From: Andrea Amorese Date: Thu, 13 Jan 2022 14:18:33 +0000 (+0100) Subject: Built motion from commit 82cba0e7.|2.6.0 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:;/%22?a=commitdiff_plain;h=1fec5f0b7919f8eead1d183fad97bc71d1882bbd;p=motion2.git Built motion from commit 82cba0e7.|2.6.0 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 7758489..e73d303 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-13T11:36:09.241Z", + "time": "2022-01-13T13:48:48.427Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 737aa26..08edf65 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-13T11:36:09.241Z", + "time": "2022-01-13T13:48:48.427Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index c2d0c16..233a8fc 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 _0x60eb=['bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser'];(function(_0x2dfd28,_0x153b3c){var _0x49c016=function(_0x1cfb4d){while(--_0x1cfb4d){_0x2dfd28['push'](_0x2dfd28['shift']());}};_0x49c016(++_0x153b3c);}(_0x60eb,0x19a));var _0xb60e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x60eb[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xb60e('0x0')]={'name':{'type':Sequelize[_0xb60e('0x1')],'get':function(_0xc62f35){return this[_0xb60e('0x2')]('action');}},'action':{'type':Sequelize[_0xb60e('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb60e('0x4'),_0xb60e('0x5'),_0xb60e('0x6'),_0xb60e('0x7'),_0xb60e('0x8'),_0xb60e('0x9'),_0xb60e('0xa'),_0xb60e('0xb')]],'msg':_0xb60e('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xb60e('0xd')},'data2':{'type':Sequelize[_0xb60e('0x3')](0x1000),'comment':_0xb60e('0xe')},'data3':{'type':Sequelize[_0xb60e('0x3')](0x1000),'comment':_0xb60e('0xf')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xb60e('0x10')},'data5':{'type':Sequelize[_0xb60e('0x3')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0xb60e('0x11')},'data7':{'type':Sequelize[_0xb60e('0x12')],'comments':_0xb60e('0x13')}}; \ No newline at end of file +var _0x6f71=['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[body]','exports','VIRTUAL','action','integration','motionbar','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x6f71,0x18a));var _0x16f7=function(_0x4de354,_0x42547e){_0x4de354=_0x4de354-0x0;var _0x5c112e=_0x6f71[_0x4de354];return _0x5c112e;};'use strict';var Sequelize=require('sequelize');module[_0x16f7('0x0')]={'name':{'type':Sequelize[_0x16f7('0x1')],'get':function(_0x2dfce6){return this['getDataValue'](_0x16f7('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x16f7('0x3'),_0x16f7('0x4'),'jscripty',_0x16f7('0x5'),'browser',_0x16f7('0x6'),_0x16f7('0x7')]],'msg':_0x16f7('0x8')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x16f7('0x9')](0x1000),'comment':_0x16f7('0xa')},'data3':{'type':Sequelize[_0x16f7('0x9')](0x1000),'comment':_0x16f7('0xb')},'data4':{'type':Sequelize[_0x16f7('0x9')](0x1000),'comments':_0x16f7('0xc')},'data5':{'type':Sequelize[_0x16f7('0x9')](0x1000),'comments':_0x16f7('0xd')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':_0x16f7('0xe')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index b61865e..aff007f 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 _0x4554=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','body','Action','find','params','catch','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x4554,0x1c5));var _0x4455=function(_0x34c4fd,_0x12e2f1){_0x34c4fd=_0x34c4fd-0x0;var _0x339ba3=_0x4554[_0x34c4fd];return _0x339ba3;};'use strict';var emlformat=require(_0x4455('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4455('0x1'));var jsonpatch=require(_0x4455('0x2'));var rp=require(_0x4455('0x3'));var moment=require('moment');var BPromise=require(_0x4455('0x4'));var Mustache=require('mustache');var util=require(_0x4455('0x5'));var path=require(_0x4455('0x6'));var sox=require(_0x4455('0x7'));var csv=require(_0x4455('0x8'));var ejs=require(_0x4455('0x9'));var fs=require('fs');var fs_extra=require(_0x4455('0xa'));var _=require(_0x4455('0xb'));var squel=require(_0x4455('0xc'));var crypto=require(_0x4455('0xd'));var jsforce=require(_0x4455('0xe'));var deskjs=require(_0x4455('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4455('0x10'));var Papa=require(_0x4455('0x11'));var Redis=require(_0x4455('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4455('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4455('0x14'));var logger=require(_0x4455('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4455('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4455('0x17'))['db'];function respondWithStatusCode(_0x2e8fd0,_0x3ee680){_0x3ee680=_0x3ee680||0xcc;return function(_0x55f715){if(_0x55f715){return _0x2e8fd0[_0x4455('0x18')](_0x3ee680);}return _0x2e8fd0[_0x4455('0x19')](_0x3ee680)[_0x4455('0x1a')]();};}function respondWithResult(_0x46f341,_0x1e8e56){_0x1e8e56=_0x1e8e56||0xc8;return function(_0x13191b){if(_0x13191b){return _0x46f341['status'](_0x1e8e56)[_0x4455('0x1b')](_0x13191b);}};}function respondWithFilteredResult(_0x3f0883,_0x2939c2){return function(_0x307d7b){if(_0x307d7b){var _0x5eedad=typeof _0x2939c2[_0x4455('0x1c')]===_0x4455('0x1d')&&typeof _0x2939c2[_0x4455('0x1e')]===_0x4455('0x1d');var _0x20567d=_0x307d7b[_0x4455('0x1f')];var _0x106159=_0x5eedad?0x0:_0x2939c2[_0x4455('0x1c')];var _0x5b85c8=_0x5eedad?_0x307d7b[_0x4455('0x1f')]:_0x2939c2['offset']+_0x2939c2[_0x4455('0x1e')];var _0x490991;if(_0x5b85c8>=_0x20567d){_0x5b85c8=_0x20567d;_0x490991=0xc8;}else{_0x490991=0xce;}_0x3f0883[_0x4455('0x19')](_0x490991);return _0x3f0883[_0x4455('0x20')](_0x4455('0x21'),_0x106159+'-'+_0x5b85c8+'/'+_0x20567d)[_0x4455('0x1b')](_0x307d7b);}return null;};}function patchUpdates(_0x1559c0){return function(_0x4b7ef3){try{jsonpatch[_0x4455('0x22')](_0x4b7ef3,_0x1559c0,!![]);}catch(_0x2f4817){return BPromise[_0x4455('0x23')](_0x2f4817);}return _0x4b7ef3['save']();};}function saveUpdates(_0x3d528a,_0x16bb0f){return function(_0x38e8bf){if(_0x38e8bf){return _0x38e8bf[_0x4455('0x24')](_0x3d528a)[_0x4455('0x25')](function(_0x408364){return _0x408364;});}return null;};}function removeEntity(_0x710baa,_0x2d81f7){return function(_0x2b9280){if(_0x2b9280){return _0x2b9280[_0x4455('0x26')]()[_0x4455('0x25')](function(){_0x710baa[_0x4455('0x19')](0xcc)[_0x4455('0x1a')]();});}};}function handleEntityNotFound(_0x51f55d,_0x282094){return function(_0x3ac638){if(!_0x3ac638){_0x51f55d[_0x4455('0x18')](0x194);}return _0x3ac638;};}function handleError(_0x1ec1ee,_0x269d6e){_0x269d6e=_0x269d6e||0x1f4;return function(_0x16a0d7){logger['error'](_0x16a0d7[_0x4455('0x27')]);if(_0x16a0d7[_0x4455('0x28')]){delete _0x16a0d7['name'];}_0x1ec1ee[_0x4455('0x19')](_0x269d6e)[_0x4455('0x29')](_0x16a0d7);};}exports[_0x4455('0x24')]=function(_0x14c402,_0x49f1c2){if(_0x14c402[_0x4455('0x2a')]['id']){delete _0x14c402[_0x4455('0x2a')]['id'];}return db[_0x4455('0x2b')][_0x4455('0x2c')]({'where':{'id':_0x14c402[_0x4455('0x2d')]['id']}})[_0x4455('0x25')](handleEntityNotFound(_0x49f1c2,null))[_0x4455('0x25')](saveUpdates(_0x14c402[_0x4455('0x2a')],null))[_0x4455('0x25')](respondWithResult(_0x49f1c2,null))[_0x4455('0x2e')](handleError(_0x49f1c2,null));};exports[_0x4455('0x26')]=function(_0xed322d,_0x5aab5c){return db[_0x4455('0x2b')][_0x4455('0x2c')]({'where':{'id':_0xed322d['params']['id']}})[_0x4455('0x25')](handleEntityNotFound(_0x5aab5c,null))[_0x4455('0x25')](removeEntity(_0x5aab5c,null))[_0x4455('0x2e')](handleError(_0x5aab5c,null));}; \ No newline at end of file +var _0x92f7=['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','undefined','count','offset','Content-Range','reject','save','update','then','end','error','stack','name','send','body','params','find','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x12461c,_0x4ffc18){var _0x13383d=function(_0x298296){while(--_0x298296){_0x12461c['push'](_0x12461c['shift']());}};_0x13383d(++_0x4ffc18);}(_0x92f7,0xe2));var _0x792f=function(_0x503564,_0x55867e){_0x503564=_0x503564-0x0;var _0x4be9fd=_0x92f7[_0x503564];return _0x4be9fd;};'use strict';var emlformat=require(_0x792f('0x0'));var rimraf=require(_0x792f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x792f('0x2'));var rp=require(_0x792f('0x3'));var moment=require(_0x792f('0x4'));var BPromise=require(_0x792f('0x5'));var Mustache=require(_0x792f('0x6'));var util=require(_0x792f('0x7'));var path=require(_0x792f('0x8'));var sox=require(_0x792f('0x9'));var csv=require(_0x792f('0xa'));var ejs=require(_0x792f('0xb'));var fs=require('fs');var fs_extra=require(_0x792f('0xc'));var _=require(_0x792f('0xd'));var squel=require(_0x792f('0xe'));var crypto=require(_0x792f('0xf'));var jsforce=require(_0x792f('0x10'));var deskjs=require(_0x792f('0x11'));var toCsv=require('to-csv');var querystring=require(_0x792f('0x12'));var Papa=require(_0x792f('0x13'));var Redis=require(_0x792f('0x14'));var authService=require(_0x792f('0x15'));var qs=require(_0x792f('0x16'));var as=require(_0x792f('0x17'));var hardwareService=require(_0x792f('0x18'));var logger=require(_0x792f('0x19'))('api');var utils=require(_0x792f('0x1a'));var config=require(_0x792f('0x1b'));var licenseUtil=require(_0x792f('0x1c'));var db=require(_0x792f('0x1d'))['db'];function respondWithStatusCode(_0x1075a9,_0x1d29ff){_0x1d29ff=_0x1d29ff||0xcc;return function(_0x57ba72){if(_0x57ba72){return _0x1075a9[_0x792f('0x1e')](_0x1d29ff);}return _0x1075a9['status'](_0x1d29ff)['end']();};}function respondWithResult(_0x5764ed,_0x24ee13){_0x24ee13=_0x24ee13||0xc8;return function(_0x5376eb){if(_0x5376eb){return _0x5764ed[_0x792f('0x1f')](_0x24ee13)['json'](_0x5376eb);}};}function respondWithFilteredResult(_0x4cfcfb,_0x2a81e0){return function(_0x380e9a){if(_0x380e9a){var _0xdd0fa8=typeof _0x2a81e0['offset']===_0x792f('0x20')&&typeof _0x2a81e0['limit']===_0x792f('0x20');var _0xea7ca4=_0x380e9a[_0x792f('0x21')];var _0x30d755=_0xdd0fa8?0x0:_0x2a81e0[_0x792f('0x22')];var _0x16f9cf=_0xdd0fa8?_0x380e9a['count']:_0x2a81e0[_0x792f('0x22')]+_0x2a81e0['limit'];var _0x37b652;if(_0x16f9cf>=_0xea7ca4){_0x16f9cf=_0xea7ca4;_0x37b652=0xc8;}else{_0x37b652=0xce;}_0x4cfcfb['status'](_0x37b652);return _0x4cfcfb['set'](_0x792f('0x23'),_0x30d755+'-'+_0x16f9cf+'/'+_0xea7ca4)['json'](_0x380e9a);}return null;};}function patchUpdates(_0x1989c4){return function(_0x1a6b4f){try{jsonpatch['apply'](_0x1a6b4f,_0x1989c4,!![]);}catch(_0x53f0cc){return BPromise[_0x792f('0x24')](_0x53f0cc);}return _0x1a6b4f[_0x792f('0x25')]();};}function saveUpdates(_0x105c0b,_0x398893){return function(_0x5a8212){if(_0x5a8212){return _0x5a8212[_0x792f('0x26')](_0x105c0b)[_0x792f('0x27')](function(_0x3d324f){return _0x3d324f;});}return null;};}function removeEntity(_0x34c3ce,_0x2b82d3){return function(_0x54ac6d){if(_0x54ac6d){return _0x54ac6d['destroy']()['then'](function(){_0x34c3ce['status'](0xcc)[_0x792f('0x28')]();});}};}function handleEntityNotFound(_0x6e14ca,_0xe5082c){return function(_0x4d227c){if(!_0x4d227c){_0x6e14ca[_0x792f('0x1e')](0x194);}return _0x4d227c;};}function handleError(_0x2e1ded,_0x31e75c){_0x31e75c=_0x31e75c||0x1f4;return function(_0x583b32){logger[_0x792f('0x29')](_0x583b32[_0x792f('0x2a')]);if(_0x583b32['name']){delete _0x583b32[_0x792f('0x2b')];}_0x2e1ded[_0x792f('0x1f')](_0x31e75c)[_0x792f('0x2c')](_0x583b32);};}exports[_0x792f('0x26')]=function(_0x252d8e,_0x5be296){if(_0x252d8e[_0x792f('0x2d')]['id']){delete _0x252d8e[_0x792f('0x2d')]['id'];}return db['Action']['find']({'where':{'id':_0x252d8e[_0x792f('0x2e')]['id']}})[_0x792f('0x27')](handleEntityNotFound(_0x5be296,null))[_0x792f('0x27')](saveUpdates(_0x252d8e[_0x792f('0x2d')],null))[_0x792f('0x27')](respondWithResult(_0x5be296,null))['catch'](handleError(_0x5be296,null));};exports['destroy']=function(_0x592c28,_0x1a7c21){return db['Action'][_0x792f('0x2f')]({'where':{'id':_0x592c28[_0x792f('0x2e')]['id']}})[_0x792f('0x27')](handleEntityNotFound(_0x1a7c21,null))[_0x792f('0x27')](removeEntity(_0x1a7c21,null))[_0x792f('0x30')](handleError(_0x1a7c21,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index bba6c59..a1bd245 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 _0x86fe=['./action.attributes','define','Action','tools_actions','moment','request-promise','rimraf','../../config/environment'];(function(_0x433b86,_0x519ff8){var _0x3c961a=function(_0x1c6160){while(--_0x1c6160){_0x433b86['push'](_0x433b86['shift']());}};_0x3c961a(++_0x519ff8);}(_0x86fe,0x1a4));var _0xe86f=function(_0x3ba654,_0x5ba21d){_0x3ba654=_0x3ba654-0x0;var _0x22559c=_0x86fe[_0x3ba654];return _0x22559c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe86f('0x0'));var BPromise=require('bluebird');var rp=require(_0xe86f('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe86f('0x2'));var config=require(_0xe86f('0x3'));var attributes=require(_0xe86f('0x4'));module['exports']=function(_0x4ad27a,_0x145608){return _0x4ad27a[_0xe86f('0x5')](_0xe86f('0x6'),attributes,{'tableName':_0xe86f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc175=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action'];(function(_0x4e8eaf,_0x1aad5b){var _0x1329cc=function(_0x4003e6){while(--_0x4003e6){_0x4e8eaf['push'](_0x4e8eaf['shift']());}};_0x1329cc(++_0x1aad5b);}(_0xc175,0x196));var _0x5c17=function(_0x16f753,_0x283960){_0x16f753=_0x16f753-0x0;var _0x234ad1=_0xc175[_0x16f753];return _0x234ad1;};'use strict';var _=require(_0x5c17('0x0'));var util=require(_0x5c17('0x1'));var logger=require(_0x5c17('0x2'))(_0x5c17('0x3'));var moment=require(_0x5c17('0x4'));var BPromise=require(_0x5c17('0x5'));var rp=require(_0x5c17('0x6'));var fs=require('fs');var path=require(_0x5c17('0x7'));var rimraf=require(_0x5c17('0x8'));var config=require(_0x5c17('0x9'));var attributes=require(_0x5c17('0xa'));module[_0x5c17('0xb')]=function(_0x13b557,_0x485105){return _0x13b557[_0x5c17('0xc')](_0x5c17('0xd'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index f019988..666c432 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 _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1bbe73,_0x3f6256){var _0x51ec71=function(_0x5351cc){while(--_0x5351cc){_0x1bbe73['push'](_0x1bbe73['shift']());}};_0x51ec71(++_0x3f6256);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x57163b,_0x41db5f){_0x57163b=_0x57163b-0x0;var _0x13c1ea=_0x7fbe[_0x57163b];return _0x13c1ea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x270ce8,_0x1b1cd7){var _0x1fcec9=function(_0x324169){while(--_0x324169){_0x270ce8['push'](_0x270ce8['shift']());}};_0x1fcec9(++_0x1b1cd7);}(_0x326f,0xd1));var _0xf326=function(_0x42f1f6,_0x29dcd8){_0x42f1f6=_0x42f1f6-0x0;var _0x1d19d8=_0x326f[_0x42f1f6];return _0x1d19d8;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 0012707..e6f636d 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 _0x8237=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x2316f5,_0x403eef){var _0x3da9a2=function(_0x2d0e63){while(--_0x2d0e63){_0x2316f5['push'](_0x2316f5['shift']());}};_0x3da9a2(++_0x403eef);}(_0x8237,0xd2));var _0x7823=function(_0x29a8a2,_0x5c1a93){_0x29a8a2=_0x29a8a2-0x0;var _0x5d01c6=_0x8237[_0x29a8a2];return _0x5d01c6;};'use strict';var multer=require('multer');var util=require(_0x7823('0x0'));var path=require('path');var timeout=require(_0x7823('0x1'));var express=require(_0x7823('0x2'));var router=express[_0x7823('0x3')]();var fs_extra=require(_0x7823('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7823('0x5'));var config=require(_0x7823('0x6'));var controller=require(_0x7823('0x7'));router[_0x7823('0x8')](_0x7823('0x9'),auth[_0x7823('0xa')](),controller[_0x7823('0xb')]);router[_0x7823('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x7823('0xd')]);module[_0x7823('0xe')]=router; \ No newline at end of file +var _0xbea9=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update'];(function(_0x9c5512,_0x5651f1){var _0x5c4f5d=function(_0x4f29ac){while(--_0x4f29ac){_0x9c5512['push'](_0x9c5512['shift']());}};_0x5c4f5d(++_0x5651f1);}(_0xbea9,0x113));var _0x9bea=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbea9[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x9bea('0x0'));var path=require(_0x9bea('0x1'));var timeout=require(_0x9bea('0x2'));var express=require(_0x9bea('0x3'));var router=express[_0x9bea('0x4')]();var fs_extra=require(_0x9bea('0x5'));var auth=require(_0x9bea('0x6'));var interaction=require(_0x9bea('0x7'));var config=require(_0x9bea('0x8'));var controller=require('./action.controller');router[_0x9bea('0x9')](_0x9bea('0xa'),auth[_0x9bea('0xb')](),controller[_0x9bea('0xc')]);router[_0x9bea('0xd')](_0x9bea('0xa'),auth[_0x9bea('0xb')](),controller[_0x9bea('0xe')]);module[_0x9bea('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 6047285..cfa3b12 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 _0xd8fb=['TEXT','sequelize','exports','STRING'];(function(_0x2c5bbb,_0x468642){var _0x38f37d=function(_0x466f17){while(--_0x466f17){_0x2c5bbb['push'](_0x2c5bbb['shift']());}};_0x38f37d(++_0x468642);}(_0xd8fb,0x99));var _0xbd8f=function(_0x3af7bc,_0x5a5a56){_0x3af7bc=_0x3af7bc-0x0;var _0x3e78de=_0xd8fb[_0x3af7bc];return _0x3e78de;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file +var _0x2bd8=['TEXT','sequelize','STRING'];(function(_0x49ed0c,_0x2dff38){var _0x5b1bd2=function(_0x3516a3){while(--_0x3516a3){_0x49ed0c['push'](_0x49ed0c['shift']());}};_0x5b1bd2(++_0x2dff38);}(_0x2bd8,0x130));var _0x82bd=function(_0x2196df,_0x435d7e){_0x2196df=_0x2196df-0x0;var _0x119d3a=_0x2bd8[_0x2196df];return _0x119d3a;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x82bd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x82bd('0x1')]},'parent':{'type':Sequelize[_0x82bd('0x1')]},'table':{'type':Sequelize[_0x82bd('0x1')]},'conditions':{'type':Sequelize[_0x82bd('0x2')]},'joins':{'type':Sequelize[_0x82bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index a053eb5..d982603 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 _0xfb07=['fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','name','index','map','AnalyticCustomReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','body','user','userProfileId','autoAssociation','create','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','table','MetricId','function','format','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','left_join','ROUND(%s)','UNIX_TIMESTAMP(%s)','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','metric','output','web','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','eml-format','request-promise','mustache','util','sox','ejs'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfb07,0x94));var _0x7fb0=function(_0x52c4a6,_0x40a97c){_0x52c4a6=_0x52c4a6-0x0;var _0x10d194=_0xfb07[_0x52c4a6];return _0x10d194;};'use strict';var emlformat=require(_0x7fb0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7fb0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7fb0('0x2'));var util=require(_0x7fb0('0x3'));var path=require('path');var sox=require(_0x7fb0('0x4'));var csv=require('to-csv');var ejs=require(_0x7fb0('0x5'));var fs=require('fs');var fs_extra=require(_0x7fb0('0x6'));var _=require('lodash');var squel=require(_0x7fb0('0x7'));var crypto=require(_0x7fb0('0x8'));var jsforce=require(_0x7fb0('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7fb0('0xa'));var Papa=require(_0x7fb0('0xb'));var Redis=require('ioredis');var authService=require(_0x7fb0('0xc'));var qs=require(_0x7fb0('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fb0('0xe'))('api');var utils=require(_0x7fb0('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7fb0('0x10'))['db'];var dbH=require(_0x7fb0('0x10'))['dbH'];function respondWithStatusCode(_0x116628,_0x1cc287){_0x1cc287=_0x1cc287||0xcc;return function(_0x2080e4){if(_0x2080e4){return _0x116628[_0x7fb0('0x11')](_0x1cc287);}return _0x116628[_0x7fb0('0x12')](_0x1cc287)[_0x7fb0('0x13')]();};}function respondWithResult(_0x31c060,_0x1cc611){_0x1cc611=_0x1cc611||0xc8;return function(_0x12d3ef){if(_0x12d3ef){return _0x31c060[_0x7fb0('0x12')](_0x1cc611)['json'](_0x12d3ef);}};}function respondWithFilteredResult(_0x15da92,_0x3a8715){return function(_0x4fce28){if(_0x4fce28){var _0xc8dedf=typeof _0x3a8715['offset']===_0x7fb0('0x14')&&typeof _0x3a8715[_0x7fb0('0x15')]===_0x7fb0('0x14');var _0x5de6f8=_0x4fce28[_0x7fb0('0x16')];var _0x46de43=_0xc8dedf?0x0:_0x3a8715['offset'];var _0x42c290=_0xc8dedf?_0x4fce28[_0x7fb0('0x16')]:_0x3a8715[_0x7fb0('0x17')]+_0x3a8715[_0x7fb0('0x15')];var _0x35106c;if(_0x42c290>=_0x5de6f8){_0x42c290=_0x5de6f8;_0x35106c=0xc8;}else{_0x35106c=0xce;}_0x15da92['status'](_0x35106c);return _0x15da92[_0x7fb0('0x18')](_0x7fb0('0x19'),_0x46de43+'-'+_0x42c290+'/'+_0x5de6f8)['json'](_0x4fce28);}return null;};}function patchUpdates(_0x4944f9){return function(_0x54b68e){try{jsonpatch[_0x7fb0('0x1a')](_0x54b68e,_0x4944f9,!![]);}catch(_0x11df9b){return BPromise['reject'](_0x11df9b);}return _0x54b68e[_0x7fb0('0x1b')]();};}function saveUpdates(_0x1a0dae,_0x3caee0){return function(_0x1bda25){if(_0x1bda25){return _0x1bda25[_0x7fb0('0x1c')](_0x1a0dae)[_0x7fb0('0x1d')](function(_0x43c8d3){return _0x43c8d3;});}return null;};}function removeEntity(_0x532eae,_0x274cb4){return function(_0x51b474){if(_0x51b474){return _0x51b474['destroy']()[_0x7fb0('0x1d')](function(){var _0x28e623=_0x51b474[_0x7fb0('0x1e')]({'plain':!![]});var _0xe00ba='CustomReports';return db[_0x7fb0('0x1f')][_0x7fb0('0x20')]({'where':{'type':_0xe00ba,'resourceId':_0x28e623['id']}})['then'](function(){return _0x51b474;});})[_0x7fb0('0x1d')](function(){_0x532eae[_0x7fb0('0x12')](0xcc)[_0x7fb0('0x13')]();});}};}function handleEntityNotFound(_0x53f147,_0x3b6764){return function(_0x442d6c){if(!_0x442d6c){_0x53f147[_0x7fb0('0x11')](0x194);}return _0x442d6c;};}function handleError(_0x569bd2,_0x4f1b6){_0x4f1b6=_0x4f1b6||0x1f4;return function(_0xd2e1e9){logger['error'](_0xd2e1e9['stack']);if(_0xd2e1e9[_0x7fb0('0x21')]){delete _0xd2e1e9[_0x7fb0('0x21')];}_0x569bd2[_0x7fb0('0x12')](_0x4f1b6)['send'](_0xd2e1e9);};}exports[_0x7fb0('0x22')]=function(_0x3b1beb,_0x2c5ed3){var _0x23c6b7={},_0x150a7d={},_0x3d33e3={'count':0x0,'rows':[]};var _0x42ac82=_[_0x7fb0('0x23')](db[_0x7fb0('0x24')]['rawAttributes'],function(_0x4c30e7){return{'name':_0x4c30e7[_0x7fb0('0x25')],'type':_0x4c30e7[_0x7fb0('0x26')][_0x7fb0('0x27')]};});_0x150a7d[_0x7fb0('0x28')]=_[_0x7fb0('0x23')](_0x42ac82,'name');_0x150a7d[_0x7fb0('0x29')]=_[_0x7fb0('0x2a')](_0x3b1beb[_0x7fb0('0x29')]);_0x150a7d[_0x7fb0('0x2b')]=_['intersection'](_0x150a7d[_0x7fb0('0x28')],_0x150a7d[_0x7fb0('0x29')]);_0x23c6b7[_0x7fb0('0x2c')]=_[_0x7fb0('0x2d')](_0x150a7d[_0x7fb0('0x28')],qs[_0x7fb0('0x2e')](_0x3b1beb[_0x7fb0('0x29')][_0x7fb0('0x2e')]));_0x23c6b7['attributes']=_0x23c6b7[_0x7fb0('0x2c')]['length']?_0x23c6b7['attributes']:_0x150a7d[_0x7fb0('0x28')];if(!_0x3b1beb[_0x7fb0('0x29')][_0x7fb0('0x2f')]('nolimit')){_0x23c6b7[_0x7fb0('0x15')]=qs[_0x7fb0('0x15')](_0x3b1beb[_0x7fb0('0x29')]['limit']);_0x23c6b7[_0x7fb0('0x17')]=qs[_0x7fb0('0x17')](_0x3b1beb[_0x7fb0('0x29')][_0x7fb0('0x17')]);}_0x23c6b7['order']=qs[_0x7fb0('0x30')](_0x3b1beb[_0x7fb0('0x29')][_0x7fb0('0x30')]);_0x23c6b7[_0x7fb0('0x31')]=qs['filters'](_[_0x7fb0('0x32')](_0x3b1beb[_0x7fb0('0x29')],_0x150a7d[_0x7fb0('0x2b')]),_0x42ac82);if(_0x3b1beb[_0x7fb0('0x29')][_0x7fb0('0x33')]){_0x23c6b7[_0x7fb0('0x31')]=_[_0x7fb0('0x34')](_0x23c6b7['where'],{'$or':_[_0x7fb0('0x23')](_0x42ac82,function(_0x410817){if(_0x410817['type']!=='VIRTUAL'){var _0x37331b={};_0x37331b[_0x410817['name']]={'$like':'%'+_0x3b1beb[_0x7fb0('0x29')][_0x7fb0('0x33')]+'%'};return _0x37331b;}})});}_0x23c6b7=_['merge']({},_0x23c6b7,_0x3b1beb[_0x7fb0('0x35')]);var _0x26eee3={'where':_0x23c6b7['where']};return db[_0x7fb0('0x24')][_0x7fb0('0x16')](_0x26eee3)[_0x7fb0('0x1d')](function(_0x35c251){_0x3d33e3[_0x7fb0('0x16')]=_0x35c251;if(_0x3b1beb[_0x7fb0('0x29')][_0x7fb0('0x36')]){_0x23c6b7[_0x7fb0('0x37')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x7fb0('0x38')](_0x23c6b7);})[_0x7fb0('0x1d')](function(_0x1dbe09){_0x3d33e3[_0x7fb0('0x39')]=_0x1dbe09;return _0x3d33e3;})[_0x7fb0('0x1d')](respondWithFilteredResult(_0x2c5ed3,_0x23c6b7))[_0x7fb0('0x3a')](handleError(_0x2c5ed3,null));};exports['show']=function(_0x4c2653,_0x22ebf7){var _0x2387a0={'raw':![],'where':{'id':_0x4c2653[_0x7fb0('0x3b')]['id']}},_0x42c44e={};_0x42c44e['model']=_['keys'](db[_0x7fb0('0x24')]['rawAttributes']);_0x42c44e[_0x7fb0('0x29')]=_['keys'](_0x4c2653['query']);_0x42c44e[_0x7fb0('0x2b')]=_[_0x7fb0('0x2d')](_0x42c44e['model'],_0x42c44e[_0x7fb0('0x29')]);_0x2387a0[_0x7fb0('0x2c')]=_['intersection'](_0x42c44e[_0x7fb0('0x28')],qs[_0x7fb0('0x2e')](_0x4c2653['query'][_0x7fb0('0x2e')]));_0x2387a0[_0x7fb0('0x2c')]=_0x2387a0[_0x7fb0('0x2c')][_0x7fb0('0x3c')]?_0x2387a0[_0x7fb0('0x2c')]:_0x42c44e['model'];if(_0x4c2653['query'][_0x7fb0('0x36')]){_0x2387a0[_0x7fb0('0x37')]=[{'all':!![]}];}_0x2387a0=_[_0x7fb0('0x34')]({},_0x2387a0,_0x4c2653[_0x7fb0('0x35')]);return db[_0x7fb0('0x24')][_0x7fb0('0x3d')](_0x2387a0)[_0x7fb0('0x1d')](handleEntityNotFound(_0x22ebf7,null))[_0x7fb0('0x1d')](respondWithResult(_0x22ebf7,null))[_0x7fb0('0x3a')](handleError(_0x22ebf7,null));};exports['create']=function(_0x5a3a92,_0x318444){return db[_0x7fb0('0x24')]['create'](_0x5a3a92[_0x7fb0('0x3e')],{})[_0x7fb0('0x1d')](function(_0x5c9f8d){var _0x5d9c29=_0x5a3a92[_0x7fb0('0x3f')][_0x7fb0('0x1e')]({'plain':!![]});if(!_0x5d9c29)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d9c29['role']===_0x7fb0('0x3f')){var _0x5085b8=_0x5c9f8d['get']({'plain':!![]});var _0x4a2170='Reports';return db['UserProfileSection'][_0x7fb0('0x3d')]({'where':{'name':_0x4a2170,'userProfileId':_0x5d9c29[_0x7fb0('0x40')]},'raw':!![]})['then'](function(_0x2afc81){if(_0x2afc81&&_0x2afc81[_0x7fb0('0x41')]===0x0){return db[_0x7fb0('0x1f')][_0x7fb0('0x42')]({'name':_0x5085b8[_0x7fb0('0x21')],'resourceId':_0x5085b8['id'],'type':_0x7fb0('0x43'),'sectionId':_0x2afc81['id']},{})['then'](function(){return _0x5c9f8d;});}else{return _0x5c9f8d;}})['catch'](function(_0x5e9f9f){logger[_0x7fb0('0x44')](_0x7fb0('0x45'),_0x5e9f9f);throw _0x5e9f9f;});}return _0x5c9f8d;})[_0x7fb0('0x1d')](respondWithResult(_0x318444,0xc9))[_0x7fb0('0x3a')](handleError(_0x318444,null));};exports['update']=function(_0x4b5a78,_0x350c7b){if(_0x4b5a78['body']['id']){delete _0x4b5a78[_0x7fb0('0x3e')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x4b5a78[_0x7fb0('0x3b')]['id']}})[_0x7fb0('0x1d')](handleEntityNotFound(_0x350c7b,null))[_0x7fb0('0x1d')](saveUpdates(_0x4b5a78[_0x7fb0('0x3e')],null))[_0x7fb0('0x1d')](respondWithResult(_0x350c7b,null))['catch'](handleError(_0x350c7b,null));};exports['destroy']=function(_0x389892,_0x5df8d2){return db[_0x7fb0('0x24')][_0x7fb0('0x3d')]({'where':{'id':_0x389892[_0x7fb0('0x3b')]['id']}})[_0x7fb0('0x1d')](handleEntityNotFound(_0x5df8d2,null))[_0x7fb0('0x1d')](removeEntity(_0x5df8d2,null))[_0x7fb0('0x3a')](handleError(_0x5df8d2,null));};exports['preview']=function(_0x472aa9,_0x41cec8){var _0x2dbcdc=0xa;var _0x381faa=['join','left_join',_0x7fb0('0x46'),_0x7fb0('0x47')];var _0x13d697={'SUM':_0x7fb0('0x48'),'COUNT':_0x7fb0('0x49'),'COUNT DISTINCT':_0x7fb0('0x4a'),'MAX':_0x7fb0('0x4b'),'MIN':_0x7fb0('0x4c'),'AVG':_0x7fb0('0x4d'),'GROUP_CONCAT':_0x7fb0('0x4e'),'GROUP_CONCAT ASC':_0x7fb0('0x4f'),'GROUP_CONCAT DESC':_0x7fb0('0x50')};var _0x5d3f3d={'SEC_TO_TIME':_0x7fb0('0x51'),'DATE':_0x7fb0('0x52'),'HOUR':_0x7fb0('0x53'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xfa4e46=function(_0x2ee25a){return!_[_0x7fb0('0x54')](['IS\x20NULL',_0x7fb0('0x55'),_0x7fb0('0x56'),_0x7fb0('0x57')],_0x2ee25a);};var _0x18d495=function(_0x34efa1){if(!_0x34efa1||!_0x34efa1[_0x7fb0('0x58')][_0x7fb0('0x3c')]){return'';}for(var _0x57ccf1='(',_0x43b183=0x0;_0x43b183<_0x34efa1[_0x7fb0('0x58')][_0x7fb0('0x3c')];_0x43b183+=0x1){_0x43b183>0x0&&(_0x57ccf1+='\x20'+_0x34efa1[_0x7fb0('0x59')]+'\x20');_0x57ccf1+=_0x34efa1['rules'][_0x43b183][_0x7fb0('0x5a')]?_0x18d495(_0x34efa1['rules'][_0x43b183][_0x7fb0('0x5a')]):_0x34efa1[_0x7fb0('0x58')][_0x43b183][_0x7fb0('0x5b')]+'\x20'+_0x34efa1[_0x7fb0('0x58')][_0x43b183][_0x7fb0('0x5c')]+(_0xfa4e46(_0x34efa1[_0x7fb0('0x58')][_0x43b183][_0x7fb0('0x5c')])?'\x20'+_0x34efa1[_0x7fb0('0x58')][_0x43b183][_0x7fb0('0x5d')]:'');}return _0x57ccf1+')';};var _0x342c84={'where':{'id':_0x472aa9[_0x7fb0('0x3b')]['id']}},_0x38ab34,_0x5a86ac,_0x2d170,_0x4d894f,_0xae8fa;_0x342c84=_['merge']({},_0x342c84,_0x472aa9[_0x7fb0('0x35')]);return db['AnalyticCustomReport']['find'](_0x342c84)['then'](function(_0x297839){if(_0x297839){_0x38ab34=_0x297839;return _0x297839[_0x7fb0('0x5e')]();}return null;})['then'](function(_0x1503f7){if(_0x1503f7){if(!_0x1503f7['length']){throw new db['Sequelize'][(_0x7fb0('0x5f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5a86ac=_0x1503f7;return db[_0x7fb0('0x60')][_0x7fb0('0x38')]({'raw':!![]});}return null;})[_0x7fb0('0x1d')](function(_0x251e36){if(_0x251e36){_0x2d170=_['keyBy'](_0x251e36,'id');var _0x21aa2e;var _0x536f59=squel['select']();_0x536f59['from'](_0x38ab34[_0x7fb0('0x61')]);for(var _0x244a84=0x0;_0x244a84<_0x5a86ac[_0x7fb0('0x3c')];_0x244a84+=0x1){_0x21aa2e=_0x5a86ac[_0x244a84]['MetricId']?_0x2d170[_0x5a86ac[_0x244a84][_0x7fb0('0x62')]]['metric']:_0x5a86ac[_0x244a84][_0x7fb0('0x5b')];_0x21aa2e=_0x5a86ac[_0x244a84][_0x7fb0('0x63')]?_['replace'](_0x13d697[_0x5a86ac[_0x244a84][_0x7fb0('0x63')]],'%s',_0x21aa2e):_0x21aa2e;_0x21aa2e=_0x5a86ac[_0x244a84][_0x7fb0('0x64')]?_[_0x7fb0('0x65')](_0x5d3f3d[_0x5a86ac[_0x244a84]['format']],'%s',_0x21aa2e):_0x21aa2e;if(_0x5a86ac[_0x244a84][_0x7fb0('0x66')]){_0x536f59['group'](_0x21aa2e);}_0x5a86ac[_0x244a84][_0x7fb0('0x67')]&&_0x536f59[_0x7fb0('0x68')](_0x21aa2e,_0x5a86ac[_0x244a84]['orderBy']===_0x7fb0('0x69')?![]:!![]);_0x536f59['field'](_0x21aa2e,_0x5a86ac[_0x244a84][_0x7fb0('0x6a')]||_0x21aa2e);}if(_0x38ab34[_0x7fb0('0x6b')]){_0x38ab34[_0x7fb0('0x6b')]=JSON[_0x7fb0('0x6c')](_0x38ab34[_0x7fb0('0x6b')]);for(var _0x3f1ff1=0x0;_0x3f1ff1<_0x38ab34[_0x7fb0('0x6b')][_0x7fb0('0x3c')];_0x3f1ff1+=0x1){if(_0x38ab34[_0x7fb0('0x6b')][_0x3f1ff1][_0x7fb0('0x26')]&&_[_0x7fb0('0x54')](_0x381faa,_0x38ab34[_0x7fb0('0x6b')][_0x3f1ff1][_0x7fb0('0x26')])&&_0x38ab34[_0x7fb0('0x6b')][_0x3f1ff1][_0x7fb0('0x6d')]&&_0x38ab34['joins'][_0x3f1ff1][_0x7fb0('0x6e')]&&_0x38ab34[_0x7fb0('0x6b')][_0x3f1ff1][_0x7fb0('0x6f')]){_0x536f59[_0x38ab34[_0x7fb0('0x6b')][_0x3f1ff1][_0x7fb0('0x26')]](_0x38ab34[_0x7fb0('0x6b')][_0x3f1ff1][_0x7fb0('0x6e')],null,util['format'](_0x7fb0('0x70'),_0x38ab34[_0x7fb0('0x61')],_0x38ab34[_0x7fb0('0x6b')][_0x3f1ff1][_0x7fb0('0x6d')],_0x38ab34[_0x7fb0('0x6b')][_0x3f1ff1][_0x7fb0('0x6e')],_0x38ab34[_0x7fb0('0x6b')][_0x3f1ff1][_0x7fb0('0x6f')]));}}}if(_0x38ab34[_0x7fb0('0x71')]){_0x38ab34[_0x7fb0('0x71')]=JSON[_0x7fb0('0x6c')](_0x38ab34[_0x7fb0('0x71')]);_0x536f59[_0x7fb0('0x31')](_0x18d495(_0x38ab34[_0x7fb0('0x71')][_0x7fb0('0x5a')]));}_0xae8fa=_0x536f59[_0x7fb0('0x72')]();_0x536f59[_0x7fb0('0x15')](_0x2dbcdc);_0x536f59['offset'](0x0);logger[_0x7fb0('0x73')](_0x7fb0('0x74'),_0x536f59[_0x7fb0('0x75')]());return dbH[_0x7fb0('0x76')][_0x7fb0('0x29')](_0x536f59[_0x7fb0('0x75')](),{'type':dbH['sequelize'][_0x7fb0('0x77')][_0x7fb0('0x78')]});}})['then'](respondWithResult(_0x41cec8,null))[_0x7fb0('0x3a')](handleError(_0x41cec8,null));};function runReport(_0x4d2393,_0x118d05,_0x2f0e3b){var _0x3a2a0e=_0x118d05[_0x7fb0('0x21')];var _0x43c82b=0xa;var _0xea587f=[_0x7fb0('0x79'),_0x7fb0('0x7a'),'right_join',_0x7fb0('0x47')];var _0x57d7be={'SUM':_0x7fb0('0x48'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7fb0('0x4a'),'MAX':_0x7fb0('0x4b'),'MIN':_0x7fb0('0x4c'),'AVG':_0x7fb0('0x4d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7fb0('0x4f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1bd3ff={'SEC_TO_TIME':_0x7fb0('0x51'),'DATE':_0x7fb0('0x52'),'HOUR':_0x7fb0('0x53'),'ROUND':_0x7fb0('0x7b'),'UNIX_TIMESTAMP':_0x7fb0('0x7c')};var _0x538512=function(_0x5ca8b9){return!_[_0x7fb0('0x54')](['IS\x20NULL',_0x7fb0('0x55'),_0x7fb0('0x56'),_0x7fb0('0x57')],_0x5ca8b9);};var _0x35cfea=function(_0x439686){if(!_0x439686||!_0x439686[_0x7fb0('0x58')][_0x7fb0('0x3c')]){return'';}for(var _0x19b70f='(',_0x192d8f=0x0;_0x192d8f<_0x439686['rules'][_0x7fb0('0x3c')];_0x192d8f+=0x1){_0x192d8f>0x0&&(_0x19b70f+='\x20'+_0x439686[_0x7fb0('0x59')]+'\x20');_0x19b70f+=_0x439686[_0x7fb0('0x58')][_0x192d8f][_0x7fb0('0x5a')]?_0x35cfea(_0x439686[_0x7fb0('0x58')][_0x192d8f]['group']):_0x439686['rules'][_0x192d8f][_0x7fb0('0x5b')]+'\x20'+_0x439686[_0x7fb0('0x58')][_0x192d8f]['condition']+(_0x538512(_0x439686[_0x7fb0('0x58')][_0x192d8f][_0x7fb0('0x5c')])?'\x20'+_0x439686['rules'][_0x192d8f][_0x7fb0('0x5d')]:'');}return _0x19b70f+')';};var _0x596886={'where':{'id':_0x4d2393['id']}},_0x171025,_0x451795,_0x1b9ed5,_0x1bc916,_0x4be320;_0x596886=_['merge']({},_0x596886,_0x2f0e3b);return db['AnalyticCustomReport'][_0x7fb0('0x3d')](_0x596886)[_0x7fb0('0x1d')](function(_0x25e04d){if(_0x25e04d){_0x171025=_0x25e04d;return _0x25e04d[_0x7fb0('0x5e')]();}return null;})['then'](function(_0x3a624e){if(_0x3a624e){if(!_0x3a624e[_0x7fb0('0x3c')]){throw new db[(_0x7fb0('0x7d'))]['ValidationErrorItem'](_0x7fb0('0x7e'),0x193);}_0x451795=_0x3a624e;return db[_0x7fb0('0x60')]['findAll']({'raw':!![]});}return null;})[_0x7fb0('0x1d')](function(_0xf7a1f8){if(_0xf7a1f8){_0x1b9ed5=_[_0x7fb0('0x7f')](_0xf7a1f8,'id');var _0x15912b;var _0x30e8e8=squel[_0x7fb0('0x80')]();_0x30e8e8[_0x7fb0('0x81')](_0x171025[_0x7fb0('0x61')]);for(var _0x231ef8=0x0;_0x231ef8<_0x451795[_0x7fb0('0x3c')];_0x231ef8+=0x1){_0x15912b=_0x451795[_0x231ef8][_0x7fb0('0x62')]?_0x1b9ed5[_0x451795[_0x231ef8]['MetricId']][_0x7fb0('0x82')]:_0x451795[_0x231ef8][_0x7fb0('0x5b')];_0x15912b=_0x451795[_0x231ef8][_0x7fb0('0x63')]?_['replace'](_0x57d7be[_0x451795[_0x231ef8]['function']],'%s',_0x15912b):_0x15912b;_0x15912b=_0x451795[_0x231ef8][_0x7fb0('0x64')]?_['replace'](_0x1bd3ff[_0x451795[_0x231ef8][_0x7fb0('0x64')]],'%s',_0x15912b):_0x15912b;if(_0x451795[_0x231ef8][_0x7fb0('0x66')]){_0x30e8e8[_0x7fb0('0x5a')](_0x15912b);}_0x451795[_0x231ef8][_0x7fb0('0x67')]&&_0x30e8e8['order'](_0x15912b,_0x451795[_0x231ef8][_0x7fb0('0x67')]===_0x7fb0('0x69')?![]:!![]);_0x30e8e8['field'](_0x15912b,_0x451795[_0x231ef8][_0x7fb0('0x6a')]||_0x15912b);}if(_0x171025[_0x7fb0('0x6b')]){_0x171025[_0x7fb0('0x6b')]=JSON[_0x7fb0('0x6c')](_0x171025[_0x7fb0('0x6b')]);for(var _0x305d49=0x0;_0x305d49<_0x171025[_0x7fb0('0x6b')][_0x7fb0('0x3c')];_0x305d49+=0x1){if(_0x171025[_0x7fb0('0x6b')][_0x305d49][_0x7fb0('0x26')]&&_[_0x7fb0('0x54')](_0xea587f,_0x171025[_0x7fb0('0x6b')][_0x305d49][_0x7fb0('0x26')])&&_0x171025[_0x7fb0('0x6b')][_0x305d49]['parentKey']&&_0x171025[_0x7fb0('0x6b')][_0x305d49]['foreignTable']&&_0x171025[_0x7fb0('0x6b')][_0x305d49][_0x7fb0('0x6f')]){_0x30e8e8[_0x171025[_0x7fb0('0x6b')][_0x305d49]['type']](_0x171025[_0x7fb0('0x6b')][_0x305d49][_0x7fb0('0x6e')],null,util['format'](_0x7fb0('0x70'),_0x171025['table'],_0x171025['joins'][_0x305d49][_0x7fb0('0x6d')],_0x171025[_0x7fb0('0x6b')][_0x305d49][_0x7fb0('0x6e')],_0x171025[_0x7fb0('0x6b')][_0x305d49][_0x7fb0('0x6f')]));}}}if(_0x171025[_0x7fb0('0x71')]){_0x171025['conditions']=JSON[_0x7fb0('0x6c')](_0x171025[_0x7fb0('0x71')]);_0x30e8e8[_0x7fb0('0x31')](_0x35cfea(_0x171025[_0x7fb0('0x71')]['group']));}_0x4be320=_0x30e8e8['clone']();_0x30e8e8[_0x7fb0('0x15')](_0x43c82b);_0x30e8e8[_0x7fb0('0x17')](0x0);return;}})[_0x7fb0('0x1d')](function(){if(_0x118d05[_0x7fb0('0x83')]===_0x7fb0('0x84')){return null;}var _0xa85ab8=_[_0x7fb0('0x34')](_0x118d05,{'name':_0x118d05['fullPath']||_0x118d05[_0x7fb0('0x21')]||_0x171025['name'],'basename':_0x3a2a0e,'savename':util[_0x7fb0('0x64')]('%s-%s.%s',_0x118d05[_0x7fb0('0x21')]||_0x171025[_0x7fb0('0x21')],require(_0x7fb0('0x85'))[_0x7fb0('0x86')](0x4),_0x118d05['output']||_0x7fb0('0x87')),'reportId':_0x171025['id'],'reportType':_0x7fb0('0x88')});return db[_0x7fb0('0x89')][_0x7fb0('0x42')](_0xa85ab8,{'raw':!![]});})[_0x7fb0('0x1d')](function(_0x2da686){if(_0x171025[_0x7fb0('0x61')]===_0x7fb0('0x8a')){_0x4be320[_0x7fb0('0x31')](_0x171025[_0x7fb0('0x61')]+_0x7fb0('0x8b'),_0x118d05[_0x7fb0('0x8c')],_0x118d05[_0x7fb0('0x8d')]);}else{_0x4be320[_0x7fb0('0x31')](_0x171025[_0x7fb0('0x61')]+_0x7fb0('0x8e'),_0x118d05[_0x7fb0('0x8c')],_0x118d05[_0x7fb0('0x8d')]);}if(_0x2da686){logger[_0x7fb0('0x8f')](_0x7fb0('0x90'),_0x4be320['toString']());require(_0x7fb0('0x91'))[_0x7fb0('0x92')](path['join'](__dirname,_0x7fb0('0x93'),_0x2da686[_0x7fb0('0x83')]),[_0x2da686['id'],_0x4be320[_0x7fb0('0x75')](),path['join'](__dirname,_0x7fb0('0x94'),_0x2da686[_0x7fb0('0x95')]),_0x3a2a0e]);return _0x2da686;}else{var _0x566a63=squel[_0x7fb0('0x80')]();_0x566a63[_0x7fb0('0x81')]('('+_0x4be320['toString']()+')',_0x7fb0('0x96'));_0x566a63[_0x7fb0('0x5b')](_0x7fb0('0x97'),_0x7fb0('0x16'));_0x4be320['limit'](_0x118d05[_0x7fb0('0x15')]||_0x43c82b);_0x4be320['offset'](_0x118d05['offset']||0x0);return dbH[_0x7fb0('0x76')][_0x7fb0('0x29')](_0x566a63['toString'](),{'type':dbH[_0x7fb0('0x76')][_0x7fb0('0x77')][_0x7fb0('0x78')]})[_0x7fb0('0x1d')](function(_0x3c3d8e){if(!_0x3c3d8e[_0x7fb0('0x3c')]){_0x1bc916=0x0;}else{_0x1bc916=_0x3c3d8e[0x0][_0x7fb0('0x16')]||0x0;}return dbH['sequelize'][_0x7fb0('0x29')](_0x4be320[_0x7fb0('0x75')](),{'type':dbH[_0x7fb0('0x76')][_0x7fb0('0x77')]['SELECT']});})[_0x7fb0('0x1d')](function(_0x13bdfe){return{'rows':_0x13bdfe||[],'count':_0x1bc916};});}});}exports[_0x7fb0('0x98')]=function(_0xdf13c6,_0x5e956c){return runReport(_0xdf13c6[_0x7fb0('0x3b')],_0xdf13c6[_0x7fb0('0x29')],_0xdf13c6[_0x7fb0('0x35')])[_0x7fb0('0x1d')](respondWithResult(_0x5e956c,null))['catch'](handleError(_0x5e956c,null));};exports[_0x7fb0('0x99')]=runReport;exports[_0x7fb0('0x29')]=function(_0x519bd7,_0x12fe2f){var _0x3fd917=0xa;var _0x16897c=[_0x7fb0('0x79'),_0x7fb0('0x7a'),_0x7fb0('0x46'),'cross_join'];var _0x22d50c={'SUM':'SUM(%s)','COUNT':_0x7fb0('0x49'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7fb0('0x4b'),'MIN':_0x7fb0('0x4c'),'AVG':_0x7fb0('0x4d'),'GROUP_CONCAT':_0x7fb0('0x4e'),'GROUP_CONCAT ASC':_0x7fb0('0x4f'),'GROUP_CONCAT DESC':_0x7fb0('0x50')};var _0x1060a0={'SEC_TO_TIME':_0x7fb0('0x51'),'DATE':_0x7fb0('0x52'),'HOUR':_0x7fb0('0x53'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7fb0('0x7c')};var _0x227e5e=function(_0x40d315){return!_['includes'](['IS\x20NULL',_0x7fb0('0x55'),_0x7fb0('0x56'),'IS\x20NOT\x20EMPTY'],_0x40d315);};var _0x3abea1=function(_0x50d4cb){if(!_0x50d4cb||!_0x50d4cb[_0x7fb0('0x58')][_0x7fb0('0x3c')]){return'';}for(var _0x402069='(',_0x56853c=0x0;_0x56853c<_0x50d4cb['rules'][_0x7fb0('0x3c')];_0x56853c+=0x1){_0x56853c>0x0&&(_0x402069+='\x20'+_0x50d4cb['operator']+'\x20');_0x402069+=_0x50d4cb[_0x7fb0('0x58')][_0x56853c][_0x7fb0('0x5a')]?_0x3abea1(_0x50d4cb[_0x7fb0('0x58')][_0x56853c]['group']):_0x50d4cb[_0x7fb0('0x58')][_0x56853c][_0x7fb0('0x5b')]+'\x20'+_0x50d4cb['rules'][_0x56853c]['condition']+(_0x227e5e(_0x50d4cb[_0x7fb0('0x58')][_0x56853c][_0x7fb0('0x5c')])?'\x20'+_0x50d4cb[_0x7fb0('0x58')][_0x56853c][_0x7fb0('0x5d')]:'');}return _0x402069+')';};var _0x1e67ca={'where':{'id':_0x519bd7[_0x7fb0('0x3b')]['id']}},_0x56edc0,_0x4ca3df,_0x2d9584,_0x31ed69,_0x31f486;_0x1e67ca=_[_0x7fb0('0x34')]({},_0x1e67ca,_0x519bd7['options']);return db[_0x7fb0('0x24')][_0x7fb0('0x3d')](_0x1e67ca)[_0x7fb0('0x1d')](function(_0x161d71){if(_0x161d71){_0x56edc0=_0x161d71;return _0x161d71[_0x7fb0('0x5e')]();}return null;})['then'](function(_0x4413df){if(_0x4413df){if(!_0x4413df[_0x7fb0('0x3c')]){throw new db[(_0x7fb0('0x7d'))][(_0x7fb0('0x5f'))](_0x7fb0('0x7e'),0x193);}_0x4ca3df=_0x4413df;return db[_0x7fb0('0x60')][_0x7fb0('0x38')]({'raw':!![]});}return null;})[_0x7fb0('0x1d')](function(_0x4a88b1){if(_0x4a88b1){_0x2d9584=_[_0x7fb0('0x7f')](_0x4a88b1,'id');var _0x30c82e;var _0xea3c4e=squel[_0x7fb0('0x80')]();_0xea3c4e[_0x7fb0('0x81')](_0x56edc0[_0x7fb0('0x61')]);for(var _0x10a89b=0x0;_0x10a89b<_0x4ca3df[_0x7fb0('0x3c')];_0x10a89b+=0x1){_0x30c82e=_0x4ca3df[_0x10a89b][_0x7fb0('0x62')]?_0x2d9584[_0x4ca3df[_0x10a89b][_0x7fb0('0x62')]][_0x7fb0('0x82')]:_0x4ca3df[_0x10a89b]['field'];_0x30c82e=_0x4ca3df[_0x10a89b][_0x7fb0('0x63')]?_['replace'](_0x22d50c[_0x4ca3df[_0x10a89b][_0x7fb0('0x63')]],'%s',_0x30c82e):_0x30c82e;_0x30c82e=_0x4ca3df[_0x10a89b][_0x7fb0('0x64')]?_[_0x7fb0('0x65')](_0x1060a0[_0x4ca3df[_0x10a89b][_0x7fb0('0x64')]],'%s',_0x30c82e):_0x30c82e;if(_0x4ca3df[_0x10a89b][_0x7fb0('0x66')]){_0xea3c4e[_0x7fb0('0x5a')](_0x30c82e);}_0x4ca3df[_0x10a89b][_0x7fb0('0x67')]&&_0xea3c4e[_0x7fb0('0x68')](_0x30c82e,_0x4ca3df[_0x10a89b][_0x7fb0('0x67')]===_0x7fb0('0x69')?![]:!![]);_0xea3c4e['field'](_0x30c82e,_0x4ca3df[_0x10a89b][_0x7fb0('0x6a')]||_0x30c82e);}if(_0x56edc0[_0x7fb0('0x6b')]){_0x56edc0[_0x7fb0('0x6b')]=JSON['parse'](_0x56edc0[_0x7fb0('0x6b')]);for(var _0x39e05c=0x0;_0x39e05c<_0x56edc0[_0x7fb0('0x6b')][_0x7fb0('0x3c')];_0x39e05c+=0x1){if(_0x56edc0[_0x7fb0('0x6b')][_0x39e05c][_0x7fb0('0x26')]&&_[_0x7fb0('0x54')](_0x16897c,_0x56edc0[_0x7fb0('0x6b')][_0x39e05c][_0x7fb0('0x26')])&&_0x56edc0[_0x7fb0('0x6b')][_0x39e05c][_0x7fb0('0x6d')]&&_0x56edc0['joins'][_0x39e05c]['foreignTable']&&_0x56edc0[_0x7fb0('0x6b')][_0x39e05c][_0x7fb0('0x6f')]){_0xea3c4e[_0x56edc0['joins'][_0x39e05c][_0x7fb0('0x26')]](_0x56edc0[_0x7fb0('0x6b')][_0x39e05c][_0x7fb0('0x6e')],null,util[_0x7fb0('0x64')](_0x7fb0('0x70'),_0x56edc0[_0x7fb0('0x61')],_0x56edc0[_0x7fb0('0x6b')][_0x39e05c][_0x7fb0('0x6d')],_0x56edc0['joins'][_0x39e05c]['foreignTable'],_0x56edc0[_0x7fb0('0x6b')][_0x39e05c][_0x7fb0('0x6f')]));}}}if(_0x56edc0[_0x7fb0('0x71')]){_0x56edc0['conditions']=JSON[_0x7fb0('0x6c')](_0x56edc0[_0x7fb0('0x71')]);_0xea3c4e[_0x7fb0('0x31')](_0x3abea1(_0x56edc0[_0x7fb0('0x71')]['group']));}_0x31f486=_0xea3c4e[_0x7fb0('0x72')]();_0xea3c4e[_0x7fb0('0x15')](_0x3fd917);_0xea3c4e['offset'](0x0);logger[_0x7fb0('0x73')](_0x7fb0('0x74'),_0xea3c4e[_0x7fb0('0x75')]());return dbH[_0x7fb0('0x76')][_0x7fb0('0x29')](_0xea3c4e[_0x7fb0('0x75')](),{'type':dbH[_0x7fb0('0x76')][_0x7fb0('0x77')][_0x7fb0('0x78')]});}})[_0x7fb0('0x1d')](function(){return{'sql':_0x31f486[_0x7fb0('0x75')]()};})['then'](respondWithResult(_0x12fe2f,null))[_0x7fb0('0x3a')](handleError(_0x12fe2f,null));}; \ No newline at end of file +var _0x283f=['cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','sendStatus','error','stack','name','send','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','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)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','debug','toString','sequelize','QueryTypes','SELECT','right_join','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','value','AnalyticMetric','parentKey','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport'];(function(_0x3e1b02,_0x1645c0){var _0x189ca8=function(_0x5102de){while(--_0x5102de){_0x3e1b02['push'](_0x3e1b02['shift']());}};_0x189ca8(++_0x1645c0);}(_0x283f,0x165));var _0xf283=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x283f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf283('0x0'));var rimraf=require(_0xf283('0x1'));var zipdir=require(_0xf283('0x2'));var jsonpatch=require(_0xf283('0x3'));var rp=require(_0xf283('0x4'));var moment=require(_0xf283('0x5'));var BPromise=require(_0xf283('0x6'));var Mustache=require(_0xf283('0x7'));var util=require(_0xf283('0x8'));var path=require('path');var sox=require(_0xf283('0x9'));var csv=require(_0xf283('0xa'));var ejs=require(_0xf283('0xb'));var fs=require('fs');var fs_extra=require(_0xf283('0xc'));var _=require(_0xf283('0xd'));var squel=require(_0xf283('0xe'));var crypto=require(_0xf283('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf283('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf283('0x11'));var Papa=require(_0xf283('0x12'));var Redis=require(_0xf283('0x13'));var authService=require(_0xf283('0x14'));var qs=require(_0xf283('0x15'));var as=require(_0xf283('0x16'));var hardwareService=require(_0xf283('0x17'));var logger=require(_0xf283('0x18'))(_0xf283('0x19'));var utils=require('../../config/utils');var config=require(_0xf283('0x1a'));var licenseUtil=require(_0xf283('0x1b'));var db=require(_0xf283('0x1c'))['db'];var dbH=require(_0xf283('0x1c'))[_0xf283('0x1d')];function respondWithStatusCode(_0x995d97,_0x3d98c1){_0x3d98c1=_0x3d98c1||0xcc;return function(_0x22d0ff){if(_0x22d0ff){return _0x995d97['sendStatus'](_0x3d98c1);}return _0x995d97[_0xf283('0x1e')](_0x3d98c1)[_0xf283('0x1f')]();};}function respondWithResult(_0xd2fe18,_0x1042f1){_0x1042f1=_0x1042f1||0xc8;return function(_0x476c79){if(_0x476c79){return _0xd2fe18[_0xf283('0x1e')](_0x1042f1)[_0xf283('0x20')](_0x476c79);}};}function respondWithFilteredResult(_0x14063d,_0x23aaa3){return function(_0x189042){if(_0x189042){var _0x18814a=typeof _0x23aaa3['offset']===_0xf283('0x21')&&typeof _0x23aaa3[_0xf283('0x22')]===_0xf283('0x21');var _0x3491be=_0x189042[_0xf283('0x23')];var _0x58c933=_0x18814a?0x0:_0x23aaa3[_0xf283('0x24')];var _0x201a65=_0x18814a?_0x189042[_0xf283('0x23')]:_0x23aaa3[_0xf283('0x24')]+_0x23aaa3['limit'];var _0x20fdc1;if(_0x201a65>=_0x3491be){_0x201a65=_0x3491be;_0x20fdc1=0xc8;}else{_0x20fdc1=0xce;}_0x14063d[_0xf283('0x1e')](_0x20fdc1);return _0x14063d[_0xf283('0x25')](_0xf283('0x26'),_0x58c933+'-'+_0x201a65+'/'+_0x3491be)['json'](_0x189042);}return null;};}function patchUpdates(_0x5962b5){return function(_0x2b255c){try{jsonpatch[_0xf283('0x27')](_0x2b255c,_0x5962b5,!![]);}catch(_0xfc2973){return BPromise[_0xf283('0x28')](_0xfc2973);}return _0x2b255c[_0xf283('0x29')]();};}function saveUpdates(_0x5c758b,_0x2b8fe5){return function(_0x524480){if(_0x524480){return _0x524480[_0xf283('0x2a')](_0x5c758b)[_0xf283('0x2b')](function(_0x447f98){return _0x447f98;});}return null;};}function removeEntity(_0x3ee0ff,_0x556783){return function(_0x3136df){if(_0x3136df){return _0x3136df[_0xf283('0x2c')]()[_0xf283('0x2b')](function(){var _0x454e7a=_0x3136df[_0xf283('0x2d')]({'plain':!![]});var _0x163ddb=_0xf283('0x2e');return db[_0xf283('0x2f')][_0xf283('0x2c')]({'where':{'type':_0x163ddb,'resourceId':_0x454e7a['id']}})['then'](function(){return _0x3136df;});})[_0xf283('0x2b')](function(){_0x3ee0ff[_0xf283('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f542b,_0x274508){return function(_0x400bdf){if(!_0x400bdf){_0x3f542b[_0xf283('0x30')](0x194);}return _0x400bdf;};}function handleError(_0x413e6e,_0x3b2cbf){_0x3b2cbf=_0x3b2cbf||0x1f4;return function(_0x44425a){logger[_0xf283('0x31')](_0x44425a[_0xf283('0x32')]);if(_0x44425a[_0xf283('0x33')]){delete _0x44425a[_0xf283('0x33')];}_0x413e6e['status'](_0x3b2cbf)[_0xf283('0x34')](_0x44425a);};}exports['index']=function(_0xbc2345,_0x328e6e){var _0x537b46={},_0x317f1f={},_0x2523df={'count':0x0,'rows':[]};var _0x24dc4f=_['map'](db[_0xf283('0x35')][_0xf283('0x36')],function(_0x5c397a){return{'name':_0x5c397a[_0xf283('0x37')],'type':_0x5c397a[_0xf283('0x38')][_0xf283('0x39')]};});_0x317f1f[_0xf283('0x3a')]=_['map'](_0x24dc4f,_0xf283('0x33'));_0x317f1f[_0xf283('0x3b')]=_['keys'](_0xbc2345[_0xf283('0x3b')]);_0x317f1f[_0xf283('0x3c')]=_[_0xf283('0x3d')](_0x317f1f['model'],_0x317f1f[_0xf283('0x3b')]);_0x537b46[_0xf283('0x3e')]=_[_0xf283('0x3d')](_0x317f1f[_0xf283('0x3a')],qs[_0xf283('0x3f')](_0xbc2345[_0xf283('0x3b')][_0xf283('0x3f')]));_0x537b46[_0xf283('0x3e')]=_0x537b46['attributes']['length']?_0x537b46['attributes']:_0x317f1f[_0xf283('0x3a')];if(!_0xbc2345['query'][_0xf283('0x40')](_0xf283('0x41'))){_0x537b46[_0xf283('0x22')]=qs[_0xf283('0x22')](_0xbc2345[_0xf283('0x3b')][_0xf283('0x22')]);_0x537b46[_0xf283('0x24')]=qs[_0xf283('0x24')](_0xbc2345[_0xf283('0x3b')][_0xf283('0x24')]);}_0x537b46[_0xf283('0x42')]=qs['sort'](_0xbc2345[_0xf283('0x3b')][_0xf283('0x43')]);_0x537b46['where']=qs[_0xf283('0x3c')](_[_0xf283('0x44')](_0xbc2345[_0xf283('0x3b')],_0x317f1f[_0xf283('0x3c')]),_0x24dc4f);if(_0xbc2345[_0xf283('0x3b')][_0xf283('0x45')]){_0x537b46[_0xf283('0x46')]=_[_0xf283('0x47')](_0x537b46[_0xf283('0x46')],{'$or':_[_0xf283('0x48')](_0x24dc4f,function(_0x2fb0c0){if(_0x2fb0c0[_0xf283('0x38')]!=='VIRTUAL'){var _0x3e8786={};_0x3e8786[_0x2fb0c0[_0xf283('0x33')]]={'$like':'%'+_0xbc2345[_0xf283('0x3b')]['filter']+'%'};return _0x3e8786;}})});}_0x537b46=_['merge']({},_0x537b46,_0xbc2345[_0xf283('0x49')]);var _0x5929ea={'where':_0x537b46[_0xf283('0x46')]};return db[_0xf283('0x35')][_0xf283('0x23')](_0x5929ea)['then'](function(_0x2f51f2){_0x2523df[_0xf283('0x23')]=_0x2f51f2;if(_0xbc2345[_0xf283('0x3b')][_0xf283('0x4a')]){_0x537b46[_0xf283('0x4b')]=[{'all':!![]}];}return db[_0xf283('0x35')][_0xf283('0x4c')](_0x537b46);})[_0xf283('0x2b')](function(_0x2039fd){_0x2523df['rows']=_0x2039fd;return _0x2523df;})['then'](respondWithFilteredResult(_0x328e6e,_0x537b46))[_0xf283('0x4d')](handleError(_0x328e6e,null));};exports[_0xf283('0x4e')]=function(_0xa14bac,_0x533ec7){var _0x535c5c={'raw':![],'where':{'id':_0xa14bac[_0xf283('0x4f')]['id']}},_0x56217e={};_0x56217e[_0xf283('0x3a')]=_[_0xf283('0x50')](db[_0xf283('0x35')][_0xf283('0x36')]);_0x56217e[_0xf283('0x3b')]=_[_0xf283('0x50')](_0xa14bac['query']);_0x56217e['filters']=_['intersection'](_0x56217e[_0xf283('0x3a')],_0x56217e[_0xf283('0x3b')]);_0x535c5c[_0xf283('0x3e')]=_[_0xf283('0x3d')](_0x56217e[_0xf283('0x3a')],qs['fields'](_0xa14bac[_0xf283('0x3b')]['fields']));_0x535c5c['attributes']=_0x535c5c[_0xf283('0x3e')][_0xf283('0x51')]?_0x535c5c['attributes']:_0x56217e[_0xf283('0x3a')];if(_0xa14bac[_0xf283('0x3b')][_0xf283('0x4a')]){_0x535c5c[_0xf283('0x4b')]=[{'all':!![]}];}_0x535c5c=_[_0xf283('0x47')]({},_0x535c5c,_0xa14bac['options']);return db['AnalyticCustomReport'][_0xf283('0x52')](_0x535c5c)[_0xf283('0x2b')](handleEntityNotFound(_0x533ec7,null))[_0xf283('0x2b')](respondWithResult(_0x533ec7,null))[_0xf283('0x4d')](handleError(_0x533ec7,null));};exports['create']=function(_0x4704b5,_0x407f76){return db['AnalyticCustomReport'][_0xf283('0x53')](_0x4704b5[_0xf283('0x54')],{})[_0xf283('0x2b')](function(_0x4d03d7){var _0x321443=_0x4704b5['user'][_0xf283('0x2d')]({'plain':!![]});if(!_0x321443)throw new Error(_0xf283('0x55'));if(_0x321443[_0xf283('0x56')]==='user'){var _0x195f74=_0x4d03d7[_0xf283('0x2d')]({'plain':!![]});var _0x596647='Reports';return db['UserProfileSection'][_0xf283('0x52')]({'where':{'name':_0x596647,'userProfileId':_0x321443[_0xf283('0x57')]},'raw':!![]})[_0xf283('0x2b')](function(_0x1c688c){if(_0x1c688c&&_0x1c688c[_0xf283('0x58')]===0x0){return db[_0xf283('0x2f')][_0xf283('0x53')]({'name':_0x195f74[_0xf283('0x33')],'resourceId':_0x195f74['id'],'type':'CustomReports','sectionId':_0x1c688c['id']},{})[_0xf283('0x2b')](function(){return _0x4d03d7;});}else{return _0x4d03d7;}})[_0xf283('0x4d')](function(_0x58ad86){logger[_0xf283('0x31')](_0xf283('0x59'),_0x58ad86);throw _0x58ad86;});}return _0x4d03d7;})[_0xf283('0x2b')](respondWithResult(_0x407f76,0xc9))[_0xf283('0x4d')](handleError(_0x407f76,null));};exports[_0xf283('0x2a')]=function(_0x13418f,_0x386301){if(_0x13418f[_0xf283('0x54')]['id']){delete _0x13418f[_0xf283('0x54')]['id'];}return db['AnalyticCustomReport'][_0xf283('0x52')]({'where':{'id':_0x13418f[_0xf283('0x4f')]['id']}})[_0xf283('0x2b')](handleEntityNotFound(_0x386301,null))['then'](saveUpdates(_0x13418f[_0xf283('0x54')],null))['then'](respondWithResult(_0x386301,null))[_0xf283('0x4d')](handleError(_0x386301,null));};exports[_0xf283('0x2c')]=function(_0x327e5b,_0x2278a8){return db[_0xf283('0x35')]['find']({'where':{'id':_0x327e5b[_0xf283('0x4f')]['id']}})[_0xf283('0x2b')](handleEntityNotFound(_0x2278a8,null))['then'](removeEntity(_0x2278a8,null))['catch'](handleError(_0x2278a8,null));};exports['preview']=function(_0xca557d,_0x544a0f){var _0x558a2f=0xa;var _0x48ff4e=[_0xf283('0x5a'),_0xf283('0x5b'),'right_join',_0xf283('0x5c')];var _0xd84dca={'SUM':_0xf283('0x5d'),'COUNT':_0xf283('0x5e'),'COUNT DISTINCT':_0xf283('0x5f'),'MAX':_0xf283('0x60'),'MIN':_0xf283('0x61'),'AVG':_0xf283('0x62'),'GROUP_CONCAT':_0xf283('0x63'),'GROUP_CONCAT ASC':_0xf283('0x64'),'GROUP_CONCAT DESC':_0xf283('0x65')};var _0x26c56b={'SEC_TO_TIME':_0xf283('0x66'),'DATE':_0xf283('0x67'),'HOUR':_0xf283('0x68'),'ROUND':_0xf283('0x69'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xa2505e=function(_0x3ae22b){return!_[_0xf283('0x6a')]([_0xf283('0x6b'),_0xf283('0x6c'),_0xf283('0x6d'),'IS\x20NOT\x20EMPTY'],_0x3ae22b);};var _0x16f7b7=function(_0x486664){if(!_0x486664||!_0x486664[_0xf283('0x6e')][_0xf283('0x51')]){return'';}for(var _0x2b822b='(',_0x17b65b=0x0;_0x17b65b<_0x486664[_0xf283('0x6e')][_0xf283('0x51')];_0x17b65b+=0x1){_0x17b65b>0x0&&(_0x2b822b+='\x20'+_0x486664[_0xf283('0x6f')]+'\x20');_0x2b822b+=_0x486664[_0xf283('0x6e')][_0x17b65b]['group']?_0x16f7b7(_0x486664[_0xf283('0x6e')][_0x17b65b][_0xf283('0x70')]):_0x486664['rules'][_0x17b65b][_0xf283('0x71')]+'\x20'+_0x486664['rules'][_0x17b65b][_0xf283('0x72')]+(_0xa2505e(_0x486664['rules'][_0x17b65b][_0xf283('0x72')])?'\x20'+_0x486664[_0xf283('0x6e')][_0x17b65b]['value']:'');}return _0x2b822b+')';};var _0x204607={'where':{'id':_0xca557d[_0xf283('0x4f')]['id']}},_0x297e2c,_0x2a12d8,_0x3e717e,_0x5113a9,_0x373b28;_0x204607=_[_0xf283('0x47')]({},_0x204607,_0xca557d['options']);return db[_0xf283('0x35')][_0xf283('0x52')](_0x204607)[_0xf283('0x2b')](function(_0x319006){if(_0x319006){_0x297e2c=_0x319006;return _0x319006[_0xf283('0x73')]();}return null;})[_0xf283('0x2b')](function(_0x43ccaa){if(_0x43ccaa){if(!_0x43ccaa[_0xf283('0x51')]){throw new db[(_0xf283('0x74'))][(_0xf283('0x75'))](_0xf283('0x76'),0x193);}_0x2a12d8=_0x43ccaa;return db['AnalyticMetric'][_0xf283('0x4c')]({'raw':!![]});}return null;})[_0xf283('0x2b')](function(_0x4a9507){if(_0x4a9507){_0x3e717e=_[_0xf283('0x77')](_0x4a9507,'id');var _0x278294;var _0x1bdf8b=squel[_0xf283('0x78')]();_0x1bdf8b[_0xf283('0x79')](_0x297e2c[_0xf283('0x7a')]);for(var _0x3c16f4=0x0;_0x3c16f4<_0x2a12d8['length'];_0x3c16f4+=0x1){_0x278294=_0x2a12d8[_0x3c16f4]['MetricId']?_0x3e717e[_0x2a12d8[_0x3c16f4][_0xf283('0x7b')]][_0xf283('0x7c')]:_0x2a12d8[_0x3c16f4][_0xf283('0x71')];_0x278294=_0x2a12d8[_0x3c16f4][_0xf283('0x7d')]?_[_0xf283('0x7e')](_0xd84dca[_0x2a12d8[_0x3c16f4][_0xf283('0x7d')]],'%s',_0x278294):_0x278294;_0x278294=_0x2a12d8[_0x3c16f4][_0xf283('0x7f')]?_['replace'](_0x26c56b[_0x2a12d8[_0x3c16f4][_0xf283('0x7f')]],'%s',_0x278294):_0x278294;if(_0x2a12d8[_0x3c16f4][_0xf283('0x80')]){_0x1bdf8b[_0xf283('0x70')](_0x278294);}_0x2a12d8[_0x3c16f4][_0xf283('0x81')]&&_0x1bdf8b[_0xf283('0x42')](_0x278294,_0x2a12d8[_0x3c16f4][_0xf283('0x81')]===_0xf283('0x82')?![]:!![]);_0x1bdf8b[_0xf283('0x71')](_0x278294,_0x2a12d8[_0x3c16f4][_0xf283('0x83')]||_0x278294);}if(_0x297e2c[_0xf283('0x84')]){_0x297e2c[_0xf283('0x84')]=JSON[_0xf283('0x85')](_0x297e2c[_0xf283('0x84')]);for(var _0x5101a9=0x0;_0x5101a9<_0x297e2c['joins'][_0xf283('0x51')];_0x5101a9+=0x1){if(_0x297e2c['joins'][_0x5101a9]['type']&&_['includes'](_0x48ff4e,_0x297e2c[_0xf283('0x84')][_0x5101a9]['type'])&&_0x297e2c[_0xf283('0x84')][_0x5101a9]['parentKey']&&_0x297e2c['joins'][_0x5101a9][_0xf283('0x86')]&&_0x297e2c[_0xf283('0x84')][_0x5101a9]['foreignKey']){_0x1bdf8b[_0x297e2c[_0xf283('0x84')][_0x5101a9]['type']](_0x297e2c['joins'][_0x5101a9][_0xf283('0x86')],null,util[_0xf283('0x7f')](_0xf283('0x87'),_0x297e2c[_0xf283('0x7a')],_0x297e2c[_0xf283('0x84')][_0x5101a9]['parentKey'],_0x297e2c[_0xf283('0x84')][_0x5101a9][_0xf283('0x86')],_0x297e2c[_0xf283('0x84')][_0x5101a9][_0xf283('0x88')]));}}}if(_0x297e2c['conditions']){_0x297e2c[_0xf283('0x89')]=JSON[_0xf283('0x85')](_0x297e2c[_0xf283('0x89')]);_0x1bdf8b['where'](_0x16f7b7(_0x297e2c[_0xf283('0x89')][_0xf283('0x70')]));}_0x373b28=_0x1bdf8b['clone']();_0x1bdf8b['limit'](_0x558a2f);_0x1bdf8b['offset'](0x0);logger[_0xf283('0x8a')]('Limited\x20Query:',_0x1bdf8b[_0xf283('0x8b')]());return dbH['sequelize'][_0xf283('0x3b')](_0x1bdf8b[_0xf283('0x8b')](),{'type':dbH[_0xf283('0x8c')][_0xf283('0x8d')][_0xf283('0x8e')]});}})['then'](respondWithResult(_0x544a0f,null))['catch'](handleError(_0x544a0f,null));};function runReport(_0x264179,_0x567462,_0x447ac5){var _0x3ba8e6=_0x567462['name'];var _0x4b8208=0xa;var _0x1e7ac6=[_0xf283('0x5a'),'left_join',_0xf283('0x8f'),_0xf283('0x5c')];var _0x2af922={'SUM':_0xf283('0x5d'),'COUNT':_0xf283('0x5e'),'COUNT DISTINCT':_0xf283('0x5f'),'MAX':_0xf283('0x60'),'MIN':_0xf283('0x61'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf283('0x63'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf283('0x65')};var _0x446d1f={'SEC_TO_TIME':_0xf283('0x66'),'DATE':'DATE(%s)','HOUR':_0xf283('0x68'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf283('0x90')};var _0x252cd2=function(_0x1e1117){return!_[_0xf283('0x6a')]([_0xf283('0x6b'),_0xf283('0x6c'),_0xf283('0x6d'),_0xf283('0x91')],_0x1e1117);};var _0x51f4ce=function(_0x41015b){if(!_0x41015b||!_0x41015b[_0xf283('0x6e')][_0xf283('0x51')]){return'';}for(var _0x51e431='(',_0x5a54d5=0x0;_0x5a54d5<_0x41015b[_0xf283('0x6e')][_0xf283('0x51')];_0x5a54d5+=0x1){_0x5a54d5>0x0&&(_0x51e431+='\x20'+_0x41015b['operator']+'\x20');_0x51e431+=_0x41015b['rules'][_0x5a54d5]['group']?_0x51f4ce(_0x41015b[_0xf283('0x6e')][_0x5a54d5][_0xf283('0x70')]):_0x41015b[_0xf283('0x6e')][_0x5a54d5][_0xf283('0x71')]+'\x20'+_0x41015b[_0xf283('0x6e')][_0x5a54d5][_0xf283('0x72')]+(_0x252cd2(_0x41015b[_0xf283('0x6e')][_0x5a54d5][_0xf283('0x72')])?'\x20'+_0x41015b[_0xf283('0x6e')][_0x5a54d5][_0xf283('0x92')]:'');}return _0x51e431+')';};var _0x41961c={'where':{'id':_0x264179['id']}},_0x53a06f,_0x58217e,_0x5a19d9,_0x3a0cc7,_0x2dcc3b;_0x41961c=_[_0xf283('0x47')]({},_0x41961c,_0x447ac5);return db[_0xf283('0x35')][_0xf283('0x52')](_0x41961c)[_0xf283('0x2b')](function(_0x48dad4){if(_0x48dad4){_0x53a06f=_0x48dad4;return _0x48dad4[_0xf283('0x73')]();}return null;})[_0xf283('0x2b')](function(_0x44e549){if(_0x44e549){if(!_0x44e549[_0xf283('0x51')]){throw new db[(_0xf283('0x74'))][(_0xf283('0x75'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x58217e=_0x44e549;return db[_0xf283('0x93')][_0xf283('0x4c')]({'raw':!![]});}return null;})[_0xf283('0x2b')](function(_0x320979){if(_0x320979){_0x5a19d9=_[_0xf283('0x77')](_0x320979,'id');var _0x5d6322;var _0x366666=squel['select']();_0x366666[_0xf283('0x79')](_0x53a06f[_0xf283('0x7a')]);for(var _0x2d1eb0=0x0;_0x2d1eb0<_0x58217e[_0xf283('0x51')];_0x2d1eb0+=0x1){_0x5d6322=_0x58217e[_0x2d1eb0][_0xf283('0x7b')]?_0x5a19d9[_0x58217e[_0x2d1eb0][_0xf283('0x7b')]][_0xf283('0x7c')]:_0x58217e[_0x2d1eb0]['field'];_0x5d6322=_0x58217e[_0x2d1eb0][_0xf283('0x7d')]?_[_0xf283('0x7e')](_0x2af922[_0x58217e[_0x2d1eb0][_0xf283('0x7d')]],'%s',_0x5d6322):_0x5d6322;_0x5d6322=_0x58217e[_0x2d1eb0]['format']?_[_0xf283('0x7e')](_0x446d1f[_0x58217e[_0x2d1eb0][_0xf283('0x7f')]],'%s',_0x5d6322):_0x5d6322;if(_0x58217e[_0x2d1eb0][_0xf283('0x80')]){_0x366666[_0xf283('0x70')](_0x5d6322);}_0x58217e[_0x2d1eb0][_0xf283('0x81')]&&_0x366666[_0xf283('0x42')](_0x5d6322,_0x58217e[_0x2d1eb0][_0xf283('0x81')]==='DESC'?![]:!![]);_0x366666[_0xf283('0x71')](_0x5d6322,_0x58217e[_0x2d1eb0]['alias']||_0x5d6322);}if(_0x53a06f[_0xf283('0x84')]){_0x53a06f['joins']=JSON[_0xf283('0x85')](_0x53a06f[_0xf283('0x84')]);for(var _0x194424=0x0;_0x194424<_0x53a06f['joins'][_0xf283('0x51')];_0x194424+=0x1){if(_0x53a06f[_0xf283('0x84')][_0x194424][_0xf283('0x38')]&&_[_0xf283('0x6a')](_0x1e7ac6,_0x53a06f['joins'][_0x194424][_0xf283('0x38')])&&_0x53a06f[_0xf283('0x84')][_0x194424][_0xf283('0x94')]&&_0x53a06f[_0xf283('0x84')][_0x194424][_0xf283('0x86')]&&_0x53a06f[_0xf283('0x84')][_0x194424][_0xf283('0x88')]){_0x366666[_0x53a06f[_0xf283('0x84')][_0x194424][_0xf283('0x38')]](_0x53a06f[_0xf283('0x84')][_0x194424][_0xf283('0x86')],null,util[_0xf283('0x7f')](_0xf283('0x87'),_0x53a06f[_0xf283('0x7a')],_0x53a06f['joins'][_0x194424][_0xf283('0x94')],_0x53a06f[_0xf283('0x84')][_0x194424][_0xf283('0x86')],_0x53a06f[_0xf283('0x84')][_0x194424][_0xf283('0x88')]));}}}if(_0x53a06f[_0xf283('0x89')]){_0x53a06f[_0xf283('0x89')]=JSON[_0xf283('0x85')](_0x53a06f['conditions']);_0x366666['where'](_0x51f4ce(_0x53a06f[_0xf283('0x89')][_0xf283('0x70')]));}_0x2dcc3b=_0x366666[_0xf283('0x95')]();_0x366666[_0xf283('0x22')](_0x4b8208);_0x366666[_0xf283('0x24')](0x0);return;}})[_0xf283('0x2b')](function(){if(_0x567462[_0xf283('0x96')]===_0xf283('0x97')){return null;}var _0x2d3c2c=_[_0xf283('0x47')](_0x567462,{'name':_0x567462[_0xf283('0x98')]||_0x567462[_0xf283('0x33')]||_0x53a06f[_0xf283('0x33')],'basename':_0x3ba8e6,'savename':util['format'](_0xf283('0x99'),_0x567462[_0xf283('0x33')]||_0x53a06f[_0xf283('0x33')],require(_0xf283('0x9a'))[_0xf283('0x9b')](0x4),_0x567462[_0xf283('0x96')]||_0xf283('0x9c')),'reportId':_0x53a06f['id'],'reportType':_0xf283('0x9d')});return db[_0xf283('0x9e')][_0xf283('0x53')](_0x2d3c2c,{'raw':!![]});})[_0xf283('0x2b')](function(_0x2d25b1){if(_0x53a06f[_0xf283('0x7a')]===_0xf283('0x9f')){_0x2dcc3b[_0xf283('0x46')](_0x53a06f[_0xf283('0x7a')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x567462[_0xf283('0xa0')],_0x567462[_0xf283('0xa1')]);}else{_0x2dcc3b[_0xf283('0x46')](_0x53a06f['table']+_0xf283('0xa2'),_0x567462[_0xf283('0xa0')],_0x567462[_0xf283('0xa1')]);}if(_0x2d25b1){logger[_0xf283('0xa3')](_0xf283('0xa4'),_0x2dcc3b[_0xf283('0x8b')]());require(_0xf283('0xa5'))[_0xf283('0xa6')](path[_0xf283('0x5a')](__dirname,_0xf283('0xa7'),_0x2d25b1[_0xf283('0x96')]),[_0x2d25b1['id'],_0x2dcc3b[_0xf283('0x8b')](),path[_0xf283('0x5a')](__dirname,'../../files/reports',_0x2d25b1[_0xf283('0xa8')]),_0x3ba8e6]);return _0x2d25b1;}else{var _0x2fe8ff=squel['select']();_0x2fe8ff[_0xf283('0x79')]('('+_0x2dcc3b[_0xf283('0x8b')]()+')',_0xf283('0xa9'));_0x2fe8ff[_0xf283('0x71')]('COUNT(*)','count');_0x2dcc3b[_0xf283('0x22')](_0x567462['limit']||_0x4b8208);_0x2dcc3b[_0xf283('0x24')](_0x567462[_0xf283('0x24')]||0x0);return dbH[_0xf283('0x8c')]['query'](_0x2fe8ff[_0xf283('0x8b')](),{'type':dbH[_0xf283('0x8c')][_0xf283('0x8d')]['SELECT']})[_0xf283('0x2b')](function(_0x3c41fd){if(!_0x3c41fd['length']){_0x3a0cc7=0x0;}else{_0x3a0cc7=_0x3c41fd[0x0][_0xf283('0x23')]||0x0;}return dbH['sequelize']['query'](_0x2dcc3b[_0xf283('0x8b')](),{'type':dbH['sequelize'][_0xf283('0x8d')][_0xf283('0x8e')]});})[_0xf283('0x2b')](function(_0x1012c4){return{'rows':_0x1012c4||[],'count':_0x3a0cc7};});}});}exports[_0xf283('0xaa')]=function(_0x4018d5,_0x35724d){return runReport(_0x4018d5[_0xf283('0x4f')],_0x4018d5[_0xf283('0x3b')],_0x4018d5['options'])['then'](respondWithResult(_0x35724d,null))['catch'](handleError(_0x35724d,null));};exports[_0xf283('0xab')]=runReport;exports[_0xf283('0x3b')]=function(_0x462e39,_0x464f43){var _0x42ef4c=0xa;var _0x4ad95d=['join',_0xf283('0x5b'),_0xf283('0x8f'),'cross_join'];var _0x117073={'SUM':_0xf283('0x5d'),'COUNT':_0xf283('0x5e'),'COUNT DISTINCT':_0xf283('0x5f'),'MAX':_0xf283('0x60'),'MIN':_0xf283('0x61'),'AVG':_0xf283('0x62'),'GROUP_CONCAT':_0xf283('0x63'),'GROUP_CONCAT ASC':_0xf283('0x64'),'GROUP_CONCAT DESC':_0xf283('0x65')};var _0x4c6d57={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf283('0x67'),'HOUR':'HOUR(%s)','ROUND':_0xf283('0x69'),'UNIX_TIMESTAMP':_0xf283('0x90')};var _0x54356a=function(_0x5c7bcd){return!_[_0xf283('0x6a')]([_0xf283('0x6b'),_0xf283('0x6c'),_0xf283('0x6d'),_0xf283('0x91')],_0x5c7bcd);};var _0x13a7c4=function(_0x44b60b){if(!_0x44b60b||!_0x44b60b[_0xf283('0x6e')][_0xf283('0x51')]){return'';}for(var _0x57e0f8='(',_0x3aa89f=0x0;_0x3aa89f<_0x44b60b[_0xf283('0x6e')][_0xf283('0x51')];_0x3aa89f+=0x1){_0x3aa89f>0x0&&(_0x57e0f8+='\x20'+_0x44b60b['operator']+'\x20');_0x57e0f8+=_0x44b60b[_0xf283('0x6e')][_0x3aa89f][_0xf283('0x70')]?_0x13a7c4(_0x44b60b[_0xf283('0x6e')][_0x3aa89f]['group']):_0x44b60b['rules'][_0x3aa89f][_0xf283('0x71')]+'\x20'+_0x44b60b[_0xf283('0x6e')][_0x3aa89f][_0xf283('0x72')]+(_0x54356a(_0x44b60b[_0xf283('0x6e')][_0x3aa89f][_0xf283('0x72')])?'\x20'+_0x44b60b['rules'][_0x3aa89f]['value']:'');}return _0x57e0f8+')';};var _0x286932={'where':{'id':_0x462e39[_0xf283('0x4f')]['id']}},_0x3b4b91,_0x4b4fdd,_0x48ed9c,_0x7465f0,_0x50578c;_0x286932=_[_0xf283('0x47')]({},_0x286932,_0x462e39[_0xf283('0x49')]);return db['AnalyticCustomReport'][_0xf283('0x52')](_0x286932)[_0xf283('0x2b')](function(_0x428e02){if(_0x428e02){_0x3b4b91=_0x428e02;return _0x428e02[_0xf283('0x73')]();}return null;})[_0xf283('0x2b')](function(_0x3dfc91){if(_0x3dfc91){if(!_0x3dfc91[_0xf283('0x51')]){throw new db[(_0xf283('0x74'))][(_0xf283('0x75'))](_0xf283('0x76'),0x193);}_0x4b4fdd=_0x3dfc91;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xf283('0x2b')](function(_0x5841d0){if(_0x5841d0){_0x48ed9c=_[_0xf283('0x77')](_0x5841d0,'id');var _0x293702;var _0x466c03=squel['select']();_0x466c03[_0xf283('0x79')](_0x3b4b91[_0xf283('0x7a')]);for(var _0x47116d=0x0;_0x47116d<_0x4b4fdd[_0xf283('0x51')];_0x47116d+=0x1){_0x293702=_0x4b4fdd[_0x47116d][_0xf283('0x7b')]?_0x48ed9c[_0x4b4fdd[_0x47116d][_0xf283('0x7b')]][_0xf283('0x7c')]:_0x4b4fdd[_0x47116d][_0xf283('0x71')];_0x293702=_0x4b4fdd[_0x47116d][_0xf283('0x7d')]?_[_0xf283('0x7e')](_0x117073[_0x4b4fdd[_0x47116d]['function']],'%s',_0x293702):_0x293702;_0x293702=_0x4b4fdd[_0x47116d][_0xf283('0x7f')]?_[_0xf283('0x7e')](_0x4c6d57[_0x4b4fdd[_0x47116d]['format']],'%s',_0x293702):_0x293702;if(_0x4b4fdd[_0x47116d][_0xf283('0x80')]){_0x466c03[_0xf283('0x70')](_0x293702);}_0x4b4fdd[_0x47116d][_0xf283('0x81')]&&_0x466c03[_0xf283('0x42')](_0x293702,_0x4b4fdd[_0x47116d][_0xf283('0x81')]===_0xf283('0x82')?![]:!![]);_0x466c03[_0xf283('0x71')](_0x293702,_0x4b4fdd[_0x47116d]['alias']||_0x293702);}if(_0x3b4b91['joins']){_0x3b4b91['joins']=JSON[_0xf283('0x85')](_0x3b4b91[_0xf283('0x84')]);for(var _0x2fd13f=0x0;_0x2fd13f<_0x3b4b91[_0xf283('0x84')][_0xf283('0x51')];_0x2fd13f+=0x1){if(_0x3b4b91[_0xf283('0x84')][_0x2fd13f][_0xf283('0x38')]&&_[_0xf283('0x6a')](_0x4ad95d,_0x3b4b91[_0xf283('0x84')][_0x2fd13f]['type'])&&_0x3b4b91[_0xf283('0x84')][_0x2fd13f][_0xf283('0x94')]&&_0x3b4b91['joins'][_0x2fd13f][_0xf283('0x86')]&&_0x3b4b91[_0xf283('0x84')][_0x2fd13f][_0xf283('0x88')]){_0x466c03[_0x3b4b91[_0xf283('0x84')][_0x2fd13f][_0xf283('0x38')]](_0x3b4b91['joins'][_0x2fd13f][_0xf283('0x86')],null,util[_0xf283('0x7f')]('%s.%s\x20=\x20%s.%s',_0x3b4b91[_0xf283('0x7a')],_0x3b4b91[_0xf283('0x84')][_0x2fd13f][_0xf283('0x94')],_0x3b4b91[_0xf283('0x84')][_0x2fd13f][_0xf283('0x86')],_0x3b4b91['joins'][_0x2fd13f]['foreignKey']));}}}if(_0x3b4b91['conditions']){_0x3b4b91[_0xf283('0x89')]=JSON[_0xf283('0x85')](_0x3b4b91[_0xf283('0x89')]);_0x466c03['where'](_0x13a7c4(_0x3b4b91[_0xf283('0x89')][_0xf283('0x70')]));}_0x50578c=_0x466c03['clone']();_0x466c03[_0xf283('0x22')](_0x42ef4c);_0x466c03['offset'](0x0);logger[_0xf283('0x8a')]('Limited\x20Query:',_0x466c03[_0xf283('0x8b')]());return dbH[_0xf283('0x8c')][_0xf283('0x3b')](_0x466c03[_0xf283('0x8b')](),{'type':dbH[_0xf283('0x8c')][_0xf283('0x8d')][_0xf283('0x8e')]});}})[_0xf283('0x2b')](function(){return{'sql':_0x50578c[_0xf283('0x8b')]()};})[_0xf283('0x2b')](respondWithResult(_0x464f43,null))['catch'](handleError(_0x464f43,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index e2851b0..4f8a455 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 _0xa2c8=['exports','define','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x563ce1,_0x40dd47){var _0x22d3d5=function(_0x1c5d4c){while(--_0x1c5d4c){_0x563ce1['push'](_0x563ce1['shift']());}};_0x22d3d5(++_0x40dd47);}(_0xa2c8,0x99));var _0x8a2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa2c8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var logger=require(_0x8a2c('0x2'))(_0x8a2c('0x3'));var moment=require(_0x8a2c('0x4'));var BPromise=require(_0x8a2c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a2c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x8a2c('0x7')]=function(_0x40fb26,_0x3f754a){return _0x40fb26[_0x8a2c('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0x8a2c('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecfb=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x4476e9,_0x31adfc){var _0x2a11d1=function(_0x2d0c7e){while(--_0x2d0c7e){_0x4476e9['push'](_0x4476e9['shift']());}};_0x2a11d1(++_0x31adfc);}(_0xecfb,0x1d2));var _0xbecf=function(_0x572995,_0x294636){_0x572995=_0x572995-0x0;var _0x200691=_0xecfb[_0x572995];return _0x200691;};'use strict';var _=require(_0xbecf('0x0'));var util=require(_0xbecf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbecf('0x2'));var BPromise=require(_0xbecf('0x3'));var rp=require(_0xbecf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbecf('0x5'));var config=require(_0xbecf('0x6'));var attributes=require(_0xbecf('0x7'));module[_0xbecf('0x8')]=function(_0x3e96df,_0x34013a){return _0x3e96df[_0xbecf('0x9')](_0xbecf('0xa'),attributes,{'tableName':_0xbecf('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index a2f8982..8e2699c 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 _0xa0c6=['AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug'];(function(_0x396cd6,_0x463cef){var _0x46285b=function(_0x30192d){while(--_0x30192d){_0x396cd6['push'](_0x396cd6['shift']());}};_0x46285b(++_0x463cef);}(_0xa0c6,0x126));var _0x6a0c=function(_0x196380,_0x4f4a2a){_0x196380=_0x196380-0x0;var _0xbb58ad=_0xa0c6[_0x196380];return _0xbb58ad;};'use strict';var _=require('lodash');var util=require(_0x6a0c('0x0'));var moment=require(_0x6a0c('0x1'));var BPromise=require(_0x6a0c('0x2'));var rs=require(_0x6a0c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a0c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6a0c('0x5'));var config=require(_0x6a0c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6a0c('0x7')][_0x6a0c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x326e3e,_0x22df3f,_0x265953){return new BPromise(function(_0x43eb79,_0x269869){return client[_0x6a0c('0x9')](_0x326e3e,_0x265953)[_0x6a0c('0xa')](function(_0xc98404){logger[_0x6a0c('0xb')](_0x6a0c('0xc'),_0x22df3f,'request\x20sent');logger[_0x6a0c('0xd')](_0x6a0c('0xe'),_0x22df3f,'request\x20sent',JSON[_0x6a0c('0xf')](_0xc98404));if(_0xc98404[_0x6a0c('0x10')]){if(_0xc98404[_0x6a0c('0x10')][_0x6a0c('0x11')]===0x1f4){logger['error'](_0x6a0c('0xc'),_0x22df3f,_0xc98404[_0x6a0c('0x10')][_0x6a0c('0x12')]);return _0x269869(_0xc98404[_0x6a0c('0x10')]['message']);}logger[_0x6a0c('0x10')](_0x6a0c('0xc'),_0x22df3f,_0xc98404[_0x6a0c('0x10')][_0x6a0c('0x12')]);return _0x43eb79(_0xc98404[_0x6a0c('0x10')][_0x6a0c('0x12')]);}else{logger[_0x6a0c('0xb')](_0x6a0c('0xc'),_0x22df3f,_0x6a0c('0x13'));_0x43eb79(_0xc98404[_0x6a0c('0x14')][_0x6a0c('0x12')]);}})[_0x6a0c('0x15')](function(_0x119cc7){logger['error'](_0x6a0c('0xc'),_0x22df3f,_0x119cc7);_0x269869(_0x119cc7);});});} \ No newline at end of file +var _0x69a1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticCustomReport,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x34ad0b,_0x404cfc){var _0x1274a1=function(_0x330b3e){while(--_0x330b3e){_0x34ad0b['push'](_0x34ad0b['shift']());}};_0x1274a1(++_0x404cfc);}(_0x69a1,0x1dd));var _0x169a=function(_0x14140e,_0x2b723b){_0x14140e=_0x14140e-0x0;var _0x534e95=_0x69a1[_0x14140e];return _0x534e95;};'use strict';var _=require('lodash');var util=require(_0x169a('0x0'));var moment=require(_0x169a('0x1'));var BPromise=require(_0x169a('0x2'));var rs=require(_0x169a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x169a('0x4'))['db'];var utils=require(_0x169a('0x5'));var logger=require(_0x169a('0x6'))(_0x169a('0x7'));var config=require(_0x169a('0x8'));var jayson=require(_0x169a('0x9'));var client=jayson[_0x169a('0xa')][_0x169a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1dc1bf,_0x319a9a,_0x55d2ac){return new BPromise(function(_0x37658e,_0x47aa14){return client[_0x169a('0xc')](_0x1dc1bf,_0x55d2ac)['then'](function(_0x5571e9){logger[_0x169a('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x319a9a,_0x169a('0xe'));logger[_0x169a('0xf')](_0x169a('0x10'),_0x319a9a,_0x169a('0xe'),JSON[_0x169a('0x11')](_0x5571e9));if(_0x5571e9[_0x169a('0x12')]){if(_0x5571e9[_0x169a('0x12')]['code']===0x1f4){logger['error'](_0x169a('0x13'),_0x319a9a,_0x5571e9[_0x169a('0x12')][_0x169a('0x14')]);return _0x47aa14(_0x5571e9[_0x169a('0x12')][_0x169a('0x14')]);}logger[_0x169a('0x12')](_0x169a('0x13'),_0x319a9a,_0x5571e9['error']['message']);return _0x37658e(_0x5571e9[_0x169a('0x12')][_0x169a('0x14')]);}else{logger[_0x169a('0xd')](_0x169a('0x13'),_0x319a9a,_0x169a('0xe'));_0x37658e(_0x5571e9['result'][_0x169a('0x14')]);}})['catch'](function(_0x4b0c84){logger[_0x169a('0x12')](_0x169a('0x13'),_0x319a9a,_0x4b0c84);_0x47aa14(_0x4b0c84);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index c939f5f..9139649 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 _0x584e=['preview','run','query','post','put','update','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','/:id','show','get','/:id/preview'];(function(_0x1d3a4d,_0x7a4edb){var _0x122e3d=function(_0x80daaa){while(--_0x80daaa){_0x1d3a4d['push'](_0x1d3a4d['shift']());}};_0x122e3d(++_0x7a4edb);}(_0x584e,0x76));var _0xe584=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0x584e[_0xd336fa];return _0x3370b1;};'use strict';var multer=require(_0xe584('0x0'));var util=require(_0xe584('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe584('0x2')]();var fs_extra=require(_0xe584('0x3'));var auth=require(_0xe584('0x4'));var interaction=require(_0xe584('0x5'));var config=require(_0xe584('0x6'));var controller=require(_0xe584('0x7'));router['get']('/',auth[_0xe584('0x8')](),controller[_0xe584('0x9')]);router['get'](_0xe584('0xa'),auth['isAuthenticated'](),controller[_0xe584('0xb')]);router[_0xe584('0xc')](_0xe584('0xd'),auth[_0xe584('0x8')](),controller[_0xe584('0xe')]);router[_0xe584('0xc')]('/:id/run',auth[_0xe584('0x8')](),controller[_0xe584('0xf')]);router[_0xe584('0xc')]('/:id/query',auth[_0xe584('0x8')](),controller[_0xe584('0x10')]);router[_0xe584('0x11')]('/',auth[_0xe584('0x8')](),controller['create']);router[_0xe584('0x12')](_0xe584('0xa'),auth[_0xe584('0x8')](),controller[_0xe584('0x13')]);router['delete'](_0xe584('0xa'),auth[_0xe584('0x8')](),controller[_0xe584('0x14')]);module[_0xe584('0x15')]=router; \ No newline at end of file +var _0x3653=['create','put','/:id','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../config/environment','./analyticCustomReport.controller','index','get','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post'];(function(_0x11717b,_0x36d2a0){var _0x4a6c02=function(_0x2f819b){while(--_0x2f819b){_0x11717b['push'](_0x11717b['shift']());}};_0x4a6c02(++_0x36d2a0);}(_0x3653,0xa6));var _0x3365=function(_0x904def,_0x13c5bd){_0x904def=_0x904def-0x0;var _0x15f393=_0x3653[_0x904def];return _0x15f393;};'use strict';var multer=require(_0x3365('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3365('0x1'));var express=require(_0x3365('0x2'));var router=express[_0x3365('0x3')]();var fs_extra=require(_0x3365('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3365('0x5'));var controller=require(_0x3365('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x3365('0x7')]);router[_0x3365('0x8')]('/:id',auth[_0x3365('0x9')](),controller[_0x3365('0xa')]);router[_0x3365('0x8')](_0x3365('0xb'),auth[_0x3365('0x9')](),controller[_0x3365('0xc')]);router['get'](_0x3365('0xd'),auth[_0x3365('0x9')](),controller[_0x3365('0xe')]);router[_0x3365('0x8')](_0x3365('0xf'),auth[_0x3365('0x9')](),controller[_0x3365('0x10')]);router[_0x3365('0x11')]('/',auth[_0x3365('0x9')](),controller[_0x3365('0x12')]);router[_0x3365('0x13')](_0x3365('0x14'),auth[_0x3365('0x9')](),controller['update']);router[_0x3365('0x15')](_0x3365('0x14'),auth[_0x3365('0x9')](),controller[_0x3365('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index fb4a47b..9f6aac9 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 _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x34149c,_0x997d78){var _0x2e4978=function(_0x28a787){while(--_0x28a787){_0x34149c['push'](_0x34149c['shift']());}};_0x2e4978(++_0x997d78);}(_0xe14b,0x93));var _0xbe14=function(_0x4e4c2d,_0x262cbb){_0x4e4c2d=_0x4e4c2d-0x0;var _0x1298b5=_0xe14b[_0x4e4c2d];return _0x1298b5;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0x55913e,_0x236320){var _0x45479c=function(_0x64ebc3){while(--_0x64ebc3){_0x55913e['push'](_0x55913e['shift']());}};_0x45479c(++_0x236320);}(_0x3eea,0x1ca));var _0xa3ee=function(_0xac12bf,_0x1da581){_0xac12bf=_0xac12bf-0x0;var _0x403350=_0x3eea[_0xac12bf];return _0x403350;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 6a51bd3..8899734 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 _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','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\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x509caa,_0xf6214f){var _0x231cb1=function(_0x35601d){while(--_0x35601d){_0x509caa['push'](_0x509caa['shift']());}};_0x231cb1(++_0xf6214f);}(_0xda19,0xd5));var _0x9da1=function(_0x1f8273,_0x2e6c41){_0x1f8273=_0x1f8273-0x0;var _0x3fb362=_0xda19[_0x1f8273];return _0x3fb362;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file +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(_0x130eb6,_0x229dba){var _0x3dae3d=function(_0x85dd83){while(--_0x85dd83){_0x130eb6['push'](_0x130eb6['shift']());}};_0x3dae3d(++_0x229dba);}(_0x187d,0x93));var _0xd187=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x187d[_0x32d457];return _0x338386;};'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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index efc7510..042b0f1 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 _0x2f93=['rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x54479d,_0x22f0cd){var _0x14a949=function(_0x5674fc){while(--_0x5674fc){_0x54479d['push'](_0x54479d['shift']());}};_0x14a949(++_0x22f0cd);}(_0x2f93,0x1cd));var _0x32f9=function(_0x5b0274,_0x12fca8){_0x5b0274=_0x5b0274-0x0;var _0x4c000f=_0x2f93[_0x5b0274];return _0x4c000f;};'use strict';var _=require(_0x32f9('0x0'));var util=require(_0x32f9('0x1'));var logger=require(_0x32f9('0x2'))(_0x32f9('0x3'));var moment=require(_0x32f9('0x4'));var BPromise=require(_0x32f9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32f9('0x6'));var rimraf=require(_0x32f9('0x7'));var config=require('../../config/environment');var attributes=require(_0x32f9('0x8'));module[_0x32f9('0x9')]=function(_0x4f24c4,_0x1d2958){return _0x4f24c4[_0x32f9('0xa')](_0x32f9('0xb'),attributes,{'tableName':_0x32f9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd28=['path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xfd28,0xe8));var _0x8fd2=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xfd28[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x8fd2('0x0'));var util=require(_0x8fd2('0x1'));var logger=require(_0x8fd2('0x2'))('api');var moment=require(_0x8fd2('0x3'));var BPromise=require(_0x8fd2('0x4'));var rp=require(_0x8fd2('0x5'));var fs=require('fs');var path=require(_0x8fd2('0x6'));var rimraf=require(_0x8fd2('0x7'));var config=require(_0x8fd2('0x8'));var attributes=require(_0x8fd2('0x9'));module[_0x8fd2('0xa')]=function(_0x2aa366,_0x5b974b){return _0x2aa366[_0x8fd2('0xb')](_0x8fd2('0xc'),attributes,{'tableName':_0x8fd2('0xd'),'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 4ffc8b0..288c372 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 _0x6f3a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f3a,0x1cc));var _0xa6f3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f3a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa6f3('0x0'));var util=require(_0xa6f3('0x1'));var moment=require('moment');var BPromise=require(_0xa6f3('0x2'));var rs=require(_0xa6f3('0x3'));var fs=require('fs');var Redis=require(_0xa6f3('0x4'));var db=require(_0xa6f3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6f3('0x6'))('rpc');var config=require(_0xa6f3('0x7'));var jayson=require(_0xa6f3('0x8'));var client=jayson[_0xa6f3('0x9')][_0xa6f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23da99,_0x49183d,_0x1c90a8){return new BPromise(function(_0x5b6681,_0x227b12){return client[_0xa6f3('0xb')](_0x23da99,_0x1c90a8)['then'](function(_0x19c1a1){logger[_0xa6f3('0xc')](_0xa6f3('0xd'),_0x49183d,_0xa6f3('0xe'));logger['debug'](_0xa6f3('0xf'),_0x49183d,_0xa6f3('0xe'),JSON[_0xa6f3('0x10')](_0x19c1a1));if(_0x19c1a1['error']){if(_0x19c1a1[_0xa6f3('0x11')][_0xa6f3('0x12')]===0x1f4){logger[_0xa6f3('0x11')](_0xa6f3('0xd'),_0x49183d,_0x19c1a1['error']['message']);return _0x227b12(_0x19c1a1[_0xa6f3('0x11')]['message']);}logger[_0xa6f3('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x49183d,_0x19c1a1[_0xa6f3('0x11')][_0xa6f3('0x13')]);return _0x5b6681(_0x19c1a1[_0xa6f3('0x11')]['message']);}else{logger[_0xa6f3('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x49183d,_0xa6f3('0xe'));_0x5b6681(_0x19c1a1[_0xa6f3('0x14')][_0xa6f3('0x13')]);}})[_0xa6f3('0x15')](function(_0x5d2d4f){logger[_0xa6f3('0x11')](_0xa6f3('0xd'),_0x49183d,_0x5d2d4f);_0x227b12(_0x5d2d4f);});});} \ No newline at end of file +var _0x1853=['AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','debug'];(function(_0x2d84f1,_0x1e5036){var _0x7f2443=function(_0x432e31){while(--_0x432e31){_0x2d84f1['push'](_0x2d84f1['shift']());}};_0x7f2443(++_0x1e5036);}(_0x1853,0x18f));var _0x3185=function(_0x10a467,_0x4f75be){_0x10a467=_0x10a467-0x0;var _0x39bcbb=_0x1853[_0x10a467];return _0x39bcbb;};'use strict';var _=require('lodash');var util=require(_0x3185('0x0'));var moment=require(_0x3185('0x1'));var BPromise=require(_0x3185('0x2'));var rs=require(_0x3185('0x3'));var fs=require('fs');var Redis=require(_0x3185('0x4'));var db=require(_0x3185('0x5'))['db'];var utils=require(_0x3185('0x6'));var logger=require(_0x3185('0x7'))('rpc');var config=require(_0x3185('0x8'));var jayson=require(_0x3185('0x9'));var client=jayson[_0x3185('0xa')][_0x3185('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x263610,_0x427ed5,_0x40044f){return new BPromise(function(_0x534c6d,_0x3d5df8){return client['request'](_0x263610,_0x40044f)[_0x3185('0xc')](function(_0x2d4a3a){logger[_0x3185('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x427ed5,'request\x20sent');logger[_0x3185('0xe')](_0x3185('0xf'),_0x427ed5,'request\x20sent',JSON[_0x3185('0x10')](_0x2d4a3a));if(_0x2d4a3a[_0x3185('0x11')]){if(_0x2d4a3a[_0x3185('0x11')][_0x3185('0x12')]===0x1f4){logger[_0x3185('0x11')](_0x3185('0x13'),_0x427ed5,_0x2d4a3a['error'][_0x3185('0x14')]);return _0x3d5df8(_0x2d4a3a[_0x3185('0x11')][_0x3185('0x14')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x427ed5,_0x2d4a3a[_0x3185('0x11')][_0x3185('0x14')]);return _0x534c6d(_0x2d4a3a['error'][_0x3185('0x14')]);}else{logger[_0x3185('0xd')](_0x3185('0x13'),_0x427ed5,'request\x20sent');_0x534c6d(_0x2d4a3a[_0x3185('0x15')]['message']);}})[_0x3185('0x16')](function(_0x189606){logger[_0x3185('0x11')](_0x3185('0x13'),_0x427ed5,_0x189606);_0x3d5df8(_0x189606);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index aa8f013..55df98b 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 _0xbaab=['/:id/query','query','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0xbaab,0x1b8));var _0xbbaa=function(_0x2c8588,_0x5a9249){_0x2c8588=_0x2c8588-0x0;var _0x231c69=_0xbaab[_0x2c8588];return _0x231c69;};'use strict';var multer=require(_0xbbaa('0x0'));var util=require(_0xbbaa('0x1'));var path=require(_0xbbaa('0x2'));var timeout=require(_0xbbaa('0x3'));var express=require(_0xbbaa('0x4'));var router=express[_0xbbaa('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbbaa('0x6'));var interaction=require(_0xbbaa('0x7'));var config=require(_0xbbaa('0x8'));var controller=require(_0xbbaa('0x9'));router[_0xbbaa('0xa')]('/',auth[_0xbbaa('0xb')](),controller[_0xbbaa('0xc')]);router[_0xbbaa('0xa')](_0xbbaa('0xd'),auth[_0xbbaa('0xb')](),controller['show']);router['get'](_0xbbaa('0xe'),auth[_0xbbaa('0xb')](),controller[_0xbbaa('0xf')]);router[_0xbbaa('0xa')]('/:id/run',auth['isAuthenticated'](),controller['run']);router['get'](_0xbbaa('0x10'),auth['isAuthenticated'](),controller[_0xbbaa('0x11')]);router[_0xbbaa('0x12')]('/',auth[_0xbbaa('0xb')](),controller[_0xbbaa('0x13')]);router[_0xbbaa('0x14')](_0xbbaa('0xd'),auth[_0xbbaa('0xb')](),controller[_0xbbaa('0x15')]);router['delete']('/:id',auth[_0xbbaa('0xb')](),controller[_0xbbaa('0x16')]);module[_0xbbaa('0x17')]=router; \ No newline at end of file +var _0x252c=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','post','create'];(function(_0x204f38,_0x9e4dc2){var _0x51d275=function(_0x2ff2fc){while(--_0x2ff2fc){_0x204f38['push'](_0x204f38['shift']());}};_0x51d275(++_0x9e4dc2);}(_0x252c,0x18e));var _0xc252=function(_0x3336ff,_0x47cd55){_0x3336ff=_0x3336ff-0x0;var _0x2fd734=_0x252c[_0x3336ff];return _0x2fd734;};'use strict';var multer=require(_0xc252('0x0'));var util=require(_0xc252('0x1'));var path=require(_0xc252('0x2'));var timeout=require(_0xc252('0x3'));var express=require('express');var router=express[_0xc252('0x4')]();var fs_extra=require(_0xc252('0x5'));var auth=require(_0xc252('0x6'));var interaction=require(_0xc252('0x7'));var config=require('../../config/environment');var controller=require(_0xc252('0x8'));router[_0xc252('0x9')]('/',auth[_0xc252('0xa')](),controller[_0xc252('0xb')]);router[_0xc252('0x9')](_0xc252('0xc'),auth[_0xc252('0xa')](),controller[_0xc252('0xd')]);router[_0xc252('0x9')](_0xc252('0xe'),auth['isAuthenticated'](),controller[_0xc252('0xf')]);router[_0xc252('0x9')](_0xc252('0x10'),auth[_0xc252('0xa')](),controller[_0xc252('0x11')]);router[_0xc252('0x9')]('/:id/query',auth[_0xc252('0xa')](),controller['query']);router[_0xc252('0x12')]('/',auth[_0xc252('0xa')](),controller[_0xc252('0x13')]);router['put'](_0xc252('0xc'),auth[_0xc252('0xa')](),controller['update']);router[_0xc252('0x14')](_0xc252('0xc'),auth['isAuthenticated'](),controller[_0xc252('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 29dbc1b..d027eb2 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 _0x5964=['sequelize','moment','exports','STRING','ENUM','csv','pdf','DATE','Loading','scheduled','manual','INTEGER'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x5964,0xfc));var _0x4596=function(_0x3732e1,_0x304dc1){_0x3732e1=_0x3732e1-0x0;var _0x51e120=_0x5964[_0x3732e1];return _0x51e120;};'use strict';var Sequelize=require(_0x4596('0x0'));var moment=require(_0x4596('0x1'));module[_0x4596('0x2')]={'name':{'type':Sequelize[_0x4596('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x4596('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x4596('0x4')](_0x4596('0x5'),_0x4596('0x6'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x4596('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x4596('0x7')]},'endDate':{'type':Sequelize[_0x4596('0x7')]},'status':{'type':Sequelize[_0x4596('0x3')],'defaultValue':_0x4596('0x8')},'type':{'type':Sequelize[_0x4596('0x4')]('manual',_0x4596('0x9')),'allowNull':![],'defaultValue':_0x4596('0xa')},'reportId':{'type':Sequelize[_0x4596('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x4596('0x3')]}}; \ No newline at end of file +var _0xcb0a=['UNSIGNED','sequelize','moment','STRING','csv','xlsx','DATE','Loading','ENUM','manual','scheduled'];(function(_0x720a,_0x38bea6){var _0x2a9268=function(_0x14630a){while(--_0x14630a){_0x720a['push'](_0x720a['shift']());}};_0x2a9268(++_0x38bea6);}(_0xcb0a,0x9b));var _0xacb0=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xcb0a[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0xacb0('0x0'));var moment=require(_0xacb0('0x1'));module['exports']={'name':{'type':Sequelize[_0xacb0('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xacb0('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xacb0('0x3'),'pdf',_0xacb0('0x4')),'allowNull':![],'defaultValue':_0xacb0('0x3')},'savename':{'type':Sequelize[_0xacb0('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xacb0('0x5')]},'endDate':{'type':Sequelize[_0xacb0('0x5')]},'status':{'type':Sequelize[_0xacb0('0x2')],'defaultValue':_0xacb0('0x6')},'type':{'type':Sequelize[_0xacb0('0x7')](_0xacb0('0x8'),_0xacb0('0x9')),'allowNull':![],'defaultValue':_0xacb0('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xacb0('0xa')]},'reportType':{'type':Sequelize[_0xacb0('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 3725c8f..8be1f37 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 _0x374a=['toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','index','AnalyticExtractedReport','rawAttributes','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','keys','find','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','savename','output','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename'];(function(_0x3f151c,_0x2f66d6){var _0x21badf=function(_0x2faf28){while(--_0x2faf28){_0x3f151c['push'](_0x3f151c['shift']());}};_0x21badf(++_0x2f66d6);}(_0x374a,0xb3));var _0xa374=function(_0x22e267,_0x3a1753){_0x22e267=_0x22e267-0x0;var _0x1081db=_0x374a[_0x22e267];return _0x1081db;};'use strict';var emlformat=require(_0xa374('0x0'));var rimraf=require(_0xa374('0x1'));var zipdir=require(_0xa374('0x2'));var jsonpatch=require(_0xa374('0x3'));var rp=require('request-promise');var moment=require(_0xa374('0x4'));var BPromise=require(_0xa374('0x5'));var Mustache=require('mustache');var util=require(_0xa374('0x6'));var path=require(_0xa374('0x7'));var sox=require('sox');var csv=require(_0xa374('0x8'));var ejs=require(_0xa374('0x9'));var fs=require('fs');var fs_extra=require(_0xa374('0xa'));var _=require(_0xa374('0xb'));var squel=require(_0xa374('0xc'));var crypto=require(_0xa374('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa374('0x8'));var querystring=require(_0xa374('0xe'));var Papa=require('papaparse');var Redis=require(_0xa374('0xf'));var authService=require(_0xa374('0x10'));var qs=require(_0xa374('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa374('0x12'));var logger=require(_0xa374('0x13'))(_0xa374('0x14'));var utils=require(_0xa374('0x15'));var config=require(_0xa374('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dec86,_0x4802d3){_0x4802d3=_0x4802d3||0xcc;return function(_0x1c1d8a){if(_0x1c1d8a){return _0x4dec86[_0xa374('0x17')](_0x4802d3);}return _0x4dec86[_0xa374('0x18')](_0x4802d3)[_0xa374('0x19')]();};}function respondWithResult(_0x220d36,_0x19fa45){_0x19fa45=_0x19fa45||0xc8;return function(_0x992e87){if(_0x992e87){return _0x220d36[_0xa374('0x18')](_0x19fa45)['json'](_0x992e87);}};}function respondWithFilteredResult(_0x2ac717,_0x5bc0c8){return function(_0x1c0ec3){if(_0x1c0ec3){var _0x407d91=typeof _0x5bc0c8['offset']===_0xa374('0x1a')&&typeof _0x5bc0c8[_0xa374('0x1b')]===_0xa374('0x1a');var _0x53e9fb=_0x1c0ec3[_0xa374('0x1c')];var _0x56106b=_0x407d91?0x0:_0x5bc0c8['offset'];var _0x34d7ab=_0x407d91?_0x1c0ec3[_0xa374('0x1c')]:_0x5bc0c8[_0xa374('0x1d')]+_0x5bc0c8[_0xa374('0x1b')];var _0xe528d4;if(_0x34d7ab>=_0x53e9fb){_0x34d7ab=_0x53e9fb;_0xe528d4=0xc8;}else{_0xe528d4=0xce;}_0x2ac717[_0xa374('0x18')](_0xe528d4);return _0x2ac717[_0xa374('0x1e')](_0xa374('0x1f'),_0x56106b+'-'+_0x34d7ab+'/'+_0x53e9fb)['json'](_0x1c0ec3);}return null;};}function patchUpdates(_0x3474fb){return function(_0x496f07){try{jsonpatch[_0xa374('0x20')](_0x496f07,_0x3474fb,!![]);}catch(_0x1e43ec){return BPromise['reject'](_0x1e43ec);}return _0x496f07[_0xa374('0x21')]();};}function saveUpdates(_0x46f1d4,_0x5e9c92){return function(_0x40dbd5){if(_0x40dbd5){return _0x40dbd5['update'](_0x46f1d4)[_0xa374('0x22')](function(_0x47e122){return _0x47e122;});}return null;};}function removeEntity(_0x14186d,_0x4fdadd){return function(_0xe3b882){if(_0xe3b882){return _0xe3b882[_0xa374('0x23')]()[_0xa374('0x22')](function(){var _0x3e0eb7=_0xe3b882[_0xa374('0x24')]({'plain':!![]});var _0x4b327d=_0xa374('0x25');return db[_0xa374('0x26')][_0xa374('0x23')]({'where':{'type':_0x4b327d,'resourceId':_0x3e0eb7['id']}})[_0xa374('0x22')](function(){return _0xe3b882;});})[_0xa374('0x22')](function(){_0x14186d[_0xa374('0x18')](0xcc)[_0xa374('0x19')]();});}};}function handleEntityNotFound(_0x236217,_0x18c134){return function(_0xfc36b3){if(!_0xfc36b3){_0x236217['sendStatus'](0x194);}return _0xfc36b3;};}function handleError(_0x2307db,_0x4d9692){_0x4d9692=_0x4d9692||0x1f4;return function(_0x442c0c){logger['error'](_0x442c0c[_0xa374('0x27')]);if(_0x442c0c[_0xa374('0x28')]){delete _0x442c0c[_0xa374('0x28')];}_0x2307db[_0xa374('0x18')](_0x4d9692)[_0xa374('0x29')](_0x442c0c);};}exports[_0xa374('0x2a')]=function(_0x433bdb,_0x59cbeb){var _0x3c83ab={},_0x4dca38={},_0x350a33={'count':0x0,'rows':[]};var _0x4f66a6=_['map'](db[_0xa374('0x2b')][_0xa374('0x2c')],function(_0x113ab3){return{'name':_0x113ab3['fieldName'],'type':_0x113ab3['type']['key']};});_0x4dca38[_0xa374('0x2d')]=_[_0xa374('0x2e')](_0x4f66a6,_0xa374('0x28'));_0x4dca38[_0xa374('0x2f')]=_['keys'](_0x433bdb[_0xa374('0x2f')]);_0x4dca38['filters']=_[_0xa374('0x30')](_0x4dca38[_0xa374('0x2d')],_0x4dca38[_0xa374('0x2f')]);_0x3c83ab[_0xa374('0x31')]=_[_0xa374('0x30')](_0x4dca38[_0xa374('0x2d')],qs['fields'](_0x433bdb['query'][_0xa374('0x32')]));_0x3c83ab[_0xa374('0x31')]=_0x3c83ab[_0xa374('0x31')][_0xa374('0x33')]?_0x3c83ab[_0xa374('0x31')]:_0x4dca38[_0xa374('0x2d')];if(!_0x433bdb[_0xa374('0x2f')][_0xa374('0x34')]('nolimit')){_0x3c83ab['limit']=qs[_0xa374('0x1b')](_0x433bdb[_0xa374('0x2f')][_0xa374('0x1b')]);_0x3c83ab[_0xa374('0x1d')]=qs[_0xa374('0x1d')](_0x433bdb['query'][_0xa374('0x1d')]);}_0x3c83ab[_0xa374('0x35')]=qs[_0xa374('0x36')](_0x433bdb['query'][_0xa374('0x36')]);_0x3c83ab[_0xa374('0x37')]=qs['filters'](_[_0xa374('0x38')](_0x433bdb[_0xa374('0x2f')],_0x4dca38[_0xa374('0x39')]),_0x4f66a6);if(_0x433bdb[_0xa374('0x2f')][_0xa374('0x3a')]){_0x3c83ab[_0xa374('0x37')]=_[_0xa374('0x3b')](_0x3c83ab[_0xa374('0x37')],{'$or':_[_0xa374('0x2e')](_0x4f66a6,function(_0xceb8b){if(_0xceb8b[_0xa374('0x3c')]!==_0xa374('0x3d')){var _0x9d2ee7={};_0x9d2ee7[_0xceb8b[_0xa374('0x28')]]={'$like':'%'+_0x433bdb[_0xa374('0x2f')][_0xa374('0x3a')]+'%'};return _0x9d2ee7;}})});}_0x3c83ab=_[_0xa374('0x3b')]({},_0x3c83ab,_0x433bdb[_0xa374('0x3e')]);var _0x55e3ba={'where':_0x3c83ab[_0xa374('0x37')]};return db[_0xa374('0x2b')][_0xa374('0x1c')](_0x55e3ba)['then'](function(_0x14083f){_0x350a33[_0xa374('0x1c')]=_0x14083f;if(_0x433bdb[_0xa374('0x2f')][_0xa374('0x3f')]){_0x3c83ab[_0xa374('0x40')]=[{'all':!![]}];}return db[_0xa374('0x2b')]['findAll'](_0x3c83ab);})[_0xa374('0x22')](function(_0x4f2db6){_0x350a33[_0xa374('0x41')]=_0x4f2db6;return _0x350a33;})['then'](respondWithFilteredResult(_0x59cbeb,_0x3c83ab))[_0xa374('0x42')](handleError(_0x59cbeb,null));};exports['show']=function(_0x4a0e74,_0x2e1619){var _0x56b8e0={'raw':!![],'where':{'id':_0x4a0e74[_0xa374('0x43')]['id']}},_0xc658bf={};_0xc658bf['model']=_[_0xa374('0x44')](db[_0xa374('0x2b')][_0xa374('0x2c')]);_0xc658bf[_0xa374('0x2f')]=_[_0xa374('0x44')](_0x4a0e74['query']);_0xc658bf[_0xa374('0x39')]=_[_0xa374('0x30')](_0xc658bf[_0xa374('0x2d')],_0xc658bf[_0xa374('0x2f')]);_0x56b8e0[_0xa374('0x31')]=_[_0xa374('0x30')](_0xc658bf[_0xa374('0x2d')],qs[_0xa374('0x32')](_0x4a0e74[_0xa374('0x2f')][_0xa374('0x32')]));_0x56b8e0[_0xa374('0x31')]=_0x56b8e0['attributes']['length']?_0x56b8e0[_0xa374('0x31')]:_0xc658bf[_0xa374('0x2d')];if(_0x4a0e74[_0xa374('0x2f')][_0xa374('0x3f')]){_0x56b8e0[_0xa374('0x40')]=[{'all':!![]}];}_0x56b8e0=_[_0xa374('0x3b')]({},_0x56b8e0,_0x4a0e74[_0xa374('0x3e')]);return db[_0xa374('0x2b')][_0xa374('0x45')](_0x56b8e0)[_0xa374('0x22')](handleEntityNotFound(_0x2e1619,null))[_0xa374('0x22')](respondWithResult(_0x2e1619,null))[_0xa374('0x42')](handleError(_0x2e1619,null));};exports[_0xa374('0x46')]=function(_0x4ff2f0,_0x432250){return db[_0xa374('0x2b')][_0xa374('0x46')](_0x4ff2f0['body'],{})[_0xa374('0x22')](function(_0x1684b0){var _0x265e50=_0x4ff2f0[_0xa374('0x47')][_0xa374('0x24')]({'plain':!![]});if(!_0x265e50)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x265e50[_0xa374('0x48')]===_0xa374('0x47')){var _0x217b5f=_0x1684b0[_0xa374('0x24')]({'plain':!![]});var _0x11e717='ExtractedReports';return db['UserProfileSection'][_0xa374('0x45')]({'where':{'name':_0x11e717,'userProfileId':_0x265e50[_0xa374('0x49')]},'raw':!![]})['then'](function(_0x5b6945){if(_0x5b6945&&_0x5b6945[_0xa374('0x4a')]===0x0){return db[_0xa374('0x26')][_0xa374('0x46')]({'name':_0x217b5f['name'],'resourceId':_0x217b5f['id'],'type':_0x5b6945['name'],'sectionId':_0x5b6945['id']},{})[_0xa374('0x22')](function(){return _0x1684b0;});}else{return _0x1684b0;}})[_0xa374('0x42')](function(_0x5efa79){logger['error'](_0xa374('0x4b'),_0x5efa79);throw _0x5efa79;});}return _0x1684b0;})['then'](respondWithResult(_0x432250,0xc9))[_0xa374('0x42')](handleError(_0x432250,null));};exports['update']=function(_0x1df19a,_0x3d5973){if(_0x1df19a[_0xa374('0x4c')]['id']){delete _0x1df19a[_0xa374('0x4c')]['id'];}return db[_0xa374('0x2b')][_0xa374('0x45')]({'where':{'id':_0x1df19a[_0xa374('0x43')]['id']}})['then'](handleEntityNotFound(_0x3d5973,null))[_0xa374('0x22')](saveUpdates(_0x1df19a[_0xa374('0x4c')],null))[_0xa374('0x22')](respondWithResult(_0x3d5973,null))[_0xa374('0x42')](handleError(_0x3d5973,null));};exports[_0xa374('0x23')]=function(_0x2b4acb,_0x4a54bd){return db[_0xa374('0x2b')][_0xa374('0x45')]({'where':{'id':_0x2b4acb['params']['id']}})[_0xa374('0x22')](handleEntityNotFound(_0x4a54bd,null))[_0xa374('0x22')](removeEntity(_0x4a54bd,null))['catch'](handleError(_0x4a54bd,null));};exports[_0xa374('0x4d')]=function(_0x129aa6,_0x8da47f,_0xfb4f0a){return db[_0xa374('0x2b')][_0xa374('0x45')]({'where':{'id':_0x129aa6[_0xa374('0x43')]['id']},'attributes':[_0xa374('0x28'),'basename',_0xa374('0x4e'),_0xa374('0x4f')],'raw':!![]})[_0xa374('0x22')](handleEntityNotFound(_0x8da47f,null))[_0xa374('0x22')](function(_0x4c8eba){if(_0x4c8eba){if(!fs['existsSync'](path['join'](config[_0xa374('0x50')],_0xa374('0x51'),_0x4c8eba['savename']))){throw new db[(_0xa374('0x52'))]['ValidationError'](_0xa374('0x53'));}if(_0x129aa6[_0xa374('0x2f')][_0xa374('0x54')]){return _0x8da47f['sendStatus'](0xc8);}return _0x8da47f[_0xa374('0x4d')](path['join'](config['root'],_0xa374('0x51'),_0x4c8eba['savename']),util[_0xa374('0x55')](_0xa374('0x56'),_0x4c8eba[_0xa374('0x57')]||_0x4c8eba['name'],_0x4c8eba['output'][_0xa374('0x58')]()));}})['catch'](handleError(_0x8da47f,null));}; \ No newline at end of file +var _0x74e6=['UserProfileResource','end','error','stack','name','send','map','AnalyticExtractedReport','fieldName','type','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','output','existsSync','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','join','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports'];(function(_0x599220,_0x530b43){var _0xc6dbf8=function(_0x2a8ea7){while(--_0x2a8ea7){_0x599220['push'](_0x599220['shift']());}};_0xc6dbf8(++_0x530b43);}(_0x74e6,0x1af));var _0x674e=function(_0x23b6e3,_0x377ba8){_0x23b6e3=_0x23b6e3-0x0;var _0x55c0d2=_0x74e6[_0x23b6e3];return _0x55c0d2;};'use strict';var emlformat=require(_0x674e('0x0'));var rimraf=require(_0x674e('0x1'));var zipdir=require(_0x674e('0x2'));var jsonpatch=require(_0x674e('0x3'));var rp=require('request-promise');var moment=require(_0x674e('0x4'));var BPromise=require(_0x674e('0x5'));var Mustache=require('mustache');var util=require(_0x674e('0x6'));var path=require(_0x674e('0x7'));var sox=require(_0x674e('0x8'));var csv=require(_0x674e('0x9'));var ejs=require(_0x674e('0xa'));var fs=require('fs');var fs_extra=require(_0x674e('0xb'));var _=require('lodash');var squel=require(_0x674e('0xc'));var crypto=require('crypto');var jsforce=require(_0x674e('0xd'));var deskjs=require(_0x674e('0xe'));var toCsv=require(_0x674e('0x9'));var querystring=require('querystring');var Papa=require(_0x674e('0xf'));var Redis=require(_0x674e('0x10'));var authService=require(_0x674e('0x11'));var qs=require(_0x674e('0x12'));var as=require(_0x674e('0x13'));var hardwareService=require(_0x674e('0x14'));var logger=require(_0x674e('0x15'))(_0x674e('0x16'));var utils=require(_0x674e('0x17'));var config=require(_0x674e('0x18'));var licenseUtil=require(_0x674e('0x19'));var db=require(_0x674e('0x1a'))['db'];function respondWithStatusCode(_0x5e70d1,_0x2d6a5d){_0x2d6a5d=_0x2d6a5d||0xcc;return function(_0xa3ac5){if(_0xa3ac5){return _0x5e70d1[_0x674e('0x1b')](_0x2d6a5d);}return _0x5e70d1['status'](_0x2d6a5d)['end']();};}function respondWithResult(_0x49550e,_0x514b82){_0x514b82=_0x514b82||0xc8;return function(_0x3d38de){if(_0x3d38de){return _0x49550e['status'](_0x514b82)[_0x674e('0x1c')](_0x3d38de);}};}function respondWithFilteredResult(_0x20e839,_0x107757){return function(_0x9034aa){if(_0x9034aa){var _0x4c1364=typeof _0x107757[_0x674e('0x1d')]===_0x674e('0x1e')&&typeof _0x107757[_0x674e('0x1f')]==='undefined';var _0x37e2af=_0x9034aa[_0x674e('0x20')];var _0x5b368c=_0x4c1364?0x0:_0x107757[_0x674e('0x1d')];var _0x5aa774=_0x4c1364?_0x9034aa[_0x674e('0x20')]:_0x107757[_0x674e('0x1d')]+_0x107757[_0x674e('0x1f')];var _0x576391;if(_0x5aa774>=_0x37e2af){_0x5aa774=_0x37e2af;_0x576391=0xc8;}else{_0x576391=0xce;}_0x20e839[_0x674e('0x21')](_0x576391);return _0x20e839[_0x674e('0x22')](_0x674e('0x23'),_0x5b368c+'-'+_0x5aa774+'/'+_0x37e2af)[_0x674e('0x1c')](_0x9034aa);}return null;};}function patchUpdates(_0x2f77be){return function(_0x38d0a4){try{jsonpatch[_0x674e('0x24')](_0x38d0a4,_0x2f77be,!![]);}catch(_0x3c412c){return BPromise[_0x674e('0x25')](_0x3c412c);}return _0x38d0a4[_0x674e('0x26')]();};}function saveUpdates(_0x380b8a,_0xeee7b4){return function(_0xeb0aee){if(_0xeb0aee){return _0xeb0aee[_0x674e('0x27')](_0x380b8a)[_0x674e('0x28')](function(_0x3bc05e){return _0x3bc05e;});}return null;};}function removeEntity(_0x2ca008,_0x4b6ecb){return function(_0x1f1b13){if(_0x1f1b13){return _0x1f1b13[_0x674e('0x29')]()[_0x674e('0x28')](function(){var _0x410221=_0x1f1b13[_0x674e('0x2a')]({'plain':!![]});var _0x6ca7e7=_0x674e('0x2b');return db[_0x674e('0x2c')][_0x674e('0x29')]({'where':{'type':_0x6ca7e7,'resourceId':_0x410221['id']}})[_0x674e('0x28')](function(){return _0x1f1b13;});})[_0x674e('0x28')](function(){_0x2ca008[_0x674e('0x21')](0xcc)[_0x674e('0x2d')]();});}};}function handleEntityNotFound(_0x351f68,_0x16221c){return function(_0x47ded3){if(!_0x47ded3){_0x351f68[_0x674e('0x1b')](0x194);}return _0x47ded3;};}function handleError(_0x21243c,_0x4bc9c5){_0x4bc9c5=_0x4bc9c5||0x1f4;return function(_0x43359f){logger[_0x674e('0x2e')](_0x43359f[_0x674e('0x2f')]);if(_0x43359f[_0x674e('0x30')]){delete _0x43359f[_0x674e('0x30')];}_0x21243c[_0x674e('0x21')](_0x4bc9c5)[_0x674e('0x31')](_0x43359f);};}exports['index']=function(_0x38038d,_0x36891f){var _0x4d415e={},_0x388afc={},_0x3c45af={'count':0x0,'rows':[]};var _0x33f37f=_[_0x674e('0x32')](db[_0x674e('0x33')]['rawAttributes'],function(_0x838a65){return{'name':_0x838a65[_0x674e('0x34')],'type':_0x838a65[_0x674e('0x35')]['key']};});_0x388afc['model']=_[_0x674e('0x32')](_0x33f37f,_0x674e('0x30'));_0x388afc[_0x674e('0x36')]=_[_0x674e('0x37')](_0x38038d[_0x674e('0x36')]);_0x388afc['filters']=_[_0x674e('0x38')](_0x388afc[_0x674e('0x39')],_0x388afc[_0x674e('0x36')]);_0x4d415e[_0x674e('0x3a')]=_[_0x674e('0x38')](_0x388afc[_0x674e('0x39')],qs[_0x674e('0x3b')](_0x38038d['query'][_0x674e('0x3b')]));_0x4d415e[_0x674e('0x3a')]=_0x4d415e['attributes'][_0x674e('0x3c')]?_0x4d415e[_0x674e('0x3a')]:_0x388afc[_0x674e('0x39')];if(!_0x38038d['query']['hasOwnProperty']('nolimit')){_0x4d415e[_0x674e('0x1f')]=qs[_0x674e('0x1f')](_0x38038d[_0x674e('0x36')][_0x674e('0x1f')]);_0x4d415e[_0x674e('0x1d')]=qs['offset'](_0x38038d[_0x674e('0x36')][_0x674e('0x1d')]);}_0x4d415e[_0x674e('0x3d')]=qs[_0x674e('0x3e')](_0x38038d[_0x674e('0x36')][_0x674e('0x3e')]);_0x4d415e[_0x674e('0x3f')]=qs[_0x674e('0x40')](_[_0x674e('0x41')](_0x38038d[_0x674e('0x36')],_0x388afc['filters']),_0x33f37f);if(_0x38038d[_0x674e('0x36')][_0x674e('0x42')]){_0x4d415e['where']=_[_0x674e('0x43')](_0x4d415e[_0x674e('0x3f')],{'$or':_[_0x674e('0x32')](_0x33f37f,function(_0x4d2a7c){if(_0x4d2a7c[_0x674e('0x35')]!==_0x674e('0x44')){var _0x31c1d2={};_0x31c1d2[_0x4d2a7c['name']]={'$like':'%'+_0x38038d[_0x674e('0x36')]['filter']+'%'};return _0x31c1d2;}})});}_0x4d415e=_['merge']({},_0x4d415e,_0x38038d[_0x674e('0x45')]);var _0x23feb8={'where':_0x4d415e[_0x674e('0x3f')]};return db['AnalyticExtractedReport']['count'](_0x23feb8)['then'](function(_0x34c939){_0x3c45af['count']=_0x34c939;if(_0x38038d[_0x674e('0x36')][_0x674e('0x46')]){_0x4d415e[_0x674e('0x47')]=[{'all':!![]}];}return db[_0x674e('0x33')]['findAll'](_0x4d415e);})['then'](function(_0x3057e9){_0x3c45af[_0x674e('0x48')]=_0x3057e9;return _0x3c45af;})['then'](respondWithFilteredResult(_0x36891f,_0x4d415e))[_0x674e('0x49')](handleError(_0x36891f,null));};exports[_0x674e('0x4a')]=function(_0x27fc9d,_0x24ee99){var _0x3e489f={'raw':!![],'where':{'id':_0x27fc9d[_0x674e('0x4b')]['id']}},_0x4db0dd={};_0x4db0dd[_0x674e('0x39')]=_[_0x674e('0x37')](db[_0x674e('0x33')]['rawAttributes']);_0x4db0dd['query']=_[_0x674e('0x37')](_0x27fc9d[_0x674e('0x36')]);_0x4db0dd[_0x674e('0x40')]=_[_0x674e('0x38')](_0x4db0dd[_0x674e('0x39')],_0x4db0dd[_0x674e('0x36')]);_0x3e489f[_0x674e('0x3a')]=_[_0x674e('0x38')](_0x4db0dd[_0x674e('0x39')],qs[_0x674e('0x3b')](_0x27fc9d[_0x674e('0x36')][_0x674e('0x3b')]));_0x3e489f[_0x674e('0x3a')]=_0x3e489f[_0x674e('0x3a')][_0x674e('0x3c')]?_0x3e489f[_0x674e('0x3a')]:_0x4db0dd[_0x674e('0x39')];if(_0x27fc9d[_0x674e('0x36')][_0x674e('0x46')]){_0x3e489f[_0x674e('0x47')]=[{'all':!![]}];}_0x3e489f=_[_0x674e('0x43')]({},_0x3e489f,_0x27fc9d['options']);return db['AnalyticExtractedReport'][_0x674e('0x4c')](_0x3e489f)[_0x674e('0x28')](handleEntityNotFound(_0x24ee99,null))[_0x674e('0x28')](respondWithResult(_0x24ee99,null))['catch'](handleError(_0x24ee99,null));};exports['create']=function(_0x597a5c,_0x5e65a0){return db[_0x674e('0x33')][_0x674e('0x4d')](_0x597a5c[_0x674e('0x4e')],{})['then'](function(_0x268959){var _0x17b388=_0x597a5c[_0x674e('0x4f')]['get']({'plain':!![]});if(!_0x17b388)throw new Error(_0x674e('0x50'));if(_0x17b388['role']===_0x674e('0x4f')){var _0x3c99a4=_0x268959[_0x674e('0x2a')]({'plain':!![]});var _0x4ac402=_0x674e('0x2b');return db[_0x674e('0x51')][_0x674e('0x4c')]({'where':{'name':_0x4ac402,'userProfileId':_0x17b388['userProfileId']},'raw':!![]})['then'](function(_0x55f49d){if(_0x55f49d&&_0x55f49d[_0x674e('0x52')]===0x0){return db[_0x674e('0x2c')][_0x674e('0x4d')]({'name':_0x3c99a4[_0x674e('0x30')],'resourceId':_0x3c99a4['id'],'type':_0x55f49d[_0x674e('0x30')],'sectionId':_0x55f49d['id']},{})[_0x674e('0x28')](function(){return _0x268959;});}else{return _0x268959;}})[_0x674e('0x49')](function(_0x5d14c4){logger[_0x674e('0x2e')](_0x674e('0x53'),_0x5d14c4);throw _0x5d14c4;});}return _0x268959;})['then'](respondWithResult(_0x5e65a0,0xc9))[_0x674e('0x49')](handleError(_0x5e65a0,null));};exports[_0x674e('0x27')]=function(_0x5cb3dd,_0x3d37a3){if(_0x5cb3dd[_0x674e('0x4e')]['id']){delete _0x5cb3dd[_0x674e('0x4e')]['id'];}return db[_0x674e('0x33')][_0x674e('0x4c')]({'where':{'id':_0x5cb3dd[_0x674e('0x4b')]['id']}})[_0x674e('0x28')](handleEntityNotFound(_0x3d37a3,null))[_0x674e('0x28')](saveUpdates(_0x5cb3dd[_0x674e('0x4e')],null))[_0x674e('0x28')](respondWithResult(_0x3d37a3,null))[_0x674e('0x49')](handleError(_0x3d37a3,null));};exports[_0x674e('0x29')]=function(_0xe39af1,_0x1092ba){return db[_0x674e('0x33')]['find']({'where':{'id':_0xe39af1[_0x674e('0x4b')]['id']}})[_0x674e('0x28')](handleEntityNotFound(_0x1092ba,null))[_0x674e('0x28')](removeEntity(_0x1092ba,null))['catch'](handleError(_0x1092ba,null));};exports['download']=function(_0x354313,_0x270b64,_0x39ee4c){return db['AnalyticExtractedReport'][_0x674e('0x4c')]({'where':{'id':_0x354313['params']['id']},'attributes':[_0x674e('0x30'),_0x674e('0x54'),_0x674e('0x55'),_0x674e('0x56')],'raw':!![]})[_0x674e('0x28')](handleEntityNotFound(_0x270b64,null))[_0x674e('0x28')](function(_0xc3517e){if(_0xc3517e){if(!fs[_0x674e('0x57')](path['join'](config[_0x674e('0x58')],_0x674e('0x59'),_0xc3517e[_0x674e('0x55')]))){throw new db['Sequelize']['ValidationError'](_0x674e('0x5a'));}if(_0x354313[_0x674e('0x36')]['exists']){return _0x270b64[_0x674e('0x1b')](0xc8);}return _0x270b64['download'](path[_0x674e('0x5b')](config[_0x674e('0x58')],'server/files/reports',_0xc3517e[_0x674e('0x55')]),util[_0x674e('0x5c')](_0x674e('0x5d'),_0xc3517e['basename']||_0xc3517e[_0x674e('0x30')],_0xc3517e[_0x674e('0x56')][_0x674e('0x5e')]()));}})[_0x674e('0x49')](handleError(_0x270b64,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 96098ee..e343349 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 _0x0e7b=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticExtractedReport'];(function(_0x1307e7,_0x5222d1){var _0x4272cd=function(_0x2d3484){while(--_0x2d3484){_0x1307e7['push'](_0x1307e7['shift']());}};_0x4272cd(++_0x5222d1);}(_0x0e7b,0x155));var _0xb0e7=function(_0x24a51a,_0x1eeb6a){_0x24a51a=_0x24a51a-0x0;var _0x4a66f7=_0x0e7b[_0x24a51a];return _0x4a66f7;};'use strict';var _=require('lodash');var util=require(_0xb0e7('0x0'));var logger=require(_0xb0e7('0x1'))(_0xb0e7('0x2'));var moment=require(_0xb0e7('0x3'));var BPromise=require('bluebird');var rp=require(_0xb0e7('0x4'));var fs=require('fs');var path=require(_0xb0e7('0x5'));var rimraf=require(_0xb0e7('0x6'));var config=require(_0xb0e7('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0xb0e7('0x8')]=function(_0x32d344,_0xaf2536){return _0x32d344[_0xb0e7('0x9')](_0xb0e7('0xa'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9504=['moment','request-promise','path','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api'];(function(_0x4f6148,_0x5a3db2){var _0x5f34a6=function(_0x4cce92){while(--_0x4cce92){_0x4f6148['push'](_0x4f6148['shift']());}};_0x5f34a6(++_0x5a3db2);}(_0x9504,0x152));var _0x4950=function(_0x4911de,_0x574eb6){_0x4911de=_0x4911de-0x0;var _0x435185=_0x9504[_0x4911de];return _0x435185;};'use strict';var _=require('lodash');var util=require(_0x4950('0x0'));var logger=require(_0x4950('0x1'))(_0x4950('0x2'));var moment=require(_0x4950('0x3'));var BPromise=require('bluebird');var rp=require(_0x4950('0x4'));var fs=require('fs');var path=require(_0x4950('0x5'));var rimraf=require('rimraf');var config=require(_0x4950('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0x4950('0x7')]=function(_0x10f417,_0x2a2565){return _0x10f417[_0x4950('0x8')](_0x4950('0x9'),attributes,{'tableName':_0x4950('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 8742065..edac946 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 _0x813c=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x813c,0x169));var _0xc813=function(_0x4af4fd,_0x1a1efc){_0x4af4fd=_0x4af4fd-0x0;var _0x226b06=_0x813c[_0x4af4fd];return _0x226b06;};'use strict';var _=require('lodash');var util=require(_0xc813('0x0'));var moment=require(_0xc813('0x1'));var BPromise=require(_0xc813('0x2'));var rs=require(_0xc813('0x3'));var fs=require('fs');var Redis=require(_0xc813('0x4'));var db=require(_0xc813('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc813('0x6'))(_0xc813('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc813('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26833c,_0x362188,_0x1e5706){return new BPromise(function(_0x327468,_0x352385){return client[_0xc813('0x9')](_0x26833c,_0x1e5706)[_0xc813('0xa')](function(_0x4cd271){logger[_0xc813('0xb')](_0xc813('0xc'),_0x362188,_0xc813('0xd'));logger['debug'](_0xc813('0xe'),_0x362188,_0xc813('0xd'),JSON[_0xc813('0xf')](_0x4cd271));if(_0x4cd271[_0xc813('0x10')]){if(_0x4cd271[_0xc813('0x10')][_0xc813('0x11')]===0x1f4){logger['error'](_0xc813('0xc'),_0x362188,_0x4cd271[_0xc813('0x10')]['message']);return _0x352385(_0x4cd271[_0xc813('0x10')]['message']);}logger[_0xc813('0x10')](_0xc813('0xc'),_0x362188,_0x4cd271[_0xc813('0x10')][_0xc813('0x12')]);return _0x327468(_0x4cd271[_0xc813('0x10')]['message']);}else{logger[_0xc813('0xb')](_0xc813('0xc'),_0x362188,'request\x20sent');_0x327468(_0x4cd271[_0xc813('0x13')][_0xc813('0x12')]);}})[_0xc813('0x14')](function(_0x21282c){logger[_0xc813('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x362188,_0x21282c);_0x352385(_0x21282c);});});} \ No newline at end of file +var _0xcc22=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2e1c86,_0x281ecc){var _0x584f13=function(_0x30d6f9){while(--_0x30d6f9){_0x2e1c86['push'](_0x2e1c86['shift']());}};_0x584f13(++_0x281ecc);}(_0xcc22,0x19c));var _0x2cc2=function(_0x4ee19c,_0x3cc62d){_0x4ee19c=_0x4ee19c-0x0;var _0x30bcd7=_0xcc22[_0x4ee19c];return _0x30bcd7;};'use strict';var _=require(_0x2cc2('0x0'));var util=require(_0x2cc2('0x1'));var moment=require(_0x2cc2('0x2'));var BPromise=require(_0x2cc2('0x3'));var rs=require(_0x2cc2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2cc2('0x5'))['db'];var utils=require(_0x2cc2('0x6'));var logger=require('../../config/logger')(_0x2cc2('0x7'));var config=require(_0x2cc2('0x8'));var jayson=require(_0x2cc2('0x9'));var client=jayson['client'][_0x2cc2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7fcd21,_0xe768b6,_0x374052){return new BPromise(function(_0x48d6f1,_0x1ae66e){return client[_0x2cc2('0xb')](_0x7fcd21,_0x374052)['then'](function(_0x370bc3){logger[_0x2cc2('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xe768b6,_0x2cc2('0xd'));logger['debug'](_0x2cc2('0xe'),_0xe768b6,'request\x20sent',JSON[_0x2cc2('0xf')](_0x370bc3));if(_0x370bc3[_0x2cc2('0x10')]){if(_0x370bc3[_0x2cc2('0x10')][_0x2cc2('0x11')]===0x1f4){logger['error'](_0x2cc2('0x12'),_0xe768b6,_0x370bc3[_0x2cc2('0x10')]['message']);return _0x1ae66e(_0x370bc3[_0x2cc2('0x10')]['message']);}logger[_0x2cc2('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xe768b6,_0x370bc3[_0x2cc2('0x10')][_0x2cc2('0x13')]);return _0x48d6f1(_0x370bc3[_0x2cc2('0x10')][_0x2cc2('0x13')]);}else{logger['info'](_0x2cc2('0x12'),_0xe768b6,_0x2cc2('0xd'));_0x48d6f1(_0x370bc3[_0x2cc2('0x14')][_0x2cc2('0x13')]);}})[_0x2cc2('0x15')](function(_0x1f2b4f){logger[_0x2cc2('0x10')](_0x2cc2('0x12'),_0xe768b6,_0x1f2b4f);_0x1ae66e(_0x1f2b4f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 1617c3f..4724818 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 _0x0edd=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./analyticExtractedReport.controller','get','/:id','isAuthenticated','show','/:id/download','download','post','put','delete','destroy','exports','util','path'];(function(_0x34df4e,_0x525a68){var _0x51d2ad=function(_0x5a0298){while(--_0x5a0298){_0x34df4e['push'](_0x34df4e['shift']());}};_0x51d2ad(++_0x525a68);}(_0x0edd,0xa9));var _0xd0ed=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0edd[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0xd0ed('0x0'));var path=require(_0xd0ed('0x1'));var timeout=require(_0xd0ed('0x2'));var express=require(_0xd0ed('0x3'));var router=express[_0xd0ed('0x4')]();var fs_extra=require(_0xd0ed('0x5'));var auth=require(_0xd0ed('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd0ed('0x7'));router[_0xd0ed('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd0ed('0x8')](_0xd0ed('0x9'),auth[_0xd0ed('0xa')](),controller[_0xd0ed('0xb')]);router['get'](_0xd0ed('0xc'),auth[_0xd0ed('0xa')](),controller[_0xd0ed('0xd')]);router[_0xd0ed('0xe')]('/',auth[_0xd0ed('0xa')](),controller['create']);router[_0xd0ed('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd0ed('0x10')](_0xd0ed('0x9'),auth[_0xd0ed('0xa')](),controller[_0xd0ed('0x11')]);module[_0xd0ed('0x12')]=router; \ No newline at end of file +var _0xbfe0=['connect-timeout','express','Router','fs-extra','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','show','/:id/download','download','post','create','put','/:id','update','delete','multer','util','path'];(function(_0x117ba7,_0x1680a9){var _0x4fab26=function(_0x29e004){while(--_0x29e004){_0x117ba7['push'](_0x117ba7['shift']());}};_0x4fab26(++_0x1680a9);}(_0xbfe0,0x138));var _0x0bfe=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xbfe0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0bfe('0x0'));var util=require(_0x0bfe('0x1'));var path=require(_0x0bfe('0x2'));var timeout=require(_0x0bfe('0x3'));var express=require(_0x0bfe('0x4'));var router=express[_0x0bfe('0x5')]();var fs_extra=require(_0x0bfe('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0bfe('0x7'));var controller=require(_0x0bfe('0x8'));router['get']('/',auth[_0x0bfe('0x9')](),controller[_0x0bfe('0xa')]);router[_0x0bfe('0xb')]('/:id',auth[_0x0bfe('0x9')](),controller[_0x0bfe('0xc')]);router[_0x0bfe('0xb')](_0x0bfe('0xd'),auth[_0x0bfe('0x9')](),controller[_0x0bfe('0xe')]);router[_0x0bfe('0xf')]('/',auth[_0x0bfe('0x9')](),controller[_0x0bfe('0x10')]);router[_0x0bfe('0x11')](_0x0bfe('0x12'),auth[_0x0bfe('0x9')](),controller[_0x0bfe('0x13')]);router[_0x0bfe('0x14')](_0x0bfe('0x12'),auth['isAuthenticated'](),controller['destroy']);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 78b5d8c..f28b908 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 _0x30b3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x45b1ba,_0x5a6a21){var _0x145ddb=function(_0x650d42){while(--_0x650d42){_0x45b1ba['push'](_0x45b1ba['shift']());}};_0x145ddb(++_0x5a6a21);}(_0x30b3,0x100));var _0x330b=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0x30b3[_0x2f3ecd];return _0xffdc44;};'use strict';var Sequelize=require(_0x330b('0x0'));module[_0x330b('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x330b('0x2')]},'groupBy':{'type':Sequelize[_0x330b('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x330b('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb738=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x163662,_0x34b3a3){var _0x17b01f=function(_0x375e10){while(--_0x375e10){_0x163662['push'](_0x163662['shift']());}};_0x17b01f(++_0x34b3a3);}(_0xb738,0xca));var _0x8b73=function(_0x363bee,_0x5eeef9){_0x363bee=_0x363bee-0x0;var _0x8f7d0a=_0xb738[_0x363bee];return _0x8f7d0a;};'use strict';var Sequelize=require(_0x8b73('0x0'));module[_0x8b73('0x1')]={'field':{'type':Sequelize[_0x8b73('0x2')]},'alias':{'type':Sequelize[_0x8b73('0x3')]},'function':{'type':Sequelize[_0x8b73('0x3')]},'format':{'type':Sequelize[_0x8b73('0x3')]},'groupBy':{'type':Sequelize[_0x8b73('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x8b73('0x3')]},'custom':{'type':Sequelize[_0x8b73('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 9670a47..48bb578 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 _0xcf9e=['limit','count','set','Content-Range','save','update','destroy','then','error','stack','name','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','params','keys','options','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0xcf9e,0x83));var _0xecf9=function(_0xa6b787,_0x486d2f){_0xa6b787=_0xa6b787-0x0;var _0x473a7f=_0xcf9e[_0xa6b787];return _0x473a7f;};'use strict';var emlformat=require(_0xecf9('0x0'));var rimraf=require(_0xecf9('0x1'));var zipdir=require(_0xecf9('0x2'));var jsonpatch=require(_0xecf9('0x3'));var rp=require('request-promise');var moment=require(_0xecf9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xecf9('0x5'));var util=require('util');var path=require(_0xecf9('0x6'));var sox=require(_0xecf9('0x7'));var csv=require(_0xecf9('0x8'));var ejs=require(_0xecf9('0x9'));var fs=require('fs');var fs_extra=require(_0xecf9('0xa'));var _=require('lodash');var squel=require(_0xecf9('0xb'));var crypto=require(_0xecf9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xecf9('0xd'));var toCsv=require(_0xecf9('0x8'));var querystring=require(_0xecf9('0xe'));var Papa=require(_0xecf9('0xf'));var Redis=require('ioredis');var authService=require(_0xecf9('0x10'));var qs=require(_0xecf9('0x11'));var as=require(_0xecf9('0x12'));var hardwareService=require(_0xecf9('0x13'));var logger=require(_0xecf9('0x14'))(_0xecf9('0x15'));var utils=require(_0xecf9('0x16'));var config=require(_0xecf9('0x17'));var licenseUtil=require(_0xecf9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25d828,_0x411223){_0x411223=_0x411223||0xcc;return function(_0x1d1a4d){if(_0x1d1a4d){return _0x25d828[_0xecf9('0x19')](_0x411223);}return _0x25d828[_0xecf9('0x1a')](_0x411223)[_0xecf9('0x1b')]();};}function respondWithResult(_0x46dda8,_0x227836){_0x227836=_0x227836||0xc8;return function(_0x55ef51){if(_0x55ef51){return _0x46dda8[_0xecf9('0x1a')](_0x227836)[_0xecf9('0x1c')](_0x55ef51);}};}function respondWithFilteredResult(_0x24f767,_0x986f44){return function(_0x4afb98){if(_0x4afb98){var _0xd2750a=typeof _0x986f44[_0xecf9('0x1d')]===_0xecf9('0x1e')&&typeof _0x986f44[_0xecf9('0x1f')]==='undefined';var _0x314da5=_0x4afb98[_0xecf9('0x20')];var _0x328d22=_0xd2750a?0x0:_0x986f44[_0xecf9('0x1d')];var _0x5f591f=_0xd2750a?_0x4afb98[_0xecf9('0x20')]:_0x986f44[_0xecf9('0x1d')]+_0x986f44[_0xecf9('0x1f')];var _0x395172;if(_0x5f591f>=_0x314da5){_0x5f591f=_0x314da5;_0x395172=0xc8;}else{_0x395172=0xce;}_0x24f767[_0xecf9('0x1a')](_0x395172);return _0x24f767[_0xecf9('0x21')](_0xecf9('0x22'),_0x328d22+'-'+_0x5f591f+'/'+_0x314da5)[_0xecf9('0x1c')](_0x4afb98);}return null;};}function patchUpdates(_0x399457){return function(_0x21ccf8){try{jsonpatch['apply'](_0x21ccf8,_0x399457,!![]);}catch(_0xb3c3e7){return BPromise['reject'](_0xb3c3e7);}return _0x21ccf8[_0xecf9('0x23')]();};}function saveUpdates(_0x4ad104,_0x58264a){return function(_0xca0383){if(_0xca0383){return _0xca0383[_0xecf9('0x24')](_0x4ad104)['then'](function(_0xa7284e){return _0xa7284e;});}return null;};}function removeEntity(_0x103c49,_0x3e8416){return function(_0x211c16){if(_0x211c16){return _0x211c16[_0xecf9('0x25')]()[_0xecf9('0x26')](function(){_0x103c49['status'](0xcc)[_0xecf9('0x1b')]();});}};}function handleEntityNotFound(_0x3becff,_0x1226aa){return function(_0x225919){if(!_0x225919){_0x3becff[_0xecf9('0x19')](0x194);}return _0x225919;};}function handleError(_0x2327bc,_0x62ef99){_0x62ef99=_0x62ef99||0x1f4;return function(_0x230410){logger[_0xecf9('0x27')](_0x230410[_0xecf9('0x28')]);if(_0x230410[_0xecf9('0x29')]){delete _0x230410[_0xecf9('0x29')];}_0x2327bc[_0xecf9('0x1a')](_0x62ef99)['send'](_0x230410);};}exports['index']=function(_0x27dbec,_0x131a4f){var _0x9b8fd={},_0x2011c5={},_0x4e06ba={'count':0x0,'rows':[]};var _0x53849f=_[_0xecf9('0x2a')](db[_0xecf9('0x2b')][_0xecf9('0x2c')],function(_0x50f416){return{'name':_0x50f416[_0xecf9('0x2d')],'type':_0x50f416[_0xecf9('0x2e')][_0xecf9('0x2f')]};});_0x2011c5[_0xecf9('0x30')]=_[_0xecf9('0x2a')](_0x53849f,_0xecf9('0x29'));_0x2011c5[_0xecf9('0x31')]=_['keys'](_0x27dbec[_0xecf9('0x31')]);_0x2011c5[_0xecf9('0x32')]=_[_0xecf9('0x33')](_0x2011c5[_0xecf9('0x30')],_0x2011c5[_0xecf9('0x31')]);_0x9b8fd['attributes']=_[_0xecf9('0x33')](_0x2011c5['model'],qs[_0xecf9('0x34')](_0x27dbec[_0xecf9('0x31')][_0xecf9('0x34')]));_0x9b8fd[_0xecf9('0x35')]=_0x9b8fd[_0xecf9('0x35')][_0xecf9('0x36')]?_0x9b8fd[_0xecf9('0x35')]:_0x2011c5[_0xecf9('0x30')];if(!_0x27dbec['query']['hasOwnProperty'](_0xecf9('0x37'))){_0x9b8fd[_0xecf9('0x1f')]=qs[_0xecf9('0x1f')](_0x27dbec[_0xecf9('0x31')]['limit']);_0x9b8fd['offset']=qs[_0xecf9('0x1d')](_0x27dbec[_0xecf9('0x31')][_0xecf9('0x1d')]);}_0x9b8fd[_0xecf9('0x38')]=qs[_0xecf9('0x39')](_0x27dbec['query'][_0xecf9('0x39')]);_0x9b8fd[_0xecf9('0x3a')]=qs[_0xecf9('0x32')](_[_0xecf9('0x3b')](_0x27dbec[_0xecf9('0x31')],_0x2011c5['filters']),_0x53849f);if(_0x27dbec[_0xecf9('0x31')][_0xecf9('0x3c')]){_0x9b8fd['where']=_[_0xecf9('0x3d')](_0x9b8fd[_0xecf9('0x3a')],{'$or':_['map'](_0x53849f,function(_0x2682d3){if(_0x2682d3[_0xecf9('0x2e')]!=='VIRTUAL'){var _0x26373c={};_0x26373c[_0x2682d3[_0xecf9('0x29')]]={'$like':'%'+_0x27dbec[_0xecf9('0x31')]['filter']+'%'};return _0x26373c;}})});}_0x9b8fd=_[_0xecf9('0x3d')]({},_0x9b8fd,_0x27dbec['options']);var _0x331c92={'where':_0x9b8fd[_0xecf9('0x3a')]};return db[_0xecf9('0x2b')][_0xecf9('0x20')](_0x331c92)['then'](function(_0x32e75a){_0x4e06ba['count']=_0x32e75a;if(_0x27dbec[_0xecf9('0x31')]['includeAll']){_0x9b8fd[_0xecf9('0x3e')]=[{'all':!![]}];}return db[_0xecf9('0x2b')][_0xecf9('0x3f')](_0x9b8fd);})['then'](function(_0xf4f1e8){_0x4e06ba[_0xecf9('0x40')]=_0xf4f1e8;return _0x4e06ba;})[_0xecf9('0x26')](respondWithFilteredResult(_0x131a4f,_0x9b8fd))[_0xecf9('0x41')](handleError(_0x131a4f,null));};exports['show']=function(_0x390540,_0x566878){var _0x4f9910={'raw':![],'where':{'id':_0x390540[_0xecf9('0x42')]['id']}},_0x4d2ec8={};_0x4d2ec8['model']=_[_0xecf9('0x43')](db[_0xecf9('0x2b')][_0xecf9('0x2c')]);_0x4d2ec8[_0xecf9('0x31')]=_[_0xecf9('0x43')](_0x390540['query']);_0x4d2ec8[_0xecf9('0x32')]=_[_0xecf9('0x33')](_0x4d2ec8[_0xecf9('0x30')],_0x4d2ec8[_0xecf9('0x31')]);_0x4f9910[_0xecf9('0x35')]=_[_0xecf9('0x33')](_0x4d2ec8[_0xecf9('0x30')],qs[_0xecf9('0x34')](_0x390540['query'][_0xecf9('0x34')]));_0x4f9910['attributes']=_0x4f9910[_0xecf9('0x35')][_0xecf9('0x36')]?_0x4f9910[_0xecf9('0x35')]:_0x4d2ec8['model'];if(_0x390540[_0xecf9('0x31')]['includeAll']){_0x4f9910[_0xecf9('0x3e')]=[{'all':!![]}];}_0x4f9910=_[_0xecf9('0x3d')]({},_0x4f9910,_0x390540[_0xecf9('0x44')]);return db[_0xecf9('0x2b')][_0xecf9('0x45')](_0x4f9910)['then'](handleEntityNotFound(_0x566878,null))['then'](respondWithResult(_0x566878,null))[_0xecf9('0x41')](handleError(_0x566878,null));};exports[_0xecf9('0x46')]=function(_0x4faf2f,_0x15af13){return db[_0xecf9('0x2b')]['create'](_0x4faf2f[_0xecf9('0x47')],{})[_0xecf9('0x26')](respondWithResult(_0x15af13,0xc9))[_0xecf9('0x41')](handleError(_0x15af13,null));};exports[_0xecf9('0x48')]=function(_0x67b676,_0x18a47f){return db[_0xecf9('0x2b')]['bulkCreate'](_0x67b676[_0xecf9('0x47')],{'raw':![],'individualHooks':!![]})[_0xecf9('0x26')](respondWithResult(_0x18a47f,0xc9))[_0xecf9('0x41')](handleError(_0x18a47f,null));};exports[_0xecf9('0x24')]=function(_0x40af86,_0x5b0636){if(_0x40af86[_0xecf9('0x47')]['id']){delete _0x40af86[_0xecf9('0x47')]['id'];}return db[_0xecf9('0x2b')][_0xecf9('0x45')]({'where':{'id':_0x40af86[_0xecf9('0x42')]['id']}})[_0xecf9('0x26')](handleEntityNotFound(_0x5b0636,null))['then'](saveUpdates(_0x40af86[_0xecf9('0x47')],null))[_0xecf9('0x26')](respondWithResult(_0x5b0636,null))['catch'](handleError(_0x5b0636,null));};exports[_0xecf9('0x25')]=function(_0x4d21ec,_0x56d6c4){return db[_0xecf9('0x2b')]['find']({'where':{'id':_0x4d21ec[_0xecf9('0x42')]['id']}})['then'](handleEntityNotFound(_0x56d6c4,null))[_0xecf9('0x26')](removeEntity(_0x56d6c4,null))[_0xecf9('0x41')](handleError(_0x56d6c4,null));};exports[_0xecf9('0x49')]=function(_0x142720,_0x4b5ad7){return db[_0xecf9('0x2b')]['destroy']({'where':{'id':_0x142720['query'][_0xecf9('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xecf9('0x26')](respondWithResult(_0x4b5ad7,0xcc))[_0xecf9('0x41')](handleError(_0x4b5ad7,null));};exports[_0xecf9('0x4b')]=function(_0x2baade,_0x63ec40,_0x377d9e){return db[_0xecf9('0x4c')][_0xecf9('0x4d')]({'where':{'id':_0x2baade['params']['id']}})['then'](handleEntityNotFound(_0x63ec40,null))[_0xecf9('0x26')](function(_0x40a899){if(_0x40a899){return db[_0xecf9('0x4e')][_0xecf9('0x4f')](function(_0x3706c2){return db['AnalyticFieldReport'][_0xecf9('0x25')]({'where':{'CustomReportId':_0x2baade[_0xecf9('0x42')]['id']},'transaction':_0x3706c2})[_0xecf9('0x26')](function(_0x165634){var _0x3b6c48=_[_0xecf9('0x2a')](_0x2baade['body'],function(_0x327037){delete _0x327037['id'];_0x327037[_0xecf9('0x50')]=_0x2baade['params']['id'];return _0x327037;});return db['AnalyticFieldReport']['bulkCreate'](_0x3b6c48,{'transaction':_0x3706c2});});})['then'](function(){return db[_0xecf9('0x2b')]['findAll']({'where':{'CustomReportId':_0x2baade[_0xecf9('0x42')]['id']}});});}})[_0xecf9('0x26')](respondWithResult(_0x63ec40,null))[_0xecf9('0x41')](handleError(_0x63ec40,null));}; \ No newline at end of file +var _0x8e9c=['apply','reject','save','then','stack','name','AnalyticFieldReport','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','bulkCreate','body','destroy','bulkDestroy','ids','addFields','transaction','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0xa7cd5f,_0x16804c){var _0x3c36ab=function(_0x132ff4){while(--_0x132ff4){_0xa7cd5f['push'](_0xa7cd5f['shift']());}};_0x3c36ab(++_0x16804c);}(_0x8e9c,0xc1));var _0xc8e9=function(_0x1757cb,_0x124091){_0x1757cb=_0x1757cb-0x0;var _0x3f7f9f=_0x8e9c[_0x1757cb];return _0x3f7f9f;};'use strict';var emlformat=require(_0xc8e9('0x0'));var rimraf=require(_0xc8e9('0x1'));var zipdir=require(_0xc8e9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc8e9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc8e9('0x4'));var util=require(_0xc8e9('0x5'));var path=require(_0xc8e9('0x6'));var sox=require(_0xc8e9('0x7'));var csv=require(_0xc8e9('0x8'));var ejs=require(_0xc8e9('0x9'));var fs=require('fs');var fs_extra=require(_0xc8e9('0xa'));var _=require('lodash');var squel=require(_0xc8e9('0xb'));var crypto=require('crypto');var jsforce=require(_0xc8e9('0xc'));var deskjs=require(_0xc8e9('0xd'));var toCsv=require(_0xc8e9('0x8'));var querystring=require(_0xc8e9('0xe'));var Papa=require(_0xc8e9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc8e9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc8e9('0x11'))(_0xc8e9('0x12'));var utils=require('../../config/utils');var config=require(_0xc8e9('0x13'));var licenseUtil=require(_0xc8e9('0x14'));var db=require(_0xc8e9('0x15'))['db'];function respondWithStatusCode(_0x15ed05,_0x2a9122){_0x2a9122=_0x2a9122||0xcc;return function(_0x34075a){if(_0x34075a){return _0x15ed05[_0xc8e9('0x16')](_0x2a9122);}return _0x15ed05[_0xc8e9('0x17')](_0x2a9122)[_0xc8e9('0x18')]();};}function respondWithResult(_0x550aad,_0x3ce9fc){_0x3ce9fc=_0x3ce9fc||0xc8;return function(_0x4a81e6){if(_0x4a81e6){return _0x550aad[_0xc8e9('0x17')](_0x3ce9fc)[_0xc8e9('0x19')](_0x4a81e6);}};}function respondWithFilteredResult(_0x4b74de,_0x2383b6){return function(_0x3f04e5){if(_0x3f04e5){var _0x5e1e41=typeof _0x2383b6['offset']===_0xc8e9('0x1a')&&typeof _0x2383b6[_0xc8e9('0x1b')]===_0xc8e9('0x1a');var _0x5e7ee3=_0x3f04e5[_0xc8e9('0x1c')];var _0x3b6e7b=_0x5e1e41?0x0:_0x2383b6[_0xc8e9('0x1d')];var _0x476da0=_0x5e1e41?_0x3f04e5['count']:_0x2383b6[_0xc8e9('0x1d')]+_0x2383b6[_0xc8e9('0x1b')];var _0x56ec0f;if(_0x476da0>=_0x5e7ee3){_0x476da0=_0x5e7ee3;_0x56ec0f=0xc8;}else{_0x56ec0f=0xce;}_0x4b74de[_0xc8e9('0x17')](_0x56ec0f);return _0x4b74de[_0xc8e9('0x1e')](_0xc8e9('0x1f'),_0x3b6e7b+'-'+_0x476da0+'/'+_0x5e7ee3)['json'](_0x3f04e5);}return null;};}function patchUpdates(_0x364619){return function(_0x5960f5){try{jsonpatch[_0xc8e9('0x20')](_0x5960f5,_0x364619,!![]);}catch(_0x704083){return BPromise[_0xc8e9('0x21')](_0x704083);}return _0x5960f5[_0xc8e9('0x22')]();};}function saveUpdates(_0x23fc36,_0x506cf1){return function(_0xa07c2){if(_0xa07c2){return _0xa07c2['update'](_0x23fc36)[_0xc8e9('0x23')](function(_0x277273){return _0x277273;});}return null;};}function removeEntity(_0x1caf70,_0x393120){return function(_0x3be61e){if(_0x3be61e){return _0x3be61e['destroy']()[_0xc8e9('0x23')](function(){_0x1caf70[_0xc8e9('0x17')](0xcc)[_0xc8e9('0x18')]();});}};}function handleEntityNotFound(_0x430c98,_0x237df2){return function(_0x1e6d21){if(!_0x1e6d21){_0x430c98[_0xc8e9('0x16')](0x194);}return _0x1e6d21;};}function handleError(_0x4d8898,_0x469618){_0x469618=_0x469618||0x1f4;return function(_0x3456cb){logger['error'](_0x3456cb[_0xc8e9('0x24')]);if(_0x3456cb[_0xc8e9('0x25')]){delete _0x3456cb[_0xc8e9('0x25')];}_0x4d8898[_0xc8e9('0x17')](_0x469618)['send'](_0x3456cb);};}exports['index']=function(_0x3614ff,_0x58a464){var _0xa9f268={},_0x28c7e4={},_0x33dc91={'count':0x0,'rows':[]};var _0x4802ec=_['map'](db[_0xc8e9('0x26')]['rawAttributes'],function(_0x3da25a){return{'name':_0x3da25a[_0xc8e9('0x27')],'type':_0x3da25a[_0xc8e9('0x28')]['key']};});_0x28c7e4['model']=_[_0xc8e9('0x29')](_0x4802ec,'name');_0x28c7e4[_0xc8e9('0x2a')]=_[_0xc8e9('0x2b')](_0x3614ff[_0xc8e9('0x2a')]);_0x28c7e4[_0xc8e9('0x2c')]=_[_0xc8e9('0x2d')](_0x28c7e4[_0xc8e9('0x2e')],_0x28c7e4[_0xc8e9('0x2a')]);_0xa9f268[_0xc8e9('0x2f')]=_['intersection'](_0x28c7e4['model'],qs[_0xc8e9('0x30')](_0x3614ff[_0xc8e9('0x2a')]['fields']));_0xa9f268['attributes']=_0xa9f268[_0xc8e9('0x2f')]['length']?_0xa9f268['attributes']:_0x28c7e4[_0xc8e9('0x2e')];if(!_0x3614ff[_0xc8e9('0x2a')][_0xc8e9('0x31')](_0xc8e9('0x32'))){_0xa9f268[_0xc8e9('0x1b')]=qs[_0xc8e9('0x1b')](_0x3614ff[_0xc8e9('0x2a')][_0xc8e9('0x1b')]);_0xa9f268[_0xc8e9('0x1d')]=qs[_0xc8e9('0x1d')](_0x3614ff[_0xc8e9('0x2a')]['offset']);}_0xa9f268[_0xc8e9('0x33')]=qs['sort'](_0x3614ff['query'][_0xc8e9('0x34')]);_0xa9f268[_0xc8e9('0x35')]=qs[_0xc8e9('0x2c')](_[_0xc8e9('0x36')](_0x3614ff[_0xc8e9('0x2a')],_0x28c7e4[_0xc8e9('0x2c')]),_0x4802ec);if(_0x3614ff['query'][_0xc8e9('0x37')]){_0xa9f268[_0xc8e9('0x35')]=_['merge'](_0xa9f268[_0xc8e9('0x35')],{'$or':_[_0xc8e9('0x29')](_0x4802ec,function(_0x3222b7){if(_0x3222b7[_0xc8e9('0x28')]!==_0xc8e9('0x38')){var _0x27aca8={};_0x27aca8[_0x3222b7[_0xc8e9('0x25')]]={'$like':'%'+_0x3614ff[_0xc8e9('0x2a')][_0xc8e9('0x37')]+'%'};return _0x27aca8;}})});}_0xa9f268=_[_0xc8e9('0x39')]({},_0xa9f268,_0x3614ff['options']);var _0x13bfbe={'where':_0xa9f268[_0xc8e9('0x35')]};return db['AnalyticFieldReport'][_0xc8e9('0x1c')](_0x13bfbe)['then'](function(_0x9c2378){_0x33dc91[_0xc8e9('0x1c')]=_0x9c2378;if(_0x3614ff['query'][_0xc8e9('0x3a')]){_0xa9f268[_0xc8e9('0x3b')]=[{'all':!![]}];}return db[_0xc8e9('0x26')][_0xc8e9('0x3c')](_0xa9f268);})['then'](function(_0x209732){_0x33dc91[_0xc8e9('0x3d')]=_0x209732;return _0x33dc91;})['then'](respondWithFilteredResult(_0x58a464,_0xa9f268))[_0xc8e9('0x3e')](handleError(_0x58a464,null));};exports['show']=function(_0x136884,_0x5f0685){var _0x4d4df6={'raw':![],'where':{'id':_0x136884[_0xc8e9('0x3f')]['id']}},_0x525202={};_0x525202[_0xc8e9('0x2e')]=_[_0xc8e9('0x2b')](db[_0xc8e9('0x26')][_0xc8e9('0x40')]);_0x525202[_0xc8e9('0x2a')]=_[_0xc8e9('0x2b')](_0x136884['query']);_0x525202['filters']=_[_0xc8e9('0x2d')](_0x525202[_0xc8e9('0x2e')],_0x525202[_0xc8e9('0x2a')]);_0x4d4df6[_0xc8e9('0x2f')]=_[_0xc8e9('0x2d')](_0x525202[_0xc8e9('0x2e')],qs[_0xc8e9('0x30')](_0x136884[_0xc8e9('0x2a')][_0xc8e9('0x30')]));_0x4d4df6[_0xc8e9('0x2f')]=_0x4d4df6[_0xc8e9('0x2f')][_0xc8e9('0x41')]?_0x4d4df6[_0xc8e9('0x2f')]:_0x525202[_0xc8e9('0x2e')];if(_0x136884[_0xc8e9('0x2a')][_0xc8e9('0x3a')]){_0x4d4df6[_0xc8e9('0x3b')]=[{'all':!![]}];}_0x4d4df6=_[_0xc8e9('0x39')]({},_0x4d4df6,_0x136884['options']);return db[_0xc8e9('0x26')][_0xc8e9('0x42')](_0x4d4df6)[_0xc8e9('0x23')](handleEntityNotFound(_0x5f0685,null))[_0xc8e9('0x23')](respondWithResult(_0x5f0685,null))[_0xc8e9('0x3e')](handleError(_0x5f0685,null));};exports[_0xc8e9('0x43')]=function(_0x40d81e,_0xed8848){return db[_0xc8e9('0x26')][_0xc8e9('0x43')](_0x40d81e['body'],{})[_0xc8e9('0x23')](respondWithResult(_0xed8848,0xc9))[_0xc8e9('0x3e')](handleError(_0xed8848,null));};exports[_0xc8e9('0x44')]=function(_0x4a98bf,_0xefd86a){return db[_0xc8e9('0x26')]['bulkCreate'](_0x4a98bf['body'],{'raw':![],'individualHooks':!![]})[_0xc8e9('0x23')](respondWithResult(_0xefd86a,0xc9))[_0xc8e9('0x3e')](handleError(_0xefd86a,null));};exports['update']=function(_0x3de61e,_0x527be5){if(_0x3de61e[_0xc8e9('0x45')]['id']){delete _0x3de61e[_0xc8e9('0x45')]['id'];}return db[_0xc8e9('0x26')][_0xc8e9('0x42')]({'where':{'id':_0x3de61e['params']['id']}})['then'](handleEntityNotFound(_0x527be5,null))[_0xc8e9('0x23')](saveUpdates(_0x3de61e[_0xc8e9('0x45')],null))[_0xc8e9('0x23')](respondWithResult(_0x527be5,null))[_0xc8e9('0x3e')](handleError(_0x527be5,null));};exports[_0xc8e9('0x46')]=function(_0xd3e8bf,_0x35e7b4){return db[_0xc8e9('0x26')][_0xc8e9('0x42')]({'where':{'id':_0xd3e8bf[_0xc8e9('0x3f')]['id']}})[_0xc8e9('0x23')](handleEntityNotFound(_0x35e7b4,null))['then'](removeEntity(_0x35e7b4,null))[_0xc8e9('0x3e')](handleError(_0x35e7b4,null));};exports[_0xc8e9('0x47')]=function(_0xfb0b74,_0x27eafc){return db[_0xc8e9('0x26')][_0xc8e9('0x46')]({'where':{'id':_0xfb0b74[_0xc8e9('0x2a')][_0xc8e9('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0xc8e9('0x23')](respondWithResult(_0x27eafc,0xcc))[_0xc8e9('0x3e')](handleError(_0x27eafc,null));};exports[_0xc8e9('0x49')]=function(_0x1a6dc2,_0x51cf28,_0x26f8eb){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x1a6dc2[_0xc8e9('0x3f')]['id']}})[_0xc8e9('0x23')](handleEntityNotFound(_0x51cf28,null))[_0xc8e9('0x23')](function(_0x34c23){if(_0x34c23){return db['sequelize'][_0xc8e9('0x4a')](function(_0x44995d){return db['AnalyticFieldReport'][_0xc8e9('0x46')]({'where':{'CustomReportId':_0x1a6dc2[_0xc8e9('0x3f')]['id']},'transaction':_0x44995d})['then'](function(_0x53ca1b){var _0x4fdbe8=_['map'](_0x1a6dc2[_0xc8e9('0x45')],function(_0x254e62){delete _0x254e62['id'];_0x254e62['CustomReportId']=_0x1a6dc2[_0xc8e9('0x3f')]['id'];return _0x254e62;});return db[_0xc8e9('0x26')][_0xc8e9('0x44')](_0x4fdbe8,{'transaction':_0x44995d});});})[_0xc8e9('0x23')](function(){return db[_0xc8e9('0x26')][_0xc8e9('0x3c')]({'where':{'CustomReportId':_0x1a6dc2[_0xc8e9('0x3f')]['id']}});});}})[_0xc8e9('0x23')](respondWithResult(_0x51cf28,null))[_0xc8e9('0x3e')](handleError(_0x51cf28,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 5d2b31a..f5c56cb 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 _0x077e=['exports','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x52a613,_0x22c319){var _0x3d6750=function(_0x6da4e7){while(--_0x6da4e7){_0x52a613['push'](_0x52a613['shift']());}};_0x3d6750(++_0x22c319);}(_0x077e,0x155));var _0xe077=function(_0x5ec387,_0x593bf4){_0x5ec387=_0x5ec387-0x0;var _0x1d71f5=_0x077e[_0x5ec387];return _0x1d71f5;};'use strict';var _=require(_0xe077('0x0'));var util=require(_0xe077('0x1'));var logger=require(_0xe077('0x2'))('api');var moment=require(_0xe077('0x3'));var BPromise=require(_0xe077('0x4'));var rp=require(_0xe077('0x5'));var fs=require('fs');var path=require(_0xe077('0x6'));var rimraf=require(_0xe077('0x7'));var config=require(_0xe077('0x8'));var attributes=require(_0xe077('0x9'));module[_0xe077('0xa')]=function(_0x19350c,_0x52db49){return _0x19350c['define'](_0xe077('0xb'),attributes,{'tableName':_0xe077('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb280=['./analyticFieldReport.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x193d38,_0x5d4cad){var _0x1294b8=function(_0x1265ae){while(--_0x1265ae){_0x193d38['push'](_0x193d38['shift']());}};_0x1294b8(++_0x5d4cad);}(_0xb280,0x9c));var _0x0b28=function(_0x273bd6,_0x39229b){_0x273bd6=_0x273bd6-0x0;var _0x279ced=_0xb280[_0x273bd6];return _0x279ced;};'use strict';var _=require(_0x0b28('0x0'));var util=require(_0x0b28('0x1'));var logger=require(_0x0b28('0x2'))(_0x0b28('0x3'));var moment=require(_0x0b28('0x4'));var BPromise=require(_0x0b28('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b28('0x6'));var rimraf=require(_0x0b28('0x7'));var config=require(_0x0b28('0x8'));var attributes=require(_0x0b28('0x9'));module['exports']=function(_0x232e07,_0x13a891){return _0x232e07[_0x0b28('0xa')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 5dd4ac3..2811ad9 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 _0x6f65=['request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x6f65,0x103));var _0x56f6=function(_0x3907a8,_0x7ff068){_0x3907a8=_0x3907a8-0x0;var _0x3db046=_0x6f65[_0x3907a8];return _0x3db046;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56f6('0x0'));var fs=require('fs');var Redis=require(_0x56f6('0x1'));var db=require(_0x56f6('0x2'))['db'];var utils=require(_0x56f6('0x3'));var logger=require(_0x56f6('0x4'))(_0x56f6('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x56f6('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e4d56,_0x33a93e,_0x3603fb){return new BPromise(function(_0x43aee2,_0x369612){return client[_0x56f6('0x7')](_0x5e4d56,_0x3603fb)[_0x56f6('0x8')](function(_0x7144cc){logger[_0x56f6('0x9')]('AnalyticFieldReport,\x20%s,\x20%s',_0x33a93e,_0x56f6('0xa'));logger[_0x56f6('0xb')](_0x56f6('0xc'),_0x33a93e,_0x56f6('0xa'),JSON['stringify'](_0x7144cc));if(_0x7144cc['error']){if(_0x7144cc[_0x56f6('0xd')][_0x56f6('0xe')]===0x1f4){logger[_0x56f6('0xd')](_0x56f6('0xf'),_0x33a93e,_0x7144cc['error']['message']);return _0x369612(_0x7144cc[_0x56f6('0xd')]['message']);}logger['error'](_0x56f6('0xf'),_0x33a93e,_0x7144cc[_0x56f6('0xd')][_0x56f6('0x10')]);return _0x43aee2(_0x7144cc[_0x56f6('0xd')][_0x56f6('0x10')]);}else{logger[_0x56f6('0x9')]('AnalyticFieldReport,\x20%s,\x20%s',_0x33a93e,_0x56f6('0xa'));_0x43aee2(_0x7144cc[_0x56f6('0x11')][_0x56f6('0x10')]);}})[_0x56f6('0x12')](function(_0x25abc4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x33a93e,_0x25abc4);_0x369612(_0x25abc4);});});} \ No newline at end of file +var _0xc77c=['info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3f9fb7,_0x503086){var _0x52f1db=function(_0x24357d){while(--_0x24357d){_0x3f9fb7['push'](_0x3f9fb7['shift']());}};_0x52f1db(++_0x503086);}(_0xc77c,0x143));var _0xcc77=function(_0x366b42,_0x46d9e0){_0x366b42=_0x366b42-0x0;var _0x29414f=_0xc77c[_0x366b42];return _0x29414f;};'use strict';var _=require(_0xcc77('0x0'));var util=require(_0xcc77('0x1'));var moment=require('moment');var BPromise=require(_0xcc77('0x2'));var rs=require(_0xcc77('0x3'));var fs=require('fs');var Redis=require(_0xcc77('0x4'));var db=require(_0xcc77('0x5'))['db'];var utils=require(_0xcc77('0x6'));var logger=require(_0xcc77('0x7'))(_0xcc77('0x8'));var config=require(_0xcc77('0x9'));var jayson=require(_0xcc77('0xa'));var client=jayson[_0xcc77('0xb')][_0xcc77('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56c253,_0x174507,_0xb9b379){return new BPromise(function(_0x419940,_0x1ad938){return client[_0xcc77('0xd')](_0x56c253,_0xb9b379)[_0xcc77('0xe')](function(_0x1c9564){logger[_0xcc77('0xf')](_0xcc77('0x10'),_0x174507,_0xcc77('0x11'));logger[_0xcc77('0x12')](_0xcc77('0x13'),_0x174507,_0xcc77('0x11'),JSON[_0xcc77('0x14')](_0x1c9564));if(_0x1c9564[_0xcc77('0x15')]){if(_0x1c9564[_0xcc77('0x15')][_0xcc77('0x16')]===0x1f4){logger[_0xcc77('0x15')](_0xcc77('0x10'),_0x174507,_0x1c9564[_0xcc77('0x15')][_0xcc77('0x17')]);return _0x1ad938(_0x1c9564[_0xcc77('0x15')][_0xcc77('0x17')]);}logger[_0xcc77('0x15')]('AnalyticFieldReport,\x20%s,\x20%s',_0x174507,_0x1c9564[_0xcc77('0x15')][_0xcc77('0x17')]);return _0x419940(_0x1c9564[_0xcc77('0x15')][_0xcc77('0x17')]);}else{logger[_0xcc77('0xf')](_0xcc77('0x10'),_0x174507,'request\x20sent');_0x419940(_0x1c9564[_0xcc77('0x18')]['message']);}})[_0xcc77('0x19')](function(_0x594f24){logger[_0xcc77('0x15')]('AnalyticFieldReport,\x20%s,\x20%s',_0x174507,_0x594f24);_0x1ad938(_0x594f24);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 1b91f86..fc6b577 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(_0x67c2cf,_0x169acd){var _0x3f8c08=function(_0x7ada9e){while(--_0x7ada9e){_0x67c2cf['push'](_0x67c2cf['shift']());}};_0x3f8c08(++_0x169acd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0xe4854b,_0x414b50){var _0x1c3d72=function(_0x266317){while(--_0x266317){_0xe4854b['push'](_0xe4854b['shift']());}};_0x1c3d72(++_0x414b50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 e3fbbe3..6e1b220 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 _0xcaa3=['STRING','name','TEXT','sequelize','exports'];(function(_0x10abfe,_0x7a9ad6){var _0x473c1b=function(_0x392758){while(--_0x392758){_0x10abfe['push'](_0x10abfe['shift']());}};_0x473c1b(++_0x7a9ad6);}(_0xcaa3,0xcb));var _0x3caa=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0xcaa3[_0x53fe97];return _0x5c49a2;};'use strict';var Sequelize=require(_0x3caa('0x0'));module[_0x3caa('0x1')]={'name':{'type':Sequelize[_0x3caa('0x2')],'allowNull':![],'unique':_0x3caa('0x3')},'table':{'type':Sequelize[_0x3caa('0x2')]},'metric':{'type':Sequelize[_0x3caa('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2ec8=['name','TEXT','sequelize','exports','STRING'];(function(_0x4ff2d8,_0x338d5a){var _0x4df835=function(_0x42cbd4){while(--_0x42cbd4){_0x4ff2d8['push'](_0x4ff2d8['shift']());}};_0x4df835(++_0x338d5a);}(_0x2ec8,0x188));var _0x82ec=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2ec8[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x82ec('0x0'));module[_0x82ec('0x1')]={'name':{'type':Sequelize[_0x82ec('0x2')],'allowNull':![],'unique':_0x82ec('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x82ec('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index ac9fed8..2cd7c51 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x59e7dd,_0x9eb0f5){var _0x15a88c=function(_0x3c81d5){while(--_0x3c81d5){_0x59e7dd['push'](_0x59e7dd['shift']());}};_0x15a88c(++_0x9eb0f5);}(_0x9a19,0x114));var _0x99a1=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x9a19[_0x51020b];return _0x371e47;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file +var _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3ab3bd,_0x5e63e4){var _0x2a6a3b=function(_0x498743){while(--_0x498743){_0x3ab3bd['push'](_0x3ab3bd['shift']());}};_0x2a6a3b(++_0x5e63e4);}(_0x8ef6,0xf2));var _0x68ef=function(_0x48f692,_0x56d23c){_0x48f692=_0x48f692-0x0;var _0x4798d9=_0x8ef6[_0x48f692];return _0x4798d9;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 8a0694c..3369523 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 _0x7ebb=['define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x218c7a,_0xbb306f){var _0x470124=function(_0x1da76d){while(--_0x1da76d){_0x218c7a['push'](_0x218c7a['shift']());}};_0x470124(++_0xbb306f);}(_0x7ebb,0x161));var _0xb7eb=function(_0x7629e,_0x40c972){_0x7629e=_0x7629e-0x0;var _0x19569b=_0x7ebb[_0x7629e];return _0x19569b;};'use strict';var _=require(_0xb7eb('0x0'));var util=require(_0xb7eb('0x1'));var logger=require(_0xb7eb('0x2'))(_0xb7eb('0x3'));var moment=require(_0xb7eb('0x4'));var BPromise=require(_0xb7eb('0x5'));var rp=require(_0xb7eb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7eb('0x7'));var config=require(_0xb7eb('0x8'));var attributes=require(_0xb7eb('0x9'));module[_0xb7eb('0xa')]=function(_0x415157,_0x3982d7){return _0x415157[_0xb7eb('0xb')](_0xb7eb('0xc'),attributes,{'tableName':_0xb7eb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34f2=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','api','moment'];(function(_0x4772a0,_0x9a9095){var _0x1329de=function(_0x5b0615){while(--_0x5b0615){_0x4772a0['push'](_0x4772a0['shift']());}};_0x1329de(++_0x9a9095);}(_0x34f2,0x15a));var _0x234f=function(_0x4e73ba,_0x419f9c){_0x4e73ba=_0x4e73ba-0x0;var _0x1f8826=_0x34f2[_0x4e73ba];return _0x1f8826;};'use strict';var _=require(_0x234f('0x0'));var util=require(_0x234f('0x1'));var logger=require('../../config/logger')(_0x234f('0x2'));var moment=require(_0x234f('0x3'));var BPromise=require(_0x234f('0x4'));var rp=require(_0x234f('0x5'));var fs=require('fs');var path=require(_0x234f('0x6'));var rimraf=require(_0x234f('0x7'));var config=require(_0x234f('0x8'));var attributes=require(_0x234f('0x9'));module[_0x234f('0xa')]=function(_0x2c7b3f,_0x2adf40){return _0x2c7b3f[_0x234f('0xb')](_0x234f('0xc'),attributes,{'tableName':_0x234f('0xd'),'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 ccaad36..fa4e1e4 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 _0xa126=['request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x23c02b,_0x411b4d){var _0x25efc5=function(_0x50e9e4){while(--_0x50e9e4){_0x23c02b['push'](_0x23c02b['shift']());}};_0x25efc5(++_0x411b4d);}(_0xa126,0x10f));var _0x6a12=function(_0x1b2f50,_0x27a457){_0x1b2f50=_0x1b2f50-0x0;var _0x5588e0=_0xa126[_0x1b2f50];return _0x5588e0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6a12('0x0'));var BPromise=require('bluebird');var rs=require(_0x6a12('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a12('0x2'))['db'];var utils=require(_0x6a12('0x3'));var logger=require(_0x6a12('0x4'))(_0x6a12('0x5'));var config=require('../../config/environment');var jayson=require(_0x6a12('0x6'));var client=jayson[_0x6a12('0x7')][_0x6a12('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f7c9f,_0x4a2448,_0x16a099){return new BPromise(function(_0x55bd03,_0x5e3b68){return client[_0x6a12('0x9')](_0x4f7c9f,_0x16a099)[_0x6a12('0xa')](function(_0x3af5b4){logger[_0x6a12('0xb')](_0x6a12('0xc'),_0x4a2448,'request\x20sent');logger[_0x6a12('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x4a2448,_0x6a12('0xe'),JSON[_0x6a12('0xf')](_0x3af5b4));if(_0x3af5b4[_0x6a12('0x10')]){if(_0x3af5b4['error']['code']===0x1f4){logger[_0x6a12('0x10')](_0x6a12('0xc'),_0x4a2448,_0x3af5b4[_0x6a12('0x10')]['message']);return _0x5e3b68(_0x3af5b4[_0x6a12('0x10')][_0x6a12('0x11')]);}logger[_0x6a12('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x4a2448,_0x3af5b4[_0x6a12('0x10')][_0x6a12('0x11')]);return _0x55bd03(_0x3af5b4['error'][_0x6a12('0x11')]);}else{logger[_0x6a12('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x4a2448,'request\x20sent');_0x55bd03(_0x3af5b4[_0x6a12('0x12')][_0x6a12('0x11')]);}})[_0x6a12('0x13')](function(_0x2368a4){logger[_0x6a12('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x4a2448,_0x2368a4);_0x5e3b68(_0x2368a4);});});} \ No newline at end of file +var _0xb503=['error','code','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3708c1,_0x1e5d1c){var _0x4cedf5=function(_0xebd76e){while(--_0xebd76e){_0x3708c1['push'](_0x3708c1['shift']());}};_0x4cedf5(++_0x1e5d1c);}(_0xb503,0x145));var _0x3b50=function(_0x4da34d,_0x150809){_0x4da34d=_0x4da34d-0x0;var _0x25295e=_0xb503[_0x4da34d];return _0x25295e;};'use strict';var _=require(_0x3b50('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3b50('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b50('0x2'))['db'];var utils=require(_0x3b50('0x3'));var logger=require(_0x3b50('0x4'))(_0x3b50('0x5'));var config=require('../../config/environment');var jayson=require(_0x3b50('0x6'));var client=jayson[_0x3b50('0x7')][_0x3b50('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x526d75,_0x15c688,_0x4c07da){return new BPromise(function(_0x10ecb7,_0x45cee8){return client[_0x3b50('0x9')](_0x526d75,_0x4c07da)['then'](function(_0x3a696a){logger[_0x3b50('0xa')](_0x3b50('0xb'),_0x15c688,'request\x20sent');logger[_0x3b50('0xc')](_0x3b50('0xd'),_0x15c688,_0x3b50('0xe'),JSON['stringify'](_0x3a696a));if(_0x3a696a[_0x3b50('0xf')]){if(_0x3a696a['error'][_0x3b50('0x10')]===0x1f4){logger[_0x3b50('0xf')](_0x3b50('0xb'),_0x15c688,_0x3a696a[_0x3b50('0xf')]['message']);return _0x45cee8(_0x3a696a[_0x3b50('0xf')][_0x3b50('0x11')]);}logger[_0x3b50('0xf')](_0x3b50('0xb'),_0x15c688,_0x3a696a[_0x3b50('0xf')]['message']);return _0x10ecb7(_0x3a696a[_0x3b50('0xf')]['message']);}else{logger[_0x3b50('0xa')](_0x3b50('0xb'),_0x15c688,_0x3b50('0xe'));_0x10ecb7(_0x3a696a[_0x3b50('0x12')]['message']);}})[_0x3b50('0x13')](function(_0x360ad9){logger[_0x3b50('0xf')](_0x3b50('0xb'),_0x15c688,_0x360ad9);_0x45cee8(_0x360ad9);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index e0dc8b4..4d291e1 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 _0x7b83=['destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','update','delete','/:id'];(function(_0x29c7f5,_0x55ceff){var _0x45c950=function(_0x25ea1c){while(--_0x25ea1c){_0x29c7f5['push'](_0x29c7f5['shift']());}};_0x45c950(++_0x55ceff);}(_0x7b83,0xa1));var _0x37b8=function(_0x54be6b,_0x1d13ee){_0x54be6b=_0x54be6b-0x0;var _0x2f6a1e=_0x7b83[_0x54be6b];return _0x2f6a1e;};'use strict';var multer=require(_0x37b8('0x0'));var util=require(_0x37b8('0x1'));var path=require(_0x37b8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x37b8('0x3')]();var fs_extra=require(_0x37b8('0x4'));var auth=require(_0x37b8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x37b8('0x6'));var controller=require(_0x37b8('0x7'));router[_0x37b8('0x8')]('/',auth[_0x37b8('0x9')](),controller[_0x37b8('0xa')]);router[_0x37b8('0x8')]('/:id',auth[_0x37b8('0x9')](),controller[_0x37b8('0xb')]);router['post']('/',auth[_0x37b8('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x37b8('0xc')]);router[_0x37b8('0xd')](_0x37b8('0xe'),auth[_0x37b8('0x9')](),controller[_0x37b8('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2dc3=['post','create','put','delete','isAuthenticated','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x2dc3,0x127));var _0x32dc=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2dc3[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x32dc('0x0'));var path=require(_0x32dc('0x1'));var timeout=require(_0x32dc('0x2'));var express=require(_0x32dc('0x3'));var router=express[_0x32dc('0x4')]();var fs_extra=require(_0x32dc('0x5'));var auth=require(_0x32dc('0x6'));var interaction=require(_0x32dc('0x7'));var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0x32dc('0x8')]('/',auth['isAuthenticated'](),controller[_0x32dc('0x9')]);router['get'](_0x32dc('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x32dc('0xb')]('/',auth['isAuthenticated'](),controller[_0x32dc('0xc')]);router[_0x32dc('0xd')](_0x32dc('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x32dc('0xe')](_0x32dc('0xa'),auth[_0x32dc('0xf')](),controller[_0x32dc('0x10')]);module[_0x32dc('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f11d56a..b5bb8d4 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 _0x378b=['sequelize','exports','TEXT'];(function(_0x466c42,_0x17d7c1){var _0x2a833f=function(_0x17408a){while(--_0x17408a){_0x466c42['push'](_0x466c42['shift']());}};_0x2a833f(++_0x17d7c1);}(_0x378b,0xbd));var _0xb378=function(_0x1dfafb,_0x35fde1){_0x1dfafb=_0x1dfafb-0x0;var _0xa85369=_0x378b[_0x1dfafb];return _0xa85369;};'use strict';var Sequelize=require(_0xb378('0x0'));module[_0xb378('0x1')]={'tree':{'type':Sequelize[_0xb378('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe6b0=['TEXT','sequelize'];(function(_0x152e77,_0x24777b){var _0x29006a=function(_0x2360a1){while(--_0x2360a1){_0x152e77['push'](_0x152e77['shift']());}};_0x29006a(++_0x24777b);}(_0xe6b0,0xdd));var _0x0e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0e6b('0x0'));module['exports']={'tree':{'type':Sequelize[_0x0e6b('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 4994c05..7527f87 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 _0x91c9=['VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','type'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x91c9,0x139));var _0x991c=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x91c9[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0x991c('0x0'));var rimraf=require(_0x991c('0x1'));var zipdir=require(_0x991c('0x2'));var jsonpatch=require(_0x991c('0x3'));var rp=require('request-promise');var moment=require(_0x991c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x991c('0x5'));var path=require(_0x991c('0x6'));var sox=require(_0x991c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x991c('0x8'));var _=require(_0x991c('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x991c('0xa'));var deskjs=require(_0x991c('0xb'));var toCsv=require(_0x991c('0xc'));var querystring=require(_0x991c('0xd'));var Papa=require(_0x991c('0xe'));var Redis=require(_0x991c('0xf'));var authService=require(_0x991c('0x10'));var qs=require(_0x991c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x991c('0x12'));var logger=require(_0x991c('0x13'))(_0x991c('0x14'));var utils=require(_0x991c('0x15'));var config=require(_0x991c('0x16'));var licenseUtil=require(_0x991c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ff1c6,_0x472953){_0x472953=_0x472953||0xcc;return function(_0x1781dd){if(_0x1781dd){return _0x4ff1c6[_0x991c('0x18')](_0x472953);}return _0x4ff1c6[_0x991c('0x19')](_0x472953)[_0x991c('0x1a')]();};}function respondWithResult(_0x1ec281,_0x2902d5){_0x2902d5=_0x2902d5||0xc8;return function(_0x2c7b51){if(_0x2c7b51){return _0x1ec281[_0x991c('0x19')](_0x2902d5)[_0x991c('0x1b')](_0x2c7b51);}};}function respondWithFilteredResult(_0x4f04ac,_0x2d7733){return function(_0x27b21b){if(_0x27b21b){var _0x4b407b=typeof _0x2d7733[_0x991c('0x1c')]===_0x991c('0x1d')&&typeof _0x2d7733['limit']===_0x991c('0x1d');var _0x4a5ffd=_0x27b21b['count'];var _0xd9be9c=_0x4b407b?0x0:_0x2d7733[_0x991c('0x1c')];var _0x54e12b=_0x4b407b?_0x27b21b[_0x991c('0x1e')]:_0x2d7733[_0x991c('0x1c')]+_0x2d7733[_0x991c('0x1f')];var _0x5b333f;if(_0x54e12b>=_0x4a5ffd){_0x54e12b=_0x4a5ffd;_0x5b333f=0xc8;}else{_0x5b333f=0xce;}_0x4f04ac['status'](_0x5b333f);return _0x4f04ac['set'](_0x991c('0x20'),_0xd9be9c+'-'+_0x54e12b+'/'+_0x4a5ffd)['json'](_0x27b21b);}return null;};}function patchUpdates(_0x141850){return function(_0x273b43){try{jsonpatch[_0x991c('0x21')](_0x273b43,_0x141850,!![]);}catch(_0x532ec9){return BPromise[_0x991c('0x22')](_0x532ec9);}return _0x273b43[_0x991c('0x23')]();};}function saveUpdates(_0x455e2e,_0x2bd1b9){return function(_0x30bb18){if(_0x30bb18){return _0x30bb18[_0x991c('0x24')](_0x455e2e)['then'](function(_0x35a3f6){return _0x35a3f6;});}return null;};}function removeEntity(_0x1d6536,_0x386ae7){return function(_0x4474a2){if(_0x4474a2){return _0x4474a2[_0x991c('0x25')]()[_0x991c('0x26')](function(){_0x1d6536[_0x991c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a4da1,_0x12788f){return function(_0x10f203){if(!_0x10f203){_0x2a4da1[_0x991c('0x18')](0x194);}return _0x10f203;};}function handleError(_0x126a7f,_0x2bf48b){_0x2bf48b=_0x2bf48b||0x1f4;return function(_0xf5c633){logger['error'](_0xf5c633[_0x991c('0x27')]);if(_0xf5c633['name']){delete _0xf5c633[_0x991c('0x28')];}_0x126a7f[_0x991c('0x19')](_0x2bf48b)[_0x991c('0x29')](_0xf5c633);};}exports[_0x991c('0x2a')]=function(_0x36e29f,_0x4c1f88){var _0x3ed851={},_0x1de421={},_0x32cab2={'count':0x0,'rows':[]};var _0x27942c=_['map'](db[_0x991c('0x2b')][_0x991c('0x2c')],function(_0x12c1c5){return{'name':_0x12c1c5[_0x991c('0x2d')],'type':_0x12c1c5['type'][_0x991c('0x2e')]};});_0x1de421[_0x991c('0x2f')]=_[_0x991c('0x30')](_0x27942c,_0x991c('0x28'));_0x1de421[_0x991c('0x31')]=_['keys'](_0x36e29f[_0x991c('0x31')]);_0x1de421[_0x991c('0x32')]=_[_0x991c('0x33')](_0x1de421['model'],_0x1de421['query']);_0x3ed851['attributes']=_[_0x991c('0x33')](_0x1de421['model'],qs[_0x991c('0x34')](_0x36e29f[_0x991c('0x31')][_0x991c('0x34')]));_0x3ed851[_0x991c('0x35')]=_0x3ed851['attributes'][_0x991c('0x36')]?_0x3ed851[_0x991c('0x35')]:_0x1de421[_0x991c('0x2f')];if(!_0x36e29f[_0x991c('0x31')][_0x991c('0x37')](_0x991c('0x38'))){_0x3ed851[_0x991c('0x1f')]=qs['limit'](_0x36e29f[_0x991c('0x31')][_0x991c('0x1f')]);_0x3ed851[_0x991c('0x1c')]=qs['offset'](_0x36e29f[_0x991c('0x31')][_0x991c('0x1c')]);}_0x3ed851[_0x991c('0x39')]=qs[_0x991c('0x3a')](_0x36e29f[_0x991c('0x31')][_0x991c('0x3a')]);_0x3ed851[_0x991c('0x3b')]=qs['filters'](_[_0x991c('0x3c')](_0x36e29f[_0x991c('0x31')],_0x1de421[_0x991c('0x32')]),_0x27942c);if(_0x36e29f[_0x991c('0x31')]['filter']){_0x3ed851['where']=_['merge'](_0x3ed851[_0x991c('0x3b')],{'$or':_[_0x991c('0x30')](_0x27942c,function(_0xdc755e){if(_0xdc755e[_0x991c('0x3d')]!==_0x991c('0x3e')){var _0x1468f4={};_0x1468f4[_0xdc755e[_0x991c('0x28')]]={'$like':'%'+_0x36e29f[_0x991c('0x31')][_0x991c('0x3f')]+'%'};return _0x1468f4;}})});}_0x3ed851=_[_0x991c('0x40')]({},_0x3ed851,_0x36e29f[_0x991c('0x41')]);var _0x4ba1c3={'where':_0x3ed851[_0x991c('0x3b')]};return db[_0x991c('0x2b')][_0x991c('0x1e')](_0x4ba1c3)['then'](function(_0x1bf02f){_0x32cab2[_0x991c('0x1e')]=_0x1bf02f;if(_0x36e29f[_0x991c('0x31')][_0x991c('0x42')]){_0x3ed851['include']=[{'all':!![]}];}return db[_0x991c('0x2b')][_0x991c('0x43')](_0x3ed851);})[_0x991c('0x26')](function(_0x5361fc){_0x32cab2['rows']=_0x5361fc;return _0x32cab2;})[_0x991c('0x26')](respondWithFilteredResult(_0x4c1f88,_0x3ed851))[_0x991c('0x44')](handleError(_0x4c1f88,null));};exports[_0x991c('0x45')]=function(_0x3efe57,_0x194518){var _0xef3986={'raw':!![],'where':{'id':_0x3efe57[_0x991c('0x46')]['id']}},_0x25e197={};_0x25e197[_0x991c('0x2f')]=_['keys'](db['AnalyticTreeReport'][_0x991c('0x2c')]);_0x25e197[_0x991c('0x31')]=_['keys'](_0x3efe57[_0x991c('0x31')]);_0x25e197['filters']=_['intersection'](_0x25e197[_0x991c('0x2f')],_0x25e197[_0x991c('0x31')]);_0xef3986[_0x991c('0x35')]=_[_0x991c('0x33')](_0x25e197['model'],qs[_0x991c('0x34')](_0x3efe57['query']['fields']));_0xef3986[_0x991c('0x35')]=_0xef3986[_0x991c('0x35')][_0x991c('0x36')]?_0xef3986[_0x991c('0x35')]:_0x25e197[_0x991c('0x2f')];if(_0x3efe57[_0x991c('0x31')][_0x991c('0x42')]){_0xef3986[_0x991c('0x47')]=[{'all':!![]}];}_0xef3986=_[_0x991c('0x40')]({},_0xef3986,_0x3efe57[_0x991c('0x41')]);return db[_0x991c('0x2b')][_0x991c('0x48')](_0xef3986)[_0x991c('0x26')](handleEntityNotFound(_0x194518,null))[_0x991c('0x26')](respondWithResult(_0x194518,null))['catch'](handleError(_0x194518,null));};exports[_0x991c('0x49')]=function(_0x1d6a39,_0x42102a){return db[_0x991c('0x2b')][_0x991c('0x49')](_0x1d6a39['body'],{})['then'](respondWithResult(_0x42102a,0xc9))[_0x991c('0x44')](handleError(_0x42102a,null));};exports[_0x991c('0x24')]=function(_0x49819d,_0x6a04e2){if(_0x49819d[_0x991c('0x4a')]['id']){delete _0x49819d[_0x991c('0x4a')]['id'];}return db['AnalyticTreeReport'][_0x991c('0x48')]({'where':{'id':_0x49819d[_0x991c('0x46')]['id']}})[_0x991c('0x26')](handleEntityNotFound(_0x6a04e2,null))[_0x991c('0x26')](saveUpdates(_0x49819d[_0x991c('0x4a')],null))[_0x991c('0x26')](respondWithResult(_0x6a04e2,null))[_0x991c('0x44')](handleError(_0x6a04e2,null));};exports['destroy']=function(_0x1840e1,_0x28f5ac){return db[_0x991c('0x2b')][_0x991c('0x48')]({'where':{'id':_0x1840e1[_0x991c('0x46')]['id']}})['then'](handleEntityNotFound(_0x28f5ac,null))['then'](removeEntity(_0x28f5ac,null))['catch'](handleError(_0x28f5ac,null));}; \ No newline at end of file +var _0x15bb=['filters','intersection','fields','attributes','order','sort','pick','filter','where','VIRTUAL','merge','findAll','rows','catch','show','params','length','includeAll','include','options','create','body','update','eml-format','zip-dir','fast-json-patch','moment','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','undefined','limit','count','set','apply','save','then','destroy','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0xf5c7bf,_0x3a157d){var _0x1425e6=function(_0x1124f1){while(--_0x1124f1){_0xf5c7bf['push'](_0xf5c7bf['shift']());}};_0x1425e6(++_0x3a157d);}(_0x15bb,0x1e5));var _0xb15b=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x15bb[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0xb15b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb15b('0x1'));var jsonpatch=require(_0xb15b('0x2'));var rp=require('request-promise');var moment=require(_0xb15b('0x3'));var BPromise=require(_0xb15b('0x4'));var Mustache=require(_0xb15b('0x5'));var util=require(_0xb15b('0x6'));var path=require(_0xb15b('0x7'));var sox=require(_0xb15b('0x8'));var csv=require(_0xb15b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb15b('0xa'));var _=require(_0xb15b('0xb'));var squel=require(_0xb15b('0xc'));var crypto=require(_0xb15b('0xd'));var jsforce=require(_0xb15b('0xe'));var deskjs=require(_0xb15b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb15b('0x10'));var Papa=require(_0xb15b('0x11'));var Redis=require(_0xb15b('0x12'));var authService=require(_0xb15b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb15b('0x14'));var hardwareService=require(_0xb15b('0x15'));var logger=require(_0xb15b('0x16'))(_0xb15b('0x17'));var utils=require(_0xb15b('0x18'));var config=require(_0xb15b('0x19'));var licenseUtil=require(_0xb15b('0x1a'));var db=require(_0xb15b('0x1b'))['db'];function respondWithStatusCode(_0x1cff11,_0x3ee879){_0x3ee879=_0x3ee879||0xcc;return function(_0x5b66ea){if(_0x5b66ea){return _0x1cff11[_0xb15b('0x1c')](_0x3ee879);}return _0x1cff11[_0xb15b('0x1d')](_0x3ee879)[_0xb15b('0x1e')]();};}function respondWithResult(_0x38ee81,_0x33386a){_0x33386a=_0x33386a||0xc8;return function(_0xa214b8){if(_0xa214b8){return _0x38ee81[_0xb15b('0x1d')](_0x33386a)[_0xb15b('0x1f')](_0xa214b8);}};}function respondWithFilteredResult(_0xb6a6dc,_0x4b2f1c){return function(_0x39c292){if(_0x39c292){var _0x4aa0a4=typeof _0x4b2f1c[_0xb15b('0x20')]===_0xb15b('0x21')&&typeof _0x4b2f1c[_0xb15b('0x22')]===_0xb15b('0x21');var _0x37fdc7=_0x39c292[_0xb15b('0x23')];var _0x36cd5d=_0x4aa0a4?0x0:_0x4b2f1c[_0xb15b('0x20')];var _0x5b0af5=_0x4aa0a4?_0x39c292[_0xb15b('0x23')]:_0x4b2f1c['offset']+_0x4b2f1c[_0xb15b('0x22')];var _0x3d6282;if(_0x5b0af5>=_0x37fdc7){_0x5b0af5=_0x37fdc7;_0x3d6282=0xc8;}else{_0x3d6282=0xce;}_0xb6a6dc['status'](_0x3d6282);return _0xb6a6dc[_0xb15b('0x24')]('Content-Range',_0x36cd5d+'-'+_0x5b0af5+'/'+_0x37fdc7)[_0xb15b('0x1f')](_0x39c292);}return null;};}function patchUpdates(_0x1254f2){return function(_0x1730ae){try{jsonpatch[_0xb15b('0x25')](_0x1730ae,_0x1254f2,!![]);}catch(_0x1fd7b5){return BPromise['reject'](_0x1fd7b5);}return _0x1730ae[_0xb15b('0x26')]();};}function saveUpdates(_0x3aa863,_0x49b476){return function(_0x51250d){if(_0x51250d){return _0x51250d['update'](_0x3aa863)[_0xb15b('0x27')](function(_0x37a7eb){return _0x37a7eb;});}return null;};}function removeEntity(_0x54c660,_0x16395e){return function(_0xe15d40){if(_0xe15d40){return _0xe15d40[_0xb15b('0x28')]()[_0xb15b('0x27')](function(){_0x54c660[_0xb15b('0x1d')](0xcc)[_0xb15b('0x1e')]();});}};}function handleEntityNotFound(_0x49d9aa,_0x3d1777){return function(_0x51980d){if(!_0x51980d){_0x49d9aa[_0xb15b('0x1c')](0x194);}return _0x51980d;};}function handleError(_0x456c85,_0x5660ef){_0x5660ef=_0x5660ef||0x1f4;return function(_0x53b58a){logger[_0xb15b('0x29')](_0x53b58a['stack']);if(_0x53b58a[_0xb15b('0x2a')]){delete _0x53b58a[_0xb15b('0x2a')];}_0x456c85[_0xb15b('0x1d')](_0x5660ef)[_0xb15b('0x2b')](_0x53b58a);};}exports[_0xb15b('0x2c')]=function(_0x447209,_0x4990b8){var _0x13bf47={},_0x4cef1d={},_0x1cc753={'count':0x0,'rows':[]};var _0x5ac910=_[_0xb15b('0x2d')](db[_0xb15b('0x2e')][_0xb15b('0x2f')],function(_0x32afc){return{'name':_0x32afc[_0xb15b('0x30')],'type':_0x32afc[_0xb15b('0x31')][_0xb15b('0x32')]};});_0x4cef1d[_0xb15b('0x33')]=_[_0xb15b('0x2d')](_0x5ac910,_0xb15b('0x2a'));_0x4cef1d[_0xb15b('0x34')]=_[_0xb15b('0x35')](_0x447209[_0xb15b('0x34')]);_0x4cef1d[_0xb15b('0x36')]=_[_0xb15b('0x37')](_0x4cef1d[_0xb15b('0x33')],_0x4cef1d[_0xb15b('0x34')]);_0x13bf47['attributes']=_[_0xb15b('0x37')](_0x4cef1d['model'],qs[_0xb15b('0x38')](_0x447209[_0xb15b('0x34')][_0xb15b('0x38')]));_0x13bf47['attributes']=_0x13bf47[_0xb15b('0x39')]['length']?_0x13bf47[_0xb15b('0x39')]:_0x4cef1d[_0xb15b('0x33')];if(!_0x447209[_0xb15b('0x34')]['hasOwnProperty']('nolimit')){_0x13bf47[_0xb15b('0x22')]=qs[_0xb15b('0x22')](_0x447209[_0xb15b('0x34')][_0xb15b('0x22')]);_0x13bf47[_0xb15b('0x20')]=qs[_0xb15b('0x20')](_0x447209[_0xb15b('0x34')][_0xb15b('0x20')]);}_0x13bf47[_0xb15b('0x3a')]=qs[_0xb15b('0x3b')](_0x447209[_0xb15b('0x34')][_0xb15b('0x3b')]);_0x13bf47['where']=qs[_0xb15b('0x36')](_[_0xb15b('0x3c')](_0x447209[_0xb15b('0x34')],_0x4cef1d[_0xb15b('0x36')]),_0x5ac910);if(_0x447209[_0xb15b('0x34')][_0xb15b('0x3d')]){_0x13bf47[_0xb15b('0x3e')]=_['merge'](_0x13bf47[_0xb15b('0x3e')],{'$or':_['map'](_0x5ac910,function(_0x23b964){if(_0x23b964[_0xb15b('0x31')]!==_0xb15b('0x3f')){var _0x5c2a48={};_0x5c2a48[_0x23b964[_0xb15b('0x2a')]]={'$like':'%'+_0x447209['query'][_0xb15b('0x3d')]+'%'};return _0x5c2a48;}})});}_0x13bf47=_[_0xb15b('0x40')]({},_0x13bf47,_0x447209['options']);var _0x188be8={'where':_0x13bf47[_0xb15b('0x3e')]};return db[_0xb15b('0x2e')]['count'](_0x188be8)[_0xb15b('0x27')](function(_0xcd8018){_0x1cc753['count']=_0xcd8018;if(_0x447209[_0xb15b('0x34')]['includeAll']){_0x13bf47['include']=[{'all':!![]}];}return db[_0xb15b('0x2e')][_0xb15b('0x41')](_0x13bf47);})[_0xb15b('0x27')](function(_0x40e9f1){_0x1cc753[_0xb15b('0x42')]=_0x40e9f1;return _0x1cc753;})['then'](respondWithFilteredResult(_0x4990b8,_0x13bf47))[_0xb15b('0x43')](handleError(_0x4990b8,null));};exports[_0xb15b('0x44')]=function(_0x3e55d7,_0x43e7fd){var _0x18f854={'raw':!![],'where':{'id':_0x3e55d7[_0xb15b('0x45')]['id']}},_0x361e11={};_0x361e11[_0xb15b('0x33')]=_[_0xb15b('0x35')](db['AnalyticTreeReport'][_0xb15b('0x2f')]);_0x361e11[_0xb15b('0x34')]=_[_0xb15b('0x35')](_0x3e55d7[_0xb15b('0x34')]);_0x361e11[_0xb15b('0x36')]=_[_0xb15b('0x37')](_0x361e11[_0xb15b('0x33')],_0x361e11[_0xb15b('0x34')]);_0x18f854[_0xb15b('0x39')]=_[_0xb15b('0x37')](_0x361e11[_0xb15b('0x33')],qs[_0xb15b('0x38')](_0x3e55d7[_0xb15b('0x34')][_0xb15b('0x38')]));_0x18f854[_0xb15b('0x39')]=_0x18f854[_0xb15b('0x39')][_0xb15b('0x46')]?_0x18f854[_0xb15b('0x39')]:_0x361e11[_0xb15b('0x33')];if(_0x3e55d7[_0xb15b('0x34')][_0xb15b('0x47')]){_0x18f854[_0xb15b('0x48')]=[{'all':!![]}];}_0x18f854=_[_0xb15b('0x40')]({},_0x18f854,_0x3e55d7[_0xb15b('0x49')]);return db[_0xb15b('0x2e')]['find'](_0x18f854)['then'](handleEntityNotFound(_0x43e7fd,null))[_0xb15b('0x27')](respondWithResult(_0x43e7fd,null))[_0xb15b('0x43')](handleError(_0x43e7fd,null));};exports['create']=function(_0xac7ae3,_0x1450bf){return db[_0xb15b('0x2e')][_0xb15b('0x4a')](_0xac7ae3[_0xb15b('0x4b')],{})[_0xb15b('0x27')](respondWithResult(_0x1450bf,0xc9))['catch'](handleError(_0x1450bf,null));};exports[_0xb15b('0x4c')]=function(_0x300fba,_0xd4cf12){if(_0x300fba['body']['id']){delete _0x300fba[_0xb15b('0x4b')]['id'];}return db[_0xb15b('0x2e')]['find']({'where':{'id':_0x300fba[_0xb15b('0x45')]['id']}})[_0xb15b('0x27')](handleEntityNotFound(_0xd4cf12,null))[_0xb15b('0x27')](saveUpdates(_0x300fba[_0xb15b('0x4b')],null))[_0xb15b('0x27')](respondWithResult(_0xd4cf12,null))[_0xb15b('0x43')](handleError(_0xd4cf12,null));};exports[_0xb15b('0x28')]=function(_0x5288f6,_0x14d930){return db[_0xb15b('0x2e')]['find']({'where':{'id':_0x5288f6[_0xb15b('0x45')]['id']}})[_0xb15b('0x27')](handleEntityNotFound(_0x14d930,null))[_0xb15b('0x27')](removeEntity(_0x14d930,null))[_0xb15b('0x43')](handleError(_0x14d930,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 96f02e5..7e70d2c 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 _0xf99e=['path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','../../config/logger','api','bluebird','request-promise'];(function(_0x106272,_0x18dab8){var _0x32fe96=function(_0x621748){while(--_0x621748){_0x106272['push'](_0x106272['shift']());}};_0x32fe96(++_0x18dab8);}(_0xf99e,0xa1));var _0xef99=function(_0x33cfe6,_0x3e215c){_0x33cfe6=_0x33cfe6-0x0;var _0x34b6cf=_0xf99e[_0x33cfe6];return _0x34b6cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xef99('0x0'))(_0xef99('0x1'));var moment=require('moment');var BPromise=require(_0xef99('0x2'));var rp=require(_0xef99('0x3'));var fs=require('fs');var path=require(_0xef99('0x4'));var rimraf=require(_0xef99('0x5'));var config=require(_0xef99('0x6'));var attributes=require(_0xef99('0x7'));module['exports']=function(_0x292d5d,_0x1d2cad){return _0x292d5d[_0xef99('0x8')](_0xef99('0x9'),attributes,{'tableName':_0xef99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5b3=['util','bluebird','request-promise','rimraf','../../config/environment','exports','define','analytics_report_trees'];(function(_0xe540eb,_0x3f46e3){var _0x527840=function(_0x4a1942){while(--_0x4a1942){_0xe540eb['push'](_0xe540eb['shift']());}};_0x527840(++_0x3f46e3);}(_0xc5b3,0xd0));var _0x3c5b=function(_0xb24fad,_0xd58756){_0xb24fad=_0xb24fad-0x0;var _0x173226=_0xc5b3[_0xb24fad];return _0x173226;};'use strict';var _=require('lodash');var util=require(_0x3c5b('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3c5b('0x1'));var rp=require(_0x3c5b('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c5b('0x3'));var config=require(_0x3c5b('0x4'));var attributes=require('./analyticTreeReport.attributes');module[_0x3c5b('0x5')]=function(_0x15c13e,_0x5f21ce){return _0x15c13e[_0x3c5b('0x6')]('AnalyticTreeReport',attributes,{'tableName':_0x3c5b('0x7'),'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 38df826..21259c9 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x56c909,_0xe5a06c){var _0x1f7fb7=function(_0x1ed188){while(--_0x1ed188){_0x56c909['push'](_0x56c909['shift']());}};_0x1f7fb7(++_0xe5a06c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x28f8a7,_0x184d1f){_0x28f8a7=_0x28f8a7-0x0;var _0x155496=_0x5f2f[_0x28f8a7];return _0x155496;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x1bcea2,_0x52cb59){var _0xbedf05=function(_0x8cbcfb){while(--_0x8cbcfb){_0x1bcea2['push'](_0x1bcea2['shift']());}};_0xbedf05(++_0x52cb59);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3053a6,_0x4faaba){_0x3053a6=_0x3053a6-0x0;var _0x185913=_0x5f2f[_0x3053a6];return _0x185913;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 65f170e..ccc5ff2 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 _0x043f=['./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5890ba,_0x3f7249){var _0x3dae8c=function(_0x1a6012){while(--_0x1a6012){_0x5890ba['push'](_0x5890ba['shift']());}};_0x3dae8c(++_0x3f7249);}(_0x043f,0xa2));var _0xf043=function(_0x4c35e5,_0x19e791){_0x4c35e5=_0x4c35e5-0x0;var _0x2ffcd1=_0x043f[_0x4c35e5];return _0x2ffcd1;};'use strict';var multer=require('multer');var util=require(_0xf043('0x0'));var path=require(_0xf043('0x1'));var timeout=require(_0xf043('0x2'));var express=require(_0xf043('0x3'));var router=express[_0xf043('0x4')]();var fs_extra=require(_0xf043('0x5'));var auth=require(_0xf043('0x6'));var interaction=require(_0xf043('0x7'));var config=require(_0xf043('0x8'));var controller=require(_0xf043('0x9'));router[_0xf043('0xa')]('/',auth[_0xf043('0xb')](),controller[_0xf043('0xc')]);router[_0xf043('0xa')](_0xf043('0xd'),auth[_0xf043('0xb')](),controller[_0xf043('0xe')]);router[_0xf043('0xf')]('/',auth[_0xf043('0xb')](),controller[_0xf043('0x10')]);router[_0xf043('0x11')](_0xf043('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xf043('0x12')](_0xf043('0xd'),auth[_0xf043('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3695=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','put','/:id','update','delete','destroy','exports'];(function(_0x26b617,_0x272863){var _0x363f41=function(_0x3915bc){while(--_0x3915bc){_0x26b617['push'](_0x26b617['shift']());}};_0x363f41(++_0x272863);}(_0x3695,0x1c2));var _0x5369=function(_0xcaa24,_0x2ac573){_0xcaa24=_0xcaa24-0x0;var _0x21a594=_0x3695[_0xcaa24];return _0x21a594;};'use strict';var multer=require(_0x5369('0x0'));var util=require('util');var path=require(_0x5369('0x1'));var timeout=require(_0x5369('0x2'));var express=require('express');var router=express[_0x5369('0x3')]();var fs_extra=require(_0x5369('0x4'));var auth=require(_0x5369('0x5'));var interaction=require(_0x5369('0x6'));var config=require(_0x5369('0x7'));var controller=require(_0x5369('0x8'));router[_0x5369('0x9')]('/',auth[_0x5369('0xa')](),controller[_0x5369('0xb')]);router[_0x5369('0x9')]('/:id',auth[_0x5369('0xa')](),controller['show']);router['post']('/',auth[_0x5369('0xa')](),controller['create']);router[_0x5369('0xc')](_0x5369('0xd'),auth['isAuthenticated'](),controller[_0x5369('0xe')]);router[_0x5369('0xf')](_0x5369('0xd'),auth[_0x5369('0xa')](),controller[_0x5369('0x10')]);module[_0x5369('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 52ffc0b..89b99e8 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 _0x1af3=['exports','STRING','sequelize'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1af3,0x1ca));var _0x31af=function(_0xf91841,_0x182ae3){_0xf91841=_0xf91841-0x0;var _0x4b9c44=_0x1af3[_0xf91841];return _0x4b9c44;};'use strict';var Sequelize=require(_0x31af('0x0'));module[_0x31af('0x1')]={'name':{'type':Sequelize[_0x31af('0x2')]},'basename':{'type':Sequelize[_0x31af('0x2')]},'type':{'type':Sequelize[_0x31af('0x2')]}}; \ No newline at end of file +var _0x295f=['exports','STRING'];(function(_0x26248b,_0x599778){var _0x2551b5=function(_0x3c2f9f){while(--_0x3c2f9f){_0x26248b['push'](_0x26248b['shift']());}};_0x2551b5(++_0x599778);}(_0x295f,0x168));var _0xf295=function(_0x5bad92,_0x5cdcf1){_0x5bad92=_0x5bad92-0x0;var _0x2d76ab=_0x295f[_0x5bad92];return _0x2d76ab;};'use strict';var Sequelize=require('sequelize');module[_0xf295('0x0')]={'name':{'type':Sequelize[_0xf295('0x1')]},'basename':{'type':Sequelize[_0xf295('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 5f91675..f5d1f4e 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 _0xcf22=['createdAt','updatedAt','body','create','basename','file','filename','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','Attachment','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','clone','get','omit'];(function(_0x3a5e41,_0x5c0b24){var _0x42184c=function(_0x3c8b57){while(--_0x3c8b57){_0x3a5e41['push'](_0x3a5e41['shift']());}};_0x42184c(++_0x5c0b24);}(_0xcf22,0x11e));var _0x2cf2=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xcf22[_0x381589];return _0x2a075d;};'use strict';var emlformat=require(_0x2cf2('0x0'));var rimraf=require(_0x2cf2('0x1'));var zipdir=require(_0x2cf2('0x2'));var jsonpatch=require(_0x2cf2('0x3'));var rp=require(_0x2cf2('0x4'));var moment=require(_0x2cf2('0x5'));var BPromise=require(_0x2cf2('0x6'));var Mustache=require(_0x2cf2('0x7'));var util=require(_0x2cf2('0x8'));var path=require(_0x2cf2('0x9'));var sox=require(_0x2cf2('0xa'));var csv=require(_0x2cf2('0xb'));var ejs=require(_0x2cf2('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cf2('0xd'));var squel=require(_0x2cf2('0xe'));var crypto=require('crypto');var jsforce=require(_0x2cf2('0xf'));var deskjs=require(_0x2cf2('0x10'));var toCsv=require(_0x2cf2('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2cf2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2cf2('0x12'));var as=require(_0x2cf2('0x13'));var hardwareService=require(_0x2cf2('0x14'));var logger=require(_0x2cf2('0x15'))(_0x2cf2('0x16'));var utils=require(_0x2cf2('0x17'));var config=require(_0x2cf2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0be3,_0x3164a5){_0x3164a5=_0x3164a5||0xcc;return function(_0x2a6b83){if(_0x2a6b83){return _0x1d0be3[_0x2cf2('0x19')](_0x3164a5);}return _0x1d0be3['status'](_0x3164a5)[_0x2cf2('0x1a')]();};}function respondWithResult(_0x218282,_0x14f24b){_0x14f24b=_0x14f24b||0xc8;return function(_0x16be23){if(_0x16be23){return _0x218282['status'](_0x14f24b)[_0x2cf2('0x1b')](_0x16be23);}};}function respondWithFilteredResult(_0x74b8ba,_0x54420d){return function(_0x3e5ca2){if(_0x3e5ca2){var _0x3d11c1=typeof _0x54420d['offset']===_0x2cf2('0x1c')&&typeof _0x54420d[_0x2cf2('0x1d')]===_0x2cf2('0x1c');var _0x24ac37=_0x3e5ca2[_0x2cf2('0x1e')];var _0x1f4fa2=_0x3d11c1?0x0:_0x54420d[_0x2cf2('0x1f')];var _0x1143fa=_0x3d11c1?_0x3e5ca2[_0x2cf2('0x1e')]:_0x54420d[_0x2cf2('0x1f')]+_0x54420d['limit'];var _0x117dd9;if(_0x1143fa>=_0x24ac37){_0x1143fa=_0x24ac37;_0x117dd9=0xc8;}else{_0x117dd9=0xce;}_0x74b8ba[_0x2cf2('0x20')](_0x117dd9);return _0x74b8ba[_0x2cf2('0x21')](_0x2cf2('0x22'),_0x1f4fa2+'-'+_0x1143fa+'/'+_0x24ac37)[_0x2cf2('0x1b')](_0x3e5ca2);}return null;};}function patchUpdates(_0x8b38e3){return function(_0x1f1296){try{jsonpatch[_0x2cf2('0x23')](_0x1f1296,_0x8b38e3,!![]);}catch(_0x36307b){return BPromise[_0x2cf2('0x24')](_0x36307b);}return _0x1f1296[_0x2cf2('0x25')]();};}function saveUpdates(_0x58c446,_0x12db8b){return function(_0x4fdcad){if(_0x4fdcad){return _0x4fdcad[_0x2cf2('0x26')](_0x58c446)[_0x2cf2('0x27')](function(_0x2071da){return _0x2071da;});}return null;};}function removeEntity(_0x3372e8,_0x4657e3){return function(_0x55f43a){if(_0x55f43a){return _0x55f43a[_0x2cf2('0x28')]()[_0x2cf2('0x27')](function(){_0x3372e8[_0x2cf2('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4baa84,_0x5c52d3){return function(_0x45a088){if(!_0x45a088){_0x4baa84[_0x2cf2('0x19')](0x194);}return _0x45a088;};}function handleError(_0x1af153,_0x3de661){_0x3de661=_0x3de661||0x1f4;return function(_0x73474){logger[_0x2cf2('0x29')](_0x73474['stack']);if(_0x73474[_0x2cf2('0x2a')]){delete _0x73474[_0x2cf2('0x2a')];}_0x1af153['status'](_0x3de661)[_0x2cf2('0x2b')](_0x73474);};}exports[_0x2cf2('0x2c')]=function(_0x58c5fa,_0x46b808){var _0x44093f={},_0x27ed2e={},_0x5784e8={'count':0x0,'rows':[]};var _0x915533=_[_0x2cf2('0x2d')](db['Attachment']['rawAttributes'],function(_0x5588df){return{'name':_0x5588df['fieldName'],'type':_0x5588df[_0x2cf2('0x2e')][_0x2cf2('0x2f')]};});_0x27ed2e[_0x2cf2('0x30')]=_[_0x2cf2('0x2d')](_0x915533,'name');_0x27ed2e[_0x2cf2('0x31')]=_[_0x2cf2('0x32')](_0x58c5fa[_0x2cf2('0x31')]);_0x27ed2e[_0x2cf2('0x33')]=_[_0x2cf2('0x34')](_0x27ed2e[_0x2cf2('0x30')],_0x27ed2e[_0x2cf2('0x31')]);_0x44093f[_0x2cf2('0x35')]=_[_0x2cf2('0x34')](_0x27ed2e[_0x2cf2('0x30')],qs[_0x2cf2('0x36')](_0x58c5fa['query'][_0x2cf2('0x36')]));_0x44093f[_0x2cf2('0x35')]=_0x44093f[_0x2cf2('0x35')][_0x2cf2('0x37')]?_0x44093f[_0x2cf2('0x35')]:_0x27ed2e[_0x2cf2('0x30')];if(!_0x58c5fa[_0x2cf2('0x31')][_0x2cf2('0x38')](_0x2cf2('0x39'))){_0x44093f[_0x2cf2('0x1d')]=qs[_0x2cf2('0x1d')](_0x58c5fa['query'][_0x2cf2('0x1d')]);_0x44093f['offset']=qs['offset'](_0x58c5fa[_0x2cf2('0x31')]['offset']);}_0x44093f[_0x2cf2('0x3a')]=qs['sort'](_0x58c5fa[_0x2cf2('0x31')]['sort']);_0x44093f[_0x2cf2('0x3b')]=qs[_0x2cf2('0x33')](_[_0x2cf2('0x3c')](_0x58c5fa[_0x2cf2('0x31')],_0x27ed2e[_0x2cf2('0x33')]),_0x915533);if(_0x58c5fa['query'][_0x2cf2('0x3d')]){_0x44093f[_0x2cf2('0x3b')]=_[_0x2cf2('0x3e')](_0x44093f['where'],{'$or':_[_0x2cf2('0x2d')](_0x915533,function(_0xfb5c66){if(_0xfb5c66['type']!==_0x2cf2('0x3f')){var _0x5d0512={};_0x5d0512[_0xfb5c66[_0x2cf2('0x2a')]]={'$like':'%'+_0x58c5fa[_0x2cf2('0x31')]['filter']+'%'};return _0x5d0512;}})});}_0x44093f=_[_0x2cf2('0x3e')]({},_0x44093f,_0x58c5fa[_0x2cf2('0x40')]);var _0x4bb4d5={'where':_0x44093f['where']};return db[_0x2cf2('0x41')][_0x2cf2('0x1e')](_0x4bb4d5)[_0x2cf2('0x27')](function(_0x3b820c){_0x5784e8[_0x2cf2('0x1e')]=_0x3b820c;if(_0x58c5fa[_0x2cf2('0x31')][_0x2cf2('0x42')]){_0x44093f[_0x2cf2('0x43')]=[{'all':!![]}];}return db['Attachment'][_0x2cf2('0x44')](_0x44093f);})[_0x2cf2('0x27')](function(_0x4d0dd5){_0x5784e8[_0x2cf2('0x45')]=_0x4d0dd5;return _0x5784e8;})[_0x2cf2('0x27')](respondWithFilteredResult(_0x46b808,_0x44093f))[_0x2cf2('0x46')](handleError(_0x46b808,null));};exports[_0x2cf2('0x47')]=function(_0x45ff0a,_0x24e2e7){var _0x32334a={'raw':!![],'where':{'id':_0x45ff0a[_0x2cf2('0x48')]['id']}},_0x534887={};_0x534887['model']=_[_0x2cf2('0x32')](db[_0x2cf2('0x41')][_0x2cf2('0x49')]);_0x534887['query']=_[_0x2cf2('0x32')](_0x45ff0a[_0x2cf2('0x31')]);_0x534887['filters']=_['intersection'](_0x534887[_0x2cf2('0x30')],_0x534887[_0x2cf2('0x31')]);_0x32334a['attributes']=_['intersection'](_0x534887[_0x2cf2('0x30')],qs[_0x2cf2('0x36')](_0x45ff0a[_0x2cf2('0x31')][_0x2cf2('0x36')]));_0x32334a[_0x2cf2('0x35')]=_0x32334a[_0x2cf2('0x35')][_0x2cf2('0x37')]?_0x32334a[_0x2cf2('0x35')]:_0x534887['model'];if(_0x45ff0a[_0x2cf2('0x31')]['includeAll']){_0x32334a[_0x2cf2('0x43')]=[{'all':!![]}];}_0x32334a=_['merge']({},_0x32334a,_0x45ff0a[_0x2cf2('0x40')]);return db[_0x2cf2('0x41')][_0x2cf2('0x4a')](_0x32334a)[_0x2cf2('0x27')](handleEntityNotFound(_0x24e2e7,null))['then'](respondWithResult(_0x24e2e7,null))['catch'](handleError(_0x24e2e7,null));};exports[_0x2cf2('0x4b')]=function(_0x4cc100,_0x43a510){var _0xa0b438={'where':{'id':_0x4cc100[_0x2cf2('0x48')]['id']}},_0x5db2b6={};_0x5db2b6[_0x2cf2('0x30')]=_[_0x2cf2('0x32')](db[_0x2cf2('0x41')][_0x2cf2('0x49')]);_0xa0b438['attributes']=_[_0x2cf2('0x34')](_0x5db2b6[_0x2cf2('0x30')],qs[_0x2cf2('0x36')](_0x4cc100[_0x2cf2('0x31')]['fields']));_0xa0b438[_0x2cf2('0x35')]=_0xa0b438[_0x2cf2('0x35')][_0x2cf2('0x37')]?_0xa0b438[_0x2cf2('0x35')]:_0x5db2b6[_0x2cf2('0x30')];if(_0x4cc100[_0x2cf2('0x31')]['includeAll']){_0xa0b438[_0x2cf2('0x43')]=[{'all':!![]}];}_0xa0b438=_[_0x2cf2('0x3e')]({},_0xa0b438,_0x4cc100['options']);return db[_0x2cf2('0x41')][_0x2cf2('0x4a')](_0xa0b438)[_0x2cf2('0x27')](handleEntityNotFound(_0x43a510,null))[_0x2cf2('0x27')](function(_0x27713d){if(_0x27713d){var _0x17bccd=_0x27713d[_0x2cf2('0x4c')]({'plain':!![]});_0x17bccd=qs[_0x2cf2('0x4d')](_0x17bccd,['id',_0x2cf2('0x4e'),_0x2cf2('0x4f')]);_0x4cc100[_0x2cf2('0x50')]=_['omit'](_0x4cc100[_0x2cf2('0x50')],['id','createdAt',_0x2cf2('0x4f')]);return db[_0x2cf2('0x41')][_0x2cf2('0x51')](_['merge'](_0x17bccd,_0x4cc100[_0x2cf2('0x50')]),{'include':_0x4cc100[_0x2cf2('0x31')][_0x2cf2('0x42')]?[{'all':!![]}]:undefined});}})[_0x2cf2('0x27')](respondWithResult(_0x43a510,0xc9))[_0x2cf2('0x46')](handleError(_0x43a510,null));};exports[_0x2cf2('0x26')]=function(_0x1bf52c,_0x5e7ea9){if(_0x1bf52c[_0x2cf2('0x50')]['id']){delete _0x1bf52c['body']['id'];}return db['Attachment'][_0x2cf2('0x4a')]({'where':{'id':_0x1bf52c[_0x2cf2('0x48')]['id']}})[_0x2cf2('0x27')](handleEntityNotFound(_0x5e7ea9,null))[_0x2cf2('0x27')](saveUpdates(_0x1bf52c[_0x2cf2('0x50')],null))[_0x2cf2('0x27')](respondWithResult(_0x5e7ea9,null))['catch'](handleError(_0x5e7ea9,null));};exports[_0x2cf2('0x28')]=function(_0x3875cc,_0x1573f5){return db['Attachment'][_0x2cf2('0x4a')]({'where':{'id':_0x3875cc[_0x2cf2('0x48')]['id']}})[_0x2cf2('0x27')](handleEntityNotFound(_0x1573f5,null))[_0x2cf2('0x27')](removeEntity(_0x1573f5,null))[_0x2cf2('0x46')](handleError(_0x1573f5,null));};exports[_0x2cf2('0x51')]=function(_0x217e40,_0x3e251b,_0x2f1cc2){_0x217e40['body']['name']=_0x217e40['file']['originalname'];_0x217e40[_0x2cf2('0x50')][_0x2cf2('0x52')]=_0x217e40[_0x2cf2('0x53')][_0x2cf2('0x54')];_0x217e40[_0x2cf2('0x50')][_0x2cf2('0x2e')]=_0x217e40['file']['mimetype'];return db['Attachment'][_0x2cf2('0x51')](_0x217e40[_0x2cf2('0x50')])[_0x2cf2('0x27')](respondWithResult(_0x3e251b,0xc9))[_0x2cf2('0x46')](handleError(_0x3e251b,null));};exports[_0x2cf2('0x55')]=function(_0x15f194,_0x2be204,_0x8bb3d1){return db[_0x2cf2('0x41')][_0x2cf2('0x56')]({'where':{'id':_0x15f194['params']['id']},'raw':!![]})[_0x2cf2('0x27')](handleEntityNotFound(_0x2be204,null))[_0x2cf2('0x27')](function(_0x4410fc){if(_0x4410fc){var _0x14091c=_0x4410fc[_0x2cf2('0x57')]!==null;var _0x315818=path[_0x2cf2('0x58')](config[_0x2cf2('0x59')],_0x2cf2('0x5a'));if(_0x14091c){_0x315818=path[_0x2cf2('0x58')](_0x315818,'offline-chat/');}var _0x211c5a=path[_0x2cf2('0x58')](_0x315818,_0x4410fc[_0x2cf2('0x52')]);return _0x2be204[_0x2cf2('0x55')](_0x211c5a);}})[_0x2cf2('0x46')](handleError(_0x2be204,null));}; \ No newline at end of file +var _0x5130=['../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','update','error','stack','name','send','index','map','Attachment','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','then','rows','show','params','include','find','catch','rawAttributes','get','omit','createdAt','updatedAt','body','create','destroy','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5130,0xf8));var _0x0513=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x5130[_0x3e25c1];return _0x52e7f2;};'use strict';var emlformat=require(_0x0513('0x0'));var rimraf=require(_0x0513('0x1'));var zipdir=require(_0x0513('0x2'));var jsonpatch=require(_0x0513('0x3'));var rp=require(_0x0513('0x4'));var moment=require(_0x0513('0x5'));var BPromise=require(_0x0513('0x6'));var Mustache=require(_0x0513('0x7'));var util=require('util');var path=require(_0x0513('0x8'));var sox=require(_0x0513('0x9'));var csv=require(_0x0513('0xa'));var ejs=require(_0x0513('0xb'));var fs=require('fs');var fs_extra=require(_0x0513('0xc'));var _=require(_0x0513('0xd'));var squel=require('squel');var crypto=require(_0x0513('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0513('0xf'));var toCsv=require(_0x0513('0xa'));var querystring=require(_0x0513('0x10'));var Papa=require(_0x0513('0x11'));var Redis=require('ioredis');var authService=require(_0x0513('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0513('0x13'));var hardwareService=require(_0x0513('0x14'));var logger=require(_0x0513('0x15'))('api');var utils=require(_0x0513('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0513('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb9cc6b,_0x5e1a8e){_0x5e1a8e=_0x5e1a8e||0xcc;return function(_0x3582f7){if(_0x3582f7){return _0xb9cc6b[_0x0513('0x18')](_0x5e1a8e);}return _0xb9cc6b[_0x0513('0x19')](_0x5e1a8e)['end']();};}function respondWithResult(_0x5477c1,_0x1f462b){_0x1f462b=_0x1f462b||0xc8;return function(_0x1ba1f8){if(_0x1ba1f8){return _0x5477c1[_0x0513('0x19')](_0x1f462b)[_0x0513('0x1a')](_0x1ba1f8);}};}function respondWithFilteredResult(_0x124310,_0x2d4a49){return function(_0x24243c){if(_0x24243c){var _0x189039=typeof _0x2d4a49['offset']===_0x0513('0x1b')&&typeof _0x2d4a49[_0x0513('0x1c')]===_0x0513('0x1b');var _0x27dd85=_0x24243c['count'];var _0x5b70b5=_0x189039?0x0:_0x2d4a49[_0x0513('0x1d')];var _0x16bdee=_0x189039?_0x24243c['count']:_0x2d4a49[_0x0513('0x1d')]+_0x2d4a49[_0x0513('0x1c')];var _0x315d7b;if(_0x16bdee>=_0x27dd85){_0x16bdee=_0x27dd85;_0x315d7b=0xc8;}else{_0x315d7b=0xce;}_0x124310[_0x0513('0x19')](_0x315d7b);return _0x124310[_0x0513('0x1e')](_0x0513('0x1f'),_0x5b70b5+'-'+_0x16bdee+'/'+_0x27dd85)[_0x0513('0x1a')](_0x24243c);}return null;};}function patchUpdates(_0x8df68e){return function(_0x2dc0da){try{jsonpatch[_0x0513('0x20')](_0x2dc0da,_0x8df68e,!![]);}catch(_0x31864e){return BPromise[_0x0513('0x21')](_0x31864e);}return _0x2dc0da['save']();};}function saveUpdates(_0x169356,_0x2db01c){return function(_0x3ce6e1){if(_0x3ce6e1){return _0x3ce6e1[_0x0513('0x22')](_0x169356)['then'](function(_0x4c9be6){return _0x4c9be6;});}return null;};}function removeEntity(_0x13c50d,_0x295814){return function(_0x37594c){if(_0x37594c){return _0x37594c['destroy']()['then'](function(){_0x13c50d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c613c,_0x5a51e7){return function(_0x1541ab){if(!_0x1541ab){_0x3c613c[_0x0513('0x18')](0x194);}return _0x1541ab;};}function handleError(_0x6e86e3,_0x3de01c){_0x3de01c=_0x3de01c||0x1f4;return function(_0x34c302){logger[_0x0513('0x23')](_0x34c302[_0x0513('0x24')]);if(_0x34c302[_0x0513('0x25')]){delete _0x34c302['name'];}_0x6e86e3[_0x0513('0x19')](_0x3de01c)[_0x0513('0x26')](_0x34c302);};}exports[_0x0513('0x27')]=function(_0x15a802,_0x38c139){var _0x5ecd63={},_0x3ecc04={},_0x559306={'count':0x0,'rows':[]};var _0x577439=_[_0x0513('0x28')](db[_0x0513('0x29')]['rawAttributes'],function(_0x371397){return{'name':_0x371397['fieldName'],'type':_0x371397[_0x0513('0x2a')][_0x0513('0x2b')]};});_0x3ecc04[_0x0513('0x2c')]=_[_0x0513('0x28')](_0x577439,_0x0513('0x25'));_0x3ecc04[_0x0513('0x2d')]=_[_0x0513('0x2e')](_0x15a802[_0x0513('0x2d')]);_0x3ecc04[_0x0513('0x2f')]=_[_0x0513('0x30')](_0x3ecc04[_0x0513('0x2c')],_0x3ecc04['query']);_0x5ecd63[_0x0513('0x31')]=_[_0x0513('0x30')](_0x3ecc04[_0x0513('0x2c')],qs[_0x0513('0x32')](_0x15a802['query'][_0x0513('0x32')]));_0x5ecd63[_0x0513('0x31')]=_0x5ecd63['attributes'][_0x0513('0x33')]?_0x5ecd63[_0x0513('0x31')]:_0x3ecc04[_0x0513('0x2c')];if(!_0x15a802['query']['hasOwnProperty'](_0x0513('0x34'))){_0x5ecd63['limit']=qs[_0x0513('0x1c')](_0x15a802[_0x0513('0x2d')][_0x0513('0x1c')]);_0x5ecd63[_0x0513('0x1d')]=qs['offset'](_0x15a802[_0x0513('0x2d')]['offset']);}_0x5ecd63[_0x0513('0x35')]=qs[_0x0513('0x36')](_0x15a802[_0x0513('0x2d')][_0x0513('0x36')]);_0x5ecd63[_0x0513('0x37')]=qs[_0x0513('0x2f')](_[_0x0513('0x38')](_0x15a802[_0x0513('0x2d')],_0x3ecc04[_0x0513('0x2f')]),_0x577439);if(_0x15a802[_0x0513('0x2d')][_0x0513('0x39')]){_0x5ecd63['where']=_[_0x0513('0x3a')](_0x5ecd63[_0x0513('0x37')],{'$or':_[_0x0513('0x28')](_0x577439,function(_0x40b63f){if(_0x40b63f['type']!==_0x0513('0x3b')){var _0x17b91a={};_0x17b91a[_0x40b63f[_0x0513('0x25')]]={'$like':'%'+_0x15a802['query'][_0x0513('0x39')]+'%'};return _0x17b91a;}})});}_0x5ecd63=_[_0x0513('0x3a')]({},_0x5ecd63,_0x15a802[_0x0513('0x3c')]);var _0xa57642={'where':_0x5ecd63[_0x0513('0x37')]};return db[_0x0513('0x29')]['count'](_0xa57642)['then'](function(_0x244dc9){_0x559306[_0x0513('0x3d')]=_0x244dc9;if(_0x15a802[_0x0513('0x2d')][_0x0513('0x3e')]){_0x5ecd63['include']=[{'all':!![]}];}return db[_0x0513('0x29')]['findAll'](_0x5ecd63);})[_0x0513('0x3f')](function(_0x401597){_0x559306[_0x0513('0x40')]=_0x401597;return _0x559306;})[_0x0513('0x3f')](respondWithFilteredResult(_0x38c139,_0x5ecd63))['catch'](handleError(_0x38c139,null));};exports[_0x0513('0x41')]=function(_0x36377b,_0xef2374){var _0x3f1b74={'raw':!![],'where':{'id':_0x36377b[_0x0513('0x42')]['id']}},_0x33ea46={};_0x33ea46[_0x0513('0x2c')]=_[_0x0513('0x2e')](db[_0x0513('0x29')]['rawAttributes']);_0x33ea46[_0x0513('0x2d')]=_[_0x0513('0x2e')](_0x36377b[_0x0513('0x2d')]);_0x33ea46['filters']=_['intersection'](_0x33ea46[_0x0513('0x2c')],_0x33ea46[_0x0513('0x2d')]);_0x3f1b74[_0x0513('0x31')]=_['intersection'](_0x33ea46[_0x0513('0x2c')],qs[_0x0513('0x32')](_0x36377b[_0x0513('0x2d')][_0x0513('0x32')]));_0x3f1b74[_0x0513('0x31')]=_0x3f1b74[_0x0513('0x31')]['length']?_0x3f1b74[_0x0513('0x31')]:_0x33ea46[_0x0513('0x2c')];if(_0x36377b[_0x0513('0x2d')]['includeAll']){_0x3f1b74[_0x0513('0x43')]=[{'all':!![]}];}_0x3f1b74=_['merge']({},_0x3f1b74,_0x36377b[_0x0513('0x3c')]);return db[_0x0513('0x29')][_0x0513('0x44')](_0x3f1b74)['then'](handleEntityNotFound(_0xef2374,null))['then'](respondWithResult(_0xef2374,null))[_0x0513('0x45')](handleError(_0xef2374,null));};exports['clone']=function(_0x17b156,_0x26bf89){var _0x4b5fc7={'where':{'id':_0x17b156[_0x0513('0x42')]['id']}},_0x57506e={};_0x57506e['model']=_[_0x0513('0x2e')](db[_0x0513('0x29')][_0x0513('0x46')]);_0x4b5fc7[_0x0513('0x31')]=_[_0x0513('0x30')](_0x57506e[_0x0513('0x2c')],qs[_0x0513('0x32')](_0x17b156[_0x0513('0x2d')][_0x0513('0x32')]));_0x4b5fc7[_0x0513('0x31')]=_0x4b5fc7['attributes']['length']?_0x4b5fc7['attributes']:_0x57506e['model'];if(_0x17b156[_0x0513('0x2d')]['includeAll']){_0x4b5fc7[_0x0513('0x43')]=[{'all':!![]}];}_0x4b5fc7=_[_0x0513('0x3a')]({},_0x4b5fc7,_0x17b156['options']);return db[_0x0513('0x29')][_0x0513('0x44')](_0x4b5fc7)['then'](handleEntityNotFound(_0x26bf89,null))[_0x0513('0x3f')](function(_0x2531d5){if(_0x2531d5){var _0x45657a=_0x2531d5[_0x0513('0x47')]({'plain':!![]});_0x45657a=qs[_0x0513('0x48')](_0x45657a,['id',_0x0513('0x49'),_0x0513('0x4a')]);_0x17b156[_0x0513('0x4b')]=_[_0x0513('0x48')](_0x17b156['body'],['id',_0x0513('0x49'),_0x0513('0x4a')]);return db[_0x0513('0x29')][_0x0513('0x4c')](_['merge'](_0x45657a,_0x17b156['body']),{'include':_0x17b156[_0x0513('0x2d')][_0x0513('0x3e')]?[{'all':!![]}]:undefined});}})[_0x0513('0x3f')](respondWithResult(_0x26bf89,0xc9))[_0x0513('0x45')](handleError(_0x26bf89,null));};exports[_0x0513('0x22')]=function(_0x102ab1,_0x380528){if(_0x102ab1[_0x0513('0x4b')]['id']){delete _0x102ab1['body']['id'];}return db[_0x0513('0x29')][_0x0513('0x44')]({'where':{'id':_0x102ab1[_0x0513('0x42')]['id']}})[_0x0513('0x3f')](handleEntityNotFound(_0x380528,null))[_0x0513('0x3f')](saveUpdates(_0x102ab1['body'],null))[_0x0513('0x3f')](respondWithResult(_0x380528,null))[_0x0513('0x45')](handleError(_0x380528,null));};exports[_0x0513('0x4d')]=function(_0x3ac9c4,_0x289d63){return db[_0x0513('0x29')]['find']({'where':{'id':_0x3ac9c4[_0x0513('0x42')]['id']}})[_0x0513('0x3f')](handleEntityNotFound(_0x289d63,null))[_0x0513('0x3f')](removeEntity(_0x289d63,null))['catch'](handleError(_0x289d63,null));};exports[_0x0513('0x4c')]=function(_0x33d682,_0xd8968a,_0x42528f){_0x33d682[_0x0513('0x4b')][_0x0513('0x25')]=_0x33d682[_0x0513('0x4e')][_0x0513('0x4f')];_0x33d682[_0x0513('0x4b')][_0x0513('0x50')]=_0x33d682[_0x0513('0x4e')][_0x0513('0x51')];_0x33d682[_0x0513('0x4b')][_0x0513('0x2a')]=_0x33d682[_0x0513('0x4e')][_0x0513('0x52')];return db[_0x0513('0x29')][_0x0513('0x4c')](_0x33d682[_0x0513('0x4b')])[_0x0513('0x3f')](respondWithResult(_0xd8968a,0xc9))[_0x0513('0x45')](handleError(_0xd8968a,null));};exports[_0x0513('0x53')]=function(_0x5d8008,_0x51330b,_0x264d24){return db[_0x0513('0x29')][_0x0513('0x54')]({'where':{'id':_0x5d8008[_0x0513('0x42')]['id']},'raw':!![]})[_0x0513('0x3f')](handleEntityNotFound(_0x51330b,null))['then'](function(_0x5245b2){if(_0x5245b2){var _0x4ace2f=_0x5245b2[_0x0513('0x55')]!==null;var _0x486047=path[_0x0513('0x56')](config[_0x0513('0x57')],_0x0513('0x58'));if(_0x4ace2f){_0x486047=path[_0x0513('0x56')](_0x486047,_0x0513('0x59'));}var _0x890a5a=path[_0x0513('0x56')](_0x486047,_0x5245b2['basename']);return _0x51330b[_0x0513('0x53')](_0x890a5a);}})['catch'](handleError(_0x51330b,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 56e578e..e7b9a2c 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 _0xa005=['../../config/logger','moment','bluebird','path','../../config/environment','./attachment.attributes','exports','define','attachments','util'];(function(_0x4ce45a,_0x55a777){var _0x3b65d2=function(_0x11309c){while(--_0x11309c){_0x4ce45a['push'](_0x4ce45a['shift']());}};_0x3b65d2(++_0x55a777);}(_0xa005,0x167));var _0x5a00=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xa005[_0xac151d];return _0x111dba;};'use strict';var _=require('lodash');var util=require(_0x5a00('0x0'));var logger=require(_0x5a00('0x1'))('api');var moment=require(_0x5a00('0x2'));var BPromise=require(_0x5a00('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a00('0x4'));var rimraf=require('rimraf');var config=require(_0x5a00('0x5'));var attributes=require(_0x5a00('0x6'));module[_0x5a00('0x7')]=function(_0x5b3ceb,_0x40dab4){return _0x5b3ceb[_0x5a00('0x8')]('Attachment',attributes,{'tableName':_0x5a00('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e3f=['exports','define','Attachment','attachments','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x1128d5,_0x1bed60){var _0x2420db=function(_0x558482){while(--_0x558482){_0x1128d5['push'](_0x1128d5['shift']());}};_0x2420db(++_0x1bed60);}(_0x0e3f,0x11c));var _0xf0e3=function(_0x47cf44,_0x2653db){_0x47cf44=_0x47cf44-0x0;var _0x2fb24b=_0x0e3f[_0x47cf44];return _0x2fb24b;};'use strict';var _=require(_0xf0e3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf0e3('0x1'));var BPromise=require(_0xf0e3('0x2'));var rp=require(_0xf0e3('0x3'));var fs=require('fs');var path=require(_0xf0e3('0x4'));var rimraf=require(_0xf0e3('0x5'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0xf0e3('0x6')]=function(_0x5a0b38,_0x334d86){return _0x5a0b38[_0xf0e3('0x7')](_0xf0e3('0x8'),attributes,{'tableName':_0xf0e3('0x9'),'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 e01509f..c115220 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 _0x130d=['debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateAttachment','Attachment','options','raw','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s'];(function(_0x41c838,_0x370983){var _0x326c73=function(_0x30f2c9){while(--_0x30f2c9){_0x41c838['push'](_0x41c838['shift']());}};_0x326c73(++_0x370983);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var util=require('util');var moment=require(_0xd130('0x1'));var BPromise=require('bluebird');var rs=require(_0xd130('0x2'));var fs=require('fs');var Redis=require(_0xd130('0x3'));var db=require(_0xd130('0x4'))['db'];var utils=require(_0xd130('0x5'));var logger=require(_0xd130('0x6'))(_0xd130('0x7'));var config=require(_0xd130('0x8'));var jayson=require(_0xd130('0x9'));var client=jayson[_0xd130('0xa')][_0xd130('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44c215,_0x168ee7,_0x3f77e1){return new BPromise(function(_0x1b9875,_0x4a3818){return client[_0xd130('0xc')](_0x44c215,_0x3f77e1)['then'](function(_0x1cec3b){logger[_0xd130('0xd')](_0xd130('0xe'),_0x168ee7,'request\x20sent');logger[_0xd130('0xf')](_0xd130('0x10'),_0x168ee7,'request\x20sent',JSON['stringify'](_0x1cec3b));if(_0x1cec3b[_0xd130('0x11')]){if(_0x1cec3b['error'][_0xd130('0x12')]===0x1f4){logger[_0xd130('0x11')]('Attachment,\x20%s,\x20%s',_0x168ee7,_0x1cec3b[_0xd130('0x11')][_0xd130('0x13')]);return _0x4a3818(_0x1cec3b[_0xd130('0x11')]['message']);}logger['error']('Attachment,\x20%s,\x20%s',_0x168ee7,_0x1cec3b[_0xd130('0x11')][_0xd130('0x13')]);return _0x1b9875(_0x1cec3b[_0xd130('0x11')][_0xd130('0x13')]);}else{logger[_0xd130('0xd')]('Attachment,\x20%s,\x20%s',_0x168ee7,_0xd130('0x14'));_0x1b9875(_0x1cec3b[_0xd130('0x15')][_0xd130('0x13')]);}})[_0xd130('0x16')](function(_0x57930b){logger[_0xd130('0x11')](_0xd130('0xe'),_0x168ee7,_0x57930b);_0x4a3818(_0x57930b);});});}exports[_0xd130('0x17')]=function(_0xce6d93){var _0x342eb2=this;return new Promise(function(_0xc1c504,_0x43ed26){return db[_0xd130('0x18')]['create'](_0xce6d93['body'],{'raw':_0xce6d93[_0xd130('0x19')]?_0xce6d93[_0xd130('0x19')][_0xd130('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2420fd){logger[_0xd130('0xd')](_0xd130('0x17'),_0xce6d93);logger[_0xd130('0xf')](_0xd130('0x17'),_0xce6d93,JSON[_0xd130('0x1b')](_0x2420fd));_0xc1c504(_0x2420fd);})['catch'](function(_0x311c3a){logger[_0xd130('0x11')](_0xd130('0x17'),_0x311c3a[_0xd130('0x13')],_0xce6d93);_0x43ed26(_0x342eb2[_0xd130('0x11')](0x1f4,_0x311c3a[_0xd130('0x13')]));});});}; \ No newline at end of file +var _0x0884=['CreateAttachment','Attachment','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4088('0x0'));var util=require(_0x4088('0x1'));var moment=require(_0x4088('0x2'));var BPromise=require(_0x4088('0x3'));var rs=require(_0x4088('0x4'));var fs=require('fs');var Redis=require(_0x4088('0x5'));var db=require(_0x4088('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4088('0x7'))(_0x4088('0x8'));var config=require(_0x4088('0x9'));var jayson=require(_0x4088('0xa'));var client=jayson[_0x4088('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d68aa,_0x42b2c3,_0x52baff){return new BPromise(function(_0x680227,_0x8f007c){return client[_0x4088('0xc')](_0x4d68aa,_0x52baff)[_0x4088('0xd')](function(_0x32fbb6){logger[_0x4088('0xe')](_0x4088('0xf'),_0x42b2c3,_0x4088('0x10'));logger[_0x4088('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0x42b2c3,_0x4088('0x10'),JSON[_0x4088('0x12')](_0x32fbb6));if(_0x32fbb6[_0x4088('0x13')]){if(_0x32fbb6['error'][_0x4088('0x14')]===0x1f4){logger[_0x4088('0x13')]('Attachment,\x20%s,\x20%s',_0x42b2c3,_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);return _0x8f007c(_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);}logger[_0x4088('0x13')](_0x4088('0xf'),_0x42b2c3,_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);return _0x680227(_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);}else{logger[_0x4088('0xe')](_0x4088('0xf'),_0x42b2c3,_0x4088('0x10'));_0x680227(_0x32fbb6[_0x4088('0x16')][_0x4088('0x15')]);}})[_0x4088('0x17')](function(_0x38c6d6){logger[_0x4088('0x13')]('Attachment,\x20%s,\x20%s',_0x42b2c3,_0x38c6d6);_0x8f007c(_0x38c6d6);});});}exports[_0x4088('0x18')]=function(_0x24fe84){var _0xc7fc8e=this;return new Promise(function(_0xf21ee7,_0x40bea5){return db[_0x4088('0x19')][_0x4088('0x1a')](_0x24fe84[_0x4088('0x1b')],{'raw':_0x24fe84[_0x4088('0x1c')]?_0x24fe84[_0x4088('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x4088('0xd')](function(_0x4b887e){logger['info']('CreateAttachment',_0x24fe84);logger['debug'](_0x4088('0x18'),_0x24fe84,JSON[_0x4088('0x12')](_0x4b887e));_0xf21ee7(_0x4b887e);})[_0x4088('0x17')](function(_0x31f333){logger['error'](_0x4088('0x18'),_0x31f333[_0x4088('0x15')],_0x24fe84);_0x40bea5(_0xc7fc8e[_0x4088('0x13')](0x1f4,_0x31f333['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 9b7cd91..97c234d 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x236461,_0x10f5dd){var _0x10e38c=function(_0x4afd37){while(--_0x4afd37){_0x236461['push'](_0x236461['shift']());}};_0x10e38c(++_0x10f5dd);}(_0x5f2f,0x73));var _0xf5f2=function(_0xda9c92,_0x4eb311){_0xda9c92=_0xda9c92-0x0;var _0x35f952=_0x5f2f[_0xda9c92];return _0x35f952;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x5872d2,_0x4e1df8){var _0x5516ef=function(_0x2dc2c8){while(--_0x2dc2c8){_0x5872d2['push'](_0x5872d2['shift']());}};_0x5516ef(++_0x4e1df8);}(_0x5f2f,0x73));var _0xf5f2=function(_0xf54af,_0x4b8989){_0xf54af=_0xf54af-0x0;var _0x4f4f72=_0x5f2f[_0xf54af];return _0x4f4f72;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 979d999..d810eea 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 _0xa0ad=['authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','name','salt','role','blockedAt','online','admin','user','agent','disabled','blocked','add','minutes','clearBlockUser','getLicense','status','message','login','ad-login','signToken','use','password','passport','passport-local','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','undefined','baseDN','domain'];(function(_0x19b5f4,_0x5528fc){var _0x5496d5=function(_0x32016a){while(--_0x32016a){_0x19b5f4['push'](_0x19b5f4['shift']());}};_0x5496d5(++_0x5528fc);}(_0xa0ad,0x12e));var _0xda0a=function(_0x50f112,_0xd38e53){_0x50f112=_0x50f112-0x0;var _0x4ecf28=_0xa0ad[_0x50f112];return _0x4ecf28;};'use strict';var passport=require(_0xda0a('0x0'));var LocalStrategy=require(_0xda0a('0x1'))['Strategy'];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xda0a('0x2'));var util=require(_0xda0a('0x3'));var db=require(_0xda0a('0x4'))['db'];var authService=require(_0xda0a('0x5'));var utils=require(_0xda0a('0x6'));var config=require('../../config/environment');var logger=require(_0xda0a('0x7'))(_0xda0a('0x8'));function isActiveDirectoryConfigured(_0x5f08f2){var _0x327ef2=![];if(typeof _0x5f08f2[_0xda0a('0x9')]!==_0xda0a('0xa')){_0x327ef2=_0x5f08f2['activedirectory'][_0xda0a('0xb')]&&_0x5f08f2[_0xda0a('0x9')]['url']&&_0x5f08f2['activedirectory'][_0xda0a('0xc')];}return _0x327ef2;}function adAuthenticate(_0x4b1dce,_0x2d1da0,_0x1ec86f){return new BPromise(function(_0x55a46f,_0x1adbee){try{var _0x377a51=new ActiveDirectory(_0x4b1dce);_0x377a51[_0xda0a('0xd')](_0x2d1da0,_0x1ec86f,function(_0x1ba75c,_0xc2fd6b){if(_0x1ba75c){logger[_0xda0a('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x2d1da0,util[_0xda0a('0xf')](_0x1ba75c,{'showHidden':![],'depth':null}));_0x1adbee(_0xda0a('0x10'));}else if(!_0xc2fd6b){logger[_0xda0a('0xe')](_0xda0a('0x11'),_0x2d1da0);_0x1adbee(_0xda0a('0x10'));}else{_0x55a46f(_0xc2fd6b);}});}catch(_0xce32d9){_0x1adbee(_0xce32d9);}});}function ActiveDirectoryAuthenticate(_0x38bcd9,_0x379334,_0x51e90d,_0x35e1a0){var _0x36ab1c,_0x4ccb1d;if(!isActiveDirectoryConfigured(config)){logger[_0xda0a('0xe')](_0xda0a('0x12'),_0x379334);return _0x35e1a0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xda0a('0x13')][_0xda0a('0x14')]({'where':{'id':0x1},'attributes':[_0xda0a('0x15'),_0xda0a('0x16')],'raw':!![]})[_0xda0a('0x17')](function(_0x1156cf){_0x36ab1c=_0x1156cf;if(!_0x36ab1c['adSsoEnabled']){logger[_0xda0a('0xe')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x379334);throw new Error(_0xda0a('0x10'));}return _0x38bcd9[_0xda0a('0x14')]({'logging':!![],'attributes':['id',_0xda0a('0x18'),'password',_0xda0a('0x19'),_0xda0a('0x1a'),'disabled','blocked',_0xda0a('0x1b'),_0xda0a('0x1c')],'where':{'name':_0x379334,'role':{'$or':[_0xda0a('0x1d'),_0xda0a('0x1e'),_0xda0a('0x1f')]},'adSsoEnabled':!![]}});})[_0xda0a('0x17')](function(_0x44d88b){if(!_0x44d88b||_0x44d88b&&_0x44d88b[_0xda0a('0x18')]!==_0x379334){throw new Error(_0xda0a('0x10'));}_0x4ccb1d=_0x44d88b;var _0xf80cbe=_0x4ccb1d[_0xda0a('0x18')]+'@'+config[_0xda0a('0x9')]['domain'];return adAuthenticate(config[_0xda0a('0x9')],_0xf80cbe,_0x51e90d);})[_0xda0a('0x17')](function(_0x274d23){if(_0x4ccb1d[_0xda0a('0x20')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x36ab1c['blockDuration']>0x0){if(_0x4ccb1d[_0xda0a('0x21')]){if(moment(_0x4ccb1d['blockedAt'])[_0xda0a('0x22')](_0x36ab1c[_0xda0a('0x16')],_0xda0a('0x23'))>moment()){throw new Error(_0xda0a('0x10'));}return utils[_0xda0a('0x24')](_0x4ccb1d,0x0,![],null)[_0xda0a('0x17')](function(){return utils['getLicense'](_0x4ccb1d);})[_0xda0a('0x17')](function(){return _0x35e1a0(null,_0x4ccb1d);});}else{return utils[_0xda0a('0x25')](_0x4ccb1d)[_0xda0a('0x17')](function(){return _0x35e1a0(null,_0x4ccb1d);});}}else{return utils[_0xda0a('0x25')](_0x4ccb1d)[_0xda0a('0x17')](function(){return _0x35e1a0(null,_0x4ccb1d);});}})['catch'](function(_0x97652f){return _0x35e1a0(null,![],_0x97652f);});}function handleError(_0x324396,_0x401f58,_0x297316){return _0x324396[_0xda0a('0x26')](_0x401f58||0x1f4)['send']({'message':_0x297316?_0x297316[_0xda0a('0x27')]||_0x297316:''});}exports[_0xda0a('0x28')]=function(_0x18814a,_0x2171ea,_0x14679e){passport[_0xda0a('0xd')](_0xda0a('0x29'),function(_0x1895c8,_0x4c1c77,_0x4175e2){var _0x24e8c0=_0x1895c8||_0x4175e2;if(_0x24e8c0){return handleError(_0x2171ea,0x191,_0x24e8c0);}if(!_0x4c1c77){return handleError(_0x2171ea,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4d035b={'payload':{'id':_0x4c1c77['id'],'role':_0x4c1c77['role']},'options':{'expiresIn':0x15180}};return authService[_0xda0a('0x2a')](_0x4d035b)[_0xda0a('0x17')](function(_0x33bc1c){_0x2171ea['json']({'id':_0x4c1c77['id'],'token':_0x33bc1c,'statusCall':'','isAlreadyLogged':_0x4c1c77[_0xda0a('0x1c')]});});}})(_0x18814a,_0x2171ea,_0x14679e);};passport[_0xda0a('0x2b')](_0xda0a('0x29'),new LocalStrategy({'usernameField':_0xda0a('0x18'),'passwordField':_0xda0a('0x2c')},function(_0x5dab76,_0x2540a0,_0x1a418c){return ActiveDirectoryAuthenticate(db['User'],_0x5dab76,_0x2540a0,_0x1a418c);})); \ No newline at end of file +var _0x8c6a=['Something\x20went\x20wrong,\x20please\x20try\x20again.','online','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','url','domain','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','findOne','blockDuration','then','adSsoEnabled','name','password','salt','role','disabled','blocked','blockedAt','user','add','minutes','getLicense','catch','status','send','message','login','ad-login'];(function(_0x77d286,_0x1ddc6d){var _0x5446a5=function(_0x45e2cf){while(--_0x45e2cf){_0x77d286['push'](_0x77d286['shift']());}};_0x5446a5(++_0x1ddc6d);}(_0x8c6a,0x1d0));var _0xa8c6=function(_0x6182ff,_0x59d492){_0x6182ff=_0x6182ff-0x0;var _0x1cec22=_0x8c6a[_0x6182ff];return _0x1cec22;};'use strict';var passport=require(_0xa8c6('0x0'));var LocalStrategy=require(_0xa8c6('0x1'))[_0xa8c6('0x2')];var moment=require(_0xa8c6('0x3'));var ActiveDirectory=require(_0xa8c6('0x4'));var BPromise=require(_0xa8c6('0x5'));var util=require(_0xa8c6('0x6'));var db=require(_0xa8c6('0x7'))['db'];var authService=require(_0xa8c6('0x8'));var utils=require(_0xa8c6('0x9'));var config=require(_0xa8c6('0xa'));var logger=require('../../config/logger')(_0xa8c6('0xb'));function isActiveDirectoryConfigured(_0x202e4f){var _0x4929e5=![];if(typeof _0x202e4f[_0xa8c6('0xc')]!==_0xa8c6('0xd')){_0x4929e5=_0x202e4f['activedirectory'][_0xa8c6('0xe')]&&_0x202e4f[_0xa8c6('0xc')][_0xa8c6('0xf')]&&_0x202e4f['activedirectory'][_0xa8c6('0x10')];}return _0x4929e5;}function adAuthenticate(_0x3af28c,_0x2cde5a,_0x4d73bc){return new BPromise(function(_0x5e5bab,_0x256bad){try{var _0x3f08f3=new ActiveDirectory(_0x3af28c);_0x3f08f3[_0xa8c6('0x11')](_0x2cde5a,_0x4d73bc,function(_0x2718bf,_0x228a8a){if(_0x2718bf){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x2cde5a,util['inspect'](_0x2718bf,{'showHidden':![],'depth':null}));_0x256bad(_0xa8c6('0x12'));}else if(!_0x228a8a){logger[_0xa8c6('0x13')](_0xa8c6('0x14'),_0x2cde5a);_0x256bad(_0xa8c6('0x12'));}else{_0x5e5bab(_0x228a8a);}});}catch(_0x35308d){_0x256bad(_0x35308d);}});}function ActiveDirectoryAuthenticate(_0x47a1e3,_0x32a6be,_0x31a7a0,_0x312b85){var _0x1b7e56,_0x1ff2cd;if(!isActiveDirectoryConfigured(config)){logger[_0xa8c6('0x13')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x32a6be);return _0x312b85(null,![],{'message':_0xa8c6('0x12')});}return db['Setting'][_0xa8c6('0x15')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xa8c6('0x16')],'raw':!![]})[_0xa8c6('0x17')](function(_0x8847e8){_0x1b7e56=_0x8847e8;if(!_0x1b7e56[_0xa8c6('0x18')]){logger[_0xa8c6('0x13')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x32a6be);throw new Error(_0xa8c6('0x12'));}return _0x47a1e3[_0xa8c6('0x15')]({'logging':!![],'attributes':['id',_0xa8c6('0x19'),_0xa8c6('0x1a'),_0xa8c6('0x1b'),_0xa8c6('0x1c'),_0xa8c6('0x1d'),_0xa8c6('0x1e'),_0xa8c6('0x1f'),'online'],'where':{'name':_0x32a6be,'role':{'$or':['admin',_0xa8c6('0x20'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x3626d6){if(!_0x3626d6||_0x3626d6&&_0x3626d6[_0xa8c6('0x19')]!==_0x32a6be){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x1ff2cd=_0x3626d6;var _0x57af90=_0x1ff2cd[_0xa8c6('0x19')]+'@'+config['activedirectory'][_0xa8c6('0x10')];return adAuthenticate(config[_0xa8c6('0xc')],_0x57af90,_0x31a7a0);})['then'](function(_0x405547){if(_0x1ff2cd[_0xa8c6('0x1d')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x1b7e56[_0xa8c6('0x16')]>0x0){if(_0x1ff2cd[_0xa8c6('0x1e')]){if(moment(_0x1ff2cd[_0xa8c6('0x1f')])[_0xa8c6('0x21')](_0x1b7e56[_0xa8c6('0x16')],_0xa8c6('0x22'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x1ff2cd,0x0,![],null)[_0xa8c6('0x17')](function(){return utils[_0xa8c6('0x23')](_0x1ff2cd);})[_0xa8c6('0x17')](function(){return _0x312b85(null,_0x1ff2cd);});}else{return utils[_0xa8c6('0x23')](_0x1ff2cd)['then'](function(){return _0x312b85(null,_0x1ff2cd);});}}else{return utils[_0xa8c6('0x23')](_0x1ff2cd)[_0xa8c6('0x17')](function(){return _0x312b85(null,_0x1ff2cd);});}})[_0xa8c6('0x24')](function(_0x33a607){return _0x312b85(null,![],_0x33a607);});}function handleError(_0x2dd92f,_0x44f39a,_0x2f6927){return _0x2dd92f[_0xa8c6('0x25')](_0x44f39a||0x1f4)[_0xa8c6('0x26')]({'message':_0x2f6927?_0x2f6927[_0xa8c6('0x27')]||_0x2f6927:''});}exports[_0xa8c6('0x28')]=function(_0x5d8f74,_0x279fa6,_0x5bd72c){passport['authenticate'](_0xa8c6('0x29'),function(_0x4f2d27,_0x15301c,_0x8271c1){var _0x4bfa07=_0x4f2d27||_0x8271c1;if(_0x4bfa07){return handleError(_0x279fa6,0x191,_0x4bfa07);}if(!_0x15301c){return handleError(_0x279fa6,0x194,{'message':_0xa8c6('0x2a')});}else{var _0x5c65c1={'payload':{'id':_0x15301c['id'],'role':_0x15301c[_0xa8c6('0x1c')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5c65c1)[_0xa8c6('0x17')](function(_0x1d94c4){_0x279fa6['json']({'id':_0x15301c['id'],'token':_0x1d94c4,'statusCall':'','isAlreadyLogged':_0x15301c[_0xa8c6('0x2b')]});});}})(_0x5d8f74,_0x279fa6,_0x5bd72c);};passport[_0xa8c6('0x2c')](_0xa8c6('0x29'),new LocalStrategy({'usernameField':_0xa8c6('0x19'),'passwordField':_0xa8c6('0x1a')},function(_0x285833,_0x27cce5,_0x41701e){return ActiveDirectoryAuthenticate(db[_0xa8c6('0x2d')],_0x285833,_0x27cce5,_0x41701e);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 43e4a1d..af40cc8 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 _0x8d23=['./authActiveDirectory.controller','post','login','exports'];(function(_0x2bdc1d,_0x2a52aa){var _0x5ab3fc=function(_0xfb4e8){while(--_0xfb4e8){_0x2bdc1d['push'](_0x2bdc1d['shift']());}};_0x5ab3fc(++_0x2a52aa);}(_0x8d23,0x1f0));var _0x38d2=function(_0x28912a,_0x1e5e3d){_0x28912a=_0x28912a-0x0;var _0x1cafd5=_0x8d23[_0x28912a];return _0x1cafd5;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x38d2('0x0'));router[_0x38d2('0x1')]('/',controller[_0x38d2('0x2')]);module[_0x38d2('0x3')]=router; \ No newline at end of file +var _0xe41c=['./authActiveDirectory.controller','login','exports','express'];(function(_0x50bb69,_0xb50dae){var _0x7803e6=function(_0x5cb8d0){while(--_0x5cb8d0){_0x50bb69['push'](_0x50bb69['shift']());}};_0x7803e6(++_0xb50dae);}(_0xe41c,0xab));var _0xce41=function(_0x2c4363,_0x125c18){_0x2c4363=_0x2c4363-0x0;var _0x6e39c=_0xe41c[_0x2c4363];return _0x6e39c;};'use strict';var express=require(_0xce41('0x0'));var router=express['Router']();var controller=require(_0xce41('0x1'));router['post']('/',controller[_0xce41('0x2')]);module[_0xce41('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index a5a843c..47120ae 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x7a54,0x106));var _0x47a5=function(_0x300388,_0x3e78a3){_0x300388=_0x300388-0x0;var _0x163cb9=_0x7a54[_0x300388];return _0x163cb9;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _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(_0x20cc13,_0x1b730f){var _0x5fefe9=function(_0x3e51c5){while(--_0x3e51c5){_0x20cc13['push'](_0x20cc13['shift']());}};_0x5fefe9(++_0x1b730f);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 4131783..14074aa 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 _0x213e=['../../components/auth/service','get','login','callback','isMiddleware','express','passport','Router','../user/user.controller.js'];(function(_0x364754,_0x30a620){var _0x5739ef=function(_0x35acb2){while(--_0x35acb2){_0x364754['push'](_0x364754['shift']());}};_0x5739ef(++_0x30a620);}(_0x213e,0x101));var _0xe213=function(_0x1a407f,_0x37cfaa){_0x1a407f=_0x1a407f-0x0;var _0x56a902=_0x213e[_0x1a407f];return _0x56a902;};'use strict';var express=require(_0xe213('0x0'));var passport=require(_0xe213('0x1'));var router=express[_0xe213('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xe213('0x3'));var authService=require(_0xe213('0x4'));router[_0xe213('0x5')]('/',controller[_0xe213('0x6')]);router[_0xe213('0x5')]('/callback',controller[_0xe213('0x7')],authService[_0xe213('0x8')],userController[_0xe213('0x6')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0x6959=['express','passport','Router','../../components/auth/service','login','get','/callback','isMiddleware','setTokenCookie'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x6959,0x117));var _0x9695=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6959[_0xa464c9];return _0x3d73c4;};'use strict';var express=require(_0x9695('0x0'));var passport=require(_0x9695('0x1'));var router=express[_0x9695('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x9695('0x3'));router['get']('/',controller[_0x9695('0x4')]);router[_0x9695('0x5')](_0x9695('0x6'),controller['callback'],authService[_0x9695('0x7')],userController[_0x9695('0x4')],authService[_0x9695('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index e462212..3c200aa 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 _0x9538=['host','port','secure','authentication','auth','pass','merge','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordHistory','previousPasswords','passwordHistoryLimit','resetPasswordExpires','Password\x20reset!','use','local-login','util','passport-local','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','salt','role','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','blocked','blockDuration','clearBlockUser','disabled','blockedAt','add','minutes','getLicense','catch','MailAccount','email','MailServerOut','service','Smtp'];(function(_0x2197e6,_0x254dc1){var _0xf4c432=function(_0x57767b){while(--_0x57767b){_0x2197e6['push'](_0x2197e6['shift']());}};_0xf4c432(++_0x254dc1);}(_0x9538,0x8c));var _0x8953=function(_0x354c88,_0x2f4a6d){_0x354c88=_0x354c88-0x0;var _0x5c0cd4=_0x9538[_0x354c88];return _0x5c0cd4;};'use strict';var util=require(_0x8953('0x0'));var passport=require('passport');var LocalStrategy=require(_0x8953('0x1'))['Strategy'];var jayson=require(_0x8953('0x2'));var _=require(_0x8953('0x3'));var rs=require(_0x8953('0x4'));var moment=require('moment');var db=require(_0x8953('0x5'))['db'];var authService=require(_0x8953('0x6'));var utils=require('../../config/utils');var client=jayson[_0x8953('0x7')][_0x8953('0x8')]({'port':0x232b});function localAuthenticate(_0x5388dc,_0x507881,_0x366772,_0x35a1d4){var _0x539616,_0x3429c6;return db[_0x8953('0x9')][_0x8953('0xa')]({'where':{'id':0x1},'attributes':[_0x8953('0xb'),'blockDuration'],'raw':!![]})[_0x8953('0xc')](function(_0x4595c5){_0x539616=_0x4595c5;return _0x5388dc[_0x8953('0xa')]({'attributes':['id',_0x8953('0xd'),_0x8953('0xe'),_0x8953('0xf'),_0x8953('0x10'),'disabled','blocked','blockedAt','loginAttempts'],'where':{'name':_0x507881,'role':{'$or':[_0x8953('0x11'),_0x8953('0x12'),_0x8953('0x13')]}}});})[_0x8953('0xc')](function(_0x47bee3){if(!_0x47bee3||_0x47bee3&&_0x47bee3[_0x8953('0xd')]!==_0x507881){throw new Error(_0x8953('0x14'));}else{_0x3429c6=_0x47bee3;return _0x3429c6;}})[_0x8953('0xc')](function(){_0x3429c6['authenticate'](_0x366772,function(_0x5b6d67,_0x39462d){var _0x32cfe5=_0x3429c6[_0x8953('0x15')]+0x1;if(_0x5b6d67){return _0x35a1d4(_0x5b6d67);}else if(!_0x39462d){if(_0x3429c6['disabled']){return _0x35a1d4(null,![],{'message':_0x8953('0x14')});}else if(_0x539616[_0x8953('0xb')]>0x0){if(_0x3429c6[_0x8953('0x16')]){if(_0x539616[_0x8953('0x17')]>0x0){if(moment(_0x3429c6['blockedAt'])['add'](_0x539616[_0x8953('0x17')],'minutes')>moment()){return _0x35a1d4(null,![],{'message':_0x8953('0x14')});}else{return utils[_0x8953('0x18')](_0x3429c6,_0x32cfe5,![],null)[_0x8953('0xc')](function(){return _0x35a1d4(null,![],{'message':_0x8953('0x14')});});}}else{return _0x35a1d4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x32cfe5>=_0x539616['allowedLoginAttempts']){return utils[_0x8953('0x18')](_0x3429c6,0x0,!![],moment())['then'](function(){return _0x35a1d4(null,![],{'message':_0x8953('0x14')});});}else{return utils['clearBlockUser'](_0x3429c6,_0x32cfe5,![],null)[_0x8953('0xc')](function(){return _0x35a1d4(null,![],{'message':_0x8953('0x14')});});}}}else{return _0x35a1d4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3429c6[_0x8953('0x19')]){return _0x35a1d4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x539616[_0x8953('0xb')]>0x0){if(_0x3429c6[_0x8953('0x16')]){if(_0x539616[_0x8953('0x17')]>0x0){if(moment(_0x3429c6[_0x8953('0x1a')])[_0x8953('0x1b')](_0x539616[_0x8953('0x17')],_0x8953('0x1c'))>moment()){return _0x35a1d4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x8953('0x18')](_0x3429c6,0x0,![],null)[_0x8953('0xc')](function(){return utils[_0x8953('0x1d')](_0x3429c6);})[_0x8953('0xc')](function(){return _0x35a1d4(null,_0x3429c6);});}}else{return _0x35a1d4(null,![],{'message':_0x8953('0x14')});}}else{return utils[_0x8953('0x18')](_0x3429c6,0x0,![],null)['then'](function(){return utils[_0x8953('0x1d')](_0x3429c6);})[_0x8953('0xc')](function(){return _0x35a1d4(null,_0x3429c6);})[_0x8953('0x1e')](function(_0x1dd6d3){return _0x35a1d4(null,![],_0x1dd6d3);});}}else{if(_0x3429c6[_0x8953('0x16')]){return _0x35a1d4(null,![],{'message':_0x8953('0x14')});}else{return utils[_0x8953('0x1d')](_0x3429c6)[_0x8953('0xc')](function(){return _0x35a1d4(null,_0x3429c6);});}}}});})[_0x8953('0x1e')](function(_0xd992a5){return _0x35a1d4(null,![],_0xd992a5);});}function sendServiceMail(_0x326f5d){return db[_0x8953('0x1f')]['find']({'where':{'service':!![]},'attributes':['id','name',_0x8953('0x20')],'include':[{'model':db[_0x8953('0x21')],'as':'Smtp'}]})[_0x8953('0xc')](function(_0x13d1e6){if(!_0x13d1e6){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x1d08b3={'tls':{'rejectUnauthorized':![]}};if(_0x13d1e6['Smtp'][_0x8953('0x22')]){_0x1d08b3['service']=_0x13d1e6[_0x8953('0x23')][_0x8953('0x22')];}else{_0x1d08b3[_0x8953('0x24')]=_0x13d1e6[_0x8953('0x23')][_0x8953('0x24')];_0x1d08b3[_0x8953('0x25')]=_0x13d1e6[_0x8953('0x23')]['port'];_0x1d08b3[_0x8953('0x26')]=_0x13d1e6[_0x8953('0x23')][_0x8953('0x26')];}if(_0x13d1e6['Smtp'][_0x8953('0x27')]){_0x1d08b3[_0x8953('0x28')]={'user':_0x13d1e6[_0x8953('0x23')][_0x8953('0x12')],'pass':_0x13d1e6['Smtp'][_0x8953('0x29')]};}var _0x53230c={'account':_0x1d08b3,'message':_[_0x8953('0x2a')]({'from':util['format'](_0x8953('0x2b'),_0x13d1e6[_0x8953('0xd')],_0x13d1e6[_0x8953('0x20')]||_0x13d1e6[_0x8953('0x23')]['user'])},_0x326f5d)};return client[_0x8953('0x2c')](_0x8953('0x2d'),_0x53230c);})['then'](function(_0x4bc986){if(_0x4bc986[_0x8953('0x2e')]){throw new Error(util['format'](_0x8953('0x2f'),_0x4bc986[_0x8953('0x2e')][_0x8953('0x30')]||JSON[_0x8953('0x31')](_0x4bc986['error'])));}return!![];});}function handleError(_0x2d9ac4,_0x27db20,_0x385703){return _0x2d9ac4[_0x8953('0x32')](_0x27db20||0x1f4)[_0x8953('0x33')]({'message':_0x385703?_0x385703[_0x8953('0x30')]||_0x385703:''});}exports[_0x8953('0x34')]=function(_0xd278dc,_0xdf092e,_0x191486){passport[_0x8953('0x35')]('local-login',function(_0x57b453,_0xce4a3f,_0x294e30){var _0xa00bc5=_0x57b453||_0x294e30;if(_0xa00bc5){return handleError(_0xdf092e,0x191,_0xa00bc5);}if(!_0xce4a3f){return handleError(_0xdf092e,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x486a21={'payload':{'id':_0xce4a3f['id'],'role':_0xce4a3f['role']},'options':{'expiresIn':0x15180}};return authService[_0x8953('0x36')](_0x486a21)[_0x8953('0xc')](function(_0x347923){_0xdf092e[_0x8953('0x37')]({'id':_0xce4a3f['id'],'token':_0x347923,'statusCall':'','isAlreadyLogged':_0xce4a3f[_0x8953('0x38')]});});}})(_0xd278dc,_0xdf092e,_0x191486);};exports[_0x8953('0x39')]=function(_0x8716f4,_0x2a76da,_0x1bcc6e){if(!_0x8716f4[_0x8953('0x3a')][_0x8953('0x20')]){return handleError(_0x2a76da,0x1f4,{'message':_0x8953('0x3b')});}var _0x3cc305=rs[_0x8953('0x3c')]();_0x8716f4['body']['email']=_0x8716f4['body'][_0x8953('0x20')][_0x8953('0x3d')]()[_0x8953('0x3e')]();var _0x16cbca;return db[_0x8953('0x9')][_0x8953('0xa')]({'where':{'id':0x1},'attributes':[_0x8953('0xb'),_0x8953('0x17')],'raw':!![]})['then'](function(_0x3d494b){_0x16cbca=_0x3d494b;return db['User'][_0x8953('0x3f')]({'where':{'email':_0x8716f4[_0x8953('0x3a')][_0x8953('0x20')]}});})['then'](function(_0x217aa6){if(!_0x217aa6){throw new Error(_0x8953('0x40'));}if(_0x217aa6[_0x8953('0x19')]){throw new Error(_0x8953('0x41'));}if(_0x217aa6[_0x8953('0x16')]){if(moment(_0x217aa6[_0x8953('0x1a')])[_0x8953('0x1b')](_0x16cbca[_0x8953('0x17')],_0x8953('0x1c'))>moment()){throw new Error(_0x8953('0x42'));}else{_0x217aa6[_0x8953('0x16')]=![];_0x217aa6[_0x8953('0x1a')]=null;}}_0x217aa6[_0x8953('0x43')]=_0x3cc305;_0x217aa6['resetPasswordExpires']=Date[_0x8953('0x44')]()+0x36ee80;return _0x217aa6[_0x8953('0x45')]();})[_0x8953('0xc')](function(){return sendServiceMail({'to':_0x8716f4[_0x8953('0x3a')]['email'],'subject':_0x8953('0x46'),'text':_0x8953('0x47')+_0x8953('0x48')+_0x8953('0x49')+_0x8716f4['headers'][_0x8953('0x24')]+_0x8953('0x4a')+_0x3cc305+'\x0a\x0a'+_0x8953('0x4b')});})[_0x8953('0xc')](function(){_0x2a76da[_0x8953('0x32')](0xc8)[_0x8953('0x33')]({'message':'Reset\x20Email\x20sent!'});})[_0x8953('0x1e')](function(_0x4ebbcc){return handleError(_0x2a76da,0x1f4,_0x4ebbcc);});};exports['reset']=function(_0x357797,_0xcf3132,_0x57c7f8){return db[_0x8953('0x4c')][_0x8953('0x3f')]({'where':{'resetPasswordToken':_0x357797[_0x8953('0x4d')][_0x8953('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x8953('0x44')]()}}})['then'](function(_0x315771){if(!_0x315771){throw new Error(_0x8953('0x4f'));}return db[_0x8953('0x9')][_0x8953('0xa')]({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})[_0x8953('0xc')](function(_0x5f0443){if(_0x5f0443[_0x8953('0x50')])authService['validatePasswordPattern'](_0x357797['body'][_0x8953('0xe')]);if(!_0x5f0443['enforcePasswordHistory']||!_0x315771['previousPasswords'])return _0x315771;authService[_0x8953('0x51')](_0x357797[_0x8953('0x3a')]['password'],_0x315771[_0x8953('0x52')],_0x5f0443[_0x8953('0x53')]);return _0x315771;})[_0x8953('0xc')](function(){_0x315771[_0x8953('0xe')]=_0x357797['body']['password'];_0x315771[_0x8953('0x43')]=null;_0x315771[_0x8953('0x54')]=null;return _0x315771[_0x8953('0x45')]();});})['then'](function(){_0xcf3132['status'](0xc8)[_0x8953('0x33')]({'message':_0x8953('0x55')});})[_0x8953('0x1e')](function(_0x34ab30){return handleError(_0xcf3132,0x1f4,_0x34ab30);});};passport[_0x8953('0x56')](_0x8953('0x57'),new LocalStrategy({'usernameField':_0x8953('0xd'),'passwordField':_0x8953('0xe')},function(_0x1e0aec,_0x4d735d,_0x13f04c){return localAuthenticate(db[_0x8953('0x4c')],_0x1e0aec,_0x4d735d,_0x13f04c);})); \ No newline at end of file +var _0x561a=['moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','password','disabled','blocked','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','merge','format','request','error','message','stringify','status','send','login','role','signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','User','util','passport','Strategy','jayson/promise','lodash'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x561a,0x157));var _0xa561=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0x561a[_0x1b64dd];return _0xeb464c;};'use strict';var util=require(_0xa561('0x0'));var passport=require(_0xa561('0x1'));var LocalStrategy=require('passport-local')[_0xa561('0x2')];var jayson=require(_0xa561('0x3'));var _=require(_0xa561('0x4'));var rs=require('randomstring');var moment=require(_0xa561('0x5'));var db=require(_0xa561('0x6'))['db'];var authService=require(_0xa561('0x7'));var utils=require(_0xa561('0x8'));var client=jayson[_0xa561('0x9')][_0xa561('0xa')]({'port':0x232b});function localAuthenticate(_0x6f0c22,_0x2c1077,_0x5951f8,_0x25743){var _0x2fa5ee,_0x47c60d;return db[_0xa561('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0xa561('0xc'),_0xa561('0xd')],'raw':!![]})[_0xa561('0xe')](function(_0x3a2fb6){_0x2fa5ee=_0x3a2fb6;return _0x6f0c22[_0xa561('0xf')]({'attributes':['id',_0xa561('0x10'),_0xa561('0x11'),'salt','role',_0xa561('0x12'),_0xa561('0x13'),'blockedAt',_0xa561('0x14')],'where':{'name':_0x2c1077,'role':{'$or':[_0xa561('0x15'),_0xa561('0x16'),_0xa561('0x17')]}}});})[_0xa561('0xe')](function(_0x2df5b2){if(!_0x2df5b2||_0x2df5b2&&_0x2df5b2[_0xa561('0x10')]!==_0x2c1077){throw new Error(_0xa561('0x18'));}else{_0x47c60d=_0x2df5b2;return _0x47c60d;}})[_0xa561('0xe')](function(){_0x47c60d[_0xa561('0x19')](_0x5951f8,function(_0x5ebd14,_0x4223ec){var _0x5845ac=_0x47c60d[_0xa561('0x14')]+0x1;if(_0x5ebd14){return _0x25743(_0x5ebd14);}else if(!_0x4223ec){if(_0x47c60d[_0xa561('0x12')]){return _0x25743(null,![],{'message':_0xa561('0x18')});}else if(_0x2fa5ee[_0xa561('0xc')]>0x0){if(_0x47c60d[_0xa561('0x13')]){if(_0x2fa5ee[_0xa561('0xd')]>0x0){if(moment(_0x47c60d[_0xa561('0x1a')])[_0xa561('0x1b')](_0x2fa5ee[_0xa561('0xd')],_0xa561('0x1c'))>moment()){return _0x25743(null,![],{'message':_0xa561('0x18')});}else{return utils[_0xa561('0x1d')](_0x47c60d,_0x5845ac,![],null)['then'](function(){return _0x25743(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x25743(null,![],{'message':_0xa561('0x18')});}}else{if(_0x5845ac>=_0x2fa5ee[_0xa561('0xc')]){return utils[_0xa561('0x1d')](_0x47c60d,0x0,!![],moment())[_0xa561('0xe')](function(){return _0x25743(null,![],{'message':_0xa561('0x18')});});}else{return utils['clearBlockUser'](_0x47c60d,_0x5845ac,![],null)[_0xa561('0xe')](function(){return _0x25743(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x25743(null,![],{'message':_0xa561('0x18')});}}else{if(_0x47c60d[_0xa561('0x12')]){return _0x25743(null,![],{'message':_0xa561('0x18')});}else if(_0x2fa5ee[_0xa561('0xc')]>0x0){if(_0x47c60d[_0xa561('0x13')]){if(_0x2fa5ee[_0xa561('0xd')]>0x0){if(moment(_0x47c60d[_0xa561('0x1a')])[_0xa561('0x1b')](_0x2fa5ee[_0xa561('0xd')],_0xa561('0x1c'))>moment()){return _0x25743(null,![],{'message':_0xa561('0x18')});}else{return utils['clearBlockUser'](_0x47c60d,0x0,![],null)[_0xa561('0xe')](function(){return utils[_0xa561('0x1e')](_0x47c60d);})[_0xa561('0xe')](function(){return _0x25743(null,_0x47c60d);});}}else{return _0x25743(null,![],{'message':_0xa561('0x18')});}}else{return utils[_0xa561('0x1d')](_0x47c60d,0x0,![],null)['then'](function(){return utils['getLicense'](_0x47c60d);})['then'](function(){return _0x25743(null,_0x47c60d);})[_0xa561('0x1f')](function(_0x5e4c4c){return _0x25743(null,![],_0x5e4c4c);});}}else{if(_0x47c60d[_0xa561('0x13')]){return _0x25743(null,![],{'message':_0xa561('0x18')});}else{return utils[_0xa561('0x1e')](_0x47c60d)[_0xa561('0xe')](function(){return _0x25743(null,_0x47c60d);});}}}});})[_0xa561('0x1f')](function(_0x3fb81f){return _0x25743(null,![],_0x3fb81f);});}function sendServiceMail(_0x233ee7){return db[_0xa561('0x20')][_0xa561('0x21')]({'where':{'service':!![]},'attributes':['id',_0xa561('0x10'),_0xa561('0x22')],'include':[{'model':db[_0xa561('0x23')],'as':'Smtp'}]})[_0xa561('0xe')](function(_0x588b3e){if(!_0x588b3e){throw new Error(_0xa561('0x24'));}var _0x5bdbdc={'tls':{'rejectUnauthorized':![]}};if(_0x588b3e[_0xa561('0x25')][_0xa561('0x26')]){_0x5bdbdc[_0xa561('0x26')]=_0x588b3e[_0xa561('0x25')][_0xa561('0x26')];}else{_0x5bdbdc[_0xa561('0x27')]=_0x588b3e[_0xa561('0x25')][_0xa561('0x27')];_0x5bdbdc[_0xa561('0x28')]=_0x588b3e['Smtp'][_0xa561('0x28')];_0x5bdbdc[_0xa561('0x29')]=_0x588b3e['Smtp'][_0xa561('0x29')];}if(_0x588b3e[_0xa561('0x25')][_0xa561('0x2a')]){_0x5bdbdc[_0xa561('0x2b')]={'user':_0x588b3e[_0xa561('0x25')]['user'],'pass':_0x588b3e[_0xa561('0x25')]['pass']};}var _0x28e3e1={'account':_0x5bdbdc,'message':_[_0xa561('0x2c')]({'from':util[_0xa561('0x2d')]('\x22%s\x22\x20<%s>',_0x588b3e[_0xa561('0x10')],_0x588b3e[_0xa561('0x22')]||_0x588b3e[_0xa561('0x25')][_0xa561('0x16')])},_0x233ee7)};return client[_0xa561('0x2e')]('SendMail',_0x28e3e1);})['then'](function(_0x2b0c2d){if(_0x2b0c2d[_0xa561('0x2f')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x2b0c2d[_0xa561('0x2f')][_0xa561('0x30')]||JSON[_0xa561('0x31')](_0x2b0c2d[_0xa561('0x2f')])));}return!![];});}function handleError(_0xe0db0d,_0x433d89,_0x2f1df5){return _0xe0db0d[_0xa561('0x32')](_0x433d89||0x1f4)[_0xa561('0x33')]({'message':_0x2f1df5?_0x2f1df5[_0xa561('0x30')]||_0x2f1df5:''});}exports[_0xa561('0x34')]=function(_0x324ad0,_0x406400,_0x569d16){passport[_0xa561('0x19')]('local-login',function(_0x4397e0,_0xb32d9a,_0x307f4c){var _0x5ac6e2=_0x4397e0||_0x307f4c;if(_0x5ac6e2){return handleError(_0x406400,0x191,_0x5ac6e2);}if(!_0xb32d9a){return handleError(_0x406400,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x5185d0={'payload':{'id':_0xb32d9a['id'],'role':_0xb32d9a[_0xa561('0x35')]},'options':{'expiresIn':0x15180}};return authService[_0xa561('0x36')](_0x5185d0)[_0xa561('0xe')](function(_0x3663c2){_0x406400[_0xa561('0x37')]({'id':_0xb32d9a['id'],'token':_0x3663c2,'statusCall':'','isAlreadyLogged':_0xb32d9a[_0xa561('0x38')]});});}})(_0x324ad0,_0x406400,_0x569d16);};exports['forgot']=function(_0x2d7984,_0x5d3863,_0x1a119c){if(!_0x2d7984[_0xa561('0x39')][_0xa561('0x22')]){return handleError(_0x5d3863,0x1f4,{'message':_0xa561('0x3a')});}var _0x4405a3=rs[_0xa561('0x3b')]();_0x2d7984[_0xa561('0x39')][_0xa561('0x22')]=_0x2d7984[_0xa561('0x39')][_0xa561('0x22')][_0xa561('0x3c')]()[_0xa561('0x3d')]();var _0x123f11;return db[_0xa561('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0xa561('0xc'),_0xa561('0xd')],'raw':!![]})[_0xa561('0xe')](function(_0x212c88){_0x123f11=_0x212c88;return db['User']['find']({'where':{'email':_0x2d7984[_0xa561('0x39')][_0xa561('0x22')]}});})[_0xa561('0xe')](function(_0x148194){if(!_0x148194){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x148194[_0xa561('0x12')]){throw new Error(_0xa561('0x3e'));}if(_0x148194[_0xa561('0x13')]){if(moment(_0x148194['blockedAt'])[_0xa561('0x1b')](_0x123f11['blockDuration'],_0xa561('0x1c'))>moment()){throw new Error(_0xa561('0x3f'));}else{_0x148194[_0xa561('0x13')]=![];_0x148194[_0xa561('0x1a')]=null;}}_0x148194[_0xa561('0x40')]=_0x4405a3;_0x148194[_0xa561('0x41')]=Date[_0xa561('0x42')]()+0x36ee80;return _0x148194['save']();})[_0xa561('0xe')](function(){return sendServiceMail({'to':_0x2d7984[_0xa561('0x39')][_0xa561('0x22')],'subject':_0xa561('0x43'),'text':_0xa561('0x44')+_0xa561('0x45')+_0xa561('0x46')+_0x2d7984['headers']['host']+_0xa561('0x47')+_0x4405a3+'\x0a\x0a'+_0xa561('0x48')});})[_0xa561('0xe')](function(){_0x5d3863[_0xa561('0x32')](0xc8)[_0xa561('0x33')]({'message':_0xa561('0x49')});})[_0xa561('0x1f')](function(_0x575d08){return handleError(_0x5d3863,0x1f4,_0x575d08);});};exports[_0xa561('0x4a')]=function(_0x28b539,_0x2a529d,_0x110a2f){return db['User']['find']({'where':{'resetPasswordToken':_0x28b539[_0xa561('0x4b')][_0xa561('0x4c')],'resetPasswordExpires':{'$gt':Date[_0xa561('0x42')]()}}})[_0xa561('0xe')](function(_0x38323c){if(!_0x38323c){throw new Error(_0xa561('0x4d'));}return db['Setting'][_0xa561('0xf')]({'attributes':['id',_0xa561('0x4e'),_0xa561('0x4f'),_0xa561('0x50')]})[_0xa561('0xe')](function(_0x53a8ba){if(_0x53a8ba[_0xa561('0x4e')])authService[_0xa561('0x51')](_0x28b539[_0xa561('0x39')][_0xa561('0x11')]);if(!_0x53a8ba[_0xa561('0x4f')]||!_0x38323c[_0xa561('0x52')])return _0x38323c;authService[_0xa561('0x53')](_0x28b539[_0xa561('0x39')]['password'],_0x38323c[_0xa561('0x52')],_0x53a8ba[_0xa561('0x50')]);return _0x38323c;})[_0xa561('0xe')](function(){_0x38323c[_0xa561('0x11')]=_0x28b539[_0xa561('0x39')][_0xa561('0x11')];_0x38323c['resetPasswordToken']=null;_0x38323c[_0xa561('0x41')]=null;return _0x38323c['save']();});})[_0xa561('0xe')](function(){_0x2a529d[_0xa561('0x32')](0xc8)[_0xa561('0x33')]({'message':_0xa561('0x54')});})['catch'](function(_0x2fce6b){return handleError(_0x2a529d,0x1f4,_0x2fce6b);});};passport[_0xa561('0x55')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x547cd3,_0x13c1c7,_0x7a7855){return localAuthenticate(db[_0xa561('0x56')],_0x547cd3,_0x13c1c7,_0x7a7855);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index c053d6e..6411b2e 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 _0x55d1=['forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','post','login','/forgot'];(function(_0x5f46f4,_0x508aef){var _0x5d91b4=function(_0x6054e5){while(--_0x6054e5){_0x5f46f4['push'](_0x5f46f4['shift']());}};_0x5d91b4(++_0x508aef);}(_0x55d1,0xfe));var _0x155d=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0x55d1[_0x2b31a8];return _0x1175a5;};'use strict';var express=require(_0x155d('0x0'));var router=express[_0x155d('0x1')]();var controller=require(_0x155d('0x2'));router[_0x155d('0x3')]('/',controller[_0x155d('0x4')]);router['post'](_0x155d('0x5'),controller[_0x155d('0x6')]);router[_0x155d('0x3')](_0x155d('0x7'),controller[_0x155d('0x8')]);module[_0x155d('0x9')]=router; \ No newline at end of file +var _0xa771=['post','login','/forgot','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller'];(function(_0x157624,_0x3ee799){var _0x517e0c=function(_0x21c462){while(--_0x21c462){_0x157624['push'](_0x157624['shift']());}};_0x517e0c(++_0x3ee799);}(_0xa771,0x133));var _0x1a77=function(_0x207b22,_0xe58886){_0x207b22=_0x207b22-0x0;var _0x3507c9=_0xa771[_0x207b22];return _0x3507c9;};'use strict';var express=require(_0x1a77('0x0'));var router=express[_0x1a77('0x1')]();var controller=require(_0x1a77('0x2'));router[_0x1a77('0x3')]('/',controller[_0x1a77('0x4')]);router['post'](_0x1a77('0x5'),controller[_0x1a77('0x6')]);router[_0x1a77('0x3')](_0x1a77('0x7'),controller[_0x1a77('0x8')]);module[_0x1a77('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index b6b6867..4788476 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 _0x7349=['sequelize','STRING'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x7349,0xae));var _0x9734=function(_0x53a380,_0xea2dd6){_0x53a380=_0x53a380-0x0;var _0x461cf4=_0x7349[_0x53a380];return _0x461cf4;};'use strict';var Sequelize=require(_0x9734('0x0'));module['exports']={'name':{'type':Sequelize[_0x9734('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9734('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x0464=['INTEGER','exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0464,0xd6));var _0x4046=function(_0x2a3a06,_0x6a5fd){_0x2a3a06=_0x2a3a06-0x0;var _0x57dcda=_0x0464[_0x2a3a06];return _0x57dcda;};'use strict';var Sequelize=require('sequelize');module[_0x4046('0x0')]={'name':{'type':Sequelize[_0x4046('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x4046('0x1')]},'description':{'type':Sequelize[_0x4046('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x4046('0x2')],'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 e708df4..790b3d1 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 _0xddd8=['map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','destroy','addConditions','Condition','ids','getConditions','findOne','pick','merge','addActions','Action','getActions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','offset','count','limit','set','apply','reject','save','update','then','error','stack','name','send','index','Automation','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','nolimit','order','sort','filter','where'];(function(_0x5e8203,_0x22ab4e){var _0x389591=function(_0x2977ed){while(--_0x2977ed){_0x5e8203['push'](_0x5e8203['shift']());}};_0x389591(++_0x22ab4e);}(_0xddd8,0x1c8));var _0x8ddd=function(_0x5c797b,_0x1b107d){_0x5c797b=_0x5c797b-0x0;var _0x381185=_0xddd8[_0x5c797b];return _0x381185;};'use strict';var emlformat=require(_0x8ddd('0x0'));var rimraf=require(_0x8ddd('0x1'));var zipdir=require(_0x8ddd('0x2'));var jsonpatch=require(_0x8ddd('0x3'));var rp=require(_0x8ddd('0x4'));var moment=require(_0x8ddd('0x5'));var BPromise=require(_0x8ddd('0x6'));var Mustache=require(_0x8ddd('0x7'));var util=require('util');var path=require(_0x8ddd('0x8'));var sox=require(_0x8ddd('0x9'));var csv=require(_0x8ddd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ddd('0xb'));var _=require('lodash');var squel=require(_0x8ddd('0xc'));var crypto=require(_0x8ddd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8ddd('0xe'));var toCsv=require(_0x8ddd('0xa'));var querystring=require('querystring');var Papa=require(_0x8ddd('0xf'));var Redis=require(_0x8ddd('0x10'));var authService=require(_0x8ddd('0x11'));var qs=require(_0x8ddd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ddd('0x13'))(_0x8ddd('0x14'));var utils=require(_0x8ddd('0x15'));var config=require(_0x8ddd('0x16'));var licenseUtil=require(_0x8ddd('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf6ce3c,_0xed47a1){_0xed47a1=_0xed47a1||0xcc;return function(_0x5eddb0){if(_0x5eddb0){return _0xf6ce3c[_0x8ddd('0x18')](_0xed47a1);}return _0xf6ce3c[_0x8ddd('0x19')](_0xed47a1)[_0x8ddd('0x1a')]();};}function respondWithResult(_0x1b1a96,_0x181afa){_0x181afa=_0x181afa||0xc8;return function(_0x5ea256){if(_0x5ea256){return _0x1b1a96[_0x8ddd('0x19')](_0x181afa)[_0x8ddd('0x1b')](_0x5ea256);}};}function respondWithFilteredResult(_0x37ea23,_0x16e025){return function(_0x45087e){if(_0x45087e){var _0x346135=typeof _0x16e025['offset']==='undefined'&&typeof _0x16e025['limit']===_0x8ddd('0x1c');var _0x2b3e8a=_0x45087e['count'];var _0x43ae81=_0x346135?0x0:_0x16e025[_0x8ddd('0x1d')];var _0x611481=_0x346135?_0x45087e[_0x8ddd('0x1e')]:_0x16e025[_0x8ddd('0x1d')]+_0x16e025[_0x8ddd('0x1f')];var _0x4a3766;if(_0x611481>=_0x2b3e8a){_0x611481=_0x2b3e8a;_0x4a3766=0xc8;}else{_0x4a3766=0xce;}_0x37ea23[_0x8ddd('0x19')](_0x4a3766);return _0x37ea23[_0x8ddd('0x20')]('Content-Range',_0x43ae81+'-'+_0x611481+'/'+_0x2b3e8a)[_0x8ddd('0x1b')](_0x45087e);}return null;};}function patchUpdates(_0x579b84){return function(_0x33c275){try{jsonpatch[_0x8ddd('0x21')](_0x33c275,_0x579b84,!![]);}catch(_0x193760){return BPromise[_0x8ddd('0x22')](_0x193760);}return _0x33c275[_0x8ddd('0x23')]();};}function saveUpdates(_0x1ae522,_0x3566ad){return function(_0x2f9005){if(_0x2f9005){return _0x2f9005[_0x8ddd('0x24')](_0x1ae522)[_0x8ddd('0x25')](function(_0xf2bb93){return _0xf2bb93;});}return null;};}function removeEntity(_0xf686dc,_0x10e1d7){return function(_0x32528f){if(_0x32528f){return _0x32528f['destroy']()[_0x8ddd('0x25')](function(){_0xf686dc[_0x8ddd('0x19')](0xcc)[_0x8ddd('0x1a')]();});}};}function handleEntityNotFound(_0x472450,_0x55b488){return function(_0xf212d){if(!_0xf212d){_0x472450[_0x8ddd('0x18')](0x194);}return _0xf212d;};}function handleError(_0x5acc6e,_0x1341f9){_0x1341f9=_0x1341f9||0x1f4;return function(_0x153cb5){logger[_0x8ddd('0x26')](_0x153cb5[_0x8ddd('0x27')]);if(_0x153cb5[_0x8ddd('0x28')]){delete _0x153cb5[_0x8ddd('0x28')];}_0x5acc6e[_0x8ddd('0x19')](_0x1341f9)[_0x8ddd('0x29')](_0x153cb5);};}exports[_0x8ddd('0x2a')]=function(_0x4c9c2b,_0x55543d){var _0x37c4f0={},_0x5892c3={},_0x5101cc={'count':0x0,'rows':[]};var _0x49fbdc=_['map'](db[_0x8ddd('0x2b')][_0x8ddd('0x2c')],function(_0xb36e05){return{'name':_0xb36e05[_0x8ddd('0x2d')],'type':_0xb36e05[_0x8ddd('0x2e')][_0x8ddd('0x2f')]};});_0x5892c3[_0x8ddd('0x30')]=_['map'](_0x49fbdc,_0x8ddd('0x28'));_0x5892c3['query']=_['keys'](_0x4c9c2b['query']);_0x5892c3[_0x8ddd('0x31')]=_[_0x8ddd('0x32')](_0x5892c3['model'],_0x5892c3[_0x8ddd('0x33')]);_0x37c4f0[_0x8ddd('0x34')]=_[_0x8ddd('0x32')](_0x5892c3[_0x8ddd('0x30')],qs[_0x8ddd('0x35')](_0x4c9c2b['query'][_0x8ddd('0x35')]));_0x37c4f0[_0x8ddd('0x34')]=_0x37c4f0[_0x8ddd('0x34')][_0x8ddd('0x36')]?_0x37c4f0[_0x8ddd('0x34')]:_0x5892c3['model'];if(!_0x4c9c2b[_0x8ddd('0x33')]['hasOwnProperty'](_0x8ddd('0x37'))){_0x37c4f0['limit']=qs['limit'](_0x4c9c2b['query'][_0x8ddd('0x1f')]);_0x37c4f0[_0x8ddd('0x1d')]=qs['offset'](_0x4c9c2b[_0x8ddd('0x33')][_0x8ddd('0x1d')]);}_0x37c4f0[_0x8ddd('0x38')]=qs[_0x8ddd('0x39')](_0x4c9c2b[_0x8ddd('0x33')][_0x8ddd('0x39')]);_0x37c4f0['where']=qs[_0x8ddd('0x31')](_['pick'](_0x4c9c2b[_0x8ddd('0x33')],_0x5892c3[_0x8ddd('0x31')]),_0x49fbdc);if(_0x4c9c2b[_0x8ddd('0x33')][_0x8ddd('0x3a')]){_0x37c4f0[_0x8ddd('0x3b')]=_['merge'](_0x37c4f0[_0x8ddd('0x3b')],{'$or':_[_0x8ddd('0x3c')](_0x49fbdc,function(_0x3f318a){if(_0x3f318a[_0x8ddd('0x2e')]!==_0x8ddd('0x3d')){var _0x219999={};_0x219999[_0x3f318a[_0x8ddd('0x28')]]={'$like':'%'+_0x4c9c2b[_0x8ddd('0x33')][_0x8ddd('0x3a')]+'%'};return _0x219999;}})});}_0x37c4f0=_['merge']({},_0x37c4f0,_0x4c9c2b[_0x8ddd('0x3e')]);var _0x7b755e={'where':_0x37c4f0['where']};return db[_0x8ddd('0x2b')][_0x8ddd('0x1e')](_0x7b755e)[_0x8ddd('0x25')](function(_0x3dd0b4){_0x5101cc[_0x8ddd('0x1e')]=_0x3dd0b4;if(_0x4c9c2b[_0x8ddd('0x33')][_0x8ddd('0x3f')]){_0x37c4f0[_0x8ddd('0x40')]=[{'all':!![]}];}return db['Automation'][_0x8ddd('0x41')](_0x37c4f0);})[_0x8ddd('0x25')](function(_0x4fff1c){_0x5101cc[_0x8ddd('0x42')]=_0x4fff1c;return _0x5101cc;})[_0x8ddd('0x25')](respondWithFilteredResult(_0x55543d,_0x37c4f0))['catch'](handleError(_0x55543d,null));};exports[_0x8ddd('0x43')]=function(_0x174362,_0x474247){var _0x22719f={'raw':![],'where':{'id':_0x174362[_0x8ddd('0x44')]['id']}},_0x836fd8={};_0x836fd8['model']=_[_0x8ddd('0x45')](db[_0x8ddd('0x2b')]['rawAttributes']);_0x836fd8[_0x8ddd('0x33')]=_[_0x8ddd('0x45')](_0x174362[_0x8ddd('0x33')]);_0x836fd8[_0x8ddd('0x31')]=_[_0x8ddd('0x32')](_0x836fd8[_0x8ddd('0x30')],_0x836fd8[_0x8ddd('0x33')]);_0x22719f[_0x8ddd('0x34')]=_[_0x8ddd('0x32')](_0x836fd8['model'],qs[_0x8ddd('0x35')](_0x174362[_0x8ddd('0x33')]['fields']));_0x22719f[_0x8ddd('0x34')]=_0x22719f[_0x8ddd('0x34')]['length']?_0x22719f['attributes']:_0x836fd8[_0x8ddd('0x30')];if(_0x174362[_0x8ddd('0x33')][_0x8ddd('0x3f')]){_0x22719f[_0x8ddd('0x40')]=[{'all':!![]}];}_0x22719f=_['merge']({},_0x22719f,_0x174362[_0x8ddd('0x3e')]);return db['Automation']['find'](_0x22719f)['then'](handleEntityNotFound(_0x474247,null))['then'](respondWithResult(_0x474247,null))[_0x8ddd('0x46')](handleError(_0x474247,null));};exports[_0x8ddd('0x47')]=function(_0x2c4a7f,_0x168cb1){return db['Automation'][_0x8ddd('0x47')](_0x2c4a7f[_0x8ddd('0x48')],{})['then'](respondWithResult(_0x168cb1,0xc9))[_0x8ddd('0x46')](handleError(_0x168cb1,null));};exports[_0x8ddd('0x24')]=function(_0x867af1,_0x55cc37){if(_0x867af1['body']['id']){delete _0x867af1['body']['id'];}return db[_0x8ddd('0x2b')][_0x8ddd('0x49')]({'where':{'id':_0x867af1[_0x8ddd('0x44')]['id']}})['then'](handleEntityNotFound(_0x55cc37,null))[_0x8ddd('0x25')](saveUpdates(_0x867af1[_0x8ddd('0x48')],null))[_0x8ddd('0x25')](respondWithResult(_0x55cc37,null))['catch'](handleError(_0x55cc37,null));};exports[_0x8ddd('0x4a')]=function(_0x27fe28,_0x294184){return db[_0x8ddd('0x2b')][_0x8ddd('0x49')]({'where':{'id':_0x27fe28['params']['id']}})[_0x8ddd('0x25')](handleEntityNotFound(_0x294184,null))[_0x8ddd('0x25')](removeEntity(_0x294184,null))[_0x8ddd('0x46')](handleError(_0x294184,null));};exports[_0x8ddd('0x4b')]=function(_0x80345e,_0x311833,_0x1ade56){return db[_0x8ddd('0x4c')]['find']({'where':{'id':_0x80345e[_0x8ddd('0x44')]['id']}})[_0x8ddd('0x25')](handleEntityNotFound(_0x311833,null))['then'](function(_0x25e455){if(_0x25e455){return _0x25e455[_0x8ddd('0x4b')](_0x80345e[_0x8ddd('0x48')]['ids'],_['omit'](_0x80345e[_0x8ddd('0x48')],[_0x8ddd('0x4d'),'id'])||{});}})[_0x8ddd('0x25')](respondWithResult(_0x311833,null))[_0x8ddd('0x46')](handleError(_0x311833,null));};exports[_0x8ddd('0x4e')]=function(_0x353b7c,_0x487648,_0xd8dff9){var _0x417524={};var _0x6261bd={};var _0x44c26d;var _0x17f44b;return db[_0x8ddd('0x2b')][_0x8ddd('0x4f')]({'where':{'id':_0x353b7c['params']['id']}})[_0x8ddd('0x25')](handleEntityNotFound(_0x487648,null))[_0x8ddd('0x25')](function(_0xd473ac){if(_0xd473ac){_0x44c26d=_0xd473ac;_0x6261bd[_0x8ddd('0x30')]=_[_0x8ddd('0x45')](db[_0x8ddd('0x4c')][_0x8ddd('0x2c')]);_0x6261bd[_0x8ddd('0x33')]=_[_0x8ddd('0x45')](_0x353b7c[_0x8ddd('0x33')]);_0x6261bd[_0x8ddd('0x31')]=_[_0x8ddd('0x32')](_0x6261bd[_0x8ddd('0x30')],_0x6261bd[_0x8ddd('0x33')]);_0x417524[_0x8ddd('0x34')]=_[_0x8ddd('0x32')](_0x6261bd[_0x8ddd('0x30')],qs[_0x8ddd('0x35')](_0x353b7c[_0x8ddd('0x33')][_0x8ddd('0x35')]));_0x417524[_0x8ddd('0x34')]=_0x417524[_0x8ddd('0x34')][_0x8ddd('0x36')]?_0x417524[_0x8ddd('0x34')]:_0x6261bd[_0x8ddd('0x30')];_0x417524[_0x8ddd('0x38')]=qs[_0x8ddd('0x39')](_0x353b7c['query'][_0x8ddd('0x39')]);_0x417524[_0x8ddd('0x3b')]=qs[_0x8ddd('0x31')](_[_0x8ddd('0x50')](_0x353b7c[_0x8ddd('0x33')],_0x6261bd['filters']));if(_0x353b7c[_0x8ddd('0x33')][_0x8ddd('0x3a')]){_0x417524['where']=_[_0x8ddd('0x51')](_0x417524['where'],{'$or':_[_0x8ddd('0x3c')](_0x417524[_0x8ddd('0x34')],function(_0x129dbd){var _0x633cdf={};_0x633cdf[_0x129dbd]={'$like':'%'+_0x353b7c[_0x8ddd('0x33')][_0x8ddd('0x3a')]+'%'};return _0x633cdf;})});}_0x417524=_[_0x8ddd('0x51')]({},_0x417524,_0x353b7c['options']);return _0x44c26d[_0x8ddd('0x4e')](_0x417524);}})[_0x8ddd('0x25')](function(_0x451247){if(_0x451247){_0x17f44b=_0x451247[_0x8ddd('0x36')];if(!_0x353b7c[_0x8ddd('0x33')]['hasOwnProperty']('nolimit')){_0x417524['limit']=qs[_0x8ddd('0x1f')](_0x353b7c[_0x8ddd('0x33')][_0x8ddd('0x1f')]);_0x417524[_0x8ddd('0x1d')]=qs[_0x8ddd('0x1d')](_0x353b7c[_0x8ddd('0x33')]['offset']);}return _0x44c26d[_0x8ddd('0x4e')](_0x417524);}})[_0x8ddd('0x25')](function(_0x57f235){if(_0x57f235){return _0x57f235?{'count':_0x17f44b,'rows':_0x57f235}:null;}})[_0x8ddd('0x25')](respondWithResult(_0x487648,null))['catch'](handleError(_0x487648,null));};exports[_0x8ddd('0x52')]=function(_0x1c3746,_0x47bf49,_0x3b8723){return db[_0x8ddd('0x53')]['find']({'where':{'id':_0x1c3746[_0x8ddd('0x44')]['id']}})[_0x8ddd('0x25')](handleEntityNotFound(_0x47bf49,null))[_0x8ddd('0x25')](function(_0x405c15){if(_0x405c15){return _0x405c15['addActions'](_0x1c3746[_0x8ddd('0x48')]['ids'],_['omit'](_0x1c3746[_0x8ddd('0x48')],[_0x8ddd('0x4d'),'id'])||{});}})[_0x8ddd('0x25')](respondWithResult(_0x47bf49,null))[_0x8ddd('0x46')](handleError(_0x47bf49,null));};exports[_0x8ddd('0x54')]=function(_0x4e9335,_0x81774,_0x5df607){var _0x5c0d78={};var _0x2f2226={};var _0x2638b7;var _0x582e45;return db[_0x8ddd('0x2b')]['findOne']({'where':{'id':_0x4e9335[_0x8ddd('0x44')]['id']}})[_0x8ddd('0x25')](handleEntityNotFound(_0x81774,null))['then'](function(_0x6df981){if(_0x6df981){_0x2638b7=_0x6df981;_0x2f2226['model']=_[_0x8ddd('0x45')](db[_0x8ddd('0x53')][_0x8ddd('0x2c')]);_0x2f2226['query']=_[_0x8ddd('0x45')](_0x4e9335[_0x8ddd('0x33')]);_0x2f2226[_0x8ddd('0x31')]=_['intersection'](_0x2f2226['model'],_0x2f2226[_0x8ddd('0x33')]);_0x5c0d78[_0x8ddd('0x34')]=_['intersection'](_0x2f2226['model'],qs[_0x8ddd('0x35')](_0x4e9335[_0x8ddd('0x33')]['fields']));_0x5c0d78[_0x8ddd('0x34')]=_0x5c0d78[_0x8ddd('0x34')][_0x8ddd('0x36')]?_0x5c0d78['attributes']:_0x2f2226[_0x8ddd('0x30')];_0x5c0d78[_0x8ddd('0x38')]=qs['sort'](_0x4e9335[_0x8ddd('0x33')][_0x8ddd('0x39')]);_0x5c0d78[_0x8ddd('0x3b')]=qs['filters'](_['pick'](_0x4e9335[_0x8ddd('0x33')],_0x2f2226[_0x8ddd('0x31')]));if(_0x4e9335[_0x8ddd('0x33')][_0x8ddd('0x3a')]){_0x5c0d78[_0x8ddd('0x3b')]=_[_0x8ddd('0x51')](_0x5c0d78[_0x8ddd('0x3b')],{'$or':_[_0x8ddd('0x3c')](_0x5c0d78['attributes'],function(_0x554323){var _0x44eb59={};_0x44eb59[_0x554323]={'$like':'%'+_0x4e9335[_0x8ddd('0x33')][_0x8ddd('0x3a')]+'%'};return _0x44eb59;})});}_0x5c0d78=_[_0x8ddd('0x51')]({},_0x5c0d78,_0x4e9335[_0x8ddd('0x3e')]);return _0x2638b7[_0x8ddd('0x54')](_0x5c0d78);}})[_0x8ddd('0x25')](function(_0x2cf469){if(_0x2cf469){_0x582e45=_0x2cf469[_0x8ddd('0x36')];if(!_0x4e9335[_0x8ddd('0x33')][_0x8ddd('0x55')](_0x8ddd('0x37'))){_0x5c0d78[_0x8ddd('0x1f')]=qs[_0x8ddd('0x1f')](_0x4e9335[_0x8ddd('0x33')]['limit']);_0x5c0d78[_0x8ddd('0x1d')]=qs[_0x8ddd('0x1d')](_0x4e9335[_0x8ddd('0x33')]['offset']);}return _0x2638b7[_0x8ddd('0x54')](_0x5c0d78);}})[_0x8ddd('0x25')](function(_0x5e9729){if(_0x5e9729){return _0x5e9729?{'count':_0x582e45,'rows':_0x5e9729}:null;}})[_0x8ddd('0x25')](respondWithResult(_0x81774,null))[_0x8ddd('0x46')](handleError(_0x81774,null));}; \ No newline at end of file +var _0x2c2b=['query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','map','VIRTUAL','then','includeAll','include','findAll','catch','params','intersection','options','find','body','addConditions','Condition','ids','omit','getConditions','findOne','addActions','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','Automation','rawAttributes','fieldName','type','key','model'];(function(_0x3db122,_0x5e6bee){var _0x325b67=function(_0x5095af){while(--_0x5095af){_0x3db122['push'](_0x3db122['shift']());}};_0x325b67(++_0x5e6bee);}(_0x2c2b,0x1ae));var _0xb2c2=function(_0x324f55,_0x2e6ca4){_0x324f55=_0x324f55-0x0;var _0x284952=_0x2c2b[_0x324f55];return _0x284952;};'use strict';var emlformat=require(_0xb2c2('0x0'));var rimraf=require(_0xb2c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb2c2('0x2'));var rp=require(_0xb2c2('0x3'));var moment=require(_0xb2c2('0x4'));var BPromise=require(_0xb2c2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb2c2('0x6'));var csv=require(_0xb2c2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb2c2('0x8'));var _=require('lodash');var squel=require(_0xb2c2('0x9'));var crypto=require('crypto');var jsforce=require(_0xb2c2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb2c2('0x7'));var querystring=require('querystring');var Papa=require(_0xb2c2('0xb'));var Redis=require('ioredis');var authService=require(_0xb2c2('0xc'));var qs=require(_0xb2c2('0xd'));var as=require(_0xb2c2('0xe'));var hardwareService=require(_0xb2c2('0xf'));var logger=require(_0xb2c2('0x10'))(_0xb2c2('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb2c2('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cc8a5,_0x1c80c1){_0x1c80c1=_0x1c80c1||0xcc;return function(_0x4de4df){if(_0x4de4df){return _0x3cc8a5[_0xb2c2('0x13')](_0x1c80c1);}return _0x3cc8a5[_0xb2c2('0x14')](_0x1c80c1)[_0xb2c2('0x15')]();};}function respondWithResult(_0xd74849,_0x227c0a){_0x227c0a=_0x227c0a||0xc8;return function(_0x3660ec){if(_0x3660ec){return _0xd74849['status'](_0x227c0a)['json'](_0x3660ec);}};}function respondWithFilteredResult(_0x1fa818,_0x4e57f8){return function(_0x100e4){if(_0x100e4){var _0x110a10=typeof _0x4e57f8['offset']==='undefined'&&typeof _0x4e57f8['limit']===_0xb2c2('0x16');var _0x5cd011=_0x100e4[_0xb2c2('0x17')];var _0x34d429=_0x110a10?0x0:_0x4e57f8[_0xb2c2('0x18')];var _0x25f7f9=_0x110a10?_0x100e4[_0xb2c2('0x17')]:_0x4e57f8[_0xb2c2('0x18')]+_0x4e57f8[_0xb2c2('0x19')];var _0x207126;if(_0x25f7f9>=_0x5cd011){_0x25f7f9=_0x5cd011;_0x207126=0xc8;}else{_0x207126=0xce;}_0x1fa818['status'](_0x207126);return _0x1fa818[_0xb2c2('0x1a')](_0xb2c2('0x1b'),_0x34d429+'-'+_0x25f7f9+'/'+_0x5cd011)[_0xb2c2('0x1c')](_0x100e4);}return null;};}function patchUpdates(_0x4fd561){return function(_0x5414ea){try{jsonpatch[_0xb2c2('0x1d')](_0x5414ea,_0x4fd561,!![]);}catch(_0x204916){return BPromise[_0xb2c2('0x1e')](_0x204916);}return _0x5414ea[_0xb2c2('0x1f')]();};}function saveUpdates(_0x3613e3,_0x1c79d7){return function(_0x25e57c){if(_0x25e57c){return _0x25e57c[_0xb2c2('0x20')](_0x3613e3)['then'](function(_0x33c5a2){return _0x33c5a2;});}return null;};}function removeEntity(_0x5edef7,_0x4b2aef){return function(_0x3bd0ef){if(_0x3bd0ef){return _0x3bd0ef[_0xb2c2('0x21')]()['then'](function(){_0x5edef7[_0xb2c2('0x14')](0xcc)[_0xb2c2('0x15')]();});}};}function handleEntityNotFound(_0x565fd3,_0x3ce0e5){return function(_0x36d5e9){if(!_0x36d5e9){_0x565fd3[_0xb2c2('0x13')](0x194);}return _0x36d5e9;};}function handleError(_0x55e2f3,_0x5304b1){_0x5304b1=_0x5304b1||0x1f4;return function(_0x5770fa){logger[_0xb2c2('0x22')](_0x5770fa[_0xb2c2('0x23')]);if(_0x5770fa[_0xb2c2('0x24')]){delete _0x5770fa[_0xb2c2('0x24')];}_0x55e2f3[_0xb2c2('0x14')](_0x5304b1)[_0xb2c2('0x25')](_0x5770fa);};}exports['index']=function(_0xd955a2,_0xc3e30d){var _0x40f8ad={},_0x467ac2={},_0x175463={'count':0x0,'rows':[]};var _0x2c4017=_['map'](db[_0xb2c2('0x26')][_0xb2c2('0x27')],function(_0x1441cf){return{'name':_0x1441cf[_0xb2c2('0x28')],'type':_0x1441cf[_0xb2c2('0x29')][_0xb2c2('0x2a')]};});_0x467ac2[_0xb2c2('0x2b')]=_['map'](_0x2c4017,_0xb2c2('0x24'));_0x467ac2[_0xb2c2('0x2c')]=_[_0xb2c2('0x2d')](_0xd955a2[_0xb2c2('0x2c')]);_0x467ac2[_0xb2c2('0x2e')]=_['intersection'](_0x467ac2[_0xb2c2('0x2b')],_0x467ac2[_0xb2c2('0x2c')]);_0x40f8ad[_0xb2c2('0x2f')]=_['intersection'](_0x467ac2[_0xb2c2('0x2b')],qs[_0xb2c2('0x30')](_0xd955a2[_0xb2c2('0x2c')]['fields']));_0x40f8ad[_0xb2c2('0x2f')]=_0x40f8ad[_0xb2c2('0x2f')][_0xb2c2('0x31')]?_0x40f8ad[_0xb2c2('0x2f')]:_0x467ac2[_0xb2c2('0x2b')];if(!_0xd955a2[_0xb2c2('0x2c')][_0xb2c2('0x32')](_0xb2c2('0x33'))){_0x40f8ad[_0xb2c2('0x19')]=qs[_0xb2c2('0x19')](_0xd955a2[_0xb2c2('0x2c')][_0xb2c2('0x19')]);_0x40f8ad[_0xb2c2('0x18')]=qs['offset'](_0xd955a2[_0xb2c2('0x2c')][_0xb2c2('0x18')]);}_0x40f8ad[_0xb2c2('0x34')]=qs[_0xb2c2('0x35')](_0xd955a2['query'][_0xb2c2('0x35')]);_0x40f8ad['where']=qs[_0xb2c2('0x2e')](_[_0xb2c2('0x36')](_0xd955a2[_0xb2c2('0x2c')],_0x467ac2[_0xb2c2('0x2e')]),_0x2c4017);if(_0xd955a2[_0xb2c2('0x2c')][_0xb2c2('0x37')]){_0x40f8ad['where']=_[_0xb2c2('0x38')](_0x40f8ad[_0xb2c2('0x39')],{'$or':_[_0xb2c2('0x3a')](_0x2c4017,function(_0x397a71){if(_0x397a71['type']!==_0xb2c2('0x3b')){var _0x35638c={};_0x35638c[_0x397a71['name']]={'$like':'%'+_0xd955a2['query'][_0xb2c2('0x37')]+'%'};return _0x35638c;}})});}_0x40f8ad=_[_0xb2c2('0x38')]({},_0x40f8ad,_0xd955a2['options']);var _0x401b4b={'where':_0x40f8ad['where']};return db['Automation'][_0xb2c2('0x17')](_0x401b4b)[_0xb2c2('0x3c')](function(_0x5eefe6){_0x175463['count']=_0x5eefe6;if(_0xd955a2[_0xb2c2('0x2c')][_0xb2c2('0x3d')]){_0x40f8ad[_0xb2c2('0x3e')]=[{'all':!![]}];}return db[_0xb2c2('0x26')][_0xb2c2('0x3f')](_0x40f8ad);})['then'](function(_0x1c21cd){_0x175463['rows']=_0x1c21cd;return _0x175463;})['then'](respondWithFilteredResult(_0xc3e30d,_0x40f8ad))[_0xb2c2('0x40')](handleError(_0xc3e30d,null));};exports['show']=function(_0x56d609,_0x51f065){var _0x128a21={'raw':![],'where':{'id':_0x56d609[_0xb2c2('0x41')]['id']}},_0x142459={};_0x142459[_0xb2c2('0x2b')]=_['keys'](db[_0xb2c2('0x26')][_0xb2c2('0x27')]);_0x142459[_0xb2c2('0x2c')]=_[_0xb2c2('0x2d')](_0x56d609[_0xb2c2('0x2c')]);_0x142459[_0xb2c2('0x2e')]=_[_0xb2c2('0x42')](_0x142459['model'],_0x142459['query']);_0x128a21[_0xb2c2('0x2f')]=_[_0xb2c2('0x42')](_0x142459[_0xb2c2('0x2b')],qs[_0xb2c2('0x30')](_0x56d609[_0xb2c2('0x2c')][_0xb2c2('0x30')]));_0x128a21[_0xb2c2('0x2f')]=_0x128a21[_0xb2c2('0x2f')][_0xb2c2('0x31')]?_0x128a21[_0xb2c2('0x2f')]:_0x142459['model'];if(_0x56d609[_0xb2c2('0x2c')][_0xb2c2('0x3d')]){_0x128a21['include']=[{'all':!![]}];}_0x128a21=_[_0xb2c2('0x38')]({},_0x128a21,_0x56d609[_0xb2c2('0x43')]);return db[_0xb2c2('0x26')][_0xb2c2('0x44')](_0x128a21)[_0xb2c2('0x3c')](handleEntityNotFound(_0x51f065,null))[_0xb2c2('0x3c')](respondWithResult(_0x51f065,null))[_0xb2c2('0x40')](handleError(_0x51f065,null));};exports['create']=function(_0x287876,_0x5043ce){return db[_0xb2c2('0x26')]['create'](_0x287876[_0xb2c2('0x45')],{})[_0xb2c2('0x3c')](respondWithResult(_0x5043ce,0xc9))['catch'](handleError(_0x5043ce,null));};exports[_0xb2c2('0x20')]=function(_0x1bb539,_0x4a1fac){if(_0x1bb539[_0xb2c2('0x45')]['id']){delete _0x1bb539[_0xb2c2('0x45')]['id'];}return db['Automation'][_0xb2c2('0x44')]({'where':{'id':_0x1bb539[_0xb2c2('0x41')]['id']}})[_0xb2c2('0x3c')](handleEntityNotFound(_0x4a1fac,null))['then'](saveUpdates(_0x1bb539[_0xb2c2('0x45')],null))['then'](respondWithResult(_0x4a1fac,null))[_0xb2c2('0x40')](handleError(_0x4a1fac,null));};exports[_0xb2c2('0x21')]=function(_0x5c0b7a,_0xfa71ea){return db[_0xb2c2('0x26')][_0xb2c2('0x44')]({'where':{'id':_0x5c0b7a[_0xb2c2('0x41')]['id']}})['then'](handleEntityNotFound(_0xfa71ea,null))['then'](removeEntity(_0xfa71ea,null))['catch'](handleError(_0xfa71ea,null));};exports[_0xb2c2('0x46')]=function(_0x25f57a,_0x11fd37,_0x5e4313){return db[_0xb2c2('0x47')][_0xb2c2('0x44')]({'where':{'id':_0x25f57a[_0xb2c2('0x41')]['id']}})[_0xb2c2('0x3c')](handleEntityNotFound(_0x11fd37,null))[_0xb2c2('0x3c')](function(_0x1f1546){if(_0x1f1546){return _0x1f1546[_0xb2c2('0x46')](_0x25f57a[_0xb2c2('0x45')][_0xb2c2('0x48')],_[_0xb2c2('0x49')](_0x25f57a['body'],[_0xb2c2('0x48'),'id'])||{});}})[_0xb2c2('0x3c')](respondWithResult(_0x11fd37,null))['catch'](handleError(_0x11fd37,null));};exports[_0xb2c2('0x4a')]=function(_0x3ab95e,_0x54be82,_0x77f4d5){var _0x2f2acc={};var _0x3a1255={};var _0x260fac;var _0x1a4696;return db['Automation'][_0xb2c2('0x4b')]({'where':{'id':_0x3ab95e['params']['id']}})[_0xb2c2('0x3c')](handleEntityNotFound(_0x54be82,null))[_0xb2c2('0x3c')](function(_0x703ace){if(_0x703ace){_0x260fac=_0x703ace;_0x3a1255[_0xb2c2('0x2b')]=_['keys'](db['Condition']['rawAttributes']);_0x3a1255['query']=_['keys'](_0x3ab95e[_0xb2c2('0x2c')]);_0x3a1255['filters']=_[_0xb2c2('0x42')](_0x3a1255['model'],_0x3a1255[_0xb2c2('0x2c')]);_0x2f2acc['attributes']=_[_0xb2c2('0x42')](_0x3a1255[_0xb2c2('0x2b')],qs[_0xb2c2('0x30')](_0x3ab95e[_0xb2c2('0x2c')]['fields']));_0x2f2acc[_0xb2c2('0x2f')]=_0x2f2acc['attributes'][_0xb2c2('0x31')]?_0x2f2acc[_0xb2c2('0x2f')]:_0x3a1255[_0xb2c2('0x2b')];_0x2f2acc[_0xb2c2('0x34')]=qs[_0xb2c2('0x35')](_0x3ab95e[_0xb2c2('0x2c')][_0xb2c2('0x35')]);_0x2f2acc[_0xb2c2('0x39')]=qs[_0xb2c2('0x2e')](_['pick'](_0x3ab95e['query'],_0x3a1255[_0xb2c2('0x2e')]));if(_0x3ab95e[_0xb2c2('0x2c')][_0xb2c2('0x37')]){_0x2f2acc[_0xb2c2('0x39')]=_['merge'](_0x2f2acc[_0xb2c2('0x39')],{'$or':_[_0xb2c2('0x3a')](_0x2f2acc[_0xb2c2('0x2f')],function(_0x3d7169){var _0x1e9497={};_0x1e9497[_0x3d7169]={'$like':'%'+_0x3ab95e['query'][_0xb2c2('0x37')]+'%'};return _0x1e9497;})});}_0x2f2acc=_[_0xb2c2('0x38')]({},_0x2f2acc,_0x3ab95e[_0xb2c2('0x43')]);return _0x260fac[_0xb2c2('0x4a')](_0x2f2acc);}})[_0xb2c2('0x3c')](function(_0xc2c19d){if(_0xc2c19d){_0x1a4696=_0xc2c19d[_0xb2c2('0x31')];if(!_0x3ab95e[_0xb2c2('0x2c')][_0xb2c2('0x32')](_0xb2c2('0x33'))){_0x2f2acc[_0xb2c2('0x19')]=qs['limit'](_0x3ab95e[_0xb2c2('0x2c')][_0xb2c2('0x19')]);_0x2f2acc[_0xb2c2('0x18')]=qs[_0xb2c2('0x18')](_0x3ab95e[_0xb2c2('0x2c')]['offset']);}return _0x260fac[_0xb2c2('0x4a')](_0x2f2acc);}})[_0xb2c2('0x3c')](function(_0x45b306){if(_0x45b306){return _0x45b306?{'count':_0x1a4696,'rows':_0x45b306}:null;}})[_0xb2c2('0x3c')](respondWithResult(_0x54be82,null))['catch'](handleError(_0x54be82,null));};exports[_0xb2c2('0x4c')]=function(_0xa6eb3b,_0x568026,_0x1a1ec5){return db[_0xb2c2('0x4d')]['find']({'where':{'id':_0xa6eb3b[_0xb2c2('0x41')]['id']}})[_0xb2c2('0x3c')](handleEntityNotFound(_0x568026,null))[_0xb2c2('0x3c')](function(_0x12d924){if(_0x12d924){return _0x12d924[_0xb2c2('0x4c')](_0xa6eb3b[_0xb2c2('0x45')][_0xb2c2('0x48')],_['omit'](_0xa6eb3b[_0xb2c2('0x45')],['ids','id'])||{});}})[_0xb2c2('0x3c')](respondWithResult(_0x568026,null))[_0xb2c2('0x40')](handleError(_0x568026,null));};exports['getActions']=function(_0x9f188b,_0xc20c4c,_0x1424d1){var _0x318a35={};var _0x4dfa64={};var _0x45fe87;var _0x1a890d;return db[_0xb2c2('0x26')][_0xb2c2('0x4b')]({'where':{'id':_0x9f188b[_0xb2c2('0x41')]['id']}})[_0xb2c2('0x3c')](handleEntityNotFound(_0xc20c4c,null))[_0xb2c2('0x3c')](function(_0x31d786){if(_0x31d786){_0x45fe87=_0x31d786;_0x4dfa64[_0xb2c2('0x2b')]=_[_0xb2c2('0x2d')](db[_0xb2c2('0x4d')]['rawAttributes']);_0x4dfa64[_0xb2c2('0x2c')]=_[_0xb2c2('0x2d')](_0x9f188b[_0xb2c2('0x2c')]);_0x4dfa64[_0xb2c2('0x2e')]=_[_0xb2c2('0x42')](_0x4dfa64[_0xb2c2('0x2b')],_0x4dfa64[_0xb2c2('0x2c')]);_0x318a35[_0xb2c2('0x2f')]=_[_0xb2c2('0x42')](_0x4dfa64[_0xb2c2('0x2b')],qs[_0xb2c2('0x30')](_0x9f188b[_0xb2c2('0x2c')][_0xb2c2('0x30')]));_0x318a35['attributes']=_0x318a35[_0xb2c2('0x2f')][_0xb2c2('0x31')]?_0x318a35['attributes']:_0x4dfa64['model'];_0x318a35[_0xb2c2('0x34')]=qs[_0xb2c2('0x35')](_0x9f188b[_0xb2c2('0x2c')][_0xb2c2('0x35')]);_0x318a35['where']=qs['filters'](_[_0xb2c2('0x36')](_0x9f188b[_0xb2c2('0x2c')],_0x4dfa64[_0xb2c2('0x2e')]));if(_0x9f188b['query'][_0xb2c2('0x37')]){_0x318a35[_0xb2c2('0x39')]=_[_0xb2c2('0x38')](_0x318a35['where'],{'$or':_[_0xb2c2('0x3a')](_0x318a35[_0xb2c2('0x2f')],function(_0xdf7672){var _0x608a4a={};_0x608a4a[_0xdf7672]={'$like':'%'+_0x9f188b[_0xb2c2('0x2c')][_0xb2c2('0x37')]+'%'};return _0x608a4a;})});}_0x318a35=_[_0xb2c2('0x38')]({},_0x318a35,_0x9f188b[_0xb2c2('0x43')]);return _0x45fe87[_0xb2c2('0x4e')](_0x318a35);}})[_0xb2c2('0x3c')](function(_0x13e5a5){if(_0x13e5a5){_0x1a890d=_0x13e5a5[_0xb2c2('0x31')];if(!_0x9f188b[_0xb2c2('0x2c')]['hasOwnProperty'](_0xb2c2('0x33'))){_0x318a35[_0xb2c2('0x19')]=qs[_0xb2c2('0x19')](_0x9f188b[_0xb2c2('0x2c')][_0xb2c2('0x19')]);_0x318a35[_0xb2c2('0x18')]=qs[_0xb2c2('0x18')](_0x9f188b[_0xb2c2('0x2c')][_0xb2c2('0x18')]);}return _0x45fe87['getActions'](_0x318a35);}})[_0xb2c2('0x3c')](function(_0x3866bf){if(_0x3866bf){return _0x3866bf?{'count':_0x1a890d,'rows':_0x3866bf}:null;}})[_0xb2c2('0x3c')](respondWithResult(_0xc20c4c,null))[_0xb2c2('0x40')](handleError(_0xc20c4c,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 86f4267..6a8ed71 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 _0xe3a4=['define','Automation','tools_automations','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./automation.attributes','exports'];(function(_0x56341d,_0x17682d){var _0x3101bc=function(_0x5e149a){while(--_0x5e149a){_0x56341d['push'](_0x56341d['shift']());}};_0x3101bc(++_0x17682d);}(_0xe3a4,0x10b));var _0x4e3a=function(_0x3cc540,_0x34adee){_0x3cc540=_0x3cc540-0x0;var _0x520116=_0xe3a4[_0x3cc540];return _0x520116;};'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('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4e3a('0x5'));var config=require(_0x4e3a('0x6'));var attributes=require(_0x4e3a('0x7'));module[_0x4e3a('0x8')]=function(_0x497cc1,_0x5ed9f7){return _0x497cc1[_0x4e3a('0x9')](_0x4e3a('0xa'),attributes,{'tableName':_0x4e3a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf3a=['request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','tools_automations','util','api','moment','bluebird'];(function(_0x2d5836,_0x5dfaba){var _0x1ed434=function(_0x398451){while(--_0x398451){_0x2d5836['push'](_0x2d5836['shift']());}};_0x1ed434(++_0x5dfaba);}(_0xaf3a,0x146));var _0xaaf3=function(_0x6287b6,_0x5682e7){_0x6287b6=_0x6287b6-0x0;var _0x5d6be4=_0xaf3a[_0x6287b6];return _0x5d6be4;};'use strict';var _=require('lodash');var util=require(_0xaaf3('0x0'));var logger=require('../../config/logger')(_0xaaf3('0x1'));var moment=require(_0xaaf3('0x2'));var BPromise=require(_0xaaf3('0x3'));var rp=require(_0xaaf3('0x4'));var fs=require('fs');var path=require(_0xaaf3('0x5'));var rimraf=require(_0xaaf3('0x6'));var config=require(_0xaaf3('0x7'));var attributes=require(_0xaaf3('0x8'));module[_0xaaf3('0x9')]=function(_0x898587,_0x3fbdb7){return _0x898587['define']('Automation',attributes,{'tableName':_0xaaf3('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 b63301a..ea1aeb0 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 _0xaa5e=['stringify','error','code','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x4a262f,_0x1fc579){var _0x293540=function(_0x2b7394){while(--_0x2b7394){_0x4a262f['push'](_0x4a262f['shift']());}};_0x293540(++_0x1fc579);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x57ba8c,_0x47d1d7){_0x57ba8c=_0x57ba8c-0x0;var _0x1765d0=_0xaa5e[_0x57ba8c];return _0x1765d0;};'use strict';var _=require(_0xeaa5('0x0'));var util=require(_0xeaa5('0x1'));var moment=require('moment');var BPromise=require(_0xeaa5('0x2'));var rs=require(_0xeaa5('0x3'));var fs=require('fs');var Redis=require(_0xeaa5('0x4'));var db=require(_0xeaa5('0x5'))['db'];var utils=require(_0xeaa5('0x6'));var logger=require('../../config/logger')(_0xeaa5('0x7'));var config=require(_0xeaa5('0x8'));var jayson=require(_0xeaa5('0x9'));var client=jayson[_0xeaa5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d405e,_0x2f9041,_0x2c9696){return new BPromise(function(_0x50cb62,_0x2e35c3){return client[_0xeaa5('0xb')](_0x4d405e,_0x2c9696)['then'](function(_0x2e9ca6){logger['info'](_0xeaa5('0xc'),_0x2f9041,_0xeaa5('0xd'));logger['debug'](_0xeaa5('0xe'),_0x2f9041,_0xeaa5('0xd'),JSON[_0xeaa5('0xf')](_0x2e9ca6));if(_0x2e9ca6[_0xeaa5('0x10')]){if(_0x2e9ca6[_0xeaa5('0x10')][_0xeaa5('0x11')]===0x1f4){logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x2e9ca6[_0xeaa5('0x10')]['message']);return _0x2e35c3(_0x2e9ca6[_0xeaa5('0x10')][_0xeaa5('0x12')]);}logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x2e9ca6[_0xeaa5('0x10')]['message']);return _0x50cb62(_0x2e9ca6[_0xeaa5('0x10')]['message']);}else{logger[_0xeaa5('0x13')](_0xeaa5('0xc'),_0x2f9041,_0xeaa5('0xd'));_0x50cb62(_0x2e9ca6['result'][_0xeaa5('0x12')]);}})['catch'](function(_0x44e4b4){logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x44e4b4);_0x2e35c3(_0x44e4b4);});});} \ No newline at end of file +var _0x3cae=['../../config/logger','rpc','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3778d8,_0x5ce417){var _0x45a1b3=function(_0x28488a){while(--_0x28488a){_0x3778d8['push'](_0x3778d8['shift']());}};_0x45a1b3(++_0x5ce417);}(_0x3cae,0x117));var _0xe3ca=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x3cae[_0xfcbcb8];return _0x1b1f97;};'use strict';var _=require(_0xe3ca('0x0'));var util=require(_0xe3ca('0x1'));var moment=require(_0xe3ca('0x2'));var BPromise=require(_0xe3ca('0x3'));var rs=require(_0xe3ca('0x4'));var fs=require('fs');var Redis=require(_0xe3ca('0x5'));var db=require(_0xe3ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3ca('0x7'))(_0xe3ca('0x8'));var config=require('../../config/environment');var jayson=require(_0xe3ca('0x9'));var client=jayson['client'][_0xe3ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7fafb4,_0x36d17a,_0x578178){return new BPromise(function(_0x2c4863,_0x100c20){return client[_0xe3ca('0xb')](_0x7fafb4,_0x578178)[_0xe3ca('0xc')](function(_0x1ae7bf){logger[_0xe3ca('0xd')](_0xe3ca('0xe'),_0x36d17a,'request\x20sent');logger[_0xe3ca('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x36d17a,_0xe3ca('0x10'),JSON[_0xe3ca('0x11')](_0x1ae7bf));if(_0x1ae7bf[_0xe3ca('0x12')]){if(_0x1ae7bf[_0xe3ca('0x12')][_0xe3ca('0x13')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x36d17a,_0x1ae7bf[_0xe3ca('0x12')]['message']);return _0x100c20(_0x1ae7bf[_0xe3ca('0x12')][_0xe3ca('0x14')]);}logger['error'](_0xe3ca('0xe'),_0x36d17a,_0x1ae7bf[_0xe3ca('0x12')][_0xe3ca('0x14')]);return _0x2c4863(_0x1ae7bf[_0xe3ca('0x12')][_0xe3ca('0x14')]);}else{logger[_0xe3ca('0xd')](_0xe3ca('0xe'),_0x36d17a,_0xe3ca('0x10'));_0x2c4863(_0x1ae7bf['result']['message']);}})[_0xe3ca('0x15')](function(_0x4296ae){logger[_0xe3ca('0x12')](_0xe3ca('0xe'),_0x36d17a,_0x4296ae);_0x100c20(_0x4296ae);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 7d3d3b9..5a262d9 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 _0x1b69=['create','addConditions','addActions','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','getActions','post'];(function(_0x468a77,_0x1382be){var _0x2d1c33=function(_0x2f2e83){while(--_0x2f2e83){_0x468a77['push'](_0x468a77['shift']());}};_0x2d1c33(++_0x1382be);}(_0x1b69,0x1d0));var _0x91b6=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x1b69[_0x5a79e2];return _0x266c45;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x91b6('0x0'));var express=require(_0x91b6('0x1'));var router=express[_0x91b6('0x2')]();var fs_extra=require(_0x91b6('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x91b6('0x4'));var config=require(_0x91b6('0x5'));var controller=require(_0x91b6('0x6'));router[_0x91b6('0x7')]('/',auth[_0x91b6('0x8')](),controller[_0x91b6('0x9')]);router[_0x91b6('0x7')](_0x91b6('0xa'),auth[_0x91b6('0x8')](),controller[_0x91b6('0xb')]);router[_0x91b6('0x7')](_0x91b6('0xc'),auth[_0x91b6('0x8')](),controller['getConditions']);router[_0x91b6('0x7')](_0x91b6('0xd'),auth[_0x91b6('0x8')](),controller[_0x91b6('0xe')]);router[_0x91b6('0xf')]('/',auth[_0x91b6('0x8')](),controller[_0x91b6('0x10')]);router['post']('/:id/conditions',auth['isAuthenticated'](),controller[_0x91b6('0x11')]);router[_0x91b6('0xf')](_0x91b6('0xd'),auth[_0x91b6('0x8')](),controller[_0x91b6('0x12')]);router[_0x91b6('0x13')](_0x91b6('0xa'),auth[_0x91b6('0x8')](),controller[_0x91b6('0x14')]);router[_0x91b6('0x15')](_0x91b6('0xa'),auth['isAuthenticated'](),controller[_0x91b6('0x16')]);module[_0x91b6('0x17')]=router; \ No newline at end of file +var _0xe644=['getActions','post','create','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','getConditions','/:id/actions'];(function(_0x47bd8a,_0x559ec3){var _0x1ee9a6=function(_0x225ec5){while(--_0x225ec5){_0x47bd8a['push'](_0x47bd8a['shift']());}};_0x1ee9a6(++_0x559ec3);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var path=require(_0x4e64('0x2'));var timeout=require(_0x4e64('0x3'));var express=require(_0x4e64('0x4'));var router=express[_0x4e64('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4e64('0x6'));var interaction=require(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var controller=require(_0x4e64('0x9'));router[_0x4e64('0xa')]('/',auth[_0x4e64('0xb')](),controller['index']);router[_0x4e64('0xa')](_0x4e64('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4e64('0xa')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x4e64('0xd')]);router[_0x4e64('0xa')](_0x4e64('0xe'),auth[_0x4e64('0xb')](),controller[_0x4e64('0xf')]);router[_0x4e64('0x10')]('/',auth['isAuthenticated'](),controller[_0x4e64('0x11')]);router[_0x4e64('0x10')]('/:id/conditions',auth[_0x4e64('0xb')](),controller['addConditions']);router['post'](_0x4e64('0xe'),auth['isAuthenticated'](),controller[_0x4e64('0x12')]);router[_0x4e64('0x13')](_0x4e64('0xc'),auth[_0x4e64('0xb')](),controller[_0x4e64('0x14')]);router[_0x4e64('0x15')](_0x4e64('0xc'),auth['isAuthenticated'](),controller[_0x4e64('0x16')]);module[_0x4e64('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 600ed45..05c9174 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 _0x6244=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x5b5870,_0x3e5b7b){var _0x23a0ca=function(_0x2c9125){while(--_0x2c9125){_0x5b5870['push'](_0x5b5870['shift']());}};_0x23a0ca(++_0x3e5b7b);}(_0x6244,0x1ad));var _0x4624=function(_0x3d2fbb,_0x12a465){_0x3d2fbb=_0x3d2fbb-0x0;var _0x1f6668=_0x6244[_0x3d2fbb];return _0x1f6668;};'use strict';var Sequelize=require(_0x4624('0x0'));module[_0x4624('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4624('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x4624('0x3')](_0x4624('0x4')),'allowNull':![],'defaultValue':_0x4624('0x4')},'description':{'type':Sequelize[_0x4624('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4624('0x6')},'limitCalls':{'type':Sequelize[_0x4624('0x7')](0x4)[_0x4624('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4624('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4624('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4624('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4624('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x4624('0x7')](0x3)[_0x4624('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4624('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4624('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4624('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x4624('0x7')](0x3)[_0x4624('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x4624('0x7')](0x5)[_0x4624('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4624('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4624('0x8')],'defaultValue':0x3,'comment':_0x4624('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4624('0x7')](0x5)[_0x4624('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4624('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4624('0x7')](0x3)[_0x4624('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4624('0xf')},'dialTimezone':{'type':Sequelize[_0x4624('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x4624('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never',_0x4624('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x4624('0x12')],'defaultValue':0x0,'comment':_0x4624('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4624('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4624('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x4624('0x7')](0x9)[_0x4624('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4624('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4624('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4624('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4624('0x7')](0x9)[_0x4624('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4624('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x4624('0x7')](0x9)[_0x4624('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4624('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4624('0x7')](0x9)[_0x4624('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4624('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x4624('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4624('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4624('0x7')](0x5)[_0x4624('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4624('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4624('0x7')](0x9)[_0x4624('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4624('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4624('0x3')]('DESC',_0x4624('0x1d')),'defaultValue':_0x4624('0x1e')},'dialPrefix':{'type':Sequelize[_0x4624('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4624('0x7')](0x3)[_0x4624('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4624('0x1f')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x4624('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4624('0x20')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4624('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4624('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4624('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x4624('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x4624('0x7')](0x5)[_0x4624('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4624('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4624('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x4624('0x7')](0x3)[_0x4624('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4624('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4624('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4624('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4624('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4624('0x7')](0x5)[_0x4624('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4624('0x25')}}; \ No newline at end of file +var _0xe019=['#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','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)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x2b9c0c,_0x4678a3){var _0xd8577b=function(_0x2dd9eb){while(--_0x2dd9eb){_0x2b9c0c['push'](_0x2b9c0c['shift']());}};_0xd8577b(++_0x4678a3);}(_0xe019,0x1b0));var _0x9e01=function(_0x3995e3,_0xa80514){_0x3995e3=_0x3995e3-0x0;var _0x4ec9f2=_0xe019[_0x3995e3];return _0x4ec9f2;};'use strict';var Sequelize=require(_0x9e01('0x0'));module[_0x9e01('0x1')]={'name':{'type':Sequelize[_0x9e01('0x2')],'unique':_0x9e01('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x9e01('0x4')),'allowNull':![],'defaultValue':_0x9e01('0x4')},'description':{'type':Sequelize[_0x9e01('0x2')]},'active':{'type':Sequelize[_0x9e01('0x5')],'defaultValue':0x0,'comment':_0x9e01('0x6')},'limitCalls':{'type':Sequelize[_0x9e01('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x9e01('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x9e01('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e01('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9e01('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e01('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9e01('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e01('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9e01('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e01('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9e01('0x7')](0x5)[_0x9e01('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9e01('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x9e01('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9e01('0x7')](0x5)[_0x9e01('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x9e01('0x7')](0x3)[_0x9e01('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9e01('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9e01('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x9e01('0x10')](_0x9e01('0x11'),_0x9e01('0x12'),_0x9e01('0x13')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9e01('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x9e01('0x7')](0x9)[_0x9e01('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9e01('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9e01('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9e01('0x7')](0x9)[_0x9e01('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9e01('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9e01('0x18')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9e01('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9e01('0x7')](0x9)[_0x9e01('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9e01('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9e01('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9e01('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9e01('0x7')](0x5)[_0x9e01('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9e01('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9e01('0x7')](0x9)[_0x9e01('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9e01('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x9e01('0x1d'),_0x9e01('0x1e')),'defaultValue':_0x9e01('0x1d')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9e01('0x7')](0x3)[_0x9e01('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x9e01('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9e01('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9e01('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e01('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x9e01('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e01('0x21')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9e01('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e01('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9e01('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e01('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x9e01('0x7')](0x3)[_0x9e01('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e01('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9e01('0x7')](0x5)[_0x9e01('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e01('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9e01('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9e01('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e01('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 22eefe6..92aa736 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 _0x5f4a=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','lodash','crypto','jsforce','desk.js','to-csv','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','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','IvrCampaigns','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','Campaign','findAll','rows','catch','show','params','keys','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','length','omit','createdAt','updatedAt','create','userProfileId','getHoppers','findOne','CmHopper','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','select','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','push','sequelize','removeBlackLists'];(function(_0x1ec836,_0x1ce2d6){var _0x4baf71=function(_0x5b640e){while(--_0x5b640e){_0x1ec836['push'](_0x1ec836['shift']());}};_0x4baf71(++_0x1ce2d6);}(_0x5f4a,0x10c));var _0xa5f4=function(_0x2b6eca,_0x15de07){_0x2b6eca=_0x2b6eca-0x0;var _0x4406e4=_0x5f4a[_0x2b6eca];return _0x4406e4;};'use strict';var emlformat=require(_0xa5f4('0x0'));var rimraf=require(_0xa5f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa5f4('0x2'));var rp=require(_0xa5f4('0x3'));var moment=require(_0xa5f4('0x4'));var BPromise=require(_0xa5f4('0x5'));var Mustache=require(_0xa5f4('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa5f4('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5f4('0x8'));var squel=require('squel');var crypto=require(_0xa5f4('0x9'));var jsforce=require(_0xa5f4('0xa'));var deskjs=require(_0xa5f4('0xb'));var toCsv=require(_0xa5f4('0xc'));var querystring=require(_0xa5f4('0xd'));var Papa=require(_0xa5f4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa5f4('0xf'));var as=require(_0xa5f4('0x10'));var hardwareService=require(_0xa5f4('0x11'));var logger=require(_0xa5f4('0x12'))(_0xa5f4('0x13'));var utils=require(_0xa5f4('0x14'));var config=require(_0xa5f4('0x15'));var licenseUtil=require(_0xa5f4('0x16'));var db=require(_0xa5f4('0x17'))['db'];function respondWithStatusCode(_0x3c923b,_0x3ec6eb){_0x3ec6eb=_0x3ec6eb||0xcc;return function(_0x537e3a){if(_0x537e3a){return _0x3c923b[_0xa5f4('0x18')](_0x3ec6eb);}return _0x3c923b[_0xa5f4('0x19')](_0x3ec6eb)[_0xa5f4('0x1a')]();};}function respondWithResult(_0x526a6f,_0x843779){_0x843779=_0x843779||0xc8;return function(_0x1117a5){if(_0x1117a5){return _0x526a6f[_0xa5f4('0x19')](_0x843779)[_0xa5f4('0x1b')](_0x1117a5);}};}function respondWithFilteredResult(_0x294538,_0x4865ce){return function(_0x5b9183){if(_0x5b9183){var _0x325e88=typeof _0x4865ce[_0xa5f4('0x1c')]===_0xa5f4('0x1d')&&typeof _0x4865ce['limit']===_0xa5f4('0x1d');var _0x5c9553=_0x5b9183[_0xa5f4('0x1e')];var _0x1825e0=_0x325e88?0x0:_0x4865ce[_0xa5f4('0x1c')];var _0x54a470=_0x325e88?_0x5b9183[_0xa5f4('0x1e')]:_0x4865ce[_0xa5f4('0x1c')]+_0x4865ce[_0xa5f4('0x1f')];var _0xcb6c6d;if(_0x54a470>=_0x5c9553){_0x54a470=_0x5c9553;_0xcb6c6d=0xc8;}else{_0xcb6c6d=0xce;}_0x294538[_0xa5f4('0x19')](_0xcb6c6d);return _0x294538['set'](_0xa5f4('0x20'),_0x1825e0+'-'+_0x54a470+'/'+_0x5c9553)['json'](_0x5b9183);}return null;};}function patchUpdates(_0x36b774){return function(_0x546015){try{jsonpatch[_0xa5f4('0x21')](_0x546015,_0x36b774,!![]);}catch(_0x4070dd){return BPromise[_0xa5f4('0x22')](_0x4070dd);}return _0x546015['save']();};}function saveUpdates(_0x4103e0,_0x10e7b7){return function(_0x22f318){if(_0x22f318){return _0x22f318[_0xa5f4('0x23')](_0x4103e0)[_0xa5f4('0x24')](function(_0x4beb17){return _0x4beb17;});}return null;};}function removeEntity(_0x39ee99,_0x4660a6){return function(_0x2b5bca){if(_0x2b5bca){return _0x2b5bca[_0xa5f4('0x25')]()[_0xa5f4('0x24')](function(){var _0x8c9190=_0x2b5bca['get']({'plain':!![]});var _0x4e9bb0=_0xa5f4('0x26');return db[_0xa5f4('0x27')]['destroy']({'where':{'type':_0x4e9bb0,'resourceId':_0x8c9190['id']}})['then'](function(){return _0x2b5bca;});})[_0xa5f4('0x24')](function(){_0x39ee99[_0xa5f4('0x19')](0xcc)[_0xa5f4('0x1a')]();});}};}function handleEntityNotFound(_0x1ad9a2,_0x125e2e){return function(_0x316432){if(!_0x316432){_0x1ad9a2['sendStatus'](0x194);}return _0x316432;};}function handleError(_0x3461a6,_0x55529b){_0x55529b=_0x55529b||0x1f4;return function(_0x5ff6aa){logger['error'](_0x5ff6aa[_0xa5f4('0x28')]);if(_0x5ff6aa[_0xa5f4('0x29')]){delete _0x5ff6aa['name'];}_0x3461a6[_0xa5f4('0x19')](_0x55529b)[_0xa5f4('0x2a')](_0x5ff6aa);};}exports[_0xa5f4('0x2b')]=function(_0x32de6a,_0x4fbaf9){var _0x3f56da={},_0x245374={},_0x4e1fba={'count':0x0,'rows':[]};var _0x383252=_[_0xa5f4('0x2c')](db['Campaign'][_0xa5f4('0x2d')],function(_0x191a43){return{'name':_0x191a43[_0xa5f4('0x2e')],'type':_0x191a43[_0xa5f4('0x2f')][_0xa5f4('0x30')]};});_0x245374[_0xa5f4('0x31')]=_[_0xa5f4('0x2c')](_0x383252,_0xa5f4('0x29'));_0x245374[_0xa5f4('0x32')]=_['keys'](_0x32de6a[_0xa5f4('0x32')]);_0x245374[_0xa5f4('0x33')]=_[_0xa5f4('0x34')](_0x245374['model'],_0x245374[_0xa5f4('0x32')]);_0x3f56da[_0xa5f4('0x35')]=_[_0xa5f4('0x34')](_0x245374['model'],qs[_0xa5f4('0x36')](_0x32de6a[_0xa5f4('0x32')][_0xa5f4('0x36')]));_0x3f56da['attributes']=_0x3f56da[_0xa5f4('0x35')]['length']?_0x3f56da['attributes']:_0x245374[_0xa5f4('0x31')];if(!_0x32de6a['query'][_0xa5f4('0x37')](_0xa5f4('0x38'))){_0x3f56da[_0xa5f4('0x1f')]=qs[_0xa5f4('0x1f')](_0x32de6a[_0xa5f4('0x32')][_0xa5f4('0x1f')]);_0x3f56da['offset']=qs['offset'](_0x32de6a[_0xa5f4('0x32')][_0xa5f4('0x1c')]);}_0x3f56da[_0xa5f4('0x39')]=qs['sort'](_0x32de6a['query'][_0xa5f4('0x3a')]);_0x3f56da[_0xa5f4('0x3b')]=qs['filters'](_['pick'](_0x32de6a[_0xa5f4('0x32')],_0x245374['filters']),_0x383252);if(_0x32de6a[_0xa5f4('0x32')][_0xa5f4('0x3c')]){_0x3f56da['where']=_[_0xa5f4('0x3d')](_0x3f56da[_0xa5f4('0x3b')],{'$or':_['map'](_0x383252,function(_0x24dd5a){if(_0x24dd5a['type']!==_0xa5f4('0x3e')){var _0x507576={};_0x507576[_0x24dd5a[_0xa5f4('0x29')]]={'$like':'%'+_0x32de6a[_0xa5f4('0x32')]['filter']+'%'};return _0x507576;}})});}_0x3f56da=_[_0xa5f4('0x3d')]({},_0x3f56da,_0x32de6a[_0xa5f4('0x3f')]);var _0xf77c23={'where':_0x3f56da['where']};return db['Campaign'][_0xa5f4('0x1e')](_0xf77c23)[_0xa5f4('0x24')](function(_0x1fd63f){_0x4e1fba['count']=_0x1fd63f;if(_0x32de6a[_0xa5f4('0x32')][_0xa5f4('0x40')]){_0x3f56da[_0xa5f4('0x41')]=[{'all':!![]}];}return db[_0xa5f4('0x42')][_0xa5f4('0x43')](_0x3f56da);})[_0xa5f4('0x24')](function(_0x49116e){_0x4e1fba[_0xa5f4('0x44')]=_0x49116e;return _0x4e1fba;})[_0xa5f4('0x24')](respondWithFilteredResult(_0x4fbaf9,_0x3f56da))[_0xa5f4('0x45')](handleError(_0x4fbaf9,null));};exports[_0xa5f4('0x46')]=function(_0x44347d,_0x900c06){var _0x1f2009={'raw':![],'where':{'id':_0x44347d[_0xa5f4('0x47')]['id']}},_0x1fa61c={};_0x1fa61c[_0xa5f4('0x31')]=_['keys'](db[_0xa5f4('0x42')]['rawAttributes']);_0x1fa61c[_0xa5f4('0x32')]=_[_0xa5f4('0x48')](_0x44347d['query']);_0x1fa61c[_0xa5f4('0x33')]=_[_0xa5f4('0x34')](_0x1fa61c[_0xa5f4('0x31')],_0x1fa61c[_0xa5f4('0x32')]);_0x1f2009[_0xa5f4('0x35')]=_['intersection'](_0x1fa61c[_0xa5f4('0x31')],qs[_0xa5f4('0x36')](_0x44347d['query'][_0xa5f4('0x36')]));_0x1f2009[_0xa5f4('0x35')]=_0x1f2009[_0xa5f4('0x35')]['length']?_0x1f2009[_0xa5f4('0x35')]:_0x1fa61c[_0xa5f4('0x31')];if(_0x44347d[_0xa5f4('0x32')]['includeAll']){_0x1f2009['include']=[{'all':!![]}];}_0x1f2009=_['merge']({},_0x1f2009,_0x44347d[_0xa5f4('0x3f')]);return db[_0xa5f4('0x42')]['find'](_0x1f2009)['then'](handleEntityNotFound(_0x900c06,null))[_0xa5f4('0x24')](respondWithResult(_0x900c06,null))[_0xa5f4('0x45')](handleError(_0x900c06,null));};exports['create']=function(_0x42f1b8,_0x242964){return db['Campaign']['create'](_0x42f1b8[_0xa5f4('0x49')],{})[_0xa5f4('0x24')](function(_0x40a5c6){var _0x35a17a=_0x42f1b8[_0xa5f4('0x4a')][_0xa5f4('0x4b')]({'plain':!![]});if(!_0x35a17a)throw new Error(_0xa5f4('0x4c'));if(_0x35a17a[_0xa5f4('0x4d')]===_0xa5f4('0x4a')){var _0xa7118c=_0x40a5c6['get']({'plain':!![]});var _0x5bcbcc=_0xa5f4('0x26');return db['UserProfileSection'][_0xa5f4('0x4e')]({'where':{'name':_0x5bcbcc,'userProfileId':_0x35a17a['userProfileId']},'raw':!![]})[_0xa5f4('0x24')](function(_0x5d58f4){if(_0x5d58f4&&_0x5d58f4[_0xa5f4('0x4f')]===0x0){return db[_0xa5f4('0x27')]['create']({'name':_0xa7118c[_0xa5f4('0x29')],'resourceId':_0xa7118c['id'],'type':_0x5d58f4[_0xa5f4('0x29')],'sectionId':_0x5d58f4['id']},{})[_0xa5f4('0x24')](function(){return _0x40a5c6;});}else{return _0x40a5c6;}})['catch'](function(_0x29cf43){logger[_0xa5f4('0x50')](_0xa5f4('0x51'),_0x29cf43);throw _0x29cf43;});}return _0x40a5c6;})['then'](respondWithResult(_0x242964,0xc9))[_0xa5f4('0x45')](handleError(_0x242964,null));};exports['clone']=function(_0x5f140b,_0x182bc8){var _0x1a021c={'where':{'id':_0x5f140b['params']['id']}},_0x2378d3={};_0x2378d3[_0xa5f4('0x31')]=_[_0xa5f4('0x48')](db[_0xa5f4('0x42')]['rawAttributes']);_0x1a021c[_0xa5f4('0x35')]=_[_0xa5f4('0x34')](_0x2378d3[_0xa5f4('0x31')],qs['fields'](_0x5f140b['query'][_0xa5f4('0x36')]));_0x1a021c['attributes']=_0x1a021c['attributes'][_0xa5f4('0x52')]?_0x1a021c[_0xa5f4('0x35')]:_0x2378d3[_0xa5f4('0x31')];if(_0x5f140b[_0xa5f4('0x32')][_0xa5f4('0x40')]){_0x1a021c['include']=[{'all':!![]}];}_0x1a021c=_['merge']({},_0x1a021c,_0x5f140b[_0xa5f4('0x3f')]);return db[_0xa5f4('0x42')][_0xa5f4('0x4e')](_0x1a021c)[_0xa5f4('0x24')](handleEntityNotFound(_0x182bc8,null))[_0xa5f4('0x24')](function(_0xf01ca9){if(_0xf01ca9){var _0x150e8c=_0xf01ca9[_0xa5f4('0x4b')]({'plain':!![]});_0x150e8c=qs[_0xa5f4('0x53')](_0x150e8c,['id',_0xa5f4('0x54'),_0xa5f4('0x55')]);_0x5f140b[_0xa5f4('0x49')]=_[_0xa5f4('0x53')](_0x5f140b[_0xa5f4('0x49')],['id',_0xa5f4('0x54'),_0xa5f4('0x55')]);return db['Campaign'][_0xa5f4('0x56')](_[_0xa5f4('0x3d')](_0x150e8c,_0x5f140b[_0xa5f4('0x49')]),{'include':_0x5f140b['query']['includeAll']?[{'all':!![]}]:undefined})[_0xa5f4('0x24')](function(_0x1456ae){var _0x23086d=_0x5f140b[_0xa5f4('0x4a')][_0xa5f4('0x4b')]({'plain':!![]});if(!_0x23086d)throw new Error(_0xa5f4('0x4c'));if(_0x23086d[_0xa5f4('0x4d')]==='user'){var _0x3df60d=_0x1456ae[_0xa5f4('0x4b')]({'plain':!![]});var _0x78061=_0xa5f4('0x26');return db['UserProfileSection'][_0xa5f4('0x4e')]({'where':{'name':_0x78061,'userProfileId':_0x23086d[_0xa5f4('0x57')]},'raw':!![]})['then'](function(_0x45cb25){if(_0x45cb25&&_0x45cb25[_0xa5f4('0x4f')]===0x0){return db[_0xa5f4('0x27')][_0xa5f4('0x56')]({'name':_0x3df60d[_0xa5f4('0x29')],'resourceId':_0x3df60d['id'],'type':_0x45cb25[_0xa5f4('0x29')],'sectionId':_0x45cb25['id']},{})[_0xa5f4('0x24')](function(){return _0x1456ae;});}else{return _0x1456ae;}})[_0xa5f4('0x45')](function(_0x17d98a){logger[_0xa5f4('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17d98a);throw _0x17d98a;});}return _0x1456ae;});}})[_0xa5f4('0x24')](respondWithResult(_0x182bc8,0xc9))[_0xa5f4('0x45')](handleError(_0x182bc8,null));};exports[_0xa5f4('0x23')]=function(_0x4491fc,_0x516cd1){if(_0x4491fc[_0xa5f4('0x49')]['id']){delete _0x4491fc[_0xa5f4('0x49')]['id'];}return db[_0xa5f4('0x42')]['find']({'where':{'id':_0x4491fc['params']['id']}})['then'](handleEntityNotFound(_0x516cd1,null))[_0xa5f4('0x24')](saveUpdates(_0x4491fc[_0xa5f4('0x49')],null))[_0xa5f4('0x24')](respondWithResult(_0x516cd1,null))[_0xa5f4('0x45')](handleError(_0x516cd1,null));};exports[_0xa5f4('0x25')]=function(_0x528250,_0x21cd1f){return db[_0xa5f4('0x42')][_0xa5f4('0x4e')]({'where':{'id':_0x528250[_0xa5f4('0x47')]['id']}})[_0xa5f4('0x24')](handleEntityNotFound(_0x21cd1f,null))[_0xa5f4('0x24')](removeEntity(_0x21cd1f,null))[_0xa5f4('0x45')](handleError(_0x21cd1f,null));};exports[_0xa5f4('0x58')]=function(_0x326642,_0x480e73,_0x322109){var _0x4ca81f={'raw':!![],'where':{}};var _0x4423ab={};var _0x4b6dbb={'count':0x0,'rows':[]};return db[_0xa5f4('0x42')][_0xa5f4('0x59')]({'where':{'id':_0x326642[_0xa5f4('0x47')]['id']}})[_0xa5f4('0x24')](handleEntityNotFound(_0x480e73,null))['then'](function(_0x5cc502){if(_0x5cc502){_0x4423ab[_0xa5f4('0x31')]=_[_0xa5f4('0x48')](db[_0xa5f4('0x5a')]['rawAttributes']);_0x4423ab[_0xa5f4('0x32')]=_['keys'](_0x326642[_0xa5f4('0x32')]);_0x4423ab[_0xa5f4('0x33')]=_[_0xa5f4('0x34')](_0x4423ab['model'],_0x4423ab[_0xa5f4('0x32')]);_0x4ca81f['attributes']=_[_0xa5f4('0x34')](_0x4423ab['model'],qs['fields'](_0x326642[_0xa5f4('0x32')][_0xa5f4('0x36')]));_0x4ca81f[_0xa5f4('0x35')]=_0x4ca81f[_0xa5f4('0x35')][_0xa5f4('0x52')]?_0x4ca81f[_0xa5f4('0x35')]:_0x4423ab[_0xa5f4('0x31')];if(!_0x326642[_0xa5f4('0x32')][_0xa5f4('0x37')](_0xa5f4('0x38'))){_0x4ca81f[_0xa5f4('0x1f')]=qs[_0xa5f4('0x1f')](_0x326642['query'][_0xa5f4('0x1f')]);_0x4ca81f[_0xa5f4('0x1c')]=qs['offset'](_0x326642['query'][_0xa5f4('0x1c')]);}_0x4ca81f['order']=qs[_0xa5f4('0x3a')](_0x326642['query'][_0xa5f4('0x3a')]);_0x4ca81f['where']=qs[_0xa5f4('0x33')](_[_0xa5f4('0x5b')](_0x326642['query'],_0x4423ab[_0xa5f4('0x33')]));_0x4ca81f['where'][_0xa5f4('0x5c')]=_0x5cc502['id'];if(_0x326642[_0xa5f4('0x32')][_0xa5f4('0x3c')]){_0x4ca81f[_0xa5f4('0x3b')]=_['merge'](_0x4ca81f['where'],{'$or':_['map'](_0x4ca81f['attributes'],function(_0x20f9e7){var _0x44bf72={};_0x44bf72[_0x20f9e7]={'$like':'%'+_0x326642['query'][_0xa5f4('0x3c')]+'%'};return _0x44bf72;})});}_0x4ca81f=_[_0xa5f4('0x3d')]({},_0x4ca81f,_0x326642[_0xa5f4('0x3f')]);return db[_0xa5f4('0x5a')][_0xa5f4('0x1e')]({'where':_0x4ca81f[_0xa5f4('0x3b')]})[_0xa5f4('0x24')](function(_0xf83b37){_0x4b6dbb[_0xa5f4('0x1e')]=_0xf83b37;if(_0x326642[_0xa5f4('0x32')][_0xa5f4('0x40')]){_0x4ca81f[_0xa5f4('0x41')]=[{'all':!![]}];}return db[_0xa5f4('0x5a')]['findAll'](_0x4ca81f);})[_0xa5f4('0x24')](function(_0x5372b8){_0x4b6dbb['rows']=_0x5372b8;return _0x4b6dbb;});}})[_0xa5f4('0x24')](respondWithFilteredResult(_0x480e73,_0x4ca81f))[_0xa5f4('0x45')](handleError(_0x480e73,null));};exports[_0xa5f4('0x5d')]=function(_0x508a78,_0xe39ac5,_0x2bd3b2){var _0x58a182={'raw':!![],'where':{}};var _0x3c94b6={};var _0x5071ad={'count':0x0,'rows':[]};return db[_0xa5f4('0x42')]['findOne']({'where':{'id':_0x508a78[_0xa5f4('0x47')]['id']}})[_0xa5f4('0x24')](handleEntityNotFound(_0xe39ac5,null))[_0xa5f4('0x24')](function(_0x55ffa5){if(_0x55ffa5){_0x3c94b6[_0xa5f4('0x31')]=_[_0xa5f4('0x48')](db[_0xa5f4('0x5e')]['rawAttributes']);_0x3c94b6[_0xa5f4('0x32')]=_[_0xa5f4('0x48')](_0x508a78[_0xa5f4('0x32')]);_0x3c94b6['filters']=_[_0xa5f4('0x34')](_0x3c94b6['model'],_0x3c94b6[_0xa5f4('0x32')]);_0x58a182['attributes']=_[_0xa5f4('0x34')](_0x3c94b6[_0xa5f4('0x31')],qs[_0xa5f4('0x36')](_0x508a78[_0xa5f4('0x32')][_0xa5f4('0x36')]));_0x58a182['attributes']=_0x58a182[_0xa5f4('0x35')]['length']?_0x58a182[_0xa5f4('0x35')]:_0x3c94b6[_0xa5f4('0x31')];if(!_0x508a78[_0xa5f4('0x32')][_0xa5f4('0x37')]('nolimit')){_0x58a182['limit']=qs[_0xa5f4('0x1f')](_0x508a78[_0xa5f4('0x32')][_0xa5f4('0x1f')]);_0x58a182[_0xa5f4('0x1c')]=qs[_0xa5f4('0x1c')](_0x508a78['query'][_0xa5f4('0x1c')]);}_0x58a182[_0xa5f4('0x39')]=qs[_0xa5f4('0x3a')](_0x508a78['query'][_0xa5f4('0x3a')]);_0x58a182[_0xa5f4('0x3b')]=qs['filters'](_['pick'](_0x508a78[_0xa5f4('0x32')],_0x3c94b6[_0xa5f4('0x33')]));_0x58a182[_0xa5f4('0x3b')][_0xa5f4('0x5c')]=_0x55ffa5['id'];if(_0x508a78[_0xa5f4('0x32')][_0xa5f4('0x3c')]){_0x58a182[_0xa5f4('0x3b')]=_[_0xa5f4('0x3d')](_0x58a182[_0xa5f4('0x3b')],{'$or':_[_0xa5f4('0x2c')](_0x58a182['attributes'],function(_0x213425){var _0x3abe3c={};_0x3abe3c[_0x213425]={'$like':'%'+_0x508a78[_0xa5f4('0x32')]['filter']+'%'};return _0x3abe3c;})});}_0x58a182=_['merge']({},_0x58a182,_0x508a78[_0xa5f4('0x3f')]);return db[_0xa5f4('0x5e')][_0xa5f4('0x1e')]({'where':_0x58a182['where']})[_0xa5f4('0x24')](function(_0x12e9f7){_0x5071ad['count']=_0x12e9f7;if(_0x508a78[_0xa5f4('0x32')][_0xa5f4('0x40')]){_0x58a182[_0xa5f4('0x41')]=[{'all':!![]}];}return db[_0xa5f4('0x5e')][_0xa5f4('0x43')](_0x58a182);})[_0xa5f4('0x24')](function(_0x277eda){_0x5071ad[_0xa5f4('0x44')]=_0x277eda;return _0x5071ad;});}})[_0xa5f4('0x24')](respondWithFilteredResult(_0xe39ac5,_0x58a182))['catch'](handleError(_0xe39ac5,null));};exports[_0xa5f4('0x5f')]=function(_0x19a0d4,_0x1b9592,_0x2f4b66){var _0x395862={'raw':!![],'where':{}};var _0x4aa7ef={};var _0x3abf6d={'count':0x0,'rows':[]};return db[_0xa5f4('0x42')][_0xa5f4('0x59')]({'where':{'id':_0x19a0d4['params']['id']}})[_0xa5f4('0x24')](handleEntityNotFound(_0x1b9592,null))[_0xa5f4('0x24')](function(_0x4eb540){if(_0x4eb540){_0x4aa7ef['model']=_[_0xa5f4('0x48')](db[_0xa5f4('0x60')][_0xa5f4('0x2d')]);_0x4aa7ef['query']=_[_0xa5f4('0x48')](_0x19a0d4[_0xa5f4('0x32')]);_0x4aa7ef[_0xa5f4('0x33')]=_[_0xa5f4('0x34')](_0x4aa7ef[_0xa5f4('0x31')],_0x4aa7ef[_0xa5f4('0x32')]);_0x395862[_0xa5f4('0x35')]=_[_0xa5f4('0x34')](_0x4aa7ef['model'],qs[_0xa5f4('0x36')](_0x19a0d4['query'][_0xa5f4('0x36')]));_0x395862[_0xa5f4('0x35')]=_0x395862['attributes'][_0xa5f4('0x52')]?_0x395862[_0xa5f4('0x35')]:_0x4aa7ef[_0xa5f4('0x31')];if(!_0x19a0d4[_0xa5f4('0x32')]['hasOwnProperty'](_0xa5f4('0x38'))){_0x395862[_0xa5f4('0x1f')]=qs['limit'](_0x19a0d4[_0xa5f4('0x32')][_0xa5f4('0x1f')]);_0x395862[_0xa5f4('0x1c')]=qs['offset'](_0x19a0d4[_0xa5f4('0x32')]['offset']);}_0x395862['order']=qs[_0xa5f4('0x3a')](_0x19a0d4['query'][_0xa5f4('0x3a')]);_0x395862[_0xa5f4('0x3b')]=qs['filters'](_[_0xa5f4('0x5b')](_0x19a0d4[_0xa5f4('0x32')],_0x4aa7ef[_0xa5f4('0x33')]));_0x395862['where'][_0xa5f4('0x5c')]=_0x4eb540['id'];if(_0x19a0d4[_0xa5f4('0x32')]['filter']){_0x395862[_0xa5f4('0x3b')]=_[_0xa5f4('0x3d')](_0x395862['where'],{'$or':_[_0xa5f4('0x2c')](_0x395862[_0xa5f4('0x35')],function(_0x3e49c6){var _0x228a07={};_0x228a07[_0x3e49c6]={'$like':'%'+_0x19a0d4[_0xa5f4('0x32')][_0xa5f4('0x3c')]+'%'};return _0x228a07;})});}_0x395862=_['merge']({},_0x395862,_0x19a0d4[_0xa5f4('0x3f')]);return db[_0xa5f4('0x60')][_0xa5f4('0x1e')]({'where':_0x395862[_0xa5f4('0x3b')]})[_0xa5f4('0x24')](function(_0xff22b5){_0x3abf6d[_0xa5f4('0x1e')]=_0xff22b5;if(_0x19a0d4[_0xa5f4('0x32')]['includeAll']){_0x395862[_0xa5f4('0x41')]=[{'all':!![]}];}return db[_0xa5f4('0x60')]['findAll'](_0x395862);})['then'](function(_0x452f5f){_0x3abf6d[_0xa5f4('0x44')]=_0x452f5f;return _0x3abf6d;});}})[_0xa5f4('0x24')](respondWithFilteredResult(_0x1b9592,_0x395862))[_0xa5f4('0x45')](handleError(_0x1b9592,null));};exports['getHopperBlacks']=function(_0x23b585,_0x58f39d,_0xee3563){var _0x5348f9={'raw':!![],'where':{}};var _0x3f236d={};var _0xf8b0c8={'count':0x0,'rows':[]};return db[_0xa5f4('0x42')][_0xa5f4('0x59')]({'where':{'id':_0x23b585[_0xa5f4('0x47')]['id']}})[_0xa5f4('0x24')](handleEntityNotFound(_0x58f39d,null))[_0xa5f4('0x24')](function(_0x364b28){if(_0x364b28){_0x3f236d[_0xa5f4('0x31')]=_[_0xa5f4('0x48')](db['CmHopperBlack'][_0xa5f4('0x2d')]);_0x3f236d[_0xa5f4('0x32')]=_[_0xa5f4('0x48')](_0x23b585['query']);_0x3f236d[_0xa5f4('0x33')]=_[_0xa5f4('0x34')](_0x3f236d[_0xa5f4('0x31')],_0x3f236d[_0xa5f4('0x32')]);_0x5348f9[_0xa5f4('0x35')]=_['intersection'](_0x3f236d[_0xa5f4('0x31')],qs[_0xa5f4('0x36')](_0x23b585[_0xa5f4('0x32')][_0xa5f4('0x36')]));_0x5348f9[_0xa5f4('0x35')]=_0x5348f9[_0xa5f4('0x35')][_0xa5f4('0x52')]?_0x5348f9[_0xa5f4('0x35')]:_0x3f236d['model'];if(!_0x23b585[_0xa5f4('0x32')][_0xa5f4('0x37')]('nolimit')){_0x5348f9[_0xa5f4('0x1f')]=qs[_0xa5f4('0x1f')](_0x23b585['query'][_0xa5f4('0x1f')]);_0x5348f9[_0xa5f4('0x1c')]=qs[_0xa5f4('0x1c')](_0x23b585[_0xa5f4('0x32')]['offset']);}_0x5348f9[_0xa5f4('0x39')]=qs[_0xa5f4('0x3a')](_0x23b585[_0xa5f4('0x32')][_0xa5f4('0x3a')]);_0x5348f9[_0xa5f4('0x3b')]=qs[_0xa5f4('0x33')](_[_0xa5f4('0x5b')](_0x23b585[_0xa5f4('0x32')],_0x3f236d['filters']));_0x5348f9[_0xa5f4('0x3b')][_0xa5f4('0x5c')]=_0x364b28['id'];if(_0x23b585[_0xa5f4('0x32')][_0xa5f4('0x3c')]){_0x5348f9['where']=_[_0xa5f4('0x3d')](_0x5348f9[_0xa5f4('0x3b')],{'$or':_['map'](_0x5348f9['attributes'],function(_0x901d6c){var _0x5895f4={};_0x5895f4[_0x901d6c]={'$like':'%'+_0x23b585[_0xa5f4('0x32')][_0xa5f4('0x3c')]+'%'};return _0x5895f4;})});}_0x5348f9=_[_0xa5f4('0x3d')]({},_0x5348f9,_0x23b585['options']);return db[_0xa5f4('0x61')][_0xa5f4('0x1e')]({'where':_0x5348f9[_0xa5f4('0x3b')]})[_0xa5f4('0x24')](function(_0x517671){_0xf8b0c8[_0xa5f4('0x1e')]=_0x517671;if(_0x23b585[_0xa5f4('0x32')][_0xa5f4('0x40')]){_0x5348f9[_0xa5f4('0x41')]=[{'all':!![]}];}return db[_0xa5f4('0x61')][_0xa5f4('0x43')](_0x5348f9);})[_0xa5f4('0x24')](function(_0x4471ce){_0xf8b0c8[_0xa5f4('0x44')]=_0x4471ce;return _0xf8b0c8;});}})[_0xa5f4('0x24')](respondWithFilteredResult(_0x58f39d,_0x5348f9))[_0xa5f4('0x45')](handleError(_0x58f39d,null));};exports[_0xa5f4('0x62')]=function(_0x5ab81e,_0x2bee1a,_0x34d40a){var _0x58138b={};var _0x208521={};var _0x2a3d43;var _0x4d7ae2;return db[_0xa5f4('0x42')][_0xa5f4('0x59')]({'where':{'id':_0x5ab81e[_0xa5f4('0x47')]['id']}})[_0xa5f4('0x24')](handleEntityNotFound(_0x2bee1a,null))['then'](function(_0x2a34bf){if(_0x2a34bf){_0x2a3d43=_0x2a34bf;_0x208521[_0xa5f4('0x31')]=_[_0xa5f4('0x48')](db[_0xa5f4('0x63')][_0xa5f4('0x2d')]);_0x208521[_0xa5f4('0x32')]=_[_0xa5f4('0x48')](_0x5ab81e[_0xa5f4('0x32')]);_0x208521[_0xa5f4('0x33')]=_[_0xa5f4('0x34')](_0x208521[_0xa5f4('0x31')],_0x208521[_0xa5f4('0x32')]);_0x58138b['attributes']=_[_0xa5f4('0x34')](_0x208521[_0xa5f4('0x31')],qs[_0xa5f4('0x36')](_0x5ab81e['query'][_0xa5f4('0x36')]));_0x58138b[_0xa5f4('0x35')]=_0x58138b[_0xa5f4('0x35')][_0xa5f4('0x52')]?_0x58138b[_0xa5f4('0x35')]:_0x208521[_0xa5f4('0x31')];_0x58138b[_0xa5f4('0x39')]=qs['sort'](_0x5ab81e[_0xa5f4('0x32')][_0xa5f4('0x3a')]);_0x58138b[_0xa5f4('0x3b')]=qs[_0xa5f4('0x33')](_[_0xa5f4('0x5b')](_0x5ab81e['query'],_0x208521[_0xa5f4('0x33')]));if(_0x5ab81e[_0xa5f4('0x32')][_0xa5f4('0x3c')]){_0x58138b[_0xa5f4('0x3b')]=_[_0xa5f4('0x3d')](_0x58138b[_0xa5f4('0x3b')],{'$or':_['map'](_0x58138b[_0xa5f4('0x35')],function(_0x3208f6){var _0x18f171={};_0x18f171[_0x3208f6]={'$like':'%'+_0x5ab81e['query'][_0xa5f4('0x3c')]+'%'};return _0x18f171;})});}_0x58138b=_[_0xa5f4('0x3d')]({},_0x58138b,_0x5ab81e['options']);return _0x2a3d43[_0xa5f4('0x62')](_0x58138b);}})['then'](function(_0x3e008d){if(_0x3e008d){_0x4d7ae2=_0x3e008d[_0xa5f4('0x52')];if(!_0x5ab81e[_0xa5f4('0x32')][_0xa5f4('0x37')](_0xa5f4('0x38'))){_0x58138b[_0xa5f4('0x1f')]=qs[_0xa5f4('0x1f')](_0x5ab81e[_0xa5f4('0x32')]['limit']);_0x58138b['offset']=qs[_0xa5f4('0x1c')](_0x5ab81e['query'][_0xa5f4('0x1c')]);}return _0x2a3d43['getLists'](_0x58138b);}})[_0xa5f4('0x24')](function(_0x2730a9){if(_0x2730a9){return _0x2730a9?{'count':_0x4d7ae2,'rows':_0x2730a9}:null;}})[_0xa5f4('0x24')](respondWithResult(_0x2bee1a,null))[_0xa5f4('0x45')](handleError(_0x2bee1a,null));};exports[_0xa5f4('0x64')]=function(_0x4fce68,_0xad8d08,_0x2251af){var _0x47e897,_0x22c31f;return db['Campaign'][_0xa5f4('0x4e')]({'where':{'id':_0x4fce68[_0xa5f4('0x47')]['id']}})['then'](handleEntityNotFound(_0xad8d08,null))[_0xa5f4('0x24')](function(_0x235e17){if(_0x235e17){_0x22c31f=_0x235e17;return _0x235e17['addLists'](_0x4fce68[_0xa5f4('0x49')][_0xa5f4('0x65')],_['omit'](_0x4fce68['body'],['ids','id'])||{});}return null;})[_0xa5f4('0x66')](function(_0x5bac1c){var _0x477555;_0x47e897=_0x5bac1c||[];var _0x756ee6=[];if(_0x5bac1c){for(var _0x45744d=0x0;_0x45744d<_0x5bac1c[_0xa5f4('0x52')];_0x45744d+=0x1){var _0x3e53e8=_0x5bac1c[_0x45744d][_0xa5f4('0x4b')]({'plain':!![]});_0x22c31f[_0xa5f4('0x67')]=_0x4fce68['body'][_0xa5f4('0x67')]?_0x4fce68[_0xa5f4('0x49')][_0xa5f4('0x67')]:_0x22c31f[_0xa5f4('0x67')];switch(_0x22c31f[_0xa5f4('0x67')]){case'always':_0x477555=squel[_0xa5f4('0x68')]()[_0xa5f4('0x69')](_0xa5f4('0x6a'))[_0xa5f4('0x6b')]([_0xa5f4('0x6c'),_0xa5f4('0x6d'),_0xa5f4('0x6e'),_0xa5f4('0x6f'),_0xa5f4('0x5c'),_0xa5f4('0x54'),_0xa5f4('0x55')],squel['select']()[_0xa5f4('0x70')](_0xa5f4('0x6c'),'phone')[_0xa5f4('0x70')](_0xa5f4('0x71'),_0xa5f4('0x6d'))['field']('id','ContactId')[_0xa5f4('0x70')](_0x3e53e8[_0xa5f4('0x72')][_0xa5f4('0x73')](),_0xa5f4('0x6f'))['field'](_0x4fce68[_0xa5f4('0x47')]['id'][_0xa5f4('0x73')](),'CampaignId')[_0xa5f4('0x70')]('NOW()',_0xa5f4('0x54'))[_0xa5f4('0x70')]('NOW()',_0xa5f4('0x55'))['from'](_0xa5f4('0x74'))[_0xa5f4('0x3b')](_0xa5f4('0x75'))[_0xa5f4('0x3b')](_0xa5f4('0x76'),_0x3e53e8['CmListId'][_0xa5f4('0x73')]())[_0xa5f4('0x3b')](_0xa5f4('0x77'))[_0xa5f4('0x3b')](_0xa5f4('0x78'),squel['select']()[_0xa5f4('0x70')]('COALESCE(calleridnum,\x27\x27)')[_0xa5f4('0x79')](_0xa5f4('0x7a'))['where'](_0xa5f4('0x7b'),_0x4fce68[_0xa5f4('0x47')]['id'][_0xa5f4('0x73')]()))['where'](_0xa5f4('0x78'),squel['select']()[_0xa5f4('0x70')](_0xa5f4('0x7c'))[_0xa5f4('0x79')](_0xa5f4('0x6a'))['where']('CampaignId\x20=\x20?',_0x4fce68[_0xa5f4('0x47')]['id'][_0xa5f4('0x73')]())))[_0xa5f4('0x73')]();break;case'onlyIfOpen':_0x477555=squel[_0xa5f4('0x68')]()[_0xa5f4('0x69')](_0xa5f4('0x6a'))[_0xa5f4('0x6b')]([_0xa5f4('0x6c'),_0xa5f4('0x6d'),_0xa5f4('0x6e'),_0xa5f4('0x6f'),_0xa5f4('0x5c'),_0xa5f4('0x54'),'updatedAt'],squel[_0xa5f4('0x7d')]()['field']('phone',_0xa5f4('0x6c'))[_0xa5f4('0x70')](_0xa5f4('0x71'),_0xa5f4('0x6d'))[_0xa5f4('0x70')]('id','ContactId')[_0xa5f4('0x70')](_0x3e53e8[_0xa5f4('0x72')]['toString'](),_0xa5f4('0x6f'))[_0xa5f4('0x70')](_0x4fce68[_0xa5f4('0x47')]['id'][_0xa5f4('0x73')](),'CampaignId')[_0xa5f4('0x70')]('NOW()','createdAt')[_0xa5f4('0x70')](_0xa5f4('0x71'),_0xa5f4('0x55'))[_0xa5f4('0x79')](_0xa5f4('0x74'))['where'](_0xa5f4('0x75'))[_0xa5f4('0x3b')](_0xa5f4('0x76'),_0x3e53e8[_0xa5f4('0x72')]['toString']())['where'](_0xa5f4('0x77'))[_0xa5f4('0x3b')](_0xa5f4('0x78'),squel[_0xa5f4('0x7d')]()[_0xa5f4('0x70')](_0xa5f4('0x7c'))['from'](_0xa5f4('0x6a'))[_0xa5f4('0x3b')]('CampaignId\x20=\x20?',_0x4fce68['params']['id'][_0xa5f4('0x73')]())))[_0xa5f4('0x73')]();break;default:_0x477555=squel[_0xa5f4('0x68')]()['into'](_0xa5f4('0x6a'))[_0xa5f4('0x6b')]([_0xa5f4('0x6c'),_0xa5f4('0x6d'),_0xa5f4('0x6e'),_0xa5f4('0x6f'),_0xa5f4('0x5c'),_0xa5f4('0x54'),_0xa5f4('0x55')],squel[_0xa5f4('0x7d')]()[_0xa5f4('0x70')](_0xa5f4('0x6c'),_0xa5f4('0x6c'))[_0xa5f4('0x70')](_0xa5f4('0x71'),'scheduledAt')[_0xa5f4('0x70')]('id',_0xa5f4('0x6e'))[_0xa5f4('0x70')](_0x3e53e8[_0xa5f4('0x72')][_0xa5f4('0x73')](),'ListId')[_0xa5f4('0x70')](_0x4fce68[_0xa5f4('0x47')]['id'][_0xa5f4('0x73')](),_0xa5f4('0x5c'))[_0xa5f4('0x70')](_0xa5f4('0x71'),_0xa5f4('0x54'))[_0xa5f4('0x70')]('NOW()','updatedAt')['from'](_0xa5f4('0x74'))[_0xa5f4('0x3b')](_0xa5f4('0x75'))['where'](_0xa5f4('0x76'),_0x3e53e8['CmListId'][_0xa5f4('0x73')]())[_0xa5f4('0x3b')](_0xa5f4('0x77')))['toString']();}_0x756ee6['push'](db['sequelize'][_0xa5f4('0x32')](_0x477555));}return BPromise[_0xa5f4('0x7e')](_0x756ee6);}})[_0xa5f4('0x24')](function(){return _0x47e897;})[_0xa5f4('0x24')](respondWithResult(_0xad8d08,null))['catch'](handleError(_0xad8d08,null));};exports[_0xa5f4('0x7f')]=function(_0x253ef3,_0x162fc0,_0x4bcca3){return db[_0xa5f4('0x42')][_0xa5f4('0x4e')]({'where':{'id':_0x253ef3[_0xa5f4('0x47')]['id']}})[_0xa5f4('0x24')](handleEntityNotFound(_0x162fc0,null))['then'](function(_0x532a55){if(_0x532a55){return _0x532a55['removeLists'](_0x253ef3[_0xa5f4('0x32')][_0xa5f4('0x65')]);}})[_0xa5f4('0x24')](function(_0x330e51){if(_0x330e51){return db[_0xa5f4('0x5a')]['destroy']({'where':{'ListId':_0x253ef3['query']['ids'],'CampaignId':_0x253ef3[_0xa5f4('0x47')]['id']}})['then'](function(){return _0x330e51;});}})['then'](respondWithStatusCode(_0x162fc0,null))[_0xa5f4('0x45')](handleError(_0x162fc0,null));};exports[_0xa5f4('0x80')]=function(_0x4a651e,_0x4a9383,_0x5818dd){var _0x14877b={};var _0x5819f4={};var _0x21999b;var _0x2d4657;return db[_0xa5f4('0x42')][_0xa5f4('0x59')]({'where':{'id':_0x4a651e['params']['id']}})['then'](handleEntityNotFound(_0x4a9383,null))[_0xa5f4('0x24')](function(_0x44a13f){if(_0x44a13f){_0x21999b=_0x44a13f;_0x5819f4[_0xa5f4('0x31')]=_['keys'](db[_0xa5f4('0x63')][_0xa5f4('0x2d')]);_0x5819f4['query']=_[_0xa5f4('0x48')](_0x4a651e[_0xa5f4('0x32')]);_0x5819f4[_0xa5f4('0x33')]=_['intersection'](_0x5819f4['model'],_0x5819f4[_0xa5f4('0x32')]);_0x14877b['attributes']=_[_0xa5f4('0x34')](_0x5819f4[_0xa5f4('0x31')],qs[_0xa5f4('0x36')](_0x4a651e['query']['fields']));_0x14877b[_0xa5f4('0x35')]=_0x14877b[_0xa5f4('0x35')][_0xa5f4('0x52')]?_0x14877b[_0xa5f4('0x35')]:_0x5819f4[_0xa5f4('0x31')];_0x14877b['order']=qs[_0xa5f4('0x3a')](_0x4a651e[_0xa5f4('0x32')][_0xa5f4('0x3a')]);_0x14877b['where']=qs[_0xa5f4('0x33')](_[_0xa5f4('0x5b')](_0x4a651e[_0xa5f4('0x32')],_0x5819f4[_0xa5f4('0x33')]));if(_0x4a651e[_0xa5f4('0x32')]['filter']){_0x14877b[_0xa5f4('0x3b')]=_[_0xa5f4('0x3d')](_0x14877b['where'],{'$or':_[_0xa5f4('0x2c')](_0x14877b[_0xa5f4('0x35')],function(_0xc4b4c1){var _0x389671={};_0x389671[_0xc4b4c1]={'$like':'%'+_0x4a651e[_0xa5f4('0x32')][_0xa5f4('0x3c')]+'%'};return _0x389671;})});}_0x14877b=_['merge']({},_0x14877b,_0x4a651e[_0xa5f4('0x3f')]);return _0x21999b[_0xa5f4('0x80')](_0x14877b);}})[_0xa5f4('0x24')](function(_0x41ded1){if(_0x41ded1){_0x2d4657=_0x41ded1['length'];if(!_0x4a651e[_0xa5f4('0x32')]['hasOwnProperty'](_0xa5f4('0x38'))){_0x14877b[_0xa5f4('0x1f')]=qs[_0xa5f4('0x1f')](_0x4a651e[_0xa5f4('0x32')][_0xa5f4('0x1f')]);_0x14877b['offset']=qs[_0xa5f4('0x1c')](_0x4a651e['query'][_0xa5f4('0x1c')]);}return _0x21999b['getBlackLists'](_0x14877b);}})[_0xa5f4('0x24')](function(_0x1c55a2){if(_0x1c55a2){return _0x1c55a2?{'count':_0x2d4657,'rows':_0x1c55a2}:null;}})[_0xa5f4('0x24')](respondWithResult(_0x4a9383,null))[_0xa5f4('0x45')](handleError(_0x4a9383,null));};exports[_0xa5f4('0x81')]=function(_0xb6bf9,_0x403a47,_0x5cf5d2){var _0x4bd93f,_0x394dfa;return db[_0xa5f4('0x42')]['find']({'where':{'id':_0xb6bf9[_0xa5f4('0x47')]['id']}})[_0xa5f4('0x24')](handleEntityNotFound(_0x403a47,null))['then'](function(_0x319871){if(_0x319871){_0x394dfa=_0x319871;return _0x319871[_0xa5f4('0x81')](_0xb6bf9[_0xa5f4('0x49')][_0xa5f4('0x65')],_[_0xa5f4('0x53')](_0xb6bf9[_0xa5f4('0x49')],['ids','id'])||{});}return null;})[_0xa5f4('0x66')](function(_0x4fbc7e){var _0x2fe11d;_0x4bd93f=_0x4fbc7e||[];var _0x48a244=[];if(_0x4fbc7e){for(var _0x33a244=0x0;_0x33a244<_0x4fbc7e[_0xa5f4('0x52')];_0x33a244+=0x1){var _0xb0916=_0x4fbc7e[_0x33a244][_0xa5f4('0x4b')]({'plain':!![]});_0x2fe11d=squel[_0xa5f4('0x68')]()[_0xa5f4('0x69')](_0xa5f4('0x82'))[_0xa5f4('0x6b')]([_0xa5f4('0x6c'),_0xa5f4('0x6e'),_0xa5f4('0x6f'),_0xa5f4('0x5c'),_0xa5f4('0x54'),_0xa5f4('0x55')],squel[_0xa5f4('0x7d')]()[_0xa5f4('0x70')](_0xa5f4('0x6c'),_0xa5f4('0x6c'))['field']('id','ContactId')[_0xa5f4('0x70')](_0xb0916['CmListId'][_0xa5f4('0x73')](),_0xa5f4('0x6f'))[_0xa5f4('0x70')](_0xb6bf9[_0xa5f4('0x47')]['id'][_0xa5f4('0x73')](),_0xa5f4('0x5c'))[_0xa5f4('0x70')](_0xa5f4('0x71'),_0xa5f4('0x54'))[_0xa5f4('0x70')]('NOW()',_0xa5f4('0x55'))[_0xa5f4('0x79')](_0xa5f4('0x74'))[_0xa5f4('0x3b')](_0xa5f4('0x75'))[_0xa5f4('0x3b')](_0xa5f4('0x76'),_0xb0916[_0xa5f4('0x72')][_0xa5f4('0x73')]())[_0xa5f4('0x3b')](_0xa5f4('0x77')))[_0xa5f4('0x73')]();_0x48a244[_0xa5f4('0x83')](db[_0xa5f4('0x84')]['query'](_0x2fe11d));}return BPromise[_0xa5f4('0x7e')](_0x48a244);}})[_0xa5f4('0x24')](function(){return _0x4bd93f;})[_0xa5f4('0x24')](respondWithResult(_0x403a47,null))[_0xa5f4('0x45')](handleError(_0x403a47,null));};exports['removeBlackLists']=function(_0x9c3adf,_0x14e05a,_0x9bf7ac){return db[_0xa5f4('0x42')][_0xa5f4('0x4e')]({'where':{'id':_0x9c3adf[_0xa5f4('0x47')]['id']}})[_0xa5f4('0x24')](handleEntityNotFound(_0x14e05a,null))['then'](function(_0x51f733){if(_0x51f733){return _0x51f733[_0xa5f4('0x85')](_0x9c3adf['query'][_0xa5f4('0x65')]);}})[_0xa5f4('0x24')](function(_0x276f6e){if(_0x276f6e){return db[_0xa5f4('0x61')][_0xa5f4('0x25')]({'where':{'ListId':_0x9c3adf[_0xa5f4('0x32')][_0xa5f4('0x65')],'CampaignId':_0x9c3adf[_0xa5f4('0x47')]['id']}})[_0xa5f4('0x24')](function(){return _0x276f6e;});}})[_0xa5f4('0x24')](respondWithStatusCode(_0x14e05a,null))[_0xa5f4('0x45')](handleError(_0x14e05a,null));}; \ No newline at end of file +var _0x5655=['name','send','index','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','type','VIRTUAL','merge','options','Campaign','includeAll','include','findAll','rows','catch','show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','IvrCampaigns','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','body','omit','role','autoAssociation','getHoppers','findOne','CmHopper','sort','CampaignId','CmHopperHistory','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','phone','NOW()','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','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','push','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','apply','save','update','then','destroy','get','error'];(function(_0x1dce50,_0x107a7b){var _0x149922=function(_0x4008f6){while(--_0x4008f6){_0x1dce50['push'](_0x1dce50['shift']());}};_0x149922(++_0x107a7b);}(_0x5655,0x16e));var _0x5565=function(_0x5d4b4f,_0x20e9a0){_0x5d4b4f=_0x5d4b4f-0x0;var _0x53c2eb=_0x5655[_0x5d4b4f];return _0x53c2eb;};'use strict';var emlformat=require(_0x5565('0x0'));var rimraf=require(_0x5565('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5565('0x2'));var rp=require(_0x5565('0x3'));var moment=require('moment');var BPromise=require(_0x5565('0x4'));var Mustache=require(_0x5565('0x5'));var util=require(_0x5565('0x6'));var path=require(_0x5565('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5565('0x8'));var fs=require('fs');var fs_extra=require(_0x5565('0x9'));var _=require(_0x5565('0xa'));var squel=require(_0x5565('0xb'));var crypto=require(_0x5565('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5565('0xd'));var toCsv=require(_0x5565('0xe'));var querystring=require('querystring');var Papa=require(_0x5565('0xf'));var Redis=require(_0x5565('0x10'));var authService=require(_0x5565('0x11'));var qs=require(_0x5565('0x12'));var as=require(_0x5565('0x13'));var hardwareService=require(_0x5565('0x14'));var logger=require(_0x5565('0x15'))('api');var utils=require(_0x5565('0x16'));var config=require(_0x5565('0x17'));var licenseUtil=require(_0x5565('0x18'));var db=require(_0x5565('0x19'))['db'];function respondWithStatusCode(_0x110c6c,_0x41b5ec){_0x41b5ec=_0x41b5ec||0xcc;return function(_0x520cef){if(_0x520cef){return _0x110c6c[_0x5565('0x1a')](_0x41b5ec);}return _0x110c6c[_0x5565('0x1b')](_0x41b5ec)[_0x5565('0x1c')]();};}function respondWithResult(_0x329912,_0x68883a){_0x68883a=_0x68883a||0xc8;return function(_0x14e80a){if(_0x14e80a){return _0x329912[_0x5565('0x1b')](_0x68883a)[_0x5565('0x1d')](_0x14e80a);}};}function respondWithFilteredResult(_0x5cf72b,_0x4f085d){return function(_0x38b5aa){if(_0x38b5aa){var _0x434cf3=typeof _0x4f085d['offset']===_0x5565('0x1e')&&typeof _0x4f085d['limit']===_0x5565('0x1e');var _0x1976a9=_0x38b5aa['count'];var _0x45af22=_0x434cf3?0x0:_0x4f085d[_0x5565('0x1f')];var _0x20ef87=_0x434cf3?_0x38b5aa[_0x5565('0x20')]:_0x4f085d[_0x5565('0x1f')]+_0x4f085d[_0x5565('0x21')];var _0x4e3aa7;if(_0x20ef87>=_0x1976a9){_0x20ef87=_0x1976a9;_0x4e3aa7=0xc8;}else{_0x4e3aa7=0xce;}_0x5cf72b['status'](_0x4e3aa7);return _0x5cf72b[_0x5565('0x22')]('Content-Range',_0x45af22+'-'+_0x20ef87+'/'+_0x1976a9)[_0x5565('0x1d')](_0x38b5aa);}return null;};}function patchUpdates(_0x329f1b){return function(_0x55e3ad){try{jsonpatch[_0x5565('0x23')](_0x55e3ad,_0x329f1b,!![]);}catch(_0x40d464){return BPromise['reject'](_0x40d464);}return _0x55e3ad[_0x5565('0x24')]();};}function saveUpdates(_0x1a37f4,_0x420816){return function(_0x508c38){if(_0x508c38){return _0x508c38[_0x5565('0x25')](_0x1a37f4)[_0x5565('0x26')](function(_0x3cb52d){return _0x3cb52d;});}return null;};}function removeEntity(_0x55e69c,_0x19b132){return function(_0x359ed2){if(_0x359ed2){return _0x359ed2[_0x5565('0x27')]()[_0x5565('0x26')](function(){var _0x233226=_0x359ed2[_0x5565('0x28')]({'plain':!![]});var _0x14b284='IvrCampaigns';return db['UserProfileResource'][_0x5565('0x27')]({'where':{'type':_0x14b284,'resourceId':_0x233226['id']}})[_0x5565('0x26')](function(){return _0x359ed2;});})['then'](function(){_0x55e69c[_0x5565('0x1b')](0xcc)[_0x5565('0x1c')]();});}};}function handleEntityNotFound(_0x414744,_0x4e9b34){return function(_0x14e4a2){if(!_0x14e4a2){_0x414744['sendStatus'](0x194);}return _0x14e4a2;};}function handleError(_0x56d68d,_0x4d3b9a){_0x4d3b9a=_0x4d3b9a||0x1f4;return function(_0x3376f7){logger[_0x5565('0x29')](_0x3376f7['stack']);if(_0x3376f7['name']){delete _0x3376f7[_0x5565('0x2a')];}_0x56d68d[_0x5565('0x1b')](_0x4d3b9a)[_0x5565('0x2b')](_0x3376f7);};}exports[_0x5565('0x2c')]=function(_0x238876,_0x4a227b){var _0x372c17={},_0x4393f4={},_0x2dd3b2={'count':0x0,'rows':[]};var _0x1625d7=_['map'](db['Campaign'][_0x5565('0x2d')],function(_0x2b19ab){return{'name':_0x2b19ab[_0x5565('0x2e')],'type':_0x2b19ab['type']['key']};});_0x4393f4[_0x5565('0x2f')]=_[_0x5565('0x30')](_0x1625d7,_0x5565('0x2a'));_0x4393f4[_0x5565('0x31')]=_['keys'](_0x238876[_0x5565('0x31')]);_0x4393f4[_0x5565('0x32')]=_[_0x5565('0x33')](_0x4393f4[_0x5565('0x2f')],_0x4393f4[_0x5565('0x31')]);_0x372c17[_0x5565('0x34')]=_[_0x5565('0x33')](_0x4393f4[_0x5565('0x2f')],qs[_0x5565('0x35')](_0x238876['query'][_0x5565('0x35')]));_0x372c17[_0x5565('0x34')]=_0x372c17['attributes'][_0x5565('0x36')]?_0x372c17['attributes']:_0x4393f4[_0x5565('0x2f')];if(!_0x238876[_0x5565('0x31')][_0x5565('0x37')](_0x5565('0x38'))){_0x372c17[_0x5565('0x21')]=qs[_0x5565('0x21')](_0x238876['query'][_0x5565('0x21')]);_0x372c17[_0x5565('0x1f')]=qs['offset'](_0x238876['query'][_0x5565('0x1f')]);}_0x372c17[_0x5565('0x39')]=qs['sort'](_0x238876[_0x5565('0x31')]['sort']);_0x372c17['where']=qs['filters'](_[_0x5565('0x3a')](_0x238876['query'],_0x4393f4[_0x5565('0x32')]),_0x1625d7);if(_0x238876['query'][_0x5565('0x3b')]){_0x372c17[_0x5565('0x3c')]=_['merge'](_0x372c17['where'],{'$or':_[_0x5565('0x30')](_0x1625d7,function(_0x72c3c5){if(_0x72c3c5[_0x5565('0x3d')]!==_0x5565('0x3e')){var _0x1fe3ce={};_0x1fe3ce[_0x72c3c5['name']]={'$like':'%'+_0x238876['query'][_0x5565('0x3b')]+'%'};return _0x1fe3ce;}})});}_0x372c17=_[_0x5565('0x3f')]({},_0x372c17,_0x238876[_0x5565('0x40')]);var _0x3ae53b={'where':_0x372c17[_0x5565('0x3c')]};return db[_0x5565('0x41')][_0x5565('0x20')](_0x3ae53b)['then'](function(_0x1d056c){_0x2dd3b2[_0x5565('0x20')]=_0x1d056c;if(_0x238876[_0x5565('0x31')][_0x5565('0x42')]){_0x372c17[_0x5565('0x43')]=[{'all':!![]}];}return db[_0x5565('0x41')][_0x5565('0x44')](_0x372c17);})['then'](function(_0x1b1507){_0x2dd3b2[_0x5565('0x45')]=_0x1b1507;return _0x2dd3b2;})['then'](respondWithFilteredResult(_0x4a227b,_0x372c17))[_0x5565('0x46')](handleError(_0x4a227b,null));};exports[_0x5565('0x47')]=function(_0x1f7ced,_0x36e29c){var _0x123121={'raw':![],'where':{'id':_0x1f7ced['params']['id']}},_0x21c712={};_0x21c712[_0x5565('0x2f')]=_[_0x5565('0x48')](db['Campaign']['rawAttributes']);_0x21c712[_0x5565('0x31')]=_[_0x5565('0x48')](_0x1f7ced[_0x5565('0x31')]);_0x21c712['filters']=_[_0x5565('0x33')](_0x21c712[_0x5565('0x2f')],_0x21c712['query']);_0x123121[_0x5565('0x34')]=_[_0x5565('0x33')](_0x21c712['model'],qs[_0x5565('0x35')](_0x1f7ced[_0x5565('0x31')]['fields']));_0x123121[_0x5565('0x34')]=_0x123121[_0x5565('0x34')]['length']?_0x123121['attributes']:_0x21c712[_0x5565('0x2f')];if(_0x1f7ced[_0x5565('0x31')]['includeAll']){_0x123121['include']=[{'all':!![]}];}_0x123121=_['merge']({},_0x123121,_0x1f7ced['options']);return db[_0x5565('0x41')][_0x5565('0x49')](_0x123121)['then'](handleEntityNotFound(_0x36e29c,null))[_0x5565('0x26')](respondWithResult(_0x36e29c,null))[_0x5565('0x46')](handleError(_0x36e29c,null));};exports['create']=function(_0xf4feea,_0x32652f){return db[_0x5565('0x41')][_0x5565('0x4a')](_0xf4feea['body'],{})[_0x5565('0x26')](function(_0x1f102c){var _0x502d8a=_0xf4feea[_0x5565('0x4b')][_0x5565('0x28')]({'plain':!![]});if(!_0x502d8a)throw new Error(_0x5565('0x4c'));if(_0x502d8a['role']===_0x5565('0x4b')){var _0x28151a=_0x1f102c['get']({'plain':!![]});var _0x800c50=_0x5565('0x4d');return db[_0x5565('0x4e')][_0x5565('0x49')]({'where':{'name':_0x800c50,'userProfileId':_0x502d8a[_0x5565('0x4f')]},'raw':!![]})['then'](function(_0x10890f){if(_0x10890f&&_0x10890f['autoAssociation']===0x0){return db[_0x5565('0x50')][_0x5565('0x4a')]({'name':_0x28151a[_0x5565('0x2a')],'resourceId':_0x28151a['id'],'type':_0x10890f[_0x5565('0x2a')],'sectionId':_0x10890f['id']},{})['then'](function(){return _0x1f102c;});}else{return _0x1f102c;}})[_0x5565('0x46')](function(_0xf7b238){logger[_0x5565('0x29')](_0x5565('0x51'),_0xf7b238);throw _0xf7b238;});}return _0x1f102c;})['then'](respondWithResult(_0x32652f,0xc9))[_0x5565('0x46')](handleError(_0x32652f,null));};exports[_0x5565('0x52')]=function(_0x2cca43,_0xabd37b){var _0x2f6310={'where':{'id':_0x2cca43[_0x5565('0x53')]['id']}},_0x380d07={};_0x380d07[_0x5565('0x2f')]=_['keys'](db[_0x5565('0x41')][_0x5565('0x2d')]);_0x2f6310[_0x5565('0x34')]=_[_0x5565('0x33')](_0x380d07[_0x5565('0x2f')],qs[_0x5565('0x35')](_0x2cca43['query']['fields']));_0x2f6310[_0x5565('0x34')]=_0x2f6310[_0x5565('0x34')][_0x5565('0x36')]?_0x2f6310[_0x5565('0x34')]:_0x380d07['model'];if(_0x2cca43[_0x5565('0x31')][_0x5565('0x42')]){_0x2f6310[_0x5565('0x43')]=[{'all':!![]}];}_0x2f6310=_[_0x5565('0x3f')]({},_0x2f6310,_0x2cca43['options']);return db[_0x5565('0x41')]['find'](_0x2f6310)['then'](handleEntityNotFound(_0xabd37b,null))['then'](function(_0x181235){if(_0x181235){var _0x425b48=_0x181235[_0x5565('0x28')]({'plain':!![]});_0x425b48=qs['omit'](_0x425b48,['id',_0x5565('0x54'),_0x5565('0x55')]);_0x2cca43[_0x5565('0x56')]=_[_0x5565('0x57')](_0x2cca43[_0x5565('0x56')],['id','createdAt',_0x5565('0x55')]);return db[_0x5565('0x41')][_0x5565('0x4a')](_[_0x5565('0x3f')](_0x425b48,_0x2cca43[_0x5565('0x56')]),{'include':_0x2cca43[_0x5565('0x31')]['includeAll']?[{'all':!![]}]:undefined})[_0x5565('0x26')](function(_0x13c6ee){var _0xc5350d=_0x2cca43[_0x5565('0x4b')][_0x5565('0x28')]({'plain':!![]});if(!_0xc5350d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc5350d[_0x5565('0x58')]===_0x5565('0x4b')){var _0x20b0aa=_0x13c6ee[_0x5565('0x28')]({'plain':!![]});var _0x15549f=_0x5565('0x4d');return db['UserProfileSection'][_0x5565('0x49')]({'where':{'name':_0x15549f,'userProfileId':_0xc5350d[_0x5565('0x4f')]},'raw':!![]})['then'](function(_0x15cfd8){if(_0x15cfd8&&_0x15cfd8[_0x5565('0x59')]===0x0){return db['UserProfileResource'][_0x5565('0x4a')]({'name':_0x20b0aa[_0x5565('0x2a')],'resourceId':_0x20b0aa['id'],'type':_0x15cfd8[_0x5565('0x2a')],'sectionId':_0x15cfd8['id']},{})['then'](function(){return _0x13c6ee;});}else{return _0x13c6ee;}})[_0x5565('0x46')](function(_0x33da0e){logger[_0x5565('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33da0e);throw _0x33da0e;});}return _0x13c6ee;});}})[_0x5565('0x26')](respondWithResult(_0xabd37b,0xc9))[_0x5565('0x46')](handleError(_0xabd37b,null));};exports[_0x5565('0x25')]=function(_0x46b75b,_0x35a767){if(_0x46b75b[_0x5565('0x56')]['id']){delete _0x46b75b[_0x5565('0x56')]['id'];}return db[_0x5565('0x41')][_0x5565('0x49')]({'where':{'id':_0x46b75b[_0x5565('0x53')]['id']}})[_0x5565('0x26')](handleEntityNotFound(_0x35a767,null))[_0x5565('0x26')](saveUpdates(_0x46b75b[_0x5565('0x56')],null))[_0x5565('0x26')](respondWithResult(_0x35a767,null))[_0x5565('0x46')](handleError(_0x35a767,null));};exports[_0x5565('0x27')]=function(_0x375aed,_0x473f4a){return db[_0x5565('0x41')][_0x5565('0x49')]({'where':{'id':_0x375aed[_0x5565('0x53')]['id']}})[_0x5565('0x26')](handleEntityNotFound(_0x473f4a,null))[_0x5565('0x26')](removeEntity(_0x473f4a,null))[_0x5565('0x46')](handleError(_0x473f4a,null));};exports[_0x5565('0x5a')]=function(_0x1897c4,_0x12a6c0,_0x43ed31){var _0x472cef={'raw':!![],'where':{}};var _0x134e53={};var _0x20710c={'count':0x0,'rows':[]};return db[_0x5565('0x41')][_0x5565('0x5b')]({'where':{'id':_0x1897c4[_0x5565('0x53')]['id']}})[_0x5565('0x26')](handleEntityNotFound(_0x12a6c0,null))[_0x5565('0x26')](function(_0x302e24){if(_0x302e24){_0x134e53[_0x5565('0x2f')]=_[_0x5565('0x48')](db[_0x5565('0x5c')][_0x5565('0x2d')]);_0x134e53[_0x5565('0x31')]=_[_0x5565('0x48')](_0x1897c4[_0x5565('0x31')]);_0x134e53[_0x5565('0x32')]=_[_0x5565('0x33')](_0x134e53[_0x5565('0x2f')],_0x134e53['query']);_0x472cef['attributes']=_[_0x5565('0x33')](_0x134e53[_0x5565('0x2f')],qs[_0x5565('0x35')](_0x1897c4[_0x5565('0x31')][_0x5565('0x35')]));_0x472cef[_0x5565('0x34')]=_0x472cef[_0x5565('0x34')]['length']?_0x472cef['attributes']:_0x134e53['model'];if(!_0x1897c4[_0x5565('0x31')][_0x5565('0x37')](_0x5565('0x38'))){_0x472cef[_0x5565('0x21')]=qs[_0x5565('0x21')](_0x1897c4[_0x5565('0x31')]['limit']);_0x472cef[_0x5565('0x1f')]=qs[_0x5565('0x1f')](_0x1897c4[_0x5565('0x31')][_0x5565('0x1f')]);}_0x472cef[_0x5565('0x39')]=qs[_0x5565('0x5d')](_0x1897c4['query'][_0x5565('0x5d')]);_0x472cef['where']=qs[_0x5565('0x32')](_['pick'](_0x1897c4['query'],_0x134e53['filters']));_0x472cef['where'][_0x5565('0x5e')]=_0x302e24['id'];if(_0x1897c4[_0x5565('0x31')][_0x5565('0x3b')]){_0x472cef[_0x5565('0x3c')]=_[_0x5565('0x3f')](_0x472cef[_0x5565('0x3c')],{'$or':_['map'](_0x472cef['attributes'],function(_0x113d74){var _0x451ca0={};_0x451ca0[_0x113d74]={'$like':'%'+_0x1897c4[_0x5565('0x31')]['filter']+'%'};return _0x451ca0;})});}_0x472cef=_[_0x5565('0x3f')]({},_0x472cef,_0x1897c4[_0x5565('0x40')]);return db['CmHopper'][_0x5565('0x20')]({'where':_0x472cef[_0x5565('0x3c')]})[_0x5565('0x26')](function(_0x40aadb){_0x20710c[_0x5565('0x20')]=_0x40aadb;if(_0x1897c4['query'][_0x5565('0x42')]){_0x472cef[_0x5565('0x43')]=[{'all':!![]}];}return db[_0x5565('0x5c')][_0x5565('0x44')](_0x472cef);})[_0x5565('0x26')](function(_0x2f1579){_0x20710c[_0x5565('0x45')]=_0x2f1579;return _0x20710c;});}})[_0x5565('0x26')](respondWithFilteredResult(_0x12a6c0,_0x472cef))['catch'](handleError(_0x12a6c0,null));};exports['getHopperHistories']=function(_0x26eb30,_0x12543a,_0x3f215d){var _0xa55903={'raw':!![],'where':{}};var _0x4cfa66={};var _0x474212={'count':0x0,'rows':[]};return db[_0x5565('0x41')][_0x5565('0x5b')]({'where':{'id':_0x26eb30['params']['id']}})[_0x5565('0x26')](handleEntityNotFound(_0x12543a,null))[_0x5565('0x26')](function(_0x4e17a9){if(_0x4e17a9){_0x4cfa66[_0x5565('0x2f')]=_['keys'](db[_0x5565('0x5f')]['rawAttributes']);_0x4cfa66[_0x5565('0x31')]=_['keys'](_0x26eb30[_0x5565('0x31')]);_0x4cfa66[_0x5565('0x32')]=_['intersection'](_0x4cfa66['model'],_0x4cfa66[_0x5565('0x31')]);_0xa55903['attributes']=_[_0x5565('0x33')](_0x4cfa66['model'],qs[_0x5565('0x35')](_0x26eb30[_0x5565('0x31')][_0x5565('0x35')]));_0xa55903[_0x5565('0x34')]=_0xa55903[_0x5565('0x34')][_0x5565('0x36')]?_0xa55903[_0x5565('0x34')]:_0x4cfa66[_0x5565('0x2f')];if(!_0x26eb30['query'][_0x5565('0x37')](_0x5565('0x38'))){_0xa55903['limit']=qs['limit'](_0x26eb30[_0x5565('0x31')][_0x5565('0x21')]);_0xa55903[_0x5565('0x1f')]=qs[_0x5565('0x1f')](_0x26eb30[_0x5565('0x31')]['offset']);}_0xa55903[_0x5565('0x39')]=qs[_0x5565('0x5d')](_0x26eb30[_0x5565('0x31')][_0x5565('0x5d')]);_0xa55903[_0x5565('0x3c')]=qs[_0x5565('0x32')](_[_0x5565('0x3a')](_0x26eb30[_0x5565('0x31')],_0x4cfa66[_0x5565('0x32')]));_0xa55903[_0x5565('0x3c')][_0x5565('0x5e')]=_0x4e17a9['id'];if(_0x26eb30['query'][_0x5565('0x3b')]){_0xa55903[_0x5565('0x3c')]=_[_0x5565('0x3f')](_0xa55903[_0x5565('0x3c')],{'$or':_[_0x5565('0x30')](_0xa55903[_0x5565('0x34')],function(_0x31ad2d){var _0x322b80={};_0x322b80[_0x31ad2d]={'$like':'%'+_0x26eb30[_0x5565('0x31')][_0x5565('0x3b')]+'%'};return _0x322b80;})});}_0xa55903=_[_0x5565('0x3f')]({},_0xa55903,_0x26eb30['options']);return db[_0x5565('0x5f')]['count']({'where':_0xa55903[_0x5565('0x3c')]})['then'](function(_0x41f158){_0x474212[_0x5565('0x20')]=_0x41f158;if(_0x26eb30['query'][_0x5565('0x42')]){_0xa55903[_0x5565('0x43')]=[{'all':!![]}];}return db[_0x5565('0x5f')][_0x5565('0x44')](_0xa55903);})['then'](function(_0x26a9a1){_0x474212[_0x5565('0x45')]=_0x26a9a1;return _0x474212;});}})['then'](respondWithFilteredResult(_0x12543a,_0xa55903))[_0x5565('0x46')](handleError(_0x12543a,null));};exports['getHopperFinals']=function(_0x33115c,_0x3b4577,_0x4c39f9){var _0xc69f88={'raw':!![],'where':{}};var _0x353c68={};var _0x275012={'count':0x0,'rows':[]};return db['Campaign'][_0x5565('0x5b')]({'where':{'id':_0x33115c['params']['id']}})[_0x5565('0x26')](handleEntityNotFound(_0x3b4577,null))[_0x5565('0x26')](function(_0x8e6bee){if(_0x8e6bee){_0x353c68['model']=_[_0x5565('0x48')](db['CmHopperFinal'][_0x5565('0x2d')]);_0x353c68[_0x5565('0x31')]=_[_0x5565('0x48')](_0x33115c[_0x5565('0x31')]);_0x353c68['filters']=_[_0x5565('0x33')](_0x353c68[_0x5565('0x2f')],_0x353c68[_0x5565('0x31')]);_0xc69f88['attributes']=_[_0x5565('0x33')](_0x353c68[_0x5565('0x2f')],qs[_0x5565('0x35')](_0x33115c[_0x5565('0x31')][_0x5565('0x35')]));_0xc69f88[_0x5565('0x34')]=_0xc69f88[_0x5565('0x34')][_0x5565('0x36')]?_0xc69f88[_0x5565('0x34')]:_0x353c68[_0x5565('0x2f')];if(!_0x33115c[_0x5565('0x31')][_0x5565('0x37')](_0x5565('0x38'))){_0xc69f88['limit']=qs[_0x5565('0x21')](_0x33115c[_0x5565('0x31')][_0x5565('0x21')]);_0xc69f88['offset']=qs[_0x5565('0x1f')](_0x33115c[_0x5565('0x31')]['offset']);}_0xc69f88[_0x5565('0x39')]=qs[_0x5565('0x5d')](_0x33115c['query']['sort']);_0xc69f88['where']=qs['filters'](_['pick'](_0x33115c[_0x5565('0x31')],_0x353c68[_0x5565('0x32')]));_0xc69f88['where'][_0x5565('0x5e')]=_0x8e6bee['id'];if(_0x33115c[_0x5565('0x31')][_0x5565('0x3b')]){_0xc69f88[_0x5565('0x3c')]=_[_0x5565('0x3f')](_0xc69f88['where'],{'$or':_[_0x5565('0x30')](_0xc69f88[_0x5565('0x34')],function(_0x2b3640){var _0x4f5961={};_0x4f5961[_0x2b3640]={'$like':'%'+_0x33115c[_0x5565('0x31')]['filter']+'%'};return _0x4f5961;})});}_0xc69f88=_['merge']({},_0xc69f88,_0x33115c['options']);return db['CmHopperFinal'][_0x5565('0x20')]({'where':_0xc69f88[_0x5565('0x3c')]})[_0x5565('0x26')](function(_0x4bc4ff){_0x275012[_0x5565('0x20')]=_0x4bc4ff;if(_0x33115c[_0x5565('0x31')]['includeAll']){_0xc69f88['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x5565('0x44')](_0xc69f88);})[_0x5565('0x26')](function(_0x5b5a26){_0x275012[_0x5565('0x45')]=_0x5b5a26;return _0x275012;});}})['then'](respondWithFilteredResult(_0x3b4577,_0xc69f88))[_0x5565('0x46')](handleError(_0x3b4577,null));};exports[_0x5565('0x60')]=function(_0x5515bb,_0x57b40a,_0x1ab019){var _0x300757={'raw':!![],'where':{}};var _0x37f3fc={};var _0x4dcfcb={'count':0x0,'rows':[]};return db['Campaign'][_0x5565('0x5b')]({'where':{'id':_0x5515bb[_0x5565('0x53')]['id']}})[_0x5565('0x26')](handleEntityNotFound(_0x57b40a,null))['then'](function(_0x8aded8){if(_0x8aded8){_0x37f3fc[_0x5565('0x2f')]=_[_0x5565('0x48')](db['CmHopperBlack']['rawAttributes']);_0x37f3fc[_0x5565('0x31')]=_[_0x5565('0x48')](_0x5515bb[_0x5565('0x31')]);_0x37f3fc[_0x5565('0x32')]=_[_0x5565('0x33')](_0x37f3fc['model'],_0x37f3fc['query']);_0x300757[_0x5565('0x34')]=_[_0x5565('0x33')](_0x37f3fc[_0x5565('0x2f')],qs[_0x5565('0x35')](_0x5515bb[_0x5565('0x31')][_0x5565('0x35')]));_0x300757['attributes']=_0x300757[_0x5565('0x34')][_0x5565('0x36')]?_0x300757[_0x5565('0x34')]:_0x37f3fc[_0x5565('0x2f')];if(!_0x5515bb[_0x5565('0x31')]['hasOwnProperty'](_0x5565('0x38'))){_0x300757[_0x5565('0x21')]=qs['limit'](_0x5515bb[_0x5565('0x31')][_0x5565('0x21')]);_0x300757['offset']=qs[_0x5565('0x1f')](_0x5515bb[_0x5565('0x31')][_0x5565('0x1f')]);}_0x300757[_0x5565('0x39')]=qs[_0x5565('0x5d')](_0x5515bb['query'][_0x5565('0x5d')]);_0x300757[_0x5565('0x3c')]=qs['filters'](_[_0x5565('0x3a')](_0x5515bb[_0x5565('0x31')],_0x37f3fc[_0x5565('0x32')]));_0x300757['where']['CampaignId']=_0x8aded8['id'];if(_0x5515bb['query'][_0x5565('0x3b')]){_0x300757['where']=_['merge'](_0x300757[_0x5565('0x3c')],{'$or':_['map'](_0x300757[_0x5565('0x34')],function(_0x55b0fd){var _0xd9c9de={};_0xd9c9de[_0x55b0fd]={'$like':'%'+_0x5515bb['query']['filter']+'%'};return _0xd9c9de;})});}_0x300757=_[_0x5565('0x3f')]({},_0x300757,_0x5515bb['options']);return db[_0x5565('0x61')]['count']({'where':_0x300757[_0x5565('0x3c')]})[_0x5565('0x26')](function(_0x53c86b){_0x4dcfcb[_0x5565('0x20')]=_0x53c86b;if(_0x5515bb['query'][_0x5565('0x42')]){_0x300757[_0x5565('0x43')]=[{'all':!![]}];}return db[_0x5565('0x61')]['findAll'](_0x300757);})[_0x5565('0x26')](function(_0x68cf83){_0x4dcfcb[_0x5565('0x45')]=_0x68cf83;return _0x4dcfcb;});}})[_0x5565('0x26')](respondWithFilteredResult(_0x57b40a,_0x300757))['catch'](handleError(_0x57b40a,null));};exports[_0x5565('0x62')]=function(_0x2ccdfa,_0x3b58c4,_0x2c9e29){var _0x1cd6d2={};var _0x2e391e={};var _0x6d5b27;var _0x59a0a7;return db[_0x5565('0x41')][_0x5565('0x5b')]({'where':{'id':_0x2ccdfa['params']['id']}})[_0x5565('0x26')](handleEntityNotFound(_0x3b58c4,null))['then'](function(_0xa76f1d){if(_0xa76f1d){_0x6d5b27=_0xa76f1d;_0x2e391e[_0x5565('0x2f')]=_['keys'](db[_0x5565('0x63')][_0x5565('0x2d')]);_0x2e391e[_0x5565('0x31')]=_[_0x5565('0x48')](_0x2ccdfa[_0x5565('0x31')]);_0x2e391e[_0x5565('0x32')]=_[_0x5565('0x33')](_0x2e391e[_0x5565('0x2f')],_0x2e391e[_0x5565('0x31')]);_0x1cd6d2[_0x5565('0x34')]=_[_0x5565('0x33')](_0x2e391e[_0x5565('0x2f')],qs[_0x5565('0x35')](_0x2ccdfa[_0x5565('0x31')][_0x5565('0x35')]));_0x1cd6d2[_0x5565('0x34')]=_0x1cd6d2[_0x5565('0x34')][_0x5565('0x36')]?_0x1cd6d2['attributes']:_0x2e391e[_0x5565('0x2f')];_0x1cd6d2['order']=qs[_0x5565('0x5d')](_0x2ccdfa[_0x5565('0x31')][_0x5565('0x5d')]);_0x1cd6d2[_0x5565('0x3c')]=qs['filters'](_[_0x5565('0x3a')](_0x2ccdfa[_0x5565('0x31')],_0x2e391e[_0x5565('0x32')]));if(_0x2ccdfa[_0x5565('0x31')]['filter']){_0x1cd6d2[_0x5565('0x3c')]=_[_0x5565('0x3f')](_0x1cd6d2[_0x5565('0x3c')],{'$or':_[_0x5565('0x30')](_0x1cd6d2['attributes'],function(_0x14255e){var _0x2e05b0={};_0x2e05b0[_0x14255e]={'$like':'%'+_0x2ccdfa[_0x5565('0x31')][_0x5565('0x3b')]+'%'};return _0x2e05b0;})});}_0x1cd6d2=_[_0x5565('0x3f')]({},_0x1cd6d2,_0x2ccdfa[_0x5565('0x40')]);return _0x6d5b27[_0x5565('0x62')](_0x1cd6d2);}})[_0x5565('0x26')](function(_0x5c87cd){if(_0x5c87cd){_0x59a0a7=_0x5c87cd[_0x5565('0x36')];if(!_0x2ccdfa[_0x5565('0x31')]['hasOwnProperty'](_0x5565('0x38'))){_0x1cd6d2[_0x5565('0x21')]=qs[_0x5565('0x21')](_0x2ccdfa[_0x5565('0x31')]['limit']);_0x1cd6d2[_0x5565('0x1f')]=qs[_0x5565('0x1f')](_0x2ccdfa[_0x5565('0x31')][_0x5565('0x1f')]);}return _0x6d5b27['getLists'](_0x1cd6d2);}})['then'](function(_0x25c14f){if(_0x25c14f){return _0x25c14f?{'count':_0x59a0a7,'rows':_0x25c14f}:null;}})['then'](respondWithResult(_0x3b58c4,null))['catch'](handleError(_0x3b58c4,null));};exports[_0x5565('0x64')]=function(_0x2751df,_0x4f14c9,_0x1e14e6){var _0x5765bd,_0x1671b7;return db[_0x5565('0x41')][_0x5565('0x49')]({'where':{'id':_0x2751df['params']['id']}})[_0x5565('0x26')](handleEntityNotFound(_0x4f14c9,null))['then'](function(_0x476846){if(_0x476846){_0x1671b7=_0x476846;return _0x476846[_0x5565('0x64')](_0x2751df[_0x5565('0x56')][_0x5565('0x65')],_[_0x5565('0x57')](_0x2751df[_0x5565('0x56')],[_0x5565('0x65'),'id'])||{});}return null;})[_0x5565('0x66')](function(_0x54ea3f){var _0xb79d91;_0x5765bd=_0x54ea3f||[];var _0x42f710=[];if(_0x54ea3f){for(var _0x5e7cb6=0x0;_0x5e7cb6<_0x54ea3f[_0x5565('0x36')];_0x5e7cb6+=0x1){var _0x47842b=_0x54ea3f[_0x5e7cb6][_0x5565('0x28')]({'plain':!![]});_0x1671b7[_0x5565('0x67')]=_0x2751df[_0x5565('0x56')][_0x5565('0x67')]?_0x2751df[_0x5565('0x56')]['dialCheckDuplicateType']:_0x1671b7[_0x5565('0x67')];switch(_0x1671b7[_0x5565('0x67')]){case'always':_0xb79d91=squel[_0x5565('0x68')]()[_0x5565('0x69')](_0x5565('0x6a'))[_0x5565('0x6b')](['phone',_0x5565('0x6c'),_0x5565('0x6d'),_0x5565('0x6e'),_0x5565('0x5e'),_0x5565('0x54'),_0x5565('0x55')],squel[_0x5565('0x6f')]()[_0x5565('0x70')]('phone',_0x5565('0x71'))[_0x5565('0x70')](_0x5565('0x72'),_0x5565('0x6c'))[_0x5565('0x70')]('id',_0x5565('0x6d'))[_0x5565('0x70')](_0x47842b[_0x5565('0x73')][_0x5565('0x74')](),'ListId')[_0x5565('0x70')](_0x2751df[_0x5565('0x53')]['id']['toString'](),'CampaignId')[_0x5565('0x70')]('NOW()','createdAt')[_0x5565('0x70')](_0x5565('0x72'),'updatedAt')[_0x5565('0x75')](_0x5565('0x76'))[_0x5565('0x3c')](_0x5565('0x77'))['where'](_0x5565('0x78'),_0x47842b[_0x5565('0x73')][_0x5565('0x74')]())['where'](_0x5565('0x79'))[_0x5565('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x5565('0x70')](_0x5565('0x7a'))['from'](_0x5565('0x7b'))[_0x5565('0x3c')]('CampaignId\x20=\x20?',_0x2751df[_0x5565('0x53')]['id']['toString']()))[_0x5565('0x3c')](_0x5565('0x7c'),squel[_0x5565('0x6f')]()['field'](_0x5565('0x7d'))[_0x5565('0x75')]('cm_hopper')[_0x5565('0x3c')](_0x5565('0x7e'),_0x2751df['params']['id']['toString']())))[_0x5565('0x74')]();break;case _0x5565('0x7f'):_0xb79d91=squel['insert']()['into'](_0x5565('0x6a'))[_0x5565('0x6b')](['phone',_0x5565('0x6c'),_0x5565('0x6d'),_0x5565('0x6e'),_0x5565('0x5e'),_0x5565('0x54'),'updatedAt'],squel[_0x5565('0x6f')]()[_0x5565('0x70')](_0x5565('0x71'),_0x5565('0x71'))[_0x5565('0x70')](_0x5565('0x72'),_0x5565('0x6c'))[_0x5565('0x70')]('id',_0x5565('0x6d'))['field'](_0x47842b[_0x5565('0x73')][_0x5565('0x74')](),_0x5565('0x6e'))[_0x5565('0x70')](_0x2751df[_0x5565('0x53')]['id'][_0x5565('0x74')](),_0x5565('0x5e'))[_0x5565('0x70')](_0x5565('0x72'),_0x5565('0x54'))['field']('NOW()','updatedAt')[_0x5565('0x75')]('cm_contacts')['where'](_0x5565('0x77'))['where'](_0x5565('0x78'),_0x47842b[_0x5565('0x73')][_0x5565('0x74')]())[_0x5565('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x5565('0x3c')](_0x5565('0x7c'),squel['select']()[_0x5565('0x70')](_0x5565('0x7d'))[_0x5565('0x75')]('cm_hopper')[_0x5565('0x3c')](_0x5565('0x7e'),_0x2751df[_0x5565('0x53')]['id'][_0x5565('0x74')]())))[_0x5565('0x74')]();break;default:_0xb79d91=squel['insert']()[_0x5565('0x69')](_0x5565('0x6a'))[_0x5565('0x6b')]([_0x5565('0x71'),_0x5565('0x6c'),_0x5565('0x6d'),_0x5565('0x6e'),_0x5565('0x5e'),'createdAt',_0x5565('0x55')],squel[_0x5565('0x6f')]()['field'](_0x5565('0x71'),'phone')[_0x5565('0x70')](_0x5565('0x72'),_0x5565('0x6c'))[_0x5565('0x70')]('id',_0x5565('0x6d'))[_0x5565('0x70')](_0x47842b['CmListId']['toString'](),'ListId')['field'](_0x2751df[_0x5565('0x53')]['id'][_0x5565('0x74')](),_0x5565('0x5e'))[_0x5565('0x70')](_0x5565('0x72'),'createdAt')[_0x5565('0x70')](_0x5565('0x72'),'updatedAt')['from'](_0x5565('0x76'))[_0x5565('0x3c')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x47842b[_0x5565('0x73')]['toString']())[_0x5565('0x3c')](_0x5565('0x79')))[_0x5565('0x74')]();}_0x42f710['push'](db[_0x5565('0x80')]['query'](_0xb79d91));}return BPromise[_0x5565('0x81')](_0x42f710);}})['then'](function(){return _0x5765bd;})['then'](respondWithResult(_0x4f14c9,null))['catch'](handleError(_0x4f14c9,null));};exports[_0x5565('0x82')]=function(_0x13d33b,_0x58cb35,_0x46aab2){return db['Campaign']['find']({'where':{'id':_0x13d33b['params']['id']}})[_0x5565('0x26')](handleEntityNotFound(_0x58cb35,null))[_0x5565('0x26')](function(_0xaba524){if(_0xaba524){return _0xaba524[_0x5565('0x82')](_0x13d33b[_0x5565('0x31')][_0x5565('0x65')]);}})['then'](function(_0x410438){if(_0x410438){return db[_0x5565('0x5c')][_0x5565('0x27')]({'where':{'ListId':_0x13d33b[_0x5565('0x31')][_0x5565('0x65')],'CampaignId':_0x13d33b[_0x5565('0x53')]['id']}})['then'](function(){return _0x410438;});}})[_0x5565('0x26')](respondWithStatusCode(_0x58cb35,null))['catch'](handleError(_0x58cb35,null));};exports[_0x5565('0x83')]=function(_0x18b1be,_0x397807,_0x5ac58e){var _0x2733a0={};var _0x429fb5={};var _0x177ede;var _0x473c09;return db['Campaign'][_0x5565('0x5b')]({'where':{'id':_0x18b1be[_0x5565('0x53')]['id']}})[_0x5565('0x26')](handleEntityNotFound(_0x397807,null))[_0x5565('0x26')](function(_0x167d21){if(_0x167d21){_0x177ede=_0x167d21;_0x429fb5[_0x5565('0x2f')]=_['keys'](db['CmList'][_0x5565('0x2d')]);_0x429fb5['query']=_[_0x5565('0x48')](_0x18b1be[_0x5565('0x31')]);_0x429fb5[_0x5565('0x32')]=_[_0x5565('0x33')](_0x429fb5[_0x5565('0x2f')],_0x429fb5['query']);_0x2733a0[_0x5565('0x34')]=_[_0x5565('0x33')](_0x429fb5[_0x5565('0x2f')],qs[_0x5565('0x35')](_0x18b1be[_0x5565('0x31')][_0x5565('0x35')]));_0x2733a0[_0x5565('0x34')]=_0x2733a0[_0x5565('0x34')][_0x5565('0x36')]?_0x2733a0[_0x5565('0x34')]:_0x429fb5[_0x5565('0x2f')];_0x2733a0[_0x5565('0x39')]=qs[_0x5565('0x5d')](_0x18b1be[_0x5565('0x31')][_0x5565('0x5d')]);_0x2733a0[_0x5565('0x3c')]=qs[_0x5565('0x32')](_[_0x5565('0x3a')](_0x18b1be[_0x5565('0x31')],_0x429fb5[_0x5565('0x32')]));if(_0x18b1be[_0x5565('0x31')][_0x5565('0x3b')]){_0x2733a0[_0x5565('0x3c')]=_[_0x5565('0x3f')](_0x2733a0[_0x5565('0x3c')],{'$or':_[_0x5565('0x30')](_0x2733a0[_0x5565('0x34')],function(_0x207402){var _0x56eb16={};_0x56eb16[_0x207402]={'$like':'%'+_0x18b1be[_0x5565('0x31')][_0x5565('0x3b')]+'%'};return _0x56eb16;})});}_0x2733a0=_[_0x5565('0x3f')]({},_0x2733a0,_0x18b1be[_0x5565('0x40')]);return _0x177ede[_0x5565('0x83')](_0x2733a0);}})[_0x5565('0x26')](function(_0x67427){if(_0x67427){_0x473c09=_0x67427[_0x5565('0x36')];if(!_0x18b1be[_0x5565('0x31')][_0x5565('0x37')](_0x5565('0x38'))){_0x2733a0[_0x5565('0x21')]=qs[_0x5565('0x21')](_0x18b1be[_0x5565('0x31')][_0x5565('0x21')]);_0x2733a0['offset']=qs[_0x5565('0x1f')](_0x18b1be[_0x5565('0x31')][_0x5565('0x1f')]);}return _0x177ede[_0x5565('0x83')](_0x2733a0);}})['then'](function(_0x4f2765){if(_0x4f2765){return _0x4f2765?{'count':_0x473c09,'rows':_0x4f2765}:null;}})[_0x5565('0x26')](respondWithResult(_0x397807,null))['catch'](handleError(_0x397807,null));};exports['addBlackLists']=function(_0xb1e0b4,_0x29f42e,_0x51ffd5){var _0x14855d,_0x2f4c01;return db[_0x5565('0x41')][_0x5565('0x49')]({'where':{'id':_0xb1e0b4['params']['id']}})[_0x5565('0x26')](handleEntityNotFound(_0x29f42e,null))['then'](function(_0x456161){if(_0x456161){_0x2f4c01=_0x456161;return _0x456161[_0x5565('0x84')](_0xb1e0b4[_0x5565('0x56')]['ids'],_['omit'](_0xb1e0b4[_0x5565('0x56')],[_0x5565('0x65'),'id'])||{});}return null;})[_0x5565('0x66')](function(_0x3fa53c){var _0x4d0ecc;_0x14855d=_0x3fa53c||[];var _0x11000c=[];if(_0x3fa53c){for(var _0x197600=0x0;_0x197600<_0x3fa53c['length'];_0x197600+=0x1){var _0x3627ed=_0x3fa53c[_0x197600][_0x5565('0x28')]({'plain':!![]});_0x4d0ecc=squel[_0x5565('0x68')]()[_0x5565('0x69')](_0x5565('0x85'))[_0x5565('0x6b')]([_0x5565('0x71'),_0x5565('0x6d'),'ListId',_0x5565('0x5e'),_0x5565('0x54'),_0x5565('0x55')],squel[_0x5565('0x6f')]()[_0x5565('0x70')](_0x5565('0x71'),'phone')[_0x5565('0x70')]('id',_0x5565('0x6d'))[_0x5565('0x70')](_0x3627ed[_0x5565('0x73')]['toString'](),_0x5565('0x6e'))[_0x5565('0x70')](_0xb1e0b4[_0x5565('0x53')]['id']['toString'](),_0x5565('0x5e'))[_0x5565('0x70')](_0x5565('0x72'),_0x5565('0x54'))['field']('NOW()',_0x5565('0x55'))['from'](_0x5565('0x76'))[_0x5565('0x3c')](_0x5565('0x77'))[_0x5565('0x3c')](_0x5565('0x78'),_0x3627ed[_0x5565('0x73')][_0x5565('0x74')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x11000c[_0x5565('0x86')](db[_0x5565('0x80')][_0x5565('0x31')](_0x4d0ecc));}return BPromise[_0x5565('0x81')](_0x11000c);}})[_0x5565('0x26')](function(){return _0x14855d;})['then'](respondWithResult(_0x29f42e,null))[_0x5565('0x46')](handleError(_0x29f42e,null));};exports['removeBlackLists']=function(_0xc795a4,_0x68117a,_0xa5c7e1){return db['Campaign'][_0x5565('0x49')]({'where':{'id':_0xc795a4[_0x5565('0x53')]['id']}})[_0x5565('0x26')](handleEntityNotFound(_0x68117a,null))['then'](function(_0x3883a1){if(_0x3883a1){return _0x3883a1[_0x5565('0x87')](_0xc795a4['query'][_0x5565('0x65')]);}})['then'](function(_0x115393){if(_0x115393){return db[_0x5565('0x61')][_0x5565('0x27')]({'where':{'ListId':_0xc795a4['query'][_0x5565('0x65')],'CampaignId':_0xc795a4['params']['id']}})[_0x5565('0x26')](function(){return _0x115393;});}})[_0x5565('0x26')](respondWithStatusCode(_0x68117a,null))[_0x5565('0x46')](handleError(_0x68117a,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index bf62348..8096c0e 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(_0x1b4e5d,_0x559929){var _0x5d5818=function(_0x5d85eb){while(--_0x5d85eb){_0x1b4e5d['push'](_0x1b4e5d['shift']());}};_0x5d5818(++_0x559929);}(_0x7a54,0x106));var _0x47a5=function(_0x2e3f6c,_0x236b9b){_0x2e3f6c=_0x2e3f6c-0x0;var _0xa9226e=_0x7a54[_0x2e3f6c];return _0xa9226e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0x7a54,0x106));var _0x47a5=function(_0x11d2a5,_0x1a444a){_0x11d2a5=_0x11d2a5-0x0;var _0x5dfe9a=_0x7a54[_0x11d2a5];return _0x5dfe9a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 455acd6..dcd7971 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 _0x0911=['Campaign,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetCampaign','Campaign','findAll','options','raw','attributes','limit','include','map','model','debug','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent'];(function(_0x1d2240,_0x21515d){var _0x248daf=function(_0x4c789a){while(--_0x4c789a){_0x1d2240['push'](_0x1d2240['shift']());}};_0x248daf(++_0x21515d);}(_0x0911,0x1a9));var _0x1091=function(_0x2460d9,_0x15da87){_0x2460d9=_0x2460d9-0x0;var _0x4bc204=_0x0911[_0x2460d9];return _0x4bc204;};'use strict';var _=require(_0x1091('0x0'));var util=require(_0x1091('0x1'));var moment=require(_0x1091('0x2'));var BPromise=require(_0x1091('0x3'));var rs=require(_0x1091('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1091('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1091('0x6'))(_0x1091('0x7'));var config=require(_0x1091('0x8'));var jayson=require(_0x1091('0x9'));var client=jayson[_0x1091('0xa')][_0x1091('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ad19a,_0x2acbb4,_0x7b3a7d){return new BPromise(function(_0x457631,_0x4b2a13){return client[_0x1091('0xc')](_0x2ad19a,_0x7b3a7d)[_0x1091('0xd')](function(_0x33d6cd){logger[_0x1091('0xe')](_0x1091('0xf'),_0x2acbb4,_0x1091('0x10'));logger['debug'](_0x1091('0x11'),_0x2acbb4,_0x1091('0x10'),JSON['stringify'](_0x33d6cd));if(_0x33d6cd['error']){if(_0x33d6cd[_0x1091('0x12')]['code']===0x1f4){logger[_0x1091('0x12')]('Campaign,\x20%s,\x20%s',_0x2acbb4,_0x33d6cd[_0x1091('0x12')][_0x1091('0x13')]);return _0x4b2a13(_0x33d6cd[_0x1091('0x12')][_0x1091('0x13')]);}logger['error'](_0x1091('0xf'),_0x2acbb4,_0x33d6cd[_0x1091('0x12')]['message']);return _0x457631(_0x33d6cd['error']['message']);}else{logger['info'](_0x1091('0xf'),_0x2acbb4,_0x1091('0x10'));_0x457631(_0x33d6cd[_0x1091('0x14')]['message']);}})[_0x1091('0x15')](function(_0xf69de4){logger[_0x1091('0x12')](_0x1091('0xf'),_0x2acbb4,_0xf69de4);_0x4b2a13(_0xf69de4);});});}exports[_0x1091('0x16')]=function(_0x5c01c3){var _0x841623=this;return new Promise(function(_0x46e3d5,_0x2b0fda){return db[_0x1091('0x17')][_0x1091('0x18')]({'raw':_0x5c01c3['options']?_0x5c01c3[_0x1091('0x19')][_0x1091('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c01c3['options']?_0x5c01c3['options']['where']||null:null,'attributes':_0x5c01c3[_0x1091('0x19')]?_0x5c01c3[_0x1091('0x19')][_0x1091('0x1b')]||null:null,'limit':_0x5c01c3[_0x1091('0x19')]?_0x5c01c3[_0x1091('0x19')][_0x1091('0x1c')]||null:null,'include':_0x5c01c3[_0x1091('0x19')]?_0x5c01c3[_0x1091('0x19')][_0x1091('0x1d')]?_[_0x1091('0x1e')](_0x5c01c3[_0x1091('0x19')][_0x1091('0x1d')],function(_0x1925fc){return{'model':db[_0x1925fc[_0x1091('0x1f')]],'as':_0x1925fc['as'],'attributes':_0x1925fc[_0x1091('0x1b')],'include':_0x1925fc[_0x1091('0x1d')]?_['map'](_0x1925fc[_0x1091('0x1d')],function(_0x3667a7){return{'model':db[_0x3667a7[_0x1091('0x1f')]],'as':_0x3667a7['as'],'attributes':_0x3667a7['attributes'],'include':_0x3667a7[_0x1091('0x1d')]?_['map'](_0x3667a7[_0x1091('0x1d')],function(_0x306165){return{'model':db[_0x306165[_0x1091('0x1f')]],'as':_0x306165['as'],'attributes':_0x306165[_0x1091('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf92795){logger[_0x1091('0xe')](_0x1091('0x16'),_0x5c01c3);logger[_0x1091('0x20')](_0x1091('0x16'),_0x5c01c3,JSON[_0x1091('0x21')](_0xf92795));_0x46e3d5(_0xf92795);})['catch'](function(_0x2be598){logger[_0x1091('0x12')](_0x1091('0x16'),_0x2be598[_0x1091('0x13')],_0x5c01c3);_0x2b0fda(_0x841623['error'](0x1f4,_0x2be598['message']));});});}; \ No newline at end of file +var _0xf874=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Campaign','findAll','options','raw','where','include','model','attributes','map','GetCampaign','moment'];(function(_0x3df1f8,_0xb25dd9){var _0x25848f=function(_0x42db38){while(--_0x42db38){_0x3df1f8['push'](_0x3df1f8['shift']());}};_0x25848f(++_0xb25dd9);}(_0xf874,0xed));var _0x4f87=function(_0x6c3f,_0x1872f6){_0x6c3f=_0x6c3f-0x0;var _0x46163a=_0xf874[_0x6c3f];return _0x46163a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f87('0x0'));var BPromise=require(_0x4f87('0x1'));var rs=require(_0x4f87('0x2'));var fs=require('fs');var Redis=require(_0x4f87('0x3'));var db=require(_0x4f87('0x4'))['db'];var utils=require(_0x4f87('0x5'));var logger=require('../../config/logger')(_0x4f87('0x6'));var config=require(_0x4f87('0x7'));var jayson=require(_0x4f87('0x8'));var client=jayson[_0x4f87('0x9')][_0x4f87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44fea6,_0x4a0662,_0x3a89e3){return new BPromise(function(_0x194853,_0x592008){return client[_0x4f87('0xb')](_0x44fea6,_0x3a89e3)[_0x4f87('0xc')](function(_0x4d8354){logger[_0x4f87('0xd')](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));logger[_0x4f87('0x10')](_0x4f87('0x11'),_0x4a0662,_0x4f87('0xf'),JSON[_0x4f87('0x12')](_0x4d8354));if(_0x4d8354['error']){if(_0x4d8354['error'][_0x4f87('0x13')]===0x1f4){logger[_0x4f87('0x14')](_0x4f87('0xe'),_0x4a0662,_0x4d8354['error']['message']);return _0x592008(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}logger[_0x4f87('0x14')]('Campaign,\x20%s,\x20%s',_0x4a0662,_0x4d8354[_0x4f87('0x14')]['message']);return _0x194853(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}else{logger['info'](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));_0x194853(_0x4d8354[_0x4f87('0x16')][_0x4f87('0x15')]);}})[_0x4f87('0x17')](function(_0x3bd90f){logger['error'](_0x4f87('0xe'),_0x4a0662,_0x3bd90f);_0x592008(_0x3bd90f);});});}exports['GetCampaign']=function(_0x10551e){var _0x6a3017=this;return new Promise(function(_0x46492d,_0x42c399){return db[_0x4f87('0x18')][_0x4f87('0x19')]({'raw':_0x10551e[_0x4f87('0x1a')]?_0x10551e[_0x4f87('0x1a')][_0x4f87('0x1b')]===undefined?!![]:![]:!![],'where':_0x10551e[_0x4f87('0x1a')]?_0x10551e[_0x4f87('0x1a')][_0x4f87('0x1c')]||null:null,'attributes':_0x10551e[_0x4f87('0x1a')]?_0x10551e['options']['attributes']||null:null,'limit':_0x10551e[_0x4f87('0x1a')]?_0x10551e[_0x4f87('0x1a')]['limit']||null:null,'include':_0x10551e['options']?_0x10551e[_0x4f87('0x1a')]['include']?_['map'](_0x10551e[_0x4f87('0x1a')][_0x4f87('0x1d')],function(_0x2a382c){return{'model':db[_0x2a382c[_0x4f87('0x1e')]],'as':_0x2a382c['as'],'attributes':_0x2a382c[_0x4f87('0x1f')],'include':_0x2a382c[_0x4f87('0x1d')]?_[_0x4f87('0x20')](_0x2a382c['include'],function(_0x234106){return{'model':db[_0x234106[_0x4f87('0x1e')]],'as':_0x234106['as'],'attributes':_0x234106[_0x4f87('0x1f')],'include':_0x234106['include']?_[_0x4f87('0x20')](_0x234106[_0x4f87('0x1d')],function(_0x51b8dd){return{'model':db[_0x51b8dd[_0x4f87('0x1e')]],'as':_0x51b8dd['as'],'attributes':_0x51b8dd[_0x4f87('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4f87('0xc')](function(_0x41e940){logger['info']('GetCampaign',_0x10551e);logger[_0x4f87('0x10')](_0x4f87('0x21'),_0x10551e,JSON[_0x4f87('0x12')](_0x41e940));_0x46492d(_0x41e940);})[_0x4f87('0x17')](function(_0x38e102){logger['error'](_0x4f87('0x21'),_0x38e102['message'],_0x10551e);_0x42c399(_0x6a3017[_0x4f87('0x14')](0x1f4,_0x38e102[_0x4f87('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 9bc24f9..2e78f7b 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 _0x2631=['clone','addLists','put','update','delete','destroy','removeLists','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','/:id/hoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone'];(function(_0x2c395b,_0x19fe03){var _0x1a2726=function(_0x29a3cd){while(--_0x29a3cd){_0x2c395b['push'](_0x2c395b['shift']());}};_0x1a2726(++_0x19fe03);}(_0x2631,0x173));var _0x1263=function(_0x2f6586,_0xd92f4c){_0x2f6586=_0x2f6586-0x0;var _0x396d6c=_0x2631[_0x2f6586];return _0x396d6c;};'use strict';var multer=require(_0x1263('0x0'));var util=require(_0x1263('0x1'));var path=require('path');var timeout=require(_0x1263('0x2'));var express=require(_0x1263('0x3'));var router=express[_0x1263('0x4')]();var fs_extra=require(_0x1263('0x5'));var auth=require(_0x1263('0x6'));var interaction=require(_0x1263('0x7'));var config=require(_0x1263('0x8'));var controller=require(_0x1263('0x9'));router[_0x1263('0xa')]('/',auth['isAuthenticated'](),controller[_0x1263('0xb')]);router[_0x1263('0xa')](_0x1263('0xc'),auth[_0x1263('0xd')](),controller['show']);router[_0x1263('0xa')](_0x1263('0xe'),auth[_0x1263('0xd')](),controller['getHoppers']);router[_0x1263('0xa')](_0x1263('0xf'),auth[_0x1263('0xd')](),controller['getHopperHistories']);router[_0x1263('0xa')]('/:id/hopper_finals',auth[_0x1263('0xd')](),controller[_0x1263('0x10')]);router['get'](_0x1263('0x11'),auth[_0x1263('0xd')](),controller[_0x1263('0x12')]);router[_0x1263('0xa')](_0x1263('0x13'),auth[_0x1263('0xd')](),controller['getLists']);router[_0x1263('0xa')](_0x1263('0x14'),auth['isAuthenticated'](),controller[_0x1263('0x15')]);router[_0x1263('0x16')]('/',auth[_0x1263('0xd')](),controller[_0x1263('0x17')]);router[_0x1263('0x16')](_0x1263('0x18'),auth[_0x1263('0xd')](),controller[_0x1263('0x19')]);router[_0x1263('0x16')](_0x1263('0x13'),auth[_0x1263('0xd')](),controller[_0x1263('0x1a')]);router[_0x1263('0x16')](_0x1263('0x14'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0x1263('0x1b')](_0x1263('0xc'),auth['isAuthenticated'](),controller[_0x1263('0x1c')]);router[_0x1263('0x1d')]('/:id',auth[_0x1263('0xd')](),controller[_0x1263('0x1e')]);router['delete'](_0x1263('0x13'),auth[_0x1263('0xd')](),controller[_0x1263('0x1f')]);router[_0x1263('0x1d')](_0x1263('0x14'),auth[_0x1263('0xd')](),controller['removeBlackLists']);module[_0x1263('0x20')]=router; \ No newline at end of file +var _0x1904=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','index','/:id','isAuthenticated','/:id/hoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone','/:id/blacklists','addBlackLists','update','delete','removeLists','removeBlackLists','exports','multer','express'];(function(_0x16fa98,_0x476d07){var _0x2ba38a=function(_0x1635ab){while(--_0x1635ab){_0x16fa98['push'](_0x16fa98['shift']());}};_0x2ba38a(++_0x476d07);}(_0x1904,0x1b1));var _0x4190=function(_0xd36cbd,_0x48cff0){_0xd36cbd=_0xd36cbd-0x0;var _0x8ffa70=_0x1904[_0xd36cbd];return _0x8ffa70;};'use strict';var multer=require(_0x4190('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4190('0x1'));var router=express[_0x4190('0x2')]();var fs_extra=require(_0x4190('0x3'));var auth=require(_0x4190('0x4'));var interaction=require(_0x4190('0x5'));var config=require('../../config/environment');var controller=require(_0x4190('0x6'));router[_0x4190('0x7')]('/',auth['isAuthenticated'](),controller[_0x4190('0x8')]);router[_0x4190('0x7')](_0x4190('0x9'),auth[_0x4190('0xa')](),controller['show']);router[_0x4190('0x7')](_0x4190('0xb'),auth[_0x4190('0xa')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0x4190('0xa')](),controller[_0x4190('0xc')]);router['get'](_0x4190('0xd'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x4190('0x7')](_0x4190('0xe'),auth[_0x4190('0xa')](),controller[_0x4190('0xf')]);router[_0x4190('0x7')](_0x4190('0x10'),auth[_0x4190('0xa')](),controller[_0x4190('0x11')]);router[_0x4190('0x7')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x4190('0x12')]);router[_0x4190('0x13')]('/',auth[_0x4190('0xa')](),controller['create']);router[_0x4190('0x13')](_0x4190('0x14'),auth[_0x4190('0xa')](),controller[_0x4190('0x15')]);router['post'](_0x4190('0x10'),auth[_0x4190('0xa')](),controller['addLists']);router[_0x4190('0x13')](_0x4190('0x16'),auth['isAuthenticated'](),controller[_0x4190('0x17')]);router['put'](_0x4190('0x9'),auth['isAuthenticated'](),controller[_0x4190('0x18')]);router[_0x4190('0x19')]('/:id',auth[_0x4190('0xa')](),controller['destroy']);router[_0x4190('0x19')](_0x4190('0x10'),auth[_0x4190('0xa')](),controller[_0x4190('0x1a')]);router[_0x4190('0x19')](_0x4190('0x16'),auth['isAuthenticated'](),controller[_0x4190('0x1b')]);module[_0x4190('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 4f1c1a8..6c45042 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 _0x69d1=['TEXT','VIRTUAL','key','exports','STRING'];(function(_0x58f1ef,_0x4cf4d5){var _0x2ef772=function(_0x3b04ab){while(--_0x3b04ab){_0x58f1ef['push'](_0x58f1ef['shift']());}};_0x2ef772(++_0x4cf4d5);}(_0x69d1,0xa3));var _0x169d=function(_0x2668e1,_0x8d2cc0){_0x2668e1=_0x2668e1-0x0;var _0x45ceb0=_0x69d1[_0x2668e1];return _0x45ceb0;};'use strict';var Sequelize=require('sequelize');module[_0x169d('0x0')]={'key':{'type':Sequelize[_0x169d('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x169d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x169d('0x1')]},'name':{'type':Sequelize[_0x169d('0x3')],'get':function(){return this['getDataValue'](_0x169d('0x4'));}}}; \ No newline at end of file +var _0xfa3e=['VIRTUAL','getDataValue','sequelize','STRING','TEXT'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xfa3e,0x8e));var _0xefa3=function(_0x3e35af,_0x3c70e7){_0x3e35af=_0x3e35af-0x0;var _0x431c6b=_0xfa3e[_0x3e35af];return _0x431c6b;};'use strict';var Sequelize=require(_0xefa3('0x0'));module['exports']={'key':{'type':Sequelize[_0xefa3('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xefa3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xefa3('0x1')]},'name':{'type':Sequelize[_0xefa3('0x3')],'get':function(){return this[_0xefa3('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 0f9e265..f6d6503 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 _0x88dc=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','CannedAnswers','destroy','sendStatus','error','stack','name','map','CannedAnswer','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','length','nolimit','order','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','catch','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf'];(function(_0x934a36,_0x516179){var _0x144f78=function(_0x38d0c9){while(--_0x38d0c9){_0x934a36['push'](_0x934a36['shift']());}};_0x144f78(++_0x516179);}(_0x88dc,0xac));var _0xc88d=function(_0x2c97a2,_0x51ffb0){_0x2c97a2=_0x2c97a2-0x0;var _0x301db9=_0x88dc[_0x2c97a2];return _0x301db9;};'use strict';var emlformat=require(_0xc88d('0x0'));var rimraf=require(_0xc88d('0x1'));var zipdir=require(_0xc88d('0x2'));var jsonpatch=require(_0xc88d('0x3'));var rp=require(_0xc88d('0x4'));var moment=require(_0xc88d('0x5'));var BPromise=require(_0xc88d('0x6'));var Mustache=require('mustache');var util=require(_0xc88d('0x7'));var path=require(_0xc88d('0x8'));var sox=require(_0xc88d('0x9'));var csv=require(_0xc88d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc88d('0xb'));var _=require('lodash');var squel=require(_0xc88d('0xc'));var crypto=require(_0xc88d('0xd'));var jsforce=require(_0xc88d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc88d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc88d('0xf'));var authService=require(_0xc88d('0x10'));var qs=require(_0xc88d('0x11'));var as=require(_0xc88d('0x12'));var hardwareService=require(_0xc88d('0x13'));var logger=require(_0xc88d('0x14'))(_0xc88d('0x15'));var utils=require(_0xc88d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc88d('0x17'));var db=require(_0xc88d('0x18'))['db'];function respondWithStatusCode(_0x41a557,_0x19cc65){_0x19cc65=_0x19cc65||0xcc;return function(_0x477703){if(_0x477703){return _0x41a557['sendStatus'](_0x19cc65);}return _0x41a557[_0xc88d('0x19')](_0x19cc65)['end']();};}function respondWithResult(_0x49b912,_0x367280){_0x367280=_0x367280||0xc8;return function(_0x283aef){if(_0x283aef){return _0x49b912[_0xc88d('0x19')](_0x367280)[_0xc88d('0x1a')](_0x283aef);}};}function respondWithFilteredResult(_0x7567b,_0x33eb71){return function(_0x4e6077){if(_0x4e6077){var _0x239964=typeof _0x33eb71[_0xc88d('0x1b')]==='undefined'&&typeof _0x33eb71[_0xc88d('0x1c')]===_0xc88d('0x1d');var _0x134de4=_0x4e6077[_0xc88d('0x1e')];var _0x470bed=_0x239964?0x0:_0x33eb71[_0xc88d('0x1b')];var _0x30e746=_0x239964?_0x4e6077['count']:_0x33eb71[_0xc88d('0x1b')]+_0x33eb71[_0xc88d('0x1c')];var _0x3fb6a4;if(_0x30e746>=_0x134de4){_0x30e746=_0x134de4;_0x3fb6a4=0xc8;}else{_0x3fb6a4=0xce;}_0x7567b[_0xc88d('0x19')](_0x3fb6a4);return _0x7567b[_0xc88d('0x1f')](_0xc88d('0x20'),_0x470bed+'-'+_0x30e746+'/'+_0x134de4)['json'](_0x4e6077);}return null;};}function patchUpdates(_0x7edcd3){return function(_0x457fe7){try{jsonpatch[_0xc88d('0x21')](_0x457fe7,_0x7edcd3,!![]);}catch(_0x5bed81){return BPromise[_0xc88d('0x22')](_0x5bed81);}return _0x457fe7[_0xc88d('0x23')]();};}function saveUpdates(_0x4b9840,_0x51cafb){return function(_0x2fa79d){if(_0x2fa79d){return _0x2fa79d[_0xc88d('0x24')](_0x4b9840)[_0xc88d('0x25')](function(_0xad9132){return _0xad9132;});}return null;};}function removeEntity(_0x25760a,_0x4d282a){return function(_0x4b1dc5){if(_0x4b1dc5){return _0x4b1dc5['destroy']()[_0xc88d('0x25')](function(){var _0x171974=_0x4b1dc5['get']({'plain':!![]});var _0x1fb51b=_0xc88d('0x26');return db['UserProfileResource'][_0xc88d('0x27')]({'where':{'type':_0x1fb51b,'resourceId':_0x171974['id']}})['then'](function(){return _0x4b1dc5;});})[_0xc88d('0x25')](function(){_0x25760a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4099ae,_0x3f5e97){return function(_0x36d3c2){if(!_0x36d3c2){_0x4099ae[_0xc88d('0x28')](0x194);}return _0x36d3c2;};}function handleError(_0x34d71e,_0x1cc79a){_0x1cc79a=_0x1cc79a||0x1f4;return function(_0x4ef764){logger[_0xc88d('0x29')](_0x4ef764[_0xc88d('0x2a')]);if(_0x4ef764[_0xc88d('0x2b')]){delete _0x4ef764[_0xc88d('0x2b')];}_0x34d71e[_0xc88d('0x19')](_0x1cc79a)['send'](_0x4ef764);};}exports['index']=function(_0x20026c,_0xccb61d){var _0x27181b={},_0x1ef641={},_0x2230cb={'count':0x0,'rows':[]};var _0x4787b2=_[_0xc88d('0x2c')](db[_0xc88d('0x2d')][_0xc88d('0x2e')],function(_0x4e6e8b){return{'name':_0x4e6e8b[_0xc88d('0x2f')],'type':_0x4e6e8b['type'][_0xc88d('0x30')]};});_0x1ef641[_0xc88d('0x31')]=_[_0xc88d('0x2c')](_0x4787b2,_0xc88d('0x2b'));_0x1ef641['query']=_[_0xc88d('0x32')](_0x20026c[_0xc88d('0x33')]);_0x1ef641['filters']=_['intersection'](_0x1ef641[_0xc88d('0x31')],_0x1ef641[_0xc88d('0x33')]);_0x27181b[_0xc88d('0x34')]=_[_0xc88d('0x35')](_0x1ef641[_0xc88d('0x31')],qs['fields'](_0x20026c[_0xc88d('0x33')][_0xc88d('0x36')]));_0x27181b[_0xc88d('0x34')]=_0x27181b[_0xc88d('0x34')][_0xc88d('0x37')]?_0x27181b[_0xc88d('0x34')]:_0x1ef641[_0xc88d('0x31')];if(!_0x20026c[_0xc88d('0x33')]['hasOwnProperty'](_0xc88d('0x38'))){_0x27181b['limit']=qs[_0xc88d('0x1c')](_0x20026c[_0xc88d('0x33')][_0xc88d('0x1c')]);_0x27181b[_0xc88d('0x1b')]=qs[_0xc88d('0x1b')](_0x20026c[_0xc88d('0x33')]['offset']);}_0x27181b[_0xc88d('0x39')]=qs['sort'](_0x20026c[_0xc88d('0x33')]['sort']);_0x27181b[_0xc88d('0x3a')]=qs[_0xc88d('0x3b')](_[_0xc88d('0x3c')](_0x20026c[_0xc88d('0x33')],_0x1ef641[_0xc88d('0x3b')]),_0x4787b2);if(_0x20026c[_0xc88d('0x33')][_0xc88d('0x3d')]){_0x27181b[_0xc88d('0x3a')]=_['merge'](_0x27181b[_0xc88d('0x3a')],{'$or':[{'key':{'$like':'%'+_0x20026c[_0xc88d('0x33')][_0xc88d('0x3d')]+'%'}},{'value':{'$like':'%'+_0x20026c['query']['filter']+'%'}}]});}_0x27181b=_[_0xc88d('0x3e')]({},_0x27181b,_0x20026c[_0xc88d('0x3f')]);var _0x2c0e32={'where':_0x27181b[_0xc88d('0x3a')]};return db['CannedAnswer'][_0xc88d('0x1e')](_0x2c0e32)[_0xc88d('0x25')](function(_0x209bc4){_0x2230cb['count']=_0x209bc4;if(_0x20026c[_0xc88d('0x33')][_0xc88d('0x40')]){_0x27181b[_0xc88d('0x41')]=[{'all':!![]}];}return db[_0xc88d('0x2d')][_0xc88d('0x42')](_0x27181b);})['then'](function(_0x2f6749){_0x2230cb[_0xc88d('0x43')]=_0x2f6749;return _0x2230cb;})[_0xc88d('0x25')](respondWithFilteredResult(_0xccb61d,_0x27181b))['catch'](handleError(_0xccb61d,null));};exports[_0xc88d('0x44')]=function(_0x1d3798,_0x2beede){var _0x48453d={'raw':!![],'where':{'id':_0x1d3798[_0xc88d('0x45')]['id']}},_0x2d73ef={};_0x2d73ef[_0xc88d('0x31')]=_['keys'](db[_0xc88d('0x2d')]['rawAttributes']);_0x2d73ef[_0xc88d('0x33')]=_['keys'](_0x1d3798[_0xc88d('0x33')]);_0x2d73ef[_0xc88d('0x3b')]=_['intersection'](_0x2d73ef[_0xc88d('0x31')],_0x2d73ef[_0xc88d('0x33')]);_0x48453d['attributes']=_['intersection'](_0x2d73ef[_0xc88d('0x31')],qs[_0xc88d('0x36')](_0x1d3798[_0xc88d('0x33')][_0xc88d('0x36')]));_0x48453d[_0xc88d('0x34')]=_0x48453d[_0xc88d('0x34')]['length']?_0x48453d[_0xc88d('0x34')]:_0x2d73ef['model'];if(_0x1d3798[_0xc88d('0x33')][_0xc88d('0x40')]){_0x48453d[_0xc88d('0x41')]=[{'all':!![]}];}_0x48453d=_[_0xc88d('0x3e')]({},_0x48453d,_0x1d3798['options']);return db[_0xc88d('0x2d')]['find'](_0x48453d)[_0xc88d('0x25')](handleEntityNotFound(_0x2beede,null))[_0xc88d('0x25')](respondWithResult(_0x2beede,null))[_0xc88d('0x46')](handleError(_0x2beede,null));};exports[_0xc88d('0x24')]=function(_0x4f251c,_0x58b80b){if(_0x4f251c[_0xc88d('0x47')]['id']){delete _0x4f251c[_0xc88d('0x47')]['id'];}return db[_0xc88d('0x2d')][_0xc88d('0x48')]({'where':{'id':_0x4f251c[_0xc88d('0x45')]['id']}})['then'](handleEntityNotFound(_0x58b80b,null))[_0xc88d('0x25')](saveUpdates(_0x4f251c[_0xc88d('0x47')],null))[_0xc88d('0x25')](respondWithResult(_0x58b80b,null))[_0xc88d('0x46')](handleError(_0x58b80b,null));};exports['destroy']=function(_0x57392d,_0x1ac479){return db[_0xc88d('0x2d')][_0xc88d('0x48')]({'where':{'id':_0x57392d[_0xc88d('0x45')]['id']}})[_0xc88d('0x25')](handleEntityNotFound(_0x1ac479,null))[_0xc88d('0x25')](removeEntity(_0x1ac479,null))[_0xc88d('0x46')](handleError(_0x1ac479,null));};exports[_0xc88d('0x49')]=function(_0x442379,_0x248260){var _0x225625={'key':_0x442379[_0xc88d('0x47')][_0xc88d('0x30')]};if(_0x442379[_0xc88d('0x47')]['MailAccountId']){_0x225625['MailAccountId']=_0x442379[_0xc88d('0x47')][_0xc88d('0x4a')];}else if(_0x442379[_0xc88d('0x47')][_0xc88d('0x4b')]){_0x225625['SmsAccountId']=_0x442379[_0xc88d('0x47')]['SmsAccountId'];}else if(_0x442379[_0xc88d('0x47')]['OpenchannelAccountId']){_0x225625[_0xc88d('0x4c')]=_0x442379['body']['OpenchannelAccountId'];}else if(_0x442379[_0xc88d('0x47')][_0xc88d('0x4d')]){_0x225625[_0xc88d('0x4d')]=_0x442379[_0xc88d('0x47')][_0xc88d('0x4d')];}return db[_0xc88d('0x2d')]['find']({'where':_0x225625})[_0xc88d('0x25')](function(_0x19642a){if(_0x19642a){throw new db['Sequelize'][(_0xc88d('0x4e'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xc88d('0x2d')][_0xc88d('0x49')](_0x442379[_0xc88d('0x47')]);})[_0xc88d('0x25')](function(_0x4d9914){var _0x1e0500=_0x442379[_0xc88d('0x4f')][_0xc88d('0x50')]({'plain':!![]});if(!_0x1e0500)throw new Error(_0xc88d('0x51'));if(_0x1e0500[_0xc88d('0x52')]===_0xc88d('0x4f')){var _0x248e76=_0x4d9914['get']({'plain':!![]});return db[_0xc88d('0x53')][_0xc88d('0x48')]({'where':{'name':_0xc88d('0x26'),'userProfileId':_0x1e0500[_0xc88d('0x54')]},'raw':!![]})['then'](function(_0x422d85){if(_0x422d85&&_0x422d85[_0xc88d('0x55')]===0x0){return db[_0xc88d('0x56')][_0xc88d('0x49')]({'name':_0x248e76['name'],'resourceId':_0x248e76['id'],'type':_0x422d85[_0xc88d('0x2b')],'sectionId':_0x422d85['id']},{})['then'](function(){return _0x4d9914;});}else{return _0x4d9914;}})[_0xc88d('0x46')](function(_0x25d124){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25d124);throw _0x25d124;});}return _0x4d9914;})['then'](respondWithResult(_0x248260,0xc9))[_0xc88d('0x46')](handleError(_0x248260,null));}; \ No newline at end of file +var _0xeb5c=['index','map','CannedAnswer','rawAttributes','fieldName','type','key','keys','filters','query','attributes','intersection','model','fields','length','hasOwnProperty','sort','where','pick','filter','options','includeAll','include','rows','show','params','merge','find','catch','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CannedAnswers','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','Content-Range','apply','save','update','destroy','then','get','UserProfileResource','sendStatus','error','stack','name'];(function(_0x206ac3,_0x2bd5c8){var _0x27e6d9=function(_0x2f393d){while(--_0x2f393d){_0x206ac3['push'](_0x206ac3['shift']());}};_0x27e6d9(++_0x2bd5c8);}(_0xeb5c,0xd4));var _0xceb5=function(_0x48b499,_0x5bdddc){_0x48b499=_0x48b499-0x0;var _0x267a48=_0xeb5c[_0x48b499];return _0x267a48;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xceb5('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xceb5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xceb5('0x2'));var util=require(_0xceb5('0x3'));var path=require(_0xceb5('0x4'));var sox=require(_0xceb5('0x5'));var csv=require(_0xceb5('0x6'));var ejs=require(_0xceb5('0x7'));var fs=require('fs');var fs_extra=require(_0xceb5('0x8'));var _=require(_0xceb5('0x9'));var squel=require(_0xceb5('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xceb5('0xb'));var Papa=require(_0xceb5('0xc'));var Redis=require(_0xceb5('0xd'));var authService=require(_0xceb5('0xe'));var qs=require(_0xceb5('0xf'));var as=require(_0xceb5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xceb5('0x11'));var utils=require(_0xceb5('0x12'));var config=require(_0xceb5('0x13'));var licenseUtil=require(_0xceb5('0x14'));var db=require(_0xceb5('0x15'))['db'];function respondWithStatusCode(_0x38dbfc,_0x4bc704){_0x4bc704=_0x4bc704||0xcc;return function(_0x869e37){if(_0x869e37){return _0x38dbfc['sendStatus'](_0x4bc704);}return _0x38dbfc[_0xceb5('0x16')](_0x4bc704)[_0xceb5('0x17')]();};}function respondWithResult(_0x30fcbd,_0x47ab31){_0x47ab31=_0x47ab31||0xc8;return function(_0x3fb2f2){if(_0x3fb2f2){return _0x30fcbd[_0xceb5('0x16')](_0x47ab31)[_0xceb5('0x18')](_0x3fb2f2);}};}function respondWithFilteredResult(_0x2553e9,_0x4288ac){return function(_0x36285a){if(_0x36285a){var _0x45deb8=typeof _0x4288ac['offset']==='undefined'&&typeof _0x4288ac[_0xceb5('0x19')]==='undefined';var _0x538351=_0x36285a[_0xceb5('0x1a')];var _0x2682d1=_0x45deb8?0x0:_0x4288ac[_0xceb5('0x1b')];var _0x52cfec=_0x45deb8?_0x36285a['count']:_0x4288ac[_0xceb5('0x1b')]+_0x4288ac['limit'];var _0x5413ef;if(_0x52cfec>=_0x538351){_0x52cfec=_0x538351;_0x5413ef=0xc8;}else{_0x5413ef=0xce;}_0x2553e9['status'](_0x5413ef);return _0x2553e9['set'](_0xceb5('0x1c'),_0x2682d1+'-'+_0x52cfec+'/'+_0x538351)[_0xceb5('0x18')](_0x36285a);}return null;};}function patchUpdates(_0x23e702){return function(_0x43a9e2){try{jsonpatch[_0xceb5('0x1d')](_0x43a9e2,_0x23e702,!![]);}catch(_0x23a974){return BPromise['reject'](_0x23a974);}return _0x43a9e2[_0xceb5('0x1e')]();};}function saveUpdates(_0x13f68d,_0xa991f4){return function(_0x230de4){if(_0x230de4){return _0x230de4[_0xceb5('0x1f')](_0x13f68d)['then'](function(_0x250233){return _0x250233;});}return null;};}function removeEntity(_0x3a200d,_0x53b0ae){return function(_0x3c9742){if(_0x3c9742){return _0x3c9742[_0xceb5('0x20')]()[_0xceb5('0x21')](function(){var _0x260ca2=_0x3c9742[_0xceb5('0x22')]({'plain':!![]});var _0x2d6d1a='CannedAnswers';return db[_0xceb5('0x23')][_0xceb5('0x20')]({'where':{'type':_0x2d6d1a,'resourceId':_0x260ca2['id']}})[_0xceb5('0x21')](function(){return _0x3c9742;});})['then'](function(){_0x3a200d[_0xceb5('0x16')](0xcc)[_0xceb5('0x17')]();});}};}function handleEntityNotFound(_0x9556a6,_0x1c64ac){return function(_0x302ab7){if(!_0x302ab7){_0x9556a6[_0xceb5('0x24')](0x194);}return _0x302ab7;};}function handleError(_0xc46e99,_0x7adf2){_0x7adf2=_0x7adf2||0x1f4;return function(_0x1a691e){logger[_0xceb5('0x25')](_0x1a691e[_0xceb5('0x26')]);if(_0x1a691e[_0xceb5('0x27')]){delete _0x1a691e[_0xceb5('0x27')];}_0xc46e99[_0xceb5('0x16')](_0x7adf2)['send'](_0x1a691e);};}exports[_0xceb5('0x28')]=function(_0x874fea,_0x45ef89){var _0x903d29={},_0x1e2faa={},_0x21dd3c={'count':0x0,'rows':[]};var _0x1b8e63=_[_0xceb5('0x29')](db[_0xceb5('0x2a')][_0xceb5('0x2b')],function(_0x48fd79){return{'name':_0x48fd79[_0xceb5('0x2c')],'type':_0x48fd79[_0xceb5('0x2d')][_0xceb5('0x2e')]};});_0x1e2faa['model']=_[_0xceb5('0x29')](_0x1b8e63,_0xceb5('0x27'));_0x1e2faa['query']=_[_0xceb5('0x2f')](_0x874fea['query']);_0x1e2faa[_0xceb5('0x30')]=_['intersection'](_0x1e2faa['model'],_0x1e2faa[_0xceb5('0x31')]);_0x903d29[_0xceb5('0x32')]=_[_0xceb5('0x33')](_0x1e2faa[_0xceb5('0x34')],qs['fields'](_0x874fea['query'][_0xceb5('0x35')]));_0x903d29[_0xceb5('0x32')]=_0x903d29[_0xceb5('0x32')][_0xceb5('0x36')]?_0x903d29[_0xceb5('0x32')]:_0x1e2faa[_0xceb5('0x34')];if(!_0x874fea[_0xceb5('0x31')][_0xceb5('0x37')]('nolimit')){_0x903d29[_0xceb5('0x19')]=qs[_0xceb5('0x19')](_0x874fea[_0xceb5('0x31')][_0xceb5('0x19')]);_0x903d29[_0xceb5('0x1b')]=qs[_0xceb5('0x1b')](_0x874fea['query'][_0xceb5('0x1b')]);}_0x903d29['order']=qs[_0xceb5('0x38')](_0x874fea[_0xceb5('0x31')][_0xceb5('0x38')]);_0x903d29[_0xceb5('0x39')]=qs[_0xceb5('0x30')](_[_0xceb5('0x3a')](_0x874fea[_0xceb5('0x31')],_0x1e2faa['filters']),_0x1b8e63);if(_0x874fea[_0xceb5('0x31')][_0xceb5('0x3b')]){_0x903d29['where']=_['merge'](_0x903d29[_0xceb5('0x39')],{'$or':[{'key':{'$like':'%'+_0x874fea[_0xceb5('0x31')][_0xceb5('0x3b')]+'%'}},{'value':{'$like':'%'+_0x874fea['query'][_0xceb5('0x3b')]+'%'}}]});}_0x903d29=_['merge']({},_0x903d29,_0x874fea[_0xceb5('0x3c')]);var _0x138ae5={'where':_0x903d29[_0xceb5('0x39')]};return db[_0xceb5('0x2a')][_0xceb5('0x1a')](_0x138ae5)[_0xceb5('0x21')](function(_0x312ced){_0x21dd3c[_0xceb5('0x1a')]=_0x312ced;if(_0x874fea[_0xceb5('0x31')][_0xceb5('0x3d')]){_0x903d29[_0xceb5('0x3e')]=[{'all':!![]}];}return db[_0xceb5('0x2a')]['findAll'](_0x903d29);})[_0xceb5('0x21')](function(_0x45987e){_0x21dd3c[_0xceb5('0x3f')]=_0x45987e;return _0x21dd3c;})[_0xceb5('0x21')](respondWithFilteredResult(_0x45ef89,_0x903d29))['catch'](handleError(_0x45ef89,null));};exports[_0xceb5('0x40')]=function(_0x36028c,_0x180a5a){var _0x529f92={'raw':!![],'where':{'id':_0x36028c[_0xceb5('0x41')]['id']}},_0x4cdb91={};_0x4cdb91[_0xceb5('0x34')]=_[_0xceb5('0x2f')](db[_0xceb5('0x2a')]['rawAttributes']);_0x4cdb91[_0xceb5('0x31')]=_['keys'](_0x36028c[_0xceb5('0x31')]);_0x4cdb91[_0xceb5('0x30')]=_[_0xceb5('0x33')](_0x4cdb91[_0xceb5('0x34')],_0x4cdb91[_0xceb5('0x31')]);_0x529f92['attributes']=_[_0xceb5('0x33')](_0x4cdb91[_0xceb5('0x34')],qs[_0xceb5('0x35')](_0x36028c[_0xceb5('0x31')][_0xceb5('0x35')]));_0x529f92[_0xceb5('0x32')]=_0x529f92[_0xceb5('0x32')][_0xceb5('0x36')]?_0x529f92[_0xceb5('0x32')]:_0x4cdb91['model'];if(_0x36028c['query']['includeAll']){_0x529f92[_0xceb5('0x3e')]=[{'all':!![]}];}_0x529f92=_[_0xceb5('0x42')]({},_0x529f92,_0x36028c['options']);return db[_0xceb5('0x2a')][_0xceb5('0x43')](_0x529f92)['then'](handleEntityNotFound(_0x180a5a,null))[_0xceb5('0x21')](respondWithResult(_0x180a5a,null))[_0xceb5('0x44')](handleError(_0x180a5a,null));};exports['update']=function(_0x2f8dcb,_0x4f966e){if(_0x2f8dcb['body']['id']){delete _0x2f8dcb[_0xceb5('0x45')]['id'];}return db[_0xceb5('0x2a')][_0xceb5('0x43')]({'where':{'id':_0x2f8dcb['params']['id']}})['then'](handleEntityNotFound(_0x4f966e,null))[_0xceb5('0x21')](saveUpdates(_0x2f8dcb[_0xceb5('0x45')],null))['then'](respondWithResult(_0x4f966e,null))['catch'](handleError(_0x4f966e,null));};exports['destroy']=function(_0x2f0079,_0x3d8a83){return db['CannedAnswer'][_0xceb5('0x43')]({'where':{'id':_0x2f0079[_0xceb5('0x41')]['id']}})['then'](handleEntityNotFound(_0x3d8a83,null))['then'](removeEntity(_0x3d8a83,null))[_0xceb5('0x44')](handleError(_0x3d8a83,null));};exports['create']=function(_0x5cf0e0,_0x3966e5){var _0x3f3553={'key':_0x5cf0e0[_0xceb5('0x45')][_0xceb5('0x2e')]};if(_0x5cf0e0['body'][_0xceb5('0x46')]){_0x3f3553[_0xceb5('0x46')]=_0x5cf0e0[_0xceb5('0x45')][_0xceb5('0x46')];}else if(_0x5cf0e0[_0xceb5('0x45')][_0xceb5('0x47')]){_0x3f3553['SmsAccountId']=_0x5cf0e0[_0xceb5('0x45')][_0xceb5('0x47')];}else if(_0x5cf0e0[_0xceb5('0x45')][_0xceb5('0x48')]){_0x3f3553[_0xceb5('0x48')]=_0x5cf0e0[_0xceb5('0x45')][_0xceb5('0x48')];}else if(_0x5cf0e0['body'][_0xceb5('0x49')]){_0x3f3553[_0xceb5('0x49')]=_0x5cf0e0[_0xceb5('0x45')][_0xceb5('0x49')];}return db[_0xceb5('0x2a')][_0xceb5('0x43')]({'where':_0x3f3553})[_0xceb5('0x21')](function(_0x4f7993){if(_0x4f7993){throw new db[(_0xceb5('0x4a'))][(_0xceb5('0x4b'))](_0xceb5('0x4c'));}return db['CannedAnswer'][_0xceb5('0x4d')](_0x5cf0e0[_0xceb5('0x45')]);})[_0xceb5('0x21')](function(_0x5711c4){var _0x40b2f0=_0x5cf0e0[_0xceb5('0x4e')]['get']({'plain':!![]});if(!_0x40b2f0)throw new Error(_0xceb5('0x4f'));if(_0x40b2f0[_0xceb5('0x50')]===_0xceb5('0x4e')){var _0x2042a0=_0x5711c4[_0xceb5('0x22')]({'plain':!![]});return db['UserProfileSection'][_0xceb5('0x43')]({'where':{'name':_0xceb5('0x51'),'userProfileId':_0x40b2f0['userProfileId']},'raw':!![]})[_0xceb5('0x21')](function(_0x4309e6){if(_0x4309e6&&_0x4309e6[_0xceb5('0x52')]===0x0){return db[_0xceb5('0x23')][_0xceb5('0x4d')]({'name':_0x2042a0['name'],'resourceId':_0x2042a0['id'],'type':_0x4309e6[_0xceb5('0x27')],'sectionId':_0x4309e6['id']},{})[_0xceb5('0x21')](function(){return _0x5711c4;});}else{return _0x5711c4;}})[_0xceb5('0x44')](function(_0x189925){logger[_0xceb5('0x25')](_0xceb5('0x53'),_0x189925);throw _0x189925;});}return _0x5711c4;})['then'](respondWithResult(_0x3966e5,0xc9))[_0xceb5('0x44')](handleError(_0x3966e5,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index ff1dc15..6a21b5d 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 _0x44a3=['path','../../config/environment','./cannedAnswer.attributes','exports','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2147ad,_0x2ed83c){var _0x56f919=function(_0x19a6df){while(--_0x19a6df){_0x2147ad['push'](_0x2147ad['shift']());}};_0x56f919(++_0x2ed83c);}(_0x44a3,0x1a9));var _0x344a=function(_0x1ca93c,_0x3271ab){_0x1ca93c=_0x1ca93c-0x0;var _0x185169=_0x44a3[_0x1ca93c];return _0x185169;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var logger=require(_0x344a('0x2'))(_0x344a('0x3'));var moment=require(_0x344a('0x4'));var BPromise=require(_0x344a('0x5'));var rp=require(_0x344a('0x6'));var fs=require('fs');var path=require(_0x344a('0x7'));var rimraf=require('rimraf');var config=require(_0x344a('0x8'));var attributes=require(_0x344a('0x9'));module[_0x344a('0xa')]=function(_0x28b51e,_0x39984a){return _0x28b51e['define']('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x344a('0xb')});}; \ No newline at end of file +var _0x569e=['utf8mb4','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','tools_canned_answers'];(function(_0x5575b0,_0x52cb7e){var _0x498b0b=function(_0x47a025){while(--_0x47a025){_0x5575b0['push'](_0x5575b0['shift']());}};_0x498b0b(++_0x52cb7e);}(_0x569e,0x199));var _0xe569=function(_0x230628,_0x4b01f9){_0x230628=_0x230628-0x0;var _0xd221b1=_0x569e[_0x230628];return _0xd221b1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe569('0x0'))(_0xe569('0x1'));var moment=require(_0xe569('0x2'));var BPromise=require(_0xe569('0x3'));var rp=require(_0xe569('0x4'));var fs=require('fs');var path=require(_0xe569('0x5'));var rimraf=require(_0xe569('0x6'));var config=require(_0xe569('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0xe569('0x8')]=function(_0x52bd49,_0x15f4e6){return _0x52bd49[_0xe569('0x9')]('CannedAnswer',attributes,{'tableName':_0xe569('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe569('0xb'),'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 86abfc7..845af53 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(_0x2cfc6d,_0x4008f6){var _0x45a575=function(_0x2958bf){while(--_0x2958bf){_0x2cfc6d['push'](_0x2cfc6d['shift']());}};_0x45a575(++_0x4008f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x44f698,_0x3896b0){var _0x2b9e7b=function(_0x23b526){while(--_0x23b526){_0x44f698['push'](_0x44f698['shift']());}};_0x2b9e7b(++_0x3896b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 f7f270e..7df2327 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 _0xa892=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get','show','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x58f877,_0x152212){var _0x2fa3c9=function(_0x167da7){while(--_0x167da7){_0x58f877['push'](_0x58f877['shift']());}};_0x2fa3c9(++_0x152212);}(_0xa892,0x150));var _0x2a89=function(_0x233061,_0x5efb44){_0x233061=_0x233061-0x0;var _0x50b4fc=_0xa892[_0x233061];return _0x50b4fc;};'use strict';var multer=require(_0x2a89('0x0'));var util=require(_0x2a89('0x1'));var path=require(_0x2a89('0x2'));var timeout=require(_0x2a89('0x3'));var express=require(_0x2a89('0x4'));var router=express[_0x2a89('0x5')]();var fs_extra=require(_0x2a89('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2a89('0x7'));var controller=require(_0x2a89('0x8'));router['get']('/',auth[_0x2a89('0x9')](),controller[_0x2a89('0xa')]);router[_0x2a89('0xb')]('/:id',auth[_0x2a89('0x9')](),controller[_0x2a89('0xc')]);router[_0x2a89('0xd')]('/',auth[_0x2a89('0x9')](),controller[_0x2a89('0xe')]);router[_0x2a89('0xf')]('/:id',auth[_0x2a89('0x9')](),controller[_0x2a89('0x10')]);router[_0x2a89('0x11')](_0x2a89('0x12'),auth[_0x2a89('0x9')](),controller[_0x2a89('0x13')]);module[_0x2a89('0x14')]=router; \ No newline at end of file +var _0xcc7f=['Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x6efb33,_0x6a6f5f){var _0x30a263=function(_0x4c1dcd){while(--_0x4c1dcd){_0x6efb33['push'](_0x6efb33['shift']());}};_0x30a263(++_0x6a6f5f);}(_0xcc7f,0x1ef));var _0xfcc7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc7f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfcc7('0x0'));var util=require(_0xfcc7('0x1'));var path=require(_0xfcc7('0x2'));var timeout=require(_0xfcc7('0x3'));var express=require(_0xfcc7('0x4'));var router=express[_0xfcc7('0x5')]();var fs_extra=require(_0xfcc7('0x6'));var auth=require(_0xfcc7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xfcc7('0x8'));var controller=require(_0xfcc7('0x9'));router[_0xfcc7('0xa')]('/',auth[_0xfcc7('0xb')](),controller[_0xfcc7('0xc')]);router[_0xfcc7('0xa')](_0xfcc7('0xd'),auth['isAuthenticated'](),controller[_0xfcc7('0xe')]);router[_0xfcc7('0xf')]('/',auth[_0xfcc7('0xb')](),controller[_0xfcc7('0x10')]);router[_0xfcc7('0x11')](_0xfcc7('0xd'),auth[_0xfcc7('0xb')](),controller['update']);router['delete'](_0xfcc7('0xd'),auth[_0xfcc7('0xb')](),controller[_0xfcc7('0x12')]);module[_0xfcc7('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 84e18b9..b706f1c 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 _0x8db0=['INTEGER','sequelize','exports','1970-01-01\x2000:00:01','STRING'];(function(_0x7c1e8a,_0x3ef421){var _0x41f757=function(_0x39e864){while(--_0x39e864){_0x7c1e8a['push'](_0x7c1e8a['shift']());}};_0x41f757(++_0x3ef421);}(_0x8db0,0x65));var _0x08db=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x8db0[_0x46d0c9];return _0x174506;};'use strict';var Sequelize=require(_0x08db('0x0'));module[_0x08db('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x08db('0x2')},'clid':{'type':Sequelize[_0x08db('0x3')]},'src':{'type':Sequelize[_0x08db('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x08db('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x08db('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x08db('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x08db('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x08db('0x3')]},'userfield':{'type':Sequelize[_0x08db('0x3')]},'uniqueid':{'type':Sequelize[_0x08db('0x3')]},'linkedid':{'type':Sequelize[_0x08db('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x08db('0x3')]},'tag':{'type':Sequelize[_0x08db('0x3')]}}; \ No newline at end of file +var _0x9a62=['exports','DATE','STRING','INTEGER'];(function(_0x20c3c2,_0x1b45e1){var _0x527149=function(_0x1b89d1){while(--_0x1b89d1){_0x20c3c2['push'](_0x20c3c2['shift']());}};_0x527149(++_0x1b45e1);}(_0x9a62,0x1bc));var _0x29a6=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9a62[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0x29a6('0x0')]={'calldate':{'type':Sequelize[_0x29a6('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x29a6('0x2')]},'src':{'type':Sequelize[_0x29a6('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x29a6('0x2')]},'dstchannel':{'type':Sequelize[_0x29a6('0x2')]},'lastapp':{'type':Sequelize[_0x29a6('0x2')]},'lastdata':{'type':Sequelize[_0x29a6('0x2')]},'duration':{'type':Sequelize[_0x29a6('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x29a6('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x29a6('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x29a6('0x2')]},'uniqueid':{'type':Sequelize[_0x29a6('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x29a6('0x2')]},'type':{'type':Sequelize[_0x29a6('0x2')]},'tag':{'type':Sequelize[_0x29a6('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index f0680af..0ffd3fa 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 _0x8ca9=['show','params','rawAttributes','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','reject','save','then','destroy','sendStatus','stack','index','map','Cdr','type','key','name','keys','filters','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x471268,_0x5ce885){var _0x1298f3=function(_0x3f5110){while(--_0x3f5110){_0x471268['push'](_0x471268['shift']());}};_0x1298f3(++_0x5ce885);}(_0x8ca9,0x9c));var _0x98ca=function(_0x2dc656,_0x274ada){_0x2dc656=_0x2dc656-0x0;var _0xf59567=_0x8ca9[_0x2dc656];return _0xf59567;};'use strict';var emlformat=require(_0x98ca('0x0'));var rimraf=require(_0x98ca('0x1'));var zipdir=require(_0x98ca('0x2'));var jsonpatch=require(_0x98ca('0x3'));var rp=require(_0x98ca('0x4'));var moment=require(_0x98ca('0x5'));var BPromise=require(_0x98ca('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x98ca('0x7'));var sox=require('sox');var csv=require(_0x98ca('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98ca('0x9'));var _=require(_0x98ca('0xa'));var squel=require(_0x98ca('0xb'));var crypto=require(_0x98ca('0xc'));var jsforce=require(_0x98ca('0xd'));var deskjs=require(_0x98ca('0xe'));var toCsv=require(_0x98ca('0x8'));var querystring=require(_0x98ca('0xf'));var Papa=require(_0x98ca('0x10'));var Redis=require(_0x98ca('0x11'));var authService=require(_0x98ca('0x12'));var qs=require(_0x98ca('0x13'));var as=require(_0x98ca('0x14'));var hardwareService=require(_0x98ca('0x15'));var logger=require(_0x98ca('0x16'))(_0x98ca('0x17'));var utils=require(_0x98ca('0x18'));var config=require(_0x98ca('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x98ca('0x1a'))['db'];function respondWithStatusCode(_0x44b65b,_0xba3887){_0xba3887=_0xba3887||0xcc;return function(_0x472e13){if(_0x472e13){return _0x44b65b['sendStatus'](_0xba3887);}return _0x44b65b[_0x98ca('0x1b')](_0xba3887)[_0x98ca('0x1c')]();};}function respondWithResult(_0x9a230e,_0xa2bab4){_0xa2bab4=_0xa2bab4||0xc8;return function(_0x3df0ef){if(_0x3df0ef){return _0x9a230e[_0x98ca('0x1b')](_0xa2bab4)[_0x98ca('0x1d')](_0x3df0ef);}};}function respondWithFilteredResult(_0x4940ca,_0x330713){return function(_0x29df1b){if(_0x29df1b){var _0x29f46b=typeof _0x330713[_0x98ca('0x1e')]==='undefined'&&typeof _0x330713[_0x98ca('0x1f')]===_0x98ca('0x20');var _0xe9f8ad=_0x29df1b[_0x98ca('0x21')];var _0x4523bb=_0x29f46b?0x0:_0x330713[_0x98ca('0x1e')];var _0x28c8a6=_0x29f46b?_0x29df1b[_0x98ca('0x21')]:_0x330713[_0x98ca('0x1e')]+_0x330713[_0x98ca('0x1f')];var _0x1b2c69;if(_0x28c8a6>=_0xe9f8ad){_0x28c8a6=_0xe9f8ad;_0x1b2c69=0xc8;}else{_0x1b2c69=0xce;}_0x4940ca['status'](_0x1b2c69);return _0x4940ca[_0x98ca('0x22')]('Content-Range',_0x4523bb+'-'+_0x28c8a6+'/'+_0xe9f8ad)[_0x98ca('0x1d')](_0x29df1b);}return null;};}function patchUpdates(_0x2fe568){return function(_0x50f8b4){try{jsonpatch['apply'](_0x50f8b4,_0x2fe568,!![]);}catch(_0x4620e3){return BPromise[_0x98ca('0x23')](_0x4620e3);}return _0x50f8b4[_0x98ca('0x24')]();};}function saveUpdates(_0x519927,_0x2f7742){return function(_0xc23332){if(_0xc23332){return _0xc23332['update'](_0x519927)[_0x98ca('0x25')](function(_0x5dc400){return _0x5dc400;});}return null;};}function removeEntity(_0x3fd0bd,_0x323cdb){return function(_0x430d16){if(_0x430d16){return _0x430d16[_0x98ca('0x26')]()[_0x98ca('0x25')](function(){_0x3fd0bd[_0x98ca('0x1b')](0xcc)[_0x98ca('0x1c')]();});}};}function handleEntityNotFound(_0x50b1a2,_0x2029cb){return function(_0x4fc3c9){if(!_0x4fc3c9){_0x50b1a2[_0x98ca('0x27')](0x194);}return _0x4fc3c9;};}function handleError(_0x1bdb75,_0x5eb829){_0x5eb829=_0x5eb829||0x1f4;return function(_0x1f569b){logger['error'](_0x1f569b[_0x98ca('0x28')]);if(_0x1f569b['name']){delete _0x1f569b['name'];}_0x1bdb75[_0x98ca('0x1b')](_0x5eb829)['send'](_0x1f569b);};}exports[_0x98ca('0x29')]=function(_0x35b920,_0x13f766){var _0x21a12a={},_0x3b3e60={},_0x1e7fcf={'count':0x0,'rows':[]};var _0x11389a=_[_0x98ca('0x2a')](db[_0x98ca('0x2b')]['rawAttributes'],function(_0x2ebf28){return{'name':_0x2ebf28['fieldName'],'type':_0x2ebf28[_0x98ca('0x2c')][_0x98ca('0x2d')]};});_0x3b3e60['model']=_['map'](_0x11389a,_0x98ca('0x2e'));_0x3b3e60['query']=_[_0x98ca('0x2f')](_0x35b920['query']);_0x3b3e60[_0x98ca('0x30')]=_['intersection'](_0x3b3e60[_0x98ca('0x31')],_0x3b3e60[_0x98ca('0x32')]);_0x21a12a['attributes']=_[_0x98ca('0x33')](_0x3b3e60[_0x98ca('0x31')],qs['fields'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x34')]));_0x21a12a['attributes']=_0x21a12a[_0x98ca('0x35')][_0x98ca('0x36')]?_0x21a12a[_0x98ca('0x35')]:_0x3b3e60[_0x98ca('0x31')];if(!_0x35b920[_0x98ca('0x32')]['hasOwnProperty'](_0x98ca('0x37'))){_0x21a12a[_0x98ca('0x1f')]=qs['limit'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x1f')]);_0x21a12a[_0x98ca('0x1e')]=qs['offset'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x1e')]);}_0x21a12a[_0x98ca('0x38')]=qs['sort'](_0x35b920[_0x98ca('0x32')][_0x98ca('0x39')]);_0x21a12a[_0x98ca('0x3a')]=qs['filters'](_['pick'](_0x35b920[_0x98ca('0x32')],_0x3b3e60[_0x98ca('0x30')]),_0x11389a);if(_0x35b920[_0x98ca('0x32')]['filter']){_0x21a12a[_0x98ca('0x3a')]=_[_0x98ca('0x3b')](_0x21a12a[_0x98ca('0x3a')],{'$or':_['map'](_0x11389a,function(_0x1f513b){if(_0x1f513b[_0x98ca('0x2c')]!==_0x98ca('0x3c')){var _0x450745={};_0x450745[_0x1f513b[_0x98ca('0x2e')]]={'$like':'%'+_0x35b920['query']['filter']+'%'};return _0x450745;}})});}_0x21a12a=_['merge']({},_0x21a12a,_0x35b920[_0x98ca('0x3d')]);var _0x2ef2f4={'where':_0x21a12a[_0x98ca('0x3a')]};return db[_0x98ca('0x2b')][_0x98ca('0x21')](_0x2ef2f4)[_0x98ca('0x25')](function(_0x29801f){_0x1e7fcf['count']=_0x29801f;if(_0x35b920['query'][_0x98ca('0x3e')]){_0x21a12a[_0x98ca('0x3f')]=[{'all':!![]}];}return db[_0x98ca('0x2b')][_0x98ca('0x40')](_0x21a12a);})[_0x98ca('0x25')](function(_0x535fdc){_0x1e7fcf['rows']=_0x535fdc;return _0x1e7fcf;})['then'](respondWithFilteredResult(_0x13f766,_0x21a12a))[_0x98ca('0x41')](handleError(_0x13f766,null));};exports[_0x98ca('0x42')]=function(_0x914606,_0x3f260b){var _0x4ede34={'raw':!![],'where':{'id':_0x914606[_0x98ca('0x43')]['id']}},_0x4c2515={};_0x4c2515[_0x98ca('0x31')]=_[_0x98ca('0x2f')](db[_0x98ca('0x2b')][_0x98ca('0x44')]);_0x4c2515[_0x98ca('0x32')]=_[_0x98ca('0x2f')](_0x914606[_0x98ca('0x32')]);_0x4c2515[_0x98ca('0x30')]=_[_0x98ca('0x33')](_0x4c2515[_0x98ca('0x31')],_0x4c2515['query']);_0x4ede34[_0x98ca('0x35')]=_[_0x98ca('0x33')](_0x4c2515[_0x98ca('0x31')],qs[_0x98ca('0x34')](_0x914606[_0x98ca('0x32')][_0x98ca('0x34')]));_0x4ede34[_0x98ca('0x35')]=_0x4ede34[_0x98ca('0x35')][_0x98ca('0x36')]?_0x4ede34['attributes']:_0x4c2515[_0x98ca('0x31')];if(_0x914606[_0x98ca('0x32')]['includeAll']){_0x4ede34[_0x98ca('0x3f')]=[{'all':!![]}];}_0x4ede34=_['merge']({},_0x4ede34,_0x914606[_0x98ca('0x3d')]);return db[_0x98ca('0x2b')][_0x98ca('0x45')](_0x4ede34)[_0x98ca('0x25')](handleEntityNotFound(_0x3f260b,null))[_0x98ca('0x25')](respondWithResult(_0x3f260b,null))[_0x98ca('0x41')](handleError(_0x3f260b,null));};exports[_0x98ca('0x46')]=function(_0x15ed74,_0x2c7d53){return db[_0x98ca('0x2b')][_0x98ca('0x46')](_0x15ed74[_0x98ca('0x47')],{})['then'](respondWithResult(_0x2c7d53,0xc9))[_0x98ca('0x41')](handleError(_0x2c7d53,null));};exports[_0x98ca('0x48')]=function(_0x40498f,_0x19dc39){if(_0x40498f['body']['id']){delete _0x40498f[_0x98ca('0x47')]['id'];}return db[_0x98ca('0x2b')][_0x98ca('0x45')]({'where':{'id':_0x40498f[_0x98ca('0x43')]['id']}})[_0x98ca('0x25')](handleEntityNotFound(_0x19dc39,null))[_0x98ca('0x25')](saveUpdates(_0x40498f[_0x98ca('0x47')],null))['then'](respondWithResult(_0x19dc39,null))['catch'](handleError(_0x19dc39,null));};exports['destroy']=function(_0x3247af,_0x3715cb){return db[_0x98ca('0x2b')][_0x98ca('0x45')]({'where':{'id':_0x3247af['params']['id']}})['then'](handleEntityNotFound(_0x3715cb,null))[_0x98ca('0x25')](removeEntity(_0x3715cb,null))[_0x98ca('0x41')](handleError(_0x3715cb,null));};exports[_0x98ca('0x49')]=function(_0x408266,_0x46bb13){return db[_0x98ca('0x2b')][_0x98ca('0x49')]()[_0x98ca('0x25')](respondWithResult(_0x46bb13,null))[_0x98ca('0x41')](handleError(_0x46bb13,null));}; \ No newline at end of file +var _0x25fa=['json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','Cdr','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25fa,0x109));var _0xa25f=function(_0x5cfc53,_0x1f6d52){_0x5cfc53=_0x5cfc53-0x0;var _0x4c79cb=_0x25fa[_0x5cfc53];return _0x4c79cb;};'use strict';var emlformat=require(_0xa25f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa25f('0x1'));var jsonpatch=require(_0xa25f('0x2'));var rp=require('request-promise');var moment=require(_0xa25f('0x3'));var BPromise=require(_0xa25f('0x4'));var Mustache=require(_0xa25f('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa25f('0x6'));var csv=require('to-csv');var ejs=require(_0xa25f('0x7'));var fs=require('fs');var fs_extra=require(_0xa25f('0x8'));var _=require(_0xa25f('0x9'));var squel=require(_0xa25f('0xa'));var crypto=require(_0xa25f('0xb'));var jsforce=require(_0xa25f('0xc'));var deskjs=require(_0xa25f('0xd'));var toCsv=require(_0xa25f('0xe'));var querystring=require(_0xa25f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa25f('0x10'));var authService=require(_0xa25f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa25f('0x12'));var hardwareService=require(_0xa25f('0x13'));var logger=require(_0xa25f('0x14'))(_0xa25f('0x15'));var utils=require('../../config/utils');var config=require(_0xa25f('0x16'));var licenseUtil=require(_0xa25f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e970c,_0x465e41){_0x465e41=_0x465e41||0xcc;return function(_0x50bb78){if(_0x50bb78){return _0x3e970c[_0xa25f('0x18')](_0x465e41);}return _0x3e970c[_0xa25f('0x19')](_0x465e41)[_0xa25f('0x1a')]();};}function respondWithResult(_0x4b3792,_0x199e18){_0x199e18=_0x199e18||0xc8;return function(_0x2a627f){if(_0x2a627f){return _0x4b3792[_0xa25f('0x19')](_0x199e18)[_0xa25f('0x1b')](_0x2a627f);}};}function respondWithFilteredResult(_0x465809,_0x2d2417){return function(_0x1e5836){if(_0x1e5836){var _0x1859ba=typeof _0x2d2417['offset']===_0xa25f('0x1c')&&typeof _0x2d2417[_0xa25f('0x1d')]===_0xa25f('0x1c');var _0x451a6e=_0x1e5836[_0xa25f('0x1e')];var _0x427105=_0x1859ba?0x0:_0x2d2417['offset'];var _0x292171=_0x1859ba?_0x1e5836['count']:_0x2d2417[_0xa25f('0x1f')]+_0x2d2417['limit'];var _0x559c89;if(_0x292171>=_0x451a6e){_0x292171=_0x451a6e;_0x559c89=0xc8;}else{_0x559c89=0xce;}_0x465809[_0xa25f('0x19')](_0x559c89);return _0x465809['set'](_0xa25f('0x20'),_0x427105+'-'+_0x292171+'/'+_0x451a6e)[_0xa25f('0x1b')](_0x1e5836);}return null;};}function patchUpdates(_0x2aaf3a){return function(_0x3c2665){try{jsonpatch[_0xa25f('0x21')](_0x3c2665,_0x2aaf3a,!![]);}catch(_0x504135){return BPromise[_0xa25f('0x22')](_0x504135);}return _0x3c2665[_0xa25f('0x23')]();};}function saveUpdates(_0x371716,_0x14b7f6){return function(_0x5d2803){if(_0x5d2803){return _0x5d2803[_0xa25f('0x24')](_0x371716)[_0xa25f('0x25')](function(_0x248c0c){return _0x248c0c;});}return null;};}function removeEntity(_0x3675b5,_0x4c6f4d){return function(_0x2b710f){if(_0x2b710f){return _0x2b710f[_0xa25f('0x26')]()[_0xa25f('0x25')](function(){_0x3675b5[_0xa25f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2812d7,_0x898446){return function(_0x53f011){if(!_0x53f011){_0x2812d7[_0xa25f('0x18')](0x194);}return _0x53f011;};}function handleError(_0x51dbf8,_0x2df893){_0x2df893=_0x2df893||0x1f4;return function(_0x4eb7b7){logger[_0xa25f('0x27')](_0x4eb7b7[_0xa25f('0x28')]);if(_0x4eb7b7['name']){delete _0x4eb7b7[_0xa25f('0x29')];}_0x51dbf8[_0xa25f('0x19')](_0x2df893)['send'](_0x4eb7b7);};}exports[_0xa25f('0x2a')]=function(_0x5d39c7,_0x1030c4){var _0x41a847={},_0x472114={},_0x208518={'count':0x0,'rows':[]};var _0x334629=_['map'](db[_0xa25f('0x2b')][_0xa25f('0x2c')],function(_0x119ffc){return{'name':_0x119ffc[_0xa25f('0x2d')],'type':_0x119ffc[_0xa25f('0x2e')]['key']};});_0x472114[_0xa25f('0x2f')]=_[_0xa25f('0x30')](_0x334629,_0xa25f('0x29'));_0x472114[_0xa25f('0x31')]=_[_0xa25f('0x32')](_0x5d39c7[_0xa25f('0x31')]);_0x472114[_0xa25f('0x33')]=_[_0xa25f('0x34')](_0x472114[_0xa25f('0x2f')],_0x472114['query']);_0x41a847['attributes']=_['intersection'](_0x472114[_0xa25f('0x2f')],qs[_0xa25f('0x35')](_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x35')]));_0x41a847[_0xa25f('0x36')]=_0x41a847[_0xa25f('0x36')][_0xa25f('0x37')]?_0x41a847[_0xa25f('0x36')]:_0x472114[_0xa25f('0x2f')];if(!_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x38')]('nolimit')){_0x41a847['limit']=qs[_0xa25f('0x1d')](_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x1d')]);_0x41a847['offset']=qs['offset'](_0x5d39c7['query'][_0xa25f('0x1f')]);}_0x41a847[_0xa25f('0x39')]=qs[_0xa25f('0x3a')](_0x5d39c7['query']['sort']);_0x41a847[_0xa25f('0x3b')]=qs[_0xa25f('0x33')](_['pick'](_0x5d39c7['query'],_0x472114[_0xa25f('0x33')]),_0x334629);if(_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x3c')]){_0x41a847['where']=_[_0xa25f('0x3d')](_0x41a847[_0xa25f('0x3b')],{'$or':_[_0xa25f('0x30')](_0x334629,function(_0x49556e){if(_0x49556e['type']!==_0xa25f('0x3e')){var _0x44c9c8={};_0x44c9c8[_0x49556e[_0xa25f('0x29')]]={'$like':'%'+_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x3c')]+'%'};return _0x44c9c8;}})});}_0x41a847=_[_0xa25f('0x3d')]({},_0x41a847,_0x5d39c7[_0xa25f('0x3f')]);var _0x3382f4={'where':_0x41a847['where']};return db[_0xa25f('0x2b')][_0xa25f('0x1e')](_0x3382f4)[_0xa25f('0x25')](function(_0x2e886f){_0x208518[_0xa25f('0x1e')]=_0x2e886f;if(_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x40')]){_0x41a847[_0xa25f('0x41')]=[{'all':!![]}];}return db[_0xa25f('0x2b')][_0xa25f('0x42')](_0x41a847);})[_0xa25f('0x25')](function(_0x3267a0){_0x208518[_0xa25f('0x43')]=_0x3267a0;return _0x208518;})['then'](respondWithFilteredResult(_0x1030c4,_0x41a847))[_0xa25f('0x44')](handleError(_0x1030c4,null));};exports['show']=function(_0xace015,_0x320119){var _0x36afe4={'raw':!![],'where':{'id':_0xace015[_0xa25f('0x45')]['id']}},_0x559874={};_0x559874[_0xa25f('0x2f')]=_[_0xa25f('0x32')](db[_0xa25f('0x2b')]['rawAttributes']);_0x559874[_0xa25f('0x31')]=_[_0xa25f('0x32')](_0xace015[_0xa25f('0x31')]);_0x559874[_0xa25f('0x33')]=_[_0xa25f('0x34')](_0x559874[_0xa25f('0x2f')],_0x559874['query']);_0x36afe4[_0xa25f('0x36')]=_[_0xa25f('0x34')](_0x559874['model'],qs[_0xa25f('0x35')](_0xace015[_0xa25f('0x31')][_0xa25f('0x35')]));_0x36afe4[_0xa25f('0x36')]=_0x36afe4[_0xa25f('0x36')][_0xa25f('0x37')]?_0x36afe4[_0xa25f('0x36')]:_0x559874[_0xa25f('0x2f')];if(_0xace015[_0xa25f('0x31')][_0xa25f('0x40')]){_0x36afe4[_0xa25f('0x41')]=[{'all':!![]}];}_0x36afe4=_[_0xa25f('0x3d')]({},_0x36afe4,_0xace015[_0xa25f('0x3f')]);return db['Cdr'][_0xa25f('0x46')](_0x36afe4)[_0xa25f('0x25')](handleEntityNotFound(_0x320119,null))[_0xa25f('0x25')](respondWithResult(_0x320119,null))[_0xa25f('0x44')](handleError(_0x320119,null));};exports['create']=function(_0x34717c,_0x43888b){return db[_0xa25f('0x2b')]['create'](_0x34717c[_0xa25f('0x47')],{})[_0xa25f('0x25')](respondWithResult(_0x43888b,0xc9))[_0xa25f('0x44')](handleError(_0x43888b,null));};exports[_0xa25f('0x24')]=function(_0x18c9f2,_0x3b6d34){if(_0x18c9f2[_0xa25f('0x47')]['id']){delete _0x18c9f2[_0xa25f('0x47')]['id'];}return db['Cdr'][_0xa25f('0x46')]({'where':{'id':_0x18c9f2[_0xa25f('0x45')]['id']}})[_0xa25f('0x25')](handleEntityNotFound(_0x3b6d34,null))[_0xa25f('0x25')](saveUpdates(_0x18c9f2[_0xa25f('0x47')],null))[_0xa25f('0x25')](respondWithResult(_0x3b6d34,null))[_0xa25f('0x44')](handleError(_0x3b6d34,null));};exports[_0xa25f('0x26')]=function(_0x26a096,_0xe04d67){return db[_0xa25f('0x2b')][_0xa25f('0x46')]({'where':{'id':_0x26a096[_0xa25f('0x45')]['id']}})[_0xa25f('0x25')](handleEntityNotFound(_0xe04d67,null))[_0xa25f('0x25')](removeEntity(_0xe04d67,null))[_0xa25f('0x44')](handleError(_0xe04d67,null));};exports[_0xa25f('0x48')]=function(_0x2fedba,_0x32f719){return db[_0xa25f('0x2b')][_0xa25f('0x48')]()[_0xa25f('0x25')](respondWithResult(_0x32f719,null))['catch'](handleError(_0x32f719,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 58bbc4c..30270ae 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(_0x496c30,_0x32d7e2){var _0x2abdfc=function(_0xd132e1){while(--_0xd132e1){_0x496c30['push'](_0x496c30['shift']());}};_0x2abdfc(++_0x32d7e2);}(_0x7a54,0x106));var _0x47a5=function(_0x3fb9b7,_0x5a53bb){_0x3fb9b7=_0x3fb9b7-0x0;var _0x482699=_0x7a54[_0x3fb9b7];return _0x482699;};'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 _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x3643a8,_0x20d68c){var _0x3e7dfd=function(_0x13eecf){while(--_0x13eecf){_0x3643a8['push'](_0x3643a8['shift']());}};_0x3e7dfd(++_0x20d68c);}(_0x7a54,0x106));var _0x47a5=function(_0x47d7e5,_0x59117a){_0x47d7e5=_0x47d7e5-0x0;var _0x10b917=_0x7a54[_0x47d7e5];return _0x10b917;};'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 diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 8dc329f..3ab76f5 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 _0x9f57=['http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5e4c24,_0x3a0461){var _0x40208b=function(_0x2e6267){while(--_0x2e6267){_0x5e4c24['push'](_0x5e4c24['shift']());}};_0x40208b(++_0x3a0461);}(_0x9f57,0x1d5));var _0x79f5=function(_0x46c776,_0x1892f4){_0x46c776=_0x46c776-0x0;var _0x454d6a=_0x9f57[_0x46c776];return _0x454d6a;};'use strict';var _=require('lodash');var util=require(_0x79f5('0x0'));var moment=require(_0x79f5('0x1'));var BPromise=require(_0x79f5('0x2'));var rs=require(_0x79f5('0x3'));var fs=require('fs');var Redis=require(_0x79f5('0x4'));var db=require(_0x79f5('0x5'))['db'];var utils=require(_0x79f5('0x6'));var logger=require(_0x79f5('0x7'))('rpc');var config=require(_0x79f5('0x8'));var jayson=require(_0x79f5('0x9'));var client=jayson[_0x79f5('0xa')][_0x79f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x418edc,_0x4f4c7c,_0x7e7a9a){return new BPromise(function(_0x376710,_0x418c23){return client[_0x79f5('0xc')](_0x418edc,_0x7e7a9a)[_0x79f5('0xd')](function(_0xf79e4d){logger[_0x79f5('0xe')](_0x79f5('0xf'),_0x4f4c7c,_0x79f5('0x10'));logger['debug'](_0x79f5('0x11'),_0x4f4c7c,_0x79f5('0x10'),JSON[_0x79f5('0x12')](_0xf79e4d));if(_0xf79e4d[_0x79f5('0x13')]){if(_0xf79e4d[_0x79f5('0x13')][_0x79f5('0x14')]===0x1f4){logger[_0x79f5('0x13')](_0x79f5('0xf'),_0x4f4c7c,_0xf79e4d[_0x79f5('0x13')]['message']);return _0x418c23(_0xf79e4d[_0x79f5('0x13')]['message']);}logger[_0x79f5('0x13')]('Cdr,\x20%s,\x20%s',_0x4f4c7c,_0xf79e4d[_0x79f5('0x13')][_0x79f5('0x15')]);return _0x376710(_0xf79e4d[_0x79f5('0x13')][_0x79f5('0x15')]);}else{logger[_0x79f5('0xe')](_0x79f5('0xf'),_0x4f4c7c,'request\x20sent');_0x376710(_0xf79e4d[_0x79f5('0x16')]['message']);}})[_0x79f5('0x17')](function(_0x4b0276){logger['error'](_0x79f5('0xf'),_0x4f4c7c,_0x4b0276);_0x418c23(_0x4b0276);});});} \ No newline at end of file +var _0xf495=['http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x1c236d,_0x5029dc){var _0x53510f=function(_0x5f0587){while(--_0x5f0587){_0x1c236d['push'](_0x1c236d['shift']());}};_0x53510f(++_0x5029dc);}(_0xf495,0x100));var _0x5f49=function(_0xe331b5,_0x3c80c1){_0xe331b5=_0xe331b5-0x0;var _0x37ec39=_0xf495[_0xe331b5];return _0x37ec39;};'use strict';var _=require(_0x5f49('0x0'));var util=require(_0x5f49('0x1'));var moment=require('moment');var BPromise=require(_0x5f49('0x2'));var rs=require(_0x5f49('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f49('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5f49('0x5'));var jayson=require(_0x5f49('0x6'));var client=jayson[_0x5f49('0x7')][_0x5f49('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x352bd1,_0x2ee2a4,_0x2446c6){return new BPromise(function(_0x915b34,_0x1b6be6){return client[_0x5f49('0x9')](_0x352bd1,_0x2446c6)[_0x5f49('0xa')](function(_0x5e5034){logger[_0x5f49('0xb')](_0x5f49('0xc'),_0x2ee2a4,_0x5f49('0xd'));logger[_0x5f49('0xe')](_0x5f49('0xf'),_0x2ee2a4,_0x5f49('0xd'),JSON[_0x5f49('0x10')](_0x5e5034));if(_0x5e5034[_0x5f49('0x11')]){if(_0x5e5034[_0x5f49('0x11')][_0x5f49('0x12')]===0x1f4){logger[_0x5f49('0x11')](_0x5f49('0xc'),_0x2ee2a4,_0x5e5034[_0x5f49('0x11')][_0x5f49('0x13')]);return _0x1b6be6(_0x5e5034[_0x5f49('0x11')]['message']);}logger['error'](_0x5f49('0xc'),_0x2ee2a4,_0x5e5034[_0x5f49('0x11')]['message']);return _0x915b34(_0x5e5034['error'][_0x5f49('0x13')]);}else{logger['info'](_0x5f49('0xc'),_0x2ee2a4,_0x5f49('0xd'));_0x915b34(_0x5e5034[_0x5f49('0x14')]['message']);}})[_0x5f49('0x15')](function(_0x3966bc){logger[_0x5f49('0x11')](_0x5f49('0xc'),_0x2ee2a4,_0x3966bc);_0x1b6be6(_0x3966bc);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index dc8130e..0a14483 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_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'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 1db83fa..cb0fabf 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 _0x1136=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x520d40,_0x4f397e){var _0x1e3e24=function(_0x56fb3d){while(--_0x56fb3d){_0x520d40['push'](_0x520d40['shift']());}};_0x1e3e24(++_0x4f397e);}(_0x1136,0x153));var _0x6113=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1136[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x6113('0x0'));module[_0x6113('0x1')]={'priority':{'type':Sequelize[_0x6113('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6113('0x3')},'appdata':{'type':Sequelize[_0x6113('0x4')]()},'description':{'type':Sequelize[_0x6113('0x5')]},'interval':{'type':Sequelize[_0x6113('0x5')],'defaultValue':_0x6113('0x6')}}; \ No newline at end of file +var _0xd31b=['noop','TEXT','STRING','*,*,*,*','sequelize','INTEGER'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xd31b,0x13c));var _0xbd31=function(_0x312ff8,_0x5d7167){_0x312ff8=_0x312ff8-0x0;var _0x4e144b=_0xd31b[_0x312ff8];return _0x4e144b;};'use strict';var Sequelize=require(_0xbd31('0x0'));module['exports']={'priority':{'type':Sequelize[_0xbd31('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbd31('0x2')},'appdata':{'type':Sequelize[_0xbd31('0x3')]()},'description':{'type':Sequelize[_0xbd31('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbd31('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 2d465d6..3b82e3d 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 _0xde2c=['fields','length','includeAll','include','merge','find','then','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','save','update','destroy','error','name','send','show','params','keys','ChatApplication','rawAttributes','query','intersection','model','attributes'];(function(_0x405b65,_0x282a2d){var _0x2dc325=function(_0x2d436c){while(--_0x2d436c){_0x405b65['push'](_0x405b65['shift']());}};_0x2dc325(++_0x282a2d);}(_0xde2c,0x7f));var _0xcde2=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0xde2c[_0x305c31];return _0x17f39f;};'use strict';var emlformat=require(_0xcde2('0x0'));var rimraf=require(_0xcde2('0x1'));var zipdir=require(_0xcde2('0x2'));var jsonpatch=require(_0xcde2('0x3'));var rp=require(_0xcde2('0x4'));var moment=require(_0xcde2('0x5'));var BPromise=require(_0xcde2('0x6'));var Mustache=require(_0xcde2('0x7'));var util=require('util');var path=require(_0xcde2('0x8'));var sox=require(_0xcde2('0x9'));var csv=require(_0xcde2('0xa'));var ejs=require(_0xcde2('0xb'));var fs=require('fs');var fs_extra=require(_0xcde2('0xc'));var _=require('lodash');var squel=require(_0xcde2('0xd'));var crypto=require(_0xcde2('0xe'));var jsforce=require(_0xcde2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcde2('0x10'));var Papa=require(_0xcde2('0x11'));var Redis=require('ioredis');var authService=require(_0xcde2('0x12'));var qs=require(_0xcde2('0x13'));var as=require(_0xcde2('0x14'));var hardwareService=require(_0xcde2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xcde2('0x16'));var config=require(_0xcde2('0x17'));var licenseUtil=require(_0xcde2('0x18'));var db=require(_0xcde2('0x19'))['db'];function respondWithStatusCode(_0x932b90,_0x1ea4bb){_0x1ea4bb=_0x1ea4bb||0xcc;return function(_0x599294){if(_0x599294){return _0x932b90[_0xcde2('0x1a')](_0x1ea4bb);}return _0x932b90['status'](_0x1ea4bb)[_0xcde2('0x1b')]();};}function respondWithResult(_0x4f0ac9,_0x4b0e0e){_0x4b0e0e=_0x4b0e0e||0xc8;return function(_0x34e079){if(_0x34e079){return _0x4f0ac9[_0xcde2('0x1c')](_0x4b0e0e)[_0xcde2('0x1d')](_0x34e079);}};}function respondWithFilteredResult(_0x19b54b,_0x11665c){return function(_0x5312c7){if(_0x5312c7){var _0x39b023=typeof _0x11665c['offset']===_0xcde2('0x1e')&&typeof _0x11665c[_0xcde2('0x1f')]===_0xcde2('0x1e');var _0x1f1858=_0x5312c7['count'];var _0x4fd5aa=_0x39b023?0x0:_0x11665c['offset'];var _0x2b4468=_0x39b023?_0x5312c7['count']:_0x11665c[_0xcde2('0x20')]+_0x11665c[_0xcde2('0x1f')];var _0x252372;if(_0x2b4468>=_0x1f1858){_0x2b4468=_0x1f1858;_0x252372=0xc8;}else{_0x252372=0xce;}_0x19b54b['status'](_0x252372);return _0x19b54b[_0xcde2('0x21')](_0xcde2('0x22'),_0x4fd5aa+'-'+_0x2b4468+'/'+_0x1f1858)[_0xcde2('0x1d')](_0x5312c7);}return null;};}function patchUpdates(_0x3c1d7e){return function(_0x43df7a){try{jsonpatch['apply'](_0x43df7a,_0x3c1d7e,!![]);}catch(_0x4bce90){return BPromise['reject'](_0x4bce90);}return _0x43df7a[_0xcde2('0x23')]();};}function saveUpdates(_0x3e5170,_0x2c9562){return function(_0x4063d4){if(_0x4063d4){return _0x4063d4[_0xcde2('0x24')](_0x3e5170)['then'](function(_0x1104b8){return _0x1104b8;});}return null;};}function removeEntity(_0x52368b,_0x280d8c){return function(_0xb2123c){if(_0xb2123c){return _0xb2123c[_0xcde2('0x25')]()['then'](function(){_0x52368b['status'](0xcc)[_0xcde2('0x1b')]();});}};}function handleEntityNotFound(_0x207a12,_0x3e8aaf){return function(_0x217ec9){if(!_0x217ec9){_0x207a12[_0xcde2('0x1a')](0x194);}return _0x217ec9;};}function handleError(_0x5a5b92,_0x2d1d17){_0x2d1d17=_0x2d1d17||0x1f4;return function(_0x45275a){logger[_0xcde2('0x26')](_0x45275a['stack']);if(_0x45275a[_0xcde2('0x27')]){delete _0x45275a[_0xcde2('0x27')];}_0x5a5b92[_0xcde2('0x1c')](_0x2d1d17)[_0xcde2('0x28')](_0x45275a);};}exports[_0xcde2('0x29')]=function(_0x5b2b7,_0x40b12c){var _0x3e492f={'raw':!![],'where':{'id':_0x5b2b7[_0xcde2('0x2a')]['id']}},_0x5bf1e6={};_0x5bf1e6['model']=_[_0xcde2('0x2b')](db[_0xcde2('0x2c')][_0xcde2('0x2d')]);_0x5bf1e6['query']=_[_0xcde2('0x2b')](_0x5b2b7[_0xcde2('0x2e')]);_0x5bf1e6['filters']=_[_0xcde2('0x2f')](_0x5bf1e6[_0xcde2('0x30')],_0x5bf1e6[_0xcde2('0x2e')]);_0x3e492f[_0xcde2('0x31')]=_[_0xcde2('0x2f')](_0x5bf1e6[_0xcde2('0x30')],qs[_0xcde2('0x32')](_0x5b2b7[_0xcde2('0x2e')]['fields']));_0x3e492f[_0xcde2('0x31')]=_0x3e492f[_0xcde2('0x31')][_0xcde2('0x33')]?_0x3e492f[_0xcde2('0x31')]:_0x5bf1e6['model'];if(_0x5b2b7[_0xcde2('0x2e')][_0xcde2('0x34')]){_0x3e492f[_0xcde2('0x35')]=[{'all':!![]}];}_0x3e492f=_[_0xcde2('0x36')]({},_0x3e492f,_0x5b2b7['options']);return db[_0xcde2('0x2c')][_0xcde2('0x37')](_0x3e492f)[_0xcde2('0x38')](handleEntityNotFound(_0x40b12c,null))[_0xcde2('0x38')](respondWithResult(_0x40b12c,null))['catch'](handleError(_0x40b12c,null));};exports[_0xcde2('0x24')]=function(_0x5ab40f,_0xbde4f4){if(_0x5ab40f[_0xcde2('0x39')]['id']){delete _0x5ab40f[_0xcde2('0x39')]['id'];}return db['ChatApplication'][_0xcde2('0x37')]({'where':{'id':_0x5ab40f[_0xcde2('0x2a')]['id']}})[_0xcde2('0x38')](handleEntityNotFound(_0xbde4f4,null))[_0xcde2('0x38')](saveUpdates(_0x5ab40f['body'],null))['then'](respondWithResult(_0xbde4f4,null))[_0xcde2('0x3a')](handleError(_0xbde4f4,null));};exports[_0xcde2('0x25')]=function(_0x40e1e2,_0x4463d1){return db[_0xcde2('0x2c')][_0xcde2('0x37')]({'where':{'id':_0x40e1e2[_0xcde2('0x2a')]['id']}})[_0xcde2('0x38')](handleEntityNotFound(_0x4463d1,null))[_0xcde2('0x38')](removeEntity(_0x4463d1,null))['catch'](handleError(_0x4463d1,null));}; \ No newline at end of file +var _0x96f9=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','name','send','show','params','model','keys','ChatApplication','query','filters','attributes','intersection','fields','length','includeAll','include','merge','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel'];(function(_0x31a550,_0x13e8a6){var _0x3ae9b7=function(_0x144081){while(--_0x144081){_0x31a550['push'](_0x31a550['shift']());}};_0x3ae9b7(++_0x13e8a6);}(_0x96f9,0x64));var _0x996f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x96f9[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x996f('0x0'));var rimraf=require(_0x996f('0x1'));var zipdir=require(_0x996f('0x2'));var jsonpatch=require(_0x996f('0x3'));var rp=require(_0x996f('0x4'));var moment=require(_0x996f('0x5'));var BPromise=require(_0x996f('0x6'));var Mustache=require(_0x996f('0x7'));var util=require(_0x996f('0x8'));var path=require('path');var sox=require(_0x996f('0x9'));var csv=require(_0x996f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x996f('0xb'));var _=require(_0x996f('0xc'));var squel=require(_0x996f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x996f('0xe'));var Redis=require(_0x996f('0xf'));var authService=require(_0x996f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x996f('0x11'));var hardwareService=require(_0x996f('0x12'));var logger=require(_0x996f('0x13'))(_0x996f('0x14'));var utils=require('../../config/utils');var config=require(_0x996f('0x15'));var licenseUtil=require(_0x996f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273c14,_0x55a294){_0x55a294=_0x55a294||0xcc;return function(_0x452f56){if(_0x452f56){return _0x273c14[_0x996f('0x17')](_0x55a294);}return _0x273c14['status'](_0x55a294)[_0x996f('0x18')]();};}function respondWithResult(_0x535a83,_0x448100){_0x448100=_0x448100||0xc8;return function(_0x9318b8){if(_0x9318b8){return _0x535a83[_0x996f('0x19')](_0x448100)[_0x996f('0x1a')](_0x9318b8);}};}function respondWithFilteredResult(_0x5b129a,_0x46e8ce){return function(_0x105920){if(_0x105920){var _0x4e5527=typeof _0x46e8ce[_0x996f('0x1b')]==='undefined'&&typeof _0x46e8ce['limit']===_0x996f('0x1c');var _0x46203f=_0x105920[_0x996f('0x1d')];var _0x58c7f3=_0x4e5527?0x0:_0x46e8ce[_0x996f('0x1b')];var _0x1fc396=_0x4e5527?_0x105920['count']:_0x46e8ce[_0x996f('0x1b')]+_0x46e8ce[_0x996f('0x1e')];var _0x3f4015;if(_0x1fc396>=_0x46203f){_0x1fc396=_0x46203f;_0x3f4015=0xc8;}else{_0x3f4015=0xce;}_0x5b129a[_0x996f('0x19')](_0x3f4015);return _0x5b129a['set'](_0x996f('0x1f'),_0x58c7f3+'-'+_0x1fc396+'/'+_0x46203f)['json'](_0x105920);}return null;};}function patchUpdates(_0x35d508){return function(_0x5b3207){try{jsonpatch[_0x996f('0x20')](_0x5b3207,_0x35d508,!![]);}catch(_0x3aa9be){return BPromise[_0x996f('0x21')](_0x3aa9be);}return _0x5b3207[_0x996f('0x22')]();};}function saveUpdates(_0x17a5d3,_0x45867b){return function(_0x645b5f){if(_0x645b5f){return _0x645b5f[_0x996f('0x23')](_0x17a5d3)[_0x996f('0x24')](function(_0x5f45f2){return _0x5f45f2;});}return null;};}function removeEntity(_0x1defa9,_0x5a9fa9){return function(_0x38fd39){if(_0x38fd39){return _0x38fd39[_0x996f('0x25')]()['then'](function(){_0x1defa9[_0x996f('0x19')](0xcc)[_0x996f('0x18')]();});}};}function handleEntityNotFound(_0x48ffe0,_0x59c141){return function(_0x492b5f){if(!_0x492b5f){_0x48ffe0[_0x996f('0x17')](0x194);}return _0x492b5f;};}function handleError(_0x1ac943,_0x4e5883){_0x4e5883=_0x4e5883||0x1f4;return function(_0x2608af){logger['error'](_0x2608af['stack']);if(_0x2608af[_0x996f('0x26')]){delete _0x2608af[_0x996f('0x26')];}_0x1ac943[_0x996f('0x19')](_0x4e5883)[_0x996f('0x27')](_0x2608af);};}exports[_0x996f('0x28')]=function(_0x419662,_0x1a520c){var _0x1f43ec={'raw':!![],'where':{'id':_0x419662[_0x996f('0x29')]['id']}},_0x23ecb0={};_0x23ecb0[_0x996f('0x2a')]=_[_0x996f('0x2b')](db[_0x996f('0x2c')]['rawAttributes']);_0x23ecb0[_0x996f('0x2d')]=_[_0x996f('0x2b')](_0x419662[_0x996f('0x2d')]);_0x23ecb0[_0x996f('0x2e')]=_['intersection'](_0x23ecb0[_0x996f('0x2a')],_0x23ecb0[_0x996f('0x2d')]);_0x1f43ec[_0x996f('0x2f')]=_[_0x996f('0x30')](_0x23ecb0['model'],qs['fields'](_0x419662[_0x996f('0x2d')][_0x996f('0x31')]));_0x1f43ec[_0x996f('0x2f')]=_0x1f43ec[_0x996f('0x2f')][_0x996f('0x32')]?_0x1f43ec[_0x996f('0x2f')]:_0x23ecb0[_0x996f('0x2a')];if(_0x419662[_0x996f('0x2d')][_0x996f('0x33')]){_0x1f43ec[_0x996f('0x34')]=[{'all':!![]}];}_0x1f43ec=_[_0x996f('0x35')]({},_0x1f43ec,_0x419662['options']);return db[_0x996f('0x2c')][_0x996f('0x36')](_0x1f43ec)[_0x996f('0x24')](handleEntityNotFound(_0x1a520c,null))[_0x996f('0x24')](respondWithResult(_0x1a520c,null))[_0x996f('0x37')](handleError(_0x1a520c,null));};exports[_0x996f('0x23')]=function(_0x47802a,_0x148908){if(_0x47802a[_0x996f('0x38')]['id']){delete _0x47802a['body']['id'];}return db[_0x996f('0x2c')][_0x996f('0x36')]({'where':{'id':_0x47802a[_0x996f('0x29')]['id']}})[_0x996f('0x24')](handleEntityNotFound(_0x148908,null))[_0x996f('0x24')](saveUpdates(_0x47802a[_0x996f('0x38')],null))[_0x996f('0x24')](respondWithResult(_0x148908,null))['catch'](handleError(_0x148908,null));};exports[_0x996f('0x25')]=function(_0x50c0b1,_0x4b426e){return db['ChatApplication'][_0x996f('0x36')]({'where':{'id':_0x50c0b1['params']['id']}})[_0x996f('0x24')](handleEntityNotFound(_0x4b426e,null))['then'](removeEntity(_0x4b426e,null))[_0x996f('0x37')](handleError(_0x4b426e,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index c884651..3d3b28a 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 _0xb673=['moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatApplication','chat_applications','lodash','util','api'];(function(_0x1c0991,_0x4f22d2){var _0x5034de=function(_0x520f49){while(--_0x520f49){_0x1c0991['push'](_0x1c0991['shift']());}};_0x5034de(++_0x4f22d2);}(_0xb673,0xa5));var _0x3b67=function(_0x395776,_0x29c569){_0x395776=_0x395776-0x0;var _0x8654cd=_0xb673[_0x395776];return _0x8654cd;};'use strict';var _=require(_0x3b67('0x0'));var util=require(_0x3b67('0x1'));var logger=require('../../config/logger')(_0x3b67('0x2'));var moment=require(_0x3b67('0x3'));var BPromise=require(_0x3b67('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b67('0x5'));var rimraf=require(_0x3b67('0x6'));var config=require(_0x3b67('0x7'));var attributes=require('./chatApplication.attributes');module[_0x3b67('0x8')]=function(_0x4bb159,_0x296e4c){return _0x4bb159[_0x3b67('0x9')](_0x3b67('0xa'),attributes,{'tableName':_0x3b67('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8f97=['../../config/logger','api','request-promise','path','rimraf','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x3977be,_0x173ba6){var _0x3bd94d=function(_0x31eb3b){while(--_0x31eb3b){_0x3977be['push'](_0x3977be['shift']());}};_0x3bd94d(++_0x173ba6);}(_0x8f97,0x13e));var _0x78f9=function(_0x2e33d3,_0x4375d2){_0x2e33d3=_0x2e33d3-0x0;var _0x5cd87d=_0x8f97[_0x2e33d3];return _0x5cd87d;};'use strict';var _=require('lodash');var util=require(_0x78f9('0x0'));var logger=require(_0x78f9('0x1'))(_0x78f9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x78f9('0x3'));var fs=require('fs');var path=require(_0x78f9('0x4'));var rimraf=require(_0x78f9('0x5'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0x78f9('0x6')]=function(_0x5b98c7,_0x3b420d){return _0x5b98c7[_0x78f9('0x7')](_0x78f9('0x8'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x78f9('0x9'),'collate':_0x78f9('0xa')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 3ab2e52..c0291d8 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 _0x482c=['message','ChatApplication,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x482c,0xdf));var _0xc482=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x482c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xc482('0x0'));var util=require(_0xc482('0x1'));var moment=require(_0xc482('0x2'));var BPromise=require('bluebird');var rs=require(_0xc482('0x3'));var fs=require('fs');var Redis=require(_0xc482('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc482('0x5'));var logger=require(_0xc482('0x6'))(_0xc482('0x7'));var config=require(_0xc482('0x8'));var jayson=require(_0xc482('0x9'));var client=jayson[_0xc482('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2abb27,_0x42a8d9,_0x35ea9e){return new BPromise(function(_0x555b0c,_0x4470ed){return client[_0xc482('0xb')](_0x2abb27,_0x35ea9e)[_0xc482('0xc')](function(_0x4cd17e){logger[_0xc482('0xd')]('ChatApplication,\x20%s,\x20%s',_0x42a8d9,_0xc482('0xe'));logger[_0xc482('0xf')](_0xc482('0x10'),_0x42a8d9,_0xc482('0xe'),JSON[_0xc482('0x11')](_0x4cd17e));if(_0x4cd17e[_0xc482('0x12')]){if(_0x4cd17e['error']['code']===0x1f4){logger[_0xc482('0x12')]('ChatApplication,\x20%s,\x20%s',_0x42a8d9,_0x4cd17e[_0xc482('0x12')]['message']);return _0x4470ed(_0x4cd17e[_0xc482('0x12')]['message']);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x42a8d9,_0x4cd17e[_0xc482('0x12')][_0xc482('0x13')]);return _0x555b0c(_0x4cd17e[_0xc482('0x12')][_0xc482('0x13')]);}else{logger['info'](_0xc482('0x14'),_0x42a8d9,_0xc482('0xe'));_0x555b0c(_0x4cd17e['result']['message']);}})[_0xc482('0x15')](function(_0x36d8ba){logger[_0xc482('0x12')](_0xc482('0x14'),_0x42a8d9,_0x36d8ba);_0x4470ed(_0x36d8ba);});});} \ No newline at end of file +var _0xaaaf=['../../config/environment','jayson/promise','client','http','request','then','info','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','ChatApplication,\x20%s,\x20%s','message','request\x20sent','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0xaaaf,0x13a));var _0xfaaa=function(_0x34ee59,_0x1a732d){_0x34ee59=_0x34ee59-0x0;var _0x38fb27=_0xaaaf[_0x34ee59];return _0x38fb27;};'use strict';var _=require(_0xfaaa('0x0'));var util=require('util');var moment=require(_0xfaaa('0x1'));var BPromise=require(_0xfaaa('0x2'));var rs=require(_0xfaaa('0x3'));var fs=require('fs');var Redis=require(_0xfaaa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfaaa('0x5'));var logger=require(_0xfaaa('0x6'))(_0xfaaa('0x7'));var config=require(_0xfaaa('0x8'));var jayson=require(_0xfaaa('0x9'));var client=jayson[_0xfaaa('0xa')][_0xfaaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x363b51,_0x3207f0,_0x5c15dc){return new BPromise(function(_0xf590c6,_0x43476c){return client[_0xfaaa('0xc')](_0x363b51,_0x5c15dc)[_0xfaaa('0xd')](function(_0x1f644f){logger[_0xfaaa('0xe')]('ChatApplication,\x20%s,\x20%s',_0x3207f0,'request\x20sent');logger[_0xfaaa('0xf')](_0xfaaa('0x10'),_0x3207f0,'request\x20sent',JSON['stringify'](_0x1f644f));if(_0x1f644f[_0xfaaa('0x11')]){if(_0x1f644f['error'][_0xfaaa('0x12')]===0x1f4){logger['error'](_0xfaaa('0x13'),_0x3207f0,_0x1f644f[_0xfaaa('0x11')][_0xfaaa('0x14')]);return _0x43476c(_0x1f644f[_0xfaaa('0x11')][_0xfaaa('0x14')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x3207f0,_0x1f644f[_0xfaaa('0x11')][_0xfaaa('0x14')]);return _0xf590c6(_0x1f644f[_0xfaaa('0x11')]['message']);}else{logger[_0xfaaa('0xe')](_0xfaaa('0x13'),_0x3207f0,_0xfaaa('0x15'));_0xf590c6(_0x1f644f['result'][_0xfaaa('0x14')]);}})[_0xfaaa('0x16')](function(_0x602ed3){logger[_0xfaaa('0x11')]('ChatApplication,\x20%s,\x20%s',_0x3207f0,_0x602ed3);_0x43476c(_0x602ed3);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index e8feda8..fcbbb91 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 _0xaa44=['../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x32b4aa,_0x12eba6){var _0x473160=function(_0x4906b6){while(--_0x4906b6){_0x32b4aa['push'](_0x32b4aa['shift']());}};_0x473160(++_0x12eba6);}(_0xaa44,0x81));var _0x4aa4=function(_0x4457f9,_0x4712dc){_0x4457f9=_0x4457f9-0x0;var _0x2a53c4=_0xaa44[_0x4457f9];return _0x2a53c4;};'use strict';var multer=require('multer');var util=require(_0x4aa4('0x0'));var path=require(_0x4aa4('0x1'));var timeout=require(_0x4aa4('0x2'));var express=require(_0x4aa4('0x3'));var router=express[_0x4aa4('0x4')]();var fs_extra=require(_0x4aa4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4aa4('0x6'));var config=require(_0x4aa4('0x7'));var controller=require(_0x4aa4('0x8'));router[_0x4aa4('0x9')](_0x4aa4('0xa'),auth[_0x4aa4('0xb')](),controller['show']);router['put'](_0x4aa4('0xa'),auth['isAuthenticated'](),controller[_0x4aa4('0xc')]);router[_0x4aa4('0xd')](_0x4aa4('0xa'),auth['isAuthenticated'](),controller[_0x4aa4('0xe')]);module['exports']=router; \ No newline at end of file +var _0xaba9=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','update','destroy','exports','util','connect-timeout','express'];(function(_0x1ad84a,_0x1e9473){var _0x575ece=function(_0x3b10a4){while(--_0x3b10a4){_0x1ad84a['push'](_0x1ad84a['shift']());}};_0x575ece(++_0x1e9473);}(_0xaba9,0x75));var _0x9aba=function(_0x24ee81,_0x56093d){_0x24ee81=_0x24ee81-0x0;var _0x38fe96=_0xaba9[_0x24ee81];return _0x38fe96;};'use strict';var multer=require('multer');var util=require(_0x9aba('0x0'));var path=require('path');var timeout=require(_0x9aba('0x1'));var express=require(_0x9aba('0x2'));var router=express[_0x9aba('0x3')]();var fs_extra=require(_0x9aba('0x4'));var auth=require(_0x9aba('0x5'));var interaction=require(_0x9aba('0x6'));var config=require(_0x9aba('0x7'));var controller=require(_0x9aba('0x8'));router[_0x9aba('0x9')]('/:id',auth[_0x9aba('0xa')](),controller[_0x9aba('0xb')]);router['put']('/:id',auth[_0x9aba('0xa')](),controller[_0x9aba('0xc')]);router['delete']('/:id',auth[_0x9aba('0xa')](),controller[_0x9aba('0xd')]);module[_0x9aba('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index be2cd82..861dc73 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 _0xc0a4=['sequelize','exports','STRING'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0xc0a4,0xc6));var _0x4c0a=function(_0x2dfc93,_0x5ec315){_0x2dfc93=_0x2dfc93-0x0;var _0x68bf04=_0xc0a4[_0x2dfc93];return _0x68bf04;};'use strict';var Sequelize=require(_0x4c0a('0x0'));module[_0x4c0a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4c0a('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xb3a4=['STRING'];(function(_0x4212fe,_0x3ba431){var _0x22e53e=function(_0x17ffa5){while(--_0x17ffa5){_0x4212fe['push'](_0x4212fe['shift']());}};_0x22e53e(++_0x3ba431);}(_0xb3a4,0x77));var _0x4b3a=function(_0x4b3618,_0x3f02d8){_0x4b3618=_0x4b3618-0x0;var _0x410aa5=_0xb3a4[_0x4b3618];return _0x410aa5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4b3a('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x4b3a('0x0')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 19c2914..9de164b 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 _0x62cc=['count','includeAll','include','findAll','rows','show','params','intersection','merge','find','catch','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','User','length','removeMembers','addMessage','ChatGroupId','split','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','options'];(function(_0x4e6a33,_0x3039d2){var _0x11c1d5=function(_0x1305d5){while(--_0x1305d5){_0x4e6a33['push'](_0x4e6a33['shift']());}};_0x11c1d5(++_0x3039d2);}(_0x62cc,0x81));var _0xc62c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x62cc[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xc62c('0x0'));var rimraf=require(_0xc62c('0x1'));var zipdir=require(_0xc62c('0x2'));var jsonpatch=require(_0xc62c('0x3'));var rp=require(_0xc62c('0x4'));var moment=require(_0xc62c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc62c('0x6'));var util=require('util');var path=require(_0xc62c('0x7'));var sox=require('sox');var csv=require(_0xc62c('0x8'));var ejs=require(_0xc62c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc62c('0xa'));var squel=require(_0xc62c('0xb'));var crypto=require(_0xc62c('0xc'));var jsforce=require(_0xc62c('0xd'));var deskjs=require(_0xc62c('0xe'));var toCsv=require(_0xc62c('0x8'));var querystring=require(_0xc62c('0xf'));var Papa=require(_0xc62c('0x10'));var Redis=require('ioredis');var authService=require(_0xc62c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc62c('0x12'));var hardwareService=require(_0xc62c('0x13'));var logger=require('../../config/logger')(_0xc62c('0x14'));var utils=require(_0xc62c('0x15'));var config=require(_0xc62c('0x16'));var licenseUtil=require(_0xc62c('0x17'));var db=require(_0xc62c('0x18'))['db'];config[_0xc62c('0x19')]=_[_0xc62c('0x1a')](config[_0xc62c('0x19')],{'host':_0xc62c('0x1b'),'port':0x18eb});var socket=require(_0xc62c('0x1c'))(new Redis(config[_0xc62c('0x19')]));require('./chatGroup.socket')[_0xc62c('0x1d')](socket);function respondWithStatusCode(_0x2ed74e,_0x116eee){_0x116eee=_0x116eee||0xcc;return function(_0x18c7d3){if(_0x18c7d3){return _0x2ed74e[_0xc62c('0x1e')](_0x116eee);}return _0x2ed74e[_0xc62c('0x1f')](_0x116eee)[_0xc62c('0x20')]();};}function respondWithResult(_0x249a12,_0x23cd15){_0x23cd15=_0x23cd15||0xc8;return function(_0x201fca){if(_0x201fca){return _0x249a12[_0xc62c('0x1f')](_0x23cd15)[_0xc62c('0x21')](_0x201fca);}};}function respondWithFilteredResult(_0x29039b,_0x22bbeb){return function(_0x5079d6){if(_0x5079d6){var _0x1d413c=typeof _0x22bbeb[_0xc62c('0x22')]==='undefined'&&typeof _0x22bbeb[_0xc62c('0x23')]==='undefined';var _0x34ce8e=_0x5079d6['count'];var _0x55f0ab=_0x1d413c?0x0:_0x22bbeb[_0xc62c('0x22')];var _0x17dcb6=_0x1d413c?_0x5079d6['count']:_0x22bbeb[_0xc62c('0x22')]+_0x22bbeb[_0xc62c('0x23')];var _0x1896f0;if(_0x17dcb6>=_0x34ce8e){_0x17dcb6=_0x34ce8e;_0x1896f0=0xc8;}else{_0x1896f0=0xce;}_0x29039b[_0xc62c('0x1f')](_0x1896f0);return _0x29039b['set'](_0xc62c('0x24'),_0x55f0ab+'-'+_0x17dcb6+'/'+_0x34ce8e)[_0xc62c('0x21')](_0x5079d6);}return null;};}function patchUpdates(_0xc1b412){return function(_0x17b0d4){try{jsonpatch[_0xc62c('0x25')](_0x17b0d4,_0xc1b412,!![]);}catch(_0x4f56e9){return BPromise['reject'](_0x4f56e9);}return _0x17b0d4[_0xc62c('0x26')]();};}function saveUpdates(_0x1d36de,_0x3f32f2){return function(_0x41e69a){if(_0x41e69a){return _0x41e69a[_0xc62c('0x27')](_0x1d36de)['then'](function(_0x55e934){return _0x55e934;});}return null;};}function removeEntity(_0x16e140,_0x53fcd1){return function(_0x105b15){if(_0x105b15){return _0x105b15[_0xc62c('0x28')]()[_0xc62c('0x29')](function(){_0x16e140[_0xc62c('0x1f')](0xcc)[_0xc62c('0x20')]();});}};}function handleEntityNotFound(_0x48a7d2,_0x5216dd){return function(_0x3bf7f5){if(!_0x3bf7f5){_0x48a7d2[_0xc62c('0x1e')](0x194);}return _0x3bf7f5;};}function handleError(_0xbc9ca2,_0x31448){_0x31448=_0x31448||0x1f4;return function(_0x3589b7){logger[_0xc62c('0x2a')](_0x3589b7[_0xc62c('0x2b')]);if(_0x3589b7[_0xc62c('0x2c')]){delete _0x3589b7[_0xc62c('0x2c')];}_0xbc9ca2[_0xc62c('0x1f')](_0x31448)[_0xc62c('0x2d')](_0x3589b7);};}exports[_0xc62c('0x2e')]=function(_0x243d6c,_0x348604){var _0x22c149={},_0x1264f8={},_0x43aac4={'count':0x0,'rows':[]};var _0x11b876=_[_0xc62c('0x2f')](db[_0xc62c('0x30')][_0xc62c('0x31')],function(_0x507cc1){return{'name':_0x507cc1[_0xc62c('0x32')],'type':_0x507cc1[_0xc62c('0x33')][_0xc62c('0x34')]};});_0x1264f8[_0xc62c('0x35')]=_[_0xc62c('0x2f')](_0x11b876,_0xc62c('0x2c'));_0x1264f8[_0xc62c('0x36')]=_[_0xc62c('0x37')](_0x243d6c[_0xc62c('0x36')]);_0x1264f8['filters']=_['intersection'](_0x1264f8[_0xc62c('0x35')],_0x1264f8[_0xc62c('0x36')]);_0x22c149[_0xc62c('0x38')]=_['intersection'](_0x1264f8[_0xc62c('0x35')],qs[_0xc62c('0x39')](_0x243d6c[_0xc62c('0x36')][_0xc62c('0x39')]));_0x22c149[_0xc62c('0x38')]=_0x22c149[_0xc62c('0x38')]['length']?_0x22c149[_0xc62c('0x38')]:_0x1264f8[_0xc62c('0x35')];if(!_0x243d6c[_0xc62c('0x36')]['hasOwnProperty'](_0xc62c('0x3a'))){_0x22c149['limit']=qs[_0xc62c('0x23')](_0x243d6c[_0xc62c('0x36')][_0xc62c('0x23')]);_0x22c149[_0xc62c('0x22')]=qs[_0xc62c('0x22')](_0x243d6c[_0xc62c('0x36')][_0xc62c('0x22')]);}_0x22c149[_0xc62c('0x3b')]=qs[_0xc62c('0x3c')](_0x243d6c[_0xc62c('0x36')]['sort']);_0x22c149['where']=qs['filters'](_[_0xc62c('0x3d')](_0x243d6c[_0xc62c('0x36')],_0x1264f8[_0xc62c('0x3e')]),_0x11b876);if(_0x243d6c[_0xc62c('0x36')][_0xc62c('0x3f')]){_0x22c149[_0xc62c('0x40')]=_['merge'](_0x22c149[_0xc62c('0x40')],{'$or':_[_0xc62c('0x2f')](_0x11b876,function(_0x13e002){if(_0x13e002['type']!==_0xc62c('0x41')){var _0x1aad39={};_0x1aad39[_0x13e002[_0xc62c('0x2c')]]={'$like':'%'+_0x243d6c[_0xc62c('0x36')]['filter']+'%'};return _0x1aad39;}})});}_0x22c149=_['merge']({},_0x22c149,_0x243d6c[_0xc62c('0x42')]);var _0x5e05b4={'where':_0x22c149[_0xc62c('0x40')]};return db[_0xc62c('0x30')]['count'](_0x5e05b4)[_0xc62c('0x29')](function(_0x28b00c){_0x43aac4[_0xc62c('0x43')]=_0x28b00c;if(_0x243d6c[_0xc62c('0x36')][_0xc62c('0x44')]){_0x22c149[_0xc62c('0x45')]=[{'all':!![]}];}return db['ChatGroup'][_0xc62c('0x46')](_0x22c149);})[_0xc62c('0x29')](function(_0x474c61){_0x43aac4[_0xc62c('0x47')]=_0x474c61;return _0x43aac4;})['then'](respondWithFilteredResult(_0x348604,_0x22c149))['catch'](handleError(_0x348604,null));};exports[_0xc62c('0x48')]=function(_0x3396f0,_0x36fa97){var _0x28348a={'raw':!![],'where':{'id':_0x3396f0[_0xc62c('0x49')]['id']}},_0x34d916={};_0x34d916[_0xc62c('0x35')]=_[_0xc62c('0x37')](db[_0xc62c('0x30')][_0xc62c('0x31')]);_0x34d916[_0xc62c('0x36')]=_['keys'](_0x3396f0[_0xc62c('0x36')]);_0x34d916[_0xc62c('0x3e')]=_[_0xc62c('0x4a')](_0x34d916['model'],_0x34d916[_0xc62c('0x36')]);_0x28348a['attributes']=_[_0xc62c('0x4a')](_0x34d916[_0xc62c('0x35')],qs[_0xc62c('0x39')](_0x3396f0[_0xc62c('0x36')]['fields']));_0x28348a[_0xc62c('0x38')]=_0x28348a[_0xc62c('0x38')]['length']?_0x28348a['attributes']:_0x34d916['model'];if(_0x3396f0[_0xc62c('0x36')][_0xc62c('0x44')]){_0x28348a[_0xc62c('0x45')]=[{'all':!![]}];}_0x28348a=_[_0xc62c('0x4b')]({},_0x28348a,_0x3396f0[_0xc62c('0x42')]);return db[_0xc62c('0x30')][_0xc62c('0x4c')](_0x28348a)[_0xc62c('0x29')](handleEntityNotFound(_0x36fa97,null))['then'](respondWithResult(_0x36fa97,null))[_0xc62c('0x4d')](handleError(_0x36fa97,null));};exports[_0xc62c('0x4e')]=function(_0x2ac136,_0x220634){return db[_0xc62c('0x30')]['create'](_0x2ac136[_0xc62c('0x4f')],{})['then'](respondWithResult(_0x220634,0xc9))['catch'](handleError(_0x220634,null));};exports[_0xc62c('0x27')]=function(_0x42a945,_0x11d8b7){if(_0x42a945['body']['id']){delete _0x42a945['body']['id'];}return db['ChatGroup'][_0xc62c('0x4c')]({'where':{'id':_0x42a945['params']['id']}})[_0xc62c('0x29')](handleEntityNotFound(_0x11d8b7,null))['then'](saveUpdates(_0x42a945['body'],null))[_0xc62c('0x29')](respondWithResult(_0x11d8b7,null))['catch'](handleError(_0x11d8b7,null));};exports['destroy']=function(_0x2f3722,_0x234e95){return db['ChatGroup'][_0xc62c('0x4c')]({'where':{'id':_0x2f3722[_0xc62c('0x49')]['id']}})[_0xc62c('0x29')](handleEntityNotFound(_0x234e95,null))[_0xc62c('0x29')](removeEntity(_0x234e95,null))[_0xc62c('0x4d')](handleError(_0x234e95,null));};exports[_0xc62c('0x50')]=function(_0x5c22ff,_0x21a9d4){return db[_0xc62c('0x30')][_0xc62c('0x50')]()['then'](respondWithResult(_0x21a9d4,null))[_0xc62c('0x4d')](handleError(_0x21a9d4,null));};exports[_0xc62c('0x51')]=function(_0x1d14a6,_0x4d1f4b,_0x351d0b){return db[_0xc62c('0x52')][_0xc62c('0x43')]({'where':{'ChatGroupId':_0x1d14a6[_0xc62c('0x49')]['id'],'ToId':_0x1d14a6[_0xc62c('0x53')]['id'],'read':![]}})[_0xc62c('0x29')](function(_0x351138){return{'id':_[_0xc62c('0x54')](_0x1d14a6[_0xc62c('0x49')]['id']),'count':_0x351138};})[_0xc62c('0x29')](respondWithResult(_0x4d1f4b,null))[_0xc62c('0x4d')](handleError(_0x4d1f4b,null));};exports[_0xc62c('0x55')]=function(_0x27611f,_0x1c45b0,_0x5b0624){return db[_0xc62c('0x30')][_0xc62c('0x4c')]({'where':{'id':_0x27611f[_0xc62c('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c45b0,null))[_0xc62c('0x29')](function(_0x2e1f1f){if(_0x2e1f1f){return _0x2e1f1f['addMembers'](_0x27611f['body']['ids'],_[_0xc62c('0x56')](_0x27611f[_0xc62c('0x4f')],[_0xc62c('0x57'),'id'])||{});}})[_0xc62c('0x29')](respondWithResult(_0x1c45b0,null))['catch'](handleError(_0x1c45b0,null));};exports[_0xc62c('0x58')]=function(_0x206816,_0x1e23a6,_0x462f03){var _0x12a10f={};var _0x319145={};var _0x1436a5;var _0x44dac7;return db['ChatGroup'][_0xc62c('0x59')]({'where':{'id':_0x206816[_0xc62c('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e23a6,null))[_0xc62c('0x29')](function(_0x4540d6){if(_0x4540d6){_0x1436a5=_0x4540d6;_0x319145[_0xc62c('0x35')]=_[_0xc62c('0x37')](db[_0xc62c('0x5a')][_0xc62c('0x31')]);_0x319145[_0xc62c('0x36')]=_['keys'](_0x206816[_0xc62c('0x36')]);_0x319145[_0xc62c('0x3e')]=_['intersection'](_0x319145[_0xc62c('0x35')],_0x319145[_0xc62c('0x36')]);_0x12a10f[_0xc62c('0x38')]=_[_0xc62c('0x4a')](_0x319145[_0xc62c('0x35')],qs['fields'](_0x206816[_0xc62c('0x36')][_0xc62c('0x39')]));_0x12a10f[_0xc62c('0x38')]=_0x12a10f[_0xc62c('0x38')]['length']?_0x12a10f[_0xc62c('0x38')]:_0x319145['model'];_0x12a10f[_0xc62c('0x3b')]=qs[_0xc62c('0x3c')](_0x206816[_0xc62c('0x36')][_0xc62c('0x3c')]);_0x12a10f[_0xc62c('0x40')]=qs[_0xc62c('0x3e')](_[_0xc62c('0x3d')](_0x206816[_0xc62c('0x36')],_0x319145[_0xc62c('0x3e')]));if(_0x206816[_0xc62c('0x36')][_0xc62c('0x3f')]){_0x12a10f[_0xc62c('0x40')]=_[_0xc62c('0x4b')](_0x12a10f['where'],{'$or':_[_0xc62c('0x2f')](_0x12a10f[_0xc62c('0x38')],function(_0x52990e){var _0x3e2dc1={};_0x3e2dc1[_0x52990e]={'$like':'%'+_0x206816[_0xc62c('0x36')][_0xc62c('0x3f')]+'%'};return _0x3e2dc1;})});}_0x12a10f=_[_0xc62c('0x4b')]({},_0x12a10f,_0x206816[_0xc62c('0x42')]);return _0x1436a5['getMembers'](_0x12a10f);}})[_0xc62c('0x29')](function(_0x27640c){if(_0x27640c){_0x44dac7=_0x27640c[_0xc62c('0x5b')];if(!_0x206816[_0xc62c('0x36')]['hasOwnProperty']('nolimit')){_0x12a10f[_0xc62c('0x23')]=qs['limit'](_0x206816[_0xc62c('0x36')]['limit']);_0x12a10f[_0xc62c('0x22')]=qs[_0xc62c('0x22')](_0x206816[_0xc62c('0x36')]['offset']);}return _0x1436a5['getMembers'](_0x12a10f);}})[_0xc62c('0x29')](function(_0x51a9cf){if(_0x51a9cf){return _0x51a9cf?{'count':_0x44dac7,'rows':_0x51a9cf}:null;}})[_0xc62c('0x29')](respondWithResult(_0x1e23a6,null))[_0xc62c('0x4d')](handleError(_0x1e23a6,null));};exports[_0xc62c('0x5c')]=function(_0x5d9cd2,_0x229a70,_0x2b70ce){return db[_0xc62c('0x30')][_0xc62c('0x4c')]({'where':{'id':_0x5d9cd2[_0xc62c('0x49')]['id']}})[_0xc62c('0x29')](handleEntityNotFound(_0x229a70,null))[_0xc62c('0x29')](function(_0x159d92){if(_0x159d92){return _0x159d92[_0xc62c('0x5c')](_0x5d9cd2[_0xc62c('0x36')][_0xc62c('0x57')]);}})[_0xc62c('0x29')](respondWithStatusCode(_0x229a70,null))['catch'](handleError(_0x229a70,null));};exports[_0xc62c('0x5d')]=function(_0x146b48,_0xdb7e78,_0x3fa514){if(_0x146b48[_0xc62c('0x4f')]['id']){delete _0x146b48[_0xc62c('0x4f')]['id'];}return db[_0xc62c('0x30')]['find']({'where':{'id':_0x146b48[_0xc62c('0x49')]['id']}})['then'](handleEntityNotFound(_0xdb7e78,null))[_0xc62c('0x29')](function(_0x3a620f){if(_0x3a620f){_0x146b48[_0xc62c('0x4f')][_0xc62c('0x5e')]=_0x3a620f['id'];return db[_0xc62c('0x52')][_0xc62c('0x4e')](_0x146b48['body']);}})[_0xc62c('0x29')](respondWithResult(_0xdb7e78,null))[_0xc62c('0x4d')](handleError(_0xdb7e78,null));};exports['getMessages']=function(_0x1a565c,_0x2e0ee9,_0x165614){var _0x30b314={};var _0x219e27={};var _0x47038c;var _0x466271;return db['ChatGroup']['findOne']({'where':{'id':_0x1a565c[_0xc62c('0x49')]['id']}})[_0xc62c('0x29')](handleEntityNotFound(_0x2e0ee9,null))[_0xc62c('0x29')](function(_0x1b1ce5){if(_0x1b1ce5){_0x47038c=_0x1b1ce5;_0x219e27['model']=_['keys'](db['ChatInternalMessage'][_0xc62c('0x31')]);_0x219e27['query']=_[_0xc62c('0x37')](_0x1a565c[_0xc62c('0x36')]);_0x219e27[_0xc62c('0x3e')]=_['intersection'](_0x219e27['model'],_0x219e27['query']);_0x30b314['attributes']=_[_0xc62c('0x4a')](_0x219e27[_0xc62c('0x35')],qs['fields'](_0x1a565c[_0xc62c('0x36')][_0xc62c('0x39')]));_0x30b314[_0xc62c('0x38')]=_0x30b314['attributes']['length']?_0x30b314[_0xc62c('0x38')]:_0x219e27['model'];_0x30b314[_0xc62c('0x3b')]=qs[_0xc62c('0x3c')](_0x1a565c[_0xc62c('0x36')][_0xc62c('0x3c')]);_0x30b314[_0xc62c('0x40')]=qs[_0xc62c('0x3e')](_[_0xc62c('0x3d')](_0x1a565c['query'],_0x219e27[_0xc62c('0x3e')]));if(_0x1a565c[_0xc62c('0x36')][_0xc62c('0x3f')]){_0x30b314['where']=_[_0xc62c('0x4b')](_0x30b314['where'],{'$or':_[_0xc62c('0x2f')](_0x30b314['attributes'],function(_0x4f77ef){var _0x2bbb54={};_0x2bbb54[_0x4f77ef]={'$like':'%'+_0x1a565c[_0xc62c('0x36')]['filter']+'%'};return _0x2bbb54;})});}if(_0x1a565c[_0xc62c('0x36')]['$gte']){var _0x56fe51=_0x1a565c['query']['$gte'][_0xc62c('0x5f')](',');var _0x4ba028={};_0x4ba028[_0x56fe51[0x0]]={'$gte':moment(_0x56fe51[0x1])['format'](_0xc62c('0x60'))};_0x30b314[_0xc62c('0x40')]=_[_0xc62c('0x4b')](_0x30b314[_0xc62c('0x40')],_0x4ba028);}_0x30b314=_[_0xc62c('0x4b')]({},_0x30b314,_0x1a565c[_0xc62c('0x42')]);return _0x47038c[_0xc62c('0x61')](_0x30b314);}})['then'](function(_0x5de117){if(_0x5de117){_0x466271=_0x5de117['length'];if(!_0x1a565c[_0xc62c('0x36')]['hasOwnProperty'](_0xc62c('0x3a'))){_0x30b314[_0xc62c('0x23')]=qs[_0xc62c('0x23')](_0x1a565c[_0xc62c('0x36')]['limit']);_0x30b314[_0xc62c('0x22')]=qs[_0xc62c('0x22')](_0x1a565c[_0xc62c('0x36')][_0xc62c('0x22')]);}return _0x47038c[_0xc62c('0x61')](_0x30b314);}})[_0xc62c('0x29')](function(_0x490ad9){if(_0x490ad9){return _0x490ad9?{'count':_0x466271,'rows':_0x490ad9}:null;}})['then'](respondWithResult(_0x2e0ee9,null))[_0xc62c('0x4d')](handleError(_0x2e0ee9,null));}; \ No newline at end of file +var _0x3b8d=['addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','ChatGroup','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','params','keys','length','include','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','User','pick','removeMembers'];(function(_0x348d2e,_0x2b7b9b){var _0x143ca5=function(_0x287ae4){while(--_0x287ae4){_0x348d2e['push'](_0x348d2e['shift']());}};_0x143ca5(++_0x2b7b9b);}(_0x3b8d,0x194));var _0xd3b8=function(_0xee51b4,_0x28f99a){_0xee51b4=_0xee51b4-0x0;var _0x5c29d7=_0x3b8d[_0xee51b4];return _0x5c29d7;};'use strict';var emlformat=require(_0xd3b8('0x0'));var rimraf=require(_0xd3b8('0x1'));var zipdir=require(_0xd3b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd3b8('0x3'));var moment=require(_0xd3b8('0x4'));var BPromise=require(_0xd3b8('0x5'));var Mustache=require(_0xd3b8('0x6'));var util=require(_0xd3b8('0x7'));var path=require(_0xd3b8('0x8'));var sox=require(_0xd3b8('0x9'));var csv=require('to-csv');var ejs=require(_0xd3b8('0xa'));var fs=require('fs');var fs_extra=require(_0xd3b8('0xb'));var _=require('lodash');var squel=require(_0xd3b8('0xc'));var crypto=require(_0xd3b8('0xd'));var jsforce=require(_0xd3b8('0xe'));var deskjs=require(_0xd3b8('0xf'));var toCsv=require(_0xd3b8('0x10'));var querystring=require(_0xd3b8('0x11'));var Papa=require('papaparse');var Redis=require(_0xd3b8('0x12'));var authService=require(_0xd3b8('0x13'));var qs=require(_0xd3b8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3b8('0x15'))('api');var utils=require(_0xd3b8('0x16'));var config=require(_0xd3b8('0x17'));var licenseUtil=require(_0xd3b8('0x18'));var db=require(_0xd3b8('0x19'))['db'];config[_0xd3b8('0x1a')]=_['defaults'](config[_0xd3b8('0x1a')],{'host':_0xd3b8('0x1b'),'port':0x18eb});var socket=require(_0xd3b8('0x1c'))(new Redis(config[_0xd3b8('0x1a')]));require(_0xd3b8('0x1d'))[_0xd3b8('0x1e')](socket);function respondWithStatusCode(_0x34c72d,_0x96f0d4){_0x96f0d4=_0x96f0d4||0xcc;return function(_0x8d62e8){if(_0x8d62e8){return _0x34c72d['sendStatus'](_0x96f0d4);}return _0x34c72d[_0xd3b8('0x1f')](_0x96f0d4)[_0xd3b8('0x20')]();};}function respondWithResult(_0x142be1,_0x2b04ee){_0x2b04ee=_0x2b04ee||0xc8;return function(_0xaff9c7){if(_0xaff9c7){return _0x142be1['status'](_0x2b04ee)[_0xd3b8('0x21')](_0xaff9c7);}};}function respondWithFilteredResult(_0x50c7c9,_0x26e54b){return function(_0x8d0fb6){if(_0x8d0fb6){var _0x280ac6=typeof _0x26e54b['offset']===_0xd3b8('0x22')&&typeof _0x26e54b[_0xd3b8('0x23')]===_0xd3b8('0x22');var _0x5e6cf4=_0x8d0fb6['count'];var _0x52773c=_0x280ac6?0x0:_0x26e54b[_0xd3b8('0x24')];var _0x574c05=_0x280ac6?_0x8d0fb6[_0xd3b8('0x25')]:_0x26e54b[_0xd3b8('0x24')]+_0x26e54b[_0xd3b8('0x23')];var _0x367fa4;if(_0x574c05>=_0x5e6cf4){_0x574c05=_0x5e6cf4;_0x367fa4=0xc8;}else{_0x367fa4=0xce;}_0x50c7c9[_0xd3b8('0x1f')](_0x367fa4);return _0x50c7c9['set'](_0xd3b8('0x26'),_0x52773c+'-'+_0x574c05+'/'+_0x5e6cf4)[_0xd3b8('0x21')](_0x8d0fb6);}return null;};}function patchUpdates(_0x551a6b){return function(_0x390df9){try{jsonpatch[_0xd3b8('0x27')](_0x390df9,_0x551a6b,!![]);}catch(_0x3aa0fc){return BPromise[_0xd3b8('0x28')](_0x3aa0fc);}return _0x390df9[_0xd3b8('0x29')]();};}function saveUpdates(_0x26013d,_0x28ec54){return function(_0x42cf4d){if(_0x42cf4d){return _0x42cf4d[_0xd3b8('0x2a')](_0x26013d)[_0xd3b8('0x2b')](function(_0x2485a7){return _0x2485a7;});}return null;};}function removeEntity(_0x48377b,_0x18d5f5){return function(_0x219a2f){if(_0x219a2f){return _0x219a2f[_0xd3b8('0x2c')]()[_0xd3b8('0x2b')](function(){_0x48377b[_0xd3b8('0x1f')](0xcc)[_0xd3b8('0x20')]();});}};}function handleEntityNotFound(_0x5312f9,_0x123671){return function(_0x3c11c0){if(!_0x3c11c0){_0x5312f9[_0xd3b8('0x2d')](0x194);}return _0x3c11c0;};}function handleError(_0x56e70f,_0x24eb8f){_0x24eb8f=_0x24eb8f||0x1f4;return function(_0x394e24){logger[_0xd3b8('0x2e')](_0x394e24[_0xd3b8('0x2f')]);if(_0x394e24['name']){delete _0x394e24['name'];}_0x56e70f['status'](_0x24eb8f)[_0xd3b8('0x30')](_0x394e24);};}exports[_0xd3b8('0x31')]=function(_0xab6da6,_0x37171b){var _0x2fba4c={},_0x2da46a={},_0x566a00={'count':0x0,'rows':[]};var _0x3a7ab6=_[_0xd3b8('0x32')](db[_0xd3b8('0x33')][_0xd3b8('0x34')],function(_0x385f82){return{'name':_0x385f82['fieldName'],'type':_0x385f82[_0xd3b8('0x35')][_0xd3b8('0x36')]};});_0x2da46a[_0xd3b8('0x37')]=_['map'](_0x3a7ab6,'name');_0x2da46a[_0xd3b8('0x38')]=_['keys'](_0xab6da6['query']);_0x2da46a[_0xd3b8('0x39')]=_['intersection'](_0x2da46a[_0xd3b8('0x37')],_0x2da46a[_0xd3b8('0x38')]);_0x2fba4c['attributes']=_[_0xd3b8('0x3a')](_0x2da46a[_0xd3b8('0x37')],qs[_0xd3b8('0x3b')](_0xab6da6[_0xd3b8('0x38')]['fields']));_0x2fba4c[_0xd3b8('0x3c')]=_0x2fba4c[_0xd3b8('0x3c')]['length']?_0x2fba4c['attributes']:_0x2da46a[_0xd3b8('0x37')];if(!_0xab6da6[_0xd3b8('0x38')]['hasOwnProperty'](_0xd3b8('0x3d'))){_0x2fba4c[_0xd3b8('0x23')]=qs[_0xd3b8('0x23')](_0xab6da6[_0xd3b8('0x38')][_0xd3b8('0x23')]);_0x2fba4c[_0xd3b8('0x24')]=qs['offset'](_0xab6da6[_0xd3b8('0x38')][_0xd3b8('0x24')]);}_0x2fba4c[_0xd3b8('0x3e')]=qs[_0xd3b8('0x3f')](_0xab6da6[_0xd3b8('0x38')][_0xd3b8('0x3f')]);_0x2fba4c[_0xd3b8('0x40')]=qs[_0xd3b8('0x39')](_['pick'](_0xab6da6[_0xd3b8('0x38')],_0x2da46a[_0xd3b8('0x39')]),_0x3a7ab6);if(_0xab6da6[_0xd3b8('0x38')]['filter']){_0x2fba4c[_0xd3b8('0x40')]=_[_0xd3b8('0x41')](_0x2fba4c['where'],{'$or':_[_0xd3b8('0x32')](_0x3a7ab6,function(_0x170463){if(_0x170463[_0xd3b8('0x35')]!==_0xd3b8('0x42')){var _0x5b8f1b={};_0x5b8f1b[_0x170463['name']]={'$like':'%'+_0xab6da6[_0xd3b8('0x38')][_0xd3b8('0x43')]+'%'};return _0x5b8f1b;}})});}_0x2fba4c=_[_0xd3b8('0x41')]({},_0x2fba4c,_0xab6da6[_0xd3b8('0x44')]);var _0x32ee01={'where':_0x2fba4c[_0xd3b8('0x40')]};return db[_0xd3b8('0x33')]['count'](_0x32ee01)[_0xd3b8('0x2b')](function(_0x2e72c3){_0x566a00[_0xd3b8('0x25')]=_0x2e72c3;if(_0xab6da6[_0xd3b8('0x38')][_0xd3b8('0x45')]){_0x2fba4c['include']=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x2fba4c);})[_0xd3b8('0x2b')](function(_0x1b04f9){_0x566a00[_0xd3b8('0x46')]=_0x1b04f9;return _0x566a00;})['then'](respondWithFilteredResult(_0x37171b,_0x2fba4c))[_0xd3b8('0x47')](handleError(_0x37171b,null));};exports['show']=function(_0x479bd9,_0x4c894b){var _0x47e4b1={'raw':!![],'where':{'id':_0x479bd9[_0xd3b8('0x48')]['id']}},_0x53fdb4={};_0x53fdb4[_0xd3b8('0x37')]=_[_0xd3b8('0x49')](db[_0xd3b8('0x33')][_0xd3b8('0x34')]);_0x53fdb4[_0xd3b8('0x38')]=_[_0xd3b8('0x49')](_0x479bd9['query']);_0x53fdb4[_0xd3b8('0x39')]=_[_0xd3b8('0x3a')](_0x53fdb4[_0xd3b8('0x37')],_0x53fdb4['query']);_0x47e4b1[_0xd3b8('0x3c')]=_[_0xd3b8('0x3a')](_0x53fdb4[_0xd3b8('0x37')],qs['fields'](_0x479bd9[_0xd3b8('0x38')]['fields']));_0x47e4b1[_0xd3b8('0x3c')]=_0x47e4b1[_0xd3b8('0x3c')][_0xd3b8('0x4a')]?_0x47e4b1[_0xd3b8('0x3c')]:_0x53fdb4[_0xd3b8('0x37')];if(_0x479bd9['query'][_0xd3b8('0x45')]){_0x47e4b1[_0xd3b8('0x4b')]=[{'all':!![]}];}_0x47e4b1=_['merge']({},_0x47e4b1,_0x479bd9[_0xd3b8('0x44')]);return db[_0xd3b8('0x33')][_0xd3b8('0x4c')](_0x47e4b1)['then'](handleEntityNotFound(_0x4c894b,null))[_0xd3b8('0x2b')](respondWithResult(_0x4c894b,null))[_0xd3b8('0x47')](handleError(_0x4c894b,null));};exports[_0xd3b8('0x4d')]=function(_0x267da0,_0x562099){return db[_0xd3b8('0x33')][_0xd3b8('0x4d')](_0x267da0[_0xd3b8('0x4e')],{})[_0xd3b8('0x2b')](respondWithResult(_0x562099,0xc9))[_0xd3b8('0x47')](handleError(_0x562099,null));};exports[_0xd3b8('0x2a')]=function(_0x416a71,_0x32b334){if(_0x416a71[_0xd3b8('0x4e')]['id']){delete _0x416a71[_0xd3b8('0x4e')]['id'];}return db[_0xd3b8('0x33')][_0xd3b8('0x4c')]({'where':{'id':_0x416a71[_0xd3b8('0x48')]['id']}})[_0xd3b8('0x2b')](handleEntityNotFound(_0x32b334,null))[_0xd3b8('0x2b')](saveUpdates(_0x416a71['body'],null))[_0xd3b8('0x2b')](respondWithResult(_0x32b334,null))[_0xd3b8('0x47')](handleError(_0x32b334,null));};exports[_0xd3b8('0x2c')]=function(_0x1d95af,_0x34bb72){return db[_0xd3b8('0x33')][_0xd3b8('0x4c')]({'where':{'id':_0x1d95af[_0xd3b8('0x48')]['id']}})[_0xd3b8('0x2b')](handleEntityNotFound(_0x34bb72,null))[_0xd3b8('0x2b')](removeEntity(_0x34bb72,null))[_0xd3b8('0x47')](handleError(_0x34bb72,null));};exports[_0xd3b8('0x4f')]=function(_0x19d875,_0xff642e){return db[_0xd3b8('0x33')][_0xd3b8('0x4f')]()[_0xd3b8('0x2b')](respondWithResult(_0xff642e,null))[_0xd3b8('0x47')](handleError(_0xff642e,null));};exports[_0xd3b8('0x50')]=function(_0x1c3cf3,_0x2642e8,_0x4096e9){return db[_0xd3b8('0x51')]['count']({'where':{'ChatGroupId':_0x1c3cf3[_0xd3b8('0x48')]['id'],'ToId':_0x1c3cf3[_0xd3b8('0x52')]['id'],'read':![]}})[_0xd3b8('0x2b')](function(_0x5eacc7){return{'id':_[_0xd3b8('0x53')](_0x1c3cf3[_0xd3b8('0x48')]['id']),'count':_0x5eacc7};})['then'](respondWithResult(_0x2642e8,null))[_0xd3b8('0x47')](handleError(_0x2642e8,null));};exports['addMembers']=function(_0x4dd05f,_0x4cf961,_0x2e003e){return db[_0xd3b8('0x33')][_0xd3b8('0x4c')]({'where':{'id':_0x4dd05f[_0xd3b8('0x48')]['id']}})[_0xd3b8('0x2b')](handleEntityNotFound(_0x4cf961,null))[_0xd3b8('0x2b')](function(_0x4ff01e){if(_0x4ff01e){return _0x4ff01e[_0xd3b8('0x54')](_0x4dd05f[_0xd3b8('0x4e')][_0xd3b8('0x55')],_['omit'](_0x4dd05f[_0xd3b8('0x4e')],[_0xd3b8('0x55'),'id'])||{});}})[_0xd3b8('0x2b')](respondWithResult(_0x4cf961,null))[_0xd3b8('0x47')](handleError(_0x4cf961,null));};exports[_0xd3b8('0x56')]=function(_0x17fb15,_0x3a4380,_0x142e0f){var _0x29799c={};var _0x31ad6b={};var _0x47bbf8;var _0x3e15c2;return db[_0xd3b8('0x33')][_0xd3b8('0x57')]({'where':{'id':_0x17fb15['params']['id']}})['then'](handleEntityNotFound(_0x3a4380,null))['then'](function(_0x24c14b){if(_0x24c14b){_0x47bbf8=_0x24c14b;_0x31ad6b['model']=_['keys'](db[_0xd3b8('0x58')][_0xd3b8('0x34')]);_0x31ad6b[_0xd3b8('0x38')]=_[_0xd3b8('0x49')](_0x17fb15[_0xd3b8('0x38')]);_0x31ad6b[_0xd3b8('0x39')]=_[_0xd3b8('0x3a')](_0x31ad6b[_0xd3b8('0x37')],_0x31ad6b[_0xd3b8('0x38')]);_0x29799c[_0xd3b8('0x3c')]=_['intersection'](_0x31ad6b[_0xd3b8('0x37')],qs[_0xd3b8('0x3b')](_0x17fb15['query']['fields']));_0x29799c[_0xd3b8('0x3c')]=_0x29799c['attributes'][_0xd3b8('0x4a')]?_0x29799c[_0xd3b8('0x3c')]:_0x31ad6b[_0xd3b8('0x37')];_0x29799c[_0xd3b8('0x3e')]=qs[_0xd3b8('0x3f')](_0x17fb15['query']['sort']);_0x29799c[_0xd3b8('0x40')]=qs[_0xd3b8('0x39')](_[_0xd3b8('0x59')](_0x17fb15[_0xd3b8('0x38')],_0x31ad6b[_0xd3b8('0x39')]));if(_0x17fb15['query']['filter']){_0x29799c[_0xd3b8('0x40')]=_['merge'](_0x29799c[_0xd3b8('0x40')],{'$or':_['map'](_0x29799c[_0xd3b8('0x3c')],function(_0x59e7b0){var _0x54b786={};_0x54b786[_0x59e7b0]={'$like':'%'+_0x17fb15['query']['filter']+'%'};return _0x54b786;})});}_0x29799c=_[_0xd3b8('0x41')]({},_0x29799c,_0x17fb15[_0xd3b8('0x44')]);return _0x47bbf8['getMembers'](_0x29799c);}})[_0xd3b8('0x2b')](function(_0x36b2ce){if(_0x36b2ce){_0x3e15c2=_0x36b2ce[_0xd3b8('0x4a')];if(!_0x17fb15[_0xd3b8('0x38')]['hasOwnProperty']('nolimit')){_0x29799c['limit']=qs[_0xd3b8('0x23')](_0x17fb15[_0xd3b8('0x38')][_0xd3b8('0x23')]);_0x29799c[_0xd3b8('0x24')]=qs[_0xd3b8('0x24')](_0x17fb15['query'][_0xd3b8('0x24')]);}return _0x47bbf8[_0xd3b8('0x56')](_0x29799c);}})[_0xd3b8('0x2b')](function(_0x2b6f11){if(_0x2b6f11){return _0x2b6f11?{'count':_0x3e15c2,'rows':_0x2b6f11}:null;}})[_0xd3b8('0x2b')](respondWithResult(_0x3a4380,null))[_0xd3b8('0x47')](handleError(_0x3a4380,null));};exports[_0xd3b8('0x5a')]=function(_0x57ceda,_0x250d11,_0x4e31f6){return db[_0xd3b8('0x33')][_0xd3b8('0x4c')]({'where':{'id':_0x57ceda['params']['id']}})[_0xd3b8('0x2b')](handleEntityNotFound(_0x250d11,null))['then'](function(_0x32080d){if(_0x32080d){return _0x32080d[_0xd3b8('0x5a')](_0x57ceda['query'][_0xd3b8('0x55')]);}})[_0xd3b8('0x2b')](respondWithStatusCode(_0x250d11,null))[_0xd3b8('0x47')](handleError(_0x250d11,null));};exports[_0xd3b8('0x5b')]=function(_0x296968,_0x4ac46c,_0x1bd194){if(_0x296968['body']['id']){delete _0x296968['body']['id'];}return db[_0xd3b8('0x33')][_0xd3b8('0x4c')]({'where':{'id':_0x296968[_0xd3b8('0x48')]['id']}})[_0xd3b8('0x2b')](handleEntityNotFound(_0x4ac46c,null))['then'](function(_0x23a217){if(_0x23a217){_0x296968['body'][_0xd3b8('0x5c')]=_0x23a217['id'];return db[_0xd3b8('0x51')][_0xd3b8('0x4d')](_0x296968[_0xd3b8('0x4e')]);}})['then'](respondWithResult(_0x4ac46c,null))['catch'](handleError(_0x4ac46c,null));};exports[_0xd3b8('0x5d')]=function(_0x580bc3,_0xe928,_0x11886d){var _0x169dbd={};var _0x12decf={};var _0x7f37e8;var _0x157235;return db[_0xd3b8('0x33')][_0xd3b8('0x57')]({'where':{'id':_0x580bc3['params']['id']}})[_0xd3b8('0x2b')](handleEntityNotFound(_0xe928,null))[_0xd3b8('0x2b')](function(_0x208cb4){if(_0x208cb4){_0x7f37e8=_0x208cb4;_0x12decf[_0xd3b8('0x37')]=_[_0xd3b8('0x49')](db[_0xd3b8('0x51')][_0xd3b8('0x34')]);_0x12decf[_0xd3b8('0x38')]=_['keys'](_0x580bc3[_0xd3b8('0x38')]);_0x12decf[_0xd3b8('0x39')]=_[_0xd3b8('0x3a')](_0x12decf[_0xd3b8('0x37')],_0x12decf['query']);_0x169dbd['attributes']=_['intersection'](_0x12decf[_0xd3b8('0x37')],qs['fields'](_0x580bc3[_0xd3b8('0x38')]['fields']));_0x169dbd[_0xd3b8('0x3c')]=_0x169dbd[_0xd3b8('0x3c')][_0xd3b8('0x4a')]?_0x169dbd[_0xd3b8('0x3c')]:_0x12decf[_0xd3b8('0x37')];_0x169dbd[_0xd3b8('0x3e')]=qs[_0xd3b8('0x3f')](_0x580bc3[_0xd3b8('0x38')]['sort']);_0x169dbd[_0xd3b8('0x40')]=qs[_0xd3b8('0x39')](_[_0xd3b8('0x59')](_0x580bc3['query'],_0x12decf[_0xd3b8('0x39')]));if(_0x580bc3[_0xd3b8('0x38')][_0xd3b8('0x43')]){_0x169dbd[_0xd3b8('0x40')]=_['merge'](_0x169dbd[_0xd3b8('0x40')],{'$or':_['map'](_0x169dbd['attributes'],function(_0x14be01){var _0x1c60d8={};_0x1c60d8[_0x14be01]={'$like':'%'+_0x580bc3[_0xd3b8('0x38')][_0xd3b8('0x43')]+'%'};return _0x1c60d8;})});}if(_0x580bc3[_0xd3b8('0x38')][_0xd3b8('0x5e')]){var _0x3dd0cd=_0x580bc3[_0xd3b8('0x38')][_0xd3b8('0x5e')][_0xd3b8('0x5f')](',');var _0xb3d6e6={};_0xb3d6e6[_0x3dd0cd[0x0]]={'$gte':moment(_0x3dd0cd[0x1])[_0xd3b8('0x60')](_0xd3b8('0x61'))};_0x169dbd[_0xd3b8('0x40')]=_[_0xd3b8('0x41')](_0x169dbd['where'],_0xb3d6e6);}_0x169dbd=_[_0xd3b8('0x41')]({},_0x169dbd,_0x580bc3['options']);return _0x7f37e8[_0xd3b8('0x5d')](_0x169dbd);}})[_0xd3b8('0x2b')](function(_0x52a640){if(_0x52a640){_0x157235=_0x52a640[_0xd3b8('0x4a')];if(!_0x580bc3[_0xd3b8('0x38')][_0xd3b8('0x62')](_0xd3b8('0x3d'))){_0x169dbd[_0xd3b8('0x23')]=qs[_0xd3b8('0x23')](_0x580bc3[_0xd3b8('0x38')][_0xd3b8('0x23')]);_0x169dbd[_0xd3b8('0x24')]=qs['offset'](_0x580bc3[_0xd3b8('0x38')][_0xd3b8('0x24')]);}return _0x7f37e8[_0xd3b8('0x5d')](_0x169dbd);}})[_0xd3b8('0x2b')](function(_0x51fee1){if(_0x51fee1){return _0x51fee1?{'count':_0x157235,'rows':_0x51fee1}:null;}})[_0xd3b8('0x2b')](respondWithResult(_0xe928,null))['catch'](handleError(_0xe928,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 09e4465..5f0574d 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 _0x4829=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','save','update','emit'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x4829,0x9c));var _0x9482=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0x4829[_0xa9eaa0];return _0x30897a;};'use strict';var EventEmitter=require(_0x9482('0x0'));var ChatGroup=require(_0x9482('0x1'))['db'][_0x9482('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9482('0x3'),'afterUpdate':_0x9482('0x4'),'afterDestroy':'remove'};function emitEvent(_0x231992){return function(_0x42cf26,_0x2e7afc,_0x242b84){ChatGroupEvents[_0x9482('0x5')](_0x231992+':'+_0x42cf26['id'],_0x42cf26);ChatGroupEvents[_0x9482('0x5')](_0x231992,_0x42cf26);_0x242b84(null);};}for(var e in events){if(events[_0x9482('0x6')](e)){var event=events[e];ChatGroup[_0x9482('0x7')](e,emitEvent(event));}}module[_0x9482('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x8861=['exports','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8861,0x6d));var _0x1886=function(_0x2e7577,_0xee78c1){_0x2e7577=_0x2e7577-0x0;var _0x364cf3=_0x8861[_0x2e7577];return _0x364cf3;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db'][_0x1886('0x0')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x1886('0x1')](0x0);var events={'afterCreate':_0x1886('0x2'),'afterUpdate':_0x1886('0x3'),'afterDestroy':_0x1886('0x4')};function emitEvent(_0x6da4a7){return function(_0x44c11a,_0x2673bc,_0x3eec67){ChatGroupEvents[_0x1886('0x5')](_0x6da4a7+':'+_0x44c11a['id'],_0x44c11a);ChatGroupEvents[_0x1886('0x5')](_0x6da4a7,_0x44c11a);_0x3eec67(null);};}for(var e in events){if(events[_0x1886('0x6')](e)){var event=events[e];ChatGroup[_0x1886('0x7')](e,emitEvent(event));}}module[_0x1886('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 96b5c7e..4a13bd2 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 _0xd302=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','chat_groups','../../config/logger'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd302,0xaf));var _0x2d30=function(_0x694b15,_0x149097){_0x694b15=_0x694b15-0x0;var _0x56fa00=_0xd302[_0x694b15];return _0x56fa00;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d30('0x0'))(_0x2d30('0x1'));var moment=require(_0x2d30('0x2'));var BPromise=require(_0x2d30('0x3'));var rp=require(_0x2d30('0x4'));var fs=require('fs');var path=require(_0x2d30('0x5'));var rimraf=require(_0x2d30('0x6'));var config=require(_0x2d30('0x7'));var attributes=require('./chatGroup.attributes');module[_0x2d30('0x8')]=function(_0x27453e,_0x24a0cc){return _0x27453e[_0x2d30('0x9')]('ChatGroup',attributes,{'tableName':_0x2d30('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4d9=['moment','bluebird','request-promise','path','./chatGroup.attributes','exports','define','ChatGroup','lodash','util','api'];(function(_0x413aac,_0x5e2430){var _0x569b11=function(_0x52e060){while(--_0x52e060){_0x413aac['push'](_0x413aac['shift']());}};_0x569b11(++_0x5e2430);}(_0xb4d9,0xd9));var _0x9b4d=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xb4d9[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x9b4d('0x0'));var util=require(_0x9b4d('0x1'));var logger=require('../../config/logger')(_0x9b4d('0x2'));var moment=require(_0x9b4d('0x3'));var BPromise=require(_0x9b4d('0x4'));var rp=require(_0x9b4d('0x5'));var fs=require('fs');var path=require(_0x9b4d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9b4d('0x7'));module[_0x9b4d('0x8')]=function(_0x3fd471,_0x1ce0e9){return _0x3fd471[_0x9b4d('0x9')](_0x9b4d('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 5a93b25..3092637 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 _0x8fe4=['../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1ac64f,_0x244de6){var _0x5ed989=function(_0x4d0279){while(--_0x4d0279){_0x1ac64f['push'](_0x1ac64f['shift']());}};_0x5ed989(++_0x244de6);}(_0x8fe4,0x170));var _0x48fe=function(_0xb4aa87,_0x5b44d6){_0xb4aa87=_0xb4aa87-0x0;var _0x3d7006=_0x8fe4[_0xb4aa87];return _0x3d7006;};'use strict';var _=require(_0x48fe('0x0'));var util=require(_0x48fe('0x1'));var moment=require('moment');var BPromise=require(_0x48fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48fe('0x3'))['db'];var utils=require(_0x48fe('0x4'));var logger=require(_0x48fe('0x5'))(_0x48fe('0x6'));var config=require(_0x48fe('0x7'));var jayson=require(_0x48fe('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x48fe('0x9')],{'host':_0x48fe('0xa'),'port':0x18eb});var socket=require(_0x48fe('0xb'))(new Redis(config[_0x48fe('0x9')]));require('./chatGroup.socket')[_0x48fe('0xc')](socket);function respondWithRpcPromise(_0xaae8a2,_0x366d88,_0x590543){return new BPromise(function(_0x5e1093,_0x1fd856){return client[_0x48fe('0xd')](_0xaae8a2,_0x590543)[_0x48fe('0xe')](function(_0x36a35e){logger[_0x48fe('0xf')](_0x48fe('0x10'),_0x366d88,'request\x20sent');logger[_0x48fe('0x11')](_0x48fe('0x12'),_0x366d88,'request\x20sent',JSON[_0x48fe('0x13')](_0x36a35e));if(_0x36a35e[_0x48fe('0x14')]){if(_0x36a35e[_0x48fe('0x14')][_0x48fe('0x15')]===0x1f4){logger[_0x48fe('0x14')]('ChatGroup,\x20%s,\x20%s',_0x366d88,_0x36a35e[_0x48fe('0x14')][_0x48fe('0x16')]);return _0x1fd856(_0x36a35e[_0x48fe('0x14')][_0x48fe('0x16')]);}logger[_0x48fe('0x14')](_0x48fe('0x10'),_0x366d88,_0x36a35e['error'][_0x48fe('0x16')]);return _0x5e1093(_0x36a35e[_0x48fe('0x14')]['message']);}else{logger[_0x48fe('0xf')](_0x48fe('0x10'),_0x366d88,_0x48fe('0x17'));_0x5e1093(_0x36a35e['result'][_0x48fe('0x16')]);}})[_0x48fe('0x18')](function(_0xe1874c){logger[_0x48fe('0x14')](_0x48fe('0x10'),_0x366d88,_0xe1874c);_0x1fd856(_0xe1874c);});});} \ No newline at end of file +var _0x3ee5=['debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent'];(function(_0x620fa4,_0x1d7e7a){var _0x43372f=function(_0x3ab7e3){while(--_0x3ab7e3){_0x620fa4['push'](_0x620fa4['shift']());}};_0x43372f(++_0x1d7e7a);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x106d8c,_0x7a9701){_0x106d8c=_0x106d8c-0x0;var _0x365567=_0x3ee5[_0x106d8c];return _0x365567;};'use strict';var _=require('lodash');var util=require(_0x53ee('0x0'));var moment=require(_0x53ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x53ee('0x2'));var fs=require('fs');var Redis=require(_0x53ee('0x3'));var db=require(_0x53ee('0x4'))['db'];var utils=require(_0x53ee('0x5'));var logger=require(_0x53ee('0x6'))(_0x53ee('0x7'));var config=require(_0x53ee('0x8'));var jayson=require(_0x53ee('0x9'));var client=jayson[_0x53ee('0xa')][_0x53ee('0xb')]({'port':0x232a});config[_0x53ee('0xc')]=_['defaults'](config[_0x53ee('0xc')],{'host':_0x53ee('0xd'),'port':0x18eb});var socket=require(_0x53ee('0xe'))(new Redis(config[_0x53ee('0xc')]));require(_0x53ee('0xf'))[_0x53ee('0x10')](socket);function respondWithRpcPromise(_0x2821b7,_0x17dace,_0x38422f){return new BPromise(function(_0x93450e,_0x2f49f4){return client[_0x53ee('0x11')](_0x2821b7,_0x38422f)['then'](function(_0x495e36){logger[_0x53ee('0x12')](_0x53ee('0x13'),_0x17dace,_0x53ee('0x14'));logger[_0x53ee('0x15')](_0x53ee('0x16'),_0x17dace,'request\x20sent',JSON['stringify'](_0x495e36));if(_0x495e36[_0x53ee('0x17')]){if(_0x495e36[_0x53ee('0x17')]['code']===0x1f4){logger['error'](_0x53ee('0x13'),_0x17dace,_0x495e36[_0x53ee('0x17')][_0x53ee('0x18')]);return _0x2f49f4(_0x495e36['error'][_0x53ee('0x18')]);}logger[_0x53ee('0x17')](_0x53ee('0x13'),_0x17dace,_0x495e36[_0x53ee('0x17')][_0x53ee('0x18')]);return _0x93450e(_0x495e36[_0x53ee('0x17')]['message']);}else{logger[_0x53ee('0x12')](_0x53ee('0x13'),_0x17dace,_0x53ee('0x14'));_0x93450e(_0x495e36[_0x53ee('0x19')][_0x53ee('0x18')]);}})[_0x53ee('0x1a')](function(_0x11b80f){logger[_0x53ee('0x17')](_0x53ee('0x13'),_0x17dace,_0x11b80f);_0x2f49f4(_0x11b80f);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 797bfd8..e8d4a54 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 _0x69f4=['./chatGroup.events','remove','update','emit','removeListener','length','chatGroup:'];(function(_0x238b1c,_0x846bbf){var _0xb3495c=function(_0x386574){while(--_0x386574){_0x238b1c['push'](_0x238b1c['shift']());}};_0xb3495c(++_0x846bbf);}(_0x69f4,0xa1));var _0x469f=function(_0x550d41,_0x2a5f39){_0x550d41=_0x550d41-0x0;var _0x2c4014=_0x69f4[_0x550d41];return _0x2c4014;};'use strict';var ChatGroupEvents=require(_0x469f('0x0'));var events=['save',_0x469f('0x1'),_0x469f('0x2')];function createListener(_0x13fad5,_0x257c36){return function(_0x21ba68){_0x257c36[_0x469f('0x3')](_0x13fad5,_0x21ba68);};}function removeListener(_0x5b323a,_0x3669c9){return function(){ChatGroupEvents[_0x469f('0x4')](_0x5b323a,_0x3669c9);};}exports['register']=function(_0x2e4d10){for(var _0x4bd0be=0x0,_0x18dfd4=events[_0x469f('0x5')];_0x4bd0be<_0x18dfd4;_0x4bd0be++){var _0x125f0a=events[_0x4bd0be];var _0x43fc8f=createListener(_0x469f('0x6')+_0x125f0a,_0x2e4d10);ChatGroupEvents['on'](_0x125f0a,_0x43fc8f);}}; \ No newline at end of file +var _0x26ef=['chatGroup:','update','removeListener'];(function(_0x2eab12,_0x5ec114){var _0x2463f3=function(_0x2962d3){while(--_0x2962d3){_0x2eab12['push'](_0x2eab12['shift']());}};_0x2463f3(++_0x5ec114);}(_0x26ef,0xd3));var _0xf26e=function(_0x517ca8,_0x219c12){_0x517ca8=_0x517ca8-0x0;var _0x45c889=_0x26ef[_0x517ca8];return _0x45c889;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save','remove',_0xf26e('0x0')];function createListener(_0xc768ef,_0x21aa71){return function(_0x2db54f){_0x21aa71['emit'](_0xc768ef,_0x2db54f);};}function removeListener(_0x5e3c0b,_0x4d9db1){return function(){ChatGroupEvents[_0xf26e('0x1')](_0x5e3c0b,_0x4d9db1);};}exports['register']=function(_0x4887ee){for(var _0x15db2e=0x0,_0x36bd03=events['length'];_0x15db2e<_0x36bd03;_0x15db2e++){var _0x1e361c=events[_0x15db2e];var _0x631447=createListener(_0xf26e('0x2')+_0x1e361c,_0x4887ee);ChatGroupEvents['on'](_0x1e361c,_0x631447);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index fb04446..c626ade 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 _0xdf5d=['isAuthenticated','index','/describe','/:id','show','/:id/unread','getUnread','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get'];(function(_0x18ebdf,_0x3ebf5a){var _0x378c03=function(_0x319a86){while(--_0x319a86){_0x18ebdf['push'](_0x18ebdf['shift']());}};_0x378c03(++_0x3ebf5a);}(_0xdf5d,0x110));var _0xddf5=function(_0x4adb3d,_0x13deac){_0x4adb3d=_0x4adb3d-0x0;var _0x5174a7=_0xdf5d[_0x4adb3d];return _0x5174a7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xddf5('0x0'));var express=require('express');var router=express[_0xddf5('0x1')]();var fs_extra=require(_0xddf5('0x2'));var auth=require(_0xddf5('0x3'));var interaction=require(_0xddf5('0x4'));var config=require(_0xddf5('0x5'));var controller=require(_0xddf5('0x6'));router[_0xddf5('0x7')]('/',auth[_0xddf5('0x8')](),controller[_0xddf5('0x9')]);router[_0xddf5('0x7')](_0xddf5('0xa'),auth[_0xddf5('0x8')](),controller['describe']);router[_0xddf5('0x7')](_0xddf5('0xb'),auth[_0xddf5('0x8')](),controller[_0xddf5('0xc')]);router[_0xddf5('0x7')](_0xddf5('0xd'),auth[_0xddf5('0x8')](),controller[_0xddf5('0xe')]);router['get']('/:id/members',auth[_0xddf5('0x8')](),controller['getMembers']);router[_0xddf5('0x7')](_0xddf5('0xf'),auth['isAuthenticated'](),controller[_0xddf5('0x10')]);router[_0xddf5('0x11')]('/',auth['isAuthenticated'](),controller[_0xddf5('0x12')]);router[_0xddf5('0x11')](_0xddf5('0x13'),auth[_0xddf5('0x8')](),controller[_0xddf5('0x14')]);router[_0xddf5('0x11')](_0xddf5('0xf'),auth[_0xddf5('0x8')](),controller[_0xddf5('0x15')]);router[_0xddf5('0x16')]('/:id',auth[_0xddf5('0x8')](),controller[_0xddf5('0x17')]);router[_0xddf5('0x18')](_0xddf5('0xb'),auth['isAuthenticated'](),controller[_0xddf5('0x19')]);router['delete']('/:id/members',auth[_0xddf5('0x8')](),controller[_0xddf5('0x1a')]);module[_0xddf5('0x1b')]=router; \ No newline at end of file +var _0x2307=['isAuthenticated','show','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMessage','put','delete','/:id','destroy','removeMembers','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get'];(function(_0x295b1a,_0x1e31a){var _0x2bb42b=function(_0xc27b30){while(--_0xc27b30){_0x295b1a['push'](_0x295b1a['shift']());}};_0x2bb42b(++_0x1e31a);}(_0x2307,0x12e));var _0x7230=function(_0x2fcbaf,_0xa147e1){_0x2fcbaf=_0x2fcbaf-0x0;var _0x9af804=_0x2307[_0x2fcbaf];return _0x9af804;};'use strict';var multer=require('multer');var util=require(_0x7230('0x0'));var path=require(_0x7230('0x1'));var timeout=require('connect-timeout');var express=require(_0x7230('0x2'));var router=express[_0x7230('0x3')]();var fs_extra=require(_0x7230('0x4'));var auth=require(_0x7230('0x5'));var interaction=require(_0x7230('0x6'));var config=require(_0x7230('0x7'));var controller=require(_0x7230('0x8'));router[_0x7230('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x7230('0xa')](),controller['describe']);router[_0x7230('0x9')]('/:id',auth[_0x7230('0xa')](),controller[_0x7230('0xb')]);router[_0x7230('0x9')](_0x7230('0xc'),auth[_0x7230('0xa')](),controller['getUnread']);router[_0x7230('0x9')](_0x7230('0xd'),auth[_0x7230('0xa')](),controller[_0x7230('0xe')]);router[_0x7230('0x9')](_0x7230('0xf'),auth[_0x7230('0xa')](),controller[_0x7230('0x10')]);router[_0x7230('0x11')]('/',auth[_0x7230('0xa')](),controller[_0x7230('0x12')]);router[_0x7230('0x11')](_0x7230('0xd'),auth[_0x7230('0xa')](),controller['addMembers']);router[_0x7230('0x11')](_0x7230('0xf'),auth[_0x7230('0xa')](),controller[_0x7230('0x13')]);router[_0x7230('0x14')]('/:id',auth[_0x7230('0xa')](),controller['update']);router[_0x7230('0x15')](_0x7230('0x16'),auth[_0x7230('0xa')](),controller[_0x7230('0x17')]);router[_0x7230('0x15')]('/:id/members',auth[_0x7230('0xa')](),controller[_0x7230('0x18')]);module[_0x7230('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index e5bd041..a8bc7be 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 _0x6f2f=['star','TEXT','STRING','long','DATE','BOOLEAN','sequelize','exports'];(function(_0x2ae01a,_0x2b9e18){var _0x2cf9ae=function(_0x4a72e0){while(--_0x4a72e0){_0x2ae01a['push'](_0x2ae01a['shift']());}};_0x2cf9ae(++_0x2b9e18);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6f2f[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xf6f2('0x0'));module[_0xf6f2('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0xf6f2('0x2'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xf6f2('0x3')]},'pathTranscript':{'type':Sequelize[_0xf6f2('0x3')]},'mailTranscript':{'type':Sequelize[_0xf6f2('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf6f2('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf6f2('0x4')]},'note':{'type':Sequelize[_0xf6f2('0x4')]},'browserName':{'type':Sequelize[_0xf6f2('0x4')]},'browserVersion':{'type':Sequelize[_0xf6f2('0x4')]},'osName':{'type':Sequelize[_0xf6f2('0x4')]},'osVersion':{'type':Sequelize[_0xf6f2('0x4')]},'deviceModel':{'type':Sequelize[_0xf6f2('0x4')]},'deviceVendor':{'type':Sequelize[_0xf6f2('0x4')]},'deviceType':{'type':Sequelize[_0xf6f2('0x4')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xf6f2('0x4')]},'formData':{'type':Sequelize[_0xf6f2('0x3')](_0xf6f2('0x5'))},'read1stAt':{'type':Sequelize[_0xf6f2('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf6f2('0x4')]},'customerPort':{'type':Sequelize[_0xf6f2('0x4')]},'vidaooSessionId':{'type':Sequelize[_0xf6f2('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xf6f2('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x69d3=['STRING','out','sequelize','exports','BOOLEAN','ENUM','star','TEXT','DATE'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x69d3,0xda));var _0x369d=function(_0x52e4e5,_0x2ac9fd){_0x52e4e5=_0x52e4e5-0x0;var _0x1807e4=_0x69d3[_0x52e4e5];return _0x1807e4;};'use strict';var Sequelize=require(_0x369d('0x0'));module[_0x369d('0x1')]={'closed':{'type':Sequelize[_0x369d('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x369d('0x3')](_0x369d('0x4'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x369d('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x369d('0x6')]},'disposition':{'type':Sequelize[_0x369d('0x7')]},'secondDisposition':{'type':Sequelize[_0x369d('0x7')]},'thirdDisposition':{'type':Sequelize[_0x369d('0x7')]},'note':{'type':Sequelize[_0x369d('0x7')]},'browserName':{'type':Sequelize[_0x369d('0x7')]},'browserVersion':{'type':Sequelize[_0x369d('0x7')]},'osName':{'type':Sequelize[_0x369d('0x7')]},'osVersion':{'type':Sequelize[_0x369d('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x369d('0x7')]},'referer':{'type':Sequelize[_0x369d('0x5')]},'customerIp':{'type':Sequelize[_0x369d('0x7')]},'formData':{'type':Sequelize[_0x369d('0x5')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x369d('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x369d('0x3')]('in',_0x369d('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x369d('0x7')]},'customerPort':{'type':Sequelize[_0x369d('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x369d('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index f9ee658..289b6d8 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 _0x3a36=['CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','agentAlias','System','format','%s%d','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','omit','ids','getMessages','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','includeAgent','addTags','setTags','spread','findAll','emit','removeTags','unix','server','files','tmp','attachments','Account','Owner','get','mkdirSync','Chat','N.A.','toString','closedAt','browserName','referer','tail','basename','existsSync','pipe','firstName','lastName','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','destroy','stack','name','merge','body','contact','agent','account','map','fullname','TagIds','Tags','split','push','waiting','talking','answered','unmanaged','abandoned','total','closed','UserId','disposition','index','ChatInteraction','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','buildExpression','some','compact','forEach','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','ChatWebsiteId','user','role','sequelize','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','show','include','update','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate'];(function(_0x395360,_0x3fe533){var _0x58e525=function(_0x4eb0a3){while(--_0x4eb0a3){_0x395360['push'](_0x395360['shift']());}};_0x58e525(++_0x3fe533);}(_0x3a36,0x64));var _0x63a3=function(_0x4ee21d,_0x932a23){_0x4ee21d=_0x4ee21d-0x0;var _0x39a45a=_0x3a36[_0x4ee21d];return _0x39a45a;};'use strict';var emlformat=require(_0x63a3('0x0'));var rimraf=require(_0x63a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x63a3('0x2'));var rp=require(_0x63a3('0x3'));var moment=require(_0x63a3('0x4'));var BPromise=require(_0x63a3('0x5'));var Mustache=require(_0x63a3('0x6'));var util=require(_0x63a3('0x7'));var path=require(_0x63a3('0x8'));var sox=require(_0x63a3('0x9'));var csv=require(_0x63a3('0xa'));var ejs=require(_0x63a3('0xb'));var fs=require('fs');var fs_extra=require(_0x63a3('0xc'));var _=require(_0x63a3('0xd'));var squel=require(_0x63a3('0xe'));var crypto=require(_0x63a3('0xf'));var jsforce=require(_0x63a3('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x63a3('0xa'));var querystring=require('querystring');var Papa=require(_0x63a3('0x11'));var Redis=require(_0x63a3('0x12'));var authService=require(_0x63a3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x63a3('0x14'));var pdf=require(_0x63a3('0x15'));var hardwareService=require(_0x63a3('0x16'));var logger=require(_0x63a3('0x17'))(_0x63a3('0x18'));var utils=require(_0x63a3('0x19'));var config=require(_0x63a3('0x1a'));var licenseUtil=require(_0x63a3('0x1b'));var db=require(_0x63a3('0x1c'))['db'];config['redis']=_[_0x63a3('0x1d')](config[_0x63a3('0x1e')],{'host':_0x63a3('0x1f'),'port':0x18eb});var socket=require(_0x63a3('0x20'))(new Redis(config[_0x63a3('0x1e')]));require(_0x63a3('0x21'))[_0x63a3('0x22')](socket);var jayson=require(_0x63a3('0x23'));var client=jayson[_0x63a3('0x24')]['http']({'port':0x232b});var client9004=jayson[_0x63a3('0x24')][_0x63a3('0x25')]({'port':0x232c});function respondWithRpcPromise(_0x3f0699,_0x1b7018,_0x373df7,_0x892056){return new BPromise(function(_0x143341,_0x4bef6c){var _0x1b7764=_0x892056||client;return _0x1b7764[_0x63a3('0x26')](_0x3f0699,_0x373df7)[_0x63a3('0x27')](function(_0xba4df8){logger[_0x63a3('0x28')](_0x63a3('0x29'),_0x1b7018,_0x63a3('0x2a'));logger['debug'](_0x63a3('0x2b'),_0x1b7018,_0x63a3('0x2a'),JSON[_0x63a3('0x2c')](_0xba4df8));if(_0xba4df8[_0x63a3('0x2d')]){if(_0xba4df8[_0x63a3('0x2d')][_0x63a3('0x2e')]===0x1f4){logger[_0x63a3('0x2d')](_0x63a3('0x29'),_0x1b7018,_0xba4df8[_0x63a3('0x2d')][_0x63a3('0x2f')]);return _0x4bef6c(_0xba4df8[_0x63a3('0x2d')]['message']);}logger[_0x63a3('0x2d')](_0x63a3('0x29'),_0x1b7018,_0xba4df8[_0x63a3('0x2d')][_0x63a3('0x2f')]);return _0x143341(_0xba4df8[_0x63a3('0x2d')]['message']);}else{logger[_0x63a3('0x28')](_0x63a3('0x29'),_0x1b7018,_0x63a3('0x2a'));_0x143341(_0xba4df8['result']['message']);}})[_0x63a3('0x30')](function(_0xec0979){logger[_0x63a3('0x2d')](_0x63a3('0x29'),_0x1b7018,_0xec0979);_0x4bef6c(_0xec0979);});});}function respondWithStatusCode(_0x511074,_0x55f7d){_0x55f7d=_0x55f7d||0xcc;return function(_0x5216ae){if(_0x5216ae){return _0x511074[_0x63a3('0x31')](_0x55f7d);}return _0x511074['status'](_0x55f7d)['end']();};}function respondWithResult(_0x55eca6,_0x4c3373){_0x4c3373=_0x4c3373||0xc8;return function(_0x32686d){if(_0x32686d){return _0x55eca6[_0x63a3('0x32')](_0x4c3373)[_0x63a3('0x33')](_0x32686d);}};}function respondWithFilteredResult(_0x33fbbe,_0xae6c8f){return function(_0x1f9e28){if(_0x1f9e28){var _0x2f7e05=typeof _0xae6c8f['offset']===_0x63a3('0x34')&&typeof _0xae6c8f[_0x63a3('0x35')]===_0x63a3('0x34');var _0x195b00=_0x1f9e28[_0x63a3('0x36')];var _0x4e507c=_0x2f7e05?0x0:_0xae6c8f[_0x63a3('0x37')];var _0x153c76=_0x2f7e05?_0x1f9e28['count']:_0xae6c8f['offset']+_0xae6c8f[_0x63a3('0x35')];var _0x439dfd;if(_0x153c76>=_0x195b00){_0x153c76=_0x195b00;_0x439dfd=0xc8;}else{_0x439dfd=0xce;}_0x33fbbe[_0x63a3('0x32')](_0x439dfd);return _0x33fbbe['set'](_0x63a3('0x38'),_0x4e507c+'-'+_0x153c76+'/'+_0x195b00)['json'](_0x1f9e28);}return null;};}function patchUpdates(_0x3369dd){return function(_0x4af40d){try{jsonpatch[_0x63a3('0x39')](_0x4af40d,_0x3369dd,!![]);}catch(_0x4f77e0){return BPromise[_0x63a3('0x3a')](_0x4f77e0);}return _0x4af40d['save']();};}function saveUpdates(_0x193fd7,_0x5acad3){return function(_0x59aa95){if(_0x59aa95){return _0x59aa95['update'](_0x193fd7)[_0x63a3('0x27')](function(_0x5a86f3){return _0x5a86f3;});}return null;};}function removeEntity(_0x557d29,_0x41b754){return function(_0x1ec345){if(_0x1ec345){return _0x1ec345[_0x63a3('0x3b')]()[_0x63a3('0x27')](function(){_0x557d29[_0x63a3('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46a479,_0x3c9933){return function(_0x149f1d){if(!_0x149f1d){_0x46a479[_0x63a3('0x31')](0x194);}return _0x149f1d;};}function handleError(_0x454a81,_0x500598){_0x500598=_0x500598||0x1f4;return function(_0x16a1c5){logger['error'](_0x16a1c5[_0x63a3('0x3c')]);if(_0x16a1c5[_0x63a3('0x3d')]){delete _0x16a1c5['name'];}_0x454a81[_0x63a3('0x32')](_0x500598)['send'](_0x16a1c5);};}function getMustacheRender(_0x4a2a59,_0x5638e5){return Mustache['render'](_0x4a2a59,_[_0x63a3('0x3e')](_0x5638e5[_0x63a3('0x3f')],{'contact':_0x5638e5[_0x63a3('0x40')],'message':_0x5638e5[_0x63a3('0x2f')],'agent':_0x5638e5[_0x63a3('0x41')],'interaction':_0x5638e5['interaction'],'account':_0x5638e5[_0x63a3('0x42')]}))||'';}function getInteractionUsers(_0x2b7f84,_0x5b2c01){return new BPromise(function(_0x465f51,_0x6ffc43){try{if(_0x5b2c01[_0x2b7f84['id']]){_0x2b7f84['Users']=_[_0x63a3('0x43')](_0x5b2c01[_0x2b7f84['id']],function(_0x37d1d4){return{'id':_0x37d1d4['id'],'fullname':_0x37d1d4[_0x63a3('0x44')]};});}}catch(_0x6b66ab){_0x6ffc43(_0x6b66ab);}_0x465f51(_0x2b7f84);});}function getInteractionTags(_0x1c13dc,_0x411641){return new BPromise(function(_0x147c81,_0x18f366){try{if(_0x1c13dc[_0x63a3('0x45')]){_0x1c13dc[_0x63a3('0x46')]=[];_0x1c13dc[_0x63a3('0x45')][_0x63a3('0x47')](',')['forEach'](function(_0x475ab7){_0x1c13dc[_0x63a3('0x46')][_0x63a3('0x48')](_0x411641[_0x475ab7]);});}delete _0x1c13dc[_0x63a3('0x45')];}catch(_0x5e62ea){_0x18f366(_0x5e62ea);}_0x147c81(_0x1c13dc);});}function updateChatInteraction(_0x4544c6,_0x571de9,_0x482862){return new BPromise(function(_0x1190ee,_0x305891){return getInteractionUsers(_0x4544c6,_0x482862)[_0x63a3('0x27')](function(_0x15b7b8){return getInteractionTags(_0x15b7b8,_0x571de9);})[_0x63a3('0x27')](function(_0x24d7b9){return getStateInteraction(_0x24d7b9);})[_0x63a3('0x27')](function(_0x435697){_0x1190ee(_0x435697);})[_0x63a3('0x30')](function(_0x1a23ba){_0x305891(_0x1a23ba);});});}function getStateInteraction(_0x473ba2){return new BPromise(function(_0x528225){_0x473ba2[_0x63a3('0x49')]=0x0;_0x473ba2[_0x63a3('0x4a')]=0x0;_0x473ba2[_0x63a3('0x4b')]=0x0;_0x473ba2[_0x63a3('0x4c')]=0x0;_0x473ba2[_0x63a3('0x4d')]=0x0;_0x473ba2[_0x63a3('0x4e')]=0x0;if(!_0x473ba2[_0x63a3('0x4f')]&&!_0x473ba2['UserId']){_0x473ba2['waiting']+=0x1;}if(!_0x473ba2[_0x63a3('0x4f')]&&_0x473ba2[_0x63a3('0x50')]){_0x473ba2['talking']+=0x1;if(_0x473ba2[_0x63a3('0x49')]){_0x473ba2['waiting']-=0x1;}}if(_0x473ba2[_0x63a3('0x4f')]&&_0x473ba2[_0x63a3('0x51')]===_0x63a3('0x4d')){_0x473ba2[_0x63a3('0x4d')]+=0x1;if(_0x473ba2['waiting']){_0x473ba2['waiting']-=0x1;}}else if(_0x473ba2[_0x63a3('0x4f')]&&!_0x473ba2[_0x63a3('0x50')]&&_0x473ba2[_0x63a3('0x51')]){_0x473ba2[_0x63a3('0x4c')]+=0x1;if(_0x473ba2[_0x63a3('0x49')]){_0x473ba2[_0x63a3('0x49')]-=0x1;}}else if(_0x473ba2[_0x63a3('0x4f')]&&_0x473ba2[_0x63a3('0x50')]){_0x473ba2[_0x63a3('0x4b')]+=0x1;if(_0x473ba2[_0x63a3('0x4a')]){_0x473ba2['talking']-=0x1;}}_0x473ba2[_0x63a3('0x4e')]+=0x1;_0x528225(_0x473ba2);});}exports[_0x63a3('0x52')]=function(_0x584ac3,_0x9ddec8){var _0x492f7a={},_0x453ed1={},_0x5d0476={'count':0x0,'rows':[]};var _0x380806=_['map'](db[_0x63a3('0x53')][_0x63a3('0x54')],function(_0x46bd22){return{'name':_0x46bd22['fieldName'],'type':_0x46bd22[_0x63a3('0x55')]['key']};});_0x453ed1[_0x63a3('0x56')]=_[_0x63a3('0x43')](_0x380806,_0x63a3('0x3d'));_0x453ed1[_0x63a3('0x57')]=_[_0x63a3('0x58')](_0x584ac3[_0x63a3('0x57')]);_0x453ed1[_0x63a3('0x59')]=_[_0x63a3('0x5a')](_0x453ed1[_0x63a3('0x56')],_0x453ed1[_0x63a3('0x57')]);_0x492f7a['attributes']=_[_0x63a3('0x5a')](_0x453ed1[_0x63a3('0x56')],qs[_0x63a3('0x5b')](_0x584ac3[_0x63a3('0x57')][_0x63a3('0x5b')]));_0x492f7a[_0x63a3('0x5c')]=_0x492f7a[_0x63a3('0x5c')][_0x63a3('0x5d')]?_0x492f7a['attributes']:_0x453ed1[_0x63a3('0x56')];if(!_0x584ac3[_0x63a3('0x57')]['hasOwnProperty'](_0x63a3('0x5e'))){_0x492f7a[_0x63a3('0x35')]=qs['limit'](_0x584ac3[_0x63a3('0x57')][_0x63a3('0x35')]);_0x492f7a[_0x63a3('0x37')]=qs[_0x63a3('0x37')](_0x584ac3[_0x63a3('0x57')]['offset']);}_0x492f7a[_0x63a3('0x5f')]=qs[_0x63a3('0x60')](_0x584ac3[_0x63a3('0x57')][_0x63a3('0x60')]);_0x492f7a[_0x63a3('0x61')]=qs[_0x63a3('0x59')](_[_0x63a3('0x62')](_0x584ac3[_0x63a3('0x57')],_0x453ed1[_0x63a3('0x59')]),_0x380806);var _0x1f7537=[];var _0x1d0761=squel['select']()[_0x63a3('0x63')]('id')[_0x63a3('0x63')](_0x63a3('0x3d'))[_0x63a3('0x63')](_0x63a3('0x64'))[_0x63a3('0x65')](_0x63a3('0x66'));var _0x38a03b=squel[_0x63a3('0x67')]()[_0x63a3('0x63')]('u.id')['field']('u.fullname')[_0x63a3('0x63')](_0x63a3('0x68'))[_0x63a3('0x65')](_0x63a3('0x69'),'ui')[_0x63a3('0x6a')](_0x63a3('0x6b'),'u',_0x63a3('0x6c'));var _0x12fb18=squel['select']()[_0x63a3('0x65')]('chat_interactions','i')[_0x63a3('0x6a')](_0x63a3('0x6d'),'c',_0x63a3('0x6e'))[_0x63a3('0x6a')](_0x63a3('0x6b'),'o',_0x63a3('0x6f'))['left_join'](_0x63a3('0x70'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x63a3('0x6a')](_0x63a3('0x71'),'me',_0x63a3('0x72'))['left_join'](_0x63a3('0x73'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x63a3('0x6a')](_0x63a3('0x66'),'t',_0x63a3('0x74'));var _0x2ea272=squel[_0x63a3('0x75')]();var _0x106349=[];var _0x50a240=squel[_0x63a3('0x75')]();var _0x33d083;if(_0x584ac3[_0x63a3('0x57')][_0x63a3('0x76')]){_0x33d083=as[_0x63a3('0x77')](_0x584ac3[_0x63a3('0x57')][_0x63a3('0x76')]);var _0x14dc57=_0x33d083[_0x63a3('0x78')];for(var _0x3fcb42=0x0;_0x3fcb42<_0x33d083[_0x63a3('0x79')][_0x63a3('0x5d')];_0x3fcb42++){var _0x469944=_0x33d083[_0x63a3('0x79')][_0x3fcb42];var _0x468a81='i';var _0x576d7c=_[_0x63a3('0x7a')](_0x380806,[_0x63a3('0x3d'),_0x469944[_0x63a3('0x63')]]);if(!_0x576d7c){switch(_0x469944[_0x63a3('0x63')]){case _0x63a3('0x7b'):if(_0x469944['value']==0x1){_0x12fb18['having']('`'+_0x469944[_0x63a3('0x63')]+'`\x20=\x200');}else{_0x12fb18[_0x63a3('0x7c')]('`'+_0x469944[_0x63a3('0x63')]+_0x63a3('0x7d'));}break;case _0x63a3('0x7e'):if(_0x469944[_0x63a3('0x7f')]==='$substring'){if(_0x469944[_0x63a3('0x80')]['split']('\x20')[_0x63a3('0x5d')]>0x1){_0x2ea272[_0x14dc57](_0x63a3('0x81'),qs[_0x63a3('0x82')](_0x469944['value']),null);}else{var _0x5d40b8='%'+_0x469944[_0x63a3('0x80')]+'%';_0x2ea272[_0x14dc57](_0x63a3('0x83'),_0x5d40b8,_0x5d40b8,_0x5d40b8);}}else{_0x576d7c=_[_0x63a3('0x7a')](_0x380806,[_0x63a3('0x3d'),_0x63a3('0x84')]);_0x469944[_0x63a3('0x63')]='ContactId';_0x38faa7=as['buildExpression'](_0x468a81,_0x576d7c[_0x63a3('0x55')],_0x469944);_0x2ea272[_0x14dc57](_0x38faa7[_0x63a3('0x85')],_0x38faa7[_0x63a3('0x80')][_0x63a3('0x86')],_0x38faa7[_0x63a3('0x80')][_0x63a3('0x87')]);}break;case _0x63a3('0x88'):var _0x50cb54=_0x469944[_0x63a3('0x80')][_0x63a3('0x47')](',')[_0x63a3('0x43')](function(_0x3e227c){return Number(_0x3e227c);});_0x50cb54['forEach'](function(_0x4559f4){_0x50a240['or'](_0x63a3('0x89'),'%,'+_0x4559f4+',%');});_0x106349=_[_0x63a3('0x8a')](_0x106349,_0x50cb54);break;case _0x63a3('0x8b'):if(_0x469944[_0x63a3('0x7f')]===_0x63a3('0x8c')){_0x2ea272[_0x14dc57]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x469944[_0x63a3('0x80')]+'%',null);}else{_0x576d7c=_[_0x63a3('0x7a')](_0x380806,[_0x63a3('0x3d'),_0x63a3('0x50')]);_0x469944['field']='UserId';_0x38faa7=as[_0x63a3('0x8d')](_0x468a81,_0x576d7c['type'],_0x469944);_0x2ea272[_0x14dc57](_0x38faa7['text'],_0x38faa7[_0x63a3('0x80')][_0x63a3('0x86')],_0x38faa7[_0x63a3('0x80')][_0x63a3('0x87')]);}break;case _0x63a3('0x3f'):_0x38faa7=as[_0x63a3('0x8d')]('me',null,_0x469944);_0x2ea272[_0x14dc57](_0x38faa7[_0x63a3('0x85')],_0x38faa7['value']['start'],_0x38faa7[_0x63a3('0x80')]['end']);break;}}else{var _0x38faa7=as[_0x63a3('0x8d')](_0x468a81,_0x576d7c[_0x63a3('0x55')],_0x469944);_0x2ea272[_0x14dc57](_0x38faa7[_0x63a3('0x85')],_0x38faa7[_0x63a3('0x80')]['start'],_0x38faa7['value'][_0x63a3('0x87')]);}}}else{var _0x479f23=_(_0x584ac3[_0x63a3('0x57')])['keys']()['map'](function(_0x3a16e7){return _[_0x63a3('0x8e')](_0x380806,[_0x63a3('0x3d'),_0x3a16e7])?_0x3a16e7:undefined;})[_0x63a3('0x8f')]()[_0x63a3('0x80')]();if(!_['isEmpty'](_0x479f23)){_0x479f23[_0x63a3('0x90')](function(_0x29d9c9){if(_0x29d9c9==='ChatWebsiteId'){_0x12fb18[_0x63a3('0x61')](_0x63a3('0x91'),[][_0x63a3('0x92')](_0x584ac3[_0x63a3('0x57')][_0x29d9c9]));}else if(_0x29d9c9==='createdAt'){var _0x4a89ce=JSON[_0x63a3('0x93')](_0x584ac3[_0x63a3('0x57')][_0x29d9c9])[_0x63a3('0x94')];var _0x3e3280=JSON[_0x63a3('0x93')](_0x584ac3[_0x63a3('0x57')][_0x29d9c9])[_0x63a3('0x95')];_0x12fb18[_0x63a3('0x61')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4a89ce,_0x3e3280);}else{if(_0x584ac3[_0x63a3('0x57')][_0x29d9c9]===_0x63a3('0x96')){_0x12fb18[_0x63a3('0x61')]('i.'+_0x29d9c9+_0x63a3('0x97'));}else{_0x12fb18['where']('i.'+_0x29d9c9+_0x63a3('0x98'),_0x584ac3[_0x63a3('0x57')][_0x29d9c9]);}}});}if(_0x584ac3[_0x63a3('0x57')][_0x63a3('0x99')]){if(_0x584ac3[_0x63a3('0x57')]['read']==0x1){_0x12fb18[_0x63a3('0x7c')](_0x63a3('0x9a'));}else{_0x12fb18[_0x63a3('0x7c')]('`unreadMessages`\x20>\x200');}}if(_0x584ac3[_0x63a3('0x57')][_0x63a3('0x9b')]){_0x106349=_[_0x63a3('0x9c')](_0x584ac3[_0x63a3('0x57')][_0x63a3('0x9b')])?_0x584ac3['query'][_0x63a3('0x9b')]:new Array(_0x584ac3['query'][_0x63a3('0x9b')]);_0x106349['forEach'](function(_0x560e9e){_0x50a240['or'](_0x63a3('0x89'),'%,'+_0x560e9e+',%');});}if(_0x584ac3['query']['filter']){var _0x31178a=_0x584ac3['query'][_0x63a3('0x9d')][_0x63a3('0x9e')]('\x5c','\x5c\x5c')[_0x63a3('0x9e')](/'/g,'\x27\x27');if(qs[_0x63a3('0x9f')](_0x31178a)){_0x2ea272['or'](_0x63a3('0xa0'),_0x31178a+'%');}else{_0x2ea272['or'](_0x63a3('0xa1'),qs['getFullTextValue'](_0x31178a))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x31178a+'%');}}}_0x12fb18['where'](_0x2ea272);_0x12fb18[_0x63a3('0xa2')]('i.id');var _0x54421f={'type':db[_0x63a3('0xa3')]['QueryTypes'][_0x63a3('0xa4')],'raw':!![]};var _0x4b47c6=_0x12fb18[_0x63a3('0xa5')]();_0x4b47c6[_0x63a3('0x63')](_0x63a3('0xa6'));_0x4b47c6[_0x63a3('0x63')](_0x63a3('0xa7'),'unreadMessages');if(_0x492f7a[_0x63a3('0x5f')]){_0x492f7a[_0x63a3('0x5f')][_0x63a3('0x90')](function(_0x3b0332){var _0x24698e=_0x3b0332[0x0]===_0x63a3('0xa8')?_0x3b0332[0x0]:'i.'+_0x3b0332[0x0];_0x12fb18[_0x63a3('0x5f')](_0x24698e,_0x3b0332[0x1]===_0x63a3('0xa9')?![]:!![]);});}if(!_[_0x63a3('0xaa')](_0x106349)){_0x12fb18[_0x63a3('0x7c')](_0x50a240);_0x4b47c6[_0x63a3('0x61')](_0x63a3('0xab'),_0x106349);}BPromise[_0x63a3('0xac')]()[_0x63a3('0x27')](function(){if(!_0x33d083){if(_0x584ac3[_0x63a3('0x57')][_0x63a3('0xad')])return;_0x4b47c6[_0x63a3('0x61')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x12fb18[_0x63a3('0x61')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x584ac3[_0x63a3('0xae')][_0x63a3('0xaf')]!==_0x63a3('0x41'))return;return _0x584ac3[_0x63a3('0xae')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x1ad619){if(_[_0x63a3('0xaa')](_0x1ad619)){_0x4b47c6['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x12fb18[_0x63a3('0x61')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x4b47c6[_0x63a3('0x61')](_0x63a3('0x91'),_[_0x63a3('0x43')](_0x1ad619,'id'));_0x12fb18['where'](_0x63a3('0x91'),_[_0x63a3('0x43')](_0x1ad619,'id'));}});})[_0x63a3('0x27')](function(){if(_0x584ac3[_0x63a3('0xae')]['role']===_0x63a3('0x41')&&!_0x33d083&&!_0x584ac3[_0x63a3('0x57')][_0x63a3('0xad')])return[];return db['sequelize']['query'](_0x4b47c6['toString'](),_0x54421f);})[_0x63a3('0x27')](function(_0x3ac791){_0x5d0476[_0x63a3('0x36')]=_0x3ac791['length'];if(_0x5d0476[_0x63a3('0x36')]===0x0)return[];return db[_0x63a3('0xb0')][_0x63a3('0x57')](_0x1d0761['toString'](),_0x54421f)[_0x63a3('0x27')](function(_0x1859f8){_0x1f7537=_['keyBy'](_0x1859f8,'id');_0x54421f=_['merge'](_0x54421f,{'model':db[_0x63a3('0x53')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x584ac3['query'][_0x63a3('0x5b')]){_0x492f7a['attributes'][_0x63a3('0x90')](function(_0x220166){_0x12fb18['field']('i.'+_0x220166);});}else{_0x12fb18[_0x63a3('0x63')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x63a3('0x7b'));_0x12fb18[_0x63a3('0x63')](_0x63a3('0xb1'),_0x63a3('0xb2'));_0x12fb18[_0x63a3('0x63')](_0x63a3('0xb3'),_0x63a3('0xb4'));_0x12fb18[_0x63a3('0x63')](_0x63a3('0xb5'),_0x63a3('0xa8'));_0x12fb18[_0x63a3('0x63')](_0x63a3('0xb6'));_0x12fb18['field'](_0x63a3('0xb7'),_0x63a3('0xb8'));_0x12fb18[_0x63a3('0x63')](_0x63a3('0xb9'),_0x63a3('0xba'));_0x12fb18[_0x63a3('0x63')]('c.email',_0x63a3('0xbb'));_0x12fb18['field'](_0x63a3('0xbc'),_0x63a3('0xbd'));_0x12fb18['field'](_0x63a3('0xbe'),_0x63a3('0xbf'));_0x12fb18[_0x63a3('0x63')](_0x63a3('0xc0'),'Contact.fax');_0x12fb18['field'](_0x63a3('0xc1'),'Owner.fullname');_0x12fb18[_0x63a3('0x63')](_0x63a3('0xc2'),_0x63a3('0xc3'));_0x12fb18['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x63a3('0x45'));}if(_0x492f7a[_0x63a3('0x35')])_0x12fb18[_0x63a3('0x35')](_0x492f7a[_0x63a3('0x35')]);if(_0x492f7a[_0x63a3('0x37')])_0x12fb18['offset'](_0x492f7a[_0x63a3('0x37')]);return db[_0x63a3('0xb0')]['query'](_0x12fb18['toString'](),_0x54421f);})[_0x63a3('0x27')](function(_0x53278d){if(_0x53278d[_0x63a3('0x5d')]>0x0)_0x38a03b[_0x63a3('0x61')](_0x63a3('0xc4'),_[_0x63a3('0x43')](_0x53278d,'id'));return db['sequelize'][_0x63a3('0x57')](_0x38a03b['toString'](),_0x54421f)[_0x63a3('0x27')](function(_0x3c1f88){var _0x389fc8=_[_0x63a3('0xc5')](_0x3c1f88,_0x63a3('0xc6'));var _0x26a563=[];_0x53278d['forEach'](function(_0x526e89){_0x26a563[_0x63a3('0x48')](updateChatInteraction(_0x526e89,_0x1f7537,_0x389fc8));});return BPromise[_0x63a3('0xc7')](_0x26a563);});});})[_0x63a3('0x27')](function(_0x56653c){_0x5d0476['rows']=_0x56653c;return _0x5d0476;})[_0x63a3('0x27')](respondWithFilteredResult(_0x9ddec8,_0x492f7a))[_0x63a3('0x30')](handleError(_0x9ddec8,null));};exports[_0x63a3('0xc8')]=function(_0x1411d1,_0x5a6460){var _0x5cdc59={'raw':![],'where':{'id':_0x1411d1['params']['id']}},_0xdf1fe8={};_0xdf1fe8[_0x63a3('0x56')]=_[_0x63a3('0x58')](db[_0x63a3('0x53')][_0x63a3('0x54')]);_0xdf1fe8[_0x63a3('0x57')]=_[_0x63a3('0x58')](_0x1411d1[_0x63a3('0x57')]);_0xdf1fe8[_0x63a3('0x59')]=_[_0x63a3('0x5a')](_0xdf1fe8[_0x63a3('0x56')],_0xdf1fe8['query']);_0x5cdc59['attributes']=_[_0x63a3('0x5a')](_0xdf1fe8[_0x63a3('0x56')],qs['fields'](_0x1411d1[_0x63a3('0x57')]['fields']));_0x5cdc59[_0x63a3('0x5c')]=_0x5cdc59[_0x63a3('0x5c')]['length']?_0x5cdc59[_0x63a3('0x5c')]:_0xdf1fe8['model'];if(_0x1411d1[_0x63a3('0x57')]['includeAll']){_0x5cdc59[_0x63a3('0xc9')]=[{'all':!![]}];}_0x5cdc59=_[_0x63a3('0x3e')]({},_0x5cdc59,_0x1411d1['options']);return db['ChatInteraction']['find'](_0x5cdc59)[_0x63a3('0x27')](handleEntityNotFound(_0x5a6460,null))[_0x63a3('0x27')](respondWithResult(_0x5a6460,null))[_0x63a3('0x30')](handleError(_0x5a6460,null));};exports['create']=function(_0x411685,_0x10b332){return db[_0x63a3('0x53')]['create'](_0x411685[_0x63a3('0x3f')],{})[_0x63a3('0x27')](respondWithResult(_0x10b332,0xc9))[_0x63a3('0x30')](handleError(_0x10b332,null));};exports[_0x63a3('0xca')]=function(_0xfda03d,_0x407dc8){if(_0xfda03d[_0x63a3('0x3f')]['id']){delete _0xfda03d[_0x63a3('0x3f')]['id'];}return db[_0x63a3('0x53')][_0x63a3('0x7a')]({'where':{'id':_0xfda03d['params']['id']}})[_0x63a3('0x27')](handleEntityNotFound(_0x407dc8,null))[_0x63a3('0x27')](saveUpdates(_0xfda03d[_0x63a3('0x3f')],null))['then'](respondWithResult(_0x407dc8,null))[_0x63a3('0x30')](handleError(_0x407dc8,null));};exports[_0x63a3('0x3b')]=function(_0x5f5a5e,_0xda7270){return db[_0x63a3('0x53')]['find']({'where':{'id':_0x5f5a5e[_0x63a3('0xcb')]['id']}})[_0x63a3('0x27')](handleEntityNotFound(_0xda7270,null))[_0x63a3('0x27')](removeEntity(_0xda7270,null))[_0x63a3('0x30')](handleError(_0xda7270,null));};exports[_0x63a3('0xcc')]=function(_0x94d068,_0x27f2fb){return db[_0x63a3('0x53')][_0x63a3('0xcc')]()[_0x63a3('0x27')](respondWithResult(_0x27f2fb,null))['catch'](handleError(_0x27f2fb,null));};exports[_0x63a3('0xcd')]=function(_0xc2a434,_0x442432){var _0x10fc1e=_0xc2a434[_0x63a3('0xcb')]['id'];var _0xf70a76;var _0x1c1f8f;var _0x179ea6;return db[_0x63a3('0x53')][_0x63a3('0xce')]({'where':{'id':_0x10fc1e}})[_0x63a3('0x27')](function(_0x28a6d2){_0xf70a76=_0x28a6d2;return db[_0x63a3('0xcf')]['findOne']({'where':{'id':_0x28a6d2[_0x63a3('0xad')]},'attributes':['id',_0x63a3('0xd0'),_0x63a3('0xd1'),_0x63a3('0xd2'),_0x63a3('0xd3'),_0x63a3('0xd4')],'raw':!![]});})['then'](function(_0x205e60){if(_0x205e60&&_0x205e60[_0x63a3('0xd0')]&&_0x205e60[_0x63a3('0xd1')]){_0x1c1f8f=_0x205e60;var _0xd4d1df={'interaction':{'id':_0x10fc1e},'agent':{'id':_0xc2a434[_0x63a3('0xae')]['id'],'name':_0xc2a434[_0x63a3('0xae')][_0x63a3('0x3d')],'fullname':_0xc2a434['user']['fullname'],'email':_0xc2a434[_0x63a3('0xae')][_0x63a3('0xd5')]},'contact':_0xc2a434['body'][_0x63a3('0x40')],'account':_0xc2a434[_0x63a3('0x3f')][_0x63a3('0x42')]};var _0xbec2={'rejectUnauthorized':![],'method':_0x63a3('0xd6'),'url':_0x63a3('0xd7'),'headers':{'X-APIKEY':_0x205e60[_0x63a3('0xd0')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xc2a434[_0x63a3('0xae')][_0x63a3('0xd5')]],'buttons':null,'topic':_0x1c1f8f[_0x63a3('0xd2')],'note':_[_0x63a3('0xd8')](_0x1c1f8f[_0x63a3('0xd3')])?null:getMustacheRender(_0x1c1f8f['vidaooNote'],_0xd4d1df),'metadata':null},'redirect':_0x63a3('0xd9'),'json':!![]};try{if(!_[_0x63a3('0xd8')](_0x1c1f8f['vidaooMetadata'])){var _0x5058dd=getMustacheRender(_0x1c1f8f[_0x63a3('0xd4')],_0xd4d1df);var _0x49cefd=JSON[_0x63a3('0x93')](_0x5058dd);_0xbec2[_0x63a3('0x3f')]['metadata']=_0x49cefd;}}catch(_0x28b806){throw new db['Sequelize']['ValidationError'](_0x63a3('0xda'));}return rp(_0xbec2);}else{throw new db[(_0x63a3('0xa3'))][(_0x63a3('0xdb'))](_0x63a3('0xdc'));}})[_0x63a3('0x27')](function(_0x491f19){_0x179ea6=_0x491f19;if(_0x179ea6['id']){var _0x50eba={'body':_0x179ea6[_0x63a3('0xdd')],'ChatWebsiteId':_0x1c1f8f['id'],'ChatInteractionId':_0xf70a76['id'],'direction':_0x63a3('0xde'),'UserId':_0xc2a434[_0x63a3('0xae')]['id']};return db[_0x63a3('0xdf')][_0x63a3('0xe0')](_0x50eba,{});}else{throw new db[(_0x63a3('0xa3'))][(_0x63a3('0xdb'))](_0x63a3('0xe1'));}})[_0x63a3('0x27')](function(){return _0xf70a76[_0x63a3('0xe2')]({'vidaooSessionId':_0x179ea6['id']});})[_0x63a3('0x27')](respondWithResult(_0x442432,null))[_0x63a3('0x30')](handleError(_0x442432,null));};exports[_0x63a3('0xe3')]=function(_0x90e70d,_0x13458b){if(_0x90e70d[_0x63a3('0x3f')]['id']){delete _0x90e70d[_0x63a3('0x3f')]['id'];}return db[_0x63a3('0x53')][_0x63a3('0x7a')]({'where':{'id':_0x90e70d[_0x63a3('0xcb')]['id']},'include':[{'model':db[_0x63a3('0xe4')],'as':_0x63a3('0x7e')}]})['then'](handleEntityNotFound(_0x13458b,null))['then'](saveUpdates(_0x90e70d[_0x63a3('0x3f')],null))[_0x63a3('0x27')](respondWithResult(_0x13458b,null))[_0x63a3('0x30')](handleError(_0x13458b,null));};exports[_0x63a3('0xe5')]=function(_0x142100,_0x500a4f,_0x4aa839){if(_0x142100[_0x63a3('0x3f')]['id']){delete _0x142100['body']['id'];}return db[_0x63a3('0x53')][_0x63a3('0x7a')]({'where':{'id':_0x142100['params']['id']}})['then'](function(_0x24a155){if(!_0x24a155){logger[_0x63a3('0x2d')](_0x63a3('0xe6'),'abandon',0x194,'entity\x20not\x20found');_0x500a4f[_0x63a3('0x31')](0x194);}else{if(_0x24a155[_0x63a3('0x50')]){throw new db['Sequelize'][(_0x63a3('0xdb'))](_0x63a3('0xe7'));}}return _0x24a155;})['then'](function(_0x5658ec){if(_0x5658ec){return _0x5658ec[_0x63a3('0xca')]({'closed':_0x142100[_0x63a3('0x3f')]['closed'],'disposition':_0x142100[_0x63a3('0x3f')][_0x63a3('0x51')]})['then'](function(_0x1b2ef1){return _0x1b2ef1;});}})[_0x63a3('0x27')](function(_0x1645b6){return respondWithRpcPromise(_0x63a3('0xe8'),_0x63a3('0xe5'),_0x142100[_0x63a3('0x3f')],client9004);})[_0x63a3('0x27')](respondWithResult(_0x500a4f,null))[_0x63a3('0x30')](handleError(_0x500a4f,null));};exports[_0x63a3('0xe9')]=function(_0xeaa6b4,_0x3d30d0,_0x3e510f){_0xeaa6b4[_0x63a3('0x3f')][_0x63a3('0x3d')]=_0xeaa6b4[_0x63a3('0xea')][_0x63a3('0xeb')];_0xeaa6b4[_0x63a3('0x3f')]['basename']=_0xeaa6b4[_0x63a3('0xea')][_0x63a3('0xec')];_0xeaa6b4['body'][_0x63a3('0x55')]=_0xeaa6b4[_0x63a3('0xea')][_0x63a3('0xed')];return db[_0x63a3('0xee')]['create'](_0xeaa6b4[_0x63a3('0x3f')])[_0x63a3('0x27')](respondWithResult(_0x3d30d0,0xc9))['catch'](handleError(_0x3d30d0,null));};exports[_0x63a3('0xef')]=function(_0xb0fcc5,_0x26e50e,_0x130278){return db[_0x63a3('0x53')][_0x63a3('0xce')]({'where':{'id':_0xb0fcc5['params']['id']},'raw':!![]})[_0x63a3('0x27')](handleEntityNotFound(_0x26e50e,null))['then'](function(_0x26ccbe){if(_0x26ccbe){if(_0x26ccbe[_0x63a3('0x4f')]){return _0x26e50e[_0x63a3('0x32')](0x193)[_0x63a3('0x33')]({'status':0x193,'message':_0x63a3('0xf0')});}return db['Attachment'][_0x63a3('0xce')]({'where':{'id':_0xb0fcc5[_0x63a3('0x57')][_0x63a3('0xf1')]},'raw':!![]})[_0x63a3('0x27')](handleEntityNotFound(_0x26e50e,null));}})['then'](function(_0x4e3834){if(_0x4e3834){var _0x8f5a6=_0x4e3834[_0x63a3('0xf2')]!==null;var _0x49c628=path[_0x63a3('0xf3')](config[_0x63a3('0xf4')],_0x63a3('0xf5'));if(_0x8f5a6){_0x49c628=path['join'](_0x49c628,_0x63a3('0xf6'));}var _0x19b4d3=path['join'](_0x49c628,_0x4e3834['basename']);return _0x26e50e[_0x63a3('0xf7')](_0x19b4d3);}})[_0x63a3('0x30')](handleError(_0x26e50e,null));};exports[_0x63a3('0xf8')]=function(_0x148e82,_0x3a57d6){var _0x53c49d=null;var _0x5e8492=null;var _0x310757=null;var _0x253c77=null;if(_0x148e82[_0x63a3('0x3f')]['id']){delete _0x148e82[_0x63a3('0x3f')]['id'];}if(_0x148e82[_0x63a3('0x3f')][_0x63a3('0xf9')]){_0x253c77=path['join'](config['root'],_0x63a3('0xfa'),util['format'](_0x63a3('0xfb'),Date[_0x63a3('0xfc')]()));_0x148e82[_0x63a3('0x3f')][_0x63a3('0xfd')]=_0x253c77;}return db['ChatInteraction']['find']({'where':{'id':_0x148e82[_0x63a3('0xcb')]['id']},'include':[{'model':db[_0x63a3('0xdf')],'as':_0x63a3('0xfe'),'include':[{'model':db[_0x63a3('0x8b')],'as':_0x63a3('0x8b')}]}]})[_0x63a3('0x27')](handleEntityNotFound(_0x3a57d6,null))[_0x63a3('0x27')](saveUpdates(_0x148e82[_0x63a3('0x3f')],null))[_0x63a3('0x27')](function(_0x543fec){if(_0x543fec){_0x53c49d=_0x543fec;return db[_0x63a3('0xcf')][_0x63a3('0x7a')]({'where':{'id':_0x53c49d[_0x63a3('0xad')]}});}})[_0x63a3('0x27')](function(_0x477b36){if(_0x477b36){_0x310757=_0x477b36;return db[_0x63a3('0xe4')][_0x63a3('0x7a')]({'where':{'id':_0x53c49d[_0x63a3('0x84')]}});}})[_0x63a3('0x27')](function(_0x38e29a){if(_0x38e29a){_0x5e8492=_0x38e29a;if(_0x253c77){var _0x206cd8=null;for(var _0x28ab6c=0x1;_0x28ab6c<_0x53c49d[_0x63a3('0xfe')][_0x63a3('0x5d')];++_0x28ab6c){_0x206cd8=_0x53c49d['Messages'][_0x28ab6c];var _0x588467=_0x206cd8[_0x63a3('0x50')]?util['format']('%s%d',_0x310757[_0x63a3('0xff')],_0x206cd8[_0x63a3('0x50')]):_0x63a3('0x100');var _0x220fe9=_0x148e82[_0x63a3('0x3f')]['customer']||util[_0x63a3('0x101')](_0x63a3('0x102'),_0x63a3('0x103'),_0x206cd8[_0x63a3('0x84')]);switch(_0x310757[_0x63a3('0x104')]){case _0x63a3('0x105'):_0x588467=_0x206cd8['UserId']?util['format'](_0x63a3('0x102'),_0x310757[_0x63a3('0xff')],_0x206cd8['UserId']):_0x63a3('0x100');break;case _0x63a3('0x106'):_0x588467=_0x206cd8[_0x63a3('0x50')]?_0x206cd8[_0x63a3('0x8b')][_0x63a3('0x107')]||_0x206cd8[_0x63a3('0x8b')][_0x63a3('0x44')]:_0x63a3('0x100');break;case _0x63a3('0x108'):_0x588467=_0x206cd8['UserId']?_0x206cd8[_0x63a3('0x8b')][_0x63a3('0x44')]:_0x63a3('0x100');break;default:_0x588467=_0x206cd8[_0x63a3('0x50')]?util[_0x63a3('0x101')](_0x63a3('0x102'),_0x310757[_0x63a3('0xff')],_0x206cd8[_0x63a3('0x50')]):_0x63a3('0x100');}var _0x4ecf6a=util[_0x63a3('0x101')](_0x63a3('0x109'),moment(_0x206cd8[_0x63a3('0x10a')])['format'](_0x63a3('0x10b')),_0x206cd8[_0x63a3('0x10c')]==='in'?_0x220fe9:_0x588467,_0x206cd8[_0x63a3('0x3f')]);if(!_0x206cd8[_0x63a3('0x10d')]){fs[_0x63a3('0x10e')](_0x253c77,_0x4ecf6a);}}return db[_0x63a3('0x10f')][_0x63a3('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0x63a3('0x110')],'as':_0x63a3('0x111'),'raw':!![]}]});}}})[_0x63a3('0x27')](function(_0x4d4684){if(_0x4d4684&&_0x4d4684[_0x63a3('0x111')]&&_0x148e82[_0x63a3('0x3f')]){var _0x489847={'tls':{'rejectUnauthorized':![]}};if(_0x4d4684['Smtp'][_0x63a3('0x112')]){_0x489847[_0x63a3('0x112')]=_0x4d4684[_0x63a3('0x111')][_0x63a3('0x112')];}else{_0x489847[_0x63a3('0x113')]=_0x4d4684[_0x63a3('0x111')][_0x63a3('0x113')];_0x489847[_0x63a3('0x114')]=_0x4d4684['Smtp'][_0x63a3('0x114')];_0x489847[_0x63a3('0x115')]=_0x4d4684[_0x63a3('0x111')][_0x63a3('0x115')];}if(_0x4d4684[_0x63a3('0x111')][_0x63a3('0x116')]){_0x489847[_0x63a3('0x117')]={'user':_0x4d4684['Smtp'][_0x63a3('0xae')],'pass':_0x4d4684[_0x63a3('0x111')][_0x63a3('0x118')]};}return respondWithRpcPromise(_0x63a3('0x119'),_0x63a3('0x11a'),{'account':_0x489847,'message':{'from':util[_0x63a3('0x101')](_0x63a3('0x11b'),_0x4d4684[_0x63a3('0x3d')],_0x4d4684[_0x63a3('0xd5')]||_0x4d4684[_0x63a3('0x111')]['user']),'to':_0x148e82['body'][_0x63a3('0xf9')],'subject':_0x63a3('0x11c'),'text':util[_0x63a3('0x101')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x148e82[_0x63a3('0x3f')][_0x63a3('0xf9')]),'attachments':[{'path':_0x253c77}]}})['then'](function(){return _0x53c49d;})[_0x63a3('0x30')](function(_0x324d22){console['error'](_0x324d22);});}else{return _0x53c49d;}})['then'](respondWithStatusCode(_0x3a57d6,0xc8))[_0x63a3('0x30')](handleError(_0x3a57d6,null));};exports[_0x63a3('0x11d')]=function(_0x43e097,_0x11f33f,_0x9a3079){return db[_0x63a3('0xdf')]['find']({'where':{'id':_0x43e097[_0x63a3('0xcb')]['id']}})[_0x63a3('0x27')](handleEntityNotFound(_0x11f33f,null))[_0x63a3('0x27')](function(_0x49a790){if(_0x49a790){return _0x49a790[_0x63a3('0x11d')](_0x43e097[_0x63a3('0x3f')]['ids'],_[_0x63a3('0x11e')](_0x43e097[_0x63a3('0x3f')],[_0x63a3('0x11f'),'id'])||{});}})[_0x63a3('0x27')](respondWithResult(_0x11f33f,null))[_0x63a3('0x30')](handleError(_0x11f33f,null));};exports[_0x63a3('0x120')]=function(_0x16a2ca,_0x350c59,_0xfbf71e){var _0x50584a={'raw':![],'where':{}};var _0xc0939c={};var _0x21244a={'count':0x0,'rows':[]};return db[_0x63a3('0x53')]['findOne']({'where':{'id':_0x16a2ca['params']['id']}})[_0x63a3('0x27')](handleEntityNotFound(_0x350c59,null))[_0x63a3('0x27')](function(_0x3c4b10){if(_0x3c4b10){_0xc0939c[_0x63a3('0x56')]=_[_0x63a3('0x58')](db[_0x63a3('0xdf')][_0x63a3('0x54')]);_0xc0939c['query']=_[_0x63a3('0x58')](_0x16a2ca[_0x63a3('0x57')]);_0xc0939c[_0x63a3('0x59')]=_[_0x63a3('0x5a')](_0xc0939c['model'],_0xc0939c[_0x63a3('0x57')]);_0x50584a[_0x63a3('0x5c')]=_[_0x63a3('0x5a')](_0xc0939c[_0x63a3('0x56')],qs[_0x63a3('0x5b')](_0x16a2ca['query'][_0x63a3('0x5b')]));_0x50584a[_0x63a3('0x5c')]=_0x50584a[_0x63a3('0x5c')][_0x63a3('0x5d')]?_0x50584a[_0x63a3('0x5c')]:_0xc0939c[_0x63a3('0x56')];if(!_0x16a2ca[_0x63a3('0x57')][_0x63a3('0x121')](_0x63a3('0x5e'))){_0x50584a['limit']=qs[_0x63a3('0x35')](_0x16a2ca[_0x63a3('0x57')]['limit']);_0x50584a['offset']=qs[_0x63a3('0x37')](_0x16a2ca[_0x63a3('0x57')][_0x63a3('0x37')]);}_0x50584a[_0x63a3('0x5f')]=qs[_0x63a3('0x60')](_0x16a2ca[_0x63a3('0x57')]['sort']);_0x50584a[_0x63a3('0x61')]=qs['filters'](_['pick'](_0x16a2ca[_0x63a3('0x57')],_0xc0939c['filters']));_0x50584a['where']['ChatInteractionId']=_0x3c4b10['id'];if(_0x16a2ca['query'][_0x63a3('0x9d')]){_0x50584a[_0x63a3('0x61')]=_[_0x63a3('0x3e')](_0x50584a['where'],{'$or':_[_0x63a3('0x43')](_0x50584a[_0x63a3('0x5c')],function(_0xdd0b7c){var _0x112338={};_0x112338[_0xdd0b7c]={'$like':'%'+_0x16a2ca[_0x63a3('0x57')][_0x63a3('0x9d')]+'%'};return _0x112338;})});}if(_0x16a2ca[_0x63a3('0x57')][_0x63a3('0x94')]){var _0x1a438c=_0x16a2ca['query'][_0x63a3('0x94')]['split'](',');var _0x3304af={};_0x3304af[_0x1a438c[0x0]]={'$gte':moment(_0x1a438c[0x1])[_0x63a3('0x101')](_0x63a3('0x122'))};_0x50584a[_0x63a3('0x61')]=_['merge'](_0x50584a[_0x63a3('0x61')],_0x3304af);}_0x50584a=_['merge']({},_0x50584a,_0x16a2ca[_0x63a3('0x123')]);return db[_0x63a3('0xdf')][_0x63a3('0x36')]({'where':_0x50584a[_0x63a3('0x61')]})['then'](function(_0x51dead){_0x21244a['count']=_0x51dead;if(_0x16a2ca[_0x63a3('0x57')][_0x63a3('0x124')]){_0x50584a['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x50584a);})[_0x63a3('0x27')](function(_0x474e53){_0x21244a[_0x63a3('0x125')]=_0x474e53;return _0x21244a;});}})[_0x63a3('0x27')](respondWithFilteredResult(_0x350c59,_0x50584a))[_0x63a3('0x30')](handleError(_0x350c59,null));};exports['getMyMessages']=function(_0x941d77,_0x2f4cd7,_0x2e76c5){var _0x69d8d1={'where':{}},_0x3414d2={},_0x18ce23={'count':0x0,'rows':[]};return db[_0x63a3('0x53')][_0x63a3('0xce')]({'where':{'id':_0x941d77[_0x63a3('0xcb')]['id']}})[_0x63a3('0x27')](handleEntityNotFound(_0x2f4cd7,null))[_0x63a3('0x27')](function(_0x5834cd){if(_0x5834cd){_0x3414d2[_0x63a3('0x56')]=_[_0x63a3('0x58')](db['ChatMessage']['rawAttributes']);_0x3414d2[_0x63a3('0x57')]=_[_0x63a3('0x58')](_0x941d77[_0x63a3('0x57')]);_0x3414d2[_0x63a3('0x59')]=_[_0x63a3('0x5a')](_0x3414d2[_0x63a3('0x56')],_0x3414d2[_0x63a3('0x57')]);_0x69d8d1[_0x63a3('0x5c')]=_[_0x63a3('0x5a')](_0x3414d2['model'],qs[_0x63a3('0x5b')](_0x941d77[_0x63a3('0x57')][_0x63a3('0x5b')]));_0x69d8d1[_0x63a3('0x5c')]=_0x69d8d1[_0x63a3('0x5c')][_0x63a3('0x5d')]?_0x69d8d1[_0x63a3('0x5c')]:_0x3414d2[_0x63a3('0x56')];if(!_0x941d77['query'][_0x63a3('0x121')](_0x63a3('0x5e'))){_0x69d8d1[_0x63a3('0x35')]=qs[_0x63a3('0x35')](_0x941d77['query'][_0x63a3('0x35')]);_0x69d8d1[_0x63a3('0x37')]=qs[_0x63a3('0x37')](_0x941d77[_0x63a3('0x57')]['offset']);}_0x69d8d1[_0x63a3('0x5f')]=qs[_0x63a3('0x60')](_0x941d77['query'][_0x63a3('0x60')]);_0x69d8d1[_0x63a3('0x61')]=qs['filters'](_['pick'](_0x941d77[_0x63a3('0x57')],_0x3414d2[_0x63a3('0x59')]));_0x69d8d1[_0x63a3('0x61')]['ChatInteractionId']=_0x5834cd['id'];if(_0x941d77[_0x63a3('0x57')]['filter']){_0x69d8d1[_0x63a3('0x61')]=_[_0x63a3('0x3e')](_0x69d8d1[_0x63a3('0x61')],{'$or':_[_0x63a3('0x43')](_0x69d8d1[_0x63a3('0x5c')],function(_0x4b7bbb){var _0x182fdc={};_0x182fdc[_0x4b7bbb]={'$like':'%'+_0x941d77[_0x63a3('0x57')][_0x63a3('0x9d')]+'%'};return _0x182fdc;})});}_0x69d8d1[_0x63a3('0x61')][_0x63a3('0x10d')]=![];if(_0x941d77[_0x63a3('0x57')]['id']){_0x69d8d1[_0x63a3('0x61')]['id']={'$gt':_0x941d77[_0x63a3('0x57')]['id']};}_0x69d8d1=_[_0x63a3('0x3e')]({},_0x69d8d1,_0x941d77[_0x63a3('0x123')]);return db[_0x63a3('0xdf')][_0x63a3('0x36')]({'where':_0x69d8d1['where']})[_0x63a3('0x27')](function(_0x25d200){_0x18ce23[_0x63a3('0x36')]=_0x25d200;_0x69d8d1[_0x63a3('0xc9')]=[];if(_0x941d77[_0x63a3('0x57')][_0x63a3('0x126')]){_0x69d8d1[_0x63a3('0xc9')][_0x63a3('0x48')]({'model':db['User'],'as':_0x63a3('0x8b'),'attributes':['id','fullname',_0x63a3('0x107')]});}if(_0x941d77[_0x63a3('0x57')][_0x63a3('0x124')]){_0x69d8d1[_0x63a3('0xc9')]=[{'all':!![]}];}return db[_0x63a3('0xdf')]['findAll'](_0x69d8d1);})['then'](function(_0x5078ae){_0x18ce23['rows']=_0x5078ae;return _0x18ce23;});}})[_0x63a3('0x27')](respondWithFilteredResult(_0x2f4cd7,_0x69d8d1))[_0x63a3('0x30')](handleError(_0x2f4cd7,null));};exports[_0x63a3('0x127')]=function(_0x48114c,_0x2bb2a3,_0x20fc23){return db[_0x63a3('0x53')]['find']({'where':{'id':_0x48114c[_0x63a3('0xcb')]['id']}})[_0x63a3('0x27')](handleEntityNotFound(_0x2bb2a3,null))[_0x63a3('0x27')](function(_0x3bfbef){if(_0x3bfbef){return _0x3bfbef[_0x63a3('0x128')](_0x48114c[_0x63a3('0x3f')]['ids'],_['omit'](_0x48114c[_0x63a3('0x3f')],[_0x63a3('0x11f'),'id'])||{})[_0x63a3('0x129')](function(){return db[_0x63a3('0x88')][_0x63a3('0x12a')]({'attributes':['id',_0x63a3('0x3d'),_0x63a3('0x64')],'where':{'id':_0x48114c['body'][_0x63a3('0x11f')]}});})['then'](function(_0x51ad77){socket[_0x63a3('0x12b')]('chatInteractionTags:save',{'id':Number(_0x48114c[_0x63a3('0xcb')]['id']),'tags':_0x51ad77||[]});return{'id':Number(_0x48114c[_0x63a3('0xcb')]['id']),'tags':_0x51ad77||[]};});}})[_0x63a3('0x27')](respondWithResult(_0x2bb2a3,null))['catch'](handleError(_0x2bb2a3,null));};exports[_0x63a3('0x12c')]=function(_0x37d53b,_0x560e07,_0x11d0de){return db[_0x63a3('0x53')][_0x63a3('0x7a')]({'where':{'id':_0x37d53b[_0x63a3('0xcb')]['id']}})[_0x63a3('0x27')](handleEntityNotFound(_0x560e07,null))[_0x63a3('0x27')](function(_0x235c34){if(_0x235c34){return _0x235c34[_0x63a3('0x12c')](_0x37d53b['query'][_0x63a3('0x11f')]);}})[_0x63a3('0x27')](respondWithStatusCode(_0x560e07,null))['catch'](handleError(_0x560e07,null));};exports[_0x63a3('0xf7')]=function(_0x5f5833,_0x4db81d){var _0x4b3a55=moment()[_0x63a3('0x12d')]()['toString']();var _0x55b087=path[_0x63a3('0xf3')](config[_0x63a3('0xf4')],_0x63a3('0x12e'),_0x63a3('0x12f'),_0x63a3('0x130'));var _0x45887a=path['join'](config[_0x63a3('0xf4')],'server',_0x63a3('0x12f'),_0x63a3('0x131'));var _0x29285c=path[_0x63a3('0xf3')](_0x55b087,_0x4b3a55);var _0x210134=util['format']('transcript-%d-%s.zip',_0x5f5833[_0x63a3('0xcb')]['id'],_0x4b3a55);var _0x24bc26=path[_0x63a3('0xf3')](_0x55b087,_0x210134);var _0x3734c6=[];_0x3734c6[_0x63a3('0x48')]({'model':db[_0x63a3('0x8b')],'as':'User','attributes':['id',_0x63a3('0x44')],'raw':!![]});_0x3734c6[_0x63a3('0x48')]({'model':db[_0x63a3('0xe4')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x5f5833[_0x63a3('0x57')]['attachments']){_0x3734c6[_0x63a3('0x48')]({'model':db[_0x63a3('0xee')],'as':_0x63a3('0xee'),'raw':!![]});}var _0x11655b=[{'model':db[_0x63a3('0xdf')],'as':'Messages','attributes':['id',_0x63a3('0x3f'),_0x63a3('0x10a'),_0x63a3('0x10c'),'secret',_0x63a3('0x99')],'include':_0x3734c6}];_0x11655b[_0x63a3('0x48')]({'model':db[_0x63a3('0xcf')],'as':_0x63a3('0x132'),'attributes':['id',_0x63a3('0x3d')]});_0x11655b[_0x63a3('0x48')]({'model':db['User'],'as':_0x63a3('0x133'),'attributes':['id',_0x63a3('0x44')]});return db[_0x63a3('0x53')][_0x63a3('0x7a')]({'where':{'id':_0x5f5833[_0x63a3('0xcb')]['id']},'include':_0x11655b})[_0x63a3('0x27')](handleEntityNotFound(_0x4db81d,null))['then'](function(_0x5a79bc){if(_0x5a79bc){var _0x43bbba=_0x5a79bc[_0x63a3('0x134')]({'plain':!![]});fs[_0x63a3('0x135')](_0x29285c);var _0x1a4032={'channel':_0x63a3('0x136'),'account':_0x43bbba['Account'][_0x63a3('0x3d')],'agent':_0x43bbba['Owner']?_0x43bbba[_0x63a3('0x133')][_0x63a3('0x44')]:_0x63a3('0x137'),'createdAt':moment(_0x43bbba[_0x63a3('0x10a')])[_0x63a3('0x101')](_0x63a3('0x122'))[_0x63a3('0x138')](),'closedAt':_0x43bbba[_0x63a3('0x4f')]?moment(_0x43bbba[_0x63a3('0x139')])[_0x63a3('0x101')](_0x63a3('0x122'))['toString']():'','disposition':_0x43bbba[_0x63a3('0x51')],'chatInfo':{'browser':_0x43bbba[_0x63a3('0x13a')],'os':_0x43bbba['osName'],'referer':_0x43bbba[_0x63a3('0x13b')],'customerIp':_0x43bbba['customerIp'],'customerPort':_0x43bbba['customerPort']?_0x43bbba['customerPort']:_0x63a3('0x137')},'messages':_(_0x43bbba[_0x63a3('0xfe')])[_0x63a3('0x13c')]()[_0x63a3('0x9d')]({'secret':![]})['map'](function(_0x5e692e){if(_0x5e692e[_0x63a3('0xee')]){var _0x33e0da=path[_0x63a3('0xf3')](_0x45887a,_0x5e692e[_0x63a3('0xee')][_0x63a3('0x13d')]);if(fs[_0x63a3('0x13e')](_0x33e0da)){fs['createReadStream'](_0x33e0da)[_0x63a3('0x13f')](fs['createWriteStream'](path[_0x63a3('0xf3')](_0x29285c,_0x5e692e['Attachment']['basename'])));}}return{'date':moment(_0x5e692e['createdAt'])[_0x63a3('0x101')](_0x63a3('0x122'))[_0x63a3('0x138')](),'sender':_0x5e692e[_0x63a3('0x10c')]==='out'?_0x5e692e[_0x63a3('0x8b')]?_0x5e692e[_0x63a3('0x8b')]['fullname']:_0x63a3('0x100'):_0x5e692e[_0x63a3('0x7e')][_0x63a3('0x140')]+(_0x5e692e[_0x63a3('0x7e')][_0x63a3('0x141')]?'\x20'+_0x5e692e[_0x63a3('0x7e')][_0x63a3('0x141')]:''),'body':_0x5e692e[_0x63a3('0xee')]?_0x5e692e['Attachment'][_0x63a3('0x13d')]:_0x5e692e[_0x63a3('0x3f')],'direction':_0x5e692e[_0x63a3('0x10c')]==='out'?'A':'C','secret':_0x5e692e[_0x63a3('0x10d')],'read':_0x5e692e[_0x63a3('0x99')],'attachment':_0x5e692e[_0x63a3('0xee')]};})[_0x63a3('0x80')]()};return ejs['renderFile'](path['join'](config[_0x63a3('0xf4')],'server',_0x63a3('0x142'),_0x63a3('0x143')),{'interaction':_0x1a4032})[_0x63a3('0x27')](function(_0x246eb7){var _0x3e69b1=path[_0x63a3('0xf3')](_0x29285c,_0x63a3('0x144')+_0x43bbba['id']+'-'+_0x4b3a55+'.pdf');var _0xf5be0c={'path':_0x3e69b1,'channel':_0x63a3('0x136'),'interactionId':_0x43bbba['id']};return pdf[_0x63a3('0x145')](_0x246eb7,_0xf5be0c);})[_0x63a3('0x27')](function(){return new BPromise(function(_0x1f6d57,_0x109200){zipdir(_0x29285c,{'saveTo':_0x24bc26},function(_0x3b463b,_0x2b1440){if(_0x3b463b)return _0x109200(_0x3b463b);return _0x1f6d57(_0x2b1440);});})[_0x63a3('0x27')](function(){return new BPromise(function(_0x10254a,_0x5d4cf0){rimraf(_0x29285c,function(_0x53f65a){if(_0x53f65a)_0x5d4cf0(_0x53f65a);return _0x10254a();});});})['then'](function(){return _0x4db81d[_0x63a3('0xf7')](_0x24bc26,_0x210134,function(_0x2d9c32){if(_0x2d9c32){console['log'](_0x63a3('0x146'),_0x2d9c32);}else{fs[_0x63a3('0x147')](_0x24bc26);}});});});}else{return _0x4db81d[_0x63a3('0x31')](0xc8);}})[_0x63a3('0x30')](handleError(_0x4db81d,null));}; \ No newline at end of file +var _0xf8d7=['abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','%s%d','agentAlias','System','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','port','secure','pass','SendMail','sendMail','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','addTags','setTags','spread','removeTags','server','files','transcript-%d-%s.zip','firstName','lastName','attachments','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','customerPort','tail','existsSync','pipe','createWriteStream','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','end','stack','name','send','merge','body','contact','agent','Users','map','fullname','TagIds','Tags','waiting','answered','abandoned','total','closed','UserId','talking','disposition','unmanaged','index','ChatInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','pick','select','field','color','tools_tags','u.id','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','find','value','having','`\x20=\x200','`\x20>\x200','operator','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','compact','isEmpty','ChatWebsiteId','where','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','push','all','show','params','includeAll','include','options','create','destroy','describe','findOne','ChatWebsite','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8d7,0x18d));var _0x7f8d=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xf8d7[_0x35b18a];return _0x4db1bd;};'use strict';var emlformat=require(_0x7f8d('0x0'));var rimraf=require(_0x7f8d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f8d('0x2'));var rp=require(_0x7f8d('0x3'));var moment=require(_0x7f8d('0x4'));var BPromise=require(_0x7f8d('0x5'));var Mustache=require(_0x7f8d('0x6'));var util=require(_0x7f8d('0x7'));var path=require(_0x7f8d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7f8d('0x9'));var fs=require('fs');var fs_extra=require(_0x7f8d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f8d('0xb'));var jsforce=require(_0x7f8d('0xc'));var deskjs=require(_0x7f8d('0xd'));var toCsv=require(_0x7f8d('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7f8d('0xf'));var qs=require(_0x7f8d('0x10'));var as=require(_0x7f8d('0x11'));var pdf=require(_0x7f8d('0x12'));var hardwareService=require(_0x7f8d('0x13'));var logger=require(_0x7f8d('0x14'))(_0x7f8d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7f8d('0x16'));var db=require('../../mysqldb')['db'];config[_0x7f8d('0x17')]=_[_0x7f8d('0x18')](config[_0x7f8d('0x17')],{'host':_0x7f8d('0x19'),'port':0x18eb});var socket=require(_0x7f8d('0x1a'))(new Redis(config[_0x7f8d('0x17')]));require('./chatInteraction.socket')[_0x7f8d('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7f8d('0x1c')][_0x7f8d('0x1d')]({'port':0x232b});var client9004=jayson[_0x7f8d('0x1c')][_0x7f8d('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x42512a,_0x485ade,_0x3afef9,_0x529071){return new BPromise(function(_0x19aa5c,_0x5dccfc){var _0x56acec=_0x529071||client;return _0x56acec[_0x7f8d('0x1e')](_0x42512a,_0x3afef9)[_0x7f8d('0x1f')](function(_0x14bcf8){logger['info'](_0x7f8d('0x20'),_0x485ade,_0x7f8d('0x21'));logger[_0x7f8d('0x22')](_0x7f8d('0x23'),_0x485ade,_0x7f8d('0x21'),JSON['stringify'](_0x14bcf8));if(_0x14bcf8['error']){if(_0x14bcf8[_0x7f8d('0x24')][_0x7f8d('0x25')]===0x1f4){logger['error'](_0x7f8d('0x20'),_0x485ade,_0x14bcf8[_0x7f8d('0x24')][_0x7f8d('0x26')]);return _0x5dccfc(_0x14bcf8['error'][_0x7f8d('0x26')]);}logger[_0x7f8d('0x24')](_0x7f8d('0x20'),_0x485ade,_0x14bcf8[_0x7f8d('0x24')][_0x7f8d('0x26')]);return _0x19aa5c(_0x14bcf8[_0x7f8d('0x24')][_0x7f8d('0x26')]);}else{logger['info'](_0x7f8d('0x20'),_0x485ade,_0x7f8d('0x21'));_0x19aa5c(_0x14bcf8['result']['message']);}})[_0x7f8d('0x27')](function(_0x5afd03){logger[_0x7f8d('0x24')](_0x7f8d('0x20'),_0x485ade,_0x5afd03);_0x5dccfc(_0x5afd03);});});}function respondWithStatusCode(_0x244da1,_0x1c7e63){_0x1c7e63=_0x1c7e63||0xcc;return function(_0x578238){if(_0x578238){return _0x244da1[_0x7f8d('0x28')](_0x1c7e63);}return _0x244da1[_0x7f8d('0x29')](_0x1c7e63)['end']();};}function respondWithResult(_0x49ab05,_0x5f3d57){_0x5f3d57=_0x5f3d57||0xc8;return function(_0xd27292){if(_0xd27292){return _0x49ab05[_0x7f8d('0x29')](_0x5f3d57)[_0x7f8d('0x2a')](_0xd27292);}};}function respondWithFilteredResult(_0x3bf494,_0x5bf6b4){return function(_0xe290a1){if(_0xe290a1){var _0x12bde6=typeof _0x5bf6b4[_0x7f8d('0x2b')]==='undefined'&&typeof _0x5bf6b4[_0x7f8d('0x2c')]===_0x7f8d('0x2d');var _0x47a027=_0xe290a1['count'];var _0x45073a=_0x12bde6?0x0:_0x5bf6b4[_0x7f8d('0x2b')];var _0x3c2a40=_0x12bde6?_0xe290a1[_0x7f8d('0x2e')]:_0x5bf6b4[_0x7f8d('0x2b')]+_0x5bf6b4['limit'];var _0x458499;if(_0x3c2a40>=_0x47a027){_0x3c2a40=_0x47a027;_0x458499=0xc8;}else{_0x458499=0xce;}_0x3bf494[_0x7f8d('0x29')](_0x458499);return _0x3bf494[_0x7f8d('0x2f')](_0x7f8d('0x30'),_0x45073a+'-'+_0x3c2a40+'/'+_0x47a027)['json'](_0xe290a1);}return null;};}function patchUpdates(_0x52324e){return function(_0x3e2ac6){try{jsonpatch['apply'](_0x3e2ac6,_0x52324e,!![]);}catch(_0x151a79){return BPromise[_0x7f8d('0x31')](_0x151a79);}return _0x3e2ac6[_0x7f8d('0x32')]();};}function saveUpdates(_0x21a51e,_0x3debc8){return function(_0x1bbd76){if(_0x1bbd76){return _0x1bbd76[_0x7f8d('0x33')](_0x21a51e)[_0x7f8d('0x1f')](function(_0x41fa2e){return _0x41fa2e;});}return null;};}function removeEntity(_0x25fb02,_0x517251){return function(_0x139e2a){if(_0x139e2a){return _0x139e2a['destroy']()[_0x7f8d('0x1f')](function(){_0x25fb02['status'](0xcc)[_0x7f8d('0x34')]();});}};}function handleEntityNotFound(_0x966a51,_0x8f9bd1){return function(_0x41da7e){if(!_0x41da7e){_0x966a51[_0x7f8d('0x28')](0x194);}return _0x41da7e;};}function handleError(_0x287004,_0x93f6ad){_0x93f6ad=_0x93f6ad||0x1f4;return function(_0x1a7c0d){logger[_0x7f8d('0x24')](_0x1a7c0d[_0x7f8d('0x35')]);if(_0x1a7c0d[_0x7f8d('0x36')]){delete _0x1a7c0d[_0x7f8d('0x36')];}_0x287004[_0x7f8d('0x29')](_0x93f6ad)[_0x7f8d('0x37')](_0x1a7c0d);};}function getMustacheRender(_0x4d30ca,_0x407183){return Mustache['render'](_0x4d30ca,_[_0x7f8d('0x38')](_0x407183[_0x7f8d('0x39')],{'contact':_0x407183[_0x7f8d('0x3a')],'message':_0x407183[_0x7f8d('0x26')],'agent':_0x407183[_0x7f8d('0x3b')],'interaction':_0x407183['interaction'],'account':_0x407183['account']}))||'';}function getInteractionUsers(_0x14920f,_0x58a5ac){return new BPromise(function(_0x1d7f48,_0x59bc35){try{if(_0x58a5ac[_0x14920f['id']]){_0x14920f[_0x7f8d('0x3c')]=_[_0x7f8d('0x3d')](_0x58a5ac[_0x14920f['id']],function(_0xd5de23){return{'id':_0xd5de23['id'],'fullname':_0xd5de23[_0x7f8d('0x3e')]};});}}catch(_0x36f688){_0x59bc35(_0x36f688);}_0x1d7f48(_0x14920f);});}function getInteractionTags(_0x3a5b0c,_0x1e31f2){return new BPromise(function(_0x223758,_0x1eda1b){try{if(_0x3a5b0c[_0x7f8d('0x3f')]){_0x3a5b0c[_0x7f8d('0x40')]=[];_0x3a5b0c['TagIds']['split'](',')['forEach'](function(_0x4a1e31){_0x3a5b0c[_0x7f8d('0x40')]['push'](_0x1e31f2[_0x4a1e31]);});}delete _0x3a5b0c[_0x7f8d('0x3f')];}catch(_0x478bfa){_0x1eda1b(_0x478bfa);}_0x223758(_0x3a5b0c);});}function updateChatInteraction(_0x122089,_0x2f08ee,_0xb1dd23){return new BPromise(function(_0x56fa25,_0x3294dc){return getInteractionUsers(_0x122089,_0xb1dd23)['then'](function(_0x4ecb4c){return getInteractionTags(_0x4ecb4c,_0x2f08ee);})[_0x7f8d('0x1f')](function(_0x59d428){return getStateInteraction(_0x59d428);})[_0x7f8d('0x1f')](function(_0x332f03){_0x56fa25(_0x332f03);})['catch'](function(_0x47200b){_0x3294dc(_0x47200b);});});}function getStateInteraction(_0x1d9845){return new BPromise(function(_0x369784){_0x1d9845[_0x7f8d('0x41')]=0x0;_0x1d9845['talking']=0x0;_0x1d9845[_0x7f8d('0x42')]=0x0;_0x1d9845['unmanaged']=0x0;_0x1d9845[_0x7f8d('0x43')]=0x0;_0x1d9845[_0x7f8d('0x44')]=0x0;if(!_0x1d9845[_0x7f8d('0x45')]&&!_0x1d9845['UserId']){_0x1d9845[_0x7f8d('0x41')]+=0x1;}if(!_0x1d9845[_0x7f8d('0x45')]&&_0x1d9845[_0x7f8d('0x46')]){_0x1d9845[_0x7f8d('0x47')]+=0x1;if(_0x1d9845['waiting']){_0x1d9845[_0x7f8d('0x41')]-=0x1;}}if(_0x1d9845[_0x7f8d('0x45')]&&_0x1d9845[_0x7f8d('0x48')]==='abandoned'){_0x1d9845[_0x7f8d('0x43')]+=0x1;if(_0x1d9845['waiting']){_0x1d9845['waiting']-=0x1;}}else if(_0x1d9845[_0x7f8d('0x45')]&&!_0x1d9845[_0x7f8d('0x46')]&&_0x1d9845[_0x7f8d('0x48')]){_0x1d9845[_0x7f8d('0x49')]+=0x1;if(_0x1d9845[_0x7f8d('0x41')]){_0x1d9845[_0x7f8d('0x41')]-=0x1;}}else if(_0x1d9845[_0x7f8d('0x45')]&&_0x1d9845[_0x7f8d('0x46')]){_0x1d9845[_0x7f8d('0x42')]+=0x1;if(_0x1d9845[_0x7f8d('0x47')]){_0x1d9845['talking']-=0x1;}}_0x1d9845[_0x7f8d('0x44')]+=0x1;_0x369784(_0x1d9845);});}exports[_0x7f8d('0x4a')]=function(_0x664050,_0x3d3bdb){var _0x4e66f6={},_0x35ea65={},_0x529953={'count':0x0,'rows':[]};var _0x53e57d=_['map'](db[_0x7f8d('0x4b')][_0x7f8d('0x4c')],function(_0x4d9d04){return{'name':_0x4d9d04[_0x7f8d('0x4d')],'type':_0x4d9d04[_0x7f8d('0x4e')][_0x7f8d('0x4f')]};});_0x35ea65['model']=_[_0x7f8d('0x3d')](_0x53e57d,_0x7f8d('0x36'));_0x35ea65[_0x7f8d('0x50')]=_[_0x7f8d('0x51')](_0x664050['query']);_0x35ea65[_0x7f8d('0x52')]=_[_0x7f8d('0x53')](_0x35ea65[_0x7f8d('0x54')],_0x35ea65[_0x7f8d('0x50')]);_0x4e66f6[_0x7f8d('0x55')]=_[_0x7f8d('0x53')](_0x35ea65[_0x7f8d('0x54')],qs['fields'](_0x664050[_0x7f8d('0x50')][_0x7f8d('0x56')]));_0x4e66f6[_0x7f8d('0x55')]=_0x4e66f6['attributes'][_0x7f8d('0x57')]?_0x4e66f6['attributes']:_0x35ea65[_0x7f8d('0x54')];if(!_0x664050['query']['hasOwnProperty']('nolimit')){_0x4e66f6[_0x7f8d('0x2c')]=qs[_0x7f8d('0x2c')](_0x664050[_0x7f8d('0x50')][_0x7f8d('0x2c')]);_0x4e66f6['offset']=qs[_0x7f8d('0x2b')](_0x664050[_0x7f8d('0x50')][_0x7f8d('0x2b')]);}_0x4e66f6[_0x7f8d('0x58')]=qs[_0x7f8d('0x59')](_0x664050[_0x7f8d('0x50')][_0x7f8d('0x59')]);_0x4e66f6['where']=qs[_0x7f8d('0x52')](_[_0x7f8d('0x5a')](_0x664050[_0x7f8d('0x50')],_0x35ea65[_0x7f8d('0x52')]),_0x53e57d);var _0x221e7b=[];var _0x2de226=squel[_0x7f8d('0x5b')]()[_0x7f8d('0x5c')]('id')[_0x7f8d('0x5c')](_0x7f8d('0x36'))['field'](_0x7f8d('0x5d'))['from'](_0x7f8d('0x5e'));var _0x1ad94a=squel[_0x7f8d('0x5b')]()[_0x7f8d('0x5c')](_0x7f8d('0x5f'))[_0x7f8d('0x5c')]('u.fullname')[_0x7f8d('0x5c')]('ui.ChatInteractionId')[_0x7f8d('0x60')](_0x7f8d('0x61'),'ui')[_0x7f8d('0x62')](_0x7f8d('0x63'),'u',_0x7f8d('0x64'));var _0x328615=squel[_0x7f8d('0x5b')]()[_0x7f8d('0x60')]('chat_interactions','i')[_0x7f8d('0x62')]('cm_contacts','c',_0x7f8d('0x65'))['left_join'](_0x7f8d('0x63'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x7f8d('0x66'),'a',_0x7f8d('0x67'))[_0x7f8d('0x62')]('chat_messages','me',_0x7f8d('0x68'))['left_join'](_0x7f8d('0x69'),'it',_0x7f8d('0x6a'))[_0x7f8d('0x62')](_0x7f8d('0x5e'),'t','t.id\x20=\x20it.TagId');var _0x99ff34=squel[_0x7f8d('0x6b')]();var _0x4f2e19=[];var _0x3e3c50=squel[_0x7f8d('0x6b')]();var _0x3bc4e3;if(_0x664050[_0x7f8d('0x50')][_0x7f8d('0x6c')]){_0x3bc4e3=as[_0x7f8d('0x6d')](_0x664050[_0x7f8d('0x50')][_0x7f8d('0x6c')]);var _0x47ac15=_0x3bc4e3['sqlOperator'];for(var _0x5de7b6=0x0;_0x5de7b6<_0x3bc4e3[_0x7f8d('0x6e')]['length'];_0x5de7b6++){var _0x44889a=_0x3bc4e3[_0x7f8d('0x6e')][_0x5de7b6];var _0x4402ab='i';var _0x338722=_[_0x7f8d('0x6f')](_0x53e57d,['name',_0x44889a['field']]);if(!_0x338722){switch(_0x44889a[_0x7f8d('0x5c')]){case'unreadMessages':if(_0x44889a[_0x7f8d('0x70')]==0x1){_0x328615[_0x7f8d('0x71')]('`'+_0x44889a['field']+_0x7f8d('0x72'));}else{_0x328615['having']('`'+_0x44889a[_0x7f8d('0x5c')]+_0x7f8d('0x73'));}break;case'Contact':if(_0x44889a[_0x7f8d('0x74')]==='$substring'){if(_0x44889a[_0x7f8d('0x70')][_0x7f8d('0x75')]('\x20')[_0x7f8d('0x57')]>0x1){_0x99ff34[_0x47ac15]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7f8d('0x76')](_0x44889a[_0x7f8d('0x70')]),null);}else{var _0x46f03e='%'+_0x44889a[_0x7f8d('0x70')]+'%';_0x99ff34[_0x47ac15](_0x7f8d('0x77'),_0x46f03e,_0x46f03e,_0x46f03e);}}else{_0x338722=_[_0x7f8d('0x6f')](_0x53e57d,[_0x7f8d('0x36'),_0x7f8d('0x78')]);_0x44889a[_0x7f8d('0x5c')]='ContactId';_0x13ac4f=as['buildExpression'](_0x4402ab,_0x338722['type'],_0x44889a);_0x99ff34[_0x47ac15](_0x13ac4f[_0x7f8d('0x79')],_0x13ac4f['value'][_0x7f8d('0x7a')],_0x13ac4f[_0x7f8d('0x70')][_0x7f8d('0x34')]);}break;case _0x7f8d('0x7b'):var _0x1d21f8=_0x44889a[_0x7f8d('0x70')][_0x7f8d('0x75')](',')[_0x7f8d('0x3d')](function(_0x582cce){return Number(_0x582cce);});_0x1d21f8[_0x7f8d('0x7c')](function(_0x31ca0b){_0x3e3c50['or'](_0x7f8d('0x7d'),'%,'+_0x31ca0b+',%');});_0x4f2e19=_[_0x7f8d('0x7e')](_0x4f2e19,_0x1d21f8);break;case _0x7f8d('0x7f'):if(_0x44889a[_0x7f8d('0x74')]===_0x7f8d('0x80')){_0x99ff34[_0x47ac15](_0x7f8d('0x81'),'%'+_0x44889a[_0x7f8d('0x70')]+'%',null);}else{_0x338722=_[_0x7f8d('0x6f')](_0x53e57d,[_0x7f8d('0x36'),'UserId']);_0x44889a[_0x7f8d('0x5c')]=_0x7f8d('0x46');_0x13ac4f=as[_0x7f8d('0x82')](_0x4402ab,_0x338722[_0x7f8d('0x4e')],_0x44889a);_0x99ff34[_0x47ac15](_0x13ac4f['text'],_0x13ac4f[_0x7f8d('0x70')][_0x7f8d('0x7a')],_0x13ac4f['value'][_0x7f8d('0x34')]);}break;case _0x7f8d('0x39'):_0x13ac4f=as[_0x7f8d('0x82')]('me',null,_0x44889a);_0x99ff34[_0x47ac15](_0x13ac4f[_0x7f8d('0x79')],_0x13ac4f[_0x7f8d('0x70')][_0x7f8d('0x7a')],_0x13ac4f['value'][_0x7f8d('0x34')]);break;}}else{var _0x13ac4f=as[_0x7f8d('0x82')](_0x4402ab,_0x338722[_0x7f8d('0x4e')],_0x44889a);_0x99ff34[_0x47ac15](_0x13ac4f[_0x7f8d('0x79')],_0x13ac4f[_0x7f8d('0x70')][_0x7f8d('0x7a')],_0x13ac4f['value'][_0x7f8d('0x34')]);}}}else{var _0x398454=_(_0x664050[_0x7f8d('0x50')])[_0x7f8d('0x51')]()['map'](function(_0xc59830){return _['some'](_0x53e57d,['name',_0xc59830])?_0xc59830:undefined;})[_0x7f8d('0x83')]()[_0x7f8d('0x70')]();if(!_[_0x7f8d('0x84')](_0x398454)){_0x398454[_0x7f8d('0x7c')](function(_0x237a33){if(_0x237a33===_0x7f8d('0x85')){_0x328615[_0x7f8d('0x86')]('i.ChatWebsiteId\x20IN\x20?',[][_0x7f8d('0x87')](_0x664050[_0x7f8d('0x50')][_0x237a33]));}else if(_0x237a33===_0x7f8d('0x88')){var _0x52dbfd=JSON[_0x7f8d('0x89')](_0x664050[_0x7f8d('0x50')][_0x237a33])[_0x7f8d('0x8a')];var _0x2b4513=JSON[_0x7f8d('0x89')](_0x664050[_0x7f8d('0x50')][_0x237a33])[_0x7f8d('0x8b')];_0x328615['where'](_0x7f8d('0x8c'),_0x52dbfd,_0x2b4513);}else{if(_0x664050['query'][_0x237a33]===_0x7f8d('0x8d')){_0x328615[_0x7f8d('0x86')]('i.'+_0x237a33+_0x7f8d('0x8e'));}else{_0x328615['where']('i.'+_0x237a33+_0x7f8d('0x8f'),_0x664050[_0x7f8d('0x50')][_0x237a33]);}}});}if(_0x664050['query'][_0x7f8d('0x90')]){if(_0x664050[_0x7f8d('0x50')][_0x7f8d('0x90')]==0x1){_0x328615[_0x7f8d('0x71')](_0x7f8d('0x91'));}else{_0x328615[_0x7f8d('0x71')](_0x7f8d('0x92'));}}if(_0x664050['query'][_0x7f8d('0x93')]){_0x4f2e19=_['isArray'](_0x664050[_0x7f8d('0x50')][_0x7f8d('0x93')])?_0x664050[_0x7f8d('0x50')][_0x7f8d('0x93')]:new Array(_0x664050[_0x7f8d('0x50')][_0x7f8d('0x93')]);_0x4f2e19[_0x7f8d('0x7c')](function(_0x34fd27){_0x3e3c50['or'](_0x7f8d('0x7d'),'%,'+_0x34fd27+',%');});}if(_0x664050[_0x7f8d('0x50')][_0x7f8d('0x94')]){var _0x21f912=_0x664050['query']['filter']['replace']('\x5c','\x5c\x5c')[_0x7f8d('0x95')](/'/g,'\x27\x27');if(qs[_0x7f8d('0x96')](_0x21f912)){_0x99ff34['or'](_0x7f8d('0x97'),_0x21f912+'%');}else{_0x99ff34['or'](_0x7f8d('0x98'),qs[_0x7f8d('0x76')](_0x21f912))['or'](_0x7f8d('0x99'),_0x21f912+'%');}}}_0x328615[_0x7f8d('0x86')](_0x99ff34);_0x328615[_0x7f8d('0x9a')](_0x7f8d('0x9b'));var _0x3e32a1={'type':db['Sequelize'][_0x7f8d('0x9c')][_0x7f8d('0x9d')],'raw':!![]};var _0x4a7ac8=_0x328615['clone']();_0x4a7ac8['field']('i.id');_0x4a7ac8[_0x7f8d('0x5c')](_0x7f8d('0x9e'),_0x7f8d('0x9f'));if(_0x4e66f6[_0x7f8d('0x58')]){_0x4e66f6[_0x7f8d('0x58')]['forEach'](function(_0x595b1b){var _0x49514a=_0x595b1b[0x0]===_0x7f8d('0xa0')?_0x595b1b[0x0]:'i.'+_0x595b1b[0x0];_0x328615[_0x7f8d('0x58')](_0x49514a,_0x595b1b[0x1]===_0x7f8d('0xa1')?![]:!![]);});}if(!_[_0x7f8d('0x84')](_0x4f2e19)){_0x328615[_0x7f8d('0x71')](_0x3e3c50);_0x4a7ac8[_0x7f8d('0x86')]('t.id\x20IN\x20?',_0x4f2e19);}BPromise['resolve']()[_0x7f8d('0x1f')](function(){if(!_0x3bc4e3){if(_0x664050[_0x7f8d('0x50')]['ChatWebsiteId'])return;_0x4a7ac8[_0x7f8d('0x86')](_0x7f8d('0xa2'));_0x328615[_0x7f8d('0x86')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x664050[_0x7f8d('0xa3')][_0x7f8d('0xa4')]!==_0x7f8d('0x3b'))return;return _0x664050[_0x7f8d('0xa3')][_0x7f8d('0xa5')]({'attributes':['id'],'raw':!![]})[_0x7f8d('0x1f')](function(_0x39d9dd){if(_[_0x7f8d('0x84')](_0x39d9dd)){_0x4a7ac8[_0x7f8d('0x86')](_0x7f8d('0xa6'));_0x328615[_0x7f8d('0x86')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x4a7ac8[_0x7f8d('0x86')](_0x7f8d('0xa7'),_['map'](_0x39d9dd,'id'));_0x328615[_0x7f8d('0x86')](_0x7f8d('0xa7'),_[_0x7f8d('0x3d')](_0x39d9dd,'id'));}});})[_0x7f8d('0x1f')](function(){if(_0x664050['user'][_0x7f8d('0xa4')]===_0x7f8d('0x3b')&&!_0x3bc4e3&&!_0x664050[_0x7f8d('0x50')]['ChatWebsiteId'])return[];return db[_0x7f8d('0xa8')][_0x7f8d('0x50')](_0x4a7ac8[_0x7f8d('0xa9')](),_0x3e32a1);})['then'](function(_0x25da7d){_0x529953[_0x7f8d('0x2e')]=_0x25da7d['length'];if(_0x529953[_0x7f8d('0x2e')]===0x0)return[];return db[_0x7f8d('0xa8')][_0x7f8d('0x50')](_0x2de226[_0x7f8d('0xa9')](),_0x3e32a1)['then'](function(_0x26c82d){_0x221e7b=_[_0x7f8d('0xaa')](_0x26c82d,'id');_0x3e32a1=_[_0x7f8d('0x38')](_0x3e32a1,{'model':db[_0x7f8d('0x4b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x664050[_0x7f8d('0x50')][_0x7f8d('0x56')]){_0x4e66f6[_0x7f8d('0x55')]['forEach'](function(_0x2569b3){_0x328615[_0x7f8d('0x5c')]('i.'+_0x2569b3);});}else{_0x328615['field'](_0x7f8d('0x9e'),_0x7f8d('0x9f'));_0x328615[_0x7f8d('0x5c')](_0x7f8d('0xab'),_0x7f8d('0xac'));_0x328615[_0x7f8d('0x5c')](_0x7f8d('0xad'),_0x7f8d('0xae'));_0x328615[_0x7f8d('0x5c')](_0x7f8d('0xaf'),'contactName');_0x328615['field'](_0x7f8d('0xb0'));_0x328615[_0x7f8d('0x5c')](_0x7f8d('0xb1'),_0x7f8d('0xb2'));_0x328615[_0x7f8d('0x5c')](_0x7f8d('0xb3'),_0x7f8d('0xb4'));_0x328615['field']('c.email',_0x7f8d('0xb5'));_0x328615[_0x7f8d('0x5c')]('c.phone',_0x7f8d('0xb6'));_0x328615['field']('c.mobile','Contact.mobile');_0x328615[_0x7f8d('0x5c')](_0x7f8d('0xb7'),'Contact.fax');_0x328615[_0x7f8d('0x5c')](_0x7f8d('0xb8'),_0x7f8d('0xb9'));_0x328615[_0x7f8d('0x5c')](_0x7f8d('0xba'),_0x7f8d('0xbb'));_0x328615[_0x7f8d('0x5c')](_0x7f8d('0xbc'),_0x7f8d('0x3f'));}if(_0x4e66f6[_0x7f8d('0x2c')])_0x328615['limit'](_0x4e66f6[_0x7f8d('0x2c')]);if(_0x4e66f6[_0x7f8d('0x2b')])_0x328615[_0x7f8d('0x2b')](_0x4e66f6[_0x7f8d('0x2b')]);return db[_0x7f8d('0xa8')][_0x7f8d('0x50')](_0x328615['toString'](),_0x3e32a1);})[_0x7f8d('0x1f')](function(_0x1dd449){if(_0x1dd449[_0x7f8d('0x57')]>0x0)_0x1ad94a[_0x7f8d('0x86')]('ui.ChatInteractionId\x20IN\x20?',_[_0x7f8d('0x3d')](_0x1dd449,'id'));return db[_0x7f8d('0xa8')][_0x7f8d('0x50')](_0x1ad94a[_0x7f8d('0xa9')](),_0x3e32a1)[_0x7f8d('0x1f')](function(_0x82d181){var _0x43fa90=_[_0x7f8d('0xbd')](_0x82d181,_0x7f8d('0xbe'));var _0x17dda2=[];_0x1dd449[_0x7f8d('0x7c')](function(_0x1d7b32){_0x17dda2[_0x7f8d('0xbf')](updateChatInteraction(_0x1d7b32,_0x221e7b,_0x43fa90));});return BPromise[_0x7f8d('0xc0')](_0x17dda2);});});})[_0x7f8d('0x1f')](function(_0x487f78){_0x529953['rows']=_0x487f78;return _0x529953;})['then'](respondWithFilteredResult(_0x3d3bdb,_0x4e66f6))[_0x7f8d('0x27')](handleError(_0x3d3bdb,null));};exports[_0x7f8d('0xc1')]=function(_0x824f3f,_0x51bf1d){var _0x4d7288={'raw':![],'where':{'id':_0x824f3f[_0x7f8d('0xc2')]['id']}},_0x3ce13f={};_0x3ce13f['model']=_[_0x7f8d('0x51')](db[_0x7f8d('0x4b')]['rawAttributes']);_0x3ce13f[_0x7f8d('0x50')]=_[_0x7f8d('0x51')](_0x824f3f['query']);_0x3ce13f[_0x7f8d('0x52')]=_[_0x7f8d('0x53')](_0x3ce13f['model'],_0x3ce13f[_0x7f8d('0x50')]);_0x4d7288[_0x7f8d('0x55')]=_[_0x7f8d('0x53')](_0x3ce13f[_0x7f8d('0x54')],qs[_0x7f8d('0x56')](_0x824f3f[_0x7f8d('0x50')][_0x7f8d('0x56')]));_0x4d7288['attributes']=_0x4d7288[_0x7f8d('0x55')][_0x7f8d('0x57')]?_0x4d7288['attributes']:_0x3ce13f[_0x7f8d('0x54')];if(_0x824f3f['query'][_0x7f8d('0xc3')]){_0x4d7288[_0x7f8d('0xc4')]=[{'all':!![]}];}_0x4d7288=_[_0x7f8d('0x38')]({},_0x4d7288,_0x824f3f[_0x7f8d('0xc5')]);return db['ChatInteraction'][_0x7f8d('0x6f')](_0x4d7288)[_0x7f8d('0x1f')](handleEntityNotFound(_0x51bf1d,null))[_0x7f8d('0x1f')](respondWithResult(_0x51bf1d,null))[_0x7f8d('0x27')](handleError(_0x51bf1d,null));};exports[_0x7f8d('0xc6')]=function(_0x3cf11c,_0x1d459b){return db[_0x7f8d('0x4b')][_0x7f8d('0xc6')](_0x3cf11c[_0x7f8d('0x39')],{})[_0x7f8d('0x1f')](respondWithResult(_0x1d459b,0xc9))[_0x7f8d('0x27')](handleError(_0x1d459b,null));};exports[_0x7f8d('0x33')]=function(_0x8602b2,_0x1b4ee3){if(_0x8602b2[_0x7f8d('0x39')]['id']){delete _0x8602b2['body']['id'];}return db[_0x7f8d('0x4b')][_0x7f8d('0x6f')]({'where':{'id':_0x8602b2['params']['id']}})[_0x7f8d('0x1f')](handleEntityNotFound(_0x1b4ee3,null))[_0x7f8d('0x1f')](saveUpdates(_0x8602b2[_0x7f8d('0x39')],null))[_0x7f8d('0x1f')](respondWithResult(_0x1b4ee3,null))['catch'](handleError(_0x1b4ee3,null));};exports[_0x7f8d('0xc7')]=function(_0x4d87a7,_0x3dd8d0){return db[_0x7f8d('0x4b')][_0x7f8d('0x6f')]({'where':{'id':_0x4d87a7[_0x7f8d('0xc2')]['id']}})[_0x7f8d('0x1f')](handleEntityNotFound(_0x3dd8d0,null))['then'](removeEntity(_0x3dd8d0,null))['catch'](handleError(_0x3dd8d0,null));};exports['describe']=function(_0x486aa,_0x21c9cc){return db['ChatInteraction'][_0x7f8d('0xc8')]()[_0x7f8d('0x1f')](respondWithResult(_0x21c9cc,null))['catch'](handleError(_0x21c9cc,null));};exports['createVidaooSession']=function(_0x1a7fad,_0x4969ed){var _0x46ab99=_0x1a7fad['params']['id'];var _0x26c729;var _0x26ebef;var _0x241c17;return db[_0x7f8d('0x4b')][_0x7f8d('0xc9')]({'where':{'id':_0x46ab99}})[_0x7f8d('0x1f')](function(_0x4a3c4a){_0x26c729=_0x4a3c4a;return db[_0x7f8d('0xca')][_0x7f8d('0xc9')]({'where':{'id':_0x4a3c4a[_0x7f8d('0x85')]},'attributes':['id',_0x7f8d('0xcb'),'vidaooEscalation',_0x7f8d('0xcc'),_0x7f8d('0xcd'),_0x7f8d('0xce')],'raw':!![]});})[_0x7f8d('0x1f')](function(_0x31f360){if(_0x31f360&&_0x31f360[_0x7f8d('0xcb')]&&_0x31f360['vidaooEscalation']){_0x26ebef=_0x31f360;var _0x171b36={'interaction':{'id':_0x46ab99},'agent':{'id':_0x1a7fad[_0x7f8d('0xa3')]['id'],'name':_0x1a7fad['user'][_0x7f8d('0x36')],'fullname':_0x1a7fad[_0x7f8d('0xa3')][_0x7f8d('0x3e')],'email':_0x1a7fad[_0x7f8d('0xa3')][_0x7f8d('0xcf')]},'contact':_0x1a7fad['body'][_0x7f8d('0x3a')],'account':_0x1a7fad['body']['account']};var _0x2dae34={'rejectUnauthorized':![],'method':_0x7f8d('0xd0'),'url':_0x7f8d('0xd1'),'headers':{'X-APIKEY':_0x31f360[_0x7f8d('0xcb')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1a7fad['user'][_0x7f8d('0xcf')]],'buttons':null,'topic':_0x26ebef[_0x7f8d('0xcc')],'note':_[_0x7f8d('0xd2')](_0x26ebef['vidaooNote'])?null:getMustacheRender(_0x26ebef['vidaooNote'],_0x171b36),'metadata':null},'redirect':_0x7f8d('0xd3'),'json':!![]};try{if(!_[_0x7f8d('0xd2')](_0x26ebef['vidaooMetadata'])){var _0x22082a=getMustacheRender(_0x26ebef[_0x7f8d('0xce')],_0x171b36);var _0x57c248=JSON[_0x7f8d('0x89')](_0x22082a);_0x2dae34[_0x7f8d('0x39')]['metadata']=_0x57c248;}}catch(_0x596a40){throw new db[(_0x7f8d('0xd4'))][(_0x7f8d('0xd5'))](_0x7f8d('0xd6'));}return rp(_0x2dae34);}else{throw new db[(_0x7f8d('0xd4'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x7f8d('0x1f')](function(_0x38802e){_0x241c17=_0x38802e;if(_0x241c17['id']){var _0x4a5e1d={'body':_0x241c17[_0x7f8d('0xd7')],'ChatWebsiteId':_0x26ebef['id'],'ChatInteractionId':_0x26c729['id'],'direction':_0x7f8d('0xd8'),'UserId':_0x1a7fad[_0x7f8d('0xa3')]['id']};return db[_0x7f8d('0xd9')][_0x7f8d('0xc6')](_0x4a5e1d,{});}else{throw new db[(_0x7f8d('0xd4'))][(_0x7f8d('0xd5'))](_0x7f8d('0xda'));}})[_0x7f8d('0x1f')](function(){return _0x26c729[_0x7f8d('0xdb')]({'vidaooSessionId':_0x241c17['id']});})[_0x7f8d('0x1f')](respondWithResult(_0x4969ed,null))[_0x7f8d('0x27')](handleError(_0x4969ed,null));};exports[_0x7f8d('0xdc')]=function(_0xf0a5b6,_0xa64681){if(_0xf0a5b6[_0x7f8d('0x39')]['id']){delete _0xf0a5b6['body']['id'];}return db[_0x7f8d('0x4b')]['find']({'where':{'id':_0xf0a5b6[_0x7f8d('0xc2')]['id']},'include':[{'model':db[_0x7f8d('0xdd')],'as':_0x7f8d('0xde')}]})[_0x7f8d('0x1f')](handleEntityNotFound(_0xa64681,null))[_0x7f8d('0x1f')](saveUpdates(_0xf0a5b6[_0x7f8d('0x39')],null))['then'](respondWithResult(_0xa64681,null))['catch'](handleError(_0xa64681,null));};exports[_0x7f8d('0xdf')]=function(_0x540060,_0x526137,_0x48a870){if(_0x540060[_0x7f8d('0x39')]['id']){delete _0x540060[_0x7f8d('0x39')]['id'];}return db[_0x7f8d('0x4b')][_0x7f8d('0x6f')]({'where':{'id':_0x540060[_0x7f8d('0xc2')]['id']}})[_0x7f8d('0x1f')](function(_0x4fab29){if(!_0x4fab29){logger[_0x7f8d('0x24')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x7f8d('0xdf'),0x194,_0x7f8d('0xe0'));_0x526137['sendStatus'](0x194);}else{if(_0x4fab29[_0x7f8d('0x46')]){throw new db[(_0x7f8d('0xd4'))][(_0x7f8d('0xd5'))](_0x7f8d('0xe1'));}}return _0x4fab29;})[_0x7f8d('0x1f')](function(_0xf254bd){if(_0xf254bd){return _0xf254bd[_0x7f8d('0x33')]({'closed':_0x540060['body'][_0x7f8d('0x45')],'disposition':_0x540060['body'][_0x7f8d('0x48')]})['then'](function(_0x5c16da){return _0x5c16da;});}})[_0x7f8d('0x1f')](function(_0x29e4b7){return respondWithRpcPromise('AbandonInteraction',_0x7f8d('0xdf'),_0x540060[_0x7f8d('0x39')],client9004);})[_0x7f8d('0x1f')](respondWithResult(_0x526137,null))[_0x7f8d('0x27')](handleError(_0x526137,null));};exports[_0x7f8d('0xe2')]=function(_0x43239a,_0x4393fe,_0x317da7){_0x43239a[_0x7f8d('0x39')][_0x7f8d('0x36')]=_0x43239a[_0x7f8d('0xe3')][_0x7f8d('0xe4')];_0x43239a[_0x7f8d('0x39')][_0x7f8d('0xe5')]=_0x43239a['file'][_0x7f8d('0xe6')];_0x43239a[_0x7f8d('0x39')]['type']=_0x43239a[_0x7f8d('0xe3')]['mimetype'];return db[_0x7f8d('0xe7')]['create'](_0x43239a[_0x7f8d('0x39')])['then'](respondWithResult(_0x4393fe,0xc9))[_0x7f8d('0x27')](handleError(_0x4393fe,null));};exports[_0x7f8d('0xe8')]=function(_0x549068,_0x499187,_0x59779b){return db[_0x7f8d('0x4b')][_0x7f8d('0xc9')]({'where':{'id':_0x549068[_0x7f8d('0xc2')]['id']},'raw':!![]})[_0x7f8d('0x1f')](handleEntityNotFound(_0x499187,null))[_0x7f8d('0x1f')](function(_0x4ced9a){if(_0x4ced9a){if(_0x4ced9a[_0x7f8d('0x45')]){return _0x499187[_0x7f8d('0x29')](0x193)[_0x7f8d('0x2a')]({'status':0x193,'message':_0x7f8d('0xe9')});}return db[_0x7f8d('0xe7')][_0x7f8d('0xc9')]({'where':{'id':_0x549068[_0x7f8d('0x50')][_0x7f8d('0xea')]},'raw':!![]})[_0x7f8d('0x1f')](handleEntityNotFound(_0x499187,null));}})['then'](function(_0x595c80){if(_0x595c80){var _0x33651e=_0x595c80[_0x7f8d('0xeb')]!==null;var _0xbf17f5=path[_0x7f8d('0xec')](config[_0x7f8d('0xed')],_0x7f8d('0xee'));if(_0x33651e){_0xbf17f5=path[_0x7f8d('0xec')](_0xbf17f5,_0x7f8d('0xef'));}var _0x5a90f2=path['join'](_0xbf17f5,_0x595c80[_0x7f8d('0xe5')]);return _0x499187[_0x7f8d('0xf0')](_0x5a90f2);}})[_0x7f8d('0x27')](handleError(_0x499187,null));};exports['close']=function(_0x443c0d,_0x2ebdaf){var _0x38cd99=null;var _0x3952dd=null;var _0x262fe2=null;var _0xb8f4fe=null;if(_0x443c0d[_0x7f8d('0x39')]['id']){delete _0x443c0d['body']['id'];}if(_0x443c0d[_0x7f8d('0x39')]['mailTranscript']){_0xb8f4fe=path[_0x7f8d('0xec')](config['root'],_0x7f8d('0xf1'),util[_0x7f8d('0xf2')](_0x7f8d('0xf3'),Date['now']()));_0x443c0d[_0x7f8d('0x39')][_0x7f8d('0xf4')]=_0xb8f4fe;}return db[_0x7f8d('0x4b')][_0x7f8d('0x6f')]({'where':{'id':_0x443c0d[_0x7f8d('0xc2')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0x7f8d('0x7f')],'as':_0x7f8d('0x7f')}]}]})[_0x7f8d('0x1f')](handleEntityNotFound(_0x2ebdaf,null))[_0x7f8d('0x1f')](saveUpdates(_0x443c0d[_0x7f8d('0x39')],null))[_0x7f8d('0x1f')](function(_0x27d7a9){if(_0x27d7a9){_0x38cd99=_0x27d7a9;return db[_0x7f8d('0xca')][_0x7f8d('0x6f')]({'where':{'id':_0x38cd99[_0x7f8d('0x85')]}});}})[_0x7f8d('0x1f')](function(_0x5d3dde){if(_0x5d3dde){_0x262fe2=_0x5d3dde;return db[_0x7f8d('0xdd')][_0x7f8d('0x6f')]({'where':{'id':_0x38cd99[_0x7f8d('0x78')]}});}})[_0x7f8d('0x1f')](function(_0x3096da){if(_0x3096da){_0x3952dd=_0x3096da;if(_0xb8f4fe){var _0x33780=null;for(var _0x1215a0=0x1;_0x1215a0<_0x38cd99['Messages'][_0x7f8d('0x57')];++_0x1215a0){_0x33780=_0x38cd99[_0x7f8d('0xf5')][_0x1215a0];var _0x1afe20=_0x33780[_0x7f8d('0x46')]?util[_0x7f8d('0xf2')](_0x7f8d('0xf6'),_0x262fe2[_0x7f8d('0xf7')],_0x33780[_0x7f8d('0x46')]):_0x7f8d('0xf8');var _0x2ceede=_0x443c0d['body']['customer']||util[_0x7f8d('0xf2')](_0x7f8d('0xf6'),_0x7f8d('0xf9'),_0x33780[_0x7f8d('0x78')]);switch(_0x262fe2[_0x7f8d('0xfa')]){case'website_alias':_0x1afe20=_0x33780[_0x7f8d('0x46')]?util[_0x7f8d('0xf2')](_0x7f8d('0xf6'),_0x262fe2[_0x7f8d('0xf7')],_0x33780[_0x7f8d('0x46')]):_0x7f8d('0xf8');break;case _0x7f8d('0xfb'):_0x1afe20=_0x33780[_0x7f8d('0x46')]?_0x33780[_0x7f8d('0x7f')][_0x7f8d('0xfc')]||_0x33780[_0x7f8d('0x7f')][_0x7f8d('0x3e')]:_0x7f8d('0xf8');break;case _0x7f8d('0xfd'):_0x1afe20=_0x33780[_0x7f8d('0x46')]?_0x33780[_0x7f8d('0x7f')][_0x7f8d('0x3e')]:_0x7f8d('0xf8');break;default:_0x1afe20=_0x33780[_0x7f8d('0x46')]?util[_0x7f8d('0xf2')](_0x7f8d('0xf6'),_0x262fe2['agentAlias'],_0x33780[_0x7f8d('0x46')]):_0x7f8d('0xf8');}var _0x238653=util[_0x7f8d('0xf2')](_0x7f8d('0xfe'),moment(_0x33780['createdAt'])[_0x7f8d('0xf2')](_0x7f8d('0xff')),_0x33780[_0x7f8d('0x100')]==='in'?_0x2ceede:_0x1afe20,_0x33780[_0x7f8d('0x39')]);if(!_0x33780[_0x7f8d('0x101')]){fs['appendFileSync'](_0xb8f4fe,_0x238653);}}return db[_0x7f8d('0x102')][_0x7f8d('0xc9')]({'where':{'service':!![]},'include':[{'model':db[_0x7f8d('0x103')],'as':_0x7f8d('0x104'),'raw':!![]}]});}}})[_0x7f8d('0x1f')](function(_0x516555){if(_0x516555&&_0x516555[_0x7f8d('0x104')]&&_0x443c0d[_0x7f8d('0x39')]){var _0x11c99d={'tls':{'rejectUnauthorized':![]}};if(_0x516555[_0x7f8d('0x104')]['service']){_0x11c99d['service']=_0x516555['Smtp'][_0x7f8d('0x105')];}else{_0x11c99d['host']=_0x516555[_0x7f8d('0x104')]['host'];_0x11c99d[_0x7f8d('0x106')]=_0x516555[_0x7f8d('0x104')][_0x7f8d('0x106')];_0x11c99d[_0x7f8d('0x107')]=_0x516555[_0x7f8d('0x104')][_0x7f8d('0x107')];}if(_0x516555[_0x7f8d('0x104')]['authentication']){_0x11c99d['auth']={'user':_0x516555[_0x7f8d('0x104')]['user'],'pass':_0x516555[_0x7f8d('0x104')][_0x7f8d('0x108')]};}return respondWithRpcPromise(_0x7f8d('0x109'),_0x7f8d('0x10a'),{'account':_0x11c99d,'message':{'from':util[_0x7f8d('0xf2')]('\x22%s\x22\x20<%s>',_0x516555[_0x7f8d('0x36')],_0x516555[_0x7f8d('0xcf')]||_0x516555[_0x7f8d('0x104')][_0x7f8d('0xa3')]),'to':_0x443c0d[_0x7f8d('0x39')][_0x7f8d('0x10b')],'subject':_0x7f8d('0x10c'),'text':util[_0x7f8d('0xf2')](_0x7f8d('0x10d'),_0x443c0d['body'][_0x7f8d('0x10b')]),'attachments':[{'path':_0xb8f4fe}]}})[_0x7f8d('0x1f')](function(){return _0x38cd99;})[_0x7f8d('0x27')](function(_0x1c5c0a){console[_0x7f8d('0x24')](_0x1c5c0a);});}else{return _0x38cd99;}})[_0x7f8d('0x1f')](respondWithStatusCode(_0x2ebdaf,0xc8))['catch'](handleError(_0x2ebdaf,null));};exports[_0x7f8d('0x10e')]=function(_0x23e7ac,_0x290665,_0x4dec81){return db['ChatMessage'][_0x7f8d('0x6f')]({'where':{'id':_0x23e7ac['params']['id']}})[_0x7f8d('0x1f')](handleEntityNotFound(_0x290665,null))[_0x7f8d('0x1f')](function(_0x815e92){if(_0x815e92){return _0x815e92[_0x7f8d('0x10e')](_0x23e7ac['body'][_0x7f8d('0x10f')],_[_0x7f8d('0x110')](_0x23e7ac[_0x7f8d('0x39')],[_0x7f8d('0x10f'),'id'])||{});}})[_0x7f8d('0x1f')](respondWithResult(_0x290665,null))[_0x7f8d('0x27')](handleError(_0x290665,null));};exports[_0x7f8d('0x111')]=function(_0x18749c,_0x191ebb,_0x4a5341){var _0x4e3d61={'raw':![],'where':{}};var _0x157d09={};var _0x51946f={'count':0x0,'rows':[]};return db[_0x7f8d('0x4b')]['findOne']({'where':{'id':_0x18749c[_0x7f8d('0xc2')]['id']}})[_0x7f8d('0x1f')](handleEntityNotFound(_0x191ebb,null))[_0x7f8d('0x1f')](function(_0x1c7aa2){if(_0x1c7aa2){_0x157d09[_0x7f8d('0x54')]=_[_0x7f8d('0x51')](db['ChatMessage'][_0x7f8d('0x4c')]);_0x157d09[_0x7f8d('0x50')]=_[_0x7f8d('0x51')](_0x18749c['query']);_0x157d09[_0x7f8d('0x52')]=_[_0x7f8d('0x53')](_0x157d09[_0x7f8d('0x54')],_0x157d09[_0x7f8d('0x50')]);_0x4e3d61[_0x7f8d('0x55')]=_[_0x7f8d('0x53')](_0x157d09['model'],qs[_0x7f8d('0x56')](_0x18749c['query'][_0x7f8d('0x56')]));_0x4e3d61['attributes']=_0x4e3d61['attributes'][_0x7f8d('0x57')]?_0x4e3d61[_0x7f8d('0x55')]:_0x157d09[_0x7f8d('0x54')];if(!_0x18749c['query'][_0x7f8d('0x112')](_0x7f8d('0x113'))){_0x4e3d61[_0x7f8d('0x2c')]=qs[_0x7f8d('0x2c')](_0x18749c['query'][_0x7f8d('0x2c')]);_0x4e3d61[_0x7f8d('0x2b')]=qs[_0x7f8d('0x2b')](_0x18749c['query'][_0x7f8d('0x2b')]);}_0x4e3d61['order']=qs[_0x7f8d('0x59')](_0x18749c[_0x7f8d('0x50')][_0x7f8d('0x59')]);_0x4e3d61[_0x7f8d('0x86')]=qs[_0x7f8d('0x52')](_['pick'](_0x18749c[_0x7f8d('0x50')],_0x157d09[_0x7f8d('0x52')]));_0x4e3d61[_0x7f8d('0x86')][_0x7f8d('0xbe')]=_0x1c7aa2['id'];if(_0x18749c[_0x7f8d('0x50')][_0x7f8d('0x94')]){_0x4e3d61['where']=_['merge'](_0x4e3d61['where'],{'$or':_['map'](_0x4e3d61[_0x7f8d('0x55')],function(_0x1d308a){var _0x1609b7={};_0x1609b7[_0x1d308a]={'$like':'%'+_0x18749c[_0x7f8d('0x50')]['filter']+'%'};return _0x1609b7;})});}if(_0x18749c[_0x7f8d('0x50')][_0x7f8d('0x8a')]){var _0xe54cb0=_0x18749c[_0x7f8d('0x50')][_0x7f8d('0x8a')][_0x7f8d('0x75')](',');var _0x428e7e={};_0x428e7e[_0xe54cb0[0x0]]={'$gte':moment(_0xe54cb0[0x1])[_0x7f8d('0xf2')](_0x7f8d('0x114'))};_0x4e3d61[_0x7f8d('0x86')]=_[_0x7f8d('0x38')](_0x4e3d61[_0x7f8d('0x86')],_0x428e7e);}_0x4e3d61=_['merge']({},_0x4e3d61,_0x18749c['options']);return db[_0x7f8d('0xd9')][_0x7f8d('0x2e')]({'where':_0x4e3d61[_0x7f8d('0x86')]})[_0x7f8d('0x1f')](function(_0x3d5f62){_0x51946f[_0x7f8d('0x2e')]=_0x3d5f62;if(_0x18749c[_0x7f8d('0x50')][_0x7f8d('0xc3')]){_0x4e3d61['include']=[{'all':!![]}];}return db['ChatMessage'][_0x7f8d('0x115')](_0x4e3d61);})[_0x7f8d('0x1f')](function(_0xfb0671){_0x51946f['rows']=_0xfb0671;return _0x51946f;});}})[_0x7f8d('0x1f')](respondWithFilteredResult(_0x191ebb,_0x4e3d61))[_0x7f8d('0x27')](handleError(_0x191ebb,null));};exports[_0x7f8d('0x116')]=function(_0x8769b,_0x44b69e,_0x5b4b07){var _0x3581f0={'where':{}},_0x378559={},_0x4a5129={'count':0x0,'rows':[]};return db[_0x7f8d('0x4b')]['findOne']({'where':{'id':_0x8769b['params']['id']}})['then'](handleEntityNotFound(_0x44b69e,null))[_0x7f8d('0x1f')](function(_0xee7d1b){if(_0xee7d1b){_0x378559[_0x7f8d('0x54')]=_[_0x7f8d('0x51')](db['ChatMessage']['rawAttributes']);_0x378559[_0x7f8d('0x50')]=_['keys'](_0x8769b[_0x7f8d('0x50')]);_0x378559[_0x7f8d('0x52')]=_[_0x7f8d('0x53')](_0x378559['model'],_0x378559[_0x7f8d('0x50')]);_0x3581f0[_0x7f8d('0x55')]=_[_0x7f8d('0x53')](_0x378559[_0x7f8d('0x54')],qs[_0x7f8d('0x56')](_0x8769b[_0x7f8d('0x50')][_0x7f8d('0x56')]));_0x3581f0[_0x7f8d('0x55')]=_0x3581f0[_0x7f8d('0x55')]['length']?_0x3581f0[_0x7f8d('0x55')]:_0x378559[_0x7f8d('0x54')];if(!_0x8769b[_0x7f8d('0x50')][_0x7f8d('0x112')](_0x7f8d('0x113'))){_0x3581f0[_0x7f8d('0x2c')]=qs[_0x7f8d('0x2c')](_0x8769b[_0x7f8d('0x50')]['limit']);_0x3581f0['offset']=qs['offset'](_0x8769b['query']['offset']);}_0x3581f0[_0x7f8d('0x58')]=qs['sort'](_0x8769b[_0x7f8d('0x50')]['sort']);_0x3581f0[_0x7f8d('0x86')]=qs[_0x7f8d('0x52')](_[_0x7f8d('0x5a')](_0x8769b['query'],_0x378559[_0x7f8d('0x52')]));_0x3581f0[_0x7f8d('0x86')]['ChatInteractionId']=_0xee7d1b['id'];if(_0x8769b[_0x7f8d('0x50')]['filter']){_0x3581f0[_0x7f8d('0x86')]=_[_0x7f8d('0x38')](_0x3581f0[_0x7f8d('0x86')],{'$or':_[_0x7f8d('0x3d')](_0x3581f0[_0x7f8d('0x55')],function(_0x3bcb0c){var _0x35cb73={};_0x35cb73[_0x3bcb0c]={'$like':'%'+_0x8769b['query'][_0x7f8d('0x94')]+'%'};return _0x35cb73;})});}_0x3581f0[_0x7f8d('0x86')][_0x7f8d('0x101')]=![];if(_0x8769b[_0x7f8d('0x50')]['id']){_0x3581f0['where']['id']={'$gt':_0x8769b[_0x7f8d('0x50')]['id']};}_0x3581f0=_[_0x7f8d('0x38')]({},_0x3581f0,_0x8769b['options']);return db[_0x7f8d('0xd9')][_0x7f8d('0x2e')]({'where':_0x3581f0[_0x7f8d('0x86')]})['then'](function(_0x363cdc){_0x4a5129['count']=_0x363cdc;_0x3581f0[_0x7f8d('0xc4')]=[];if(_0x8769b[_0x7f8d('0x50')][_0x7f8d('0x117')]){_0x3581f0[_0x7f8d('0xc4')][_0x7f8d('0xbf')]({'model':db[_0x7f8d('0x7f')],'as':_0x7f8d('0x7f'),'attributes':['id','fullname',_0x7f8d('0xfc')]});}if(_0x8769b[_0x7f8d('0x50')]['includeAll']){_0x3581f0[_0x7f8d('0xc4')]=[{'all':!![]}];}return db[_0x7f8d('0xd9')][_0x7f8d('0x115')](_0x3581f0);})[_0x7f8d('0x1f')](function(_0x267d87){_0x4a5129['rows']=_0x267d87;return _0x4a5129;});}})[_0x7f8d('0x1f')](respondWithFilteredResult(_0x44b69e,_0x3581f0))[_0x7f8d('0x27')](handleError(_0x44b69e,null));};exports[_0x7f8d('0x118')]=function(_0xc51050,_0x23c015,_0x2cce95){return db[_0x7f8d('0x4b')]['find']({'where':{'id':_0xc51050['params']['id']}})[_0x7f8d('0x1f')](handleEntityNotFound(_0x23c015,null))[_0x7f8d('0x1f')](function(_0x4c49f5){if(_0x4c49f5){return _0x4c49f5[_0x7f8d('0x119')](_0xc51050[_0x7f8d('0x39')][_0x7f8d('0x10f')],_[_0x7f8d('0x110')](_0xc51050[_0x7f8d('0x39')],[_0x7f8d('0x10f'),'id'])||{})[_0x7f8d('0x11a')](function(){return db[_0x7f8d('0x7b')][_0x7f8d('0x115')]({'attributes':['id','name',_0x7f8d('0x5d')],'where':{'id':_0xc51050[_0x7f8d('0x39')][_0x7f8d('0x10f')]}});})['then'](function(_0x1f74cc){socket['emit']('chatInteractionTags:save',{'id':Number(_0xc51050['params']['id']),'tags':_0x1f74cc||[]});return{'id':Number(_0xc51050[_0x7f8d('0xc2')]['id']),'tags':_0x1f74cc||[]};});}})['then'](respondWithResult(_0x23c015,null))[_0x7f8d('0x27')](handleError(_0x23c015,null));};exports[_0x7f8d('0x11b')]=function(_0x250350,_0x15d0bf,_0x279d33){return db[_0x7f8d('0x4b')][_0x7f8d('0x6f')]({'where':{'id':_0x250350[_0x7f8d('0xc2')]['id']}})[_0x7f8d('0x1f')](handleEntityNotFound(_0x15d0bf,null))[_0x7f8d('0x1f')](function(_0x41260d){if(_0x41260d){return _0x41260d[_0x7f8d('0x11b')](_0x250350[_0x7f8d('0x50')]['ids']);}})[_0x7f8d('0x1f')](respondWithStatusCode(_0x15d0bf,null))[_0x7f8d('0x27')](handleError(_0x15d0bf,null));};exports[_0x7f8d('0xf0')]=function(_0x35bee1,_0x474f5a){var _0x28a0cf=moment()['unix']()['toString']();var _0x3ad8c3=path[_0x7f8d('0xec')](config[_0x7f8d('0xed')],_0x7f8d('0x11c'),_0x7f8d('0x11d'),'tmp');var _0x23485a=path[_0x7f8d('0xec')](config[_0x7f8d('0xed')],_0x7f8d('0x11c'),_0x7f8d('0x11d'),'attachments');var _0x67dfeb=path['join'](_0x3ad8c3,_0x28a0cf);var _0x53c7ea=util[_0x7f8d('0xf2')](_0x7f8d('0x11e'),_0x35bee1['params']['id'],_0x28a0cf);var _0x451ebb=path[_0x7f8d('0xec')](_0x3ad8c3,_0x53c7ea);var _0x162da0=[];_0x162da0[_0x7f8d('0xbf')]({'model':db['User'],'as':'User','attributes':['id',_0x7f8d('0x3e')],'raw':!![]});_0x162da0[_0x7f8d('0xbf')]({'model':db['CmContact'],'as':_0x7f8d('0xde'),'attributes':['id',_0x7f8d('0x11f'),_0x7f8d('0x120')],'raw':!![]});if(_0x35bee1[_0x7f8d('0x50')][_0x7f8d('0x121')]){_0x162da0[_0x7f8d('0xbf')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x5912b9=[{'model':db[_0x7f8d('0xd9')],'as':_0x7f8d('0xf5'),'attributes':['id',_0x7f8d('0x39'),_0x7f8d('0x88'),_0x7f8d('0x100'),_0x7f8d('0x101'),_0x7f8d('0x90')],'include':_0x162da0}];_0x5912b9[_0x7f8d('0xbf')]({'model':db[_0x7f8d('0xca')],'as':_0x7f8d('0x122'),'attributes':['id',_0x7f8d('0x36')]});_0x5912b9['push']({'model':db['User'],'as':_0x7f8d('0x123'),'attributes':['id','fullname']});return db[_0x7f8d('0x4b')][_0x7f8d('0x6f')]({'where':{'id':_0x35bee1[_0x7f8d('0xc2')]['id']},'include':_0x5912b9})[_0x7f8d('0x1f')](handleEntityNotFound(_0x474f5a,null))[_0x7f8d('0x1f')](function(_0x4b3035){if(_0x4b3035){var _0x2bc609=_0x4b3035[_0x7f8d('0x124')]({'plain':!![]});fs[_0x7f8d('0x125')](_0x67dfeb);var _0x222903={'channel':_0x7f8d('0x126'),'account':_0x2bc609[_0x7f8d('0x122')][_0x7f8d('0x36')],'agent':_0x2bc609['Owner']?_0x2bc609['Owner'][_0x7f8d('0x3e')]:_0x7f8d('0x127'),'createdAt':moment(_0x2bc609[_0x7f8d('0x88')])['format'](_0x7f8d('0x114'))[_0x7f8d('0xa9')](),'closedAt':_0x2bc609[_0x7f8d('0x45')]?moment(_0x2bc609[_0x7f8d('0x128')])[_0x7f8d('0xf2')](_0x7f8d('0x114'))['toString']():'','disposition':_0x2bc609[_0x7f8d('0x48')],'chatInfo':{'browser':_0x2bc609[_0x7f8d('0x129')],'os':_0x2bc609[_0x7f8d('0x12a')],'referer':_0x2bc609['referer'],'customerIp':_0x2bc609['customerIp'],'customerPort':_0x2bc609[_0x7f8d('0x12b')]?_0x2bc609['customerPort']:_0x7f8d('0x127')},'messages':_(_0x2bc609[_0x7f8d('0xf5')])[_0x7f8d('0x12c')]()[_0x7f8d('0x94')]({'secret':![]})[_0x7f8d('0x3d')](function(_0x3b625b){if(_0x3b625b[_0x7f8d('0xe7')]){var _0x289a35=path[_0x7f8d('0xec')](_0x23485a,_0x3b625b[_0x7f8d('0xe7')]['basename']);if(fs[_0x7f8d('0x12d')](_0x289a35)){fs['createReadStream'](_0x289a35)[_0x7f8d('0x12e')](fs[_0x7f8d('0x12f')](path[_0x7f8d('0xec')](_0x67dfeb,_0x3b625b[_0x7f8d('0xe7')][_0x7f8d('0xe5')])));}}return{'date':moment(_0x3b625b[_0x7f8d('0x88')])['format'](_0x7f8d('0x114'))[_0x7f8d('0xa9')](),'sender':_0x3b625b[_0x7f8d('0x100')]===_0x7f8d('0xd8')?_0x3b625b['User']?_0x3b625b[_0x7f8d('0x7f')][_0x7f8d('0x3e')]:_0x7f8d('0xf8'):_0x3b625b[_0x7f8d('0xde')][_0x7f8d('0x11f')]+(_0x3b625b[_0x7f8d('0xde')][_0x7f8d('0x120')]?'\x20'+_0x3b625b[_0x7f8d('0xde')][_0x7f8d('0x120')]:''),'body':_0x3b625b[_0x7f8d('0xe7')]?_0x3b625b[_0x7f8d('0xe7')]['basename']:_0x3b625b[_0x7f8d('0x39')],'direction':_0x3b625b['direction']==='out'?'A':'C','secret':_0x3b625b[_0x7f8d('0x101')],'read':_0x3b625b['read'],'attachment':_0x3b625b[_0x7f8d('0xe7')]};})['value']()};return ejs[_0x7f8d('0x130')](path['join'](config[_0x7f8d('0xed')],'server','views',_0x7f8d('0x131')),{'interaction':_0x222903})[_0x7f8d('0x1f')](function(_0x179b51){var _0x5472b8=path['join'](_0x67dfeb,'transcript-'+_0x2bc609['id']+'-'+_0x28a0cf+_0x7f8d('0x132'));var _0x46668e={'path':_0x5472b8,'channel':_0x7f8d('0x126'),'interactionId':_0x2bc609['id']};return pdf[_0x7f8d('0x133')](_0x179b51,_0x46668e);})[_0x7f8d('0x1f')](function(){return new BPromise(function(_0x24624f,_0x359742){zipdir(_0x67dfeb,{'saveTo':_0x451ebb},function(_0x1cb3af,_0x83f4f){if(_0x1cb3af)return _0x359742(_0x1cb3af);return _0x24624f(_0x83f4f);});})['then'](function(){return new BPromise(function(_0xf1d89b,_0x1679d9){rimraf(_0x67dfeb,function(_0x20d869){if(_0x20d869)_0x1679d9(_0x20d869);return _0xf1d89b();});});})['then'](function(){return _0x474f5a['download'](_0x451ebb,_0x53c7ea,function(_0x20c29a){if(_0x20c29a){console[_0x7f8d('0x134')](_0x7f8d('0x135'),_0x20c29a);}else{fs['unlinkSync'](_0x451ebb);}});});});}else{return _0x474f5a[_0x7f8d('0x28')](0xc8);}})[_0x7f8d('0x27')](handleError(_0x474f5a,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index b03da76..7dccb10 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 _0x437a=['then','setDataValue','Users','map','length','emit','catch','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','getUsers'];(function(_0x34de7a,_0x57d22c){var _0xd1c14=function(_0x20c909){while(--_0x20c909){_0x34de7a['push'](_0x34de7a['shift']());}};_0xd1c14(++_0x57d22c);}(_0x437a,0xc4));var _0xa437=function(_0x245217,_0x2083a1){_0x245217=_0x245217-0x0;var _0x3e53fe=_0x437a[_0x245217];return _0x3e53fe;};'use strict';var EventEmitter=require(_0xa437('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xa437('0x1')];var ChatMessage=require(_0xa437('0x2'))['db'][_0xa437('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xa437('0x4')](0x0);var events={'afterCreate':_0xa437('0x5'),'afterUpdate':_0xa437('0x6'),'afterDestroy':'remove'};function emitEvent(_0xeb98ef){return function(_0x482c4c,_0x3596fc,_0x413fb8){_0x482c4c[_0xa437('0x7')]({'attributes':['id'],'raw':!![]})[_0xa437('0x8')](function(_0x541c0f){_0x482c4c[_0xa437('0x9')](_0xa437('0xa'),_0x541c0f[_0xa437('0xb')](function(_0x51bc6b){return{'id':_0x51bc6b['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x482c4c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa437('0x8')](function(_0xdb3a35){_0x482c4c['setDataValue']('unreadMessages',_0xdb3a35[_0xa437('0xc')]);ChatInteractionEvents[_0xa437('0xd')](_0xeb98ef+':'+_0x482c4c['id'],_0x482c4c);ChatInteractionEvents[_0xa437('0xd')](_0xeb98ef,_0x482c4c);_0x413fb8(null);})[_0xa437('0xe')](_0x413fb8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xa437('0xf')](e,emitEvent(event));}}module[_0xa437('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x1637=['unreadMessages','length','emit','catch','hook','exports','events','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x530c53,_0x546020){var _0x5408ca=function(_0x1de646){while(--_0x1de646){_0x530c53['push'](_0x530c53['shift']());}};_0x5408ca(++_0x546020);}(_0x1637,0x136));var _0x7163=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0x1637[_0x16db8b];return _0x5ba017;};'use strict';var EventEmitter=require(_0x7163('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x7163('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x7163('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x7163('0x3')](0x0);var events={'afterCreate':_0x7163('0x4'),'afterUpdate':_0x7163('0x5'),'afterDestroy':_0x7163('0x6')};function emitEvent(_0xcdb4f4){return function(_0x24f9fa,_0x1539db,_0x34330d){_0x24f9fa[_0x7163('0x7')]({'attributes':['id'],'raw':!![]})[_0x7163('0x8')](function(_0x4336ad){_0x24f9fa[_0x7163('0x9')](_0x7163('0xa'),_0x4336ad[_0x7163('0xb')](function(_0x1a59b9){return{'id':_0x1a59b9['id']};}));return ChatMessage[_0x7163('0xc')]({'where':{'ChatInteractionId':_0x24f9fa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7163('0x8')](function(_0x421c21){_0x24f9fa[_0x7163('0x9')](_0x7163('0xd'),_0x421c21[_0x7163('0xe')]);ChatInteractionEvents[_0x7163('0xf')](_0xcdb4f4+':'+_0x24f9fa['id'],_0x24f9fa);ChatInteractionEvents[_0x7163('0xf')](_0xcdb4f4,_0x24f9fa);_0x34330d(null);})[_0x7163('0x10')](_0x34330d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x7163('0x11')](e,emitEvent(event));}}module[_0x7163('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 9bebe61..8cf066d 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 _0x0fa8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','../../config/logger','api'];(function(_0x24085c,_0x5c9f94){var _0x4c55d1=function(_0x590b33){while(--_0x590b33){_0x24085c['push'](_0x24085c['shift']());}};_0x4c55d1(++_0x5c9f94);}(_0x0fa8,0xe1));var _0x80fa=function(_0x572eea,_0x853014){_0x572eea=_0x572eea-0x0;var _0x3c8359=_0x0fa8[_0x572eea];return _0x3c8359;};'use strict';var _=require(_0x80fa('0x0'));var util=require('util');var logger=require(_0x80fa('0x1'))(_0x80fa('0x2'));var moment=require(_0x80fa('0x3'));var BPromise=require(_0x80fa('0x4'));var rp=require(_0x80fa('0x5'));var fs=require('fs');var path=require(_0x80fa('0x6'));var rimraf=require(_0x80fa('0x7'));var config=require(_0x80fa('0x8'));var attributes=require(_0x80fa('0x9'));module['exports']=function(_0x45275b,_0x2485eb){return _0x45275b[_0x80fa('0xa')](_0x80fa('0xb'),attributes,{'tableName':_0x80fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x38f568,_0x2be7c9,_0x77396b){if(_0x38f568[_0x80fa('0xd')](_0x80fa('0xe'))){_0x38f568[_0x80fa('0xf')]=moment()[_0x80fa('0x10')](_0x80fa('0x11'));}_0x77396b(null,_0x38f568);}},'charset':_0x80fa('0x12'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8a5d=['closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','util','../../config/logger','moment','path','rimraf','../../config/environment','exports','ChatInteraction','changed'];(function(_0x3b2ea8,_0x352270){var _0x4995da=function(_0x28417a){while(--_0x28417a){_0x3b2ea8['push'](_0x3b2ea8['shift']());}};_0x4995da(++_0x352270);}(_0x8a5d,0x163));var _0xd8a5=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0x8a5d[_0x2ab365];return _0x49fef3;};'use strict';var _=require('lodash');var util=require(_0xd8a5('0x0'));var logger=require(_0xd8a5('0x1'))('api');var moment=require(_0xd8a5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8a5('0x3'));var rimraf=require(_0xd8a5('0x4'));var config=require(_0xd8a5('0x5'));var attributes=require('./chatInteraction.attributes');module[_0xd8a5('0x6')]=function(_0x5b6112,_0x3d1b5b){return _0x5b6112['define'](_0xd8a5('0x7'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x393cfa,_0x11a8b1,_0x4eb9fa){if(_0x393cfa[_0xd8a5('0x8')](_0xd8a5('0x9'))){_0x393cfa['closedAt']=moment()[_0xd8a5('0xa')](_0xd8a5('0xb'));}_0x4eb9fa(null,_0x393cfa);}},'charset':'utf8mb4','collate':_0xd8a5('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index ea4353a..7ec4237 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 _0xa837=['ChatInteraction','find','addTags','omit','ids','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','catch','UpdateChatInteraction','body','options','raw','where','limit','then'];(function(_0x1a00cc,_0x52dab8){var _0x772e9=function(_0x5bad1d){while(--_0x5bad1d){_0x1a00cc['push'](_0x1a00cc['shift']());}};_0x772e9(++_0x52dab8);}(_0xa837,0xdf));var _0x7a83=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa837[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7a83('0x0'));var util=require(_0x7a83('0x1'));var moment=require(_0x7a83('0x2'));var BPromise=require(_0x7a83('0x3'));var rs=require(_0x7a83('0x4'));var fs=require('fs');var Redis=require(_0x7a83('0x5'));var db=require(_0x7a83('0x6'))['db'];var utils=require(_0x7a83('0x7'));var logger=require(_0x7a83('0x8'))(_0x7a83('0x9'));var config=require(_0x7a83('0xa'));var jayson=require(_0x7a83('0xb'));var client=jayson[_0x7a83('0xc')][_0x7a83('0xd')]({'port':0x232a});config[_0x7a83('0xe')]=_[_0x7a83('0xf')](config[_0x7a83('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x7a83('0x10'))(new Redis(config[_0x7a83('0xe')]));require(_0x7a83('0x11'))[_0x7a83('0x12')](socket);function respondWithRpcPromise(_0x1d5d9d,_0x21e84d,_0x1e4afb){return new BPromise(function(_0x57b5f7,_0x34a093){return client[_0x7a83('0x13')](_0x1d5d9d,_0x1e4afb)['then'](function(_0x1395a1){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x21e84d,_0x7a83('0x14'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x21e84d,_0x7a83('0x14'),JSON[_0x7a83('0x15')](_0x1395a1));if(_0x1395a1[_0x7a83('0x16')]){if(_0x1395a1[_0x7a83('0x16')][_0x7a83('0x17')]===0x1f4){logger[_0x7a83('0x16')](_0x7a83('0x18'),_0x21e84d,_0x1395a1[_0x7a83('0x16')]['message']);return _0x34a093(_0x1395a1[_0x7a83('0x16')][_0x7a83('0x19')]);}logger[_0x7a83('0x16')](_0x7a83('0x18'),_0x21e84d,_0x1395a1[_0x7a83('0x16')][_0x7a83('0x19')]);return _0x57b5f7(_0x1395a1[_0x7a83('0x16')][_0x7a83('0x19')]);}else{logger[_0x7a83('0x1a')](_0x7a83('0x18'),_0x21e84d,'request\x20sent');_0x57b5f7(_0x1395a1['result'][_0x7a83('0x19')]);}})[_0x7a83('0x1b')](function(_0x51193c){logger[_0x7a83('0x16')](_0x7a83('0x18'),_0x21e84d,_0x51193c);_0x34a093(_0x51193c);});});}exports[_0x7a83('0x1c')]=function(_0x143574){var _0x5a9d02=this;return new Promise(function(_0x4f5784,_0xd606e1){return db['ChatInteraction']['update'](_0x143574[_0x7a83('0x1d')],{'raw':_0x143574[_0x7a83('0x1e')]?_0x143574[_0x7a83('0x1e')][_0x7a83('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x143574['options']?_0x143574[_0x7a83('0x1e')][_0x7a83('0x20')]||null:null,'attributes':_0x143574[_0x7a83('0x1e')]?_0x143574[_0x7a83('0x1e')]['attributes']||null:null,'limit':_0x143574[_0x7a83('0x1e')]?_0x143574[_0x7a83('0x1e')][_0x7a83('0x21')]||null:null})[_0x7a83('0x22')](function(_0x56c91b){logger[_0x7a83('0x1a')](_0x7a83('0x1c'),_0x143574);logger['debug'](_0x7a83('0x1c'),_0x143574,JSON['stringify'](_0x56c91b));_0x4f5784(_0x56c91b);})[_0x7a83('0x1b')](function(_0x21a2fb){logger[_0x7a83('0x16')](_0x7a83('0x1c'),_0x21a2fb[_0x7a83('0x19')],_0x143574);_0xd606e1(_0x5a9d02[_0x7a83('0x16')](0x1f4,_0x21a2fb[_0x7a83('0x19')]));});});};exports['AddTagsToChatInteraction']=function(_0x3647ef){return new Promise(function(_0x558a48,_0x173fd9){return db[_0x7a83('0x23')][_0x7a83('0x24')]({'where':_0x3647ef['options']?_0x3647ef[_0x7a83('0x1e')][_0x7a83('0x20')]||null:null})[_0x7a83('0x22')](function(_0x1acd4a){if(_0x1acd4a){return _0x1acd4a[_0x7a83('0x25')](_0x3647ef[_0x7a83('0x1d')]['ids'],_[_0x7a83('0x26')](_0x3647ef[_0x7a83('0x1d')],[_0x7a83('0x27'),'id'])||{});}})[_0x7a83('0x28')](function(_0x5b3183){logger[_0x7a83('0x1a')](_0x7a83('0x29'),_0x3647ef);logger[_0x7a83('0x2a')](_0x7a83('0x29'),_0x3647ef,JSON[_0x7a83('0x15')](_0x5b3183));_0x558a48(_0x5b3183);})[_0x7a83('0x1b')](function(_0x347bbf){logger[_0x7a83('0x16')](_0x7a83('0x29'),_0x347bbf[_0x7a83('0x19')],_0x3647ef);_0x173fd9(_this[_0x7a83('0x16')](0x1f4,_0x347bbf[_0x7a83('0x19')]));});});}; \ No newline at end of file +var _0x8ec8=['ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./chatInteraction.socket','request','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','then','AddTagsToChatInteraction','addTags'];(function(_0x43941d,_0x45fd0d){var _0x27b82a=function(_0x21851e){while(--_0x21851e){_0x43941d['push'](_0x43941d['shift']());}};_0x27b82a(++_0x45fd0d);}(_0x8ec8,0xa8));var _0x88ec=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8ec8[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x88ec('0x0'));var util=require(_0x88ec('0x1'));var moment=require(_0x88ec('0x2'));var BPromise=require(_0x88ec('0x3'));var rs=require(_0x88ec('0x4'));var fs=require('fs');var Redis=require(_0x88ec('0x5'));var db=require(_0x88ec('0x6'))['db'];var utils=require(_0x88ec('0x7'));var logger=require(_0x88ec('0x8'))('rpc');var config=require(_0x88ec('0x9'));var jayson=require(_0x88ec('0xa'));var client=jayson['client'][_0x88ec('0xb')]({'port':0x232a});config[_0x88ec('0xc')]=_[_0x88ec('0xd')](config[_0x88ec('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88ec('0xc')]));require(_0x88ec('0xe'))['register'](socket);function respondWithRpcPromise(_0x396527,_0x5791b8,_0x2ebe6b){return new BPromise(function(_0x49824c,_0x43a374){return client[_0x88ec('0xf')](_0x396527,_0x2ebe6b)['then'](function(_0x4f4437){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5791b8,_0x88ec('0x10'));logger[_0x88ec('0x11')](_0x88ec('0x12'),_0x5791b8,_0x88ec('0x10'),JSON[_0x88ec('0x13')](_0x4f4437));if(_0x4f4437[_0x88ec('0x14')]){if(_0x4f4437[_0x88ec('0x14')][_0x88ec('0x15')]===0x1f4){logger[_0x88ec('0x14')](_0x88ec('0x16'),_0x5791b8,_0x4f4437['error'][_0x88ec('0x17')]);return _0x43a374(_0x4f4437[_0x88ec('0x14')][_0x88ec('0x17')]);}logger[_0x88ec('0x14')](_0x88ec('0x16'),_0x5791b8,_0x4f4437['error'][_0x88ec('0x17')]);return _0x49824c(_0x4f4437['error']['message']);}else{logger[_0x88ec('0x18')](_0x88ec('0x16'),_0x5791b8,_0x88ec('0x10'));_0x49824c(_0x4f4437[_0x88ec('0x19')][_0x88ec('0x17')]);}})[_0x88ec('0x1a')](function(_0x335b66){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5791b8,_0x335b66);_0x43a374(_0x335b66);});});}exports[_0x88ec('0x1b')]=function(_0x68fd8a){var _0x251a88=this;return new Promise(function(_0x285280,_0x1c0d8e){return db[_0x88ec('0x1c')][_0x88ec('0x1d')](_0x68fd8a[_0x88ec('0x1e')],{'raw':_0x68fd8a[_0x88ec('0x1f')]?_0x68fd8a[_0x88ec('0x1f')][_0x88ec('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x68fd8a[_0x88ec('0x1f')]?_0x68fd8a[_0x88ec('0x1f')][_0x88ec('0x21')]||null:null,'attributes':_0x68fd8a[_0x88ec('0x1f')]?_0x68fd8a[_0x88ec('0x1f')]['attributes']||null:null,'limit':_0x68fd8a[_0x88ec('0x1f')]?_0x68fd8a[_0x88ec('0x1f')]['limit']||null:null})[_0x88ec('0x22')](function(_0x2f9001){logger[_0x88ec('0x18')](_0x88ec('0x1b'),_0x68fd8a);logger[_0x88ec('0x11')](_0x88ec('0x1b'),_0x68fd8a,JSON[_0x88ec('0x13')](_0x2f9001));_0x285280(_0x2f9001);})[_0x88ec('0x1a')](function(_0x206d84){logger[_0x88ec('0x14')]('UpdateChatInteraction',_0x206d84['message'],_0x68fd8a);_0x1c0d8e(_0x251a88[_0x88ec('0x14')](0x1f4,_0x206d84['message']));});});};exports[_0x88ec('0x23')]=function(_0x235d76){return new Promise(function(_0x1346e2,_0x293a19){return db[_0x88ec('0x1c')]['find']({'where':_0x235d76[_0x88ec('0x1f')]?_0x235d76[_0x88ec('0x1f')][_0x88ec('0x21')]||null:null})[_0x88ec('0x22')](function(_0x51fdf1){if(_0x51fdf1){return _0x51fdf1[_0x88ec('0x24')](_0x235d76[_0x88ec('0x1e')][_0x88ec('0x25')],_[_0x88ec('0x26')](_0x235d76[_0x88ec('0x1e')],[_0x88ec('0x25'),'id'])||{});}})[_0x88ec('0x27')](function(_0x5194d0){logger[_0x88ec('0x18')](_0x88ec('0x28'),_0x235d76);logger[_0x88ec('0x11')](_0x88ec('0x28'),_0x235d76,JSON[_0x88ec('0x13')](_0x5194d0));_0x1346e2(_0x5194d0);})['catch'](function(_0x548a86){logger[_0x88ec('0x14')]('AddTags',_0x548a86[_0x88ec('0x17')],_0x235d76);_0x293a19(_this[_0x88ec('0x14')](0x1f4,_0x548a86[_0x88ec('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 0562124..aa7d70d 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 _0xbfd2=['emit','removeListener','chatInteraction:','./chatInteraction.events','remove','update'];(function(_0x5bc85a,_0x802e13){var _0x5875a8=function(_0x26d816){while(--_0x26d816){_0x5bc85a['push'](_0x5bc85a['shift']());}};_0x5875a8(++_0x802e13);}(_0xbfd2,0x123));var _0x2bfd=function(_0x2e9f10,_0xff2493){_0x2e9f10=_0x2e9f10-0x0;var _0x3ee9e4=_0xbfd2[_0x2e9f10];return _0x3ee9e4;};'use strict';var ChatInteractionEvents=require(_0x2bfd('0x0'));var events=['save',_0x2bfd('0x1'),_0x2bfd('0x2')];function createListener(_0x48a8dc,_0x5ced93){return function(_0x5d3170){_0x5ced93[_0x2bfd('0x3')](_0x48a8dc,_0x5d3170);};}function removeListener(_0x524a99,_0x1e40a2){return function(){ChatInteractionEvents[_0x2bfd('0x4')](_0x524a99,_0x1e40a2);};}exports['register']=function(_0x5498ab){for(var _0x56996c=0x0,_0x46adf7=events['length'];_0x56996c<_0x46adf7;_0x56996c++){var _0xd016cd=events[_0x56996c];var _0x34bef9=createListener(_0x2bfd('0x5')+_0xd016cd,_0x5498ab);ChatInteractionEvents['on'](_0xd016cd,_0x34bef9);}}; \ No newline at end of file +var _0x76d5=['remove','update','emit','register','length','chatInteraction:'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x76d5,0x108));var _0x576d=function(_0x4aff5d,_0x231166){_0x4aff5d=_0x4aff5d-0x0;var _0x5aa98e=_0x76d5[_0x4aff5d];return _0x5aa98e;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x576d('0x0'),_0x576d('0x1')];function createListener(_0x4e9450,_0x49b919){return function(_0x5f59dd){_0x49b919[_0x576d('0x2')](_0x4e9450,_0x5f59dd);};}function removeListener(_0x76bb2f,_0x40c0e1){return function(){ChatInteractionEvents['removeListener'](_0x76bb2f,_0x40c0e1);};}exports[_0x576d('0x3')]=function(_0xbce837){for(var _0x25bfb4=0x0,_0x24a072=events[_0x576d('0x4')];_0x25bfb4<_0x24a072;_0x25bfb4++){var _0x5ba991=events[_0x25bfb4];var _0x38dc9f=createListener(_0x576d('0x5')+_0x5ba991,_0xbce837);ChatInteractionEvents['on'](_0x5ba991,_0x38dc9f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 21da8b3..13f9e2a 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 _0xb5f6=['isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','post','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','delete','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','/:id','/:id/attachment_download'];(function(_0x38161b,_0x218f8a){var _0x26235f=function(_0x3426b9){while(--_0x3426b9){_0x38161b['push'](_0x38161b['shift']());}};_0x26235f(++_0x218f8a);}(_0xb5f6,0xc8));var _0x6b5f=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0xb5f6[_0x31dde9];return _0x1fbf2d;};'use strict';var multer=require(_0x6b5f('0x0'));var util=require(_0x6b5f('0x1'));var path=require(_0x6b5f('0x2'));var timeout=require(_0x6b5f('0x3'));var express=require('express');var router=express[_0x6b5f('0x4')]();var fs_extra=require(_0x6b5f('0x5'));var auth=require(_0x6b5f('0x6'));var interaction=require(_0x6b5f('0x7'));var config=require(_0x6b5f('0x8'));var controller=require(_0x6b5f('0x9'));router[_0x6b5f('0xa')]('/',auth['isAuthenticated'](),controller[_0x6b5f('0xb')]);router[_0x6b5f('0xa')](_0x6b5f('0xc'),auth[_0x6b5f('0xd')](),controller['describe']);router['get'](_0x6b5f('0xe'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0x6b5f('0xa')](_0x6b5f('0xf'),auth[_0x6b5f('0x10')](),controller[_0x6b5f('0x11')]);router[_0x6b5f('0xa')](_0x6b5f('0x12'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x6b5f('0x13'),auth[_0x6b5f('0x10')](),controller[_0x6b5f('0x14')]);router[_0x6b5f('0xa')](_0x6b5f('0x15'),auth['isAuthenticated'](),controller['download']);router[_0x6b5f('0x16')]('/',auth[_0x6b5f('0xd')](),controller['create']);router['post'](_0x6b5f('0x17'),auth[_0x6b5f('0xd')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x6b5f('0x18')]({'destination':function(_0x205a3a,_0x60332a,_0x309eb0){_0x309eb0(null,path[_0x6b5f('0x19')](config[_0x6b5f('0x1a')],_0x6b5f('0x1b')));},'filename':function(_0x25ec32,_0x1e488c,_0x32ddef){_0x32ddef(null,util['format'](_0x6b5f('0x1c'),Date[_0x6b5f('0x1d')](),_0x1e488c[_0x6b5f('0x1e')][_0x6b5f('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x6b5f('0x20'),upload[_0x6b5f('0x21')](_0x6b5f('0x22')),controller[_0x6b5f('0x23')]);router[_0x6b5f('0x16')](_0x6b5f('0x12'),auth[_0x6b5f('0x10')](),controller[_0x6b5f('0x24')]);router[_0x6b5f('0x16')](_0x6b5f('0x25'),auth[_0x6b5f('0xd')](),interaction[_0x6b5f('0x26')](_0x6b5f('0x27'),_0x6b5f('0x28')),controller[_0x6b5f('0x29')]);router[_0x6b5f('0x2a')]('/:id',auth[_0x6b5f('0xd')](),interaction[_0x6b5f('0x26')](_0x6b5f('0x27'),'chatinteraction:update'),controller[_0x6b5f('0x2b')]);router[_0x6b5f('0x2a')](_0x6b5f('0x2c'),controller[_0x6b5f('0x2d')]);router[_0x6b5f('0x2a')](_0x6b5f('0x2e'),auth[_0x6b5f('0x10')](),controller[_0x6b5f('0x2f')]);router['put'](_0x6b5f('0x30'),controller[_0x6b5f('0x31')]);router['delete'](_0x6b5f('0xe'),auth[_0x6b5f('0xd')](),interaction['tracked']('chat',_0x6b5f('0x32')),controller['destroy']);router[_0x6b5f('0x33')](_0x6b5f('0x25'),auth[_0x6b5f('0xd')](),controller[_0x6b5f('0x34')]);module[_0x6b5f('0x35')]=router; \ No newline at end of file +var _0x7e64=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','createVidaooSession','diskStorage','join','server/files/attachments/','now','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','/:id/tags','multer','path','connect-timeout','express'];(function(_0x13ce90,_0xdf634d){var _0x59ce8c=function(_0x3652d1){while(--_0x3652d1){_0x13ce90['push'](_0x13ce90['shift']());}};_0x59ce8c(++_0xdf634d);}(_0x7e64,0x161));var _0x47e6=function(_0x37304a,_0x1f3ae4){_0x37304a=_0x37304a-0x0;var _0x1bea38=_0x7e64[_0x37304a];return _0x1bea38;};'use strict';var multer=require(_0x47e6('0x0'));var util=require('util');var path=require(_0x47e6('0x1'));var timeout=require(_0x47e6('0x2'));var express=require(_0x47e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x47e6('0x4'));var interaction=require(_0x47e6('0x5'));var config=require(_0x47e6('0x6'));var controller=require(_0x47e6('0x7'));router[_0x47e6('0x8')]('/',auth[_0x47e6('0x9')](),controller[_0x47e6('0xa')]);router[_0x47e6('0x8')](_0x47e6('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x47e6('0x8')](_0x47e6('0xc'),auth[_0x47e6('0xd')](),controller[_0x47e6('0xe')]);router[_0x47e6('0x8')]('/:id/attachment_download',auth[_0x47e6('0xd')](),controller[_0x47e6('0xf')]);router[_0x47e6('0x8')](_0x47e6('0x10'),auth[_0x47e6('0x9')](),controller[_0x47e6('0x11')]);router[_0x47e6('0x8')](_0x47e6('0x12'),auth[_0x47e6('0xd')](),controller[_0x47e6('0x13')]);router['get'](_0x47e6('0x14'),auth['isAuthenticated'](),controller[_0x47e6('0x15')]);router[_0x47e6('0x16')]('/',auth[_0x47e6('0x9')](),controller[_0x47e6('0x17')]);router[_0x47e6('0x16')]('/:id/vidaoo',auth[_0x47e6('0x9')](),controller[_0x47e6('0x18')]);var upload=multer({'storage':multer[_0x47e6('0x19')]({'destination':function(_0x1e7df,_0x1fcfc1,_0x277aad){_0x277aad(null,path[_0x47e6('0x1a')](config['root'],_0x47e6('0x1b')));},'filename':function(_0x36d3c1,_0x4afb7a,_0x520157){_0x520157(null,util['format']('%s-%s',Date[_0x47e6('0x1c')](),_0x4afb7a['originalname'][_0x47e6('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x47e6('0x16')](_0x47e6('0x1e'),upload[_0x47e6('0x1f')](_0x47e6('0x20')),controller[_0x47e6('0x21')]);router[_0x47e6('0x16')](_0x47e6('0x10'),auth[_0x47e6('0xd')](),controller[_0x47e6('0x22')]);router[_0x47e6('0x16')]('/:id/tags',auth[_0x47e6('0x9')](),interaction[_0x47e6('0x23')](_0x47e6('0x24'),_0x47e6('0x25')),controller[_0x47e6('0x26')]);router['put'](_0x47e6('0xc'),auth[_0x47e6('0x9')](),interaction['tracked']('chat',_0x47e6('0x27')),controller[_0x47e6('0x28')]);router[_0x47e6('0x29')](_0x47e6('0x2a'),controller[_0x47e6('0x2b')]);router['put'](_0x47e6('0x2c'),auth[_0x47e6('0xd')](),controller[_0x47e6('0x2d')]);router[_0x47e6('0x29')](_0x47e6('0x2e'),controller['close']);router[_0x47e6('0x2f')](_0x47e6('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x47e6('0x24'),_0x47e6('0x30')),controller[_0x47e6('0x31')]);router['delete'](_0x47e6('0x32'),auth[_0x47e6('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 045f7c0..7f04ad7 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 _0x5287=['medium','BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x122e9b,_0x391bf4){var _0x22c247=function(_0x1b2c65){while(--_0x1b2c65){_0x122e9b['push'](_0x122e9b['shift']());}};_0x22c247(++_0x391bf4);}(_0x5287,0x165));var _0x7528=function(_0x1ac30d,_0x39dc7d){_0x1ac30d=_0x1ac30d-0x0;var _0x4f7dfe=_0x5287[_0x1ac30d];return _0x4f7dfe;};'use strict';var Sequelize=require(_0x7528('0x0'));module[_0x7528('0x1')]={'body':{'type':Sequelize[_0x7528('0x2')](_0x7528('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7528('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x7528('0x5')]}}; \ No newline at end of file +var _0x745c=['INTEGER','sequelize','exports','TEXT','medium'];(function(_0x40a3f6,_0x39e6e8){var _0x3edc10=function(_0x45cd93){while(--_0x45cd93){_0x40a3f6['push'](_0x40a3f6['shift']());}};_0x3edc10(++_0x39e6e8);}(_0x745c,0x12d));var _0xc745=function(_0x3c3b51,_0xe90b55){_0x3c3b51=_0x3c3b51-0x0;var _0x303246=_0x745c[_0x3c3b51];return _0x303246;};'use strict';var Sequelize=require(_0xc745('0x0'));module[_0xc745('0x1')]={'body':{'type':Sequelize[_0xc745('0x2')](_0xc745('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xc745('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f3125df..0e6d165 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 _0x021f=['fs-extra','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','ChatInternalMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','get','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','UserProfileSection','Agents','autoAssociation','push','createdAt','ToId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x4ded18,_0x4a1ef4){var _0x5370b=function(_0x29f4ea){while(--_0x29f4ea){_0x4ded18['push'](_0x4ded18['shift']());}};_0x5370b(++_0x4a1ef4);}(_0x021f,0x1b1));var _0xf021=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x021f[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require(_0xf021('0x0'));var rimraf=require(_0xf021('0x1'));var zipdir=require(_0xf021('0x2'));var jsonpatch=require(_0xf021('0x3'));var rp=require('request-promise');var moment=require(_0xf021('0x4'));var BPromise=require(_0xf021('0x5'));var Mustache=require(_0xf021('0x6'));var util=require(_0xf021('0x7'));var path=require('path');var sox=require(_0xf021('0x8'));var csv=require(_0xf021('0x9'));var ejs=require(_0xf021('0xa'));var fs=require('fs');var fs_extra=require(_0xf021('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf021('0xc'));var toCsv=require(_0xf021('0x9'));var querystring=require('querystring');var Papa=require(_0xf021('0xd'));var Redis=require(_0xf021('0xe'));var authService=require(_0xf021('0xf'));var qs=require(_0xf021('0x10'));var as=require(_0xf021('0x11'));var hardwareService=require(_0xf021('0x12'));var logger=require(_0xf021('0x13'))(_0xf021('0x14'));var utils=require('../../config/utils');var config=require(_0xf021('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf021('0x16'))['db'];config[_0xf021('0x17')]=_[_0xf021('0x18')](config['redis'],{'host':_0xf021('0x19'),'port':0x18eb});var socket=require(_0xf021('0x1a'))(new Redis(config[_0xf021('0x17')]));require(_0xf021('0x1b'))[_0xf021('0x1c')](socket);function respondWithStatusCode(_0xfd416d,_0x3e0709){_0x3e0709=_0x3e0709||0xcc;return function(_0x2c6910){if(_0x2c6910){return _0xfd416d[_0xf021('0x1d')](_0x3e0709);}return _0xfd416d[_0xf021('0x1e')](_0x3e0709)[_0xf021('0x1f')]();};}function respondWithResult(_0x3c3396,_0x543a5e){_0x543a5e=_0x543a5e||0xc8;return function(_0x361101){if(_0x361101){return _0x3c3396[_0xf021('0x1e')](_0x543a5e)[_0xf021('0x20')](_0x361101);}};}function respondWithFilteredResult(_0x2cd266,_0x31e82c){return function(_0x454b64){if(_0x454b64){var _0x15e632=typeof _0x31e82c[_0xf021('0x21')]===_0xf021('0x22')&&typeof _0x31e82c['limit']===_0xf021('0x22');var _0x1b2160=_0x454b64[_0xf021('0x23')];var _0x412b0d=_0x15e632?0x0:_0x31e82c[_0xf021('0x21')];var _0x1c4e63=_0x15e632?_0x454b64['count']:_0x31e82c[_0xf021('0x21')]+_0x31e82c[_0xf021('0x24')];var _0x27d0c7;if(_0x1c4e63>=_0x1b2160){_0x1c4e63=_0x1b2160;_0x27d0c7=0xc8;}else{_0x27d0c7=0xce;}_0x2cd266[_0xf021('0x1e')](_0x27d0c7);return _0x2cd266[_0xf021('0x25')](_0xf021('0x26'),_0x412b0d+'-'+_0x1c4e63+'/'+_0x1b2160)['json'](_0x454b64);}return null;};}function patchUpdates(_0x5b5a26){return function(_0x5d35c0){try{jsonpatch[_0xf021('0x27')](_0x5d35c0,_0x5b5a26,!![]);}catch(_0x2ea462){return BPromise[_0xf021('0x28')](_0x2ea462);}return _0x5d35c0[_0xf021('0x29')]();};}function saveUpdates(_0x227c35,_0x121593){return function(_0x483842){if(_0x483842){return _0x483842[_0xf021('0x2a')](_0x227c35)['then'](function(_0x327be9){return _0x327be9;});}return null;};}function removeEntity(_0x220840,_0x8d455f){return function(_0x592afc){if(_0x592afc){return _0x592afc[_0xf021('0x2b')]()[_0xf021('0x2c')](function(){_0x220840[_0xf021('0x1e')](0xcc)[_0xf021('0x1f')]();});}};}function handleEntityNotFound(_0x388ba9,_0x5cbd4c){return function(_0x57d4c7){if(!_0x57d4c7){_0x388ba9[_0xf021('0x1d')](0x194);}return _0x57d4c7;};}function handleError(_0x49245b,_0x3639f4){_0x3639f4=_0x3639f4||0x1f4;return function(_0x40bb4a){logger['error'](_0x40bb4a[_0xf021('0x2d')]);if(_0x40bb4a[_0xf021('0x2e')]){delete _0x40bb4a[_0xf021('0x2e')];}_0x49245b['status'](_0x3639f4)[_0xf021('0x2f')](_0x40bb4a);};}exports[_0xf021('0x30')]=function(_0x14adfe,_0x39d088){var _0x4f3c7d={},_0x28e6de={},_0x443e7a={'count':0x0,'rows':[]};var _0x1b3d2d=_[_0xf021('0x31')](db[_0xf021('0x32')]['rawAttributes'],function(_0x2ab4e4){return{'name':_0x2ab4e4[_0xf021('0x33')],'type':_0x2ab4e4[_0xf021('0x34')][_0xf021('0x35')]};});_0x28e6de[_0xf021('0x36')]=_[_0xf021('0x31')](_0x1b3d2d,'name');_0x28e6de[_0xf021('0x37')]=_[_0xf021('0x38')](_0x14adfe[_0xf021('0x37')]);_0x28e6de[_0xf021('0x39')]=_[_0xf021('0x3a')](_0x28e6de[_0xf021('0x36')],_0x28e6de[_0xf021('0x37')]);_0x4f3c7d[_0xf021('0x3b')]=_[_0xf021('0x3a')](_0x28e6de['model'],qs[_0xf021('0x3c')](_0x14adfe[_0xf021('0x37')]['fields']));_0x4f3c7d['attributes']=_0x4f3c7d[_0xf021('0x3b')][_0xf021('0x3d')]?_0x4f3c7d[_0xf021('0x3b')]:_0x28e6de['model'];if(!_0x14adfe[_0xf021('0x37')][_0xf021('0x3e')](_0xf021('0x3f'))){_0x4f3c7d[_0xf021('0x24')]=qs[_0xf021('0x24')](_0x14adfe[_0xf021('0x37')][_0xf021('0x24')]);_0x4f3c7d[_0xf021('0x21')]=qs[_0xf021('0x21')](_0x14adfe[_0xf021('0x37')][_0xf021('0x21')]);}_0x4f3c7d[_0xf021('0x40')]=qs[_0xf021('0x41')](_0x14adfe[_0xf021('0x37')][_0xf021('0x41')]);_0x4f3c7d[_0xf021('0x42')]=qs[_0xf021('0x39')](_[_0xf021('0x43')](_0x14adfe[_0xf021('0x37')],_0x28e6de['filters']),_0x1b3d2d);if(_0x14adfe[_0xf021('0x37')][_0xf021('0x44')]){_0x4f3c7d['where']=_[_0xf021('0x45')](_0x4f3c7d[_0xf021('0x42')],{'$or':_[_0xf021('0x31')](_0x1b3d2d,function(_0x48d9c2){if(_0x48d9c2[_0xf021('0x34')]!=='VIRTUAL'){var _0x3e5a0f={};_0x3e5a0f[_0x48d9c2[_0xf021('0x2e')]]={'$like':'%'+_0x14adfe['query'][_0xf021('0x44')]+'%'};return _0x3e5a0f;}})});}_0x4f3c7d=_[_0xf021('0x45')]({},_0x4f3c7d,_0x14adfe[_0xf021('0x46')]);var _0x290691={'where':_0x4f3c7d[_0xf021('0x42')]};return db['ChatInternalMessage'][_0xf021('0x23')](_0x290691)['then'](function(_0x2790e8){_0x443e7a[_0xf021('0x23')]=_0x2790e8;if(_0x14adfe[_0xf021('0x37')][_0xf021('0x47')]){_0x4f3c7d[_0xf021('0x48')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xf021('0x49')](_0x4f3c7d);})[_0xf021('0x2c')](function(_0x19d54a){_0x443e7a[_0xf021('0x4a')]=_0x19d54a;return _0x443e7a;})[_0xf021('0x2c')](respondWithFilteredResult(_0x39d088,_0x4f3c7d))[_0xf021('0x4b')](handleError(_0x39d088,null));};exports[_0xf021('0x4c')]=function(_0x40193b,_0x3905a8){var _0x5c8d20={'raw':!![],'where':{'id':_0x40193b['params']['id']}},_0x15ac2c={};_0x15ac2c[_0xf021('0x36')]=_[_0xf021('0x38')](db[_0xf021('0x32')][_0xf021('0x4d')]);_0x15ac2c[_0xf021('0x37')]=_[_0xf021('0x38')](_0x40193b[_0xf021('0x37')]);_0x15ac2c[_0xf021('0x39')]=_['intersection'](_0x15ac2c[_0xf021('0x36')],_0x15ac2c[_0xf021('0x37')]);_0x5c8d20[_0xf021('0x3b')]=_[_0xf021('0x3a')](_0x15ac2c[_0xf021('0x36')],qs[_0xf021('0x3c')](_0x40193b[_0xf021('0x37')][_0xf021('0x3c')]));_0x5c8d20[_0xf021('0x3b')]=_0x5c8d20[_0xf021('0x3b')][_0xf021('0x3d')]?_0x5c8d20[_0xf021('0x3b')]:_0x15ac2c[_0xf021('0x36')];if(_0x40193b[_0xf021('0x37')][_0xf021('0x47')]){_0x5c8d20[_0xf021('0x48')]=[{'all':!![]}];}_0x5c8d20=_[_0xf021('0x45')]({},_0x5c8d20,_0x40193b[_0xf021('0x46')]);return db['ChatInternalMessage'][_0xf021('0x4e')](_0x5c8d20)[_0xf021('0x2c')](handleEntityNotFound(_0x3905a8,null))[_0xf021('0x2c')](respondWithResult(_0x3905a8,null))['catch'](handleError(_0x3905a8,null));};exports[_0xf021('0x4f')]=function(_0x385acd,_0x9d2cc4){return db[_0xf021('0x32')][_0xf021('0x4f')](_0x385acd[_0xf021('0x50')],{})[_0xf021('0x2c')](respondWithResult(_0x9d2cc4,0xc9))[_0xf021('0x4b')](handleError(_0x9d2cc4,null));};exports[_0xf021('0x2a')]=function(_0x5e03cb,_0x595f31){if(_0x5e03cb[_0xf021('0x50')]['id']){delete _0x5e03cb[_0xf021('0x50')]['id'];}return db[_0xf021('0x32')]['find']({'where':{'id':_0x5e03cb['params']['id']}})[_0xf021('0x2c')](handleEntityNotFound(_0x595f31,null))[_0xf021('0x2c')](saveUpdates(_0x5e03cb['body'],null))[_0xf021('0x2c')](respondWithResult(_0x595f31,null))['catch'](handleError(_0x595f31,null));};exports[_0xf021('0x2b')]=function(_0x59d33b,_0x36235c){return db['ChatInternalMessage'][_0xf021('0x4e')]({'where':{'id':_0x59d33b[_0xf021('0x51')]['id']}})[_0xf021('0x2c')](handleEntityNotFound(_0x36235c,null))[_0xf021('0x2c')](removeEntity(_0x36235c,null))['catch'](handleError(_0x36235c,null));};exports['describe']=function(_0x3f40c3,_0x5606ed){return db[_0xf021('0x32')][_0xf021('0x52')]()[_0xf021('0x2c')](respondWithResult(_0x5606ed,null))[_0xf021('0x4b')](handleError(_0x5606ed,null));};function wrapUser(_0xb705a6){return function(_0x22f90b){var _0x13f890=_0xb705a6[_0xf021('0x53')]({'plain':!![]});_0x13f890[_0xf021('0x54')]=[];if(_0x22f90b){_0x13f890[_0xf021('0x55')]=_0x22f90b['createdAt'];_0x13f890['lastMessage']=_0x22f90b;}else{_0x13f890[_0xf021('0x55')]=moment(0x0)[_0xf021('0x56')](_0xf021('0x57'));_0x13f890[_0xf021('0x58')]={};}return _0x13f890;};}exports[_0xf021('0x59')]=function(_0x17ead7,_0x2b7d43,_0x3eb6a4){var _0x2dde8e=[];return db['User'][_0xf021('0x49')]({'where':{'role':[_0xf021('0x5a'),_0xf021('0x5b'),_0xf021('0x5c')]},'attributes':['id',_0xf021('0x5d'),'name',_0xf021('0x5e'),_0xf021('0x5f'),_0xf021('0x60'),_0xf021('0x61'),_0xf021('0x62'),_0xf021('0x63'),'showWebBar'],'order':qs[_0xf021('0x41')](_0xf021('0x64')),'include':[{'model':db[_0xf021('0x65')],'as':_0xf021('0x66'),'attributes':['id',_0xf021('0x2e'),_0xf021('0x34')],'through':{'attributes':[]}}]})[_0xf021('0x2c')](function(_0x4d42ae){if(_0x4d42ae){var _0x17a2e6=_0x17ead7[_0xf021('0x5c')][_0xf021('0x53')]({'plain':!![]});if(!_0x17a2e6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17a2e6[_0xf021('0x5e')]===_0xf021('0x5c')){return db[_0xf021('0x67')][_0xf021('0x4e')]({'where':{'name':_0xf021('0x68'),'userProfileId':_0x17a2e6['userProfileId']},'raw':!![]})[_0xf021('0x2c')](function(_0x59f988){if(_0x59f988){if(_0x59f988[_0xf021('0x69')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x59f988['id']},'raw':!![]})[_0xf021('0x2c')](function(_0x387bbf){var _0x29c06e=[];if(_['isEmpty'](_0x387bbf)){_0x29c06e=_[_0xf021('0x44')](_0x4d42ae,function(_0x53f1db){if(_0x53f1db[_0xf021('0x5e')]!==_0xf021('0x5a')){return _0x53f1db;}});return _0x29c06e;}else{for(var _0xdc60a4=0x0;_0xdc60a4<_0x4d42ae[_0xf021('0x3d')];_0xdc60a4++){var _0x50258e=_0x4d42ae[_0xdc60a4];if(_0x50258e[_0xf021('0x5e')]===_0xf021('0x5a')){var _0x586670=_[_0xf021('0x4e')](_0x387bbf,function(_0x58caf6){return _0x58caf6['resourceId']===_0x50258e['id'];});if(_0x586670)_0x29c06e[_0xf021('0x6a')](_0x50258e);}else{_0x29c06e[_0xf021('0x6a')](_0x50258e);}}return _0x29c06e;}});}else{return _0x4d42ae;}}else{var _0x576fcb=_['filter'](_0x4d42ae,function(_0x51f4a8){if(_0x51f4a8['role']!==_0xf021('0x5a')){return _0x51f4a8;}});return _0x576fcb;}});}else{return _0x4d42ae;}}})[_0xf021('0x2c')](function(_0x2cfb2d){var _0x8015de=[];if(_0x2cfb2d){_0x2dde8e=_0x2cfb2d;for(var _0x3f8012=0x0;_0x3f8012<_0x2cfb2d['length'];_0x3f8012+=0x1){_0x2dde8e[_0x3f8012]['messages']=[];_0x8015de['push'](db[_0xf021('0x32')]['find']({'where':{'FromId':[_0x17ead7[_0xf021('0x5c')]['id'],_0x2cfb2d[_0x3f8012]['id']],'ToId':[_0x17ead7[_0xf021('0x5c')]['id'],_0x2cfb2d[_0x3f8012]['id']],'ChatGroupId':null},'attributes':['id',_0xf021('0x6b'),'FromId',_0xf021('0x6c'),'read','body'],'order':qs['sort'](_0xf021('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf021('0x2c')](wrapUser(_0x2cfb2d[_0x3f8012])));}return BPromise[_0xf021('0x6e')](_0x8015de);}return[];})[_0xf021('0x2c')](function(_0x30d121){return{'rows':_0x30d121,'count':_0x30d121['length']};})['then'](respondWithResult(_0x2b7d43,null))[_0xf021('0x4b')](handleError(_0x2b7d43,null));}; \ No newline at end of file +var _0x4ece=['rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','ChatInternalMessage','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','messages','createdAt','lastMessage','lastMessageAt','format','User','admin','user','fullname','role','userpic','internal','online','lastLoginAt','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','read','-createdAt','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','register','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','end','name','index'];(function(_0x800c3d,_0x4ccf70){var _0x2d97c9=function(_0xaf4256){while(--_0xaf4256){_0x800c3d['push'](_0x800c3d['shift']());}};_0x2d97c9(++_0x4ccf70);}(_0x4ece,0x1d2));var _0xe4ec=function(_0x1041b1,_0x35f64a){_0x1041b1=_0x1041b1-0x0;var _0x166b49=_0x4ece[_0x1041b1];return _0x166b49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4ec('0x0'));var zipdir=require(_0xe4ec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe4ec('0x2'));var moment=require(_0xe4ec('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe4ec('0x4'));var util=require(_0xe4ec('0x5'));var path=require(_0xe4ec('0x6'));var sox=require(_0xe4ec('0x7'));var csv=require(_0xe4ec('0x8'));var ejs=require(_0xe4ec('0x9'));var fs=require('fs');var fs_extra=require(_0xe4ec('0xa'));var _=require('lodash');var squel=require(_0xe4ec('0xb'));var crypto=require(_0xe4ec('0xc'));var jsforce=require(_0xe4ec('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe4ec('0x8'));var querystring=require('querystring');var Papa=require(_0xe4ec('0xe'));var Redis=require(_0xe4ec('0xf'));var authService=require(_0xe4ec('0x10'));var qs=require(_0xe4ec('0x11'));var as=require(_0xe4ec('0x12'));var hardwareService=require(_0xe4ec('0x13'));var logger=require(_0xe4ec('0x14'))(_0xe4ec('0x15'));var utils=require(_0xe4ec('0x16'));var config=require(_0xe4ec('0x17'));var licenseUtil=require(_0xe4ec('0x18'));var db=require('../../mysqldb')['db'];config[_0xe4ec('0x19')]=_['defaults'](config[_0xe4ec('0x19')],{'host':_0xe4ec('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe4ec('0x19')]));require('./chatInternalMessage.socket')[_0xe4ec('0x1b')](socket);function respondWithStatusCode(_0x460db9,_0x3cbf97){_0x3cbf97=_0x3cbf97||0xcc;return function(_0x493187){if(_0x493187){return _0x460db9[_0xe4ec('0x1c')](_0x3cbf97);}return _0x460db9[_0xe4ec('0x1d')](_0x3cbf97)['end']();};}function respondWithResult(_0x291df9,_0x497dd6){_0x497dd6=_0x497dd6||0xc8;return function(_0x55a42b){if(_0x55a42b){return _0x291df9[_0xe4ec('0x1d')](_0x497dd6)[_0xe4ec('0x1e')](_0x55a42b);}};}function respondWithFilteredResult(_0x2a615e,_0x19ffe2){return function(_0x2209a9){if(_0x2209a9){var _0x3894a2=typeof _0x19ffe2['offset']===_0xe4ec('0x1f')&&typeof _0x19ffe2[_0xe4ec('0x20')]===_0xe4ec('0x1f');var _0x34d1f8=_0x2209a9[_0xe4ec('0x21')];var _0x9cf201=_0x3894a2?0x0:_0x19ffe2[_0xe4ec('0x22')];var _0x33a61e=_0x3894a2?_0x2209a9['count']:_0x19ffe2[_0xe4ec('0x22')]+_0x19ffe2[_0xe4ec('0x20')];var _0x1301f5;if(_0x33a61e>=_0x34d1f8){_0x33a61e=_0x34d1f8;_0x1301f5=0xc8;}else{_0x1301f5=0xce;}_0x2a615e[_0xe4ec('0x1d')](_0x1301f5);return _0x2a615e[_0xe4ec('0x23')]('Content-Range',_0x9cf201+'-'+_0x33a61e+'/'+_0x34d1f8)[_0xe4ec('0x1e')](_0x2209a9);}return null;};}function patchUpdates(_0x6edf02){return function(_0x252372){try{jsonpatch[_0xe4ec('0x24')](_0x252372,_0x6edf02,!![]);}catch(_0x4b500e){return BPromise[_0xe4ec('0x25')](_0x4b500e);}return _0x252372[_0xe4ec('0x26')]();};}function saveUpdates(_0x34ee0e,_0x3530a1){return function(_0x58f667){if(_0x58f667){return _0x58f667[_0xe4ec('0x27')](_0x34ee0e)[_0xe4ec('0x28')](function(_0x518b04){return _0x518b04;});}return null;};}function removeEntity(_0x1aed6a,_0x1496be){return function(_0x2e1333){if(_0x2e1333){return _0x2e1333['destroy']()[_0xe4ec('0x28')](function(){_0x1aed6a['status'](0xcc)[_0xe4ec('0x29')]();});}};}function handleEntityNotFound(_0x5904e7,_0x1582ae){return function(_0x11f9fc){if(!_0x11f9fc){_0x5904e7[_0xe4ec('0x1c')](0x194);}return _0x11f9fc;};}function handleError(_0x527302,_0x54e507){_0x54e507=_0x54e507||0x1f4;return function(_0x5464f7){logger['error'](_0x5464f7['stack']);if(_0x5464f7[_0xe4ec('0x2a')]){delete _0x5464f7[_0xe4ec('0x2a')];}_0x527302[_0xe4ec('0x1d')](_0x54e507)['send'](_0x5464f7);};}exports[_0xe4ec('0x2b')]=function(_0x1855ae,_0x2b101a){var _0x1f10aa={},_0x48c108={},_0x1da8df={'count':0x0,'rows':[]};var _0x534818=_['map'](db['ChatInternalMessage'][_0xe4ec('0x2c')],function(_0x33cd69){return{'name':_0x33cd69[_0xe4ec('0x2d')],'type':_0x33cd69[_0xe4ec('0x2e')]['key']};});_0x48c108['model']=_[_0xe4ec('0x2f')](_0x534818,_0xe4ec('0x2a'));_0x48c108[_0xe4ec('0x30')]=_[_0xe4ec('0x31')](_0x1855ae[_0xe4ec('0x30')]);_0x48c108['filters']=_[_0xe4ec('0x32')](_0x48c108[_0xe4ec('0x33')],_0x48c108['query']);_0x1f10aa[_0xe4ec('0x34')]=_[_0xe4ec('0x32')](_0x48c108[_0xe4ec('0x33')],qs[_0xe4ec('0x35')](_0x1855ae[_0xe4ec('0x30')]['fields']));_0x1f10aa['attributes']=_0x1f10aa['attributes'][_0xe4ec('0x36')]?_0x1f10aa[_0xe4ec('0x34')]:_0x48c108[_0xe4ec('0x33')];if(!_0x1855ae[_0xe4ec('0x30')][_0xe4ec('0x37')]('nolimit')){_0x1f10aa[_0xe4ec('0x20')]=qs[_0xe4ec('0x20')](_0x1855ae[_0xe4ec('0x30')][_0xe4ec('0x20')]);_0x1f10aa[_0xe4ec('0x22')]=qs['offset'](_0x1855ae[_0xe4ec('0x30')][_0xe4ec('0x22')]);}_0x1f10aa[_0xe4ec('0x38')]=qs[_0xe4ec('0x39')](_0x1855ae[_0xe4ec('0x30')][_0xe4ec('0x39')]);_0x1f10aa[_0xe4ec('0x3a')]=qs[_0xe4ec('0x3b')](_['pick'](_0x1855ae[_0xe4ec('0x30')],_0x48c108['filters']),_0x534818);if(_0x1855ae['query'][_0xe4ec('0x3c')]){_0x1f10aa[_0xe4ec('0x3a')]=_[_0xe4ec('0x3d')](_0x1f10aa[_0xe4ec('0x3a')],{'$or':_[_0xe4ec('0x2f')](_0x534818,function(_0x143242){if(_0x143242[_0xe4ec('0x2e')]!=='VIRTUAL'){var _0x4321f5={};_0x4321f5[_0x143242[_0xe4ec('0x2a')]]={'$like':'%'+_0x1855ae[_0xe4ec('0x30')][_0xe4ec('0x3c')]+'%'};return _0x4321f5;}})});}_0x1f10aa=_[_0xe4ec('0x3d')]({},_0x1f10aa,_0x1855ae['options']);var _0x58aff3={'where':_0x1f10aa[_0xe4ec('0x3a')]};return db[_0xe4ec('0x3e')][_0xe4ec('0x21')](_0x58aff3)[_0xe4ec('0x28')](function(_0x51f082){_0x1da8df['count']=_0x51f082;if(_0x1855ae[_0xe4ec('0x30')][_0xe4ec('0x3f')]){_0x1f10aa['include']=[{'all':!![]}];}return db[_0xe4ec('0x3e')][_0xe4ec('0x40')](_0x1f10aa);})[_0xe4ec('0x28')](function(_0x636895){_0x1da8df[_0xe4ec('0x41')]=_0x636895;return _0x1da8df;})[_0xe4ec('0x28')](respondWithFilteredResult(_0x2b101a,_0x1f10aa))[_0xe4ec('0x42')](handleError(_0x2b101a,null));};exports[_0xe4ec('0x43')]=function(_0x5c3fa9,_0xc75c2c){var _0x5aec63={'raw':!![],'where':{'id':_0x5c3fa9[_0xe4ec('0x44')]['id']}},_0xf3f696={};_0xf3f696[_0xe4ec('0x33')]=_[_0xe4ec('0x31')](db[_0xe4ec('0x3e')][_0xe4ec('0x2c')]);_0xf3f696[_0xe4ec('0x30')]=_[_0xe4ec('0x31')](_0x5c3fa9[_0xe4ec('0x30')]);_0xf3f696[_0xe4ec('0x3b')]=_['intersection'](_0xf3f696[_0xe4ec('0x33')],_0xf3f696[_0xe4ec('0x30')]);_0x5aec63['attributes']=_[_0xe4ec('0x32')](_0xf3f696[_0xe4ec('0x33')],qs[_0xe4ec('0x35')](_0x5c3fa9[_0xe4ec('0x30')][_0xe4ec('0x35')]));_0x5aec63[_0xe4ec('0x34')]=_0x5aec63[_0xe4ec('0x34')]['length']?_0x5aec63[_0xe4ec('0x34')]:_0xf3f696[_0xe4ec('0x33')];if(_0x5c3fa9['query'][_0xe4ec('0x3f')]){_0x5aec63[_0xe4ec('0x45')]=[{'all':!![]}];}_0x5aec63=_['merge']({},_0x5aec63,_0x5c3fa9[_0xe4ec('0x46')]);return db[_0xe4ec('0x3e')][_0xe4ec('0x47')](_0x5aec63)[_0xe4ec('0x28')](handleEntityNotFound(_0xc75c2c,null))['then'](respondWithResult(_0xc75c2c,null))[_0xe4ec('0x42')](handleError(_0xc75c2c,null));};exports[_0xe4ec('0x48')]=function(_0x947c6b,_0x42d71e){return db[_0xe4ec('0x3e')]['create'](_0x947c6b[_0xe4ec('0x49')],{})[_0xe4ec('0x28')](respondWithResult(_0x42d71e,0xc9))[_0xe4ec('0x42')](handleError(_0x42d71e,null));};exports[_0xe4ec('0x27')]=function(_0x633d8d,_0x128d4b){if(_0x633d8d[_0xe4ec('0x49')]['id']){delete _0x633d8d['body']['id'];}return db[_0xe4ec('0x3e')][_0xe4ec('0x47')]({'where':{'id':_0x633d8d[_0xe4ec('0x44')]['id']}})[_0xe4ec('0x28')](handleEntityNotFound(_0x128d4b,null))[_0xe4ec('0x28')](saveUpdates(_0x633d8d[_0xe4ec('0x49')],null))['then'](respondWithResult(_0x128d4b,null))[_0xe4ec('0x42')](handleError(_0x128d4b,null));};exports['destroy']=function(_0x2abef6,_0x3b8d54){return db[_0xe4ec('0x3e')][_0xe4ec('0x47')]({'where':{'id':_0x2abef6[_0xe4ec('0x44')]['id']}})[_0xe4ec('0x28')](handleEntityNotFound(_0x3b8d54,null))['then'](removeEntity(_0x3b8d54,null))[_0xe4ec('0x42')](handleError(_0x3b8d54,null));};exports['describe']=function(_0x197efc,_0x373101){return db[_0xe4ec('0x3e')]['describe']()[_0xe4ec('0x28')](respondWithResult(_0x373101,null))['catch'](handleError(_0x373101,null));};function wrapUser(_0x977a67){return function(_0x48e52d){var _0x55a2f2=_0x977a67['get']({'plain':!![]});_0x55a2f2[_0xe4ec('0x4a')]=[];if(_0x48e52d){_0x55a2f2['lastMessageAt']=_0x48e52d[_0xe4ec('0x4b')];_0x55a2f2[_0xe4ec('0x4c')]=_0x48e52d;}else{_0x55a2f2[_0xe4ec('0x4d')]=moment(0x0)[_0xe4ec('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x55a2f2[_0xe4ec('0x4c')]={};}return _0x55a2f2;};}exports['getUsers']=function(_0x1f7ea5,_0x3b34b1,_0x307f05){var _0x2b7122=[];return db[_0xe4ec('0x4f')]['findAll']({'where':{'role':['agent',_0xe4ec('0x50'),_0xe4ec('0x51')]},'attributes':['id',_0xe4ec('0x52'),_0xe4ec('0x2a'),_0xe4ec('0x53'),_0xe4ec('0x54'),_0xe4ec('0x55'),_0xe4ec('0x56'),_0xe4ec('0x57'),'allowmessenger','showWebBar'],'order':qs[_0xe4ec('0x39')]('-online'),'include':[{'model':db[_0xe4ec('0x58')],'as':_0xe4ec('0x59'),'attributes':['id',_0xe4ec('0x2a'),_0xe4ec('0x2e')],'through':{'attributes':[]}}]})[_0xe4ec('0x28')](function(_0x14d0f0){if(_0x14d0f0){var _0x483867=_0x1f7ea5[_0xe4ec('0x51')][_0xe4ec('0x5a')]({'plain':!![]});if(!_0x483867)throw new Error(_0xe4ec('0x5b'));if(_0x483867[_0xe4ec('0x53')]==='user'){return db[_0xe4ec('0x5c')][_0xe4ec('0x47')]({'where':{'name':'Agents','userProfileId':_0x483867['userProfileId']},'raw':!![]})['then'](function(_0x23108f){if(_0x23108f){if(_0x23108f[_0xe4ec('0x5d')]===0x0){return db[_0xe4ec('0x5e')][_0xe4ec('0x40')]({'where':{'sectionId':_0x23108f['id']},'raw':!![]})[_0xe4ec('0x28')](function(_0x5980d7){var _0x16db5e=[];if(_[_0xe4ec('0x5f')](_0x5980d7)){_0x16db5e=_[_0xe4ec('0x3c')](_0x14d0f0,function(_0x3d281c){if(_0x3d281c[_0xe4ec('0x53')]!==_0xe4ec('0x60')){return _0x3d281c;}});return _0x16db5e;}else{for(var _0x327d1f=0x0;_0x327d1f<_0x14d0f0['length'];_0x327d1f++){var _0x470d64=_0x14d0f0[_0x327d1f];if(_0x470d64['role']==='agent'){var _0x58d7b5=_[_0xe4ec('0x47')](_0x5980d7,function(_0x22e3dd){return _0x22e3dd[_0xe4ec('0x61')]===_0x470d64['id'];});if(_0x58d7b5)_0x16db5e['push'](_0x470d64);}else{_0x16db5e[_0xe4ec('0x62')](_0x470d64);}}return _0x16db5e;}});}else{return _0x14d0f0;}}else{var _0x689e51=_['filter'](_0x14d0f0,function(_0x3f9284){if(_0x3f9284[_0xe4ec('0x53')]!==_0xe4ec('0x60')){return _0x3f9284;}});return _0x689e51;}});}else{return _0x14d0f0;}}})[_0xe4ec('0x28')](function(_0x54fcc9){var _0x31b464=[];if(_0x54fcc9){_0x2b7122=_0x54fcc9;for(var _0x51e0cb=0x0;_0x51e0cb<_0x54fcc9[_0xe4ec('0x36')];_0x51e0cb+=0x1){_0x2b7122[_0x51e0cb][_0xe4ec('0x4a')]=[];_0x31b464[_0xe4ec('0x62')](db[_0xe4ec('0x3e')][_0xe4ec('0x47')]({'where':{'FromId':[_0x1f7ea5[_0xe4ec('0x51')]['id'],_0x54fcc9[_0x51e0cb]['id']],'ToId':[_0x1f7ea5[_0xe4ec('0x51')]['id'],_0x54fcc9[_0x51e0cb]['id']],'ChatGroupId':null},'attributes':['id',_0xe4ec('0x4b'),_0xe4ec('0x63'),'ToId',_0xe4ec('0x64'),_0xe4ec('0x49')],'order':qs[_0xe4ec('0x39')](_0xe4ec('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe4ec('0x28')](wrapUser(_0x54fcc9[_0x51e0cb])));}return BPromise['all'](_0x31b464);}return[];})[_0xe4ec('0x28')](function(_0x2a5b6f){return{'rows':_0x2a5b6f,'count':_0x2a5b6f[_0xe4ec('0x36')]};})[_0xe4ec('0x28')](respondWithResult(_0x3b34b1,null))[_0xe4ec('0x42')](handleError(_0x3b34b1,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 4407b61..2b91737 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 _0xe617=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xe617,0xea));var _0x7e61=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe617[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x7e61('0x0'));var ChatInternalMessage=require(_0x7e61('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x7e61('0x2')](0x0);var events={'afterCreate':_0x7e61('0x3'),'afterUpdate':_0x7e61('0x4'),'afterDestroy':_0x7e61('0x5')};function emitEvent(_0xa7eaa9){return function(_0x33b206,_0x99b13e,_0x259abf){ChatInternalMessageEvents[_0x7e61('0x6')](_0xa7eaa9+':'+_0x33b206['id'],_0x33b206);ChatInternalMessageEvents['emit'](_0xa7eaa9,_0x33b206);_0x259abf(null);};}for(var e in events){if(events[_0x7e61('0x7')](e)){var event=events[e];ChatInternalMessage[_0x7e61('0x8')](e,emitEvent(event));}}module[_0x7e61('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xcea7=['setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x4581f7,_0x89ddf8){var _0x18686c=function(_0x21d74e){while(--_0x21d74e){_0x4581f7['push'](_0x4581f7['shift']());}};_0x18686c(++_0x89ddf8);}(_0xcea7,0xcf));var _0x7cea=function(_0x32d3d9,_0x1f4fb7){_0x32d3d9=_0x32d3d9-0x0;var _0x30b2d9=_0xcea7[_0x32d3d9];return _0x30b2d9;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x7cea('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x7cea('0x1')](0x0);var events={'afterCreate':_0x7cea('0x2'),'afterUpdate':_0x7cea('0x3'),'afterDestroy':_0x7cea('0x4')};function emitEvent(_0x3662f7){return function(_0x3697d1,_0x210eda,_0x2cf6e3){ChatInternalMessageEvents['emit'](_0x3662f7+':'+_0x3697d1['id'],_0x3697d1);ChatInternalMessageEvents[_0x7cea('0x5')](_0x3662f7,_0x3697d1);_0x2cf6e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x7cea('0x6')](e,emitEvent(event));}}module[_0x7cea('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index fd0c09c..f782e3c 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 _0x60a7=['api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1a3306,_0x2bcb81){var _0x48b05c=function(_0x49ad93){while(--_0x49ad93){_0x1a3306['push'](_0x1a3306['shift']());}};_0x48b05c(++_0x2bcb81);}(_0x60a7,0x18d));var _0x760a=function(_0x3c2c20,_0x236798){_0x3c2c20=_0x3c2c20-0x0;var _0x2e7926=_0x60a7[_0x3c2c20];return _0x2e7926;};'use strict';var _=require(_0x760a('0x0'));var util=require(_0x760a('0x1'));var logger=require(_0x760a('0x2'))(_0x760a('0x3'));var moment=require(_0x760a('0x4'));var BPromise=require(_0x760a('0x5'));var rp=require(_0x760a('0x6'));var fs=require('fs');var path=require(_0x760a('0x7'));var rimraf=require(_0x760a('0x8'));var config=require('../../config/environment');var attributes=require(_0x760a('0x9'));module[_0x760a('0xa')]=function(_0x24e5fd,_0x4ec800){return _0x24e5fd[_0x760a('0xb')](_0x760a('0xc'),attributes,{'tableName':_0x760a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x760a('0xe'),'collate':_0x760a('0xf')});}; \ No newline at end of file +var _0xf801=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages'];(function(_0x2d7c2f,_0x1822e8){var _0x4b65ee=function(_0x2d8ce5){while(--_0x2d8ce5){_0x2d7c2f['push'](_0x2d7c2f['shift']());}};_0x4b65ee(++_0x1822e8);}(_0xf801,0x1d0));var _0x1f80=function(_0x3f758f,_0x302451){_0x3f758f=_0x3f758f-0x0;var _0x26e4ae=_0xf801[_0x3f758f];return _0x26e4ae;};'use strict';var _=require(_0x1f80('0x0'));var util=require(_0x1f80('0x1'));var logger=require(_0x1f80('0x2'))(_0x1f80('0x3'));var moment=require(_0x1f80('0x4'));var BPromise=require(_0x1f80('0x5'));var rp=require(_0x1f80('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1f80('0x7'));var attributes=require(_0x1f80('0x8'));module['exports']=function(_0x29cc60,_0x2037e7){return _0x29cc60[_0x1f80('0x9')](_0x1f80('0xa'),attributes,{'tableName':_0x1f80('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1f80('0xc'),'collate':_0x1f80('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index f5f5284..fbee59d 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 _0xc2b1=['catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc2b1,0x1a1));var _0x1c2b=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0xc2b1[_0x4aa4e6];return _0x322588;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1c2b('0x0'));var BPromise=require('bluebird');var rs=require(_0x1c2b('0x1'));var fs=require('fs');var Redis=require(_0x1c2b('0x2'));var db=require(_0x1c2b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c2b('0x4'))(_0x1c2b('0x5'));var config=require('../../config/environment');var jayson=require(_0x1c2b('0x6'));var client=jayson[_0x1c2b('0x7')][_0x1c2b('0x8')]({'port':0x232a});config[_0x1c2b('0x9')]=_[_0x1c2b('0xa')](config[_0x1c2b('0x9')],{'host':_0x1c2b('0xb'),'port':0x18eb});var socket=require(_0x1c2b('0xc'))(new Redis(config[_0x1c2b('0x9')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0xf664d4,_0x289f26,_0x29a0f6){return new BPromise(function(_0x18bc96,_0x1e0f36){return client[_0x1c2b('0xd')](_0xf664d4,_0x29a0f6)[_0x1c2b('0xe')](function(_0x443622){logger[_0x1c2b('0xf')](_0x1c2b('0x10'),_0x289f26,'request\x20sent');logger[_0x1c2b('0x11')](_0x1c2b('0x12'),_0x289f26,_0x1c2b('0x13'),JSON[_0x1c2b('0x14')](_0x443622));if(_0x443622[_0x1c2b('0x15')]){if(_0x443622[_0x1c2b('0x15')][_0x1c2b('0x16')]===0x1f4){logger[_0x1c2b('0x15')](_0x1c2b('0x10'),_0x289f26,_0x443622[_0x1c2b('0x15')][_0x1c2b('0x17')]);return _0x1e0f36(_0x443622[_0x1c2b('0x15')]['message']);}logger[_0x1c2b('0x15')](_0x1c2b('0x10'),_0x289f26,_0x443622[_0x1c2b('0x15')][_0x1c2b('0x17')]);return _0x18bc96(_0x443622['error'][_0x1c2b('0x17')]);}else{logger[_0x1c2b('0xf')](_0x1c2b('0x10'),_0x289f26,'request\x20sent');_0x18bc96(_0x443622[_0x1c2b('0x18')][_0x1c2b('0x17')]);}})[_0x1c2b('0x19')](function(_0x472ba0){logger[_0x1c2b('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x289f26,_0x472ba0);_0x1e0f36(_0x472ba0);});});} \ No newline at end of file +var _0x66d2=['http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x31bbf7,_0x292c9a){var _0x1469f3=function(_0x58ca15){while(--_0x58ca15){_0x31bbf7['push'](_0x31bbf7['shift']());}};_0x1469f3(++_0x292c9a);}(_0x66d2,0x17b));var _0x266d=function(_0x83d702,_0x5cb1fd){_0x83d702=_0x83d702-0x0;var _0xa9410a=_0x66d2[_0x83d702];return _0xa9410a;};'use strict';var _=require(_0x266d('0x0'));var util=require(_0x266d('0x1'));var moment=require(_0x266d('0x2'));var BPromise=require(_0x266d('0x3'));var rs=require(_0x266d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x266d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x266d('0x6'))(_0x266d('0x7'));var config=require(_0x266d('0x8'));var jayson=require(_0x266d('0x9'));var client=jayson[_0x266d('0xa')][_0x266d('0xb')]({'port':0x232a});config[_0x266d('0xc')]=_['defaults'](config['redis'],{'host':_0x266d('0xd'),'port':0x18eb});var socket=require(_0x266d('0xe'))(new Redis(config['redis']));require(_0x266d('0xf'))[_0x266d('0x10')](socket);function respondWithRpcPromise(_0xffd53e,_0xe0e68e,_0x140242){return new BPromise(function(_0x396604,_0x5a9fbf){return client[_0x266d('0x11')](_0xffd53e,_0x140242)[_0x266d('0x12')](function(_0x18ff7d){logger[_0x266d('0x13')](_0x266d('0x14'),_0xe0e68e,_0x266d('0x15'));logger[_0x266d('0x16')](_0x266d('0x17'),_0xe0e68e,'request\x20sent',JSON[_0x266d('0x18')](_0x18ff7d));if(_0x18ff7d['error']){if(_0x18ff7d[_0x266d('0x19')][_0x266d('0x1a')]===0x1f4){logger['error'](_0x266d('0x14'),_0xe0e68e,_0x18ff7d[_0x266d('0x19')]['message']);return _0x5a9fbf(_0x18ff7d[_0x266d('0x19')][_0x266d('0x1b')]);}logger[_0x266d('0x19')](_0x266d('0x14'),_0xe0e68e,_0x18ff7d[_0x266d('0x19')][_0x266d('0x1b')]);return _0x396604(_0x18ff7d[_0x266d('0x19')]['message']);}else{logger[_0x266d('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0xe0e68e,_0x266d('0x15'));_0x396604(_0x18ff7d[_0x266d('0x1c')][_0x266d('0x1b')]);}})[_0x266d('0x1d')](function(_0x12f5f9){logger[_0x266d('0x19')](_0x266d('0x14'),_0xe0e68e,_0x12f5f9);_0x5a9fbf(_0x12f5f9);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index d302c9f..366f58e 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 _0xb373=['removeListener','register','length','chatInternalMessage:','save','remove','update','emit'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0xb373,0x12c));var _0x3b37=function(_0x312f25,_0x1c870f){_0x312f25=_0x312f25-0x0;var _0x56bdec=_0xb373[_0x312f25];return _0x56bdec;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x3b37('0x0'),_0x3b37('0x1'),_0x3b37('0x2')];function createListener(_0x1e176a,_0x34e1a9){return function(_0x1ffb0e){_0x34e1a9[_0x3b37('0x3')](_0x1e176a,_0x1ffb0e);};}function removeListener(_0x24be6b,_0x38956a){return function(){ChatInternalMessageEvents[_0x3b37('0x4')](_0x24be6b,_0x38956a);};}exports[_0x3b37('0x5')]=function(_0x556d9b){for(var _0x4ee2c0=0x0,_0x1bcc3f=events[_0x3b37('0x6')];_0x4ee2c0<_0x1bcc3f;_0x4ee2c0++){var _0x119c16=events[_0x4ee2c0];var _0x2d1d86=createListener(_0x3b37('0x7')+_0x119c16,_0x556d9b);ChatInternalMessageEvents['on'](_0x119c16,_0x2d1d86);}}; \ No newline at end of file +var _0xf64f=['update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x4b7377,_0x261c01){var _0x11a7b5=function(_0x1407cc){while(--_0x1407cc){_0x4b7377['push'](_0x4b7377['shift']());}};_0x11a7b5(++_0x261c01);}(_0xf64f,0x86));var _0xff64=function(_0x2dc760,_0x12de5b){_0x2dc760=_0x2dc760-0x0;var _0x3d97d7=_0xf64f[_0x2dc760];return _0x3d97d7;};'use strict';var ChatInternalMessageEvents=require(_0xff64('0x0'));var events=[_0xff64('0x1'),'remove',_0xff64('0x2')];function createListener(_0xf7c36a,_0x444734){return function(_0x1a2a5e){_0x444734[_0xff64('0x3')](_0xf7c36a,_0x1a2a5e);};}function removeListener(_0x1d5de6,_0x23c839){return function(){ChatInternalMessageEvents[_0xff64('0x4')](_0x1d5de6,_0x23c839);};}exports[_0xff64('0x5')]=function(_0x268984){for(var _0x35829e=0x0,_0x3a9598=events[_0xff64('0x6')];_0x35829e<_0x3a9598;_0x35829e++){var _0x4d39c1=events[_0x35829e];var _0xc03bf8=createListener(_0xff64('0x7')+_0x4d39c1,_0x268984);ChatInternalMessageEvents['on'](_0x4d39c1,_0xc03bf8);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index cae0bd8..d6c62ab 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 _0x7211=['isAuthenticated','describe','getUsers','show','post','create','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index'];(function(_0x19be15,_0x5271d3){var _0x28b46d=function(_0x42a622){while(--_0x42a622){_0x19be15['push'](_0x19be15['shift']());}};_0x28b46d(++_0x5271d3);}(_0x7211,0x123));var _0x1721=function(_0x373d70,_0xcc109e){_0x373d70=_0x373d70-0x0;var _0x42861c=_0x7211[_0x373d70];return _0x42861c;};'use strict';var multer=require('multer');var util=require(_0x1721('0x0'));var path=require(_0x1721('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1721('0x2'));var auth=require(_0x1721('0x3'));var interaction=require(_0x1721('0x4'));var config=require(_0x1721('0x5'));var controller=require(_0x1721('0x6'));router[_0x1721('0x7')]('/',auth['isAuthenticated'](),controller[_0x1721('0x8')]);router[_0x1721('0x7')]('/describe',auth[_0x1721('0x9')](),controller[_0x1721('0xa')]);router[_0x1721('0x7')]('/users',auth[_0x1721('0x9')](),controller[_0x1721('0xb')]);router[_0x1721('0x7')]('/:id',auth[_0x1721('0x9')](),controller[_0x1721('0xc')]);router[_0x1721('0xd')]('/',auth[_0x1721('0x9')](),controller[_0x1721('0xe')]);router['put'](_0x1721('0xf'),controller[_0x1721('0x10')]);router[_0x1721('0x11')](_0x1721('0xf'),auth[_0x1721('0x9')](),controller[_0x1721('0x12')]);module[_0x1721('0x13')]=router; \ No newline at end of file +var _0xb0b7=['post','create','put','update','delete','multer','util','path','../../config/environment','isAuthenticated','index','/describe','describe','get','/users','getUsers','/:id'];(function(_0x4d6bfd,_0x8d79ff){var _0x243a46=function(_0x3883b1){while(--_0x3883b1){_0x4d6bfd['push'](_0x4d6bfd['shift']());}};_0x243a46(++_0x8d79ff);}(_0xb0b7,0x17b));var _0x7b0b=function(_0x4264bf,_0x39db0f){_0x4264bf=_0x4264bf-0x0;var _0x515e5f=_0xb0b7[_0x4264bf];return _0x515e5f;};'use strict';var multer=require(_0x7b0b('0x0'));var util=require(_0x7b0b('0x1'));var path=require(_0x7b0b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7b0b('0x3'));var controller=require('./chatInternalMessage.controller');router['get']('/',auth[_0x7b0b('0x4')](),controller[_0x7b0b('0x5')]);router['get'](_0x7b0b('0x6'),auth['isAuthenticated'](),controller[_0x7b0b('0x7')]);router[_0x7b0b('0x8')](_0x7b0b('0x9'),auth[_0x7b0b('0x4')](),controller[_0x7b0b('0xa')]);router['get'](_0x7b0b('0xb'),auth[_0x7b0b('0x4')](),controller['show']);router[_0x7b0b('0xc')]('/',auth[_0x7b0b('0x4')](),controller[_0x7b0b('0xd')]);router[_0x7b0b('0xe')](_0x7b0b('0xb'),controller[_0x7b0b('0xf')]);router[_0x7b0b('0x10')](_0x7b0b('0xb'),auth[_0x7b0b('0x4')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 49d89c0..debc84f 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 _0x97e6=['out','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x4ed4c0,_0x4b6d7d){var _0x191144=function(_0x33400e){while(--_0x33400e){_0x4ed4c0['push'](_0x4ed4c0['shift']());}};_0x191144(++_0x4b6d7d);}(_0x97e6,0x159));var _0x697e=function(_0x28db86,_0x45d20f){_0x28db86=_0x28db86-0x0;var _0x3b0ae7=_0x97e6[_0x28db86];return _0x3b0ae7;};'use strict';var Sequelize=require(_0x697e('0x0'));module['exports']={'body':{'type':Sequelize[_0x697e('0x1')](_0x697e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x697e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x697e('0x4')]('in',_0x697e('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x697e('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x697e('0x1')]}}; \ No newline at end of file +var _0x1707=['BOOLEAN','out','DATE','STRING','TEXT','sequelize'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x1707,0x1df));var _0x7170=function(_0x1b6b3a,_0x43205b){_0x1b6b3a=_0x1b6b3a-0x0;var _0x434d93=_0x1707[_0x1b6b3a];return _0x434d93;};'use strict';var Sequelize=require(_0x7170('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7170('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7170('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7170('0x2')),'defaultValue':_0x7170('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7170('0x3')]},'providerName':{'type':Sequelize[_0x7170('0x4')]},'providerResponse':{'type':Sequelize[_0x7170('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 359997d..6ea5084 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 _0xfc2f=['fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','body','params','describe','accept','chat','read','readAt','format','user','agent','get','ChatInteraction','ChatInteractionId','UserId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','RejectMessage','QueryTypes','interface','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','update','destroy','end','send','index','map','ChatMessage','fieldName','type','key','model','name','query','keys','intersection','attributes'];(function(_0x584442,_0x50b5d2){var _0x418504=function(_0x4d8234){while(--_0x4d8234){_0x584442['push'](_0x584442['shift']());}};_0x418504(++_0x50b5d2);}(_0xfc2f,0xc4));var _0xffc2=function(_0x46d58b,_0x317d7f){_0x46d58b=_0x46d58b-0x0;var _0x6b93cb=_0xfc2f[_0x46d58b];return _0x6b93cb;};'use strict';var emlformat=require(_0xffc2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xffc2('0x1'));var jsonpatch=require(_0xffc2('0x2'));var rp=require(_0xffc2('0x3'));var moment=require(_0xffc2('0x4'));var BPromise=require(_0xffc2('0x5'));var Mustache=require(_0xffc2('0x6'));var util=require(_0xffc2('0x7'));var path=require(_0xffc2('0x8'));var sox=require(_0xffc2('0x9'));var csv=require(_0xffc2('0xa'));var ejs=require(_0xffc2('0xb'));var fs=require('fs');var fs_extra=require(_0xffc2('0xc'));var _=require(_0xffc2('0xd'));var squel=require(_0xffc2('0xe'));var crypto=require('crypto');var jsforce=require(_0xffc2('0xf'));var deskjs=require(_0xffc2('0x10'));var toCsv=require(_0xffc2('0xa'));var querystring=require(_0xffc2('0x11'));var Papa=require(_0xffc2('0x12'));var Redis=require(_0xffc2('0x13'));var authService=require(_0xffc2('0x14'));var qs=require(_0xffc2('0x15'));var as=require(_0xffc2('0x16'));var hardwareService=require(_0xffc2('0x17'));var logger=require(_0xffc2('0x18'))(_0xffc2('0x19'));var utils=require(_0xffc2('0x1a'));var config=require(_0xffc2('0x1b'));var licenseUtil=require(_0xffc2('0x1c'));var db=require(_0xffc2('0x1d'))['db'];config[_0xffc2('0x1e')]=_[_0xffc2('0x1f')](config[_0xffc2('0x1e')],{'host':_0xffc2('0x20'),'port':0x18eb});var socket=require(_0xffc2('0x21'))(new Redis(config[_0xffc2('0x1e')]));require(_0xffc2('0x22'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xffc2('0x23')][_0xffc2('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x538a4e,_0x4e9e74,_0x4644d,_0x2bd13f){return new BPromise(function(_0x3d65da,_0x5b3eaf){var _0x535323=_0x2bd13f||client;return _0x535323[_0xffc2('0x25')](_0x538a4e,_0x4644d)[_0xffc2('0x26')](function(_0x149509){logger[_0xffc2('0x27')](_0xffc2('0x28'),_0x4e9e74,_0xffc2('0x29'));logger[_0xffc2('0x2a')](_0xffc2('0x2b'),_0x4e9e74,_0xffc2('0x29'),JSON[_0xffc2('0x2c')](_0x149509));if(_0x149509['error']){if(_0x149509[_0xffc2('0x2d')]['code']===0x1f4){logger[_0xffc2('0x2d')](_0xffc2('0x28'),_0x4e9e74,_0x149509['error'][_0xffc2('0x2e')]);return _0x5b3eaf(_0x149509['error'][_0xffc2('0x2e')]);}logger[_0xffc2('0x2d')](_0xffc2('0x28'),_0x4e9e74,_0x149509[_0xffc2('0x2d')]['message']);return _0x3d65da(_0x149509[_0xffc2('0x2d')][_0xffc2('0x2e')]);}else{logger['info'](_0xffc2('0x28'),_0x4e9e74,'request\x20sent');_0x3d65da(_0x149509['result'][_0xffc2('0x2e')]);}})[_0xffc2('0x2f')](function(_0x158ab1){logger['error']('ChatMessage,\x20%s,\x20%s',_0x4e9e74,_0x158ab1);_0x5b3eaf(_0x158ab1);});});}function respondWithStatusCode(_0x562a28,_0x32b91b){_0x32b91b=_0x32b91b||0xcc;return function(_0x161b80){if(_0x161b80){return _0x562a28[_0xffc2('0x30')](_0x32b91b);}return _0x562a28[_0xffc2('0x31')](_0x32b91b)['end']();};}function respondWithResult(_0x39045c,_0x558ece){_0x558ece=_0x558ece||0xc8;return function(_0x4f50ef){if(_0x4f50ef){return _0x39045c[_0xffc2('0x31')](_0x558ece)[_0xffc2('0x32')](_0x4f50ef);}};}function respondWithFilteredResult(_0x2e44b8,_0x24fc3b){return function(_0x283710){if(_0x283710){var _0x18abfa=typeof _0x24fc3b['offset']==='undefined'&&typeof _0x24fc3b[_0xffc2('0x33')]==='undefined';var _0x325e3e=_0x283710[_0xffc2('0x34')];var _0x414c47=_0x18abfa?0x0:_0x24fc3b['offset'];var _0x242aea=_0x18abfa?_0x283710[_0xffc2('0x34')]:_0x24fc3b[_0xffc2('0x35')]+_0x24fc3b[_0xffc2('0x33')];var _0x23862d;if(_0x242aea>=_0x325e3e){_0x242aea=_0x325e3e;_0x23862d=0xc8;}else{_0x23862d=0xce;}_0x2e44b8['status'](_0x23862d);return _0x2e44b8[_0xffc2('0x36')](_0xffc2('0x37'),_0x414c47+'-'+_0x242aea+'/'+_0x325e3e)[_0xffc2('0x32')](_0x283710);}return null;};}function patchUpdates(_0x2f0a32){return function(_0x1841d1){try{jsonpatch[_0xffc2('0x38')](_0x1841d1,_0x2f0a32,!![]);}catch(_0x420d09){return BPromise[_0xffc2('0x39')](_0x420d09);}return _0x1841d1['save']();};}function saveUpdates(_0x2961b8,_0x29d25e){return function(_0x442018){if(_0x442018){return _0x442018[_0xffc2('0x3a')](_0x2961b8)[_0xffc2('0x26')](function(_0x47734b){return _0x47734b;});}return null;};}function removeEntity(_0xd0c898,_0x29a75c){return function(_0x1235a8){if(_0x1235a8){return _0x1235a8[_0xffc2('0x3b')]()[_0xffc2('0x26')](function(){_0xd0c898[_0xffc2('0x31')](0xcc)[_0xffc2('0x3c')]();});}};}function handleEntityNotFound(_0x27ffcc,_0x29e8de){return function(_0x1e9e69){if(!_0x1e9e69){_0x27ffcc['sendStatus'](0x194);}return _0x1e9e69;};}function handleError(_0x567ddb,_0x506953){_0x506953=_0x506953||0x1f4;return function(_0x271c22){logger[_0xffc2('0x2d')](_0x271c22['stack']);if(_0x271c22['name']){delete _0x271c22['name'];}_0x567ddb[_0xffc2('0x31')](_0x506953)[_0xffc2('0x3d')](_0x271c22);};}exports[_0xffc2('0x3e')]=function(_0x1db6d2,_0x502344){var _0x9a9b22={},_0x2a951a={},_0x418cb4={'count':0x0,'rows':[]};var _0x1ea85f=_[_0xffc2('0x3f')](db[_0xffc2('0x40')]['rawAttributes'],function(_0x252136){return{'name':_0x252136[_0xffc2('0x41')],'type':_0x252136[_0xffc2('0x42')][_0xffc2('0x43')]};});_0x2a951a[_0xffc2('0x44')]=_[_0xffc2('0x3f')](_0x1ea85f,_0xffc2('0x45'));_0x2a951a[_0xffc2('0x46')]=_[_0xffc2('0x47')](_0x1db6d2['query']);_0x2a951a['filters']=_[_0xffc2('0x48')](_0x2a951a['model'],_0x2a951a[_0xffc2('0x46')]);_0x9a9b22[_0xffc2('0x49')]=_[_0xffc2('0x48')](_0x2a951a[_0xffc2('0x44')],qs[_0xffc2('0x4a')](_0x1db6d2[_0xffc2('0x46')][_0xffc2('0x4a')]));_0x9a9b22[_0xffc2('0x49')]=_0x9a9b22[_0xffc2('0x49')][_0xffc2('0x4b')]?_0x9a9b22['attributes']:_0x2a951a[_0xffc2('0x44')];if(!_0x1db6d2[_0xffc2('0x46')][_0xffc2('0x4c')](_0xffc2('0x4d'))){_0x9a9b22['limit']=qs[_0xffc2('0x33')](_0x1db6d2['query'][_0xffc2('0x33')]);_0x9a9b22[_0xffc2('0x35')]=qs[_0xffc2('0x35')](_0x1db6d2[_0xffc2('0x46')][_0xffc2('0x35')]);}_0x9a9b22[_0xffc2('0x4e')]=qs['sort'](_0x1db6d2['query']['sort']);_0x9a9b22[_0xffc2('0x4f')]=qs[_0xffc2('0x50')](_[_0xffc2('0x51')](_0x1db6d2[_0xffc2('0x46')],_0x2a951a[_0xffc2('0x50')]),_0x1ea85f);if(_0x1db6d2[_0xffc2('0x46')][_0xffc2('0x52')]){_0x9a9b22['where']=_[_0xffc2('0x53')](_0x9a9b22[_0xffc2('0x4f')],{'$or':_[_0xffc2('0x3f')](_0x1ea85f,function(_0x5a3eba){if(_0x5a3eba[_0xffc2('0x42')]!==_0xffc2('0x54')){var _0x3473f1={};_0x3473f1[_0x5a3eba[_0xffc2('0x45')]]={'$like':'%'+_0x1db6d2[_0xffc2('0x46')][_0xffc2('0x52')]+'%'};return _0x3473f1;}})});}_0x9a9b22=_['merge']({},_0x9a9b22,_0x1db6d2[_0xffc2('0x55')]);var _0x4c91cc={'where':_0x9a9b22[_0xffc2('0x4f')]};return db[_0xffc2('0x40')][_0xffc2('0x34')](_0x4c91cc)['then'](function(_0x5e7944){_0x418cb4[_0xffc2('0x34')]=_0x5e7944;if(_0x1db6d2[_0xffc2('0x46')][_0xffc2('0x56')]){_0x9a9b22[_0xffc2('0x57')]=[{'all':!![]}];}return db[_0xffc2('0x40')][_0xffc2('0x58')](_0x9a9b22);})[_0xffc2('0x26')](function(_0x3c8a88){_0x418cb4[_0xffc2('0x59')]=_0x3c8a88;return _0x418cb4;})[_0xffc2('0x26')](respondWithFilteredResult(_0x502344,_0x9a9b22))[_0xffc2('0x2f')](handleError(_0x502344,null));};exports[_0xffc2('0x5a')]=function(_0xe27508,_0x5795c0){var _0x42c9f7={'raw':!![],'where':{'id':_0xe27508['params']['id']}},_0x1b75cb={};_0x1b75cb[_0xffc2('0x44')]=_['keys'](db[_0xffc2('0x40')]['rawAttributes']);_0x1b75cb[_0xffc2('0x46')]=_['keys'](_0xe27508[_0xffc2('0x46')]);_0x1b75cb['filters']=_[_0xffc2('0x48')](_0x1b75cb[_0xffc2('0x44')],_0x1b75cb[_0xffc2('0x46')]);_0x42c9f7[_0xffc2('0x49')]=_[_0xffc2('0x48')](_0x1b75cb[_0xffc2('0x44')],qs[_0xffc2('0x4a')](_0xe27508[_0xffc2('0x46')]['fields']));_0x42c9f7['attributes']=_0x42c9f7['attributes'][_0xffc2('0x4b')]?_0x42c9f7[_0xffc2('0x49')]:_0x1b75cb[_0xffc2('0x44')];if(_0xe27508[_0xffc2('0x46')][_0xffc2('0x56')]){_0x42c9f7[_0xffc2('0x57')]=[{'all':!![]}];}_0x42c9f7=_[_0xffc2('0x53')]({},_0x42c9f7,_0xe27508[_0xffc2('0x55')]);return db[_0xffc2('0x40')][_0xffc2('0x5b')](_0x42c9f7)[_0xffc2('0x26')](handleEntityNotFound(_0x5795c0,null))['then'](respondWithResult(_0x5795c0,null))[_0xffc2('0x2f')](handleError(_0x5795c0,null));};exports['create']=function(_0x537078,_0x5d7bf9){return db['ChatMessage']['create'](_0x537078[_0xffc2('0x5c')],{})[_0xffc2('0x26')](respondWithResult(_0x5d7bf9,0xc9))[_0xffc2('0x2f')](handleError(_0x5d7bf9,null));};exports[_0xffc2('0x3a')]=function(_0x4ad478,_0x7c0f82){if(_0x4ad478[_0xffc2('0x5c')]['id']){delete _0x4ad478[_0xffc2('0x5c')]['id'];}return db[_0xffc2('0x40')][_0xffc2('0x5b')]({'where':{'id':_0x4ad478[_0xffc2('0x5d')]['id']}})[_0xffc2('0x26')](handleEntityNotFound(_0x7c0f82,null))[_0xffc2('0x26')](saveUpdates(_0x4ad478['body'],null))[_0xffc2('0x26')](respondWithResult(_0x7c0f82,null))[_0xffc2('0x2f')](handleError(_0x7c0f82,null));};exports[_0xffc2('0x3b')]=function(_0x42412e,_0x4322ce){return db[_0xffc2('0x40')][_0xffc2('0x5b')]({'where':{'id':_0x42412e['params']['id']}})[_0xffc2('0x26')](handleEntityNotFound(_0x4322ce,null))['then'](removeEntity(_0x4322ce,null))[_0xffc2('0x2f')](handleError(_0x4322ce,null));};exports[_0xffc2('0x5e')]=function(_0x1fd7b8,_0x3c4256){return db[_0xffc2('0x40')][_0xffc2('0x5e')]()[_0xffc2('0x26')](respondWithResult(_0x3c4256,null))[_0xffc2('0x2f')](handleError(_0x3c4256,null));};var interaction_log=require(_0xffc2('0x18'))('chat-interactions');exports[_0xffc2('0x5f')]=function(_0xedc20,_0x501d81,_0x15e00d){var _0x2e9e17={'agent':{},'channel':_0xffc2('0x60')};if(_0xedc20[_0xffc2('0x5c')]['id']){delete _0xedc20[_0xffc2('0x5c')]['id'];}_0xedc20['body'][_0xffc2('0x61')]=!![];_0xedc20[_0xffc2('0x5c')][_0xffc2('0x62')]=moment()[_0xffc2('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0xedc20[_0xffc2('0x5c')]['UserId']=_0xedc20['body']['UserId']||_0xedc20[_0xffc2('0x64')]['id'];_0x2e9e17[_0xffc2('0x65')]['id']=_0xedc20['body']['UserId'];return db['ChatMessage']['find']({'where':{'id':_0xedc20['params']['id'],'UserId':null}})[_0xffc2('0x26')](handleEntityNotFound(_0x501d81,null))['then'](saveUpdates(_0xedc20[_0xffc2('0x5c')],null))[_0xffc2('0x26')](function(_0x136b49){if(_0x136b49){_0x2e9e17[_0xffc2('0x2e')]=_0x136b49[_0xffc2('0x66')]({'plain':!![]});return db[_0xffc2('0x67')][_0xffc2('0x5b')]({'where':{'id':_0x136b49[_0xffc2('0x68')]}});}return null;})[_0xffc2('0x26')](handleEntityNotFound(_0x501d81,null))[_0xffc2('0x26')](function(_0x4aa9f0){if(_0x4aa9f0){return _0x4aa9f0[_0xffc2('0x3a')]({'UserId':_0xedc20[_0xffc2('0x5c')][_0xffc2('0x69')],'read1stAt':_['isNil'](_0x4aa9f0[_0xffc2('0x6a')])?moment()[_0xffc2('0x63')](_0xffc2('0x6b')):undefined});}return null;})['then'](function(_0x1d7a60){if(_0x1d7a60){_0x2e9e17[_0xffc2('0x6c')]=_0x1d7a60[_0xffc2('0x66')]({'plain':!![]});interaction_log['info'](_0xffc2('0x6d'),_0xedc20[_0xffc2('0x64')]['id'],_0xedc20[_0xffc2('0x64')][_0xffc2('0x45')],_0xedc20[_0xffc2('0x64')][_0xffc2('0x6e')],_0x2e9e17['interaction']['id'],_0xedc20[_0xffc2('0x5c')]?JSON['stringify'](_0xedc20['body']):_0xffc2('0x6f'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2e9e17);}return null;})[_0xffc2('0x26')](function(_0x2aedf3){var _0x380202=_0xffc2('0x70')+_0x2aedf3[_0xffc2('0x2e')][_0xffc2('0x71')];return db[_0xffc2('0x72')][_0xffc2('0x46')](_0x380202,{'type':db[_0xffc2('0x73')]['QueryTypes'][_0xffc2('0x74')],'raw':!![]})[_0xffc2('0x26')](function(_0x26d916){return _0x26d916;});})[_0xffc2('0x26')](function(_0x1805f0){if(_0x1805f0){_0x2e9e17['message'][_0xffc2('0x75')]=_0x1805f0[0x0];if(!_0xedc20[_0xffc2('0x5c')]['UserId'])return;return db[_0xffc2('0x76')][_0xffc2('0x5b')]({'where':{'id':_0xedc20['body'][_0xffc2('0x69')],'role':_0xffc2('0x65')},'attributes':['id',_0xffc2('0x45'),_0xffc2('0x77'),_0xffc2('0x78'),_0xffc2('0x79')],'raw':!![]});}return null;})[_0xffc2('0x26')](function(_0x592877){if(!_0x592877)return null;_0x2e9e17[_0xffc2('0x2e')][_0xffc2('0x65')]=_0x592877;return _0x2e9e17;})[_0xffc2('0x26')](function(_0xf3dd13){if(_0xf3dd13){if(_0xedc20[_0xffc2('0x5c')][_0xffc2('0x7a')]){_0x2e9e17['message']['interface']=util[_0xffc2('0x63')](_0xffc2('0x7b'),_0xedc20[_0xffc2('0x64')]['name']);_0x2e9e17['message'][_0xffc2('0x7c')]=_0x2e9e17[_0xffc2('0x7c')];_0x2e9e17['message'][_0xffc2('0x7d')]=_0x2e9e17[_0xffc2('0x7c')];_0x2e9e17[_0xffc2('0x2e')][_0xffc2('0x7e')]='accept';return respondWithRpcPromise(_0xffc2('0x7f'),_0xffc2('0x7f'),{'event':_0xffc2('0x80'),'message':_[_0xffc2('0x53')](_0x2e9e17['message'],JSON[_0xffc2('0x81')](_0x2e9e17[_0xffc2('0x6c')][_0xffc2('0x82')]))},client9002)[_0xffc2('0x26')](function(){return _0x2e9e17;});}return _0x2e9e17;}return null;})[_0xffc2('0x26')](respondWithResult(_0x501d81,null))['catch'](handleError(_0x501d81,null));};var interaction_log=require(_0xffc2('0x18'))('chat-interactions');exports['reject']=function(_0x553e00,_0x4eb5d1,_0x4056e8){var _0x4261ba={'agent':{},'channel':'chat'};if(_0x553e00[_0xffc2('0x5c')]['id']){delete _0x553e00[_0xffc2('0x5c')]['id'];}_0x553e00[_0xffc2('0x5c')]['UserId']=_0x553e00[_0xffc2('0x5c')][_0xffc2('0x69')]||_0x553e00[_0xffc2('0x64')]['id'];_0x4261ba[_0xffc2('0x65')]['id']=_0x553e00[_0xffc2('0x5c')][_0xffc2('0x69')];return db[_0xffc2('0x40')][_0xffc2('0x5b')]({'where':{'id':_0x553e00[_0xffc2('0x5d')]['id'],'UserId':null}})[_0xffc2('0x26')](handleEntityNotFound(_0x4eb5d1,null))[_0xffc2('0x26')](function(_0x1ebab2){if(_0x1ebab2){_0x4261ba[_0xffc2('0x2e')]=_0x1ebab2[_0xffc2('0x66')]({'plain':!![]});return db[_0xffc2('0x67')][_0xffc2('0x5b')]({'where':{'id':_0x1ebab2[_0xffc2('0x68')]}});}return null;})[_0xffc2('0x26')](handleEntityNotFound(_0x4eb5d1,null))[_0xffc2('0x26')](function(_0x517896){if(_0x517896){_0x4261ba[_0xffc2('0x6c')]=_0x517896['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x553e00[_0xffc2('0x64')]['id'],_0x553e00[_0xffc2('0x64')][_0xffc2('0x45')],_0x553e00[_0xffc2('0x64')]['role'],_0x4261ba['interaction']['id'],_0x553e00[_0xffc2('0x5c')]?JSON[_0xffc2('0x2c')](_0x553e00[_0xffc2('0x5c')]):_0xffc2('0x6f'));return respondWithRpcPromise(_0xffc2('0x83'),'rejectMessage',_0x4261ba);}return null;})['then'](function(_0x5cb116){var _0x43c1da=_0xffc2('0x70')+_0x5cb116['message'][_0xffc2('0x71')];return db[_0xffc2('0x72')]['query'](_0x43c1da,{'type':db[_0xffc2('0x73')][_0xffc2('0x84')][_0xffc2('0x74')],'raw':!![]})[_0xffc2('0x26')](function(_0x17b90d){return _0x17b90d;});})[_0xffc2('0x26')](function(_0x454d4d){if(_0x454d4d){_0x4261ba[_0xffc2('0x2e')][_0xffc2('0x75')]=_0x454d4d[0x0];if(!_0x553e00[_0xffc2('0x5c')][_0xffc2('0x69')])return;return db[_0xffc2('0x76')][_0xffc2('0x5b')]({'where':{'id':_0x553e00['body'][_0xffc2('0x69')],'role':_0xffc2('0x65')},'attributes':['id',_0xffc2('0x45'),_0xffc2('0x77'),_0xffc2('0x78'),'internal'],'raw':!![]});}return null;})[_0xffc2('0x26')](function(_0x498acf){if(!_0x498acf)return null;_0x4261ba[_0xffc2('0x2e')][_0xffc2('0x65')]=_0x498acf;return _0x4261ba;})[_0xffc2('0x26')](function(_0xd718e2){if(_0xd718e2){_0xd718e2[_0xffc2('0x2e')][_0xffc2('0x85')]=util['format']('SIP/%s',_0x553e00['user'][_0xffc2('0x45')]);_0xd718e2[_0xffc2('0x2e')][_0xffc2('0x7c')]=_0x4261ba[_0xffc2('0x7c')];_0xd718e2['message'][_0xffc2('0x7d')]=_0x4261ba['channel'];_0xd718e2[_0xffc2('0x2e')]['event']='reject';respondWithRpcPromise(_0xffc2('0x7f'),_0xffc2('0x7f'),{'event':_0xffc2('0x86'),'message':_[_0xffc2('0x53')](_0x4261ba['message'],JSON[_0xffc2('0x81')](_0x4261ba[_0xffc2('0x6c')][_0xffc2('0x82')]))},client9002);return _0x4261ba;}return null;})['then'](respondWithResult(_0x4eb5d1,null))['catch'](handleError(_0x4eb5d1,null));}; \ No newline at end of file +var _0x4f61=['QueryTypes','contact','User','email','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT','fullname','rejectmessage','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','ChatMessage','fieldName','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','count','includeAll','include','findAll','show','params','rawAttributes','merge','create','body','find','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize'];(function(_0x42225e,_0x1164f2){var _0x2bf9e5=function(_0x3762d6){while(--_0x3762d6){_0x42225e['push'](_0x42225e['shift']());}};_0x2bf9e5(++_0x1164f2);}(_0x4f61,0x9a));var _0x14f6=function(_0x55b5a9,_0x339873){_0x55b5a9=_0x55b5a9-0x0;var _0x58a726=_0x4f61[_0x55b5a9];return _0x58a726;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x14f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14f6('0x1'));var rp=require('request-promise');var moment=require(_0x14f6('0x2'));var BPromise=require(_0x14f6('0x3'));var Mustache=require(_0x14f6('0x4'));var util=require(_0x14f6('0x5'));var path=require(_0x14f6('0x6'));var sox=require(_0x14f6('0x7'));var csv=require(_0x14f6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x14f6('0x9'));var _=require(_0x14f6('0xa'));var squel=require(_0x14f6('0xb'));var crypto=require(_0x14f6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x14f6('0xd'));var toCsv=require(_0x14f6('0x8'));var querystring=require(_0x14f6('0xe'));var Papa=require(_0x14f6('0xf'));var Redis=require('ioredis');var authService=require(_0x14f6('0x10'));var qs=require(_0x14f6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14f6('0x12'));var logger=require(_0x14f6('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x14f6('0x14'));var licenseUtil=require(_0x14f6('0x15'));var db=require(_0x14f6('0x16'))['db'];config[_0x14f6('0x17')]=_[_0x14f6('0x18')](config[_0x14f6('0x17')],{'host':_0x14f6('0x19'),'port':0x18eb});var socket=require(_0x14f6('0x1a'))(new Redis(config[_0x14f6('0x17')]));require('./chatMessage.socket')[_0x14f6('0x1b')](socket);var jayson=require(_0x14f6('0x1c'));var client=jayson[_0x14f6('0x1d')][_0x14f6('0x1e')]({'port':0x232c});var client9002=jayson[_0x14f6('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e23bb,_0x30919e,_0x4ca684,_0x1fd8c1){return new BPromise(function(_0xd42cd1,_0x490915){var _0x159294=_0x1fd8c1||client;return _0x159294['request'](_0x5e23bb,_0x4ca684)[_0x14f6('0x1f')](function(_0x5a5ca8){logger['info'](_0x14f6('0x20'),_0x30919e,'request\x20sent');logger[_0x14f6('0x21')](_0x14f6('0x22'),_0x30919e,_0x14f6('0x23'),JSON[_0x14f6('0x24')](_0x5a5ca8));if(_0x5a5ca8[_0x14f6('0x25')]){if(_0x5a5ca8['error'][_0x14f6('0x26')]===0x1f4){logger[_0x14f6('0x25')](_0x14f6('0x20'),_0x30919e,_0x5a5ca8[_0x14f6('0x25')][_0x14f6('0x27')]);return _0x490915(_0x5a5ca8[_0x14f6('0x25')][_0x14f6('0x27')]);}logger[_0x14f6('0x25')](_0x14f6('0x20'),_0x30919e,_0x5a5ca8[_0x14f6('0x25')][_0x14f6('0x27')]);return _0xd42cd1(_0x5a5ca8[_0x14f6('0x25')]['message']);}else{logger[_0x14f6('0x28')](_0x14f6('0x20'),_0x30919e,'request\x20sent');_0xd42cd1(_0x5a5ca8[_0x14f6('0x29')][_0x14f6('0x27')]);}})[_0x14f6('0x2a')](function(_0x53c8df){logger['error'](_0x14f6('0x20'),_0x30919e,_0x53c8df);_0x490915(_0x53c8df);});});}function respondWithStatusCode(_0x2b2c65,_0x41a29c){_0x41a29c=_0x41a29c||0xcc;return function(_0x2c7b1d){if(_0x2c7b1d){return _0x2b2c65[_0x14f6('0x2b')](_0x41a29c);}return _0x2b2c65['status'](_0x41a29c)[_0x14f6('0x2c')]();};}function respondWithResult(_0x513dc8,_0x5733a0){_0x5733a0=_0x5733a0||0xc8;return function(_0x5948da){if(_0x5948da){return _0x513dc8[_0x14f6('0x2d')](_0x5733a0)[_0x14f6('0x2e')](_0x5948da);}};}function respondWithFilteredResult(_0x414c91,_0x221e0d){return function(_0x3c7621){if(_0x3c7621){var _0x383bdb=typeof _0x221e0d[_0x14f6('0x2f')]===_0x14f6('0x30')&&typeof _0x221e0d[_0x14f6('0x31')]===_0x14f6('0x30');var _0x56912d=_0x3c7621['count'];var _0x22f574=_0x383bdb?0x0:_0x221e0d['offset'];var _0x52200b=_0x383bdb?_0x3c7621['count']:_0x221e0d[_0x14f6('0x2f')]+_0x221e0d['limit'];var _0x4b3c5a;if(_0x52200b>=_0x56912d){_0x52200b=_0x56912d;_0x4b3c5a=0xc8;}else{_0x4b3c5a=0xce;}_0x414c91[_0x14f6('0x2d')](_0x4b3c5a);return _0x414c91[_0x14f6('0x32')](_0x14f6('0x33'),_0x22f574+'-'+_0x52200b+'/'+_0x56912d)['json'](_0x3c7621);}return null;};}function patchUpdates(_0x551a85){return function(_0x33fb9d){try{jsonpatch[_0x14f6('0x34')](_0x33fb9d,_0x551a85,!![]);}catch(_0x364405){return BPromise[_0x14f6('0x35')](_0x364405);}return _0x33fb9d[_0x14f6('0x36')]();};}function saveUpdates(_0x25ccb0,_0x52ee9d){return function(_0x363332){if(_0x363332){return _0x363332[_0x14f6('0x37')](_0x25ccb0)[_0x14f6('0x1f')](function(_0x128dd3){return _0x128dd3;});}return null;};}function removeEntity(_0x22ad70,_0x13b970){return function(_0x44b044){if(_0x44b044){return _0x44b044[_0x14f6('0x38')]()[_0x14f6('0x1f')](function(){_0x22ad70['status'](0xcc)[_0x14f6('0x2c')]();});}};}function handleEntityNotFound(_0x3a304e,_0x202c90){return function(_0x4c66ff){if(!_0x4c66ff){_0x3a304e[_0x14f6('0x2b')](0x194);}return _0x4c66ff;};}function handleError(_0x3346b7,_0x44c587){_0x44c587=_0x44c587||0x1f4;return function(_0x376037){logger[_0x14f6('0x25')](_0x376037[_0x14f6('0x39')]);if(_0x376037[_0x14f6('0x3a')]){delete _0x376037[_0x14f6('0x3a')];}_0x3346b7[_0x14f6('0x2d')](_0x44c587)['send'](_0x376037);};}exports[_0x14f6('0x3b')]=function(_0x447a36,_0x3a82ae){var _0x4e60aa={},_0x10bea2={},_0x4fefea={'count':0x0,'rows':[]};var _0x34ed25=_['map'](db[_0x14f6('0x3c')]['rawAttributes'],function(_0x56ce26){return{'name':_0x56ce26[_0x14f6('0x3d')],'type':_0x56ce26['type']['key']};});_0x10bea2[_0x14f6('0x3e')]=_[_0x14f6('0x3f')](_0x34ed25,'name');_0x10bea2['query']=_[_0x14f6('0x40')](_0x447a36[_0x14f6('0x41')]);_0x10bea2[_0x14f6('0x42')]=_['intersection'](_0x10bea2[_0x14f6('0x3e')],_0x10bea2['query']);_0x4e60aa['attributes']=_[_0x14f6('0x43')](_0x10bea2['model'],qs['fields'](_0x447a36['query'][_0x14f6('0x44')]));_0x4e60aa[_0x14f6('0x45')]=_0x4e60aa['attributes'][_0x14f6('0x46')]?_0x4e60aa['attributes']:_0x10bea2[_0x14f6('0x3e')];if(!_0x447a36['query']['hasOwnProperty'](_0x14f6('0x47'))){_0x4e60aa[_0x14f6('0x31')]=qs[_0x14f6('0x31')](_0x447a36[_0x14f6('0x41')][_0x14f6('0x31')]);_0x4e60aa['offset']=qs[_0x14f6('0x2f')](_0x447a36[_0x14f6('0x41')]['offset']);}_0x4e60aa[_0x14f6('0x48')]=qs['sort'](_0x447a36['query'][_0x14f6('0x49')]);_0x4e60aa['where']=qs[_0x14f6('0x42')](_[_0x14f6('0x4a')](_0x447a36[_0x14f6('0x41')],_0x10bea2[_0x14f6('0x42')]),_0x34ed25);if(_0x447a36[_0x14f6('0x41')][_0x14f6('0x4b')]){_0x4e60aa[_0x14f6('0x4c')]=_['merge'](_0x4e60aa[_0x14f6('0x4c')],{'$or':_['map'](_0x34ed25,function(_0x127307){if(_0x127307[_0x14f6('0x4d')]!==_0x14f6('0x4e')){var _0xdd6a13={};_0xdd6a13[_0x127307['name']]={'$like':'%'+_0x447a36[_0x14f6('0x41')][_0x14f6('0x4b')]+'%'};return _0xdd6a13;}})});}_0x4e60aa=_['merge']({},_0x4e60aa,_0x447a36[_0x14f6('0x4f')]);var _0x579613={'where':_0x4e60aa['where']};return db[_0x14f6('0x3c')][_0x14f6('0x50')](_0x579613)['then'](function(_0x40eb8d){_0x4fefea['count']=_0x40eb8d;if(_0x447a36['query'][_0x14f6('0x51')]){_0x4e60aa[_0x14f6('0x52')]=[{'all':!![]}];}return db['ChatMessage'][_0x14f6('0x53')](_0x4e60aa);})[_0x14f6('0x1f')](function(_0x42a998){_0x4fefea['rows']=_0x42a998;return _0x4fefea;})[_0x14f6('0x1f')](respondWithFilteredResult(_0x3a82ae,_0x4e60aa))['catch'](handleError(_0x3a82ae,null));};exports[_0x14f6('0x54')]=function(_0x5a5553,_0x2e3028){var _0x1e1659={'raw':!![],'where':{'id':_0x5a5553[_0x14f6('0x55')]['id']}},_0x25c3d7={};_0x25c3d7['model']=_[_0x14f6('0x40')](db['ChatMessage'][_0x14f6('0x56')]);_0x25c3d7['query']=_['keys'](_0x5a5553[_0x14f6('0x41')]);_0x25c3d7[_0x14f6('0x42')]=_['intersection'](_0x25c3d7['model'],_0x25c3d7[_0x14f6('0x41')]);_0x1e1659['attributes']=_[_0x14f6('0x43')](_0x25c3d7[_0x14f6('0x3e')],qs['fields'](_0x5a5553[_0x14f6('0x41')][_0x14f6('0x44')]));_0x1e1659[_0x14f6('0x45')]=_0x1e1659['attributes'][_0x14f6('0x46')]?_0x1e1659[_0x14f6('0x45')]:_0x25c3d7[_0x14f6('0x3e')];if(_0x5a5553['query'][_0x14f6('0x51')]){_0x1e1659[_0x14f6('0x52')]=[{'all':!![]}];}_0x1e1659=_[_0x14f6('0x57')]({},_0x1e1659,_0x5a5553[_0x14f6('0x4f')]);return db['ChatMessage']['find'](_0x1e1659)['then'](handleEntityNotFound(_0x2e3028,null))[_0x14f6('0x1f')](respondWithResult(_0x2e3028,null))['catch'](handleError(_0x2e3028,null));};exports['create']=function(_0x1d4876,_0x3f40bd){return db[_0x14f6('0x3c')][_0x14f6('0x58')](_0x1d4876[_0x14f6('0x59')],{})['then'](respondWithResult(_0x3f40bd,0xc9))[_0x14f6('0x2a')](handleError(_0x3f40bd,null));};exports[_0x14f6('0x37')]=function(_0x29c55d,_0x47e07f){if(_0x29c55d[_0x14f6('0x59')]['id']){delete _0x29c55d['body']['id'];}return db['ChatMessage'][_0x14f6('0x5a')]({'where':{'id':_0x29c55d[_0x14f6('0x55')]['id']}})['then'](handleEntityNotFound(_0x47e07f,null))[_0x14f6('0x1f')](saveUpdates(_0x29c55d['body'],null))[_0x14f6('0x1f')](respondWithResult(_0x47e07f,null))[_0x14f6('0x2a')](handleError(_0x47e07f,null));};exports[_0x14f6('0x38')]=function(_0x551c4d,_0x514634){return db[_0x14f6('0x3c')]['find']({'where':{'id':_0x551c4d['params']['id']}})[_0x14f6('0x1f')](handleEntityNotFound(_0x514634,null))['then'](removeEntity(_0x514634,null))[_0x14f6('0x2a')](handleError(_0x514634,null));};exports[_0x14f6('0x5b')]=function(_0x11692d,_0x44cd21){return db[_0x14f6('0x3c')][_0x14f6('0x5b')]()[_0x14f6('0x1f')](respondWithResult(_0x44cd21,null))[_0x14f6('0x2a')](handleError(_0x44cd21,null));};var interaction_log=require(_0x14f6('0x13'))(_0x14f6('0x5c'));exports[_0x14f6('0x5d')]=function(_0x25d436,_0xebcbaf,_0x2da2cb){var _0x1b2ad2={'agent':{},'channel':_0x14f6('0x5e')};if(_0x25d436[_0x14f6('0x59')]['id']){delete _0x25d436[_0x14f6('0x59')]['id'];}_0x25d436[_0x14f6('0x59')][_0x14f6('0x5f')]=!![];_0x25d436[_0x14f6('0x59')][_0x14f6('0x60')]=moment()[_0x14f6('0x61')](_0x14f6('0x62'));_0x25d436[_0x14f6('0x59')][_0x14f6('0x63')]=_0x25d436[_0x14f6('0x59')][_0x14f6('0x63')]||_0x25d436['user']['id'];_0x1b2ad2[_0x14f6('0x64')]['id']=_0x25d436[_0x14f6('0x59')][_0x14f6('0x63')];return db[_0x14f6('0x3c')][_0x14f6('0x5a')]({'where':{'id':_0x25d436['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xebcbaf,null))[_0x14f6('0x1f')](saveUpdates(_0x25d436[_0x14f6('0x59')],null))[_0x14f6('0x1f')](function(_0x3c50fd){if(_0x3c50fd){_0x1b2ad2[_0x14f6('0x27')]=_0x3c50fd[_0x14f6('0x65')]({'plain':!![]});return db['ChatInteraction'][_0x14f6('0x5a')]({'where':{'id':_0x3c50fd[_0x14f6('0x66')]}});}return null;})[_0x14f6('0x1f')](handleEntityNotFound(_0xebcbaf,null))['then'](function(_0x337d9f){if(_0x337d9f){return _0x337d9f[_0x14f6('0x37')]({'UserId':_0x25d436[_0x14f6('0x59')][_0x14f6('0x63')],'read1stAt':_[_0x14f6('0x67')](_0x337d9f[_0x14f6('0x68')])?moment()[_0x14f6('0x61')](_0x14f6('0x62')):undefined});}return null;})[_0x14f6('0x1f')](function(_0xf9ccef){if(_0xf9ccef){_0x1b2ad2[_0x14f6('0x69')]=_0xf9ccef['get']({'plain':!![]});interaction_log[_0x14f6('0x28')](_0x14f6('0x6a'),_0x25d436[_0x14f6('0x6b')]['id'],_0x25d436['user'][_0x14f6('0x3a')],_0x25d436['user'][_0x14f6('0x6c')],_0x1b2ad2[_0x14f6('0x69')]['id'],_0x25d436[_0x14f6('0x59')]?JSON[_0x14f6('0x24')](_0x25d436[_0x14f6('0x59')]):_0x14f6('0x6d'));return respondWithRpcPromise(_0x14f6('0x6e'),_0x14f6('0x6f'),_0x1b2ad2);}return null;})[_0x14f6('0x1f')](function(_0x2a4c61){var _0x273d9d=_0x14f6('0x70')+_0x2a4c61[_0x14f6('0x27')][_0x14f6('0x71')];return db[_0x14f6('0x72')][_0x14f6('0x41')](_0x273d9d,{'type':db[_0x14f6('0x73')][_0x14f6('0x74')]['SELECT'],'raw':!![]})['then'](function(_0x40e498){return _0x40e498;});})['then'](function(_0xc94fb2){if(_0xc94fb2){_0x1b2ad2[_0x14f6('0x27')][_0x14f6('0x75')]=_0xc94fb2[0x0];if(!_0x25d436[_0x14f6('0x59')][_0x14f6('0x63')])return;return db[_0x14f6('0x76')][_0x14f6('0x5a')]({'where':{'id':_0x25d436[_0x14f6('0x59')][_0x14f6('0x63')],'role':_0x14f6('0x64')},'attributes':['id',_0x14f6('0x3a'),'fullname',_0x14f6('0x77'),'internal'],'raw':!![]});}return null;})['then'](function(_0x329cfb){if(!_0x329cfb)return null;_0x1b2ad2['message']['agent']=_0x329cfb;return _0x1b2ad2;})[_0x14f6('0x1f')](function(_0x36c4cd){if(_0x36c4cd){if(_0x25d436[_0x14f6('0x59')][_0x14f6('0x78')]){_0x1b2ad2['message'][_0x14f6('0x79')]=util['format'](_0x14f6('0x7a'),_0x25d436[_0x14f6('0x6b')][_0x14f6('0x3a')]);_0x1b2ad2[_0x14f6('0x27')][_0x14f6('0x7b')]=_0x1b2ad2[_0x14f6('0x7b')];_0x1b2ad2[_0x14f6('0x27')]['motionChannel']=_0x1b2ad2[_0x14f6('0x7b')];_0x1b2ad2['message'][_0x14f6('0x7c')]=_0x14f6('0x5d');return respondWithRpcPromise(_0x14f6('0x7d'),_0x14f6('0x7d'),{'event':_0x14f6('0x7e'),'message':_['merge'](_0x1b2ad2[_0x14f6('0x27')],JSON[_0x14f6('0x7f')](_0x1b2ad2[_0x14f6('0x69')][_0x14f6('0x80')]))},client9002)[_0x14f6('0x1f')](function(){return _0x1b2ad2;});}return _0x1b2ad2;}return null;})['then'](respondWithResult(_0xebcbaf,null))[_0x14f6('0x2a')](handleError(_0xebcbaf,null));};var interaction_log=require('../../config/logger')(_0x14f6('0x5c'));exports[_0x14f6('0x35')]=function(_0x1aab69,_0x44b633,_0x33811a){var _0x2f5f13={'agent':{},'channel':_0x14f6('0x5e')};if(_0x1aab69['body']['id']){delete _0x1aab69[_0x14f6('0x59')]['id'];}_0x1aab69['body']['UserId']=_0x1aab69[_0x14f6('0x59')][_0x14f6('0x63')]||_0x1aab69[_0x14f6('0x6b')]['id'];_0x2f5f13[_0x14f6('0x64')]['id']=_0x1aab69[_0x14f6('0x59')]['UserId'];return db[_0x14f6('0x3c')][_0x14f6('0x5a')]({'where':{'id':_0x1aab69[_0x14f6('0x55')]['id'],'UserId':null}})[_0x14f6('0x1f')](handleEntityNotFound(_0x44b633,null))['then'](function(_0x5ecf88){if(_0x5ecf88){_0x2f5f13[_0x14f6('0x27')]=_0x5ecf88[_0x14f6('0x65')]({'plain':!![]});return db[_0x14f6('0x81')][_0x14f6('0x5a')]({'where':{'id':_0x5ecf88[_0x14f6('0x66')]}});}return null;})[_0x14f6('0x1f')](handleEntityNotFound(_0x44b633,null))[_0x14f6('0x1f')](function(_0x50a645){if(_0x50a645){_0x2f5f13[_0x14f6('0x69')]=_0x50a645[_0x14f6('0x65')]({'plain':!![]});interaction_log[_0x14f6('0x28')](_0x14f6('0x82'),_0x1aab69[_0x14f6('0x6b')]['id'],_0x1aab69[_0x14f6('0x6b')]['name'],_0x1aab69[_0x14f6('0x6b')][_0x14f6('0x6c')],_0x2f5f13[_0x14f6('0x69')]['id'],_0x1aab69[_0x14f6('0x59')]?JSON[_0x14f6('0x24')](_0x1aab69[_0x14f6('0x59')]):_0x14f6('0x6d'));return respondWithRpcPromise('RejectMessage',_0x14f6('0x83'),_0x2f5f13);}return null;})[_0x14f6('0x1f')](function(_0x19422f){var _0x2ff198=_0x14f6('0x70')+_0x19422f[_0x14f6('0x27')]['ContactId'];return db[_0x14f6('0x72')][_0x14f6('0x41')](_0x2ff198,{'type':db[_0x14f6('0x73')][_0x14f6('0x74')][_0x14f6('0x84')],'raw':!![]})[_0x14f6('0x1f')](function(_0x50ded8){return _0x50ded8;});})[_0x14f6('0x1f')](function(_0x5372af){if(_0x5372af){_0x2f5f13['message'][_0x14f6('0x75')]=_0x5372af[0x0];if(!_0x1aab69[_0x14f6('0x59')][_0x14f6('0x63')])return;return db['User']['find']({'where':{'id':_0x1aab69['body'][_0x14f6('0x63')],'role':_0x14f6('0x64')},'attributes':['id',_0x14f6('0x3a'),_0x14f6('0x85'),_0x14f6('0x77'),'internal'],'raw':!![]});}return null;})['then'](function(_0x451c2){if(!_0x451c2)return null;_0x2f5f13['message'][_0x14f6('0x64')]=_0x451c2;return _0x2f5f13;})[_0x14f6('0x1f')](function(_0x3407a0){if(_0x3407a0){_0x3407a0[_0x14f6('0x27')][_0x14f6('0x79')]=util[_0x14f6('0x61')](_0x14f6('0x7a'),_0x1aab69[_0x14f6('0x6b')][_0x14f6('0x3a')]);_0x3407a0[_0x14f6('0x27')]['channel']=_0x2f5f13[_0x14f6('0x7b')];_0x3407a0[_0x14f6('0x27')]['motionChannel']=_0x2f5f13[_0x14f6('0x7b')];_0x3407a0[_0x14f6('0x27')][_0x14f6('0x7c')]=_0x14f6('0x35');respondWithRpcPromise(_0x14f6('0x7d'),_0x14f6('0x7d'),{'event':_0x14f6('0x86'),'message':_[_0x14f6('0x57')](_0x2f5f13[_0x14f6('0x27')],JSON[_0x14f6('0x7f')](_0x2f5f13[_0x14f6('0x69')][_0x14f6('0x80')]))},client9002);return _0x2f5f13;}return null;})[_0x14f6('0x1f')](respondWithResult(_0x44b633,null))[_0x14f6('0x2a')](handleError(_0x44b633,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 8757bc0..ede7f7b 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 _0xf8ac=['events','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x55da14,_0x59d44f){var _0x2f83f8=function(_0x3cfe06){while(--_0x3cfe06){_0x55da14['push'](_0x55da14['shift']());}};_0x2f83f8(++_0x59d44f);}(_0xf8ac,0x134));var _0xcf8a=function(_0xeff2c3,_0x3a5a82){_0xeff2c3=_0xeff2c3-0x0;var _0x2cade6=_0xf8ac[_0xeff2c3];return _0x2cade6;};'use strict';var EventEmitter=require(_0xcf8a('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xcf8a('0x1')](0x0);var events={'afterCreate':_0xcf8a('0x2'),'afterUpdate':'update','afterDestroy':_0xcf8a('0x3')};function emitEvent(_0x53801b){return function(_0x24e865,_0x4eaeb9,_0x2e4a65){ChatMessageEvents[_0xcf8a('0x4')](_0x53801b+':'+_0x24e865['id'],_0x24e865);ChatMessageEvents[_0xcf8a('0x4')](_0x53801b,_0x24e865);_0x2e4a65(null);};}for(var e in events){if(events[_0xcf8a('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xcf8a('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x99d6=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0xb3a67e,_0x44a594){var _0x5d6938=function(_0x3d2aa0){while(--_0x3d2aa0){_0xb3a67e['push'](_0xb3a67e['shift']());}};_0x5d6938(++_0x44a594);}(_0x99d6,0x100));var _0x699d=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x99d6[_0x15cbce];return _0x257f29;};'use strict';var EventEmitter=require(_0x699d('0x0'));var ChatMessage=require(_0x699d('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x699d('0x2')](0x0);var events={'afterCreate':_0x699d('0x3'),'afterUpdate':_0x699d('0x4'),'afterDestroy':_0x699d('0x5')};function emitEvent(_0x330771){return function(_0x23ed26,_0xa3a922,_0x194f56){ChatMessageEvents[_0x699d('0x6')](_0x330771+':'+_0x23ed26['id'],_0x23ed26);ChatMessageEvents[_0x699d('0x6')](_0x330771,_0x23ed26);_0x194f56(null);};}for(var e in events){if(events[_0x699d('0x7')](e)){var event=events[e];ChatMessage[_0x699d('0x8')](e,emitEvent(event));}}module[_0x699d('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 9b82add..21df244 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 _0x3c0c=['request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','isNil','UserId','ChatInteraction','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4a500b,_0x65d0e7){var _0x13c3ea=function(_0x5d1dcb){while(--_0x5d1dcb){_0x4a500b['push'](_0x4a500b['shift']());}};_0x13c3ea(++_0x65d0e7);}(_0x3c0c,0x162));var _0xc3c0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3c0c[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xc3c0('0x0'));var util=require(_0xc3c0('0x1'));var logger=require(_0xc3c0('0x2'))(_0xc3c0('0x3'));var moment=require(_0xc3c0('0x4'));var BPromise=require(_0xc3c0('0x5'));var rp=require(_0xc3c0('0x6'));var fs=require('fs');var path=require(_0xc3c0('0x7'));var rimraf=require(_0xc3c0('0x8'));var config=require(_0xc3c0('0x9'));var attributes=require(_0xc3c0('0xa'));module[_0xc3c0('0xb')]=function(_0x2f2ea5,_0x24dbda){return _0x2f2ea5[_0xc3c0('0xc')](_0xc3c0('0xd'),attributes,{'tableName':_0xc3c0('0xe'),'paranoid':![],'indexes':[{'name':_0xc3c0('0xf'),'fields':[_0xc3c0('0x10')],'type':_0xc3c0('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x525a25,_0x54b4e8,_0x4a6ed9){var _0x5ada80=_0x2f2ea5['models'];var _0x5e1e7c=_0x525a25[_0xc3c0('0x12')]({'plain':!![]});if(_0x5e1e7c[_0xc3c0('0x13')][_0xc3c0('0x14')]()==='in'||_0x5e1e7c[_0xc3c0('0x13')]['toLowerCase']()==='out'&&!_0x5e1e7c['secret']&&!_[_0xc3c0('0x15')](_0x5e1e7c[_0xc3c0('0x16')])){_0x5ada80[_0xc3c0('0x17')]['findOne']({'where':{'id':_0x5e1e7c['ChatInteractionId']}})[_0xc3c0('0x18')](function(_0x51de1c){if(_0x51de1c){_0x51de1c[_0xc3c0('0x19')]({'lastMsgAt':_0x5e1e7c['createdAt'],'lastMsgDirection':_0x5e1e7c[_0xc3c0('0x13')][_0xc3c0('0x14')]()});}})[_0xc3c0('0x1a')](function(_0x50a8f6){console[_0xc3c0('0x1b')](_0x50a8f6);});}_0x4a6ed9();}},'charset':_0xc3c0('0x1c'),'collate':_0xc3c0('0x1d')});}; \ No newline at end of file +var _0x5ad3=['ChatInteractionId','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','isNil','UserId'];(function(_0x3a6922,_0xc728be){var _0x9c1b44=function(_0x4ffb5e){while(--_0x4ffb5e){_0x3a6922['push'](_0x3a6922['shift']());}};_0x9c1b44(++_0xc728be);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x35ba71,_0xa2fbbd){_0x35ba71=_0x35ba71-0x0;var _0x5f04f4=_0x5ad3[_0x35ba71];return _0x5f04f4;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var moment=require('moment');var BPromise=require(_0x35ad('0x4'));var rp=require(_0x35ad('0x5'));var fs=require('fs');var path=require(_0x35ad('0x6'));var rimraf=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var attributes=require(_0x35ad('0x9'));module[_0x35ad('0xa')]=function(_0x436dcb,_0x36c606){return _0x436dcb[_0x35ad('0xb')]('ChatMessage',attributes,{'tableName':_0x35ad('0xc'),'paranoid':![],'indexes':[{'name':_0x35ad('0xd'),'fields':[_0x35ad('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2498c1,_0x487107,_0x5a29e3){var _0x2efae0=_0x436dcb[_0x35ad('0xf')];var _0x4881d1=_0x2498c1[_0x35ad('0x10')]({'plain':!![]});if(_0x4881d1[_0x35ad('0x11')]['toLowerCase']()==='in'||_0x4881d1['direction'][_0x35ad('0x12')]()===_0x35ad('0x13')&&!_0x4881d1['secret']&&!_[_0x35ad('0x14')](_0x4881d1[_0x35ad('0x15')])){_0x2efae0['ChatInteraction']['findOne']({'where':{'id':_0x4881d1[_0x35ad('0x16')]}})[_0x35ad('0x17')](function(_0x3cda5e){if(_0x3cda5e){_0x3cda5e['update']({'lastMsgAt':_0x4881d1[_0x35ad('0x18')],'lastMsgDirection':_0x4881d1[_0x35ad('0x11')]['toLowerCase']()});}})[_0x35ad('0x19')](function(_0x4d5185){console['error'](_0x4d5185);});}_0x5a29e3();}},'charset':_0x35ad('0x1a'),'collate':_0x35ad('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 9c2e2fc..8b65a07 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 _0x2c17=['ChatMessage,\x20%s,\x20%s','result','catch','CreateChatMessage','ChatMessage','create','body','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','request','then','info','debug','request\x20sent','stringify','error','message'];(function(_0x128c4b,_0xbea87f){var _0x2a6636=function(_0x49569a){while(--_0x49569a){_0x128c4b['push'](_0x128c4b['shift']());}};_0x2a6636(++_0xbea87f);}(_0x2c17,0x174));var _0x72c1=function(_0x1db621,_0x3dd8d7){_0x1db621=_0x1db621-0x0;var _0x4d9c49=_0x2c17[_0x1db621];return _0x4d9c49;};'use strict';var _=require(_0x72c1('0x0'));var util=require(_0x72c1('0x1'));var moment=require(_0x72c1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72c1('0x3'));var db=require(_0x72c1('0x4'))['db'];var utils=require(_0x72c1('0x5'));var logger=require(_0x72c1('0x6'))(_0x72c1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x72c1('0x8')]['http']({'port':0x232a});config[_0x72c1('0x9')]=_[_0x72c1('0xa')](config[_0x72c1('0x9')],{'host':_0x72c1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72c1('0x9')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x418a18,_0x3a6562,_0x3fc93a){return new BPromise(function(_0x571203,_0x3ff0da){return client[_0x72c1('0xc')](_0x418a18,_0x3fc93a)[_0x72c1('0xd')](function(_0x402cd0){logger[_0x72c1('0xe')]('ChatMessage,\x20%s,\x20%s',_0x3a6562,'request\x20sent');logger[_0x72c1('0xf')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3a6562,_0x72c1('0x10'),JSON[_0x72c1('0x11')](_0x402cd0));if(_0x402cd0['error']){if(_0x402cd0[_0x72c1('0x12')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x3a6562,_0x402cd0['error'][_0x72c1('0x13')]);return _0x3ff0da(_0x402cd0[_0x72c1('0x12')][_0x72c1('0x13')]);}logger[_0x72c1('0x12')]('ChatMessage,\x20%s,\x20%s',_0x3a6562,_0x402cd0[_0x72c1('0x12')][_0x72c1('0x13')]);return _0x571203(_0x402cd0[_0x72c1('0x12')][_0x72c1('0x13')]);}else{logger[_0x72c1('0xe')](_0x72c1('0x14'),_0x3a6562,_0x72c1('0x10'));_0x571203(_0x402cd0[_0x72c1('0x15')][_0x72c1('0x13')]);}})[_0x72c1('0x16')](function(_0x5f0976){logger['error'](_0x72c1('0x14'),_0x3a6562,_0x5f0976);_0x3ff0da(_0x5f0976);});});}exports[_0x72c1('0x17')]=function(_0x208d10){var _0x503c92=this;return new Promise(function(_0x37059b,_0x536b34){return db[_0x72c1('0x18')][_0x72c1('0x19')](_0x208d10[_0x72c1('0x1a')],{'raw':_0x208d10['options']?_0x208d10['options'][_0x72c1('0x1b')]===undefined?!![]:![]:!![]})[_0x72c1('0xd')](function(_0x3918b6){logger[_0x72c1('0xe')](_0x72c1('0x17'),_0x208d10);logger[_0x72c1('0xf')](_0x72c1('0x17'),_0x208d10,JSON['stringify'](_0x3918b6));_0x37059b(_0x3918b6);})['catch'](function(_0x5220af){logger[_0x72c1('0x12')](_0x72c1('0x17'),_0x5220af['message'],_0x208d10);_0x536b34(_0x503c92[_0x72c1('0x12')](0x1f4,_0x5220af[_0x72c1('0x13')]));});});}; \ No newline at end of file +var _0xd202=['request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatMessage,\x20%s,\x20%s','message','catch','CreateChatMessage','body','options','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','request','then','info'];(function(_0x29b628,_0x5da950){var _0x39fea6=function(_0x159d66){while(--_0x159d66){_0x29b628['push'](_0x29b628['shift']());}};_0x39fea6(++_0x5da950);}(_0xd202,0x14c));var _0x2d20=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xd202[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x2d20('0x0'));var util=require(_0x2d20('0x1'));var moment=require(_0x2d20('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d20('0x3'));var fs=require('fs');var Redis=require(_0x2d20('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d20('0x5'));var logger=require(_0x2d20('0x6'))(_0x2d20('0x7'));var config=require(_0x2d20('0x8'));var jayson=require(_0x2d20('0x9'));var client=jayson['client'][_0x2d20('0xa')]({'port':0x232a});config[_0x2d20('0xb')]=_['defaults'](config[_0x2d20('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2d20('0xc'))(new Redis(config[_0x2d20('0xb')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5985ca,_0x12a095,_0xe261d1){return new BPromise(function(_0x45b214,_0x3effca){return client[_0x2d20('0xd')](_0x5985ca,_0xe261d1)[_0x2d20('0xe')](function(_0x148b11){logger[_0x2d20('0xf')]('ChatMessage,\x20%s,\x20%s',_0x12a095,_0x2d20('0x10'));logger[_0x2d20('0x11')](_0x2d20('0x12'),_0x12a095,_0x2d20('0x10'),JSON[_0x2d20('0x13')](_0x148b11));if(_0x148b11['error']){if(_0x148b11['error'][_0x2d20('0x14')]===0x1f4){logger[_0x2d20('0x15')](_0x2d20('0x16'),_0x12a095,_0x148b11[_0x2d20('0x15')][_0x2d20('0x17')]);return _0x3effca(_0x148b11[_0x2d20('0x15')][_0x2d20('0x17')]);}logger['error'](_0x2d20('0x16'),_0x12a095,_0x148b11[_0x2d20('0x15')][_0x2d20('0x17')]);return _0x45b214(_0x148b11[_0x2d20('0x15')][_0x2d20('0x17')]);}else{logger[_0x2d20('0xf')]('ChatMessage,\x20%s,\x20%s',_0x12a095,_0x2d20('0x10'));_0x45b214(_0x148b11['result']['message']);}})[_0x2d20('0x18')](function(_0x51089b){logger[_0x2d20('0x15')](_0x2d20('0x16'),_0x12a095,_0x51089b);_0x3effca(_0x51089b);});});}exports[_0x2d20('0x19')]=function(_0x59f3d7){var _0x7b0936=this;return new Promise(function(_0x193097,_0x42fd89){return db['ChatMessage']['create'](_0x59f3d7[_0x2d20('0x1a')],{'raw':_0x59f3d7[_0x2d20('0x1b')]?_0x59f3d7['options'][_0x2d20('0x1c')]===undefined?!![]:![]:!![]})[_0x2d20('0xe')](function(_0x20516f){logger[_0x2d20('0xf')](_0x2d20('0x19'),_0x59f3d7);logger[_0x2d20('0x11')](_0x2d20('0x19'),_0x59f3d7,JSON['stringify'](_0x20516f));_0x193097(_0x20516f);})[_0x2d20('0x18')](function(_0x56331b){logger['error']('CreateChatMessage',_0x56331b[_0x2d20('0x17')],_0x59f3d7);_0x42fd89(_0x7b0936[_0x2d20('0x15')](0x1f4,_0x56331b[_0x2d20('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 70c096d..5c7d2c4 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 _0x93bb=['update','emit','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x5f3c49,_0x2c9716){var _0x5259ac=function(_0x54eb42){while(--_0x54eb42){_0x5f3c49['push'](_0x5f3c49['shift']());}};_0x5259ac(++_0x2c9716);}(_0x93bb,0x135));var _0xb93b=function(_0x54fe9e,_0x5afb32){_0x54fe9e=_0x54fe9e-0x0;var _0x562510=_0x93bb[_0x54fe9e];return _0x562510;};'use strict';var ChatMessageEvents=require(_0xb93b('0x0'));var events=[_0xb93b('0x1'),_0xb93b('0x2'),_0xb93b('0x3')];function createListener(_0xef52ba,_0x9b62ab){return function(_0x3ae317){_0x9b62ab[_0xb93b('0x4')](_0xef52ba,_0x3ae317);};}function removeListener(_0x3eb285,_0x355196){return function(){ChatMessageEvents['removeListener'](_0x3eb285,_0x355196);};}exports[_0xb93b('0x5')]=function(_0x1ec4dd){for(var _0x4e89c7=0x0,_0x3c4dcf=events[_0xb93b('0x6')];_0x4e89c7<_0x3c4dcf;_0x4e89c7++){var _0x516b0b=events[_0x4e89c7];var _0x35c135=createListener(_0xb93b('0x7')+_0x516b0b,_0x1ec4dd);ChatMessageEvents['on'](_0x516b0b,_0x35c135);}}; \ No newline at end of file +var _0x4fd7=['emit','register','./chatMessage.events','save','remove','update'];(function(_0x5eb76f,_0x28d41d){var _0x549bbe=function(_0x16c635){while(--_0x16c635){_0x5eb76f['push'](_0x5eb76f['shift']());}};_0x549bbe(++_0x28d41d);}(_0x4fd7,0xe6));var _0x74fd=function(_0x4f7cfd,_0x1e8c34){_0x4f7cfd=_0x4f7cfd-0x0;var _0x44ca47=_0x4fd7[_0x4f7cfd];return _0x44ca47;};'use strict';var ChatMessageEvents=require(_0x74fd('0x0'));var events=[_0x74fd('0x1'),_0x74fd('0x2'),_0x74fd('0x3')];function createListener(_0x5bb9e2,_0x4fba38){return function(_0xfa6318){_0x4fba38[_0x74fd('0x4')](_0x5bb9e2,_0xfa6318);};}function removeListener(_0x59e3f1,_0x34f92f){return function(){ChatMessageEvents['removeListener'](_0x59e3f1,_0x34f92f);};}exports[_0x74fd('0x5')]=function(_0x480ec2){for(var _0x1959e1=0x0,_0xced36a=events['length'];_0x1959e1<_0xced36a;_0x1959e1++){var _0x1fd5b7=events[_0x1959e1];var _0x15563c=createListener('chatMessage:'+_0x1fd5b7,_0x480ec2);ChatMessageEvents['on'](_0x1fd5b7,_0x15563c);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 06e78fd..7b00185 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 _0x0a52=['update','put','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','show','post','tracked','chat','chatmessage:create','create'];(function(_0x3e4d91,_0x46d43c){var _0x5b4888=function(_0x843da9){while(--_0x843da9){_0x3e4d91['push'](_0x3e4d91['shift']());}};_0x5b4888(++_0x46d43c);}(_0x0a52,0xbe));var _0x20a5=function(_0x476358,_0x787ae1){_0x476358=_0x476358-0x0;var _0x55452e=_0x0a52[_0x476358];return _0x55452e;};'use strict';var multer=require(_0x20a5('0x0'));var util=require(_0x20a5('0x1'));var path=require(_0x20a5('0x2'));var timeout=require(_0x20a5('0x3'));var express=require(_0x20a5('0x4'));var router=express['Router']();var fs_extra=require(_0x20a5('0x5'));var auth=require(_0x20a5('0x6'));var interaction=require(_0x20a5('0x7'));var config=require(_0x20a5('0x8'));var controller=require(_0x20a5('0x9'));router[_0x20a5('0xa')]('/',auth[_0x20a5('0xb')](),controller['index']);router[_0x20a5('0xa')](_0x20a5('0xc'),auth[_0x20a5('0xb')](),controller[_0x20a5('0xd')]);router[_0x20a5('0xa')]('/:id',auth[_0x20a5('0xb')](),controller[_0x20a5('0xe')]);router[_0x20a5('0xf')]('/',auth['isAuthenticated'](),interaction[_0x20a5('0x10')](_0x20a5('0x11'),_0x20a5('0x12')),controller[_0x20a5('0x13')]);router['put']('/:id',controller[_0x20a5('0x14')]);router[_0x20a5('0x15')](_0x20a5('0x16'),auth[_0x20a5('0xb')](),controller[_0x20a5('0x17')]);router['put'](_0x20a5('0x18'),auth[_0x20a5('0xb')](),controller[_0x20a5('0x19')]);router[_0x20a5('0x1a')](_0x20a5('0x1b'),auth[_0x20a5('0xb')](),controller[_0x20a5('0x1c')]);module[_0x20a5('0x1d')]=router; \ No newline at end of file +var _0xe7fa=['tracked','chat','create','put','update','accept','/:id/reject','reject','delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x5322fa,_0x5750df){var _0x39a323=function(_0x209959){while(--_0x209959){_0x5322fa['push'](_0x5322fa['shift']());}};_0x39a323(++_0x5750df);}(_0xe7fa,0x181));var _0xae7f=function(_0xe3e5bd,_0x58a711){_0xe3e5bd=_0xe3e5bd-0x0;var _0x39753f=_0xe7fa[_0xe3e5bd];return _0x39753f;};'use strict';var multer=require(_0xae7f('0x0'));var util=require(_0xae7f('0x1'));var path=require(_0xae7f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xae7f('0x3'));var auth=require(_0xae7f('0x4'));var interaction=require(_0xae7f('0x5'));var config=require(_0xae7f('0x6'));var controller=require('./chatMessage.controller');router[_0xae7f('0x7')]('/',auth[_0xae7f('0x8')](),controller[_0xae7f('0x9')]);router[_0xae7f('0x7')](_0xae7f('0xa'),auth[_0xae7f('0x8')](),controller[_0xae7f('0xb')]);router[_0xae7f('0x7')](_0xae7f('0xc'),auth[_0xae7f('0x8')](),controller[_0xae7f('0xd')]);router[_0xae7f('0xe')]('/',auth['isAuthenticated'](),interaction[_0xae7f('0xf')](_0xae7f('0x10'),'chatmessage:create'),controller[_0xae7f('0x11')]);router[_0xae7f('0x12')]('/:id',controller[_0xae7f('0x13')]);router[_0xae7f('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0xae7f('0x14')]);router['put'](_0xae7f('0x15'),auth['isAuthenticated'](),controller[_0xae7f('0x16')]);router[_0xae7f('0x17')](_0xae7f('0xc'),auth[_0xae7f('0x8')](),controller[_0xae7f('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 6cc32d2..daac448 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 _0xadb5=['medium','TEXT','exports'];(function(_0x889b54,_0x4669aa){var _0x1aa95c=function(_0x5bd5f0){while(--_0x5bd5f0){_0x889b54['push'](_0x889b54['shift']());}};_0x1aa95c(++_0x4669aa);}(_0xadb5,0xad));var _0x5adb=function(_0xed449b,_0x120235){_0xed449b=_0xed449b-0x0;var _0x22306c=_0xadb5[_0xed449b];return _0x22306c;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0x0b0e[_0x1fd9e7];return _0x1781f2;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 09230bd..3f5c258 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x5ec744,_0xc8a519){var _0x41c521=function(_0x555c94){while(--_0x555c94){_0x5ec744['push'](_0x5ec744['shift']());}};_0x41c521(++_0xc8a519);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x7a54,0x106));var _0x47a5=function(_0x138dda,_0x395fe2){_0x138dda=_0x138dda-0x0;var _0x47aadd=_0x7a54[_0x138dda];return _0x47aadd;};'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 f55a9f2..188b7bd 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 _0x9bcc=['../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x38f47b,_0x1ae610){var _0x2339d5=function(_0x2d6ab4){while(--_0x2d6ab4){_0x38f47b['push'](_0x38f47b['shift']());}};_0x2339d5(++_0x1ae610);}(_0x9bcc,0x1b7));var _0xc9bc=function(_0x519554,_0x17e6b1){_0x519554=_0x519554-0x0;var _0xf68f51=_0x9bcc[_0x519554];return _0xf68f51;};'use strict';var EventEmitter=require(_0xc9bc('0x0'));var ChatOfflineMessage=require(_0xc9bc('0x1'))['db'][_0xc9bc('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xc9bc('0x3')](0x0);var events={'afterCreate':_0xc9bc('0x4'),'afterUpdate':_0xc9bc('0x5'),'afterDestroy':_0xc9bc('0x6')};function emitEvent(_0xc8f954){return function(_0x1ba2a3,_0x57dc13,_0x5af220){ChatOfflineMessageEvents[_0xc9bc('0x7')](_0xc8f954+':'+_0x1ba2a3['id'],_0x1ba2a3);ChatOfflineMessageEvents[_0xc9bc('0x7')](_0xc8f954,_0x1ba2a3);_0x5af220(null);};}for(var e in events){if(events[_0xc9bc('0x8')](e)){var event=events[e];ChatOfflineMessage[_0xc9bc('0x9')](e,emitEvent(event));}}module[_0xc9bc('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x7343=['hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7343,0xd9));var _0x3734=function(_0x201048,_0x597884){_0x201048=_0x201048-0x0;var _0x3351d6=_0x7343[_0x201048];return _0x3351d6;};'use strict';var EventEmitter=require(_0x3734('0x0'));var ChatOfflineMessage=require(_0x3734('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x3734('0x2')](0x0);var events={'afterCreate':_0x3734('0x3'),'afterUpdate':_0x3734('0x4'),'afterDestroy':_0x3734('0x5')};function emitEvent(_0x18c7c5){return function(_0x361fc5,_0x563e69,_0x602cc3){ChatOfflineMessageEvents[_0x3734('0x6')](_0x18c7c5+':'+_0x361fc5['id'],_0x361fc5);ChatOfflineMessageEvents[_0x3734('0x6')](_0x18c7c5,_0x361fc5);_0x602cc3(null);};}for(var e in events){if(events[_0x3734('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x3734('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 027e3f1..e0c006d 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 _0x4caa=['exports','define','ChatOfflineMessage','utf8mb4','./chatOfflineMessage.attributes'];(function(_0x12f847,_0x245909){var _0x11cbe5=function(_0x374a0b){while(--_0x374a0b){_0x12f847['push'](_0x12f847['shift']());}};_0x11cbe5(++_0x245909);}(_0x4caa,0x6d));var _0xa4ca=function(_0x283f1a,_0x271f9a){_0x283f1a=_0x283f1a-0x0;var _0x3eeb4c=_0x4caa[_0x283f1a];return _0x3eeb4c;};'use strict';var attributes=require(_0xa4ca('0x0'));module[_0xa4ca('0x1')]=function(_0x47ee67){return _0x47ee67[_0xa4ca('0x2')](_0xa4ca('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa4ca('0x4'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe1a7=['exports','ChatOfflineMessage','chat_offline_messages','./chatOfflineMessage.attributes'];(function(_0x2ae4dc,_0x2f481a){var _0x10fe8a=function(_0x41faa9){while(--_0x41faa9){_0x2ae4dc['push'](_0x2ae4dc['shift']());}};_0x10fe8a(++_0x2f481a);}(_0xe1a7,0x8b));var _0x7e1a=function(_0x1a41e5,_0xe89008){_0x1a41e5=_0x1a41e5-0x0;var _0xeb3be8=_0xe1a7[_0x1a41e5];return _0xeb3be8;};'use strict';var attributes=require(_0x7e1a('0x0'));module[_0x7e1a('0x1')]=function(_0x5a3705){return _0x5a3705['define'](_0x7e1a('0x2'),attributes,{'tableName':_0x7e1a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index b166ebf..83e9d72 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 _0x1ba8=['rpc','../../config/environment','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','bluebird','ioredis'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x1ba8,0x10d));var _0x81ba=function(_0x2868c5,_0x4403d8){_0x2868c5=_0x2868c5-0x0;var _0xeb3155=_0x1ba8[_0x2868c5];return _0xeb3155;};'use strict';var _=require(_0x81ba('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x81ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x81ba('0x3'));var config=require(_0x81ba('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x81ba('0x5')][_0x81ba('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5bf14b,_0x5e24d3,_0xc45bdb){return new BPromise(function(_0x43a1a6,_0x418935){return client['request'](_0x5bf14b,_0xc45bdb)[_0x81ba('0x7')](function(_0x5715f2){logger[_0x81ba('0x8')](_0x81ba('0x9'),_0x5e24d3,_0x81ba('0xa'));logger[_0x81ba('0xb')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5e24d3,_0x81ba('0xa'),JSON['stringify'](_0x5715f2));if(_0x5715f2[_0x81ba('0xc')]){if(_0x5715f2[_0x81ba('0xc')][_0x81ba('0xd')]===0x1f4){logger[_0x81ba('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5e24d3,_0x5715f2[_0x81ba('0xc')]['message']);return _0x418935(_0x5715f2[_0x81ba('0xc')][_0x81ba('0xe')]);}logger['error'](_0x81ba('0x9'),_0x5e24d3,_0x5715f2['error'][_0x81ba('0xe')]);return _0x43a1a6(_0x5715f2[_0x81ba('0xc')][_0x81ba('0xe')]);}else{logger[_0x81ba('0x8')](_0x81ba('0x9'),_0x5e24d3,_0x81ba('0xa'));_0x43a1a6(_0x5715f2['result'][_0x81ba('0xe')]);}})[_0x81ba('0xf')](function(_0x3822ea){logger[_0x81ba('0xc')](_0x81ba('0x9'),_0x5e24d3,_0x3822ea);_0x418935(_0x3822ea);});});} \ No newline at end of file +var _0x56a4=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x1917a2,_0x5e0244){var _0x391ccb=function(_0x40d6cc){while(--_0x40d6cc){_0x1917a2['push'](_0x1917a2['shift']());}};_0x391ccb(++_0x5e0244);}(_0x56a4,0x11b));var _0x456a=function(_0x58464f,_0x4918f7){_0x58464f=_0x58464f-0x0;var _0x1d56e=_0x56a4[_0x58464f];return _0x1d56e;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var moment=require('moment');var BPromise=require(_0x456a('0x2'));var rs=require(_0x456a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x456a('0x4'));var logger=require(_0x456a('0x5'))(_0x456a('0x6'));var config=require(_0x456a('0x7'));var jayson=require(_0x456a('0x8'));var client=jayson['client'][_0x456a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52b38d,_0x497df4,_0x2b6329){return new BPromise(function(_0x20c8e0,_0x37f1b4){return client['request'](_0x52b38d,_0x2b6329)[_0x456a('0xa')](function(_0x595c4b){logger[_0x456a('0xb')](_0x456a('0xc'),_0x497df4,_0x456a('0xd'));logger[_0x456a('0xe')](_0x456a('0xf'),_0x497df4,_0x456a('0xd'),JSON[_0x456a('0x10')](_0x595c4b));if(_0x595c4b[_0x456a('0x11')]){if(_0x595c4b[_0x456a('0x11')][_0x456a('0x12')]===0x1f4){logger[_0x456a('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x497df4,_0x595c4b[_0x456a('0x11')]['message']);return _0x37f1b4(_0x595c4b['error'][_0x456a('0x13')]);}logger[_0x456a('0x11')](_0x456a('0xc'),_0x497df4,_0x595c4b[_0x456a('0x11')]['message']);return _0x20c8e0(_0x595c4b[_0x456a('0x11')][_0x456a('0x13')]);}else{logger[_0x456a('0xb')](_0x456a('0xc'),_0x497df4,_0x456a('0xd'));_0x20c8e0(_0x595c4b[_0x456a('0x14')]['message']);}})[_0x456a('0x15')](function(_0x42f7d8){logger[_0x456a('0x11')](_0x456a('0xc'),_0x497df4,_0x42f7d8);_0x37f1b4(_0x42f7d8);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index c4aebdf..b85ef76 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 _0x6adb=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x3c0c0d,_0x2eb1d6){var _0x31bf59=function(_0x1a8df9){while(--_0x1a8df9){_0x3c0c0d['push'](_0x3c0c0d['shift']());}};_0x31bf59(++_0x2eb1d6);}(_0x6adb,0xad));var _0xb6ad=function(_0xc1760e,_0x5f4ecc){_0xc1760e=_0xc1760e-0x0;var _0x40445c=_0x6adb[_0xc1760e];return _0x40445c;};'use strict';var multer=require('multer');var util=require(_0xb6ad('0x0'));var path=require(_0xb6ad('0x1'));var timeout=require(_0xb6ad('0x2'));var express=require(_0xb6ad('0x3'));var router=express[_0xb6ad('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb6ad('0x5'));var interaction=require(_0xb6ad('0x6'));var config=require(_0xb6ad('0x7'));var controller=require(_0xb6ad('0x8'));router[_0xb6ad('0x9')]('/',auth[_0xb6ad('0xa')](),controller[_0xb6ad('0xb')]);router[_0xb6ad('0x9')](_0xb6ad('0xc'),auth[_0xb6ad('0xa')](),controller[_0xb6ad('0xd')]);router[_0xb6ad('0x9')](_0xb6ad('0xe'),auth[_0xb6ad('0xa')](),controller[_0xb6ad('0xf')]);router['post']('/',auth[_0xb6ad('0xa')](),controller[_0xb6ad('0x10')]);router[_0xb6ad('0x11')](_0xb6ad('0xe'),auth['isAuthenticated'](),controller[_0xb6ad('0x12')]);router[_0xb6ad('0x13')](_0xb6ad('0xe'),auth[_0xb6ad('0xa')](),controller[_0xb6ad('0x14')]);module[_0xb6ad('0x15')]=router; \ No newline at end of file +var _0xff2d=['post','create','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x1a03e9,_0x470712){var _0x4fdf58=function(_0x539cca){while(--_0x539cca){_0x1a03e9['push'](_0x1a03e9['shift']());}};_0x4fdf58(++_0x470712);}(_0xff2d,0x16e));var _0xdff2=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xff2d[_0x1abb09];return _0xea1c07;};'use strict';var multer=require(_0xdff2('0x0'));var util=require('util');var path=require(_0xdff2('0x1'));var timeout=require(_0xdff2('0x2'));var express=require(_0xdff2('0x3'));var router=express[_0xdff2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdff2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdff2('0x6'));router[_0xdff2('0x7')]('/',auth[_0xdff2('0x8')](),controller[_0xdff2('0x9')]);router[_0xdff2('0x7')](_0xdff2('0xa'),auth[_0xdff2('0x8')](),controller[_0xdff2('0xb')]);router[_0xdff2('0x7')](_0xdff2('0xc'),auth['isAuthenticated'](),controller[_0xdff2('0xd')]);router[_0xdff2('0xe')]('/',auth[_0xdff2('0x8')](),controller[_0xdff2('0xf')]);router[_0xdff2('0x10')](_0xdff2('0xc'),auth[_0xdff2('0x8')](),controller['update']);router[_0xdff2('0x11')](_0xdff2('0xc'),auth[_0xdff2('0x8')](),controller['destroy']);module[_0xdff2('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 66e6088..496f6f2 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 _0xb07f=['ENUM','mouseOver','timeout','INTEGER','STRING'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xb07f,0x6d));var _0xfb07=function(_0x48bf32,_0x50df36){_0x48bf32=_0x48bf32-0x0;var _0x2fff24=_0xb07f[_0x48bf32];return _0x2fff24;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfb07('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xfb07('0x1')](_0xfb07('0x2'),_0xfb07('0x3')),'defaultValue':_0xfb07('0x2')},'selector':{'type':Sequelize[_0xfb07('0x0')]},'timeout':{'type':Sequelize[_0xfb07('0x4')]}}; \ No newline at end of file +var _0xba30=['sequelize','exports','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xba30,0xe0));var _0x0ba3=function(_0xc0bde9,_0x355373){_0xc0bde9=_0xc0bde9-0x0;var _0x3483f9=_0xba30[_0xc0bde9];return _0x3483f9;};'use strict';var Sequelize=require(_0x0ba3('0x0'));module[_0x0ba3('0x1')]={'name':{'type':Sequelize[_0x0ba3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0ba3('0x3')](_0x0ba3('0x4'),_0x0ba3('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x0ba3('0x2')]},'timeout':{'type':Sequelize[_0x0ba3('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index ce8a087..bf9be08 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 _0xb079=['model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','find','create','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','show','params'];(function(_0x5ddeca,_0x54d349){var _0x1bb689=function(_0x97271){while(--_0x97271){_0x5ddeca['push'](_0x5ddeca['shift']());}};_0x1bb689(++_0x54d349);}(_0xb079,0x1c9));var _0x9b07=function(_0x528fe6,_0x8e6406){_0x528fe6=_0x528fe6-0x0;var _0x7c88d5=_0xb079[_0x528fe6];return _0x7c88d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b07('0x0'));var zipdir=require(_0x9b07('0x1'));var jsonpatch=require(_0x9b07('0x2'));var rp=require(_0x9b07('0x3'));var moment=require(_0x9b07('0x4'));var BPromise=require(_0x9b07('0x5'));var Mustache=require(_0x9b07('0x6'));var util=require(_0x9b07('0x7'));var path=require(_0x9b07('0x8'));var sox=require(_0x9b07('0x9'));var csv=require(_0x9b07('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9b07('0xb'));var _=require(_0x9b07('0xc'));var squel=require('squel');var crypto=require(_0x9b07('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9b07('0xa'));var querystring=require(_0x9b07('0xe'));var Papa=require(_0x9b07('0xf'));var Redis=require(_0x9b07('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9b07('0x11'));var as=require(_0x9b07('0x12'));var hardwareService=require(_0x9b07('0x13'));var logger=require(_0x9b07('0x14'))(_0x9b07('0x15'));var utils=require(_0x9b07('0x16'));var config=require(_0x9b07('0x17'));var licenseUtil=require(_0x9b07('0x18'));var db=require(_0x9b07('0x19'))['db'];function respondWithStatusCode(_0x352289,_0x75d173){_0x75d173=_0x75d173||0xcc;return function(_0x28af25){if(_0x28af25){return _0x352289[_0x9b07('0x1a')](_0x75d173);}return _0x352289['status'](_0x75d173)['end']();};}function respondWithResult(_0x14d026,_0x39883c){_0x39883c=_0x39883c||0xc8;return function(_0x2c359f){if(_0x2c359f){return _0x14d026[_0x9b07('0x1b')](_0x39883c)[_0x9b07('0x1c')](_0x2c359f);}};}function respondWithFilteredResult(_0x558049,_0x398a54){return function(_0x43d4a7){if(_0x43d4a7){var _0x18eda4=typeof _0x398a54['offset']===_0x9b07('0x1d')&&typeof _0x398a54[_0x9b07('0x1e')]===_0x9b07('0x1d');var _0x130668=_0x43d4a7[_0x9b07('0x1f')];var _0x131dd2=_0x18eda4?0x0:_0x398a54[_0x9b07('0x20')];var _0x220bd3=_0x18eda4?_0x43d4a7['count']:_0x398a54['offset']+_0x398a54[_0x9b07('0x1e')];var _0x5e1766;if(_0x220bd3>=_0x130668){_0x220bd3=_0x130668;_0x5e1766=0xc8;}else{_0x5e1766=0xce;}_0x558049[_0x9b07('0x1b')](_0x5e1766);return _0x558049['set'](_0x9b07('0x21'),_0x131dd2+'-'+_0x220bd3+'/'+_0x130668)[_0x9b07('0x1c')](_0x43d4a7);}return null;};}function patchUpdates(_0x3cd5ec){return function(_0x49bab7){try{jsonpatch[_0x9b07('0x22')](_0x49bab7,_0x3cd5ec,!![]);}catch(_0x17c6f3){return BPromise[_0x9b07('0x23')](_0x17c6f3);}return _0x49bab7[_0x9b07('0x24')]();};}function saveUpdates(_0x5be3ce,_0x1254fd){return function(_0x5d1196){if(_0x5d1196){return _0x5d1196[_0x9b07('0x25')](_0x5be3ce)[_0x9b07('0x26')](function(_0x175e87){return _0x175e87;});}return null;};}function removeEntity(_0x39ac29,_0x1ebd07){return function(_0x48144d){if(_0x48144d){return _0x48144d[_0x9b07('0x27')]()['then'](function(){_0x39ac29[_0x9b07('0x1b')](0xcc)[_0x9b07('0x28')]();});}};}function handleEntityNotFound(_0x518f7c,_0x373cdc){return function(_0x56dbe1){if(!_0x56dbe1){_0x518f7c[_0x9b07('0x1a')](0x194);}return _0x56dbe1;};}function handleError(_0x2817d8,_0x2553d9){_0x2553d9=_0x2553d9||0x1f4;return function(_0x25d44a){logger[_0x9b07('0x29')](_0x25d44a[_0x9b07('0x2a')]);if(_0x25d44a[_0x9b07('0x2b')]){delete _0x25d44a[_0x9b07('0x2b')];}_0x2817d8[_0x9b07('0x1b')](_0x2553d9)[_0x9b07('0x2c')](_0x25d44a);};}exports[_0x9b07('0x2d')]=function(_0x3020b4,_0x758425){var _0x1d4040={'raw':!![],'where':{'id':_0x3020b4[_0x9b07('0x2e')]['id']}},_0x57a197={};_0x57a197[_0x9b07('0x2f')]=_[_0x9b07('0x30')](db[_0x9b07('0x31')][_0x9b07('0x32')]);_0x57a197[_0x9b07('0x33')]=_[_0x9b07('0x30')](_0x3020b4[_0x9b07('0x33')]);_0x57a197[_0x9b07('0x34')]=_[_0x9b07('0x35')](_0x57a197[_0x9b07('0x2f')],_0x57a197[_0x9b07('0x33')]);_0x1d4040[_0x9b07('0x36')]=_['intersection'](_0x57a197[_0x9b07('0x2f')],qs[_0x9b07('0x37')](_0x3020b4[_0x9b07('0x33')][_0x9b07('0x37')]));_0x1d4040[_0x9b07('0x36')]=_0x1d4040[_0x9b07('0x36')][_0x9b07('0x38')]?_0x1d4040[_0x9b07('0x36')]:_0x57a197['model'];if(_0x3020b4[_0x9b07('0x33')][_0x9b07('0x39')]){_0x1d4040[_0x9b07('0x3a')]=[{'all':!![]}];}_0x1d4040=_['merge']({},_0x1d4040,_0x3020b4['options']);return db[_0x9b07('0x31')][_0x9b07('0x3b')](_0x1d4040)['then'](handleEntityNotFound(_0x758425,null))[_0x9b07('0x26')](respondWithResult(_0x758425,null))['catch'](handleError(_0x758425,null));};exports[_0x9b07('0x3c')]=function(_0x14104a,_0x4091aa){return db[_0x9b07('0x31')][_0x9b07('0x3c')](_0x14104a['body'],{})[_0x9b07('0x26')](respondWithResult(_0x4091aa,0xc9))[_0x9b07('0x3d')](handleError(_0x4091aa,null));};exports[_0x9b07('0x25')]=function(_0x3891a7,_0x51a0ce){if(_0x3891a7[_0x9b07('0x3e')]['id']){delete _0x3891a7[_0x9b07('0x3e')]['id'];}return db[_0x9b07('0x31')][_0x9b07('0x3b')]({'where':{'id':_0x3891a7[_0x9b07('0x2e')]['id']}})['then'](handleEntityNotFound(_0x51a0ce,null))[_0x9b07('0x26')](saveUpdates(_0x3891a7[_0x9b07('0x3e')],null))[_0x9b07('0x26')](respondWithResult(_0x51a0ce,null))[_0x9b07('0x3d')](handleError(_0x51a0ce,null));};exports['destroy']=function(_0x459956,_0x33b721){return db[_0x9b07('0x31')][_0x9b07('0x3b')]({'where':{'id':_0x459956['params']['id']}})[_0x9b07('0x26')](handleEntityNotFound(_0x33b721,null))[_0x9b07('0x26')](removeEntity(_0x33b721,null))[_0x9b07('0x3d')](handleError(_0x33b721,null));}; \ No newline at end of file +var _0x4403=['squel','jsforce','to-csv','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','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','show','params','model','keys','intersection','attributes','query','includeAll','merge','ChatProactiveAction','then','catch','create','body','find','fast-json-patch','moment','bluebird','mustache','util','sox','fs-extra','lodash'];(function(_0x26aee3,_0x189562){var _0x435f11=function(_0x1acf0c){while(--_0x1acf0c){_0x26aee3['push'](_0x26aee3['shift']());}};_0x435f11(++_0x189562);}(_0x4403,0x179));var _0x3440=function(_0x1b2953,_0x17b156){_0x1b2953=_0x1b2953-0x0;var _0x39cde0=_0x4403[_0x1b2953];return _0x39cde0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3440('0x0'));var rp=require('request-promise');var moment=require(_0x3440('0x1'));var BPromise=require(_0x3440('0x2'));var Mustache=require(_0x3440('0x3'));var util=require(_0x3440('0x4'));var path=require('path');var sox=require(_0x3440('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3440('0x6'));var _=require(_0x3440('0x7'));var squel=require(_0x3440('0x8'));var crypto=require('crypto');var jsforce=require(_0x3440('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x3440('0xa'));var querystring=require(_0x3440('0xb'));var Papa=require(_0x3440('0xc'));var Redis=require('ioredis');var authService=require(_0x3440('0xd'));var qs=require(_0x3440('0xe'));var as=require(_0x3440('0xf'));var hardwareService=require(_0x3440('0x10'));var logger=require(_0x3440('0x11'))(_0x3440('0x12'));var utils=require(_0x3440('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3440('0x14'));var db=require(_0x3440('0x15'))['db'];function respondWithStatusCode(_0x3b0c44,_0x4f541e){_0x4f541e=_0x4f541e||0xcc;return function(_0x270f4a){if(_0x270f4a){return _0x3b0c44[_0x3440('0x16')](_0x4f541e);}return _0x3b0c44[_0x3440('0x17')](_0x4f541e)[_0x3440('0x18')]();};}function respondWithResult(_0x26bfc4,_0x5201e6){_0x5201e6=_0x5201e6||0xc8;return function(_0x36dd82){if(_0x36dd82){return _0x26bfc4['status'](_0x5201e6)[_0x3440('0x19')](_0x36dd82);}};}function respondWithFilteredResult(_0x3bd8dd,_0x33a5bb){return function(_0x18871d){if(_0x18871d){var _0x11930d=typeof _0x33a5bb[_0x3440('0x1a')]===_0x3440('0x1b')&&typeof _0x33a5bb[_0x3440('0x1c')]==='undefined';var _0x30108d=_0x18871d[_0x3440('0x1d')];var _0x43fd39=_0x11930d?0x0:_0x33a5bb[_0x3440('0x1a')];var _0x31a8dd=_0x11930d?_0x18871d[_0x3440('0x1d')]:_0x33a5bb['offset']+_0x33a5bb[_0x3440('0x1c')];var _0x268086;if(_0x31a8dd>=_0x30108d){_0x31a8dd=_0x30108d;_0x268086=0xc8;}else{_0x268086=0xce;}_0x3bd8dd[_0x3440('0x17')](_0x268086);return _0x3bd8dd[_0x3440('0x1e')](_0x3440('0x1f'),_0x43fd39+'-'+_0x31a8dd+'/'+_0x30108d)[_0x3440('0x19')](_0x18871d);}return null;};}function patchUpdates(_0x12030c){return function(_0x36f851){try{jsonpatch[_0x3440('0x20')](_0x36f851,_0x12030c,!![]);}catch(_0xd34993){return BPromise[_0x3440('0x21')](_0xd34993);}return _0x36f851['save']();};}function saveUpdates(_0x485350,_0x5f4386){return function(_0x2c8e7c){if(_0x2c8e7c){return _0x2c8e7c[_0x3440('0x22')](_0x485350)['then'](function(_0x1205ea){return _0x1205ea;});}return null;};}function removeEntity(_0x232b8f,_0x33cfb5){return function(_0x38bf02){if(_0x38bf02){return _0x38bf02[_0x3440('0x23')]()['then'](function(){_0x232b8f[_0x3440('0x17')](0xcc)[_0x3440('0x18')]();});}};}function handleEntityNotFound(_0x3b9e75,_0x15f121){return function(_0xd89efe){if(!_0xd89efe){_0x3b9e75['sendStatus'](0x194);}return _0xd89efe;};}function handleError(_0x381942,_0x2e93c){_0x2e93c=_0x2e93c||0x1f4;return function(_0x1cfe3a){logger[_0x3440('0x24')](_0x1cfe3a[_0x3440('0x25')]);if(_0x1cfe3a['name']){delete _0x1cfe3a[_0x3440('0x26')];}_0x381942[_0x3440('0x17')](_0x2e93c)[_0x3440('0x27')](_0x1cfe3a);};}exports[_0x3440('0x28')]=function(_0x2e6e96,_0x24426a){var _0xe23a={'raw':!![],'where':{'id':_0x2e6e96[_0x3440('0x29')]['id']}},_0x1f7fee={};_0x1f7fee[_0x3440('0x2a')]=_[_0x3440('0x2b')](db['ChatProactiveAction']['rawAttributes']);_0x1f7fee['query']=_['keys'](_0x2e6e96['query']);_0x1f7fee['filters']=_[_0x3440('0x2c')](_0x1f7fee['model'],_0x1f7fee['query']);_0xe23a[_0x3440('0x2d')]=_[_0x3440('0x2c')](_0x1f7fee[_0x3440('0x2a')],qs['fields'](_0x2e6e96[_0x3440('0x2e')]['fields']));_0xe23a['attributes']=_0xe23a[_0x3440('0x2d')]['length']?_0xe23a['attributes']:_0x1f7fee[_0x3440('0x2a')];if(_0x2e6e96['query'][_0x3440('0x2f')]){_0xe23a['include']=[{'all':!![]}];}_0xe23a=_[_0x3440('0x30')]({},_0xe23a,_0x2e6e96['options']);return db[_0x3440('0x31')]['find'](_0xe23a)[_0x3440('0x32')](handleEntityNotFound(_0x24426a,null))[_0x3440('0x32')](respondWithResult(_0x24426a,null))[_0x3440('0x33')](handleError(_0x24426a,null));};exports[_0x3440('0x34')]=function(_0x18dda0,_0x5b27c8){return db[_0x3440('0x31')][_0x3440('0x34')](_0x18dda0[_0x3440('0x35')],{})[_0x3440('0x32')](respondWithResult(_0x5b27c8,0xc9))['catch'](handleError(_0x5b27c8,null));};exports[_0x3440('0x22')]=function(_0x12e049,_0x4cfce5){if(_0x12e049[_0x3440('0x35')]['id']){delete _0x12e049[_0x3440('0x35')]['id'];}return db[_0x3440('0x31')][_0x3440('0x36')]({'where':{'id':_0x12e049[_0x3440('0x29')]['id']}})[_0x3440('0x32')](handleEntityNotFound(_0x4cfce5,null))['then'](saveUpdates(_0x12e049[_0x3440('0x35')],null))[_0x3440('0x32')](respondWithResult(_0x4cfce5,null))[_0x3440('0x33')](handleError(_0x4cfce5,null));};exports['destroy']=function(_0x5f50a4,_0x4e26ce){return db['ChatProactiveAction'][_0x3440('0x36')]({'where':{'id':_0x5f50a4[_0x3440('0x29')]['id']}})[_0x3440('0x32')](handleEntityNotFound(_0x4e26ce,null))[_0x3440('0x32')](removeEntity(_0x4e26ce,null))[_0x3440('0x33')](handleError(_0x4e26ce,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 2766c0d..ce856b1 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 _0x8f43=['define','chat_proactive_actions','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x2bf2f3,_0x1a97c8){var _0x4f0b67=function(_0x3b5cd5){while(--_0x3b5cd5){_0x2bf2f3['push'](_0x2bf2f3['shift']());}};_0x4f0b67(++_0x1a97c8);}(_0x8f43,0x110));var _0x38f4=function(_0x300921,_0x3bca31){_0x300921=_0x300921-0x0;var _0x3feeca=_0x8f43[_0x300921];return _0x3feeca;};'use strict';var _=require(_0x38f4('0x0'));var util=require('util');var logger=require(_0x38f4('0x1'))(_0x38f4('0x2'));var moment=require('moment');var BPromise=require(_0x38f4('0x3'));var rp=require(_0x38f4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x38f4('0x5'));var config=require(_0x38f4('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0x38f4('0x7')]=function(_0x2c8945,_0x2ab0ee){return _0x2c8945[_0x38f4('0x8')]('ChatProactiveAction',attributes,{'tableName':_0x38f4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3086=['exports','define','ChatProactiveAction','chat_proactive_actions','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2045ad,_0x5f28e5){var _0x4cc6b8=function(_0x307bbe){while(--_0x307bbe){_0x2045ad['push'](_0x2045ad['shift']());}};_0x4cc6b8(++_0x5f28e5);}(_0x3086,0x1a8));var _0x6308=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x3086[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6308('0x0'))(_0x6308('0x1'));var moment=require(_0x6308('0x2'));var BPromise=require(_0x6308('0x3'));var rp=require(_0x6308('0x4'));var fs=require('fs');var path=require(_0x6308('0x5'));var rimraf=require(_0x6308('0x6'));var config=require(_0x6308('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0x6308('0x8')]=function(_0x18ccf6,_0x5eb1d6){return _0x18ccf6[_0x6308('0x9')](_0x6308('0xa'),attributes,{'tableName':_0x6308('0xb'),'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 fb1fb26..1792c14 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 _0xe87c=['ioredis','../../config/utils','rpc','jayson/promise','client','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x107f10,_0x5529f2){var _0x811cab=function(_0xc160ea){while(--_0xc160ea){_0x107f10['push'](_0x107f10['shift']());}};_0x811cab(++_0x5529f2);}(_0xe87c,0x87));var _0xce87=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xe87c[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xce87('0x0'));var util=require(_0xce87('0x1'));var moment=require(_0xce87('0x2'));var BPromise=require(_0xce87('0x3'));var rs=require(_0xce87('0x4'));var fs=require('fs');var Redis=require(_0xce87('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xce87('0x6'));var logger=require('../../config/logger')(_0xce87('0x7'));var config=require('../../config/environment');var jayson=require(_0xce87('0x8'));var client=jayson[_0xce87('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x278198,_0x3c44db,_0x2ecb33){return new BPromise(function(_0x130b42,_0xda0593){return client['request'](_0x278198,_0x2ecb33)['then'](function(_0x3ad69b){logger[_0xce87('0xa')](_0xce87('0xb'),_0x3c44db,_0xce87('0xc'));logger['debug'](_0xce87('0xd'),_0x3c44db,'request\x20sent',JSON[_0xce87('0xe')](_0x3ad69b));if(_0x3ad69b['error']){if(_0x3ad69b[_0xce87('0xf')][_0xce87('0x10')]===0x1f4){logger[_0xce87('0xf')](_0xce87('0xb'),_0x3c44db,_0x3ad69b[_0xce87('0xf')][_0xce87('0x11')]);return _0xda0593(_0x3ad69b[_0xce87('0xf')][_0xce87('0x11')]);}logger[_0xce87('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x3c44db,_0x3ad69b[_0xce87('0xf')][_0xce87('0x11')]);return _0x130b42(_0x3ad69b[_0xce87('0xf')][_0xce87('0x11')]);}else{logger['info'](_0xce87('0xb'),_0x3c44db,_0xce87('0xc'));_0x130b42(_0x3ad69b[_0xce87('0x12')][_0xce87('0x11')]);}})[_0xce87('0x13')](function(_0x2859f5){logger[_0xce87('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x3c44db,_0x2859f5);_0xda0593(_0x2859f5);});});} \ No newline at end of file +var _0xdc4b=['../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x7830c6,_0x1f47aa){var _0x9b0c=function(_0x37fe07){while(--_0x37fe07){_0x7830c6['push'](_0x7830c6['shift']());}};_0x9b0c(++_0x1f47aa);}(_0xdc4b,0x123));var _0xbdc4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xdc4b[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xbdc4('0x0'));var moment=require(_0xbdc4('0x1'));var BPromise=require(_0xbdc4('0x2'));var rs=require(_0xbdc4('0x3'));var fs=require('fs');var Redis=require(_0xbdc4('0x4'));var db=require(_0xbdc4('0x5'))['db'];var utils=require(_0xbdc4('0x6'));var logger=require(_0xbdc4('0x7'))('rpc');var config=require(_0xbdc4('0x8'));var jayson=require(_0xbdc4('0x9'));var client=jayson[_0xbdc4('0xa')][_0xbdc4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fd980,_0x1d640a,_0x3f04d5){return new BPromise(function(_0x39bb82,_0x375d65){return client['request'](_0x1fd980,_0x3f04d5)[_0xbdc4('0xc')](function(_0x4aff08){logger[_0xbdc4('0xd')](_0xbdc4('0xe'),_0x1d640a,_0xbdc4('0xf'));logger[_0xbdc4('0x10')](_0xbdc4('0x11'),_0x1d640a,_0xbdc4('0xf'),JSON['stringify'](_0x4aff08));if(_0x4aff08[_0xbdc4('0x12')]){if(_0x4aff08[_0xbdc4('0x12')][_0xbdc4('0x13')]===0x1f4){logger[_0xbdc4('0x12')](_0xbdc4('0xe'),_0x1d640a,_0x4aff08[_0xbdc4('0x12')][_0xbdc4('0x14')]);return _0x375d65(_0x4aff08[_0xbdc4('0x12')][_0xbdc4('0x14')]);}logger[_0xbdc4('0x12')](_0xbdc4('0xe'),_0x1d640a,_0x4aff08['error'][_0xbdc4('0x14')]);return _0x39bb82(_0x4aff08[_0xbdc4('0x12')][_0xbdc4('0x14')]);}else{logger['info'](_0xbdc4('0xe'),_0x1d640a,_0xbdc4('0xf'));_0x39bb82(_0x4aff08[_0xbdc4('0x15')][_0xbdc4('0x14')]);}})[_0xbdc4('0x16')](function(_0xd8bcf1){logger['error'](_0xbdc4('0xe'),_0x1d640a,_0xd8bcf1);_0x375d65(_0xd8bcf1);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 60f8a0a..d260355 100644 --- a/server/api/chatProactiveAction/index.js +++ b/server/api/chatProactiveAction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x038b=['isAuthenticated','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x038b,0x114));var _0xb038=function(_0x115bf4,_0xad70e4){_0x115bf4=_0x115bf4-0x0;var _0x3581f7=_0x038b[_0x115bf4];return _0x3581f7;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0x8')]);router[_0xb038('0x9')]('/',auth[_0xb038('0xa')](),controller['create']);router['put'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['update']);router['delete'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['destroy']);module[_0xb038('0xc')]=router; \ No newline at end of file +var _0x038b=['isAuthenticated','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','show','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x038b,0x114));var _0xb038=function(_0x58756c,_0x212636){_0x58756c=_0x58756c-0x0;var _0x3c2ddd=_0x038b[_0x58756c];return _0x3c2ddd;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0x8')]);router[_0xb038('0x9')]('/',auth[_0xb038('0xa')](),controller['create']);router['put'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['update']);router['delete'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['destroy']);module[_0xb038('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index b578391..ec6b3ac 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 _0x774d=['name','INTEGER','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x487f61,_0x39bd39){var _0x254457=function(_0x2f0533){while(--_0x2f0533){_0x487f61['push'](_0x487f61['shift']());}};_0x254457(++_0x39bd39);}(_0x774d,0x66));var _0xd774=function(_0x19a31e,_0x4d9d56){_0x19a31e=_0x19a31e-0x0;var _0x5a9ed4=_0x774d[_0x19a31e];return _0x5a9ed4;};'use strict';var Sequelize=require(_0xd774('0x0'));module[_0xd774('0x1')]={'name':{'type':Sequelize[_0xd774('0x2')],'unique':_0xd774('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd774('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xd774('0x5'),_0xd774('0x6'))}}; \ No newline at end of file +var _0xd1f5=['rrmemory','beepall','roundrobin','STRING','name','INTEGER','ENUM'];(function(_0xa2d495,_0x4b8476){var _0x531350=function(_0x6a6641){while(--_0x6a6641){_0xa2d495['push'](_0xa2d495['shift']());}};_0x531350(++_0x4b8476);}(_0xd1f5,0x153));var _0x5d1f=function(_0x43959c,_0x5d51d0){_0x43959c=_0x43959c-0x0;var _0x3d8545=_0xd1f5[_0x43959c];return _0x3d8545;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5d1f('0x0')],'unique':_0x5d1f('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5d1f('0x0')]},'timeout':{'type':Sequelize[_0x5d1f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5d1f('0x3')](_0x5d1f('0x4'),_0x5d1f('0x5'),_0x5d1f('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 53a91f4..1cf62a9 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 _0xb172=['online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','select','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','compact','value','removeTeams','removeAgents','userChatQueue:remove','addAgents','spread','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','index','map','ChatQueue','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','options','findAndCountAll','UserId','chatPause','updatedAt','createdAt','%s/%s','getTeams','hasOwnProperty','addTeams','ids','Team','User'];(function(_0x24d9a3,_0x216c1c){var _0x469d26=function(_0x1fb628){while(--_0x1fb628){_0x24d9a3['push'](_0x24d9a3['shift']());}};_0x469d26(++_0x216c1c);}(_0xb172,0xbe));var _0x2b17=function(_0x2e8508,_0xbb9b7c){_0x2e8508=_0x2e8508-0x0;var _0x2daa31=_0xb172[_0x2e8508];return _0x2daa31;};'use strict';var emlformat=require(_0x2b17('0x0'));var rimraf=require(_0x2b17('0x1'));var zipdir=require(_0x2b17('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b17('0x3'));var moment=require(_0x2b17('0x4'));var BPromise=require(_0x2b17('0x5'));var Mustache=require(_0x2b17('0x6'));var util=require(_0x2b17('0x7'));var path=require(_0x2b17('0x8'));var sox=require(_0x2b17('0x9'));var csv=require('to-csv');var ejs=require(_0x2b17('0xa'));var fs=require('fs');var fs_extra=require(_0x2b17('0xb'));var _=require(_0x2b17('0xc'));var squel=require('squel');var crypto=require(_0x2b17('0xd'));var jsforce=require(_0x2b17('0xe'));var deskjs=require(_0x2b17('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2b17('0x10'));var Redis=require(_0x2b17('0x11'));var authService=require(_0x2b17('0x12'));var qs=require(_0x2b17('0x13'));var as=require(_0x2b17('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2b17('0x15'));var utils=require(_0x2b17('0x16'));var config=require(_0x2b17('0x17'));var licenseUtil=require(_0x2b17('0x18'));var db=require(_0x2b17('0x19'))['db'];config[_0x2b17('0x1a')]=_[_0x2b17('0x1b')](config[_0x2b17('0x1a')],{'host':_0x2b17('0x1c'),'port':0x18eb});var socket=require(_0x2b17('0x1d'))(new Redis(config['redis']));require(_0x2b17('0x1e'))[_0x2b17('0x1f')](socket);var jayson=require(_0x2b17('0x20'));var client=jayson['client'][_0x2b17('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5d49b8,_0x1c7221,_0x5ac740,_0x2083b1){return new BPromise(function(_0x540544,_0x424994){var _0x55683c=_0x2083b1||client;return _0x55683c[_0x2b17('0x22')](_0x5d49b8,_0x5ac740)[_0x2b17('0x23')](function(_0x2559f8){logger[_0x2b17('0x24')](_0x2b17('0x25'),_0x1c7221,_0x2b17('0x26'));logger['debug'](_0x2b17('0x27'),_0x1c7221,_0x2b17('0x26'),JSON[_0x2b17('0x28')](_0x2559f8));if(_0x2559f8[_0x2b17('0x29')]){if(_0x2559f8[_0x2b17('0x29')][_0x2b17('0x2a')]===0x1f4){logger[_0x2b17('0x29')](_0x2b17('0x25'),_0x1c7221,_0x2559f8[_0x2b17('0x29')][_0x2b17('0x2b')]);return _0x424994(_0x2559f8[_0x2b17('0x29')]['message']);}logger[_0x2b17('0x29')]('ChatQueue,\x20%s,\x20%s',_0x1c7221,_0x2559f8['error'][_0x2b17('0x2b')]);return _0x540544(_0x2559f8['error']['message']);}else{logger['info'](_0x2b17('0x25'),_0x1c7221,_0x2b17('0x26'));_0x540544(_0x2559f8[_0x2b17('0x2c')][_0x2b17('0x2b')]);}})['catch'](function(_0x5bdc94){logger[_0x2b17('0x29')](_0x2b17('0x25'),_0x1c7221,_0x5bdc94);_0x424994(_0x5bdc94);});});}function respondWithStatusCode(_0xe722d1,_0x2990b2){_0x2990b2=_0x2990b2||0xcc;return function(_0x44ef60){if(_0x44ef60){return _0xe722d1[_0x2b17('0x2d')](_0x2990b2);}return _0xe722d1[_0x2b17('0x2e')](_0x2990b2)[_0x2b17('0x2f')]();};}function respondWithResult(_0x33c2b1,_0x4cf4e2){_0x4cf4e2=_0x4cf4e2||0xc8;return function(_0x95eea5){if(_0x95eea5){return _0x33c2b1[_0x2b17('0x2e')](_0x4cf4e2)['json'](_0x95eea5);}};}function respondWithFilteredResult(_0x1f677f,_0xf21741){return function(_0x37d012){if(_0x37d012){var _0x14367b=typeof _0xf21741[_0x2b17('0x30')]===_0x2b17('0x31')&&typeof _0xf21741[_0x2b17('0x32')]==='undefined';var _0x38cba8=_0x37d012[_0x2b17('0x33')];var _0x1356e0=_0x14367b?0x0:_0xf21741['offset'];var _0x191431=_0x14367b?_0x37d012[_0x2b17('0x33')]:_0xf21741[_0x2b17('0x30')]+_0xf21741[_0x2b17('0x32')];var _0x489239;if(_0x191431>=_0x38cba8){_0x191431=_0x38cba8;_0x489239=0xc8;}else{_0x489239=0xce;}_0x1f677f[_0x2b17('0x2e')](_0x489239);return _0x1f677f[_0x2b17('0x34')](_0x2b17('0x35'),_0x1356e0+'-'+_0x191431+'/'+_0x38cba8)['json'](_0x37d012);}return null;};}function patchUpdates(_0x484d32){return function(_0x41f1e7){try{jsonpatch[_0x2b17('0x36')](_0x41f1e7,_0x484d32,!![]);}catch(_0x1a5c17){return BPromise[_0x2b17('0x37')](_0x1a5c17);}return _0x41f1e7[_0x2b17('0x38')]();};}function saveUpdates(_0x2322ab,_0x119bc8){return function(_0x2b809f){if(_0x2b809f){return _0x2b809f[_0x2b17('0x39')](_0x2322ab)[_0x2b17('0x23')](function(_0x3f3b5e){return _0x3f3b5e;});}return null;};}function removeEntity(_0xc7cb65,_0x538fe0){return function(_0x5532ae){if(_0x5532ae){return _0x5532ae[_0x2b17('0x3a')]()['then'](function(){var _0x46f9c5=_0x5532ae[_0x2b17('0x3b')]({'plain':!![]});var _0x4bfb1d=_0x2b17('0x3c');return db[_0x2b17('0x3d')][_0x2b17('0x3a')]({'where':{'type':_0x4bfb1d,'resourceId':_0x46f9c5['id']}})[_0x2b17('0x23')](function(){return _0x5532ae;});})['then'](function(){_0xc7cb65[_0x2b17('0x2e')](0xcc)[_0x2b17('0x2f')]();});}};}function handleEntityNotFound(_0x1a4cf4,_0x5d9c98){return function(_0x241c0a){if(!_0x241c0a){_0x1a4cf4[_0x2b17('0x2d')](0x194);}return _0x241c0a;};}function handleError(_0x248d79,_0x377da5){_0x377da5=_0x377da5||0x1f4;return function(_0xac101d){logger[_0x2b17('0x29')](_0xac101d[_0x2b17('0x3e')]);if(_0xac101d[_0x2b17('0x3f')]){delete _0xac101d[_0x2b17('0x3f')];}_0x248d79[_0x2b17('0x2e')](_0x377da5)['send'](_0xac101d);};}exports[_0x2b17('0x40')]=function(_0x4aca8e,_0x35dd38){var _0x3b3281={},_0x2c07e0={},_0x4c8314={'count':0x0,'rows':[]};var _0x360304=_[_0x2b17('0x41')](db[_0x2b17('0x42')]['rawAttributes'],function(_0x520151){return{'name':_0x520151['fieldName'],'type':_0x520151[_0x2b17('0x43')][_0x2b17('0x44')]};});_0x2c07e0[_0x2b17('0x45')]=_[_0x2b17('0x41')](_0x360304,'name');_0x2c07e0[_0x2b17('0x46')]=_[_0x2b17('0x47')](_0x4aca8e[_0x2b17('0x46')]);_0x2c07e0[_0x2b17('0x48')]=_[_0x2b17('0x49')](_0x2c07e0[_0x2b17('0x45')],_0x2c07e0[_0x2b17('0x46')]);_0x3b3281[_0x2b17('0x4a')]=_[_0x2b17('0x49')](_0x2c07e0[_0x2b17('0x45')],qs['fields'](_0x4aca8e['query'][_0x2b17('0x4b')]));_0x3b3281[_0x2b17('0x4a')]=_0x3b3281[_0x2b17('0x4a')][_0x2b17('0x4c')]?_0x3b3281[_0x2b17('0x4a')]:_0x2c07e0['model'];if(!_0x4aca8e['query']['hasOwnProperty'](_0x2b17('0x4d'))){_0x3b3281[_0x2b17('0x32')]=qs[_0x2b17('0x32')](_0x4aca8e[_0x2b17('0x46')][_0x2b17('0x32')]);_0x3b3281['offset']=qs[_0x2b17('0x30')](_0x4aca8e[_0x2b17('0x46')][_0x2b17('0x30')]);}_0x3b3281[_0x2b17('0x4e')]=qs[_0x2b17('0x4f')](_0x4aca8e[_0x2b17('0x46')][_0x2b17('0x4f')]);_0x3b3281[_0x2b17('0x50')]=qs[_0x2b17('0x48')](_[_0x2b17('0x51')](_0x4aca8e['query'],_0x2c07e0[_0x2b17('0x48')]),_0x360304);if(_0x4aca8e['query'][_0x2b17('0x52')]){_0x3b3281[_0x2b17('0x50')]=_[_0x2b17('0x53')](_0x3b3281[_0x2b17('0x50')],{'$or':_[_0x2b17('0x41')](_0x360304,function(_0x56c5dd){if(_0x56c5dd[_0x2b17('0x43')]!==_0x2b17('0x54')){var _0x7ca2cc={};_0x7ca2cc[_0x56c5dd[_0x2b17('0x3f')]]={'$like':'%'+_0x4aca8e['query'][_0x2b17('0x52')]+'%'};return _0x7ca2cc;}})});}_0x3b3281=_['merge']({},_0x3b3281,_0x4aca8e['options']);var _0x4948d6={'where':_0x3b3281[_0x2b17('0x50')]};return db[_0x2b17('0x42')][_0x2b17('0x33')](_0x4948d6)[_0x2b17('0x23')](function(_0x5ac06a){_0x4c8314[_0x2b17('0x33')]=_0x5ac06a;if(_0x4aca8e[_0x2b17('0x46')][_0x2b17('0x55')]){_0x3b3281[_0x2b17('0x56')]=[{'all':!![]}];}return db[_0x2b17('0x42')][_0x2b17('0x57')](_0x3b3281);})[_0x2b17('0x23')](function(_0x508649){_0x4c8314[_0x2b17('0x58')]=_0x508649;return _0x4c8314;})[_0x2b17('0x23')](respondWithFilteredResult(_0x35dd38,_0x3b3281))[_0x2b17('0x59')](handleError(_0x35dd38,null));};exports[_0x2b17('0x5a')]=function(_0x132e7d,_0x34555e){var _0xe79790={'raw':!![],'where':{'id':_0x132e7d['params']['id']}},_0x1789c7={};_0x1789c7['model']=_['keys'](db['ChatQueue'][_0x2b17('0x5b')]);_0x1789c7[_0x2b17('0x46')]=_[_0x2b17('0x47')](_0x132e7d[_0x2b17('0x46')]);_0x1789c7['filters']=_[_0x2b17('0x49')](_0x1789c7['model'],_0x1789c7[_0x2b17('0x46')]);_0xe79790[_0x2b17('0x4a')]=_[_0x2b17('0x49')](_0x1789c7['model'],qs[_0x2b17('0x4b')](_0x132e7d[_0x2b17('0x46')][_0x2b17('0x4b')]));_0xe79790[_0x2b17('0x4a')]=_0xe79790['attributes'][_0x2b17('0x4c')]?_0xe79790[_0x2b17('0x4a')]:_0x1789c7[_0x2b17('0x45')];if(_0x132e7d[_0x2b17('0x46')][_0x2b17('0x55')]){_0xe79790[_0x2b17('0x56')]=[{'all':!![]}];}_0xe79790=_[_0x2b17('0x53')]({},_0xe79790,_0x132e7d['options']);return db[_0x2b17('0x42')][_0x2b17('0x5c')](_0xe79790)[_0x2b17('0x23')](handleEntityNotFound(_0x34555e,null))[_0x2b17('0x23')](respondWithResult(_0x34555e,null))['catch'](handleError(_0x34555e,null));};exports[_0x2b17('0x5d')]=function(_0x547a0d,_0x11bdf7){return db[_0x2b17('0x42')][_0x2b17('0x5d')](_0x547a0d[_0x2b17('0x5e')],{})[_0x2b17('0x23')](function(_0x537627){var _0x5b2ded=_0x547a0d[_0x2b17('0x5f')]['get']({'plain':!![]});if(!_0x5b2ded)throw new Error(_0x2b17('0x60'));if(_0x5b2ded['role']===_0x2b17('0x5f')){var _0xa17cda=_0x537627[_0x2b17('0x3b')]({'plain':!![]});var _0xf0c5bb=_0x2b17('0x3c');return db[_0x2b17('0x61')][_0x2b17('0x5c')]({'where':{'name':_0xf0c5bb,'userProfileId':_0x5b2ded[_0x2b17('0x62')]},'raw':!![]})[_0x2b17('0x23')](function(_0x17e5c9){if(_0x17e5c9&&_0x17e5c9['autoAssociation']===0x0){return db[_0x2b17('0x3d')][_0x2b17('0x5d')]({'name':_0xa17cda[_0x2b17('0x3f')],'resourceId':_0xa17cda['id'],'type':_0x17e5c9[_0x2b17('0x3f')],'sectionId':_0x17e5c9['id']},{})[_0x2b17('0x23')](function(){return _0x537627;});}else{return _0x537627;}})['catch'](function(_0x2e00c4){logger['error'](_0x2b17('0x63'),_0x2e00c4);throw _0x2e00c4;});}return _0x537627;})[_0x2b17('0x23')](respondWithResult(_0x11bdf7,0xc9))[_0x2b17('0x59')](handleError(_0x11bdf7,null));};exports[_0x2b17('0x39')]=function(_0x9a0bd7,_0x1124d7){if(_0x9a0bd7[_0x2b17('0x5e')]['id']){delete _0x9a0bd7['body']['id'];}return db[_0x2b17('0x42')][_0x2b17('0x5c')]({'where':{'id':_0x9a0bd7[_0x2b17('0x64')]['id']}})[_0x2b17('0x23')](handleEntityNotFound(_0x1124d7,null))['then'](saveUpdates(_0x9a0bd7[_0x2b17('0x5e')],null))['then'](respondWithResult(_0x1124d7,null))['catch'](handleError(_0x1124d7,null));};exports[_0x2b17('0x3a')]=function(_0x3b0068,_0x539fae){return db['ChatQueue'][_0x2b17('0x5c')]({'where':{'id':_0x3b0068[_0x2b17('0x64')]['id']}})['then'](handleEntityNotFound(_0x539fae,null))[_0x2b17('0x23')](removeEntity(_0x539fae,null))['catch'](handleError(_0x539fae,null));};exports[_0x2b17('0x65')]=function(_0x2da533,_0x4cf4db){return db[_0x2b17('0x42')][_0x2b17('0x65')]()[_0x2b17('0x23')](respondWithResult(_0x4cf4db,null))['catch'](handleError(_0x4cf4db,null));};exports[_0x2b17('0x66')]=function(_0xcf3365,_0x1d9a20,_0x2ffd8e){var _0x115b59={'raw':!![],'where':{}},_0x54f41a={},_0x36a685;return db[_0x2b17('0x42')][_0x2b17('0x67')]({'where':{'id':_0xcf3365[_0x2b17('0x64')]['id']}})[_0x2b17('0x23')](handleEntityNotFound(_0x1d9a20,null))['then'](function(_0x5bbd5f){if(_0x5bbd5f){_0x36a685=_0x5bbd5f[_0x2b17('0x3b')]({'plain':!![]});_0x54f41a[_0x2b17('0x45')]=_['keys'](db[_0x2b17('0x68')][_0x2b17('0x5b')]);_0x54f41a[_0x2b17('0x46')]=_['keys'](_0xcf3365[_0x2b17('0x46')]);_0x54f41a[_0x2b17('0x48')]=_[_0x2b17('0x49')](_0x54f41a[_0x2b17('0x45')],_0x54f41a[_0x2b17('0x46')]);_0x115b59[_0x2b17('0x4a')]=_[_0x2b17('0x49')](_0x54f41a[_0x2b17('0x45')],qs[_0x2b17('0x4b')](_0xcf3365[_0x2b17('0x46')][_0x2b17('0x4b')]));_0x115b59['attributes']=_0x115b59[_0x2b17('0x4a')][_0x2b17('0x4c')]?_0x115b59[_0x2b17('0x4a')]:_0x54f41a[_0x2b17('0x45')];if(!_0xcf3365[_0x2b17('0x46')]['hasOwnProperty'](_0x2b17('0x4d'))){_0x115b59[_0x2b17('0x32')]=qs[_0x2b17('0x32')](_0xcf3365[_0x2b17('0x46')][_0x2b17('0x32')]);_0x115b59[_0x2b17('0x30')]=qs[_0x2b17('0x30')](_0xcf3365[_0x2b17('0x46')][_0x2b17('0x30')]);}_0x115b59[_0x2b17('0x4e')]=qs[_0x2b17('0x4f')](_0xcf3365[_0x2b17('0x46')]['sort']);_0x115b59[_0x2b17('0x50')]=qs[_0x2b17('0x48')](_[_0x2b17('0x51')](_0xcf3365[_0x2b17('0x46')],_0x54f41a['filters']));_0x115b59[_0x2b17('0x50')]['ChatQueueId']=_0x5bbd5f['id'];if(_0xcf3365[_0x2b17('0x46')][_0x2b17('0x52')]){_0x115b59['where']=_['merge'](_0x115b59['where'],{'$or':_[_0x2b17('0x41')](_0x115b59[_0x2b17('0x4a')],function(_0x20fe81){var _0xa4400a={};_0xa4400a[_0x20fe81]={'$like':'%'+_0xcf3365[_0x2b17('0x46')][_0x2b17('0x52')]+'%'};return _0xa4400a;})});}_0x115b59=_[_0x2b17('0x53')]({},_0x115b59,_0xcf3365[_0x2b17('0x69')]);return db[_0x2b17('0x68')][_0x2b17('0x57')](_0x115b59);}})[_0x2b17('0x23')](function(_0xe0215){if(_0xe0215){return db['User'][_0x2b17('0x6a')]({'where':{'id':_[_0x2b17('0x41')](_0xe0215,_0x2b17('0x6b')),'role':'agent'},'attributes':['id',_0x2b17('0x3f'),_0x2b17('0x6c'),_0x2b17('0x6d'),_0x2b17('0x6e')]});}})['then'](function(_0x41be5c){if(_0x41be5c){return{'count':_0x41be5c['count'],'rows':_['map'](_0x41be5c[_0x2b17('0x58')],function(_0x1325e8){return{'membername':_0x1325e8['name'],'UserId':_0x1325e8['id'],'queue_name':_0x36a685[_0x2b17('0x3f')],'ChatQueueId':_0x36a685['id'],'interface':util['format'](_0x2b17('0x6f'),'SIP',_0x1325e8[_0x2b17('0x3f')]),'penalty':0x0,'paused':_0x1325e8[_0x2b17('0x6c')],'createdAt':_0x1325e8[_0x2b17('0x6e')],'updatedAt':_0x1325e8[_0x2b17('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2b17('0x23')](respondWithFilteredResult(_0x1d9a20,_0x115b59))[_0x2b17('0x59')](handleError(_0x1d9a20,null));};exports[_0x2b17('0x70')]=function(_0x14054e,_0x30c1f0,_0x23e686){var _0x41e668={};var _0x4c9a8d={};var _0x1046b4;var _0x2c9ca0;return db['ChatQueue']['findOne']({'where':{'id':_0x14054e[_0x2b17('0x64')]['id']}})[_0x2b17('0x23')](handleEntityNotFound(_0x30c1f0,null))[_0x2b17('0x23')](function(_0x2fa6ee){if(_0x2fa6ee){_0x1046b4=_0x2fa6ee;_0x4c9a8d[_0x2b17('0x45')]=_['keys'](db['Team'][_0x2b17('0x5b')]);_0x4c9a8d[_0x2b17('0x46')]=_[_0x2b17('0x47')](_0x14054e['query']);_0x4c9a8d[_0x2b17('0x48')]=_[_0x2b17('0x49')](_0x4c9a8d[_0x2b17('0x45')],_0x4c9a8d[_0x2b17('0x46')]);_0x41e668[_0x2b17('0x4a')]=_[_0x2b17('0x49')](_0x4c9a8d[_0x2b17('0x45')],qs['fields'](_0x14054e['query'][_0x2b17('0x4b')]));_0x41e668['attributes']=_0x41e668[_0x2b17('0x4a')][_0x2b17('0x4c')]?_0x41e668[_0x2b17('0x4a')]:_0x4c9a8d[_0x2b17('0x45')];_0x41e668[_0x2b17('0x4e')]=qs[_0x2b17('0x4f')](_0x14054e[_0x2b17('0x46')]['sort']);_0x41e668[_0x2b17('0x50')]=qs[_0x2b17('0x48')](_['pick'](_0x14054e[_0x2b17('0x46')],_0x4c9a8d['filters']));if(_0x14054e['query']['filter']){_0x41e668['where']=_[_0x2b17('0x53')](_0x41e668[_0x2b17('0x50')],{'$or':_['map'](_0x41e668['attributes'],function(_0xcd9131){var _0x4ef65b={};_0x4ef65b[_0xcd9131]={'$like':'%'+_0x14054e[_0x2b17('0x46')]['filter']+'%'};return _0x4ef65b;})});}_0x41e668=_[_0x2b17('0x53')]({},_0x41e668,_0x14054e[_0x2b17('0x69')]);return _0x1046b4['getTeams'](_0x41e668);}})[_0x2b17('0x23')](function(_0xe13bda){if(_0xe13bda){_0x2c9ca0=_0xe13bda[_0x2b17('0x4c')];if(!_0x14054e[_0x2b17('0x46')][_0x2b17('0x71')](_0x2b17('0x4d'))){_0x41e668[_0x2b17('0x32')]=qs['limit'](_0x14054e[_0x2b17('0x46')][_0x2b17('0x32')]);_0x41e668[_0x2b17('0x30')]=qs[_0x2b17('0x30')](_0x14054e[_0x2b17('0x46')][_0x2b17('0x30')]);}return _0x1046b4[_0x2b17('0x70')](_0x41e668);}})[_0x2b17('0x23')](function(_0x456426){if(_0x456426){return _0x456426?{'count':_0x2c9ca0,'rows':_0x456426}:null;}})[_0x2b17('0x23')](respondWithResult(_0x30c1f0,null))[_0x2b17('0x59')](handleError(_0x30c1f0,null));};exports[_0x2b17('0x72')]=function(_0x21c9ed,_0x543757,_0x5bcbef){var _0x38c50d=_0x21c9ed[_0x2b17('0x5e')][_0x2b17('0x73')];return db[_0x2b17('0x74')]['findAll']({'where':{'id':_0x38c50d},'attributes':['id'],'include':[{'model':db[_0x2b17('0x75')],'as':'Agents','attributes':['id',_0x2b17('0x3f'),_0x2b17('0x76'),_0x2b17('0x77'),_0x2b17('0x78')],'raw':!![]}]})[_0x2b17('0x23')](function(_0xa0bc68){if(_0xa0bc68){var _0x5f3cc1=_[_0x2b17('0x79')](_0xa0bc68,function(_0x543d49){var _0x2a0ed0=_0x543d49[_0x2b17('0x3b')]({'plain':!![]});return _0x2a0ed0[_0x2b17('0x7a')];});return db[_0x2b17('0x42')][_0x2b17('0x5c')]({'where':{'id':_0x21c9ed['params']['id']}})['then'](function(_0x4cef6b){return db[_0x2b17('0x7b')][_0x2b17('0x7c')](function(_0x1adead){return _0x4cef6b['addTeams'](_0x38c50d,{'transaction':_0x1adead})[_0x2b17('0x23')](function(){return BPromise[_0x2b17('0x7d')](_0x5f3cc1,function(_0x108347){return db[_0x2b17('0x68')][_0x2b17('0x7e')]({'where':{'UserId':_0x108347['id'],'ChatQueueId':_0x21c9ed[_0x2b17('0x64')]['id']},'transaction':_0x1adead});});})['then'](function(){_0x5f3cc1[_0x2b17('0x7f')](function(_0x24ebb5){socket[_0x2b17('0x80')](_0x2b17('0x81'),{'UserId':_0x24ebb5['id'],'ChatQueueId':_0x4cef6b['id']});});});});});}})[_0x2b17('0x23')](respondWithStatusCode(_0x543757,null))[_0x2b17('0x59')](handleError(_0x543757,null));};exports['removeTeams']=function(_0x18df60,_0x105998,_0x4b5f81){return db[_0x2b17('0x74')][_0x2b17('0x57')]({'where':{'id':_0x18df60[_0x2b17('0x46')][_0x2b17('0x73')]},'attributes':['id'],'include':[{'model':db[_0x2b17('0x75')],'as':_0x2b17('0x7a'),'attributes':['id'],'raw':!![]}]})[_0x2b17('0x23')](handleEntityNotFound(_0x105998,null))['then'](function(_0x3471f9){var _0x48b610=_['map'](_0x3471f9,'id');var _0x14e20f=[];var _0x48d019=[];var _0x4d1dbf=squel[_0x2b17('0x82')]();_0x4d1dbf['field'](_0x2b17('0x83'))[_0x2b17('0x84')](_0x2b17('0x85'),'tq')['join'](_0x2b17('0x86'),'ut',_0x2b17('0x87'))[_0x2b17('0x50')](_0x2b17('0x88'),_0x18df60[_0x2b17('0x64')]['id']);for(var _0x3750d2=0x0;_0x3750d2<_0x3471f9[_0x2b17('0x4c')];_0x3750d2+=0x1){let _0x5db703=_0x3471f9[_0x3750d2];for(var _0x2bfe6a=0x0;_0x2bfe6a<_0x5db703['Agents'][_0x2b17('0x4c')];_0x2bfe6a+=0x1){let _0x1b69a1=_0x5db703[_0x2b17('0x7a')][_0x2bfe6a];var _0x1bbe65=_0x4d1dbf[_0x2b17('0x89')]();_0x1bbe65['where'](_0x2b17('0x8a'),_0x1b69a1['id']);_0x48d019[_0x2b17('0x8b')](db[_0x2b17('0x7b')][_0x2b17('0x46')](_0x1bbe65[_0x2b17('0x8c')](),{'type':db[_0x2b17('0x7b')]['QueryTypes'][_0x2b17('0x8d')]})[_0x2b17('0x23')](function(_0x1331a1){if(_0x1331a1[_0x2b17('0x4c')]===0x1){return _0x1b69a1['id'];}else{var _0x3d6a6b=_[_0x2b17('0x8e')](_[_0x2b17('0x41')](_0x1331a1,_0x2b17('0x8f')),function(_0x5701ea){return _[_0x2b17('0x90')](_0x48b610,_0x5701ea);});if(_0x3d6a6b){return _0x1b69a1['id'];}}}));}}return BPromise['all'](_0x48d019)[_0x2b17('0x23')](function(_0x2cc1cf){_0x14e20f=_(_0x14e20f)[_0x2b17('0x91')](_0x2cc1cf)[_0x2b17('0x92')]()[_0x2b17('0x93')]();return db[_0x2b17('0x42')][_0x2b17('0x5c')]({'where':{'id':_0x18df60['params']['id']}})['then'](function(_0x2daf01){return db[_0x2b17('0x7b')]['transaction'](function(_0x14aec1){return _0x2daf01[_0x2b17('0x94')](_0x18df60['query'][_0x2b17('0x73')],{'transaction':_0x14aec1})[_0x2b17('0x23')](function(){if(!_['isEmpty'](_0x14e20f)){return _0x2daf01[_0x2b17('0x95')](_0x14e20f,{'transaction':_0x14aec1});}})[_0x2b17('0x23')](function(){_0x14e20f[_0x2b17('0x7f')](function(_0x91a7bf){socket[_0x2b17('0x80')](_0x2b17('0x96'),{'UserId':_0x91a7bf,'ChatQueueId':_0x2daf01['id']});});});});});});})[_0x2b17('0x23')](respondWithStatusCode(_0x105998,null))[_0x2b17('0x59')](handleError(_0x105998,null));};exports[_0x2b17('0x97')]=function(_0x4245e5,_0x4b3889,_0x1b25e4){return db['ChatQueue']['find']({'where':{'id':_0x4245e5['params']['id']}})['then'](handleEntityNotFound(_0x4b3889,null))[_0x2b17('0x23')](function(_0x1241a8){if(_0x1241a8){return _0x1241a8[_0x2b17('0x97')](_0x4245e5['body'][_0x2b17('0x73')],_['omit'](_0x4245e5['body'],['ids','id'])||{})[_0x2b17('0x98')](function(_0x22f0b7){for(var _0x5d5b27=0x0;_0x5d5b27<_0x4245e5[_0x2b17('0x5e')][_0x2b17('0x73')][_0x2b17('0x4c')];_0x5d5b27+=0x1){socket[_0x2b17('0x80')](_0x2b17('0x81'),{'UserId':Number(_0x4245e5[_0x2b17('0x5e')]['ids'][_0x5d5b27]),'ChatQueueId':Number(_0x4245e5[_0x2b17('0x64')]['id'])});}return _0x22f0b7;});}})[_0x2b17('0x23')](respondWithResult(_0x4b3889,null))[_0x2b17('0x59')](handleError(_0x4b3889,null));};exports[_0x2b17('0x95')]=function(_0x12ccac,_0x3b859a,_0x28fa0f){return db[_0x2b17('0x42')][_0x2b17('0x5c')]({'where':{'id':_0x12ccac[_0x2b17('0x64')]['id']}})[_0x2b17('0x23')](handleEntityNotFound(_0x3b859a,null))[_0x2b17('0x23')](function(_0x2bb2bf){if(_0x2bb2bf){return _0x2bb2bf['removeAgents'](_0x12ccac[_0x2b17('0x46')][_0x2b17('0x73')])[_0x2b17('0x23')](function(){if(_['isArray'](_0x12ccac[_0x2b17('0x46')][_0x2b17('0x73')])){for(var _0x461966=0x0;_0x461966<_0x12ccac[_0x2b17('0x46')][_0x2b17('0x73')][_0x2b17('0x4c')];_0x461966+=0x1){socket[_0x2b17('0x80')](_0x2b17('0x96'),{'UserId':Number(_0x12ccac[_0x2b17('0x46')][_0x2b17('0x73')][_0x461966]),'ChatQueueId':Number(_0x12ccac[_0x2b17('0x64')]['id'])});}}else{socket[_0x2b17('0x80')](_0x2b17('0x96'),{'UserId':Number(_0x12ccac[_0x2b17('0x46')][_0x2b17('0x73')]),'ChatQueueId':Number(_0x12ccac['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3b859a,null))['catch'](handleError(_0x3b859a,null));};exports[_0x2b17('0x99')]=function(_0x172d1a,_0x2bc5fa,_0x51f049){var _0x349905={};var _0x5dd2ac={};var _0x4bbed9;var _0x5aed2c;return db['ChatQueue'][_0x2b17('0x67')]({'where':{'id':_0x172d1a[_0x2b17('0x64')]['id']}})['then'](handleEntityNotFound(_0x2bc5fa,null))[_0x2b17('0x23')](function(_0x74c020){if(_0x74c020){_0x4bbed9=_0x74c020;_0x5dd2ac[_0x2b17('0x45')]=_[_0x2b17('0x47')](db[_0x2b17('0x75')][_0x2b17('0x5b')]);_0x5dd2ac[_0x2b17('0x46')]=_['keys'](_0x172d1a['query']);_0x5dd2ac[_0x2b17('0x48')]=_[_0x2b17('0x49')](_0x5dd2ac[_0x2b17('0x45')],_0x5dd2ac[_0x2b17('0x46')]);_0x349905[_0x2b17('0x4a')]=_['intersection'](_0x5dd2ac[_0x2b17('0x45')],qs[_0x2b17('0x4b')](_0x172d1a[_0x2b17('0x46')][_0x2b17('0x4b')]));_0x349905[_0x2b17('0x4a')]=_0x349905[_0x2b17('0x4a')]['length']?_0x349905[_0x2b17('0x4a')]:_0x5dd2ac[_0x2b17('0x45')];_0x349905[_0x2b17('0x4e')]=qs['sort'](_0x172d1a[_0x2b17('0x46')]['sort']);_0x349905[_0x2b17('0x50')]=qs['filters'](_[_0x2b17('0x51')](_0x172d1a[_0x2b17('0x46')],_0x5dd2ac[_0x2b17('0x48')]));if(_0x172d1a[_0x2b17('0x46')][_0x2b17('0x52')]){_0x349905[_0x2b17('0x50')]=_['merge'](_0x349905['where'],{'$or':_[_0x2b17('0x41')](_0x349905[_0x2b17('0x4a')],function(_0x561592){var _0x5706bd={};_0x5706bd[_0x561592]={'$like':'%'+_0x172d1a[_0x2b17('0x46')]['filter']+'%'};return _0x5706bd;})});}_0x349905=_[_0x2b17('0x53')]({},_0x349905,_0x172d1a[_0x2b17('0x69')]);return _0x4bbed9[_0x2b17('0x99')](_0x349905);}})[_0x2b17('0x23')](function(_0x3089fe){if(_0x3089fe){_0x5aed2c=_0x3089fe[_0x2b17('0x4c')];if(!_0x172d1a[_0x2b17('0x46')]['hasOwnProperty'](_0x2b17('0x4d'))){_0x349905['limit']=qs[_0x2b17('0x32')](_0x172d1a['query'][_0x2b17('0x32')]);_0x349905[_0x2b17('0x30')]=qs[_0x2b17('0x30')](_0x172d1a[_0x2b17('0x46')]['offset']);}return _0x4bbed9[_0x2b17('0x99')](_0x349905);}})['then'](function(_0x4836da){if(_0x4836da){return _0x4836da?{'count':_0x5aed2c,'rows':_0x4836da}:null;}})[_0x2b17('0x23')](respondWithResult(_0x2bc5fa,null))['catch'](handleError(_0x2bc5fa,null));}; \ No newline at end of file +var _0x6878=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','ChatQueueId','UserChatQueue','User','agent','chatPause','createdAt','%s/%s','SIP','Team','getTeams','addTeams','Agents','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','userChatQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','stack','name','map','ChatQueue','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x1581c6,_0x10bab7){var _0x3b6c6e=function(_0x1306e9){while(--_0x1306e9){_0x1581c6['push'](_0x1581c6['shift']());}};_0x3b6c6e(++_0x10bab7);}(_0x6878,0x171));var _0x8687=function(_0x4e797b,_0x3d7623){_0x4e797b=_0x4e797b-0x0;var _0xe42e3f=_0x6878[_0x4e797b];return _0xe42e3f;};'use strict';var emlformat=require(_0x8687('0x0'));var rimraf=require(_0x8687('0x1'));var zipdir=require(_0x8687('0x2'));var jsonpatch=require(_0x8687('0x3'));var rp=require(_0x8687('0x4'));var moment=require(_0x8687('0x5'));var BPromise=require(_0x8687('0x6'));var Mustache=require(_0x8687('0x7'));var util=require(_0x8687('0x8'));var path=require(_0x8687('0x9'));var sox=require(_0x8687('0xa'));var csv=require('to-csv');var ejs=require(_0x8687('0xb'));var fs=require('fs');var fs_extra=require(_0x8687('0xc'));var _=require('lodash');var squel=require(_0x8687('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8687('0xe'));var querystring=require(_0x8687('0xf'));var Papa=require(_0x8687('0x10'));var Redis=require(_0x8687('0x11'));var authService=require(_0x8687('0x12'));var qs=require(_0x8687('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8687('0x14'));var logger=require(_0x8687('0x15'))(_0x8687('0x16'));var utils=require('../../config/utils');var config=require(_0x8687('0x17'));var licenseUtil=require(_0x8687('0x18'));var db=require(_0x8687('0x19'))['db'];config[_0x8687('0x1a')]=_[_0x8687('0x1b')](config[_0x8687('0x1a')],{'host':_0x8687('0x1c'),'port':0x18eb});var socket=require(_0x8687('0x1d'))(new Redis(config[_0x8687('0x1a')]));require(_0x8687('0x1e'))[_0x8687('0x1f')](socket);var jayson=require(_0x8687('0x20'));var client=jayson[_0x8687('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x213387,_0x548060,_0x33efd5,_0x146548){return new BPromise(function(_0x51fa56,_0x40adbc){var _0x122ceb=_0x146548||client;return _0x122ceb[_0x8687('0x22')](_0x213387,_0x33efd5)[_0x8687('0x23')](function(_0x42e596){logger[_0x8687('0x24')](_0x8687('0x25'),_0x548060,_0x8687('0x26'));logger[_0x8687('0x27')](_0x8687('0x28'),_0x548060,_0x8687('0x26'),JSON[_0x8687('0x29')](_0x42e596));if(_0x42e596[_0x8687('0x2a')]){if(_0x42e596[_0x8687('0x2a')][_0x8687('0x2b')]===0x1f4){logger[_0x8687('0x2a')](_0x8687('0x25'),_0x548060,_0x42e596[_0x8687('0x2a')][_0x8687('0x2c')]);return _0x40adbc(_0x42e596[_0x8687('0x2a')]['message']);}logger[_0x8687('0x2a')](_0x8687('0x25'),_0x548060,_0x42e596[_0x8687('0x2a')][_0x8687('0x2c')]);return _0x51fa56(_0x42e596['error'][_0x8687('0x2c')]);}else{logger[_0x8687('0x24')](_0x8687('0x25'),_0x548060,_0x8687('0x26'));_0x51fa56(_0x42e596[_0x8687('0x2d')][_0x8687('0x2c')]);}})[_0x8687('0x2e')](function(_0x6e0343){logger[_0x8687('0x2a')](_0x8687('0x25'),_0x548060,_0x6e0343);_0x40adbc(_0x6e0343);});});}function respondWithStatusCode(_0x3bcba8,_0x2b7889){_0x2b7889=_0x2b7889||0xcc;return function(_0x124180){if(_0x124180){return _0x3bcba8[_0x8687('0x2f')](_0x2b7889);}return _0x3bcba8[_0x8687('0x30')](_0x2b7889)[_0x8687('0x31')]();};}function respondWithResult(_0x320761,_0x74c2ec){_0x74c2ec=_0x74c2ec||0xc8;return function(_0x4299cf){if(_0x4299cf){return _0x320761['status'](_0x74c2ec)[_0x8687('0x32')](_0x4299cf);}};}function respondWithFilteredResult(_0x377756,_0x457a07){return function(_0x2d7ef9){if(_0x2d7ef9){var _0x22612d=typeof _0x457a07[_0x8687('0x33')]===_0x8687('0x34')&&typeof _0x457a07[_0x8687('0x35')]===_0x8687('0x34');var _0x16061f=_0x2d7ef9[_0x8687('0x36')];var _0xde216b=_0x22612d?0x0:_0x457a07[_0x8687('0x33')];var _0x8005ce=_0x22612d?_0x2d7ef9[_0x8687('0x36')]:_0x457a07[_0x8687('0x33')]+_0x457a07['limit'];var _0x1713d5;if(_0x8005ce>=_0x16061f){_0x8005ce=_0x16061f;_0x1713d5=0xc8;}else{_0x1713d5=0xce;}_0x377756[_0x8687('0x30')](_0x1713d5);return _0x377756[_0x8687('0x37')](_0x8687('0x38'),_0xde216b+'-'+_0x8005ce+'/'+_0x16061f)[_0x8687('0x32')](_0x2d7ef9);}return null;};}function patchUpdates(_0x536bad){return function(_0x3ca246){try{jsonpatch[_0x8687('0x39')](_0x3ca246,_0x536bad,!![]);}catch(_0x2d98d7){return BPromise[_0x8687('0x3a')](_0x2d98d7);}return _0x3ca246[_0x8687('0x3b')]();};}function saveUpdates(_0x403dd7,_0x53b814){return function(_0x490d1a){if(_0x490d1a){return _0x490d1a[_0x8687('0x3c')](_0x403dd7)[_0x8687('0x23')](function(_0x106fe3){return _0x106fe3;});}return null;};}function removeEntity(_0x399676,_0x28ef89){return function(_0x4fcd15){if(_0x4fcd15){return _0x4fcd15[_0x8687('0x3d')]()[_0x8687('0x23')](function(){var _0x211898=_0x4fcd15[_0x8687('0x3e')]({'plain':!![]});var _0x21f44e=_0x8687('0x3f');return db['UserProfileResource'][_0x8687('0x3d')]({'where':{'type':_0x21f44e,'resourceId':_0x211898['id']}})[_0x8687('0x23')](function(){return _0x4fcd15;});})['then'](function(){_0x399676[_0x8687('0x30')](0xcc)[_0x8687('0x31')]();});}};}function handleEntityNotFound(_0x42c5ce,_0x4b17b8){return function(_0x34e656){if(!_0x34e656){_0x42c5ce[_0x8687('0x2f')](0x194);}return _0x34e656;};}function handleError(_0x528801,_0x38640f){_0x38640f=_0x38640f||0x1f4;return function(_0x6b3b2e){logger[_0x8687('0x2a')](_0x6b3b2e[_0x8687('0x40')]);if(_0x6b3b2e[_0x8687('0x41')]){delete _0x6b3b2e[_0x8687('0x41')];}_0x528801[_0x8687('0x30')](_0x38640f)['send'](_0x6b3b2e);};}exports['index']=function(_0x468906,_0x2f4c50){var _0xfedc17={},_0x2a19cc={},_0x329525={'count':0x0,'rows':[]};var _0x4153e8=_[_0x8687('0x42')](db[_0x8687('0x43')][_0x8687('0x44')],function(_0x11a11d){return{'name':_0x11a11d[_0x8687('0x45')],'type':_0x11a11d[_0x8687('0x46')][_0x8687('0x47')]};});_0x2a19cc['model']=_[_0x8687('0x42')](_0x4153e8,'name');_0x2a19cc[_0x8687('0x48')]=_['keys'](_0x468906[_0x8687('0x48')]);_0x2a19cc['filters']=_[_0x8687('0x49')](_0x2a19cc[_0x8687('0x4a')],_0x2a19cc['query']);_0xfedc17[_0x8687('0x4b')]=_[_0x8687('0x49')](_0x2a19cc['model'],qs['fields'](_0x468906[_0x8687('0x48')][_0x8687('0x4c')]));_0xfedc17['attributes']=_0xfedc17[_0x8687('0x4b')][_0x8687('0x4d')]?_0xfedc17['attributes']:_0x2a19cc[_0x8687('0x4a')];if(!_0x468906[_0x8687('0x48')][_0x8687('0x4e')](_0x8687('0x4f'))){_0xfedc17[_0x8687('0x35')]=qs[_0x8687('0x35')](_0x468906[_0x8687('0x48')][_0x8687('0x35')]);_0xfedc17['offset']=qs[_0x8687('0x33')](_0x468906['query'][_0x8687('0x33')]);}_0xfedc17[_0x8687('0x50')]=qs[_0x8687('0x51')](_0x468906['query']['sort']);_0xfedc17[_0x8687('0x52')]=qs[_0x8687('0x53')](_[_0x8687('0x54')](_0x468906[_0x8687('0x48')],_0x2a19cc[_0x8687('0x53')]),_0x4153e8);if(_0x468906[_0x8687('0x48')][_0x8687('0x55')]){_0xfedc17['where']=_[_0x8687('0x56')](_0xfedc17[_0x8687('0x52')],{'$or':_['map'](_0x4153e8,function(_0x222a0c){if(_0x222a0c[_0x8687('0x46')]!==_0x8687('0x57')){var _0x1c8ab5={};_0x1c8ab5[_0x222a0c[_0x8687('0x41')]]={'$like':'%'+_0x468906['query'][_0x8687('0x55')]+'%'};return _0x1c8ab5;}})});}_0xfedc17=_['merge']({},_0xfedc17,_0x468906[_0x8687('0x58')]);var _0x1660f1={'where':_0xfedc17['where']};return db[_0x8687('0x43')][_0x8687('0x36')](_0x1660f1)[_0x8687('0x23')](function(_0x2d84e2){_0x329525[_0x8687('0x36')]=_0x2d84e2;if(_0x468906[_0x8687('0x48')][_0x8687('0x59')]){_0xfedc17[_0x8687('0x5a')]=[{'all':!![]}];}return db[_0x8687('0x43')][_0x8687('0x5b')](_0xfedc17);})[_0x8687('0x23')](function(_0x129688){_0x329525[_0x8687('0x5c')]=_0x129688;return _0x329525;})[_0x8687('0x23')](respondWithFilteredResult(_0x2f4c50,_0xfedc17))[_0x8687('0x2e')](handleError(_0x2f4c50,null));};exports[_0x8687('0x5d')]=function(_0x3aca4b,_0x1fb9f1){var _0x196bf5={'raw':!![],'where':{'id':_0x3aca4b[_0x8687('0x5e')]['id']}},_0x434739={};_0x434739[_0x8687('0x4a')]=_['keys'](db[_0x8687('0x43')]['rawAttributes']);_0x434739['query']=_[_0x8687('0x5f')](_0x3aca4b[_0x8687('0x48')]);_0x434739['filters']=_[_0x8687('0x49')](_0x434739['model'],_0x434739[_0x8687('0x48')]);_0x196bf5['attributes']=_[_0x8687('0x49')](_0x434739[_0x8687('0x4a')],qs[_0x8687('0x4c')](_0x3aca4b[_0x8687('0x48')]['fields']));_0x196bf5['attributes']=_0x196bf5[_0x8687('0x4b')][_0x8687('0x4d')]?_0x196bf5[_0x8687('0x4b')]:_0x434739['model'];if(_0x3aca4b[_0x8687('0x48')][_0x8687('0x59')]){_0x196bf5[_0x8687('0x5a')]=[{'all':!![]}];}_0x196bf5=_[_0x8687('0x56')]({},_0x196bf5,_0x3aca4b[_0x8687('0x58')]);return db[_0x8687('0x43')][_0x8687('0x60')](_0x196bf5)[_0x8687('0x23')](handleEntityNotFound(_0x1fb9f1,null))[_0x8687('0x23')](respondWithResult(_0x1fb9f1,null))[_0x8687('0x2e')](handleError(_0x1fb9f1,null));};exports['create']=function(_0x36a57c,_0x63cd8a){return db[_0x8687('0x43')]['create'](_0x36a57c['body'],{})['then'](function(_0x52c5e4){var _0x13a1ea=_0x36a57c['user'][_0x8687('0x3e')]({'plain':!![]});if(!_0x13a1ea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13a1ea['role']===_0x8687('0x61')){var _0x40b415=_0x52c5e4[_0x8687('0x3e')]({'plain':!![]});var _0x5b4a46='ChatQueues';return db[_0x8687('0x62')][_0x8687('0x60')]({'where':{'name':_0x5b4a46,'userProfileId':_0x13a1ea[_0x8687('0x63')]},'raw':!![]})[_0x8687('0x23')](function(_0x3a6ae7){if(_0x3a6ae7&&_0x3a6ae7[_0x8687('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x40b415['name'],'resourceId':_0x40b415['id'],'type':_0x3a6ae7[_0x8687('0x41')],'sectionId':_0x3a6ae7['id']},{})[_0x8687('0x23')](function(){return _0x52c5e4;});}else{return _0x52c5e4;}})[_0x8687('0x2e')](function(_0x24223e){logger[_0x8687('0x2a')](_0x8687('0x65'),_0x24223e);throw _0x24223e;});}return _0x52c5e4;})[_0x8687('0x23')](respondWithResult(_0x63cd8a,0xc9))[_0x8687('0x2e')](handleError(_0x63cd8a,null));};exports[_0x8687('0x3c')]=function(_0x1053f6,_0x4f8e54){if(_0x1053f6[_0x8687('0x66')]['id']){delete _0x1053f6[_0x8687('0x66')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x1053f6['params']['id']}})[_0x8687('0x23')](handleEntityNotFound(_0x4f8e54,null))['then'](saveUpdates(_0x1053f6[_0x8687('0x66')],null))[_0x8687('0x23')](respondWithResult(_0x4f8e54,null))[_0x8687('0x2e')](handleError(_0x4f8e54,null));};exports[_0x8687('0x3d')]=function(_0x285338,_0x4319eb){return db[_0x8687('0x43')][_0x8687('0x60')]({'where':{'id':_0x285338[_0x8687('0x5e')]['id']}})[_0x8687('0x23')](handleEntityNotFound(_0x4319eb,null))['then'](removeEntity(_0x4319eb,null))['catch'](handleError(_0x4319eb,null));};exports[_0x8687('0x67')]=function(_0x574df4,_0x225fb1){return db['ChatQueue']['describe']()['then'](respondWithResult(_0x225fb1,null))['catch'](handleError(_0x225fb1,null));};exports[_0x8687('0x68')]=function(_0x39183a,_0x48cf0f,_0x1294ae){var _0x2783f3={'raw':!![],'where':{}},_0x5e0e1a={},_0x19d3ea;return db[_0x8687('0x43')][_0x8687('0x69')]({'where':{'id':_0x39183a[_0x8687('0x5e')]['id']}})['then'](handleEntityNotFound(_0x48cf0f,null))[_0x8687('0x23')](function(_0x479d0a){if(_0x479d0a){_0x19d3ea=_0x479d0a[_0x8687('0x3e')]({'plain':!![]});_0x5e0e1a[_0x8687('0x4a')]=_['keys'](db['UserChatQueue'][_0x8687('0x44')]);_0x5e0e1a[_0x8687('0x48')]=_['keys'](_0x39183a[_0x8687('0x48')]);_0x5e0e1a[_0x8687('0x53')]=_['intersection'](_0x5e0e1a[_0x8687('0x4a')],_0x5e0e1a[_0x8687('0x48')]);_0x2783f3[_0x8687('0x4b')]=_['intersection'](_0x5e0e1a[_0x8687('0x4a')],qs['fields'](_0x39183a[_0x8687('0x48')][_0x8687('0x4c')]));_0x2783f3[_0x8687('0x4b')]=_0x2783f3[_0x8687('0x4b')][_0x8687('0x4d')]?_0x2783f3[_0x8687('0x4b')]:_0x5e0e1a['model'];if(!_0x39183a['query']['hasOwnProperty'](_0x8687('0x4f'))){_0x2783f3['limit']=qs[_0x8687('0x35')](_0x39183a[_0x8687('0x48')][_0x8687('0x35')]);_0x2783f3[_0x8687('0x33')]=qs[_0x8687('0x33')](_0x39183a[_0x8687('0x48')]['offset']);}_0x2783f3['order']=qs[_0x8687('0x51')](_0x39183a[_0x8687('0x48')][_0x8687('0x51')]);_0x2783f3[_0x8687('0x52')]=qs[_0x8687('0x53')](_[_0x8687('0x54')](_0x39183a[_0x8687('0x48')],_0x5e0e1a[_0x8687('0x53')]));_0x2783f3[_0x8687('0x52')][_0x8687('0x6a')]=_0x479d0a['id'];if(_0x39183a['query'][_0x8687('0x55')]){_0x2783f3[_0x8687('0x52')]=_[_0x8687('0x56')](_0x2783f3['where'],{'$or':_[_0x8687('0x42')](_0x2783f3[_0x8687('0x4b')],function(_0x32261b){var _0x3e1b7e={};_0x3e1b7e[_0x32261b]={'$like':'%'+_0x39183a[_0x8687('0x48')][_0x8687('0x55')]+'%'};return _0x3e1b7e;})});}_0x2783f3=_[_0x8687('0x56')]({},_0x2783f3,_0x39183a[_0x8687('0x58')]);return db[_0x8687('0x6b')][_0x8687('0x5b')](_0x2783f3);}})[_0x8687('0x23')](function(_0x5dbff6){if(_0x5dbff6){return db[_0x8687('0x6c')]['findAndCountAll']({'where':{'id':_[_0x8687('0x42')](_0x5dbff6,'UserId'),'role':_0x8687('0x6d')},'attributes':['id',_0x8687('0x41'),_0x8687('0x6e'),'updatedAt',_0x8687('0x6f')]});}})[_0x8687('0x23')](function(_0x1c5c1f){if(_0x1c5c1f){return{'count':_0x1c5c1f[_0x8687('0x36')],'rows':_['map'](_0x1c5c1f[_0x8687('0x5c')],function(_0x24fca9){return{'membername':_0x24fca9[_0x8687('0x41')],'UserId':_0x24fca9['id'],'queue_name':_0x19d3ea['name'],'ChatQueueId':_0x19d3ea['id'],'interface':util['format'](_0x8687('0x70'),_0x8687('0x71'),_0x24fca9['name']),'penalty':0x0,'paused':_0x24fca9[_0x8687('0x6e')],'createdAt':_0x24fca9['createdAt'],'updatedAt':_0x24fca9['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8687('0x23')](respondWithFilteredResult(_0x48cf0f,_0x2783f3))['catch'](handleError(_0x48cf0f,null));};exports['getTeams']=function(_0x2696a9,_0x5b80a6,_0x451103){var _0x3413b1={};var _0x3103bc={};var _0x8dfad9;var _0xc27bfe;return db[_0x8687('0x43')][_0x8687('0x69')]({'where':{'id':_0x2696a9['params']['id']}})[_0x8687('0x23')](handleEntityNotFound(_0x5b80a6,null))[_0x8687('0x23')](function(_0xdbf453){if(_0xdbf453){_0x8dfad9=_0xdbf453;_0x3103bc[_0x8687('0x4a')]=_['keys'](db[_0x8687('0x72')][_0x8687('0x44')]);_0x3103bc[_0x8687('0x48')]=_[_0x8687('0x5f')](_0x2696a9[_0x8687('0x48')]);_0x3103bc[_0x8687('0x53')]=_['intersection'](_0x3103bc['model'],_0x3103bc[_0x8687('0x48')]);_0x3413b1[_0x8687('0x4b')]=_['intersection'](_0x3103bc[_0x8687('0x4a')],qs[_0x8687('0x4c')](_0x2696a9[_0x8687('0x48')][_0x8687('0x4c')]));_0x3413b1[_0x8687('0x4b')]=_0x3413b1[_0x8687('0x4b')][_0x8687('0x4d')]?_0x3413b1['attributes']:_0x3103bc[_0x8687('0x4a')];_0x3413b1[_0x8687('0x50')]=qs[_0x8687('0x51')](_0x2696a9['query'][_0x8687('0x51')]);_0x3413b1[_0x8687('0x52')]=qs[_0x8687('0x53')](_[_0x8687('0x54')](_0x2696a9[_0x8687('0x48')],_0x3103bc[_0x8687('0x53')]));if(_0x2696a9[_0x8687('0x48')]['filter']){_0x3413b1[_0x8687('0x52')]=_[_0x8687('0x56')](_0x3413b1[_0x8687('0x52')],{'$or':_[_0x8687('0x42')](_0x3413b1[_0x8687('0x4b')],function(_0x4608cf){var _0x249280={};_0x249280[_0x4608cf]={'$like':'%'+_0x2696a9[_0x8687('0x48')][_0x8687('0x55')]+'%'};return _0x249280;})});}_0x3413b1=_[_0x8687('0x56')]({},_0x3413b1,_0x2696a9[_0x8687('0x58')]);return _0x8dfad9[_0x8687('0x73')](_0x3413b1);}})[_0x8687('0x23')](function(_0x1773c8){if(_0x1773c8){_0xc27bfe=_0x1773c8[_0x8687('0x4d')];if(!_0x2696a9[_0x8687('0x48')][_0x8687('0x4e')]('nolimit')){_0x3413b1[_0x8687('0x35')]=qs[_0x8687('0x35')](_0x2696a9['query'][_0x8687('0x35')]);_0x3413b1[_0x8687('0x33')]=qs['offset'](_0x2696a9[_0x8687('0x48')]['offset']);}return _0x8dfad9[_0x8687('0x73')](_0x3413b1);}})[_0x8687('0x23')](function(_0x4bc53a){if(_0x4bc53a){return _0x4bc53a?{'count':_0xc27bfe,'rows':_0x4bc53a}:null;}})[_0x8687('0x23')](respondWithResult(_0x5b80a6,null))[_0x8687('0x2e')](handleError(_0x5b80a6,null));};exports[_0x8687('0x74')]=function(_0x1ef545,_0x309a99,_0x2a8ff0){var _0x2fe279=_0x1ef545[_0x8687('0x66')]['ids'];return db[_0x8687('0x72')][_0x8687('0x5b')]({'where':{'id':_0x2fe279},'attributes':['id'],'include':[{'model':db[_0x8687('0x6c')],'as':_0x8687('0x75'),'attributes':['id','name','online','voicePause',_0x8687('0x76')],'raw':!![]}]})[_0x8687('0x23')](function(_0x3ede43){if(_0x3ede43){var _0x3bbf99=_[_0x8687('0x77')](_0x3ede43,function(_0xbfd33e){var _0x272a0f=_0xbfd33e[_0x8687('0x3e')]({'plain':!![]});return _0x272a0f[_0x8687('0x75')];});return db[_0x8687('0x43')]['find']({'where':{'id':_0x1ef545[_0x8687('0x5e')]['id']}})[_0x8687('0x23')](function(_0x2bec86){return db[_0x8687('0x78')][_0x8687('0x79')](function(_0x2dcbf8){return _0x2bec86[_0x8687('0x74')](_0x2fe279,{'transaction':_0x2dcbf8})[_0x8687('0x23')](function(){return BPromise['each'](_0x3bbf99,function(_0xcc2e2d){return db[_0x8687('0x6b')][_0x8687('0x7a')]({'where':{'UserId':_0xcc2e2d['id'],'ChatQueueId':_0x1ef545[_0x8687('0x5e')]['id']},'transaction':_0x2dcbf8});});})[_0x8687('0x23')](function(){_0x3bbf99[_0x8687('0x7b')](function(_0x50df9c){socket[_0x8687('0x7c')](_0x8687('0x7d'),{'UserId':_0x50df9c['id'],'ChatQueueId':_0x2bec86['id']});});});});});}})[_0x8687('0x23')](respondWithStatusCode(_0x309a99,null))[_0x8687('0x2e')](handleError(_0x309a99,null));};exports[_0x8687('0x7e')]=function(_0x4ce9d1,_0x5d34be,_0x4f76bd){return db['Team'][_0x8687('0x5b')]({'where':{'id':_0x4ce9d1[_0x8687('0x48')][_0x8687('0x7f')]},'attributes':['id'],'include':[{'model':db[_0x8687('0x6c')],'as':_0x8687('0x75'),'attributes':['id'],'raw':!![]}]})[_0x8687('0x23')](handleEntityNotFound(_0x5d34be,null))[_0x8687('0x23')](function(_0x196e3b){var _0x575339=_[_0x8687('0x42')](_0x196e3b,'id');var _0x1ad5f6=[];var _0x23f063=[];var _0x1e5953=squel[_0x8687('0x80')]();_0x1e5953[_0x8687('0x81')](_0x8687('0x82'))['from']('team_has_chat_queues','tq')[_0x8687('0x83')](_0x8687('0x84'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8687('0x85'),_0x4ce9d1[_0x8687('0x5e')]['id']);for(var _0x5015ef=0x0;_0x5015ef<_0x196e3b[_0x8687('0x4d')];_0x5015ef+=0x1){let _0x1bc0f7=_0x196e3b[_0x5015ef];for(var _0x1e82d8=0x0;_0x1e82d8<_0x1bc0f7['Agents']['length'];_0x1e82d8+=0x1){let _0x55a8db=_0x1bc0f7[_0x8687('0x75')][_0x1e82d8];var _0x41a9d8=_0x1e5953[_0x8687('0x86')]();_0x41a9d8[_0x8687('0x52')](_0x8687('0x87'),_0x55a8db['id']);_0x23f063[_0x8687('0x88')](db['sequelize'][_0x8687('0x48')](_0x41a9d8['toString'](),{'type':db[_0x8687('0x78')][_0x8687('0x89')][_0x8687('0x8a')]})['then'](function(_0x7a0147){if(_0x7a0147[_0x8687('0x4d')]===0x1){return _0x55a8db['id'];}else{var _0x35e5e4=_[_0x8687('0x8b')](_[_0x8687('0x42')](_0x7a0147,'TeamId'),function(_0x2ad0fc){return _[_0x8687('0x8c')](_0x575339,_0x2ad0fc);});if(_0x35e5e4){return _0x55a8db['id'];}}}));}}return BPromise['all'](_0x23f063)['then'](function(_0x31f20a){_0x1ad5f6=_(_0x1ad5f6)[_0x8687('0x8d')](_0x31f20a)[_0x8687('0x8e')]()[_0x8687('0x8f')]();return db[_0x8687('0x43')][_0x8687('0x60')]({'where':{'id':_0x4ce9d1[_0x8687('0x5e')]['id']}})[_0x8687('0x23')](function(_0x11dc1d){return db[_0x8687('0x78')][_0x8687('0x79')](function(_0x33ccc6){return _0x11dc1d['removeTeams'](_0x4ce9d1[_0x8687('0x48')]['ids'],{'transaction':_0x33ccc6})[_0x8687('0x23')](function(){if(!_[_0x8687('0x90')](_0x1ad5f6)){return _0x11dc1d['removeAgents'](_0x1ad5f6,{'transaction':_0x33ccc6});}})[_0x8687('0x23')](function(){_0x1ad5f6[_0x8687('0x7b')](function(_0x37a04c){socket[_0x8687('0x7c')](_0x8687('0x91'),{'UserId':_0x37a04c,'ChatQueueId':_0x11dc1d['id']});});});});});});})['then'](respondWithStatusCode(_0x5d34be,null))['catch'](handleError(_0x5d34be,null));};exports['addAgents']=function(_0x4443e2,_0x11f540,_0x3a7a5d){return db['ChatQueue'][_0x8687('0x60')]({'where':{'id':_0x4443e2['params']['id']}})['then'](handleEntityNotFound(_0x11f540,null))['then'](function(_0x19f587){if(_0x19f587){return _0x19f587[_0x8687('0x92')](_0x4443e2[_0x8687('0x66')][_0x8687('0x7f')],_[_0x8687('0x93')](_0x4443e2[_0x8687('0x66')],[_0x8687('0x7f'),'id'])||{})[_0x8687('0x94')](function(_0x22d581){for(var _0xdae1eb=0x0;_0xdae1eb<_0x4443e2[_0x8687('0x66')][_0x8687('0x7f')][_0x8687('0x4d')];_0xdae1eb+=0x1){socket['emit'](_0x8687('0x7d'),{'UserId':Number(_0x4443e2[_0x8687('0x66')]['ids'][_0xdae1eb]),'ChatQueueId':Number(_0x4443e2['params']['id'])});}return _0x22d581;});}})['then'](respondWithResult(_0x11f540,null))[_0x8687('0x2e')](handleError(_0x11f540,null));};exports[_0x8687('0x95')]=function(_0x207137,_0x5a03c6,_0x59c650){return db[_0x8687('0x43')]['find']({'where':{'id':_0x207137[_0x8687('0x5e')]['id']}})[_0x8687('0x23')](handleEntityNotFound(_0x5a03c6,null))[_0x8687('0x23')](function(_0x49b555){if(_0x49b555){return _0x49b555[_0x8687('0x95')](_0x207137[_0x8687('0x48')][_0x8687('0x7f')])[_0x8687('0x23')](function(){if(_['isArray'](_0x207137[_0x8687('0x48')]['ids'])){for(var _0x577dee=0x0;_0x577dee<_0x207137[_0x8687('0x48')][_0x8687('0x7f')]['length'];_0x577dee+=0x1){socket[_0x8687('0x7c')]('userChatQueue:remove',{'UserId':Number(_0x207137[_0x8687('0x48')][_0x8687('0x7f')][_0x577dee]),'ChatQueueId':Number(_0x207137[_0x8687('0x5e')]['id'])});}}else{socket[_0x8687('0x7c')](_0x8687('0x91'),{'UserId':Number(_0x207137[_0x8687('0x48')][_0x8687('0x7f')]),'ChatQueueId':Number(_0x207137['params']['id'])});}});}})[_0x8687('0x23')](respondWithStatusCode(_0x5a03c6,null))[_0x8687('0x2e')](handleError(_0x5a03c6,null));};exports['getAgents']=function(_0x586d38,_0x5ca4e5,_0xcd0305){var _0x5d1a09={};var _0x219b50={};var _0x545145;var _0x6ac4a6;return db['ChatQueue'][_0x8687('0x69')]({'where':{'id':_0x586d38[_0x8687('0x5e')]['id']}})[_0x8687('0x23')](handleEntityNotFound(_0x5ca4e5,null))[_0x8687('0x23')](function(_0x49bba0){if(_0x49bba0){_0x545145=_0x49bba0;_0x219b50[_0x8687('0x4a')]=_[_0x8687('0x5f')](db[_0x8687('0x6c')][_0x8687('0x44')]);_0x219b50[_0x8687('0x48')]=_[_0x8687('0x5f')](_0x586d38['query']);_0x219b50[_0x8687('0x53')]=_[_0x8687('0x49')](_0x219b50[_0x8687('0x4a')],_0x219b50['query']);_0x5d1a09['attributes']=_[_0x8687('0x49')](_0x219b50[_0x8687('0x4a')],qs[_0x8687('0x4c')](_0x586d38[_0x8687('0x48')][_0x8687('0x4c')]));_0x5d1a09[_0x8687('0x4b')]=_0x5d1a09[_0x8687('0x4b')][_0x8687('0x4d')]?_0x5d1a09['attributes']:_0x219b50['model'];_0x5d1a09[_0x8687('0x50')]=qs[_0x8687('0x51')](_0x586d38[_0x8687('0x48')][_0x8687('0x51')]);_0x5d1a09[_0x8687('0x52')]=qs[_0x8687('0x53')](_[_0x8687('0x54')](_0x586d38[_0x8687('0x48')],_0x219b50[_0x8687('0x53')]));if(_0x586d38[_0x8687('0x48')][_0x8687('0x55')]){_0x5d1a09[_0x8687('0x52')]=_[_0x8687('0x56')](_0x5d1a09[_0x8687('0x52')],{'$or':_['map'](_0x5d1a09['attributes'],function(_0x278987){var _0x1618ea={};_0x1618ea[_0x278987]={'$like':'%'+_0x586d38['query'][_0x8687('0x55')]+'%'};return _0x1618ea;})});}_0x5d1a09=_[_0x8687('0x56')]({},_0x5d1a09,_0x586d38[_0x8687('0x58')]);return _0x545145[_0x8687('0x96')](_0x5d1a09);}})['then'](function(_0x4d5ec6){if(_0x4d5ec6){_0x6ac4a6=_0x4d5ec6[_0x8687('0x4d')];if(!_0x586d38['query'][_0x8687('0x4e')](_0x8687('0x4f'))){_0x5d1a09[_0x8687('0x35')]=qs[_0x8687('0x35')](_0x586d38['query'][_0x8687('0x35')]);_0x5d1a09[_0x8687('0x33')]=qs['offset'](_0x586d38[_0x8687('0x48')][_0x8687('0x33')]);}return _0x545145[_0x8687('0x96')](_0x5d1a09);}})[_0x8687('0x23')](function(_0x132d3f){if(_0x132d3f){return _0x132d3f?{'count':_0x6ac4a6,'rows':_0x132d3f}:null;}})[_0x8687('0x23')](respondWithResult(_0x5ca4e5,null))[_0x8687('0x2e')](handleError(_0x5ca4e5,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 32968bd..19f9b7d 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 _0x149c=['exports','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x30f310,_0x299ac1){var _0x51e8e2=function(_0x4aa010){while(--_0x4aa010){_0x30f310['push'](_0x30f310['shift']());}};_0x51e8e2(++_0x299ac1);}(_0x149c,0x143));var _0xc149=function(_0x2554c8,_0xa97f86){_0x2554c8=_0x2554c8-0x0;var _0x47c346=_0x149c[_0x2554c8];return _0x47c346;};'use strict';var EventEmitter=require(_0xc149('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xc149('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xc149('0x2')](0x0);var events={'afterCreate':_0xc149('0x3'),'afterUpdate':'update','afterDestroy':_0xc149('0x4')};function emitEvent(_0x27b283){return function(_0x19a7cb,_0x298415,_0x166647){ChatQueueEvents[_0xc149('0x5')](_0x27b283+':'+_0x19a7cb['id'],_0x19a7cb);ChatQueueEvents[_0xc149('0x5')](_0x27b283,_0x19a7cb);_0x166647(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xc149('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0x37ca=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','save','remove'];(function(_0x2755d3,_0x219134){var _0xc0afd8=function(_0x383037){while(--_0x383037){_0x2755d3['push'](_0x2755d3['shift']());}};_0xc0afd8(++_0x219134);}(_0x37ca,0x112));var _0xa37c=function(_0x192199,_0x3c6d4e){_0x192199=_0x192199-0x0;var _0x689797=_0x37ca[_0x192199];return _0x689797;};'use strict';var EventEmitter=require(_0xa37c('0x0'));var ChatQueue=require(_0xa37c('0x1'))['db'][_0xa37c('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa37c('0x3'),'afterUpdate':'update','afterDestroy':_0xa37c('0x4')};function emitEvent(_0x39811a){return function(_0x7510a1,_0x433fae,_0x2e25f1){ChatQueueEvents['emit'](_0x39811a+':'+_0x7510a1['id'],_0x7510a1);ChatQueueEvents[_0xa37c('0x5')](_0x39811a,_0x7510a1);_0x2e25f1(null);};}for(var e in events){if(events[_0xa37c('0x6')](e)){var event=events[e];ChatQueue[_0xa37c('0x7')](e,emitEvent(event));}}module[_0xa37c('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 7b70948..eba3432 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 _0x9e92=['chat_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./chatQueue.attributes','exports','ChatQueue'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x9e92,0x135));var _0x29e9=function(_0x157ca9,_0x2ff783){_0x157ca9=_0x157ca9-0x0;var _0x3be5fd=_0x9e92[_0x157ca9];return _0x3be5fd;};'use strict';var _=require(_0x29e9('0x0'));var util=require(_0x29e9('0x1'));var logger=require(_0x29e9('0x2'))(_0x29e9('0x3'));var moment=require(_0x29e9('0x4'));var BPromise=require('bluebird');var rp=require(_0x29e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x29e9('0x6'));var config=require('../../config/environment');var attributes=require(_0x29e9('0x7'));module[_0x29e9('0x8')]=function(_0x2ab55c,_0x37b7f6){return _0x2ab55c['define'](_0x29e9('0x9'),attributes,{'tableName':_0x29e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa063=['./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa063,0x14a));var _0x3a06=function(_0x4a1667,_0xa41e2d){_0x4a1667=_0x4a1667-0x0;var _0x332d8b=_0xa063[_0x4a1667];return _0x332d8b;};'use strict';var _=require(_0x3a06('0x0'));var util=require(_0x3a06('0x1'));var logger=require(_0x3a06('0x2'))(_0x3a06('0x3'));var moment=require('moment');var BPromise=require(_0x3a06('0x4'));var rp=require(_0x3a06('0x5'));var fs=require('fs');var path=require(_0x3a06('0x6'));var rimraf=require('rimraf');var config=require(_0x3a06('0x7'));var attributes=require(_0x3a06('0x8'));module[_0x3a06('0x9')]=function(_0xee4577,_0x27cbf9){return _0xee4577[_0x3a06('0xa')](_0x3a06('0xb'),attributes,{'tableName':_0x3a06('0xc'),'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 d2892f7..f75e76a 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 _0xe2cf=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','error','message','result','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','include','map','model','debug','stringify','catch','ShowChatQueue','find','util','bluebird','ioredis'];(function(_0x427787,_0xf1abc9){var _0x4f5f61=function(_0x6ff455){while(--_0x6ff455){_0x427787['push'](_0x427787['shift']());}};_0x4f5f61(++_0xf1abc9);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x5a4b42,_0x2b9c18){_0x5a4b42=_0x5a4b42-0x0;var _0x5e81d6=_0xe2cf[_0x5a4b42];return _0x5e81d6;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var moment=require('moment');var BPromise=require(_0xfe2c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe2c('0x2'));var db=require(_0xfe2c('0x3'))['db'];var utils=require(_0xfe2c('0x4'));var logger=require(_0xfe2c('0x5'))('rpc');var config=require(_0xfe2c('0x6'));var jayson=require(_0xfe2c('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xfe2c('0x8')]=_[_0xfe2c('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfe2c('0xa'))(new Redis(config[_0xfe2c('0x8')]));require(_0xfe2c('0xb'))['register'](socket);function respondWithRpcPromise(_0x5b616c,_0x396912,_0x15421e){return new BPromise(function(_0x495513,_0x22278c){return client[_0xfe2c('0xc')](_0x5b616c,_0x15421e)[_0xfe2c('0xd')](function(_0xa176e9){logger[_0xfe2c('0xe')](_0xfe2c('0xf'),_0x396912,_0xfe2c('0x10'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x396912,'request\x20sent',JSON['stringify'](_0xa176e9));if(_0xa176e9[_0xfe2c('0x11')]){if(_0xa176e9['error']['code']===0x1f4){logger[_0xfe2c('0x11')](_0xfe2c('0xf'),_0x396912,_0xa176e9[_0xfe2c('0x11')][_0xfe2c('0x12')]);return _0x22278c(_0xa176e9['error']['message']);}logger[_0xfe2c('0x11')](_0xfe2c('0xf'),_0x396912,_0xa176e9[_0xfe2c('0x11')][_0xfe2c('0x12')]);return _0x495513(_0xa176e9['error'][_0xfe2c('0x12')]);}else{logger[_0xfe2c('0xe')](_0xfe2c('0xf'),_0x396912,_0xfe2c('0x10'));_0x495513(_0xa176e9[_0xfe2c('0x13')][_0xfe2c('0x12')]);}})['catch'](function(_0x22481a){logger[_0xfe2c('0x11')](_0xfe2c('0xf'),_0x396912,_0x22481a);_0x22278c(_0x22481a);});});}exports[_0xfe2c('0x14')]=function(_0x55f751){var _0x1139fe=this;return new Promise(function(_0x59bdeb,_0x4e9137){return db[_0xfe2c('0x15')][_0xfe2c('0x16')]({'raw':_0x55f751['options']?_0x55f751[_0xfe2c('0x17')][_0xfe2c('0x18')]===undefined?!![]:![]:!![],'where':_0x55f751['options']?_0x55f751[_0xfe2c('0x17')]['where']||null:null,'attributes':_0x55f751[_0xfe2c('0x17')]?_0x55f751[_0xfe2c('0x17')][_0xfe2c('0x19')]||null:null,'limit':_0x55f751[_0xfe2c('0x17')]?_0x55f751[_0xfe2c('0x17')][_0xfe2c('0x1a')]||null:null,'include':_0x55f751['options']?_0x55f751[_0xfe2c('0x17')][_0xfe2c('0x1b')]?_[_0xfe2c('0x1c')](_0x55f751[_0xfe2c('0x17')][_0xfe2c('0x1b')],function(_0x10afde){return{'model':db[_0x10afde['model']],'as':_0x10afde['as'],'attributes':_0x10afde[_0xfe2c('0x19')],'include':_0x10afde['include']?_[_0xfe2c('0x1c')](_0x10afde[_0xfe2c('0x1b')],function(_0x1c35d3){return{'model':db[_0x1c35d3['model']],'as':_0x1c35d3['as'],'attributes':_0x1c35d3[_0xfe2c('0x19')],'include':_0x1c35d3[_0xfe2c('0x1b')]?_['map'](_0x1c35d3[_0xfe2c('0x1b')],function(_0x1b6eb7){return{'model':db[_0x1b6eb7[_0xfe2c('0x1d')]],'as':_0x1b6eb7['as'],'attributes':_0x1b6eb7[_0xfe2c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfe2c('0xd')](function(_0x1b7c91){logger['info']('GetChatQueue',_0x55f751);logger[_0xfe2c('0x1e')](_0xfe2c('0x14'),_0x55f751,JSON[_0xfe2c('0x1f')](_0x1b7c91));_0x59bdeb(_0x1b7c91);})[_0xfe2c('0x20')](function(_0xf4495b){logger['error'](_0xfe2c('0x14'),_0xf4495b[_0xfe2c('0x12')],_0x55f751);_0x4e9137(_0x1139fe[_0xfe2c('0x11')](0x1f4,_0xf4495b[_0xfe2c('0x12')]));});});};exports[_0xfe2c('0x21')]=function(_0xabc499){var _0x69d23a=this;return new Promise(function(_0x3f8696,_0x2e09fe){return db[_0xfe2c('0x15')][_0xfe2c('0x22')]({'raw':_0xabc499[_0xfe2c('0x17')]?_0xabc499['options'][_0xfe2c('0x18')]===undefined?!![]:![]:!![],'where':_0xabc499[_0xfe2c('0x17')]?_0xabc499[_0xfe2c('0x17')]['where']||null:null,'attributes':_0xabc499[_0xfe2c('0x17')]?_0xabc499[_0xfe2c('0x17')]['attributes']||null:null,'include':_0xabc499[_0xfe2c('0x17')]?_0xabc499[_0xfe2c('0x17')][_0xfe2c('0x1b')]?_['map'](_0xabc499[_0xfe2c('0x17')][_0xfe2c('0x1b')],function(_0x2df7fa){return{'model':db[_0x2df7fa[_0xfe2c('0x1d')]],'as':_0x2df7fa['as'],'attributes':_0x2df7fa[_0xfe2c('0x19')],'include':_0x2df7fa[_0xfe2c('0x1b')]?_[_0xfe2c('0x1c')](_0x2df7fa['include'],function(_0x48b8dc){return{'model':db[_0x48b8dc[_0xfe2c('0x1d')]],'as':_0x48b8dc['as'],'attributes':_0x48b8dc[_0xfe2c('0x19')],'include':_0x48b8dc[_0xfe2c('0x1b')]?_[_0xfe2c('0x1c')](_0x48b8dc['include'],function(_0x275c4f){return{'model':db[_0x275c4f['model']],'as':_0x275c4f['as'],'attributes':_0x275c4f[_0xfe2c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfe2c('0xd')](function(_0x5c849c){logger[_0xfe2c('0xe')]('ShowChatQueue',_0xabc499);logger['debug'](_0xfe2c('0x21'),_0xabc499,JSON[_0xfe2c('0x1f')](_0x5c849c));_0x3f8696(_0x5c849c);})[_0xfe2c('0x20')](function(_0x5e48bb){logger[_0xfe2c('0x11')](_0xfe2c('0x21'),_0x5e48bb[_0xfe2c('0x12')],_0xabc499);_0x2e09fe(_0x69d23a[_0xfe2c('0x11')](0x1f4,_0x5e48bb[_0xfe2c('0x12')]));});});}; \ No newline at end of file +var _0xc953=['find','raw','ShowChatQueue','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ChatQueue','findAll','options','where','limit','include','map','model','attributes','GetChatQueue'];(function(_0x2954e5,_0x4beb14){var _0x3c64d3=function(_0x1325fa){while(--_0x1325fa){_0x2954e5['push'](_0x2954e5['shift']());}};_0x3c64d3(++_0x4beb14);}(_0xc953,0x84));var _0x3c95=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0xc953[_0xd2d54];return _0x78b113;};'use strict';var _=require(_0x3c95('0x0'));var util=require(_0x3c95('0x1'));var moment=require(_0x3c95('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c95('0x3'));var db=require(_0x3c95('0x4'))['db'];var utils=require(_0x3c95('0x5'));var logger=require(_0x3c95('0x6'))(_0x3c95('0x7'));var config=require(_0x3c95('0x8'));var jayson=require(_0x3c95('0x9'));var client=jayson[_0x3c95('0xa')]['http']({'port':0x232a});config['redis']=_[_0x3c95('0xb')](config[_0x3c95('0xc')],{'host':_0x3c95('0xd'),'port':0x18eb});var socket=require(_0x3c95('0xe'))(new Redis(config[_0x3c95('0xc')]));require(_0x3c95('0xf'))[_0x3c95('0x10')](socket);function respondWithRpcPromise(_0x58b6ee,_0x161cc6,_0x3fb7ff){return new BPromise(function(_0xa37eee,_0x4261dd){return client[_0x3c95('0x11')](_0x58b6ee,_0x3fb7ff)[_0x3c95('0x12')](function(_0x40e230){logger['info'](_0x3c95('0x13'),_0x161cc6,'request\x20sent');logger[_0x3c95('0x14')](_0x3c95('0x15'),_0x161cc6,_0x3c95('0x16'),JSON[_0x3c95('0x17')](_0x40e230));if(_0x40e230['error']){if(_0x40e230[_0x3c95('0x18')][_0x3c95('0x19')]===0x1f4){logger[_0x3c95('0x18')](_0x3c95('0x13'),_0x161cc6,_0x40e230[_0x3c95('0x18')]['message']);return _0x4261dd(_0x40e230[_0x3c95('0x18')][_0x3c95('0x1a')]);}logger[_0x3c95('0x18')](_0x3c95('0x13'),_0x161cc6,_0x40e230['error'][_0x3c95('0x1a')]);return _0xa37eee(_0x40e230[_0x3c95('0x18')][_0x3c95('0x1a')]);}else{logger[_0x3c95('0x1b')]('ChatQueue,\x20%s,\x20%s',_0x161cc6,_0x3c95('0x16'));_0xa37eee(_0x40e230[_0x3c95('0x1c')][_0x3c95('0x1a')]);}})[_0x3c95('0x1d')](function(_0x29f0a2){logger['error']('ChatQueue,\x20%s,\x20%s',_0x161cc6,_0x29f0a2);_0x4261dd(_0x29f0a2);});});}exports['GetChatQueue']=function(_0x2a57d3){var _0xd8e550=this;return new Promise(function(_0x3faba6,_0x6766ae){return db[_0x3c95('0x1e')][_0x3c95('0x1f')]({'raw':_0x2a57d3['options']?_0x2a57d3['options']['raw']===undefined?!![]:![]:!![],'where':_0x2a57d3['options']?_0x2a57d3[_0x3c95('0x20')][_0x3c95('0x21')]||null:null,'attributes':_0x2a57d3['options']?_0x2a57d3[_0x3c95('0x20')]['attributes']||null:null,'limit':_0x2a57d3[_0x3c95('0x20')]?_0x2a57d3[_0x3c95('0x20')][_0x3c95('0x22')]||null:null,'include':_0x2a57d3[_0x3c95('0x20')]?_0x2a57d3[_0x3c95('0x20')][_0x3c95('0x23')]?_[_0x3c95('0x24')](_0x2a57d3['options'][_0x3c95('0x23')],function(_0x4c2395){return{'model':db[_0x4c2395[_0x3c95('0x25')]],'as':_0x4c2395['as'],'attributes':_0x4c2395['attributes'],'include':_0x4c2395[_0x3c95('0x23')]?_[_0x3c95('0x24')](_0x4c2395[_0x3c95('0x23')],function(_0x3965f8){return{'model':db[_0x3965f8[_0x3c95('0x25')]],'as':_0x3965f8['as'],'attributes':_0x3965f8[_0x3c95('0x26')],'include':_0x3965f8[_0x3c95('0x23')]?_['map'](_0x3965f8[_0x3c95('0x23')],function(_0x47ac6a){return{'model':db[_0x47ac6a[_0x3c95('0x25')]],'as':_0x47ac6a['as'],'attributes':_0x47ac6a['attributes']};}):[]};}):[]};}):[]:[]})[_0x3c95('0x12')](function(_0x4a2f84){logger['info'](_0x3c95('0x27'),_0x2a57d3);logger[_0x3c95('0x14')](_0x3c95('0x27'),_0x2a57d3,JSON[_0x3c95('0x17')](_0x4a2f84));_0x3faba6(_0x4a2f84);})[_0x3c95('0x1d')](function(_0x41a1db){logger[_0x3c95('0x18')](_0x3c95('0x27'),_0x41a1db[_0x3c95('0x1a')],_0x2a57d3);_0x6766ae(_0xd8e550[_0x3c95('0x18')](0x1f4,_0x41a1db[_0x3c95('0x1a')]));});});};exports['ShowChatQueue']=function(_0x582538){var _0x5c5ec7=this;return new Promise(function(_0x2f3e6f,_0x2e141e){return db[_0x3c95('0x1e')][_0x3c95('0x28')]({'raw':_0x582538[_0x3c95('0x20')]?_0x582538['options'][_0x3c95('0x29')]===undefined?!![]:![]:!![],'where':_0x582538[_0x3c95('0x20')]?_0x582538[_0x3c95('0x20')][_0x3c95('0x21')]||null:null,'attributes':_0x582538[_0x3c95('0x20')]?_0x582538[_0x3c95('0x20')]['attributes']||null:null,'include':_0x582538['options']?_0x582538[_0x3c95('0x20')][_0x3c95('0x23')]?_['map'](_0x582538[_0x3c95('0x20')][_0x3c95('0x23')],function(_0x36bdc4){return{'model':db[_0x36bdc4[_0x3c95('0x25')]],'as':_0x36bdc4['as'],'attributes':_0x36bdc4[_0x3c95('0x26')],'include':_0x36bdc4[_0x3c95('0x23')]?_[_0x3c95('0x24')](_0x36bdc4['include'],function(_0x4ebe1c){return{'model':db[_0x4ebe1c[_0x3c95('0x25')]],'as':_0x4ebe1c['as'],'attributes':_0x4ebe1c[_0x3c95('0x26')],'include':_0x4ebe1c[_0x3c95('0x23')]?_[_0x3c95('0x24')](_0x4ebe1c['include'],function(_0x463c40){return{'model':db[_0x463c40[_0x3c95('0x25')]],'as':_0x463c40['as'],'attributes':_0x463c40[_0x3c95('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x259381){logger[_0x3c95('0x1b')]('ShowChatQueue',_0x582538);logger[_0x3c95('0x14')](_0x3c95('0x2a'),_0x582538,JSON[_0x3c95('0x17')](_0x259381));_0x2f3e6f(_0x259381);})[_0x3c95('0x1d')](function(_0x360978){logger[_0x3c95('0x18')](_0x3c95('0x2a'),_0x360978[_0x3c95('0x1a')],_0x582538);_0x2e141e(_0x5c5ec7[_0x3c95('0x18')](0x1f4,_0x360978['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 712a5c3..a5a4f08 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 _0x55ca=['removeListener','register','./chatQueue.events','save'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x55ca,0x126));var _0xa55c=function(_0x30dfa4,_0x1a6275){_0x30dfa4=_0x30dfa4-0x0;var _0x185b37=_0x55ca[_0x30dfa4];return _0x185b37;};'use strict';var ChatQueueEvents=require(_0xa55c('0x0'));var events=[_0xa55c('0x1'),'remove','update'];function createListener(_0x49875a,_0x1c6ec3){return function(_0x267ea0){_0x1c6ec3['emit'](_0x49875a,_0x267ea0);};}function removeListener(_0x3b478a,_0x2db02a){return function(){ChatQueueEvents[_0xa55c('0x2')](_0x3b478a,_0x2db02a);};}exports[_0xa55c('0x3')]=function(_0x3c97c8){for(var _0x279caa=0x0,_0x36b623=events['length'];_0x279caa<_0x36b623;_0x279caa++){var _0x2121fd=events[_0x279caa];var _0x2537f0=createListener('chatQueue:'+_0x2121fd,_0x3c97c8);ChatQueueEvents['on'](_0x2121fd,_0x2537f0);}}; \ No newline at end of file +var _0x6f0d=['update','emit','removeListener','length','save','remove'];(function(_0x581543,_0x5d08cf){var _0x2845f5=function(_0x59aec4){while(--_0x59aec4){_0x581543['push'](_0x581543['shift']());}};_0x2845f5(++_0x5d08cf);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1e999e,_0x2d77aa){_0x1e999e=_0x1e999e-0x0;var _0x437552=_0x6f0d[_0x1e999e];return _0x437552;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xd6f0('0x0'),_0xd6f0('0x1'),_0xd6f0('0x2')];function createListener(_0x107a8c,_0x573473){return function(_0x275230){_0x573473[_0xd6f0('0x3')](_0x107a8c,_0x275230);};}function removeListener(_0x2f78fb,_0x25344b){return function(){ChatQueueEvents[_0xd6f0('0x4')](_0x2f78fb,_0x25344b);};}exports['register']=function(_0x2d2ce6){for(var _0x4a8b0c=0x0,_0xe21ac4=events[_0xd6f0('0x5')];_0x4a8b0c<_0xe21ac4;_0x4a8b0c++){var _0x8b89a9=events[_0x4a8b0c];var _0x1a48a0=createListener('chatQueue:'+_0x8b89a9,_0x2d2ce6);ChatQueueEvents['on'](_0x8b89a9,_0x1a48a0);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 2f26c46..75b7275 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x3db233,_0x28809e){var _0x59b35f=function(_0x5242aa){while(--_0x5242aa){_0x3db233['push'](_0x3db233['shift']());}};_0x59b35f(++_0x28809e);}(_0xe14b,0x93));var _0xbe14=function(_0xdc8ea0,_0x3d9cb1){_0xdc8ea0=_0xdc8ea0-0x0;var _0x2893de=_0xe14b[_0xdc8ea0];return _0x2893de;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x4de1c3,_0xbe77b9){var _0x26acfe=function(_0x2c9df4){while(--_0x2c9df4){_0x4de1c3['push'](_0x4de1c3['shift']());}};_0x26acfe(++_0xbe77b9);}(_0x814b,0x1a2));var _0xb814=function(_0x4d0df6,_0x4634f3){_0x4d0df6=_0x4d0df6-0x0;var _0x4e2615=_0x814b[_0x4d0df6];return _0x4e2615;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 883cd74..1f80f7c 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 _0xf458=['DATE','moment','sequelize','STRING'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xf458,0x85));var _0x8f45=function(_0x2aeb37,_0x34db7f){_0x2aeb37=_0x2aeb37-0x0;var _0x3067d5=_0xf458[_0x2aeb37];return _0x3067d5;};'use strict';var moment=require(_0x8f45('0x0'));var Sequelize=require(_0x8f45('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x8f45('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8f45('0x3')]},'leaveAt':{'type':Sequelize[_0x8f45('0x3')]},'acceptAt':{'type':Sequelize[_0x8f45('0x3')]},'exitAt':{'type':Sequelize[_0x8f45('0x3')]},'reason':{'type':Sequelize[_0x8f45('0x2')]}}; \ No newline at end of file +var _0xb2df=['DATE','sequelize','STRING'];(function(_0x1cba95,_0x48b77b){var _0xffad74=function(_0x3f40e8){while(--_0x3f40e8){_0x1cba95['push'](_0x1cba95['shift']());}};_0xffad74(++_0x48b77b);}(_0xb2df,0x8b));var _0xfb2d=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xb2df[_0x47aa64];return _0x549c7a;};'use strict';var moment=require('moment');var Sequelize=require(_0xfb2d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xfb2d('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xfb2d('0x1')]},'joinAt':{'type':Sequelize[_0xfb2d('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xfb2d('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xfb2d('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index e5ddfcc..00d70ae 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 _0x4cc7=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','stack','name','index','map','ChatQueueReport','rawAttributes','type','key','model'];(function(_0x5a97e7,_0x46ec49){var _0x1cea4e=function(_0x469e55){while(--_0x469e55){_0x5a97e7['push'](_0x5a97e7['shift']());}};_0x1cea4e(++_0x46ec49);}(_0x4cc7,0x1b6));var _0x74cc=function(_0x3ec510,_0x196121){_0x3ec510=_0x3ec510-0x0;var _0x30a8f7=_0x4cc7[_0x3ec510];return _0x30a8f7;};'use strict';var emlformat=require(_0x74cc('0x0'));var rimraf=require(_0x74cc('0x1'));var zipdir=require(_0x74cc('0x2'));var jsonpatch=require(_0x74cc('0x3'));var rp=require(_0x74cc('0x4'));var moment=require(_0x74cc('0x5'));var BPromise=require(_0x74cc('0x6'));var Mustache=require(_0x74cc('0x7'));var util=require('util');var path=require(_0x74cc('0x8'));var sox=require(_0x74cc('0x9'));var csv=require(_0x74cc('0xa'));var ejs=require(_0x74cc('0xb'));var fs=require('fs');var fs_extra=require(_0x74cc('0xc'));var _=require(_0x74cc('0xd'));var squel=require(_0x74cc('0xe'));var crypto=require(_0x74cc('0xf'));var jsforce=require(_0x74cc('0x10'));var deskjs=require(_0x74cc('0x11'));var toCsv=require(_0x74cc('0xa'));var querystring=require(_0x74cc('0x12'));var Papa=require(_0x74cc('0x13'));var Redis=require('ioredis');var authService=require(_0x74cc('0x14'));var qs=require(_0x74cc('0x15'));var as=require(_0x74cc('0x16'));var hardwareService=require(_0x74cc('0x17'));var logger=require(_0x74cc('0x18'))(_0x74cc('0x19'));var utils=require(_0x74cc('0x1a'));var config=require(_0x74cc('0x1b'));var licenseUtil=require(_0x74cc('0x1c'));var db=require(_0x74cc('0x1d'))['db'];function respondWithStatusCode(_0x34939c,_0x31c6bd){_0x31c6bd=_0x31c6bd||0xcc;return function(_0x5397a7){if(_0x5397a7){return _0x34939c[_0x74cc('0x1e')](_0x31c6bd);}return _0x34939c[_0x74cc('0x1f')](_0x31c6bd)[_0x74cc('0x20')]();};}function respondWithResult(_0x566061,_0x1a2814){_0x1a2814=_0x1a2814||0xc8;return function(_0x1a2b8b){if(_0x1a2b8b){return _0x566061[_0x74cc('0x1f')](_0x1a2814)[_0x74cc('0x21')](_0x1a2b8b);}};}function respondWithFilteredResult(_0x2c3c81,_0x336069){return function(_0x2f317c){if(_0x2f317c){var _0x47e76b=typeof _0x336069[_0x74cc('0x22')]==='undefined'&&typeof _0x336069['limit']===_0x74cc('0x23');var _0x388de9=_0x2f317c[_0x74cc('0x24')];var _0x1fb365=_0x47e76b?0x0:_0x336069[_0x74cc('0x22')];var _0x4efb24=_0x47e76b?_0x2f317c[_0x74cc('0x24')]:_0x336069[_0x74cc('0x22')]+_0x336069[_0x74cc('0x25')];var _0x15bf31;if(_0x4efb24>=_0x388de9){_0x4efb24=_0x388de9;_0x15bf31=0xc8;}else{_0x15bf31=0xce;}_0x2c3c81[_0x74cc('0x1f')](_0x15bf31);return _0x2c3c81[_0x74cc('0x26')](_0x74cc('0x27'),_0x1fb365+'-'+_0x4efb24+'/'+_0x388de9)[_0x74cc('0x21')](_0x2f317c);}return null;};}function patchUpdates(_0x477605){return function(_0x341bcb){try{jsonpatch['apply'](_0x341bcb,_0x477605,!![]);}catch(_0x44812d){return BPromise[_0x74cc('0x28')](_0x44812d);}return _0x341bcb[_0x74cc('0x29')]();};}function saveUpdates(_0x36a77a,_0x433583){return function(_0x18183c){if(_0x18183c){return _0x18183c[_0x74cc('0x2a')](_0x36a77a)[_0x74cc('0x2b')](function(_0x3d5f3c){return _0x3d5f3c;});}return null;};}function removeEntity(_0x49ccbe,_0x2dfdf4){return function(_0x3c327d){if(_0x3c327d){return _0x3c327d['destroy']()[_0x74cc('0x2b')](function(){_0x49ccbe[_0x74cc('0x1f')](0xcc)[_0x74cc('0x20')]();});}};}function handleEntityNotFound(_0x26aa57,_0x21b42b){return function(_0x4a14ad){if(!_0x4a14ad){_0x26aa57[_0x74cc('0x1e')](0x194);}return _0x4a14ad;};}function handleError(_0x2f49c9,_0x47c32f){_0x47c32f=_0x47c32f||0x1f4;return function(_0x1456d3){logger[_0x74cc('0x2c')](_0x1456d3[_0x74cc('0x2d')]);if(_0x1456d3[_0x74cc('0x2e')]){delete _0x1456d3[_0x74cc('0x2e')];}_0x2f49c9[_0x74cc('0x1f')](_0x47c32f)['send'](_0x1456d3);};}exports[_0x74cc('0x2f')]=function(_0x42a856,_0x5d013a){var _0x49b780={},_0x206c7a={},_0x3c41a6={'count':0x0,'rows':[]};var _0x349832=_[_0x74cc('0x30')](db[_0x74cc('0x31')][_0x74cc('0x32')],function(_0x28923e){return{'name':_0x28923e['fieldName'],'type':_0x28923e[_0x74cc('0x33')][_0x74cc('0x34')]};});_0x206c7a[_0x74cc('0x35')]=_['map'](_0x349832,_0x74cc('0x2e'));_0x206c7a[_0x74cc('0x36')]=_[_0x74cc('0x37')](_0x42a856[_0x74cc('0x36')]);_0x206c7a[_0x74cc('0x38')]=_[_0x74cc('0x39')](_0x206c7a[_0x74cc('0x35')],_0x206c7a[_0x74cc('0x36')]);_0x49b780[_0x74cc('0x3a')]=_[_0x74cc('0x39')](_0x206c7a[_0x74cc('0x35')],qs[_0x74cc('0x3b')](_0x42a856[_0x74cc('0x36')][_0x74cc('0x3b')]));_0x49b780[_0x74cc('0x3a')]=_0x49b780[_0x74cc('0x3a')][_0x74cc('0x3c')]?_0x49b780['attributes']:_0x206c7a['model'];if(!_0x42a856[_0x74cc('0x36')][_0x74cc('0x3d')](_0x74cc('0x3e'))){_0x49b780[_0x74cc('0x25')]=qs[_0x74cc('0x25')](_0x42a856[_0x74cc('0x36')][_0x74cc('0x25')]);_0x49b780[_0x74cc('0x22')]=qs[_0x74cc('0x22')](_0x42a856[_0x74cc('0x36')][_0x74cc('0x22')]);}_0x49b780[_0x74cc('0x3f')]=qs['sort'](_0x42a856['query'][_0x74cc('0x40')]);_0x49b780[_0x74cc('0x41')]=qs[_0x74cc('0x38')](_[_0x74cc('0x42')](_0x42a856[_0x74cc('0x36')],_0x206c7a[_0x74cc('0x38')]),_0x349832);if(_0x42a856[_0x74cc('0x36')][_0x74cc('0x43')]){_0x49b780[_0x74cc('0x41')]=_[_0x74cc('0x44')](_0x49b780[_0x74cc('0x41')],{'$or':_[_0x74cc('0x30')](_0x349832,function(_0x1312e4){if(_0x1312e4[_0x74cc('0x33')]!==_0x74cc('0x45')){var _0x4ca3f2={};_0x4ca3f2[_0x1312e4[_0x74cc('0x2e')]]={'$like':'%'+_0x42a856[_0x74cc('0x36')][_0x74cc('0x43')]+'%'};return _0x4ca3f2;}})});}_0x49b780=_[_0x74cc('0x44')]({},_0x49b780,_0x42a856['options']);var _0x398236={'where':_0x49b780[_0x74cc('0x41')]};return db[_0x74cc('0x31')][_0x74cc('0x24')](_0x398236)['then'](function(_0x57c1bd){_0x3c41a6[_0x74cc('0x24')]=_0x57c1bd;if(_0x42a856[_0x74cc('0x36')][_0x74cc('0x46')]){_0x49b780['include']=[{'all':!![]}];}return db[_0x74cc('0x31')]['findAll'](_0x49b780);})['then'](function(_0x5728f4){_0x3c41a6[_0x74cc('0x47')]=_0x5728f4;return _0x3c41a6;})[_0x74cc('0x2b')](respondWithFilteredResult(_0x5d013a,_0x49b780))[_0x74cc('0x48')](handleError(_0x5d013a,null));};exports[_0x74cc('0x49')]=function(_0x122e27,_0x4945f1){var _0x531116={'raw':!![],'where':{'id':_0x122e27[_0x74cc('0x4a')]['id']}},_0x124ca8={};_0x124ca8['model']=_[_0x74cc('0x37')](db[_0x74cc('0x31')]['rawAttributes']);_0x124ca8[_0x74cc('0x36')]=_['keys'](_0x122e27['query']);_0x124ca8['filters']=_['intersection'](_0x124ca8[_0x74cc('0x35')],_0x124ca8[_0x74cc('0x36')]);_0x531116['attributes']=_['intersection'](_0x124ca8['model'],qs[_0x74cc('0x3b')](_0x122e27['query']['fields']));_0x531116[_0x74cc('0x3a')]=_0x531116['attributes'][_0x74cc('0x3c')]?_0x531116[_0x74cc('0x3a')]:_0x124ca8[_0x74cc('0x35')];if(_0x122e27[_0x74cc('0x36')][_0x74cc('0x46')]){_0x531116[_0x74cc('0x4b')]=[{'all':!![]}];}_0x531116=_[_0x74cc('0x44')]({},_0x531116,_0x122e27[_0x74cc('0x4c')]);return db['ChatQueueReport']['find'](_0x531116)[_0x74cc('0x2b')](handleEntityNotFound(_0x4945f1,null))[_0x74cc('0x2b')](respondWithResult(_0x4945f1,null))['catch'](handleError(_0x4945f1,null));};exports[_0x74cc('0x4d')]=function(_0x39b010,_0x29b385){return db[_0x74cc('0x31')][_0x74cc('0x4d')](_0x39b010[_0x74cc('0x4e')],{})['then'](respondWithResult(_0x29b385,0xc9))['catch'](handleError(_0x29b385,null));};exports[_0x74cc('0x2a')]=function(_0x436cc8,_0x273f42){if(_0x436cc8['body']['id']){delete _0x436cc8['body']['id'];}return db[_0x74cc('0x31')][_0x74cc('0x4f')]({'where':{'id':_0x436cc8['params']['id']}})[_0x74cc('0x2b')](handleEntityNotFound(_0x273f42,null))[_0x74cc('0x2b')](saveUpdates(_0x436cc8[_0x74cc('0x4e')],null))[_0x74cc('0x2b')](respondWithResult(_0x273f42,null))['catch'](handleError(_0x273f42,null));};exports[_0x74cc('0x50')]=function(_0x5a166e,_0x4dab41){return db['ChatQueueReport']['find']({'where':{'id':_0x5a166e[_0x74cc('0x4a')]['id']}})[_0x74cc('0x2b')](handleEntityNotFound(_0x4dab41,null))[_0x74cc('0x2b')](removeEntity(_0x4dab41,null))[_0x74cc('0x48')](handleError(_0x4dab41,null));};exports[_0x74cc('0x51')]=function(_0x470699,_0x1faf89){return db[_0x74cc('0x31')]['describe']()[_0x74cc('0x2b')](respondWithResult(_0x1faf89,null))[_0x74cc('0x48')](handleError(_0x1faf89,null));}; \ No newline at end of file +var _0xee87=['limit','count','Content-Range','apply','reject','save','update','then','destroy','name','send','ChatQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x22de70,_0x2f9621){var _0x55cb26=function(_0x426e73){while(--_0x426e73){_0x22de70['push'](_0x22de70['shift']());}};_0x55cb26(++_0x2f9621);}(_0xee87,0x10d));var _0x7ee8=function(_0x996e5a,_0x1ca22d){_0x996e5a=_0x996e5a-0x0;var _0x3247f1=_0xee87[_0x996e5a];return _0x3247f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ee8('0x0'));var zipdir=require(_0x7ee8('0x1'));var jsonpatch=require(_0x7ee8('0x2'));var rp=require(_0x7ee8('0x3'));var moment=require(_0x7ee8('0x4'));var BPromise=require(_0x7ee8('0x5'));var Mustache=require(_0x7ee8('0x6'));var util=require(_0x7ee8('0x7'));var path=require(_0x7ee8('0x8'));var sox=require(_0x7ee8('0x9'));var csv=require('to-csv');var ejs=require(_0x7ee8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ee8('0xb'));var squel=require(_0x7ee8('0xc'));var crypto=require(_0x7ee8('0xd'));var jsforce=require(_0x7ee8('0xe'));var deskjs=require(_0x7ee8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7ee8('0x10'));var Redis=require('ioredis');var authService=require(_0x7ee8('0x11'));var qs=require(_0x7ee8('0x12'));var as=require(_0x7ee8('0x13'));var hardwareService=require(_0x7ee8('0x14'));var logger=require(_0x7ee8('0x15'))(_0x7ee8('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7ee8('0x17'));var db=require(_0x7ee8('0x18'))['db'];function respondWithStatusCode(_0x39a4cd,_0x36e82a){_0x36e82a=_0x36e82a||0xcc;return function(_0xb4a1bc){if(_0xb4a1bc){return _0x39a4cd[_0x7ee8('0x19')](_0x36e82a);}return _0x39a4cd[_0x7ee8('0x1a')](_0x36e82a)[_0x7ee8('0x1b')]();};}function respondWithResult(_0x2a5fa3,_0x46b127){_0x46b127=_0x46b127||0xc8;return function(_0x1669d7){if(_0x1669d7){return _0x2a5fa3[_0x7ee8('0x1a')](_0x46b127)[_0x7ee8('0x1c')](_0x1669d7);}};}function respondWithFilteredResult(_0x12e853,_0x268b93){return function(_0x43f34c){if(_0x43f34c){var _0x192d8c=typeof _0x268b93[_0x7ee8('0x1d')]===_0x7ee8('0x1e')&&typeof _0x268b93[_0x7ee8('0x1f')]===_0x7ee8('0x1e');var _0x124442=_0x43f34c[_0x7ee8('0x20')];var _0x4028a7=_0x192d8c?0x0:_0x268b93[_0x7ee8('0x1d')];var _0x5c1969=_0x192d8c?_0x43f34c[_0x7ee8('0x20')]:_0x268b93['offset']+_0x268b93[_0x7ee8('0x1f')];var _0x459ad1;if(_0x5c1969>=_0x124442){_0x5c1969=_0x124442;_0x459ad1=0xc8;}else{_0x459ad1=0xce;}_0x12e853['status'](_0x459ad1);return _0x12e853['set'](_0x7ee8('0x21'),_0x4028a7+'-'+_0x5c1969+'/'+_0x124442)[_0x7ee8('0x1c')](_0x43f34c);}return null;};}function patchUpdates(_0x298430){return function(_0x15c00f){try{jsonpatch[_0x7ee8('0x22')](_0x15c00f,_0x298430,!![]);}catch(_0x49f7e0){return BPromise[_0x7ee8('0x23')](_0x49f7e0);}return _0x15c00f[_0x7ee8('0x24')]();};}function saveUpdates(_0x334b46,_0x555338){return function(_0x27bff9){if(_0x27bff9){return _0x27bff9[_0x7ee8('0x25')](_0x334b46)[_0x7ee8('0x26')](function(_0x1bcdd9){return _0x1bcdd9;});}return null;};}function removeEntity(_0x57dfaa,_0x40d420){return function(_0x273bbe){if(_0x273bbe){return _0x273bbe[_0x7ee8('0x27')]()['then'](function(){_0x57dfaa[_0x7ee8('0x1a')](0xcc)[_0x7ee8('0x1b')]();});}};}function handleEntityNotFound(_0x3118fe,_0x5ae459){return function(_0x3f9cae){if(!_0x3f9cae){_0x3118fe[_0x7ee8('0x19')](0x194);}return _0x3f9cae;};}function handleError(_0x568ea,_0x52ff5d){_0x52ff5d=_0x52ff5d||0x1f4;return function(_0x27c94c){logger['error'](_0x27c94c['stack']);if(_0x27c94c[_0x7ee8('0x28')]){delete _0x27c94c[_0x7ee8('0x28')];}_0x568ea['status'](_0x52ff5d)[_0x7ee8('0x29')](_0x27c94c);};}exports['index']=function(_0x2e31ed,_0x5e81d7){var _0x76beaa={},_0x547147={},_0xf54bb1={'count':0x0,'rows':[]};var _0x33f20e=_['map'](db[_0x7ee8('0x2a')][_0x7ee8('0x2b')],function(_0x2d8809){return{'name':_0x2d8809[_0x7ee8('0x2c')],'type':_0x2d8809[_0x7ee8('0x2d')][_0x7ee8('0x2e')]};});_0x547147[_0x7ee8('0x2f')]=_['map'](_0x33f20e,_0x7ee8('0x28'));_0x547147['query']=_[_0x7ee8('0x30')](_0x2e31ed[_0x7ee8('0x31')]);_0x547147[_0x7ee8('0x32')]=_[_0x7ee8('0x33')](_0x547147['model'],_0x547147[_0x7ee8('0x31')]);_0x76beaa[_0x7ee8('0x34')]=_['intersection'](_0x547147[_0x7ee8('0x2f')],qs[_0x7ee8('0x35')](_0x2e31ed[_0x7ee8('0x31')][_0x7ee8('0x35')]));_0x76beaa[_0x7ee8('0x34')]=_0x76beaa['attributes'][_0x7ee8('0x36')]?_0x76beaa[_0x7ee8('0x34')]:_0x547147[_0x7ee8('0x2f')];if(!_0x2e31ed['query'][_0x7ee8('0x37')]('nolimit')){_0x76beaa[_0x7ee8('0x1f')]=qs[_0x7ee8('0x1f')](_0x2e31ed['query'][_0x7ee8('0x1f')]);_0x76beaa[_0x7ee8('0x1d')]=qs[_0x7ee8('0x1d')](_0x2e31ed['query'][_0x7ee8('0x1d')]);}_0x76beaa['order']=qs[_0x7ee8('0x38')](_0x2e31ed[_0x7ee8('0x31')][_0x7ee8('0x38')]);_0x76beaa[_0x7ee8('0x39')]=qs[_0x7ee8('0x32')](_[_0x7ee8('0x3a')](_0x2e31ed[_0x7ee8('0x31')],_0x547147[_0x7ee8('0x32')]),_0x33f20e);if(_0x2e31ed[_0x7ee8('0x31')][_0x7ee8('0x3b')]){_0x76beaa[_0x7ee8('0x39')]=_[_0x7ee8('0x3c')](_0x76beaa[_0x7ee8('0x39')],{'$or':_[_0x7ee8('0x3d')](_0x33f20e,function(_0x52c56b){if(_0x52c56b['type']!==_0x7ee8('0x3e')){var _0x4d095f={};_0x4d095f[_0x52c56b[_0x7ee8('0x28')]]={'$like':'%'+_0x2e31ed[_0x7ee8('0x31')][_0x7ee8('0x3b')]+'%'};return _0x4d095f;}})});}_0x76beaa=_[_0x7ee8('0x3c')]({},_0x76beaa,_0x2e31ed[_0x7ee8('0x3f')]);var _0x1c996b={'where':_0x76beaa[_0x7ee8('0x39')]};return db[_0x7ee8('0x2a')][_0x7ee8('0x20')](_0x1c996b)[_0x7ee8('0x26')](function(_0x2017e6){_0xf54bb1[_0x7ee8('0x20')]=_0x2017e6;if(_0x2e31ed[_0x7ee8('0x31')][_0x7ee8('0x40')]){_0x76beaa[_0x7ee8('0x41')]=[{'all':!![]}];}return db[_0x7ee8('0x2a')][_0x7ee8('0x42')](_0x76beaa);})[_0x7ee8('0x26')](function(_0x1074ef){_0xf54bb1[_0x7ee8('0x43')]=_0x1074ef;return _0xf54bb1;})['then'](respondWithFilteredResult(_0x5e81d7,_0x76beaa))[_0x7ee8('0x44')](handleError(_0x5e81d7,null));};exports[_0x7ee8('0x45')]=function(_0x58a461,_0x16bd01){var _0x29e866={'raw':!![],'where':{'id':_0x58a461[_0x7ee8('0x46')]['id']}},_0x509838={};_0x509838[_0x7ee8('0x2f')]=_['keys'](db[_0x7ee8('0x2a')]['rawAttributes']);_0x509838['query']=_['keys'](_0x58a461['query']);_0x509838[_0x7ee8('0x32')]=_[_0x7ee8('0x33')](_0x509838['model'],_0x509838[_0x7ee8('0x31')]);_0x29e866[_0x7ee8('0x34')]=_[_0x7ee8('0x33')](_0x509838[_0x7ee8('0x2f')],qs[_0x7ee8('0x35')](_0x58a461[_0x7ee8('0x31')][_0x7ee8('0x35')]));_0x29e866[_0x7ee8('0x34')]=_0x29e866['attributes'][_0x7ee8('0x36')]?_0x29e866[_0x7ee8('0x34')]:_0x509838['model'];if(_0x58a461[_0x7ee8('0x31')]['includeAll']){_0x29e866['include']=[{'all':!![]}];}_0x29e866=_[_0x7ee8('0x3c')]({},_0x29e866,_0x58a461['options']);return db[_0x7ee8('0x2a')][_0x7ee8('0x47')](_0x29e866)[_0x7ee8('0x26')](handleEntityNotFound(_0x16bd01,null))['then'](respondWithResult(_0x16bd01,null))[_0x7ee8('0x44')](handleError(_0x16bd01,null));};exports['create']=function(_0xf0d68e,_0x45c08b){return db['ChatQueueReport'][_0x7ee8('0x48')](_0xf0d68e[_0x7ee8('0x49')],{})[_0x7ee8('0x26')](respondWithResult(_0x45c08b,0xc9))[_0x7ee8('0x44')](handleError(_0x45c08b,null));};exports['update']=function(_0x4f36d0,_0x46e007){if(_0x4f36d0[_0x7ee8('0x49')]['id']){delete _0x4f36d0['body']['id'];}return db[_0x7ee8('0x2a')]['find']({'where':{'id':_0x4f36d0['params']['id']}})[_0x7ee8('0x26')](handleEntityNotFound(_0x46e007,null))[_0x7ee8('0x26')](saveUpdates(_0x4f36d0[_0x7ee8('0x49')],null))[_0x7ee8('0x26')](respondWithResult(_0x46e007,null))[_0x7ee8('0x44')](handleError(_0x46e007,null));};exports[_0x7ee8('0x27')]=function(_0x34d306,_0x2e228b){return db[_0x7ee8('0x2a')][_0x7ee8('0x47')]({'where':{'id':_0x34d306['params']['id']}})[_0x7ee8('0x26')](handleEntityNotFound(_0x2e228b,null))[_0x7ee8('0x26')](removeEntity(_0x2e228b,null))['catch'](handleError(_0x2e228b,null));};exports[_0x7ee8('0x4a')]=function(_0x2d6bde,_0x5d2e84){return db[_0x7ee8('0x2a')][_0x7ee8('0x4a')]()['then'](respondWithResult(_0x5d2e84,null))['catch'](handleError(_0x5d2e84,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index a110214..ec10adf 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x4fa489,_0x4cba6b){var _0x41d2ce=function(_0x364060){while(--_0x364060){_0x4fa489['push'](_0x4fa489['shift']());}};_0x41d2ce(++_0x4cba6b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index fef6914..ceed081 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 _0x76fa=['create','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','ChatQueueReport','update','where','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x1fb460,_0x360c21){var _0x534b23=function(_0x1d12a3){while(--_0x1d12a3){_0x1fb460['push'](_0x1fb460['shift']());}};_0x534b23(++_0x360c21);}(_0x76fa,0x175));var _0xa76f=function(_0xb6c1ed,_0x308fda){_0xb6c1ed=_0xb6c1ed-0x0;var _0x4b0314=_0x76fa[_0xb6c1ed];return _0x4b0314;};'use strict';var _=require(_0xa76f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa76f('0x1'));var rs=require(_0xa76f('0x2'));var fs=require('fs');var Redis=require(_0xa76f('0x3'));var db=require(_0xa76f('0x4'))['db'];var utils=require(_0xa76f('0x5'));var logger=require(_0xa76f('0x6'))(_0xa76f('0x7'));var config=require(_0xa76f('0x8'));var jayson=require(_0xa76f('0x9'));var client=jayson['client'][_0xa76f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x493f2e,_0x3d6139,_0x42b085){return new BPromise(function(_0x393dab,_0x8e8fae){return client[_0xa76f('0xb')](_0x493f2e,_0x42b085)[_0xa76f('0xc')](function(_0x35c3f8){logger[_0xa76f('0xd')](_0xa76f('0xe'),_0x3d6139,_0xa76f('0xf'));logger[_0xa76f('0x10')](_0xa76f('0x11'),_0x3d6139,_0xa76f('0xf'),JSON[_0xa76f('0x12')](_0x35c3f8));if(_0x35c3f8[_0xa76f('0x13')]){if(_0x35c3f8[_0xa76f('0x13')][_0xa76f('0x14')]===0x1f4){logger[_0xa76f('0x13')](_0xa76f('0xe'),_0x3d6139,_0x35c3f8[_0xa76f('0x13')][_0xa76f('0x15')]);return _0x8e8fae(_0x35c3f8[_0xa76f('0x13')][_0xa76f('0x15')]);}logger[_0xa76f('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x3d6139,_0x35c3f8[_0xa76f('0x13')][_0xa76f('0x15')]);return _0x393dab(_0x35c3f8['error'][_0xa76f('0x15')]);}else{logger[_0xa76f('0xd')](_0xa76f('0xe'),_0x3d6139,_0xa76f('0xf'));_0x393dab(_0x35c3f8['result'][_0xa76f('0x15')]);}})[_0xa76f('0x16')](function(_0x2f632a){logger[_0xa76f('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x3d6139,_0x2f632a);_0x8e8fae(_0x2f632a);});});}exports['CreateChatQueueReport']=function(_0x33d8b6){var _0x1427d0=this;return new Promise(function(_0x3da30d,_0x53dc85){return db['ChatQueueReport'][_0xa76f('0x17')](_0x33d8b6[_0xa76f('0x18')],{'raw':_0x33d8b6['options']?_0x33d8b6[_0xa76f('0x19')][_0xa76f('0x1a')]===undefined?!![]:![]:!![]})[_0xa76f('0xc')](function(_0x5eb161){logger['info'](_0xa76f('0x1b'),_0x33d8b6);logger[_0xa76f('0x10')](_0xa76f('0x1b'),_0x33d8b6,JSON[_0xa76f('0x12')](_0x5eb161));_0x3da30d(_0x5eb161);})[_0xa76f('0x16')](function(_0x1d91d5){logger[_0xa76f('0x13')](_0xa76f('0x1b'),_0x1d91d5[_0xa76f('0x15')],_0x33d8b6);_0x53dc85(_0x1427d0[_0xa76f('0x13')](0x1f4,_0x1d91d5['message']));});});};exports[_0xa76f('0x1c')]=function(_0x45e112){var _0x5d7c18=this;return new Promise(function(_0x259a88,_0x271926){return db[_0xa76f('0x1d')][_0xa76f('0x1e')](_0x45e112[_0xa76f('0x18')],{'raw':_0x45e112[_0xa76f('0x19')]?_0x45e112[_0xa76f('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45e112['options']?_0x45e112[_0xa76f('0x19')][_0xa76f('0x1f')]||null:null,'attributes':_0x45e112[_0xa76f('0x19')]?_0x45e112[_0xa76f('0x19')]['attributes']||null:null,'limit':_0x45e112[_0xa76f('0x19')]?_0x45e112['options'][_0xa76f('0x20')]||null:null})[_0xa76f('0xc')](function(_0x191200){logger[_0xa76f('0xd')]('UpdateChatQueueReport',_0x45e112);logger[_0xa76f('0x10')]('UpdateChatQueueReport',_0x45e112,JSON[_0xa76f('0x12')](_0x191200));_0x259a88(_0x191200);})[_0xa76f('0x16')](function(_0x4d810e){logger['error'](_0xa76f('0x1c'),_0x4d810e['message'],_0x45e112);_0x271926(_0x5d7c18['error'](0x1f4,_0x4d810e['message']));});});}; \ No newline at end of file +var _0x6a11=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','options','raw','update','body','UpdateChatQueueReport','lodash','moment'];(function(_0x9b4b12,_0x5b26b8){var _0x1d8fdc=function(_0xfc7c53){while(--_0xfc7c53){_0x9b4b12['push'](_0x9b4b12['shift']());}};_0x1d8fdc(++_0x5b26b8);}(_0x6a11,0x172));var _0x16a1=function(_0x2fc573,_0x2a9098){_0x2fc573=_0x2fc573-0x0;var _0xef20ab=_0x6a11[_0x2fc573];return _0xef20ab;};'use strict';var _=require(_0x16a1('0x0'));var util=require('util');var moment=require(_0x16a1('0x1'));var BPromise=require(_0x16a1('0x2'));var rs=require(_0x16a1('0x3'));var fs=require('fs');var Redis=require(_0x16a1('0x4'));var db=require(_0x16a1('0x5'))['db'];var utils=require(_0x16a1('0x6'));var logger=require(_0x16a1('0x7'))(_0x16a1('0x8'));var config=require(_0x16a1('0x9'));var jayson=require(_0x16a1('0xa'));var client=jayson[_0x16a1('0xb')][_0x16a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51a4dd,_0x557c45,_0x318c05){return new BPromise(function(_0x18a933,_0x2a7f24){return client['request'](_0x51a4dd,_0x318c05)[_0x16a1('0xd')](function(_0x52b143){logger[_0x16a1('0xe')](_0x16a1('0xf'),_0x557c45,_0x16a1('0x10'));logger[_0x16a1('0x11')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x557c45,'request\x20sent',JSON[_0x16a1('0x12')](_0x52b143));if(_0x52b143[_0x16a1('0x13')]){if(_0x52b143[_0x16a1('0x13')][_0x16a1('0x14')]===0x1f4){logger[_0x16a1('0x13')](_0x16a1('0xf'),_0x557c45,_0x52b143['error'][_0x16a1('0x15')]);return _0x2a7f24(_0x52b143[_0x16a1('0x13')]['message']);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x557c45,_0x52b143[_0x16a1('0x13')]['message']);return _0x18a933(_0x52b143[_0x16a1('0x13')][_0x16a1('0x15')]);}else{logger[_0x16a1('0xe')](_0x16a1('0xf'),_0x557c45,'request\x20sent');_0x18a933(_0x52b143[_0x16a1('0x16')]['message']);}})['catch'](function(_0x5299ac){logger[_0x16a1('0x13')](_0x16a1('0xf'),_0x557c45,_0x5299ac);_0x2a7f24(_0x5299ac);});});}exports[_0x16a1('0x17')]=function(_0x2b69b0){var _0x2d4c57=this;return new Promise(function(_0xe1b82d,_0x3fb608){return db[_0x16a1('0x18')][_0x16a1('0x19')](_0x2b69b0['body'],{'raw':_0x2b69b0[_0x16a1('0x1a')]?_0x2b69b0[_0x16a1('0x1a')][_0x16a1('0x1b')]===undefined?!![]:![]:!![]})[_0x16a1('0xd')](function(_0x243790){logger[_0x16a1('0xe')]('CreateChatQueueReport',_0x2b69b0);logger['debug']('CreateChatQueueReport',_0x2b69b0,JSON[_0x16a1('0x12')](_0x243790));_0xe1b82d(_0x243790);})['catch'](function(_0x3463b9){logger['error']('CreateChatQueueReport',_0x3463b9[_0x16a1('0x15')],_0x2b69b0);_0x3fb608(_0x2d4c57['error'](0x1f4,_0x3463b9[_0x16a1('0x15')]));});});};exports['UpdateChatQueueReport']=function(_0x1ead5e){var _0x48d63d=this;return new Promise(function(_0x5ba4a3,_0x55acea){return db['ChatQueueReport'][_0x16a1('0x1c')](_0x1ead5e[_0x16a1('0x1d')],{'raw':_0x1ead5e[_0x16a1('0x1a')]?_0x1ead5e['options'][_0x16a1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ead5e['options']?_0x1ead5e['options']['where']||null:null,'attributes':_0x1ead5e['options']?_0x1ead5e[_0x16a1('0x1a')]['attributes']||null:null,'limit':_0x1ead5e[_0x16a1('0x1a')]?_0x1ead5e[_0x16a1('0x1a')]['limit']||null:null})[_0x16a1('0xd')](function(_0xbb6647){logger[_0x16a1('0xe')](_0x16a1('0x1e'),_0x1ead5e);logger[_0x16a1('0x11')](_0x16a1('0x1e'),_0x1ead5e,JSON[_0x16a1('0x12')](_0xbb6647));_0x5ba4a3(_0xbb6647);})['catch'](function(_0x5424f1){logger[_0x16a1('0x13')](_0x16a1('0x1e'),_0x5424f1[_0x16a1('0x15')],_0x1ead5e);_0x55acea(_0x48d63d[_0x16a1('0x13')](0x1f4,_0x5424f1[_0x16a1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 77182d0..5b83785 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 _0x546f=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x45dac2,_0x1c10b6){var _0x540bb5=function(_0x203bf2){while(--_0x203bf2){_0x45dac2['push'](_0x45dac2['shift']());}};_0x540bb5(++_0x1c10b6);}(_0x546f,0x6b));var _0xf546=function(_0x294d96,_0x2a7812){_0x294d96=_0x294d96-0x0;var _0x5ceb37=_0x546f[_0x294d96];return _0x5ceb37;};'use strict';var multer=require(_0xf546('0x0'));var util=require(_0xf546('0x1'));var path=require(_0xf546('0x2'));var timeout=require(_0xf546('0x3'));var express=require(_0xf546('0x4'));var router=express[_0xf546('0x5')]();var fs_extra=require(_0xf546('0x6'));var auth=require(_0xf546('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf546('0x8'));var controller=require('./chatQueueReport.controller');router[_0xf546('0x9')]('/',auth['isAuthenticated'](),controller[_0xf546('0xa')]);router[_0xf546('0x9')](_0xf546('0xb'),auth[_0xf546('0xc')](),controller[_0xf546('0xd')]);router[_0xf546('0x9')](_0xf546('0xe'),auth[_0xf546('0xc')](),controller[_0xf546('0xf')]);router[_0xf546('0x10')]('/',auth[_0xf546('0xc')](),controller[_0xf546('0x11')]);router[_0xf546('0x12')](_0xf546('0xe'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xf546('0xc')](),controller[_0xf546('0x13')]);module[_0xf546('0x14')]=router; \ No newline at end of file +var _0xfb91=['../../config/environment','./chatQueueReport.controller','index','get','isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x198c46,_0x495122){var _0x23f871=function(_0xd9e505){while(--_0xd9e505){_0x198c46['push'](_0x198c46['shift']());}};_0x23f871(++_0x495122);}(_0xfb91,0x7f));var _0x1fb9=function(_0xeaf66a,_0x39389a){_0xeaf66a=_0xeaf66a-0x0;var _0x308f8d=_0xfb91[_0xeaf66a];return _0x308f8d;};'use strict';var multer=require(_0x1fb9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1fb9('0x1'));var express=require('express');var router=express[_0x1fb9('0x2')]();var fs_extra=require(_0x1fb9('0x3'));var auth=require(_0x1fb9('0x4'));var interaction=require(_0x1fb9('0x5'));var config=require(_0x1fb9('0x6'));var controller=require(_0x1fb9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1fb9('0x8')]);router[_0x1fb9('0x9')]('/describe',auth[_0x1fb9('0xa')](),controller[_0x1fb9('0xb')]);router['get'](_0x1fb9('0xc'),auth['isAuthenticated'](),controller[_0x1fb9('0xd')]);router[_0x1fb9('0xe')]('/',auth[_0x1fb9('0xa')](),controller[_0x1fb9('0xf')]);router['put'](_0x1fb9('0xc'),auth[_0x1fb9('0xa')](),controller['update']);router[_0x1fb9('0x10')](_0x1fb9('0xc'),auth[_0x1fb9('0xa')](),controller[_0x1fb9('0x11')]);module[_0x1fb9('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index e0eb00a..ddbaffa 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x13e6e1,_0x22c6f9){var _0xab9bd6=function(_0x52475e){while(--_0x52475e){_0x13e6e1['push'](_0x13e6e1['shift']());}};_0xab9bd6(++_0x22c6f9);}(_0x008c,0x188));var _0xc008=function(_0x478829,_0x4ef2bb){_0x478829=_0x478829-0x0;var _0x59a14a=_0x008c[_0x478829];return _0x59a14a;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x22e3ea,_0x57d13c){var _0x58a537=function(_0xedf300){while(--_0xedf300){_0x22e3ea['push'](_0x22e3ea['shift']());}};_0x58a537(++_0x57d13c);}(_0x34e8,0x12c));var _0x834e=function(_0x1344a0,_0x20ba3d){_0x1344a0=_0x1344a0-0x0;var _0x1c01c4=_0x34e8[_0x1344a0];return _0x1c01c4;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index b02af15..a080ce8 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 _0xa566=['sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x33715a,_0x324764){var _0x3913f9=function(_0x502012){while(--_0x502012){_0x33715a['push'](_0x33715a['shift']());}};_0x3913f9(++_0x324764);}(_0xa566,0x1d7));var _0x6a56=function(_0x3d29ab,_0x4742b2){_0x3d29ab=_0x3d29ab-0x0;var _0x305ef8=_0xa566[_0x3d29ab];return _0x305ef8;};'use strict';var emlformat=require(_0x6a56('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a56('0x1'));var jsonpatch=require(_0x6a56('0x2'));var rp=require('request-promise');var moment=require(_0x6a56('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6a56('0x4'));var sox=require(_0x6a56('0x5'));var csv=require(_0x6a56('0x6'));var ejs=require(_0x6a56('0x7'));var fs=require('fs');var fs_extra=require(_0x6a56('0x8'));var _=require('lodash');var squel=require(_0x6a56('0x9'));var crypto=require(_0x6a56('0xa'));var jsforce=require(_0x6a56('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6a56('0x6'));var querystring=require(_0x6a56('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a56('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x6a56('0xe'));var hardwareService=require(_0x6a56('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x6a56('0x10'));var config=require(_0x6a56('0x11'));var licenseUtil=require(_0x6a56('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55b899,_0x52986f){_0x52986f=_0x52986f||0xcc;return function(_0x249c45){if(_0x249c45){return _0x55b899[_0x6a56('0x13')](_0x52986f);}return _0x55b899[_0x6a56('0x14')](_0x52986f)[_0x6a56('0x15')]();};}function respondWithResult(_0x49dddb,_0x1607ef){_0x1607ef=_0x1607ef||0xc8;return function(_0x2f6496){if(_0x2f6496){return _0x49dddb[_0x6a56('0x14')](_0x1607ef)[_0x6a56('0x16')](_0x2f6496);}};}function respondWithFilteredResult(_0x71fd2d,_0x4d0fb7){return function(_0x412ebf){if(_0x412ebf){var _0x58607e=typeof _0x4d0fb7[_0x6a56('0x17')]==='undefined'&&typeof _0x4d0fb7[_0x6a56('0x18')]===_0x6a56('0x19');var _0x285bbb=_0x412ebf[_0x6a56('0x1a')];var _0x47dcdf=_0x58607e?0x0:_0x4d0fb7[_0x6a56('0x17')];var _0x2d0e3d=_0x58607e?_0x412ebf[_0x6a56('0x1a')]:_0x4d0fb7['offset']+_0x4d0fb7[_0x6a56('0x18')];var _0x340c70;if(_0x2d0e3d>=_0x285bbb){_0x2d0e3d=_0x285bbb;_0x340c70=0xc8;}else{_0x340c70=0xce;}_0x71fd2d[_0x6a56('0x14')](_0x340c70);return _0x71fd2d[_0x6a56('0x1b')](_0x6a56('0x1c'),_0x47dcdf+'-'+_0x2d0e3d+'/'+_0x285bbb)[_0x6a56('0x16')](_0x412ebf);}return null;};}function patchUpdates(_0x13f740){return function(_0x4908cc){try{jsonpatch[_0x6a56('0x1d')](_0x4908cc,_0x13f740,!![]);}catch(_0x55bdbe){return BPromise['reject'](_0x55bdbe);}return _0x4908cc[_0x6a56('0x1e')]();};}function saveUpdates(_0x241858,_0x41b272){return function(_0x518366){if(_0x518366){return _0x518366[_0x6a56('0x1f')](_0x241858)[_0x6a56('0x20')](function(_0x3ec3b8){return _0x3ec3b8;});}return null;};}function removeEntity(_0x4f82a6,_0xe3b58a){return function(_0x3aa64a){if(_0x3aa64a){return _0x3aa64a[_0x6a56('0x21')]()['then'](function(){_0x4f82a6[_0x6a56('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10d9d3,_0x494ddd){return function(_0x38ccee){if(!_0x38ccee){_0x10d9d3['sendStatus'](0x194);}return _0x38ccee;};}function handleError(_0x4c8e80,_0x321e46){_0x321e46=_0x321e46||0x1f4;return function(_0x2811b3){logger[_0x6a56('0x22')](_0x2811b3[_0x6a56('0x23')]);if(_0x2811b3[_0x6a56('0x24')]){delete _0x2811b3[_0x6a56('0x24')];}_0x4c8e80['status'](_0x321e46)['send'](_0x2811b3);};}exports[_0x6a56('0x25')]=function(_0x967e8a,_0x12cda5){var _0x5768db={},_0x2e7c03={},_0x3ffd20={'count':0x0,'rows':[]};var _0x4a85d0=_[_0x6a56('0x26')](db[_0x6a56('0x27')][_0x6a56('0x28')],function(_0x436223){return{'name':_0x436223[_0x6a56('0x29')],'type':_0x436223[_0x6a56('0x2a')][_0x6a56('0x2b')]};});_0x2e7c03[_0x6a56('0x2c')]=_[_0x6a56('0x26')](_0x4a85d0,'name');_0x2e7c03['query']=_[_0x6a56('0x2d')](_0x967e8a['query']);_0x2e7c03[_0x6a56('0x2e')]=_[_0x6a56('0x2f')](_0x2e7c03[_0x6a56('0x2c')],_0x2e7c03[_0x6a56('0x30')]);_0x5768db[_0x6a56('0x31')]=_['intersection'](_0x2e7c03['model'],qs['fields'](_0x967e8a[_0x6a56('0x30')][_0x6a56('0x32')]));_0x5768db[_0x6a56('0x31')]=_0x5768db[_0x6a56('0x31')][_0x6a56('0x33')]?_0x5768db['attributes']:_0x2e7c03['model'];if(!_0x967e8a['query'][_0x6a56('0x34')](_0x6a56('0x35'))){_0x5768db[_0x6a56('0x18')]=qs[_0x6a56('0x18')](_0x967e8a[_0x6a56('0x30')][_0x6a56('0x18')]);_0x5768db[_0x6a56('0x17')]=qs[_0x6a56('0x17')](_0x967e8a[_0x6a56('0x30')][_0x6a56('0x17')]);}_0x5768db[_0x6a56('0x36')]=qs[_0x6a56('0x37')](_0x967e8a[_0x6a56('0x30')]['sort']);_0x5768db[_0x6a56('0x38')]=qs[_0x6a56('0x2e')](_['pick'](_0x967e8a[_0x6a56('0x30')],_0x2e7c03['filters']),_0x4a85d0);if(_0x967e8a[_0x6a56('0x30')][_0x6a56('0x39')]){_0x5768db[_0x6a56('0x38')]=_[_0x6a56('0x3a')](_0x5768db['where'],{'$or':_[_0x6a56('0x26')](_0x4a85d0,function(_0x322539){if(_0x322539[_0x6a56('0x2a')]!=='VIRTUAL'){var _0xf4da9={};_0xf4da9[_0x322539[_0x6a56('0x24')]]={'$like':'%'+_0x967e8a[_0x6a56('0x30')][_0x6a56('0x39')]+'%'};return _0xf4da9;}})});}_0x5768db=_[_0x6a56('0x3a')]({},_0x5768db,_0x967e8a['options']);var _0x39d28a={'where':_0x5768db['where']};return db[_0x6a56('0x27')][_0x6a56('0x1a')](_0x39d28a)[_0x6a56('0x20')](function(_0x54f7f9){_0x3ffd20[_0x6a56('0x1a')]=_0x54f7f9;if(_0x967e8a[_0x6a56('0x30')][_0x6a56('0x3b')]){_0x5768db[_0x6a56('0x3c')]=[{'all':!![]}];}return db[_0x6a56('0x27')][_0x6a56('0x3d')](_0x5768db);})['then'](function(_0x466942){_0x3ffd20[_0x6a56('0x3e')]=_0x466942;return _0x3ffd20;})['then'](respondWithFilteredResult(_0x12cda5,_0x5768db))[_0x6a56('0x3f')](handleError(_0x12cda5,null));};exports['show']=function(_0x873f9f,_0x44f087){var _0x2da493={'raw':!![],'where':{'id':_0x873f9f[_0x6a56('0x40')]['id']}},_0x463687={};_0x463687[_0x6a56('0x2c')]=_[_0x6a56('0x2d')](db[_0x6a56('0x27')][_0x6a56('0x28')]);_0x463687[_0x6a56('0x30')]=_[_0x6a56('0x2d')](_0x873f9f[_0x6a56('0x30')]);_0x463687['filters']=_[_0x6a56('0x2f')](_0x463687[_0x6a56('0x2c')],_0x463687[_0x6a56('0x30')]);_0x2da493['attributes']=_['intersection'](_0x463687[_0x6a56('0x2c')],qs[_0x6a56('0x32')](_0x873f9f[_0x6a56('0x30')]['fields']));_0x2da493['attributes']=_0x2da493[_0x6a56('0x31')]['length']?_0x2da493[_0x6a56('0x31')]:_0x463687[_0x6a56('0x2c')];if(_0x873f9f[_0x6a56('0x30')][_0x6a56('0x3b')]){_0x2da493[_0x6a56('0x3c')]=[{'all':!![]}];}_0x2da493=_['merge']({},_0x2da493,_0x873f9f[_0x6a56('0x41')]);return db[_0x6a56('0x27')]['find'](_0x2da493)['then'](handleEntityNotFound(_0x44f087,null))[_0x6a56('0x20')](respondWithResult(_0x44f087,null))[_0x6a56('0x3f')](handleError(_0x44f087,null));};exports[_0x6a56('0x42')]=function(_0x52c5,_0x37aa12){return db['ChatTransferReport'][_0x6a56('0x42')](_0x52c5['body'],{})[_0x6a56('0x20')](respondWithResult(_0x37aa12,0xc9))[_0x6a56('0x3f')](handleError(_0x37aa12,null));};exports[_0x6a56('0x1f')]=function(_0x165a3d,_0x287a6f){if(_0x165a3d[_0x6a56('0x43')]['id']){delete _0x165a3d['body']['id'];}return db[_0x6a56('0x27')][_0x6a56('0x44')]({'where':{'id':_0x165a3d[_0x6a56('0x40')]['id']}})[_0x6a56('0x20')](handleEntityNotFound(_0x287a6f,null))['then'](saveUpdates(_0x165a3d[_0x6a56('0x43')],null))['then'](respondWithResult(_0x287a6f,null))[_0x6a56('0x3f')](handleError(_0x287a6f,null));};exports[_0x6a56('0x21')]=function(_0x2f185b,_0x3484f0){return db[_0x6a56('0x27')][_0x6a56('0x44')]({'where':{'id':_0x2f185b[_0x6a56('0x40')]['id']}})[_0x6a56('0x20')](handleEntityNotFound(_0x3484f0,null))[_0x6a56('0x20')](removeEntity(_0x3484f0,null))[_0x6a56('0x3f')](handleError(_0x3484f0,null));};exports[_0x6a56('0x45')]=function(_0x165d62,_0x400066){return db['ChatTransferReport'][_0x6a56('0x45')]()[_0x6a56('0x20')](respondWithResult(_0x400066,null))[_0x6a56('0x3f')](handleError(_0x400066,null));}; \ No newline at end of file +var _0x4563=['nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','error','stack','name','map','ChatTransferReport','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0x4563,0xa5));var _0x3456=function(_0x3f5cf7,_0x2b475f){_0x3f5cf7=_0x3f5cf7-0x0;var _0x5d6a54=_0x4563[_0x3f5cf7];return _0x5d6a54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3456('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3456('0x1'));var rp=require(_0x3456('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3456('0x3'));var path=require(_0x3456('0x4'));var sox=require(_0x3456('0x5'));var csv=require(_0x3456('0x6'));var ejs=require(_0x3456('0x7'));var fs=require('fs');var fs_extra=require(_0x3456('0x8'));var _=require(_0x3456('0x9'));var squel=require('squel');var crypto=require(_0x3456('0xa'));var jsforce=require(_0x3456('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3456('0x6'));var querystring=require('querystring');var Papa=require(_0x3456('0xc'));var Redis=require('ioredis');var authService=require(_0x3456('0xd'));var qs=require(_0x3456('0xe'));var as=require(_0x3456('0xf'));var hardwareService=require(_0x3456('0x10'));var logger=require(_0x3456('0x11'))(_0x3456('0x12'));var utils=require(_0x3456('0x13'));var config=require(_0x3456('0x14'));var licenseUtil=require(_0x3456('0x15'));var db=require(_0x3456('0x16'))['db'];function respondWithStatusCode(_0x2e36f9,_0x2a5425){_0x2a5425=_0x2a5425||0xcc;return function(_0x20dc7b){if(_0x20dc7b){return _0x2e36f9[_0x3456('0x17')](_0x2a5425);}return _0x2e36f9[_0x3456('0x18')](_0x2a5425)[_0x3456('0x19')]();};}function respondWithResult(_0x2b109f,_0x2c9862){_0x2c9862=_0x2c9862||0xc8;return function(_0x3a74f2){if(_0x3a74f2){return _0x2b109f[_0x3456('0x18')](_0x2c9862)[_0x3456('0x1a')](_0x3a74f2);}};}function respondWithFilteredResult(_0x396e50,_0x43ec8f){return function(_0x14040a){if(_0x14040a){var _0x1d8135=typeof _0x43ec8f[_0x3456('0x1b')]===_0x3456('0x1c')&&typeof _0x43ec8f[_0x3456('0x1d')]==='undefined';var _0x288595=_0x14040a[_0x3456('0x1e')];var _0x28e216=_0x1d8135?0x0:_0x43ec8f[_0x3456('0x1b')];var _0x1cb436=_0x1d8135?_0x14040a[_0x3456('0x1e')]:_0x43ec8f[_0x3456('0x1b')]+_0x43ec8f['limit'];var _0x202ca4;if(_0x1cb436>=_0x288595){_0x1cb436=_0x288595;_0x202ca4=0xc8;}else{_0x202ca4=0xce;}_0x396e50[_0x3456('0x18')](_0x202ca4);return _0x396e50['set']('Content-Range',_0x28e216+'-'+_0x1cb436+'/'+_0x288595)[_0x3456('0x1a')](_0x14040a);}return null;};}function patchUpdates(_0x8435dd){return function(_0x3abb60){try{jsonpatch[_0x3456('0x1f')](_0x3abb60,_0x8435dd,!![]);}catch(_0x30b302){return BPromise[_0x3456('0x20')](_0x30b302);}return _0x3abb60[_0x3456('0x21')]();};}function saveUpdates(_0x39622d,_0x13b1ae){return function(_0x4fba0f){if(_0x4fba0f){return _0x4fba0f[_0x3456('0x22')](_0x39622d)[_0x3456('0x23')](function(_0x5a3e2a){return _0x5a3e2a;});}return null;};}function removeEntity(_0xe39d54,_0xc8dd7e){return function(_0x15449a){if(_0x15449a){return _0x15449a['destroy']()[_0x3456('0x23')](function(){_0xe39d54[_0x3456('0x18')](0xcc)[_0x3456('0x19')]();});}};}function handleEntityNotFound(_0x1e3b48,_0x35d3a0){return function(_0x56071e){if(!_0x56071e){_0x1e3b48['sendStatus'](0x194);}return _0x56071e;};}function handleError(_0x24d266,_0x171c90){_0x171c90=_0x171c90||0x1f4;return function(_0x4181f9){logger[_0x3456('0x24')](_0x4181f9[_0x3456('0x25')]);if(_0x4181f9['name']){delete _0x4181f9[_0x3456('0x26')];}_0x24d266[_0x3456('0x18')](_0x171c90)['send'](_0x4181f9);};}exports['index']=function(_0x33ccfe,_0x3290ca){var _0x48c9c8={},_0x19a424={},_0x44990c={'count':0x0,'rows':[]};var _0x5a8b06=_[_0x3456('0x27')](db[_0x3456('0x28')]['rawAttributes'],function(_0x44e40b){return{'name':_0x44e40b[_0x3456('0x29')],'type':_0x44e40b['type'][_0x3456('0x2a')]};});_0x19a424['model']=_[_0x3456('0x27')](_0x5a8b06,_0x3456('0x26'));_0x19a424[_0x3456('0x2b')]=_[_0x3456('0x2c')](_0x33ccfe[_0x3456('0x2b')]);_0x19a424['filters']=_[_0x3456('0x2d')](_0x19a424[_0x3456('0x2e')],_0x19a424[_0x3456('0x2b')]);_0x48c9c8['attributes']=_[_0x3456('0x2d')](_0x19a424['model'],qs['fields'](_0x33ccfe[_0x3456('0x2b')][_0x3456('0x2f')]));_0x48c9c8['attributes']=_0x48c9c8[_0x3456('0x30')][_0x3456('0x31')]?_0x48c9c8[_0x3456('0x30')]:_0x19a424[_0x3456('0x2e')];if(!_0x33ccfe[_0x3456('0x2b')][_0x3456('0x32')](_0x3456('0x33'))){_0x48c9c8[_0x3456('0x1d')]=qs[_0x3456('0x1d')](_0x33ccfe[_0x3456('0x2b')][_0x3456('0x1d')]);_0x48c9c8['offset']=qs[_0x3456('0x1b')](_0x33ccfe[_0x3456('0x2b')]['offset']);}_0x48c9c8['order']=qs[_0x3456('0x34')](_0x33ccfe['query'][_0x3456('0x34')]);_0x48c9c8[_0x3456('0x35')]=qs[_0x3456('0x36')](_[_0x3456('0x37')](_0x33ccfe[_0x3456('0x2b')],_0x19a424[_0x3456('0x36')]),_0x5a8b06);if(_0x33ccfe[_0x3456('0x2b')]['filter']){_0x48c9c8[_0x3456('0x35')]=_[_0x3456('0x38')](_0x48c9c8[_0x3456('0x35')],{'$or':_[_0x3456('0x27')](_0x5a8b06,function(_0x4040ec){if(_0x4040ec['type']!==_0x3456('0x39')){var _0x520952={};_0x520952[_0x4040ec[_0x3456('0x26')]]={'$like':'%'+_0x33ccfe[_0x3456('0x2b')][_0x3456('0x3a')]+'%'};return _0x520952;}})});}_0x48c9c8=_['merge']({},_0x48c9c8,_0x33ccfe[_0x3456('0x3b')]);var _0x3e527b={'where':_0x48c9c8[_0x3456('0x35')]};return db[_0x3456('0x28')][_0x3456('0x1e')](_0x3e527b)[_0x3456('0x23')](function(_0x4e65ed){_0x44990c[_0x3456('0x1e')]=_0x4e65ed;if(_0x33ccfe[_0x3456('0x2b')][_0x3456('0x3c')]){_0x48c9c8[_0x3456('0x3d')]=[{'all':!![]}];}return db[_0x3456('0x28')][_0x3456('0x3e')](_0x48c9c8);})['then'](function(_0x3d5fe1){_0x44990c[_0x3456('0x3f')]=_0x3d5fe1;return _0x44990c;})[_0x3456('0x23')](respondWithFilteredResult(_0x3290ca,_0x48c9c8))['catch'](handleError(_0x3290ca,null));};exports[_0x3456('0x40')]=function(_0x3b8c0f,_0x12c43b){var _0x3ac999={'raw':!![],'where':{'id':_0x3b8c0f[_0x3456('0x41')]['id']}},_0x686773={};_0x686773[_0x3456('0x2e')]=_[_0x3456('0x2c')](db[_0x3456('0x28')][_0x3456('0x42')]);_0x686773[_0x3456('0x2b')]=_[_0x3456('0x2c')](_0x3b8c0f[_0x3456('0x2b')]);_0x686773['filters']=_[_0x3456('0x2d')](_0x686773[_0x3456('0x2e')],_0x686773[_0x3456('0x2b')]);_0x3ac999['attributes']=_[_0x3456('0x2d')](_0x686773[_0x3456('0x2e')],qs[_0x3456('0x2f')](_0x3b8c0f[_0x3456('0x2b')][_0x3456('0x2f')]));_0x3ac999[_0x3456('0x30')]=_0x3ac999[_0x3456('0x30')]['length']?_0x3ac999['attributes']:_0x686773[_0x3456('0x2e')];if(_0x3b8c0f[_0x3456('0x2b')][_0x3456('0x3c')]){_0x3ac999['include']=[{'all':!![]}];}_0x3ac999=_[_0x3456('0x38')]({},_0x3ac999,_0x3b8c0f['options']);return db[_0x3456('0x28')][_0x3456('0x43')](_0x3ac999)['then'](handleEntityNotFound(_0x12c43b,null))[_0x3456('0x23')](respondWithResult(_0x12c43b,null))[_0x3456('0x44')](handleError(_0x12c43b,null));};exports['create']=function(_0x547df6,_0x26a2f2){return db[_0x3456('0x28')][_0x3456('0x45')](_0x547df6[_0x3456('0x46')],{})[_0x3456('0x23')](respondWithResult(_0x26a2f2,0xc9))[_0x3456('0x44')](handleError(_0x26a2f2,null));};exports[_0x3456('0x22')]=function(_0x117e24,_0x284379){if(_0x117e24['body']['id']){delete _0x117e24['body']['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x117e24[_0x3456('0x41')]['id']}})[_0x3456('0x23')](handleEntityNotFound(_0x284379,null))[_0x3456('0x23')](saveUpdates(_0x117e24['body'],null))[_0x3456('0x23')](respondWithResult(_0x284379,null))['catch'](handleError(_0x284379,null));};exports['destroy']=function(_0x23bc5e,_0x363a9c){return db['ChatTransferReport'][_0x3456('0x43')]({'where':{'id':_0x23bc5e[_0x3456('0x41')]['id']}})[_0x3456('0x23')](handleEntityNotFound(_0x363a9c,null))[_0x3456('0x23')](removeEntity(_0x363a9c,null))[_0x3456('0x44')](handleError(_0x363a9c,null));};exports[_0x3456('0x47')]=function(_0x128722,_0x190905){return db[_0x3456('0x28')][_0x3456('0x47')]()[_0x3456('0x23')](respondWithResult(_0x190905,null))[_0x3456('0x44')](handleError(_0x190905,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index f3a9a57..0d7434a 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 _0x1e74=['ChatTransferReport','report_chat_transfer','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1e74,0x81));var _0x41e7=function(_0x200d26,_0x2d0438){_0x200d26=_0x200d26-0x0;var _0x3b72d0=_0x1e74[_0x200d26];return _0x3b72d0;};'use strict';var _=require('lodash');var util=require(_0x41e7('0x0'));var logger=require('../../config/logger')(_0x41e7('0x1'));var moment=require(_0x41e7('0x2'));var BPromise=require(_0x41e7('0x3'));var rp=require(_0x41e7('0x4'));var fs=require('fs');var path=require(_0x41e7('0x5'));var rimraf=require(_0x41e7('0x6'));var config=require(_0x41e7('0x7'));var attributes=require(_0x41e7('0x8'));module[_0x41e7('0x9')]=function(_0x1026ca,_0x1d1b9e){return _0x1026ca[_0x41e7('0xa')](_0x41e7('0xb'),attributes,{'tableName':_0x41e7('0xc'),'paranoid':![],'indexes':[{'name':_0x41e7('0xd'),'fields':[_0x41e7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba1c=['api','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','util','../../config/logger'];(function(_0x4ccc15,_0xac3724){var _0x2f7fa1=function(_0x3a5ff2){while(--_0x3a5ff2){_0x4ccc15['push'](_0x4ccc15['shift']());}};_0x2f7fa1(++_0xac3724);}(_0xba1c,0xe8));var _0xcba1=function(_0x2248b3,_0x3f672e){_0x2248b3=_0x2248b3-0x0;var _0x17dc4f=_0xba1c[_0x2248b3];return _0x17dc4f;};'use strict';var _=require('lodash');var util=require(_0xcba1('0x0'));var logger=require(_0xcba1('0x1'))(_0xcba1('0x2'));var moment=require('moment');var BPromise=require(_0xcba1('0x3'));var rp=require(_0xcba1('0x4'));var fs=require('fs');var path=require(_0xcba1('0x5'));var rimraf=require(_0xcba1('0x6'));var config=require(_0xcba1('0x7'));var attributes=require(_0xcba1('0x8'));module[_0xcba1('0x9')]=function(_0x218ec3,_0x5d78e5){return _0x218ec3[_0xcba1('0xa')](_0xcba1('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xcba1('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index ce705f0..3213a6b 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 _0xdd8d=['../../config/environment','client','http','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x2e3328,_0x46a3bf){var _0x5b7b85=function(_0x368fb9){while(--_0x368fb9){_0x2e3328['push'](_0x2e3328['shift']());}};_0x5b7b85(++_0x46a3bf);}(_0xdd8d,0xf4));var _0xddd8=function(_0x5a9666,_0x30bc94){_0x5a9666=_0x5a9666-0x0;var _0x28601f=_0xdd8d[_0x5a9666];return _0x28601f;};'use strict';var _=require(_0xddd8('0x0'));var util=require(_0xddd8('0x1'));var moment=require(_0xddd8('0x2'));var BPromise=require(_0xddd8('0x3'));var rs=require(_0xddd8('0x4'));var fs=require('fs');var Redis=require(_0xddd8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xddd8('0x6'));var logger=require('../../config/logger')(_0xddd8('0x7'));var config=require(_0xddd8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xddd8('0x9')][_0xddd8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37b08c,_0x5b6354,_0x1c3a12){return new BPromise(function(_0x54196c,_0x9d745e){return client['request'](_0x37b08c,_0x1c3a12)[_0xddd8('0xb')](function(_0x2a9441){logger['info'](_0xddd8('0xc'),_0x5b6354,_0xddd8('0xd'));logger[_0xddd8('0xe')](_0xddd8('0xf'),_0x5b6354,_0xddd8('0xd'),JSON[_0xddd8('0x10')](_0x2a9441));if(_0x2a9441[_0xddd8('0x11')]){if(_0x2a9441[_0xddd8('0x11')][_0xddd8('0x12')]===0x1f4){logger[_0xddd8('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x5b6354,_0x2a9441[_0xddd8('0x11')]['message']);return _0x9d745e(_0x2a9441[_0xddd8('0x11')][_0xddd8('0x13')]);}logger[_0xddd8('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x5b6354,_0x2a9441[_0xddd8('0x11')][_0xddd8('0x13')]);return _0x54196c(_0x2a9441[_0xddd8('0x11')][_0xddd8('0x13')]);}else{logger['info'](_0xddd8('0xc'),_0x5b6354,'request\x20sent');_0x54196c(_0x2a9441[_0xddd8('0x14')][_0xddd8('0x13')]);}})['catch'](function(_0xc6d2f0){logger[_0xddd8('0x11')](_0xddd8('0xc'),_0x5b6354,_0xc6d2f0);_0x9d745e(_0xc6d2f0);});});} \ No newline at end of file +var _0x370a=['result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x2adb87,_0x208f7c){var _0x5951f8=function(_0x26b53d){while(--_0x26b53d){_0x2adb87['push'](_0x2adb87['shift']());}};_0x5951f8(++_0x208f7c);}(_0x370a,0xbe));var _0xa370=function(_0x35c765,_0x4381ae){_0x35c765=_0x35c765-0x0;var _0xf63292=_0x370a[_0x35c765];return _0xf63292;};'use strict';var _=require('lodash');var util=require(_0xa370('0x0'));var moment=require(_0xa370('0x1'));var BPromise=require('bluebird');var rs=require(_0xa370('0x2'));var fs=require('fs');var Redis=require(_0xa370('0x3'));var db=require(_0xa370('0x4'))['db'];var utils=require(_0xa370('0x5'));var logger=require(_0xa370('0x6'))(_0xa370('0x7'));var config=require(_0xa370('0x8'));var jayson=require(_0xa370('0x9'));var client=jayson['client'][_0xa370('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a82a6,_0x32d291,_0x30f9c4){return new BPromise(function(_0x31a6a0,_0x3e8ab2){return client[_0xa370('0xb')](_0x4a82a6,_0x30f9c4)[_0xa370('0xc')](function(_0x1c1351){logger['info'](_0xa370('0xd'),_0x32d291,'request\x20sent');logger[_0xa370('0xe')](_0xa370('0xf'),_0x32d291,_0xa370('0x10'),JSON['stringify'](_0x1c1351));if(_0x1c1351[_0xa370('0x11')]){if(_0x1c1351[_0xa370('0x11')][_0xa370('0x12')]===0x1f4){logger[_0xa370('0x11')](_0xa370('0xd'),_0x32d291,_0x1c1351['error'][_0xa370('0x13')]);return _0x3e8ab2(_0x1c1351[_0xa370('0x11')]['message']);}logger[_0xa370('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x32d291,_0x1c1351[_0xa370('0x11')][_0xa370('0x13')]);return _0x31a6a0(_0x1c1351[_0xa370('0x11')]['message']);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x32d291,_0xa370('0x10'));_0x31a6a0(_0x1c1351[_0xa370('0x14')][_0xa370('0x13')]);}})['catch'](function(_0x404a70){logger[_0xa370('0x11')](_0xa370('0xd'),_0x32d291,_0x404a70);_0x3e8ab2(_0x404a70);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 00c1daf..175d7a7 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 _0x9d11=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','get','show','post','create','update','delete','/:id','destroy','util','path','connect-timeout'];(function(_0x3d27fd,_0x23e4f7){var _0x526bcf=function(_0x3b3fd4){while(--_0x3b3fd4){_0x3d27fd['push'](_0x3d27fd['shift']());}};_0x526bcf(++_0x23e4f7);}(_0x9d11,0x1b2));var _0x19d1=function(_0x284506,_0x191316){_0x284506=_0x284506-0x0;var _0x1e9ee5=_0x9d11[_0x284506];return _0x1e9ee5;};'use strict';var multer=require('multer');var util=require(_0x19d1('0x0'));var path=require(_0x19d1('0x1'));var timeout=require(_0x19d1('0x2'));var express=require(_0x19d1('0x3'));var router=express[_0x19d1('0x4')]();var fs_extra=require(_0x19d1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x19d1('0x6'));var config=require(_0x19d1('0x7'));var controller=require(_0x19d1('0x8'));router['get']('/',auth[_0x19d1('0x9')](),controller[_0x19d1('0xa')]);router[_0x19d1('0xb')]('/describe',auth[_0x19d1('0x9')](),controller['describe']);router[_0x19d1('0xb')]('/:id',auth[_0x19d1('0x9')](),controller[_0x19d1('0xc')]);router[_0x19d1('0xd')]('/',auth[_0x19d1('0x9')](),controller[_0x19d1('0xe')]);router['put']('/:id',auth[_0x19d1('0x9')](),controller[_0x19d1('0xf')]);router[_0x19d1('0x10')](_0x19d1('0x11'),auth[_0x19d1('0x9')](),controller[_0x19d1('0x12')]);module['exports']=router; \ No newline at end of file +var _0xfd00=['express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','post','create','delete','destroy','exports','util','path','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfd00,0x165));var _0x0fd0=function(_0x325991,_0x1957cd){_0x325991=_0x325991-0x0;var _0x35da9f=_0xfd00[_0x325991];return _0x35da9f;};'use strict';var multer=require('multer');var util=require(_0x0fd0('0x0'));var path=require(_0x0fd0('0x1'));var timeout=require(_0x0fd0('0x2'));var express=require(_0x0fd0('0x3'));var router=express[_0x0fd0('0x4')]();var fs_extra=require(_0x0fd0('0x5'));var auth=require(_0x0fd0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0x0fd0('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x0fd0('0x8')](),controller['describe']);router[_0x0fd0('0x7')](_0x0fd0('0x9'),auth[_0x0fd0('0x8')](),controller['show']);router[_0x0fd0('0xa')]('/',auth[_0x0fd0('0x8')](),controller[_0x0fd0('0xb')]);router['put'](_0x0fd0('0x9'),auth[_0x0fd0('0x8')](),controller['update']);router[_0x0fd0('0xc')](_0x0fd0('0x9'),auth[_0x0fd0('0x8')](),controller[_0x0fd0('0xd')]);module[_0x0fd0('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index de8bd29..3b6a27e 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 _0x3148=['stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Send','Skip','Feedback','star','thumb'];(function(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0x3148,0xa9));var _0x8314=function(_0x4b5a9f,_0x3bbdf0){_0x4b5a9f=_0x4b5a9f-0x0;var _0x53163a=_0x3148[_0x4b5a9f];return _0x53163a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8314('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x8314('0x1')]},'mapKey':{'type':Sequelize[_0x8314('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0x2')},'key':{'type':Sequelize[_0x8314('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8314('0x1')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8314('0x1')],'allowNull':![],'defaultValue':_0x8314('0x3'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8314('0x1')],'allowNull':![],'defaultValue':_0x8314('0x3'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8314('0x1')],'allowNull':![],'defaultValue':_0x8314('0x4'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x8314('0x5')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8314('0x1')]},'animation':{'type':Sequelize[_0x8314('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x8314('0x7'),_0x8314('0x8')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0x9')},'start_chat_button':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0xa')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0xb')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0xc')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8314('0xd')]},'closingQuestion':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0x10')},'noteTitle':{'type':Sequelize[_0x8314('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0x11')},'closingMessage':{'type':Sequelize[_0x8314('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0x12')},'skipMessageButton':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0x13')},'conditionAgreement':{'type':Sequelize[_0x8314('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8314('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8314('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x8314('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0x14')},'ratingType':{'type':Sequelize['ENUM'](_0x8314('0x15'),_0x8314('0x16')),'defaultValue':_0x8314('0x15')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8314('0xd')],'defaultValue':function(){return JSON[_0x8314('0x17')]({'items':[{'type':_0x8314('0x18'),'variable':null,'config':{'placeholder':_0x8314('0x19'),'type':_0x8314('0x1a'),'required':!![]},'props':{'title':_0x8314('0x19'),'helpText':''}},{'type':_0x8314('0x18'),'props':{'title':_0x8314('0x2'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8314('0x1b')](_0x8314('0x1c'))?JSON[_0x8314('0x1d')](this[_0x8314('0x1b')]('onlineForm')):{};},'set':function(_0x2205c1){return this['setDataValue'](_0x8314('0x1c'),JSON[_0x8314('0x17')](_0x2205c1));}},'offlineForm':{'type':Sequelize[_0x8314('0xd')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8314('0x18'),'props':{'title':_0x8314('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x8314('0x2'),'type':_0x8314('0x2')},'variable':null},{'type':_0x8314('0x1e'),'config':{'placeholder':_0x8314('0x1f')},'props':{'title':_0x8314('0x1f'),'helpText':_0x8314('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x8314('0x1b')](_0x8314('0x21'))?JSON['parse'](this[_0x8314('0x1b')](_0x8314('0x21'))):{};},'set':function(_0x40c1ea){return this[_0x8314('0x22')](_0x8314('0x21'),JSON[_0x8314('0x17')](_0x40c1ea));}},'token':{'type':Sequelize[_0x8314('0x1')],'defaultValue':function(){return rs[_0x8314('0x23')]();}},'autoclose':{'type':Sequelize[_0x8314('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8314('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x8314('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8314('0x1')]},'waitingTitle':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8314('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x8314('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x8314('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0x26')},'skipUnmanaged':{'type':Sequelize[_0x8314('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0x12')},'enableCustomerAttachment':{'type':Sequelize[_0x8314('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x8314('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x8314('0xd')]},'showAgentAvatar':{'type':Sequelize[_0x8314('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8314('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8314('0x27');}},'notificationSound':{'type':Sequelize[_0x8314('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8314('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x8314('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0x29')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0x2a')},'messagesAlignment':{'type':Sequelize[_0x8314('0x1')],'defaultValue':_0x8314('0x2b')},'defaultTitle':{'type':Sequelize[_0x8314('0x1')]},'customerAvatar':{'type':Sequelize[_0x8314('0xd')]},'showCustomerAvatar':{'type':Sequelize[_0x8314('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8314('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8314('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8314('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8314('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8314('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8314('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x8314('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8314('0x2d'),'set':function(_0xe042cd){if(!_0xe042cd)this['setDataValue'](_0x8314('0x2e'),null);this[_0x8314('0x22')]('mandatoryDisposition',_0xe042cd);}},'vidaooEscalation':{'type':Sequelize[_0x8314('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8314('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x8314('0x1')],'defaultValue':function(){return _0x8314('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x8314('0xd')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8314('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8314('0xd')]}}; \ No newline at end of file +var _0xe468=['email','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','STRING','#ffffff','INTEGER','ENUM','We\x20are\x20here!','Send','Contact\x20us','BOOLEAN','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','star','TEXT','stringify','input','name','text'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xe468,0xfa));var _0x8e46=function(_0x2a1ec7,_0xbdd6c4){_0x2a1ec7=_0x2a1ec7-0x0;var _0x4a3ed8=_0xe468[_0x2a1ec7];return _0x4a3ed8;};'use strict';var Sequelize=require(_0x8e46('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x8e46('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x8e46('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0x8e46('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8e46('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8e46('0x1')],'allowNull':![],'defaultValue':_0x8e46('0x2'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x8e46('0x3')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8e46('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8e46('0x4')]('rounded','squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':_0x8e46('0x5')},'start_chat_button':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':_0x8e46('0x6')},'header_offline':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':_0x8e46('0x7')},'download_transcript':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8e46('0x3')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':_0x8e46('0x9')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8e46('0xa')},'noteTitle':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':_0x8e46('0xb')},'placeholderMessage':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':_0x8e46('0xc')},'closingMessage':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':_0x8e46('0xd')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8e46('0x6')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x8e46('0x4')]('star','thumb'),'defaultValue':_0x8e46('0xe')},'ratingStarsNumber':{'type':Sequelize[_0x8e46('0x3')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8e46('0xf')],'defaultValue':function(){return JSON[_0x8e46('0x10')]({'items':[{'type':_0x8e46('0x11'),'variable':null,'config':{'placeholder':_0x8e46('0x12'),'type':_0x8e46('0x13'),'required':!![]},'props':{'title':_0x8e46('0x12'),'helpText':''}},{'type':_0x8e46('0x11'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x8e46('0x14'),'type':_0x8e46('0x14')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8e46('0x15')](_0x8e46('0x16'))?JSON[_0x8e46('0x17')](this[_0x8e46('0x15')](_0x8e46('0x16'))):{};},'set':function(_0x159521){return this[_0x8e46('0x18')](_0x8e46('0x16'),JSON[_0x8e46('0x10')](_0x159521));}},'offlineForm':{'type':Sequelize[_0x8e46('0xf')],'defaultValue':function(){return JSON[_0x8e46('0x10')]({'items':[{'type':_0x8e46('0x11'),'props':{'title':_0x8e46('0x14'),'helpText':''},'config':{'required':!![],'placeholder':_0x8e46('0x14'),'type':'email'},'variable':null},{'type':_0x8e46('0x19'),'config':{'placeholder':_0x8e46('0x1a')},'props':{'title':_0x8e46('0x1a'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x8e46('0x1b'))?JSON[_0x8e46('0x17')](this[_0x8e46('0x15')](_0x8e46('0x1b'))):{};},'set':function(_0x5f3e50){return this['setDataValue'](_0x8e46('0x1b'),JSON[_0x8e46('0x10')](_0x5f3e50));}},'token':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':function(){return rs[_0x8e46('0x1c')]();}},'autoclose':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8e46('0x1')]},'waitingTitle':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':_0x8e46('0x1d')},'waitingMessage':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':_0x8e46('0x1e')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':_0x8e46('0x1f')},'enableUnmanagedNote':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':_0x8e46('0x20')},'skipUnmanaged':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':_0x8e46('0x21')},'sendUnmanaged':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8e46('0x1')]},'notificationTemplate':{'type':Sequelize[_0x8e46('0xf')],'defaultValue':function(){return _0x8e46('0x22');}},'notificationSound':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':_0x8e46('0x23')},'waitForTheAssignedAgent':{'type':Sequelize[_0x8e46('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x8e46('0x24')},'verticalAlignment':{'type':Sequelize[_0x8e46('0x3')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':_0x8e46('0x25')},'messagesAlignment':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x8e46('0x1')]},'customerAvatar':{'type':Sequelize[_0x8e46('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8e46('0x3')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8e46('0x1')],'allowNull':![],'defaultValue':_0x8e46('0x26'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8e46('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8e46('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':_0x8e46('0x27')},'systemAvatar':{'type':Sequelize[_0x8e46('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8e46('0x3')],'comment':_0x8e46('0x28')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8e46('0x29'),'set':function(_0x48ccbb){if(!_0x48ccbb)this['setDataValue'](_0x8e46('0x2a'),null);this[_0x8e46('0x18')](_0x8e46('0x2b'),_0x48ccbb);}},'vidaooEscalation':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x8e46('0x1')],'defaultValue':function(){return _0x8e46('0x2c');}},'vidaooMetadata':{'type':Sequelize[_0x8e46('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8e46('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8e46('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index d251ee3..023c109 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 _0xe57e=['send','index','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','findAll','rows','show','Pause','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','root','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','ChatApplication','Applications','account','list','applications','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','created','autoclose','close','*,*,*,*','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','mapKeyOffline','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','fromString','mimetype','server','files','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','user','pass','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','originalname','mapValues','email','NotifyMailAccount','notifyMail','remove','addInteraction','omit','Owner','fullname','internal','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','custom','License','increment','chatLicenseExceeded','push','all','some','utf8','remote','connection','remoteAddress','textColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','READ_COMMITTED','findAndCountAll','priority','getApplications','chatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','Attachments','removeAgents','isArray','emit','getAgents','bluebird','util','path','ejs','querystring','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','UserProfileResource','end','stack','name'];(function(_0x18441d,_0x5694bd){var _0x5a4801=function(_0x160dfd){while(--_0x160dfd){_0x18441d['push'](_0x18441d['shift']());}};_0x5a4801(++_0x5694bd);}(_0xe57e,0xf2));var _0xee57=function(_0x1fd36b,_0x3f0f3b){_0x1fd36b=_0x1fd36b-0x0;var _0x473d7c=_0xe57e[_0x1fd36b];return _0x473d7c;};'use strict';var BPromise=require(_0xee57('0x0'));var Mustache=require('mustache');var util=require(_0xee57('0x1'));var path=require(_0xee57('0x2'));var ejs=require(_0xee57('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require(_0xee57('0x4'));var Redis=require('ioredis');var qs=require(_0xee57('0x5'));var logger=require(_0xee57('0x6'))(_0xee57('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xee57('0x8')]=_[_0xee57('0x9')](config[_0xee57('0x8')],{'host':_0xee57('0xa'),'port':0x18eb});var socket=require(_0xee57('0xb'))(new Redis(config[_0xee57('0x8')]));require(_0xee57('0xc'))['register'](socket);var htmlToText=require('html-to-text');var jayson=require(_0xee57('0xd'));var client=jayson[_0xee57('0xe')][_0xee57('0xf')]({'port':0x232c});var client9002=jayson[_0xee57('0xe')][_0xee57('0xf')]({'port':0x232a});var client9003=jayson[_0xee57('0xe')][_0xee57('0xf')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x45414f,_0x1f46e2,_0x298f51,_0x390305){return new BPromise(function(_0xdc2ed,_0x5491ba){var _0x1a063f=_0x390305||client;return _0x1a063f['request'](_0x45414f,_0x298f51)[_0xee57('0x10')](function(_0x4f37fb){logger[_0xee57('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x1f46e2,'request\x20sent');logger[_0xee57('0x12')](_0xee57('0x13'),_0x1f46e2,_0xee57('0x14'),JSON[_0xee57('0x15')](_0x4f37fb));if(_0x4f37fb['error']){if(_0x4f37fb[_0xee57('0x16')][_0xee57('0x17')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1f46e2,_0x4f37fb['error'][_0xee57('0x18')]);return _0x5491ba(_0x4f37fb['error'][_0xee57('0x18')]);}logger[_0xee57('0x16')](_0xee57('0x19'),_0x1f46e2,_0x4f37fb[_0xee57('0x16')][_0xee57('0x18')]);return _0xdc2ed(_0x4f37fb[_0xee57('0x16')]['message']);}else{logger[_0xee57('0x11')](_0xee57('0x19'),_0x1f46e2,_0xee57('0x14'));_0xdc2ed(_0x4f37fb['result']['message']);}})[_0xee57('0x1a')](function(_0x5c45c5){logger[_0xee57('0x16')](_0xee57('0x19'),_0x1f46e2,_0x5c45c5);_0x5491ba(_0x5c45c5);});});}function respondWithStatusCode(_0x54486f,_0x466869){_0x466869=_0x466869||0xcc;return function(_0x23fdf3){if(_0x23fdf3){return _0x54486f[_0xee57('0x1b')](_0x466869);}return _0x54486f[_0xee57('0x1c')](_0x466869)['end']();};}function respondWithResult(_0x2b5747,_0xb1fdf2){_0xb1fdf2=_0xb1fdf2||0xc8;return function(_0x111b7b){if(_0x111b7b){return _0x2b5747[_0xee57('0x1c')](_0xb1fdf2)[_0xee57('0x1d')](_0x111b7b);}};}function respondWithFilteredResult(_0x52d2f9,_0x7d7236){return function(_0x17fd20){if(_0x17fd20){var _0x4eedc9=typeof _0x7d7236[_0xee57('0x1e')]==='undefined'&&typeof _0x7d7236[_0xee57('0x1f')]===_0xee57('0x20');var _0x3c3706=_0x17fd20[_0xee57('0x21')];var _0x2cb540=_0x4eedc9?0x0:_0x7d7236['offset'];var _0x47bda3=_0x4eedc9?_0x17fd20[_0xee57('0x21')]:_0x7d7236['offset']+_0x7d7236[_0xee57('0x1f')];var _0x2c4e0f;if(_0x47bda3>=_0x3c3706){_0x47bda3=_0x3c3706;_0x2c4e0f=0xc8;}else{_0x2c4e0f=0xce;}_0x52d2f9[_0xee57('0x1c')](_0x2c4e0f);return _0x52d2f9[_0xee57('0x22')](_0xee57('0x23'),_0x2cb540+'-'+_0x47bda3+'/'+_0x3c3706)['json'](_0x17fd20);}return null;};}function saveUpdates(_0xe24fb1){return function(_0x26f1e3){if(_0x26f1e3){return _0x26f1e3[_0xee57('0x24')](_0xe24fb1)['then'](function(_0x329405){return _0x329405;});}return null;};}function removeEntity(_0x11c1e4){return function(_0x4aad08){if(_0x4aad08){return _0x4aad08[_0xee57('0x25')]()[_0xee57('0x10')](function(){var _0x2d5da2=_0x4aad08[_0xee57('0x26')]({'plain':!![]});var _0x2dd4c7='ChatWebsites';return db[_0xee57('0x27')][_0xee57('0x25')]({'where':{'type':_0x2dd4c7,'resourceId':_0x2d5da2['id']}})['then'](function(){return _0x4aad08;});})[_0xee57('0x10')](function(){_0x11c1e4[_0xee57('0x1c')](0xcc)[_0xee57('0x28')]();});}};}function handleEntityNotFound(_0x195459){return function(_0x38e4d2){if(!_0x38e4d2){_0x195459['sendStatus'](0x194);}return _0x38e4d2;};}function handleError(_0x31bd66,_0xec651){_0xec651=_0xec651||0x1f4;return function(_0x38b917){logger[_0xee57('0x16')](_0x38b917[_0xee57('0x29')]);if(_0x38b917[_0xee57('0x2a')]){delete _0x38b917['name'];}_0x31bd66['status'](_0xec651)[_0xee57('0x2b')](_0x38b917);};}exports[_0xee57('0x2c')]=function(_0x25cec8,_0x5c736a){var _0x49a7d8={'include':[{'model':db['Pause'],'as':_0xee57('0x2d')}]},_0x350ce3={},_0x28e181={'count':0x0,'rows':[]};var _0x44bdc7=_['map'](db[_0xee57('0x2e')][_0xee57('0x2f')],function(_0xa71bf3){return{'name':_0xa71bf3[_0xee57('0x30')],'type':_0xa71bf3[_0xee57('0x31')]['key']};});_0x350ce3['model']=_[_0xee57('0x32')](_0x44bdc7,_0xee57('0x2a'));_0x350ce3[_0xee57('0x33')]=_[_0xee57('0x34')](_0x25cec8[_0xee57('0x33')]);_0x350ce3[_0xee57('0x35')]=_[_0xee57('0x36')](_0x350ce3[_0xee57('0x37')],_0x350ce3[_0xee57('0x33')]);_0x49a7d8[_0xee57('0x38')]=_[_0xee57('0x36')](_0x350ce3[_0xee57('0x37')],qs[_0xee57('0x39')](_0x25cec8['query']['fields']));_0x49a7d8['attributes']=_0x49a7d8['attributes'][_0xee57('0x3a')]?_0x49a7d8[_0xee57('0x38')]:_0x350ce3[_0xee57('0x37')];if(!_0x25cec8['query']['hasOwnProperty'](_0xee57('0x3b'))){_0x49a7d8['limit']=qs[_0xee57('0x1f')](_0x25cec8[_0xee57('0x33')]['limit']);_0x49a7d8[_0xee57('0x1e')]=qs['offset'](_0x25cec8['query'][_0xee57('0x1e')]);}_0x49a7d8[_0xee57('0x3c')]=qs[_0xee57('0x3d')](_0x25cec8[_0xee57('0x33')][_0xee57('0x3d')]);_0x49a7d8['where']=qs[_0xee57('0x35')](_[_0xee57('0x3e')](_0x25cec8[_0xee57('0x33')],_0x350ce3[_0xee57('0x35')]),_0x44bdc7);if(_0x25cec8[_0xee57('0x33')][_0xee57('0x3f')]){_0x49a7d8['where']=_[_0xee57('0x40')](_0x49a7d8[_0xee57('0x41')],{'$or':_['map'](_0x44bdc7,function(_0x326e35){if(_0x326e35[_0xee57('0x31')]!==_0xee57('0x42')){var _0x3a028a={};_0x3a028a[_0x326e35[_0xee57('0x2a')]]={'$like':'%'+_0x25cec8[_0xee57('0x33')][_0xee57('0x3f')]+'%'};return _0x3a028a;}})});}_0x49a7d8=_[_0xee57('0x40')]({},_0x49a7d8,_0x25cec8[_0xee57('0x43')]);var _0x2f3515={'where':_0x49a7d8['where']};return db[_0xee57('0x2e')][_0xee57('0x21')](_0x2f3515)[_0xee57('0x10')](function(_0x370310){_0x28e181[_0xee57('0x21')]=_0x370310;if(_0x25cec8[_0xee57('0x33')]['includeAll']){_0x49a7d8['include']=[{'all':!![]}];}return db[_0xee57('0x2e')][_0xee57('0x44')](_0x49a7d8);})['then'](function(_0x13058d){_0x28e181[_0xee57('0x45')]=_0x13058d;return _0x28e181;})['then'](respondWithFilteredResult(_0x5c736a,_0x49a7d8))[_0xee57('0x1a')](handleError(_0x5c736a,null));};exports[_0xee57('0x46')]=function(_0x21b4f5,_0x5ad09b){var _0xe58a70={'raw':![],'where':{'id':_0x21b4f5['params']['id']},'include':[{'model':db[_0xee57('0x47')],'as':_0xee57('0x2d')}]},_0x378ba7={};_0x378ba7[_0xee57('0x37')]=_[_0xee57('0x34')](db[_0xee57('0x2e')][_0xee57('0x2f')]);_0x378ba7['query']=_['keys'](_0x21b4f5[_0xee57('0x33')]);_0x378ba7[_0xee57('0x35')]=_[_0xee57('0x36')](_0x378ba7[_0xee57('0x37')],_0x378ba7[_0xee57('0x33')]);_0xe58a70['attributes']=_[_0xee57('0x36')](_0x378ba7[_0xee57('0x37')],qs[_0xee57('0x39')](_0x21b4f5[_0xee57('0x33')][_0xee57('0x39')]));_0xe58a70[_0xee57('0x38')]=_0xe58a70[_0xee57('0x38')][_0xee57('0x3a')]?_0xe58a70[_0xee57('0x38')]:_0x378ba7[_0xee57('0x37')];if(_0x21b4f5['query'][_0xee57('0x48')]){_0xe58a70[_0xee57('0x49')]=[{'all':!![]}];}_0xe58a70=_[_0xee57('0x40')]({},_0xe58a70,_0x21b4f5[_0xee57('0x43')]);return db[_0xee57('0x2e')][_0xee57('0x4a')](_0xe58a70)[_0xee57('0x10')](handleEntityNotFound(_0x5ad09b,null))[_0xee57('0x10')](respondWithResult(_0x5ad09b,null))[_0xee57('0x1a')](handleError(_0x5ad09b,null));};exports[_0xee57('0x4b')]=function(_0x5cc7e3,_0x236ed1){return db[_0xee57('0x2e')][_0xee57('0x4b')](_0x5cc7e3[_0xee57('0x4c')],{})[_0xee57('0x10')](function(_0x5253a4){var _0x2d7b65=_0x5cc7e3['user'][_0xee57('0x26')]({'plain':!![]});if(!_0x2d7b65)throw new Error(_0xee57('0x4d'));if(_0x2d7b65[_0xee57('0x4e')]==='user'){var _0x12cb94=_0x5253a4['get']({'plain':!![]});var _0x16dcf4=_0xee57('0x4f');return db[_0xee57('0x50')][_0xee57('0x4a')]({'where':{'name':_0x16dcf4,'userProfileId':_0x2d7b65[_0xee57('0x51')]},'raw':!![]})['then'](function(_0x4d626e){if(_0x4d626e&&_0x4d626e['autoAssociation']===0x0){return db[_0xee57('0x27')][_0xee57('0x4b')]({'name':_0x12cb94[_0xee57('0x2a')],'resourceId':_0x12cb94['id'],'type':_0x4d626e['name'],'sectionId':_0x4d626e['id']},{})[_0xee57('0x10')](function(){return _0x5253a4;});}else{return _0x5253a4;}})[_0xee57('0x1a')](function(_0x12bb75){logger[_0xee57('0x16')](_0xee57('0x52'),_0x12bb75);throw _0x12bb75;});}return _0x5253a4;})[_0xee57('0x10')](respondWithResult(_0x236ed1,0xc9))[_0xee57('0x1a')](handleError(_0x236ed1,null));};exports[_0xee57('0x24')]=function(_0x31f6fe,_0x5e3b57){if(_0x31f6fe[_0xee57('0x4c')]['id']){delete _0x31f6fe['body']['id'];}return db[_0xee57('0x2e')]['find']({'where':{'id':_0x31f6fe[_0xee57('0x53')]['id']},'include':[{'model':db[_0xee57('0x47')],'as':_0xee57('0x2d')}]})[_0xee57('0x10')](handleEntityNotFound(_0x5e3b57,null))[_0xee57('0x10')](saveUpdates(_0x31f6fe[_0xee57('0x4c')],null))['then'](respondWithResult(_0x5e3b57,null))[_0xee57('0x1a')](handleError(_0x5e3b57,null));};exports[_0xee57('0x25')]=function(_0x313358,_0x19019f){return db['ChatWebsite']['find']({'where':{'id':_0x313358[_0xee57('0x53')]['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x19019f,null))['then'](removeEntity(_0x19019f,null))[_0xee57('0x1a')](handleError(_0x19019f,null));};exports['describe']=function(_0x3d1aa3,_0x11032e){return db['ChatWebsite'][_0xee57('0x54')]()['then'](respondWithResult(_0x11032e,null))['catch'](handleError(_0x11032e,null));};exports['addDisposition']=function(_0x43db41,_0x4db647){if(_0x43db41['body']['id']){delete _0x43db41[_0xee57('0x4c')]['id'];}return db['ChatWebsite'][_0xee57('0x4a')]({'where':{'id':_0x43db41['params']['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x4db647,null))[_0xee57('0x10')](function(_0x3ff727){if(_0x3ff727){_0x43db41['body'][_0xee57('0x55')]=_0x3ff727['id'];return db[_0xee57('0x56')][_0xee57('0x4b')](_0x43db41[_0xee57('0x4c')]);}})['then'](respondWithResult(_0x4db647,null))['catch'](handleError(_0x4db647,null));};exports[_0xee57('0x57')]=function(_0x42bbcd,_0x197e74){var _0x4f6239={'raw':![],'where':{}};var _0xa0d87e={};var _0x3fe3e6={'count':0x0,'rows':[]};return db[_0xee57('0x2e')][_0xee57('0x58')]({'where':{'id':_0x42bbcd[_0xee57('0x53')]['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x197e74,null))[_0xee57('0x10')](function(_0x1a8a1a){if(_0x1a8a1a){_0xa0d87e[_0xee57('0x37')]=_[_0xee57('0x34')](db['Disposition'][_0xee57('0x2f')]);_0xa0d87e[_0xee57('0x33')]=_[_0xee57('0x34')](_0x42bbcd[_0xee57('0x33')]);_0xa0d87e[_0xee57('0x35')]=_[_0xee57('0x36')](_0xa0d87e[_0xee57('0x37')],_0xa0d87e[_0xee57('0x33')]);_0x4f6239[_0xee57('0x38')]=_[_0xee57('0x36')](_0xa0d87e[_0xee57('0x37')],qs[_0xee57('0x39')](_0x42bbcd['query'][_0xee57('0x39')]));_0x4f6239[_0xee57('0x38')]=_0x4f6239[_0xee57('0x38')][_0xee57('0x3a')]?_0x4f6239[_0xee57('0x38')]:_0xa0d87e[_0xee57('0x37')];if(!_0x42bbcd['query'][_0xee57('0x59')]('nolimit')){_0x4f6239[_0xee57('0x1f')]=qs[_0xee57('0x1f')](_0x42bbcd[_0xee57('0x33')]['limit']);_0x4f6239[_0xee57('0x1e')]=qs[_0xee57('0x1e')](_0x42bbcd[_0xee57('0x33')][_0xee57('0x1e')]);}_0x4f6239['order']=qs['sort'](_0x42bbcd['query'][_0xee57('0x3d')]);_0x4f6239[_0xee57('0x41')]=qs[_0xee57('0x35')](_[_0xee57('0x3e')](_0x42bbcd[_0xee57('0x33')],_0xa0d87e[_0xee57('0x35')]));_0x4f6239[_0xee57('0x41')][_0xee57('0x55')]=_0x1a8a1a['id'];if(_0x42bbcd[_0xee57('0x33')]['filter']){_0x4f6239[_0xee57('0x41')]=_[_0xee57('0x40')](_0x4f6239[_0xee57('0x41')],{'$or':_[_0xee57('0x32')](_0x4f6239[_0xee57('0x38')],function(_0x145931){var _0x4fd92b={};_0x4fd92b[_0x145931]={'$like':'%'+_0x42bbcd[_0xee57('0x33')][_0xee57('0x3f')]+'%'};return _0x4fd92b;})});}_0x4f6239=_[_0xee57('0x40')]({},_0x4f6239,_0x42bbcd[_0xee57('0x43')]);return db[_0xee57('0x56')][_0xee57('0x21')]({'where':_0x4f6239[_0xee57('0x41')]})['then'](function(_0x32d50c){_0x3fe3e6[_0xee57('0x21')]=_0x32d50c;if(_0x42bbcd['query'][_0xee57('0x48')]){_0x4f6239[_0xee57('0x49')]=[{'all':!![]}];}return db[_0xee57('0x56')]['findAll'](_0x4f6239);})[_0xee57('0x10')](function(_0x46eedd){_0x3fe3e6[_0xee57('0x45')]=_0x46eedd;return _0x3fe3e6;});}})[_0xee57('0x10')](respondWithFilteredResult(_0x197e74,_0x4f6239))['catch'](handleError(_0x197e74,null));};exports[_0xee57('0x5a')]=function(_0x1e30cd,_0x2c8cc3){return db[_0xee57('0x2e')][_0xee57('0x4a')]({'where':{'id':_0x1e30cd[_0xee57('0x53')]['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x2c8cc3,null))[_0xee57('0x10')](function(_0x532c75){if(_0x532c75){return _0x532c75[_0xee57('0x5a')](_0x1e30cd[_0xee57('0x33')][_0xee57('0x5b')]);}})['then'](respondWithStatusCode(_0x2c8cc3,null))[_0xee57('0x1a')](handleError(_0x2c8cc3,null));};exports['addAnswer']=function(_0x1f1b9c,_0x3c598a){if(_0x1f1b9c[_0xee57('0x4c')]['id']){delete _0x1f1b9c[_0xee57('0x4c')]['id'];}return db[_0xee57('0x2e')][_0xee57('0x4a')]({'where':{'id':_0x1f1b9c['params']['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x3c598a,null))[_0xee57('0x10')](function(_0x3c2f2e){if(_0x3c2f2e){_0x1f1b9c[_0xee57('0x4c')]['ChatWebsiteId']=_0x3c2f2e['id'];return db['CannedAnswer'][_0xee57('0x4b')](_0x1f1b9c[_0xee57('0x4c')]);}})[_0xee57('0x10')](respondWithResult(_0x3c598a,null))[_0xee57('0x1a')](handleError(_0x3c598a,null));};exports[_0xee57('0x5c')]=function(_0x595931,_0x47c536){var _0x8f1d58={'raw':![],'where':{}};var _0x415508={};var _0xd57868={'count':0x0,'rows':[]};return db[_0xee57('0x2e')][_0xee57('0x58')]({'where':{'id':_0x595931[_0xee57('0x53')]['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x47c536,null))[_0xee57('0x10')](function(_0x381791){if(_0x381791){_0x415508['model']=_[_0xee57('0x34')](db[_0xee57('0x5d')][_0xee57('0x2f')]);_0x415508[_0xee57('0x33')]=_['keys'](_0x595931['query']);_0x415508[_0xee57('0x35')]=_['intersection'](_0x415508[_0xee57('0x37')],_0x415508[_0xee57('0x33')]);_0x8f1d58['attributes']=_[_0xee57('0x36')](_0x415508[_0xee57('0x37')],qs[_0xee57('0x39')](_0x595931[_0xee57('0x33')]['fields']));_0x8f1d58[_0xee57('0x38')]=_0x8f1d58[_0xee57('0x38')]['length']?_0x8f1d58[_0xee57('0x38')]:_0x415508[_0xee57('0x37')];if(!_0x595931[_0xee57('0x33')][_0xee57('0x59')](_0xee57('0x3b'))){_0x8f1d58[_0xee57('0x1f')]=qs['limit'](_0x595931[_0xee57('0x33')]['limit']);_0x8f1d58['offset']=qs['offset'](_0x595931[_0xee57('0x33')][_0xee57('0x1e')]);}_0x8f1d58[_0xee57('0x3c')]=qs[_0xee57('0x3d')](_0x595931['query'][_0xee57('0x3d')]);_0x8f1d58[_0xee57('0x41')]=qs['filters'](_[_0xee57('0x3e')](_0x595931[_0xee57('0x33')],_0x415508[_0xee57('0x35')]));_0x8f1d58[_0xee57('0x41')][_0xee57('0x55')]=_0x381791['id'];if(_0x595931[_0xee57('0x33')][_0xee57('0x3f')]){_0x8f1d58[_0xee57('0x41')]=_['merge'](_0x8f1d58['where'],{'$or':_[_0xee57('0x32')](_0x8f1d58[_0xee57('0x38')],function(_0x5b21ee){var _0x51a4b9={};_0x51a4b9[_0x5b21ee]={'$like':'%'+_0x595931[_0xee57('0x33')][_0xee57('0x3f')]+'%'};return _0x51a4b9;})});}_0x8f1d58=_[_0xee57('0x40')]({},_0x8f1d58,_0x595931[_0xee57('0x43')]);return db[_0xee57('0x5d')][_0xee57('0x21')]({'where':_0x8f1d58[_0xee57('0x41')]})['then'](function(_0x3e510a){_0xd57868[_0xee57('0x21')]=_0x3e510a;if(_0x595931[_0xee57('0x33')]['includeAll']){_0x8f1d58[_0xee57('0x49')]=[{'all':!![]}];}return db[_0xee57('0x5d')]['findAll'](_0x8f1d58);})[_0xee57('0x10')](function(_0x5d6e8e){_0xd57868[_0xee57('0x45')]=_0x5d6e8e;return _0xd57868;});}})[_0xee57('0x10')](respondWithFilteredResult(_0x47c536,_0x8f1d58))[_0xee57('0x1a')](handleError(_0x47c536,null));};exports[_0xee57('0x5e')]=function(_0x3bb6fe,_0x47ed16){return db['ChatWebsite'][_0xee57('0x4a')]({'where':{'id':_0x3bb6fe[_0xee57('0x53')]['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x47ed16,null))[_0xee57('0x10')](function(_0x41e9ee){if(_0x41e9ee){return _0x41e9ee[_0xee57('0x5e')](_0x3bb6fe['query'][_0xee57('0x5b')]);}})[_0xee57('0x10')](respondWithStatusCode(_0x47ed16,null))[_0xee57('0x1a')](handleError(_0x47ed16,null));};exports[_0xee57('0x5f')]=function(_0x49ff95,_0x254d9d){_0x49ff95[_0xee57('0x4c')][_0xee57('0x60')]=_0x49ff95[_0xee57('0x61')][_0xee57('0x62')];return db[_0xee57('0x2e')][_0xee57('0x4a')]({'where':{'id':_0x49ff95[_0xee57('0x53')]['id']}})['then'](handleEntityNotFound(_0x254d9d,null))[_0xee57('0x10')](saveUpdates(_0x49ff95[_0xee57('0x4c')],null))['then'](respondWithResult(_0x254d9d,null))[_0xee57('0x1a')](handleError(_0x254d9d,null));};exports[_0xee57('0x63')]=function(_0x37a3c4,_0x4ac800){_0x37a3c4[_0xee57('0x4c')][_0xee57('0x64')]=_0x37a3c4['file'][_0xee57('0x62')];return db[_0xee57('0x2e')][_0xee57('0x4a')]({'where':{'id':_0x37a3c4[_0xee57('0x53')]['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x4ac800,null))[_0xee57('0x10')](saveUpdates(_0x37a3c4['body'],null))['then'](respondWithResult(_0x4ac800,null))[_0xee57('0x1a')](handleError(_0x4ac800,null));};exports['addCustomerAvatar']=function(_0x4eb727,_0x1985af){_0x4eb727[_0xee57('0x4c')][_0xee57('0x65')]=_0x4eb727[_0xee57('0x61')]['filename'];return db[_0xee57('0x2e')][_0xee57('0x4a')]({'where':{'id':_0x4eb727[_0xee57('0x53')]['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x1985af,null))[_0xee57('0x10')](saveUpdates(_0x4eb727[_0xee57('0x4c')],null))[_0xee57('0x10')](respondWithResult(_0x1985af,null))[_0xee57('0x1a')](handleError(_0x1985af,null));};exports[_0xee57('0x66')]=function(_0xb01d3a,_0x1de26b){_0xb01d3a['body'][_0xee57('0x67')]=_0xb01d3a[_0xee57('0x61')]['filename'];return db[_0xee57('0x2e')][_0xee57('0x4a')]({'where':{'id':_0xb01d3a[_0xee57('0x53')]['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x1de26b,null))[_0xee57('0x10')](saveUpdates(_0xb01d3a[_0xee57('0x4c')],null))['then'](respondWithResult(_0x1de26b,null))['catch'](handleError(_0x1de26b,null));};exports['getLogo']=function(_0x2ddb9a,_0x25fd56){var _0x602a9f=path[_0xee57('0x68')](config['root'],_0xee57('0x69'));var _0x2321ed={'where':{'id':_0x2ddb9a[_0xee57('0x53')]['id']},'attributes':['id',_0xee57('0x60')],'raw':!![]};var _0x1ca856=![];return require(_0xee57('0x6a'))[_0xee57('0x6b')]()[_0xee57('0x10')](function(_0x553d16){if(_0x553d16){_0x1ca856=_0x553d16['custom'];}})[_0xee57('0x10')](function(){return db[_0xee57('0x2e')][_0xee57('0x4a')](_0x2321ed);})[_0xee57('0x10')](handleEntityNotFound(_0x25fd56,null))[_0xee57('0x10')](function(_0x53a369){if(_0x53a369){if(!_[_0xee57('0x6c')](_0x53a369[_0xee57('0x60')])){if(fs['existsSync'](path[_0xee57('0x68')](config['root'],'server/files/images/logos/',_0x53a369[_0xee57('0x60')]))&&_0x1ca856){_0x602a9f=path[_0xee57('0x68')](config[_0xee57('0x6d')],'server/files/images/logos/',_0x53a369[_0xee57('0x60')]);}}return _0x25fd56[_0xee57('0x6e')](_0x602a9f);}})[_0xee57('0x1a')](handleError(_0x25fd56,null));};exports[_0xee57('0x6f')]=function(_0x56b2b3,_0x45f3c3){var _0x37e36b=path['join'](config[_0xee57('0x6d')],_0xee57('0x70'));var _0x570525={'where':{'id':_0x56b2b3[_0xee57('0x53')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0xee57('0x4a')](_0x570525)[_0xee57('0x10')](handleEntityNotFound(_0x45f3c3,null))[_0xee57('0x10')](function(_0x36b62b){if(_0x36b62b){if(!_[_0xee57('0x6c')](_0x36b62b['agentAvatar'])){if(fs[_0xee57('0x71')](path[_0xee57('0x68')](config[_0xee57('0x6d')],_0xee57('0x72'),_0x36b62b['agentAvatar']))){_0x37e36b=path[_0xee57('0x68')](config[_0xee57('0x6d')],_0xee57('0x72'),_0x36b62b[_0xee57('0x64')]);}}return _0x45f3c3['download'](_0x37e36b);}})['catch'](handleError(_0x45f3c3,null));};exports['getCustomerAvatar']=function(_0x292964,_0x63600e){var _0x4c2937=path[_0xee57('0x68')](config[_0xee57('0x6d')],_0xee57('0x73'));var _0x4e4b30={'where':{'id':_0x292964[_0xee57('0x53')]['id']},'attributes':['id',_0xee57('0x65'),_0xee57('0x74')],'raw':!![]};return db[_0xee57('0x2e')][_0xee57('0x4a')](_0x4e4b30)['then'](handleEntityNotFound(_0x63600e,null))[_0xee57('0x10')](function(_0xa95b72){if(_0xa95b72){if(!_[_0xee57('0x6c')](_0xa95b72['customerAvatar'])){if(fs[_0xee57('0x71')](path[_0xee57('0x68')](config[_0xee57('0x6d')],_0xee57('0x72'),_0xa95b72['customerAvatar']))&&_0xa95b72[_0xee57('0x74')]){_0x4c2937=path[_0xee57('0x68')](config[_0xee57('0x6d')],'server/files/images/avatars/',_0xa95b72[_0xee57('0x65')]);}}return _0x63600e[_0xee57('0x6e')](_0x4c2937);}})[_0xee57('0x1a')](handleError(_0x63600e,null));};exports['getSystemAvatar']=function(_0xf2f014,_0x48cabc){var _0x2d5905=path[_0xee57('0x68')](config['root'],_0xee57('0x75'));var _0x28140b={'where':{'id':_0xf2f014[_0xee57('0x53')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0xee57('0x4a')](_0x28140b)[_0xee57('0x10')](handleEntityNotFound(_0x48cabc,null))['then'](function(_0xfdb1b2){if(_0xfdb1b2){if(!_[_0xee57('0x6c')](_0xfdb1b2['systemAvatar'])){if(fs[_0xee57('0x71')](path['join'](config['root'],_0xee57('0x72'),_0xfdb1b2['systemAvatar']))){_0x2d5905=path[_0xee57('0x68')](config['root'],'server/files/images/avatars/',_0xfdb1b2[_0xee57('0x67')]);}}return _0x48cabc['download'](_0x2d5905);}})[_0xee57('0x1a')](handleError(_0x48cabc,null));};exports[_0xee57('0x76')]=function(_0x38e8f0,_0x2de8b7){var _0x2414ab=require(_0xee57('0x77'));var _0x343f13=new _0x2414ab();var _0x4ceada=_0x343f13[_0xee57('0x78')](_0x38e8f0[_0xee57('0x79')][_0xee57('0x7a')])['getResult']();var _0x5eea5b={'body':_0x38e8f0[_0xee57('0x4c')],'channel':_0xee57('0x7b')};var _0x2118b7=[];var _0x2124ab=[];var _0x596569={};var _0x54b054=![];return db[_0xee57('0x7c')][_0xee57('0x54')]()[_0xee57('0x10')](function(_0x494a2a){if(!_0x494a2a){throw new db[(_0xee57('0x7d'))][(_0xee57('0x7e'))](_0xee57('0x7f'));}_0x2118b7=_['difference'](_[_0xee57('0x34')](_0x494a2a),[_0xee57('0x80'),_0xee57('0x81')]);_0x2124ab=_[_0xee57('0x82')](_['keys'](_0x494a2a),[_0xee57('0x80'),_0xee57('0x81'),_0xee57('0x83'),_0xee57('0x84')]);if(_0x38e8f0[_0xee57('0x4c')]['id']){delete _0x38e8f0['body']['id'];}if(_[_0xee57('0x6c')](_0x38e8f0[_0xee57('0x4c')]['from'])){throw new db[(_0xee57('0x7d'))]['ValidationError'](_0xee57('0x85'));}if(_[_0xee57('0x6c')](_0x38e8f0[_0xee57('0x4c')][_0xee57('0x4c')])||_0x38e8f0['body'][_0xee57('0x4c')]===''){throw new db[(_0xee57('0x7d'))][(_0xee57('0x7e'))](_0xee57('0x86'));}if(_['isNil'](_0x38e8f0[_0xee57('0x4c')]['mapKey'])){throw new db[(_0xee57('0x7d'))][(_0xee57('0x7e'))](_0xee57('0x87')+_0x2124ab);}if(!_[_0xee57('0x88')](_0x2124ab,_0x38e8f0[_0xee57('0x4c')][_0xee57('0x89')])){throw new db[(_0xee57('0x7d'))][(_0xee57('0x7e'))](_0xee57('0x8a')+_0x2124ab);}_0x596569[_0x38e8f0['body'][_0xee57('0x89')]]=_0x38e8f0[_0xee57('0x4c')][_0xee57('0x8b')];})['then'](function(){return db['ChatWebsite'][_0xee57('0x4a')]({'where':{'id':_0x38e8f0['params']['id']},'include':[{'model':db['CmList'],'as':_0xee57('0x8c'),'include':[{'model':db['CmContact'],'as':_0xee57('0x8d'),'where':_0x596569,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xee57('0x8e')],'as':_0xee57('0x8f')}]});})[_0xee57('0x10')](handleEntityNotFound(_0x2de8b7,null))[_0xee57('0x10')](function(_0xd731e7){if(_0xd731e7&&_0xd731e7[_0xee57('0x8c')]){_0x5eea5b[_0xee57('0x90')]=_0xd731e7;_0x5eea5b['applications']=_0xd731e7[_0xee57('0x8f')];_0x5eea5b[_0xee57('0x91')]=_0xd731e7[_0xee57('0x8c')];_0x5eea5b[_0xee57('0x92')]=_['orderBy'](_0x5eea5b[_0xee57('0x92')],['priority'],['asc']);if(_0x5eea5b[_0xee57('0x90')][_0xee57('0x8f')]){delete _0x5eea5b['account'][_0xee57('0x8f')];}if(_0x5eea5b[_0xee57('0x90')][_0xee57('0x8c')]&&_0x5eea5b[_0xee57('0x90')]['List'][_0xee57('0x8d')][_0xee57('0x3a')]){return _0x5eea5b['account']['List'][_0xee57('0x8d')][0x0];}var _0x190d4=_[_0xee57('0x9')](_0x38e8f0[_0xee57('0x4c')],{'firstName':_0x38e8f0[_0xee57('0x4c')][_0xee57('0x8b')],'ListId':_0xd731e7['ListId']});_0x190d4[_0x38e8f0[_0xee57('0x4c')][_0xee57('0x89')]]=_0x38e8f0['body'][_0xee57('0x8b')];return db['CmContact'][_0xee57('0x4b')](_0x190d4,{'fields':_0x2118b7,'raw':!![]});}})[_0xee57('0x10')](handleEntityNotFound(_0x2de8b7,null))[_0xee57('0x10')](function(_0x4e1978){_0x5eea5b['contact']=_0x4e1978;var _0x156787=_0x38e8f0[_0xee57('0x4c')][_0xee57('0x93')];if(_0x38e8f0['headers'][_0xee57('0x94')]){_0x156787=_0x38e8f0[_0xee57('0x79')][_0xee57('0x94')];}else if(_0x38e8f0['headers'][_0xee57('0x95')]){_0x156787=_[_0xee57('0x96')](_0x38e8f0['headers'][_0xee57('0x95')][_0xee57('0x97')](','));}if(_0x4e1978){var _0x422f79={'ContactId':_0x4e1978['id'],'ChatWebsiteId':_0x38e8f0['params']['id'],'from':(_0x4e1978[_0xee57('0x98')]||'')+'\x20'+(_0x4e1978[_0xee57('0x99')]||''),'customerIp':_0x156787,'customerPort':_0x38e8f0['headers'][_0xee57('0x9a')]?_0x38e8f0[_0xee57('0x79')][_0xee57('0x9a')]:null,'referer':_0x38e8f0[_0xee57('0x4c')][_0xee57('0x9b')],'browserName':_0x4ceada['browser'][_0xee57('0x2a')]&&_0x4ceada[_0xee57('0x9c')][_0xee57('0x9d')]?util['format'](_0xee57('0x9e'),_0x4ceada[_0xee57('0x9c')][_0xee57('0x2a')],_0x4ceada['browser'][_0xee57('0x9d')]):_0xee57('0x9f'),'browserVersion':_0x4ceada[_0xee57('0x9c')]['version']||_0xee57('0x9f'),'osName':util[_0xee57('0xa0')](_0xee57('0x9e'),_0x4ceada['os']['name'],_0x4ceada['os'][_0xee57('0x9d')]),'osVersion':_0x4ceada['os'][_0xee57('0x9d')],'deviceModel':_0x4ceada[_0xee57('0xa1')][_0xee57('0x37')]&&_0x4ceada[_0xee57('0xa1')][_0xee57('0xa2')]?util['format'](_0xee57('0xa3'),_0x4ceada[_0xee57('0xa1')]['model'],_0x4ceada[_0xee57('0xa1')][_0xee57('0xa2')],_0x4ceada[_0xee57('0xa1')][_0xee57('0x31')]):null,'deviceVendor':_0x4ceada[_0xee57('0xa1')][_0xee57('0xa2')],'deviceType':_0x4ceada[_0xee57('0xa1')]['type'],'formData':JSON['stringify'](_0x38e8f0[_0xee57('0x4c')])};var _0x2f977b={'ChatWebsiteId':_0x38e8f0['params']['id'],'closed':![]};if(_0x38e8f0[_0xee57('0x4c')][_0xee57('0xa4')]){_0x2f977b['threadId']=_0x38e8f0['body'][_0xee57('0xa4')];return db[_0xee57('0xa5')][_0xee57('0x4a')]({'where':_0x2f977b})[_0xee57('0x10')](function(_0x197e22){if(_0x197e22){return[_0x197e22,![]];}_0x422f79['threadId']=_0x38e8f0['body']['threadId'];_0x422f79['externalUrl']=_0x38e8f0[_0xee57('0x4c')][_0xee57('0xa6')];return db[_0xee57('0xa5')][_0xee57('0x4b')](_0x422f79)[_0xee57('0x10')](function(_0x514c46){return[_0x514c46,!![]];});});}_0x2f977b[_0xee57('0xa7')]=_0x4e1978['id'];if(_0x38e8f0[_0xee57('0x4c')]['interaction']&&_0x38e8f0['body']['interaction']['id']){_0x2f977b['id']=_0x38e8f0[_0xee57('0x4c')][_0xee57('0xa8')]['id'];return db[_0xee57('0xa5')][_0xee57('0x4a')]({'where':_0x2f977b})[_0xee57('0x10')](function(_0x49d727){if(_0x49d727){return[_0x49d727,![]];}return db['ChatInteraction'][_0xee57('0x4b')](_0x422f79)[_0xee57('0x10')](function(_0x5e3c7e){return[_0x5e3c7e,!![]];});});}return db[_0xee57('0xa5')]['create'](_0x422f79)[_0xee57('0x10')](function(_0x479550){return[_0x479550,!![]];});}})[_0xee57('0xa9')](function(_0x4e88e1,_0x39a974){if(_0x4e88e1){_0x54b054=_0x39a974;if(!_0x39a974){var _0x2c6bf8={'from':(_0x5eea5b[_0xee57('0xaa')]['firstName']||'')+'\x20'+(_0x5eea5b[_0xee57('0xaa')][_0xee57('0x99')]||'')};if(_0x38e8f0['body'][_0xee57('0xa4')]&&_0x38e8f0[_0xee57('0x4c')][_0xee57('0xab')]&&_0x38e8f0[_0xee57('0x4c')]['threadId']!=_0x38e8f0[_0xee57('0x4c')]['messageId']){_0x2c6bf8['threadId']=_0x38e8f0[_0xee57('0x4c')][_0xee57('0xab')];}return _0x4e88e1[_0xee57('0x24')](_0x2c6bf8);}else{return _0x4e88e1;}}})[_0xee57('0x10')](function(_0x8715f9){_0x5eea5b[_0xee57('0xa8')]=_0x8715f9[_0xee57('0x26')]({'plain':!![]});_0x5eea5b['interaction'][_0xee57('0xac')]=_0x54b054;if(_0x5eea5b[_0xee57('0xa8')]['created']){if(_0x5eea5b[_0xee57('0x90')][_0xee57('0xad')]){_0x5eea5b[_0xee57('0x92')]['push']({'id':0x0,'priority':_0x5eea5b[_0xee57('0x92')][_0xee57('0x3a')]+0x1,'app':_0xee57('0xae'),'appdata':'unmanaged','interval':_0xee57('0xaf')});}}return db['ChatMessage'][_0xee57('0x4b')]({'body':_0x38e8f0[_0xee57('0x4c')]['body'],'ChatWebsiteId':_0x38e8f0[_0xee57('0x53')]['id'],'ChatInteractionId':_0x8715f9['id'],'direction':'in','ContactId':_0x5eea5b['contact']['id'],'AttachmentId':_0x38e8f0['body']['AttachmentId']});})['then'](function(_0xcbeffc){_0x5eea5b[_0xee57('0x18')]=_0xcbeffc;if(_0x5eea5b[_0xee57('0xa8')][_0xee57('0xb0')]){return db[_0xee57('0xb1')][_0xee57('0x4a')]({'attributes':['id',_0xee57('0x2a')],'where':{'id':_0x5eea5b[_0xee57('0xa8')][_0xee57('0xb0')]}})['then'](function(_0x1fde1e){if(_0x1fde1e){_0x5eea5b[_0xee57('0x92')][_0xee57('0xb2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1fde1e[_0xee57('0x2a')]+','+(_0x5eea5b[_0xee57('0x90')][_0xee57('0xb3')]||0xa),'interval':_0xee57('0xaf')});_0x5eea5b[_0xee57('0xb4')]=!![];}return respondWithRpcPromise(_0xee57('0xb5'),_0xee57('0xb6'),_0x5eea5b);});}return respondWithRpcPromise(_0xee57('0xb5'),_0xee57('0xb6'),_0x5eea5b);})[_0xee57('0x10')](function(_0x5b5765){respondWithRpcPromise(_0xee57('0xb7'),_0xee57('0xb7'),{'event':_0xee57('0x76'),'message':_0x5b5765},client9002);return _0x5b5765;})[_0xee57('0x10')](respondWithResult(_0x2de8b7,null))[_0xee57('0x1a')](handleError(_0x2de8b7,null));};exports['offline']=function(_0x171f76,_0x13b090){var _0x4e04e9,_0x8fe3c5,_0x1a962f;var _0x2f190f=[];var _0x266c2b={};var _0x5b31d9=_0x171f76['files']||[];var _0x55f373=[];var _0x2aadcc;return db[_0xee57('0x7c')][_0xee57('0x54')]()['then'](function(_0x26d89b){if(!_0x26d89b){throw new db[(_0xee57('0x7d'))]['ValidationError']('no\x20available\x20attributes');}_0x2f190f=_[_0xee57('0x82')](_['keys'](_0x26d89b),[_0xee57('0x80'),'updatedAt',_0xee57('0x83'),'ListId']);if(_0x171f76[_0xee57('0x4c')]['id']){delete _0x171f76[_0xee57('0x4c')]['id'];}if(_[_0xee57('0x6c')](_0x171f76[_0xee57('0x4c')][_0xee57('0x8b')])){throw _0x13b090[_0xee57('0x1c')](0x1f4)[_0xee57('0x2b')](new db[(_0xee57('0x7d'))][(_0xee57('0x7e'))](_0xee57('0x85')));}if(_[_0xee57('0x6c')](_0x171f76[_0xee57('0x4c')][_0xee57('0x4c')])||_0x171f76[_0xee57('0x4c')][_0xee57('0x4c')]===''){throw _0x13b090[_0xee57('0x1c')](0x1f4)[_0xee57('0x2b')](new db[(_0xee57('0x7d'))][(_0xee57('0x7e'))](_0xee57('0x86')));}if(_['isNil'](_0x171f76['body'][_0xee57('0xb8')])){throw _0x13b090[_0xee57('0x1c')](0x1f4)['send'](new db[(_0xee57('0x7d'))][(_0xee57('0x7e'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2f190f));}if(!_[_0xee57('0x88')](_0x2f190f,_0x171f76['body'][_0xee57('0xb8')])){throw _0x13b090[_0xee57('0x1c')](0x1f4)[_0xee57('0x2b')](new db[(_0xee57('0x7d'))][(_0xee57('0x7e'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2f190f));}_0x266c2b[_0x171f76[_0xee57('0x4c')][_0xee57('0xb8')]]=_0x171f76[_0xee57('0x4c')][_0xee57('0x8b')];})['then'](function(){return db['ChatWebsite'][_0xee57('0x4a')]({'where':{'id':_0x171f76[_0xee57('0x53')]['id']},'include':[{'model':db[_0xee57('0xb9')],'as':_0xee57('0x8c')},{'model':db['MailAccount'],'as':_0xee57('0xba')}]});})['then'](handleEntityNotFound(_0x13b090,null))['then'](function(_0x34f4cc){if(_0x34f4cc&&_0x34f4cc[_0xee57('0x8c')]){_0x8fe3c5=_0x34f4cc;var _0x196507=_[_0xee57('0x9')](_0x171f76[_0xee57('0x4c')],{'firstName':_0x171f76[_0xee57('0x4c')][_0xee57('0x8b')],'phone':_0x171f76[_0xee57('0x4c')][_0xee57('0x8b')],'ListId':_0x34f4cc[_0xee57('0x84')]});_0x196507[_0x171f76['body']['mapKeyOffline']]=_0x171f76['body'][_0xee57('0x8b')];return db[_0xee57('0x7c')][_0xee57('0xbb')]({'where':_0x266c2b,'defaults':_0x196507});}})['spread'](function(_0x25a514){if(_0x25a514){_0x1a962f=_0x25a514;var _0x854e80=fs[_0xee57('0xbc')](path['join'](config[_0xee57('0x6d')],_0xee57('0xbd')),'utf8');var _0x227b09=ejs[_0xee57('0xbe')](_0x854e80,{'body':_[_0xee57('0xbf')](_0x171f76[_0xee57('0x4c')][_0xee57('0x4c')]),'bodyTitle':_0x8fe3c5[_0xee57('0xc0')]});return db['ChatOfflineMessage'][_0xee57('0x4b')]({'body':_0x227b09,'plainBody':htmlToText[_0xee57('0xc1')](_0x227b09),'ContactId':_0x25a514['id'],'ChatWebsiteId':_0x8fe3c5['id']});}})['then'](function(_0x5f4696){_0x2aadcc=_0x5f4696;if(_0x5b31d9['length']){var _0x14ad53=_0x5b31d9['map'](function(_0x42a4f3){return{'name':_0x42a4f3['originalname'],'basename':_0x42a4f3[_0xee57('0x62')],'type':_0x42a4f3[_0xee57('0xc2')],'ChatOfflineMessageId':_0x5f4696['id']};});_0x55f373=_0x14ad53[_0xee57('0x32')](_0x7596ee=>{var _0x188363={'filename':_0x7596ee[_0xee57('0x2a')],'path':path[_0xee57('0x68')](config['root'],_0xee57('0xc3'),_0xee57('0xc4'),_0xee57('0xc5'),_0xee57('0xc6'),_0x7596ee['basename'])};return _0x188363;});if(!_0x8fe3c5[_0xee57('0xc7')]){return db[_0xee57('0xc8')][_0xee57('0xc9')](function(_0x122c99){return db[_0xee57('0xca')][_0xee57('0xcb')](_0x14ad53,{'transaction':_0x122c99});});}}})['then'](function(){if(_0x2aadcc){_0x4e04e9=_0x2aadcc;return db[_0xee57('0xba')][_0xee57('0x58')]({'where':{'active':!![]},'include':[{'model':db[_0xee57('0xcc')],'as':'Smtp','raw':!![]}]});}})[_0xee57('0x10')](function(_0x2e55e2){if(_0x2e55e2&&_0x2e55e2[_0xee57('0xcd')]&&_0x8fe3c5[_0xee57('0xce')]&&_0x8fe3c5[_0xee57('0xcf')]){var _0x485858={'tls':{'rejectUnauthorized':![]}};if(_0x2e55e2['Smtp'][_0xee57('0xd0')]){_0x485858[_0xee57('0xd0')]=_0x2e55e2['Smtp'][_0xee57('0xd0')];}else{_0x485858['host']=_0x2e55e2[_0xee57('0xcd')][_0xee57('0xd1')];_0x485858['port']=_0x2e55e2[_0xee57('0xcd')][_0xee57('0xd2')];_0x485858[_0xee57('0xd3')]=_0x2e55e2['Smtp'][_0xee57('0xd3')];}if(_0x2e55e2[_0xee57('0xcd')][_0xee57('0xd4')]){_0x485858[_0xee57('0xd5')]={'user':_0x2e55e2[_0xee57('0xcd')][_0xee57('0xd6')],'pass':_0x2e55e2[_0xee57('0xcd')][_0xee57('0xd7')]};}return respondWithRpcPromise('SendMail',_0xee57('0xd8'),{'account':_0x485858,'message':{'from':util['format'](_0xee57('0xd9'),_0x2e55e2[_0xee57('0x2a')],_0x2e55e2['email']||_0x2e55e2[_0xee57('0xcd')]['user']),'to':_0x8fe3c5[_0xee57('0xcf')],'subject':_0x8fe3c5[_0xee57('0xda')],'html':_0x4e04e9[_0xee57('0x4c')],'attachments':_0x55f373}},client9003)[_0xee57('0x10')](function(){return _0x4e04e9;})[_0xee57('0x1a')](function(_0x26edf8){console[_0xee57('0x16')](_0x26edf8);});}})[_0xee57('0x10')](function(){if(_0x8fe3c5&&_0x8fe3c5[_0xee57('0xc7')]&&_0x8fe3c5[_0xee57('0xdb')]){var _0x294a65=[];if(_0x5b31d9['length']){_0x294a65=_0x5b31d9['map'](function(_0x368ebc){return{'name':_0x368ebc[_0xee57('0xdc')],'basename':_0x368ebc['filename'],'type':_0x368ebc[_0xee57('0xc2')],'ChatOfflineMessageId':_0x2aadcc['id']};});}var _0x1a4601;if(!_[_0xee57('0x6c')](_0x8fe3c5['subjectOffline'])){var _0x38c9b8=_[_0xee57('0x32')](_0x171f76[_0xee57('0x4c')],function(_0x273aa9){return _0x273aa9;});var _0x538aad=_['toPairsIn'](_0x38c9b8)[0x0];var _0x214d5e=_[_0xee57('0xdd')](_0x538aad,function(_0x9f3a94){return _0x9f3a94;});_0x1a4601=_0x214d5e[0x1][_0x8fe3c5['subjectOffline']];}var _0x41d7df={'from':_0x1a962f[_0xee57('0xde')],'firstName':_0x1a962f[_0xee57('0x98')],'lastName':_0x1a962f['lastName'],'mapKey':_0xee57('0xde'),'message':{'from':_0x1a962f[_0xee57('0xde')],'to':_0x8fe3c5[_0xee57('0xba')]['email'],'cc':'','subject':_[_0xee57('0x6c')](_0x1a4601)?_0x8fe3c5[_0xee57('0xda')]:_0x1a4601,'messageId':'','sentAt':new Date(),'attach':_0x294a65[_0xee57('0x3a')],'attachments':_0x294a65,'originChannel':'Chat','ChatWebsiteId':_0x8fe3c5['id'],'ChatOfflineMessageId':_0x4e04e9['id'],'originTo':_0x8fe3c5['MailAccount'][_0xee57('0xde')]},'body':_0x4e04e9[_0xee57('0x4c')]};var _0x27e8ee={'account':{'id':_0x8fe3c5[_0xee57('0xdb')]},'body':_0x41d7df,'log':_0xee57('0xdf')};return respondWithRpcPromise(_0xee57('0xdf'),_0xee57('0xe0'),_0x27e8ee,client9001)[_0xee57('0x10')](function(){return _0x4e04e9;})[_0xee57('0x1a')](function(_0x359c56){console[_0xee57('0x16')](_0x359c56);});}return;})[_0xee57('0x10')](function(){if(_0x4e04e9){return _0x4e04e9;}})[_0xee57('0x10')](respondWithResult(_0x13b090,null))[_0xee57('0x1a')](function(_0x42724e){console[_0xee57('0x16')](_0xee57('0x1a'),_0x42724e);for(var _0x15c6f5 of _0x5b31d9){var _0x1969d8=path['join'](config[_0xee57('0x6d')],_0xee57('0xc3'),_0xee57('0xc4'),_0xee57('0xc5'),_0xee57('0xc6'),_0x15c6f5['filename']);fs_extra[_0xee57('0xe1')](_0x1969d8)[_0xee57('0x1a')](function(_0x105693){console[_0xee57('0x16')]('Could\x20not\x20remove\x20attachment\x20file',_0x1969d8,_0x105693);});}});};exports[_0xee57('0xe2')]=function(_0x219aa3,_0x2e9952){return db['ChatInteraction']['find']({'where':{'id':_0x219aa3[_0xee57('0x53')]['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x2e9952,null))[_0xee57('0x10')](function(_0x277ea2){if(_0x277ea2){return _0x277ea2[_0xee57('0xe2')](_0x219aa3[_0xee57('0x4c')]['ids'],_[_0xee57('0xe3')](_0x219aa3[_0xee57('0x4c')],['ids','id'])||{});}})[_0xee57('0x10')](respondWithResult(_0x2e9952,null))[_0xee57('0x1a')](handleError(_0x2e9952,null));};exports['getInteractions']=function(_0x1b279c,_0x1a3bb9){var _0x37c2b4={'raw':![],'where':{}};var _0x455e8e={};var _0x3299a4={'count':0x0,'rows':[]};return db[_0xee57('0x2e')][_0xee57('0x58')]({'where':{'id':_0x1b279c[_0xee57('0x53')]['id']}})['then'](handleEntityNotFound(_0x1a3bb9,null))[_0xee57('0x10')](function(_0x108f12){if(_0x108f12){_0x455e8e[_0xee57('0x37')]=_[_0xee57('0x34')](db['ChatInteraction'][_0xee57('0x2f')]);_0x455e8e[_0xee57('0x33')]=_[_0xee57('0x34')](_0x1b279c[_0xee57('0x33')]);_0x455e8e[_0xee57('0x35')]=_[_0xee57('0x36')](_0x455e8e[_0xee57('0x37')],_0x455e8e[_0xee57('0x33')]);_0x37c2b4[_0xee57('0x38')]=_[_0xee57('0x36')](_0x455e8e['model'],qs[_0xee57('0x39')](_0x1b279c['query'][_0xee57('0x39')]));_0x37c2b4[_0xee57('0x38')]=_0x37c2b4['attributes'][_0xee57('0x3a')]?_0x37c2b4[_0xee57('0x38')]:_0x455e8e[_0xee57('0x37')];if(!_0x1b279c[_0xee57('0x33')][_0xee57('0x59')](_0xee57('0x3b'))){_0x37c2b4['limit']=qs[_0xee57('0x1f')](_0x1b279c[_0xee57('0x33')]['limit']);_0x37c2b4['offset']=qs[_0xee57('0x1e')](_0x1b279c['query'][_0xee57('0x1e')]);}_0x37c2b4[_0xee57('0x3c')]=qs[_0xee57('0x3d')](_0x1b279c['query'][_0xee57('0x3d')]);_0x37c2b4[_0xee57('0x41')]=qs['filters'](_[_0xee57('0x3e')](_0x1b279c[_0xee57('0x33')],_0x455e8e[_0xee57('0x35')]));_0x37c2b4[_0xee57('0x41')][_0xee57('0x55')]=_0x108f12['id'];if(_0x1b279c[_0xee57('0x33')][_0xee57('0x3f')]){_0x37c2b4['where']=_[_0xee57('0x40')](_0x37c2b4[_0xee57('0x41')],{'$or':_['map'](_0x37c2b4['attributes'],function(_0x2aba37){var _0x163c10={};_0x163c10[_0x2aba37]={'$like':'%'+_0x1b279c[_0xee57('0x33')][_0xee57('0x3f')]+'%'};return _0x163c10;})});}_0x37c2b4=_[_0xee57('0x40')]({},_0x37c2b4,_0x1b279c[_0xee57('0x43')]);return db[_0xee57('0xa5')][_0xee57('0x21')]({'where':_0x37c2b4[_0xee57('0x41')]})[_0xee57('0x10')](function(_0x287319){_0x3299a4[_0xee57('0x21')]=_0x287319;if(_0x1b279c['query'][_0xee57('0x48')]){_0x37c2b4[_0xee57('0x49')]=[{'model':db[_0xee57('0x7c')],'as':'Contact','required':![]},{'model':db[_0xee57('0xb1')],'as':_0xee57('0xe4'),'attributes':['name',_0xee57('0xe5'),_0xee57('0xe6')],'required':![]},{'model':db[_0xee57('0xe7')],'as':'Tags','attributes':['id','name',_0xee57('0xe8')],'where':_0x1b279c[_0xee57('0x33')][_0xee57('0xe9')]?{'id':_0x1b279c[_0xee57('0x33')][_0xee57('0xe9')]}:undefined,'required':_0x1b279c['query'][_0xee57('0xe9')]?!![]:![]}];}return db[_0xee57('0xa5')][_0xee57('0x44')](_0x37c2b4);})[_0xee57('0x10')](function(_0x1a8cdc){_0x3299a4['rows']=_0x1a8cdc;return _0x3299a4;});}})[_0xee57('0x10')](respondWithFilteredResult(_0x1a3bb9,_0x37c2b4))[_0xee57('0x1a')](handleError(_0x1a3bb9,null));};function iftimePromise(_0x739e68,_0x4a923f){return respondWithRpcPromise(_0xee57('0xea'),_0xee57('0xeb'),{'command':_0x4a923f[_0xee57('0xec')]?util['format'](_0xee57('0xed'),_0x739e68[_0xee57('0xee')],_0x4a923f['timezone']):util[_0xee57('0xa0')](_0xee57('0xef'),_0x739e68[_0xee57('0xee')])},client9002)[_0xee57('0x10')](function(_0x12222b){var _0xa4f34=_0x12222b&&_0x12222b['indexOf'](_0xee57('0xf0'))>=0x0?!![]:![];logger[_0xee57('0x11')](_0xee57('0xf1'),_0x4a923f['id'],_0x739e68['id'],_0x739e68[_0xee57('0xee')],_0xa4f34?'ONLINE':_0xee57('0xf2'),_0x4a923f[_0xee57('0xec')]?_0x4a923f['timezone']:'No\x20timezone');return _0xa4f34;})[_0xee57('0x1a')](function(_0x26fc51){logger[_0xee57('0x16')](_0xee57('0xf1'),_0x4a923f['id'],_0x739e68['id'],_0x739e68[_0xee57('0xee')],util['inspect'](_0x26fc51,{'showHidden':![],'depth':null}),_0x4a923f['timezone']?_0x4a923f['timezone']:_0xee57('0xf3'));return![];});}exports['getSnippet']=function(_0xe17d09,_0x2c117b){var _0x318cf3=0x0;var _0x41159c=0x0;var _0x486308=![];var _0x1b040c;var _0x8925a;return db[_0xee57('0x2e')]['find']({'where':{'id':_0xe17d09[_0xee57('0x53')]['id']},'include':[{'model':db[_0xee57('0xf4')],'as':_0xee57('0xf4'),'include':[{'model':db['Interval'],'as':_0xee57('0xf5'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xee57('0x10')](handleEntityNotFound(_0x2c117b,null))['then'](function(_0x1a9441){if(_0x1a9441){_0x1b040c=_0x1a9441;return _0x1a9441[_0xee57('0xf6')]({'raw':!![]});}})['then'](function(_0x4c6128){if(_0x1b040c){if(_0x4c6128){_0x8925a=_0x4c6128;}}return require('../../config/license/util')[_0xee57('0x6b')]();})[_0xee57('0x10')](function(_0x14812d){if(_0x14812d){_0x41159c=_0x14812d[_0xee57('0xf7')];_0x486308=_0x14812d[_0xee57('0xf8')];}})[_0xee57('0x10')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0xee57('0x10')](function(_0x9eb4da){_0x318cf3=_0x9eb4da;if(_0x41159c&&_0x9eb4da>_0x41159c){return db[_0xee57('0xf9')][_0xee57('0x58')]({'where':{'id':0x1}})[_0xee57('0x10')](function(_0x519422){if(_0x519422){_0x519422[_0xee57('0xfa')](_0xee57('0xfb'));}});}})['then'](function(){if(_0x1b040c[_0xee57('0xf4')]&&_0x1b040c[_0xee57('0xf4')][_0xee57('0xf5')]){var _0x240519=[];for(var _0xe78cd=0x0;_0xe78cd<_0x1b040c[_0xee57('0xf4')][_0xee57('0xf5')][_0xee57('0x3a')];_0xe78cd++){var _0xef2054=_0x1b040c[_0xee57('0xf4')][_0xee57('0xf5')][_0xe78cd][_0xee57('0x26')]({'plain':!![]});_0x240519[_0xee57('0xfc')](iftimePromise(_0xef2054,_0x1b040c));}return BPromise[_0xee57('0xfd')](_0x240519)['then'](function(_0x23c7d8){return _[_0xee57('0xfe')](_0x23c7d8);});}else{return!![];}})['then'](function(_0x5a50ac){var _0x24e030=fs[_0xee57('0xbc')](path['join'](config[_0xee57('0x6d')],'server/files/chat/iframe.ejs'),_0xee57('0xff'));var _0x4021b2={'remote':_0x1b040c[_0xee57('0x100')],'query':querystring['stringify'](_[_0xee57('0x40')](_0x1b040c[_0xee57('0x26')]({'plain':!![]}),{'customerIp':_0xe17d09[_0xee57('0x79')][_0xee57('0x95')]||_0xe17d09[_0xee57('0x79')]['x-real-ip']||_0xe17d09[_0xee57('0x101')][_0xee57('0x102')]||_0xe17d09['ip'],'referer':_0xe17d09[_0xee57('0x79')][_0xee57('0x9b')],'openedInteractions':_0x318cf3,'maxInteractions':_0x41159c,'virtual':_0x486308[_0xee57('0xf7')],'online':_0x5a50ac,'custom':_0x486308}))['replace'](/'/g,'\x5c\x27')};_0x2c117b[_0xee57('0x2b')](ejs[_0xee57('0xbe')](Mustache['render'](_0x24e030,_0x4021b2),{'proactiveActions':_0x8925a,'alignment':_0x1b040c['alignment'],'verticalAlignment':_0x1b040c['verticalAlignment'],'div_color':_0x1b040c[_0xee57('0xe8')],'labelText':_0x1b040c['labelText'],'text_color':_0x1b040c[_0xee57('0x103')],'button_color':_0x1b040c['color_button'],'background_color':_0x1b040c[_0xee57('0x104')],'hideWhenOffline':_0x1b040c[_0xee57('0x105')],'interval':_0x1b040c[_0xee57('0x106')]}));})[_0xee57('0x1a')](handleError(_0x2c117b,null));};exports[_0xee57('0x107')]=function(_0x2bf193,_0x37f29e){var _0x3fa960=_0x2bf193['params']['id'];var _0x4a5c50=_0x2bf193['body'];var _0x2ae172=0xc8;var _0x34d109=null;return db['sequelize'][_0xee57('0xc9')]({'isolationLevel':db[_0xee57('0xc8')][_0xee57('0x108')]['ISOLATION_LEVELS'][_0xee57('0x109')]},function(_0x2b192d){return db[_0xee57('0x2e')][_0xee57('0x58')]({'where':{'id':_0x3fa960},'transaction':_0x2b192d})[_0xee57('0x10')](function(_0x51e1f4){if(_0x51e1f4){return db['ChatApplication'][_0xee57('0x25')]({'where':{'ChatWebsiteId':_0x3fa960},'transaction':_0x2b192d})[_0xee57('0x10')](function(){var _0x3684fa=_[_0xee57('0x32')](_0x4a5c50,function(_0x3ba6a2){_0x3ba6a2['ChatWebsiteId']=_0x3fa960;return _0x3ba6a2;});return db[_0xee57('0x8e')][_0xee57('0xcb')](_0x3684fa,{'transaction':_0x2b192d});});}else{_0x2ae172=0x194;_0x34d109=[];}});})[_0xee57('0x10')](function(){if(_0x2ae172!==0x194){return db[_0xee57('0x8e')][_0xee57('0x10a')]({'where':{'ChatWebsiteId':_0x3fa960},'order':_0xee57('0x10b')})['then'](function(_0x1d436b){_0x34d109=_0x1d436b;});}})['catch'](function(_0x1b0779){_0x2ae172=0x1f4;logger[_0xee57('0x16')](_0x1b0779['stack']);if(_0x1b0779[_0xee57('0x2a')]){delete _0x1b0779[_0xee57('0x2a')];}_0x34d109=_0x1b0779;})['finally'](function(){if(_0x34d109===null){_0x37f29e[_0xee57('0x1b')](_0x2ae172);}else{if(_0x2ae172===0x1f4){_0x37f29e[_0xee57('0x1c')](_0x2ae172)[_0xee57('0x2b')](_0x34d109);}else{_0x37f29e[_0xee57('0x1c')](_0x2ae172)['json'](_0x34d109);}}});};exports[_0xee57('0x10c')]=function(_0x5afa93,_0x35cd3c){var _0x364fa4={};var _0x281392={};var _0x13a687;var _0x4d4373;return db[_0xee57('0x2e')][_0xee57('0x58')]({'where':{'id':_0x5afa93[_0xee57('0x53')]['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x35cd3c,null))[_0xee57('0x10')](function(_0x499836){if(_0x499836){_0x13a687=_0x499836;_0x281392[_0xee57('0x37')]=_[_0xee57('0x34')](db['ChatApplication'][_0xee57('0x2f')]);_0x281392[_0xee57('0x33')]=_['keys'](_0x5afa93['query']);_0x281392[_0xee57('0x35')]=_['intersection'](_0x281392[_0xee57('0x37')],_0x281392[_0xee57('0x33')]);_0x364fa4[_0xee57('0x38')]=_[_0xee57('0x36')](_0x281392['model'],qs['fields'](_0x5afa93['query'][_0xee57('0x39')]));_0x364fa4[_0xee57('0x38')]=_0x364fa4[_0xee57('0x38')][_0xee57('0x3a')]?_0x364fa4['attributes']:_0x281392['model'];_0x364fa4[_0xee57('0x3c')]=qs[_0xee57('0x3d')](_0x5afa93[_0xee57('0x33')][_0xee57('0x3d')]);_0x364fa4[_0xee57('0x41')]=qs[_0xee57('0x35')](_[_0xee57('0x3e')](_0x5afa93['query'],_0x281392[_0xee57('0x35')]));if(_0x5afa93['query'][_0xee57('0x3f')]){_0x364fa4[_0xee57('0x41')]=_[_0xee57('0x40')](_0x364fa4[_0xee57('0x41')],{'$or':_[_0xee57('0x32')](_0x364fa4[_0xee57('0x38')],function(_0x5689b5){var _0x5077ba={};_0x5077ba[_0x5689b5]={'$like':'%'+_0x5afa93['query']['filter']+'%'};return _0x5077ba;})});}_0x364fa4=_[_0xee57('0x40')]({},_0x364fa4,_0x5afa93[_0xee57('0x43')]);return _0x13a687[_0xee57('0x10c')](_0x364fa4);}})[_0xee57('0x10')](function(_0x1cb675){if(_0x1cb675){_0x4d4373=_0x1cb675[_0xee57('0x3a')];if(!_0x5afa93[_0xee57('0x33')][_0xee57('0x59')](_0xee57('0x3b'))){_0x364fa4[_0xee57('0x1f')]=qs[_0xee57('0x1f')](_0x5afa93[_0xee57('0x33')]['limit']);_0x364fa4[_0xee57('0x1e')]=qs['offset'](_0x5afa93[_0xee57('0x33')]['offset']);}return _0x13a687[_0xee57('0x10c')](_0x364fa4);}})[_0xee57('0x10')](function(_0x19898a){if(_0x19898a){return _0x19898a?{'count':_0x4d4373,'rows':_0x19898a}:null;}})[_0xee57('0x10')](respondWithResult(_0x35cd3c,null))[_0xee57('0x1a')](handleError(_0x35cd3c,null));};exports['addProactiveActions']=function(_0x259530,_0x9e1082){return db[_0xee57('0x10d')]['find']({'where':{'id':_0x259530[_0xee57('0x53')]['id']}})['then'](handleEntityNotFound(_0x9e1082,null))[_0xee57('0x10')](function(_0x58a41e){if(_0x58a41e){return _0x58a41e['addProactiveActions'](_0x259530[_0xee57('0x4c')][_0xee57('0x5b')],_[_0xee57('0xe3')](_0x259530[_0xee57('0x4c')],[_0xee57('0x5b'),'id'])||{});}})[_0xee57('0x10')](respondWithResult(_0x9e1082,null))[_0xee57('0x1a')](handleError(_0x9e1082,null));};exports[_0xee57('0xf6')]=function(_0x2ee368,_0x46f941){var _0x4b2c08={};var _0x5881ad={};var _0x30271c;var _0x4685c8;return db[_0xee57('0x2e')]['findOne']({'where':{'id':_0x2ee368[_0xee57('0x53')]['id']}})['then'](handleEntityNotFound(_0x46f941,null))[_0xee57('0x10')](function(_0x5ebce4){if(_0x5ebce4){_0x30271c=_0x5ebce4;_0x5881ad[_0xee57('0x37')]=_[_0xee57('0x34')](db['ChatProactiveAction'][_0xee57('0x2f')]);_0x5881ad[_0xee57('0x33')]=_['keys'](_0x2ee368[_0xee57('0x33')]);_0x5881ad[_0xee57('0x35')]=_['intersection'](_0x5881ad[_0xee57('0x37')],_0x5881ad[_0xee57('0x33')]);_0x4b2c08['attributes']=_['intersection'](_0x5881ad[_0xee57('0x37')],qs[_0xee57('0x39')](_0x2ee368['query'][_0xee57('0x39')]));_0x4b2c08['attributes']=_0x4b2c08[_0xee57('0x38')][_0xee57('0x3a')]?_0x4b2c08[_0xee57('0x38')]:_0x5881ad['model'];_0x4b2c08[_0xee57('0x3c')]=qs[_0xee57('0x3d')](_0x2ee368[_0xee57('0x33')][_0xee57('0x3d')]);_0x4b2c08[_0xee57('0x41')]=qs[_0xee57('0x35')](_[_0xee57('0x3e')](_0x2ee368[_0xee57('0x33')],_0x5881ad[_0xee57('0x35')]));if(_0x2ee368[_0xee57('0x33')][_0xee57('0x3f')]){_0x4b2c08[_0xee57('0x41')]=_[_0xee57('0x40')](_0x4b2c08[_0xee57('0x41')],{'$or':_[_0xee57('0x32')](_0x4b2c08['attributes'],function(_0x593271){var _0x3ed612={};_0x3ed612[_0x593271]={'$like':'%'+_0x2ee368[_0xee57('0x33')][_0xee57('0x3f')]+'%'};return _0x3ed612;})});}_0x4b2c08=_[_0xee57('0x40')]({},_0x4b2c08,_0x2ee368[_0xee57('0x43')]);return _0x30271c[_0xee57('0xf6')](_0x4b2c08);}})['then'](function(_0x31ee06){if(_0x31ee06){_0x4685c8=_0x31ee06[_0xee57('0x3a')];if(!_0x2ee368[_0xee57('0x33')][_0xee57('0x59')](_0xee57('0x3b'))){_0x4b2c08[_0xee57('0x1f')]=qs[_0xee57('0x1f')](_0x2ee368[_0xee57('0x33')][_0xee57('0x1f')]);_0x4b2c08[_0xee57('0x1e')]=qs[_0xee57('0x1e')](_0x2ee368[_0xee57('0x33')][_0xee57('0x1e')]);}return _0x30271c[_0xee57('0xf6')](_0x4b2c08);}})[_0xee57('0x10')](function(_0x45b242){if(_0x45b242){return _0x45b242?{'count':_0x4685c8,'rows':_0x45b242}:null;}})[_0xee57('0x10')](respondWithResult(_0x46f941,null))['catch'](handleError(_0x46f941,null));};exports[_0xee57('0x10e')]=function(_0xbff9b2,_0x2a8836){var _0x527f05=_0xbff9b2[_0xee57('0x33')][_0xee57('0x10f')]===_0xee57('0x110')?_0xee57('0x111'):_0xee57('0x112');return db[_0xee57('0x2e')][_0xee57('0x4a')]({'attributes':['id',_0x527f05],'where':{'id':_0xbff9b2[_0xee57('0x53')]['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x2a8836,null))[_0xee57('0x10')](function(_0x5c989e){if(_0x5c989e){var _0x40a981=_0x5c989e[_0x527f05];var _0x255315=_0x40a981&&_0x40a981[_0xee57('0x113')]?_0x40a981[_0xee57('0x113')]:[];_0x2a8836['send']({'fromKey':_[_0xee57('0x6c')](_0x40a981[_0xee57('0x114')])?undefined:_0x40a981[_0xee57('0x114')],'count':_0x255315[_0xee57('0x3a')],'rows':_0x255315});}})[_0xee57('0x1a')](handleError(_0x2a8836,null));};exports[_0xee57('0x115')]=function(_0x583738,_0x175e76){var _0xa1c152={'raw':![],'where':{}};var _0x155236={};var _0x138a83={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xee57('0x58')]({'where':{'id':_0x583738[_0xee57('0x53')]['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x175e76,null))['then'](function(_0x4da293){if(_0x4da293){_0x155236[_0xee57('0x37')]=_[_0xee57('0x34')](db[_0xee57('0x116')]['rawAttributes']);_0x155236[_0xee57('0x33')]=_[_0xee57('0x34')](_0x583738['query']);_0x155236[_0xee57('0x35')]=_[_0xee57('0x36')](_0x155236[_0xee57('0x37')],_0x155236[_0xee57('0x33')]);_0xa1c152[_0xee57('0x38')]=_[_0xee57('0x36')](_0x155236['model'],qs[_0xee57('0x39')](_0x583738[_0xee57('0x33')][_0xee57('0x39')]));_0xa1c152[_0xee57('0x38')]=_0xa1c152[_0xee57('0x38')][_0xee57('0x3a')]?_0xa1c152[_0xee57('0x38')]:_0x155236[_0xee57('0x37')];if(!_0x583738[_0xee57('0x33')][_0xee57('0x59')](_0xee57('0x3b'))){_0xa1c152['limit']=qs[_0xee57('0x1f')](_0x583738[_0xee57('0x33')]['limit']);_0xa1c152[_0xee57('0x1e')]=qs[_0xee57('0x1e')](_0x583738[_0xee57('0x33')][_0xee57('0x1e')]);}_0xa1c152[_0xee57('0x3c')]=qs[_0xee57('0x3d')](_0x583738['query'][_0xee57('0x3d')]);_0xa1c152[_0xee57('0x41')]=qs[_0xee57('0x35')](_['pick'](_0x583738[_0xee57('0x33')],_0x155236[_0xee57('0x35')]));_0xa1c152[_0xee57('0x41')][_0xee57('0x55')]=_0x4da293['id'];if(_0x583738[_0xee57('0x33')]['filter']){_0xa1c152['where']=_[_0xee57('0x40')](_0xa1c152[_0xee57('0x41')],{'$or':_[_0xee57('0x32')](_0xa1c152[_0xee57('0x38')],function(_0x173412){var _0x51c224={};_0x51c224[_0x173412]={'$like':'%'+_0x583738['query'][_0xee57('0x3f')]+'%'};return _0x51c224;})});}_0xa1c152=_[_0xee57('0x40')]({},_0xa1c152,_0x583738[_0xee57('0x43')]);return db[_0xee57('0x116')][_0xee57('0x21')]({'where':_0xa1c152[_0xee57('0x41')]})['then'](function(_0x59125f){_0x138a83['count']=_0x59125f;if(_0x583738[_0xee57('0x33')][_0xee57('0x48')]){_0xa1c152['include']=[{'all':!![]}];}else{_0xa1c152[_0xee57('0x49')]=[{'model':db[_0xee57('0x7c')],'as':_0xee57('0x117'),'required':![]},{'model':db[_0xee57('0xca')],'as':_0xee57('0x118'),'required':![]}];}return db[_0xee57('0x116')][_0xee57('0x44')](_0xa1c152);})[_0xee57('0x10')](function(_0x2da2b7){_0x138a83[_0xee57('0x45')]=_0x2da2b7;return _0x138a83;});}})[_0xee57('0x10')](respondWithFilteredResult(_0x175e76,_0xa1c152))['catch'](handleError(_0x175e76,null));};exports['addAgents']=function(_0x15fe81,_0x450165){return db[_0xee57('0x2e')][_0xee57('0x4a')]({'where':{'id':_0x15fe81['params']['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x450165,null))[_0xee57('0x10')](function(_0x53b6d5){if(_0x53b6d5){return _0x53b6d5['addAgents'](_0x15fe81['body'][_0xee57('0x5b')],_['omit'](_0x15fe81[_0xee57('0x4c')],['ids','id'])||{})[_0xee57('0xa9')](function(_0xcb0dd9){for(var _0x204362=0x0;_0x204362<_0x15fe81['body'][_0xee57('0x5b')][_0xee57('0x3a')];_0x204362+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x15fe81[_0xee57('0x4c')]['ids'][_0x204362]),'ChatWebsiteId':Number(_0x15fe81['params']['id'])});}return _0xcb0dd9;});}})['then'](respondWithResult(_0x450165,null))[_0xee57('0x1a')](handleError(_0x450165,null));};exports[_0xee57('0x119')]=function(_0x4f2dc9,_0x31dbea){return db[_0xee57('0x2e')][_0xee57('0x4a')]({'where':{'id':_0x4f2dc9[_0xee57('0x53')]['id']}})['then'](handleEntityNotFound(_0x31dbea,null))['then'](function(_0x1797ce){if(_0x1797ce){return _0x1797ce[_0xee57('0x119')](_0x4f2dc9[_0xee57('0x33')][_0xee57('0x5b')])['then'](function(){if(_[_0xee57('0x11a')](_0x4f2dc9[_0xee57('0x33')][_0xee57('0x5b')])){for(var _0x488b21=0x0;_0x488b21<_0x4f2dc9[_0xee57('0x33')][_0xee57('0x5b')][_0xee57('0x3a')];_0x488b21+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x4f2dc9[_0xee57('0x33')]['ids'][_0x488b21]),'ChatWebsiteId':Number(_0x4f2dc9['params']['id'])});}}else{socket[_0xee57('0x11b')]('userChatWebsite:remove',{'UserId':Number(_0x4f2dc9[_0xee57('0x33')][_0xee57('0x5b')]),'ChatWebsiteId':Number(_0x4f2dc9['params']['id'])});}});}})['then'](respondWithStatusCode(_0x31dbea,null))[_0xee57('0x1a')](handleError(_0x31dbea,null));};exports[_0xee57('0x11c')]=function(_0xcf7133,_0x325ec2){var _0x5f53a0={};var _0x3fc2c7={};var _0x15d94f;var _0x24488a;return db[_0xee57('0x2e')][_0xee57('0x58')]({'where':{'id':_0xcf7133['params']['id']}})[_0xee57('0x10')](handleEntityNotFound(_0x325ec2,null))[_0xee57('0x10')](function(_0x37fcc){if(_0x37fcc){_0x15d94f=_0x37fcc;_0x3fc2c7[_0xee57('0x37')]=_['keys'](db['User'][_0xee57('0x2f')]);_0x3fc2c7['query']=_[_0xee57('0x34')](_0xcf7133[_0xee57('0x33')]);_0x3fc2c7[_0xee57('0x35')]=_[_0xee57('0x36')](_0x3fc2c7[_0xee57('0x37')],_0x3fc2c7[_0xee57('0x33')]);_0x5f53a0[_0xee57('0x38')]=_[_0xee57('0x36')](_0x3fc2c7[_0xee57('0x37')],qs['fields'](_0xcf7133[_0xee57('0x33')][_0xee57('0x39')]));_0x5f53a0[_0xee57('0x38')]=_0x5f53a0[_0xee57('0x38')][_0xee57('0x3a')]?_0x5f53a0[_0xee57('0x38')]:_0x3fc2c7[_0xee57('0x37')];_0x5f53a0[_0xee57('0x3c')]=qs[_0xee57('0x3d')](_0xcf7133[_0xee57('0x33')][_0xee57('0x3d')]);_0x5f53a0[_0xee57('0x41')]=qs[_0xee57('0x35')](_[_0xee57('0x3e')](_0xcf7133[_0xee57('0x33')],_0x3fc2c7[_0xee57('0x35')]));if(_0xcf7133[_0xee57('0x33')][_0xee57('0x3f')]){_0x5f53a0[_0xee57('0x41')]=_[_0xee57('0x40')](_0x5f53a0[_0xee57('0x41')],{'$or':_[_0xee57('0x32')](_0x5f53a0[_0xee57('0x38')],function(_0x2abe0a){var _0x4f13be={};_0x4f13be[_0x2abe0a]={'$like':'%'+_0xcf7133[_0xee57('0x33')][_0xee57('0x3f')]+'%'};return _0x4f13be;})});}_0x5f53a0=_['merge']({},_0x5f53a0,_0xcf7133[_0xee57('0x43')]);return _0x15d94f[_0xee57('0x11c')](_0x5f53a0);}})['then'](function(_0x51ce3c){if(_0x51ce3c){_0x24488a=_0x51ce3c['length'];if(!_0xcf7133[_0xee57('0x33')][_0xee57('0x59')](_0xee57('0x3b'))){_0x5f53a0[_0xee57('0x1f')]=qs[_0xee57('0x1f')](_0xcf7133[_0xee57('0x33')][_0xee57('0x1f')]);_0x5f53a0[_0xee57('0x1e')]=qs[_0xee57('0x1e')](_0xcf7133[_0xee57('0x33')][_0xee57('0x1e')]);}return _0x15d94f['getAgents'](_0x5f53a0);}})['then'](function(_0x3e4277){if(_0x3e4277){return _0x3e4277?{'count':_0x24488a,'rows':_0x3e4277}:null;}})[_0xee57('0x10')](respondWithResult(_0x325ec2,null))[_0xee57('0x1a')](handleError(_0x325ec2,null));}; \ No newline at end of file +var _0x2fda=['readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','Attachment','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','authentication','auth','pass','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','verticalAlignment','labelText','backgroundColor','IntervalId','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','spread','removeAgents','isArray','emit','userChatWebsite:remove','User','getAgents','bluebird','path','ejs','fs-extra','lodash','querystring','api','../../config/environment','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','http','client','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','update','destroy','then','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','ChatWebsite','includeAll','include','findAll','rows','show','params','intersection','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','ChatWebsiteId','Disposition','findOne','pick','removeDispositions','ids','CannedAnswer','removeAnswers','addLogo','filename','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','sitepic','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','getResult','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','CmContact','Contacts','DESC','ChatApplication','account','applications','list','orderBy','priority','asc','Applications','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','headers','x-real-port','referer','version','format','%s\x20%s','browser','unknown','device','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','lastName','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','agent','Start','startRouting','EventManager','notify','files','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','findOrCreate'];(function(_0x383339,_0x3d185b){var _0x1f5132=function(_0x4dfa59){while(--_0x4dfa59){_0x383339['push'](_0x383339['shift']());}};_0x1f5132(++_0x3d185b);}(_0x2fda,0x186));var _0xa2fd=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x2fda[_0x38a7ac];return _0x53061a;};'use strict';var BPromise=require(_0xa2fd('0x0'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa2fd('0x1'));var ejs=require(_0xa2fd('0x2'));var fs=require('fs');var fs_extra=require(_0xa2fd('0x3'));var _=require(_0xa2fd('0x4'));var querystring=require(_0xa2fd('0x5'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xa2fd('0x6'));var config=require(_0xa2fd('0x7'));var db=require('../../mysqldb')['db'];config[_0xa2fd('0x8')]=_[_0xa2fd('0x9')](config[_0xa2fd('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa2fd('0xa'))(new Redis(config[_0xa2fd('0x8')]));require(_0xa2fd('0xb'))[_0xa2fd('0xc')](socket);var htmlToText=require(_0xa2fd('0xd'));var jayson=require(_0xa2fd('0xe'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0xa2fd('0xf')]({'port':0x232a});var client9003=jayson['client'][_0xa2fd('0xf')]({'port':0x232b});var client9001=jayson[_0xa2fd('0x10')]['http']({'port':0x2329});function respondWithRpcPromise(_0x52de07,_0x10e8a5,_0x295780,_0x71c59a){return new BPromise(function(_0x325f35,_0x2e9eb8){var _0x3cff47=_0x71c59a||client;return _0x3cff47['request'](_0x52de07,_0x295780)['then'](function(_0x3a1708){logger['info'](_0xa2fd('0x11'),_0x10e8a5,'request\x20sent');logger[_0xa2fd('0x12')](_0xa2fd('0x13'),_0x10e8a5,_0xa2fd('0x14'),JSON[_0xa2fd('0x15')](_0x3a1708));if(_0x3a1708['error']){if(_0x3a1708[_0xa2fd('0x16')][_0xa2fd('0x17')]===0x1f4){logger[_0xa2fd('0x16')](_0xa2fd('0x11'),_0x10e8a5,_0x3a1708[_0xa2fd('0x16')]['message']);return _0x2e9eb8(_0x3a1708[_0xa2fd('0x16')][_0xa2fd('0x18')]);}logger[_0xa2fd('0x16')](_0xa2fd('0x11'),_0x10e8a5,_0x3a1708[_0xa2fd('0x16')][_0xa2fd('0x18')]);return _0x325f35(_0x3a1708[_0xa2fd('0x16')][_0xa2fd('0x18')]);}else{logger[_0xa2fd('0x19')](_0xa2fd('0x11'),_0x10e8a5,_0xa2fd('0x14'));_0x325f35(_0x3a1708['result'][_0xa2fd('0x18')]);}})[_0xa2fd('0x1a')](function(_0x295f04){logger[_0xa2fd('0x16')](_0xa2fd('0x11'),_0x10e8a5,_0x295f04);_0x2e9eb8(_0x295f04);});});}function respondWithStatusCode(_0x58b1d6,_0x40e0f8){_0x40e0f8=_0x40e0f8||0xcc;return function(_0x12d3ed){if(_0x12d3ed){return _0x58b1d6[_0xa2fd('0x1b')](_0x40e0f8);}return _0x58b1d6[_0xa2fd('0x1c')](_0x40e0f8)[_0xa2fd('0x1d')]();};}function respondWithResult(_0x1e111a,_0x2bd046){_0x2bd046=_0x2bd046||0xc8;return function(_0x1cf9e3){if(_0x1cf9e3){return _0x1e111a[_0xa2fd('0x1c')](_0x2bd046)['json'](_0x1cf9e3);}};}function respondWithFilteredResult(_0x3c551d,_0x44b155){return function(_0x457434){if(_0x457434){var _0x584339=typeof _0x44b155['offset']===_0xa2fd('0x1e')&&typeof _0x44b155[_0xa2fd('0x1f')]===_0xa2fd('0x1e');var _0x366d3c=_0x457434['count'];var _0x4b700b=_0x584339?0x0:_0x44b155[_0xa2fd('0x20')];var _0x164366=_0x584339?_0x457434[_0xa2fd('0x21')]:_0x44b155[_0xa2fd('0x20')]+_0x44b155[_0xa2fd('0x1f')];var _0x26b042;if(_0x164366>=_0x366d3c){_0x164366=_0x366d3c;_0x26b042=0xc8;}else{_0x26b042=0xce;}_0x3c551d['status'](_0x26b042);return _0x3c551d[_0xa2fd('0x22')](_0xa2fd('0x23'),_0x4b700b+'-'+_0x164366+'/'+_0x366d3c)[_0xa2fd('0x24')](_0x457434);}return null;};}function saveUpdates(_0x3e9c0b){return function(_0x3288e2){if(_0x3288e2){return _0x3288e2[_0xa2fd('0x25')](_0x3e9c0b)['then'](function(_0x346bfd){return _0x346bfd;});}return null;};}function removeEntity(_0x21c9cd){return function(_0x1c879a){if(_0x1c879a){return _0x1c879a[_0xa2fd('0x26')]()[_0xa2fd('0x27')](function(){var _0x1b4662=_0x1c879a[_0xa2fd('0x28')]({'plain':!![]});var _0x408f73='ChatWebsites';return db[_0xa2fd('0x29')][_0xa2fd('0x26')]({'where':{'type':_0x408f73,'resourceId':_0x1b4662['id']}})[_0xa2fd('0x27')](function(){return _0x1c879a;});})[_0xa2fd('0x27')](function(){_0x21c9cd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54bcba){return function(_0x3bdbfd){if(!_0x3bdbfd){_0x54bcba['sendStatus'](0x194);}return _0x3bdbfd;};}function handleError(_0x5223c0,_0x207d06){_0x207d06=_0x207d06||0x1f4;return function(_0x38016f){logger['error'](_0x38016f[_0xa2fd('0x2a')]);if(_0x38016f[_0xa2fd('0x2b')]){delete _0x38016f[_0xa2fd('0x2b')];}_0x5223c0['status'](_0x207d06)[_0xa2fd('0x2c')](_0x38016f);};}exports[_0xa2fd('0x2d')]=function(_0x1722ef,_0x1007ac){var _0x32d203={'include':[{'model':db[_0xa2fd('0x2e')],'as':_0xa2fd('0x2f')}]},_0x5c54dd={},_0xed54e8={'count':0x0,'rows':[]};var _0x2a0bd1=_[_0xa2fd('0x30')](db['ChatWebsite'][_0xa2fd('0x31')],function(_0x51d8ea){return{'name':_0x51d8ea[_0xa2fd('0x32')],'type':_0x51d8ea[_0xa2fd('0x33')]['key']};});_0x5c54dd[_0xa2fd('0x34')]=_['map'](_0x2a0bd1,'name');_0x5c54dd[_0xa2fd('0x35')]=_[_0xa2fd('0x36')](_0x1722ef['query']);_0x5c54dd[_0xa2fd('0x37')]=_['intersection'](_0x5c54dd[_0xa2fd('0x34')],_0x5c54dd[_0xa2fd('0x35')]);_0x32d203[_0xa2fd('0x38')]=_['intersection'](_0x5c54dd[_0xa2fd('0x34')],qs[_0xa2fd('0x39')](_0x1722ef[_0xa2fd('0x35')]['fields']));_0x32d203[_0xa2fd('0x38')]=_0x32d203[_0xa2fd('0x38')]['length']?_0x32d203[_0xa2fd('0x38')]:_0x5c54dd[_0xa2fd('0x34')];if(!_0x1722ef[_0xa2fd('0x35')][_0xa2fd('0x3a')](_0xa2fd('0x3b'))){_0x32d203['limit']=qs[_0xa2fd('0x1f')](_0x1722ef[_0xa2fd('0x35')][_0xa2fd('0x1f')]);_0x32d203[_0xa2fd('0x20')]=qs['offset'](_0x1722ef[_0xa2fd('0x35')][_0xa2fd('0x20')]);}_0x32d203[_0xa2fd('0x3c')]=qs[_0xa2fd('0x3d')](_0x1722ef[_0xa2fd('0x35')][_0xa2fd('0x3d')]);_0x32d203[_0xa2fd('0x3e')]=qs[_0xa2fd('0x37')](_['pick'](_0x1722ef[_0xa2fd('0x35')],_0x5c54dd['filters']),_0x2a0bd1);if(_0x1722ef['query']['filter']){_0x32d203[_0xa2fd('0x3e')]=_['merge'](_0x32d203[_0xa2fd('0x3e')],{'$or':_['map'](_0x2a0bd1,function(_0x59d3be){if(_0x59d3be[_0xa2fd('0x33')]!==_0xa2fd('0x3f')){var _0x589606={};_0x589606[_0x59d3be['name']]={'$like':'%'+_0x1722ef[_0xa2fd('0x35')][_0xa2fd('0x40')]+'%'};return _0x589606;}})});}_0x32d203=_['merge']({},_0x32d203,_0x1722ef['options']);var _0x6cf505={'where':_0x32d203[_0xa2fd('0x3e')]};return db[_0xa2fd('0x41')][_0xa2fd('0x21')](_0x6cf505)[_0xa2fd('0x27')](function(_0x43475b){_0xed54e8['count']=_0x43475b;if(_0x1722ef[_0xa2fd('0x35')][_0xa2fd('0x42')]){_0x32d203[_0xa2fd('0x43')]=[{'all':!![]}];}return db[_0xa2fd('0x41')][_0xa2fd('0x44')](_0x32d203);})[_0xa2fd('0x27')](function(_0x1beb9c){_0xed54e8[_0xa2fd('0x45')]=_0x1beb9c;return _0xed54e8;})['then'](respondWithFilteredResult(_0x1007ac,_0x32d203))['catch'](handleError(_0x1007ac,null));};exports[_0xa2fd('0x46')]=function(_0x92235f,_0x206091){var _0x39a3ac={'raw':![],'where':{'id':_0x92235f[_0xa2fd('0x47')]['id']},'include':[{'model':db[_0xa2fd('0x2e')],'as':_0xa2fd('0x2f')}]},_0x54522c={};_0x54522c['model']=_[_0xa2fd('0x36')](db['ChatWebsite']['rawAttributes']);_0x54522c[_0xa2fd('0x35')]=_[_0xa2fd('0x36')](_0x92235f[_0xa2fd('0x35')]);_0x54522c['filters']=_[_0xa2fd('0x48')](_0x54522c[_0xa2fd('0x34')],_0x54522c[_0xa2fd('0x35')]);_0x39a3ac[_0xa2fd('0x38')]=_[_0xa2fd('0x48')](_0x54522c['model'],qs['fields'](_0x92235f[_0xa2fd('0x35')][_0xa2fd('0x39')]));_0x39a3ac['attributes']=_0x39a3ac[_0xa2fd('0x38')][_0xa2fd('0x49')]?_0x39a3ac[_0xa2fd('0x38')]:_0x54522c[_0xa2fd('0x34')];if(_0x92235f[_0xa2fd('0x35')]['includeAll']){_0x39a3ac['include']=[{'all':!![]}];}_0x39a3ac=_[_0xa2fd('0x4a')]({},_0x39a3ac,_0x92235f[_0xa2fd('0x4b')]);return db[_0xa2fd('0x41')][_0xa2fd('0x4c')](_0x39a3ac)[_0xa2fd('0x27')](handleEntityNotFound(_0x206091,null))['then'](respondWithResult(_0x206091,null))['catch'](handleError(_0x206091,null));};exports[_0xa2fd('0x4d')]=function(_0x214e9a,_0x4a260c){return db[_0xa2fd('0x41')][_0xa2fd('0x4d')](_0x214e9a[_0xa2fd('0x4e')],{})[_0xa2fd('0x27')](function(_0x1b24fa){var _0x11fe47=_0x214e9a[_0xa2fd('0x4f')][_0xa2fd('0x28')]({'plain':!![]});if(!_0x11fe47)throw new Error(_0xa2fd('0x50'));if(_0x11fe47[_0xa2fd('0x51')]===_0xa2fd('0x4f')){var _0x4fbabb=_0x1b24fa[_0xa2fd('0x28')]({'plain':!![]});var _0x1ee688=_0xa2fd('0x52');return db[_0xa2fd('0x53')][_0xa2fd('0x4c')]({'where':{'name':_0x1ee688,'userProfileId':_0x11fe47[_0xa2fd('0x54')]},'raw':!![]})[_0xa2fd('0x27')](function(_0xf15bff){if(_0xf15bff&&_0xf15bff[_0xa2fd('0x55')]===0x0){return db[_0xa2fd('0x29')][_0xa2fd('0x4d')]({'name':_0x4fbabb[_0xa2fd('0x2b')],'resourceId':_0x4fbabb['id'],'type':_0xf15bff[_0xa2fd('0x2b')],'sectionId':_0xf15bff['id']},{})['then'](function(){return _0x1b24fa;});}else{return _0x1b24fa;}})[_0xa2fd('0x1a')](function(_0x4cc1ab){logger[_0xa2fd('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cc1ab);throw _0x4cc1ab;});}return _0x1b24fa;})[_0xa2fd('0x27')](respondWithResult(_0x4a260c,0xc9))[_0xa2fd('0x1a')](handleError(_0x4a260c,null));};exports[_0xa2fd('0x25')]=function(_0x35b400,_0x20798d){if(_0x35b400['body']['id']){delete _0x35b400[_0xa2fd('0x4e')]['id'];}return db['ChatWebsite'][_0xa2fd('0x4c')]({'where':{'id':_0x35b400['params']['id']},'include':[{'model':db[_0xa2fd('0x2e')],'as':_0xa2fd('0x2f')}]})[_0xa2fd('0x27')](handleEntityNotFound(_0x20798d,null))['then'](saveUpdates(_0x35b400[_0xa2fd('0x4e')],null))[_0xa2fd('0x27')](respondWithResult(_0x20798d,null))[_0xa2fd('0x1a')](handleError(_0x20798d,null));};exports[_0xa2fd('0x26')]=function(_0x4579b9,_0x57513a){return db['ChatWebsite'][_0xa2fd('0x4c')]({'where':{'id':_0x4579b9[_0xa2fd('0x47')]['id']}})['then'](handleEntityNotFound(_0x57513a,null))['then'](removeEntity(_0x57513a,null))[_0xa2fd('0x1a')](handleError(_0x57513a,null));};exports[_0xa2fd('0x56')]=function(_0x374eda,_0x648bf5){return db[_0xa2fd('0x41')][_0xa2fd('0x56')]()['then'](respondWithResult(_0x648bf5,null))[_0xa2fd('0x1a')](handleError(_0x648bf5,null));};exports[_0xa2fd('0x57')]=function(_0x3694a4,_0x2f50ff){if(_0x3694a4[_0xa2fd('0x4e')]['id']){delete _0x3694a4[_0xa2fd('0x4e')]['id'];}return db[_0xa2fd('0x41')][_0xa2fd('0x4c')]({'where':{'id':_0x3694a4[_0xa2fd('0x47')]['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x2f50ff,null))[_0xa2fd('0x27')](function(_0x6648d6){if(_0x6648d6){_0x3694a4['body'][_0xa2fd('0x58')]=_0x6648d6['id'];return db[_0xa2fd('0x59')][_0xa2fd('0x4d')](_0x3694a4['body']);}})[_0xa2fd('0x27')](respondWithResult(_0x2f50ff,null))[_0xa2fd('0x1a')](handleError(_0x2f50ff,null));};exports['getDispositions']=function(_0x43e000,_0x416c13){var _0x36a4c1={'raw':![],'where':{}};var _0xe48bc2={};var _0x3707dc={'count':0x0,'rows':[]};return db[_0xa2fd('0x41')][_0xa2fd('0x5a')]({'where':{'id':_0x43e000[_0xa2fd('0x47')]['id']}})['then'](handleEntityNotFound(_0x416c13,null))[_0xa2fd('0x27')](function(_0x18b1d5){if(_0x18b1d5){_0xe48bc2[_0xa2fd('0x34')]=_[_0xa2fd('0x36')](db['Disposition']['rawAttributes']);_0xe48bc2['query']=_[_0xa2fd('0x36')](_0x43e000[_0xa2fd('0x35')]);_0xe48bc2[_0xa2fd('0x37')]=_['intersection'](_0xe48bc2[_0xa2fd('0x34')],_0xe48bc2[_0xa2fd('0x35')]);_0x36a4c1['attributes']=_[_0xa2fd('0x48')](_0xe48bc2[_0xa2fd('0x34')],qs[_0xa2fd('0x39')](_0x43e000[_0xa2fd('0x35')]['fields']));_0x36a4c1[_0xa2fd('0x38')]=_0x36a4c1[_0xa2fd('0x38')][_0xa2fd('0x49')]?_0x36a4c1[_0xa2fd('0x38')]:_0xe48bc2[_0xa2fd('0x34')];if(!_0x43e000[_0xa2fd('0x35')]['hasOwnProperty'](_0xa2fd('0x3b'))){_0x36a4c1[_0xa2fd('0x1f')]=qs[_0xa2fd('0x1f')](_0x43e000['query']['limit']);_0x36a4c1[_0xa2fd('0x20')]=qs[_0xa2fd('0x20')](_0x43e000[_0xa2fd('0x35')][_0xa2fd('0x20')]);}_0x36a4c1[_0xa2fd('0x3c')]=qs['sort'](_0x43e000['query'][_0xa2fd('0x3d')]);_0x36a4c1['where']=qs[_0xa2fd('0x37')](_[_0xa2fd('0x5b')](_0x43e000[_0xa2fd('0x35')],_0xe48bc2[_0xa2fd('0x37')]));_0x36a4c1[_0xa2fd('0x3e')]['ChatWebsiteId']=_0x18b1d5['id'];if(_0x43e000[_0xa2fd('0x35')][_0xa2fd('0x40')]){_0x36a4c1[_0xa2fd('0x3e')]=_[_0xa2fd('0x4a')](_0x36a4c1['where'],{'$or':_[_0xa2fd('0x30')](_0x36a4c1[_0xa2fd('0x38')],function(_0x2d5f45){var _0xae9735={};_0xae9735[_0x2d5f45]={'$like':'%'+_0x43e000[_0xa2fd('0x35')]['filter']+'%'};return _0xae9735;})});}_0x36a4c1=_[_0xa2fd('0x4a')]({},_0x36a4c1,_0x43e000[_0xa2fd('0x4b')]);return db['Disposition'][_0xa2fd('0x21')]({'where':_0x36a4c1[_0xa2fd('0x3e')]})[_0xa2fd('0x27')](function(_0x12c4d6){_0x3707dc[_0xa2fd('0x21')]=_0x12c4d6;if(_0x43e000[_0xa2fd('0x35')][_0xa2fd('0x42')]){_0x36a4c1['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x36a4c1);})[_0xa2fd('0x27')](function(_0x134082){_0x3707dc[_0xa2fd('0x45')]=_0x134082;return _0x3707dc;});}})[_0xa2fd('0x27')](respondWithFilteredResult(_0x416c13,_0x36a4c1))[_0xa2fd('0x1a')](handleError(_0x416c13,null));};exports[_0xa2fd('0x5c')]=function(_0x1e6918,_0x3cfde4){return db[_0xa2fd('0x41')][_0xa2fd('0x4c')]({'where':{'id':_0x1e6918[_0xa2fd('0x47')]['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x3cfde4,null))[_0xa2fd('0x27')](function(_0x3846e2){if(_0x3846e2){return _0x3846e2['removeDispositions'](_0x1e6918['query'][_0xa2fd('0x5d')]);}})[_0xa2fd('0x27')](respondWithStatusCode(_0x3cfde4,null))['catch'](handleError(_0x3cfde4,null));};exports['addAnswer']=function(_0x31579b,_0x483d4f){if(_0x31579b['body']['id']){delete _0x31579b[_0xa2fd('0x4e')]['id'];}return db[_0xa2fd('0x41')]['find']({'where':{'id':_0x31579b[_0xa2fd('0x47')]['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x483d4f,null))[_0xa2fd('0x27')](function(_0x4595b6){if(_0x4595b6){_0x31579b[_0xa2fd('0x4e')][_0xa2fd('0x58')]=_0x4595b6['id'];return db[_0xa2fd('0x5e')][_0xa2fd('0x4d')](_0x31579b['body']);}})[_0xa2fd('0x27')](respondWithResult(_0x483d4f,null))[_0xa2fd('0x1a')](handleError(_0x483d4f,null));};exports['getAnswers']=function(_0x1f2be7,_0x503ab8){var _0x39979a={'raw':![],'where':{}};var _0x546bde={};var _0x1caabd={'count':0x0,'rows':[]};return db[_0xa2fd('0x41')][_0xa2fd('0x5a')]({'where':{'id':_0x1f2be7['params']['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x503ab8,null))['then'](function(_0x29be44){if(_0x29be44){_0x546bde[_0xa2fd('0x34')]=_[_0xa2fd('0x36')](db[_0xa2fd('0x5e')]['rawAttributes']);_0x546bde[_0xa2fd('0x35')]=_[_0xa2fd('0x36')](_0x1f2be7[_0xa2fd('0x35')]);_0x546bde[_0xa2fd('0x37')]=_[_0xa2fd('0x48')](_0x546bde[_0xa2fd('0x34')],_0x546bde[_0xa2fd('0x35')]);_0x39979a[_0xa2fd('0x38')]=_[_0xa2fd('0x48')](_0x546bde[_0xa2fd('0x34')],qs[_0xa2fd('0x39')](_0x1f2be7[_0xa2fd('0x35')][_0xa2fd('0x39')]));_0x39979a[_0xa2fd('0x38')]=_0x39979a[_0xa2fd('0x38')]['length']?_0x39979a[_0xa2fd('0x38')]:_0x546bde[_0xa2fd('0x34')];if(!_0x1f2be7['query'][_0xa2fd('0x3a')]('nolimit')){_0x39979a[_0xa2fd('0x1f')]=qs[_0xa2fd('0x1f')](_0x1f2be7[_0xa2fd('0x35')][_0xa2fd('0x1f')]);_0x39979a[_0xa2fd('0x20')]=qs['offset'](_0x1f2be7[_0xa2fd('0x35')]['offset']);}_0x39979a[_0xa2fd('0x3c')]=qs[_0xa2fd('0x3d')](_0x1f2be7['query'][_0xa2fd('0x3d')]);_0x39979a[_0xa2fd('0x3e')]=qs[_0xa2fd('0x37')](_[_0xa2fd('0x5b')](_0x1f2be7[_0xa2fd('0x35')],_0x546bde[_0xa2fd('0x37')]));_0x39979a['where'][_0xa2fd('0x58')]=_0x29be44['id'];if(_0x1f2be7[_0xa2fd('0x35')][_0xa2fd('0x40')]){_0x39979a[_0xa2fd('0x3e')]=_[_0xa2fd('0x4a')](_0x39979a[_0xa2fd('0x3e')],{'$or':_[_0xa2fd('0x30')](_0x39979a['attributes'],function(_0x3a840a){var _0x54bc5={};_0x54bc5[_0x3a840a]={'$like':'%'+_0x1f2be7[_0xa2fd('0x35')][_0xa2fd('0x40')]+'%'};return _0x54bc5;})});}_0x39979a=_['merge']({},_0x39979a,_0x1f2be7[_0xa2fd('0x4b')]);return db[_0xa2fd('0x5e')][_0xa2fd('0x21')]({'where':_0x39979a[_0xa2fd('0x3e')]})[_0xa2fd('0x27')](function(_0x26bb94){_0x1caabd['count']=_0x26bb94;if(_0x1f2be7[_0xa2fd('0x35')]['includeAll']){_0x39979a['include']=[{'all':!![]}];}return db[_0xa2fd('0x5e')][_0xa2fd('0x44')](_0x39979a);})[_0xa2fd('0x27')](function(_0xa41fed){_0x1caabd[_0xa2fd('0x45')]=_0xa41fed;return _0x1caabd;});}})[_0xa2fd('0x27')](respondWithFilteredResult(_0x503ab8,_0x39979a))[_0xa2fd('0x1a')](handleError(_0x503ab8,null));};exports[_0xa2fd('0x5f')]=function(_0x4fc4f7,_0x3ae9fe){return db['ChatWebsite'][_0xa2fd('0x4c')]({'where':{'id':_0x4fc4f7[_0xa2fd('0x47')]['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x3ae9fe,null))[_0xa2fd('0x27')](function(_0x5d3f82){if(_0x5d3f82){return _0x5d3f82['removeAnswers'](_0x4fc4f7[_0xa2fd('0x35')][_0xa2fd('0x5d')]);}})[_0xa2fd('0x27')](respondWithStatusCode(_0x3ae9fe,null))[_0xa2fd('0x1a')](handleError(_0x3ae9fe,null));};exports[_0xa2fd('0x60')]=function(_0x1e512c,_0x58ae44){_0x1e512c['body']['sitepic']=_0x1e512c['file'][_0xa2fd('0x61')];return db[_0xa2fd('0x41')][_0xa2fd('0x4c')]({'where':{'id':_0x1e512c['params']['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x58ae44,null))[_0xa2fd('0x27')](saveUpdates(_0x1e512c[_0xa2fd('0x4e')],null))[_0xa2fd('0x27')](respondWithResult(_0x58ae44,null))[_0xa2fd('0x1a')](handleError(_0x58ae44,null));};exports['addAvatar']=function(_0x39c443,_0x38b742){_0x39c443[_0xa2fd('0x4e')]['agentAvatar']=_0x39c443[_0xa2fd('0x62')][_0xa2fd('0x61')];return db[_0xa2fd('0x41')][_0xa2fd('0x4c')]({'where':{'id':_0x39c443[_0xa2fd('0x47')]['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x38b742,null))[_0xa2fd('0x27')](saveUpdates(_0x39c443[_0xa2fd('0x4e')],null))['then'](respondWithResult(_0x38b742,null))['catch'](handleError(_0x38b742,null));};exports[_0xa2fd('0x63')]=function(_0x5e249e,_0x23ccc1){_0x5e249e[_0xa2fd('0x4e')][_0xa2fd('0x64')]=_0x5e249e[_0xa2fd('0x62')][_0xa2fd('0x61')];return db[_0xa2fd('0x41')][_0xa2fd('0x4c')]({'where':{'id':_0x5e249e[_0xa2fd('0x47')]['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x23ccc1,null))[_0xa2fd('0x27')](saveUpdates(_0x5e249e[_0xa2fd('0x4e')],null))[_0xa2fd('0x27')](respondWithResult(_0x23ccc1,null))[_0xa2fd('0x1a')](handleError(_0x23ccc1,null));};exports[_0xa2fd('0x65')]=function(_0x2494c0,_0x53af3b){_0x2494c0[_0xa2fd('0x4e')][_0xa2fd('0x66')]=_0x2494c0['file'][_0xa2fd('0x61')];return db['ChatWebsite'][_0xa2fd('0x4c')]({'where':{'id':_0x2494c0[_0xa2fd('0x47')]['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x53af3b,null))[_0xa2fd('0x27')](saveUpdates(_0x2494c0[_0xa2fd('0x4e')],null))[_0xa2fd('0x27')](respondWithResult(_0x53af3b,null))['catch'](handleError(_0x53af3b,null));};exports[_0xa2fd('0x67')]=function(_0x539cdb,_0x40baa9){var _0x1ccfe0=path[_0xa2fd('0x68')](config[_0xa2fd('0x69')],_0xa2fd('0x6a'));var _0x5b32c7={'where':{'id':_0x539cdb[_0xa2fd('0x47')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x436c86=![];return require(_0xa2fd('0x6b'))[_0xa2fd('0x6c')]()[_0xa2fd('0x27')](function(_0x5418d7){if(_0x5418d7){_0x436c86=_0x5418d7[_0xa2fd('0x6d')];}})[_0xa2fd('0x27')](function(){return db[_0xa2fd('0x41')][_0xa2fd('0x4c')](_0x5b32c7);})['then'](handleEntityNotFound(_0x40baa9,null))[_0xa2fd('0x27')](function(_0x21193c){if(_0x21193c){if(!_[_0xa2fd('0x6e')](_0x21193c[_0xa2fd('0x6f')])){if(fs[_0xa2fd('0x70')](path[_0xa2fd('0x68')](config['root'],_0xa2fd('0x71'),_0x21193c[_0xa2fd('0x6f')]))&&_0x436c86){_0x1ccfe0=path[_0xa2fd('0x68')](config[_0xa2fd('0x69')],_0xa2fd('0x71'),_0x21193c[_0xa2fd('0x6f')]);}}return _0x40baa9[_0xa2fd('0x72')](_0x1ccfe0);}})[_0xa2fd('0x1a')](handleError(_0x40baa9,null));};exports[_0xa2fd('0x73')]=function(_0x59673a,_0x580965){var _0x1e0ac9=path[_0xa2fd('0x68')](config['root'],_0xa2fd('0x74'));var _0x464dab={'where':{'id':_0x59673a[_0xa2fd('0x47')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xa2fd('0x41')]['find'](_0x464dab)[_0xa2fd('0x27')](handleEntityNotFound(_0x580965,null))[_0xa2fd('0x27')](function(_0x3c7d9a){if(_0x3c7d9a){if(!_[_0xa2fd('0x6e')](_0x3c7d9a[_0xa2fd('0x75')])){if(fs['existsSync'](path[_0xa2fd('0x68')](config[_0xa2fd('0x69')],_0xa2fd('0x76'),_0x3c7d9a[_0xa2fd('0x75')]))){_0x1e0ac9=path[_0xa2fd('0x68')](config[_0xa2fd('0x69')],_0xa2fd('0x76'),_0x3c7d9a['agentAvatar']);}}return _0x580965[_0xa2fd('0x72')](_0x1e0ac9);}})[_0xa2fd('0x1a')](handleError(_0x580965,null));};exports[_0xa2fd('0x77')]=function(_0x2396fb,_0x268f18){var _0x3472c1=path[_0xa2fd('0x68')](config[_0xa2fd('0x69')],_0xa2fd('0x78'));var _0x5de0eb={'where':{'id':_0x2396fb[_0xa2fd('0x47')]['id']},'attributes':['id',_0xa2fd('0x64'),_0xa2fd('0x79')],'raw':!![]};return db[_0xa2fd('0x41')][_0xa2fd('0x4c')](_0x5de0eb)[_0xa2fd('0x27')](handleEntityNotFound(_0x268f18,null))['then'](function(_0x33eaae){if(_0x33eaae){if(!_[_0xa2fd('0x6e')](_0x33eaae['customerAvatar'])){if(fs['existsSync'](path[_0xa2fd('0x68')](config[_0xa2fd('0x69')],_0xa2fd('0x76'),_0x33eaae[_0xa2fd('0x64')]))&&_0x33eaae[_0xa2fd('0x79')]){_0x3472c1=path[_0xa2fd('0x68')](config[_0xa2fd('0x69')],_0xa2fd('0x76'),_0x33eaae[_0xa2fd('0x64')]);}}return _0x268f18[_0xa2fd('0x72')](_0x3472c1);}})[_0xa2fd('0x1a')](handleError(_0x268f18,null));};exports[_0xa2fd('0x7a')]=function(_0x5cf326,_0x2f3130){var _0x452893=path[_0xa2fd('0x68')](config[_0xa2fd('0x69')],_0xa2fd('0x7b'));var _0x5cf087={'where':{'id':_0x5cf326[_0xa2fd('0x47')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x5cf087)[_0xa2fd('0x27')](handleEntityNotFound(_0x2f3130,null))[_0xa2fd('0x27')](function(_0x2b422a){if(_0x2b422a){if(!_[_0xa2fd('0x6e')](_0x2b422a[_0xa2fd('0x66')])){if(fs[_0xa2fd('0x70')](path[_0xa2fd('0x68')](config[_0xa2fd('0x69')],'server/files/images/avatars/',_0x2b422a['systemAvatar']))){_0x452893=path[_0xa2fd('0x68')](config[_0xa2fd('0x69')],_0xa2fd('0x76'),_0x2b422a['systemAvatar']);}}return _0x2f3130[_0xa2fd('0x72')](_0x452893);}})[_0xa2fd('0x1a')](handleError(_0x2f3130,null));};exports['notify']=function(_0x18d04f,_0x55e2c4){var _0x536c9c=require(_0xa2fd('0x7c'));var _0x43cef9=new _0x536c9c();var _0x23da2d=_0x43cef9[_0xa2fd('0x7d')](_0x18d04f['headers']['user-agent'])[_0xa2fd('0x7e')]();var _0x225755={'body':_0x18d04f[_0xa2fd('0x4e')],'channel':'chat'};var _0x5b0cee=[];var _0x113462=[];var _0x5c3730={};var _0x49c204=![];return db['CmContact']['describe']()['then'](function(_0x467771){if(!_0x467771){throw new db[(_0xa2fd('0x7f'))][(_0xa2fd('0x80'))](_0xa2fd('0x81'));}_0x5b0cee=_[_0xa2fd('0x82')](_['keys'](_0x467771),[_0xa2fd('0x83'),_0xa2fd('0x84')]);_0x113462=_[_0xa2fd('0x82')](_[_0xa2fd('0x36')](_0x467771),[_0xa2fd('0x83'),'updatedAt',_0xa2fd('0x85'),_0xa2fd('0x86')]);if(_0x18d04f[_0xa2fd('0x4e')]['id']){delete _0x18d04f[_0xa2fd('0x4e')]['id'];}if(_[_0xa2fd('0x6e')](_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0x87')])){throw new db['Sequelize'][(_0xa2fd('0x80'))]('from\x20is\x20mandatory');}if(_[_0xa2fd('0x6e')](_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0x4e')])||_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0x4e')]===''){throw new db[(_0xa2fd('0x7f'))]['ValidationError'](_0xa2fd('0x88'));}if(_['isNil'](_0x18d04f['body'][_0xa2fd('0x89')])){throw new db['Sequelize'][(_0xa2fd('0x80'))](_0xa2fd('0x8a')+_0x113462);}if(!_[_0xa2fd('0x8b')](_0x113462,_0x18d04f['body'][_0xa2fd('0x89')])){throw new db[(_0xa2fd('0x7f'))][(_0xa2fd('0x80'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x113462);}_0x5c3730[_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0x89')]]=_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0x87')];})[_0xa2fd('0x27')](function(){return db[_0xa2fd('0x41')][_0xa2fd('0x4c')]({'where':{'id':_0x18d04f[_0xa2fd('0x47')]['id']},'include':[{'model':db[_0xa2fd('0x8c')],'as':_0xa2fd('0x8d'),'include':[{'model':db[_0xa2fd('0x8e')],'as':_0xa2fd('0x8f'),'where':_0x5c3730,'limit':0x1,'order':[[_0xa2fd('0x84'),_0xa2fd('0x90')]]}]},{'model':db[_0xa2fd('0x91')],'as':'Applications'}]});})[_0xa2fd('0x27')](handleEntityNotFound(_0x55e2c4,null))[_0xa2fd('0x27')](function(_0xdef7c8){if(_0xdef7c8&&_0xdef7c8[_0xa2fd('0x8d')]){_0x225755[_0xa2fd('0x92')]=_0xdef7c8;_0x225755[_0xa2fd('0x93')]=_0xdef7c8['Applications'];_0x225755[_0xa2fd('0x94')]=_0xdef7c8[_0xa2fd('0x8d')];_0x225755[_0xa2fd('0x93')]=_[_0xa2fd('0x95')](_0x225755[_0xa2fd('0x93')],[_0xa2fd('0x96')],[_0xa2fd('0x97')]);if(_0x225755[_0xa2fd('0x92')]['Applications']){delete _0x225755[_0xa2fd('0x92')][_0xa2fd('0x98')];}if(_0x225755[_0xa2fd('0x92')][_0xa2fd('0x8d')]&&_0x225755[_0xa2fd('0x92')][_0xa2fd('0x8d')][_0xa2fd('0x8f')][_0xa2fd('0x49')]){return _0x225755['account'][_0xa2fd('0x8d')][_0xa2fd('0x8f')][0x0];}var _0x5dd5bf=_[_0xa2fd('0x9')](_0x18d04f[_0xa2fd('0x4e')],{'firstName':_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0x87')],'ListId':_0xdef7c8[_0xa2fd('0x86')]});_0x5dd5bf[_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0x89')]]=_0x18d04f['body'][_0xa2fd('0x87')];return db[_0xa2fd('0x8e')][_0xa2fd('0x4d')](_0x5dd5bf,{'fields':_0x5b0cee,'raw':!![]});}})[_0xa2fd('0x27')](handleEntityNotFound(_0x55e2c4,null))[_0xa2fd('0x27')](function(_0x2624a0){_0x225755[_0xa2fd('0x99')]=_0x2624a0;var _0x309550=_0x18d04f['body'][_0xa2fd('0x9a')];if(_0x18d04f['headers']['cf-connecting-ip']){_0x309550=_0x18d04f['headers'][_0xa2fd('0x9b')];}else if(_0x18d04f['headers']['x-forwarded-for']){_0x309550=_['first'](_0x18d04f['headers'][_0xa2fd('0x9c')][_0xa2fd('0x9d')](','));}if(_0x2624a0){var _0x471abf={'ContactId':_0x2624a0['id'],'ChatWebsiteId':_0x18d04f['params']['id'],'from':(_0x2624a0[_0xa2fd('0x9e')]||'')+'\x20'+(_0x2624a0['lastName']||''),'customerIp':_0x309550,'customerPort':_0x18d04f[_0xa2fd('0x9f')][_0xa2fd('0xa0')]?_0x18d04f['headers'][_0xa2fd('0xa0')]:null,'referer':_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0xa1')],'browserName':_0x23da2d['browser'][_0xa2fd('0x2b')]&&_0x23da2d['browser'][_0xa2fd('0xa2')]?util[_0xa2fd('0xa3')](_0xa2fd('0xa4'),_0x23da2d[_0xa2fd('0xa5')]['name'],_0x23da2d[_0xa2fd('0xa5')]['version']):_0xa2fd('0xa6'),'browserVersion':_0x23da2d[_0xa2fd('0xa5')][_0xa2fd('0xa2')]||_0xa2fd('0xa6'),'osName':util[_0xa2fd('0xa3')](_0xa2fd('0xa4'),_0x23da2d['os']['name'],_0x23da2d['os']['version']),'osVersion':_0x23da2d['os'][_0xa2fd('0xa2')],'deviceModel':_0x23da2d[_0xa2fd('0xa7')][_0xa2fd('0x34')]&&_0x23da2d[_0xa2fd('0xa7')]['vendor']?util[_0xa2fd('0xa3')](_0xa2fd('0xa8'),_0x23da2d[_0xa2fd('0xa7')][_0xa2fd('0x34')],_0x23da2d[_0xa2fd('0xa7')]['vendor'],_0x23da2d[_0xa2fd('0xa7')]['type']):null,'deviceVendor':_0x23da2d['device']['vendor'],'deviceType':_0x23da2d[_0xa2fd('0xa7')][_0xa2fd('0x33')],'formData':JSON[_0xa2fd('0x15')](_0x18d04f[_0xa2fd('0x4e')])};var _0x5f92e7={'ChatWebsiteId':_0x18d04f[_0xa2fd('0x47')]['id'],'closed':![]};if(_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0xa9')]){_0x5f92e7[_0xa2fd('0xa9')]=_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0xa9')];return db[_0xa2fd('0xaa')][_0xa2fd('0x4c')]({'where':_0x5f92e7})[_0xa2fd('0x27')](function(_0x3cebe7){if(_0x3cebe7){return[_0x3cebe7,![]];}_0x471abf[_0xa2fd('0xa9')]=_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0xa9')];_0x471abf[_0xa2fd('0xab')]=_0x18d04f[_0xa2fd('0x4e')]['externalUrl'];return db['ChatInteraction'][_0xa2fd('0x4d')](_0x471abf)[_0xa2fd('0x27')](function(_0x189134){return[_0x189134,!![]];});});}_0x5f92e7[_0xa2fd('0xac')]=_0x2624a0['id'];if(_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0xad')]&&_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0xad')]['id']){_0x5f92e7['id']=_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0xad')]['id'];return db[_0xa2fd('0xaa')][_0xa2fd('0x4c')]({'where':_0x5f92e7})[_0xa2fd('0x27')](function(_0x3c809){if(_0x3c809){return[_0x3c809,![]];}return db[_0xa2fd('0xaa')][_0xa2fd('0x4d')](_0x471abf)['then'](function(_0x4dda51){return[_0x4dda51,!![]];});});}return db[_0xa2fd('0xaa')][_0xa2fd('0x4d')](_0x471abf)['then'](function(_0x2941b2){return[_0x2941b2,!![]];});}})['spread'](function(_0x2318dc,_0x18d6d5){if(_0x2318dc){_0x49c204=_0x18d6d5;if(!_0x18d6d5){var _0x2cd824={'from':(_0x225755[_0xa2fd('0x99')]['firstName']||'')+'\x20'+(_0x225755[_0xa2fd('0x99')][_0xa2fd('0xae')]||'')};if(_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0xa9')]&&_0x18d04f['body'][_0xa2fd('0xaf')]&&_0x18d04f['body'][_0xa2fd('0xa9')]!=_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0xaf')]){_0x2cd824[_0xa2fd('0xa9')]=_0x18d04f[_0xa2fd('0x4e')]['messageId'];}return _0x2318dc['update'](_0x2cd824);}else{return _0x2318dc;}}})[_0xa2fd('0x27')](function(_0xe87aa2){_0x225755[_0xa2fd('0xad')]=_0xe87aa2[_0xa2fd('0x28')]({'plain':!![]});_0x225755[_0xa2fd('0xad')][_0xa2fd('0xb0')]=_0x49c204;if(_0x225755[_0xa2fd('0xad')][_0xa2fd('0xb0')]){if(_0x225755[_0xa2fd('0x92')][_0xa2fd('0xb1')]){_0x225755['applications'][_0xa2fd('0xb2')]({'id':0x0,'priority':_0x225755[_0xa2fd('0x93')]['length']+0x1,'app':_0xa2fd('0xb3'),'appdata':'unmanaged','interval':_0xa2fd('0xb4')});}}return db[_0xa2fd('0xb5')][_0xa2fd('0x4d')]({'body':_0x18d04f[_0xa2fd('0x4e')][_0xa2fd('0x4e')],'ChatWebsiteId':_0x18d04f[_0xa2fd('0x47')]['id'],'ChatInteractionId':_0xe87aa2['id'],'direction':'in','ContactId':_0x225755[_0xa2fd('0x99')]['id'],'AttachmentId':_0x18d04f['body'][_0xa2fd('0xb6')]});})['then'](function(_0x4c5b93){_0x225755['message']=_0x4c5b93;if(_0x225755[_0xa2fd('0xad')][_0xa2fd('0xb7')]){return db['User'][_0xa2fd('0x4c')]({'attributes':['id','name'],'where':{'id':_0x225755[_0xa2fd('0xad')]['UserId']}})['then'](function(_0x6ab046){if(_0x6ab046){_0x225755[_0xa2fd('0x93')]['unshift']({'id':0x0,'priority':0x0,'app':_0xa2fd('0xb8'),'appdata':_0x6ab046[_0xa2fd('0x2b')]+','+(_0x225755[_0xa2fd('0x92')]['waitForTheAssignedAgent']||0xa),'interval':_0xa2fd('0xb4')});_0x225755['forcedOwnership']=!![];}return respondWithRpcPromise(_0xa2fd('0xb9'),_0xa2fd('0xba'),_0x225755);});}return respondWithRpcPromise('Start','startRouting',_0x225755);})[_0xa2fd('0x27')](function(_0x24f027){respondWithRpcPromise(_0xa2fd('0xbb'),_0xa2fd('0xbb'),{'event':_0xa2fd('0xbc'),'message':_0x24f027},client9002);return _0x24f027;})[_0xa2fd('0x27')](respondWithResult(_0x55e2c4,null))[_0xa2fd('0x1a')](handleError(_0x55e2c4,null));};exports['offline']=function(_0x39f699,_0x5d3f51){var _0x33c53c,_0x5be760,_0x10ecb1;var _0x5ae3e6=[];var _0x3d4043={};var _0x2a2733=_0x39f699[_0xa2fd('0xbd')]||[];var _0x741b16=[];var _0x23661b;return db[_0xa2fd('0x8e')][_0xa2fd('0x56')]()[_0xa2fd('0x27')](function(_0x1f5240){if(!_0x1f5240){throw new db[(_0xa2fd('0x7f'))][(_0xa2fd('0x80'))]('no\x20available\x20attributes');}_0x5ae3e6=_['difference'](_[_0xa2fd('0x36')](_0x1f5240),[_0xa2fd('0x83'),_0xa2fd('0x84'),'CompanyId','ListId']);if(_0x39f699[_0xa2fd('0x4e')]['id']){delete _0x39f699[_0xa2fd('0x4e')]['id'];}if(_[_0xa2fd('0x6e')](_0x39f699['body'][_0xa2fd('0x87')])){throw _0x5d3f51[_0xa2fd('0x1c')](0x1f4)[_0xa2fd('0x2c')](new db['Sequelize']['ValidationError']('from\x20is\x20mandatory'));}if(_[_0xa2fd('0x6e')](_0x39f699[_0xa2fd('0x4e')][_0xa2fd('0x4e')])||_0x39f699['body'][_0xa2fd('0x4e')]===''){throw _0x5d3f51[_0xa2fd('0x1c')](0x1f4)['send'](new db[(_0xa2fd('0x7f'))][(_0xa2fd('0x80'))](_0xa2fd('0x88')));}if(_['isNil'](_0x39f699[_0xa2fd('0x4e')]['mapKeyOffline'])){throw _0x5d3f51['status'](0x1f4)[_0xa2fd('0x2c')](new db[(_0xa2fd('0x7f'))][(_0xa2fd('0x80'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5ae3e6));}if(!_[_0xa2fd('0x8b')](_0x5ae3e6,_0x39f699['body']['mapKeyOffline'])){throw _0x5d3f51['status'](0x1f4)['send'](new db['Sequelize'][(_0xa2fd('0x80'))](_0xa2fd('0xbe')+_0x5ae3e6));}_0x3d4043[_0x39f699[_0xa2fd('0x4e')][_0xa2fd('0xbf')]]=_0x39f699[_0xa2fd('0x4e')]['from'];})['then'](function(){return db[_0xa2fd('0x41')][_0xa2fd('0x4c')]({'where':{'id':_0x39f699['params']['id']},'include':[{'model':db[_0xa2fd('0x8c')],'as':_0xa2fd('0x8d')},{'model':db[_0xa2fd('0xc0')],'as':_0xa2fd('0xc0')}]});})[_0xa2fd('0x27')](handleEntityNotFound(_0x5d3f51,null))[_0xa2fd('0x27')](function(_0x3c84c0){if(_0x3c84c0&&_0x3c84c0['List']){_0x5be760=_0x3c84c0;var _0xda972=_[_0xa2fd('0x9')](_0x39f699['body'],{'firstName':_0x39f699['body'][_0xa2fd('0x87')],'phone':_0x39f699[_0xa2fd('0x4e')]['from'],'ListId':_0x3c84c0[_0xa2fd('0x86')]});_0xda972[_0x39f699[_0xa2fd('0x4e')][_0xa2fd('0xbf')]]=_0x39f699['body'][_0xa2fd('0x87')];return db['CmContact'][_0xa2fd('0xc1')]({'where':_0x3d4043,'defaults':_0xda972});}})['spread'](function(_0x543659){if(_0x543659){_0x10ecb1=_0x543659;var _0x20e4d5=fs[_0xa2fd('0xc2')](path[_0xa2fd('0x68')](config[_0xa2fd('0x69')],_0xa2fd('0xc3')),_0xa2fd('0xc4'));var _0x60fa7b=ejs[_0xa2fd('0xc5')](_0x20e4d5,{'body':_[_0xa2fd('0xc6')](_0x39f699[_0xa2fd('0x4e')][_0xa2fd('0x4e')]),'bodyTitle':_0x5be760['offlineMessageBody']});return db[_0xa2fd('0xc7')][_0xa2fd('0x4d')]({'body':_0x60fa7b,'plainBody':htmlToText['fromString'](_0x60fa7b),'ContactId':_0x543659['id'],'ChatWebsiteId':_0x5be760['id']});}})['then'](function(_0x79d333){_0x23661b=_0x79d333;if(_0x2a2733['length']){var _0x717a69=_0x2a2733[_0xa2fd('0x30')](function(_0xabc722){return{'name':_0xabc722[_0xa2fd('0xc8')],'basename':_0xabc722[_0xa2fd('0x61')],'type':_0xabc722[_0xa2fd('0xc9')],'ChatOfflineMessageId':_0x79d333['id']};});_0x741b16=_0x717a69[_0xa2fd('0x30')](_0x1ff73c=>{var _0x54f836={'filename':_0x1ff73c[_0xa2fd('0x2b')],'path':path[_0xa2fd('0x68')](config[_0xa2fd('0x69')],_0xa2fd('0xca'),_0xa2fd('0xbd'),_0xa2fd('0xcb'),_0xa2fd('0xcc'),_0x1ff73c[_0xa2fd('0xcd')])};return _0x54f836;});if(!_0x5be760[_0xa2fd('0xce')]){return db['sequelize']['transaction'](function(_0x57c81c){return db[_0xa2fd('0xcf')]['bulkCreate'](_0x717a69,{'transaction':_0x57c81c});});}}})[_0xa2fd('0x27')](function(){if(_0x23661b){_0x33c53c=_0x23661b;return db[_0xa2fd('0xc0')][_0xa2fd('0x5a')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0xa2fd('0xd0'),'raw':!![]}]});}})[_0xa2fd('0x27')](function(_0x3bdb1e){if(_0x3bdb1e&&_0x3bdb1e['Smtp']&&_0x5be760[_0xa2fd('0xd1')]&&_0x5be760[_0xa2fd('0xd2')]){var _0x27d428={'tls':{'rejectUnauthorized':![]}};if(_0x3bdb1e[_0xa2fd('0xd0')][_0xa2fd('0xd3')]){_0x27d428[_0xa2fd('0xd3')]=_0x3bdb1e[_0xa2fd('0xd0')][_0xa2fd('0xd3')];}else{_0x27d428[_0xa2fd('0xd4')]=_0x3bdb1e[_0xa2fd('0xd0')][_0xa2fd('0xd4')];_0x27d428['port']=_0x3bdb1e[_0xa2fd('0xd0')][_0xa2fd('0xd5')];_0x27d428['secure']=_0x3bdb1e[_0xa2fd('0xd0')]['secure'];}if(_0x3bdb1e[_0xa2fd('0xd0')][_0xa2fd('0xd6')]){_0x27d428[_0xa2fd('0xd7')]={'user':_0x3bdb1e[_0xa2fd('0xd0')]['user'],'pass':_0x3bdb1e[_0xa2fd('0xd0')][_0xa2fd('0xd8')]};}return respondWithRpcPromise(_0xa2fd('0xd9'),_0xa2fd('0xda'),{'account':_0x27d428,'message':{'from':util[_0xa2fd('0xa3')]('\x22%s\x22\x20<%s>',_0x3bdb1e[_0xa2fd('0x2b')],_0x3bdb1e[_0xa2fd('0xdb')]||_0x3bdb1e[_0xa2fd('0xd0')][_0xa2fd('0x4f')]),'to':_0x5be760[_0xa2fd('0xd2')],'subject':_0x5be760[_0xa2fd('0xdc')],'html':_0x33c53c['body'],'attachments':_0x741b16}},client9003)[_0xa2fd('0x27')](function(){return _0x33c53c;})[_0xa2fd('0x1a')](function(_0x4f940c){console[_0xa2fd('0x16')](_0x4f940c);});}})[_0xa2fd('0x27')](function(){if(_0x5be760&&_0x5be760[_0xa2fd('0xce')]&&_0x5be760[_0xa2fd('0xdd')]){var _0x35cbbf=[];if(_0x2a2733[_0xa2fd('0x49')]){_0x35cbbf=_0x2a2733[_0xa2fd('0x30')](function(_0x137438){return{'name':_0x137438[_0xa2fd('0xc8')],'basename':_0x137438[_0xa2fd('0x61')],'type':_0x137438[_0xa2fd('0xc9')],'ChatOfflineMessageId':_0x23661b['id']};});}var _0x421e9c;if(!_[_0xa2fd('0x6e')](_0x5be760[_0xa2fd('0xde')])){var _0x4091e2=_[_0xa2fd('0x30')](_0x39f699[_0xa2fd('0x4e')],function(_0x4947d4){return _0x4947d4;});var _0xdc0dbe=_[_0xa2fd('0xdf')](_0x4091e2)[0x0];var _0x385c2e=_[_0xa2fd('0xe0')](_0xdc0dbe,function(_0x198de3){return _0x198de3;});_0x421e9c=_0x385c2e[0x1][_0x5be760[_0xa2fd('0xde')]];}var _0x602294={'from':_0x10ecb1[_0xa2fd('0xdb')],'firstName':_0x10ecb1[_0xa2fd('0x9e')],'lastName':_0x10ecb1[_0xa2fd('0xae')],'mapKey':_0xa2fd('0xdb'),'message':{'from':_0x10ecb1['email'],'to':_0x5be760[_0xa2fd('0xc0')][_0xa2fd('0xdb')],'cc':'','subject':_[_0xa2fd('0x6e')](_0x421e9c)?_0x5be760[_0xa2fd('0xdc')]:_0x421e9c,'messageId':'','sentAt':new Date(),'attach':_0x35cbbf['length'],'attachments':_0x35cbbf,'originChannel':_0xa2fd('0xe1'),'ChatWebsiteId':_0x5be760['id'],'ChatOfflineMessageId':_0x33c53c['id'],'originTo':_0x5be760[_0xa2fd('0xc0')][_0xa2fd('0xdb')]},'body':_0x33c53c[_0xa2fd('0x4e')]};var _0x2e9145={'account':{'id':_0x5be760['MailAccountId']},'body':_0x602294,'log':_0xa2fd('0xe2')};return respondWithRpcPromise(_0xa2fd('0xe2'),_0xa2fd('0xe3'),_0x2e9145,client9001)[_0xa2fd('0x27')](function(){return _0x33c53c;})[_0xa2fd('0x1a')](function(_0x446a7e){console[_0xa2fd('0x16')](_0x446a7e);});}return;})[_0xa2fd('0x27')](function(){if(_0x33c53c){return _0x33c53c;}})[_0xa2fd('0x27')](respondWithResult(_0x5d3f51,null))['catch'](function(_0x4609a6){console[_0xa2fd('0x16')](_0xa2fd('0x1a'),_0x4609a6);for(var _0x302774 of _0x2a2733){var _0x197182=path[_0xa2fd('0x68')](config[_0xa2fd('0x69')],_0xa2fd('0xca'),_0xa2fd('0xbd'),_0xa2fd('0xcb'),_0xa2fd('0xcc'),_0x302774[_0xa2fd('0x61')]);fs_extra[_0xa2fd('0xe4')](_0x197182)[_0xa2fd('0x1a')](function(_0x48f174){console['error']('Could\x20not\x20remove\x20attachment\x20file',_0x197182,_0x48f174);});}});};exports[_0xa2fd('0xe5')]=function(_0x4e9edc,_0x405928){return db[_0xa2fd('0xaa')]['find']({'where':{'id':_0x4e9edc['params']['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x405928,null))[_0xa2fd('0x27')](function(_0x5ec317){if(_0x5ec317){return _0x5ec317[_0xa2fd('0xe5')](_0x4e9edc[_0xa2fd('0x4e')][_0xa2fd('0x5d')],_['omit'](_0x4e9edc[_0xa2fd('0x4e')],[_0xa2fd('0x5d'),'id'])||{});}})[_0xa2fd('0x27')](respondWithResult(_0x405928,null))[_0xa2fd('0x1a')](handleError(_0x405928,null));};exports[_0xa2fd('0xe6')]=function(_0x43c3d8,_0x1fe6e1){var _0x437f61={'raw':![],'where':{}};var _0x31ec22={};var _0x83a034={'count':0x0,'rows':[]};return db[_0xa2fd('0x41')]['findOne']({'where':{'id':_0x43c3d8[_0xa2fd('0x47')]['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x1fe6e1,null))[_0xa2fd('0x27')](function(_0x2ce7fb){if(_0x2ce7fb){_0x31ec22[_0xa2fd('0x34')]=_[_0xa2fd('0x36')](db[_0xa2fd('0xaa')][_0xa2fd('0x31')]);_0x31ec22[_0xa2fd('0x35')]=_[_0xa2fd('0x36')](_0x43c3d8[_0xa2fd('0x35')]);_0x31ec22[_0xa2fd('0x37')]=_[_0xa2fd('0x48')](_0x31ec22[_0xa2fd('0x34')],_0x31ec22['query']);_0x437f61['attributes']=_['intersection'](_0x31ec22[_0xa2fd('0x34')],qs[_0xa2fd('0x39')](_0x43c3d8[_0xa2fd('0x35')]['fields']));_0x437f61[_0xa2fd('0x38')]=_0x437f61[_0xa2fd('0x38')][_0xa2fd('0x49')]?_0x437f61[_0xa2fd('0x38')]:_0x31ec22[_0xa2fd('0x34')];if(!_0x43c3d8[_0xa2fd('0x35')][_0xa2fd('0x3a')]('nolimit')){_0x437f61[_0xa2fd('0x1f')]=qs[_0xa2fd('0x1f')](_0x43c3d8[_0xa2fd('0x35')]['limit']);_0x437f61[_0xa2fd('0x20')]=qs[_0xa2fd('0x20')](_0x43c3d8[_0xa2fd('0x35')][_0xa2fd('0x20')]);}_0x437f61['order']=qs[_0xa2fd('0x3d')](_0x43c3d8[_0xa2fd('0x35')]['sort']);_0x437f61[_0xa2fd('0x3e')]=qs[_0xa2fd('0x37')](_[_0xa2fd('0x5b')](_0x43c3d8[_0xa2fd('0x35')],_0x31ec22[_0xa2fd('0x37')]));_0x437f61['where'][_0xa2fd('0x58')]=_0x2ce7fb['id'];if(_0x43c3d8[_0xa2fd('0x35')][_0xa2fd('0x40')]){_0x437f61[_0xa2fd('0x3e')]=_[_0xa2fd('0x4a')](_0x437f61['where'],{'$or':_['map'](_0x437f61[_0xa2fd('0x38')],function(_0x279dc9){var _0x10ea08={};_0x10ea08[_0x279dc9]={'$like':'%'+_0x43c3d8['query'][_0xa2fd('0x40')]+'%'};return _0x10ea08;})});}_0x437f61=_['merge']({},_0x437f61,_0x43c3d8[_0xa2fd('0x4b')]);return db[_0xa2fd('0xaa')][_0xa2fd('0x21')]({'where':_0x437f61['where']})[_0xa2fd('0x27')](function(_0x3c1487){_0x83a034[_0xa2fd('0x21')]=_0x3c1487;if(_0x43c3d8[_0xa2fd('0x35')][_0xa2fd('0x42')]){_0x437f61[_0xa2fd('0x43')]=[{'model':db[_0xa2fd('0x8e')],'as':_0xa2fd('0xe7'),'required':![]},{'model':db['User'],'as':_0xa2fd('0xe8'),'attributes':[_0xa2fd('0x2b'),_0xa2fd('0xe9'),'internal'],'required':![]},{'model':db[_0xa2fd('0xea')],'as':_0xa2fd('0xeb'),'attributes':['id',_0xa2fd('0x2b'),_0xa2fd('0xec')],'where':_0x43c3d8[_0xa2fd('0x35')][_0xa2fd('0xed')]?{'id':_0x43c3d8[_0xa2fd('0x35')]['tag']}:undefined,'required':_0x43c3d8[_0xa2fd('0x35')]['tag']?!![]:![]}];}return db[_0xa2fd('0xaa')]['findAll'](_0x437f61);})['then'](function(_0x537286){_0x83a034[_0xa2fd('0x45')]=_0x537286;return _0x83a034;});}})[_0xa2fd('0x27')](respondWithFilteredResult(_0x1fe6e1,_0x437f61))[_0xa2fd('0x1a')](handleError(_0x1fe6e1,null));};function iftimePromise(_0x1a88ff,_0x4ecaf1){return respondWithRpcPromise('Command',_0xa2fd('0xee'),{'command':_0x4ecaf1['timezone']?util[_0xa2fd('0xa3')](_0xa2fd('0xef'),_0x1a88ff[_0xa2fd('0xf0')],_0x4ecaf1[_0xa2fd('0xf1')]):util[_0xa2fd('0xa3')](_0xa2fd('0xf2'),_0x1a88ff['interval'])},client9002)[_0xa2fd('0x27')](function(_0x54c061){var _0x19dec9=_0x54c061&&_0x54c061['indexOf'](_0xa2fd('0xf3'))>=0x0?!![]:![];logger['info'](_0xa2fd('0xf4'),_0x4ecaf1['id'],_0x1a88ff['id'],_0x1a88ff[_0xa2fd('0xf0')],_0x19dec9?_0xa2fd('0xf5'):'OFFLINE',_0x4ecaf1[_0xa2fd('0xf1')]?_0x4ecaf1['timezone']:_0xa2fd('0xf6'));return _0x19dec9;})[_0xa2fd('0x1a')](function(_0x32fee9){logger[_0xa2fd('0x16')](_0xa2fd('0xf4'),_0x4ecaf1['id'],_0x1a88ff['id'],_0x1a88ff[_0xa2fd('0xf0')],util['inspect'](_0x32fee9,{'showHidden':![],'depth':null}),_0x4ecaf1[_0xa2fd('0xf1')]?_0x4ecaf1[_0xa2fd('0xf1')]:_0xa2fd('0xf6'));return![];});}exports[_0xa2fd('0xee')]=function(_0x3f7a0a,_0x57d67b){var _0x1315e8=0x0;var _0x45e5f7=0x0;var _0x448eef=![];var _0x548054;var _0x5e2976;return db[_0xa2fd('0x41')][_0xa2fd('0x4c')]({'where':{'id':_0x3f7a0a[_0xa2fd('0x47')]['id']},'include':[{'model':db['Interval'],'as':_0xa2fd('0xf7'),'include':[{'model':db['Interval'],'as':_0xa2fd('0xf8'),'attributes':['id',_0xa2fd('0xf0')],'raw':!![]}]}]})[_0xa2fd('0x27')](handleEntityNotFound(_0x57d67b,null))[_0xa2fd('0x27')](function(_0x78f4c8){if(_0x78f4c8){_0x548054=_0x78f4c8;return _0x78f4c8[_0xa2fd('0xf9')]({'raw':!![]});}})[_0xa2fd('0x27')](function(_0x450590){if(_0x548054){if(_0x450590){_0x5e2976=_0x450590;}}return require(_0xa2fd('0x6b'))[_0xa2fd('0x6c')]();})['then'](function(_0x45f3b7){if(_0x45f3b7){_0x45e5f7=_0x45f3b7[_0xa2fd('0xfa')];_0x448eef=_0x45f3b7[_0xa2fd('0x6d')];}})[_0xa2fd('0x27')](function(){return db[_0xa2fd('0xaa')][_0xa2fd('0x21')]({'where':{'closed':![]}});})['then'](function(_0xd42543){_0x1315e8=_0xd42543;if(_0x45e5f7&&_0xd42543>_0x45e5f7){return db['License'][_0xa2fd('0x5a')]({'where':{'id':0x1}})[_0xa2fd('0x27')](function(_0x384932){if(_0x384932){_0x384932['increment'](_0xa2fd('0xfb'));}});}})[_0xa2fd('0x27')](function(){if(_0x548054[_0xa2fd('0xf7')]&&_0x548054[_0xa2fd('0xf7')][_0xa2fd('0xf8')]){var _0x30f3a8=[];for(var _0x2ec369=0x0;_0x2ec369<_0x548054[_0xa2fd('0xf7')][_0xa2fd('0xf8')][_0xa2fd('0x49')];_0x2ec369++){var _0x4b6f8f=_0x548054[_0xa2fd('0xf7')][_0xa2fd('0xf8')][_0x2ec369][_0xa2fd('0x28')]({'plain':!![]});_0x30f3a8['push'](iftimePromise(_0x4b6f8f,_0x548054));}return BPromise[_0xa2fd('0xfc')](_0x30f3a8)[_0xa2fd('0x27')](function(_0x3d8f0b){return _[_0xa2fd('0xfd')](_0x3d8f0b);});}else{return!![];}})[_0xa2fd('0x27')](function(_0x570324){var _0x2f0efa=fs[_0xa2fd('0xc2')](path[_0xa2fd('0x68')](config['root'],_0xa2fd('0xfe')),'utf8');var _0x2adc87={'remote':_0x548054[_0xa2fd('0xff')],'query':querystring[_0xa2fd('0x15')](_[_0xa2fd('0x4a')](_0x548054[_0xa2fd('0x28')]({'plain':!![]}),{'customerIp':_0x3f7a0a['headers'][_0xa2fd('0x9c')]||_0x3f7a0a[_0xa2fd('0x9f')][_0xa2fd('0x100')]||_0x3f7a0a[_0xa2fd('0x101')][_0xa2fd('0x102')]||_0x3f7a0a['ip'],'referer':_0x3f7a0a[_0xa2fd('0x9f')]['referer'],'openedInteractions':_0x1315e8,'maxInteractions':_0x45e5f7,'virtual':_0x448eef[_0xa2fd('0xfa')],'online':_0x570324,'custom':_0x448eef}))[_0xa2fd('0x103')](/'/g,'\x5c\x27')};_0x57d67b['send'](ejs[_0xa2fd('0xc5')](Mustache['render'](_0x2f0efa,_0x2adc87),{'proactiveActions':_0x5e2976,'alignment':_0x548054['alignment'],'verticalAlignment':_0x548054[_0xa2fd('0x104')],'div_color':_0x548054['color'],'labelText':_0x548054[_0xa2fd('0x105')],'text_color':_0x548054['textColor'],'button_color':_0x548054['color_button'],'background_color':_0x548054[_0xa2fd('0x106')],'hideWhenOffline':_0x548054['hideWhenOffline'],'interval':_0x548054[_0xa2fd('0x107')]}));})['catch'](handleError(_0x57d67b,null));};exports[_0xa2fd('0x108')]=function(_0x24a47c,_0x2b6d2a){var _0x93610b=_0x24a47c[_0xa2fd('0x47')]['id'];var _0x3d4cec=_0x24a47c[_0xa2fd('0x4e')];var _0x5a970a=0xc8;var _0x360052=null;return db[_0xa2fd('0x109')][_0xa2fd('0x10a')]({'isolationLevel':db['sequelize'][_0xa2fd('0x10b')][_0xa2fd('0x10c')][_0xa2fd('0x10d')]},function(_0x49a1ea){return db['ChatWebsite'][_0xa2fd('0x5a')]({'where':{'id':_0x93610b},'transaction':_0x49a1ea})['then'](function(_0x2775b9){if(_0x2775b9){return db[_0xa2fd('0x91')][_0xa2fd('0x26')]({'where':{'ChatWebsiteId':_0x93610b},'transaction':_0x49a1ea})[_0xa2fd('0x27')](function(){var _0x45bd99=_[_0xa2fd('0x30')](_0x3d4cec,function(_0xc95a2d){_0xc95a2d[_0xa2fd('0x58')]=_0x93610b;return _0xc95a2d;});return db[_0xa2fd('0x91')][_0xa2fd('0x10e')](_0x45bd99,{'transaction':_0x49a1ea});});}else{_0x5a970a=0x194;_0x360052=[];}});})['then'](function(){if(_0x5a970a!==0x194){return db[_0xa2fd('0x91')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x93610b},'order':_0xa2fd('0x96')})['then'](function(_0x190498){_0x360052=_0x190498;});}})[_0xa2fd('0x1a')](function(_0x548ed5){_0x5a970a=0x1f4;logger[_0xa2fd('0x16')](_0x548ed5[_0xa2fd('0x2a')]);if(_0x548ed5['name']){delete _0x548ed5['name'];}_0x360052=_0x548ed5;})['finally'](function(){if(_0x360052===null){_0x2b6d2a[_0xa2fd('0x1b')](_0x5a970a);}else{if(_0x5a970a===0x1f4){_0x2b6d2a['status'](_0x5a970a)[_0xa2fd('0x2c')](_0x360052);}else{_0x2b6d2a[_0xa2fd('0x1c')](_0x5a970a)[_0xa2fd('0x24')](_0x360052);}}});};exports['getApplications']=function(_0xff784d,_0x1e9088){var _0x5d5822={};var _0x3b496a={};var _0x5e6c87;var _0x2177dc;return db[_0xa2fd('0x41')]['findOne']({'where':{'id':_0xff784d['params']['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x1e9088,null))[_0xa2fd('0x27')](function(_0x205657){if(_0x205657){_0x5e6c87=_0x205657;_0x3b496a['model']=_[_0xa2fd('0x36')](db['ChatApplication'][_0xa2fd('0x31')]);_0x3b496a[_0xa2fd('0x35')]=_[_0xa2fd('0x36')](_0xff784d['query']);_0x3b496a[_0xa2fd('0x37')]=_[_0xa2fd('0x48')](_0x3b496a[_0xa2fd('0x34')],_0x3b496a[_0xa2fd('0x35')]);_0x5d5822['attributes']=_[_0xa2fd('0x48')](_0x3b496a[_0xa2fd('0x34')],qs[_0xa2fd('0x39')](_0xff784d[_0xa2fd('0x35')][_0xa2fd('0x39')]));_0x5d5822[_0xa2fd('0x38')]=_0x5d5822[_0xa2fd('0x38')][_0xa2fd('0x49')]?_0x5d5822[_0xa2fd('0x38')]:_0x3b496a[_0xa2fd('0x34')];_0x5d5822[_0xa2fd('0x3c')]=qs[_0xa2fd('0x3d')](_0xff784d[_0xa2fd('0x35')][_0xa2fd('0x3d')]);_0x5d5822[_0xa2fd('0x3e')]=qs[_0xa2fd('0x37')](_[_0xa2fd('0x5b')](_0xff784d[_0xa2fd('0x35')],_0x3b496a[_0xa2fd('0x37')]));if(_0xff784d[_0xa2fd('0x35')][_0xa2fd('0x40')]){_0x5d5822[_0xa2fd('0x3e')]=_[_0xa2fd('0x4a')](_0x5d5822[_0xa2fd('0x3e')],{'$or':_[_0xa2fd('0x30')](_0x5d5822[_0xa2fd('0x38')],function(_0x44d167){var _0x11f25d={};_0x11f25d[_0x44d167]={'$like':'%'+_0xff784d[_0xa2fd('0x35')][_0xa2fd('0x40')]+'%'};return _0x11f25d;})});}_0x5d5822=_[_0xa2fd('0x4a')]({},_0x5d5822,_0xff784d[_0xa2fd('0x4b')]);return _0x5e6c87[_0xa2fd('0x10f')](_0x5d5822);}})['then'](function(_0x415b6a){if(_0x415b6a){_0x2177dc=_0x415b6a[_0xa2fd('0x49')];if(!_0xff784d[_0xa2fd('0x35')][_0xa2fd('0x3a')](_0xa2fd('0x3b'))){_0x5d5822[_0xa2fd('0x1f')]=qs[_0xa2fd('0x1f')](_0xff784d[_0xa2fd('0x35')][_0xa2fd('0x1f')]);_0x5d5822['offset']=qs[_0xa2fd('0x20')](_0xff784d['query'][_0xa2fd('0x20')]);}return _0x5e6c87[_0xa2fd('0x10f')](_0x5d5822);}})['then'](function(_0x550c4a){if(_0x550c4a){return _0x550c4a?{'count':_0x2177dc,'rows':_0x550c4a}:null;}})[_0xa2fd('0x27')](respondWithResult(_0x1e9088,null))['catch'](handleError(_0x1e9088,null));};exports[_0xa2fd('0x110')]=function(_0x382c5d,_0x4eb43e){return db[_0xa2fd('0x111')]['find']({'where':{'id':_0x382c5d[_0xa2fd('0x47')]['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x4eb43e,null))['then'](function(_0x534145){if(_0x534145){return _0x534145[_0xa2fd('0x110')](_0x382c5d['body'][_0xa2fd('0x5d')],_[_0xa2fd('0x112')](_0x382c5d[_0xa2fd('0x4e')],[_0xa2fd('0x5d'),'id'])||{});}})[_0xa2fd('0x27')](respondWithResult(_0x4eb43e,null))[_0xa2fd('0x1a')](handleError(_0x4eb43e,null));};exports[_0xa2fd('0xf9')]=function(_0x48bae5,_0x43c5d4){var _0x30c956={};var _0x2e2c10={};var _0x3901e4;var _0x144b73;return db['ChatWebsite']['findOne']({'where':{'id':_0x48bae5[_0xa2fd('0x47')]['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x43c5d4,null))[_0xa2fd('0x27')](function(_0x47a766){if(_0x47a766){_0x3901e4=_0x47a766;_0x2e2c10[_0xa2fd('0x34')]=_['keys'](db[_0xa2fd('0x113')][_0xa2fd('0x31')]);_0x2e2c10[_0xa2fd('0x35')]=_['keys'](_0x48bae5[_0xa2fd('0x35')]);_0x2e2c10[_0xa2fd('0x37')]=_[_0xa2fd('0x48')](_0x2e2c10[_0xa2fd('0x34')],_0x2e2c10[_0xa2fd('0x35')]);_0x30c956[_0xa2fd('0x38')]=_[_0xa2fd('0x48')](_0x2e2c10[_0xa2fd('0x34')],qs[_0xa2fd('0x39')](_0x48bae5[_0xa2fd('0x35')]['fields']));_0x30c956[_0xa2fd('0x38')]=_0x30c956['attributes'][_0xa2fd('0x49')]?_0x30c956[_0xa2fd('0x38')]:_0x2e2c10[_0xa2fd('0x34')];_0x30c956['order']=qs[_0xa2fd('0x3d')](_0x48bae5[_0xa2fd('0x35')]['sort']);_0x30c956[_0xa2fd('0x3e')]=qs[_0xa2fd('0x37')](_[_0xa2fd('0x5b')](_0x48bae5[_0xa2fd('0x35')],_0x2e2c10[_0xa2fd('0x37')]));if(_0x48bae5['query'][_0xa2fd('0x40')]){_0x30c956[_0xa2fd('0x3e')]=_[_0xa2fd('0x4a')](_0x30c956[_0xa2fd('0x3e')],{'$or':_['map'](_0x30c956['attributes'],function(_0x30bfcf){var _0x390e09={};_0x390e09[_0x30bfcf]={'$like':'%'+_0x48bae5[_0xa2fd('0x35')][_0xa2fd('0x40')]+'%'};return _0x390e09;})});}_0x30c956=_[_0xa2fd('0x4a')]({},_0x30c956,_0x48bae5[_0xa2fd('0x4b')]);return _0x3901e4['getProactiveActions'](_0x30c956);}})[_0xa2fd('0x27')](function(_0x2c754d){if(_0x2c754d){_0x144b73=_0x2c754d[_0xa2fd('0x49')];if(!_0x48bae5[_0xa2fd('0x35')]['hasOwnProperty'](_0xa2fd('0x3b'))){_0x30c956[_0xa2fd('0x1f')]=qs['limit'](_0x48bae5[_0xa2fd('0x35')][_0xa2fd('0x1f')]);_0x30c956['offset']=qs[_0xa2fd('0x20')](_0x48bae5[_0xa2fd('0x35')][_0xa2fd('0x20')]);}return _0x3901e4[_0xa2fd('0xf9')](_0x30c956);}})[_0xa2fd('0x27')](function(_0x284fd7){if(_0x284fd7){return _0x284fd7?{'count':_0x144b73,'rows':_0x284fd7}:null;}})[_0xa2fd('0x27')](respondWithResult(_0x43c5d4,null))['catch'](handleError(_0x43c5d4,null));};exports[_0xa2fd('0x114')]=function(_0xbad263,_0x177d3b){var _0x54cc4a=_0xbad263[_0xa2fd('0x35')][_0xa2fd('0x115')]==='false'?_0xa2fd('0x116'):_0xa2fd('0x117');return db['ChatWebsite']['find']({'attributes':['id',_0x54cc4a],'where':{'id':_0xbad263[_0xa2fd('0x47')]['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x177d3b,null))[_0xa2fd('0x27')](function(_0x363d98){if(_0x363d98){var _0x5ef81b=_0x363d98[_0x54cc4a];var _0x306c90=_0x5ef81b&&_0x5ef81b[_0xa2fd('0x118')]?_0x5ef81b[_0xa2fd('0x118')]:[];_0x177d3b['send']({'fromKey':_[_0xa2fd('0x6e')](_0x5ef81b[_0xa2fd('0x119')])?undefined:_0x5ef81b[_0xa2fd('0x119')],'count':_0x306c90[_0xa2fd('0x49')],'rows':_0x306c90});}})[_0xa2fd('0x1a')](handleError(_0x177d3b,null));};exports[_0xa2fd('0x11a')]=function(_0x2f5101,_0x25c50b){var _0x4c4dfc={'raw':![],'where':{}};var _0x58c75a={};var _0x5a596f={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x2f5101[_0xa2fd('0x47')]['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x25c50b,null))[_0xa2fd('0x27')](function(_0x54b804){if(_0x54b804){_0x58c75a[_0xa2fd('0x34')]=_[_0xa2fd('0x36')](db[_0xa2fd('0xc7')][_0xa2fd('0x31')]);_0x58c75a['query']=_[_0xa2fd('0x36')](_0x2f5101[_0xa2fd('0x35')]);_0x58c75a[_0xa2fd('0x37')]=_[_0xa2fd('0x48')](_0x58c75a[_0xa2fd('0x34')],_0x58c75a['query']);_0x4c4dfc[_0xa2fd('0x38')]=_[_0xa2fd('0x48')](_0x58c75a[_0xa2fd('0x34')],qs['fields'](_0x2f5101[_0xa2fd('0x35')][_0xa2fd('0x39')]));_0x4c4dfc['attributes']=_0x4c4dfc[_0xa2fd('0x38')][_0xa2fd('0x49')]?_0x4c4dfc[_0xa2fd('0x38')]:_0x58c75a[_0xa2fd('0x34')];if(!_0x2f5101[_0xa2fd('0x35')][_0xa2fd('0x3a')](_0xa2fd('0x3b'))){_0x4c4dfc[_0xa2fd('0x1f')]=qs[_0xa2fd('0x1f')](_0x2f5101['query'][_0xa2fd('0x1f')]);_0x4c4dfc['offset']=qs[_0xa2fd('0x20')](_0x2f5101['query']['offset']);}_0x4c4dfc[_0xa2fd('0x3c')]=qs['sort'](_0x2f5101[_0xa2fd('0x35')][_0xa2fd('0x3d')]);_0x4c4dfc['where']=qs[_0xa2fd('0x37')](_['pick'](_0x2f5101['query'],_0x58c75a['filters']));_0x4c4dfc[_0xa2fd('0x3e')][_0xa2fd('0x58')]=_0x54b804['id'];if(_0x2f5101[_0xa2fd('0x35')]['filter']){_0x4c4dfc[_0xa2fd('0x3e')]=_[_0xa2fd('0x4a')](_0x4c4dfc['where'],{'$or':_[_0xa2fd('0x30')](_0x4c4dfc[_0xa2fd('0x38')],function(_0x2b8b2d){var _0x15ac14={};_0x15ac14[_0x2b8b2d]={'$like':'%'+_0x2f5101[_0xa2fd('0x35')]['filter']+'%'};return _0x15ac14;})});}_0x4c4dfc=_[_0xa2fd('0x4a')]({},_0x4c4dfc,_0x2f5101[_0xa2fd('0x4b')]);return db[_0xa2fd('0xc7')]['count']({'where':_0x4c4dfc['where']})[_0xa2fd('0x27')](function(_0x15ceff){_0x5a596f[_0xa2fd('0x21')]=_0x15ceff;if(_0x2f5101[_0xa2fd('0x35')]['includeAll']){_0x4c4dfc[_0xa2fd('0x43')]=[{'all':!![]}];}else{_0x4c4dfc['include']=[{'model':db['CmContact'],'as':_0xa2fd('0xe7'),'required':![]},{'model':db[_0xa2fd('0xcf')],'as':_0xa2fd('0x11b'),'required':![]}];}return db[_0xa2fd('0xc7')][_0xa2fd('0x44')](_0x4c4dfc);})[_0xa2fd('0x27')](function(_0x4edc71){_0x5a596f['rows']=_0x4edc71;return _0x5a596f;});}})[_0xa2fd('0x27')](respondWithFilteredResult(_0x25c50b,_0x4c4dfc))[_0xa2fd('0x1a')](handleError(_0x25c50b,null));};exports[_0xa2fd('0x11c')]=function(_0x59a4f0,_0x558cb2){return db[_0xa2fd('0x41')][_0xa2fd('0x4c')]({'where':{'id':_0x59a4f0['params']['id']}})['then'](handleEntityNotFound(_0x558cb2,null))[_0xa2fd('0x27')](function(_0x154321){if(_0x154321){return _0x154321[_0xa2fd('0x11c')](_0x59a4f0[_0xa2fd('0x4e')][_0xa2fd('0x5d')],_[_0xa2fd('0x112')](_0x59a4f0[_0xa2fd('0x4e')],[_0xa2fd('0x5d'),'id'])||{})[_0xa2fd('0x11d')](function(_0x31fadb){for(var _0x278d33=0x0;_0x278d33<_0x59a4f0['body']['ids']['length'];_0x278d33+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x59a4f0[_0xa2fd('0x4e')]['ids'][_0x278d33]),'ChatWebsiteId':Number(_0x59a4f0['params']['id'])});}return _0x31fadb;});}})['then'](respondWithResult(_0x558cb2,null))['catch'](handleError(_0x558cb2,null));};exports[_0xa2fd('0x11e')]=function(_0xc912c0,_0x33cf0a){return db[_0xa2fd('0x41')][_0xa2fd('0x4c')]({'where':{'id':_0xc912c0[_0xa2fd('0x47')]['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x33cf0a,null))['then'](function(_0x593817){if(_0x593817){return _0x593817[_0xa2fd('0x11e')](_0xc912c0[_0xa2fd('0x35')]['ids'])[_0xa2fd('0x27')](function(){if(_[_0xa2fd('0x11f')](_0xc912c0[_0xa2fd('0x35')]['ids'])){for(var _0x58142d=0x0;_0x58142d<_0xc912c0[_0xa2fd('0x35')]['ids'][_0xa2fd('0x49')];_0x58142d+=0x1){socket[_0xa2fd('0x120')](_0xa2fd('0x121'),{'UserId':Number(_0xc912c0[_0xa2fd('0x35')][_0xa2fd('0x5d')][_0x58142d]),'ChatWebsiteId':Number(_0xc912c0['params']['id'])});}}else{socket[_0xa2fd('0x120')](_0xa2fd('0x121'),{'UserId':Number(_0xc912c0[_0xa2fd('0x35')][_0xa2fd('0x5d')]),'ChatWebsiteId':Number(_0xc912c0[_0xa2fd('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x33cf0a,null))[_0xa2fd('0x1a')](handleError(_0x33cf0a,null));};exports['getAgents']=function(_0x5bda47,_0x50148d){var _0x4bfb79={};var _0x302dc2={};var _0xb663a7;var _0x2f5525;return db[_0xa2fd('0x41')][_0xa2fd('0x5a')]({'where':{'id':_0x5bda47['params']['id']}})[_0xa2fd('0x27')](handleEntityNotFound(_0x50148d,null))[_0xa2fd('0x27')](function(_0x4711be){if(_0x4711be){_0xb663a7=_0x4711be;_0x302dc2[_0xa2fd('0x34')]=_[_0xa2fd('0x36')](db[_0xa2fd('0x122')][_0xa2fd('0x31')]);_0x302dc2['query']=_[_0xa2fd('0x36')](_0x5bda47[_0xa2fd('0x35')]);_0x302dc2[_0xa2fd('0x37')]=_[_0xa2fd('0x48')](_0x302dc2[_0xa2fd('0x34')],_0x302dc2[_0xa2fd('0x35')]);_0x4bfb79['attributes']=_[_0xa2fd('0x48')](_0x302dc2[_0xa2fd('0x34')],qs['fields'](_0x5bda47['query'][_0xa2fd('0x39')]));_0x4bfb79['attributes']=_0x4bfb79[_0xa2fd('0x38')]['length']?_0x4bfb79[_0xa2fd('0x38')]:_0x302dc2[_0xa2fd('0x34')];_0x4bfb79[_0xa2fd('0x3c')]=qs[_0xa2fd('0x3d')](_0x5bda47['query'][_0xa2fd('0x3d')]);_0x4bfb79[_0xa2fd('0x3e')]=qs['filters'](_[_0xa2fd('0x5b')](_0x5bda47['query'],_0x302dc2[_0xa2fd('0x37')]));if(_0x5bda47[_0xa2fd('0x35')]['filter']){_0x4bfb79[_0xa2fd('0x3e')]=_['merge'](_0x4bfb79[_0xa2fd('0x3e')],{'$or':_[_0xa2fd('0x30')](_0x4bfb79[_0xa2fd('0x38')],function(_0x287d43){var _0x1c712d={};_0x1c712d[_0x287d43]={'$like':'%'+_0x5bda47[_0xa2fd('0x35')][_0xa2fd('0x40')]+'%'};return _0x1c712d;})});}_0x4bfb79=_[_0xa2fd('0x4a')]({},_0x4bfb79,_0x5bda47[_0xa2fd('0x4b')]);return _0xb663a7[_0xa2fd('0x123')](_0x4bfb79);}})[_0xa2fd('0x27')](function(_0xf38dd9){if(_0xf38dd9){_0x2f5525=_0xf38dd9[_0xa2fd('0x49')];if(!_0x5bda47[_0xa2fd('0x35')][_0xa2fd('0x3a')](_0xa2fd('0x3b'))){_0x4bfb79[_0xa2fd('0x1f')]=qs['limit'](_0x5bda47[_0xa2fd('0x35')][_0xa2fd('0x1f')]);_0x4bfb79[_0xa2fd('0x20')]=qs['offset'](_0x5bda47[_0xa2fd('0x35')]['offset']);}return _0xb663a7[_0xa2fd('0x123')](_0x4bfb79);}})[_0xa2fd('0x27')](function(_0x13c47e){if(_0x13c47e){return _0x13c47e?{'count':_0x2f5525,'rows':_0x13c47e}:null;}})['then'](respondWithResult(_0x50148d,null))[_0xa2fd('0x1a')](handleError(_0x50148d,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index a28cb1e..1599b82 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 _0xcb57=['events','../../mysqldb','setMaxListeners','update','emit','hook','exports'];(function(_0x4f3bae,_0x41ce56){var _0x36fc37=function(_0x34469b){while(--_0x34469b){_0x4f3bae['push'](_0x4f3bae['shift']());}};_0x36fc37(++_0x41ce56);}(_0xcb57,0xa1));var _0x7cb5=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xcb57[_0x2dadb9];return _0x2f0097;};'use strict';var EventEmitter=require(_0x7cb5('0x0'));var ChatWebsite=require(_0x7cb5('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7cb5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7cb5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x33e1e6){return function(_0x1b1ef7,_0x4850d6,_0x3dc74f){ChatWebsiteEvents[_0x7cb5('0x4')](_0x33e1e6+':'+_0x1b1ef7['id'],_0x1b1ef7);ChatWebsiteEvents[_0x7cb5('0x4')](_0x33e1e6,_0x1b1ef7);_0x3dc74f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x7cb5('0x5')](e,emitEvent(event));}}module[_0x7cb5('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0xd67b=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x37adf7,_0x15b876){var _0x2d881c=function(_0x44e082){while(--_0x44e082){_0x37adf7['push'](_0x37adf7['shift']());}};_0x2d881c(++_0x15b876);}(_0xd67b,0x133));var _0xbd67=function(_0x26bdcc,_0xf45b3e){_0x26bdcc=_0x26bdcc-0x0;var _0x14a927=_0xd67b[_0x26bdcc];return _0x14a927;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xbd67('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xbd67('0x1')](0x0);var events={'afterCreate':_0xbd67('0x2'),'afterUpdate':_0xbd67('0x3'),'afterDestroy':'remove'};function emitEvent(_0x40e384){return function(_0x50da5a,_0x1bf96,_0x5a827b){ChatWebsiteEvents[_0xbd67('0x4')](_0x40e384+':'+_0x50da5a['id'],_0x50da5a);ChatWebsiteEvents[_0xbd67('0x4')](_0x40e384,_0x50da5a);_0x5a827b(null);};}for(var e in events){if(events[_0xbd67('0x5')](e)){var event=events[e];ChatWebsite[_0xbd67('0x6')](e,emitEvent(event));}}module[_0xbd67('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 7b096e5..2e4f52f 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 _0x1dab=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','util','../../config/logger','moment','bluebird'];(function(_0x309d93,_0x157662){var _0x2dd61d=function(_0x25ff34){while(--_0x25ff34){_0x309d93['push'](_0x309d93['shift']());}};_0x2dd61d(++_0x157662);}(_0x1dab,0x15b));var _0xb1da=function(_0x5d491a,_0x46fe1b){_0x5d491a=_0x5d491a-0x0;var _0x31b402=_0x1dab[_0x5d491a];return _0x31b402;};'use strict';var _=require('lodash');var util=require(_0xb1da('0x0'));var logger=require(_0xb1da('0x1'))('api');var moment=require(_0xb1da('0x2'));var BPromise=require(_0xb1da('0x3'));var rp=require(_0xb1da('0x4'));var fs=require('fs');var path=require(_0xb1da('0x5'));var rimraf=require(_0xb1da('0x6'));var config=require(_0xb1da('0x7'));var attributes=require(_0xb1da('0x8'));module[_0xb1da('0x9')]=function(_0x56f3c4,_0x3ca5b9){return _0x56f3c4[_0xb1da('0xa')](_0xb1da('0xb'),attributes,{'tableName':_0xb1da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbd4=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x21d845,_0x42185b){var _0x57e2fa=function(_0x459e42){while(--_0x459e42){_0x21d845['push'](_0x21d845['shift']());}};_0x57e2fa(++_0x42185b);}(_0xcbd4,0x12c));var _0x4cbd=function(_0x41b0cd,_0x29db5b){_0x41b0cd=_0x41b0cd-0x0;var _0xda25a7=_0xcbd4[_0x41b0cd];return _0xda25a7;};'use strict';var _=require(_0x4cbd('0x0'));var util=require(_0x4cbd('0x1'));var logger=require(_0x4cbd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4cbd('0x3'));var rp=require(_0x4cbd('0x4'));var fs=require('fs');var path=require(_0x4cbd('0x5'));var rimraf=require(_0x4cbd('0x6'));var config=require(_0x4cbd('0x7'));var attributes=require('./chatWebsite.attributes');module[_0x4cbd('0x8')]=function(_0x4656c8,_0x115f8a){return _0x4656c8[_0x4cbd('0x9')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 745416e..cc22aee 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 _0x7557=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result'];(function(_0x1cee55,_0xe75188){var _0x4f640a=function(_0x550c43){while(--_0x550c43){_0x1cee55['push'](_0x1cee55['shift']());}};_0x4f640a(++_0xe75188);}(_0x7557,0x169));var _0x7755=function(_0x347487,_0x32fc13){_0x347487=_0x347487-0x0;var _0x38b1bb=_0x7557[_0x347487];return _0x38b1bb;};'use strict';var _=require(_0x7755('0x0'));var util=require('util');var moment=require(_0x7755('0x1'));var BPromise=require(_0x7755('0x2'));var rs=require(_0x7755('0x3'));var fs=require('fs');var Redis=require(_0x7755('0x4'));var db=require(_0x7755('0x5'))['db'];var utils=require(_0x7755('0x6'));var logger=require(_0x7755('0x7'))(_0x7755('0x8'));var config=require(_0x7755('0x9'));var jayson=require(_0x7755('0xa'));var client=jayson[_0x7755('0xb')][_0x7755('0xc')]({'port':0x232a});config[_0x7755('0xd')]=_[_0x7755('0xe')](config['redis'],{'host':_0x7755('0xf'),'port':0x18eb});var socket=require(_0x7755('0x10'))(new Redis(config[_0x7755('0xd')]));require('./chatWebsite.socket')[_0x7755('0x11')](socket);function respondWithRpcPromise(_0x397e99,_0x89b3a3,_0x3989b6){return new BPromise(function(_0xb4c11c,_0x37c334){return client[_0x7755('0x12')](_0x397e99,_0x3989b6)[_0x7755('0x13')](function(_0x56bbb6){logger[_0x7755('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x89b3a3,_0x7755('0x15'));logger[_0x7755('0x16')](_0x7755('0x17'),_0x89b3a3,'request\x20sent',JSON[_0x7755('0x18')](_0x56bbb6));if(_0x56bbb6[_0x7755('0x19')]){if(_0x56bbb6[_0x7755('0x19')]['code']===0x1f4){logger[_0x7755('0x19')](_0x7755('0x1a'),_0x89b3a3,_0x56bbb6[_0x7755('0x19')][_0x7755('0x1b')]);return _0x37c334(_0x56bbb6[_0x7755('0x19')][_0x7755('0x1b')]);}logger[_0x7755('0x19')](_0x7755('0x1a'),_0x89b3a3,_0x56bbb6['error'][_0x7755('0x1b')]);return _0xb4c11c(_0x56bbb6[_0x7755('0x19')]['message']);}else{logger[_0x7755('0x14')](_0x7755('0x1a'),_0x89b3a3,'request\x20sent');_0xb4c11c(_0x56bbb6[_0x7755('0x1c')][_0x7755('0x1b')]);}})[_0x7755('0x1d')](function(_0x158f77){logger[_0x7755('0x19')](_0x7755('0x1a'),_0x89b3a3,_0x158f77);_0x37c334(_0x158f77);});});} \ No newline at end of file +var _0x4cd2=['ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','./chatWebsite.socket','register','request','then','info'];(function(_0x403518,_0x59bf03){var _0x19955f=function(_0x53e7e8){while(--_0x53e7e8){_0x403518['push'](_0x403518['shift']());}};_0x19955f(++_0x59bf03);}(_0x4cd2,0x1c4));var _0x24cd=function(_0x253493,_0x622fd7){_0x253493=_0x253493-0x0;var _0x43a0e1=_0x4cd2[_0x253493];return _0x43a0e1;};'use strict';var _=require(_0x24cd('0x0'));var util=require('util');var moment=require(_0x24cd('0x1'));var BPromise=require(_0x24cd('0x2'));var rs=require(_0x24cd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x24cd('0x4'))(_0x24cd('0x5'));var config=require('../../config/environment');var jayson=require(_0x24cd('0x6'));var client=jayson[_0x24cd('0x7')]['http']({'port':0x232a});config['redis']=_[_0x24cd('0x8')](config[_0x24cd('0x9')],{'host':_0x24cd('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x24cd('0x9')]));require(_0x24cd('0xb'))[_0x24cd('0xc')](socket);function respondWithRpcPromise(_0x350091,_0x186441,_0x41dec2){return new BPromise(function(_0x476fa4,_0x10503d){return client[_0x24cd('0xd')](_0x350091,_0x41dec2)[_0x24cd('0xe')](function(_0x19ff29){logger[_0x24cd('0xf')](_0x24cd('0x10'),_0x186441,_0x24cd('0x11'));logger[_0x24cd('0x12')](_0x24cd('0x13'),_0x186441,_0x24cd('0x11'),JSON[_0x24cd('0x14')](_0x19ff29));if(_0x19ff29[_0x24cd('0x15')]){if(_0x19ff29[_0x24cd('0x15')][_0x24cd('0x16')]===0x1f4){logger[_0x24cd('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x186441,_0x19ff29[_0x24cd('0x15')]['message']);return _0x10503d(_0x19ff29['error']['message']);}logger[_0x24cd('0x15')](_0x24cd('0x10'),_0x186441,_0x19ff29[_0x24cd('0x15')][_0x24cd('0x17')]);return _0x476fa4(_0x19ff29[_0x24cd('0x15')][_0x24cd('0x17')]);}else{logger[_0x24cd('0xf')](_0x24cd('0x10'),_0x186441,'request\x20sent');_0x476fa4(_0x19ff29[_0x24cd('0x18')][_0x24cd('0x17')]);}})[_0x24cd('0x19')](function(_0x834602){logger[_0x24cd('0x15')](_0x24cd('0x10'),_0x186441,_0x834602);_0x10503d(_0x834602);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index b0de279..c206d4e 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 _0xd421=['register','length','chatWebsite:','./chatWebsite.events','save','remove','removeListener'];(function(_0x31b72c,_0x5396df){var _0x56c4ea=function(_0x4326bb){while(--_0x4326bb){_0x31b72c['push'](_0x31b72c['shift']());}};_0x56c4ea(++_0x5396df);}(_0xd421,0x10d));var _0x1d42=function(_0x693a00,_0x1282f9){_0x693a00=_0x693a00-0x0;var _0xac0922=_0xd421[_0x693a00];return _0xac0922;};'use strict';var ChatWebsiteEvents=require(_0x1d42('0x0'));var events=[_0x1d42('0x1'),_0x1d42('0x2'),'update'];function createListener(_0xcfb8be,_0x254808){return function(_0x26e867){_0x254808['emit'](_0xcfb8be,_0x26e867);};}function removeListener(_0x45d7b0,_0x4c58db){return function(){ChatWebsiteEvents[_0x1d42('0x3')](_0x45d7b0,_0x4c58db);};}exports[_0x1d42('0x4')]=function(_0x49ecd4){for(var _0x324617=0x0,_0x5b0b27=events[_0x1d42('0x5')];_0x324617<_0x5b0b27;_0x324617++){var _0xc437d2=events[_0x324617];var _0x5d7a3e=createListener(_0x1d42('0x6')+_0xc437d2,_0x49ecd4);ChatWebsiteEvents['on'](_0xc437d2,_0x5d7a3e);}}; \ No newline at end of file +var _0x81e5=['remove','update','emit','removeListener','register','chatWebsite:','./chatWebsite.events','save'];(function(_0x166c01,_0x252a3a){var _0x2d6f94=function(_0x5b3f36){while(--_0x5b3f36){_0x166c01['push'](_0x166c01['shift']());}};_0x2d6f94(++_0x252a3a);}(_0x81e5,0xd6));var _0x581e=function(_0x763f28,_0x4b9acc){_0x763f28=_0x763f28-0x0;var _0x2721f2=_0x81e5[_0x763f28];return _0x2721f2;};'use strict';var ChatWebsiteEvents=require(_0x581e('0x0'));var events=[_0x581e('0x1'),_0x581e('0x2'),_0x581e('0x3')];function createListener(_0x4a755,_0x3c4694){return function(_0x3ff5ac){_0x3c4694[_0x581e('0x4')](_0x4a755,_0x3ff5ac);};}function removeListener(_0x1e888f,_0x3dd518){return function(){ChatWebsiteEvents[_0x581e('0x5')](_0x1e888f,_0x3dd518);};}exports[_0x581e('0x6')]=function(_0x2e3a7e){for(var _0xea79b=0x0,_0x1dd824=events['length'];_0xea79b<_0x1dd824;_0xea79b++){var _0xd5065c=events[_0xea79b];var _0x2abd05=createListener(_0x581e('0x7')+_0xd5065c,_0x2e3a7e);ChatWebsiteEvents['on'](_0xd5065c,_0x2abd05);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7c6bd75..b7c2aaa 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 _0x75ee=['getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage','root','server/files/images/logos/','now','originalname','/:id/logo','single','addLogo','server/files/images/avatars/','format','%s-%s','file','addAvatar','join','addCustomerAvatar','server/files','ensureDir','extname','replace','/:id/offline','any','offline','addApplications','addProactiveActions','addAgents','/:id','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar'];(function(_0x99779c,_0x18fddf){var _0x265bdd=function(_0x49f795){while(--_0x49f795){_0x99779c['push'](_0x99779c['shift']());}};_0x265bdd(++_0x18fddf);}(_0x75ee,0x1ce));var _0xe75e=function(_0x533132,_0xf5b6fa){_0x533132=_0x533132-0x0;var _0x1a7447=_0x75ee[_0x533132];return _0x1a7447;};'use strict';var multer=require(_0xe75e('0x0'));var util=require(_0xe75e('0x1'));var path=require(_0xe75e('0x2'));var timeout=require(_0xe75e('0x3'));var express=require(_0xe75e('0x4'));var router=express[_0xe75e('0x5')]();var fs_extra=require(_0xe75e('0x6'));var auth=require(_0xe75e('0x7'));var interaction=require(_0xe75e('0x8'));var config=require(_0xe75e('0x9'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0xe75e('0xa')](),controller[_0xe75e('0xb')]);router[_0xe75e('0xc')]('/describe',auth[_0xe75e('0xa')](),controller[_0xe75e('0xd')]);router[_0xe75e('0xc')]('/:id',auth[_0xe75e('0xa')](),controller[_0xe75e('0xe')]);router[_0xe75e('0xc')](_0xe75e('0xf'),auth[_0xe75e('0xa')](),controller[_0xe75e('0x10')]);router[_0xe75e('0xc')](_0xe75e('0x11'),auth[_0xe75e('0xa')](),controller[_0xe75e('0x12')]);router['get']('/:id/logo',controller[_0xe75e('0x13')]);router[_0xe75e('0xc')](_0xe75e('0x14'),controller[_0xe75e('0x15')]);router[_0xe75e('0xc')](_0xe75e('0x16'),controller[_0xe75e('0x17')]);router[_0xe75e('0xc')]('/:id/system_avatar',controller[_0xe75e('0x18')]);router[_0xe75e('0xc')](_0xe75e('0x19'),auth[_0xe75e('0xa')](),controller[_0xe75e('0x1a')]);router[_0xe75e('0xc')]('/:id/snippet',controller['getSnippet']);router[_0xe75e('0xc')]('/:id/applications',auth[_0xe75e('0xa')](),controller['getApplications']);router[_0xe75e('0xc')](_0xe75e('0x1b'),auth[_0xe75e('0xa')](),controller[_0xe75e('0x1c')]);router['get'](_0xe75e('0x1d'),controller[_0xe75e('0x1e')]);router[_0xe75e('0xc')](_0xe75e('0x1f'),auth[_0xe75e('0xa')](),controller[_0xe75e('0x20')]);router['get'](_0xe75e('0x21'),auth[_0xe75e('0xa')](),controller[_0xe75e('0x22')]);router[_0xe75e('0x23')]('/',auth[_0xe75e('0xa')](),controller[_0xe75e('0x24')]);router[_0xe75e('0x23')](_0xe75e('0xf'),auth[_0xe75e('0xa')](),controller[_0xe75e('0x25')]);router[_0xe75e('0x23')](_0xe75e('0x11'),auth[_0xe75e('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xe75e('0x26')]({'destination':function(_0x40da2a,_0x498841,_0x4f0221){_0x4f0221(null,path['join'](config[_0xe75e('0x27')],_0xe75e('0x28')));},'filename':function(_0xdb6e69,_0x49c79a,_0x473517){_0x473517(null,util['format']('%s-%s',Date[_0xe75e('0x29')](),_0x49c79a[_0xe75e('0x2a')]));}})});router[_0xe75e('0x23')](_0xe75e('0x2b'),upload[_0xe75e('0x2c')]('file'),controller[_0xe75e('0x2d')]);var upload=multer({'storage':multer[_0xe75e('0x26')]({'destination':function(_0x5e8839,_0x52bfbf,_0x521bc8){_0x521bc8(null,path['join'](config[_0xe75e('0x27')],_0xe75e('0x2e')));},'filename':function(_0x2927d0,_0x134d93,_0x52c852){_0x52c852(null,util[_0xe75e('0x2f')](_0xe75e('0x30'),Date[_0xe75e('0x29')](),_0x134d93['originalname']));}})});router[_0xe75e('0x23')](_0xe75e('0x14'),upload[_0xe75e('0x2c')](_0xe75e('0x31')),controller[_0xe75e('0x32')]);var upload=multer({'storage':multer[_0xe75e('0x26')]({'destination':function(_0x146031,_0x36130e,_0x799f29){_0x799f29(null,path[_0xe75e('0x33')](config[_0xe75e('0x27')],_0xe75e('0x2e')));},'filename':function(_0x998638,_0x456b1a,_0x169640){_0x169640(null,util['format'](_0xe75e('0x30'),Date[_0xe75e('0x29')](),_0x456b1a[_0xe75e('0x2a')]));}})});router[_0xe75e('0x23')](_0xe75e('0x16'),upload[_0xe75e('0x2c')](_0xe75e('0x31')),controller[_0xe75e('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3b520e,_0x5a26ee,_0x21a9e4){_0x21a9e4(null,path[_0xe75e('0x33')](config[_0xe75e('0x27')],_0xe75e('0x2e')));},'filename':function(_0x502e48,_0x20cb8f,_0x260413){_0x260413(null,util['format'](_0xe75e('0x30'),Date[_0xe75e('0x29')](),_0x20cb8f['originalname']));}})});router['post']('/:id/system_avatar',upload[_0xe75e('0x2c')]('file'),controller['addSystemAvatar']);router[_0xe75e('0x23')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xe75e('0x26')]({'destination':function(_0x582471,_0xf19d08,_0x3c5781){const _0x2e3b65=path[_0xe75e('0x33')](config['root'],_0xe75e('0x35'),'attachments','offline-chat');fs_extra[_0xe75e('0x36')](_0x2e3b65,function(){_0x3c5781(null,_0x2e3b65);});},'filename':function(_0x131f72,_0x2843ed,_0x18457f){const _0x54b0f5=_0x2843ed[_0xe75e('0x2a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5b8d60=path[_0xe75e('0x37')](_0x54b0f5);const _0x34a05d=Date['now']()+'-'+_0x54b0f5[_0xe75e('0x38')](_0x5b8d60,'')+_0x5b8d60;_0x18457f(null,_0x34a05d);}})});router[_0xe75e('0x23')](_0xe75e('0x39'),offlineUploadMulter[_0xe75e('0x3a')](),controller[_0xe75e('0x3b')]);router[_0xe75e('0x23')](_0xe75e('0x19'),auth[_0xe75e('0xa')](),controller['addInteraction']);router[_0xe75e('0x23')]('/:id/applications',auth[_0xe75e('0xa')](),controller[_0xe75e('0x3c')]);router[_0xe75e('0x23')](_0xe75e('0x1b'),auth[_0xe75e('0xa')](),controller[_0xe75e('0x3d')]);router[_0xe75e('0x23')]('/:id/users',auth[_0xe75e('0xa')](),controller[_0xe75e('0x3e')]);router['put'](_0xe75e('0x3f'),auth[_0xe75e('0xa')](),controller['update']);router[_0xe75e('0x40')](_0xe75e('0x3f'),auth[_0xe75e('0xa')](),controller[_0xe75e('0x41')]);router[_0xe75e('0x40')](_0xe75e('0xf'),auth[_0xe75e('0xa')](),controller['removeDispositions']);router[_0xe75e('0x40')]('/:id/canned_answers',auth[_0xe75e('0xa')](),controller[_0xe75e('0x42')]);router[_0xe75e('0x40')]('/:id/users',auth['isAuthenticated'](),controller[_0xe75e('0x43')]);module[_0xe75e('0x44')]=router; \ No newline at end of file +var _0xa62f=['/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','addDisposition','addAnswer','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','diskStorage','file','addAvatar','server/files/images/avatars/','/:id/system_avatar','addSystemAvatar','notify','server/files','attachments','offline-chat','replace','/:id/offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers'];(function(_0x56aa66,_0x1ddf52){var _0xeba9ff=function(_0x5467b5){while(--_0x5467b5){_0x56aa66['push'](_0x56aa66['shift']());}};_0xeba9ff(++_0x1ddf52);}(_0xa62f,0x1ca));var _0xfa62=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa62f[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa62('0x0'));var timeout=require(_0xfa62('0x1'));var express=require(_0xfa62('0x2'));var router=express[_0xfa62('0x3')]();var fs_extra=require(_0xfa62('0x4'));var auth=require(_0xfa62('0x5'));var interaction=require(_0xfa62('0x6'));var config=require(_0xfa62('0x7'));var controller=require(_0xfa62('0x8'));router[_0xfa62('0x9')]('/',auth[_0xfa62('0xa')](),controller[_0xfa62('0xb')]);router[_0xfa62('0x9')](_0xfa62('0xc'),auth[_0xfa62('0xa')](),controller[_0xfa62('0xd')]);router['get'](_0xfa62('0xe'),auth['isAuthenticated'](),controller[_0xfa62('0xf')]);router[_0xfa62('0x9')](_0xfa62('0x10'),auth[_0xfa62('0xa')](),controller['getDispositions']);router[_0xfa62('0x9')](_0xfa62('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xfa62('0x9')](_0xfa62('0x12'),controller[_0xfa62('0x13')]);router[_0xfa62('0x9')](_0xfa62('0x14'),controller[_0xfa62('0x15')]);router['get'](_0xfa62('0x16'),controller[_0xfa62('0x17')]);router[_0xfa62('0x9')]('/:id/system_avatar',controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0xfa62('0xa')](),controller['getInteractions']);router[_0xfa62('0x9')]('/:id/snippet',controller[_0xfa62('0x18')]);router[_0xfa62('0x9')](_0xfa62('0x19'),auth['isAuthenticated'](),controller['getApplications']);router[_0xfa62('0x9')](_0xfa62('0x1a'),auth[_0xfa62('0xa')](),controller[_0xfa62('0x1b')]);router[_0xfa62('0x9')](_0xfa62('0x1c'),controller[_0xfa62('0x1d')]);router[_0xfa62('0x9')](_0xfa62('0x1e'),auth[_0xfa62('0xa')](),controller[_0xfa62('0x1f')]);router[_0xfa62('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xfa62('0x20')]);router[_0xfa62('0x21')]('/',auth['isAuthenticated'](),controller[_0xfa62('0x22')]);router['post'](_0xfa62('0x10'),auth[_0xfa62('0xa')](),controller[_0xfa62('0x23')]);router['post'](_0xfa62('0x11'),auth['isAuthenticated'](),controller[_0xfa62('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x23dd1e,_0x54c36e,_0x547d0d){_0x547d0d(null,path[_0xfa62('0x25')](config[_0xfa62('0x26')],_0xfa62('0x27')));},'filename':function(_0x11b0f1,_0x37b467,_0x2922eb){_0x2922eb(null,util[_0xfa62('0x28')](_0xfa62('0x29'),Date[_0xfa62('0x2a')](),_0x37b467[_0xfa62('0x2b')]));}})});router['post']('/:id/logo',upload[_0xfa62('0x2c')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0xfa62('0x2d')]({'destination':function(_0x2ed406,_0x52ffc1,_0x1f0f50){_0x1f0f50(null,path[_0xfa62('0x25')](config[_0xfa62('0x26')],'server/files/images/avatars/'));},'filename':function(_0x352c2,_0x5774f2,_0x1a106b){_0x1a106b(null,util[_0xfa62('0x28')](_0xfa62('0x29'),Date[_0xfa62('0x2a')](),_0x5774f2['originalname']));}})});router[_0xfa62('0x21')](_0xfa62('0x14'),upload['single'](_0xfa62('0x2e')),controller[_0xfa62('0x2f')]);var upload=multer({'storage':multer[_0xfa62('0x2d')]({'destination':function(_0x23faeb,_0x933a04,_0x542d5e){_0x542d5e(null,path['join'](config['root'],_0xfa62('0x30')));},'filename':function(_0xd7d160,_0x4a9bf3,_0x8bbafd){_0x8bbafd(null,util[_0xfa62('0x28')](_0xfa62('0x29'),Date['now'](),_0x4a9bf3['originalname']));}})});router['post'](_0xfa62('0x16'),upload[_0xfa62('0x2c')](_0xfa62('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xfa62('0x2d')]({'destination':function(_0x4052a3,_0x47781d,_0x2a121c){_0x2a121c(null,path['join'](config[_0xfa62('0x26')],'server/files/images/avatars/'));},'filename':function(_0x2de1c7,_0x212784,_0x14705c){_0x14705c(null,util[_0xfa62('0x28')](_0xfa62('0x29'),Date[_0xfa62('0x2a')](),_0x212784[_0xfa62('0x2b')]));}})});router[_0xfa62('0x21')](_0xfa62('0x31'),upload['single']('file'),controller[_0xfa62('0x32')]);router[_0xfa62('0x21')]('/:id/notify',controller[_0xfa62('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0xfa62('0x2d')]({'destination':function(_0x2f7052,_0x120d28,_0x3433da){const _0x285429=path[_0xfa62('0x25')](config[_0xfa62('0x26')],_0xfa62('0x34'),_0xfa62('0x35'),_0xfa62('0x36'));fs_extra['ensureDir'](_0x285429,function(){_0x3433da(null,_0x285429);});},'filename':function(_0x30b751,_0x581d0f,_0x2db4fd){const _0x2038a6=_0x581d0f['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x636a84=path['extname'](_0x2038a6);const _0x1325f6=Date[_0xfa62('0x2a')]()+'-'+_0x2038a6[_0xfa62('0x37')](_0x636a84,'')+_0x636a84;_0x2db4fd(null,_0x1325f6);}})});router[_0xfa62('0x21')](_0xfa62('0x38'),offlineUploadMulter['any'](),controller['offline']);router[_0xfa62('0x21')](_0xfa62('0x39'),auth['isAuthenticated'](),controller[_0xfa62('0x3a')]);router[_0xfa62('0x21')]('/:id/applications',auth[_0xfa62('0xa')](),controller[_0xfa62('0x3b')]);router[_0xfa62('0x21')](_0xfa62('0x1a'),auth[_0xfa62('0xa')](),controller[_0xfa62('0x3c')]);router['post']('/:id/users',auth[_0xfa62('0xa')](),controller[_0xfa62('0x3d')]);router['put']('/:id',auth[_0xfa62('0xa')](),controller[_0xfa62('0x3e')]);router[_0xfa62('0x3f')]('/:id',auth[_0xfa62('0xa')](),controller[_0xfa62('0x40')]);router[_0xfa62('0x3f')](_0xfa62('0x10'),auth[_0xfa62('0xa')](),controller[_0xfa62('0x41')]);router[_0xfa62('0x3f')](_0xfa62('0x11'),auth['isAuthenticated'](),controller[_0xfa62('0x42')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xfa62('0x43')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 4d15525..ae6a30e 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 _0x2c92=['get','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','use','isAuthenticated','exports','express','../components/auth/service','../config/environment','Router','env','production','app'];(function(_0x3a1bc3,_0x2e8c21){var _0x1e92c9=function(_0x18f4a8){while(--_0x18f4a8){_0x3a1bc3['push'](_0x3a1bc3['shift']());}};_0x1e92c9(++_0x2e8c21);}(_0x2c92,0x93));var _0x22c9=function(_0x4ca6a4,_0x5e9694){_0x4ca6a4=_0x4ca6a4-0x0;var _0x120555=_0x2c92[_0x4ca6a4];return _0x120555;};var beaverLogger=require('beaver-logger/server');var express=require(_0x22c9('0x0'));var auth=require(_0x22c9('0x1'));var config=require(_0x22c9('0x2'));var router=express[_0x22c9('0x3')]();var isProduction=config[_0x22c9('0x4')]===_0x22c9('0x5')||![];function clientSideLogs(_0x12782d,_0x4bc85f,_0x7b7b2b){var _0x1f3877=_0x12782d[_0x22c9('0x6')][_0x22c9('0x7')](_0x22c9('0x8'));if(!_0x1f3877){throw new Error(_0x22c9('0x9'));}return beaverLogger['expressEndpoint']({'uri':_0x22c9('0xa'),'logger':_0x1f3877,'enableCors':!isProduction})(_0x12782d,_0x4bc85f,_0x7b7b2b);}router[_0x22c9('0xb')](auth[_0x22c9('0xc')](),clientSideLogs);module[_0x22c9('0xd')]=router; \ No newline at end of file +var _0x235d=['/client-logs','use','exports','beaver-logger/server','express','../components/auth/service','../config/environment','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint'];(function(_0x39c07c,_0x44f2a7){var _0x1a45be=function(_0x52be4b){while(--_0x52be4b){_0x39c07c['push'](_0x39c07c['shift']());}};_0x1a45be(++_0x44f2a7);}(_0x235d,0x183));var _0xd235=function(_0x23fbad,_0x32c9b3){_0x23fbad=_0x23fbad-0x0;var _0x5ecff6=_0x235d[_0x23fbad];return _0x5ecff6;};var beaverLogger=require(_0xd235('0x0'));var express=require(_0xd235('0x1'));var auth=require(_0xd235('0x2'));var config=require(_0xd235('0x3'));var router=express['Router']();var isProduction=config['env']===_0xd235('0x4')||![];function clientSideLogs(_0x11009e,_0x1f156a,_0x51f7d9){var _0x35c8a8=_0x11009e[_0xd235('0x5')]['get'](_0xd235('0x6'));if(!_0x35c8a8){throw new Error(_0xd235('0x7'));}return beaverLogger[_0xd235('0x8')]({'uri':_0xd235('0x9'),'logger':_0x35c8a8,'enableCors':!isProduction})(_0x11009e,_0x1f156a,_0x51f7d9);}router[_0xd235('0xa')](auth['isAuthenticated'](),clientSideLogs);module[_0xd235('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index ab47b0e..36f03b4 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 _0x9957=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','Google','MicrosoftAzure','ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x3d27ba,_0x2671a3){var _0xf01885=function(_0x311f5c){while(--_0x311f5c){_0x3d27ba['push'](_0x3d27ba['shift']());}};_0xf01885(++_0x2671a3);}(_0x9957,0xfd));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x7995('0x0'));module['exports']={'name':{'type':Sequelize[_0x7995('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x7995('0x2'),_0x7995('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x7995('0x4')](_0x7995('0x5'),_0x7995('0x6'))},'data1':{'type':Sequelize[_0x7995('0x1')],'comment':_0x7995('0x7')},'data2':{'type':Sequelize[_0x7995('0x1')],'comment':_0x7995('0x8')},'data3':{'type':Sequelize[_0x7995('0x1')],'comment':_0x7995('0x9')},'data4':{'type':Sequelize[_0x7995('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x7995('0xa')],'comment':_0x7995('0xb')},'data6':{'type':Sequelize['TEXT'],'comment':_0x7995('0xc')},'data7':{'type':Sequelize[_0x7995('0xa')],'comment':_0x7995('0xd')}}; \ No newline at end of file +var _0xd099=['sequelize','exports','STRING','ENUM','AmazonAWS','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0xd099,0x193));var _0x9d09=function(_0x9b9c46,_0x3997a8){_0x9b9c46=_0x9b9c46-0x0;var _0x47ee52=_0xd099[_0x9b9c46];return _0x47ee52;};'use strict';var Sequelize=require(_0x9d09('0x0'));module[_0x9d09('0x1')]={'name':{'type':Sequelize[_0x9d09('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9d09('0x3')](_0x9d09('0x4'),'Google',_0x9d09('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x9d09('0x3')](_0x9d09('0x6'),_0x9d09('0x7'))},'data1':{'type':Sequelize[_0x9d09('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x9d09('0x2')],'comment':_0x9d09('0x8')},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x9d09('0x2')],'comment':_0x9d09('0x9')},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x9d09('0xa')],'comment':_0x9d09('0xb')},'data7':{'type':Sequelize[_0x9d09('0xa')],'comment':_0x9d09('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index a49ca18..f239968 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 _0xb954=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','CloudProvider','findAll','rows','service','MicrosoftAzure','decryptString','data3','show','params','find','catch','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','state','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','error','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','defaults','localhost','redis','sendStatus','status','end','json','undefined','count','offset','Content-Range','destroy','then','stack','name','send','padEnd','slice','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x59dbc3,_0xfc1f22){var _0x1ba735=function(_0x5bc380){while(--_0x5bc380){_0x59dbc3['push'](_0x59dbc3['shift']());}};_0x1ba735(++_0xfc1f22);}(_0xb954,0x9c));var _0x4b95=function(_0x3c8b46,_0x34e053){_0x3c8b46=_0x3c8b46-0x0;var _0x4bf0a8=_0xb954[_0x3c8b46];return _0x4bf0a8;};'use strict';var _=require(_0x4b95('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0x4b95('0x1'));var config=require(_0x4b95('0x2'));var logger=require('../../config/logger')(_0x4b95('0x3'));var db=require(_0x4b95('0x4'))['db'];var oauth=require(_0x4b95('0x5'));config['redis']=_[_0x4b95('0x6')](config['redis'],{'host':_0x4b95('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b95('0x8')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x1dc852,_0x247b59){_0x247b59=_0x247b59||0xcc;return function(_0x5631f7){if(_0x5631f7){return _0x1dc852[_0x4b95('0x9')](_0x247b59);}return _0x1dc852[_0x4b95('0xa')](_0x247b59)[_0x4b95('0xb')]();};}function respondWithResult(_0xd96441,_0x4c22eb){_0x4c22eb=_0x4c22eb||0xc8;return function(_0x27bded){if(_0x27bded){return _0xd96441[_0x4b95('0xa')](_0x4c22eb)[_0x4b95('0xc')](_0x27bded);}};}function respondWithFilteredResult(_0x20b20b,_0x10f328){return function(_0x1790a6){if(_0x1790a6){var _0x26a696=typeof _0x10f328['offset']===_0x4b95('0xd')&&typeof _0x10f328['limit']===_0x4b95('0xd');var _0x3b3d3a=_0x1790a6[_0x4b95('0xe')];var _0x413cb0=_0x26a696?0x0:_0x10f328[_0x4b95('0xf')];var _0x3fa39e=_0x26a696?_0x1790a6[_0x4b95('0xe')]:_0x10f328[_0x4b95('0xf')]+_0x10f328['limit'];var _0x8bbff8;if(_0x3fa39e>=_0x3b3d3a){_0x3fa39e=_0x3b3d3a;_0x8bbff8=0xc8;}else{_0x8bbff8=0xce;}_0x20b20b[_0x4b95('0xa')](_0x8bbff8);return _0x20b20b['set'](_0x4b95('0x10'),_0x413cb0+'-'+_0x3fa39e+'/'+_0x3b3d3a)[_0x4b95('0xc')](_0x1790a6);}return null;};}function saveUpdates(_0x713dcd){return function(_0x5a1d10){if(_0x5a1d10){return _0x5a1d10['update'](_0x713dcd)['then'](function(_0x32fb2c){return _0x32fb2c;});}return null;};}function removeEntity(_0x2304b3){return function(_0x17a131){if(_0x17a131){return _0x17a131[_0x4b95('0x11')]()[_0x4b95('0x12')](function(){_0x2304b3[_0x4b95('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eb66f){return function(_0x9449e4){if(!_0x9449e4){_0x2eb66f[_0x4b95('0x9')](0x194);}return _0x9449e4;};}function handleError(_0x17d190,_0x22a6fc){_0x22a6fc=_0x22a6fc||0x1f4;return function(_0x113b1a){logger['error'](_0x113b1a[_0x4b95('0x13')]);if(_0x113b1a['name']){delete _0x113b1a[_0x4b95('0x14')];}_0x17d190['status'](_0x22a6fc)[_0x4b95('0x15')](_0x113b1a);};}function maskClientSecret(_0x3fa900){return _[_0x4b95('0x16')](_0x3fa900[_0x4b95('0x17')](0x0,0x3),0x14,'*');}exports['index']=function(_0x5a22a3,_0x42c6a0){var _0x5cbe0f={},_0x355c7c={},_0x5cea71={'count':0x0,'rows':[]};var _0x2258c4=_[_0x4b95('0x18')](db['CloudProvider'][_0x4b95('0x19')],function(_0x5af9d7){return{'name':_0x5af9d7['fieldName'],'type':_0x5af9d7['type'][_0x4b95('0x1a')]};});_0x355c7c[_0x4b95('0x1b')]=_[_0x4b95('0x18')](_0x2258c4,_0x4b95('0x14'));_0x355c7c[_0x4b95('0x1c')]=_[_0x4b95('0x1d')](_0x5a22a3[_0x4b95('0x1c')]);_0x355c7c[_0x4b95('0x1e')]=_[_0x4b95('0x1f')](_0x355c7c[_0x4b95('0x1b')],_0x355c7c[_0x4b95('0x1c')]);_0x5cbe0f[_0x4b95('0x20')]=_['intersection'](_0x355c7c[_0x4b95('0x1b')],qs[_0x4b95('0x21')](_0x5a22a3[_0x4b95('0x1c')][_0x4b95('0x21')]));_0x5cbe0f[_0x4b95('0x20')]=_0x5cbe0f[_0x4b95('0x20')][_0x4b95('0x22')]?_0x5cbe0f[_0x4b95('0x20')]:_0x355c7c[_0x4b95('0x1b')];if(!_0x5a22a3[_0x4b95('0x1c')][_0x4b95('0x23')](_0x4b95('0x24'))){_0x5cbe0f[_0x4b95('0x25')]=qs[_0x4b95('0x25')](_0x5a22a3[_0x4b95('0x1c')][_0x4b95('0x25')]);_0x5cbe0f[_0x4b95('0xf')]=qs[_0x4b95('0xf')](_0x5a22a3[_0x4b95('0x1c')]['offset']);}_0x5cbe0f[_0x4b95('0x26')]=qs[_0x4b95('0x27')](_0x5a22a3[_0x4b95('0x1c')]['sort']);_0x5cbe0f[_0x4b95('0x28')]=qs[_0x4b95('0x1e')](_[_0x4b95('0x29')](_0x5a22a3['query'],_0x355c7c['filters']),_0x2258c4);if(_0x5a22a3['query'][_0x4b95('0x2a')]){_0x5cbe0f[_0x4b95('0x28')]=_[_0x4b95('0x2b')](_0x5cbe0f[_0x4b95('0x28')],{'$or':_[_0x4b95('0x18')](_0x2258c4,function(_0x2bc71d){if(_0x2bc71d[_0x4b95('0x2c')]!==_0x4b95('0x2d')){var _0x39d468={};_0x39d468[_0x2bc71d[_0x4b95('0x14')]]={'$like':'%'+_0x5a22a3[_0x4b95('0x1c')][_0x4b95('0x2a')]+'%'};return _0x39d468;}})});}_0x5cbe0f=_[_0x4b95('0x2b')]({},_0x5cbe0f,_0x5a22a3[_0x4b95('0x2e')]);var _0x17aa22={'where':_0x5cbe0f['where']};return db['CloudProvider'][_0x4b95('0xe')](_0x17aa22)[_0x4b95('0x12')](function(_0x37d8b0){_0x5cea71[_0x4b95('0xe')]=_0x37d8b0;if(_0x5a22a3[_0x4b95('0x1c')][_0x4b95('0x2f')]){_0x5cbe0f[_0x4b95('0x30')]=[{'all':!![]}];}return db[_0x4b95('0x31')][_0x4b95('0x32')](_0x5cbe0f);})[_0x4b95('0x12')](function(_0x9c8c3d){_0x5cea71[_0x4b95('0x33')]=_[_0x4b95('0x18')](_0x9c8c3d,function(_0x344145){if(_0x344145[_0x4b95('0x34')]===_0x4b95('0x35')){var _0x41b0e4=encryptor[_0x4b95('0x36')](_0x344145[_0x4b95('0x37')]);_0x344145[_0x4b95('0x37')]=maskClientSecret(_0x41b0e4);}return _0x344145;});return _0x5cea71;})[_0x4b95('0x12')](respondWithFilteredResult(_0x42c6a0,_0x5cbe0f))['catch'](handleError(_0x42c6a0,null));};exports[_0x4b95('0x38')]=function(_0x1d48f5,_0x3da7e1){var _0x4913d5={'raw':!![],'where':{'id':_0x1d48f5[_0x4b95('0x39')]['id']}},_0x527dac={};_0x527dac['model']=_[_0x4b95('0x1d')](db[_0x4b95('0x31')][_0x4b95('0x19')]);_0x527dac['query']=_['keys'](_0x1d48f5[_0x4b95('0x1c')]);_0x527dac[_0x4b95('0x1e')]=_[_0x4b95('0x1f')](_0x527dac[_0x4b95('0x1b')],_0x527dac[_0x4b95('0x1c')]);_0x4913d5['attributes']=_[_0x4b95('0x1f')](_0x527dac[_0x4b95('0x1b')],qs[_0x4b95('0x21')](_0x1d48f5[_0x4b95('0x1c')]['fields']));_0x4913d5['attributes']=_0x4913d5[_0x4b95('0x20')]['length']?_0x4913d5['attributes']:_0x527dac[_0x4b95('0x1b')];if(_0x1d48f5[_0x4b95('0x1c')][_0x4b95('0x2f')]){_0x4913d5[_0x4b95('0x30')]=[{'all':!![]}];}_0x4913d5=_['merge']({},_0x4913d5,_0x1d48f5[_0x4b95('0x2e')]);return db['CloudProvider'][_0x4b95('0x3a')](_0x4913d5)[_0x4b95('0x12')](handleEntityNotFound(_0x3da7e1,null))[_0x4b95('0x12')](function(_0x30bbb8){if(_0x30bbb8[_0x4b95('0x34')]===_0x4b95('0x35')){var _0x4a9e22=encryptor[_0x4b95('0x36')](_0x30bbb8[_0x4b95('0x37')]);_0x30bbb8[_0x4b95('0x37')]=maskClientSecret(_0x4a9e22);}return _0x30bbb8;})[_0x4b95('0x12')](respondWithResult(_0x3da7e1,null))[_0x4b95('0x3b')](handleError(_0x3da7e1,null));};exports[_0x4b95('0x3c')]=function(_0x1cfcfc,_0x57be67){if(!_0x1cfcfc[_0x4b95('0x3d')][_0x4b95('0x14')])throw new Error(_0x4b95('0x3e'));if(!_0x1cfcfc[_0x4b95('0x3d')][_0x4b95('0x34')])throw new Error(_0x4b95('0x3f'));var _0x2077d4=db['CloudProvider'][_0x4b95('0x19')][_0x4b95('0x34')]['values'];if(!_0x2077d4['includes'](_0x1cfcfc['body'][_0x4b95('0x34')]))throw new Error(_0x4b95('0x40')+_0x2077d4[_0x4b95('0x41')](',\x20'));if(_0x1cfcfc[_0x4b95('0x3d')][_0x4b95('0x34')]===_0x4b95('0x35')&&_0x1cfcfc['body'][_0x4b95('0x37')]){_0x1cfcfc[_0x4b95('0x3d')][_0x4b95('0x37')]=encryptor[_0x4b95('0x42')](_0x1cfcfc[_0x4b95('0x3d')][_0x4b95('0x37')]);}return db[_0x4b95('0x31')][_0x4b95('0x3c')](_0x1cfcfc[_0x4b95('0x3d')],{})[_0x4b95('0x12')](respondWithResult(_0x57be67,0xc9))['catch'](handleError(_0x57be67,null));};exports[_0x4b95('0x43')]=function(_0x1d9e52,_0x2046c5){if(_0x1d9e52[_0x4b95('0x3d')]['id']){delete _0x1d9e52['body']['id'];}return db[_0x4b95('0x31')]['find']({'where':{'id':_0x1d9e52['params']['id']}})['then'](handleEntityNotFound(_0x2046c5,null))[_0x4b95('0x12')](function(_0x3539ff){if(_0x3539ff[_0x4b95('0x34')]===_0x4b95('0x35')&&_0x1d9e52[_0x4b95('0x3d')][_0x4b95('0x37')]){_0x1d9e52[_0x4b95('0x3d')][_0x4b95('0x37')]=encryptor[_0x4b95('0x42')](_0x1d9e52[_0x4b95('0x3d')]['data3']);}return _0x3539ff;})['then'](saveUpdates(_0x1d9e52['body'],null))[_0x4b95('0x12')](respondWithResult(_0x2046c5,null))[_0x4b95('0x3b')](handleError(_0x2046c5,null));};exports[_0x4b95('0x11')]=function(_0x47c241,_0x47234b){return db[_0x4b95('0x31')][_0x4b95('0x3a')]({'where':{'id':_0x47c241[_0x4b95('0x39')]['id']}})[_0x4b95('0x12')](handleEntityNotFound(_0x47234b,null))[_0x4b95('0x12')](removeEntity(_0x47234b,null))[_0x4b95('0x3b')](handleError(_0x47234b,null));};exports['oauth2MicrosoftAuthorize']=function(_0x1f1158,_0x3cfccc){return db[_0x4b95('0x31')]['findOne']({'where':{'id':_0x1f1158['params']['id']},'raw':!![]})[_0x4b95('0x12')](function(_0x3b0813){if(!_0x3b0813)return _0x3cfccc[_0x4b95('0x9')](0x194);return{'url':oauth[_0x4b95('0x44')](_0x3b0813,_0x1f1158['user']['id'])};})[_0x4b95('0x12')](respondWithResult(_0x3cfccc,null))[_0x4b95('0x3b')](handleError(_0x3cfccc,null));};exports[_0x4b95('0x45')]=function(_0x4a587b,_0x1b841c){var _0x4b6f62=_0x4a587b[_0x4b95('0x3d')];var _0x88c12;var _0x31a865;if(_0x4b6f62['error'])throw _0x4b6f62;redis[_0x4b95('0x46')](_0x4b6f62['state'])[_0x4b95('0x12')](function(_0x503f65){if(!_0x503f65)throw new Error(_0x4b95('0x47'));_0x88c12=JSON[_0x4b95('0x48')](_0x503f65);var _0x3de334=Buffer[_0x4b95('0x49')](_0x4b6f62[_0x4b95('0x4a')],_0x4b95('0x4b'))[_0x4b95('0x4c')](_0x4b95('0x4d'));_0x31a865=JSON[_0x4b95('0x48')](_0x3de334);if(!oauth[_0x4b95('0x4e')](_0x4b6f62[_0x4b95('0x4f')],_0x88c12[_0x4b95('0x50')]))throw new Error(_0x4b95('0x51'));redis[_0x4b95('0x52')](_0x4b6f62[_0x4b95('0x4a')]);return oauth[_0x4b95('0x53')](_0x4b6f62[_0x4b95('0x54')],_0x88c12);})['then'](function(_0x10afcb){_0x88c12[_0x4b95('0x55')]=_0x10afcb[_0x4b95('0x56')];_0x88c12[_0x4b95('0x57')]=_0x10afcb['refresh_token'];return db['CloudProvider']['update']({'data5':_0x88c12['data5'],'data6':_0x88c12[_0x4b95('0x57')]},{'where':{'id':_0x88c12['id']}});})[_0x4b95('0x12')](function(){oauth['startRefreshInterval'](_0x88c12);socket['emit'](_0x4b95('0x58'),{'id':_0x31a865['id']});return;})[_0x4b95('0x12')](respondWithStatusCode(_0x1b841c,null))['catch'](function(_0x491328){if(_0x31a865){socket['emit'](_0x4b95('0x59'),{'id':_0x31a865['id']});}if(!_0x88c12){logger['error'](_0x4b95('0x5a'),_0x491328);return _0x1b841c[_0x4b95('0xa')](0x1f4)[_0x4b95('0x15')](_0x491328[_0x4b95('0x5b')]);}logger[_0x4b95('0x5c')](_0x4b95('0x5d'),_0x88c12['id'],JSON[_0x4b95('0x5e')](_0x491328));});}; \ No newline at end of file +var _0xe8e0=['intersection','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','decryptString','data3','catch','show','params','keys','service','create','body','values','includes','MicrosoftAzure','find','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','then','error','name','send','padEnd','slice','map','CloudProvider','rawAttributes','type','model','query','filters','attributes'];(function(_0x4b124d,_0x15e140){var _0x14af9e=function(_0x4e510d){while(--_0x4e510d){_0x4b124d['push'](_0x4b124d['shift']());}};_0x14af9e(++_0x15e140);}(_0xe8e0,0x89));var _0x0e8e=function(_0x48c049,_0x1d0140){_0x48c049=_0x48c049-0x0;var _0x7b1e42=_0xe8e0[_0x48c049];return _0x7b1e42;};'use strict';var _=require(_0x0e8e('0x0'));var Redis=require(_0x0e8e('0x1'));var qs=require(_0x0e8e('0x2'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x0e8e('0x3'))('api');var db=require(_0x0e8e('0x4'))['db'];var oauth=require(_0x0e8e('0x5'));config[_0x0e8e('0x6')]=_[_0x0e8e('0x7')](config[_0x0e8e('0x6')],{'host':_0x0e8e('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0e8e('0x6')]));var redis=new Redis(config[_0x0e8e('0x6')]);function respondWithStatusCode(_0x35e69b,_0x1442aa){_0x1442aa=_0x1442aa||0xcc;return function(_0x2725ce){if(_0x2725ce){return _0x35e69b[_0x0e8e('0x9')](_0x1442aa);}return _0x35e69b[_0x0e8e('0xa')](_0x1442aa)[_0x0e8e('0xb')]();};}function respondWithResult(_0x29830a,_0x457047){_0x457047=_0x457047||0xc8;return function(_0x12ba83){if(_0x12ba83){return _0x29830a[_0x0e8e('0xa')](_0x457047)[_0x0e8e('0xc')](_0x12ba83);}};}function respondWithFilteredResult(_0x530f7e,_0x30754b){return function(_0x55ba50){if(_0x55ba50){var _0x508b8a=typeof _0x30754b['offset']===_0x0e8e('0xd')&&typeof _0x30754b[_0x0e8e('0xe')]===_0x0e8e('0xd');var _0x5ac680=_0x55ba50[_0x0e8e('0xf')];var _0x2feae7=_0x508b8a?0x0:_0x30754b[_0x0e8e('0x10')];var _0xfdc1ce=_0x508b8a?_0x55ba50[_0x0e8e('0xf')]:_0x30754b[_0x0e8e('0x10')]+_0x30754b[_0x0e8e('0xe')];var _0x118646;if(_0xfdc1ce>=_0x5ac680){_0xfdc1ce=_0x5ac680;_0x118646=0xc8;}else{_0x118646=0xce;}_0x530f7e[_0x0e8e('0xa')](_0x118646);return _0x530f7e[_0x0e8e('0x11')](_0x0e8e('0x12'),_0x2feae7+'-'+_0xfdc1ce+'/'+_0x5ac680)[_0x0e8e('0xc')](_0x55ba50);}return null;};}function saveUpdates(_0x3c7979){return function(_0x4a555e){if(_0x4a555e){return _0x4a555e[_0x0e8e('0x13')](_0x3c7979)['then'](function(_0x1dea17){return _0x1dea17;});}return null;};}function removeEntity(_0x2810a7){return function(_0x544d54){if(_0x544d54){return _0x544d54[_0x0e8e('0x14')]()[_0x0e8e('0x15')](function(){_0x2810a7[_0x0e8e('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17c2a6){return function(_0x56d5d0){if(!_0x56d5d0){_0x17c2a6[_0x0e8e('0x9')](0x194);}return _0x56d5d0;};}function handleError(_0x3af646,_0x2e4f5a){_0x2e4f5a=_0x2e4f5a||0x1f4;return function(_0x2df1af){logger[_0x0e8e('0x16')](_0x2df1af['stack']);if(_0x2df1af[_0x0e8e('0x17')]){delete _0x2df1af[_0x0e8e('0x17')];}_0x3af646['status'](_0x2e4f5a)[_0x0e8e('0x18')](_0x2df1af);};}function maskClientSecret(_0xfab4a0){return _[_0x0e8e('0x19')](_0xfab4a0[_0x0e8e('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0x4c945b,_0x3037fd){var _0x2b01b6={},_0x43f8a2={},_0x1142d7={'count':0x0,'rows':[]};var _0x5c5137=_[_0x0e8e('0x1b')](db[_0x0e8e('0x1c')][_0x0e8e('0x1d')],function(_0x1707d4){return{'name':_0x1707d4['fieldName'],'type':_0x1707d4[_0x0e8e('0x1e')]['key']};});_0x43f8a2[_0x0e8e('0x1f')]=_[_0x0e8e('0x1b')](_0x5c5137,_0x0e8e('0x17'));_0x43f8a2[_0x0e8e('0x20')]=_['keys'](_0x4c945b[_0x0e8e('0x20')]);_0x43f8a2[_0x0e8e('0x21')]=_['intersection'](_0x43f8a2[_0x0e8e('0x1f')],_0x43f8a2['query']);_0x2b01b6[_0x0e8e('0x22')]=_[_0x0e8e('0x23')](_0x43f8a2[_0x0e8e('0x1f')],qs[_0x0e8e('0x24')](_0x4c945b[_0x0e8e('0x20')][_0x0e8e('0x24')]));_0x2b01b6['attributes']=_0x2b01b6['attributes'][_0x0e8e('0x25')]?_0x2b01b6[_0x0e8e('0x22')]:_0x43f8a2[_0x0e8e('0x1f')];if(!_0x4c945b[_0x0e8e('0x20')]['hasOwnProperty'](_0x0e8e('0x26'))){_0x2b01b6[_0x0e8e('0xe')]=qs[_0x0e8e('0xe')](_0x4c945b['query']['limit']);_0x2b01b6[_0x0e8e('0x10')]=qs[_0x0e8e('0x10')](_0x4c945b[_0x0e8e('0x20')][_0x0e8e('0x10')]);}_0x2b01b6['order']=qs[_0x0e8e('0x27')](_0x4c945b['query'][_0x0e8e('0x27')]);_0x2b01b6['where']=qs[_0x0e8e('0x21')](_[_0x0e8e('0x28')](_0x4c945b[_0x0e8e('0x20')],_0x43f8a2[_0x0e8e('0x21')]),_0x5c5137);if(_0x4c945b[_0x0e8e('0x20')][_0x0e8e('0x29')]){_0x2b01b6[_0x0e8e('0x2a')]=_[_0x0e8e('0x2b')](_0x2b01b6[_0x0e8e('0x2a')],{'$or':_[_0x0e8e('0x1b')](_0x5c5137,function(_0x3a46b9){if(_0x3a46b9['type']!==_0x0e8e('0x2c')){var _0x2f1028={};_0x2f1028[_0x3a46b9[_0x0e8e('0x17')]]={'$like':'%'+_0x4c945b[_0x0e8e('0x20')][_0x0e8e('0x29')]+'%'};return _0x2f1028;}})});}_0x2b01b6=_[_0x0e8e('0x2b')]({},_0x2b01b6,_0x4c945b[_0x0e8e('0x2d')]);var _0x5787e1={'where':_0x2b01b6[_0x0e8e('0x2a')]};return db[_0x0e8e('0x1c')][_0x0e8e('0xf')](_0x5787e1)[_0x0e8e('0x15')](function(_0xef0b26){_0x1142d7[_0x0e8e('0xf')]=_0xef0b26;if(_0x4c945b[_0x0e8e('0x20')][_0x0e8e('0x2e')]){_0x2b01b6[_0x0e8e('0x2f')]=[{'all':!![]}];}return db[_0x0e8e('0x1c')][_0x0e8e('0x30')](_0x2b01b6);})[_0x0e8e('0x15')](function(_0x5e7530){_0x1142d7['rows']=_[_0x0e8e('0x1b')](_0x5e7530,function(_0x45c735){if(_0x45c735['service']==='MicrosoftAzure'){var _0x50a2b8=encryptor[_0x0e8e('0x31')](_0x45c735[_0x0e8e('0x32')]);_0x45c735[_0x0e8e('0x32')]=maskClientSecret(_0x50a2b8);}return _0x45c735;});return _0x1142d7;})[_0x0e8e('0x15')](respondWithFilteredResult(_0x3037fd,_0x2b01b6))[_0x0e8e('0x33')](handleError(_0x3037fd,null));};exports[_0x0e8e('0x34')]=function(_0x37e2cd,_0x1ab1ec){var _0x2faa45={'raw':!![],'where':{'id':_0x37e2cd[_0x0e8e('0x35')]['id']}},_0x5b9b40={};_0x5b9b40[_0x0e8e('0x1f')]=_[_0x0e8e('0x36')](db['CloudProvider'][_0x0e8e('0x1d')]);_0x5b9b40['query']=_['keys'](_0x37e2cd[_0x0e8e('0x20')]);_0x5b9b40[_0x0e8e('0x21')]=_[_0x0e8e('0x23')](_0x5b9b40['model'],_0x5b9b40[_0x0e8e('0x20')]);_0x2faa45[_0x0e8e('0x22')]=_[_0x0e8e('0x23')](_0x5b9b40['model'],qs[_0x0e8e('0x24')](_0x37e2cd['query'][_0x0e8e('0x24')]));_0x2faa45[_0x0e8e('0x22')]=_0x2faa45[_0x0e8e('0x22')][_0x0e8e('0x25')]?_0x2faa45[_0x0e8e('0x22')]:_0x5b9b40['model'];if(_0x37e2cd[_0x0e8e('0x20')][_0x0e8e('0x2e')]){_0x2faa45['include']=[{'all':!![]}];}_0x2faa45=_['merge']({},_0x2faa45,_0x37e2cd['options']);return db['CloudProvider']['find'](_0x2faa45)[_0x0e8e('0x15')](handleEntityNotFound(_0x1ab1ec,null))[_0x0e8e('0x15')](function(_0x1a2c97){if(_0x1a2c97[_0x0e8e('0x37')]==='MicrosoftAzure'){var _0x48dc27=encryptor[_0x0e8e('0x31')](_0x1a2c97[_0x0e8e('0x32')]);_0x1a2c97[_0x0e8e('0x32')]=maskClientSecret(_0x48dc27);}return _0x1a2c97;})[_0x0e8e('0x15')](respondWithResult(_0x1ab1ec,null))['catch'](handleError(_0x1ab1ec,null));};exports[_0x0e8e('0x38')]=function(_0x1f6108,_0x4ff5ac){if(!_0x1f6108['body'][_0x0e8e('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x1f6108[_0x0e8e('0x39')][_0x0e8e('0x37')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x27b0a5=db[_0x0e8e('0x1c')][_0x0e8e('0x1d')][_0x0e8e('0x37')][_0x0e8e('0x3a')];if(!_0x27b0a5[_0x0e8e('0x3b')](_0x1f6108[_0x0e8e('0x39')][_0x0e8e('0x37')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x27b0a5['join'](',\x20'));if(_0x1f6108[_0x0e8e('0x39')][_0x0e8e('0x37')]===_0x0e8e('0x3c')&&_0x1f6108['body'][_0x0e8e('0x32')]){_0x1f6108[_0x0e8e('0x39')][_0x0e8e('0x32')]=encryptor['encryptString'](_0x1f6108[_0x0e8e('0x39')][_0x0e8e('0x32')]);}return db[_0x0e8e('0x1c')][_0x0e8e('0x38')](_0x1f6108[_0x0e8e('0x39')],{})[_0x0e8e('0x15')](respondWithResult(_0x4ff5ac,0xc9))[_0x0e8e('0x33')](handleError(_0x4ff5ac,null));};exports[_0x0e8e('0x13')]=function(_0x28bf8d,_0x1eca7d){if(_0x28bf8d[_0x0e8e('0x39')]['id']){delete _0x28bf8d[_0x0e8e('0x39')]['id'];}return db[_0x0e8e('0x1c')][_0x0e8e('0x3d')]({'where':{'id':_0x28bf8d[_0x0e8e('0x35')]['id']}})['then'](handleEntityNotFound(_0x1eca7d,null))[_0x0e8e('0x15')](function(_0x37c6dc){if(_0x37c6dc[_0x0e8e('0x37')]==='MicrosoftAzure'&&_0x28bf8d[_0x0e8e('0x39')][_0x0e8e('0x32')]){_0x28bf8d[_0x0e8e('0x39')][_0x0e8e('0x32')]=encryptor['encryptString'](_0x28bf8d[_0x0e8e('0x39')][_0x0e8e('0x32')]);}return _0x37c6dc;})['then'](saveUpdates(_0x28bf8d[_0x0e8e('0x39')],null))[_0x0e8e('0x15')](respondWithResult(_0x1eca7d,null))[_0x0e8e('0x33')](handleError(_0x1eca7d,null));};exports[_0x0e8e('0x14')]=function(_0x968720,_0x2c1bd5){return db[_0x0e8e('0x1c')][_0x0e8e('0x3d')]({'where':{'id':_0x968720['params']['id']}})[_0x0e8e('0x15')](handleEntityNotFound(_0x2c1bd5,null))['then'](removeEntity(_0x2c1bd5,null))['catch'](handleError(_0x2c1bd5,null));};exports[_0x0e8e('0x3e')]=function(_0x293e39,_0x14e5ee){return db[_0x0e8e('0x1c')][_0x0e8e('0x3f')]({'where':{'id':_0x293e39[_0x0e8e('0x35')]['id']},'raw':!![]})['then'](function(_0x140601){if(!_0x140601)return _0x14e5ee['sendStatus'](0x194);return{'url':oauth[_0x0e8e('0x40')](_0x140601,_0x293e39[_0x0e8e('0x41')]['id'])};})['then'](respondWithResult(_0x14e5ee,null))['catch'](handleError(_0x14e5ee,null));};exports['oauth2MicrosoftCallback']=function(_0x395734,_0x5e8bcd){var _0x2601a3=_0x395734[_0x0e8e('0x39')];var _0x42b1b3;var _0x34bbc8;if(_0x2601a3[_0x0e8e('0x16')])throw _0x2601a3;redis[_0x0e8e('0x42')](_0x2601a3[_0x0e8e('0x43')])[_0x0e8e('0x15')](function(_0x2ab119){if(!_0x2ab119)throw new Error(_0x0e8e('0x44'));_0x42b1b3=JSON[_0x0e8e('0x45')](_0x2ab119);var _0x586684=Buffer[_0x0e8e('0x46')](_0x2601a3[_0x0e8e('0x43')],_0x0e8e('0x47'))['toString'](_0x0e8e('0x48'));_0x34bbc8=JSON['parse'](_0x586684);if(!oauth['isValidIdToken'](_0x2601a3[_0x0e8e('0x49')],_0x42b1b3[_0x0e8e('0x4a')]))throw new Error(_0x0e8e('0x4b'));redis['del'](_0x2601a3['state']);return oauth[_0x0e8e('0x4c')](_0x2601a3[_0x0e8e('0x4d')],_0x42b1b3);})[_0x0e8e('0x15')](function(_0x51379f){_0x42b1b3[_0x0e8e('0x4e')]=_0x51379f['access_token'];_0x42b1b3['data6']=_0x51379f['refresh_token'];return db[_0x0e8e('0x1c')][_0x0e8e('0x13')]({'data5':_0x42b1b3[_0x0e8e('0x4e')],'data6':_0x42b1b3['data6']},{'where':{'id':_0x42b1b3['id']}});})['then'](function(){oauth[_0x0e8e('0x4f')](_0x42b1b3);socket[_0x0e8e('0x50')](_0x0e8e('0x51'),{'id':_0x34bbc8['id']});return;})[_0x0e8e('0x15')](respondWithStatusCode(_0x5e8bcd,null))['catch'](function(_0x51c8bf){if(_0x34bbc8){socket[_0x0e8e('0x50')](_0x0e8e('0x52'),{'id':_0x34bbc8['id']});}if(!_0x42b1b3){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x51c8bf);return _0x5e8bcd['status'](0x1f4)[_0x0e8e('0x18')](_0x51c8bf[_0x0e8e('0x53')]);}logger[_0x0e8e('0x16')](_0x0e8e('0x54'),_0x42b1b3['id'],JSON[_0x0e8e('0x55')](_0x51c8bf));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 876b7fd..5d3ce6d 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 _0xc152=['cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise','path','./cloudProvider.attributes','define','CloudProvider'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0xc152,0x1da));var _0x2c15=function(_0xc137a4,_0x14ec73){_0xc137a4=_0xc137a4-0x0;var _0x1ba492=_0xc152[_0xc137a4];return _0x1ba492;};'use strict';var _=require(_0x2c15('0x0'));var util=require(_0x2c15('0x1'));var logger=require(_0x2c15('0x2'))(_0x2c15('0x3'));var moment=require('moment');var BPromise=require(_0x2c15('0x4'));var rp=require(_0x2c15('0x5'));var fs=require('fs');var path=require(_0x2c15('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2c15('0x7'));module['exports']=function(_0x327ae7,_0xf7d4dc){return _0x327ae7[_0x2c15('0x8')](_0x2c15('0x9'),attributes,{'tableName':_0x2c15('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1612=['cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider'];(function(_0x158dd7,_0x1f5f90){var _0x1772ba=function(_0x20cbf1){while(--_0x20cbf1){_0x158dd7['push'](_0x158dd7['shift']());}};_0x1772ba(++_0x1f5f90);}(_0x1612,0x100));var _0x2161=function(_0x2b824d,_0x424788){_0x2b824d=_0x2b824d-0x0;var _0x573ed4=_0x1612[_0x2b824d];return _0x573ed4;};'use strict';var _=require(_0x2161('0x0'));var util=require(_0x2161('0x1'));var logger=require(_0x2161('0x2'))(_0x2161('0x3'));var moment=require(_0x2161('0x4'));var BPromise=require(_0x2161('0x5'));var rp=require(_0x2161('0x6'));var fs=require('fs');var path=require(_0x2161('0x7'));var rimraf=require(_0x2161('0x8'));var config=require(_0x2161('0x9'));var attributes=require(_0x2161('0xa'));module[_0x2161('0xb')]=function(_0x530ada,_0x1f56e6){return _0x530ada[_0x2161('0xc')](_0x2161('0xd'),attributes,{'tableName':_0x2161('0xe'),'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 9743b79..feaa1d8 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 _0xd92c=['email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token','type','push','join','Outlook365','Dynamics365','data7','replace','{TENANT_ID}','data2','code','id_token','from','toString','base64','randomBytes','hex','data1','response_type','redirect_uri','form_post','nonce','prompt','login','map','oauth2Claims','oauth2/','stringify','payload','iss','issuer','aud','audience','isAfter','unix','data3','findOne','refresh_token','data6','data4','decryptString','then','data5','access_token','CloudProvider','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','all','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xd92c,0x1c4));var _0xcd92=function(_0xfea291,_0x577c43){_0xfea291=_0xfea291-0x0;var _0x46f868=_0xd92c[_0xfea291];return _0x46f868;};'use strict';var _=require(_0xcd92('0x0'));var crypto=require('crypto');var jwt=require(_0xcd92('0x1'));var moment=require(_0xcd92('0x2'));var Redis=require(_0xcd92('0x3'));var rp=require('request-promise');var util=require(_0xcd92('0x4'));var encryptor=require(_0xcd92('0x5'));var config=require(_0xcd92('0x6'));var logger=require(_0xcd92('0x7'))(_0xcd92('0x8'));var schedule=require(_0xcd92('0x9'));var db=require(_0xcd92('0xa'))['db'];config[_0xcd92('0xb')]=_[_0xcd92('0xc')](config[_0xcd92('0xb')],{'host':_0xcd92('0xd'),'port':0x18eb});var redis=new Redis(config[_0xcd92('0xb')]);var MICROSOFT_AUTH_URL=_0xcd92('0xe');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xcd92('0xf'),_0xcd92('0x10'),_0xcd92('0x11'),_0xcd92('0x12'),_0xcd92('0x13'),_0xcd92('0x14')],'Dynamics365':[_0xcd92('0x15'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xcd92('0x16');var MICROSOFT_TOKEN_ENDPOINT=_0xcd92('0x17');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3514d7){var _0x4c8fca=_['map'](AZURE_AUTH_SCOPES[_0x3514d7['type']]);if(_0x3514d7[_0xcd92('0x18')]==='Dynamics365')_0x4c8fca[_0xcd92('0x19')](_0x3514d7['data7']+'/.default');return _0x4c8fca[_0xcd92('0x1a')]('\x20');}function getAccessTokenScope(_0x4fec1b){if(_0x4fec1b[_0xcd92('0x18')]===_0xcd92('0x1b'))return _0xcd92('0x12');if(_0x4fec1b['type']===_0xcd92('0x1c'))return _0x4fec1b[_0xcd92('0x1d')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x365e40,_0x535cf0){var _0xa6ee05=MICROSOFT_AUTH_URL[_0xcd92('0x1e')](_0xcd92('0x1f'),_0x365e40[_0xcd92('0x20')]);var _0x265542=[_0xcd92('0x21'),_0xcd92('0x22')];var _0x24ea44=Buffer[_0xcd92('0x23')](JSON['stringify']({'id':_0x535cf0}))[_0xcd92('0x24')](_0xcd92('0x25'));var _0x534ba2=crypto[_0xcd92('0x26')](0x10)[_0xcd92('0x24')](_0xcd92('0x27'));var _0x4b834a=getAuthorizationScopes(_0x365e40);var _0x76b3c7=[{'key':'client_id','value':_0x365e40[_0xcd92('0x28')]},{'key':_0xcd92('0x29'),'value':encodeURIComponent(_0x265542[_0xcd92('0x1a')]('\x20'))},{'key':_0xcd92('0x2a'),'value':_0x365e40['data4']},{'key':'response_mode','value':_0xcd92('0x2b')},{'key':'scope','value':encodeURIComponent(_0x4b834a)},{'key':'state','value':_0x24ea44},{'key':_0xcd92('0x2c'),'value':_0x534ba2},{'key':_0xcd92('0x2d'),'value':_0xcd92('0x2e')}];var _0x21ce40=_0xa6ee05+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xcd92('0x2f')](_0x76b3c7,function(_0x196b03){return _0x196b03['key']+'='+_0x196b03['value'];})[_0xcd92('0x1a')]('&');_0x365e40[_0xcd92('0x30')]={'issuer':_0xa6ee05[_0xcd92('0x1e')](_0xcd92('0x31'),''),'audience':_0x365e40[_0xcd92('0x28')],'state':_0x24ea44,'nonce':_0x534ba2};redis['set'](_0x24ea44,JSON[_0xcd92('0x32')](_0x365e40));return _0x21ce40;}function isValidIdToken(_0x197a5a,_0x649d9b){try{var _0x520e7d=jwt['decode'](_0x197a5a,{'complete':!![]});var _0x3cd683=_0x520e7d[_0xcd92('0x33')];if(_0x3cd683[_0xcd92('0x34')]!==_0x649d9b[_0xcd92('0x35')])return![];if(_0x3cd683[_0xcd92('0x36')]!==_0x649d9b[_0xcd92('0x37')])return![];if(_0x3cd683[_0xcd92('0x2c')]!==_0x649d9b[_0xcd92('0x2c')])return![];if(moment()[_0xcd92('0x38')](moment[_0xcd92('0x39')](_0x3cd683['exp'])))return![];return!![];}catch(_0x230cf8){throw _0x230cf8;}}function refreshOauth2MicrosoftAccessToken(_0x113782){return Promise['resolve']()['then'](function(){if(_0x113782[_0xcd92('0x3a')])return _0x113782;return db['CloudProvider'][_0xcd92('0x3b')]({'where':{'id':_0x113782['id']},'raw':!![]});})['then'](function(_0x272f4a){var _0x25012d={'grant_type':_0xcd92('0x3c'),'refresh_token':_0x272f4a[_0xcd92('0x3d')],'scope':getAccessTokenScope(_0x272f4a),'redirect_uri':_0x272f4a[_0xcd92('0x3e')],'client_id':_0x272f4a[_0xcd92('0x28')],'client_secret':encryptor[_0xcd92('0x3f')](_0x272f4a[_0xcd92('0x3a')])};var _0x216c80={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0xcd92('0x1f'),_0x272f4a[_0xcd92('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x25012d,'json':!![]};return rp(_0x216c80);})[_0xcd92('0x40')](function(_0x4d22a4){_0x113782[_0xcd92('0x41')]=_0x4d22a4[_0xcd92('0x42')];_0x113782[_0xcd92('0x3d')]=_0x4d22a4[_0xcd92('0x3c')];return db[_0xcd92('0x43')][_0xcd92('0x44')]({'data5':_0x113782[_0xcd92('0x41')],'data6':_0x113782[_0xcd92('0x3d')]},{'where':{'id':_0x113782['id']}});})[_0xcd92('0x40')](function(){return _0x113782;})[_0xcd92('0x45')](function(_0x83b4fa){logger['error'](_0xcd92('0x46'),_0x113782['id'],_0x83b4fa);});}function getOauth2MicrosoftAccessToken(_0x57b265,_0x25a2b5){var _0x1f7bcf={'grant_type':_0xcd92('0x47'),'code':_0x57b265,'scope':getAccessTokenScope(_0x25a2b5),'redirect_uri':_0x25a2b5[_0xcd92('0x3e')],'client_id':_0x25a2b5[_0xcd92('0x28')],'client_secret':encryptor[_0xcd92('0x3f')](_0x25a2b5['data3'])};var _0x504ab1={'method':_0xcd92('0x48'),'uri':MICROSOFT_AUTH_URL[_0xcd92('0x1e')](_0xcd92('0x1f'),_0x25a2b5[_0xcd92('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1f7bcf,'json':!![]};return rp(_0x504ab1);}function startRefreshInterval(_0x35004b){var _0x119715=schedule[_0xcd92('0x49')];if(_0x119715[_0x35004b['id']])clearInterval(_0x119715[_0x35004b['id']]);_0x119715[_0x35004b['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x35004b['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xcd92('0x49')]=_0x119715;}function startAllRefreshIntervals(){return db[_0xcd92('0x43')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xcd92('0x40')](function(_0x41f419){var _0xcf3dfd=_0x41f419['map'](function(_0x2130fd){return refreshOauth2MicrosoftAccessToken(_0x2130fd)[_0xcd92('0x40')](function(_0x4cb9c5){startRefreshInterval(_0x4cb9c5);});});return Promise[_0xcd92('0x4a')](_0xcf3dfd);})[_0xcd92('0x45')](function(_0x2034cb){var _0x328bc0=_0x2034cb?util['inspect'](_0x2034cb,{'showHidden':![],'depth':null}):'';logger[_0xcd92('0x4b')](_0xcd92('0x4c'),_0x328bc0);});}module[_0xcd92('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xdae0=['type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','{TENANT_ID}','data2','code','id_token','from','stringify','base64','toString','hex','response_type','redirect_uri','response_mode','form_post','prompt','key','replace','oauth2/','data1','set','decode','payload','aud','audience','nonce','isAfter','unix','exp','resolve','then','CloudProvider','refresh_token','data6','data4','decryptString','data3','POST','data5','catch','error','authorization_code','intervals','bind','all','inspect','exports','crypto','moment','ioredis','request-promise','util','../../components/encryptor','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office.com/SMTP.Send','/authorize','/token'];(function(_0xd936bb,_0x3a0d73){var _0x4a13b5=function(_0x14379f){while(--_0x14379f){_0xd936bb['push'](_0xd936bb['shift']());}};_0x4a13b5(++_0x3a0d73);}(_0xdae0,0x1df));var _0x0dae=function(_0x3a1a7e,_0x171a36){_0x3a1a7e=_0x3a1a7e-0x0;var _0x40c795=_0xdae0[_0x3a1a7e];return _0x40c795;};'use strict';var _=require('lodash');var crypto=require(_0x0dae('0x0'));var jwt=require('jsonwebtoken');var moment=require(_0x0dae('0x1'));var Redis=require(_0x0dae('0x2'));var rp=require(_0x0dae('0x3'));var util=require(_0x0dae('0x4'));var encryptor=require(_0x0dae('0x5'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x0dae('0x6'));var schedule=require(_0x0dae('0x7'));var db=require(_0x0dae('0x8'))['db'];config[_0x0dae('0x9')]=_['defaults'](config[_0x0dae('0x9')],{'host':_0x0dae('0xa'),'port':0x18eb});var redis=new Redis(config[_0x0dae('0x9')]);var MICROSOFT_AUTH_URL=_0x0dae('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0x0dae('0xc'),'profile',_0x0dae('0xd'),_0x0dae('0xe'),'https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All',_0x0dae('0xf')],'Dynamics365':[_0x0dae('0xc'),_0x0dae('0xe')]};var MICROSOFT_AUTH_ENDPOINT=_0x0dae('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0x0dae('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x7d7607){var _0x3823ce=_['map'](AZURE_AUTH_SCOPES[_0x7d7607[_0x0dae('0x12')]]);if(_0x7d7607[_0x0dae('0x12')]===_0x0dae('0x13'))_0x3823ce[_0x0dae('0x14')](_0x7d7607[_0x0dae('0x15')]+_0x0dae('0x16'));return _0x3823ce[_0x0dae('0x17')]('\x20');}function getAccessTokenScope(_0x402400){if(_0x402400[_0x0dae('0x12')]===_0x0dae('0x18'))return _0x0dae('0x19');if(_0x402400[_0x0dae('0x12')]===_0x0dae('0x13'))return _0x402400[_0x0dae('0x15')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x4610f2,_0x216839){var _0x3159fb=MICROSOFT_AUTH_URL['replace'](_0x0dae('0x1a'),_0x4610f2[_0x0dae('0x1b')]);var _0x1e1b22=[_0x0dae('0x1c'),_0x0dae('0x1d')];var _0x1619da=Buffer[_0x0dae('0x1e')](JSON[_0x0dae('0x1f')]({'id':_0x216839}))['toString'](_0x0dae('0x20'));var _0x3c8bb3=crypto['randomBytes'](0x10)[_0x0dae('0x21')](_0x0dae('0x22'));var _0x2854bd=getAuthorizationScopes(_0x4610f2);var _0x3e7653=[{'key':'client_id','value':_0x4610f2['data1']},{'key':_0x0dae('0x23'),'value':encodeURIComponent(_0x1e1b22[_0x0dae('0x17')]('\x20'))},{'key':_0x0dae('0x24'),'value':_0x4610f2['data4']},{'key':_0x0dae('0x25'),'value':_0x0dae('0x26')},{'key':'scope','value':encodeURIComponent(_0x2854bd)},{'key':'state','value':_0x1619da},{'key':'nonce','value':_0x3c8bb3},{'key':_0x0dae('0x27'),'value':'login'}];var _0x46eb65=_0x3159fb+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x3e7653,function(_0x198715){return _0x198715[_0x0dae('0x28')]+'='+_0x198715['value'];})[_0x0dae('0x17')]('&');_0x4610f2['oauth2Claims']={'issuer':_0x3159fb[_0x0dae('0x29')](_0x0dae('0x2a'),''),'audience':_0x4610f2[_0x0dae('0x2b')],'state':_0x1619da,'nonce':_0x3c8bb3};redis[_0x0dae('0x2c')](_0x1619da,JSON['stringify'](_0x4610f2));return _0x46eb65;}function isValidIdToken(_0x28b901,_0x2c2bad){try{var _0x36ed44=jwt[_0x0dae('0x2d')](_0x28b901,{'complete':!![]});var _0x7e7e78=_0x36ed44[_0x0dae('0x2e')];if(_0x7e7e78['iss']!==_0x2c2bad['issuer'])return![];if(_0x7e7e78[_0x0dae('0x2f')]!==_0x2c2bad[_0x0dae('0x30')])return![];if(_0x7e7e78[_0x0dae('0x31')]!==_0x2c2bad[_0x0dae('0x31')])return![];if(moment()[_0x0dae('0x32')](moment[_0x0dae('0x33')](_0x7e7e78[_0x0dae('0x34')])))return![];return!![];}catch(_0x30f4b3){throw _0x30f4b3;}}function refreshOauth2MicrosoftAccessToken(_0x3d1a54){return Promise[_0x0dae('0x35')]()[_0x0dae('0x36')](function(){if(_0x3d1a54['data3'])return _0x3d1a54;return db[_0x0dae('0x37')]['findOne']({'where':{'id':_0x3d1a54['id']},'raw':!![]});})[_0x0dae('0x36')](function(_0x5218e7){var _0x4a1834={'grant_type':_0x0dae('0x38'),'refresh_token':_0x5218e7[_0x0dae('0x39')],'scope':getAccessTokenScope(_0x5218e7),'redirect_uri':_0x5218e7[_0x0dae('0x3a')],'client_id':_0x5218e7[_0x0dae('0x2b')],'client_secret':encryptor[_0x0dae('0x3b')](_0x5218e7[_0x0dae('0x3c')])};var _0x298ed7={'method':_0x0dae('0x3d'),'uri':MICROSOFT_AUTH_URL[_0x0dae('0x29')]('{TENANT_ID}',_0x5218e7['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4a1834,'json':!![]};return rp(_0x298ed7);})[_0x0dae('0x36')](function(_0x5ae4f7){_0x3d1a54['data5']=_0x5ae4f7['access_token'];_0x3d1a54[_0x0dae('0x39')]=_0x5ae4f7[_0x0dae('0x38')];return db[_0x0dae('0x37')]['update']({'data5':_0x3d1a54[_0x0dae('0x3e')],'data6':_0x3d1a54['data6']},{'where':{'id':_0x3d1a54['id']}});})['then'](function(){return _0x3d1a54;})[_0x0dae('0x3f')](function(_0x1719db){logger[_0x0dae('0x40')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x3d1a54['id'],_0x1719db);});}function getOauth2MicrosoftAccessToken(_0x3300be,_0x4840a6){var _0x3ab5eb={'grant_type':_0x0dae('0x41'),'code':_0x3300be,'scope':getAccessTokenScope(_0x4840a6),'redirect_uri':_0x4840a6['data4'],'client_id':_0x4840a6[_0x0dae('0x2b')],'client_secret':encryptor[_0x0dae('0x3b')](_0x4840a6[_0x0dae('0x3c')])};var _0x2395f6={'method':_0x0dae('0x3d'),'uri':MICROSOFT_AUTH_URL['replace'](_0x0dae('0x1a'),_0x4840a6[_0x0dae('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3ab5eb,'json':!![]};return rp(_0x2395f6);}function startRefreshInterval(_0x499979){var _0x206008=schedule[_0x0dae('0x42')];if(_0x206008[_0x499979['id']])clearInterval(_0x206008[_0x499979['id']]);_0x206008[_0x499979['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x0dae('0x43')](this,{'id':_0x499979['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x0dae('0x42')]=_0x206008;}function startAllRefreshIntervals(){return db[_0x0dae('0x37')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x23e7b5){var _0x4bf2fd=_0x23e7b5['map'](function(_0x341401){return refreshOauth2MicrosoftAccessToken(_0x341401)['then'](function(_0x5246a1){startRefreshInterval(_0x5246a1);});});return Promise[_0x0dae('0x44')](_0x4bf2fd);})['catch'](function(_0x4fa394){var _0xa2b660=_0x4fa394?util[_0x0dae('0x45')](_0x4fa394,{'showHidden':![],'depth':null}):'';logger[_0x0dae('0x40')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0xa2b660);});}module[_0x0dae('0x46')]={'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 e157212..81199d6 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 _0xc17d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4f5607,_0x5a51e4){var _0x5a7446=function(_0x487274){while(--_0x487274){_0x4f5607['push'](_0x4f5607['shift']());}};_0x5a7446(++_0x5a51e4);}(_0xc17d,0x96));var _0xdc17=function(_0x424489,_0xa114b7){_0x424489=_0x424489-0x0;var _0x1b81a3=_0xc17d[_0x424489];return _0x1b81a3;};'use strict';var _=require(_0xdc17('0x0'));var util=require(_0xdc17('0x1'));var moment=require(_0xdc17('0x2'));var BPromise=require(_0xdc17('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc17('0x4'));var db=require(_0xdc17('0x5'))['db'];var utils=require(_0xdc17('0x6'));var logger=require(_0xdc17('0x7'))('rpc');var config=require(_0xdc17('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdc17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52a11b,_0x16ac50,_0x373463){return new BPromise(function(_0x53143d,_0x5ccdc5){return client[_0xdc17('0xa')](_0x52a11b,_0x373463)[_0xdc17('0xb')](function(_0x17c626){logger[_0xdc17('0xc')](_0xdc17('0xd'),_0x16ac50,_0xdc17('0xe'));logger[_0xdc17('0xf')](_0xdc17('0x10'),_0x16ac50,'request\x20sent',JSON[_0xdc17('0x11')](_0x17c626));if(_0x17c626[_0xdc17('0x12')]){if(_0x17c626[_0xdc17('0x12')]['code']===0x1f4){logger[_0xdc17('0x12')]('CloudProvider,\x20%s,\x20%s',_0x16ac50,_0x17c626[_0xdc17('0x12')][_0xdc17('0x13')]);return _0x5ccdc5(_0x17c626['error'][_0xdc17('0x13')]);}logger[_0xdc17('0x12')]('CloudProvider,\x20%s,\x20%s',_0x16ac50,_0x17c626[_0xdc17('0x12')]['message']);return _0x53143d(_0x17c626[_0xdc17('0x12')][_0xdc17('0x13')]);}else{logger['info'](_0xdc17('0xd'),_0x16ac50,_0xdc17('0xe'));_0x53143d(_0x17c626[_0xdc17('0x14')][_0xdc17('0x13')]);}})[_0xdc17('0x15')](function(_0x3adc90){logger['error'](_0xdc17('0xd'),_0x16ac50,_0x3adc90);_0x5ccdc5(_0x3adc90);});});} \ No newline at end of file +var _0xa3db=['client','http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CloudProvider,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0xa3db,0x10c));var _0xba3d=function(_0x159a20,_0x181185){_0x159a20=_0x159a20-0x0;var _0x491dd9=_0xa3db[_0x159a20];return _0x491dd9;};'use strict';var _=require(_0xba3d('0x0'));var util=require(_0xba3d('0x1'));var moment=require(_0xba3d('0x2'));var BPromise=require(_0xba3d('0x3'));var rs=require(_0xba3d('0x4'));var fs=require('fs');var Redis=require(_0xba3d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba3d('0x6'))('rpc');var config=require(_0xba3d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xba3d('0x8')][_0xba3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x477583,_0x1bacd7,_0x1bd181){return new BPromise(function(_0x426868,_0x3b69e9){return client[_0xba3d('0xa')](_0x477583,_0x1bd181)[_0xba3d('0xb')](function(_0x102fe6){logger[_0xba3d('0xc')]('CloudProvider,\x20%s,\x20%s',_0x1bacd7,_0xba3d('0xd'));logger[_0xba3d('0xe')](_0xba3d('0xf'),_0x1bacd7,_0xba3d('0xd'),JSON[_0xba3d('0x10')](_0x102fe6));if(_0x102fe6['error']){if(_0x102fe6[_0xba3d('0x11')][_0xba3d('0x12')]===0x1f4){logger[_0xba3d('0x11')]('CloudProvider,\x20%s,\x20%s',_0x1bacd7,_0x102fe6['error'][_0xba3d('0x13')]);return _0x3b69e9(_0x102fe6[_0xba3d('0x11')]['message']);}logger['error'](_0xba3d('0x14'),_0x1bacd7,_0x102fe6['error'][_0xba3d('0x13')]);return _0x426868(_0x102fe6[_0xba3d('0x11')][_0xba3d('0x13')]);}else{logger[_0xba3d('0xc')](_0xba3d('0x14'),_0x1bacd7,_0xba3d('0xd'));_0x426868(_0x102fe6[_0xba3d('0x15')][_0xba3d('0x13')]);}})[_0xba3d('0x16')](function(_0x2ce092){logger['error'](_0xba3d('0x14'),_0x1bacd7,_0x2ce092);_0x3b69e9(_0x2ce092);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index cab5cfc..52f5b98 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x2c5e6a,_0x297a18){var _0x2e4eb2=function(_0x5f2e5f){while(--_0x5f2e5f){_0x2c5e6a['push'](_0x2c5e6a['shift']());}};_0x2e4eb2(++_0x297a18);}(_0x2ef3,0xba));var _0x32ef=function(_0x5ca464,_0x55aae3){_0x5ca464=_0x5ca464-0x0;var _0x50f7e7=_0x2ef3[_0x5ca464];return _0x50f7e7;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x5c4f4f,_0x500dc1){var _0x41d0a5=function(_0x1a227b){while(--_0x1a227b){_0x5c4f4f['push'](_0x5c4f4f['shift']());}};_0x41d0a5(++_0x500dc1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 66354db..d4f19ae 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 _0xc8c0=['STRING','name'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0xc8c0,0x100));var _0x0c8c=function(_0x19abf4,_0x51ee82){_0x19abf4=_0x19abf4-0x0;var _0x5b15d9=_0xc8c0[_0x19abf4];return _0x5b15d9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0c8c('0x0')],'unique':_0x0c8c('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0c8c('0x0')]},'companyId':{'type':Sequelize[_0x0c8c('0x0')]},'website':{'type':Sequelize[_0x0c8c('0x0')]},'phone':{'type':Sequelize[_0x0c8c('0x0')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0c8c('0x0')]},'street':{'type':Sequelize[_0x0c8c('0x0')]},'postalCode':{'type':Sequelize[_0x0c8c('0x0')]},'city':{'type':Sequelize[_0x0c8c('0x0')]},'country':{'type':Sequelize[_0x0c8c('0x0')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0c8c('0x0')]},'sStreet':{'type':Sequelize[_0x0c8c('0x0')]},'sPostalCode':{'type':Sequelize[_0x0c8c('0x0')]},'sCity':{'type':Sequelize[_0x0c8c('0x0')]},'sCountry':{'type':Sequelize[_0x0c8c('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa0a1=['STRING','sequelize','exports','name'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xa0a1,0x65));var _0x1a0a=function(_0x4a8f76,_0x5e85c0){_0x4a8f76=_0x4a8f76-0x0;var _0x489610=_0xa0a1[_0x4a8f76];return _0x489610;};'use strict';var Sequelize=require(_0x1a0a('0x0'));module[_0x1a0a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1a0a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1a0a('0x3')]},'companyId':{'type':Sequelize[_0x1a0a('0x3')]},'website':{'type':Sequelize[_0x1a0a('0x3')]},'phone':{'type':Sequelize[_0x1a0a('0x3')]},'fax':{'type':Sequelize[_0x1a0a('0x3')]},'type':{'type':Sequelize[_0x1a0a('0x3')]},'street':{'type':Sequelize[_0x1a0a('0x3')]},'postalCode':{'type':Sequelize[_0x1a0a('0x3')]},'city':{'type':Sequelize[_0x1a0a('0x3')]},'country':{'type':Sequelize[_0x1a0a('0x3')]},'email':{'type':Sequelize[_0x1a0a('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1a0a('0x3')]},'sStreet':{'type':Sequelize[_0x1a0a('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x1a0a('0x3')]},'sCountry':{'type':Sequelize[_0x1a0a('0x3')]},'description':{'type':Sequelize[_0x1a0a('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index bb2d281..251481b 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 _0x0c9b=['filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','omit','ids','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','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','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','Companies','UserProfileResource','sendStatus','error','name','send','index','CmCompany','describe','keys','query'];(function(_0x1630b6,_0x28a9f0){var _0x36d381=function(_0x8cbfa4){while(--_0x8cbfa4){_0x1630b6['push'](_0x1630b6['shift']());}};_0x36d381(++_0x28a9f0);}(_0x0c9b,0x1e3));var _0xb0c9=function(_0x550f28,_0x395191){_0x550f28=_0x550f28-0x0;var _0x4ebb7d=_0x0c9b[_0x550f28];return _0x4ebb7d;};'use strict';var emlformat=require(_0xb0c9('0x0'));var rimraf=require(_0xb0c9('0x1'));var zipdir=require(_0xb0c9('0x2'));var jsonpatch=require(_0xb0c9('0x3'));var rp=require(_0xb0c9('0x4'));var moment=require(_0xb0c9('0x5'));var BPromise=require(_0xb0c9('0x6'));var Mustache=require(_0xb0c9('0x7'));var util=require(_0xb0c9('0x8'));var path=require(_0xb0c9('0x9'));var sox=require('sox');var csv=require(_0xb0c9('0xa'));var ejs=require(_0xb0c9('0xb'));var fs=require('fs');var fs_extra=require(_0xb0c9('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb0c9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb0c9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb0c9('0xf'));var Papa=require(_0xb0c9('0x10'));var Redis=require(_0xb0c9('0x11'));var authService=require(_0xb0c9('0x12'));var qs=require(_0xb0c9('0x13'));var as=require(_0xb0c9('0x14'));var hardwareService=require(_0xb0c9('0x15'));var logger=require(_0xb0c9('0x16'))(_0xb0c9('0x17'));var utils=require(_0xb0c9('0x18'));var config=require(_0xb0c9('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ca06f,_0xef521b){_0xef521b=_0xef521b||0xcc;return function(_0x4077d0){if(_0x4077d0){return _0x4ca06f['sendStatus'](_0xef521b);}return _0x4ca06f[_0xb0c9('0x1a')](_0xef521b)[_0xb0c9('0x1b')]();};}function respondWithResult(_0x31b28a,_0x26bbfc){_0x26bbfc=_0x26bbfc||0xc8;return function(_0x1220a0){if(_0x1220a0){return _0x31b28a[_0xb0c9('0x1a')](_0x26bbfc)['json'](_0x1220a0);}};}function respondWithFilteredResult(_0x2c3c68,_0x28375f){return function(_0x2f2042){if(_0x2f2042){var _0x28bdcf=typeof _0x28375f['offset']==='undefined'&&typeof _0x28375f['limit']==='undefined';var _0x3cbfac=_0x2f2042[_0xb0c9('0x1c')];var _0x4f30aa=_0x28bdcf?0x0:_0x28375f[_0xb0c9('0x1d')];var _0x107d3f=_0x28bdcf?_0x2f2042['count']:_0x28375f[_0xb0c9('0x1d')]+_0x28375f[_0xb0c9('0x1e')];var _0x2845c0;if(_0x107d3f>=_0x3cbfac){_0x107d3f=_0x3cbfac;_0x2845c0=0xc8;}else{_0x2845c0=0xce;}_0x2c3c68['status'](_0x2845c0);return _0x2c3c68[_0xb0c9('0x1f')](_0xb0c9('0x20'),_0x4f30aa+'-'+_0x107d3f+'/'+_0x3cbfac)[_0xb0c9('0x21')](_0x2f2042);}return null;};}function patchUpdates(_0x4ba1bc){return function(_0x523415){try{jsonpatch[_0xb0c9('0x22')](_0x523415,_0x4ba1bc,!![]);}catch(_0x5b790b){return BPromise[_0xb0c9('0x23')](_0x5b790b);}return _0x523415[_0xb0c9('0x24')]();};}function saveUpdates(_0x36248f,_0x131e99){return function(_0x9dbdb6){if(_0x9dbdb6){return _0x9dbdb6[_0xb0c9('0x25')](_0x36248f)[_0xb0c9('0x26')](function(_0x79f2a7){return _0x79f2a7;});}return null;};}function removeEntity(_0x280751,_0x14216d){return function(_0x30009c){if(_0x30009c){return _0x30009c['destroy']()[_0xb0c9('0x26')](function(){var _0x540a6b=_0x30009c[_0xb0c9('0x27')]({'plain':!![]});var _0x45a1c8=_0xb0c9('0x28');return db[_0xb0c9('0x29')]['destroy']({'where':{'type':_0x45a1c8,'resourceId':_0x540a6b['id']}})['then'](function(){return _0x30009c;});})[_0xb0c9('0x26')](function(){_0x280751[_0xb0c9('0x1a')](0xcc)[_0xb0c9('0x1b')]();});}};}function handleEntityNotFound(_0x4b1993,_0x44750d){return function(_0x1ee82b){if(!_0x1ee82b){_0x4b1993[_0xb0c9('0x2a')](0x194);}return _0x1ee82b;};}function handleError(_0x4a3452,_0x447ab7){_0x447ab7=_0x447ab7||0x1f4;return function(_0xbd233a){logger[_0xb0c9('0x2b')](_0xbd233a['stack']);if(_0xbd233a[_0xb0c9('0x2c')]){delete _0xbd233a['name'];}_0x4a3452['status'](_0x447ab7)[_0xb0c9('0x2d')](_0xbd233a);};}exports[_0xb0c9('0x2e')]=function(_0x3dd21e,_0x4a02e5){var _0x273d93={},_0x220bbc={},_0x25649e={'count':0x0,'rows':[]};return db[_0xb0c9('0x2f')][_0xb0c9('0x30')]()[_0xb0c9('0x26')](function(_0x28b256){_0x220bbc['model']=_[_0xb0c9('0x31')](_0x28b256);_0x220bbc[_0xb0c9('0x32')]=_['keys'](_0x3dd21e[_0xb0c9('0x32')]);_0x220bbc[_0xb0c9('0x33')]=_[_0xb0c9('0x34')](_0x220bbc[_0xb0c9('0x35')],_0x220bbc[_0xb0c9('0x32')]);_0x273d93[_0xb0c9('0x36')]=_[_0xb0c9('0x34')](_0x220bbc[_0xb0c9('0x35')],qs[_0xb0c9('0x37')](_0x3dd21e[_0xb0c9('0x32')]['fields']));_0x273d93['attributes']=_0x273d93[_0xb0c9('0x36')]['length']?_0x273d93[_0xb0c9('0x36')]:_0x220bbc[_0xb0c9('0x35')];if(!_0x3dd21e['query'][_0xb0c9('0x38')](_0xb0c9('0x39'))){_0x273d93['limit']=qs[_0xb0c9('0x1e')](_0x3dd21e[_0xb0c9('0x32')]['limit']);_0x273d93['offset']=qs[_0xb0c9('0x1d')](_0x3dd21e[_0xb0c9('0x32')][_0xb0c9('0x1d')]);}_0x273d93[_0xb0c9('0x3a')]=qs[_0xb0c9('0x3b')](_0x3dd21e[_0xb0c9('0x32')]['sort']);_0x273d93[_0xb0c9('0x3c')]=qs[_0xb0c9('0x33')](_[_0xb0c9('0x3d')](_0x3dd21e['query'],_0x220bbc[_0xb0c9('0x33')]),_0x28b256);if(_0x3dd21e[_0xb0c9('0x32')]['filter']){_0x273d93[_0xb0c9('0x3c')]=_['merge'](_0x273d93[_0xb0c9('0x3c')],{'$or':_[_0xb0c9('0x3e')](_0x273d93[_0xb0c9('0x36')],function(_0x47d074){var _0x369f10={};_0x369f10[_0x47d074]={'$like':'%'+_0x3dd21e['query'][_0xb0c9('0x3f')]+'%'};return _0x369f10;})});}_0x273d93=_[_0xb0c9('0x40')]({},_0x273d93,_0x3dd21e[_0xb0c9('0x41')]);var _0x1c309c={'where':_0x273d93[_0xb0c9('0x3c')]};return db['CmCompany'][_0xb0c9('0x1c')](_0x1c309c)['then'](function(_0x5eb626){_0x25649e[_0xb0c9('0x1c')]=_0x5eb626;if(_0x3dd21e[_0xb0c9('0x32')]['includeAll']){_0x273d93[_0xb0c9('0x42')]=[{'all':!![]}];}return db[_0xb0c9('0x2f')][_0xb0c9('0x43')](_0x273d93);})[_0xb0c9('0x26')](function(_0x55de66){_0x25649e[_0xb0c9('0x44')]=_0x55de66;return _0x25649e;})[_0xb0c9('0x26')](respondWithFilteredResult(_0x4a02e5,_0x273d93))[_0xb0c9('0x45')](handleError(_0x4a02e5,null));})[_0xb0c9('0x45')](handleError(_0x4a02e5,null));};exports[_0xb0c9('0x46')]=function(_0x24adeb,_0xd5003b){var _0x24f50e={'raw':![],'where':{'id':_0x24adeb[_0xb0c9('0x47')]['id']}},_0x33d193={};_0x33d193[_0xb0c9('0x35')]=_[_0xb0c9('0x31')](db['CmCompany'][_0xb0c9('0x48')]);_0x33d193[_0xb0c9('0x32')]=_[_0xb0c9('0x31')](_0x24adeb['query']);_0x33d193[_0xb0c9('0x33')]=_[_0xb0c9('0x34')](_0x33d193[_0xb0c9('0x35')],_0x33d193[_0xb0c9('0x32')]);_0x24f50e[_0xb0c9('0x36')]=_['intersection'](_0x33d193[_0xb0c9('0x35')],qs['fields'](_0x24adeb[_0xb0c9('0x32')]['fields']));_0x24f50e[_0xb0c9('0x36')]=_0x24f50e[_0xb0c9('0x36')][_0xb0c9('0x49')]?_0x24f50e[_0xb0c9('0x36')]:_0x33d193['model'];if(_0x24adeb['query']['includeAll']){_0x24f50e['include']=[{'all':!![]}];}_0x24f50e=_['merge']({},_0x24f50e,_0x24adeb[_0xb0c9('0x41')]);return db[_0xb0c9('0x2f')][_0xb0c9('0x4a')](_0x24f50e)[_0xb0c9('0x26')](handleEntityNotFound(_0xd5003b,null))[_0xb0c9('0x26')](respondWithResult(_0xd5003b,null))['catch'](handleError(_0xd5003b,null));};exports['create']=function(_0x526edf,_0x15f6c4){return db[_0xb0c9('0x2f')][_0xb0c9('0x4b')](_0x526edf[_0xb0c9('0x4c')],{})[_0xb0c9('0x26')](function(_0x19a303){var _0x4d68b0=_0x526edf[_0xb0c9('0x4d')][_0xb0c9('0x27')]({'plain':!![]});if(!_0x4d68b0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d68b0[_0xb0c9('0x4e')]==='user'){var _0x25cfe7=_0x19a303[_0xb0c9('0x27')]({'plain':!![]});var _0x3e40e9=_0xb0c9('0x28');return db[_0xb0c9('0x4f')][_0xb0c9('0x4a')]({'where':{'name':_0x3e40e9,'userProfileId':_0x4d68b0[_0xb0c9('0x50')]},'raw':!![]})[_0xb0c9('0x26')](function(_0x519ac4){if(_0x519ac4&&_0x519ac4[_0xb0c9('0x51')]===0x0){return db[_0xb0c9('0x29')][_0xb0c9('0x4b')]({'name':_0x25cfe7['name'],'resourceId':_0x25cfe7['id'],'type':_0x519ac4['name'],'sectionId':_0x519ac4['id']},{})[_0xb0c9('0x26')](function(){return _0x19a303;});}else{return _0x19a303;}})[_0xb0c9('0x45')](function(_0x4a0608){logger[_0xb0c9('0x2b')](_0xb0c9('0x52'),_0x4a0608);throw _0x4a0608;});}return _0x19a303;})[_0xb0c9('0x26')](respondWithResult(_0x15f6c4,0xc9))[_0xb0c9('0x45')](handleError(_0x15f6c4,null));};exports[_0xb0c9('0x25')]=function(_0xc6e8f3,_0x1fb927){if(_0xc6e8f3[_0xb0c9('0x4c')]['id']){delete _0xc6e8f3[_0xb0c9('0x4c')]['id'];}return db[_0xb0c9('0x2f')][_0xb0c9('0x4a')]({'where':{'id':_0xc6e8f3['params']['id']}})[_0xb0c9('0x26')](handleEntityNotFound(_0x1fb927,null))[_0xb0c9('0x26')](saveUpdates(_0xc6e8f3['body'],null))[_0xb0c9('0x26')](respondWithResult(_0x1fb927,null))[_0xb0c9('0x45')](handleError(_0x1fb927,null));};exports['destroy']=function(_0x1fab27,_0x4687d6){return db[_0xb0c9('0x2f')][_0xb0c9('0x4a')]({'where':{'id':_0x1fab27['params']['id']}})[_0xb0c9('0x26')](handleEntityNotFound(_0x4687d6,null))[_0xb0c9('0x26')](removeEntity(_0x4687d6,null))[_0xb0c9('0x45')](handleError(_0x4687d6,null));};exports[_0xb0c9('0x30')]=function(_0x6b1c9d,_0x140174){return db[_0xb0c9('0x2f')][_0xb0c9('0x30')]()[_0xb0c9('0x26')](respondWithResult(_0x140174,null))[_0xb0c9('0x45')](handleError(_0x140174,null));};exports[_0xb0c9('0x53')]=function(_0x3a2c41,_0x258cb2,_0x2e1d56){return db[_0xb0c9('0x54')]['find']({'where':{'id':_0x3a2c41[_0xb0c9('0x47')]['id']}})[_0xb0c9('0x26')](handleEntityNotFound(_0x258cb2,null))[_0xb0c9('0x26')](function(_0x4186ff){if(_0x4186ff){return _0x4186ff[_0xb0c9('0x53')](_0x3a2c41[_0xb0c9('0x4c')]['ids'],_[_0xb0c9('0x55')](_0x3a2c41[_0xb0c9('0x4c')],[_0xb0c9('0x56'),'id'])||{});}})[_0xb0c9('0x26')](respondWithResult(_0x258cb2,null))[_0xb0c9('0x45')](handleError(_0x258cb2,null));};exports[_0xb0c9('0x57')]=function(_0x89c060,_0x4c0820,_0x4d2b02){var _0x213c2d={};var _0x22db10={};var _0x438e29;var _0x521271;return db[_0xb0c9('0x2f')][_0xb0c9('0x58')]({'where':{'id':_0x89c060['params']['id']}})[_0xb0c9('0x26')](handleEntityNotFound(_0x4c0820,null))[_0xb0c9('0x26')](function(_0x39a5f7){if(_0x39a5f7){_0x438e29=_0x39a5f7;_0x22db10[_0xb0c9('0x35')]=_[_0xb0c9('0x31')](db[_0xb0c9('0x54')][_0xb0c9('0x48')]);_0x22db10[_0xb0c9('0x32')]=_[_0xb0c9('0x31')](_0x89c060[_0xb0c9('0x32')]);_0x22db10[_0xb0c9('0x33')]=_['intersection'](_0x22db10[_0xb0c9('0x35')],_0x22db10['query']);_0x213c2d[_0xb0c9('0x36')]=_[_0xb0c9('0x34')](_0x22db10['model'],qs[_0xb0c9('0x37')](_0x89c060[_0xb0c9('0x32')][_0xb0c9('0x37')]));_0x213c2d[_0xb0c9('0x36')]=_0x213c2d[_0xb0c9('0x36')][_0xb0c9('0x49')]?_0x213c2d[_0xb0c9('0x36')]:_0x22db10[_0xb0c9('0x35')];_0x213c2d[_0xb0c9('0x3a')]=qs[_0xb0c9('0x3b')](_0x89c060['query']['sort']);_0x213c2d[_0xb0c9('0x3c')]=qs[_0xb0c9('0x33')](_[_0xb0c9('0x3d')](_0x89c060[_0xb0c9('0x32')],_0x22db10['filters']));if(_0x89c060[_0xb0c9('0x32')]['filter']){_0x213c2d[_0xb0c9('0x3c')]=_[_0xb0c9('0x40')](_0x213c2d[_0xb0c9('0x3c')],{'$or':_[_0xb0c9('0x3e')](_0x213c2d[_0xb0c9('0x36')],function(_0x325381){var _0x15163c={};_0x15163c[_0x325381]={'$like':'%'+_0x89c060['query']['filter']+'%'};return _0x15163c;})});}_0x213c2d=_['merge']({},_0x213c2d,_0x89c060[_0xb0c9('0x41')]);return _0x438e29[_0xb0c9('0x57')](_0x213c2d);}})['then'](function(_0x5af10c){if(_0x5af10c){_0x521271=_0x5af10c[_0xb0c9('0x49')];if(!_0x89c060[_0xb0c9('0x32')][_0xb0c9('0x38')]('nolimit')){_0x213c2d[_0xb0c9('0x1e')]=qs['limit'](_0x89c060['query']['limit']);_0x213c2d[_0xb0c9('0x1d')]=qs[_0xb0c9('0x1d')](_0x89c060[_0xb0c9('0x32')][_0xb0c9('0x1d')]);}return _0x438e29['getContacts'](_0x213c2d);}})[_0xb0c9('0x26')](function(_0x402e42){if(_0x402e42){return _0x402e42?{'count':_0x521271,'rows':_0x402e42}:null;}})[_0xb0c9('0x26')](respondWithResult(_0x4c0820,null))['catch'](handleError(_0x4c0820,null));}; \ No newline at end of file +var _0xae90=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','get','Companies','destroy','stack','name','send','describe','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','map','merge','CmCompany','includeAll','findAll','rows','catch','rawAttributes','include','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','CmContact','addContacts','ids','omit','getContacts','findOne','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis'];(function(_0xe0906b,_0x342805){var _0x43b39e=function(_0x5ef4b2){while(--_0x5ef4b2){_0xe0906b['push'](_0xe0906b['shift']());}};_0x43b39e(++_0x342805);}(_0xae90,0xf2));var _0x0ae9=function(_0xbce6e4,_0x1e95a7){_0xbce6e4=_0xbce6e4-0x0;var _0x471e8a=_0xae90[_0xbce6e4];return _0x471e8a;};'use strict';var emlformat=require(_0x0ae9('0x0'));var rimraf=require(_0x0ae9('0x1'));var zipdir=require(_0x0ae9('0x2'));var jsonpatch=require(_0x0ae9('0x3'));var rp=require(_0x0ae9('0x4'));var moment=require(_0x0ae9('0x5'));var BPromise=require(_0x0ae9('0x6'));var Mustache=require(_0x0ae9('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0ae9('0x8'));var csv=require(_0x0ae9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ae9('0xa'));var _=require(_0x0ae9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0ae9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0ae9('0x9'));var querystring=require(_0x0ae9('0xd'));var Papa=require(_0x0ae9('0xe'));var Redis=require(_0x0ae9('0xf'));var authService=require(_0x0ae9('0x10'));var qs=require(_0x0ae9('0x11'));var as=require(_0x0ae9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0ae9('0x13'));var config=require(_0x0ae9('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4009ec,_0x3d9ff8){_0x3d9ff8=_0x3d9ff8||0xcc;return function(_0x1518d1){if(_0x1518d1){return _0x4009ec[_0x0ae9('0x15')](_0x3d9ff8);}return _0x4009ec['status'](_0x3d9ff8)[_0x0ae9('0x16')]();};}function respondWithResult(_0x23b5f4,_0x546f7b){_0x546f7b=_0x546f7b||0xc8;return function(_0x22328b){if(_0x22328b){return _0x23b5f4[_0x0ae9('0x17')](_0x546f7b)['json'](_0x22328b);}};}function respondWithFilteredResult(_0x30a70c,_0x26e418){return function(_0x2ca9af){if(_0x2ca9af){var _0x2be6fc=typeof _0x26e418[_0x0ae9('0x18')]===_0x0ae9('0x19')&&typeof _0x26e418[_0x0ae9('0x1a')]===_0x0ae9('0x19');var _0x2543f5=_0x2ca9af[_0x0ae9('0x1b')];var _0x4be9d4=_0x2be6fc?0x0:_0x26e418[_0x0ae9('0x18')];var _0x228b0f=_0x2be6fc?_0x2ca9af[_0x0ae9('0x1b')]:_0x26e418['offset']+_0x26e418[_0x0ae9('0x1a')];var _0x43b291;if(_0x228b0f>=_0x2543f5){_0x228b0f=_0x2543f5;_0x43b291=0xc8;}else{_0x43b291=0xce;}_0x30a70c['status'](_0x43b291);return _0x30a70c[_0x0ae9('0x1c')](_0x0ae9('0x1d'),_0x4be9d4+'-'+_0x228b0f+'/'+_0x2543f5)[_0x0ae9('0x1e')](_0x2ca9af);}return null;};}function patchUpdates(_0x55cc0a){return function(_0x2fa899){try{jsonpatch[_0x0ae9('0x1f')](_0x2fa899,_0x55cc0a,!![]);}catch(_0x524ea8){return BPromise[_0x0ae9('0x20')](_0x524ea8);}return _0x2fa899[_0x0ae9('0x21')]();};}function saveUpdates(_0x5834d0,_0x575c15){return function(_0x583013){if(_0x583013){return _0x583013['update'](_0x5834d0)[_0x0ae9('0x22')](function(_0x4fb247){return _0x4fb247;});}return null;};}function removeEntity(_0x324984,_0x30794b){return function(_0x3e3b62){if(_0x3e3b62){return _0x3e3b62['destroy']()['then'](function(){var _0x1f8a25=_0x3e3b62[_0x0ae9('0x23')]({'plain':!![]});var _0x3c0199=_0x0ae9('0x24');return db['UserProfileResource'][_0x0ae9('0x25')]({'where':{'type':_0x3c0199,'resourceId':_0x1f8a25['id']}})[_0x0ae9('0x22')](function(){return _0x3e3b62;});})[_0x0ae9('0x22')](function(){_0x324984[_0x0ae9('0x17')](0xcc)[_0x0ae9('0x16')]();});}};}function handleEntityNotFound(_0x1fdfa3,_0xacc3ea){return function(_0x102c1d){if(!_0x102c1d){_0x1fdfa3[_0x0ae9('0x15')](0x194);}return _0x102c1d;};}function handleError(_0x30d9f0,_0x1a755e){_0x1a755e=_0x1a755e||0x1f4;return function(_0x5cec9f){logger['error'](_0x5cec9f[_0x0ae9('0x26')]);if(_0x5cec9f[_0x0ae9('0x27')]){delete _0x5cec9f[_0x0ae9('0x27')];}_0x30d9f0[_0x0ae9('0x17')](_0x1a755e)[_0x0ae9('0x28')](_0x5cec9f);};}exports['index']=function(_0x5e2e59,_0x1810d3){var _0x16abb9={},_0x300b1e={},_0x3a0002={'count':0x0,'rows':[]};return db['CmCompany'][_0x0ae9('0x29')]()[_0x0ae9('0x22')](function(_0x1d2c88){_0x300b1e[_0x0ae9('0x2a')]=_[_0x0ae9('0x2b')](_0x1d2c88);_0x300b1e['query']=_[_0x0ae9('0x2b')](_0x5e2e59['query']);_0x300b1e[_0x0ae9('0x2c')]=_[_0x0ae9('0x2d')](_0x300b1e['model'],_0x300b1e[_0x0ae9('0x2e')]);_0x16abb9['attributes']=_[_0x0ae9('0x2d')](_0x300b1e[_0x0ae9('0x2a')],qs[_0x0ae9('0x2f')](_0x5e2e59[_0x0ae9('0x2e')][_0x0ae9('0x2f')]));_0x16abb9[_0x0ae9('0x30')]=_0x16abb9[_0x0ae9('0x30')][_0x0ae9('0x31')]?_0x16abb9[_0x0ae9('0x30')]:_0x300b1e[_0x0ae9('0x2a')];if(!_0x5e2e59[_0x0ae9('0x2e')][_0x0ae9('0x32')](_0x0ae9('0x33'))){_0x16abb9['limit']=qs[_0x0ae9('0x1a')](_0x5e2e59[_0x0ae9('0x2e')][_0x0ae9('0x1a')]);_0x16abb9[_0x0ae9('0x18')]=qs[_0x0ae9('0x18')](_0x5e2e59['query'][_0x0ae9('0x18')]);}_0x16abb9[_0x0ae9('0x34')]=qs['sort'](_0x5e2e59['query'][_0x0ae9('0x35')]);_0x16abb9[_0x0ae9('0x36')]=qs[_0x0ae9('0x2c')](_[_0x0ae9('0x37')](_0x5e2e59[_0x0ae9('0x2e')],_0x300b1e[_0x0ae9('0x2c')]),_0x1d2c88);if(_0x5e2e59[_0x0ae9('0x2e')]['filter']){_0x16abb9[_0x0ae9('0x36')]=_['merge'](_0x16abb9[_0x0ae9('0x36')],{'$or':_[_0x0ae9('0x38')](_0x16abb9['attributes'],function(_0x49f16f){var _0x249187={};_0x249187[_0x49f16f]={'$like':'%'+_0x5e2e59[_0x0ae9('0x2e')]['filter']+'%'};return _0x249187;})});}_0x16abb9=_[_0x0ae9('0x39')]({},_0x16abb9,_0x5e2e59['options']);var _0x65c632={'where':_0x16abb9[_0x0ae9('0x36')]};return db[_0x0ae9('0x3a')][_0x0ae9('0x1b')](_0x65c632)[_0x0ae9('0x22')](function(_0xdeeb34){_0x3a0002[_0x0ae9('0x1b')]=_0xdeeb34;if(_0x5e2e59[_0x0ae9('0x2e')][_0x0ae9('0x3b')]){_0x16abb9['include']=[{'all':!![]}];}return db[_0x0ae9('0x3a')][_0x0ae9('0x3c')](_0x16abb9);})[_0x0ae9('0x22')](function(_0x1ee087){_0x3a0002[_0x0ae9('0x3d')]=_0x1ee087;return _0x3a0002;})[_0x0ae9('0x22')](respondWithFilteredResult(_0x1810d3,_0x16abb9))[_0x0ae9('0x3e')](handleError(_0x1810d3,null));})[_0x0ae9('0x3e')](handleError(_0x1810d3,null));};exports['show']=function(_0x2d2072,_0x3b9083){var _0x386197={'raw':![],'where':{'id':_0x2d2072['params']['id']}},_0x19c5f1={};_0x19c5f1['model']=_[_0x0ae9('0x2b')](db[_0x0ae9('0x3a')][_0x0ae9('0x3f')]);_0x19c5f1['query']=_[_0x0ae9('0x2b')](_0x2d2072[_0x0ae9('0x2e')]);_0x19c5f1[_0x0ae9('0x2c')]=_[_0x0ae9('0x2d')](_0x19c5f1[_0x0ae9('0x2a')],_0x19c5f1['query']);_0x386197['attributes']=_[_0x0ae9('0x2d')](_0x19c5f1[_0x0ae9('0x2a')],qs['fields'](_0x2d2072[_0x0ae9('0x2e')][_0x0ae9('0x2f')]));_0x386197[_0x0ae9('0x30')]=_0x386197[_0x0ae9('0x30')][_0x0ae9('0x31')]?_0x386197[_0x0ae9('0x30')]:_0x19c5f1['model'];if(_0x2d2072[_0x0ae9('0x2e')][_0x0ae9('0x3b')]){_0x386197[_0x0ae9('0x40')]=[{'all':!![]}];}_0x386197=_[_0x0ae9('0x39')]({},_0x386197,_0x2d2072[_0x0ae9('0x41')]);return db['CmCompany'][_0x0ae9('0x42')](_0x386197)[_0x0ae9('0x22')](handleEntityNotFound(_0x3b9083,null))[_0x0ae9('0x22')](respondWithResult(_0x3b9083,null))[_0x0ae9('0x3e')](handleError(_0x3b9083,null));};exports[_0x0ae9('0x43')]=function(_0x3eb22a,_0x429c20){return db['CmCompany'][_0x0ae9('0x43')](_0x3eb22a['body'],{})[_0x0ae9('0x22')](function(_0x1e3dde){var _0x3810c0=_0x3eb22a['user'][_0x0ae9('0x23')]({'plain':!![]});if(!_0x3810c0)throw new Error(_0x0ae9('0x44'));if(_0x3810c0[_0x0ae9('0x45')]===_0x0ae9('0x46')){var _0x204e4e=_0x1e3dde['get']({'plain':!![]});var _0x45d7f3=_0x0ae9('0x24');return db[_0x0ae9('0x47')]['find']({'where':{'name':_0x45d7f3,'userProfileId':_0x3810c0['userProfileId']},'raw':!![]})[_0x0ae9('0x22')](function(_0x566e26){if(_0x566e26&&_0x566e26[_0x0ae9('0x48')]===0x0){return db[_0x0ae9('0x49')][_0x0ae9('0x43')]({'name':_0x204e4e[_0x0ae9('0x27')],'resourceId':_0x204e4e['id'],'type':_0x566e26[_0x0ae9('0x27')],'sectionId':_0x566e26['id']},{})['then'](function(){return _0x1e3dde;});}else{return _0x1e3dde;}})[_0x0ae9('0x3e')](function(_0x2afd3c){logger[_0x0ae9('0x4a')](_0x0ae9('0x4b'),_0x2afd3c);throw _0x2afd3c;});}return _0x1e3dde;})[_0x0ae9('0x22')](respondWithResult(_0x429c20,0xc9))['catch'](handleError(_0x429c20,null));};exports[_0x0ae9('0x4c')]=function(_0x24337c,_0x1ff423){if(_0x24337c['body']['id']){delete _0x24337c[_0x0ae9('0x4d')]['id'];}return db[_0x0ae9('0x3a')]['find']({'where':{'id':_0x24337c[_0x0ae9('0x4e')]['id']}})[_0x0ae9('0x22')](handleEntityNotFound(_0x1ff423,null))[_0x0ae9('0x22')](saveUpdates(_0x24337c['body'],null))['then'](respondWithResult(_0x1ff423,null))[_0x0ae9('0x3e')](handleError(_0x1ff423,null));};exports['destroy']=function(_0x2ffd73,_0x2ce0c8){return db[_0x0ae9('0x3a')][_0x0ae9('0x42')]({'where':{'id':_0x2ffd73['params']['id']}})[_0x0ae9('0x22')](handleEntityNotFound(_0x2ce0c8,null))['then'](removeEntity(_0x2ce0c8,null))['catch'](handleError(_0x2ce0c8,null));};exports[_0x0ae9('0x29')]=function(_0x56a94f,_0x23c54b){return db['CmCompany']['describe']()[_0x0ae9('0x22')](respondWithResult(_0x23c54b,null))[_0x0ae9('0x3e')](handleError(_0x23c54b,null));};exports['addContacts']=function(_0x30866a,_0x25691f,_0x3fd690){return db[_0x0ae9('0x4f')]['find']({'where':{'id':_0x30866a[_0x0ae9('0x4e')]['id']}})[_0x0ae9('0x22')](handleEntityNotFound(_0x25691f,null))[_0x0ae9('0x22')](function(_0x100e88){if(_0x100e88){return _0x100e88[_0x0ae9('0x50')](_0x30866a[_0x0ae9('0x4d')][_0x0ae9('0x51')],_[_0x0ae9('0x52')](_0x30866a[_0x0ae9('0x4d')],[_0x0ae9('0x51'),'id'])||{});}})['then'](respondWithResult(_0x25691f,null))[_0x0ae9('0x3e')](handleError(_0x25691f,null));};exports[_0x0ae9('0x53')]=function(_0x16a65e,_0x553312,_0x188fd2){var _0x259de4={};var _0x2f8ae4={};var _0x41a137;var _0x3c76d4;return db[_0x0ae9('0x3a')][_0x0ae9('0x54')]({'where':{'id':_0x16a65e[_0x0ae9('0x4e')]['id']}})[_0x0ae9('0x22')](handleEntityNotFound(_0x553312,null))['then'](function(_0x12befa){if(_0x12befa){_0x41a137=_0x12befa;_0x2f8ae4['model']=_[_0x0ae9('0x2b')](db['CmContact'][_0x0ae9('0x3f')]);_0x2f8ae4[_0x0ae9('0x2e')]=_['keys'](_0x16a65e[_0x0ae9('0x2e')]);_0x2f8ae4[_0x0ae9('0x2c')]=_[_0x0ae9('0x2d')](_0x2f8ae4[_0x0ae9('0x2a')],_0x2f8ae4['query']);_0x259de4[_0x0ae9('0x30')]=_['intersection'](_0x2f8ae4[_0x0ae9('0x2a')],qs[_0x0ae9('0x2f')](_0x16a65e[_0x0ae9('0x2e')]['fields']));_0x259de4[_0x0ae9('0x30')]=_0x259de4[_0x0ae9('0x30')][_0x0ae9('0x31')]?_0x259de4[_0x0ae9('0x30')]:_0x2f8ae4[_0x0ae9('0x2a')];_0x259de4[_0x0ae9('0x34')]=qs[_0x0ae9('0x35')](_0x16a65e['query'][_0x0ae9('0x35')]);_0x259de4['where']=qs[_0x0ae9('0x2c')](_[_0x0ae9('0x37')](_0x16a65e[_0x0ae9('0x2e')],_0x2f8ae4[_0x0ae9('0x2c')]));if(_0x16a65e['query'][_0x0ae9('0x55')]){_0x259de4[_0x0ae9('0x36')]=_[_0x0ae9('0x39')](_0x259de4[_0x0ae9('0x36')],{'$or':_[_0x0ae9('0x38')](_0x259de4[_0x0ae9('0x30')],function(_0x396db3){var _0x4b7498={};_0x4b7498[_0x396db3]={'$like':'%'+_0x16a65e[_0x0ae9('0x2e')][_0x0ae9('0x55')]+'%'};return _0x4b7498;})});}_0x259de4=_['merge']({},_0x259de4,_0x16a65e[_0x0ae9('0x41')]);return _0x41a137['getContacts'](_0x259de4);}})['then'](function(_0x6437b4){if(_0x6437b4){_0x3c76d4=_0x6437b4['length'];if(!_0x16a65e[_0x0ae9('0x2e')][_0x0ae9('0x32')](_0x0ae9('0x33'))){_0x259de4[_0x0ae9('0x1a')]=qs[_0x0ae9('0x1a')](_0x16a65e[_0x0ae9('0x2e')][_0x0ae9('0x1a')]);_0x259de4[_0x0ae9('0x18')]=qs[_0x0ae9('0x18')](_0x16a65e[_0x0ae9('0x2e')][_0x0ae9('0x18')]);}return _0x41a137['getContacts'](_0x259de4);}})[_0x0ae9('0x22')](function(_0x5dac14){if(_0x5dac14){return _0x5dac14?{'count':_0x3c76d4,'rows':_0x5dac14}:null;}})[_0x0ae9('0x22')](respondWithResult(_0x553312,null))['catch'](handleError(_0x553312,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index c355abf..97ccc32 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 _0x3b95=['api','moment','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','define','cm_companies','lodash','util','../../config/logger'];(function(_0x3cc6bd,_0x43959d){var _0x19b0c1=function(_0x38ffa9){while(--_0x38ffa9){_0x3cc6bd['push'](_0x3cc6bd['shift']());}};_0x19b0c1(++_0x43959d);}(_0x3b95,0x171));var _0x53b9=function(_0x182aaa,_0xd45a1){_0x182aaa=_0x182aaa-0x0;var _0x594269=_0x3b95[_0x182aaa];return _0x594269;};'use strict';var _=require(_0x53b9('0x0'));var util=require(_0x53b9('0x1'));var logger=require(_0x53b9('0x2'))(_0x53b9('0x3'));var moment=require(_0x53b9('0x4'));var BPromise=require(_0x53b9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x53b9('0x6'));var rimraf=require(_0x53b9('0x7'));var config=require(_0x53b9('0x8'));var attributes=require(_0x53b9('0x9'));module['exports']=function(_0x48b1eb,_0x309f5e){return _0x48b1eb[_0x53b9('0xa')]('CmCompany',attributes,{'tableName':_0x53b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x776a=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cmCompany.attributes','exports','define','cm_companies'];(function(_0x5ae372,_0x5066d1){var _0x1eeb3=function(_0x3f0550){while(--_0x3f0550){_0x5ae372['push'](_0x5ae372['shift']());}};_0x1eeb3(++_0x5066d1);}(_0x776a,0x84));var _0xa776=function(_0x306c86,_0x5076d6){_0x306c86=_0x306c86-0x0;var _0x17dd66=_0x776a[_0x306c86];return _0x17dd66;};'use strict';var _=require(_0xa776('0x0'));var util=require(_0xa776('0x1'));var logger=require(_0xa776('0x2'))(_0xa776('0x3'));var moment=require(_0xa776('0x4'));var BPromise=require('bluebird');var rp=require(_0xa776('0x5'));var fs=require('fs');var path=require(_0xa776('0x6'));var rimraf=require('rimraf');var config=require(_0xa776('0x7'));var attributes=require(_0xa776('0x8'));module[_0xa776('0x9')]=function(_0x2c73fe,_0x1b4543){return _0x2c73fe[_0xa776('0xa')]('CmCompany',attributes,{'tableName':_0xa776('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index ff9f615..a1ed429 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 _0x825a=['http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4f4360,_0x5f0d21){var _0x25603f=function(_0x3b6ced){while(--_0x3b6ced){_0x4f4360['push'](_0x4f4360['shift']());}};_0x25603f(++_0x5f0d21);}(_0x825a,0x15d));var _0xa825=function(_0x3d73ba,_0x356e23){_0x3d73ba=_0x3d73ba-0x0;var _0x47e406=_0x825a[_0x3d73ba];return _0x47e406;};'use strict';var _=require('lodash');var util=require(_0xa825('0x0'));var moment=require(_0xa825('0x1'));var BPromise=require(_0xa825('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa825('0x3'));var db=require(_0xa825('0x4'))['db'];var utils=require(_0xa825('0x5'));var logger=require(_0xa825('0x6'))(_0xa825('0x7'));var config=require(_0xa825('0x8'));var jayson=require(_0xa825('0x9'));var client=jayson[_0xa825('0xa')][_0xa825('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56e284,_0x1f4d6b,_0x133206){return new BPromise(function(_0x5082c8,_0x32fd10){return client[_0xa825('0xc')](_0x56e284,_0x133206)[_0xa825('0xd')](function(_0x259571){logger[_0xa825('0xe')](_0xa825('0xf'),_0x1f4d6b,_0xa825('0x10'));logger[_0xa825('0x11')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x1f4d6b,_0xa825('0x10'),JSON[_0xa825('0x12')](_0x259571));if(_0x259571['error']){if(_0x259571[_0xa825('0x13')][_0xa825('0x14')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x1f4d6b,_0x259571[_0xa825('0x13')]['message']);return _0x32fd10(_0x259571[_0xa825('0x13')][_0xa825('0x15')]);}logger[_0xa825('0x13')](_0xa825('0xf'),_0x1f4d6b,_0x259571[_0xa825('0x13')][_0xa825('0x15')]);return _0x5082c8(_0x259571[_0xa825('0x13')][_0xa825('0x15')]);}else{logger[_0xa825('0xe')](_0xa825('0xf'),_0x1f4d6b,'request\x20sent');_0x5082c8(_0x259571[_0xa825('0x16')]['message']);}})[_0xa825('0x17')](function(_0x375e81){logger[_0xa825('0x13')]('CmCompany,\x20%s,\x20%s',_0x1f4d6b,_0x375e81);_0x32fd10(_0x375e81);});});} \ No newline at end of file +var _0x384c=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash'];(function(_0x248bcc,_0x891345){var _0x899754=function(_0x3dcfbd){while(--_0x3dcfbd){_0x248bcc['push'](_0x248bcc['shift']());}};_0x899754(++_0x891345);}(_0x384c,0x1cd));var _0xc384=function(_0x216d26,_0x4a0c52){_0x216d26=_0x216d26-0x0;var _0x15c908=_0x384c[_0x216d26];return _0x15c908;};'use strict';var _=require(_0xc384('0x0'));var util=require(_0xc384('0x1'));var moment=require(_0xc384('0x2'));var BPromise=require(_0xc384('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc384('0x4'));var db=require(_0xc384('0x5'))['db'];var utils=require(_0xc384('0x6'));var logger=require('../../config/logger')(_0xc384('0x7'));var config=require(_0xc384('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc384('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9cfe9c,_0xb7d0d6,_0x27ae10){return new BPromise(function(_0x34ae10,_0x18bea7){return client[_0xc384('0xa')](_0x9cfe9c,_0x27ae10)[_0xc384('0xb')](function(_0xc203f6){logger['info'](_0xc384('0xc'),_0xb7d0d6,_0xc384('0xd'));logger[_0xc384('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0xb7d0d6,'request\x20sent',JSON[_0xc384('0xf')](_0xc203f6));if(_0xc203f6['error']){if(_0xc203f6[_0xc384('0x10')][_0xc384('0x11')]===0x1f4){logger[_0xc384('0x10')](_0xc384('0xc'),_0xb7d0d6,_0xc203f6['error'][_0xc384('0x12')]);return _0x18bea7(_0xc203f6[_0xc384('0x10')][_0xc384('0x12')]);}logger[_0xc384('0x10')]('CmCompany,\x20%s,\x20%s',_0xb7d0d6,_0xc203f6[_0xc384('0x10')][_0xc384('0x12')]);return _0x34ae10(_0xc203f6[_0xc384('0x10')][_0xc384('0x12')]);}else{logger[_0xc384('0x13')](_0xc384('0xc'),_0xb7d0d6,_0xc384('0xd'));_0x34ae10(_0xc203f6[_0xc384('0x14')][_0xc384('0x12')]);}})[_0xc384('0x15')](function(_0x2bfca5){logger[_0xc384('0x10')](_0xc384('0xc'),_0xb7d0d6,_0x2bfca5);_0x18bea7(_0x2bfca5);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 2619fba..dd4131a 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 _0x3acb=['../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','/describe','show','getContacts','create','post','/:id/contacts','addContacts','/:id','update','delete','destroy','path','express','Router','fs-extra'];(function(_0x553c90,_0x2c1169){var _0x3d0f8f=function(_0x438e10){while(--_0x438e10){_0x553c90['push'](_0x553c90['shift']());}};_0x3d0f8f(++_0x2c1169);}(_0x3acb,0x114));var _0xb3ac=function(_0x50e9b3,_0x420ce0){_0x50e9b3=_0x50e9b3-0x0;var _0x542f2a=_0x3acb[_0x50e9b3];return _0x542f2a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb3ac('0x0'));var timeout=require('connect-timeout');var express=require(_0xb3ac('0x1'));var router=express[_0xb3ac('0x2')]();var fs_extra=require(_0xb3ac('0x3'));var auth=require(_0xb3ac('0x4'));var interaction=require(_0xb3ac('0x5'));var config=require('../../config/environment');var controller=require(_0xb3ac('0x6'));router[_0xb3ac('0x7')]('/',auth[_0xb3ac('0x8')](),controller['index']);router[_0xb3ac('0x7')](_0xb3ac('0x9'),auth[_0xb3ac('0x8')](),controller['describe']);router[_0xb3ac('0x7')]('/:id',auth[_0xb3ac('0x8')](),controller[_0xb3ac('0xa')]);router['get']('/:id/contacts',auth[_0xb3ac('0x8')](),controller[_0xb3ac('0xb')]);router['post']('/',auth[_0xb3ac('0x8')](),controller[_0xb3ac('0xc')]);router[_0xb3ac('0xd')](_0xb3ac('0xe'),auth[_0xb3ac('0x8')](),controller[_0xb3ac('0xf')]);router['put'](_0xb3ac('0x10'),auth['isAuthenticated'](),controller[_0xb3ac('0x11')]);router[_0xb3ac('0x12')](_0xb3ac('0x10'),auth[_0xb3ac('0x8')](),controller[_0xb3ac('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc9b8=['getContacts','post','/:id/contacts','addContacts','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','/:id','show'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xc9b8,0x1aa));var _0x8c9b=function(_0x5670cd,_0x2c5194){_0x5670cd=_0x5670cd-0x0;var _0x6a8666=_0xc9b8[_0x5670cd];return _0x6a8666;};'use strict';var multer=require(_0x8c9b('0x0'));var util=require(_0x8c9b('0x1'));var path=require('path');var timeout=require(_0x8c9b('0x2'));var express=require(_0x8c9b('0x3'));var router=express[_0x8c9b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8c9b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c9b('0x6'));var controller=require(_0x8c9b('0x7'));router[_0x8c9b('0x8')]('/',auth['isAuthenticated'](),controller[_0x8c9b('0x9')]);router[_0x8c9b('0x8')](_0x8c9b('0xa'),auth[_0x8c9b('0xb')](),controller['describe']);router[_0x8c9b('0x8')](_0x8c9b('0xc'),auth[_0x8c9b('0xb')](),controller[_0x8c9b('0xd')]);router[_0x8c9b('0x8')]('/:id/contacts',auth[_0x8c9b('0xb')](),controller[_0x8c9b('0xe')]);router[_0x8c9b('0xf')]('/',auth[_0x8c9b('0xb')](),controller['create']);router[_0x8c9b('0xf')](_0x8c9b('0x10'),auth[_0x8c9b('0xb')](),controller[_0x8c9b('0x11')]);router['put'](_0x8c9b('0xc'),auth[_0x8c9b('0xb')](),controller[_0x8c9b('0x12')]);router['delete']('/:id',auth[_0x8c9b('0xb')](),controller['destroy']);module[_0x8c9b('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 716d922..c8ba260 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 _0x0b0e=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x2bf5f2,_0x36b1cb){var _0x24335a=function(_0x157c5f){while(--_0x157c5f){_0x2bf5f2['push'](_0x2bf5f2['shift']());}};_0x24335a(++_0x36b1cb);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5f3de3,_0x40f0f5){_0x5f3de3=_0x5f3de3-0x0;var _0x287e0d=_0x0b0e[_0x5f3de3];return _0x287e0d;};'use strict';var _=require(_0xe0b0('0x0'));var Sequelize=require('sequelize');module[_0xe0b0('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xe0b0('0x2')]},'street':{'type':Sequelize[_0xe0b0('0x2')]},'postalCode':{'type':Sequelize[_0xe0b0('0x2')]},'city':{'type':Sequelize[_0xe0b0('0x2')]},'country':{'type':Sequelize[_0xe0b0('0x2')]},'dateOfBirth':{'type':Sequelize[_0xe0b0('0x2')]},'description':{'type':Sequelize[_0xe0b0('0x3')]},'phone':{'type':Sequelize[_0xe0b0('0x2')]},'mobile':{'type':Sequelize[_0xe0b0('0x2')]},'fax':{'type':Sequelize[_0xe0b0('0x2')]},'email':{'type':Sequelize[_0xe0b0('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xe0b0('0x2')]},'twitter':{'type':Sequelize[_0xe0b0('0x2')]},'skype':{'type':Sequelize[_0xe0b0('0x2')]},'teams':{'type':Sequelize[_0xe0b0('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xe0b0('0x2')]},'wechat':{'type':Sequelize[_0xe0b0('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xe0b0('0x4')]},'priority':{'type':Sequelize[_0xe0b0('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':Sequelize[_0xe0b0('0x6')]},'dialTimezone':{'type':Sequelize[_0xe0b0('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbaf0=['DATE','NOW','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x59db20,_0x9dbeb8){var _0x5cec1a=function(_0x158931){while(--_0x158931){_0x59db20['push'](_0x59db20['shift']());}};_0x5cec1a(++_0x9dbeb8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var Sequelize=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'firstName':{'type':Sequelize[_0x0baf('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0baf('0x2')]},'street':{'type':Sequelize[_0x0baf('0x2')]},'postalCode':{'type':Sequelize[_0x0baf('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0baf('0x2')]},'dateOfBirth':{'type':Sequelize[_0x0baf('0x2')]},'description':{'type':Sequelize[_0x0baf('0x3')]},'phone':{'type':Sequelize[_0x0baf('0x2')]},'mobile':{'type':Sequelize[_0x0baf('0x2')]},'fax':{'type':Sequelize[_0x0baf('0x2')]},'email':{'type':Sequelize[_0x0baf('0x2')]},'url':{'type':Sequelize[_0x0baf('0x2')]},'facebook':{'type':Sequelize[_0x0baf('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x0baf('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x0baf('0x2')]},'viber':{'type':Sequelize[_0x0baf('0x2')]},'line':{'type':Sequelize[_0x0baf('0x2')]},'wechat':{'type':Sequelize[_0x0baf('0x2')]},'telegram':{'type':Sequelize[_0x0baf('0x2')]},'UserId':{'type':Sequelize[_0x0baf('0x4')]},'priority':{'type':Sequelize[_0x0baf('0x4')](0x2)[_0x0baf('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':Sequelize[_0x0baf('0x7')]},'dialTimezone':{'type':Sequelize[_0x0baf('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 5361133..bcd87a8 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 _0xcf74=['text','phone','getTags','rawAttributes','intersection','setTags','ids','getHoppers','options','includeAll','getHopperHistories','ContactId','include','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','root','server/files/tmp','file','chmodSync','child_process','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','parse','meta','import','No\x20ListId\x20specified','binding','firstName','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','getJourney','mail','chat','sms','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','VoiceCallReport','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','Account','key','browserName','customerPort','deviceModel','osName','ratingValue','subject','substatus','openchannel','externalUrl','threadId','Owner','all','flatten','sortBy','reverse','moment','bluebird','path','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','register','json','undefined','limit','offset','count','status','set','Content-Range','then','destroy','end','sendStatus','error','stack','name','send','index','CmContact','describe','keys','length','startsWith','cf_','push','findOne','trimStart','type','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','value','fieldType','datetime','castTo','buildExpression','start','filter','Contact','isEmpty','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','clone','t.id\x20IN\x20?','user','role','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','merge','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','params','columnName','displayName','analytics','CmCustomField','findAll','alias','custom','values','catch','body','get','mergeWith','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','bulkCreate','each','duplicates','$or','ListId','findOrCreate','show','color','$and','omit','format','cf_%d','pickBy','table','id\x20=\x20?','toParam'];(function(_0x567c7d,_0x2945cb){var _0x3c9595=function(_0xbab35d){while(--_0xbab35d){_0x567c7d['push'](_0x567c7d['shift']());}};_0x3c9595(++_0x2945cb);}(_0xcf74,0x17f));var _0x4cf7=function(_0x8f3d60,_0x2df20b){_0x8f3d60=_0x8f3d60-0x0;var _0x138090=_0xcf74[_0x8f3d60];return _0x138090;};'use strict';var moment=require(_0x4cf7('0x0'));var BPromise=require(_0x4cf7('0x1'));var util=require('util');var path=require(_0x4cf7('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4cf7('0x3'));var Papa=require(_0x4cf7('0x4'));var Redis=require(_0x4cf7('0x5'));var qs=require(_0x4cf7('0x6'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x4cf7('0x7'))(_0x4cf7('0x8'));var config=require(_0x4cf7('0x9'));var shared=require(_0x4cf7('0xa'));var db=require(_0x4cf7('0xb'))['db'];config[_0x4cf7('0xc')]=_[_0x4cf7('0xd')](config[_0x4cf7('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4cf7('0xe'))(new Redis(config[_0x4cf7('0xc')]));require(_0x4cf7('0xf'))[_0x4cf7('0x10')](socket);function respondWithResult(_0x5b0cfa,_0x124dc1){_0x124dc1=_0x124dc1||0xc8;return function(_0x43a982){if(_0x43a982){return _0x5b0cfa['status'](_0x124dc1)[_0x4cf7('0x11')](_0x43a982);}};}function respondWithFilteredResult(_0x3e6aad,_0xa8fc7e){return function(_0x35f4c6){if(_0x35f4c6){var _0x4eda56=typeof _0xa8fc7e['offset']===_0x4cf7('0x12')&&typeof _0xa8fc7e[_0x4cf7('0x13')]===_0x4cf7('0x12');var _0x26ff69=_0x35f4c6['count'];var _0x5191f3=_0x4eda56?0x0:_0xa8fc7e[_0x4cf7('0x14')];var _0x332f94=_0x4eda56?_0x35f4c6[_0x4cf7('0x15')]:_0xa8fc7e[_0x4cf7('0x14')]+_0xa8fc7e['limit'];var _0x7e142b;if(_0x332f94>=_0x26ff69){_0x332f94=_0x26ff69;_0x7e142b=0xc8;}else{_0x7e142b=0xce;}_0x3e6aad[_0x4cf7('0x16')](_0x7e142b);return _0x3e6aad[_0x4cf7('0x17')](_0x4cf7('0x18'),_0x5191f3+'-'+_0x332f94+'/'+_0x26ff69)[_0x4cf7('0x11')](_0x35f4c6);}return null;};}function saveUpdates(_0x48867a){return function(_0x257578){if(_0x257578){return _0x257578['update'](_0x48867a)[_0x4cf7('0x19')](function(_0x43f0d3){return _0x43f0d3;});}return null;};}function removeEntity(_0x2d904){return function(_0x3e159e){if(_0x3e159e){return _0x3e159e[_0x4cf7('0x1a')]()[_0x4cf7('0x19')](function(){_0x2d904[_0x4cf7('0x16')](0xcc)[_0x4cf7('0x1b')]();});}};}function handleEntityNotFound(_0x3b3039){return function(_0x39df25){if(!_0x39df25){_0x3b3039[_0x4cf7('0x1c')](0x194);}return _0x39df25;};}function handleError(_0x1aeb2f,_0x4fc756){_0x4fc756=_0x4fc756||0x1f4;return function(_0x1cf4d3){logger[_0x4cf7('0x1d')](_0x1cf4d3[_0x4cf7('0x1e')]);if(_0x1cf4d3[_0x4cf7('0x1f')]){delete _0x1cf4d3[_0x4cf7('0x1f')];}_0x1aeb2f[_0x4cf7('0x16')](_0x4fc756)[_0x4cf7('0x20')](_0x1cf4d3);};}exports[_0x4cf7('0x21')]=function(_0x80bfcb,_0x1f6ff7){var _0x4ce27e={},_0x2b91f2={},_0x142c72={'count':0x0,'rows':[]};return db[_0x4cf7('0x22')][_0x4cf7('0x23')]()['then'](function(_0x25763d){var _0x4f5f9b=[];for(var _0x5875bb=0x0;_0x5875bb0x1){_0x1164c8['or'](_0x4cf7('0x5d'),qs[_0x4cf7('0x5e')](_0x1256b4),null);}else{if(qs[_0x4cf7('0x5f')](_0x1256b4)){_0x1164c8['or']('c.id\x20LIKE\x20?',_0x1256b4+'%');_0x1164c8['or'](_0x4cf7('0x60'),_0x1256b4+'%');_0x1164c8['or'](_0x4cf7('0x61'),_0x1256b4+'%');_0x1164c8['or'](_0x4cf7('0x62'),_0x1256b4+'%');}else if(qs[_0x4cf7('0x63')](_0x1256b4)){_0x1164c8['or'](_0x4cf7('0x64'),_0x1256b4+'%');}else{_0x1164c8['or'](_0x4cf7('0x65'),'%'+_0x1256b4+'%');_0x1164c8['or'](_0x4cf7('0x66'),'%'+_0x1256b4+'%');_0x1164c8['or']('c.email\x20LIKE\x20?','%'+_0x1256b4+'%');}}}}_0x1038cb[_0x4cf7('0x35')](_0x1164c8);_0x1038cb[_0x4cf7('0x67')](_0x4cf7('0x68'));var _0x48300e={'type':db[_0x4cf7('0x69')][_0x4cf7('0x6a')]['SELECT'],'raw':!![]};var _0x29ca1a=_0x1038cb[_0x4cf7('0x6b')]()[_0x4cf7('0x38')](_0x4cf7('0x68'));if(_0x4ce27e[_0x4cf7('0x33')]){_0x4ce27e[_0x4cf7('0x33')][_0x4cf7('0x4a')](function(_0x34228a){_0x1038cb[_0x4cf7('0x33')]('c.'+_0x34228a[0x0],_0x34228a[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x268fac)){_0x1038cb['having'](_0x99d3e1);_0x29ca1a[_0x4cf7('0x35')](_0x4cf7('0x6c'),_0x268fac);}BPromise['resolve']()[_0x4cf7('0x19')](function(){if(!_0x53b8bb)return;if(_0x80bfcb[_0x4cf7('0x6d')][_0x4cf7('0x6e')]!=='agent')return;if(!_[_0x4cf7('0x6f')](_0x53b8bb[_0x4cf7('0x45')],['field',_0x4cf7('0x4d')])){return _0x80bfcb[_0x4cf7('0x6d')][_0x4cf7('0x70')]({'attributes':['id'],'raw':!![]})[_0x4cf7('0x19')](function(_0xae2ccb){if(_[_0x4cf7('0x57')](_0xae2ccb)){_0x29ca1a[_0x4cf7('0x35')]('c.ListId\x20IS\x20NULL');_0x1038cb[_0x4cf7('0x35')](_0x4cf7('0x71'));}else{_0x29ca1a[_0x4cf7('0x35')](_0x4cf7('0x72'),_[_0x4cf7('0x49')](_0xae2ccb,'id'));_0x1038cb[_0x4cf7('0x35')](_0x4cf7('0x72'),_[_0x4cf7('0x49')](_0xae2ccb,'id'));}});}})[_0x4cf7('0x19')](function(){if(_0x80bfcb[_0x4cf7('0x6d')][_0x4cf7('0x6e')]==='agent'&&!_0x53b8bb&&!_0x80bfcb[_0x4cf7('0x2c')]['ListId'])return[];return db[_0x4cf7('0x73')]['query'](_0x29ca1a[_0x4cf7('0x74')](),_0x48300e);})[_0x4cf7('0x19')](function(_0x24d0b7){_0x142c72[_0x4cf7('0x15')]=_0x24d0b7[_0x4cf7('0x25')];if(_0x142c72[_0x4cf7('0x15')]===0x0)return[];return db[_0x4cf7('0x73')][_0x4cf7('0x2c')](_0x558d6f[_0x4cf7('0x74')](),_0x48300e)['then'](function(_0x4a9f25){_0x2fa32d=_[_0x4cf7('0x75')](_0x4a9f25,'id');_0x48300e=_[_0x4cf7('0x76')](_0x48300e,{'model':db[_0x4cf7('0x22')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x80bfcb[_0x4cf7('0x2c')][_0x4cf7('0x30')]){_0x4ce27e['attributes'][_0x4cf7('0x4a')](function(_0x1f3087){_0x1038cb[_0x4cf7('0x38')]('c.'+_0x1f3087);});}else{_0x1038cb[_0x4cf7('0x38')](_0x4cf7('0x68'));_0x1038cb[_0x4cf7('0x38')]('c.firstName');_0x1038cb[_0x4cf7('0x38')](_0x4cf7('0x77'));_0x1038cb[_0x4cf7('0x38')](_0x4cf7('0x78'));_0x1038cb[_0x4cf7('0x38')](_0x4cf7('0x79'));_0x1038cb[_0x4cf7('0x38')](_0x4cf7('0x7a'));_0x1038cb[_0x4cf7('0x38')](_0x4cf7('0x7b'));_0x1038cb[_0x4cf7('0x38')](_0x4cf7('0x7c'));_0x1038cb[_0x4cf7('0x38')](_0x4cf7('0x7d'));_0x1038cb[_0x4cf7('0x38')]('c.deletedAt');_0x1038cb[_0x4cf7('0x38')](_0x4cf7('0x7e'));_0x1038cb[_0x4cf7('0x38')](_0x4cf7('0x7f'),_0x4cf7('0x80'));}if(_0x4ce27e[_0x4cf7('0x13')])_0x1038cb[_0x4cf7('0x13')](_0x4ce27e[_0x4cf7('0x13')]);if(_0x4ce27e[_0x4cf7('0x14')])_0x1038cb[_0x4cf7('0x14')](_0x4ce27e[_0x4cf7('0x14')]);return db[_0x4cf7('0x73')][_0x4cf7('0x2c')](_0x1038cb[_0x4cf7('0x74')](),_0x48300e);});})[_0x4cf7('0x19')](function(_0x244f88){_0x244f88['forEach'](function(_0x4ac7e1){if(_0x4ac7e1[_0x4cf7('0x80')]){_0x4ac7e1[_0x4cf7('0x81')]=[];_0x4ac7e1[_0x4cf7('0x80')]['split'](',')[_0x4cf7('0x4a')](function(_0x43c769){_0x4ac7e1['Tags'][_0x4cf7('0x28')](_0x2fa32d[_0x43c769]);});}delete _0x4ac7e1[_0x4cf7('0x80')];});_0x142c72[_0x4cf7('0x82')]=_0x244f88;return _0x142c72;})['then'](respondWithFilteredResult(_0x1f6ff7,_0x4ce27e));})['catch'](handleError(_0x1f6ff7,null));};exports['destroy']=function(_0x1f9eac,_0x599697){return db[_0x4cf7('0x22')]['find']({'where':{'id':_0x1f9eac[_0x4cf7('0x83')]['id']}})['then'](handleEntityNotFound(_0x599697,null))[_0x4cf7('0x19')](removeEntity(_0x599697,null))['catch'](handleError(_0x599697,null));};exports['describe']=function(_0x2a01f9,_0x1faecd){return db['CmContact'][_0x4cf7('0x23')]()[_0x4cf7('0x19')](function(_0x126f8d){delete _0x126f8d['tags'];for(var _0x2bfe43=0x0;_0x2bfe43=_0x3012a0){_0x5bbd34=_0x3012a0;_0xf91190=0xc8;}else{_0xf91190=0xce;}_0x15d25c[_0xf1f4('0xc')](_0xf91190);return _0x15d25c[_0xf1f4('0x12')](_0xf1f4('0x13'),_0x4a055f+'-'+_0x5bbd34+'/'+_0x3012a0)['json'](_0x56f9a6);}return null;};}function saveUpdates(_0x1426ee){return function(_0x1dac47){if(_0x1dac47){return _0x1dac47['update'](_0x1426ee)[_0xf1f4('0x14')](function(_0x23eba5){return _0x23eba5;});}return null;};}function removeEntity(_0x388fe8){return function(_0x5ae301){if(_0x5ae301){return _0x5ae301['destroy']()[_0xf1f4('0x14')](function(){_0x388fe8[_0xf1f4('0xc')](0xcc)[_0xf1f4('0x15')]();});}};}function handleEntityNotFound(_0x4e9af8){return function(_0x278a39){if(!_0x278a39){_0x4e9af8['sendStatus'](0x194);}return _0x278a39;};}function handleError(_0x339b9e,_0x35241f){_0x35241f=_0x35241f||0x1f4;return function(_0x54c25b){logger[_0xf1f4('0x16')](_0x54c25b[_0xf1f4('0x17')]);if(_0x54c25b[_0xf1f4('0x18')]){delete _0x54c25b[_0xf1f4('0x18')];}_0x339b9e[_0xf1f4('0xc')](_0x35241f)[_0xf1f4('0x19')](_0x54c25b);};}exports['index']=function(_0x5a3353,_0x5d079b){var _0x266728={},_0x33e332={},_0x1492ad={'count':0x0,'rows':[]};return db[_0xf1f4('0x1a')][_0xf1f4('0x1b')]()['then'](function(_0x2ae552){var _0x25f474=[];for(var _0x405310=0x0;_0x4053100x1){_0x2a8015['or'](_0xf1f4('0x5c'),qs['getFullTextValue'](_0x47acfb),null);}else{if(qs[_0xf1f4('0x5d')](_0x47acfb)){_0x2a8015['or'](_0xf1f4('0x5e'),_0x47acfb+'%');_0x2a8015['or'](_0xf1f4('0x5f'),_0x47acfb+'%');_0x2a8015['or'](_0xf1f4('0x60'),_0x47acfb+'%');_0x2a8015['or']('c.fax\x20LIKE\x20?',_0x47acfb+'%');}else if(qs[_0xf1f4('0x61')](_0x47acfb)){_0x2a8015['or'](_0xf1f4('0x62'),_0x47acfb+'%');}else{_0x2a8015['or'](_0xf1f4('0x63'),'%'+_0x47acfb+'%');_0x2a8015['or']('c.lastName\x20LIKE\x20?','%'+_0x47acfb+'%');_0x2a8015['or'](_0xf1f4('0x62'),'%'+_0x47acfb+'%');}}}}_0x3c0238['where'](_0x2a8015);_0x3c0238[_0xf1f4('0x64')](_0xf1f4('0x65'));var _0x53bc07={'type':db['Sequelize']['QueryTypes'][_0xf1f4('0x66')],'raw':!![]};var _0xae2b09=_0x3c0238[_0xf1f4('0x67')]()[_0xf1f4('0x43')]('c.id');if(_0x266728[_0xf1f4('0x2e')]){_0x266728['order'][_0xf1f4('0x55')](function(_0x17f1b2){_0x3c0238[_0xf1f4('0x2e')]('c.'+_0x17f1b2[0x0],_0x17f1b2[0x1]===_0xf1f4('0x68')?![]:!![]);});}if(!_[_0xf1f4('0x69')](_0x409c37)){_0x3c0238['having'](_0x4fc3f1);_0xae2b09['where'](_0xf1f4('0x6a'),_0x409c37);}BPromise[_0xf1f4('0x6b')]()[_0xf1f4('0x14')](function(){if(!_0x52405c)return;if(_0x5a3353['user']['role']!==_0xf1f4('0x6c'))return;if(!_['some'](_0x52405c[_0xf1f4('0x41')],['field',_0xf1f4('0x4a')])){return _0x5a3353['user'][_0xf1f4('0x6d')]({'attributes':['id'],'raw':!![]})[_0xf1f4('0x14')](function(_0x2202c7){if(_[_0xf1f4('0x69')](_0x2202c7)){_0xae2b09[_0xf1f4('0x30')](_0xf1f4('0x6e'));_0x3c0238[_0xf1f4('0x30')]('c.ListId\x20IS\x20NULL');}else{_0xae2b09['where'](_0xf1f4('0x56'),_[_0xf1f4('0x47')](_0x2202c7,'id'));_0x3c0238['where']('c.ListId\x20IN\x20?',_[_0xf1f4('0x47')](_0x2202c7,'id'));}});}})[_0xf1f4('0x14')](function(){if(_0x5a3353[_0xf1f4('0x6f')][_0xf1f4('0x70')]===_0xf1f4('0x6c')&&!_0x52405c&&!_0x5a3353[_0xf1f4('0x27')]['ListId'])return[];return db[_0xf1f4('0x71')][_0xf1f4('0x27')](_0xae2b09['toString'](),_0x53bc07);})[_0xf1f4('0x14')](function(_0x12f574){_0x1492ad[_0xf1f4('0x11')]=_0x12f574[_0xf1f4('0x1d')];if(_0x1492ad[_0xf1f4('0x11')]===0x0)return[];return db['sequelize'][_0xf1f4('0x27')](_0x1310f3[_0xf1f4('0x72')](),_0x53bc07)['then'](function(_0x4659a8){_0x14b01a=_[_0xf1f4('0x73')](_0x4659a8,'id');_0x53bc07=_[_0xf1f4('0x74')](_0x53bc07,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5a3353[_0xf1f4('0x27')][_0xf1f4('0x2b')]){_0x266728[_0xf1f4('0x2a')][_0xf1f4('0x55')](function(_0x1662b4){_0x3c0238[_0xf1f4('0x43')]('c.'+_0x1662b4);});}else{_0x3c0238[_0xf1f4('0x43')](_0xf1f4('0x65'));_0x3c0238[_0xf1f4('0x43')](_0xf1f4('0x75'));_0x3c0238[_0xf1f4('0x43')](_0xf1f4('0x76'));_0x3c0238[_0xf1f4('0x43')]('c.phone');_0x3c0238[_0xf1f4('0x43')](_0xf1f4('0x77'));_0x3c0238[_0xf1f4('0x43')](_0xf1f4('0x78'));_0x3c0238[_0xf1f4('0x43')](_0xf1f4('0x79'));_0x3c0238['field']('c.ListId');_0x3c0238[_0xf1f4('0x43')]('c.createdAt');_0x3c0238[_0xf1f4('0x43')](_0xf1f4('0x7a'));_0x3c0238[_0xf1f4('0x43')](_0xf1f4('0x7b'));_0x3c0238[_0xf1f4('0x43')](_0xf1f4('0x7c'),_0xf1f4('0x7d'));}if(_0x266728[_0xf1f4('0xf')])_0x3c0238[_0xf1f4('0xf')](_0x266728[_0xf1f4('0xf')]);if(_0x266728['offset'])_0x3c0238[_0xf1f4('0xe')](_0x266728[_0xf1f4('0xe')]);return db[_0xf1f4('0x71')]['query'](_0x3c0238[_0xf1f4('0x72')](),_0x53bc07);});})[_0xf1f4('0x14')](function(_0x4595a9){_0x4595a9[_0xf1f4('0x55')](function(_0x5bcd2b){if(_0x5bcd2b['TagIds']){_0x5bcd2b[_0xf1f4('0x7e')]=[];_0x5bcd2b[_0xf1f4('0x7d')][_0xf1f4('0x46')](',')['forEach'](function(_0x530e9f){_0x5bcd2b['Tags'][_0xf1f4('0x1f')](_0x14b01a[_0x530e9f]);});}delete _0x5bcd2b[_0xf1f4('0x7d')];});_0x1492ad[_0xf1f4('0x7f')]=_0x4595a9;return _0x1492ad;})[_0xf1f4('0x14')](respondWithFilteredResult(_0x5d079b,_0x266728));})[_0xf1f4('0x80')](handleError(_0x5d079b,null));};exports[_0xf1f4('0x81')]=function(_0xa2dcc8,_0x1671af){return db[_0xf1f4('0x1a')]['find']({'where':{'id':_0xa2dcc8['params']['id']}})[_0xf1f4('0x14')](handleEntityNotFound(_0x1671af,null))[_0xf1f4('0x14')](removeEntity(_0x1671af,null))[_0xf1f4('0x80')](handleError(_0x1671af,null));};exports[_0xf1f4('0x1b')]=function(_0x8d7666,_0x4ce156){return db[_0xf1f4('0x1a')][_0xf1f4('0x1b')]()['then'](function(_0x903bbb){delete _0x903bbb[_0xf1f4('0x82')];for(var _0x44e0a1=0x0;_0x44e0a1{}\s\\|]/g,'-');_0x4960a5(null,util['format'](_0xa2a9('0x23'),path['basename'](_0x2ea9a5[_0xa2a9('0x21')],path['extname'](_0x2ea9a5[_0xa2a9('0x21')])),Date['now'](),path[_0xa2a9('0x24')](_0x2ea9a5['originalname'])));}})});router[_0xa2a9('0x18')](_0xa2a9('0x25'),upload[_0xa2a9('0x26')](_0xa2a9('0x27')),controller[_0xa2a9('0x28')]);var upload=multer({'storage':multer[_0xa2a9('0x1e')]({'destination':function(_0x21bf63,_0x5c1ac6,_0x2e1353){_0x2e1353(null,path['join'](config[_0xa2a9('0x1f')],_0xa2a9('0x20')));},'filename':function(_0x5abaea,_0x5610df,_0xadab98){_0x5610df['originalname']=_0x5610df[_0xa2a9('0x21')][_0xa2a9('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xadab98(null,util[_0xa2a9('0x29')]('%s-%s%s',path['basename'](_0x5610df[_0xa2a9('0x21')],path[_0xa2a9('0x24')](_0x5610df['originalname'])),Date[_0xa2a9('0x2a')](),path['extname'](_0x5610df[_0xa2a9('0x21')])));}})});router[_0xa2a9('0x18')](_0xa2a9('0x2b'),upload['single'](_0xa2a9('0x27')),controller[_0xa2a9('0x2c')]);router['post'](_0xa2a9('0x2d'),auth[_0xa2a9('0x7')](),controller['import']);router['put'](_0xa2a9('0xc'),auth[_0xa2a9('0x7')](),controller[_0xa2a9('0x2e')]);router['delete']('/:id',auth[_0xa2a9('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xec7f=['/upload/:id','import','put','delete','destroy','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/journey','getJourney','/merge','merge','create','post','/create_many','setTags','join','root','server/files/tmp','originalname','now','extname','/csv','file','uploadCsv','diskStorage','replace','format','%s-%s%s','basename','/upload','single','upload'];(function(_0x3ec592,_0x5ea0b0){var _0xd9d9e7=function(_0x424f2d){while(--_0x424f2d){_0x3ec592['push'](_0x3ec592['shift']());}};_0xd9d9e7(++_0x5ea0b0);}(_0xec7f,0x163));var _0xfec7=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xec7f[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfec7('0x0'));var timeout=require('connect-timeout');var express=require(_0xfec7('0x1'));var router=express[_0xfec7('0x2')]();var fs_extra=require(_0xfec7('0x3'));var auth=require(_0xfec7('0x4'));var interaction=require(_0xfec7('0x5'));var config=require('../../config/environment');var controller=require(_0xfec7('0x6'));router[_0xfec7('0x7')]('/',auth[_0xfec7('0x8')](),controller[_0xfec7('0x9')]);router[_0xfec7('0x7')](_0xfec7('0xa'),auth[_0xfec7('0x8')](),controller[_0xfec7('0xb')]);router[_0xfec7('0x7')](_0xfec7('0xc'),auth[_0xfec7('0x8')](),controller[_0xfec7('0xd')]);router[_0xfec7('0x7')](_0xfec7('0xe'),auth[_0xfec7('0x8')](),controller[_0xfec7('0xf')]);router[_0xfec7('0x7')](_0xfec7('0x10'),auth['isAuthenticated'](),controller['getHoppers']);router[_0xfec7('0x7')]('/:id/hopper_histories',auth[_0xfec7('0x8')](),controller[_0xfec7('0x11')]);router[_0xfec7('0x7')](_0xfec7('0x12'),auth[_0xfec7('0x8')](),controller[_0xfec7('0x13')]);router[_0xfec7('0x7')]('/:id/jscripty_sessions',auth[_0xfec7('0x8')](),controller['getJscriptySessions']);router['get'](_0xfec7('0x14'),auth['isAuthenticated'](),controller[_0xfec7('0x15')]);router['post'](_0xfec7('0x16'),auth['isAuthenticated'](),controller[_0xfec7('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfec7('0x18')]);router[_0xfec7('0x19')](_0xfec7('0x1a'),auth[_0xfec7('0x8')](),controller['bulkCreate']);router[_0xfec7('0x19')](_0xfec7('0xe'),auth[_0xfec7('0x8')](),controller[_0xfec7('0x1b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1145fe,_0x501d1c,_0x1287ce){_0x1287ce(null,path[_0xfec7('0x1c')](config[_0xfec7('0x1d')],_0xfec7('0x1e')));},'filename':function(_0xcaad8e,_0x76b72f,_0x559cf4){_0x76b72f[_0xfec7('0x1f')]=_0x76b72f[_0xfec7('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x559cf4(null,util['format']('%s-%s%s',path['basename'](_0x76b72f[_0xfec7('0x1f')],path['extname'](_0x76b72f[_0xfec7('0x1f')])),Date[_0xfec7('0x20')](),path[_0xfec7('0x21')](_0x76b72f[_0xfec7('0x1f')])));}})});router[_0xfec7('0x19')](_0xfec7('0x22'),upload['single'](_0xfec7('0x23')),controller[_0xfec7('0x24')]);var upload=multer({'storage':multer[_0xfec7('0x25')]({'destination':function(_0x1e3462,_0xcd0231,_0x1d4f03){_0x1d4f03(null,path[_0xfec7('0x1c')](config['root'],_0xfec7('0x1e')));},'filename':function(_0x7fd996,_0x57b5e8,_0x1c0d3f){_0x57b5e8[_0xfec7('0x1f')]=_0x57b5e8['originalname'][_0xfec7('0x26')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1c0d3f(null,util[_0xfec7('0x27')](_0xfec7('0x28'),path[_0xfec7('0x29')](_0x57b5e8[_0xfec7('0x1f')],path[_0xfec7('0x21')](_0x57b5e8[_0xfec7('0x1f')])),Date[_0xfec7('0x20')](),path[_0xfec7('0x21')](_0x57b5e8[_0xfec7('0x1f')])));}})});router[_0xfec7('0x19')](_0xfec7('0x2a'),upload[_0xfec7('0x2b')](_0xfec7('0x23')),controller[_0xfec7('0x2c')]);router[_0xfec7('0x19')](_0xfec7('0x2d'),auth[_0xfec7('0x8')](),controller[_0xfec7('0x2e')]);router[_0xfec7('0x2f')]('/:id',auth[_0xfec7('0x8')](),controller['update']);router[_0xfec7('0x30')](_0xfec7('0xc'),auth[_0xfec7('0x8')](),controller[_0xfec7('0x31')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 3669d11..62decbf 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 _0xbe0e=['parse','values','stringify','BOOLEAN','ENUM','voice','sequelize','exports','VIRTUAL','alias','STRING','setDataValue','getDataValue','name','long','type'];(function(_0x10fa95,_0x339386){var _0x7d1a41=function(_0x1fa8be){while(--_0x1fa8be){_0x10fa95['push'](_0x10fa95['shift']());}};_0x7d1a41(++_0x339386);}(_0xbe0e,0x116));var _0xebe0=function(_0x121908,_0x3c9fb5){_0x121908=_0x121908-0x0;var _0x385b14=_0xbe0e[_0x121908];return _0x385b14;};'use strict';var Sequelize=require(_0xebe0('0x0'));var _=require('lodash');module[_0xebe0('0x1')]={'name':{'type':Sequelize[_0xebe0('0x2')],'get':function(_0x205898){return this['getDataValue'](_0xebe0('0x3'));}},'alias':{'type':Sequelize[_0xebe0('0x4')],'allowNull':![],'set':function(_0x3777c5){this[_0xebe0('0x5')](_0xebe0('0x3'),_0x3777c5?_0x3777c5:this[_0xebe0('0x6')](_0xebe0('0x7')));}},'type':{'type':Sequelize[_0xebe0('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xebe0('0x8')),'get':function(){if(this[_0xebe0('0x6')](_0xebe0('0x9'))==='select'){return JSON[_0xebe0('0xa')](this[_0xebe0('0x6')]('values'));}else{return this[_0xebe0('0x6')](_0xebe0('0xb'));}},'set':function(_0x386c9){if(Array['isArray'](_0x386c9)){this['setDataValue'](_0xebe0('0xb'),JSON[_0xebe0('0xc')](_0x386c9));}else{this[_0xebe0('0x5')](_0xebe0('0xb'),_0x386c9);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xebe0('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xebe0('0xe')](_0xebe0('0xf'))}}; \ No newline at end of file +var _0x25f0=['exports','VIRTUAL','getDataValue','alias','STRING','name','TEXT','long','type','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize'];(function(_0x6e2cfd,_0xd64de2){var _0xaa4745=function(_0x44e0f7){while(--_0x44e0f7){_0x6e2cfd['push'](_0x6e2cfd['shift']());}};_0xaa4745(++_0xd64de2);}(_0x25f0,0xbd));var _0x025f=function(_0x4cf601,_0x586fac){_0x4cf601=_0x4cf601-0x0;var _0x2dcddb=_0x25f0[_0x4cf601];return _0x2dcddb;};'use strict';var Sequelize=require(_0x025f('0x0'));var _=require('lodash');module[_0x025f('0x1')]={'name':{'type':Sequelize[_0x025f('0x2')],'get':function(_0x7421e7){return this[_0x025f('0x3')](_0x025f('0x4'));}},'alias':{'type':Sequelize[_0x025f('0x5')],'allowNull':![],'set':function(_0x33f67c){this['setDataValue']('alias',_0x33f67c?_0x33f67c:this['getDataValue'](_0x025f('0x6')));}},'type':{'type':Sequelize[_0x025f('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x025f('0x7')](_0x025f('0x8')),'get':function(){if(this['getDataValue'](_0x025f('0x9'))===_0x025f('0xa')){return JSON[_0x025f('0xb')](this[_0x025f('0x3')](_0x025f('0xc')));}else{return this[_0x025f('0x3')](_0x025f('0xc'));}},'set':function(_0x9acc9a){if(Array[_0x025f('0xd')](_0x9acc9a)){this[_0x025f('0xe')](_0x025f('0xc'),JSON[_0x025f('0xf')](_0x9acc9a));}else{this[_0x025f('0xe')](_0x025f('0xc'),_0x9acc9a);}}},'required':{'type':Sequelize[_0x025f('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x025f('0x11')](_0x025f('0x12'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 610d9e7..b1d9f5c 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 _0x754f=['INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','CmCustomField','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','show','find','catch','body','params','create','sequelize','transaction','Sequelize','TEXT'];(function(_0x109371,_0x441c8e){var _0x4fd858=function(_0x13504f){while(--_0x13504f){_0x109371['push'](_0x109371['shift']());}};_0x4fd858(++_0x441c8e);}(_0x754f,0x16c));var _0xf754=function(_0x281bac,_0x29916c){_0x281bac=_0x281bac-0x0;var _0x36cb32=_0x754f[_0x281bac];return _0x36cb32;};'use strict';var emlformat=require(_0xf754('0x0'));var rimraf=require(_0xf754('0x1'));var zipdir=require(_0xf754('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf754('0x3'));var moment=require(_0xf754('0x4'));var BPromise=require(_0xf754('0x5'));var Mustache=require(_0xf754('0x6'));var util=require(_0xf754('0x7'));var path=require(_0xf754('0x8'));var sox=require(_0xf754('0x9'));var csv=require(_0xf754('0xa'));var ejs=require(_0xf754('0xb'));var fs=require('fs');var fs_extra=require(_0xf754('0xc'));var _=require(_0xf754('0xd'));var squel=require(_0xf754('0xe'));var crypto=require(_0xf754('0xf'));var jsforce=require(_0xf754('0x10'));var deskjs=require(_0xf754('0x11'));var toCsv=require(_0xf754('0xa'));var querystring=require(_0xf754('0x12'));var Papa=require(_0xf754('0x13'));var Redis=require(_0xf754('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf754('0x15'));var hardwareService=require(_0xf754('0x16'));var logger=require(_0xf754('0x17'))(_0xf754('0x18'));var utils=require(_0xf754('0x19'));var config=require(_0xf754('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2059a9,_0x116842){_0x116842=_0x116842||0xcc;return function(_0x37d374){if(_0x37d374){return _0x2059a9[_0xf754('0x1b')](_0x116842);}return _0x2059a9[_0xf754('0x1c')](_0x116842)[_0xf754('0x1d')]();};}function respondWithResult(_0x4583a3,_0x3f6032){_0x3f6032=_0x3f6032||0xc8;return function(_0x1419f3){if(_0x1419f3){return _0x4583a3[_0xf754('0x1c')](_0x3f6032)[_0xf754('0x1e')](_0x1419f3);}};}function respondWithFilteredResult(_0x3a1e83,_0x77f6f){return function(_0x5e35c1){if(_0x5e35c1){var _0x397e6c=typeof _0x77f6f[_0xf754('0x1f')]===_0xf754('0x20')&&typeof _0x77f6f[_0xf754('0x21')]===_0xf754('0x20');var _0x4835af=_0x5e35c1[_0xf754('0x22')];var _0x38740c=_0x397e6c?0x0:_0x77f6f['offset'];var _0x273ff7=_0x397e6c?_0x5e35c1[_0xf754('0x22')]:_0x77f6f[_0xf754('0x1f')]+_0x77f6f['limit'];var _0x323342;if(_0x273ff7>=_0x4835af){_0x273ff7=_0x4835af;_0x323342=0xc8;}else{_0x323342=0xce;}_0x3a1e83[_0xf754('0x1c')](_0x323342);return _0x3a1e83[_0xf754('0x23')](_0xf754('0x24'),_0x38740c+'-'+_0x273ff7+'/'+_0x4835af)['json'](_0x5e35c1);}return null;};}function patchUpdates(_0x52d1e1){return function(_0xb11a27){try{jsonpatch[_0xf754('0x25')](_0xb11a27,_0x52d1e1,!![]);}catch(_0x13dc5f){return BPromise[_0xf754('0x26')](_0x13dc5f);}return _0xb11a27['save']();};}function saveUpdates(_0x1cc49c,_0x2b14e8){return function(_0x398c48){if(_0x398c48){return _0x398c48[_0xf754('0x27')](_0x1cc49c)[_0xf754('0x28')](function(_0x2451c2){return _0x2451c2;});}return null;};}function removeEntity(_0x7dd505,_0x2f5459){return function(_0x26458b){if(_0x26458b){return _0x26458b[_0xf754('0x29')]()[_0xf754('0x28')](function(){_0x7dd505[_0xf754('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x461e35,_0x37b2fb){return function(_0x15e6a4){if(!_0x15e6a4){_0x461e35[_0xf754('0x1b')](0x194);}return _0x15e6a4;};}function handleError(_0x31c864,_0xe246ba){_0xe246ba=_0xe246ba||0x1f4;return function(_0x3a3ff0){logger[_0xf754('0x2a')](_0x3a3ff0[_0xf754('0x2b')]);if(_0x3a3ff0['name']){delete _0x3a3ff0[_0xf754('0x2c')];}_0x31c864[_0xf754('0x1c')](_0xe246ba)[_0xf754('0x2d')](_0x3a3ff0);};}exports[_0xf754('0x2e')]=function(_0x466f43,_0x3abc16){var _0xf2df1={},_0x3c79ab={},_0x4e9333={'count':0x0,'rows':[]};var _0xf35260=_[_0xf754('0x2f')](db[_0xf754('0x30')]['rawAttributes'],function(_0x4e3775){return{'name':_0x4e3775[_0xf754('0x31')],'type':_0x4e3775[_0xf754('0x32')][_0xf754('0x33')]};});_0x3c79ab[_0xf754('0x34')]=_[_0xf754('0x35')](_[_0xf754('0x2f')](_0xf35260,'name'),[_0xf754('0x2c')]);_0x3c79ab['query']=_[_0xf754('0x36')](_0x466f43[_0xf754('0x37')]);_0x3c79ab[_0xf754('0x38')]=_[_0xf754('0x39')](_0x3c79ab[_0xf754('0x34')],_0x3c79ab[_0xf754('0x37')]);_0xf2df1[_0xf754('0x3a')]=_['intersection'](_0x3c79ab[_0xf754('0x34')],qs[_0xf754('0x3b')](_0x466f43[_0xf754('0x37')][_0xf754('0x3b')]));_0xf2df1['attributes']=_0xf2df1[_0xf754('0x3a')][_0xf754('0x3c')]?_0xf2df1[_0xf754('0x3a')]:_0x3c79ab['model'];if(!_0x466f43[_0xf754('0x37')][_0xf754('0x3d')]('nolimit')){_0xf2df1['limit']=qs[_0xf754('0x21')](_0x466f43[_0xf754('0x37')][_0xf754('0x21')]);_0xf2df1['offset']=qs[_0xf754('0x1f')](_0x466f43[_0xf754('0x37')][_0xf754('0x1f')]);}_0xf2df1[_0xf754('0x3e')]=qs['sort'](_0x466f43[_0xf754('0x37')][_0xf754('0x3f')]);_0xf2df1[_0xf754('0x40')]=qs[_0xf754('0x38')](_[_0xf754('0x41')](_0x466f43[_0xf754('0x37')],_0x3c79ab[_0xf754('0x38')]),_0xf35260);if(_0x466f43['query'][_0xf754('0x42')]){_0xf2df1['where']=_['merge'](_0xf2df1[_0xf754('0x40')],{'$or':_[_0xf754('0x2f')](_0xf35260,function(_0x3a71ae){if(_0x3a71ae['type']!=='VIRTUAL'){var _0x5a75c3={};_0x5a75c3[_0x3a71ae[_0xf754('0x2c')]]={'$like':'%'+_0x466f43[_0xf754('0x37')]['filter']+'%'};return _0x5a75c3;}})});}_0xf2df1=_[_0xf754('0x43')]({},_0xf2df1,_0x466f43[_0xf754('0x44')]);var _0x3b4e21={'where':_0xf2df1[_0xf754('0x40')]};return db['CmCustomField']['count'](_0x3b4e21)['then'](function(_0x2d147b){_0x4e9333['count']=_0x2d147b;if(_0x466f43[_0xf754('0x37')][_0xf754('0x45')]){_0xf2df1[_0xf754('0x46')]=[{'all':!![]}];}return db[_0xf754('0x30')]['findAll'](_0xf2df1);})['then'](function(_0x27c8b5){_0x4e9333['rows']=_0x27c8b5;return _0x4e9333;})[_0xf754('0x28')](respondWithFilteredResult(_0x3abc16,_0xf2df1))['catch'](handleError(_0x3abc16,null));};exports[_0xf754('0x47')]=function(_0xdc6132,_0x1c218c){var _0x5adc02={'raw':!![],'where':{'id':_0xdc6132['params']['id']}},_0x353a3a={};_0x353a3a['model']=_[_0xf754('0x36')](db['CmCustomField']['rawAttributes']);_0x353a3a[_0xf754('0x37')]=_['keys'](_0xdc6132[_0xf754('0x37')]);_0x353a3a[_0xf754('0x38')]=_[_0xf754('0x39')](_0x353a3a['model'],_0x353a3a['query']);_0x5adc02[_0xf754('0x3a')]=_[_0xf754('0x39')](_0x353a3a[_0xf754('0x34')],qs[_0xf754('0x3b')](_0xdc6132['query']['fields']));_0x5adc02[_0xf754('0x3a')]=_0x5adc02[_0xf754('0x3a')][_0xf754('0x3c')]?_0x5adc02[_0xf754('0x3a')]:_0x353a3a[_0xf754('0x34')];if(_0xdc6132['query'][_0xf754('0x45')]){_0x5adc02[_0xf754('0x46')]=[{'all':!![]}];}_0x5adc02=_[_0xf754('0x43')]({},_0x5adc02,_0xdc6132[_0xf754('0x44')]);return db[_0xf754('0x30')][_0xf754('0x48')](_0x5adc02)[_0xf754('0x28')](handleEntityNotFound(_0x1c218c,null))[_0xf754('0x28')](respondWithResult(_0x1c218c,null))[_0xf754('0x49')](handleError(_0x1c218c,null));};exports[_0xf754('0x27')]=function(_0x5ee998,_0x2790ce){if(_0x5ee998[_0xf754('0x4a')]['id']){delete _0x5ee998[_0xf754('0x4a')]['id'];}return db['CmCustomField'][_0xf754('0x48')]({'where':{'id':_0x5ee998['params']['id']}})[_0xf754('0x28')](handleEntityNotFound(_0x2790ce,null))['then'](saveUpdates(_0x5ee998['body'],null))[_0xf754('0x28')](respondWithResult(_0x2790ce,null))['catch'](handleError(_0x2790ce,null));};exports[_0xf754('0x29')]=function(_0x4e2b69,_0x246c65){return db[_0xf754('0x30')][_0xf754('0x48')]({'where':{'id':_0x4e2b69[_0xf754('0x4b')]['id']}})[_0xf754('0x28')](handleEntityNotFound(_0x246c65,null))['then'](removeEntity(_0x246c65,null))[_0xf754('0x49')](handleError(_0x246c65,null));};exports[_0xf754('0x4c')]=function(_0x49d65b,_0x1ff1fd){var _0x4e3266;return db[_0xf754('0x4d')][_0xf754('0x4e')](function(_0x401450){return db['CmCustomField'][_0xf754('0x4c')](_0x49d65b[_0xf754('0x4a')],{'transaction':_0x401450})[_0xf754('0x28')](function(_0xc4b94a){_0x4e3266=_0xc4b94a;var _0x183591={'type':db[_0xf754('0x4f')][_0xf754('0x50')],'transaction':_0x401450};switch(_0x49d65b['body'][_0xf754('0x32')]){case'text':_0x183591[_0xf754('0x32')]=db[_0xf754('0x4f')]['TEXT'];break;case'number':_0x183591[_0xf754('0x32')]=db[_0xf754('0x4f')][_0xf754('0x51')];break;case _0xf754('0x52'):_0x183591['type']=db[_0xf754('0x4f')]['BOOLEAN'];_0x183591[_0xf754('0x53')]=![];break;default:}return db['sequelize'][_0xf754('0x54')][_0xf754('0x55')](_0xf754('0x56'),util[_0xf754('0x57')](_0xf754('0x58'),_0x4e3266['id']),_0x183591);})[_0xf754('0x28')](function(){return _0x4e3266;});})[_0xf754('0x28')](respondWithResult(_0x1ff1fd,0xc9))[_0xf754('0x49')](handleError(_0x1ff1fd,null));}; \ No newline at end of file +var _0xaa7f=['includeAll','include','findAll','catch','show','params','find','update','body','sequelize','transaction','create','Sequelize','type','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','index','CmCustomField','rawAttributes','fieldName','model','differenceBy','map','name','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x3cca8f,_0x19b8af){var _0x2c7e8c=function(_0x4e8a1a){while(--_0x4e8a1a){_0x3cca8f['push'](_0x3cca8f['shift']());}};_0x2c7e8c(++_0x19b8af);}(_0xaa7f,0x166));var _0xfaa7=function(_0x411023,_0x9be3b7){_0x411023=_0x411023-0x0;var _0x521781=_0xaa7f[_0x411023];return _0x521781;};'use strict';var emlformat=require(_0xfaa7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfaa7('0x1'));var jsonpatch=require(_0xfaa7('0x2'));var rp=require(_0xfaa7('0x3'));var moment=require(_0xfaa7('0x4'));var BPromise=require(_0xfaa7('0x5'));var Mustache=require('mustache');var util=require(_0xfaa7('0x6'));var path=require(_0xfaa7('0x7'));var sox=require(_0xfaa7('0x8'));var csv=require(_0xfaa7('0x9'));var ejs=require(_0xfaa7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfaa7('0xb'));var squel=require(_0xfaa7('0xc'));var crypto=require(_0xfaa7('0xd'));var jsforce=require(_0xfaa7('0xe'));var deskjs=require(_0xfaa7('0xf'));var toCsv=require(_0xfaa7('0x9'));var querystring=require(_0xfaa7('0x10'));var Papa=require(_0xfaa7('0x11'));var Redis=require(_0xfaa7('0x12'));var authService=require(_0xfaa7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xfaa7('0x14'));var hardwareService=require(_0xfaa7('0x15'));var logger=require(_0xfaa7('0x16'))('api');var utils=require(_0xfaa7('0x17'));var config=require(_0xfaa7('0x18'));var licenseUtil=require(_0xfaa7('0x19'));var db=require(_0xfaa7('0x1a'))['db'];function respondWithStatusCode(_0x4dc163,_0x19c9b6){_0x19c9b6=_0x19c9b6||0xcc;return function(_0x242891){if(_0x242891){return _0x4dc163[_0xfaa7('0x1b')](_0x19c9b6);}return _0x4dc163[_0xfaa7('0x1c')](_0x19c9b6)['end']();};}function respondWithResult(_0x2a3b3a,_0x5c6be8){_0x5c6be8=_0x5c6be8||0xc8;return function(_0x417728){if(_0x417728){return _0x2a3b3a[_0xfaa7('0x1c')](_0x5c6be8)[_0xfaa7('0x1d')](_0x417728);}};}function respondWithFilteredResult(_0x2f1cbb,_0x32a525){return function(_0x1e2028){if(_0x1e2028){var _0x2173f1=typeof _0x32a525[_0xfaa7('0x1e')]==='undefined'&&typeof _0x32a525[_0xfaa7('0x1f')]===_0xfaa7('0x20');var _0x40071d=_0x1e2028[_0xfaa7('0x21')];var _0x446985=_0x2173f1?0x0:_0x32a525[_0xfaa7('0x1e')];var _0x3412eb=_0x2173f1?_0x1e2028[_0xfaa7('0x21')]:_0x32a525[_0xfaa7('0x1e')]+_0x32a525[_0xfaa7('0x1f')];var _0x306226;if(_0x3412eb>=_0x40071d){_0x3412eb=_0x40071d;_0x306226=0xc8;}else{_0x306226=0xce;}_0x2f1cbb[_0xfaa7('0x1c')](_0x306226);return _0x2f1cbb[_0xfaa7('0x22')](_0xfaa7('0x23'),_0x446985+'-'+_0x3412eb+'/'+_0x40071d)[_0xfaa7('0x1d')](_0x1e2028);}return null;};}function patchUpdates(_0x44ae68){return function(_0x1e8243){try{jsonpatch[_0xfaa7('0x24')](_0x1e8243,_0x44ae68,!![]);}catch(_0x4b507c){return BPromise['reject'](_0x4b507c);}return _0x1e8243[_0xfaa7('0x25')]();};}function saveUpdates(_0x1bc5d2,_0x11ad68){return function(_0xdc0f4f){if(_0xdc0f4f){return _0xdc0f4f['update'](_0x1bc5d2)[_0xfaa7('0x26')](function(_0x285767){return _0x285767;});}return null;};}function removeEntity(_0x315169,_0x6747ad){return function(_0x2ed10){if(_0x2ed10){return _0x2ed10[_0xfaa7('0x27')]()[_0xfaa7('0x26')](function(){_0x315169['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30776c,_0x137529){return function(_0x35ad89){if(!_0x35ad89){_0x30776c[_0xfaa7('0x1b')](0x194);}return _0x35ad89;};}function handleError(_0x45be38,_0x469bc1){_0x469bc1=_0x469bc1||0x1f4;return function(_0x35e4b3){logger['error'](_0x35e4b3['stack']);if(_0x35e4b3['name']){delete _0x35e4b3['name'];}_0x45be38['status'](_0x469bc1)['send'](_0x35e4b3);};}exports[_0xfaa7('0x28')]=function(_0x29d8e9,_0x2826f0){var _0x3df4fb={},_0xa65693={},_0x3bdfd3={'count':0x0,'rows':[]};var _0x12a010=_['map'](db[_0xfaa7('0x29')][_0xfaa7('0x2a')],function(_0x286653){return{'name':_0x286653[_0xfaa7('0x2b')],'type':_0x286653['type']['key']};});_0xa65693[_0xfaa7('0x2c')]=_[_0xfaa7('0x2d')](_[_0xfaa7('0x2e')](_0x12a010,'name'),[_0xfaa7('0x2f')]);_0xa65693[_0xfaa7('0x30')]=_[_0xfaa7('0x31')](_0x29d8e9['query']);_0xa65693[_0xfaa7('0x32')]=_[_0xfaa7('0x33')](_0xa65693[_0xfaa7('0x2c')],_0xa65693[_0xfaa7('0x30')]);_0x3df4fb['attributes']=_[_0xfaa7('0x33')](_0xa65693[_0xfaa7('0x2c')],qs[_0xfaa7('0x34')](_0x29d8e9[_0xfaa7('0x30')][_0xfaa7('0x34')]));_0x3df4fb[_0xfaa7('0x35')]=_0x3df4fb[_0xfaa7('0x35')][_0xfaa7('0x36')]?_0x3df4fb[_0xfaa7('0x35')]:_0xa65693['model'];if(!_0x29d8e9[_0xfaa7('0x30')]['hasOwnProperty']('nolimit')){_0x3df4fb[_0xfaa7('0x1f')]=qs[_0xfaa7('0x1f')](_0x29d8e9[_0xfaa7('0x30')][_0xfaa7('0x1f')]);_0x3df4fb[_0xfaa7('0x1e')]=qs['offset'](_0x29d8e9['query'][_0xfaa7('0x1e')]);}_0x3df4fb[_0xfaa7('0x37')]=qs[_0xfaa7('0x38')](_0x29d8e9[_0xfaa7('0x30')][_0xfaa7('0x38')]);_0x3df4fb[_0xfaa7('0x39')]=qs[_0xfaa7('0x32')](_['pick'](_0x29d8e9[_0xfaa7('0x30')],_0xa65693['filters']),_0x12a010);if(_0x29d8e9[_0xfaa7('0x30')][_0xfaa7('0x3a')]){_0x3df4fb[_0xfaa7('0x39')]=_[_0xfaa7('0x3b')](_0x3df4fb[_0xfaa7('0x39')],{'$or':_['map'](_0x12a010,function(_0x9a909a){if(_0x9a909a['type']!==_0xfaa7('0x3c')){var _0x88412b={};_0x88412b[_0x9a909a['name']]={'$like':'%'+_0x29d8e9[_0xfaa7('0x30')][_0xfaa7('0x3a')]+'%'};return _0x88412b;}})});}_0x3df4fb=_[_0xfaa7('0x3b')]({},_0x3df4fb,_0x29d8e9[_0xfaa7('0x3d')]);var _0x4aba07={'where':_0x3df4fb[_0xfaa7('0x39')]};return db[_0xfaa7('0x29')][_0xfaa7('0x21')](_0x4aba07)[_0xfaa7('0x26')](function(_0x5d3795){_0x3bdfd3[_0xfaa7('0x21')]=_0x5d3795;if(_0x29d8e9[_0xfaa7('0x30')][_0xfaa7('0x3e')]){_0x3df4fb[_0xfaa7('0x3f')]=[{'all':!![]}];}return db['CmCustomField'][_0xfaa7('0x40')](_0x3df4fb);})[_0xfaa7('0x26')](function(_0x1a8eea){_0x3bdfd3['rows']=_0x1a8eea;return _0x3bdfd3;})[_0xfaa7('0x26')](respondWithFilteredResult(_0x2826f0,_0x3df4fb))[_0xfaa7('0x41')](handleError(_0x2826f0,null));};exports[_0xfaa7('0x42')]=function(_0x1f4bb3,_0x43cb0c){var _0x123a0c={'raw':!![],'where':{'id':_0x1f4bb3[_0xfaa7('0x43')]['id']}},_0x46a75b={};_0x46a75b['model']=_[_0xfaa7('0x31')](db['CmCustomField'][_0xfaa7('0x2a')]);_0x46a75b[_0xfaa7('0x30')]=_['keys'](_0x1f4bb3[_0xfaa7('0x30')]);_0x46a75b[_0xfaa7('0x32')]=_[_0xfaa7('0x33')](_0x46a75b[_0xfaa7('0x2c')],_0x46a75b[_0xfaa7('0x30')]);_0x123a0c[_0xfaa7('0x35')]=_[_0xfaa7('0x33')](_0x46a75b[_0xfaa7('0x2c')],qs[_0xfaa7('0x34')](_0x1f4bb3[_0xfaa7('0x30')][_0xfaa7('0x34')]));_0x123a0c[_0xfaa7('0x35')]=_0x123a0c[_0xfaa7('0x35')][_0xfaa7('0x36')]?_0x123a0c['attributes']:_0x46a75b[_0xfaa7('0x2c')];if(_0x1f4bb3[_0xfaa7('0x30')]['includeAll']){_0x123a0c[_0xfaa7('0x3f')]=[{'all':!![]}];}_0x123a0c=_['merge']({},_0x123a0c,_0x1f4bb3['options']);return db[_0xfaa7('0x29')][_0xfaa7('0x44')](_0x123a0c)['then'](handleEntityNotFound(_0x43cb0c,null))[_0xfaa7('0x26')](respondWithResult(_0x43cb0c,null))['catch'](handleError(_0x43cb0c,null));};exports[_0xfaa7('0x45')]=function(_0x5b0478,_0x3fe497){if(_0x5b0478[_0xfaa7('0x46')]['id']){delete _0x5b0478['body']['id'];}return db['CmCustomField'][_0xfaa7('0x44')]({'where':{'id':_0x5b0478[_0xfaa7('0x43')]['id']}})[_0xfaa7('0x26')](handleEntityNotFound(_0x3fe497,null))[_0xfaa7('0x26')](saveUpdates(_0x5b0478[_0xfaa7('0x46')],null))['then'](respondWithResult(_0x3fe497,null))[_0xfaa7('0x41')](handleError(_0x3fe497,null));};exports[_0xfaa7('0x27')]=function(_0x24ed51,_0x4d7c19){return db[_0xfaa7('0x29')][_0xfaa7('0x44')]({'where':{'id':_0x24ed51[_0xfaa7('0x43')]['id']}})[_0xfaa7('0x26')](handleEntityNotFound(_0x4d7c19,null))['then'](removeEntity(_0x4d7c19,null))['catch'](handleError(_0x4d7c19,null));};exports['create']=function(_0x4a1f31,_0x134050){var _0x28cc2f;return db[_0xfaa7('0x47')][_0xfaa7('0x48')](function(_0x2982c3){return db[_0xfaa7('0x29')][_0xfaa7('0x49')](_0x4a1f31[_0xfaa7('0x46')],{'transaction':_0x2982c3})[_0xfaa7('0x26')](function(_0x2379be){_0x28cc2f=_0x2379be;var _0x44b8b7={'type':db[_0xfaa7('0x4a')]['TEXT'],'transaction':_0x2982c3};switch(_0x4a1f31[_0xfaa7('0x46')][_0xfaa7('0x4b')]){case'text':_0x44b8b7[_0xfaa7('0x4b')]=db['Sequelize'][_0xfaa7('0x4c')];break;case _0xfaa7('0x4d'):_0x44b8b7['type']=db['Sequelize']['INTEGER'];break;case _0xfaa7('0x4e'):_0x44b8b7[_0xfaa7('0x4b')]=db['Sequelize'][_0xfaa7('0x4f')];_0x44b8b7[_0xfaa7('0x50')]=![];break;default:}return db[_0xfaa7('0x47')][_0xfaa7('0x51')][_0xfaa7('0x52')]('cm_contacts',util['format'](_0xfaa7('0x53'),_0x28cc2f['id']),_0x44b8b7);})[_0xfaa7('0x26')](function(){return _0x28cc2f;});})[_0xfaa7('0x26')](respondWithResult(_0x134050,0xc9))[_0xfaa7('0x41')](handleError(_0x134050,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index a8053c8..20527eb 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 _0xffd1=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','util'];(function(_0x3daa3f,_0x1b8535){var _0xd021d5=function(_0x2e355a){while(--_0x2e355a){_0x3daa3f['push'](_0x3daa3f['shift']());}};_0xd021d5(++_0x1b8535);}(_0xffd1,0x8a));var _0x1ffd=function(_0x4afc6d,_0x588290){_0x4afc6d=_0x4afc6d-0x0;var _0x5a3754=_0xffd1[_0x4afc6d];return _0x5a3754;};'use strict';var _=require(_0x1ffd('0x0'));var util=require(_0x1ffd('0x1'));var logger=require(_0x1ffd('0x2'))(_0x1ffd('0x3'));var moment=require(_0x1ffd('0x4'));var BPromise=require(_0x1ffd('0x5'));var rp=require(_0x1ffd('0x6'));var fs=require('fs');var path=require(_0x1ffd('0x7'));var rimraf=require(_0x1ffd('0x8'));var config=require(_0x1ffd('0x9'));var attributes=require(_0x1ffd('0xa'));module[_0x1ffd('0xb')]=function(_0x25f035,_0x3549a3){return _0x25f035['define'](_0x1ffd('0xc'),attributes,{'tableName':_0x1ffd('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf88c=['./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x3b6ce6,_0x2fc572){var _0xea4a54=function(_0x3e31e0){while(--_0x3e31e0){_0x3b6ce6['push'](_0x3b6ce6['shift']());}};_0xea4a54(++_0x2fc572);}(_0xf88c,0x160));var _0xcf88=function(_0x219929,_0x2e0d7e){_0x219929=_0x219929-0x0;var _0x3f66e8=_0xf88c[_0x219929];return _0x3f66e8;};'use strict';var _=require(_0xcf88('0x0'));var util=require(_0xcf88('0x1'));var logger=require(_0xcf88('0x2'))(_0xcf88('0x3'));var moment=require(_0xcf88('0x4'));var BPromise=require(_0xcf88('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf88('0x6'));var rimraf=require('rimraf');var config=require(_0xcf88('0x7'));var attributes=require(_0xcf88('0x8'));module[_0xcf88('0x9')]=function(_0x1cc574,_0x195ea9){return _0x1cc574['define'](_0xcf88('0xa'),attributes,{'tableName':_0xcf88('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index ffe5834..7e39388 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 _0xe70f=['bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2e1906,_0xa281e9){var _0x3ea10e=function(_0x19749){while(--_0x19749){_0x2e1906['push'](_0x2e1906['shift']());}};_0x3ea10e(++_0xa281e9);}(_0xe70f,0xcc));var _0xfe70=function(_0x4b812c,_0xce73f4){_0x4b812c=_0x4b812c-0x0;var _0x31579e=_0xe70f[_0x4b812c];return _0x31579e;};'use strict';var _=require(_0xfe70('0x0'));var util=require(_0xfe70('0x1'));var moment=require(_0xfe70('0x2'));var BPromise=require(_0xfe70('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfe70('0x4'));var logger=require(_0xfe70('0x5'))('rpc');var config=require(_0xfe70('0x6'));var jayson=require(_0xfe70('0x7'));var client=jayson[_0xfe70('0x8')][_0xfe70('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd1552b,_0x4a0224,_0x140358){return new BPromise(function(_0x4284c0,_0x1e4ac2){return client[_0xfe70('0xa')](_0xd1552b,_0x140358)[_0xfe70('0xb')](function(_0x15a3ae){logger[_0xfe70('0xc')](_0xfe70('0xd'),_0x4a0224,_0xfe70('0xe'));logger[_0xfe70('0xf')](_0xfe70('0x10'),_0x4a0224,_0xfe70('0xe'),JSON[_0xfe70('0x11')](_0x15a3ae));if(_0x15a3ae[_0xfe70('0x12')]){if(_0x15a3ae[_0xfe70('0x12')][_0xfe70('0x13')]===0x1f4){logger[_0xfe70('0x12')](_0xfe70('0xd'),_0x4a0224,_0x15a3ae[_0xfe70('0x12')]['message']);return _0x1e4ac2(_0x15a3ae['error']['message']);}logger[_0xfe70('0x12')](_0xfe70('0xd'),_0x4a0224,_0x15a3ae['error'][_0xfe70('0x14')]);return _0x4284c0(_0x15a3ae[_0xfe70('0x12')][_0xfe70('0x14')]);}else{logger[_0xfe70('0xc')](_0xfe70('0xd'),_0x4a0224,_0xfe70('0xe'));_0x4284c0(_0x15a3ae[_0xfe70('0x15')]['message']);}})[_0xfe70('0x16')](function(_0x16bfe4){logger[_0xfe70('0x12')]('CmCustomField,\x20%s,\x20%s',_0x4a0224,_0x16bfe4);_0x1e4ac2(_0x16bfe4);});});} \ No newline at end of file +var _0xfc94=['request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','CmCustomField,\x20%s,\x20%s'];(function(_0x1d102d,_0x15de99){var _0x5657f8=function(_0x3c2a16){while(--_0x3c2a16){_0x1d102d['push'](_0x1d102d['shift']());}};_0x5657f8(++_0x15de99);}(_0xfc94,0x130));var _0x4fc9=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xfc94[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x4fc9('0x0'));var util=require(_0x4fc9('0x1'));var moment=require(_0x4fc9('0x2'));var BPromise=require('bluebird');var rs=require(_0x4fc9('0x3'));var fs=require('fs');var Redis=require(_0x4fc9('0x4'));var db=require(_0x4fc9('0x5'))['db'];var utils=require(_0x4fc9('0x6'));var logger=require(_0x4fc9('0x7'))(_0x4fc9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4fc9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35d1dc,_0x13e842,_0x28bf8b){return new BPromise(function(_0x20b95a,_0x1336d4){return client['request'](_0x35d1dc,_0x28bf8b)['then'](function(_0x15adf5){logger['info'](_0x4fc9('0xa'),_0x13e842,_0x4fc9('0xb'));logger[_0x4fc9('0xc')](_0x4fc9('0xd'),_0x13e842,_0x4fc9('0xb'),JSON[_0x4fc9('0xe')](_0x15adf5));if(_0x15adf5[_0x4fc9('0xf')]){if(_0x15adf5['error'][_0x4fc9('0x10')]===0x1f4){logger[_0x4fc9('0xf')](_0x4fc9('0xa'),_0x13e842,_0x15adf5[_0x4fc9('0xf')][_0x4fc9('0x11')]);return _0x1336d4(_0x15adf5[_0x4fc9('0xf')]['message']);}logger[_0x4fc9('0xf')](_0x4fc9('0xa'),_0x13e842,_0x15adf5[_0x4fc9('0xf')][_0x4fc9('0x11')]);return _0x20b95a(_0x15adf5[_0x4fc9('0xf')][_0x4fc9('0x11')]);}else{logger[_0x4fc9('0x12')](_0x4fc9('0xa'),_0x13e842,_0x4fc9('0xb'));_0x20b95a(_0x15adf5[_0x4fc9('0x13')][_0x4fc9('0x11')]);}})[_0x4fc9('0x14')](function(_0x4a49d1){logger[_0x4fc9('0xf')](_0x4fc9('0xa'),_0x13e842,_0x4a49d1);_0x1336d4(_0x4a49d1);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 67fc644..c1e2676 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 _0xe6c5=['delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id','show','post','isAuthenticated','create','put','update'];(function(_0x2d51ab,_0x214ea1){var _0x2ae0a3=function(_0x3ad96b){while(--_0x3ad96b){_0x2d51ab['push'](_0x2d51ab['shift']());}};_0x2ae0a3(++_0x214ea1);}(_0xe6c5,0x67));var _0x5e6c=function(_0x2a55b6,_0x16b504){_0x2a55b6=_0x2a55b6-0x0;var _0x2c24ac=_0xe6c5[_0x2a55b6];return _0x2c24ac;};'use strict';var multer=require(_0x5e6c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5e6c('0x1'));var express=require(_0x5e6c('0x2'));var router=express[_0x5e6c('0x3')]();var fs_extra=require(_0x5e6c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5e6c('0x5'));var config=require(_0x5e6c('0x6'));var controller=require(_0x5e6c('0x7'));router[_0x5e6c('0x8')]('/',auth['isAuthenticated'](),controller[_0x5e6c('0x9')]);router[_0x5e6c('0x8')](_0x5e6c('0xa'),auth['isAuthenticated'](),controller[_0x5e6c('0xb')]);router[_0x5e6c('0xc')]('/',auth[_0x5e6c('0xd')](),controller[_0x5e6c('0xe')]);router[_0x5e6c('0xf')]('/:id',auth[_0x5e6c('0xd')](),controller[_0x5e6c('0x10')]);router[_0x5e6c('0x11')](_0x5e6c('0xa'),auth[_0x5e6c('0xd')](),controller[_0x5e6c('0x12')]);module[_0x5e6c('0x13')]=router; \ No newline at end of file +var _0x847f=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','update','destroy','multer','util','path','express','Router'];(function(_0x1a725d,_0x13c4fb){var _0x34a939=function(_0x2dfe7e){while(--_0x2dfe7e){_0x1a725d['push'](_0x1a725d['shift']());}};_0x34a939(++_0x13c4fb);}(_0x847f,0x182));var _0xf847=function(_0x2238ba,_0xfeb953){_0x2238ba=_0x2238ba-0x0;var _0x33032f=_0x847f[_0x2238ba];return _0x33032f;};'use strict';var multer=require(_0xf847('0x0'));var util=require(_0xf847('0x1'));var path=require(_0xf847('0x2'));var timeout=require('connect-timeout');var express=require(_0xf847('0x3'));var router=express[_0xf847('0x4')]();var fs_extra=require(_0xf847('0x5'));var auth=require(_0xf847('0x6'));var interaction=require(_0xf847('0x7'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0xf847('0x8')]('/',auth[_0xf847('0x9')](),controller['index']);router['get'](_0xf847('0xa'),auth[_0xf847('0x9')](),controller[_0xf847('0xb')]);router[_0xf847('0xc')]('/',auth['isAuthenticated'](),controller[_0xf847('0xd')]);router[_0xf847('0xe')](_0xf847('0xa'),auth['isAuthenticated'](),controller[_0xf847('0xf')]);router['delete'](_0xf847('0xa'),auth[_0xf847('0x9')](),controller[_0xf847('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 3675281..1d2d095 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 _0x1a85=['exports','STRING','BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue'];(function(_0x30ae74,_0x5228f7){var _0x253e28=function(_0x4ab7d6){while(--_0x4ab7d6){_0x30ae74['push'](_0x30ae74['shift']());}};_0x253e28(++_0x5228f7);}(_0x1a85,0x178));var _0x51a8=function(_0x4f025f,_0x274149){_0x4f025f=_0x4f025f-0x0;var _0x143048=_0x1a85[_0x4f025f];return _0x143048;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x51a8('0x0')]={'phone':{'type':Sequelize[_0x51a8('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x51a8('0x3'))},'countbusyretry':{'type':Sequelize[_0x51a8('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x51a8('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x51a8('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x51a8('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x51a8('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x51a8('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x51a8('0x4')],'unique':_0x51a8('0x7')},'CampaignId':{'type':Sequelize[_0x51a8('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x51a8('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x51a8('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x51a8('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x51a8('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x51a8('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x51a8('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x51a8('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x14a0=['UNSIGNED','contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x158b52,_0x888420){var _0x42eba4=function(_0x4137d0){while(--_0x4137d0){_0x158b52['push'](_0x158b52['shift']());}};_0x42eba4(++_0x888420);}(_0x14a0,0x8e));var _0x014a=function(_0x30dae4,_0x571c28){_0x30dae4=_0x30dae4-0x0;var _0x587053=_0x14a0[_0x30dae4];return _0x587053;};'use strict';var moment=require('moment');var Sequelize=require(_0x014a('0x0'));module[_0x014a('0x1')]={'phone':{'type':Sequelize[_0x014a('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x014a('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x014a('0x4')],'defaultValue':moment()[_0x014a('0x5')](_0x014a('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x014a('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x014a('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x014a('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x014a('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x014a('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x014a('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x014a('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x014a('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x014a('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x014a('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x014a('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x014a('0x4')],'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 12f4708..6604869 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 _0x5fee=['$notILike','$contains','attributes','fields','length','where','pick','merge','VIRTUAL','filter','options','CmHopper','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','describe','destroy','VoiceQueueId','VoiceQueue','CampaignId','dataValues','createdAt','updatedAt','state','statedesc','campaign','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','end','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','dialActive','transaction','scheduledat','recallme','Company','getOpenContacts','outbound','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','update','then','sendStatus','name','send','map','fieldName','key','model','keys','query','filters','intersection','concat','$or','$gt','$lt','$lte','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike'];(function(_0x4bd119,_0x31285e){var _0x4faaac=function(_0x2bbd5c){while(--_0x2bbd5c){_0x4bd119['push'](_0x4bd119['shift']());}};_0x4faaac(++_0x31285e);}(_0x5fee,0x1e5));var _0xe5fe=function(_0x4b2d44,_0x3cb79f){_0x4b2d44=_0x4b2d44-0x0;var _0x359d92=_0x5fee[_0x4b2d44];return _0x359d92;};'use strict';var moment=require(_0xe5fe('0x0'));var _=require(_0xe5fe('0x1'));var qs=require(_0xe5fe('0x2'));var logger=require(_0xe5fe('0x3'))('api');var shared=require(_0xe5fe('0x4'));var db=require(_0xe5fe('0x5'))['db'];function respondWithResult(_0x200c23,_0x4c6b10){_0x4c6b10=_0x4c6b10||0xc8;return function(_0x42e9d4){if(_0x42e9d4){return _0x200c23[_0xe5fe('0x6')](_0x4c6b10)[_0xe5fe('0x7')](_0x42e9d4);}};}function respondWithFilteredResult(_0x43f04b,_0x46847e){return function(_0x4c1ce9){if(_0x4c1ce9){var _0x38c1c7=typeof _0x46847e[_0xe5fe('0x8')]==='undefined'&&typeof _0x46847e[_0xe5fe('0x9')]===_0xe5fe('0xa');var _0xb92b38=_0x4c1ce9[_0xe5fe('0xb')];var _0x5e2764=_0x38c1c7?0x0:_0x46847e[_0xe5fe('0x8')];var _0x28144=_0x38c1c7?_0x4c1ce9['count']:_0x46847e['offset']+_0x46847e[_0xe5fe('0x9')];var _0x5eae04;if(_0x28144>=_0xb92b38){_0x28144=_0xb92b38;_0x5eae04=0xc8;}else{_0x5eae04=0xce;}_0x43f04b['status'](_0x5eae04);return _0x43f04b['set'](_0xe5fe('0xc'),_0x5e2764+'-'+_0x28144+'/'+_0xb92b38)[_0xe5fe('0x7')](_0x4c1ce9);}return null;};}function saveUpdates(_0x2fdd35,_0x546b07){return function(_0x3c2500){if(_0x3c2500){return _0x3c2500[_0xe5fe('0xd')](_0x2fdd35)[_0xe5fe('0xe')](function(_0xf2fe0e){return _0xf2fe0e;});}return null;};}function handleEntityNotFound(_0x400e17,_0x4a9033){return function(_0x359984){if(!_0x359984){_0x400e17[_0xe5fe('0xf')](0x194);}return _0x359984;};}function handleError(_0x5f4742,_0x2e9188){_0x2e9188=_0x2e9188||0x1f4;return function(_0x211c8e){logger['error'](_0x211c8e['stack']);if(_0x211c8e[_0xe5fe('0x10')]){delete _0x211c8e['name'];}_0x5f4742[_0xe5fe('0x6')](_0x2e9188)[_0xe5fe('0x11')](_0x211c8e);};}exports['index']=function(_0x312681,_0x4b951f){var _0x2c1025={},_0x15d93c={},_0x427d0f={'count':0x0,'rows':[]};var _0x1cb59d=_[_0xe5fe('0x12')](db['CmHopper']['rawAttributes'],function(_0x52c62f){return{'name':_0x52c62f[_0xe5fe('0x13')],'type':_0x52c62f['type'][_0xe5fe('0x14')]};});_0x15d93c[_0xe5fe('0x15')]=_[_0xe5fe('0x12')](_0x1cb59d,_0xe5fe('0x10'));_0x15d93c['query']=_[_0xe5fe('0x16')](_0x312681[_0xe5fe('0x17')]);_0x15d93c[_0xe5fe('0x18')]=_[_0xe5fe('0x19')](_0x15d93c[_0xe5fe('0x15')],_0x15d93c[_0xe5fe('0x17')]);_0x15d93c[_0xe5fe('0x18')]=_[_0xe5fe('0x1a')](_0x15d93c[_0xe5fe('0x18')],['$and',_0xe5fe('0x1b'),_0xe5fe('0x1c'),'$gte',_0xe5fe('0x1d'),_0xe5fe('0x1e'),'$ne',_0xe5fe('0x1f'),_0xe5fe('0x20'),_0xe5fe('0x21'),'$notBetween',_0xe5fe('0x22'),_0xe5fe('0x23'),_0xe5fe('0x24'),_0xe5fe('0x25'),_0xe5fe('0x26'),_0xe5fe('0x27'),_0xe5fe('0x24'),'$overlap',_0xe5fe('0x28'),'$contained','$any']);_0x2c1025[_0xe5fe('0x29')]=_[_0xe5fe('0x19')](_0x15d93c[_0xe5fe('0x15')],qs[_0xe5fe('0x2a')](_0x312681[_0xe5fe('0x17')]['fields']));_0x2c1025['attributes']=_0x2c1025[_0xe5fe('0x29')][_0xe5fe('0x2b')]?_0x2c1025[_0xe5fe('0x29')]:_0x15d93c['model'];if(!_0x312681['query']['hasOwnProperty']('nolimit')){_0x2c1025[_0xe5fe('0x9')]=qs[_0xe5fe('0x9')](_0x312681[_0xe5fe('0x17')]['limit']);_0x2c1025[_0xe5fe('0x8')]=qs[_0xe5fe('0x8')](_0x312681['query'][_0xe5fe('0x8')]);}_0x2c1025['order']=qs['sort'](_0x312681[_0xe5fe('0x17')]['sort']);_0x2c1025[_0xe5fe('0x2c')]=qs[_0xe5fe('0x18')](_[_0xe5fe('0x2d')](_0x312681[_0xe5fe('0x17')],_0x15d93c[_0xe5fe('0x18')]),_0x1cb59d);if(_0x312681[_0xe5fe('0x17')]['filter']){_0x2c1025[_0xe5fe('0x2c')]=_[_0xe5fe('0x2e')](_0x2c1025[_0xe5fe('0x2c')],{'$or':_[_0xe5fe('0x12')](_0x1cb59d,function(_0x347874){if(_0x347874['type']!==_0xe5fe('0x2f')){var _0x189016={};_0x189016[_0x347874[_0xe5fe('0x10')]]={'$like':'%'+_0x312681[_0xe5fe('0x17')][_0xe5fe('0x30')]+'%'};return _0x189016;}})});}_0x2c1025=_[_0xe5fe('0x2e')]({},_0x2c1025,_0x312681[_0xe5fe('0x31')]);var _0x1de604={'where':_0x2c1025[_0xe5fe('0x2c')]};return db[_0xe5fe('0x32')][_0xe5fe('0xb')](_0x1de604)[_0xe5fe('0xe')](function(_0x5e9ae4){_0x427d0f['count']=_0x5e9ae4;if(_0x312681[_0xe5fe('0x17')][_0xe5fe('0x33')]){_0x2c1025['include']=[{'all':!![]}];}return db['CmHopper'][_0xe5fe('0x34')](_0x2c1025);})[_0xe5fe('0xe')](function(_0x299031){_0x427d0f[_0xe5fe('0x35')]=_0x299031;return _0x427d0f;})[_0xe5fe('0xe')](respondWithFilteredResult(_0x4b951f,_0x2c1025))[_0xe5fe('0x36')](handleError(_0x4b951f,null));};exports['show']=function(_0x255fb9,_0x2a01a6){var _0x4a7f5d={'raw':!![],'where':{'id':_0x255fb9[_0xe5fe('0x37')]['id']}},_0x5e2eff={};_0x5e2eff[_0xe5fe('0x15')]=_['keys'](db[_0xe5fe('0x32')][_0xe5fe('0x38')]);_0x5e2eff['query']=_[_0xe5fe('0x16')](_0x255fb9['query']);_0x5e2eff['filters']=_['intersection'](_0x5e2eff[_0xe5fe('0x15')],_0x5e2eff[_0xe5fe('0x17')]);_0x4a7f5d['attributes']=_['intersection'](_0x5e2eff['model'],qs['fields'](_0x255fb9[_0xe5fe('0x17')]['fields']));_0x4a7f5d[_0xe5fe('0x29')]=_0x4a7f5d[_0xe5fe('0x29')][_0xe5fe('0x2b')]?_0x4a7f5d[_0xe5fe('0x29')]:_0x5e2eff[_0xe5fe('0x15')];if(_0x255fb9[_0xe5fe('0x17')][_0xe5fe('0x33')]){_0x4a7f5d[_0xe5fe('0x39')]=[{'all':!![]}];}_0x4a7f5d=_[_0xe5fe('0x2e')]({},_0x4a7f5d,_0x255fb9[_0xe5fe('0x31')]);return db['CmHopper'][_0xe5fe('0x3a')](_0x4a7f5d)['then'](handleEntityNotFound(_0x2a01a6,null))[_0xe5fe('0xe')](respondWithResult(_0x2a01a6,null))['catch'](handleError(_0x2a01a6,null));};exports[_0xe5fe('0x3b')]=function(_0x1eeb80,_0x122599){return db[_0xe5fe('0x32')][_0xe5fe('0x3b')](_0x1eeb80['body'],{})[_0xe5fe('0xe')](respondWithResult(_0x122599,0xc9))[_0xe5fe('0x36')](handleError(_0x122599,null));};exports['update']=function(_0x346d1b,_0x754eaf){if(_0x346d1b[_0xe5fe('0x3c')]['id']){delete _0x346d1b[_0xe5fe('0x3c')]['id'];}return db['CmHopper'][_0xe5fe('0x3a')]({'where':{'id':_0x346d1b[_0xe5fe('0x37')]['id']}})[_0xe5fe('0xe')](handleEntityNotFound(_0x754eaf,null))[_0xe5fe('0xe')](saveUpdates(_0x346d1b['body'],null))['then'](respondWithResult(_0x754eaf,null))[_0xe5fe('0x36')](handleError(_0x754eaf,null));};exports['describe']=function(_0xecfe69,_0x27eeb2){return db[_0xe5fe('0x32')][_0xe5fe('0x3d')]()[_0xe5fe('0xe')](respondWithResult(_0x27eeb2,null))['catch'](handleError(_0x27eeb2,null));};exports[_0xe5fe('0x3e')]=function(_0x39505d,_0x56cade){var _0x5ea50b;return db[_0xe5fe('0x32')][_0xe5fe('0x3a')]({'where':{'id':_0x39505d[_0xe5fe('0x37')]['id']}})['then'](handleEntityNotFound(_0x56cade,null))[_0xe5fe('0xe')](function(_0x4df21b){if(_0x4df21b){return _0x4df21b[_0xe5fe('0x3e')]()[_0xe5fe('0xe')](function(_0x3b7d5d){return _0x3b7d5d;});}})[_0xe5fe('0xe')](function(_0x5317c0){_0x5ea50b=_0x5317c0;if(_0x5317c0){if(_0x5317c0['VoiceQueueId']||_0x5317c0['CampaignId']){return db[_0x5317c0[_0xe5fe('0x3f')]?_0xe5fe('0x40'):'Campaign']['find']({'where':{'id':_0x5317c0[_0xe5fe('0x3f')]?_0x5317c0[_0xe5fe('0x3f')]:_0x5317c0[_0xe5fe('0x41')]},'attributes':['id',_0xe5fe('0x10')],'raw':!![]});}}})[_0xe5fe('0xe')](function(_0x1de939){var _0x4baf20={};if(_0x1de939){_[_0xe5fe('0x2e')](_0x4baf20,_['omit'](_0x5ea50b[_0xe5fe('0x42')],[_0xe5fe('0x43'),_0xe5fe('0x44'),'id']));_0x4baf20[_0xe5fe('0x45')]=0x15;_0x4baf20[_0xe5fe('0x46')]='deleted';_0x4baf20[_0xe5fe('0x47')]=_0x1de939[_0xe5fe('0x10')];_0x4baf20['membername']=_0x39505d[_0xe5fe('0x48')]['name'];_0x4baf20[_0xe5fe('0x49')]=_0x39505d['user']['id'];_0x4baf20[_0xe5fe('0x4a')]=!![];_0x4baf20[_0xe5fe('0x4b')]=moment()[_0xe5fe('0x4c')](_0xe5fe('0x4d'));_0x4baf20[_0xe5fe('0x4e')]=_0x5ea50b[_0xe5fe('0x4f')];_0x4baf20[_0xe5fe('0x50')]=_0x5ea50b['VoiceQueueId']?_0xe5fe('0x51'):_0xe5fe('0x52');return db[_0xe5fe('0x53')][_0xe5fe('0x3a')]({'where':{'id':_0x4baf20[_0xe5fe('0x54')]},'attributes':[_0xe5fe('0x55'),_0xe5fe('0x56')]})['then'](function(_0x274cad){if(!_[_0xe5fe('0x57')](_0x56cade)&&!_['isNil'](_0x274cad['firstName'])){_0x4baf20[_0xe5fe('0x58')]=_0x274cad[_0xe5fe('0x55')];if(!_[_0xe5fe('0x57')](_0x274cad[_0xe5fe('0x56')])){_0x4baf20['calleridname']+='\x20'+_0x274cad['lastName'];}}})[_0xe5fe('0x59')](function(){return db[_0xe5fe('0x5a')][_0xe5fe('0x3b')](_0x4baf20);});}})[_0xe5fe('0xe')](function(){return _0x56cade['status'](0xcc)[_0xe5fe('0x5b')]();})[_0xe5fe('0x36')](handleError(_0x56cade,null));};exports['getPreview']=function(_0x2815ba,_0x25c0b2){var _0x28960e=[];return db[_0xe5fe('0x53')][_0xe5fe('0x3d')]()[_0xe5fe('0xe')](function(_0x59a69b){_0x28960e=_['keys'](_0x59a69b);return _0x2815ba[_0xe5fe('0x48')][_0xe5fe('0x5c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xe5fe('0x5d')},'attributes':['id',_0xe5fe('0x5e'),_0xe5fe('0x5f')],'raw':!![]});})[_0xe5fe('0xe')](function(_0x3c2be9){if(_0x3c2be9&&_0x3c2be9['length']){return db[_0xe5fe('0x60')]['transaction'](function(_0x1ddde4){var _0xaa4124={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe5fe('0x4c')](_0xe5fe('0x4d'))},'VoiceQueueId':{'$in':_['map'](_0x3c2be9,'id')},'$or':[{'UserId':null},{'UserId':_0x2815ba[_0xe5fe('0x48')]['id']}]};var _0x3c8368={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3c2be9)[_0xe5fe('0x30')]([_0xe5fe('0x5f'),0x0])[_0xe5fe('0x12')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x2815ba[_0xe5fe('0x48')]['id']}]};var _0x759fb2={'$or':[_0xaa4124,_0x3c8368]};var _0x272241=[];if(_0x2815ba[_0xe5fe('0x3c')][_0xe5fe('0x61')]&&_0x2815ba['body']['direction']===_0xe5fe('0x62')){if(!_[_0xe5fe('0x63')](_0x2815ba[_0xe5fe('0x3c')][_0xe5fe('0x64')])){_0x759fb2['id']={'$in':_0x2815ba[_0xe5fe('0x3c')][_0xe5fe('0x64')]};}_0x272241=[[_0xe5fe('0x65'),_0xe5fe('0x66')],[_0xe5fe('0x67'),_0x3c2be9[0x0][_0xe5fe('0x5e')]===_0xe5fe('0x66')?_0xe5fe('0x68'):'ASC'],db[_0xe5fe('0x60')][_0xe5fe('0x69')](_0xe5fe('0x6a')),['id','DESC']];}else{if(!_['isEmpty'](_0x2815ba['body']['hopperIds'])){_0x759fb2['id']={'$notIn':_0x2815ba[_0xe5fe('0x3c')][_0xe5fe('0x64')]};}_0x272241=[[_0xe5fe('0x65'),_0xe5fe('0x68')],[_0xe5fe('0x67'),_0x3c2be9[0x0][_0xe5fe('0x5e')]],db[_0xe5fe('0x60')][_0xe5fe('0x69')](_0xe5fe('0x6b')),['id',_0xe5fe('0x66')]];}return db[_0xe5fe('0x32')][_0xe5fe('0x6c')]({'attributes':['id','scheduledat','recallme'],'where':_0x759fb2,'order':_0x272241,'transaction':_0x1ddde4,'lock':_0x1ddde4[_0xe5fe('0x6d')][_0xe5fe('0x6e')],'include':[{'model':db[_0xe5fe('0x53')],'as':_0xe5fe('0x6f'),'attributes':_0x28960e,'include':[{'model':db[_0xe5fe('0x70')],'as':'Company','attributes':['id','name']}]},{'model':db[_0xe5fe('0x71')],'as':_0xe5fe('0x72'),'attributes':['id','name']},{'model':db[_0xe5fe('0x40')],'as':_0xe5fe('0x73'),'attributes':['id','name',_0xe5fe('0x74')]}]})[_0xe5fe('0xe')](function(_0x5aaf8c){if(_0x5aaf8c){return _0x5aaf8c['update']({'UserId':_0x2815ba[_0xe5fe('0x48')]['id']},{'transaction':_0x1ddde4});}});});}})[_0xe5fe('0xe')](handleEntityNotFound(_0x25c0b2,null))[_0xe5fe('0xe')](respondWithResult(_0x25c0b2,null))[_0xe5fe('0x36')](handleError(_0x25c0b2,null));};exports['getPreviewRecall']=function(_0xd426f7,_0x2713e9,_0x4723a0){var _0x875a27=[];var _0x10a2b9=_0xd426f7[_0xe5fe('0x37')]['id'];var _0x406dc9=_0xd426f7['user']['id'];return db['CmContact'][_0xe5fe('0x3d')]()[_0xe5fe('0xe')](function(_0x21cc19){_0x875a27=_['keys'](_0x21cc19);return db[_0xe5fe('0x60')][_0xe5fe('0x75')](function(_0x231adc){const _0x383511={'id':_0x10a2b9};return db['CmHopper'][_0xe5fe('0x6c')]({'attributes':['id',_0xe5fe('0x76'),_0xe5fe('0x77')],'where':_0x383511,'transaction':_0x231adc,'lock':_0x231adc[_0xe5fe('0x6d')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xe5fe('0x6f'),'attributes':_0x875a27,'include':[{'model':db['CmCompany'],'as':_0xe5fe('0x78'),'attributes':['id',_0xe5fe('0x10')]}]},{'model':db[_0xe5fe('0x71')],'as':_0xe5fe('0x72'),'attributes':['id',_0xe5fe('0x10')]},{'model':db[_0xe5fe('0x40')],'as':'Queue','attributes':['id','name',_0xe5fe('0x74')]}]})[_0xe5fe('0xe')](function(_0x5ab397){if(_0x5ab397){return _0x5ab397[_0xe5fe('0xd')]({'UserId':_0x406dc9},{'transaction':_0x231adc});}});});})['then'](handleEntityNotFound(_0x2713e9,null))[_0xe5fe('0xe')](respondWithResult(_0x2713e9,null))[_0xe5fe('0x36')](handleError(_0x2713e9,null));};exports[_0xe5fe('0x79')]=function(_0x1372da,_0x53cb87){return _0x1372da[_0xe5fe('0x48')][_0xe5fe('0x5c')]({'where':{'type':_0xe5fe('0x7a'),'dialActive':!![],'dialMethod':_0xe5fe('0x5d')},'attributes':['id'],'raw':!![]})[_0xe5fe('0xe')](function(_0x103e44){if(_0x103e44&&_0x103e44[_0xe5fe('0x2b')]){return db['CmHopper'][_0xe5fe('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe5fe('0x4c')](_0xe5fe('0x4d'))},'VoiceQueueId':{'$in':_[_0xe5fe('0x12')](_0x103e44,'id')},'$or':[{'UserId':null},{'UserId':_0x1372da[_0xe5fe('0x48')]['id']}]}});}return 0x0;})['then'](function(_0x1ffe15){if(!_[_0xe5fe('0x57')](_0x1ffe15)&&_['isNumber'](_0x1ffe15)){return _0x53cb87[_0xe5fe('0x6')](0xc8)[_0xe5fe('0x7')]({'contacts':_0x1ffe15});}else{logger[_0xe5fe('0x7b')](_0xe5fe('0x7c'),_0xe5fe('0x79'),0x194,_0xe5fe('0x7d'));_0x53cb87[_0xe5fe('0xf')](0x194);}})[_0xe5fe('0x36')](handleError(_0x53cb87,null));};exports[_0xe5fe('0x7e')]=function(_0x443d55,_0x1fce09){var _0x3e2165=shared[_0xe5fe('0x7f')];var _0x30b306=[];_[_0xe5fe('0x12')](_0x3e2165,function(_0xbf221f){_0x30b306[_0xe5fe('0x80')]({'id':_0xbf221f['name'],'name':_0xbf221f[_0xe5fe('0x10')],'utcOffset':_0xbf221f[_0xe5fe('0x81')]});});return _0x1fce09[_0xe5fe('0x6')](0xc8)[_0xe5fe('0x7')]({'tz':_0x30b306});};exports[_0xe5fe('0x82')]=function(_0x2f26b8,_0x180b68){var _0x56606e=shared['timezones'];var _0x404c96={};if(!_[_0xe5fe('0x57')](_0x56606e[_0x2f26b8[_0xe5fe('0x3c')]['id']]))_0x404c96=_0x56606e[_0x2f26b8[_0xe5fe('0x3c')]['id']];return _0x180b68['status'](0xc8)['json'](_0x404c96);}; \ No newline at end of file +var _0xf68e=['rows','catch','show','length','includeAll','find','create','body','describe','destroy','params','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','updatedAt','state','statedesc','campaign','membername','user','UserId','deletedat','calleridnum','phone','campaigntype','queue','ivr','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','YYYY-MM-DD\x20HH:mm:ss','value','direction','prev','hopperIds','scheduledAt','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','priority','findOne','recallme','LOCK','UPDATE','Contact','Company','CmList','List','Queue','dialActive','transaction','scheduledat','CmCompany','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','utcOffset','lodash','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','map','CmHopper','rawAttributes','fieldName','key','model','keys','query','filters','intersection','$and','$gte','$ne','$eq','$not','$notBetween','$notIn','$like','$notILike','$overlap','$contained','$any','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','type','VIRTUAL','options','where','include','findAll'];(function(_0x5d71fd,_0xbb13fd){var _0x3aa838=function(_0x560406){while(--_0x560406){_0x5d71fd['push'](_0x5d71fd['shift']());}};_0x3aa838(++_0xbb13fd);}(_0xf68e,0x14a));var _0xef68=function(_0xd1b9e2,_0x1f9371){_0xd1b9e2=_0xd1b9e2-0x0;var _0x1feb23=_0xf68e[_0xd1b9e2];return _0x1feb23;};'use strict';var moment=require('moment');var _=require(_0xef68('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xef68('0x1'))(_0xef68('0x2'));var shared=require(_0xef68('0x3'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x4edee8,_0x8b02c3){_0x8b02c3=_0x8b02c3||0xc8;return function(_0x2ccf08){if(_0x2ccf08){return _0x4edee8[_0xef68('0x4')](_0x8b02c3)[_0xef68('0x5')](_0x2ccf08);}};}function respondWithFilteredResult(_0x2d5a4d,_0x581a66){return function(_0x5e510c){if(_0x5e510c){var _0x1e017b=typeof _0x581a66[_0xef68('0x6')]===_0xef68('0x7')&&typeof _0x581a66[_0xef68('0x8')]===_0xef68('0x7');var _0x491c96=_0x5e510c[_0xef68('0x9')];var _0x1be61d=_0x1e017b?0x0:_0x581a66['offset'];var _0xefbd0c=_0x1e017b?_0x5e510c[_0xef68('0x9')]:_0x581a66[_0xef68('0x6')]+_0x581a66[_0xef68('0x8')];var _0x23c815;if(_0xefbd0c>=_0x491c96){_0xefbd0c=_0x491c96;_0x23c815=0xc8;}else{_0x23c815=0xce;}_0x2d5a4d[_0xef68('0x4')](_0x23c815);return _0x2d5a4d[_0xef68('0xa')](_0xef68('0xb'),_0x1be61d+'-'+_0xefbd0c+'/'+_0x491c96)[_0xef68('0x5')](_0x5e510c);}return null;};}function saveUpdates(_0x42d713,_0x29931e){return function(_0x219303){if(_0x219303){return _0x219303[_0xef68('0xc')](_0x42d713)[_0xef68('0xd')](function(_0x2721aa){return _0x2721aa;});}return null;};}function handleEntityNotFound(_0x4f1f0e,_0x3625a6){return function(_0x3a37ea){if(!_0x3a37ea){_0x4f1f0e[_0xef68('0xe')](0x194);}return _0x3a37ea;};}function handleError(_0x1cdeca,_0x1051c7){_0x1051c7=_0x1051c7||0x1f4;return function(_0x1b130d){logger[_0xef68('0xf')](_0x1b130d[_0xef68('0x10')]);if(_0x1b130d[_0xef68('0x11')]){delete _0x1b130d[_0xef68('0x11')];}_0x1cdeca[_0xef68('0x4')](_0x1051c7)['send'](_0x1b130d);};}exports['index']=function(_0x31d8c7,_0x22d8a4){var _0x1026a1={},_0x39959c={},_0x44c630={'count':0x0,'rows':[]};var _0x2d2f28=_[_0xef68('0x12')](db[_0xef68('0x13')][_0xef68('0x14')],function(_0x4a8bf1){return{'name':_0x4a8bf1[_0xef68('0x15')],'type':_0x4a8bf1['type'][_0xef68('0x16')]};});_0x39959c[_0xef68('0x17')]=_[_0xef68('0x12')](_0x2d2f28,_0xef68('0x11'));_0x39959c['query']=_[_0xef68('0x18')](_0x31d8c7[_0xef68('0x19')]);_0x39959c[_0xef68('0x1a')]=_[_0xef68('0x1b')](_0x39959c['model'],_0x39959c[_0xef68('0x19')]);_0x39959c[_0xef68('0x1a')]=_['concat'](_0x39959c[_0xef68('0x1a')],[_0xef68('0x1c'),'$or','$gt',_0xef68('0x1d'),'$lt','$lte',_0xef68('0x1e'),_0xef68('0x1f'),_0xef68('0x20'),'$between',_0xef68('0x21'),'$in',_0xef68('0x22'),_0xef68('0x23'),'$notLike','$iLike',_0xef68('0x24'),_0xef68('0x23'),_0xef68('0x25'),'$contains',_0xef68('0x26'),_0xef68('0x27')]);_0x1026a1[_0xef68('0x28')]=_['intersection'](_0x39959c[_0xef68('0x17')],qs[_0xef68('0x29')](_0x31d8c7[_0xef68('0x19')][_0xef68('0x29')]));_0x1026a1['attributes']=_0x1026a1[_0xef68('0x28')]['length']?_0x1026a1[_0xef68('0x28')]:_0x39959c['model'];if(!_0x31d8c7[_0xef68('0x19')][_0xef68('0x2a')](_0xef68('0x2b'))){_0x1026a1[_0xef68('0x8')]=qs[_0xef68('0x8')](_0x31d8c7['query'][_0xef68('0x8')]);_0x1026a1['offset']=qs[_0xef68('0x6')](_0x31d8c7[_0xef68('0x19')][_0xef68('0x6')]);}_0x1026a1['order']=qs[_0xef68('0x2c')](_0x31d8c7[_0xef68('0x19')][_0xef68('0x2c')]);_0x1026a1['where']=qs[_0xef68('0x1a')](_[_0xef68('0x2d')](_0x31d8c7[_0xef68('0x19')],_0x39959c[_0xef68('0x1a')]),_0x2d2f28);if(_0x31d8c7['query'][_0xef68('0x2e')]){_0x1026a1['where']=_[_0xef68('0x2f')](_0x1026a1['where'],{'$or':_['map'](_0x2d2f28,function(_0x5cb242){if(_0x5cb242[_0xef68('0x30')]!==_0xef68('0x31')){var _0x502f61={};_0x502f61[_0x5cb242['name']]={'$like':'%'+_0x31d8c7['query'][_0xef68('0x2e')]+'%'};return _0x502f61;}})});}_0x1026a1=_['merge']({},_0x1026a1,_0x31d8c7[_0xef68('0x32')]);var _0x50afc1={'where':_0x1026a1[_0xef68('0x33')]};return db[_0xef68('0x13')][_0xef68('0x9')](_0x50afc1)[_0xef68('0xd')](function(_0x1c9106){_0x44c630[_0xef68('0x9')]=_0x1c9106;if(_0x31d8c7[_0xef68('0x19')]['includeAll']){_0x1026a1[_0xef68('0x34')]=[{'all':!![]}];}return db[_0xef68('0x13')][_0xef68('0x35')](_0x1026a1);})['then'](function(_0x2e4524){_0x44c630[_0xef68('0x36')]=_0x2e4524;return _0x44c630;})['then'](respondWithFilteredResult(_0x22d8a4,_0x1026a1))[_0xef68('0x37')](handleError(_0x22d8a4,null));};exports[_0xef68('0x38')]=function(_0x7584e2,_0x36df3c){var _0x5b32d1={'raw':!![],'where':{'id':_0x7584e2['params']['id']}},_0x5384a8={};_0x5384a8['model']=_[_0xef68('0x18')](db[_0xef68('0x13')][_0xef68('0x14')]);_0x5384a8[_0xef68('0x19')]=_[_0xef68('0x18')](_0x7584e2[_0xef68('0x19')]);_0x5384a8[_0xef68('0x1a')]=_[_0xef68('0x1b')](_0x5384a8['model'],_0x5384a8['query']);_0x5b32d1[_0xef68('0x28')]=_[_0xef68('0x1b')](_0x5384a8[_0xef68('0x17')],qs[_0xef68('0x29')](_0x7584e2[_0xef68('0x19')][_0xef68('0x29')]));_0x5b32d1[_0xef68('0x28')]=_0x5b32d1[_0xef68('0x28')][_0xef68('0x39')]?_0x5b32d1[_0xef68('0x28')]:_0x5384a8['model'];if(_0x7584e2[_0xef68('0x19')][_0xef68('0x3a')]){_0x5b32d1[_0xef68('0x34')]=[{'all':!![]}];}_0x5b32d1=_['merge']({},_0x5b32d1,_0x7584e2[_0xef68('0x32')]);return db[_0xef68('0x13')][_0xef68('0x3b')](_0x5b32d1)[_0xef68('0xd')](handleEntityNotFound(_0x36df3c,null))[_0xef68('0xd')](respondWithResult(_0x36df3c,null))[_0xef68('0x37')](handleError(_0x36df3c,null));};exports[_0xef68('0x3c')]=function(_0x59e031,_0x5de5e1){return db['CmHopper'][_0xef68('0x3c')](_0x59e031['body'],{})[_0xef68('0xd')](respondWithResult(_0x5de5e1,0xc9))[_0xef68('0x37')](handleError(_0x5de5e1,null));};exports['update']=function(_0x391f13,_0x419ebf){if(_0x391f13[_0xef68('0x3d')]['id']){delete _0x391f13['body']['id'];}return db[_0xef68('0x13')]['find']({'where':{'id':_0x391f13['params']['id']}})['then'](handleEntityNotFound(_0x419ebf,null))[_0xef68('0xd')](saveUpdates(_0x391f13[_0xef68('0x3d')],null))[_0xef68('0xd')](respondWithResult(_0x419ebf,null))[_0xef68('0x37')](handleError(_0x419ebf,null));};exports[_0xef68('0x3e')]=function(_0x435c48,_0x5f334f){return db[_0xef68('0x13')][_0xef68('0x3e')]()['then'](respondWithResult(_0x5f334f,null))[_0xef68('0x37')](handleError(_0x5f334f,null));};exports[_0xef68('0x3f')]=function(_0xbb5fa2,_0x11f7aa){var _0x2fe9c2;return db[_0xef68('0x13')][_0xef68('0x3b')]({'where':{'id':_0xbb5fa2[_0xef68('0x40')]['id']}})[_0xef68('0xd')](handleEntityNotFound(_0x11f7aa,null))[_0xef68('0xd')](function(_0x4af43d){if(_0x4af43d){return _0x4af43d['destroy']()[_0xef68('0xd')](function(_0x349e5a){return _0x349e5a;});}})[_0xef68('0xd')](function(_0x44d15a){_0x2fe9c2=_0x44d15a;if(_0x44d15a){if(_0x44d15a[_0xef68('0x41')]||_0x44d15a[_0xef68('0x42')]){return db[_0x44d15a[_0xef68('0x41')]?_0xef68('0x43'):_0xef68('0x44')][_0xef68('0x3b')]({'where':{'id':_0x44d15a['VoiceQueueId']?_0x44d15a['VoiceQueueId']:_0x44d15a['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x46edcb){var _0x413380={};if(_0x46edcb){_[_0xef68('0x2f')](_0x413380,_[_0xef68('0x45')](_0x2fe9c2[_0xef68('0x46')],['createdAt',_0xef68('0x47'),'id']));_0x413380[_0xef68('0x48')]=0x15;_0x413380[_0xef68('0x49')]='deleted';_0x413380[_0xef68('0x4a')]=_0x46edcb[_0xef68('0x11')];_0x413380[_0xef68('0x4b')]=_0xbb5fa2[_0xef68('0x4c')][_0xef68('0x11')];_0x413380[_0xef68('0x4d')]=_0xbb5fa2[_0xef68('0x4c')]['id'];_0x413380['deleted']=!![];_0x413380[_0xef68('0x4e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x413380[_0xef68('0x4f')]=_0x2fe9c2[_0xef68('0x50')];_0x413380[_0xef68('0x51')]=_0x2fe9c2[_0xef68('0x41')]?_0xef68('0x52'):_0xef68('0x53');return db['CmContact']['find']({'where':{'id':_0x413380['ContactId']},'attributes':[_0xef68('0x54'),_0xef68('0x55')]})[_0xef68('0xd')](function(_0x3fc909){if(!_['isNil'](_0x11f7aa)&&!_[_0xef68('0x56')](_0x3fc909[_0xef68('0x54')])){_0x413380[_0xef68('0x57')]=_0x3fc909[_0xef68('0x54')];if(!_[_0xef68('0x56')](_0x3fc909[_0xef68('0x55')])){_0x413380['calleridname']+='\x20'+_0x3fc909[_0xef68('0x55')];}}})[_0xef68('0x58')](function(){return db[_0xef68('0x59')][_0xef68('0x3c')](_0x413380);});}})[_0xef68('0xd')](function(){return _0x11f7aa[_0xef68('0x4')](0xcc)['end']();})[_0xef68('0x37')](handleError(_0x11f7aa,null));};exports[_0xef68('0x5a')]=function(_0x36bd85,_0x32a72c){var _0x127bc8=[];return db[_0xef68('0x5b')][_0xef68('0x3e')]()['then'](function(_0x2c8389){_0x127bc8=_['keys'](_0x2c8389);return _0x36bd85[_0xef68('0x4c')][_0xef68('0x5c')]({'where':{'type':_0xef68('0x5d'),'dialActive':!![],'dialMethod':_0xef68('0x5e')},'attributes':['id',_0xef68('0x5f'),_0xef68('0x60')],'raw':!![]});})['then'](function(_0x540ac2){if(_0x540ac2&&_0x540ac2[_0xef68('0x39')]){return db[_0xef68('0x61')]['transaction'](function(_0x10f2c9){var _0x1f477e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xef68('0x62'))},'VoiceQueueId':{'$in':_[_0xef68('0x12')](_0x540ac2,'id')},'$or':[{'UserId':null},{'UserId':_0x36bd85[_0xef68('0x4c')]['id']}]};var _0x2f0af0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x540ac2)['filter']([_0xef68('0x60'),0x0])['map']('id')[_0xef68('0x63')]()},'$or':[{'UserId':null},{'UserId':_0x36bd85[_0xef68('0x4c')]['id']}]};var _0x4f553f={'$or':[_0x1f477e,_0x2f0af0]};var _0x3040a1=[];if(_0x36bd85[_0xef68('0x3d')][_0xef68('0x64')]&&_0x36bd85['body'][_0xef68('0x64')]===_0xef68('0x65')){if(!_['isEmpty'](_0x36bd85[_0xef68('0x3d')][_0xef68('0x66')])){_0x4f553f['id']={'$in':_0x36bd85['body'][_0xef68('0x66')]};}_0x3040a1=[['priority','ASC'],[_0xef68('0x67'),_0x540ac2[0x0]['dialOrderByScheduledAt']===_0xef68('0x68')?_0xef68('0x69'):_0xef68('0x68')],db[_0xef68('0x61')][_0xef68('0x6a')](_0xef68('0x6b')),['id',_0xef68('0x69')]];}else{if(!_[_0xef68('0x6c')](_0x36bd85[_0xef68('0x3d')]['hopperIds'])){_0x4f553f['id']={'$notIn':_0x36bd85[_0xef68('0x3d')][_0xef68('0x66')]};}_0x3040a1=[[_0xef68('0x6d'),'DESC'],[_0xef68('0x67'),_0x540ac2[0x0][_0xef68('0x5f')]],db[_0xef68('0x61')][_0xef68('0x6a')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xef68('0x68')]];}return db['CmHopper'][_0xef68('0x6e')]({'attributes':['id','scheduledat',_0xef68('0x6f')],'where':_0x4f553f,'order':_0x3040a1,'transaction':_0x10f2c9,'lock':_0x10f2c9[_0xef68('0x70')][_0xef68('0x71')],'include':[{'model':db[_0xef68('0x5b')],'as':_0xef68('0x72'),'attributes':_0x127bc8,'include':[{'model':db['CmCompany'],'as':_0xef68('0x73'),'attributes':['id',_0xef68('0x11')]}]},{'model':db[_0xef68('0x74')],'as':_0xef68('0x75'),'attributes':['id',_0xef68('0x11')]},{'model':db[_0xef68('0x43')],'as':_0xef68('0x76'),'attributes':['id','name',_0xef68('0x77')]}]})[_0xef68('0xd')](function(_0x3e994e){if(_0x3e994e){return _0x3e994e[_0xef68('0xc')]({'UserId':_0x36bd85[_0xef68('0x4c')]['id']},{'transaction':_0x10f2c9});}});});}})[_0xef68('0xd')](handleEntityNotFound(_0x32a72c,null))[_0xef68('0xd')](respondWithResult(_0x32a72c,null))[_0xef68('0x37')](handleError(_0x32a72c,null));};exports['getPreviewRecall']=function(_0x3996b7,_0x2139d2,_0x36e409){var _0x18f452=[];var _0x31fc52=_0x3996b7[_0xef68('0x40')]['id'];var _0x1b9512=_0x3996b7[_0xef68('0x4c')]['id'];return db[_0xef68('0x5b')]['describe']()[_0xef68('0xd')](function(_0x2c4bdf){_0x18f452=_[_0xef68('0x18')](_0x2c4bdf);return db[_0xef68('0x61')][_0xef68('0x78')](function(_0x4e3f59){const _0x44f16a={'id':_0x31fc52};return db[_0xef68('0x13')]['findOne']({'attributes':['id',_0xef68('0x79'),_0xef68('0x6f')],'where':_0x44f16a,'transaction':_0x4e3f59,'lock':_0x4e3f59['LOCK'][_0xef68('0x71')],'include':[{'model':db[_0xef68('0x5b')],'as':_0xef68('0x72'),'attributes':_0x18f452,'include':[{'model':db[_0xef68('0x7a')],'as':_0xef68('0x73'),'attributes':['id',_0xef68('0x11')]}]},{'model':db[_0xef68('0x74')],'as':_0xef68('0x75'),'attributes':['id',_0xef68('0x11')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xef68('0x11'),_0xef68('0x77')]}]})['then'](function(_0x28b49f){if(_0x28b49f){return _0x28b49f[_0xef68('0xc')]({'UserId':_0x1b9512},{'transaction':_0x4e3f59});}});});})[_0xef68('0xd')](handleEntityNotFound(_0x2139d2,null))['then'](respondWithResult(_0x2139d2,null))['catch'](handleError(_0x2139d2,null));};exports['getOpenContacts']=function(_0x1e2256,_0x217c31){return _0x1e2256['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xef68('0xd')](function(_0x2c147d){if(_0x2c147d&&_0x2c147d[_0xef68('0x39')]){return db['CmHopper'][_0xef68('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xef68('0x62'))},'VoiceQueueId':{'$in':_[_0xef68('0x12')](_0x2c147d,'id')},'$or':[{'UserId':null},{'UserId':_0x1e2256[_0xef68('0x4c')]['id']}]}});}return 0x0;})['then'](function(_0x242c35){if(!_[_0xef68('0x56')](_0x242c35)&&_['isNumber'](_0x242c35)){return _0x217c31[_0xef68('0x4')](0xc8)['json']({'contacts':_0x242c35});}else{logger['error'](_0xef68('0x7b'),'getOpenContacts',0x194,_0xef68('0x7c'));_0x217c31[_0xef68('0xe')](0x194);}})[_0xef68('0x37')](handleError(_0x217c31,null));};exports['getTimezones']=function(_0xb7e3e8,_0x252758){var _0x4434dd=shared[_0xef68('0x7d')];var _0x4a1ac5=[];_['map'](_0x4434dd,function(_0x36c0d3){_0x4a1ac5[_0xef68('0x7e')]({'id':_0x36c0d3[_0xef68('0x11')],'name':_0x36c0d3[_0xef68('0x11')],'utcOffset':_0x36c0d3[_0xef68('0x7f')]});});return _0x252758['status'](0xc8)[_0xef68('0x5')]({'tz':_0x4a1ac5});};exports['getTimezone']=function(_0x5f4716,_0x527bce){var _0x466da2=shared['timezones'];var _0x21c1ae={};if(!_[_0xef68('0x56')](_0x466da2[_0x5f4716[_0xef68('0x3d')]['id']]))_0x21c1ae=_0x466da2[_0x5f4716[_0xef68('0x3d')]['id']];return _0x527bce[_0xef68('0x4')](0xc8)['json'](_0x21c1ae);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 8c06eb3..4b6d853 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 _0x5496=['request-promise','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x3bdb9b,_0x2ec0a5){var _0x446a79=function(_0x29b9f8){while(--_0x29b9f8){_0x3bdb9b['push'](_0x3bdb9b['shift']());}};_0x446a79(++_0x2ec0a5);}(_0x5496,0x175));var _0x6549=function(_0x556411,_0x127852){_0x556411=_0x556411-0x0;var _0x4a1a69=_0x5496[_0x556411];return _0x4a1a69;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('CmHopper',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xb')]},{'name':'phone','fields':[_0x6549('0xc')]},{'name':_0x6549('0xd'),'fields':[_0x6549('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x4687df,_0x12099c){var _0x32eaef=function(_0x2387db){while(--_0x2387db){_0x4687df['push'](_0x4687df['shift']());}};_0x32eaef(++_0x12099c);}(_0x4975,0x86));var _0x5497=function(_0x14516a,_0x4af7aa){_0x14516a=_0x14516a-0x0;var _0x2f2dde=_0x4975[_0x14516a];return _0x2f2dde;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['scheduledat']},{'name':_0x5497('0xe'),'fields':['phone']},{'name':_0x5497('0xf'),'fields':[_0x5497('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 6742d5a..a37b2eb 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 _0x6736=['debug','CreateCmHopper','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','keys','Agent','name','voicePause','length','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','create','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','UserId','push','GetCmHopperPreview','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Contact','User','CmList','lodash','bluebird','../../config/logger','jayson/promise','client','http','then','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopper,\x20%s,\x20%s','message','info','result','catch','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopper','ShowCmHopper'];(function(_0xd0ea3e,_0x3d33f0){var _0x55faa9=function(_0x381b89){while(--_0x381b89){_0xd0ea3e['push'](_0xd0ea3e['shift']());}};_0x55faa9(++_0x3d33f0);}(_0x6736,0x1db));var _0x6673=function(_0x12665e,_0x2458fc){_0x12665e=_0x12665e-0x0;var _0x375e5e=_0x6736[_0x12665e];return _0x375e5e;};'use strict';var _=require(_0x6673('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6673('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x6673('0x2'))('rpc');var jayson=require(_0x6673('0x3'));var client=jayson[_0x6673('0x4')][_0x6673('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x521812,_0x27fe3e,_0x42d369){return new BPromise(function(_0x36fa91,_0x4fbc70){return client['request'](_0x521812,_0x42d369)[_0x6673('0x6')](function(_0x591309){logger['info']('CmHopper,\x20%s,\x20%s',_0x27fe3e,'request\x20sent');logger['debug'](_0x6673('0x7'),_0x27fe3e,_0x6673('0x8'),JSON[_0x6673('0x9')](_0x591309));if(_0x591309[_0x6673('0xa')]){if(_0x591309[_0x6673('0xa')][_0x6673('0xb')]===0x1f4){logger[_0x6673('0xa')](_0x6673('0xc'),_0x27fe3e,_0x591309['error']['message']);return _0x4fbc70(_0x591309[_0x6673('0xa')][_0x6673('0xd')]);}logger[_0x6673('0xa')]('CmHopper,\x20%s,\x20%s',_0x27fe3e,_0x591309[_0x6673('0xa')][_0x6673('0xd')]);return _0x36fa91(_0x591309[_0x6673('0xa')]['message']);}else{logger[_0x6673('0xe')](_0x6673('0xc'),_0x27fe3e,'request\x20sent');_0x36fa91(_0x591309[_0x6673('0xf')][_0x6673('0xd')]);}})[_0x6673('0x10')](function(_0x7196b7){logger[_0x6673('0xa')](_0x6673('0xc'),_0x27fe3e,_0x7196b7);_0x4fbc70(_0x7196b7);});});}exports['GetCmHopper']=function(_0x2340f5){var _0x38549f=this;return new Promise(function(_0x51c7dd,_0x58a7f5){return db[_0x6673('0x11')][_0x6673('0x12')]({'raw':_0x2340f5[_0x6673('0x13')]?_0x2340f5[_0x6673('0x13')][_0x6673('0x14')]===undefined?!![]:![]:!![],'where':_0x2340f5[_0x6673('0x13')]?_0x2340f5[_0x6673('0x13')][_0x6673('0x15')]||null:null,'attributes':_0x2340f5[_0x6673('0x13')]?_0x2340f5[_0x6673('0x13')][_0x6673('0x16')]||null:null,'limit':_0x2340f5[_0x6673('0x13')]?_0x2340f5[_0x6673('0x13')][_0x6673('0x17')]||null:null,'include':_0x2340f5[_0x6673('0x13')]?_0x2340f5[_0x6673('0x13')]['include']?_['map'](_0x2340f5['options'][_0x6673('0x18')],function(_0x3a54d1){return{'model':db[_0x3a54d1['model']],'as':_0x3a54d1['as'],'attributes':_0x3a54d1[_0x6673('0x16')],'include':_0x3a54d1[_0x6673('0x18')]?_[_0x6673('0x19')](_0x3a54d1['include'],function(_0x465877){return{'model':db[_0x465877[_0x6673('0x1a')]],'as':_0x465877['as'],'attributes':_0x465877[_0x6673('0x16')],'include':_0x465877[_0x6673('0x18')]?_[_0x6673('0x19')](_0x465877[_0x6673('0x18')],function(_0x31e206){return{'model':db[_0x31e206[_0x6673('0x1a')]],'as':_0x31e206['as'],'attributes':_0x31e206[_0x6673('0x16')]};}):[]};}):[]};}):[]:[]})[_0x6673('0x6')](function(_0x2541aa){logger[_0x6673('0xe')](_0x6673('0x1b'),_0x2340f5);logger['debug']('GetCmHopper',_0x2340f5,JSON[_0x6673('0x9')](_0x2541aa));_0x51c7dd(_0x2541aa);})['catch'](function(_0x112c10){logger[_0x6673('0xa')]('GetCmHopper',_0x112c10[_0x6673('0xd')],_0x2340f5);_0x58a7f5(_0x38549f[_0x6673('0xa')](0x1f4,_0x112c10[_0x6673('0xd')]));});});};exports[_0x6673('0x1c')]=function(_0x12ab2c){var _0x4e9c43=this;return new Promise(function(_0x4b53b2,_0x5d8f60){return db['CmHopper']['find']({'raw':_0x12ab2c[_0x6673('0x13')]?_0x12ab2c[_0x6673('0x13')][_0x6673('0x14')]===undefined?!![]:![]:!![],'where':_0x12ab2c[_0x6673('0x13')]?_0x12ab2c[_0x6673('0x13')][_0x6673('0x15')]||null:null,'attributes':_0x12ab2c[_0x6673('0x13')]?_0x12ab2c['options'][_0x6673('0x16')]||null:null,'include':_0x12ab2c[_0x6673('0x13')]?_0x12ab2c[_0x6673('0x13')][_0x6673('0x18')]?_[_0x6673('0x19')](_0x12ab2c[_0x6673('0x13')][_0x6673('0x18')],function(_0x4e0fa5){return{'model':db[_0x4e0fa5[_0x6673('0x1a')]],'as':_0x4e0fa5['as'],'attributes':_0x4e0fa5[_0x6673('0x16')],'include':_0x4e0fa5['include']?_[_0x6673('0x19')](_0x4e0fa5['include'],function(_0xb38852){return{'model':db[_0xb38852[_0x6673('0x1a')]],'as':_0xb38852['as'],'attributes':_0xb38852[_0x6673('0x16')],'include':_0xb38852[_0x6673('0x18')]?_[_0x6673('0x19')](_0xb38852[_0x6673('0x18')],function(_0x38b20d){return{'model':db[_0x38b20d['model']],'as':_0x38b20d['as'],'attributes':_0x38b20d[_0x6673('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4712da){logger['info'](_0x6673('0x1c'),_0x12ab2c);logger[_0x6673('0x1d')](_0x6673('0x1c'),_0x12ab2c,JSON[_0x6673('0x9')](_0x4712da));_0x4b53b2(_0x4712da);})[_0x6673('0x10')](function(_0x32bfb9){logger[_0x6673('0xa')](_0x6673('0x1c'),_0x32bfb9[_0x6673('0xd')],_0x12ab2c);_0x5d8f60(_0x4e9c43[_0x6673('0xa')](0x1f4,_0x32bfb9[_0x6673('0xd')]));});});};exports[_0x6673('0x1e')]=function(_0x3668d0){var _0x536184=this;return new Promise(function(_0x2417a6,_0x410c79){return db[_0x6673('0x11')]['create'](_0x3668d0[_0x6673('0x1f')],{'raw':_0x3668d0[_0x6673('0x13')]?_0x3668d0[_0x6673('0x13')][_0x6673('0x14')]===undefined?!![]:![]:!![]})[_0x6673('0x6')](function(_0x2a5cbd){logger['info'](_0x6673('0x1e'),_0x3668d0);logger[_0x6673('0x1d')]('CreateCmHopper',_0x3668d0,JSON[_0x6673('0x9')](_0x2a5cbd));_0x2417a6(_0x2a5cbd);})[_0x6673('0x10')](function(_0x353056){logger[_0x6673('0xa')]('CreateCmHopper',_0x353056[_0x6673('0xd')],_0x3668d0);_0x410c79(_0x536184[_0x6673('0xa')](0x1f4,_0x353056[_0x6673('0xd')]));});});};exports[_0x6673('0x20')]=function(_0x598ad1){var _0x34a23b=this;return new Promise(function(_0x409611,_0x136800){return db[_0x6673('0x11')][_0x6673('0x21')](_0x598ad1[_0x6673('0x1f')],{'raw':_0x598ad1['options']?_0x598ad1[_0x6673('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x598ad1[_0x6673('0x13')]?_0x598ad1['options'][_0x6673('0x15')]||null:null,'attributes':_0x598ad1[_0x6673('0x13')]?_0x598ad1['options'][_0x6673('0x16')]||null:null,'limit':_0x598ad1[_0x6673('0x13')]?_0x598ad1[_0x6673('0x13')]['limit']||null:null})[_0x6673('0x6')](function(_0xa94157){logger[_0x6673('0xe')](_0x6673('0x20'),_0x598ad1);logger[_0x6673('0xe')](_0x6673('0x22'),JSON[_0x6673('0x9')](_0x598ad1[_0x6673('0x13')][_0x6673('0x15')]),_0x598ad1[_0x6673('0x1f')][_0x6673('0x23')]);logger[_0x6673('0x1d')](_0x6673('0x20'),_0x598ad1,JSON['stringify'](_0xa94157));_0x409611(_0xa94157);})[_0x6673('0x10')](function(_0x32d0b8){logger[_0x6673('0xa')](_0x6673('0x20'),_0x32d0b8[_0x6673('0xd')],_0x598ad1);_0x136800(_0x34a23b[_0x6673('0xa')](0x1f4,_0x32d0b8['message']));});});};exports['DestroyCmHopper']=function(_0x203876){var _0x329419=this;return new Promise(function(_0x53d901,_0x4b799b){return db['CmHopper'][_0x6673('0x24')]({'where':_0x203876[_0x6673('0x13')]?_0x203876[_0x6673('0x13')][_0x6673('0x15')]||null:null})[_0x6673('0x6')](function(_0x2b91fe){logger['info'](_0x6673('0x25'),_0x203876);logger['debug'](_0x6673('0x25'),_0x203876,JSON[_0x6673('0x9')](_0x2b91fe));_0x53d901(_0x2b91fe);})[_0x6673('0x10')](function(_0x249e00){logger[_0x6673('0xa')](_0x6673('0x25'),_0x249e00[_0x6673('0xd')],_0x203876);_0x4b799b(_0x329419[_0x6673('0xa')](0x1f4,_0x249e00['message']));});});};exports[_0x6673('0x26')]=function(_0x3d090d){var _0x5bbcc3=this;return new Promise(function(_0x2e9d4f,_0x1b6fd4){return db[_0x6673('0x27')][_0x6673('0x28')]()[_0x6673('0x6')](function(_0x4a0e9e){return db[_0x6673('0x29')][_0x6673('0x2a')](function(_0x27c171){return db[_0x6673('0x11')][_0x6673('0x12')]({'where':_0x3d090d[_0x6673('0x13')]?_0x3d090d[_0x6673('0x13')][_0x6673('0x15')]||null:null,'attributes':_0x3d090d[_0x6673('0x13')]?_0x3d090d['options'][_0x6673('0x16')]||null:null,'limit':_0x3d090d['options']?_0x3d090d[_0x6673('0x13')][_0x6673('0x17')]||null:null,'order':_0x3d090d[_0x6673('0x13')]?_0x3d090d['options'][_0x6673('0x2b')]||null:null,'transaction':_0x27c171,'lock':_0x27c171[_0x6673('0x2c')]['UPDATE'],'include':[{'model':db[_0x6673('0x27')],'as':'Contact','attributes':_[_0x6673('0x2d')](_0x4a0e9e)},{'model':db['User'],'as':_0x6673('0x2e'),'attributes':['id',_0x6673('0x2f'),_0x6673('0x30')]}]})[_0x6673('0x6')](function(_0x3f366){var _0x5e9a35=[];var _0x329567=[];for(var _0x2b846b=0x0;_0x2b846b<_0x3f366[_0x6673('0x31')];_0x2b846b+=0x1){var _0x43b114=_0x3f366[_0x2b846b]['UserId'];if(_0x43b114===null){_0x5e9a35['push'](_0x3f366[_0x2b846b][_0x6673('0x21')](_0x3d090d['body'],{'transaction':_0x27c171}));}else if(!_0x329567[_0x6673('0x32')](_0x43b114)){_0x329567['push'](_0x43b114);_0x5e9a35['push'](_0x3f366[_0x2b846b][_0x6673('0x21')](_0x3d090d[_0x6673('0x1f')],{'transaction':_0x27c171}));}}return BPromise[_0x6673('0x33')](_0x5e9a35);});})[_0x6673('0x6')](function(_0x156d88){logger['info']('GetContactDialer',_0x3d090d);if(_0x156d88['length']>0x0){logger['info'](_0x6673('0x34'),_0x156d88[0x0][_0x6673('0x35')]['id'],_0x156d88[0x0][_0x6673('0x35')][_0x6673('0x36')],_0x156d88[0x0][_0x6673('0x35')][_0x6673('0x23')]);}logger['debug']('GetContactDialer',_0x3d090d,JSON[_0x6673('0x9')](_0x156d88));_0x2e9d4f(_0x156d88);})[_0x6673('0x10')](function(_0xd75dfa){logger[_0x6673('0xa')]('GetContactDialer',_0xd75dfa[_0x6673('0xd')],_0x3d090d);_0x1b6fd4(_0x5bbcc3[_0x6673('0xa')](0x1f4,_0xd75dfa['message']));});});});};exports[_0x6673('0x37')]=function(_0x4f29c6){var _0x51b0dd=this;return new Promise(function(_0x441e1c,_0x40ec7a){return db['sequelize'][_0x6673('0x2a')](function(_0x4ecce9){return db[_0x6673('0x38')][_0x6673('0x39')](_0x4f29c6[_0x6673('0x1f')],{'raw':_0x4f29c6['options']?_0x4f29c6['options'][_0x6673('0x14')]===undefined?!![]:![]:!![],'transaction':_0x4ecce9})['then'](function(){logger[_0x6673('0xe')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x4f29c6['options']['where']),_0x4f29c6[_0x6673('0x13')][_0x6673('0x15')][_0x6673('0x23')]);return db['CmHopper'][_0x6673('0x24')]({'where':_0x4f29c6['options']?_0x4f29c6[_0x6673('0x13')][_0x6673('0x15')]||null:null,'transaction':_0x4ecce9});});})[_0x6673('0x6')](function(_0x2c2ca4){logger[_0x6673('0xe')](_0x6673('0x37'),_0x4f29c6);logger[_0x6673('0x1d')]('MoveContactManagedDialer',_0x4f29c6,JSON[_0x6673('0x9')](_0x2c2ca4));_0x441e1c(_0x2c2ca4);})[_0x6673('0x10')](function(_0x590ad3){logger[_0x6673('0xa')]('MoveContactManagedDialer',_0x590ad3['message'],_0x4f29c6);_0x40ec7a(_0x51b0dd[_0x6673('0xa')](0x1f4,_0x590ad3[_0x6673('0xd')]));});});};exports[_0x6673('0x3a')]=function(_0x28aafa){var _0x2199db=this;return new Promise(function(_0x4687b9,_0x3a0def){return db[_0x6673('0x11')][_0x6673('0x12')]({'raw':_0x28aafa[_0x6673('0x13')]?_0x28aafa[_0x6673('0x13')][_0x6673('0x14')]===undefined?!![]:![]:!![],'where':_0x28aafa['options']?_0x28aafa['options']['where']||null:null,'attributes':[[db[_0x6673('0x29')]['fn'](_0x6673('0x3b'),db[_0x6673('0x29')]['fn']('IF',db['sequelize']['literal'](_0x6673('0x3c')+util[_0x6673('0x3d')](_0x6673('0x3e'),moment()[_0x6673('0x3d')](_0x6673('0x3f')))+'\x20,\x201,\x20null'))),_0x6673('0x40')]]})[_0x6673('0x6')](function(_0x1a364c){logger[_0x6673('0xe')](_0x6673('0x3a'),_0x28aafa);logger[_0x6673('0x1d')](_0x6673('0x3a'),_0x28aafa,JSON[_0x6673('0x9')](_0x1a364c));_0x4687b9(_0x1a364c);})['catch'](function(_0x165486){logger[_0x6673('0xa')]('CountReScheduled',_0x165486[_0x6673('0xd')],_0x28aafa);_0x3a0def(_0x2199db['error'](0x1f4,_0x165486['message']));});});};exports[_0x6673('0x41')]=function(_0x1a1c0d){var _0x2907fa=this;return new Promise(function(_0x3dff1d,_0x31f9ca){return db['CmContact'][_0x6673('0x28')]()[_0x6673('0x6')](function(_0x80d95b){return db[_0x6673('0x29')][_0x6673('0x2a')](function(_0x48e9fa){return db[_0x6673('0x11')][_0x6673('0x12')]({'where':_0x1a1c0d[_0x6673('0x13')]?_0x1a1c0d['options']['where']||null:null,'attributes':_0x1a1c0d[_0x6673('0x13')]?_0x1a1c0d[_0x6673('0x13')][_0x6673('0x16')]||null:null,'limit':0x1,'order':_0x1a1c0d[_0x6673('0x13')]?_0x1a1c0d[_0x6673('0x13')][_0x6673('0x2b')]||null:null,'group':db['CmHopper'][_0x6673('0x42')],'transaction':_0x48e9fa,'lock':_0x48e9fa['LOCK']['UPDATE'],'include':_0x1a1c0d[_0x6673('0x13')]?_0x1a1c0d['options'][_0x6673('0x18')]?_[_0x6673('0x19')](_0x1a1c0d[_0x6673('0x13')]['include'],function(_0x27d9ee){return{'model':db[_0x27d9ee[_0x6673('0x1a')]],'as':_0x27d9ee['as'],'attributes':_0x27d9ee[_0x6673('0x16')],'include':_0x27d9ee[_0x6673('0x18')]?_[_0x6673('0x19')](_0x27d9ee[_0x6673('0x18')],function(_0x4a0704){return{'model':db[_0x4a0704[_0x6673('0x1a')]],'as':_0x4a0704['as'],'attributes':_0x4a0704['attributes'],'include':_0x4a0704[_0x6673('0x18')]?_[_0x6673('0x19')](_0x4a0704[_0x6673('0x18')],function(_0x472f90){return{'model':db[_0x472f90[_0x6673('0x1a')]],'as':_0x472f90['as'],'attributes':_0x472f90[_0x6673('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x196376){var _0x4d2ed0=[];for(var _0x351249=0x0;_0x351249<_0x196376[_0x6673('0x31')];_0x351249+=0x1){_0x4d2ed0[_0x6673('0x43')](_0x196376[_0x351249][_0x6673('0x21')](_0x1a1c0d[_0x6673('0x1f')],{'transaction':_0x48e9fa}));}return BPromise[_0x6673('0x33')](_0x4d2ed0);});})['then'](function(_0x277bc8){logger[_0x6673('0xe')]('GetContactRecallMe',_0x1a1c0d);logger[_0x6673('0x1d')](_0x6673('0x41'),_0x1a1c0d,JSON[_0x6673('0x9')](_0x277bc8));_0x3dff1d(_0x277bc8);})['catch'](function(_0xdf15c5){logger[_0x6673('0xa')](_0x6673('0x41'),_0xdf15c5['message'],_0x1a1c0d);_0x31f9ca(_0x2907fa['error'](0x1f4,_0xdf15c5[_0x6673('0xd')]));});});});};exports[_0x6673('0x44')]=function(_0x35bad3){var _0x32ab26=this;return new Promise(function(_0x4e4fe3,_0x462988){db[_0x6673('0x27')]['describe']()[_0x6673('0x6')](function(_0x251bd9){return db[_0x6673('0x11')][_0x6673('0x12')]({'raw':_0x35bad3[_0x6673('0x13')]?_0x35bad3['options']['raw']===undefined?!![]:![]:!![],'where':_0x35bad3[_0x6673('0x13')]?_0x35bad3[_0x6673('0x13')][_0x6673('0x15')]||null:null,'attributes':_0x35bad3[_0x6673('0x13')]?_0x35bad3[_0x6673('0x13')][_0x6673('0x16')]||null:null,'limit':_0x35bad3[_0x6673('0x13')]?_0x35bad3[_0x6673('0x13')][_0x6673('0x17')]||null:null,'include':_0x35bad3[_0x6673('0x13')]?_0x35bad3[_0x6673('0x13')][_0x6673('0x18')]?_[_0x6673('0x19')](_0x35bad3[_0x6673('0x13')][_0x6673('0x18')],function(_0x11d1d4){return{'model':db[_0x11d1d4[_0x6673('0x1a')]],'as':_0x11d1d4['as'],'attributes':_0x11d1d4['as']==='Contact'?_[_0x6673('0x2d')](_0x251bd9):_0x11d1d4[_0x6673('0x16')],'include':_0x11d1d4['include']?_[_0x6673('0x19')](_0x11d1d4['include'],function(_0x4ae2c4){return{'model':db[_0x4ae2c4[_0x6673('0x1a')]],'as':_0x4ae2c4['as'],'attributes':_0x4ae2c4[_0x6673('0x16')],'include':_0x4ae2c4['include']?_[_0x6673('0x19')](_0x4ae2c4[_0x6673('0x18')],function(_0x5bea0b){return{'model':db[_0x5bea0b[_0x6673('0x1a')]],'as':_0x5bea0b['as'],'attributes':_0x5bea0b[_0x6673('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22f2c1){logger[_0x6673('0xe')]('GetCmHopper',_0x35bad3);logger['debug'](_0x6673('0x1b'),_0x35bad3,JSON['stringify'](_0x22f2c1));_0x4e4fe3(_0x22f2c1);})[_0x6673('0x10')](function(_0x1415aa){logger['error'](_0x6673('0x1b'),_0x1415aa[_0x6673('0xd')],_0x35bad3);_0x462988(_0x32ab26['error'](0x1f4,_0x1415aa[_0x6673('0xd')]));});});});};exports['GetContactByPhone']=function(_0x450eeb){var _0x5c75e0=this;return new Promise(function(_0xaef3ec,_0x358997){return db['CmContact'][_0x6673('0x45')]({'raw':!![],'where':{'phone':_0x450eeb[_0x6673('0x13')][_0x6673('0x15')][_0x6673('0x46')]},'attributes':['id','dialTimezone'],'order':[['id',_0x6673('0x47')]]})[_0x6673('0x6')](function(_0x3cd263){logger[_0x6673('0xe')](_0x6673('0x48'),_0x450eeb);logger[_0x6673('0x1d')](_0x6673('0x48'),_0x450eeb,JSON['stringify'](_0x3cd263));_0xaef3ec(_0x3cd263);})[_0x6673('0x10')](function(_0x1be56f){logger[_0x6673('0xa')](_0x6673('0x48'),_0x1be56f[_0x6673('0xd')],_0x450eeb);_0x358997(_0x5c75e0[_0x6673('0xa')](0x1f4,_0x1be56f[_0x6673('0xd')]));});});};exports[_0x6673('0x49')]=function(_0x1a5bc8){var _0x1db58a=this;return new Promise(function(_0x20c60c,_0x17939f){return db[_0x6673('0x29')]['transaction'](function(_0x1bcd9a){return db[_0x6673('0x11')][_0x6673('0x21')]({'active':![]},{'where':{},'transaction':_0x1bcd9a})[_0x6673('0x6')](function(_0x247754){logger[_0x6673('0xe')](_0x6673('0x49'),_0x1a5bc8);logger[_0x6673('0x1d')](_0x6673('0x49'),_0x1a5bc8,JSON['stringify'](_0x247754));_0x20c60c(_0x247754);})[_0x6673('0x10')](function(_0x3540a7){logger[_0x6673('0xa')]('ResetActiveCalls',_0x3540a7['message'],_0x1a5bc8);_0x17939f(_0x1db58a['error'](0x1f4,_0x3540a7[_0x6673('0xd')]));});});});};exports[_0x6673('0x4a')]=function(_0x4179a0){var _0x3959e5=this;var _0x40ae4b=_0x4179a0['body'][_0x6673('0x15')]['voiceQueueId'];var _0x310de2=_0x4179a0[_0x6673('0x1f')][_0x6673('0x15')][_0x6673('0x4b')];var _0xf20976=_0x4179a0[_0x6673('0x1f')]['where'][_0x6673('0x4c')];return new Promise(function(_0x704ae3,_0x4e36b1){return db[_0x6673('0x11')]['findAll']({'where':{'voiceQueueId':_0x40ae4b,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x6673('0x29')][_0x6673('0x4d')](_0x6673('0x4e')+_0x310de2+_0x6673('0x4f')),'$gt':db[_0x6673('0x29')]['literal'](_0x6673('0x50'))}},'UserId':{'$in':_0xf20976}},'include':[{'model':db[_0x6673('0x27')],'as':_0x6673('0x51')},{'model':db[_0x6673('0x52')],'as':_0x6673('0x2e'),'attributes':['id',_0x6673('0x2f'),_0x6673('0x30')]},{'model':db[_0x6673('0x53')],'as':'List'}]})['then'](function(_0x866b04){if(_0x866b04[_0x6673('0x31')]>0x0){return db[_0x6673('0x29')]['transaction'](function(_0x2b0f47){return db['CmHopper'][_0x6673('0x21')]({'recallmeNotifiedDate':db['sequelize'][_0x6673('0x4d')](_0x6673('0x50'))},{'where':{'id':{'$in':_[_0x6673('0x19')](_0x866b04,'id')}},'transaction':_0x2b0f47})[_0x6673('0x6')](function(){_0x704ae3(_0x866b04);})[_0x6673('0x10')](function(_0x5cd902){logger[_0x6673('0xa')](_0x6673('0x4a'),_0x5cd902[_0x6673('0xd')],_0x4179a0);_0x4e36b1(_0x3959e5['error'](0x1f4,_0x5cd902[_0x6673('0xd')]));});})['catch'](function(_0x882b48){logger[_0x6673('0xa')]('CmHopperHandlePreviewRecallNotifications',_0x882b48[_0x6673('0xd')],_0x4179a0);_0x4e36b1(_0x3959e5[_0x6673('0xa')](0x1f4,_0x882b48['message']));});}else{_0x704ae3(_0x866b04);}});});}; \ No newline at end of file +var _0x5793=['CmHopper','find','where','ShowCmHopper','CreateCmHopper','create','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','client','http','request','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','CmHopper,\x20%s,\x20%s','message','info','catch','findAll','options','raw','limit','include','map','model','attributes','then','GetCmHopper'];(function(_0x231673,_0x5e4b30){var _0x34502e=function(_0x1a9284){while(--_0x1a9284){_0x231673['push'](_0x231673['shift']());}};_0x34502e(++_0x5e4b30);}(_0x5793,0x138));var _0x3579=function(_0x2b053c,_0x33245f){_0x2b053c=_0x2b053c-0x0;var _0x3a2ccc=_0x5793[_0x2b053c];return _0x3a2ccc;};'use strict';var _=require(_0x3579('0x0'));var util=require(_0x3579('0x1'));var moment=require(_0x3579('0x2'));var BPromise=require(_0x3579('0x3'));var db=require(_0x3579('0x4'))['db'];var logger=require(_0x3579('0x5'))('rpc');var jayson=require('jayson/promise');var client=jayson[_0x3579('0x6')][_0x3579('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45042b,_0x215d4e,_0x4b2779){return new BPromise(function(_0x15ba03,_0x13b99c){return client[_0x3579('0x8')](_0x45042b,_0x4b2779)['then'](function(_0x2f0cad){logger['info']('CmHopper,\x20%s,\x20%s',_0x215d4e,_0x3579('0x9'));logger[_0x3579('0xa')](_0x3579('0xb'),_0x215d4e,_0x3579('0x9'),JSON[_0x3579('0xc')](_0x2f0cad));if(_0x2f0cad['error']){if(_0x2f0cad[_0x3579('0xd')]['code']===0x1f4){logger[_0x3579('0xd')](_0x3579('0xe'),_0x215d4e,_0x2f0cad['error'][_0x3579('0xf')]);return _0x13b99c(_0x2f0cad[_0x3579('0xd')][_0x3579('0xf')]);}logger[_0x3579('0xd')]('CmHopper,\x20%s,\x20%s',_0x215d4e,_0x2f0cad[_0x3579('0xd')][_0x3579('0xf')]);return _0x15ba03(_0x2f0cad['error'][_0x3579('0xf')]);}else{logger[_0x3579('0x10')](_0x3579('0xe'),_0x215d4e,_0x3579('0x9'));_0x15ba03(_0x2f0cad['result'][_0x3579('0xf')]);}})[_0x3579('0x11')](function(_0x5949ef){logger['error'](_0x3579('0xe'),_0x215d4e,_0x5949ef);_0x13b99c(_0x5949ef);});});}exports['GetCmHopper']=function(_0x414947){var _0x58781e=this;return new Promise(function(_0x4047ad,_0x52466e){return db['CmHopper'][_0x3579('0x12')]({'raw':_0x414947[_0x3579('0x13')]?_0x414947[_0x3579('0x13')][_0x3579('0x14')]===undefined?!![]:![]:!![],'where':_0x414947[_0x3579('0x13')]?_0x414947[_0x3579('0x13')]['where']||null:null,'attributes':_0x414947[_0x3579('0x13')]?_0x414947[_0x3579('0x13')]['attributes']||null:null,'limit':_0x414947[_0x3579('0x13')]?_0x414947['options'][_0x3579('0x15')]||null:null,'include':_0x414947[_0x3579('0x13')]?_0x414947[_0x3579('0x13')][_0x3579('0x16')]?_[_0x3579('0x17')](_0x414947[_0x3579('0x13')][_0x3579('0x16')],function(_0x514049){return{'model':db[_0x514049[_0x3579('0x18')]],'as':_0x514049['as'],'attributes':_0x514049[_0x3579('0x19')],'include':_0x514049[_0x3579('0x16')]?_[_0x3579('0x17')](_0x514049[_0x3579('0x16')],function(_0x293f17){return{'model':db[_0x293f17[_0x3579('0x18')]],'as':_0x293f17['as'],'attributes':_0x293f17[_0x3579('0x19')],'include':_0x293f17[_0x3579('0x16')]?_[_0x3579('0x17')](_0x293f17[_0x3579('0x16')],function(_0x74c4af){return{'model':db[_0x74c4af[_0x3579('0x18')]],'as':_0x74c4af['as'],'attributes':_0x74c4af[_0x3579('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3579('0x1a')](function(_0x4f0c4c){logger[_0x3579('0x10')](_0x3579('0x1b'),_0x414947);logger[_0x3579('0xa')](_0x3579('0x1b'),_0x414947,JSON[_0x3579('0xc')](_0x4f0c4c));_0x4047ad(_0x4f0c4c);})[_0x3579('0x11')](function(_0x4ad241){logger[_0x3579('0xd')]('GetCmHopper',_0x4ad241[_0x3579('0xf')],_0x414947);_0x52466e(_0x58781e[_0x3579('0xd')](0x1f4,_0x4ad241[_0x3579('0xf')]));});});};exports['ShowCmHopper']=function(_0x28a8a8){var _0x312b32=this;return new Promise(function(_0x476052,_0x4f5103){return db[_0x3579('0x1c')][_0x3579('0x1d')]({'raw':_0x28a8a8[_0x3579('0x13')]?_0x28a8a8[_0x3579('0x13')][_0x3579('0x14')]===undefined?!![]:![]:!![],'where':_0x28a8a8['options']?_0x28a8a8[_0x3579('0x13')][_0x3579('0x1e')]||null:null,'attributes':_0x28a8a8[_0x3579('0x13')]?_0x28a8a8[_0x3579('0x13')]['attributes']||null:null,'include':_0x28a8a8[_0x3579('0x13')]?_0x28a8a8['options'][_0x3579('0x16')]?_['map'](_0x28a8a8['options'][_0x3579('0x16')],function(_0x24fd58){return{'model':db[_0x24fd58[_0x3579('0x18')]],'as':_0x24fd58['as'],'attributes':_0x24fd58[_0x3579('0x19')],'include':_0x24fd58[_0x3579('0x16')]?_[_0x3579('0x17')](_0x24fd58[_0x3579('0x16')],function(_0x3dd6aa){return{'model':db[_0x3dd6aa[_0x3579('0x18')]],'as':_0x3dd6aa['as'],'attributes':_0x3dd6aa['attributes'],'include':_0x3dd6aa[_0x3579('0x16')]?_[_0x3579('0x17')](_0x3dd6aa[_0x3579('0x16')],function(_0x3f56a5){return{'model':db[_0x3f56a5[_0x3579('0x18')]],'as':_0x3f56a5['as'],'attributes':_0x3f56a5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5de5a4){logger[_0x3579('0x10')](_0x3579('0x1f'),_0x28a8a8);logger[_0x3579('0xa')](_0x3579('0x1f'),_0x28a8a8,JSON[_0x3579('0xc')](_0x5de5a4));_0x476052(_0x5de5a4);})[_0x3579('0x11')](function(_0x3cb55c){logger[_0x3579('0xd')](_0x3579('0x1f'),_0x3cb55c['message'],_0x28a8a8);_0x4f5103(_0x312b32[_0x3579('0xd')](0x1f4,_0x3cb55c[_0x3579('0xf')]));});});};exports[_0x3579('0x20')]=function(_0x12248e){var _0x42d6f1=this;return new Promise(function(_0x10951a,_0x75c747){return db[_0x3579('0x1c')][_0x3579('0x21')](_0x12248e['body'],{'raw':_0x12248e[_0x3579('0x13')]?_0x12248e[_0x3579('0x13')][_0x3579('0x14')]===undefined?!![]:![]:!![]})[_0x3579('0x1a')](function(_0x1ee477){logger[_0x3579('0x10')](_0x3579('0x20'),_0x12248e);logger[_0x3579('0xa')]('CreateCmHopper',_0x12248e,JSON[_0x3579('0xc')](_0x1ee477));_0x10951a(_0x1ee477);})[_0x3579('0x11')](function(_0x534f4d){logger[_0x3579('0xd')]('CreateCmHopper',_0x534f4d[_0x3579('0xf')],_0x12248e);_0x75c747(_0x42d6f1[_0x3579('0xd')](0x1f4,_0x534f4d[_0x3579('0xf')]));});});};exports[_0x3579('0x22')]=function(_0x5a4509){var _0x42387d=this;return new Promise(function(_0x1fdee1,_0x10e456){return db[_0x3579('0x1c')][_0x3579('0x23')](_0x5a4509[_0x3579('0x24')],{'raw':_0x5a4509[_0x3579('0x13')]?_0x5a4509[_0x3579('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a4509['options']?_0x5a4509[_0x3579('0x13')]['where']||null:null,'attributes':_0x5a4509['options']?_0x5a4509[_0x3579('0x13')][_0x3579('0x19')]||null:null,'limit':_0x5a4509[_0x3579('0x13')]?_0x5a4509['options'][_0x3579('0x15')]||null:null})[_0x3579('0x1a')](function(_0x2f6ba3){logger[_0x3579('0x10')](_0x3579('0x22'),_0x5a4509);logger[_0x3579('0x10')](_0x3579('0x25'),JSON['stringify'](_0x5a4509[_0x3579('0x13')][_0x3579('0x1e')]),_0x5a4509[_0x3579('0x24')]['active']);logger[_0x3579('0xa')](_0x3579('0x22'),_0x5a4509,JSON[_0x3579('0xc')](_0x2f6ba3));_0x1fdee1(_0x2f6ba3);})[_0x3579('0x11')](function(_0x5d3b48){logger['error'](_0x3579('0x22'),_0x5d3b48[_0x3579('0xf')],_0x5a4509);_0x10e456(_0x42387d[_0x3579('0xd')](0x1f4,_0x5d3b48[_0x3579('0xf')]));});});};exports['DestroyCmHopper']=function(_0x37f8db){var _0x23f61a=this;return new Promise(function(_0x37d6bb,_0x480f13){return db['CmHopper'][_0x3579('0x26')]({'where':_0x37f8db[_0x3579('0x13')]?_0x37f8db[_0x3579('0x13')][_0x3579('0x1e')]||null:null})['then'](function(_0x258a62){logger[_0x3579('0x10')]('DestroyCmHopper',_0x37f8db);logger[_0x3579('0xa')](_0x3579('0x27'),_0x37f8db,JSON[_0x3579('0xc')](_0x258a62));_0x37d6bb(_0x258a62);})[_0x3579('0x11')](function(_0x254cd6){logger[_0x3579('0xd')](_0x3579('0x27'),_0x254cd6[_0x3579('0xf')],_0x37f8db);_0x480f13(_0x23f61a[_0x3579('0xd')](0x1f4,_0x254cd6[_0x3579('0xf')]));});});};exports[_0x3579('0x28')]=function(_0x35d6e4){var _0x36e4f2=this;return new Promise(function(_0x215898,_0x5c4b6b){return db[_0x3579('0x29')][_0x3579('0x2a')]()[_0x3579('0x1a')](function(_0x38def7){return db[_0x3579('0x2b')][_0x3579('0x2c')](function(_0x11a08){return db[_0x3579('0x1c')][_0x3579('0x12')]({'where':_0x35d6e4['options']?_0x35d6e4[_0x3579('0x13')][_0x3579('0x1e')]||null:null,'attributes':_0x35d6e4[_0x3579('0x13')]?_0x35d6e4['options'][_0x3579('0x19')]||null:null,'limit':_0x35d6e4[_0x3579('0x13')]?_0x35d6e4[_0x3579('0x13')]['limit']||null:null,'order':_0x35d6e4['options']?_0x35d6e4[_0x3579('0x13')][_0x3579('0x2d')]||null:null,'transaction':_0x11a08,'lock':_0x11a08[_0x3579('0x2e')][_0x3579('0x2f')],'include':[{'model':db[_0x3579('0x29')],'as':_0x3579('0x30'),'attributes':_[_0x3579('0x31')](_0x38def7)},{'model':db[_0x3579('0x32')],'as':_0x3579('0x33'),'attributes':['id',_0x3579('0x34'),_0x3579('0x35')]}]})[_0x3579('0x1a')](function(_0xa641a2){var _0x5da8f3=[];var _0x3ac183=[];for(var _0x4081ac=0x0;_0x4081ac<_0xa641a2[_0x3579('0x36')];_0x4081ac+=0x1){var _0x3cb51f=_0xa641a2[_0x4081ac]['UserId'];if(_0x3cb51f===null){_0x5da8f3[_0x3579('0x37')](_0xa641a2[_0x4081ac][_0x3579('0x23')](_0x35d6e4[_0x3579('0x24')],{'transaction':_0x11a08}));}else if(!_0x3ac183['includes'](_0x3cb51f)){_0x3ac183['push'](_0x3cb51f);_0x5da8f3[_0x3579('0x37')](_0xa641a2[_0x4081ac][_0x3579('0x23')](_0x35d6e4['body'],{'transaction':_0x11a08}));}}return BPromise[_0x3579('0x38')](_0x5da8f3);});})[_0x3579('0x1a')](function(_0x3e2d14){logger[_0x3579('0x10')](_0x3579('0x28'),_0x35d6e4);if(_0x3e2d14[_0x3579('0x36')]>0x0){logger[_0x3579('0x10')](_0x3579('0x39'),_0x3e2d14[0x0][_0x3579('0x3a')]['id'],_0x3e2d14[0x0][_0x3579('0x3a')][_0x3579('0x3b')],_0x3e2d14[0x0][_0x3579('0x3a')][_0x3579('0x3c')]);}logger[_0x3579('0xa')]('GetContactDialer',_0x35d6e4,JSON[_0x3579('0xc')](_0x3e2d14));_0x215898(_0x3e2d14);})['catch'](function(_0x4f07da){logger['error'](_0x3579('0x28'),_0x4f07da[_0x3579('0xf')],_0x35d6e4);_0x5c4b6b(_0x36e4f2['error'](0x1f4,_0x4f07da['message']));});});});};exports[_0x3579('0x3d')]=function(_0x4ebc5c){var _0x30ad1e=this;return new Promise(function(_0x52ba7e,_0x219b63){return db[_0x3579('0x2b')][_0x3579('0x2c')](function(_0x466d59){return db[_0x3579('0x3e')][_0x3579('0x21')](_0x4ebc5c[_0x3579('0x24')],{'raw':_0x4ebc5c[_0x3579('0x13')]?_0x4ebc5c['options'][_0x3579('0x14')]===undefined?!![]:![]:!![],'transaction':_0x466d59})[_0x3579('0x1a')](function(){logger[_0x3579('0x10')](_0x3579('0x3f'),JSON[_0x3579('0xc')](_0x4ebc5c[_0x3579('0x13')]['where']),_0x4ebc5c[_0x3579('0x13')][_0x3579('0x1e')]['active']);return db[_0x3579('0x1c')][_0x3579('0x26')]({'where':_0x4ebc5c[_0x3579('0x13')]?_0x4ebc5c[_0x3579('0x13')]['where']||null:null,'transaction':_0x466d59});});})['then'](function(_0x4cf5db){logger[_0x3579('0x10')]('MoveContactManagedDialer',_0x4ebc5c);logger[_0x3579('0xa')](_0x3579('0x3d'),_0x4ebc5c,JSON[_0x3579('0xc')](_0x4cf5db));_0x52ba7e(_0x4cf5db);})[_0x3579('0x11')](function(_0x55d39a){logger[_0x3579('0xd')]('MoveContactManagedDialer',_0x55d39a['message'],_0x4ebc5c);_0x219b63(_0x30ad1e[_0x3579('0xd')](0x1f4,_0x55d39a[_0x3579('0xf')]));});});};exports[_0x3579('0x40')]=function(_0x567ba6){var _0x4b6662=this;return new Promise(function(_0x5e705d,_0x2b941f){return db['CmHopper'][_0x3579('0x12')]({'raw':_0x567ba6[_0x3579('0x13')]?_0x567ba6[_0x3579('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x567ba6[_0x3579('0x13')]?_0x567ba6['options'][_0x3579('0x1e')]||null:null,'attributes':[[db[_0x3579('0x2b')]['fn']('COUNT',db[_0x3579('0x2b')]['fn']('IF',db[_0x3579('0x2b')][_0x3579('0x41')]('`scheduledat`\x20>=\x20'+util['format']('\x22%s\x22',moment()[_0x3579('0x42')](_0x3579('0x43')))+_0x3579('0x44')))),_0x3579('0x45')]]})[_0x3579('0x1a')](function(_0x537dd8){logger[_0x3579('0x10')](_0x3579('0x40'),_0x567ba6);logger[_0x3579('0xa')]('CountReScheduled',_0x567ba6,JSON[_0x3579('0xc')](_0x537dd8));_0x5e705d(_0x537dd8);})['catch'](function(_0x3c4a45){logger[_0x3579('0xd')](_0x3579('0x40'),_0x3c4a45[_0x3579('0xf')],_0x567ba6);_0x2b941f(_0x4b6662[_0x3579('0xd')](0x1f4,_0x3c4a45['message']));});});};exports[_0x3579('0x46')]=function(_0x1dbb7e){var _0x300a36=this;return new Promise(function(_0x2e2a3a,_0x4f41eb){return db[_0x3579('0x29')][_0x3579('0x2a')]()['then'](function(_0x2881b2){return db[_0x3579('0x2b')]['transaction'](function(_0x52519a){return db[_0x3579('0x1c')]['findAll']({'where':_0x1dbb7e[_0x3579('0x13')]?_0x1dbb7e[_0x3579('0x13')][_0x3579('0x1e')]||null:null,'attributes':_0x1dbb7e[_0x3579('0x13')]?_0x1dbb7e[_0x3579('0x13')][_0x3579('0x19')]||null:null,'limit':0x1,'order':_0x1dbb7e[_0x3579('0x13')]?_0x1dbb7e[_0x3579('0x13')]['order']||null:null,'group':db[_0x3579('0x1c')]['UserId'],'transaction':_0x52519a,'lock':_0x52519a['LOCK']['UPDATE'],'include':_0x1dbb7e['options']?_0x1dbb7e[_0x3579('0x13')][_0x3579('0x16')]?_[_0x3579('0x17')](_0x1dbb7e[_0x3579('0x13')][_0x3579('0x16')],function(_0x2636ed){return{'model':db[_0x2636ed['model']],'as':_0x2636ed['as'],'attributes':_0x2636ed['attributes'],'include':_0x2636ed['include']?_[_0x3579('0x17')](_0x2636ed['include'],function(_0x1bdd21){return{'model':db[_0x1bdd21['model']],'as':_0x1bdd21['as'],'attributes':_0x1bdd21[_0x3579('0x19')],'include':_0x1bdd21[_0x3579('0x16')]?_[_0x3579('0x17')](_0x1bdd21['include'],function(_0x57bfd5){return{'model':db[_0x57bfd5[_0x3579('0x18')]],'as':_0x57bfd5['as'],'attributes':_0x57bfd5[_0x3579('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3579('0x1a')](function(_0x435c2e){var _0x311606=[];for(var _0x4fdba0=0x0;_0x4fdba0<_0x435c2e['length'];_0x4fdba0+=0x1){_0x311606[_0x3579('0x37')](_0x435c2e[_0x4fdba0][_0x3579('0x23')](_0x1dbb7e[_0x3579('0x24')],{'transaction':_0x52519a}));}return BPromise['all'](_0x311606);});})[_0x3579('0x1a')](function(_0x56c8f5){logger[_0x3579('0x10')](_0x3579('0x46'),_0x1dbb7e);logger[_0x3579('0xa')]('GetContactRecallMe',_0x1dbb7e,JSON[_0x3579('0xc')](_0x56c8f5));_0x2e2a3a(_0x56c8f5);})[_0x3579('0x11')](function(_0x81b905){logger['error'](_0x3579('0x46'),_0x81b905[_0x3579('0xf')],_0x1dbb7e);_0x4f41eb(_0x300a36[_0x3579('0xd')](0x1f4,_0x81b905[_0x3579('0xf')]));});});});};exports[_0x3579('0x47')]=function(_0x2a8e68){var _0x5284cd=this;return new Promise(function(_0x46b8e1,_0x2ed357){db[_0x3579('0x29')][_0x3579('0x2a')]()[_0x3579('0x1a')](function(_0x42a325){return db['CmHopper'][_0x3579('0x12')]({'raw':_0x2a8e68['options']?_0x2a8e68[_0x3579('0x13')][_0x3579('0x14')]===undefined?!![]:![]:!![],'where':_0x2a8e68[_0x3579('0x13')]?_0x2a8e68[_0x3579('0x13')]['where']||null:null,'attributes':_0x2a8e68['options']?_0x2a8e68['options']['attributes']||null:null,'limit':_0x2a8e68['options']?_0x2a8e68[_0x3579('0x13')][_0x3579('0x15')]||null:null,'include':_0x2a8e68['options']?_0x2a8e68[_0x3579('0x13')][_0x3579('0x16')]?_['map'](_0x2a8e68[_0x3579('0x13')]['include'],function(_0x3cf482){return{'model':db[_0x3cf482[_0x3579('0x18')]],'as':_0x3cf482['as'],'attributes':_0x3cf482['as']===_0x3579('0x30')?_['keys'](_0x42a325):_0x3cf482[_0x3579('0x19')],'include':_0x3cf482['include']?_[_0x3579('0x17')](_0x3cf482[_0x3579('0x16')],function(_0x10480f){return{'model':db[_0x10480f['model']],'as':_0x10480f['as'],'attributes':_0x10480f[_0x3579('0x19')],'include':_0x10480f[_0x3579('0x16')]?_[_0x3579('0x17')](_0x10480f[_0x3579('0x16')],function(_0xc0a86b){return{'model':db[_0xc0a86b[_0x3579('0x18')]],'as':_0xc0a86b['as'],'attributes':_0xc0a86b[_0x3579('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3579('0x1a')](function(_0x4f104b){logger[_0x3579('0x10')](_0x3579('0x1b'),_0x2a8e68);logger[_0x3579('0xa')](_0x3579('0x1b'),_0x2a8e68,JSON[_0x3579('0xc')](_0x4f104b));_0x46b8e1(_0x4f104b);})[_0x3579('0x11')](function(_0x2ad480){logger[_0x3579('0xd')](_0x3579('0x1b'),_0x2ad480[_0x3579('0xf')],_0x2a8e68);_0x2ed357(_0x5284cd[_0x3579('0xd')](0x1f4,_0x2ad480[_0x3579('0xf')]));});});});};exports[_0x3579('0x48')]=function(_0x2dd5c9){var _0x4c09ea=this;return new Promise(function(_0x39fc85,_0x5d13ed){return db[_0x3579('0x29')][_0x3579('0x49')]({'raw':!![],'where':{'phone':_0x2dd5c9[_0x3579('0x13')][_0x3579('0x1e')]['phone']},'attributes':['id',_0x3579('0x4a')],'order':[['id',_0x3579('0x4b')]]})[_0x3579('0x1a')](function(_0x5285e2){logger[_0x3579('0x10')](_0x3579('0x4c'),_0x2dd5c9);logger[_0x3579('0xa')](_0x3579('0x4c'),_0x2dd5c9,JSON['stringify'](_0x5285e2));_0x39fc85(_0x5285e2);})[_0x3579('0x11')](function(_0x4d3bb4){logger[_0x3579('0xd')]('getContactByPhone',_0x4d3bb4[_0x3579('0xf')],_0x2dd5c9);_0x5d13ed(_0x4c09ea['error'](0x1f4,_0x4d3bb4[_0x3579('0xf')]));});});};exports[_0x3579('0x4d')]=function(_0x6736c7){var _0x1cd61a=this;return new Promise(function(_0x212eab,_0x72fd2d){return db[_0x3579('0x2b')]['transaction'](function(_0xa2812e){return db[_0x3579('0x1c')][_0x3579('0x23')]({'active':![]},{'where':{},'transaction':_0xa2812e})[_0x3579('0x1a')](function(_0xe088d0){logger[_0x3579('0x10')](_0x3579('0x4d'),_0x6736c7);logger[_0x3579('0xa')]('ResetActiveCalls',_0x6736c7,JSON[_0x3579('0xc')](_0xe088d0));_0x212eab(_0xe088d0);})[_0x3579('0x11')](function(_0x347932){logger[_0x3579('0xd')]('ResetActiveCalls',_0x347932[_0x3579('0xf')],_0x6736c7);_0x72fd2d(_0x1cd61a['error'](0x1f4,_0x347932[_0x3579('0xf')]));});});});};exports[_0x3579('0x4e')]=function(_0x22ace){var _0x3411d0=this;var _0x44971b=_0x22ace[_0x3579('0x24')][_0x3579('0x1e')][_0x3579('0x4f')];var _0x4f8cc0=_0x22ace['body'][_0x3579('0x1e')]['interval'];var _0x324e21=_0x22ace['body'][_0x3579('0x1e')][_0x3579('0x50')];return new Promise(function(_0x25db8d,_0x1855c3){return db[_0x3579('0x1c')][_0x3579('0x12')]({'where':{'voiceQueueId':_0x44971b,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x3579('0x2b')][_0x3579('0x41')](_0x3579('0x51')+_0x4f8cc0+_0x3579('0x52')),'$gt':db[_0x3579('0x2b')][_0x3579('0x41')](_0x3579('0x53'))}},'UserId':{'$in':_0x324e21}},'include':[{'model':db[_0x3579('0x29')],'as':_0x3579('0x30')},{'model':db[_0x3579('0x32')],'as':'Agent','attributes':['id',_0x3579('0x34'),'voicePause']},{'model':db[_0x3579('0x54')],'as':'List'}]})[_0x3579('0x1a')](function(_0x3627f2){if(_0x3627f2[_0x3579('0x36')]>0x0){return db[_0x3579('0x2b')][_0x3579('0x2c')](function(_0x5ca7c8){return db[_0x3579('0x1c')][_0x3579('0x23')]({'recallmeNotifiedDate':db[_0x3579('0x2b')]['literal'](_0x3579('0x53'))},{'where':{'id':{'$in':_[_0x3579('0x17')](_0x3627f2,'id')}},'transaction':_0x5ca7c8})[_0x3579('0x1a')](function(){_0x25db8d(_0x3627f2);})['catch'](function(_0x5aa367){logger['error'](_0x3579('0x4e'),_0x5aa367[_0x3579('0xf')],_0x22ace);_0x1855c3(_0x3411d0[_0x3579('0xd')](0x1f4,_0x5aa367[_0x3579('0xf')]));});})[_0x3579('0x11')](function(_0x51800c){logger[_0x3579('0xd')](_0x3579('0x4e'),_0x51800c[_0x3579('0xf')],_0x22ace);_0x1855c3(_0x3411d0[_0x3579('0xd')](0x1f4,_0x51800c['message']));});}else{_0x25db8d(_0x3627f2);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 12ff38e..be953f7 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 _0xf7cb=['update','delete','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','show','/:id/previewrecall','post','create','getPreview','/timezone','put','/:id'];(function(_0x156d07,_0x48ac3f){var _0x127caf=function(_0x2d5f20){while(--_0x2d5f20){_0x156d07['push'](_0x156d07['shift']());}};_0x127caf(++_0x48ac3f);}(_0xf7cb,0x93));var _0xbf7c=function(_0x15fb4c,_0x21e6ba){_0x15fb4c=_0x15fb4c-0x0;var _0x1bd4a9=_0xf7cb[_0x15fb4c];return _0x1bd4a9;};'use strict';var express=require(_0xbf7c('0x0'));var router=express[_0xbf7c('0x1')]();var auth=require(_0xbf7c('0x2'));var controller=require(_0xbf7c('0x3'));router[_0xbf7c('0x4')]('/',auth[_0xbf7c('0x5')](),controller[_0xbf7c('0x6')]);router[_0xbf7c('0x4')](_0xbf7c('0x7'),auth[_0xbf7c('0x5')](),controller[_0xbf7c('0x8')]);router[_0xbf7c('0x4')](_0xbf7c('0x9'),auth[_0xbf7c('0x5')](),controller[_0xbf7c('0xa')]);router[_0xbf7c('0x4')](_0xbf7c('0xb'),auth[_0xbf7c('0x5')](),controller[_0xbf7c('0xc')]);router[_0xbf7c('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xbf7c('0xd')]);router['get'](_0xbf7c('0xe'),auth[_0xbf7c('0x5')](),controller['getPreviewRecall']);router[_0xbf7c('0xf')]('/',auth[_0xbf7c('0x5')](),controller[_0xbf7c('0x10')]);router['post']('/preview',auth['isAuthenticated'](),controller[_0xbf7c('0x11')]);router[_0xbf7c('0xf')](_0xbf7c('0x12'),auth[_0xbf7c('0x5')](),controller['getTimezone']);router[_0xbf7c('0x13')](_0xbf7c('0x14'),auth[_0xbf7c('0x5')](),controller[_0xbf7c('0x15')]);router[_0xbf7c('0x16')]('/:id',auth[_0xbf7c('0x5')](),controller['destroy']);module[_0xbf7c('0x17')]=router; \ No newline at end of file +var _0x36fc=['describe','/opencontacts','getOpenContacts','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview','getTimezone','put','destroy','Router','./cmHopper.controller','get','isAuthenticated','index','/describe'];(function(_0x41ed31,_0x349024){var _0x58cddc=function(_0x5c70c1){while(--_0x5c70c1){_0x41ed31['push'](_0x41ed31['shift']());}};_0x58cddc(++_0x349024);}(_0x36fc,0x150));var _0xc36f=function(_0x52907f,_0x5d988a){_0x52907f=_0x52907f-0x0;var _0x3fdfc1=_0x36fc[_0x52907f];return _0x3fdfc1;};'use strict';var express=require('express');var router=express[_0xc36f('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xc36f('0x1'));router[_0xc36f('0x2')]('/',auth[_0xc36f('0x3')](),controller[_0xc36f('0x4')]);router['get'](_0xc36f('0x5'),auth[_0xc36f('0x3')](),controller[_0xc36f('0x6')]);router[_0xc36f('0x2')](_0xc36f('0x7'),auth[_0xc36f('0x3')](),controller[_0xc36f('0x8')]);router[_0xc36f('0x2')]('/timezones',auth[_0xc36f('0x3')](),controller['getTimezones']);router[_0xc36f('0x2')](_0xc36f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc36f('0x2')](_0xc36f('0xa'),auth[_0xc36f('0x3')](),controller[_0xc36f('0xb')]);router[_0xc36f('0xc')]('/',auth[_0xc36f('0x3')](),controller[_0xc36f('0xd')]);router[_0xc36f('0xc')](_0xc36f('0xe'),auth[_0xc36f('0x3')](),controller['getPreview']);router[_0xc36f('0xc')]('/timezone',auth['isAuthenticated'](),controller[_0xc36f('0xf')]);router[_0xc36f('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xc36f('0x9'),auth['isAuthenticated'](),controller[_0xc36f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index ea4428a..58b1677 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 _0x4ce6=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x4ce6,0x108));var _0x64ce=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x4ce6[_0x519756];return _0x37047e;};'use strict';var moment=require(_0x64ce('0x0'));var Sequelize=require('sequelize');module[_0x64ce('0x1')]={'phone':{'type':Sequelize[_0x64ce('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x64ce('0x3')],'unique':_0x64ce('0x4')},'ListId':{'type':Sequelize[_0x64ce('0x3')],'unique':_0x64ce('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x64ce('0x4')}}; \ No newline at end of file +var _0x35e2=['STRING','INTEGER','contactListQueue','moment','exports'];(function(_0x2475ff,_0x79b368){var _0x3ef26f=function(_0x53bc20){while(--_0x53bc20){_0x2475ff['push'](_0x2475ff['shift']());}};_0x3ef26f(++_0x79b368);}(_0x35e2,0x1ed));var _0x235e=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x35e2[_0x1caf6a];return _0x1bf493;};'use strict';var moment=require(_0x235e('0x0'));var Sequelize=require('sequelize');module[_0x235e('0x1')]={'phone':{'type':Sequelize[_0x235e('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x235e('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x235e('0x3')],'unique':_0x235e('0x4')},'VoiceQueueId':{'type':Sequelize[_0x235e('0x3')],'unique':_0x235e('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 3189dfe..868acf1 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 _0xfffd=['catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','name','index','map','CmHopperBlack','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find'];(function(_0x3baabc,_0x2f0167){var _0x5abbca=function(_0x36e9f6){while(--_0x36e9f6){_0x3baabc['push'](_0x3baabc['shift']());}};_0x5abbca(++_0x2f0167);}(_0xfffd,0xea));var _0xdfff=function(_0x3b9a98,_0x33258c){_0x3b9a98=_0x3b9a98-0x0;var _0x4f9981=_0xfffd[_0x3b9a98];return _0x4f9981;};'use strict';var emlformat=require(_0xdfff('0x0'));var rimraf=require(_0xdfff('0x1'));var zipdir=require(_0xdfff('0x2'));var jsonpatch=require(_0xdfff('0x3'));var rp=require(_0xdfff('0x4'));var moment=require(_0xdfff('0x5'));var BPromise=require(_0xdfff('0x6'));var Mustache=require(_0xdfff('0x7'));var util=require(_0xdfff('0x8'));var path=require(_0xdfff('0x9'));var sox=require(_0xdfff('0xa'));var csv=require(_0xdfff('0xb'));var ejs=require(_0xdfff('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfff('0xd'));var squel=require('squel');var crypto=require(_0xdfff('0xe'));var jsforce=require(_0xdfff('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdfff('0x10'));var Papa=require(_0xdfff('0x11'));var Redis=require(_0xdfff('0x12'));var authService=require(_0xdfff('0x13'));var qs=require(_0xdfff('0x14'));var as=require(_0xdfff('0x15'));var hardwareService=require(_0xdfff('0x16'));var logger=require(_0xdfff('0x17'))('api');var utils=require(_0xdfff('0x18'));var config=require(_0xdfff('0x19'));var licenseUtil=require(_0xdfff('0x1a'));var db=require(_0xdfff('0x1b'))['db'];function respondWithStatusCode(_0x311de5,_0x49995c){_0x49995c=_0x49995c||0xcc;return function(_0x53af91){if(_0x53af91){return _0x311de5[_0xdfff('0x1c')](_0x49995c);}return _0x311de5[_0xdfff('0x1d')](_0x49995c)[_0xdfff('0x1e')]();};}function respondWithResult(_0xcc36c4,_0x414b75){_0x414b75=_0x414b75||0xc8;return function(_0xaa9885){if(_0xaa9885){return _0xcc36c4[_0xdfff('0x1d')](_0x414b75)[_0xdfff('0x1f')](_0xaa9885);}};}function respondWithFilteredResult(_0x28b2ef,_0x4970ed){return function(_0x1a6309){if(_0x1a6309){var _0x143d72=typeof _0x4970ed[_0xdfff('0x20')]===_0xdfff('0x21')&&typeof _0x4970ed['limit']===_0xdfff('0x21');var _0xbcbca9=_0x1a6309[_0xdfff('0x22')];var _0x508aea=_0x143d72?0x0:_0x4970ed[_0xdfff('0x20')];var _0x520ac0=_0x143d72?_0x1a6309[_0xdfff('0x22')]:_0x4970ed[_0xdfff('0x20')]+_0x4970ed['limit'];var _0x23042a;if(_0x520ac0>=_0xbcbca9){_0x520ac0=_0xbcbca9;_0x23042a=0xc8;}else{_0x23042a=0xce;}_0x28b2ef[_0xdfff('0x1d')](_0x23042a);return _0x28b2ef[_0xdfff('0x23')](_0xdfff('0x24'),_0x508aea+'-'+_0x520ac0+'/'+_0xbcbca9)[_0xdfff('0x1f')](_0x1a6309);}return null;};}function patchUpdates(_0x255fd9){return function(_0x1769d1){try{jsonpatch['apply'](_0x1769d1,_0x255fd9,!![]);}catch(_0x563b7a){return BPromise[_0xdfff('0x25')](_0x563b7a);}return _0x1769d1[_0xdfff('0x26')]();};}function saveUpdates(_0x408a5d,_0x7e9101){return function(_0x43cbb9){if(_0x43cbb9){return _0x43cbb9[_0xdfff('0x27')](_0x408a5d)['then'](function(_0x361d4f){return _0x361d4f;});}return null;};}function removeEntity(_0x3afe76,_0x2f7eb6){return function(_0x4ef4de){if(_0x4ef4de){return _0x4ef4de[_0xdfff('0x28')]()[_0xdfff('0x29')](function(){_0x3afe76['status'](0xcc)[_0xdfff('0x1e')]();});}};}function handleEntityNotFound(_0x236578,_0x2140e4){return function(_0x51717d){if(!_0x51717d){_0x236578[_0xdfff('0x1c')](0x194);}return _0x51717d;};}function handleError(_0x402fc2,_0x4e2e0e){_0x4e2e0e=_0x4e2e0e||0x1f4;return function(_0x2bd773){logger[_0xdfff('0x2a')](_0x2bd773['stack']);if(_0x2bd773[_0xdfff('0x2b')]){delete _0x2bd773['name'];}_0x402fc2['status'](_0x4e2e0e)['send'](_0x2bd773);};}exports[_0xdfff('0x2c')]=function(_0x3088e8,_0x56b190){var _0x1909c5={},_0x3bc07e={},_0x1a66e7={'count':0x0,'rows':[]};var _0x23afd0=_[_0xdfff('0x2d')](db[_0xdfff('0x2e')][_0xdfff('0x2f')],function(_0x533d62){return{'name':_0x533d62[_0xdfff('0x30')],'type':_0x533d62[_0xdfff('0x31')]['key']};});_0x3bc07e['model']=_['map'](_0x23afd0,_0xdfff('0x2b'));_0x3bc07e[_0xdfff('0x32')]=_[_0xdfff('0x33')](_0x3088e8[_0xdfff('0x32')]);_0x3bc07e[_0xdfff('0x34')]=_[_0xdfff('0x35')](_0x3bc07e[_0xdfff('0x36')],_0x3bc07e[_0xdfff('0x32')]);_0x1909c5[_0xdfff('0x37')]=_[_0xdfff('0x35')](_0x3bc07e['model'],qs[_0xdfff('0x38')](_0x3088e8['query'][_0xdfff('0x38')]));_0x1909c5[_0xdfff('0x37')]=_0x1909c5[_0xdfff('0x37')][_0xdfff('0x39')]?_0x1909c5[_0xdfff('0x37')]:_0x3bc07e[_0xdfff('0x36')];if(!_0x3088e8['query'][_0xdfff('0x3a')](_0xdfff('0x3b'))){_0x1909c5[_0xdfff('0x3c')]=qs[_0xdfff('0x3c')](_0x3088e8[_0xdfff('0x32')][_0xdfff('0x3c')]);_0x1909c5[_0xdfff('0x20')]=qs['offset'](_0x3088e8[_0xdfff('0x32')]['offset']);}_0x1909c5[_0xdfff('0x3d')]=qs[_0xdfff('0x3e')](_0x3088e8[_0xdfff('0x32')][_0xdfff('0x3e')]);_0x1909c5[_0xdfff('0x3f')]=qs[_0xdfff('0x34')](_[_0xdfff('0x40')](_0x3088e8[_0xdfff('0x32')],_0x3bc07e[_0xdfff('0x34')]),_0x23afd0);if(_0x3088e8[_0xdfff('0x32')]['filter']){_0x1909c5[_0xdfff('0x3f')]=_[_0xdfff('0x41')](_0x1909c5[_0xdfff('0x3f')],{'$or':_[_0xdfff('0x2d')](_0x23afd0,function(_0x32fa1a){if(_0x32fa1a[_0xdfff('0x31')]!==_0xdfff('0x42')){var _0x3c2d55={};_0x3c2d55[_0x32fa1a[_0xdfff('0x2b')]]={'$like':'%'+_0x3088e8['query']['filter']+'%'};return _0x3c2d55;}})});}_0x1909c5=_[_0xdfff('0x41')]({},_0x1909c5,_0x3088e8[_0xdfff('0x43')]);var _0x2f956f={'where':_0x1909c5[_0xdfff('0x3f')]};return db['CmHopperBlack'][_0xdfff('0x22')](_0x2f956f)[_0xdfff('0x29')](function(_0x239391){_0x1a66e7[_0xdfff('0x22')]=_0x239391;if(_0x3088e8[_0xdfff('0x32')][_0xdfff('0x44')]){_0x1909c5[_0xdfff('0x45')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xdfff('0x46')](_0x1909c5);})[_0xdfff('0x29')](function(_0x5cd9f7){_0x1a66e7['rows']=_0x5cd9f7;return _0x1a66e7;})[_0xdfff('0x29')](respondWithFilteredResult(_0x56b190,_0x1909c5))['catch'](handleError(_0x56b190,null));};exports[_0xdfff('0x47')]=function(_0x458a1c,_0x804013){var _0x1bd50e={'raw':!![],'where':{'id':_0x458a1c[_0xdfff('0x48')]['id']}},_0x2947c3={};_0x2947c3['model']=_[_0xdfff('0x33')](db[_0xdfff('0x2e')]['rawAttributes']);_0x2947c3['query']=_[_0xdfff('0x33')](_0x458a1c['query']);_0x2947c3[_0xdfff('0x34')]=_['intersection'](_0x2947c3[_0xdfff('0x36')],_0x2947c3[_0xdfff('0x32')]);_0x1bd50e[_0xdfff('0x37')]=_['intersection'](_0x2947c3[_0xdfff('0x36')],qs[_0xdfff('0x38')](_0x458a1c[_0xdfff('0x32')][_0xdfff('0x38')]));_0x1bd50e['attributes']=_0x1bd50e[_0xdfff('0x37')][_0xdfff('0x39')]?_0x1bd50e[_0xdfff('0x37')]:_0x2947c3[_0xdfff('0x36')];if(_0x458a1c[_0xdfff('0x32')][_0xdfff('0x44')]){_0x1bd50e[_0xdfff('0x45')]=[{'all':!![]}];}_0x1bd50e=_['merge']({},_0x1bd50e,_0x458a1c[_0xdfff('0x43')]);return db[_0xdfff('0x2e')][_0xdfff('0x49')](_0x1bd50e)[_0xdfff('0x29')](handleEntityNotFound(_0x804013,null))['then'](respondWithResult(_0x804013,null))[_0xdfff('0x4a')](handleError(_0x804013,null));};exports['update']=function(_0x5443d7,_0x1fbe6f){if(_0x5443d7[_0xdfff('0x4b')]['id']){delete _0x5443d7[_0xdfff('0x4b')]['id'];}return db[_0xdfff('0x2e')][_0xdfff('0x49')]({'where':{'id':_0x5443d7['params']['id']}})[_0xdfff('0x29')](handleEntityNotFound(_0x1fbe6f,null))[_0xdfff('0x29')](saveUpdates(_0x5443d7[_0xdfff('0x4b')],null))[_0xdfff('0x29')](respondWithResult(_0x1fbe6f,null))['catch'](handleError(_0x1fbe6f,null));};exports[_0xdfff('0x28')]=function(_0x2a432e,_0x197114){return db[_0xdfff('0x2e')][_0xdfff('0x49')]({'where':{'id':_0x2a432e[_0xdfff('0x48')]['id']}})[_0xdfff('0x29')](handleEntityNotFound(_0x197114,null))[_0xdfff('0x29')](removeEntity(_0x197114,null))['catch'](handleError(_0x197114,null));};exports[_0xdfff('0x4c')]=function(_0x23386b,_0x3c4655){return db[_0xdfff('0x2e')][_0xdfff('0x4c')]()['then'](respondWithResult(_0x3c4655,null))[_0xdfff('0x4a')](handleError(_0x3c4655,null));}; \ No newline at end of file +var _0xbf40=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','key','model','map','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','fields','find','catch','body','describe','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x38d8e2,_0x48603c){var _0x5afbee=function(_0x2eca5e){while(--_0x2eca5e){_0x38d8e2['push'](_0x38d8e2['shift']());}};_0x5afbee(++_0x48603c);}(_0xbf40,0x1f4));var _0x0bf4=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xbf40[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0bf4('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0bf4('0x1'));var BPromise=require(_0x0bf4('0x2'));var Mustache=require(_0x0bf4('0x3'));var util=require(_0x0bf4('0x4'));var path=require(_0x0bf4('0x5'));var sox=require(_0x0bf4('0x6'));var csv=require(_0x0bf4('0x7'));var ejs=require(_0x0bf4('0x8'));var fs=require('fs');var fs_extra=require(_0x0bf4('0x9'));var _=require(_0x0bf4('0xa'));var squel=require(_0x0bf4('0xb'));var crypto=require('crypto');var jsforce=require(_0x0bf4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0bf4('0x7'));var querystring=require(_0x0bf4('0xd'));var Papa=require(_0x0bf4('0xe'));var Redis=require(_0x0bf4('0xf'));var authService=require(_0x0bf4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0bf4('0x11'));var hardwareService=require(_0x0bf4('0x12'));var logger=require(_0x0bf4('0x13'))(_0x0bf4('0x14'));var utils=require(_0x0bf4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0bf4('0x16'));var db=require(_0x0bf4('0x17'))['db'];function respondWithStatusCode(_0x219af1,_0x2160a3){_0x2160a3=_0x2160a3||0xcc;return function(_0x2189c9){if(_0x2189c9){return _0x219af1['sendStatus'](_0x2160a3);}return _0x219af1[_0x0bf4('0x18')](_0x2160a3)[_0x0bf4('0x19')]();};}function respondWithResult(_0xbe1443,_0x8f1780){_0x8f1780=_0x8f1780||0xc8;return function(_0x305dca){if(_0x305dca){return _0xbe1443['status'](_0x8f1780)[_0x0bf4('0x1a')](_0x305dca);}};}function respondWithFilteredResult(_0x528397,_0x32e906){return function(_0x35a19c){if(_0x35a19c){var _0x4947e3=typeof _0x32e906[_0x0bf4('0x1b')]===_0x0bf4('0x1c')&&typeof _0x32e906[_0x0bf4('0x1d')]===_0x0bf4('0x1c');var _0x11119a=_0x35a19c['count'];var _0x350730=_0x4947e3?0x0:_0x32e906[_0x0bf4('0x1b')];var _0x17f3f3=_0x4947e3?_0x35a19c[_0x0bf4('0x1e')]:_0x32e906[_0x0bf4('0x1b')]+_0x32e906[_0x0bf4('0x1d')];var _0x296e7f;if(_0x17f3f3>=_0x11119a){_0x17f3f3=_0x11119a;_0x296e7f=0xc8;}else{_0x296e7f=0xce;}_0x528397[_0x0bf4('0x18')](_0x296e7f);return _0x528397[_0x0bf4('0x1f')](_0x0bf4('0x20'),_0x350730+'-'+_0x17f3f3+'/'+_0x11119a)[_0x0bf4('0x1a')](_0x35a19c);}return null;};}function patchUpdates(_0x220da8){return function(_0x34ea26){try{jsonpatch[_0x0bf4('0x21')](_0x34ea26,_0x220da8,!![]);}catch(_0x2984a2){return BPromise[_0x0bf4('0x22')](_0x2984a2);}return _0x34ea26[_0x0bf4('0x23')]();};}function saveUpdates(_0x295db6,_0x4cccf0){return function(_0x35699e){if(_0x35699e){return _0x35699e[_0x0bf4('0x24')](_0x295db6)[_0x0bf4('0x25')](function(_0x162dc3){return _0x162dc3;});}return null;};}function removeEntity(_0x42158e,_0x373764){return function(_0x59378b){if(_0x59378b){return _0x59378b[_0x0bf4('0x26')]()[_0x0bf4('0x25')](function(){_0x42158e[_0x0bf4('0x18')](0xcc)[_0x0bf4('0x19')]();});}};}function handleEntityNotFound(_0x31345a,_0xe908c7){return function(_0x229f87){if(!_0x229f87){_0x31345a[_0x0bf4('0x27')](0x194);}return _0x229f87;};}function handleError(_0x211bac,_0x52cd07){_0x52cd07=_0x52cd07||0x1f4;return function(_0x48dba1){logger[_0x0bf4('0x28')](_0x48dba1[_0x0bf4('0x29')]);if(_0x48dba1['name']){delete _0x48dba1[_0x0bf4('0x2a')];}_0x211bac[_0x0bf4('0x18')](_0x52cd07)[_0x0bf4('0x2b')](_0x48dba1);};}exports[_0x0bf4('0x2c')]=function(_0x31978c,_0x287297){var _0x2101c9={},_0x5e6327={},_0x9bc5e0={'count':0x0,'rows':[]};var _0x591f82=_['map'](db[_0x0bf4('0x2d')][_0x0bf4('0x2e')],function(_0x350b9d){return{'name':_0x350b9d[_0x0bf4('0x2f')],'type':_0x350b9d['type'][_0x0bf4('0x30')]};});_0x5e6327[_0x0bf4('0x31')]=_[_0x0bf4('0x32')](_0x591f82,'name');_0x5e6327[_0x0bf4('0x33')]=_['keys'](_0x31978c[_0x0bf4('0x33')]);_0x5e6327['filters']=_[_0x0bf4('0x34')](_0x5e6327['model'],_0x5e6327[_0x0bf4('0x33')]);_0x2101c9['attributes']=_[_0x0bf4('0x34')](_0x5e6327['model'],qs['fields'](_0x31978c[_0x0bf4('0x33')]['fields']));_0x2101c9['attributes']=_0x2101c9[_0x0bf4('0x35')][_0x0bf4('0x36')]?_0x2101c9['attributes']:_0x5e6327['model'];if(!_0x31978c[_0x0bf4('0x33')][_0x0bf4('0x37')](_0x0bf4('0x38'))){_0x2101c9[_0x0bf4('0x1d')]=qs[_0x0bf4('0x1d')](_0x31978c[_0x0bf4('0x33')][_0x0bf4('0x1d')]);_0x2101c9[_0x0bf4('0x1b')]=qs[_0x0bf4('0x1b')](_0x31978c[_0x0bf4('0x33')]['offset']);}_0x2101c9[_0x0bf4('0x39')]=qs[_0x0bf4('0x3a')](_0x31978c[_0x0bf4('0x33')][_0x0bf4('0x3a')]);_0x2101c9[_0x0bf4('0x3b')]=qs[_0x0bf4('0x3c')](_[_0x0bf4('0x3d')](_0x31978c['query'],_0x5e6327['filters']),_0x591f82);if(_0x31978c[_0x0bf4('0x33')][_0x0bf4('0x3e')]){_0x2101c9[_0x0bf4('0x3b')]=_[_0x0bf4('0x3f')](_0x2101c9[_0x0bf4('0x3b')],{'$or':_['map'](_0x591f82,function(_0x35c7cb){if(_0x35c7cb['type']!==_0x0bf4('0x40')){var _0x44385b={};_0x44385b[_0x35c7cb[_0x0bf4('0x2a')]]={'$like':'%'+_0x31978c[_0x0bf4('0x33')][_0x0bf4('0x3e')]+'%'};return _0x44385b;}})});}_0x2101c9=_[_0x0bf4('0x3f')]({},_0x2101c9,_0x31978c[_0x0bf4('0x41')]);var _0x1da840={'where':_0x2101c9['where']};return db[_0x0bf4('0x2d')][_0x0bf4('0x1e')](_0x1da840)[_0x0bf4('0x25')](function(_0x2b4543){_0x9bc5e0['count']=_0x2b4543;if(_0x31978c[_0x0bf4('0x33')][_0x0bf4('0x42')]){_0x2101c9[_0x0bf4('0x43')]=[{'all':!![]}];}return db[_0x0bf4('0x2d')][_0x0bf4('0x44')](_0x2101c9);})[_0x0bf4('0x25')](function(_0x3b04fe){_0x9bc5e0['rows']=_0x3b04fe;return _0x9bc5e0;})[_0x0bf4('0x25')](respondWithFilteredResult(_0x287297,_0x2101c9))['catch'](handleError(_0x287297,null));};exports['show']=function(_0xae7d39,_0x3a347b){var _0x402304={'raw':!![],'where':{'id':_0xae7d39[_0x0bf4('0x45')]['id']}},_0x54d445={};_0x54d445[_0x0bf4('0x31')]=_[_0x0bf4('0x46')](db[_0x0bf4('0x2d')][_0x0bf4('0x2e')]);_0x54d445[_0x0bf4('0x33')]=_[_0x0bf4('0x46')](_0xae7d39['query']);_0x54d445[_0x0bf4('0x3c')]=_[_0x0bf4('0x34')](_0x54d445[_0x0bf4('0x31')],_0x54d445['query']);_0x402304['attributes']=_[_0x0bf4('0x34')](_0x54d445[_0x0bf4('0x31')],qs[_0x0bf4('0x47')](_0xae7d39[_0x0bf4('0x33')][_0x0bf4('0x47')]));_0x402304['attributes']=_0x402304[_0x0bf4('0x35')][_0x0bf4('0x36')]?_0x402304[_0x0bf4('0x35')]:_0x54d445[_0x0bf4('0x31')];if(_0xae7d39['query']['includeAll']){_0x402304[_0x0bf4('0x43')]=[{'all':!![]}];}_0x402304=_['merge']({},_0x402304,_0xae7d39['options']);return db['CmHopperBlack'][_0x0bf4('0x48')](_0x402304)['then'](handleEntityNotFound(_0x3a347b,null))[_0x0bf4('0x25')](respondWithResult(_0x3a347b,null))[_0x0bf4('0x49')](handleError(_0x3a347b,null));};exports[_0x0bf4('0x24')]=function(_0x292f11,_0x434281){if(_0x292f11[_0x0bf4('0x4a')]['id']){delete _0x292f11[_0x0bf4('0x4a')]['id'];}return db[_0x0bf4('0x2d')][_0x0bf4('0x48')]({'where':{'id':_0x292f11[_0x0bf4('0x45')]['id']}})[_0x0bf4('0x25')](handleEntityNotFound(_0x434281,null))['then'](saveUpdates(_0x292f11[_0x0bf4('0x4a')],null))[_0x0bf4('0x25')](respondWithResult(_0x434281,null))[_0x0bf4('0x49')](handleError(_0x434281,null));};exports['destroy']=function(_0x1fea2e,_0x3faf47){return db[_0x0bf4('0x2d')][_0x0bf4('0x48')]({'where':{'id':_0x1fea2e[_0x0bf4('0x45')]['id']}})[_0x0bf4('0x25')](handleEntityNotFound(_0x3faf47,null))[_0x0bf4('0x25')](removeEntity(_0x3faf47,null))['catch'](handleError(_0x3faf47,null));};exports[_0x0bf4('0x4b')]=function(_0x1b696e,_0x438439){return db[_0x0bf4('0x2d')][_0x0bf4('0x4b')]()[_0x0bf4('0x25')](respondWithResult(_0x438439,null))[_0x0bf4('0x49')](handleError(_0x438439,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 6b32719..eea8d5a 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 _0xd101=['./cmHopperBlack.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x49773b,_0x887163){var _0x5212ba=function(_0x47e78c){while(--_0x47e78c){_0x49773b['push'](_0x49773b['shift']());}};_0x5212ba(++_0x887163);}(_0xd101,0x193));var _0x1d10=function(_0x19d5f0,_0x14f4aa){_0x19d5f0=_0x19d5f0-0x0;var _0x475668=_0xd101[_0x19d5f0];return _0x475668;};'use strict';var _=require(_0x1d10('0x0'));var util=require(_0x1d10('0x1'));var logger=require(_0x1d10('0x2'))(_0x1d10('0x3'));var moment=require('moment');var BPromise=require(_0x1d10('0x4'));var rp=require(_0x1d10('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d10('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d10('0x7'));module[_0x1d10('0x8')]=function(_0x13cd67,_0x1364c2){return _0x13cd67[_0x1d10('0x9')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07db=['moment','bluebird','request-promise','path','../../config/environment','exports','define','cm_hopper_black','lodash','util','../../config/logger'];(function(_0x45d573,_0x3b14a0){var _0x145490=function(_0xd66e6c){while(--_0xd66e6c){_0x45d573['push'](_0x45d573['shift']());}};_0x145490(++_0x3b14a0);}(_0x07db,0x1cb));var _0xb07d=function(_0x187c30,_0x238119){_0x187c30=_0x187c30-0x0;var _0x391824=_0x07db[_0x187c30];return _0x391824;};'use strict';var _=require(_0xb07d('0x0'));var util=require(_0xb07d('0x1'));var logger=require(_0xb07d('0x2'))('api');var moment=require(_0xb07d('0x3'));var BPromise=require(_0xb07d('0x4'));var rp=require(_0xb07d('0x5'));var fs=require('fs');var path=require(_0xb07d('0x6'));var rimraf=require('rimraf');var config=require(_0xb07d('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0xb07d('0x8')]=function(_0x2ab605,_0x59f7b8){return _0x2ab605[_0xb07d('0x9')]('CmHopperBlack',attributes,{'tableName':_0xb07d('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 423cf39..b9fa657 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 _0x1d79=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','debug','GetCmHopperBlack','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring'];(function(_0x2ec70c,_0x2b24d0){var _0x17e925=function(_0x21772c){while(--_0x21772c){_0x2ec70c['push'](_0x2ec70c['shift']());}};_0x17e925(++_0x2b24d0);}(_0x1d79,0x124));var _0x91d7=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x1d79[_0xbd08b4];return _0x314f1e;};'use strict';var _=require('lodash');var util=require(_0x91d7('0x0'));var moment=require(_0x91d7('0x1'));var BPromise=require(_0x91d7('0x2'));var rs=require(_0x91d7('0x3'));var fs=require('fs');var Redis=require(_0x91d7('0x4'));var db=require(_0x91d7('0x5'))['db'];var utils=require(_0x91d7('0x6'));var logger=require('../../config/logger')(_0x91d7('0x7'));var config=require(_0x91d7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x91d7('0x9')][_0x91d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1daab9,_0x55c9dc,_0x57d67b){return new BPromise(function(_0x629a61,_0x2627a3){return client['request'](_0x1daab9,_0x57d67b)[_0x91d7('0xb')](function(_0x336c1d){logger[_0x91d7('0xc')](_0x91d7('0xd'),_0x55c9dc,_0x91d7('0xe'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x55c9dc,_0x91d7('0xe'),JSON[_0x91d7('0xf')](_0x336c1d));if(_0x336c1d[_0x91d7('0x10')]){if(_0x336c1d[_0x91d7('0x10')][_0x91d7('0x11')]===0x1f4){logger['error'](_0x91d7('0xd'),_0x55c9dc,_0x336c1d[_0x91d7('0x10')]['message']);return _0x2627a3(_0x336c1d[_0x91d7('0x10')]['message']);}logger[_0x91d7('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x55c9dc,_0x336c1d[_0x91d7('0x10')]['message']);return _0x629a61(_0x336c1d['error'][_0x91d7('0x12')]);}else{logger['info'](_0x91d7('0xd'),_0x55c9dc,_0x91d7('0xe'));_0x629a61(_0x336c1d['result'][_0x91d7('0x12')]);}})[_0x91d7('0x13')](function(_0x4e237a){logger[_0x91d7('0x10')](_0x91d7('0xd'),_0x55c9dc,_0x4e237a);_0x2627a3(_0x4e237a);});});}exports['GetCmHopperBlack']=function(_0x523a24){var _0x5b46af=this;return new Promise(function(_0x245f11,_0x1840e8){return db[_0x91d7('0x14')][_0x91d7('0x15')]({'raw':_0x523a24[_0x91d7('0x16')]?_0x523a24[_0x91d7('0x16')][_0x91d7('0x17')]===undefined?!![]:![]:!![],'where':_0x523a24[_0x91d7('0x16')]?_0x523a24[_0x91d7('0x16')][_0x91d7('0x18')]||null:null,'attributes':_0x523a24[_0x91d7('0x16')]?_0x523a24[_0x91d7('0x16')][_0x91d7('0x19')]||null:null,'limit':_0x523a24[_0x91d7('0x16')]?_0x523a24[_0x91d7('0x16')][_0x91d7('0x1a')]||null:null,'include':_0x523a24[_0x91d7('0x16')]?_0x523a24[_0x91d7('0x16')][_0x91d7('0x1b')]?_[_0x91d7('0x1c')](_0x523a24['options'][_0x91d7('0x1b')],function(_0x4b9c19){return{'model':db[_0x4b9c19['model']],'as':_0x4b9c19['as'],'attributes':_0x4b9c19[_0x91d7('0x19')],'include':_0x4b9c19[_0x91d7('0x1b')]?_[_0x91d7('0x1c')](_0x4b9c19[_0x91d7('0x1b')],function(_0x1e0dbe){return{'model':db[_0x1e0dbe[_0x91d7('0x1d')]],'as':_0x1e0dbe['as'],'attributes':_0x1e0dbe[_0x91d7('0x19')],'include':_0x1e0dbe[_0x91d7('0x1b')]?_[_0x91d7('0x1c')](_0x1e0dbe[_0x91d7('0x1b')],function(_0x22f706){return{'model':db[_0x22f706['model']],'as':_0x22f706['as'],'attributes':_0x22f706['attributes']};}):[]};}):[]};}):[]:[]})[_0x91d7('0xb')](function(_0x2d0528){logger[_0x91d7('0xc')]('GetCmHopperBlack',_0x523a24);logger[_0x91d7('0x1e')]('GetCmHopperBlack',_0x523a24,JSON[_0x91d7('0xf')](_0x2d0528));_0x245f11(_0x2d0528);})[_0x91d7('0x13')](function(_0x4af229){logger[_0x91d7('0x10')](_0x91d7('0x1f'),_0x4af229[_0x91d7('0x12')],_0x523a24);_0x1840e8(_0x5b46af['error'](0x1f4,_0x4af229[_0x91d7('0x12')]));});});};exports[_0x91d7('0x20')]=function(_0x3105ec){var _0x3558c6=this;return new Promise(function(_0x52f84a,_0x12560b){return db[_0x91d7('0x14')][_0x91d7('0x21')](_0x3105ec[_0x91d7('0x22')],{'raw':_0x3105ec[_0x91d7('0x16')]?_0x3105ec['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3105ec['options']?_0x3105ec[_0x91d7('0x16')][_0x91d7('0x18')]||null:null,'attributes':_0x3105ec[_0x91d7('0x16')]?_0x3105ec['options'][_0x91d7('0x19')]||null:null,'limit':_0x3105ec['options']?_0x3105ec[_0x91d7('0x16')]['limit']||null:null})[_0x91d7('0xb')](function(_0x203989){logger[_0x91d7('0xc')](_0x91d7('0x20'),_0x3105ec);logger[_0x91d7('0x1e')]('UpdateCmHopperBlack',_0x3105ec,JSON[_0x91d7('0xf')](_0x203989));_0x52f84a(_0x203989);})[_0x91d7('0x13')](function(_0x343798){logger['error'](_0x91d7('0x20'),_0x343798[_0x91d7('0x12')],_0x3105ec);_0x12560b(_0x3558c6[_0x91d7('0x10')](0x1f4,_0x343798['message']));});});};exports[_0x91d7('0x23')]=function(_0x1e78c6){var _0x283e25=this;return new Promise(function(_0x36fe03,_0x2948ad){return db[_0x91d7('0x14')][_0x91d7('0x24')]({'where':_0x1e78c6[_0x91d7('0x16')]?_0x1e78c6[_0x91d7('0x16')][_0x91d7('0x18')]||null:null})['then'](function(_0x51131a){logger[_0x91d7('0xc')](_0x91d7('0x23'),_0x1e78c6);logger['debug'](_0x91d7('0x23'),_0x1e78c6,JSON[_0x91d7('0xf')](_0x51131a));_0x36fe03(_0x51131a);})[_0x91d7('0x13')](function(_0x3cfa64){logger[_0x91d7('0x10')](_0x91d7('0x23'),_0x3cfa64['message'],_0x1e78c6);_0x2948ad(_0x283e25['error'](0x1f4,_0x3cfa64[_0x91d7('0x12')]));});});}; \ No newline at end of file +var _0xf5f3=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','GetCmHopperBlack','options','where','attributes','map','include','model','stringify','UpdateCmHopperBlack','CmHopperBlack','update','body','raw','limit','destroy','DestroyCmHopperBlack','lodash','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5f3,0x115));var _0x3f5f=function(_0x2ade1c,_0x193e30){_0x2ade1c=_0x2ade1c-0x0;var _0x3ccbfa=_0xf5f3[_0x2ade1c];return _0x3ccbfa;};'use strict';var _=require(_0x3f5f('0x0'));var util=require('util');var moment=require(_0x3f5f('0x1'));var BPromise=require(_0x3f5f('0x2'));var rs=require(_0x3f5f('0x3'));var fs=require('fs');var Redis=require(_0x3f5f('0x4'));var db=require(_0x3f5f('0x5'))['db'];var utils=require(_0x3f5f('0x6'));var logger=require(_0x3f5f('0x7'))(_0x3f5f('0x8'));var config=require(_0x3f5f('0x9'));var jayson=require(_0x3f5f('0xa'));var client=jayson[_0x3f5f('0xb')][_0x3f5f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a7a2d,_0x5953f0,_0x5823f5){return new BPromise(function(_0x3749c3,_0x190483){return client['request'](_0x5a7a2d,_0x5823f5)[_0x3f5f('0xd')](function(_0x42aed7){logger['info'](_0x3f5f('0xe'),_0x5953f0,'request\x20sent');logger[_0x3f5f('0xf')](_0x3f5f('0x10'),_0x5953f0,'request\x20sent',JSON['stringify'](_0x42aed7));if(_0x42aed7[_0x3f5f('0x11')]){if(_0x42aed7[_0x3f5f('0x11')][_0x3f5f('0x12')]===0x1f4){logger[_0x3f5f('0x11')](_0x3f5f('0xe'),_0x5953f0,_0x42aed7['error']['message']);return _0x190483(_0x42aed7['error']['message']);}logger['error'](_0x3f5f('0xe'),_0x5953f0,_0x42aed7[_0x3f5f('0x11')][_0x3f5f('0x13')]);return _0x3749c3(_0x42aed7[_0x3f5f('0x11')][_0x3f5f('0x13')]);}else{logger[_0x3f5f('0x14')](_0x3f5f('0xe'),_0x5953f0,_0x3f5f('0x15'));_0x3749c3(_0x42aed7[_0x3f5f('0x16')][_0x3f5f('0x13')]);}})[_0x3f5f('0x17')](function(_0xb9c9ad){logger[_0x3f5f('0x11')](_0x3f5f('0xe'),_0x5953f0,_0xb9c9ad);_0x190483(_0xb9c9ad);});});}exports[_0x3f5f('0x18')]=function(_0x3c071f){var _0xd336a9=this;return new Promise(function(_0x2e39e4,_0x2e36fb){return db['CmHopperBlack']['findAll']({'raw':_0x3c071f[_0x3f5f('0x19')]?_0x3c071f['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c071f[_0x3f5f('0x19')]?_0x3c071f[_0x3f5f('0x19')][_0x3f5f('0x1a')]||null:null,'attributes':_0x3c071f['options']?_0x3c071f[_0x3f5f('0x19')][_0x3f5f('0x1b')]||null:null,'limit':_0x3c071f[_0x3f5f('0x19')]?_0x3c071f['options']['limit']||null:null,'include':_0x3c071f['options']?_0x3c071f['options']['include']?_[_0x3f5f('0x1c')](_0x3c071f[_0x3f5f('0x19')][_0x3f5f('0x1d')],function(_0x310fa1){return{'model':db[_0x310fa1[_0x3f5f('0x1e')]],'as':_0x310fa1['as'],'attributes':_0x310fa1[_0x3f5f('0x1b')],'include':_0x310fa1[_0x3f5f('0x1d')]?_['map'](_0x310fa1[_0x3f5f('0x1d')],function(_0x2fd9e2){return{'model':db[_0x2fd9e2[_0x3f5f('0x1e')]],'as':_0x2fd9e2['as'],'attributes':_0x2fd9e2[_0x3f5f('0x1b')],'include':_0x2fd9e2[_0x3f5f('0x1d')]?_['map'](_0x2fd9e2[_0x3f5f('0x1d')],function(_0x42bc6a){return{'model':db[_0x42bc6a[_0x3f5f('0x1e')]],'as':_0x42bc6a['as'],'attributes':_0x42bc6a[_0x3f5f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3f5f('0xd')](function(_0x4dd41f){logger[_0x3f5f('0x14')](_0x3f5f('0x18'),_0x3c071f);logger[_0x3f5f('0xf')](_0x3f5f('0x18'),_0x3c071f,JSON[_0x3f5f('0x1f')](_0x4dd41f));_0x2e39e4(_0x4dd41f);})['catch'](function(_0x29586a){logger[_0x3f5f('0x11')](_0x3f5f('0x18'),_0x29586a['message'],_0x3c071f);_0x2e36fb(_0xd336a9[_0x3f5f('0x11')](0x1f4,_0x29586a[_0x3f5f('0x13')]));});});};exports[_0x3f5f('0x20')]=function(_0x40574b){var _0x1d3e13=this;return new Promise(function(_0x1d4815,_0x191708){return db[_0x3f5f('0x21')][_0x3f5f('0x22')](_0x40574b[_0x3f5f('0x23')],{'raw':_0x40574b[_0x3f5f('0x19')]?_0x40574b[_0x3f5f('0x19')][_0x3f5f('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40574b[_0x3f5f('0x19')]?_0x40574b[_0x3f5f('0x19')][_0x3f5f('0x1a')]||null:null,'attributes':_0x40574b[_0x3f5f('0x19')]?_0x40574b[_0x3f5f('0x19')][_0x3f5f('0x1b')]||null:null,'limit':_0x40574b[_0x3f5f('0x19')]?_0x40574b[_0x3f5f('0x19')][_0x3f5f('0x25')]||null:null})[_0x3f5f('0xd')](function(_0x252f1b){logger[_0x3f5f('0x14')](_0x3f5f('0x20'),_0x40574b);logger[_0x3f5f('0xf')](_0x3f5f('0x20'),_0x40574b,JSON[_0x3f5f('0x1f')](_0x252f1b));_0x1d4815(_0x252f1b);})[_0x3f5f('0x17')](function(_0x39b835){logger[_0x3f5f('0x11')](_0x3f5f('0x20'),_0x39b835[_0x3f5f('0x13')],_0x40574b);_0x191708(_0x1d3e13[_0x3f5f('0x11')](0x1f4,_0x39b835[_0x3f5f('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x34b7f5){var _0x51bf9e=this;return new Promise(function(_0x23b035,_0x48918a){return db[_0x3f5f('0x21')][_0x3f5f('0x26')]({'where':_0x34b7f5['options']?_0x34b7f5[_0x3f5f('0x19')]['where']||null:null})['then'](function(_0x37ba9c){logger[_0x3f5f('0x14')](_0x3f5f('0x27'),_0x34b7f5);logger[_0x3f5f('0xf')](_0x3f5f('0x27'),_0x34b7f5,JSON[_0x3f5f('0x1f')](_0x37ba9c));_0x23b035(_0x37ba9c);})[_0x3f5f('0x17')](function(_0x42cdb5){logger['error'](_0x3f5f('0x27'),_0x42cdb5[_0x3f5f('0x13')],_0x34b7f5);_0x48918a(_0x51bf9e[_0x3f5f('0x11')](0x1f4,_0x42cdb5[_0x3f5f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index f94a821..1057c1d 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 _0x01d9=['update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var fs_extra=require(_0x901d('0x5'));var auth=require(_0x901d('0x6'));var interaction=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var controller=require(_0x901d('0x9'));router[_0x901d('0xa')]('/',auth['isAuthenticated'](),controller[_0x901d('0xb')]);router[_0x901d('0xa')](_0x901d('0xc'),auth[_0x901d('0xd')](),controller[_0x901d('0xe')]);router[_0x901d('0xa')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x10')]);router[_0x901d('0x11')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x12')]);router['delete'](_0x901d('0xf'),auth['isAuthenticated'](),controller[_0x901d('0x13')]);module[_0x901d('0x14')]=router; \ No newline at end of file +var _0x11e5=['update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','put'];(function(_0x54aca6,_0x13161b){var _0x1a7a46=function(_0x32f83c){while(--_0x32f83c){_0x54aca6['push'](_0x54aca6['shift']());}};_0x1a7a46(++_0x13161b);}(_0x11e5,0x8b));var _0x511e=function(_0x14a6cf,_0x27e1cb){_0x14a6cf=_0x14a6cf-0x0;var _0x66d8e7=_0x11e5[_0x14a6cf];return _0x66d8e7;};'use strict';var multer=require(_0x511e('0x0'));var util=require('util');var path=require(_0x511e('0x1'));var timeout=require(_0x511e('0x2'));var express=require('express');var router=express[_0x511e('0x3')]();var fs_extra=require(_0x511e('0x4'));var auth=require(_0x511e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x511e('0x6'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth[_0x511e('0x7')](),controller[_0x511e('0x8')]);router[_0x511e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x511e('0xa')]);router[_0x511e('0x9')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xc')]);router[_0x511e('0xd')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xe')]);router[_0x511e('0xf')](_0x511e('0xb'),auth['isAuthenticated'](),controller[_0x511e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index a1e174f..1645c24 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 _0x9845=['followuptime','diff','seconds','BOOLEAN','sequelize','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue'];(function(_0x454a26,_0x2a48e1){var _0x2c27cf=function(_0x21ff63){while(--_0x21ff63){_0x454a26['push'](_0x454a26['shift']());}};_0x2c27cf(++_0x2a48e1);}(_0x9845,0x10c));var _0x5984=function(_0x28f632,_0x19c6b5){_0x28f632=_0x28f632-0x0;var _0x1bbfa2=_0x9845[_0x28f632];return _0x1bbfa2;};'use strict';var Sequelize=require(_0x5984('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0x5984('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x5984('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x5984('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5984('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5984('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5984('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5984('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x5984('0x2')]},'calleridnum':{'type':Sequelize[_0x5984('0x2')]},'calleridname':{'type':Sequelize[_0x5984('0x2')]},'starttime':{'type':Sequelize[_0x5984('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x5984('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x5984('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5984('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5984('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5984('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5984('0x2')]},'campaign':{'type':Sequelize[_0x5984('0x2')]},'campaigntype':{'type':Sequelize[_0x5984('0x2')]},'membername':{'type':Sequelize[_0x5984('0x2')]},'reason':{'type':Sequelize[_0x5984('0x2')]},'disposition':{'type':Sequelize[_0x5984('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5984('0x2')]},'dispositionat':{'type':Sequelize[_0x5984('0x3')],'set':function(_0x32d44e){var _0x3e3b76=this[_0x5984('0x4')](_0x5984('0x5'));if(_0x3e3b76&&_0x32d44e){this[_0x5984('0x6')](_0x5984('0x7'),moment(_0x32d44e)[_0x5984('0x8')](moment(_0x3e3b76),_0x5984('0x9')));}return this[_0x5984('0x6')]('dispositionat',_0x32d44e);}},'amd':{'type':Sequelize[_0x5984('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5984('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x5984('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5984('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5984('0x3')]},'callback':{'type':Sequelize[_0x5984('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5984('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x5984('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x5984('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x5984('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5984('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5984('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe417=['exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0xe417,0xcf));var _0x7e41=function(_0x434783,_0xff395d){_0x434783=_0x434783-0x0;var _0x13efcf=_0xe417[_0x434783];return _0x13efcf;};'use strict';var Sequelize=require(_0x7e41('0x0'));var moment=require('moment');module[_0x7e41('0x1')]={'state':{'type':Sequelize[_0x7e41('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7e41('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7e41('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7e41('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7e41('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x7e41('0x3')]},'originatecalleridname':{'type':Sequelize[_0x7e41('0x3')]},'calleridnum':{'type':Sequelize[_0x7e41('0x3')]},'calleridname':{'type':Sequelize[_0x7e41('0x3')]},'starttime':{'type':Sequelize[_0x7e41('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x7e41('0x4')]},'droptime':{'type':Sequelize[_0x7e41('0x4')]},'endtime':{'type':Sequelize[_0x7e41('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7e41('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7e41('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7e41('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7e41('0x3')]},'campaign':{'type':Sequelize[_0x7e41('0x3')]},'campaigntype':{'type':Sequelize[_0x7e41('0x3')]},'membername':{'type':Sequelize[_0x7e41('0x3')]},'reason':{'type':Sequelize[_0x7e41('0x3')]},'disposition':{'type':Sequelize[_0x7e41('0x3')]},'secondDisposition':{'type':Sequelize[_0x7e41('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x7e41('0x4')],'set':function(_0x38e527){var _0x5cd6cf=this[_0x7e41('0x5')](_0x7e41('0x6'));if(_0x5cd6cf&&_0x38e527){this[_0x7e41('0x7')](_0x7e41('0x8'),moment(_0x38e527)[_0x7e41('0x9')](moment(_0x5cd6cf),_0x7e41('0xa')));}return this['setDataValue'](_0x7e41('0xb'),_0x38e527);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x7e41('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x7e41('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x7e41('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7e41('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7e41('0x4')]},'deleted':{'type':Sequelize[_0x7e41('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x7e41('0x4')]},'recallme':{'type':Sequelize[_0x7e41('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x7e41('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x7e41('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7e41('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7e41('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7e41('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7e41('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 5c7eaba..e99870d 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 _0x71ab=['json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','CmHopperFinal','findAll','rows','catch','show','params','rawAttributes','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','dropContacts','VoiceQueue','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','state','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x4cdb48,_0x2aac5a){var _0x310d49=function(_0x229f5a){while(--_0x229f5a){_0x4cdb48['push'](_0x4cdb48['shift']());}};_0x310d49(++_0x2aac5a);}(_0x71ab,0x64));var _0xb71a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x71ab[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb71a('0x1'));var rp=require('request-promise');var moment=require(_0xb71a('0x2'));var BPromise=require(_0xb71a('0x3'));var Mustache=require(_0xb71a('0x4'));var util=require(_0xb71a('0x5'));var path=require(_0xb71a('0x6'));var sox=require(_0xb71a('0x7'));var csv=require(_0xb71a('0x8'));var ejs=require(_0xb71a('0x9'));var fs=require('fs');var fs_extra=require(_0xb71a('0xa'));var _=require(_0xb71a('0xb'));var squel=require(_0xb71a('0xc'));var crypto=require(_0xb71a('0xd'));var jsforce=require(_0xb71a('0xe'));var deskjs=require(_0xb71a('0xf'));var toCsv=require(_0xb71a('0x8'));var querystring=require(_0xb71a('0x10'));var Papa=require(_0xb71a('0x11'));var Redis=require(_0xb71a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb71a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71a('0x14'));var logger=require(_0xb71a('0x15'))(_0xb71a('0x16'));var utils=require('../../config/utils');var config=require(_0xb71a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb71a('0x18'))['db'];function respondWithStatusCode(_0x50030d,_0x50b43b){_0x50b43b=_0x50b43b||0xcc;return function(_0x3346a5){if(_0x3346a5){return _0x50030d[_0xb71a('0x19')](_0x50b43b);}return _0x50030d[_0xb71a('0x1a')](_0x50b43b)[_0xb71a('0x1b')]();};}function respondWithResult(_0x483d77,_0x47ee48){_0x47ee48=_0x47ee48||0xc8;return function(_0x5364e3){if(_0x5364e3){return _0x483d77[_0xb71a('0x1a')](_0x47ee48)[_0xb71a('0x1c')](_0x5364e3);}};}function respondWithFilteredResult(_0x15252a,_0x42fc55){return function(_0x3cd0f0){if(_0x3cd0f0){var _0x1e9363=typeof _0x42fc55[_0xb71a('0x1d')]===_0xb71a('0x1e')&&typeof _0x42fc55[_0xb71a('0x1f')]==='undefined';var _0x1ca65e=_0x3cd0f0[_0xb71a('0x20')];var _0x374c8c=_0x1e9363?0x0:_0x42fc55[_0xb71a('0x1d')];var _0x2bdb61=_0x1e9363?_0x3cd0f0[_0xb71a('0x20')]:_0x42fc55[_0xb71a('0x1d')]+_0x42fc55[_0xb71a('0x1f')];var _0x20bdfe;if(_0x2bdb61>=_0x1ca65e){_0x2bdb61=_0x1ca65e;_0x20bdfe=0xc8;}else{_0x20bdfe=0xce;}_0x15252a[_0xb71a('0x1a')](_0x20bdfe);return _0x15252a[_0xb71a('0x21')]('Content-Range',_0x374c8c+'-'+_0x2bdb61+'/'+_0x1ca65e)['json'](_0x3cd0f0);}return null;};}function patchUpdates(_0x1358f2){return function(_0x578fe4){try{jsonpatch['apply'](_0x578fe4,_0x1358f2,!![]);}catch(_0x4d8871){return BPromise[_0xb71a('0x22')](_0x4d8871);}return _0x578fe4['save']();};}function saveUpdates(_0x76d6dc,_0x4227c7){return function(_0x3ac77b){if(_0x3ac77b){return _0x3ac77b[_0xb71a('0x23')](_0x76d6dc)[_0xb71a('0x24')](function(_0x14b2a1){return _0x14b2a1;});}return null;};}function removeEntity(_0x2f4fac,_0x14aac7){return function(_0x5f3f19){if(_0x5f3f19){return _0x5f3f19[_0xb71a('0x25')]()[_0xb71a('0x24')](function(){_0x2f4fac[_0xb71a('0x1a')](0xcc)[_0xb71a('0x1b')]();});}};}function handleEntityNotFound(_0x3401f7,_0x1a010d){return function(_0x20ed75){if(!_0x20ed75){_0x3401f7[_0xb71a('0x19')](0x194);}return _0x20ed75;};}function handleError(_0x31085b,_0x2a847a){_0x2a847a=_0x2a847a||0x1f4;return function(_0x45b849){logger[_0xb71a('0x26')](_0x45b849[_0xb71a('0x27')]);if(_0x45b849['name']){delete _0x45b849[_0xb71a('0x28')];}_0x31085b[_0xb71a('0x1a')](_0x2a847a)[_0xb71a('0x29')](_0x45b849);};}exports[_0xb71a('0x2a')]=function(_0x2fbd73,_0x38178c){var _0x44826e={},_0x25364c={},_0x42c086={'count':0x0,'rows':[]};var _0x421fcf=_[_0xb71a('0x2b')](db['CmHopperFinal']['rawAttributes'],function(_0x3112d3){return{'name':_0x3112d3['fieldName'],'type':_0x3112d3[_0xb71a('0x2c')][_0xb71a('0x2d')]};});_0x25364c['model']=_[_0xb71a('0x2b')](_0x421fcf,_0xb71a('0x28'));_0x25364c[_0xb71a('0x2e')]=_[_0xb71a('0x2f')](_0x2fbd73[_0xb71a('0x2e')]);_0x25364c[_0xb71a('0x30')]=_['intersection'](_0x25364c[_0xb71a('0x31')],_0x25364c[_0xb71a('0x2e')]);_0x44826e[_0xb71a('0x32')]=_[_0xb71a('0x33')](_0x25364c['model'],qs[_0xb71a('0x34')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x34')]));_0x44826e[_0xb71a('0x32')]=_0x44826e[_0xb71a('0x32')][_0xb71a('0x35')]?_0x44826e[_0xb71a('0x32')]:_0x25364c[_0xb71a('0x31')];if(!_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x36')]('nolimit')){_0x44826e['limit']=qs[_0xb71a('0x1f')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1f')]);_0x44826e[_0xb71a('0x1d')]=qs[_0xb71a('0x1d')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1d')]);}_0x44826e['order']=qs[_0xb71a('0x37')](_0x2fbd73['query'][_0xb71a('0x37')]);_0x44826e[_0xb71a('0x38')]=qs[_0xb71a('0x30')](_[_0xb71a('0x39')](_0x2fbd73['query'],_0x25364c[_0xb71a('0x30')]),_0x421fcf);if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]){_0x44826e[_0xb71a('0x38')]=_[_0xb71a('0x3b')](_0x44826e[_0xb71a('0x38')],{'$or':_[_0xb71a('0x2b')](_0x421fcf,function(_0x2756b9){if(_0x2756b9[_0xb71a('0x2c')]!=='VIRTUAL'){var _0x24a3af={};_0x24a3af[_0x2756b9['name']]={'$like':'%'+_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]+'%'};return _0x24a3af;}})});}_0x44826e=_[_0xb71a('0x3b')]({},_0x44826e,_0x2fbd73[_0xb71a('0x3c')]);var _0xce7b8a={'where':_0x44826e[_0xb71a('0x38')]};return db['CmHopperFinal']['count'](_0xce7b8a)['then'](function(_0x35fea9){_0x42c086['count']=_0x35fea9;if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x44826e[_0xb71a('0x3e')]=[{'all':!![]}];}return db[_0xb71a('0x3f')][_0xb71a('0x40')](_0x44826e);})[_0xb71a('0x24')](function(_0x59530a){_0x42c086[_0xb71a('0x41')]=_0x59530a;return _0x42c086;})[_0xb71a('0x24')](respondWithFilteredResult(_0x38178c,_0x44826e))[_0xb71a('0x42')](handleError(_0x38178c,null));};exports[_0xb71a('0x43')]=function(_0x7d305,_0x2f08d2){var _0x55cbca={'raw':!![],'where':{'id':_0x7d305[_0xb71a('0x44')]['id']}},_0x2afff3={};_0x2afff3[_0xb71a('0x31')]=_[_0xb71a('0x2f')](db[_0xb71a('0x3f')][_0xb71a('0x45')]);_0x2afff3[_0xb71a('0x2e')]=_['keys'](_0x7d305['query']);_0x2afff3[_0xb71a('0x30')]=_[_0xb71a('0x33')](_0x2afff3[_0xb71a('0x31')],_0x2afff3[_0xb71a('0x2e')]);_0x55cbca['attributes']=_[_0xb71a('0x33')](_0x2afff3['model'],qs[_0xb71a('0x34')](_0x7d305[_0xb71a('0x2e')]['fields']));_0x55cbca[_0xb71a('0x32')]=_0x55cbca[_0xb71a('0x32')][_0xb71a('0x35')]?_0x55cbca[_0xb71a('0x32')]:_0x2afff3['model'];if(_0x7d305[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x55cbca[_0xb71a('0x3e')]=[{'all':!![]}];}_0x55cbca=_['merge']({},_0x55cbca,_0x7d305[_0xb71a('0x3c')]);return db[_0xb71a('0x3f')][_0xb71a('0x46')](_0x55cbca)['then'](handleEntityNotFound(_0x2f08d2,null))[_0xb71a('0x24')](respondWithResult(_0x2f08d2,null))[_0xb71a('0x42')](handleError(_0x2f08d2,null));};exports[_0xb71a('0x47')]=function(_0x1f29b7,_0x365bed){return db['CmHopperFinal'][_0xb71a('0x47')]()[_0xb71a('0x24')](respondWithResult(_0x365bed,null))[_0xb71a('0x42')](handleError(_0x365bed,null));};exports[_0xb71a('0x23')]=function(_0x489c1f,_0x48fbde){if(_0x489c1f[_0xb71a('0x48')][_0xb71a('0x49')]){delete _0x489c1f[_0xb71a('0x48')][_0xb71a('0x49')];}return db[_0xb71a('0x3f')][_0xb71a('0x46')]({'where':{'uniqueid':_0x489c1f[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x48fbde,null))[_0xb71a('0x24')](saveUpdates(_0x489c1f[_0xb71a('0x48')],null))['then'](respondWithResult(_0x48fbde,null))[_0xb71a('0x42')](handleError(_0x48fbde,null));};exports[_0xb71a('0x4a')]=function(_0x500196,_0x1c0536,_0x58116c){return db[_0xb71a('0x3f')][_0xb71a('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x500196[_0xb71a('0x44')]['id']},'attributes':[[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x4d')))),_0xb71a('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xb71a('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x50')))),_0xb71a('0x51')],[db['sequelize']['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x52')))),_0xb71a('0x53')],[db['sequelize']['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x54')))),'dropContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x55')))),_0xb71a('0x56')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x57')))),_0xb71a('0x58')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x59')))),_0xb71a('0x5a')]]})['then'](handleEntityNotFound(_0x1c0536,null))[_0xb71a('0x24')](respondWithResult(_0x1c0536,null))[_0xb71a('0x42')](handleError(_0x1c0536,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x181a9f,_0xe55672,_0x38de3a){return db[_0xb71a('0x3f')]['findAll']({'raw':![],'where':{'CampaignId':_0x181a9f[_0xb71a('0x44')]['id']},'attributes':[[db[_0xb71a('0x4b')]['fn']('COUNT',db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x4d')))),_0xb71a('0x4e')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x5b')))),'noAnswerContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x50')))),_0xb71a('0x51')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x52')))),_0xb71a('0x53')],[db['sequelize']['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb71a('0x5c')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x55')))),'abandonedContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x57')))),_0xb71a('0x58')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x59')))),_0xb71a('0x5a')]]})[_0xb71a('0x24')](handleEntityNotFound(_0xe55672,null))[_0xb71a('0x24')](respondWithResult(_0xe55672,null))['catch'](handleError(_0xe55672,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x15b8be,_0x2dd470,_0x38a8a1){return db[_0xb71a('0x5d')][_0xb71a('0x46')]({'where':{'id':_0x15b8be[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x2dd470,null))['then'](function(_0x45f4b2){var _0x27c15e;if(_0x45f4b2){_0x27c15e=squel['insert']()[_0xb71a('0x5e')](_0xb71a('0x5f'))[_0xb71a('0x60')](['phone',_0xb71a('0x61'),_0xb71a('0x62'),_0xb71a('0x63'),'VoiceQueueId',_0xb71a('0x64'),_0xb71a('0x65')],squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x68'),_0xb71a('0x69'))[_0xb71a('0x67')](_0xb71a('0x6a'),'scheduledAt')[_0xb71a('0x67')](_0xb71a('0x6b'),_0xb71a('0x62'))[_0xb71a('0x67')](_0xb71a('0x6c'),_0xb71a('0x63'))[_0xb71a('0x67')]('ANY_VALUE(VoiceQueueId)',_0xb71a('0x6d'))['field'](_0xb71a('0x6a'),_0xb71a('0x64'))['field'](_0xb71a('0x6a'),'updatedAt')[_0xb71a('0x6e')]('cm_hopper_final')[_0xb71a('0x38')](_0xb71a('0x6f'),_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x71'),_0x15b8be[_0xb71a('0x48')]['state'][_0xb71a('0x70')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x69'))['from'](_0xb71a('0x5f'))[_0xb71a('0x38')]('VoiceQueueId\x20=\x20?',_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]()))[_0xb71a('0x38')](_0xb71a('0x72'),squel[_0xb71a('0x66')]()[_0xb71a('0x67')]('calleridnum')[_0xb71a('0x6e')](_0xb71a('0x73'))[_0xb71a('0x38')](_0xb71a('0x6f'),_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x74')))[_0xb71a('0x75')]('ContactId'))[_0xb71a('0x70')]();return db[_0xb71a('0x4b')][_0xb71a('0x2e')](_0x27c15e);}return[];})['then'](respondWithResult(_0x2dd470,null))[_0xb71a('0x42')](handleError(_0x2dd470,null));};exports[_0xb71a('0x76')]=function(_0x28bc74,_0x575a0a,_0x1a658e){return db[_0xb71a('0x77')]['find']({'where':{'id':_0x28bc74[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x575a0a,null))[_0xb71a('0x24')](function(_0x21b9b5){var _0x4abfd6;if(_0x21b9b5){_0x4abfd6=squel[_0xb71a('0x78')]()[_0xb71a('0x5e')](_0xb71a('0x5f'))[_0xb71a('0x60')](['phone',_0xb71a('0x61'),_0xb71a('0x62'),'ListId',_0xb71a('0x79'),_0xb71a('0x64'),'updatedAt'],squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x68'),'phone')[_0xb71a('0x67')](_0xb71a('0x6a'),_0xb71a('0x61'))[_0xb71a('0x67')](_0xb71a('0x6b'),_0xb71a('0x62'))[_0xb71a('0x67')](_0xb71a('0x6c'),_0xb71a('0x63'))['field']('ANY_VALUE(CampaignId)',_0xb71a('0x79'))[_0xb71a('0x67')](_0xb71a('0x6a'),_0xb71a('0x64'))[_0xb71a('0x67')](_0xb71a('0x6a'),'updatedAt')[_0xb71a('0x6e')]('cm_hopper_final')[_0xb71a('0x38')]('CampaignId\x20=\x20?',_0x28bc74[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x71'),_0x28bc74[_0xb71a('0x48')][_0xb71a('0x7a')][_0xb71a('0x70')]())[_0xb71a('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xb71a('0x38')](_0xb71a('0x72'),squel['select']()[_0xb71a('0x67')](_0xb71a('0x69'))['from'](_0xb71a('0x5f'))[_0xb71a('0x38')](_0xb71a('0x7b'),_0x28bc74['params']['id'][_0xb71a('0x70')]()))[_0xb71a('0x38')](_0xb71a('0x72'),squel['select']()[_0xb71a('0x67')](_0xb71a('0x7c'))[_0xb71a('0x6e')](_0xb71a('0x73'))[_0xb71a('0x38')]('CampaignId\x20=\x20?',_0x28bc74[_0xb71a('0x44')]['id']['toString']())[_0xb71a('0x38')](_0xb71a('0x74')))[_0xb71a('0x75')]('ContactId'))['toString']();return db[_0xb71a('0x4b')][_0xb71a('0x2e')](_0x4abfd6);}return[];})[_0xb71a('0x24')](respondWithResult(_0x575a0a,null))[_0xb71a('0x42')](handleError(_0x575a0a,null));};exports[_0xb71a('0x7d')]=function(_0x18dfb3,_0x38ffc1,_0x442ec0){return db[_0xb71a('0x7e')][_0xb71a('0x7f')]({'where':{'VoiceQueueId':_0x18dfb3[_0xb71a('0x48')][_0xb71a('0x6d')],'CampaignId':_0x18dfb3[_0xb71a('0x48')][_0xb71a('0x79')],'ContactId':_0x18dfb3[_0xb71a('0x48')]['ContactId']}})[_0xb71a('0x24')](handleEntityNotFound(_0x38ffc1,null))[_0xb71a('0x24')](function(_0x243c90){if(_0x243c90){return _0x243c90;}return null;})['then'](respondWithResult(_0x38ffc1,null))['catch'](handleError(_0x38ffc1,null));}; \ No newline at end of file +var _0x430c=['field','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','createdAt','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','from','checkContactHopper','CmHopper','findOne','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','describe','update','uniqueid','body','find','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x208,\x201,\x20null','dropContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select'];(function(_0x5be7a3,_0x280a22){var _0x3bad90=function(_0x4743af){while(--_0x4743af){_0x5be7a3['push'](_0x5be7a3['shift']());}};_0x3bad90(++_0x280a22);}(_0x430c,0x1a1));var _0xc430=function(_0x628eee,_0x3f3fba){_0x628eee=_0x628eee-0x0;var _0x447718=_0x430c[_0x628eee];return _0x447718;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':!![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['describe']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')]()[_0xc430('0x1e')](respondWithResult(_0x4eafae,null))['catch'](handleError(_0x4eafae,null));};exports[_0xc430('0x45')]=function(_0x2e7052,_0x19e563){if(_0x2e7052['body'][_0xc430('0x46')]){delete _0x2e7052[_0xc430('0x47')][_0xc430('0x46')];}return db[_0xc430('0x25')][_0xc430('0x48')]({'where':{'uniqueid':_0x2e7052[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x19e563,null))['then'](saveUpdates(_0x2e7052[_0xc430('0x47')],null))[_0xc430('0x1e')](respondWithResult(_0x19e563,null))[_0xc430('0x40')](handleError(_0x19e563,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x23cb41,_0x4178d7,_0x2d064b){return db[_0xc430('0x25')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x23cb41[_0xc430('0x42')]['id']},'attributes':[[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4c')))),_0xc430('0x4d')],[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x4e')))),_0xc430('0x4f')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x50')))),_0xc430('0x51')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xc430('0x52')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x53')))),'dropContacts'],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x54')))),_0xc430('0x55')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x56')))),_0xc430('0x57')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db['sequelize']['fn']('IF',db[_0xc430('0x4a')]['literal'](_0xc430('0x58')))),'answeringMachine']]})[_0xc430('0x1e')](handleEntityNotFound(_0x4178d7,null))[_0xc430('0x1e')](respondWithResult(_0x4178d7,null))[_0xc430('0x40')](handleError(_0x4178d7,null));};exports[_0xc430('0x59')]=function(_0x147062,_0x45eec6,_0x5d3393){return db[_0xc430('0x25')][_0xc430('0x3e')]({'raw':![],'where':{'CampaignId':_0x147062['params']['id']},'attributes':[[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4c')))),_0xc430('0x4d')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4e')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xc430('0x49'),db['sequelize']['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')]('`state`\x20=\x205,\x201,\x20null'))),_0xc430('0x51')],[db['sequelize']['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')]['literal'](_0xc430('0x5a')))),'congestionContacts'],[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xc430('0x5b')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x54')))),_0xc430('0x55')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x56')))),_0xc430('0x57')],[db[_0xc430('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x58')))),_0xc430('0x5c')]]})['then'](handleEntityNotFound(_0x45eec6,null))['then'](respondWithResult(_0x45eec6,null))[_0xc430('0x40')](handleError(_0x45eec6,null));};exports[_0xc430('0x5d')]=function(_0x31ae3c,_0x19c080,_0x256290){return db[_0xc430('0x5e')][_0xc430('0x48')]({'where':{'id':_0x31ae3c[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x19c080,null))[_0xc430('0x1e')](function(_0x5ca0f2){var _0x6debfb;if(_0x5ca0f2){_0x6debfb=squel[_0xc430('0x5f')]()[_0xc430('0x60')]('cm_hopper')['fromQuery'](['phone',_0xc430('0x61'),_0xc430('0x62'),_0xc430('0x63'),_0xc430('0x64'),'createdAt',_0xc430('0x65')],squel[_0xc430('0x66')]()[_0xc430('0x67')]('ANY_VALUE(calleridnum)',_0xc430('0x68'))['field'](_0xc430('0x69'),_0xc430('0x61'))[_0xc430('0x67')](_0xc430('0x6a'),_0xc430('0x62'))['field'](_0xc430('0x6b'),_0xc430('0x63'))[_0xc430('0x67')](_0xc430('0x6c'),'VoiceQueueId')['field'](_0xc430('0x69'),'createdAt')['field'](_0xc430('0x69'),_0xc430('0x65'))['from'](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x6e'),_0x31ae3c[_0xc430('0x42')]['id'][_0xc430('0x6f')]())[_0xc430('0x34')]('state\x20=\x20?',_0x31ae3c[_0xc430('0x47')][_0xc430('0x70')][_0xc430('0x6f')]())[_0xc430('0x34')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xc430('0x34')](_0xc430('0x71'),squel[_0xc430('0x66')]()['field'](_0xc430('0x68'))['from']('cm_hopper')[_0xc430('0x34')]('VoiceQueueId\x20=\x20?',_0x31ae3c[_0xc430('0x42')]['id']['toString']()))[_0xc430('0x34')](_0xc430('0x71'),squel['select']()[_0xc430('0x67')](_0xc430('0x72'))['from'](_0xc430('0x6d'))[_0xc430('0x34')]('VoiceQueueId\x20=\x20?',_0x31ae3c[_0xc430('0x42')]['id'][_0xc430('0x6f')]())['where'](_0xc430('0x73')))[_0xc430('0x74')](_0xc430('0x62')))[_0xc430('0x6f')]();return db[_0xc430('0x4a')][_0xc430('0x2c')](_0x6debfb);}return[];})[_0xc430('0x1e')](respondWithResult(_0x19c080,null))[_0xc430('0x40')](handleError(_0x19c080,null));};exports[_0xc430('0x75')]=function(_0x19789f,_0x24b380,_0x4fe467){return db[_0xc430('0x76')][_0xc430('0x48')]({'where':{'id':_0x19789f[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x24b380,null))['then'](function(_0x150a8a){var _0x4edead;if(_0x150a8a){_0x4edead=squel[_0xc430('0x5f')]()[_0xc430('0x60')]('cm_hopper')['fromQuery']([_0xc430('0x68'),_0xc430('0x61'),_0xc430('0x62'),'ListId',_0xc430('0x77'),'createdAt','updatedAt'],squel[_0xc430('0x66')]()[_0xc430('0x67')](_0xc430('0x78'),'phone')[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x61'))[_0xc430('0x67')](_0xc430('0x6a'),'ContactId')['field'](_0xc430('0x6b'),_0xc430('0x63'))[_0xc430('0x67')](_0xc430('0x79'),_0xc430('0x77'))[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x7a'))[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x65'))['from'](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id']['toString']())['where'](_0xc430('0x7c'),_0x19789f['body'][_0xc430('0x70')][_0xc430('0x6f')]())[_0xc430('0x34')](_0xc430('0x7d'))[_0xc430('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')[_0xc430('0x7e')]('cm_hopper')['where'](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id'][_0xc430('0x6f')]()))[_0xc430('0x34')](_0xc430('0x71'),squel[_0xc430('0x66')]()[_0xc430('0x67')](_0xc430('0x72'))[_0xc430('0x7e')](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id']['toString']())[_0xc430('0x34')](_0xc430('0x73')))[_0xc430('0x74')](_0xc430('0x62')))[_0xc430('0x6f')]();return db[_0xc430('0x4a')][_0xc430('0x2c')](_0x4edead);}return[];})[_0xc430('0x1e')](respondWithResult(_0x24b380,null))['catch'](handleError(_0x24b380,null));};exports[_0xc430('0x7f')]=function(_0x6e48a3,_0x5be78a,_0x3bd6e1){return db[_0xc430('0x80')][_0xc430('0x81')]({'where':{'VoiceQueueId':_0x6e48a3[_0xc430('0x47')]['VoiceQueueId'],'CampaignId':_0x6e48a3[_0xc430('0x47')]['CampaignId'],'ContactId':_0x6e48a3['body'][_0xc430('0x62')]}})[_0xc430('0x1e')](handleEntityNotFound(_0x5be78a,null))[_0xc430('0x1e')](function(_0x207067){if(_0x207067){return _0x207067;}return null;})[_0xc430('0x1e')](respondWithResult(_0x5be78a,null))[_0xc430('0x40')](handleError(_0x5be78a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index d25db20..c5b8bb8 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 _0xfca3=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x3fdded,_0x46d446){var _0x336bf8=function(_0x4ccfad){while(--_0x4ccfad){_0x3fdded['push'](_0x3fdded['shift']());}};_0x336bf8(++_0x46d446);}(_0xfca3,0xa1));var _0x3fca=function(_0x3eb37,_0x55a9eb){_0x3eb37=_0x3eb37-0x0;var _0x7609cf=_0xfca3[_0x3eb37];return _0x7609cf;};'use strict';var _=require(_0x3fca('0x0'));var util=require(_0x3fca('0x1'));var logger=require(_0x3fca('0x2'))(_0x3fca('0x3'));var moment=require(_0x3fca('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fca('0x5'));var rimraf=require('rimraf');var config=require(_0x3fca('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0x3fca('0x7')]=function(_0x579818,_0x5f0325){return _0x579818['define'](_0x3fca('0x8'),attributes,{'tableName':_0x3fca('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x3fca('0xa')]},{'name':_0x3fca('0xb'),'fields':[_0x3fca('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1446=['rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','uniqueid','util','../../config/logger','moment','request-promise','path'];(function(_0x54165e,_0x33fc32){var _0x1a2142=function(_0x322d1c){while(--_0x322d1c){_0x54165e['push'](_0x54165e['shift']());}};_0x1a2142(++_0x33fc32);}(_0x1446,0x187));var _0x6144=function(_0x122917,_0x4e17b7){_0x122917=_0x122917-0x0;var _0x172d2d=_0x1446[_0x122917];return _0x172d2d;};'use strict';var _=require('lodash');var util=require(_0x6144('0x0'));var logger=require(_0x6144('0x1'))('api');var moment=require(_0x6144('0x2'));var BPromise=require('bluebird');var rp=require(_0x6144('0x3'));var fs=require('fs');var path=require(_0x6144('0x4'));var rimraf=require(_0x6144('0x5'));var config=require(_0x6144('0x6'));var attributes=require(_0x6144('0x7'));module[_0x6144('0x8')]=function(_0x2377b8,_0x31a8c2){return _0x2377b8['define'](_0x6144('0x9'),attributes,{'tableName':_0x6144('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0x6144('0xb'),'fields':[_0x6144('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 5047b0d..02f4f33 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(_0x49966f,_0x5ad025){var _0xc6f405=function(_0x2a82b8){while(--_0x2a82b8){_0x49966f['push'](_0x49966f['shift']());}};_0xc6f405(++_0x5ad025);}(_0xb10b,0x12a));var _0xbb10=function(_0x28bef9,_0x28e8d6){_0x28bef9=_0x28bef9-0x0;var _0x45db81=_0xb10b[_0x28bef9];return _0x45db81;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x5c2115,_0x313147){var _0x4a8892=function(_0x275669){while(--_0x275669){_0x5c2115['push'](_0x5c2115['shift']());}};_0x4a8892(++_0x313147);}(_0xb10b,0x12a));var _0xbb10=function(_0x193109,_0x50a9ca){_0x193109=_0x193109-0x0;var _0x4af109=_0xb10b[_0x193109];return _0x4af109;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 1606d45..2ab5949 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 _0x551b=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','isAuthenticated','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','update','exports','util','path','connect-timeout'];(function(_0x22a9ae,_0x60d67a){var _0x1ca8b6=function(_0x22ad46){while(--_0x22ad46){_0x22a9ae['push'](_0x22a9ae['shift']());}};_0x1ca8b6(++_0x60d67a);}(_0x551b,0x66));var _0xb551=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x551b[_0xdd2bfa];return _0x55397e;};'use strict';var multer=require('multer');var util=require(_0xb551('0x0'));var path=require(_0xb551('0x1'));var timeout=require(_0xb551('0x2'));var express=require(_0xb551('0x3'));var router=express[_0xb551('0x4')]();var fs_extra=require(_0xb551('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb551('0x6'));var config=require(_0xb551('0x7'));var controller=require(_0xb551('0x8'));router[_0xb551('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb551('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb551('0xa')]);router[_0xb551('0x9')](_0xb551('0xb'),auth['isAuthenticated'](),controller[_0xb551('0xc')]);router[_0xb551('0x9')](_0xb551('0xd'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router['post']('/voice/queue/moveContacts/:id',auth[_0xb551('0xe')](),controller[_0xb551('0xf')]);router[_0xb551('0x10')](_0xb551('0x11'),auth[_0xb551('0xe')](),controller[_0xb551('0x12')]);router[_0xb551('0x10')]('/checkContactHopper',auth['isAuthenticated'](),controller['checkContactHopper']);router['put']('/:id',auth[_0xb551('0xe')](),controller[_0xb551('0x13')]);module[_0xb551('0x14')]=router; \ No newline at end of file +var _0x6efe=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/:id','isAuthenticated','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6efe,0xc6));var _0xe6ef=function(_0xf03fed,_0x3257dc){_0xf03fed=_0xf03fed-0x0;var _0x19e5cb=_0x6efe[_0xf03fed];return _0x19e5cb;};'use strict';var multer=require(_0xe6ef('0x0'));var util=require(_0xe6ef('0x1'));var path=require(_0xe6ef('0x2'));var timeout=require(_0xe6ef('0x3'));var express=require(_0xe6ef('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe6ef('0x5'));var interaction=require(_0xe6ef('0x6'));var config=require(_0xe6ef('0x7'));var controller=require(_0xe6ef('0x8'));router[_0xe6ef('0x9')]('/',auth['isAuthenticated'](),controller[_0xe6ef('0xa')]);router[_0xe6ef('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xe6ef('0x9')](_0xe6ef('0xb'),auth[_0xe6ef('0xc')](),controller['show']);router[_0xe6ef('0x9')]('/voice/queue/countAttributes/:id',auth[_0xe6ef('0xc')](),controller[_0xe6ef('0xd')]);router[_0xe6ef('0x9')](_0xe6ef('0xe'),auth[_0xe6ef('0xc')](),controller[_0xe6ef('0xf')]);router[_0xe6ef('0x10')](_0xe6ef('0x11'),auth['isAuthenticated'](),controller[_0xe6ef('0x12')]);router[_0xe6ef('0x10')](_0xe6ef('0x13'),auth[_0xe6ef('0xc')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xe6ef('0x10')]('/checkContactHopper',auth[_0xe6ef('0xc')](),controller[_0xe6ef('0x14')]);router[_0xe6ef('0x15')](_0xe6ef('0xb'),auth[_0xe6ef('0xc')](),controller[_0xe6ef('0x16')]);module[_0xe6ef('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 3e80b4b..adbaf05 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 _0x0b8f=['DATE','INTEGER','BOOLEAN','exports','STRING'];(function(_0x62e0c2,_0x28ad9d){var _0x395a20=function(_0x329335){while(--_0x329335){_0x62e0c2['push'](_0x62e0c2['shift']());}};_0x395a20(++_0x28ad9d);}(_0x0b8f,0x17a));var _0xf0b8=function(_0x3ded33,_0x1df3e1){_0x3ded33=_0x3ded33-0x0;var _0x221d8e=_0x0b8f[_0x3ded33];return _0x221d8e;};'use strict';var Sequelize=require('sequelize');module[_0xf0b8('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xf0b8('0x1')]},'scheduledat':{'type':Sequelize[_0xf0b8('0x2')]},'countbusyretry':{'type':Sequelize[_0xf0b8('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf0b8('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf0b8('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xf0b8('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xf0b8('0x2')]},'responsetime':{'type':Sequelize[_0xf0b8('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xf0b8('0x2')]},'endtime':{'type':Sequelize[_0xf0b8('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf0b8('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf0b8('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf0b8('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf0b8('0x1')]},'campaign':{'type':Sequelize[_0xf0b8('0x1')]},'campaigntype':{'type':Sequelize[_0xf0b8('0x1')]},'membername':{'type':Sequelize[_0xf0b8('0x1')]},'reason':{'type':Sequelize[_0xf0b8('0x1')]},'amd':{'type':Sequelize[_0xf0b8('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xf0b8('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf0b8('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xf0b8('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xf0b8('0x2')]},'edited':{'type':Sequelize[_0xf0b8('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf0b8('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf0b8('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf0b8('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf0b8('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xf0b8('0x1')]}}; \ No newline at end of file +var _0xd7d5=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x2c54dc,_0x1db485){var _0x32ccd4=function(_0xd334b5){while(--_0xd334b5){_0x2c54dc['push'](_0x2c54dc['shift']());}};_0x32ccd4(++_0x1db485);}(_0xd7d5,0x1ea));var _0x5d7d=function(_0x127526,_0xf89d35){_0x127526=_0x127526-0x0;var _0x223aa4=_0xd7d5[_0x127526];return _0x223aa4;};'use strict';var Sequelize=require(_0x5d7d('0x0'));module[_0x5d7d('0x1')]={'state':{'type':Sequelize[_0x5d7d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5d7d('0x3')]},'scheduledat':{'type':Sequelize[_0x5d7d('0x4')]},'countbusyretry':{'type':Sequelize[_0x5d7d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5d7d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5d7d('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x5d7d('0x3')]},'originatecalleridname':{'type':Sequelize[_0x5d7d('0x3')]},'calleridnum':{'type':Sequelize[_0x5d7d('0x3')]},'calleridname':{'type':Sequelize[_0x5d7d('0x3')]},'starttime':{'type':Sequelize[_0x5d7d('0x4')]},'responsetime':{'type':Sequelize[_0x5d7d('0x4')]},'answertime':{'type':Sequelize[_0x5d7d('0x4')]},'droptime':{'type':Sequelize[_0x5d7d('0x4')]},'endtime':{'type':Sequelize[_0x5d7d('0x4')]},'ringtime':{'type':Sequelize[_0x5d7d('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5d7d('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5d7d('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5d7d('0x3')]},'campaign':{'type':Sequelize[_0x5d7d('0x3')]},'campaigntype':{'type':Sequelize[_0x5d7d('0x3')]},'membername':{'type':Sequelize[_0x5d7d('0x3')]},'reason':{'type':Sequelize[_0x5d7d('0x3')]},'amd':{'type':Sequelize[_0x5d7d('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5d7d('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5d7d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5d7d('0x4')]},'recallme':{'type':Sequelize[_0x5d7d('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x5d7d('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5d7d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5d7d('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 57b7d81..c12c879 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 _0x66ea=['status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','CmHopperHistory','includeAll','include','rows','catch','show','params','find','create','describe','body','uniqueid','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x51d94c,_0x2ab838){var _0xb33e88=function(_0x29332d){while(--_0x29332d){_0x51d94c['push'](_0x51d94c['shift']());}};_0xb33e88(++_0x2ab838);}(_0x66ea,0x1c5));var _0xa66e=function(_0x3b59c0,_0x253597){_0x3b59c0=_0x3b59c0-0x0;var _0x5d5f13=_0x66ea[_0x3b59c0];return _0x5d5f13;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa66e('0x0'));var rp=require('request-promise');var moment=require(_0xa66e('0x1'));var BPromise=require(_0xa66e('0x2'));var Mustache=require(_0xa66e('0x3'));var util=require(_0xa66e('0x4'));var path=require(_0xa66e('0x5'));var sox=require(_0xa66e('0x6'));var csv=require(_0xa66e('0x7'));var ejs=require(_0xa66e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa66e('0x9'));var squel=require('squel');var crypto=require(_0xa66e('0xa'));var jsforce=require(_0xa66e('0xb'));var deskjs=require(_0xa66e('0xc'));var toCsv=require(_0xa66e('0x7'));var querystring=require(_0xa66e('0xd'));var Papa=require(_0xa66e('0xe'));var Redis=require(_0xa66e('0xf'));var authService=require(_0xa66e('0x10'));var qs=require(_0xa66e('0x11'));var as=require(_0xa66e('0x12'));var hardwareService=require(_0xa66e('0x13'));var logger=require(_0xa66e('0x14'))(_0xa66e('0x15'));var utils=require(_0xa66e('0x16'));var config=require(_0xa66e('0x17'));var licenseUtil=require(_0xa66e('0x18'));var db=require(_0xa66e('0x19'))['db'];function respondWithStatusCode(_0x42ae70,_0x101bb1){_0x101bb1=_0x101bb1||0xcc;return function(_0x4fbbdf){if(_0x4fbbdf){return _0x42ae70[_0xa66e('0x1a')](_0x101bb1);}return _0x42ae70[_0xa66e('0x1b')](_0x101bb1)[_0xa66e('0x1c')]();};}function respondWithResult(_0x479b8b,_0x10561f){_0x10561f=_0x10561f||0xc8;return function(_0x2d5c6b){if(_0x2d5c6b){return _0x479b8b['status'](_0x10561f)[_0xa66e('0x1d')](_0x2d5c6b);}};}function respondWithFilteredResult(_0x26314e,_0x38629a){return function(_0x11d975){if(_0x11d975){var _0x52ff00=typeof _0x38629a[_0xa66e('0x1e')]===_0xa66e('0x1f')&&typeof _0x38629a[_0xa66e('0x20')]===_0xa66e('0x1f');var _0x527a25=_0x11d975['count'];var _0x5ae99b=_0x52ff00?0x0:_0x38629a[_0xa66e('0x1e')];var _0x14b3a6=_0x52ff00?_0x11d975[_0xa66e('0x21')]:_0x38629a[_0xa66e('0x1e')]+_0x38629a[_0xa66e('0x20')];var _0x305f7c;if(_0x14b3a6>=_0x527a25){_0x14b3a6=_0x527a25;_0x305f7c=0xc8;}else{_0x305f7c=0xce;}_0x26314e[_0xa66e('0x1b')](_0x305f7c);return _0x26314e[_0xa66e('0x22')](_0xa66e('0x23'),_0x5ae99b+'-'+_0x14b3a6+'/'+_0x527a25)['json'](_0x11d975);}return null;};}function patchUpdates(_0x9fc8c6){return function(_0x24e43d){try{jsonpatch['apply'](_0x24e43d,_0x9fc8c6,!![]);}catch(_0x716c16){return BPromise[_0xa66e('0x24')](_0x716c16);}return _0x24e43d[_0xa66e('0x25')]();};}function saveUpdates(_0x33c2de,_0x5e704b){return function(_0x5624f7){if(_0x5624f7){return _0x5624f7[_0xa66e('0x26')](_0x33c2de)[_0xa66e('0x27')](function(_0x2f3951){return _0x2f3951;});}return null;};}function removeEntity(_0x498d8a,_0x28997a){return function(_0x4cc2bd){if(_0x4cc2bd){return _0x4cc2bd[_0xa66e('0x28')]()[_0xa66e('0x27')](function(){_0x498d8a[_0xa66e('0x1b')](0xcc)[_0xa66e('0x1c')]();});}};}function handleEntityNotFound(_0x5116fd,_0x1758a7){return function(_0x225357){if(!_0x225357){_0x5116fd[_0xa66e('0x1a')](0x194);}return _0x225357;};}function handleError(_0x40eb85,_0x766674){_0x766674=_0x766674||0x1f4;return function(_0x1f2f00){logger[_0xa66e('0x29')](_0x1f2f00[_0xa66e('0x2a')]);if(_0x1f2f00[_0xa66e('0x2b')]){delete _0x1f2f00['name'];}_0x40eb85[_0xa66e('0x1b')](_0x766674)[_0xa66e('0x2c')](_0x1f2f00);};}exports[_0xa66e('0x2d')]=function(_0x5a2bb2,_0x3cf700){var _0x4e6c46={},_0x20d860={},_0x3cd9dd={'count':0x0,'rows':[]};var _0x54f4c4=_[_0xa66e('0x2e')](db['CmHopperHistory'][_0xa66e('0x2f')],function(_0x3f74da){return{'name':_0x3f74da[_0xa66e('0x30')],'type':_0x3f74da[_0xa66e('0x31')][_0xa66e('0x32')]};});_0x20d860['model']=_[_0xa66e('0x2e')](_0x54f4c4,'name');_0x20d860['query']=_[_0xa66e('0x33')](_0x5a2bb2[_0xa66e('0x34')]);_0x20d860[_0xa66e('0x35')]=_[_0xa66e('0x36')](_0x20d860[_0xa66e('0x37')],_0x20d860[_0xa66e('0x34')]);_0x4e6c46['attributes']=_[_0xa66e('0x36')](_0x20d860[_0xa66e('0x37')],qs['fields'](_0x5a2bb2['query'][_0xa66e('0x38')]));_0x4e6c46['attributes']=_0x4e6c46[_0xa66e('0x39')][_0xa66e('0x3a')]?_0x4e6c46[_0xa66e('0x39')]:_0x20d860[_0xa66e('0x37')];if(!_0x5a2bb2['query']['hasOwnProperty'](_0xa66e('0x3b'))){_0x4e6c46[_0xa66e('0x20')]=qs[_0xa66e('0x20')](_0x5a2bb2['query'][_0xa66e('0x20')]);_0x4e6c46['offset']=qs['offset'](_0x5a2bb2[_0xa66e('0x34')]['offset']);}_0x4e6c46[_0xa66e('0x3c')]=qs[_0xa66e('0x3d')](_0x5a2bb2[_0xa66e('0x34')][_0xa66e('0x3d')]);_0x4e6c46[_0xa66e('0x3e')]=qs[_0xa66e('0x35')](_[_0xa66e('0x3f')](_0x5a2bb2[_0xa66e('0x34')],_0x20d860[_0xa66e('0x35')]),_0x54f4c4);if(_0x5a2bb2['query']['filter']){_0x4e6c46['where']=_[_0xa66e('0x40')](_0x4e6c46[_0xa66e('0x3e')],{'$or':_[_0xa66e('0x2e')](_0x54f4c4,function(_0x4118d9){if(_0x4118d9[_0xa66e('0x31')]!==_0xa66e('0x41')){var _0x4e662b={};_0x4e662b[_0x4118d9[_0xa66e('0x2b')]]={'$like':'%'+_0x5a2bb2[_0xa66e('0x34')][_0xa66e('0x42')]+'%'};return _0x4e662b;}})});}_0x4e6c46=_['merge']({},_0x4e6c46,_0x5a2bb2[_0xa66e('0x43')]);var _0x5f58b1={'where':_0x4e6c46['where']};return db[_0xa66e('0x44')]['count'](_0x5f58b1)[_0xa66e('0x27')](function(_0x387133){_0x3cd9dd[_0xa66e('0x21')]=_0x387133;if(_0x5a2bb2[_0xa66e('0x34')][_0xa66e('0x45')]){_0x4e6c46[_0xa66e('0x46')]=[{'all':!![]}];}return db[_0xa66e('0x44')]['findAll'](_0x4e6c46);})[_0xa66e('0x27')](function(_0x140ba5){_0x3cd9dd[_0xa66e('0x47')]=_0x140ba5;return _0x3cd9dd;})[_0xa66e('0x27')](respondWithFilteredResult(_0x3cf700,_0x4e6c46))[_0xa66e('0x48')](handleError(_0x3cf700,null));};exports[_0xa66e('0x49')]=function(_0x305ae9,_0x42f09c){var _0x5b42b0={'raw':!![],'where':{'id':_0x305ae9[_0xa66e('0x4a')]['id']}},_0x404ba7={};_0x404ba7[_0xa66e('0x37')]=_['keys'](db['CmHopperHistory'][_0xa66e('0x2f')]);_0x404ba7['query']=_[_0xa66e('0x33')](_0x305ae9[_0xa66e('0x34')]);_0x404ba7['filters']=_['intersection'](_0x404ba7[_0xa66e('0x37')],_0x404ba7[_0xa66e('0x34')]);_0x5b42b0['attributes']=_['intersection'](_0x404ba7[_0xa66e('0x37')],qs[_0xa66e('0x38')](_0x305ae9['query'][_0xa66e('0x38')]));_0x5b42b0[_0xa66e('0x39')]=_0x5b42b0[_0xa66e('0x39')][_0xa66e('0x3a')]?_0x5b42b0[_0xa66e('0x39')]:_0x404ba7[_0xa66e('0x37')];if(_0x305ae9[_0xa66e('0x34')][_0xa66e('0x45')]){_0x5b42b0['include']=[{'all':!![]}];}_0x5b42b0=_[_0xa66e('0x40')]({},_0x5b42b0,_0x305ae9[_0xa66e('0x43')]);return db[_0xa66e('0x44')][_0xa66e('0x4b')](_0x5b42b0)['then'](handleEntityNotFound(_0x42f09c,null))[_0xa66e('0x27')](respondWithResult(_0x42f09c,null))[_0xa66e('0x48')](handleError(_0x42f09c,null));};exports[_0xa66e('0x4c')]=function(_0x3beda8,_0x2a392b){return db['CmHopperHistory'][_0xa66e('0x4c')](_0x3beda8['body'],{})[_0xa66e('0x27')](respondWithResult(_0x2a392b,0xc9))[_0xa66e('0x48')](handleError(_0x2a392b,null));};exports[_0xa66e('0x4d')]=function(_0x44f5ae,_0x533a1c){return db[_0xa66e('0x44')][_0xa66e('0x4d')]()['then'](respondWithResult(_0x533a1c,null))[_0xa66e('0x48')](handleError(_0x533a1c,null));};exports['update']=function(_0x592360,_0x5d3f6d){if(_0x592360[_0xa66e('0x4e')][_0xa66e('0x4f')]){delete _0x592360[_0xa66e('0x4e')][_0xa66e('0x4f')];}return db[_0xa66e('0x44')][_0xa66e('0x4b')]({'where':{'uniqueid':_0x592360[_0xa66e('0x4a')]['id']}})[_0xa66e('0x27')](handleEntityNotFound(_0x5d3f6d,null))[_0xa66e('0x27')](saveUpdates(_0x592360[_0xa66e('0x4e')],null))[_0xa66e('0x27')](respondWithResult(_0x5d3f6d,null))[_0xa66e('0x48')](handleError(_0x5d3f6d,null));}; \ No newline at end of file +var _0xd728=['rows','catch','show','params','rawAttributes','includeAll','include','create','body','uniqueid','find','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperHistory','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','findAll'];(function(_0x2070b3,_0x3536cd){var _0x3d1161=function(_0x4c6aae){while(--_0x4c6aae){_0x2070b3['push'](_0x2070b3['shift']());}};_0x3d1161(++_0x3536cd);}(_0xd728,0x1c1));var _0x8d72=function(_0x3c1cf0,_0x2130b4){_0x3c1cf0=_0x3c1cf0-0x0;var _0x2fc5f9=_0xd728[_0x3c1cf0];return _0x2fc5f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d72('0x0'));var zipdir=require(_0x8d72('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8d72('0x2'));var BPromise=require(_0x8d72('0x3'));var Mustache=require(_0x8d72('0x4'));var util=require(_0x8d72('0x5'));var path=require(_0x8d72('0x6'));var sox=require(_0x8d72('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d72('0x8'));var squel=require(_0x8d72('0x9'));var crypto=require(_0x8d72('0xa'));var jsforce=require(_0x8d72('0xb'));var deskjs=require(_0x8d72('0xc'));var toCsv=require(_0x8d72('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8d72('0xe'));var qs=require(_0x8d72('0xf'));var as=require(_0x8d72('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8d72('0x11'));var utils=require(_0x8d72('0x12'));var config=require(_0x8d72('0x13'));var licenseUtil=require(_0x8d72('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56638e,_0x54f95d){_0x54f95d=_0x54f95d||0xcc;return function(_0x2312f5){if(_0x2312f5){return _0x56638e['sendStatus'](_0x54f95d);}return _0x56638e['status'](_0x54f95d)[_0x8d72('0x15')]();};}function respondWithResult(_0x104885,_0x107ed1){_0x107ed1=_0x107ed1||0xc8;return function(_0x3e6ac6){if(_0x3e6ac6){return _0x104885['status'](_0x107ed1)[_0x8d72('0x16')](_0x3e6ac6);}};}function respondWithFilteredResult(_0x24be7b,_0x4fecf1){return function(_0x13cd27){if(_0x13cd27){var _0x408584=typeof _0x4fecf1['offset']==='undefined'&&typeof _0x4fecf1['limit']===_0x8d72('0x17');var _0xc49773=_0x13cd27[_0x8d72('0x18')];var _0x2071d6=_0x408584?0x0:_0x4fecf1[_0x8d72('0x19')];var _0x455b30=_0x408584?_0x13cd27[_0x8d72('0x18')]:_0x4fecf1[_0x8d72('0x19')]+_0x4fecf1[_0x8d72('0x1a')];var _0x3528ce;if(_0x455b30>=_0xc49773){_0x455b30=_0xc49773;_0x3528ce=0xc8;}else{_0x3528ce=0xce;}_0x24be7b[_0x8d72('0x1b')](_0x3528ce);return _0x24be7b[_0x8d72('0x1c')](_0x8d72('0x1d'),_0x2071d6+'-'+_0x455b30+'/'+_0xc49773)[_0x8d72('0x16')](_0x13cd27);}return null;};}function patchUpdates(_0x288d91){return function(_0x1f0a7d){try{jsonpatch[_0x8d72('0x1e')](_0x1f0a7d,_0x288d91,!![]);}catch(_0x16e0d5){return BPromise['reject'](_0x16e0d5);}return _0x1f0a7d[_0x8d72('0x1f')]();};}function saveUpdates(_0x10630a,_0x295643){return function(_0x4d7464){if(_0x4d7464){return _0x4d7464[_0x8d72('0x20')](_0x10630a)[_0x8d72('0x21')](function(_0x521649){return _0x521649;});}return null;};}function removeEntity(_0x1ef522,_0x3f5401){return function(_0x2fdd26){if(_0x2fdd26){return _0x2fdd26[_0x8d72('0x22')]()[_0x8d72('0x21')](function(){_0x1ef522[_0x8d72('0x1b')](0xcc)[_0x8d72('0x15')]();});}};}function handleEntityNotFound(_0x817cca,_0x2dd48c){return function(_0x2daa4f){if(!_0x2daa4f){_0x817cca[_0x8d72('0x23')](0x194);}return _0x2daa4f;};}function handleError(_0x9b806e,_0x5474bd){_0x5474bd=_0x5474bd||0x1f4;return function(_0x3b25b5){logger[_0x8d72('0x24')](_0x3b25b5[_0x8d72('0x25')]);if(_0x3b25b5[_0x8d72('0x26')]){delete _0x3b25b5['name'];}_0x9b806e['status'](_0x5474bd)[_0x8d72('0x27')](_0x3b25b5);};}exports[_0x8d72('0x28')]=function(_0x408eed,_0xfb41c){var _0xc7550e={},_0xae1a22={},_0x4244ad={'count':0x0,'rows':[]};var _0x9d1738=_[_0x8d72('0x29')](db[_0x8d72('0x2a')]['rawAttributes'],function(_0x14e5f8){return{'name':_0x14e5f8[_0x8d72('0x2b')],'type':_0x14e5f8['type'][_0x8d72('0x2c')]};});_0xae1a22[_0x8d72('0x2d')]=_['map'](_0x9d1738,_0x8d72('0x26'));_0xae1a22[_0x8d72('0x2e')]=_[_0x8d72('0x2f')](_0x408eed[_0x8d72('0x2e')]);_0xae1a22[_0x8d72('0x30')]=_[_0x8d72('0x31')](_0xae1a22[_0x8d72('0x2d')],_0xae1a22[_0x8d72('0x2e')]);_0xc7550e[_0x8d72('0x32')]=_[_0x8d72('0x31')](_0xae1a22[_0x8d72('0x2d')],qs[_0x8d72('0x33')](_0x408eed[_0x8d72('0x2e')]['fields']));_0xc7550e[_0x8d72('0x32')]=_0xc7550e[_0x8d72('0x32')][_0x8d72('0x34')]?_0xc7550e[_0x8d72('0x32')]:_0xae1a22[_0x8d72('0x2d')];if(!_0x408eed[_0x8d72('0x2e')][_0x8d72('0x35')]('nolimit')){_0xc7550e[_0x8d72('0x1a')]=qs[_0x8d72('0x1a')](_0x408eed['query'][_0x8d72('0x1a')]);_0xc7550e[_0x8d72('0x19')]=qs[_0x8d72('0x19')](_0x408eed[_0x8d72('0x2e')][_0x8d72('0x19')]);}_0xc7550e['order']=qs[_0x8d72('0x36')](_0x408eed[_0x8d72('0x2e')][_0x8d72('0x36')]);_0xc7550e[_0x8d72('0x37')]=qs[_0x8d72('0x30')](_[_0x8d72('0x38')](_0x408eed[_0x8d72('0x2e')],_0xae1a22[_0x8d72('0x30')]),_0x9d1738);if(_0x408eed[_0x8d72('0x2e')][_0x8d72('0x39')]){_0xc7550e[_0x8d72('0x37')]=_['merge'](_0xc7550e['where'],{'$or':_[_0x8d72('0x29')](_0x9d1738,function(_0x40ffc5){if(_0x40ffc5[_0x8d72('0x3a')]!==_0x8d72('0x3b')){var _0x50d586={};_0x50d586[_0x40ffc5[_0x8d72('0x26')]]={'$like':'%'+_0x408eed[_0x8d72('0x2e')][_0x8d72('0x39')]+'%'};return _0x50d586;}})});}_0xc7550e=_[_0x8d72('0x3c')]({},_0xc7550e,_0x408eed['options']);var _0x2c3981={'where':_0xc7550e['where']};return db[_0x8d72('0x2a')][_0x8d72('0x18')](_0x2c3981)['then'](function(_0x342889){_0x4244ad[_0x8d72('0x18')]=_0x342889;if(_0x408eed[_0x8d72('0x2e')]['includeAll']){_0xc7550e['include']=[{'all':!![]}];}return db[_0x8d72('0x2a')][_0x8d72('0x3d')](_0xc7550e);})[_0x8d72('0x21')](function(_0x9c3258){_0x4244ad[_0x8d72('0x3e')]=_0x9c3258;return _0x4244ad;})[_0x8d72('0x21')](respondWithFilteredResult(_0xfb41c,_0xc7550e))[_0x8d72('0x3f')](handleError(_0xfb41c,null));};exports[_0x8d72('0x40')]=function(_0x3dde18,_0x414dcb){var _0x5f1a8e={'raw':!![],'where':{'id':_0x3dde18[_0x8d72('0x41')]['id']}},_0x595f7f={};_0x595f7f['model']=_['keys'](db['CmHopperHistory'][_0x8d72('0x42')]);_0x595f7f[_0x8d72('0x2e')]=_[_0x8d72('0x2f')](_0x3dde18[_0x8d72('0x2e')]);_0x595f7f[_0x8d72('0x30')]=_[_0x8d72('0x31')](_0x595f7f[_0x8d72('0x2d')],_0x595f7f[_0x8d72('0x2e')]);_0x5f1a8e['attributes']=_[_0x8d72('0x31')](_0x595f7f[_0x8d72('0x2d')],qs[_0x8d72('0x33')](_0x3dde18[_0x8d72('0x2e')][_0x8d72('0x33')]));_0x5f1a8e[_0x8d72('0x32')]=_0x5f1a8e['attributes']['length']?_0x5f1a8e[_0x8d72('0x32')]:_0x595f7f[_0x8d72('0x2d')];if(_0x3dde18[_0x8d72('0x2e')][_0x8d72('0x43')]){_0x5f1a8e[_0x8d72('0x44')]=[{'all':!![]}];}_0x5f1a8e=_['merge']({},_0x5f1a8e,_0x3dde18['options']);return db[_0x8d72('0x2a')]['find'](_0x5f1a8e)[_0x8d72('0x21')](handleEntityNotFound(_0x414dcb,null))[_0x8d72('0x21')](respondWithResult(_0x414dcb,null))[_0x8d72('0x3f')](handleError(_0x414dcb,null));};exports[_0x8d72('0x45')]=function(_0x34dd27,_0x3da7a2){return db[_0x8d72('0x2a')][_0x8d72('0x45')](_0x34dd27[_0x8d72('0x46')],{})['then'](respondWithResult(_0x3da7a2,0xc9))['catch'](handleError(_0x3da7a2,null));};exports['describe']=function(_0x1cb76f,_0x153639){return db[_0x8d72('0x2a')]['describe']()[_0x8d72('0x21')](respondWithResult(_0x153639,null))[_0x8d72('0x3f')](handleError(_0x153639,null));};exports[_0x8d72('0x20')]=function(_0x2e3b21,_0x7b90af){if(_0x2e3b21[_0x8d72('0x46')][_0x8d72('0x47')]){delete _0x2e3b21[_0x8d72('0x46')][_0x8d72('0x47')];}return db[_0x8d72('0x2a')][_0x8d72('0x48')]({'where':{'uniqueid':_0x2e3b21[_0x8d72('0x41')]['id']}})[_0x8d72('0x21')](handleEntityNotFound(_0x7b90af,null))[_0x8d72('0x21')](saveUpdates(_0x2e3b21[_0x8d72('0x46')],null))[_0x8d72('0x21')](respondWithResult(_0x7b90af,null))[_0x8d72('0x3f')](handleError(_0x7b90af,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b7f5adb..8463ac3 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 _0x2eba=['uniqueid','util','../../config/logger','api','moment','path','../../config/environment','./cmHopperHistory.attributes','exports','cm_hopper_history','endtime'];(function(_0x30b8ef,_0x242e8){var _0xc5a192=function(_0x322965){while(--_0x322965){_0x30b8ef['push'](_0x30b8ef['shift']());}};_0xc5a192(++_0x242e8);}(_0x2eba,0xc7));var _0xa2eb=function(_0x23e734,_0x135d92){_0x23e734=_0x23e734-0x0;var _0x1e5f06=_0x2eba[_0x23e734];return _0x1e5f06;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var logger=require(_0xa2eb('0x1'))(_0xa2eb('0x2'));var moment=require(_0xa2eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2eb('0x4'));var rimraf=require('rimraf');var config=require(_0xa2eb('0x5'));var attributes=require(_0xa2eb('0x6'));module[_0xa2eb('0x7')]=function(_0x1e6fa2,_0x575a5c){return _0x1e6fa2['define']('CmHopperHistory',attributes,{'tableName':_0xa2eb('0x8'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xa2eb('0x9')]},{'name':_0xa2eb('0xa'),'fields':[_0xa2eb('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6edc=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','CmHopperHistory','endtime','uniqueid'];(function(_0x28fad6,_0x2d2220){var _0x3c6f2f=function(_0x56b880){while(--_0x56b880){_0x28fad6['push'](_0x28fad6['shift']());}};_0x3c6f2f(++_0x2d2220);}(_0x6edc,0x138));var _0xc6ed=function(_0x4243a3,_0x4baa0d){_0x4243a3=_0x4243a3-0x0;var _0x273f65=_0x6edc[_0x4243a3];return _0x273f65;};'use strict';var _=require(_0xc6ed('0x0'));var util=require(_0xc6ed('0x1'));var logger=require(_0xc6ed('0x2'))(_0xc6ed('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc6ed('0x4'));var fs=require('fs');var path=require(_0xc6ed('0x5'));var rimraf=require(_0xc6ed('0x6'));var config=require(_0xc6ed('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0xc6ed('0x8')]=function(_0x442466,_0x2b3e56){return _0x442466['define'](_0xc6ed('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xc6ed('0xa'),'fields':[_0xc6ed('0xa')]},{'name':_0xc6ed('0xb'),'fields':[_0xc6ed('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 30f3c6f..463b0d0 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 _0x3445=['request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','then','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','CmHopperHistory,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3445,0x13a));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5344('0x2'));var fs=require('fs');var Redis=require(_0x5344('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5344('0x4'));var logger=require(_0x5344('0x5'))(_0x5344('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5344('0x7')][_0x5344('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xea8222,_0x3c4589,_0x9f237f){return new BPromise(function(_0xb805dc,_0x530ebb){return client[_0x5344('0x9')](_0xea8222,_0x9f237f)['then'](function(_0x271c86){logger['info'](_0x5344('0xa'),_0x3c4589,_0x5344('0xb'));logger[_0x5344('0xc')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x3c4589,_0x5344('0xb'),JSON[_0x5344('0xd')](_0x271c86));if(_0x271c86[_0x5344('0xe')]){if(_0x271c86[_0x5344('0xe')][_0x5344('0xf')]===0x1f4){logger['error'](_0x5344('0xa'),_0x3c4589,_0x271c86[_0x5344('0xe')][_0x5344('0x10')]);return _0x530ebb(_0x271c86[_0x5344('0xe')]['message']);}logger[_0x5344('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x3c4589,_0x271c86[_0x5344('0xe')][_0x5344('0x10')]);return _0xb805dc(_0x271c86[_0x5344('0xe')]['message']);}else{logger[_0x5344('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x3c4589,_0x5344('0xb'));_0xb805dc(_0x271c86[_0x5344('0x12')][_0x5344('0x10')]);}})[_0x5344('0x13')](function(_0x2b4963){logger[_0x5344('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x3c4589,_0x2b4963);_0x530ebb(_0x2b4963);});});}exports[_0x5344('0x14')]=function(_0x5ee0a3){var _0xd2740c=this;return new Promise(function(_0x193492,_0xf2811d){return db[_0x5344('0x15')]['create'](_0x5ee0a3[_0x5344('0x16')],{'raw':_0x5ee0a3[_0x5344('0x17')]?_0x5ee0a3['options'][_0x5344('0x18')]===undefined?!![]:![]:!![]})[_0x5344('0x19')](function(_0x3418da){logger[_0x5344('0x11')](_0x5344('0x14'),_0x5ee0a3);logger[_0x5344('0xc')](_0x5344('0x14'),_0x5ee0a3,JSON[_0x5344('0xd')](_0x3418da));_0x193492(_0x3418da);})[_0x5344('0x13')](function(_0x1ebec4){logger[_0x5344('0xe')]('CreateCmHopperHistory',_0x1ebec4['message'],_0x5ee0a3);_0xf2811d(_0xd2740c[_0x5344('0xe')](0x1f4,_0x1ebec4[_0x5344('0x10')]));});});};exports['AvgHandleTime']=function(_0x487993){var _0x20472=this;return new Promise(function(_0x20f228,_0x2f000d){return db['CmHopperHistory'][_0x5344('0x1a')]({'raw':_0x487993[_0x5344('0x17')]?_0x487993['options'][_0x5344('0x18')]===undefined?!![]:![]:!![],'where':_0x487993[_0x5344('0x17')]?_0x487993[_0x5344('0x17')][_0x5344('0x1b')]||null:null,'attributes':[[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')][_0x5344('0x1e')]('id')),_0x5344('0x1f')],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x21')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x22')))),_0x5344('0x23')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5344('0x24')))),_0x5344('0x25')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x26'),db['sequelize']['fn']('IF',db[_0x5344('0x1c')]['literal'](_0x5344('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0x5344('0x1c')]['fn'](_0x5344('0x26'),db['sequelize']['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x5344('0x28')]]})['then'](function(_0x217c43){logger[_0x5344('0x11')](_0x5344('0x29'),_0x487993);logger[_0x5344('0xc')](_0x5344('0x29'),_0x487993,JSON[_0x5344('0xd')](_0x217c43));_0x20f228(_0x217c43);})[_0x5344('0x13')](function(_0x1e7070){logger['error'](_0x5344('0x29'),_0x1e7070['message'],_0x487993);_0x2f000d(_0x20472[_0x5344('0xe')](0x1f4,_0x1e7070[_0x5344('0x10')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x35c7d0){var _0x2bb695=this;return new Promise(function(_0x29d396,_0x2eaffa){return db[_0x5344('0x15')][_0x5344('0x1a')]({'raw':_0x35c7d0['options']?_0x35c7d0[_0x5344('0x17')][_0x5344('0x18')]===undefined?!![]:![]:!![],'where':_0x35c7d0[_0x5344('0x17')]?_0x35c7d0[_0x5344('0x17')][_0x5344('0x1b')]||null:null,'attributes':[[_0x5344('0x2a'),_0x5344('0x2b')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db['sequelize'][_0x5344('0x20')](_0x5344('0x2c')))),_0x5344('0x2d')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x21')))),_0x5344('0x2f')],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x205,\x201,\x20null'))),_0x5344('0x30')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x31')))),_0x5344('0x32')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x33')))),_0x5344('0x34')],[db['sequelize']['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x2012,\x201,\x20null'))),_0x5344('0x35')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x36')))),_0x5344('0x37')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),_0x5344('0x38')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5344('0x39')))),_0x5344('0x3a')],[db['sequelize']['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x3b')))),_0x5344('0x3c')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x3d')))),'outboundRejectCallsDay'],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x5344('0x2a')]})[_0x5344('0x19')](function(_0x54d2b0){logger['info'](_0x5344('0x3e'),_0x35c7d0);logger[_0x5344('0xc')](_0x5344('0x3e'),_0x35c7d0,JSON[_0x5344('0xd')](_0x54d2b0));_0x29d396(_0x54d2b0);})[_0x5344('0x13')](function(_0x534b32){logger[_0x5344('0xe')](_0x5344('0x3e'),_0x534b32[_0x5344('0x10')],_0x35c7d0);_0x2eaffa(_0x2bb695['error'](0x1f4,_0x534b32['message']));});});};exports[_0x5344('0x3f')]=function(_0x2e71f4){var _0x37409e=this;return new Promise(function(_0xaae044,_0x52882e){return db[_0x5344('0x15')][_0x5344('0x1a')]({'raw':_0x2e71f4[_0x5344('0x17')]?_0x2e71f4[_0x5344('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2e71f4[_0x5344('0x17')]?_0x2e71f4[_0x5344('0x17')][_0x5344('0x1b')]||null:null,'attributes':[[_0x5344('0x2a'),_0x5344('0x2b')],[db[_0x5344('0x1c')]['fn']('COUNT',db['sequelize'][_0x5344('0x1e')]('id')),_0x5344('0x40')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x5344('0x20')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x5344('0x2a')]})[_0x5344('0x19')](function(_0x32cfa4){logger['info'](_0x5344('0x3f'),_0x2e71f4);logger[_0x5344('0xc')]('GetCampaignHopperHistory',_0x2e71f4,JSON[_0x5344('0xd')](_0x32cfa4));_0xaae044(_0x32cfa4);})['catch'](function(_0x56dc43){logger[_0x5344('0xe')](_0x5344('0x3f'),_0x56dc43['message'],_0x2e71f4);_0x52882e(_0x37409e[_0x5344('0xe')](0x1f4,_0x56dc43['message']));});});}; \ No newline at end of file +var _0xc5b1=['request\x20sent','stringify','error','message','result','catch','CreateCmHopperHistory','create','body','raw','AvgHandleTime','findAll','options','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','CmHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s'];(function(_0x1d6dd8,_0x4ecdcf){var _0x10a027=function(_0x4d7711){while(--_0x4d7711){_0x1d6dd8['push'](_0x1d6dd8['shift']());}};_0x10a027(++_0x4ecdcf);}(_0xc5b1,0x106));var _0x1c5b=function(_0x39cc54,_0x182bb7){_0x39cc54=_0x39cc54-0x0;var _0x4c3183=_0xc5b1[_0x39cc54];return _0x4c3183;};'use strict';var _=require(_0x1c5b('0x0'));var util=require(_0x1c5b('0x1'));var moment=require(_0x1c5b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c5b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1c5b('0x4'))(_0x1c5b('0x5'));var config=require('../../config/environment');var jayson=require(_0x1c5b('0x6'));var client=jayson['client'][_0x1c5b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x39422a,_0x119c97,_0x3b8538){return new BPromise(function(_0x41382b,_0x587526){return client[_0x1c5b('0x8')](_0x39422a,_0x3b8538)[_0x1c5b('0x9')](function(_0x102c93){logger[_0x1c5b('0xa')](_0x1c5b('0xb'),_0x119c97,'request\x20sent');logger[_0x1c5b('0xc')](_0x1c5b('0xd'),_0x119c97,_0x1c5b('0xe'),JSON[_0x1c5b('0xf')](_0x102c93));if(_0x102c93[_0x1c5b('0x10')]){if(_0x102c93['error']['code']===0x1f4){logger[_0x1c5b('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x119c97,_0x102c93['error'][_0x1c5b('0x11')]);return _0x587526(_0x102c93[_0x1c5b('0x10')][_0x1c5b('0x11')]);}logger[_0x1c5b('0x10')](_0x1c5b('0xb'),_0x119c97,_0x102c93[_0x1c5b('0x10')]['message']);return _0x41382b(_0x102c93[_0x1c5b('0x10')]['message']);}else{logger[_0x1c5b('0xa')](_0x1c5b('0xb'),_0x119c97,_0x1c5b('0xe'));_0x41382b(_0x102c93[_0x1c5b('0x12')][_0x1c5b('0x11')]);}})[_0x1c5b('0x13')](function(_0x37f051){logger[_0x1c5b('0x10')](_0x1c5b('0xb'),_0x119c97,_0x37f051);_0x587526(_0x37f051);});});}exports[_0x1c5b('0x14')]=function(_0x153dc7){var _0x47bdcb=this;return new Promise(function(_0xb1aa14,_0x5b45f1){return db['CmHopperHistory'][_0x1c5b('0x15')](_0x153dc7[_0x1c5b('0x16')],{'raw':_0x153dc7['options']?_0x153dc7['options'][_0x1c5b('0x17')]===undefined?!![]:![]:!![]})[_0x1c5b('0x9')](function(_0x5ab13a){logger[_0x1c5b('0xa')](_0x1c5b('0x14'),_0x153dc7);logger[_0x1c5b('0xc')](_0x1c5b('0x14'),_0x153dc7,JSON[_0x1c5b('0xf')](_0x5ab13a));_0xb1aa14(_0x5ab13a);})[_0x1c5b('0x13')](function(_0x3a67b5){logger[_0x1c5b('0x10')](_0x1c5b('0x14'),_0x3a67b5[_0x1c5b('0x11')],_0x153dc7);_0x5b45f1(_0x47bdcb[_0x1c5b('0x10')](0x1f4,_0x3a67b5[_0x1c5b('0x11')]));});});};exports[_0x1c5b('0x18')]=function(_0x109383){var _0x529493=this;return new Promise(function(_0x48057e,_0x168909){return db['CmHopperHistory'][_0x1c5b('0x19')]({'raw':_0x109383['options']?_0x109383[_0x1c5b('0x1a')][_0x1c5b('0x17')]===undefined?!![]:![]:!![],'where':_0x109383[_0x1c5b('0x1a')]?_0x109383[_0x1c5b('0x1a')][_0x1c5b('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0x1c5b('0x1c'),db[_0x1c5b('0x1d')][_0x1c5b('0x1e')]('id')),_0x1c5b('0x1f')],[db[_0x1c5b('0x1d')]['fn'](_0x1c5b('0x1c'),db['sequelize']['fn']('IF',db[_0x1c5b('0x1d')][_0x1c5b('0x20')](_0x1c5b('0x21')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x1c5b('0x1c'),db['sequelize']['fn']('IF',db[_0x1c5b('0x1d')][_0x1c5b('0x20')](_0x1c5b('0x22')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x1c5b('0x1d')]['fn'](_0x1c5b('0x1c'),db[_0x1c5b('0x1d')]['fn']('IF',db[_0x1c5b('0x1d')][_0x1c5b('0x20')](_0x1c5b('0x23')))),_0x1c5b('0x24')],[db[_0x1c5b('0x1d')]['fn'](_0x1c5b('0x25'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x1c5b('0x26')))),_0x1c5b('0x27')],[db[_0x1c5b('0x1d')]['fn'](_0x1c5b('0x25'),db[_0x1c5b('0x1d')]['fn']('IF',db[_0x1c5b('0x1d')][_0x1c5b('0x20')](_0x1c5b('0x28')))),_0x1c5b('0x29')]]})['then'](function(_0x5eec45){logger[_0x1c5b('0xa')](_0x1c5b('0x18'),_0x109383);logger[_0x1c5b('0xc')](_0x1c5b('0x18'),_0x109383,JSON[_0x1c5b('0xf')](_0x5eec45));_0x48057e(_0x5eec45);})[_0x1c5b('0x13')](function(_0x5d1d30){logger[_0x1c5b('0x10')](_0x1c5b('0x18'),_0x5d1d30['message'],_0x109383);_0x168909(_0x529493[_0x1c5b('0x10')](0x1f4,_0x5d1d30[_0x1c5b('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x3294b1){var _0x1a6782=this;return new Promise(function(_0x3cd592,_0x2dd4b5){return db[_0x1c5b('0x2a')][_0x1c5b('0x19')]({'raw':_0x3294b1[_0x1c5b('0x1a')]?_0x3294b1['options'][_0x1c5b('0x17')]===undefined?!![]:![]:!![],'where':_0x3294b1[_0x1c5b('0x1a')]?_0x3294b1[_0x1c5b('0x1a')][_0x1c5b('0x1b')]||null:null,'attributes':[[_0x1c5b('0x2b'),'name'],[db[_0x1c5b('0x1d')]['fn'](_0x1c5b('0x1c'),db[_0x1c5b('0x1d')]['fn']('IF',db[_0x1c5b('0x1d')][_0x1c5b('0x20')](_0x1c5b('0x2c')))),'outboundNoSuchCallsDay'],[db[_0x1c5b('0x1d')]['fn'](_0x1c5b('0x1c'),db[_0x1c5b('0x1d')]['fn']('IF',db['sequelize'][_0x1c5b('0x20')](_0x1c5b('0x2d')))),_0x1c5b('0x2e')],[db[_0x1c5b('0x1d')]['fn'](_0x1c5b('0x1c'),db['sequelize']['fn']('IF',db[_0x1c5b('0x1d')][_0x1c5b('0x20')](_0x1c5b('0x21')))),_0x1c5b('0x2f')],[db[_0x1c5b('0x1d')]['fn']('COUNT',db[_0x1c5b('0x1d')]['fn']('IF',db[_0x1c5b('0x1d')][_0x1c5b('0x20')](_0x1c5b('0x30')))),_0x1c5b('0x31')],[db[_0x1c5b('0x1d')]['fn'](_0x1c5b('0x1c'),db[_0x1c5b('0x1d')]['fn']('IF',db['sequelize'][_0x1c5b('0x20')](_0x1c5b('0x32')))),_0x1c5b('0x33')],[db[_0x1c5b('0x1d')]['fn']('COUNT',db[_0x1c5b('0x1d')]['fn']('IF',db[_0x1c5b('0x1d')][_0x1c5b('0x20')](_0x1c5b('0x34')))),_0x1c5b('0x35')],[db['sequelize']['fn'](_0x1c5b('0x1c'),db[_0x1c5b('0x1d')]['fn']('IF',db['sequelize'][_0x1c5b('0x20')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1c5b('0x36')],[db[_0x1c5b('0x1d')]['fn'](_0x1c5b('0x1c'),db[_0x1c5b('0x1d')]['fn']('IF',db[_0x1c5b('0x1d')][_0x1c5b('0x20')](_0x1c5b('0x37')))),_0x1c5b('0x38')],[db['sequelize']['fn'](_0x1c5b('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x1c5b('0x39')))),'outboundBlacklistCallsDay'],[db[_0x1c5b('0x1d')]['fn']('COUNT',db[_0x1c5b('0x1d')]['fn']('IF',db[_0x1c5b('0x1d')][_0x1c5b('0x20')](_0x1c5b('0x3a')))),'outboundOriginateFailureCallsDay'],[db[_0x1c5b('0x1d')]['fn'](_0x1c5b('0x1c'),db[_0x1c5b('0x1d')]['fn']('IF',db[_0x1c5b('0x1d')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x1c5b('0x3b')],[db[_0x1c5b('0x1d')]['fn'](_0x1c5b('0x1c'),db[_0x1c5b('0x1d')]['fn']('IF',db[_0x1c5b('0x1d')][_0x1c5b('0x20')](_0x1c5b('0x3c')))),_0x1c5b('0x3d')],[db[_0x1c5b('0x1d')]['fn'](_0x1c5b('0x1c'),db[_0x1c5b('0x1d')]['fn']('IF',db['sequelize'][_0x1c5b('0x20')]('`state`\x20=\x2020,\x201,\x20null'))),_0x1c5b('0x3b')],[db[_0x1c5b('0x1d')]['fn'](_0x1c5b('0x1c'),db[_0x1c5b('0x1d')]['fn']('IF',db[_0x1c5b('0x1d')][_0x1c5b('0x20')](_0x1c5b('0x3e')))),_0x1c5b('0x3f')]],'group':['campaign']})[_0x1c5b('0x9')](function(_0xb65b3e){logger[_0x1c5b('0xa')](_0x1c5b('0x40'),_0x3294b1);logger['debug']('GetVoiceQueueHopperHistory',_0x3294b1,JSON[_0x1c5b('0xf')](_0xb65b3e));_0x3cd592(_0xb65b3e);})['catch'](function(_0x2e574d){logger[_0x1c5b('0x10')]('GetVoiceQueueHopperHistory',_0x2e574d[_0x1c5b('0x11')],_0x3294b1);_0x2dd4b5(_0x1a6782[_0x1c5b('0x10')](0x1f4,_0x2e574d[_0x1c5b('0x11')]));});});};exports[_0x1c5b('0x41')]=function(_0x513684){var _0x2a85e9=this;return new Promise(function(_0x2ec550,_0x20bba1){return db['CmHopperHistory'][_0x1c5b('0x19')]({'raw':_0x513684[_0x1c5b('0x1a')]?_0x513684[_0x1c5b('0x1a')][_0x1c5b('0x17')]===undefined?!![]:![]:!![],'where':_0x513684['options']?_0x513684[_0x1c5b('0x1a')][_0x1c5b('0x1b')]||null:null,'attributes':[['campaign',_0x1c5b('0x42')],[db[_0x1c5b('0x1d')]['fn'](_0x1c5b('0x1c'),db['sequelize'][_0x1c5b('0x1e')]('id')),_0x1c5b('0x43')],[db[_0x1c5b('0x1d')]['fn'](_0x1c5b('0x1c'),db[_0x1c5b('0x1d')]['fn']('IF',db[_0x1c5b('0x1d')][_0x1c5b('0x20')](_0x1c5b('0x21')))),_0x1c5b('0x44')]],'group':[_0x1c5b('0x2b')]})[_0x1c5b('0x9')](function(_0x38bbff){logger['info']('GetCampaignHopperHistory',_0x513684);logger[_0x1c5b('0xc')](_0x1c5b('0x41'),_0x513684,JSON[_0x1c5b('0xf')](_0x38bbff));_0x2ec550(_0x38bbff);})[_0x1c5b('0x13')](function(_0x414b60){logger[_0x1c5b('0x10')](_0x1c5b('0x41'),_0x414b60[_0x1c5b('0x11')],_0x513684);_0x20bba1(_0x2a85e9[_0x1c5b('0x10')](0x1f4,_0x414b60['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index f12b32a..c774266 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 _0x7b8e=['put','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','create'];(function(_0x365ac1,_0x51d0ef){var _0x3e9aad=function(_0x2dbc19){while(--_0x2dbc19){_0x365ac1['push'](_0x365ac1['shift']());}};_0x3e9aad(++_0x51d0ef);}(_0x7b8e,0x1a2));var _0xe7b8=function(_0x3e4f5a,_0x3cefc4){_0x3e4f5a=_0x3e4f5a-0x0;var _0x364f78=_0x7b8e[_0x3e4f5a];return _0x364f78;};'use strict';var multer=require('multer');var util=require(_0xe7b8('0x0'));var path=require('path');var timeout=require(_0xe7b8('0x1'));var express=require(_0xe7b8('0x2'));var router=express[_0xe7b8('0x3')]();var fs_extra=require(_0xe7b8('0x4'));var auth=require(_0xe7b8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe7b8('0x6'));var controller=require('./cmHopperHistory.controller');router[_0xe7b8('0x7')]('/',auth[_0xe7b8('0x8')](),controller[_0xe7b8('0x9')]);router['get'](_0xe7b8('0xa'),auth[_0xe7b8('0x8')](),controller[_0xe7b8('0xb')]);router[_0xe7b8('0x7')]('/:id',auth[_0xe7b8('0x8')](),controller[_0xe7b8('0xc')]);router['post']('/',auth[_0xe7b8('0x8')](),controller[_0xe7b8('0xd')]);router[_0xe7b8('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0xe7b8('0xf')]=router; \ No newline at end of file +var _0xb1f0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','multer','util'];(function(_0x2ca116,_0x4be94c){var _0x123ce2=function(_0x15be9a){while(--_0x15be9a){_0x2ca116['push'](_0x2ca116['shift']());}};_0x123ce2(++_0x4be94c);}(_0xb1f0,0x19c));var _0x0b1f=function(_0x2ed119,_0x3e16aa){_0x2ed119=_0x2ed119-0x0;var _0x458cd3=_0xb1f0[_0x2ed119];return _0x458cd3;};'use strict';var multer=require(_0x0b1f('0x0'));var util=require(_0x0b1f('0x1'));var path=require('path');var timeout=require(_0x0b1f('0x2'));var express=require(_0x0b1f('0x3'));var router=express[_0x0b1f('0x4')]();var fs_extra=require(_0x0b1f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0b1f('0x6'));var config=require(_0x0b1f('0x7'));var controller=require(_0x0b1f('0x8'));router[_0x0b1f('0x9')]('/',auth['isAuthenticated'](),controller[_0x0b1f('0xa')]);router[_0x0b1f('0x9')](_0x0b1f('0xb'),auth[_0x0b1f('0xc')](),controller[_0x0b1f('0xd')]);router[_0x0b1f('0x9')](_0x0b1f('0xe'),auth[_0x0b1f('0xc')](),controller[_0x0b1f('0xf')]);router[_0x0b1f('0x10')]('/',auth[_0x0b1f('0xc')](),controller[_0x0b1f('0x11')]);router['put'](_0x0b1f('0xe'),auth[_0x0b1f('0xc')](),controller['update']);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 25e1547..b2ea2bb 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 _0x639d=['STRING','sequelize','exports'];(function(_0x24b3fe,_0x878967){var _0x330c64=function(_0x3ede79){while(--_0x3ede79){_0x24b3fe['push'](_0x24b3fe['shift']());}};_0x330c64(++_0x878967);}(_0x639d,0xbb));var _0xd639=function(_0x1f632a,_0x59972b){_0x1f632a=_0x1f632a-0x0;var _0x473d31=_0x639d[_0x1f632a];return _0x473d31;};'use strict';var Sequelize=require(_0xd639('0x0'));module[_0xd639('0x1')]={'name':{'type':Sequelize[_0xd639('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd639('0x2')]},'dialPrefix':{'type':Sequelize[_0xd639('0x2')]}}; \ No newline at end of file +var _0x046b=['exports','STRING','name'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0x046b,0x147));var _0xb046=function(_0x42af9f,_0x15463e){_0x42af9f=_0x42af9f-0x0;var _0x3c94c5=_0x046b[_0x42af9f];return _0x3c94c5;};'use strict';var Sequelize=require('sequelize');module[_0xb046('0x0')]={'name':{'type':Sequelize[_0xb046('0x1')],'unique':_0xb046('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb046('0x1')]},'dialPrefix':{'type':Sequelize[_0xb046('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 3e55485..9a86677 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 _0x705e=['isEmpty','now','writeFileSync','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','sendStatus','addCustomField','findOne','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./cmList.socket','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','get','Lists','destroy','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','intersection','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','addDisposition','ListId','Disposition','filter','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CustomFields','format','cf_%d','order','raw','CmCustomField'];(function(_0x49eaca,_0x2ea569){var _0x3598bd=function(_0x3df3c3){while(--_0x3df3c3){_0x49eaca['push'](_0x49eaca['shift']());}};_0x3598bd(++_0x2ea569);}(_0x705e,0x146));var _0xe705=function(_0x12f8c6,_0x54d2d8){_0x12f8c6=_0x12f8c6-0x0;var _0xe9ae4a=_0x705e[_0x12f8c6];return _0xe9ae4a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe705('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe705('0x1'));var rp=require(_0xe705('0x2'));var moment=require('moment');var BPromise=require(_0xe705('0x3'));var Mustache=require(_0xe705('0x4'));var util=require(_0xe705('0x5'));var path=require(_0xe705('0x6'));var sox=require(_0xe705('0x7'));var csv=require(_0xe705('0x8'));var ejs=require(_0xe705('0x9'));var fs=require('fs');var fs_extra=require(_0xe705('0xa'));var _=require(_0xe705('0xb'));var squel=require(_0xe705('0xc'));var crypto=require(_0xe705('0xd'));var jsforce=require(_0xe705('0xe'));var deskjs=require(_0xe705('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe705('0x10'));var Papa=require(_0xe705('0x11'));var Redis=require('ioredis');var authService=require(_0xe705('0x12'));var qs=require(_0xe705('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe705('0x14'))(_0xe705('0x15'));var utils=require(_0xe705('0x16'));var config=require(_0xe705('0x17'));var licenseUtil=require(_0xe705('0x18'));var db=require('../../mysqldb')['db'];config[_0xe705('0x19')]=_[_0xe705('0x1a')](config[_0xe705('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe705('0x1b'))(new Redis(config[_0xe705('0x19')]));require(_0xe705('0x1c'))['register'](socket);function respondWithStatusCode(_0x3f591a,_0x4430b7){_0x4430b7=_0x4430b7||0xcc;return function(_0x5e7b04){if(_0x5e7b04){return _0x3f591a['sendStatus'](_0x4430b7);}return _0x3f591a['status'](_0x4430b7)[_0xe705('0x1d')]();};}function respondWithResult(_0x213b1b,_0x33c832){_0x33c832=_0x33c832||0xc8;return function(_0x3f2fa0){if(_0x3f2fa0){return _0x213b1b['status'](_0x33c832)[_0xe705('0x1e')](_0x3f2fa0);}};}function respondWithFilteredResult(_0x4689c6,_0xea9b5e){return function(_0x170223){if(_0x170223){var _0x56e384=typeof _0xea9b5e[_0xe705('0x1f')]===_0xe705('0x20')&&typeof _0xea9b5e[_0xe705('0x21')]===_0xe705('0x20');var _0x3e86df=_0x170223[_0xe705('0x22')];var _0x48d37d=_0x56e384?0x0:_0xea9b5e[_0xe705('0x1f')];var _0x23a3cc=_0x56e384?_0x170223['count']:_0xea9b5e[_0xe705('0x1f')]+_0xea9b5e[_0xe705('0x21')];var _0x28ae6a;if(_0x23a3cc>=_0x3e86df){_0x23a3cc=_0x3e86df;_0x28ae6a=0xc8;}else{_0x28ae6a=0xce;}_0x4689c6[_0xe705('0x23')](_0x28ae6a);return _0x4689c6[_0xe705('0x24')](_0xe705('0x25'),_0x48d37d+'-'+_0x23a3cc+'/'+_0x3e86df)['json'](_0x170223);}return null;};}function patchUpdates(_0x5d0e29){return function(_0x150aa5){try{jsonpatch[_0xe705('0x26')](_0x150aa5,_0x5d0e29,!![]);}catch(_0x39592a){return BPromise[_0xe705('0x27')](_0x39592a);}return _0x150aa5[_0xe705('0x28')]();};}function saveUpdates(_0x27eec6,_0x48fb70){return function(_0x30f9f6){if(_0x30f9f6){return _0x30f9f6['update'](_0x27eec6)[_0xe705('0x29')](function(_0x54a1c1){return _0x54a1c1;});}return null;};}function removeEntity(_0x162639,_0x47a6c4){return function(_0x335dbf){if(_0x335dbf){return _0x335dbf['destroy']()[_0xe705('0x29')](function(){var _0x20d97d=_0x335dbf[_0xe705('0x2a')]({'plain':!![]});var _0x282ee5=_0xe705('0x2b');return db['UserProfileResource'][_0xe705('0x2c')]({'where':{'type':_0x282ee5,'resourceId':_0x20d97d['id']}})[_0xe705('0x29')](function(){return _0x335dbf;});})['then'](function(){_0x162639['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10cc77,_0x5db3df){return function(_0xdf6d0c){if(!_0xdf6d0c){_0x10cc77['sendStatus'](0x194);}return _0xdf6d0c;};}function handleError(_0x258971,_0x1e197a){_0x1e197a=_0x1e197a||0x1f4;return function(_0x10c2d3){logger['error'](_0x10c2d3[_0xe705('0x2d')]);if(_0x10c2d3[_0xe705('0x2e')]){delete _0x10c2d3['name'];}_0x258971[_0xe705('0x23')](_0x1e197a)[_0xe705('0x2f')](_0x10c2d3);};}exports[_0xe705('0x30')]=function(_0x3e01f6,_0x471744){var _0x34e0f6={},_0xabf52e={},_0x53413e={'count':0x0,'rows':[]};var _0x148524=_[_0xe705('0x31')](db[_0xe705('0x32')][_0xe705('0x33')],function(_0xf40f9f){return{'name':_0xf40f9f[_0xe705('0x34')],'type':_0xf40f9f[_0xe705('0x35')][_0xe705('0x36')]};});_0xabf52e['model']=_[_0xe705('0x31')](_0x148524,'name');_0xabf52e[_0xe705('0x37')]=_[_0xe705('0x38')](_0x3e01f6[_0xe705('0x37')]);_0xabf52e[_0xe705('0x39')]=_['intersection'](_0xabf52e[_0xe705('0x3a')],_0xabf52e[_0xe705('0x37')]);_0x34e0f6[_0xe705('0x3b')]=_['intersection'](_0xabf52e[_0xe705('0x3a')],qs['fields'](_0x3e01f6[_0xe705('0x37')][_0xe705('0x3c')]));_0x34e0f6[_0xe705('0x3b')]=_0x34e0f6[_0xe705('0x3b')][_0xe705('0x3d')]?_0x34e0f6[_0xe705('0x3b')]:_0xabf52e['model'];if(!_0x3e01f6[_0xe705('0x37')][_0xe705('0x3e')](_0xe705('0x3f'))){_0x34e0f6[_0xe705('0x21')]=qs[_0xe705('0x21')](_0x3e01f6[_0xe705('0x37')][_0xe705('0x21')]);_0x34e0f6[_0xe705('0x1f')]=qs['offset'](_0x3e01f6[_0xe705('0x37')]['offset']);}_0x34e0f6['order']=qs[_0xe705('0x40')](_0x3e01f6[_0xe705('0x37')][_0xe705('0x40')]);_0x34e0f6[_0xe705('0x41')]=qs['filters'](_[_0xe705('0x42')](_0x3e01f6['query'],_0xabf52e['filters']),_0x148524);if(_0x3e01f6[_0xe705('0x37')]['filter']){_0x34e0f6['where']=_[_0xe705('0x43')](_0x34e0f6['where'],{'$or':_['map'](_0x148524,function(_0x93994c){if(_0x93994c['type']!==_0xe705('0x44')){var _0x336906={};_0x336906[_0x93994c[_0xe705('0x2e')]]={'$like':'%'+_0x3e01f6[_0xe705('0x37')]['filter']+'%'};return _0x336906;}})});}_0x34e0f6=_['merge']({},_0x34e0f6,_0x3e01f6[_0xe705('0x45')]);var _0x38422c={'where':_0x34e0f6[_0xe705('0x41')]};return db[_0xe705('0x32')][_0xe705('0x22')](_0x38422c)[_0xe705('0x29')](function(_0x5cb56e){_0x53413e[_0xe705('0x22')]=_0x5cb56e;if(_0x3e01f6['query'][_0xe705('0x46')]){_0x34e0f6['include']=[{'all':!![]}];}return db[_0xe705('0x32')][_0xe705('0x47')](_0x34e0f6);})['then'](function(_0x22027a){_0x53413e[_0xe705('0x48')]=_0x22027a;return _0x53413e;})['then'](respondWithFilteredResult(_0x471744,_0x34e0f6))[_0xe705('0x49')](handleError(_0x471744,null));};exports[_0xe705('0x4a')]=function(_0x220bff,_0x1654bf){var _0x42e7a6={'raw':![],'where':{'id':_0x220bff['params']['id']}},_0xd47c7a={};_0xd47c7a[_0xe705('0x3a')]=_[_0xe705('0x38')](db[_0xe705('0x32')][_0xe705('0x33')]);_0xd47c7a[_0xe705('0x37')]=_[_0xe705('0x38')](_0x220bff['query']);_0xd47c7a[_0xe705('0x39')]=_[_0xe705('0x4b')](_0xd47c7a['model'],_0xd47c7a[_0xe705('0x37')]);_0x42e7a6[_0xe705('0x3b')]=_[_0xe705('0x4b')](_0xd47c7a[_0xe705('0x3a')],qs[_0xe705('0x3c')](_0x220bff['query']['fields']));_0x42e7a6['attributes']=_0x42e7a6[_0xe705('0x3b')][_0xe705('0x3d')]?_0x42e7a6[_0xe705('0x3b')]:_0xd47c7a['model'];if(_0x220bff[_0xe705('0x37')][_0xe705('0x46')]){_0x42e7a6[_0xe705('0x4c')]=[{'all':!![]}];}_0x42e7a6=_[_0xe705('0x43')]({},_0x42e7a6,_0x220bff[_0xe705('0x45')]);return db[_0xe705('0x32')][_0xe705('0x4d')](_0x42e7a6)['then'](handleEntityNotFound(_0x1654bf,null))['then'](respondWithResult(_0x1654bf,null))[_0xe705('0x49')](handleError(_0x1654bf,null));};exports[_0xe705('0x4e')]=function(_0xd74eb2,_0x5706d2){return db[_0xe705('0x32')][_0xe705('0x4e')](_0xd74eb2['body'],{})[_0xe705('0x29')](function(_0x4b4173){var _0x206f69=_0xd74eb2[_0xe705('0x4f')][_0xe705('0x2a')]({'plain':!![]});if(!_0x206f69)throw new Error(_0xe705('0x50'));if(_0x206f69[_0xe705('0x51')]==='user'){var _0x61d19c=_0x4b4173[_0xe705('0x2a')]({'plain':!![]});var _0x368aed=_0xe705('0x2b');return db[_0xe705('0x52')]['find']({'where':{'name':_0x368aed,'userProfileId':_0x206f69['userProfileId']},'raw':!![]})[_0xe705('0x29')](function(_0x2c512e){if(_0x2c512e&&_0x2c512e[_0xe705('0x53')]===0x0){return db['UserProfileResource'][_0xe705('0x4e')]({'name':_0x61d19c[_0xe705('0x2e')],'resourceId':_0x61d19c['id'],'type':_0x2c512e[_0xe705('0x2e')],'sectionId':_0x2c512e['id']},{})['then'](function(){return _0x4b4173;});}else{return _0x4b4173;}})[_0xe705('0x49')](function(_0xd2035c){logger[_0xe705('0x54')](_0xe705('0x55'),_0xd2035c);throw _0xd2035c;});}return _0x4b4173;})[_0xe705('0x29')](respondWithResult(_0x5706d2,0xc9))[_0xe705('0x49')](handleError(_0x5706d2,null));};exports[_0xe705('0x56')]=function(_0x179954,_0x5f4768){if(_0x179954[_0xe705('0x57')]['id']){delete _0x179954[_0xe705('0x57')]['id'];}return db['CmList'][_0xe705('0x4d')]({'where':{'id':_0x179954[_0xe705('0x58')]['id']}})[_0xe705('0x29')](handleEntityNotFound(_0x5f4768,null))[_0xe705('0x29')](saveUpdates(_0x179954[_0xe705('0x57')],null))[_0xe705('0x29')](respondWithResult(_0x5f4768,null))[_0xe705('0x49')](handleError(_0x5f4768,null));};exports['destroy']=function(_0x13b4f9,_0x3cb92a){return db[_0xe705('0x32')]['find']({'where':{'id':_0x13b4f9[_0xe705('0x58')]['id']}})[_0xe705('0x29')](handleEntityNotFound(_0x3cb92a,null))[_0xe705('0x29')](removeEntity(_0x3cb92a,null))[_0xe705('0x49')](handleError(_0x3cb92a,null));};exports[_0xe705('0x59')]=function(_0x3446d4,_0x478d2d){return db[_0xe705('0x32')][_0xe705('0x59')]()[_0xe705('0x29')](respondWithResult(_0x478d2d,null))['catch'](handleError(_0x478d2d,null));};exports[_0xe705('0x5a')]=function(_0x1d0be5,_0x22f36a,_0x4e4e45){if(_0x1d0be5['body']['id']){delete _0x1d0be5[_0xe705('0x57')]['id'];}return db[_0xe705('0x32')][_0xe705('0x4d')]({'where':{'id':_0x1d0be5[_0xe705('0x58')]['id']}})[_0xe705('0x29')](handleEntityNotFound(_0x22f36a,null))[_0xe705('0x29')](function(_0x3fd75){if(_0x3fd75){_0x1d0be5[_0xe705('0x57')][_0xe705('0x5b')]=_0x3fd75['id'];return db['Disposition'][_0xe705('0x4e')](_0x1d0be5['body']);}})[_0xe705('0x29')](respondWithResult(_0x22f36a,null))[_0xe705('0x49')](handleError(_0x22f36a,null));};exports['getDispositions']=function(_0x1ebc78,_0x4ec50a,_0x18ee3a){var _0x64b859={'raw':![],'where':{}};var _0x112149={};var _0x31033b={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x1ebc78[_0xe705('0x58')]['id']}})['then'](handleEntityNotFound(_0x4ec50a,null))[_0xe705('0x29')](function(_0x31e879){if(_0x31e879){_0x112149[_0xe705('0x3a')]=_[_0xe705('0x38')](db[_0xe705('0x5c')][_0xe705('0x33')]);_0x112149[_0xe705('0x37')]=_['keys'](_0x1ebc78[_0xe705('0x37')]);_0x112149[_0xe705('0x39')]=_[_0xe705('0x4b')](_0x112149[_0xe705('0x3a')],_0x112149[_0xe705('0x37')]);_0x64b859[_0xe705('0x3b')]=_[_0xe705('0x4b')](_0x112149['model'],qs['fields'](_0x1ebc78['query'][_0xe705('0x3c')]));_0x64b859[_0xe705('0x3b')]=_0x64b859['attributes'][_0xe705('0x3d')]?_0x64b859['attributes']:_0x112149[_0xe705('0x3a')];if(!_0x1ebc78[_0xe705('0x37')][_0xe705('0x3e')](_0xe705('0x3f'))){_0x64b859[_0xe705('0x21')]=qs['limit'](_0x1ebc78[_0xe705('0x37')]['limit']);_0x64b859[_0xe705('0x1f')]=qs[_0xe705('0x1f')](_0x1ebc78['query']['offset']);}_0x64b859['order']=qs['sort'](_0x1ebc78[_0xe705('0x37')][_0xe705('0x40')]);_0x64b859[_0xe705('0x41')]=qs[_0xe705('0x39')](_[_0xe705('0x42')](_0x1ebc78[_0xe705('0x37')],_0x112149[_0xe705('0x39')]));_0x64b859[_0xe705('0x41')]['ListId']=_0x31e879['id'];if(_0x1ebc78[_0xe705('0x37')]['filter']){_0x64b859[_0xe705('0x41')]=_[_0xe705('0x43')](_0x64b859[_0xe705('0x41')],{'$or':_[_0xe705('0x31')](_0x64b859[_0xe705('0x3b')],function(_0x1f7311){var _0x13d3f9={};_0x13d3f9[_0x1f7311]={'$like':'%'+_0x1ebc78['query'][_0xe705('0x5d')]+'%'};return _0x13d3f9;})});}_0x64b859=_[_0xe705('0x43')]({},_0x64b859,_0x1ebc78['options']);return db[_0xe705('0x5c')][_0xe705('0x22')]({'where':_0x64b859[_0xe705('0x41')]})[_0xe705('0x29')](function(_0xd13033){_0x31033b['count']=_0xd13033;if(_0x1ebc78['query'][_0xe705('0x46')]){_0x64b859[_0xe705('0x4c')]=[{'all':!![]}];}return db[_0xe705('0x5c')]['findAll'](_0x64b859);})[_0xe705('0x29')](function(_0x5bcbf7){_0x31033b[_0xe705('0x48')]=_0x5bcbf7;return _0x31033b;});}})[_0xe705('0x29')](respondWithFilteredResult(_0x4ec50a,_0x64b859))['catch'](handleError(_0x4ec50a,null));};exports[_0xe705('0x5e')]=function(_0x12a08b,_0x261cf6,_0x108943){return db[_0xe705('0x32')][_0xe705('0x4d')]({'where':{'id':_0x12a08b[_0xe705('0x58')]['id']}})[_0xe705('0x29')](handleEntityNotFound(_0x261cf6,null))[_0xe705('0x29')](function(_0x2bf5fd){if(_0x2bf5fd){return _0x2bf5fd[_0xe705('0x5e')](_0x12a08b[_0xe705('0x37')][_0xe705('0x5f')]);}})[_0xe705('0x29')](respondWithStatusCode(_0x261cf6,null))[_0xe705('0x49')](handleError(_0x261cf6,null));};exports[_0xe705('0x60')]=function(_0x8c15c4,_0x21a9c,_0x5c5e3f){return db[_0xe705('0x32')][_0xe705('0x4d')]({'where':{'id':_0x8c15c4[_0xe705('0x58')]['id']}})[_0xe705('0x29')](handleEntityNotFound(_0x21a9c,null))[_0xe705('0x29')](function(_0x53cf63){if(_0x53cf63){var _0x3dc6f4=[];var _0x39a76c={'success':[],'errors':[]};return db[_0xe705('0x61')][_0xe705('0x59')]()[_0xe705('0x29')](function(_0x23b8c4){if(_0x8c15c4['body'][_0xe705('0x62')]&&_[_0xe705('0x63')](_0x8c15c4[_0xe705('0x57')][_0xe705('0x62')])){if(_0x8c15c4[_0xe705('0x57')][_0xe705('0x62')]['length']){_0x8c15c4[_0xe705('0x57')][_0xe705('0x62')]=_0x8c15c4[_0xe705('0x57')]['tags'][_0xe705('0x64')](';')+';';}else{_0x8c15c4['body'][_0xe705('0x62')]=null;}}else{_0x8c15c4[_0xe705('0x57')][_0xe705('0x62')]=null;}if(_0x8c15c4[_0xe705('0x57')]&&_['isArray'](_0x8c15c4[_0xe705('0x57')])){for(var _0x1a3635=0x0;_0x1a3635<_0x8c15c4[_0xe705('0x57')][_0xe705('0x3d')];_0x1a3635+=0x1){_0x8c15c4[_0xe705('0x57')][_0x1a3635][_0xe705('0x5b')]=_0x8c15c4['params']['id'];_0x3dc6f4[_0xe705('0x65')](_0x8c15c4['body'][_0x1a3635]);}return BPromise[_0xe705('0x66')](_0x3dc6f4,function(_0x327674){return db[_0xe705('0x61')]['create'](_[_0xe705('0x67')](_0x327674,[_0xe705('0x5f'),'id'])||{},{'fields':_[_0xe705('0x38')](_0x23b8c4),'raw':!![]})[_0xe705('0x29')](function(_0x16b43d){_0x39a76c[_0xe705('0x68')][_0xe705('0x65')](_0x16b43d[_0xe705('0x69')]);})[_0xe705('0x49')](function(_0x32ee74){_0x39a76c[_0xe705('0x6a')]['push']({'data':_0x327674,'error':_0x32ee74['message']});});})[_0xe705('0x29')](function(_0x3e2415){return _0x39a76c;})[_0xe705('0x49')](function(_0x3b6788){return _0x3b6788;});}else{_0x21a9c[_0xe705('0x23')](0x190)[_0xe705('0x1e')]({'message':_0xe705('0x6b')});}});}})[_0xe705('0x29')](respondWithResult(_0x21a9c,null))[_0xe705('0x49')](handleError(_0x21a9c,null));};exports[_0xe705('0x6c')]=function(_0x459cd1,_0x3e4b84,_0x5bf39d){var _0x2338c2;return db[_0xe705('0x32')][_0xe705('0x4d')]({'where':{'id':_0x459cd1[_0xe705('0x58')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xe705('0x6d')}]})['then'](handleEntityNotFound(_0x3e4b84,null))[_0xe705('0x29')](function(_0x3519f0){if(_0x3519f0){_0x2338c2=_0x3519f0;return db[_0xe705('0x61')][_0xe705('0x33')];}})[_0xe705('0x29')](function(_0x3a0bf3){if(_0x3a0bf3){var _0x736756={};var _0x566a6a={};_0x566a6a[_0xe705('0x3a')]=_['concat'](_['keys'](_0x3a0bf3),_[_0xe705('0x31')](_0x2338c2['CustomFields'],function(_0x25c476){return util[_0xe705('0x6e')](_0xe705('0x6f'),_0x25c476['id']);}));_0x566a6a[_0xe705('0x37')]=_[_0xe705('0x38')](_0x459cd1[_0xe705('0x37')]);_0x566a6a['filters']=_['intersection'](_0x566a6a[_0xe705('0x3a')],_0x566a6a[_0xe705('0x37')]);_0x736756[_0xe705('0x3b')]=_['intersection'](_0x566a6a[_0xe705('0x3a')],qs[_0xe705('0x3c')](_0x459cd1[_0xe705('0x37')][_0xe705('0x3c')]));_0x736756[_0xe705('0x3b')]=_0x736756[_0xe705('0x3b')]['length']?_0x736756[_0xe705('0x3b')]:_0x566a6a['model'];if(!_0x459cd1[_0xe705('0x37')][_0xe705('0x3e')](_0xe705('0x3f'))){_0x736756['limit']=qs['limit'](_0x459cd1['query'][_0xe705('0x21')]);_0x736756[_0xe705('0x1f')]=qs[_0xe705('0x1f')](_0x459cd1[_0xe705('0x37')][_0xe705('0x1f')]);}_0x736756[_0xe705('0x70')]=qs[_0xe705('0x40')](_0x459cd1[_0xe705('0x37')][_0xe705('0x40')]);_0x736756['where']=qs[_0xe705('0x39')](_[_0xe705('0x42')](_0x459cd1[_0xe705('0x37')],_0x566a6a[_0xe705('0x39')]));_0x736756[_0xe705('0x71')]=!![];if(_0x459cd1[_0xe705('0x37')][_0xe705('0x5d')]){_0x736756[_0xe705('0x41')]=_[_0xe705('0x43')](_0x736756[_0xe705('0x41')],{'$or':_['map'](_0x736756[_0xe705('0x3b')],function(_0x145086){var _0x3c449a={};_0x3c449a[_0x145086]={'$like':'%'+_0x459cd1['query'][_0xe705('0x5d')]+'%'};return _0x3c449a;})});}_0x736756=_[_0xe705('0x43')]({},_0x736756,_0x459cd1[_0xe705('0x45')]);return _0x2338c2['getContacts'](_0x736756);}})[_0xe705('0x29')](respondWithResult(_0x3e4b84,null))[_0xe705('0x49')](handleError(_0x3e4b84,null));};exports['getContactsCsv']=function(_0x25bf9a,_0x451e7c,_0x13eaad){var _0xc0150f;return db[_0xe705('0x32')][_0xe705('0x4d')]({'where':{'id':_0x25bf9a[_0xe705('0x58')]['id']},'include':[{'model':db[_0xe705('0x72')],'as':'CustomFields'}]})[_0xe705('0x29')](handleEntityNotFound(_0x451e7c,null))[_0xe705('0x29')](function(_0x10d3a8){if(_0x10d3a8){_0xc0150f=_0x10d3a8;return db['CmContact'][_0xe705('0x33')];}})[_0xe705('0x29')](function(_0x21395b){if(_0x21395b){var _0x4bb392={};var _0xf7c52c={};_0xf7c52c[_0xe705('0x3a')]=_['concat'](_[_0xe705('0x38')](_0x21395b),_[_0xe705('0x31')](_0xc0150f[_0xe705('0x6d')],function(_0x25ad7b){return util[_0xe705('0x6e')](_0xe705('0x6f'),_0x25ad7b['id']);}));_0xf7c52c[_0xe705('0x37')]=_[_0xe705('0x38')](_0x25bf9a[_0xe705('0x37')]);_0xf7c52c['filters']=_[_0xe705('0x4b')](_0xf7c52c['model'],_0xf7c52c['query']);_0x4bb392[_0xe705('0x3b')]=_[_0xe705('0x4b')](_0xf7c52c[_0xe705('0x3a')],qs['fields'](_0x25bf9a[_0xe705('0x37')][_0xe705('0x3c')]));_0x4bb392[_0xe705('0x3b')]=_0x4bb392[_0xe705('0x3b')][_0xe705('0x3d')]?_0x4bb392[_0xe705('0x3b')]:_0xf7c52c[_0xe705('0x3a')];if(!_0x25bf9a[_0xe705('0x37')][_0xe705('0x3e')](_0xe705('0x3f'))){_0x4bb392[_0xe705('0x21')]=qs[_0xe705('0x21')](_0x25bf9a['query'][_0xe705('0x21')]);_0x4bb392[_0xe705('0x1f')]=qs[_0xe705('0x1f')](_0x25bf9a[_0xe705('0x37')][_0xe705('0x1f')]);}_0x4bb392[_0xe705('0x70')]=qs[_0xe705('0x40')](_0x25bf9a[_0xe705('0x37')][_0xe705('0x40')]);_0x4bb392[_0xe705('0x41')]=qs[_0xe705('0x39')](_[_0xe705('0x42')](_0x25bf9a[_0xe705('0x37')],_0xf7c52c[_0xe705('0x39')]));_0x4bb392[_0xe705('0x71')]=!![];if(_0x25bf9a[_0xe705('0x37')][_0xe705('0x5d')]){_0x4bb392['where']=_['merge'](_0x4bb392[_0xe705('0x41')],{'$or':_[_0xe705('0x31')](_0x4bb392['attributes'],function(_0x3db05e){var _0x57dda0={};_0x57dda0[_0x3db05e]={'$like':'%'+_0x25bf9a['query'][_0xe705('0x5d')]+'%'};return _0x57dda0;})});}_0x4bb392=_[_0xe705('0x43')]({},_0x4bb392,_0x25bf9a[_0xe705('0x45')]);return _0xc0150f[_0xe705('0x6c')](_0x4bb392);}})[_0xe705('0x29')](function(_0x5887f2){if(!_[_0xe705('0x73')](_0x5887f2)){var _0x3e5334=toCsv(_0x5887f2);var _0x403422=Date[_0xe705('0x74')]();fs[_0xe705('0x75')](util['format']('/tmp/list_%d_%s.csv',_0xc0150f['id'],_0x403422),_0x3e5334);_0x451e7c[_0xe705('0x76')]('Content-disposition',_0xe705('0x77')+util[_0xe705('0x6e')](_0xe705('0x78'),_0xc0150f['id'],_0x403422));_0x451e7c[_0xe705('0x76')](_0xe705('0x79'),'text/csv');return _0x451e7c[_0xe705('0x7a')](util[_0xe705('0x6e')]('/tmp/list_%d_%s.csv',_0xc0150f['id'],_0x403422));}else{return _0x451e7c[_0xe705('0x7b')](0xcc);}})[_0xe705('0x49')](handleError(_0x451e7c,null));};exports[_0xe705('0x7c')]=function(_0x4e57cb,_0x2ab322,_0x2893b0){var _0x34ce47;delete _0x4e57cb[_0xe705('0x57')]['id'];return db[_0xe705('0x32')][_0xe705('0x7d')]({'where':{'id':_0x4e57cb['params']['id']}})['then'](handleEntityNotFound(_0x2ab322,null))[_0xe705('0x29')](function(_0x3b4eca){if(_0x3b4eca){return db[_0xe705('0x7e')][_0xe705('0x7f')](function(_0x4f8129){return db[_0xe705('0x72')][_0xe705('0x4e')](_0x4e57cb[_0xe705('0x57')],{'transaction':_0x4f8129})[_0xe705('0x29')](function(_0x430ed1){_0x34ce47=_0x430ed1;return _0x3b4eca['addCustomFields'](_0x430ed1,{'transaction':_0x4f8129});})[_0xe705('0x29')](function(){var _0x5204af={'type':db[_0xe705('0x80')][_0xe705('0x81')],'transaction':_0x4f8129};switch(_0x4e57cb['body'][_0xe705('0x35')]){case _0xe705('0x82'):_0x5204af['type']=db[_0xe705('0x80')][_0xe705('0x81')];break;case _0xe705('0x83'):_0x5204af[_0xe705('0x35')]=db[_0xe705('0x80')][_0xe705('0x84')];break;case _0xe705('0x85'):_0x5204af[_0xe705('0x35')]=db['Sequelize'][_0xe705('0x86')];_0x5204af[_0xe705('0x87')]=![];break;default:}return db[_0xe705('0x7e')][_0xe705('0x88')]['addColumn'](_0xe705('0x89'),util[_0xe705('0x6e')]('cf_%s',_0x34ce47['id']),_0x5204af);})[_0xe705('0x29')](function(){return _0x34ce47;});});}})[_0xe705('0x29')](respondWithResult(_0x2ab322,null))[_0xe705('0x49')](handleError(_0x2ab322,null));};exports[_0xe705('0x8a')]=function(_0x6a5cbd,_0x32c00b,_0x383420){var _0x2d2818={};var _0xa9f7c1={};var _0x223dd5;var _0x1c5204;return db[_0xe705('0x32')][_0xe705('0x7d')]({'where':{'id':_0x6a5cbd[_0xe705('0x58')]['id']}})[_0xe705('0x29')](handleEntityNotFound(_0x32c00b,null))['then'](function(_0x163d5f){if(_0x163d5f){_0x223dd5=_0x163d5f;_0xa9f7c1['model']=_[_0xe705('0x38')](db[_0xe705('0x72')]['rawAttributes']);_0xa9f7c1['query']=_[_0xe705('0x38')](_0x6a5cbd[_0xe705('0x37')]);_0xa9f7c1['filters']=_[_0xe705('0x4b')](_0xa9f7c1[_0xe705('0x3a')],_0xa9f7c1[_0xe705('0x37')]);_0x2d2818[_0xe705('0x3b')]=_[_0xe705('0x4b')](_0xa9f7c1[_0xe705('0x3a')],qs['fields'](_0x6a5cbd[_0xe705('0x37')][_0xe705('0x3c')]));_0x2d2818[_0xe705('0x3b')]=_0x2d2818['attributes']['length']?_0x2d2818[_0xe705('0x3b')]:_0xa9f7c1[_0xe705('0x3a')];_0x2d2818[_0xe705('0x70')]=qs[_0xe705('0x40')](_0x6a5cbd['query'][_0xe705('0x40')]);_0x2d2818[_0xe705('0x41')]=qs['filters'](_['pick'](_0x6a5cbd['query'],_0xa9f7c1['filters']));_0x2d2818[_0xe705('0x41')]=_[_0xe705('0x43')](_0x2d2818[_0xe705('0x41')],{'$or':[{'ListId':_0x163d5f['id']},{'ListId':null}]});if(_0x6a5cbd['query']['filter']){_0x2d2818[_0xe705('0x41')]=_['merge'](_0x2d2818['where'],{'$or':_['map'](_0x2d2818[_0xe705('0x3b')],function(_0x2c9588){var _0x1462ca={};_0x1462ca[_0x2c9588]={'$like':'%'+_0x6a5cbd[_0xe705('0x37')]['filter']+'%'};return _0x1462ca;})});}_0x2d2818=_[_0xe705('0x43')]({},_0x2d2818,_0x6a5cbd['options']);return db[_0xe705('0x72')][_0xe705('0x8b')](_0x2d2818);}})[_0xe705('0x29')](respondWithResult(_0x32c00b,null))[_0xe705('0x49')](handleError(_0x32c00b,null));};exports[_0xe705('0x8c')]=function(_0x4aa93f,_0x4d55f5,_0x3abb18){return db[_0xe705('0x32')][_0xe705('0x4d')]({'where':{'id':_0x4aa93f[_0xe705('0x58')]['id']}})[_0xe705('0x29')](handleEntityNotFound(_0x4d55f5,null))[_0xe705('0x29')](function(_0x2218a4){if(_0x2218a4){return _0x2218a4[_0xe705('0x8c')](_0x4aa93f[_0xe705('0x57')]['ids'],_['omit'](_0x4aa93f[_0xe705('0x57')],[_0xe705('0x5f'),'id'])||{})[_0xe705('0x8d')](function(_0x474988){for(var _0x3a33ae=0x0;_0x3a33ae<_0x4aa93f[_0xe705('0x57')][_0xe705('0x5f')][_0xe705('0x3d')];_0x3a33ae+=0x1){socket[_0xe705('0x8e')](_0xe705('0x8f'),{'UserId':Number(_0x4aa93f['body'][_0xe705('0x5f')][_0x3a33ae]),'CmListId':Number(_0x4aa93f['params']['id'])});}return _0x474988;});}})[_0xe705('0x29')](respondWithResult(_0x4d55f5,null))['catch'](handleError(_0x4d55f5,null));};exports['removeAgents']=function(_0x437a20,_0x3683c5,_0x4d3c52){return db[_0xe705('0x32')][_0xe705('0x4d')]({'where':{'id':_0x437a20[_0xe705('0x58')]['id']}})[_0xe705('0x29')](handleEntityNotFound(_0x3683c5,null))[_0xe705('0x29')](function(_0x55fd38){if(_0x55fd38){return _0x55fd38[_0xe705('0x90')](_0x437a20[_0xe705('0x37')][_0xe705('0x5f')])[_0xe705('0x29')](function(){if(_[_0xe705('0x63')](_0x437a20[_0xe705('0x37')]['ids'])){for(var _0x43c6b6=0x0;_0x43c6b6<_0x437a20['query'][_0xe705('0x5f')]['length'];_0x43c6b6+=0x1){socket[_0xe705('0x8e')](_0xe705('0x91'),{'UserId':Number(_0x437a20[_0xe705('0x37')][_0xe705('0x5f')][_0x43c6b6]),'CmListId':Number(_0x437a20[_0xe705('0x58')]['id'])});}}else{socket[_0xe705('0x8e')](_0xe705('0x91'),{'UserId':Number(_0x437a20[_0xe705('0x37')][_0xe705('0x5f')]),'CmListId':Number(_0x437a20[_0xe705('0x58')]['id'])});}});}})[_0xe705('0x29')](respondWithStatusCode(_0x3683c5,null))[_0xe705('0x49')](handleError(_0x3683c5,null));};exports[_0xe705('0x92')]=function(_0x404331,_0x181528,_0x5e9cc8){var _0x5f4c35={};var _0x3ea45b={};var _0x32cc92;var _0x17df2b;return db[_0xe705('0x32')][_0xe705('0x7d')]({'where':{'id':_0x404331[_0xe705('0x58')]['id']}})[_0xe705('0x29')](handleEntityNotFound(_0x181528,null))['then'](function(_0x20f859){if(_0x20f859){_0x32cc92=_0x20f859;_0x3ea45b[_0xe705('0x3a')]=_[_0xe705('0x38')](db['User'][_0xe705('0x33')]);_0x3ea45b[_0xe705('0x37')]=_['keys'](_0x404331[_0xe705('0x37')]);_0x3ea45b[_0xe705('0x39')]=_[_0xe705('0x4b')](_0x3ea45b['model'],_0x3ea45b['query']);_0x5f4c35[_0xe705('0x3b')]=_['intersection'](_0x3ea45b[_0xe705('0x3a')],qs[_0xe705('0x3c')](_0x404331[_0xe705('0x37')][_0xe705('0x3c')]));_0x5f4c35[_0xe705('0x3b')]=_0x5f4c35['attributes']['length']?_0x5f4c35[_0xe705('0x3b')]:_0x3ea45b[_0xe705('0x3a')];_0x5f4c35[_0xe705('0x70')]=qs[_0xe705('0x40')](_0x404331['query'][_0xe705('0x40')]);_0x5f4c35[_0xe705('0x41')]=qs[_0xe705('0x39')](_[_0xe705('0x42')](_0x404331[_0xe705('0x37')],_0x3ea45b[_0xe705('0x39')]));if(_0x404331[_0xe705('0x37')][_0xe705('0x5d')]){_0x5f4c35[_0xe705('0x41')]=_['merge'](_0x5f4c35[_0xe705('0x41')],{'$or':_[_0xe705('0x31')](_0x5f4c35[_0xe705('0x3b')],function(_0x3c132e){var _0xcfb12={};_0xcfb12[_0x3c132e]={'$like':'%'+_0x404331[_0xe705('0x37')]['filter']+'%'};return _0xcfb12;})});}_0x5f4c35=_[_0xe705('0x43')]({},_0x5f4c35,_0x404331[_0xe705('0x45')]);return _0x32cc92[_0xe705('0x92')](_0x5f4c35);}})[_0xe705('0x29')](function(_0x277b30){if(_0x277b30){_0x17df2b=_0x277b30[_0xe705('0x3d')];if(!_0x404331[_0xe705('0x37')][_0xe705('0x3e')]('nolimit')){_0x5f4c35['limit']=qs['limit'](_0x404331[_0xe705('0x37')][_0xe705('0x21')]);_0x5f4c35[_0xe705('0x1f')]=qs[_0xe705('0x1f')](_0x404331[_0xe705('0x37')][_0xe705('0x1f')]);}return _0x32cc92['getAgents'](_0x5f4c35);}})[_0xe705('0x29')](function(_0x21fbd5){if(_0x21fbd5){return _0x21fbd5?{'count':_0x17df2b,'rows':_0x21fbd5}:null;}})[_0xe705('0x29')](respondWithResult(_0x181528,null))[_0xe705('0x49')](handleError(_0x181528,null));}; \ No newline at end of file +var _0xb4a6=['writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','download','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','findOne','findAndCountAll','addAgents','emit','removeAgents','isArray','userCmList:remove','User','getAgents','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','update','then','destroy','get','Lists','UserProfileResource','error','name','send','index','CmList','fieldName','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getDispositions','Disposition','rawAttributes','sort','ListId','removeDispositions','addContacts','CmContact','tags','join','push','each','omit','ids','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','raw','cf_%d','isEmpty','now'];(function(_0x31d637,_0x55a9a7){var _0x493ae5=function(_0x441403){while(--_0x441403){_0x31d637['push'](_0x31d637['shift']());}};_0x493ae5(++_0x55a9a7);}(_0xb4a6,0x131));var _0x6b4a=function(_0x17646a,_0xcc6b0f){_0x17646a=_0x17646a-0x0;var _0x4357ca=_0xb4a6[_0x17646a];return _0x4357ca;};'use strict';var emlformat=require(_0x6b4a('0x0'));var rimraf=require(_0x6b4a('0x1'));var zipdir=require(_0x6b4a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b4a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6b4a('0x4'));var util=require(_0x6b4a('0x5'));var path=require(_0x6b4a('0x6'));var sox=require(_0x6b4a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b4a('0x8'));var _=require('lodash');var squel=require(_0x6b4a('0x9'));var crypto=require('crypto');var jsforce=require(_0x6b4a('0xa'));var deskjs=require(_0x6b4a('0xb'));var toCsv=require(_0x6b4a('0xc'));var querystring=require(_0x6b4a('0xd'));var Papa=require(_0x6b4a('0xe'));var Redis=require(_0x6b4a('0xf'));var authService=require(_0x6b4a('0x10'));var qs=require(_0x6b4a('0x11'));var as=require(_0x6b4a('0x12'));var hardwareService=require(_0x6b4a('0x13'));var logger=require(_0x6b4a('0x14'))('api');var utils=require(_0x6b4a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6b4a('0x16'))['db'];config[_0x6b4a('0x17')]=_[_0x6b4a('0x18')](config[_0x6b4a('0x17')],{'host':_0x6b4a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b4a('0x17')]));require(_0x6b4a('0x1a'))[_0x6b4a('0x1b')](socket);function respondWithStatusCode(_0x7dcd3f,_0x2c3cdd){_0x2c3cdd=_0x2c3cdd||0xcc;return function(_0x3c2284){if(_0x3c2284){return _0x7dcd3f[_0x6b4a('0x1c')](_0x2c3cdd);}return _0x7dcd3f[_0x6b4a('0x1d')](_0x2c3cdd)[_0x6b4a('0x1e')]();};}function respondWithResult(_0xfb0cff,_0x3e213e){_0x3e213e=_0x3e213e||0xc8;return function(_0x4f9419){if(_0x4f9419){return _0xfb0cff[_0x6b4a('0x1d')](_0x3e213e)['json'](_0x4f9419);}};}function respondWithFilteredResult(_0xcdc61,_0x4247f5){return function(_0x48f02e){if(_0x48f02e){var _0x13bc38=typeof _0x4247f5['offset']===_0x6b4a('0x1f')&&typeof _0x4247f5['limit']===_0x6b4a('0x1f');var _0x207923=_0x48f02e[_0x6b4a('0x20')];var _0x41ba22=_0x13bc38?0x0:_0x4247f5[_0x6b4a('0x21')];var _0x2b28de=_0x13bc38?_0x48f02e['count']:_0x4247f5[_0x6b4a('0x21')]+_0x4247f5[_0x6b4a('0x22')];var _0xf6b5df;if(_0x2b28de>=_0x207923){_0x2b28de=_0x207923;_0xf6b5df=0xc8;}else{_0xf6b5df=0xce;}_0xcdc61[_0x6b4a('0x1d')](_0xf6b5df);return _0xcdc61[_0x6b4a('0x23')](_0x6b4a('0x24'),_0x41ba22+'-'+_0x2b28de+'/'+_0x207923)[_0x6b4a('0x25')](_0x48f02e);}return null;};}function patchUpdates(_0xd50fc4){return function(_0x46aef2){try{jsonpatch[_0x6b4a('0x26')](_0x46aef2,_0xd50fc4,!![]);}catch(_0x168292){return BPromise['reject'](_0x168292);}return _0x46aef2['save']();};}function saveUpdates(_0x2f6664,_0x5abef0){return function(_0xd0b73){if(_0xd0b73){return _0xd0b73[_0x6b4a('0x27')](_0x2f6664)[_0x6b4a('0x28')](function(_0x11c94d){return _0x11c94d;});}return null;};}function removeEntity(_0x1ea254,_0x4dca8b){return function(_0x225a25){if(_0x225a25){return _0x225a25[_0x6b4a('0x29')]()[_0x6b4a('0x28')](function(){var _0x5a599a=_0x225a25[_0x6b4a('0x2a')]({'plain':!![]});var _0x5e7525=_0x6b4a('0x2b');return db[_0x6b4a('0x2c')][_0x6b4a('0x29')]({'where':{'type':_0x5e7525,'resourceId':_0x5a599a['id']}})[_0x6b4a('0x28')](function(){return _0x225a25;});})[_0x6b4a('0x28')](function(){_0x1ea254[_0x6b4a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2743fb,_0x24f6e5){return function(_0x4c1fac){if(!_0x4c1fac){_0x2743fb[_0x6b4a('0x1c')](0x194);}return _0x4c1fac;};}function handleError(_0x4f4b44,_0x466c86){_0x466c86=_0x466c86||0x1f4;return function(_0x3d8537){logger[_0x6b4a('0x2d')](_0x3d8537['stack']);if(_0x3d8537[_0x6b4a('0x2e')]){delete _0x3d8537['name'];}_0x4f4b44[_0x6b4a('0x1d')](_0x466c86)[_0x6b4a('0x2f')](_0x3d8537);};}exports[_0x6b4a('0x30')]=function(_0xce917b,_0x51162e){var _0x1125ca={},_0x11eae4={},_0x5cefb1={'count':0x0,'rows':[]};var _0x184f5d=_['map'](db[_0x6b4a('0x31')]['rawAttributes'],function(_0x46c6c8){return{'name':_0x46c6c8[_0x6b4a('0x32')],'type':_0x46c6c8['type'][_0x6b4a('0x33')]};});_0x11eae4[_0x6b4a('0x34')]=_[_0x6b4a('0x35')](_0x184f5d,_0x6b4a('0x2e'));_0x11eae4[_0x6b4a('0x36')]=_[_0x6b4a('0x37')](_0xce917b[_0x6b4a('0x36')]);_0x11eae4['filters']=_['intersection'](_0x11eae4[_0x6b4a('0x34')],_0x11eae4['query']);_0x1125ca[_0x6b4a('0x38')]=_[_0x6b4a('0x39')](_0x11eae4[_0x6b4a('0x34')],qs['fields'](_0xce917b[_0x6b4a('0x36')][_0x6b4a('0x3a')]));_0x1125ca[_0x6b4a('0x38')]=_0x1125ca[_0x6b4a('0x38')][_0x6b4a('0x3b')]?_0x1125ca['attributes']:_0x11eae4[_0x6b4a('0x34')];if(!_0xce917b[_0x6b4a('0x36')][_0x6b4a('0x3c')](_0x6b4a('0x3d'))){_0x1125ca['limit']=qs[_0x6b4a('0x22')](_0xce917b[_0x6b4a('0x36')][_0x6b4a('0x22')]);_0x1125ca[_0x6b4a('0x21')]=qs[_0x6b4a('0x21')](_0xce917b[_0x6b4a('0x36')][_0x6b4a('0x21')]);}_0x1125ca[_0x6b4a('0x3e')]=qs['sort'](_0xce917b[_0x6b4a('0x36')]['sort']);_0x1125ca[_0x6b4a('0x3f')]=qs[_0x6b4a('0x40')](_[_0x6b4a('0x41')](_0xce917b[_0x6b4a('0x36')],_0x11eae4[_0x6b4a('0x40')]),_0x184f5d);if(_0xce917b[_0x6b4a('0x36')]['filter']){_0x1125ca[_0x6b4a('0x3f')]=_[_0x6b4a('0x42')](_0x1125ca['where'],{'$or':_[_0x6b4a('0x35')](_0x184f5d,function(_0x2ba1da){if(_0x2ba1da[_0x6b4a('0x43')]!=='VIRTUAL'){var _0x595833={};_0x595833[_0x2ba1da[_0x6b4a('0x2e')]]={'$like':'%'+_0xce917b['query'][_0x6b4a('0x44')]+'%'};return _0x595833;}})});}_0x1125ca=_[_0x6b4a('0x42')]({},_0x1125ca,_0xce917b[_0x6b4a('0x45')]);var _0x356b60={'where':_0x1125ca[_0x6b4a('0x3f')]};return db[_0x6b4a('0x31')][_0x6b4a('0x20')](_0x356b60)[_0x6b4a('0x28')](function(_0x3c7c0c){_0x5cefb1['count']=_0x3c7c0c;if(_0xce917b[_0x6b4a('0x36')][_0x6b4a('0x46')]){_0x1125ca[_0x6b4a('0x47')]=[{'all':!![]}];}return db[_0x6b4a('0x31')][_0x6b4a('0x48')](_0x1125ca);})[_0x6b4a('0x28')](function(_0x51154b){_0x5cefb1[_0x6b4a('0x49')]=_0x51154b;return _0x5cefb1;})[_0x6b4a('0x28')](respondWithFilteredResult(_0x51162e,_0x1125ca))[_0x6b4a('0x4a')](handleError(_0x51162e,null));};exports['show']=function(_0x281fc9,_0x357b8f){var _0x45cadd={'raw':![],'where':{'id':_0x281fc9[_0x6b4a('0x4b')]['id']}},_0x1f6841={};_0x1f6841[_0x6b4a('0x34')]=_[_0x6b4a('0x37')](db[_0x6b4a('0x31')]['rawAttributes']);_0x1f6841[_0x6b4a('0x36')]=_[_0x6b4a('0x37')](_0x281fc9[_0x6b4a('0x36')]);_0x1f6841['filters']=_[_0x6b4a('0x39')](_0x1f6841[_0x6b4a('0x34')],_0x1f6841['query']);_0x45cadd['attributes']=_[_0x6b4a('0x39')](_0x1f6841[_0x6b4a('0x34')],qs['fields'](_0x281fc9['query'][_0x6b4a('0x3a')]));_0x45cadd['attributes']=_0x45cadd[_0x6b4a('0x38')][_0x6b4a('0x3b')]?_0x45cadd[_0x6b4a('0x38')]:_0x1f6841[_0x6b4a('0x34')];if(_0x281fc9[_0x6b4a('0x36')][_0x6b4a('0x46')]){_0x45cadd['include']=[{'all':!![]}];}_0x45cadd=_['merge']({},_0x45cadd,_0x281fc9['options']);return db['CmList'][_0x6b4a('0x4c')](_0x45cadd)[_0x6b4a('0x28')](handleEntityNotFound(_0x357b8f,null))[_0x6b4a('0x28')](respondWithResult(_0x357b8f,null))[_0x6b4a('0x4a')](handleError(_0x357b8f,null));};exports['create']=function(_0xe2b5ca,_0x4271e0){return db['CmList'][_0x6b4a('0x4d')](_0xe2b5ca['body'],{})[_0x6b4a('0x28')](function(_0x1bde7a){var _0x4fd0fe=_0xe2b5ca['user'][_0x6b4a('0x2a')]({'plain':!![]});if(!_0x4fd0fe)throw new Error(_0x6b4a('0x4e'));if(_0x4fd0fe[_0x6b4a('0x4f')]==='user'){var _0x1c2862=_0x1bde7a[_0x6b4a('0x2a')]({'plain':!![]});var _0x577ff1=_0x6b4a('0x2b');return db['UserProfileSection'][_0x6b4a('0x4c')]({'where':{'name':_0x577ff1,'userProfileId':_0x4fd0fe[_0x6b4a('0x50')]},'raw':!![]})[_0x6b4a('0x28')](function(_0x5941a9){if(_0x5941a9&&_0x5941a9[_0x6b4a('0x51')]===0x0){return db[_0x6b4a('0x2c')][_0x6b4a('0x4d')]({'name':_0x1c2862[_0x6b4a('0x2e')],'resourceId':_0x1c2862['id'],'type':_0x5941a9[_0x6b4a('0x2e')],'sectionId':_0x5941a9['id']},{})[_0x6b4a('0x28')](function(){return _0x1bde7a;});}else{return _0x1bde7a;}})[_0x6b4a('0x4a')](function(_0x4979dc){logger[_0x6b4a('0x2d')](_0x6b4a('0x52'),_0x4979dc);throw _0x4979dc;});}return _0x1bde7a;})['then'](respondWithResult(_0x4271e0,0xc9))[_0x6b4a('0x4a')](handleError(_0x4271e0,null));};exports[_0x6b4a('0x27')]=function(_0x2eb5e5,_0x581a3c){if(_0x2eb5e5['body']['id']){delete _0x2eb5e5[_0x6b4a('0x53')]['id'];}return db['CmList'][_0x6b4a('0x4c')]({'where':{'id':_0x2eb5e5[_0x6b4a('0x4b')]['id']}})[_0x6b4a('0x28')](handleEntityNotFound(_0x581a3c,null))['then'](saveUpdates(_0x2eb5e5[_0x6b4a('0x53')],null))[_0x6b4a('0x28')](respondWithResult(_0x581a3c,null))[_0x6b4a('0x4a')](handleError(_0x581a3c,null));};exports[_0x6b4a('0x29')]=function(_0x5e428a,_0x245d27){return db['CmList']['find']({'where':{'id':_0x5e428a[_0x6b4a('0x4b')]['id']}})[_0x6b4a('0x28')](handleEntityNotFound(_0x245d27,null))[_0x6b4a('0x28')](removeEntity(_0x245d27,null))[_0x6b4a('0x4a')](handleError(_0x245d27,null));};exports[_0x6b4a('0x54')]=function(_0x462746,_0x39dd10){return db[_0x6b4a('0x31')][_0x6b4a('0x54')]()[_0x6b4a('0x28')](respondWithResult(_0x39dd10,null))['catch'](handleError(_0x39dd10,null));};exports['addDisposition']=function(_0x245010,_0x50cad1,_0x11227e){if(_0x245010[_0x6b4a('0x53')]['id']){delete _0x245010['body']['id'];}return db[_0x6b4a('0x31')][_0x6b4a('0x4c')]({'where':{'id':_0x245010['params']['id']}})[_0x6b4a('0x28')](handleEntityNotFound(_0x50cad1,null))['then'](function(_0xddbcbf){if(_0xddbcbf){_0x245010[_0x6b4a('0x53')]['ListId']=_0xddbcbf['id'];return db['Disposition'][_0x6b4a('0x4d')](_0x245010[_0x6b4a('0x53')]);}})[_0x6b4a('0x28')](respondWithResult(_0x50cad1,null))[_0x6b4a('0x4a')](handleError(_0x50cad1,null));};exports[_0x6b4a('0x55')]=function(_0x369598,_0x53bde4,_0x575134){var _0x501e90={'raw':![],'where':{}};var _0x5bb0f6={};var _0xc51c08={'count':0x0,'rows':[]};return db[_0x6b4a('0x31')]['findOne']({'where':{'id':_0x369598[_0x6b4a('0x4b')]['id']}})[_0x6b4a('0x28')](handleEntityNotFound(_0x53bde4,null))['then'](function(_0x18814f){if(_0x18814f){_0x5bb0f6[_0x6b4a('0x34')]=_[_0x6b4a('0x37')](db[_0x6b4a('0x56')][_0x6b4a('0x57')]);_0x5bb0f6[_0x6b4a('0x36')]=_[_0x6b4a('0x37')](_0x369598['query']);_0x5bb0f6['filters']=_[_0x6b4a('0x39')](_0x5bb0f6[_0x6b4a('0x34')],_0x5bb0f6['query']);_0x501e90[_0x6b4a('0x38')]=_[_0x6b4a('0x39')](_0x5bb0f6[_0x6b4a('0x34')],qs['fields'](_0x369598['query']['fields']));_0x501e90[_0x6b4a('0x38')]=_0x501e90['attributes'][_0x6b4a('0x3b')]?_0x501e90['attributes']:_0x5bb0f6[_0x6b4a('0x34')];if(!_0x369598['query'][_0x6b4a('0x3c')](_0x6b4a('0x3d'))){_0x501e90[_0x6b4a('0x22')]=qs[_0x6b4a('0x22')](_0x369598[_0x6b4a('0x36')][_0x6b4a('0x22')]);_0x501e90[_0x6b4a('0x21')]=qs[_0x6b4a('0x21')](_0x369598[_0x6b4a('0x36')][_0x6b4a('0x21')]);}_0x501e90['order']=qs[_0x6b4a('0x58')](_0x369598[_0x6b4a('0x36')]['sort']);_0x501e90[_0x6b4a('0x3f')]=qs[_0x6b4a('0x40')](_[_0x6b4a('0x41')](_0x369598[_0x6b4a('0x36')],_0x5bb0f6[_0x6b4a('0x40')]));_0x501e90[_0x6b4a('0x3f')][_0x6b4a('0x59')]=_0x18814f['id'];if(_0x369598['query'][_0x6b4a('0x44')]){_0x501e90['where']=_[_0x6b4a('0x42')](_0x501e90[_0x6b4a('0x3f')],{'$or':_['map'](_0x501e90['attributes'],function(_0x53698e){var _0x3a43ce={};_0x3a43ce[_0x53698e]={'$like':'%'+_0x369598[_0x6b4a('0x36')][_0x6b4a('0x44')]+'%'};return _0x3a43ce;})});}_0x501e90=_[_0x6b4a('0x42')]({},_0x501e90,_0x369598[_0x6b4a('0x45')]);return db[_0x6b4a('0x56')]['count']({'where':_0x501e90[_0x6b4a('0x3f')]})[_0x6b4a('0x28')](function(_0x4ba070){_0xc51c08[_0x6b4a('0x20')]=_0x4ba070;if(_0x369598['query']['includeAll']){_0x501e90[_0x6b4a('0x47')]=[{'all':!![]}];}return db[_0x6b4a('0x56')][_0x6b4a('0x48')](_0x501e90);})[_0x6b4a('0x28')](function(_0x4c4ec8){_0xc51c08[_0x6b4a('0x49')]=_0x4c4ec8;return _0xc51c08;});}})['then'](respondWithFilteredResult(_0x53bde4,_0x501e90))[_0x6b4a('0x4a')](handleError(_0x53bde4,null));};exports[_0x6b4a('0x5a')]=function(_0x2c9d1c,_0x217e99,_0x12ec80){return db[_0x6b4a('0x31')][_0x6b4a('0x4c')]({'where':{'id':_0x2c9d1c[_0x6b4a('0x4b')]['id']}})[_0x6b4a('0x28')](handleEntityNotFound(_0x217e99,null))[_0x6b4a('0x28')](function(_0x28c379){if(_0x28c379){return _0x28c379[_0x6b4a('0x5a')](_0x2c9d1c['query']['ids']);}})[_0x6b4a('0x28')](respondWithStatusCode(_0x217e99,null))[_0x6b4a('0x4a')](handleError(_0x217e99,null));};exports[_0x6b4a('0x5b')]=function(_0x44daf2,_0x2dec17,_0x9aabdf){return db[_0x6b4a('0x31')][_0x6b4a('0x4c')]({'where':{'id':_0x44daf2[_0x6b4a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2dec17,null))[_0x6b4a('0x28')](function(_0x1fb57e){if(_0x1fb57e){var _0x215953=[];var _0x18e9bd={'success':[],'errors':[]};return db[_0x6b4a('0x5c')]['describe']()['then'](function(_0x430af4){if(_0x44daf2[_0x6b4a('0x53')]['tags']&&_['isArray'](_0x44daf2[_0x6b4a('0x53')][_0x6b4a('0x5d')])){if(_0x44daf2[_0x6b4a('0x53')]['tags'][_0x6b4a('0x3b')]){_0x44daf2[_0x6b4a('0x53')][_0x6b4a('0x5d')]=_0x44daf2['body'][_0x6b4a('0x5d')][_0x6b4a('0x5e')](';')+';';}else{_0x44daf2[_0x6b4a('0x53')][_0x6b4a('0x5d')]=null;}}else{_0x44daf2[_0x6b4a('0x53')][_0x6b4a('0x5d')]=null;}if(_0x44daf2[_0x6b4a('0x53')]&&_['isArray'](_0x44daf2[_0x6b4a('0x53')])){for(var _0x2446c9=0x0;_0x2446c9<_0x44daf2[_0x6b4a('0x53')][_0x6b4a('0x3b')];_0x2446c9+=0x1){_0x44daf2[_0x6b4a('0x53')][_0x2446c9]['ListId']=_0x44daf2[_0x6b4a('0x4b')]['id'];_0x215953[_0x6b4a('0x5f')](_0x44daf2[_0x6b4a('0x53')][_0x2446c9]);}return BPromise[_0x6b4a('0x60')](_0x215953,function(_0x233161){return db[_0x6b4a('0x5c')][_0x6b4a('0x4d')](_[_0x6b4a('0x61')](_0x233161,[_0x6b4a('0x62'),'id'])||{},{'fields':_[_0x6b4a('0x37')](_0x430af4),'raw':!![]})[_0x6b4a('0x28')](function(_0x50e922){_0x18e9bd['success']['push'](_0x50e922[_0x6b4a('0x63')]);})[_0x6b4a('0x4a')](function(_0x5b44d8){_0x18e9bd[_0x6b4a('0x64')][_0x6b4a('0x5f')]({'data':_0x233161,'error':_0x5b44d8[_0x6b4a('0x65')]});});})[_0x6b4a('0x28')](function(_0x228b7d){return _0x18e9bd;})[_0x6b4a('0x4a')](function(_0x3d806d){return _0x3d806d;});}else{_0x2dec17['status'](0x190)[_0x6b4a('0x25')]({'message':_0x6b4a('0x66')});}});}})['then'](respondWithResult(_0x2dec17,null))['catch'](handleError(_0x2dec17,null));};exports[_0x6b4a('0x67')]=function(_0x4aed92,_0x3ea3f3,_0x3ccf35){var _0x52a42b;return db[_0x6b4a('0x31')][_0x6b4a('0x4c')]({'where':{'id':_0x4aed92[_0x6b4a('0x4b')]['id']},'include':[{'model':db[_0x6b4a('0x68')],'as':_0x6b4a('0x69')}]})['then'](handleEntityNotFound(_0x3ea3f3,null))[_0x6b4a('0x28')](function(_0x419bb6){if(_0x419bb6){_0x52a42b=_0x419bb6;return db[_0x6b4a('0x5c')][_0x6b4a('0x57')];}})[_0x6b4a('0x28')](function(_0x13b94a){if(_0x13b94a){var _0x5814f7={};var _0x48303c={};_0x48303c['model']=_[_0x6b4a('0x6a')](_[_0x6b4a('0x37')](_0x13b94a),_[_0x6b4a('0x35')](_0x52a42b[_0x6b4a('0x69')],function(_0x15d49a){return util[_0x6b4a('0x6b')]('cf_%d',_0x15d49a['id']);}));_0x48303c[_0x6b4a('0x36')]=_[_0x6b4a('0x37')](_0x4aed92[_0x6b4a('0x36')]);_0x48303c[_0x6b4a('0x40')]=_[_0x6b4a('0x39')](_0x48303c[_0x6b4a('0x34')],_0x48303c[_0x6b4a('0x36')]);_0x5814f7[_0x6b4a('0x38')]=_[_0x6b4a('0x39')](_0x48303c[_0x6b4a('0x34')],qs[_0x6b4a('0x3a')](_0x4aed92['query']['fields']));_0x5814f7[_0x6b4a('0x38')]=_0x5814f7[_0x6b4a('0x38')][_0x6b4a('0x3b')]?_0x5814f7[_0x6b4a('0x38')]:_0x48303c[_0x6b4a('0x34')];if(!_0x4aed92['query'][_0x6b4a('0x3c')]('nolimit')){_0x5814f7[_0x6b4a('0x22')]=qs[_0x6b4a('0x22')](_0x4aed92[_0x6b4a('0x36')][_0x6b4a('0x22')]);_0x5814f7[_0x6b4a('0x21')]=qs[_0x6b4a('0x21')](_0x4aed92['query'][_0x6b4a('0x21')]);}_0x5814f7[_0x6b4a('0x3e')]=qs[_0x6b4a('0x58')](_0x4aed92['query']['sort']);_0x5814f7[_0x6b4a('0x3f')]=qs[_0x6b4a('0x40')](_[_0x6b4a('0x41')](_0x4aed92[_0x6b4a('0x36')],_0x48303c[_0x6b4a('0x40')]));_0x5814f7[_0x6b4a('0x6c')]=!![];if(_0x4aed92[_0x6b4a('0x36')]['filter']){_0x5814f7[_0x6b4a('0x3f')]=_[_0x6b4a('0x42')](_0x5814f7[_0x6b4a('0x3f')],{'$or':_[_0x6b4a('0x35')](_0x5814f7[_0x6b4a('0x38')],function(_0x4a2eaa){var _0x2f133b={};_0x2f133b[_0x4a2eaa]={'$like':'%'+_0x4aed92[_0x6b4a('0x36')]['filter']+'%'};return _0x2f133b;})});}_0x5814f7=_[_0x6b4a('0x42')]({},_0x5814f7,_0x4aed92['options']);return _0x52a42b[_0x6b4a('0x67')](_0x5814f7);}})[_0x6b4a('0x28')](respondWithResult(_0x3ea3f3,null))['catch'](handleError(_0x3ea3f3,null));};exports['getContactsCsv']=function(_0x33a93c,_0x11dd29,_0xbfc256){var _0x57a91f;return db[_0x6b4a('0x31')][_0x6b4a('0x4c')]({'where':{'id':_0x33a93c[_0x6b4a('0x4b')]['id']},'include':[{'model':db[_0x6b4a('0x68')],'as':_0x6b4a('0x69')}]})[_0x6b4a('0x28')](handleEntityNotFound(_0x11dd29,null))['then'](function(_0x3d9102){if(_0x3d9102){_0x57a91f=_0x3d9102;return db[_0x6b4a('0x5c')]['rawAttributes'];}})['then'](function(_0x3b33a8){if(_0x3b33a8){var _0x2a75d4={};var _0x40d6c3={};_0x40d6c3[_0x6b4a('0x34')]=_[_0x6b4a('0x6a')](_[_0x6b4a('0x37')](_0x3b33a8),_[_0x6b4a('0x35')](_0x57a91f[_0x6b4a('0x69')],function(_0x2ea61a){return util['format'](_0x6b4a('0x6d'),_0x2ea61a['id']);}));_0x40d6c3[_0x6b4a('0x36')]=_[_0x6b4a('0x37')](_0x33a93c['query']);_0x40d6c3[_0x6b4a('0x40')]=_[_0x6b4a('0x39')](_0x40d6c3['model'],_0x40d6c3['query']);_0x2a75d4['attributes']=_[_0x6b4a('0x39')](_0x40d6c3[_0x6b4a('0x34')],qs[_0x6b4a('0x3a')](_0x33a93c[_0x6b4a('0x36')][_0x6b4a('0x3a')]));_0x2a75d4[_0x6b4a('0x38')]=_0x2a75d4[_0x6b4a('0x38')]['length']?_0x2a75d4['attributes']:_0x40d6c3[_0x6b4a('0x34')];if(!_0x33a93c[_0x6b4a('0x36')]['hasOwnProperty'](_0x6b4a('0x3d'))){_0x2a75d4[_0x6b4a('0x22')]=qs[_0x6b4a('0x22')](_0x33a93c[_0x6b4a('0x36')][_0x6b4a('0x22')]);_0x2a75d4['offset']=qs[_0x6b4a('0x21')](_0x33a93c['query']['offset']);}_0x2a75d4[_0x6b4a('0x3e')]=qs['sort'](_0x33a93c[_0x6b4a('0x36')][_0x6b4a('0x58')]);_0x2a75d4[_0x6b4a('0x3f')]=qs['filters'](_[_0x6b4a('0x41')](_0x33a93c['query'],_0x40d6c3['filters']));_0x2a75d4[_0x6b4a('0x6c')]=!![];if(_0x33a93c['query'][_0x6b4a('0x44')]){_0x2a75d4[_0x6b4a('0x3f')]=_[_0x6b4a('0x42')](_0x2a75d4[_0x6b4a('0x3f')],{'$or':_[_0x6b4a('0x35')](_0x2a75d4['attributes'],function(_0x38c87d){var _0x1c69aa={};_0x1c69aa[_0x38c87d]={'$like':'%'+_0x33a93c[_0x6b4a('0x36')][_0x6b4a('0x44')]+'%'};return _0x1c69aa;})});}_0x2a75d4=_[_0x6b4a('0x42')]({},_0x2a75d4,_0x33a93c[_0x6b4a('0x45')]);return _0x57a91f[_0x6b4a('0x67')](_0x2a75d4);}})[_0x6b4a('0x28')](function(_0x518279){if(!_[_0x6b4a('0x6e')](_0x518279)){var _0x3ff752=toCsv(_0x518279);var _0x1c8839=Date[_0x6b4a('0x6f')]();fs[_0x6b4a('0x70')](util[_0x6b4a('0x6b')](_0x6b4a('0x71'),_0x57a91f['id'],_0x1c8839),_0x3ff752);_0x11dd29['setHeader'](_0x6b4a('0x72'),_0x6b4a('0x73')+util[_0x6b4a('0x6b')]('list_%d_%s.csv',_0x57a91f['id'],_0x1c8839));_0x11dd29[_0x6b4a('0x74')]('Content-type','text/csv');return _0x11dd29[_0x6b4a('0x75')](util[_0x6b4a('0x6b')]('/tmp/list_%d_%s.csv',_0x57a91f['id'],_0x1c8839));}else{return _0x11dd29['sendStatus'](0xcc);}})[_0x6b4a('0x4a')](handleError(_0x11dd29,null));};exports['addCustomField']=function(_0x237948,_0x228ea1,_0x5e46dc){var _0x106b01;delete _0x237948[_0x6b4a('0x53')]['id'];return db['CmList']['findOne']({'where':{'id':_0x237948[_0x6b4a('0x4b')]['id']}})[_0x6b4a('0x28')](handleEntityNotFound(_0x228ea1,null))[_0x6b4a('0x28')](function(_0x177838){if(_0x177838){return db['sequelize'][_0x6b4a('0x76')](function(_0x5d8dc5){return db['CmCustomField']['create'](_0x237948['body'],{'transaction':_0x5d8dc5})[_0x6b4a('0x28')](function(_0x3d1ee9){_0x106b01=_0x3d1ee9;return _0x177838['addCustomFields'](_0x3d1ee9,{'transaction':_0x5d8dc5});})[_0x6b4a('0x28')](function(){var _0x1bf0a3={'type':db[_0x6b4a('0x77')][_0x6b4a('0x78')],'transaction':_0x5d8dc5};switch(_0x237948[_0x6b4a('0x53')][_0x6b4a('0x43')]){case'text':_0x1bf0a3[_0x6b4a('0x43')]=db['Sequelize'][_0x6b4a('0x78')];break;case _0x6b4a('0x79'):_0x1bf0a3['type']=db[_0x6b4a('0x77')][_0x6b4a('0x7a')];break;case _0x6b4a('0x7b'):_0x1bf0a3['type']=db[_0x6b4a('0x77')][_0x6b4a('0x7c')];_0x1bf0a3['defaultValue']=![];break;default:}return db[_0x6b4a('0x7d')][_0x6b4a('0x7e')][_0x6b4a('0x7f')](_0x6b4a('0x80'),util[_0x6b4a('0x6b')](_0x6b4a('0x81'),_0x106b01['id']),_0x1bf0a3);})[_0x6b4a('0x28')](function(){return _0x106b01;});});}})[_0x6b4a('0x28')](respondWithResult(_0x228ea1,null))[_0x6b4a('0x4a')](handleError(_0x228ea1,null));};exports['getCustomFields']=function(_0x34dca4,_0x565f63,_0x3049cf){var _0xa20cb7={};var _0x59a629={};var _0x56040c;var _0x26232a;return db[_0x6b4a('0x31')][_0x6b4a('0x82')]({'where':{'id':_0x34dca4[_0x6b4a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x565f63,null))[_0x6b4a('0x28')](function(_0x2963a4){if(_0x2963a4){_0x56040c=_0x2963a4;_0x59a629['model']=_[_0x6b4a('0x37')](db[_0x6b4a('0x68')]['rawAttributes']);_0x59a629[_0x6b4a('0x36')]=_[_0x6b4a('0x37')](_0x34dca4[_0x6b4a('0x36')]);_0x59a629['filters']=_[_0x6b4a('0x39')](_0x59a629[_0x6b4a('0x34')],_0x59a629['query']);_0xa20cb7[_0x6b4a('0x38')]=_[_0x6b4a('0x39')](_0x59a629[_0x6b4a('0x34')],qs[_0x6b4a('0x3a')](_0x34dca4[_0x6b4a('0x36')][_0x6b4a('0x3a')]));_0xa20cb7[_0x6b4a('0x38')]=_0xa20cb7[_0x6b4a('0x38')]['length']?_0xa20cb7['attributes']:_0x59a629['model'];_0xa20cb7[_0x6b4a('0x3e')]=qs[_0x6b4a('0x58')](_0x34dca4[_0x6b4a('0x36')][_0x6b4a('0x58')]);_0xa20cb7['where']=qs[_0x6b4a('0x40')](_[_0x6b4a('0x41')](_0x34dca4[_0x6b4a('0x36')],_0x59a629[_0x6b4a('0x40')]));_0xa20cb7[_0x6b4a('0x3f')]=_['merge'](_0xa20cb7[_0x6b4a('0x3f')],{'$or':[{'ListId':_0x2963a4['id']},{'ListId':null}]});if(_0x34dca4[_0x6b4a('0x36')][_0x6b4a('0x44')]){_0xa20cb7['where']=_[_0x6b4a('0x42')](_0xa20cb7[_0x6b4a('0x3f')],{'$or':_[_0x6b4a('0x35')](_0xa20cb7[_0x6b4a('0x38')],function(_0x4eaff7){var _0x37d702={};_0x37d702[_0x4eaff7]={'$like':'%'+_0x34dca4[_0x6b4a('0x36')][_0x6b4a('0x44')]+'%'};return _0x37d702;})});}_0xa20cb7=_[_0x6b4a('0x42')]({},_0xa20cb7,_0x34dca4['options']);return db['CmCustomField'][_0x6b4a('0x83')](_0xa20cb7);}})[_0x6b4a('0x28')](respondWithResult(_0x565f63,null))[_0x6b4a('0x4a')](handleError(_0x565f63,null));};exports['addAgents']=function(_0x5dab30,_0x3b3e34,_0x4c90ea){return db[_0x6b4a('0x31')]['find']({'where':{'id':_0x5dab30[_0x6b4a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3b3e34,null))[_0x6b4a('0x28')](function(_0x4e8913){if(_0x4e8913){return _0x4e8913[_0x6b4a('0x84')](_0x5dab30[_0x6b4a('0x53')][_0x6b4a('0x62')],_[_0x6b4a('0x61')](_0x5dab30[_0x6b4a('0x53')],[_0x6b4a('0x62'),'id'])||{})['spread'](function(_0x6ad467){for(var _0x142333=0x0;_0x142333<_0x5dab30[_0x6b4a('0x53')]['ids'][_0x6b4a('0x3b')];_0x142333+=0x1){socket[_0x6b4a('0x85')]('userCmList:save',{'UserId':Number(_0x5dab30[_0x6b4a('0x53')][_0x6b4a('0x62')][_0x142333]),'CmListId':Number(_0x5dab30[_0x6b4a('0x4b')]['id'])});}return _0x6ad467;});}})[_0x6b4a('0x28')](respondWithResult(_0x3b3e34,null))[_0x6b4a('0x4a')](handleError(_0x3b3e34,null));};exports[_0x6b4a('0x86')]=function(_0x5e4a7f,_0x2aaf38,_0x7c71d9){return db[_0x6b4a('0x31')][_0x6b4a('0x4c')]({'where':{'id':_0x5e4a7f['params']['id']}})['then'](handleEntityNotFound(_0x2aaf38,null))[_0x6b4a('0x28')](function(_0x4ff35d){if(_0x4ff35d){return _0x4ff35d['removeAgents'](_0x5e4a7f[_0x6b4a('0x36')][_0x6b4a('0x62')])[_0x6b4a('0x28')](function(){if(_[_0x6b4a('0x87')](_0x5e4a7f[_0x6b4a('0x36')][_0x6b4a('0x62')])){for(var _0x3092b7=0x0;_0x3092b7<_0x5e4a7f[_0x6b4a('0x36')][_0x6b4a('0x62')]['length'];_0x3092b7+=0x1){socket['emit'](_0x6b4a('0x88'),{'UserId':Number(_0x5e4a7f['query']['ids'][_0x3092b7]),'CmListId':Number(_0x5e4a7f[_0x6b4a('0x4b')]['id'])});}}else{socket[_0x6b4a('0x85')](_0x6b4a('0x88'),{'UserId':Number(_0x5e4a7f[_0x6b4a('0x36')][_0x6b4a('0x62')]),'CmListId':Number(_0x5e4a7f[_0x6b4a('0x4b')]['id'])});}});}})[_0x6b4a('0x28')](respondWithStatusCode(_0x2aaf38,null))[_0x6b4a('0x4a')](handleError(_0x2aaf38,null));};exports['getAgents']=function(_0x13f6af,_0x40b4dc,_0x2d75ad){var _0x3e69ff={};var _0x2cc8af={};var _0x366a58;var _0x284e48;return db[_0x6b4a('0x31')][_0x6b4a('0x82')]({'where':{'id':_0x13f6af[_0x6b4a('0x4b')]['id']}})[_0x6b4a('0x28')](handleEntityNotFound(_0x40b4dc,null))[_0x6b4a('0x28')](function(_0x5900dd){if(_0x5900dd){_0x366a58=_0x5900dd;_0x2cc8af[_0x6b4a('0x34')]=_[_0x6b4a('0x37')](db[_0x6b4a('0x89')][_0x6b4a('0x57')]);_0x2cc8af[_0x6b4a('0x36')]=_[_0x6b4a('0x37')](_0x13f6af[_0x6b4a('0x36')]);_0x2cc8af[_0x6b4a('0x40')]=_[_0x6b4a('0x39')](_0x2cc8af[_0x6b4a('0x34')],_0x2cc8af[_0x6b4a('0x36')]);_0x3e69ff[_0x6b4a('0x38')]=_[_0x6b4a('0x39')](_0x2cc8af[_0x6b4a('0x34')],qs[_0x6b4a('0x3a')](_0x13f6af['query'][_0x6b4a('0x3a')]));_0x3e69ff['attributes']=_0x3e69ff['attributes'][_0x6b4a('0x3b')]?_0x3e69ff['attributes']:_0x2cc8af[_0x6b4a('0x34')];_0x3e69ff[_0x6b4a('0x3e')]=qs[_0x6b4a('0x58')](_0x13f6af[_0x6b4a('0x36')]['sort']);_0x3e69ff[_0x6b4a('0x3f')]=qs[_0x6b4a('0x40')](_[_0x6b4a('0x41')](_0x13f6af[_0x6b4a('0x36')],_0x2cc8af[_0x6b4a('0x40')]));if(_0x13f6af[_0x6b4a('0x36')][_0x6b4a('0x44')]){_0x3e69ff[_0x6b4a('0x3f')]=_[_0x6b4a('0x42')](_0x3e69ff[_0x6b4a('0x3f')],{'$or':_[_0x6b4a('0x35')](_0x3e69ff[_0x6b4a('0x38')],function(_0x2f4232){var _0x3e0271={};_0x3e0271[_0x2f4232]={'$like':'%'+_0x13f6af[_0x6b4a('0x36')][_0x6b4a('0x44')]+'%'};return _0x3e0271;})});}_0x3e69ff=_[_0x6b4a('0x42')]({},_0x3e69ff,_0x13f6af[_0x6b4a('0x45')]);return _0x366a58[_0x6b4a('0x8a')](_0x3e69ff);}})[_0x6b4a('0x28')](function(_0x52e370){if(_0x52e370){_0x284e48=_0x52e370[_0x6b4a('0x3b')];if(!_0x13f6af[_0x6b4a('0x36')][_0x6b4a('0x3c')](_0x6b4a('0x3d'))){_0x3e69ff['limit']=qs[_0x6b4a('0x22')](_0x13f6af[_0x6b4a('0x36')][_0x6b4a('0x22')]);_0x3e69ff[_0x6b4a('0x21')]=qs[_0x6b4a('0x21')](_0x13f6af[_0x6b4a('0x36')][_0x6b4a('0x21')]);}return _0x366a58['getAgents'](_0x3e69ff);}})[_0x6b4a('0x28')](function(_0x5be47b){if(_0x5be47b){return _0x5be47b?{'count':_0x284e48,'rows':_0x5be47b}:null;}})[_0x6b4a('0x28')](respondWithResult(_0x40b4dc,null))[_0x6b4a('0x4a')](handleError(_0x40b4dc,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index d2918c3..c2d7f3f 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0x7217,0x19e));var _0x7721=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x7217[_0x2160a9];return _0xa88cf7;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x4a464e,_0x250abf){var _0x54d070=function(_0xf56d7){while(--_0xf56d7){_0x4a464e['push'](_0x4a464e['shift']());}};_0x54d070(++_0x250abf);}(_0x7217,0x19e));var _0x7721=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x7217[_0x47e7cb];return _0x2a8874;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 1bb1476..bcb4a73 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 _0x4522=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api','moment','request-promise'];(function(_0xe14e28,_0x3910e8){var _0x3f2056=function(_0x4dcd63){while(--_0x4dcd63){_0xe14e28['push'](_0xe14e28['shift']());}};_0x3f2056(++_0x3910e8);}(_0x4522,0x1a0));var _0x2452=function(_0x4fe10b,_0x724bec){_0x4fe10b=_0x4fe10b-0x0;var _0xfa4be0=_0x4522[_0x4fe10b];return _0xfa4be0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2452('0x0'))(_0x2452('0x1'));var moment=require(_0x2452('0x2'));var BPromise=require('bluebird');var rp=require(_0x2452('0x3'));var fs=require('fs');var path=require(_0x2452('0x4'));var rimraf=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var attributes=require(_0x2452('0x7'));module[_0x2452('0x8')]=function(_0x15fc69,_0x226578){return _0x15fc69[_0x2452('0x9')](_0x2452('0xa'),attributes,{'tableName':_0x2452('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c76=['define','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x1e95dc,_0x18033a){var _0x4e72fd=function(_0x1539aa){while(--_0x1539aa){_0x1e95dc['push'](_0x1e95dc['shift']());}};_0x4e72fd(++_0x18033a);}(_0x6c76,0x184));var _0x66c7=function(_0x33d17c,_0x5aa51c){_0x33d17c=_0x33d17c-0x0;var _0x1e5980=_0x6c76[_0x33d17c];return _0x1e5980;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var moment=require(_0x66c7('0x3'));var BPromise=require(_0x66c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var attributes=require('./cmList.attributes');module[_0x66c7('0x7')]=function(_0x45b0a5,_0x52f71b){return _0x45b0a5[_0x66c7('0x8')]('CmList',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 f24d1a7..11523a4 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 _0x39ec=['localhost','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x29c517,_0x2a15ee){var _0x5ed504=function(_0x3dfcf9){while(--_0x3dfcf9){_0x29c517['push'](_0x29c517['shift']());}};_0x5ed504(++_0x2a15ee);}(_0x39ec,0xb7));var _0xc39e=function(_0x279157,_0x18a11b){_0x279157=_0x279157-0x0;var _0x1f421f=_0x39ec[_0x279157];return _0x1f421f;};'use strict';var _=require(_0xc39e('0x0'));var util=require(_0xc39e('0x1'));var moment=require(_0xc39e('0x2'));var BPromise=require(_0xc39e('0x3'));var rs=require(_0xc39e('0x4'));var fs=require('fs');var Redis=require(_0xc39e('0x5'));var db=require(_0xc39e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc39e('0x7'));var config=require(_0xc39e('0x8'));var jayson=require(_0xc39e('0x9'));var client=jayson[_0xc39e('0xa')][_0xc39e('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc39e('0xc')],{'host':_0xc39e('0xd'),'port':0x18eb});var socket=require(_0xc39e('0xe'))(new Redis(config[_0xc39e('0xc')]));require(_0xc39e('0xf'))['register'](socket);function respondWithRpcPromise(_0x4985c6,_0x13a8d7,_0x22c16d){return new BPromise(function(_0x8b31b5,_0x538390){return client[_0xc39e('0x10')](_0x4985c6,_0x22c16d)[_0xc39e('0x11')](function(_0x4c9d24){logger[_0xc39e('0x12')](_0xc39e('0x13'),_0x13a8d7,_0xc39e('0x14'));logger[_0xc39e('0x15')]('CmList,\x20%s,\x20%s,\x20%s',_0x13a8d7,_0xc39e('0x14'),JSON[_0xc39e('0x16')](_0x4c9d24));if(_0x4c9d24[_0xc39e('0x17')]){if(_0x4c9d24[_0xc39e('0x17')][_0xc39e('0x18')]===0x1f4){logger[_0xc39e('0x17')](_0xc39e('0x13'),_0x13a8d7,_0x4c9d24[_0xc39e('0x17')]['message']);return _0x538390(_0x4c9d24['error']['message']);}logger[_0xc39e('0x17')](_0xc39e('0x13'),_0x13a8d7,_0x4c9d24['error']['message']);return _0x8b31b5(_0x4c9d24[_0xc39e('0x17')]['message']);}else{logger['info'](_0xc39e('0x13'),_0x13a8d7,_0xc39e('0x14'));_0x8b31b5(_0x4c9d24[_0xc39e('0x19')][_0xc39e('0x1a')]);}})[_0xc39e('0x1b')](function(_0x1acbbd){logger[_0xc39e('0x17')](_0xc39e('0x13'),_0x13a8d7,_0x1acbbd);_0x538390(_0x1acbbd);});});} \ No newline at end of file +var _0x92c1=['../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./cmList.socket','then','info','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmList,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x92c1,0x126));var _0x192c=function(_0x1819eb,_0x5a3a47){_0x1819eb=_0x1819eb-0x0;var _0x49a985=_0x92c1[_0x1819eb];return _0x49a985;};'use strict';var _=require('lodash');var util=require(_0x192c('0x0'));var moment=require(_0x192c('0x1'));var BPromise=require(_0x192c('0x2'));var rs=require(_0x192c('0x3'));var fs=require('fs');var Redis=require(_0x192c('0x4'));var db=require(_0x192c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x192c('0x6'))(_0x192c('0x7'));var config=require('../../config/environment');var jayson=require(_0x192c('0x8'));var client=jayson[_0x192c('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x192c('0xa')],{'host':_0x192c('0xb'),'port':0x18eb});var socket=require(_0x192c('0xc'))(new Redis(config[_0x192c('0xa')]));require(_0x192c('0xd'))['register'](socket);function respondWithRpcPromise(_0x35e815,_0x4da7cf,_0x3338d1){return new BPromise(function(_0x856e94,_0x541550){return client['request'](_0x35e815,_0x3338d1)[_0x192c('0xe')](function(_0x2a1b4d){logger[_0x192c('0xf')]('CmList,\x20%s,\x20%s',_0x4da7cf,'request\x20sent');logger[_0x192c('0x10')](_0x192c('0x11'),_0x4da7cf,_0x192c('0x12'),JSON['stringify'](_0x2a1b4d));if(_0x2a1b4d[_0x192c('0x13')]){if(_0x2a1b4d[_0x192c('0x13')][_0x192c('0x14')]===0x1f4){logger[_0x192c('0x13')](_0x192c('0x15'),_0x4da7cf,_0x2a1b4d[_0x192c('0x13')][_0x192c('0x16')]);return _0x541550(_0x2a1b4d[_0x192c('0x13')][_0x192c('0x16')]);}logger[_0x192c('0x13')]('CmList,\x20%s,\x20%s',_0x4da7cf,_0x2a1b4d['error']['message']);return _0x856e94(_0x2a1b4d[_0x192c('0x13')][_0x192c('0x16')]);}else{logger['info'](_0x192c('0x15'),_0x4da7cf,_0x192c('0x12'));_0x856e94(_0x2a1b4d[_0x192c('0x17')][_0x192c('0x16')]);}})[_0x192c('0x18')](function(_0xcd6ddf){logger[_0x192c('0x13')](_0x192c('0x15'),_0x4da7cf,_0xcd6ddf);_0x541550(_0xcd6ddf);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 15b29e2..df066d3 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 _0x8966=['emit','removeListener','cmList:','save','update'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8966,0x184));var _0x6896=function(_0x4219e2,_0x5d1152){_0x4219e2=_0x4219e2-0x0;var _0x2bb0c7=_0x8966[_0x4219e2];return _0x2bb0c7;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x6896('0x0'),'remove',_0x6896('0x1')];function createListener(_0x2a6cd9,_0x3b366f){return function(_0x5e4202){_0x3b366f[_0x6896('0x2')](_0x2a6cd9,_0x5e4202);};}function removeListener(_0x34948a,_0x485803){return function(){CmListEvents[_0x6896('0x3')](_0x34948a,_0x485803);};}exports['register']=function(_0xf34206){for(var _0x4294d4=0x0,_0x44afb7=events['length'];_0x4294d4<_0x44afb7;_0x4294d4++){var _0x223e85=events[_0x4294d4];var _0x52a264=createListener(_0x6896('0x4')+_0x223e85,_0xf34206);CmListEvents['on'](_0x223e85,_0x52a264);}}; \ No newline at end of file +var _0xe640=['./cmList.events','save','update','emit','removeListener','register','length'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xe640,0x1ce));var _0x0e64=function(_0x38e806,_0x47bb6c){_0x38e806=_0x38e806-0x0;var _0x3ca974=_0xe640[_0x38e806];return _0x3ca974;};'use strict';var CmListEvents=require(_0x0e64('0x0'));var events=[_0x0e64('0x1'),'remove',_0x0e64('0x2')];function createListener(_0x4c63fc,_0xcfd010){return function(_0x2c5af5){_0xcfd010[_0x0e64('0x3')](_0x4c63fc,_0x2c5af5);};}function removeListener(_0x47fea9,_0x156881){return function(){CmListEvents[_0x0e64('0x4')](_0x47fea9,_0x156881);};}exports[_0x0e64('0x5')]=function(_0x3febb4){for(var _0x71f805=0x0,_0x176f3c=events[_0x0e64('0x6')];_0x71f805<_0x176f3c;_0x71f805++){var _0xef42b6=events[_0x71f805];var _0x408089=createListener('cmList:'+_0xef42b6,_0x3febb4);CmListEvents['on'](_0xef42b6,_0x408089);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index e23fc1b..8fe7bef 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 _0x14df=['update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getContactsCsv','getCustomFields','create','post','/:id/contacts','addContacts','/:id/fields','addCustomField','/:id/users','addAgents','put'];(function(_0x469009,_0x6cfae){var _0x190703=function(_0x40595f){while(--_0x40595f){_0x469009['push'](_0x469009['shift']());}};_0x190703(++_0x6cfae);}(_0x14df,0x13a));var _0xf14d=function(_0x147ed4,_0x1b60ec){_0x147ed4=_0x147ed4-0x0;var _0x2069e7=_0x14df[_0x147ed4];return _0x2069e7;};'use strict';var multer=require(_0xf14d('0x0'));var util=require(_0xf14d('0x1'));var path=require('path');var timeout=require(_0xf14d('0x2'));var express=require('express');var router=express[_0xf14d('0x3')]();var fs_extra=require(_0xf14d('0x4'));var auth=require(_0xf14d('0x5'));var interaction=require(_0xf14d('0x6'));var config=require('../../config/environment');var controller=require(_0xf14d('0x7'));router[_0xf14d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf14d('0x9'),auth[_0xf14d('0xa')](),controller[_0xf14d('0xb')]);router[_0xf14d('0x8')](_0xf14d('0xc'),auth[_0xf14d('0xa')](),controller[_0xf14d('0xd')]);router[_0xf14d('0x8')](_0xf14d('0xe'),auth[_0xf14d('0xa')](),controller[_0xf14d('0xf')]);router[_0xf14d('0x8')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0xf14d('0x8')]('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0xf14d('0x10')]);router['get']('/:id/fields',auth[_0xf14d('0xa')](),controller[_0xf14d('0x11')]);router['get']('/:id/users',auth[_0xf14d('0xa')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xf14d('0x12')]);router[_0xf14d('0x13')](_0xf14d('0xe'),auth[_0xf14d('0xa')](),controller['addDisposition']);router[_0xf14d('0x13')](_0xf14d('0x14'),auth[_0xf14d('0xa')](),controller[_0xf14d('0x15')]);router[_0xf14d('0x13')](_0xf14d('0x16'),auth['isAuthenticated'](),controller[_0xf14d('0x17')]);router[_0xf14d('0x13')](_0xf14d('0x18'),auth['isAuthenticated'](),controller[_0xf14d('0x19')]);router[_0xf14d('0x1a')]('/:id',auth[_0xf14d('0xa')](),controller[_0xf14d('0x1b')]);router[_0xf14d('0x1c')](_0xf14d('0xc'),auth[_0xf14d('0xa')](),controller[_0xf14d('0x1d')]);router['delete'](_0xf14d('0xe'),auth[_0xf14d('0xa')](),controller['removeDispositions']);router[_0xf14d('0x1c')](_0xf14d('0x18'),auth[_0xf14d('0xa')](),controller['removeAgents']);module[_0xf14d('0x1e')]=router; \ No newline at end of file +var _0x44e9=['isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','create','addContacts','/:id/fields','addCustomField','post','addAgents','put','update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get'];(function(_0x33b72f,_0x5312fe){var _0x1879d4=function(_0x680930){while(--_0x680930){_0x33b72f['push'](_0x33b72f['shift']());}};_0x1879d4(++_0x5312fe);}(_0x44e9,0x138));var _0x944e=function(_0x1f0e43,_0x26f8e5){_0x1f0e43=_0x1f0e43-0x0;var _0x5e760a=_0x44e9[_0x1f0e43];return _0x5e760a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x944e('0x0'));var express=require(_0x944e('0x1'));var router=express[_0x944e('0x2')]();var fs_extra=require(_0x944e('0x3'));var auth=require(_0x944e('0x4'));var interaction=require(_0x944e('0x5'));var config=require('../../config/environment');var controller=require(_0x944e('0x6'));router[_0x944e('0x7')]('/',auth[_0x944e('0x8')](),controller[_0x944e('0x9')]);router[_0x944e('0x7')]('/describe',auth[_0x944e('0x8')](),controller[_0x944e('0xa')]);router[_0x944e('0x7')](_0x944e('0xb'),auth['isAuthenticated'](),controller[_0x944e('0xc')]);router['get'](_0x944e('0xd'),auth[_0x944e('0x8')](),controller[_0x944e('0xe')]);router[_0x944e('0x7')](_0x944e('0xf'),auth[_0x944e('0x8')](),controller[_0x944e('0x10')]);router[_0x944e('0x7')](_0x944e('0x11'),auth[_0x944e('0x8')](),controller[_0x944e('0x12')]);router[_0x944e('0x7')]('/:id/fields',auth[_0x944e('0x8')](),controller[_0x944e('0x13')]);router[_0x944e('0x7')](_0x944e('0x14'),auth[_0x944e('0x8')](),controller[_0x944e('0x15')]);router['post']('/',auth[_0x944e('0x8')](),controller[_0x944e('0x16')]);router['post'](_0x944e('0xd'),auth[_0x944e('0x8')](),controller['addDisposition']);router['post'](_0x944e('0xf'),auth['isAuthenticated'](),controller[_0x944e('0x17')]);router['post'](_0x944e('0x18'),auth['isAuthenticated'](),controller[_0x944e('0x19')]);router[_0x944e('0x1a')](_0x944e('0x14'),auth[_0x944e('0x8')](),controller[_0x944e('0x1b')]);router[_0x944e('0x1c')](_0x944e('0xb'),auth[_0x944e('0x8')](),controller[_0x944e('0x1d')]);router['delete'](_0x944e('0xb'),auth[_0x944e('0x8')](),controller['destroy']);router[_0x944e('0x1e')](_0x944e('0xd'),auth[_0x944e('0x8')](),controller['removeDispositions']);router[_0x944e('0x1e')](_0x944e('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x944e('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 3308b16..cbfc645 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 _0xcf50=['sequelize','VIRTUAL','getDataValue','field','STRING'];(function(_0x54cfa4,_0x2d41ac){var _0x26ecf5=function(_0x5854d0){while(--_0x5854d0){_0x54cfa4['push'](_0x54cfa4['shift']());}};_0x26ecf5(++_0x2d41ac);}(_0xcf50,0x131));var _0x0cf5=function(_0x197682,_0x136df4){_0x197682=_0x197682-0x0;var _0x4013e6=_0xcf50[_0x197682];return _0x4013e6;};'use strict';var Sequelize=require(_0x0cf5('0x0'));module['exports']={'name':{'type':Sequelize[_0x0cf5('0x1')],'get':function(_0x29dd81){return this[_0x0cf5('0x2')](_0x0cf5('0x3'));}},'field':{'type':Sequelize[_0x0cf5('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x0cf5('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0cf5('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x16d6=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x207f10,_0x3cc74d){var _0x544956=function(_0x543eeb){while(--_0x543eeb){_0x207f10['push'](_0x207f10['shift']());}};_0x544956(++_0x3cc74d);}(_0x16d6,0xe3));var _0x616d=function(_0x375126,_0x514a8e){_0x375126=_0x375126-0x0;var _0x1f76bb=_0x16d6[_0x375126];return _0x1f76bb;};'use strict';var Sequelize=require(_0x616d('0x0'));module[_0x616d('0x1')]={'name':{'type':Sequelize[_0x616d('0x2')],'get':function(_0x560e8c){return this['getDataValue'](_0x616d('0x3'));}},'field':{'type':Sequelize[_0x616d('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x616d('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x616d('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 247fd51..262d1ec 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x451212,_0x11bbcf){var _0x5f028b=function(_0x330a5c){while(--_0x330a5c){_0x451212['push'](_0x451212['shift']());}};_0x5f028b(++_0x11bbcf);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _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(_0x32f081,_0x162a19){var _0x97934b=function(_0xd0882b){while(--_0xd0882b){_0x32f081['push'](_0x32f081['shift']());}};_0x97934b(++_0x162a19);}(_0x7a54,0x106));var _0x47a5=function(_0x1befa4,_0x319b86){_0x1befa4=_0x1befa4-0x0;var _0xe6f429=_0x7a54[_0x1befa4];return _0xe6f429;};'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 30cccec..f093a05 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 _0xb08c=['tools_conditions','util','moment','bluebird','request-promise','path','./condition.attributes','exports','define','Condition'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb08c,0x105));var _0xcb08=function(_0x53885b,_0x514cc6){_0x53885b=_0x53885b-0x0;var _0x29c313=_0xb08c[_0x53885b];return _0x29c313;};'use strict';var _=require('lodash');var util=require(_0xcb08('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xcb08('0x1'));var BPromise=require(_0xcb08('0x2'));var rp=require(_0xcb08('0x3'));var fs=require('fs');var path=require(_0xcb08('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcb08('0x5'));module[_0xcb08('0x6')]=function(_0x376a66,_0x23f26e){return _0x376a66[_0xcb08('0x7')](_0xcb08('0x8'),attributes,{'tableName':_0xcb08('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5749=['tools_conditions','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','Condition'];(function(_0x52fa57,_0x504a2f){var _0x44aaf3=function(_0x5a35bd){while(--_0x5a35bd){_0x52fa57['push'](_0x52fa57['shift']());}};_0x44aaf3(++_0x504a2f);}(_0x5749,0xd9));var _0x9574=function(_0x5d7c63,_0x284d18){_0x5d7c63=_0x5d7c63-0x0;var _0x2887c8=_0x5749[_0x5d7c63];return _0x2887c8;};'use strict';var _=require(_0x9574('0x0'));var util=require(_0x9574('0x1'));var logger=require(_0x9574('0x2'))('api');var moment=require(_0x9574('0x3'));var BPromise=require('bluebird');var rp=require(_0x9574('0x4'));var fs=require('fs');var path=require(_0x9574('0x5'));var rimraf=require(_0x9574('0x6'));var config=require(_0x9574('0x7'));var attributes=require('./condition.attributes');module[_0x9574('0x8')]=function(_0x560c4b,_0x2367d7){return _0x560c4b[_0x9574('0x9')](_0x9574('0xa'),attributes,{'tableName':_0x9574('0xb'),'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 03db8ec..96f9cb8 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 _0x66ba=['stringify','error','code','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x2e15de,_0x3b9a6f){var _0xdaa198=function(_0x575fed){while(--_0x575fed){_0x2e15de['push'](_0x2e15de['shift']());}};_0xdaa198(++_0x3b9a6f);}(_0x66ba,0x17b));var _0xa66b=function(_0x3d90b4,_0x1e2fc6){_0x3d90b4=_0x3d90b4-0x0;var _0x4c65d3=_0x66ba[_0x3d90b4];return _0x4c65d3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa66b('0x0'));var rs=require(_0xa66b('0x1'));var fs=require('fs');var Redis=require(_0xa66b('0x2'));var db=require(_0xa66b('0x3'))['db'];var utils=require(_0xa66b('0x4'));var logger=require(_0xa66b('0x5'))(_0xa66b('0x6'));var config=require(_0xa66b('0x7'));var jayson=require(_0xa66b('0x8'));var client=jayson['client'][_0xa66b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x468504,_0x375cf6,_0x51bbe3){return new BPromise(function(_0x30dd50,_0x764c51){return client[_0xa66b('0xa')](_0x468504,_0x51bbe3)[_0xa66b('0xb')](function(_0x2fc0e3){logger[_0xa66b('0xc')](_0xa66b('0xd'),_0x375cf6,_0xa66b('0xe'));logger[_0xa66b('0xf')](_0xa66b('0x10'),_0x375cf6,'request\x20sent',JSON[_0xa66b('0x11')](_0x2fc0e3));if(_0x2fc0e3['error']){if(_0x2fc0e3[_0xa66b('0x12')][_0xa66b('0x13')]===0x1f4){logger[_0xa66b('0x12')](_0xa66b('0xd'),_0x375cf6,_0x2fc0e3['error'][_0xa66b('0x14')]);return _0x764c51(_0x2fc0e3[_0xa66b('0x12')][_0xa66b('0x14')]);}logger[_0xa66b('0x12')](_0xa66b('0xd'),_0x375cf6,_0x2fc0e3[_0xa66b('0x12')][_0xa66b('0x14')]);return _0x30dd50(_0x2fc0e3[_0xa66b('0x12')]['message']);}else{logger[_0xa66b('0xc')](_0xa66b('0xd'),_0x375cf6,_0xa66b('0xe'));_0x30dd50(_0x2fc0e3['result'][_0xa66b('0x14')]);}})[_0xa66b('0x15')](function(_0x47f046){logger[_0xa66b('0x12')](_0xa66b('0xd'),_0x375cf6,_0x47f046);_0x764c51(_0x47f046);});});} \ No newline at end of file +var _0xd5fb=['request','then','info','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xd5fb,0x89));var _0xbd5f=function(_0x402282,_0x615de3){_0x402282=_0x402282-0x0;var _0x4f65af=_0xd5fb[_0x402282];return _0x4f65af;};'use strict';var _=require(_0xbd5f('0x0'));var util=require(_0xbd5f('0x1'));var moment=require(_0xbd5f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd5f('0x3'));var db=require(_0xbd5f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd5f('0x5'))(_0xbd5f('0x6'));var config=require(_0xbd5f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbd5f('0x8')][_0xbd5f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x64b9ae,_0x6c22ed,_0x6878bd){return new BPromise(function(_0x1daf99,_0x3b92dd){return client[_0xbd5f('0xa')](_0x64b9ae,_0x6878bd)[_0xbd5f('0xb')](function(_0x1b6ff4){logger[_0xbd5f('0xc')](_0xbd5f('0xd'),_0x6c22ed,'request\x20sent');logger['debug'](_0xbd5f('0xe'),_0x6c22ed,_0xbd5f('0xf'),JSON[_0xbd5f('0x10')](_0x1b6ff4));if(_0x1b6ff4['error']){if(_0x1b6ff4['error'][_0xbd5f('0x11')]===0x1f4){logger[_0xbd5f('0x12')]('Condition,\x20%s,\x20%s',_0x6c22ed,_0x1b6ff4['error'][_0xbd5f('0x13')]);return _0x3b92dd(_0x1b6ff4[_0xbd5f('0x12')]['message']);}logger[_0xbd5f('0x12')](_0xbd5f('0xd'),_0x6c22ed,_0x1b6ff4[_0xbd5f('0x12')][_0xbd5f('0x13')]);return _0x1daf99(_0x1b6ff4[_0xbd5f('0x12')][_0xbd5f('0x13')]);}else{logger[_0xbd5f('0xc')](_0xbd5f('0xd'),_0x6c22ed,'request\x20sent');_0x1daf99(_0x1b6ff4[_0xbd5f('0x14')]['message']);}})['catch'](function(_0x56b171){logger[_0xbd5f('0x12')](_0xbd5f('0xd'),_0x6c22ed,_0x56b171);_0x3b92dd(_0x56b171);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 364b614..6485ae4 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 _0x7622=['isAuthenticated','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x7622,0xf1));var _0x2762=function(_0x205e5a,_0x5c19fb){_0x205e5a=_0x205e5a-0x0;var _0x10da58=_0x7622[_0x205e5a];return _0x10da58;};'use strict';var multer=require(_0x2762('0x0'));var util=require(_0x2762('0x1'));var path=require('path');var timeout=require(_0x2762('0x2'));var express=require(_0x2762('0x3'));var router=express[_0x2762('0x4')]();var fs_extra=require(_0x2762('0x5'));var auth=require(_0x2762('0x6'));var interaction=require(_0x2762('0x7'));var config=require(_0x2762('0x8'));var controller=require(_0x2762('0x9'));router['put'](_0x2762('0xa'),auth[_0x2762('0xb')](),controller[_0x2762('0xc')]);router['delete'](_0x2762('0xa'),auth[_0x2762('0xb')](),controller['destroy']);module[_0x2762('0xd')]=router; \ No newline at end of file +var _0xbc9b=['isAuthenticated','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc9b,0x190));var _0xbbc9=function(_0x1719ca,_0xcb74b8){_0x1719ca=_0x1719ca-0x0;var _0x66fd23=_0xbc9b[_0x1719ca];return _0x66fd23;};'use strict';var multer=require(_0xbbc9('0x0'));var util=require(_0xbbc9('0x1'));var path=require('path');var timeout=require(_0xbbc9('0x2'));var express=require(_0xbbc9('0x3'));var router=express['Router']();var fs_extra=require(_0xbbc9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbbc9('0x5'));var config=require(_0xbbc9('0x6'));var controller=require('./condition.controller');router['put'](_0xbbc9('0x7'),auth[_0xbbc9('0x8')](),controller[_0xbbc9('0x9')]);router['delete'](_0xbbc9('0x7'),auth[_0xbbc9('0x8')](),controller[_0xbbc9('0xa')]);module[_0xbbc9('0xb')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 512c011..26ed89b 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 _0xb10b=['name','sequelize','STRING'];(function(_0xa5b4e9,_0x2d8b62){var _0x1356ce=function(_0x42b7ea){while(--_0x42b7ea){_0xa5b4e9['push'](_0xa5b4e9['shift']());}};_0x1356ce(++_0x2d8b62);}(_0xb10b,0x12a));var _0xbb10=function(_0x497948,_0x4ca60c){_0x497948=_0x497948-0x0;var _0x39bb36=_0xb10b[_0x497948];return _0x39bb36;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xe706,0xa3));var _0x6e70=function(_0x57a670,_0x30e402){_0x57a670=_0x57a670-0x0;var _0x41ce21=_0xe706[_0x57a670];return _0x41ce21;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 9a94d5c..c9cbb95 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 _0x3f02=['util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','json','undefined','count','offset','limit','status','set','Content-Range','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','end','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','Dashboard','includeAll','findAll','catch','show','params','include','create','body','user','role','find','autoAssociation','error','clone','updatedAt','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','attrUrl','attrs','value','https://','custom','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','addItem','DashboardId','findOne','DashboardItem','pick','getItems','fast-json-patch','bluebird'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3f02,0x16c));var _0x23f0=function(_0x127783,_0x258715){_0x127783=_0x127783-0x0;var _0x14f298=_0x3f02[_0x127783];return _0x14f298;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x23f0('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x23f0('0x1'));var Mustache=require('mustache');var util=require(_0x23f0('0x2'));var path=require(_0x23f0('0x3'));var sox=require(_0x23f0('0x4'));var csv=require(_0x23f0('0x5'));var ejs=require(_0x23f0('0x6'));var fs=require('fs');var fs_extra=require(_0x23f0('0x7'));var _=require(_0x23f0('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x23f0('0x9'));var deskjs=require(_0x23f0('0xa'));var toCsv=require(_0x23f0('0x5'));var querystring=require(_0x23f0('0xb'));var Papa=require(_0x23f0('0xc'));var Redis=require(_0x23f0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x23f0('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x23f0('0xf'));var logger=require(_0x23f0('0x10'))(_0x23f0('0x11'));var utils=require(_0x23f0('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x23f0('0x13'));var db=require(_0x23f0('0x14'))['db'];config[_0x23f0('0x15')]=_[_0x23f0('0x16')](config[_0x23f0('0x15')],{'host':_0x23f0('0x17'),'port':0x18eb});var socket=require(_0x23f0('0x18'))(new Redis(config[_0x23f0('0x15')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x49feb2,_0x13bc21){_0x13bc21=_0x13bc21||0xcc;return function(_0x1a4391){if(_0x1a4391){return _0x49feb2[_0x23f0('0x19')](_0x13bc21);}return _0x49feb2['status'](_0x13bc21)['end']();};}function respondWithResult(_0x596e92,_0x19e160){_0x19e160=_0x19e160||0xc8;return function(_0x367034){if(_0x367034){return _0x596e92['status'](_0x19e160)[_0x23f0('0x1a')](_0x367034);}};}function respondWithFilteredResult(_0x199f5a,_0x5c43a9){return function(_0x50962e){if(_0x50962e){var _0x3ccf2d=typeof _0x5c43a9['offset']==='undefined'&&typeof _0x5c43a9['limit']===_0x23f0('0x1b');var _0x5de836=_0x50962e[_0x23f0('0x1c')];var _0xa4b548=_0x3ccf2d?0x0:_0x5c43a9[_0x23f0('0x1d')];var _0x108180=_0x3ccf2d?_0x50962e[_0x23f0('0x1c')]:_0x5c43a9['offset']+_0x5c43a9[_0x23f0('0x1e')];var _0x2fa2b1;if(_0x108180>=_0x5de836){_0x108180=_0x5de836;_0x2fa2b1=0xc8;}else{_0x2fa2b1=0xce;}_0x199f5a[_0x23f0('0x1f')](_0x2fa2b1);return _0x199f5a[_0x23f0('0x20')](_0x23f0('0x21'),_0xa4b548+'-'+_0x108180+'/'+_0x5de836)['json'](_0x50962e);}return null;};}function patchUpdates(_0x33232a){return function(_0x561e01){try{jsonpatch['apply'](_0x561e01,_0x33232a,!![]);}catch(_0x46c28e){return BPromise[_0x23f0('0x22')](_0x46c28e);}return _0x561e01[_0x23f0('0x23')]();};}function saveUpdates(_0x514701,_0x17cb55){return function(_0x28daee){if(_0x28daee){return _0x28daee['update'](_0x514701)[_0x23f0('0x24')](function(_0x5635a3){return _0x5635a3;});}return null;};}function removeEntity(_0x21f3e,_0x50670c){return function(_0x49cd4b){if(_0x49cd4b){return _0x49cd4b[_0x23f0('0x25')]()[_0x23f0('0x24')](function(){var _0x2a7bf8=_0x49cd4b[_0x23f0('0x26')]({'plain':!![]});var _0x1fec3f=_0x23f0('0x27');return db[_0x23f0('0x28')][_0x23f0('0x25')]({'where':{'type':_0x1fec3f,'resourceId':_0x2a7bf8['id']}})[_0x23f0('0x24')](function(){return _0x49cd4b;});})['then'](function(){_0x21f3e['status'](0xcc)[_0x23f0('0x29')]();});}};}function handleEntityNotFound(_0x17aaaf,_0x967409){return function(_0x84d4a6){if(!_0x84d4a6){_0x17aaaf[_0x23f0('0x19')](0x194);}return _0x84d4a6;};}function handleError(_0x2a24c3,_0x4a219d){_0x4a219d=_0x4a219d||0x1f4;return function(_0xbd9aca){logger['error'](_0xbd9aca[_0x23f0('0x2a')]);if(_0xbd9aca['name']){delete _0xbd9aca['name'];}_0x2a24c3[_0x23f0('0x1f')](_0x4a219d)['send'](_0xbd9aca);};}exports[_0x23f0('0x2b')]=function(_0x58173a,_0x495808){var _0x23e81a={},_0x30051c={},_0x3e4e8b={'count':0x0,'rows':[]};var _0x28e75c=_[_0x23f0('0x2c')](db['Dashboard'][_0x23f0('0x2d')],function(_0x2e33fb){return{'name':_0x2e33fb[_0x23f0('0x2e')],'type':_0x2e33fb[_0x23f0('0x2f')][_0x23f0('0x30')]};});_0x30051c[_0x23f0('0x31')]=_['map'](_0x28e75c,_0x23f0('0x32'));_0x30051c[_0x23f0('0x33')]=_[_0x23f0('0x34')](_0x58173a[_0x23f0('0x33')]);_0x30051c['filters']=_[_0x23f0('0x35')](_0x30051c[_0x23f0('0x31')],_0x30051c[_0x23f0('0x33')]);_0x23e81a['attributes']=_[_0x23f0('0x35')](_0x30051c[_0x23f0('0x31')],qs['fields'](_0x58173a[_0x23f0('0x33')][_0x23f0('0x36')]));_0x23e81a[_0x23f0('0x37')]=_0x23e81a[_0x23f0('0x37')][_0x23f0('0x38')]?_0x23e81a[_0x23f0('0x37')]:_0x30051c[_0x23f0('0x31')];if(!_0x58173a[_0x23f0('0x33')][_0x23f0('0x39')](_0x23f0('0x3a'))){_0x23e81a[_0x23f0('0x1e')]=qs['limit'](_0x58173a[_0x23f0('0x33')][_0x23f0('0x1e')]);_0x23e81a[_0x23f0('0x1d')]=qs[_0x23f0('0x1d')](_0x58173a[_0x23f0('0x33')][_0x23f0('0x1d')]);}_0x23e81a[_0x23f0('0x3b')]=qs[_0x23f0('0x3c')](_0x58173a['query'][_0x23f0('0x3c')]);_0x23e81a[_0x23f0('0x3d')]=qs[_0x23f0('0x3e')](_['pick'](_0x58173a[_0x23f0('0x33')],_0x30051c['filters']),_0x28e75c);if(_0x58173a[_0x23f0('0x33')][_0x23f0('0x3f')]){_0x23e81a['where']=_[_0x23f0('0x40')](_0x23e81a[_0x23f0('0x3d')],{'$or':_[_0x23f0('0x2c')](_0x28e75c,function(_0x57c441){if(_0x57c441[_0x23f0('0x2f')]!==_0x23f0('0x41')){var _0x303df8={};_0x303df8[_0x57c441[_0x23f0('0x32')]]={'$like':'%'+_0x58173a[_0x23f0('0x33')][_0x23f0('0x3f')]+'%'};return _0x303df8;}})});}_0x23e81a=_[_0x23f0('0x40')]({},_0x23e81a,_0x58173a[_0x23f0('0x42')]);var _0x4f24b5={'where':_0x23e81a[_0x23f0('0x3d')]};return db[_0x23f0('0x43')][_0x23f0('0x1c')](_0x4f24b5)['then'](function(_0x30f063){_0x3e4e8b[_0x23f0('0x1c')]=_0x30f063;if(_0x58173a[_0x23f0('0x33')][_0x23f0('0x44')]){_0x23e81a['include']=[{'all':!![]}];}return db['Dashboard'][_0x23f0('0x45')](_0x23e81a);})[_0x23f0('0x24')](function(_0x23ba83){_0x3e4e8b['rows']=_0x23ba83;return _0x3e4e8b;})[_0x23f0('0x24')](respondWithFilteredResult(_0x495808,_0x23e81a))[_0x23f0('0x46')](handleError(_0x495808,null));};exports[_0x23f0('0x47')]=function(_0x5dc414,_0x200828){var _0x1980cb={'raw':![],'where':{'id':_0x5dc414[_0x23f0('0x48')]['id']}},_0x5d7ad0={};_0x5d7ad0[_0x23f0('0x31')]=_[_0x23f0('0x34')](db['Dashboard'][_0x23f0('0x2d')]);_0x5d7ad0[_0x23f0('0x33')]=_[_0x23f0('0x34')](_0x5dc414['query']);_0x5d7ad0['filters']=_['intersection'](_0x5d7ad0[_0x23f0('0x31')],_0x5d7ad0['query']);_0x1980cb[_0x23f0('0x37')]=_[_0x23f0('0x35')](_0x5d7ad0[_0x23f0('0x31')],qs[_0x23f0('0x36')](_0x5dc414['query'][_0x23f0('0x36')]));_0x1980cb[_0x23f0('0x37')]=_0x1980cb['attributes'][_0x23f0('0x38')]?_0x1980cb['attributes']:_0x5d7ad0[_0x23f0('0x31')];if(_0x5dc414['query'][_0x23f0('0x44')]){_0x1980cb[_0x23f0('0x49')]=[{'all':!![]}];}_0x1980cb=_['merge']({},_0x1980cb,_0x5dc414[_0x23f0('0x42')]);return db[_0x23f0('0x43')]['find'](_0x1980cb)[_0x23f0('0x24')](handleEntityNotFound(_0x200828,null))['then'](respondWithResult(_0x200828,null))['catch'](handleError(_0x200828,null));};exports[_0x23f0('0x4a')]=function(_0x117c57,_0xcdb5f8){return db['Dashboard'][_0x23f0('0x4a')](_0x117c57[_0x23f0('0x4b')],{})[_0x23f0('0x24')](function(_0x5871dd){var _0xacc1c9=_0x117c57[_0x23f0('0x4c')]['get']({'plain':!![]});if(!_0xacc1c9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xacc1c9[_0x23f0('0x4d')]===_0x23f0('0x4c')){var _0x5682ae=_0x5871dd[_0x23f0('0x26')]({'plain':!![]});var _0x1e956a=_0x23f0('0x27');return db['UserProfileSection'][_0x23f0('0x4e')]({'where':{'name':_0x1e956a,'userProfileId':_0xacc1c9['userProfileId']},'raw':!![]})[_0x23f0('0x24')](function(_0x44a2e4){if(_0x44a2e4&&_0x44a2e4[_0x23f0('0x4f')]===0x0){return db[_0x23f0('0x28')]['create']({'name':_0x5682ae['name'],'resourceId':_0x5682ae['id'],'type':_0x44a2e4['name'],'sectionId':_0x44a2e4['id']},{})[_0x23f0('0x24')](function(){return _0x5871dd;});}else{return _0x5871dd;}})['catch'](function(_0x6f3cac){logger[_0x23f0('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6f3cac);throw _0x6f3cac;});}return _0x5871dd;})['then'](respondWithResult(_0xcdb5f8,0xc9))[_0x23f0('0x46')](handleError(_0xcdb5f8,null));};exports[_0x23f0('0x51')]=function(_0xf433b0,_0x53f0a4){var _0x583dfb={'where':{'id':_0xf433b0[_0x23f0('0x48')]['id']}},_0x9f7eaf={};_0x9f7eaf[_0x23f0('0x31')]=_['keys'](db[_0x23f0('0x43')][_0x23f0('0x2d')]);_0x583dfb[_0x23f0('0x37')]=_[_0x23f0('0x35')](_0x9f7eaf[_0x23f0('0x31')],qs[_0x23f0('0x36')](_0xf433b0[_0x23f0('0x33')]['fields']));_0x583dfb[_0x23f0('0x37')]=_0x583dfb[_0x23f0('0x37')]['length']?_0x583dfb[_0x23f0('0x37')]:_0x9f7eaf[_0x23f0('0x31')];if(_0xf433b0['query'][_0x23f0('0x44')]){_0x583dfb[_0x23f0('0x49')]=[{'all':!![]}];}_0x583dfb=_['merge']({},_0x583dfb,_0xf433b0[_0x23f0('0x42')]);return db[_0x23f0('0x43')][_0x23f0('0x4e')](_0x583dfb)[_0x23f0('0x24')](handleEntityNotFound(_0x53f0a4,null))[_0x23f0('0x24')](function(_0x2d5edc){if(_0x2d5edc){var _0x4b9c92=_0x2d5edc['get']({'plain':!![]});_0x4b9c92=qs['omit'](_0x4b9c92,['id','createdAt','updatedAt']);_0xf433b0[_0x23f0('0x4b')]=_['omit'](_0xf433b0[_0x23f0('0x4b')],['id','createdAt',_0x23f0('0x52')]);return db[_0x23f0('0x43')][_0x23f0('0x4a')](_[_0x23f0('0x40')](_0x4b9c92,_0xf433b0[_0x23f0('0x4b')]),{'include':_0xf433b0[_0x23f0('0x33')][_0x23f0('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x1f579f){var _0x54ee7b=_0xf433b0[_0x23f0('0x4c')][_0x23f0('0x26')]({'plain':!![]});if(!_0x54ee7b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54ee7b[_0x23f0('0x4d')]==='user'){var _0x20cf3e=_0x1f579f[_0x23f0('0x26')]({'plain':!![]});var _0x13484d=_0x23f0('0x27');return db[_0x23f0('0x53')][_0x23f0('0x4e')]({'where':{'name':_0x13484d,'userProfileId':_0x54ee7b[_0x23f0('0x54')]},'raw':!![]})[_0x23f0('0x24')](function(_0x25713b){if(_0x25713b&&_0x25713b[_0x23f0('0x4f')]===0x0){return db[_0x23f0('0x28')][_0x23f0('0x4a')]({'name':_0x20cf3e[_0x23f0('0x32')],'resourceId':_0x20cf3e['id'],'type':_0x25713b[_0x23f0('0x32')],'sectionId':_0x25713b['id']},{})['then'](function(){return _0x1f579f;});}else{return _0x1f579f;}})['catch'](function(_0x5b9bba){logger[_0x23f0('0x50')](_0x23f0('0x55'),_0x5b9bba);throw _0x5b9bba;});}return _0x1f579f;});}})['then'](respondWithResult(_0x53f0a4,0xc9))[_0x23f0('0x46')](handleError(_0x53f0a4,null));};exports[_0x23f0('0x56')]=function(_0x1f72cd,_0x5d7864){if(_0x1f72cd[_0x23f0('0x4b')]['id']){delete _0x1f72cd[_0x23f0('0x4b')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x1f72cd[_0x23f0('0x48')]['id']}})[_0x23f0('0x24')](handleEntityNotFound(_0x5d7864,null))['then'](saveUpdates(_0x1f72cd['body'],null))['then'](respondWithResult(_0x5d7864,null))['catch'](handleError(_0x5d7864,null));};exports[_0x23f0('0x25')]=function(_0x553824,_0x52d2c8){return db[_0x23f0('0x43')][_0x23f0('0x4e')]({'where':{'id':_0x553824[_0x23f0('0x48')]['id']}})[_0x23f0('0x24')](handleEntityNotFound(_0x52d2c8,null))[_0x23f0('0x24')](removeEntity(_0x52d2c8,null))[_0x23f0('0x46')](handleError(_0x52d2c8,null));};function widgetAttributes(_0x430b86){try{switch(_0x430b86[_0x23f0('0x2f')]){case'iframe':return[{'name':'attrUrl','value':_0x430b86[_0x23f0('0x57')]||(_0x430b86['attrs']&&_0x430b86[_0x23f0('0x58')][0x0]?_0x430b86['attrs'][0x0][_0x23f0('0x59')]:undefined)||_0x23f0('0x5a')}];case _0x23f0('0x5b'):return[{'name':'attrPath','value':_0x430b86['attrPath']||(_0x430b86[_0x23f0('0x58')]&&_0x430b86[_0x23f0('0x58')][0x0]?_0x430b86[_0x23f0('0x58')][0x0][_0x23f0('0x59')]:undefined)||''}];case _0x23f0('0x5c'):return[{'name':'attrHourFormat','value':_0x430b86['attrHourFormat']||(_0x430b86[_0x23f0('0x58')]&&_0x430b86['attrs'][0x0]?_0x430b86[_0x23f0('0x58')][0x0][_0x23f0('0x59')]:undefined)||_0x23f0('0x5d')},{'name':_0x23f0('0x5e'),'value':_0x430b86[_0x23f0('0x5e')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86[_0x23f0('0x58')][0x1]?_0x430b86[_0x23f0('0x58')][0x1][_0x23f0('0x59')]:undefined)||_0x23f0('0x5f')},{'name':_0x23f0('0x60'),'value':_0x430b86['attrFontSize']||(_0x430b86[_0x23f0('0x58')]&&_0x430b86['attrs'][0x2]?_0x430b86[_0x23f0('0x58')][0x2][_0x23f0('0x59')]:undefined)||0xc}];case _0x23f0('0x61'):return[{'name':_0x23f0('0x62'),'value':_0x430b86[_0x23f0('0x62')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86[_0x23f0('0x58')][0x0]?_0x430b86[_0x23f0('0x58')][0x0][_0x23f0('0x59')]:undefined)||_0x23f0('0x63')},{'name':_0x23f0('0x64'),'value':_0x430b86[_0x23f0('0x64')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86['attrs'][0x1]?_0x430b86[_0x23f0('0x58')][0x1][_0x23f0('0x59')]:undefined)||[]},{'name':'attrFontSize','value':_0x430b86[_0x23f0('0x60')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86['attrs'][0x2]?_0x430b86[_0x23f0('0x58')][0x2][_0x23f0('0x59')]:undefined)||0x14},{'name':_0x23f0('0x65'),'value':_0x430b86[_0x23f0('0x65')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86[_0x23f0('0x58')][0x3]?_0x430b86[_0x23f0('0x58')][0x3][_0x23f0('0x59')]:undefined)||_0x23f0('0x66')},{'name':_0x23f0('0x67'),'value':_0x430b86[_0x23f0('0x67')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86[_0x23f0('0x58')][0x4]?_0x430b86[_0x23f0('0x58')][0x4][_0x23f0('0x59')]:undefined)||''},{'name':_0x23f0('0x68'),'value':_0x430b86[_0x23f0('0x68')]||(_0x430b86['attrs']&&_0x430b86[_0x23f0('0x58')][0x5]?_0x430b86['attrs'][0x5][_0x23f0('0x59')]:undefined)||''},{'name':_0x23f0('0x69'),'value':_0x430b86['attrSmsAccounts']||(_0x430b86[_0x23f0('0x58')]&&_0x430b86[_0x23f0('0x58')][0x6]?_0x430b86['attrs'][0x6]['value']:undefined)||''},{'name':_0x23f0('0x6a'),'value':_0x430b86[_0x23f0('0x6a')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86['attrs'][0x7]?_0x430b86['attrs'][0x7][_0x23f0('0x59')]:undefined)||''},{'name':_0x23f0('0x6b'),'value':_0x430b86[_0x23f0('0x6b')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86[_0x23f0('0x58')][0x8]?_0x430b86[_0x23f0('0x58')][0x8][_0x23f0('0x59')]:undefined)||''},{'name':_0x23f0('0x6c'),'value':_0x430b86[_0x23f0('0x6c')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86['attrs'][0x9]?_0x430b86[_0x23f0('0x58')][0x9]['value']:undefined)||''}];case _0x23f0('0x6d'):case _0x23f0('0x6e'):return[{'name':_0x23f0('0x6f'),'value':_0x430b86['attrSerie1']||(_0x430b86['attrs']&&_0x430b86[_0x23f0('0x58')][0x0]?_0x430b86['attrs'][0x0][_0x23f0('0x59')]:undefined)||_0x23f0('0x63')},{'name':_0x23f0('0x70'),'value':_0x430b86[_0x23f0('0x70')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86[_0x23f0('0x58')][0x1]?_0x430b86[_0x23f0('0x58')][0x1][_0x23f0('0x59')]:undefined)||null},{'name':_0x23f0('0x71'),'value':_0x430b86[_0x23f0('0x71')]||(_0x430b86['attrs']&&_0x430b86[_0x23f0('0x58')][0x2]?_0x430b86['attrs'][0x2]['value']:undefined)||null},{'name':_0x23f0('0x64'),'value':_0x430b86['attrVoiceQueues']||(_0x430b86['attrs']&&_0x430b86[_0x23f0('0x58')][0x3]?_0x430b86[_0x23f0('0x58')][0x3][_0x23f0('0x59')]:undefined)||[]},{'name':_0x23f0('0x65'),'value':_0x430b86[_0x23f0('0x65')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86[_0x23f0('0x58')][0x4]?_0x430b86['attrs'][0x4][_0x23f0('0x59')]:undefined)||_0x23f0('0x66')},{'name':_0x23f0('0x67'),'value':_0x430b86[_0x23f0('0x67')]||(_0x430b86['attrs']&&_0x430b86[_0x23f0('0x58')][0x5]?_0x430b86[_0x23f0('0x58')][0x5]['value']:undefined)||''},{'name':_0x23f0('0x68'),'value':_0x430b86[_0x23f0('0x68')]||(_0x430b86['attrs']&&_0x430b86[_0x23f0('0x58')][0x6]?_0x430b86[_0x23f0('0x58')][0x6]['value']:undefined)||''},{'name':_0x23f0('0x69'),'value':_0x430b86[_0x23f0('0x69')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86[_0x23f0('0x58')][0x7]?_0x430b86[_0x23f0('0x58')][0x7][_0x23f0('0x59')]:undefined)||''},{'name':_0x23f0('0x6a'),'value':_0x430b86[_0x23f0('0x6a')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86[_0x23f0('0x58')][0x8]?_0x430b86['attrs'][0x8][_0x23f0('0x59')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x430b86[_0x23f0('0x6b')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86[_0x23f0('0x58')][0x9]?_0x430b86['attrs'][0x9][_0x23f0('0x59')]:undefined)||''},{'name':_0x23f0('0x6c'),'value':_0x430b86[_0x23f0('0x6c')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86[_0x23f0('0x58')][0xa]?_0x430b86[_0x23f0('0x58')][0xa][_0x23f0('0x59')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x430b86['reportType']||(_0x430b86['attrs']&&_0x430b86[_0x23f0('0x58')][0x0]?_0x430b86['attrs'][0x0]['type']:undefined)||null,'value':_0x430b86[_0x23f0('0x72')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86[_0x23f0('0x58')][0x0]?_0x430b86[_0x23f0('0x58')][0x0]['value']:undefined)||null},{'name':_0x23f0('0x73'),'value':_0x430b86[_0x23f0('0x73')]||(_0x430b86[_0x23f0('0x58')]&&_0x430b86[_0x23f0('0x58')][0x1]?_0x430b86[_0x23f0('0x58')][0x1][_0x23f0('0x59')]:undefined)||0x0}];default:return[];}}catch(_0x6598db){logger[_0x23f0('0x50')]('widgetAttributes:\x20%s',JSON['stringify'](_0x6598db));return[];}}exports[_0x23f0('0x74')]=function(_0x4858e2,_0x2e0b35,_0x16b2f5){if(_0x4858e2[_0x23f0('0x4b')]['id']){delete _0x4858e2['body']['id'];}return db['Dashboard'][_0x23f0('0x4e')]({'where':{'id':_0x4858e2['params']['id']}})[_0x23f0('0x24')](handleEntityNotFound(_0x2e0b35,null))[_0x23f0('0x24')](function(_0x5a33f3){if(_0x5a33f3){_0x4858e2[_0x23f0('0x4b')][_0x23f0('0x75')]=_0x5a33f3['id'];_0x4858e2['body']['attrs']=widgetAttributes(_0x4858e2['body']);return db['DashboardItem']['create'](_0x4858e2[_0x23f0('0x4b')]);}})[_0x23f0('0x24')](respondWithResult(_0x2e0b35,null))[_0x23f0('0x46')](handleError(_0x2e0b35,null));};exports['getItems']=function(_0x24f132,_0x56e6b0,_0x13c44f){var _0x26b188={};var _0x40239e={};var _0x28ce04;var _0x5b3436;return db[_0x23f0('0x43')][_0x23f0('0x76')]({'where':{'id':_0x24f132[_0x23f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e6b0,null))[_0x23f0('0x24')](function(_0x381105){if(_0x381105){_0x28ce04=_0x381105;_0x40239e[_0x23f0('0x31')]=_[_0x23f0('0x34')](db[_0x23f0('0x77')][_0x23f0('0x2d')]);_0x40239e[_0x23f0('0x33')]=_[_0x23f0('0x34')](_0x24f132[_0x23f0('0x33')]);_0x40239e[_0x23f0('0x3e')]=_[_0x23f0('0x35')](_0x40239e[_0x23f0('0x31')],_0x40239e[_0x23f0('0x33')]);_0x26b188[_0x23f0('0x37')]=_[_0x23f0('0x35')](_0x40239e[_0x23f0('0x31')],qs[_0x23f0('0x36')](_0x24f132[_0x23f0('0x33')][_0x23f0('0x36')]));_0x26b188[_0x23f0('0x37')]=_0x26b188[_0x23f0('0x37')][_0x23f0('0x38')]?_0x26b188[_0x23f0('0x37')]:_0x40239e[_0x23f0('0x31')];_0x26b188['order']=qs[_0x23f0('0x3c')](_0x24f132[_0x23f0('0x33')]['sort']);_0x26b188[_0x23f0('0x3d')]=qs[_0x23f0('0x3e')](_[_0x23f0('0x78')](_0x24f132['query'],_0x40239e[_0x23f0('0x3e')]));if(_0x24f132[_0x23f0('0x33')]['filter']){_0x26b188[_0x23f0('0x3d')]=_[_0x23f0('0x40')](_0x26b188[_0x23f0('0x3d')],{'$or':_[_0x23f0('0x2c')](_0x26b188[_0x23f0('0x37')],function(_0x5d8ed7){var _0x1f4ed3={};_0x1f4ed3[_0x5d8ed7]={'$like':'%'+_0x24f132['query'][_0x23f0('0x3f')]+'%'};return _0x1f4ed3;})});}_0x26b188=_[_0x23f0('0x40')]({},_0x26b188,_0x24f132[_0x23f0('0x42')]);return _0x28ce04[_0x23f0('0x79')](_0x26b188);}})[_0x23f0('0x24')](function(_0xa33b9a){if(_0xa33b9a){_0x5b3436=_0xa33b9a[_0x23f0('0x38')];if(!_0x24f132[_0x23f0('0x33')][_0x23f0('0x39')](_0x23f0('0x3a'))){_0x26b188[_0x23f0('0x1e')]=qs['limit'](_0x24f132[_0x23f0('0x33')][_0x23f0('0x1e')]);_0x26b188[_0x23f0('0x1d')]=qs[_0x23f0('0x1d')](_0x24f132[_0x23f0('0x33')]['offset']);}return _0x28ce04[_0x23f0('0x79')](_0x26b188);}})[_0x23f0('0x24')](function(_0xadd713){if(_0xadd713){return _0xadd713?{'count':_0x5b3436,'rows':_0xadd713}:null;}})[_0x23f0('0x24')](respondWithResult(_0x56e6b0,null))['catch'](handleError(_0x56e6b0,null));}; \ No newline at end of file +var _0xc414=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','reject','update','then','destroy','get','CustomDashboards','error','stack','name','send','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrOpenchannelAccounts','attrWhatsappAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','getItems','eml-format','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5c9f8b,_0x348375){var _0x5a7832=function(_0x495c7b){while(--_0x495c7b){_0x5c9f8b['push'](_0x5c9f8b['shift']());}};_0x5a7832(++_0x348375);}(_0xc414,0xee));var _0x4c41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc414[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4c41('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4c41('0x1'));var moment=require('moment');var BPromise=require(_0x4c41('0x2'));var Mustache=require(_0x4c41('0x3'));var util=require(_0x4c41('0x4'));var path=require('path');var sox=require(_0x4c41('0x5'));var csv=require(_0x4c41('0x6'));var ejs=require(_0x4c41('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4c41('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4c41('0x6'));var querystring=require(_0x4c41('0x9'));var Papa=require(_0x4c41('0xa'));var Redis=require(_0x4c41('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x4c41('0xc'));var as=require(_0x4c41('0xd'));var hardwareService=require(_0x4c41('0xe'));var logger=require(_0x4c41('0xf'))(_0x4c41('0x10'));var utils=require(_0x4c41('0x11'));var config=require(_0x4c41('0x12'));var licenseUtil=require(_0x4c41('0x13'));var db=require(_0x4c41('0x14'))['db'];config[_0x4c41('0x15')]=_[_0x4c41('0x16')](config[_0x4c41('0x15')],{'host':_0x4c41('0x17'),'port':0x18eb});var socket=require(_0x4c41('0x18'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x2f9c67,_0x5eb7d4){_0x5eb7d4=_0x5eb7d4||0xcc;return function(_0x563f42){if(_0x563f42){return _0x2f9c67[_0x4c41('0x19')](_0x5eb7d4);}return _0x2f9c67[_0x4c41('0x1a')](_0x5eb7d4)[_0x4c41('0x1b')]();};}function respondWithResult(_0x1fa022,_0x61a0e1){_0x61a0e1=_0x61a0e1||0xc8;return function(_0x4d3603){if(_0x4d3603){return _0x1fa022[_0x4c41('0x1a')](_0x61a0e1)[_0x4c41('0x1c')](_0x4d3603);}};}function respondWithFilteredResult(_0x22fb74,_0x439981){return function(_0x3b7a5a){if(_0x3b7a5a){var _0x596a06=typeof _0x439981[_0x4c41('0x1d')]===_0x4c41('0x1e')&&typeof _0x439981[_0x4c41('0x1f')]===_0x4c41('0x1e');var _0x4afee4=_0x3b7a5a[_0x4c41('0x20')];var _0x46831c=_0x596a06?0x0:_0x439981[_0x4c41('0x1d')];var _0x12f075=_0x596a06?_0x3b7a5a[_0x4c41('0x20')]:_0x439981[_0x4c41('0x1d')]+_0x439981[_0x4c41('0x1f')];var _0x4a212e;if(_0x12f075>=_0x4afee4){_0x12f075=_0x4afee4;_0x4a212e=0xc8;}else{_0x4a212e=0xce;}_0x22fb74['status'](_0x4a212e);return _0x22fb74['set']('Content-Range',_0x46831c+'-'+_0x12f075+'/'+_0x4afee4)[_0x4c41('0x1c')](_0x3b7a5a);}return null;};}function patchUpdates(_0x3dab5b){return function(_0x4964c8){try{jsonpatch['apply'](_0x4964c8,_0x3dab5b,!![]);}catch(_0x1eff02){return BPromise[_0x4c41('0x21')](_0x1eff02);}return _0x4964c8['save']();};}function saveUpdates(_0x522fa0,_0x2d1d8f){return function(_0x5e8b0e){if(_0x5e8b0e){return _0x5e8b0e[_0x4c41('0x22')](_0x522fa0)[_0x4c41('0x23')](function(_0x1701d9){return _0x1701d9;});}return null;};}function removeEntity(_0x5d6334,_0x163e09){return function(_0x627adf){if(_0x627adf){return _0x627adf[_0x4c41('0x24')]()[_0x4c41('0x23')](function(){var _0x3ec363=_0x627adf[_0x4c41('0x25')]({'plain':!![]});var _0x37c03a=_0x4c41('0x26');return db['UserProfileResource'][_0x4c41('0x24')]({'where':{'type':_0x37c03a,'resourceId':_0x3ec363['id']}})[_0x4c41('0x23')](function(){return _0x627adf;});})[_0x4c41('0x23')](function(){_0x5d6334[_0x4c41('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdc8e6,_0x5502d2){return function(_0x3578ca){if(!_0x3578ca){_0xdc8e6['sendStatus'](0x194);}return _0x3578ca;};}function handleError(_0x25a894,_0x9e34dc){_0x9e34dc=_0x9e34dc||0x1f4;return function(_0x572f3b){logger[_0x4c41('0x27')](_0x572f3b[_0x4c41('0x28')]);if(_0x572f3b[_0x4c41('0x29')]){delete _0x572f3b[_0x4c41('0x29')];}_0x25a894[_0x4c41('0x1a')](_0x9e34dc)[_0x4c41('0x2a')](_0x572f3b);};}exports['index']=function(_0x105092,_0x339285){var _0x387c99={},_0x1e9d3d={},_0x113be2={'count':0x0,'rows':[]};var _0x4c2a44=_[_0x4c41('0x2b')](db[_0x4c41('0x2c')][_0x4c41('0x2d')],function(_0x5e4c2b){return{'name':_0x5e4c2b[_0x4c41('0x2e')],'type':_0x5e4c2b[_0x4c41('0x2f')][_0x4c41('0x30')]};});_0x1e9d3d[_0x4c41('0x31')]=_[_0x4c41('0x2b')](_0x4c2a44,_0x4c41('0x29'));_0x1e9d3d['query']=_[_0x4c41('0x32')](_0x105092['query']);_0x1e9d3d[_0x4c41('0x33')]=_[_0x4c41('0x34')](_0x1e9d3d[_0x4c41('0x31')],_0x1e9d3d['query']);_0x387c99['attributes']=_[_0x4c41('0x34')](_0x1e9d3d[_0x4c41('0x31')],qs[_0x4c41('0x35')](_0x105092[_0x4c41('0x36')][_0x4c41('0x35')]));_0x387c99[_0x4c41('0x37')]=_0x387c99[_0x4c41('0x37')][_0x4c41('0x38')]?_0x387c99['attributes']:_0x1e9d3d[_0x4c41('0x31')];if(!_0x105092[_0x4c41('0x36')][_0x4c41('0x39')](_0x4c41('0x3a'))){_0x387c99[_0x4c41('0x1f')]=qs[_0x4c41('0x1f')](_0x105092[_0x4c41('0x36')][_0x4c41('0x1f')]);_0x387c99[_0x4c41('0x1d')]=qs[_0x4c41('0x1d')](_0x105092[_0x4c41('0x36')][_0x4c41('0x1d')]);}_0x387c99[_0x4c41('0x3b')]=qs[_0x4c41('0x3c')](_0x105092[_0x4c41('0x36')][_0x4c41('0x3c')]);_0x387c99[_0x4c41('0x3d')]=qs[_0x4c41('0x33')](_[_0x4c41('0x3e')](_0x105092[_0x4c41('0x36')],_0x1e9d3d[_0x4c41('0x33')]),_0x4c2a44);if(_0x105092[_0x4c41('0x36')][_0x4c41('0x3f')]){_0x387c99[_0x4c41('0x3d')]=_[_0x4c41('0x40')](_0x387c99[_0x4c41('0x3d')],{'$or':_[_0x4c41('0x2b')](_0x4c2a44,function(_0x59ebc3){if(_0x59ebc3[_0x4c41('0x2f')]!==_0x4c41('0x41')){var _0x3c242e={};_0x3c242e[_0x59ebc3[_0x4c41('0x29')]]={'$like':'%'+_0x105092[_0x4c41('0x36')][_0x4c41('0x3f')]+'%'};return _0x3c242e;}})});}_0x387c99=_[_0x4c41('0x40')]({},_0x387c99,_0x105092[_0x4c41('0x42')]);var _0x450a81={'where':_0x387c99[_0x4c41('0x3d')]};return db[_0x4c41('0x2c')][_0x4c41('0x20')](_0x450a81)['then'](function(_0x3eff7d){_0x113be2[_0x4c41('0x20')]=_0x3eff7d;if(_0x105092[_0x4c41('0x36')][_0x4c41('0x43')]){_0x387c99[_0x4c41('0x44')]=[{'all':!![]}];}return db['Dashboard'][_0x4c41('0x45')](_0x387c99);})[_0x4c41('0x23')](function(_0x44e9e0){_0x113be2[_0x4c41('0x46')]=_0x44e9e0;return _0x113be2;})[_0x4c41('0x23')](respondWithFilteredResult(_0x339285,_0x387c99))[_0x4c41('0x47')](handleError(_0x339285,null));};exports[_0x4c41('0x48')]=function(_0x574379,_0x10f2d5){var _0x2e25ba={'raw':![],'where':{'id':_0x574379[_0x4c41('0x49')]['id']}},_0x557fa2={};_0x557fa2['model']=_[_0x4c41('0x32')](db[_0x4c41('0x2c')]['rawAttributes']);_0x557fa2['query']=_[_0x4c41('0x32')](_0x574379[_0x4c41('0x36')]);_0x557fa2[_0x4c41('0x33')]=_[_0x4c41('0x34')](_0x557fa2['model'],_0x557fa2[_0x4c41('0x36')]);_0x2e25ba[_0x4c41('0x37')]=_['intersection'](_0x557fa2[_0x4c41('0x31')],qs[_0x4c41('0x35')](_0x574379['query'][_0x4c41('0x35')]));_0x2e25ba[_0x4c41('0x37')]=_0x2e25ba[_0x4c41('0x37')][_0x4c41('0x38')]?_0x2e25ba['attributes']:_0x557fa2['model'];if(_0x574379['query'][_0x4c41('0x43')]){_0x2e25ba[_0x4c41('0x44')]=[{'all':!![]}];}_0x2e25ba=_[_0x4c41('0x40')]({},_0x2e25ba,_0x574379[_0x4c41('0x42')]);return db[_0x4c41('0x2c')][_0x4c41('0x4a')](_0x2e25ba)[_0x4c41('0x23')](handleEntityNotFound(_0x10f2d5,null))[_0x4c41('0x23')](respondWithResult(_0x10f2d5,null))[_0x4c41('0x47')](handleError(_0x10f2d5,null));};exports[_0x4c41('0x4b')]=function(_0x16e57c,_0x249ba8){return db[_0x4c41('0x2c')][_0x4c41('0x4b')](_0x16e57c[_0x4c41('0x4c')],{})[_0x4c41('0x23')](function(_0x12466c){var _0x1cbb69=_0x16e57c['user'][_0x4c41('0x25')]({'plain':!![]});if(!_0x1cbb69)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cbb69[_0x4c41('0x4d')]===_0x4c41('0x4e')){var _0x272743=_0x12466c[_0x4c41('0x25')]({'plain':!![]});var _0x3b97b8=_0x4c41('0x26');return db[_0x4c41('0x4f')]['find']({'where':{'name':_0x3b97b8,'userProfileId':_0x1cbb69[_0x4c41('0x50')]},'raw':!![]})[_0x4c41('0x23')](function(_0xe23f4e){if(_0xe23f4e&&_0xe23f4e[_0x4c41('0x51')]===0x0){return db['UserProfileResource'][_0x4c41('0x4b')]({'name':_0x272743[_0x4c41('0x29')],'resourceId':_0x272743['id'],'type':_0xe23f4e[_0x4c41('0x29')],'sectionId':_0xe23f4e['id']},{})['then'](function(){return _0x12466c;});}else{return _0x12466c;}})[_0x4c41('0x47')](function(_0x11fac7){logger[_0x4c41('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11fac7);throw _0x11fac7;});}return _0x12466c;})[_0x4c41('0x23')](respondWithResult(_0x249ba8,0xc9))['catch'](handleError(_0x249ba8,null));};exports[_0x4c41('0x52')]=function(_0x216e38,_0x36baea){var _0xbee8={'where':{'id':_0x216e38[_0x4c41('0x49')]['id']}},_0xeadad={};_0xeadad[_0x4c41('0x31')]=_['keys'](db[_0x4c41('0x2c')]['rawAttributes']);_0xbee8['attributes']=_[_0x4c41('0x34')](_0xeadad['model'],qs[_0x4c41('0x35')](_0x216e38['query']['fields']));_0xbee8[_0x4c41('0x37')]=_0xbee8[_0x4c41('0x37')][_0x4c41('0x38')]?_0xbee8['attributes']:_0xeadad[_0x4c41('0x31')];if(_0x216e38['query'][_0x4c41('0x43')]){_0xbee8[_0x4c41('0x44')]=[{'all':!![]}];}_0xbee8=_['merge']({},_0xbee8,_0x216e38[_0x4c41('0x42')]);return db[_0x4c41('0x2c')][_0x4c41('0x4a')](_0xbee8)['then'](handleEntityNotFound(_0x36baea,null))[_0x4c41('0x23')](function(_0x19e64e){if(_0x19e64e){var _0x2e9fc0=_0x19e64e[_0x4c41('0x25')]({'plain':!![]});_0x2e9fc0=qs[_0x4c41('0x53')](_0x2e9fc0,['id',_0x4c41('0x54'),_0x4c41('0x55')]);_0x216e38[_0x4c41('0x4c')]=_[_0x4c41('0x53')](_0x216e38[_0x4c41('0x4c')],['id',_0x4c41('0x54'),'updatedAt']);return db[_0x4c41('0x2c')][_0x4c41('0x4b')](_[_0x4c41('0x40')](_0x2e9fc0,_0x216e38[_0x4c41('0x4c')]),{'include':_0x216e38['query'][_0x4c41('0x43')]?[{'all':!![]}]:undefined})[_0x4c41('0x23')](function(_0xe17e54){var _0xa2019c=_0x216e38[_0x4c41('0x4e')][_0x4c41('0x25')]({'plain':!![]});if(!_0xa2019c)throw new Error(_0x4c41('0x56'));if(_0xa2019c[_0x4c41('0x4d')]==='user'){var _0x3f7a4a=_0xe17e54[_0x4c41('0x25')]({'plain':!![]});var _0x2f735e=_0x4c41('0x26');return db['UserProfileSection'][_0x4c41('0x4a')]({'where':{'name':_0x2f735e,'userProfileId':_0xa2019c[_0x4c41('0x50')]},'raw':!![]})[_0x4c41('0x23')](function(_0x1ccd74){if(_0x1ccd74&&_0x1ccd74[_0x4c41('0x51')]===0x0){return db[_0x4c41('0x57')]['create']({'name':_0x3f7a4a[_0x4c41('0x29')],'resourceId':_0x3f7a4a['id'],'type':_0x1ccd74[_0x4c41('0x29')],'sectionId':_0x1ccd74['id']},{})['then'](function(){return _0xe17e54;});}else{return _0xe17e54;}})[_0x4c41('0x47')](function(_0x344175){logger[_0x4c41('0x27')](_0x4c41('0x58'),_0x344175);throw _0x344175;});}return _0xe17e54;});}})[_0x4c41('0x23')](respondWithResult(_0x36baea,0xc9))[_0x4c41('0x47')](handleError(_0x36baea,null));};exports[_0x4c41('0x22')]=function(_0xc6cc0a,_0x231102){if(_0xc6cc0a['body']['id']){delete _0xc6cc0a[_0x4c41('0x4c')]['id'];}return db[_0x4c41('0x2c')][_0x4c41('0x4a')]({'where':{'id':_0xc6cc0a[_0x4c41('0x49')]['id']}})[_0x4c41('0x23')](handleEntityNotFound(_0x231102,null))[_0x4c41('0x23')](saveUpdates(_0xc6cc0a['body'],null))['then'](respondWithResult(_0x231102,null))['catch'](handleError(_0x231102,null));};exports['destroy']=function(_0x21702f,_0x4115b9){return db['Dashboard'][_0x4c41('0x4a')]({'where':{'id':_0x21702f[_0x4c41('0x49')]['id']}})[_0x4c41('0x23')](handleEntityNotFound(_0x4115b9,null))[_0x4c41('0x23')](removeEntity(_0x4115b9,null))[_0x4c41('0x47')](handleError(_0x4115b9,null));};function widgetAttributes(_0x2790d6){try{switch(_0x2790d6['type']){case _0x4c41('0x59'):return[{'name':_0x4c41('0x5a'),'value':_0x2790d6[_0x4c41('0x5a')]||(_0x2790d6['attrs']&&_0x2790d6[_0x4c41('0x5b')][0x0]?_0x2790d6[_0x4c41('0x5b')][0x0][_0x4c41('0x5c')]:undefined)||_0x4c41('0x5d')}];case _0x4c41('0x5e'):return[{'name':_0x4c41('0x5f'),'value':_0x2790d6[_0x4c41('0x5f')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6['attrs'][0x0]?_0x2790d6[_0x4c41('0x5b')][0x0][_0x4c41('0x5c')]:undefined)||''}];case'clock':return[{'name':_0x4c41('0x60'),'value':_0x2790d6[_0x4c41('0x60')]||(_0x2790d6['attrs']&&_0x2790d6[_0x4c41('0x5b')][0x0]?_0x2790d6[_0x4c41('0x5b')][0x0][_0x4c41('0x5c')]:undefined)||_0x4c41('0x61')},{'name':_0x4c41('0x62'),'value':_0x2790d6[_0x4c41('0x62')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x1]?_0x2790d6['attrs'][0x1][_0x4c41('0x5c')]:undefined)||_0x4c41('0x63')},{'name':_0x4c41('0x64'),'value':_0x2790d6[_0x4c41('0x64')]||(_0x2790d6['attrs']&&_0x2790d6[_0x4c41('0x5b')][0x2]?_0x2790d6['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x2790d6[_0x4c41('0x65')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x0]?_0x2790d6['attrs'][0x0][_0x4c41('0x5c')]:undefined)||_0x4c41('0x66')},{'name':_0x4c41('0x67'),'value':_0x2790d6['attrVoiceQueues']||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x1]?_0x2790d6[_0x4c41('0x5b')][0x1][_0x4c41('0x5c')]:undefined)||[]},{'name':_0x4c41('0x64'),'value':_0x2790d6[_0x4c41('0x64')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6['attrs'][0x2]?_0x2790d6[_0x4c41('0x5b')][0x2][_0x4c41('0x5c')]:undefined)||0x14},{'name':'attrChannel','value':_0x2790d6[_0x4c41('0x68')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x3]?_0x2790d6['attrs'][0x3][_0x4c41('0x5c')]:undefined)||'voice'},{'name':_0x4c41('0x69'),'value':_0x2790d6[_0x4c41('0x69')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x4]?_0x2790d6[_0x4c41('0x5b')][0x4]['value']:undefined)||''},{'name':_0x4c41('0x6a'),'value':_0x2790d6[_0x4c41('0x6a')]||(_0x2790d6['attrs']&&_0x2790d6['attrs'][0x5]?_0x2790d6['attrs'][0x5][_0x4c41('0x5c')]:undefined)||''},{'name':_0x4c41('0x6b'),'value':_0x2790d6[_0x4c41('0x6b')]||(_0x2790d6['attrs']&&_0x2790d6[_0x4c41('0x5b')][0x6]?_0x2790d6[_0x4c41('0x5b')][0x6][_0x4c41('0x5c')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2790d6['attrOpenchannelAccounts']||(_0x2790d6['attrs']&&_0x2790d6['attrs'][0x7]?_0x2790d6[_0x4c41('0x5b')][0x7][_0x4c41('0x5c')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2790d6['attrWhatsappAccounts']||(_0x2790d6['attrs']&&_0x2790d6[_0x4c41('0x5b')][0x8]?_0x2790d6[_0x4c41('0x5b')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x2790d6[_0x4c41('0x6c')]||(_0x2790d6['attrs']&&_0x2790d6[_0x4c41('0x5b')][0x9]?_0x2790d6[_0x4c41('0x5b')][0x9][_0x4c41('0x5c')]:undefined)||''}];case _0x4c41('0x6d'):case _0x4c41('0x6e'):return[{'name':_0x4c41('0x6f'),'value':_0x2790d6[_0x4c41('0x6f')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x0]?_0x2790d6[_0x4c41('0x5b')][0x0][_0x4c41('0x5c')]:undefined)||_0x4c41('0x66')},{'name':_0x4c41('0x70'),'value':_0x2790d6[_0x4c41('0x70')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x1]?_0x2790d6[_0x4c41('0x5b')][0x1][_0x4c41('0x5c')]:undefined)||null},{'name':'attrSerie3','value':_0x2790d6[_0x4c41('0x71')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x2]?_0x2790d6[_0x4c41('0x5b')][0x2]['value']:undefined)||null},{'name':_0x4c41('0x67'),'value':_0x2790d6[_0x4c41('0x67')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x3]?_0x2790d6[_0x4c41('0x5b')][0x3][_0x4c41('0x5c')]:undefined)||[]},{'name':_0x4c41('0x68'),'value':_0x2790d6[_0x4c41('0x68')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x4]?_0x2790d6[_0x4c41('0x5b')][0x4][_0x4c41('0x5c')]:undefined)||'voice'},{'name':_0x4c41('0x69'),'value':_0x2790d6[_0x4c41('0x69')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x5]?_0x2790d6['attrs'][0x5]['value']:undefined)||''},{'name':_0x4c41('0x6a'),'value':_0x2790d6[_0x4c41('0x6a')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6['attrs'][0x6]?_0x2790d6['attrs'][0x6][_0x4c41('0x5c')]:undefined)||''},{'name':_0x4c41('0x6b'),'value':_0x2790d6[_0x4c41('0x6b')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x7]?_0x2790d6['attrs'][0x7][_0x4c41('0x5c')]:undefined)||''},{'name':_0x4c41('0x72'),'value':_0x2790d6[_0x4c41('0x72')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x8]?_0x2790d6[_0x4c41('0x5b')][0x8][_0x4c41('0x5c')]:undefined)||''},{'name':_0x4c41('0x73'),'value':_0x2790d6[_0x4c41('0x73')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x9]?_0x2790d6[_0x4c41('0x5b')][0x9][_0x4c41('0x5c')]:undefined)||''},{'name':_0x4c41('0x6c'),'value':_0x2790d6[_0x4c41('0x6c')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0xa]?_0x2790d6['attrs'][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x4c41('0x74'),'type':_0x2790d6[_0x4c41('0x75')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x0]?_0x2790d6[_0x4c41('0x5b')][0x0][_0x4c41('0x2f')]:undefined)||null,'value':_0x2790d6[_0x4c41('0x74')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6[_0x4c41('0x5b')][0x0]?_0x2790d6[_0x4c41('0x5b')][0x0][_0x4c41('0x5c')]:undefined)||null},{'name':'attrRefresh','value':_0x2790d6[_0x4c41('0x76')]||(_0x2790d6[_0x4c41('0x5b')]&&_0x2790d6['attrs'][0x1]?_0x2790d6[_0x4c41('0x5b')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x454f2d){logger[_0x4c41('0x27')](_0x4c41('0x77'),JSON[_0x4c41('0x78')](_0x454f2d));return[];}}exports[_0x4c41('0x79')]=function(_0x5ca56c,_0xab5684,_0x17ebbf){if(_0x5ca56c[_0x4c41('0x4c')]['id']){delete _0x5ca56c[_0x4c41('0x4c')]['id'];}return db[_0x4c41('0x2c')][_0x4c41('0x4a')]({'where':{'id':_0x5ca56c['params']['id']}})[_0x4c41('0x23')](handleEntityNotFound(_0xab5684,null))['then'](function(_0x56cbac){if(_0x56cbac){_0x5ca56c[_0x4c41('0x4c')][_0x4c41('0x7a')]=_0x56cbac['id'];_0x5ca56c[_0x4c41('0x4c')][_0x4c41('0x5b')]=widgetAttributes(_0x5ca56c[_0x4c41('0x4c')]);return db[_0x4c41('0x7b')][_0x4c41('0x4b')](_0x5ca56c[_0x4c41('0x4c')]);}})[_0x4c41('0x23')](respondWithResult(_0xab5684,null))[_0x4c41('0x47')](handleError(_0xab5684,null));};exports['getItems']=function(_0x4eb0cb,_0x28e701,_0x404db7){var _0x3d252e={};var _0x4365ca={};var _0x2348ba;var _0xe6525d;return db[_0x4c41('0x2c')][_0x4c41('0x7c')]({'where':{'id':_0x4eb0cb[_0x4c41('0x49')]['id']}})[_0x4c41('0x23')](handleEntityNotFound(_0x28e701,null))[_0x4c41('0x23')](function(_0x4d31f9){if(_0x4d31f9){_0x2348ba=_0x4d31f9;_0x4365ca[_0x4c41('0x31')]=_[_0x4c41('0x32')](db[_0x4c41('0x7b')][_0x4c41('0x2d')]);_0x4365ca['query']=_[_0x4c41('0x32')](_0x4eb0cb[_0x4c41('0x36')]);_0x4365ca[_0x4c41('0x33')]=_[_0x4c41('0x34')](_0x4365ca['model'],_0x4365ca[_0x4c41('0x36')]);_0x3d252e[_0x4c41('0x37')]=_['intersection'](_0x4365ca[_0x4c41('0x31')],qs[_0x4c41('0x35')](_0x4eb0cb['query']['fields']));_0x3d252e[_0x4c41('0x37')]=_0x3d252e[_0x4c41('0x37')][_0x4c41('0x38')]?_0x3d252e[_0x4c41('0x37')]:_0x4365ca[_0x4c41('0x31')];_0x3d252e['order']=qs[_0x4c41('0x3c')](_0x4eb0cb[_0x4c41('0x36')][_0x4c41('0x3c')]);_0x3d252e[_0x4c41('0x3d')]=qs[_0x4c41('0x33')](_['pick'](_0x4eb0cb[_0x4c41('0x36')],_0x4365ca[_0x4c41('0x33')]));if(_0x4eb0cb['query'][_0x4c41('0x3f')]){_0x3d252e['where']=_[_0x4c41('0x40')](_0x3d252e[_0x4c41('0x3d')],{'$or':_[_0x4c41('0x2b')](_0x3d252e['attributes'],function(_0x155e50){var _0x57a9c0={};_0x57a9c0[_0x155e50]={'$like':'%'+_0x4eb0cb['query'][_0x4c41('0x3f')]+'%'};return _0x57a9c0;})});}_0x3d252e=_[_0x4c41('0x40')]({},_0x3d252e,_0x4eb0cb[_0x4c41('0x42')]);return _0x2348ba[_0x4c41('0x7d')](_0x3d252e);}})[_0x4c41('0x23')](function(_0x3a8b2c){if(_0x3a8b2c){_0xe6525d=_0x3a8b2c[_0x4c41('0x38')];if(!_0x4eb0cb[_0x4c41('0x36')][_0x4c41('0x39')](_0x4c41('0x3a'))){_0x3d252e['limit']=qs['limit'](_0x4eb0cb[_0x4c41('0x36')]['limit']);_0x3d252e[_0x4c41('0x1d')]=qs[_0x4c41('0x1d')](_0x4eb0cb['query'][_0x4c41('0x1d')]);}return _0x2348ba[_0x4c41('0x7d')](_0x3d252e);}})[_0x4c41('0x23')](function(_0x252a38){if(_0x252a38){return _0x252a38?{'count':_0xe6525d,'rows':_0x252a38}:null;}})[_0x4c41('0x23')](respondWithResult(_0x28e701,null))[_0x4c41('0x47')](handleError(_0x28e701,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index d73e68a..7a63f77 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 _0x40f3=['Dashboard','save','update','emit','hook','exports','../../mysqldb'];(function(_0x212b32,_0x1781e8){var _0x3f1e7e=function(_0xf9a727){while(--_0xf9a727){_0x212b32['push'](_0x212b32['shift']());}};_0x3f1e7e(++_0x1781e8);}(_0x40f3,0x8b));var _0x340f=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x40f3[_0x4dc7b9];return _0x3ab114;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x340f('0x0'))['db'][_0x340f('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x340f('0x2'),'afterUpdate':_0x340f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x541841){return function(_0x42b102,_0x3380ba,_0x5b331a){DashboardEvents[_0x340f('0x4')](_0x541841+':'+_0x42b102['id'],_0x42b102);DashboardEvents['emit'](_0x541841,_0x42b102);_0x5b331a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x340f('0x5')](e,emitEvent(event));}}module[_0x340f('0x6')]=DashboardEvents; \ No newline at end of file +var _0xf2a0=['save','remove','emit','hasOwnProperty','hook','../../mysqldb','Dashboard','setMaxListeners'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xf2a0,0x7d));var _0x0f2a=function(_0x5a75e7,_0x3ad506){_0x5a75e7=_0x5a75e7-0x0;var _0x15c695=_0xf2a0[_0x5a75e7];return _0x15c695;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x0f2a('0x0'))['db'][_0x0f2a('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x0f2a('0x2')](0x0);var events={'afterCreate':_0x0f2a('0x3'),'afterUpdate':'update','afterDestroy':_0x0f2a('0x4')};function emitEvent(_0x53675){return function(_0x17fdb8,_0x56095c,_0x452b83){DashboardEvents[_0x0f2a('0x5')](_0x53675+':'+_0x17fdb8['id'],_0x17fdb8);DashboardEvents['emit'](_0x53675,_0x17fdb8);_0x452b83(null);};}for(var e in events){if(events[_0x0f2a('0x6')](e)){var event=events[e];Dashboard[_0x0f2a('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 574aaa6..677325a 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 _0x71b6=['./dashboard.attributes','exports','define','Dashboard','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xb8a9d9,_0x419509){var _0x5302f3=function(_0xc4607a){while(--_0xc4607a){_0xb8a9d9['push'](_0xb8a9d9['shift']());}};_0x5302f3(++_0x419509);}(_0x71b6,0xe0));var _0x671b=function(_0x5dd48e,_0x3b0824){_0x5dd48e=_0x5dd48e-0x0;var _0x1ca5ff=_0x71b6[_0x5dd48e];return _0x1ca5ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x671b('0x0'))(_0x671b('0x1'));var moment=require('moment');var BPromise=require(_0x671b('0x2'));var rp=require(_0x671b('0x3'));var fs=require('fs');var path=require(_0x671b('0x4'));var rimraf=require(_0x671b('0x5'));var config=require(_0x671b('0x6'));var attributes=require(_0x671b('0x7'));module[_0x671b('0x8')]=function(_0x2d231e,_0x2fde3a){return _0x2d231e[_0x671b('0x9')](_0x671b('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4341=['exports','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x315d84,_0x3dacc3){var _0x560da1=function(_0x22ccb0){while(--_0x22ccb0){_0x315d84['push'](_0x315d84['shift']());}};_0x560da1(++_0x3dacc3);}(_0x4341,0xb5));var _0x1434=function(_0x2595a6,_0x48fc45){_0x2595a6=_0x2595a6-0x0;var _0x460197=_0x4341[_0x2595a6];return _0x460197;};'use strict';var _=require(_0x1434('0x0'));var util=require('util');var logger=require(_0x1434('0x1'))(_0x1434('0x2'));var moment=require(_0x1434('0x3'));var BPromise=require(_0x1434('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1434('0x5'));var rimraf=require(_0x1434('0x6'));var config=require(_0x1434('0x7'));var attributes=require(_0x1434('0x8'));module[_0x1434('0x9')]=function(_0x3cea38,_0x31fd65){return _0x3cea38['define']('Dashboard',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 75de145..8c421db 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 _0xd192=['error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x28fcdc,_0x17e930){var _0x80bd4c=function(_0x2c490d){while(--_0x2c490d){_0x28fcdc['push'](_0x28fcdc['shift']());}};_0x80bd4c(++_0x17e930);}(_0xd192,0x130));var _0x2d19=function(_0x545ced,_0x2eb3d3){_0x545ced=_0x545ced-0x0;var _0x40da32=_0xd192[_0x545ced];return _0x40da32;};'use strict';var _=require('lodash');var util=require(_0x2d19('0x0'));var moment=require('moment');var BPromise=require(_0x2d19('0x1'));var rs=require(_0x2d19('0x2'));var fs=require('fs');var Redis=require(_0x2d19('0x3'));var db=require(_0x2d19('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d19('0x5'))(_0x2d19('0x6'));var config=require(_0x2d19('0x7'));var jayson=require(_0x2d19('0x8'));var client=jayson[_0x2d19('0x9')]['http']({'port':0x232a});config[_0x2d19('0xa')]=_['defaults'](config[_0x2d19('0xa')],{'host':_0x2d19('0xb'),'port':0x18eb});var socket=require(_0x2d19('0xc'))(new Redis(config[_0x2d19('0xa')]));require(_0x2d19('0xd'))['register'](socket);function respondWithRpcPromise(_0x13a131,_0x49d931,_0x190d30){return new BPromise(function(_0x4ff5e8,_0x4166c8){return client[_0x2d19('0xe')](_0x13a131,_0x190d30)[_0x2d19('0xf')](function(_0x102af5){logger[_0x2d19('0x10')](_0x2d19('0x11'),_0x49d931,'request\x20sent');logger[_0x2d19('0x12')](_0x2d19('0x13'),_0x49d931,'request\x20sent',JSON[_0x2d19('0x14')](_0x102af5));if(_0x102af5[_0x2d19('0x15')]){if(_0x102af5[_0x2d19('0x15')][_0x2d19('0x16')]===0x1f4){logger[_0x2d19('0x15')](_0x2d19('0x11'),_0x49d931,_0x102af5['error'][_0x2d19('0x17')]);return _0x4166c8(_0x102af5['error']['message']);}logger[_0x2d19('0x15')]('Dashboard,\x20%s,\x20%s',_0x49d931,_0x102af5[_0x2d19('0x15')]['message']);return _0x4ff5e8(_0x102af5['error']['message']);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x49d931,'request\x20sent');_0x4ff5e8(_0x102af5[_0x2d19('0x18')][_0x2d19('0x17')]);}})['catch'](function(_0x47b88f){logger[_0x2d19('0x15')](_0x2d19('0x11'),_0x49d931,_0x47b88f);_0x4166c8(_0x47b88f);});});} \ No newline at end of file +var _0x29e1=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5af7af,_0x3ee946){var _0x548c33=function(_0xbff1c8){while(--_0xbff1c8){_0x5af7af['push'](_0x5af7af['shift']());}};_0x548c33(++_0x3ee946);}(_0x29e1,0x15c));var _0x129e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x129e('0x0'));var moment=require('moment');var BPromise=require(_0x129e('0x1'));var rs=require(_0x129e('0x2'));var fs=require('fs');var Redis=require(_0x129e('0x3'));var db=require(_0x129e('0x4'))['db'];var utils=require(_0x129e('0x5'));var logger=require(_0x129e('0x6'))(_0x129e('0x7'));var config=require(_0x129e('0x8'));var jayson=require(_0x129e('0x9'));var client=jayson['client'][_0x129e('0xa')]({'port':0x232a});config[_0x129e('0xb')]=_['defaults'](config[_0x129e('0xb')],{'host':_0x129e('0xc'),'port':0x18eb});var socket=require(_0x129e('0xd'))(new Redis(config['redis']));require(_0x129e('0xe'))[_0x129e('0xf')](socket);function respondWithRpcPromise(_0x187f4e,_0x2fa106,_0x410085){return new BPromise(function(_0x8212e6,_0x284c15){return client[_0x129e('0x10')](_0x187f4e,_0x410085)[_0x129e('0x11')](function(_0x570b8b){logger[_0x129e('0x12')](_0x129e('0x13'),_0x2fa106,_0x129e('0x14'));logger[_0x129e('0x15')](_0x129e('0x16'),_0x2fa106,_0x129e('0x14'),JSON[_0x129e('0x17')](_0x570b8b));if(_0x570b8b[_0x129e('0x18')]){if(_0x570b8b[_0x129e('0x18')][_0x129e('0x19')]===0x1f4){logger[_0x129e('0x18')](_0x129e('0x13'),_0x2fa106,_0x570b8b[_0x129e('0x18')][_0x129e('0x1a')]);return _0x284c15(_0x570b8b[_0x129e('0x18')][_0x129e('0x1a')]);}logger[_0x129e('0x18')](_0x129e('0x13'),_0x2fa106,_0x570b8b[_0x129e('0x18')][_0x129e('0x1a')]);return _0x8212e6(_0x570b8b[_0x129e('0x18')][_0x129e('0x1a')]);}else{logger[_0x129e('0x12')]('Dashboard,\x20%s,\x20%s',_0x2fa106,'request\x20sent');_0x8212e6(_0x570b8b[_0x129e('0x1b')][_0x129e('0x1a')]);}})[_0x129e('0x1c')](function(_0x57496c){logger['error'](_0x129e('0x13'),_0x2fa106,_0x57496c);_0x284c15(_0x57496c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 36b8522..183450b 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 _0x1be0=['length','dashboard:','save','remove','update','emit','removeListener'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1be0,0x79));var _0x01be=function(_0x4f49f2,_0x1f7193){_0x4f49f2=_0x4f49f2-0x0;var _0x48905c=_0x1be0[_0x4f49f2];return _0x48905c;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x01be('0x0'),_0x01be('0x1'),_0x01be('0x2')];function createListener(_0x5898eb,_0x461591){return function(_0x4c13e7){_0x461591[_0x01be('0x3')](_0x5898eb,_0x4c13e7);};}function removeListener(_0x52a2d7,_0x4856f6){return function(){DashboardEvents[_0x01be('0x4')](_0x52a2d7,_0x4856f6);};}exports['register']=function(_0x3faaa3){for(var _0x3ee5bd=0x0,_0x2a9b89=events[_0x01be('0x5')];_0x3ee5bd<_0x2a9b89;_0x3ee5bd++){var _0x309e6d=events[_0x3ee5bd];var _0x24e0c7=createListener(_0x01be('0x6')+_0x309e6d,_0x3faaa3);DashboardEvents['on'](_0x309e6d,_0x24e0c7);}}; \ No newline at end of file +var _0xf53b=['update','emit','removeListener','length','dashboard:','./dashboard.events','save','remove'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xf53b,0x135));var _0xbf53=function(_0x587233,_0x5d83f8){_0x587233=_0x587233-0x0;var _0x18372a=_0xf53b[_0x587233];return _0x18372a;};'use strict';var DashboardEvents=require(_0xbf53('0x0'));var events=[_0xbf53('0x1'),_0xbf53('0x2'),_0xbf53('0x3')];function createListener(_0x4791d9,_0x1ebe9f){return function(_0x2412b1){_0x1ebe9f[_0xbf53('0x4')](_0x4791d9,_0x2412b1);};}function removeListener(_0x3607e5,_0xf2bdbe){return function(){DashboardEvents[_0xbf53('0x5')](_0x3607e5,_0xf2bdbe);};}exports['register']=function(_0x1c4256){for(var _0x542aca=0x0,_0x4f5d1a=events[_0xbf53('0x6')];_0x542aca<_0x4f5d1a;_0x542aca++){var _0x5a8e84=events[_0x542aca];var _0x62817d=createListener(_0xbf53('0x7')+_0x5a8e84,_0x1c4256);DashboardEvents['on'](_0x5a8e84,_0x62817d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 22ed6ae..cecc5b7 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 _0x2100=['addItem','put','/:id','update','destroy','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/items','getItems','post','create','clone'];(function(_0x3f3317,_0x1120d5){var _0x51a0aa=function(_0x525e0a){while(--_0x525e0a){_0x3f3317['push'](_0x3f3317['shift']());}};_0x51a0aa(++_0x1120d5);}(_0x2100,0x15b));var _0x0210=function(_0x2dc96f,_0x459058){_0x2dc96f=_0x2dc96f-0x0;var _0xd012da=_0x2100[_0x2dc96f];return _0xd012da;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0210('0x0'));var express=require(_0x0210('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0210('0x2'));var config=require(_0x0210('0x3'));var controller=require('./dashboard.controller');router[_0x0210('0x4')]('/',auth[_0x0210('0x5')](),controller[_0x0210('0x6')]);router[_0x0210('0x4')]('/:id',auth[_0x0210('0x5')](),controller[_0x0210('0x7')]);router[_0x0210('0x4')](_0x0210('0x8'),auth[_0x0210('0x5')](),controller[_0x0210('0x9')]);router[_0x0210('0xa')]('/',auth['isAuthenticated'](),controller[_0x0210('0xb')]);router[_0x0210('0xa')]('/:id/clone',auth[_0x0210('0x5')](),controller[_0x0210('0xc')]);router[_0x0210('0xa')](_0x0210('0x8'),auth[_0x0210('0x5')](),controller[_0x0210('0xd')]);router[_0x0210('0xe')](_0x0210('0xf'),auth[_0x0210('0x5')](),controller[_0x0210('0x10')]);router['delete'](_0x0210('0xf'),auth[_0x0210('0x5')](),controller[_0x0210('0x11')]);module['exports']=router; \ No newline at end of file +var _0x48ba=['post','create','/:id/clone','clone','addItem','/:id','update','delete','exports','multer','util','path','Router','./dashboard.controller','get','isAuthenticated','show','getItems'];(function(_0x4d21ff,_0x19d202){var _0x22b554=function(_0x4473c5){while(--_0x4473c5){_0x4d21ff['push'](_0x4d21ff['shift']());}};_0x22b554(++_0x19d202);}(_0x48ba,0x171));var _0xa48b=function(_0x5ab540,_0x5818e7){_0x5ab540=_0x5ab540-0x0;var _0x47a877=_0x48ba[_0x5ab540];return _0x47a877;};'use strict';var multer=require(_0xa48b('0x0'));var util=require(_0xa48b('0x1'));var path=require(_0xa48b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa48b('0x3')]();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(_0xa48b('0x4'));router[_0xa48b('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa48b('0x5')]('/:id',auth[_0xa48b('0x6')](),controller[_0xa48b('0x7')]);router[_0xa48b('0x5')]('/:id/items',auth[_0xa48b('0x6')](),controller[_0xa48b('0x8')]);router[_0xa48b('0x9')]('/',auth[_0xa48b('0x6')](),controller[_0xa48b('0xa')]);router[_0xa48b('0x9')](_0xa48b('0xb'),auth[_0xa48b('0x6')](),controller[_0xa48b('0xc')]);router[_0xa48b('0x9')]('/:id/items',auth['isAuthenticated'](),controller[_0xa48b('0xd')]);router['put'](_0xa48b('0xe'),auth[_0xa48b('0x6')](),controller[_0xa48b('0xf')]);router[_0xa48b('0x10')](_0xa48b('0xe'),auth[_0xa48b('0x6')](),controller['destroy']);module[_0xa48b('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 6965dbb..0b19d1b 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 _0x6d38=['INTEGER','STRING','#2196f3','squel','lodash','exports','TEXT','parse','getDataValue','attrs','setDataValue','stringify'];(function(_0x4c6167,_0x541650){var _0xf16244=function(_0x4dba68){while(--_0x4dba68){_0x4c6167['push'](_0x4c6167['shift']());}};_0xf16244(++_0x541650);}(_0x6d38,0x1ef));var _0x86d3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6d38[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x86d3('0x0'));var _=require(_0x86d3('0x1'));module[_0x86d3('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x86d3('0x3')]('long'),'get':function(){try{return JSON[_0x86d3('0x4')](this[_0x86d3('0x5')](_0x86d3('0x6')));}catch(_0x4ef557){return[];}},'set':function(_0x2d8272){try{this[_0x86d3('0x7')](_0x86d3('0x6'),JSON[_0x86d3('0x8')](_0x2d8272));}catch(_0x47e654){this['setDataValue'](_0x86d3('0x6'),JSON[_0x86d3('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x86d3('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x86d3('0x9')]},'background':{'type':Sequelize[_0x86d3('0xa')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x86d3('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x86d3('0xa')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x0295=['#ffffff','sequelize','exports','TEXT','long','parse','getDataValue','attrs','setDataValue','INTEGER','STRING'];(function(_0x2ad1b8,_0x1ea09b){var _0x52547d=function(_0x33b77c){while(--_0x33b77c){_0x2ad1b8['push'](_0x2ad1b8['shift']());}};_0x52547d(++_0x1ea09b);}(_0x0295,0x1f0));var _0x5029=function(_0x470a01,_0x1ef188){_0x470a01=_0x470a01-0x0;var _0x5df181=_0x0295[_0x470a01];return _0x5df181;};'use strict';var Sequelize=require(_0x5029('0x0'));var squel=require('squel');var _=require('lodash');module[_0x5029('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5029('0x2')](_0x5029('0x3')),'get':function(){try{return JSON[_0x5029('0x4')](this[_0x5029('0x5')](_0x5029('0x6')));}catch(_0x69a497){return[];}},'set':function(_0x200217){try{this[_0x5029('0x7')](_0x5029('0x6'),JSON['stringify'](_0x200217));}catch(_0x54978f){this['setDataValue'](_0x5029('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5029('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5029('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':_0x5029('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5029('0x9')]},'titleFontSize':{'type':Sequelize[_0x5029('0x8')],'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 f123956..c1768ee 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 _0xd8af=['pie-chart','attrSerie1','attrSerie2','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','DashboardItem','find','catch','type','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart'];(function(_0x26cffe,_0x56660d){var _0x40d4c6=function(_0x55e18a){while(--_0x55e18a){_0x26cffe['push'](_0x26cffe['shift']());}};_0x40d4c6(++_0x56660d);}(_0xd8af,0x18d));var _0xfd8a=function(_0x489c67,_0x593ef6){_0x489c67=_0x489c67-0x0;var _0x4926de=_0xd8af[_0x489c67];return _0x4926de;};'use strict';var emlformat=require(_0xfd8a('0x0'));var rimraf=require(_0xfd8a('0x1'));var zipdir=require(_0xfd8a('0x2'));var jsonpatch=require(_0xfd8a('0x3'));var rp=require(_0xfd8a('0x4'));var moment=require('moment');var BPromise=require(_0xfd8a('0x5'));var Mustache=require('mustache');var util=require(_0xfd8a('0x6'));var path=require(_0xfd8a('0x7'));var sox=require(_0xfd8a('0x8'));var csv=require('to-csv');var ejs=require(_0xfd8a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd8a('0xa'));var squel=require(_0xfd8a('0xb'));var crypto=require(_0xfd8a('0xc'));var jsforce=require(_0xfd8a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfd8a('0xe'));var querystring=require(_0xfd8a('0xf'));var Papa=require(_0xfd8a('0x10'));var Redis=require(_0xfd8a('0x11'));var authService=require(_0xfd8a('0x12'));var qs=require(_0xfd8a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd8a('0x14'))(_0xfd8a('0x15'));var utils=require(_0xfd8a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xfd8a('0x17')]=_[_0xfd8a('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfd8a('0x19'))(new Redis(config[_0xfd8a('0x17')]));require(_0xfd8a('0x1a'))[_0xfd8a('0x1b')](socket);function respondWithStatusCode(_0x2b4189,_0x3581e8){_0x3581e8=_0x3581e8||0xcc;return function(_0x395ee1){if(_0x395ee1){return _0x2b4189[_0xfd8a('0x1c')](_0x3581e8);}return _0x2b4189[_0xfd8a('0x1d')](_0x3581e8)[_0xfd8a('0x1e')]();};}function respondWithResult(_0x24b1d7,_0x2fb2c1){_0x2fb2c1=_0x2fb2c1||0xc8;return function(_0x215205){if(_0x215205){return _0x24b1d7[_0xfd8a('0x1d')](_0x2fb2c1)[_0xfd8a('0x1f')](_0x215205);}};}function respondWithFilteredResult(_0xf44ccd,_0x97ec09){return function(_0x1d5e85){if(_0x1d5e85){var _0x45428e=typeof _0x97ec09[_0xfd8a('0x20')]===_0xfd8a('0x21')&&typeof _0x97ec09[_0xfd8a('0x22')]===_0xfd8a('0x21');var _0x508164=_0x1d5e85[_0xfd8a('0x23')];var _0x9eade2=_0x45428e?0x0:_0x97ec09[_0xfd8a('0x20')];var _0x53eb71=_0x45428e?_0x1d5e85[_0xfd8a('0x23')]:_0x97ec09['offset']+_0x97ec09[_0xfd8a('0x22')];var _0x5415bc;if(_0x53eb71>=_0x508164){_0x53eb71=_0x508164;_0x5415bc=0xc8;}else{_0x5415bc=0xce;}_0xf44ccd[_0xfd8a('0x1d')](_0x5415bc);return _0xf44ccd[_0xfd8a('0x24')](_0xfd8a('0x25'),_0x9eade2+'-'+_0x53eb71+'/'+_0x508164)[_0xfd8a('0x1f')](_0x1d5e85);}return null;};}function patchUpdates(_0x292b75){return function(_0x1108dc){try{jsonpatch[_0xfd8a('0x26')](_0x1108dc,_0x292b75,!![]);}catch(_0x4cd34d){return BPromise[_0xfd8a('0x27')](_0x4cd34d);}return _0x1108dc[_0xfd8a('0x28')]();};}function saveUpdates(_0x2e582f,_0x2715ea){return function(_0x3e59de){if(_0x3e59de){return _0x3e59de[_0xfd8a('0x29')](_0x2e582f)[_0xfd8a('0x2a')](function(_0x1d7042){return _0x1d7042;});}return null;};}function removeEntity(_0xf7618a,_0x5e101e){return function(_0x15ab6d){if(_0x15ab6d){return _0x15ab6d['destroy']()[_0xfd8a('0x2a')](function(){_0xf7618a[_0xfd8a('0x1d')](0xcc)[_0xfd8a('0x1e')]();});}};}function handleEntityNotFound(_0x25d5d4,_0x3355a6){return function(_0x25417b){if(!_0x25417b){_0x25d5d4[_0xfd8a('0x1c')](0x194);}return _0x25417b;};}function handleError(_0x66c047,_0x4373ca){_0x4373ca=_0x4373ca||0x1f4;return function(_0x4a5926){logger[_0xfd8a('0x2b')](_0x4a5926[_0xfd8a('0x2c')]);if(_0x4a5926[_0xfd8a('0x2d')]){delete _0x4a5926['name'];}_0x66c047[_0xfd8a('0x1d')](_0x4373ca)[_0xfd8a('0x2e')](_0x4a5926);};}exports[_0xfd8a('0x2f')]=function(_0x214b72,_0x531bb0){var _0x5992b6={'raw':![],'where':{'id':_0x214b72[_0xfd8a('0x30')]['id']}},_0x592e7c={};_0x592e7c[_0xfd8a('0x31')]=_[_0xfd8a('0x32')](db['DashboardItem'][_0xfd8a('0x33')]);_0x592e7c['query']=_['keys'](_0x214b72[_0xfd8a('0x34')]);_0x592e7c[_0xfd8a('0x35')]=_[_0xfd8a('0x36')](_0x592e7c[_0xfd8a('0x31')],_0x592e7c[_0xfd8a('0x34')]);_0x5992b6[_0xfd8a('0x37')]=_[_0xfd8a('0x36')](_0x592e7c[_0xfd8a('0x31')],qs['fields'](_0x214b72['query'][_0xfd8a('0x38')]));_0x5992b6[_0xfd8a('0x37')]=_0x5992b6[_0xfd8a('0x37')]['length']?_0x5992b6[_0xfd8a('0x37')]:_0x592e7c['model'];if(_0x214b72[_0xfd8a('0x34')][_0xfd8a('0x39')]){_0x5992b6[_0xfd8a('0x3a')]=[{'all':!![]}];}_0x5992b6=_[_0xfd8a('0x3b')]({},_0x5992b6,_0x214b72['options']);return db[_0xfd8a('0x3c')][_0xfd8a('0x3d')](_0x5992b6)[_0xfd8a('0x2a')](handleEntityNotFound(_0x531bb0,null))[_0xfd8a('0x2a')](respondWithResult(_0x531bb0,null))[_0xfd8a('0x3e')](handleError(_0x531bb0,null));};exports['destroy']=function(_0x5903e7,_0xf2e139){return db[_0xfd8a('0x3c')][_0xfd8a('0x3d')]({'where':{'id':_0x5903e7['params']['id']}})[_0xfd8a('0x2a')](handleEntityNotFound(_0xf2e139,null))['then'](removeEntity(_0xf2e139,null))['catch'](handleError(_0xf2e139,null));};function widgetAttributes(_0x4e7396){try{switch(_0x4e7396[_0xfd8a('0x3f')]){case'iframe':return[{'name':_0xfd8a('0x40'),'value':_0x4e7396[_0xfd8a('0x40')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x0]?_0x4e7396[_0xfd8a('0x41')][0x0][_0xfd8a('0x42')]:undefined)||_0xfd8a('0x43')}];case'custom':return[{'name':_0xfd8a('0x44'),'value':_0x4e7396[_0xfd8a('0x44')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x0]?_0x4e7396[_0xfd8a('0x41')][0x0]['value']:undefined)||''}];case _0xfd8a('0x45'):return[{'name':_0xfd8a('0x46'),'value':_0x4e7396[_0xfd8a('0x46')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x0]?_0x4e7396[_0xfd8a('0x41')][0x0][_0xfd8a('0x42')]:undefined)||_0xfd8a('0x47')},{'name':_0xfd8a('0x48'),'value':_0x4e7396[_0xfd8a('0x48')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x1]?_0x4e7396['attrs'][0x1][_0xfd8a('0x42')]:undefined)||_0xfd8a('0x49')},{'name':_0xfd8a('0x4a'),'value':_0x4e7396['attrFontSize']||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x2]?_0x4e7396[_0xfd8a('0x41')][0x2][_0xfd8a('0x42')]:undefined)||0xc}];case _0xfd8a('0x4b'):return[{'name':_0xfd8a('0x4c'),'value':_0x4e7396[_0xfd8a('0x4c')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x0]?_0x4e7396[_0xfd8a('0x41')][0x0][_0xfd8a('0x42')]:undefined)||_0xfd8a('0x4d')},{'name':'attrVoiceQueues','value':_0x4e7396[_0xfd8a('0x4e')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x1]?_0x4e7396[_0xfd8a('0x41')][0x1][_0xfd8a('0x42')]:undefined)||[]},{'name':'attrFontSize','value':_0x4e7396[_0xfd8a('0x4a')]||(_0x4e7396['attrs']&&_0x4e7396['attrs'][0x2]?_0x4e7396[_0xfd8a('0x41')][0x2][_0xfd8a('0x42')]:undefined)||0x14},{'name':_0xfd8a('0x4f'),'value':_0x4e7396[_0xfd8a('0x4f')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396['attrs'][0x3]?_0x4e7396[_0xfd8a('0x41')][0x3][_0xfd8a('0x42')]:undefined)||_0xfd8a('0x50')},{'name':_0xfd8a('0x51'),'value':_0x4e7396[_0xfd8a('0x51')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x4]?_0x4e7396[_0xfd8a('0x41')][0x4][_0xfd8a('0x42')]:undefined)||''},{'name':_0xfd8a('0x52'),'value':_0x4e7396[_0xfd8a('0x52')]||(_0x4e7396['attrs']&&_0x4e7396[_0xfd8a('0x41')][0x5]?_0x4e7396[_0xfd8a('0x41')][0x5]['value']:undefined)||''},{'name':_0xfd8a('0x53'),'value':_0x4e7396[_0xfd8a('0x53')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x6]?_0x4e7396[_0xfd8a('0x41')][0x6]['value']:undefined)||''},{'name':_0xfd8a('0x54'),'value':_0x4e7396[_0xfd8a('0x54')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396['attrs'][0x7]?_0x4e7396[_0xfd8a('0x41')][0x7][_0xfd8a('0x42')]:undefined)||''},{'name':_0xfd8a('0x55'),'value':_0x4e7396['attrWhatsappAccounts']||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x8]?_0x4e7396[_0xfd8a('0x41')][0x8][_0xfd8a('0x42')]:undefined)||''},{'name':_0xfd8a('0x56'),'value':_0x4e7396[_0xfd8a('0x56')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396['attrs'][0x9]?_0x4e7396[_0xfd8a('0x41')][0x9][_0xfd8a('0x42')]:undefined)||''}];case _0xfd8a('0x57'):case _0xfd8a('0x58'):return[{'name':_0xfd8a('0x59'),'value':_0x4e7396[_0xfd8a('0x59')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x0]?_0x4e7396[_0xfd8a('0x41')][0x0][_0xfd8a('0x42')]:undefined)||_0xfd8a('0x4d')},{'name':_0xfd8a('0x5a'),'value':_0x4e7396[_0xfd8a('0x5a')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x1]?_0x4e7396[_0xfd8a('0x41')][0x1][_0xfd8a('0x42')]:undefined)||null},{'name':'attrSerie3','value':_0x4e7396['attrSerie3']||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x2]?_0x4e7396[_0xfd8a('0x41')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x4e7396['attrVoiceQueues']||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x3]?_0x4e7396[_0xfd8a('0x41')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x4e7396[_0xfd8a('0x4f')]||(_0x4e7396['attrs']&&_0x4e7396[_0xfd8a('0x41')][0x4]?_0x4e7396[_0xfd8a('0x41')][0x4][_0xfd8a('0x42')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x4e7396[_0xfd8a('0x51')]||(_0x4e7396['attrs']&&_0x4e7396[_0xfd8a('0x41')][0x5]?_0x4e7396[_0xfd8a('0x41')][0x5][_0xfd8a('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x4e7396[_0xfd8a('0x52')]||(_0x4e7396['attrs']&&_0x4e7396['attrs'][0x6]?_0x4e7396[_0xfd8a('0x41')][0x6][_0xfd8a('0x42')]:undefined)||''},{'name':_0xfd8a('0x53'),'value':_0x4e7396[_0xfd8a('0x53')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x7]?_0x4e7396[_0xfd8a('0x41')][0x7]['value']:undefined)||''},{'name':_0xfd8a('0x54'),'value':_0x4e7396['attrOpenchannelAccounts']||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x8]?_0x4e7396[_0xfd8a('0x41')][0x8][_0xfd8a('0x42')]:undefined)||''},{'name':_0xfd8a('0x55'),'value':_0x4e7396[_0xfd8a('0x55')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x9]?_0x4e7396[_0xfd8a('0x41')][0x9][_0xfd8a('0x42')]:undefined)||''},{'name':_0xfd8a('0x56'),'value':_0x4e7396[_0xfd8a('0x56')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0xa]?_0x4e7396[_0xfd8a('0x41')][0xa]['value']:undefined)||''}];case _0xfd8a('0x5b'):return[{'name':'attrReport','type':_0x4e7396[_0xfd8a('0x5c')]||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x0]?_0x4e7396['attrs'][0x0]['type']:undefined)||null,'value':_0x4e7396['attrReport']||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x0]?_0x4e7396[_0xfd8a('0x41')][0x0][_0xfd8a('0x42')]:undefined)||null},{'name':_0xfd8a('0x5d'),'value':_0x4e7396['attrRefresh']||(_0x4e7396[_0xfd8a('0x41')]&&_0x4e7396[_0xfd8a('0x41')][0x1]?_0x4e7396[_0xfd8a('0x41')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1c850e){logger['error'](_0xfd8a('0x5e'),JSON['stringify'](_0x1c850e));return[];}}exports[_0xfd8a('0x5f')]=function(_0x5e0153,_0x2bf4e2){if(_0x5e0153[_0xfd8a('0x60')]){_0x5e0153['body']['attrs']=widgetAttributes(_0x5e0153['body']);}return db[_0xfd8a('0x3c')][_0xfd8a('0x5f')](_0x5e0153[_0xfd8a('0x60')],{})[_0xfd8a('0x2a')](respondWithResult(_0x2bf4e2,0xc9))[_0xfd8a('0x3e')](handleError(_0x2bf4e2,null));};exports[_0xfd8a('0x29')]=function(_0x20cf80,_0x1145c7){if(_0x20cf80['body']['id']){delete _0x20cf80['body']['id'];}_0x20cf80[_0xfd8a('0x60')][_0xfd8a('0x41')]=widgetAttributes(_0x20cf80[_0xfd8a('0x60')]);return db[_0xfd8a('0x3c')]['find']({'where':{'id':_0x20cf80['params']['id']}})[_0xfd8a('0x2a')](handleEntityNotFound(_0x1145c7,null))[_0xfd8a('0x2a')](saveUpdates(_0x20cf80['body'],null))[_0xfd8a('0x2a')](respondWithResult(_0x1145c7,null))[_0xfd8a('0x3e')](handleError(_0x1145c7,null));}; \ No newline at end of file +var _0x3914=['find','catch','type','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','intersection','fields','attributes','length','includeAll','merge','options'];(function(_0xb8acdd,_0x11b6bc){var _0x41ea5f=function(_0x32824d){while(--_0x32824d){_0xb8acdd['push'](_0xb8acdd['shift']());}};_0x41ea5f(++_0x11b6bc);}(_0x3914,0xeb));var _0x4391=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0x3914[_0xffa198];return _0x1e4b50;};'use strict';var emlformat=require(_0x4391('0x0'));var rimraf=require(_0x4391('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4391('0x2'));var rp=require(_0x4391('0x3'));var moment=require('moment');var BPromise=require(_0x4391('0x4'));var Mustache=require(_0x4391('0x5'));var util=require(_0x4391('0x6'));var path=require('path');var sox=require(_0x4391('0x7'));var csv=require(_0x4391('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4391('0x9'));var _=require('lodash');var squel=require(_0x4391('0xa'));var crypto=require('crypto');var jsforce=require(_0x4391('0xb'));var deskjs=require(_0x4391('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4391('0xd'));var Redis=require(_0x4391('0xe'));var authService=require(_0x4391('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4391('0x10'));var hardwareService=require(_0x4391('0x11'));var logger=require(_0x4391('0x12'))(_0x4391('0x13'));var utils=require('../../config/utils');var config=require(_0x4391('0x14'));var licenseUtil=require(_0x4391('0x15'));var db=require(_0x4391('0x16'))['db'];config[_0x4391('0x17')]=_[_0x4391('0x18')](config[_0x4391('0x17')],{'host':_0x4391('0x19'),'port':0x18eb});var socket=require(_0x4391('0x1a'))(new Redis(config['redis']));require(_0x4391('0x1b'))[_0x4391('0x1c')](socket);function respondWithStatusCode(_0x3f82fb,_0x2c0020){_0x2c0020=_0x2c0020||0xcc;return function(_0x536e5d){if(_0x536e5d){return _0x3f82fb[_0x4391('0x1d')](_0x2c0020);}return _0x3f82fb['status'](_0x2c0020)[_0x4391('0x1e')]();};}function respondWithResult(_0x3a1b80,_0x3e4585){_0x3e4585=_0x3e4585||0xc8;return function(_0x1c2038){if(_0x1c2038){return _0x3a1b80[_0x4391('0x1f')](_0x3e4585)[_0x4391('0x20')](_0x1c2038);}};}function respondWithFilteredResult(_0x2b5117,_0x19924d){return function(_0x58a311){if(_0x58a311){var _0x4cfa6b=typeof _0x19924d[_0x4391('0x21')]==='undefined'&&typeof _0x19924d[_0x4391('0x22')]===_0x4391('0x23');var _0xa9c97f=_0x58a311[_0x4391('0x24')];var _0x3b7709=_0x4cfa6b?0x0:_0x19924d['offset'];var _0x5f1337=_0x4cfa6b?_0x58a311[_0x4391('0x24')]:_0x19924d[_0x4391('0x21')]+_0x19924d[_0x4391('0x22')];var _0x5570a8;if(_0x5f1337>=_0xa9c97f){_0x5f1337=_0xa9c97f;_0x5570a8=0xc8;}else{_0x5570a8=0xce;}_0x2b5117[_0x4391('0x1f')](_0x5570a8);return _0x2b5117[_0x4391('0x25')](_0x4391('0x26'),_0x3b7709+'-'+_0x5f1337+'/'+_0xa9c97f)[_0x4391('0x20')](_0x58a311);}return null;};}function patchUpdates(_0x505d2c){return function(_0x105ef8){try{jsonpatch[_0x4391('0x27')](_0x105ef8,_0x505d2c,!![]);}catch(_0x3c4c9b){return BPromise[_0x4391('0x28')](_0x3c4c9b);}return _0x105ef8[_0x4391('0x29')]();};}function saveUpdates(_0x40ff34,_0x55759a){return function(_0x474666){if(_0x474666){return _0x474666[_0x4391('0x2a')](_0x40ff34)[_0x4391('0x2b')](function(_0x333ca6){return _0x333ca6;});}return null;};}function removeEntity(_0x540339,_0x4b0c28){return function(_0x11c859){if(_0x11c859){return _0x11c859[_0x4391('0x2c')]()[_0x4391('0x2b')](function(){_0x540339[_0x4391('0x1f')](0xcc)[_0x4391('0x1e')]();});}};}function handleEntityNotFound(_0x53363c,_0x49860f){return function(_0x4ee253){if(!_0x4ee253){_0x53363c['sendStatus'](0x194);}return _0x4ee253;};}function handleError(_0x3fabde,_0x439d69){_0x439d69=_0x439d69||0x1f4;return function(_0x471d43){logger[_0x4391('0x2d')](_0x471d43['stack']);if(_0x471d43[_0x4391('0x2e')]){delete _0x471d43[_0x4391('0x2e')];}_0x3fabde[_0x4391('0x1f')](_0x439d69)[_0x4391('0x2f')](_0x471d43);};}exports[_0x4391('0x30')]=function(_0x47b39a,_0x1a8df0){var _0x3edb24={'raw':![],'where':{'id':_0x47b39a[_0x4391('0x31')]['id']}},_0x19b5d1={};_0x19b5d1[_0x4391('0x32')]=_[_0x4391('0x33')](db[_0x4391('0x34')][_0x4391('0x35')]);_0x19b5d1[_0x4391('0x36')]=_[_0x4391('0x33')](_0x47b39a[_0x4391('0x36')]);_0x19b5d1['filters']=_[_0x4391('0x37')](_0x19b5d1['model'],_0x19b5d1[_0x4391('0x36')]);_0x3edb24['attributes']=_['intersection'](_0x19b5d1[_0x4391('0x32')],qs[_0x4391('0x38')](_0x47b39a[_0x4391('0x36')][_0x4391('0x38')]));_0x3edb24[_0x4391('0x39')]=_0x3edb24[_0x4391('0x39')][_0x4391('0x3a')]?_0x3edb24['attributes']:_0x19b5d1[_0x4391('0x32')];if(_0x47b39a['query'][_0x4391('0x3b')]){_0x3edb24['include']=[{'all':!![]}];}_0x3edb24=_[_0x4391('0x3c')]({},_0x3edb24,_0x47b39a[_0x4391('0x3d')]);return db[_0x4391('0x34')][_0x4391('0x3e')](_0x3edb24)[_0x4391('0x2b')](handleEntityNotFound(_0x1a8df0,null))[_0x4391('0x2b')](respondWithResult(_0x1a8df0,null))[_0x4391('0x3f')](handleError(_0x1a8df0,null));};exports[_0x4391('0x2c')]=function(_0x420fdf,_0x1b4fab){return db[_0x4391('0x34')][_0x4391('0x3e')]({'where':{'id':_0x420fdf[_0x4391('0x31')]['id']}})[_0x4391('0x2b')](handleEntityNotFound(_0x1b4fab,null))[_0x4391('0x2b')](removeEntity(_0x1b4fab,null))[_0x4391('0x3f')](handleError(_0x1b4fab,null));};function widgetAttributes(_0x7f513a){try{switch(_0x7f513a[_0x4391('0x40')]){case'iframe':return[{'name':'attrUrl','value':_0x7f513a[_0x4391('0x41')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x0]?_0x7f513a[_0x4391('0x42')][0x0][_0x4391('0x43')]:undefined)||_0x4391('0x44')}];case _0x4391('0x45'):return[{'name':_0x4391('0x46'),'value':_0x7f513a['attrPath']||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a['attrs'][0x0]?_0x7f513a['attrs'][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x4391('0x47'),'value':_0x7f513a[_0x4391('0x47')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x0]?_0x7f513a['attrs'][0x0]['value']:undefined)||_0x4391('0x48')},{'name':'attrTimezone','value':_0x7f513a[_0x4391('0x49')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x1]?_0x7f513a[_0x4391('0x42')][0x1][_0x4391('0x43')]:undefined)||_0x4391('0x4a')},{'name':'attrFontSize','value':_0x7f513a[_0x4391('0x4b')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x2]?_0x7f513a[_0x4391('0x42')][0x2][_0x4391('0x43')]:undefined)||0xc}];case _0x4391('0x4c'):return[{'name':_0x4391('0x4d'),'value':_0x7f513a['attrMetric']||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x0]?_0x7f513a[_0x4391('0x42')][0x0][_0x4391('0x43')]:undefined)||_0x4391('0x4e')},{'name':_0x4391('0x4f'),'value':_0x7f513a[_0x4391('0x4f')]||(_0x7f513a['attrs']&&_0x7f513a[_0x4391('0x42')][0x1]?_0x7f513a['attrs'][0x1][_0x4391('0x43')]:undefined)||[]},{'name':_0x4391('0x4b'),'value':_0x7f513a[_0x4391('0x4b')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x2]?_0x7f513a[_0x4391('0x42')][0x2][_0x4391('0x43')]:undefined)||0x14},{'name':_0x4391('0x50'),'value':_0x7f513a[_0x4391('0x50')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x3]?_0x7f513a[_0x4391('0x42')][0x3][_0x4391('0x43')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x7f513a[_0x4391('0x51')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x4]?_0x7f513a[_0x4391('0x42')][0x4][_0x4391('0x43')]:undefined)||''},{'name':_0x4391('0x52'),'value':_0x7f513a['attrFaxAccounts']||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a['attrs'][0x5]?_0x7f513a[_0x4391('0x42')][0x5]['value']:undefined)||''},{'name':_0x4391('0x53'),'value':_0x7f513a[_0x4391('0x53')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x6]?_0x7f513a[_0x4391('0x42')][0x6][_0x4391('0x43')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x7f513a[_0x4391('0x54')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x7]?_0x7f513a[_0x4391('0x42')][0x7][_0x4391('0x43')]:undefined)||''},{'name':_0x4391('0x55'),'value':_0x7f513a[_0x4391('0x55')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x8]?_0x7f513a[_0x4391('0x42')][0x8][_0x4391('0x43')]:undefined)||''},{'name':_0x4391('0x56'),'value':_0x7f513a[_0x4391('0x56')]||(_0x7f513a['attrs']&&_0x7f513a[_0x4391('0x42')][0x9]?_0x7f513a[_0x4391('0x42')][0x9][_0x4391('0x43')]:undefined)||''}];case'multibar-chart':case _0x4391('0x57'):return[{'name':_0x4391('0x58'),'value':_0x7f513a[_0x4391('0x58')]||(_0x7f513a['attrs']&&_0x7f513a[_0x4391('0x42')][0x0]?_0x7f513a[_0x4391('0x42')][0x0]['value']:undefined)||_0x4391('0x4e')},{'name':_0x4391('0x59'),'value':_0x7f513a[_0x4391('0x59')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x1]?_0x7f513a[_0x4391('0x42')][0x1][_0x4391('0x43')]:undefined)||null},{'name':'attrSerie3','value':_0x7f513a[_0x4391('0x5a')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x2]?_0x7f513a[_0x4391('0x42')][0x2][_0x4391('0x43')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x7f513a[_0x4391('0x4f')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x3]?_0x7f513a[_0x4391('0x42')][0x3][_0x4391('0x43')]:undefined)||[]},{'name':_0x4391('0x50'),'value':_0x7f513a['attrChannel']||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a['attrs'][0x4]?_0x7f513a[_0x4391('0x42')][0x4][_0x4391('0x43')]:undefined)||'voice'},{'name':_0x4391('0x51'),'value':_0x7f513a[_0x4391('0x51')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x5]?_0x7f513a[_0x4391('0x42')][0x5][_0x4391('0x43')]:undefined)||''},{'name':_0x4391('0x52'),'value':_0x7f513a[_0x4391('0x52')]||(_0x7f513a['attrs']&&_0x7f513a[_0x4391('0x42')][0x6]?_0x7f513a[_0x4391('0x42')][0x6][_0x4391('0x43')]:undefined)||''},{'name':_0x4391('0x53'),'value':_0x7f513a[_0x4391('0x53')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x7]?_0x7f513a['attrs'][0x7][_0x4391('0x43')]:undefined)||''},{'name':_0x4391('0x54'),'value':_0x7f513a[_0x4391('0x54')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x8]?_0x7f513a[_0x4391('0x42')][0x8]['value']:undefined)||''},{'name':_0x4391('0x55'),'value':_0x7f513a[_0x4391('0x55')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x9]?_0x7f513a[_0x4391('0x42')][0x9][_0x4391('0x43')]:undefined)||''},{'name':_0x4391('0x56'),'value':_0x7f513a['attrChatWebsites']||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0xa]?_0x7f513a[_0x4391('0x42')][0xa][_0x4391('0x43')]:undefined)||''}];case _0x4391('0x5b'):return[{'name':_0x4391('0x5c'),'type':_0x7f513a[_0x4391('0x5d')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x0]?_0x7f513a[_0x4391('0x42')][0x0][_0x4391('0x40')]:undefined)||null,'value':_0x7f513a[_0x4391('0x5c')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x0]?_0x7f513a[_0x4391('0x42')][0x0]['value']:undefined)||null},{'name':_0x4391('0x5e'),'value':_0x7f513a[_0x4391('0x5e')]||(_0x7f513a[_0x4391('0x42')]&&_0x7f513a[_0x4391('0x42')][0x1]?_0x7f513a['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x227470){logger[_0x4391('0x2d')](_0x4391('0x5f'),JSON[_0x4391('0x60')](_0x227470));return[];}}exports['create']=function(_0x818e5a,_0x389c86){if(_0x818e5a[_0x4391('0x61')]){_0x818e5a['body'][_0x4391('0x42')]=widgetAttributes(_0x818e5a[_0x4391('0x61')]);}return db[_0x4391('0x34')][_0x4391('0x62')](_0x818e5a['body'],{})[_0x4391('0x2b')](respondWithResult(_0x389c86,0xc9))[_0x4391('0x3f')](handleError(_0x389c86,null));};exports[_0x4391('0x2a')]=function(_0x2cedcf,_0x380697){if(_0x2cedcf[_0x4391('0x61')]['id']){delete _0x2cedcf['body']['id'];}_0x2cedcf[_0x4391('0x61')][_0x4391('0x42')]=widgetAttributes(_0x2cedcf['body']);return db['DashboardItem']['find']({'where':{'id':_0x2cedcf[_0x4391('0x31')]['id']}})[_0x4391('0x2b')](handleEntityNotFound(_0x380697,null))[_0x4391('0x2b')](saveUpdates(_0x2cedcf[_0x4391('0x61')],null))['then'](respondWithResult(_0x380697,null))[_0x4391('0x3f')](handleError(_0x380697,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 4510147..d3eba58 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 _0x150c=['save','update','remove','emit','exports','events','setMaxListeners'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0x150c,0x12b));var _0xc150=function(_0x5b2c7e,_0x3d22f0){_0x5b2c7e=_0x5b2c7e-0x0;var _0x5ec399=_0x150c[_0x5b2c7e];return _0x5ec399;};'use strict';var EventEmitter=require(_0xc150('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc150('0x1')](0x0);var events={'afterCreate':_0xc150('0x2'),'afterUpdate':_0xc150('0x3'),'afterDestroy':_0xc150('0x4')};function emitEvent(_0x90855e){return function(_0xd7c2c3,_0x10341b,_0x1a9586){DashboardItemEvents[_0xc150('0x5')](_0x90855e+':'+_0xd7c2c3['id'],_0xd7c2c3);DashboardItemEvents['emit'](_0x90855e,_0xd7c2c3);_0x1a9586(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xc150('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x8600=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8600,0xc3));var _0x0860=function(_0x255be9,_0x3345d9){_0x255be9=_0x255be9-0x0;var _0x34fedf=_0x8600[_0x255be9];return _0x34fedf;};'use strict';var EventEmitter=require(_0x0860('0x0'));var DashboardItem=require(_0x0860('0x1'))['db'][_0x0860('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0860('0x3')](0x0);var events={'afterCreate':_0x0860('0x4'),'afterUpdate':_0x0860('0x5'),'afterDestroy':_0x0860('0x6')};function emitEvent(_0x30c5d3){return function(_0x5306a3,_0x10a42e,_0x54bf31){DashboardItemEvents['emit'](_0x30c5d3+':'+_0x5306a3['id'],_0x5306a3);DashboardItemEvents[_0x0860('0x7')](_0x30c5d3,_0x5306a3);_0x54bf31(null);};}for(var e in events){if(events[_0x0860('0x8')](e)){var event=events[e];DashboardItem[_0x0860('0x9')](e,emitEvent(event));}}module[_0x0860('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index aaaf10e..8d1e22c 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 _0xe586=['./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1591d4,_0x4ea3bd){var _0x4c46bb=function(_0x13b7e7){while(--_0x13b7e7){_0x1591d4['push'](_0x1591d4['shift']());}};_0x4c46bb(++_0x4ea3bd);}(_0xe586,0xc8));var _0x6e58=function(_0x33e4f9,_0x1969b3){_0x33e4f9=_0x33e4f9-0x0;var _0x19fd71=_0xe586[_0x33e4f9];return _0x19fd71;};'use strict';var _=require(_0x6e58('0x0'));var util=require(_0x6e58('0x1'));var logger=require(_0x6e58('0x2'))('api');var moment=require(_0x6e58('0x3'));var BPromise=require(_0x6e58('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e58('0x5'));var rimraf=require(_0x6e58('0x6'));var config=require(_0x6e58('0x7'));var attributes=require(_0x6e58('0x8'));module[_0x6e58('0x9')]=function(_0xc77f2a,_0x3fff2d){return _0xc77f2a[_0x6e58('0xa')](_0x6e58('0xb'),attributes,{'tableName':_0x6e58('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3ab=['path','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5f543d,_0x6466f1){var _0x8b79ab=function(_0x4e6bfe){while(--_0x4e6bfe){_0x5f543d['push'](_0x5f543d['shift']());}};_0x8b79ab(++_0x6466f1);}(_0xe3ab,0x8b));var _0xbe3a=function(_0x5f1fa5,_0x3963cd){_0x5f1fa5=_0x5f1fa5-0x0;var _0x1c99c0=_0xe3ab[_0x5f1fa5];return _0x1c99c0;};'use strict';var _=require(_0xbe3a('0x0'));var util=require('util');var logger=require(_0xbe3a('0x1'))(_0xbe3a('0x2'));var moment=require(_0xbe3a('0x3'));var BPromise=require(_0xbe3a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe3a('0x5'));var rimraf=require('rimraf');var config=require(_0xbe3a('0x6'));var attributes=require(_0xbe3a('0x7'));module[_0xbe3a('0x8')]=function(_0xe218e1,_0x3f4fde){return _0xe218e1[_0xbe3a('0x9')](_0xbe3a('0xa'),attributes,{'tableName':_0xbe3a('0xb'),'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 c059f39..50f512b 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 _0xb071=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x278f23,_0x5370cd){var _0x35ff23=function(_0x516b9d){while(--_0x516b9d){_0x278f23['push'](_0x278f23['shift']());}};_0x35ff23(++_0x5370cd);}(_0xb071,0x88));var _0x1b07=function(_0xe9e6cf,_0x395f6d){_0xe9e6cf=_0xe9e6cf-0x0;var _0x2b8851=_0xb071[_0xe9e6cf];return _0x2b8851;};'use strict';var _=require(_0x1b07('0x0'));var util=require(_0x1b07('0x1'));var moment=require('moment');var BPromise=require(_0x1b07('0x2'));var rs=require(_0x1b07('0x3'));var fs=require('fs');var Redis=require(_0x1b07('0x4'));var db=require(_0x1b07('0x5'))['db'];var utils=require(_0x1b07('0x6'));var logger=require(_0x1b07('0x7'))(_0x1b07('0x8'));var config=require(_0x1b07('0x9'));var jayson=require(_0x1b07('0xa'));var client=jayson[_0x1b07('0xb')][_0x1b07('0xc')]({'port':0x232a});config[_0x1b07('0xd')]=_[_0x1b07('0xe')](config[_0x1b07('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b07('0xf'))(new Redis(config[_0x1b07('0xd')]));require(_0x1b07('0x10'))[_0x1b07('0x11')](socket);function respondWithRpcPromise(_0x1a7ce3,_0x54bdbf,_0x388199){return new BPromise(function(_0x1392cb,_0x4272fc){return client[_0x1b07('0x12')](_0x1a7ce3,_0x388199)[_0x1b07('0x13')](function(_0x644eff){logger['info'](_0x1b07('0x14'),_0x54bdbf,_0x1b07('0x15'));logger[_0x1b07('0x16')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x54bdbf,_0x1b07('0x15'),JSON[_0x1b07('0x17')](_0x644eff));if(_0x644eff[_0x1b07('0x18')]){if(_0x644eff[_0x1b07('0x18')][_0x1b07('0x19')]===0x1f4){logger[_0x1b07('0x18')](_0x1b07('0x14'),_0x54bdbf,_0x644eff[_0x1b07('0x18')][_0x1b07('0x1a')]);return _0x4272fc(_0x644eff[_0x1b07('0x18')][_0x1b07('0x1a')]);}logger[_0x1b07('0x18')]('DashboardItem,\x20%s,\x20%s',_0x54bdbf,_0x644eff['error'][_0x1b07('0x1a')]);return _0x1392cb(_0x644eff['error'][_0x1b07('0x1a')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x54bdbf,_0x1b07('0x15'));_0x1392cb(_0x644eff[_0x1b07('0x1b')][_0x1b07('0x1a')]);}})[_0x1b07('0x1c')](function(_0x5c7330){logger[_0x1b07('0x18')]('DashboardItem,\x20%s,\x20%s',_0x54bdbf,_0x5c7330);_0x4272fc(_0x5c7330);});});} \ No newline at end of file +var _0x2f2f=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','ioredis'];(function(_0x4c0a20,_0x5e2be8){var _0x277055=function(_0x404036){while(--_0x404036){_0x4c0a20['push'](_0x4c0a20['shift']());}};_0x277055(++_0x5e2be8);}(_0x2f2f,0xcb));var _0xf2f2=function(_0x37db78,_0x71ba32){_0x37db78=_0x37db78-0x0;var _0x3fc339=_0x2f2f[_0x37db78];return _0x3fc339;};'use strict';var _=require(_0xf2f2('0x0'));var util=require(_0xf2f2('0x1'));var moment=require('moment');var BPromise=require(_0xf2f2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2f2('0x3'));var db=require(_0xf2f2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf2f2('0x5'))(_0xf2f2('0x6'));var config=require('../../config/environment');var jayson=require(_0xf2f2('0x7'));var client=jayson[_0xf2f2('0x8')]['http']({'port':0x232a});config[_0xf2f2('0x9')]=_[_0xf2f2('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf2f2('0xb'))(new Redis(config[_0xf2f2('0x9')]));require('./dashboardItem.socket')[_0xf2f2('0xc')](socket);function respondWithRpcPromise(_0x400958,_0x5ac223,_0x21e4d5){return new BPromise(function(_0x2915f1,_0x14322f){return client['request'](_0x400958,_0x21e4d5)[_0xf2f2('0xd')](function(_0x323384){logger[_0xf2f2('0xe')](_0xf2f2('0xf'),_0x5ac223,_0xf2f2('0x10'));logger[_0xf2f2('0x11')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x5ac223,'request\x20sent',JSON[_0xf2f2('0x12')](_0x323384));if(_0x323384[_0xf2f2('0x13')]){if(_0x323384['error'][_0xf2f2('0x14')]===0x1f4){logger[_0xf2f2('0x13')](_0xf2f2('0xf'),_0x5ac223,_0x323384[_0xf2f2('0x13')]['message']);return _0x14322f(_0x323384[_0xf2f2('0x13')][_0xf2f2('0x15')]);}logger[_0xf2f2('0x13')]('DashboardItem,\x20%s,\x20%s',_0x5ac223,_0x323384[_0xf2f2('0x13')][_0xf2f2('0x15')]);return _0x2915f1(_0x323384[_0xf2f2('0x13')][_0xf2f2('0x15')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x5ac223,'request\x20sent');_0x2915f1(_0x323384['result']['message']);}})[_0xf2f2('0x16')](function(_0x7f8ad3){logger[_0xf2f2('0x13')](_0xf2f2('0xf'),_0x5ac223,_0x7f8ad3);_0x14322f(_0x7f8ad3);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 4f8d99c..c9743a4 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 _0xc8c2=['length','dashboardItem:','./dashboardItem.events','emit','removeListener'];(function(_0x4a1fb8,_0x9a0f88){var _0x1a76c1=function(_0x55cc9d){while(--_0x55cc9d){_0x4a1fb8['push'](_0x4a1fb8['shift']());}};_0x1a76c1(++_0x9a0f88);}(_0xc8c2,0x1d8));var _0x2c8c=function(_0x36de10,_0xfe25e8){_0x36de10=_0x36de10-0x0;var _0x58100f=_0xc8c2[_0x36de10];return _0x58100f;};'use strict';var DashboardItemEvents=require(_0x2c8c('0x0'));var events=['save','remove','update'];function createListener(_0x179fa2,_0x4e3c46){return function(_0x8aff8e){_0x4e3c46[_0x2c8c('0x1')](_0x179fa2,_0x8aff8e);};}function removeListener(_0x18b682,_0x120afd){return function(){DashboardItemEvents[_0x2c8c('0x2')](_0x18b682,_0x120afd);};}exports['register']=function(_0x169952){for(var _0x1a4c16=0x0,_0x163779=events[_0x2c8c('0x3')];_0x1a4c16<_0x163779;_0x1a4c16++){var _0x12a570=events[_0x1a4c16];var _0x201c67=createListener(_0x2c8c('0x4')+_0x12a570,_0x169952);DashboardItemEvents['on'](_0x12a570,_0x201c67);}}; \ No newline at end of file +var _0x4a12=['register','length','dashboardItem:','save','removeListener'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0x4a12,0x139));var _0x24a1=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0x4a12[_0x3e21f4];return _0x40fc49;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x24a1('0x0'),'remove','update'];function createListener(_0x18c0c8,_0x3f411a){return function(_0x4e8a02){_0x3f411a['emit'](_0x18c0c8,_0x4e8a02);};}function removeListener(_0x62791c,_0x4e12dd){return function(){DashboardItemEvents[_0x24a1('0x1')](_0x62791c,_0x4e12dd);};}exports[_0x24a1('0x2')]=function(_0x3783d8){for(var _0x198b24=0x0,_0x33fc19=events[_0x24a1('0x3')];_0x198b24<_0x33fc19;_0x198b24++){var _0xf750f5=events[_0x198b24];var _0x360adf=createListener(_0x24a1('0x4')+_0xf750f5,_0x3783d8);DashboardItemEvents['on'](_0xf750f5,_0x360adf);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ac4cb66..7012f75 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 _0x7292=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x7292,0x178));var _0x2729=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x7292[_0x1a36a5];return _0x746243;};'use strict';var multer=require(_0x2729('0x0'));var util=require(_0x2729('0x1'));var path=require(_0x2729('0x2'));var timeout=require(_0x2729('0x3'));var express=require('express');var router=express[_0x2729('0x4')]();var fs_extra=require(_0x2729('0x5'));var auth=require(_0x2729('0x6'));var interaction=require(_0x2729('0x7'));var config=require(_0x2729('0x8'));var controller=require('./dashboardItem.controller');router[_0x2729('0x9')]('/:id',auth[_0x2729('0xa')](),controller[_0x2729('0xb')]);router[_0x2729('0xc')]('/',auth[_0x2729('0xa')](),controller[_0x2729('0xd')]);router[_0x2729('0xe')](_0x2729('0xf'),auth['isAuthenticated'](),controller[_0x2729('0x10')]);router[_0x2729('0x11')](_0x2729('0xf'),auth[_0x2729('0xa')](),controller[_0x2729('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd489=['util','connect-timeout','express','../../components/interaction/service','./dashboardItem.controller','/:id','isAuthenticated','show','post','put','update'];(function(_0x481ff7,_0x2b6ebb){var _0x1c1573=function(_0x4933fe){while(--_0x4933fe){_0x481ff7['push'](_0x481ff7['shift']());}};_0x1c1573(++_0x2b6ebb);}(_0xd489,0x1c3));var _0x9d48=function(_0x3b2102,_0x3acb71){_0x3b2102=_0x3b2102-0x0;var _0x13154c=_0xd489[_0x3b2102];return _0x13154c;};'use strict';var multer=require('multer');var util=require(_0x9d48('0x0'));var path=require('path');var timeout=require(_0x9d48('0x1'));var express=require(_0x9d48('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9d48('0x3'));var config=require('../../config/environment');var controller=require(_0x9d48('0x4'));router['get'](_0x9d48('0x5'),auth[_0x9d48('0x6')](),controller[_0x9d48('0x7')]);router[_0x9d48('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9d48('0x9')](_0x9d48('0x5'),auth[_0x9d48('0x6')](),controller[_0x9d48('0xa')]);router['delete'](_0x9d48('0x5'),auth[_0x9d48('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 394b7f4..3c813f7 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 _0x4ef2=['exports','STRING','ENUM','second','third','sequelize'];(function(_0x3a52e1,_0x1dfbbe){var _0xe4f484=function(_0x4bcb8e){while(--_0x4bcb8e){_0x3a52e1['push'](_0x3a52e1['shift']());}};_0xe4f484(++_0x1dfbbe);}(_0x4ef2,0xbf));var _0x24ef=function(_0x5b20e7,_0x4fdd80){_0x5b20e7=_0x5b20e7-0x0;var _0x38a218=_0x4ef2[_0x5b20e7];return _0x38a218;};'use strict';var Sequelize=require(_0x24ef('0x0'));module[_0x24ef('0x1')]={'name':{'type':Sequelize[_0x24ef('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x24ef('0x3')]('first',_0x24ef('0x4'),_0x24ef('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x24ef('0x2')]}}; \ No newline at end of file +var _0xa97d=['second','third','sequelize','STRING','ENUM','first'];(function(_0x5c0fa8,_0xbef4b3){var _0x3b31de=function(_0x59edc1){while(--_0x59edc1){_0x5c0fa8['push'](_0x5c0fa8['shift']());}};_0x3b31de(++_0xbef4b3);}(_0xa97d,0x12e));var _0xda97=function(_0x322f69,_0x5a194c){_0x322f69=_0x322f69-0x0;var _0x30bf48=_0xa97d[_0x322f69];return _0x30bf48;};'use strict';var Sequelize=require(_0xda97('0x0'));module['exports']={'name':{'type':Sequelize[_0xda97('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xda97('0x2')](_0xda97('0x3'),_0xda97('0x4'),_0xda97('0x5')),'allowNull':![],'defaultValue':_0xda97('0x3')},'description':{'type':Sequelize[_0xda97('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 07aae74..d7a3e32 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 _0x9917=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','error','stack','name','send','index','map','Disposition','fieldName','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','find','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x9917,0xe6));var _0x7991=function(_0x48a216,_0x57a9e8){_0x48a216=_0x48a216-0x0;var _0x188c85=_0x9917[_0x48a216];return _0x188c85;};'use strict';var emlformat=require(_0x7991('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7991('0x1'));var jsonpatch=require(_0x7991('0x2'));var rp=require(_0x7991('0x3'));var moment=require('moment');var BPromise=require(_0x7991('0x4'));var Mustache=require(_0x7991('0x5'));var util=require(_0x7991('0x6'));var path=require(_0x7991('0x7'));var sox=require(_0x7991('0x8'));var csv=require(_0x7991('0x9'));var ejs=require(_0x7991('0xa'));var fs=require('fs');var fs_extra=require(_0x7991('0xb'));var _=require(_0x7991('0xc'));var squel=require('squel');var crypto=require(_0x7991('0xd'));var jsforce=require(_0x7991('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7991('0x9'));var querystring=require(_0x7991('0xf'));var Papa=require('papaparse');var Redis=require(_0x7991('0x10'));var authService=require(_0x7991('0x11'));var qs=require(_0x7991('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7991('0x13'));var logger=require(_0x7991('0x14'))(_0x7991('0x15'));var utils=require('../../config/utils');var config=require(_0x7991('0x16'));var licenseUtil=require(_0x7991('0x17'));var db=require(_0x7991('0x18'))['db'];function respondWithStatusCode(_0x1d3d02,_0x179264){_0x179264=_0x179264||0xcc;return function(_0x2be062){if(_0x2be062){return _0x1d3d02[_0x7991('0x19')](_0x179264);}return _0x1d3d02[_0x7991('0x1a')](_0x179264)[_0x7991('0x1b')]();};}function respondWithResult(_0x3b0c3e,_0x4f84ff){_0x4f84ff=_0x4f84ff||0xc8;return function(_0x35c475){if(_0x35c475){return _0x3b0c3e['status'](_0x4f84ff)[_0x7991('0x1c')](_0x35c475);}};}function respondWithFilteredResult(_0x25030c,_0x48e7d5){return function(_0x56955a){if(_0x56955a){var _0x4453e1=typeof _0x48e7d5[_0x7991('0x1d')]===_0x7991('0x1e')&&typeof _0x48e7d5[_0x7991('0x1f')]===_0x7991('0x1e');var _0x488a96=_0x56955a[_0x7991('0x20')];var _0x4c477b=_0x4453e1?0x0:_0x48e7d5['offset'];var _0x550a4d=_0x4453e1?_0x56955a[_0x7991('0x20')]:_0x48e7d5[_0x7991('0x1d')]+_0x48e7d5[_0x7991('0x1f')];var _0x108516;if(_0x550a4d>=_0x488a96){_0x550a4d=_0x488a96;_0x108516=0xc8;}else{_0x108516=0xce;}_0x25030c['status'](_0x108516);return _0x25030c['set'](_0x7991('0x21'),_0x4c477b+'-'+_0x550a4d+'/'+_0x488a96)[_0x7991('0x1c')](_0x56955a);}return null;};}function patchUpdates(_0x41414a){return function(_0xd30a13){try{jsonpatch[_0x7991('0x22')](_0xd30a13,_0x41414a,!![]);}catch(_0xf5f6f9){return BPromise[_0x7991('0x23')](_0xf5f6f9);}return _0xd30a13[_0x7991('0x24')]();};}function saveUpdates(_0x51555e,_0x1448c4){return function(_0x56a15d){if(_0x56a15d){return _0x56a15d['update'](_0x51555e)[_0x7991('0x25')](function(_0x2692d9){return _0x2692d9;});}return null;};}function removeEntity(_0x3cc12e,_0xded02a){return function(_0x2a19da){if(_0x2a19da){return _0x2a19da[_0x7991('0x26')]()[_0x7991('0x25')](function(){var _0x213999=_0x2a19da[_0x7991('0x27')]({'plain':!![]});var _0x415d14='Dispositions';return db['UserProfileResource'][_0x7991('0x26')]({'where':{'type':_0x415d14,'resourceId':_0x213999['id']}})['then'](function(){return _0x2a19da;});})['then'](function(){_0x3cc12e[_0x7991('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ad626,_0x35389c){return function(_0x34a296){if(!_0x34a296){_0x5ad626[_0x7991('0x19')](0x194);}return _0x34a296;};}function handleError(_0x52f98e,_0x1127e6){_0x1127e6=_0x1127e6||0x1f4;return function(_0x3904bf){logger[_0x7991('0x28')](_0x3904bf[_0x7991('0x29')]);if(_0x3904bf[_0x7991('0x2a')]){delete _0x3904bf[_0x7991('0x2a')];}_0x52f98e[_0x7991('0x1a')](_0x1127e6)[_0x7991('0x2b')](_0x3904bf);};}exports[_0x7991('0x2c')]=function(_0x45de98,_0x1b3e79){var _0x261f4c={},_0x127737={},_0x1873b9={'count':0x0,'rows':[]};var _0x5c540a=_[_0x7991('0x2d')](db[_0x7991('0x2e')]['rawAttributes'],function(_0x118367){return{'name':_0x118367[_0x7991('0x2f')],'type':_0x118367['type'][_0x7991('0x30')]};});_0x127737['model']=_[_0x7991('0x2d')](_0x5c540a,_0x7991('0x2a'));_0x127737['query']=_[_0x7991('0x31')](_0x45de98['query']);_0x127737[_0x7991('0x32')]=_[_0x7991('0x33')](_0x127737[_0x7991('0x34')],_0x127737[_0x7991('0x35')]);_0x261f4c[_0x7991('0x36')]=_[_0x7991('0x33')](_0x127737['model'],qs[_0x7991('0x37')](_0x45de98[_0x7991('0x35')]['fields']));_0x261f4c['attributes']=_0x261f4c[_0x7991('0x36')][_0x7991('0x38')]?_0x261f4c[_0x7991('0x36')]:_0x127737[_0x7991('0x34')];if(!_0x45de98['query'][_0x7991('0x39')](_0x7991('0x3a'))){_0x261f4c[_0x7991('0x1f')]=qs[_0x7991('0x1f')](_0x45de98[_0x7991('0x35')][_0x7991('0x1f')]);_0x261f4c[_0x7991('0x1d')]=qs[_0x7991('0x1d')](_0x45de98[_0x7991('0x35')][_0x7991('0x1d')]);}_0x261f4c[_0x7991('0x3b')]=qs[_0x7991('0x3c')](_0x45de98[_0x7991('0x35')][_0x7991('0x3c')]);_0x261f4c[_0x7991('0x3d')]=qs[_0x7991('0x32')](_[_0x7991('0x3e')](_0x45de98[_0x7991('0x35')],_0x127737[_0x7991('0x32')]),_0x5c540a);if(_0x45de98[_0x7991('0x35')][_0x7991('0x3f')]){_0x261f4c[_0x7991('0x3d')]=_[_0x7991('0x40')](_0x261f4c[_0x7991('0x3d')],{'$or':_[_0x7991('0x2d')](_0x5c540a,function(_0x154489){if(_0x154489[_0x7991('0x41')]!==_0x7991('0x42')){var _0x4e317f={};_0x4e317f[_0x154489[_0x7991('0x2a')]]={'$like':'%'+_0x45de98[_0x7991('0x35')][_0x7991('0x3f')]+'%'};return _0x4e317f;}})});}_0x261f4c=_[_0x7991('0x40')]({},_0x261f4c,_0x45de98[_0x7991('0x43')]);var _0x5dc682={'where':_0x261f4c[_0x7991('0x3d')]};return db[_0x7991('0x2e')]['count'](_0x5dc682)[_0x7991('0x25')](function(_0x4ea7ab){_0x1873b9[_0x7991('0x20')]=_0x4ea7ab;if(_0x45de98[_0x7991('0x35')]['includeAll']){_0x261f4c[_0x7991('0x44')]=[{'all':!![]}];}return db[_0x7991('0x2e')][_0x7991('0x45')](_0x261f4c);})[_0x7991('0x25')](function(_0x32c214){_0x1873b9[_0x7991('0x46')]=_0x32c214;return _0x1873b9;})[_0x7991('0x25')](respondWithFilteredResult(_0x1b3e79,_0x261f4c))[_0x7991('0x47')](handleError(_0x1b3e79,null));};exports[_0x7991('0x48')]=function(_0x59c6ee,_0x10dc38){var _0x425b66={'raw':!![],'where':{'id':_0x59c6ee[_0x7991('0x49')]['id']}},_0x58e2e7={};_0x58e2e7[_0x7991('0x34')]=_[_0x7991('0x31')](db[_0x7991('0x2e')][_0x7991('0x4a')]);_0x58e2e7[_0x7991('0x35')]=_[_0x7991('0x31')](_0x59c6ee[_0x7991('0x35')]);_0x58e2e7[_0x7991('0x32')]=_[_0x7991('0x33')](_0x58e2e7[_0x7991('0x34')],_0x58e2e7[_0x7991('0x35')]);_0x425b66[_0x7991('0x36')]=_[_0x7991('0x33')](_0x58e2e7[_0x7991('0x34')],qs['fields'](_0x59c6ee['query'][_0x7991('0x37')]));_0x425b66[_0x7991('0x36')]=_0x425b66[_0x7991('0x36')][_0x7991('0x38')]?_0x425b66['attributes']:_0x58e2e7['model'];if(_0x59c6ee['query']['includeAll']){_0x425b66['include']=[{'all':!![]}];}_0x425b66=_[_0x7991('0x40')]({},_0x425b66,_0x59c6ee['options']);return db[_0x7991('0x2e')][_0x7991('0x4b')](_0x425b66)[_0x7991('0x25')](handleEntityNotFound(_0x10dc38,null))[_0x7991('0x25')](respondWithResult(_0x10dc38,null))[_0x7991('0x47')](handleError(_0x10dc38,null));};exports['create']=function(_0x308f9e,_0x172abf){return db[_0x7991('0x2e')]['create'](_0x308f9e['body'],{})[_0x7991('0x25')](function(_0x2716b2){var _0x12571b=_0x308f9e[_0x7991('0x4c')]['get']({'plain':!![]});if(!_0x12571b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12571b[_0x7991('0x4d')]===_0x7991('0x4c')){var _0x2e5259=_0x2716b2[_0x7991('0x27')]({'plain':!![]});var _0x3cb93b='Dispositions';return db['UserProfileSection']['find']({'where':{'name':_0x3cb93b,'userProfileId':_0x12571b[_0x7991('0x4e')]},'raw':!![]})['then'](function(_0x12f4e6){if(_0x12f4e6&&_0x12f4e6[_0x7991('0x4f')]===0x0){return db[_0x7991('0x50')]['create']({'name':_0x2e5259[_0x7991('0x2a')],'resourceId':_0x2e5259['id'],'type':_0x12f4e6[_0x7991('0x2a')],'sectionId':_0x12f4e6['id']},{})[_0x7991('0x25')](function(){return _0x2716b2;});}else{return _0x2716b2;}})[_0x7991('0x47')](function(_0x3cea7f){logger[_0x7991('0x28')](_0x7991('0x51'),_0x3cea7f);throw _0x3cea7f;});}return _0x2716b2;})['then'](respondWithResult(_0x172abf,0xc9))[_0x7991('0x47')](handleError(_0x172abf,null));};exports[_0x7991('0x52')]=function(_0x2ab796,_0x47b6d1){if(_0x2ab796[_0x7991('0x53')]['id']){delete _0x2ab796[_0x7991('0x53')]['id'];}return db[_0x7991('0x2e')]['find']({'where':{'id':_0x2ab796[_0x7991('0x49')]['id']}})[_0x7991('0x25')](handleEntityNotFound(_0x47b6d1,null))['then'](saveUpdates(_0x2ab796[_0x7991('0x53')],null))['then'](respondWithResult(_0x47b6d1,null))['catch'](handleError(_0x47b6d1,null));};exports[_0x7991('0x26')]=function(_0x1463cc,_0x569bbe){return db[_0x7991('0x2e')][_0x7991('0x4b')]({'where':{'id':_0x1463cc[_0x7991('0x49')]['id']}})[_0x7991('0x25')](handleEntityNotFound(_0x569bbe,null))[_0x7991('0x25')](removeEntity(_0x569bbe,null))[_0x7991('0x47')](handleError(_0x569bbe,null));}; \ No newline at end of file +var _0xd8a5=['UserProfileSection','find','userProfileId','autoAssociation','eml-format','zip-dir','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','Dispositions','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','Disposition','findAll','rows','catch','show','params','intersection','fields','length','includeAll','include','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd8a5,0x160));var _0x5d8a=function(_0x45e9a4,_0x415e9c){_0x45e9a4=_0x45e9a4-0x0;var _0xcf40b=_0xd8a5[_0x45e9a4];return _0xcf40b;};'use strict';var emlformat=require(_0x5d8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d8a('0x1'));var jsonpatch=require(_0x5d8a('0x2'));var rp=require('request-promise');var moment=require(_0x5d8a('0x3'));var BPromise=require(_0x5d8a('0x4'));var Mustache=require(_0x5d8a('0x5'));var util=require(_0x5d8a('0x6'));var path=require(_0x5d8a('0x7'));var sox=require(_0x5d8a('0x8'));var csv=require(_0x5d8a('0x9'));var ejs=require(_0x5d8a('0xa'));var fs=require('fs');var fs_extra=require(_0x5d8a('0xb'));var _=require(_0x5d8a('0xc'));var squel=require(_0x5d8a('0xd'));var crypto=require(_0x5d8a('0xe'));var jsforce=require(_0x5d8a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5d8a('0x9'));var querystring=require(_0x5d8a('0x10'));var Papa=require(_0x5d8a('0x11'));var Redis=require(_0x5d8a('0x12'));var authService=require(_0x5d8a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5d8a('0x14'));var hardwareService=require(_0x5d8a('0x15'));var logger=require(_0x5d8a('0x16'))(_0x5d8a('0x17'));var utils=require('../../config/utils');var config=require(_0x5d8a('0x18'));var licenseUtil=require(_0x5d8a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b4578,_0x1b8221){_0x1b8221=_0x1b8221||0xcc;return function(_0x2accb9){if(_0x2accb9){return _0x3b4578[_0x5d8a('0x1a')](_0x1b8221);}return _0x3b4578[_0x5d8a('0x1b')](_0x1b8221)[_0x5d8a('0x1c')]();};}function respondWithResult(_0x3727d3,_0x1fb140){_0x1fb140=_0x1fb140||0xc8;return function(_0x3d852e){if(_0x3d852e){return _0x3727d3[_0x5d8a('0x1b')](_0x1fb140)[_0x5d8a('0x1d')](_0x3d852e);}};}function respondWithFilteredResult(_0x81815e,_0x5dba52){return function(_0x4d45e7){if(_0x4d45e7){var _0x39a1b8=typeof _0x5dba52[_0x5d8a('0x1e')]==='undefined'&&typeof _0x5dba52[_0x5d8a('0x1f')]===_0x5d8a('0x20');var _0x341262=_0x4d45e7[_0x5d8a('0x21')];var _0x5eb748=_0x39a1b8?0x0:_0x5dba52[_0x5d8a('0x1e')];var _0x54ab16=_0x39a1b8?_0x4d45e7[_0x5d8a('0x21')]:_0x5dba52[_0x5d8a('0x1e')]+_0x5dba52[_0x5d8a('0x1f')];var _0x235257;if(_0x54ab16>=_0x341262){_0x54ab16=_0x341262;_0x235257=0xc8;}else{_0x235257=0xce;}_0x81815e[_0x5d8a('0x1b')](_0x235257);return _0x81815e[_0x5d8a('0x22')](_0x5d8a('0x23'),_0x5eb748+'-'+_0x54ab16+'/'+_0x341262)['json'](_0x4d45e7);}return null;};}function patchUpdates(_0x460e95){return function(_0x235065){try{jsonpatch[_0x5d8a('0x24')](_0x235065,_0x460e95,!![]);}catch(_0x3c2524){return BPromise['reject'](_0x3c2524);}return _0x235065[_0x5d8a('0x25')]();};}function saveUpdates(_0x3d9815,_0x50e0fe){return function(_0x5443b9){if(_0x5443b9){return _0x5443b9[_0x5d8a('0x26')](_0x3d9815)[_0x5d8a('0x27')](function(_0x186aa9){return _0x186aa9;});}return null;};}function removeEntity(_0x1201c6,_0x5d9f63){return function(_0x8cbf6e){if(_0x8cbf6e){return _0x8cbf6e[_0x5d8a('0x28')]()['then'](function(){var _0x93d735=_0x8cbf6e['get']({'plain':!![]});var _0x194b9e=_0x5d8a('0x29');return db[_0x5d8a('0x2a')]['destroy']({'where':{'type':_0x194b9e,'resourceId':_0x93d735['id']}})[_0x5d8a('0x27')](function(){return _0x8cbf6e;});})[_0x5d8a('0x27')](function(){_0x1201c6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a637f,_0x189617){return function(_0x20fae2){if(!_0x20fae2){_0x3a637f['sendStatus'](0x194);}return _0x20fae2;};}function handleError(_0x2fa9fd,_0x3cafbf){_0x3cafbf=_0x3cafbf||0x1f4;return function(_0x4e4c43){logger[_0x5d8a('0x2b')](_0x4e4c43[_0x5d8a('0x2c')]);if(_0x4e4c43[_0x5d8a('0x2d')]){delete _0x4e4c43[_0x5d8a('0x2d')];}_0x2fa9fd[_0x5d8a('0x1b')](_0x3cafbf)['send'](_0x4e4c43);};}exports[_0x5d8a('0x2e')]=function(_0x13c112,_0x6fda47){var _0x1b1d4b={},_0x2b10e6={},_0x1e6ab5={'count':0x0,'rows':[]};var _0x30b4ad=_[_0x5d8a('0x2f')](db['Disposition'][_0x5d8a('0x30')],function(_0x1a85c3){return{'name':_0x1a85c3[_0x5d8a('0x31')],'type':_0x1a85c3[_0x5d8a('0x32')][_0x5d8a('0x33')]};});_0x2b10e6[_0x5d8a('0x34')]=_[_0x5d8a('0x2f')](_0x30b4ad,_0x5d8a('0x2d'));_0x2b10e6[_0x5d8a('0x35')]=_[_0x5d8a('0x36')](_0x13c112[_0x5d8a('0x35')]);_0x2b10e6[_0x5d8a('0x37')]=_['intersection'](_0x2b10e6[_0x5d8a('0x34')],_0x2b10e6[_0x5d8a('0x35')]);_0x1b1d4b[_0x5d8a('0x38')]=_['intersection'](_0x2b10e6[_0x5d8a('0x34')],qs['fields'](_0x13c112[_0x5d8a('0x35')]['fields']));_0x1b1d4b['attributes']=_0x1b1d4b[_0x5d8a('0x38')]['length']?_0x1b1d4b['attributes']:_0x2b10e6[_0x5d8a('0x34')];if(!_0x13c112[_0x5d8a('0x35')][_0x5d8a('0x39')](_0x5d8a('0x3a'))){_0x1b1d4b[_0x5d8a('0x1f')]=qs[_0x5d8a('0x1f')](_0x13c112[_0x5d8a('0x35')][_0x5d8a('0x1f')]);_0x1b1d4b[_0x5d8a('0x1e')]=qs['offset'](_0x13c112['query']['offset']);}_0x1b1d4b[_0x5d8a('0x3b')]=qs[_0x5d8a('0x3c')](_0x13c112[_0x5d8a('0x35')][_0x5d8a('0x3c')]);_0x1b1d4b['where']=qs['filters'](_[_0x5d8a('0x3d')](_0x13c112[_0x5d8a('0x35')],_0x2b10e6[_0x5d8a('0x37')]),_0x30b4ad);if(_0x13c112[_0x5d8a('0x35')][_0x5d8a('0x3e')]){_0x1b1d4b[_0x5d8a('0x3f')]=_[_0x5d8a('0x40')](_0x1b1d4b['where'],{'$or':_['map'](_0x30b4ad,function(_0x54ed0a){if(_0x54ed0a[_0x5d8a('0x32')]!==_0x5d8a('0x41')){var _0x19b308={};_0x19b308[_0x54ed0a[_0x5d8a('0x2d')]]={'$like':'%'+_0x13c112[_0x5d8a('0x35')][_0x5d8a('0x3e')]+'%'};return _0x19b308;}})});}_0x1b1d4b=_[_0x5d8a('0x40')]({},_0x1b1d4b,_0x13c112['options']);var _0x35c729={'where':_0x1b1d4b[_0x5d8a('0x3f')]};return db[_0x5d8a('0x42')]['count'](_0x35c729)[_0x5d8a('0x27')](function(_0x36a409){_0x1e6ab5[_0x5d8a('0x21')]=_0x36a409;if(_0x13c112[_0x5d8a('0x35')]['includeAll']){_0x1b1d4b['include']=[{'all':!![]}];}return db[_0x5d8a('0x42')][_0x5d8a('0x43')](_0x1b1d4b);})[_0x5d8a('0x27')](function(_0x4bb87d){_0x1e6ab5[_0x5d8a('0x44')]=_0x4bb87d;return _0x1e6ab5;})['then'](respondWithFilteredResult(_0x6fda47,_0x1b1d4b))[_0x5d8a('0x45')](handleError(_0x6fda47,null));};exports[_0x5d8a('0x46')]=function(_0x4ee290,_0x4be896){var _0x247ea3={'raw':!![],'where':{'id':_0x4ee290[_0x5d8a('0x47')]['id']}},_0x3eafdd={};_0x3eafdd[_0x5d8a('0x34')]=_[_0x5d8a('0x36')](db[_0x5d8a('0x42')][_0x5d8a('0x30')]);_0x3eafdd[_0x5d8a('0x35')]=_[_0x5d8a('0x36')](_0x4ee290[_0x5d8a('0x35')]);_0x3eafdd[_0x5d8a('0x37')]=_['intersection'](_0x3eafdd[_0x5d8a('0x34')],_0x3eafdd[_0x5d8a('0x35')]);_0x247ea3[_0x5d8a('0x38')]=_[_0x5d8a('0x48')](_0x3eafdd[_0x5d8a('0x34')],qs[_0x5d8a('0x49')](_0x4ee290['query']['fields']));_0x247ea3[_0x5d8a('0x38')]=_0x247ea3[_0x5d8a('0x38')][_0x5d8a('0x4a')]?_0x247ea3[_0x5d8a('0x38')]:_0x3eafdd[_0x5d8a('0x34')];if(_0x4ee290[_0x5d8a('0x35')][_0x5d8a('0x4b')]){_0x247ea3[_0x5d8a('0x4c')]=[{'all':!![]}];}_0x247ea3=_['merge']({},_0x247ea3,_0x4ee290[_0x5d8a('0x4d')]);return db['Disposition']['find'](_0x247ea3)[_0x5d8a('0x27')](handleEntityNotFound(_0x4be896,null))['then'](respondWithResult(_0x4be896,null))[_0x5d8a('0x45')](handleError(_0x4be896,null));};exports[_0x5d8a('0x4e')]=function(_0xcc48d9,_0x9c507b){return db['Disposition']['create'](_0xcc48d9[_0x5d8a('0x4f')],{})[_0x5d8a('0x27')](function(_0x504149){var _0x14e1d3=_0xcc48d9['user']['get']({'plain':!![]});if(!_0x14e1d3)throw new Error(_0x5d8a('0x50'));if(_0x14e1d3[_0x5d8a('0x51')]===_0x5d8a('0x52')){var _0x38b1fe=_0x504149['get']({'plain':!![]});var _0x192244=_0x5d8a('0x29');return db[_0x5d8a('0x53')][_0x5d8a('0x54')]({'where':{'name':_0x192244,'userProfileId':_0x14e1d3[_0x5d8a('0x55')]},'raw':!![]})[_0x5d8a('0x27')](function(_0x3ba08f){if(_0x3ba08f&&_0x3ba08f[_0x5d8a('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x38b1fe[_0x5d8a('0x2d')],'resourceId':_0x38b1fe['id'],'type':_0x3ba08f['name'],'sectionId':_0x3ba08f['id']},{})['then'](function(){return _0x504149;});}else{return _0x504149;}})[_0x5d8a('0x45')](function(_0x183990){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x183990);throw _0x183990;});}return _0x504149;})[_0x5d8a('0x27')](respondWithResult(_0x9c507b,0xc9))['catch'](handleError(_0x9c507b,null));};exports[_0x5d8a('0x26')]=function(_0x52f8da,_0x1fc3db){if(_0x52f8da[_0x5d8a('0x4f')]['id']){delete _0x52f8da[_0x5d8a('0x4f')]['id'];}return db[_0x5d8a('0x42')][_0x5d8a('0x54')]({'where':{'id':_0x52f8da[_0x5d8a('0x47')]['id']}})[_0x5d8a('0x27')](handleEntityNotFound(_0x1fc3db,null))['then'](saveUpdates(_0x52f8da[_0x5d8a('0x4f')],null))[_0x5d8a('0x27')](respondWithResult(_0x1fc3db,null))[_0x5d8a('0x45')](handleError(_0x1fc3db,null));};exports[_0x5d8a('0x28')]=function(_0xf1ee00,_0x49f0a1){return db[_0x5d8a('0x42')]['find']({'where':{'id':_0xf1ee00[_0x5d8a('0x47')]['id']}})['then'](handleEntityNotFound(_0x49f0a1,null))[_0x5d8a('0x27')](removeEntity(_0x49f0a1,null))['catch'](handleError(_0x49f0a1,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 37a074b..eeea5ba 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 _0x78c3=['OpenchannelAccountId','WhatsappAccountId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel'];(function(_0x2cbb78,_0x282b39){var _0x53ee5e=function(_0x2a4786){while(--_0x2a4786){_0x2cbb78['push'](_0x2cbb78['shift']());}};_0x53ee5e(++_0x282b39);}(_0x78c3,0x106));var _0x378c=function(_0x1b6aac,_0x2de844){_0x1b6aac=_0x1b6aac-0x0;var _0xfbdb8c=_0x78c3[_0x1b6aac];return _0xfbdb8c;};'use strict';var _=require('lodash');var util=require(_0x378c('0x0'));var logger=require(_0x378c('0x1'))('api');var moment=require(_0x378c('0x2'));var BPromise=require(_0x378c('0x3'));var rp=require(_0x378c('0x4'));var fs=require('fs');var path=require(_0x378c('0x5'));var rimraf=require(_0x378c('0x6'));var config=require(_0x378c('0x7'));var attributes=require(_0x378c('0x8'));module[_0x378c('0x9')]=function(_0x4b7464,_0x52f917){return _0x4b7464[_0x378c('0xa')](_0x378c('0xb'),attributes,{'tableName':_0x378c('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x378c('0xd'),'fields':[_0x378c('0xe'),_0x378c('0xf')]},{'unique':!![],'name':'name_chat','fields':[_0x378c('0xe'),_0x378c('0x10')]},{'unique':!![],'name':_0x378c('0x11'),'fields':[_0x378c('0xe'),_0x378c('0x12')]},{'unique':!![],'name':_0x378c('0x13'),'fields':[_0x378c('0xe'),_0x378c('0x14')]},{'unique':!![],'name':_0x378c('0x15'),'fields':['name',_0x378c('0x16')]},{'unique':!![],'name':_0x378c('0x17'),'fields':[_0x378c('0xe'),_0x378c('0x18')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x378c('0xe'),_0x378c('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1c1=['request-promise','path','rimraf','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','ChatWebsiteId','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment'];(function(_0x17ebc9,_0x35c3e9){var _0x2de53b=function(_0x5af291){while(--_0x5af291){_0x17ebc9['push'](_0x17ebc9['shift']());}};_0x2de53b(++_0x35c3e9);}(_0xb1c1,0x155));var _0x1b1c=function(_0x3be53d,_0x3fa492){_0x3be53d=_0x3be53d-0x0;var _0x3a7d39=_0xb1c1[_0x3be53d];return _0x3a7d39;};'use strict';var _=require(_0x1b1c('0x0'));var util=require(_0x1b1c('0x1'));var logger=require(_0x1b1c('0x2'))('api');var moment=require(_0x1b1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b1c('0x4'));var fs=require('fs');var path=require(_0x1b1c('0x5'));var rimraf=require(_0x1b1c('0x6'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x1b1c('0x7')]=function(_0x20771c,_0x56c1bd){return _0x20771c[_0x1b1c('0x8')](_0x1b1c('0x9'),attributes,{'tableName':_0x1b1c('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x1b1c('0xb'),'fields':[_0x1b1c('0xc'),_0x1b1c('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0x1b1c('0xc'),_0x1b1c('0xe')]},{'unique':!![],'name':'name_mail','fields':['name',_0x1b1c('0xf')]},{'unique':!![],'name':'name_sms','fields':['name',_0x1b1c('0x10')]},{'unique':!![],'name':_0x1b1c('0x11'),'fields':[_0x1b1c('0xc'),_0x1b1c('0x12')]},{'unique':!![],'name':_0x1b1c('0x13'),'fields':['name',_0x1b1c('0x14')]},{'unique':!![],'name':_0x1b1c('0x15'),'fields':['name',_0x1b1c('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index a329c1f..e2346e3 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(_0x3a0caa,_0xee5b99){var _0x1a5d8a=function(_0x4af3e3){while(--_0x4af3e3){_0x3a0caa['push'](_0x3a0caa['shift']());}};_0x1a5d8a(++_0xee5b99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x15ab2e,_0x5bd44e){var _0x3fe3bc=function(_0x40d50d){while(--_0x40d50d){_0x15ab2e['push'](_0x15ab2e['shift']());}};_0x3fe3bc(++_0x5bd44e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 4511e9e..478f82f 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 _0x9219=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x9219,0x1cd));var _0x9921=function(_0x3460fd,_0x298e50){_0x3460fd=_0x3460fd-0x0;var _0x47b43c=_0x9219[_0x3460fd];return _0x47b43c;};'use strict';var multer=require('multer');var util=require(_0x9921('0x0'));var path=require(_0x9921('0x1'));var timeout=require(_0x9921('0x2'));var express=require(_0x9921('0x3'));var router=express[_0x9921('0x4')]();var fs_extra=require(_0x9921('0x5'));var auth=require(_0x9921('0x6'));var interaction=require(_0x9921('0x7'));var config=require(_0x9921('0x8'));var controller=require('./disposition.controller');router[_0x9921('0x9')]('/',auth[_0x9921('0xa')](),controller[_0x9921('0xb')]);router['get'](_0x9921('0xc'),auth[_0x9921('0xa')](),controller['show']);router[_0x9921('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9921('0xe')](_0x9921('0xc'),auth[_0x9921('0xa')](),controller[_0x9921('0xf')]);router[_0x9921('0x10')](_0x9921('0xc'),auth['isAuthenticated'](),controller[_0x9921('0x11')]);module[_0x9921('0x12')]=router; \ No newline at end of file +var _0x633b=['/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x633b,0xd8));var _0xb633=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x633b[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb633('0x0'));var util=require(_0xb633('0x1'));var path=require(_0xb633('0x2'));var timeout=require(_0xb633('0x3'));var express=require(_0xb633('0x4'));var router=express['Router']();var fs_extra=require(_0xb633('0x5'));var auth=require(_0xb633('0x6'));var interaction=require(_0xb633('0x7'));var config=require(_0xb633('0x8'));var controller=require(_0xb633('0x9'));router[_0xb633('0xa')]('/',auth[_0xb633('0xb')](),controller['index']);router[_0xb633('0xa')](_0xb633('0xc'),auth['isAuthenticated'](),controller[_0xb633('0xd')]);router[_0xb633('0xe')]('/',auth[_0xb633('0xb')](),controller[_0xb633('0xf')]);router[_0xb633('0x10')](_0xb633('0xc'),auth[_0xb633('0xb')](),controller[_0xb633('0x11')]);router['delete'](_0xb633('0xc'),auth[_0xb633('0xb')](),controller['destroy']);module[_0xb633('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 387478f..5bd9e56 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 _0x57fa=['12000','14400','9600','v17,v27,v29','SIP','DADHI','KHOMP','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','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x57fa,0x1be));var _0xa57f=function(_0x2b3cd2,_0x19b508){_0x2b3cd2=_0x2b3cd2-0x0;var _0x30348a=_0x57fa[_0x2b3cd2];return _0x30348a;};'use strict';var Sequelize=require(_0xa57f('0x0'));module[_0xa57f('0x1')]={'name':{'type':Sequelize[_0xa57f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xa57f('0x3')](_0xa57f('0x4'),'no'),'defaultValue':_0xa57f('0x4')},'headerinfo':{'type':Sequelize[_0xa57f('0x2')],'defaultValue':_0xa57f('0x5')},'localstationid':{'type':Sequelize[_0xa57f('0x2')],'unique':_0xa57f('0x6')},'minrate':{'type':Sequelize[_0xa57f('0x3')](_0xa57f('0x7'),_0xa57f('0x8'),_0xa57f('0x9'),'9600',_0xa57f('0xa'),_0xa57f('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xa57f('0x3')](_0xa57f('0x7'),_0xa57f('0x8'),_0xa57f('0x9'),_0xa57f('0xc'),_0xa57f('0xa'),_0xa57f('0xb')),'defaultValue':_0xa57f('0xb')},'modem':{'type':Sequelize[_0xa57f('0x2')],'defaultValue':_0xa57f('0xd')},'gateway':{'type':Sequelize[_0xa57f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa57f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa57f('0x3')](_0xa57f('0xe'),'IAX',_0xa57f('0xf'),_0xa57f('0x10')),'defaultValue':_0xa57f('0xe')},'key':{'type':Sequelize[_0xa57f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa57f('0x11')],'defaultValue':function(){return _0xa57f('0x12');}},'notificationSound':{'type':Sequelize[_0xa57f('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa57f('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa57f('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa57f('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa57f('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa57f('0x15')},'mandatoryDisposition':{'type':Sequelize[_0xa57f('0x13')],'defaultValue':![],'comment':_0xa57f('0x16'),'set':function(_0xc046ef){if(!_0xc046ef)this[_0xa57f('0x17')]('mandatoryDispositionPauseId',null);this[_0xa57f('0x17')]('mandatoryDisposition',_0xc046ef);}}}; \ No newline at end of file +var _0x79aa=['14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','2400','4800','7200','9600','12000'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x79aa,0x121));var _0xa79a=function(_0xf46bd9,_0x322826){_0xf46bd9=_0xf46bd9-0x0;var _0x2763c3=_0x79aa[_0xf46bd9];return _0x2763c3;};'use strict';var Sequelize=require(_0xa79a('0x0'));module[_0xa79a('0x1')]={'name':{'type':Sequelize[_0xa79a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xa79a('0x3')]('yes','no'),'defaultValue':_0xa79a('0x4')},'headerinfo':{'type':Sequelize[_0xa79a('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xa79a('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0xa79a('0x5'),_0xa79a('0x6'),_0xa79a('0x7'),_0xa79a('0x8'),_0xa79a('0x9'),_0xa79a('0xa')),'defaultValue':_0xa79a('0x6')},'maxrate':{'type':Sequelize[_0xa79a('0x3')](_0xa79a('0x5'),_0xa79a('0x6'),_0xa79a('0x7'),_0xa79a('0x8'),_0xa79a('0x9'),_0xa79a('0xa')),'defaultValue':_0xa79a('0xa')},'modem':{'type':Sequelize[_0xa79a('0x2')],'defaultValue':_0xa79a('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa79a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa79a('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa79a('0x3')](_0xa79a('0xd'),_0xa79a('0xe'),_0xa79a('0xf'),_0xa79a('0x10')),'defaultValue':_0xa79a('0xd')},'key':{'type':Sequelize[_0xa79a('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa79a('0x11')],'defaultValue':function(){return _0xa79a('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa79a('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa79a('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa79a('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa79a('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa79a('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xa79a('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xa79a('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1b72b9){if(!_0x1b72b9)this[_0xa79a('0x15')](_0xa79a('0x16'),null);this[_0xa79a('0x15')]('mandatoryDisposition',_0x1b72b9);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 7d8fefe..786119f 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 _0x3a3c=['CannedAnswer','getAnswers','findOne','hasOwnProperty','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','getApplications','pick','context','from-voip-provider','exten','localstationid','app','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','Wait','ReceiveFax','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','path','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getDispositions','Disposition','FaxAccountId','removeDispositions','ids'];(function(_0x3984d3,_0x5996a5){var _0x5733a3=function(_0x7b2fda){while(--_0x7b2fda){_0x3984d3['push'](_0x3984d3['shift']());}};_0x5733a3(++_0x5996a5);}(_0x3a3c,0x11f));var _0xc3a3=function(_0x3dbbe3,_0x5140b6){_0x3dbbe3=_0x3dbbe3-0x0;var _0x12cb31=_0x3a3c[_0x3dbbe3];return _0x12cb31;};'use strict';var emlformat=require(_0xc3a3('0x0'));var rimraf=require(_0xc3a3('0x1'));var zipdir=require(_0xc3a3('0x2'));var jsonpatch=require(_0xc3a3('0x3'));var rp=require(_0xc3a3('0x4'));var moment=require(_0xc3a3('0x5'));var BPromise=require(_0xc3a3('0x6'));var Mustache=require(_0xc3a3('0x7'));var util=require('util');var path=require('path');var sox=require(_0xc3a3('0x8'));var csv=require(_0xc3a3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc3a3('0xa'));var _=require('lodash');var squel=require(_0xc3a3('0xb'));var crypto=require(_0xc3a3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc3a3('0xd'));var toCsv=require(_0xc3a3('0x9'));var querystring=require('querystring');var Papa=require(_0xc3a3('0xe'));var Redis=require(_0xc3a3('0xf'));var authService=require(_0xc3a3('0x10'));var qs=require(_0xc3a3('0x11'));var as=require(_0xc3a3('0x12'));var hardwareService=require(_0xc3a3('0x13'));var logger=require(_0xc3a3('0x14'))(_0xc3a3('0x15'));var utils=require(_0xc3a3('0x16'));var config=require(_0xc3a3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3a3('0x18'))['db'];config[_0xc3a3('0x19')]=_['defaults'](config[_0xc3a3('0x19')],{'host':_0xc3a3('0x1a'),'port':0x18eb});var socket=require(_0xc3a3('0x1b'))(new Redis(config[_0xc3a3('0x19')]));require('./faxAccount.socket')[_0xc3a3('0x1c')](socket);var jayson=require(_0xc3a3('0x1d'));var client=jayson[_0xc3a3('0x1e')][_0xc3a3('0x1f')]({'port':0x232c});var client9002=jayson[_0xc3a3('0x1e')][_0xc3a3('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5b14d5,_0xc3d098,_0x263ecc,_0x551c30){return new BPromise(function(_0xe7acdf,_0x399143){var _0x278dc3=_0x551c30||client;return _0x278dc3[_0xc3a3('0x20')](_0x5b14d5,_0x263ecc)[_0xc3a3('0x21')](function(_0x3accc8){logger['info']('FaxAccount,\x20%s,\x20%s',_0xc3d098,_0xc3a3('0x22'));logger[_0xc3a3('0x23')](_0xc3a3('0x24'),_0xc3d098,'request\x20sent',JSON[_0xc3a3('0x25')](_0x3accc8));if(_0x3accc8['error']){if(_0x3accc8[_0xc3a3('0x26')][_0xc3a3('0x27')]===0x1f4){logger[_0xc3a3('0x26')](_0xc3a3('0x28'),_0xc3d098,_0x3accc8[_0xc3a3('0x26')][_0xc3a3('0x29')]);return _0x399143(_0x3accc8[_0xc3a3('0x26')]['message']);}logger[_0xc3a3('0x26')](_0xc3a3('0x28'),_0xc3d098,_0x3accc8[_0xc3a3('0x26')][_0xc3a3('0x29')]);return _0xe7acdf(_0x3accc8['error'][_0xc3a3('0x29')]);}else{logger[_0xc3a3('0x2a')](_0xc3a3('0x28'),_0xc3d098,_0xc3a3('0x22'));_0xe7acdf(_0x3accc8['result'][_0xc3a3('0x29')]);}})[_0xc3a3('0x2b')](function(_0x4a5202){logger[_0xc3a3('0x26')](_0xc3a3('0x28'),_0xc3d098,_0x4a5202);_0x399143(_0x4a5202);});});}function respondWithStatusCode(_0x102c49,_0x321603){_0x321603=_0x321603||0xcc;return function(_0x5740a3){if(_0x5740a3){return _0x102c49[_0xc3a3('0x2c')](_0x321603);}return _0x102c49[_0xc3a3('0x2d')](_0x321603)['end']();};}function respondWithResult(_0x15749d,_0x22d786){_0x22d786=_0x22d786||0xc8;return function(_0x35cc78){if(_0x35cc78){return _0x15749d[_0xc3a3('0x2d')](_0x22d786)[_0xc3a3('0x2e')](_0x35cc78);}};}function respondWithFilteredResult(_0x8a7f38,_0x32c1f9){return function(_0x29ec63){if(_0x29ec63){var _0x4de0dc=typeof _0x32c1f9[_0xc3a3('0x2f')]===_0xc3a3('0x30')&&typeof _0x32c1f9[_0xc3a3('0x31')]===_0xc3a3('0x30');var _0x41a1ad=_0x29ec63['count'];var _0x3b40cb=_0x4de0dc?0x0:_0x32c1f9[_0xc3a3('0x2f')];var _0x229bb6=_0x4de0dc?_0x29ec63['count']:_0x32c1f9[_0xc3a3('0x2f')]+_0x32c1f9[_0xc3a3('0x31')];var _0x5350ea;if(_0x229bb6>=_0x41a1ad){_0x229bb6=_0x41a1ad;_0x5350ea=0xc8;}else{_0x5350ea=0xce;}_0x8a7f38[_0xc3a3('0x2d')](_0x5350ea);return _0x8a7f38[_0xc3a3('0x32')](_0xc3a3('0x33'),_0x3b40cb+'-'+_0x229bb6+'/'+_0x41a1ad)[_0xc3a3('0x2e')](_0x29ec63);}return null;};}function patchUpdates(_0x15c49f){return function(_0x113bcf){try{jsonpatch['apply'](_0x113bcf,_0x15c49f,!![]);}catch(_0x20e384){return BPromise['reject'](_0x20e384);}return _0x113bcf[_0xc3a3('0x34')]();};}function saveUpdates(_0x380b15,_0x513950){return function(_0x476666){if(_0x476666){return _0x476666[_0xc3a3('0x35')](_0x380b15)[_0xc3a3('0x21')](function(_0x2d493c){return _0x2d493c;});}return null;};}function removeEntity(_0xb0c520,_0x559266){return function(_0x2e975e){if(_0x2e975e){return _0x2e975e[_0xc3a3('0x36')]()['then'](function(){var _0x2e40a0=_0x2e975e[_0xc3a3('0x37')]({'plain':!![]});var _0x557f2d=_0xc3a3('0x38');return db[_0xc3a3('0x39')][_0xc3a3('0x36')]({'where':{'type':_0x557f2d,'resourceId':_0x2e40a0['id']}})[_0xc3a3('0x21')](function(){return _0x2e975e;});})[_0xc3a3('0x21')](function(){_0xb0c520['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36e0ec,_0x55d897){return function(_0x56252f){if(!_0x56252f){_0x36e0ec[_0xc3a3('0x2c')](0x194);}return _0x56252f;};}function handleError(_0x10f962,_0x11127f){_0x11127f=_0x11127f||0x1f4;return function(_0x2d9ba2){logger['error'](_0x2d9ba2[_0xc3a3('0x3a')]);if(_0x2d9ba2['name']){delete _0x2d9ba2[_0xc3a3('0x3b')];}_0x10f962[_0xc3a3('0x2d')](_0x11127f)[_0xc3a3('0x3c')](_0x2d9ba2);};}exports['index']=function(_0x44426e,_0x2a6f8b){var _0x3886c7={'include':[{'model':db[_0xc3a3('0x3d')],'as':_0xc3a3('0x3e')}]},_0x8c1a59={},_0x2f6c69={'count':0x0,'rows':[]};var _0x45e88b=_[_0xc3a3('0x3f')](db[_0xc3a3('0x40')][_0xc3a3('0x41')],function(_0x445b49){return{'name':_0x445b49[_0xc3a3('0x42')],'type':_0x445b49[_0xc3a3('0x43')][_0xc3a3('0x44')]};});_0x8c1a59[_0xc3a3('0x45')]=_[_0xc3a3('0x3f')](_0x45e88b,_0xc3a3('0x3b'));_0x8c1a59[_0xc3a3('0x46')]=_[_0xc3a3('0x47')](_0x44426e['query']);_0x8c1a59[_0xc3a3('0x48')]=_[_0xc3a3('0x49')](_0x8c1a59[_0xc3a3('0x45')],_0x8c1a59[_0xc3a3('0x46')]);_0x3886c7['attributes']=_[_0xc3a3('0x49')](_0x8c1a59[_0xc3a3('0x45')],qs[_0xc3a3('0x4a')](_0x44426e[_0xc3a3('0x46')][_0xc3a3('0x4a')]));_0x3886c7[_0xc3a3('0x4b')]=_0x3886c7[_0xc3a3('0x4b')][_0xc3a3('0x4c')]?_0x3886c7['attributes']:_0x8c1a59[_0xc3a3('0x45')];if(!_0x44426e[_0xc3a3('0x46')]['hasOwnProperty'](_0xc3a3('0x4d'))){_0x3886c7[_0xc3a3('0x31')]=qs['limit'](_0x44426e[_0xc3a3('0x46')][_0xc3a3('0x31')]);_0x3886c7[_0xc3a3('0x2f')]=qs[_0xc3a3('0x2f')](_0x44426e['query']['offset']);}_0x3886c7[_0xc3a3('0x4e')]=qs['sort'](_0x44426e[_0xc3a3('0x46')][_0xc3a3('0x4f')]);_0x3886c7['where']=qs[_0xc3a3('0x48')](_['pick'](_0x44426e['query'],_0x8c1a59[_0xc3a3('0x48')]),_0x45e88b);if(_0x44426e[_0xc3a3('0x46')][_0xc3a3('0x50')]){_0x3886c7[_0xc3a3('0x51')]=_[_0xc3a3('0x52')](_0x3886c7[_0xc3a3('0x51')],{'$or':_[_0xc3a3('0x3f')](_0x45e88b,function(_0x32a4a0){if(_0x32a4a0[_0xc3a3('0x43')]!==_0xc3a3('0x53')){var _0x27819f={};_0x27819f[_0x32a4a0[_0xc3a3('0x3b')]]={'$like':'%'+_0x44426e['query']['filter']+'%'};return _0x27819f;}})});}_0x3886c7=_[_0xc3a3('0x52')]({},_0x3886c7,_0x44426e[_0xc3a3('0x54')]);var _0x3c6bb8={'where':_0x3886c7[_0xc3a3('0x51')]};return db['FaxAccount'][_0xc3a3('0x55')](_0x3c6bb8)['then'](function(_0x352781){_0x2f6c69[_0xc3a3('0x55')]=_0x352781;if(_0x44426e[_0xc3a3('0x46')][_0xc3a3('0x56')]){_0x3886c7[_0xc3a3('0x57')]=[{'all':!![]}];}return db[_0xc3a3('0x40')][_0xc3a3('0x58')](_0x3886c7);})[_0xc3a3('0x21')](function(_0x563e9c){_0x2f6c69[_0xc3a3('0x59')]=_0x563e9c;return _0x2f6c69;})[_0xc3a3('0x21')](respondWithFilteredResult(_0x2a6f8b,_0x3886c7))['catch'](handleError(_0x2a6f8b,null));};exports[_0xc3a3('0x5a')]=function(_0x3534fc,_0x2a172f){var _0x513bf4={'raw':![],'where':{'id':_0x3534fc[_0xc3a3('0x5b')]['id']},'include':[{'model':db[_0xc3a3('0x3d')],'as':'mandatoryDispositionPause'}]},_0x317789={};_0x317789[_0xc3a3('0x45')]=_['keys'](db[_0xc3a3('0x40')][_0xc3a3('0x41')]);_0x317789[_0xc3a3('0x46')]=_[_0xc3a3('0x47')](_0x3534fc[_0xc3a3('0x46')]);_0x317789[_0xc3a3('0x48')]=_[_0xc3a3('0x49')](_0x317789[_0xc3a3('0x45')],_0x317789[_0xc3a3('0x46')]);_0x513bf4[_0xc3a3('0x4b')]=_[_0xc3a3('0x49')](_0x317789[_0xc3a3('0x45')],qs[_0xc3a3('0x4a')](_0x3534fc[_0xc3a3('0x46')][_0xc3a3('0x4a')]));_0x513bf4['attributes']=_0x513bf4[_0xc3a3('0x4b')][_0xc3a3('0x4c')]?_0x513bf4[_0xc3a3('0x4b')]:_0x317789[_0xc3a3('0x45')];if(_0x3534fc[_0xc3a3('0x46')]['includeAll']){_0x513bf4[_0xc3a3('0x57')]=[{'all':!![]}];}_0x513bf4=_[_0xc3a3('0x52')]({},_0x513bf4,_0x3534fc[_0xc3a3('0x54')]);return db[_0xc3a3('0x40')][_0xc3a3('0x5c')](_0x513bf4)[_0xc3a3('0x21')](handleEntityNotFound(_0x2a172f,null))[_0xc3a3('0x21')](respondWithResult(_0x2a172f,null))['catch'](handleError(_0x2a172f,null));};exports[_0xc3a3('0x5d')]=function(_0x1b7d49,_0x580989){return db[_0xc3a3('0x40')][_0xc3a3('0x5d')](_0x1b7d49[_0xc3a3('0x5e')],{})[_0xc3a3('0x21')](function(_0x188837){var _0x4fb612=_0x1b7d49[_0xc3a3('0x5f')][_0xc3a3('0x37')]({'plain':!![]});if(!_0x4fb612)throw new Error(_0xc3a3('0x60'));if(_0x4fb612[_0xc3a3('0x61')]===_0xc3a3('0x5f')){var _0x25b1c1=_0x188837['get']({'plain':!![]});var _0x2991df=_0xc3a3('0x38');return db[_0xc3a3('0x62')][_0xc3a3('0x5c')]({'where':{'name':_0x2991df,'userProfileId':_0x4fb612[_0xc3a3('0x63')]},'raw':!![]})[_0xc3a3('0x21')](function(_0xa3b62c){if(_0xa3b62c&&_0xa3b62c[_0xc3a3('0x64')]===0x0){return db['UserProfileResource'][_0xc3a3('0x5d')]({'name':_0x25b1c1['name'],'resourceId':_0x25b1c1['id'],'type':_0xa3b62c['name'],'sectionId':_0xa3b62c['id']},{})['then'](function(){return _0x188837;});}else{return _0x188837;}})['catch'](function(_0x572b4a){logger[_0xc3a3('0x26')](_0xc3a3('0x65'),_0x572b4a);throw _0x572b4a;});}return _0x188837;})[_0xc3a3('0x21')](respondWithResult(_0x580989,0xc9))[_0xc3a3('0x2b')](handleError(_0x580989,null));};exports[_0xc3a3('0x35')]=function(_0x5a6122,_0x37351c){if(_0x5a6122[_0xc3a3('0x5e')]['id']){delete _0x5a6122[_0xc3a3('0x5e')]['id'];}return db['FaxAccount'][_0xc3a3('0x5c')]({'where':{'id':_0x5a6122[_0xc3a3('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xc3a3('0x21')](handleEntityNotFound(_0x37351c,null))[_0xc3a3('0x21')](saveUpdates(_0x5a6122[_0xc3a3('0x5e')],null))[_0xc3a3('0x21')](respondWithResult(_0x37351c,null))['catch'](handleError(_0x37351c,null));};exports[_0xc3a3('0x36')]=function(_0x4c1340,_0x1f6c2e){return db[_0xc3a3('0x40')]['find']({'where':{'id':_0x4c1340['params']['id']}})[_0xc3a3('0x21')](handleEntityNotFound(_0x1f6c2e,null))[_0xc3a3('0x21')](removeEntity(_0x1f6c2e,null))[_0xc3a3('0x2b')](handleError(_0x1f6c2e,null));};exports['describe']=function(_0x431ec1,_0xd53636){return db[_0xc3a3('0x40')]['describe']()[_0xc3a3('0x21')](respondWithResult(_0xd53636,null))['catch'](handleError(_0xd53636,null));};exports['addDisposition']=function(_0xba3e52,_0x10c3f9,_0x2f05f1){if(_0xba3e52[_0xc3a3('0x5e')]['id']){delete _0xba3e52[_0xc3a3('0x5e')]['id'];}return db[_0xc3a3('0x40')][_0xc3a3('0x5c')]({'where':{'id':_0xba3e52[_0xc3a3('0x5b')]['id']}})[_0xc3a3('0x21')](handleEntityNotFound(_0x10c3f9,null))['then'](function(_0x93d77e){if(_0x93d77e){_0xba3e52[_0xc3a3('0x5e')]['FaxAccountId']=_0x93d77e['id'];return db['Disposition']['create'](_0xba3e52[_0xc3a3('0x5e')]);}})[_0xc3a3('0x21')](respondWithResult(_0x10c3f9,null))[_0xc3a3('0x2b')](handleError(_0x10c3f9,null));};exports[_0xc3a3('0x66')]=function(_0x7262a6,_0x2061c4,_0x5ceff9){var _0x503fbd={'raw':![],'where':{}};var _0x56e5fc={};var _0x3fc243={'count':0x0,'rows':[]};return db[_0xc3a3('0x40')]['findOne']({'where':{'id':_0x7262a6[_0xc3a3('0x5b')]['id']}})[_0xc3a3('0x21')](handleEntityNotFound(_0x2061c4,null))[_0xc3a3('0x21')](function(_0x37ceb4){if(_0x37ceb4){_0x56e5fc[_0xc3a3('0x45')]=_[_0xc3a3('0x47')](db[_0xc3a3('0x67')]['rawAttributes']);_0x56e5fc[_0xc3a3('0x46')]=_[_0xc3a3('0x47')](_0x7262a6[_0xc3a3('0x46')]);_0x56e5fc[_0xc3a3('0x48')]=_['intersection'](_0x56e5fc['model'],_0x56e5fc[_0xc3a3('0x46')]);_0x503fbd[_0xc3a3('0x4b')]=_['intersection'](_0x56e5fc['model'],qs[_0xc3a3('0x4a')](_0x7262a6[_0xc3a3('0x46')][_0xc3a3('0x4a')]));_0x503fbd['attributes']=_0x503fbd[_0xc3a3('0x4b')][_0xc3a3('0x4c')]?_0x503fbd[_0xc3a3('0x4b')]:_0x56e5fc[_0xc3a3('0x45')];if(!_0x7262a6[_0xc3a3('0x46')]['hasOwnProperty'](_0xc3a3('0x4d'))){_0x503fbd[_0xc3a3('0x31')]=qs[_0xc3a3('0x31')](_0x7262a6['query'][_0xc3a3('0x31')]);_0x503fbd['offset']=qs[_0xc3a3('0x2f')](_0x7262a6[_0xc3a3('0x46')][_0xc3a3('0x2f')]);}_0x503fbd[_0xc3a3('0x4e')]=qs[_0xc3a3('0x4f')](_0x7262a6['query']['sort']);_0x503fbd[_0xc3a3('0x51')]=qs[_0xc3a3('0x48')](_['pick'](_0x7262a6[_0xc3a3('0x46')],_0x56e5fc['filters']));_0x503fbd['where'][_0xc3a3('0x68')]=_0x37ceb4['id'];if(_0x7262a6[_0xc3a3('0x46')][_0xc3a3('0x50')]){_0x503fbd[_0xc3a3('0x51')]=_[_0xc3a3('0x52')](_0x503fbd[_0xc3a3('0x51')],{'$or':_[_0xc3a3('0x3f')](_0x503fbd[_0xc3a3('0x4b')],function(_0x52a89b){var _0x3bce5b={};_0x3bce5b[_0x52a89b]={'$like':'%'+_0x7262a6[_0xc3a3('0x46')][_0xc3a3('0x50')]+'%'};return _0x3bce5b;})});}_0x503fbd=_['merge']({},_0x503fbd,_0x7262a6[_0xc3a3('0x54')]);return db['Disposition'][_0xc3a3('0x55')]({'where':_0x503fbd[_0xc3a3('0x51')]})[_0xc3a3('0x21')](function(_0x417470){_0x3fc243[_0xc3a3('0x55')]=_0x417470;if(_0x7262a6['query'][_0xc3a3('0x56')]){_0x503fbd['include']=[{'all':!![]}];}return db[_0xc3a3('0x67')]['findAll'](_0x503fbd);})[_0xc3a3('0x21')](function(_0xd260e3){_0x3fc243[_0xc3a3('0x59')]=_0xd260e3;return _0x3fc243;});}})['then'](respondWithFilteredResult(_0x2061c4,_0x503fbd))[_0xc3a3('0x2b')](handleError(_0x2061c4,null));};exports['removeDispositions']=function(_0x36fd05,_0xfe6334,_0x29e553){return db[_0xc3a3('0x40')][_0xc3a3('0x5c')]({'where':{'id':_0x36fd05[_0xc3a3('0x5b')]['id']}})[_0xc3a3('0x21')](handleEntityNotFound(_0xfe6334,null))[_0xc3a3('0x21')](function(_0x3f25ed){if(_0x3f25ed){return _0x3f25ed[_0xc3a3('0x69')](_0x36fd05['query'][_0xc3a3('0x6a')]);}})[_0xc3a3('0x21')](respondWithStatusCode(_0xfe6334,null))['catch'](handleError(_0xfe6334,null));};exports['addAnswer']=function(_0x3a25fd,_0x46bb24,_0x49f7f8){if(_0x3a25fd[_0xc3a3('0x5e')]['id']){delete _0x3a25fd[_0xc3a3('0x5e')]['id'];}return db[_0xc3a3('0x40')][_0xc3a3('0x5c')]({'where':{'id':_0x3a25fd[_0xc3a3('0x5b')]['id']}})[_0xc3a3('0x21')](handleEntityNotFound(_0x46bb24,null))[_0xc3a3('0x21')](function(_0x3e88fc){if(_0x3e88fc){_0x3a25fd[_0xc3a3('0x5e')][_0xc3a3('0x68')]=_0x3e88fc['id'];return db[_0xc3a3('0x6b')][_0xc3a3('0x5d')](_0x3a25fd[_0xc3a3('0x5e')]);}})['then'](respondWithResult(_0x46bb24,null))['catch'](handleError(_0x46bb24,null));};exports[_0xc3a3('0x6c')]=function(_0x2c3265,_0x54327b,_0x384819){var _0x44c710={'raw':![],'where':{}};var _0x2fc31b={};var _0x17a7fc={'count':0x0,'rows':[]};return db[_0xc3a3('0x40')][_0xc3a3('0x6d')]({'where':{'id':_0x2c3265['params']['id']}})['then'](handleEntityNotFound(_0x54327b,null))[_0xc3a3('0x21')](function(_0x487a33){if(_0x487a33){_0x2fc31b['model']=_[_0xc3a3('0x47')](db['CannedAnswer']['rawAttributes']);_0x2fc31b[_0xc3a3('0x46')]=_[_0xc3a3('0x47')](_0x2c3265[_0xc3a3('0x46')]);_0x2fc31b['filters']=_[_0xc3a3('0x49')](_0x2fc31b['model'],_0x2fc31b['query']);_0x44c710[_0xc3a3('0x4b')]=_[_0xc3a3('0x49')](_0x2fc31b['model'],qs[_0xc3a3('0x4a')](_0x2c3265['query']['fields']));_0x44c710['attributes']=_0x44c710['attributes'][_0xc3a3('0x4c')]?_0x44c710['attributes']:_0x2fc31b[_0xc3a3('0x45')];if(!_0x2c3265[_0xc3a3('0x46')][_0xc3a3('0x6e')]('nolimit')){_0x44c710[_0xc3a3('0x31')]=qs[_0xc3a3('0x31')](_0x2c3265[_0xc3a3('0x46')][_0xc3a3('0x31')]);_0x44c710[_0xc3a3('0x2f')]=qs['offset'](_0x2c3265['query'][_0xc3a3('0x2f')]);}_0x44c710['order']=qs[_0xc3a3('0x4f')](_0x2c3265['query'][_0xc3a3('0x4f')]);_0x44c710[_0xc3a3('0x51')]=qs['filters'](_['pick'](_0x2c3265[_0xc3a3('0x46')],_0x2fc31b['filters']));_0x44c710[_0xc3a3('0x51')][_0xc3a3('0x68')]=_0x487a33['id'];if(_0x2c3265[_0xc3a3('0x46')][_0xc3a3('0x50')]){_0x44c710[_0xc3a3('0x51')]=_['merge'](_0x44c710[_0xc3a3('0x51')],{'$or':_['map'](_0x44c710[_0xc3a3('0x4b')],function(_0x3063d8){var _0x108d59={};_0x108d59[_0x3063d8]={'$like':'%'+_0x2c3265[_0xc3a3('0x46')][_0xc3a3('0x50')]+'%'};return _0x108d59;})});}_0x44c710=_[_0xc3a3('0x52')]({},_0x44c710,_0x2c3265[_0xc3a3('0x54')]);return db[_0xc3a3('0x6b')][_0xc3a3('0x55')]({'where':_0x44c710[_0xc3a3('0x51')]})[_0xc3a3('0x21')](function(_0x23cf65){_0x17a7fc['count']=_0x23cf65;if(_0x2c3265['query'][_0xc3a3('0x56')]){_0x44c710[_0xc3a3('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc3a3('0x58')](_0x44c710);})[_0xc3a3('0x21')](function(_0x386e79){_0x17a7fc[_0xc3a3('0x59')]=_0x386e79;return _0x17a7fc;});}})[_0xc3a3('0x21')](respondWithFilteredResult(_0x54327b,_0x44c710))[_0xc3a3('0x2b')](handleError(_0x54327b,null));};exports[_0xc3a3('0x6f')]=function(_0x3aabeb,_0x2c7b1b,_0x1f849c){return db[_0xc3a3('0x40')][_0xc3a3('0x5c')]({'where':{'id':_0x3aabeb[_0xc3a3('0x5b')]['id']}})[_0xc3a3('0x21')](handleEntityNotFound(_0x2c7b1b,null))[_0xc3a3('0x21')](function(_0x59ec25){if(_0x59ec25){return _0x59ec25['removeAnswers'](_0x3aabeb[_0xc3a3('0x46')][_0xc3a3('0x6a')]);}})[_0xc3a3('0x21')](respondWithStatusCode(_0x2c7b1b,null))['catch'](handleError(_0x2c7b1b,null));};exports[_0xc3a3('0x70')]=function(_0x4ca0ed,_0x1a44c5,_0x35adbc){return db[_0xc3a3('0x71')]['find']({'where':{'id':_0x4ca0ed[_0xc3a3('0x5b')]['id']}})[_0xc3a3('0x21')](handleEntityNotFound(_0x1a44c5,null))[_0xc3a3('0x21')](function(_0x305af6){if(_0x305af6){return _0x305af6[_0xc3a3('0x70')](_0x4ca0ed[_0xc3a3('0x5e')][_0xc3a3('0x6a')],_[_0xc3a3('0x72')](_0x4ca0ed[_0xc3a3('0x5e')],[_0xc3a3('0x6a'),'id'])||{});}})[_0xc3a3('0x21')](respondWithResult(_0x1a44c5,null))[_0xc3a3('0x2b')](handleError(_0x1a44c5,null));};exports['getInteractions']=function(_0x197b88,_0xf1620a,_0x3b7d9c){var _0x4fd0b7={'raw':![],'where':{}};var _0x14fcd6={};var _0x48d00c={'count':0x0,'rows':[]};return db[_0xc3a3('0x40')][_0xc3a3('0x6d')]({'where':{'id':_0x197b88[_0xc3a3('0x5b')]['id']}})[_0xc3a3('0x21')](handleEntityNotFound(_0xf1620a,null))[_0xc3a3('0x21')](function(_0xb295af){if(_0xb295af){_0x14fcd6[_0xc3a3('0x45')]=_['keys'](db[_0xc3a3('0x71')][_0xc3a3('0x41')]);_0x14fcd6[_0xc3a3('0x46')]=_['keys'](_0x197b88[_0xc3a3('0x46')]);_0x14fcd6[_0xc3a3('0x48')]=_['intersection'](_0x14fcd6[_0xc3a3('0x45')],_0x14fcd6[_0xc3a3('0x46')]);_0x4fd0b7['attributes']=_[_0xc3a3('0x49')](_0x14fcd6['model'],qs[_0xc3a3('0x4a')](_0x197b88['query'][_0xc3a3('0x4a')]));_0x4fd0b7[_0xc3a3('0x4b')]=_0x4fd0b7[_0xc3a3('0x4b')][_0xc3a3('0x4c')]?_0x4fd0b7[_0xc3a3('0x4b')]:_0x14fcd6[_0xc3a3('0x45')];if(!_0x197b88[_0xc3a3('0x46')][_0xc3a3('0x6e')](_0xc3a3('0x4d'))){_0x4fd0b7['limit']=qs['limit'](_0x197b88[_0xc3a3('0x46')]['limit']);_0x4fd0b7[_0xc3a3('0x2f')]=qs[_0xc3a3('0x2f')](_0x197b88[_0xc3a3('0x46')][_0xc3a3('0x2f')]);}_0x4fd0b7[_0xc3a3('0x4e')]=qs[_0xc3a3('0x4f')](_0x197b88[_0xc3a3('0x46')][_0xc3a3('0x4f')]);_0x4fd0b7['where']=qs[_0xc3a3('0x48')](_['pick'](_0x197b88[_0xc3a3('0x46')],_0x14fcd6[_0xc3a3('0x48')]));_0x4fd0b7[_0xc3a3('0x51')][_0xc3a3('0x68')]=_0xb295af['id'];if(_0x197b88[_0xc3a3('0x46')][_0xc3a3('0x50')]){_0x4fd0b7[_0xc3a3('0x51')]=_[_0xc3a3('0x52')](_0x4fd0b7['where'],{'$or':_[_0xc3a3('0x3f')](_0x4fd0b7[_0xc3a3('0x4b')],function(_0x1fd99d){var _0x36e0de={};_0x36e0de[_0x1fd99d]={'$like':'%'+_0x197b88['query'][_0xc3a3('0x50')]+'%'};return _0x36e0de;})});}_0x4fd0b7=_[_0xc3a3('0x52')]({},_0x4fd0b7,_0x197b88['options']);return db[_0xc3a3('0x71')][_0xc3a3('0x55')]({'where':_0x4fd0b7['where']})['then'](function(_0x5de84f){_0x48d00c[_0xc3a3('0x55')]=_0x5de84f;if(_0x197b88['query'][_0xc3a3('0x56')]){_0x4fd0b7[_0xc3a3('0x57')]=[{'model':db[_0xc3a3('0x73')],'as':_0xc3a3('0x74'),'required':![]},{'model':db[_0xc3a3('0x75')],'as':'Owner','attributes':[_0xc3a3('0x3b'),_0xc3a3('0x76'),_0xc3a3('0x77')],'required':![]},{'model':db[_0xc3a3('0x78')],'as':_0xc3a3('0x79'),'attributes':['id',_0xc3a3('0x3b'),_0xc3a3('0x7a')],'where':_0x197b88[_0xc3a3('0x46')][_0xc3a3('0x7b')]?{'id':_0x197b88[_0xc3a3('0x46')][_0xc3a3('0x7b')]}:undefined,'required':_0x197b88[_0xc3a3('0x46')][_0xc3a3('0x7b')]?!![]:![]}];}return db[_0xc3a3('0x71')][_0xc3a3('0x58')](_0x4fd0b7);})['then'](function(_0xedd963){_0x48d00c[_0xc3a3('0x59')]=_0xedd963;return _0x48d00c;});}})[_0xc3a3('0x21')](respondWithFilteredResult(_0xf1620a,_0x4fd0b7))[_0xc3a3('0x2b')](handleError(_0xf1620a,null));};exports[_0xc3a3('0x7c')]=function(_0x485c30,_0x157627){var _0x854e26=_0x485c30[_0xc3a3('0x5b')]['id'];var _0x18af71=_0x485c30[_0xc3a3('0x5e')];var _0x53f849=0xc8;var _0x468f84=null;return db[_0xc3a3('0x7d')][_0xc3a3('0x7e')]({'isolationLevel':db[_0xc3a3('0x7d')][_0xc3a3('0x7f')][_0xc3a3('0x80')][_0xc3a3('0x81')]},function(_0xc8f96){return db[_0xc3a3('0x40')][_0xc3a3('0x6d')]({'where':{'id':_0x854e26},'transaction':_0xc8f96})['then'](function(_0x16a7e4){if(_0x16a7e4){return db['FaxApplication'][_0xc3a3('0x36')]({'where':{'FaxAccountId':_0x854e26},'transaction':_0xc8f96})[_0xc3a3('0x21')](function(){var _0x283713=_[_0xc3a3('0x3f')](_0x18af71,function(_0x9124f7){_0x9124f7[_0xc3a3('0x68')]=_0x854e26;return _0x9124f7;});return db[_0xc3a3('0x82')][_0xc3a3('0x83')](_0x283713,{'transaction':_0xc8f96});});}else{_0x53f849=0x194;_0x468f84=[];}});})['then'](function(){if(_0x53f849!==0x194){return db[_0xc3a3('0x82')]['findAndCountAll']({'where':{'FaxAccountId':_0x854e26},'order':'priority'})['then'](function(_0x35c7a9){_0x468f84=_0x35c7a9;});}})[_0xc3a3('0x2b')](function(_0x400626){_0x53f849=0x1f4;logger[_0xc3a3('0x26')](_0x400626[_0xc3a3('0x3a')]);if(_0x400626[_0xc3a3('0x3b')]){delete _0x400626[_0xc3a3('0x3b')];}_0x468f84=_0x400626;})['finally'](function(){if(_0x468f84===null){_0x157627['sendStatus'](_0x53f849);}else{if(_0x53f849===0x1f4){_0x157627[_0xc3a3('0x2d')](_0x53f849)[_0xc3a3('0x3c')](_0x468f84);}else{_0x157627[_0xc3a3('0x2d')](_0x53f849)[_0xc3a3('0x2e')](_0x468f84);}}});};exports[_0xc3a3('0x84')]=function(_0xe5abc4,_0x51bcc9,_0x5ac431){var _0x58846c={};var _0x465297={};var _0x36214c;var _0x4011da;return db['FaxAccount'][_0xc3a3('0x6d')]({'where':{'id':_0xe5abc4[_0xc3a3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x51bcc9,null))[_0xc3a3('0x21')](function(_0x6549d4){if(_0x6549d4){_0x36214c=_0x6549d4;_0x465297[_0xc3a3('0x45')]=_['keys'](db[_0xc3a3('0x82')][_0xc3a3('0x41')]);_0x465297[_0xc3a3('0x46')]=_[_0xc3a3('0x47')](_0xe5abc4[_0xc3a3('0x46')]);_0x465297['filters']=_['intersection'](_0x465297['model'],_0x465297[_0xc3a3('0x46')]);_0x58846c[_0xc3a3('0x4b')]=_[_0xc3a3('0x49')](_0x465297[_0xc3a3('0x45')],qs['fields'](_0xe5abc4['query'][_0xc3a3('0x4a')]));_0x58846c[_0xc3a3('0x4b')]=_0x58846c[_0xc3a3('0x4b')]['length']?_0x58846c[_0xc3a3('0x4b')]:_0x465297[_0xc3a3('0x45')];_0x58846c[_0xc3a3('0x4e')]=qs[_0xc3a3('0x4f')](_0xe5abc4['query'][_0xc3a3('0x4f')]);_0x58846c['where']=qs[_0xc3a3('0x48')](_[_0xc3a3('0x85')](_0xe5abc4[_0xc3a3('0x46')],_0x465297[_0xc3a3('0x48')]));if(_0xe5abc4[_0xc3a3('0x46')][_0xc3a3('0x50')]){_0x58846c[_0xc3a3('0x51')]=_['merge'](_0x58846c[_0xc3a3('0x51')],{'$or':_[_0xc3a3('0x3f')](_0x58846c['attributes'],function(_0x227b89){var _0x4bc08a={};_0x4bc08a[_0x227b89]={'$like':'%'+_0xe5abc4[_0xc3a3('0x46')][_0xc3a3('0x50')]+'%'};return _0x4bc08a;})});}_0x58846c=_['merge']({},_0x58846c,_0xe5abc4[_0xc3a3('0x54')]);return _0x36214c['getApplications'](_0x58846c);}})[_0xc3a3('0x21')](function(_0x189879){if(_0x189879){_0x4011da=_0x189879[_0xc3a3('0x4c')];if(!_0xe5abc4['query']['hasOwnProperty']('nolimit')){_0x58846c['limit']=qs['limit'](_0xe5abc4['query'][_0xc3a3('0x31')]);_0x58846c[_0xc3a3('0x2f')]=qs[_0xc3a3('0x2f')](_0xe5abc4[_0xc3a3('0x46')][_0xc3a3('0x2f')]);}return _0x36214c['getApplications'](_0x58846c);}})[_0xc3a3('0x21')](function(_0x3a51c0){if(_0x3a51c0){return _0x3a51c0?{'count':_0x4011da,'rows':_0x3a51c0}:null;}})['then'](respondWithResult(_0x51bcc9,null))[_0xc3a3('0x2b')](handleError(_0x51bcc9,null));};function Extension(_0x442d70,_0xd31f83,_0x31bb93,_0x1b966d){this[_0xc3a3('0x86')]=_0xc3a3('0x87');this[_0xc3a3('0x88')]=_0x442d70[_0xc3a3('0x89')];this[_0xc3a3('0x8a')]=_0x1b966d;this[_0xc3a3('0x43')]='system';this['description']=_0xc3a3('0x8b');this[_0xc3a3('0x68')]=_0x442d70['id'];this[_0xc3a3('0x8c')]=_0xd31f83;this[_0xc3a3('0x8d')]=_0x31bb93;}function createExtensionsReciveFax(_0x1c8aaa){var _0xcabb92=0x1;var _0x39fec2=[];_0x39fec2[_0xc3a3('0x8e')](new Extension(_0x1c8aaa,_0xcabb92,'',_0xc3a3('0x8f')));_0xcabb92+=0x1;_0x39fec2[_0xc3a3('0x8e')](new Extension(_0x1c8aaa,_0xcabb92,_0xc3a3('0x90'),_0xc3a3('0x91')));_0xcabb92+=0x1;for(var _0x451b7e in _0x1c8aaa){if(_0x1c8aaa[_0xc3a3('0x6e')](_0x451b7e)&&(_0x451b7e===_0xc3a3('0x92')||_0x451b7e===_0xc3a3('0x89')||_0x451b7e===_0xc3a3('0x93')||_0x451b7e===_0xc3a3('0x94')||_0x451b7e===_0xc3a3('0x95')||_0x451b7e===_0xc3a3('0x96')||_0x451b7e==='minrate'||_0x451b7e===_0xc3a3('0x97')||_0x451b7e===_0xc3a3('0x98'))){_0x39fec2[_0xc3a3('0x8e')](new Extension(_0x1c8aaa,_0xcabb92,'FAXOPT('+_0x451b7e+')='+_0x1c8aaa[_0x451b7e],_0xc3a3('0x91')));_0xcabb92+=0x1;}}_0x39fec2[_0xc3a3('0x8e')](new Extension(_0x1c8aaa,_0xcabb92,'6',_0xc3a3('0x99')));_0xcabb92+=0x1;_0x39fec2[_0xc3a3('0x8e')](new Extension(_0x1c8aaa,_0xcabb92,'/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',_0xc3a3('0x9a')));_0xcabb92=0x0;return _0x39fec2;}exports['addAccountApplications']=function(_0x264b8c,_0x294d57,_0x53f67f){var _0x4f4217;return db[_0xc3a3('0x7d')]['transaction'](function(_0x4fe5cb){return db['FaxAccount']['create'](_0x264b8c[_0xc3a3('0x5e')],{'transaction':_0x4fe5cb})['then'](function(_0x3ed253){_0x4f4217=_0x3ed253[_0xc3a3('0x37')]({'plain':!![]});return db['VoiceExtension'][_0xc3a3('0x83')](createExtensionsReciveFax(_0x4f4217),{'transaction':_0x4fe5cb});});})[_0xc3a3('0x21')](function(){return _0x4f4217;})[_0xc3a3('0x21')](respondWithResult(_0x294d57,null))[_0xc3a3('0x2b')](handleError(_0x294d57,null));};exports[_0xc3a3('0x9b')]=function(_0x2356e1,_0x5e308a,_0x24c512){var _0x1a695d;return db[_0xc3a3('0x7d')][_0xc3a3('0x7e')](function(_0x42cb17){return db[_0xc3a3('0x40')][_0xc3a3('0x35')](_0x2356e1[_0xc3a3('0x5e')],{'where':{'id':_0x2356e1[_0xc3a3('0x5e')]['id']},'transaction':_0x42cb17})[_0xc3a3('0x21')](function(_0x17e9ae){return db[_0xc3a3('0x9c')][_0xc3a3('0x36')]({'where':{'FaxAccountId':_0x2356e1['body']['id']},'transaction':_0x42cb17})['then'](function(_0x45c43e){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x2356e1[_0xc3a3('0x5e')],[_0xc3a3('0x9d'),_0xc3a3('0x44'),_0xc3a3('0x9e'),_0xc3a3('0x9f'),_0xc3a3('0xa0'),_0xc3a3('0xa1')])),{'transaction':_0x42cb17});});});})[_0xc3a3('0x21')](function(){return db[_0xc3a3('0x40')][_0xc3a3('0xa2')](_0x2356e1[_0xc3a3('0x5e')]['id']);})[_0xc3a3('0x21')](respondWithResult(_0x5e308a,null))['catch'](handleError(_0x5e308a,null));};exports['getMessages']=function(_0x4a17b7,_0x2e0484,_0x45601e){var _0x3f8261={'raw':!![],'where':{}};var _0x4d1cea={};var _0x2ff2bf={'count':0x0,'rows':[]};return db[_0xc3a3('0x40')]['findOne']({'where':{'id':_0x4a17b7['params']['id']}})['then'](handleEntityNotFound(_0x2e0484,null))[_0xc3a3('0x21')](function(_0x318ef3){if(_0x318ef3){_0x4d1cea[_0xc3a3('0x45')]=_[_0xc3a3('0x47')](db[_0xc3a3('0xa3')]['rawAttributes']);_0x4d1cea[_0xc3a3('0x46')]=_[_0xc3a3('0x47')](_0x4a17b7[_0xc3a3('0x46')]);_0x4d1cea[_0xc3a3('0x48')]=_[_0xc3a3('0x49')](_0x4d1cea['model'],_0x4d1cea['query']);_0x3f8261[_0xc3a3('0x4b')]=_[_0xc3a3('0x49')](_0x4d1cea[_0xc3a3('0x45')],qs['fields'](_0x4a17b7[_0xc3a3('0x46')][_0xc3a3('0x4a')]));_0x3f8261[_0xc3a3('0x4b')]=_0x3f8261['attributes'][_0xc3a3('0x4c')]?_0x3f8261[_0xc3a3('0x4b')]:_0x4d1cea['model'];if(!_0x4a17b7[_0xc3a3('0x46')][_0xc3a3('0x6e')](_0xc3a3('0x4d'))){_0x3f8261[_0xc3a3('0x31')]=qs[_0xc3a3('0x31')](_0x4a17b7[_0xc3a3('0x46')][_0xc3a3('0x31')]);_0x3f8261['offset']=qs[_0xc3a3('0x2f')](_0x4a17b7[_0xc3a3('0x46')][_0xc3a3('0x2f')]);}_0x3f8261[_0xc3a3('0x4e')]=qs[_0xc3a3('0x4f')](_0x4a17b7[_0xc3a3('0x46')][_0xc3a3('0x4f')]);_0x3f8261[_0xc3a3('0x51')]=qs['filters'](_['pick'](_0x4a17b7[_0xc3a3('0x46')],_0x4d1cea['filters']));_0x3f8261[_0xc3a3('0x51')][_0xc3a3('0x68')]=_0x318ef3['id'];if(_0x4a17b7['query']['filter']){_0x3f8261[_0xc3a3('0x51')]=_['merge'](_0x3f8261[_0xc3a3('0x51')],{'$or':_[_0xc3a3('0x3f')](_0x3f8261[_0xc3a3('0x4b')],function(_0x354f11){var _0x15187a={};_0x15187a[_0x354f11]={'$like':'%'+_0x4a17b7[_0xc3a3('0x46')][_0xc3a3('0x50')]+'%'};return _0x15187a;})});}if(_0x4a17b7['query']['$gte']){var _0x7b9664=_0x4a17b7[_0xc3a3('0x46')][_0xc3a3('0xa4')]['split'](',');var _0x3c5057={};_0x3c5057[_0x7b9664[0x0]]={'$gte':moment(_0x7b9664[0x1])[_0xc3a3('0xa5')](_0xc3a3('0xa6'))};_0x3f8261['where']=_['merge'](_0x3f8261[_0xc3a3('0x51')],_0x3c5057);}_0x3f8261=_['merge']({},_0x3f8261,_0x4a17b7[_0xc3a3('0x54')]);return db[_0xc3a3('0xa3')]['count']({'where':_0x3f8261[_0xc3a3('0x51')]})[_0xc3a3('0x21')](function(_0x99e310){_0x2ff2bf[_0xc3a3('0x55')]=_0x99e310;if(_0x4a17b7['query'][_0xc3a3('0x56')]){_0x3f8261[_0xc3a3('0x57')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x3f8261);})[_0xc3a3('0x21')](function(_0x424678){_0x2ff2bf[_0xc3a3('0x59')]=_0x424678;return _0x2ff2bf;});}})[_0xc3a3('0x21')](respondWithFilteredResult(_0x2e0484,_0x3f8261))[_0xc3a3('0x2b')](handleError(_0x2e0484,null));};exports[_0xc3a3('0x3c')]=function(_0x28ba95,_0x5ee103,_0x441a7a){var _0xc63759,_0x18d343={},_0x7b34a1;if(_0x28ba95[_0xc3a3('0x5e')]['to']){_0x7b34a1=_0x28ba95[_0xc3a3('0x5e')]['to'][0x0];}return db[_0xc3a3('0x40')][_0xc3a3('0x5c')]({'where':{'id':_0x28ba95[_0xc3a3('0x5b')]['id']},'include':[{'model':db[_0xc3a3('0xa7')],'as':_0xc3a3('0xa8'),'include':[{'model':db[_0xc3a3('0x73')],'as':_0xc3a3('0xa9'),'where':{'fax':_0x7b34a1},'limit':0x1,'order':[[_0xc3a3('0x9f'),_0xc3a3('0xaa')]]}]}]})[_0xc3a3('0x21')](handleEntityNotFound(_0x5ee103,null))['then'](function(_0x44c3ea){_0xc63759=_0x44c3ea;if(_0x28ba95[_0xc3a3('0x5e')][_0xc3a3('0xab')]&&_0x28ba95[_0xc3a3('0x5e')]['attachments'][_0xc3a3('0x4c')]){for(var _0x53399c=0x0;_0x53399c<_0x28ba95[_0xc3a3('0x5e')][_0xc3a3('0xab')][_0xc3a3('0x4c')];_0x53399c+=0x1){_0x28ba95[_0xc3a3('0x5e')]['attachments'][_0x53399c]={'filename':_0x28ba95['body']['attachments'][_0x53399c][_0xc3a3('0x3b')],'id':_0x28ba95[_0xc3a3('0x5e')][_0xc3a3('0xab')][_0x53399c]['id'],'path':path[_0xc3a3('0xac')](config['root'],_0xc3a3('0xad'),_0x28ba95['body'][_0xc3a3('0xab')][_0x53399c][_0xc3a3('0xae')])};}}return respondWithRpcPromise('CheckAfterSend',_0xc3a3('0xaf'),{'FaxAccountId':_[_0xc3a3('0xb0')](_0x28ba95[_0xc3a3('0x5b')]['id'])?undefined:_0x28ba95[_0xc3a3('0x5b')]['id'],'path':_[_0xc3a3('0xb0')](_0x28ba95[_0xc3a3('0x5e')]['attachments'][0x0][_0xc3a3('0xb1')])?undefined:_0x28ba95['body']['attachments'][0x0][_0xc3a3('0xb1')],'fax':_[_0xc3a3('0xb0')](_0x28ba95[_0xc3a3('0x5e')]['to'][0x0])?undefined:_0x28ba95[_0xc3a3('0x5e')]['to'][0x0]},client9002);})[_0xc3a3('0x21')](function(){if(_0xc63759){if(_[_0xc3a3('0xb0')](_0x28ba95[_0xc3a3('0x5e')]['from'])){_0x28ba95['body']['from']=util[_0xc3a3('0xa5')]('\x22%s\x22\x20<%s>',_0xc63759['name'],_0xc63759['fax']);}if(_0xc63759[_0xc3a3('0xa8')]){if(_0xc63759[_0xc3a3('0xa8')][_0xc3a3('0xa9')]['length']){return _0xc63759['List'][_0xc3a3('0xa9')][0x0];}else{return db[_0xc3a3('0x73')][_0xc3a3('0x5d')](_[_0xc3a3('0xb2')](_0x28ba95[_0xc3a3('0x5e')],{'firstName':_0x28ba95[_0xc3a3('0x5e')]['to'][0x0],'phone':_0x28ba95['body']['to'][0x0],'fax':_0x28ba95[_0xc3a3('0x5e')]['to'][0x0],'ListId':_0xc63759[_0xc3a3('0xa1')]}));}}else{throw new Error(_0xc3a3('0xb3'));}}else{throw new Error(_0xc3a3('0xb4'));}})['then'](function(_0x1452e2){if(_0x1452e2){return db[_0xc3a3('0x71')][_0xc3a3('0x5c')]({'where':{'ContactId':_0x1452e2['id'],'closed':![],'FaxAccountId':_0xc63759['id']}})[_0xc3a3('0x21')](function(_0x4f4995){if(_0x4f4995){return[_0x4f4995,![]];}return db[_0xc3a3('0x71')]['create']({'UserId':_0x28ba95['user']['id'],'ContactId':_0x1452e2['id'],'FaxAccountId':_0xc63759['id'],'fax':_0x28ba95[_0xc3a3('0x5e')]['to'][0x0],'firstMsgDirection':_0xc3a3('0xb5'),'Messages':[_['merge'](_0x28ba95[_0xc3a3('0x5e')],{'read':![],'body':_0x28ba95[_0xc3a3('0x5e')][_0xc3a3('0xab')][0x0][_0xc3a3('0xb6')],'FaxAccountId':_0xc63759['id'],'UserId':_0x28ba95['user']['id'],'ContactId':_0x1452e2['id'],'AttachmentId':_0x28ba95[_0xc3a3('0x5e')][_0xc3a3('0xab')][0x0]['id']})]},{'include':[{'model':db[_0xc3a3('0xa3')],'as':_0xc3a3('0xb7')}]})['then'](function(_0x43663b){return[_0x43663b,!![]];});});}else{throw new Error(_0xc3a3('0xb8'));}})[_0xc3a3('0xb9')](function(_0x2aef7d,_0x2ef0a7){if(_0x2ef0a7){return _0x2aef7d;}return db['FaxMessage'][_0xc3a3('0x5d')]({'direction':_0xc3a3('0xb5'),'read':![],'body':_0x28ba95[_0xc3a3('0x5e')][_0xc3a3('0xab')][0x0][_0xc3a3('0xb6')],'FaxAccountId':_0xc63759['id'],'FaxInteractionId':_0x2aef7d['id'],'UserId':_0x28ba95[_0xc3a3('0x5f')]['id'],'ContactId':_0x2aef7d[_0xc3a3('0xba')],'AttachmentId':_0x28ba95[_0xc3a3('0x5e')][_0xc3a3('0xab')][0x0]['id']})[_0xc3a3('0x21')](function(_0x5f8b6b){_0x2aef7d[_0xc3a3('0xbb')][_0xc3a3('0xb7')]=[];_0x2aef7d[_0xc3a3('0xbb')]['Messages'][_0xc3a3('0x8e')](_0x5f8b6b[_0xc3a3('0xbb')]);return _0x2aef7d;});})['then'](function(_0x3260ea){respondWithRpcPromise(_0xc3a3('0xbc'),_0xc3a3('0xbc'),{'FaxAccountId':_[_0xc3a3('0xb0')](_0x28ba95['params']['id'])?undefined:_0x28ba95[_0xc3a3('0x5b')]['id'],'path':_[_0xc3a3('0xb0')](_0x28ba95[_0xc3a3('0x5e')]['attachments'][0x0][_0xc3a3('0xb1')])?undefined:_0x28ba95[_0xc3a3('0x5e')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x28ba95[_0xc3a3('0x5e')]['to'][0x0])?undefined:_0x28ba95[_0xc3a3('0x5e')]['to'][0x0],'AttachmentId':_0x28ba95[_0xc3a3('0x5e')]['attachments'][0x0]['id']},client9002)[_0xc3a3('0x21')](function(_0x301281){logger[_0xc3a3('0x2a')](_0xc3a3('0xbd'),_0x301281);})[_0xc3a3('0x2b')](function(_0x62d8ae){logger[_0xc3a3('0x2a')]('SendFaxRpc,\x20%s',_0x62d8ae);});return _0x3260ea;})[_0xc3a3('0x21')](respondWithResult(_0x5ee103,null))[_0xc3a3('0x2b')](handleError(_0x5ee103,null));};exports[_0xc3a3('0xbe')]=function(_0x299777,_0xd2bcd,_0x3efa2f){return db[_0xc3a3('0x40')][_0xc3a3('0x5c')]({'where':{'id':_0x299777[_0xc3a3('0x5b')]['id']}})['then'](handleEntityNotFound(_0xd2bcd,null))[_0xc3a3('0x21')](function(_0x1031c0){if(_0x1031c0){return _0x1031c0[_0xc3a3('0xbe')](_0x299777[_0xc3a3('0x5e')][_0xc3a3('0x6a')],_['omit'](_0x299777[_0xc3a3('0x5e')],['ids','id'])||{})['spread'](function(_0x1f4857){for(var _0x3cf7b9=0x0;_0x3cf7b9<_0x299777[_0xc3a3('0x5e')]['ids'][_0xc3a3('0x4c')];_0x3cf7b9+=0x1){socket[_0xc3a3('0xbf')](_0xc3a3('0xc0'),{'UserId':Number(_0x299777[_0xc3a3('0x5e')][_0xc3a3('0x6a')][_0x3cf7b9]),'FaxAccountId':Number(_0x299777[_0xc3a3('0x5b')]['id'])});}return _0x1f4857;});}})[_0xc3a3('0x21')](respondWithResult(_0xd2bcd,null))[_0xc3a3('0x2b')](handleError(_0xd2bcd,null));};exports[_0xc3a3('0xc1')]=function(_0x4dedd8,_0x20a894,_0x33c186){return db[_0xc3a3('0x40')][_0xc3a3('0x5c')]({'where':{'id':_0x4dedd8[_0xc3a3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x20a894,null))[_0xc3a3('0x21')](function(_0x29d1f6){if(_0x29d1f6){return _0x29d1f6[_0xc3a3('0xc1')](_0x4dedd8['query'][_0xc3a3('0x6a')])[_0xc3a3('0x21')](function(){if(_[_0xc3a3('0xc2')](_0x4dedd8[_0xc3a3('0x46')][_0xc3a3('0x6a')])){for(var _0x7f9e33=0x0;_0x7f9e33<_0x4dedd8[_0xc3a3('0x46')]['ids'][_0xc3a3('0x4c')];_0x7f9e33+=0x1){socket[_0xc3a3('0xbf')](_0xc3a3('0xc3'),{'UserId':Number(_0x4dedd8[_0xc3a3('0x46')][_0xc3a3('0x6a')][_0x7f9e33]),'FaxAccountId':Number(_0x4dedd8[_0xc3a3('0x5b')]['id'])});}}else{socket[_0xc3a3('0xbf')](_0xc3a3('0xc3'),{'UserId':Number(_0x4dedd8['query'][_0xc3a3('0x6a')]),'FaxAccountId':Number(_0x4dedd8[_0xc3a3('0x5b')]['id'])});}});}})[_0xc3a3('0x21')](respondWithStatusCode(_0x20a894,null))[_0xc3a3('0x2b')](handleError(_0x20a894,null));};exports['getAgents']=function(_0x4f3ced,_0x2ba33d,_0x17417e){var _0x54095a={};var _0x2c13f0={};var _0x356f46;var _0x5935d8;return db['FaxAccount'][_0xc3a3('0x6d')]({'where':{'id':_0x4f3ced[_0xc3a3('0x5b')]['id']}})[_0xc3a3('0x21')](handleEntityNotFound(_0x2ba33d,null))[_0xc3a3('0x21')](function(_0x53db9c){if(_0x53db9c){_0x356f46=_0x53db9c;_0x2c13f0['model']=_[_0xc3a3('0x47')](db[_0xc3a3('0x75')][_0xc3a3('0x41')]);_0x2c13f0[_0xc3a3('0x46')]=_[_0xc3a3('0x47')](_0x4f3ced[_0xc3a3('0x46')]);_0x2c13f0['filters']=_['intersection'](_0x2c13f0[_0xc3a3('0x45')],_0x2c13f0[_0xc3a3('0x46')]);_0x54095a[_0xc3a3('0x4b')]=_[_0xc3a3('0x49')](_0x2c13f0[_0xc3a3('0x45')],qs[_0xc3a3('0x4a')](_0x4f3ced['query'][_0xc3a3('0x4a')]));_0x54095a[_0xc3a3('0x4b')]=_0x54095a[_0xc3a3('0x4b')]['length']?_0x54095a[_0xc3a3('0x4b')]:_0x2c13f0[_0xc3a3('0x45')];_0x54095a[_0xc3a3('0x4e')]=qs['sort'](_0x4f3ced[_0xc3a3('0x46')][_0xc3a3('0x4f')]);_0x54095a[_0xc3a3('0x51')]=qs['filters'](_['pick'](_0x4f3ced[_0xc3a3('0x46')],_0x2c13f0[_0xc3a3('0x48')]));if(_0x4f3ced[_0xc3a3('0x46')][_0xc3a3('0x50')]){_0x54095a['where']=_[_0xc3a3('0x52')](_0x54095a[_0xc3a3('0x51')],{'$or':_[_0xc3a3('0x3f')](_0x54095a[_0xc3a3('0x4b')],function(_0x14bdbf){var _0x4c23d2={};_0x4c23d2[_0x14bdbf]={'$like':'%'+_0x4f3ced['query']['filter']+'%'};return _0x4c23d2;})});}_0x54095a=_['merge']({},_0x54095a,_0x4f3ced[_0xc3a3('0x54')]);return _0x356f46[_0xc3a3('0xc4')](_0x54095a);}})[_0xc3a3('0x21')](function(_0x56334c){if(_0x56334c){_0x5935d8=_0x56334c['length'];if(!_0x4f3ced['query'][_0xc3a3('0x6e')]('nolimit')){_0x54095a[_0xc3a3('0x31')]=qs['limit'](_0x4f3ced[_0xc3a3('0x46')][_0xc3a3('0x31')]);_0x54095a['offset']=qs[_0xc3a3('0x2f')](_0x4f3ced[_0xc3a3('0x46')][_0xc3a3('0x2f')]);}return _0x356f46[_0xc3a3('0xc4')](_0x54095a);}})['then'](function(_0x3d74b7){if(_0x3d74b7){return _0x3d74b7?{'count':_0x5935d8,'rows':_0x3d74b7}:null;}})['then'](respondWithResult(_0x2ba33d,null))[_0xc3a3('0x2b')](handleError(_0x2ba33d,null));}; \ No newline at end of file +var _0xb020=['SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./faxAccount.socket','register','http','request','info','request\x20sent','debug','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','map','FaxAccount','rawAttributes','fieldName','model','query','filters','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','findAll','catch','show','params','mandatoryDispositionPause','keys','intersection','fields','includeAll','options','find','create','user','get','role','userProfileId','autoAssociation','update','body','describe','addDisposition','FaxAccountId','Disposition','findOne','order','include','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','sequelize','transaction','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','appdata','push','Answer','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','FAXOPT(','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','key','createdAt','updatedAt','TrunkId','findById','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId','dataValues'];(function(_0x434174,_0x389064){var _0xb78d1=function(_0x37fdb1){while(--_0x37fdb1){_0x434174['push'](_0x434174['shift']());}};_0xb78d1(++_0x389064);}(_0xb020,0xcb));var _0x0b02=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xb020[_0x44a64f];return _0x52024b;};'use strict';var emlformat=require(_0x0b02('0x0'));var rimraf=require(_0x0b02('0x1'));var zipdir=require(_0x0b02('0x2'));var jsonpatch=require(_0x0b02('0x3'));var rp=require(_0x0b02('0x4'));var moment=require(_0x0b02('0x5'));var BPromise=require(_0x0b02('0x6'));var Mustache=require(_0x0b02('0x7'));var util=require(_0x0b02('0x8'));var path=require(_0x0b02('0x9'));var sox=require(_0x0b02('0xa'));var csv=require(_0x0b02('0xb'));var ejs=require(_0x0b02('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b02('0xd'));var squel=require(_0x0b02('0xe'));var crypto=require(_0x0b02('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0b02('0x10'));var toCsv=require(_0x0b02('0xb'));var querystring=require(_0x0b02('0x11'));var Papa=require('papaparse');var Redis=require(_0x0b02('0x12'));var authService=require(_0x0b02('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0b02('0x14'));var hardwareService=require(_0x0b02('0x15'));var logger=require(_0x0b02('0x16'))(_0x0b02('0x17'));var utils=require(_0x0b02('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0b02('0x19'));var db=require('../../mysqldb')['db'];config[_0x0b02('0x1a')]=_[_0x0b02('0x1b')](config[_0x0b02('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x0b02('0x1c'))(new Redis(config['redis']));require(_0x0b02('0x1d'))[_0x0b02('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x0b02('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1bcf59,_0x2f3066,_0x111ce1,_0x139738){return new BPromise(function(_0x425551,_0x31e63c){var _0x38ffa4=_0x139738||client;return _0x38ffa4[_0x0b02('0x20')](_0x1bcf59,_0x111ce1)['then'](function(_0x164d44){logger[_0x0b02('0x21')]('FaxAccount,\x20%s,\x20%s',_0x2f3066,_0x0b02('0x22'));logger[_0x0b02('0x23')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2f3066,'request\x20sent',JSON[_0x0b02('0x24')](_0x164d44));if(_0x164d44['error']){if(_0x164d44[_0x0b02('0x25')]['code']===0x1f4){logger[_0x0b02('0x25')](_0x0b02('0x26'),_0x2f3066,_0x164d44[_0x0b02('0x25')][_0x0b02('0x27')]);return _0x31e63c(_0x164d44[_0x0b02('0x25')][_0x0b02('0x27')]);}logger['error'](_0x0b02('0x26'),_0x2f3066,_0x164d44['error'][_0x0b02('0x27')]);return _0x425551(_0x164d44['error']['message']);}else{logger[_0x0b02('0x21')](_0x0b02('0x26'),_0x2f3066,_0x0b02('0x22'));_0x425551(_0x164d44[_0x0b02('0x28')]['message']);}})['catch'](function(_0xa27c13){logger[_0x0b02('0x25')](_0x0b02('0x26'),_0x2f3066,_0xa27c13);_0x31e63c(_0xa27c13);});});}function respondWithStatusCode(_0x3f02eb,_0x5b6052){_0x5b6052=_0x5b6052||0xcc;return function(_0x3fcc87){if(_0x3fcc87){return _0x3f02eb[_0x0b02('0x29')](_0x5b6052);}return _0x3f02eb[_0x0b02('0x2a')](_0x5b6052)['end']();};}function respondWithResult(_0x1f5b36,_0x52a7f4){_0x52a7f4=_0x52a7f4||0xc8;return function(_0x5a6559){if(_0x5a6559){return _0x1f5b36[_0x0b02('0x2a')](_0x52a7f4)['json'](_0x5a6559);}};}function respondWithFilteredResult(_0x1dbd9d,_0x24eef3){return function(_0x5df827){if(_0x5df827){var _0x20ac86=typeof _0x24eef3[_0x0b02('0x2b')]===_0x0b02('0x2c')&&typeof _0x24eef3[_0x0b02('0x2d')]==='undefined';var _0x131bdb=_0x5df827['count'];var _0x9eebb5=_0x20ac86?0x0:_0x24eef3['offset'];var _0x4b02e5=_0x20ac86?_0x5df827[_0x0b02('0x2e')]:_0x24eef3[_0x0b02('0x2b')]+_0x24eef3[_0x0b02('0x2d')];var _0x493a4f;if(_0x4b02e5>=_0x131bdb){_0x4b02e5=_0x131bdb;_0x493a4f=0xc8;}else{_0x493a4f=0xce;}_0x1dbd9d[_0x0b02('0x2a')](_0x493a4f);return _0x1dbd9d[_0x0b02('0x2f')](_0x0b02('0x30'),_0x9eebb5+'-'+_0x4b02e5+'/'+_0x131bdb)[_0x0b02('0x31')](_0x5df827);}return null;};}function patchUpdates(_0x54962c){return function(_0x513570){try{jsonpatch[_0x0b02('0x32')](_0x513570,_0x54962c,!![]);}catch(_0x3b967a){return BPromise[_0x0b02('0x33')](_0x3b967a);}return _0x513570['save']();};}function saveUpdates(_0x1f79b1,_0x21120c){return function(_0x5a745c){if(_0x5a745c){return _0x5a745c['update'](_0x1f79b1)[_0x0b02('0x34')](function(_0x44d8e1){return _0x44d8e1;});}return null;};}function removeEntity(_0x36bad2,_0x98077a){return function(_0x3d0766){if(_0x3d0766){return _0x3d0766[_0x0b02('0x35')]()[_0x0b02('0x34')](function(){var _0x2b7481=_0x3d0766['get']({'plain':!![]});var _0x5041f7=_0x0b02('0x36');return db[_0x0b02('0x37')][_0x0b02('0x35')]({'where':{'type':_0x5041f7,'resourceId':_0x2b7481['id']}})[_0x0b02('0x34')](function(){return _0x3d0766;});})['then'](function(){_0x36bad2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c0a,_0x1f1278){return function(_0x1c2602){if(!_0x1c2602){_0x459c0a[_0x0b02('0x29')](0x194);}return _0x1c2602;};}function handleError(_0x1ff770,_0x385507){_0x385507=_0x385507||0x1f4;return function(_0x4994aa){logger[_0x0b02('0x25')](_0x4994aa[_0x0b02('0x38')]);if(_0x4994aa[_0x0b02('0x39')]){delete _0x4994aa[_0x0b02('0x39')];}_0x1ff770[_0x0b02('0x2a')](_0x385507)[_0x0b02('0x3a')](_0x4994aa);};}exports[_0x0b02('0x3b')]=function(_0x49b46d,_0x201462){var _0x1771d1={'include':[{'model':db[_0x0b02('0x3c')],'as':'mandatoryDispositionPause'}]},_0x5661fb={},_0x323d9e={'count':0x0,'rows':[]};var _0x14cb73=_[_0x0b02('0x3d')](db[_0x0b02('0x3e')][_0x0b02('0x3f')],function(_0x425283){return{'name':_0x425283[_0x0b02('0x40')],'type':_0x425283['type']['key']};});_0x5661fb[_0x0b02('0x41')]=_[_0x0b02('0x3d')](_0x14cb73,_0x0b02('0x39'));_0x5661fb[_0x0b02('0x42')]=_['keys'](_0x49b46d[_0x0b02('0x42')]);_0x5661fb[_0x0b02('0x43')]=_['intersection'](_0x5661fb[_0x0b02('0x41')],_0x5661fb['query']);_0x1771d1[_0x0b02('0x44')]=_['intersection'](_0x5661fb[_0x0b02('0x41')],qs['fields'](_0x49b46d[_0x0b02('0x42')]['fields']));_0x1771d1[_0x0b02('0x44')]=_0x1771d1[_0x0b02('0x44')][_0x0b02('0x45')]?_0x1771d1[_0x0b02('0x44')]:_0x5661fb[_0x0b02('0x41')];if(!_0x49b46d['query'][_0x0b02('0x46')](_0x0b02('0x47'))){_0x1771d1[_0x0b02('0x2d')]=qs['limit'](_0x49b46d[_0x0b02('0x42')][_0x0b02('0x2d')]);_0x1771d1['offset']=qs[_0x0b02('0x2b')](_0x49b46d[_0x0b02('0x42')][_0x0b02('0x2b')]);}_0x1771d1['order']=qs[_0x0b02('0x48')](_0x49b46d['query'][_0x0b02('0x48')]);_0x1771d1['where']=qs[_0x0b02('0x43')](_[_0x0b02('0x49')](_0x49b46d[_0x0b02('0x42')],_0x5661fb[_0x0b02('0x43')]),_0x14cb73);if(_0x49b46d['query'][_0x0b02('0x4a')]){_0x1771d1[_0x0b02('0x4b')]=_['merge'](_0x1771d1[_0x0b02('0x4b')],{'$or':_[_0x0b02('0x3d')](_0x14cb73,function(_0xf445e5){if(_0xf445e5[_0x0b02('0x4c')]!==_0x0b02('0x4d')){var _0x3ac04d={};_0x3ac04d[_0xf445e5[_0x0b02('0x39')]]={'$like':'%'+_0x49b46d[_0x0b02('0x42')][_0x0b02('0x4a')]+'%'};return _0x3ac04d;}})});}_0x1771d1=_[_0x0b02('0x4e')]({},_0x1771d1,_0x49b46d['options']);var _0x165c03={'where':_0x1771d1[_0x0b02('0x4b')]};return db[_0x0b02('0x3e')][_0x0b02('0x2e')](_0x165c03)[_0x0b02('0x34')](function(_0x488700){_0x323d9e[_0x0b02('0x2e')]=_0x488700;if(_0x49b46d[_0x0b02('0x42')]['includeAll']){_0x1771d1['include']=[{'all':!![]}];}return db[_0x0b02('0x3e')][_0x0b02('0x4f')](_0x1771d1);})[_0x0b02('0x34')](function(_0x53a48d){_0x323d9e['rows']=_0x53a48d;return _0x323d9e;})[_0x0b02('0x34')](respondWithFilteredResult(_0x201462,_0x1771d1))[_0x0b02('0x50')](handleError(_0x201462,null));};exports[_0x0b02('0x51')]=function(_0x403542,_0x4de0d0){var _0x45ff5c={'raw':![],'where':{'id':_0x403542[_0x0b02('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0x0b02('0x53')}]},_0x313333={};_0x313333[_0x0b02('0x41')]=_[_0x0b02('0x54')](db[_0x0b02('0x3e')][_0x0b02('0x3f')]);_0x313333['query']=_[_0x0b02('0x54')](_0x403542[_0x0b02('0x42')]);_0x313333[_0x0b02('0x43')]=_['intersection'](_0x313333[_0x0b02('0x41')],_0x313333[_0x0b02('0x42')]);_0x45ff5c['attributes']=_[_0x0b02('0x55')](_0x313333[_0x0b02('0x41')],qs['fields'](_0x403542[_0x0b02('0x42')][_0x0b02('0x56')]));_0x45ff5c[_0x0b02('0x44')]=_0x45ff5c[_0x0b02('0x44')]['length']?_0x45ff5c['attributes']:_0x313333[_0x0b02('0x41')];if(_0x403542[_0x0b02('0x42')][_0x0b02('0x57')]){_0x45ff5c['include']=[{'all':!![]}];}_0x45ff5c=_[_0x0b02('0x4e')]({},_0x45ff5c,_0x403542[_0x0b02('0x58')]);return db[_0x0b02('0x3e')][_0x0b02('0x59')](_0x45ff5c)['then'](handleEntityNotFound(_0x4de0d0,null))[_0x0b02('0x34')](respondWithResult(_0x4de0d0,null))[_0x0b02('0x50')](handleError(_0x4de0d0,null));};exports['create']=function(_0x3df626,_0x5525f2){return db[_0x0b02('0x3e')][_0x0b02('0x5a')](_0x3df626['body'],{})[_0x0b02('0x34')](function(_0x592f2d){var _0x1555cf=_0x3df626[_0x0b02('0x5b')][_0x0b02('0x5c')]({'plain':!![]});if(!_0x1555cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1555cf[_0x0b02('0x5d')]===_0x0b02('0x5b')){var _0x4af357=_0x592f2d['get']({'plain':!![]});var _0x1c2d42=_0x0b02('0x36');return db['UserProfileSection'][_0x0b02('0x59')]({'where':{'name':_0x1c2d42,'userProfileId':_0x1555cf[_0x0b02('0x5e')]},'raw':!![]})[_0x0b02('0x34')](function(_0x32aff5){if(_0x32aff5&&_0x32aff5[_0x0b02('0x5f')]===0x0){return db[_0x0b02('0x37')]['create']({'name':_0x4af357[_0x0b02('0x39')],'resourceId':_0x4af357['id'],'type':_0x32aff5[_0x0b02('0x39')],'sectionId':_0x32aff5['id']},{})[_0x0b02('0x34')](function(){return _0x592f2d;});}else{return _0x592f2d;}})[_0x0b02('0x50')](function(_0x10f604){logger[_0x0b02('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10f604);throw _0x10f604;});}return _0x592f2d;})['then'](respondWithResult(_0x5525f2,0xc9))['catch'](handleError(_0x5525f2,null));};exports[_0x0b02('0x60')]=function(_0x2f2a32,_0xdb7475){if(_0x2f2a32[_0x0b02('0x61')]['id']){delete _0x2f2a32[_0x0b02('0x61')]['id'];}return db[_0x0b02('0x3e')]['find']({'where':{'id':_0x2f2a32[_0x0b02('0x52')]['id']},'include':[{'model':db[_0x0b02('0x3c')],'as':_0x0b02('0x53')}]})['then'](handleEntityNotFound(_0xdb7475,null))[_0x0b02('0x34')](saveUpdates(_0x2f2a32[_0x0b02('0x61')],null))[_0x0b02('0x34')](respondWithResult(_0xdb7475,null))[_0x0b02('0x50')](handleError(_0xdb7475,null));};exports[_0x0b02('0x35')]=function(_0x470d65,_0x2f2ace){return db['FaxAccount']['find']({'where':{'id':_0x470d65[_0x0b02('0x52')]['id']}})[_0x0b02('0x34')](handleEntityNotFound(_0x2f2ace,null))['then'](removeEntity(_0x2f2ace,null))[_0x0b02('0x50')](handleError(_0x2f2ace,null));};exports[_0x0b02('0x62')]=function(_0xf2e204,_0x312f84){return db[_0x0b02('0x3e')][_0x0b02('0x62')]()['then'](respondWithResult(_0x312f84,null))[_0x0b02('0x50')](handleError(_0x312f84,null));};exports[_0x0b02('0x63')]=function(_0x4e0def,_0xbab54d,_0x14ee35){if(_0x4e0def[_0x0b02('0x61')]['id']){delete _0x4e0def['body']['id'];}return db[_0x0b02('0x3e')]['find']({'where':{'id':_0x4e0def['params']['id']}})[_0x0b02('0x34')](handleEntityNotFound(_0xbab54d,null))['then'](function(_0x177b14){if(_0x177b14){_0x4e0def[_0x0b02('0x61')][_0x0b02('0x64')]=_0x177b14['id'];return db[_0x0b02('0x65')]['create'](_0x4e0def[_0x0b02('0x61')]);}})[_0x0b02('0x34')](respondWithResult(_0xbab54d,null))[_0x0b02('0x50')](handleError(_0xbab54d,null));};exports['getDispositions']=function(_0x5313e6,_0x2ae2fb,_0x36ef2b){var _0x82e693={'raw':![],'where':{}};var _0xe56c74={};var _0x1a7bd4={'count':0x0,'rows':[]};return db[_0x0b02('0x3e')][_0x0b02('0x66')]({'where':{'id':_0x5313e6[_0x0b02('0x52')]['id']}})[_0x0b02('0x34')](handleEntityNotFound(_0x2ae2fb,null))[_0x0b02('0x34')](function(_0x485218){if(_0x485218){_0xe56c74[_0x0b02('0x41')]=_[_0x0b02('0x54')](db[_0x0b02('0x65')][_0x0b02('0x3f')]);_0xe56c74[_0x0b02('0x42')]=_[_0x0b02('0x54')](_0x5313e6[_0x0b02('0x42')]);_0xe56c74['filters']=_[_0x0b02('0x55')](_0xe56c74[_0x0b02('0x41')],_0xe56c74[_0x0b02('0x42')]);_0x82e693[_0x0b02('0x44')]=_[_0x0b02('0x55')](_0xe56c74[_0x0b02('0x41')],qs[_0x0b02('0x56')](_0x5313e6[_0x0b02('0x42')][_0x0b02('0x56')]));_0x82e693[_0x0b02('0x44')]=_0x82e693[_0x0b02('0x44')][_0x0b02('0x45')]?_0x82e693[_0x0b02('0x44')]:_0xe56c74[_0x0b02('0x41')];if(!_0x5313e6[_0x0b02('0x42')][_0x0b02('0x46')]('nolimit')){_0x82e693[_0x0b02('0x2d')]=qs[_0x0b02('0x2d')](_0x5313e6['query']['limit']);_0x82e693[_0x0b02('0x2b')]=qs['offset'](_0x5313e6['query'][_0x0b02('0x2b')]);}_0x82e693[_0x0b02('0x67')]=qs[_0x0b02('0x48')](_0x5313e6['query']['sort']);_0x82e693[_0x0b02('0x4b')]=qs['filters'](_[_0x0b02('0x49')](_0x5313e6[_0x0b02('0x42')],_0xe56c74['filters']));_0x82e693[_0x0b02('0x4b')][_0x0b02('0x64')]=_0x485218['id'];if(_0x5313e6[_0x0b02('0x42')][_0x0b02('0x4a')]){_0x82e693[_0x0b02('0x4b')]=_['merge'](_0x82e693[_0x0b02('0x4b')],{'$or':_[_0x0b02('0x3d')](_0x82e693[_0x0b02('0x44')],function(_0x40e4b7){var _0x1ec30b={};_0x1ec30b[_0x40e4b7]={'$like':'%'+_0x5313e6[_0x0b02('0x42')][_0x0b02('0x4a')]+'%'};return _0x1ec30b;})});}_0x82e693=_[_0x0b02('0x4e')]({},_0x82e693,_0x5313e6[_0x0b02('0x58')]);return db['Disposition'][_0x0b02('0x2e')]({'where':_0x82e693[_0x0b02('0x4b')]})[_0x0b02('0x34')](function(_0x4cc7ea){_0x1a7bd4[_0x0b02('0x2e')]=_0x4cc7ea;if(_0x5313e6['query']['includeAll']){_0x82e693[_0x0b02('0x68')]=[{'all':!![]}];}return db[_0x0b02('0x65')]['findAll'](_0x82e693);})[_0x0b02('0x34')](function(_0x1872d0){_0x1a7bd4[_0x0b02('0x69')]=_0x1872d0;return _0x1a7bd4;});}})[_0x0b02('0x34')](respondWithFilteredResult(_0x2ae2fb,_0x82e693))[_0x0b02('0x50')](handleError(_0x2ae2fb,null));};exports[_0x0b02('0x6a')]=function(_0x6dc001,_0x28f930,_0x6c52bd){return db[_0x0b02('0x3e')][_0x0b02('0x59')]({'where':{'id':_0x6dc001['params']['id']}})[_0x0b02('0x34')](handleEntityNotFound(_0x28f930,null))['then'](function(_0x647201){if(_0x647201){return _0x647201[_0x0b02('0x6a')](_0x6dc001[_0x0b02('0x42')][_0x0b02('0x6b')]);}})['then'](respondWithStatusCode(_0x28f930,null))[_0x0b02('0x50')](handleError(_0x28f930,null));};exports[_0x0b02('0x6c')]=function(_0x2bb0bd,_0x3d6a36,_0x515750){if(_0x2bb0bd[_0x0b02('0x61')]['id']){delete _0x2bb0bd['body']['id'];}return db[_0x0b02('0x3e')][_0x0b02('0x59')]({'where':{'id':_0x2bb0bd[_0x0b02('0x52')]['id']}})['then'](handleEntityNotFound(_0x3d6a36,null))[_0x0b02('0x34')](function(_0x576065){if(_0x576065){_0x2bb0bd[_0x0b02('0x61')][_0x0b02('0x64')]=_0x576065['id'];return db[_0x0b02('0x6d')][_0x0b02('0x5a')](_0x2bb0bd[_0x0b02('0x61')]);}})[_0x0b02('0x34')](respondWithResult(_0x3d6a36,null))['catch'](handleError(_0x3d6a36,null));};exports[_0x0b02('0x6e')]=function(_0x2fbd35,_0x4a476d,_0x53ac1c){var _0x327ae1={'raw':![],'where':{}};var _0x51ce20={};var _0x1f3ed3={'count':0x0,'rows':[]};return db[_0x0b02('0x3e')][_0x0b02('0x66')]({'where':{'id':_0x2fbd35[_0x0b02('0x52')]['id']}})[_0x0b02('0x34')](handleEntityNotFound(_0x4a476d,null))[_0x0b02('0x34')](function(_0x53d28f){if(_0x53d28f){_0x51ce20[_0x0b02('0x41')]=_[_0x0b02('0x54')](db[_0x0b02('0x6d')]['rawAttributes']);_0x51ce20[_0x0b02('0x42')]=_['keys'](_0x2fbd35[_0x0b02('0x42')]);_0x51ce20[_0x0b02('0x43')]=_[_0x0b02('0x55')](_0x51ce20[_0x0b02('0x41')],_0x51ce20['query']);_0x327ae1['attributes']=_[_0x0b02('0x55')](_0x51ce20['model'],qs['fields'](_0x2fbd35[_0x0b02('0x42')]['fields']));_0x327ae1['attributes']=_0x327ae1['attributes'][_0x0b02('0x45')]?_0x327ae1[_0x0b02('0x44')]:_0x51ce20[_0x0b02('0x41')];if(!_0x2fbd35[_0x0b02('0x42')][_0x0b02('0x46')]('nolimit')){_0x327ae1[_0x0b02('0x2d')]=qs[_0x0b02('0x2d')](_0x2fbd35[_0x0b02('0x42')][_0x0b02('0x2d')]);_0x327ae1[_0x0b02('0x2b')]=qs[_0x0b02('0x2b')](_0x2fbd35[_0x0b02('0x42')][_0x0b02('0x2b')]);}_0x327ae1['order']=qs[_0x0b02('0x48')](_0x2fbd35[_0x0b02('0x42')][_0x0b02('0x48')]);_0x327ae1[_0x0b02('0x4b')]=qs['filters'](_[_0x0b02('0x49')](_0x2fbd35['query'],_0x51ce20[_0x0b02('0x43')]));_0x327ae1[_0x0b02('0x4b')][_0x0b02('0x64')]=_0x53d28f['id'];if(_0x2fbd35[_0x0b02('0x42')][_0x0b02('0x4a')]){_0x327ae1[_0x0b02('0x4b')]=_['merge'](_0x327ae1[_0x0b02('0x4b')],{'$or':_[_0x0b02('0x3d')](_0x327ae1[_0x0b02('0x44')],function(_0x1d0dce){var _0x5b9b7b={};_0x5b9b7b[_0x1d0dce]={'$like':'%'+_0x2fbd35[_0x0b02('0x42')][_0x0b02('0x4a')]+'%'};return _0x5b9b7b;})});}_0x327ae1=_[_0x0b02('0x4e')]({},_0x327ae1,_0x2fbd35[_0x0b02('0x58')]);return db[_0x0b02('0x6d')]['count']({'where':_0x327ae1[_0x0b02('0x4b')]})[_0x0b02('0x34')](function(_0x5c75bc){_0x1f3ed3[_0x0b02('0x2e')]=_0x5c75bc;if(_0x2fbd35[_0x0b02('0x42')][_0x0b02('0x57')]){_0x327ae1['include']=[{'all':!![]}];}return db[_0x0b02('0x6d')][_0x0b02('0x4f')](_0x327ae1);})[_0x0b02('0x34')](function(_0x95ad0c){_0x1f3ed3[_0x0b02('0x69')]=_0x95ad0c;return _0x1f3ed3;});}})[_0x0b02('0x34')](respondWithFilteredResult(_0x4a476d,_0x327ae1))[_0x0b02('0x50')](handleError(_0x4a476d,null));};exports[_0x0b02('0x6f')]=function(_0x44d5d9,_0x3aecdb,_0xa1a79e){return db['FaxAccount'][_0x0b02('0x59')]({'where':{'id':_0x44d5d9[_0x0b02('0x52')]['id']}})[_0x0b02('0x34')](handleEntityNotFound(_0x3aecdb,null))[_0x0b02('0x34')](function(_0x553e18){if(_0x553e18){return _0x553e18[_0x0b02('0x6f')](_0x44d5d9['query'][_0x0b02('0x6b')]);}})[_0x0b02('0x34')](respondWithStatusCode(_0x3aecdb,null))[_0x0b02('0x50')](handleError(_0x3aecdb,null));};exports[_0x0b02('0x70')]=function(_0x4ecfb9,_0x17e890,_0x446d18){return db['FaxInteraction'][_0x0b02('0x59')]({'where':{'id':_0x4ecfb9['params']['id']}})[_0x0b02('0x34')](handleEntityNotFound(_0x17e890,null))[_0x0b02('0x34')](function(_0x3a3498){if(_0x3a3498){return _0x3a3498[_0x0b02('0x70')](_0x4ecfb9[_0x0b02('0x61')][_0x0b02('0x6b')],_[_0x0b02('0x71')](_0x4ecfb9[_0x0b02('0x61')],[_0x0b02('0x6b'),'id'])||{});}})[_0x0b02('0x34')](respondWithResult(_0x17e890,null))[_0x0b02('0x50')](handleError(_0x17e890,null));};exports[_0x0b02('0x72')]=function(_0xebacb0,_0x5ed0e9,_0x57e81){var _0x406a3e={'raw':![],'where':{}};var _0x54044c={};var _0x16b6a0={'count':0x0,'rows':[]};return db[_0x0b02('0x3e')]['findOne']({'where':{'id':_0xebacb0[_0x0b02('0x52')]['id']}})[_0x0b02('0x34')](handleEntityNotFound(_0x5ed0e9,null))['then'](function(_0x321709){if(_0x321709){_0x54044c['model']=_[_0x0b02('0x54')](db[_0x0b02('0x73')][_0x0b02('0x3f')]);_0x54044c[_0x0b02('0x42')]=_['keys'](_0xebacb0[_0x0b02('0x42')]);_0x54044c[_0x0b02('0x43')]=_[_0x0b02('0x55')](_0x54044c[_0x0b02('0x41')],_0x54044c[_0x0b02('0x42')]);_0x406a3e[_0x0b02('0x44')]=_['intersection'](_0x54044c['model'],qs[_0x0b02('0x56')](_0xebacb0[_0x0b02('0x42')]['fields']));_0x406a3e[_0x0b02('0x44')]=_0x406a3e[_0x0b02('0x44')][_0x0b02('0x45')]?_0x406a3e[_0x0b02('0x44')]:_0x54044c['model'];if(!_0xebacb0[_0x0b02('0x42')][_0x0b02('0x46')]('nolimit')){_0x406a3e['limit']=qs[_0x0b02('0x2d')](_0xebacb0[_0x0b02('0x42')]['limit']);_0x406a3e[_0x0b02('0x2b')]=qs[_0x0b02('0x2b')](_0xebacb0[_0x0b02('0x42')][_0x0b02('0x2b')]);}_0x406a3e[_0x0b02('0x67')]=qs[_0x0b02('0x48')](_0xebacb0[_0x0b02('0x42')][_0x0b02('0x48')]);_0x406a3e['where']=qs[_0x0b02('0x43')](_[_0x0b02('0x49')](_0xebacb0[_0x0b02('0x42')],_0x54044c[_0x0b02('0x43')]));_0x406a3e['where'][_0x0b02('0x64')]=_0x321709['id'];if(_0xebacb0['query'][_0x0b02('0x4a')]){_0x406a3e[_0x0b02('0x4b')]=_[_0x0b02('0x4e')](_0x406a3e['where'],{'$or':_['map'](_0x406a3e[_0x0b02('0x44')],function(_0x508a39){var _0x377729={};_0x377729[_0x508a39]={'$like':'%'+_0xebacb0[_0x0b02('0x42')][_0x0b02('0x4a')]+'%'};return _0x377729;})});}_0x406a3e=_[_0x0b02('0x4e')]({},_0x406a3e,_0xebacb0[_0x0b02('0x58')]);return db[_0x0b02('0x73')][_0x0b02('0x2e')]({'where':_0x406a3e['where']})[_0x0b02('0x34')](function(_0x215b89){_0x16b6a0[_0x0b02('0x2e')]=_0x215b89;if(_0xebacb0[_0x0b02('0x42')][_0x0b02('0x57')]){_0x406a3e['include']=[{'model':db[_0x0b02('0x74')],'as':_0x0b02('0x75'),'required':![]},{'model':db[_0x0b02('0x76')],'as':_0x0b02('0x77'),'attributes':['name',_0x0b02('0x78'),'internal'],'required':![]},{'model':db[_0x0b02('0x79')],'as':_0x0b02('0x7a'),'attributes':['id','name',_0x0b02('0x7b')],'where':_0xebacb0[_0x0b02('0x42')][_0x0b02('0x7c')]?{'id':_0xebacb0[_0x0b02('0x42')][_0x0b02('0x7c')]}:undefined,'required':_0xebacb0['query'][_0x0b02('0x7c')]?!![]:![]}];}return db[_0x0b02('0x73')]['findAll'](_0x406a3e);})[_0x0b02('0x34')](function(_0x30af82){_0x16b6a0[_0x0b02('0x69')]=_0x30af82;return _0x16b6a0;});}})[_0x0b02('0x34')](respondWithFilteredResult(_0x5ed0e9,_0x406a3e))['catch'](handleError(_0x5ed0e9,null));};exports['addApplications']=function(_0x105bbf,_0x53ba97){var _0x3f5823=_0x105bbf['params']['id'];var _0xfbd3f3=_0x105bbf[_0x0b02('0x61')];var _0x30d2f4=0xc8;var _0x35138e=null;return db[_0x0b02('0x7d')][_0x0b02('0x7e')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x0b02('0x7f')]},function(_0xa3347b){return db[_0x0b02('0x3e')][_0x0b02('0x66')]({'where':{'id':_0x3f5823},'transaction':_0xa3347b})[_0x0b02('0x34')](function(_0x5d69c0){if(_0x5d69c0){return db[_0x0b02('0x80')]['destroy']({'where':{'FaxAccountId':_0x3f5823},'transaction':_0xa3347b})[_0x0b02('0x34')](function(){var _0xa1e79f=_[_0x0b02('0x3d')](_0xfbd3f3,function(_0x5928f3){_0x5928f3[_0x0b02('0x64')]=_0x3f5823;return _0x5928f3;});return db[_0x0b02('0x80')][_0x0b02('0x81')](_0xa1e79f,{'transaction':_0xa3347b});});}else{_0x30d2f4=0x194;_0x35138e=[];}});})[_0x0b02('0x34')](function(){if(_0x30d2f4!==0x194){return db[_0x0b02('0x80')][_0x0b02('0x82')]({'where':{'FaxAccountId':_0x3f5823},'order':_0x0b02('0x83')})['then'](function(_0x20f21f){_0x35138e=_0x20f21f;});}})[_0x0b02('0x50')](function(_0x3f9f40){_0x30d2f4=0x1f4;logger[_0x0b02('0x25')](_0x3f9f40[_0x0b02('0x38')]);if(_0x3f9f40['name']){delete _0x3f9f40[_0x0b02('0x39')];}_0x35138e=_0x3f9f40;})['finally'](function(){if(_0x35138e===null){_0x53ba97[_0x0b02('0x29')](_0x30d2f4);}else{if(_0x30d2f4===0x1f4){_0x53ba97[_0x0b02('0x2a')](_0x30d2f4)['send'](_0x35138e);}else{_0x53ba97['status'](_0x30d2f4)[_0x0b02('0x31')](_0x35138e);}}});};exports[_0x0b02('0x84')]=function(_0x14313f,_0x4c3fd9,_0x5b5465){var _0x1211c6={};var _0x21be95={};var _0x452cc0;var _0x296d27;return db[_0x0b02('0x3e')][_0x0b02('0x66')]({'where':{'id':_0x14313f[_0x0b02('0x52')]['id']}})[_0x0b02('0x34')](handleEntityNotFound(_0x4c3fd9,null))[_0x0b02('0x34')](function(_0xe00e95){if(_0xe00e95){_0x452cc0=_0xe00e95;_0x21be95[_0x0b02('0x41')]=_['keys'](db[_0x0b02('0x80')][_0x0b02('0x3f')]);_0x21be95[_0x0b02('0x42')]=_[_0x0b02('0x54')](_0x14313f[_0x0b02('0x42')]);_0x21be95[_0x0b02('0x43')]=_[_0x0b02('0x55')](_0x21be95[_0x0b02('0x41')],_0x21be95['query']);_0x1211c6[_0x0b02('0x44')]=_['intersection'](_0x21be95['model'],qs[_0x0b02('0x56')](_0x14313f[_0x0b02('0x42')]['fields']));_0x1211c6['attributes']=_0x1211c6[_0x0b02('0x44')][_0x0b02('0x45')]?_0x1211c6['attributes']:_0x21be95[_0x0b02('0x41')];_0x1211c6[_0x0b02('0x67')]=qs[_0x0b02('0x48')](_0x14313f[_0x0b02('0x42')][_0x0b02('0x48')]);_0x1211c6['where']=qs[_0x0b02('0x43')](_['pick'](_0x14313f[_0x0b02('0x42')],_0x21be95[_0x0b02('0x43')]));if(_0x14313f[_0x0b02('0x42')][_0x0b02('0x4a')]){_0x1211c6['where']=_[_0x0b02('0x4e')](_0x1211c6[_0x0b02('0x4b')],{'$or':_[_0x0b02('0x3d')](_0x1211c6[_0x0b02('0x44')],function(_0x49b337){var _0x5174ac={};_0x5174ac[_0x49b337]={'$like':'%'+_0x14313f[_0x0b02('0x42')][_0x0b02('0x4a')]+'%'};return _0x5174ac;})});}_0x1211c6=_[_0x0b02('0x4e')]({},_0x1211c6,_0x14313f[_0x0b02('0x58')]);return _0x452cc0[_0x0b02('0x84')](_0x1211c6);}})[_0x0b02('0x34')](function(_0x16bb7a){if(_0x16bb7a){_0x296d27=_0x16bb7a[_0x0b02('0x45')];if(!_0x14313f[_0x0b02('0x42')][_0x0b02('0x46')](_0x0b02('0x47'))){_0x1211c6[_0x0b02('0x2d')]=qs[_0x0b02('0x2d')](_0x14313f[_0x0b02('0x42')]['limit']);_0x1211c6[_0x0b02('0x2b')]=qs[_0x0b02('0x2b')](_0x14313f['query'][_0x0b02('0x2b')]);}return _0x452cc0[_0x0b02('0x84')](_0x1211c6);}})[_0x0b02('0x34')](function(_0x8941ee){if(_0x8941ee){return _0x8941ee?{'count':_0x296d27,'rows':_0x8941ee}:null;}})[_0x0b02('0x34')](respondWithResult(_0x4c3fd9,null))['catch'](handleError(_0x4c3fd9,null));};function Extension(_0x2e0c0a,_0x5d72a2,_0x44d750,_0x429edb){this[_0x0b02('0x85')]=_0x0b02('0x86');this[_0x0b02('0x87')]=_0x2e0c0a[_0x0b02('0x88')];this[_0x0b02('0x89')]=_0x429edb;this[_0x0b02('0x4c')]=_0x0b02('0x8a');this[_0x0b02('0x8b')]='Fax\x20Extension';this['FaxAccountId']=_0x2e0c0a['id'];this['priority']=_0x5d72a2;this[_0x0b02('0x8c')]=_0x44d750;}function createExtensionsReciveFax(_0x33e4a6){var _0x5a6975=0x1;var _0x46fd1a=[];_0x46fd1a[_0x0b02('0x8d')](new Extension(_0x33e4a6,_0x5a6975,'',_0x0b02('0x8e')));_0x5a6975+=0x1;_0x46fd1a[_0x0b02('0x8d')](new Extension(_0x33e4a6,_0x5a6975,'CDR(type)=inbound-fax','Set'));_0x5a6975+=0x1;for(var _0x468c3e in _0x33e4a6){if(_0x33e4a6['hasOwnProperty'](_0x468c3e)&&(_0x468c3e===_0x0b02('0x8f')||_0x468c3e===_0x0b02('0x88')||_0x468c3e===_0x0b02('0x90')||_0x468c3e===_0x0b02('0x91')||_0x468c3e===_0x0b02('0x92')||_0x468c3e===_0x0b02('0x93')||_0x468c3e===_0x0b02('0x94')||_0x468c3e==='modem'||_0x468c3e==='t38timeout')){_0x46fd1a[_0x0b02('0x8d')](new Extension(_0x33e4a6,_0x5a6975,_0x0b02('0x95')+_0x468c3e+')='+_0x33e4a6[_0x468c3e],'Set'));_0x5a6975+=0x1;}}_0x46fd1a[_0x0b02('0x8d')](new Extension(_0x33e4a6,_0x5a6975,'6','Wait'));_0x5a6975+=0x1;_0x46fd1a[_0x0b02('0x8d')](new Extension(_0x33e4a6,_0x5a6975,'/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',_0x0b02('0x96')));_0x5a6975=0x0;return _0x46fd1a;}exports[_0x0b02('0x97')]=function(_0x4697ec,_0x3a99a1,_0x2e9dec){var _0x56d48d;return db[_0x0b02('0x7d')][_0x0b02('0x7e')](function(_0x64279c){return db[_0x0b02('0x3e')][_0x0b02('0x5a')](_0x4697ec[_0x0b02('0x61')],{'transaction':_0x64279c})['then'](function(_0x24910d){_0x56d48d=_0x24910d['get']({'plain':!![]});return db['VoiceExtension'][_0x0b02('0x81')](createExtensionsReciveFax(_0x56d48d),{'transaction':_0x64279c});});})[_0x0b02('0x34')](function(){return _0x56d48d;})[_0x0b02('0x34')](respondWithResult(_0x3a99a1,null))[_0x0b02('0x50')](handleError(_0x3a99a1,null));};exports[_0x0b02('0x98')]=function(_0xaf540a,_0x588ddc,_0x39d42b){var _0x34b297;return db[_0x0b02('0x7d')][_0x0b02('0x7e')](function(_0x401e3e){return db[_0x0b02('0x3e')][_0x0b02('0x60')](_0xaf540a[_0x0b02('0x61')],{'where':{'id':_0xaf540a[_0x0b02('0x61')]['id']},'transaction':_0x401e3e})[_0x0b02('0x34')](function(_0x186c54){return db[_0x0b02('0x99')]['destroy']({'where':{'FaxAccountId':_0xaf540a[_0x0b02('0x61')]['id']},'transaction':_0x401e3e})[_0x0b02('0x34')](function(_0x4dbabb){return db[_0x0b02('0x99')][_0x0b02('0x81')](createExtensionsReciveFax(_[_0x0b02('0x71')](_0xaf540a[_0x0b02('0x61')],[_0x0b02('0x9a'),_0x0b02('0x9b'),_0x0b02('0x9c'),_0x0b02('0x9d'),_0x0b02('0x9e'),'ListId'])),{'transaction':_0x401e3e});});});})[_0x0b02('0x34')](function(){return db['FaxAccount'][_0x0b02('0x9f')](_0xaf540a[_0x0b02('0x61')]['id']);})[_0x0b02('0x34')](respondWithResult(_0x588ddc,null))[_0x0b02('0x50')](handleError(_0x588ddc,null));};exports['getMessages']=function(_0x425603,_0x11bdd4,_0x547978){var _0x305099={'raw':!![],'where':{}};var _0x228caf={};var _0x17478d={'count':0x0,'rows':[]};return db['FaxAccount'][_0x0b02('0x66')]({'where':{'id':_0x425603[_0x0b02('0x52')]['id']}})['then'](handleEntityNotFound(_0x11bdd4,null))['then'](function(_0x466b3c){if(_0x466b3c){_0x228caf[_0x0b02('0x41')]=_[_0x0b02('0x54')](db[_0x0b02('0xa0')][_0x0b02('0x3f')]);_0x228caf['query']=_[_0x0b02('0x54')](_0x425603[_0x0b02('0x42')]);_0x228caf['filters']=_[_0x0b02('0x55')](_0x228caf['model'],_0x228caf[_0x0b02('0x42')]);_0x305099[_0x0b02('0x44')]=_['intersection'](_0x228caf['model'],qs[_0x0b02('0x56')](_0x425603[_0x0b02('0x42')][_0x0b02('0x56')]));_0x305099[_0x0b02('0x44')]=_0x305099[_0x0b02('0x44')][_0x0b02('0x45')]?_0x305099[_0x0b02('0x44')]:_0x228caf[_0x0b02('0x41')];if(!_0x425603[_0x0b02('0x42')][_0x0b02('0x46')](_0x0b02('0x47'))){_0x305099[_0x0b02('0x2d')]=qs[_0x0b02('0x2d')](_0x425603[_0x0b02('0x42')]['limit']);_0x305099['offset']=qs[_0x0b02('0x2b')](_0x425603[_0x0b02('0x42')][_0x0b02('0x2b')]);}_0x305099['order']=qs[_0x0b02('0x48')](_0x425603['query'][_0x0b02('0x48')]);_0x305099['where']=qs[_0x0b02('0x43')](_['pick'](_0x425603[_0x0b02('0x42')],_0x228caf[_0x0b02('0x43')]));_0x305099['where'][_0x0b02('0x64')]=_0x466b3c['id'];if(_0x425603['query']['filter']){_0x305099['where']=_[_0x0b02('0x4e')](_0x305099[_0x0b02('0x4b')],{'$or':_[_0x0b02('0x3d')](_0x305099[_0x0b02('0x44')],function(_0x58e357){var _0x27147c={};_0x27147c[_0x58e357]={'$like':'%'+_0x425603[_0x0b02('0x42')]['filter']+'%'};return _0x27147c;})});}if(_0x425603[_0x0b02('0x42')][_0x0b02('0xa1')]){var _0x1bc72e=_0x425603['query'][_0x0b02('0xa1')][_0x0b02('0xa2')](',');var _0x213d57={};_0x213d57[_0x1bc72e[0x0]]={'$gte':moment(_0x1bc72e[0x1])['format'](_0x0b02('0xa3'))};_0x305099[_0x0b02('0x4b')]=_[_0x0b02('0x4e')](_0x305099[_0x0b02('0x4b')],_0x213d57);}_0x305099=_[_0x0b02('0x4e')]({},_0x305099,_0x425603[_0x0b02('0x58')]);return db[_0x0b02('0xa0')][_0x0b02('0x2e')]({'where':_0x305099['where']})[_0x0b02('0x34')](function(_0x53edd7){_0x17478d[_0x0b02('0x2e')]=_0x53edd7;if(_0x425603['query'][_0x0b02('0x57')]){_0x305099[_0x0b02('0x68')]=[{'all':!![]}];}return db[_0x0b02('0xa0')][_0x0b02('0x4f')](_0x305099);})[_0x0b02('0x34')](function(_0x4de843){_0x17478d['rows']=_0x4de843;return _0x17478d;});}})[_0x0b02('0x34')](respondWithFilteredResult(_0x11bdd4,_0x305099))[_0x0b02('0x50')](handleError(_0x11bdd4,null));};exports[_0x0b02('0x3a')]=function(_0x3bce48,_0x2a6275,_0x14e1b7){var _0x4a58ec,_0x2379fc={},_0x136d7b;if(_0x3bce48[_0x0b02('0x61')]['to']){_0x136d7b=_0x3bce48[_0x0b02('0x61')]['to'][0x0];}return db[_0x0b02('0x3e')][_0x0b02('0x59')]({'where':{'id':_0x3bce48[_0x0b02('0x52')]['id']},'include':[{'model':db[_0x0b02('0xa4')],'as':_0x0b02('0xa5'),'include':[{'model':db[_0x0b02('0x74')],'as':'Contacts','where':{'fax':_0x136d7b},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x0b02('0x34')](handleEntityNotFound(_0x2a6275,null))[_0x0b02('0x34')](function(_0x1de788){_0x4a58ec=_0x1de788;if(_0x3bce48[_0x0b02('0x61')][_0x0b02('0xa6')]&&_0x3bce48[_0x0b02('0x61')][_0x0b02('0xa6')]['length']){for(var _0xcf287a=0x0;_0xcf287a<_0x3bce48[_0x0b02('0x61')][_0x0b02('0xa6')][_0x0b02('0x45')];_0xcf287a+=0x1){_0x3bce48['body'][_0x0b02('0xa6')][_0xcf287a]={'filename':_0x3bce48[_0x0b02('0x61')][_0x0b02('0xa6')][_0xcf287a][_0x0b02('0x39')],'id':_0x3bce48[_0x0b02('0x61')][_0x0b02('0xa6')][_0xcf287a]['id'],'path':path['join'](config[_0x0b02('0xa7')],_0x0b02('0xa8'),_0x3bce48[_0x0b02('0x61')][_0x0b02('0xa6')][_0xcf287a][_0x0b02('0xa9')])};}}return respondWithRpcPromise(_0x0b02('0xaa'),_0x0b02('0xaa'),{'FaxAccountId':_[_0x0b02('0xab')](_0x3bce48[_0x0b02('0x52')]['id'])?undefined:_0x3bce48[_0x0b02('0x52')]['id'],'path':_[_0x0b02('0xab')](_0x3bce48[_0x0b02('0x61')][_0x0b02('0xa6')][0x0]['path'])?undefined:_0x3bce48[_0x0b02('0x61')]['attachments'][0x0][_0x0b02('0x9')],'fax':_[_0x0b02('0xab')](_0x3bce48['body']['to'][0x0])?undefined:_0x3bce48[_0x0b02('0x61')]['to'][0x0]},client9002);})[_0x0b02('0x34')](function(){if(_0x4a58ec){if(_[_0x0b02('0xab')](_0x3bce48[_0x0b02('0x61')][_0x0b02('0xac')])){_0x3bce48[_0x0b02('0x61')][_0x0b02('0xac')]=util[_0x0b02('0xad')](_0x0b02('0xae'),_0x4a58ec['name'],_0x4a58ec[_0x0b02('0xaf')]);}if(_0x4a58ec['List']){if(_0x4a58ec['List']['Contacts'][_0x0b02('0x45')]){return _0x4a58ec[_0x0b02('0xa5')][_0x0b02('0xb0')][0x0];}else{return db[_0x0b02('0x74')][_0x0b02('0x5a')](_[_0x0b02('0x1b')](_0x3bce48[_0x0b02('0x61')],{'firstName':_0x3bce48[_0x0b02('0x61')]['to'][0x0],'phone':_0x3bce48[_0x0b02('0x61')]['to'][0x0],'fax':_0x3bce48[_0x0b02('0x61')]['to'][0x0],'ListId':_0x4a58ec['ListId']}));}}else{throw new Error(_0x0b02('0xb1'));}}else{throw new Error(_0x0b02('0xb2'));}})[_0x0b02('0x34')](function(_0x123219){if(_0x123219){return db['FaxInteraction'][_0x0b02('0x59')]({'where':{'ContactId':_0x123219['id'],'closed':![],'FaxAccountId':_0x4a58ec['id']}})['then'](function(_0x2073c2){if(_0x2073c2){return[_0x2073c2,![]];}return db[_0x0b02('0x73')]['create']({'UserId':_0x3bce48[_0x0b02('0x5b')]['id'],'ContactId':_0x123219['id'],'FaxAccountId':_0x4a58ec['id'],'fax':_0x3bce48[_0x0b02('0x61')]['to'][0x0],'firstMsgDirection':_0x0b02('0xb3'),'Messages':[_[_0x0b02('0x4e')](_0x3bce48[_0x0b02('0x61')],{'read':![],'body':_0x3bce48[_0x0b02('0x61')][_0x0b02('0xa6')][0x0][_0x0b02('0xb4')],'FaxAccountId':_0x4a58ec['id'],'UserId':_0x3bce48[_0x0b02('0x5b')]['id'],'ContactId':_0x123219['id'],'AttachmentId':_0x3bce48['body'][_0x0b02('0xa6')][0x0]['id']})]},{'include':[{'model':db[_0x0b02('0xa0')],'as':_0x0b02('0xb5')}]})[_0x0b02('0x34')](function(_0x284d87){return[_0x284d87,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x0b02('0xb6')](function(_0x1f2910,_0x4dea8e){if(_0x4dea8e){return _0x1f2910;}return db['FaxMessage'][_0x0b02('0x5a')]({'direction':_0x0b02('0xb3'),'read':![],'body':_0x3bce48[_0x0b02('0x61')]['attachments'][0x0][_0x0b02('0xb4')],'FaxAccountId':_0x4a58ec['id'],'FaxInteractionId':_0x1f2910['id'],'UserId':_0x3bce48['user']['id'],'ContactId':_0x1f2910[_0x0b02('0xb7')],'AttachmentId':_0x3bce48[_0x0b02('0x61')][_0x0b02('0xa6')][0x0]['id']})[_0x0b02('0x34')](function(_0x3199da){_0x1f2910[_0x0b02('0xb8')][_0x0b02('0xb5')]=[];_0x1f2910['dataValues'][_0x0b02('0xb5')][_0x0b02('0x8d')](_0x3199da[_0x0b02('0xb8')]);return _0x1f2910;});})[_0x0b02('0x34')](function(_0x37ce3a){respondWithRpcPromise(_0x0b02('0xb9'),_0x0b02('0xb9'),{'FaxAccountId':_[_0x0b02('0xab')](_0x3bce48[_0x0b02('0x52')]['id'])?undefined:_0x3bce48[_0x0b02('0x52')]['id'],'path':_[_0x0b02('0xab')](_0x3bce48[_0x0b02('0x61')]['attachments'][0x0][_0x0b02('0x9')])?undefined:_0x3bce48[_0x0b02('0x61')][_0x0b02('0xa6')][0x0][_0x0b02('0x9')],'fax':_[_0x0b02('0xab')](_0x3bce48[_0x0b02('0x61')]['to'][0x0])?undefined:_0x3bce48[_0x0b02('0x61')]['to'][0x0],'AttachmentId':_0x3bce48[_0x0b02('0x61')]['attachments'][0x0]['id']},client9002)[_0x0b02('0x34')](function(_0x55f8c1){logger[_0x0b02('0x21')]('SendFaxRpc,\x20%s',_0x55f8c1);})[_0x0b02('0x50')](function(_0x3f7d04){logger['info'](_0x0b02('0xba'),_0x3f7d04);});return _0x37ce3a;})[_0x0b02('0x34')](respondWithResult(_0x2a6275,null))[_0x0b02('0x50')](handleError(_0x2a6275,null));};exports['addAgents']=function(_0x2d2c53,_0x1160ac,_0x2f7c55){return db[_0x0b02('0x3e')][_0x0b02('0x59')]({'where':{'id':_0x2d2c53[_0x0b02('0x52')]['id']}})[_0x0b02('0x34')](handleEntityNotFound(_0x1160ac,null))['then'](function(_0x5bea92){if(_0x5bea92){return _0x5bea92[_0x0b02('0xbb')](_0x2d2c53['body'][_0x0b02('0x6b')],_[_0x0b02('0x71')](_0x2d2c53[_0x0b02('0x61')],[_0x0b02('0x6b'),'id'])||{})[_0x0b02('0xb6')](function(_0x747e90){for(var _0x4fe750=0x0;_0x4fe750<_0x2d2c53[_0x0b02('0x61')]['ids'][_0x0b02('0x45')];_0x4fe750+=0x1){socket[_0x0b02('0xbc')](_0x0b02('0xbd'),{'UserId':Number(_0x2d2c53['body']['ids'][_0x4fe750]),'FaxAccountId':Number(_0x2d2c53[_0x0b02('0x52')]['id'])});}return _0x747e90;});}})['then'](respondWithResult(_0x1160ac,null))[_0x0b02('0x50')](handleError(_0x1160ac,null));};exports[_0x0b02('0xbe')]=function(_0x5851ea,_0xbb6bdd,_0x3b4b5d){return db['FaxAccount'][_0x0b02('0x59')]({'where':{'id':_0x5851ea[_0x0b02('0x52')]['id']}})[_0x0b02('0x34')](handleEntityNotFound(_0xbb6bdd,null))[_0x0b02('0x34')](function(_0x2eefdd){if(_0x2eefdd){return _0x2eefdd[_0x0b02('0xbe')](_0x5851ea['query'][_0x0b02('0x6b')])[_0x0b02('0x34')](function(){if(_[_0x0b02('0xbf')](_0x5851ea[_0x0b02('0x42')][_0x0b02('0x6b')])){for(var _0x3da894=0x0;_0x3da894<_0x5851ea[_0x0b02('0x42')][_0x0b02('0x6b')][_0x0b02('0x45')];_0x3da894+=0x1){socket[_0x0b02('0xbc')](_0x0b02('0xc0'),{'UserId':Number(_0x5851ea[_0x0b02('0x42')][_0x0b02('0x6b')][_0x3da894]),'FaxAccountId':Number(_0x5851ea[_0x0b02('0x52')]['id'])});}}else{socket[_0x0b02('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0x5851ea[_0x0b02('0x42')]['ids']),'FaxAccountId':Number(_0x5851ea[_0x0b02('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0xbb6bdd,null))[_0x0b02('0x50')](handleError(_0xbb6bdd,null));};exports[_0x0b02('0xc1')]=function(_0x3887c5,_0x4c0e5c,_0x593d50){var _0x4b51d7={};var _0x3042b4={};var _0x5f0cfc;var _0x37a895;return db['FaxAccount'][_0x0b02('0x66')]({'where':{'id':_0x3887c5['params']['id']}})[_0x0b02('0x34')](handleEntityNotFound(_0x4c0e5c,null))[_0x0b02('0x34')](function(_0xbadabb){if(_0xbadabb){_0x5f0cfc=_0xbadabb;_0x3042b4[_0x0b02('0x41')]=_['keys'](db['User']['rawAttributes']);_0x3042b4[_0x0b02('0x42')]=_[_0x0b02('0x54')](_0x3887c5[_0x0b02('0x42')]);_0x3042b4[_0x0b02('0x43')]=_[_0x0b02('0x55')](_0x3042b4[_0x0b02('0x41')],_0x3042b4[_0x0b02('0x42')]);_0x4b51d7[_0x0b02('0x44')]=_[_0x0b02('0x55')](_0x3042b4[_0x0b02('0x41')],qs[_0x0b02('0x56')](_0x3887c5[_0x0b02('0x42')]['fields']));_0x4b51d7[_0x0b02('0x44')]=_0x4b51d7[_0x0b02('0x44')][_0x0b02('0x45')]?_0x4b51d7[_0x0b02('0x44')]:_0x3042b4[_0x0b02('0x41')];_0x4b51d7[_0x0b02('0x67')]=qs[_0x0b02('0x48')](_0x3887c5[_0x0b02('0x42')]['sort']);_0x4b51d7['where']=qs['filters'](_[_0x0b02('0x49')](_0x3887c5['query'],_0x3042b4[_0x0b02('0x43')]));if(_0x3887c5[_0x0b02('0x42')][_0x0b02('0x4a')]){_0x4b51d7[_0x0b02('0x4b')]=_[_0x0b02('0x4e')](_0x4b51d7['where'],{'$or':_['map'](_0x4b51d7[_0x0b02('0x44')],function(_0x56780f){var _0x173912={};_0x173912[_0x56780f]={'$like':'%'+_0x3887c5['query'][_0x0b02('0x4a')]+'%'};return _0x173912;})});}_0x4b51d7=_['merge']({},_0x4b51d7,_0x3887c5[_0x0b02('0x58')]);return _0x5f0cfc[_0x0b02('0xc1')](_0x4b51d7);}})[_0x0b02('0x34')](function(_0x21edd2){if(_0x21edd2){_0x37a895=_0x21edd2['length'];if(!_0x3887c5[_0x0b02('0x42')]['hasOwnProperty'](_0x0b02('0x47'))){_0x4b51d7[_0x0b02('0x2d')]=qs[_0x0b02('0x2d')](_0x3887c5[_0x0b02('0x42')][_0x0b02('0x2d')]);_0x4b51d7[_0x0b02('0x2b')]=qs[_0x0b02('0x2b')](_0x3887c5['query'][_0x0b02('0x2b')]);}return _0x5f0cfc['getAgents'](_0x4b51d7);}})['then'](function(_0x2263aa){if(_0x2263aa){return _0x2263aa?{'count':_0x37a895,'rows':_0x2263aa}:null;}})[_0x0b02('0x34')](respondWithResult(_0x4c0e5c,null))[_0x0b02('0x50')](handleError(_0x4c0e5c,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index bde4184..0ce2153 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 _0x1117=['hook','exports','events','FaxAccount','save','update','remove','emit','hasOwnProperty'];(function(_0x26e0ac,_0x297c09){var _0x25b956=function(_0x5abbb3){while(--_0x5abbb3){_0x26e0ac['push'](_0x26e0ac['shift']());}};_0x25b956(++_0x297c09);}(_0x1117,0x18e));var _0x7111=function(_0x1a68dd,_0x168fdd){_0x1a68dd=_0x1a68dd-0x0;var _0x564bc7=_0x1117[_0x1a68dd];return _0x564bc7;};'use strict';var EventEmitter=require(_0x7111('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x7111('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7111('0x2'),'afterUpdate':_0x7111('0x3'),'afterDestroy':_0x7111('0x4')};function emitEvent(_0x1ade0e){return function(_0x41efb0,_0x1a60e1,_0x57e474){FaxAccountEvents[_0x7111('0x5')](_0x1ade0e+':'+_0x41efb0['id'],_0x41efb0);FaxAccountEvents[_0x7111('0x5')](_0x1ade0e,_0x41efb0);_0x57e474(null);};}for(var e in events){if(events[_0x7111('0x6')](e)){var event=events[e];FaxAccount[_0x7111('0x7')](e,emitEvent(event));}}module[_0x7111('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xbc4b=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','save','remove'];(function(_0x52b494,_0x144998){var _0x295940=function(_0x2ee8eb){while(--_0x2ee8eb){_0x52b494['push'](_0x52b494['shift']());}};_0x295940(++_0x144998);}(_0xbc4b,0x1a2));var _0xbbc4=function(_0x68caa7,_0x3bc5ff){_0x68caa7=_0x68caa7-0x0;var _0x4eaacb=_0xbc4b[_0x68caa7];return _0x4eaacb;};'use strict';var EventEmitter=require(_0xbbc4('0x0'));var FaxAccount=require(_0xbbc4('0x1'))['db'][_0xbbc4('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbbc4('0x3'),'afterUpdate':'update','afterDestroy':_0xbbc4('0x4')};function emitEvent(_0x3febe3){return function(_0xd8c8a7,_0x369a65,_0x418d4b){FaxAccountEvents[_0xbbc4('0x5')](_0x3febe3+':'+_0xd8c8a7['id'],_0xd8c8a7);FaxAccountEvents['emit'](_0x3febe3,_0xd8c8a7);_0x418d4b(null);};}for(var e in events){if(events[_0xbbc4('0x6')](e)){var event=events[e];FaxAccount[_0xbbc4('0x7')](e,emitEvent(event));}}module[_0xbbc4('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index bd16830..a37056f 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 _0x315a=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','FaxAccount','fax_accounts','lodash','util','api','moment','bluebird'];(function(_0x99c257,_0x52331b){var _0x30dc8f=function(_0x28295d){while(--_0x28295d){_0x99c257['push'](_0x99c257['shift']());}};_0x30dc8f(++_0x52331b);}(_0x315a,0x1cf));var _0xa315=function(_0x550aed,_0x1ba6cb){_0x550aed=_0x550aed-0x0;var _0x1c43a5=_0x315a[_0x550aed];return _0x1c43a5;};'use strict';var _=require(_0xa315('0x0'));var util=require(_0xa315('0x1'));var logger=require('../../config/logger')(_0xa315('0x2'));var moment=require(_0xa315('0x3'));var BPromise=require(_0xa315('0x4'));var rp=require(_0xa315('0x5'));var fs=require('fs');var path=require(_0xa315('0x6'));var rimraf=require(_0xa315('0x7'));var config=require(_0xa315('0x8'));var attributes=require(_0xa315('0x9'));module['exports']=function(_0x1c8a12,_0x20939a){return _0x1c8a12['define'](_0xa315('0xa'),attributes,{'tableName':_0xa315('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0647=['../../config/environment','./faxAccount.attributes','exports','FaxAccount','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x328e5f,_0x3cdce9){var _0x5a9b53=function(_0x5995a8){while(--_0x5995a8){_0x328e5f['push'](_0x328e5f['shift']());}};_0x5a9b53(++_0x3cdce9);}(_0x0647,0xac));var _0x7064=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x0647[_0x41d432];return _0x1650f9;};'use strict';var _=require(_0x7064('0x0'));var util=require(_0x7064('0x1'));var logger=require(_0x7064('0x2'))(_0x7064('0x3'));var moment=require('moment');var BPromise=require(_0x7064('0x4'));var rp=require(_0x7064('0x5'));var fs=require('fs');var path=require(_0x7064('0x6'));var rimraf=require(_0x7064('0x7'));var config=require(_0x7064('0x8'));var attributes=require(_0x7064('0x9'));module[_0x7064('0xa')]=function(_0x40a786,_0x15775f){return _0x40a786['define'](_0x7064('0xb'),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 97af7e4..802ca95 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 _0x31be=['CmList','Contacts','DESC','FaxApplication','Applications','List','get','list','applications','priority','asc','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','close','unmanaged','FaxMessage','ContactId','AttachmentId','interaction','UserId','agent','name','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','FaxAccount','options','raw','where','attributes','limit','map','include','model','then','debug','GetFaxAccount','catch','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account'];(function(_0x103f34,_0x4cea2f){var _0x3e1fce=function(_0x4a403c){while(--_0x4a403c){_0x103f34['push'](_0x103f34['shift']());}};_0x3e1fce(++_0x4cea2f);}(_0x31be,0x1ec));var _0xe31b=function(_0x4f0e32,_0x118e8e){_0x4f0e32=_0x4f0e32-0x0;var _0x1d2724=_0x31be[_0x4f0e32];return _0x1d2724;};'use strict';var _=require(_0xe31b('0x0'));var util=require(_0xe31b('0x1'));var moment=require(_0xe31b('0x2'));var BPromise=require(_0xe31b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe31b('0x4'));var db=require(_0xe31b('0x5'))['db'];var utils=require(_0xe31b('0x6'));var logger=require(_0xe31b('0x7'))(_0xe31b('0x8'));var config=require(_0xe31b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe31b('0xa')]['http']({'port':0x232c});config[_0xe31b('0xb')]=_[_0xe31b('0xc')](config[_0xe31b('0xb')],{'host':_0xe31b('0xd'),'port':0x18eb});var socket=require(_0xe31b('0xe'))(new Redis(config[_0xe31b('0xb')]));require(_0xe31b('0xf'))[_0xe31b('0x10')](socket);function respondWithRpcPromise(_0x49fc40,_0x37d267,_0x327861){return new BPromise(function(_0x2064d9,_0x524bcc){return client[_0xe31b('0x11')](_0x49fc40,_0x327861)['then'](function(_0x4e732a){logger[_0xe31b('0x12')](_0xe31b('0x13'),_0x37d267,_0xe31b('0x14'));logger['debug'](_0xe31b('0x15'),_0x37d267,'request\x20sent',JSON['stringify'](_0x4e732a));if(_0x4e732a[_0xe31b('0x16')]){if(_0x4e732a['error'][_0xe31b('0x17')]===0x1f4){logger[_0xe31b('0x16')]('FaxAccount,\x20%s,\x20%s',_0x37d267,_0x4e732a[_0xe31b('0x16')]['message']);return _0x524bcc(_0x4e732a['error'][_0xe31b('0x18')]);}logger[_0xe31b('0x16')]('FaxAccount,\x20%s,\x20%s',_0x37d267,_0x4e732a['error'][_0xe31b('0x18')]);return _0x2064d9(_0x4e732a['error'][_0xe31b('0x18')]);}else{logger[_0xe31b('0x12')](_0xe31b('0x13'),_0x37d267,_0xe31b('0x14'));_0x2064d9(_0x4e732a[_0xe31b('0x19')]['message']);}})['catch'](function(_0x347ae4){logger[_0xe31b('0x16')]('FaxAccount,\x20%s,\x20%s',_0x37d267,_0x347ae4);_0x524bcc(_0x347ae4);});});}exports['GetFaxAccount']=function(_0x5414fd){var _0x3145fe=this;return new Promise(function(_0x3aef09,_0x380666){return db[_0xe31b('0x1a')]['findAll']({'raw':_0x5414fd[_0xe31b('0x1b')]?_0x5414fd['options'][_0xe31b('0x1c')]===undefined?!![]:![]:!![],'where':_0x5414fd[_0xe31b('0x1b')]?_0x5414fd[_0xe31b('0x1b')][_0xe31b('0x1d')]||null:null,'attributes':_0x5414fd[_0xe31b('0x1b')]?_0x5414fd[_0xe31b('0x1b')][_0xe31b('0x1e')]||null:null,'limit':_0x5414fd[_0xe31b('0x1b')]?_0x5414fd[_0xe31b('0x1b')][_0xe31b('0x1f')]||null:null,'include':_0x5414fd[_0xe31b('0x1b')]?_0x5414fd[_0xe31b('0x1b')]['include']?_[_0xe31b('0x20')](_0x5414fd[_0xe31b('0x1b')]['include'],function(_0x52843e){return{'model':db[_0x52843e['model']],'as':_0x52843e['as'],'attributes':_0x52843e[_0xe31b('0x1e')],'include':_0x52843e['include']?_[_0xe31b('0x20')](_0x52843e[_0xe31b('0x21')],function(_0x5bf6b6){return{'model':db[_0x5bf6b6[_0xe31b('0x22')]],'as':_0x5bf6b6['as'],'attributes':_0x5bf6b6['attributes'],'include':_0x5bf6b6[_0xe31b('0x21')]?_[_0xe31b('0x20')](_0x5bf6b6['include'],function(_0xe93db1){return{'model':db[_0xe93db1[_0xe31b('0x22')]],'as':_0xe93db1['as'],'attributes':_0xe93db1[_0xe31b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe31b('0x23')](function(_0x4a62f3){logger[_0xe31b('0x12')]('GetFaxAccount',_0x5414fd);logger[_0xe31b('0x24')](_0xe31b('0x25'),_0x5414fd,JSON['stringify'](_0x4a62f3));_0x3aef09(_0x4a62f3);})[_0xe31b('0x26')](function(_0xcbbb7b){logger[_0xe31b('0x16')]('GetFaxAccount',_0xcbbb7b[_0xe31b('0x18')],_0x5414fd);_0x380666(_0x3145fe['error'](0x1f4,_0xcbbb7b['message']));});});};exports['NotifyFaxAccount']=function(_0x45f114,_0xf67efa,_0x32dedc){var _0x576d22=this;return new Promise(function(_0x473378,_0x2e1f0c){var _0x286cb6={'body':_0x45f114['body'],'channel':_0xe31b('0x27')};var _0x130ba2=[];var _0xd317e7=[];var _0x902c64={};return db[_0xe31b('0x28')][_0xe31b('0x29')]()['then'](function(_0x36f710){if(!_0x36f710){throw new db[(_0xe31b('0x2a'))][(_0xe31b('0x2b'))](_0xe31b('0x2c'));}_0x130ba2=_[_0xe31b('0x2d')](_[_0xe31b('0x2e')](_0x36f710),[_0xe31b('0x2f'),_0xe31b('0x30')]);_0xd317e7=_['difference'](_['keys'](_0x36f710),[_0xe31b('0x2f'),'updatedAt',_0xe31b('0x31'),'ListId']);if(_0x45f114[_0xe31b('0x32')]['id']){delete _0x45f114[_0xe31b('0x32')]['id'];}if(_[_0xe31b('0x33')](_0x45f114[_0xe31b('0x32')][_0xe31b('0x34')])){throw new db[(_0xe31b('0x2a'))][(_0xe31b('0x2b'))](_0xe31b('0x35'));}if(_[_0xe31b('0x33')](_0x45f114['body'][_0xe31b('0x32')])||_0x45f114[_0xe31b('0x32')]['body']===''){throw new db[(_0xe31b('0x2a'))][(_0xe31b('0x2b'))](_0xe31b('0x36'));}if(_[_0xe31b('0x33')](_0x45f114['body']['mapKey'])){throw new db[(_0xe31b('0x2a'))][(_0xe31b('0x2b'))](_0xe31b('0x37')+_0xd317e7);}if(!_[_0xe31b('0x38')](_0xd317e7,_0x45f114[_0xe31b('0x32')][_0xe31b('0x39')])){throw new db[(_0xe31b('0x2a'))]['ValidationError'](_0xe31b('0x3a')+_0xd317e7);}_0x902c64[_0x45f114[_0xe31b('0x32')]['mapKey']]=_0x45f114[_0xe31b('0x32')][_0xe31b('0x34')];})[_0xe31b('0x23')](function(){return db[_0xe31b('0x1a')]['find']({'where':{'id':_0x45f114[_0xe31b('0x3b')]['id']},'include':[{'model':db[_0xe31b('0x3c')],'as':'List','include':[{'model':db[_0xe31b('0x28')],'as':_0xe31b('0x3d'),'where':_0x902c64,'limit':0x1,'order':[[_0xe31b('0x30'),_0xe31b('0x3e')]]}]},{'model':db[_0xe31b('0x3f')],'as':_0xe31b('0x40')}]});})['then'](function(_0x26d428){if(_0x26d428&&_0x26d428[_0xe31b('0x41')]){var _0x580f56=_0x26d428[_0xe31b('0x42')]({'plain':!![]});_0x286cb6[_0xe31b('0x3b')]=_0x580f56;_0x286cb6['applications']=_0x580f56[_0xe31b('0x40')];_0x286cb6[_0xe31b('0x43')]=_0x580f56['List'];_0x286cb6[_0xe31b('0x44')]=_['orderBy'](_0x286cb6['applications'],[_0xe31b('0x45')],[_0xe31b('0x46')]);if(_0x286cb6['account'][_0xe31b('0x40')]){delete _0x286cb6[_0xe31b('0x3b')][_0xe31b('0x40')];}if(_0x286cb6[_0xe31b('0x3b')]['List']&&_0x286cb6[_0xe31b('0x3b')]['List']['Contacts'][_0xe31b('0x47')]){return _0x286cb6['account'][_0xe31b('0x41')][_0xe31b('0x3d')][0x0];}var _0x419ced=_[_0xe31b('0xc')](_0x45f114['body'],{'firstName':_0x45f114['body'][_0xe31b('0x34')],'ListId':_0x580f56[_0xe31b('0x48')]});_0x419ced[_0x45f114[_0xe31b('0x32')][_0xe31b('0x39')]]=_0x45f114[_0xe31b('0x32')][_0xe31b('0x34')];return db['CmContact'][_0xe31b('0x49')](_0x419ced,{'fields':_0x130ba2,'raw':!![]});}})[_0xe31b('0x23')](function(_0x5d576b){_0x286cb6[_0xe31b('0x4a')]=_0x5d576b;if(_0x5d576b){var _0x368941={'ContactId':_0x5d576b['id'],'FaxAccountId':_0x45f114[_0xe31b('0x3b')]['id'],'fax':_0x5d576b['fax']};return db['FaxInteraction']['find']({'where':{'ContactId':_0x5d576b['id'],'closed':![],'FaxAccountId':_0x45f114[_0xe31b('0x3b')]['id']}})[_0xe31b('0x23')](function(_0x349dd9){if(_0x349dd9){return[_0x349dd9,![]];}return db[_0xe31b('0x4b')]['create'](_0x368941)[_0xe31b('0x23')](function(_0xc13d37){return[_0xc13d37,!![]];});});}else{throw new Error(_0xe31b('0x4c'));}})['spread'](function(_0x3c4aa6,_0x424b24){var _0x2af736=_0x3c4aa6[_0xe31b('0x42')]({'plain':!![]});if(_0x424b24){if(_0x286cb6[_0xe31b('0x3b')][_0xe31b('0x4d')]){_0x286cb6[_0xe31b('0x44')][_0xe31b('0x4e')]({'id':0x0,'priority':_0x286cb6[_0xe31b('0x44')][_0xe31b('0x47')]+0x1,'app':_0xe31b('0x4f'),'appdata':_0xe31b('0x50'),'interval':'*,*,*,*'});}_0x2af736['created']=!![];}else{_0x2af736['created']=![];}_0x286cb6['interaction']=_0x2af736;return db[_0xe31b('0x51')][_0xe31b('0x49')]({'body':_0x45f114[_0xe31b('0x32')][_0xe31b('0x32')],'FaxAccountId':_0x45f114['account']['id'],'FaxInteractionId':_0x3c4aa6['id'],'direction':'in','ContactId':_0x3c4aa6[_0xe31b('0x52')],'AttachmentId':_0x45f114[_0xe31b('0x32')][_0xe31b('0x53')]});})[_0xe31b('0x23')](function(_0x42fd9b){_0x286cb6[_0xe31b('0x18')]=_0x42fd9b;if(_0x286cb6[_0xe31b('0x54')][_0xe31b('0x55')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x286cb6['interaction']['UserId']}})['then'](function(_0xbe4c9b){if(_0xbe4c9b){_0x286cb6[_0xe31b('0x44')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe31b('0x56'),'appdata':_0xbe4c9b[_0xe31b('0x57')]+','+(_0x286cb6[_0xe31b('0x3b')][_0xe31b('0x58')]||0xa),'interval':_0xe31b('0x59')});}return respondWithRpcPromise('Start',_0xe31b('0x5a'),_0x286cb6);});}return respondWithRpcPromise(_0xe31b('0x5b'),_0xe31b('0x5a'),_0x286cb6);})[_0xe31b('0x23')](function(_0x83cd1b){_0x473378(_0x83cd1b);})[_0xe31b('0x26')](function(_0x497ce8){_0x2e1f0c(_0x576d22['error'](0x1f4,_0x497ce8[_0xe31b('0x18')]));});});}; \ No newline at end of file +var _0x3143=['localhost','socket.io-emitter','redis','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','GetFaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','FaxAccount','find','account','CmList','List','Contacts','Applications','get','list','orderBy','priority','asc','create','FaxInteraction','Contact\x20not\x20found','autoclose','applications','push','length','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','Start','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3143,0x102));var _0x3314=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x3143[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x3314('0x0'));var util=require(_0x3314('0x1'));var moment=require(_0x3314('0x2'));var BPromise=require(_0x3314('0x3'));var rs=require(_0x3314('0x4'));var fs=require('fs');var Redis=require(_0x3314('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3314('0x6'));var logger=require('../../config/logger')(_0x3314('0x7'));var config=require(_0x3314('0x8'));var jayson=require(_0x3314('0x9'));var client=jayson['client'][_0x3314('0xa')]({'port':0x232c});config['redis']=_[_0x3314('0xb')](config['redis'],{'host':_0x3314('0xc'),'port':0x18eb});var socket=require(_0x3314('0xd'))(new Redis(config[_0x3314('0xe')]));require(_0x3314('0xf'))[_0x3314('0x10')](socket);function respondWithRpcPromise(_0x171a36,_0xf7f74f,_0x591f2f){return new BPromise(function(_0x5747b3,_0x434ce0){return client[_0x3314('0x11')](_0x171a36,_0x591f2f)[_0x3314('0x12')](function(_0x2f5b8c){logger[_0x3314('0x13')](_0x3314('0x14'),_0xf7f74f,'request\x20sent');logger['debug'](_0x3314('0x15'),_0xf7f74f,'request\x20sent',JSON['stringify'](_0x2f5b8c));if(_0x2f5b8c['error']){if(_0x2f5b8c[_0x3314('0x16')][_0x3314('0x17')]===0x1f4){logger['error'](_0x3314('0x14'),_0xf7f74f,_0x2f5b8c['error'][_0x3314('0x18')]);return _0x434ce0(_0x2f5b8c[_0x3314('0x16')][_0x3314('0x18')]);}logger[_0x3314('0x16')](_0x3314('0x14'),_0xf7f74f,_0x2f5b8c[_0x3314('0x16')][_0x3314('0x18')]);return _0x5747b3(_0x2f5b8c[_0x3314('0x16')]['message']);}else{logger[_0x3314('0x13')]('FaxAccount,\x20%s,\x20%s',_0xf7f74f,_0x3314('0x19'));_0x5747b3(_0x2f5b8c['result']['message']);}})['catch'](function(_0x40f525){logger[_0x3314('0x16')](_0x3314('0x14'),_0xf7f74f,_0x40f525);_0x434ce0(_0x40f525);});});}exports[_0x3314('0x1a')]=function(_0x55928e){var _0x487002=this;return new Promise(function(_0x572fad,_0x443fdf){return db['FaxAccount'][_0x3314('0x1b')]({'raw':_0x55928e['options']?_0x55928e[_0x3314('0x1c')][_0x3314('0x1d')]===undefined?!![]:![]:!![],'where':_0x55928e['options']?_0x55928e[_0x3314('0x1c')][_0x3314('0x1e')]||null:null,'attributes':_0x55928e[_0x3314('0x1c')]?_0x55928e['options'][_0x3314('0x1f')]||null:null,'limit':_0x55928e[_0x3314('0x1c')]?_0x55928e[_0x3314('0x1c')][_0x3314('0x20')]||null:null,'include':_0x55928e['options']?_0x55928e[_0x3314('0x1c')][_0x3314('0x21')]?_[_0x3314('0x22')](_0x55928e[_0x3314('0x1c')]['include'],function(_0x22b134){return{'model':db[_0x22b134[_0x3314('0x23')]],'as':_0x22b134['as'],'attributes':_0x22b134[_0x3314('0x1f')],'include':_0x22b134[_0x3314('0x21')]?_[_0x3314('0x22')](_0x22b134['include'],function(_0x3ae7ea){return{'model':db[_0x3ae7ea[_0x3314('0x23')]],'as':_0x3ae7ea['as'],'attributes':_0x3ae7ea['attributes'],'include':_0x3ae7ea[_0x3314('0x21')]?_[_0x3314('0x22')](_0x3ae7ea[_0x3314('0x21')],function(_0x28d945){return{'model':db[_0x28d945[_0x3314('0x23')]],'as':_0x28d945['as'],'attributes':_0x28d945[_0x3314('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3314('0x12')](function(_0x2d142c){logger[_0x3314('0x13')](_0x3314('0x1a'),_0x55928e);logger[_0x3314('0x24')]('GetFaxAccount',_0x55928e,JSON[_0x3314('0x25')](_0x2d142c));_0x572fad(_0x2d142c);})['catch'](function(_0x235966){logger[_0x3314('0x16')]('GetFaxAccount',_0x235966[_0x3314('0x18')],_0x55928e);_0x443fdf(_0x487002[_0x3314('0x16')](0x1f4,_0x235966[_0x3314('0x18')]));});});};exports[_0x3314('0x26')]=function(_0x58369d,_0x38adb1,_0x43b912){var _0x52adae=this;return new Promise(function(_0x16a933,_0x5b1908){var _0x6f67eb={'body':_0x58369d[_0x3314('0x27')],'channel':_0x3314('0x28')};var _0x2d9c5b=[];var _0x47d167=[];var _0x755454={};return db[_0x3314('0x29')]['describe']()[_0x3314('0x12')](function(_0x3bde16){if(!_0x3bde16){throw new db[(_0x3314('0x2a'))][(_0x3314('0x2b'))](_0x3314('0x2c'));}_0x2d9c5b=_['difference'](_[_0x3314('0x2d')](_0x3bde16),[_0x3314('0x2e'),_0x3314('0x2f')]);_0x47d167=_[_0x3314('0x30')](_[_0x3314('0x2d')](_0x3bde16),['createdAt',_0x3314('0x2f'),_0x3314('0x31'),_0x3314('0x32')]);if(_0x58369d[_0x3314('0x27')]['id']){delete _0x58369d[_0x3314('0x27')]['id'];}if(_[_0x3314('0x33')](_0x58369d[_0x3314('0x27')]['from'])){throw new db['Sequelize'][(_0x3314('0x2b'))](_0x3314('0x34'));}if(_[_0x3314('0x33')](_0x58369d[_0x3314('0x27')]['body'])||_0x58369d[_0x3314('0x27')]['body']===''){throw new db[(_0x3314('0x2a'))][(_0x3314('0x2b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3314('0x33')](_0x58369d[_0x3314('0x27')][_0x3314('0x35')])){throw new db[(_0x3314('0x2a'))][(_0x3314('0x2b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x47d167);}if(!_[_0x3314('0x36')](_0x47d167,_0x58369d[_0x3314('0x27')][_0x3314('0x35')])){throw new db[(_0x3314('0x2a'))]['ValidationError'](_0x3314('0x37')+_0x47d167);}_0x755454[_0x58369d[_0x3314('0x27')][_0x3314('0x35')]]=_0x58369d[_0x3314('0x27')][_0x3314('0x38')];})[_0x3314('0x12')](function(){return db[_0x3314('0x39')][_0x3314('0x3a')]({'where':{'id':_0x58369d[_0x3314('0x3b')]['id']},'include':[{'model':db[_0x3314('0x3c')],'as':_0x3314('0x3d'),'include':[{'model':db['CmContact'],'as':_0x3314('0x3e'),'where':_0x755454,'limit':0x1,'order':[[_0x3314('0x2f'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x3314('0x3f')}]});})[_0x3314('0x12')](function(_0x41fd71){if(_0x41fd71&&_0x41fd71[_0x3314('0x3d')]){var _0x313a43=_0x41fd71[_0x3314('0x40')]({'plain':!![]});_0x6f67eb[_0x3314('0x3b')]=_0x313a43;_0x6f67eb['applications']=_0x313a43[_0x3314('0x3f')];_0x6f67eb[_0x3314('0x41')]=_0x313a43[_0x3314('0x3d')];_0x6f67eb['applications']=_[_0x3314('0x42')](_0x6f67eb['applications'],[_0x3314('0x43')],[_0x3314('0x44')]);if(_0x6f67eb[_0x3314('0x3b')][_0x3314('0x3f')]){delete _0x6f67eb[_0x3314('0x3b')]['Applications'];}if(_0x6f67eb[_0x3314('0x3b')]['List']&&_0x6f67eb['account'][_0x3314('0x3d')][_0x3314('0x3e')]['length']){return _0x6f67eb[_0x3314('0x3b')][_0x3314('0x3d')][_0x3314('0x3e')][0x0];}var _0x529222=_[_0x3314('0xb')](_0x58369d[_0x3314('0x27')],{'firstName':_0x58369d[_0x3314('0x27')][_0x3314('0x38')],'ListId':_0x313a43['ListId']});_0x529222[_0x58369d[_0x3314('0x27')][_0x3314('0x35')]]=_0x58369d[_0x3314('0x27')][_0x3314('0x38')];return db[_0x3314('0x29')][_0x3314('0x45')](_0x529222,{'fields':_0x2d9c5b,'raw':!![]});}})[_0x3314('0x12')](function(_0x329d63){_0x6f67eb['contact']=_0x329d63;if(_0x329d63){var _0x24688a={'ContactId':_0x329d63['id'],'FaxAccountId':_0x58369d[_0x3314('0x3b')]['id'],'fax':_0x329d63[_0x3314('0x28')]};return db[_0x3314('0x46')][_0x3314('0x3a')]({'where':{'ContactId':_0x329d63['id'],'closed':![],'FaxAccountId':_0x58369d[_0x3314('0x3b')]['id']}})[_0x3314('0x12')](function(_0x3c99c9){if(_0x3c99c9){return[_0x3c99c9,![]];}return db[_0x3314('0x46')][_0x3314('0x45')](_0x24688a)[_0x3314('0x12')](function(_0x4babaa){return[_0x4babaa,!![]];});});}else{throw new Error(_0x3314('0x47'));}})['spread'](function(_0x210013,_0x51cb93){var _0x5cae9c=_0x210013['get']({'plain':!![]});if(_0x51cb93){if(_0x6f67eb[_0x3314('0x3b')][_0x3314('0x48')]){_0x6f67eb[_0x3314('0x49')][_0x3314('0x4a')]({'id':0x0,'priority':_0x6f67eb[_0x3314('0x49')][_0x3314('0x4b')]+0x1,'app':_0x3314('0x4c'),'appdata':_0x3314('0x4d'),'interval':_0x3314('0x4e')});}_0x5cae9c[_0x3314('0x4f')]=!![];}else{_0x5cae9c[_0x3314('0x4f')]=![];}_0x6f67eb[_0x3314('0x50')]=_0x5cae9c;return db['FaxMessage'][_0x3314('0x45')]({'body':_0x58369d[_0x3314('0x27')]['body'],'FaxAccountId':_0x58369d['account']['id'],'FaxInteractionId':_0x210013['id'],'direction':'in','ContactId':_0x210013[_0x3314('0x51')],'AttachmentId':_0x58369d[_0x3314('0x27')][_0x3314('0x52')]});})[_0x3314('0x12')](function(_0x5ecb05){_0x6f67eb[_0x3314('0x18')]=_0x5ecb05;if(_0x6f67eb[_0x3314('0x50')][_0x3314('0x53')]){return db[_0x3314('0x54')][_0x3314('0x3a')]({'attributes':['id',_0x3314('0x55')],'where':{'id':_0x6f67eb['interaction'][_0x3314('0x53')]}})[_0x3314('0x12')](function(_0x59fcc6){if(_0x59fcc6){_0x6f67eb[_0x3314('0x49')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3314('0x56'),'appdata':_0x59fcc6[_0x3314('0x55')]+','+(_0x6f67eb['account'][_0x3314('0x57')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3314('0x58'),'startRouting',_0x6f67eb);});}return respondWithRpcPromise(_0x3314('0x58'),'startRouting',_0x6f67eb);})[_0x3314('0x12')](function(_0x2b2248){_0x16a933(_0x2b2248);})[_0x3314('0x59')](function(_0x32e8ed){_0x5b1908(_0x52adae['error'](0x1f4,_0x32e8ed['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index a0f283b..69a289e 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 _0xb7a6=['save','remove','update','removeListener','register','length','faxAccount:'];(function(_0x20e49e,_0x159d81){var _0x5d190d=function(_0x160d1d){while(--_0x160d1d){_0x20e49e['push'](_0x20e49e['shift']());}};_0x5d190d(++_0x159d81);}(_0xb7a6,0x1b9));var _0x6b7a=function(_0x1eb012,_0x188a1e){_0x1eb012=_0x1eb012-0x0;var _0x2b36ed=_0xb7a6[_0x1eb012];return _0x2b36ed;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x6b7a('0x0'),_0x6b7a('0x1'),_0x6b7a('0x2')];function createListener(_0x249b85,_0x32f5bb){return function(_0x4654d9){_0x32f5bb['emit'](_0x249b85,_0x4654d9);};}function removeListener(_0x3917a3,_0x375a03){return function(){FaxAccountEvents[_0x6b7a('0x3')](_0x3917a3,_0x375a03);};}exports[_0x6b7a('0x4')]=function(_0x44c9ba){for(var _0x3555b8=0x0,_0x1bcc1c=events[_0x6b7a('0x5')];_0x3555b8<_0x1bcc1c;_0x3555b8++){var _0x4b898a=events[_0x3555b8];var _0x312cf3=createListener(_0x6b7a('0x6')+_0x4b898a,_0x44c9ba);FaxAccountEvents['on'](_0x4b898a,_0x312cf3);}}; \ No newline at end of file +var _0x30ae=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0xce8aa3,_0x45587a){var _0x3c1e2d=function(_0x40a374){while(--_0x40a374){_0xce8aa3['push'](_0xce8aa3['shift']());}};_0x3c1e2d(++_0x45587a);}(_0x30ae,0x96));var _0xe30a=function(_0x44cd28,_0x1502d9){_0x44cd28=_0x44cd28-0x0;var _0x39356e=_0x30ae[_0x44cd28];return _0x39356e;};'use strict';var FaxAccountEvents=require(_0xe30a('0x0'));var events=[_0xe30a('0x1'),_0xe30a('0x2'),_0xe30a('0x3')];function createListener(_0x3c8612,_0x4ca051){return function(_0xbe0fd0){_0x4ca051[_0xe30a('0x4')](_0x3c8612,_0xbe0fd0);};}function removeListener(_0x73b514,_0x55aa7c){return function(){FaxAccountEvents[_0xe30a('0x5')](_0x73b514,_0x55aa7c);};}exports[_0xe30a('0x6')]=function(_0x1d2153){for(var _0x5901a7=0x0,_0x507a73=events[_0xe30a('0x7')];_0x5901a7<_0x507a73;_0x5901a7++){var _0x431f42=events[_0x5901a7];var _0x2a6617=createListener(_0xe30a('0x8')+_0x431f42,_0x1d2153);FaxAccountEvents['on'](_0x431f42,_0x2a6617);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 7b5f248..5273583 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x28c64e,_0x40d01a){var _0x2b0012=function(_0x52d469){while(--_0x52d469){_0x28c64e['push'](_0x28c64e['shift']());}};_0x2b0012(++_0x40d01a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x5e2475,_0x1a6d1b){var _0x17926d=function(_0x2a9064){while(--_0x2a9064){_0x5e2475['push'](_0x5e2475['shift']());}};_0x17926d(++_0x1a6d1b);}(_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['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 27d1365..6e6c562 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 _0xd967=['exports','INTEGER','TEXT','STRING','*,*,*,*'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd967,0x87));var _0x7d96=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0xd967[_0x11b58d];return _0xc2811b;};'use strict';var Sequelize=require('sequelize');module[_0x7d96('0x0')]={'priority':{'type':Sequelize[_0x7d96('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7d96('0x2')]()},'description':{'type':Sequelize[_0x7d96('0x3')]},'interval':{'type':Sequelize[_0x7d96('0x3')],'defaultValue':_0x7d96('0x4')}}; \ No newline at end of file +var _0x12ea=['TEXT','STRING','*,*,*,*','sequelize','INTEGER'];(function(_0x1d4193,_0x2d4e36){var _0x580b82=function(_0x1ac8dd){while(--_0x1ac8dd){_0x1d4193['push'](_0x1d4193['shift']());}};_0x580b82(++_0x2d4e36);}(_0x12ea,0x157));var _0xa12e=function(_0x29c0e0,_0x2b4cab){_0x29c0e0=_0x29c0e0-0x0;var _0x98a9ff=_0x12ea[_0x29c0e0];return _0x98a9ff;};'use strict';var Sequelize=require(_0xa12e('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa12e('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa12e('0x2')]()},'description':{'type':Sequelize[_0xa12e('0x3')]},'interval':{'type':Sequelize[_0xa12e('0x3')],'defaultValue':_0xa12e('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 2bcc1ef..acfa757 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 _0x5fe7=['offset','undefined','limit','count','status','set','apply','reject','save','update','destroy','then','end','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','FaxApplication','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json'];(function(_0x43a449,_0x1e9127){var _0x58c63b=function(_0x48a395){while(--_0x48a395){_0x43a449['push'](_0x43a449['shift']());}};_0x58c63b(++_0x1e9127);}(_0x5fe7,0x111));var _0x75fe=function(_0x358aca,_0x361411){_0x358aca=_0x358aca-0x0;var _0x56b5ff=_0x5fe7[_0x358aca];return _0x56b5ff;};'use strict';var emlformat=require(_0x75fe('0x0'));var rimraf=require(_0x75fe('0x1'));var zipdir=require(_0x75fe('0x2'));var jsonpatch=require(_0x75fe('0x3'));var rp=require(_0x75fe('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x75fe('0x5'));var util=require('util');var path=require(_0x75fe('0x6'));var sox=require(_0x75fe('0x7'));var csv=require(_0x75fe('0x8'));var ejs=require(_0x75fe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x75fe('0xa'));var squel=require(_0x75fe('0xb'));var crypto=require(_0x75fe('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x75fe('0xd'));var toCsv=require(_0x75fe('0x8'));var querystring=require('querystring');var Papa=require(_0x75fe('0xe'));var Redis=require(_0x75fe('0xf'));var authService=require(_0x75fe('0x10'));var qs=require(_0x75fe('0x11'));var as=require(_0x75fe('0x12'));var hardwareService=require(_0x75fe('0x13'));var logger=require(_0x75fe('0x14'))(_0x75fe('0x15'));var utils=require(_0x75fe('0x16'));var config=require(_0x75fe('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x75fe('0x18'))['db'];function respondWithStatusCode(_0x1ae2a9,_0x7d0f63){_0x7d0f63=_0x7d0f63||0xcc;return function(_0x5e51c6){if(_0x5e51c6){return _0x1ae2a9[_0x75fe('0x19')](_0x7d0f63);}return _0x1ae2a9['status'](_0x7d0f63)['end']();};}function respondWithResult(_0x2d7b35,_0x4c1e77){_0x4c1e77=_0x4c1e77||0xc8;return function(_0x201750){if(_0x201750){return _0x2d7b35['status'](_0x4c1e77)[_0x75fe('0x1a')](_0x201750);}};}function respondWithFilteredResult(_0x15205c,_0x4e1446){return function(_0x3b315f){if(_0x3b315f){var _0x4c28ab=typeof _0x4e1446[_0x75fe('0x1b')]===_0x75fe('0x1c')&&typeof _0x4e1446[_0x75fe('0x1d')]===_0x75fe('0x1c');var _0x4399b1=_0x3b315f[_0x75fe('0x1e')];var _0x52205f=_0x4c28ab?0x0:_0x4e1446[_0x75fe('0x1b')];var _0x4b8e31=_0x4c28ab?_0x3b315f[_0x75fe('0x1e')]:_0x4e1446[_0x75fe('0x1b')]+_0x4e1446[_0x75fe('0x1d')];var _0x1119cb;if(_0x4b8e31>=_0x4399b1){_0x4b8e31=_0x4399b1;_0x1119cb=0xc8;}else{_0x1119cb=0xce;}_0x15205c[_0x75fe('0x1f')](_0x1119cb);return _0x15205c[_0x75fe('0x20')]('Content-Range',_0x52205f+'-'+_0x4b8e31+'/'+_0x4399b1)[_0x75fe('0x1a')](_0x3b315f);}return null;};}function patchUpdates(_0x3b7b85){return function(_0x28791e){try{jsonpatch[_0x75fe('0x21')](_0x28791e,_0x3b7b85,!![]);}catch(_0x267dab){return BPromise[_0x75fe('0x22')](_0x267dab);}return _0x28791e[_0x75fe('0x23')]();};}function saveUpdates(_0x3a27f5,_0x1b5996){return function(_0x2359ec){if(_0x2359ec){return _0x2359ec[_0x75fe('0x24')](_0x3a27f5)['then'](function(_0x299f68){return _0x299f68;});}return null;};}function removeEntity(_0x4c6115,_0xfe454d){return function(_0x21a26f){if(_0x21a26f){return _0x21a26f[_0x75fe('0x25')]()[_0x75fe('0x26')](function(){_0x4c6115[_0x75fe('0x1f')](0xcc)[_0x75fe('0x27')]();});}};}function handleEntityNotFound(_0x1fe77b,_0x434299){return function(_0x47b85b){if(!_0x47b85b){_0x1fe77b['sendStatus'](0x194);}return _0x47b85b;};}function handleError(_0x3098b2,_0x149c7e){_0x149c7e=_0x149c7e||0x1f4;return function(_0x3afb2a){logger['error'](_0x3afb2a[_0x75fe('0x28')]);if(_0x3afb2a[_0x75fe('0x29')]){delete _0x3afb2a['name'];}_0x3098b2[_0x75fe('0x1f')](_0x149c7e)['send'](_0x3afb2a);};}exports[_0x75fe('0x2a')]=function(_0x21e6d8,_0x36e0f2){var _0x19fd3e={},_0x1b3d5f={},_0x174a9d={'count':0x0,'rows':[]};var _0x451284=_[_0x75fe('0x2b')](db['FaxApplication'][_0x75fe('0x2c')],function(_0x56f556){return{'name':_0x56f556[_0x75fe('0x2d')],'type':_0x56f556[_0x75fe('0x2e')][_0x75fe('0x2f')]};});_0x1b3d5f['model']=_[_0x75fe('0x2b')](_0x451284,_0x75fe('0x29'));_0x1b3d5f[_0x75fe('0x30')]=_[_0x75fe('0x31')](_0x21e6d8[_0x75fe('0x30')]);_0x1b3d5f[_0x75fe('0x32')]=_[_0x75fe('0x33')](_0x1b3d5f[_0x75fe('0x34')],_0x1b3d5f[_0x75fe('0x30')]);_0x19fd3e['attributes']=_[_0x75fe('0x33')](_0x1b3d5f['model'],qs[_0x75fe('0x35')](_0x21e6d8[_0x75fe('0x30')][_0x75fe('0x35')]));_0x19fd3e[_0x75fe('0x36')]=_0x19fd3e[_0x75fe('0x36')][_0x75fe('0x37')]?_0x19fd3e[_0x75fe('0x36')]:_0x1b3d5f['model'];if(!_0x21e6d8[_0x75fe('0x30')][_0x75fe('0x38')]('nolimit')){_0x19fd3e['limit']=qs[_0x75fe('0x1d')](_0x21e6d8[_0x75fe('0x30')][_0x75fe('0x1d')]);_0x19fd3e[_0x75fe('0x1b')]=qs[_0x75fe('0x1b')](_0x21e6d8[_0x75fe('0x30')][_0x75fe('0x1b')]);}_0x19fd3e[_0x75fe('0x39')]=qs['sort'](_0x21e6d8[_0x75fe('0x30')][_0x75fe('0x3a')]);_0x19fd3e['where']=qs[_0x75fe('0x32')](_[_0x75fe('0x3b')](_0x21e6d8[_0x75fe('0x30')],_0x1b3d5f['filters']),_0x451284);if(_0x21e6d8[_0x75fe('0x30')][_0x75fe('0x3c')]){_0x19fd3e[_0x75fe('0x3d')]=_[_0x75fe('0x3e')](_0x19fd3e[_0x75fe('0x3d')],{'$or':_[_0x75fe('0x2b')](_0x451284,function(_0x24e5a0){if(_0x24e5a0[_0x75fe('0x2e')]!==_0x75fe('0x3f')){var _0x3cf184={};_0x3cf184[_0x24e5a0[_0x75fe('0x29')]]={'$like':'%'+_0x21e6d8[_0x75fe('0x30')][_0x75fe('0x3c')]+'%'};return _0x3cf184;}})});}_0x19fd3e=_['merge']({},_0x19fd3e,_0x21e6d8[_0x75fe('0x40')]);var _0x52bc89={'where':_0x19fd3e['where']};return db[_0x75fe('0x41')]['count'](_0x52bc89)[_0x75fe('0x26')](function(_0x56a2a0){_0x174a9d[_0x75fe('0x1e')]=_0x56a2a0;if(_0x21e6d8['query'][_0x75fe('0x42')]){_0x19fd3e[_0x75fe('0x43')]=[{'all':!![]}];}return db['FaxApplication'][_0x75fe('0x44')](_0x19fd3e);})[_0x75fe('0x26')](function(_0x50fda2){_0x174a9d[_0x75fe('0x45')]=_0x50fda2;return _0x174a9d;})[_0x75fe('0x26')](respondWithFilteredResult(_0x36e0f2,_0x19fd3e))[_0x75fe('0x46')](handleError(_0x36e0f2,null));};exports['show']=function(_0x47b371,_0x5372d4){var _0x1789ce={'raw':!![],'where':{'id':_0x47b371[_0x75fe('0x47')]['id']}},_0x4bacae={};_0x4bacae[_0x75fe('0x34')]=_['keys'](db['FaxApplication'][_0x75fe('0x2c')]);_0x4bacae[_0x75fe('0x30')]=_['keys'](_0x47b371['query']);_0x4bacae[_0x75fe('0x32')]=_[_0x75fe('0x33')](_0x4bacae[_0x75fe('0x34')],_0x4bacae['query']);_0x1789ce[_0x75fe('0x36')]=_[_0x75fe('0x33')](_0x4bacae[_0x75fe('0x34')],qs[_0x75fe('0x35')](_0x47b371['query'][_0x75fe('0x35')]));_0x1789ce[_0x75fe('0x36')]=_0x1789ce[_0x75fe('0x36')][_0x75fe('0x37')]?_0x1789ce['attributes']:_0x4bacae[_0x75fe('0x34')];if(_0x47b371[_0x75fe('0x30')][_0x75fe('0x42')]){_0x1789ce[_0x75fe('0x43')]=[{'all':!![]}];}_0x1789ce=_[_0x75fe('0x3e')]({},_0x1789ce,_0x47b371[_0x75fe('0x40')]);return db['FaxApplication'][_0x75fe('0x48')](_0x1789ce)['then'](handleEntityNotFound(_0x5372d4,null))['then'](respondWithResult(_0x5372d4,null))['catch'](handleError(_0x5372d4,null));};exports[_0x75fe('0x49')]=function(_0x2a9fcf,_0x5baadd){return db['FaxApplication'][_0x75fe('0x49')](_0x2a9fcf[_0x75fe('0x4a')],{})[_0x75fe('0x26')](respondWithResult(_0x5baadd,0xc9))[_0x75fe('0x46')](handleError(_0x5baadd,null));};exports[_0x75fe('0x24')]=function(_0xab507d,_0x307a15){if(_0xab507d[_0x75fe('0x4a')]['id']){delete _0xab507d[_0x75fe('0x4a')]['id'];}return db[_0x75fe('0x41')][_0x75fe('0x48')]({'where':{'id':_0xab507d['params']['id']}})['then'](handleEntityNotFound(_0x307a15,null))[_0x75fe('0x26')](saveUpdates(_0xab507d['body'],null))[_0x75fe('0x26')](respondWithResult(_0x307a15,null))[_0x75fe('0x46')](handleError(_0x307a15,null));};exports[_0x75fe('0x25')]=function(_0x45c6df,_0x4195d0){return db['FaxApplication']['find']({'where':{'id':_0x45c6df[_0x75fe('0x47')]['id']}})[_0x75fe('0x26')](handleEntityNotFound(_0x4195d0,null))[_0x75fe('0x26')](removeEntity(_0x4195d0,null))['catch'](handleError(_0x4195d0,null));}; \ No newline at end of file +var _0x495e=['query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','keys','find','catch','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model'];(function(_0x409fa8,_0x3bd8d2){var _0x2642a4=function(_0x15f9a8){while(--_0x15f9a8){_0x409fa8['push'](_0x409fa8['shift']());}};_0x2642a4(++_0x3bd8d2);}(_0x495e,0x140));var _0xe495=function(_0x3d86f5,_0x257914){_0x3d86f5=_0x3d86f5-0x0;var _0x2d6881=_0x495e[_0x3d86f5];return _0x2d6881;};'use strict';var emlformat=require(_0xe495('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe495('0x1'));var jsonpatch=require(_0xe495('0x2'));var rp=require(_0xe495('0x3'));var moment=require(_0xe495('0x4'));var BPromise=require(_0xe495('0x5'));var Mustache=require(_0xe495('0x6'));var util=require(_0xe495('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe495('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe495('0x9'));var squel=require(_0xe495('0xa'));var crypto=require(_0xe495('0xb'));var jsforce=require(_0xe495('0xc'));var deskjs=require(_0xe495('0xd'));var toCsv=require(_0xe495('0x8'));var querystring=require('querystring');var Papa=require(_0xe495('0xe'));var Redis=require(_0xe495('0xf'));var authService=require(_0xe495('0x10'));var qs=require(_0xe495('0x11'));var as=require(_0xe495('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe495('0x13'))(_0xe495('0x14'));var utils=require(_0xe495('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe495('0x16'));var db=require(_0xe495('0x17'))['db'];function respondWithStatusCode(_0x3928ec,_0x24a44b){_0x24a44b=_0x24a44b||0xcc;return function(_0x3e40ea){if(_0x3e40ea){return _0x3928ec[_0xe495('0x18')](_0x24a44b);}return _0x3928ec[_0xe495('0x19')](_0x24a44b)[_0xe495('0x1a')]();};}function respondWithResult(_0x175477,_0x132257){_0x132257=_0x132257||0xc8;return function(_0x3f668f){if(_0x3f668f){return _0x175477['status'](_0x132257)[_0xe495('0x1b')](_0x3f668f);}};}function respondWithFilteredResult(_0x2000a4,_0x3777ff){return function(_0x4901b3){if(_0x4901b3){var _0x26deab=typeof _0x3777ff[_0xe495('0x1c')]===_0xe495('0x1d')&&typeof _0x3777ff[_0xe495('0x1e')]===_0xe495('0x1d');var _0xb919db=_0x4901b3[_0xe495('0x1f')];var _0x4903b=_0x26deab?0x0:_0x3777ff[_0xe495('0x1c')];var _0x1831a2=_0x26deab?_0x4901b3[_0xe495('0x1f')]:_0x3777ff[_0xe495('0x1c')]+_0x3777ff[_0xe495('0x1e')];var _0x1a6232;if(_0x1831a2>=_0xb919db){_0x1831a2=_0xb919db;_0x1a6232=0xc8;}else{_0x1a6232=0xce;}_0x2000a4['status'](_0x1a6232);return _0x2000a4[_0xe495('0x20')](_0xe495('0x21'),_0x4903b+'-'+_0x1831a2+'/'+_0xb919db)[_0xe495('0x1b')](_0x4901b3);}return null;};}function patchUpdates(_0x3a86a2){return function(_0x202af1){try{jsonpatch[_0xe495('0x22')](_0x202af1,_0x3a86a2,!![]);}catch(_0x5f50bc){return BPromise['reject'](_0x5f50bc);}return _0x202af1[_0xe495('0x23')]();};}function saveUpdates(_0x3fb521,_0xf2787a){return function(_0x8bdd73){if(_0x8bdd73){return _0x8bdd73['update'](_0x3fb521)[_0xe495('0x24')](function(_0x4351ec){return _0x4351ec;});}return null;};}function removeEntity(_0x42e358,_0x2af031){return function(_0x2b779f){if(_0x2b779f){return _0x2b779f[_0xe495('0x25')]()[_0xe495('0x24')](function(){_0x42e358['status'](0xcc)[_0xe495('0x1a')]();});}};}function handleEntityNotFound(_0x2a68e6,_0x57a31b){return function(_0x260572){if(!_0x260572){_0x2a68e6[_0xe495('0x18')](0x194);}return _0x260572;};}function handleError(_0x40c702,_0x1a8fbb){_0x1a8fbb=_0x1a8fbb||0x1f4;return function(_0x2665cd){logger[_0xe495('0x26')](_0x2665cd[_0xe495('0x27')]);if(_0x2665cd[_0xe495('0x28')]){delete _0x2665cd['name'];}_0x40c702['status'](_0x1a8fbb)[_0xe495('0x29')](_0x2665cd);};}exports[_0xe495('0x2a')]=function(_0x4c089a,_0x4ac4f9){var _0x106e38={},_0x44f0e9={},_0x405fce={'count':0x0,'rows':[]};var _0x5c3b61=_[_0xe495('0x2b')](db[_0xe495('0x2c')][_0xe495('0x2d')],function(_0x4cf8d2){return{'name':_0x4cf8d2[_0xe495('0x2e')],'type':_0x4cf8d2[_0xe495('0x2f')][_0xe495('0x30')]};});_0x44f0e9[_0xe495('0x31')]=_['map'](_0x5c3b61,_0xe495('0x28'));_0x44f0e9[_0xe495('0x32')]=_['keys'](_0x4c089a[_0xe495('0x32')]);_0x44f0e9[_0xe495('0x33')]=_[_0xe495('0x34')](_0x44f0e9[_0xe495('0x31')],_0x44f0e9[_0xe495('0x32')]);_0x106e38[_0xe495('0x35')]=_[_0xe495('0x34')](_0x44f0e9['model'],qs['fields'](_0x4c089a[_0xe495('0x32')][_0xe495('0x36')]));_0x106e38[_0xe495('0x35')]=_0x106e38[_0xe495('0x35')][_0xe495('0x37')]?_0x106e38[_0xe495('0x35')]:_0x44f0e9[_0xe495('0x31')];if(!_0x4c089a['query'][_0xe495('0x38')]('nolimit')){_0x106e38[_0xe495('0x1e')]=qs[_0xe495('0x1e')](_0x4c089a[_0xe495('0x32')][_0xe495('0x1e')]);_0x106e38['offset']=qs[_0xe495('0x1c')](_0x4c089a[_0xe495('0x32')]['offset']);}_0x106e38[_0xe495('0x39')]=qs[_0xe495('0x3a')](_0x4c089a['query'][_0xe495('0x3a')]);_0x106e38[_0xe495('0x3b')]=qs['filters'](_['pick'](_0x4c089a[_0xe495('0x32')],_0x44f0e9[_0xe495('0x33')]),_0x5c3b61);if(_0x4c089a[_0xe495('0x32')][_0xe495('0x3c')]){_0x106e38[_0xe495('0x3b')]=_[_0xe495('0x3d')](_0x106e38['where'],{'$or':_[_0xe495('0x2b')](_0x5c3b61,function(_0x3a8ec9){if(_0x3a8ec9[_0xe495('0x2f')]!==_0xe495('0x3e')){var _0x22838b={};_0x22838b[_0x3a8ec9['name']]={'$like':'%'+_0x4c089a[_0xe495('0x32')][_0xe495('0x3c')]+'%'};return _0x22838b;}})});}_0x106e38=_[_0xe495('0x3d')]({},_0x106e38,_0x4c089a[_0xe495('0x3f')]);var _0x13dd20={'where':_0x106e38[_0xe495('0x3b')]};return db[_0xe495('0x2c')][_0xe495('0x1f')](_0x13dd20)[_0xe495('0x24')](function(_0x340159){_0x405fce[_0xe495('0x1f')]=_0x340159;if(_0x4c089a[_0xe495('0x32')][_0xe495('0x40')]){_0x106e38['include']=[{'all':!![]}];}return db[_0xe495('0x2c')][_0xe495('0x41')](_0x106e38);})['then'](function(_0x58dad1){_0x405fce['rows']=_0x58dad1;return _0x405fce;})[_0xe495('0x24')](respondWithFilteredResult(_0x4ac4f9,_0x106e38))['catch'](handleError(_0x4ac4f9,null));};exports[_0xe495('0x42')]=function(_0x35b783,_0x5d5561){var _0x3bf93c={'raw':!![],'where':{'id':_0x35b783[_0xe495('0x43')]['id']}},_0x435858={};_0x435858['model']=_[_0xe495('0x44')](db[_0xe495('0x2c')][_0xe495('0x2d')]);_0x435858[_0xe495('0x32')]=_[_0xe495('0x44')](_0x35b783[_0xe495('0x32')]);_0x435858[_0xe495('0x33')]=_[_0xe495('0x34')](_0x435858[_0xe495('0x31')],_0x435858['query']);_0x3bf93c[_0xe495('0x35')]=_[_0xe495('0x34')](_0x435858[_0xe495('0x31')],qs['fields'](_0x35b783[_0xe495('0x32')][_0xe495('0x36')]));_0x3bf93c[_0xe495('0x35')]=_0x3bf93c[_0xe495('0x35')][_0xe495('0x37')]?_0x3bf93c[_0xe495('0x35')]:_0x435858[_0xe495('0x31')];if(_0x35b783['query'][_0xe495('0x40')]){_0x3bf93c['include']=[{'all':!![]}];}_0x3bf93c=_['merge']({},_0x3bf93c,_0x35b783['options']);return db[_0xe495('0x2c')][_0xe495('0x45')](_0x3bf93c)['then'](handleEntityNotFound(_0x5d5561,null))[_0xe495('0x24')](respondWithResult(_0x5d5561,null))[_0xe495('0x46')](handleError(_0x5d5561,null));};exports['create']=function(_0x7de1ec,_0xa441ba){return db[_0xe495('0x2c')][_0xe495('0x47')](_0x7de1ec[_0xe495('0x48')],{})[_0xe495('0x24')](respondWithResult(_0xa441ba,0xc9))[_0xe495('0x46')](handleError(_0xa441ba,null));};exports[_0xe495('0x49')]=function(_0x28a7c7,_0x313053){if(_0x28a7c7[_0xe495('0x48')]['id']){delete _0x28a7c7[_0xe495('0x48')]['id'];}return db['FaxApplication'][_0xe495('0x45')]({'where':{'id':_0x28a7c7[_0xe495('0x43')]['id']}})[_0xe495('0x24')](handleEntityNotFound(_0x313053,null))[_0xe495('0x24')](saveUpdates(_0x28a7c7[_0xe495('0x48')],null))[_0xe495('0x24')](respondWithResult(_0x313053,null))[_0xe495('0x46')](handleError(_0x313053,null));};exports[_0xe495('0x25')]=function(_0x3bcb93,_0x59697d){return db[_0xe495('0x2c')][_0xe495('0x45')]({'where':{'id':_0x3bcb93[_0xe495('0x43')]['id']}})[_0xe495('0x24')](handleEntityNotFound(_0x59697d,null))[_0xe495('0x24')](removeEntity(_0x59697d,null))[_0xe495('0x46')](handleError(_0x59697d,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 14f146c..4a8112f 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 _0x9a69=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','FaxApplication'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0x9a69,0x121));var _0x99a6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9a69[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x99a6('0x0'));var util=require(_0x99a6('0x1'));var logger=require(_0x99a6('0x2'))(_0x99a6('0x3'));var moment=require(_0x99a6('0x4'));var BPromise=require(_0x99a6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x99a6('0x6'));var config=require(_0x99a6('0x7'));var attributes=require('./faxApplication.attributes');module[_0x99a6('0x8')]=function(_0x187beb,_0x2524b5){return _0x187beb[_0x99a6('0x9')](_0x99a6('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x99a6('0xb')});}; \ No newline at end of file +var _0x0faf=['bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x0faf,0xfc));var _0xf0fa=function(_0x221637,_0x42a5e0){_0x221637=_0x221637-0x0;var _0x11bf9e=_0x0faf[_0x221637];return _0x11bf9e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf0fa('0x0'))(_0xf0fa('0x1'));var moment=require(_0xf0fa('0x2'));var BPromise=require(_0xf0fa('0x3'));var rp=require(_0xf0fa('0x4'));var fs=require('fs');var path=require(_0xf0fa('0x5'));var rimraf=require(_0xf0fa('0x6'));var config=require(_0xf0fa('0x7'));var attributes=require(_0xf0fa('0x8'));module[_0xf0fa('0x9')]=function(_0x36b1e7,_0x39c7c9){return _0x36b1e7[_0xf0fa('0xa')](_0xf0fa('0xb'),attributes,{'tableName':_0xf0fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf0fa('0xd'),'collate':_0xf0fa('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 970eb8c..a584cc7 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 _0x656c=['result','catch','FaxApplication','update','body','options','raw','where','limit','UpdateFaxApplication','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x527e31,_0x158c09){var _0x4d3bb0=function(_0x1b672e){while(--_0x1b672e){_0x527e31['push'](_0x527e31['shift']());}};_0x4d3bb0(++_0x158c09);}(_0x656c,0x6a));var _0xc656=function(_0x24dfd7,_0x36da84){_0x24dfd7=_0x24dfd7-0x0;var _0xb0cd27=_0x656c[_0x24dfd7];return _0xb0cd27;};'use strict';var _=require('lodash');var util=require(_0xc656('0x0'));var moment=require(_0xc656('0x1'));var BPromise=require(_0xc656('0x2'));var rs=require(_0xc656('0x3'));var fs=require('fs');var Redis=require(_0xc656('0x4'));var db=require(_0xc656('0x5'))['db'];var utils=require(_0xc656('0x6'));var logger=require(_0xc656('0x7'))(_0xc656('0x8'));var config=require(_0xc656('0x9'));var jayson=require(_0xc656('0xa'));var client=jayson[_0xc656('0xb')][_0xc656('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36bb55,_0x299fe6,_0x455747){return new BPromise(function(_0x2de1dc,_0x595e94){return client['request'](_0x36bb55,_0x455747)[_0xc656('0xd')](function(_0x500739){logger[_0xc656('0xe')](_0xc656('0xf'),_0x299fe6,_0xc656('0x10'));logger[_0xc656('0x11')](_0xc656('0x12'),_0x299fe6,'request\x20sent',JSON['stringify'](_0x500739));if(_0x500739['error']){if(_0x500739['error'][_0xc656('0x13')]===0x1f4){logger['error'](_0xc656('0xf'),_0x299fe6,_0x500739[_0xc656('0x14')]['message']);return _0x595e94(_0x500739[_0xc656('0x14')][_0xc656('0x15')]);}logger['error'](_0xc656('0xf'),_0x299fe6,_0x500739['error'][_0xc656('0x15')]);return _0x2de1dc(_0x500739[_0xc656('0x14')][_0xc656('0x15')]);}else{logger[_0xc656('0xe')](_0xc656('0xf'),_0x299fe6,_0xc656('0x10'));_0x2de1dc(_0x500739[_0xc656('0x16')]['message']);}})[_0xc656('0x17')](function(_0x396d56){logger[_0xc656('0x14')](_0xc656('0xf'),_0x299fe6,_0x396d56);_0x595e94(_0x396d56);});});}exports['UpdateFaxApplication']=function(_0x37d22f){var _0x3baa3f=this;return new Promise(function(_0x1ac27c,_0x138795){return db[_0xc656('0x18')][_0xc656('0x19')](_0x37d22f[_0xc656('0x1a')],{'raw':_0x37d22f[_0xc656('0x1b')]?_0x37d22f[_0xc656('0x1b')][_0xc656('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37d22f['options']?_0x37d22f['options'][_0xc656('0x1d')]||null:null,'attributes':_0x37d22f['options']?_0x37d22f['options']['attributes']||null:null,'limit':_0x37d22f[_0xc656('0x1b')]?_0x37d22f[_0xc656('0x1b')][_0xc656('0x1e')]||null:null})['then'](function(_0xeb77db){logger['info'](_0xc656('0x1f'),_0x37d22f);logger['debug']('UpdateFaxApplication',_0x37d22f,JSON['stringify'](_0xeb77db));_0x1ac27c(_0xeb77db);})[_0xc656('0x17')](function(_0x448f0e){logger[_0xc656('0x14')]('UpdateFaxApplication',_0x448f0e[_0xc656('0x15')],_0x37d22f);_0x138795(_0x3baa3f[_0xc656('0x14')](0x1f4,_0x448f0e[_0xc656('0x15')]));});});}; \ No newline at end of file +var _0xe513=['options','where','attributes','limit','UpdateFaxApplication','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxApplication'];(function(_0x5531b4,_0x4d9d33){var _0x344b6d=function(_0x273879){while(--_0x273879){_0x5531b4['push'](_0x5531b4['shift']());}};_0x344b6d(++_0x4d9d33);}(_0xe513,0x18b));var _0x3e51=function(_0x2587c9,_0x52e319){_0x2587c9=_0x2587c9-0x0;var _0xc843ba=_0xe513[_0x2587c9];return _0xc843ba;};'use strict';var _=require('lodash');var util=require(_0x3e51('0x0'));var moment=require(_0x3e51('0x1'));var BPromise=require(_0x3e51('0x2'));var rs=require(_0x3e51('0x3'));var fs=require('fs');var Redis=require(_0x3e51('0x4'));var db=require(_0x3e51('0x5'))['db'];var utils=require(_0x3e51('0x6'));var logger=require(_0x3e51('0x7'))(_0x3e51('0x8'));var config=require(_0x3e51('0x9'));var jayson=require(_0x3e51('0xa'));var client=jayson[_0x3e51('0xb')][_0x3e51('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33593b,_0x5ac574,_0x320a25){return new BPromise(function(_0x223adf,_0x86f7ef){return client['request'](_0x33593b,_0x320a25)[_0x3e51('0xd')](function(_0x2ac780){logger[_0x3e51('0xe')](_0x3e51('0xf'),_0x5ac574,_0x3e51('0x10'));logger[_0x3e51('0x11')](_0x3e51('0x12'),_0x5ac574,_0x3e51('0x10'),JSON[_0x3e51('0x13')](_0x2ac780));if(_0x2ac780[_0x3e51('0x14')]){if(_0x2ac780[_0x3e51('0x14')][_0x3e51('0x15')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x5ac574,_0x2ac780['error'][_0x3e51('0x16')]);return _0x86f7ef(_0x2ac780['error'][_0x3e51('0x16')]);}logger[_0x3e51('0x14')](_0x3e51('0xf'),_0x5ac574,_0x2ac780[_0x3e51('0x14')]['message']);return _0x223adf(_0x2ac780[_0x3e51('0x14')][_0x3e51('0x16')]);}else{logger['info'](_0x3e51('0xf'),_0x5ac574,_0x3e51('0x10'));_0x223adf(_0x2ac780['result']['message']);}})[_0x3e51('0x17')](function(_0x4336da){logger['error']('FaxApplication,\x20%s,\x20%s',_0x5ac574,_0x4336da);_0x86f7ef(_0x4336da);});});}exports['UpdateFaxApplication']=function(_0x248902){var _0x54875d=this;return new Promise(function(_0x2257c2,_0x3734ae){return db[_0x3e51('0x18')]['update'](_0x248902['body'],{'raw':_0x248902[_0x3e51('0x19')]?_0x248902[_0x3e51('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x248902['options']?_0x248902[_0x3e51('0x19')][_0x3e51('0x1a')]||null:null,'attributes':_0x248902['options']?_0x248902[_0x3e51('0x19')][_0x3e51('0x1b')]||null:null,'limit':_0x248902[_0x3e51('0x19')]?_0x248902[_0x3e51('0x19')][_0x3e51('0x1c')]||null:null})[_0x3e51('0xd')](function(_0x469399){logger[_0x3e51('0xe')](_0x3e51('0x1d'),_0x248902);logger['debug'](_0x3e51('0x1d'),_0x248902,JSON[_0x3e51('0x13')](_0x469399));_0x2257c2(_0x469399);})['catch'](function(_0x64b69){logger[_0x3e51('0x14')](_0x3e51('0x1d'),_0x64b69['message'],_0x248902);_0x3734ae(_0x54875d[_0x3e51('0x14')](0x1f4,_0x64b69[_0x3e51('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 7af1f63..4715e15 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 _0xea28=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xea28,0x13a));var _0x8ea2=function(_0x2cddce,_0x521947){_0x2cddce=_0x2cddce-0x0;var _0x3968b5=_0xea28[_0x2cddce];return _0x3968b5;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xf')]('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0x11')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x12')]);router['delete']('/:id',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);module[_0x8ea2('0x14')]=router; \ No newline at end of file +var _0x0b0e=['./faxApplication.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x355de0,_0x3e1d21){var _0xad0de2=function(_0x5ac42d){while(--_0x5ac42d){_0x355de0['push'](_0x355de0['shift']());}};_0xad0de2(++_0x3e1d21);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0x0b0e[_0x2f0057];return _0x17f2c3;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 5b92eaa..e135d88 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 _0x218f=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x57198f,_0x339fd0){var _0x117da4=function(_0x359cc0){while(--_0x359cc0){_0x57198f['push'](_0x57198f['shift']());}};_0x117da4(++_0x339fd0);}(_0x218f,0xc4));var _0xf218=function(_0x13bc6d,_0x58c89f){_0x13bc6d=_0x13bc6d-0x0;var _0x1b9a6a=_0x218f[_0x13bc6d];return _0x1b9a6a;};'use strict';var Sequelize=require(_0xf218('0x0'));module[_0xf218('0x1')]={'closed':{'type':Sequelize[_0xf218('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf218('0x3')]},'disposition':{'type':Sequelize[_0xf218('0x4')]},'secondDisposition':{'type':Sequelize[_0xf218('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf218('0x4')]},'read1stAt':{'type':Sequelize[_0xf218('0x3')]},'fax':{'type':Sequelize[_0xf218('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf218('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf218('0x5')]('in',_0xf218('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x686b=['DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x2242cc,_0x536932){var _0x368558=function(_0x1c091c){while(--_0x1c091c){_0x2242cc['push'](_0x2242cc['shift']());}};_0x368558(++_0x536932);}(_0x686b,0x130));var _0xb686=function(_0x4db2a6,_0xe43814){_0x4db2a6=_0x4db2a6-0x0;var _0x57caa1=_0x686b[_0x4db2a6];return _0x57caa1;};'use strict';var Sequelize=require(_0xb686('0x0'));module[_0xb686('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb686('0x2')]},'disposition':{'type':Sequelize[_0xb686('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb686('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb686('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xb686('0x4')]('in',_0xb686('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb686('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xb686('0x4')]('in',_0xb686('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 24b51f6..3d06f6b 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 _0x0434=['talking','answered','unmanaged','total','waiting','closed','UserId','index','map','FaxInteraction','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','field','color','from','tools_tags','select','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','split','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','text','body','type','some','compact','isEmpty','forEach','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','options','create','update','describe','addMessage','FaxMessage','ids','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','omit','emit','faxInteractionTags:save','removeTags','join','root','tmp','server','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','createReadStream','createWriteStream','log','unlinkSync','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','then','sendStatus','error','stack','name','send','Users','fullname','TagIds','Tags','push','catch'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0434,0xa4));var _0x4043=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x0434[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4043('0x0'));var jsonpatch=require(_0x4043('0x1'));var rp=require('request-promise');var moment=require(_0x4043('0x2'));var BPromise=require(_0x4043('0x3'));var Mustache=require(_0x4043('0x4'));var util=require(_0x4043('0x5'));var path=require(_0x4043('0x6'));var sox=require(_0x4043('0x7'));var csv=require(_0x4043('0x8'));var ejs=require(_0x4043('0x9'));var fs=require('fs');var fs_extra=require(_0x4043('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4043('0xb'));var jsforce=require(_0x4043('0xc'));var deskjs=require(_0x4043('0xd'));var toCsv=require(_0x4043('0x8'));var querystring=require(_0x4043('0xe'));var Papa=require(_0x4043('0xf'));var Redis=require(_0x4043('0x10'));var authService=require(_0x4043('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4043('0x12'));var hardwareService=require(_0x4043('0x13'));var logger=require(_0x4043('0x14'))(_0x4043('0x15'));var utils=require(_0x4043('0x16'));var config=require(_0x4043('0x17'));var licenseUtil=require(_0x4043('0x18'));var db=require(_0x4043('0x19'))['db'];config[_0x4043('0x1a')]=_[_0x4043('0x1b')](config[_0x4043('0x1a')],{'host':_0x4043('0x1c'),'port':0x18eb});var socket=require(_0x4043('0x1d'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x4043('0x1e')](socket);function respondWithStatusCode(_0x8ced01,_0x54b28f){_0x54b28f=_0x54b28f||0xcc;return function(_0x5dc142){if(_0x5dc142){return _0x8ced01['sendStatus'](_0x54b28f);}return _0x8ced01[_0x4043('0x1f')](_0x54b28f)[_0x4043('0x20')]();};}function respondWithResult(_0x5bde8b,_0x5d62cb){_0x5d62cb=_0x5d62cb||0xc8;return function(_0x5e51fa){if(_0x5e51fa){return _0x5bde8b['status'](_0x5d62cb)['json'](_0x5e51fa);}};}function respondWithFilteredResult(_0x401d5a,_0x39ae2f){return function(_0x18f77a){if(_0x18f77a){var _0x4a1087=typeof _0x39ae2f[_0x4043('0x21')]===_0x4043('0x22')&&typeof _0x39ae2f[_0x4043('0x23')]===_0x4043('0x22');var _0x2db772=_0x18f77a[_0x4043('0x24')];var _0x442376=_0x4a1087?0x0:_0x39ae2f['offset'];var _0x21f89c=_0x4a1087?_0x18f77a['count']:_0x39ae2f['offset']+_0x39ae2f['limit'];var _0x4b25de;if(_0x21f89c>=_0x2db772){_0x21f89c=_0x2db772;_0x4b25de=0xc8;}else{_0x4b25de=0xce;}_0x401d5a[_0x4043('0x1f')](_0x4b25de);return _0x401d5a[_0x4043('0x25')](_0x4043('0x26'),_0x442376+'-'+_0x21f89c+'/'+_0x2db772)['json'](_0x18f77a);}return null;};}function patchUpdates(_0x5446f0){return function(_0x5bd7a2){try{jsonpatch[_0x4043('0x27')](_0x5bd7a2,_0x5446f0,!![]);}catch(_0x5d964b){return BPromise['reject'](_0x5d964b);}return _0x5bd7a2[_0x4043('0x28')]();};}function saveUpdates(_0x853b46,_0x11196e){return function(_0xfcbcbc){if(_0xfcbcbc){return _0xfcbcbc['update'](_0x853b46)[_0x4043('0x29')](function(_0x5de439){return _0x5de439;});}return null;};}function removeEntity(_0xee6c83,_0x16259b){return function(_0x23e5dd){if(_0x23e5dd){return _0x23e5dd['destroy']()['then'](function(){_0xee6c83[_0x4043('0x1f')](0xcc)[_0x4043('0x20')]();});}};}function handleEntityNotFound(_0x1b3022,_0x47e9f2){return function(_0x3a697c){if(!_0x3a697c){_0x1b3022[_0x4043('0x2a')](0x194);}return _0x3a697c;};}function handleError(_0x4877c9,_0x4c7ad9){_0x4c7ad9=_0x4c7ad9||0x1f4;return function(_0x334345){logger[_0x4043('0x2b')](_0x334345[_0x4043('0x2c')]);if(_0x334345[_0x4043('0x2d')]){delete _0x334345[_0x4043('0x2d')];}_0x4877c9[_0x4043('0x1f')](_0x4c7ad9)[_0x4043('0x2e')](_0x334345);};}function getInteractionUsers(_0x45f4ef,_0x4b1270){return new BPromise(function(_0x5536a9,_0x58c391){try{if(_0x4b1270[_0x45f4ef['id']]){_0x45f4ef[_0x4043('0x2f')]=_['map'](_0x4b1270[_0x45f4ef['id']],function(_0x242ebf){return{'id':_0x242ebf['id'],'fullname':_0x242ebf[_0x4043('0x30')]};});}}catch(_0x107297){_0x58c391(_0x107297);}_0x5536a9(_0x45f4ef);});}function getInteractionTags(_0x6e13da,_0x2dac1f){return new BPromise(function(_0x3fa5fb,_0x41157c){try{if(_0x6e13da[_0x4043('0x31')]){_0x6e13da[_0x4043('0x32')]=[];_0x6e13da[_0x4043('0x31')]['split'](',')['forEach'](function(_0x25820b){_0x6e13da[_0x4043('0x32')][_0x4043('0x33')](_0x2dac1f[_0x25820b]);});}delete _0x6e13da[_0x4043('0x31')];}catch(_0x5cb569){_0x41157c(_0x5cb569);}_0x3fa5fb(_0x6e13da);});}function updateFaxInteraction(_0x51b32c,_0x17e82e,_0x38b50a){return new BPromise(function(_0x545b25,_0xfe5455){return getInteractionUsers(_0x51b32c,_0x38b50a)[_0x4043('0x29')](function(_0xc68217){return getInteractionTags(_0xc68217,_0x17e82e);})[_0x4043('0x29')](function(_0x49bb3f){return getStateInteraction(_0x49bb3f);})[_0x4043('0x29')](function(_0x1e64c9){_0x545b25(_0x1e64c9);})[_0x4043('0x34')](function(_0x312536){_0xfe5455(_0x312536);});});}function getStateInteraction(_0x243b9e){return new BPromise(function(_0x3e4f7f){_0x243b9e['waiting']=0x0;_0x243b9e[_0x4043('0x35')]=0x0;_0x243b9e[_0x4043('0x36')]=0x0;_0x243b9e[_0x4043('0x37')]=0x0;_0x243b9e[_0x4043('0x38')]=0x0;if(!_0x243b9e['closed']&&!_0x243b9e['UserId']){_0x243b9e[_0x4043('0x39')]+=0x1;}if(!_0x243b9e[_0x4043('0x3a')]&&_0x243b9e['UserId']){_0x243b9e[_0x4043('0x35')]+=0x1;if(_0x243b9e[_0x4043('0x39')]){_0x243b9e['waiting']-=0x1;}}if(_0x243b9e['closed']&&_0x243b9e[_0x4043('0x3b')]){_0x243b9e[_0x4043('0x36')]+=0x1;if(_0x243b9e[_0x4043('0x35')]){_0x243b9e['talking']-=0x1;}}if(_0x243b9e[_0x4043('0x3a')]&&!_0x243b9e[_0x4043('0x3b')]){_0x243b9e[_0x4043('0x37')]+=0x1;if(_0x243b9e[_0x4043('0x39')]){_0x243b9e[_0x4043('0x39')]-=0x1;}}_0x243b9e['total']+=0x1;_0x3e4f7f(_0x243b9e);});}exports[_0x4043('0x3c')]=function(_0x2924e9,_0x5f2505){var _0x42af99={},_0x549213={},_0x3702={'count':0x0,'rows':[]};var _0x3650cf=_[_0x4043('0x3d')](db[_0x4043('0x3e')][_0x4043('0x3f')],function(_0x12d297){return{'name':_0x12d297[_0x4043('0x40')],'type':_0x12d297['type']['key']};});_0x549213[_0x4043('0x41')]=_[_0x4043('0x3d')](_0x3650cf,_0x4043('0x2d'));_0x549213[_0x4043('0x42')]=_[_0x4043('0x43')](_0x2924e9[_0x4043('0x42')]);_0x549213[_0x4043('0x44')]=_['intersection'](_0x549213[_0x4043('0x41')],_0x549213['query']);_0x42af99[_0x4043('0x45')]=_[_0x4043('0x46')](_0x549213[_0x4043('0x41')],qs[_0x4043('0x47')](_0x2924e9[_0x4043('0x42')]['fields']));_0x42af99[_0x4043('0x45')]=_0x42af99[_0x4043('0x45')][_0x4043('0x48')]?_0x42af99[_0x4043('0x45')]:_0x549213[_0x4043('0x41')];if(!_0x2924e9[_0x4043('0x42')][_0x4043('0x49')]('nolimit')){_0x42af99[_0x4043('0x23')]=qs[_0x4043('0x23')](_0x2924e9['query'][_0x4043('0x23')]);_0x42af99[_0x4043('0x21')]=qs[_0x4043('0x21')](_0x2924e9[_0x4043('0x42')]['offset']);}_0x42af99[_0x4043('0x4a')]=qs[_0x4043('0x4b')](_0x2924e9[_0x4043('0x42')]['sort']);_0x42af99[_0x4043('0x4c')]=qs[_0x4043('0x44')](_[_0x4043('0x4d')](_0x2924e9[_0x4043('0x42')],_0x549213[_0x4043('0x44')]),_0x3650cf);var _0x4d5059=[];var _0x1e7c33=squel['select']()[_0x4043('0x4e')]('id')[_0x4043('0x4e')](_0x4043('0x2d'))['field'](_0x4043('0x4f'))[_0x4043('0x50')](_0x4043('0x51'));var _0x417d94=squel[_0x4043('0x52')]()['field'](_0x4043('0x53'))[_0x4043('0x4e')]('u.fullname')[_0x4043('0x4e')](_0x4043('0x54'))[_0x4043('0x50')](_0x4043('0x55'),'ui')[_0x4043('0x56')](_0x4043('0x57'),'u','u.id\x20=\x20ui.UserId');var _0x2cd044=squel[_0x4043('0x52')]()[_0x4043('0x50')](_0x4043('0x58'),'i')[_0x4043('0x56')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4043('0x56')](_0x4043('0x57'),'o',_0x4043('0x59'))[_0x4043('0x56')](_0x4043('0x5a'),'a',_0x4043('0x5b'))[_0x4043('0x56')](_0x4043('0x5c'),'me',_0x4043('0x5d'))['left_join'](_0x4043('0x5e'),'it',_0x4043('0x5f'))[_0x4043('0x56')](_0x4043('0x51'),'t',_0x4043('0x60'));var _0x4170c6=squel[_0x4043('0x61')]();var _0x413757=[];var _0x4f69d9=squel[_0x4043('0x61')]();var _0x4019c7;if(_0x2924e9[_0x4043('0x42')][_0x4043('0x62')]){_0x4019c7=as[_0x4043('0x63')](_0x2924e9[_0x4043('0x42')][_0x4043('0x62')]);var _0x56e2a3=_0x4019c7[_0x4043('0x64')];for(var _0x13c2ed=0x0;_0x13c2ed<_0x4019c7[_0x4043('0x65')]['length'];_0x13c2ed++){var _0xc8f8b1=_0x4019c7['conditions'][_0x13c2ed];var _0x2d2c91='i';var _0x5c248d=_[_0x4043('0x66')](_0x3650cf,[_0x4043('0x2d'),_0xc8f8b1['field']]);if(!_0x5c248d){switch(_0xc8f8b1[_0x4043('0x4e')]){case _0x4043('0x67'):if(_0xc8f8b1[_0x4043('0x68')]==0x1){_0x2cd044[_0x4043('0x69')]('`'+_0xc8f8b1[_0x4043('0x4e')]+'`\x20=\x200');}else{_0x2cd044[_0x4043('0x69')]('`'+_0xc8f8b1[_0x4043('0x4e')]+_0x4043('0x6a'));}break;case _0x4043('0x6b'):if(_0xc8f8b1[_0x4043('0x6c')]==='$substring'){if(_0xc8f8b1['value'][_0x4043('0x6d')]('\x20')[_0x4043('0x48')]>0x1){_0x4170c6[_0x56e2a3]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xc8f8b1['value']),null);}else{var _0x4ae8de='%'+_0xc8f8b1[_0x4043('0x68')]+'%';_0x4170c6[_0x56e2a3]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4ae8de,_0x4ae8de,_0x4ae8de);}}else{_0x5c248d=_['find'](_0x3650cf,[_0x4043('0x2d'),'ContactId']);_0xc8f8b1[_0x4043('0x4e')]='ContactId';_0x48e0ef=as[_0x4043('0x6e')](_0x2d2c91,_0x5c248d['type'],_0xc8f8b1);_0x4170c6[_0x56e2a3](_0x48e0ef['text'],_0x48e0ef['value'][_0x4043('0x6f')],_0x48e0ef[_0x4043('0x68')]['end']);}break;case _0x4043('0x70'):var _0x779644=_0xc8f8b1[_0x4043('0x68')][_0x4043('0x6d')](',')['map'](function(_0x1743ad){return Number(_0x1743ad);});_0x779644['forEach'](function(_0x7380dc){_0x4f69d9['or'](_0x4043('0x71'),'%,'+_0x7380dc+',%');});_0x413757=_[_0x4043('0x72')](_0x413757,_0x779644);break;case _0x4043('0x73'):if(_0xc8f8b1[_0x4043('0x6c')]===_0x4043('0x74')){_0x4170c6[_0x56e2a3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xc8f8b1[_0x4043('0x68')]+'%',null);}else{_0x5c248d=_['find'](_0x3650cf,[_0x4043('0x2d'),_0x4043('0x3b')]);_0xc8f8b1[_0x4043('0x4e')]=_0x4043('0x3b');_0x48e0ef=as[_0x4043('0x6e')](_0x2d2c91,_0x5c248d['type'],_0xc8f8b1);_0x4170c6[_0x56e2a3](_0x48e0ef[_0x4043('0x75')],_0x48e0ef['value']['start'],_0x48e0ef[_0x4043('0x68')][_0x4043('0x20')]);}break;case _0x4043('0x76'):_0x48e0ef=as[_0x4043('0x6e')]('me',null,_0xc8f8b1);_0x4170c6[_0x56e2a3](_0x48e0ef['text'],_0x48e0ef[_0x4043('0x68')][_0x4043('0x6f')],_0x48e0ef[_0x4043('0x68')][_0x4043('0x20')]);break;}}else{var _0x48e0ef=as[_0x4043('0x6e')](_0x2d2c91,_0x5c248d[_0x4043('0x77')],_0xc8f8b1);_0x4170c6[_0x56e2a3](_0x48e0ef[_0x4043('0x75')],_0x48e0ef[_0x4043('0x68')][_0x4043('0x6f')],_0x48e0ef['value'][_0x4043('0x20')]);}}}else{var _0x390622=_(_0x2924e9[_0x4043('0x42')])[_0x4043('0x43')]()[_0x4043('0x3d')](function(_0xe52b10){return _[_0x4043('0x78')](_0x3650cf,[_0x4043('0x2d'),_0xe52b10])?_0xe52b10:undefined;})[_0x4043('0x79')]()[_0x4043('0x68')]();if(!_[_0x4043('0x7a')](_0x390622)){_0x390622[_0x4043('0x7b')](function(_0x3b3334){if(_0x3b3334==='FaxAccountId'){_0x2cd044[_0x4043('0x4c')]('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x2924e9[_0x4043('0x42')][_0x3b3334]));}else if(_0x3b3334===_0x4043('0x7c')){var _0x39bd14=JSON[_0x4043('0x7d')](_0x2924e9[_0x4043('0x42')][_0x3b3334])[_0x4043('0x7e')];var _0x201d67=JSON[_0x4043('0x7d')](_0x2924e9[_0x4043('0x42')][_0x3b3334])[_0x4043('0x7f')];_0x2cd044[_0x4043('0x4c')](_0x4043('0x80'),_0x39bd14,_0x201d67);}else{if(_0x2924e9[_0x4043('0x42')][_0x3b3334]==='null'){_0x2cd044['where']('i.'+_0x3b3334+_0x4043('0x81'));}else{_0x2cd044['where']('i.'+_0x3b3334+_0x4043('0x82'),_0x2924e9['query'][_0x3b3334]);}}});}if(_0x2924e9[_0x4043('0x42')][_0x4043('0x83')]){if(_0x2924e9['query'][_0x4043('0x83')]==0x1){_0x2cd044[_0x4043('0x69')]('`unreadMessages`\x20=\x200');}else{_0x2cd044[_0x4043('0x69')]('`unreadMessages`\x20>\x200');}}if(_0x2924e9[_0x4043('0x42')]['tag']){_0x413757=_[_0x4043('0x84')](_0x2924e9[_0x4043('0x42')]['tag'])?_0x2924e9[_0x4043('0x42')]['tag']:new Array(_0x2924e9[_0x4043('0x42')][_0x4043('0x85')]);_0x413757[_0x4043('0x7b')](function(_0x12d86b){_0x4f69d9['or'](_0x4043('0x71'),'%,'+_0x12d86b+',%');});}if(_0x2924e9[_0x4043('0x42')]['filter']){var _0x2e79c9=_0x2924e9[_0x4043('0x42')][_0x4043('0x86')][_0x4043('0x87')]('\x5c','\x5c\x5c')[_0x4043('0x87')](/'/g,'\x27\x27');if(qs[_0x4043('0x88')](_0x2e79c9)){_0x4170c6['or'](_0x4043('0x89'),_0x2e79c9+'%')['or'](_0x4043('0x8a'),_0x2e79c9+'%');}_0x4170c6['or'](_0x4043('0x8b'),_0x2e79c9+'%');}}_0x2cd044[_0x4043('0x4c')](_0x4170c6);_0x2cd044[_0x4043('0x8c')](_0x4043('0x8d'));var _0x43b3c7={'type':db[_0x4043('0x8e')][_0x4043('0x8f')][_0x4043('0x90')],'raw':!![]};var _0x1c4362=_0x2cd044[_0x4043('0x91')]();_0x1c4362[_0x4043('0x4e')](_0x4043('0x8d'));_0x1c4362[_0x4043('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4043('0x67'));if(_0x42af99[_0x4043('0x4a')]){_0x42af99[_0x4043('0x4a')]['forEach'](function(_0x21aa4c){var _0x47c5a3=_0x21aa4c[0x0]===_0x4043('0x92')?_0x21aa4c[0x0]:'i.'+_0x21aa4c[0x0];_0x2cd044[_0x4043('0x4a')](_0x47c5a3,_0x21aa4c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4043('0x7a')](_0x413757)){_0x2cd044[_0x4043('0x69')](_0x4f69d9);_0x1c4362[_0x4043('0x4c')](_0x4043('0x93'),_0x413757);}BPromise[_0x4043('0x94')]()[_0x4043('0x29')](function(){if(!_0x4019c7){if(_0x2924e9[_0x4043('0x42')]['FaxAccountId'])return;_0x1c4362[_0x4043('0x4c')](_0x4043('0x95'));_0x2cd044[_0x4043('0x4c')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2924e9[_0x4043('0x96')][_0x4043('0x97')]!=='agent')return;return _0x2924e9[_0x4043('0x96')][_0x4043('0x98')]({'attributes':['id'],'raw':!![]})[_0x4043('0x29')](function(_0x1f48b9){if(_['isEmpty'](_0x1f48b9)){_0x1c4362['where'](_0x4043('0x99'));_0x2cd044[_0x4043('0x4c')](_0x4043('0x99'));}else{_0x1c4362['where']('i.FaxAccountId\x20IN\x20?',_[_0x4043('0x3d')](_0x1f48b9,'id'));_0x2cd044[_0x4043('0x4c')](_0x4043('0x9a'),_['map'](_0x1f48b9,'id'));}});})[_0x4043('0x29')](function(){if(_0x2924e9[_0x4043('0x96')][_0x4043('0x97')]===_0x4043('0x9b')&&!_0x4019c7&&!_0x2924e9['query']['FaxAccountId'])return[];return db[_0x4043('0x9c')][_0x4043('0x42')](_0x1c4362[_0x4043('0x9d')](),_0x43b3c7);})['then'](function(_0x5c45e7){_0x3702[_0x4043('0x24')]=_0x5c45e7[_0x4043('0x48')];if(_0x3702[_0x4043('0x24')]===0x0)return[];return db[_0x4043('0x9c')][_0x4043('0x42')](_0x1e7c33[_0x4043('0x9d')](),_0x43b3c7)[_0x4043('0x29')](function(_0x1d5e1f){_0x4d5059=_[_0x4043('0x9e')](_0x1d5e1f,'id');_0x43b3c7=_[_0x4043('0x9f')](_0x43b3c7,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2924e9[_0x4043('0x42')][_0x4043('0x47')]){_0x42af99['attributes'][_0x4043('0x7b')](function(_0x1ad913){_0x2cd044[_0x4043('0x4e')]('i.'+_0x1ad913);});}else{_0x2cd044['field'](_0x4043('0xa0'),_0x4043('0x67'));_0x2cd044['field'](_0x4043('0xa1'),_0x4043('0xa2'));_0x2cd044[_0x4043('0x4e')](_0x4043('0xa3'),_0x4043('0xa4'));_0x2cd044[_0x4043('0x4e')](_0x4043('0xa5'),_0x4043('0x92'));_0x2cd044[_0x4043('0x4e')]('i.*');_0x2cd044[_0x4043('0x4e')]('c.firstName','Contact.firstName');_0x2cd044[_0x4043('0x4e')]('c.lastName',_0x4043('0xa6'));_0x2cd044[_0x4043('0x4e')]('c.email','Contact.email');_0x2cd044['field'](_0x4043('0xa7'),_0x4043('0xa8'));_0x2cd044[_0x4043('0x4e')](_0x4043('0xa9'),_0x4043('0xaa'));_0x2cd044[_0x4043('0x4e')](_0x4043('0xab'),'Contact.fax');_0x2cd044[_0x4043('0x4e')](_0x4043('0xac'),_0x4043('0xad'));_0x2cd044[_0x4043('0x4e')](_0x4043('0xae'),_0x4043('0xaf'));_0x2cd044[_0x4043('0x4e')](_0x4043('0xb0'),_0x4043('0x31'));}if(_0x42af99[_0x4043('0x23')])_0x2cd044[_0x4043('0x23')](_0x42af99[_0x4043('0x23')]);if(_0x42af99[_0x4043('0x21')])_0x2cd044['offset'](_0x42af99['offset']);return db[_0x4043('0x9c')][_0x4043('0x42')](_0x2cd044[_0x4043('0x9d')](),_0x43b3c7);})[_0x4043('0x29')](function(_0x2e7a92){if(_0x2e7a92['length']>0x0)_0x417d94[_0x4043('0x4c')](_0x4043('0xb1'),_[_0x4043('0x3d')](_0x2e7a92,'id'));return db[_0x4043('0x9c')][_0x4043('0x42')](_0x417d94['toString'](),_0x43b3c7)[_0x4043('0x29')](function(_0x4f4e94){var _0xd67c50=_[_0x4043('0xb2')](_0x4f4e94,_0x4043('0xb3'));var _0x501456=[];_0x2e7a92['forEach'](function(_0x4ff215){_0x501456[_0x4043('0x33')](updateFaxInteraction(_0x4ff215,_0x4d5059,_0xd67c50));});return BPromise[_0x4043('0xb4')](_0x501456);});});})[_0x4043('0x29')](function(_0x38423d){_0x3702[_0x4043('0xb5')]=_0x38423d;return _0x3702;})[_0x4043('0x29')](respondWithFilteredResult(_0x5f2505,_0x42af99))['catch'](handleError(_0x5f2505,null));};exports[_0x4043('0xb6')]=function(_0x3a5881,_0xc8bc35){var _0x340f49={'raw':![],'where':{'id':_0x3a5881[_0x4043('0xb7')]['id']}},_0x2c31f9={};_0x2c31f9[_0x4043('0x41')]=_[_0x4043('0x43')](db[_0x4043('0x3e')]['rawAttributes']);_0x2c31f9['query']=_[_0x4043('0x43')](_0x3a5881[_0x4043('0x42')]);_0x2c31f9[_0x4043('0x44')]=_[_0x4043('0x46')](_0x2c31f9[_0x4043('0x41')],_0x2c31f9[_0x4043('0x42')]);_0x340f49[_0x4043('0x45')]=_[_0x4043('0x46')](_0x2c31f9['model'],qs[_0x4043('0x47')](_0x3a5881[_0x4043('0x42')]['fields']));_0x340f49[_0x4043('0x45')]=_0x340f49['attributes'][_0x4043('0x48')]?_0x340f49[_0x4043('0x45')]:_0x2c31f9[_0x4043('0x41')];if(_0x3a5881[_0x4043('0x42')][_0x4043('0xb8')]){_0x340f49['include']=[{'all':!![]}];}_0x340f49=_[_0x4043('0x9f')]({},_0x340f49,_0x3a5881[_0x4043('0xb9')]);return db[_0x4043('0x3e')][_0x4043('0x66')](_0x340f49)[_0x4043('0x29')](handleEntityNotFound(_0xc8bc35,null))[_0x4043('0x29')](respondWithResult(_0xc8bc35,null))[_0x4043('0x34')](handleError(_0xc8bc35,null));};exports[_0x4043('0xba')]=function(_0x1d2842,_0x198201){return db['FaxInteraction']['create'](_0x1d2842[_0x4043('0x76')],{})[_0x4043('0x29')](respondWithResult(_0x198201,0xc9))[_0x4043('0x34')](handleError(_0x198201,null));};exports[_0x4043('0xbb')]=function(_0x2e9dc0,_0x1d8cc4){if(_0x2e9dc0[_0x4043('0x76')]['id']){delete _0x2e9dc0[_0x4043('0x76')]['id'];}return db[_0x4043('0x3e')]['find']({'where':{'id':_0x2e9dc0[_0x4043('0xb7')]['id']}})['then'](handleEntityNotFound(_0x1d8cc4,null))[_0x4043('0x29')](saveUpdates(_0x2e9dc0[_0x4043('0x76')],null))[_0x4043('0x29')](respondWithResult(_0x1d8cc4,null))[_0x4043('0x34')](handleError(_0x1d8cc4,null));};exports['destroy']=function(_0x5a0023,_0x5bb6fd){return db[_0x4043('0x3e')][_0x4043('0x66')]({'where':{'id':_0x5a0023['params']['id']}})[_0x4043('0x29')](handleEntityNotFound(_0x5bb6fd,null))['then'](removeEntity(_0x5bb6fd,null))[_0x4043('0x34')](handleError(_0x5bb6fd,null));};exports[_0x4043('0xbc')]=function(_0x4afd72,_0x19ef22){return db[_0x4043('0x3e')][_0x4043('0xbc')]()['then'](respondWithResult(_0x19ef22,null))[_0x4043('0x34')](handleError(_0x19ef22,null));};exports[_0x4043('0xbd')]=function(_0xb9462b,_0x4fecaf,_0x3f61a2){return db[_0x4043('0xbe')][_0x4043('0x66')]({'where':{'id':_0xb9462b['params']['id']}})[_0x4043('0x29')](handleEntityNotFound(_0x4fecaf,null))[_0x4043('0x29')](function(_0x4445cd){if(_0x4445cd){return _0x4445cd[_0x4043('0xbd')](_0xb9462b[_0x4043('0x76')][_0x4043('0xbf')],_['omit'](_0xb9462b[_0x4043('0x76')],['ids','id'])||{});}})[_0x4043('0x29')](respondWithResult(_0x4fecaf,null))[_0x4043('0x34')](handleError(_0x4fecaf,null));};exports[_0x4043('0xc0')]=function(_0x5c4be1,_0x439617,_0x1aaf2b){var _0x5456f5={'raw':![],'where':{}};var _0x2a6691={};var _0x398850={'count':0x0,'rows':[]};return db[_0x4043('0x3e')][_0x4043('0xc1')]({'where':{'id':_0x5c4be1[_0x4043('0xb7')]['id']}})[_0x4043('0x29')](handleEntityNotFound(_0x439617,null))[_0x4043('0x29')](function(_0xeece98){if(_0xeece98){_0x2a6691[_0x4043('0x41')]=_[_0x4043('0x43')](db[_0x4043('0xbe')][_0x4043('0x3f')]);_0x2a6691[_0x4043('0x42')]=_[_0x4043('0x43')](_0x5c4be1[_0x4043('0x42')]);_0x2a6691[_0x4043('0x44')]=_['intersection'](_0x2a6691[_0x4043('0x41')],_0x2a6691['query']);_0x5456f5[_0x4043('0x45')]=_['intersection'](_0x2a6691[_0x4043('0x41')],qs[_0x4043('0x47')](_0x5c4be1['query'][_0x4043('0x47')]));_0x5456f5['attributes']=_0x5456f5[_0x4043('0x45')][_0x4043('0x48')]?_0x5456f5[_0x4043('0x45')]:_0x2a6691['model'];if(!_0x5c4be1[_0x4043('0x42')][_0x4043('0x49')](_0x4043('0xc2'))){_0x5456f5[_0x4043('0x23')]=qs[_0x4043('0x23')](_0x5c4be1[_0x4043('0x42')][_0x4043('0x23')]);_0x5456f5['offset']=qs[_0x4043('0x21')](_0x5c4be1[_0x4043('0x42')][_0x4043('0x21')]);}_0x5456f5[_0x4043('0x4a')]=qs[_0x4043('0x4b')](_0x5c4be1[_0x4043('0x42')][_0x4043('0x4b')]);_0x5456f5[_0x4043('0x4c')]=qs['filters'](_['pick'](_0x5c4be1[_0x4043('0x42')],_0x2a6691[_0x4043('0x44')]));_0x5456f5[_0x4043('0x4c')][_0x4043('0xb3')]=_0xeece98['id'];if(_0x5c4be1[_0x4043('0x42')][_0x4043('0x86')]){_0x5456f5[_0x4043('0x4c')]=_[_0x4043('0x9f')](_0x5456f5[_0x4043('0x4c')],{'$or':_['map'](_0x5456f5[_0x4043('0x45')],function(_0x3f84b9){var _0x1948b1={};_0x1948b1[_0x3f84b9]={'$like':'%'+_0x5c4be1[_0x4043('0x42')][_0x4043('0x86')]+'%'};return _0x1948b1;})});}if(_0x5c4be1['query']['$gte']){var _0x2724c2=_0x5c4be1[_0x4043('0x42')][_0x4043('0x7e')][_0x4043('0x6d')](',');var _0x2b8928={};_0x2b8928[_0x2724c2[0x0]]={'$gte':moment(_0x2724c2[0x1])[_0x4043('0xc3')](_0x4043('0xc4'))};_0x5456f5[_0x4043('0x4c')]=_['merge'](_0x5456f5[_0x4043('0x4c')],_0x2b8928);}_0x5456f5=_[_0x4043('0x9f')]({},_0x5456f5,_0x5c4be1[_0x4043('0xb9')]);return db[_0x4043('0xbe')][_0x4043('0x24')]({'where':_0x5456f5['where']})['then'](function(_0x11a614){_0x398850[_0x4043('0x24')]=_0x11a614;if(_0x5c4be1[_0x4043('0x42')]['includeAll']){_0x5456f5[_0x4043('0xc5')]=[{'all':!![]}];}return db[_0x4043('0xbe')][_0x4043('0xc6')](_0x5456f5);})[_0x4043('0x29')](function(_0x48890f){_0x398850['rows']=_0x48890f;return _0x398850;});}})[_0x4043('0x29')](respondWithFilteredResult(_0x439617,_0x5456f5))['catch'](handleError(_0x439617,null));};exports[_0x4043('0xc7')]=function(_0x5f5a45,_0x448996,_0x4a8ead){return db[_0x4043('0x3e')][_0x4043('0x66')]({'where':{'id':_0x5f5a45[_0x4043('0xb7')]['id']}})['then'](handleEntityNotFound(_0x448996,null))[_0x4043('0x29')](function(_0x16867e){if(_0x16867e){return _0x16867e['setTags'](_0x5f5a45['body'][_0x4043('0xbf')],_[_0x4043('0xc8')](_0x5f5a45['body'],['ids','id'])||{})['spread'](function(){return db[_0x4043('0x70')]['findAll']({'attributes':['id','name',_0x4043('0x4f')],'where':{'id':_0x5f5a45[_0x4043('0x76')]['ids']}});})[_0x4043('0x29')](function(_0x5b535f){socket[_0x4043('0xc9')](_0x4043('0xca'),{'id':Number(_0x5f5a45[_0x4043('0xb7')]['id']),'tags':_0x5b535f||[]});return{'id':Number(_0x5f5a45[_0x4043('0xb7')]['id']),'tags':_0x5b535f||[]};});}})[_0x4043('0x29')](respondWithResult(_0x448996,null))[_0x4043('0x34')](handleError(_0x448996,null));};exports[_0x4043('0xcb')]=function(_0x2602db,_0x59f695,_0x48f440){return db['FaxInteraction'][_0x4043('0x66')]({'where':{'id':_0x2602db[_0x4043('0xb7')]['id']}})[_0x4043('0x29')](handleEntityNotFound(_0x59f695,null))[_0x4043('0x29')](function(_0x1e6df1){if(_0x1e6df1){return _0x1e6df1['removeTags'](_0x2602db[_0x4043('0x42')][_0x4043('0xbf')]);}})[_0x4043('0x29')](respondWithStatusCode(_0x59f695,null))[_0x4043('0x34')](handleError(_0x59f695,null));};exports['download']=function(_0xf3d382,_0x26d5e2){var _0x2c2392=moment()['unix']()[_0x4043('0x9d')]();var _0x37022e=path[_0x4043('0xcc')](config[_0x4043('0xcd')],'server','files',_0x4043('0xce'));var _0x2f9ecd=path[_0x4043('0xcc')](config['root'],_0x4043('0xcf'),'files','attachments');var _0x47038c=path['join'](_0x37022e,_0x2c2392);var _0xce07de=util[_0x4043('0xc3')](_0x4043('0xd0'),_0xf3d382['params']['id'],_0x2c2392);var _0x53ba85=path['join'](_0x37022e,_0xce07de);var _0x247dba=[];_0x247dba[_0x4043('0x33')]({'model':db[_0x4043('0xd1')],'as':_0x4043('0xd1'),'raw':!![]});var _0x353eec=[{'model':db[_0x4043('0xbe')],'as':_0x4043('0xd2'),'attributes':['id',_0x4043('0x76'),_0x4043('0x7c')],'include':_0x247dba}];return db[_0x4043('0x3e')][_0x4043('0x66')]({'where':{'id':_0xf3d382['params']['id']},'include':_0x353eec})[_0x4043('0x29')](handleEntityNotFound(_0x26d5e2,null))[_0x4043('0x29')](function(_0x53f5dd){if(_0x53f5dd&&_0x53f5dd['Messages']){var _0x226a5d=_0x53f5dd['get']({'plain':!![]});fs[_0x4043('0xd3')](_0x47038c);for(var _0x2a57a3=0x0;_0x2a57a3<_0x226a5d[_0x4043('0xd2')][_0x4043('0x48')];_0x2a57a3++){var _0x166521=_0x226a5d['Messages'][_0x2a57a3]['Attachment'];if(_0x166521){var _0x274212=path[_0x4043('0xcc')](_0x2f9ecd,_0x166521[_0x4043('0xd4')]);if(fs['existsSync'](_0x274212)){fs[_0x4043('0xd5')](_0x274212)['pipe'](fs[_0x4043('0xd6')](path[_0x4043('0xcc')](_0x47038c,_0x166521['basename'])));}}}return BPromise['resolve']()[_0x4043('0x29')](function(){return new BPromise(function(_0x3d15b3,_0x2e2850){zipdir(_0x47038c,{'saveTo':_0x53ba85},function(_0x58bf7,_0x46020d){if(_0x58bf7)return _0x2e2850(_0x58bf7);return _0x3d15b3(_0x46020d);});})[_0x4043('0x29')](function(){return new BPromise(function(_0x38bc60,_0x2682d3){rimraf(_0x47038c,function(_0x301ec0){if(_0x301ec0)_0x2682d3(_0x301ec0);return _0x38bc60();});});})[_0x4043('0x29')](function(){return _0x26d5e2['download'](_0x53ba85,_0xce07de,function(_0x2fe290){if(_0x2fe290){console[_0x4043('0xd7')]('err',_0x2fe290);}else{fs[_0x4043('0xd8')](_0x53ba85);}});});});}else{return _0x26d5e2[_0x4043('0x2a')](0xc8);}})['catch'](handleError(_0x26d5e2,null));}; \ No newline at end of file +var _0x17c3=['Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','push','all','rows','rawAttributes','includeAll','options','create','params','describe','addMessage','ids','omit','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','faxInteractionTags:save','removeTags','root','server','files','attachments','join','Attachment','FaxMessage','Messages','createdAt','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','download','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','stack','name','send','map','TagIds','Tags','split','forEach','then','catch','talking','answered','unmanaged','closed','UserId','waiting','total','index','FaxInteraction','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName'];(function(_0x2061a4,_0x10fc2a){var _0x53a414=function(_0x40452d){while(--_0x40452d){_0x2061a4['push'](_0x2061a4['shift']());}};_0x53a414(++_0x10fc2a);}(_0x17c3,0x1f3));var _0x317c=function(_0x1ea5d3,_0x3809f1){_0x1ea5d3=_0x1ea5d3-0x0;var _0x1c7ea4=_0x17c3[_0x1ea5d3];return _0x1c7ea4;};'use strict';var emlformat=require(_0x317c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x317c('0x1'));var jsonpatch=require(_0x317c('0x2'));var rp=require(_0x317c('0x3'));var moment=require('moment');var BPromise=require(_0x317c('0x4'));var Mustache=require('mustache');var util=require(_0x317c('0x5'));var path=require(_0x317c('0x6'));var sox=require(_0x317c('0x7'));var csv=require(_0x317c('0x8'));var ejs=require(_0x317c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x317c('0xa'));var squel=require('squel');var crypto=require(_0x317c('0xb'));var jsforce=require(_0x317c('0xc'));var deskjs=require(_0x317c('0xd'));var toCsv=require(_0x317c('0x8'));var querystring=require(_0x317c('0xe'));var Papa=require(_0x317c('0xf'));var Redis=require(_0x317c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x317c('0x11'));var hardwareService=require(_0x317c('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x317c('0x13'));var config=require(_0x317c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x317c('0x15'))['db'];config[_0x317c('0x16')]=_[_0x317c('0x17')](config[_0x317c('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x317c('0x18'))[_0x317c('0x19')](socket);function respondWithStatusCode(_0x1a6258,_0x397ec1){_0x397ec1=_0x397ec1||0xcc;return function(_0x17ad63){if(_0x17ad63){return _0x1a6258[_0x317c('0x1a')](_0x397ec1);}return _0x1a6258[_0x317c('0x1b')](_0x397ec1)[_0x317c('0x1c')]();};}function respondWithResult(_0x4b3242,_0x58fb54){_0x58fb54=_0x58fb54||0xc8;return function(_0x5e4690){if(_0x5e4690){return _0x4b3242[_0x317c('0x1b')](_0x58fb54)['json'](_0x5e4690);}};}function respondWithFilteredResult(_0x663f4b,_0x10c5f0){return function(_0x4c54e5){if(_0x4c54e5){var _0x43adc0=typeof _0x10c5f0[_0x317c('0x1d')]===_0x317c('0x1e')&&typeof _0x10c5f0[_0x317c('0x1f')]===_0x317c('0x1e');var _0x57e7bc=_0x4c54e5[_0x317c('0x20')];var _0x8007a6=_0x43adc0?0x0:_0x10c5f0['offset'];var _0x5a12cb=_0x43adc0?_0x4c54e5[_0x317c('0x20')]:_0x10c5f0[_0x317c('0x1d')]+_0x10c5f0[_0x317c('0x1f')];var _0x5a4ba8;if(_0x5a12cb>=_0x57e7bc){_0x5a12cb=_0x57e7bc;_0x5a4ba8=0xc8;}else{_0x5a4ba8=0xce;}_0x663f4b[_0x317c('0x1b')](_0x5a4ba8);return _0x663f4b['set'](_0x317c('0x21'),_0x8007a6+'-'+_0x5a12cb+'/'+_0x57e7bc)[_0x317c('0x22')](_0x4c54e5);}return null;};}function patchUpdates(_0x4b949e){return function(_0x1bfa50){try{jsonpatch[_0x317c('0x23')](_0x1bfa50,_0x4b949e,!![]);}catch(_0x27ffb5){return BPromise[_0x317c('0x24')](_0x27ffb5);}return _0x1bfa50['save']();};}function saveUpdates(_0x12bb32,_0x1f2f55){return function(_0x3cf165){if(_0x3cf165){return _0x3cf165[_0x317c('0x25')](_0x12bb32)['then'](function(_0x290e14){return _0x290e14;});}return null;};}function removeEntity(_0x1e4b38,_0x1570f1){return function(_0x232e3c){if(_0x232e3c){return _0x232e3c[_0x317c('0x26')]()['then'](function(){_0x1e4b38[_0x317c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x269767,_0x3d9103){return function(_0x5513ea){if(!_0x5513ea){_0x269767[_0x317c('0x1a')](0x194);}return _0x5513ea;};}function handleError(_0x354294,_0x231148){_0x231148=_0x231148||0x1f4;return function(_0x2cae6f){logger['error'](_0x2cae6f[_0x317c('0x27')]);if(_0x2cae6f[_0x317c('0x28')]){delete _0x2cae6f[_0x317c('0x28')];}_0x354294[_0x317c('0x1b')](_0x231148)[_0x317c('0x29')](_0x2cae6f);};}function getInteractionUsers(_0x61420b,_0x2b9fee){return new BPromise(function(_0x2db281,_0x52fd04){try{if(_0x2b9fee[_0x61420b['id']]){_0x61420b['Users']=_[_0x317c('0x2a')](_0x2b9fee[_0x61420b['id']],function(_0x16249b){return{'id':_0x16249b['id'],'fullname':_0x16249b['fullname']};});}}catch(_0xfe7a03){_0x52fd04(_0xfe7a03);}_0x2db281(_0x61420b);});}function getInteractionTags(_0x1ff907,_0x152ba3){return new BPromise(function(_0xdb0367,_0x2a368a){try{if(_0x1ff907[_0x317c('0x2b')]){_0x1ff907[_0x317c('0x2c')]=[];_0x1ff907[_0x317c('0x2b')][_0x317c('0x2d')](',')[_0x317c('0x2e')](function(_0x1b9e4e){_0x1ff907[_0x317c('0x2c')]['push'](_0x152ba3[_0x1b9e4e]);});}delete _0x1ff907[_0x317c('0x2b')];}catch(_0x1a0ae3){_0x2a368a(_0x1a0ae3);}_0xdb0367(_0x1ff907);});}function updateFaxInteraction(_0x177653,_0x22c524,_0x3cb00c){return new BPromise(function(_0x4372f2,_0x14edba){return getInteractionUsers(_0x177653,_0x3cb00c)[_0x317c('0x2f')](function(_0x229eb8){return getInteractionTags(_0x229eb8,_0x22c524);})[_0x317c('0x2f')](function(_0x1e31e7){return getStateInteraction(_0x1e31e7);})['then'](function(_0x1334bc){_0x4372f2(_0x1334bc);})[_0x317c('0x30')](function(_0x50fd15){_0x14edba(_0x50fd15);});});}function getStateInteraction(_0x470a3b){return new BPromise(function(_0x386324){_0x470a3b['waiting']=0x0;_0x470a3b[_0x317c('0x31')]=0x0;_0x470a3b[_0x317c('0x32')]=0x0;_0x470a3b[_0x317c('0x33')]=0x0;_0x470a3b['total']=0x0;if(!_0x470a3b[_0x317c('0x34')]&&!_0x470a3b[_0x317c('0x35')]){_0x470a3b[_0x317c('0x36')]+=0x1;}if(!_0x470a3b[_0x317c('0x34')]&&_0x470a3b[_0x317c('0x35')]){_0x470a3b['talking']+=0x1;if(_0x470a3b['waiting']){_0x470a3b[_0x317c('0x36')]-=0x1;}}if(_0x470a3b['closed']&&_0x470a3b[_0x317c('0x35')]){_0x470a3b['answered']+=0x1;if(_0x470a3b[_0x317c('0x31')]){_0x470a3b['talking']-=0x1;}}if(_0x470a3b[_0x317c('0x34')]&&!_0x470a3b[_0x317c('0x35')]){_0x470a3b[_0x317c('0x33')]+=0x1;if(_0x470a3b[_0x317c('0x36')]){_0x470a3b[_0x317c('0x36')]-=0x1;}}_0x470a3b[_0x317c('0x37')]+=0x1;_0x386324(_0x470a3b);});}exports[_0x317c('0x38')]=function(_0x50ac79,_0x1c185e){var _0x371ffd={},_0x57bf07={},_0x1de8cd={'count':0x0,'rows':[]};var _0x54ecbe=_['map'](db[_0x317c('0x39')]['rawAttributes'],function(_0x4a3255){return{'name':_0x4a3255[_0x317c('0x3a')],'type':_0x4a3255[_0x317c('0x3b')][_0x317c('0x3c')]};});_0x57bf07['model']=_[_0x317c('0x2a')](_0x54ecbe,_0x317c('0x28'));_0x57bf07[_0x317c('0x3d')]=_[_0x317c('0x3e')](_0x50ac79[_0x317c('0x3d')]);_0x57bf07[_0x317c('0x3f')]=_[_0x317c('0x40')](_0x57bf07[_0x317c('0x41')],_0x57bf07['query']);_0x371ffd[_0x317c('0x42')]=_[_0x317c('0x40')](_0x57bf07[_0x317c('0x41')],qs[_0x317c('0x43')](_0x50ac79[_0x317c('0x3d')]['fields']));_0x371ffd[_0x317c('0x42')]=_0x371ffd['attributes'][_0x317c('0x44')]?_0x371ffd[_0x317c('0x42')]:_0x57bf07[_0x317c('0x41')];if(!_0x50ac79[_0x317c('0x3d')][_0x317c('0x45')](_0x317c('0x46'))){_0x371ffd[_0x317c('0x1f')]=qs[_0x317c('0x1f')](_0x50ac79[_0x317c('0x3d')][_0x317c('0x1f')]);_0x371ffd[_0x317c('0x1d')]=qs[_0x317c('0x1d')](_0x50ac79[_0x317c('0x3d')]['offset']);}_0x371ffd[_0x317c('0x47')]=qs['sort'](_0x50ac79['query'][_0x317c('0x48')]);_0x371ffd[_0x317c('0x49')]=qs[_0x317c('0x3f')](_[_0x317c('0x4a')](_0x50ac79[_0x317c('0x3d')],_0x57bf07[_0x317c('0x3f')]),_0x54ecbe);var _0x4724b1=[];var _0x378b31=squel[_0x317c('0x4b')]()['field']('id')['field'](_0x317c('0x28'))[_0x317c('0x4c')]('color')['from']('tools_tags');var _0x5379e0=squel[_0x317c('0x4b')]()[_0x317c('0x4c')](_0x317c('0x4d'))['field'](_0x317c('0x4e'))[_0x317c('0x4c')](_0x317c('0x4f'))[_0x317c('0x50')](_0x317c('0x51'),'ui')['left_join'](_0x317c('0x52'),'u',_0x317c('0x53'));var _0x3b089a=squel[_0x317c('0x4b')]()[_0x317c('0x50')]('fax_interactions','i')['left_join'](_0x317c('0x54'),'c',_0x317c('0x55'))[_0x317c('0x56')](_0x317c('0x52'),'o','o.id\x20=\x20i.UserId')[_0x317c('0x56')](_0x317c('0x57'),'a',_0x317c('0x58'))[_0x317c('0x56')]('fax_messages','me',_0x317c('0x59'))['left_join'](_0x317c('0x5a'),'it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0x317c('0x5b'),'t',_0x317c('0x5c'));var _0x45253e=squel[_0x317c('0x5d')]();var _0x2329f7=[];var _0x23c588=squel[_0x317c('0x5d')]();var _0x14c44c;if(_0x50ac79[_0x317c('0x3d')][_0x317c('0x5e')]){_0x14c44c=as['parseSearch'](_0x50ac79[_0x317c('0x3d')][_0x317c('0x5e')]);var _0x448e59=_0x14c44c[_0x317c('0x5f')];for(var _0x4a2555=0x0;_0x4a2555<_0x14c44c[_0x317c('0x60')]['length'];_0x4a2555++){var _0x33c655=_0x14c44c[_0x317c('0x60')][_0x4a2555];var _0x25a819='i';var _0x2176fb=_[_0x317c('0x61')](_0x54ecbe,[_0x317c('0x28'),_0x33c655[_0x317c('0x4c')]]);if(!_0x2176fb){switch(_0x33c655[_0x317c('0x4c')]){case'unreadMessages':if(_0x33c655[_0x317c('0x62')]==0x1){_0x3b089a[_0x317c('0x63')]('`'+_0x33c655[_0x317c('0x4c')]+_0x317c('0x64'));}else{_0x3b089a[_0x317c('0x63')]('`'+_0x33c655[_0x317c('0x4c')]+_0x317c('0x65'));}break;case'Contact':if(_0x33c655[_0x317c('0x66')]==='$substring'){if(_0x33c655[_0x317c('0x62')]['split']('\x20')['length']>0x1){_0x45253e[_0x448e59](_0x317c('0x67'),qs[_0x317c('0x68')](_0x33c655[_0x317c('0x62')]),null);}else{var _0x310b14='%'+_0x33c655['value']+'%';_0x45253e[_0x448e59](_0x317c('0x69'),_0x310b14,_0x310b14,_0x310b14);}}else{_0x2176fb=_[_0x317c('0x61')](_0x54ecbe,[_0x317c('0x28'),_0x317c('0x6a')]);_0x33c655[_0x317c('0x4c')]=_0x317c('0x6a');_0x2ce1fd=as[_0x317c('0x6b')](_0x25a819,_0x2176fb[_0x317c('0x3b')],_0x33c655);_0x45253e[_0x448e59](_0x2ce1fd[_0x317c('0x6c')],_0x2ce1fd[_0x317c('0x62')][_0x317c('0x6d')],_0x2ce1fd[_0x317c('0x62')][_0x317c('0x1c')]);}break;case _0x317c('0x6e'):var _0x366eec=_0x33c655[_0x317c('0x62')]['split'](',')[_0x317c('0x2a')](function(_0x498c01){return Number(_0x498c01);});_0x366eec[_0x317c('0x2e')](function(_0x4ecf54){_0x23c588['or'](_0x317c('0x6f'),'%,'+_0x4ecf54+',%');});_0x2329f7=_[_0x317c('0x70')](_0x2329f7,_0x366eec);break;case _0x317c('0x71'):if(_0x33c655[_0x317c('0x66')]===_0x317c('0x72')){_0x45253e[_0x448e59](_0x317c('0x73'),'%'+_0x33c655[_0x317c('0x62')]+'%',null);}else{_0x2176fb=_[_0x317c('0x61')](_0x54ecbe,['name',_0x317c('0x35')]);_0x33c655[_0x317c('0x4c')]=_0x317c('0x35');_0x2ce1fd=as[_0x317c('0x6b')](_0x25a819,_0x2176fb[_0x317c('0x3b')],_0x33c655);_0x45253e[_0x448e59](_0x2ce1fd[_0x317c('0x6c')],_0x2ce1fd['value'][_0x317c('0x6d')],_0x2ce1fd[_0x317c('0x62')][_0x317c('0x1c')]);}break;case _0x317c('0x74'):_0x2ce1fd=as['buildExpression']('me',null,_0x33c655);_0x45253e[_0x448e59](_0x2ce1fd[_0x317c('0x6c')],_0x2ce1fd[_0x317c('0x62')][_0x317c('0x6d')],_0x2ce1fd[_0x317c('0x62')][_0x317c('0x1c')]);break;}}else{var _0x2ce1fd=as[_0x317c('0x6b')](_0x25a819,_0x2176fb[_0x317c('0x3b')],_0x33c655);_0x45253e[_0x448e59](_0x2ce1fd[_0x317c('0x6c')],_0x2ce1fd[_0x317c('0x62')]['start'],_0x2ce1fd[_0x317c('0x62')][_0x317c('0x1c')]);}}}else{var _0x41df7d=_(_0x50ac79[_0x317c('0x3d')])[_0x317c('0x3e')]()[_0x317c('0x2a')](function(_0x1b431a){return _[_0x317c('0x75')](_0x54ecbe,[_0x317c('0x28'),_0x1b431a])?_0x1b431a:undefined;})[_0x317c('0x76')]()[_0x317c('0x62')]();if(!_[_0x317c('0x77')](_0x41df7d)){_0x41df7d['forEach'](function(_0x4d907b){if(_0x4d907b===_0x317c('0x78')){_0x3b089a[_0x317c('0x49')](_0x317c('0x79'),[][_0x317c('0x7a')](_0x50ac79[_0x317c('0x3d')][_0x4d907b]));}else if(_0x4d907b==='createdAt'){var _0x161d47=JSON[_0x317c('0x7b')](_0x50ac79['query'][_0x4d907b])[_0x317c('0x7c')];var _0x1bdda7=JSON[_0x317c('0x7b')](_0x50ac79[_0x317c('0x3d')][_0x4d907b])[_0x317c('0x7d')];_0x3b089a['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x161d47,_0x1bdda7);}else{if(_0x50ac79['query'][_0x4d907b]===_0x317c('0x7e')){_0x3b089a[_0x317c('0x49')]('i.'+_0x4d907b+_0x317c('0x7f'));}else{_0x3b089a[_0x317c('0x49')]('i.'+_0x4d907b+_0x317c('0x80'),_0x50ac79[_0x317c('0x3d')][_0x4d907b]);}}});}if(_0x50ac79['query'][_0x317c('0x81')]){if(_0x50ac79[_0x317c('0x3d')][_0x317c('0x81')]==0x1){_0x3b089a[_0x317c('0x63')](_0x317c('0x82'));}else{_0x3b089a[_0x317c('0x63')](_0x317c('0x83'));}}if(_0x50ac79['query']['tag']){_0x2329f7=_[_0x317c('0x84')](_0x50ac79[_0x317c('0x3d')][_0x317c('0x85')])?_0x50ac79[_0x317c('0x3d')][_0x317c('0x85')]:new Array(_0x50ac79['query'][_0x317c('0x85')]);_0x2329f7['forEach'](function(_0x1d1ca5){_0x23c588['or'](_0x317c('0x6f'),'%,'+_0x1d1ca5+',%');});}if(_0x50ac79['query']['filter']){var _0x29ee1c=_0x50ac79[_0x317c('0x3d')][_0x317c('0x86')][_0x317c('0x87')]('\x5c','\x5c\x5c')[_0x317c('0x87')](/'/g,'\x27\x27');if(qs[_0x317c('0x88')](_0x29ee1c)){_0x45253e['or'](_0x317c('0x89'),_0x29ee1c+'%')['or'](_0x317c('0x8a'),_0x29ee1c+'%');}_0x45253e['or'](_0x317c('0x8b'),_0x29ee1c+'%');}}_0x3b089a[_0x317c('0x49')](_0x45253e);_0x3b089a[_0x317c('0x8c')](_0x317c('0x8d'));var _0xb6de55={'type':db['Sequelize'][_0x317c('0x8e')][_0x317c('0x8f')],'raw':!![]};var _0x26d885=_0x3b089a[_0x317c('0x90')]();_0x26d885[_0x317c('0x4c')]('i.id');_0x26d885['field'](_0x317c('0x91'),_0x317c('0x92'));if(_0x371ffd[_0x317c('0x47')]){_0x371ffd[_0x317c('0x47')][_0x317c('0x2e')](function(_0x1286a5){var _0x4cd4f9=_0x1286a5[0x0]===_0x317c('0x93')?_0x1286a5[0x0]:'i.'+_0x1286a5[0x0];_0x3b089a[_0x317c('0x47')](_0x4cd4f9,_0x1286a5[0x1]===_0x317c('0x94')?![]:!![]);});}if(!_[_0x317c('0x77')](_0x2329f7)){_0x3b089a[_0x317c('0x63')](_0x23c588);_0x26d885['where'](_0x317c('0x95'),_0x2329f7);}BPromise[_0x317c('0x96')]()['then'](function(){if(!_0x14c44c){if(_0x50ac79[_0x317c('0x3d')]['FaxAccountId'])return;_0x26d885[_0x317c('0x49')](_0x317c('0x97'));_0x3b089a['where'](_0x317c('0x97'));return;}if(_0x50ac79[_0x317c('0x98')]['role']!==_0x317c('0x99'))return;return _0x50ac79[_0x317c('0x98')][_0x317c('0x9a')]({'attributes':['id'],'raw':!![]})['then'](function(_0xe994b8){if(_[_0x317c('0x77')](_0xe994b8)){_0x26d885[_0x317c('0x49')](_0x317c('0x9b'));_0x3b089a[_0x317c('0x49')](_0x317c('0x9b'));}else{_0x26d885[_0x317c('0x49')](_0x317c('0x79'),_[_0x317c('0x2a')](_0xe994b8,'id'));_0x3b089a[_0x317c('0x49')](_0x317c('0x79'),_[_0x317c('0x2a')](_0xe994b8,'id'));}});})['then'](function(){if(_0x50ac79[_0x317c('0x98')][_0x317c('0x9c')]===_0x317c('0x99')&&!_0x14c44c&&!_0x50ac79[_0x317c('0x3d')]['FaxAccountId'])return[];return db[_0x317c('0x9d')][_0x317c('0x3d')](_0x26d885[_0x317c('0x9e')](),_0xb6de55);})[_0x317c('0x2f')](function(_0x5d4545){_0x1de8cd[_0x317c('0x20')]=_0x5d4545[_0x317c('0x44')];if(_0x1de8cd[_0x317c('0x20')]===0x0)return[];return db[_0x317c('0x9d')][_0x317c('0x3d')](_0x378b31[_0x317c('0x9e')](),_0xb6de55)[_0x317c('0x2f')](function(_0x3d58d5){_0x4724b1=_[_0x317c('0x9f')](_0x3d58d5,'id');_0xb6de55=_[_0x317c('0xa0')](_0xb6de55,{'model':db[_0x317c('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x50ac79[_0x317c('0x3d')]['fields']){_0x371ffd[_0x317c('0x42')][_0x317c('0x2e')](function(_0x4b8a5e){_0x3b089a[_0x317c('0x4c')]('i.'+_0x4b8a5e);});}else{_0x3b089a[_0x317c('0x4c')](_0x317c('0x91'),_0x317c('0x92'));_0x3b089a[_0x317c('0x4c')](_0x317c('0xa1'),_0x317c('0xa2'));_0x3b089a['field'](_0x317c('0xa3'),_0x317c('0xa4'));_0x3b089a[_0x317c('0x4c')](_0x317c('0xa5'),'contactName');_0x3b089a[_0x317c('0x4c')]('i.*');_0x3b089a[_0x317c('0x4c')](_0x317c('0xa6'),_0x317c('0xa7'));_0x3b089a['field'](_0x317c('0xa8'),'Contact.lastName');_0x3b089a['field'](_0x317c('0xa9'),_0x317c('0xaa'));_0x3b089a[_0x317c('0x4c')](_0x317c('0xab'),'Contact.phone');_0x3b089a['field']('c.mobile',_0x317c('0xac'));_0x3b089a[_0x317c('0x4c')](_0x317c('0xad'),_0x317c('0xae'));_0x3b089a[_0x317c('0x4c')](_0x317c('0xaf'),_0x317c('0xb0'));_0x3b089a[_0x317c('0x4c')](_0x317c('0xb1'),_0x317c('0xb2'));_0x3b089a[_0x317c('0x4c')](_0x317c('0xb3'),_0x317c('0x2b'));}if(_0x371ffd['limit'])_0x3b089a[_0x317c('0x1f')](_0x371ffd[_0x317c('0x1f')]);if(_0x371ffd['offset'])_0x3b089a[_0x317c('0x1d')](_0x371ffd['offset']);return db[_0x317c('0x9d')][_0x317c('0x3d')](_0x3b089a[_0x317c('0x9e')](),_0xb6de55);})[_0x317c('0x2f')](function(_0x165e6a){if(_0x165e6a['length']>0x0)_0x5379e0[_0x317c('0x49')]('ui.FaxInteractionId\x20IN\x20?',_[_0x317c('0x2a')](_0x165e6a,'id'));return db[_0x317c('0x9d')][_0x317c('0x3d')](_0x5379e0[_0x317c('0x9e')](),_0xb6de55)[_0x317c('0x2f')](function(_0x27503b){var _0x25cc43=_[_0x317c('0xb4')](_0x27503b,_0x317c('0xb5'));var _0x16bfec=[];_0x165e6a[_0x317c('0x2e')](function(_0x27d669){_0x16bfec[_0x317c('0xb6')](updateFaxInteraction(_0x27d669,_0x4724b1,_0x25cc43));});return BPromise[_0x317c('0xb7')](_0x16bfec);});});})[_0x317c('0x2f')](function(_0x5506bf){_0x1de8cd[_0x317c('0xb8')]=_0x5506bf;return _0x1de8cd;})['then'](respondWithFilteredResult(_0x1c185e,_0x371ffd))[_0x317c('0x30')](handleError(_0x1c185e,null));};exports['show']=function(_0x472d2a,_0x1ab955){var _0x588eca={'raw':![],'where':{'id':_0x472d2a['params']['id']}},_0x54b9ee={};_0x54b9ee[_0x317c('0x41')]=_[_0x317c('0x3e')](db[_0x317c('0x39')][_0x317c('0xb9')]);_0x54b9ee[_0x317c('0x3d')]=_[_0x317c('0x3e')](_0x472d2a[_0x317c('0x3d')]);_0x54b9ee[_0x317c('0x3f')]=_[_0x317c('0x40')](_0x54b9ee[_0x317c('0x41')],_0x54b9ee[_0x317c('0x3d')]);_0x588eca['attributes']=_[_0x317c('0x40')](_0x54b9ee[_0x317c('0x41')],qs[_0x317c('0x43')](_0x472d2a[_0x317c('0x3d')][_0x317c('0x43')]));_0x588eca[_0x317c('0x42')]=_0x588eca['attributes'][_0x317c('0x44')]?_0x588eca[_0x317c('0x42')]:_0x54b9ee['model'];if(_0x472d2a[_0x317c('0x3d')][_0x317c('0xba')]){_0x588eca['include']=[{'all':!![]}];}_0x588eca=_[_0x317c('0xa0')]({},_0x588eca,_0x472d2a[_0x317c('0xbb')]);return db['FaxInteraction'][_0x317c('0x61')](_0x588eca)[_0x317c('0x2f')](handleEntityNotFound(_0x1ab955,null))[_0x317c('0x2f')](respondWithResult(_0x1ab955,null))[_0x317c('0x30')](handleError(_0x1ab955,null));};exports[_0x317c('0xbc')]=function(_0x32eb17,_0x33af1a){return db[_0x317c('0x39')]['create'](_0x32eb17[_0x317c('0x74')],{})['then'](respondWithResult(_0x33af1a,0xc9))['catch'](handleError(_0x33af1a,null));};exports[_0x317c('0x25')]=function(_0x3729b3,_0x41f352){if(_0x3729b3[_0x317c('0x74')]['id']){delete _0x3729b3[_0x317c('0x74')]['id'];}return db[_0x317c('0x39')]['find']({'where':{'id':_0x3729b3[_0x317c('0xbd')]['id']}})['then'](handleEntityNotFound(_0x41f352,null))[_0x317c('0x2f')](saveUpdates(_0x3729b3[_0x317c('0x74')],null))[_0x317c('0x2f')](respondWithResult(_0x41f352,null))[_0x317c('0x30')](handleError(_0x41f352,null));};exports[_0x317c('0x26')]=function(_0x36d3d5,_0x4d462a){return db[_0x317c('0x39')]['find']({'where':{'id':_0x36d3d5[_0x317c('0xbd')]['id']}})[_0x317c('0x2f')](handleEntityNotFound(_0x4d462a,null))[_0x317c('0x2f')](removeEntity(_0x4d462a,null))['catch'](handleError(_0x4d462a,null));};exports['describe']=function(_0x90ba51,_0x4d234b){return db[_0x317c('0x39')][_0x317c('0xbe')]()['then'](respondWithResult(_0x4d234b,null))['catch'](handleError(_0x4d234b,null));};exports[_0x317c('0xbf')]=function(_0x28bb9b,_0x28eb05,_0x215a75){return db['FaxMessage']['find']({'where':{'id':_0x28bb9b[_0x317c('0xbd')]['id']}})[_0x317c('0x2f')](handleEntityNotFound(_0x28eb05,null))[_0x317c('0x2f')](function(_0x1f531f){if(_0x1f531f){return _0x1f531f[_0x317c('0xbf')](_0x28bb9b['body'][_0x317c('0xc0')],_[_0x317c('0xc1')](_0x28bb9b[_0x317c('0x74')],['ids','id'])||{});}})[_0x317c('0x2f')](respondWithResult(_0x28eb05,null))[_0x317c('0x30')](handleError(_0x28eb05,null));};exports[_0x317c('0xc2')]=function(_0x3a4c6a,_0x1218ce,_0x1e4444){var _0x24d34a={'raw':![],'where':{}};var _0x274849={};var _0xb9de98={'count':0x0,'rows':[]};return db[_0x317c('0x39')][_0x317c('0xc3')]({'where':{'id':_0x3a4c6a[_0x317c('0xbd')]['id']}})['then'](handleEntityNotFound(_0x1218ce,null))[_0x317c('0x2f')](function(_0x539212){if(_0x539212){_0x274849[_0x317c('0x41')]=_[_0x317c('0x3e')](db['FaxMessage']['rawAttributes']);_0x274849[_0x317c('0x3d')]=_[_0x317c('0x3e')](_0x3a4c6a[_0x317c('0x3d')]);_0x274849[_0x317c('0x3f')]=_[_0x317c('0x40')](_0x274849[_0x317c('0x41')],_0x274849['query']);_0x24d34a['attributes']=_[_0x317c('0x40')](_0x274849[_0x317c('0x41')],qs[_0x317c('0x43')](_0x3a4c6a['query'][_0x317c('0x43')]));_0x24d34a[_0x317c('0x42')]=_0x24d34a['attributes'][_0x317c('0x44')]?_0x24d34a[_0x317c('0x42')]:_0x274849[_0x317c('0x41')];if(!_0x3a4c6a[_0x317c('0x3d')][_0x317c('0x45')]('nolimit')){_0x24d34a[_0x317c('0x1f')]=qs[_0x317c('0x1f')](_0x3a4c6a['query'][_0x317c('0x1f')]);_0x24d34a[_0x317c('0x1d')]=qs[_0x317c('0x1d')](_0x3a4c6a['query']['offset']);}_0x24d34a['order']=qs[_0x317c('0x48')](_0x3a4c6a['query'][_0x317c('0x48')]);_0x24d34a[_0x317c('0x49')]=qs['filters'](_[_0x317c('0x4a')](_0x3a4c6a[_0x317c('0x3d')],_0x274849[_0x317c('0x3f')]));_0x24d34a[_0x317c('0x49')]['FaxInteractionId']=_0x539212['id'];if(_0x3a4c6a[_0x317c('0x3d')]['filter']){_0x24d34a['where']=_[_0x317c('0xa0')](_0x24d34a[_0x317c('0x49')],{'$or':_[_0x317c('0x2a')](_0x24d34a[_0x317c('0x42')],function(_0x1ac695){var _0x1ab1c4={};_0x1ab1c4[_0x1ac695]={'$like':'%'+_0x3a4c6a['query'][_0x317c('0x86')]+'%'};return _0x1ab1c4;})});}if(_0x3a4c6a[_0x317c('0x3d')][_0x317c('0x7c')]){var _0x3f01c3=_0x3a4c6a[_0x317c('0x3d')][_0x317c('0x7c')][_0x317c('0x2d')](',');var _0x21da81={};_0x21da81[_0x3f01c3[0x0]]={'$gte':moment(_0x3f01c3[0x1])['format'](_0x317c('0xc4'))};_0x24d34a[_0x317c('0x49')]=_[_0x317c('0xa0')](_0x24d34a[_0x317c('0x49')],_0x21da81);}_0x24d34a=_[_0x317c('0xa0')]({},_0x24d34a,_0x3a4c6a['options']);return db['FaxMessage'][_0x317c('0x20')]({'where':_0x24d34a[_0x317c('0x49')]})['then'](function(_0x5b16ae){_0xb9de98[_0x317c('0x20')]=_0x5b16ae;if(_0x3a4c6a[_0x317c('0x3d')][_0x317c('0xba')]){_0x24d34a['include']=[{'all':!![]}];}return db['FaxMessage'][_0x317c('0xc5')](_0x24d34a);})[_0x317c('0x2f')](function(_0x178d49){_0xb9de98[_0x317c('0xb8')]=_0x178d49;return _0xb9de98;});}})['then'](respondWithFilteredResult(_0x1218ce,_0x24d34a))[_0x317c('0x30')](handleError(_0x1218ce,null));};exports[_0x317c('0xc6')]=function(_0x326410,_0x2f461c,_0x547489){return db[_0x317c('0x39')]['find']({'where':{'id':_0x326410['params']['id']}})[_0x317c('0x2f')](handleEntityNotFound(_0x2f461c,null))[_0x317c('0x2f')](function(_0x288161){if(_0x288161){return _0x288161[_0x317c('0xc7')](_0x326410[_0x317c('0x74')]['ids'],_[_0x317c('0xc1')](_0x326410[_0x317c('0x74')],[_0x317c('0xc0'),'id'])||{})[_0x317c('0xc8')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x326410[_0x317c('0x74')][_0x317c('0xc0')]}});})[_0x317c('0x2f')](function(_0x567cd0){socket['emit'](_0x317c('0xc9'),{'id':Number(_0x326410[_0x317c('0xbd')]['id']),'tags':_0x567cd0||[]});return{'id':Number(_0x326410[_0x317c('0xbd')]['id']),'tags':_0x567cd0||[]};});}})[_0x317c('0x2f')](respondWithResult(_0x2f461c,null))[_0x317c('0x30')](handleError(_0x2f461c,null));};exports[_0x317c('0xca')]=function(_0xf5460,_0x3c638c,_0x534ee1){return db['FaxInteraction'][_0x317c('0x61')]({'where':{'id':_0xf5460[_0x317c('0xbd')]['id']}})[_0x317c('0x2f')](handleEntityNotFound(_0x3c638c,null))[_0x317c('0x2f')](function(_0x5a4a01){if(_0x5a4a01){return _0x5a4a01[_0x317c('0xca')](_0xf5460[_0x317c('0x3d')][_0x317c('0xc0')]);}})['then'](respondWithStatusCode(_0x3c638c,null))[_0x317c('0x30')](handleError(_0x3c638c,null));};exports['download']=function(_0x3f290b,_0x38b98b){var _0x42fe29=moment()['unix']()[_0x317c('0x9e')]();var _0x271011=path['join'](config[_0x317c('0xcb')],_0x317c('0xcc'),_0x317c('0xcd'),'tmp');var _0xb7e8b1=path['join'](config[_0x317c('0xcb')],_0x317c('0xcc'),_0x317c('0xcd'),_0x317c('0xce'));var _0x5848e6=path[_0x317c('0xcf')](_0x271011,_0x42fe29);var _0x44bcb1=util['format']('transcript-%d-%s.zip',_0x3f290b[_0x317c('0xbd')]['id'],_0x42fe29);var _0x37d348=path[_0x317c('0xcf')](_0x271011,_0x44bcb1);var _0x2a6ea1=[];_0x2a6ea1[_0x317c('0xb6')]({'model':db['Attachment'],'as':_0x317c('0xd0'),'raw':!![]});var _0x23e3b2=[{'model':db[_0x317c('0xd1')],'as':_0x317c('0xd2'),'attributes':['id',_0x317c('0x74'),_0x317c('0xd3')],'include':_0x2a6ea1}];return db[_0x317c('0x39')][_0x317c('0x61')]({'where':{'id':_0x3f290b[_0x317c('0xbd')]['id']},'include':_0x23e3b2})['then'](handleEntityNotFound(_0x38b98b,null))[_0x317c('0x2f')](function(_0x46209){if(_0x46209&&_0x46209['Messages']){var _0x1e86e3=_0x46209['get']({'plain':!![]});fs[_0x317c('0xd4')](_0x5848e6);for(var _0x11db47=0x0;_0x11db47<_0x1e86e3[_0x317c('0xd2')][_0x317c('0x44')];_0x11db47++){var _0x2fbcf6=_0x1e86e3[_0x317c('0xd2')][_0x11db47]['Attachment'];if(_0x2fbcf6){var _0x4ae721=path['join'](_0xb7e8b1,_0x2fbcf6['basename']);if(fs[_0x317c('0xd5')](_0x4ae721)){fs[_0x317c('0xd6')](_0x4ae721)[_0x317c('0xd7')](fs[_0x317c('0xd8')](path[_0x317c('0xcf')](_0x5848e6,_0x2fbcf6[_0x317c('0xd9')])));}}}return BPromise[_0x317c('0x96')]()[_0x317c('0x2f')](function(){return new BPromise(function(_0x126d26,_0x433277){zipdir(_0x5848e6,{'saveTo':_0x37d348},function(_0x555ac4,_0x154c11){if(_0x555ac4)return _0x433277(_0x555ac4);return _0x126d26(_0x154c11);});})['then'](function(){return new BPromise(function(_0x4ca1ea,_0x56e64f){rimraf(_0x5848e6,function(_0x5cf851){if(_0x5cf851)_0x56e64f(_0x5cf851);return _0x4ca1ea();});});})[_0x317c('0x2f')](function(){return _0x38b98b[_0x317c('0xda')](_0x37d348,_0x44bcb1,function(_0x1d872f){if(_0x1d872f){console[_0x317c('0xdb')](_0x317c('0xdc'),_0x1d872f);}else{fs[_0x317c('0xdd')](_0x37d348);}});});});}else{return _0x38b98b[_0x317c('0x1a')](0xc8);}})['catch'](handleError(_0x38b98b,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 24d388e..54748ca 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 _0xbc98=['emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x141cfe,_0x443b19){var _0x3536ca=function(_0x1dedfe){while(--_0x1dedfe){_0x141cfe['push'](_0x141cfe['shift']());}};_0x3536ca(++_0x443b19);}(_0xbc98,0x16d));var _0x8bc9=function(_0x4f6033,_0x51b341){_0x4f6033=_0x4f6033-0x0;var _0x1e82aa=_0xbc98[_0x4f6033];return _0x1e82aa;};'use strict';var EventEmitter=require(_0x8bc9('0x0'));var FaxInteraction=require(_0x8bc9('0x1'))['db'][_0x8bc9('0x2')];var FaxMessage=require(_0x8bc9('0x1'))['db'][_0x8bc9('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x8bc9('0x4')](0x0);var events={'afterCreate':_0x8bc9('0x5'),'afterUpdate':_0x8bc9('0x6'),'afterDestroy':'remove'};function emitEvent(_0x2aabc6){return function(_0x20aaca,_0x935257,_0x2eea99){_0x20aaca[_0x8bc9('0x7')]({'attributes':['id'],'raw':!![]})[_0x8bc9('0x8')](function(_0x40043f){_0x20aaca[_0x8bc9('0x9')](_0x8bc9('0xa'),_0x40043f[_0x8bc9('0xb')](function(_0x54f8df){return{'id':_0x54f8df['id']};}));return FaxMessage[_0x8bc9('0xc')]({'where':{'FaxInteractionId':_0x20aaca['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8bc9('0x8')](function(_0x2e31a8){_0x20aaca[_0x8bc9('0x9')](_0x8bc9('0xd'),_0x2e31a8[_0x8bc9('0xe')]);FaxInteractionEvents[_0x8bc9('0xf')](_0x2aabc6+':'+_0x20aaca['id'],_0x20aaca);FaxInteractionEvents[_0x8bc9('0xf')](_0x2aabc6,_0x20aaca);_0x2eea99(null);})[_0x8bc9('0x10')](_0x2eea99(null));};}for(var e in events){if(events[_0x8bc9('0x11')](e)){var event=events[e];FaxInteraction[_0x8bc9('0x12')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x5cec=['../../mysqldb','FaxInteraction','FaxMessage','save','update','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x18baf4,_0x33086b){var _0x278ed1=function(_0x3ea0a2){while(--_0x3ea0a2){_0x18baf4['push'](_0x18baf4['shift']());}};_0x278ed1(++_0x33086b);}(_0x5cec,0x187));var _0xc5ce=function(_0x35e4db,_0x3bb371){_0x35e4db=_0x35e4db-0x0;var _0x4d6446=_0x5cec[_0x35e4db];return _0x4d6446;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xc5ce('0x0'))['db'][_0xc5ce('0x1')];var FaxMessage=require(_0xc5ce('0x0'))['db'][_0xc5ce('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc5ce('0x3'),'afterUpdate':_0xc5ce('0x4'),'afterDestroy':'remove'};function emitEvent(_0x50ee9e){return function(_0x31afd2,_0x407721,_0x370d0a){_0x31afd2[_0xc5ce('0x5')]({'attributes':['id'],'raw':!![]})[_0xc5ce('0x6')](function(_0xa70999){_0x31afd2[_0xc5ce('0x7')](_0xc5ce('0x8'),_0xa70999['map'](function(_0x30ace1){return{'id':_0x30ace1['id']};}));return FaxMessage[_0xc5ce('0x9')]({'where':{'FaxInteractionId':_0x31afd2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4002b1){_0x31afd2['setDataValue'](_0xc5ce('0xa'),_0x4002b1[_0xc5ce('0xb')]);FaxInteractionEvents[_0xc5ce('0xc')](_0x50ee9e+':'+_0x31afd2['id'],_0x31afd2);FaxInteractionEvents[_0xc5ce('0xc')](_0x50ee9e,_0x31afd2);_0x370d0a(null);})[_0xc5ce('0xd')](_0x370d0a(null));};}for(var e in events){if(events[_0xc5ce('0xe')](e)){var event=events[e];FaxInteraction[_0xc5ce('0xf')](e,emitEvent(event));}}module[_0xc5ce('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 658abbe..d50d13a 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 _0x7acb=['../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x27a264,_0x4e2f4b){var _0x4f4791=function(_0x2c74cf){while(--_0x2c74cf){_0x27a264['push'](_0x27a264['shift']());}};_0x4f4791(++_0x4e2f4b);}(_0x7acb,0xbf));var _0xb7ac=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7acb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xb7ac('0x0'));var util=require('util');var logger=require(_0xb7ac('0x1'))(_0xb7ac('0x2'));var moment=require('moment');var BPromise=require(_0xb7ac('0x3'));var rp=require(_0xb7ac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb7ac('0x5'));var attributes=require(_0xb7ac('0x6'));module['exports']=function(_0x4d5e31,_0xe305a5){return _0x4d5e31[_0xb7ac('0x7')](_0xb7ac('0x8'),attributes,{'tableName':_0xb7ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x327fd6,_0x43b289,_0x12e27e){if(_0x327fd6[_0xb7ac('0xa')](_0xb7ac('0xb'))){_0x327fd6[_0xb7ac('0xc')]=moment()['format'](_0xb7ac('0xd'));}_0x12e27e(null,_0x327fd6);}}});}; \ No newline at end of file +var _0x8c9c=['./faxInteraction.attributes','exports','define','FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x8c9c,0xf9));var _0xc8c9=function(_0x2c843d,_0x144e01){_0x2c843d=_0x2c843d-0x0;var _0x159a78=_0x8c9c[_0x2c843d];return _0x159a78;};'use strict';var _=require(_0xc8c9('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc8c9('0x1'));var BPromise=require(_0xc8c9('0x2'));var rp=require(_0xc8c9('0x3'));var fs=require('fs');var path=require(_0xc8c9('0x4'));var rimraf=require('rimraf');var config=require(_0xc8c9('0x5'));var attributes=require(_0xc8c9('0x6'));module[_0xc8c9('0x7')]=function(_0x4db65a,_0x2aef94){return _0x4db65a[_0xc8c9('0x8')](_0xc8c9('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31c0be,_0x101847,_0x13b4c6){if(_0x31c0be[_0xc8c9('0xa')](_0xc8c9('0xb'))){_0x31c0be[_0xc8c9('0xc')]=moment()[_0xc8c9('0xd')](_0xc8c9('0xe'));}_0x13b4c6(null,_0x31c0be);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index f73fd76..9613f3e 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 _0x4061=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./faxInteraction.socket','register','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','UpdateFaxInteraction','update','body','options','where','attributes','catch','FaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x380bf0,_0x3b93b3){var _0xd3573a=function(_0xb44d3d){while(--_0xb44d3d){_0x380bf0['push'](_0x380bf0['shift']());}};_0xd3573a(++_0x3b93b3);}(_0x4061,0x11e));var _0x1406=function(_0x1a079b,_0x11419b){_0x1a079b=_0x1a079b-0x0;var _0x50e0bd=_0x4061[_0x1a079b];return _0x50e0bd;};'use strict';var _=require(_0x1406('0x0'));var util=require(_0x1406('0x1'));var moment=require(_0x1406('0x2'));var BPromise=require(_0x1406('0x3'));var rs=require(_0x1406('0x4'));var fs=require('fs');var Redis=require(_0x1406('0x5'));var db=require(_0x1406('0x6'))['db'];var utils=require(_0x1406('0x7'));var logger=require(_0x1406('0x8'))(_0x1406('0x9'));var config=require(_0x1406('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1406('0xb')][_0x1406('0xc')]({'port':0x232a});config[_0x1406('0xd')]=_[_0x1406('0xe')](config['redis'],{'host':_0x1406('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1406('0x10'))[_0x1406('0x11')](socket);function respondWithRpcPromise(_0x1ddc2c,_0x1a55f0,_0x45244e){return new BPromise(function(_0x88b971,_0x207465){return client['request'](_0x1ddc2c,_0x45244e)[_0x1406('0x12')](function(_0x3106e3){logger['info'](_0x1406('0x13'),_0x1a55f0,_0x1406('0x14'));logger[_0x1406('0x15')](_0x1406('0x16'),_0x1a55f0,'request\x20sent',JSON[_0x1406('0x17')](_0x3106e3));if(_0x3106e3[_0x1406('0x18')]){if(_0x3106e3[_0x1406('0x18')][_0x1406('0x19')]===0x1f4){logger['error'](_0x1406('0x13'),_0x1a55f0,_0x3106e3[_0x1406('0x18')][_0x1406('0x1a')]);return _0x207465(_0x3106e3[_0x1406('0x18')]['message']);}logger[_0x1406('0x18')](_0x1406('0x13'),_0x1a55f0,_0x3106e3[_0x1406('0x18')][_0x1406('0x1a')]);return _0x88b971(_0x3106e3[_0x1406('0x18')][_0x1406('0x1a')]);}else{logger[_0x1406('0x1b')](_0x1406('0x13'),_0x1a55f0,'request\x20sent');_0x88b971(_0x3106e3['result'][_0x1406('0x1a')]);}})['catch'](function(_0x13baa9){logger[_0x1406('0x18')](_0x1406('0x13'),_0x1a55f0,_0x13baa9);_0x207465(_0x13baa9);});});}exports[_0x1406('0x1c')]=function(_0x52ea5a){var _0x55041e=this;return new Promise(function(_0x3f6168,_0x1bfe33){return db['FaxInteraction'][_0x1406('0x1d')](_0x52ea5a[_0x1406('0x1e')],{'raw':_0x52ea5a['options']?_0x52ea5a[_0x1406('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52ea5a[_0x1406('0x1f')]?_0x52ea5a[_0x1406('0x1f')][_0x1406('0x20')]||null:null,'attributes':_0x52ea5a[_0x1406('0x1f')]?_0x52ea5a[_0x1406('0x1f')][_0x1406('0x21')]||null:null,'limit':_0x52ea5a['options']?_0x52ea5a[_0x1406('0x1f')]['limit']||null:null})[_0x1406('0x12')](function(_0x47410c){logger['info']('UpdateFaxInteraction',_0x52ea5a);logger[_0x1406('0x15')](_0x1406('0x1c'),_0x52ea5a,JSON[_0x1406('0x17')](_0x47410c));_0x3f6168(_0x47410c);})[_0x1406('0x22')](function(_0xb74472){logger[_0x1406('0x18')](_0x1406('0x1c'),_0xb74472[_0x1406('0x1a')],_0x52ea5a);_0x1bfe33(_0x55041e[_0x1406('0x18')](0x1f4,_0xb74472[_0x1406('0x1a')]));});});};exports['AddTagsToFaxInteraction']=function(_0x3222ed){return new Promise(function(_0x50e614,_0x253eba){return db[_0x1406('0x23')][_0x1406('0x24')]({'where':_0x3222ed['options']?_0x3222ed[_0x1406('0x1f')]['where']||null:null})[_0x1406('0x12')](function(_0x16a9f8){if(_0x16a9f8){return _0x16a9f8[_0x1406('0x25')](_0x3222ed['body'][_0x1406('0x26')],_[_0x1406('0x27')](_0x3222ed[_0x1406('0x1e')],[_0x1406('0x26'),'id'])||{});}})[_0x1406('0x28')](function(_0x561f59){logger['info'](_0x1406('0x29'),_0x3222ed);logger[_0x1406('0x15')](_0x1406('0x29'),_0x3222ed,JSON['stringify'](_0x561f59));_0x50e614(_0x561f59);})['catch'](function(_0x501818){logger[_0x1406('0x18')]('AddTags',_0x501818[_0x1406('0x1a')],_0x3222ed);_0x253eba(_this[_0x1406('0x18')](0x1f4,_0x501818[_0x1406('0x1a')]));});});}; \ No newline at end of file +var _0xe87b=['request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxInteraction','FaxInteraction','options','raw','attributes','AddTagsToFaxInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe87b,0x1dc));var _0xbe87=function(_0x10e870,_0x4c4324){_0x10e870=_0x10e870-0x0;var _0x29b93d=_0xe87b[_0x10e870];return _0x29b93d;};'use strict';var _=require(_0xbe87('0x0'));var util=require('util');var moment=require(_0xbe87('0x1'));var BPromise=require(_0xbe87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe87('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbe87('0x4'))(_0xbe87('0x5'));var config=require(_0xbe87('0x6'));var jayson=require(_0xbe87('0x7'));var client=jayson[_0xbe87('0x8')][_0xbe87('0x9')]({'port':0x232a});config[_0xbe87('0xa')]=_[_0xbe87('0xb')](config[_0xbe87('0xa')],{'host':_0xbe87('0xc'),'port':0x18eb});var socket=require(_0xbe87('0xd'))(new Redis(config[_0xbe87('0xa')]));require(_0xbe87('0xe'))[_0xbe87('0xf')](socket);function respondWithRpcPromise(_0x3904f0,_0x2fcd18,_0x309fb1){return new BPromise(function(_0x47cad9,_0x114c59){return client[_0xbe87('0x10')](_0x3904f0,_0x309fb1)[_0xbe87('0x11')](function(_0x2fe5e4){logger[_0xbe87('0x12')](_0xbe87('0x13'),_0x2fcd18,_0xbe87('0x14'));logger[_0xbe87('0x15')](_0xbe87('0x16'),_0x2fcd18,_0xbe87('0x14'),JSON[_0xbe87('0x17')](_0x2fe5e4));if(_0x2fe5e4[_0xbe87('0x18')]){if(_0x2fe5e4[_0xbe87('0x18')]['code']===0x1f4){logger[_0xbe87('0x18')](_0xbe87('0x13'),_0x2fcd18,_0x2fe5e4['error'][_0xbe87('0x19')]);return _0x114c59(_0x2fe5e4[_0xbe87('0x18')]['message']);}logger[_0xbe87('0x18')](_0xbe87('0x13'),_0x2fcd18,_0x2fe5e4[_0xbe87('0x18')][_0xbe87('0x19')]);return _0x47cad9(_0x2fe5e4['error']['message']);}else{logger[_0xbe87('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x2fcd18,_0xbe87('0x14'));_0x47cad9(_0x2fe5e4[_0xbe87('0x1a')]['message']);}})[_0xbe87('0x1b')](function(_0x25d4aa){logger[_0xbe87('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x2fcd18,_0x25d4aa);_0x114c59(_0x25d4aa);});});}exports[_0xbe87('0x1c')]=function(_0x4ca261){var _0x418ba6=this;return new Promise(function(_0x151674,_0x54fd0f){return db[_0xbe87('0x1d')]['update'](_0x4ca261['body'],{'raw':_0x4ca261[_0xbe87('0x1e')]?_0x4ca261['options'][_0xbe87('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ca261[_0xbe87('0x1e')]?_0x4ca261['options']['where']||null:null,'attributes':_0x4ca261[_0xbe87('0x1e')]?_0x4ca261[_0xbe87('0x1e')][_0xbe87('0x20')]||null:null,'limit':_0x4ca261['options']?_0x4ca261[_0xbe87('0x1e')]['limit']||null:null})[_0xbe87('0x11')](function(_0x577b46){logger['info'](_0xbe87('0x1c'),_0x4ca261);logger[_0xbe87('0x15')](_0xbe87('0x1c'),_0x4ca261,JSON[_0xbe87('0x17')](_0x577b46));_0x151674(_0x577b46);})['catch'](function(_0x82f58e){logger[_0xbe87('0x18')](_0xbe87('0x1c'),_0x82f58e[_0xbe87('0x19')],_0x4ca261);_0x54fd0f(_0x418ba6['error'](0x1f4,_0x82f58e[_0xbe87('0x19')]));});});};exports[_0xbe87('0x21')]=function(_0x36b0b6){return new Promise(function(_0x486290,_0x29266c){return db[_0xbe87('0x1d')][_0xbe87('0x22')]({'where':_0x36b0b6[_0xbe87('0x1e')]?_0x36b0b6[_0xbe87('0x1e')]['where']||null:null})[_0xbe87('0x11')](function(_0x37d2aa){if(_0x37d2aa){return _0x37d2aa[_0xbe87('0x23')](_0x36b0b6[_0xbe87('0x24')][_0xbe87('0x25')],_[_0xbe87('0x26')](_0x36b0b6[_0xbe87('0x24')],[_0xbe87('0x25'),'id'])||{});}})[_0xbe87('0x27')](function(_0x1eaed7){logger[_0xbe87('0x12')]('AddTags',_0x36b0b6);logger[_0xbe87('0x15')](_0xbe87('0x28'),_0x36b0b6,JSON['stringify'](_0x1eaed7));_0x486290(_0x1eaed7);})['catch'](function(_0x3287d1){logger[_0xbe87('0x18')](_0xbe87('0x28'),_0x3287d1[_0xbe87('0x19')],_0x36b0b6);_0x29266c(_this[_0xbe87('0x18')](0x1f4,_0x3287d1[_0xbe87('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index ffaff04..13ea08f 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 _0xfd6b=['./faxInteraction.events','save','removeListener','register','length','faxInteraction:'];(function(_0x3ffb28,_0x5de69b){var _0x4a9a39=function(_0x1a2af1){while(--_0x1a2af1){_0x3ffb28['push'](_0x3ffb28['shift']());}};_0x4a9a39(++_0x5de69b);}(_0xfd6b,0x1f2));var _0xbfd6=function(_0x23e111,_0x373c12){_0x23e111=_0x23e111-0x0;var _0x5ea3dd=_0xfd6b[_0x23e111];return _0x5ea3dd;};'use strict';var FaxInteractionEvents=require(_0xbfd6('0x0'));var events=[_0xbfd6('0x1'),'remove','update'];function createListener(_0x31b03c,_0x48439a){return function(_0x3f4fb0){_0x48439a['emit'](_0x31b03c,_0x3f4fb0);};}function removeListener(_0x3bda0a,_0x1ccea3){return function(){FaxInteractionEvents[_0xbfd6('0x2')](_0x3bda0a,_0x1ccea3);};}exports[_0xbfd6('0x3')]=function(_0xb3f63c){for(var _0x3a2cb5=0x0,_0x2ea1be=events[_0xbfd6('0x4')];_0x3a2cb5<_0x2ea1be;_0x3a2cb5++){var _0x91a034=events[_0x3a2cb5];var _0x5ab08e=createListener(_0xbfd6('0x5')+_0x91a034,_0xb3f63c);FaxInteractionEvents['on'](_0x91a034,_0x5ab08e);}}; \ No newline at end of file +var _0x109f=['faxInteraction:','./faxInteraction.events','save','removeListener','register','length'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x109f,0x157));var _0xf109=function(_0x39e3fa,_0x5daf9d){_0x39e3fa=_0x39e3fa-0x0;var _0x311569=_0x109f[_0x39e3fa];return _0x311569;};'use strict';var FaxInteractionEvents=require(_0xf109('0x0'));var events=[_0xf109('0x1'),'remove','update'];function createListener(_0x360f3d,_0x44a18b){return function(_0x379e42){_0x44a18b['emit'](_0x360f3d,_0x379e42);};}function removeListener(_0x42259f,_0x304505){return function(){FaxInteractionEvents[_0xf109('0x2')](_0x42259f,_0x304505);};}exports[_0xf109('0x3')]=function(_0x1f1658){for(var _0x107122=0x0,_0xfd3db7=events[_0xf109('0x4')];_0x107122<_0xfd3db7;_0x107122++){var _0x442854=events[_0x107122];var _0x3a0c37=createListener(_0xf109('0x5')+_0x442854,_0x1f1658);FaxInteractionEvents['on'](_0x442854,_0x3a0c37);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 7b7e25e..639ad6a 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 _0xb73b=['post','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','index','/describe','describe','get','show','getMessages','/:id/download','download'];(function(_0x3e3936,_0x24c3a6){var _0x10be4e=function(_0x271a5d){while(--_0x271a5d){_0x3e3936['push'](_0x3e3936['shift']());}};_0x10be4e(++_0x24c3a6);}(_0xb73b,0x14f));var _0xbb73=function(_0x9ad710,_0x449a0e){_0x9ad710=_0x9ad710-0x0;var _0x5c1bd6=_0xb73b[_0x9ad710];return _0x5c1bd6;};'use strict';var multer=require(_0xbb73('0x0'));var util=require(_0xbb73('0x1'));var path=require('path');var timeout=require(_0xbb73('0x2'));var express=require(_0xbb73('0x3'));var router=express[_0xbb73('0x4')]();var fs_extra=require(_0xbb73('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbb73('0x6'));var config=require('../../config/environment');var controller=require(_0xbb73('0x7'));router['get']('/',auth[_0xbb73('0x8')](),controller[_0xbb73('0x9')]);router['get'](_0xbb73('0xa'),auth['isAuthenticated'](),controller[_0xbb73('0xb')]);router[_0xbb73('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xbb73('0xd')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xbb73('0xe')]);router[_0xbb73('0xc')](_0xbb73('0xf'),auth[_0xbb73('0x8')](),controller[_0xbb73('0x10')]);router[_0xbb73('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/messages',auth[_0xbb73('0x8')](),controller['addMessage']);router[_0xbb73('0x11')](_0xbb73('0x12'),auth[_0xbb73('0x8')](),interaction[_0xbb73('0x13')](_0xbb73('0x14'),_0xbb73('0x15')),controller[_0xbb73('0x16')]);router[_0xbb73('0x17')](_0xbb73('0x18'),auth[_0xbb73('0x8')](),interaction[_0xbb73('0x13')]('fax',_0xbb73('0x19')),controller[_0xbb73('0x1a')]);router[_0xbb73('0x1b')](_0xbb73('0x18'),auth[_0xbb73('0x8')](),interaction['tracked']('fax',_0xbb73('0x1c')),controller[_0xbb73('0x1d')]);router['delete'](_0xbb73('0x12'),auth[_0xbb73('0x8')](),controller[_0xbb73('0x1e')]);module[_0xbb73('0x1f')]=router; \ No newline at end of file +var _0x5b02=['/:id/messages','addMessage','fax','addTags','tracked','faxinteraction:update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','index','get','/describe','/:id','isAuthenticated','show','/:id/download','download','post','create'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x5b02,0xbf));var _0x25b0=function(_0x5216b1,_0x459e39){_0x5216b1=_0x5216b1-0x0;var _0x4c138b=_0x5b02[_0x5216b1];return _0x4c138b;};'use strict';var multer=require(_0x25b0('0x0'));var util=require('util');var path=require(_0x25b0('0x1'));var timeout=require(_0x25b0('0x2'));var express=require(_0x25b0('0x3'));var router=express['Router']();var fs_extra=require(_0x25b0('0x4'));var auth=require(_0x25b0('0x5'));var interaction=require(_0x25b0('0x6'));var config=require(_0x25b0('0x7'));var controller=require(_0x25b0('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x25b0('0x9')]);router[_0x25b0('0xa')](_0x25b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x25b0('0xa')](_0x25b0('0xc'),auth[_0x25b0('0xd')](),controller[_0x25b0('0xe')]);router[_0x25b0('0xa')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x25b0('0xa')](_0x25b0('0xf'),auth['isAuthenticated'](),controller[_0x25b0('0x10')]);router[_0x25b0('0x11')]('/',auth[_0x25b0('0xd')](),controller[_0x25b0('0x12')]);router[_0x25b0('0x11')](_0x25b0('0x13'),auth[_0x25b0('0xd')](),controller[_0x25b0('0x14')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0x25b0('0x15'),'faxinteraction:addtags'),controller[_0x25b0('0x16')]);router['put'](_0x25b0('0xc'),auth[_0x25b0('0xd')](),interaction[_0x25b0('0x17')](_0x25b0('0x15'),_0x25b0('0x18')),controller['update']);router[_0x25b0('0x19')](_0x25b0('0xc'),auth[_0x25b0('0xd')](),interaction[_0x25b0('0x17')]('fax',_0x25b0('0x1a')),controller[_0x25b0('0x1b')]);router[_0x25b0('0x19')](_0x25b0('0x1c'),auth[_0x25b0('0xd')](),controller[_0x25b0('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 94077e7..f768387 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 _0x4a81=['DATE','sequelize','exports','TEXT','medium','out'];(function(_0x3a1ac1,_0x15b77c){var _0x2e1eb0=function(_0x103c71){while(--_0x103c71){_0x3a1ac1['push'](_0x3a1ac1['shift']());}};_0x2e1eb0(++_0x15b77c);}(_0x4a81,0x1b7));var _0x14a8=function(_0x350346,_0x360c77){_0x350346=_0x350346-0x0;var _0x1686c5=_0x4a81[_0x350346];return _0x1686c5;};'use strict';var Sequelize=require(_0x14a8('0x0'));module[_0x14a8('0x1')]={'body':{'type':Sequelize[_0x14a8('0x2')](_0x14a8('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x14a8('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x14a8('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x14a8('0x5')]}}; \ No newline at end of file +var _0x2029=['DATE','sequelize','exports','medium','BOOLEAN','ENUM','out','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2029,0x171));var _0x9202=function(_0x383067,_0x37f66f){_0x383067=_0x383067-0x0;var _0x354a87=_0x2029[_0x383067];return _0x354a87;};'use strict';var Sequelize=require(_0x9202('0x0'));module[_0x9202('0x1')]={'body':{'type':Sequelize['TEXT'](_0x9202('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9202('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9202('0x4')]('in',_0x9202('0x5')),'defaultValue':_0x9202('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x9202('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0x9202('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index ff4832a..7f94537 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 _0xd2b0=['create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','server','files','join','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','save','destroy','sendStatus','stack','name','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','FaxMessage','findAll','rows','params','keys','find','update','body','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','User','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','role','RejectMessage','rejectMessage','ContactId','SELECT','contact','fullname','rejectmessage'];(function(_0x10034d,_0x1440dd){var _0x3db847=function(_0x25fa7e){while(--_0x25fa7e){_0x10034d['push'](_0x10034d['shift']());}};_0x3db847(++_0x1440dd);}(_0xd2b0,0x1b4));var _0x0d2b=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0xd2b0[_0x37a79c];return _0x561d89;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0d2b('0x0'));var jsonpatch=require(_0x0d2b('0x1'));var rp=require(_0x0d2b('0x2'));var moment=require(_0x0d2b('0x3'));var BPromise=require(_0x0d2b('0x4'));var Mustache=require(_0x0d2b('0x5'));var util=require(_0x0d2b('0x6'));var path=require(_0x0d2b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d2b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d2b('0x9'));var squel=require(_0x0d2b('0xa'));var crypto=require('crypto');var jsforce=require(_0x0d2b('0xb'));var deskjs=require(_0x0d2b('0xc'));var toCsv=require(_0x0d2b('0xd'));var querystring=require(_0x0d2b('0xe'));var Papa=require('papaparse');var Redis=require(_0x0d2b('0xf'));var authService=require(_0x0d2b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0d2b('0x11'));var hardwareService=require(_0x0d2b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0d2b('0x13'));var config=require(_0x0d2b('0x14'));var licenseUtil=require(_0x0d2b('0x15'));var db=require(_0x0d2b('0x16'))['db'];config[_0x0d2b('0x17')]=_[_0x0d2b('0x18')](config['redis'],{'host':_0x0d2b('0x19'),'port':0x18eb});var socket=require(_0x0d2b('0x1a'))(new Redis(config[_0x0d2b('0x17')]));require(_0x0d2b('0x1b'))[_0x0d2b('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0d2b('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x0d2b('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e29c7,_0x4e2fec,_0x4cc29f,_0xa3f09b){return new BPromise(function(_0x1068f3,_0x1de58f){var _0x25874b=_0xa3f09b||client;return _0x25874b['request'](_0x3e29c7,_0x4cc29f)[_0x0d2b('0x1e')](function(_0x5db34){logger[_0x0d2b('0x1f')](_0x0d2b('0x20'),_0x4e2fec,_0x0d2b('0x21'));logger[_0x0d2b('0x22')](_0x0d2b('0x23'),_0x4e2fec,_0x0d2b('0x21'),JSON[_0x0d2b('0x24')](_0x5db34));if(_0x5db34['error']){if(_0x5db34['error'][_0x0d2b('0x25')]===0x1f4){logger[_0x0d2b('0x26')](_0x0d2b('0x20'),_0x4e2fec,_0x5db34[_0x0d2b('0x26')][_0x0d2b('0x27')]);return _0x1de58f(_0x5db34[_0x0d2b('0x26')][_0x0d2b('0x27')]);}logger[_0x0d2b('0x26')](_0x0d2b('0x20'),_0x4e2fec,_0x5db34['error'][_0x0d2b('0x27')]);return _0x1068f3(_0x5db34[_0x0d2b('0x26')][_0x0d2b('0x27')]);}else{logger[_0x0d2b('0x1f')](_0x0d2b('0x20'),_0x4e2fec,_0x0d2b('0x21'));_0x1068f3(_0x5db34[_0x0d2b('0x28')][_0x0d2b('0x27')]);}})[_0x0d2b('0x29')](function(_0x20e79e){logger[_0x0d2b('0x26')](_0x0d2b('0x20'),_0x4e2fec,_0x20e79e);_0x1de58f(_0x20e79e);});});}function respondWithStatusCode(_0x3d694d,_0x45ca6f){_0x45ca6f=_0x45ca6f||0xcc;return function(_0x2a99b4){if(_0x2a99b4){return _0x3d694d['sendStatus'](_0x45ca6f);}return _0x3d694d[_0x0d2b('0x2a')](_0x45ca6f)[_0x0d2b('0x2b')]();};}function respondWithResult(_0x580a32,_0x2e45ed){_0x2e45ed=_0x2e45ed||0xc8;return function(_0x241266){if(_0x241266){return _0x580a32['status'](_0x2e45ed)[_0x0d2b('0x2c')](_0x241266);}};}function respondWithFilteredResult(_0x36b9e3,_0x34ddc0){return function(_0x94acec){if(_0x94acec){var _0xd19906=typeof _0x34ddc0['offset']==='undefined'&&typeof _0x34ddc0['limit']===_0x0d2b('0x2d');var _0x2a4d0f=_0x94acec[_0x0d2b('0x2e')];var _0x45a2f2=_0xd19906?0x0:_0x34ddc0[_0x0d2b('0x2f')];var _0x189a0d=_0xd19906?_0x94acec['count']:_0x34ddc0[_0x0d2b('0x2f')]+_0x34ddc0[_0x0d2b('0x30')];var _0x206faf;if(_0x189a0d>=_0x2a4d0f){_0x189a0d=_0x2a4d0f;_0x206faf=0xc8;}else{_0x206faf=0xce;}_0x36b9e3[_0x0d2b('0x2a')](_0x206faf);return _0x36b9e3[_0x0d2b('0x31')](_0x0d2b('0x32'),_0x45a2f2+'-'+_0x189a0d+'/'+_0x2a4d0f)[_0x0d2b('0x2c')](_0x94acec);}return null;};}function patchUpdates(_0xbaee13){return function(_0x1ca313){try{jsonpatch['apply'](_0x1ca313,_0xbaee13,!![]);}catch(_0x3c27a5){return BPromise['reject'](_0x3c27a5);}return _0x1ca313[_0x0d2b('0x33')]();};}function saveUpdates(_0x133550,_0x5604e2){return function(_0x11dbe5){if(_0x11dbe5){return _0x11dbe5['update'](_0x133550)[_0x0d2b('0x1e')](function(_0x2eabd7){return _0x2eabd7;});}return null;};}function removeEntity(_0x289985,_0x3de940){return function(_0x5a9323){if(_0x5a9323){return _0x5a9323[_0x0d2b('0x34')]()[_0x0d2b('0x1e')](function(){_0x289985['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x380e6d,_0x3d05f3){return function(_0x45949b){if(!_0x45949b){_0x380e6d[_0x0d2b('0x35')](0x194);}return _0x45949b;};}function handleError(_0x596555,_0x1b193a){_0x1b193a=_0x1b193a||0x1f4;return function(_0x421e3c){logger[_0x0d2b('0x26')](_0x421e3c[_0x0d2b('0x36')]);if(_0x421e3c[_0x0d2b('0x37')]){delete _0x421e3c['name'];}_0x596555[_0x0d2b('0x2a')](_0x1b193a)['send'](_0x421e3c);};}exports[_0x0d2b('0x38')]=function(_0x5a211a,_0x2fc284){var _0x27189a={},_0x40e98c={},_0x2380d7={'count':0x0,'rows':[]};var _0x14a24c=_[_0x0d2b('0x39')](db['FaxMessage'][_0x0d2b('0x3a')],function(_0x2c10dd){return{'name':_0x2c10dd['fieldName'],'type':_0x2c10dd[_0x0d2b('0x3b')][_0x0d2b('0x3c')]};});_0x40e98c[_0x0d2b('0x3d')]=_[_0x0d2b('0x39')](_0x14a24c,'name');_0x40e98c[_0x0d2b('0x3e')]=_['keys'](_0x5a211a['query']);_0x40e98c[_0x0d2b('0x3f')]=_[_0x0d2b('0x40')](_0x40e98c[_0x0d2b('0x3d')],_0x40e98c['query']);_0x27189a[_0x0d2b('0x41')]=_[_0x0d2b('0x40')](_0x40e98c[_0x0d2b('0x3d')],qs[_0x0d2b('0x42')](_0x5a211a[_0x0d2b('0x3e')][_0x0d2b('0x42')]));_0x27189a[_0x0d2b('0x41')]=_0x27189a[_0x0d2b('0x41')][_0x0d2b('0x43')]?_0x27189a[_0x0d2b('0x41')]:_0x40e98c['model'];if(!_0x5a211a[_0x0d2b('0x3e')][_0x0d2b('0x44')](_0x0d2b('0x45'))){_0x27189a[_0x0d2b('0x30')]=qs[_0x0d2b('0x30')](_0x5a211a[_0x0d2b('0x3e')][_0x0d2b('0x30')]);_0x27189a['offset']=qs[_0x0d2b('0x2f')](_0x5a211a[_0x0d2b('0x3e')]['offset']);}_0x27189a['order']=qs[_0x0d2b('0x46')](_0x5a211a['query']['sort']);_0x27189a[_0x0d2b('0x47')]=qs[_0x0d2b('0x3f')](_['pick'](_0x5a211a[_0x0d2b('0x3e')],_0x40e98c[_0x0d2b('0x3f')]),_0x14a24c);if(_0x5a211a['query'][_0x0d2b('0x48')]){_0x27189a[_0x0d2b('0x47')]=_[_0x0d2b('0x49')](_0x27189a['where'],{'$or':_['map'](_0x14a24c,function(_0x3ea27b){if(_0x3ea27b[_0x0d2b('0x3b')]!=='VIRTUAL'){var _0x12a268={};_0x12a268[_0x3ea27b[_0x0d2b('0x37')]]={'$like':'%'+_0x5a211a[_0x0d2b('0x3e')][_0x0d2b('0x48')]+'%'};return _0x12a268;}})});}_0x27189a=_[_0x0d2b('0x49')]({},_0x27189a,_0x5a211a[_0x0d2b('0x4a')]);var _0x3c4cdc={'where':_0x27189a[_0x0d2b('0x47')]};return db['FaxMessage'][_0x0d2b('0x2e')](_0x3c4cdc)[_0x0d2b('0x1e')](function(_0x20824a){_0x2380d7[_0x0d2b('0x2e')]=_0x20824a;if(_0x5a211a[_0x0d2b('0x3e')][_0x0d2b('0x4b')]){_0x27189a[_0x0d2b('0x4c')]=[{'all':!![]}];}return db[_0x0d2b('0x4d')][_0x0d2b('0x4e')](_0x27189a);})['then'](function(_0x5f56e7){_0x2380d7[_0x0d2b('0x4f')]=_0x5f56e7;return _0x2380d7;})[_0x0d2b('0x1e')](respondWithFilteredResult(_0x2fc284,_0x27189a))[_0x0d2b('0x29')](handleError(_0x2fc284,null));};exports['show']=function(_0x584e21,_0x3fbe28){var _0x5368e9={'raw':!![],'where':{'id':_0x584e21[_0x0d2b('0x50')]['id']}},_0x55782b={};_0x55782b[_0x0d2b('0x3d')]=_[_0x0d2b('0x51')](db[_0x0d2b('0x4d')][_0x0d2b('0x3a')]);_0x55782b['query']=_[_0x0d2b('0x51')](_0x584e21[_0x0d2b('0x3e')]);_0x55782b[_0x0d2b('0x3f')]=_[_0x0d2b('0x40')](_0x55782b[_0x0d2b('0x3d')],_0x55782b[_0x0d2b('0x3e')]);_0x5368e9[_0x0d2b('0x41')]=_['intersection'](_0x55782b['model'],qs[_0x0d2b('0x42')](_0x584e21[_0x0d2b('0x3e')]['fields']));_0x5368e9[_0x0d2b('0x41')]=_0x5368e9[_0x0d2b('0x41')][_0x0d2b('0x43')]?_0x5368e9['attributes']:_0x55782b[_0x0d2b('0x3d')];if(_0x584e21[_0x0d2b('0x3e')][_0x0d2b('0x4b')]){_0x5368e9[_0x0d2b('0x4c')]=[{'all':!![]}];}_0x5368e9=_['merge']({},_0x5368e9,_0x584e21['options']);return db['FaxMessage'][_0x0d2b('0x52')](_0x5368e9)[_0x0d2b('0x1e')](handleEntityNotFound(_0x3fbe28,null))[_0x0d2b('0x1e')](respondWithResult(_0x3fbe28,null))['catch'](handleError(_0x3fbe28,null));};exports[_0x0d2b('0x53')]=function(_0x30b6bc,_0x58b621){if(_0x30b6bc[_0x0d2b('0x54')]['id']){delete _0x30b6bc[_0x0d2b('0x54')]['id'];}return db['FaxMessage'][_0x0d2b('0x52')]({'where':{'id':_0x30b6bc[_0x0d2b('0x50')]['id']}})[_0x0d2b('0x1e')](handleEntityNotFound(_0x58b621,null))[_0x0d2b('0x1e')](saveUpdates(_0x30b6bc[_0x0d2b('0x54')],null))[_0x0d2b('0x1e')](respondWithResult(_0x58b621,null))[_0x0d2b('0x29')](handleError(_0x58b621,null));};exports[_0x0d2b('0x34')]=function(_0x2f02f2,_0x3ae57b){return db['FaxMessage'][_0x0d2b('0x52')]({'where':{'id':_0x2f02f2['params']['id']}})[_0x0d2b('0x1e')](handleEntityNotFound(_0x3ae57b,null))[_0x0d2b('0x1e')](removeEntity(_0x3ae57b,null))[_0x0d2b('0x29')](handleError(_0x3ae57b,null));};exports[_0x0d2b('0x55')]=function(_0x38717b,_0x1ed883){return db[_0x0d2b('0x4d')]['describe']()[_0x0d2b('0x1e')](respondWithResult(_0x1ed883,null))[_0x0d2b('0x29')](handleError(_0x1ed883,null));};var interaction_log=require(_0x0d2b('0x56'))(_0x0d2b('0x57'));exports[_0x0d2b('0x58')]=function(_0xdbaa63,_0x1fcdf7,_0x48ca76){var _0x3242bd={'agent':{},'channel':_0x0d2b('0x59')};if(_0xdbaa63['body']['id']){delete _0xdbaa63[_0x0d2b('0x54')]['id'];}_0xdbaa63[_0x0d2b('0x54')][_0x0d2b('0x5a')]=!![];_0xdbaa63['body'][_0x0d2b('0x5b')]=moment()['format'](_0x0d2b('0x5c'));_0xdbaa63[_0x0d2b('0x54')][_0x0d2b('0x5d')]=_0xdbaa63[_0x0d2b('0x54')][_0x0d2b('0x5d')]||_0xdbaa63[_0x0d2b('0x5e')]['id'];_0x3242bd[_0x0d2b('0x5f')]['id']=_0xdbaa63[_0x0d2b('0x54')][_0x0d2b('0x5d')];return db[_0x0d2b('0x4d')][_0x0d2b('0x52')]({'where':{'id':_0xdbaa63['params']['id'],'UserId':null}})[_0x0d2b('0x1e')](handleEntityNotFound(_0x1fcdf7,null))['then'](saveUpdates(_0xdbaa63[_0x0d2b('0x54')],null))[_0x0d2b('0x1e')](function(_0x16baac){if(_0x16baac){_0x3242bd['message']=_0x16baac[_0x0d2b('0x60')]({'plain':!![]});return db[_0x0d2b('0x61')][_0x0d2b('0x52')]({'where':{'id':_0x16baac[_0x0d2b('0x62')]}});}return null;})[_0x0d2b('0x1e')](handleEntityNotFound(_0x1fcdf7,null))['then'](function(_0x1f1d6f){if(_0x1f1d6f){return _0x1f1d6f[_0x0d2b('0x53')]({'UserId':_0xdbaa63[_0x0d2b('0x54')]['UserId'],'read1stAt':_[_0x0d2b('0x63')](_0x1f1d6f[_0x0d2b('0x64')])?moment()[_0x0d2b('0x65')](_0x0d2b('0x5c')):undefined});}return null;})['then'](function(_0x52a856){if(_0x52a856){_0x3242bd[_0x0d2b('0x66')]=_0x52a856[_0x0d2b('0x60')]({'plain':!![]});interaction_log[_0x0d2b('0x1f')](_0x0d2b('0x67'),_0xdbaa63[_0x0d2b('0x5e')]['id'],_0xdbaa63['user'][_0x0d2b('0x37')],_0xdbaa63[_0x0d2b('0x5e')]['role'],_0x3242bd[_0x0d2b('0x66')]['id'],_0xdbaa63[_0x0d2b('0x54')]?JSON['stringify'](_0xdbaa63[_0x0d2b('0x54')]):_0x0d2b('0x68'));return respondWithRpcPromise('AcceptMessage',_0x0d2b('0x69'),_0x3242bd);}return null;})['then'](function(_0x534151){var _0x4972a8=_0x0d2b('0x6a')+_0x534151[_0x0d2b('0x27')]['ContactId'];return db[_0x0d2b('0x6b')]['query'](_0x4972a8,{'type':db['Sequelize'][_0x0d2b('0x6c')]['SELECT'],'raw':!![]})[_0x0d2b('0x1e')](function(_0x256679){return _0x256679;});})[_0x0d2b('0x1e')](function(_0x3f6a1e){if(_0x3f6a1e){_0x3242bd[_0x0d2b('0x27')]['contact']=_0x3f6a1e[0x0];if(!_0xdbaa63[_0x0d2b('0x54')][_0x0d2b('0x5d')])return;return db[_0x0d2b('0x6d')][_0x0d2b('0x52')]({'where':{'id':_0xdbaa63['body']['UserId'],'role':_0x0d2b('0x5f')},'attributes':['id',_0x0d2b('0x37'),'fullname',_0x0d2b('0x6e'),_0x0d2b('0x6f')],'raw':!![]});}return null;})[_0x0d2b('0x1e')](function(_0x55c949){if(!_0x55c949)return null;_0x3242bd[_0x0d2b('0x27')][_0x0d2b('0x5f')]=_0x55c949;return _0x3242bd;})[_0x0d2b('0x1e')](function(_0x4c5475){if(_0x4c5475){if(_0xdbaa63[_0x0d2b('0x54')]['manual']){_0x3242bd[_0x0d2b('0x27')][_0x0d2b('0x70')]=util[_0x0d2b('0x65')](_0x0d2b('0x71'),_0xdbaa63[_0x0d2b('0x5e')]['name']);_0x3242bd[_0x0d2b('0x27')][_0x0d2b('0x72')]=_0x3242bd[_0x0d2b('0x72')];_0x3242bd[_0x0d2b('0x27')][_0x0d2b('0x73')]=_0x3242bd['channel'];_0x3242bd[_0x0d2b('0x27')][_0x0d2b('0x74')]='accept';return respondWithRpcPromise(_0x0d2b('0x75'),'EventManager',{'event':_0x0d2b('0x76'),'message':_0x3242bd[_0x0d2b('0x27')]},client9002)[_0x0d2b('0x1e')](function(){return _0x3242bd;});}return _0x3242bd;}return null;})[_0x0d2b('0x1e')](respondWithResult(_0x1fcdf7,null))[_0x0d2b('0x29')](handleError(_0x1fcdf7,null));};var interaction_log=require(_0x0d2b('0x56'))(_0x0d2b('0x57'));exports[_0x0d2b('0x77')]=function(_0x20e2af,_0xa97314,_0x25ccbb){var _0x298799={'agent':{},'channel':_0x0d2b('0x59')};if(_0x20e2af['body']['id']){delete _0x20e2af[_0x0d2b('0x54')]['id'];}_0x20e2af[_0x0d2b('0x54')][_0x0d2b('0x5d')]=_0x20e2af[_0x0d2b('0x54')][_0x0d2b('0x5d')]||_0x20e2af[_0x0d2b('0x5e')]['id'];_0x298799[_0x0d2b('0x5f')]['id']=_0x20e2af[_0x0d2b('0x54')]['UserId'];return db[_0x0d2b('0x4d')][_0x0d2b('0x52')]({'where':{'id':_0x20e2af['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xa97314,null))[_0x0d2b('0x1e')](function(_0x59d757){if(_0x59d757){_0x298799['message']=_0x59d757[_0x0d2b('0x60')]({'plain':!![]});return db['FaxInteraction'][_0x0d2b('0x52')]({'where':{'id':_0x59d757['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xa97314,null))['then'](function(_0x3c6e89){if(_0x3c6e89){_0x298799[_0x0d2b('0x66')]=_0x3c6e89['get']({'plain':!![]});interaction_log[_0x0d2b('0x1f')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x20e2af[_0x0d2b('0x5e')]['id'],_0x20e2af[_0x0d2b('0x5e')][_0x0d2b('0x37')],_0x20e2af['user'][_0x0d2b('0x78')],_0x298799['interaction']['id'],_0x20e2af[_0x0d2b('0x54')]?JSON[_0x0d2b('0x24')](_0x20e2af['body']):_0x0d2b('0x68'));return respondWithRpcPromise(_0x0d2b('0x79'),_0x0d2b('0x7a'),_0x298799);}return null;})[_0x0d2b('0x1e')](function(_0x5db1de){var _0x39775d=_0x0d2b('0x6a')+_0x5db1de[_0x0d2b('0x27')][_0x0d2b('0x7b')];return db[_0x0d2b('0x6b')][_0x0d2b('0x3e')](_0x39775d,{'type':db['Sequelize']['QueryTypes'][_0x0d2b('0x7c')],'raw':!![]})[_0x0d2b('0x1e')](function(_0x567086){return _0x567086;});})[_0x0d2b('0x1e')](function(_0x5dd1af){if(_0x5dd1af){_0x298799[_0x0d2b('0x27')][_0x0d2b('0x7d')]=_0x5dd1af[0x0];if(!_0x20e2af[_0x0d2b('0x54')][_0x0d2b('0x5d')])return;return db[_0x0d2b('0x6d')]['find']({'where':{'id':_0x20e2af[_0x0d2b('0x54')][_0x0d2b('0x5d')],'role':_0x0d2b('0x5f')},'attributes':['id',_0x0d2b('0x37'),_0x0d2b('0x7e'),_0x0d2b('0x6e'),_0x0d2b('0x6f')],'raw':!![]});}return null;})[_0x0d2b('0x1e')](function(_0x91623a){if(!_0x91623a)return null;_0x298799[_0x0d2b('0x27')][_0x0d2b('0x5f')]=_0x91623a;return _0x298799;})['then'](function(_0x284744){if(_0x284744){_0x284744[_0x0d2b('0x27')][_0x0d2b('0x70')]=util[_0x0d2b('0x65')](_0x0d2b('0x71'),_0x20e2af[_0x0d2b('0x5e')][_0x0d2b('0x37')]);_0x284744[_0x0d2b('0x27')][_0x0d2b('0x72')]=_0x298799['channel'];_0x284744[_0x0d2b('0x27')][_0x0d2b('0x73')]=_0x298799[_0x0d2b('0x72')];_0x284744['message'][_0x0d2b('0x74')]=_0x0d2b('0x77');respondWithRpcPromise(_0x0d2b('0x75'),_0x0d2b('0x75'),{'event':_0x0d2b('0x7f'),'message':_0x284744['message']},client9002);return _0x298799;}return null;})[_0x0d2b('0x1e')](respondWithResult(_0xa97314,null))[_0x0d2b('0x29')](handleError(_0xa97314,null));};exports[_0x0d2b('0x80')]=function(_0x14dc1d,_0x1d0deb){var _0x4c7447;return db[_0x0d2b('0x4d')][_0x0d2b('0x80')](_0x14dc1d[_0x0d2b('0x54')],{})[_0x0d2b('0x1e')](function(_0x1286a4){_0x4c7447=_0x1286a4;return db[_0x0d2b('0x81')][_0x0d2b('0x82')]({'where':{'id':_0x4c7447[_0x0d2b('0x7b')]}});})[_0x0d2b('0x1e')](function(_0x4fab7a){if(_[_0x0d2b('0x63')](_0x4fab7a)){return;}else{_0x4c7447[_0x0d2b('0x59')]=_0x4fab7a['fax'];return db[_0x0d2b('0x83')]['findOne']({'where':{'id':_0x4c7447[_0x0d2b('0x84')]}});}})[_0x0d2b('0x1e')](function(_0x1d6173){return respondWithRpcPromise('SendFax',_0x0d2b('0x85'),{'FaxAccountId':_['isNil'](_0x14dc1d[_0x0d2b('0x54')])?undefined:_0x14dc1d[_0x0d2b('0x54')][_0x0d2b('0x86')],'path':_[_0x0d2b('0x63')](_0x1d6173)?undefined:util[_0x0d2b('0x65')](_0x0d2b('0x87'),_0x1d6173[_0x0d2b('0x88')]),'fax':_[_0x0d2b('0x63')](_0x4c7447[_0x0d2b('0x59')])?undefined:_0x4c7447[_0x0d2b('0x59')],'AttachmentId':_0x4c7447['AttachmentId']},client9002);})['then'](respondWithResult(_0x1d0deb,0xc9))[_0x0d2b('0x29')](handleError(_0x1d0deb,null));};exports[_0x0d2b('0x89')]=function(_0x1f3975,_0x59d20f){var _0x34f788=path['join'](config['root'],_0x0d2b('0x8a'),_0x0d2b('0x8b'),'attachments');return db[_0x0d2b('0x4d')]['find']({'where':{'id':_0x1f3975[_0x0d2b('0x50')]['id']},'include':[{'model':db[_0x0d2b('0x83')],'as':'Attachment'}]})[_0x0d2b('0x1e')](handleEntityNotFound(_0x59d20f,null))['then'](function(_0x2212ac){if(_0x2212ac){return _0x59d20f[_0x0d2b('0x89')](path[_0x0d2b('0x8c')](_0x34f788,_0x2212ac[_0x0d2b('0x83')][_0x0d2b('0x88')]));}})[_0x0d2b('0x29')](handleError(_0x59d20f,null));}; \ No newline at end of file +var _0xefce=['findAll','rows','show','params','includeAll','include','catch','body','find','describe','../../config/logger','fax-interactions','readAt','format','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','event','accept','EventManager','acceptmessage','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','interface','motionChannel','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','attachments','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','end','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','order','where','filters','filter','VIRTUAL','merge','options'];(function(_0x4a4c4e,_0x4c6599){var _0x376e35=function(_0x5d1672){while(--_0x5d1672){_0x4a4c4e['push'](_0x4a4c4e['shift']());}};_0x376e35(++_0x4c6599);}(_0xefce,0xd3));var _0xeefc=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0xefce[_0xce93c];return _0x230720;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeefc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeefc('0x1'));var rp=require(_0xeefc('0x2'));var moment=require(_0xeefc('0x3'));var BPromise=require(_0xeefc('0x4'));var Mustache=require('mustache');var util=require(_0xeefc('0x5'));var path=require(_0xeefc('0x6'));var sox=require(_0xeefc('0x7'));var csv=require(_0xeefc('0x8'));var ejs=require(_0xeefc('0x9'));var fs=require('fs');var fs_extra=require(_0xeefc('0xa'));var _=require(_0xeefc('0xb'));var squel=require(_0xeefc('0xc'));var crypto=require(_0xeefc('0xd'));var jsforce=require(_0xeefc('0xe'));var deskjs=require(_0xeefc('0xf'));var toCsv=require(_0xeefc('0x8'));var querystring=require(_0xeefc('0x10'));var Papa=require(_0xeefc('0x11'));var Redis=require(_0xeefc('0x12'));var authService=require(_0xeefc('0x13'));var qs=require(_0xeefc('0x14'));var as=require(_0xeefc('0x15'));var hardwareService=require(_0xeefc('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xeefc('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xeefc('0x18'));var db=require(_0xeefc('0x19'))['db'];config[_0xeefc('0x1a')]=_[_0xeefc('0x1b')](config[_0xeefc('0x1a')],{'host':_0xeefc('0x1c'),'port':0x18eb});var socket=require(_0xeefc('0x1d'))(new Redis(config[_0xeefc('0x1a')]));require(_0xeefc('0x1e'))[_0xeefc('0x1f')](socket);var jayson=require(_0xeefc('0x20'));var client=jayson[_0xeefc('0x21')][_0xeefc('0x22')]({'port':0x232c});var client9002=jayson[_0xeefc('0x21')][_0xeefc('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x138a10,_0x324c38,_0x67403,_0xb86d65){return new BPromise(function(_0x4f3543,_0x36eaad){var _0x54cc1e=_0xb86d65||client;return _0x54cc1e['request'](_0x138a10,_0x67403)['then'](function(_0x399d88){logger['info'](_0xeefc('0x23'),_0x324c38,'request\x20sent');logger[_0xeefc('0x24')](_0xeefc('0x25'),_0x324c38,_0xeefc('0x26'),JSON[_0xeefc('0x27')](_0x399d88));if(_0x399d88['error']){if(_0x399d88[_0xeefc('0x28')]['code']===0x1f4){logger[_0xeefc('0x28')](_0xeefc('0x23'),_0x324c38,_0x399d88[_0xeefc('0x28')][_0xeefc('0x29')]);return _0x36eaad(_0x399d88[_0xeefc('0x28')][_0xeefc('0x29')]);}logger[_0xeefc('0x28')](_0xeefc('0x23'),_0x324c38,_0x399d88[_0xeefc('0x28')]['message']);return _0x4f3543(_0x399d88[_0xeefc('0x28')]['message']);}else{logger[_0xeefc('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x324c38,'request\x20sent');_0x4f3543(_0x399d88[_0xeefc('0x2b')]['message']);}})['catch'](function(_0x48dd6e){logger[_0xeefc('0x28')](_0xeefc('0x23'),_0x324c38,_0x48dd6e);_0x36eaad(_0x48dd6e);});});}function respondWithStatusCode(_0x39e9b5,_0x2fad54){_0x2fad54=_0x2fad54||0xcc;return function(_0x24671d){if(_0x24671d){return _0x39e9b5[_0xeefc('0x2c')](_0x2fad54);}return _0x39e9b5[_0xeefc('0x2d')](_0x2fad54)['end']();};}function respondWithResult(_0x3c8344,_0x4b7040){_0x4b7040=_0x4b7040||0xc8;return function(_0x88f838){if(_0x88f838){return _0x3c8344[_0xeefc('0x2d')](_0x4b7040)[_0xeefc('0x2e')](_0x88f838);}};}function respondWithFilteredResult(_0x278cea,_0x5705a8){return function(_0x414d15){if(_0x414d15){var _0xa23d94=typeof _0x5705a8[_0xeefc('0x2f')]===_0xeefc('0x30')&&typeof _0x5705a8[_0xeefc('0x31')]===_0xeefc('0x30');var _0x4f84e3=_0x414d15[_0xeefc('0x32')];var _0x5b0db5=_0xa23d94?0x0:_0x5705a8[_0xeefc('0x2f')];var _0x1522a2=_0xa23d94?_0x414d15['count']:_0x5705a8['offset']+_0x5705a8[_0xeefc('0x31')];var _0x5be091;if(_0x1522a2>=_0x4f84e3){_0x1522a2=_0x4f84e3;_0x5be091=0xc8;}else{_0x5be091=0xce;}_0x278cea[_0xeefc('0x2d')](_0x5be091);return _0x278cea[_0xeefc('0x33')](_0xeefc('0x34'),_0x5b0db5+'-'+_0x1522a2+'/'+_0x4f84e3)['json'](_0x414d15);}return null;};}function patchUpdates(_0x48e3ee){return function(_0xde702b){try{jsonpatch[_0xeefc('0x35')](_0xde702b,_0x48e3ee,!![]);}catch(_0x477e28){return BPromise[_0xeefc('0x36')](_0x477e28);}return _0xde702b[_0xeefc('0x37')]();};}function saveUpdates(_0x5bea01,_0x39db55){return function(_0x2b706f){if(_0x2b706f){return _0x2b706f['update'](_0x5bea01)['then'](function(_0x283ee5){return _0x283ee5;});}return null;};}function removeEntity(_0x238296,_0x4b169f){return function(_0x101a67){if(_0x101a67){return _0x101a67[_0xeefc('0x38')]()[_0xeefc('0x39')](function(){_0x238296[_0xeefc('0x2d')](0xcc)[_0xeefc('0x3a')]();});}};}function handleEntityNotFound(_0x160d8d,_0x1ba103){return function(_0x25e616){if(!_0x25e616){_0x160d8d[_0xeefc('0x2c')](0x194);}return _0x25e616;};}function handleError(_0x3f7753,_0x15f162){_0x15f162=_0x15f162||0x1f4;return function(_0x3b7343){logger[_0xeefc('0x28')](_0x3b7343['stack']);if(_0x3b7343[_0xeefc('0x3b')]){delete _0x3b7343[_0xeefc('0x3b')];}_0x3f7753[_0xeefc('0x2d')](_0x15f162)[_0xeefc('0x3c')](_0x3b7343);};}exports[_0xeefc('0x3d')]=function(_0x4c7a83,_0x1b4c02){var _0x1da51f={},_0x5daf88={},_0x1820ff={'count':0x0,'rows':[]};var _0x205d57=_[_0xeefc('0x3e')](db[_0xeefc('0x3f')][_0xeefc('0x40')],function(_0x568a78){return{'name':_0x568a78[_0xeefc('0x41')],'type':_0x568a78[_0xeefc('0x42')]['key']};});_0x5daf88[_0xeefc('0x43')]=_['map'](_0x205d57,_0xeefc('0x3b'));_0x5daf88[_0xeefc('0x44')]=_[_0xeefc('0x45')](_0x4c7a83[_0xeefc('0x44')]);_0x5daf88['filters']=_[_0xeefc('0x46')](_0x5daf88['model'],_0x5daf88['query']);_0x1da51f['attributes']=_['intersection'](_0x5daf88[_0xeefc('0x43')],qs['fields'](_0x4c7a83[_0xeefc('0x44')][_0xeefc('0x47')]));_0x1da51f[_0xeefc('0x48')]=_0x1da51f['attributes'][_0xeefc('0x49')]?_0x1da51f[_0xeefc('0x48')]:_0x5daf88[_0xeefc('0x43')];if(!_0x4c7a83['query']['hasOwnProperty']('nolimit')){_0x1da51f[_0xeefc('0x31')]=qs[_0xeefc('0x31')](_0x4c7a83['query'][_0xeefc('0x31')]);_0x1da51f[_0xeefc('0x2f')]=qs['offset'](_0x4c7a83['query']['offset']);}_0x1da51f[_0xeefc('0x4a')]=qs['sort'](_0x4c7a83['query']['sort']);_0x1da51f[_0xeefc('0x4b')]=qs[_0xeefc('0x4c')](_['pick'](_0x4c7a83['query'],_0x5daf88[_0xeefc('0x4c')]),_0x205d57);if(_0x4c7a83[_0xeefc('0x44')][_0xeefc('0x4d')]){_0x1da51f['where']=_['merge'](_0x1da51f[_0xeefc('0x4b')],{'$or':_[_0xeefc('0x3e')](_0x205d57,function(_0x60622d){if(_0x60622d[_0xeefc('0x42')]!==_0xeefc('0x4e')){var _0x1d1710={};_0x1d1710[_0x60622d[_0xeefc('0x3b')]]={'$like':'%'+_0x4c7a83[_0xeefc('0x44')][_0xeefc('0x4d')]+'%'};return _0x1d1710;}})});}_0x1da51f=_[_0xeefc('0x4f')]({},_0x1da51f,_0x4c7a83[_0xeefc('0x50')]);var _0x46cb64={'where':_0x1da51f[_0xeefc('0x4b')]};return db[_0xeefc('0x3f')][_0xeefc('0x32')](_0x46cb64)[_0xeefc('0x39')](function(_0x4b8ecc){_0x1820ff['count']=_0x4b8ecc;if(_0x4c7a83[_0xeefc('0x44')]['includeAll']){_0x1da51f['include']=[{'all':!![]}];}return db[_0xeefc('0x3f')][_0xeefc('0x51')](_0x1da51f);})[_0xeefc('0x39')](function(_0x363b6f){_0x1820ff[_0xeefc('0x52')]=_0x363b6f;return _0x1820ff;})[_0xeefc('0x39')](respondWithFilteredResult(_0x1b4c02,_0x1da51f))['catch'](handleError(_0x1b4c02,null));};exports[_0xeefc('0x53')]=function(_0x248a7e,_0x267425){var _0x4d3dc8={'raw':!![],'where':{'id':_0x248a7e[_0xeefc('0x54')]['id']}},_0x116c74={};_0x116c74['model']=_[_0xeefc('0x45')](db[_0xeefc('0x3f')]['rawAttributes']);_0x116c74[_0xeefc('0x44')]=_[_0xeefc('0x45')](_0x248a7e[_0xeefc('0x44')]);_0x116c74[_0xeefc('0x4c')]=_['intersection'](_0x116c74[_0xeefc('0x43')],_0x116c74['query']);_0x4d3dc8[_0xeefc('0x48')]=_[_0xeefc('0x46')](_0x116c74[_0xeefc('0x43')],qs[_0xeefc('0x47')](_0x248a7e[_0xeefc('0x44')]['fields']));_0x4d3dc8[_0xeefc('0x48')]=_0x4d3dc8[_0xeefc('0x48')][_0xeefc('0x49')]?_0x4d3dc8[_0xeefc('0x48')]:_0x116c74[_0xeefc('0x43')];if(_0x248a7e[_0xeefc('0x44')][_0xeefc('0x55')]){_0x4d3dc8[_0xeefc('0x56')]=[{'all':!![]}];}_0x4d3dc8=_[_0xeefc('0x4f')]({},_0x4d3dc8,_0x248a7e[_0xeefc('0x50')]);return db[_0xeefc('0x3f')]['find'](_0x4d3dc8)[_0xeefc('0x39')](handleEntityNotFound(_0x267425,null))[_0xeefc('0x39')](respondWithResult(_0x267425,null))[_0xeefc('0x57')](handleError(_0x267425,null));};exports['update']=function(_0x5225a3,_0x369b85){if(_0x5225a3[_0xeefc('0x58')]['id']){delete _0x5225a3[_0xeefc('0x58')]['id'];}return db[_0xeefc('0x3f')][_0xeefc('0x59')]({'where':{'id':_0x5225a3[_0xeefc('0x54')]['id']}})[_0xeefc('0x39')](handleEntityNotFound(_0x369b85,null))[_0xeefc('0x39')](saveUpdates(_0x5225a3[_0xeefc('0x58')],null))[_0xeefc('0x39')](respondWithResult(_0x369b85,null))[_0xeefc('0x57')](handleError(_0x369b85,null));};exports[_0xeefc('0x38')]=function(_0x3f8ff9,_0x2d50bc){return db[_0xeefc('0x3f')][_0xeefc('0x59')]({'where':{'id':_0x3f8ff9[_0xeefc('0x54')]['id']}})[_0xeefc('0x39')](handleEntityNotFound(_0x2d50bc,null))['then'](removeEntity(_0x2d50bc,null))[_0xeefc('0x57')](handleError(_0x2d50bc,null));};exports[_0xeefc('0x5a')]=function(_0x15f2fa,_0x44a9e8){return db[_0xeefc('0x3f')]['describe']()[_0xeefc('0x39')](respondWithResult(_0x44a9e8,null))[_0xeefc('0x57')](handleError(_0x44a9e8,null));};var interaction_log=require(_0xeefc('0x5b'))(_0xeefc('0x5c'));exports['accept']=function(_0x2b36e1,_0x3a43a5,_0x23401d){var _0x3d1570={'agent':{},'channel':'fax'};if(_0x2b36e1[_0xeefc('0x58')]['id']){delete _0x2b36e1[_0xeefc('0x58')]['id'];}_0x2b36e1[_0xeefc('0x58')]['read']=!![];_0x2b36e1['body'][_0xeefc('0x5d')]=moment()[_0xeefc('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b36e1[_0xeefc('0x58')][_0xeefc('0x5f')]=_0x2b36e1[_0xeefc('0x58')][_0xeefc('0x5f')]||_0x2b36e1['user']['id'];_0x3d1570[_0xeefc('0x60')]['id']=_0x2b36e1[_0xeefc('0x58')][_0xeefc('0x5f')];return db[_0xeefc('0x3f')][_0xeefc('0x59')]({'where':{'id':_0x2b36e1[_0xeefc('0x54')]['id'],'UserId':null}})[_0xeefc('0x39')](handleEntityNotFound(_0x3a43a5,null))[_0xeefc('0x39')](saveUpdates(_0x2b36e1[_0xeefc('0x58')],null))['then'](function(_0x36543d){if(_0x36543d){_0x3d1570[_0xeefc('0x29')]=_0x36543d[_0xeefc('0x61')]({'plain':!![]});return db[_0xeefc('0x62')][_0xeefc('0x59')]({'where':{'id':_0x36543d[_0xeefc('0x63')]}});}return null;})[_0xeefc('0x39')](handleEntityNotFound(_0x3a43a5,null))[_0xeefc('0x39')](function(_0x38779e){if(_0x38779e){return _0x38779e['update']({'UserId':_0x2b36e1[_0xeefc('0x58')][_0xeefc('0x5f')],'read1stAt':_[_0xeefc('0x64')](_0x38779e[_0xeefc('0x65')])?moment()[_0xeefc('0x5e')](_0xeefc('0x66')):undefined});}return null;})[_0xeefc('0x39')](function(_0x15b324){if(_0x15b324){_0x3d1570[_0xeefc('0x67')]=_0x15b324[_0xeefc('0x61')]({'plain':!![]});interaction_log[_0xeefc('0x2a')](_0xeefc('0x68'),_0x2b36e1[_0xeefc('0x69')]['id'],_0x2b36e1['user'][_0xeefc('0x3b')],_0x2b36e1[_0xeefc('0x69')][_0xeefc('0x6a')],_0x3d1570['interaction']['id'],_0x2b36e1[_0xeefc('0x58')]?JSON[_0xeefc('0x27')](_0x2b36e1[_0xeefc('0x58')]):_0xeefc('0x6b'));return respondWithRpcPromise(_0xeefc('0x6c'),_0xeefc('0x6d'),_0x3d1570);}return null;})[_0xeefc('0x39')](function(_0x3c66e9){var _0x1f91e7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3c66e9['message']['ContactId'];return db[_0xeefc('0x6e')][_0xeefc('0x44')](_0x1f91e7,{'type':db[_0xeefc('0x6f')][_0xeefc('0x70')][_0xeefc('0x71')],'raw':!![]})[_0xeefc('0x39')](function(_0x4dfec8){return _0x4dfec8;});})['then'](function(_0x110c28){if(_0x110c28){_0x3d1570['message'][_0xeefc('0x72')]=_0x110c28[0x0];if(!_0x2b36e1[_0xeefc('0x58')][_0xeefc('0x5f')])return;return db[_0xeefc('0x73')][_0xeefc('0x59')]({'where':{'id':_0x2b36e1[_0xeefc('0x58')][_0xeefc('0x5f')],'role':_0xeefc('0x60')},'attributes':['id',_0xeefc('0x3b'),_0xeefc('0x74'),_0xeefc('0x75'),_0xeefc('0x76')],'raw':!![]});}return null;})[_0xeefc('0x39')](function(_0x3a6527){if(!_0x3a6527)return null;_0x3d1570[_0xeefc('0x29')][_0xeefc('0x60')]=_0x3a6527;return _0x3d1570;})[_0xeefc('0x39')](function(_0x314170){if(_0x314170){if(_0x2b36e1['body'][_0xeefc('0x77')]){_0x3d1570[_0xeefc('0x29')]['interface']=util[_0xeefc('0x5e')](_0xeefc('0x78'),_0x2b36e1[_0xeefc('0x69')][_0xeefc('0x3b')]);_0x3d1570[_0xeefc('0x29')][_0xeefc('0x79')]=_0x3d1570[_0xeefc('0x79')];_0x3d1570[_0xeefc('0x29')]['motionChannel']=_0x3d1570[_0xeefc('0x79')];_0x3d1570[_0xeefc('0x29')][_0xeefc('0x7a')]=_0xeefc('0x7b');return respondWithRpcPromise(_0xeefc('0x7c'),_0xeefc('0x7c'),{'event':_0xeefc('0x7d'),'message':_0x3d1570['message']},client9002)[_0xeefc('0x39')](function(){return _0x3d1570;});}return _0x3d1570;}return null;})[_0xeefc('0x39')](respondWithResult(_0x3a43a5,null))[_0xeefc('0x57')](handleError(_0x3a43a5,null));};var interaction_log=require(_0xeefc('0x5b'))('fax-interactions');exports[_0xeefc('0x36')]=function(_0x3519d7,_0x454ace,_0x1283c1){var _0x1f693f={'agent':{},'channel':_0xeefc('0x7e')};if(_0x3519d7['body']['id']){delete _0x3519d7[_0xeefc('0x58')]['id'];}_0x3519d7[_0xeefc('0x58')][_0xeefc('0x5f')]=_0x3519d7['body'][_0xeefc('0x5f')]||_0x3519d7['user']['id'];_0x1f693f[_0xeefc('0x60')]['id']=_0x3519d7['body'][_0xeefc('0x5f')];return db[_0xeefc('0x3f')]['find']({'where':{'id':_0x3519d7[_0xeefc('0x54')]['id'],'UserId':null}})[_0xeefc('0x39')](handleEntityNotFound(_0x454ace,null))[_0xeefc('0x39')](function(_0x27e33f){if(_0x27e33f){_0x1f693f[_0xeefc('0x29')]=_0x27e33f[_0xeefc('0x61')]({'plain':!![]});return db[_0xeefc('0x62')]['find']({'where':{'id':_0x27e33f['FaxInteractionId']}});}return null;})[_0xeefc('0x39')](handleEntityNotFound(_0x454ace,null))[_0xeefc('0x39')](function(_0x26b8e8){if(_0x26b8e8){_0x1f693f[_0xeefc('0x67')]=_0x26b8e8[_0xeefc('0x61')]({'plain':!![]});interaction_log[_0xeefc('0x2a')](_0xeefc('0x7f'),_0x3519d7['user']['id'],_0x3519d7[_0xeefc('0x69')][_0xeefc('0x3b')],_0x3519d7[_0xeefc('0x69')][_0xeefc('0x6a')],_0x1f693f[_0xeefc('0x67')]['id'],_0x3519d7[_0xeefc('0x58')]?JSON['stringify'](_0x3519d7[_0xeefc('0x58')]):_0xeefc('0x6b'));return respondWithRpcPromise(_0xeefc('0x80'),'rejectMessage',_0x1f693f);}return null;})[_0xeefc('0x39')](function(_0x344e54){var _0x5a2dd7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x344e54[_0xeefc('0x29')][_0xeefc('0x81')];return db[_0xeefc('0x6e')]['query'](_0x5a2dd7,{'type':db[_0xeefc('0x6f')][_0xeefc('0x70')]['SELECT'],'raw':!![]})[_0xeefc('0x39')](function(_0x1449a1){return _0x1449a1;});})[_0xeefc('0x39')](function(_0x155819){if(_0x155819){_0x1f693f[_0xeefc('0x29')][_0xeefc('0x72')]=_0x155819[0x0];if(!_0x3519d7[_0xeefc('0x58')][_0xeefc('0x5f')])return;return db[_0xeefc('0x73')][_0xeefc('0x59')]({'where':{'id':_0x3519d7[_0xeefc('0x58')]['UserId'],'role':_0xeefc('0x60')},'attributes':['id',_0xeefc('0x3b'),'fullname','email',_0xeefc('0x76')],'raw':!![]});}return null;})[_0xeefc('0x39')](function(_0x17d4df){if(!_0x17d4df)return null;_0x1f693f[_0xeefc('0x29')][_0xeefc('0x60')]=_0x17d4df;return _0x1f693f;})[_0xeefc('0x39')](function(_0x929a0c){if(_0x929a0c){_0x929a0c[_0xeefc('0x29')][_0xeefc('0x82')]=util['format'](_0xeefc('0x78'),_0x3519d7[_0xeefc('0x69')][_0xeefc('0x3b')]);_0x929a0c[_0xeefc('0x29')][_0xeefc('0x79')]=_0x1f693f[_0xeefc('0x79')];_0x929a0c[_0xeefc('0x29')][_0xeefc('0x83')]=_0x1f693f[_0xeefc('0x79')];_0x929a0c[_0xeefc('0x29')][_0xeefc('0x7a')]=_0xeefc('0x36');respondWithRpcPromise(_0xeefc('0x7c'),'EventManager',{'event':_0xeefc('0x84'),'message':_0x929a0c[_0xeefc('0x29')]},client9002);return _0x1f693f;}return null;})[_0xeefc('0x39')](respondWithResult(_0x454ace,null))['catch'](handleError(_0x454ace,null));};exports[_0xeefc('0x85')]=function(_0x569a8e,_0x121348){var _0x1a9199;return db[_0xeefc('0x3f')][_0xeefc('0x85')](_0x569a8e[_0xeefc('0x58')],{})[_0xeefc('0x39')](function(_0x11184f){_0x1a9199=_0x11184f;return db[_0xeefc('0x86')][_0xeefc('0x87')]({'where':{'id':_0x1a9199['ContactId']}});})[_0xeefc('0x39')](function(_0x4a7d77){if(_[_0xeefc('0x64')](_0x4a7d77)){return;}else{_0x1a9199[_0xeefc('0x7e')]=_0x4a7d77[_0xeefc('0x7e')];return db[_0xeefc('0x88')][_0xeefc('0x87')]({'where':{'id':_0x1a9199[_0xeefc('0x89')]}});}})[_0xeefc('0x39')](function(_0x1bfb6f){return respondWithRpcPromise(_0xeefc('0x8a'),_0xeefc('0x8a'),{'FaxAccountId':_[_0xeefc('0x64')](_0x569a8e[_0xeefc('0x58')])?undefined:_0x569a8e[_0xeefc('0x58')][_0xeefc('0x8b')],'path':_[_0xeefc('0x64')](_0x1bfb6f)?undefined:util['format'](_0xeefc('0x8c'),_0x1bfb6f[_0xeefc('0x8d')]),'fax':_[_0xeefc('0x64')](_0x1a9199[_0xeefc('0x7e')])?undefined:_0x1a9199['fax'],'AttachmentId':_0x1a9199[_0xeefc('0x89')]},client9002);})[_0xeefc('0x39')](respondWithResult(_0x121348,0xc9))[_0xeefc('0x57')](handleError(_0x121348,null));};exports[_0xeefc('0x8e')]=function(_0x191b6d,_0x316fca){var _0x44a3aa=path[_0xeefc('0x8f')](config['root'],_0xeefc('0x90'),'files',_0xeefc('0x91'));return db[_0xeefc('0x3f')][_0xeefc('0x59')]({'where':{'id':_0x191b6d['params']['id']},'include':[{'model':db['Attachment'],'as':_0xeefc('0x88')}]})[_0xeefc('0x39')](handleEntityNotFound(_0x316fca,null))[_0xeefc('0x39')](function(_0x394d48){if(_0x394d48){return _0x316fca[_0xeefc('0x8e')](path[_0xeefc('0x8f')](_0x44a3aa,_0x394d48[_0xeefc('0x88')][_0xeefc('0x8d')]));}})[_0xeefc('0x57')](handleError(_0x316fca,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c12fea5..ebec50b 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 _0xf9e5=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x2f4d5f,_0xda7f63){var _0x13dfeb=function(_0x567b81){while(--_0x567b81){_0x2f4d5f['push'](_0x2f4d5f['shift']());}};_0x13dfeb(++_0xda7f63);}(_0xf9e5,0x89));var _0x5f9e=function(_0x2e4b36,_0x4de9ce){_0x2e4b36=_0x2e4b36-0x0;var _0x14601d=_0xf9e5[_0x2e4b36];return _0x14601d;};'use strict';var EventEmitter=require(_0x5f9e('0x0'));var FaxMessage=require(_0x5f9e('0x1'))['db'][_0x5f9e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5f9e('0x3')](0x0);var events={'afterCreate':_0x5f9e('0x4'),'afterUpdate':_0x5f9e('0x5'),'afterDestroy':_0x5f9e('0x6')};function emitEvent(_0x4e7665){return function(_0x15b4ed,_0x25c34c,_0x596261){FaxMessageEvents[_0x5f9e('0x7')](_0x4e7665+':'+_0x15b4ed['id'],_0x15b4ed);FaxMessageEvents['emit'](_0x4e7665,_0x15b4ed);_0x596261(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x5f9e('0x8')](e,emitEvent(event));}}module[_0x5f9e('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0xe574=['events','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x54dcad,_0x554f46){var _0x537c56=function(_0x48ff85){while(--_0x48ff85){_0x54dcad['push'](_0x54dcad['shift']());}};_0x537c56(++_0x554f46);}(_0xe574,0x100));var _0x4e57=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe574[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x4e57('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x4e57('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4e57('0x2')](0x0);var events={'afterCreate':_0x4e57('0x3'),'afterUpdate':_0x4e57('0x4'),'afterDestroy':_0x4e57('0x5')};function emitEvent(_0x1bdd55){return function(_0x10de04,_0x44569b,_0x4378ea){FaxMessageEvents[_0x4e57('0x6')](_0x1bdd55+':'+_0x10de04['id'],_0x10de04);FaxMessageEvents[_0x4e57('0x6')](_0x1bdd55,_0x10de04);_0x4378ea(null);};}for(var e in events){if(events[_0x4e57('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 42bdb10..693cec1 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 _0xf54d=['../../config/logger','bluebird','request-promise','path','../../config/environment','define','FaxMessage','fax_messages','body','FULLTEXT','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','error','utf8mb4_unicode_ci','lodash'];(function(_0x214386,_0x5495eb){var _0x411b30=function(_0x460761){while(--_0x460761){_0x214386['push'](_0x214386['shift']());}};_0x411b30(++_0x5495eb);}(_0xf54d,0x186));var _0xdf54=function(_0x5c920,_0x84424a){_0x5c920=_0x5c920-0x0;var _0x880a69=_0xf54d[_0x5c920];return _0x880a69;};'use strict';var _=require(_0xdf54('0x0'));var util=require('util');var logger=require(_0xdf54('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdf54('0x2'));var rp=require(_0xdf54('0x3'));var fs=require('fs');var path=require(_0xdf54('0x4'));var rimraf=require('rimraf');var config=require(_0xdf54('0x5'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x6b7308,_0x563865){return _0x6b7308[_0xdf54('0x6')](_0xdf54('0x7'),attributes,{'tableName':_0xdf54('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xdf54('0x9')],'type':_0xdf54('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x590d7c,_0x1f98a1,_0x3079e1){var _0x1e0797=_0x6b7308['models'];var _0x2d04c7=_0x590d7c['get']({'plain':!![]});if(_0x2d04c7[_0xdf54('0xb')][_0xdf54('0xc')]()==='in'||_0x2d04c7['direction'][_0xdf54('0xc')]()==='out'&&!_0x2d04c7[_0xdf54('0xd')]&&!_[_0xdf54('0xe')](_0x2d04c7[_0xdf54('0xf')])){_0x1e0797[_0xdf54('0x10')][_0xdf54('0x11')]({'where':{'id':_0x2d04c7[_0xdf54('0x12')]}})[_0xdf54('0x13')](function(_0x40967c){if(_0x40967c){_0x40967c[_0xdf54('0x14')]({'lastMsgAt':_0x2d04c7['createdAt'],'lastMsgDirection':_0x2d04c7['direction'][_0xdf54('0xc')]()});}})['catch'](function(_0x49f7e6){console[_0xdf54('0x15')](_0x49f7e6);});}_0x3079e1();}},'charset':'utf8mb4','collate':_0xdf54('0x16')});}; \ No newline at end of file +var _0x2c32=['fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','then','update','createdAt','catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage'];(function(_0x1a1ba8,_0x52a437){var _0x3c5118=function(_0x34821f){while(--_0x34821f){_0x1a1ba8['push'](_0x1a1ba8['shift']());}};_0x3c5118(++_0x52a437);}(_0x2c32,0x93));var _0x22c3=function(_0x4406f6,_0x482509){_0x4406f6=_0x4406f6-0x0;var _0x295bb5=_0x2c32[_0x4406f6];return _0x295bb5;};'use strict';var _=require(_0x22c3('0x0'));var util=require(_0x22c3('0x1'));var logger=require(_0x22c3('0x2'))(_0x22c3('0x3'));var moment=require(_0x22c3('0x4'));var BPromise=require(_0x22c3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22c3('0x6'));var rimraf=require(_0x22c3('0x7'));var config=require(_0x22c3('0x8'));var attributes=require(_0x22c3('0x9'));module[_0x22c3('0xa')]=function(_0x5b780d,_0x2259cf){return _0x5b780d[_0x22c3('0xb')](_0x22c3('0xc'),attributes,{'tableName':_0x22c3('0xd'),'paranoid':![],'indexes':[{'name':_0x22c3('0xe'),'fields':[_0x22c3('0xf')],'type':_0x22c3('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ba544,_0x266ec4,_0x2824f2){var _0x411d60=_0x5b780d[_0x22c3('0x11')];var _0x37b3dd=_0x3ba544[_0x22c3('0x12')]({'plain':!![]});if(_0x37b3dd[_0x22c3('0x13')][_0x22c3('0x14')]()==='in'||_0x37b3dd[_0x22c3('0x13')][_0x22c3('0x14')]()===_0x22c3('0x15')&&!_0x37b3dd[_0x22c3('0x16')]&&!_[_0x22c3('0x17')](_0x37b3dd[_0x22c3('0x18')])){_0x411d60[_0x22c3('0x19')][_0x22c3('0x1a')]({'where':{'id':_0x37b3dd['FaxInteractionId']}})[_0x22c3('0x1b')](function(_0x2aecb1){if(_0x2aecb1){_0x2aecb1[_0x22c3('0x1c')]({'lastMsgAt':_0x37b3dd[_0x22c3('0x1d')],'lastMsgDirection':_0x37b3dd['direction'][_0x22c3('0x14')]()});}})[_0x22c3('0x1e')](function(_0x4895a4){console['error'](_0x4895a4);});}_0x2824f2();}},'charset':_0x22c3('0x1f'),'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 c630cde..52ea076 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 _0xac9d=['then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxMessage','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request'];(function(_0x399870,_0x34e16d){var _0x2a74bb=function(_0x2ede0b){while(--_0x2ede0b){_0x399870['push'](_0x399870['shift']());}};_0x2a74bb(++_0x34e16d);}(_0xac9d,0x14d));var _0xdac9=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0xac9d[_0x4a93bb];return _0x208468;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});}exports['CreateFaxMessage']=function(_0x520369){var _0x4029fc=this;return new Promise(function(_0x20ece3,_0x2b9d91){return db[_0xdac9('0x1d')]['create'](_0x520369[_0xdac9('0x1e')],{'raw':_0x520369[_0xdac9('0x1f')]?_0x520369[_0xdac9('0x1f')][_0xdac9('0x20')]===undefined?!![]:![]:!![]})[_0xdac9('0x12')](function(_0x42317c){logger[_0xdac9('0x13')](_0xdac9('0x21'),_0x520369);logger[_0xdac9('0x15')](_0xdac9('0x21'),_0x520369,JSON['stringify'](_0x42317c));_0x20ece3(_0x42317c);})[_0xdac9('0x1c')](function(_0x11f4fd){logger[_0xdac9('0x18')](_0xdac9('0x21'),_0x11f4fd['message'],_0x520369);_0x2b9d91(_0x4029fc[_0xdac9('0x18')](0x1f4,_0x11f4fd['message']));});});};exports[_0xdac9('0x22')]=function(_0x2fce71){var _0x566d8c=this;return new Promise(function(_0x433be9,_0x5105f1){return db[_0xdac9('0x1d')][_0xdac9('0x23')](_0x2fce71[_0xdac9('0x1e')],{'raw':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')]['where']||null:null,'attributes':_0x2fce71['options']?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x24')]||null:null,'limit':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x25')]||null:null})[_0xdac9('0x12')](function(_0xed99f9){logger[_0xdac9('0x13')](_0xdac9('0x22'),_0x2fce71);logger[_0xdac9('0x15')](_0xdac9('0x22'),_0x2fce71,JSON[_0xdac9('0x26')](_0xed99f9));_0x433be9(_0xed99f9);})[_0xdac9('0x1c')](function(_0x336fd5){logger[_0xdac9('0x18')](_0xdac9('0x22'),_0x336fd5[_0xdac9('0x1a')],_0x2fce71);_0x5105f1(_0x566d8c[_0xdac9('0x18')](0x1f4,_0x336fd5[_0xdac9('0x1a')]));});});}; \ No newline at end of file +var _0x4b84=['CreateFaxMessage','FaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','attributes','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','defaults','localhost','./faxMessage.socket','register','request','then','info','request\x20sent','debug','error','message','FaxMessage,\x20%s,\x20%s','result'];(function(_0x10092d,_0xc7cbee){var _0x1d723d=function(_0x120c15){while(--_0x120c15){_0x10092d['push'](_0x10092d['shift']());}};_0x1d723d(++_0xc7cbee);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x4b84[_0x1d1d09];return _0x8827e;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});config['redis']=_[_0x44b8('0x7')](config['redis'],{'host':_0x44b8('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x44b8('0x9'))[_0x44b8('0xa')](socket);function respondWithRpcPromise(_0x30ebc3,_0x48a371,_0xc650ec){return new BPromise(function(_0x2cc74b,_0x4315f6){return client[_0x44b8('0xb')](_0x30ebc3,_0xc650ec)[_0x44b8('0xc')](function(_0x37e471){logger[_0x44b8('0xd')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'));logger[_0x44b8('0xf')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'),JSON['stringify'](_0x37e471));if(_0x37e471[_0x44b8('0x10')]){if(_0x37e471[_0x44b8('0x10')]['code']===0x1f4){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error'][_0x44b8('0x11')]);return _0x4315f6(_0x37e471[_0x44b8('0x10')][_0x44b8('0x11')]);}logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error']['message']);return _0x2cc74b(_0x37e471[_0x44b8('0x10')]['message']);}else{logger[_0x44b8('0xd')](_0x44b8('0x12'),_0x48a371,'request\x20sent');_0x2cc74b(_0x37e471[_0x44b8('0x13')][_0x44b8('0x11')]);}})['catch'](function(_0x89bc30){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x89bc30);_0x4315f6(_0x89bc30);});});}exports[_0x44b8('0x14')]=function(_0x8b4301){var _0xebfe79=this;return new Promise(function(_0x235bdc,_0x102ef9){return db[_0x44b8('0x15')][_0x44b8('0x16')](_0x8b4301[_0x44b8('0x17')],{'raw':_0x8b4301[_0x44b8('0x18')]?_0x8b4301[_0x44b8('0x18')][_0x44b8('0x19')]===undefined?!![]:![]:!![]})[_0x44b8('0xc')](function(_0x48327e){logger[_0x44b8('0xd')](_0x44b8('0x14'),_0x8b4301);logger[_0x44b8('0xf')](_0x44b8('0x14'),_0x8b4301,JSON[_0x44b8('0x1a')](_0x48327e));_0x235bdc(_0x48327e);})['catch'](function(_0x402497){logger['error'](_0x44b8('0x14'),_0x402497[_0x44b8('0x11')],_0x8b4301);_0x102ef9(_0xebfe79[_0x44b8('0x10')](0x1f4,_0x402497[_0x44b8('0x11')]));});});};exports[_0x44b8('0x1b')]=function(_0x59acbc){var _0x474f01=this;return new Promise(function(_0x502acf,_0x41d673){return db[_0x44b8('0x15')]['update'](_0x59acbc[_0x44b8('0x17')],{'raw':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['where']||null:null,'attributes':_0x59acbc[_0x44b8('0x18')]?_0x59acbc['options'][_0x44b8('0x1c')]||null:null,'limit':_0x59acbc['options']?_0x59acbc['options']['limit']||null:null})[_0x44b8('0xc')](function(_0x29b18d){logger[_0x44b8('0xd')](_0x44b8('0x1b'),_0x59acbc);logger[_0x44b8('0xf')](_0x44b8('0x1b'),_0x59acbc,JSON[_0x44b8('0x1a')](_0x29b18d));_0x502acf(_0x29b18d);})[_0x44b8('0x1d')](function(_0xd1d320){logger[_0x44b8('0x10')](_0x44b8('0x1b'),_0xd1d320[_0x44b8('0x11')],_0x59acbc);_0x41d673(_0x474f01[_0x44b8('0x10')](0x1f4,_0xd1d320['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 49e77b8..80f46f8 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 _0xdb2d=['remove','emit','removeListener','register','length','faxMessage:','./faxMessage.events','save'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xdb2d,0x1de));var _0xddb2=function(_0x263e1e,_0x187a4b){_0x263e1e=_0x263e1e-0x0;var _0x334f28=_0xdb2d[_0x263e1e];return _0x334f28;};'use strict';var FaxMessageEvents=require(_0xddb2('0x0'));var events=[_0xddb2('0x1'),_0xddb2('0x2'),'update'];function createListener(_0x57d853,_0x27c37f){return function(_0x1f1e83){_0x27c37f[_0xddb2('0x3')](_0x57d853,_0x1f1e83);};}function removeListener(_0x1338d3,_0x4f2fcc){return function(){FaxMessageEvents[_0xddb2('0x4')](_0x1338d3,_0x4f2fcc);};}exports[_0xddb2('0x5')]=function(_0x5bded6){for(var _0x5577c6=0x0,_0x7ab59c=events[_0xddb2('0x6')];_0x5577c6<_0x7ab59c;_0x5577c6++){var _0x27f2dd=events[_0x5577c6];var _0x56dc8e=createListener(_0xddb2('0x7')+_0x27f2dd,_0x5bded6);FaxMessageEvents['on'](_0x27f2dd,_0x56dc8e);}}; \ No newline at end of file +var _0x24ad=['save','remove','update','emit','removeListener','register','length','faxMessage:','./faxMessage.events'];(function(_0x71a70,_0x4e1cdd){var _0x3a2b22=function(_0x17d53f){while(--_0x17d53f){_0x71a70['push'](_0x71a70['shift']());}};_0x3a2b22(++_0x4e1cdd);}(_0x24ad,0xd7));var _0xd24a=function(_0x1e79c7,_0x26afae){_0x1e79c7=_0x1e79c7-0x0;var _0x42da3a=_0x24ad[_0x1e79c7];return _0x42da3a;};'use strict';var FaxMessageEvents=require(_0xd24a('0x0'));var events=[_0xd24a('0x1'),_0xd24a('0x2'),_0xd24a('0x3')];function createListener(_0xfb879d,_0x4865ca){return function(_0x520a4d){_0x4865ca[_0xd24a('0x4')](_0xfb879d,_0x520a4d);};}function removeListener(_0x238937,_0x3d236e){return function(){FaxMessageEvents[_0xd24a('0x5')](_0x238937,_0x3d236e);};}exports[_0xd24a('0x6')]=function(_0x30dca4){for(var _0x1da07c=0x0,_0x1932cd=events[_0xd24a('0x7')];_0x1da07c<_0x1932cd;_0x1da07c++){var _0x415a09=events[_0x1da07c];var _0xccc268=createListener(_0xd24a('0x8')+_0x415a09,_0x30dca4);FaxMessageEvents['on'](_0x415a09,_0xccc268);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ab883e5..cfbe749 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 _0x153f=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','tracked','fax','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x153f,0x15b));var _0xf153=function(_0x21518d,_0x3c2fd4){_0x21518d=_0x21518d-0x0;var _0x26d789=_0x153f[_0x21518d];return _0x26d789;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/describe',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0x9')](_0xf153('0xf'),auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router['post']('/',auth[_0xf153('0xa')](),interaction[_0xf153('0x11')](_0xf153('0x12'),'faxmessage:create'),controller[_0xf153('0x13')]);router[_0xf153('0x14')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0x15')]);router[_0xf153('0x14')](_0xf153('0x16'),auth[_0xf153('0xa')](),controller[_0xf153('0x17')]);router['put'](_0xf153('0x18'),auth[_0xf153('0xa')](),controller[_0xf153('0x19')]);router[_0xf153('0x1a')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0x1b')]);module[_0xf153('0x1c')]=router; \ No newline at end of file +var _0xbdb7=['accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','index','get','describe','show','/:id/download','isAuthenticated','download','post','tracked','put','/:id','update'];(function(_0x2c8318,_0x4bc937){var _0x1fd0cd=function(_0x5ae0ed){while(--_0x5ae0ed){_0x2c8318['push'](_0x2c8318['shift']());}};_0x1fd0cd(++_0x4bc937);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x774b6f,_0x1717fe){_0x774b6f=_0x774b6f-0x0;var _0x38cf6b=_0xbdb7[_0x774b6f];return _0x38cf6b;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0x11')]('/',auth[_0x7bdb('0xf')](),interaction[_0x7bdb('0x12')]('fax','faxmessage:create'),controller['create']);router[_0x7bdb('0x13')](_0x7bdb('0x14'),auth['isAuthenticated'](),controller[_0x7bdb('0x15')]);router['put']('/:id/accept',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x7bdb('0x17')]);router[_0x7bdb('0x18')](_0x7bdb('0x14'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x19')]);module[_0x7bdb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index f8c950e..6bf3abb 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 _0x35e7=['INTEGER','ENUM','rrmemory','sequelize','exports','STRING','name'];(function(_0x3cf053,_0x7a9947){var _0x3b55a0=function(_0x2a99cc){while(--_0x2a99cc){_0x3cf053['push'](_0x3cf053['shift']());}};_0x3b55a0(++_0x7a9947);}(_0x35e7,0x1a0));var _0x735e=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x35e7[_0x1e3c16];return _0x47a0c9;};'use strict';var Sequelize=require(_0x735e('0x0'));module[_0x735e('0x1')]={'name':{'type':Sequelize[_0x735e('0x2')],'unique':_0x735e('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x735e('0x2')]},'timeout':{'type':Sequelize[_0x735e('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x735e('0x5')](_0x735e('0x6'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x02e0=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x47ce4b,_0xc18873){var _0x5862b4=function(_0x4d476c){while(--_0x4d476c){_0x47ce4b['push'](_0x47ce4b['shift']());}};_0x5862b4(++_0xc18873);}(_0x02e0,0x15d));var _0x002e=function(_0xdc5a80,_0x3b3072){_0xdc5a80=_0xdc5a80-0x0;var _0x2afa3b=_0x02e0[_0xdc5a80];return _0x2afa3b;};'use strict';var Sequelize=require(_0x002e('0x0'));module[_0x002e('0x1')]={'name':{'type':Sequelize[_0x002e('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x002e('0x2')]},'timeout':{'type':Sequelize[_0x002e('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x002e('0x4')](_0x002e('0x5'),_0x002e('0x6'),_0x002e('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x002e('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 2f32554..a6a1a11 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 _0xed82=['desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','sendStatus','end','json','offset','count','limit','status','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','FaxQueue','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','hasOwnProperty','order','pick','FaxQueueId','findAll','UserId','agent','faxPause','updatedAt','format','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','FaxQueueId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce'];(function(_0x564852,_0x2a5a05){var _0x434694=function(_0xe7136a){while(--_0xe7136a){_0x564852['push'](_0x564852['shift']());}};_0x434694(++_0x2a5a05);}(_0xed82,0xfd));var _0x2ed8=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xed82[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0x2ed8('0x0'));var rimraf=require(_0x2ed8('0x1'));var zipdir=require(_0x2ed8('0x2'));var jsonpatch=require(_0x2ed8('0x3'));var rp=require(_0x2ed8('0x4'));var moment=require(_0x2ed8('0x5'));var BPromise=require(_0x2ed8('0x6'));var Mustache=require('mustache');var util=require(_0x2ed8('0x7'));var path=require(_0x2ed8('0x8'));var sox=require(_0x2ed8('0x9'));var csv=require(_0x2ed8('0xa'));var ejs=require(_0x2ed8('0xb'));var fs=require('fs');var fs_extra=require(_0x2ed8('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2ed8('0xd'));var jsforce=require(_0x2ed8('0xe'));var deskjs=require(_0x2ed8('0xf'));var toCsv=require(_0x2ed8('0xa'));var querystring=require(_0x2ed8('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2ed8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2ed8('0x12'));var hardwareService=require(_0x2ed8('0x13'));var logger=require('../../config/logger')(_0x2ed8('0x14'));var utils=require(_0x2ed8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2ed8('0x16'));var db=require(_0x2ed8('0x17'))['db'];config[_0x2ed8('0x18')]=_[_0x2ed8('0x19')](config[_0x2ed8('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ed8('0x1a'))(new Redis(config[_0x2ed8('0x18')]));require(_0x2ed8('0x1b'))['register'](socket);function respondWithStatusCode(_0x58fc18,_0x1a12a9){_0x1a12a9=_0x1a12a9||0xcc;return function(_0x5c65df){if(_0x5c65df){return _0x58fc18[_0x2ed8('0x1c')](_0x1a12a9);}return _0x58fc18['status'](_0x1a12a9)[_0x2ed8('0x1d')]();};}function respondWithResult(_0x2afad2,_0x22d412){_0x22d412=_0x22d412||0xc8;return function(_0xe9d57a){if(_0xe9d57a){return _0x2afad2['status'](_0x22d412)[_0x2ed8('0x1e')](_0xe9d57a);}};}function respondWithFilteredResult(_0x54bebf,_0x400b83){return function(_0x120fe4){if(_0x120fe4){var _0x53e903=typeof _0x400b83[_0x2ed8('0x1f')]==='undefined'&&typeof _0x400b83['limit']==='undefined';var _0x38555a=_0x120fe4['count'];var _0x493890=_0x53e903?0x0:_0x400b83[_0x2ed8('0x1f')];var _0x115159=_0x53e903?_0x120fe4[_0x2ed8('0x20')]:_0x400b83[_0x2ed8('0x1f')]+_0x400b83[_0x2ed8('0x21')];var _0x3c1e9e;if(_0x115159>=_0x38555a){_0x115159=_0x38555a;_0x3c1e9e=0xc8;}else{_0x3c1e9e=0xce;}_0x54bebf[_0x2ed8('0x22')](_0x3c1e9e);return _0x54bebf['set']('Content-Range',_0x493890+'-'+_0x115159+'/'+_0x38555a)[_0x2ed8('0x1e')](_0x120fe4);}return null;};}function patchUpdates(_0x2128ac){return function(_0x410db2){try{jsonpatch[_0x2ed8('0x23')](_0x410db2,_0x2128ac,!![]);}catch(_0x14fe36){return BPromise[_0x2ed8('0x24')](_0x14fe36);}return _0x410db2[_0x2ed8('0x25')]();};}function saveUpdates(_0x150ba0,_0x242f0b){return function(_0x4cc4da){if(_0x4cc4da){return _0x4cc4da[_0x2ed8('0x26')](_0x150ba0)[_0x2ed8('0x27')](function(_0x1a26d2){return _0x1a26d2;});}return null;};}function removeEntity(_0x3aca13,_0x2009fd){return function(_0xda1df7){if(_0xda1df7){return _0xda1df7[_0x2ed8('0x28')]()[_0x2ed8('0x27')](function(){var _0x365e4f=_0xda1df7['get']({'plain':!![]});var _0x561b31='FaxQueues';return db[_0x2ed8('0x29')][_0x2ed8('0x28')]({'where':{'type':_0x561b31,'resourceId':_0x365e4f['id']}})[_0x2ed8('0x27')](function(){return _0xda1df7;});})[_0x2ed8('0x27')](function(){_0x3aca13[_0x2ed8('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cca9,_0x69172e){return function(_0x1cd397){if(!_0x1cd397){_0x41cca9[_0x2ed8('0x1c')](0x194);}return _0x1cd397;};}function handleError(_0x1ac7bd,_0x38ef39){_0x38ef39=_0x38ef39||0x1f4;return function(_0x5a4bab){logger[_0x2ed8('0x2a')](_0x5a4bab[_0x2ed8('0x2b')]);if(_0x5a4bab['name']){delete _0x5a4bab[_0x2ed8('0x2c')];}_0x1ac7bd['status'](_0x38ef39)[_0x2ed8('0x2d')](_0x5a4bab);};}exports[_0x2ed8('0x2e')]=function(_0x383ce7,_0x42c207){var _0x1be0ae={},_0xe2b1d1={},_0x31b04b={'count':0x0,'rows':[]};var _0x140cbf=_[_0x2ed8('0x2f')](db['FaxQueue'][_0x2ed8('0x30')],function(_0x5a9b93){return{'name':_0x5a9b93[_0x2ed8('0x31')],'type':_0x5a9b93['type'][_0x2ed8('0x32')]};});_0xe2b1d1[_0x2ed8('0x33')]=_[_0x2ed8('0x2f')](_0x140cbf,_0x2ed8('0x2c'));_0xe2b1d1[_0x2ed8('0x34')]=_[_0x2ed8('0x35')](_0x383ce7['query']);_0xe2b1d1['filters']=_['intersection'](_0xe2b1d1[_0x2ed8('0x33')],_0xe2b1d1[_0x2ed8('0x34')]);_0x1be0ae[_0x2ed8('0x36')]=_[_0x2ed8('0x37')](_0xe2b1d1[_0x2ed8('0x33')],qs[_0x2ed8('0x38')](_0x383ce7[_0x2ed8('0x34')][_0x2ed8('0x38')]));_0x1be0ae[_0x2ed8('0x36')]=_0x1be0ae['attributes']['length']?_0x1be0ae['attributes']:_0xe2b1d1[_0x2ed8('0x33')];if(!_0x383ce7[_0x2ed8('0x34')]['hasOwnProperty'](_0x2ed8('0x39'))){_0x1be0ae[_0x2ed8('0x21')]=qs[_0x2ed8('0x21')](_0x383ce7[_0x2ed8('0x34')][_0x2ed8('0x21')]);_0x1be0ae[_0x2ed8('0x1f')]=qs[_0x2ed8('0x1f')](_0x383ce7['query'][_0x2ed8('0x1f')]);}_0x1be0ae['order']=qs[_0x2ed8('0x3a')](_0x383ce7[_0x2ed8('0x34')][_0x2ed8('0x3a')]);_0x1be0ae[_0x2ed8('0x3b')]=qs[_0x2ed8('0x3c')](_['pick'](_0x383ce7['query'],_0xe2b1d1[_0x2ed8('0x3c')]),_0x140cbf);if(_0x383ce7['query'][_0x2ed8('0x3d')]){_0x1be0ae[_0x2ed8('0x3b')]=_[_0x2ed8('0x3e')](_0x1be0ae[_0x2ed8('0x3b')],{'$or':_[_0x2ed8('0x2f')](_0x140cbf,function(_0x148e43){if(_0x148e43['type']!==_0x2ed8('0x3f')){var _0x3af235={};_0x3af235[_0x148e43[_0x2ed8('0x2c')]]={'$like':'%'+_0x383ce7[_0x2ed8('0x34')][_0x2ed8('0x3d')]+'%'};return _0x3af235;}})});}_0x1be0ae=_[_0x2ed8('0x3e')]({},_0x1be0ae,_0x383ce7[_0x2ed8('0x40')]);var _0x32e776={'where':_0x1be0ae[_0x2ed8('0x3b')]};return db['FaxQueue']['count'](_0x32e776)[_0x2ed8('0x27')](function(_0x3918e3){_0x31b04b[_0x2ed8('0x20')]=_0x3918e3;if(_0x383ce7[_0x2ed8('0x34')][_0x2ed8('0x41')]){_0x1be0ae['include']=[{'all':!![]}];}return db[_0x2ed8('0x42')]['findAll'](_0x1be0ae);})[_0x2ed8('0x27')](function(_0xf75d2d){_0x31b04b[_0x2ed8('0x43')]=_0xf75d2d;return _0x31b04b;})[_0x2ed8('0x27')](respondWithFilteredResult(_0x42c207,_0x1be0ae))[_0x2ed8('0x44')](handleError(_0x42c207,null));};exports[_0x2ed8('0x45')]=function(_0x501028,_0x451691){var _0xd1aaa={'raw':!![],'where':{'id':_0x501028[_0x2ed8('0x46')]['id']}},_0x578905={};_0x578905['model']=_[_0x2ed8('0x35')](db['FaxQueue'][_0x2ed8('0x30')]);_0x578905[_0x2ed8('0x34')]=_[_0x2ed8('0x35')](_0x501028[_0x2ed8('0x34')]);_0x578905[_0x2ed8('0x3c')]=_[_0x2ed8('0x37')](_0x578905[_0x2ed8('0x33')],_0x578905[_0x2ed8('0x34')]);_0xd1aaa[_0x2ed8('0x36')]=_[_0x2ed8('0x37')](_0x578905[_0x2ed8('0x33')],qs[_0x2ed8('0x38')](_0x501028[_0x2ed8('0x34')][_0x2ed8('0x38')]));_0xd1aaa['attributes']=_0xd1aaa[_0x2ed8('0x36')][_0x2ed8('0x47')]?_0xd1aaa['attributes']:_0x578905[_0x2ed8('0x33')];if(_0x501028[_0x2ed8('0x34')][_0x2ed8('0x41')]){_0xd1aaa['include']=[{'all':!![]}];}_0xd1aaa=_[_0x2ed8('0x3e')]({},_0xd1aaa,_0x501028[_0x2ed8('0x40')]);return db[_0x2ed8('0x42')][_0x2ed8('0x48')](_0xd1aaa)[_0x2ed8('0x27')](handleEntityNotFound(_0x451691,null))[_0x2ed8('0x27')](respondWithResult(_0x451691,null))[_0x2ed8('0x44')](handleError(_0x451691,null));};exports[_0x2ed8('0x49')]=function(_0x1153d9,_0x2da786){return db['FaxQueue'][_0x2ed8('0x49')](_0x1153d9[_0x2ed8('0x4a')],{})[_0x2ed8('0x27')](function(_0x3da627){var _0x11d61c=_0x1153d9[_0x2ed8('0x4b')][_0x2ed8('0x4c')]({'plain':!![]});if(!_0x11d61c)throw new Error(_0x2ed8('0x4d'));if(_0x11d61c[_0x2ed8('0x4e')]===_0x2ed8('0x4b')){var _0x5e686a=_0x3da627[_0x2ed8('0x4c')]({'plain':!![]});var _0x5d72da='FaxQueues';return db[_0x2ed8('0x4f')][_0x2ed8('0x48')]({'where':{'name':_0x5d72da,'userProfileId':_0x11d61c[_0x2ed8('0x50')]},'raw':!![]})[_0x2ed8('0x27')](function(_0x5bccdd){if(_0x5bccdd&&_0x5bccdd['autoAssociation']===0x0){return db['UserProfileResource'][_0x2ed8('0x49')]({'name':_0x5e686a[_0x2ed8('0x2c')],'resourceId':_0x5e686a['id'],'type':_0x5bccdd[_0x2ed8('0x2c')],'sectionId':_0x5bccdd['id']},{})[_0x2ed8('0x27')](function(){return _0x3da627;});}else{return _0x3da627;}})[_0x2ed8('0x44')](function(_0x56e919){logger[_0x2ed8('0x2a')](_0x2ed8('0x51'),_0x56e919);throw _0x56e919;});}return _0x3da627;})[_0x2ed8('0x27')](respondWithResult(_0x2da786,0xc9))[_0x2ed8('0x44')](handleError(_0x2da786,null));};exports[_0x2ed8('0x26')]=function(_0x5ccf39,_0x118c64){if(_0x5ccf39[_0x2ed8('0x4a')]['id']){delete _0x5ccf39[_0x2ed8('0x4a')]['id'];}return db[_0x2ed8('0x42')][_0x2ed8('0x48')]({'where':{'id':_0x5ccf39[_0x2ed8('0x46')]['id']}})['then'](handleEntityNotFound(_0x118c64,null))['then'](saveUpdates(_0x5ccf39[_0x2ed8('0x4a')],null))['then'](respondWithResult(_0x118c64,null))[_0x2ed8('0x44')](handleError(_0x118c64,null));};exports[_0x2ed8('0x28')]=function(_0x161e75,_0x5078c8){return db[_0x2ed8('0x42')][_0x2ed8('0x48')]({'where':{'id':_0x161e75[_0x2ed8('0x46')]['id']}})[_0x2ed8('0x27')](handleEntityNotFound(_0x5078c8,null))['then'](removeEntity(_0x5078c8,null))[_0x2ed8('0x44')](handleError(_0x5078c8,null));};exports[_0x2ed8('0x52')]=function(_0x4e0efe,_0x439c65){return db[_0x2ed8('0x42')][_0x2ed8('0x52')]()['then'](respondWithResult(_0x439c65,null))[_0x2ed8('0x44')](handleError(_0x439c65,null));};exports['getMembers']=function(_0xbf3021,_0x4f7f8e,_0x290f6c){var _0x228d52={'raw':!![],'where':{}},_0x5d9a0e={},_0x2ce160;return db['FaxQueue'][_0x2ed8('0x53')]({'where':{'id':_0xbf3021['params']['id']}})[_0x2ed8('0x27')](handleEntityNotFound(_0x4f7f8e,null))[_0x2ed8('0x27')](function(_0x54de3a){if(_0x54de3a){_0x2ce160=_0x54de3a[_0x2ed8('0x4c')]({'plain':!![]});_0x5d9a0e[_0x2ed8('0x33')]=_[_0x2ed8('0x35')](db[_0x2ed8('0x54')][_0x2ed8('0x30')]);_0x5d9a0e['query']=_[_0x2ed8('0x35')](_0xbf3021['query']);_0x5d9a0e['filters']=_[_0x2ed8('0x37')](_0x5d9a0e[_0x2ed8('0x33')],_0x5d9a0e[_0x2ed8('0x34')]);_0x228d52[_0x2ed8('0x36')]=_[_0x2ed8('0x37')](_0x5d9a0e[_0x2ed8('0x33')],qs[_0x2ed8('0x38')](_0xbf3021[_0x2ed8('0x34')][_0x2ed8('0x38')]));_0x228d52[_0x2ed8('0x36')]=_0x228d52['attributes']['length']?_0x228d52[_0x2ed8('0x36')]:_0x5d9a0e[_0x2ed8('0x33')];if(!_0xbf3021['query'][_0x2ed8('0x55')](_0x2ed8('0x39'))){_0x228d52[_0x2ed8('0x21')]=qs[_0x2ed8('0x21')](_0xbf3021[_0x2ed8('0x34')][_0x2ed8('0x21')]);_0x228d52[_0x2ed8('0x1f')]=qs[_0x2ed8('0x1f')](_0xbf3021[_0x2ed8('0x34')]['offset']);}_0x228d52[_0x2ed8('0x56')]=qs[_0x2ed8('0x3a')](_0xbf3021[_0x2ed8('0x34')][_0x2ed8('0x3a')]);_0x228d52[_0x2ed8('0x3b')]=qs['filters'](_[_0x2ed8('0x57')](_0xbf3021[_0x2ed8('0x34')],_0x5d9a0e['filters']));_0x228d52[_0x2ed8('0x3b')][_0x2ed8('0x58')]=_0x54de3a['id'];if(_0xbf3021['query'][_0x2ed8('0x3d')]){_0x228d52['where']=_[_0x2ed8('0x3e')](_0x228d52[_0x2ed8('0x3b')],{'$or':_[_0x2ed8('0x2f')](_0x228d52[_0x2ed8('0x36')],function(_0x2b699f){var _0x5b38b8={};_0x5b38b8[_0x2b699f]={'$like':'%'+_0xbf3021[_0x2ed8('0x34')]['filter']+'%'};return _0x5b38b8;})});}_0x228d52=_[_0x2ed8('0x3e')]({},_0x228d52,_0xbf3021[_0x2ed8('0x40')]);return db[_0x2ed8('0x54')][_0x2ed8('0x59')](_0x228d52);}})[_0x2ed8('0x27')](function(_0x310841){if(_0x310841){return db['User']['findAndCountAll']({'where':{'id':_[_0x2ed8('0x2f')](_0x310841,_0x2ed8('0x5a')),'role':_0x2ed8('0x5b')},'attributes':['id','name',_0x2ed8('0x5c'),_0x2ed8('0x5d'),'createdAt']});}})[_0x2ed8('0x27')](function(_0x55a72c){if(_0x55a72c){return{'count':_0x55a72c[_0x2ed8('0x20')],'rows':_[_0x2ed8('0x2f')](_0x55a72c[_0x2ed8('0x43')],function(_0x453ceb){return{'membername':_0x453ceb[_0x2ed8('0x2c')],'UserId':_0x453ceb['id'],'queue_name':_0x2ce160['name'],'FaxQueueId':_0x2ce160['id'],'interface':util[_0x2ed8('0x5e')]('%s/%s',_0x2ed8('0x5f'),_0x453ceb[_0x2ed8('0x2c')]),'penalty':0x0,'paused':_0x453ceb[_0x2ed8('0x5c')],'createdAt':_0x453ceb['createdAt'],'updatedAt':_0x453ceb[_0x2ed8('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2ed8('0x27')](respondWithFilteredResult(_0x4f7f8e,_0x228d52))['catch'](handleError(_0x4f7f8e,null));};exports[_0x2ed8('0x60')]=function(_0x5ccd94,_0x3f0eaf,_0x2cf10f){var _0x4956b4={};var _0x23bc1f={};var _0x3dbdf5;var _0x35ada4;return db[_0x2ed8('0x42')]['findOne']({'where':{'id':_0x5ccd94[_0x2ed8('0x46')]['id']}})[_0x2ed8('0x27')](handleEntityNotFound(_0x3f0eaf,null))[_0x2ed8('0x27')](function(_0x1985bc){if(_0x1985bc){_0x3dbdf5=_0x1985bc;_0x23bc1f[_0x2ed8('0x33')]=_[_0x2ed8('0x35')](db[_0x2ed8('0x61')][_0x2ed8('0x30')]);_0x23bc1f[_0x2ed8('0x34')]=_[_0x2ed8('0x35')](_0x5ccd94[_0x2ed8('0x34')]);_0x23bc1f['filters']=_[_0x2ed8('0x37')](_0x23bc1f[_0x2ed8('0x33')],_0x23bc1f[_0x2ed8('0x34')]);_0x4956b4[_0x2ed8('0x36')]=_[_0x2ed8('0x37')](_0x23bc1f[_0x2ed8('0x33')],qs[_0x2ed8('0x38')](_0x5ccd94[_0x2ed8('0x34')][_0x2ed8('0x38')]));_0x4956b4['attributes']=_0x4956b4[_0x2ed8('0x36')]['length']?_0x4956b4['attributes']:_0x23bc1f[_0x2ed8('0x33')];_0x4956b4[_0x2ed8('0x56')]=qs[_0x2ed8('0x3a')](_0x5ccd94[_0x2ed8('0x34')]['sort']);_0x4956b4[_0x2ed8('0x3b')]=qs[_0x2ed8('0x3c')](_[_0x2ed8('0x57')](_0x5ccd94[_0x2ed8('0x34')],_0x23bc1f[_0x2ed8('0x3c')]));if(_0x5ccd94[_0x2ed8('0x34')][_0x2ed8('0x3d')]){_0x4956b4[_0x2ed8('0x3b')]=_[_0x2ed8('0x3e')](_0x4956b4['where'],{'$or':_[_0x2ed8('0x2f')](_0x4956b4[_0x2ed8('0x36')],function(_0x9ff47d){var _0x5c6bcd={};_0x5c6bcd[_0x9ff47d]={'$like':'%'+_0x5ccd94[_0x2ed8('0x34')][_0x2ed8('0x3d')]+'%'};return _0x5c6bcd;})});}_0x4956b4=_['merge']({},_0x4956b4,_0x5ccd94[_0x2ed8('0x40')]);return _0x3dbdf5['getTeams'](_0x4956b4);}})[_0x2ed8('0x27')](function(_0x4aeab2){if(_0x4aeab2){_0x35ada4=_0x4aeab2[_0x2ed8('0x47')];if(!_0x5ccd94[_0x2ed8('0x34')][_0x2ed8('0x55')](_0x2ed8('0x39'))){_0x4956b4[_0x2ed8('0x21')]=qs['limit'](_0x5ccd94[_0x2ed8('0x34')]['limit']);_0x4956b4['offset']=qs[_0x2ed8('0x1f')](_0x5ccd94['query']['offset']);}return _0x3dbdf5[_0x2ed8('0x60')](_0x4956b4);}})[_0x2ed8('0x27')](function(_0x8561a1){if(_0x8561a1){return _0x8561a1?{'count':_0x35ada4,'rows':_0x8561a1}:null;}})[_0x2ed8('0x27')](respondWithResult(_0x3f0eaf,null))[_0x2ed8('0x44')](handleError(_0x3f0eaf,null));};exports[_0x2ed8('0x62')]=function(_0x5ceca3,_0x298991,_0x3d4605){var _0x148f7=_0x5ceca3[_0x2ed8('0x4a')][_0x2ed8('0x63')];return db[_0x2ed8('0x61')][_0x2ed8('0x59')]({'where':{'id':_0x148f7},'attributes':['id'],'include':[{'model':db[_0x2ed8('0x64')],'as':_0x2ed8('0x65'),'attributes':['id',_0x2ed8('0x2c'),_0x2ed8('0x66'),_0x2ed8('0x67'),_0x2ed8('0x68')],'raw':!![]}]})['then'](function(_0x34169a){if(_0x34169a){var _0x532fa7=_[_0x2ed8('0x69')](_0x34169a,function(_0x39d672){var _0x5cbd28=_0x39d672['get']({'plain':!![]});return _0x5cbd28[_0x2ed8('0x65')];});return db[_0x2ed8('0x42')]['find']({'where':{'id':_0x5ceca3[_0x2ed8('0x46')]['id']}})['then'](function(_0x2cf6bd){return db[_0x2ed8('0x6a')][_0x2ed8('0x6b')](function(_0x42114c){return _0x2cf6bd[_0x2ed8('0x62')](_0x148f7,{'transaction':_0x42114c})['then'](function(){return BPromise['each'](_0x532fa7,function(_0x3e4ade){return db[_0x2ed8('0x54')][_0x2ed8('0x6c')]({'where':{'UserId':_0x3e4ade['id'],'FaxQueueId':_0x5ceca3['params']['id']},'transaction':_0x42114c});});})[_0x2ed8('0x27')](function(){_0x532fa7[_0x2ed8('0x6d')](function(_0x13ddfb){socket[_0x2ed8('0x6e')]('userFaxQueue:save',{'UserId':_0x13ddfb['id'],'FaxQueueId':_0x2cf6bd['id']});});});});});}})[_0x2ed8('0x27')](respondWithStatusCode(_0x298991,null))[_0x2ed8('0x44')](handleError(_0x298991,null));};exports[_0x2ed8('0x6f')]=function(_0xddb7a9,_0x284f63,_0x44e0bf){return db[_0x2ed8('0x61')][_0x2ed8('0x59')]({'where':{'id':_0xddb7a9[_0x2ed8('0x34')][_0x2ed8('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2ed8('0x27')](handleEntityNotFound(_0x284f63,null))[_0x2ed8('0x27')](function(_0x52a9a9){var _0x409075=_[_0x2ed8('0x2f')](_0x52a9a9,'id');var _0x3e1e0f=[];var _0x599a57=[];var _0x309df1=squel[_0x2ed8('0x70')]();_0x309df1[_0x2ed8('0x71')](_0x2ed8('0x72'))[_0x2ed8('0x73')](_0x2ed8('0x74'),'tq')['join'](_0x2ed8('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2ed8('0x3b')](_0x2ed8('0x76'),_0xddb7a9[_0x2ed8('0x46')]['id']);for(var _0x542770=0x0;_0x542770<_0x52a9a9['length'];_0x542770+=0x1){let _0x547888=_0x52a9a9[_0x542770];for(var _0x4d8786=0x0;_0x4d8786<_0x547888['Agents'][_0x2ed8('0x47')];_0x4d8786+=0x1){let _0x17ceb9=_0x547888[_0x2ed8('0x65')][_0x4d8786];var _0x347172=_0x309df1['clone']();_0x347172[_0x2ed8('0x3b')]('ut.UserId\x20=\x20?',_0x17ceb9['id']);_0x599a57[_0x2ed8('0x77')](db['sequelize']['query'](_0x347172['toString'](),{'type':db[_0x2ed8('0x6a')][_0x2ed8('0x78')][_0x2ed8('0x79')]})['then'](function(_0x53e9ee){if(_0x53e9ee[_0x2ed8('0x47')]===0x1){return _0x17ceb9['id'];}else{var _0x34a31b=_[_0x2ed8('0x7a')](_['map'](_0x53e9ee,'TeamId'),function(_0x384371){return _[_0x2ed8('0x7b')](_0x409075,_0x384371);});if(_0x34a31b){return _0x17ceb9['id'];}}}));}}return BPromise[_0x2ed8('0x7c')](_0x599a57)[_0x2ed8('0x27')](function(_0x1d2f60){_0x3e1e0f=_(_0x3e1e0f)[_0x2ed8('0x7d')](_0x1d2f60)[_0x2ed8('0x7e')]()[_0x2ed8('0x7f')]();return db[_0x2ed8('0x42')][_0x2ed8('0x48')]({'where':{'id':_0xddb7a9[_0x2ed8('0x46')]['id']}})[_0x2ed8('0x27')](function(_0x589f76){return db[_0x2ed8('0x6a')][_0x2ed8('0x6b')](function(_0x4991b3){return _0x589f76['removeTeams'](_0xddb7a9[_0x2ed8('0x34')][_0x2ed8('0x63')],{'transaction':_0x4991b3})['then'](function(){if(!_[_0x2ed8('0x80')](_0x3e1e0f)){return _0x589f76[_0x2ed8('0x81')](_0x3e1e0f,{'transaction':_0x4991b3});}})['then'](function(){_0x3e1e0f['forEach'](function(_0x1f9ea9){socket[_0x2ed8('0x6e')]('userFaxQueue:remove',{'UserId':_0x1f9ea9,'FaxQueueId':_0x589f76['id']});});});});});});})[_0x2ed8('0x27')](respondWithStatusCode(_0x284f63,null))['catch'](handleError(_0x284f63,null));};exports['addAgents']=function(_0x5997d7,_0x4a4129,_0x4903f5){return db['FaxQueue']['find']({'where':{'id':_0x5997d7['params']['id']}})[_0x2ed8('0x27')](handleEntityNotFound(_0x4a4129,null))[_0x2ed8('0x27')](function(_0x4cebd0){if(_0x4cebd0){return _0x4cebd0[_0x2ed8('0x82')](_0x5997d7[_0x2ed8('0x4a')][_0x2ed8('0x63')],_[_0x2ed8('0x83')](_0x5997d7[_0x2ed8('0x4a')],[_0x2ed8('0x63'),'id'])||{})['spread'](function(_0x430319){for(var _0x5f168a=0x0;_0x5f168a<_0x5997d7[_0x2ed8('0x4a')][_0x2ed8('0x63')]['length'];_0x5f168a+=0x1){socket[_0x2ed8('0x6e')]('userFaxQueue:save',{'UserId':Number(_0x5997d7[_0x2ed8('0x4a')][_0x2ed8('0x63')][_0x5f168a]),'FaxQueueId':Number(_0x5997d7[_0x2ed8('0x46')]['id'])});}return _0x430319;});}})[_0x2ed8('0x27')](respondWithResult(_0x4a4129,null))[_0x2ed8('0x44')](handleError(_0x4a4129,null));};exports[_0x2ed8('0x81')]=function(_0x14a284,_0x4b8f0c,_0x5eed78){return db[_0x2ed8('0x42')]['find']({'where':{'id':_0x14a284[_0x2ed8('0x46')]['id']}})[_0x2ed8('0x27')](handleEntityNotFound(_0x4b8f0c,null))['then'](function(_0x5beb3d){if(_0x5beb3d){return _0x5beb3d[_0x2ed8('0x81')](_0x14a284[_0x2ed8('0x34')][_0x2ed8('0x63')])['then'](function(){if(_['isArray'](_0x14a284['query'][_0x2ed8('0x63')])){for(var _0x354a5a=0x0;_0x354a5a<_0x14a284['query'][_0x2ed8('0x63')][_0x2ed8('0x47')];_0x354a5a+=0x1){socket[_0x2ed8('0x6e')]('userFaxQueue:remove',{'UserId':Number(_0x14a284['query'][_0x2ed8('0x63')][_0x354a5a]),'FaxQueueId':Number(_0x14a284[_0x2ed8('0x46')]['id'])});}}else{socket[_0x2ed8('0x6e')](_0x2ed8('0x84'),{'UserId':Number(_0x14a284[_0x2ed8('0x34')][_0x2ed8('0x63')]),'FaxQueueId':Number(_0x14a284[_0x2ed8('0x46')]['id'])});}});}})[_0x2ed8('0x27')](respondWithStatusCode(_0x4b8f0c,null))[_0x2ed8('0x44')](handleError(_0x4b8f0c,null));};exports[_0x2ed8('0x85')]=function(_0x3afabb,_0x2781e9,_0x3225c9){var _0x32c449={};var _0x4c7ee3={};var _0x3d449b;var _0x228d1e;return db['FaxQueue'][_0x2ed8('0x53')]({'where':{'id':_0x3afabb[_0x2ed8('0x46')]['id']}})[_0x2ed8('0x27')](handleEntityNotFound(_0x2781e9,null))['then'](function(_0xcaaad3){if(_0xcaaad3){_0x3d449b=_0xcaaad3;_0x4c7ee3['model']=_[_0x2ed8('0x35')](db[_0x2ed8('0x64')][_0x2ed8('0x30')]);_0x4c7ee3[_0x2ed8('0x34')]=_['keys'](_0x3afabb['query']);_0x4c7ee3[_0x2ed8('0x3c')]=_[_0x2ed8('0x37')](_0x4c7ee3[_0x2ed8('0x33')],_0x4c7ee3['query']);_0x32c449['attributes']=_[_0x2ed8('0x37')](_0x4c7ee3[_0x2ed8('0x33')],qs[_0x2ed8('0x38')](_0x3afabb[_0x2ed8('0x34')][_0x2ed8('0x38')]));_0x32c449[_0x2ed8('0x36')]=_0x32c449[_0x2ed8('0x36')][_0x2ed8('0x47')]?_0x32c449[_0x2ed8('0x36')]:_0x4c7ee3['model'];_0x32c449['order']=qs[_0x2ed8('0x3a')](_0x3afabb[_0x2ed8('0x34')][_0x2ed8('0x3a')]);_0x32c449[_0x2ed8('0x3b')]=qs[_0x2ed8('0x3c')](_[_0x2ed8('0x57')](_0x3afabb[_0x2ed8('0x34')],_0x4c7ee3[_0x2ed8('0x3c')]));if(_0x3afabb['query']['filter']){_0x32c449[_0x2ed8('0x3b')]=_[_0x2ed8('0x3e')](_0x32c449['where'],{'$or':_[_0x2ed8('0x2f')](_0x32c449[_0x2ed8('0x36')],function(_0x3b9d8b){var _0x59b93e={};_0x59b93e[_0x3b9d8b]={'$like':'%'+_0x3afabb[_0x2ed8('0x34')][_0x2ed8('0x3d')]+'%'};return _0x59b93e;})});}_0x32c449=_[_0x2ed8('0x3e')]({},_0x32c449,_0x3afabb[_0x2ed8('0x40')]);return _0x3d449b['getAgents'](_0x32c449);}})['then'](function(_0x4152b0){if(_0x4152b0){_0x228d1e=_0x4152b0['length'];if(!_0x3afabb['query'][_0x2ed8('0x55')](_0x2ed8('0x39'))){_0x32c449[_0x2ed8('0x21')]=qs[_0x2ed8('0x21')](_0x3afabb['query'][_0x2ed8('0x21')]);_0x32c449[_0x2ed8('0x1f')]=qs[_0x2ed8('0x1f')](_0x3afabb[_0x2ed8('0x34')][_0x2ed8('0x1f')]);}return _0x3d449b['getAgents'](_0x32c449);}})[_0x2ed8('0x27')](function(_0x28a420){if(_0x28a420){return _0x28a420?{'count':_0x228d1e,'rows':_0x28a420}:null;}})['then'](respondWithResult(_0x2781e9,null))[_0x2ed8('0x44')](handleError(_0x2781e9,null));}; \ No newline at end of file +var _0x10e5=['index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','FaxQueue','includeAll','findAll','rows','catch','params','length','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','UserFaxQueue','pick','FaxQueueId','User','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','all','union','compact','value','removeAgents','userFaxQueue:remove','addAgents','omit','userFaxQueue:save','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','get','UserProfileResource','name','send'];(function(_0x23da5f,_0x158cd5){var _0x323900=function(_0x4faece){while(--_0x4faece){_0x23da5f['push'](_0x23da5f['shift']());}};_0x323900(++_0x158cd5);}(_0x10e5,0x16f));var _0x510e=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x10e5[_0x585133];return _0x18254a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x510e('0x0'));var zipdir=require(_0x510e('0x1'));var jsonpatch=require(_0x510e('0x2'));var rp=require(_0x510e('0x3'));var moment=require(_0x510e('0x4'));var BPromise=require(_0x510e('0x5'));var Mustache=require(_0x510e('0x6'));var util=require(_0x510e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x510e('0x8'));var ejs=require(_0x510e('0x9'));var fs=require('fs');var fs_extra=require(_0x510e('0xa'));var _=require(_0x510e('0xb'));var squel=require(_0x510e('0xc'));var crypto=require('crypto');var jsforce=require(_0x510e('0xd'));var deskjs=require(_0x510e('0xe'));var toCsv=require(_0x510e('0x8'));var querystring=require(_0x510e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x510e('0x10'));var as=require(_0x510e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x510e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x510e('0x13'));var licenseUtil=require(_0x510e('0x14'));var db=require(_0x510e('0x15'))['db'];config[_0x510e('0x16')]=_[_0x510e('0x17')](config[_0x510e('0x16')],{'host':_0x510e('0x18'),'port':0x18eb});var socket=require(_0x510e('0x19'))(new Redis(config[_0x510e('0x16')]));require(_0x510e('0x1a'))[_0x510e('0x1b')](socket);function respondWithStatusCode(_0xf66481,_0x29dcf1){_0x29dcf1=_0x29dcf1||0xcc;return function(_0x2f66f8){if(_0x2f66f8){return _0xf66481[_0x510e('0x1c')](_0x29dcf1);}return _0xf66481[_0x510e('0x1d')](_0x29dcf1)[_0x510e('0x1e')]();};}function respondWithResult(_0x195d0d,_0x385119){_0x385119=_0x385119||0xc8;return function(_0x292d30){if(_0x292d30){return _0x195d0d[_0x510e('0x1d')](_0x385119)[_0x510e('0x1f')](_0x292d30);}};}function respondWithFilteredResult(_0x55867e,_0x2311b5){return function(_0x512f0f){if(_0x512f0f){var _0x45ae4a=typeof _0x2311b5[_0x510e('0x20')]===_0x510e('0x21')&&typeof _0x2311b5[_0x510e('0x22')]===_0x510e('0x21');var _0x20b4e4=_0x512f0f[_0x510e('0x23')];var _0x388e6d=_0x45ae4a?0x0:_0x2311b5[_0x510e('0x20')];var _0x5cb129=_0x45ae4a?_0x512f0f['count']:_0x2311b5['offset']+_0x2311b5[_0x510e('0x22')];var _0x128380;if(_0x5cb129>=_0x20b4e4){_0x5cb129=_0x20b4e4;_0x128380=0xc8;}else{_0x128380=0xce;}_0x55867e['status'](_0x128380);return _0x55867e[_0x510e('0x24')](_0x510e('0x25'),_0x388e6d+'-'+_0x5cb129+'/'+_0x20b4e4)[_0x510e('0x1f')](_0x512f0f);}return null;};}function patchUpdates(_0x1d2d14){return function(_0x53cfee){try{jsonpatch['apply'](_0x53cfee,_0x1d2d14,!![]);}catch(_0x5671b4){return BPromise['reject'](_0x5671b4);}return _0x53cfee[_0x510e('0x26')]();};}function saveUpdates(_0x4d5394,_0x448a1c){return function(_0x2b6dd4){if(_0x2b6dd4){return _0x2b6dd4['update'](_0x4d5394)['then'](function(_0x29b6f4){return _0x29b6f4;});}return null;};}function removeEntity(_0x24c9d7,_0x28eebc){return function(_0x4942e0){if(_0x4942e0){return _0x4942e0['destroy']()[_0x510e('0x27')](function(){var _0x423037=_0x4942e0[_0x510e('0x28')]({'plain':!![]});var _0x52eba5='FaxQueues';return db[_0x510e('0x29')]['destroy']({'where':{'type':_0x52eba5,'resourceId':_0x423037['id']}})[_0x510e('0x27')](function(){return _0x4942e0;});})[_0x510e('0x27')](function(){_0x24c9d7[_0x510e('0x1d')](0xcc)[_0x510e('0x1e')]();});}};}function handleEntityNotFound(_0x8f1529,_0x11e34a){return function(_0x424870){if(!_0x424870){_0x8f1529[_0x510e('0x1c')](0x194);}return _0x424870;};}function handleError(_0x2b0c8d,_0x200e80){_0x200e80=_0x200e80||0x1f4;return function(_0x443941){logger['error'](_0x443941['stack']);if(_0x443941[_0x510e('0x2a')]){delete _0x443941['name'];}_0x2b0c8d[_0x510e('0x1d')](_0x200e80)[_0x510e('0x2b')](_0x443941);};}exports[_0x510e('0x2c')]=function(_0x36ca8c,_0x51b1c7){var _0x5dbcce={},_0x5ac6c7={},_0x5cb380={'count':0x0,'rows':[]};var _0xb18fc9=_[_0x510e('0x2d')](db['FaxQueue'][_0x510e('0x2e')],function(_0x4592d9){return{'name':_0x4592d9[_0x510e('0x2f')],'type':_0x4592d9[_0x510e('0x30')][_0x510e('0x31')]};});_0x5ac6c7[_0x510e('0x32')]=_['map'](_0xb18fc9,_0x510e('0x2a'));_0x5ac6c7[_0x510e('0x33')]=_[_0x510e('0x34')](_0x36ca8c[_0x510e('0x33')]);_0x5ac6c7[_0x510e('0x35')]=_[_0x510e('0x36')](_0x5ac6c7[_0x510e('0x32')],_0x5ac6c7[_0x510e('0x33')]);_0x5dbcce[_0x510e('0x37')]=_['intersection'](_0x5ac6c7[_0x510e('0x32')],qs[_0x510e('0x38')](_0x36ca8c[_0x510e('0x33')]['fields']));_0x5dbcce[_0x510e('0x37')]=_0x5dbcce[_0x510e('0x37')]['length']?_0x5dbcce['attributes']:_0x5ac6c7[_0x510e('0x32')];if(!_0x36ca8c[_0x510e('0x33')][_0x510e('0x39')](_0x510e('0x3a'))){_0x5dbcce['limit']=qs[_0x510e('0x22')](_0x36ca8c[_0x510e('0x33')][_0x510e('0x22')]);_0x5dbcce[_0x510e('0x20')]=qs[_0x510e('0x20')](_0x36ca8c[_0x510e('0x33')][_0x510e('0x20')]);}_0x5dbcce[_0x510e('0x3b')]=qs[_0x510e('0x3c')](_0x36ca8c[_0x510e('0x33')][_0x510e('0x3c')]);_0x5dbcce[_0x510e('0x3d')]=qs[_0x510e('0x35')](_['pick'](_0x36ca8c[_0x510e('0x33')],_0x5ac6c7[_0x510e('0x35')]),_0xb18fc9);if(_0x36ca8c[_0x510e('0x33')]['filter']){_0x5dbcce[_0x510e('0x3d')]=_[_0x510e('0x3e')](_0x5dbcce['where'],{'$or':_['map'](_0xb18fc9,function(_0x5c692a){if(_0x5c692a['type']!==_0x510e('0x3f')){var _0x71613c={};_0x71613c[_0x5c692a['name']]={'$like':'%'+_0x36ca8c[_0x510e('0x33')][_0x510e('0x40')]+'%'};return _0x71613c;}})});}_0x5dbcce=_['merge']({},_0x5dbcce,_0x36ca8c[_0x510e('0x41')]);var _0x3e7bcf={'where':_0x5dbcce[_0x510e('0x3d')]};return db[_0x510e('0x42')]['count'](_0x3e7bcf)['then'](function(_0x2f5662){_0x5cb380[_0x510e('0x23')]=_0x2f5662;if(_0x36ca8c[_0x510e('0x33')][_0x510e('0x43')]){_0x5dbcce['include']=[{'all':!![]}];}return db['FaxQueue'][_0x510e('0x44')](_0x5dbcce);})[_0x510e('0x27')](function(_0x45bbd9){_0x5cb380[_0x510e('0x45')]=_0x45bbd9;return _0x5cb380;})[_0x510e('0x27')](respondWithFilteredResult(_0x51b1c7,_0x5dbcce))[_0x510e('0x46')](handleError(_0x51b1c7,null));};exports['show']=function(_0x4105e0,_0x48982b){var _0x1de4e0={'raw':!![],'where':{'id':_0x4105e0[_0x510e('0x47')]['id']}},_0x1e5bc0={};_0x1e5bc0[_0x510e('0x32')]=_[_0x510e('0x34')](db[_0x510e('0x42')]['rawAttributes']);_0x1e5bc0['query']=_[_0x510e('0x34')](_0x4105e0[_0x510e('0x33')]);_0x1e5bc0[_0x510e('0x35')]=_[_0x510e('0x36')](_0x1e5bc0[_0x510e('0x32')],_0x1e5bc0[_0x510e('0x33')]);_0x1de4e0['attributes']=_[_0x510e('0x36')](_0x1e5bc0[_0x510e('0x32')],qs[_0x510e('0x38')](_0x4105e0[_0x510e('0x33')][_0x510e('0x38')]));_0x1de4e0['attributes']=_0x1de4e0[_0x510e('0x37')][_0x510e('0x48')]?_0x1de4e0[_0x510e('0x37')]:_0x1e5bc0[_0x510e('0x32')];if(_0x4105e0[_0x510e('0x33')][_0x510e('0x43')]){_0x1de4e0['include']=[{'all':!![]}];}_0x1de4e0=_[_0x510e('0x3e')]({},_0x1de4e0,_0x4105e0[_0x510e('0x41')]);return db['FaxQueue'][_0x510e('0x49')](_0x1de4e0)[_0x510e('0x27')](handleEntityNotFound(_0x48982b,null))[_0x510e('0x27')](respondWithResult(_0x48982b,null))[_0x510e('0x46')](handleError(_0x48982b,null));};exports[_0x510e('0x4a')]=function(_0x2b91c9,_0x3e2eb5){return db['FaxQueue'][_0x510e('0x4a')](_0x2b91c9['body'],{})[_0x510e('0x27')](function(_0x1bfc4f){var _0x208330=_0x2b91c9['user'][_0x510e('0x28')]({'plain':!![]});if(!_0x208330)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x208330[_0x510e('0x4b')]===_0x510e('0x4c')){var _0xe2b47=_0x1bfc4f['get']({'plain':!![]});var _0x1d6923='FaxQueues';return db[_0x510e('0x4d')]['find']({'where':{'name':_0x1d6923,'userProfileId':_0x208330[_0x510e('0x4e')]},'raw':!![]})[_0x510e('0x27')](function(_0x51a647){if(_0x51a647&&_0x51a647[_0x510e('0x4f')]===0x0){return db['UserProfileResource'][_0x510e('0x4a')]({'name':_0xe2b47[_0x510e('0x2a')],'resourceId':_0xe2b47['id'],'type':_0x51a647['name'],'sectionId':_0x51a647['id']},{})[_0x510e('0x27')](function(){return _0x1bfc4f;});}else{return _0x1bfc4f;}})[_0x510e('0x46')](function(_0x1b9480){logger[_0x510e('0x50')](_0x510e('0x51'),_0x1b9480);throw _0x1b9480;});}return _0x1bfc4f;})[_0x510e('0x27')](respondWithResult(_0x3e2eb5,0xc9))[_0x510e('0x46')](handleError(_0x3e2eb5,null));};exports['update']=function(_0x55ed5d,_0x24f910){if(_0x55ed5d['body']['id']){delete _0x55ed5d['body']['id'];}return db[_0x510e('0x42')]['find']({'where':{'id':_0x55ed5d[_0x510e('0x47')]['id']}})[_0x510e('0x27')](handleEntityNotFound(_0x24f910,null))[_0x510e('0x27')](saveUpdates(_0x55ed5d[_0x510e('0x52')],null))[_0x510e('0x27')](respondWithResult(_0x24f910,null))[_0x510e('0x46')](handleError(_0x24f910,null));};exports[_0x510e('0x53')]=function(_0x3ea71a,_0x9d5aa1){return db[_0x510e('0x42')][_0x510e('0x49')]({'where':{'id':_0x3ea71a[_0x510e('0x47')]['id']}})['then'](handleEntityNotFound(_0x9d5aa1,null))[_0x510e('0x27')](removeEntity(_0x9d5aa1,null))[_0x510e('0x46')](handleError(_0x9d5aa1,null));};exports[_0x510e('0x54')]=function(_0x5bd98b,_0x223d00){return db[_0x510e('0x42')][_0x510e('0x54')]()[_0x510e('0x27')](respondWithResult(_0x223d00,null))['catch'](handleError(_0x223d00,null));};exports[_0x510e('0x55')]=function(_0x2e2939,_0x7db8a,_0x1b954c){var _0x536211={'raw':!![],'where':{}},_0x40a6e6={},_0x2bc0aa;return db['FaxQueue'][_0x510e('0x56')]({'where':{'id':_0x2e2939['params']['id']}})[_0x510e('0x27')](handleEntityNotFound(_0x7db8a,null))[_0x510e('0x27')](function(_0x33896e){if(_0x33896e){_0x2bc0aa=_0x33896e[_0x510e('0x28')]({'plain':!![]});_0x40a6e6[_0x510e('0x32')]=_['keys'](db[_0x510e('0x57')][_0x510e('0x2e')]);_0x40a6e6[_0x510e('0x33')]=_[_0x510e('0x34')](_0x2e2939[_0x510e('0x33')]);_0x40a6e6[_0x510e('0x35')]=_[_0x510e('0x36')](_0x40a6e6[_0x510e('0x32')],_0x40a6e6[_0x510e('0x33')]);_0x536211[_0x510e('0x37')]=_['intersection'](_0x40a6e6[_0x510e('0x32')],qs[_0x510e('0x38')](_0x2e2939[_0x510e('0x33')]['fields']));_0x536211[_0x510e('0x37')]=_0x536211['attributes'][_0x510e('0x48')]?_0x536211[_0x510e('0x37')]:_0x40a6e6[_0x510e('0x32')];if(!_0x2e2939['query']['hasOwnProperty']('nolimit')){_0x536211[_0x510e('0x22')]=qs['limit'](_0x2e2939[_0x510e('0x33')][_0x510e('0x22')]);_0x536211['offset']=qs[_0x510e('0x20')](_0x2e2939[_0x510e('0x33')][_0x510e('0x20')]);}_0x536211['order']=qs[_0x510e('0x3c')](_0x2e2939[_0x510e('0x33')]['sort']);_0x536211['where']=qs['filters'](_[_0x510e('0x58')](_0x2e2939[_0x510e('0x33')],_0x40a6e6['filters']));_0x536211[_0x510e('0x3d')][_0x510e('0x59')]=_0x33896e['id'];if(_0x2e2939[_0x510e('0x33')][_0x510e('0x40')]){_0x536211[_0x510e('0x3d')]=_[_0x510e('0x3e')](_0x536211[_0x510e('0x3d')],{'$or':_[_0x510e('0x2d')](_0x536211['attributes'],function(_0x5659ca){var _0x2688d7={};_0x2688d7[_0x5659ca]={'$like':'%'+_0x2e2939[_0x510e('0x33')]['filter']+'%'};return _0x2688d7;})});}_0x536211=_[_0x510e('0x3e')]({},_0x536211,_0x2e2939[_0x510e('0x41')]);return db[_0x510e('0x57')][_0x510e('0x44')](_0x536211);}})[_0x510e('0x27')](function(_0x53f29c){if(_0x53f29c){return db[_0x510e('0x5a')]['findAndCountAll']({'where':{'id':_[_0x510e('0x2d')](_0x53f29c,_0x510e('0x5b')),'role':_0x510e('0x5c')},'attributes':['id',_0x510e('0x2a'),_0x510e('0x5d'),_0x510e('0x5e'),_0x510e('0x5f')]});}})[_0x510e('0x27')](function(_0x1d1332){if(_0x1d1332){return{'count':_0x1d1332['count'],'rows':_[_0x510e('0x2d')](_0x1d1332[_0x510e('0x45')],function(_0x2378e4){return{'membername':_0x2378e4['name'],'UserId':_0x2378e4['id'],'queue_name':_0x2bc0aa[_0x510e('0x2a')],'FaxQueueId':_0x2bc0aa['id'],'interface':util[_0x510e('0x60')](_0x510e('0x61'),_0x510e('0x62'),_0x2378e4[_0x510e('0x2a')]),'penalty':0x0,'paused':_0x2378e4['faxPause'],'createdAt':_0x2378e4[_0x510e('0x5f')],'updatedAt':_0x2378e4[_0x510e('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x510e('0x27')](respondWithFilteredResult(_0x7db8a,_0x536211))[_0x510e('0x46')](handleError(_0x7db8a,null));};exports[_0x510e('0x63')]=function(_0x1b58c8,_0x49a043,_0x523412){var _0x262679={};var _0x6034fb={};var _0x128200;var _0x528d02;return db[_0x510e('0x42')][_0x510e('0x56')]({'where':{'id':_0x1b58c8[_0x510e('0x47')]['id']}})['then'](handleEntityNotFound(_0x49a043,null))[_0x510e('0x27')](function(_0x569d37){if(_0x569d37){_0x128200=_0x569d37;_0x6034fb['model']=_[_0x510e('0x34')](db[_0x510e('0x64')]['rawAttributes']);_0x6034fb['query']=_[_0x510e('0x34')](_0x1b58c8['query']);_0x6034fb['filters']=_[_0x510e('0x36')](_0x6034fb[_0x510e('0x32')],_0x6034fb[_0x510e('0x33')]);_0x262679[_0x510e('0x37')]=_['intersection'](_0x6034fb[_0x510e('0x32')],qs['fields'](_0x1b58c8[_0x510e('0x33')][_0x510e('0x38')]));_0x262679[_0x510e('0x37')]=_0x262679[_0x510e('0x37')][_0x510e('0x48')]?_0x262679[_0x510e('0x37')]:_0x6034fb['model'];_0x262679['order']=qs[_0x510e('0x3c')](_0x1b58c8[_0x510e('0x33')][_0x510e('0x3c')]);_0x262679[_0x510e('0x3d')]=qs[_0x510e('0x35')](_[_0x510e('0x58')](_0x1b58c8[_0x510e('0x33')],_0x6034fb['filters']));if(_0x1b58c8['query'][_0x510e('0x40')]){_0x262679[_0x510e('0x3d')]=_[_0x510e('0x3e')](_0x262679[_0x510e('0x3d')],{'$or':_[_0x510e('0x2d')](_0x262679[_0x510e('0x37')],function(_0x41199c){var _0x3d5c26={};_0x3d5c26[_0x41199c]={'$like':'%'+_0x1b58c8['query'][_0x510e('0x40')]+'%'};return _0x3d5c26;})});}_0x262679=_[_0x510e('0x3e')]({},_0x262679,_0x1b58c8['options']);return _0x128200[_0x510e('0x63')](_0x262679);}})['then'](function(_0x194d73){if(_0x194d73){_0x528d02=_0x194d73['length'];if(!_0x1b58c8[_0x510e('0x33')][_0x510e('0x39')](_0x510e('0x3a'))){_0x262679[_0x510e('0x22')]=qs[_0x510e('0x22')](_0x1b58c8[_0x510e('0x33')][_0x510e('0x22')]);_0x262679['offset']=qs[_0x510e('0x20')](_0x1b58c8['query'][_0x510e('0x20')]);}return _0x128200[_0x510e('0x63')](_0x262679);}})[_0x510e('0x27')](function(_0x5e2140){if(_0x5e2140){return _0x5e2140?{'count':_0x528d02,'rows':_0x5e2140}:null;}})[_0x510e('0x27')](respondWithResult(_0x49a043,null))[_0x510e('0x46')](handleError(_0x49a043,null));};exports[_0x510e('0x65')]=function(_0x2ea668,_0x446c9e,_0x4f7909){var _0x45104a=_0x2ea668[_0x510e('0x52')][_0x510e('0x66')];return db[_0x510e('0x64')][_0x510e('0x44')]({'where':{'id':_0x45104a},'attributes':['id'],'include':[{'model':db[_0x510e('0x5a')],'as':_0x510e('0x67'),'attributes':['id',_0x510e('0x2a'),_0x510e('0x68'),_0x510e('0x69'),_0x510e('0x6a')],'raw':!![]}]})[_0x510e('0x27')](function(_0x593dc4){if(_0x593dc4){var _0x1db33a=_[_0x510e('0x6b')](_0x593dc4,function(_0x391a5d){var _0x145a97=_0x391a5d[_0x510e('0x28')]({'plain':!![]});return _0x145a97[_0x510e('0x67')];});return db[_0x510e('0x42')][_0x510e('0x49')]({'where':{'id':_0x2ea668[_0x510e('0x47')]['id']}})[_0x510e('0x27')](function(_0x2229a0){return db[_0x510e('0x6c')][_0x510e('0x6d')](function(_0x394bca){return _0x2229a0['addTeams'](_0x45104a,{'transaction':_0x394bca})[_0x510e('0x27')](function(){return BPromise[_0x510e('0x6e')](_0x1db33a,function(_0x506cfa){return db['UserFaxQueue'][_0x510e('0x6f')]({'where':{'UserId':_0x506cfa['id'],'FaxQueueId':_0x2ea668[_0x510e('0x47')]['id']},'transaction':_0x394bca});});})[_0x510e('0x27')](function(){_0x1db33a[_0x510e('0x70')](function(_0x52e57d){socket[_0x510e('0x71')]('userFaxQueue:save',{'UserId':_0x52e57d['id'],'FaxQueueId':_0x2229a0['id']});});});});});}})[_0x510e('0x27')](respondWithStatusCode(_0x446c9e,null))['catch'](handleError(_0x446c9e,null));};exports[_0x510e('0x72')]=function(_0x2b3c6c,_0x5f28b0,_0x1c9b4e){return db[_0x510e('0x64')]['findAll']({'where':{'id':_0x2b3c6c[_0x510e('0x33')][_0x510e('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5f28b0,null))[_0x510e('0x27')](function(_0x5e0fc9){var _0x44146e=_['map'](_0x5e0fc9,'id');var _0x498f0a=[];var _0x55d189=[];var _0x50cb43=squel[_0x510e('0x73')]();_0x50cb43[_0x510e('0x74')](_0x510e('0x75'))[_0x510e('0x76')](_0x510e('0x77'),'tq')[_0x510e('0x78')](_0x510e('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x510e('0x3d')](_0x510e('0x7a'),_0x2b3c6c[_0x510e('0x47')]['id']);for(var _0x29af5c=0x0;_0x29af5c<_0x5e0fc9[_0x510e('0x48')];_0x29af5c+=0x1){let _0x2c4f1d=_0x5e0fc9[_0x29af5c];for(var _0x37483d=0x0;_0x37483d<_0x2c4f1d[_0x510e('0x67')][_0x510e('0x48')];_0x37483d+=0x1){let _0x14dd7c=_0x2c4f1d[_0x510e('0x67')][_0x37483d];var _0x33de94=_0x50cb43['clone']();_0x33de94[_0x510e('0x3d')](_0x510e('0x7b'),_0x14dd7c['id']);_0x55d189['push'](db[_0x510e('0x6c')][_0x510e('0x33')](_0x33de94[_0x510e('0x7c')](),{'type':db[_0x510e('0x6c')][_0x510e('0x7d')]['SELECT']})['then'](function(_0x170d24){if(_0x170d24[_0x510e('0x48')]===0x1){return _0x14dd7c['id'];}else{var _0xc384d1=_['every'](_[_0x510e('0x2d')](_0x170d24,_0x510e('0x7e')),function(_0x38ade5){return _['includes'](_0x44146e,_0x38ade5);});if(_0xc384d1){return _0x14dd7c['id'];}}}));}}return BPromise[_0x510e('0x7f')](_0x55d189)['then'](function(_0x30cad4){_0x498f0a=_(_0x498f0a)[_0x510e('0x80')](_0x30cad4)[_0x510e('0x81')]()[_0x510e('0x82')]();return db[_0x510e('0x42')]['find']({'where':{'id':_0x2b3c6c[_0x510e('0x47')]['id']}})[_0x510e('0x27')](function(_0x2b98c7){return db[_0x510e('0x6c')]['transaction'](function(_0x3068a8){return _0x2b98c7[_0x510e('0x72')](_0x2b3c6c[_0x510e('0x33')][_0x510e('0x66')],{'transaction':_0x3068a8})['then'](function(){if(!_['isEmpty'](_0x498f0a)){return _0x2b98c7[_0x510e('0x83')](_0x498f0a,{'transaction':_0x3068a8});}})['then'](function(){_0x498f0a['forEach'](function(_0x1b9f3d){socket['emit'](_0x510e('0x84'),{'UserId':_0x1b9f3d,'FaxQueueId':_0x2b98c7['id']});});});});});});})[_0x510e('0x27')](respondWithStatusCode(_0x5f28b0,null))[_0x510e('0x46')](handleError(_0x5f28b0,null));};exports[_0x510e('0x85')]=function(_0x50a2a0,_0x3558a7,_0x3d6a52){return db[_0x510e('0x42')][_0x510e('0x49')]({'where':{'id':_0x50a2a0[_0x510e('0x47')]['id']}})[_0x510e('0x27')](handleEntityNotFound(_0x3558a7,null))[_0x510e('0x27')](function(_0x414acc){if(_0x414acc){return _0x414acc['addAgents'](_0x50a2a0[_0x510e('0x52')][_0x510e('0x66')],_[_0x510e('0x86')](_0x50a2a0[_0x510e('0x52')],[_0x510e('0x66'),'id'])||{})['spread'](function(_0xa01b8b){for(var _0x283fd8=0x0;_0x283fd8<_0x50a2a0[_0x510e('0x52')][_0x510e('0x66')]['length'];_0x283fd8+=0x1){socket['emit'](_0x510e('0x87'),{'UserId':Number(_0x50a2a0['body'][_0x510e('0x66')][_0x283fd8]),'FaxQueueId':Number(_0x50a2a0[_0x510e('0x47')]['id'])});}return _0xa01b8b;});}})[_0x510e('0x27')](respondWithResult(_0x3558a7,null))[_0x510e('0x46')](handleError(_0x3558a7,null));};exports[_0x510e('0x83')]=function(_0x1ff577,_0x53f52c,_0x38844d){return db[_0x510e('0x42')][_0x510e('0x49')]({'where':{'id':_0x1ff577[_0x510e('0x47')]['id']}})[_0x510e('0x27')](handleEntityNotFound(_0x53f52c,null))[_0x510e('0x27')](function(_0x4793f1){if(_0x4793f1){return _0x4793f1[_0x510e('0x83')](_0x1ff577[_0x510e('0x33')][_0x510e('0x66')])[_0x510e('0x27')](function(){if(_['isArray'](_0x1ff577[_0x510e('0x33')][_0x510e('0x66')])){for(var _0x1191c4=0x0;_0x1191c4<_0x1ff577[_0x510e('0x33')][_0x510e('0x66')][_0x510e('0x48')];_0x1191c4+=0x1){socket[_0x510e('0x71')](_0x510e('0x84'),{'UserId':Number(_0x1ff577['query'][_0x510e('0x66')][_0x1191c4]),'FaxQueueId':Number(_0x1ff577[_0x510e('0x47')]['id'])});}}else{socket[_0x510e('0x71')](_0x510e('0x84'),{'UserId':Number(_0x1ff577['query'][_0x510e('0x66')]),'FaxQueueId':Number(_0x1ff577[_0x510e('0x47')]['id'])});}});}})[_0x510e('0x27')](respondWithStatusCode(_0x53f52c,null))['catch'](handleError(_0x53f52c,null));};exports[_0x510e('0x88')]=function(_0xbb7329,_0x1611ef,_0xaf45b4){var _0x4e05d2={};var _0x401a0f={};var _0x401f02;var _0x1d85e3;return db[_0x510e('0x42')][_0x510e('0x56')]({'where':{'id':_0xbb7329[_0x510e('0x47')]['id']}})['then'](handleEntityNotFound(_0x1611ef,null))[_0x510e('0x27')](function(_0x36faec){if(_0x36faec){_0x401f02=_0x36faec;_0x401a0f[_0x510e('0x32')]=_[_0x510e('0x34')](db[_0x510e('0x5a')][_0x510e('0x2e')]);_0x401a0f[_0x510e('0x33')]=_[_0x510e('0x34')](_0xbb7329['query']);_0x401a0f[_0x510e('0x35')]=_[_0x510e('0x36')](_0x401a0f[_0x510e('0x32')],_0x401a0f['query']);_0x4e05d2[_0x510e('0x37')]=_['intersection'](_0x401a0f[_0x510e('0x32')],qs['fields'](_0xbb7329[_0x510e('0x33')][_0x510e('0x38')]));_0x4e05d2['attributes']=_0x4e05d2[_0x510e('0x37')][_0x510e('0x48')]?_0x4e05d2['attributes']:_0x401a0f['model'];_0x4e05d2[_0x510e('0x3b')]=qs['sort'](_0xbb7329[_0x510e('0x33')]['sort']);_0x4e05d2[_0x510e('0x3d')]=qs[_0x510e('0x35')](_[_0x510e('0x58')](_0xbb7329['query'],_0x401a0f[_0x510e('0x35')]));if(_0xbb7329['query']['filter']){_0x4e05d2[_0x510e('0x3d')]=_[_0x510e('0x3e')](_0x4e05d2[_0x510e('0x3d')],{'$or':_[_0x510e('0x2d')](_0x4e05d2['attributes'],function(_0x51f74c){var _0x489984={};_0x489984[_0x51f74c]={'$like':'%'+_0xbb7329['query'][_0x510e('0x40')]+'%'};return _0x489984;})});}_0x4e05d2=_[_0x510e('0x3e')]({},_0x4e05d2,_0xbb7329[_0x510e('0x41')]);return _0x401f02[_0x510e('0x88')](_0x4e05d2);}})['then'](function(_0x24eeee){if(_0x24eeee){_0x1d85e3=_0x24eeee[_0x510e('0x48')];if(!_0xbb7329[_0x510e('0x33')][_0x510e('0x39')](_0x510e('0x3a'))){_0x4e05d2[_0x510e('0x22')]=qs[_0x510e('0x22')](_0xbb7329[_0x510e('0x33')][_0x510e('0x22')]);_0x4e05d2['offset']=qs[_0x510e('0x20')](_0xbb7329['query'][_0x510e('0x20')]);}return _0x401f02[_0x510e('0x88')](_0x4e05d2);}})[_0x510e('0x27')](function(_0x5437e0){if(_0x5437e0){return _0x5437e0?{'count':_0x1d85e3,'rows':_0x5437e0}:null;}})[_0x510e('0x27')](respondWithResult(_0x1611ef,null))['catch'](handleError(_0x1611ef,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index a93bb26..ce99177 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 _0x6827=['hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1ab21c,_0x446e99){var _0x53dcb1=function(_0x482a6f){while(--_0x482a6f){_0x1ab21c['push'](_0x1ab21c['shift']());}};_0x53dcb1(++_0x446e99);}(_0x6827,0x1e2));var _0x7682=function(_0x431edc,_0xef2bec){_0x431edc=_0x431edc-0x0;var _0x5af419=_0x6827[_0x431edc];return _0x5af419;};'use strict';var EventEmitter=require(_0x7682('0x0'));var FaxQueue=require(_0x7682('0x1'))['db'][_0x7682('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x7682('0x3')](0x0);var events={'afterCreate':_0x7682('0x4'),'afterUpdate':_0x7682('0x5'),'afterDestroy':'remove'};function emitEvent(_0x14c3a9){return function(_0x333e37,_0x3d274e,_0x767470){FaxQueueEvents[_0x7682('0x6')](_0x14c3a9+':'+_0x333e37['id'],_0x333e37);FaxQueueEvents['emit'](_0x14c3a9,_0x333e37);_0x767470(null);};}for(var e in events){if(events[_0x7682('0x7')](e)){var event=events[e];FaxQueue[_0x7682('0x8')](e,emitEvent(event));}}module[_0x7682('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0xfeef=['remove','emit','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save'];(function(_0x5c7507,_0x2abff){var _0x2698f1=function(_0x20fd51){while(--_0x20fd51){_0x5c7507['push'](_0x5c7507['shift']());}};_0x2698f1(++_0x2abff);}(_0xfeef,0x12d));var _0xffee=function(_0x5db570,_0x4116d3){_0x5db570=_0x5db570-0x0;var _0x4ee280=_0xfeef[_0x5db570];return _0x4ee280;};'use strict';var EventEmitter=require(_0xffee('0x0'));var FaxQueue=require(_0xffee('0x1'))['db'][_0xffee('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xffee('0x3')](0x0);var events={'afterCreate':_0xffee('0x4'),'afterUpdate':'update','afterDestroy':_0xffee('0x5')};function emitEvent(_0x7f1130){return function(_0x44bcb6,_0x2b97c4,_0x342084){FaxQueueEvents['emit'](_0x7f1130+':'+_0x44bcb6['id'],_0x44bcb6);FaxQueueEvents[_0xffee('0x6')](_0x7f1130,_0x44bcb6);_0x342084(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xffee('0x7')](e,emitEvent(event));}}module[_0xffee('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 76e6b66..551bf6c 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 _0x56e4=['lodash','moment','request-promise','rimraf','./faxQueue.attributes','exports','define','FaxQueue','fax_queues'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x56e4,0x129));var _0x456e=function(_0x187d40,_0x5869d9){_0x187d40=_0x187d40-0x0;var _0x6d39=_0x56e4[_0x187d40];return _0x6d39;};'use strict';var _=require(_0x456e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x456e('0x1'));var BPromise=require('bluebird');var rp=require(_0x456e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x456e('0x3'));var config=require('../../config/environment');var attributes=require(_0x456e('0x4'));module[_0x456e('0x5')]=function(_0x3db064,_0x41ffd3){return _0x3db064[_0x456e('0x6')](_0x456e('0x7'),attributes,{'tableName':_0x456e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7833=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues','util'];(function(_0x1a1bd2,_0x1f07e4){var _0x2fabdc=function(_0x50c293){while(--_0x50c293){_0x1a1bd2['push'](_0x1a1bd2['shift']());}};_0x2fabdc(++_0x1f07e4);}(_0x7833,0x6d));var _0x3783=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0x7833[_0x31eb67];return _0x2a8cb8;};'use strict';var _=require('lodash');var util=require(_0x3783('0x0'));var logger=require(_0x3783('0x1'))('api');var moment=require(_0x3783('0x2'));var BPromise=require('bluebird');var rp=require(_0x3783('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3783('0x4'));var config=require(_0x3783('0x5'));var attributes=require(_0x3783('0x6'));module['exports']=function(_0x4f284c,_0x459bb4){return _0x4f284c[_0x3783('0x7')](_0x3783('0x8'),attributes,{'tableName':_0x3783('0x9'),'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 f56f121..55befd6 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 _0xfac2=['limit','map','include','model','stringify','ShowFaxQueue','find','raw','util','randomstring','ioredis','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetFaxQueue','FaxQueue','options','where','attributes'];(function(_0x33f153,_0x39d65d){var _0x12ac15=function(_0x1603c1){while(--_0x1603c1){_0x33f153['push'](_0x33f153['shift']());}};_0x12ac15(++_0x39d65d);}(_0xfac2,0xc8));var _0x2fac=function(_0x336520,_0x4030d4){_0x336520=_0x336520-0x0;var _0x483e9a=_0xfac2[_0x336520];return _0x483e9a;};'use strict';var _=require('lodash');var util=require(_0x2fac('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2fac('0x1'));var fs=require('fs');var Redis=require(_0x2fac('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2fac('0x3'));var client=jayson[_0x2fac('0x4')][_0x2fac('0x5')]({'port':0x232a});config[_0x2fac('0x6')]=_[_0x2fac('0x7')](config[_0x2fac('0x6')],{'host':_0x2fac('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2fac('0x9'))['register'](socket);function respondWithRpcPromise(_0x1b3775,_0x5c52d5,_0x378ecc){return new BPromise(function(_0x532245,_0xe20373){return client[_0x2fac('0xa')](_0x1b3775,_0x378ecc)['then'](function(_0x5cfce7){logger[_0x2fac('0xb')](_0x2fac('0xc'),_0x5c52d5,_0x2fac('0xd'));logger[_0x2fac('0xe')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x5c52d5,_0x2fac('0xd'),JSON['stringify'](_0x5cfce7));if(_0x5cfce7['error']){if(_0x5cfce7[_0x2fac('0xf')]['code']===0x1f4){logger[_0x2fac('0xf')](_0x2fac('0xc'),_0x5c52d5,_0x5cfce7['error'][_0x2fac('0x10')]);return _0xe20373(_0x5cfce7[_0x2fac('0xf')][_0x2fac('0x10')]);}logger[_0x2fac('0xf')]('FaxQueue,\x20%s,\x20%s',_0x5c52d5,_0x5cfce7[_0x2fac('0xf')][_0x2fac('0x10')]);return _0x532245(_0x5cfce7[_0x2fac('0xf')][_0x2fac('0x10')]);}else{logger[_0x2fac('0xb')](_0x2fac('0xc'),_0x5c52d5,_0x2fac('0xd'));_0x532245(_0x5cfce7[_0x2fac('0x11')]['message']);}})[_0x2fac('0x12')](function(_0xcfd51e){logger[_0x2fac('0xf')](_0x2fac('0xc'),_0x5c52d5,_0xcfd51e);_0xe20373(_0xcfd51e);});});}exports[_0x2fac('0x13')]=function(_0x1ad179){var _0x4ceb85=this;return new Promise(function(_0x254769,_0x329581){return db[_0x2fac('0x14')]['findAll']({'raw':_0x1ad179[_0x2fac('0x15')]?_0x1ad179['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ad179['options']?_0x1ad179[_0x2fac('0x15')][_0x2fac('0x16')]||null:null,'attributes':_0x1ad179['options']?_0x1ad179[_0x2fac('0x15')][_0x2fac('0x17')]||null:null,'limit':_0x1ad179[_0x2fac('0x15')]?_0x1ad179[_0x2fac('0x15')][_0x2fac('0x18')]||null:null,'include':_0x1ad179[_0x2fac('0x15')]?_0x1ad179['options']['include']?_[_0x2fac('0x19')](_0x1ad179[_0x2fac('0x15')][_0x2fac('0x1a')],function(_0xe966b6){return{'model':db[_0xe966b6[_0x2fac('0x1b')]],'as':_0xe966b6['as'],'attributes':_0xe966b6[_0x2fac('0x17')],'include':_0xe966b6[_0x2fac('0x1a')]?_[_0x2fac('0x19')](_0xe966b6[_0x2fac('0x1a')],function(_0x21b284){return{'model':db[_0x21b284[_0x2fac('0x1b')]],'as':_0x21b284['as'],'attributes':_0x21b284[_0x2fac('0x17')],'include':_0x21b284[_0x2fac('0x1a')]?_['map'](_0x21b284[_0x2fac('0x1a')],function(_0x59f13a){return{'model':db[_0x59f13a[_0x2fac('0x1b')]],'as':_0x59f13a['as'],'attributes':_0x59f13a[_0x2fac('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4eb966){logger['info'](_0x2fac('0x13'),_0x1ad179);logger['debug']('GetFaxQueue',_0x1ad179,JSON[_0x2fac('0x1c')](_0x4eb966));_0x254769(_0x4eb966);})[_0x2fac('0x12')](function(_0x8c4f33){logger[_0x2fac('0xf')]('GetFaxQueue',_0x8c4f33[_0x2fac('0x10')],_0x1ad179);_0x329581(_0x4ceb85[_0x2fac('0xf')](0x1f4,_0x8c4f33[_0x2fac('0x10')]));});});};exports[_0x2fac('0x1d')]=function(_0x412ff0){var _0x206441=this;return new Promise(function(_0x58ce99,_0x30e40b){return db['FaxQueue'][_0x2fac('0x1e')]({'raw':_0x412ff0[_0x2fac('0x15')]?_0x412ff0[_0x2fac('0x15')][_0x2fac('0x1f')]===undefined?!![]:![]:!![],'where':_0x412ff0['options']?_0x412ff0['options'][_0x2fac('0x16')]||null:null,'attributes':_0x412ff0['options']?_0x412ff0[_0x2fac('0x15')][_0x2fac('0x17')]||null:null,'include':_0x412ff0[_0x2fac('0x15')]?_0x412ff0[_0x2fac('0x15')]['include']?_['map'](_0x412ff0['options'][_0x2fac('0x1a')],function(_0x3587ed){return{'model':db[_0x3587ed[_0x2fac('0x1b')]],'as':_0x3587ed['as'],'attributes':_0x3587ed[_0x2fac('0x17')],'include':_0x3587ed['include']?_['map'](_0x3587ed[_0x2fac('0x1a')],function(_0x4dae68){return{'model':db[_0x4dae68[_0x2fac('0x1b')]],'as':_0x4dae68['as'],'attributes':_0x4dae68['attributes'],'include':_0x4dae68[_0x2fac('0x1a')]?_[_0x2fac('0x19')](_0x4dae68[_0x2fac('0x1a')],function(_0x320116){return{'model':db[_0x320116['model']],'as':_0x320116['as'],'attributes':_0x320116['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xcb9528){logger[_0x2fac('0xb')](_0x2fac('0x1d'),_0x412ff0);logger[_0x2fac('0xe')](_0x2fac('0x1d'),_0x412ff0,JSON[_0x2fac('0x1c')](_0xcb9528));_0x58ce99(_0xcb9528);})[_0x2fac('0x12')](function(_0x2975c3){logger[_0x2fac('0xf')](_0x2fac('0x1d'),_0x2975c3[_0x2fac('0x10')],_0x412ff0);_0x30e40b(_0x206441[_0x2fac('0xf')](0x1f4,_0x2975c3['message']));});});}; \ No newline at end of file +var _0x31c9=['catch','find','ShowFaxQueue','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','client','defaults','redis','localhost','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetFaxQueue','FaxQueue','options','raw','where','limit','include','map','model','attributes'];(function(_0x55d65b,_0x40e24d){var _0x3f82b4=function(_0x558e22){while(--_0x558e22){_0x55d65b['push'](_0x55d65b['shift']());}};_0x3f82b4(++_0x40e24d);}(_0x31c9,0x1d7));var _0x931c=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x31c9[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0x931c('0x0'));var util=require('util');var moment=require(_0x931c('0x1'));var BPromise=require(_0x931c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x931c('0x3'));var db=require(_0x931c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x931c('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x931c('0x6')]['http']({'port':0x232a});config['redis']=_[_0x931c('0x7')](config[_0x931c('0x8')],{'host':_0x931c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x931c('0x8')]));require(_0x931c('0xa'))[_0x931c('0xb')](socket);function respondWithRpcPromise(_0x3221b3,_0x4b6925,_0x5aed20){return new BPromise(function(_0x5cffe0,_0x265bde){return client['request'](_0x3221b3,_0x5aed20)[_0x931c('0xc')](function(_0x2736dd){logger[_0x931c('0xd')](_0x931c('0xe'),_0x4b6925,'request\x20sent');logger[_0x931c('0xf')](_0x931c('0x10'),_0x4b6925,_0x931c('0x11'),JSON[_0x931c('0x12')](_0x2736dd));if(_0x2736dd['error']){if(_0x2736dd[_0x931c('0x13')][_0x931c('0x14')]===0x1f4){logger[_0x931c('0x13')](_0x931c('0xe'),_0x4b6925,_0x2736dd['error'][_0x931c('0x15')]);return _0x265bde(_0x2736dd['error'][_0x931c('0x15')]);}logger['error'](_0x931c('0xe'),_0x4b6925,_0x2736dd[_0x931c('0x13')][_0x931c('0x15')]);return _0x5cffe0(_0x2736dd[_0x931c('0x13')][_0x931c('0x15')]);}else{logger[_0x931c('0xd')](_0x931c('0xe'),_0x4b6925,_0x931c('0x11'));_0x5cffe0(_0x2736dd[_0x931c('0x16')][_0x931c('0x15')]);}})['catch'](function(_0x2362f1){logger[_0x931c('0x13')]('FaxQueue,\x20%s,\x20%s',_0x4b6925,_0x2362f1);_0x265bde(_0x2362f1);});});}exports[_0x931c('0x17')]=function(_0x2b992b){var _0x3cf0d7=this;return new Promise(function(_0x34565a,_0x4cb220){return db[_0x931c('0x18')]['findAll']({'raw':_0x2b992b[_0x931c('0x19')]?_0x2b992b[_0x931c('0x19')][_0x931c('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b992b[_0x931c('0x19')]?_0x2b992b['options'][_0x931c('0x1b')]||null:null,'attributes':_0x2b992b[_0x931c('0x19')]?_0x2b992b[_0x931c('0x19')]['attributes']||null:null,'limit':_0x2b992b[_0x931c('0x19')]?_0x2b992b[_0x931c('0x19')][_0x931c('0x1c')]||null:null,'include':_0x2b992b[_0x931c('0x19')]?_0x2b992b[_0x931c('0x19')][_0x931c('0x1d')]?_[_0x931c('0x1e')](_0x2b992b[_0x931c('0x19')][_0x931c('0x1d')],function(_0x3c65c2){return{'model':db[_0x3c65c2[_0x931c('0x1f')]],'as':_0x3c65c2['as'],'attributes':_0x3c65c2['attributes'],'include':_0x3c65c2['include']?_['map'](_0x3c65c2[_0x931c('0x1d')],function(_0x15ef9c){return{'model':db[_0x15ef9c[_0x931c('0x1f')]],'as':_0x15ef9c['as'],'attributes':_0x15ef9c['attributes'],'include':_0x15ef9c['include']?_[_0x931c('0x1e')](_0x15ef9c['include'],function(_0x39fc28){return{'model':db[_0x39fc28[_0x931c('0x1f')]],'as':_0x39fc28['as'],'attributes':_0x39fc28[_0x931c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x931c('0xc')](function(_0x5a6d01){logger[_0x931c('0xd')](_0x931c('0x17'),_0x2b992b);logger[_0x931c('0xf')](_0x931c('0x17'),_0x2b992b,JSON[_0x931c('0x12')](_0x5a6d01));_0x34565a(_0x5a6d01);})[_0x931c('0x21')](function(_0x59199b){logger[_0x931c('0x13')](_0x931c('0x17'),_0x59199b[_0x931c('0x15')],_0x2b992b);_0x4cb220(_0x3cf0d7[_0x931c('0x13')](0x1f4,_0x59199b['message']));});});};exports['ShowFaxQueue']=function(_0x4bad4e){var _0x111b94=this;return new Promise(function(_0x228547,_0x2c96f4){return db[_0x931c('0x18')][_0x931c('0x22')]({'raw':_0x4bad4e['options']?_0x4bad4e['options']['raw']===undefined?!![]:![]:!![],'where':_0x4bad4e[_0x931c('0x19')]?_0x4bad4e[_0x931c('0x19')][_0x931c('0x1b')]||null:null,'attributes':_0x4bad4e[_0x931c('0x19')]?_0x4bad4e[_0x931c('0x19')][_0x931c('0x20')]||null:null,'include':_0x4bad4e[_0x931c('0x19')]?_0x4bad4e[_0x931c('0x19')][_0x931c('0x1d')]?_['map'](_0x4bad4e['options'][_0x931c('0x1d')],function(_0x1c7b64){return{'model':db[_0x1c7b64['model']],'as':_0x1c7b64['as'],'attributes':_0x1c7b64[_0x931c('0x20')],'include':_0x1c7b64[_0x931c('0x1d')]?_['map'](_0x1c7b64[_0x931c('0x1d')],function(_0x36eac9){return{'model':db[_0x36eac9[_0x931c('0x1f')]],'as':_0x36eac9['as'],'attributes':_0x36eac9[_0x931c('0x20')],'include':_0x36eac9['include']?_[_0x931c('0x1e')](_0x36eac9['include'],function(_0x34abb3){return{'model':db[_0x34abb3[_0x931c('0x1f')]],'as':_0x34abb3['as'],'attributes':_0x34abb3[_0x931c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x931c('0xc')](function(_0x597534){logger['info'](_0x931c('0x23'),_0x4bad4e);logger['debug'](_0x931c('0x23'),_0x4bad4e,JSON[_0x931c('0x12')](_0x597534));_0x228547(_0x597534);})[_0x931c('0x21')](function(_0xda34f0){logger[_0x931c('0x13')]('ShowFaxQueue',_0xda34f0['message'],_0x4bad4e);_0x2c96f4(_0x111b94[_0x931c('0x13')](0x1f4,_0xda34f0[_0x931c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 5d2d6db..836d036 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 _0xee14=['faxQueue:','./faxQueue.events','remove','update','emit','removeListener','length'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0xee14,0x166));var _0x4ee1=function(_0x116136,_0x15bda9){_0x116136=_0x116136-0x0;var _0x67f359=_0xee14[_0x116136];return _0x67f359;};'use strict';var FaxQueueEvents=require(_0x4ee1('0x0'));var events=['save',_0x4ee1('0x1'),_0x4ee1('0x2')];function createListener(_0x40519a,_0xf072b3){return function(_0x5957b3){_0xf072b3[_0x4ee1('0x3')](_0x40519a,_0x5957b3);};}function removeListener(_0x267683,_0x127b3f){return function(){FaxQueueEvents[_0x4ee1('0x4')](_0x267683,_0x127b3f);};}exports['register']=function(_0x5961f3){for(var _0x37fbb3=0x0,_0x17312a=events[_0x4ee1('0x5')];_0x37fbb3<_0x17312a;_0x37fbb3++){var _0x43b89e=events[_0x37fbb3];var _0x3f970e=createListener(_0x4ee1('0x6')+_0x43b89e,_0x5961f3);FaxQueueEvents['on'](_0x43b89e,_0x3f970e);}}; \ No newline at end of file +var _0xbe41=['update','removeListener','length','./faxQueue.events','save','remove'];(function(_0x500b9f,_0x242e49){var _0x42a63f=function(_0x54ee81){while(--_0x54ee81){_0x500b9f['push'](_0x500b9f['shift']());}};_0x42a63f(++_0x242e49);}(_0xbe41,0x1b9));var _0x1be4=function(_0x2a2c6e,_0x5a3792){_0x2a2c6e=_0x2a2c6e-0x0;var _0x364631=_0xbe41[_0x2a2c6e];return _0x364631;};'use strict';var FaxQueueEvents=require(_0x1be4('0x0'));var events=[_0x1be4('0x1'),_0x1be4('0x2'),_0x1be4('0x3')];function createListener(_0x305abe,_0x435ecb){return function(_0x28710d){_0x435ecb['emit'](_0x305abe,_0x28710d);};}function removeListener(_0x1139e3,_0x332ad6){return function(){FaxQueueEvents[_0x1be4('0x4')](_0x1139e3,_0x332ad6);};}exports['register']=function(_0x2f6063){for(var _0x47489e=0x0,_0x313492=events[_0x1be4('0x5')];_0x47489e<_0x313492;_0x47489e++){var _0x3c4573=events[_0x47489e];var _0x5daf08=createListener('faxQueue:'+_0x3c4573,_0x2f6063);FaxQueueEvents['on'](_0x3c4573,_0x5daf08);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 375d217..710624d 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 _0x3e24=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','exports','multer'];(function(_0x27eead,_0x18ecbb){var _0x2605b=function(_0x2eec9c){while(--_0x2eec9c){_0x27eead['push'](_0x27eead['shift']());}};_0x2605b(++_0x18ecbb);}(_0x3e24,0x167));var _0x43e2=function(_0x390b40,_0x32a62e){_0x390b40=_0x390b40-0x0;var _0x11a416=_0x3e24[_0x390b40];return _0x11a416;};'use strict';var multer=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var path=require(_0x43e2('0x2'));var timeout=require(_0x43e2('0x3'));var express=require(_0x43e2('0x4'));var router=express['Router']();var fs_extra=require(_0x43e2('0x5'));var auth=require(_0x43e2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x43e2('0x7'));var controller=require(_0x43e2('0x8'));router[_0x43e2('0x9')]('/',auth[_0x43e2('0xa')](),controller[_0x43e2('0xb')]);router[_0x43e2('0x9')](_0x43e2('0xc'),auth['isAuthenticated'](),controller[_0x43e2('0xd')]);router[_0x43e2('0x9')]('/:id',auth[_0x43e2('0xa')](),controller[_0x43e2('0xe')]);router['get'](_0x43e2('0xf'),auth[_0x43e2('0xa')](),controller['getMembers']);router[_0x43e2('0x9')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x43e2('0x9')](_0x43e2('0x10'),auth[_0x43e2('0xa')](),controller[_0x43e2('0x11')]);router[_0x43e2('0x12')]('/',auth[_0x43e2('0xa')](),controller[_0x43e2('0x13')]);router[_0x43e2('0x12')](_0x43e2('0x14'),auth[_0x43e2('0xa')](),controller[_0x43e2('0x15')]);router[_0x43e2('0x12')]('/:id/users',auth[_0x43e2('0xa')](),controller[_0x43e2('0x16')]);router[_0x43e2('0x17')](_0x43e2('0x18'),auth['isAuthenticated'](),controller['update']);router[_0x43e2('0x19')](_0x43e2('0x18'),auth[_0x43e2('0xa')](),controller[_0x43e2('0x1a')]);router[_0x43e2('0x19')](_0x43e2('0x14'),auth[_0x43e2('0xa')](),controller[_0x43e2('0x1b')]);router[_0x43e2('0x19')](_0x43e2('0x10'),auth['isAuthenticated'](),controller[_0x43e2('0x1c')]);module[_0x43e2('0x1d')]=router; \ No newline at end of file +var _0xcaf2=['delete','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','update','destroy'];(function(_0x382781,_0x4fc697){var _0x33c15d=function(_0x2df6c7){while(--_0x2df6c7){_0x382781['push'](_0x382781['shift']());}};_0x33c15d(++_0x4fc697);}(_0xcaf2,0x8a));var _0x2caf=function(_0x5aabcb,_0x219fbd){_0x5aabcb=_0x5aabcb-0x0;var _0x4b6e71=_0xcaf2[_0x5aabcb];return _0x4b6e71;};'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('0x7')](_0x2caf('0xd'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xe')]);router[_0x2caf('0x7')](_0x2caf('0xf'),auth['isAuthenticated'](),controller[_0x2caf('0x10')]);router[_0x2caf('0x7')](_0x2caf('0x11'),auth[_0x2caf('0x8')](),controller[_0x2caf('0x12')]);router[_0x2caf('0x13')]('/',auth[_0x2caf('0x8')](),controller[_0x2caf('0x14')]);router['post'](_0x2caf('0xf'),auth[_0x2caf('0x8')](),controller['addTeams']);router['post']('/:id/users',auth[_0x2caf('0x8')](),controller['addAgents']);router[_0x2caf('0x15')](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0x16')]);router['delete'](_0x2caf('0xb'),auth['isAuthenticated'](),controller[_0x2caf('0x17')]);router['delete']('/:id/teams',auth[_0x2caf('0x8')](),controller['removeTeams']);router[_0x2caf('0x18')](_0x2caf('0x11'),auth['isAuthenticated'](),controller[_0x2caf('0x19')]);module[_0x2caf('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 3f0205e..6251b87 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 _0xa8e7=['moment','sequelize','exports','STRING','DATE'];(function(_0x16b094,_0x58e0ed){var _0x21a5d8=function(_0x233107){while(--_0x233107){_0x16b094['push'](_0x16b094['shift']());}};_0x21a5d8(++_0x58e0ed);}(_0xa8e7,0xd2));var _0x7a8e=function(_0x4d93f4,_0x542242){_0x4d93f4=_0x4d93f4-0x0;var _0x48545d=_0xa8e7[_0x4d93f4];return _0x48545d;};'use strict';var moment=require(_0x7a8e('0x0'));var Sequelize=require(_0x7a8e('0x1'));module[_0x7a8e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x7a8e('0x3')]},'joinAt':{'type':Sequelize[_0x7a8e('0x4')]},'leaveAt':{'type':Sequelize[_0x7a8e('0x4')]},'acceptAt':{'type':Sequelize[_0x7a8e('0x4')]},'exitAt':{'type':Sequelize[_0x7a8e('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaede=['sequelize','exports','STRING','DATE','moment'];(function(_0x17929d,_0x43f6ec){var _0x362504=function(_0x3ea2f8){while(--_0x3ea2f8){_0x17929d['push'](_0x17929d['shift']());}};_0x362504(++_0x43f6ec);}(_0xaede,0x11c));var _0xeaed=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xaede[_0x4a9fb1];return _0x348672;};'use strict';var moment=require(_0xeaed('0x0'));var Sequelize=require(_0xeaed('0x1'));module[_0xeaed('0x2')]={'uniqueid':{'type':Sequelize[_0xeaed('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xeaed('0x4')]},'leaveAt':{'type':Sequelize[_0xeaed('0x4')]},'acceptAt':{'type':Sequelize[_0xeaed('0x4')]},'exitAt':{'type':Sequelize[_0xeaed('0x4')]},'reason':{'type':Sequelize[_0xeaed('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 99c9e2b..730c931 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 _0x1cf3=['status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end'];(function(_0x24e7b0,_0x23104f){var _0x1b09a1=function(_0xf17972){while(--_0xf17972){_0x24e7b0['push'](_0x24e7b0['shift']());}};_0x1b09a1(++_0x23104f);}(_0x1cf3,0x1be));var _0x31cf=function(_0x501781,_0x3860cd){_0x501781=_0x501781-0x0;var _0x5b0537=_0x1cf3[_0x501781];return _0x5b0537;};'use strict';var emlformat=require(_0x31cf('0x0'));var rimraf=require(_0x31cf('0x1'));var zipdir=require(_0x31cf('0x2'));var jsonpatch=require(_0x31cf('0x3'));var rp=require('request-promise');var moment=require(_0x31cf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x31cf('0x5'));var util=require(_0x31cf('0x6'));var path=require(_0x31cf('0x7'));var sox=require(_0x31cf('0x8'));var csv=require(_0x31cf('0x9'));var ejs=require(_0x31cf('0xa'));var fs=require('fs');var fs_extra=require(_0x31cf('0xb'));var _=require(_0x31cf('0xc'));var squel=require(_0x31cf('0xd'));var crypto=require(_0x31cf('0xe'));var jsforce=require(_0x31cf('0xf'));var deskjs=require(_0x31cf('0x10'));var toCsv=require(_0x31cf('0x9'));var querystring=require(_0x31cf('0x11'));var Papa=require('papaparse');var Redis=require(_0x31cf('0x12'));var authService=require(_0x31cf('0x13'));var qs=require(_0x31cf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31cf('0x15'));var logger=require(_0x31cf('0x16'))(_0x31cf('0x17'));var utils=require(_0x31cf('0x18'));var config=require(_0x31cf('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15c5ef,_0x34e202){_0x34e202=_0x34e202||0xcc;return function(_0xfc40c9){if(_0xfc40c9){return _0x15c5ef[_0x31cf('0x1a')](_0x34e202);}return _0x15c5ef['status'](_0x34e202)[_0x31cf('0x1b')]();};}function respondWithResult(_0x106949,_0x41f3df){_0x41f3df=_0x41f3df||0xc8;return function(_0x492d3d){if(_0x492d3d){return _0x106949[_0x31cf('0x1c')](_0x41f3df)[_0x31cf('0x1d')](_0x492d3d);}};}function respondWithFilteredResult(_0x28be97,_0x1f6470){return function(_0x4ae41f){if(_0x4ae41f){var _0x54af12=typeof _0x1f6470[_0x31cf('0x1e')]===_0x31cf('0x1f')&&typeof _0x1f6470[_0x31cf('0x20')]==='undefined';var _0x1d4830=_0x4ae41f[_0x31cf('0x21')];var _0x54b753=_0x54af12?0x0:_0x1f6470['offset'];var _0x3c1bca=_0x54af12?_0x4ae41f['count']:_0x1f6470[_0x31cf('0x1e')]+_0x1f6470['limit'];var _0x4fd305;if(_0x3c1bca>=_0x1d4830){_0x3c1bca=_0x1d4830;_0x4fd305=0xc8;}else{_0x4fd305=0xce;}_0x28be97[_0x31cf('0x1c')](_0x4fd305);return _0x28be97[_0x31cf('0x22')](_0x31cf('0x23'),_0x54b753+'-'+_0x3c1bca+'/'+_0x1d4830)[_0x31cf('0x1d')](_0x4ae41f);}return null;};}function patchUpdates(_0x337447){return function(_0x2499e7){try{jsonpatch[_0x31cf('0x24')](_0x2499e7,_0x337447,!![]);}catch(_0x1a1864){return BPromise['reject'](_0x1a1864);}return _0x2499e7[_0x31cf('0x25')]();};}function saveUpdates(_0x134f75,_0x247a48){return function(_0xfa517f){if(_0xfa517f){return _0xfa517f[_0x31cf('0x26')](_0x134f75)[_0x31cf('0x27')](function(_0x462b83){return _0x462b83;});}return null;};}function removeEntity(_0x5cb51b,_0x33e6e1){return function(_0x3f09d3){if(_0x3f09d3){return _0x3f09d3[_0x31cf('0x28')]()[_0x31cf('0x27')](function(){_0x5cb51b[_0x31cf('0x1c')](0xcc)[_0x31cf('0x1b')]();});}};}function handleEntityNotFound(_0x34c383,_0x10dd40){return function(_0x53664a){if(!_0x53664a){_0x34c383[_0x31cf('0x1a')](0x194);}return _0x53664a;};}function handleError(_0x2860c4,_0x43519e){_0x43519e=_0x43519e||0x1f4;return function(_0xc5fee6){logger[_0x31cf('0x29')](_0xc5fee6[_0x31cf('0x2a')]);if(_0xc5fee6[_0x31cf('0x2b')]){delete _0xc5fee6[_0x31cf('0x2b')];}_0x2860c4[_0x31cf('0x1c')](_0x43519e)[_0x31cf('0x2c')](_0xc5fee6);};}exports['index']=function(_0x128606,_0x148e36){var _0x4d7fd0={},_0x29b920={},_0x51e298={'count':0x0,'rows':[]};var _0x3bd4ce=_[_0x31cf('0x2d')](db[_0x31cf('0x2e')][_0x31cf('0x2f')],function(_0x80372c){return{'name':_0x80372c[_0x31cf('0x30')],'type':_0x80372c[_0x31cf('0x31')][_0x31cf('0x32')]};});_0x29b920[_0x31cf('0x33')]=_[_0x31cf('0x2d')](_0x3bd4ce,_0x31cf('0x2b'));_0x29b920[_0x31cf('0x34')]=_['keys'](_0x128606['query']);_0x29b920[_0x31cf('0x35')]=_[_0x31cf('0x36')](_0x29b920[_0x31cf('0x33')],_0x29b920[_0x31cf('0x34')]);_0x4d7fd0[_0x31cf('0x37')]=_[_0x31cf('0x36')](_0x29b920['model'],qs[_0x31cf('0x38')](_0x128606[_0x31cf('0x34')][_0x31cf('0x38')]));_0x4d7fd0['attributes']=_0x4d7fd0[_0x31cf('0x37')][_0x31cf('0x39')]?_0x4d7fd0['attributes']:_0x29b920['model'];if(!_0x128606[_0x31cf('0x34')][_0x31cf('0x3a')](_0x31cf('0x3b'))){_0x4d7fd0[_0x31cf('0x20')]=qs['limit'](_0x128606[_0x31cf('0x34')][_0x31cf('0x20')]);_0x4d7fd0[_0x31cf('0x1e')]=qs['offset'](_0x128606['query']['offset']);}_0x4d7fd0[_0x31cf('0x3c')]=qs[_0x31cf('0x3d')](_0x128606[_0x31cf('0x34')][_0x31cf('0x3d')]);_0x4d7fd0[_0x31cf('0x3e')]=qs['filters'](_['pick'](_0x128606['query'],_0x29b920[_0x31cf('0x35')]),_0x3bd4ce);if(_0x128606[_0x31cf('0x34')][_0x31cf('0x3f')]){_0x4d7fd0['where']=_[_0x31cf('0x40')](_0x4d7fd0[_0x31cf('0x3e')],{'$or':_[_0x31cf('0x2d')](_0x3bd4ce,function(_0x189bbf){if(_0x189bbf[_0x31cf('0x31')]!==_0x31cf('0x41')){var _0x48094f={};_0x48094f[_0x189bbf[_0x31cf('0x2b')]]={'$like':'%'+_0x128606[_0x31cf('0x34')][_0x31cf('0x3f')]+'%'};return _0x48094f;}})});}_0x4d7fd0=_[_0x31cf('0x40')]({},_0x4d7fd0,_0x128606[_0x31cf('0x42')]);var _0x28886b={'where':_0x4d7fd0[_0x31cf('0x3e')]};return db[_0x31cf('0x2e')][_0x31cf('0x21')](_0x28886b)['then'](function(_0x411a5a){_0x51e298['count']=_0x411a5a;if(_0x128606['query'][_0x31cf('0x43')]){_0x4d7fd0[_0x31cf('0x44')]=[{'all':!![]}];}return db[_0x31cf('0x2e')][_0x31cf('0x45')](_0x4d7fd0);})['then'](function(_0x25704f){_0x51e298[_0x31cf('0x46')]=_0x25704f;return _0x51e298;})[_0x31cf('0x27')](respondWithFilteredResult(_0x148e36,_0x4d7fd0))[_0x31cf('0x47')](handleError(_0x148e36,null));};exports[_0x31cf('0x48')]=function(_0x239654,_0x540419){var _0x4d45ed={'raw':!![],'where':{'id':_0x239654[_0x31cf('0x49')]['id']}},_0x44c1b2={};_0x44c1b2[_0x31cf('0x33')]=_[_0x31cf('0x4a')](db[_0x31cf('0x2e')][_0x31cf('0x2f')]);_0x44c1b2[_0x31cf('0x34')]=_[_0x31cf('0x4a')](_0x239654[_0x31cf('0x34')]);_0x44c1b2[_0x31cf('0x35')]=_[_0x31cf('0x36')](_0x44c1b2[_0x31cf('0x33')],_0x44c1b2[_0x31cf('0x34')]);_0x4d45ed[_0x31cf('0x37')]=_[_0x31cf('0x36')](_0x44c1b2['model'],qs[_0x31cf('0x38')](_0x239654[_0x31cf('0x34')]['fields']));_0x4d45ed[_0x31cf('0x37')]=_0x4d45ed[_0x31cf('0x37')][_0x31cf('0x39')]?_0x4d45ed[_0x31cf('0x37')]:_0x44c1b2[_0x31cf('0x33')];if(_0x239654[_0x31cf('0x34')][_0x31cf('0x43')]){_0x4d45ed[_0x31cf('0x44')]=[{'all':!![]}];}_0x4d45ed=_[_0x31cf('0x40')]({},_0x4d45ed,_0x239654[_0x31cf('0x42')]);return db[_0x31cf('0x2e')][_0x31cf('0x4b')](_0x4d45ed)[_0x31cf('0x27')](handleEntityNotFound(_0x540419,null))[_0x31cf('0x27')](respondWithResult(_0x540419,null))[_0x31cf('0x47')](handleError(_0x540419,null));};exports['create']=function(_0x492c4d,_0x559ab0){return db['FaxQueueReport'][_0x31cf('0x4c')](_0x492c4d[_0x31cf('0x4d')],{})[_0x31cf('0x27')](respondWithResult(_0x559ab0,0xc9))['catch'](handleError(_0x559ab0,null));};exports[_0x31cf('0x26')]=function(_0x1d01be,_0x1c96f1){if(_0x1d01be['body']['id']){delete _0x1d01be[_0x31cf('0x4d')]['id'];}return db[_0x31cf('0x2e')][_0x31cf('0x4b')]({'where':{'id':_0x1d01be['params']['id']}})['then'](handleEntityNotFound(_0x1c96f1,null))[_0x31cf('0x27')](saveUpdates(_0x1d01be[_0x31cf('0x4d')],null))['then'](respondWithResult(_0x1c96f1,null))[_0x31cf('0x47')](handleError(_0x1c96f1,null));};exports[_0x31cf('0x28')]=function(_0x533a5b,_0x5a9f3c){return db[_0x31cf('0x2e')][_0x31cf('0x4b')]({'where':{'id':_0x533a5b[_0x31cf('0x49')]['id']}})[_0x31cf('0x27')](handleEntityNotFound(_0x5a9f3c,null))[_0x31cf('0x27')](removeEntity(_0x5a9f3c,null))[_0x31cf('0x47')](handleError(_0x5a9f3c,null));};exports[_0x31cf('0x4e')]=function(_0x2a5aab,_0x2baaf3){return db[_0x31cf('0x2e')][_0x31cf('0x4e')]()['then'](respondWithResult(_0x2baaf3,null))['catch'](handleError(_0x2baaf3,null));}; \ No newline at end of file +var _0x86f5=['FaxQueueReport','includeAll','include','findAll','rows','params','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options'];(function(_0x5ee858,_0x35482c){var _0x2c5d89=function(_0x4a378e){while(--_0x4a378e){_0x5ee858['push'](_0x5ee858['shift']());}};_0x2c5d89(++_0x35482c);}(_0x86f5,0x178));var _0x586f=function(_0x234318,_0xf22f31){_0x234318=_0x234318-0x0;var _0x1ab719=_0x86f5[_0x234318];return _0x1ab719;};'use strict';var emlformat=require(_0x586f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x586f('0x1'));var jsonpatch=require(_0x586f('0x2'));var rp=require('request-promise');var moment=require(_0x586f('0x3'));var BPromise=require(_0x586f('0x4'));var Mustache=require(_0x586f('0x5'));var util=require(_0x586f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x586f('0x7'));var ejs=require(_0x586f('0x8'));var fs=require('fs');var fs_extra=require(_0x586f('0x9'));var _=require('lodash');var squel=require(_0x586f('0xa'));var crypto=require(_0x586f('0xb'));var jsforce=require(_0x586f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x586f('0xd'));var Papa=require(_0x586f('0xe'));var Redis=require(_0x586f('0xf'));var authService=require(_0x586f('0x10'));var qs=require(_0x586f('0x11'));var as=require(_0x586f('0x12'));var hardwareService=require(_0x586f('0x13'));var logger=require('../../config/logger')(_0x586f('0x14'));var utils=require('../../config/utils');var config=require(_0x586f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x586f('0x16'))['db'];function respondWithStatusCode(_0x5a0c86,_0xf6b7f9){_0xf6b7f9=_0xf6b7f9||0xcc;return function(_0x560019){if(_0x560019){return _0x5a0c86[_0x586f('0x17')](_0xf6b7f9);}return _0x5a0c86[_0x586f('0x18')](_0xf6b7f9)[_0x586f('0x19')]();};}function respondWithResult(_0x3fc15c,_0x1056cf){_0x1056cf=_0x1056cf||0xc8;return function(_0x23d237){if(_0x23d237){return _0x3fc15c['status'](_0x1056cf)[_0x586f('0x1a')](_0x23d237);}};}function respondWithFilteredResult(_0x4da2fa,_0x5d838c){return function(_0x3381c6){if(_0x3381c6){var _0x24d0ca=typeof _0x5d838c[_0x586f('0x1b')]===_0x586f('0x1c')&&typeof _0x5d838c[_0x586f('0x1d')]===_0x586f('0x1c');var _0x5ef362=_0x3381c6['count'];var _0x44f938=_0x24d0ca?0x0:_0x5d838c[_0x586f('0x1b')];var _0x287faf=_0x24d0ca?_0x3381c6[_0x586f('0x1e')]:_0x5d838c[_0x586f('0x1b')]+_0x5d838c[_0x586f('0x1d')];var _0x276f07;if(_0x287faf>=_0x5ef362){_0x287faf=_0x5ef362;_0x276f07=0xc8;}else{_0x276f07=0xce;}_0x4da2fa[_0x586f('0x18')](_0x276f07);return _0x4da2fa[_0x586f('0x1f')](_0x586f('0x20'),_0x44f938+'-'+_0x287faf+'/'+_0x5ef362)[_0x586f('0x1a')](_0x3381c6);}return null;};}function patchUpdates(_0x38fda7){return function(_0x2c9e43){try{jsonpatch['apply'](_0x2c9e43,_0x38fda7,!![]);}catch(_0x3e36fb){return BPromise[_0x586f('0x21')](_0x3e36fb);}return _0x2c9e43[_0x586f('0x22')]();};}function saveUpdates(_0x32b709,_0x4a7c6a){return function(_0xbd3f34){if(_0xbd3f34){return _0xbd3f34[_0x586f('0x23')](_0x32b709)[_0x586f('0x24')](function(_0x2457b3){return _0x2457b3;});}return null;};}function removeEntity(_0x2d226e,_0x4c1b9c){return function(_0x45e18e){if(_0x45e18e){return _0x45e18e[_0x586f('0x25')]()[_0x586f('0x24')](function(){_0x2d226e[_0x586f('0x18')](0xcc)[_0x586f('0x19')]();});}};}function handleEntityNotFound(_0x2683d7,_0x5cb2ba){return function(_0x1743f2){if(!_0x1743f2){_0x2683d7[_0x586f('0x17')](0x194);}return _0x1743f2;};}function handleError(_0x3e8b53,_0xcee521){_0xcee521=_0xcee521||0x1f4;return function(_0x5536ce){logger[_0x586f('0x26')](_0x5536ce['stack']);if(_0x5536ce[_0x586f('0x27')]){delete _0x5536ce[_0x586f('0x27')];}_0x3e8b53[_0x586f('0x18')](_0xcee521)[_0x586f('0x28')](_0x5536ce);};}exports[_0x586f('0x29')]=function(_0x410d51,_0x2ba6f1){var _0x4d1cfe={},_0x44e83f={},_0x550277={'count':0x0,'rows':[]};var _0x3d6bb2=_['map'](db['FaxQueueReport'][_0x586f('0x2a')],function(_0x2a2f9f){return{'name':_0x2a2f9f['fieldName'],'type':_0x2a2f9f['type'][_0x586f('0x2b')]};});_0x44e83f[_0x586f('0x2c')]=_['map'](_0x3d6bb2,_0x586f('0x27'));_0x44e83f[_0x586f('0x2d')]=_[_0x586f('0x2e')](_0x410d51[_0x586f('0x2d')]);_0x44e83f[_0x586f('0x2f')]=_[_0x586f('0x30')](_0x44e83f['model'],_0x44e83f[_0x586f('0x2d')]);_0x4d1cfe['attributes']=_[_0x586f('0x30')](_0x44e83f[_0x586f('0x2c')],qs[_0x586f('0x31')](_0x410d51[_0x586f('0x2d')][_0x586f('0x31')]));_0x4d1cfe[_0x586f('0x32')]=_0x4d1cfe[_0x586f('0x32')][_0x586f('0x33')]?_0x4d1cfe['attributes']:_0x44e83f[_0x586f('0x2c')];if(!_0x410d51[_0x586f('0x2d')][_0x586f('0x34')](_0x586f('0x35'))){_0x4d1cfe[_0x586f('0x1d')]=qs['limit'](_0x410d51[_0x586f('0x2d')]['limit']);_0x4d1cfe[_0x586f('0x1b')]=qs['offset'](_0x410d51[_0x586f('0x2d')][_0x586f('0x1b')]);}_0x4d1cfe[_0x586f('0x36')]=qs[_0x586f('0x37')](_0x410d51[_0x586f('0x2d')][_0x586f('0x37')]);_0x4d1cfe[_0x586f('0x38')]=qs[_0x586f('0x2f')](_[_0x586f('0x39')](_0x410d51[_0x586f('0x2d')],_0x44e83f['filters']),_0x3d6bb2);if(_0x410d51[_0x586f('0x2d')][_0x586f('0x3a')]){_0x4d1cfe['where']=_['merge'](_0x4d1cfe[_0x586f('0x38')],{'$or':_['map'](_0x3d6bb2,function(_0x47afad){if(_0x47afad[_0x586f('0x3b')]!=='VIRTUAL'){var _0x346a56={};_0x346a56[_0x47afad[_0x586f('0x27')]]={'$like':'%'+_0x410d51[_0x586f('0x2d')][_0x586f('0x3a')]+'%'};return _0x346a56;}})});}_0x4d1cfe=_[_0x586f('0x3c')]({},_0x4d1cfe,_0x410d51[_0x586f('0x3d')]);var _0x5269e7={'where':_0x4d1cfe[_0x586f('0x38')]};return db[_0x586f('0x3e')]['count'](_0x5269e7)[_0x586f('0x24')](function(_0x47c881){_0x550277[_0x586f('0x1e')]=_0x47c881;if(_0x410d51[_0x586f('0x2d')][_0x586f('0x3f')]){_0x4d1cfe[_0x586f('0x40')]=[{'all':!![]}];}return db[_0x586f('0x3e')][_0x586f('0x41')](_0x4d1cfe);})[_0x586f('0x24')](function(_0x1ece6d){_0x550277[_0x586f('0x42')]=_0x1ece6d;return _0x550277;})[_0x586f('0x24')](respondWithFilteredResult(_0x2ba6f1,_0x4d1cfe))['catch'](handleError(_0x2ba6f1,null));};exports['show']=function(_0x2e9b2d,_0x4ac7fc){var _0x5ef3f6={'raw':!![],'where':{'id':_0x2e9b2d[_0x586f('0x43')]['id']}},_0x5729cb={};_0x5729cb[_0x586f('0x2c')]=_[_0x586f('0x2e')](db[_0x586f('0x3e')][_0x586f('0x2a')]);_0x5729cb[_0x586f('0x2d')]=_['keys'](_0x2e9b2d[_0x586f('0x2d')]);_0x5729cb[_0x586f('0x2f')]=_[_0x586f('0x30')](_0x5729cb[_0x586f('0x2c')],_0x5729cb['query']);_0x5ef3f6[_0x586f('0x32')]=_[_0x586f('0x30')](_0x5729cb['model'],qs[_0x586f('0x31')](_0x2e9b2d[_0x586f('0x2d')]['fields']));_0x5ef3f6[_0x586f('0x32')]=_0x5ef3f6[_0x586f('0x32')][_0x586f('0x33')]?_0x5ef3f6[_0x586f('0x32')]:_0x5729cb[_0x586f('0x2c')];if(_0x2e9b2d['query'][_0x586f('0x3f')]){_0x5ef3f6['include']=[{'all':!![]}];}_0x5ef3f6=_[_0x586f('0x3c')]({},_0x5ef3f6,_0x2e9b2d[_0x586f('0x3d')]);return db[_0x586f('0x3e')]['find'](_0x5ef3f6)[_0x586f('0x24')](handleEntityNotFound(_0x4ac7fc,null))[_0x586f('0x24')](respondWithResult(_0x4ac7fc,null))[_0x586f('0x44')](handleError(_0x4ac7fc,null));};exports[_0x586f('0x45')]=function(_0x487d20,_0x470e74){return db['FaxQueueReport'][_0x586f('0x45')](_0x487d20[_0x586f('0x46')],{})[_0x586f('0x24')](respondWithResult(_0x470e74,0xc9))[_0x586f('0x44')](handleError(_0x470e74,null));};exports['update']=function(_0x1207e9,_0x1da394){if(_0x1207e9[_0x586f('0x46')]['id']){delete _0x1207e9[_0x586f('0x46')]['id'];}return db[_0x586f('0x3e')][_0x586f('0x47')]({'where':{'id':_0x1207e9['params']['id']}})[_0x586f('0x24')](handleEntityNotFound(_0x1da394,null))['then'](saveUpdates(_0x1207e9[_0x586f('0x46')],null))[_0x586f('0x24')](respondWithResult(_0x1da394,null))[_0x586f('0x44')](handleError(_0x1da394,null));};exports[_0x586f('0x25')]=function(_0x2df877,_0xef5a6a){return db[_0x586f('0x3e')][_0x586f('0x47')]({'where':{'id':_0x2df877[_0x586f('0x43')]['id']}})[_0x586f('0x24')](handleEntityNotFound(_0xef5a6a,null))[_0x586f('0x24')](removeEntity(_0xef5a6a,null))[_0x586f('0x44')](handleError(_0xef5a6a,null));};exports['describe']=function(_0x2e5b00,_0x51d5df){return db['FaxQueueReport'][_0x586f('0x48')]()[_0x586f('0x24')](respondWithResult(_0x51d5df,null))['catch'](handleError(_0x51d5df,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 607a601..312c77f 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(_0x5e0cc8,_0x5dadaf){var _0xbed21=function(_0x3e86fc){while(--_0x3e86fc){_0x5e0cc8['push'](_0x5e0cc8['shift']());}};_0xbed21(++_0x5dadaf);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4d7116,_0xdb8175){_0x4d7116=_0x4d7116-0x0;var _0x4593dc=_0x5fc3[_0x4d7116];return _0x4593dc;};'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 _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x1ba6a2,_0x8297c9){var _0x34ab74=function(_0x5bfe3a){while(--_0x5bfe3a){_0x1ba6a2['push'](_0x1ba6a2['shift']());}};_0x34ab74(++_0x8297c9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc4aa[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index c93dc4d..1f1b983 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 _0xb846=['jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','create','body','options','then','UpdateFaxQueueReport','FaxQueueReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x502be5,_0x55e06b){var _0x820b75=function(_0x16f30a){while(--_0x16f30a){_0x502be5['push'](_0x502be5['shift']());}};_0x820b75(++_0x55e06b);}(_0xb846,0x9b));var _0x6b84=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb846[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x6b84('0x0'));var util=require(_0x6b84('0x1'));var moment=require(_0x6b84('0x2'));var BPromise=require(_0x6b84('0x3'));var rs=require(_0x6b84('0x4'));var fs=require('fs');var Redis=require(_0x6b84('0x5'));var db=require(_0x6b84('0x6'))['db'];var utils=require(_0x6b84('0x7'));var logger=require(_0x6b84('0x8'))(_0x6b84('0x9'));var config=require('../../config/environment');var jayson=require(_0x6b84('0xa'));var client=jayson[_0x6b84('0xb')][_0x6b84('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e00eb,_0x1fb579,_0x2f84a7){return new BPromise(function(_0x184881,_0x378243){return client[_0x6b84('0xd')](_0x4e00eb,_0x2f84a7)['then'](function(_0x4eff5d){logger[_0x6b84('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x1fb579,_0x6b84('0xf'));logger[_0x6b84('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1fb579,_0x6b84('0xf'),JSON[_0x6b84('0x11')](_0x4eff5d));if(_0x4eff5d[_0x6b84('0x12')]){if(_0x4eff5d[_0x6b84('0x12')][_0x6b84('0x13')]===0x1f4){logger[_0x6b84('0x12')](_0x6b84('0x14'),_0x1fb579,_0x4eff5d[_0x6b84('0x12')]['message']);return _0x378243(_0x4eff5d[_0x6b84('0x12')][_0x6b84('0x15')]);}logger['error'](_0x6b84('0x14'),_0x1fb579,_0x4eff5d['error']['message']);return _0x184881(_0x4eff5d[_0x6b84('0x12')]['message']);}else{logger[_0x6b84('0xe')](_0x6b84('0x14'),_0x1fb579,_0x6b84('0xf'));_0x184881(_0x4eff5d[_0x6b84('0x16')][_0x6b84('0x15')]);}})[_0x6b84('0x17')](function(_0x2b88c8){logger['error'](_0x6b84('0x14'),_0x1fb579,_0x2b88c8);_0x378243(_0x2b88c8);});});}exports[_0x6b84('0x18')]=function(_0x111f8f){var _0xb933f8=this;return new Promise(function(_0x42dc2c,_0x2cb5d6){return db['FaxQueueReport'][_0x6b84('0x19')](_0x111f8f[_0x6b84('0x1a')],{'raw':_0x111f8f['options']?_0x111f8f[_0x6b84('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x6b84('0x1c')](function(_0x498f44){logger[_0x6b84('0xe')](_0x6b84('0x18'),_0x111f8f);logger[_0x6b84('0x10')](_0x6b84('0x18'),_0x111f8f,JSON['stringify'](_0x498f44));_0x42dc2c(_0x498f44);})[_0x6b84('0x17')](function(_0x273a28){logger[_0x6b84('0x12')](_0x6b84('0x18'),_0x273a28['message'],_0x111f8f);_0x2cb5d6(_0xb933f8[_0x6b84('0x12')](0x1f4,_0x273a28['message']));});});};exports[_0x6b84('0x1d')]=function(_0x3959e9){var _0x19f34d=this;return new Promise(function(_0x4cafde,_0x359dd1){return db[_0x6b84('0x1e')]['update'](_0x3959e9[_0x6b84('0x1a')],{'raw':_0x3959e9[_0x6b84('0x1b')]?_0x3959e9[_0x6b84('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3959e9[_0x6b84('0x1b')]?_0x3959e9[_0x6b84('0x1b')]['where']||null:null,'attributes':_0x3959e9[_0x6b84('0x1b')]?_0x3959e9['options'][_0x6b84('0x1f')]||null:null,'limit':_0x3959e9[_0x6b84('0x1b')]?_0x3959e9[_0x6b84('0x1b')][_0x6b84('0x20')]||null:null})[_0x6b84('0x1c')](function(_0x1246bc){logger['info'](_0x6b84('0x1d'),_0x3959e9);logger[_0x6b84('0x10')]('UpdateFaxQueueReport',_0x3959e9,JSON[_0x6b84('0x11')](_0x1246bc));_0x4cafde(_0x1246bc);})[_0x6b84('0x17')](function(_0x30ac9a){logger['error']('UpdateFaxQueueReport',_0x30ac9a[_0x6b84('0x15')],_0x3959e9);_0x359dd1(_0x19f34d['error'](0x1f4,_0x30ac9a[_0x6b84('0x15')]));});});}; \ No newline at end of file +var _0x3d2c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','info','result','CreateFaxQueueReport','FaxQueueReport','create','options','raw','debug','UpdateFaxQueueReport','update','body','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3d2c,0xe1));var _0xc3d2=function(_0x4a1bfe,_0x26f551){_0x4a1bfe=_0x4a1bfe-0x0;var _0x421de9=_0x3d2c[_0x4a1bfe];return _0x421de9;};'use strict';var _=require(_0xc3d2('0x0'));var util=require(_0xc3d2('0x1'));var moment=require(_0xc3d2('0x2'));var BPromise=require(_0xc3d2('0x3'));var rs=require(_0xc3d2('0x4'));var fs=require('fs');var Redis=require(_0xc3d2('0x5'));var db=require(_0xc3d2('0x6'))['db'];var utils=require(_0xc3d2('0x7'));var logger=require(_0xc3d2('0x8'))(_0xc3d2('0x9'));var config=require(_0xc3d2('0xa'));var jayson=require(_0xc3d2('0xb'));var client=jayson[_0xc3d2('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21b206,_0x407a9d,_0x5a7b30){return new BPromise(function(_0x14a402,_0x1cc3cb){return client['request'](_0x21b206,_0x5a7b30)[_0xc3d2('0xd')](function(_0x55cc6f){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x407a9d,_0xc3d2('0xe'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x407a9d,_0xc3d2('0xe'),JSON[_0xc3d2('0xf')](_0x55cc6f));if(_0x55cc6f[_0xc3d2('0x10')]){if(_0x55cc6f[_0xc3d2('0x10')]['code']===0x1f4){logger[_0xc3d2('0x10')](_0xc3d2('0x11'),_0x407a9d,_0x55cc6f['error'][_0xc3d2('0x12')]);return _0x1cc3cb(_0x55cc6f[_0xc3d2('0x10')][_0xc3d2('0x12')]);}logger[_0xc3d2('0x10')](_0xc3d2('0x11'),_0x407a9d,_0x55cc6f[_0xc3d2('0x10')]['message']);return _0x14a402(_0x55cc6f[_0xc3d2('0x10')]['message']);}else{logger[_0xc3d2('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x407a9d,'request\x20sent');_0x14a402(_0x55cc6f[_0xc3d2('0x14')][_0xc3d2('0x12')]);}})['catch'](function(_0xc65611){logger[_0xc3d2('0x10')](_0xc3d2('0x11'),_0x407a9d,_0xc65611);_0x1cc3cb(_0xc65611);});});}exports[_0xc3d2('0x15')]=function(_0x41b39e){var _0x1f372f=this;return new Promise(function(_0xb10f2c,_0x21e64c){return db[_0xc3d2('0x16')][_0xc3d2('0x17')](_0x41b39e['body'],{'raw':_0x41b39e[_0xc3d2('0x18')]?_0x41b39e[_0xc3d2('0x18')][_0xc3d2('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2e1860){logger[_0xc3d2('0x13')](_0xc3d2('0x15'),_0x41b39e);logger[_0xc3d2('0x1a')](_0xc3d2('0x15'),_0x41b39e,JSON[_0xc3d2('0xf')](_0x2e1860));_0xb10f2c(_0x2e1860);})['catch'](function(_0x34a0d1){logger[_0xc3d2('0x10')](_0xc3d2('0x15'),_0x34a0d1[_0xc3d2('0x12')],_0x41b39e);_0x21e64c(_0x1f372f[_0xc3d2('0x10')](0x1f4,_0x34a0d1[_0xc3d2('0x12')]));});});};exports[_0xc3d2('0x1b')]=function(_0x4e8a74){var _0x2749e6=this;return new Promise(function(_0x3d9b60,_0x4b83ca){return db['FaxQueueReport'][_0xc3d2('0x1c')](_0x4e8a74[_0xc3d2('0x1d')],{'raw':_0x4e8a74[_0xc3d2('0x18')]?_0x4e8a74[_0xc3d2('0x18')][_0xc3d2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e8a74[_0xc3d2('0x18')]?_0x4e8a74[_0xc3d2('0x18')]['where']||null:null,'attributes':_0x4e8a74[_0xc3d2('0x18')]?_0x4e8a74[_0xc3d2('0x18')][_0xc3d2('0x1e')]||null:null,'limit':_0x4e8a74['options']?_0x4e8a74[_0xc3d2('0x18')][_0xc3d2('0x1f')]||null:null})[_0xc3d2('0xd')](function(_0x2e6ed2){logger[_0xc3d2('0x13')](_0xc3d2('0x1b'),_0x4e8a74);logger['debug'](_0xc3d2('0x1b'),_0x4e8a74,JSON['stringify'](_0x2e6ed2));_0x3d9b60(_0x2e6ed2);})[_0xc3d2('0x20')](function(_0x360c20){logger[_0xc3d2('0x10')](_0xc3d2('0x1b'),_0x360c20[_0xc3d2('0x12')],_0x4e8a74);_0x4b83ca(_0x2749e6['error'](0x1f4,_0x360c20['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 968fe6d..b34499b 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 _0x7ed0=['get','index','describe','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller'];(function(_0x16428e,_0x3444a3){var _0x5e6d00=function(_0x1718b2){while(--_0x1718b2){_0x16428e['push'](_0x16428e['shift']());}};_0x5e6d00(++_0x3444a3);}(_0x7ed0,0x15b));var _0x07ed=function(_0xd5ba21,_0x1c689a){_0xd5ba21=_0xd5ba21-0x0;var _0x515390=_0x7ed0[_0xd5ba21];return _0x515390;};'use strict';var multer=require(_0x07ed('0x0'));var util=require(_0x07ed('0x1'));var path=require('path');var timeout=require(_0x07ed('0x2'));var express=require(_0x07ed('0x3'));var router=express[_0x07ed('0x4')]();var fs_extra=require(_0x07ed('0x5'));var auth=require(_0x07ed('0x6'));var interaction=require(_0x07ed('0x7'));var config=require(_0x07ed('0x8'));var controller=require(_0x07ed('0x9'));router[_0x07ed('0xa')]('/',auth['isAuthenticated'](),controller[_0x07ed('0xb')]);router[_0x07ed('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x07ed('0xc')]);router[_0x07ed('0xa')](_0x07ed('0xd'),auth[_0x07ed('0xe')](),controller['show']);router[_0x07ed('0xf')]('/',auth[_0x07ed('0xe')](),controller[_0x07ed('0x10')]);router[_0x07ed('0x11')](_0x07ed('0xd'),auth[_0x07ed('0xe')](),controller[_0x07ed('0x12')]);router[_0x07ed('0x13')](_0x07ed('0xd'),auth['isAuthenticated'](),controller[_0x07ed('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf0c5=['exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete'];(function(_0x435dde,_0x2a2fa3){var _0x4aca2d=function(_0x283a96){while(--_0x283a96){_0x435dde['push'](_0x435dde['shift']());}};_0x4aca2d(++_0x2a2fa3);}(_0xf0c5,0x122));var _0x5f0c=function(_0x1a04a6,_0x1b9764){_0x1a04a6=_0x1a04a6-0x0;var _0xb3f005=_0xf0c5[_0x1a04a6];return _0xb3f005;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5f0c('0x0'));var timeout=require(_0x5f0c('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5f0c('0x2'));var auth=require(_0x5f0c('0x3'));var interaction=require(_0x5f0c('0x4'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x5f0c('0x5')]('/',auth[_0x5f0c('0x6')](),controller[_0x5f0c('0x7')]);router[_0x5f0c('0x5')](_0x5f0c('0x8'),auth[_0x5f0c('0x6')](),controller[_0x5f0c('0x9')]);router[_0x5f0c('0x5')](_0x5f0c('0xa'),auth[_0x5f0c('0x6')](),controller[_0x5f0c('0xb')]);router[_0x5f0c('0xc')]('/',auth[_0x5f0c('0x6')](),controller['create']);router[_0x5f0c('0xd')](_0x5f0c('0xa'),auth[_0x5f0c('0x6')](),controller[_0x5f0c('0xe')]);router[_0x5f0c('0xf')](_0x5f0c('0xa'),auth[_0x5f0c('0x6')](),controller['destroy']);module[_0x5f0c('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index f061e66..3ea2a7a 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x42dc58,_0x2f0925){_0x42dc58=_0x42dc58-0x0;var _0x44e792=_0xb43b[_0x42dc58];return _0x44e792;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xbd6e89,_0x4022a4){var _0x532660=function(_0x7049f8){while(--_0x7049f8){_0xbd6e89['push'](_0xbd6e89['shift']());}};_0x532660(++_0x4022a4);}(_0x70e0,0x17b));var _0x070e=function(_0x1e3649,_0x3aca86){_0x1e3649=_0x1e3649-0x0;var _0x13e496=_0x70e0[_0x1e3649];return _0x13e496;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 5b4511f..5d040ea 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 _0x085d=['index','FaxTransferReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','findAll','catch','params','keys','rawAttributes','includeAll','find','create','update','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send'];(function(_0x504d71,_0x3d3ccb){var _0x37040a=function(_0x3953e1){while(--_0x3953e1){_0x504d71['push'](_0x504d71['shift']());}};_0x37040a(++_0x3d3ccb);}(_0x085d,0x104));var _0xd085=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0x085d[_0x4b5813];return _0x423465;};'use strict';var emlformat=require(_0xd085('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd085('0x1'));var jsonpatch=require(_0xd085('0x2'));var rp=require('request-promise');var moment=require(_0xd085('0x3'));var BPromise=require(_0xd085('0x4'));var Mustache=require(_0xd085('0x5'));var util=require(_0xd085('0x6'));var path=require(_0xd085('0x7'));var sox=require(_0xd085('0x8'));var csv=require(_0xd085('0x9'));var ejs=require(_0xd085('0xa'));var fs=require('fs');var fs_extra=require(_0xd085('0xb'));var _=require(_0xd085('0xc'));var squel=require('squel');var crypto=require(_0xd085('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd085('0xe'));var toCsv=require(_0xd085('0x9'));var querystring=require(_0xd085('0xf'));var Papa=require(_0xd085('0x10'));var Redis=require(_0xd085('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd085('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd085('0x13'));var logger=require(_0xd085('0x14'))('api');var utils=require(_0xd085('0x15'));var config=require(_0xd085('0x16'));var licenseUtil=require(_0xd085('0x17'));var db=require(_0xd085('0x18'))['db'];function respondWithStatusCode(_0x20fb23,_0x5e37ca){_0x5e37ca=_0x5e37ca||0xcc;return function(_0x582e7b){if(_0x582e7b){return _0x20fb23['sendStatus'](_0x5e37ca);}return _0x20fb23[_0xd085('0x19')](_0x5e37ca)[_0xd085('0x1a')]();};}function respondWithResult(_0x2a00fc,_0x6f4146){_0x6f4146=_0x6f4146||0xc8;return function(_0x533893){if(_0x533893){return _0x2a00fc[_0xd085('0x19')](_0x6f4146)[_0xd085('0x1b')](_0x533893);}};}function respondWithFilteredResult(_0x3aefbb,_0x2b0b1a){return function(_0x4372ba){if(_0x4372ba){var _0x1a3f54=typeof _0x2b0b1a[_0xd085('0x1c')]===_0xd085('0x1d')&&typeof _0x2b0b1a[_0xd085('0x1e')]===_0xd085('0x1d');var _0x597f3e=_0x4372ba[_0xd085('0x1f')];var _0x494a4a=_0x1a3f54?0x0:_0x2b0b1a[_0xd085('0x1c')];var _0x1aa14f=_0x1a3f54?_0x4372ba['count']:_0x2b0b1a['offset']+_0x2b0b1a['limit'];var _0x497dc1;if(_0x1aa14f>=_0x597f3e){_0x1aa14f=_0x597f3e;_0x497dc1=0xc8;}else{_0x497dc1=0xce;}_0x3aefbb[_0xd085('0x19')](_0x497dc1);return _0x3aefbb[_0xd085('0x20')](_0xd085('0x21'),_0x494a4a+'-'+_0x1aa14f+'/'+_0x597f3e)['json'](_0x4372ba);}return null;};}function patchUpdates(_0x12d1ae){return function(_0x5bcb63){try{jsonpatch[_0xd085('0x22')](_0x5bcb63,_0x12d1ae,!![]);}catch(_0x453039){return BPromise[_0xd085('0x23')](_0x453039);}return _0x5bcb63[_0xd085('0x24')]();};}function saveUpdates(_0x5a66ed,_0x2b6632){return function(_0x3c4032){if(_0x3c4032){return _0x3c4032['update'](_0x5a66ed)['then'](function(_0x157923){return _0x157923;});}return null;};}function removeEntity(_0x5d5129,_0x567efd){return function(_0x58a45f){if(_0x58a45f){return _0x58a45f[_0xd085('0x25')]()[_0xd085('0x26')](function(){_0x5d5129[_0xd085('0x19')](0xcc)[_0xd085('0x1a')]();});}};}function handleEntityNotFound(_0x3d3659,_0x305081){return function(_0x59a15d){if(!_0x59a15d){_0x3d3659[_0xd085('0x27')](0x194);}return _0x59a15d;};}function handleError(_0x3ca218,_0xb1f08c){_0xb1f08c=_0xb1f08c||0x1f4;return function(_0x27cea2){logger[_0xd085('0x28')](_0x27cea2[_0xd085('0x29')]);if(_0x27cea2[_0xd085('0x2a')]){delete _0x27cea2['name'];}_0x3ca218['status'](_0xb1f08c)[_0xd085('0x2b')](_0x27cea2);};}exports[_0xd085('0x2c')]=function(_0x531d72,_0x53a215){var _0x4bed67={},_0x8d046={},_0x42de2f={'count':0x0,'rows':[]};var _0x29856e=_['map'](db[_0xd085('0x2d')]['rawAttributes'],function(_0x463274){return{'name':_0x463274[_0xd085('0x2e')],'type':_0x463274[_0xd085('0x2f')]['key']};});_0x8d046[_0xd085('0x30')]=_[_0xd085('0x31')](_0x29856e,_0xd085('0x2a'));_0x8d046[_0xd085('0x32')]=_['keys'](_0x531d72['query']);_0x8d046[_0xd085('0x33')]=_[_0xd085('0x34')](_0x8d046[_0xd085('0x30')],_0x8d046[_0xd085('0x32')]);_0x4bed67[_0xd085('0x35')]=_[_0xd085('0x34')](_0x8d046[_0xd085('0x30')],qs[_0xd085('0x36')](_0x531d72[_0xd085('0x32')][_0xd085('0x36')]));_0x4bed67[_0xd085('0x35')]=_0x4bed67[_0xd085('0x35')][_0xd085('0x37')]?_0x4bed67['attributes']:_0x8d046['model'];if(!_0x531d72[_0xd085('0x32')][_0xd085('0x38')](_0xd085('0x39'))){_0x4bed67[_0xd085('0x1e')]=qs[_0xd085('0x1e')](_0x531d72[_0xd085('0x32')][_0xd085('0x1e')]);_0x4bed67[_0xd085('0x1c')]=qs['offset'](_0x531d72[_0xd085('0x32')]['offset']);}_0x4bed67[_0xd085('0x3a')]=qs[_0xd085('0x3b')](_0x531d72['query'][_0xd085('0x3b')]);_0x4bed67['where']=qs[_0xd085('0x33')](_['pick'](_0x531d72['query'],_0x8d046[_0xd085('0x33')]),_0x29856e);if(_0x531d72[_0xd085('0x32')][_0xd085('0x3c')]){_0x4bed67[_0xd085('0x3d')]=_['merge'](_0x4bed67[_0xd085('0x3d')],{'$or':_[_0xd085('0x31')](_0x29856e,function(_0x1bc92a){if(_0x1bc92a[_0xd085('0x2f')]!==_0xd085('0x3e')){var _0x47968b={};_0x47968b[_0x1bc92a[_0xd085('0x2a')]]={'$like':'%'+_0x531d72[_0xd085('0x32')][_0xd085('0x3c')]+'%'};return _0x47968b;}})});}_0x4bed67=_[_0xd085('0x3f')]({},_0x4bed67,_0x531d72[_0xd085('0x40')]);var _0x499a00={'where':_0x4bed67[_0xd085('0x3d')]};return db[_0xd085('0x2d')]['count'](_0x499a00)['then'](function(_0x5aa9b7){_0x42de2f['count']=_0x5aa9b7;if(_0x531d72[_0xd085('0x32')]['includeAll']){_0x4bed67['include']=[{'all':!![]}];}return db[_0xd085('0x2d')][_0xd085('0x41')](_0x4bed67);})['then'](function(_0x13ceab){_0x42de2f['rows']=_0x13ceab;return _0x42de2f;})['then'](respondWithFilteredResult(_0x53a215,_0x4bed67))[_0xd085('0x42')](handleError(_0x53a215,null));};exports['show']=function(_0x12bb90,_0x3d205c){var _0x34882b={'raw':!![],'where':{'id':_0x12bb90[_0xd085('0x43')]['id']}},_0x27d14d={};_0x27d14d[_0xd085('0x30')]=_[_0xd085('0x44')](db[_0xd085('0x2d')][_0xd085('0x45')]);_0x27d14d[_0xd085('0x32')]=_[_0xd085('0x44')](_0x12bb90[_0xd085('0x32')]);_0x27d14d[_0xd085('0x33')]=_[_0xd085('0x34')](_0x27d14d[_0xd085('0x30')],_0x27d14d[_0xd085('0x32')]);_0x34882b['attributes']=_[_0xd085('0x34')](_0x27d14d[_0xd085('0x30')],qs['fields'](_0x12bb90[_0xd085('0x32')][_0xd085('0x36')]));_0x34882b[_0xd085('0x35')]=_0x34882b[_0xd085('0x35')][_0xd085('0x37')]?_0x34882b[_0xd085('0x35')]:_0x27d14d[_0xd085('0x30')];if(_0x12bb90[_0xd085('0x32')][_0xd085('0x46')]){_0x34882b['include']=[{'all':!![]}];}_0x34882b=_['merge']({},_0x34882b,_0x12bb90[_0xd085('0x40')]);return db[_0xd085('0x2d')][_0xd085('0x47')](_0x34882b)[_0xd085('0x26')](handleEntityNotFound(_0x3d205c,null))['then'](respondWithResult(_0x3d205c,null))['catch'](handleError(_0x3d205c,null));};exports[_0xd085('0x48')]=function(_0x36a9a2,_0xe52809){return db[_0xd085('0x2d')]['create'](_0x36a9a2['body'],{})[_0xd085('0x26')](respondWithResult(_0xe52809,0xc9))[_0xd085('0x42')](handleError(_0xe52809,null));};exports[_0xd085('0x49')]=function(_0x707ac9,_0xfc4960){if(_0x707ac9['body']['id']){delete _0x707ac9[_0xd085('0x4a')]['id'];}return db[_0xd085('0x2d')][_0xd085('0x47')]({'where':{'id':_0x707ac9['params']['id']}})[_0xd085('0x26')](handleEntityNotFound(_0xfc4960,null))[_0xd085('0x26')](saveUpdates(_0x707ac9[_0xd085('0x4a')],null))[_0xd085('0x26')](respondWithResult(_0xfc4960,null))['catch'](handleError(_0xfc4960,null));};exports[_0xd085('0x25')]=function(_0x138dac,_0x2d9891){return db[_0xd085('0x2d')][_0xd085('0x47')]({'where':{'id':_0x138dac[_0xd085('0x43')]['id']}})[_0xd085('0x26')](handleEntityNotFound(_0x2d9891,null))[_0xd085('0x26')](removeEntity(_0x2d9891,null))[_0xd085('0x42')](handleError(_0x2d9891,null));};exports[_0xd085('0x4b')]=function(_0x484b6e,_0x3f808a){return db['FaxTransferReport'][_0xd085('0x4b')]()[_0xd085('0x26')](respondWithResult(_0x3f808a,null))[_0xd085('0x42')](handleError(_0x3f808a,null));}; \ No newline at end of file +var _0xb4ae=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','describe','zip-dir','fast-json-patch','moment'];(function(_0x2d450a,_0x774e2e){var _0x3009d8=function(_0x1096e1){while(--_0x1096e1){_0x2d450a['push'](_0x2d450a['shift']());}};_0x3009d8(++_0x774e2e);}(_0xb4ae,0x12d));var _0xeb4a=function(_0x35d535,_0x264ecf){_0x35d535=_0x35d535-0x0;var _0x6731aa=_0xb4ae[_0x35d535];return _0x6731aa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xeb4a('0x0'));var jsonpatch=require(_0xeb4a('0x1'));var rp=require('request-promise');var moment=require(_0xeb4a('0x2'));var BPromise=require(_0xeb4a('0x3'));var Mustache=require(_0xeb4a('0x4'));var util=require(_0xeb4a('0x5'));var path=require(_0xeb4a('0x6'));var sox=require(_0xeb4a('0x7'));var csv=require(_0xeb4a('0x8'));var ejs=require(_0xeb4a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb4a('0xa'));var squel=require(_0xeb4a('0xb'));var crypto=require(_0xeb4a('0xc'));var jsforce=require(_0xeb4a('0xd'));var deskjs=require(_0xeb4a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xeb4a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xeb4a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xeb4a('0x11'));var hardwareService=require(_0xeb4a('0x12'));var logger=require(_0xeb4a('0x13'))(_0xeb4a('0x14'));var utils=require(_0xeb4a('0x15'));var config=require(_0xeb4a('0x16'));var licenseUtil=require(_0xeb4a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dfef8,_0x3cadd1){_0x3cadd1=_0x3cadd1||0xcc;return function(_0x26b7b7){if(_0x26b7b7){return _0x1dfef8[_0xeb4a('0x18')](_0x3cadd1);}return _0x1dfef8[_0xeb4a('0x19')](_0x3cadd1)[_0xeb4a('0x1a')]();};}function respondWithResult(_0x34cfe1,_0x428432){_0x428432=_0x428432||0xc8;return function(_0x2e0792){if(_0x2e0792){return _0x34cfe1[_0xeb4a('0x19')](_0x428432)[_0xeb4a('0x1b')](_0x2e0792);}};}function respondWithFilteredResult(_0x8b9ede,_0x15902d){return function(_0x9571cf){if(_0x9571cf){var _0xcc14a0=typeof _0x15902d[_0xeb4a('0x1c')]==='undefined'&&typeof _0x15902d[_0xeb4a('0x1d')]===_0xeb4a('0x1e');var _0x2fe5d5=_0x9571cf['count'];var _0x3cdcb9=_0xcc14a0?0x0:_0x15902d['offset'];var _0x3b3a7b=_0xcc14a0?_0x9571cf['count']:_0x15902d[_0xeb4a('0x1c')]+_0x15902d['limit'];var _0x48cc81;if(_0x3b3a7b>=_0x2fe5d5){_0x3b3a7b=_0x2fe5d5;_0x48cc81=0xc8;}else{_0x48cc81=0xce;}_0x8b9ede[_0xeb4a('0x19')](_0x48cc81);return _0x8b9ede[_0xeb4a('0x1f')]('Content-Range',_0x3cdcb9+'-'+_0x3b3a7b+'/'+_0x2fe5d5)['json'](_0x9571cf);}return null;};}function patchUpdates(_0x136cfe){return function(_0x24e114){try{jsonpatch[_0xeb4a('0x20')](_0x24e114,_0x136cfe,!![]);}catch(_0x5dcf96){return BPromise[_0xeb4a('0x21')](_0x5dcf96);}return _0x24e114['save']();};}function saveUpdates(_0x4effdb,_0x6118ce){return function(_0x5319cf){if(_0x5319cf){return _0x5319cf[_0xeb4a('0x22')](_0x4effdb)[_0xeb4a('0x23')](function(_0x2f0224){return _0x2f0224;});}return null;};}function removeEntity(_0x31ee43,_0x1ecc12){return function(_0x4f00aa){if(_0x4f00aa){return _0x4f00aa[_0xeb4a('0x24')]()[_0xeb4a('0x23')](function(){_0x31ee43[_0xeb4a('0x19')](0xcc)[_0xeb4a('0x1a')]();});}};}function handleEntityNotFound(_0x2ec188,_0x2d8734){return function(_0x551bee){if(!_0x551bee){_0x2ec188[_0xeb4a('0x18')](0x194);}return _0x551bee;};}function handleError(_0x1ffbd0,_0x3ed57c){_0x3ed57c=_0x3ed57c||0x1f4;return function(_0x12955d){logger[_0xeb4a('0x25')](_0x12955d[_0xeb4a('0x26')]);if(_0x12955d[_0xeb4a('0x27')]){delete _0x12955d[_0xeb4a('0x27')];}_0x1ffbd0['status'](_0x3ed57c)[_0xeb4a('0x28')](_0x12955d);};}exports[_0xeb4a('0x29')]=function(_0x3fab88,_0x3d9fb2){var _0x275fa2={},_0x4c33a4={},_0x482049={'count':0x0,'rows':[]};var _0x39f798=_[_0xeb4a('0x2a')](db[_0xeb4a('0x2b')][_0xeb4a('0x2c')],function(_0x7188fd){return{'name':_0x7188fd[_0xeb4a('0x2d')],'type':_0x7188fd['type'][_0xeb4a('0x2e')]};});_0x4c33a4[_0xeb4a('0x2f')]=_[_0xeb4a('0x2a')](_0x39f798,_0xeb4a('0x27'));_0x4c33a4[_0xeb4a('0x30')]=_['keys'](_0x3fab88['query']);_0x4c33a4[_0xeb4a('0x31')]=_[_0xeb4a('0x32')](_0x4c33a4['model'],_0x4c33a4[_0xeb4a('0x30')]);_0x275fa2['attributes']=_[_0xeb4a('0x32')](_0x4c33a4[_0xeb4a('0x2f')],qs[_0xeb4a('0x33')](_0x3fab88[_0xeb4a('0x30')]['fields']));_0x275fa2[_0xeb4a('0x34')]=_0x275fa2[_0xeb4a('0x34')][_0xeb4a('0x35')]?_0x275fa2[_0xeb4a('0x34')]:_0x4c33a4['model'];if(!_0x3fab88['query']['hasOwnProperty'](_0xeb4a('0x36'))){_0x275fa2[_0xeb4a('0x1d')]=qs[_0xeb4a('0x1d')](_0x3fab88[_0xeb4a('0x30')][_0xeb4a('0x1d')]);_0x275fa2['offset']=qs['offset'](_0x3fab88['query'][_0xeb4a('0x1c')]);}_0x275fa2[_0xeb4a('0x37')]=qs[_0xeb4a('0x38')](_0x3fab88[_0xeb4a('0x30')][_0xeb4a('0x38')]);_0x275fa2[_0xeb4a('0x39')]=qs[_0xeb4a('0x31')](_['pick'](_0x3fab88[_0xeb4a('0x30')],_0x4c33a4[_0xeb4a('0x31')]),_0x39f798);if(_0x3fab88[_0xeb4a('0x30')][_0xeb4a('0x3a')]){_0x275fa2[_0xeb4a('0x39')]=_['merge'](_0x275fa2[_0xeb4a('0x39')],{'$or':_[_0xeb4a('0x2a')](_0x39f798,function(_0x18f50b){if(_0x18f50b[_0xeb4a('0x3b')]!==_0xeb4a('0x3c')){var _0x1cfeb7={};_0x1cfeb7[_0x18f50b['name']]={'$like':'%'+_0x3fab88['query'][_0xeb4a('0x3a')]+'%'};return _0x1cfeb7;}})});}_0x275fa2=_[_0xeb4a('0x3d')]({},_0x275fa2,_0x3fab88[_0xeb4a('0x3e')]);var _0x1d5847={'where':_0x275fa2[_0xeb4a('0x39')]};return db[_0xeb4a('0x2b')][_0xeb4a('0x3f')](_0x1d5847)['then'](function(_0x295e8b){_0x482049[_0xeb4a('0x3f')]=_0x295e8b;if(_0x3fab88[_0xeb4a('0x30')][_0xeb4a('0x40')]){_0x275fa2[_0xeb4a('0x41')]=[{'all':!![]}];}return db[_0xeb4a('0x2b')][_0xeb4a('0x42')](_0x275fa2);})[_0xeb4a('0x23')](function(_0x20897e){_0x482049[_0xeb4a('0x43')]=_0x20897e;return _0x482049;})[_0xeb4a('0x23')](respondWithFilteredResult(_0x3d9fb2,_0x275fa2))[_0xeb4a('0x44')](handleError(_0x3d9fb2,null));};exports[_0xeb4a('0x45')]=function(_0x590eb3,_0x428aa1){var _0x5ccf74={'raw':!![],'where':{'id':_0x590eb3['params']['id']}},_0x19f4a3={};_0x19f4a3[_0xeb4a('0x2f')]=_[_0xeb4a('0x46')](db[_0xeb4a('0x2b')][_0xeb4a('0x2c')]);_0x19f4a3['query']=_['keys'](_0x590eb3[_0xeb4a('0x30')]);_0x19f4a3[_0xeb4a('0x31')]=_[_0xeb4a('0x32')](_0x19f4a3[_0xeb4a('0x2f')],_0x19f4a3[_0xeb4a('0x30')]);_0x5ccf74['attributes']=_[_0xeb4a('0x32')](_0x19f4a3['model'],qs['fields'](_0x590eb3[_0xeb4a('0x30')]['fields']));_0x5ccf74['attributes']=_0x5ccf74['attributes'][_0xeb4a('0x35')]?_0x5ccf74[_0xeb4a('0x34')]:_0x19f4a3['model'];if(_0x590eb3[_0xeb4a('0x30')][_0xeb4a('0x40')]){_0x5ccf74[_0xeb4a('0x41')]=[{'all':!![]}];}_0x5ccf74=_[_0xeb4a('0x3d')]({},_0x5ccf74,_0x590eb3[_0xeb4a('0x3e')]);return db[_0xeb4a('0x2b')][_0xeb4a('0x47')](_0x5ccf74)[_0xeb4a('0x23')](handleEntityNotFound(_0x428aa1,null))[_0xeb4a('0x23')](respondWithResult(_0x428aa1,null))[_0xeb4a('0x44')](handleError(_0x428aa1,null));};exports[_0xeb4a('0x48')]=function(_0x54c870,_0x57a1af){return db[_0xeb4a('0x2b')]['create'](_0x54c870[_0xeb4a('0x49')],{})[_0xeb4a('0x23')](respondWithResult(_0x57a1af,0xc9))[_0xeb4a('0x44')](handleError(_0x57a1af,null));};exports[_0xeb4a('0x22')]=function(_0x524fe9,_0x2d5833){if(_0x524fe9['body']['id']){delete _0x524fe9[_0xeb4a('0x49')]['id'];}return db['FaxTransferReport'][_0xeb4a('0x47')]({'where':{'id':_0x524fe9['params']['id']}})['then'](handleEntityNotFound(_0x2d5833,null))['then'](saveUpdates(_0x524fe9[_0xeb4a('0x49')],null))['then'](respondWithResult(_0x2d5833,null))[_0xeb4a('0x44')](handleError(_0x2d5833,null));};exports[_0xeb4a('0x24')]=function(_0x3998ed,_0x152d4b){return db[_0xeb4a('0x2b')][_0xeb4a('0x47')]({'where':{'id':_0x3998ed[_0xeb4a('0x4a')]['id']}})[_0xeb4a('0x23')](handleEntityNotFound(_0x152d4b,null))[_0xeb4a('0x23')](removeEntity(_0x152d4b,null))[_0xeb4a('0x44')](handleError(_0x152d4b,null));};exports[_0xeb4a('0x4b')]=function(_0x256c9f,_0x1b0f00){return db[_0xeb4a('0x2b')][_0xeb4a('0x4b')]()['then'](respondWithResult(_0x1b0f00,null))['catch'](handleError(_0x1b0f00,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 154cf5e..49df4c8 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 _0x228f=['request-promise','path','rimraf','../../config/environment','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3238ea,_0x91809d){var _0x4aaac2=function(_0xc5b102){while(--_0xc5b102){_0x3238ea['push'](_0x3238ea['shift']());}};_0x4aaac2(++_0x91809d);}(_0x228f,0xf6));var _0xf228=function(_0x632cec,_0x54bca1){_0x632cec=_0x632cec-0x0;var _0x4a9ee7=_0x228f[_0x632cec];return _0x4a9ee7;};'use strict';var _=require(_0xf228('0x0'));var util=require(_0xf228('0x1'));var logger=require(_0xf228('0x2'))(_0xf228('0x3'));var moment=require(_0xf228('0x4'));var BPromise=require(_0xf228('0x5'));var rp=require(_0xf228('0x6'));var fs=require('fs');var path=require(_0xf228('0x7'));var rimraf=require(_0xf228('0x8'));var config=require(_0xf228('0x9'));var attributes=require('./faxTransferReport.attributes');module[_0xf228('0xa')]=function(_0x4cf596,_0x2a7dce){return _0x4cf596[_0xf228('0xb')]('FaxTransferReport',attributes,{'tableName':_0xf228('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf228('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6458=['exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6458,0x124));var _0x8645=function(_0x4adfa4,_0x121c5a){_0x4adfa4=_0x4adfa4-0x0;var _0x14cec1=_0x6458[_0x4adfa4];return _0x14cec1;};'use strict';var _=require(_0x8645('0x0'));var util=require('util');var logger=require(_0x8645('0x1'))(_0x8645('0x2'));var moment=require(_0x8645('0x3'));var BPromise=require(_0x8645('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8645('0x5'));var config=require(_0x8645('0x6'));var attributes=require(_0x8645('0x7'));module[_0x8645('0x8')]=function(_0x3c8aab,_0x1232fc){return _0x3c8aab['define'](_0x8645('0x9'),attributes,{'tableName':_0x8645('0xa'),'paranoid':![],'indexes':[{'name':_0x8645('0xb'),'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 473f6ef..57eb98d 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 _0x1442=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash'];(function(_0xe8632f,_0x48f88b){var _0x37b1ad=function(_0x514b0d){while(--_0x514b0d){_0xe8632f['push'](_0xe8632f['shift']());}};_0x37b1ad(++_0x48f88b);}(_0x1442,0x19d));var _0x2144=function(_0x27031d,_0x339d04){_0x27031d=_0x27031d-0x0;var _0x2f5db2=_0x1442[_0x27031d];return _0x2f5db2;};'use strict';var _=require(_0x2144('0x0'));var util=require(_0x2144('0x1'));var moment=require(_0x2144('0x2'));var BPromise=require(_0x2144('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2144('0x4'));var db=require(_0x2144('0x5'))['db'];var utils=require(_0x2144('0x6'));var logger=require(_0x2144('0x7'))('rpc');var config=require(_0x2144('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2144('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1697d3,_0x56dc10,_0x5bbcfa){return new BPromise(function(_0x545acc,_0x229321){return client['request'](_0x1697d3,_0x5bbcfa)[_0x2144('0xa')](function(_0x56ff97){logger[_0x2144('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x56dc10,_0x2144('0xc'));logger[_0x2144('0xd')](_0x2144('0xe'),_0x56dc10,_0x2144('0xc'),JSON['stringify'](_0x56ff97));if(_0x56ff97[_0x2144('0xf')]){if(_0x56ff97['error']['code']===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x56dc10,_0x56ff97['error']['message']);return _0x229321(_0x56ff97[_0x2144('0xf')][_0x2144('0x10')]);}logger[_0x2144('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x56dc10,_0x56ff97[_0x2144('0xf')]['message']);return _0x545acc(_0x56ff97[_0x2144('0xf')][_0x2144('0x10')]);}else{logger[_0x2144('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x56dc10,_0x2144('0xc'));_0x545acc(_0x56ff97[_0x2144('0x11')][_0x2144('0x10')]);}})['catch'](function(_0x394ddf){logger[_0x2144('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x56dc10,_0x394ddf);_0x229321(_0x394ddf);});});} \ No newline at end of file +var _0x4371=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4371,0x7f));var _0x1437=function(_0x46fec8,_0x4ce832){_0x46fec8=_0x46fec8-0x0;var _0x361a0e=_0x4371[_0x46fec8];return _0x361a0e;};'use strict';var _=require(_0x1437('0x0'));var util=require(_0x1437('0x1'));var moment=require(_0x1437('0x2'));var BPromise=require(_0x1437('0x3'));var rs=require(_0x1437('0x4'));var fs=require('fs');var Redis=require(_0x1437('0x5'));var db=require(_0x1437('0x6'))['db'];var utils=require(_0x1437('0x7'));var logger=require(_0x1437('0x8'))(_0x1437('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1437('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e4e76,_0x856b8c,_0x103248){return new BPromise(function(_0x5b0e5e,_0x5ec1cb){return client[_0x1437('0xb')](_0x2e4e76,_0x103248)[_0x1437('0xc')](function(_0xcb5e5a){logger['info'](_0x1437('0xd'),_0x856b8c,_0x1437('0xe'));logger['debug'](_0x1437('0xf'),_0x856b8c,_0x1437('0xe'),JSON[_0x1437('0x10')](_0xcb5e5a));if(_0xcb5e5a[_0x1437('0x11')]){if(_0xcb5e5a['error']['code']===0x1f4){logger[_0x1437('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x856b8c,_0xcb5e5a[_0x1437('0x11')]['message']);return _0x5ec1cb(_0xcb5e5a[_0x1437('0x11')][_0x1437('0x12')]);}logger['error'](_0x1437('0xd'),_0x856b8c,_0xcb5e5a['error'][_0x1437('0x12')]);return _0x5b0e5e(_0xcb5e5a[_0x1437('0x11')][_0x1437('0x12')]);}else{logger[_0x1437('0x13')](_0x1437('0xd'),_0x856b8c,'request\x20sent');_0x5b0e5e(_0xcb5e5a[_0x1437('0x14')]['message']);}})['catch'](function(_0x3ef55d){logger[_0x1437('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x856b8c,_0x3ef55d);_0x5ec1cb(_0x3ef55d);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 127dfbd..df60091 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 _0x70fb=['../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0x70fb,0xf1));var _0xb70f=function(_0x2c5d4d,_0x1d4d5e){_0x2c5d4d=_0x2c5d4d-0x0;var _0x14dfe0=_0x70fb[_0x2c5d4d];return _0x14dfe0;};'use strict';var multer=require('multer');var util=require(_0xb70f('0x0'));var path=require(_0xb70f('0x1'));var timeout=require(_0xb70f('0x2'));var express=require(_0xb70f('0x3'));var router=express[_0xb70f('0x4')]();var fs_extra=require(_0xb70f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb70f('0x6'));var config=require(_0xb70f('0x7'));var controller=require(_0xb70f('0x8'));router['get']('/',auth[_0xb70f('0x9')](),controller[_0xb70f('0xa')]);router[_0xb70f('0xb')](_0xb70f('0xc'),auth[_0xb70f('0x9')](),controller['describe']);router[_0xb70f('0xb')]('/:id',auth[_0xb70f('0x9')](),controller['show']);router[_0xb70f('0xd')]('/',auth[_0xb70f('0x9')](),controller[_0xb70f('0xe')]);router['put']('/:id',auth[_0xb70f('0x9')](),controller[_0xb70f('0xf')]);router[_0xb70f('0x10')]('/:id',auth[_0xb70f('0x9')](),controller[_0xb70f('0x11')]);module[_0xb70f('0x12')]=router; \ No newline at end of file +var _0xa82d=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','delete','exports'];(function(_0x331b18,_0x1610c2){var _0x49e729=function(_0x5a53b5){while(--_0x5a53b5){_0x331b18['push'](_0x331b18['shift']());}};_0x49e729(++_0x1610c2);}(_0xa82d,0x98));var _0xda82=function(_0x1411d8,_0x5d8a99){_0x1411d8=_0x1411d8-0x0;var _0x2572c7=_0xa82d[_0x1411d8];return _0x2572c7;};'use strict';var multer=require(_0xda82('0x0'));var util=require(_0xda82('0x1'));var path=require(_0xda82('0x2'));var timeout=require(_0xda82('0x3'));var express=require('express');var router=express[_0xda82('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xda82('0x5'));var interaction=require(_0xda82('0x6'));var config=require(_0xda82('0x7'));var controller=require(_0xda82('0x8'));router[_0xda82('0x9')]('/',auth['isAuthenticated'](),controller[_0xda82('0xa')]);router[_0xda82('0x9')](_0xda82('0xb'),auth[_0xda82('0xc')](),controller[_0xda82('0xd')]);router['get'](_0xda82('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xda82('0xf')]('/',auth['isAuthenticated'](),controller[_0xda82('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xda82('0x11')](_0xda82('0xe'),auth[_0xda82('0xc')](),controller['destroy']);module[_0xda82('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 7424f32..ddde3f7 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 _0x4c7c=['isAuthenticated','show','/:id/configurations','getConfigurations','post','create','put','update','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id'];(function(_0x24243b,_0x55c567){var _0x1a85ce=function(_0x28c017){while(--_0x28c017){_0x24243b['push'](_0x24243b['shift']());}};_0x1a85ce(++_0x55c567);}(_0x4c7c,0x139));var _0xc4c7=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0x4c7c[_0x590851];return _0x3b0115;};'use strict';var multer=require('multer');var util=require(_0xc4c7('0x0'));var path=require(_0xc4c7('0x1'));var timeout=require('connect-timeout');var express=require(_0xc4c7('0x2'));var router=express[_0xc4c7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc4c7('0x4'));var interaction=require(_0xc4c7('0x5'));var config=require(_0xc4c7('0x6'));var controller=require('./intDeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc4c7('0x7')]);router[_0xc4c7('0x8')](_0xc4c7('0x9'),auth[_0xc4c7('0xa')](),controller[_0xc4c7('0xb')]);router[_0xc4c7('0x8')](_0xc4c7('0xc'),auth[_0xc4c7('0xa')](),controller[_0xc4c7('0xd')]);router[_0xc4c7('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xc4c7('0xe')]('/',auth[_0xc4c7('0xa')](),controller[_0xc4c7('0xf')]);router[_0xc4c7('0xe')](_0xc4c7('0xc'),auth[_0xc4c7('0xa')](),controller['addConfiguration']);router[_0xc4c7('0x10')](_0xc4c7('0x9'),auth['isAuthenticated'](),controller[_0xc4c7('0x11')]);router['delete'](_0xc4c7('0x9'),auth[_0xc4c7('0xa')](),controller[_0xc4c7('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc638=['post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x3ec122,_0x55150a){var _0x4ecf41=function(_0x1709cd){while(--_0x1709cd){_0x3ec122['push'](_0x3ec122['shift']());}};_0x4ecf41(++_0x55150a);}(_0xc638,0x178));var _0x8c63=function(_0x4ec920,_0x4b9ef0){_0x4ec920=_0x4ec920-0x0;var _0x518cf3=_0xc638[_0x4ec920];return _0x518cf3;};'use strict';var multer=require(_0x8c63('0x0'));var util=require('util');var path=require(_0x8c63('0x1'));var timeout=require(_0x8c63('0x2'));var express=require(_0x8c63('0x3'));var router=express[_0x8c63('0x4')]();var fs_extra=require(_0x8c63('0x5'));var auth=require(_0x8c63('0x6'));var interaction=require(_0x8c63('0x7'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x8c63('0x8')]('/',auth[_0x8c63('0x9')](),controller[_0x8c63('0xa')]);router[_0x8c63('0x8')](_0x8c63('0xb'),auth[_0x8c63('0x9')](),controller[_0x8c63('0xc')]);router[_0x8c63('0x8')](_0x8c63('0xd'),auth[_0x8c63('0x9')](),controller[_0x8c63('0xe')]);router[_0x8c63('0x8')]('/:id/fields',auth[_0x8c63('0x9')](),controller['getFields']);router[_0x8c63('0xf')]('/',auth[_0x8c63('0x9')](),controller[_0x8c63('0x10')]);router[_0x8c63('0xf')]('/:id/configurations',auth[_0x8c63('0x9')](),controller[_0x8c63('0x11')]);router[_0x8c63('0x12')](_0x8c63('0xb'),auth['isAuthenticated'](),controller[_0x8c63('0x13')]);router[_0x8c63('0x14')](_0x8c63('0xb'),auth[_0x8c63('0x9')](),controller[_0x8c63('0x15')]);module[_0x8c63('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index ecb318c..3d98c8d 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 _0xd053=['exports','STRING','ENUM','basic','integrationTab'];(function(_0x53efa4,_0x1e673b){var _0x276274=function(_0x5a0479){while(--_0x5a0479){_0x53efa4['push'](_0x53efa4['shift']());}};_0x276274(++_0x1e673b);}(_0xd053,0x10e));var _0x3d05=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0xd053[_0x51674a];return _0x13fca6;};'use strict';var Sequelize=require('sequelize');module[_0x3d05('0x0')]={'name':{'type':Sequelize[_0x3d05('0x1')]},'description':{'type':Sequelize[_0x3d05('0x1')]},'username':{'type':Sequelize[_0x3d05('0x1')]},'remoteUri':{'type':Sequelize[_0x3d05('0x1')]},'authType':{'type':Sequelize[_0x3d05('0x2')]('basic'),'defaultValue':_0x3d05('0x3')},'password':{'type':Sequelize[_0x3d05('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x3d05('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x3d05('0x1')]},'serverUrl':{'type':Sequelize[_0x3d05('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3d05('0x4'),'newTab'),'defaultValue':_0x3d05('0x4')}}; \ No newline at end of file +var _0x1ec3=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0x1ec3,0x164));var _0x31ec=function(_0x3b228c,_0x18d42e){_0x3b228c=_0x3b228c-0x0;var _0x480bd1=_0x1ec3[_0x3b228c];return _0x480bd1;};'use strict';var Sequelize=require(_0x31ec('0x0'));module[_0x31ec('0x1')]={'name':{'type':Sequelize[_0x31ec('0x2')]},'description':{'type':Sequelize[_0x31ec('0x2')]},'username':{'type':Sequelize[_0x31ec('0x2')]},'remoteUri':{'type':Sequelize[_0x31ec('0x2')]},'authType':{'type':Sequelize[_0x31ec('0x3')](_0x31ec('0x4')),'defaultValue':_0x31ec('0x4')},'password':{'type':Sequelize[_0x31ec('0x2')]},'consumerKey':{'type':Sequelize[_0x31ec('0x2')]},'consumerSecret':{'type':Sequelize[_0x31ec('0x2')]},'token':{'type':Sequelize[_0x31ec('0x2')]},'tokenSecret':{'type':Sequelize[_0x31ec('0x2')]},'serverUrl':{'type':Sequelize[_0x31ec('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x31ec('0x3')](_0x31ec('0x5'),_0x31ec('0x6')),'defaultValue':_0x31ec('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 4d7e4e3..f8e8989 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 _0x79fa=['username','concat','_embedded','entries','active','label','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','json','offset','limit','undefined','count','status','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','findAll','rows','show','includeAll','catch','create','body','find','params','getConfigurations','DeskConfiguration','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','DeskField','priority','remoteUri','authType','password','consumerKey','token','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s'];(function(_0x2c2a8e,_0x1dfe39){var _0x3b9e38=function(_0x115a84){while(--_0x115a84){_0x2c2a8e['push'](_0x2c2a8e['shift']());}};_0x3b9e38(++_0x1dfe39);}(_0x79fa,0xea));var _0xa79f=function(_0x30896d,_0x389776){_0x30896d=_0x30896d-0x0;var _0xd5bf6a=_0x79fa[_0x30896d];return _0xd5bf6a;};'use strict';var emlformat=require(_0xa79f('0x0'));var rimraf=require(_0xa79f('0x1'));var zipdir=require(_0xa79f('0x2'));var jsonpatch=require(_0xa79f('0x3'));var rp=require(_0xa79f('0x4'));var moment=require(_0xa79f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa79f('0x6'));var path=require('path');var sox=require(_0xa79f('0x7'));var csv=require(_0xa79f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa79f('0x9'));var _=require(_0xa79f('0xa'));var squel=require(_0xa79f('0xb'));var crypto=require(_0xa79f('0xc'));var jsforce=require(_0xa79f('0xd'));var deskjs=require(_0xa79f('0xe'));var toCsv=require(_0xa79f('0x8'));var querystring=require(_0xa79f('0xf'));var Papa=require(_0xa79f('0x10'));var Redis=require(_0xa79f('0x11'));var authService=require(_0xa79f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa79f('0x13'));var logger=require(_0xa79f('0x14'))(_0xa79f('0x15'));var utils=require(_0xa79f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xa79f('0x17'));function respondWithStatusCode(_0x323da1,_0x4d2cf2){_0x4d2cf2=_0x4d2cf2||0xcc;return function(_0x3159ff){if(_0x3159ff){return _0x323da1[_0xa79f('0x18')](_0x4d2cf2);}return _0x323da1['status'](_0x4d2cf2)['end']();};}function respondWithResult(_0x2f5b49,_0x141157){_0x141157=_0x141157||0xc8;return function(_0x240fd8){if(_0x240fd8){return _0x2f5b49['status'](_0x141157)[_0xa79f('0x19')](_0x240fd8);}};}function respondWithFilteredResult(_0x5b6a23,_0x2fef41){return function(_0x5f3d9a){if(_0x5f3d9a){var _0x303bea=typeof _0x2fef41[_0xa79f('0x1a')]==='undefined'&&typeof _0x2fef41[_0xa79f('0x1b')]===_0xa79f('0x1c');var _0x5f35b1=_0x5f3d9a['count'];var _0x370004=_0x303bea?0x0:_0x2fef41['offset'];var _0x36dac9=_0x303bea?_0x5f3d9a[_0xa79f('0x1d')]:_0x2fef41[_0xa79f('0x1a')]+_0x2fef41['limit'];var _0x257744;if(_0x36dac9>=_0x5f35b1){_0x36dac9=_0x5f35b1;_0x257744=0xc8;}else{_0x257744=0xce;}_0x5b6a23[_0xa79f('0x1e')](_0x257744);return _0x5b6a23['set']('Content-Range',_0x370004+'-'+_0x36dac9+'/'+_0x5f35b1)[_0xa79f('0x19')](_0x5f3d9a);}return null;};}function patchUpdates(_0x10caa4){return function(_0x528a0b){try{jsonpatch[_0xa79f('0x1f')](_0x528a0b,_0x10caa4,!![]);}catch(_0x5b2954){return BPromise[_0xa79f('0x20')](_0x5b2954);}return _0x528a0b['save']();};}function saveUpdates(_0x1a64c2,_0x3a3442){return function(_0x11f4d2){if(_0x11f4d2){return _0x11f4d2[_0xa79f('0x21')](_0x1a64c2)[_0xa79f('0x22')](function(_0x57d4b5){return _0x57d4b5;});}return null;};}function removeEntity(_0x280cc8,_0x3d20df){return function(_0x4c9254){if(_0x4c9254){return _0x4c9254[_0xa79f('0x23')]()[_0xa79f('0x22')](function(){_0x280cc8[_0xa79f('0x1e')](0xcc)[_0xa79f('0x24')]();});}};}function handleEntityNotFound(_0x250952,_0x1fe23c){return function(_0x1c9984){if(!_0x1c9984){_0x250952['sendStatus'](0x194);}return _0x1c9984;};}function handleError(_0x4ad41e,_0x15007b){_0x15007b=_0x15007b||0x1f4;return function(_0x7fa856){logger[_0xa79f('0x25')](_0x7fa856[_0xa79f('0x26')]);if(_0x7fa856[_0xa79f('0x27')]){delete _0x7fa856['name'];}_0x4ad41e['status'](_0x15007b)[_0xa79f('0x28')](_0x7fa856);};}exports[_0xa79f('0x29')]=function(_0x98be7e,_0x37561d){var _0x36e37e={},_0x1fdc1c={},_0x208e0d={'count':0x0,'rows':[]};var _0x37a6cf=_[_0xa79f('0x2a')](db[_0xa79f('0x2b')][_0xa79f('0x2c')],function(_0x39b469){return{'name':_0x39b469[_0xa79f('0x2d')],'type':_0x39b469['type'][_0xa79f('0x2e')]};});_0x1fdc1c[_0xa79f('0x2f')]=_[_0xa79f('0x2a')](_0x37a6cf,_0xa79f('0x27'));_0x1fdc1c[_0xa79f('0x30')]=_[_0xa79f('0x31')](_0x98be7e[_0xa79f('0x30')]);_0x1fdc1c[_0xa79f('0x32')]=_['intersection'](_0x1fdc1c[_0xa79f('0x2f')],_0x1fdc1c[_0xa79f('0x30')]);_0x36e37e[_0xa79f('0x33')]=_[_0xa79f('0x34')](_0x1fdc1c['model'],qs[_0xa79f('0x35')](_0x98be7e[_0xa79f('0x30')][_0xa79f('0x35')]));_0x36e37e[_0xa79f('0x33')]=_0x36e37e[_0xa79f('0x33')][_0xa79f('0x36')]?_0x36e37e[_0xa79f('0x33')]:_0x1fdc1c['model'];if(!_0x98be7e[_0xa79f('0x30')][_0xa79f('0x37')](_0xa79f('0x38'))){_0x36e37e[_0xa79f('0x1b')]=qs[_0xa79f('0x1b')](_0x98be7e[_0xa79f('0x30')]['limit']);_0x36e37e['offset']=qs[_0xa79f('0x1a')](_0x98be7e[_0xa79f('0x30')]['offset']);}_0x36e37e[_0xa79f('0x39')]=qs[_0xa79f('0x3a')](_0x98be7e['query'][_0xa79f('0x3a')]);_0x36e37e['where']=qs[_0xa79f('0x32')](_[_0xa79f('0x3b')](_0x98be7e['query'],_0x1fdc1c['filters']),_0x37a6cf);if(_0x98be7e[_0xa79f('0x30')][_0xa79f('0x3c')]){_0x36e37e[_0xa79f('0x3d')]=_['merge'](_0x36e37e[_0xa79f('0x3d')],{'$or':_[_0xa79f('0x2a')](_0x37a6cf,function(_0x37fdf1){if(_0x37fdf1[_0xa79f('0x3e')]!==_0xa79f('0x3f')){var _0x1f7ca3={};_0x1f7ca3[_0x37fdf1[_0xa79f('0x27')]]={'$like':'%'+_0x98be7e['query'][_0xa79f('0x3c')]+'%'};return _0x1f7ca3;}})});}_0x36e37e=_[_0xa79f('0x40')]({},_0x36e37e,_0x98be7e[_0xa79f('0x41')]);var _0x46a816={'where':_0x36e37e[_0xa79f('0x3d')]};return db['DeskAccount'][_0xa79f('0x1d')](_0x46a816)['then'](function(_0x2c9293){_0x208e0d[_0xa79f('0x1d')]=_0x2c9293;if(_0x98be7e[_0xa79f('0x30')]['includeAll']){_0x36e37e['include']=[{'all':!![]}];}return db[_0xa79f('0x2b')][_0xa79f('0x42')](_0x36e37e);})[_0xa79f('0x22')](function(_0x1121f5){_0x208e0d[_0xa79f('0x43')]=_0x1121f5;return _0x208e0d;})[_0xa79f('0x22')](respondWithFilteredResult(_0x37561d,_0x36e37e))['catch'](handleError(_0x37561d,null));};exports[_0xa79f('0x44')]=function(_0x5d3421,_0x22cd56){var _0x2c303e={'raw':![],'where':{'id':_0x5d3421['params']['id']}},_0x1637db={};_0x1637db[_0xa79f('0x2f')]=_[_0xa79f('0x31')](db[_0xa79f('0x2b')][_0xa79f('0x2c')]);_0x1637db[_0xa79f('0x30')]=_[_0xa79f('0x31')](_0x5d3421[_0xa79f('0x30')]);_0x1637db[_0xa79f('0x32')]=_[_0xa79f('0x34')](_0x1637db[_0xa79f('0x2f')],_0x1637db[_0xa79f('0x30')]);_0x2c303e[_0xa79f('0x33')]=_[_0xa79f('0x34')](_0x1637db[_0xa79f('0x2f')],qs['fields'](_0x5d3421[_0xa79f('0x30')][_0xa79f('0x35')]));_0x2c303e[_0xa79f('0x33')]=_0x2c303e[_0xa79f('0x33')]['length']?_0x2c303e[_0xa79f('0x33')]:_0x1637db[_0xa79f('0x2f')];if(_0x5d3421[_0xa79f('0x30')][_0xa79f('0x45')]){_0x2c303e['include']=[{'all':!![]}];}_0x2c303e=_[_0xa79f('0x40')]({},_0x2c303e,_0x5d3421[_0xa79f('0x41')]);return db['DeskAccount']['find'](_0x2c303e)[_0xa79f('0x22')](handleEntityNotFound(_0x22cd56,null))['then'](respondWithResult(_0x22cd56,null))[_0xa79f('0x46')](handleError(_0x22cd56,null));};exports['create']=function(_0x3c05ad,_0x170758){return db[_0xa79f('0x2b')][_0xa79f('0x47')](_0x3c05ad[_0xa79f('0x48')],{})[_0xa79f('0x22')](respondWithResult(_0x170758,0xc9))[_0xa79f('0x46')](handleError(_0x170758,null));};exports[_0xa79f('0x21')]=function(_0x2ad2d5,_0x3af309){if(_0x2ad2d5[_0xa79f('0x48')]['id']){delete _0x2ad2d5[_0xa79f('0x48')]['id'];}return db['DeskAccount'][_0xa79f('0x49')]({'where':{'id':_0x2ad2d5['params']['id']}})[_0xa79f('0x22')](handleEntityNotFound(_0x3af309,null))[_0xa79f('0x22')](saveUpdates(_0x2ad2d5[_0xa79f('0x48')],null))[_0xa79f('0x22')](respondWithResult(_0x3af309,null))[_0xa79f('0x46')](handleError(_0x3af309,null));};exports[_0xa79f('0x23')]=function(_0x41111f,_0x536d07){return db[_0xa79f('0x2b')][_0xa79f('0x49')]({'where':{'id':_0x41111f[_0xa79f('0x4a')]['id']}})[_0xa79f('0x22')](handleEntityNotFound(_0x536d07,null))['then'](removeEntity(_0x536d07,null))['catch'](handleError(_0x536d07,null));};exports[_0xa79f('0x4b')]=function(_0x4a245c,_0x588007,_0xf813b3){var _0xe8991f={};var _0x57773e={};var _0x10c770;var _0x58d221;return db[_0xa79f('0x2b')]['findOne']({'where':{'id':_0x4a245c[_0xa79f('0x4a')]['id']}})[_0xa79f('0x22')](handleEntityNotFound(_0x588007,null))['then'](function(_0xf9c3){if(_0xf9c3){_0x10c770=_0xf9c3;_0x57773e[_0xa79f('0x2f')]=_[_0xa79f('0x31')](db[_0xa79f('0x4c')][_0xa79f('0x2c')]);_0x57773e[_0xa79f('0x30')]=_[_0xa79f('0x31')](_0x4a245c['query']);_0x57773e[_0xa79f('0x32')]=_['intersection'](_0x57773e[_0xa79f('0x2f')],_0x57773e[_0xa79f('0x30')]);_0xe8991f[_0xa79f('0x33')]=_[_0xa79f('0x34')](_0x57773e[_0xa79f('0x2f')],qs['fields'](_0x4a245c[_0xa79f('0x30')][_0xa79f('0x35')]));_0xe8991f[_0xa79f('0x33')]=_0xe8991f[_0xa79f('0x33')][_0xa79f('0x36')]?_0xe8991f['attributes']:_0x57773e[_0xa79f('0x2f')];_0xe8991f[_0xa79f('0x39')]=qs['sort'](_0x4a245c[_0xa79f('0x30')][_0xa79f('0x3a')]);_0xe8991f['where']=qs[_0xa79f('0x32')](_['pick'](_0x4a245c[_0xa79f('0x30')],_0x57773e[_0xa79f('0x32')]));if(_0x4a245c[_0xa79f('0x30')][_0xa79f('0x3c')]){_0xe8991f['where']=_[_0xa79f('0x40')](_0xe8991f[_0xa79f('0x3d')],{'$or':_[_0xa79f('0x2a')](_0xe8991f[_0xa79f('0x33')],function(_0x3e9460){var _0x28a716={};_0x28a716[_0x3e9460]={'$like':'%'+_0x4a245c['query']['filter']+'%'};return _0x28a716;})});}_0xe8991f=_[_0xa79f('0x40')]({},_0xe8991f,_0x4a245c[_0xa79f('0x41')]);return _0x10c770[_0xa79f('0x4b')](_0xe8991f);}})[_0xa79f('0x22')](function(_0x3e87a9){if(_0x3e87a9){_0x58d221=_0x3e87a9[_0xa79f('0x36')];if(!_0x4a245c[_0xa79f('0x30')][_0xa79f('0x37')]('nolimit')){_0xe8991f[_0xa79f('0x1b')]=qs[_0xa79f('0x1b')](_0x4a245c[_0xa79f('0x30')][_0xa79f('0x1b')]);_0xe8991f[_0xa79f('0x1a')]=qs[_0xa79f('0x1a')](_0x4a245c['query'][_0xa79f('0x1a')]);}return _0x10c770[_0xa79f('0x4b')](_0xe8991f);}})[_0xa79f('0x22')](function(_0x28675c){if(_0x28675c){return _0x28675c?{'count':_0x58d221,'rows':_0x28675c}:null;}})[_0xa79f('0x22')](respondWithResult(_0x588007,null))['catch'](handleError(_0x588007,null));};exports[_0xa79f('0x4d')]=function(_0x241c72,_0x16996a,_0x119134){if(_0x241c72[_0xa79f('0x48')]['id']){delete _0x241c72['body']['id'];}return db[_0xa79f('0x2b')][_0xa79f('0x4e')]({'where':{'id':_0x241c72[_0xa79f('0x4a')]['id']}})[_0xa79f('0x22')](handleEntityNotFound(_0x16996a,null))[_0xa79f('0x22')](function(_0x4a2046){if(_0x4a2046){_0x241c72[_0xa79f('0x48')]['AccountId']=_0x4a2046['id'];_0x241c72[_0xa79f('0x48')][_0xa79f('0x4f')]=integrations[_0xa79f('0x50')](_0x241c72[_0xa79f('0x48')][_0xa79f('0x51')],_0x241c72[_0xa79f('0x48')][_0xa79f('0x3e')]);_0x241c72[_0xa79f('0x48')][_0xa79f('0x52')]=integrations['getDescriptions'](_0x241c72[_0xa79f('0x48')]['channel'],_0x241c72[_0xa79f('0x48')][_0xa79f('0x3e')]);return db['DeskConfiguration'][_0xa79f('0x47')](_0x241c72[_0xa79f('0x48')],{'include':[{'model':db[_0xa79f('0x53')],'as':_0xa79f('0x4f')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0xa79f('0x22')](respondWithResult(_0x16996a,null))[_0xa79f('0x46')](handleError(_0x16996a,null));};exports['getFields']=function(_0x50a095,_0x2404ca,_0x586d45){var _0x4d0262=[{'name':_0xa79f('0x54'),'label':_0xa79f('0x54'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x42fb9d='';return db[_0xa79f('0x2b')][_0xa79f('0x4e')]({'where':{'id':_0x50a095[_0xa79f('0x4a')]['id']},'attributes':['id',_0xa79f('0x55'),_0xa79f('0x56'),'username',_0xa79f('0x57'),_0xa79f('0x58'),'consumerSecret',_0xa79f('0x59'),_0xa79f('0x5a')]})['then'](handleEntityNotFound(_0x2404ca,null))[_0xa79f('0x22')](function(_0x1dd49e){if(_0x1dd49e){_0x42fb9d=_0x1dd49e[_0xa79f('0x55')];var _0x3759e1=_0x42fb9d[_0xa79f('0x5b')](-0x1);if(_0x3759e1==='/'){_0x42fb9d=_0x42fb9d[_0xa79f('0x5c')](0x0,_0x42fb9d['lastIndexOf'](_0x3759e1));}var _0x1ffca7={'method':_0xa79f('0x5d'),'uri':util[_0xa79f('0x5e')](_0xa79f('0x5f'),_0x42fb9d),'headers':{'Content-Type':_0xa79f('0x60'),'Accept':_0xa79f('0x60')},'json':!![]};if(_0x1dd49e[_0xa79f('0x56')]===_0xa79f('0x61')){_0x1ffca7[_0xa79f('0x62')][_0xa79f('0x63')]=util[_0xa79f('0x5e')](_0xa79f('0x64'),new Buffer(util['format'](_0xa79f('0x65'),_0x1dd49e[_0xa79f('0x66')],_0x1dd49e[_0xa79f('0x57')]))['toString']('base64'));}return rp(_0x1ffca7)[_0xa79f('0x22')](function(_0x808cee){return _0x4d0262[_0xa79f('0x67')](_[_0xa79f('0x2a')](_0x808cee[_0xa79f('0x68')][_0xa79f('0x69')],function(_0x473e2c){return{'id':_0x473e2c['name'],'name':_0x473e2c['name'],'type':_0x473e2c[_0xa79f('0x3e')],'active':_0x473e2c[_0xa79f('0x6a')],'label':_0x473e2c[_0xa79f('0x6b')],'custom':!![]};}));});}})[_0xa79f('0x22')](function(_0x14469c){return{'count':_0x14469c['length'],'rows':_0x14469c};})[_0xa79f('0x22')](respondWithResult(_0x2404ca,null))[_0xa79f('0x46')](function(_0x38eb27){var _0x2b57da=_0x50a095[_0xa79f('0x30')]['test']?0x1f4:_0x38eb27['statusCode']||0x1f4;logger[_0xa79f('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2b57da,JSON[_0xa79f('0x6c')](_0x38eb27));delete _0x38eb27[_0xa79f('0x27')];if(_0x2b57da===0x191){_0x2b57da=0x190;}_0x2404ca[_0xa79f('0x1e')](_0x2b57da)[_0xa79f('0x28')](_0x50a095[_0xa79f('0x30')][_0xa79f('0x6d')]?{'message':_0xa79f('0x6e'),'statusCode':_0x38eb27[_0xa79f('0x6f')]}:_0x38eb27);});}; \ No newline at end of file +var _0xf68d=['DeskConfiguration','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','authType','username','password','consumerKey','consumerSecret','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','format','Basic\x20%s','%s:%s','toString','base64','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','update','then','error','stack','name','map','DeskAccount','rawAttributes','key','model','query','keys','intersection','attributes','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','includeAll','include','findAll','rows','show','fields','length','options','find','create','body','catch','destroy','params','getConfigurations','findOne'];(function(_0x225930,_0x4bce90){var _0x325c82=function(_0x5973af){while(--_0x5973af){_0x225930['push'](_0x225930['shift']());}};_0x325c82(++_0x4bce90);}(_0xf68d,0x175));var _0xdf68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf68d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf68('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf68('0x1'));var rp=require(_0xdf68('0x2'));var moment=require(_0xdf68('0x3'));var BPromise=require(_0xdf68('0x4'));var Mustache=require(_0xdf68('0x5'));var util=require('util');var path=require(_0xdf68('0x6'));var sox=require(_0xdf68('0x7'));var csv=require(_0xdf68('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf68('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdf68('0xa'));var deskjs=require(_0xdf68('0xb'));var toCsv=require(_0xdf68('0x8'));var querystring=require(_0xdf68('0xc'));var Papa=require(_0xdf68('0xd'));var Redis=require(_0xdf68('0xe'));var authService=require(_0xdf68('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf68('0x10'));var logger=require(_0xdf68('0x11'))(_0xdf68('0x12'));var utils=require(_0xdf68('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xdf68('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdf68('0x15'));function respondWithStatusCode(_0x17fd28,_0x504ae4){_0x504ae4=_0x504ae4||0xcc;return function(_0x5f76bf){if(_0x5f76bf){return _0x17fd28[_0xdf68('0x16')](_0x504ae4);}return _0x17fd28[_0xdf68('0x17')](_0x504ae4)['end']();};}function respondWithResult(_0xb0bf5b,_0x24deae){_0x24deae=_0x24deae||0xc8;return function(_0x63dbd0){if(_0x63dbd0){return _0xb0bf5b[_0xdf68('0x17')](_0x24deae)[_0xdf68('0x18')](_0x63dbd0);}};}function respondWithFilteredResult(_0x2d92b3,_0xdd0d3f){return function(_0x2b2c49){if(_0x2b2c49){var _0x58cd58=typeof _0xdd0d3f[_0xdf68('0x19')]==='undefined'&&typeof _0xdd0d3f['limit']===_0xdf68('0x1a');var _0x1df7ec=_0x2b2c49[_0xdf68('0x1b')];var _0x4d5ed1=_0x58cd58?0x0:_0xdd0d3f[_0xdf68('0x19')];var _0x2c8c38=_0x58cd58?_0x2b2c49[_0xdf68('0x1b')]:_0xdd0d3f['offset']+_0xdd0d3f['limit'];var _0xa1bc63;if(_0x2c8c38>=_0x1df7ec){_0x2c8c38=_0x1df7ec;_0xa1bc63=0xc8;}else{_0xa1bc63=0xce;}_0x2d92b3[_0xdf68('0x17')](_0xa1bc63);return _0x2d92b3[_0xdf68('0x1c')](_0xdf68('0x1d'),_0x4d5ed1+'-'+_0x2c8c38+'/'+_0x1df7ec)[_0xdf68('0x18')](_0x2b2c49);}return null;};}function patchUpdates(_0x580d45){return function(_0x2cf34d){try{jsonpatch[_0xdf68('0x1e')](_0x2cf34d,_0x580d45,!![]);}catch(_0x106141){return BPromise['reject'](_0x106141);}return _0x2cf34d['save']();};}function saveUpdates(_0x1486da,_0x4aa44c){return function(_0x55be90){if(_0x55be90){return _0x55be90[_0xdf68('0x1f')](_0x1486da)[_0xdf68('0x20')](function(_0x15ef65){return _0x15ef65;});}return null;};}function removeEntity(_0x3e86f2,_0x49039c){return function(_0x8ee348){if(_0x8ee348){return _0x8ee348['destroy']()[_0xdf68('0x20')](function(){_0x3e86f2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x195054,_0xe3c987){return function(_0x24be1d){if(!_0x24be1d){_0x195054[_0xdf68('0x16')](0x194);}return _0x24be1d;};}function handleError(_0x132ed2,_0x3c73e5){_0x3c73e5=_0x3c73e5||0x1f4;return function(_0x2739fa){logger[_0xdf68('0x21')](_0x2739fa[_0xdf68('0x22')]);if(_0x2739fa[_0xdf68('0x23')]){delete _0x2739fa[_0xdf68('0x23')];}_0x132ed2['status'](_0x3c73e5)['send'](_0x2739fa);};}exports['index']=function(_0x22da46,_0x1d7771){var _0x1f7379={},_0x4bfe9d={},_0x1a5bfe={'count':0x0,'rows':[]};var _0x4e5f36=_[_0xdf68('0x24')](db[_0xdf68('0x25')][_0xdf68('0x26')],function(_0x35780c){return{'name':_0x35780c['fieldName'],'type':_0x35780c['type'][_0xdf68('0x27')]};});_0x4bfe9d[_0xdf68('0x28')]=_[_0xdf68('0x24')](_0x4e5f36,_0xdf68('0x23'));_0x4bfe9d[_0xdf68('0x29')]=_[_0xdf68('0x2a')](_0x22da46['query']);_0x4bfe9d['filters']=_[_0xdf68('0x2b')](_0x4bfe9d[_0xdf68('0x28')],_0x4bfe9d['query']);_0x1f7379[_0xdf68('0x2c')]=_['intersection'](_0x4bfe9d[_0xdf68('0x28')],qs['fields'](_0x22da46[_0xdf68('0x29')]['fields']));_0x1f7379[_0xdf68('0x2c')]=_0x1f7379[_0xdf68('0x2c')]['length']?_0x1f7379['attributes']:_0x4bfe9d[_0xdf68('0x28')];if(!_0x22da46[_0xdf68('0x29')]['hasOwnProperty'](_0xdf68('0x2d'))){_0x1f7379[_0xdf68('0x2e')]=qs[_0xdf68('0x2e')](_0x22da46[_0xdf68('0x29')][_0xdf68('0x2e')]);_0x1f7379['offset']=qs[_0xdf68('0x19')](_0x22da46[_0xdf68('0x29')][_0xdf68('0x19')]);}_0x1f7379[_0xdf68('0x2f')]=qs[_0xdf68('0x30')](_0x22da46[_0xdf68('0x29')][_0xdf68('0x30')]);_0x1f7379['where']=qs[_0xdf68('0x31')](_[_0xdf68('0x32')](_0x22da46['query'],_0x4bfe9d['filters']),_0x4e5f36);if(_0x22da46[_0xdf68('0x29')][_0xdf68('0x33')]){_0x1f7379[_0xdf68('0x34')]=_[_0xdf68('0x35')](_0x1f7379[_0xdf68('0x34')],{'$or':_[_0xdf68('0x24')](_0x4e5f36,function(_0xabcc5a){if(_0xabcc5a[_0xdf68('0x36')]!=='VIRTUAL'){var _0x22aea5={};_0x22aea5[_0xabcc5a[_0xdf68('0x23')]]={'$like':'%'+_0x22da46['query']['filter']+'%'};return _0x22aea5;}})});}_0x1f7379=_[_0xdf68('0x35')]({},_0x1f7379,_0x22da46['options']);var _0x288c9c={'where':_0x1f7379['where']};return db[_0xdf68('0x25')][_0xdf68('0x1b')](_0x288c9c)[_0xdf68('0x20')](function(_0x3551ec){_0x1a5bfe['count']=_0x3551ec;if(_0x22da46[_0xdf68('0x29')][_0xdf68('0x37')]){_0x1f7379[_0xdf68('0x38')]=[{'all':!![]}];}return db[_0xdf68('0x25')][_0xdf68('0x39')](_0x1f7379);})[_0xdf68('0x20')](function(_0x572617){_0x1a5bfe[_0xdf68('0x3a')]=_0x572617;return _0x1a5bfe;})[_0xdf68('0x20')](respondWithFilteredResult(_0x1d7771,_0x1f7379))['catch'](handleError(_0x1d7771,null));};exports[_0xdf68('0x3b')]=function(_0x559b9d,_0x172edb){var _0x430d57={'raw':![],'where':{'id':_0x559b9d['params']['id']}},_0x26344a={};_0x26344a[_0xdf68('0x28')]=_[_0xdf68('0x2a')](db[_0xdf68('0x25')][_0xdf68('0x26')]);_0x26344a[_0xdf68('0x29')]=_[_0xdf68('0x2a')](_0x559b9d[_0xdf68('0x29')]);_0x26344a[_0xdf68('0x31')]=_['intersection'](_0x26344a['model'],_0x26344a['query']);_0x430d57['attributes']=_[_0xdf68('0x2b')](_0x26344a['model'],qs[_0xdf68('0x3c')](_0x559b9d[_0xdf68('0x29')][_0xdf68('0x3c')]));_0x430d57[_0xdf68('0x2c')]=_0x430d57[_0xdf68('0x2c')][_0xdf68('0x3d')]?_0x430d57[_0xdf68('0x2c')]:_0x26344a[_0xdf68('0x28')];if(_0x559b9d[_0xdf68('0x29')][_0xdf68('0x37')]){_0x430d57[_0xdf68('0x38')]=[{'all':!![]}];}_0x430d57=_[_0xdf68('0x35')]({},_0x430d57,_0x559b9d[_0xdf68('0x3e')]);return db[_0xdf68('0x25')][_0xdf68('0x3f')](_0x430d57)[_0xdf68('0x20')](handleEntityNotFound(_0x172edb,null))[_0xdf68('0x20')](respondWithResult(_0x172edb,null))['catch'](handleError(_0x172edb,null));};exports['create']=function(_0x2d5086,_0x4f5cf6){return db[_0xdf68('0x25')][_0xdf68('0x40')](_0x2d5086[_0xdf68('0x41')],{})['then'](respondWithResult(_0x4f5cf6,0xc9))['catch'](handleError(_0x4f5cf6,null));};exports[_0xdf68('0x1f')]=function(_0x2aa4fc,_0x11b97f){if(_0x2aa4fc[_0xdf68('0x41')]['id']){delete _0x2aa4fc[_0xdf68('0x41')]['id'];}return db['DeskAccount'][_0xdf68('0x3f')]({'where':{'id':_0x2aa4fc['params']['id']}})[_0xdf68('0x20')](handleEntityNotFound(_0x11b97f,null))[_0xdf68('0x20')](saveUpdates(_0x2aa4fc[_0xdf68('0x41')],null))[_0xdf68('0x20')](respondWithResult(_0x11b97f,null))[_0xdf68('0x42')](handleError(_0x11b97f,null));};exports[_0xdf68('0x43')]=function(_0x41ff5c,_0x48bcb4){return db[_0xdf68('0x25')][_0xdf68('0x3f')]({'where':{'id':_0x41ff5c[_0xdf68('0x44')]['id']}})[_0xdf68('0x20')](handleEntityNotFound(_0x48bcb4,null))[_0xdf68('0x20')](removeEntity(_0x48bcb4,null))['catch'](handleError(_0x48bcb4,null));};exports[_0xdf68('0x45')]=function(_0x280b62,_0x8667da,_0x44151c){var _0x306708={};var _0x34122b={};var _0x53db90;var _0xff24a8;return db[_0xdf68('0x25')][_0xdf68('0x46')]({'where':{'id':_0x280b62['params']['id']}})[_0xdf68('0x20')](handleEntityNotFound(_0x8667da,null))[_0xdf68('0x20')](function(_0x2f7a23){if(_0x2f7a23){_0x53db90=_0x2f7a23;_0x34122b[_0xdf68('0x28')]=_[_0xdf68('0x2a')](db[_0xdf68('0x47')][_0xdf68('0x26')]);_0x34122b[_0xdf68('0x29')]=_[_0xdf68('0x2a')](_0x280b62[_0xdf68('0x29')]);_0x34122b[_0xdf68('0x31')]=_['intersection'](_0x34122b[_0xdf68('0x28')],_0x34122b[_0xdf68('0x29')]);_0x306708[_0xdf68('0x2c')]=_[_0xdf68('0x2b')](_0x34122b['model'],qs[_0xdf68('0x3c')](_0x280b62[_0xdf68('0x29')][_0xdf68('0x3c')]));_0x306708[_0xdf68('0x2c')]=_0x306708[_0xdf68('0x2c')][_0xdf68('0x3d')]?_0x306708[_0xdf68('0x2c')]:_0x34122b['model'];_0x306708['order']=qs[_0xdf68('0x30')](_0x280b62['query'][_0xdf68('0x30')]);_0x306708['where']=qs[_0xdf68('0x31')](_[_0xdf68('0x32')](_0x280b62[_0xdf68('0x29')],_0x34122b[_0xdf68('0x31')]));if(_0x280b62['query'][_0xdf68('0x33')]){_0x306708[_0xdf68('0x34')]=_[_0xdf68('0x35')](_0x306708[_0xdf68('0x34')],{'$or':_['map'](_0x306708[_0xdf68('0x2c')],function(_0x2afe0e){var _0x1b7326={};_0x1b7326[_0x2afe0e]={'$like':'%'+_0x280b62[_0xdf68('0x29')][_0xdf68('0x33')]+'%'};return _0x1b7326;})});}_0x306708=_[_0xdf68('0x35')]({},_0x306708,_0x280b62[_0xdf68('0x3e')]);return _0x53db90['getConfigurations'](_0x306708);}})['then'](function(_0x5783e6){if(_0x5783e6){_0xff24a8=_0x5783e6[_0xdf68('0x3d')];if(!_0x280b62['query'][_0xdf68('0x48')](_0xdf68('0x2d'))){_0x306708[_0xdf68('0x2e')]=qs[_0xdf68('0x2e')](_0x280b62[_0xdf68('0x29')]['limit']);_0x306708[_0xdf68('0x19')]=qs['offset'](_0x280b62[_0xdf68('0x29')][_0xdf68('0x19')]);}return _0x53db90['getConfigurations'](_0x306708);}})[_0xdf68('0x20')](function(_0x39b37a){if(_0x39b37a){return _0x39b37a?{'count':_0xff24a8,'rows':_0x39b37a}:null;}})['then'](respondWithResult(_0x8667da,null))[_0xdf68('0x42')](handleError(_0x8667da,null));};exports[_0xdf68('0x49')]=function(_0x31c443,_0x5a7dc5,_0x34cc95){if(_0x31c443[_0xdf68('0x41')]['id']){delete _0x31c443[_0xdf68('0x41')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x31c443['params']['id']}})[_0xdf68('0x20')](handleEntityNotFound(_0x5a7dc5,null))['then'](function(_0x2bc19b){if(_0x2bc19b){_0x31c443['body'][_0xdf68('0x4a')]=_0x2bc19b['id'];_0x31c443[_0xdf68('0x41')]['Subjects']=integrations[_0xdf68('0x4b')](_0x31c443['body'][_0xdf68('0x4c')],_0x31c443[_0xdf68('0x41')]['type']);_0x31c443[_0xdf68('0x41')][_0xdf68('0x4d')]=integrations[_0xdf68('0x4e')](_0x31c443['body'][_0xdf68('0x4c')],_0x31c443['body'][_0xdf68('0x36')]);return db['DeskConfiguration'][_0xdf68('0x40')](_0x31c443['body'],{'include':[{'model':db[_0xdf68('0x4f')],'as':_0xdf68('0x50')},{'model':db['DeskField'],'as':_0xdf68('0x4d')}]});}return null;})[_0xdf68('0x20')](respondWithResult(_0x5a7dc5,null))[_0xdf68('0x42')](handleError(_0x5a7dc5,null));};exports[_0xdf68('0x51')]=function(_0x475b29,_0x69d9b4,_0x156444){var _0x26139f=[{'name':_0xdf68('0x52'),'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 _0x350c80='';return db[_0xdf68('0x25')]['findOne']({'where':{'id':_0x475b29['params']['id']},'attributes':['id','remoteUri',_0xdf68('0x53'),_0xdf68('0x54'),_0xdf68('0x55'),_0xdf68('0x56'),_0xdf68('0x57'),'token',_0xdf68('0x58')]})[_0xdf68('0x20')](handleEntityNotFound(_0x69d9b4,null))['then'](function(_0x3b63e1){if(_0x3b63e1){_0x350c80=_0x3b63e1['remoteUri'];var _0x4c6589=_0x350c80[_0xdf68('0x59')](-0x1);if(_0x4c6589==='/'){_0x350c80=_0x350c80[_0xdf68('0x5a')](0x0,_0x350c80[_0xdf68('0x5b')](_0x4c6589));}var _0x595b6d={'method':_0xdf68('0x5c'),'uri':util['format'](_0xdf68('0x5d'),_0x350c80),'headers':{'Content-Type':_0xdf68('0x5e'),'Accept':_0xdf68('0x5e')},'json':!![]};if(_0x3b63e1[_0xdf68('0x53')]===_0xdf68('0x5f')){_0x595b6d[_0xdf68('0x60')]['Authorization']=util[_0xdf68('0x61')](_0xdf68('0x62'),new Buffer(util[_0xdf68('0x61')](_0xdf68('0x63'),_0x3b63e1['username'],_0x3b63e1[_0xdf68('0x55')]))[_0xdf68('0x64')](_0xdf68('0x65')));}return rp(_0x595b6d)[_0xdf68('0x20')](function(_0x58d793){return _0x26139f['concat'](_[_0xdf68('0x24')](_0x58d793[_0xdf68('0x66')][_0xdf68('0x67')],function(_0x4478cd){return{'id':_0x4478cd[_0xdf68('0x23')],'name':_0x4478cd[_0xdf68('0x23')],'type':_0x4478cd[_0xdf68('0x36')],'active':_0x4478cd[_0xdf68('0x68')],'label':_0x4478cd[_0xdf68('0x69')],'custom':!![]};}));});}})[_0xdf68('0x20')](function(_0x50ae5f){return{'count':_0x50ae5f[_0xdf68('0x3d')],'rows':_0x50ae5f};})[_0xdf68('0x20')](respondWithResult(_0x69d9b4,null))[_0xdf68('0x42')](function(_0x4fa799){var _0x380349=_0x475b29[_0xdf68('0x29')]['test']?0x1f4:_0x4fa799[_0xdf68('0x6a')]||0x1f4;logger[_0xdf68('0x21')](_0xdf68('0x6b'),'getFields',_0x380349,JSON[_0xdf68('0x6c')](_0x4fa799));delete _0x4fa799[_0xdf68('0x23')];if(_0x380349===0x191){_0x380349=0x190;}_0x69d9b4['status'](_0x380349)['send'](_0x475b29[_0xdf68('0x29')][_0xdf68('0x6d')]?{'message':_0xdf68('0x6e'),'statusCode':_0x4fa799[_0xdf68('0x6a')]}:_0x4fa799);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index eff04a9..1604e7f 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 _0xb065=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','lodash'];(function(_0x41c0ec,_0x3ed4ef){var _0x4cd986=function(_0x3bc7cc){while(--_0x3bc7cc){_0x41c0ec['push'](_0x41c0ec['shift']());}};_0x4cd986(++_0x3ed4ef);}(_0xb065,0x81));var _0x5b06=function(_0x4362d5,_0x1c20a6){_0x4362d5=_0x4362d5-0x0;var _0x5daade=_0xb065[_0x4362d5];return _0x5daade;};'use strict';var _=require(_0x5b06('0x0'));var util=require(_0x5b06('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5b06('0x2'));var BPromise=require(_0x5b06('0x3'));var rp=require(_0x5b06('0x4'));var fs=require('fs');var path=require(_0x5b06('0x5'));var rimraf=require(_0x5b06('0x6'));var config=require(_0x5b06('0x7'));var attributes=require(_0x5b06('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x5b06('0x9')]=function(_0x513037,_0x404d72){return _0x513037[_0x5b06('0xa')](_0x5b06('0xb'),attributes,{'tableName':_0x5b06('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77bb=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash'];(function(_0xe12712,_0xcf2af5){var _0x4913c0=function(_0x1ff103){while(--_0x1ff103){_0xe12712['push'](_0xe12712['shift']());}};_0x4913c0(++_0xcf2af5);}(_0x77bb,0xc2));var _0xb77b=function(_0x223d46,_0x35f615){_0x223d46=_0x223d46-0x0;var _0x2db6e5=_0x77bb[_0x223d46];return _0x2db6e5;};'use strict';var _=require(_0xb77b('0x0'));var util=require(_0xb77b('0x1'));var logger=require(_0xb77b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb77b('0x3'));var rp=require(_0xb77b('0x4'));var fs=require('fs');var path=require(_0xb77b('0x5'));var rimraf=require(_0xb77b('0x6'));var config=require(_0xb77b('0x7'));var attributes=require(_0xb77b('0x8'));var integrations=require(_0xb77b('0x9'));module['exports']=function(_0x18e3d5,_0x517201){return _0x18e3d5[_0xb77b('0xa')](_0xb77b('0xb'),attributes,{'tableName':_0xb77b('0xc'),'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 4264cfa..89ce53a 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 _0x9014=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','where','limit','include','map','attributes','model','ShowDeskAccount','debug','util','bluebird','randomstring','ioredis'];(function(_0x716e6a,_0x199240){var _0x542993=function(_0x171da2){while(--_0x171da2){_0x716e6a['push'](_0x716e6a['shift']());}};_0x542993(++_0x199240);}(_0x9014,0x146));var _0x4901=function(_0xc9a482,_0x6c7eef){_0xc9a482=_0xc9a482-0x0;var _0x372e68=_0x9014[_0xc9a482];return _0x372e68;};'use strict';var _=require('lodash');var util=require(_0x4901('0x0'));var moment=require('moment');var BPromise=require(_0x4901('0x1'));var rs=require(_0x4901('0x2'));var fs=require('fs');var Redis=require(_0x4901('0x3'));var db=require(_0x4901('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4901('0x5'))('rpc');var config=require(_0x4901('0x6'));var jayson=require(_0x4901('0x7'));var client=jayson[_0x4901('0x8')][_0x4901('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20c956,_0x16e26e,_0x23c3da){return new BPromise(function(_0x254a86,_0x25b4c0){return client[_0x4901('0xa')](_0x20c956,_0x23c3da)[_0x4901('0xb')](function(_0x51da59){logger[_0x4901('0xc')](_0x4901('0xd'),_0x16e26e,'request\x20sent');logger['debug'](_0x4901('0xe'),_0x16e26e,'request\x20sent',JSON[_0x4901('0xf')](_0x51da59));if(_0x51da59[_0x4901('0x10')]){if(_0x51da59['error'][_0x4901('0x11')]===0x1f4){logger[_0x4901('0x10')](_0x4901('0xd'),_0x16e26e,_0x51da59[_0x4901('0x10')][_0x4901('0x12')]);return _0x25b4c0(_0x51da59[_0x4901('0x10')][_0x4901('0x12')]);}logger[_0x4901('0x10')](_0x4901('0xd'),_0x16e26e,_0x51da59[_0x4901('0x10')][_0x4901('0x12')]);return _0x254a86(_0x51da59['error']['message']);}else{logger['info'](_0x4901('0xd'),_0x16e26e,'request\x20sent');_0x254a86(_0x51da59[_0x4901('0x13')][_0x4901('0x12')]);}})[_0x4901('0x14')](function(_0x51cd05){logger[_0x4901('0x10')](_0x4901('0xd'),_0x16e26e,_0x51cd05);_0x25b4c0(_0x51cd05);});});}exports[_0x4901('0x15')]=function(_0x1a958e){var _0x1ecfa6=this;return new Promise(function(_0x401c80,_0x140afe){return db[_0x4901('0x16')]['findAll']({'raw':_0x1a958e[_0x4901('0x17')]?_0x1a958e['options'][_0x4901('0x18')]===undefined?!![]:![]:!![],'where':_0x1a958e[_0x4901('0x17')]?_0x1a958e['options'][_0x4901('0x19')]||null:null,'attributes':_0x1a958e[_0x4901('0x17')]?_0x1a958e['options']['attributes']||null:null,'limit':_0x1a958e[_0x4901('0x17')]?_0x1a958e['options'][_0x4901('0x1a')]||null:null,'include':_0x1a958e['options']?_0x1a958e['options'][_0x4901('0x1b')]?_[_0x4901('0x1c')](_0x1a958e[_0x4901('0x17')][_0x4901('0x1b')],function(_0xba0d11){return{'model':db[_0xba0d11['model']],'as':_0xba0d11['as'],'attributes':_0xba0d11[_0x4901('0x1d')],'include':_0xba0d11[_0x4901('0x1b')]?_[_0x4901('0x1c')](_0xba0d11['include'],function(_0x3765cf){return{'model':db[_0x3765cf[_0x4901('0x1e')]],'as':_0x3765cf['as'],'attributes':_0x3765cf[_0x4901('0x1d')],'include':_0x3765cf[_0x4901('0x1b')]?_[_0x4901('0x1c')](_0x3765cf['include'],function(_0x262426){return{'model':db[_0x262426[_0x4901('0x1e')]],'as':_0x262426['as'],'attributes':_0x262426[_0x4901('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4901('0xb')](function(_0x5df545){logger[_0x4901('0xc')](_0x4901('0x15'),_0x1a958e);logger['debug'](_0x4901('0x15'),_0x1a958e,JSON['stringify'](_0x5df545));_0x401c80(_0x5df545);})['catch'](function(_0x298939){logger[_0x4901('0x10')]('GetDeskAccount',_0x298939[_0x4901('0x12')],_0x1a958e);_0x140afe(_0x1ecfa6['error'](0x1f4,_0x298939[_0x4901('0x12')]));});});};exports[_0x4901('0x1f')]=function(_0x54d1ae){var _0x184bad=this;return new Promise(function(_0x53cc73,_0x132d93){return db['DeskAccount']['find']({'raw':_0x54d1ae[_0x4901('0x17')]?_0x54d1ae[_0x4901('0x17')][_0x4901('0x18')]===undefined?!![]:![]:!![],'where':_0x54d1ae[_0x4901('0x17')]?_0x54d1ae[_0x4901('0x17')]['where']||null:null,'attributes':_0x54d1ae['options']?_0x54d1ae['options'][_0x4901('0x1d')]||null:null,'include':_0x54d1ae[_0x4901('0x17')]?_0x54d1ae[_0x4901('0x17')][_0x4901('0x1b')]?_[_0x4901('0x1c')](_0x54d1ae[_0x4901('0x17')][_0x4901('0x1b')],function(_0x5b5171){return{'model':db[_0x5b5171[_0x4901('0x1e')]],'as':_0x5b5171['as'],'attributes':_0x5b5171[_0x4901('0x1d')],'include':_0x5b5171[_0x4901('0x1b')]?_['map'](_0x5b5171[_0x4901('0x1b')],function(_0x41abf6){return{'model':db[_0x41abf6[_0x4901('0x1e')]],'as':_0x41abf6['as'],'attributes':_0x41abf6['attributes'],'include':_0x41abf6[_0x4901('0x1b')]?_['map'](_0x41abf6[_0x4901('0x1b')],function(_0x5587d3){return{'model':db[_0x5587d3[_0x4901('0x1e')]],'as':_0x5587d3['as'],'attributes':_0x5587d3['attributes']};}):[]};}):[]};}):[]:[]})[_0x4901('0xb')](function(_0x2426da){logger[_0x4901('0xc')](_0x4901('0x1f'),_0x54d1ae);logger[_0x4901('0x20')](_0x4901('0x1f'),_0x54d1ae,JSON[_0x4901('0xf')](_0x2426da));_0x53cc73(_0x2426da);})[_0x4901('0x14')](function(_0x8f4083){logger[_0x4901('0x10')](_0x4901('0x1f'),_0x8f4083['message'],_0x54d1ae);_0x132d93(_0x184bad[_0x4901('0x10')](0x1f4,_0x8f4083[_0x4901('0x12')]));});});}; \ No newline at end of file +var _0xb68d=['then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','include','map','model','stringify','catch','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xb68d,0x1a4));var _0xdb68=function(_0x58c7b2,_0x23c0be){_0x58c7b2=_0x58c7b2-0x0;var _0x3634df=_0xb68d[_0x58c7b2];return _0x3634df;};'use strict';var _=require(_0xdb68('0x0'));var util=require(_0xdb68('0x1'));var moment=require(_0xdb68('0x2'));var BPromise=require(_0xdb68('0x3'));var rs=require(_0xdb68('0x4'));var fs=require('fs');var Redis=require(_0xdb68('0x5'));var db=require(_0xdb68('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb68('0x7'))(_0xdb68('0x8'));var config=require(_0xdb68('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdb68('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3223b,_0x385fff,_0x31e5ae){return new BPromise(function(_0x16bdef,_0xba9a0c){return client[_0xdb68('0xb')](_0xd3223b,_0x31e5ae)[_0xdb68('0xc')](function(_0x1e9cf9){logger[_0xdb68('0xd')](_0xdb68('0xe'),_0x385fff,_0xdb68('0xf'));logger[_0xdb68('0x10')](_0xdb68('0x11'),_0x385fff,_0xdb68('0xf'),JSON['stringify'](_0x1e9cf9));if(_0x1e9cf9[_0xdb68('0x12')]){if(_0x1e9cf9['error'][_0xdb68('0x13')]===0x1f4){logger['error'](_0xdb68('0xe'),_0x385fff,_0x1e9cf9[_0xdb68('0x12')][_0xdb68('0x14')]);return _0xba9a0c(_0x1e9cf9['error']['message']);}logger[_0xdb68('0x12')](_0xdb68('0xe'),_0x385fff,_0x1e9cf9['error'][_0xdb68('0x14')]);return _0x16bdef(_0x1e9cf9[_0xdb68('0x12')]['message']);}else{logger[_0xdb68('0xd')](_0xdb68('0xe'),_0x385fff,_0xdb68('0xf'));_0x16bdef(_0x1e9cf9[_0xdb68('0x15')][_0xdb68('0x14')]);}})['catch'](function(_0x13c9f3){logger[_0xdb68('0x12')](_0xdb68('0xe'),_0x385fff,_0x13c9f3);_0xba9a0c(_0x13c9f3);});});}exports[_0xdb68('0x16')]=function(_0x435725){var _0x3c479d=this;return new Promise(function(_0x19e41e,_0x494852){return db[_0xdb68('0x17')][_0xdb68('0x18')]({'raw':_0x435725[_0xdb68('0x19')]?_0x435725['options']['raw']===undefined?!![]:![]:!![],'where':_0x435725[_0xdb68('0x19')]?_0x435725[_0xdb68('0x19')][_0xdb68('0x1a')]||null:null,'attributes':_0x435725[_0xdb68('0x19')]?_0x435725[_0xdb68('0x19')][_0xdb68('0x1b')]||null:null,'limit':_0x435725[_0xdb68('0x19')]?_0x435725['options'][_0xdb68('0x1c')]||null:null,'include':_0x435725[_0xdb68('0x19')]?_0x435725[_0xdb68('0x19')][_0xdb68('0x1d')]?_[_0xdb68('0x1e')](_0x435725[_0xdb68('0x19')][_0xdb68('0x1d')],function(_0x5c259a){return{'model':db[_0x5c259a[_0xdb68('0x1f')]],'as':_0x5c259a['as'],'attributes':_0x5c259a[_0xdb68('0x1b')],'include':_0x5c259a[_0xdb68('0x1d')]?_[_0xdb68('0x1e')](_0x5c259a[_0xdb68('0x1d')],function(_0x9f0e60){return{'model':db[_0x9f0e60['model']],'as':_0x9f0e60['as'],'attributes':_0x9f0e60[_0xdb68('0x1b')],'include':_0x9f0e60[_0xdb68('0x1d')]?_[_0xdb68('0x1e')](_0x9f0e60[_0xdb68('0x1d')],function(_0x39d8d8){return{'model':db[_0x39d8d8[_0xdb68('0x1f')]],'as':_0x39d8d8['as'],'attributes':_0x39d8d8[_0xdb68('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdb68('0xc')](function(_0x333a2d){logger[_0xdb68('0xd')](_0xdb68('0x16'),_0x435725);logger[_0xdb68('0x10')](_0xdb68('0x16'),_0x435725,JSON[_0xdb68('0x20')](_0x333a2d));_0x19e41e(_0x333a2d);})[_0xdb68('0x21')](function(_0x4cef74){logger[_0xdb68('0x12')](_0xdb68('0x16'),_0x4cef74[_0xdb68('0x14')],_0x435725);_0x494852(_0x3c479d[_0xdb68('0x12')](0x1f4,_0x4cef74[_0xdb68('0x14')]));});});};exports[_0xdb68('0x22')]=function(_0x3f8f31){var _0x569098=this;return new Promise(function(_0x2f4b17,_0x3a6629){return db[_0xdb68('0x17')][_0xdb68('0x23')]({'raw':_0x3f8f31[_0xdb68('0x19')]?_0x3f8f31[_0xdb68('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3f8f31['options']?_0x3f8f31['options'][_0xdb68('0x1a')]||null:null,'attributes':_0x3f8f31[_0xdb68('0x19')]?_0x3f8f31[_0xdb68('0x19')][_0xdb68('0x1b')]||null:null,'include':_0x3f8f31[_0xdb68('0x19')]?_0x3f8f31[_0xdb68('0x19')][_0xdb68('0x1d')]?_['map'](_0x3f8f31['options'][_0xdb68('0x1d')],function(_0x505709){return{'model':db[_0x505709['model']],'as':_0x505709['as'],'attributes':_0x505709[_0xdb68('0x1b')],'include':_0x505709[_0xdb68('0x1d')]?_['map'](_0x505709['include'],function(_0x1232cd){return{'model':db[_0x1232cd[_0xdb68('0x1f')]],'as':_0x1232cd['as'],'attributes':_0x1232cd[_0xdb68('0x1b')],'include':_0x1232cd[_0xdb68('0x1d')]?_[_0xdb68('0x1e')](_0x1232cd[_0xdb68('0x1d')],function(_0x552a40){return{'model':db[_0x552a40[_0xdb68('0x1f')]],'as':_0x552a40['as'],'attributes':_0x552a40[_0xdb68('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdb68('0xc')](function(_0x6f3bca){logger['info']('ShowDeskAccount',_0x3f8f31);logger[_0xdb68('0x10')](_0xdb68('0x22'),_0x3f8f31,JSON[_0xdb68('0x20')](_0x6f3bca));_0x2f4b17(_0x6f3bca);})[_0xdb68('0x21')](function(_0x7c6d96){logger[_0xdb68('0x12')]('ShowDeskAccount',_0x7c6d96[_0xdb68('0x14')],_0x3f8f31);_0x3a6629(_0x569098[_0xdb68('0x12')](0x1f4,_0x7c6d96[_0xdb68('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 4902097..6007908 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1365e5,_0x2bdfce){var _0x3fe75a=function(_0x4908e8){while(--_0x4908e8){_0x1365e5['push'](_0x1365e5['shift']());}};_0x3fe75a(++_0x2bdfce);}(_0x008c,0x188));var _0xc008=function(_0x10df87,_0x4e3dcb){_0x10df87=_0x10df87-0x0;var _0x22923d=_0x008c[_0x10df87];return _0x22923d;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _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(_0x475923,_0x25d9ec){var _0x374030=function(_0x3f256b){while(--_0x3f256b){_0x475923['push'](_0x475923['shift']());}};_0x374030(++_0x25d9ec);}(_0x55ca,0x126));var _0xa55c=function(_0x37d3f3,_0xca010f){_0x37d3f3=_0x37d3f3-0x0;var _0x185c9c=_0x55ca[_0x37d3f3];return _0x185c9c;};'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 fac0777..5302686 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 _0x518b=['STRING','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x518b,0x14e));var _0xb518=function(_0x4e2efd,_0x3c4339){_0x4e2efd=_0x4e2efd-0x0;var _0x5cbcf1=_0x518b[_0x4e2efd];return _0x5cbcf1;};'use strict';var Sequelize=require(_0xb518('0x0'));module[_0xb518('0x1')]={'name':{'type':Sequelize[_0xb518('0x2')]},'description':{'type':Sequelize[_0xb518('0x2')]}}; \ No newline at end of file +var _0xd32f=['STRING','exports'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xd32f,0xab));var _0xfd32=function(_0x5b2b12,_0x10af43){_0x5b2b12=_0x5b2b12-0x0;var _0x4df689=_0xd32f[_0x5b2b12];return _0x4df689;};'use strict';var Sequelize=require('sequelize');module[_0xfd32('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfd32('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 47be603..6d76d13 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 _0x1ae4=['name','send','index','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','DeskConfiguration','count','include','findAll','rows','params','keys','find','catch','create','body','findOne','DeskField','map','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','stack'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x1ae4,0x7c));var _0x41ae=function(_0x3a8f0f,_0x1061f8){_0x3a8f0f=_0x3a8f0f-0x0;var _0x3eb1f6=_0x1ae4[_0x3a8f0f];return _0x3eb1f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x41ae('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41ae('0x1'));var rp=require(_0x41ae('0x2'));var moment=require('moment');var BPromise=require(_0x41ae('0x3'));var Mustache=require(_0x41ae('0x4'));var util=require(_0x41ae('0x5'));var path=require(_0x41ae('0x6'));var sox=require(_0x41ae('0x7'));var csv=require(_0x41ae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x41ae('0x9'));var _=require('lodash');var squel=require(_0x41ae('0xa'));var crypto=require('crypto');var jsforce=require(_0x41ae('0xb'));var deskjs=require(_0x41ae('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x41ae('0xd'));var authService=require(_0x41ae('0xe'));var qs=require(_0x41ae('0xf'));var as=require(_0x41ae('0x10'));var hardwareService=require(_0x41ae('0x11'));var logger=require(_0x41ae('0x12'))('api');var utils=require(_0x41ae('0x13'));var config=require(_0x41ae('0x14'));var licenseUtil=require(_0x41ae('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x324938,_0x32225c){_0x32225c=_0x32225c||0xcc;return function(_0x5cf837){if(_0x5cf837){return _0x324938[_0x41ae('0x16')](_0x32225c);}return _0x324938[_0x41ae('0x17')](_0x32225c)[_0x41ae('0x18')]();};}function respondWithResult(_0x3ec4fa,_0x4eda10){_0x4eda10=_0x4eda10||0xc8;return function(_0x4f95f8){if(_0x4f95f8){return _0x3ec4fa['status'](_0x4eda10)[_0x41ae('0x19')](_0x4f95f8);}};}function respondWithFilteredResult(_0x28daa3,_0xf9d7a9){return function(_0x498faa){if(_0x498faa){var _0x4fc2be=typeof _0xf9d7a9[_0x41ae('0x1a')]===_0x41ae('0x1b')&&typeof _0xf9d7a9[_0x41ae('0x1c')]==='undefined';var _0x15fd7=_0x498faa['count'];var _0x1c109b=_0x4fc2be?0x0:_0xf9d7a9['offset'];var _0x4c0573=_0x4fc2be?_0x498faa['count']:_0xf9d7a9[_0x41ae('0x1a')]+_0xf9d7a9[_0x41ae('0x1c')];var _0x2a1533;if(_0x4c0573>=_0x15fd7){_0x4c0573=_0x15fd7;_0x2a1533=0xc8;}else{_0x2a1533=0xce;}_0x28daa3[_0x41ae('0x17')](_0x2a1533);return _0x28daa3['set'](_0x41ae('0x1d'),_0x1c109b+'-'+_0x4c0573+'/'+_0x15fd7)[_0x41ae('0x19')](_0x498faa);}return null;};}function patchUpdates(_0x12ef40){return function(_0x3c3036){try{jsonpatch[_0x41ae('0x1e')](_0x3c3036,_0x12ef40,!![]);}catch(_0x31f301){return BPromise[_0x41ae('0x1f')](_0x31f301);}return _0x3c3036['save']();};}function saveUpdates(_0x29f87c,_0x311e43){return function(_0x3c989c){if(_0x3c989c){return _0x3c989c[_0x41ae('0x20')](_0x29f87c)[_0x41ae('0x21')](function(_0x43a32e){return _0x43a32e;});}return null;};}function removeEntity(_0x2be335,_0x210f67){return function(_0x39be5c){if(_0x39be5c){return _0x39be5c[_0x41ae('0x22')]()[_0x41ae('0x21')](function(){_0x2be335[_0x41ae('0x17')](0xcc)[_0x41ae('0x18')]();});}};}function handleEntityNotFound(_0x3fa86b,_0x40a3a6){return function(_0x4f68a1){if(!_0x4f68a1){_0x3fa86b[_0x41ae('0x16')](0x194);}return _0x4f68a1;};}function handleError(_0xc68fb3,_0x442bad){_0x442bad=_0x442bad||0x1f4;return function(_0x174cc9){logger['error'](_0x174cc9[_0x41ae('0x23')]);if(_0x174cc9['name']){delete _0x174cc9[_0x41ae('0x24')];}_0xc68fb3[_0x41ae('0x17')](_0x442bad)[_0x41ae('0x25')](_0x174cc9);};}exports[_0x41ae('0x26')]=function(_0x214a46,_0x2877be){var _0x3317f9={},_0x3979a3={},_0x3ce78f={'count':0x0,'rows':[]};var _0x1bb17f=_['map'](db['DeskConfiguration'][_0x41ae('0x27')],function(_0x10f57d){return{'name':_0x10f57d['fieldName'],'type':_0x10f57d[_0x41ae('0x28')][_0x41ae('0x29')]};});_0x3979a3[_0x41ae('0x2a')]=_['map'](_0x1bb17f,'name');_0x3979a3[_0x41ae('0x2b')]=_['keys'](_0x214a46[_0x41ae('0x2b')]);_0x3979a3['filters']=_[_0x41ae('0x2c')](_0x3979a3['model'],_0x3979a3[_0x41ae('0x2b')]);_0x3317f9[_0x41ae('0x2d')]=_[_0x41ae('0x2c')](_0x3979a3['model'],qs[_0x41ae('0x2e')](_0x214a46[_0x41ae('0x2b')][_0x41ae('0x2e')]));_0x3317f9[_0x41ae('0x2d')]=_0x3317f9[_0x41ae('0x2d')][_0x41ae('0x2f')]?_0x3317f9[_0x41ae('0x2d')]:_0x3979a3[_0x41ae('0x2a')];if(!_0x214a46[_0x41ae('0x2b')][_0x41ae('0x30')](_0x41ae('0x31'))){_0x3317f9[_0x41ae('0x1c')]=qs[_0x41ae('0x1c')](_0x214a46['query']['limit']);_0x3317f9[_0x41ae('0x1a')]=qs[_0x41ae('0x1a')](_0x214a46[_0x41ae('0x2b')]['offset']);}_0x3317f9[_0x41ae('0x32')]=qs['sort'](_0x214a46['query'][_0x41ae('0x33')]);_0x3317f9[_0x41ae('0x34')]=qs[_0x41ae('0x35')](_[_0x41ae('0x36')](_0x214a46[_0x41ae('0x2b')],_0x3979a3[_0x41ae('0x35')]),_0x1bb17f);if(_0x214a46['query'][_0x41ae('0x37')]){_0x3317f9['where']=_[_0x41ae('0x38')](_0x3317f9['where'],{'$or':_['map'](_0x1bb17f,function(_0x10e183){if(_0x10e183['type']!==_0x41ae('0x39')){var _0x21eaf0={};_0x21eaf0[_0x10e183['name']]={'$like':'%'+_0x214a46[_0x41ae('0x2b')][_0x41ae('0x37')]+'%'};return _0x21eaf0;}})});}_0x3317f9=_[_0x41ae('0x38')]({},_0x3317f9,_0x214a46[_0x41ae('0x3a')]);var _0x2d6434={'where':_0x3317f9[_0x41ae('0x34')]};return db[_0x41ae('0x3b')][_0x41ae('0x3c')](_0x2d6434)[_0x41ae('0x21')](function(_0x41cbf4){_0x3ce78f[_0x41ae('0x3c')]=_0x41cbf4;if(_0x214a46['query']['includeAll']){_0x3317f9[_0x41ae('0x3d')]=[{'all':!![]}];}return db[_0x41ae('0x3b')][_0x41ae('0x3e')](_0x3317f9);})[_0x41ae('0x21')](function(_0x107f83){_0x3ce78f[_0x41ae('0x3f')]=_0x107f83;return _0x3ce78f;})['then'](respondWithFilteredResult(_0x2877be,_0x3317f9))['catch'](handleError(_0x2877be,null));};exports['show']=function(_0x627eab,_0x42c58f){var _0x2f9680={'raw':![],'where':{'id':_0x627eab[_0x41ae('0x40')]['id']}},_0x1617ff={};_0x1617ff[_0x41ae('0x2a')]=_['keys'](db[_0x41ae('0x3b')][_0x41ae('0x27')]);_0x1617ff['query']=_[_0x41ae('0x41')](_0x627eab[_0x41ae('0x2b')]);_0x1617ff[_0x41ae('0x35')]=_[_0x41ae('0x2c')](_0x1617ff[_0x41ae('0x2a')],_0x1617ff['query']);_0x2f9680[_0x41ae('0x2d')]=_[_0x41ae('0x2c')](_0x1617ff['model'],qs[_0x41ae('0x2e')](_0x627eab[_0x41ae('0x2b')]['fields']));_0x2f9680[_0x41ae('0x2d')]=_0x2f9680[_0x41ae('0x2d')]['length']?_0x2f9680[_0x41ae('0x2d')]:_0x1617ff[_0x41ae('0x2a')];if(_0x627eab[_0x41ae('0x2b')]['includeAll']){_0x2f9680[_0x41ae('0x3d')]=[{'all':!![]}];}_0x2f9680=_[_0x41ae('0x38')]({},_0x2f9680,_0x627eab[_0x41ae('0x3a')]);return db[_0x41ae('0x3b')][_0x41ae('0x42')](_0x2f9680)[_0x41ae('0x21')](handleEntityNotFound(_0x42c58f,null))[_0x41ae('0x21')](respondWithResult(_0x42c58f,null))[_0x41ae('0x43')](handleError(_0x42c58f,null));};exports[_0x41ae('0x44')]=function(_0x551139,_0x5c551c){return db[_0x41ae('0x3b')][_0x41ae('0x44')](_0x551139[_0x41ae('0x45')],{})[_0x41ae('0x21')](respondWithResult(_0x5c551c,0xc9))[_0x41ae('0x43')](handleError(_0x5c551c,null));};exports[_0x41ae('0x20')]=function(_0x3e2f3c,_0x1d3abc){if(_0x3e2f3c[_0x41ae('0x45')]['id']){delete _0x3e2f3c[_0x41ae('0x45')]['id'];}return db['DeskConfiguration'][_0x41ae('0x42')]({'where':{'id':_0x3e2f3c[_0x41ae('0x40')]['id']}})[_0x41ae('0x21')](handleEntityNotFound(_0x1d3abc,null))[_0x41ae('0x21')](saveUpdates(_0x3e2f3c[_0x41ae('0x45')],null))[_0x41ae('0x21')](respondWithResult(_0x1d3abc,null))[_0x41ae('0x43')](handleError(_0x1d3abc,null));};exports['destroy']=function(_0x1e9411,_0x561da6){return db[_0x41ae('0x3b')][_0x41ae('0x42')]({'where':{'id':_0x1e9411[_0x41ae('0x40')]['id']}})[_0x41ae('0x21')](handleEntityNotFound(_0x561da6,null))[_0x41ae('0x21')](removeEntity(_0x561da6,null))[_0x41ae('0x43')](handleError(_0x561da6,null));};exports['getFields']=function(_0x38fca9,_0x1afa24,_0xcfe699){var _0x4d9195={};var _0x488e74={};var _0x1250fe;var _0x332d2f;return db[_0x41ae('0x3b')][_0x41ae('0x46')]({'where':{'id':_0x38fca9[_0x41ae('0x40')]['id']}})[_0x41ae('0x21')](handleEntityNotFound(_0x1afa24,null))[_0x41ae('0x21')](function(_0x22d2dd){if(_0x22d2dd){_0x1250fe=_0x22d2dd;_0x488e74[_0x41ae('0x2a')]=_[_0x41ae('0x41')](db[_0x41ae('0x47')]['rawAttributes']);_0x488e74[_0x41ae('0x2b')]=_[_0x41ae('0x41')](_0x38fca9[_0x41ae('0x2b')]);_0x488e74['filters']=_[_0x41ae('0x2c')](_0x488e74[_0x41ae('0x2a')],_0x488e74['query']);_0x4d9195['attributes']=_[_0x41ae('0x2c')](_0x488e74['model'],qs['fields'](_0x38fca9[_0x41ae('0x2b')]['fields']));_0x4d9195[_0x41ae('0x2d')]=_0x4d9195['attributes'][_0x41ae('0x2f')]?_0x4d9195[_0x41ae('0x2d')]:_0x488e74[_0x41ae('0x2a')];_0x4d9195[_0x41ae('0x32')]=qs['sort'](_0x38fca9[_0x41ae('0x2b')]['sort']);_0x4d9195[_0x41ae('0x34')]=qs[_0x41ae('0x35')](_['pick'](_0x38fca9['query'],_0x488e74[_0x41ae('0x35')]));if(_0x38fca9[_0x41ae('0x2b')][_0x41ae('0x37')]){_0x4d9195[_0x41ae('0x34')]=_[_0x41ae('0x38')](_0x4d9195['where'],{'$or':_[_0x41ae('0x48')](_0x4d9195[_0x41ae('0x2d')],function(_0x31a807){var _0x11649f={};_0x11649f[_0x31a807]={'$like':'%'+_0x38fca9[_0x41ae('0x2b')][_0x41ae('0x37')]+'%'};return _0x11649f;})});}_0x4d9195=_[_0x41ae('0x38')]({},_0x4d9195,_0x38fca9[_0x41ae('0x3a')]);return _0x1250fe[_0x41ae('0x49')](_0x4d9195);}})[_0x41ae('0x21')](function(_0x1c11c2){if(_0x1c11c2){_0x332d2f=_0x1c11c2[_0x41ae('0x2f')];if(!_0x38fca9[_0x41ae('0x2b')][_0x41ae('0x30')](_0x41ae('0x31'))){_0x4d9195[_0x41ae('0x1c')]=qs[_0x41ae('0x1c')](_0x38fca9[_0x41ae('0x2b')][_0x41ae('0x1c')]);_0x4d9195[_0x41ae('0x1a')]=qs[_0x41ae('0x1a')](_0x38fca9[_0x41ae('0x2b')][_0x41ae('0x1a')]);}return _0x1250fe['getFields'](_0x4d9195);}})[_0x41ae('0x21')](function(_0x50d4b8){if(_0x50d4b8){return _0x50d4b8?{'count':_0x332d2f,'rows':_0x50d4b8}:null;}})[_0x41ae('0x21')](respondWithResult(_0x1afa24,null))[_0x41ae('0x43')](handleError(_0x1afa24,null));};exports[_0x41ae('0x4a')]=function(_0x3f1ab3,_0x2b1a4c,_0x4058b4){var _0x32c663={};var _0x8df0a3={};var _0x371da5;var _0x2ac7a3;return db['DeskConfiguration'][_0x41ae('0x46')]({'where':{'id':_0x3f1ab3[_0x41ae('0x40')]['id']}})[_0x41ae('0x21')](handleEntityNotFound(_0x2b1a4c,null))[_0x41ae('0x21')](function(_0x1b1bd6){if(_0x1b1bd6){_0x371da5=_0x1b1bd6;_0x8df0a3['model']=_[_0x41ae('0x41')](db[_0x41ae('0x47')][_0x41ae('0x27')]);_0x8df0a3[_0x41ae('0x2b')]=_[_0x41ae('0x41')](_0x3f1ab3[_0x41ae('0x2b')]);_0x8df0a3[_0x41ae('0x35')]=_[_0x41ae('0x2c')](_0x8df0a3[_0x41ae('0x2a')],_0x8df0a3[_0x41ae('0x2b')]);_0x32c663[_0x41ae('0x2d')]=_[_0x41ae('0x2c')](_0x8df0a3['model'],qs[_0x41ae('0x2e')](_0x3f1ab3[_0x41ae('0x2b')][_0x41ae('0x2e')]));_0x32c663['attributes']=_0x32c663[_0x41ae('0x2d')][_0x41ae('0x2f')]?_0x32c663[_0x41ae('0x2d')]:_0x8df0a3['model'];_0x32c663[_0x41ae('0x32')]=qs[_0x41ae('0x33')](_0x3f1ab3['query'][_0x41ae('0x33')]);_0x32c663[_0x41ae('0x34')]=qs[_0x41ae('0x35')](_['pick'](_0x3f1ab3[_0x41ae('0x2b')],_0x8df0a3[_0x41ae('0x35')]));if(_0x3f1ab3['query']['filter']){_0x32c663[_0x41ae('0x34')]=_[_0x41ae('0x38')](_0x32c663['where'],{'$or':_[_0x41ae('0x48')](_0x32c663['attributes'],function(_0x185655){var _0x26ae67={};_0x26ae67[_0x185655]={'$like':'%'+_0x3f1ab3[_0x41ae('0x2b')]['filter']+'%'};return _0x26ae67;})});}_0x32c663=_[_0x41ae('0x38')]({},_0x32c663,_0x3f1ab3[_0x41ae('0x3a')]);return _0x371da5[_0x41ae('0x4a')](_0x32c663);}})[_0x41ae('0x21')](function(_0x33da41){if(_0x33da41){_0x2ac7a3=_0x33da41['length'];if(!_0x3f1ab3['query']['hasOwnProperty'](_0x41ae('0x31'))){_0x32c663[_0x41ae('0x1c')]=qs[_0x41ae('0x1c')](_0x3f1ab3[_0x41ae('0x2b')][_0x41ae('0x1c')]);_0x32c663[_0x41ae('0x1a')]=qs[_0x41ae('0x1a')](_0x3f1ab3['query'][_0x41ae('0x1a')]);}return _0x371da5[_0x41ae('0x4a')](_0x32c663);}})[_0x41ae('0x21')](function(_0x52a6bc){if(_0x52a6bc){return _0x52a6bc?{'count':_0x2ac7a3,'rows':_0x52a6bc}:null;}})[_0x41ae('0x21')](respondWithResult(_0x2b1a4c,null))[_0x41ae('0x43')](handleError(_0x2b1a4c,null));};exports['getDescriptions']=function(_0x316613,_0x20ce8f,_0x8d40b7){var _0x35b2a0={};var _0x13282c={};var _0x578d61;var _0x17c8ce;return db['DeskConfiguration'][_0x41ae('0x46')]({'where':{'id':_0x316613[_0x41ae('0x40')]['id']}})[_0x41ae('0x21')](handleEntityNotFound(_0x20ce8f,null))[_0x41ae('0x21')](function(_0xfea84){if(_0xfea84){_0x578d61=_0xfea84;_0x13282c[_0x41ae('0x2a')]=_[_0x41ae('0x41')](db[_0x41ae('0x47')][_0x41ae('0x27')]);_0x13282c[_0x41ae('0x2b')]=_[_0x41ae('0x41')](_0x316613[_0x41ae('0x2b')]);_0x13282c[_0x41ae('0x35')]=_[_0x41ae('0x2c')](_0x13282c[_0x41ae('0x2a')],_0x13282c[_0x41ae('0x2b')]);_0x35b2a0[_0x41ae('0x2d')]=_[_0x41ae('0x2c')](_0x13282c['model'],qs[_0x41ae('0x2e')](_0x316613[_0x41ae('0x2b')]['fields']));_0x35b2a0[_0x41ae('0x2d')]=_0x35b2a0['attributes'][_0x41ae('0x2f')]?_0x35b2a0[_0x41ae('0x2d')]:_0x13282c[_0x41ae('0x2a')];_0x35b2a0[_0x41ae('0x32')]=qs[_0x41ae('0x33')](_0x316613['query'][_0x41ae('0x33')]);_0x35b2a0[_0x41ae('0x34')]=qs['filters'](_[_0x41ae('0x36')](_0x316613[_0x41ae('0x2b')],_0x13282c[_0x41ae('0x35')]));if(_0x316613[_0x41ae('0x2b')][_0x41ae('0x37')]){_0x35b2a0[_0x41ae('0x34')]=_[_0x41ae('0x38')](_0x35b2a0[_0x41ae('0x34')],{'$or':_['map'](_0x35b2a0['attributes'],function(_0x894bd0){var _0x499697={};_0x499697[_0x894bd0]={'$like':'%'+_0x316613[_0x41ae('0x2b')]['filter']+'%'};return _0x499697;})});}_0x35b2a0=_[_0x41ae('0x38')]({},_0x35b2a0,_0x316613[_0x41ae('0x3a')]);return _0x578d61[_0x41ae('0x4b')](_0x35b2a0);}})[_0x41ae('0x21')](function(_0x2242f2){if(_0x2242f2){_0x17c8ce=_0x2242f2[_0x41ae('0x2f')];if(!_0x316613[_0x41ae('0x2b')]['hasOwnProperty'](_0x41ae('0x31'))){_0x35b2a0[_0x41ae('0x1c')]=qs['limit'](_0x316613['query']['limit']);_0x35b2a0[_0x41ae('0x1a')]=qs[_0x41ae('0x1a')](_0x316613[_0x41ae('0x2b')][_0x41ae('0x1a')]);}return _0x578d61[_0x41ae('0x4b')](_0x35b2a0);}})[_0x41ae('0x21')](function(_0x20b29b){if(_0x20b29b){return _0x20b29b?{'count':_0x17c8ce,'rows':_0x20b29b}:null;}})[_0x41ae('0x21')](respondWithResult(_0x20ce8f,null))[_0x41ae('0x43')](handleError(_0x20ce8f,null));};exports[_0x41ae('0x4c')]=function(_0x53008c,_0x19e18d,_0x579101){var _0x13fc4b={};var _0x36c491={};var _0x2e1562;var _0x1edda4;return db['DeskConfiguration'][_0x41ae('0x46')]({'where':{'id':_0x53008c[_0x41ae('0x40')]['id']}})['then'](handleEntityNotFound(_0x19e18d,null))[_0x41ae('0x21')](function(_0xe63bf6){if(_0xe63bf6){_0x2e1562=_0xe63bf6;_0x36c491['model']=_['keys'](db[_0x41ae('0x4d')][_0x41ae('0x27')]);_0x36c491[_0x41ae('0x2b')]=_['keys'](_0x53008c[_0x41ae('0x2b')]);_0x36c491[_0x41ae('0x35')]=_[_0x41ae('0x2c')](_0x36c491[_0x41ae('0x2a')],_0x36c491[_0x41ae('0x2b')]);_0x13fc4b[_0x41ae('0x2d')]=_[_0x41ae('0x2c')](_0x36c491['model'],qs[_0x41ae('0x2e')](_0x53008c[_0x41ae('0x2b')]['fields']));_0x13fc4b['attributes']=_0x13fc4b[_0x41ae('0x2d')][_0x41ae('0x2f')]?_0x13fc4b[_0x41ae('0x2d')]:_0x36c491['model'];_0x13fc4b[_0x41ae('0x32')]=qs[_0x41ae('0x33')](_0x53008c[_0x41ae('0x2b')][_0x41ae('0x33')]);_0x13fc4b['where']=qs[_0x41ae('0x35')](_[_0x41ae('0x36')](_0x53008c[_0x41ae('0x2b')],_0x36c491[_0x41ae('0x35')]));if(_0x53008c[_0x41ae('0x2b')][_0x41ae('0x37')]){_0x13fc4b[_0x41ae('0x34')]=_['merge'](_0x13fc4b[_0x41ae('0x34')],{'$or':_[_0x41ae('0x48')](_0x13fc4b[_0x41ae('0x2d')],function(_0x4e8e5b){var _0x471507={};_0x471507[_0x4e8e5b]={'$like':'%'+_0x53008c[_0x41ae('0x2b')][_0x41ae('0x37')]+'%'};return _0x471507;})});}_0x13fc4b=_['merge']({},_0x13fc4b,_0x53008c[_0x41ae('0x3a')]);return _0x2e1562[_0x41ae('0x4c')](_0x13fc4b);}})['then'](function(_0x4b135b){if(_0x4b135b){_0x1edda4=_0x4b135b[_0x41ae('0x2f')];if(!_0x53008c[_0x41ae('0x2b')][_0x41ae('0x30')](_0x41ae('0x31'))){_0x13fc4b[_0x41ae('0x1c')]=qs[_0x41ae('0x1c')](_0x53008c[_0x41ae('0x2b')]['limit']);_0x13fc4b[_0x41ae('0x1a')]=qs['offset'](_0x53008c[_0x41ae('0x2b')]['offset']);}return _0x2e1562[_0x41ae('0x4c')](_0x13fc4b);}})['then'](function(_0x513126){if(_0x513126){return _0x513126?{'count':_0x1edda4,'rows':_0x513126}:null;}})[_0x41ae('0x21')](respondWithResult(_0x19e18d,null))[_0x41ae('0x43')](handleError(_0x19e18d,null));};exports[_0x41ae('0x4e')]=function(_0xff524f,_0x1bd5b7,_0x1b19cf){if(_0xff524f['body']['id']){delete _0xff524f[_0x41ae('0x45')]['id'];}return db[_0x41ae('0x3b')][_0x41ae('0x46')]({'where':{'id':_0xff524f[_0x41ae('0x40')]['id']}})[_0x41ae('0x21')](handleEntityNotFound(_0x1bd5b7,null))['then'](function(_0x1af92f){if(_0x1af92f){return _0x1af92f[_0x41ae('0x4e')](_0xff524f[_0x41ae('0x45')][_0x41ae('0x4f')]||[]);}return null;})[_0x41ae('0x21')](respondWithResult(_0x1bd5b7,null))[_0x41ae('0x43')](handleError(_0x1bd5b7,null));}; \ No newline at end of file +var _0x02fd=['count','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','DeskConfiguration','rawAttributes','fieldName','type','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','include','findAll','catch','show','keys','includeAll','find','create','body','params','getFields','DeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x02fd,0xdd));var _0xd02f=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x02fd[_0xc8a931];return _0x28bd27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd02f('0x0'));var zipdir=require(_0xd02f('0x1'));var jsonpatch=require(_0xd02f('0x2'));var rp=require(_0xd02f('0x3'));var moment=require(_0xd02f('0x4'));var BPromise=require(_0xd02f('0x5'));var Mustache=require(_0xd02f('0x6'));var util=require(_0xd02f('0x7'));var path=require(_0xd02f('0x8'));var sox=require(_0xd02f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd02f('0xa'));var _=require(_0xd02f('0xb'));var squel=require(_0xd02f('0xc'));var crypto=require('crypto');var jsforce=require(_0xd02f('0xd'));var deskjs=require(_0xd02f('0xe'));var toCsv=require(_0xd02f('0xf'));var querystring=require(_0xd02f('0x10'));var Papa=require('papaparse');var Redis=require(_0xd02f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd02f('0x12'));var as=require(_0xd02f('0x13'));var hardwareService=require(_0xd02f('0x14'));var logger=require('../../config/logger')(_0xd02f('0x15'));var utils=require(_0xd02f('0x16'));var config=require(_0xd02f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd02f('0x18'))['db'];function respondWithStatusCode(_0x45e837,_0xe20535){_0xe20535=_0xe20535||0xcc;return function(_0x1b504b){if(_0x1b504b){return _0x45e837[_0xd02f('0x19')](_0xe20535);}return _0x45e837['status'](_0xe20535)[_0xd02f('0x1a')]();};}function respondWithResult(_0x3bd846,_0x1f1ad9){_0x1f1ad9=_0x1f1ad9||0xc8;return function(_0x478aa5){if(_0x478aa5){return _0x3bd846['status'](_0x1f1ad9)[_0xd02f('0x1b')](_0x478aa5);}};}function respondWithFilteredResult(_0x8998fc,_0x1bda33){return function(_0x5ca342){if(_0x5ca342){var _0x177717=typeof _0x1bda33[_0xd02f('0x1c')]===_0xd02f('0x1d')&&typeof _0x1bda33[_0xd02f('0x1e')]===_0xd02f('0x1d');var _0x61562d=_0x5ca342[_0xd02f('0x1f')];var _0x28e92e=_0x177717?0x0:_0x1bda33[_0xd02f('0x1c')];var _0x37b5f9=_0x177717?_0x5ca342[_0xd02f('0x1f')]:_0x1bda33[_0xd02f('0x1c')]+_0x1bda33['limit'];var _0x256b33;if(_0x37b5f9>=_0x61562d){_0x37b5f9=_0x61562d;_0x256b33=0xc8;}else{_0x256b33=0xce;}_0x8998fc['status'](_0x256b33);return _0x8998fc[_0xd02f('0x20')](_0xd02f('0x21'),_0x28e92e+'-'+_0x37b5f9+'/'+_0x61562d)[_0xd02f('0x1b')](_0x5ca342);}return null;};}function patchUpdates(_0x19a010){return function(_0x1c95c2){try{jsonpatch[_0xd02f('0x22')](_0x1c95c2,_0x19a010,!![]);}catch(_0x1fd9f0){return BPromise[_0xd02f('0x23')](_0x1fd9f0);}return _0x1c95c2[_0xd02f('0x24')]();};}function saveUpdates(_0x1b6dab,_0x2f4dd0){return function(_0x1d0d6a){if(_0x1d0d6a){return _0x1d0d6a[_0xd02f('0x25')](_0x1b6dab)[_0xd02f('0x26')](function(_0x2bf0eb){return _0x2bf0eb;});}return null;};}function removeEntity(_0x3696fc,_0x5a3b57){return function(_0x491561){if(_0x491561){return _0x491561[_0xd02f('0x27')]()[_0xd02f('0x26')](function(){_0x3696fc[_0xd02f('0x28')](0xcc)[_0xd02f('0x1a')]();});}};}function handleEntityNotFound(_0x32dee4,_0x2c7353){return function(_0x4fa5c0){if(!_0x4fa5c0){_0x32dee4['sendStatus'](0x194);}return _0x4fa5c0;};}function handleError(_0x34515e,_0x410474){_0x410474=_0x410474||0x1f4;return function(_0x52241d){logger[_0xd02f('0x29')](_0x52241d[_0xd02f('0x2a')]);if(_0x52241d[_0xd02f('0x2b')]){delete _0x52241d[_0xd02f('0x2b')];}_0x34515e[_0xd02f('0x28')](_0x410474)['send'](_0x52241d);};}exports['index']=function(_0x35536e,_0x250307){var _0x2d0e25={},_0x85a42={},_0x201e38={'count':0x0,'rows':[]};var _0x5f25aa=_['map'](db[_0xd02f('0x2c')][_0xd02f('0x2d')],function(_0xfdf605){return{'name':_0xfdf605[_0xd02f('0x2e')],'type':_0xfdf605[_0xd02f('0x2f')]['key']};});_0x85a42['model']=_[_0xd02f('0x30')](_0x5f25aa,'name');_0x85a42[_0xd02f('0x31')]=_['keys'](_0x35536e['query']);_0x85a42['filters']=_[_0xd02f('0x32')](_0x85a42[_0xd02f('0x33')],_0x85a42[_0xd02f('0x31')]);_0x2d0e25[_0xd02f('0x34')]=_[_0xd02f('0x32')](_0x85a42[_0xd02f('0x33')],qs[_0xd02f('0x35')](_0x35536e[_0xd02f('0x31')][_0xd02f('0x35')]));_0x2d0e25['attributes']=_0x2d0e25[_0xd02f('0x34')][_0xd02f('0x36')]?_0x2d0e25[_0xd02f('0x34')]:_0x85a42[_0xd02f('0x33')];if(!_0x35536e[_0xd02f('0x31')][_0xd02f('0x37')](_0xd02f('0x38'))){_0x2d0e25[_0xd02f('0x1e')]=qs['limit'](_0x35536e[_0xd02f('0x31')][_0xd02f('0x1e')]);_0x2d0e25[_0xd02f('0x1c')]=qs[_0xd02f('0x1c')](_0x35536e[_0xd02f('0x31')][_0xd02f('0x1c')]);}_0x2d0e25[_0xd02f('0x39')]=qs[_0xd02f('0x3a')](_0x35536e[_0xd02f('0x31')]['sort']);_0x2d0e25[_0xd02f('0x3b')]=qs[_0xd02f('0x3c')](_[_0xd02f('0x3d')](_0x35536e[_0xd02f('0x31')],_0x85a42[_0xd02f('0x3c')]),_0x5f25aa);if(_0x35536e['query']['filter']){_0x2d0e25[_0xd02f('0x3b')]=_[_0xd02f('0x3e')](_0x2d0e25['where'],{'$or':_[_0xd02f('0x30')](_0x5f25aa,function(_0x44ac83){if(_0x44ac83['type']!=='VIRTUAL'){var _0x10278a={};_0x10278a[_0x44ac83[_0xd02f('0x2b')]]={'$like':'%'+_0x35536e[_0xd02f('0x31')][_0xd02f('0x3f')]+'%'};return _0x10278a;}})});}_0x2d0e25=_[_0xd02f('0x3e')]({},_0x2d0e25,_0x35536e[_0xd02f('0x40')]);var _0x77b121={'where':_0x2d0e25[_0xd02f('0x3b')]};return db[_0xd02f('0x2c')][_0xd02f('0x1f')](_0x77b121)['then'](function(_0x4d1572){_0x201e38[_0xd02f('0x1f')]=_0x4d1572;if(_0x35536e[_0xd02f('0x31')]['includeAll']){_0x2d0e25[_0xd02f('0x41')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xd02f('0x42')](_0x2d0e25);})['then'](function(_0x2cfa40){_0x201e38['rows']=_0x2cfa40;return _0x201e38;})[_0xd02f('0x26')](respondWithFilteredResult(_0x250307,_0x2d0e25))[_0xd02f('0x43')](handleError(_0x250307,null));};exports[_0xd02f('0x44')]=function(_0x5d01c0,_0x527ec2){var _0x3b1486={'raw':![],'where':{'id':_0x5d01c0['params']['id']}},_0x3ff121={};_0x3ff121[_0xd02f('0x33')]=_[_0xd02f('0x45')](db[_0xd02f('0x2c')][_0xd02f('0x2d')]);_0x3ff121['query']=_[_0xd02f('0x45')](_0x5d01c0[_0xd02f('0x31')]);_0x3ff121[_0xd02f('0x3c')]=_[_0xd02f('0x32')](_0x3ff121[_0xd02f('0x33')],_0x3ff121[_0xd02f('0x31')]);_0x3b1486[_0xd02f('0x34')]=_['intersection'](_0x3ff121[_0xd02f('0x33')],qs[_0xd02f('0x35')](_0x5d01c0[_0xd02f('0x31')]['fields']));_0x3b1486[_0xd02f('0x34')]=_0x3b1486[_0xd02f('0x34')][_0xd02f('0x36')]?_0x3b1486['attributes']:_0x3ff121[_0xd02f('0x33')];if(_0x5d01c0[_0xd02f('0x31')][_0xd02f('0x46')]){_0x3b1486[_0xd02f('0x41')]=[{'all':!![]}];}_0x3b1486=_[_0xd02f('0x3e')]({},_0x3b1486,_0x5d01c0[_0xd02f('0x40')]);return db['DeskConfiguration'][_0xd02f('0x47')](_0x3b1486)['then'](handleEntityNotFound(_0x527ec2,null))['then'](respondWithResult(_0x527ec2,null))[_0xd02f('0x43')](handleError(_0x527ec2,null));};exports['create']=function(_0x3eb732,_0x2cf800){return db['DeskConfiguration'][_0xd02f('0x48')](_0x3eb732[_0xd02f('0x49')],{})[_0xd02f('0x26')](respondWithResult(_0x2cf800,0xc9))[_0xd02f('0x43')](handleError(_0x2cf800,null));};exports[_0xd02f('0x25')]=function(_0x550160,_0xf0a1e1){if(_0x550160['body']['id']){delete _0x550160['body']['id'];}return db[_0xd02f('0x2c')][_0xd02f('0x47')]({'where':{'id':_0x550160[_0xd02f('0x4a')]['id']}})[_0xd02f('0x26')](handleEntityNotFound(_0xf0a1e1,null))[_0xd02f('0x26')](saveUpdates(_0x550160[_0xd02f('0x49')],null))[_0xd02f('0x26')](respondWithResult(_0xf0a1e1,null))[_0xd02f('0x43')](handleError(_0xf0a1e1,null));};exports[_0xd02f('0x27')]=function(_0x2cd32e,_0x224ac1){return db[_0xd02f('0x2c')]['find']({'where':{'id':_0x2cd32e['params']['id']}})[_0xd02f('0x26')](handleEntityNotFound(_0x224ac1,null))[_0xd02f('0x26')](removeEntity(_0x224ac1,null))['catch'](handleError(_0x224ac1,null));};exports['getFields']=function(_0x5c9c60,_0x9b9b0f,_0x329146){var _0x466cdb={};var _0x57f1c1={};var _0x1b357b;var _0x5c1940;return db[_0xd02f('0x2c')]['findOne']({'where':{'id':_0x5c9c60['params']['id']}})['then'](handleEntityNotFound(_0x9b9b0f,null))[_0xd02f('0x26')](function(_0x5f04e5){if(_0x5f04e5){_0x1b357b=_0x5f04e5;_0x57f1c1[_0xd02f('0x33')]=_[_0xd02f('0x45')](db['DeskField'][_0xd02f('0x2d')]);_0x57f1c1[_0xd02f('0x31')]=_[_0xd02f('0x45')](_0x5c9c60[_0xd02f('0x31')]);_0x57f1c1[_0xd02f('0x3c')]=_[_0xd02f('0x32')](_0x57f1c1[_0xd02f('0x33')],_0x57f1c1[_0xd02f('0x31')]);_0x466cdb['attributes']=_[_0xd02f('0x32')](_0x57f1c1['model'],qs[_0xd02f('0x35')](_0x5c9c60[_0xd02f('0x31')][_0xd02f('0x35')]));_0x466cdb[_0xd02f('0x34')]=_0x466cdb[_0xd02f('0x34')][_0xd02f('0x36')]?_0x466cdb[_0xd02f('0x34')]:_0x57f1c1[_0xd02f('0x33')];_0x466cdb[_0xd02f('0x39')]=qs[_0xd02f('0x3a')](_0x5c9c60[_0xd02f('0x31')][_0xd02f('0x3a')]);_0x466cdb[_0xd02f('0x3b')]=qs[_0xd02f('0x3c')](_[_0xd02f('0x3d')](_0x5c9c60[_0xd02f('0x31')],_0x57f1c1[_0xd02f('0x3c')]));if(_0x5c9c60[_0xd02f('0x31')]['filter']){_0x466cdb['where']=_[_0xd02f('0x3e')](_0x466cdb[_0xd02f('0x3b')],{'$or':_['map'](_0x466cdb[_0xd02f('0x34')],function(_0x1864f8){var _0x52b723={};_0x52b723[_0x1864f8]={'$like':'%'+_0x5c9c60[_0xd02f('0x31')]['filter']+'%'};return _0x52b723;})});}_0x466cdb=_[_0xd02f('0x3e')]({},_0x466cdb,_0x5c9c60[_0xd02f('0x40')]);return _0x1b357b['getFields'](_0x466cdb);}})[_0xd02f('0x26')](function(_0x25758f){if(_0x25758f){_0x5c1940=_0x25758f[_0xd02f('0x36')];if(!_0x5c9c60[_0xd02f('0x31')][_0xd02f('0x37')](_0xd02f('0x38'))){_0x466cdb[_0xd02f('0x1e')]=qs[_0xd02f('0x1e')](_0x5c9c60[_0xd02f('0x31')][_0xd02f('0x1e')]);_0x466cdb[_0xd02f('0x1c')]=qs[_0xd02f('0x1c')](_0x5c9c60[_0xd02f('0x31')][_0xd02f('0x1c')]);}return _0x1b357b[_0xd02f('0x4b')](_0x466cdb);}})[_0xd02f('0x26')](function(_0x359001){if(_0x359001){return _0x359001?{'count':_0x5c1940,'rows':_0x359001}:null;}})[_0xd02f('0x26')](respondWithResult(_0x9b9b0f,null))['catch'](handleError(_0x9b9b0f,null));};exports['getSubjects']=function(_0x2f966b,_0x428e62,_0x30869b){var _0x16b653={};var _0x1f8adc={};var _0x28ada9;var _0x32837b;return db['DeskConfiguration']['findOne']({'where':{'id':_0x2f966b[_0xd02f('0x4a')]['id']}})[_0xd02f('0x26')](handleEntityNotFound(_0x428e62,null))[_0xd02f('0x26')](function(_0x13e2cc){if(_0x13e2cc){_0x28ada9=_0x13e2cc;_0x1f8adc['model']=_[_0xd02f('0x45')](db[_0xd02f('0x4c')][_0xd02f('0x2d')]);_0x1f8adc[_0xd02f('0x31')]=_[_0xd02f('0x45')](_0x2f966b[_0xd02f('0x31')]);_0x1f8adc[_0xd02f('0x3c')]=_['intersection'](_0x1f8adc[_0xd02f('0x33')],_0x1f8adc[_0xd02f('0x31')]);_0x16b653[_0xd02f('0x34')]=_[_0xd02f('0x32')](_0x1f8adc[_0xd02f('0x33')],qs[_0xd02f('0x35')](_0x2f966b['query'][_0xd02f('0x35')]));_0x16b653[_0xd02f('0x34')]=_0x16b653[_0xd02f('0x34')][_0xd02f('0x36')]?_0x16b653[_0xd02f('0x34')]:_0x1f8adc[_0xd02f('0x33')];_0x16b653[_0xd02f('0x39')]=qs[_0xd02f('0x3a')](_0x2f966b[_0xd02f('0x31')][_0xd02f('0x3a')]);_0x16b653[_0xd02f('0x3b')]=qs['filters'](_[_0xd02f('0x3d')](_0x2f966b[_0xd02f('0x31')],_0x1f8adc[_0xd02f('0x3c')]));if(_0x2f966b[_0xd02f('0x31')][_0xd02f('0x3f')]){_0x16b653[_0xd02f('0x3b')]=_['merge'](_0x16b653[_0xd02f('0x3b')],{'$or':_[_0xd02f('0x30')](_0x16b653[_0xd02f('0x34')],function(_0x1cfc56){var _0x35b568={};_0x35b568[_0x1cfc56]={'$like':'%'+_0x2f966b[_0xd02f('0x31')][_0xd02f('0x3f')]+'%'};return _0x35b568;})});}_0x16b653=_[_0xd02f('0x3e')]({},_0x16b653,_0x2f966b[_0xd02f('0x40')]);return _0x28ada9[_0xd02f('0x4d')](_0x16b653);}})[_0xd02f('0x26')](function(_0x220c36){if(_0x220c36){_0x32837b=_0x220c36[_0xd02f('0x36')];if(!_0x2f966b[_0xd02f('0x31')]['hasOwnProperty'](_0xd02f('0x38'))){_0x16b653[_0xd02f('0x1e')]=qs[_0xd02f('0x1e')](_0x2f966b[_0xd02f('0x31')][_0xd02f('0x1e')]);_0x16b653[_0xd02f('0x1c')]=qs[_0xd02f('0x1c')](_0x2f966b[_0xd02f('0x31')][_0xd02f('0x1c')]);}return _0x28ada9['getSubjects'](_0x16b653);}})[_0xd02f('0x26')](function(_0x112d3a){if(_0x112d3a){return _0x112d3a?{'count':_0x32837b,'rows':_0x112d3a}:null;}})[_0xd02f('0x26')](respondWithResult(_0x428e62,null))[_0xd02f('0x43')](handleError(_0x428e62,null));};exports['getDescriptions']=function(_0x21b400,_0x2fc6c3,_0xfd9dcb){var _0x23afff={};var _0x10660f={};var _0x4fbba1;var _0x297e0b;return db[_0xd02f('0x2c')][_0xd02f('0x4e')]({'where':{'id':_0x21b400[_0xd02f('0x4a')]['id']}})[_0xd02f('0x26')](handleEntityNotFound(_0x2fc6c3,null))[_0xd02f('0x26')](function(_0x262952){if(_0x262952){_0x4fbba1=_0x262952;_0x10660f[_0xd02f('0x33')]=_[_0xd02f('0x45')](db[_0xd02f('0x4c')]['rawAttributes']);_0x10660f[_0xd02f('0x31')]=_[_0xd02f('0x45')](_0x21b400[_0xd02f('0x31')]);_0x10660f['filters']=_[_0xd02f('0x32')](_0x10660f[_0xd02f('0x33')],_0x10660f[_0xd02f('0x31')]);_0x23afff[_0xd02f('0x34')]=_[_0xd02f('0x32')](_0x10660f[_0xd02f('0x33')],qs[_0xd02f('0x35')](_0x21b400[_0xd02f('0x31')][_0xd02f('0x35')]));_0x23afff[_0xd02f('0x34')]=_0x23afff[_0xd02f('0x34')][_0xd02f('0x36')]?_0x23afff[_0xd02f('0x34')]:_0x10660f['model'];_0x23afff['order']=qs['sort'](_0x21b400[_0xd02f('0x31')][_0xd02f('0x3a')]);_0x23afff[_0xd02f('0x3b')]=qs[_0xd02f('0x3c')](_[_0xd02f('0x3d')](_0x21b400[_0xd02f('0x31')],_0x10660f[_0xd02f('0x3c')]));if(_0x21b400[_0xd02f('0x31')][_0xd02f('0x3f')]){_0x23afff[_0xd02f('0x3b')]=_['merge'](_0x23afff['where'],{'$or':_['map'](_0x23afff[_0xd02f('0x34')],function(_0x2c6a9e){var _0x496a2a={};_0x496a2a[_0x2c6a9e]={'$like':'%'+_0x21b400[_0xd02f('0x31')][_0xd02f('0x3f')]+'%'};return _0x496a2a;})});}_0x23afff=_[_0xd02f('0x3e')]({},_0x23afff,_0x21b400['options']);return _0x4fbba1[_0xd02f('0x4f')](_0x23afff);}})[_0xd02f('0x26')](function(_0x4bf0b1){if(_0x4bf0b1){_0x297e0b=_0x4bf0b1[_0xd02f('0x36')];if(!_0x21b400[_0xd02f('0x31')]['hasOwnProperty']('nolimit')){_0x23afff['limit']=qs[_0xd02f('0x1e')](_0x21b400['query'][_0xd02f('0x1e')]);_0x23afff[_0xd02f('0x1c')]=qs[_0xd02f('0x1c')](_0x21b400[_0xd02f('0x31')]['offset']);}return _0x4fbba1['getDescriptions'](_0x23afff);}})['then'](function(_0x513ae2){if(_0x513ae2){return _0x513ae2?{'count':_0x297e0b,'rows':_0x513ae2}:null;}})[_0xd02f('0x26')](respondWithResult(_0x2fc6c3,null))[_0xd02f('0x43')](handleError(_0x2fc6c3,null));};exports[_0xd02f('0x50')]=function(_0x393504,_0x1ab225,_0x392a7d){var _0x50d087={};var _0x4415f2={};var _0x2ba367;var _0x401268;return db['DeskConfiguration'][_0xd02f('0x4e')]({'where':{'id':_0x393504[_0xd02f('0x4a')]['id']}})[_0xd02f('0x26')](handleEntityNotFound(_0x1ab225,null))[_0xd02f('0x26')](function(_0x4a8cd9){if(_0x4a8cd9){_0x2ba367=_0x4a8cd9;_0x4415f2[_0xd02f('0x33')]=_[_0xd02f('0x45')](db[_0xd02f('0x51')][_0xd02f('0x2d')]);_0x4415f2['query']=_[_0xd02f('0x45')](_0x393504['query']);_0x4415f2[_0xd02f('0x3c')]=_[_0xd02f('0x32')](_0x4415f2[_0xd02f('0x33')],_0x4415f2[_0xd02f('0x31')]);_0x50d087[_0xd02f('0x34')]=_[_0xd02f('0x32')](_0x4415f2[_0xd02f('0x33')],qs[_0xd02f('0x35')](_0x393504['query'][_0xd02f('0x35')]));_0x50d087[_0xd02f('0x34')]=_0x50d087['attributes']['length']?_0x50d087[_0xd02f('0x34')]:_0x4415f2['model'];_0x50d087['order']=qs['sort'](_0x393504['query'][_0xd02f('0x3a')]);_0x50d087[_0xd02f('0x3b')]=qs[_0xd02f('0x3c')](_[_0xd02f('0x3d')](_0x393504[_0xd02f('0x31')],_0x4415f2[_0xd02f('0x3c')]));if(_0x393504[_0xd02f('0x31')][_0xd02f('0x3f')]){_0x50d087[_0xd02f('0x3b')]=_['merge'](_0x50d087['where'],{'$or':_[_0xd02f('0x30')](_0x50d087[_0xd02f('0x34')],function(_0x7d32e6){var _0x41d828={};_0x41d828[_0x7d32e6]={'$like':'%'+_0x393504[_0xd02f('0x31')][_0xd02f('0x3f')]+'%'};return _0x41d828;})});}_0x50d087=_[_0xd02f('0x3e')]({},_0x50d087,_0x393504[_0xd02f('0x40')]);return _0x2ba367[_0xd02f('0x50')](_0x50d087);}})[_0xd02f('0x26')](function(_0x429f4f){if(_0x429f4f){_0x401268=_0x429f4f[_0xd02f('0x36')];if(!_0x393504['query']['hasOwnProperty'](_0xd02f('0x38'))){_0x50d087[_0xd02f('0x1e')]=qs[_0xd02f('0x1e')](_0x393504[_0xd02f('0x31')][_0xd02f('0x1e')]);_0x50d087[_0xd02f('0x1c')]=qs['offset'](_0x393504[_0xd02f('0x31')]['offset']);}return _0x2ba367['getTags'](_0x50d087);}})[_0xd02f('0x26')](function(_0x1d5d9a){if(_0x1d5d9a){return _0x1d5d9a?{'count':_0x401268,'rows':_0x1d5d9a}:null;}})[_0xd02f('0x26')](respondWithResult(_0x1ab225,null))[_0xd02f('0x43')](handleError(_0x1ab225,null));};exports[_0xd02f('0x52')]=function(_0x16d217,_0x44befc,_0x2e541c){if(_0x16d217[_0xd02f('0x49')]['id']){delete _0x16d217[_0xd02f('0x49')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x16d217[_0xd02f('0x4a')]['id']}})[_0xd02f('0x26')](handleEntityNotFound(_0x44befc,null))['then'](function(_0x3ee399){if(_0x3ee399){return _0x3ee399[_0xd02f('0x52')](_0x16d217[_0xd02f('0x49')][_0xd02f('0x53')]||[]);}return null;})[_0xd02f('0x26')](respondWithResult(_0x44befc,null))[_0xd02f('0x43')](handleError(_0x44befc,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 147418f..57b2b2b 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 _0xce93=['moment','bluebird','request-promise','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xce93,0x8b));var _0x3ce9=function(_0x3ba938,_0x27414d){_0x3ba938=_0x3ba938-0x0;var _0x2aabff=_0xce93[_0x3ba938];return _0x2aabff;};'use strict';var _=require(_0x3ce9('0x0'));var util=require(_0x3ce9('0x1'));var logger=require(_0x3ce9('0x2'))(_0x3ce9('0x3'));var moment=require(_0x3ce9('0x4'));var BPromise=require(_0x3ce9('0x5'));var rp=require(_0x3ce9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ce9('0x7'));var config=require('../../config/environment');var attributes=require(_0x3ce9('0x8'));module[_0x3ce9('0x9')]=function(_0x487f1b,_0x19d491){return _0x487f1b[_0x3ce9('0xa')](_0x3ce9('0xb'),attributes,{'tableName':_0x3ce9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad72=['int_desk_configurations','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./intDeskConfiguration.attributes','define','DeskConfiguration'];(function(_0x1f4ddb,_0x165b05){var _0x247b42=function(_0x297278){while(--_0x297278){_0x1f4ddb['push'](_0x1f4ddb['shift']());}};_0x247b42(++_0x165b05);}(_0xad72,0x198));var _0x2ad7=function(_0xe0abb5,_0x164bc6){_0xe0abb5=_0xe0abb5-0x0;var _0x19d6be=_0xad72[_0xe0abb5];return _0x19d6be;};'use strict';var _=require(_0x2ad7('0x0'));var util=require(_0x2ad7('0x1'));var logger=require(_0x2ad7('0x2'))('api');var moment=require(_0x2ad7('0x3'));var BPromise=require(_0x2ad7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ad7('0x5'));var rimraf=require(_0x2ad7('0x6'));var config=require('../../config/environment');var attributes=require(_0x2ad7('0x7'));module['exports']=function(_0x5cb3cc,_0x5b3c1a){return _0x5cb3cc[_0x2ad7('0x8')](_0x2ad7('0x9'),attributes,{'tableName':_0x2ad7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index dfd4ab0..2eb4031 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 _0xd291=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd291,0xae));var _0x1d29=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd291[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1d29('0x0'));var util=require(_0x1d29('0x1'));var moment=require(_0x1d29('0x2'));var BPromise=require(_0x1d29('0x3'));var rs=require(_0x1d29('0x4'));var fs=require('fs');var Redis=require(_0x1d29('0x5'));var db=require(_0x1d29('0x6'))['db'];var utils=require(_0x1d29('0x7'));var logger=require(_0x1d29('0x8'))(_0x1d29('0x9'));var config=require(_0x1d29('0xa'));var jayson=require(_0x1d29('0xb'));var client=jayson[_0x1d29('0xc')][_0x1d29('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x98cd3a,_0x226bcb,_0x5da133){return new BPromise(function(_0x43c5e1,_0x3c3336){return client['request'](_0x98cd3a,_0x5da133)['then'](function(_0x420a41){logger[_0x1d29('0xe')](_0x1d29('0xf'),_0x226bcb,'request\x20sent');logger[_0x1d29('0x10')](_0x1d29('0x11'),_0x226bcb,_0x1d29('0x12'),JSON[_0x1d29('0x13')](_0x420a41));if(_0x420a41[_0x1d29('0x14')]){if(_0x420a41[_0x1d29('0x14')][_0x1d29('0x15')]===0x1f4){logger[_0x1d29('0x14')](_0x1d29('0xf'),_0x226bcb,_0x420a41['error'][_0x1d29('0x16')]);return _0x3c3336(_0x420a41[_0x1d29('0x14')]['message']);}logger['error'](_0x1d29('0xf'),_0x226bcb,_0x420a41[_0x1d29('0x14')][_0x1d29('0x16')]);return _0x43c5e1(_0x420a41[_0x1d29('0x14')][_0x1d29('0x16')]);}else{logger[_0x1d29('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x226bcb,_0x1d29('0x12'));_0x43c5e1(_0x420a41[_0x1d29('0x17')][_0x1d29('0x16')]);}})[_0x1d29('0x18')](function(_0xdec7dd){logger[_0x1d29('0x14')](_0x1d29('0xf'),_0x226bcb,_0xdec7dd);_0x3c3336(_0xdec7dd);});});} \ No newline at end of file +var _0x3166=['then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3166,0xbb));var _0x6316=function(_0x386797,_0xea2482){_0x386797=_0x386797-0x0;var _0x1fa5d6=_0x3166[_0x386797];return _0x1fa5d6;};'use strict';var _=require('lodash');var util=require(_0x6316('0x0'));var moment=require(_0x6316('0x1'));var BPromise=require(_0x6316('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6316('0x3'));var db=require(_0x6316('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6316('0x5'))(_0x6316('0x6'));var config=require('../../config/environment');var jayson=require(_0x6316('0x7'));var client=jayson[_0x6316('0x8')][_0x6316('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24d39c,_0x58058a,_0x2d7d22){return new BPromise(function(_0x31ca1a,_0x56abe5){return client[_0x6316('0xa')](_0x24d39c,_0x2d7d22)[_0x6316('0xb')](function(_0xed311e){logger[_0x6316('0xc')](_0x6316('0xd'),_0x58058a,_0x6316('0xe'));logger[_0x6316('0xf')](_0x6316('0x10'),_0x58058a,_0x6316('0xe'),JSON[_0x6316('0x11')](_0xed311e));if(_0xed311e[_0x6316('0x12')]){if(_0xed311e['error'][_0x6316('0x13')]===0x1f4){logger[_0x6316('0x12')](_0x6316('0xd'),_0x58058a,_0xed311e[_0x6316('0x12')][_0x6316('0x14')]);return _0x56abe5(_0xed311e[_0x6316('0x12')]['message']);}logger[_0x6316('0x12')](_0x6316('0xd'),_0x58058a,_0xed311e[_0x6316('0x12')][_0x6316('0x14')]);return _0x31ca1a(_0xed311e['error'][_0x6316('0x14')]);}else{logger[_0x6316('0xc')](_0x6316('0xd'),_0x58058a,'request\x20sent');_0x31ca1a(_0xed311e[_0x6316('0x15')][_0x6316('0x14')]);}})['catch'](function(_0x31b704){logger[_0x6316('0x12')](_0x6316('0xd'),_0x58058a,_0x31b704);_0x56abe5(_0x31b704);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 4373b39..6d0858a 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 _0x3991=['put','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','post','isAuthenticated','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3991,0x169));var _0x1399=function(_0x102ba4,_0x103bbc){_0x102ba4=_0x102ba4-0x0;var _0x53d666=_0x3991[_0x102ba4];return _0x53d666;};'use strict';var multer=require('multer');var util=require(_0x1399('0x0'));var path=require(_0x1399('0x1'));var timeout=require(_0x1399('0x2'));var express=require(_0x1399('0x3'));var router=express[_0x1399('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1399('0x5'));var interaction=require(_0x1399('0x6'));var config=require(_0x1399('0x7'));var controller=require(_0x1399('0x8'));router[_0x1399('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1399('0xa')]('/',auth[_0x1399('0xb')](),controller[_0x1399('0xc')]);router[_0x1399('0xd')](_0x1399('0xe'),auth[_0x1399('0xb')](),controller['update']);router['delete'](_0x1399('0xe'),auth[_0x1399('0xb')](),controller[_0x1399('0xf')]);module[_0x1399('0x10')]=router; \ No newline at end of file +var _0x5e1e=['/:id','show','post','create','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5e1e,0x137));var _0xe5e1=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5e1e[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0xe5e1('0x0'));var util=require(_0xe5e1('0x1'));var path=require(_0xe5e1('0x2'));var timeout=require('connect-timeout');var express=require(_0xe5e1('0x3'));var router=express[_0xe5e1('0x4')]();var fs_extra=require(_0xe5e1('0x5'));var auth=require(_0xe5e1('0x6'));var interaction=require(_0xe5e1('0x7'));var config=require(_0xe5e1('0x8'));var controller=require('./intDeskField.controller');router[_0xe5e1('0x9')]('/',auth[_0xe5e1('0xa')](),controller[_0xe5e1('0xb')]);router[_0xe5e1('0x9')](_0xe5e1('0xc'),auth[_0xe5e1('0xa')](),controller[_0xe5e1('0xd')]);router[_0xe5e1('0xe')]('/',auth[_0xe5e1('0xa')](),controller[_0xe5e1('0xf')]);router[_0xe5e1('0x10')](_0xe5e1('0xc'),auth[_0xe5e1('0xa')](),controller[_0xe5e1('0x11')]);router['delete'](_0xe5e1('0xc'),auth['isAuthenticated'](),controller[_0xe5e1('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 075693d..cc15dc5 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 _0xa3fd=['customVariable','sequelize','exports','variable','picklist','string','STRING'];(function(_0x375046,_0x181417){var _0x74937e=function(_0x3abe8b){while(--_0x3abe8b){_0x375046['push'](_0x375046['shift']());}};_0x74937e(++_0x181417);}(_0xa3fd,0x1b3));var _0xda3f=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0xa3fd[_0x4fa0ea];return _0x51d027;};'use strict';var Sequelize=require(_0xda3f('0x0'));module[_0xda3f('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xda3f('0x2'),'customVariable','keyValue',_0xda3f('0x3')),'defaultValue':_0xda3f('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xda3f('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xda3f('0x2'),_0xda3f('0x6'))},'keyContent':{'type':Sequelize[_0xda3f('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xda3f('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xda3f('0x5')]}}; \ No newline at end of file +var _0xf1a9=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x156ba3,_0x543a99){var _0x353639=function(_0x1b36bf){while(--_0x1b36bf){_0x156ba3['push'](_0x156ba3['shift']());}};_0x353639(++_0x543a99);}(_0xf1a9,0xab));var _0x9f1a=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xf1a9[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x9f1a('0x0'));module[_0x9f1a('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9f1a('0x2'),_0x9f1a('0x3'),_0x9f1a('0x4'),_0x9f1a('0x5'),_0x9f1a('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9f1a('0x7')]},'key':{'type':Sequelize[_0x9f1a('0x7')]},'keyType':{'type':Sequelize[_0x9f1a('0x8')](_0x9f1a('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x9f1a('0x7')]},'idField':{'type':Sequelize[_0x9f1a('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9f1a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9f1a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 0b0e47e..5993533 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 _0x5fe0=['count','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','Content-Range','apply','reject','update','then','end','sendStatus','error','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x1e861f,_0x3f6d6c){var _0x5b2e69=function(_0x2a9679){while(--_0x2a9679){_0x1e861f['push'](_0x1e861f['shift']());}};_0x5b2e69(++_0x3f6d6c);}(_0x5fe0,0xe8));var _0x05fe=function(_0x321e04,_0x481681){_0x321e04=_0x321e04-0x0;var _0x536415=_0x5fe0[_0x321e04];return _0x536415;};'use strict';var emlformat=require(_0x05fe('0x0'));var rimraf=require(_0x05fe('0x1'));var zipdir=require(_0x05fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05fe('0x3'));var moment=require(_0x05fe('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x05fe('0x5'));var path=require(_0x05fe('0x6'));var sox=require(_0x05fe('0x7'));var csv=require(_0x05fe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05fe('0x9'));var squel=require('squel');var crypto=require(_0x05fe('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x05fe('0xb'));var toCsv=require(_0x05fe('0x8'));var querystring=require(_0x05fe('0xc'));var Papa=require(_0x05fe('0xd'));var Redis=require(_0x05fe('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x05fe('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05fe('0x10'));var logger=require(_0x05fe('0x11'))(_0x05fe('0x12'));var utils=require(_0x05fe('0x13'));var config=require(_0x05fe('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x05fe('0x15'))['db'];function respondWithStatusCode(_0x500f62,_0x204f36){_0x204f36=_0x204f36||0xcc;return function(_0x1c71a8){if(_0x1c71a8){return _0x500f62['sendStatus'](_0x204f36);}return _0x500f62[_0x05fe('0x16')](_0x204f36)['end']();};}function respondWithResult(_0x2ce92e,_0x438b29){_0x438b29=_0x438b29||0xc8;return function(_0xa3f71a){if(_0xa3f71a){return _0x2ce92e['status'](_0x438b29)[_0x05fe('0x17')](_0xa3f71a);}};}function respondWithFilteredResult(_0x468538,_0x2b0aa0){return function(_0x135101){if(_0x135101){var _0x52ae81=typeof _0x2b0aa0[_0x05fe('0x18')]===_0x05fe('0x19')&&typeof _0x2b0aa0[_0x05fe('0x1a')]==='undefined';var _0x23adf8=_0x135101['count'];var _0xe6d681=_0x52ae81?0x0:_0x2b0aa0[_0x05fe('0x18')];var _0x61fce=_0x52ae81?_0x135101['count']:_0x2b0aa0[_0x05fe('0x18')]+_0x2b0aa0[_0x05fe('0x1a')];var _0x23917a;if(_0x61fce>=_0x23adf8){_0x61fce=_0x23adf8;_0x23917a=0xc8;}else{_0x23917a=0xce;}_0x468538[_0x05fe('0x16')](_0x23917a);return _0x468538['set'](_0x05fe('0x1b'),_0xe6d681+'-'+_0x61fce+'/'+_0x23adf8)['json'](_0x135101);}return null;};}function patchUpdates(_0x59d617){return function(_0x347be1){try{jsonpatch[_0x05fe('0x1c')](_0x347be1,_0x59d617,!![]);}catch(_0x456e6c){return BPromise[_0x05fe('0x1d')](_0x456e6c);}return _0x347be1['save']();};}function saveUpdates(_0x37b449,_0x42919f){return function(_0x5caaa5){if(_0x5caaa5){return _0x5caaa5[_0x05fe('0x1e')](_0x37b449)['then'](function(_0xaedb4){return _0xaedb4;});}return null;};}function removeEntity(_0x29426d,_0x36c7ca){return function(_0x4134fd){if(_0x4134fd){return _0x4134fd['destroy']()[_0x05fe('0x1f')](function(){_0x29426d[_0x05fe('0x16')](0xcc)[_0x05fe('0x20')]();});}};}function handleEntityNotFound(_0x53c2fa,_0x20cec3){return function(_0x46ee7c){if(!_0x46ee7c){_0x53c2fa[_0x05fe('0x21')](0x194);}return _0x46ee7c;};}function handleError(_0x5a0b35,_0x16a010){_0x16a010=_0x16a010||0x1f4;return function(_0x55e171){logger[_0x05fe('0x22')](_0x55e171[_0x05fe('0x23')]);if(_0x55e171[_0x05fe('0x24')]){delete _0x55e171[_0x05fe('0x24')];}_0x5a0b35[_0x05fe('0x16')](_0x16a010)[_0x05fe('0x25')](_0x55e171);};}exports[_0x05fe('0x26')]=function(_0x5e5219,_0x23fd34){var _0x452a49={},_0x2e13c3={},_0x5bb6e5={'count':0x0,'rows':[]};var _0xc61430=_[_0x05fe('0x27')](db[_0x05fe('0x28')]['rawAttributes'],function(_0x412ed3){return{'name':_0x412ed3[_0x05fe('0x29')],'type':_0x412ed3[_0x05fe('0x2a')][_0x05fe('0x2b')]};});_0x2e13c3[_0x05fe('0x2c')]=_['map'](_0xc61430,_0x05fe('0x24'));_0x2e13c3[_0x05fe('0x2d')]=_['keys'](_0x5e5219['query']);_0x2e13c3[_0x05fe('0x2e')]=_['intersection'](_0x2e13c3[_0x05fe('0x2c')],_0x2e13c3['query']);_0x452a49['attributes']=_[_0x05fe('0x2f')](_0x2e13c3[_0x05fe('0x2c')],qs['fields'](_0x5e5219[_0x05fe('0x2d')][_0x05fe('0x30')]));_0x452a49[_0x05fe('0x31')]=_0x452a49['attributes'][_0x05fe('0x32')]?_0x452a49['attributes']:_0x2e13c3[_0x05fe('0x2c')];if(!_0x5e5219[_0x05fe('0x2d')][_0x05fe('0x33')](_0x05fe('0x34'))){_0x452a49[_0x05fe('0x1a')]=qs[_0x05fe('0x1a')](_0x5e5219[_0x05fe('0x2d')]['limit']);_0x452a49[_0x05fe('0x18')]=qs[_0x05fe('0x18')](_0x5e5219[_0x05fe('0x2d')][_0x05fe('0x18')]);}_0x452a49[_0x05fe('0x35')]=qs[_0x05fe('0x36')](_0x5e5219[_0x05fe('0x2d')]['sort']);_0x452a49[_0x05fe('0x37')]=qs[_0x05fe('0x2e')](_[_0x05fe('0x38')](_0x5e5219[_0x05fe('0x2d')],_0x2e13c3[_0x05fe('0x2e')]),_0xc61430);if(_0x5e5219[_0x05fe('0x2d')][_0x05fe('0x39')]){_0x452a49[_0x05fe('0x37')]=_[_0x05fe('0x3a')](_0x452a49[_0x05fe('0x37')],{'$or':_[_0x05fe('0x27')](_0xc61430,function(_0x4d0bc3){if(_0x4d0bc3[_0x05fe('0x2a')]!=='VIRTUAL'){var _0x1b5313={};_0x1b5313[_0x4d0bc3[_0x05fe('0x24')]]={'$like':'%'+_0x5e5219[_0x05fe('0x2d')]['filter']+'%'};return _0x1b5313;}})});}_0x452a49=_[_0x05fe('0x3a')]({},_0x452a49,_0x5e5219[_0x05fe('0x3b')]);var _0x26dc8d={'where':_0x452a49['where']};return db[_0x05fe('0x28')][_0x05fe('0x3c')](_0x26dc8d)[_0x05fe('0x1f')](function(_0x354369){_0x5bb6e5[_0x05fe('0x3c')]=_0x354369;if(_0x5e5219[_0x05fe('0x2d')][_0x05fe('0x3d')]){_0x452a49[_0x05fe('0x3e')]=[{'all':!![]}];}return db[_0x05fe('0x28')][_0x05fe('0x3f')](_0x452a49);})[_0x05fe('0x1f')](function(_0x2e3f58){_0x5bb6e5[_0x05fe('0x40')]=_0x2e3f58;return _0x5bb6e5;})['then'](respondWithFilteredResult(_0x23fd34,_0x452a49))['catch'](handleError(_0x23fd34,null));};exports[_0x05fe('0x41')]=function(_0x3f3de7,_0x186318){var _0x457667={'raw':!![],'where':{'id':_0x3f3de7[_0x05fe('0x42')]['id']}},_0x19967e={};_0x19967e['model']=_[_0x05fe('0x43')](db[_0x05fe('0x28')]['rawAttributes']);_0x19967e[_0x05fe('0x2d')]=_['keys'](_0x3f3de7[_0x05fe('0x2d')]);_0x19967e['filters']=_['intersection'](_0x19967e['model'],_0x19967e['query']);_0x457667['attributes']=_[_0x05fe('0x2f')](_0x19967e[_0x05fe('0x2c')],qs['fields'](_0x3f3de7['query'][_0x05fe('0x30')]));_0x457667[_0x05fe('0x31')]=_0x457667[_0x05fe('0x31')][_0x05fe('0x32')]?_0x457667[_0x05fe('0x31')]:_0x19967e[_0x05fe('0x2c')];if(_0x3f3de7[_0x05fe('0x2d')][_0x05fe('0x3d')]){_0x457667[_0x05fe('0x3e')]=[{'all':!![]}];}_0x457667=_[_0x05fe('0x3a')]({},_0x457667,_0x3f3de7['options']);return db[_0x05fe('0x28')][_0x05fe('0x44')](_0x457667)['then'](handleEntityNotFound(_0x186318,null))[_0x05fe('0x1f')](respondWithResult(_0x186318,null))[_0x05fe('0x45')](handleError(_0x186318,null));};exports[_0x05fe('0x46')]=function(_0x452013,_0x3ba11c){return db[_0x05fe('0x28')][_0x05fe('0x46')](_0x452013[_0x05fe('0x47')],{})['then'](respondWithResult(_0x3ba11c,0xc9))[_0x05fe('0x45')](handleError(_0x3ba11c,null));};exports[_0x05fe('0x1e')]=function(_0x8638bd,_0x3c7d71){if(_0x8638bd[_0x05fe('0x47')]['id']){delete _0x8638bd[_0x05fe('0x47')]['id'];}return db['DeskField'][_0x05fe('0x44')]({'where':{'id':_0x8638bd[_0x05fe('0x42')]['id']}})[_0x05fe('0x1f')](handleEntityNotFound(_0x3c7d71,null))[_0x05fe('0x1f')](saveUpdates(_0x8638bd[_0x05fe('0x47')],null))[_0x05fe('0x1f')](respondWithResult(_0x3c7d71,null))[_0x05fe('0x45')](handleError(_0x3c7d71,null));};exports[_0x05fe('0x48')]=function(_0x39f6d7,_0x4f1e21){return db['DeskField']['find']({'where':{'id':_0x39f6d7[_0x05fe('0x42')]['id']}})[_0x05fe('0x1f')](handleEntityNotFound(_0x4f1e21,null))[_0x05fe('0x1f')](removeEntity(_0x4f1e21,null))[_0x05fe('0x45')](handleError(_0x4f1e21,null));}; \ No newline at end of file +var _0x2d78=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','DeskField','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0xd60031,_0x5efb93){var _0x43d00a=function(_0x21ac92){while(--_0x21ac92){_0xd60031['push'](_0xd60031['shift']());}};_0x43d00a(++_0x5efb93);}(_0x2d78,0x199));var _0x82d7=function(_0x380016,_0x178dd6){_0x380016=_0x380016-0x0;var _0x5c7ac0=_0x2d78[_0x380016];return _0x5c7ac0;};'use strict';var emlformat=require(_0x82d7('0x0'));var rimraf=require(_0x82d7('0x1'));var zipdir=require(_0x82d7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82d7('0x3'));var moment=require(_0x82d7('0x4'));var BPromise=require(_0x82d7('0x5'));var Mustache=require(_0x82d7('0x6'));var util=require(_0x82d7('0x7'));var path=require(_0x82d7('0x8'));var sox=require(_0x82d7('0x9'));var csv=require(_0x82d7('0xa'));var ejs=require(_0x82d7('0xb'));var fs=require('fs');var fs_extra=require(_0x82d7('0xc'));var _=require(_0x82d7('0xd'));var squel=require(_0x82d7('0xe'));var crypto=require(_0x82d7('0xf'));var jsforce=require(_0x82d7('0x10'));var deskjs=require(_0x82d7('0x11'));var toCsv=require(_0x82d7('0xa'));var querystring=require(_0x82d7('0x12'));var Papa=require(_0x82d7('0x13'));var Redis=require(_0x82d7('0x14'));var authService=require(_0x82d7('0x15'));var qs=require(_0x82d7('0x16'));var as=require(_0x82d7('0x17'));var hardwareService=require(_0x82d7('0x18'));var logger=require(_0x82d7('0x19'))(_0x82d7('0x1a'));var utils=require(_0x82d7('0x1b'));var config=require(_0x82d7('0x1c'));var licenseUtil=require(_0x82d7('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44962d,_0x5bf4fa){_0x5bf4fa=_0x5bf4fa||0xcc;return function(_0x3d4892){if(_0x3d4892){return _0x44962d['sendStatus'](_0x5bf4fa);}return _0x44962d[_0x82d7('0x1e')](_0x5bf4fa)[_0x82d7('0x1f')]();};}function respondWithResult(_0x4716e6,_0x1bb2d8){_0x1bb2d8=_0x1bb2d8||0xc8;return function(_0x558013){if(_0x558013){return _0x4716e6[_0x82d7('0x1e')](_0x1bb2d8)[_0x82d7('0x20')](_0x558013);}};}function respondWithFilteredResult(_0x19461a,_0x106cfd){return function(_0x3ff872){if(_0x3ff872){var _0x5a2974=typeof _0x106cfd[_0x82d7('0x21')]===_0x82d7('0x22')&&typeof _0x106cfd[_0x82d7('0x23')]===_0x82d7('0x22');var _0x56fb67=_0x3ff872[_0x82d7('0x24')];var _0x331374=_0x5a2974?0x0:_0x106cfd[_0x82d7('0x21')];var _0x45a6a0=_0x5a2974?_0x3ff872[_0x82d7('0x24')]:_0x106cfd[_0x82d7('0x21')]+_0x106cfd[_0x82d7('0x23')];var _0x2a7cee;if(_0x45a6a0>=_0x56fb67){_0x45a6a0=_0x56fb67;_0x2a7cee=0xc8;}else{_0x2a7cee=0xce;}_0x19461a[_0x82d7('0x1e')](_0x2a7cee);return _0x19461a['set'](_0x82d7('0x25'),_0x331374+'-'+_0x45a6a0+'/'+_0x56fb67)['json'](_0x3ff872);}return null;};}function patchUpdates(_0x4374a1){return function(_0x1720ee){try{jsonpatch[_0x82d7('0x26')](_0x1720ee,_0x4374a1,!![]);}catch(_0x5a22a1){return BPromise[_0x82d7('0x27')](_0x5a22a1);}return _0x1720ee[_0x82d7('0x28')]();};}function saveUpdates(_0xe30ff2,_0x37c1da){return function(_0x108e9d){if(_0x108e9d){return _0x108e9d[_0x82d7('0x29')](_0xe30ff2)['then'](function(_0x1e2921){return _0x1e2921;});}return null;};}function removeEntity(_0xfe6d5c,_0x1a654d){return function(_0x5abd25){if(_0x5abd25){return _0x5abd25[_0x82d7('0x2a')]()[_0x82d7('0x2b')](function(){_0xfe6d5c['status'](0xcc)[_0x82d7('0x1f')]();});}};}function handleEntityNotFound(_0x83b51,_0x7f82f){return function(_0x2a56bc){if(!_0x2a56bc){_0x83b51[_0x82d7('0x2c')](0x194);}return _0x2a56bc;};}function handleError(_0x129fce,_0x47312a){_0x47312a=_0x47312a||0x1f4;return function(_0x5dcaea){logger['error'](_0x5dcaea[_0x82d7('0x2d')]);if(_0x5dcaea[_0x82d7('0x2e')]){delete _0x5dcaea[_0x82d7('0x2e')];}_0x129fce[_0x82d7('0x1e')](_0x47312a)[_0x82d7('0x2f')](_0x5dcaea);};}exports[_0x82d7('0x30')]=function(_0x4b1762,_0x43e362){var _0x25b4f1={},_0x28d94c={},_0x4de17c={'count':0x0,'rows':[]};var _0x1af023=_[_0x82d7('0x31')](db[_0x82d7('0x32')][_0x82d7('0x33')],function(_0x2260a3){return{'name':_0x2260a3[_0x82d7('0x34')],'type':_0x2260a3['type'][_0x82d7('0x35')]};});_0x28d94c['model']=_[_0x82d7('0x31')](_0x1af023,_0x82d7('0x2e'));_0x28d94c[_0x82d7('0x36')]=_[_0x82d7('0x37')](_0x4b1762[_0x82d7('0x36')]);_0x28d94c[_0x82d7('0x38')]=_[_0x82d7('0x39')](_0x28d94c[_0x82d7('0x3a')],_0x28d94c['query']);_0x25b4f1[_0x82d7('0x3b')]=_[_0x82d7('0x39')](_0x28d94c['model'],qs[_0x82d7('0x3c')](_0x4b1762['query'][_0x82d7('0x3c')]));_0x25b4f1[_0x82d7('0x3b')]=_0x25b4f1[_0x82d7('0x3b')][_0x82d7('0x3d')]?_0x25b4f1[_0x82d7('0x3b')]:_0x28d94c[_0x82d7('0x3a')];if(!_0x4b1762[_0x82d7('0x36')][_0x82d7('0x3e')](_0x82d7('0x3f'))){_0x25b4f1[_0x82d7('0x23')]=qs['limit'](_0x4b1762['query']['limit']);_0x25b4f1[_0x82d7('0x21')]=qs['offset'](_0x4b1762[_0x82d7('0x36')]['offset']);}_0x25b4f1[_0x82d7('0x40')]=qs[_0x82d7('0x41')](_0x4b1762[_0x82d7('0x36')][_0x82d7('0x41')]);_0x25b4f1['where']=qs[_0x82d7('0x38')](_[_0x82d7('0x42')](_0x4b1762[_0x82d7('0x36')],_0x28d94c[_0x82d7('0x38')]),_0x1af023);if(_0x4b1762['query'][_0x82d7('0x43')]){_0x25b4f1['where']=_[_0x82d7('0x44')](_0x25b4f1[_0x82d7('0x45')],{'$or':_['map'](_0x1af023,function(_0x5d0801){if(_0x5d0801[_0x82d7('0x46')]!==_0x82d7('0x47')){var _0x894eea={};_0x894eea[_0x5d0801[_0x82d7('0x2e')]]={'$like':'%'+_0x4b1762[_0x82d7('0x36')][_0x82d7('0x43')]+'%'};return _0x894eea;}})});}_0x25b4f1=_[_0x82d7('0x44')]({},_0x25b4f1,_0x4b1762[_0x82d7('0x48')]);var _0x4ec87a={'where':_0x25b4f1[_0x82d7('0x45')]};return db['DeskField'][_0x82d7('0x24')](_0x4ec87a)[_0x82d7('0x2b')](function(_0x3f7f40){_0x4de17c['count']=_0x3f7f40;if(_0x4b1762['query'][_0x82d7('0x49')]){_0x25b4f1[_0x82d7('0x4a')]=[{'all':!![]}];}return db[_0x82d7('0x32')][_0x82d7('0x4b')](_0x25b4f1);})[_0x82d7('0x2b')](function(_0x536a12){_0x4de17c[_0x82d7('0x4c')]=_0x536a12;return _0x4de17c;})['then'](respondWithFilteredResult(_0x43e362,_0x25b4f1))['catch'](handleError(_0x43e362,null));};exports[_0x82d7('0x4d')]=function(_0x3c16ba,_0x50fd66){var _0x467b79={'raw':!![],'where':{'id':_0x3c16ba[_0x82d7('0x4e')]['id']}},_0x1eb847={};_0x1eb847[_0x82d7('0x3a')]=_[_0x82d7('0x37')](db[_0x82d7('0x32')][_0x82d7('0x33')]);_0x1eb847[_0x82d7('0x36')]=_[_0x82d7('0x37')](_0x3c16ba[_0x82d7('0x36')]);_0x1eb847[_0x82d7('0x38')]=_[_0x82d7('0x39')](_0x1eb847[_0x82d7('0x3a')],_0x1eb847[_0x82d7('0x36')]);_0x467b79[_0x82d7('0x3b')]=_[_0x82d7('0x39')](_0x1eb847[_0x82d7('0x3a')],qs[_0x82d7('0x3c')](_0x3c16ba[_0x82d7('0x36')][_0x82d7('0x3c')]));_0x467b79[_0x82d7('0x3b')]=_0x467b79['attributes'][_0x82d7('0x3d')]?_0x467b79[_0x82d7('0x3b')]:_0x1eb847[_0x82d7('0x3a')];if(_0x3c16ba[_0x82d7('0x36')]['includeAll']){_0x467b79[_0x82d7('0x4a')]=[{'all':!![]}];}_0x467b79=_[_0x82d7('0x44')]({},_0x467b79,_0x3c16ba[_0x82d7('0x48')]);return db[_0x82d7('0x32')]['find'](_0x467b79)[_0x82d7('0x2b')](handleEntityNotFound(_0x50fd66,null))['then'](respondWithResult(_0x50fd66,null))[_0x82d7('0x4f')](handleError(_0x50fd66,null));};exports[_0x82d7('0x50')]=function(_0x409ff9,_0x54d751){return db['DeskField']['create'](_0x409ff9['body'],{})[_0x82d7('0x2b')](respondWithResult(_0x54d751,0xc9))[_0x82d7('0x4f')](handleError(_0x54d751,null));};exports[_0x82d7('0x29')]=function(_0x2e9798,_0x549590){if(_0x2e9798[_0x82d7('0x51')]['id']){delete _0x2e9798[_0x82d7('0x51')]['id'];}return db[_0x82d7('0x32')][_0x82d7('0x52')]({'where':{'id':_0x2e9798[_0x82d7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x549590,null))['then'](saveUpdates(_0x2e9798['body'],null))[_0x82d7('0x2b')](respondWithResult(_0x549590,null))[_0x82d7('0x4f')](handleError(_0x549590,null));};exports[_0x82d7('0x2a')]=function(_0x1da9bd,_0xc06584){return db[_0x82d7('0x32')]['find']({'where':{'id':_0x1da9bd[_0x82d7('0x4e')]['id']}})[_0x82d7('0x2b')](handleEntityNotFound(_0xc06584,null))[_0x82d7('0x2b')](removeEntity(_0xc06584,null))[_0x82d7('0x4f')](handleError(_0xc06584,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 9cddb64..22e512b 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 _0x764e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','FieldId'];(function(_0x52e57f,_0x545436){var _0x2aac74=function(_0x282faa){while(--_0x282faa){_0x52e57f['push'](_0x52e57f['shift']());}};_0x2aac74(++_0x545436);}(_0x764e,0x180));var _0xe764=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x764e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe764('0x0'));var logger=require(_0xe764('0x1'))(_0xe764('0x2'));var moment=require(_0xe764('0x3'));var BPromise=require(_0xe764('0x4'));var rp=require(_0xe764('0x5'));var fs=require('fs');var path=require(_0xe764('0x6'));var rimraf=require(_0xe764('0x7'));var config=require(_0xe764('0x8'));var attributes=require(_0xe764('0x9'));module[_0xe764('0xa')]=function(_0x545948,_0x325deb){return _0x545948[_0xe764('0xb')](_0xe764('0xc'),attributes,{'tableName':_0xe764('0xd'),'paranoid':![],'indexes':[{'name':_0xe764('0xe'),'fields':['idField',_0xe764('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf2f=['path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','desk_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcf2f,0x1f2));var _0xfcf2=function(_0x44b60c,_0x381585){_0x44b60c=_0x44b60c-0x0;var _0x55d77f=_0xcf2f[_0x44b60c];return _0x55d77f;};'use strict';var _=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var logger=require(_0xfcf2('0x2'))('api');var moment=require(_0xfcf2('0x3'));var BPromise=require(_0xfcf2('0x4'));var rp=require(_0xfcf2('0x5'));var fs=require('fs');var path=require(_0xfcf2('0x6'));var rimraf=require(_0xfcf2('0x7'));var config=require(_0xfcf2('0x8'));var attributes=require(_0xfcf2('0x9'));module[_0xfcf2('0xa')]=function(_0x4ba0f1,_0x107bbb){return _0x4ba0f1['define'](_0xfcf2('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xfcf2('0xc'),'fields':['idField',_0xfcf2('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 6172f0f..dd72ba7 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 _0x4a17=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3bf679,_0x578e9b){var _0x1f4d01=function(_0x3db8ca){while(--_0x3db8ca){_0x3bf679['push'](_0x3bf679['shift']());}};_0x1f4d01(++_0x578e9b);}(_0x4a17,0xb2));var _0x74a1=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x4a17[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x74a1('0x0'));var util=require(_0x74a1('0x1'));var moment=require(_0x74a1('0x2'));var BPromise=require(_0x74a1('0x3'));var rs=require(_0x74a1('0x4'));var fs=require('fs');var Redis=require(_0x74a1('0x5'));var db=require(_0x74a1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x74a1('0x7'))('rpc');var config=require(_0x74a1('0x8'));var jayson=require(_0x74a1('0x9'));var client=jayson[_0x74a1('0xa')][_0x74a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15ddf7,_0x29ec8c,_0x32347b){return new BPromise(function(_0x3b23f5,_0xdb8ddf){return client[_0x74a1('0xc')](_0x15ddf7,_0x32347b)[_0x74a1('0xd')](function(_0x1adc7c){logger[_0x74a1('0xe')](_0x74a1('0xf'),_0x29ec8c,'request\x20sent');logger['debug'](_0x74a1('0x10'),_0x29ec8c,'request\x20sent',JSON[_0x74a1('0x11')](_0x1adc7c));if(_0x1adc7c[_0x74a1('0x12')]){if(_0x1adc7c['error'][_0x74a1('0x13')]===0x1f4){logger[_0x74a1('0x12')]('DeskField,\x20%s,\x20%s',_0x29ec8c,_0x1adc7c['error'][_0x74a1('0x14')]);return _0xdb8ddf(_0x1adc7c['error'][_0x74a1('0x14')]);}logger[_0x74a1('0x12')](_0x74a1('0xf'),_0x29ec8c,_0x1adc7c[_0x74a1('0x12')]['message']);return _0x3b23f5(_0x1adc7c[_0x74a1('0x12')][_0x74a1('0x14')]);}else{logger[_0x74a1('0xe')](_0x74a1('0xf'),_0x29ec8c,'request\x20sent');_0x3b23f5(_0x1adc7c[_0x74a1('0x15')][_0x74a1('0x14')]);}})[_0x74a1('0x16')](function(_0x3bc346){logger[_0x74a1('0x12')](_0x74a1('0xf'),_0x29ec8c,_0x3bc346);_0xdb8ddf(_0x3bc346);});});} \ No newline at end of file +var _0x2db0=['message','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x20c27d,_0x185660){var _0x229d95=function(_0x4fb794){while(--_0x4fb794){_0x20c27d['push'](_0x20c27d['shift']());}};_0x229d95(++_0x185660);}(_0x2db0,0x17b));var _0x02db=function(_0x22d417,_0x440660){_0x22d417=_0x22d417-0x0;var _0x15410a=_0x2db0[_0x22d417];return _0x15410a;};'use strict';var _=require('lodash');var util=require(_0x02db('0x0'));var moment=require(_0x02db('0x1'));var BPromise=require('bluebird');var rs=require(_0x02db('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02db('0x3'))['db'];var utils=require(_0x02db('0x4'));var logger=require(_0x02db('0x5'))(_0x02db('0x6'));var config=require(_0x02db('0x7'));var jayson=require(_0x02db('0x8'));var client=jayson[_0x02db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x281bbd,_0x589e8f,_0x4f1a92){return new BPromise(function(_0xac7cf,_0xe74d65){return client[_0x02db('0xa')](_0x281bbd,_0x4f1a92)[_0x02db('0xb')](function(_0x1bc508){logger[_0x02db('0xc')](_0x02db('0xd'),_0x589e8f,'request\x20sent');logger[_0x02db('0xe')](_0x02db('0xf'),_0x589e8f,_0x02db('0x10'),JSON[_0x02db('0x11')](_0x1bc508));if(_0x1bc508[_0x02db('0x12')]){if(_0x1bc508['error'][_0x02db('0x13')]===0x1f4){logger['error'](_0x02db('0xd'),_0x589e8f,_0x1bc508['error'][_0x02db('0x14')]);return _0xe74d65(_0x1bc508[_0x02db('0x12')]['message']);}logger[_0x02db('0x12')]('DeskField,\x20%s,\x20%s',_0x589e8f,_0x1bc508['error'][_0x02db('0x14')]);return _0xac7cf(_0x1bc508[_0x02db('0x12')][_0x02db('0x14')]);}else{logger[_0x02db('0xc')](_0x02db('0xd'),_0x589e8f,'request\x20sent');_0xac7cf(_0x1bc508['result'][_0x02db('0x14')]);}})['catch'](function(_0x23571e){logger[_0x02db('0x12')](_0x02db('0xd'),_0x589e8f,_0x23571e);_0xe74d65(_0x23571e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 36029ea..a4b1c89 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 _0xb686=['index','/:id','show','/:id/configurations','get','/:id/fields','post','create','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x21b762,_0xc8ef11){var _0x2ea6d4=function(_0x22bd14){while(--_0x22bd14){_0x21b762['push'](_0x21b762['shift']());}};_0x2ea6d4(++_0xc8ef11);}(_0xb686,0x1ac));var _0x6b68=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xb686[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x6b68('0x0'));var util=require('util');var path=require(_0x6b68('0x1'));var timeout=require(_0x6b68('0x2'));var express=require(_0x6b68('0x3'));var router=express[_0x6b68('0x4')]();var fs_extra=require(_0x6b68('0x5'));var auth=require(_0x6b68('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6b68('0x7'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0x6b68('0x8')](),controller[_0x6b68('0x9')]);router['get'](_0x6b68('0xa'),auth['isAuthenticated'](),controller[_0x6b68('0xb')]);router['get'](_0x6b68('0xc'),auth[_0x6b68('0x8')](),controller['getConfigurations']);router[_0x6b68('0xd')](_0x6b68('0xe'),auth[_0x6b68('0x8')](),controller['getFields']);router[_0x6b68('0xf')]('/',auth[_0x6b68('0x8')](),controller[_0x6b68('0x10')]);router['post'](_0x6b68('0xc'),auth[_0x6b68('0x8')](),controller['addConfiguration']);router['put']('/:id',auth[_0x6b68('0x8')](),controller[_0x6b68('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6b68('0x12')]);module['exports']=router; \ No newline at end of file +var _0x95ec=['./intDynamics365Account.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x43147f,_0x46d8e9){var _0x389499=function(_0x2343bd){while(--_0x2343bd){_0x43147f['push'](_0x43147f['shift']());}};_0x389499(++_0x46d8e9);}(_0x95ec,0x7d));var _0xc95e=function(_0x30abff,_0x5f2c5f){_0x30abff=_0x30abff-0x0;var _0x4c571e=_0x95ec[_0x30abff];return _0x4c571e;};'use strict';var multer=require(_0xc95e('0x0'));var util=require(_0xc95e('0x1'));var path=require(_0xc95e('0x2'));var timeout=require(_0xc95e('0x3'));var express=require(_0xc95e('0x4'));var router=express[_0xc95e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc95e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc95e('0x7'));router[_0xc95e('0x8')]('/',auth['isAuthenticated'](),controller[_0xc95e('0x9')]);router['get']('/:id',auth[_0xc95e('0xa')](),controller[_0xc95e('0xb')]);router[_0xc95e('0x8')](_0xc95e('0xc'),auth[_0xc95e('0xa')](),controller[_0xc95e('0xd')]);router[_0xc95e('0x8')](_0xc95e('0xe'),auth[_0xc95e('0xa')](),controller['getFields']);router[_0xc95e('0xf')]('/',auth[_0xc95e('0xa')](),controller['create']);router[_0xc95e('0xf')]('/:id/configurations',auth[_0xc95e('0xa')](),controller[_0xc95e('0x10')]);router[_0xc95e('0x11')]('/:id',auth[_0xc95e('0xa')](),controller[_0xc95e('0x12')]);router[_0xc95e('0x13')](_0xc95e('0x14'),auth[_0xc95e('0xa')](),controller[_0xc95e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 1fdd000..c6c8b6a 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 _0x11e5=['STRING','sequelize'];(function(_0x4a2707,_0x56a7aa){var _0x2eb468=function(_0x5ef08d){while(--_0x5ef08d){_0x4a2707['push'](_0x4a2707['shift']());}};_0x2eb468(++_0x56a7aa);}(_0x11e5,0x8b));var _0x511e=function(_0x429536,_0x3d6d0a){_0x429536=_0x429536-0x0;var _0xb20867=_0x11e5[_0x429536];return _0xb20867;};'use strict';var Sequelize=require(_0x511e('0x0'));module['exports']={'name':{'type':Sequelize[_0x511e('0x1')]},'username':{'type':Sequelize[_0x511e('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x511e('0x1')]},'tenantId':{'type':Sequelize[_0x511e('0x1')]},'clientId':{'type':Sequelize[_0x511e('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x511e('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xe647=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4b4277,_0x22676f){var _0x1ff405=function(_0x2fa9e2){while(--_0x2fa9e2){_0x4b4277['push'](_0x4b4277['shift']());}};_0x1ff405(++_0x22676f);}(_0xe647,0x16d));var _0x7e64=function(_0x4f5349,_0x111821){_0x4f5349=_0x4f5349-0x0;var _0x2b6c15=_0xe647[_0x4f5349];return _0x2b6c15;};'use strict';var Sequelize=require(_0x7e64('0x0'));module[_0x7e64('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7e64('0x2')]},'password':{'type':Sequelize[_0x7e64('0x2')]},'remoteUri':{'type':Sequelize[_0x7e64('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x7e64('0x2')]},'serverUrl':{'type':Sequelize[_0x7e64('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7e64('0x2')]},'modernAuthentication':{'type':Sequelize[_0x7e64('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index bc4eea8..f801c43 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 _0x507f=['create','body','find','params','findOne','Dynamics365Configuration','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','slice','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','PhoneCall','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridtype','emailaddress','entitlementidname','escalatedon','exchangerate','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','resolveby','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','remoteUri','tenantId','clientId','CloudProvider','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','Options','Label','UserLocalizedLabel','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','true','FalseOption','false','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','json','offset','undefined','count','limit','status','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0xdbb6cb,_0x3b8fda){var _0x476b50=function(_0x470ebb){while(--_0x470ebb){_0xdbb6cb['push'](_0xdbb6cb['shift']());}};_0x476b50(++_0x3b8fda);}(_0x507f,0x1f1));var _0xf507=function(_0x2420c8,_0x59cdcc){_0x2420c8=_0x2420c8-0x0;var _0x46e13d=_0x507f[_0x2420c8];return _0x46e13d;};'use strict';var rp=require(_0xf507('0x0'));var util=require(_0xf507('0x1'));var _=require(_0xf507('0x2'));var qs=require(_0xf507('0x3'));var logger=require(_0xf507('0x4'))(_0xf507('0x5'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf507('0x6'));function respondWithResult(_0x3a9572,_0x4b712a){_0x4b712a=_0x4b712a||0xc8;return function(_0xd0d199){if(_0xd0d199){return _0x3a9572['status'](_0x4b712a)[_0xf507('0x7')](_0xd0d199);}};}function respondWithFilteredResult(_0x2169fc,_0x1eaf2c){return function(_0x3b7629){if(_0x3b7629){var _0x1a872b=typeof _0x1eaf2c[_0xf507('0x8')]===_0xf507('0x9')&&typeof _0x1eaf2c['limit']==='undefined';var _0x381f0a=_0x3b7629[_0xf507('0xa')];var _0x3b4f01=_0x1a872b?0x0:_0x1eaf2c['offset'];var _0x2ae051=_0x1a872b?_0x3b7629[_0xf507('0xa')]:_0x1eaf2c[_0xf507('0x8')]+_0x1eaf2c[_0xf507('0xb')];var _0x3fc435;if(_0x2ae051>=_0x381f0a){_0x2ae051=_0x381f0a;_0x3fc435=0xc8;}else{_0x3fc435=0xce;}_0x2169fc[_0xf507('0xc')](_0x3fc435);return _0x2169fc['set'](_0xf507('0xd'),_0x3b4f01+'-'+_0x2ae051+'/'+_0x381f0a)[_0xf507('0x7')](_0x3b7629);}return null;};}function saveUpdates(_0xb98e6){return function(_0x40340d){if(_0x40340d){return _0x40340d[_0xf507('0xe')](_0xb98e6)[_0xf507('0xf')](function(_0x4d3f12){return _0x4d3f12;});}return null;};}function removeEntity(_0x835e26){return function(_0x2ea018){if(_0x2ea018){return _0x2ea018[_0xf507('0x10')]()[_0xf507('0xf')](function(){_0x835e26[_0xf507('0xc')](0xcc)[_0xf507('0x11')]();});}};}function handleEntityNotFound(_0x4ed1bb){return function(_0x3e5405){if(!_0x3e5405){_0x4ed1bb[_0xf507('0x12')](0x194);}return _0x3e5405;};}function handleError(_0x40990e,_0xac8764){_0xac8764=_0xac8764||0x1f4;return function(_0x3bcac9){logger[_0xf507('0x13')](_0x3bcac9[_0xf507('0x14')]);if(_0x3bcac9[_0xf507('0x15')]){delete _0x3bcac9['name'];}_0x40990e[_0xf507('0xc')](_0xac8764)[_0xf507('0x16')](_0x3bcac9);};}exports[_0xf507('0x17')]=function(_0x3a3d30,_0x30b31d){var _0x198a8f={},_0x2f44b9={},_0x310a36={'count':0x0,'rows':[]};var _0x234057=_[_0xf507('0x18')](db[_0xf507('0x19')][_0xf507('0x1a')],function(_0x5025b0){return{'name':_0x5025b0['fieldName'],'type':_0x5025b0[_0xf507('0x1b')][_0xf507('0x1c')]};});_0x2f44b9[_0xf507('0x1d')]=_[_0xf507('0x18')](_0x234057,_0xf507('0x15'));_0x2f44b9['query']=_[_0xf507('0x1e')](_0x3a3d30[_0xf507('0x1f')]);_0x2f44b9[_0xf507('0x20')]=_[_0xf507('0x21')](_0x2f44b9[_0xf507('0x1d')],_0x2f44b9[_0xf507('0x1f')]);_0x198a8f[_0xf507('0x22')]=_[_0xf507('0x21')](_0x2f44b9['model'],qs[_0xf507('0x23')](_0x3a3d30[_0xf507('0x1f')][_0xf507('0x23')]));_0x198a8f[_0xf507('0x22')]=_0x198a8f['attributes'][_0xf507('0x24')]?_0x198a8f[_0xf507('0x22')]:_0x2f44b9[_0xf507('0x1d')];if(!_0x3a3d30[_0xf507('0x1f')][_0xf507('0x25')](_0xf507('0x26'))){_0x198a8f[_0xf507('0xb')]=qs[_0xf507('0xb')](_0x3a3d30[_0xf507('0x1f')][_0xf507('0xb')]);_0x198a8f[_0xf507('0x8')]=qs[_0xf507('0x8')](_0x3a3d30['query'][_0xf507('0x8')]);}_0x198a8f[_0xf507('0x27')]=qs['sort'](_0x3a3d30['query'][_0xf507('0x28')]);_0x198a8f[_0xf507('0x29')]=qs[_0xf507('0x20')](_[_0xf507('0x2a')](_0x3a3d30[_0xf507('0x1f')],_0x2f44b9[_0xf507('0x20')]),_0x234057);if(_0x3a3d30['query'][_0xf507('0x2b')]){_0x198a8f['where']=_[_0xf507('0x2c')](_0x198a8f['where'],{'$or':_[_0xf507('0x18')](_0x234057,function(_0x5b0e8e){if(_0x5b0e8e[_0xf507('0x1b')]!=='VIRTUAL'){var _0x563064={};_0x563064[_0x5b0e8e[_0xf507('0x15')]]={'$like':'%'+_0x3a3d30[_0xf507('0x1f')][_0xf507('0x2b')]+'%'};return _0x563064;}})});}_0x198a8f=_[_0xf507('0x2c')]({},_0x198a8f,_0x3a3d30[_0xf507('0x2d')]);var _0x1ee95c={'where':_0x198a8f['where']};return db[_0xf507('0x19')][_0xf507('0xa')](_0x1ee95c)[_0xf507('0xf')](function(_0x496199){_0x310a36[_0xf507('0xa')]=_0x496199;if(_0x3a3d30[_0xf507('0x1f')][_0xf507('0x2e')]){_0x198a8f[_0xf507('0x2f')]=[{'all':!![]}];}return db[_0xf507('0x19')][_0xf507('0x30')](_0x198a8f);})[_0xf507('0xf')](function(_0x57c4ab){_0x310a36[_0xf507('0x31')]=_0x57c4ab;return _0x310a36;})[_0xf507('0xf')](respondWithFilteredResult(_0x30b31d,_0x198a8f))[_0xf507('0x32')](handleError(_0x30b31d,null));};exports[_0xf507('0x33')]=function(_0x27a151,_0x3201e2){var _0x289c7d={'raw':![],'where':{'id':_0x27a151['params']['id']}},_0x88c33b={};_0x88c33b[_0xf507('0x1d')]=_[_0xf507('0x1e')](db[_0xf507('0x19')]['rawAttributes']);_0x88c33b[_0xf507('0x1f')]=_[_0xf507('0x1e')](_0x27a151[_0xf507('0x1f')]);_0x88c33b[_0xf507('0x20')]=_[_0xf507('0x21')](_0x88c33b[_0xf507('0x1d')],_0x88c33b['query']);_0x289c7d[_0xf507('0x22')]=_[_0xf507('0x21')](_0x88c33b[_0xf507('0x1d')],qs[_0xf507('0x23')](_0x27a151[_0xf507('0x1f')]['fields']));_0x289c7d[_0xf507('0x22')]=_0x289c7d[_0xf507('0x22')]['length']?_0x289c7d[_0xf507('0x22')]:_0x88c33b['model'];if(_0x27a151[_0xf507('0x1f')][_0xf507('0x2e')]){_0x289c7d['include']=[{'all':!![]}];}_0x289c7d=_['merge']({},_0x289c7d,_0x27a151[_0xf507('0x2d')]);return db[_0xf507('0x19')]['find'](_0x289c7d)[_0xf507('0xf')](handleEntityNotFound(_0x3201e2,null))[_0xf507('0xf')](respondWithResult(_0x3201e2,null))[_0xf507('0x32')](handleError(_0x3201e2,null));};exports[_0xf507('0x34')]=function(_0x41e741,_0x182bd9){return db['Dynamics365Account'][_0xf507('0x34')](_0x41e741[_0xf507('0x35')],{})['then'](respondWithResult(_0x182bd9,0xc9))[_0xf507('0x32')](handleError(_0x182bd9,null));};exports['update']=function(_0xe48695,_0x358799){if(_0xe48695[_0xf507('0x35')]['id']){delete _0xe48695['body']['id'];}return db[_0xf507('0x19')]['find']({'where':{'id':_0xe48695['params']['id']}})[_0xf507('0xf')](handleEntityNotFound(_0x358799,null))['then'](saveUpdates(_0xe48695['body'],null))[_0xf507('0xf')](respondWithResult(_0x358799,null))[_0xf507('0x32')](handleError(_0x358799,null));};exports[_0xf507('0x10')]=function(_0x58eb24,_0x1dc9ab){return db[_0xf507('0x19')][_0xf507('0x36')]({'where':{'id':_0x58eb24[_0xf507('0x37')]['id']}})['then'](handleEntityNotFound(_0x1dc9ab,null))[_0xf507('0xf')](removeEntity(_0x1dc9ab,null))['catch'](handleError(_0x1dc9ab,null));};exports['getConfigurations']=function(_0x3a67ce,_0xaa7ef8){var _0x31ee2b={};var _0x43eb67={};var _0x4a53a3;var _0xf232ba;return db[_0xf507('0x19')][_0xf507('0x38')]({'where':{'id':_0x3a67ce['params']['id']}})[_0xf507('0xf')](handleEntityNotFound(_0xaa7ef8,null))[_0xf507('0xf')](function(_0x2b6c1d){if(_0x2b6c1d){_0x4a53a3=_0x2b6c1d;_0x43eb67[_0xf507('0x1d')]=_[_0xf507('0x1e')](db[_0xf507('0x39')]['rawAttributes']);_0x43eb67[_0xf507('0x1f')]=_[_0xf507('0x1e')](_0x3a67ce[_0xf507('0x1f')]);_0x43eb67[_0xf507('0x20')]=_[_0xf507('0x21')](_0x43eb67[_0xf507('0x1d')],_0x43eb67[_0xf507('0x1f')]);_0x31ee2b['attributes']=_[_0xf507('0x21')](_0x43eb67[_0xf507('0x1d')],qs[_0xf507('0x23')](_0x3a67ce['query'][_0xf507('0x23')]));_0x31ee2b[_0xf507('0x22')]=_0x31ee2b['attributes'][_0xf507('0x24')]?_0x31ee2b[_0xf507('0x22')]:_0x43eb67[_0xf507('0x1d')];_0x31ee2b[_0xf507('0x27')]=qs['sort'](_0x3a67ce[_0xf507('0x1f')][_0xf507('0x28')]);_0x31ee2b[_0xf507('0x29')]=qs['filters'](_[_0xf507('0x2a')](_0x3a67ce[_0xf507('0x1f')],_0x43eb67['filters']));if(_0x3a67ce[_0xf507('0x1f')][_0xf507('0x2b')]){_0x31ee2b[_0xf507('0x29')]=_[_0xf507('0x2c')](_0x31ee2b[_0xf507('0x29')],{'$or':_[_0xf507('0x18')](_0x31ee2b['attributes'],function(_0x416120){var _0x39df48={};_0x39df48[_0x416120]={'$like':'%'+_0x3a67ce[_0xf507('0x1f')]['filter']+'%'};return _0x39df48;})});}_0x31ee2b=_['merge']({},_0x31ee2b,_0x3a67ce[_0xf507('0x2d')]);return _0x4a53a3[_0xf507('0x3a')](_0x31ee2b);}})[_0xf507('0xf')](function(_0x2a197a){if(_0x2a197a){_0xf232ba=_0x2a197a[_0xf507('0x24')];if(!_0x3a67ce[_0xf507('0x1f')][_0xf507('0x25')](_0xf507('0x26'))){_0x31ee2b[_0xf507('0xb')]=qs[_0xf507('0xb')](_0x3a67ce[_0xf507('0x1f')][_0xf507('0xb')]);_0x31ee2b[_0xf507('0x8')]=qs['offset'](_0x3a67ce[_0xf507('0x1f')]['offset']);}return _0x4a53a3['getConfigurations'](_0x31ee2b);}})['then'](function(_0x4ddc66){if(_0x4ddc66){return _0x4ddc66?{'count':_0xf232ba,'rows':_0x4ddc66}:null;}})[_0xf507('0xf')](respondWithResult(_0xaa7ef8,null))[_0xf507('0x32')](handleError(_0xaa7ef8,null));};exports[_0xf507('0x3b')]=function(_0x3fe12d,_0x56e8f7){if(_0x3fe12d[_0xf507('0x35')]['id']){delete _0x3fe12d[_0xf507('0x35')]['id'];}return db[_0xf507('0x19')][_0xf507('0x38')]({'where':{'id':_0x3fe12d[_0xf507('0x37')]['id']}})[_0xf507('0xf')](handleEntityNotFound(_0x56e8f7,null))['then'](function(_0x1fedc4){if(_0x1fedc4){_0x3fe12d[_0xf507('0x35')]['AccountId']=_0x1fedc4['id'];_0x3fe12d[_0xf507('0x35')][_0xf507('0x3c')]=integrations[_0xf507('0x3d')](_0x3fe12d[_0xf507('0x35')]['channel'],_0x3fe12d[_0xf507('0x35')]['type']);_0x3fe12d[_0xf507('0x35')][_0xf507('0x3e')]=integrations[_0xf507('0x3f')](_0x3fe12d[_0xf507('0x35')][_0xf507('0x40')],_0x3fe12d[_0xf507('0x35')]['type']);return db['Dynamics365Configuration'][_0xf507('0x34')](_0x3fe12d[_0xf507('0x35')],{'include':[{'model':db[_0xf507('0x41')],'as':'Subjects'},{'model':db[_0xf507('0x41')],'as':_0xf507('0x3e')}]});}return null;})[_0xf507('0xf')](respondWithResult(_0x56e8f7,null))[_0xf507('0x32')](handleError(_0x56e8f7,null));};function sanitizeRemoteUri(_0x3ee71f){var _0x2cf8bc=_0x3ee71f[_0xf507('0x42')](-0x1);if(_0x2cf8bc==='/')return _0x3ee71f['substring'](0x0,_0x3ee71f[_0xf507('0x43')](_0x2cf8bc));return _0x3ee71f;}function getWebApiUrl(_0x354044){return util['format'](_0xf507('0x44'),_0x354044);}exports[_0xf507('0x45')]=function(_0x396a2b,_0x42e8ec){var _0x5b9800=_0x396a2b[_0xf507('0x1f')][_0xf507('0x46')];var _0x241f2d=_0x5b9800===_0xf507('0x47')?'Incident':_0xf507('0x48');var _0x568591='';var _0x2e9e0e='';var _0x5c7bb6='';var _0x456201='';var _0x3fa750='';var _0x44ddb5='';var _0x5bba9c='';var _0x42cc81='';var _0x577563=['title',_0xf507('0x49'),_0xf507('0x4a'),_0xf507('0x4b'),_0xf507('0x4c'),_0xf507('0x4d'),_0xf507('0x4e'),_0xf507('0x4f'),_0xf507('0x50'),_0xf507('0x51')];var _0x2fc038=[_0xf507('0x52'),_0xf507('0x53'),_0xf507('0x54'),_0xf507('0x55'),_0xf507('0x56'),_0xf507('0x57'),'contractdetailidname',_0xf507('0x58'),_0xf507('0x59'),_0xf507('0x5a'),_0xf507('0x5b'),_0xf507('0x5c'),_0xf507('0x5d'),'createdonbehalfbyname',_0xf507('0x5e'),'customeridname',_0xf507('0x5f'),'customeridyominame',_0xf507('0x60'),_0xf507('0x61'),'entityimage_timestamp','entityimage_url',_0xf507('0x62'),_0xf507('0x63'),'firstresponsebykpiidname',_0xf507('0x64'),'importsequencenumber',_0xf507('0x65'),'kbarticleidname',_0xf507('0x66'),_0xf507('0x67'),_0xf507('0x68'),_0xf507('0x69'),_0xf507('0x6a'),'modifiedbyyominame',_0xf507('0x6b'),_0xf507('0x6c'),'modifiedonbehalfbyyominame',_0xf507('0x6d'),_0xf507('0x6e'),'numberofchildincidents',_0xf507('0x6f'),_0xf507('0x70'),'owneridname',_0xf507('0x71'),_0xf507('0x72'),_0xf507('0x73'),'primarycontactidname',_0xf507('0x74'),'prioritycodename','productidname','productserialnumber',_0xf507('0x75'),'resolvebykpiidname',_0xf507('0x76'),'responsiblecontactidname',_0xf507('0x77'),_0xf507('0x78'),_0xf507('0x79'),_0xf507('0x7a'),_0xf507('0x7b'),'statecode',_0xf507('0x7c'),'subjectidname',_0xf507('0x7d'),_0xf507('0x7e'),_0xf507('0x7f'),_0xf507('0x80'),'utcconversiontimezonecode',_0xf507('0x81')];var _0x2b00a6=_0x577563[_0xf507('0x82')](_0x2fc038);return db[_0xf507('0x19')][_0xf507('0x38')]({'where':{'id':_0x396a2b[_0xf507('0x37')]['id']},'attributes':['id',_0xf507('0x83'),'password',_0xf507('0x84'),_0xf507('0x85'),_0xf507('0x86'),'clientSecret','modernAuthentication'],'include':[{'model':db['CloudProvider'],'as':_0xf507('0x87'),'attributes':['id','data5',_0xf507('0x88')]}]})['then'](handleEntityNotFound(_0x42e8ec,null))[_0xf507('0xf')](function(_0x587f91){if(_0x587f91){if(_0x587f91['modernAuthentication']){_0x587f91[_0xf507('0x89')]=_0x587f91[_0xf507('0x87')]['data5'];_0x42cc81=sanitizeRemoteUri(_0x587f91[_0xf507('0x87')][_0xf507('0x88')]);_0x5bba9c=getWebApiUrl(_0x42cc81);return _0x587f91;}_0x42cc81=sanitizeRemoteUri(_0x587f91[_0xf507('0x84')]);_0x5bba9c=getWebApiUrl(_0x42cc81);var _0x44b0f0={'method':_0xf507('0x8a'),'uri':_0xf507('0x8b')+_0x587f91[_0xf507('0x85')]+_0xf507('0x8c'),'form':{'client_id':_0x587f91[_0xf507('0x86')],'resource':_0x42cc81,'username':_0x587f91['username'],'password':_0x587f91['password'],'grant_type':_0xf507('0x8d'),'client_secret':_0x587f91['clientSecret']},'json':!![]};return rp(_0x44b0f0);}})['then'](function(_0x4ecc4d){_0x44ddb5=_0x4ecc4d[_0xf507('0x89')];var _0x231767={'method':_0xf507('0x8e'),'uri':encodeURI(_0x5bba9c+_0xf507('0x8f')+_0x241f2d+'\x27'),'headers':{'Authorization':_0xf507('0x90')+_0x44ddb5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x231767);})['then'](function(_0x37d817){var _0x26afd1=_0x37d817[_0xf507('0x91')][0x0];var _0x23a7cb=_0x26afd1[_0xf507('0x92')];var _0x4fccea={'method':_0xf507('0x8e'),'uri':_0x5bba9c+_0xf507('0x93')+_0x23a7cb+_0xf507('0x94'),'headers':{'Authorization':_0xf507('0x90')+_0x44ddb5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4fccea);})[_0xf507('0xf')](function(_0xae2444){_0x568591=_0xae2444;_0x2e9e0e=_0x568591[_0xf507('0x95')];_0x2e9e0e=_[_0xf507('0x96')](_0x2e9e0e,function(_0x1ba169){return!_0x2b00a6[_0xf507('0x97')](_0x1ba169['LogicalName']);});var _0x38c14e=[];var _0x508958=[];_0x2e9e0e[_0xf507('0x98')](function(_0x2c1775){if(_0x2c1775[_0xf507('0x99')]){var _0xf77125=_0x2c1775['@odata.type'][_0xf507('0x9a')](_0x2c1775['@odata.type']['lastIndexOf']('.')+0x1);if(_0xf77125===_0xf507('0x9b')){_0x38c14e[_0xf507('0x9c')](getSelectList(_0x5bba9c,_0x5b9800,_0x508958,_0x568591[_0xf507('0x92')],_0x2c1775[_0xf507('0x92')],_0x44ddb5));}}});return Promise[_0xf507('0x9d')](_0x38c14e);})[_0xf507('0xf')](function(_0x3d158e){_0x5c7bb6=_0x3d158e[0x0];var _0x41f2fb=[];var _0x49620a=[];_0x2e9e0e[_0xf507('0x98')](function(_0x592610){if(!_['isNil'](_0x592610[_0xf507('0x99')])){var _0x17e4c6=_0x592610[_0xf507('0x99')]['substring'](_0x592610['@odata.type']['lastIndexOf']('.')+0x1);if(_0x17e4c6===_0xf507('0x9e')){_0x41f2fb['push'](getBooleanList(_0x5bba9c,_0x5b9800,_0x49620a,_0x568591[_0xf507('0x92')],_0x592610[_0xf507('0x92')],_0x44ddb5));}}});return Promise[_0xf507('0x9d')](_0x41f2fb);})[_0xf507('0xf')](function(_0x539e46){_0x456201=_0x539e46[0x0];var _0x4cd51c=[];var _0x4a7a57=[];_0x2e9e0e[_0xf507('0x98')](function(_0x1ca069){if(_0x1ca069[_0xf507('0x99')]){var _0x4c38f7=_0x1ca069[_0xf507('0x99')][_0xf507('0x9a')](_0x1ca069['@odata.type'][_0xf507('0x43')]('.')+0x1);if(_0x4c38f7===_0xf507('0x9f')||_0x4c38f7===_0xf507('0xa0')||_0x4c38f7==='BigIntAttributeMetadata'||_0x4c38f7===_0xf507('0xa1')||_0x4c38f7===_0xf507('0xa2')||_0x4c38f7===_0xf507('0xa3')||_0x4c38f7==='StatusAttributeMetadata'||_0x4c38f7===_0xf507('0xa4')||_0x4c38f7===_0xf507('0xa5')||_0x4c38f7===_0xf507('0xa6')){_0x4cd51c[_0xf507('0x9c')](getInputList(_0x5bba9c,_0x5b9800,_0x4c38f7,_0x4a7a57,_0x568591[_0xf507('0x92')],_0x1ca069['MetadataId'],_0x44ddb5));}}});return Promise['all'](_0x4cd51c);})[_0xf507('0xf')](function(_0x4946a5){_0x3fa750=_0x4946a5[0x0];var _0x1e7954=_0x5c7bb6[_0xf507('0x82')](_0x456201)[_0xf507('0x82')](_0x3fa750);var _0x4ba800={'count':_0x1e7954[_0xf507('0x24')],'rows':_0x1e7954};return _0x4ba800;})[_0xf507('0xf')](respondWithResult(_0x42e8ec,null))[_0xf507('0x32')](function(_0xf46ef){var _0x1d0548=_0x396a2b[_0xf507('0x1f')][_0xf507('0xa7')]?0x1f4:_0xf46ef['statusCode']||0x1f4;logger[_0xf507('0x13')](_0xf46ef['stack']);delete _0xf46ef[_0xf507('0x15')];if(_0x1d0548===0x191){_0x1d0548=0x190;}_0x42e8ec['status'](_0x1d0548)[_0xf507('0x16')](_0x396a2b[_0xf507('0x1f')][_0xf507('0xa7')]?{'message':_0xf507('0xa8'),'statusCode':_0xf46ef['statusCode']}:_0xf46ef);});};function getSelectList(_0x5f185e,_0x239e7e,_0x46fb8a,_0x3d6661,_0x4159cb,_0x508b4f){var _0x496625={'method':'GET','uri':_0x5f185e+_0xf507('0x93')+_0x3d6661+_0xf507('0xa9')+_0x4159cb+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xf507('0xaa'),'headers':{'Authorization':'Bearer\x20'+_0x508b4f,'If-None-Match':null,'OData-Version':_0xf507('0xab')},'json':!![]};return rp(_0x496625)[_0xf507('0xf')](function(_0x20ac88){var _0x9d1d6e=[];var _0x8afe4f=_0x20ac88['OptionSet'][_0xf507('0xac')];_0x8afe4f[_0xf507('0x98')](function(_0x2da34d){_0x9d1d6e['push']({'name':_0x2da34d[_0xf507('0xad')][_0xf507('0xae')][_0xf507('0xad')],'value':String(_0x2da34d['Value'])});});var _0x157885={'id':_0x239e7e+'_'+_0x20ac88[_0xf507('0xaf')],'name':_0x20ac88[_0xf507('0xb0')][_0xf507('0xae')][_0xf507('0xad')],'custom':![],'options':_0x9d1d6e};_0x46fb8a['push'](_0x157885);return _0x46fb8a;});}function getBooleanList(_0x188906,_0x234ce2,_0x112695,_0x1a723d,_0x517a3d,_0x41ea29){var _0x2245e4={'method':'GET','uri':_0x188906+_0xf507('0x93')+_0x1a723d+_0xf507('0xa9')+_0x517a3d+_0xf507('0xb1'),'headers':{'Authorization':_0xf507('0x90')+_0x41ea29,'If-None-Match':null,'OData-Version':_0xf507('0xab')},'json':!![]};return rp(_0x2245e4)[_0xf507('0xf')](function(_0xa81df9){var _0x13aa9d=[];_0x13aa9d[_0xf507('0x9c')]({'name':_0xa81df9[_0xf507('0xb2')]['TrueOption']['Label']['UserLocalizedLabel'][_0xf507('0xad')],'value':_0xf507('0xb3')},{'name':_0xa81df9[_0xf507('0xb2')][_0xf507('0xb4')][_0xf507('0xad')][_0xf507('0xae')][_0xf507('0xad')],'value':_0xf507('0xb5')});var _0x76e676={'id':_0x234ce2+'_'+_0xa81df9[_0xf507('0xaf')],'name':_0xa81df9[_0xf507('0xb0')][_0xf507('0xae')][_0xf507('0xad')],'custom':![],'options':_0x13aa9d};_0x112695[_0xf507('0x9c')](_0x76e676);return _0x112695;});}function getInputList(_0x4ed0ba,_0x3e0672,_0x308ae0,_0x59202b,_0x4da2c0,_0x59430e,_0x3b102d){var _0x520783={'method':_0xf507('0x8e'),'uri':_0x4ed0ba+_0xf507('0x93')+_0x4da2c0+_0xf507('0xa9')+_0x59430e+')/Microsoft.Dynamics.CRM.'+_0x308ae0+_0xf507('0xb6'),'headers':{'Authorization':_0xf507('0x90')+_0x3b102d,'If-None-Match':null,'OData-Version':_0xf507('0xab')},'json':!![]};return rp(_0x520783)['then'](function(_0x4a52be){var _0x253746={'id':_0x3e0672+'_'+_0x4a52be[_0xf507('0xaf')],'name':_0x4a52be[_0xf507('0xb0')][_0xf507('0xae')]?_0x4a52be['DisplayName'][_0xf507('0xae')][_0xf507('0xad')]:_0x4a52be['LogicalName'],'custom':![],'options':[]};_0x59202b[_0xf507('0x9c')](_0x253746);return _0x59202b;});} \ No newline at end of file +var _0x9e09=['attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','params','create','body','find','getConfigurations','findOne','pick','options','hasOwnProperty','AccountId','Subjects','channel','type','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','PhoneCall','title','description','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','transactioncurrencyidname','traversedpath','versionnumber','username','password','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','POST','tenantId','GET','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','send','Wrong\x20credentials','statusCode','EntityDefinitions(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','request-promise','util','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','end','error','stack','name','map','Dynamics365Account','rawAttributes','key','model','keys','query','intersection','fields'];(function(_0x49e2cd,_0x200d6f){var _0x51dd3c=function(_0x519ec6){while(--_0x519ec6){_0x49e2cd['push'](_0x49e2cd['shift']());}};_0x51dd3c(++_0x200d6f);}(_0x9e09,0x152));var _0x99e0=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9e09[_0x4cf98e];return _0x1623ac;};'use strict';var rp=require(_0x99e0('0x0'));var util=require(_0x99e0('0x1'));var _=require('lodash');var qs=require(_0x99e0('0x2'));var logger=require(_0x99e0('0x3'))('api');var db=require(_0x99e0('0x4'))['db'];var integrations=require(_0x99e0('0x5'));function respondWithResult(_0x191ea2,_0x1757aa){_0x1757aa=_0x1757aa||0xc8;return function(_0x5d0f9a){if(_0x5d0f9a){return _0x191ea2[_0x99e0('0x6')](_0x1757aa)[_0x99e0('0x7')](_0x5d0f9a);}};}function respondWithFilteredResult(_0x26e559,_0x121eeb){return function(_0x1f8df0){if(_0x1f8df0){var _0x3c4afa=typeof _0x121eeb['offset']===_0x99e0('0x8')&&typeof _0x121eeb['limit']===_0x99e0('0x8');var _0xecd6e5=_0x1f8df0[_0x99e0('0x9')];var _0x10e03c=_0x3c4afa?0x0:_0x121eeb[_0x99e0('0xa')];var _0x4ccc35=_0x3c4afa?_0x1f8df0['count']:_0x121eeb['offset']+_0x121eeb[_0x99e0('0xb')];var _0x49be17;if(_0x4ccc35>=_0xecd6e5){_0x4ccc35=_0xecd6e5;_0x49be17=0xc8;}else{_0x49be17=0xce;}_0x26e559[_0x99e0('0x6')](_0x49be17);return _0x26e559[_0x99e0('0xc')](_0x99e0('0xd'),_0x10e03c+'-'+_0x4ccc35+'/'+_0xecd6e5)['json'](_0x1f8df0);}return null;};}function saveUpdates(_0x4e5f00){return function(_0x1ac43d){if(_0x1ac43d){return _0x1ac43d[_0x99e0('0xe')](_0x4e5f00)[_0x99e0('0xf')](function(_0x59af30){return _0x59af30;});}return null;};}function removeEntity(_0x44b24a){return function(_0x28ad7a){if(_0x28ad7a){return _0x28ad7a[_0x99e0('0x10')]()[_0x99e0('0xf')](function(){_0x44b24a[_0x99e0('0x6')](0xcc)[_0x99e0('0x11')]();});}};}function handleEntityNotFound(_0x2ff75b){return function(_0x4237a1){if(!_0x4237a1){_0x2ff75b['sendStatus'](0x194);}return _0x4237a1;};}function handleError(_0x73dd32,_0x5838e3){_0x5838e3=_0x5838e3||0x1f4;return function(_0x158b21){logger[_0x99e0('0x12')](_0x158b21[_0x99e0('0x13')]);if(_0x158b21[_0x99e0('0x14')]){delete _0x158b21['name'];}_0x73dd32[_0x99e0('0x6')](_0x5838e3)['send'](_0x158b21);};}exports['index']=function(_0x3ee1ce,_0x4fb7c1){var _0x566b73={},_0x1b8187={},_0x41f9dd={'count':0x0,'rows':[]};var _0x5d1abf=_[_0x99e0('0x15')](db[_0x99e0('0x16')][_0x99e0('0x17')],function(_0x1b427a){return{'name':_0x1b427a['fieldName'],'type':_0x1b427a['type'][_0x99e0('0x18')]};});_0x1b8187[_0x99e0('0x19')]=_[_0x99e0('0x15')](_0x5d1abf,_0x99e0('0x14'));_0x1b8187['query']=_[_0x99e0('0x1a')](_0x3ee1ce[_0x99e0('0x1b')]);_0x1b8187['filters']=_[_0x99e0('0x1c')](_0x1b8187[_0x99e0('0x19')],_0x1b8187[_0x99e0('0x1b')]);_0x566b73['attributes']=_[_0x99e0('0x1c')](_0x1b8187[_0x99e0('0x19')],qs[_0x99e0('0x1d')](_0x3ee1ce[_0x99e0('0x1b')][_0x99e0('0x1d')]));_0x566b73[_0x99e0('0x1e')]=_0x566b73['attributes'][_0x99e0('0x1f')]?_0x566b73[_0x99e0('0x1e')]:_0x1b8187[_0x99e0('0x19')];if(!_0x3ee1ce[_0x99e0('0x1b')]['hasOwnProperty'](_0x99e0('0x20'))){_0x566b73['limit']=qs[_0x99e0('0xb')](_0x3ee1ce['query'][_0x99e0('0xb')]);_0x566b73['offset']=qs[_0x99e0('0xa')](_0x3ee1ce[_0x99e0('0x1b')][_0x99e0('0xa')]);}_0x566b73[_0x99e0('0x21')]=qs[_0x99e0('0x22')](_0x3ee1ce[_0x99e0('0x1b')][_0x99e0('0x22')]);_0x566b73[_0x99e0('0x23')]=qs[_0x99e0('0x24')](_['pick'](_0x3ee1ce[_0x99e0('0x1b')],_0x1b8187[_0x99e0('0x24')]),_0x5d1abf);if(_0x3ee1ce[_0x99e0('0x1b')][_0x99e0('0x25')]){_0x566b73[_0x99e0('0x23')]=_[_0x99e0('0x26')](_0x566b73[_0x99e0('0x23')],{'$or':_[_0x99e0('0x15')](_0x5d1abf,function(_0x4d7d21){if(_0x4d7d21['type']!==_0x99e0('0x27')){var _0x4d077f={};_0x4d077f[_0x4d7d21[_0x99e0('0x14')]]={'$like':'%'+_0x3ee1ce['query'][_0x99e0('0x25')]+'%'};return _0x4d077f;}})});}_0x566b73=_['merge']({},_0x566b73,_0x3ee1ce['options']);var _0xd0e0bd={'where':_0x566b73['where']};return db[_0x99e0('0x16')][_0x99e0('0x9')](_0xd0e0bd)[_0x99e0('0xf')](function(_0x14d30f){_0x41f9dd[_0x99e0('0x9')]=_0x14d30f;if(_0x3ee1ce['query']['includeAll']){_0x566b73[_0x99e0('0x28')]=[{'all':!![]}];}return db[_0x99e0('0x16')][_0x99e0('0x29')](_0x566b73);})[_0x99e0('0xf')](function(_0x4817fa){_0x41f9dd[_0x99e0('0x2a')]=_0x4817fa;return _0x41f9dd;})[_0x99e0('0xf')](respondWithFilteredResult(_0x4fb7c1,_0x566b73))[_0x99e0('0x2b')](handleError(_0x4fb7c1,null));};exports['show']=function(_0x43ce3c,_0x27fd72){var _0x11c99f={'raw':![],'where':{'id':_0x43ce3c[_0x99e0('0x2c')]['id']}},_0xd1c992={};_0xd1c992[_0x99e0('0x19')]=_[_0x99e0('0x1a')](db[_0x99e0('0x16')][_0x99e0('0x17')]);_0xd1c992[_0x99e0('0x1b')]=_['keys'](_0x43ce3c[_0x99e0('0x1b')]);_0xd1c992[_0x99e0('0x24')]=_[_0x99e0('0x1c')](_0xd1c992['model'],_0xd1c992[_0x99e0('0x1b')]);_0x11c99f[_0x99e0('0x1e')]=_[_0x99e0('0x1c')](_0xd1c992['model'],qs[_0x99e0('0x1d')](_0x43ce3c[_0x99e0('0x1b')][_0x99e0('0x1d')]));_0x11c99f['attributes']=_0x11c99f[_0x99e0('0x1e')][_0x99e0('0x1f')]?_0x11c99f['attributes']:_0xd1c992[_0x99e0('0x19')];if(_0x43ce3c[_0x99e0('0x1b')]['includeAll']){_0x11c99f[_0x99e0('0x28')]=[{'all':!![]}];}_0x11c99f=_[_0x99e0('0x26')]({},_0x11c99f,_0x43ce3c['options']);return db[_0x99e0('0x16')]['find'](_0x11c99f)[_0x99e0('0xf')](handleEntityNotFound(_0x27fd72,null))[_0x99e0('0xf')](respondWithResult(_0x27fd72,null))['catch'](handleError(_0x27fd72,null));};exports[_0x99e0('0x2d')]=function(_0x5c6345,_0x4be8d0){return db[_0x99e0('0x16')][_0x99e0('0x2d')](_0x5c6345['body'],{})[_0x99e0('0xf')](respondWithResult(_0x4be8d0,0xc9))['catch'](handleError(_0x4be8d0,null));};exports[_0x99e0('0xe')]=function(_0xdcfb73,_0x19cb41){if(_0xdcfb73[_0x99e0('0x2e')]['id']){delete _0xdcfb73[_0x99e0('0x2e')]['id'];}return db[_0x99e0('0x16')][_0x99e0('0x2f')]({'where':{'id':_0xdcfb73[_0x99e0('0x2c')]['id']}})[_0x99e0('0xf')](handleEntityNotFound(_0x19cb41,null))[_0x99e0('0xf')](saveUpdates(_0xdcfb73[_0x99e0('0x2e')],null))[_0x99e0('0xf')](respondWithResult(_0x19cb41,null))[_0x99e0('0x2b')](handleError(_0x19cb41,null));};exports[_0x99e0('0x10')]=function(_0x433360,_0x831326){return db[_0x99e0('0x16')][_0x99e0('0x2f')]({'where':{'id':_0x433360[_0x99e0('0x2c')]['id']}})[_0x99e0('0xf')](handleEntityNotFound(_0x831326,null))[_0x99e0('0xf')](removeEntity(_0x831326,null))[_0x99e0('0x2b')](handleError(_0x831326,null));};exports[_0x99e0('0x30')]=function(_0x18dc10,_0x5db620){var _0x5374fe={};var _0x34e20f={};var _0x4ab793;var _0x2ef6f8;return db[_0x99e0('0x16')][_0x99e0('0x31')]({'where':{'id':_0x18dc10['params']['id']}})['then'](handleEntityNotFound(_0x5db620,null))[_0x99e0('0xf')](function(_0x1553b1){if(_0x1553b1){_0x4ab793=_0x1553b1;_0x34e20f[_0x99e0('0x19')]=_[_0x99e0('0x1a')](db['Dynamics365Configuration'][_0x99e0('0x17')]);_0x34e20f[_0x99e0('0x1b')]=_[_0x99e0('0x1a')](_0x18dc10[_0x99e0('0x1b')]);_0x34e20f[_0x99e0('0x24')]=_[_0x99e0('0x1c')](_0x34e20f[_0x99e0('0x19')],_0x34e20f[_0x99e0('0x1b')]);_0x5374fe[_0x99e0('0x1e')]=_['intersection'](_0x34e20f[_0x99e0('0x19')],qs[_0x99e0('0x1d')](_0x18dc10[_0x99e0('0x1b')][_0x99e0('0x1d')]));_0x5374fe[_0x99e0('0x1e')]=_0x5374fe['attributes'][_0x99e0('0x1f')]?_0x5374fe[_0x99e0('0x1e')]:_0x34e20f[_0x99e0('0x19')];_0x5374fe['order']=qs['sort'](_0x18dc10[_0x99e0('0x1b')][_0x99e0('0x22')]);_0x5374fe[_0x99e0('0x23')]=qs[_0x99e0('0x24')](_[_0x99e0('0x32')](_0x18dc10[_0x99e0('0x1b')],_0x34e20f[_0x99e0('0x24')]));if(_0x18dc10[_0x99e0('0x1b')][_0x99e0('0x25')]){_0x5374fe[_0x99e0('0x23')]=_[_0x99e0('0x26')](_0x5374fe[_0x99e0('0x23')],{'$or':_['map'](_0x5374fe[_0x99e0('0x1e')],function(_0x129ca2){var _0xa1877f={};_0xa1877f[_0x129ca2]={'$like':'%'+_0x18dc10[_0x99e0('0x1b')]['filter']+'%'};return _0xa1877f;})});}_0x5374fe=_[_0x99e0('0x26')]({},_0x5374fe,_0x18dc10[_0x99e0('0x33')]);return _0x4ab793[_0x99e0('0x30')](_0x5374fe);}})['then'](function(_0x49f861){if(_0x49f861){_0x2ef6f8=_0x49f861[_0x99e0('0x1f')];if(!_0x18dc10[_0x99e0('0x1b')][_0x99e0('0x34')](_0x99e0('0x20'))){_0x5374fe[_0x99e0('0xb')]=qs[_0x99e0('0xb')](_0x18dc10['query']['limit']);_0x5374fe[_0x99e0('0xa')]=qs['offset'](_0x18dc10[_0x99e0('0x1b')][_0x99e0('0xa')]);}return _0x4ab793[_0x99e0('0x30')](_0x5374fe);}})[_0x99e0('0xf')](function(_0x5516d6){if(_0x5516d6){return _0x5516d6?{'count':_0x2ef6f8,'rows':_0x5516d6}:null;}})[_0x99e0('0xf')](respondWithResult(_0x5db620,null))['catch'](handleError(_0x5db620,null));};exports['addConfiguration']=function(_0x37f219,_0x5485d0){if(_0x37f219[_0x99e0('0x2e')]['id']){delete _0x37f219['body']['id'];}return db[_0x99e0('0x16')][_0x99e0('0x31')]({'where':{'id':_0x37f219[_0x99e0('0x2c')]['id']}})[_0x99e0('0xf')](handleEntityNotFound(_0x5485d0,null))['then'](function(_0x188480){if(_0x188480){_0x37f219[_0x99e0('0x2e')][_0x99e0('0x35')]=_0x188480['id'];_0x37f219[_0x99e0('0x2e')][_0x99e0('0x36')]=integrations['getSubjects'](_0x37f219[_0x99e0('0x2e')][_0x99e0('0x37')],_0x37f219[_0x99e0('0x2e')][_0x99e0('0x38')]);_0x37f219[_0x99e0('0x2e')][_0x99e0('0x39')]=integrations['getDescriptions'](_0x37f219[_0x99e0('0x2e')][_0x99e0('0x37')],_0x37f219[_0x99e0('0x2e')][_0x99e0('0x38')]);return db['Dynamics365Configuration'][_0x99e0('0x2d')](_0x37f219['body'],{'include':[{'model':db[_0x99e0('0x3a')],'as':_0x99e0('0x36')},{'model':db[_0x99e0('0x3a')],'as':_0x99e0('0x39')}]});}return null;})['then'](respondWithResult(_0x5485d0,null))[_0x99e0('0x2b')](handleError(_0x5485d0,null));};function sanitizeRemoteUri(_0x2a2a7b){var _0xc365c2=_0x2a2a7b[_0x99e0('0x3b')](-0x1);if(_0xc365c2==='/')return _0x2a2a7b[_0x99e0('0x3c')](0x0,_0x2a2a7b[_0x99e0('0x3d')](_0xc365c2));return _0x2a2a7b;}function getWebApiUrl(_0x3298dc){return util[_0x99e0('0x3e')](_0x99e0('0x3f'),_0x3298dc);}exports[_0x99e0('0x40')]=function(_0x5d383a,_0x52bd03){var _0x1cd4ed=_0x5d383a['query'][_0x99e0('0x41')];var _0x127929=_0x1cd4ed==='incident'?'Incident':_0x99e0('0x42');var _0x268dc4='';var _0x15e92d='';var _0x77ba86='';var _0x325a70='';var _0x363e83='';var _0x760538='';var _0x89446='';var _0x5d6640='';var _0xae0c00=[_0x99e0('0x43'),_0x99e0('0x44'),'customerid',_0x99e0('0x45'),'caseorigincode',_0x99e0('0x46'),_0x99e0('0x47'),_0x99e0('0x48'),_0x99e0('0x49'),_0x99e0('0x4a')];var _0x22cb40=[_0x99e0('0x4b'),_0x99e0('0x4c'),_0x99e0('0x4d'),_0x99e0('0x4e'),_0x99e0('0x4f'),'contactidyominame',_0x99e0('0x50'),_0x99e0('0x51'),'createdbyexternalpartyname',_0x99e0('0x52'),_0x99e0('0x53'),_0x99e0('0x54'),_0x99e0('0x55'),_0x99e0('0x56'),_0x99e0('0x57'),'customeridname','customeridtype','customeridyominame','emailaddress',_0x99e0('0x58'),_0x99e0('0x59'),_0x99e0('0x5a'),'escalatedon',_0x99e0('0x5b'),_0x99e0('0x5c'),_0x99e0('0x5d'),_0x99e0('0x5e'),_0x99e0('0x5f'),_0x99e0('0x60'),'lastonholdtime',_0x99e0('0x61'),_0x99e0('0x62'),_0x99e0('0x63'),'modifiedbyname',_0x99e0('0x64'),_0x99e0('0x65'),'modifiedonbehalfbyname',_0x99e0('0x66'),'msdyn_incidenttypename',_0x99e0('0x67'),'numberofchildincidents',_0x99e0('0x68'),'overriddencreatedon','owneridname',_0x99e0('0x69'),_0x99e0('0x6a'),_0x99e0('0x6b'),_0x99e0('0x6c'),_0x99e0('0x6d'),_0x99e0('0x6e'),_0x99e0('0x6f'),'productserialnumber',_0x99e0('0x70'),'resolvebykpiidname',_0x99e0('0x71'),'responsiblecontactidname',_0x99e0('0x72'),_0x99e0('0x73'),_0x99e0('0x74'),_0x99e0('0x75'),_0x99e0('0x76'),_0x99e0('0x77'),_0x99e0('0x78'),'subjectidname',_0x99e0('0x79'),'timezoneruleversionnumber',_0x99e0('0x7a'),_0x99e0('0x7b'),'utcconversiontimezonecode',_0x99e0('0x7c')];var _0x1d2ea2=_0xae0c00['concat'](_0x22cb40);return db[_0x99e0('0x16')][_0x99e0('0x31')]({'where':{'id':_0x5d383a[_0x99e0('0x2c')]['id']},'attributes':['id',_0x99e0('0x7d'),_0x99e0('0x7e'),_0x99e0('0x7f'),'tenantId',_0x99e0('0x80'),_0x99e0('0x81'),_0x99e0('0x82')],'include':[{'model':db[_0x99e0('0x83')],'as':_0x99e0('0x83'),'attributes':['id',_0x99e0('0x84'),'data7']}]})['then'](handleEntityNotFound(_0x52bd03,null))[_0x99e0('0xf')](function(_0x4e24b4){if(_0x4e24b4){if(_0x4e24b4[_0x99e0('0x82')]){_0x4e24b4[_0x99e0('0x85')]=_0x4e24b4[_0x99e0('0x83')][_0x99e0('0x84')];_0x5d6640=sanitizeRemoteUri(_0x4e24b4['CloudProvider'][_0x99e0('0x86')]);_0x89446=getWebApiUrl(_0x5d6640);return _0x4e24b4;}_0x5d6640=sanitizeRemoteUri(_0x4e24b4['remoteUri']);_0x89446=getWebApiUrl(_0x5d6640);var _0x330419={'method':_0x99e0('0x87'),'uri':'https://login.microsoftonline.com/'+_0x4e24b4[_0x99e0('0x88')]+'/oauth2/token','form':{'client_id':_0x4e24b4[_0x99e0('0x80')],'resource':_0x5d6640,'username':_0x4e24b4[_0x99e0('0x7d')],'password':_0x4e24b4['password'],'grant_type':_0x99e0('0x7e'),'client_secret':_0x4e24b4[_0x99e0('0x81')]},'json':!![]};return rp(_0x330419);}})[_0x99e0('0xf')](function(_0xe7efdc){_0x760538=_0xe7efdc['access_token'];var _0x2c4a7f={'method':_0x99e0('0x89'),'uri':encodeURI(_0x89446+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x127929+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x760538,'If-None-Match':null,'OData-Version':_0x99e0('0x8a')},'json':!![]};return rp(_0x2c4a7f);})[_0x99e0('0xf')](function(_0x39c81d){var _0x283315=_0x39c81d[_0x99e0('0x8b')][0x0];var _0x5a1fb9=_0x283315[_0x99e0('0x8c')];var _0x40f40d={'method':_0x99e0('0x89'),'uri':_0x89446+'EntityDefinitions('+_0x5a1fb9+_0x99e0('0x8d'),'headers':{'Authorization':_0x99e0('0x8e')+_0x760538,'If-None-Match':null,'OData-Version':_0x99e0('0x8a')},'json':!![]};return rp(_0x40f40d);})[_0x99e0('0xf')](function(_0x556534){_0x268dc4=_0x556534;_0x15e92d=_0x268dc4[_0x99e0('0x8f')];_0x15e92d=_[_0x99e0('0x90')](_0x15e92d,function(_0x407f22){return!_0x1d2ea2[_0x99e0('0x91')](_0x407f22[_0x99e0('0x92')]);});var _0x46ef65=[];var _0x1766bd=[];_0x15e92d[_0x99e0('0x93')](function(_0x185043){if(_0x185043[_0x99e0('0x94')]){var _0x3ae35d=_0x185043[_0x99e0('0x94')][_0x99e0('0x3c')](_0x185043[_0x99e0('0x94')][_0x99e0('0x3d')]('.')+0x1);if(_0x3ae35d===_0x99e0('0x95')){_0x46ef65[_0x99e0('0x96')](getSelectList(_0x89446,_0x1cd4ed,_0x1766bd,_0x268dc4['MetadataId'],_0x185043[_0x99e0('0x8c')],_0x760538));}}});return Promise[_0x99e0('0x97')](_0x46ef65);})[_0x99e0('0xf')](function(_0x3afa80){_0x77ba86=_0x3afa80[0x0];var _0x3493c4=[];var _0x3a2040=[];_0x15e92d['forEach'](function(_0x2e4065){if(!_[_0x99e0('0x98')](_0x2e4065[_0x99e0('0x94')])){var _0x5368ad=_0x2e4065[_0x99e0('0x94')][_0x99e0('0x3c')](_0x2e4065['@odata.type'][_0x99e0('0x3d')]('.')+0x1);if(_0x5368ad===_0x99e0('0x99')){_0x3493c4[_0x99e0('0x96')](getBooleanList(_0x89446,_0x1cd4ed,_0x3a2040,_0x268dc4['MetadataId'],_0x2e4065[_0x99e0('0x8c')],_0x760538));}}});return Promise[_0x99e0('0x97')](_0x3493c4);})[_0x99e0('0xf')](function(_0x726a12){_0x325a70=_0x726a12[0x0];var _0x3b7c23=[];var _0x5b6aa9=[];_0x15e92d[_0x99e0('0x93')](function(_0x1e8fc7){if(_0x1e8fc7[_0x99e0('0x94')]){var _0x350d65=_0x1e8fc7[_0x99e0('0x94')][_0x99e0('0x3c')](_0x1e8fc7[_0x99e0('0x94')]['lastIndexOf']('.')+0x1);if(_0x350d65===_0x99e0('0x9a')||_0x350d65==='DoubleAttributeMetadata'||_0x350d65==='BigIntAttributeMetadata'||_0x350d65===_0x99e0('0x9b')||_0x350d65===_0x99e0('0x9c')||_0x350d65===_0x99e0('0x9d')||_0x350d65===_0x99e0('0x9e')||_0x350d65===_0x99e0('0x9f')||_0x350d65===_0x99e0('0xa0')||_0x350d65===_0x99e0('0xa1')){_0x3b7c23[_0x99e0('0x96')](getInputList(_0x89446,_0x1cd4ed,_0x350d65,_0x5b6aa9,_0x268dc4['MetadataId'],_0x1e8fc7[_0x99e0('0x8c')],_0x760538));}}});return Promise[_0x99e0('0x97')](_0x3b7c23);})[_0x99e0('0xf')](function(_0x2dda71){_0x363e83=_0x2dda71[0x0];var _0x3f639e=_0x77ba86['concat'](_0x325a70)[_0x99e0('0xa2')](_0x363e83);var _0x3f7af7={'count':_0x3f639e[_0x99e0('0x1f')],'rows':_0x3f639e};return _0x3f7af7;})[_0x99e0('0xf')](respondWithResult(_0x52bd03,null))['catch'](function(_0x1dbf1f){var _0x51202c=_0x5d383a[_0x99e0('0x1b')][_0x99e0('0xa3')]?0x1f4:_0x1dbf1f['statusCode']||0x1f4;logger[_0x99e0('0x12')](_0x1dbf1f[_0x99e0('0x13')]);delete _0x1dbf1f[_0x99e0('0x14')];if(_0x51202c===0x191){_0x51202c=0x190;}_0x52bd03[_0x99e0('0x6')](_0x51202c)[_0x99e0('0xa4')](_0x5d383a['query'][_0x99e0('0xa3')]?{'message':_0x99e0('0xa5'),'statusCode':_0x1dbf1f[_0x99e0('0xa6')]}:_0x1dbf1f);});};function getSelectList(_0x54439a,_0x31cd7d,_0x44cc57,_0x555837,_0x3d4506,_0x171910){var _0x45bcfb={'method':_0x99e0('0x89'),'uri':_0x54439a+_0x99e0('0xa7')+_0x555837+')/Attributes('+_0x3d4506+_0x99e0('0xa8')+_0x99e0('0xa9'),'headers':{'Authorization':'Bearer\x20'+_0x171910,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x45bcfb)['then'](function(_0x4f2dd3){var _0x556b97=[];var _0x3f62c1=_0x4f2dd3[_0x99e0('0xaa')][_0x99e0('0xab')];_0x3f62c1['forEach'](function(_0x350524){_0x556b97['push']({'name':_0x350524['Label'][_0x99e0('0xac')][_0x99e0('0xad')],'value':String(_0x350524[_0x99e0('0xae')])});});var _0x2d2f35={'id':_0x31cd7d+'_'+_0x4f2dd3[_0x99e0('0x92')],'name':_0x4f2dd3['DisplayName']['UserLocalizedLabel'][_0x99e0('0xad')],'custom':![],'options':_0x556b97};_0x44cc57[_0x99e0('0x96')](_0x2d2f35);return _0x44cc57;});}function getBooleanList(_0x1e356b,_0x2ba2c1,_0x2ef5bf,_0x27468a,_0x298714,_0x2d96c3){var _0x53ff4f={'method':'GET','uri':_0x1e356b+'EntityDefinitions('+_0x27468a+_0x99e0('0xaf')+_0x298714+_0x99e0('0xb0'),'headers':{'Authorization':'Bearer\x20'+_0x2d96c3,'If-None-Match':null,'OData-Version':_0x99e0('0x8a')},'json':!![]};return rp(_0x53ff4f)[_0x99e0('0xf')](function(_0x3b506c){var _0x5c0db8=[];_0x5c0db8[_0x99e0('0x96')]({'name':_0x3b506c[_0x99e0('0xaa')][_0x99e0('0xb1')][_0x99e0('0xad')][_0x99e0('0xac')][_0x99e0('0xad')],'value':_0x99e0('0xb2')},{'name':_0x3b506c[_0x99e0('0xaa')][_0x99e0('0xb3')][_0x99e0('0xad')]['UserLocalizedLabel'][_0x99e0('0xad')],'value':_0x99e0('0xb4')});var _0x437e30={'id':_0x2ba2c1+'_'+_0x3b506c['LogicalName'],'name':_0x3b506c['DisplayName'][_0x99e0('0xac')][_0x99e0('0xad')],'custom':![],'options':_0x5c0db8};_0x2ef5bf[_0x99e0('0x96')](_0x437e30);return _0x2ef5bf;});}function getInputList(_0x2a947b,_0x4b4d6a,_0x4db524,_0x319bc4,_0x405ff3,_0x54d98a,_0x2921cc){var _0x346b1e={'method':_0x99e0('0x89'),'uri':_0x2a947b+'EntityDefinitions('+_0x405ff3+')/Attributes('+_0x54d98a+_0x99e0('0xb5')+_0x4db524+_0x99e0('0xb6'),'headers':{'Authorization':'Bearer\x20'+_0x2921cc,'If-None-Match':null,'OData-Version':_0x99e0('0x8a')},'json':!![]};return rp(_0x346b1e)[_0x99e0('0xf')](function(_0x4d90a6){var _0xe3c15b={'id':_0x4b4d6a+'_'+_0x4d90a6[_0x99e0('0x92')],'name':_0x4d90a6[_0x99e0('0xb7')]['UserLocalizedLabel']?_0x4d90a6[_0x99e0('0xb7')][_0x99e0('0xac')][_0x99e0('0xad')]:_0x4d90a6['LogicalName'],'custom':![],'options':[]};_0x319bc4['push'](_0xe3c15b);return _0x319bc4;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index b013793..5c9473d 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(_0x20e4f5,_0x508e65){var _0x5eed4b=function(_0x447acd){while(--_0x447acd){_0x20e4f5['push'](_0x20e4f5['shift']());}};_0x5eed4b(++_0x508e65);}(_0x757a,0xde));var _0xa757=function(_0x597064,_0x2d85ae){_0x597064=_0x597064-0x0;var _0x4031b3=_0x757a[_0x597064];return _0x4031b3;};'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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x16b3e8,_0x5ebd88){var _0x340d24=function(_0x1063e9){while(--_0x1063e9){_0x16b3e8['push'](_0x16b3e8['shift']());}};_0x340d24(++_0x5ebd88);}(_0xe706,0xa3));var _0x6e70=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0xe706[_0x5a1a51];return _0x47edd7;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 9aaa3b1..5a006d0 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 _0x88ad=['findAll','options','where','attributes','include','model','map','then','ShowDynamics365Account','Dynamics365Account','find','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetDynamics365Account'];(function(_0x4a0598,_0x16b2d5){var _0x166c4e=function(_0x7a223e){while(--_0x7a223e){_0x4a0598['push'](_0x4a0598['shift']());}};_0x166c4e(++_0x16b2d5);}(_0x88ad,0x10d));var _0xd88a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x88ad[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xd88a('0x0'));var moment=require(_0xd88a('0x1'));var BPromise=require(_0xd88a('0x2'));var rs=require(_0xd88a('0x3'));var fs=require('fs');var Redis=require(_0xd88a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd88a('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd88a('0x6')][_0xd88a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3ced48,_0x3da03e,_0x5d7689){return new BPromise(function(_0x3626b1,_0x4e86dc){return client[_0xd88a('0x8')](_0x3ced48,_0x5d7689)['then'](function(_0x140112){logger[_0xd88a('0x9')](_0xd88a('0xa'),_0x3da03e,_0xd88a('0xb'));logger[_0xd88a('0xc')](_0xd88a('0xd'),_0x3da03e,_0xd88a('0xb'),JSON['stringify'](_0x140112));if(_0x140112[_0xd88a('0xe')]){if(_0x140112[_0xd88a('0xe')][_0xd88a('0xf')]===0x1f4){logger[_0xd88a('0xe')](_0xd88a('0xa'),_0x3da03e,_0x140112['error']['message']);return _0x4e86dc(_0x140112[_0xd88a('0xe')][_0xd88a('0x10')]);}logger[_0xd88a('0xe')](_0xd88a('0xa'),_0x3da03e,_0x140112[_0xd88a('0xe')]['message']);return _0x3626b1(_0x140112['error'][_0xd88a('0x10')]);}else{logger[_0xd88a('0x9')](_0xd88a('0xa'),_0x3da03e,_0xd88a('0xb'));_0x3626b1(_0x140112['result'][_0xd88a('0x10')]);}})[_0xd88a('0x11')](function(_0x34e641){logger[_0xd88a('0xe')](_0xd88a('0xa'),_0x3da03e,_0x34e641);_0x4e86dc(_0x34e641);});});}exports[_0xd88a('0x12')]=function(_0x37ec2f){var _0x1efbad=this;return new Promise(function(_0x16a7be,_0x2c85bb){return db['Dynamics365Account'][_0xd88a('0x13')]({'raw':_0x37ec2f[_0xd88a('0x14')]?_0x37ec2f[_0xd88a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x37ec2f['options']?_0x37ec2f[_0xd88a('0x14')][_0xd88a('0x15')]||null:null,'attributes':_0x37ec2f[_0xd88a('0x14')]?_0x37ec2f[_0xd88a('0x14')][_0xd88a('0x16')]||null:null,'limit':_0x37ec2f[_0xd88a('0x14')]?_0x37ec2f['options']['limit']||null:null,'include':_0x37ec2f[_0xd88a('0x14')]?_0x37ec2f[_0xd88a('0x14')][_0xd88a('0x17')]?_['map'](_0x37ec2f[_0xd88a('0x14')][_0xd88a('0x17')],function(_0x314280){return{'model':db[_0x314280[_0xd88a('0x18')]],'as':_0x314280['as'],'attributes':_0x314280['attributes'],'include':_0x314280[_0xd88a('0x17')]?_[_0xd88a('0x19')](_0x314280[_0xd88a('0x17')],function(_0x2f562){return{'model':db[_0x2f562[_0xd88a('0x18')]],'as':_0x2f562['as'],'attributes':_0x2f562[_0xd88a('0x16')],'include':_0x2f562[_0xd88a('0x17')]?_[_0xd88a('0x19')](_0x2f562[_0xd88a('0x17')],function(_0x4aacd8){return{'model':db[_0x4aacd8[_0xd88a('0x18')]],'as':_0x4aacd8['as'],'attributes':_0x4aacd8['attributes']};}):[]};}):[]};}):[]:[]})[_0xd88a('0x1a')](function(_0xfa458){logger[_0xd88a('0x9')]('GetDynamics365Account',_0x37ec2f);logger[_0xd88a('0xc')](_0xd88a('0x12'),_0x37ec2f,JSON['stringify'](_0xfa458));_0x16a7be(_0xfa458);})['catch'](function(_0x8fc249){logger[_0xd88a('0xe')]('GetDynamics365Account',_0x8fc249[_0xd88a('0x10')],_0x37ec2f);_0x2c85bb(_0x1efbad[_0xd88a('0xe')](0x1f4,_0x8fc249['message']));});});};exports[_0xd88a('0x1b')]=function(_0x1f4770){var _0x3088c1=this;return new Promise(function(_0x3b52c4,_0x59f565){return db[_0xd88a('0x1c')][_0xd88a('0x1d')]({'raw':_0x1f4770[_0xd88a('0x14')]?_0x1f4770[_0xd88a('0x14')][_0xd88a('0x1e')]===undefined?!![]:![]:!![],'where':_0x1f4770[_0xd88a('0x14')]?_0x1f4770[_0xd88a('0x14')][_0xd88a('0x15')]||null:null,'attributes':_0x1f4770[_0xd88a('0x14')]?_0x1f4770[_0xd88a('0x14')]['attributes']||null:null,'include':_0x1f4770[_0xd88a('0x14')]?_0x1f4770['options'][_0xd88a('0x17')]?_[_0xd88a('0x19')](_0x1f4770[_0xd88a('0x14')]['include'],function(_0x381dcf){return{'model':db[_0x381dcf[_0xd88a('0x18')]],'as':_0x381dcf['as'],'attributes':_0x381dcf[_0xd88a('0x16')],'include':_0x381dcf[_0xd88a('0x17')]?_[_0xd88a('0x19')](_0x381dcf['include'],function(_0x54be5f){return{'model':db[_0x54be5f[_0xd88a('0x18')]],'as':_0x54be5f['as'],'attributes':_0x54be5f['attributes'],'include':_0x54be5f[_0xd88a('0x17')]?_['map'](_0x54be5f['include'],function(_0x1c8f92){return{'model':db[_0x1c8f92['model']],'as':_0x1c8f92['as'],'attributes':_0x1c8f92[_0xd88a('0x16')]};}):[]};}):[]};}):[]:[]})[_0xd88a('0x1a')](function(_0x56123d){logger[_0xd88a('0x9')](_0xd88a('0x1b'),_0x1f4770);logger[_0xd88a('0xc')](_0xd88a('0x1b'),_0x1f4770,JSON[_0xd88a('0x1f')](_0x56123d));_0x3b52c4(_0x56123d);})[_0xd88a('0x11')](function(_0x20941f){logger[_0xd88a('0xe')](_0xd88a('0x1b'),_0x20941f[_0xd88a('0x10')],_0x1f4770);_0x59f565(_0x3088c1[_0xd88a('0xe')](0x1f4,_0x20941f[_0xd88a('0x10')]));});});}; \ No newline at end of file +var _0x7c1c=['client','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','findAll','options','raw','where','attributes','include','map','model','ShowDynamics365Account','Dynamics365Account','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5337ab,_0x2653a6){var _0x59e033=function(_0x223e2f){while(--_0x223e2f){_0x5337ab['push'](_0x5337ab['shift']());}};_0x59e033(++_0x2653a6);}(_0x7c1c,0x1ca));var _0xc7c1=function(_0x5554c5,_0x4e2cec){_0x5554c5=_0x5554c5-0x0;var _0x359003=_0x7c1c[_0x5554c5];return _0x359003;};'use strict';var _=require(_0xc7c1('0x0'));var util=require(_0xc7c1('0x1'));var moment=require(_0xc7c1('0x2'));var BPromise=require(_0xc7c1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7c1('0x4'));var db=require(_0xc7c1('0x5'))['db'];var utils=require(_0xc7c1('0x6'));var logger=require('../../config/logger')(_0xc7c1('0x7'));var config=require(_0xc7c1('0x8'));var jayson=require(_0xc7c1('0x9'));var client=jayson[_0xc7c1('0xa')][_0xc7c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36d63a,_0x223660,_0x4e2852){return new BPromise(function(_0x2b9e2b,_0x3300b3){return client[_0xc7c1('0xc')](_0x36d63a,_0x4e2852)[_0xc7c1('0xd')](function(_0x1a7232){logger[_0xc7c1('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x223660,_0xc7c1('0xf'));logger[_0xc7c1('0x10')](_0xc7c1('0x11'),_0x223660,_0xc7c1('0xf'),JSON[_0xc7c1('0x12')](_0x1a7232));if(_0x1a7232[_0xc7c1('0x13')]){if(_0x1a7232[_0xc7c1('0x13')]['code']===0x1f4){logger[_0xc7c1('0x13')](_0xc7c1('0x14'),_0x223660,_0x1a7232[_0xc7c1('0x13')][_0xc7c1('0x15')]);return _0x3300b3(_0x1a7232['error'][_0xc7c1('0x15')]);}logger[_0xc7c1('0x13')](_0xc7c1('0x14'),_0x223660,_0x1a7232[_0xc7c1('0x13')]['message']);return _0x2b9e2b(_0x1a7232[_0xc7c1('0x13')]['message']);}else{logger[_0xc7c1('0xe')](_0xc7c1('0x14'),_0x223660,_0xc7c1('0xf'));_0x2b9e2b(_0x1a7232[_0xc7c1('0x16')][_0xc7c1('0x15')]);}})[_0xc7c1('0x17')](function(_0x54b331){logger[_0xc7c1('0x13')](_0xc7c1('0x14'),_0x223660,_0x54b331);_0x3300b3(_0x54b331);});});}exports[_0xc7c1('0x18')]=function(_0x37f988){var _0x4ab808=this;return new Promise(function(_0x323061,_0x388524){return db['Dynamics365Account'][_0xc7c1('0x19')]({'raw':_0x37f988['options']?_0x37f988[_0xc7c1('0x1a')][_0xc7c1('0x1b')]===undefined?!![]:![]:!![],'where':_0x37f988[_0xc7c1('0x1a')]?_0x37f988['options'][_0xc7c1('0x1c')]||null:null,'attributes':_0x37f988[_0xc7c1('0x1a')]?_0x37f988[_0xc7c1('0x1a')][_0xc7c1('0x1d')]||null:null,'limit':_0x37f988[_0xc7c1('0x1a')]?_0x37f988[_0xc7c1('0x1a')]['limit']||null:null,'include':_0x37f988[_0xc7c1('0x1a')]?_0x37f988[_0xc7c1('0x1a')][_0xc7c1('0x1e')]?_[_0xc7c1('0x1f')](_0x37f988['options'][_0xc7c1('0x1e')],function(_0x457624){return{'model':db[_0x457624['model']],'as':_0x457624['as'],'attributes':_0x457624[_0xc7c1('0x1d')],'include':_0x457624[_0xc7c1('0x1e')]?_[_0xc7c1('0x1f')](_0x457624[_0xc7c1('0x1e')],function(_0x579c16){return{'model':db[_0x579c16['model']],'as':_0x579c16['as'],'attributes':_0x579c16[_0xc7c1('0x1d')],'include':_0x579c16[_0xc7c1('0x1e')]?_[_0xc7c1('0x1f')](_0x579c16[_0xc7c1('0x1e')],function(_0x3cd92f){return{'model':db[_0x3cd92f[_0xc7c1('0x20')]],'as':_0x3cd92f['as'],'attributes':_0x3cd92f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5768d8){logger[_0xc7c1('0xe')](_0xc7c1('0x18'),_0x37f988);logger['debug'](_0xc7c1('0x18'),_0x37f988,JSON[_0xc7c1('0x12')](_0x5768d8));_0x323061(_0x5768d8);})[_0xc7c1('0x17')](function(_0x3ad268){logger[_0xc7c1('0x13')]('GetDynamics365Account',_0x3ad268[_0xc7c1('0x15')],_0x37f988);_0x388524(_0x4ab808[_0xc7c1('0x13')](0x1f4,_0x3ad268[_0xc7c1('0x15')]));});});};exports[_0xc7c1('0x21')]=function(_0x2113ca){var _0xc302d6=this;return new Promise(function(_0x1710f3,_0x1b47c7){return db[_0xc7c1('0x22')][_0xc7c1('0x23')]({'raw':_0x2113ca[_0xc7c1('0x1a')]?_0x2113ca[_0xc7c1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2113ca['options']?_0x2113ca[_0xc7c1('0x1a')][_0xc7c1('0x1c')]||null:null,'attributes':_0x2113ca[_0xc7c1('0x1a')]?_0x2113ca['options'][_0xc7c1('0x1d')]||null:null,'include':_0x2113ca[_0xc7c1('0x1a')]?_0x2113ca['options']['include']?_[_0xc7c1('0x1f')](_0x2113ca[_0xc7c1('0x1a')]['include'],function(_0x28e39d){return{'model':db[_0x28e39d[_0xc7c1('0x20')]],'as':_0x28e39d['as'],'attributes':_0x28e39d[_0xc7c1('0x1d')],'include':_0x28e39d[_0xc7c1('0x1e')]?_[_0xc7c1('0x1f')](_0x28e39d[_0xc7c1('0x1e')],function(_0x4673c9){return{'model':db[_0x4673c9[_0xc7c1('0x20')]],'as':_0x4673c9['as'],'attributes':_0x4673c9[_0xc7c1('0x1d')],'include':_0x4673c9['include']?_[_0xc7c1('0x1f')](_0x4673c9['include'],function(_0x3aee18){return{'model':db[_0x3aee18[_0xc7c1('0x20')]],'as':_0x3aee18['as'],'attributes':_0x3aee18[_0xc7c1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc7c1('0xd')](function(_0x110038){logger[_0xc7c1('0xe')](_0xc7c1('0x21'),_0x2113ca);logger[_0xc7c1('0x10')](_0xc7c1('0x21'),_0x2113ca,JSON[_0xc7c1('0x12')](_0x110038));_0x1710f3(_0x110038);})[_0xc7c1('0x17')](function(_0x293659){logger['error'](_0xc7c1('0x21'),_0x293659['message'],_0x2113ca);_0x1b47c7(_0xc302d6['error'](0x1f4,_0x293659[_0xc7c1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index a730309..c3c0887 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 _0x2c47=['getDescriptions','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects'];(function(_0x547e3b,_0x1f8a61){var _0x21f9bd=function(_0x5ee03b){while(--_0x5ee03b){_0x547e3b['push'](_0x547e3b['shift']());}};_0x21f9bd(++_0x1f8a61);}(_0x2c47,0xe8));var _0x72c4=function(_0x4d14e1,_0x4ba18a){_0x4d14e1=_0x4d14e1-0x0;var _0x1c669e=_0x2c47[_0x4d14e1];return _0x1c669e;};'use strict';var multer=require(_0x72c4('0x0'));var util=require('util');var path=require(_0x72c4('0x1'));var timeout=require(_0x72c4('0x2'));var express=require(_0x72c4('0x3'));var router=express[_0x72c4('0x4')]();var fs_extra=require(_0x72c4('0x5'));var auth=require(_0x72c4('0x6'));var interaction=require(_0x72c4('0x7'));var config=require(_0x72c4('0x8'));var controller=require(_0x72c4('0x9'));router[_0x72c4('0xa')]('/',auth['isAuthenticated'](),controller[_0x72c4('0xb')]);router[_0x72c4('0xa')](_0x72c4('0xc'),auth['isAuthenticated'](),controller[_0x72c4('0xd')]);router['get'](_0x72c4('0xe'),auth[_0x72c4('0xf')](),controller[_0x72c4('0x10')]);router[_0x72c4('0xa')](_0x72c4('0x11'),auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x72c4('0xf')](),controller[_0x72c4('0x12')]);router[_0x72c4('0x13')]('/',auth[_0x72c4('0xf')](),controller[_0x72c4('0x14')]);router[_0x72c4('0x15')]('/:id',auth[_0x72c4('0xf')](),controller[_0x72c4('0x16')]);router['delete'](_0x72c4('0xc'),auth[_0x72c4('0xf')](),controller[_0x72c4('0x17')]);module[_0x72c4('0x18')]=router; \ No newline at end of file +var _0x8c2d=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller','isAuthenticated','index','/:id','show','get','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x5bd626,_0xdbf46d){var _0x2661ca=function(_0x421ff4){while(--_0x421ff4){_0x5bd626['push'](_0x5bd626['shift']());}};_0x2661ca(++_0xdbf46d);}(_0x8c2d,0x1cb));var _0xd8c2=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x8c2d[_0x27bd2c];return _0x3784ea;};'use strict';var multer=require(_0xd8c2('0x0'));var util=require(_0xd8c2('0x1'));var path=require(_0xd8c2('0x2'));var timeout=require(_0xd8c2('0x3'));var express=require(_0xd8c2('0x4'));var router=express[_0xd8c2('0x5')]();var fs_extra=require(_0xd8c2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd8c2('0x7'));var config=require('../../config/environment');var controller=require(_0xd8c2('0x8'));router['get']('/',auth[_0xd8c2('0x9')](),controller[_0xd8c2('0xa')]);router['get'](_0xd8c2('0xb'),auth['isAuthenticated'](),controller[_0xd8c2('0xc')]);router[_0xd8c2('0xd')]('/:id/fields',auth[_0xd8c2('0x9')](),controller[_0xd8c2('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd8c2('0xf')]);router[_0xd8c2('0xd')](_0xd8c2('0x10'),auth[_0xd8c2('0x9')](),controller[_0xd8c2('0x11')]);router[_0xd8c2('0x12')]('/',auth[_0xd8c2('0x9')](),controller[_0xd8c2('0x13')]);router[_0xd8c2('0x14')](_0xd8c2('0xb'),auth['isAuthenticated'](),controller[_0xd8c2('0x15')]);router[_0xd8c2('0x16')](_0xd8c2('0xb'),auth[_0xd8c2('0x9')](),controller[_0xd8c2('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 1a4a11b..31ba013 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 _0x0078=['ENUM','contact','sequelize','exports','STRING','incident','phonecall'];(function(_0x5d234d,_0x5de2e0){var _0x45679c=function(_0xf703ee){while(--_0xf703ee){_0x5d234d['push'](_0x5d234d['shift']());}};_0x45679c(++_0x5de2e0);}(_0x0078,0x160));var _0x8007=function(_0x5ee4c3,_0x498d70){_0x5ee4c3=_0x5ee4c3-0x0;var _0x6179ac=_0x0078[_0x5ee4c3];return _0x6179ac;};'use strict';var Sequelize=require(_0x8007('0x0'));module[_0x8007('0x1')]={'name':{'type':Sequelize[_0x8007('0x2')]},'description':{'type':Sequelize[_0x8007('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x8007('0x3'),_0x8007('0x4')),'defaultValue':_0x8007('0x3')},'moduleCreate':{'type':Sequelize[_0x8007('0x5')](_0x8007('0x6'),'nothing'),'defaultValue':'contact','allowNull':![]}}; \ No newline at end of file +var _0x6f12=['nothing','sequelize','exports','STRING','phonecall','incident','contact'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x6f12,0x12e));var _0x26f1=function(_0x20709c,_0x1a96cb){_0x20709c=_0x20709c-0x0;var _0x933458=_0x6f12[_0x20709c];return _0x933458;};'use strict';var Sequelize=require(_0x26f1('0x0'));module[_0x26f1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x26f1('0x2')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0x26f1('0x3')),'defaultValue':_0x26f1('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x26f1('0x5'),_0x26f1('0x6')),'defaultValue':_0x26f1('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 679f5c1..9f0fa3c 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 _0x4f1e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','Dynamics365Configuration','findAll','catch','params','includeAll','include','find','create','body','getFields','findOne','hasOwnProperty','nolimit','Dynamics365Field','length','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x374f91,_0x513208){var _0x25d4a2=function(_0x2c6b08){while(--_0x2c6b08){_0x374f91['push'](_0x374f91['shift']());}};_0x25d4a2(++_0x513208);}(_0x4f1e,0x18d));var _0xe4f1=function(_0x3605df,_0x217ea5){_0x3605df=_0x3605df-0x0;var _0x12e7d1=_0x4f1e[_0x3605df];return _0x12e7d1;};'use strict';var emlformat=require(_0xe4f1('0x0'));var rimraf=require(_0xe4f1('0x1'));var zipdir=require(_0xe4f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe4f1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe4f1('0x4'));var util=require(_0xe4f1('0x5'));var path=require(_0xe4f1('0x6'));var sox=require(_0xe4f1('0x7'));var csv=require(_0xe4f1('0x8'));var ejs=require(_0xe4f1('0x9'));var fs=require('fs');var fs_extra=require(_0xe4f1('0xa'));var _=require('lodash');var squel=require(_0xe4f1('0xb'));var crypto=require(_0xe4f1('0xc'));var jsforce=require(_0xe4f1('0xd'));var deskjs=require(_0xe4f1('0xe'));var toCsv=require(_0xe4f1('0x8'));var querystring=require(_0xe4f1('0xf'));var Papa=require(_0xe4f1('0x10'));var Redis=require('ioredis');var authService=require(_0xe4f1('0x11'));var qs=require(_0xe4f1('0x12'));var as=require(_0xe4f1('0x13'));var hardwareService=require(_0xe4f1('0x14'));var logger=require(_0xe4f1('0x15'))(_0xe4f1('0x16'));var utils=require(_0xe4f1('0x17'));var config=require(_0xe4f1('0x18'));var licenseUtil=require(_0xe4f1('0x19'));var db=require(_0xe4f1('0x1a'))['db'];function respondWithStatusCode(_0x348592,_0x3d022e){_0x3d022e=_0x3d022e||0xcc;return function(_0x4cdd81){if(_0x4cdd81){return _0x348592['sendStatus'](_0x3d022e);}return _0x348592[_0xe4f1('0x1b')](_0x3d022e)[_0xe4f1('0x1c')]();};}function respondWithResult(_0x117f89,_0x538e81){_0x538e81=_0x538e81||0xc8;return function(_0x2f1c5c){if(_0x2f1c5c){return _0x117f89['status'](_0x538e81)['json'](_0x2f1c5c);}};}function respondWithFilteredResult(_0x1d0643,_0x55e605){return function(_0x59094e){if(_0x59094e){var _0x1d6d3e=typeof _0x55e605['offset']==='undefined'&&typeof _0x55e605[_0xe4f1('0x1d')]==='undefined';var _0x120b3b=_0x59094e['count'];var _0x174a27=_0x1d6d3e?0x0:_0x55e605['offset'];var _0x2c0172=_0x1d6d3e?_0x59094e[_0xe4f1('0x1e')]:_0x55e605[_0xe4f1('0x1f')]+_0x55e605['limit'];var _0x1a8d2a;if(_0x2c0172>=_0x120b3b){_0x2c0172=_0x120b3b;_0x1a8d2a=0xc8;}else{_0x1a8d2a=0xce;}_0x1d0643[_0xe4f1('0x1b')](_0x1a8d2a);return _0x1d0643[_0xe4f1('0x20')](_0xe4f1('0x21'),_0x174a27+'-'+_0x2c0172+'/'+_0x120b3b)[_0xe4f1('0x22')](_0x59094e);}return null;};}function patchUpdates(_0x4bfaf6){return function(_0x6eff5e){try{jsonpatch[_0xe4f1('0x23')](_0x6eff5e,_0x4bfaf6,!![]);}catch(_0x1434ba){return BPromise[_0xe4f1('0x24')](_0x1434ba);}return _0x6eff5e[_0xe4f1('0x25')]();};}function saveUpdates(_0x187b5a,_0x104e2f){return function(_0x1b0f93){if(_0x1b0f93){return _0x1b0f93[_0xe4f1('0x26')](_0x187b5a)[_0xe4f1('0x27')](function(_0x54b1d7){return _0x54b1d7;});}return null;};}function removeEntity(_0xcca93c,_0x185bf2){return function(_0x4a4cc1){if(_0x4a4cc1){return _0x4a4cc1[_0xe4f1('0x28')]()[_0xe4f1('0x27')](function(){_0xcca93c['status'](0xcc)[_0xe4f1('0x1c')]();});}};}function handleEntityNotFound(_0x2999cb,_0x503b59){return function(_0x58b2ca){if(!_0x58b2ca){_0x2999cb['sendStatus'](0x194);}return _0x58b2ca;};}function handleError(_0x218a8f,_0x5d98b8){_0x5d98b8=_0x5d98b8||0x1f4;return function(_0x269bc7){logger[_0xe4f1('0x29')](_0x269bc7[_0xe4f1('0x2a')]);if(_0x269bc7[_0xe4f1('0x2b')]){delete _0x269bc7[_0xe4f1('0x2b')];}_0x218a8f[_0xe4f1('0x1b')](_0x5d98b8)[_0xe4f1('0x2c')](_0x269bc7);};}exports[_0xe4f1('0x2d')]=function(_0x4abc3d,_0x3b4987){var _0x523e42={},_0x31a0ab={},_0x5995bb={'count':0x0,'rows':[]};var _0x1f74e6=_[_0xe4f1('0x2e')](db['Dynamics365Configuration'][_0xe4f1('0x2f')],function(_0x5679a0){return{'name':_0x5679a0[_0xe4f1('0x30')],'type':_0x5679a0[_0xe4f1('0x31')][_0xe4f1('0x32')]};});_0x31a0ab['model']=_[_0xe4f1('0x2e')](_0x1f74e6,_0xe4f1('0x2b'));_0x31a0ab[_0xe4f1('0x33')]=_[_0xe4f1('0x34')](_0x4abc3d[_0xe4f1('0x33')]);_0x31a0ab['filters']=_[_0xe4f1('0x35')](_0x31a0ab[_0xe4f1('0x36')],_0x31a0ab[_0xe4f1('0x33')]);_0x523e42[_0xe4f1('0x37')]=_[_0xe4f1('0x35')](_0x31a0ab[_0xe4f1('0x36')],qs[_0xe4f1('0x38')](_0x4abc3d[_0xe4f1('0x33')][_0xe4f1('0x38')]));_0x523e42[_0xe4f1('0x37')]=_0x523e42['attributes']['length']?_0x523e42[_0xe4f1('0x37')]:_0x31a0ab[_0xe4f1('0x36')];if(!_0x4abc3d[_0xe4f1('0x33')]['hasOwnProperty']('nolimit')){_0x523e42[_0xe4f1('0x1d')]=qs[_0xe4f1('0x1d')](_0x4abc3d[_0xe4f1('0x33')]['limit']);_0x523e42[_0xe4f1('0x1f')]=qs['offset'](_0x4abc3d['query']['offset']);}_0x523e42[_0xe4f1('0x39')]=qs[_0xe4f1('0x3a')](_0x4abc3d[_0xe4f1('0x33')][_0xe4f1('0x3a')]);_0x523e42[_0xe4f1('0x3b')]=qs['filters'](_[_0xe4f1('0x3c')](_0x4abc3d['query'],_0x31a0ab[_0xe4f1('0x3d')]),_0x1f74e6);if(_0x4abc3d['query'][_0xe4f1('0x3e')]){_0x523e42[_0xe4f1('0x3b')]=_[_0xe4f1('0x3f')](_0x523e42['where'],{'$or':_[_0xe4f1('0x2e')](_0x1f74e6,function(_0x51258d){if(_0x51258d[_0xe4f1('0x31')]!==_0xe4f1('0x40')){var _0x35957c={};_0x35957c[_0x51258d['name']]={'$like':'%'+_0x4abc3d[_0xe4f1('0x33')][_0xe4f1('0x3e')]+'%'};return _0x35957c;}})});}_0x523e42=_[_0xe4f1('0x3f')]({},_0x523e42,_0x4abc3d[_0xe4f1('0x41')]);var _0x1388e1={'where':_0x523e42[_0xe4f1('0x3b')]};return db[_0xe4f1('0x42')][_0xe4f1('0x1e')](_0x1388e1)[_0xe4f1('0x27')](function(_0x2e176a){_0x5995bb[_0xe4f1('0x1e')]=_0x2e176a;if(_0x4abc3d[_0xe4f1('0x33')]['includeAll']){_0x523e42['include']=[{'all':!![]}];}return db[_0xe4f1('0x42')][_0xe4f1('0x43')](_0x523e42);})[_0xe4f1('0x27')](function(_0x452006){_0x5995bb['rows']=_0x452006;return _0x5995bb;})[_0xe4f1('0x27')](respondWithFilteredResult(_0x3b4987,_0x523e42))[_0xe4f1('0x44')](handleError(_0x3b4987,null));};exports['show']=function(_0x5914f1,_0x10e7cd){var _0x4a2c0e={'raw':![],'where':{'id':_0x5914f1[_0xe4f1('0x45')]['id']}},_0x377bfc={};_0x377bfc[_0xe4f1('0x36')]=_[_0xe4f1('0x34')](db[_0xe4f1('0x42')]['rawAttributes']);_0x377bfc[_0xe4f1('0x33')]=_[_0xe4f1('0x34')](_0x5914f1['query']);_0x377bfc[_0xe4f1('0x3d')]=_[_0xe4f1('0x35')](_0x377bfc[_0xe4f1('0x36')],_0x377bfc['query']);_0x4a2c0e['attributes']=_[_0xe4f1('0x35')](_0x377bfc[_0xe4f1('0x36')],qs[_0xe4f1('0x38')](_0x5914f1[_0xe4f1('0x33')][_0xe4f1('0x38')]));_0x4a2c0e[_0xe4f1('0x37')]=_0x4a2c0e[_0xe4f1('0x37')]['length']?_0x4a2c0e['attributes']:_0x377bfc['model'];if(_0x5914f1['query'][_0xe4f1('0x46')]){_0x4a2c0e[_0xe4f1('0x47')]=[{'all':!![]}];}_0x4a2c0e=_[_0xe4f1('0x3f')]({},_0x4a2c0e,_0x5914f1['options']);return db[_0xe4f1('0x42')][_0xe4f1('0x48')](_0x4a2c0e)[_0xe4f1('0x27')](handleEntityNotFound(_0x10e7cd,null))[_0xe4f1('0x27')](respondWithResult(_0x10e7cd,null))['catch'](handleError(_0x10e7cd,null));};exports['create']=function(_0x36d5f6,_0x15fd93){return db[_0xe4f1('0x42')][_0xe4f1('0x49')](_0x36d5f6['body'],{})[_0xe4f1('0x27')](respondWithResult(_0x15fd93,0xc9))[_0xe4f1('0x44')](handleError(_0x15fd93,null));};exports['update']=function(_0x4e6800,_0x2b6e25){if(_0x4e6800['body']['id']){delete _0x4e6800[_0xe4f1('0x4a')]['id'];}return db[_0xe4f1('0x42')][_0xe4f1('0x48')]({'where':{'id':_0x4e6800[_0xe4f1('0x45')]['id']}})[_0xe4f1('0x27')](handleEntityNotFound(_0x2b6e25,null))[_0xe4f1('0x27')](saveUpdates(_0x4e6800['body'],null))[_0xe4f1('0x27')](respondWithResult(_0x2b6e25,null))[_0xe4f1('0x44')](handleError(_0x2b6e25,null));};exports['destroy']=function(_0x5bfa9d,_0x202e92){return db['Dynamics365Configuration'][_0xe4f1('0x48')]({'where':{'id':_0x5bfa9d['params']['id']}})[_0xe4f1('0x27')](handleEntityNotFound(_0x202e92,null))[_0xe4f1('0x27')](removeEntity(_0x202e92,null))['catch'](handleError(_0x202e92,null));};exports[_0xe4f1('0x4b')]=function(_0x126d9c,_0x4c6cbf,_0x34e7ba){var _0x35c225={};var _0x21d92f={};var _0x55c759;var _0x145d9a;return db[_0xe4f1('0x42')][_0xe4f1('0x4c')]({'where':{'id':_0x126d9c['params']['id']}})[_0xe4f1('0x27')](handleEntityNotFound(_0x4c6cbf,null))[_0xe4f1('0x27')](function(_0x3f4f0b){if(_0x3f4f0b){_0x55c759=_0x3f4f0b;_0x21d92f['model']=_[_0xe4f1('0x34')](db['Dynamics365Field'][_0xe4f1('0x2f')]);_0x21d92f[_0xe4f1('0x33')]=_['keys'](_0x126d9c[_0xe4f1('0x33')]);_0x21d92f[_0xe4f1('0x3d')]=_[_0xe4f1('0x35')](_0x21d92f['model'],_0x21d92f[_0xe4f1('0x33')]);_0x35c225[_0xe4f1('0x37')]=_[_0xe4f1('0x35')](_0x21d92f[_0xe4f1('0x36')],qs[_0xe4f1('0x38')](_0x126d9c[_0xe4f1('0x33')][_0xe4f1('0x38')]));_0x35c225[_0xe4f1('0x37')]=_0x35c225['attributes']['length']?_0x35c225[_0xe4f1('0x37')]:_0x21d92f[_0xe4f1('0x36')];_0x35c225['order']=qs[_0xe4f1('0x3a')](_0x126d9c['query'][_0xe4f1('0x3a')]);_0x35c225[_0xe4f1('0x3b')]=qs[_0xe4f1('0x3d')](_[_0xe4f1('0x3c')](_0x126d9c[_0xe4f1('0x33')],_0x21d92f[_0xe4f1('0x3d')]));if(_0x126d9c['query'][_0xe4f1('0x3e')]){_0x35c225['where']=_['merge'](_0x35c225[_0xe4f1('0x3b')],{'$or':_['map'](_0x35c225[_0xe4f1('0x37')],function(_0x2d9bf7){var _0x24165b={};_0x24165b[_0x2d9bf7]={'$like':'%'+_0x126d9c[_0xe4f1('0x33')][_0xe4f1('0x3e')]+'%'};return _0x24165b;})});}_0x35c225=_['merge']({},_0x35c225,_0x126d9c[_0xe4f1('0x41')]);return _0x55c759[_0xe4f1('0x4b')](_0x35c225);}})['then'](function(_0x81fc97){if(_0x81fc97){_0x145d9a=_0x81fc97['length'];if(!_0x126d9c[_0xe4f1('0x33')][_0xe4f1('0x4d')](_0xe4f1('0x4e'))){_0x35c225[_0xe4f1('0x1d')]=qs[_0xe4f1('0x1d')](_0x126d9c[_0xe4f1('0x33')][_0xe4f1('0x1d')]);_0x35c225['offset']=qs['offset'](_0x126d9c['query']['offset']);}return _0x55c759[_0xe4f1('0x4b')](_0x35c225);}})[_0xe4f1('0x27')](function(_0x285a35){if(_0x285a35){return _0x285a35?{'count':_0x145d9a,'rows':_0x285a35}:null;}})[_0xe4f1('0x27')](respondWithResult(_0x4c6cbf,null))['catch'](handleError(_0x4c6cbf,null));};exports['getSubjects']=function(_0x4b6f83,_0x41b663,_0x373bc7){var _0x3b95ad={};var _0x2b9398={};var _0x2d4418;var _0x3c6910;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x4b6f83[_0xe4f1('0x45')]['id']}})['then'](handleEntityNotFound(_0x41b663,null))['then'](function(_0x1b1a97){if(_0x1b1a97){_0x2d4418=_0x1b1a97;_0x2b9398[_0xe4f1('0x36')]=_[_0xe4f1('0x34')](db[_0xe4f1('0x4f')][_0xe4f1('0x2f')]);_0x2b9398[_0xe4f1('0x33')]=_[_0xe4f1('0x34')](_0x4b6f83[_0xe4f1('0x33')]);_0x2b9398['filters']=_[_0xe4f1('0x35')](_0x2b9398[_0xe4f1('0x36')],_0x2b9398[_0xe4f1('0x33')]);_0x3b95ad[_0xe4f1('0x37')]=_[_0xe4f1('0x35')](_0x2b9398[_0xe4f1('0x36')],qs[_0xe4f1('0x38')](_0x4b6f83[_0xe4f1('0x33')]['fields']));_0x3b95ad['attributes']=_0x3b95ad['attributes'][_0xe4f1('0x50')]?_0x3b95ad['attributes']:_0x2b9398['model'];_0x3b95ad[_0xe4f1('0x39')]=qs[_0xe4f1('0x3a')](_0x4b6f83[_0xe4f1('0x33')]['sort']);_0x3b95ad['where']=qs['filters'](_[_0xe4f1('0x3c')](_0x4b6f83[_0xe4f1('0x33')],_0x2b9398[_0xe4f1('0x3d')]));if(_0x4b6f83[_0xe4f1('0x33')][_0xe4f1('0x3e')]){_0x3b95ad[_0xe4f1('0x3b')]=_[_0xe4f1('0x3f')](_0x3b95ad['where'],{'$or':_[_0xe4f1('0x2e')](_0x3b95ad['attributes'],function(_0x2c8bd6){var _0x16cb56={};_0x16cb56[_0x2c8bd6]={'$like':'%'+_0x4b6f83[_0xe4f1('0x33')][_0xe4f1('0x3e')]+'%'};return _0x16cb56;})});}_0x3b95ad=_['merge']({},_0x3b95ad,_0x4b6f83[_0xe4f1('0x41')]);return _0x2d4418[_0xe4f1('0x51')](_0x3b95ad);}})[_0xe4f1('0x27')](function(_0x6221bc){if(_0x6221bc){_0x3c6910=_0x6221bc[_0xe4f1('0x50')];if(!_0x4b6f83['query']['hasOwnProperty'](_0xe4f1('0x4e'))){_0x3b95ad[_0xe4f1('0x1d')]=qs[_0xe4f1('0x1d')](_0x4b6f83['query'][_0xe4f1('0x1d')]);_0x3b95ad[_0xe4f1('0x1f')]=qs['offset'](_0x4b6f83[_0xe4f1('0x33')][_0xe4f1('0x1f')]);}return _0x2d4418['getSubjects'](_0x3b95ad);}})[_0xe4f1('0x27')](function(_0x397ab9){if(_0x397ab9){return _0x397ab9?{'count':_0x3c6910,'rows':_0x397ab9}:null;}})[_0xe4f1('0x27')](respondWithResult(_0x41b663,null))[_0xe4f1('0x44')](handleError(_0x41b663,null));};exports[_0xe4f1('0x52')]=function(_0x30556e,_0x250ec3,_0x10dfa4){var _0x556d3d={};var _0x130eb0={};var _0x421793;var _0x322f95;return db[_0xe4f1('0x42')][_0xe4f1('0x4c')]({'where':{'id':_0x30556e[_0xe4f1('0x45')]['id']}})['then'](handleEntityNotFound(_0x250ec3,null))[_0xe4f1('0x27')](function(_0x23be41){if(_0x23be41){_0x421793=_0x23be41;_0x130eb0[_0xe4f1('0x36')]=_[_0xe4f1('0x34')](db[_0xe4f1('0x4f')]['rawAttributes']);_0x130eb0[_0xe4f1('0x33')]=_[_0xe4f1('0x34')](_0x30556e[_0xe4f1('0x33')]);_0x130eb0[_0xe4f1('0x3d')]=_['intersection'](_0x130eb0[_0xe4f1('0x36')],_0x130eb0[_0xe4f1('0x33')]);_0x556d3d[_0xe4f1('0x37')]=_[_0xe4f1('0x35')](_0x130eb0['model'],qs[_0xe4f1('0x38')](_0x30556e[_0xe4f1('0x33')][_0xe4f1('0x38')]));_0x556d3d[_0xe4f1('0x37')]=_0x556d3d[_0xe4f1('0x37')][_0xe4f1('0x50')]?_0x556d3d[_0xe4f1('0x37')]:_0x130eb0['model'];_0x556d3d[_0xe4f1('0x39')]=qs[_0xe4f1('0x3a')](_0x30556e[_0xe4f1('0x33')][_0xe4f1('0x3a')]);_0x556d3d[_0xe4f1('0x3b')]=qs[_0xe4f1('0x3d')](_['pick'](_0x30556e[_0xe4f1('0x33')],_0x130eb0['filters']));if(_0x30556e[_0xe4f1('0x33')][_0xe4f1('0x3e')]){_0x556d3d[_0xe4f1('0x3b')]=_[_0xe4f1('0x3f')](_0x556d3d[_0xe4f1('0x3b')],{'$or':_[_0xe4f1('0x2e')](_0x556d3d[_0xe4f1('0x37')],function(_0x49f3a2){var _0x18e399={};_0x18e399[_0x49f3a2]={'$like':'%'+_0x30556e['query']['filter']+'%'};return _0x18e399;})});}_0x556d3d=_[_0xe4f1('0x3f')]({},_0x556d3d,_0x30556e['options']);return _0x421793[_0xe4f1('0x52')](_0x556d3d);}})[_0xe4f1('0x27')](function(_0x3cc866){if(_0x3cc866){_0x322f95=_0x3cc866[_0xe4f1('0x50')];if(!_0x30556e[_0xe4f1('0x33')][_0xe4f1('0x4d')](_0xe4f1('0x4e'))){_0x556d3d[_0xe4f1('0x1d')]=qs[_0xe4f1('0x1d')](_0x30556e['query'][_0xe4f1('0x1d')]);_0x556d3d[_0xe4f1('0x1f')]=qs[_0xe4f1('0x1f')](_0x30556e[_0xe4f1('0x33')][_0xe4f1('0x1f')]);}return _0x421793[_0xe4f1('0x52')](_0x556d3d);}})[_0xe4f1('0x27')](function(_0x27035e){if(_0x27035e){return _0x27035e?{'count':_0x322f95,'rows':_0x27035e}:null;}})[_0xe4f1('0x27')](respondWithResult(_0x250ec3,null))['catch'](handleError(_0x250ec3,null));}; \ No newline at end of file +var _0x2587=['Dynamics365Configuration','includeAll','rows','show','params','include','find','catch','create','body','destroy','getFields','findOne','Dynamics365Field','rawAttributes','options','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2587,0x106));var _0x7258=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0x2587[_0x3e0763];return _0x351ca2;};'use strict';var emlformat=require(_0x7258('0x0'));var rimraf=require(_0x7258('0x1'));var zipdir=require(_0x7258('0x2'));var jsonpatch=require(_0x7258('0x3'));var rp=require(_0x7258('0x4'));var moment=require('moment');var BPromise=require(_0x7258('0x5'));var Mustache=require(_0x7258('0x6'));var util=require(_0x7258('0x7'));var path=require(_0x7258('0x8'));var sox=require('sox');var csv=require(_0x7258('0x9'));var ejs=require(_0x7258('0xa'));var fs=require('fs');var fs_extra=require(_0x7258('0xb'));var _=require('lodash');var squel=require(_0x7258('0xc'));var crypto=require('crypto');var jsforce=require(_0x7258('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7258('0x9'));var querystring=require(_0x7258('0xe'));var Papa=require('papaparse');var Redis=require(_0x7258('0xf'));var authService=require(_0x7258('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7258('0x11'));var hardwareService=require(_0x7258('0x12'));var logger=require(_0x7258('0x13'))(_0x7258('0x14'));var utils=require('../../config/utils');var config=require(_0x7258('0x15'));var licenseUtil=require(_0x7258('0x16'));var db=require(_0x7258('0x17'))['db'];function respondWithStatusCode(_0x315a68,_0x48cf70){_0x48cf70=_0x48cf70||0xcc;return function(_0x278e13){if(_0x278e13){return _0x315a68[_0x7258('0x18')](_0x48cf70);}return _0x315a68[_0x7258('0x19')](_0x48cf70)[_0x7258('0x1a')]();};}function respondWithResult(_0x5ea471,_0x59f5ee){_0x59f5ee=_0x59f5ee||0xc8;return function(_0x1d042b){if(_0x1d042b){return _0x5ea471[_0x7258('0x19')](_0x59f5ee)['json'](_0x1d042b);}};}function respondWithFilteredResult(_0x25881c,_0x575a21){return function(_0x3eb5ee){if(_0x3eb5ee){var _0x28b585=typeof _0x575a21[_0x7258('0x1b')]===_0x7258('0x1c')&&typeof _0x575a21[_0x7258('0x1d')]===_0x7258('0x1c');var _0x30c012=_0x3eb5ee['count'];var _0x43fb1a=_0x28b585?0x0:_0x575a21['offset'];var _0xb7ea9c=_0x28b585?_0x3eb5ee[_0x7258('0x1e')]:_0x575a21[_0x7258('0x1b')]+_0x575a21['limit'];var _0x3b141e;if(_0xb7ea9c>=_0x30c012){_0xb7ea9c=_0x30c012;_0x3b141e=0xc8;}else{_0x3b141e=0xce;}_0x25881c[_0x7258('0x19')](_0x3b141e);return _0x25881c['set'](_0x7258('0x1f'),_0x43fb1a+'-'+_0xb7ea9c+'/'+_0x30c012)[_0x7258('0x20')](_0x3eb5ee);}return null;};}function patchUpdates(_0x2ac259){return function(_0x4637de){try{jsonpatch[_0x7258('0x21')](_0x4637de,_0x2ac259,!![]);}catch(_0x2d0860){return BPromise[_0x7258('0x22')](_0x2d0860);}return _0x4637de[_0x7258('0x23')]();};}function saveUpdates(_0x2c5e88,_0x3c95cd){return function(_0x2b4697){if(_0x2b4697){return _0x2b4697[_0x7258('0x24')](_0x2c5e88)[_0x7258('0x25')](function(_0x1ef8a7){return _0x1ef8a7;});}return null;};}function removeEntity(_0x150b90,_0x458658){return function(_0x881979){if(_0x881979){return _0x881979['destroy']()['then'](function(){_0x150b90['status'](0xcc)[_0x7258('0x1a')]();});}};}function handleEntityNotFound(_0x36f140,_0x5b9bae){return function(_0x39de6a){if(!_0x39de6a){_0x36f140['sendStatus'](0x194);}return _0x39de6a;};}function handleError(_0x16d7b7,_0x163cce){_0x163cce=_0x163cce||0x1f4;return function(_0x429b2e){logger[_0x7258('0x26')](_0x429b2e[_0x7258('0x27')]);if(_0x429b2e[_0x7258('0x28')]){delete _0x429b2e[_0x7258('0x28')];}_0x16d7b7['status'](_0x163cce)[_0x7258('0x29')](_0x429b2e);};}exports[_0x7258('0x2a')]=function(_0x23ab03,_0x1aee03){var _0x421dcb={},_0x48d6fe={},_0x281df0={'count':0x0,'rows':[]};var _0x471dfa=_[_0x7258('0x2b')](db['Dynamics365Configuration']['rawAttributes'],function(_0x2a7d88){return{'name':_0x2a7d88[_0x7258('0x2c')],'type':_0x2a7d88[_0x7258('0x2d')]['key']};});_0x48d6fe['model']=_[_0x7258('0x2b')](_0x471dfa,_0x7258('0x28'));_0x48d6fe[_0x7258('0x2e')]=_[_0x7258('0x2f')](_0x23ab03[_0x7258('0x2e')]);_0x48d6fe[_0x7258('0x30')]=_[_0x7258('0x31')](_0x48d6fe[_0x7258('0x32')],_0x48d6fe[_0x7258('0x2e')]);_0x421dcb[_0x7258('0x33')]=_[_0x7258('0x31')](_0x48d6fe['model'],qs[_0x7258('0x34')](_0x23ab03[_0x7258('0x2e')]['fields']));_0x421dcb['attributes']=_0x421dcb[_0x7258('0x33')][_0x7258('0x35')]?_0x421dcb['attributes']:_0x48d6fe[_0x7258('0x32')];if(!_0x23ab03[_0x7258('0x2e')]['hasOwnProperty'](_0x7258('0x36'))){_0x421dcb[_0x7258('0x1d')]=qs[_0x7258('0x1d')](_0x23ab03[_0x7258('0x2e')]['limit']);_0x421dcb['offset']=qs['offset'](_0x23ab03[_0x7258('0x2e')]['offset']);}_0x421dcb[_0x7258('0x37')]=qs[_0x7258('0x38')](_0x23ab03[_0x7258('0x2e')]['sort']);_0x421dcb[_0x7258('0x39')]=qs[_0x7258('0x30')](_[_0x7258('0x3a')](_0x23ab03['query'],_0x48d6fe[_0x7258('0x30')]),_0x471dfa);if(_0x23ab03[_0x7258('0x2e')][_0x7258('0x3b')]){_0x421dcb[_0x7258('0x39')]=_[_0x7258('0x3c')](_0x421dcb['where'],{'$or':_[_0x7258('0x2b')](_0x471dfa,function(_0x39feaa){if(_0x39feaa[_0x7258('0x2d')]!==_0x7258('0x3d')){var _0x4f5284={};_0x4f5284[_0x39feaa[_0x7258('0x28')]]={'$like':'%'+_0x23ab03['query'][_0x7258('0x3b')]+'%'};return _0x4f5284;}})});}_0x421dcb=_[_0x7258('0x3c')]({},_0x421dcb,_0x23ab03['options']);var _0x2cde78={'where':_0x421dcb[_0x7258('0x39')]};return db[_0x7258('0x3e')]['count'](_0x2cde78)['then'](function(_0x4f8def){_0x281df0[_0x7258('0x1e')]=_0x4f8def;if(_0x23ab03[_0x7258('0x2e')][_0x7258('0x3f')]){_0x421dcb['include']=[{'all':!![]}];}return db[_0x7258('0x3e')]['findAll'](_0x421dcb);})[_0x7258('0x25')](function(_0x5aff00){_0x281df0[_0x7258('0x40')]=_0x5aff00;return _0x281df0;})['then'](respondWithFilteredResult(_0x1aee03,_0x421dcb))['catch'](handleError(_0x1aee03,null));};exports[_0x7258('0x41')]=function(_0x47fac3,_0x2411c4){var _0x4257a7={'raw':![],'where':{'id':_0x47fac3[_0x7258('0x42')]['id']}},_0x3ff330={};_0x3ff330[_0x7258('0x32')]=_[_0x7258('0x2f')](db[_0x7258('0x3e')]['rawAttributes']);_0x3ff330['query']=_['keys'](_0x47fac3[_0x7258('0x2e')]);_0x3ff330['filters']=_[_0x7258('0x31')](_0x3ff330[_0x7258('0x32')],_0x3ff330[_0x7258('0x2e')]);_0x4257a7[_0x7258('0x33')]=_['intersection'](_0x3ff330[_0x7258('0x32')],qs[_0x7258('0x34')](_0x47fac3[_0x7258('0x2e')][_0x7258('0x34')]));_0x4257a7[_0x7258('0x33')]=_0x4257a7[_0x7258('0x33')][_0x7258('0x35')]?_0x4257a7['attributes']:_0x3ff330['model'];if(_0x47fac3[_0x7258('0x2e')]['includeAll']){_0x4257a7[_0x7258('0x43')]=[{'all':!![]}];}_0x4257a7=_[_0x7258('0x3c')]({},_0x4257a7,_0x47fac3['options']);return db[_0x7258('0x3e')][_0x7258('0x44')](_0x4257a7)[_0x7258('0x25')](handleEntityNotFound(_0x2411c4,null))['then'](respondWithResult(_0x2411c4,null))[_0x7258('0x45')](handleError(_0x2411c4,null));};exports[_0x7258('0x46')]=function(_0x419ced,_0x4d6840){return db[_0x7258('0x3e')][_0x7258('0x46')](_0x419ced[_0x7258('0x47')],{})['then'](respondWithResult(_0x4d6840,0xc9))[_0x7258('0x45')](handleError(_0x4d6840,null));};exports[_0x7258('0x24')]=function(_0x477c2e,_0x182db7){if(_0x477c2e[_0x7258('0x47')]['id']){delete _0x477c2e[_0x7258('0x47')]['id'];}return db['Dynamics365Configuration'][_0x7258('0x44')]({'where':{'id':_0x477c2e[_0x7258('0x42')]['id']}})['then'](handleEntityNotFound(_0x182db7,null))[_0x7258('0x25')](saveUpdates(_0x477c2e[_0x7258('0x47')],null))['then'](respondWithResult(_0x182db7,null))[_0x7258('0x45')](handleError(_0x182db7,null));};exports[_0x7258('0x48')]=function(_0x402704,_0x12b03c){return db[_0x7258('0x3e')]['find']({'where':{'id':_0x402704[_0x7258('0x42')]['id']}})['then'](handleEntityNotFound(_0x12b03c,null))[_0x7258('0x25')](removeEntity(_0x12b03c,null))[_0x7258('0x45')](handleError(_0x12b03c,null));};exports[_0x7258('0x49')]=function(_0xa33a2f,_0x381a20,_0x24ec47){var _0x545333={};var _0x193873={};var _0x4bfc31;var _0x539d2e;return db['Dynamics365Configuration'][_0x7258('0x4a')]({'where':{'id':_0xa33a2f[_0x7258('0x42')]['id']}})[_0x7258('0x25')](handleEntityNotFound(_0x381a20,null))[_0x7258('0x25')](function(_0x344b4a){if(_0x344b4a){_0x4bfc31=_0x344b4a;_0x193873[_0x7258('0x32')]=_[_0x7258('0x2f')](db[_0x7258('0x4b')][_0x7258('0x4c')]);_0x193873['query']=_[_0x7258('0x2f')](_0xa33a2f[_0x7258('0x2e')]);_0x193873[_0x7258('0x30')]=_['intersection'](_0x193873['model'],_0x193873[_0x7258('0x2e')]);_0x545333[_0x7258('0x33')]=_['intersection'](_0x193873['model'],qs['fields'](_0xa33a2f['query'][_0x7258('0x34')]));_0x545333[_0x7258('0x33')]=_0x545333[_0x7258('0x33')][_0x7258('0x35')]?_0x545333[_0x7258('0x33')]:_0x193873[_0x7258('0x32')];_0x545333[_0x7258('0x37')]=qs[_0x7258('0x38')](_0xa33a2f[_0x7258('0x2e')][_0x7258('0x38')]);_0x545333[_0x7258('0x39')]=qs[_0x7258('0x30')](_[_0x7258('0x3a')](_0xa33a2f[_0x7258('0x2e')],_0x193873[_0x7258('0x30')]));if(_0xa33a2f['query']['filter']){_0x545333[_0x7258('0x39')]=_[_0x7258('0x3c')](_0x545333['where'],{'$or':_[_0x7258('0x2b')](_0x545333[_0x7258('0x33')],function(_0xc058ce){var _0x5603c2={};_0x5603c2[_0xc058ce]={'$like':'%'+_0xa33a2f[_0x7258('0x2e')][_0x7258('0x3b')]+'%'};return _0x5603c2;})});}_0x545333=_['merge']({},_0x545333,_0xa33a2f[_0x7258('0x4d')]);return _0x4bfc31[_0x7258('0x49')](_0x545333);}})[_0x7258('0x25')](function(_0x16f12c){if(_0x16f12c){_0x539d2e=_0x16f12c['length'];if(!_0xa33a2f[_0x7258('0x2e')][_0x7258('0x4e')](_0x7258('0x36'))){_0x545333[_0x7258('0x1d')]=qs[_0x7258('0x1d')](_0xa33a2f[_0x7258('0x2e')][_0x7258('0x1d')]);_0x545333[_0x7258('0x1b')]=qs[_0x7258('0x1b')](_0xa33a2f['query']['offset']);}return _0x4bfc31['getFields'](_0x545333);}})[_0x7258('0x25')](function(_0x12558e){if(_0x12558e){return _0x12558e?{'count':_0x539d2e,'rows':_0x12558e}:null;}})[_0x7258('0x25')](respondWithResult(_0x381a20,null))[_0x7258('0x45')](handleError(_0x381a20,null));};exports[_0x7258('0x4f')]=function(_0x48948f,_0x834921,_0x253a16){var _0x307606={};var _0x13b94c={};var _0x84a6f7;var _0x1367b0;return db[_0x7258('0x3e')][_0x7258('0x4a')]({'where':{'id':_0x48948f[_0x7258('0x42')]['id']}})[_0x7258('0x25')](handleEntityNotFound(_0x834921,null))[_0x7258('0x25')](function(_0x4e0e53){if(_0x4e0e53){_0x84a6f7=_0x4e0e53;_0x13b94c[_0x7258('0x32')]=_[_0x7258('0x2f')](db[_0x7258('0x4b')]['rawAttributes']);_0x13b94c[_0x7258('0x2e')]=_[_0x7258('0x2f')](_0x48948f[_0x7258('0x2e')]);_0x13b94c[_0x7258('0x30')]=_[_0x7258('0x31')](_0x13b94c[_0x7258('0x32')],_0x13b94c[_0x7258('0x2e')]);_0x307606[_0x7258('0x33')]=_[_0x7258('0x31')](_0x13b94c[_0x7258('0x32')],qs['fields'](_0x48948f[_0x7258('0x2e')][_0x7258('0x34')]));_0x307606[_0x7258('0x33')]=_0x307606[_0x7258('0x33')][_0x7258('0x35')]?_0x307606[_0x7258('0x33')]:_0x13b94c[_0x7258('0x32')];_0x307606[_0x7258('0x37')]=qs[_0x7258('0x38')](_0x48948f[_0x7258('0x2e')]['sort']);_0x307606[_0x7258('0x39')]=qs['filters'](_['pick'](_0x48948f[_0x7258('0x2e')],_0x13b94c[_0x7258('0x30')]));if(_0x48948f['query']['filter']){_0x307606[_0x7258('0x39')]=_[_0x7258('0x3c')](_0x307606[_0x7258('0x39')],{'$or':_[_0x7258('0x2b')](_0x307606[_0x7258('0x33')],function(_0xf2260f){var _0x399391={};_0x399391[_0xf2260f]={'$like':'%'+_0x48948f['query'][_0x7258('0x3b')]+'%'};return _0x399391;})});}_0x307606=_[_0x7258('0x3c')]({},_0x307606,_0x48948f['options']);return _0x84a6f7[_0x7258('0x4f')](_0x307606);}})[_0x7258('0x25')](function(_0x1e81d8){if(_0x1e81d8){_0x1367b0=_0x1e81d8['length'];if(!_0x48948f['query'][_0x7258('0x4e')](_0x7258('0x36'))){_0x307606[_0x7258('0x1d')]=qs[_0x7258('0x1d')](_0x48948f['query'][_0x7258('0x1d')]);_0x307606[_0x7258('0x1b')]=qs[_0x7258('0x1b')](_0x48948f[_0x7258('0x2e')][_0x7258('0x1b')]);}return _0x84a6f7['getSubjects'](_0x307606);}})[_0x7258('0x25')](function(_0x4550a8){if(_0x4550a8){return _0x4550a8?{'count':_0x1367b0,'rows':_0x4550a8}:null;}})[_0x7258('0x25')](respondWithResult(_0x834921,null))[_0x7258('0x45')](handleError(_0x834921,null));};exports[_0x7258('0x50')]=function(_0x432c49,_0x4d37a5,_0x3635f4){var _0xd870a8={};var _0x300047={};var _0x505ea2;var _0x10ab2d;return db[_0x7258('0x3e')][_0x7258('0x4a')]({'where':{'id':_0x432c49[_0x7258('0x42')]['id']}})[_0x7258('0x25')](handleEntityNotFound(_0x4d37a5,null))['then'](function(_0xca9b30){if(_0xca9b30){_0x505ea2=_0xca9b30;_0x300047['model']=_[_0x7258('0x2f')](db['Dynamics365Field'][_0x7258('0x4c')]);_0x300047[_0x7258('0x2e')]=_[_0x7258('0x2f')](_0x432c49[_0x7258('0x2e')]);_0x300047['filters']=_[_0x7258('0x31')](_0x300047[_0x7258('0x32')],_0x300047['query']);_0xd870a8[_0x7258('0x33')]=_[_0x7258('0x31')](_0x300047['model'],qs['fields'](_0x432c49[_0x7258('0x2e')]['fields']));_0xd870a8[_0x7258('0x33')]=_0xd870a8[_0x7258('0x33')][_0x7258('0x35')]?_0xd870a8['attributes']:_0x300047[_0x7258('0x32')];_0xd870a8[_0x7258('0x37')]=qs['sort'](_0x432c49[_0x7258('0x2e')][_0x7258('0x38')]);_0xd870a8[_0x7258('0x39')]=qs[_0x7258('0x30')](_[_0x7258('0x3a')](_0x432c49[_0x7258('0x2e')],_0x300047[_0x7258('0x30')]));if(_0x432c49['query'][_0x7258('0x3b')]){_0xd870a8[_0x7258('0x39')]=_[_0x7258('0x3c')](_0xd870a8[_0x7258('0x39')],{'$or':_[_0x7258('0x2b')](_0xd870a8[_0x7258('0x33')],function(_0x26f192){var _0x5c6cdb={};_0x5c6cdb[_0x26f192]={'$like':'%'+_0x432c49[_0x7258('0x2e')]['filter']+'%'};return _0x5c6cdb;})});}_0xd870a8=_[_0x7258('0x3c')]({},_0xd870a8,_0x432c49['options']);return _0x505ea2[_0x7258('0x50')](_0xd870a8);}})[_0x7258('0x25')](function(_0x3531be){if(_0x3531be){_0x10ab2d=_0x3531be[_0x7258('0x35')];if(!_0x432c49[_0x7258('0x2e')][_0x7258('0x4e')](_0x7258('0x36'))){_0xd870a8['limit']=qs[_0x7258('0x1d')](_0x432c49['query'][_0x7258('0x1d')]);_0xd870a8[_0x7258('0x1b')]=qs[_0x7258('0x1b')](_0x432c49['query'][_0x7258('0x1b')]);}return _0x505ea2[_0x7258('0x50')](_0xd870a8);}})[_0x7258('0x25')](function(_0x25ee8c){if(_0x25ee8c){return _0x25ee8c?{'count':_0x10ab2d,'rows':_0x25ee8c}:null;}})[_0x7258('0x25')](respondWithResult(_0x4d37a5,null))[_0x7258('0x45')](handleError(_0x4d37a5,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index ecd3a1c..cff00ac 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 _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','util','api'];(function(_0x49b73d,_0x36e3b3){var _0x2a971d=function(_0x2e5754){while(--_0x2e5754){_0x49b73d['push'](_0x49b73d['shift']());}};_0x2a971d(++_0x36e3b3);}(_0xa41a,0x6b));var _0xaa41=function(_0x38accd,_0x3c0c52){_0x38accd=_0x38accd-0x0;var _0x286b47=_0xa41a[_0x38accd];return _0x286b47;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Dynamics365Configuration',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81bd=['../../config/environment','./intDynamics365Configuration.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x315d97,_0x5f4eeb){var _0x5d906c=function(_0x53e2b6){while(--_0x53e2b6){_0x315d97['push'](_0x315d97['shift']());}};_0x5d906c(++_0x5f4eeb);}(_0x81bd,0x7c));var _0xd81b=function(_0x5d1d9f,_0x1ef696){_0x5d1d9f=_0x5d1d9f-0x0;var _0x2faa8e=_0x81bd[_0x5d1d9f];return _0x2faa8e;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var logger=require(_0xd81b('0x2'))(_0xd81b('0x3'));var moment=require(_0xd81b('0x4'));var BPromise=require(_0xd81b('0x5'));var rp=require(_0xd81b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var attributes=require(_0xd81b('0x9'));module['exports']=function(_0x42a0aa,_0x34eb73){return _0x42a0aa[_0xd81b('0xa')]('Dynamics365Configuration',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 b11c95e..ff1bcbe 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 _0x45f4=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x45f4,0x1d6));var _0x445f=function(_0x3caf46,_0x7b53d5){_0x3caf46=_0x3caf46-0x0;var _0x103a95=_0x45f4[_0x3caf46];return _0x103a95;};'use strict';var _=require('lodash');var util=require(_0x445f('0x0'));var moment=require('moment');var BPromise=require(_0x445f('0x1'));var rs=require(_0x445f('0x2'));var fs=require('fs');var Redis=require(_0x445f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x445f('0x4'));var logger=require(_0x445f('0x5'))(_0x445f('0x6'));var config=require(_0x445f('0x7'));var jayson=require(_0x445f('0x8'));var client=jayson[_0x445f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37efe7,_0x31864d,_0x193984){return new BPromise(function(_0x2d68d7,_0x8a871a){return client[_0x445f('0xa')](_0x37efe7,_0x193984)[_0x445f('0xb')](function(_0x49346a){logger[_0x445f('0xc')](_0x445f('0xd'),_0x31864d,_0x445f('0xe'));logger[_0x445f('0xf')](_0x445f('0x10'),_0x31864d,_0x445f('0xe'),JSON[_0x445f('0x11')](_0x49346a));if(_0x49346a[_0x445f('0x12')]){if(_0x49346a[_0x445f('0x12')]['code']===0x1f4){logger['error'](_0x445f('0xd'),_0x31864d,_0x49346a[_0x445f('0x12')][_0x445f('0x13')]);return _0x8a871a(_0x49346a[_0x445f('0x12')][_0x445f('0x13')]);}logger[_0x445f('0x12')](_0x445f('0xd'),_0x31864d,_0x49346a['error'][_0x445f('0x13')]);return _0x2d68d7(_0x49346a['error'][_0x445f('0x13')]);}else{logger[_0x445f('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x31864d,_0x445f('0xe'));_0x2d68d7(_0x49346a['result']['message']);}})[_0x445f('0x14')](function(_0x54543a){logger[_0x445f('0x12')](_0x445f('0xd'),_0x31864d,_0x54543a);_0x8a871a(_0x54543a);});});} \ No newline at end of file +var _0xaf03=['stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x48ed01,_0x308521){var _0x3910d8=function(_0x22fe80){while(--_0x22fe80){_0x48ed01['push'](_0x48ed01['shift']());}};_0x3910d8(++_0x308521);}(_0xaf03,0x6a));var _0x3af0=function(_0x241417,_0x21a56c){_0x241417=_0x241417-0x0;var _0x5b8f2c=_0xaf03[_0x241417];return _0x5b8f2c;};'use strict';var _=require(_0x3af0('0x0'));var util=require(_0x3af0('0x1'));var moment=require(_0x3af0('0x2'));var BPromise=require('bluebird');var rs=require(_0x3af0('0x3'));var fs=require('fs');var Redis=require(_0x3af0('0x4'));var db=require(_0x3af0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3af0('0x6'))(_0x3af0('0x7'));var config=require('../../config/environment');var jayson=require(_0x3af0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fd667,_0x19af89,_0x54221c){return new BPromise(function(_0x524783,_0x39de17){return client[_0x3af0('0x9')](_0x3fd667,_0x54221c)[_0x3af0('0xa')](function(_0x4b6533){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x19af89,'request\x20sent');logger[_0x3af0('0xb')](_0x3af0('0xc'),_0x19af89,_0x3af0('0xd'),JSON[_0x3af0('0xe')](_0x4b6533));if(_0x4b6533[_0x3af0('0xf')]){if(_0x4b6533[_0x3af0('0xf')]['code']===0x1f4){logger['error'](_0x3af0('0x10'),_0x19af89,_0x4b6533[_0x3af0('0xf')][_0x3af0('0x11')]);return _0x39de17(_0x4b6533[_0x3af0('0xf')][_0x3af0('0x11')]);}logger['error'](_0x3af0('0x10'),_0x19af89,_0x4b6533[_0x3af0('0xf')]['message']);return _0x524783(_0x4b6533[_0x3af0('0xf')]['message']);}else{logger[_0x3af0('0x12')](_0x3af0('0x10'),_0x19af89,_0x3af0('0xd'));_0x524783(_0x4b6533['result'][_0x3af0('0x11')]);}})[_0x3af0('0x13')](function(_0x19dc9f){logger['error'](_0x3af0('0x10'),_0x19af89,_0x19dc9f);_0x39de17(_0x19dc9f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 1414f86..947bc4c 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 _0xd831=['delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x1cddba,_0x24ce1a){var _0x492533=function(_0xd1d7e2){while(--_0xd1d7e2){_0x1cddba['push'](_0x1cddba['shift']());}};_0x492533(++_0x24ce1a);}(_0xd831,0x19a));var _0x1d83=function(_0x29cf49,_0x1f4aca){_0x29cf49=_0x29cf49-0x0;var _0x28d088=_0xd831[_0x29cf49];return _0x28d088;};'use strict';var multer=require('multer');var util=require(_0x1d83('0x0'));var path=require(_0x1d83('0x1'));var timeout=require(_0x1d83('0x2'));var express=require(_0x1d83('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1d83('0x4'));var interaction=require(_0x1d83('0x5'));var config=require(_0x1d83('0x6'));var controller=require('./intDynamics365Field.controller');router[_0x1d83('0x7')]('/',auth[_0x1d83('0x8')](),controller[_0x1d83('0x9')]);router[_0x1d83('0x7')](_0x1d83('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x1d83('0xb')]('/',auth[_0x1d83('0x8')](),controller[_0x1d83('0xc')]);router[_0x1d83('0xd')](_0x1d83('0xa'),auth[_0x1d83('0x8')](),controller[_0x1d83('0xe')]);router[_0x1d83('0xf')](_0x1d83('0xa'),auth[_0x1d83('0x8')](),controller['destroy']);module[_0x1d83('0x10')]=router; \ No newline at end of file +var _0x8461=['isAuthenticated','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get'];(function(_0x14f8a5,_0x25fb97){var _0x4b09a9=function(_0x427bc4){while(--_0x427bc4){_0x14f8a5['push'](_0x14f8a5['shift']());}};_0x4b09a9(++_0x25fb97);}(_0x8461,0x67));var _0x1846=function(_0x498903,_0x503c20){_0x498903=_0x498903-0x0;var _0x51a96b=_0x8461[_0x498903];return _0x51a96b;};'use strict';var multer=require(_0x1846('0x0'));var util=require(_0x1846('0x1'));var path=require('path');var timeout=require(_0x1846('0x2'));var express=require(_0x1846('0x3'));var router=express[_0x1846('0x4')]();var fs_extra=require(_0x1846('0x5'));var auth=require(_0x1846('0x6'));var interaction=require(_0x1846('0x7'));var config=require(_0x1846('0x8'));var controller=require(_0x1846('0x9'));router[_0x1846('0xa')]('/',auth[_0x1846('0xb')](),controller['index']);router[_0x1846('0xa')](_0x1846('0xc'),auth[_0x1846('0xb')](),controller[_0x1846('0xd')]);router[_0x1846('0xe')]('/',auth[_0x1846('0xb')](),controller['create']);router[_0x1846('0xf')](_0x1846('0xc'),auth[_0x1846('0xb')](),controller[_0x1846('0x10')]);router[_0x1846('0x11')](_0x1846('0xc'),auth[_0x1846('0xb')](),controller['destroy']);module[_0x1846('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index ac08278..fa18c53 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 _0x70ae=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0x70ae,0x1c1));var _0xe70a=function(_0x513c68,_0x3d15e2){_0x513c68=_0x513c68-0x0;var _0x361e7d=_0x70ae[_0x513c68];return _0x361e7d;};'use strict';var Sequelize=require('sequelize');module[_0xe70a('0x0')]={'type':{'type':Sequelize[_0xe70a('0x1')](_0xe70a('0x2'),_0xe70a('0x3'),_0xe70a('0x4'),_0xe70a('0x5'),_0xe70a('0x6')),'defaultValue':_0xe70a('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe70a('0x7')]},'keyType':{'type':Sequelize[_0xe70a('0x1')](_0xe70a('0x2'),_0xe70a('0x3'),_0xe70a('0x4'))},'keyContent':{'type':Sequelize[_0xe70a('0x7')]},'idField':{'type':Sequelize[_0xe70a('0x7')]},'nameField':{'type':Sequelize[_0xe70a('0x7')]},'customField':{'type':Sequelize[_0xe70a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe70a('0x7')]}}; \ No newline at end of file +var _0xc9f9=['keyValue','picklist','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable'];(function(_0x154557,_0x369e31){var _0x3f341d=function(_0x11b0c5){while(--_0x11b0c5){_0x154557['push'](_0x154557['shift']());}};_0x3f341d(++_0x369e31);}(_0xc9f9,0xf6));var _0x9c9f=function(_0x2aaac2,_0x313a75){_0x2aaac2=_0x2aaac2-0x0;var _0x5e0a23=_0xc9f9[_0x2aaac2];return _0x5e0a23;};'use strict';var Sequelize=require(_0x9c9f('0x0'));module[_0x9c9f('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x9c9f('0x2'),_0x9c9f('0x3'),_0x9c9f('0x4'),_0x9c9f('0x5')),'defaultValue':_0x9c9f('0x6')},'content':{'type':Sequelize[_0x9c9f('0x7')]},'key':{'type':Sequelize[_0x9c9f('0x7')]},'keyType':{'type':Sequelize[_0x9c9f('0x8')]('string',_0x9c9f('0x2'),_0x9c9f('0x3'))},'keyContent':{'type':Sequelize[_0x9c9f('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9c9f('0x7')]},'customField':{'type':Sequelize[_0x9c9f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9c9f('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 03fc414..d8facfe 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 _0x511d=['mustache','util','path','sox','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','Dynamics365Field','findAll','rows','catch','keys','rawAttributes','includeAll','include','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x2da4a4,_0x52522a){var _0x61a76d=function(_0x5a716b){while(--_0x5a716b){_0x2da4a4['push'](_0x2da4a4['shift']());}};_0x61a76d(++_0x52522a);}(_0x511d,0x8e));var _0xd511=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x511d[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0xd511('0x0'));var rimraf=require(_0xd511('0x1'));var zipdir=require(_0xd511('0x2'));var jsonpatch=require(_0xd511('0x3'));var rp=require(_0xd511('0x4'));var moment=require('moment');var BPromise=require(_0xd511('0x5'));var Mustache=require(_0xd511('0x6'));var util=require(_0xd511('0x7'));var path=require(_0xd511('0x8'));var sox=require(_0xd511('0x9'));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(_0xd511('0xa'));var crypto=require('crypto');var jsforce=require(_0xd511('0xb'));var deskjs=require(_0xd511('0xc'));var toCsv=require(_0xd511('0xd'));var querystring=require(_0xd511('0xe'));var Papa=require(_0xd511('0xf'));var Redis=require(_0xd511('0x10'));var authService=require(_0xd511('0x11'));var qs=require(_0xd511('0x12'));var as=require(_0xd511('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd511('0x14'))(_0xd511('0x15'));var utils=require('../../config/utils');var config=require(_0xd511('0x16'));var licenseUtil=require(_0xd511('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ea7a,_0x59a85f){_0x59a85f=_0x59a85f||0xcc;return function(_0x55b27b){if(_0x55b27b){return _0x24ea7a[_0xd511('0x18')](_0x59a85f);}return _0x24ea7a[_0xd511('0x19')](_0x59a85f)[_0xd511('0x1a')]();};}function respondWithResult(_0xab3916,_0xa0e416){_0xa0e416=_0xa0e416||0xc8;return function(_0x56cffd){if(_0x56cffd){return _0xab3916['status'](_0xa0e416)[_0xd511('0x1b')](_0x56cffd);}};}function respondWithFilteredResult(_0x121c9f,_0x5c4bc1){return function(_0x2bbab9){if(_0x2bbab9){var _0x53e330=typeof _0x5c4bc1[_0xd511('0x1c')]===_0xd511('0x1d')&&typeof _0x5c4bc1[_0xd511('0x1e')]===_0xd511('0x1d');var _0x2ae212=_0x2bbab9[_0xd511('0x1f')];var _0x1c0ae7=_0x53e330?0x0:_0x5c4bc1[_0xd511('0x1c')];var _0x26deba=_0x53e330?_0x2bbab9[_0xd511('0x1f')]:_0x5c4bc1[_0xd511('0x1c')]+_0x5c4bc1[_0xd511('0x1e')];var _0x2ef0ef;if(_0x26deba>=_0x2ae212){_0x26deba=_0x2ae212;_0x2ef0ef=0xc8;}else{_0x2ef0ef=0xce;}_0x121c9f['status'](_0x2ef0ef);return _0x121c9f['set'](_0xd511('0x20'),_0x1c0ae7+'-'+_0x26deba+'/'+_0x2ae212)[_0xd511('0x1b')](_0x2bbab9);}return null;};}function patchUpdates(_0x5ec45f){return function(_0x5f4f67){try{jsonpatch['apply'](_0x5f4f67,_0x5ec45f,!![]);}catch(_0x3283a0){return BPromise[_0xd511('0x21')](_0x3283a0);}return _0x5f4f67[_0xd511('0x22')]();};}function saveUpdates(_0x3a8050,_0x8e2211){return function(_0x1fb0fe){if(_0x1fb0fe){return _0x1fb0fe[_0xd511('0x23')](_0x3a8050)[_0xd511('0x24')](function(_0x889b9b){return _0x889b9b;});}return null;};}function removeEntity(_0x5dfbc9,_0x4f5500){return function(_0x52a147){if(_0x52a147){return _0x52a147[_0xd511('0x25')]()[_0xd511('0x24')](function(){_0x5dfbc9[_0xd511('0x19')](0xcc)[_0xd511('0x1a')]();});}};}function handleEntityNotFound(_0x2df3d3,_0x591c2c){return function(_0x31a39b){if(!_0x31a39b){_0x2df3d3[_0xd511('0x18')](0x194);}return _0x31a39b;};}function handleError(_0x4f0d75,_0x23f531){_0x23f531=_0x23f531||0x1f4;return function(_0x1892dc){logger[_0xd511('0x26')](_0x1892dc['stack']);if(_0x1892dc[_0xd511('0x27')]){delete _0x1892dc[_0xd511('0x27')];}_0x4f0d75[_0xd511('0x19')](_0x23f531)[_0xd511('0x28')](_0x1892dc);};}exports[_0xd511('0x29')]=function(_0x4c1a74,_0x1981af){var _0x28567c={},_0x27934d={},_0x469c3b={'count':0x0,'rows':[]};var _0x3b77c2=_[_0xd511('0x2a')](db['Dynamics365Field']['rawAttributes'],function(_0x3bbab0){return{'name':_0x3bbab0[_0xd511('0x2b')],'type':_0x3bbab0[_0xd511('0x2c')]['key']};});_0x27934d[_0xd511('0x2d')]=_['map'](_0x3b77c2,'name');_0x27934d[_0xd511('0x2e')]=_['keys'](_0x4c1a74[_0xd511('0x2e')]);_0x27934d[_0xd511('0x2f')]=_[_0xd511('0x30')](_0x27934d[_0xd511('0x2d')],_0x27934d[_0xd511('0x2e')]);_0x28567c[_0xd511('0x31')]=_[_0xd511('0x30')](_0x27934d['model'],qs[_0xd511('0x32')](_0x4c1a74[_0xd511('0x2e')][_0xd511('0x32')]));_0x28567c['attributes']=_0x28567c[_0xd511('0x31')][_0xd511('0x33')]?_0x28567c['attributes']:_0x27934d['model'];if(!_0x4c1a74[_0xd511('0x2e')][_0xd511('0x34')](_0xd511('0x35'))){_0x28567c[_0xd511('0x1e')]=qs[_0xd511('0x1e')](_0x4c1a74[_0xd511('0x2e')][_0xd511('0x1e')]);_0x28567c[_0xd511('0x1c')]=qs['offset'](_0x4c1a74[_0xd511('0x2e')][_0xd511('0x1c')]);}_0x28567c[_0xd511('0x36')]=qs[_0xd511('0x37')](_0x4c1a74[_0xd511('0x2e')][_0xd511('0x37')]);_0x28567c[_0xd511('0x38')]=qs[_0xd511('0x2f')](_[_0xd511('0x39')](_0x4c1a74['query'],_0x27934d[_0xd511('0x2f')]),_0x3b77c2);if(_0x4c1a74[_0xd511('0x2e')]['filter']){_0x28567c[_0xd511('0x38')]=_[_0xd511('0x3a')](_0x28567c[_0xd511('0x38')],{'$or':_[_0xd511('0x2a')](_0x3b77c2,function(_0xa89a86){if(_0xa89a86[_0xd511('0x2c')]!==_0xd511('0x3b')){var _0x26bc1d={};_0x26bc1d[_0xa89a86[_0xd511('0x27')]]={'$like':'%'+_0x4c1a74[_0xd511('0x2e')][_0xd511('0x3c')]+'%'};return _0x26bc1d;}})});}_0x28567c=_[_0xd511('0x3a')]({},_0x28567c,_0x4c1a74['options']);var _0x5504ee={'where':_0x28567c[_0xd511('0x38')]};return db[_0xd511('0x3d')]['count'](_0x5504ee)[_0xd511('0x24')](function(_0x35260a){_0x469c3b[_0xd511('0x1f')]=_0x35260a;if(_0x4c1a74[_0xd511('0x2e')]['includeAll']){_0x28567c['include']=[{'all':!![]}];}return db[_0xd511('0x3d')][_0xd511('0x3e')](_0x28567c);})[_0xd511('0x24')](function(_0x163552){_0x469c3b[_0xd511('0x3f')]=_0x163552;return _0x469c3b;})['then'](respondWithFilteredResult(_0x1981af,_0x28567c))[_0xd511('0x40')](handleError(_0x1981af,null));};exports['show']=function(_0x3ed847,_0xf61e19){var _0x18232b={'raw':!![],'where':{'id':_0x3ed847['params']['id']}},_0x3b0653={};_0x3b0653[_0xd511('0x2d')]=_[_0xd511('0x41')](db[_0xd511('0x3d')][_0xd511('0x42')]);_0x3b0653['query']=_[_0xd511('0x41')](_0x3ed847['query']);_0x3b0653[_0xd511('0x2f')]=_['intersection'](_0x3b0653[_0xd511('0x2d')],_0x3b0653[_0xd511('0x2e')]);_0x18232b[_0xd511('0x31')]=_[_0xd511('0x30')](_0x3b0653[_0xd511('0x2d')],qs[_0xd511('0x32')](_0x3ed847[_0xd511('0x2e')][_0xd511('0x32')]));_0x18232b[_0xd511('0x31')]=_0x18232b[_0xd511('0x31')][_0xd511('0x33')]?_0x18232b['attributes']:_0x3b0653['model'];if(_0x3ed847[_0xd511('0x2e')][_0xd511('0x43')]){_0x18232b[_0xd511('0x44')]=[{'all':!![]}];}_0x18232b=_[_0xd511('0x3a')]({},_0x18232b,_0x3ed847[_0xd511('0x45')]);return db['Dynamics365Field'][_0xd511('0x46')](_0x18232b)['then'](handleEntityNotFound(_0xf61e19,null))[_0xd511('0x24')](respondWithResult(_0xf61e19,null))[_0xd511('0x40')](handleError(_0xf61e19,null));};exports[_0xd511('0x47')]=function(_0x1af754,_0x2bfdce){return db[_0xd511('0x3d')][_0xd511('0x47')](_0x1af754[_0xd511('0x48')],{})[_0xd511('0x24')](respondWithResult(_0x2bfdce,0xc9))[_0xd511('0x40')](handleError(_0x2bfdce,null));};exports[_0xd511('0x23')]=function(_0x38ce95,_0x565e0d){if(_0x38ce95[_0xd511('0x48')]['id']){delete _0x38ce95['body']['id'];}return db[_0xd511('0x3d')][_0xd511('0x46')]({'where':{'id':_0x38ce95[_0xd511('0x49')]['id']}})[_0xd511('0x24')](handleEntityNotFound(_0x565e0d,null))[_0xd511('0x24')](saveUpdates(_0x38ce95[_0xd511('0x48')],null))['then'](respondWithResult(_0x565e0d,null))[_0xd511('0x40')](handleError(_0x565e0d,null));};exports[_0xd511('0x25')]=function(_0xec855b,_0x59017c){return db[_0xd511('0x3d')][_0xd511('0x46')]({'where':{'id':_0xec855b['params']['id']}})[_0xd511('0x24')](handleEntityNotFound(_0x59017c,null))[_0xd511('0x24')](removeEntity(_0x59017c,null))['catch'](handleError(_0x59017c,null));}; \ No newline at end of file +var _0x8a54=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','Dynamics365Field','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection'];(function(_0x3df8e7,_0x25c056){var _0x502178=function(_0x382341){while(--_0x382341){_0x3df8e7['push'](_0x3df8e7['shift']());}};_0x502178(++_0x25c056);}(_0x8a54,0xb0));var _0x48a5=function(_0x4cacaa,_0x498461){_0x4cacaa=_0x4cacaa-0x0;var _0x458d8c=_0x8a54[_0x4cacaa];return _0x458d8c;};'use strict';var emlformat=require(_0x48a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x48a5('0x1'));var rp=require(_0x48a5('0x2'));var moment=require(_0x48a5('0x3'));var BPromise=require(_0x48a5('0x4'));var Mustache=require(_0x48a5('0x5'));var util=require('util');var path=require(_0x48a5('0x6'));var sox=require(_0x48a5('0x7'));var csv=require(_0x48a5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x48a5('0x9'));var _=require(_0x48a5('0xa'));var squel=require(_0x48a5('0xb'));var crypto=require(_0x48a5('0xc'));var jsforce=require(_0x48a5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x48a5('0x8'));var querystring=require(_0x48a5('0xe'));var Papa=require(_0x48a5('0xf'));var Redis=require('ioredis');var authService=require(_0x48a5('0x10'));var qs=require(_0x48a5('0x11'));var as=require(_0x48a5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x48a5('0x13'))(_0x48a5('0x14'));var utils=require(_0x48a5('0x15'));var config=require(_0x48a5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x48a5('0x17'))['db'];function respondWithStatusCode(_0x322328,_0x5ea968){_0x5ea968=_0x5ea968||0xcc;return function(_0xa22cb1){if(_0xa22cb1){return _0x322328[_0x48a5('0x18')](_0x5ea968);}return _0x322328[_0x48a5('0x19')](_0x5ea968)[_0x48a5('0x1a')]();};}function respondWithResult(_0xa57e55,_0x9378ca){_0x9378ca=_0x9378ca||0xc8;return function(_0x59d2d8){if(_0x59d2d8){return _0xa57e55[_0x48a5('0x19')](_0x9378ca)[_0x48a5('0x1b')](_0x59d2d8);}};}function respondWithFilteredResult(_0x3a74ac,_0x4f91c7){return function(_0x5b9aaa){if(_0x5b9aaa){var _0x21de3b=typeof _0x4f91c7['offset']===_0x48a5('0x1c')&&typeof _0x4f91c7['limit']===_0x48a5('0x1c');var _0x3af998=_0x5b9aaa[_0x48a5('0x1d')];var _0x5a77bd=_0x21de3b?0x0:_0x4f91c7[_0x48a5('0x1e')];var _0x93172c=_0x21de3b?_0x5b9aaa[_0x48a5('0x1d')]:_0x4f91c7['offset']+_0x4f91c7[_0x48a5('0x1f')];var _0x3eaa0d;if(_0x93172c>=_0x3af998){_0x93172c=_0x3af998;_0x3eaa0d=0xc8;}else{_0x3eaa0d=0xce;}_0x3a74ac[_0x48a5('0x19')](_0x3eaa0d);return _0x3a74ac[_0x48a5('0x20')](_0x48a5('0x21'),_0x5a77bd+'-'+_0x93172c+'/'+_0x3af998)[_0x48a5('0x1b')](_0x5b9aaa);}return null;};}function patchUpdates(_0x2b40c5){return function(_0x510384){try{jsonpatch[_0x48a5('0x22')](_0x510384,_0x2b40c5,!![]);}catch(_0x2e7df7){return BPromise[_0x48a5('0x23')](_0x2e7df7);}return _0x510384['save']();};}function saveUpdates(_0x481aa9,_0x3acd1b){return function(_0x3e2762){if(_0x3e2762){return _0x3e2762[_0x48a5('0x24')](_0x481aa9)[_0x48a5('0x25')](function(_0x2d0f1a){return _0x2d0f1a;});}return null;};}function removeEntity(_0x3e38d9,_0x450324){return function(_0x436352){if(_0x436352){return _0x436352[_0x48a5('0x26')]()[_0x48a5('0x25')](function(){_0x3e38d9[_0x48a5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc89f65,_0x1ba9f7){return function(_0x4b3f26){if(!_0x4b3f26){_0xc89f65[_0x48a5('0x18')](0x194);}return _0x4b3f26;};}function handleError(_0x29de06,_0xe5a476){_0xe5a476=_0xe5a476||0x1f4;return function(_0x339604){logger[_0x48a5('0x27')](_0x339604[_0x48a5('0x28')]);if(_0x339604[_0x48a5('0x29')]){delete _0x339604[_0x48a5('0x29')];}_0x29de06[_0x48a5('0x19')](_0xe5a476)['send'](_0x339604);};}exports['index']=function(_0x5945bf,_0x547f31){var _0x403d45={},_0xf551b3={},_0x3598bf={'count':0x0,'rows':[]};var _0x2c3103=_['map'](db['Dynamics365Field'][_0x48a5('0x2a')],function(_0x4bcec2){return{'name':_0x4bcec2[_0x48a5('0x2b')],'type':_0x4bcec2[_0x48a5('0x2c')][_0x48a5('0x2d')]};});_0xf551b3[_0x48a5('0x2e')]=_['map'](_0x2c3103,_0x48a5('0x29'));_0xf551b3[_0x48a5('0x2f')]=_[_0x48a5('0x30')](_0x5945bf[_0x48a5('0x2f')]);_0xf551b3[_0x48a5('0x31')]=_['intersection'](_0xf551b3[_0x48a5('0x2e')],_0xf551b3[_0x48a5('0x2f')]);_0x403d45[_0x48a5('0x32')]=_[_0x48a5('0x33')](_0xf551b3[_0x48a5('0x2e')],qs['fields'](_0x5945bf['query']['fields']));_0x403d45[_0x48a5('0x32')]=_0x403d45[_0x48a5('0x32')][_0x48a5('0x34')]?_0x403d45['attributes']:_0xf551b3['model'];if(!_0x5945bf[_0x48a5('0x2f')][_0x48a5('0x35')](_0x48a5('0x36'))){_0x403d45[_0x48a5('0x1f')]=qs[_0x48a5('0x1f')](_0x5945bf[_0x48a5('0x2f')][_0x48a5('0x1f')]);_0x403d45['offset']=qs['offset'](_0x5945bf[_0x48a5('0x2f')][_0x48a5('0x1e')]);}_0x403d45[_0x48a5('0x37')]=qs[_0x48a5('0x38')](_0x5945bf[_0x48a5('0x2f')][_0x48a5('0x38')]);_0x403d45[_0x48a5('0x39')]=qs[_0x48a5('0x31')](_[_0x48a5('0x3a')](_0x5945bf['query'],_0xf551b3[_0x48a5('0x31')]),_0x2c3103);if(_0x5945bf[_0x48a5('0x2f')][_0x48a5('0x3b')]){_0x403d45[_0x48a5('0x39')]=_[_0x48a5('0x3c')](_0x403d45[_0x48a5('0x39')],{'$or':_[_0x48a5('0x3d')](_0x2c3103,function(_0x397537){if(_0x397537['type']!==_0x48a5('0x3e')){var _0x409a0d={};_0x409a0d[_0x397537[_0x48a5('0x29')]]={'$like':'%'+_0x5945bf[_0x48a5('0x2f')]['filter']+'%'};return _0x409a0d;}})});}_0x403d45=_[_0x48a5('0x3c')]({},_0x403d45,_0x5945bf[_0x48a5('0x3f')]);var _0x178d3e={'where':_0x403d45['where']};return db[_0x48a5('0x40')][_0x48a5('0x1d')](_0x178d3e)['then'](function(_0x199165){_0x3598bf[_0x48a5('0x1d')]=_0x199165;if(_0x5945bf['query'][_0x48a5('0x41')]){_0x403d45[_0x48a5('0x42')]=[{'all':!![]}];}return db[_0x48a5('0x40')][_0x48a5('0x43')](_0x403d45);})['then'](function(_0x13f2ea){_0x3598bf[_0x48a5('0x44')]=_0x13f2ea;return _0x3598bf;})[_0x48a5('0x25')](respondWithFilteredResult(_0x547f31,_0x403d45))['catch'](handleError(_0x547f31,null));};exports[_0x48a5('0x45')]=function(_0xf4e9be,_0x5adff0){var _0x125cc8={'raw':!![],'where':{'id':_0xf4e9be[_0x48a5('0x46')]['id']}},_0x475ba6={};_0x475ba6[_0x48a5('0x2e')]=_[_0x48a5('0x30')](db['Dynamics365Field'][_0x48a5('0x2a')]);_0x475ba6[_0x48a5('0x2f')]=_[_0x48a5('0x30')](_0xf4e9be[_0x48a5('0x2f')]);_0x475ba6[_0x48a5('0x31')]=_[_0x48a5('0x33')](_0x475ba6[_0x48a5('0x2e')],_0x475ba6[_0x48a5('0x2f')]);_0x125cc8[_0x48a5('0x32')]=_['intersection'](_0x475ba6[_0x48a5('0x2e')],qs[_0x48a5('0x47')](_0xf4e9be[_0x48a5('0x2f')]['fields']));_0x125cc8['attributes']=_0x125cc8[_0x48a5('0x32')]['length']?_0x125cc8[_0x48a5('0x32')]:_0x475ba6[_0x48a5('0x2e')];if(_0xf4e9be[_0x48a5('0x2f')][_0x48a5('0x41')]){_0x125cc8['include']=[{'all':!![]}];}_0x125cc8=_['merge']({},_0x125cc8,_0xf4e9be[_0x48a5('0x3f')]);return db[_0x48a5('0x40')][_0x48a5('0x48')](_0x125cc8)['then'](handleEntityNotFound(_0x5adff0,null))[_0x48a5('0x25')](respondWithResult(_0x5adff0,null))[_0x48a5('0x49')](handleError(_0x5adff0,null));};exports[_0x48a5('0x4a')]=function(_0x3857de,_0x4039c6){return db[_0x48a5('0x40')][_0x48a5('0x4a')](_0x3857de[_0x48a5('0x4b')],{})[_0x48a5('0x25')](respondWithResult(_0x4039c6,0xc9))[_0x48a5('0x49')](handleError(_0x4039c6,null));};exports[_0x48a5('0x24')]=function(_0x38beba,_0x25a1a9){if(_0x38beba[_0x48a5('0x4b')]['id']){delete _0x38beba['body']['id'];}return db['Dynamics365Field'][_0x48a5('0x48')]({'where':{'id':_0x38beba[_0x48a5('0x46')]['id']}})[_0x48a5('0x25')](handleEntityNotFound(_0x25a1a9,null))[_0x48a5('0x25')](saveUpdates(_0x38beba[_0x48a5('0x4b')],null))[_0x48a5('0x25')](respondWithResult(_0x25a1a9,null))[_0x48a5('0x49')](handleError(_0x25a1a9,null));};exports[_0x48a5('0x26')]=function(_0x3dd22e,_0x2e5525){return db[_0x48a5('0x40')][_0x48a5('0x48')]({'where':{'id':_0x3dd22e[_0x48a5('0x46')]['id']}})['then'](handleEntityNotFound(_0x2e5525,null))['then'](removeEntity(_0x2e5525,null))[_0x48a5('0x49')](handleError(_0x2e5525,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 5431317..6566df5 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 _0x8e96=['request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x1e296f,_0x536c0f){var _0x77295b=function(_0x45502c){while(--_0x45502c){_0x1e296f['push'](_0x1e296f['shift']());}};_0x77295b(++_0x536c0f);}(_0x8e96,0xcd));var _0x68e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e96[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x68e9('0x0'));var util=require(_0x68e9('0x1'));var logger=require(_0x68e9('0x2'))(_0x68e9('0x3'));var moment=require(_0x68e9('0x4'));var BPromise=require('bluebird');var rp=require(_0x68e9('0x5'));var fs=require('fs');var path=require(_0x68e9('0x6'));var rimraf=require('rimraf');var config=require(_0x68e9('0x7'));var attributes=require(_0x68e9('0x8'));module[_0x68e9('0x9')]=function(_0x48f331,_0x31a138){return _0x48f331[_0x68e9('0xa')](_0x68e9('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x68e9('0xc'),'fields':[_0x68e9('0xd'),_0x68e9('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4349=['dynamics365_unique_index','idField','FieldId','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields'];(function(_0x2a0111,_0x2babd3){var _0xe51197=function(_0x5d24f6){while(--_0x5d24f6){_0x2a0111['push'](_0x2a0111['shift']());}};_0xe51197(++_0x2babd3);}(_0x4349,0x120));var _0x9434=function(_0x118008,_0x4685e4){_0x118008=_0x118008-0x0;var _0x240985=_0x4349[_0x118008];return _0x240985;};'use strict';var _=require('lodash');var util=require(_0x9434('0x0'));var logger=require(_0x9434('0x1'))(_0x9434('0x2'));var moment=require(_0x9434('0x3'));var BPromise=require('bluebird');var rp=require(_0x9434('0x4'));var fs=require('fs');var path=require(_0x9434('0x5'));var rimraf=require('rimraf');var config=require(_0x9434('0x6'));var attributes=require(_0x9434('0x7'));module[_0x9434('0x8')]=function(_0x5d93b1,_0x4d56ad){return _0x5d93b1[_0x9434('0x9')](_0x9434('0xa'),attributes,{'tableName':_0x9434('0xb'),'paranoid':![],'indexes':[{'name':_0x9434('0xc'),'fields':[_0x9434('0xd'),_0x9434('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 8800b3c..0ada11d 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 _0x5018=['ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x31903c,_0x991c0a){var _0x50522f=function(_0x39a00c){while(--_0x39a00c){_0x31903c['push'](_0x31903c['shift']());}};_0x50522f(++_0x991c0a);}(_0x5018,0x1c9));var _0x8501=function(_0x2f8530,_0x5cbd67){_0x2f8530=_0x2f8530-0x0;var _0x5e814e=_0x5018[_0x2f8530];return _0x5e814e;};'use strict';var _=require(_0x8501('0x0'));var util=require(_0x8501('0x1'));var moment=require(_0x8501('0x2'));var BPromise=require(_0x8501('0x3'));var rs=require(_0x8501('0x4'));var fs=require('fs');var Redis=require(_0x8501('0x5'));var db=require(_0x8501('0x6'))['db'];var utils=require(_0x8501('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8501('0x8'));var client=jayson[_0x8501('0x9')][_0x8501('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4599a9,_0x5aace8,_0x1a13de){return new BPromise(function(_0x1606cc,_0x33321d){return client[_0x8501('0xb')](_0x4599a9,_0x1a13de)[_0x8501('0xc')](function(_0x1eaf90){logger[_0x8501('0xd')](_0x8501('0xe'),_0x5aace8,_0x8501('0xf'));logger['debug'](_0x8501('0x10'),_0x5aace8,_0x8501('0xf'),JSON['stringify'](_0x1eaf90));if(_0x1eaf90[_0x8501('0x11')]){if(_0x1eaf90[_0x8501('0x11')][_0x8501('0x12')]===0x1f4){logger['error'](_0x8501('0xe'),_0x5aace8,_0x1eaf90['error'][_0x8501('0x13')]);return _0x33321d(_0x1eaf90[_0x8501('0x11')]['message']);}logger[_0x8501('0x11')](_0x8501('0xe'),_0x5aace8,_0x1eaf90[_0x8501('0x11')][_0x8501('0x13')]);return _0x1606cc(_0x1eaf90[_0x8501('0x11')]['message']);}else{logger[_0x8501('0xd')](_0x8501('0xe'),_0x5aace8,_0x8501('0xf'));_0x1606cc(_0x1eaf90[_0x8501('0x14')][_0x8501('0x13')]);}})[_0x8501('0x15')](function(_0x44349d){logger['error'](_0x8501('0xe'),_0x5aace8,_0x44349d);_0x33321d(_0x44349d);});});} \ No newline at end of file +var _0xc4a8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0xc4a8,0xaa));var _0x8c4a=function(_0x5d93a9,_0x574468){_0x5d93a9=_0x5d93a9-0x0;var _0x483793=_0xc4a8[_0x5d93a9];return _0x483793;};'use strict';var _=require(_0x8c4a('0x0'));var util=require(_0x8c4a('0x1'));var moment=require(_0x8c4a('0x2'));var BPromise=require(_0x8c4a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c4a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c4a('0x5'));var logger=require(_0x8c4a('0x6'))(_0x8c4a('0x7'));var config=require(_0x8c4a('0x8'));var jayson=require(_0x8c4a('0x9'));var client=jayson[_0x8c4a('0xa')][_0x8c4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1827a8,_0x4508c0,_0x1f86da){return new BPromise(function(_0x54eab5,_0x1ea2ef){return client[_0x8c4a('0xc')](_0x1827a8,_0x1f86da)[_0x8c4a('0xd')](function(_0x4aa29e){logger['info'](_0x8c4a('0xe'),_0x4508c0,_0x8c4a('0xf'));logger[_0x8c4a('0x10')](_0x8c4a('0x11'),_0x4508c0,_0x8c4a('0xf'),JSON['stringify'](_0x4aa29e));if(_0x4aa29e[_0x8c4a('0x12')]){if(_0x4aa29e[_0x8c4a('0x12')]['code']===0x1f4){logger[_0x8c4a('0x12')](_0x8c4a('0xe'),_0x4508c0,_0x4aa29e[_0x8c4a('0x12')]['message']);return _0x1ea2ef(_0x4aa29e[_0x8c4a('0x12')]['message']);}logger[_0x8c4a('0x12')](_0x8c4a('0xe'),_0x4508c0,_0x4aa29e[_0x8c4a('0x12')][_0x8c4a('0x13')]);return _0x54eab5(_0x4aa29e[_0x8c4a('0x12')][_0x8c4a('0x13')]);}else{logger[_0x8c4a('0x14')](_0x8c4a('0xe'),_0x4508c0,_0x8c4a('0xf'));_0x54eab5(_0x4aa29e['result'][_0x8c4a('0x13')]);}})[_0x8c4a('0x15')](function(_0x4a8cf1){logger[_0x8c4a('0x12')](_0x8c4a('0xe'),_0x4508c0,_0x4a8cf1);_0x1ea2ef(_0x4a8cf1);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index db8dfbd..c70ab22 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 _0x51f3=['put','update','/:id','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','create','/:id/configurations','addConfiguration'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x51f3,0x139));var _0x351f=function(_0x24e2a0,_0x4a3038){_0x24e2a0=_0x24e2a0-0x0;var _0x44540e=_0x51f3[_0x24e2a0];return _0x44540e;};'use strict';var multer=require(_0x351f('0x0'));var util=require('util');var path=require(_0x351f('0x1'));var timeout=require('connect-timeout');var express=require(_0x351f('0x2'));var router=express[_0x351f('0x3')]();var fs_extra=require(_0x351f('0x4'));var auth=require(_0x351f('0x5'));var interaction=require(_0x351f('0x6'));var config=require('../../config/environment');var controller=require(_0x351f('0x7'));router[_0x351f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x351f('0x8')]('/:id',auth[_0x351f('0x9')](),controller[_0x351f('0xa')]);router[_0x351f('0x8')]('/:id/configurations',auth[_0x351f('0x9')](),controller[_0x351f('0xb')]);router[_0x351f('0x8')](_0x351f('0xc'),auth[_0x351f('0x9')](),controller[_0x351f('0xd')]);router['post']('/',auth[_0x351f('0x9')](),controller[_0x351f('0xe')]);router['post'](_0x351f('0xf'),auth[_0x351f('0x9')](),controller[_0x351f('0x10')]);router[_0x351f('0x11')]('/:id',auth[_0x351f('0x9')](),controller[_0x351f('0x12')]);router['delete'](_0x351f('0x13'),auth[_0x351f('0x9')](),controller[_0x351f('0x14')]);module[_0x351f('0x15')]=router; \ No newline at end of file +var _0x973b=['index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','exports','util','path','connect-timeout','express','../../components/interaction/service','./intFreshdeskAccount.controller','get'];(function(_0x1b438e,_0x25398a){var _0x1d99da=function(_0x25976f){while(--_0x25976f){_0x1b438e['push'](_0x1b438e['shift']());}};_0x1d99da(++_0x25398a);}(_0x973b,0xf0));var _0xb973=function(_0x20e7bf,_0x2b3de2){_0x20e7bf=_0x20e7bf-0x0;var _0x285e28=_0x973b[_0x20e7bf];return _0x285e28;};'use strict';var multer=require('multer');var util=require(_0xb973('0x0'));var path=require(_0xb973('0x1'));var timeout=require(_0xb973('0x2'));var express=require(_0xb973('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb973('0x4'));var config=require('../../config/environment');var controller=require(_0xb973('0x5'));router[_0xb973('0x6')]('/',auth['isAuthenticated'](),controller[_0xb973('0x7')]);router[_0xb973('0x6')](_0xb973('0x8'),auth[_0xb973('0x9')](),controller[_0xb973('0xa')]);router[_0xb973('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xb973('0xb')]);router['get'](_0xb973('0xc'),auth[_0xb973('0x9')](),controller['getFields']);router[_0xb973('0xd')]('/',auth['isAuthenticated'](),controller[_0xb973('0xe')]);router[_0xb973('0xd')]('/:id/configurations',auth[_0xb973('0x9')](),controller[_0xb973('0xf')]);router['put'](_0xb973('0x8'),auth['isAuthenticated'](),controller[_0xb973('0x10')]);router[_0xb973('0x11')](_0xb973('0x8'),auth[_0xb973('0x9')](),controller['destroy']);module[_0xb973('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 5256c25..594f96e 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 _0x065e=['sequelize','STRING','username'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x065e,0x1a7));var _0xe065=function(_0x4e8680,_0x5ca85e){_0x4e8680=_0x4e8680-0x0;var _0x3a417a=_0x065e[_0x4e8680];return _0x3a417a;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe065('0x1')],'unique':_0xe065('0x2')},'apiKey':{'type':Sequelize[_0xe065('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xe065('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2ef3=['remoteUri','sequelize','exports','STRING','username'];(function(_0x211dde,_0x4a954d){var _0x555466=function(_0x28b890){while(--_0x28b890){_0x211dde['push'](_0x211dde['shift']());}};_0x555466(++_0x4a954d);}(_0x2ef3,0xba));var _0x32ef=function(_0x4f89ad,_0x11eb67){_0x4f89ad=_0x4f89ad-0x0;var _0x48f15e=_0x2ef3[_0x4f89ad];return _0x48f15e;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'name':{'type':Sequelize[_0x32ef('0x2')]},'description':{'type':Sequelize[_0x32ef('0x2')]},'username':{'type':Sequelize[_0x32ef('0x2')],'unique':_0x32ef('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x32ef('0x2')],'unique':_0x32ef('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 972bcf7..70775dd 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 _0xa1b9=['util','sox','to-csv','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','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','FreshdeskAccount','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','filter','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','remoteUri','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','ticket_type','company','includes','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x39003b,_0x39898c){var _0x24f7f6=function(_0x5a258e){while(--_0x5a258e){_0x39003b['push'](_0x39003b['shift']());}};_0x24f7f6(++_0x39898c);}(_0xa1b9,0x71));var _0x9a1b=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa1b9[_0x1b349a];return _0x5d1f7c;};'use strict';var emlformat=require(_0x9a1b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a1b('0x1'));var jsonpatch=require(_0x9a1b('0x2'));var rp=require(_0x9a1b('0x3'));var moment=require(_0x9a1b('0x4'));var BPromise=require(_0x9a1b('0x5'));var Mustache=require(_0x9a1b('0x6'));var util=require(_0x9a1b('0x7'));var path=require('path');var sox=require(_0x9a1b('0x8'));var csv=require(_0x9a1b('0x9'));var ejs=require(_0x9a1b('0xa'));var fs=require('fs');var fs_extra=require(_0x9a1b('0xb'));var _=require('lodash');var squel=require(_0x9a1b('0xc'));var crypto=require('crypto');var jsforce=require(_0x9a1b('0xd'));var deskjs=require(_0x9a1b('0xe'));var toCsv=require(_0x9a1b('0x9'));var querystring=require(_0x9a1b('0xf'));var Papa=require(_0x9a1b('0x10'));var Redis=require('ioredis');var authService=require(_0x9a1b('0x11'));var qs=require(_0x9a1b('0x12'));var as=require(_0x9a1b('0x13'));var hardwareService=require(_0x9a1b('0x14'));var logger=require(_0x9a1b('0x15'))(_0x9a1b('0x16'));var utils=require(_0x9a1b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9a1b('0x18'));var db=require(_0x9a1b('0x19'))['db'];var integrations=require(_0x9a1b('0x1a'));function respondWithStatusCode(_0x5ee9d3,_0x1d016d){_0x1d016d=_0x1d016d||0xcc;return function(_0x3a129b){if(_0x3a129b){return _0x5ee9d3[_0x9a1b('0x1b')](_0x1d016d);}return _0x5ee9d3[_0x9a1b('0x1c')](_0x1d016d)[_0x9a1b('0x1d')]();};}function respondWithResult(_0x157b6f,_0x3fe388){_0x3fe388=_0x3fe388||0xc8;return function(_0x18df50){if(_0x18df50){return _0x157b6f[_0x9a1b('0x1c')](_0x3fe388)[_0x9a1b('0x1e')](_0x18df50);}};}function respondWithFilteredResult(_0x5c397f,_0x357cd9){return function(_0x2440fc){if(_0x2440fc){var _0x5a1d3b=typeof _0x357cd9[_0x9a1b('0x1f')]===_0x9a1b('0x20')&&typeof _0x357cd9[_0x9a1b('0x21')]===_0x9a1b('0x20');var _0x402d0c=_0x2440fc[_0x9a1b('0x22')];var _0xe7a820=_0x5a1d3b?0x0:_0x357cd9['offset'];var _0x403250=_0x5a1d3b?_0x2440fc[_0x9a1b('0x22')]:_0x357cd9[_0x9a1b('0x1f')]+_0x357cd9[_0x9a1b('0x21')];var _0x2dacdc;if(_0x403250>=_0x402d0c){_0x403250=_0x402d0c;_0x2dacdc=0xc8;}else{_0x2dacdc=0xce;}_0x5c397f['status'](_0x2dacdc);return _0x5c397f[_0x9a1b('0x23')](_0x9a1b('0x24'),_0xe7a820+'-'+_0x403250+'/'+_0x402d0c)[_0x9a1b('0x1e')](_0x2440fc);}return null;};}function patchUpdates(_0x1977a7){return function(_0x4a0ccd){try{jsonpatch[_0x9a1b('0x25')](_0x4a0ccd,_0x1977a7,!![]);}catch(_0x303110){return BPromise[_0x9a1b('0x26')](_0x303110);}return _0x4a0ccd[_0x9a1b('0x27')]();};}function saveUpdates(_0x1c9ab3,_0x327cac){return function(_0x2b8cfe){if(_0x2b8cfe){return _0x2b8cfe[_0x9a1b('0x28')](_0x1c9ab3)[_0x9a1b('0x29')](function(_0x37971c){return _0x37971c;});}return null;};}function removeEntity(_0x5841c1,_0x2439e9){return function(_0x3392da){if(_0x3392da){return _0x3392da[_0x9a1b('0x2a')]()['then'](function(){_0x5841c1['status'](0xcc)[_0x9a1b('0x1d')]();});}};}function handleEntityNotFound(_0x52fce9,_0x17704b){return function(_0x4a461e){if(!_0x4a461e){_0x52fce9['sendStatus'](0x194);}return _0x4a461e;};}function handleError(_0x48e736,_0x432a3d){_0x432a3d=_0x432a3d||0x1f4;return function(_0x50ebc5){logger[_0x9a1b('0x2b')](_0x50ebc5[_0x9a1b('0x2c')]);if(_0x50ebc5[_0x9a1b('0x2d')]){delete _0x50ebc5[_0x9a1b('0x2d')];}_0x48e736[_0x9a1b('0x1c')](_0x432a3d)[_0x9a1b('0x2e')](_0x50ebc5);};}exports[_0x9a1b('0x2f')]=function(_0x1453c4,_0x4070aa){var _0x2d9ca8={},_0x56f3e8={},_0x5735a4={'count':0x0,'rows':[]};var _0x46fca0=_[_0x9a1b('0x30')](db['FreshdeskAccount'][_0x9a1b('0x31')],function(_0x43c2e7){return{'name':_0x43c2e7[_0x9a1b('0x32')],'type':_0x43c2e7[_0x9a1b('0x33')][_0x9a1b('0x34')]};});_0x56f3e8[_0x9a1b('0x35')]=_[_0x9a1b('0x30')](_0x46fca0,_0x9a1b('0x2d'));_0x56f3e8[_0x9a1b('0x36')]=_['keys'](_0x1453c4[_0x9a1b('0x36')]);_0x56f3e8['filters']=_[_0x9a1b('0x37')](_0x56f3e8[_0x9a1b('0x35')],_0x56f3e8[_0x9a1b('0x36')]);_0x2d9ca8[_0x9a1b('0x38')]=_['intersection'](_0x56f3e8[_0x9a1b('0x35')],qs[_0x9a1b('0x39')](_0x1453c4[_0x9a1b('0x36')][_0x9a1b('0x39')]));_0x2d9ca8[_0x9a1b('0x38')]=_0x2d9ca8[_0x9a1b('0x38')][_0x9a1b('0x3a')]?_0x2d9ca8[_0x9a1b('0x38')]:_0x56f3e8[_0x9a1b('0x35')];if(!_0x1453c4['query'][_0x9a1b('0x3b')](_0x9a1b('0x3c'))){_0x2d9ca8[_0x9a1b('0x21')]=qs[_0x9a1b('0x21')](_0x1453c4[_0x9a1b('0x36')][_0x9a1b('0x21')]);_0x2d9ca8[_0x9a1b('0x1f')]=qs['offset'](_0x1453c4[_0x9a1b('0x36')][_0x9a1b('0x1f')]);}_0x2d9ca8[_0x9a1b('0x3d')]=qs[_0x9a1b('0x3e')](_0x1453c4[_0x9a1b('0x36')][_0x9a1b('0x3e')]);_0x2d9ca8[_0x9a1b('0x3f')]=qs[_0x9a1b('0x40')](_[_0x9a1b('0x41')](_0x1453c4['query'],_0x56f3e8[_0x9a1b('0x40')]),_0x46fca0);if(_0x1453c4[_0x9a1b('0x36')]['filter']){_0x2d9ca8[_0x9a1b('0x3f')]=_[_0x9a1b('0x42')](_0x2d9ca8['where'],{'$or':_['map'](_0x46fca0,function(_0x4e7d1e){if(_0x4e7d1e[_0x9a1b('0x33')]!==_0x9a1b('0x43')){var _0x3ccca0={};_0x3ccca0[_0x4e7d1e[_0x9a1b('0x2d')]]={'$like':'%'+_0x1453c4[_0x9a1b('0x36')]['filter']+'%'};return _0x3ccca0;}})});}_0x2d9ca8=_[_0x9a1b('0x42')]({},_0x2d9ca8,_0x1453c4[_0x9a1b('0x44')]);var _0x2683a1={'where':_0x2d9ca8[_0x9a1b('0x3f')]};return db[_0x9a1b('0x45')][_0x9a1b('0x22')](_0x2683a1)[_0x9a1b('0x29')](function(_0x4da1c0){_0x5735a4[_0x9a1b('0x22')]=_0x4da1c0;if(_0x1453c4[_0x9a1b('0x36')]['includeAll']){_0x2d9ca8[_0x9a1b('0x46')]=[{'all':!![]}];}return db[_0x9a1b('0x45')][_0x9a1b('0x47')](_0x2d9ca8);})[_0x9a1b('0x29')](function(_0x59b901){_0x5735a4[_0x9a1b('0x48')]=_0x59b901;return _0x5735a4;})[_0x9a1b('0x29')](respondWithFilteredResult(_0x4070aa,_0x2d9ca8))[_0x9a1b('0x49')](handleError(_0x4070aa,null));};exports[_0x9a1b('0x4a')]=function(_0x1863d8,_0x18a606){var _0x515bb8={'raw':![],'where':{'id':_0x1863d8[_0x9a1b('0x4b')]['id']}},_0x2f852e={};_0x2f852e[_0x9a1b('0x35')]=_['keys'](db[_0x9a1b('0x45')][_0x9a1b('0x31')]);_0x2f852e[_0x9a1b('0x36')]=_[_0x9a1b('0x4c')](_0x1863d8[_0x9a1b('0x36')]);_0x2f852e[_0x9a1b('0x40')]=_[_0x9a1b('0x37')](_0x2f852e['model'],_0x2f852e[_0x9a1b('0x36')]);_0x515bb8[_0x9a1b('0x38')]=_[_0x9a1b('0x37')](_0x2f852e[_0x9a1b('0x35')],qs['fields'](_0x1863d8[_0x9a1b('0x36')][_0x9a1b('0x39')]));_0x515bb8[_0x9a1b('0x38')]=_0x515bb8[_0x9a1b('0x38')][_0x9a1b('0x3a')]?_0x515bb8[_0x9a1b('0x38')]:_0x2f852e[_0x9a1b('0x35')];if(_0x1863d8['query']['includeAll']){_0x515bb8[_0x9a1b('0x46')]=[{'all':!![]}];}_0x515bb8=_[_0x9a1b('0x42')]({},_0x515bb8,_0x1863d8['options']);return db[_0x9a1b('0x45')][_0x9a1b('0x4d')](_0x515bb8)[_0x9a1b('0x29')](handleEntityNotFound(_0x18a606,null))['then'](respondWithResult(_0x18a606,null))['catch'](handleError(_0x18a606,null));};exports['create']=function(_0x31b879,_0xd5f4bf){return db['FreshdeskAccount'][_0x9a1b('0x4e')](_0x31b879[_0x9a1b('0x4f')],{})['then'](respondWithResult(_0xd5f4bf,0xc9))['catch'](handleError(_0xd5f4bf,null));};exports[_0x9a1b('0x28')]=function(_0x2ff4b5,_0x511510){if(_0x2ff4b5[_0x9a1b('0x4f')]['id']){delete _0x2ff4b5[_0x9a1b('0x4f')]['id'];}return db[_0x9a1b('0x45')][_0x9a1b('0x4d')]({'where':{'id':_0x2ff4b5['params']['id']}})['then'](handleEntityNotFound(_0x511510,null))['then'](saveUpdates(_0x2ff4b5[_0x9a1b('0x4f')],null))[_0x9a1b('0x29')](respondWithResult(_0x511510,null))[_0x9a1b('0x49')](handleError(_0x511510,null));};exports[_0x9a1b('0x2a')]=function(_0x1a608a,_0x36bb41){return db[_0x9a1b('0x45')][_0x9a1b('0x4d')]({'where':{'id':_0x1a608a[_0x9a1b('0x4b')]['id']}})[_0x9a1b('0x29')](handleEntityNotFound(_0x36bb41,null))[_0x9a1b('0x29')](removeEntity(_0x36bb41,null))[_0x9a1b('0x49')](handleError(_0x36bb41,null));};exports[_0x9a1b('0x50')]=function(_0x2bc22a,_0x5cb018,_0x5c37d2){var _0x25b950={};var _0x10f485={};var _0x25bf42;var _0x2ae8f3;return db[_0x9a1b('0x45')][_0x9a1b('0x51')]({'where':{'id':_0x2bc22a[_0x9a1b('0x4b')]['id']}})[_0x9a1b('0x29')](handleEntityNotFound(_0x5cb018,null))[_0x9a1b('0x29')](function(_0x5c35b7){if(_0x5c35b7){_0x25bf42=_0x5c35b7;_0x10f485[_0x9a1b('0x35')]=_[_0x9a1b('0x4c')](db[_0x9a1b('0x52')][_0x9a1b('0x31')]);_0x10f485['query']=_[_0x9a1b('0x4c')](_0x2bc22a[_0x9a1b('0x36')]);_0x10f485['filters']=_[_0x9a1b('0x37')](_0x10f485['model'],_0x10f485['query']);_0x25b950[_0x9a1b('0x38')]=_[_0x9a1b('0x37')](_0x10f485[_0x9a1b('0x35')],qs['fields'](_0x2bc22a[_0x9a1b('0x36')][_0x9a1b('0x39')]));_0x25b950[_0x9a1b('0x38')]=_0x25b950[_0x9a1b('0x38')][_0x9a1b('0x3a')]?_0x25b950[_0x9a1b('0x38')]:_0x10f485[_0x9a1b('0x35')];_0x25b950[_0x9a1b('0x3d')]=qs[_0x9a1b('0x3e')](_0x2bc22a[_0x9a1b('0x36')][_0x9a1b('0x3e')]);_0x25b950[_0x9a1b('0x3f')]=qs[_0x9a1b('0x40')](_[_0x9a1b('0x41')](_0x2bc22a[_0x9a1b('0x36')],_0x10f485[_0x9a1b('0x40')]));if(_0x2bc22a[_0x9a1b('0x36')][_0x9a1b('0x53')]){_0x25b950[_0x9a1b('0x3f')]=_[_0x9a1b('0x42')](_0x25b950[_0x9a1b('0x3f')],{'$or':_[_0x9a1b('0x30')](_0x25b950[_0x9a1b('0x38')],function(_0x53ea49){var _0x244f08={};_0x244f08[_0x53ea49]={'$like':'%'+_0x2bc22a[_0x9a1b('0x36')]['filter']+'%'};return _0x244f08;})});}_0x25b950=_[_0x9a1b('0x42')]({},_0x25b950,_0x2bc22a[_0x9a1b('0x44')]);return _0x25bf42[_0x9a1b('0x50')](_0x25b950);}})[_0x9a1b('0x29')](function(_0x4b595b){if(_0x4b595b){_0x2ae8f3=_0x4b595b[_0x9a1b('0x3a')];if(!_0x2bc22a[_0x9a1b('0x36')]['hasOwnProperty'](_0x9a1b('0x3c'))){_0x25b950[_0x9a1b('0x21')]=qs['limit'](_0x2bc22a[_0x9a1b('0x36')][_0x9a1b('0x21')]);_0x25b950['offset']=qs[_0x9a1b('0x1f')](_0x2bc22a['query'][_0x9a1b('0x1f')]);}return _0x25bf42[_0x9a1b('0x50')](_0x25b950);}})[_0x9a1b('0x29')](function(_0x11a704){if(_0x11a704){return _0x11a704?{'count':_0x2ae8f3,'rows':_0x11a704}:null;}})['then'](respondWithResult(_0x5cb018,null))[_0x9a1b('0x49')](handleError(_0x5cb018,null));};exports[_0x9a1b('0x54')]=function(_0x265ca5,_0x2cc80c,_0x4c90ea){if(_0x265ca5[_0x9a1b('0x4f')]['id']){delete _0x265ca5[_0x9a1b('0x4f')]['id'];}return db[_0x9a1b('0x45')]['findOne']({'where':{'id':_0x265ca5[_0x9a1b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2cc80c,null))['then'](function(_0x5cd1e0){if(_0x5cd1e0){_0x265ca5[_0x9a1b('0x4f')]['AccountId']=_0x5cd1e0['id'];_0x265ca5[_0x9a1b('0x4f')][_0x9a1b('0x55')]=integrations[_0x9a1b('0x56')](_0x265ca5[_0x9a1b('0x4f')]['channel'],_0x265ca5[_0x9a1b('0x4f')][_0x9a1b('0x33')]);_0x265ca5['body'][_0x9a1b('0x57')]=integrations[_0x9a1b('0x58')](_0x265ca5[_0x9a1b('0x4f')]['channel'],_0x265ca5[_0x9a1b('0x4f')][_0x9a1b('0x33')]);return db[_0x9a1b('0x52')][_0x9a1b('0x4e')](_0x265ca5[_0x9a1b('0x4f')],{'include':[{'model':db[_0x9a1b('0x59')],'as':_0x9a1b('0x55')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0x9a1b('0x29')](respondWithResult(_0x2cc80c,null))[_0x9a1b('0x49')](handleError(_0x2cc80c,null));};exports[_0x9a1b('0x5a')]=function(_0x3448a3,_0x289b13,_0x34a80b){var _0x40d72b='';return db[_0x9a1b('0x45')][_0x9a1b('0x51')]({'where':{'id':_0x3448a3[_0x9a1b('0x4b')]['id']},'attributes':['id','remoteUri',_0x9a1b('0x5b')]})[_0x9a1b('0x29')](handleEntityNotFound(_0x289b13,null))['then'](function(_0x4c2823){if(_0x4c2823){_0x40d72b=_0x4c2823[_0x9a1b('0x5c')];var _0x46256b=_0x40d72b['slice'](-0x1);if(_0x46256b==='/'){_0x40d72b=_0x40d72b['substring'](0x0,_0x40d72b[_0x9a1b('0x5d')](_0x46256b));}return rp({'method':_0x9a1b('0x5e'),'uri':util[_0x9a1b('0x5f')](_0x9a1b('0x60'),_0x40d72b,_0x9a1b('0x61')),'headers':{'Authorization':util[_0x9a1b('0x5f')](_0x9a1b('0x62'),new Buffer(util[_0x9a1b('0x5f')](_0x9a1b('0x63'),_0x4c2823[_0x9a1b('0x5b')]))[_0x9a1b('0x64')](_0x9a1b('0x65')))},'json':!![]});}})[_0x9a1b('0x29')](function(_0x6dc531){if(_0x6dc531){var _0x33008a=[_0x9a1b('0x66'),_0x9a1b('0x67'),_0x9a1b('0x68'),_0x9a1b('0x69'),_0x9a1b('0x1c'),_0x9a1b('0x6a'),_0x9a1b('0x6b'),'source',_0x9a1b('0x6c'),'group',_0x9a1b('0x6d')];_['remove'](_0x6dc531,function(_0xbb642d){return _0x33008a[_0x9a1b('0x6e')](_0xbb642d[_0x9a1b('0x2d')])||!_0xbb642d[_0x9a1b('0x6f')]&&_0xbb642d['type']!==_0x9a1b('0x70')&&_0xbb642d['type']!==_0x9a1b('0x71');});return{'count':_0x6dc531['length'],'rows':_['map'](_0x6dc531,function(_0x4fa66d){return{'id':_0x4fa66d[_0x9a1b('0x2d')],'name':_0x4fa66d[_0x9a1b('0x72')],'custom':!_0x4fa66d[_0x9a1b('0x6f')],'options':_0x4fa66d[_0x9a1b('0x73')]?_['map'](_0x4fa66d[_0x9a1b('0x73')],function(_0x5f2200){return{'name':_['capitalize'](_0x5f2200),'value':_0x5f2200};}):[]};})};}})['then'](respondWithResult(_0x289b13,null))[_0x9a1b('0x49')](function(_0x32a043){var _0x338c8a=_0x3448a3[_0x9a1b('0x36')][_0x9a1b('0x74')]?0x1f4:_0x32a043[_0x9a1b('0x75')]||0x1f4;logger[_0x9a1b('0x2b')](_0x9a1b('0x76'),_0x9a1b('0x5a'),_0x338c8a,JSON['stringify'](_0x32a043));delete _0x32a043[_0x9a1b('0x2d')];if(_0x338c8a===0x191){_0x338c8a=0x190;}_0x289b13[_0x9a1b('0x1c')](_0x338c8a)[_0x9a1b('0x2e')](_0x3448a3[_0x9a1b('0x36')][_0x9a1b('0x74')]?{'message':_0x9a1b('0x77'),'statusCode':_0x32a043['statusCode']}:_0x32a043);});}; \ No newline at end of file +var _0x93e7=['params','keys','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','subject','agent','description','priority','remove','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','rawAttributes','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskAccount','then','includeAll','include','findAll','rows','catch','show'];(function(_0x21621b,_0x32bce8){var _0x80eab3=function(_0x3082d0){while(--_0x3082d0){_0x21621b['push'](_0x21621b['shift']());}};_0x80eab3(++_0x32bce8);}(_0x93e7,0x9e));var _0x793e=function(_0x1d3fdc,_0x2b5c54){_0x1d3fdc=_0x1d3fdc-0x0;var _0x128bb0=_0x93e7[_0x1d3fdc];return _0x128bb0;};'use strict';var emlformat=require(_0x793e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x793e('0x1'));var jsonpatch=require(_0x793e('0x2'));var rp=require('request-promise');var moment=require(_0x793e('0x3'));var BPromise=require(_0x793e('0x4'));var Mustache=require(_0x793e('0x5'));var util=require(_0x793e('0x6'));var path=require('path');var sox=require(_0x793e('0x7'));var csv=require('to-csv');var ejs=require(_0x793e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x793e('0x9'));var squel=require('squel');var crypto=require(_0x793e('0xa'));var jsforce=require(_0x793e('0xb'));var deskjs=require(_0x793e('0xc'));var toCsv=require(_0x793e('0xd'));var querystring=require(_0x793e('0xe'));var Papa=require(_0x793e('0xf'));var Redis=require(_0x793e('0x10'));var authService=require(_0x793e('0x11'));var qs=require(_0x793e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x793e('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x793e('0x14'));var db=require(_0x793e('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x6a5f34,_0x2e2efe){_0x2e2efe=_0x2e2efe||0xcc;return function(_0x746de2){if(_0x746de2){return _0x6a5f34[_0x793e('0x16')](_0x2e2efe);}return _0x6a5f34[_0x793e('0x17')](_0x2e2efe)[_0x793e('0x18')]();};}function respondWithResult(_0x1c7c58,_0x3a0952){_0x3a0952=_0x3a0952||0xc8;return function(_0x41ea9f){if(_0x41ea9f){return _0x1c7c58[_0x793e('0x17')](_0x3a0952)[_0x793e('0x19')](_0x41ea9f);}};}function respondWithFilteredResult(_0x36686c,_0x418b5f){return function(_0x18990a){if(_0x18990a){var _0x3fd9fe=typeof _0x418b5f[_0x793e('0x1a')]===_0x793e('0x1b')&&typeof _0x418b5f[_0x793e('0x1c')]===_0x793e('0x1b');var _0x5b9204=_0x18990a[_0x793e('0x1d')];var _0x3c6163=_0x3fd9fe?0x0:_0x418b5f['offset'];var _0x4d55d4=_0x3fd9fe?_0x18990a['count']:_0x418b5f[_0x793e('0x1a')]+_0x418b5f[_0x793e('0x1c')];var _0xbd81fc;if(_0x4d55d4>=_0x5b9204){_0x4d55d4=_0x5b9204;_0xbd81fc=0xc8;}else{_0xbd81fc=0xce;}_0x36686c[_0x793e('0x17')](_0xbd81fc);return _0x36686c[_0x793e('0x1e')](_0x793e('0x1f'),_0x3c6163+'-'+_0x4d55d4+'/'+_0x5b9204)[_0x793e('0x19')](_0x18990a);}return null;};}function patchUpdates(_0x9413f9){return function(_0x63d809){try{jsonpatch[_0x793e('0x20')](_0x63d809,_0x9413f9,!![]);}catch(_0xb72e9e){return BPromise[_0x793e('0x21')](_0xb72e9e);}return _0x63d809[_0x793e('0x22')]();};}function saveUpdates(_0xed37e,_0x33fe28){return function(_0x353ae3){if(_0x353ae3){return _0x353ae3[_0x793e('0x23')](_0xed37e)['then'](function(_0x59a4ff){return _0x59a4ff;});}return null;};}function removeEntity(_0xc259c8,_0x36840f){return function(_0x54eec3){if(_0x54eec3){return _0x54eec3[_0x793e('0x24')]()['then'](function(){_0xc259c8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59b191,_0x5203aa){return function(_0x20c876){if(!_0x20c876){_0x59b191[_0x793e('0x16')](0x194);}return _0x20c876;};}function handleError(_0x4c7816,_0x361a87){_0x361a87=_0x361a87||0x1f4;return function(_0x143918){logger[_0x793e('0x25')](_0x143918[_0x793e('0x26')]);if(_0x143918[_0x793e('0x27')]){delete _0x143918[_0x793e('0x27')];}_0x4c7816[_0x793e('0x17')](_0x361a87)[_0x793e('0x28')](_0x143918);};}exports['index']=function(_0xfe7fb9,_0x48edff){var _0x4a45ae={},_0x530316={},_0xeb38af={'count':0x0,'rows':[]};var _0x4d1415=_[_0x793e('0x29')](db['FreshdeskAccount'][_0x793e('0x2a')],function(_0x3b2b0c){return{'name':_0x3b2b0c['fieldName'],'type':_0x3b2b0c['type'][_0x793e('0x2b')]};});_0x530316['model']=_[_0x793e('0x29')](_0x4d1415,_0x793e('0x27'));_0x530316[_0x793e('0x2c')]=_['keys'](_0xfe7fb9[_0x793e('0x2c')]);_0x530316[_0x793e('0x2d')]=_[_0x793e('0x2e')](_0x530316[_0x793e('0x2f')],_0x530316[_0x793e('0x2c')]);_0x4a45ae['attributes']=_[_0x793e('0x2e')](_0x530316[_0x793e('0x2f')],qs[_0x793e('0x30')](_0xfe7fb9[_0x793e('0x2c')]['fields']));_0x4a45ae[_0x793e('0x31')]=_0x4a45ae[_0x793e('0x31')][_0x793e('0x32')]?_0x4a45ae[_0x793e('0x31')]:_0x530316[_0x793e('0x2f')];if(!_0xfe7fb9['query'][_0x793e('0x33')](_0x793e('0x34'))){_0x4a45ae[_0x793e('0x1c')]=qs[_0x793e('0x1c')](_0xfe7fb9[_0x793e('0x2c')][_0x793e('0x1c')]);_0x4a45ae[_0x793e('0x1a')]=qs[_0x793e('0x1a')](_0xfe7fb9['query'][_0x793e('0x1a')]);}_0x4a45ae[_0x793e('0x35')]=qs[_0x793e('0x36')](_0xfe7fb9[_0x793e('0x2c')][_0x793e('0x36')]);_0x4a45ae[_0x793e('0x37')]=qs['filters'](_[_0x793e('0x38')](_0xfe7fb9[_0x793e('0x2c')],_0x530316[_0x793e('0x2d')]),_0x4d1415);if(_0xfe7fb9[_0x793e('0x2c')][_0x793e('0x39')]){_0x4a45ae[_0x793e('0x37')]=_[_0x793e('0x3a')](_0x4a45ae[_0x793e('0x37')],{'$or':_['map'](_0x4d1415,function(_0x3feeba){if(_0x3feeba[_0x793e('0x3b')]!==_0x793e('0x3c')){var _0x284a43={};_0x284a43[_0x3feeba[_0x793e('0x27')]]={'$like':'%'+_0xfe7fb9[_0x793e('0x2c')]['filter']+'%'};return _0x284a43;}})});}_0x4a45ae=_['merge']({},_0x4a45ae,_0xfe7fb9[_0x793e('0x3d')]);var _0x1f1f98={'where':_0x4a45ae[_0x793e('0x37')]};return db[_0x793e('0x3e')][_0x793e('0x1d')](_0x1f1f98)[_0x793e('0x3f')](function(_0x196287){_0xeb38af[_0x793e('0x1d')]=_0x196287;if(_0xfe7fb9[_0x793e('0x2c')][_0x793e('0x40')]){_0x4a45ae[_0x793e('0x41')]=[{'all':!![]}];}return db[_0x793e('0x3e')][_0x793e('0x42')](_0x4a45ae);})[_0x793e('0x3f')](function(_0x388641){_0xeb38af[_0x793e('0x43')]=_0x388641;return _0xeb38af;})[_0x793e('0x3f')](respondWithFilteredResult(_0x48edff,_0x4a45ae))[_0x793e('0x44')](handleError(_0x48edff,null));};exports[_0x793e('0x45')]=function(_0xd0a349,_0x10f99e){var _0x42883d={'raw':![],'where':{'id':_0xd0a349[_0x793e('0x46')]['id']}},_0x36bfb9={};_0x36bfb9['model']=_[_0x793e('0x47')](db['FreshdeskAccount']['rawAttributes']);_0x36bfb9[_0x793e('0x2c')]=_[_0x793e('0x47')](_0xd0a349[_0x793e('0x2c')]);_0x36bfb9[_0x793e('0x2d')]=_[_0x793e('0x2e')](_0x36bfb9[_0x793e('0x2f')],_0x36bfb9[_0x793e('0x2c')]);_0x42883d[_0x793e('0x31')]=_[_0x793e('0x2e')](_0x36bfb9['model'],qs['fields'](_0xd0a349[_0x793e('0x2c')][_0x793e('0x30')]));_0x42883d[_0x793e('0x31')]=_0x42883d[_0x793e('0x31')]['length']?_0x42883d[_0x793e('0x31')]:_0x36bfb9[_0x793e('0x2f')];if(_0xd0a349[_0x793e('0x2c')][_0x793e('0x40')]){_0x42883d['include']=[{'all':!![]}];}_0x42883d=_[_0x793e('0x3a')]({},_0x42883d,_0xd0a349[_0x793e('0x3d')]);return db[_0x793e('0x3e')][_0x793e('0x48')](_0x42883d)[_0x793e('0x3f')](handleEntityNotFound(_0x10f99e,null))['then'](respondWithResult(_0x10f99e,null))['catch'](handleError(_0x10f99e,null));};exports['create']=function(_0x494921,_0x2722d0){return db[_0x793e('0x3e')][_0x793e('0x49')](_0x494921[_0x793e('0x4a')],{})['then'](respondWithResult(_0x2722d0,0xc9))[_0x793e('0x44')](handleError(_0x2722d0,null));};exports[_0x793e('0x23')]=function(_0x112645,_0x5bbabf){if(_0x112645[_0x793e('0x4a')]['id']){delete _0x112645['body']['id'];}return db['FreshdeskAccount'][_0x793e('0x48')]({'where':{'id':_0x112645[_0x793e('0x46')]['id']}})[_0x793e('0x3f')](handleEntityNotFound(_0x5bbabf,null))[_0x793e('0x3f')](saveUpdates(_0x112645['body'],null))[_0x793e('0x3f')](respondWithResult(_0x5bbabf,null))[_0x793e('0x44')](handleError(_0x5bbabf,null));};exports[_0x793e('0x24')]=function(_0x363bf0,_0x488950){return db['FreshdeskAccount']['find']({'where':{'id':_0x363bf0[_0x793e('0x46')]['id']}})[_0x793e('0x3f')](handleEntityNotFound(_0x488950,null))[_0x793e('0x3f')](removeEntity(_0x488950,null))['catch'](handleError(_0x488950,null));};exports[_0x793e('0x4b')]=function(_0x47b465,_0x5c90e3,_0x29abc7){var _0x1306d5={};var _0x3e0380={};var _0x500ee5;var _0x250eb8;return db['FreshdeskAccount'][_0x793e('0x4c')]({'where':{'id':_0x47b465['params']['id']}})['then'](handleEntityNotFound(_0x5c90e3,null))[_0x793e('0x3f')](function(_0x5de1ef){if(_0x5de1ef){_0x500ee5=_0x5de1ef;_0x3e0380[_0x793e('0x2f')]=_['keys'](db[_0x793e('0x4d')]['rawAttributes']);_0x3e0380['query']=_[_0x793e('0x47')](_0x47b465[_0x793e('0x2c')]);_0x3e0380[_0x793e('0x2d')]=_[_0x793e('0x2e')](_0x3e0380[_0x793e('0x2f')],_0x3e0380['query']);_0x1306d5['attributes']=_[_0x793e('0x2e')](_0x3e0380[_0x793e('0x2f')],qs['fields'](_0x47b465[_0x793e('0x2c')][_0x793e('0x30')]));_0x1306d5[_0x793e('0x31')]=_0x1306d5[_0x793e('0x31')][_0x793e('0x32')]?_0x1306d5[_0x793e('0x31')]:_0x3e0380[_0x793e('0x2f')];_0x1306d5['order']=qs[_0x793e('0x36')](_0x47b465[_0x793e('0x2c')]['sort']);_0x1306d5[_0x793e('0x37')]=qs[_0x793e('0x2d')](_[_0x793e('0x38')](_0x47b465[_0x793e('0x2c')],_0x3e0380[_0x793e('0x2d')]));if(_0x47b465[_0x793e('0x2c')][_0x793e('0x39')]){_0x1306d5[_0x793e('0x37')]=_[_0x793e('0x3a')](_0x1306d5['where'],{'$or':_[_0x793e('0x29')](_0x1306d5['attributes'],function(_0x1b23c4){var _0x354126={};_0x354126[_0x1b23c4]={'$like':'%'+_0x47b465[_0x793e('0x2c')][_0x793e('0x39')]+'%'};return _0x354126;})});}_0x1306d5=_['merge']({},_0x1306d5,_0x47b465[_0x793e('0x3d')]);return _0x500ee5['getConfigurations'](_0x1306d5);}})[_0x793e('0x3f')](function(_0xf0a09){if(_0xf0a09){_0x250eb8=_0xf0a09[_0x793e('0x32')];if(!_0x47b465[_0x793e('0x2c')][_0x793e('0x33')](_0x793e('0x34'))){_0x1306d5[_0x793e('0x1c')]=qs['limit'](_0x47b465[_0x793e('0x2c')][_0x793e('0x1c')]);_0x1306d5[_0x793e('0x1a')]=qs[_0x793e('0x1a')](_0x47b465[_0x793e('0x2c')]['offset']);}return _0x500ee5['getConfigurations'](_0x1306d5);}})[_0x793e('0x3f')](function(_0x28bd9f){if(_0x28bd9f){return _0x28bd9f?{'count':_0x250eb8,'rows':_0x28bd9f}:null;}})[_0x793e('0x3f')](respondWithResult(_0x5c90e3,null))[_0x793e('0x44')](handleError(_0x5c90e3,null));};exports[_0x793e('0x4e')]=function(_0x1e2764,_0x2b0e20,_0x112180){if(_0x1e2764[_0x793e('0x4a')]['id']){delete _0x1e2764[_0x793e('0x4a')]['id'];}return db[_0x793e('0x3e')][_0x793e('0x4c')]({'where':{'id':_0x1e2764[_0x793e('0x46')]['id']}})['then'](handleEntityNotFound(_0x2b0e20,null))[_0x793e('0x3f')](function(_0x2e1058){if(_0x2e1058){_0x1e2764[_0x793e('0x4a')][_0x793e('0x4f')]=_0x2e1058['id'];_0x1e2764[_0x793e('0x4a')][_0x793e('0x50')]=integrations[_0x793e('0x51')](_0x1e2764[_0x793e('0x4a')][_0x793e('0x52')],_0x1e2764['body'][_0x793e('0x3b')]);_0x1e2764[_0x793e('0x4a')][_0x793e('0x53')]=integrations[_0x793e('0x54')](_0x1e2764[_0x793e('0x4a')][_0x793e('0x52')],_0x1e2764[_0x793e('0x4a')][_0x793e('0x3b')]);return db[_0x793e('0x4d')][_0x793e('0x49')](_0x1e2764[_0x793e('0x4a')],{'include':[{'model':db[_0x793e('0x55')],'as':_0x793e('0x50')},{'model':db[_0x793e('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2b0e20,null))[_0x793e('0x44')](handleError(_0x2b0e20,null));};exports['getFields']=function(_0x5d1af7,_0x315981,_0x10cb95){var _0x2ab9a0='';return db[_0x793e('0x3e')][_0x793e('0x4c')]({'where':{'id':_0x5d1af7['params']['id']},'attributes':['id',_0x793e('0x56'),'apiKey']})['then'](handleEntityNotFound(_0x315981,null))[_0x793e('0x3f')](function(_0x50eac0){if(_0x50eac0){_0x2ab9a0=_0x50eac0[_0x793e('0x56')];var _0x42472a=_0x2ab9a0[_0x793e('0x57')](-0x1);if(_0x42472a==='/'){_0x2ab9a0=_0x2ab9a0[_0x793e('0x58')](0x0,_0x2ab9a0[_0x793e('0x59')](_0x42472a));}return rp({'method':_0x793e('0x5a'),'uri':util[_0x793e('0x5b')](_0x793e('0x5c'),_0x2ab9a0,_0x793e('0x5d')),'headers':{'Authorization':util[_0x793e('0x5b')](_0x793e('0x5e'),new Buffer(util['format'](_0x793e('0x5f'),_0x50eac0[_0x793e('0x60')]))[_0x793e('0x61')]('base64'))},'json':!![]});}})[_0x793e('0x3f')](function(_0x2df2f7){if(_0x2df2f7){var _0x1c18bd=['requester',_0x793e('0x62'),_0x793e('0x63'),_0x793e('0x64'),'status',_0x793e('0x65'),'group','source','ticket_type','group','company'];_[_0x793e('0x66')](_0x2df2f7,function(_0x59e0d3){return _0x1c18bd['includes'](_0x59e0d3[_0x793e('0x27')])||!_0x59e0d3['default']&&_0x59e0d3[_0x793e('0x3b')]!==_0x793e('0x67')&&_0x59e0d3['type']!==_0x793e('0x68');});return{'count':_0x2df2f7['length'],'rows':_['map'](_0x2df2f7,function(_0x504fe7){return{'id':_0x504fe7[_0x793e('0x27')],'name':_0x504fe7[_0x793e('0x69')],'custom':!_0x504fe7['default'],'options':_0x504fe7[_0x793e('0x6a')]?_[_0x793e('0x29')](_0x504fe7[_0x793e('0x6a')],function(_0xb6c308){return{'name':_[_0x793e('0x6b')](_0xb6c308),'value':_0xb6c308};}):[]};})};}})[_0x793e('0x3f')](respondWithResult(_0x315981,null))[_0x793e('0x44')](function(_0x1cb659){var _0x392574=_0x5d1af7[_0x793e('0x2c')][_0x793e('0x6c')]?0x1f4:_0x1cb659[_0x793e('0x6d')]||0x1f4;logger['error'](_0x793e('0x6e'),_0x793e('0x6f'),_0x392574,JSON[_0x793e('0x70')](_0x1cb659));delete _0x1cb659[_0x793e('0x27')];if(_0x392574===0x191){_0x392574=0x190;}_0x315981[_0x793e('0x17')](_0x392574)['send'](_0x5d1af7['query'][_0x793e('0x6c')]?{'message':_0x793e('0x71'),'statusCode':_0x1cb659[_0x793e('0x6d')]}:_0x1cb659);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 4cd472d..5563bae 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 _0x2ae5=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x39af72,_0x1c1bf9){var _0x55e6e3=function(_0x45d571){while(--_0x45d571){_0x39af72['push'](_0x39af72['shift']());}};_0x55e6e3(++_0x1c1bf9);}(_0x2ae5,0x1b2));var _0x52ae=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x2ae5[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x52ae('0x0'));var util=require('util');var logger=require(_0x52ae('0x1'))(_0x52ae('0x2'));var moment=require(_0x52ae('0x3'));var BPromise=require(_0x52ae('0x4'));var rp=require(_0x52ae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52ae('0x6'));var config=require(_0x52ae('0x7'));var attributes=require(_0x52ae('0x8'));var integrations=require(_0x52ae('0x9'));module[_0x52ae('0xa')]=function(_0x4ca260,_0x161c9b){return _0x4ca260['define'](_0x52ae('0xb'),attributes,{'tableName':_0x52ae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8909=['lodash','util','bluebird','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x4ee448,_0x3864e7){var _0x46c835=function(_0x4892b3){while(--_0x4892b3){_0x4ee448['push'](_0x4ee448['shift']());}};_0x46c835(++_0x3864e7);}(_0x8909,0x15e));var _0x9890=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0x8909[_0x4e783c];return _0x2fbd6d;};'use strict';var _=require(_0x9890('0x0'));var util=require(_0x9890('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9890('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9890('0x3'));var config=require(_0x9890('0x4'));var attributes=require(_0x9890('0x5'));var integrations=require(_0x9890('0x6'));module['exports']=function(_0x282d32,_0x430c96){return _0x282d32[_0x9890('0x7')](_0x9890('0x8'),attributes,{'tableName':_0x9890('0x9'),'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 3b8fc1f..d20f0a4 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 _0x0642=['error','code','message','request\x20sent','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','debug','find','ShowFreshdeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x0642,0x1dc));var _0x2064=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0x0642[_0x26da89];return _0xc95b7b;};'use strict';var _=require(_0x2064('0x0'));var util=require('util');var moment=require(_0x2064('0x1'));var BPromise=require(_0x2064('0x2'));var rs=require(_0x2064('0x3'));var fs=require('fs');var Redis=require(_0x2064('0x4'));var db=require(_0x2064('0x5'))['db'];var utils=require(_0x2064('0x6'));var logger=require(_0x2064('0x7'))(_0x2064('0x8'));var config=require('../../config/environment');var jayson=require(_0x2064('0x9'));var client=jayson[_0x2064('0xa')][_0x2064('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x397297,_0x13df9d,_0x39dc5b){return new BPromise(function(_0x507929,_0x351905){return client[_0x2064('0xc')](_0x397297,_0x39dc5b)[_0x2064('0xd')](function(_0x87a83e){logger[_0x2064('0xe')](_0x2064('0xf'),_0x13df9d,'request\x20sent');logger['debug'](_0x2064('0x10'),_0x13df9d,'request\x20sent',JSON[_0x2064('0x11')](_0x87a83e));if(_0x87a83e[_0x2064('0x12')]){if(_0x87a83e[_0x2064('0x12')][_0x2064('0x13')]===0x1f4){logger[_0x2064('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x13df9d,_0x87a83e['error'][_0x2064('0x14')]);return _0x351905(_0x87a83e[_0x2064('0x12')]['message']);}logger[_0x2064('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x13df9d,_0x87a83e[_0x2064('0x12')]['message']);return _0x507929(_0x87a83e[_0x2064('0x12')]['message']);}else{logger[_0x2064('0xe')](_0x2064('0xf'),_0x13df9d,_0x2064('0x15'));_0x507929(_0x87a83e[_0x2064('0x16')][_0x2064('0x14')]);}})[_0x2064('0x17')](function(_0x8ed40b){logger['error'](_0x2064('0xf'),_0x13df9d,_0x8ed40b);_0x351905(_0x8ed40b);});});}exports[_0x2064('0x18')]=function(_0x3b4f29){var _0x2e0687=this;return new Promise(function(_0x4dda78,_0x542f11){return db[_0x2064('0x19')][_0x2064('0x1a')]({'raw':_0x3b4f29[_0x2064('0x1b')]?_0x3b4f29[_0x2064('0x1b')][_0x2064('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b4f29['options']?_0x3b4f29['options'][_0x2064('0x1d')]||null:null,'attributes':_0x3b4f29[_0x2064('0x1b')]?_0x3b4f29['options'][_0x2064('0x1e')]||null:null,'limit':_0x3b4f29[_0x2064('0x1b')]?_0x3b4f29['options'][_0x2064('0x1f')]||null:null,'include':_0x3b4f29[_0x2064('0x1b')]?_0x3b4f29[_0x2064('0x1b')][_0x2064('0x20')]?_['map'](_0x3b4f29[_0x2064('0x1b')][_0x2064('0x20')],function(_0x224711){return{'model':db[_0x224711[_0x2064('0x21')]],'as':_0x224711['as'],'attributes':_0x224711[_0x2064('0x1e')],'include':_0x224711[_0x2064('0x20')]?_[_0x2064('0x22')](_0x224711['include'],function(_0x1c1f25){return{'model':db[_0x1c1f25[_0x2064('0x21')]],'as':_0x1c1f25['as'],'attributes':_0x1c1f25[_0x2064('0x1e')],'include':_0x1c1f25[_0x2064('0x20')]?_[_0x2064('0x22')](_0x1c1f25[_0x2064('0x20')],function(_0xa679ab){return{'model':db[_0xa679ab[_0x2064('0x21')]],'as':_0xa679ab['as'],'attributes':_0xa679ab[_0x2064('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2064('0xd')](function(_0x3d8ce9){logger['info'](_0x2064('0x18'),_0x3b4f29);logger[_0x2064('0x23')](_0x2064('0x18'),_0x3b4f29,JSON[_0x2064('0x11')](_0x3d8ce9));_0x4dda78(_0x3d8ce9);})[_0x2064('0x17')](function(_0x57d0c8){logger[_0x2064('0x12')](_0x2064('0x18'),_0x57d0c8[_0x2064('0x14')],_0x3b4f29);_0x542f11(_0x2e0687[_0x2064('0x12')](0x1f4,_0x57d0c8[_0x2064('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0x4f09b1){var _0x13f27e=this;return new Promise(function(_0x2ddedf,_0x22749e){return db[_0x2064('0x19')][_0x2064('0x24')]({'raw':_0x4f09b1[_0x2064('0x1b')]?_0x4f09b1[_0x2064('0x1b')][_0x2064('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f09b1[_0x2064('0x1b')]?_0x4f09b1[_0x2064('0x1b')][_0x2064('0x1d')]||null:null,'attributes':_0x4f09b1['options']?_0x4f09b1[_0x2064('0x1b')][_0x2064('0x1e')]||null:null,'include':_0x4f09b1[_0x2064('0x1b')]?_0x4f09b1[_0x2064('0x1b')][_0x2064('0x20')]?_[_0x2064('0x22')](_0x4f09b1['options']['include'],function(_0x1697f8){return{'model':db[_0x1697f8['model']],'as':_0x1697f8['as'],'attributes':_0x1697f8[_0x2064('0x1e')],'include':_0x1697f8[_0x2064('0x20')]?_[_0x2064('0x22')](_0x1697f8[_0x2064('0x20')],function(_0x3b00fb){return{'model':db[_0x3b00fb[_0x2064('0x21')]],'as':_0x3b00fb['as'],'attributes':_0x3b00fb['attributes'],'include':_0x3b00fb[_0x2064('0x20')]?_['map'](_0x3b00fb[_0x2064('0x20')],function(_0x4679dd){return{'model':db[_0x4679dd['model']],'as':_0x4679dd['as'],'attributes':_0x4679dd[_0x2064('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2064('0xd')](function(_0x343c31){logger['info']('ShowFreshdeskAccount',_0x4f09b1);logger[_0x2064('0x23')](_0x2064('0x25'),_0x4f09b1,JSON['stringify'](_0x343c31));_0x2ddedf(_0x343c31);})[_0x2064('0x17')](function(_0x5c9a7b){logger[_0x2064('0x12')](_0x2064('0x25'),_0x5c9a7b[_0x2064('0x14')],_0x4f09b1);_0x22749e(_0x13f27e[_0x2064('0x12')](0x1f4,_0x5c9a7b[_0x2064('0x14')]));});});}; \ No newline at end of file +var _0xc641=['options','where','attributes','include','map','model','debug','catch','ShowFreshdeskAccount','FreshdeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetFreshdeskAccount','findAll'];(function(_0x61b3ab,_0x1fc298){var _0x57097f=function(_0x25970b){while(--_0x25970b){_0x61b3ab['push'](_0x61b3ab['shift']());}};_0x57097f(++_0x1fc298);}(_0xc641,0xea));var _0x1c64=function(_0x503100,_0x131748){_0x503100=_0x503100-0x0;var _0x295869=_0xc641[_0x503100];return _0x295869;};'use strict';var _=require(_0x1c64('0x0'));var util=require(_0x1c64('0x1'));var moment=require(_0x1c64('0x2'));var BPromise=require(_0x1c64('0x3'));var rs=require(_0x1c64('0x4'));var fs=require('fs');var Redis=require(_0x1c64('0x5'));var db=require(_0x1c64('0x6'))['db'];var utils=require(_0x1c64('0x7'));var logger=require(_0x1c64('0x8'))(_0x1c64('0x9'));var config=require(_0x1c64('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1c64('0xb')][_0x1c64('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc454fd,_0x493243,_0x2a15ac){return new BPromise(function(_0x5a5b06,_0x36a9e6){return client[_0x1c64('0xd')](_0xc454fd,_0x2a15ac)[_0x1c64('0xe')](function(_0xa92d83){logger[_0x1c64('0xf')](_0x1c64('0x10'),_0x493243,'request\x20sent');logger['debug'](_0x1c64('0x11'),_0x493243,_0x1c64('0x12'),JSON[_0x1c64('0x13')](_0xa92d83));if(_0xa92d83[_0x1c64('0x14')]){if(_0xa92d83[_0x1c64('0x14')]['code']===0x1f4){logger[_0x1c64('0x14')](_0x1c64('0x10'),_0x493243,_0xa92d83[_0x1c64('0x14')]['message']);return _0x36a9e6(_0xa92d83[_0x1c64('0x14')][_0x1c64('0x15')]);}logger[_0x1c64('0x14')](_0x1c64('0x10'),_0x493243,_0xa92d83[_0x1c64('0x14')][_0x1c64('0x15')]);return _0x5a5b06(_0xa92d83[_0x1c64('0x14')][_0x1c64('0x15')]);}else{logger['info'](_0x1c64('0x10'),_0x493243,_0x1c64('0x12'));_0x5a5b06(_0xa92d83[_0x1c64('0x16')][_0x1c64('0x15')]);}})['catch'](function(_0x480e99){logger[_0x1c64('0x14')](_0x1c64('0x10'),_0x493243,_0x480e99);_0x36a9e6(_0x480e99);});});}exports[_0x1c64('0x17')]=function(_0x512af5){var _0x4e6d44=this;return new Promise(function(_0x3a526a,_0x2d66d3){return db['FreshdeskAccount'][_0x1c64('0x18')]({'raw':_0x512af5[_0x1c64('0x19')]?_0x512af5[_0x1c64('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x512af5[_0x1c64('0x19')]?_0x512af5[_0x1c64('0x19')][_0x1c64('0x1a')]||null:null,'attributes':_0x512af5['options']?_0x512af5[_0x1c64('0x19')][_0x1c64('0x1b')]||null:null,'limit':_0x512af5['options']?_0x512af5[_0x1c64('0x19')]['limit']||null:null,'include':_0x512af5[_0x1c64('0x19')]?_0x512af5[_0x1c64('0x19')][_0x1c64('0x1c')]?_[_0x1c64('0x1d')](_0x512af5[_0x1c64('0x19')]['include'],function(_0x464d3e){return{'model':db[_0x464d3e[_0x1c64('0x1e')]],'as':_0x464d3e['as'],'attributes':_0x464d3e[_0x1c64('0x1b')],'include':_0x464d3e[_0x1c64('0x1c')]?_['map'](_0x464d3e[_0x1c64('0x1c')],function(_0x5f3dcd){return{'model':db[_0x5f3dcd[_0x1c64('0x1e')]],'as':_0x5f3dcd['as'],'attributes':_0x5f3dcd['attributes'],'include':_0x5f3dcd['include']?_[_0x1c64('0x1d')](_0x5f3dcd[_0x1c64('0x1c')],function(_0x4a5a78){return{'model':db[_0x4a5a78['model']],'as':_0x4a5a78['as'],'attributes':_0x4a5a78['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c64('0xe')](function(_0x64e8ae){logger['info'](_0x1c64('0x17'),_0x512af5);logger[_0x1c64('0x1f')](_0x1c64('0x17'),_0x512af5,JSON[_0x1c64('0x13')](_0x64e8ae));_0x3a526a(_0x64e8ae);})[_0x1c64('0x20')](function(_0x42bafe){logger[_0x1c64('0x14')]('GetFreshdeskAccount',_0x42bafe[_0x1c64('0x15')],_0x512af5);_0x2d66d3(_0x4e6d44[_0x1c64('0x14')](0x1f4,_0x42bafe['message']));});});};exports[_0x1c64('0x21')]=function(_0x57841d){var _0x3a734d=this;return new Promise(function(_0x4946af,_0x502661){return db[_0x1c64('0x22')][_0x1c64('0x23')]({'raw':_0x57841d[_0x1c64('0x19')]?_0x57841d[_0x1c64('0x19')][_0x1c64('0x24')]===undefined?!![]:![]:!![],'where':_0x57841d[_0x1c64('0x19')]?_0x57841d['options'][_0x1c64('0x1a')]||null:null,'attributes':_0x57841d[_0x1c64('0x19')]?_0x57841d['options'][_0x1c64('0x1b')]||null:null,'include':_0x57841d[_0x1c64('0x19')]?_0x57841d[_0x1c64('0x19')][_0x1c64('0x1c')]?_['map'](_0x57841d[_0x1c64('0x19')][_0x1c64('0x1c')],function(_0x3dc84b){return{'model':db[_0x3dc84b[_0x1c64('0x1e')]],'as':_0x3dc84b['as'],'attributes':_0x3dc84b[_0x1c64('0x1b')],'include':_0x3dc84b['include']?_[_0x1c64('0x1d')](_0x3dc84b[_0x1c64('0x1c')],function(_0x183d87){return{'model':db[_0x183d87[_0x1c64('0x1e')]],'as':_0x183d87['as'],'attributes':_0x183d87['attributes'],'include':_0x183d87[_0x1c64('0x1c')]?_[_0x1c64('0x1d')](_0x183d87[_0x1c64('0x1c')],function(_0x140ea9){return{'model':db[_0x140ea9[_0x1c64('0x1e')]],'as':_0x140ea9['as'],'attributes':_0x140ea9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c9c7b){logger[_0x1c64('0xf')](_0x1c64('0x21'),_0x57841d);logger[_0x1c64('0x1f')](_0x1c64('0x21'),_0x57841d,JSON[_0x1c64('0x13')](_0x3c9c7b));_0x4946af(_0x3c9c7b);})['catch'](function(_0x5b32bc){logger[_0x1c64('0x14')](_0x1c64('0x21'),_0x5b32bc[_0x1c64('0x15')],_0x57841d);_0x502661(_0x3a734d[_0x1c64('0x14')](0x1f4,_0x5b32bc[_0x1c64('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 9e0cc32..bf0c3a2 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 _0xa29f=['getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields'];(function(_0x39aeb2,_0x586cfe){var _0x36a6dd=function(_0x417eea){while(--_0x417eea){_0x39aeb2['push'](_0x39aeb2['shift']());}};_0x36a6dd(++_0x586cfe);}(_0xa29f,0xb5));var _0xfa29=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0xa29f[_0x49a57c];return _0x4e0316;};'use strict';var multer=require(_0xfa29('0x0'));var util=require(_0xfa29('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa29('0x2')]();var fs_extra=require(_0xfa29('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfa29('0x4'));var config=require('../../config/environment');var controller=require(_0xfa29('0x5'));router[_0xfa29('0x6')]('/',auth['isAuthenticated'](),controller[_0xfa29('0x7')]);router['get'](_0xfa29('0x8'),auth[_0xfa29('0x9')](),controller['show']);router[_0xfa29('0x6')](_0xfa29('0xa'),auth[_0xfa29('0x9')](),controller[_0xfa29('0xb')]);router[_0xfa29('0x6')](_0xfa29('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0xfa29('0xd'),auth['isAuthenticated'](),controller[_0xfa29('0xe')]);router[_0xfa29('0x6')](_0xfa29('0xf'),auth[_0xfa29('0x9')](),controller[_0xfa29('0x10')]);router[_0xfa29('0x11')]('/',auth[_0xfa29('0x9')](),controller[_0xfa29('0x12')]);router['post'](_0xfa29('0xf'),auth['isAuthenticated'](),controller[_0xfa29('0x13')]);router[_0xfa29('0x14')](_0xfa29('0x8'),auth[_0xfa29('0x9')](),controller[_0xfa29('0x15')]);router['delete'](_0xfa29('0x8'),auth[_0xfa29('0x9')](),controller[_0xfa29('0x16')]);module[_0xfa29('0x17')]=router; \ No newline at end of file +var _0x65ea=['../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','create','post','setTags','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x47534d,_0x59f6d7){var _0x36035f=function(_0x2f0de2){while(--_0x2f0de2){_0x47534d['push'](_0x47534d['shift']());}};_0x36035f(++_0x59f6d7);}(_0x65ea,0x8d));var _0xa65e=function(_0x9d8269,_0x3d3e68){_0x9d8269=_0x9d8269-0x0;var _0x2d72da=_0x65ea[_0x9d8269];return _0x2d72da;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa65e('0x0'));var timeout=require(_0xa65e('0x1'));var express=require(_0xa65e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa65e('0x3'));var interaction=require(_0xa65e('0x4'));var config=require('../../config/environment');var controller=require(_0xa65e('0x5'));router[_0xa65e('0x6')]('/',auth['isAuthenticated'](),controller[_0xa65e('0x7')]);router[_0xa65e('0x6')](_0xa65e('0x8'),auth[_0xa65e('0x9')](),controller[_0xa65e('0xa')]);router[_0xa65e('0x6')](_0xa65e('0xb'),auth[_0xa65e('0x9')](),controller[_0xa65e('0xc')]);router[_0xa65e('0x6')](_0xa65e('0xd'),auth[_0xa65e('0x9')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xa65e('0x9')](),controller[_0xa65e('0xe')]);router['get'](_0xa65e('0xf'),auth[_0xa65e('0x9')](),controller[_0xa65e('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa65e('0x11')]);router[_0xa65e('0x12')](_0xa65e('0xf'),auth[_0xa65e('0x9')](),controller[_0xa65e('0x13')]);router['put'](_0xa65e('0x8'),auth[_0xa65e('0x9')](),controller[_0xa65e('0x14')]);router[_0xa65e('0x15')](_0xa65e('0x8'),auth[_0xa65e('0x9')](),controller[_0xa65e('0x16')]);module[_0xa65e('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index b4a9432..b4236f3 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 _0xaf90=['sequelize','exports','STRING'];(function(_0x26f71c,_0x5df3dd){var _0x1aa55e=function(_0x1b63b9){while(--_0x1b63b9){_0x26f71c['push'](_0x26f71c['shift']());}};_0x1aa55e(++_0x5df3dd);}(_0xaf90,0x13b));var _0x0af9=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xaf90[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x0af9('0x0'));module[_0x0af9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0af9('0x2')]}}; \ No newline at end of file +var _0x6739=['STRING','sequelize','exports'];(function(_0x282a73,_0x4297e1){var _0x4e415b=function(_0x312c32){while(--_0x312c32){_0x282a73['push'](_0x282a73['shift']());}};_0x4e415b(++_0x4297e1);}(_0x6739,0xd6));var _0x9673=function(_0x3e2a65,_0x239b40){_0x3e2a65=_0x3e2a65-0x0;var _0x2706df=_0x6739[_0x3e2a65];return _0x2706df;};'use strict';var Sequelize=require(_0x9673('0x0'));module[_0x9673('0x1')]={'name':{'type':Sequelize[_0x9673('0x2')]},'description':{'type':Sequelize[_0x9673('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index f14025b..388a29c 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 _0xc7b0=['ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','FreshdeskConfiguration','find','create','body','params','findOne','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x230249,_0x27c009){var _0x4f6e0b=function(_0x50d266){while(--_0x50d266){_0x230249['push'](_0x230249['shift']());}};_0x4f6e0b(++_0x27c009);}(_0xc7b0,0x98));var _0x0c7b=function(_0x5066e4,_0x505797){_0x5066e4=_0x5066e4-0x0;var _0x2b73c6=_0xc7b0[_0x5066e4];return _0x2b73c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c7b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c7b('0x1'));var rp=require(_0x0c7b('0x2'));var moment=require(_0x0c7b('0x3'));var BPromise=require(_0x0c7b('0x4'));var Mustache=require(_0x0c7b('0x5'));var util=require(_0x0c7b('0x6'));var path=require(_0x0c7b('0x7'));var sox=require(_0x0c7b('0x8'));var csv=require(_0x0c7b('0x9'));var ejs=require(_0x0c7b('0xa'));var fs=require('fs');var fs_extra=require(_0x0c7b('0xb'));var _=require(_0x0c7b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0c7b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0c7b('0x9'));var querystring=require(_0x0c7b('0xe'));var Papa=require(_0x0c7b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0c7b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c7b('0x11'))(_0x0c7b('0x12'));var utils=require(_0x0c7b('0x13'));var config=require(_0x0c7b('0x14'));var licenseUtil=require(_0x0c7b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x350e4e,_0x2bf1a6){_0x2bf1a6=_0x2bf1a6||0xcc;return function(_0x4db5cc){if(_0x4db5cc){return _0x350e4e[_0x0c7b('0x16')](_0x2bf1a6);}return _0x350e4e['status'](_0x2bf1a6)[_0x0c7b('0x17')]();};}function respondWithResult(_0x57d7b8,_0x49965c){_0x49965c=_0x49965c||0xc8;return function(_0x39aa94){if(_0x39aa94){return _0x57d7b8[_0x0c7b('0x18')](_0x49965c)['json'](_0x39aa94);}};}function respondWithFilteredResult(_0x489495,_0x2e4762){return function(_0x3a9b72){if(_0x3a9b72){var _0x592799=typeof _0x2e4762['offset']===_0x0c7b('0x19')&&typeof _0x2e4762[_0x0c7b('0x1a')]===_0x0c7b('0x19');var _0x598f54=_0x3a9b72[_0x0c7b('0x1b')];var _0x421adb=_0x592799?0x0:_0x2e4762[_0x0c7b('0x1c')];var _0x4467bb=_0x592799?_0x3a9b72['count']:_0x2e4762[_0x0c7b('0x1c')]+_0x2e4762[_0x0c7b('0x1a')];var _0xf6dc75;if(_0x4467bb>=_0x598f54){_0x4467bb=_0x598f54;_0xf6dc75=0xc8;}else{_0xf6dc75=0xce;}_0x489495[_0x0c7b('0x18')](_0xf6dc75);return _0x489495[_0x0c7b('0x1d')](_0x0c7b('0x1e'),_0x421adb+'-'+_0x4467bb+'/'+_0x598f54)['json'](_0x3a9b72);}return null;};}function patchUpdates(_0xf6ab64){return function(_0x19d4b9){try{jsonpatch[_0x0c7b('0x1f')](_0x19d4b9,_0xf6ab64,!![]);}catch(_0x819f61){return BPromise[_0x0c7b('0x20')](_0x819f61);}return _0x19d4b9[_0x0c7b('0x21')]();};}function saveUpdates(_0x12257f,_0x259a50){return function(_0x4ca292){if(_0x4ca292){return _0x4ca292[_0x0c7b('0x22')](_0x12257f)[_0x0c7b('0x23')](function(_0x38f060){return _0x38f060;});}return null;};}function removeEntity(_0x6c3857,_0xf0965b){return function(_0x4300a0){if(_0x4300a0){return _0x4300a0[_0x0c7b('0x24')]()[_0x0c7b('0x23')](function(){_0x6c3857[_0x0c7b('0x18')](0xcc)[_0x0c7b('0x17')]();});}};}function handleEntityNotFound(_0x43315d,_0x5cdcfd){return function(_0x1bdcf7){if(!_0x1bdcf7){_0x43315d[_0x0c7b('0x16')](0x194);}return _0x1bdcf7;};}function handleError(_0xb3e29a,_0x5d146c){_0x5d146c=_0x5d146c||0x1f4;return function(_0x124967){logger[_0x0c7b('0x25')](_0x124967[_0x0c7b('0x26')]);if(_0x124967[_0x0c7b('0x27')]){delete _0x124967[_0x0c7b('0x27')];}_0xb3e29a['status'](_0x5d146c)['send'](_0x124967);};}exports[_0x0c7b('0x28')]=function(_0x47f796,_0x560163){var _0xc9838a={},_0x2eec2d={},_0x46763f={'count':0x0,'rows':[]};var _0x4459ae=_['map'](db['FreshdeskConfiguration'][_0x0c7b('0x29')],function(_0x3c2fc7){return{'name':_0x3c2fc7['fieldName'],'type':_0x3c2fc7[_0x0c7b('0x2a')][_0x0c7b('0x2b')]};});_0x2eec2d[_0x0c7b('0x2c')]=_['map'](_0x4459ae,'name');_0x2eec2d[_0x0c7b('0x2d')]=_[_0x0c7b('0x2e')](_0x47f796[_0x0c7b('0x2d')]);_0x2eec2d['filters']=_[_0x0c7b('0x2f')](_0x2eec2d[_0x0c7b('0x2c')],_0x2eec2d['query']);_0xc9838a[_0x0c7b('0x30')]=_[_0x0c7b('0x2f')](_0x2eec2d[_0x0c7b('0x2c')],qs[_0x0c7b('0x31')](_0x47f796['query'][_0x0c7b('0x31')]));_0xc9838a['attributes']=_0xc9838a[_0x0c7b('0x30')][_0x0c7b('0x32')]?_0xc9838a[_0x0c7b('0x30')]:_0x2eec2d[_0x0c7b('0x2c')];if(!_0x47f796[_0x0c7b('0x2d')][_0x0c7b('0x33')](_0x0c7b('0x34'))){_0xc9838a['limit']=qs[_0x0c7b('0x1a')](_0x47f796[_0x0c7b('0x2d')][_0x0c7b('0x1a')]);_0xc9838a[_0x0c7b('0x1c')]=qs[_0x0c7b('0x1c')](_0x47f796[_0x0c7b('0x2d')][_0x0c7b('0x1c')]);}_0xc9838a[_0x0c7b('0x35')]=qs[_0x0c7b('0x36')](_0x47f796['query'][_0x0c7b('0x36')]);_0xc9838a[_0x0c7b('0x37')]=qs['filters'](_[_0x0c7b('0x38')](_0x47f796[_0x0c7b('0x2d')],_0x2eec2d[_0x0c7b('0x39')]),_0x4459ae);if(_0x47f796[_0x0c7b('0x2d')][_0x0c7b('0x3a')]){_0xc9838a[_0x0c7b('0x37')]=_[_0x0c7b('0x3b')](_0xc9838a[_0x0c7b('0x37')],{'$or':_[_0x0c7b('0x3c')](_0x4459ae,function(_0x520cb9){if(_0x520cb9[_0x0c7b('0x2a')]!==_0x0c7b('0x3d')){var _0x3280da={};_0x3280da[_0x520cb9[_0x0c7b('0x27')]]={'$like':'%'+_0x47f796[_0x0c7b('0x2d')][_0x0c7b('0x3a')]+'%'};return _0x3280da;}})});}_0xc9838a=_['merge']({},_0xc9838a,_0x47f796[_0x0c7b('0x3e')]);var _0x5dce50={'where':_0xc9838a['where']};return db['FreshdeskConfiguration'][_0x0c7b('0x1b')](_0x5dce50)[_0x0c7b('0x23')](function(_0x57aace){_0x46763f[_0x0c7b('0x1b')]=_0x57aace;if(_0x47f796[_0x0c7b('0x2d')]['includeAll']){_0xc9838a[_0x0c7b('0x3f')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x0c7b('0x40')](_0xc9838a);})[_0x0c7b('0x23')](function(_0x2d04ee){_0x46763f[_0x0c7b('0x41')]=_0x2d04ee;return _0x46763f;})[_0x0c7b('0x23')](respondWithFilteredResult(_0x560163,_0xc9838a))[_0x0c7b('0x42')](handleError(_0x560163,null));};exports[_0x0c7b('0x43')]=function(_0x584959,_0xb7bbd2){var _0x1e370c={'raw':![],'where':{'id':_0x584959['params']['id']}},_0x5f46bf={};_0x5f46bf[_0x0c7b('0x2c')]=_['keys'](db[_0x0c7b('0x44')][_0x0c7b('0x29')]);_0x5f46bf[_0x0c7b('0x2d')]=_[_0x0c7b('0x2e')](_0x584959['query']);_0x5f46bf[_0x0c7b('0x39')]=_['intersection'](_0x5f46bf[_0x0c7b('0x2c')],_0x5f46bf['query']);_0x1e370c[_0x0c7b('0x30')]=_[_0x0c7b('0x2f')](_0x5f46bf[_0x0c7b('0x2c')],qs[_0x0c7b('0x31')](_0x584959[_0x0c7b('0x2d')][_0x0c7b('0x31')]));_0x1e370c['attributes']=_0x1e370c['attributes']['length']?_0x1e370c[_0x0c7b('0x30')]:_0x5f46bf[_0x0c7b('0x2c')];if(_0x584959[_0x0c7b('0x2d')]['includeAll']){_0x1e370c['include']=[{'all':!![]}];}_0x1e370c=_[_0x0c7b('0x3b')]({},_0x1e370c,_0x584959[_0x0c7b('0x3e')]);return db[_0x0c7b('0x44')][_0x0c7b('0x45')](_0x1e370c)[_0x0c7b('0x23')](handleEntityNotFound(_0xb7bbd2,null))['then'](respondWithResult(_0xb7bbd2,null))['catch'](handleError(_0xb7bbd2,null));};exports['create']=function(_0x42ba3f,_0x69435e){return db['FreshdeskConfiguration'][_0x0c7b('0x46')](_0x42ba3f[_0x0c7b('0x47')],{})[_0x0c7b('0x23')](respondWithResult(_0x69435e,0xc9))[_0x0c7b('0x42')](handleError(_0x69435e,null));};exports['update']=function(_0xb6fbe1,_0x358213){if(_0xb6fbe1[_0x0c7b('0x47')]['id']){delete _0xb6fbe1[_0x0c7b('0x47')]['id'];}return db[_0x0c7b('0x44')]['find']({'where':{'id':_0xb6fbe1[_0x0c7b('0x48')]['id']}})[_0x0c7b('0x23')](handleEntityNotFound(_0x358213,null))[_0x0c7b('0x23')](saveUpdates(_0xb6fbe1[_0x0c7b('0x47')],null))[_0x0c7b('0x23')](respondWithResult(_0x358213,null))['catch'](handleError(_0x358213,null));};exports[_0x0c7b('0x24')]=function(_0x25cf35,_0x4a1122){return db[_0x0c7b('0x44')][_0x0c7b('0x45')]({'where':{'id':_0x25cf35[_0x0c7b('0x48')]['id']}})['then'](handleEntityNotFound(_0x4a1122,null))[_0x0c7b('0x23')](removeEntity(_0x4a1122,null))[_0x0c7b('0x42')](handleError(_0x4a1122,null));};exports['getFields']=function(_0x34af9a,_0x3bf2db,_0x5993b1){var _0x1892f5={};var _0x201eaa={};var _0x554512;var _0x5749b6;return db[_0x0c7b('0x44')][_0x0c7b('0x49')]({'where':{'id':_0x34af9a[_0x0c7b('0x48')]['id']}})[_0x0c7b('0x23')](handleEntityNotFound(_0x3bf2db,null))[_0x0c7b('0x23')](function(_0x44247f){if(_0x44247f){_0x554512=_0x44247f;_0x201eaa[_0x0c7b('0x2c')]=_[_0x0c7b('0x2e')](db[_0x0c7b('0x4a')]['rawAttributes']);_0x201eaa['query']=_['keys'](_0x34af9a[_0x0c7b('0x2d')]);_0x201eaa[_0x0c7b('0x39')]=_[_0x0c7b('0x2f')](_0x201eaa['model'],_0x201eaa[_0x0c7b('0x2d')]);_0x1892f5[_0x0c7b('0x30')]=_['intersection'](_0x201eaa[_0x0c7b('0x2c')],qs[_0x0c7b('0x31')](_0x34af9a[_0x0c7b('0x2d')]['fields']));_0x1892f5[_0x0c7b('0x30')]=_0x1892f5['attributes'][_0x0c7b('0x32')]?_0x1892f5[_0x0c7b('0x30')]:_0x201eaa['model'];_0x1892f5[_0x0c7b('0x35')]=qs['sort'](_0x34af9a['query'][_0x0c7b('0x36')]);_0x1892f5[_0x0c7b('0x37')]=qs['filters'](_[_0x0c7b('0x38')](_0x34af9a[_0x0c7b('0x2d')],_0x201eaa['filters']));if(_0x34af9a[_0x0c7b('0x2d')][_0x0c7b('0x3a')]){_0x1892f5['where']=_[_0x0c7b('0x3b')](_0x1892f5['where'],{'$or':_[_0x0c7b('0x3c')](_0x1892f5[_0x0c7b('0x30')],function(_0x564c48){var _0x534a24={};_0x534a24[_0x564c48]={'$like':'%'+_0x34af9a[_0x0c7b('0x2d')]['filter']+'%'};return _0x534a24;})});}_0x1892f5=_['merge']({},_0x1892f5,_0x34af9a[_0x0c7b('0x3e')]);return _0x554512['getFields'](_0x1892f5);}})['then'](function(_0xef382a){if(_0xef382a){_0x5749b6=_0xef382a['length'];if(!_0x34af9a[_0x0c7b('0x2d')][_0x0c7b('0x33')](_0x0c7b('0x34'))){_0x1892f5[_0x0c7b('0x1a')]=qs['limit'](_0x34af9a[_0x0c7b('0x2d')][_0x0c7b('0x1a')]);_0x1892f5['offset']=qs[_0x0c7b('0x1c')](_0x34af9a[_0x0c7b('0x2d')][_0x0c7b('0x1c')]);}return _0x554512['getFields'](_0x1892f5);}})[_0x0c7b('0x23')](function(_0x2768e8){if(_0x2768e8){return _0x2768e8?{'count':_0x5749b6,'rows':_0x2768e8}:null;}})[_0x0c7b('0x23')](respondWithResult(_0x3bf2db,null))[_0x0c7b('0x42')](handleError(_0x3bf2db,null));};exports[_0x0c7b('0x4b')]=function(_0x367917,_0x369bf2,_0x1c8454){var _0x27bb81={};var _0x4b21ee={};var _0x47fd91;var _0x371bda;return db['FreshdeskConfiguration'][_0x0c7b('0x49')]({'where':{'id':_0x367917['params']['id']}})['then'](handleEntityNotFound(_0x369bf2,null))['then'](function(_0x525c8c){if(_0x525c8c){_0x47fd91=_0x525c8c;_0x4b21ee[_0x0c7b('0x2c')]=_['keys'](db[_0x0c7b('0x4a')][_0x0c7b('0x29')]);_0x4b21ee[_0x0c7b('0x2d')]=_[_0x0c7b('0x2e')](_0x367917[_0x0c7b('0x2d')]);_0x4b21ee[_0x0c7b('0x39')]=_['intersection'](_0x4b21ee[_0x0c7b('0x2c')],_0x4b21ee[_0x0c7b('0x2d')]);_0x27bb81[_0x0c7b('0x30')]=_[_0x0c7b('0x2f')](_0x4b21ee[_0x0c7b('0x2c')],qs[_0x0c7b('0x31')](_0x367917[_0x0c7b('0x2d')][_0x0c7b('0x31')]));_0x27bb81[_0x0c7b('0x30')]=_0x27bb81['attributes'][_0x0c7b('0x32')]?_0x27bb81[_0x0c7b('0x30')]:_0x4b21ee[_0x0c7b('0x2c')];_0x27bb81[_0x0c7b('0x35')]=qs[_0x0c7b('0x36')](_0x367917[_0x0c7b('0x2d')][_0x0c7b('0x36')]);_0x27bb81[_0x0c7b('0x37')]=qs['filters'](_['pick'](_0x367917['query'],_0x4b21ee[_0x0c7b('0x39')]));if(_0x367917[_0x0c7b('0x2d')][_0x0c7b('0x3a')]){_0x27bb81[_0x0c7b('0x37')]=_[_0x0c7b('0x3b')](_0x27bb81[_0x0c7b('0x37')],{'$or':_[_0x0c7b('0x3c')](_0x27bb81['attributes'],function(_0x1176d9){var _0x240de3={};_0x240de3[_0x1176d9]={'$like':'%'+_0x367917[_0x0c7b('0x2d')]['filter']+'%'};return _0x240de3;})});}_0x27bb81=_[_0x0c7b('0x3b')]({},_0x27bb81,_0x367917[_0x0c7b('0x3e')]);return _0x47fd91[_0x0c7b('0x4b')](_0x27bb81);}})[_0x0c7b('0x23')](function(_0x3abc96){if(_0x3abc96){_0x371bda=_0x3abc96[_0x0c7b('0x32')];if(!_0x367917[_0x0c7b('0x2d')][_0x0c7b('0x33')](_0x0c7b('0x34'))){_0x27bb81[_0x0c7b('0x1a')]=qs[_0x0c7b('0x1a')](_0x367917[_0x0c7b('0x2d')]['limit']);_0x27bb81[_0x0c7b('0x1c')]=qs[_0x0c7b('0x1c')](_0x367917[_0x0c7b('0x2d')][_0x0c7b('0x1c')]);}return _0x47fd91['getSubjects'](_0x27bb81);}})['then'](function(_0x1111c9){if(_0x1111c9){return _0x1111c9?{'count':_0x371bda,'rows':_0x1111c9}:null;}})['then'](respondWithResult(_0x369bf2,null))[_0x0c7b('0x42')](handleError(_0x369bf2,null));};exports['getDescriptions']=function(_0x483304,_0x1b26a3,_0x5e3601){var _0x4ed8de={};var _0x2ff05b={};var _0x693b49;var _0x15f73a;return db[_0x0c7b('0x44')][_0x0c7b('0x49')]({'where':{'id':_0x483304[_0x0c7b('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b26a3,null))['then'](function(_0x5cf940){if(_0x5cf940){_0x693b49=_0x5cf940;_0x2ff05b[_0x0c7b('0x2c')]=_[_0x0c7b('0x2e')](db[_0x0c7b('0x4a')][_0x0c7b('0x29')]);_0x2ff05b[_0x0c7b('0x2d')]=_[_0x0c7b('0x2e')](_0x483304[_0x0c7b('0x2d')]);_0x2ff05b[_0x0c7b('0x39')]=_[_0x0c7b('0x2f')](_0x2ff05b[_0x0c7b('0x2c')],_0x2ff05b[_0x0c7b('0x2d')]);_0x4ed8de[_0x0c7b('0x30')]=_[_0x0c7b('0x2f')](_0x2ff05b[_0x0c7b('0x2c')],qs[_0x0c7b('0x31')](_0x483304[_0x0c7b('0x2d')][_0x0c7b('0x31')]));_0x4ed8de[_0x0c7b('0x30')]=_0x4ed8de['attributes'][_0x0c7b('0x32')]?_0x4ed8de['attributes']:_0x2ff05b[_0x0c7b('0x2c')];_0x4ed8de[_0x0c7b('0x35')]=qs[_0x0c7b('0x36')](_0x483304[_0x0c7b('0x2d')]['sort']);_0x4ed8de[_0x0c7b('0x37')]=qs[_0x0c7b('0x39')](_[_0x0c7b('0x38')](_0x483304[_0x0c7b('0x2d')],_0x2ff05b[_0x0c7b('0x39')]));if(_0x483304[_0x0c7b('0x2d')][_0x0c7b('0x3a')]){_0x4ed8de[_0x0c7b('0x37')]=_[_0x0c7b('0x3b')](_0x4ed8de[_0x0c7b('0x37')],{'$or':_[_0x0c7b('0x3c')](_0x4ed8de['attributes'],function(_0x2a8d8c){var _0x2bd132={};_0x2bd132[_0x2a8d8c]={'$like':'%'+_0x483304['query'][_0x0c7b('0x3a')]+'%'};return _0x2bd132;})});}_0x4ed8de=_[_0x0c7b('0x3b')]({},_0x4ed8de,_0x483304[_0x0c7b('0x3e')]);return _0x693b49[_0x0c7b('0x4c')](_0x4ed8de);}})[_0x0c7b('0x23')](function(_0xc98a8a){if(_0xc98a8a){_0x15f73a=_0xc98a8a[_0x0c7b('0x32')];if(!_0x483304[_0x0c7b('0x2d')]['hasOwnProperty']('nolimit')){_0x4ed8de[_0x0c7b('0x1a')]=qs[_0x0c7b('0x1a')](_0x483304[_0x0c7b('0x2d')][_0x0c7b('0x1a')]);_0x4ed8de[_0x0c7b('0x1c')]=qs[_0x0c7b('0x1c')](_0x483304[_0x0c7b('0x2d')]['offset']);}return _0x693b49[_0x0c7b('0x4c')](_0x4ed8de);}})[_0x0c7b('0x23')](function(_0x5085e3){if(_0x5085e3){return _0x5085e3?{'count':_0x15f73a,'rows':_0x5085e3}:null;}})[_0x0c7b('0x23')](respondWithResult(_0x1b26a3,null))['catch'](handleError(_0x1b26a3,null));};exports['getTags']=function(_0x21a3cc,_0x290062,_0x32088a){var _0x3b03db={};var _0x1ed2b9={};var _0xf6f8ba;var _0x237113;return db[_0x0c7b('0x44')][_0x0c7b('0x49')]({'where':{'id':_0x21a3cc[_0x0c7b('0x48')]['id']}})[_0x0c7b('0x23')](handleEntityNotFound(_0x290062,null))[_0x0c7b('0x23')](function(_0x42a5fe){if(_0x42a5fe){_0xf6f8ba=_0x42a5fe;_0x1ed2b9[_0x0c7b('0x2c')]=_[_0x0c7b('0x2e')](db[_0x0c7b('0x4d')]['rawAttributes']);_0x1ed2b9[_0x0c7b('0x2d')]=_['keys'](_0x21a3cc['query']);_0x1ed2b9[_0x0c7b('0x39')]=_[_0x0c7b('0x2f')](_0x1ed2b9[_0x0c7b('0x2c')],_0x1ed2b9[_0x0c7b('0x2d')]);_0x3b03db[_0x0c7b('0x30')]=_['intersection'](_0x1ed2b9['model'],qs[_0x0c7b('0x31')](_0x21a3cc[_0x0c7b('0x2d')][_0x0c7b('0x31')]));_0x3b03db['attributes']=_0x3b03db[_0x0c7b('0x30')][_0x0c7b('0x32')]?_0x3b03db[_0x0c7b('0x30')]:_0x1ed2b9[_0x0c7b('0x2c')];_0x3b03db[_0x0c7b('0x35')]=qs[_0x0c7b('0x36')](_0x21a3cc[_0x0c7b('0x2d')][_0x0c7b('0x36')]);_0x3b03db['where']=qs['filters'](_['pick'](_0x21a3cc['query'],_0x1ed2b9[_0x0c7b('0x39')]));if(_0x21a3cc['query'][_0x0c7b('0x3a')]){_0x3b03db[_0x0c7b('0x37')]=_[_0x0c7b('0x3b')](_0x3b03db[_0x0c7b('0x37')],{'$or':_[_0x0c7b('0x3c')](_0x3b03db[_0x0c7b('0x30')],function(_0x521ecd){var _0x11c435={};_0x11c435[_0x521ecd]={'$like':'%'+_0x21a3cc[_0x0c7b('0x2d')][_0x0c7b('0x3a')]+'%'};return _0x11c435;})});}_0x3b03db=_[_0x0c7b('0x3b')]({},_0x3b03db,_0x21a3cc[_0x0c7b('0x3e')]);return _0xf6f8ba['getTags'](_0x3b03db);}})[_0x0c7b('0x23')](function(_0x1df0de){if(_0x1df0de){_0x237113=_0x1df0de[_0x0c7b('0x32')];if(!_0x21a3cc[_0x0c7b('0x2d')][_0x0c7b('0x33')](_0x0c7b('0x34'))){_0x3b03db[_0x0c7b('0x1a')]=qs[_0x0c7b('0x1a')](_0x21a3cc[_0x0c7b('0x2d')][_0x0c7b('0x1a')]);_0x3b03db[_0x0c7b('0x1c')]=qs[_0x0c7b('0x1c')](_0x21a3cc['query']['offset']);}return _0xf6f8ba[_0x0c7b('0x4e')](_0x3b03db);}})[_0x0c7b('0x23')](function(_0x1beb98){if(_0x1beb98){return _0x1beb98?{'count':_0x237113,'rows':_0x1beb98}:null;}})['then'](respondWithResult(_0x290062,null))[_0x0c7b('0x42')](handleError(_0x290062,null));};exports[_0x0c7b('0x4f')]=function(_0x3149c1,_0x22328c,_0x8bd60f){if(_0x3149c1[_0x0c7b('0x47')]['id']){delete _0x3149c1[_0x0c7b('0x47')]['id'];}return db[_0x0c7b('0x44')]['findOne']({'where':{'id':_0x3149c1[_0x0c7b('0x48')]['id']}})[_0x0c7b('0x23')](handleEntityNotFound(_0x22328c,null))[_0x0c7b('0x23')](function(_0x1e6ef8){if(_0x1e6ef8){return _0x1e6ef8[_0x0c7b('0x4f')](_0x3149c1[_0x0c7b('0x47')][_0x0c7b('0x50')]||[]);}return null;})[_0x0c7b('0x23')](respondWithResult(_0x22328c,null))[_0x0c7b('0x42')](handleError(_0x22328c,null));}; \ No newline at end of file +var _0x7c41=['../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','show','params','FreshdeskConfiguration','rawAttributes','includeAll','find','catch','create','body','destroy','getFields','FreshdeskField','hasOwnProperty','getSubjects','findOne','options','getDescriptions','getTags','Tag','setTags','ids','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x7c41,0x94));var _0x17c4=function(_0xb02334,_0x509f86){_0xb02334=_0xb02334-0x0;var _0x50e6b2=_0x7c41[_0xb02334];return _0x50e6b2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x17c4('0x0'));var rp=require(_0x17c4('0x1'));var moment=require('moment');var BPromise=require(_0x17c4('0x2'));var Mustache=require(_0x17c4('0x3'));var util=require(_0x17c4('0x4'));var path=require(_0x17c4('0x5'));var sox=require(_0x17c4('0x6'));var csv=require('to-csv');var ejs=require(_0x17c4('0x7'));var fs=require('fs');var fs_extra=require(_0x17c4('0x8'));var _=require('lodash');var squel=require(_0x17c4('0x9'));var crypto=require(_0x17c4('0xa'));var jsforce=require(_0x17c4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x17c4('0xc'));var Redis=require(_0x17c4('0xd'));var authService=require(_0x17c4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x17c4('0xf'));var hardwareService=require(_0x17c4('0x10'));var logger=require(_0x17c4('0x11'))(_0x17c4('0x12'));var utils=require('../../config/utils');var config=require(_0x17c4('0x13'));var licenseUtil=require(_0x17c4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ad46d,_0xca54ec){_0xca54ec=_0xca54ec||0xcc;return function(_0x3912d4){if(_0x3912d4){return _0x4ad46d[_0x17c4('0x15')](_0xca54ec);}return _0x4ad46d[_0x17c4('0x16')](_0xca54ec)[_0x17c4('0x17')]();};}function respondWithResult(_0x3daac9,_0x5c5855){_0x5c5855=_0x5c5855||0xc8;return function(_0x395335){if(_0x395335){return _0x3daac9[_0x17c4('0x16')](_0x5c5855)[_0x17c4('0x18')](_0x395335);}};}function respondWithFilteredResult(_0x5e7576,_0x435bea){return function(_0x15ccd7){if(_0x15ccd7){var _0x8b95a0=typeof _0x435bea[_0x17c4('0x19')]===_0x17c4('0x1a')&&typeof _0x435bea['limit']===_0x17c4('0x1a');var _0x30d598=_0x15ccd7[_0x17c4('0x1b')];var _0xa1f30e=_0x8b95a0?0x0:_0x435bea[_0x17c4('0x19')];var _0x2f1f79=_0x8b95a0?_0x15ccd7[_0x17c4('0x1b')]:_0x435bea[_0x17c4('0x19')]+_0x435bea[_0x17c4('0x1c')];var _0x5aa75a;if(_0x2f1f79>=_0x30d598){_0x2f1f79=_0x30d598;_0x5aa75a=0xc8;}else{_0x5aa75a=0xce;}_0x5e7576[_0x17c4('0x16')](_0x5aa75a);return _0x5e7576[_0x17c4('0x1d')](_0x17c4('0x1e'),_0xa1f30e+'-'+_0x2f1f79+'/'+_0x30d598)[_0x17c4('0x18')](_0x15ccd7);}return null;};}function patchUpdates(_0x5d589){return function(_0x48f92f){try{jsonpatch['apply'](_0x48f92f,_0x5d589,!![]);}catch(_0x461760){return BPromise[_0x17c4('0x1f')](_0x461760);}return _0x48f92f[_0x17c4('0x20')]();};}function saveUpdates(_0x3fb3f9,_0x11be0b){return function(_0xcbedbe){if(_0xcbedbe){return _0xcbedbe[_0x17c4('0x21')](_0x3fb3f9)[_0x17c4('0x22')](function(_0x543fca){return _0x543fca;});}return null;};}function removeEntity(_0x55d242,_0x157039){return function(_0x3c7559){if(_0x3c7559){return _0x3c7559['destroy']()[_0x17c4('0x22')](function(){_0x55d242[_0x17c4('0x16')](0xcc)[_0x17c4('0x17')]();});}};}function handleEntityNotFound(_0x242be7,_0x1c32ba){return function(_0xe20c99){if(!_0xe20c99){_0x242be7[_0x17c4('0x15')](0x194);}return _0xe20c99;};}function handleError(_0x26c7da,_0x120e1c){_0x120e1c=_0x120e1c||0x1f4;return function(_0x14aaf2){logger[_0x17c4('0x23')](_0x14aaf2[_0x17c4('0x24')]);if(_0x14aaf2[_0x17c4('0x25')]){delete _0x14aaf2[_0x17c4('0x25')];}_0x26c7da[_0x17c4('0x16')](_0x120e1c)[_0x17c4('0x26')](_0x14aaf2);};}exports[_0x17c4('0x27')]=function(_0xfd65c6,_0x1a3bcb){var _0x40a040={},_0x1d935d={},_0x536c91={'count':0x0,'rows':[]};var _0x4d4892=_[_0x17c4('0x28')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x16ca4c){return{'name':_0x16ca4c[_0x17c4('0x29')],'type':_0x16ca4c[_0x17c4('0x2a')][_0x17c4('0x2b')]};});_0x1d935d[_0x17c4('0x2c')]=_[_0x17c4('0x28')](_0x4d4892,'name');_0x1d935d[_0x17c4('0x2d')]=_[_0x17c4('0x2e')](_0xfd65c6[_0x17c4('0x2d')]);_0x1d935d[_0x17c4('0x2f')]=_[_0x17c4('0x30')](_0x1d935d[_0x17c4('0x2c')],_0x1d935d[_0x17c4('0x2d')]);_0x40a040[_0x17c4('0x31')]=_[_0x17c4('0x30')](_0x1d935d['model'],qs[_0x17c4('0x32')](_0xfd65c6[_0x17c4('0x2d')][_0x17c4('0x32')]));_0x40a040['attributes']=_0x40a040['attributes'][_0x17c4('0x33')]?_0x40a040[_0x17c4('0x31')]:_0x1d935d[_0x17c4('0x2c')];if(!_0xfd65c6['query']['hasOwnProperty'](_0x17c4('0x34'))){_0x40a040[_0x17c4('0x1c')]=qs[_0x17c4('0x1c')](_0xfd65c6['query']['limit']);_0x40a040[_0x17c4('0x19')]=qs[_0x17c4('0x19')](_0xfd65c6['query'][_0x17c4('0x19')]);}_0x40a040[_0x17c4('0x35')]=qs['sort'](_0xfd65c6[_0x17c4('0x2d')][_0x17c4('0x36')]);_0x40a040['where']=qs[_0x17c4('0x2f')](_[_0x17c4('0x37')](_0xfd65c6[_0x17c4('0x2d')],_0x1d935d['filters']),_0x4d4892);if(_0xfd65c6['query'][_0x17c4('0x38')]){_0x40a040[_0x17c4('0x39')]=_[_0x17c4('0x3a')](_0x40a040['where'],{'$or':_['map'](_0x4d4892,function(_0x7f3f0e){if(_0x7f3f0e['type']!==_0x17c4('0x3b')){var _0xa9c9ba={};_0xa9c9ba[_0x7f3f0e[_0x17c4('0x25')]]={'$like':'%'+_0xfd65c6[_0x17c4('0x2d')][_0x17c4('0x38')]+'%'};return _0xa9c9ba;}})});}_0x40a040=_[_0x17c4('0x3a')]({},_0x40a040,_0xfd65c6['options']);var _0x147d9a={'where':_0x40a040[_0x17c4('0x39')]};return db['FreshdeskConfiguration'][_0x17c4('0x1b')](_0x147d9a)[_0x17c4('0x22')](function(_0x527871){_0x536c91[_0x17c4('0x1b')]=_0x527871;if(_0xfd65c6[_0x17c4('0x2d')]['includeAll']){_0x40a040[_0x17c4('0x3c')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x17c4('0x3d')](_0x40a040);})[_0x17c4('0x22')](function(_0xe82daa){_0x536c91[_0x17c4('0x3e')]=_0xe82daa;return _0x536c91;})[_0x17c4('0x22')](respondWithFilteredResult(_0x1a3bcb,_0x40a040))['catch'](handleError(_0x1a3bcb,null));};exports[_0x17c4('0x3f')]=function(_0x1c1853,_0x4eb8ee){var _0x2cfed2={'raw':![],'where':{'id':_0x1c1853[_0x17c4('0x40')]['id']}},_0x404aad={};_0x404aad[_0x17c4('0x2c')]=_[_0x17c4('0x2e')](db[_0x17c4('0x41')][_0x17c4('0x42')]);_0x404aad['query']=_[_0x17c4('0x2e')](_0x1c1853[_0x17c4('0x2d')]);_0x404aad[_0x17c4('0x2f')]=_[_0x17c4('0x30')](_0x404aad['model'],_0x404aad[_0x17c4('0x2d')]);_0x2cfed2[_0x17c4('0x31')]=_[_0x17c4('0x30')](_0x404aad[_0x17c4('0x2c')],qs[_0x17c4('0x32')](_0x1c1853[_0x17c4('0x2d')][_0x17c4('0x32')]));_0x2cfed2[_0x17c4('0x31')]=_0x2cfed2[_0x17c4('0x31')][_0x17c4('0x33')]?_0x2cfed2[_0x17c4('0x31')]:_0x404aad[_0x17c4('0x2c')];if(_0x1c1853[_0x17c4('0x2d')][_0x17c4('0x43')]){_0x2cfed2[_0x17c4('0x3c')]=[{'all':!![]}];}_0x2cfed2=_[_0x17c4('0x3a')]({},_0x2cfed2,_0x1c1853['options']);return db[_0x17c4('0x41')][_0x17c4('0x44')](_0x2cfed2)[_0x17c4('0x22')](handleEntityNotFound(_0x4eb8ee,null))[_0x17c4('0x22')](respondWithResult(_0x4eb8ee,null))[_0x17c4('0x45')](handleError(_0x4eb8ee,null));};exports[_0x17c4('0x46')]=function(_0x43a86f,_0x295525){return db[_0x17c4('0x41')][_0x17c4('0x46')](_0x43a86f[_0x17c4('0x47')],{})[_0x17c4('0x22')](respondWithResult(_0x295525,0xc9))[_0x17c4('0x45')](handleError(_0x295525,null));};exports[_0x17c4('0x21')]=function(_0x13efb0,_0xb36f7){if(_0x13efb0['body']['id']){delete _0x13efb0[_0x17c4('0x47')]['id'];}return db['FreshdeskConfiguration'][_0x17c4('0x44')]({'where':{'id':_0x13efb0[_0x17c4('0x40')]['id']}})[_0x17c4('0x22')](handleEntityNotFound(_0xb36f7,null))[_0x17c4('0x22')](saveUpdates(_0x13efb0['body'],null))[_0x17c4('0x22')](respondWithResult(_0xb36f7,null))[_0x17c4('0x45')](handleError(_0xb36f7,null));};exports[_0x17c4('0x48')]=function(_0x42c639,_0x41631d){return db[_0x17c4('0x41')]['find']({'where':{'id':_0x42c639[_0x17c4('0x40')]['id']}})[_0x17c4('0x22')](handleEntityNotFound(_0x41631d,null))[_0x17c4('0x22')](removeEntity(_0x41631d,null))['catch'](handleError(_0x41631d,null));};exports[_0x17c4('0x49')]=function(_0x2a3855,_0xa216bd,_0x218166){var _0x4ff3ad={};var _0x1167e0={};var _0x2d2f89;var _0x51d466;return db[_0x17c4('0x41')]['findOne']({'where':{'id':_0x2a3855[_0x17c4('0x40')]['id']}})[_0x17c4('0x22')](handleEntityNotFound(_0xa216bd,null))[_0x17c4('0x22')](function(_0x364455){if(_0x364455){_0x2d2f89=_0x364455;_0x1167e0['model']=_[_0x17c4('0x2e')](db[_0x17c4('0x4a')][_0x17c4('0x42')]);_0x1167e0[_0x17c4('0x2d')]=_[_0x17c4('0x2e')](_0x2a3855['query']);_0x1167e0[_0x17c4('0x2f')]=_[_0x17c4('0x30')](_0x1167e0['model'],_0x1167e0[_0x17c4('0x2d')]);_0x4ff3ad['attributes']=_[_0x17c4('0x30')](_0x1167e0['model'],qs[_0x17c4('0x32')](_0x2a3855[_0x17c4('0x2d')][_0x17c4('0x32')]));_0x4ff3ad['attributes']=_0x4ff3ad[_0x17c4('0x31')][_0x17c4('0x33')]?_0x4ff3ad[_0x17c4('0x31')]:_0x1167e0[_0x17c4('0x2c')];_0x4ff3ad['order']=qs[_0x17c4('0x36')](_0x2a3855[_0x17c4('0x2d')][_0x17c4('0x36')]);_0x4ff3ad[_0x17c4('0x39')]=qs['filters'](_['pick'](_0x2a3855[_0x17c4('0x2d')],_0x1167e0[_0x17c4('0x2f')]));if(_0x2a3855['query'][_0x17c4('0x38')]){_0x4ff3ad[_0x17c4('0x39')]=_[_0x17c4('0x3a')](_0x4ff3ad[_0x17c4('0x39')],{'$or':_[_0x17c4('0x28')](_0x4ff3ad['attributes'],function(_0x1ab32a){var _0x83a28e={};_0x83a28e[_0x1ab32a]={'$like':'%'+_0x2a3855[_0x17c4('0x2d')][_0x17c4('0x38')]+'%'};return _0x83a28e;})});}_0x4ff3ad=_['merge']({},_0x4ff3ad,_0x2a3855['options']);return _0x2d2f89['getFields'](_0x4ff3ad);}})[_0x17c4('0x22')](function(_0x22c525){if(_0x22c525){_0x51d466=_0x22c525[_0x17c4('0x33')];if(!_0x2a3855[_0x17c4('0x2d')][_0x17c4('0x4b')](_0x17c4('0x34'))){_0x4ff3ad[_0x17c4('0x1c')]=qs[_0x17c4('0x1c')](_0x2a3855[_0x17c4('0x2d')][_0x17c4('0x1c')]);_0x4ff3ad['offset']=qs[_0x17c4('0x19')](_0x2a3855['query'][_0x17c4('0x19')]);}return _0x2d2f89[_0x17c4('0x49')](_0x4ff3ad);}})['then'](function(_0x17b9c5){if(_0x17b9c5){return _0x17b9c5?{'count':_0x51d466,'rows':_0x17b9c5}:null;}})[_0x17c4('0x22')](respondWithResult(_0xa216bd,null))['catch'](handleError(_0xa216bd,null));};exports[_0x17c4('0x4c')]=function(_0x1a63f7,_0x139e02,_0x55300c){var _0x2a4510={};var _0xa97e51={};var _0x4bb5a0;var _0xc3ed9b;return db['FreshdeskConfiguration'][_0x17c4('0x4d')]({'where':{'id':_0x1a63f7[_0x17c4('0x40')]['id']}})[_0x17c4('0x22')](handleEntityNotFound(_0x139e02,null))[_0x17c4('0x22')](function(_0x38812a){if(_0x38812a){_0x4bb5a0=_0x38812a;_0xa97e51[_0x17c4('0x2c')]=_[_0x17c4('0x2e')](db[_0x17c4('0x4a')]['rawAttributes']);_0xa97e51[_0x17c4('0x2d')]=_[_0x17c4('0x2e')](_0x1a63f7[_0x17c4('0x2d')]);_0xa97e51[_0x17c4('0x2f')]=_['intersection'](_0xa97e51['model'],_0xa97e51['query']);_0x2a4510[_0x17c4('0x31')]=_[_0x17c4('0x30')](_0xa97e51[_0x17c4('0x2c')],qs[_0x17c4('0x32')](_0x1a63f7[_0x17c4('0x2d')][_0x17c4('0x32')]));_0x2a4510[_0x17c4('0x31')]=_0x2a4510['attributes']['length']?_0x2a4510[_0x17c4('0x31')]:_0xa97e51['model'];_0x2a4510[_0x17c4('0x35')]=qs['sort'](_0x1a63f7[_0x17c4('0x2d')]['sort']);_0x2a4510[_0x17c4('0x39')]=qs[_0x17c4('0x2f')](_['pick'](_0x1a63f7[_0x17c4('0x2d')],_0xa97e51['filters']));if(_0x1a63f7['query'][_0x17c4('0x38')]){_0x2a4510[_0x17c4('0x39')]=_[_0x17c4('0x3a')](_0x2a4510['where'],{'$or':_['map'](_0x2a4510[_0x17c4('0x31')],function(_0x144a52){var _0x585aff={};_0x585aff[_0x144a52]={'$like':'%'+_0x1a63f7['query']['filter']+'%'};return _0x585aff;})});}_0x2a4510=_[_0x17c4('0x3a')]({},_0x2a4510,_0x1a63f7[_0x17c4('0x4e')]);return _0x4bb5a0[_0x17c4('0x4c')](_0x2a4510);}})[_0x17c4('0x22')](function(_0x1078c1){if(_0x1078c1){_0xc3ed9b=_0x1078c1[_0x17c4('0x33')];if(!_0x1a63f7['query']['hasOwnProperty'](_0x17c4('0x34'))){_0x2a4510[_0x17c4('0x1c')]=qs[_0x17c4('0x1c')](_0x1a63f7[_0x17c4('0x2d')][_0x17c4('0x1c')]);_0x2a4510[_0x17c4('0x19')]=qs['offset'](_0x1a63f7['query'][_0x17c4('0x19')]);}return _0x4bb5a0[_0x17c4('0x4c')](_0x2a4510);}})['then'](function(_0x2a7e21){if(_0x2a7e21){return _0x2a7e21?{'count':_0xc3ed9b,'rows':_0x2a7e21}:null;}})['then'](respondWithResult(_0x139e02,null))[_0x17c4('0x45')](handleError(_0x139e02,null));};exports[_0x17c4('0x4f')]=function(_0x5e8e5f,_0x1926c9,_0x335c89){var _0x553676={};var _0x179bc9={};var _0x5dc252;var _0x27cafa;return db[_0x17c4('0x41')][_0x17c4('0x4d')]({'where':{'id':_0x5e8e5f[_0x17c4('0x40')]['id']}})[_0x17c4('0x22')](handleEntityNotFound(_0x1926c9,null))[_0x17c4('0x22')](function(_0x402555){if(_0x402555){_0x5dc252=_0x402555;_0x179bc9[_0x17c4('0x2c')]=_[_0x17c4('0x2e')](db[_0x17c4('0x4a')][_0x17c4('0x42')]);_0x179bc9[_0x17c4('0x2d')]=_[_0x17c4('0x2e')](_0x5e8e5f[_0x17c4('0x2d')]);_0x179bc9[_0x17c4('0x2f')]=_[_0x17c4('0x30')](_0x179bc9[_0x17c4('0x2c')],_0x179bc9[_0x17c4('0x2d')]);_0x553676[_0x17c4('0x31')]=_[_0x17c4('0x30')](_0x179bc9[_0x17c4('0x2c')],qs['fields'](_0x5e8e5f[_0x17c4('0x2d')][_0x17c4('0x32')]));_0x553676['attributes']=_0x553676[_0x17c4('0x31')]['length']?_0x553676[_0x17c4('0x31')]:_0x179bc9[_0x17c4('0x2c')];_0x553676[_0x17c4('0x35')]=qs[_0x17c4('0x36')](_0x5e8e5f[_0x17c4('0x2d')][_0x17c4('0x36')]);_0x553676[_0x17c4('0x39')]=qs[_0x17c4('0x2f')](_[_0x17c4('0x37')](_0x5e8e5f['query'],_0x179bc9[_0x17c4('0x2f')]));if(_0x5e8e5f[_0x17c4('0x2d')][_0x17c4('0x38')]){_0x553676[_0x17c4('0x39')]=_['merge'](_0x553676['where'],{'$or':_['map'](_0x553676[_0x17c4('0x31')],function(_0x24e2f9){var _0x54a428={};_0x54a428[_0x24e2f9]={'$like':'%'+_0x5e8e5f[_0x17c4('0x2d')][_0x17c4('0x38')]+'%'};return _0x54a428;})});}_0x553676=_[_0x17c4('0x3a')]({},_0x553676,_0x5e8e5f['options']);return _0x5dc252['getDescriptions'](_0x553676);}})['then'](function(_0xf6d620){if(_0xf6d620){_0x27cafa=_0xf6d620[_0x17c4('0x33')];if(!_0x5e8e5f[_0x17c4('0x2d')]['hasOwnProperty'](_0x17c4('0x34'))){_0x553676['limit']=qs[_0x17c4('0x1c')](_0x5e8e5f[_0x17c4('0x2d')][_0x17c4('0x1c')]);_0x553676[_0x17c4('0x19')]=qs['offset'](_0x5e8e5f[_0x17c4('0x2d')][_0x17c4('0x19')]);}return _0x5dc252[_0x17c4('0x4f')](_0x553676);}})[_0x17c4('0x22')](function(_0x3e0f93){if(_0x3e0f93){return _0x3e0f93?{'count':_0x27cafa,'rows':_0x3e0f93}:null;}})['then'](respondWithResult(_0x1926c9,null))[_0x17c4('0x45')](handleError(_0x1926c9,null));};exports[_0x17c4('0x50')]=function(_0x28e8bf,_0x3d6ff0,_0x3466e3){var _0x5bf9b0={};var _0x5a2f18={};var _0x272f87;var _0x1fd211;return db['FreshdeskConfiguration'][_0x17c4('0x4d')]({'where':{'id':_0x28e8bf['params']['id']}})[_0x17c4('0x22')](handleEntityNotFound(_0x3d6ff0,null))[_0x17c4('0x22')](function(_0x3dd35b){if(_0x3dd35b){_0x272f87=_0x3dd35b;_0x5a2f18[_0x17c4('0x2c')]=_[_0x17c4('0x2e')](db[_0x17c4('0x51')]['rawAttributes']);_0x5a2f18['query']=_[_0x17c4('0x2e')](_0x28e8bf[_0x17c4('0x2d')]);_0x5a2f18[_0x17c4('0x2f')]=_[_0x17c4('0x30')](_0x5a2f18['model'],_0x5a2f18[_0x17c4('0x2d')]);_0x5bf9b0[_0x17c4('0x31')]=_[_0x17c4('0x30')](_0x5a2f18[_0x17c4('0x2c')],qs[_0x17c4('0x32')](_0x28e8bf[_0x17c4('0x2d')]['fields']));_0x5bf9b0[_0x17c4('0x31')]=_0x5bf9b0['attributes'][_0x17c4('0x33')]?_0x5bf9b0[_0x17c4('0x31')]:_0x5a2f18[_0x17c4('0x2c')];_0x5bf9b0[_0x17c4('0x35')]=qs[_0x17c4('0x36')](_0x28e8bf['query'][_0x17c4('0x36')]);_0x5bf9b0[_0x17c4('0x39')]=qs[_0x17c4('0x2f')](_[_0x17c4('0x37')](_0x28e8bf[_0x17c4('0x2d')],_0x5a2f18['filters']));if(_0x28e8bf[_0x17c4('0x2d')][_0x17c4('0x38')]){_0x5bf9b0['where']=_[_0x17c4('0x3a')](_0x5bf9b0[_0x17c4('0x39')],{'$or':_['map'](_0x5bf9b0[_0x17c4('0x31')],function(_0x3dae19){var _0x4fe41f={};_0x4fe41f[_0x3dae19]={'$like':'%'+_0x28e8bf[_0x17c4('0x2d')][_0x17c4('0x38')]+'%'};return _0x4fe41f;})});}_0x5bf9b0=_[_0x17c4('0x3a')]({},_0x5bf9b0,_0x28e8bf[_0x17c4('0x4e')]);return _0x272f87['getTags'](_0x5bf9b0);}})[_0x17c4('0x22')](function(_0x365618){if(_0x365618){_0x1fd211=_0x365618[_0x17c4('0x33')];if(!_0x28e8bf[_0x17c4('0x2d')][_0x17c4('0x4b')](_0x17c4('0x34'))){_0x5bf9b0[_0x17c4('0x1c')]=qs[_0x17c4('0x1c')](_0x28e8bf[_0x17c4('0x2d')]['limit']);_0x5bf9b0[_0x17c4('0x19')]=qs[_0x17c4('0x19')](_0x28e8bf['query'][_0x17c4('0x19')]);}return _0x272f87[_0x17c4('0x50')](_0x5bf9b0);}})[_0x17c4('0x22')](function(_0x468388){if(_0x468388){return _0x468388?{'count':_0x1fd211,'rows':_0x468388}:null;}})[_0x17c4('0x22')](respondWithResult(_0x3d6ff0,null))[_0x17c4('0x45')](handleError(_0x3d6ff0,null));};exports[_0x17c4('0x52')]=function(_0x3f6790,_0x7adfdb,_0x18969f){if(_0x3f6790[_0x17c4('0x47')]['id']){delete _0x3f6790[_0x17c4('0x47')]['id'];}return db['FreshdeskConfiguration'][_0x17c4('0x4d')]({'where':{'id':_0x3f6790['params']['id']}})[_0x17c4('0x22')](handleEntityNotFound(_0x7adfdb,null))['then'](function(_0x53fa9c){if(_0x53fa9c){return _0x53fa9c[_0x17c4('0x52')](_0x3f6790[_0x17c4('0x47')][_0x17c4('0x53')]||[]);}return null;})[_0x17c4('0x22')](respondWithResult(_0x7adfdb,null))['catch'](handleError(_0x7adfdb,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 4044b39..e98ecab 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 _0xcd6e=['../../config/logger','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util'];(function(_0x48031a,_0x1bbc54){var _0x3d5cbc=function(_0x1dacba){while(--_0x1dacba){_0x48031a['push'](_0x48031a['shift']());}};_0x3d5cbc(++_0x1bbc54);}(_0xcd6e,0x1ee));var _0xecd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xecd6('0x0'));var logger=require(_0xecd6('0x1'))('api');var moment=require('moment');var BPromise=require(_0xecd6('0x2'));var rp=require(_0xecd6('0x3'));var fs=require('fs');var path=require(_0xecd6('0x4'));var rimraf=require('rimraf');var config=require(_0xecd6('0x5'));var attributes=require(_0xecd6('0x6'));module[_0xecd6('0x7')]=function(_0x5409d9,_0x3afc9a){return _0x5409d9[_0xecd6('0x8')](_0xecd6('0x9'),attributes,{'tableName':_0xecd6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb339=['path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','util','api','moment','request-promise'];(function(_0x1be466,_0x4e7311){var _0x23ece4=function(_0x231a90){while(--_0x231a90){_0x1be466['push'](_0x1be466['shift']());}};_0x23ece4(++_0x4e7311);}(_0xb339,0x12f));var _0x9b33=function(_0x111311,_0x1e2f69){_0x111311=_0x111311-0x0;var _0x4cef39=_0xb339[_0x111311];return _0x4cef39;};'use strict';var _=require(_0x9b33('0x0'));var util=require(_0x9b33('0x1'));var logger=require('../../config/logger')(_0x9b33('0x2'));var moment=require(_0x9b33('0x3'));var BPromise=require('bluebird');var rp=require(_0x9b33('0x4'));var fs=require('fs');var path=require(_0x9b33('0x5'));var rimraf=require('rimraf');var config=require(_0x9b33('0x6'));var attributes=require(_0x9b33('0x7'));module[_0x9b33('0x8')]=function(_0x17e6da,_0x342048){return _0x17e6da[_0x9b33('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x9b33('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index e7b7ab1..5622329 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 _0x3aa9=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x3aa9,0x118));var _0x93aa=function(_0x1be371,_0x1e7c00){_0x1be371=_0x1be371-0x0;var _0x2f1b4a=_0x3aa9[_0x1be371];return _0x2f1b4a;};'use strict';var _=require(_0x93aa('0x0'));var util=require(_0x93aa('0x1'));var moment=require(_0x93aa('0x2'));var BPromise=require('bluebird');var rs=require(_0x93aa('0x3'));var fs=require('fs');var Redis=require(_0x93aa('0x4'));var db=require(_0x93aa('0x5'))['db'];var utils=require(_0x93aa('0x6'));var logger=require(_0x93aa('0x7'))('rpc');var config=require(_0x93aa('0x8'));var jayson=require(_0x93aa('0x9'));var client=jayson['client'][_0x93aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ffd21,_0x2252b3,_0x27811e){return new BPromise(function(_0x305784,_0x5a85a6){return client['request'](_0x4ffd21,_0x27811e)[_0x93aa('0xb')](function(_0x55f874){logger[_0x93aa('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2252b3,_0x93aa('0xd'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2252b3,_0x93aa('0xd'),JSON['stringify'](_0x55f874));if(_0x55f874[_0x93aa('0xe')]){if(_0x55f874['error'][_0x93aa('0xf')]===0x1f4){logger[_0x93aa('0xe')](_0x93aa('0x10'),_0x2252b3,_0x55f874['error'][_0x93aa('0x11')]);return _0x5a85a6(_0x55f874['error']['message']);}logger[_0x93aa('0xe')](_0x93aa('0x10'),_0x2252b3,_0x55f874[_0x93aa('0xe')][_0x93aa('0x11')]);return _0x305784(_0x55f874[_0x93aa('0xe')][_0x93aa('0x11')]);}else{logger[_0x93aa('0xc')](_0x93aa('0x10'),_0x2252b3,'request\x20sent');_0x305784(_0x55f874[_0x93aa('0x12')]['message']);}})[_0x93aa('0x13')](function(_0x435504){logger[_0x93aa('0xe')](_0x93aa('0x10'),_0x2252b3,_0x435504);_0x5a85a6(_0x435504);});});} \ No newline at end of file +var _0x0b77=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring'];(function(_0xa59fa5,_0x421eb9){var _0x2ecef2=function(_0x1c12cb){while(--_0x1c12cb){_0xa59fa5['push'](_0xa59fa5['shift']());}};_0x2ecef2(++_0x421eb9);}(_0x0b77,0xb0));var _0x70b7=function(_0x415f7e,_0x4630b6){_0x415f7e=_0x415f7e-0x0;var _0x311ff4=_0x0b77[_0x415f7e];return _0x311ff4;};'use strict';var _=require('lodash');var util=require(_0x70b7('0x0'));var moment=require(_0x70b7('0x1'));var BPromise=require(_0x70b7('0x2'));var rs=require(_0x70b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x70b7('0x4'));var logger=require(_0x70b7('0x5'))(_0x70b7('0x6'));var config=require(_0x70b7('0x7'));var jayson=require(_0x70b7('0x8'));var client=jayson['client'][_0x70b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x152aec,_0x121505,_0x399c60){return new BPromise(function(_0x416058,_0x1dc071){return client['request'](_0x152aec,_0x399c60)['then'](function(_0x48fcdb){logger['info'](_0x70b7('0xa'),_0x121505,_0x70b7('0xb'));logger['debug'](_0x70b7('0xc'),_0x121505,_0x70b7('0xb'),JSON[_0x70b7('0xd')](_0x48fcdb));if(_0x48fcdb[_0x70b7('0xe')]){if(_0x48fcdb[_0x70b7('0xe')][_0x70b7('0xf')]===0x1f4){logger[_0x70b7('0xe')](_0x70b7('0xa'),_0x121505,_0x48fcdb[_0x70b7('0xe')][_0x70b7('0x10')]);return _0x1dc071(_0x48fcdb[_0x70b7('0xe')][_0x70b7('0x10')]);}logger['error'](_0x70b7('0xa'),_0x121505,_0x48fcdb['error'][_0x70b7('0x10')]);return _0x416058(_0x48fcdb[_0x70b7('0xe')]['message']);}else{logger[_0x70b7('0x11')](_0x70b7('0xa'),_0x121505,_0x70b7('0xb'));_0x416058(_0x48fcdb[_0x70b7('0x12')][_0x70b7('0x10')]);}})[_0x70b7('0x13')](function(_0x1f42a4){logger[_0x70b7('0xe')](_0x70b7('0xa'),_0x121505,_0x1f42a4);_0x1dc071(_0x1f42a4);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 98e9afd..7a1a925 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 _0x4f20=['delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','show','create'];(function(_0x2b5b44,_0x17189c){var _0x32cb66=function(_0x4ce183){while(--_0x4ce183){_0x2b5b44['push'](_0x2b5b44['shift']());}};_0x32cb66(++_0x17189c);}(_0x4f20,0x18f));var _0x04f2=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4f20[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x04f2('0x0'));var util=require(_0x04f2('0x1'));var path=require(_0x04f2('0x2'));var timeout=require(_0x04f2('0x3'));var express=require(_0x04f2('0x4'));var router=express[_0x04f2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x04f2('0x6'));var interaction=require(_0x04f2('0x7'));var config=require(_0x04f2('0x8'));var controller=require(_0x04f2('0x9'));router[_0x04f2('0xa')]('/',auth[_0x04f2('0xb')](),controller[_0x04f2('0xc')]);router[_0x04f2('0xa')]('/:id',auth[_0x04f2('0xb')](),controller[_0x04f2('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x04f2('0xe')]);router['put']('/:id',auth[_0x04f2('0xb')](),controller['update']);router[_0x04f2('0xf')](_0x04f2('0x10'),auth[_0x04f2('0xb')](),controller[_0x04f2('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1789=['post','isAuthenticated','create','put','update','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','index','/:id','show'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1789,0x16e));var _0x9178=function(_0x52215e,_0x3644bd){_0x52215e=_0x52215e-0x0;var _0x5e787c=_0x1789[_0x52215e];return _0x5e787c;};'use strict';var multer=require(_0x9178('0x0'));var util=require(_0x9178('0x1'));var path=require('path');var timeout=require(_0x9178('0x2'));var express=require('express');var router=express[_0x9178('0x3')]();var fs_extra=require(_0x9178('0x4'));var auth=require(_0x9178('0x5'));var interaction=require(_0x9178('0x6'));var config=require('../../config/environment');var controller=require(_0x9178('0x7'));router[_0x9178('0x8')]('/',auth['isAuthenticated'](),controller[_0x9178('0x9')]);router['get'](_0x9178('0xa'),auth['isAuthenticated'](),controller[_0x9178('0xb')]);router[_0x9178('0xc')]('/',auth[_0x9178('0xd')](),controller[_0x9178('0xe')]);router[_0x9178('0xf')](_0x9178('0xa'),auth[_0x9178('0xd')](),controller[_0x9178('0x10')]);router['delete'](_0x9178('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x9178('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 79d4b73..be66236 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 _0x3417=['BOOLEAN','exports','string','variable','customVariable','keyValue','picklist','ENUM','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3417,0x121));var _0x7341=function(_0x147e32,_0x3c6c0c){_0x147e32=_0x147e32-0x0;var _0x1a48c8=_0x3417[_0x147e32];return _0x1a48c8;};'use strict';var Sequelize=require('sequelize');module[_0x7341('0x0')]={'type':{'type':Sequelize['ENUM'](_0x7341('0x1'),_0x7341('0x2'),_0x7341('0x3'),_0x7341('0x4'),_0x7341('0x5')),'defaultValue':_0x7341('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7341('0x6')](_0x7341('0x1'),_0x7341('0x2'),_0x7341('0x3'))},'keyContent':{'type':Sequelize[_0x7341('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7341('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7341('0x7')]}}; \ No newline at end of file +var _0x2c1a=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x1c6633,_0x222d86){var _0x499802=function(_0x2bb38c){while(--_0x2bb38c){_0x1c6633['push'](_0x1c6633['shift']());}};_0x499802(++_0x222d86);}(_0x2c1a,0x91));var _0xa2c1=function(_0x446763,_0x36a718){_0x446763=_0x446763-0x0;var _0x1d2b69=_0x2c1a[_0x446763];return _0x1d2b69;};'use strict';var Sequelize=require(_0xa2c1('0x0'));module[_0xa2c1('0x1')]={'type':{'type':Sequelize[_0xa2c1('0x2')](_0xa2c1('0x3'),_0xa2c1('0x4'),_0xa2c1('0x5'),'keyValue',_0xa2c1('0x6')),'defaultValue':_0xa2c1('0x3')},'content':{'type':Sequelize[_0xa2c1('0x7')]},'key':{'type':Sequelize[_0xa2c1('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xa2c1('0x3'),'variable',_0xa2c1('0x5'))},'keyContent':{'type':Sequelize[_0xa2c1('0x7')]},'idField':{'type':Sequelize[_0xa2c1('0x7')]},'nameField':{'type':Sequelize[_0xa2c1('0x7')]},'customField':{'type':Sequelize[_0xa2c1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa2c1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 61ce244..243e301 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 _0x9bde=['catch','show','params','includeAll','include','create','body','update','find','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','index','map','FreshdeskField','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','rows'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3db09c,_0x16a50c){_0x3db09c=_0x3db09c-0x0;var _0x5edd9b=_0x9bde[_0x3db09c];return _0x5edd9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={},_0x1de54c={},_0x56e409={'count':0x0,'rows':[]};var _0xa45eb0=_[_0xe9bd('0x2b')](db[_0xe9bd('0x2c')][_0xe9bd('0x2d')],function(_0x4057df){return{'name':_0x4057df['fieldName'],'type':_0x4057df['type'][_0xe9bd('0x2e')]};});_0x1de54c[_0xe9bd('0x2f')]=_[_0xe9bd('0x2b')](_0xa45eb0,_0xe9bd('0x28'));_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x183601[_0xe9bd('0x30')]);_0x1de54c[_0xe9bd('0x32')]=_[_0xe9bd('0x33')](_0x1de54c['model'],_0x1de54c[_0xe9bd('0x30')]);_0x5b7f1d[_0xe9bd('0x34')]=_[_0xe9bd('0x33')](_0x1de54c['model'],qs['fields'](_0x183601[_0xe9bd('0x30')][_0xe9bd('0x35')]));_0x5b7f1d[_0xe9bd('0x34')]=_0x5b7f1d[_0xe9bd('0x34')][_0xe9bd('0x36')]?_0x5b7f1d[_0xe9bd('0x34')]:_0x1de54c[_0xe9bd('0x2f')];if(!_0x183601[_0xe9bd('0x30')][_0xe9bd('0x37')](_0xe9bd('0x38'))){_0x5b7f1d[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x183601[_0xe9bd('0x30')][_0xe9bd('0x1e')]);_0x5b7f1d[_0xe9bd('0x20')]=qs[_0xe9bd('0x20')](_0x183601[_0xe9bd('0x30')][_0xe9bd('0x20')]);}_0x5b7f1d['order']=qs[_0xe9bd('0x39')](_0x183601[_0xe9bd('0x30')]['sort']);_0x5b7f1d[_0xe9bd('0x3a')]=qs[_0xe9bd('0x32')](_['pick'](_0x183601['query'],_0x1de54c[_0xe9bd('0x32')]),_0xa45eb0);if(_0x183601[_0xe9bd('0x30')]['filter']){_0x5b7f1d[_0xe9bd('0x3a')]=_[_0xe9bd('0x3b')](_0x5b7f1d[_0xe9bd('0x3a')],{'$or':_['map'](_0xa45eb0,function(_0x19740b){if(_0x19740b['type']!==_0xe9bd('0x3c')){var _0x42238a={};_0x42238a[_0x19740b[_0xe9bd('0x28')]]={'$like':'%'+_0x183601[_0xe9bd('0x30')]['filter']+'%'};return _0x42238a;}})});}_0x5b7f1d=_[_0xe9bd('0x3b')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x3d')]);var _0x327e1a={'where':_0x5b7f1d[_0xe9bd('0x3a')]};return db[_0xe9bd('0x2c')][_0xe9bd('0x1f')](_0x327e1a)[_0xe9bd('0x25')](function(_0xacfd19){_0x56e409[_0xe9bd('0x1f')]=_0xacfd19;if(_0x183601[_0xe9bd('0x30')]['includeAll']){_0x5b7f1d['include']=[{'all':!![]}];}return db[_0xe9bd('0x2c')]['findAll'](_0x5b7f1d);})[_0xe9bd('0x25')](function(_0x340819){_0x56e409[_0xe9bd('0x3e')]=_0x340819;return _0x56e409;})['then'](respondWithFilteredResult(_0x519f48,_0x5b7f1d))[_0xe9bd('0x3f')](handleError(_0x519f48,null));};exports[_0xe9bd('0x40')]=function(_0x1a2d94,_0x5a4460){var _0x2ef01b={'raw':!![],'where':{'id':_0x1a2d94[_0xe9bd('0x41')]['id']}},_0x3a5703={};_0x3a5703[_0xe9bd('0x2f')]=_[_0xe9bd('0x31')](db[_0xe9bd('0x2c')][_0xe9bd('0x2d')]);_0x3a5703[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1a2d94[_0xe9bd('0x30')]);_0x3a5703[_0xe9bd('0x32')]=_[_0xe9bd('0x33')](_0x3a5703[_0xe9bd('0x2f')],_0x3a5703[_0xe9bd('0x30')]);_0x2ef01b[_0xe9bd('0x34')]=_['intersection'](_0x3a5703['model'],qs[_0xe9bd('0x35')](_0x1a2d94[_0xe9bd('0x30')][_0xe9bd('0x35')]));_0x2ef01b['attributes']=_0x2ef01b['attributes'][_0xe9bd('0x36')]?_0x2ef01b[_0xe9bd('0x34')]:_0x3a5703[_0xe9bd('0x2f')];if(_0x1a2d94[_0xe9bd('0x30')][_0xe9bd('0x42')]){_0x2ef01b[_0xe9bd('0x43')]=[{'all':!![]}];}_0x2ef01b=_[_0xe9bd('0x3b')]({},_0x2ef01b,_0x1a2d94['options']);return db[_0xe9bd('0x2c')]['find'](_0x2ef01b)[_0xe9bd('0x25')](handleEntityNotFound(_0x5a4460,null))[_0xe9bd('0x25')](respondWithResult(_0x5a4460,null))[_0xe9bd('0x3f')](handleError(_0x5a4460,null));};exports[_0xe9bd('0x44')]=function(_0x74ea23,_0x4b7b67){return db[_0xe9bd('0x2c')][_0xe9bd('0x44')](_0x74ea23[_0xe9bd('0x45')],{})['then'](respondWithResult(_0x4b7b67,0xc9))[_0xe9bd('0x3f')](handleError(_0x4b7b67,null));};exports[_0xe9bd('0x46')]=function(_0x34f787,_0x5a466b){if(_0x34f787[_0xe9bd('0x45')]['id']){delete _0x34f787[_0xe9bd('0x45')]['id'];}return db[_0xe9bd('0x2c')][_0xe9bd('0x47')]({'where':{'id':_0x34f787[_0xe9bd('0x41')]['id']}})['then'](handleEntityNotFound(_0x5a466b,null))[_0xe9bd('0x25')](saveUpdates(_0x34f787['body'],null))[_0xe9bd('0x25')](respondWithResult(_0x5a466b,null))[_0xe9bd('0x3f')](handleError(_0x5a466b,null));};exports[_0xe9bd('0x26')]=function(_0x14b06b,_0x194b7d){return db['FreshdeskField'][_0xe9bd('0x47')]({'where':{'id':_0x14b06b['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x194b7d,null))[_0xe9bd('0x25')](removeEntity(_0x194b7d,null))['catch'](handleError(_0x194b7d,null));}; \ No newline at end of file +var _0x2bc6=['crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','FreshdeskField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','catch','show','params','rawAttributes','fields','find','create','body','eml-format','rimraf','zip-dir','mustache','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x117685,_0x4d1ac1){var _0x4c5743=function(_0xc9146){while(--_0xc9146){_0x117685['push'](_0x117685['shift']());}};_0x4c5743(++_0x4d1ac1);}(_0x2bc6,0x163));var _0x62bc=function(_0x2a9a4c,_0x28d7f5){_0x2a9a4c=_0x2a9a4c-0x0;var _0x295752=_0x2bc6[_0x2a9a4c];return _0x295752;};'use strict';var emlformat=require(_0x62bc('0x0'));var rimraf=require(_0x62bc('0x1'));var zipdir=require(_0x62bc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x62bc('0x3'));var util=require('util');var path=require(_0x62bc('0x4'));var sox=require(_0x62bc('0x5'));var csv=require('to-csv');var ejs=require(_0x62bc('0x6'));var fs=require('fs');var fs_extra=require(_0x62bc('0x7'));var _=require(_0x62bc('0x8'));var squel=require(_0x62bc('0x9'));var crypto=require(_0x62bc('0xa'));var jsforce=require(_0x62bc('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x62bc('0xc'));var querystring=require(_0x62bc('0xd'));var Papa=require(_0x62bc('0xe'));var Redis=require(_0x62bc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x62bc('0x10'));var as=require(_0x62bc('0x11'));var hardwareService=require(_0x62bc('0x12'));var logger=require('../../config/logger')(_0x62bc('0x13'));var utils=require(_0x62bc('0x14'));var config=require(_0x62bc('0x15'));var licenseUtil=require(_0x62bc('0x16'));var db=require(_0x62bc('0x17'))['db'];function respondWithStatusCode(_0x2a9309,_0x414a08){_0x414a08=_0x414a08||0xcc;return function(_0x4f92f7){if(_0x4f92f7){return _0x2a9309[_0x62bc('0x18')](_0x414a08);}return _0x2a9309[_0x62bc('0x19')](_0x414a08)['end']();};}function respondWithResult(_0x314358,_0x10230f){_0x10230f=_0x10230f||0xc8;return function(_0xc14ac9){if(_0xc14ac9){return _0x314358['status'](_0x10230f)[_0x62bc('0x1a')](_0xc14ac9);}};}function respondWithFilteredResult(_0x94b649,_0x56eade){return function(_0x515c80){if(_0x515c80){var _0x39c5e0=typeof _0x56eade[_0x62bc('0x1b')]==='undefined'&&typeof _0x56eade[_0x62bc('0x1c')]===_0x62bc('0x1d');var _0xc1211c=_0x515c80[_0x62bc('0x1e')];var _0xc95407=_0x39c5e0?0x0:_0x56eade[_0x62bc('0x1b')];var _0x1d3d8f=_0x39c5e0?_0x515c80[_0x62bc('0x1e')]:_0x56eade[_0x62bc('0x1b')]+_0x56eade['limit'];var _0x5dd6f0;if(_0x1d3d8f>=_0xc1211c){_0x1d3d8f=_0xc1211c;_0x5dd6f0=0xc8;}else{_0x5dd6f0=0xce;}_0x94b649[_0x62bc('0x19')](_0x5dd6f0);return _0x94b649[_0x62bc('0x1f')](_0x62bc('0x20'),_0xc95407+'-'+_0x1d3d8f+'/'+_0xc1211c)['json'](_0x515c80);}return null;};}function patchUpdates(_0x380621){return function(_0x495f99){try{jsonpatch[_0x62bc('0x21')](_0x495f99,_0x380621,!![]);}catch(_0x37ab87){return BPromise[_0x62bc('0x22')](_0x37ab87);}return _0x495f99['save']();};}function saveUpdates(_0x3b8644,_0x28757d){return function(_0xae87bf){if(_0xae87bf){return _0xae87bf[_0x62bc('0x23')](_0x3b8644)[_0x62bc('0x24')](function(_0x3b2eb0){return _0x3b2eb0;});}return null;};}function removeEntity(_0x5b2e16,_0x70e428){return function(_0xb0d0fb){if(_0xb0d0fb){return _0xb0d0fb[_0x62bc('0x25')]()[_0x62bc('0x24')](function(){_0x5b2e16[_0x62bc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52ca86,_0xcd4b0){return function(_0x58e76a){if(!_0x58e76a){_0x52ca86[_0x62bc('0x18')](0x194);}return _0x58e76a;};}function handleError(_0x36af97,_0x1e046d){_0x1e046d=_0x1e046d||0x1f4;return function(_0x4a72d6){logger[_0x62bc('0x26')](_0x4a72d6[_0x62bc('0x27')]);if(_0x4a72d6[_0x62bc('0x28')]){delete _0x4a72d6['name'];}_0x36af97['status'](_0x1e046d)[_0x62bc('0x29')](_0x4a72d6);};}exports[_0x62bc('0x2a')]=function(_0x23817c,_0x4df640){var _0x4313ba={},_0x1f2985={},_0x44600f={'count':0x0,'rows':[]};var _0x444267=_['map'](db[_0x62bc('0x2b')]['rawAttributes'],function(_0x26701b){return{'name':_0x26701b[_0x62bc('0x2c')],'type':_0x26701b[_0x62bc('0x2d')][_0x62bc('0x2e')]};});_0x1f2985[_0x62bc('0x2f')]=_[_0x62bc('0x30')](_0x444267,_0x62bc('0x28'));_0x1f2985[_0x62bc('0x31')]=_[_0x62bc('0x32')](_0x23817c[_0x62bc('0x31')]);_0x1f2985[_0x62bc('0x33')]=_[_0x62bc('0x34')](_0x1f2985[_0x62bc('0x2f')],_0x1f2985[_0x62bc('0x31')]);_0x4313ba[_0x62bc('0x35')]=_[_0x62bc('0x34')](_0x1f2985[_0x62bc('0x2f')],qs['fields'](_0x23817c[_0x62bc('0x31')]['fields']));_0x4313ba['attributes']=_0x4313ba[_0x62bc('0x35')]['length']?_0x4313ba['attributes']:_0x1f2985['model'];if(!_0x23817c[_0x62bc('0x31')][_0x62bc('0x36')](_0x62bc('0x37'))){_0x4313ba['limit']=qs['limit'](_0x23817c['query'][_0x62bc('0x1c')]);_0x4313ba[_0x62bc('0x1b')]=qs['offset'](_0x23817c['query'][_0x62bc('0x1b')]);}_0x4313ba[_0x62bc('0x38')]=qs[_0x62bc('0x39')](_0x23817c['query'][_0x62bc('0x39')]);_0x4313ba[_0x62bc('0x3a')]=qs[_0x62bc('0x33')](_[_0x62bc('0x3b')](_0x23817c['query'],_0x1f2985[_0x62bc('0x33')]),_0x444267);if(_0x23817c[_0x62bc('0x31')]['filter']){_0x4313ba[_0x62bc('0x3a')]=_[_0x62bc('0x3c')](_0x4313ba[_0x62bc('0x3a')],{'$or':_[_0x62bc('0x30')](_0x444267,function(_0x599aed){if(_0x599aed[_0x62bc('0x2d')]!=='VIRTUAL'){var _0x38230a={};_0x38230a[_0x599aed[_0x62bc('0x28')]]={'$like':'%'+_0x23817c[_0x62bc('0x31')][_0x62bc('0x3d')]+'%'};return _0x38230a;}})});}_0x4313ba=_['merge']({},_0x4313ba,_0x23817c[_0x62bc('0x3e')]);var _0x5c806b={'where':_0x4313ba[_0x62bc('0x3a')]};return db[_0x62bc('0x2b')][_0x62bc('0x1e')](_0x5c806b)[_0x62bc('0x24')](function(_0x9011f2){_0x44600f[_0x62bc('0x1e')]=_0x9011f2;if(_0x23817c[_0x62bc('0x31')][_0x62bc('0x3f')]){_0x4313ba[_0x62bc('0x40')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x4313ba);})[_0x62bc('0x24')](function(_0x400779){_0x44600f['rows']=_0x400779;return _0x44600f;})[_0x62bc('0x24')](respondWithFilteredResult(_0x4df640,_0x4313ba))[_0x62bc('0x41')](handleError(_0x4df640,null));};exports[_0x62bc('0x42')]=function(_0xedc9f3,_0xbd8c7e){var _0x5f3752={'raw':!![],'where':{'id':_0xedc9f3[_0x62bc('0x43')]['id']}},_0x3bf043={};_0x3bf043['model']=_['keys'](db[_0x62bc('0x2b')][_0x62bc('0x44')]);_0x3bf043[_0x62bc('0x31')]=_['keys'](_0xedc9f3[_0x62bc('0x31')]);_0x3bf043[_0x62bc('0x33')]=_[_0x62bc('0x34')](_0x3bf043[_0x62bc('0x2f')],_0x3bf043[_0x62bc('0x31')]);_0x5f3752[_0x62bc('0x35')]=_['intersection'](_0x3bf043[_0x62bc('0x2f')],qs['fields'](_0xedc9f3[_0x62bc('0x31')][_0x62bc('0x45')]));_0x5f3752[_0x62bc('0x35')]=_0x5f3752['attributes']['length']?_0x5f3752['attributes']:_0x3bf043[_0x62bc('0x2f')];if(_0xedc9f3['query'][_0x62bc('0x3f')]){_0x5f3752[_0x62bc('0x40')]=[{'all':!![]}];}_0x5f3752=_['merge']({},_0x5f3752,_0xedc9f3['options']);return db['FreshdeskField'][_0x62bc('0x46')](_0x5f3752)[_0x62bc('0x24')](handleEntityNotFound(_0xbd8c7e,null))[_0x62bc('0x24')](respondWithResult(_0xbd8c7e,null))[_0x62bc('0x41')](handleError(_0xbd8c7e,null));};exports[_0x62bc('0x47')]=function(_0x49389f,_0x3834b2){return db[_0x62bc('0x2b')]['create'](_0x49389f[_0x62bc('0x48')],{})['then'](respondWithResult(_0x3834b2,0xc9))[_0x62bc('0x41')](handleError(_0x3834b2,null));};exports[_0x62bc('0x23')]=function(_0x17e0ec,_0xca6190){if(_0x17e0ec[_0x62bc('0x48')]['id']){delete _0x17e0ec[_0x62bc('0x48')]['id'];}return db[_0x62bc('0x2b')]['find']({'where':{'id':_0x17e0ec[_0x62bc('0x43')]['id']}})[_0x62bc('0x24')](handleEntityNotFound(_0xca6190,null))['then'](saveUpdates(_0x17e0ec[_0x62bc('0x48')],null))['then'](respondWithResult(_0xca6190,null))[_0x62bc('0x41')](handleError(_0xca6190,null));};exports[_0x62bc('0x25')]=function(_0x4bec08,_0x6c2969){return db[_0x62bc('0x2b')][_0x62bc('0x46')]({'where':{'id':_0x4bec08['params']['id']}})[_0x62bc('0x24')](handleEntityNotFound(_0x6c2969,null))[_0x62bc('0x24')](removeEntity(_0x6c2969,null))[_0x62bc('0x41')](handleError(_0x6c2969,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 6241972..ec90b8b 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 _0x18d6=['rimraf','../../config/environment','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x38afb8,_0x173f9f){var _0x404291=function(_0x554c1f){while(--_0x554c1f){_0x38afb8['push'](_0x38afb8['shift']());}};_0x404291(++_0x173f9f);}(_0x18d6,0x166));var _0x618d=function(_0x1fcdb5,_0x162157){_0x1fcdb5=_0x1fcdb5-0x0;var _0x44a25f=_0x18d6[_0x1fcdb5];return _0x44a25f;};'use strict';var _=require(_0x618d('0x0'));var util=require(_0x618d('0x1'));var logger=require('../../config/logger')(_0x618d('0x2'));var moment=require(_0x618d('0x3'));var BPromise=require(_0x618d('0x4'));var rp=require(_0x618d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x618d('0x6'));var config=require(_0x618d('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0x618d('0x8')]=function(_0x55caad,_0xa89cff){return _0x55caad[_0x618d('0x9')]('FreshdeskField',attributes,{'tableName':_0x618d('0xa'),'paranoid':![],'indexes':[{'name':_0x618d('0xb'),'fields':[_0x618d('0xc'),_0x618d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5127=['exports','int_freshdesk_fields','idField','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x29380f,_0x45f689){var _0x5b08d2=function(_0x3e7ec3){while(--_0x3e7ec3){_0x29380f['push'](_0x29380f['shift']());}};_0x5b08d2(++_0x45f689);}(_0x5127,0x18f));var _0x7512=function(_0x59ee91,_0x5ca1ef){_0x59ee91=_0x59ee91-0x0;var _0x51b0b7=_0x5127[_0x59ee91];return _0x51b0b7;};'use strict';var _=require(_0x7512('0x0'));var util=require(_0x7512('0x1'));var logger=require(_0x7512('0x2'))(_0x7512('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7512('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7512('0x5'));var config=require(_0x7512('0x6'));var attributes=require(_0x7512('0x7'));module[_0x7512('0x8')]=function(_0x35a3e5,_0x1a7239){return _0x35a3e5['define']('FreshdeskField',attributes,{'tableName':_0x7512('0x9'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x7512('0xa'),'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 bac927d..cfdd8e8 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 _0x870f=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c40fe,_0x509ee9){var _0x166957=function(_0x4816b4){while(--_0x4816b4){_0x1c40fe['push'](_0x1c40fe['shift']());}};_0x166957(++_0x509ee9);}(_0x870f,0x10b));var _0xf870=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x870f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf870('0x0'));var util=require(_0xf870('0x1'));var moment=require('moment');var BPromise=require(_0xf870('0x2'));var rs=require(_0xf870('0x3'));var fs=require('fs');var Redis=require(_0xf870('0x4'));var db=require(_0xf870('0x5'))['db'];var utils=require(_0xf870('0x6'));var logger=require(_0xf870('0x7'))('rpc');var config=require(_0xf870('0x8'));var jayson=require(_0xf870('0x9'));var client=jayson['client'][_0xf870('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2060ba,_0x59bca6,_0x40b69a){return new BPromise(function(_0x4f8132,_0x3cee92){return client[_0xf870('0xb')](_0x2060ba,_0x40b69a)['then'](function(_0x16fc4e){logger[_0xf870('0xc')](_0xf870('0xd'),_0x59bca6,_0xf870('0xe'));logger[_0xf870('0xf')](_0xf870('0x10'),_0x59bca6,_0xf870('0xe'),JSON[_0xf870('0x11')](_0x16fc4e));if(_0x16fc4e[_0xf870('0x12')]){if(_0x16fc4e[_0xf870('0x12')]['code']===0x1f4){logger[_0xf870('0x12')](_0xf870('0xd'),_0x59bca6,_0x16fc4e['error'][_0xf870('0x13')]);return _0x3cee92(_0x16fc4e[_0xf870('0x12')]['message']);}logger[_0xf870('0x12')](_0xf870('0xd'),_0x59bca6,_0x16fc4e[_0xf870('0x12')][_0xf870('0x13')]);return _0x4f8132(_0x16fc4e[_0xf870('0x12')][_0xf870('0x13')]);}else{logger[_0xf870('0xc')](_0xf870('0xd'),_0x59bca6,_0xf870('0xe'));_0x4f8132(_0x16fc4e[_0xf870('0x14')][_0xf870('0x13')]);}})[_0xf870('0x15')](function(_0x556d60){logger[_0xf870('0x12')](_0xf870('0xd'),_0x59bca6,_0x556d60);_0x3cee92(_0x556d60);});});} \ No newline at end of file +var _0x2e08=['info','result','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2b8f2b,_0x3e41ac){var _0x12b3ff=function(_0x179f1f){while(--_0x179f1f){_0x2b8f2b['push'](_0x2b8f2b['shift']());}};_0x12b3ff(++_0x3e41ac);}(_0x2e08,0x1b9));var _0x82e0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2e08[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x82e0('0x0'));var util=require(_0x82e0('0x1'));var moment=require(_0x82e0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82e0('0x3'));var db=require(_0x82e0('0x4'))['db'];var utils=require(_0x82e0('0x5'));var logger=require(_0x82e0('0x6'))(_0x82e0('0x7'));var config=require(_0x82e0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x82e0('0x9')][_0x82e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x624ea7,_0x3095f9,_0x3a52af){return new BPromise(function(_0x175c7f,_0x3d885c){return client['request'](_0x624ea7,_0x3a52af)[_0x82e0('0xb')](function(_0x23e16b){logger['info'](_0x82e0('0xc'),_0x3095f9,_0x82e0('0xd'));logger[_0x82e0('0xe')](_0x82e0('0xf'),_0x3095f9,_0x82e0('0xd'),JSON[_0x82e0('0x10')](_0x23e16b));if(_0x23e16b[_0x82e0('0x11')]){if(_0x23e16b[_0x82e0('0x11')][_0x82e0('0x12')]===0x1f4){logger[_0x82e0('0x11')](_0x82e0('0xc'),_0x3095f9,_0x23e16b[_0x82e0('0x11')]['message']);return _0x3d885c(_0x23e16b[_0x82e0('0x11')]['message']);}logger['error'](_0x82e0('0xc'),_0x3095f9,_0x23e16b['error']['message']);return _0x175c7f(_0x23e16b[_0x82e0('0x11')]['message']);}else{logger[_0x82e0('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x3095f9,_0x82e0('0xd'));_0x175c7f(_0x23e16b[_0x82e0('0x14')][_0x82e0('0x15')]);}})[_0x82e0('0x16')](function(_0x5d8fbc){logger[_0x82e0('0x11')](_0x82e0('0xc'),_0x3095f9,_0x5d8fbc);_0x3d885c(_0x5d8fbc);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index b3576b9..063b3ea 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 _0x6c76=['getConfigurations','/:id/fields','post','create','addConfiguration','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/configurations'];(function(_0xc3b34a,_0x8f0080){var _0x472b25=function(_0x366fb2){while(--_0x366fb2){_0xc3b34a['push'](_0xc3b34a['shift']());}};_0x472b25(++_0x8f0080);}(_0x6c76,0x184));var _0x66c7=function(_0x122df5,_0x29caeb){_0x122df5=_0x122df5-0x0;var _0x4f5339=_0x6c76[_0x122df5];return _0x4f5339;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x66c7('0x7')]('/',auth[_0x66c7('0x8')](),controller['index']);router[_0x66c7('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x66c7('0x9')]);router[_0x66c7('0x7')](_0x66c7('0xa'),auth['isAuthenticated'](),controller[_0x66c7('0xb')]);router[_0x66c7('0x7')](_0x66c7('0xc'),auth[_0x66c7('0x8')](),controller['getFields']);router[_0x66c7('0xd')]('/',auth[_0x66c7('0x8')](),controller[_0x66c7('0xe')]);router[_0x66c7('0xd')](_0x66c7('0xa'),auth[_0x66c7('0x8')](),controller[_0x66c7('0xf')]);router['put'](_0x66c7('0x10'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x11')]);router[_0x66c7('0x12')](_0x66c7('0x10'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x13')]);module[_0x66c7('0x14')]=router; \ No newline at end of file +var _0xda3f=['/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations'];(function(_0x58da8a,_0x1fb6ff){var _0x5294b9=function(_0x684dd6){while(--_0x684dd6){_0x58da8a['push'](_0x58da8a['shift']());}};_0x5294b9(++_0x1fb6ff);}(_0xda3f,0xec));var _0xfda3=function(_0x265857,_0xf6f3af){_0x265857=_0x265857-0x0;var _0x4efa6d=_0xda3f[_0x265857];return _0x4efa6d;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./intFreshsalesAccount.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')]('/',auth['isAuthenticated'](),controller[_0xfda3('0xe')]);router[_0xfda3('0xd')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xf')]);router['put'](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfda3('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index bb3b151..a4d2344 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 _0x4137=['STRING','username','remoteUri','sequelize','exports'];(function(_0x44bd67,_0x303c86){var _0x17f46d=function(_0x71277f){while(--_0x71277f){_0x44bd67['push'](_0x44bd67['shift']());}};_0x17f46d(++_0x303c86);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x7413('0x0'));module[_0x7413('0x1')]={'name':{'type':Sequelize[_0x7413('0x2')]},'description':{'type':Sequelize[_0x7413('0x2')]},'username':{'type':Sequelize[_0x7413('0x2')],'unique':_0x7413('0x3')},'apiKey':{'type':Sequelize[_0x7413('0x2')]},'remoteUri':{'type':Sequelize[_0x7413('0x2')],'unique':_0x7413('0x4')},'serverUrl':{'type':Sequelize[_0x7413('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4e2e=['username','remoteUri','exports','STRING'];(function(_0x4e3253,_0x49f2cf){var _0x3702a8=function(_0x5d0031){while(--_0x5d0031){_0x4e3253['push'](_0x4e3253['shift']());}};_0x3702a8(++_0x49f2cf);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x5ea5af,_0x1a671e){_0x5ea5af=_0x5ea5af-0x0;var _0x37de8e=_0x4e2e[_0x5ea5af];return _0x37de8e;};'use strict';var Sequelize=require('sequelize');module[_0xe4e2('0x0')]={'name':{'type':Sequelize[_0xe4e2('0x1')]},'description':{'type':Sequelize[_0xe4e2('0x1')]},'username':{'type':Sequelize[_0xe4e2('0x1')],'unique':_0xe4e2('0x2')},'apiKey':{'type':Sequelize[_0xe4e2('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe4e2('0x3')},'serverUrl':{'type':Sequelize[_0xe4e2('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 45eae79..347bfaa 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 _0xff30=['FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','keys','include','options','find','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','Descriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','GET','format','/api/selector/owners','Token\x20token=','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map'];(function(_0x15f447,_0x2e9fd1){var _0x4e5fea=function(_0x51edc8){while(--_0x51edc8){_0x15f447['push'](_0x15f447['shift']());}};_0x4e5fea(++_0x2e9fd1);}(_0xff30,0xa2));var _0x0ff3=function(_0x1ecea4,_0x303ce7){_0x1ecea4=_0x1ecea4-0x0;var _0x51aba6=_0xff30[_0x1ecea4];return _0x51aba6;};'use strict';var emlformat=require(_0x0ff3('0x0'));var rimraf=require(_0x0ff3('0x1'));var zipdir=require(_0x0ff3('0x2'));var jsonpatch=require(_0x0ff3('0x3'));var rp=require(_0x0ff3('0x4'));var moment=require(_0x0ff3('0x5'));var BPromise=require(_0x0ff3('0x6'));var Mustache=require(_0x0ff3('0x7'));var util=require(_0x0ff3('0x8'));var path=require(_0x0ff3('0x9'));var sox=require(_0x0ff3('0xa'));var csv=require(_0x0ff3('0xb'));var ejs=require(_0x0ff3('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0ff3('0xd'));var crypto=require(_0x0ff3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0ff3('0xb'));var querystring=require(_0x0ff3('0xf'));var Papa=require(_0x0ff3('0x10'));var Redis=require(_0x0ff3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0ff3('0x12'));var as=require(_0x0ff3('0x13'));var hardwareService=require(_0x0ff3('0x14'));var logger=require(_0x0ff3('0x15'))(_0x0ff3('0x16'));var utils=require(_0x0ff3('0x17'));var config=require(_0x0ff3('0x18'));var licenseUtil=require(_0x0ff3('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0ff3('0x1a'));function respondWithStatusCode(_0xb74dd3,_0x5f2bc9){_0x5f2bc9=_0x5f2bc9||0xcc;return function(_0x17e81f){if(_0x17e81f){return _0xb74dd3[_0x0ff3('0x1b')](_0x5f2bc9);}return _0xb74dd3[_0x0ff3('0x1c')](_0x5f2bc9)[_0x0ff3('0x1d')]();};}function respondWithResult(_0x313e7e,_0x5ae6a4){_0x5ae6a4=_0x5ae6a4||0xc8;return function(_0x20c1b4){if(_0x20c1b4){return _0x313e7e[_0x0ff3('0x1c')](_0x5ae6a4)[_0x0ff3('0x1e')](_0x20c1b4);}};}function respondWithFilteredResult(_0x4875d4,_0x9a3857){return function(_0xee293b){if(_0xee293b){var _0x2120fa=typeof _0x9a3857[_0x0ff3('0x1f')]===_0x0ff3('0x20')&&typeof _0x9a3857[_0x0ff3('0x21')]===_0x0ff3('0x20');var _0x460574=_0xee293b['count'];var _0x1024e0=_0x2120fa?0x0:_0x9a3857['offset'];var _0x336940=_0x2120fa?_0xee293b['count']:_0x9a3857[_0x0ff3('0x1f')]+_0x9a3857[_0x0ff3('0x21')];var _0x3e6689;if(_0x336940>=_0x460574){_0x336940=_0x460574;_0x3e6689=0xc8;}else{_0x3e6689=0xce;}_0x4875d4[_0x0ff3('0x1c')](_0x3e6689);return _0x4875d4['set'](_0x0ff3('0x22'),_0x1024e0+'-'+_0x336940+'/'+_0x460574)[_0x0ff3('0x1e')](_0xee293b);}return null;};}function patchUpdates(_0x2c5140){return function(_0x15ba6c){try{jsonpatch[_0x0ff3('0x23')](_0x15ba6c,_0x2c5140,!![]);}catch(_0xdc6a93){return BPromise[_0x0ff3('0x24')](_0xdc6a93);}return _0x15ba6c[_0x0ff3('0x25')]();};}function saveUpdates(_0x3d3034,_0x38b622){return function(_0x4c3fcf){if(_0x4c3fcf){return _0x4c3fcf['update'](_0x3d3034)['then'](function(_0x2a189f){return _0x2a189f;});}return null;};}function removeEntity(_0x3fb30f,_0x598c45){return function(_0x3fbb4d){if(_0x3fbb4d){return _0x3fbb4d[_0x0ff3('0x26')]()[_0x0ff3('0x27')](function(){_0x3fb30f[_0x0ff3('0x1c')](0xcc)[_0x0ff3('0x1d')]();});}};}function handleEntityNotFound(_0x30c236,_0x548079){return function(_0x5663cd){if(!_0x5663cd){_0x30c236[_0x0ff3('0x1b')](0x194);}return _0x5663cd;};}function handleError(_0x91537b,_0x36bb2d){_0x36bb2d=_0x36bb2d||0x1f4;return function(_0x5792d6){logger[_0x0ff3('0x28')](_0x5792d6[_0x0ff3('0x29')]);if(_0x5792d6[_0x0ff3('0x2a')]){delete _0x5792d6[_0x0ff3('0x2a')];}_0x91537b['status'](_0x36bb2d)[_0x0ff3('0x2b')](_0x5792d6);};}exports[_0x0ff3('0x2c')]=function(_0x4c77ec,_0x5c7bff){var _0x15e2cf={},_0x1a129c={},_0x139360={'count':0x0,'rows':[]};var _0x4b4c38=_[_0x0ff3('0x2d')](db[_0x0ff3('0x2e')][_0x0ff3('0x2f')],function(_0xc11104){return{'name':_0xc11104[_0x0ff3('0x30')],'type':_0xc11104[_0x0ff3('0x31')][_0x0ff3('0x32')]};});_0x1a129c[_0x0ff3('0x33')]=_[_0x0ff3('0x2d')](_0x4b4c38,_0x0ff3('0x2a'));_0x1a129c[_0x0ff3('0x34')]=_['keys'](_0x4c77ec[_0x0ff3('0x34')]);_0x1a129c[_0x0ff3('0x35')]=_[_0x0ff3('0x36')](_0x1a129c[_0x0ff3('0x33')],_0x1a129c[_0x0ff3('0x34')]);_0x15e2cf[_0x0ff3('0x37')]=_[_0x0ff3('0x36')](_0x1a129c[_0x0ff3('0x33')],qs['fields'](_0x4c77ec[_0x0ff3('0x34')][_0x0ff3('0x38')]));_0x15e2cf[_0x0ff3('0x37')]=_0x15e2cf['attributes'][_0x0ff3('0x39')]?_0x15e2cf[_0x0ff3('0x37')]:_0x1a129c[_0x0ff3('0x33')];if(!_0x4c77ec[_0x0ff3('0x34')][_0x0ff3('0x3a')](_0x0ff3('0x3b'))){_0x15e2cf[_0x0ff3('0x21')]=qs[_0x0ff3('0x21')](_0x4c77ec['query'][_0x0ff3('0x21')]);_0x15e2cf['offset']=qs[_0x0ff3('0x1f')](_0x4c77ec[_0x0ff3('0x34')][_0x0ff3('0x1f')]);}_0x15e2cf[_0x0ff3('0x3c')]=qs[_0x0ff3('0x3d')](_0x4c77ec['query'][_0x0ff3('0x3d')]);_0x15e2cf[_0x0ff3('0x3e')]=qs[_0x0ff3('0x35')](_[_0x0ff3('0x3f')](_0x4c77ec[_0x0ff3('0x34')],_0x1a129c[_0x0ff3('0x35')]),_0x4b4c38);if(_0x4c77ec[_0x0ff3('0x34')][_0x0ff3('0x40')]){_0x15e2cf[_0x0ff3('0x3e')]=_[_0x0ff3('0x41')](_0x15e2cf[_0x0ff3('0x3e')],{'$or':_['map'](_0x4b4c38,function(_0x12d590){if(_0x12d590[_0x0ff3('0x31')]!==_0x0ff3('0x42')){var _0x8b04c8={};_0x8b04c8[_0x12d590[_0x0ff3('0x2a')]]={'$like':'%'+_0x4c77ec[_0x0ff3('0x34')][_0x0ff3('0x40')]+'%'};return _0x8b04c8;}})});}_0x15e2cf=_['merge']({},_0x15e2cf,_0x4c77ec['options']);var _0x266f39={'where':_0x15e2cf[_0x0ff3('0x3e')]};return db[_0x0ff3('0x2e')][_0x0ff3('0x43')](_0x266f39)['then'](function(_0x8dd99c){_0x139360[_0x0ff3('0x43')]=_0x8dd99c;if(_0x4c77ec[_0x0ff3('0x34')]['includeAll']){_0x15e2cf['include']=[{'all':!![]}];}return db[_0x0ff3('0x2e')][_0x0ff3('0x44')](_0x15e2cf);})[_0x0ff3('0x27')](function(_0xb06f80){_0x139360[_0x0ff3('0x45')]=_0xb06f80;return _0x139360;})['then'](respondWithFilteredResult(_0x5c7bff,_0x15e2cf))[_0x0ff3('0x46')](handleError(_0x5c7bff,null));};exports[_0x0ff3('0x47')]=function(_0x4f5b04,_0x4fd45f){var _0x2ca6af={'raw':![],'where':{'id':_0x4f5b04[_0x0ff3('0x48')]['id']}},_0x5c3e7e={};_0x5c3e7e[_0x0ff3('0x33')]=_['keys'](db[_0x0ff3('0x2e')]['rawAttributes']);_0x5c3e7e[_0x0ff3('0x34')]=_[_0x0ff3('0x49')](_0x4f5b04['query']);_0x5c3e7e[_0x0ff3('0x35')]=_[_0x0ff3('0x36')](_0x5c3e7e['model'],_0x5c3e7e[_0x0ff3('0x34')]);_0x2ca6af['attributes']=_[_0x0ff3('0x36')](_0x5c3e7e[_0x0ff3('0x33')],qs[_0x0ff3('0x38')](_0x4f5b04[_0x0ff3('0x34')][_0x0ff3('0x38')]));_0x2ca6af[_0x0ff3('0x37')]=_0x2ca6af[_0x0ff3('0x37')]['length']?_0x2ca6af[_0x0ff3('0x37')]:_0x5c3e7e[_0x0ff3('0x33')];if(_0x4f5b04['query']['includeAll']){_0x2ca6af[_0x0ff3('0x4a')]=[{'all':!![]}];}_0x2ca6af=_[_0x0ff3('0x41')]({},_0x2ca6af,_0x4f5b04[_0x0ff3('0x4b')]);return db[_0x0ff3('0x2e')][_0x0ff3('0x4c')](_0x2ca6af)['then'](handleEntityNotFound(_0x4fd45f,null))[_0x0ff3('0x27')](respondWithResult(_0x4fd45f,null))['catch'](handleError(_0x4fd45f,null));};exports['create']=function(_0x456b68,_0xe3a7c1){return db['FreshsalesAccount'][_0x0ff3('0x4d')](_0x456b68[_0x0ff3('0x4e')],{})[_0x0ff3('0x27')](respondWithResult(_0xe3a7c1,0xc9))[_0x0ff3('0x46')](handleError(_0xe3a7c1,null));};exports[_0x0ff3('0x4f')]=function(_0x5ef907,_0x250c2b){if(_0x5ef907['body']['id']){delete _0x5ef907[_0x0ff3('0x4e')]['id'];}return db[_0x0ff3('0x2e')]['find']({'where':{'id':_0x5ef907[_0x0ff3('0x48')]['id']}})['then'](handleEntityNotFound(_0x250c2b,null))['then'](saveUpdates(_0x5ef907[_0x0ff3('0x4e')],null))['then'](respondWithResult(_0x250c2b,null))['catch'](handleError(_0x250c2b,null));};exports['destroy']=function(_0x3bc1f9,_0x3a1503){return db[_0x0ff3('0x2e')]['find']({'where':{'id':_0x3bc1f9[_0x0ff3('0x48')]['id']}})[_0x0ff3('0x27')](handleEntityNotFound(_0x3a1503,null))['then'](removeEntity(_0x3a1503,null))[_0x0ff3('0x46')](handleError(_0x3a1503,null));};exports[_0x0ff3('0x50')]=function(_0x2376fa,_0x7fd51d,_0x2d8bed){var _0x7842b2={};var _0x221ed={};var _0x5d6229;var _0x5a1758;return db[_0x0ff3('0x2e')][_0x0ff3('0x51')]({'where':{'id':_0x2376fa[_0x0ff3('0x48')]['id']}})['then'](handleEntityNotFound(_0x7fd51d,null))[_0x0ff3('0x27')](function(_0x16566c){if(_0x16566c){_0x5d6229=_0x16566c;_0x221ed[_0x0ff3('0x33')]=_[_0x0ff3('0x49')](db[_0x0ff3('0x52')][_0x0ff3('0x2f')]);_0x221ed[_0x0ff3('0x34')]=_[_0x0ff3('0x49')](_0x2376fa[_0x0ff3('0x34')]);_0x221ed[_0x0ff3('0x35')]=_[_0x0ff3('0x36')](_0x221ed[_0x0ff3('0x33')],_0x221ed[_0x0ff3('0x34')]);_0x7842b2[_0x0ff3('0x37')]=_[_0x0ff3('0x36')](_0x221ed['model'],qs[_0x0ff3('0x38')](_0x2376fa[_0x0ff3('0x34')]['fields']));_0x7842b2[_0x0ff3('0x37')]=_0x7842b2['attributes'][_0x0ff3('0x39')]?_0x7842b2[_0x0ff3('0x37')]:_0x221ed[_0x0ff3('0x33')];_0x7842b2[_0x0ff3('0x3c')]=qs['sort'](_0x2376fa[_0x0ff3('0x34')][_0x0ff3('0x3d')]);_0x7842b2[_0x0ff3('0x3e')]=qs[_0x0ff3('0x35')](_[_0x0ff3('0x3f')](_0x2376fa[_0x0ff3('0x34')],_0x221ed[_0x0ff3('0x35')]));if(_0x2376fa[_0x0ff3('0x34')][_0x0ff3('0x40')]){_0x7842b2[_0x0ff3('0x3e')]=_['merge'](_0x7842b2[_0x0ff3('0x3e')],{'$or':_[_0x0ff3('0x2d')](_0x7842b2[_0x0ff3('0x37')],function(_0x45bb92){var _0x1550f9={};_0x1550f9[_0x45bb92]={'$like':'%'+_0x2376fa[_0x0ff3('0x34')][_0x0ff3('0x40')]+'%'};return _0x1550f9;})});}_0x7842b2=_[_0x0ff3('0x41')]({},_0x7842b2,_0x2376fa[_0x0ff3('0x4b')]);return _0x5d6229[_0x0ff3('0x50')](_0x7842b2);}})[_0x0ff3('0x27')](function(_0x358c68){if(_0x358c68){_0x5a1758=_0x358c68['length'];if(!_0x2376fa[_0x0ff3('0x34')][_0x0ff3('0x3a')](_0x0ff3('0x3b'))){_0x7842b2[_0x0ff3('0x21')]=qs[_0x0ff3('0x21')](_0x2376fa[_0x0ff3('0x34')][_0x0ff3('0x21')]);_0x7842b2[_0x0ff3('0x1f')]=qs[_0x0ff3('0x1f')](_0x2376fa[_0x0ff3('0x34')][_0x0ff3('0x1f')]);}return _0x5d6229['getConfigurations'](_0x7842b2);}})['then'](function(_0x8ed4f2){if(_0x8ed4f2){return _0x8ed4f2?{'count':_0x5a1758,'rows':_0x8ed4f2}:null;}})[_0x0ff3('0x27')](respondWithResult(_0x7fd51d,null))[_0x0ff3('0x46')](handleError(_0x7fd51d,null));};exports[_0x0ff3('0x53')]=function(_0x2c33b0,_0x837676,_0x3c8280){if(_0x2c33b0[_0x0ff3('0x4e')]['id']){delete _0x2c33b0[_0x0ff3('0x4e')]['id'];}return db[_0x0ff3('0x2e')]['findOne']({'where':{'id':_0x2c33b0['params']['id']}})[_0x0ff3('0x27')](handleEntityNotFound(_0x837676,null))[_0x0ff3('0x27')](function(_0x36669c){if(_0x36669c){_0x2c33b0[_0x0ff3('0x4e')][_0x0ff3('0x54')]=_0x36669c['id'];_0x2c33b0[_0x0ff3('0x4e')][_0x0ff3('0x55')]=integrations['getSubjects'](_0x2c33b0[_0x0ff3('0x4e')]['channel'],_0x2c33b0['body']['type']);_0x2c33b0[_0x0ff3('0x4e')][_0x0ff3('0x56')]=integrations['getDescriptions'](_0x2c33b0['body'][_0x0ff3('0x57')],_0x2c33b0['body'][_0x0ff3('0x31')]);return db[_0x0ff3('0x52')][_0x0ff3('0x4d')](_0x2c33b0['body'],{'include':[{'model':db[_0x0ff3('0x58')],'as':'Subjects'},{'model':db[_0x0ff3('0x58')],'as':'Descriptions'}]});}return null;})[_0x0ff3('0x27')](respondWithResult(_0x837676,null))[_0x0ff3('0x46')](handleError(_0x837676,null));};exports[_0x0ff3('0x59')]=function(_0x12c8a7,_0x1f19bc,_0x1b779c){var _0x17fed2='';var _0x19ae87='';return db[_0x0ff3('0x2e')][_0x0ff3('0x51')]({'where':{'id':_0x12c8a7[_0x0ff3('0x48')]['id']},'attributes':['id',_0x0ff3('0x5a'),_0x0ff3('0x5b'),_0x0ff3('0x5c')]})[_0x0ff3('0x27')](handleEntityNotFound(_0x1f19bc,null))[_0x0ff3('0x27')](function(_0x29ead9){if(_0x29ead9){_0x19ae87=_0x29ead9[_0x0ff3('0x5a')];_0x17fed2=_0x29ead9['remoteUri'];var _0x427b99=_0x29ead9[_0x0ff3('0x5b')][_0x0ff3('0x5d')](-0x1);if(_0x427b99==='/'){_0x17fed2=_0x17fed2[_0x0ff3('0x5e')](0x0,_0x17fed2['lastIndexOf'](_0x427b99));}return rp({'method':_0x0ff3('0x5f'),'uri':util[_0x0ff3('0x60')]('%s%s',_0x17fed2,_0x0ff3('0x61')),'headers':{'Authorization':_0x0ff3('0x62')+_0x29ead9[_0x0ff3('0x5c')]},'json':!![]});}})['then'](function(_0x43daf7){if(_0x43daf7){var _0x16e145=_0x43daf7['users'];var _0xcf80e8=![];var _0x1cac2e=null;for(_0x1cac2e=0x0;_0x1cac2e<_0x16e145[_0x0ff3('0x39')];_0x1cac2e++){if(_0x16e145[_0x1cac2e]['email']===_0x19ae87){_0xcf80e8=!![];}}if(_0xcf80e8){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0ff3('0x63')});}}})['then'](respondWithResult(_0x1f19bc,null))['catch'](function(_0x198269){var _0x5185e7=_0x12c8a7[_0x0ff3('0x34')][_0x0ff3('0x64')]?0x1f4:_0x198269[_0x0ff3('0x65')]||0x1f4;logger[_0x0ff3('0x28')](_0x0ff3('0x66'),_0x0ff3('0x59'),_0x5185e7,JSON[_0x0ff3('0x67')](_0x198269));delete _0x198269[_0x0ff3('0x2a')];if(_0x5185e7===0x191){_0x5185e7=0x190;}_0x1f19bc[_0x0ff3('0x1c')](_0x5185e7)[_0x0ff3('0x2b')](_0x12c8a7[_0x0ff3('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x198269[_0x0ff3('0x65')]}:_0x198269);});}; \ No newline at end of file +var _0xc573=['show','params','keys','options','find','create','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','GET','format','/api/selector/owners','users','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','limit','Content-Range','reject','save','update','then','sendStatus','error','stack','name','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch'];(function(_0x1fc77a,_0x3102c0){var _0x1f41d0=function(_0x8f1d5d){while(--_0x8f1d5d){_0x1fc77a['push'](_0x1fc77a['shift']());}};_0x1f41d0(++_0x3102c0);}(_0xc573,0x1c0));var _0x3c57=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xc573[_0x5834bc];return _0x3e183a;};'use strict';var emlformat=require(_0x3c57('0x0'));var rimraf=require(_0x3c57('0x1'));var zipdir=require(_0x3c57('0x2'));var jsonpatch=require(_0x3c57('0x3'));var rp=require(_0x3c57('0x4'));var moment=require(_0x3c57('0x5'));var BPromise=require(_0x3c57('0x6'));var Mustache=require(_0x3c57('0x7'));var util=require(_0x3c57('0x8'));var path=require(_0x3c57('0x9'));var sox=require('sox');var csv=require(_0x3c57('0xa'));var ejs=require(_0x3c57('0xb'));var fs=require('fs');var fs_extra=require(_0x3c57('0xc'));var _=require('lodash');var squel=require(_0x3c57('0xd'));var crypto=require(_0x3c57('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3c57('0xa'));var querystring=require('querystring');var Papa=require(_0x3c57('0xf'));var Redis=require(_0x3c57('0x10'));var authService=require(_0x3c57('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3c57('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c57('0x13'))(_0x3c57('0x14'));var utils=require(_0x3c57('0x15'));var config=require(_0x3c57('0x16'));var licenseUtil=require(_0x3c57('0x17'));var db=require(_0x3c57('0x18'))['db'];var integrations=require(_0x3c57('0x19'));function respondWithStatusCode(_0x5ebdc2,_0x5ddc6e){_0x5ddc6e=_0x5ddc6e||0xcc;return function(_0x326336){if(_0x326336){return _0x5ebdc2['sendStatus'](_0x5ddc6e);}return _0x5ebdc2['status'](_0x5ddc6e)[_0x3c57('0x1a')]();};}function respondWithResult(_0x397255,_0x455df0){_0x455df0=_0x455df0||0xc8;return function(_0x48a1be){if(_0x48a1be){return _0x397255[_0x3c57('0x1b')](_0x455df0)[_0x3c57('0x1c')](_0x48a1be);}};}function respondWithFilteredResult(_0x34b532,_0x3ae311){return function(_0x154c1b){if(_0x154c1b){var _0x1e3d7b=typeof _0x3ae311[_0x3c57('0x1d')]===_0x3c57('0x1e')&&typeof _0x3ae311[_0x3c57('0x1f')]===_0x3c57('0x1e');var _0x4421d6=_0x154c1b['count'];var _0x20bfa5=_0x1e3d7b?0x0:_0x3ae311[_0x3c57('0x1d')];var _0x58b1d2=_0x1e3d7b?_0x154c1b['count']:_0x3ae311[_0x3c57('0x1d')]+_0x3ae311[_0x3c57('0x1f')];var _0x2924e6;if(_0x58b1d2>=_0x4421d6){_0x58b1d2=_0x4421d6;_0x2924e6=0xc8;}else{_0x2924e6=0xce;}_0x34b532[_0x3c57('0x1b')](_0x2924e6);return _0x34b532['set'](_0x3c57('0x20'),_0x20bfa5+'-'+_0x58b1d2+'/'+_0x4421d6)[_0x3c57('0x1c')](_0x154c1b);}return null;};}function patchUpdates(_0x1a5dff){return function(_0x24f1bc){try{jsonpatch['apply'](_0x24f1bc,_0x1a5dff,!![]);}catch(_0x2494e8){return BPromise[_0x3c57('0x21')](_0x2494e8);}return _0x24f1bc[_0x3c57('0x22')]();};}function saveUpdates(_0x39d159,_0x59b05f){return function(_0x2c39c5){if(_0x2c39c5){return _0x2c39c5[_0x3c57('0x23')](_0x39d159)[_0x3c57('0x24')](function(_0x2c3349){return _0x2c3349;});}return null;};}function removeEntity(_0x596c31,_0x21fb23){return function(_0x9c112b){if(_0x9c112b){return _0x9c112b['destroy']()['then'](function(){_0x596c31[_0x3c57('0x1b')](0xcc)[_0x3c57('0x1a')]();});}};}function handleEntityNotFound(_0x4289a2,_0x3b664d){return function(_0x34e494){if(!_0x34e494){_0x4289a2[_0x3c57('0x25')](0x194);}return _0x34e494;};}function handleError(_0xceadab,_0xeace7b){_0xeace7b=_0xeace7b||0x1f4;return function(_0x524364){logger[_0x3c57('0x26')](_0x524364[_0x3c57('0x27')]);if(_0x524364[_0x3c57('0x28')]){delete _0x524364[_0x3c57('0x28')];}_0xceadab[_0x3c57('0x1b')](_0xeace7b)['send'](_0x524364);};}exports['index']=function(_0x349097,_0x50b7d2){var _0x4c31fc={},_0xdf3b6f={},_0x50c743={'count':0x0,'rows':[]};var _0x494303=_[_0x3c57('0x29')](db[_0x3c57('0x2a')][_0x3c57('0x2b')],function(_0x2a1231){return{'name':_0x2a1231[_0x3c57('0x2c')],'type':_0x2a1231[_0x3c57('0x2d')][_0x3c57('0x2e')]};});_0xdf3b6f[_0x3c57('0x2f')]=_[_0x3c57('0x29')](_0x494303,_0x3c57('0x28'));_0xdf3b6f[_0x3c57('0x30')]=_['keys'](_0x349097[_0x3c57('0x30')]);_0xdf3b6f[_0x3c57('0x31')]=_['intersection'](_0xdf3b6f[_0x3c57('0x2f')],_0xdf3b6f['query']);_0x4c31fc[_0x3c57('0x32')]=_[_0x3c57('0x33')](_0xdf3b6f['model'],qs[_0x3c57('0x34')](_0x349097['query'][_0x3c57('0x34')]));_0x4c31fc[_0x3c57('0x32')]=_0x4c31fc[_0x3c57('0x32')][_0x3c57('0x35')]?_0x4c31fc[_0x3c57('0x32')]:_0xdf3b6f['model'];if(!_0x349097[_0x3c57('0x30')][_0x3c57('0x36')]('nolimit')){_0x4c31fc[_0x3c57('0x1f')]=qs[_0x3c57('0x1f')](_0x349097[_0x3c57('0x30')][_0x3c57('0x1f')]);_0x4c31fc[_0x3c57('0x1d')]=qs[_0x3c57('0x1d')](_0x349097[_0x3c57('0x30')][_0x3c57('0x1d')]);}_0x4c31fc[_0x3c57('0x37')]=qs['sort'](_0x349097[_0x3c57('0x30')][_0x3c57('0x38')]);_0x4c31fc[_0x3c57('0x39')]=qs[_0x3c57('0x31')](_[_0x3c57('0x3a')](_0x349097[_0x3c57('0x30')],_0xdf3b6f['filters']),_0x494303);if(_0x349097['query'][_0x3c57('0x3b')]){_0x4c31fc[_0x3c57('0x39')]=_[_0x3c57('0x3c')](_0x4c31fc['where'],{'$or':_[_0x3c57('0x29')](_0x494303,function(_0x34dc23){if(_0x34dc23['type']!=='VIRTUAL'){var _0x59b9ed={};_0x59b9ed[_0x34dc23[_0x3c57('0x28')]]={'$like':'%'+_0x349097[_0x3c57('0x30')]['filter']+'%'};return _0x59b9ed;}})});}_0x4c31fc=_[_0x3c57('0x3c')]({},_0x4c31fc,_0x349097['options']);var _0x3a2c8e={'where':_0x4c31fc['where']};return db[_0x3c57('0x2a')][_0x3c57('0x3d')](_0x3a2c8e)['then'](function(_0x35602f){_0x50c743[_0x3c57('0x3d')]=_0x35602f;if(_0x349097['query'][_0x3c57('0x3e')]){_0x4c31fc[_0x3c57('0x3f')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x3c57('0x40')](_0x4c31fc);})[_0x3c57('0x24')](function(_0x394a66){_0x50c743[_0x3c57('0x41')]=_0x394a66;return _0x50c743;})[_0x3c57('0x24')](respondWithFilteredResult(_0x50b7d2,_0x4c31fc))[_0x3c57('0x42')](handleError(_0x50b7d2,null));};exports[_0x3c57('0x43')]=function(_0x26bc1e,_0x37a414){var _0x20143a={'raw':![],'where':{'id':_0x26bc1e[_0x3c57('0x44')]['id']}},_0x16c7d5={};_0x16c7d5[_0x3c57('0x2f')]=_['keys'](db[_0x3c57('0x2a')][_0x3c57('0x2b')]);_0x16c7d5[_0x3c57('0x30')]=_[_0x3c57('0x45')](_0x26bc1e[_0x3c57('0x30')]);_0x16c7d5['filters']=_['intersection'](_0x16c7d5[_0x3c57('0x2f')],_0x16c7d5[_0x3c57('0x30')]);_0x20143a[_0x3c57('0x32')]=_['intersection'](_0x16c7d5[_0x3c57('0x2f')],qs[_0x3c57('0x34')](_0x26bc1e[_0x3c57('0x30')][_0x3c57('0x34')]));_0x20143a[_0x3c57('0x32')]=_0x20143a['attributes']['length']?_0x20143a[_0x3c57('0x32')]:_0x16c7d5[_0x3c57('0x2f')];if(_0x26bc1e[_0x3c57('0x30')][_0x3c57('0x3e')]){_0x20143a['include']=[{'all':!![]}];}_0x20143a=_[_0x3c57('0x3c')]({},_0x20143a,_0x26bc1e[_0x3c57('0x46')]);return db[_0x3c57('0x2a')][_0x3c57('0x47')](_0x20143a)[_0x3c57('0x24')](handleEntityNotFound(_0x37a414,null))[_0x3c57('0x24')](respondWithResult(_0x37a414,null))[_0x3c57('0x42')](handleError(_0x37a414,null));};exports[_0x3c57('0x48')]=function(_0x28691b,_0x53f71c){return db[_0x3c57('0x2a')][_0x3c57('0x48')](_0x28691b[_0x3c57('0x49')],{})[_0x3c57('0x24')](respondWithResult(_0x53f71c,0xc9))[_0x3c57('0x42')](handleError(_0x53f71c,null));};exports[_0x3c57('0x23')]=function(_0x5c0aeb,_0x1708dc){if(_0x5c0aeb[_0x3c57('0x49')]['id']){delete _0x5c0aeb[_0x3c57('0x49')]['id'];}return db[_0x3c57('0x2a')][_0x3c57('0x47')]({'where':{'id':_0x5c0aeb[_0x3c57('0x44')]['id']}})['then'](handleEntityNotFound(_0x1708dc,null))[_0x3c57('0x24')](saveUpdates(_0x5c0aeb[_0x3c57('0x49')],null))[_0x3c57('0x24')](respondWithResult(_0x1708dc,null))[_0x3c57('0x42')](handleError(_0x1708dc,null));};exports[_0x3c57('0x4a')]=function(_0x1f9896,_0x5342c8){return db[_0x3c57('0x2a')]['find']({'where':{'id':_0x1f9896[_0x3c57('0x44')]['id']}})[_0x3c57('0x24')](handleEntityNotFound(_0x5342c8,null))[_0x3c57('0x24')](removeEntity(_0x5342c8,null))['catch'](handleError(_0x5342c8,null));};exports[_0x3c57('0x4b')]=function(_0x18231d,_0x4c9cd8,_0x34f7c0){var _0x51ec58={};var _0x323f21={};var _0x123ae9;var _0x5e3ef6;return db[_0x3c57('0x2a')][_0x3c57('0x4c')]({'where':{'id':_0x18231d['params']['id']}})[_0x3c57('0x24')](handleEntityNotFound(_0x4c9cd8,null))[_0x3c57('0x24')](function(_0x3787b4){if(_0x3787b4){_0x123ae9=_0x3787b4;_0x323f21['model']=_['keys'](db[_0x3c57('0x4d')][_0x3c57('0x2b')]);_0x323f21[_0x3c57('0x30')]=_[_0x3c57('0x45')](_0x18231d[_0x3c57('0x30')]);_0x323f21['filters']=_[_0x3c57('0x33')](_0x323f21[_0x3c57('0x2f')],_0x323f21['query']);_0x51ec58['attributes']=_[_0x3c57('0x33')](_0x323f21['model'],qs[_0x3c57('0x34')](_0x18231d[_0x3c57('0x30')]['fields']));_0x51ec58['attributes']=_0x51ec58[_0x3c57('0x32')]['length']?_0x51ec58[_0x3c57('0x32')]:_0x323f21['model'];_0x51ec58['order']=qs[_0x3c57('0x38')](_0x18231d[_0x3c57('0x30')][_0x3c57('0x38')]);_0x51ec58['where']=qs[_0x3c57('0x31')](_[_0x3c57('0x3a')](_0x18231d[_0x3c57('0x30')],_0x323f21['filters']));if(_0x18231d[_0x3c57('0x30')][_0x3c57('0x3b')]){_0x51ec58[_0x3c57('0x39')]=_['merge'](_0x51ec58[_0x3c57('0x39')],{'$or':_[_0x3c57('0x29')](_0x51ec58[_0x3c57('0x32')],function(_0xea9f36){var _0x4902e4={};_0x4902e4[_0xea9f36]={'$like':'%'+_0x18231d['query']['filter']+'%'};return _0x4902e4;})});}_0x51ec58=_['merge']({},_0x51ec58,_0x18231d[_0x3c57('0x46')]);return _0x123ae9[_0x3c57('0x4b')](_0x51ec58);}})['then'](function(_0x49c359){if(_0x49c359){_0x5e3ef6=_0x49c359[_0x3c57('0x35')];if(!_0x18231d[_0x3c57('0x30')]['hasOwnProperty'](_0x3c57('0x4e'))){_0x51ec58['limit']=qs[_0x3c57('0x1f')](_0x18231d['query'][_0x3c57('0x1f')]);_0x51ec58[_0x3c57('0x1d')]=qs[_0x3c57('0x1d')](_0x18231d[_0x3c57('0x30')][_0x3c57('0x1d')]);}return _0x123ae9[_0x3c57('0x4b')](_0x51ec58);}})[_0x3c57('0x24')](function(_0x34ecad){if(_0x34ecad){return _0x34ecad?{'count':_0x5e3ef6,'rows':_0x34ecad}:null;}})[_0x3c57('0x24')](respondWithResult(_0x4c9cd8,null))[_0x3c57('0x42')](handleError(_0x4c9cd8,null));};exports[_0x3c57('0x4f')]=function(_0x90320d,_0x4f105d,_0xcd995b){if(_0x90320d[_0x3c57('0x49')]['id']){delete _0x90320d[_0x3c57('0x49')]['id'];}return db[_0x3c57('0x2a')][_0x3c57('0x4c')]({'where':{'id':_0x90320d[_0x3c57('0x44')]['id']}})[_0x3c57('0x24')](handleEntityNotFound(_0x4f105d,null))[_0x3c57('0x24')](function(_0x2a7cfe){if(_0x2a7cfe){_0x90320d[_0x3c57('0x49')][_0x3c57('0x50')]=_0x2a7cfe['id'];_0x90320d[_0x3c57('0x49')][_0x3c57('0x51')]=integrations[_0x3c57('0x52')](_0x90320d['body'][_0x3c57('0x53')],_0x90320d[_0x3c57('0x49')]['type']);_0x90320d[_0x3c57('0x49')][_0x3c57('0x54')]=integrations[_0x3c57('0x55')](_0x90320d['body'][_0x3c57('0x53')],_0x90320d['body'][_0x3c57('0x2d')]);return db[_0x3c57('0x4d')]['create'](_0x90320d['body'],{'include':[{'model':db[_0x3c57('0x56')],'as':'Subjects'},{'model':db[_0x3c57('0x56')],'as':_0x3c57('0x54')}]});}return null;})[_0x3c57('0x24')](respondWithResult(_0x4f105d,null))[_0x3c57('0x42')](handleError(_0x4f105d,null));};exports[_0x3c57('0x57')]=function(_0x232ce1,_0x306490,_0x15f95c){var _0x43082b='';var _0xf338d4='';return db[_0x3c57('0x2a')][_0x3c57('0x4c')]({'where':{'id':_0x232ce1[_0x3c57('0x44')]['id']},'attributes':['id',_0x3c57('0x58'),_0x3c57('0x59'),_0x3c57('0x5a')]})[_0x3c57('0x24')](handleEntityNotFound(_0x306490,null))['then'](function(_0x2c92e9){if(_0x2c92e9){_0xf338d4=_0x2c92e9[_0x3c57('0x58')];_0x43082b=_0x2c92e9[_0x3c57('0x59')];var _0x14818d=_0x2c92e9['remoteUri'][_0x3c57('0x5b')](-0x1);if(_0x14818d==='/'){_0x43082b=_0x43082b[_0x3c57('0x5c')](0x0,_0x43082b['lastIndexOf'](_0x14818d));}return rp({'method':_0x3c57('0x5d'),'uri':util[_0x3c57('0x5e')]('%s%s',_0x43082b,_0x3c57('0x5f')),'headers':{'Authorization':'Token\x20token='+_0x2c92e9[_0x3c57('0x5a')]},'json':!![]});}})[_0x3c57('0x24')](function(_0x1acc39){if(_0x1acc39){var _0x31041d=_0x1acc39[_0x3c57('0x60')];var _0x230ada=![];var _0xdabe2f=null;for(_0xdabe2f=0x0;_0xdabe2f<_0x31041d[_0x3c57('0x35')];_0xdabe2f++){if(_0x31041d[_0xdabe2f]['email']===_0xf338d4){_0x230ada=!![];}}if(_0x230ada){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x3c57('0x24')](respondWithResult(_0x306490,null))['catch'](function(_0x46015e){var _0xaefdd5=_0x232ce1[_0x3c57('0x30')]['test']?0x1f4:_0x46015e[_0x3c57('0x61')]||0x1f4;logger['error'](_0x3c57('0x62'),_0x3c57('0x57'),_0xaefdd5,JSON[_0x3c57('0x63')](_0x46015e));delete _0x46015e[_0x3c57('0x28')];if(_0xaefdd5===0x191){_0xaefdd5=0x190;}_0x306490[_0x3c57('0x1b')](_0xaefdd5)[_0x3c57('0x64')](_0x232ce1[_0x3c57('0x30')][_0x3c57('0x65')]?{'message':_0x3c57('0x66'),'statusCode':_0x46015e['statusCode']}:_0x46015e);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 454dd89..5f0edc4 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 _0x187d=['exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x192b7d,_0x3db1eb){var _0x57e19a=function(_0x15287d){while(--_0x15287d){_0x192b7d['push'](_0x192b7d['shift']());}};_0x57e19a(++_0x3db1eb);}(_0x187d,0x93));var _0xd187=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x187d[_0x491a7f];return _0x3d8f44;};'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 _0x2542=['api','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger'];(function(_0x1c2e5e,_0x27ac20){var _0x12d9bb=function(_0x16f179){while(--_0x16f179){_0x1c2e5e['push'](_0x1c2e5e['shift']());}};_0x12d9bb(++_0x27ac20);}(_0x2542,0x169));var _0x2254=function(_0x521024,_0xc15041){_0x521024=_0x521024-0x0;var _0x1bf010=_0x2542[_0x521024];return _0x1bf010;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));var integrations=require(_0x2254('0x9'));module['exports']=function(_0x19ad3c,_0xe8ca50){return _0x19ad3c[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('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 2760b1c..84e2b9b 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 _0x9536=['code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9536,0x179));var _0x6953=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9536[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});}exports[_0x6953('0x17')]=function(_0x2da771){var _0x4b43ae=this;return new Promise(function(_0x10858a,_0x3207dd){return db[_0x6953('0x18')][_0x6953('0x19')]({'raw':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1b')]===undefined?!![]:![]:!![],'where':_0x2da771[_0x6953('0x1a')]?_0x2da771[_0x6953('0x1a')][_0x6953('0x1c')]||null:null,'attributes':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1d')]||null:null,'limit':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1e')]||null:null,'include':_0x2da771[_0x6953('0x1a')]?_0x2da771[_0x6953('0x1a')][_0x6953('0x1f')]?_['map'](_0x2da771[_0x6953('0x1a')][_0x6953('0x1f')],function(_0x2a7f6a){return{'model':db[_0x2a7f6a['model']],'as':_0x2a7f6a['as'],'attributes':_0x2a7f6a['attributes'],'include':_0x2a7f6a['include']?_[_0x6953('0x20')](_0x2a7f6a[_0x6953('0x1f')],function(_0x550be4){return{'model':db[_0x550be4[_0x6953('0x21')]],'as':_0x550be4['as'],'attributes':_0x550be4['attributes'],'include':_0x550be4[_0x6953('0x1f')]?_[_0x6953('0x20')](_0x550be4[_0x6953('0x1f')],function(_0x2cc01e){return{'model':db[_0x2cc01e[_0x6953('0x21')]],'as':_0x2cc01e['as'],'attributes':_0x2cc01e[_0x6953('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dd890){logger[_0x6953('0x15')]('GetFreshsalesAccount',_0x2da771);logger[_0x6953('0xf')]('GetFreshsalesAccount',_0x2da771,JSON[_0x6953('0x11')](_0x3dd890));_0x10858a(_0x3dd890);})[_0x6953('0x16')](function(_0x426c7c){logger['error'](_0x6953('0x17'),_0x426c7c[_0x6953('0x14')],_0x2da771);_0x3207dd(_0x4b43ae[_0x6953('0x12')](0x1f4,_0x426c7c['message']));});});};exports[_0x6953('0x22')]=function(_0x132a71){var _0x481c6a=this;return new Promise(function(_0x4d856d,_0xd80e42){return db[_0x6953('0x18')][_0x6953('0x23')]({'raw':_0x132a71[_0x6953('0x1a')]?_0x132a71[_0x6953('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x132a71[_0x6953('0x1a')]?_0x132a71['options'][_0x6953('0x1c')]||null:null,'attributes':_0x132a71[_0x6953('0x1a')]?_0x132a71['options']['attributes']||null:null,'include':_0x132a71[_0x6953('0x1a')]?_0x132a71[_0x6953('0x1a')][_0x6953('0x1f')]?_['map'](_0x132a71[_0x6953('0x1a')]['include'],function(_0x4e95f1){return{'model':db[_0x4e95f1['model']],'as':_0x4e95f1['as'],'attributes':_0x4e95f1['attributes'],'include':_0x4e95f1[_0x6953('0x1f')]?_[_0x6953('0x20')](_0x4e95f1[_0x6953('0x1f')],function(_0x11f316){return{'model':db[_0x11f316[_0x6953('0x21')]],'as':_0x11f316['as'],'attributes':_0x11f316[_0x6953('0x1d')],'include':_0x11f316['include']?_[_0x6953('0x20')](_0x11f316['include'],function(_0x199c67){return{'model':db[_0x199c67['model']],'as':_0x199c67['as'],'attributes':_0x199c67[_0x6953('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6953('0xc')](function(_0xd81149){logger[_0x6953('0x15')]('ShowFreshsalesAccount',_0x132a71);logger[_0x6953('0xf')](_0x6953('0x22'),_0x132a71,JSON[_0x6953('0x11')](_0xd81149));_0x4d856d(_0xd81149);})[_0x6953('0x16')](function(_0x40b6ea){logger[_0x6953('0x12')](_0x6953('0x22'),_0x40b6ea[_0x6953('0x14')],_0x132a71);_0xd80e42(_0x481c6a[_0x6953('0x12')](0x1f4,_0x40b6ea[_0x6953('0x14')]));});});}; \ No newline at end of file +var _0xe2fe=['find','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowFreshsalesAccount'];(function(_0x201f62,_0x3a9311){var _0x116c72=function(_0x51b84f){while(--_0x51b84f){_0x201f62['push'](_0x201f62['shift']());}};_0x116c72(++_0x3a9311);}(_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']('FreshsalesAccount,\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);});});}exports[_0xee2f('0x12')]=function(_0x502eb6){var _0x550da7=this;return new Promise(function(_0x40b5bc,_0x5a5078){return db[_0xee2f('0x13')][_0xee2f('0x14')]({'raw':_0x502eb6[_0xee2f('0x15')]?_0x502eb6['options'][_0xee2f('0x16')]===undefined?!![]:![]:!![],'where':_0x502eb6[_0xee2f('0x15')]?_0x502eb6[_0xee2f('0x15')][_0xee2f('0x17')]||null:null,'attributes':_0x502eb6[_0xee2f('0x15')]?_0x502eb6['options']['attributes']||null:null,'limit':_0x502eb6[_0xee2f('0x15')]?_0x502eb6[_0xee2f('0x15')][_0xee2f('0x18')]||null:null,'include':_0x502eb6[_0xee2f('0x15')]?_0x502eb6[_0xee2f('0x15')][_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x502eb6['options'][_0xee2f('0x19')],function(_0x2c47c5){return{'model':db[_0x2c47c5[_0xee2f('0x1b')]],'as':_0x2c47c5['as'],'attributes':_0x2c47c5[_0xee2f('0x1c')],'include':_0x2c47c5[_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x2c47c5[_0xee2f('0x19')],function(_0x13013f){return{'model':db[_0x13013f[_0xee2f('0x1b')]],'as':_0x13013f['as'],'attributes':_0x13013f[_0xee2f('0x1c')],'include':_0x13013f[_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x13013f[_0xee2f('0x19')],function(_0x45c4a0){return{'model':db[_0x45c4a0['model']],'as':_0x45c4a0['as'],'attributes':_0x45c4a0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x18bdbb){logger[_0xee2f('0xb')](_0xee2f('0x12'),_0x502eb6);logger[_0xee2f('0x1d')](_0xee2f('0x12'),_0x502eb6,JSON[_0xee2f('0xd')](_0x18bdbb));_0x40b5bc(_0x18bdbb);})['catch'](function(_0x3d3806){logger['error'](_0xee2f('0x12'),_0x3d3806[_0xee2f('0xf')],_0x502eb6);_0x5a5078(_0x550da7[_0xee2f('0xe')](0x1f4,_0x3d3806[_0xee2f('0xf')]));});});};exports[_0xee2f('0x1e')]=function(_0x47d5a6){var _0x310c0b=this;return new Promise(function(_0xd16e35,_0x56706e){return db['FreshsalesAccount'][_0xee2f('0x1f')]({'raw':_0x47d5a6['options']?_0x47d5a6[_0xee2f('0x15')][_0xee2f('0x16')]===undefined?!![]:![]:!![],'where':_0x47d5a6['options']?_0x47d5a6[_0xee2f('0x15')]['where']||null:null,'attributes':_0x47d5a6['options']?_0x47d5a6['options'][_0xee2f('0x1c')]||null:null,'include':_0x47d5a6[_0xee2f('0x15')]?_0x47d5a6['options'][_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x47d5a6[_0xee2f('0x15')][_0xee2f('0x19')],function(_0x1c3a01){return{'model':db[_0x1c3a01['model']],'as':_0x1c3a01['as'],'attributes':_0x1c3a01[_0xee2f('0x1c')],'include':_0x1c3a01['include']?_[_0xee2f('0x1a')](_0x1c3a01[_0xee2f('0x19')],function(_0x3dcb9e){return{'model':db[_0x3dcb9e['model']],'as':_0x3dcb9e['as'],'attributes':_0x3dcb9e[_0xee2f('0x1c')],'include':_0x3dcb9e['include']?_[_0xee2f('0x1a')](_0x3dcb9e['include'],function(_0x3e6dcc){return{'model':db[_0x3e6dcc[_0xee2f('0x1b')]],'as':_0x3e6dcc['as'],'attributes':_0x3e6dcc[_0xee2f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xee2f('0xa')](function(_0x1b9f6c){logger[_0xee2f('0xb')](_0xee2f('0x1e'),_0x47d5a6);logger[_0xee2f('0x1d')](_0xee2f('0x1e'),_0x47d5a6,JSON[_0xee2f('0xd')](_0x1b9f6c));_0xd16e35(_0x1b9f6c);})[_0xee2f('0x20')](function(_0x5ad0a7){logger[_0xee2f('0xe')]('ShowFreshsalesAccount',_0x5ad0a7[_0xee2f('0xf')],_0x47d5a6);_0x56706e(_0x310c0b[_0xee2f('0xe')](0x1f4,_0x5ad0a7[_0xee2f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index a9a971a..e45d3af 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 _0xca4e=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','getDescriptions','getFields','post','create','put','update'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xca4e,0xdb));var _0xeca4=function(_0x5ceb21,_0x2a5f13){_0x5ceb21=_0x5ceb21-0x0;var _0x36cea0=_0xca4e[_0x5ceb21];return _0x36cea0;};'use strict';var multer=require(_0xeca4('0x0'));var util=require(_0xeca4('0x1'));var path=require(_0xeca4('0x2'));var timeout=require(_0xeca4('0x3'));var express=require(_0xeca4('0x4'));var router=express[_0xeca4('0x5')]();var fs_extra=require(_0xeca4('0x6'));var auth=require(_0xeca4('0x7'));var interaction=require(_0xeca4('0x8'));var config=require('../../config/environment');var controller=require(_0xeca4('0x9'));router[_0xeca4('0xa')]('/',auth[_0xeca4('0xb')](),controller[_0xeca4('0xc')]);router[_0xeca4('0xa')](_0xeca4('0xd'),auth[_0xeca4('0xb')](),controller[_0xeca4('0xe')]);router['get']('/:id/subjects',auth[_0xeca4('0xb')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xeca4('0xb')](),controller[_0xeca4('0xf')]);router[_0xeca4('0xa')]('/:id/fields',auth[_0xeca4('0xb')](),controller[_0xeca4('0x10')]);router[_0xeca4('0x11')]('/',auth[_0xeca4('0xb')](),controller[_0xeca4('0x12')]);router[_0xeca4('0x13')](_0xeca4('0xd'),auth[_0xeca4('0xb')](),controller[_0xeca4('0x14')]);router[_0xeca4('0x15')]('/:id',auth[_0xeca4('0xb')](),controller[_0xeca4('0x16')]);module[_0xeca4('0x17')]=router; \ No newline at end of file +var _0x3dac=['index','get','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x3dac,0xcd));var _0xc3da=function(_0x79614c,_0x16c053){_0x79614c=_0x79614c-0x0;var _0x48060c=_0x3dac[_0x79614c];return _0x48060c;};'use strict';var multer=require(_0xc3da('0x0'));var util=require(_0xc3da('0x1'));var path=require(_0xc3da('0x2'));var timeout=require(_0xc3da('0x3'));var express=require(_0xc3da('0x4'));var router=express[_0xc3da('0x5')]();var fs_extra=require(_0xc3da('0x6'));var auth=require(_0xc3da('0x7'));var interaction=require(_0xc3da('0x8'));var config=require(_0xc3da('0x9'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0xc3da('0xa')](),controller[_0xc3da('0xb')]);router[_0xc3da('0xc')](_0xc3da('0xd'),auth[_0xc3da('0xa')](),controller['show']);router['get'](_0xc3da('0xe'),auth[_0xc3da('0xa')](),controller[_0xc3da('0xf')]);router[_0xc3da('0xc')](_0xc3da('0x10'),auth[_0xc3da('0xa')](),controller[_0xc3da('0x11')]);router[_0xc3da('0xc')](_0xc3da('0x12'),auth[_0xc3da('0xa')](),controller[_0xc3da('0x13')]);router[_0xc3da('0x14')]('/',auth[_0xc3da('0xa')](),controller[_0xc3da('0x15')]);router[_0xc3da('0x16')]('/:id',auth[_0xc3da('0xa')](),controller[_0xc3da('0x17')]);router['delete'](_0xc3da('0xd'),auth[_0xc3da('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index fd16b50..a8482ec 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 _0x6737=['STRING','sequelize','exports'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x6737,0x187));var _0x7673=function(_0x38656f,_0x5a0dee){_0x38656f=_0x38656f-0x0;var _0x44213d=_0x6737[_0x38656f];return _0x44213d;};'use strict';var Sequelize=require(_0x7673('0x0'));module[_0x7673('0x1')]={'name':{'type':Sequelize[_0x7673('0x2')]},'description':{'type':Sequelize[_0x7673('0x2')]}}; \ No newline at end of file +var _0x0d62=['sequelize','exports','STRING'];(function(_0x2cc9ff,_0x529d73){var _0x21de3a=function(_0x50401d){while(--_0x50401d){_0x2cc9ff['push'](_0x2cc9ff['shift']());}};_0x21de3a(++_0x529d73);}(_0x0d62,0x180));var _0x20d6=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0x0d62[_0x3817a9];return _0x443f30;};'use strict';var Sequelize=require(_0x20d6('0x0'));module[_0x20d6('0x1')]={'name':{'type':Sequelize[_0x20d6('0x2')]},'description':{'type':Sequelize[_0x20d6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index d39d32e..06ea07c 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 _0xe6e3=['mustache','util','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','error','stack','name','map','rawAttributes','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','FreshsalesConfiguration','include','rows','catch','show','params','includeAll','find','create','body','getSubjects','findOne','FreshsalesField','order','getDescriptions','getFields','rimraf','zip-dir','request-promise','moment'];(function(_0x3eb7ef,_0x5c6ea8){var _0x42404a=function(_0x2ed287){while(--_0x2ed287){_0x3eb7ef['push'](_0x3eb7ef['shift']());}};_0x42404a(++_0x5c6ea8);}(_0xe6e3,0x96));var _0x3e6e=function(_0x508986,_0x43d040){_0x508986=_0x508986-0x0;var _0x25d13a=_0xe6e3[_0x508986];return _0x25d13a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e6e('0x0'));var zipdir=require(_0x3e6e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e6e('0x2'));var moment=require(_0x3e6e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3e6e('0x4'));var util=require(_0x3e6e('0x5'));var path=require('path');var sox=require(_0x3e6e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e6e('0x7'));var _=require(_0x3e6e('0x8'));var squel=require('squel');var crypto=require(_0x3e6e('0x9'));var jsforce=require(_0x3e6e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3e6e('0xb'));var querystring=require(_0x3e6e('0xc'));var Papa=require(_0x3e6e('0xd'));var Redis=require(_0x3e6e('0xe'));var authService=require(_0x3e6e('0xf'));var qs=require(_0x3e6e('0x10'));var as=require(_0x3e6e('0x11'));var hardwareService=require(_0x3e6e('0x12'));var logger=require(_0x3e6e('0x13'))(_0x3e6e('0x14'));var utils=require(_0x3e6e('0x15'));var config=require(_0x3e6e('0x16'));var licenseUtil=require(_0x3e6e('0x17'));var db=require(_0x3e6e('0x18'))['db'];function respondWithStatusCode(_0x1f6f43,_0x210a17){_0x210a17=_0x210a17||0xcc;return function(_0x3c5dff){if(_0x3c5dff){return _0x1f6f43[_0x3e6e('0x19')](_0x210a17);}return _0x1f6f43[_0x3e6e('0x1a')](_0x210a17)[_0x3e6e('0x1b')]();};}function respondWithResult(_0x45454f,_0x21c7c0){_0x21c7c0=_0x21c7c0||0xc8;return function(_0x31895a){if(_0x31895a){return _0x45454f['status'](_0x21c7c0)[_0x3e6e('0x1c')](_0x31895a);}};}function respondWithFilteredResult(_0x2dc8ac,_0x2a3050){return function(_0x57961a){if(_0x57961a){var _0x4dd701=typeof _0x2a3050[_0x3e6e('0x1d')]===_0x3e6e('0x1e')&&typeof _0x2a3050[_0x3e6e('0x1f')]===_0x3e6e('0x1e');var _0x2ec65d=_0x57961a[_0x3e6e('0x20')];var _0xe98a85=_0x4dd701?0x0:_0x2a3050[_0x3e6e('0x1d')];var _0x380241=_0x4dd701?_0x57961a[_0x3e6e('0x20')]:_0x2a3050[_0x3e6e('0x1d')]+_0x2a3050[_0x3e6e('0x1f')];var _0x50af70;if(_0x380241>=_0x2ec65d){_0x380241=_0x2ec65d;_0x50af70=0xc8;}else{_0x50af70=0xce;}_0x2dc8ac[_0x3e6e('0x1a')](_0x50af70);return _0x2dc8ac[_0x3e6e('0x21')]('Content-Range',_0xe98a85+'-'+_0x380241+'/'+_0x2ec65d)['json'](_0x57961a);}return null;};}function patchUpdates(_0x18daae){return function(_0xbef110){try{jsonpatch['apply'](_0xbef110,_0x18daae,!![]);}catch(_0x46351f){return BPromise['reject'](_0x46351f);}return _0xbef110['save']();};}function saveUpdates(_0x100b5a,_0x18c01b){return function(_0x182e87){if(_0x182e87){return _0x182e87[_0x3e6e('0x22')](_0x100b5a)[_0x3e6e('0x23')](function(_0x4aa7c7){return _0x4aa7c7;});}return null;};}function removeEntity(_0x4426ab,_0x50924b){return function(_0x44f1ae){if(_0x44f1ae){return _0x44f1ae[_0x3e6e('0x24')]()['then'](function(){_0x4426ab[_0x3e6e('0x1a')](0xcc)[_0x3e6e('0x1b')]();});}};}function handleEntityNotFound(_0x2350ae,_0x1174c0){return function(_0x365ca8){if(!_0x365ca8){_0x2350ae[_0x3e6e('0x19')](0x194);}return _0x365ca8;};}function handleError(_0x456517,_0x27fe01){_0x27fe01=_0x27fe01||0x1f4;return function(_0x2f1f4c){logger[_0x3e6e('0x25')](_0x2f1f4c[_0x3e6e('0x26')]);if(_0x2f1f4c[_0x3e6e('0x27')]){delete _0x2f1f4c[_0x3e6e('0x27')];}_0x456517[_0x3e6e('0x1a')](_0x27fe01)['send'](_0x2f1f4c);};}exports['index']=function(_0x39a07d,_0x5e4e12){var _0x3f80e9={},_0xea5857={},_0x190f86={'count':0x0,'rows':[]};var _0x347498=_[_0x3e6e('0x28')](db['FreshsalesConfiguration'][_0x3e6e('0x29')],function(_0x27901a){return{'name':_0x27901a['fieldName'],'type':_0x27901a[_0x3e6e('0x2a')][_0x3e6e('0x2b')]};});_0xea5857['model']=_[_0x3e6e('0x28')](_0x347498,_0x3e6e('0x27'));_0xea5857['query']=_[_0x3e6e('0x2c')](_0x39a07d[_0x3e6e('0x2d')]);_0xea5857[_0x3e6e('0x2e')]=_['intersection'](_0xea5857[_0x3e6e('0x2f')],_0xea5857[_0x3e6e('0x2d')]);_0x3f80e9[_0x3e6e('0x30')]=_[_0x3e6e('0x31')](_0xea5857[_0x3e6e('0x2f')],qs[_0x3e6e('0x32')](_0x39a07d[_0x3e6e('0x2d')][_0x3e6e('0x32')]));_0x3f80e9['attributes']=_0x3f80e9[_0x3e6e('0x30')][_0x3e6e('0x33')]?_0x3f80e9[_0x3e6e('0x30')]:_0xea5857[_0x3e6e('0x2f')];if(!_0x39a07d['query'][_0x3e6e('0x34')](_0x3e6e('0x35'))){_0x3f80e9[_0x3e6e('0x1f')]=qs['limit'](_0x39a07d[_0x3e6e('0x2d')][_0x3e6e('0x1f')]);_0x3f80e9['offset']=qs[_0x3e6e('0x1d')](_0x39a07d[_0x3e6e('0x2d')]['offset']);}_0x3f80e9['order']=qs[_0x3e6e('0x36')](_0x39a07d['query'][_0x3e6e('0x36')]);_0x3f80e9[_0x3e6e('0x37')]=qs[_0x3e6e('0x2e')](_[_0x3e6e('0x38')](_0x39a07d[_0x3e6e('0x2d')],_0xea5857[_0x3e6e('0x2e')]),_0x347498);if(_0x39a07d[_0x3e6e('0x2d')]['filter']){_0x3f80e9['where']=_[_0x3e6e('0x39')](_0x3f80e9[_0x3e6e('0x37')],{'$or':_[_0x3e6e('0x28')](_0x347498,function(_0x2efb57){if(_0x2efb57[_0x3e6e('0x2a')]!==_0x3e6e('0x3a')){var _0x2ce6b0={};_0x2ce6b0[_0x2efb57[_0x3e6e('0x27')]]={'$like':'%'+_0x39a07d[_0x3e6e('0x2d')][_0x3e6e('0x3b')]+'%'};return _0x2ce6b0;}})});}_0x3f80e9=_[_0x3e6e('0x39')]({},_0x3f80e9,_0x39a07d[_0x3e6e('0x3c')]);var _0x291bfd={'where':_0x3f80e9['where']};return db[_0x3e6e('0x3d')][_0x3e6e('0x20')](_0x291bfd)[_0x3e6e('0x23')](function(_0x16c371){_0x190f86['count']=_0x16c371;if(_0x39a07d['query']['includeAll']){_0x3f80e9[_0x3e6e('0x3e')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x3f80e9);})[_0x3e6e('0x23')](function(_0x2f4e4a){_0x190f86[_0x3e6e('0x3f')]=_0x2f4e4a;return _0x190f86;})[_0x3e6e('0x23')](respondWithFilteredResult(_0x5e4e12,_0x3f80e9))[_0x3e6e('0x40')](handleError(_0x5e4e12,null));};exports[_0x3e6e('0x41')]=function(_0x16a742,_0x302f36){var _0x4e98dc={'raw':![],'where':{'id':_0x16a742[_0x3e6e('0x42')]['id']}},_0x65ba6b={};_0x65ba6b['model']=_[_0x3e6e('0x2c')](db[_0x3e6e('0x3d')][_0x3e6e('0x29')]);_0x65ba6b[_0x3e6e('0x2d')]=_[_0x3e6e('0x2c')](_0x16a742[_0x3e6e('0x2d')]);_0x65ba6b['filters']=_['intersection'](_0x65ba6b[_0x3e6e('0x2f')],_0x65ba6b['query']);_0x4e98dc['attributes']=_[_0x3e6e('0x31')](_0x65ba6b[_0x3e6e('0x2f')],qs[_0x3e6e('0x32')](_0x16a742[_0x3e6e('0x2d')][_0x3e6e('0x32')]));_0x4e98dc['attributes']=_0x4e98dc[_0x3e6e('0x30')][_0x3e6e('0x33')]?_0x4e98dc['attributes']:_0x65ba6b['model'];if(_0x16a742[_0x3e6e('0x2d')][_0x3e6e('0x43')]){_0x4e98dc['include']=[{'all':!![]}];}_0x4e98dc=_['merge']({},_0x4e98dc,_0x16a742['options']);return db['FreshsalesConfiguration'][_0x3e6e('0x44')](_0x4e98dc)[_0x3e6e('0x23')](handleEntityNotFound(_0x302f36,null))[_0x3e6e('0x23')](respondWithResult(_0x302f36,null))['catch'](handleError(_0x302f36,null));};exports[_0x3e6e('0x45')]=function(_0x24cee7,_0x1c9e6a){return db['FreshsalesConfiguration'][_0x3e6e('0x45')](_0x24cee7[_0x3e6e('0x46')],{})[_0x3e6e('0x23')](respondWithResult(_0x1c9e6a,0xc9))['catch'](handleError(_0x1c9e6a,null));};exports[_0x3e6e('0x22')]=function(_0x22cc71,_0x58d28d){if(_0x22cc71['body']['id']){delete _0x22cc71['body']['id'];}return db['FreshsalesConfiguration'][_0x3e6e('0x44')]({'where':{'id':_0x22cc71[_0x3e6e('0x42')]['id']}})['then'](handleEntityNotFound(_0x58d28d,null))[_0x3e6e('0x23')](saveUpdates(_0x22cc71[_0x3e6e('0x46')],null))[_0x3e6e('0x23')](respondWithResult(_0x58d28d,null))['catch'](handleError(_0x58d28d,null));};exports[_0x3e6e('0x24')]=function(_0x166d87,_0x458096){return db[_0x3e6e('0x3d')][_0x3e6e('0x44')]({'where':{'id':_0x166d87[_0x3e6e('0x42')]['id']}})['then'](handleEntityNotFound(_0x458096,null))[_0x3e6e('0x23')](removeEntity(_0x458096,null))[_0x3e6e('0x40')](handleError(_0x458096,null));};exports[_0x3e6e('0x47')]=function(_0xefbccf,_0x3efea0,_0x24bda8){var _0xe13592={};var _0x286b99={};var _0x3982d6;var _0x2b70b3;return db['FreshsalesConfiguration'][_0x3e6e('0x48')]({'where':{'id':_0xefbccf['params']['id']}})[_0x3e6e('0x23')](handleEntityNotFound(_0x3efea0,null))['then'](function(_0x3a4409){if(_0x3a4409){_0x3982d6=_0x3a4409;_0x286b99[_0x3e6e('0x2f')]=_[_0x3e6e('0x2c')](db[_0x3e6e('0x49')][_0x3e6e('0x29')]);_0x286b99[_0x3e6e('0x2d')]=_['keys'](_0xefbccf[_0x3e6e('0x2d')]);_0x286b99[_0x3e6e('0x2e')]=_[_0x3e6e('0x31')](_0x286b99[_0x3e6e('0x2f')],_0x286b99[_0x3e6e('0x2d')]);_0xe13592[_0x3e6e('0x30')]=_['intersection'](_0x286b99['model'],qs[_0x3e6e('0x32')](_0xefbccf[_0x3e6e('0x2d')][_0x3e6e('0x32')]));_0xe13592[_0x3e6e('0x30')]=_0xe13592[_0x3e6e('0x30')][_0x3e6e('0x33')]?_0xe13592[_0x3e6e('0x30')]:_0x286b99[_0x3e6e('0x2f')];_0xe13592['order']=qs[_0x3e6e('0x36')](_0xefbccf[_0x3e6e('0x2d')][_0x3e6e('0x36')]);_0xe13592['where']=qs[_0x3e6e('0x2e')](_[_0x3e6e('0x38')](_0xefbccf[_0x3e6e('0x2d')],_0x286b99[_0x3e6e('0x2e')]));if(_0xefbccf[_0x3e6e('0x2d')][_0x3e6e('0x3b')]){_0xe13592[_0x3e6e('0x37')]=_[_0x3e6e('0x39')](_0xe13592[_0x3e6e('0x37')],{'$or':_[_0x3e6e('0x28')](_0xe13592[_0x3e6e('0x30')],function(_0xc7209f){var _0x4cb528={};_0x4cb528[_0xc7209f]={'$like':'%'+_0xefbccf[_0x3e6e('0x2d')][_0x3e6e('0x3b')]+'%'};return _0x4cb528;})});}_0xe13592=_[_0x3e6e('0x39')]({},_0xe13592,_0xefbccf['options']);return _0x3982d6[_0x3e6e('0x47')](_0xe13592);}})['then'](function(_0x2968bc){if(_0x2968bc){_0x2b70b3=_0x2968bc[_0x3e6e('0x33')];if(!_0xefbccf[_0x3e6e('0x2d')][_0x3e6e('0x34')](_0x3e6e('0x35'))){_0xe13592[_0x3e6e('0x1f')]=qs['limit'](_0xefbccf['query'][_0x3e6e('0x1f')]);_0xe13592[_0x3e6e('0x1d')]=qs[_0x3e6e('0x1d')](_0xefbccf['query'][_0x3e6e('0x1d')]);}return _0x3982d6[_0x3e6e('0x47')](_0xe13592);}})[_0x3e6e('0x23')](function(_0xf4383a){if(_0xf4383a){return _0xf4383a?{'count':_0x2b70b3,'rows':_0xf4383a}:null;}})['then'](respondWithResult(_0x3efea0,null))[_0x3e6e('0x40')](handleError(_0x3efea0,null));};exports['getDescriptions']=function(_0x37f451,_0x1c4810,_0x241d98){var _0x315c1b={};var _0x2c0eba={};var _0x5ca2d2;var _0x54cd08;return db[_0x3e6e('0x3d')][_0x3e6e('0x48')]({'where':{'id':_0x37f451[_0x3e6e('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c4810,null))[_0x3e6e('0x23')](function(_0x114dd9){if(_0x114dd9){_0x5ca2d2=_0x114dd9;_0x2c0eba[_0x3e6e('0x2f')]=_[_0x3e6e('0x2c')](db[_0x3e6e('0x49')][_0x3e6e('0x29')]);_0x2c0eba[_0x3e6e('0x2d')]=_[_0x3e6e('0x2c')](_0x37f451[_0x3e6e('0x2d')]);_0x2c0eba[_0x3e6e('0x2e')]=_['intersection'](_0x2c0eba[_0x3e6e('0x2f')],_0x2c0eba[_0x3e6e('0x2d')]);_0x315c1b[_0x3e6e('0x30')]=_[_0x3e6e('0x31')](_0x2c0eba[_0x3e6e('0x2f')],qs[_0x3e6e('0x32')](_0x37f451['query']['fields']));_0x315c1b[_0x3e6e('0x30')]=_0x315c1b[_0x3e6e('0x30')][_0x3e6e('0x33')]?_0x315c1b[_0x3e6e('0x30')]:_0x2c0eba[_0x3e6e('0x2f')];_0x315c1b[_0x3e6e('0x4a')]=qs[_0x3e6e('0x36')](_0x37f451[_0x3e6e('0x2d')][_0x3e6e('0x36')]);_0x315c1b[_0x3e6e('0x37')]=qs[_0x3e6e('0x2e')](_['pick'](_0x37f451[_0x3e6e('0x2d')],_0x2c0eba['filters']));if(_0x37f451[_0x3e6e('0x2d')]['filter']){_0x315c1b['where']=_[_0x3e6e('0x39')](_0x315c1b[_0x3e6e('0x37')],{'$or':_['map'](_0x315c1b[_0x3e6e('0x30')],function(_0xba4941){var _0x164f03={};_0x164f03[_0xba4941]={'$like':'%'+_0x37f451[_0x3e6e('0x2d')][_0x3e6e('0x3b')]+'%'};return _0x164f03;})});}_0x315c1b=_['merge']({},_0x315c1b,_0x37f451['options']);return _0x5ca2d2[_0x3e6e('0x4b')](_0x315c1b);}})[_0x3e6e('0x23')](function(_0x556876){if(_0x556876){_0x54cd08=_0x556876[_0x3e6e('0x33')];if(!_0x37f451['query'][_0x3e6e('0x34')](_0x3e6e('0x35'))){_0x315c1b[_0x3e6e('0x1f')]=qs[_0x3e6e('0x1f')](_0x37f451[_0x3e6e('0x2d')]['limit']);_0x315c1b[_0x3e6e('0x1d')]=qs[_0x3e6e('0x1d')](_0x37f451[_0x3e6e('0x2d')][_0x3e6e('0x1d')]);}return _0x5ca2d2[_0x3e6e('0x4b')](_0x315c1b);}})[_0x3e6e('0x23')](function(_0x22025d){if(_0x22025d){return _0x22025d?{'count':_0x54cd08,'rows':_0x22025d}:null;}})[_0x3e6e('0x23')](respondWithResult(_0x1c4810,null))[_0x3e6e('0x40')](handleError(_0x1c4810,null));};exports['getFields']=function(_0xb7a537,_0x45fbc3,_0x29473a){var _0x4d2ed8={};var _0x511835={};var _0x3943c0;var _0x1f5e03;return db[_0x3e6e('0x3d')][_0x3e6e('0x48')]({'where':{'id':_0xb7a537['params']['id']}})[_0x3e6e('0x23')](handleEntityNotFound(_0x45fbc3,null))['then'](function(_0x95f1a7){if(_0x95f1a7){_0x3943c0=_0x95f1a7;_0x511835[_0x3e6e('0x2f')]=_['keys'](db[_0x3e6e('0x49')][_0x3e6e('0x29')]);_0x511835[_0x3e6e('0x2d')]=_[_0x3e6e('0x2c')](_0xb7a537[_0x3e6e('0x2d')]);_0x511835[_0x3e6e('0x2e')]=_['intersection'](_0x511835[_0x3e6e('0x2f')],_0x511835[_0x3e6e('0x2d')]);_0x4d2ed8[_0x3e6e('0x30')]=_[_0x3e6e('0x31')](_0x511835[_0x3e6e('0x2f')],qs['fields'](_0xb7a537[_0x3e6e('0x2d')][_0x3e6e('0x32')]));_0x4d2ed8[_0x3e6e('0x30')]=_0x4d2ed8[_0x3e6e('0x30')]['length']?_0x4d2ed8[_0x3e6e('0x30')]:_0x511835[_0x3e6e('0x2f')];_0x4d2ed8[_0x3e6e('0x4a')]=qs['sort'](_0xb7a537[_0x3e6e('0x2d')]['sort']);_0x4d2ed8[_0x3e6e('0x37')]=qs[_0x3e6e('0x2e')](_[_0x3e6e('0x38')](_0xb7a537['query'],_0x511835[_0x3e6e('0x2e')]));if(_0xb7a537[_0x3e6e('0x2d')][_0x3e6e('0x3b')]){_0x4d2ed8[_0x3e6e('0x37')]=_['merge'](_0x4d2ed8[_0x3e6e('0x37')],{'$or':_[_0x3e6e('0x28')](_0x4d2ed8[_0x3e6e('0x30')],function(_0x3a831a){var _0xe96ca2={};_0xe96ca2[_0x3a831a]={'$like':'%'+_0xb7a537[_0x3e6e('0x2d')][_0x3e6e('0x3b')]+'%'};return _0xe96ca2;})});}_0x4d2ed8=_['merge']({},_0x4d2ed8,_0xb7a537[_0x3e6e('0x3c')]);return _0x3943c0[_0x3e6e('0x4c')](_0x4d2ed8);}})[_0x3e6e('0x23')](function(_0x1c4a0e){if(_0x1c4a0e){_0x1f5e03=_0x1c4a0e['length'];if(!_0xb7a537[_0x3e6e('0x2d')]['hasOwnProperty'](_0x3e6e('0x35'))){_0x4d2ed8[_0x3e6e('0x1f')]=qs[_0x3e6e('0x1f')](_0xb7a537[_0x3e6e('0x2d')][_0x3e6e('0x1f')]);_0x4d2ed8[_0x3e6e('0x1d')]=qs[_0x3e6e('0x1d')](_0xb7a537['query'][_0x3e6e('0x1d')]);}return _0x3943c0[_0x3e6e('0x4c')](_0x4d2ed8);}})['then'](function(_0x363937){if(_0x363937){return _0x363937?{'count':_0x1f5e03,'rows':_0x363937}:null;}})[_0x3e6e('0x23')](respondWithResult(_0x45fbc3,null))[_0x3e6e('0x40')](handleError(_0x45fbc3,null));}; \ No newline at end of file +var _0x97b0=['params','find','catch','create','body','pick','getSubjects','hasOwnProperty','getDescriptions','findOne','FreshsalesField','getFields','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FreshsalesConfiguration','rawAttributes','key','model','map','query','keys','filters','attributes','intersection','fields','length','order','sort','where','filter','type','merge','options','includeAll','include','findAll','show'];(function(_0x878a08,_0x33aa83){var _0x1fb092=function(_0x41bf66){while(--_0x41bf66){_0x878a08['push'](_0x878a08['shift']());}};_0x1fb092(++_0x33aa83);}(_0x97b0,0xb1));var _0x097b=function(_0x5d44bb,_0x191734){_0x5d44bb=_0x5d44bb-0x0;var _0x206c43=_0x97b0[_0x5d44bb];return _0x206c43;};'use strict';var emlformat=require(_0x097b('0x0'));var rimraf=require(_0x097b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x097b('0x2'));var rp=require(_0x097b('0x3'));var moment=require(_0x097b('0x4'));var BPromise=require(_0x097b('0x5'));var Mustache=require(_0x097b('0x6'));var util=require(_0x097b('0x7'));var path=require(_0x097b('0x8'));var sox=require(_0x097b('0x9'));var csv=require(_0x097b('0xa'));var ejs=require(_0x097b('0xb'));var fs=require('fs');var fs_extra=require(_0x097b('0xc'));var _=require(_0x097b('0xd'));var squel=require(_0x097b('0xe'));var crypto=require('crypto');var jsforce=require(_0x097b('0xf'));var deskjs=require(_0x097b('0x10'));var toCsv=require(_0x097b('0xa'));var querystring=require(_0x097b('0x11'));var Papa=require(_0x097b('0x12'));var Redis=require(_0x097b('0x13'));var authService=require(_0x097b('0x14'));var qs=require(_0x097b('0x15'));var as=require(_0x097b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x097b('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x097b('0x18'));var licenseUtil=require(_0x097b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c204d,_0x369953){_0x369953=_0x369953||0xcc;return function(_0x3387bd){if(_0x3387bd){return _0x2c204d[_0x097b('0x1a')](_0x369953);}return _0x2c204d[_0x097b('0x1b')](_0x369953)[_0x097b('0x1c')]();};}function respondWithResult(_0x334a24,_0x4f9a75){_0x4f9a75=_0x4f9a75||0xc8;return function(_0x48602b){if(_0x48602b){return _0x334a24[_0x097b('0x1b')](_0x4f9a75)[_0x097b('0x1d')](_0x48602b);}};}function respondWithFilteredResult(_0xdff3d1,_0x2cbc6f){return function(_0xe7134c){if(_0xe7134c){var _0x3b3e99=typeof _0x2cbc6f[_0x097b('0x1e')]===_0x097b('0x1f')&&typeof _0x2cbc6f[_0x097b('0x20')]===_0x097b('0x1f');var _0x5788f3=_0xe7134c[_0x097b('0x21')];var _0x1e370f=_0x3b3e99?0x0:_0x2cbc6f['offset'];var _0x40112d=_0x3b3e99?_0xe7134c[_0x097b('0x21')]:_0x2cbc6f[_0x097b('0x1e')]+_0x2cbc6f['limit'];var _0x388218;if(_0x40112d>=_0x5788f3){_0x40112d=_0x5788f3;_0x388218=0xc8;}else{_0x388218=0xce;}_0xdff3d1[_0x097b('0x1b')](_0x388218);return _0xdff3d1['set'](_0x097b('0x22'),_0x1e370f+'-'+_0x40112d+'/'+_0x5788f3)['json'](_0xe7134c);}return null;};}function patchUpdates(_0x47079d){return function(_0x18e4e6){try{jsonpatch[_0x097b('0x23')](_0x18e4e6,_0x47079d,!![]);}catch(_0x352c84){return BPromise[_0x097b('0x24')](_0x352c84);}return _0x18e4e6[_0x097b('0x25')]();};}function saveUpdates(_0x50075c,_0x13a18c){return function(_0x2a3fa8){if(_0x2a3fa8){return _0x2a3fa8[_0x097b('0x26')](_0x50075c)[_0x097b('0x27')](function(_0x4ea51b){return _0x4ea51b;});}return null;};}function removeEntity(_0x1a5287,_0x289e38){return function(_0x40ca90){if(_0x40ca90){return _0x40ca90[_0x097b('0x28')]()['then'](function(){_0x1a5287['status'](0xcc)[_0x097b('0x1c')]();});}};}function handleEntityNotFound(_0x228e17,_0x35f361){return function(_0x22bab9){if(!_0x22bab9){_0x228e17['sendStatus'](0x194);}return _0x22bab9;};}function handleError(_0x193e7b,_0x113203){_0x113203=_0x113203||0x1f4;return function(_0x8d70b5){logger[_0x097b('0x29')](_0x8d70b5[_0x097b('0x2a')]);if(_0x8d70b5[_0x097b('0x2b')]){delete _0x8d70b5[_0x097b('0x2b')];}_0x193e7b['status'](_0x113203)[_0x097b('0x2c')](_0x8d70b5);};}exports[_0x097b('0x2d')]=function(_0x1e24cc,_0x2e8889){var _0x50d08f={},_0x3c48c2={},_0x55db64={'count':0x0,'rows':[]};var _0x2421eb=_['map'](db[_0x097b('0x2e')][_0x097b('0x2f')],function(_0x1ab6a6){return{'name':_0x1ab6a6['fieldName'],'type':_0x1ab6a6['type'][_0x097b('0x30')]};});_0x3c48c2[_0x097b('0x31')]=_[_0x097b('0x32')](_0x2421eb,_0x097b('0x2b'));_0x3c48c2[_0x097b('0x33')]=_[_0x097b('0x34')](_0x1e24cc[_0x097b('0x33')]);_0x3c48c2[_0x097b('0x35')]=_['intersection'](_0x3c48c2[_0x097b('0x31')],_0x3c48c2[_0x097b('0x33')]);_0x50d08f[_0x097b('0x36')]=_[_0x097b('0x37')](_0x3c48c2[_0x097b('0x31')],qs[_0x097b('0x38')](_0x1e24cc[_0x097b('0x33')][_0x097b('0x38')]));_0x50d08f['attributes']=_0x50d08f['attributes'][_0x097b('0x39')]?_0x50d08f[_0x097b('0x36')]:_0x3c48c2[_0x097b('0x31')];if(!_0x1e24cc['query']['hasOwnProperty']('nolimit')){_0x50d08f[_0x097b('0x20')]=qs[_0x097b('0x20')](_0x1e24cc['query'][_0x097b('0x20')]);_0x50d08f[_0x097b('0x1e')]=qs['offset'](_0x1e24cc[_0x097b('0x33')][_0x097b('0x1e')]);}_0x50d08f[_0x097b('0x3a')]=qs[_0x097b('0x3b')](_0x1e24cc['query'][_0x097b('0x3b')]);_0x50d08f[_0x097b('0x3c')]=qs[_0x097b('0x35')](_['pick'](_0x1e24cc['query'],_0x3c48c2['filters']),_0x2421eb);if(_0x1e24cc['query'][_0x097b('0x3d')]){_0x50d08f[_0x097b('0x3c')]=_['merge'](_0x50d08f[_0x097b('0x3c')],{'$or':_[_0x097b('0x32')](_0x2421eb,function(_0x5f3efc){if(_0x5f3efc[_0x097b('0x3e')]!=='VIRTUAL'){var _0x238f53={};_0x238f53[_0x5f3efc[_0x097b('0x2b')]]={'$like':'%'+_0x1e24cc[_0x097b('0x33')][_0x097b('0x3d')]+'%'};return _0x238f53;}})});}_0x50d08f=_[_0x097b('0x3f')]({},_0x50d08f,_0x1e24cc[_0x097b('0x40')]);var _0x518037={'where':_0x50d08f[_0x097b('0x3c')]};return db['FreshsalesConfiguration']['count'](_0x518037)[_0x097b('0x27')](function(_0x4e6a30){_0x55db64[_0x097b('0x21')]=_0x4e6a30;if(_0x1e24cc['query'][_0x097b('0x41')]){_0x50d08f[_0x097b('0x42')]=[{'all':!![]}];}return db[_0x097b('0x2e')][_0x097b('0x43')](_0x50d08f);})[_0x097b('0x27')](function(_0x270949){_0x55db64['rows']=_0x270949;return _0x55db64;})[_0x097b('0x27')](respondWithFilteredResult(_0x2e8889,_0x50d08f))['catch'](handleError(_0x2e8889,null));};exports[_0x097b('0x44')]=function(_0x18b11d,_0x2a60f4){var _0x1d0385={'raw':![],'where':{'id':_0x18b11d[_0x097b('0x45')]['id']}},_0xf06c5={};_0xf06c5['model']=_[_0x097b('0x34')](db[_0x097b('0x2e')][_0x097b('0x2f')]);_0xf06c5['query']=_[_0x097b('0x34')](_0x18b11d[_0x097b('0x33')]);_0xf06c5[_0x097b('0x35')]=_['intersection'](_0xf06c5[_0x097b('0x31')],_0xf06c5['query']);_0x1d0385['attributes']=_[_0x097b('0x37')](_0xf06c5['model'],qs[_0x097b('0x38')](_0x18b11d[_0x097b('0x33')][_0x097b('0x38')]));_0x1d0385[_0x097b('0x36')]=_0x1d0385[_0x097b('0x36')][_0x097b('0x39')]?_0x1d0385[_0x097b('0x36')]:_0xf06c5[_0x097b('0x31')];if(_0x18b11d[_0x097b('0x33')]['includeAll']){_0x1d0385['include']=[{'all':!![]}];}_0x1d0385=_[_0x097b('0x3f')]({},_0x1d0385,_0x18b11d[_0x097b('0x40')]);return db['FreshsalesConfiguration'][_0x097b('0x46')](_0x1d0385)[_0x097b('0x27')](handleEntityNotFound(_0x2a60f4,null))[_0x097b('0x27')](respondWithResult(_0x2a60f4,null))[_0x097b('0x47')](handleError(_0x2a60f4,null));};exports['create']=function(_0x20bd26,_0x1c0f76){return db[_0x097b('0x2e')][_0x097b('0x48')](_0x20bd26[_0x097b('0x49')],{})[_0x097b('0x27')](respondWithResult(_0x1c0f76,0xc9))[_0x097b('0x47')](handleError(_0x1c0f76,null));};exports[_0x097b('0x26')]=function(_0x155812,_0x299a04){if(_0x155812[_0x097b('0x49')]['id']){delete _0x155812[_0x097b('0x49')]['id'];}return db['FreshsalesConfiguration'][_0x097b('0x46')]({'where':{'id':_0x155812['params']['id']}})[_0x097b('0x27')](handleEntityNotFound(_0x299a04,null))[_0x097b('0x27')](saveUpdates(_0x155812[_0x097b('0x49')],null))['then'](respondWithResult(_0x299a04,null))[_0x097b('0x47')](handleError(_0x299a04,null));};exports[_0x097b('0x28')]=function(_0x36cc06,_0x391857){return db[_0x097b('0x2e')][_0x097b('0x46')]({'where':{'id':_0x36cc06['params']['id']}})[_0x097b('0x27')](handleEntityNotFound(_0x391857,null))[_0x097b('0x27')](removeEntity(_0x391857,null))[_0x097b('0x47')](handleError(_0x391857,null));};exports['getSubjects']=function(_0x3a6d4c,_0x722ec5,_0x222258){var _0x27967d={};var _0x320f4c={};var _0x4a4540;var _0x3c55fa;return db[_0x097b('0x2e')]['findOne']({'where':{'id':_0x3a6d4c['params']['id']}})[_0x097b('0x27')](handleEntityNotFound(_0x722ec5,null))[_0x097b('0x27')](function(_0x4add4f){if(_0x4add4f){_0x4a4540=_0x4add4f;_0x320f4c[_0x097b('0x31')]=_['keys'](db['FreshsalesField'][_0x097b('0x2f')]);_0x320f4c[_0x097b('0x33')]=_[_0x097b('0x34')](_0x3a6d4c[_0x097b('0x33')]);_0x320f4c['filters']=_[_0x097b('0x37')](_0x320f4c[_0x097b('0x31')],_0x320f4c['query']);_0x27967d[_0x097b('0x36')]=_[_0x097b('0x37')](_0x320f4c[_0x097b('0x31')],qs['fields'](_0x3a6d4c[_0x097b('0x33')][_0x097b('0x38')]));_0x27967d[_0x097b('0x36')]=_0x27967d[_0x097b('0x36')][_0x097b('0x39')]?_0x27967d[_0x097b('0x36')]:_0x320f4c['model'];_0x27967d[_0x097b('0x3a')]=qs[_0x097b('0x3b')](_0x3a6d4c['query'][_0x097b('0x3b')]);_0x27967d[_0x097b('0x3c')]=qs[_0x097b('0x35')](_[_0x097b('0x4a')](_0x3a6d4c[_0x097b('0x33')],_0x320f4c[_0x097b('0x35')]));if(_0x3a6d4c[_0x097b('0x33')]['filter']){_0x27967d[_0x097b('0x3c')]=_[_0x097b('0x3f')](_0x27967d['where'],{'$or':_[_0x097b('0x32')](_0x27967d[_0x097b('0x36')],function(_0x373cfb){var _0x313405={};_0x313405[_0x373cfb]={'$like':'%'+_0x3a6d4c[_0x097b('0x33')][_0x097b('0x3d')]+'%'};return _0x313405;})});}_0x27967d=_[_0x097b('0x3f')]({},_0x27967d,_0x3a6d4c[_0x097b('0x40')]);return _0x4a4540[_0x097b('0x4b')](_0x27967d);}})[_0x097b('0x27')](function(_0x1c75f8){if(_0x1c75f8){_0x3c55fa=_0x1c75f8[_0x097b('0x39')];if(!_0x3a6d4c[_0x097b('0x33')][_0x097b('0x4c')]('nolimit')){_0x27967d[_0x097b('0x20')]=qs['limit'](_0x3a6d4c['query'][_0x097b('0x20')]);_0x27967d[_0x097b('0x1e')]=qs[_0x097b('0x1e')](_0x3a6d4c['query'][_0x097b('0x1e')]);}return _0x4a4540[_0x097b('0x4b')](_0x27967d);}})[_0x097b('0x27')](function(_0x24d014){if(_0x24d014){return _0x24d014?{'count':_0x3c55fa,'rows':_0x24d014}:null;}})['then'](respondWithResult(_0x722ec5,null))[_0x097b('0x47')](handleError(_0x722ec5,null));};exports[_0x097b('0x4d')]=function(_0x3373a2,_0x5a7cd3,_0x5e4a51){var _0x121a1b={};var _0x1d0900={};var _0x20c4a3;var _0x175b7d;return db['FreshsalesConfiguration'][_0x097b('0x4e')]({'where':{'id':_0x3373a2[_0x097b('0x45')]['id']}})['then'](handleEntityNotFound(_0x5a7cd3,null))[_0x097b('0x27')](function(_0x4b8206){if(_0x4b8206){_0x20c4a3=_0x4b8206;_0x1d0900[_0x097b('0x31')]=_['keys'](db[_0x097b('0x4f')][_0x097b('0x2f')]);_0x1d0900[_0x097b('0x33')]=_[_0x097b('0x34')](_0x3373a2['query']);_0x1d0900[_0x097b('0x35')]=_[_0x097b('0x37')](_0x1d0900[_0x097b('0x31')],_0x1d0900[_0x097b('0x33')]);_0x121a1b[_0x097b('0x36')]=_[_0x097b('0x37')](_0x1d0900[_0x097b('0x31')],qs[_0x097b('0x38')](_0x3373a2['query'][_0x097b('0x38')]));_0x121a1b[_0x097b('0x36')]=_0x121a1b[_0x097b('0x36')][_0x097b('0x39')]?_0x121a1b['attributes']:_0x1d0900[_0x097b('0x31')];_0x121a1b[_0x097b('0x3a')]=qs[_0x097b('0x3b')](_0x3373a2['query'][_0x097b('0x3b')]);_0x121a1b['where']=qs[_0x097b('0x35')](_[_0x097b('0x4a')](_0x3373a2['query'],_0x1d0900[_0x097b('0x35')]));if(_0x3373a2[_0x097b('0x33')]['filter']){_0x121a1b[_0x097b('0x3c')]=_[_0x097b('0x3f')](_0x121a1b[_0x097b('0x3c')],{'$or':_['map'](_0x121a1b['attributes'],function(_0x5337e0){var _0x4208b5={};_0x4208b5[_0x5337e0]={'$like':'%'+_0x3373a2[_0x097b('0x33')][_0x097b('0x3d')]+'%'};return _0x4208b5;})});}_0x121a1b=_['merge']({},_0x121a1b,_0x3373a2['options']);return _0x20c4a3['getDescriptions'](_0x121a1b);}})[_0x097b('0x27')](function(_0x1053ca){if(_0x1053ca){_0x175b7d=_0x1053ca[_0x097b('0x39')];if(!_0x3373a2['query'][_0x097b('0x4c')]('nolimit')){_0x121a1b['limit']=qs['limit'](_0x3373a2['query'][_0x097b('0x20')]);_0x121a1b[_0x097b('0x1e')]=qs[_0x097b('0x1e')](_0x3373a2[_0x097b('0x33')][_0x097b('0x1e')]);}return _0x20c4a3[_0x097b('0x4d')](_0x121a1b);}})[_0x097b('0x27')](function(_0x4f5c95){if(_0x4f5c95){return _0x4f5c95?{'count':_0x175b7d,'rows':_0x4f5c95}:null;}})[_0x097b('0x27')](respondWithResult(_0x5a7cd3,null))['catch'](handleError(_0x5a7cd3,null));};exports['getFields']=function(_0x34d692,_0x4a87f8,_0x234f3b){var _0x2eba34={};var _0x5c4fe0={};var _0xf83379;var _0x4cbc39;return db[_0x097b('0x2e')][_0x097b('0x4e')]({'where':{'id':_0x34d692[_0x097b('0x45')]['id']}})[_0x097b('0x27')](handleEntityNotFound(_0x4a87f8,null))['then'](function(_0x2d9301){if(_0x2d9301){_0xf83379=_0x2d9301;_0x5c4fe0['model']=_[_0x097b('0x34')](db['FreshsalesField'][_0x097b('0x2f')]);_0x5c4fe0[_0x097b('0x33')]=_[_0x097b('0x34')](_0x34d692['query']);_0x5c4fe0['filters']=_['intersection'](_0x5c4fe0[_0x097b('0x31')],_0x5c4fe0[_0x097b('0x33')]);_0x2eba34['attributes']=_[_0x097b('0x37')](_0x5c4fe0['model'],qs['fields'](_0x34d692[_0x097b('0x33')][_0x097b('0x38')]));_0x2eba34[_0x097b('0x36')]=_0x2eba34[_0x097b('0x36')][_0x097b('0x39')]?_0x2eba34['attributes']:_0x5c4fe0[_0x097b('0x31')];_0x2eba34[_0x097b('0x3a')]=qs['sort'](_0x34d692[_0x097b('0x33')][_0x097b('0x3b')]);_0x2eba34[_0x097b('0x3c')]=qs[_0x097b('0x35')](_['pick'](_0x34d692[_0x097b('0x33')],_0x5c4fe0[_0x097b('0x35')]));if(_0x34d692['query'][_0x097b('0x3d')]){_0x2eba34[_0x097b('0x3c')]=_[_0x097b('0x3f')](_0x2eba34[_0x097b('0x3c')],{'$or':_[_0x097b('0x32')](_0x2eba34[_0x097b('0x36')],function(_0x15a952){var _0x53ac5a={};_0x53ac5a[_0x15a952]={'$like':'%'+_0x34d692['query'][_0x097b('0x3d')]+'%'};return _0x53ac5a;})});}_0x2eba34=_['merge']({},_0x2eba34,_0x34d692[_0x097b('0x40')]);return _0xf83379[_0x097b('0x50')](_0x2eba34);}})[_0x097b('0x27')](function(_0x297574){if(_0x297574){_0x4cbc39=_0x297574[_0x097b('0x39')];if(!_0x34d692[_0x097b('0x33')][_0x097b('0x4c')](_0x097b('0x51'))){_0x2eba34[_0x097b('0x20')]=qs[_0x097b('0x20')](_0x34d692[_0x097b('0x33')][_0x097b('0x20')]);_0x2eba34[_0x097b('0x1e')]=qs[_0x097b('0x1e')](_0x34d692[_0x097b('0x33')][_0x097b('0x1e')]);}return _0xf83379[_0x097b('0x50')](_0x2eba34);}})[_0x097b('0x27')](function(_0x3b3cf1){if(_0x3b3cf1){return _0x3b3cf1?{'count':_0x4cbc39,'rows':_0x3b3cf1}:null;}})['then'](respondWithResult(_0x4a87f8,null))['catch'](handleError(_0x4a87f8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 6a9b4c8..21d6b5e 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 _0xdb5e=['../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x35b2b7,_0x1df89a){var _0x5bfdee=function(_0x4269ea){while(--_0x4269ea){_0x35b2b7['push'](_0x35b2b7['shift']());}};_0x5bfdee(++_0x1df89a);}(_0xdb5e,0x1cc));var _0xedb5=function(_0x170a28,_0x76e6d5){_0x170a28=_0x170a28-0x0;var _0x5ef0ca=_0xdb5e[_0x170a28];return _0x5ef0ca;};'use strict';var _=require(_0xedb5('0x0'));var util=require(_0xedb5('0x1'));var logger=require(_0xedb5('0x2'))('api');var moment=require(_0xedb5('0x3'));var BPromise=require(_0xedb5('0x4'));var rp=require(_0xedb5('0x5'));var fs=require('fs');var path=require(_0xedb5('0x6'));var rimraf=require(_0xedb5('0x7'));var config=require(_0xedb5('0x8'));var attributes=require(_0xedb5('0x9'));module[_0xedb5('0xa')]=function(_0x23e2b5,_0x3af511){return _0x23e2b5[_0xedb5('0xb')]('FreshsalesConfiguration',attributes,{'tableName':_0xedb5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2195=['bluebird','request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','util','../../config/logger','moment'];(function(_0x4996d5,_0x123daf){var _0x4793f9=function(_0x30c7ec){while(--_0x30c7ec){_0x4996d5['push'](_0x4996d5['shift']());}};_0x4793f9(++_0x123daf);}(_0x2195,0xed));var _0x5219=function(_0x5a0b42,_0x3e3308){_0x5a0b42=_0x5a0b42-0x0;var _0x1ecfad=_0x2195[_0x5a0b42];return _0x1ecfad;};'use strict';var _=require('lodash');var util=require(_0x5219('0x0'));var logger=require(_0x5219('0x1'))('api');var moment=require(_0x5219('0x2'));var BPromise=require(_0x5219('0x3'));var rp=require(_0x5219('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5219('0x5'));var attributes=require(_0x5219('0x6'));module[_0x5219('0x7')]=function(_0x587cd8,_0x445120){return _0x587cd8[_0x5219('0x8')](_0x5219('0x9'),attributes,{'tableName':'int_freshsales_configurations','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 7396302..f38beb5 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 _0x1426=['client','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4d35f3,_0x19ba66){var _0x382fea=function(_0x2c2390){while(--_0x2c2390){_0x4d35f3['push'](_0x4d35f3['shift']());}};_0x382fea(++_0x19ba66);}(_0x1426,0x186));var _0x6142=function(_0x1317af,_0x4d5cb9){_0x1317af=_0x1317af-0x0;var _0x40cadd=_0x1426[_0x1317af];return _0x40cadd;};'use strict';var _=require(_0x6142('0x0'));var util=require(_0x6142('0x1'));var moment=require(_0x6142('0x2'));var BPromise=require(_0x6142('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6142('0x4'));var db=require(_0x6142('0x5'))['db'];var utils=require(_0x6142('0x6'));var logger=require(_0x6142('0x7'))(_0x6142('0x8'));var config=require(_0x6142('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6142('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49e63e,_0x5dc777,_0x361dd8){return new BPromise(function(_0xc87fcf,_0x3db726){return client[_0x6142('0xb')](_0x49e63e,_0x361dd8)['then'](function(_0x2819ba){logger[_0x6142('0xc')](_0x6142('0xd'),_0x5dc777,_0x6142('0xe'));logger['debug'](_0x6142('0xf'),_0x5dc777,_0x6142('0xe'),JSON[_0x6142('0x10')](_0x2819ba));if(_0x2819ba[_0x6142('0x11')]){if(_0x2819ba[_0x6142('0x11')][_0x6142('0x12')]===0x1f4){logger[_0x6142('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5dc777,_0x2819ba[_0x6142('0x11')][_0x6142('0x13')]);return _0x3db726(_0x2819ba['error'][_0x6142('0x13')]);}logger[_0x6142('0x11')](_0x6142('0xd'),_0x5dc777,_0x2819ba[_0x6142('0x11')][_0x6142('0x13')]);return _0xc87fcf(_0x2819ba[_0x6142('0x11')][_0x6142('0x13')]);}else{logger[_0x6142('0xc')](_0x6142('0xd'),_0x5dc777,'request\x20sent');_0xc87fcf(_0x2819ba['result']['message']);}})['catch'](function(_0x50ada5){logger[_0x6142('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5dc777,_0x50ada5);_0x3db726(_0x50ada5);});});} \ No newline at end of file +var _0x47eb=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3381f4,_0x178384){var _0x116e37=function(_0x2f0032){while(--_0x2f0032){_0x3381f4['push'](_0x3381f4['shift']());}};_0x116e37(++_0x178384);}(_0x47eb,0x99));var _0xb47e=function(_0x16f77c,_0x5256b1){_0x16f77c=_0x16f77c-0x0;var _0x78986e=_0x47eb[_0x16f77c];return _0x78986e;};'use strict';var _=require(_0xb47e('0x0'));var util=require(_0xb47e('0x1'));var moment=require('moment');var BPromise=require(_0xb47e('0x2'));var rs=require(_0xb47e('0x3'));var fs=require('fs');var Redis=require(_0xb47e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb47e('0x5'));var logger=require(_0xb47e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb47e('0x7'));var client=jayson[_0xb47e('0x8')][_0xb47e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b5011,_0x10715e,_0x3758b4){return new BPromise(function(_0x540c29,_0x5daa1f){return client['request'](_0x3b5011,_0x3758b4)[_0xb47e('0xa')](function(_0x5706fc){logger['info'](_0xb47e('0xb'),_0x10715e,_0xb47e('0xc'));logger[_0xb47e('0xd')](_0xb47e('0xe'),_0x10715e,_0xb47e('0xc'),JSON[_0xb47e('0xf')](_0x5706fc));if(_0x5706fc[_0xb47e('0x10')]){if(_0x5706fc[_0xb47e('0x10')][_0xb47e('0x11')]===0x1f4){logger[_0xb47e('0x10')](_0xb47e('0xb'),_0x10715e,_0x5706fc[_0xb47e('0x10')]['message']);return _0x5daa1f(_0x5706fc[_0xb47e('0x10')]['message']);}logger[_0xb47e('0x10')](_0xb47e('0xb'),_0x10715e,_0x5706fc[_0xb47e('0x10')][_0xb47e('0x12')]);return _0x540c29(_0x5706fc[_0xb47e('0x10')][_0xb47e('0x12')]);}else{logger['info'](_0xb47e('0xb'),_0x10715e,_0xb47e('0xc'));_0x540c29(_0x5706fc[_0xb47e('0x13')][_0xb47e('0x12')]);}})[_0xb47e('0x14')](function(_0x409120){logger[_0xb47e('0x10')](_0xb47e('0xb'),_0x10715e,_0x409120);_0x5daa1f(_0x409120);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 7dd4de2..6e879a7 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 _0x1b32=['isAuthenticated','index','/:id','show','put','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get'];(function(_0x313927,_0x2b3a6d){var _0x545b28=function(_0x1be96e){while(--_0x1be96e){_0x313927['push'](_0x313927['shift']());}};_0x545b28(++_0x2b3a6d);}(_0x1b32,0x85));var _0x21b3=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x1b32[_0x59d89e];return _0x554e93;};'use strict';var multer=require('multer');var util=require(_0x21b3('0x0'));var path=require(_0x21b3('0x1'));var timeout=require(_0x21b3('0x2'));var express=require(_0x21b3('0x3'));var router=express[_0x21b3('0x4')]();var fs_extra=require(_0x21b3('0x5'));var auth=require(_0x21b3('0x6'));var interaction=require(_0x21b3('0x7'));var config=require(_0x21b3('0x8'));var controller=require(_0x21b3('0x9'));router[_0x21b3('0xa')]('/',auth[_0x21b3('0xb')](),controller[_0x21b3('0xc')]);router[_0x21b3('0xa')](_0x21b3('0xd'),auth['isAuthenticated'](),controller[_0x21b3('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x21b3('0xf')](_0x21b3('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x21b3('0x10')](_0x21b3('0xd'),auth[_0x21b3('0xb')](),controller['destroy']);module[_0x21b3('0x11')]=router; \ No newline at end of file +var _0x2a41=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5bf9dd,_0x17f447){var _0x8df32b=function(_0x2b3a4d){while(--_0x2b3a4d){_0x5bf9dd['push'](_0x5bf9dd['shift']());}};_0x8df32b(++_0x17f447);}(_0x2a41,0x126));var _0x12a4=function(_0x4e7f7e,_0xef5c04){_0x4e7f7e=_0x4e7f7e-0x0;var _0x1b45af=_0x2a41[_0x4e7f7e];return _0x1b45af;};'use strict';var multer=require(_0x12a4('0x0'));var util=require('util');var path=require(_0x12a4('0x1'));var timeout=require(_0x12a4('0x2'));var express=require(_0x12a4('0x3'));var router=express[_0x12a4('0x4')]();var fs_extra=require(_0x12a4('0x5'));var auth=require(_0x12a4('0x6'));var interaction=require(_0x12a4('0x7'));var config=require(_0x12a4('0x8'));var controller=require(_0x12a4('0x9'));router['get']('/',auth[_0x12a4('0xa')](),controller[_0x12a4('0xb')]);router['get']('/:id',auth[_0x12a4('0xa')](),controller['show']);router[_0x12a4('0xc')]('/',auth[_0x12a4('0xa')](),controller[_0x12a4('0xd')]);router[_0x12a4('0xe')](_0x12a4('0xf'),auth['isAuthenticated'](),controller[_0x12a4('0x10')]);router[_0x12a4('0x11')](_0x12a4('0xf'),auth[_0x12a4('0xa')](),controller[_0x12a4('0x12')]);module[_0x12a4('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index b33443b..24157d5 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 _0xa821=['ENUM','variable','customVariable','keyValue','picklist','STRING','string','BOOLEAN','sequelize','exports'];(function(_0xc4b950,_0x53310b){var _0x1a80bd=function(_0x5587cb){while(--_0x5587cb){_0xc4b950['push'](_0xc4b950['shift']());}};_0x1a80bd(++_0x53310b);}(_0xa821,0x116));var _0x1a82=function(_0x25c4df,_0x11403f){_0x25c4df=_0x25c4df-0x0;var _0x9762b6=_0xa821[_0x25c4df];return _0x9762b6;};'use strict';var Sequelize=require(_0x1a82('0x0'));module[_0x1a82('0x1')]={'type':{'type':Sequelize[_0x1a82('0x2')]('string',_0x1a82('0x3'),_0x1a82('0x4'),_0x1a82('0x5'),_0x1a82('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1a82('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1a82('0x2')](_0x1a82('0x8'),_0x1a82('0x3'),_0x1a82('0x4'))},'keyContent':{'type':Sequelize[_0x1a82('0x7')]},'idField':{'type':Sequelize[_0x1a82('0x7')]},'nameField':{'type':Sequelize[_0x1a82('0x7')]},'customField':{'type':Sequelize[_0x1a82('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1a82('0x7')]}}; \ No newline at end of file +var _0xd235=['customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x2c4b8f,_0x532b0d){var _0x19d3ef=function(_0x27b890){while(--_0x27b890){_0x2c4b8f['push'](_0x2c4b8f['shift']());}};_0x19d3ef(++_0x532b0d);}(_0xd235,0x191));var _0x5d23=function(_0x2d66ca,_0x20d7d9){_0x2d66ca=_0x2d66ca-0x0;var _0x24e8c5=_0xd235[_0x2d66ca];return _0x24e8c5;};'use strict';var Sequelize=require('sequelize');module[_0x5d23('0x0')]={'type':{'type':Sequelize[_0x5d23('0x1')](_0x5d23('0x2'),_0x5d23('0x3'),_0x5d23('0x4'),_0x5d23('0x5'),_0x5d23('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5d23('0x7')]},'key':{'type':Sequelize[_0x5d23('0x7')]},'keyType':{'type':Sequelize[_0x5d23('0x1')](_0x5d23('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x5d23('0x7')]},'idField':{'type':Sequelize[_0x5d23('0x7')]},'nameField':{'type':Sequelize[_0x5d23('0x7')]},'customField':{'type':Sequelize[_0x5d23('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5d23('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index f539c98..f451ab8 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 _0x1ebe=['catch','show','params','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','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','merge','VIRTUAL','options','include','findAll','rows'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1ebe,0xf7));var _0xe1eb=function(_0x3aab0a,_0x17a881){_0x3aab0a=_0x3aab0a-0x0;var _0x56a482=_0x1ebe[_0x3aab0a];return _0x56a482;};'use strict';var emlformat=require(_0xe1eb('0x0'));var rimraf=require(_0xe1eb('0x1'));var zipdir=require(_0xe1eb('0x2'));var jsonpatch=require(_0xe1eb('0x3'));var rp=require(_0xe1eb('0x4'));var moment=require(_0xe1eb('0x5'));var BPromise=require(_0xe1eb('0x6'));var Mustache=require(_0xe1eb('0x7'));var util=require(_0xe1eb('0x8'));var path=require(_0xe1eb('0x9'));var sox=require(_0xe1eb('0xa'));var csv=require(_0xe1eb('0xb'));var ejs=require(_0xe1eb('0xc'));var fs=require('fs');var fs_extra=require(_0xe1eb('0xd'));var _=require(_0xe1eb('0xe'));var squel=require('squel');var crypto=require(_0xe1eb('0xf'));var jsforce=require(_0xe1eb('0x10'));var deskjs=require(_0xe1eb('0x11'));var toCsv=require(_0xe1eb('0xb'));var querystring=require(_0xe1eb('0x12'));var Papa=require(_0xe1eb('0x13'));var Redis=require('ioredis');var authService=require(_0xe1eb('0x14'));var qs=require(_0xe1eb('0x15'));var as=require(_0xe1eb('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe1eb('0x17'))(_0xe1eb('0x18'));var utils=require(_0xe1eb('0x19'));var config=require(_0xe1eb('0x1a'));var licenseUtil=require(_0xe1eb('0x1b'));var db=require(_0xe1eb('0x1c'))['db'];function respondWithStatusCode(_0x946db9,_0x504436){_0x504436=_0x504436||0xcc;return function(_0x1ba5a5){if(_0x1ba5a5){return _0x946db9['sendStatus'](_0x504436);}return _0x946db9['status'](_0x504436)[_0xe1eb('0x1d')]();};}function respondWithResult(_0x4e8587,_0xa6d13b){_0xa6d13b=_0xa6d13b||0xc8;return function(_0x492731){if(_0x492731){return _0x4e8587[_0xe1eb('0x1e')](_0xa6d13b)[_0xe1eb('0x1f')](_0x492731);}};}function respondWithFilteredResult(_0x3e766c,_0x343da2){return function(_0xdbfd6f){if(_0xdbfd6f){var _0x401cb1=typeof _0x343da2[_0xe1eb('0x20')]==='undefined'&&typeof _0x343da2[_0xe1eb('0x21')]===_0xe1eb('0x22');var _0x373bca=_0xdbfd6f[_0xe1eb('0x23')];var _0x5aa455=_0x401cb1?0x0:_0x343da2['offset'];var _0x4f9e4d=_0x401cb1?_0xdbfd6f[_0xe1eb('0x23')]:_0x343da2['offset']+_0x343da2[_0xe1eb('0x21')];var _0x3c16df;if(_0x4f9e4d>=_0x373bca){_0x4f9e4d=_0x373bca;_0x3c16df=0xc8;}else{_0x3c16df=0xce;}_0x3e766c['status'](_0x3c16df);return _0x3e766c[_0xe1eb('0x24')](_0xe1eb('0x25'),_0x5aa455+'-'+_0x4f9e4d+'/'+_0x373bca)[_0xe1eb('0x1f')](_0xdbfd6f);}return null;};}function patchUpdates(_0x2e164a){return function(_0x4d6ac6){try{jsonpatch[_0xe1eb('0x26')](_0x4d6ac6,_0x2e164a,!![]);}catch(_0x207fbe){return BPromise['reject'](_0x207fbe);}return _0x4d6ac6[_0xe1eb('0x27')]();};}function saveUpdates(_0x29e967,_0x3935a5){return function(_0x4015cf){if(_0x4015cf){return _0x4015cf[_0xe1eb('0x28')](_0x29e967)[_0xe1eb('0x29')](function(_0x3984f9){return _0x3984f9;});}return null;};}function removeEntity(_0x238ddc,_0x1faf30){return function(_0x5c3a42){if(_0x5c3a42){return _0x5c3a42[_0xe1eb('0x2a')]()[_0xe1eb('0x29')](function(){_0x238ddc[_0xe1eb('0x1e')](0xcc)[_0xe1eb('0x1d')]();});}};}function handleEntityNotFound(_0x1fbb68,_0x3da1e0){return function(_0x5a78d8){if(!_0x5a78d8){_0x1fbb68[_0xe1eb('0x2b')](0x194);}return _0x5a78d8;};}function handleError(_0x3de041,_0x1fea40){_0x1fea40=_0x1fea40||0x1f4;return function(_0x109f0e){logger['error'](_0x109f0e[_0xe1eb('0x2c')]);if(_0x109f0e[_0xe1eb('0x2d')]){delete _0x109f0e[_0xe1eb('0x2d')];}_0x3de041[_0xe1eb('0x1e')](_0x1fea40)[_0xe1eb('0x2e')](_0x109f0e);};}exports[_0xe1eb('0x2f')]=function(_0x5a63f7,_0x3f4dd6){var _0x3a2cc9={},_0x4e6f01={},_0x238573={'count':0x0,'rows':[]};var _0x3250f4=_[_0xe1eb('0x30')](db[_0xe1eb('0x31')][_0xe1eb('0x32')],function(_0x14bc67){return{'name':_0x14bc67[_0xe1eb('0x33')],'type':_0x14bc67[_0xe1eb('0x34')][_0xe1eb('0x35')]};});_0x4e6f01[_0xe1eb('0x36')]=_[_0xe1eb('0x30')](_0x3250f4,'name');_0x4e6f01[_0xe1eb('0x37')]=_[_0xe1eb('0x38')](_0x5a63f7[_0xe1eb('0x37')]);_0x4e6f01['filters']=_[_0xe1eb('0x39')](_0x4e6f01[_0xe1eb('0x36')],_0x4e6f01['query']);_0x3a2cc9[_0xe1eb('0x3a')]=_[_0xe1eb('0x39')](_0x4e6f01[_0xe1eb('0x36')],qs[_0xe1eb('0x3b')](_0x5a63f7[_0xe1eb('0x37')][_0xe1eb('0x3b')]));_0x3a2cc9['attributes']=_0x3a2cc9[_0xe1eb('0x3a')][_0xe1eb('0x3c')]?_0x3a2cc9[_0xe1eb('0x3a')]:_0x4e6f01[_0xe1eb('0x36')];if(!_0x5a63f7[_0xe1eb('0x37')][_0xe1eb('0x3d')](_0xe1eb('0x3e'))){_0x3a2cc9[_0xe1eb('0x21')]=qs['limit'](_0x5a63f7[_0xe1eb('0x37')][_0xe1eb('0x21')]);_0x3a2cc9[_0xe1eb('0x20')]=qs[_0xe1eb('0x20')](_0x5a63f7[_0xe1eb('0x37')][_0xe1eb('0x20')]);}_0x3a2cc9[_0xe1eb('0x3f')]=qs['sort'](_0x5a63f7[_0xe1eb('0x37')]['sort']);_0x3a2cc9[_0xe1eb('0x40')]=qs[_0xe1eb('0x41')](_[_0xe1eb('0x42')](_0x5a63f7[_0xe1eb('0x37')],_0x4e6f01['filters']),_0x3250f4);if(_0x5a63f7[_0xe1eb('0x37')]['filter']){_0x3a2cc9[_0xe1eb('0x40')]=_[_0xe1eb('0x43')](_0x3a2cc9[_0xe1eb('0x40')],{'$or':_['map'](_0x3250f4,function(_0xc60eba){if(_0xc60eba[_0xe1eb('0x34')]!==_0xe1eb('0x44')){var _0x424ac2={};_0x424ac2[_0xc60eba['name']]={'$like':'%'+_0x5a63f7[_0xe1eb('0x37')]['filter']+'%'};return _0x424ac2;}})});}_0x3a2cc9=_[_0xe1eb('0x43')]({},_0x3a2cc9,_0x5a63f7[_0xe1eb('0x45')]);var _0x7d7abc={'where':_0x3a2cc9['where']};return db[_0xe1eb('0x31')][_0xe1eb('0x23')](_0x7d7abc)[_0xe1eb('0x29')](function(_0x4384a1){_0x238573[_0xe1eb('0x23')]=_0x4384a1;if(_0x5a63f7[_0xe1eb('0x37')]['includeAll']){_0x3a2cc9[_0xe1eb('0x46')]=[{'all':!![]}];}return db[_0xe1eb('0x31')][_0xe1eb('0x47')](_0x3a2cc9);})['then'](function(_0xdfdd54){_0x238573[_0xe1eb('0x48')]=_0xdfdd54;return _0x238573;})['then'](respondWithFilteredResult(_0x3f4dd6,_0x3a2cc9))[_0xe1eb('0x49')](handleError(_0x3f4dd6,null));};exports[_0xe1eb('0x4a')]=function(_0x560434,_0x4fb81d){var _0x4818fb={'raw':!![],'where':{'id':_0x560434[_0xe1eb('0x4b')]['id']}},_0x5b75a5={};_0x5b75a5[_0xe1eb('0x36')]=_[_0xe1eb('0x38')](db['FreshsalesField'][_0xe1eb('0x32')]);_0x5b75a5[_0xe1eb('0x37')]=_[_0xe1eb('0x38')](_0x560434[_0xe1eb('0x37')]);_0x5b75a5[_0xe1eb('0x41')]=_[_0xe1eb('0x39')](_0x5b75a5[_0xe1eb('0x36')],_0x5b75a5[_0xe1eb('0x37')]);_0x4818fb['attributes']=_[_0xe1eb('0x39')](_0x5b75a5[_0xe1eb('0x36')],qs['fields'](_0x560434['query'][_0xe1eb('0x3b')]));_0x4818fb[_0xe1eb('0x3a')]=_0x4818fb[_0xe1eb('0x3a')][_0xe1eb('0x3c')]?_0x4818fb['attributes']:_0x5b75a5[_0xe1eb('0x36')];if(_0x560434[_0xe1eb('0x37')][_0xe1eb('0x4c')]){_0x4818fb[_0xe1eb('0x46')]=[{'all':!![]}];}_0x4818fb=_[_0xe1eb('0x43')]({},_0x4818fb,_0x560434[_0xe1eb('0x45')]);return db['FreshsalesField'][_0xe1eb('0x4d')](_0x4818fb)[_0xe1eb('0x29')](handleEntityNotFound(_0x4fb81d,null))[_0xe1eb('0x29')](respondWithResult(_0x4fb81d,null))[_0xe1eb('0x49')](handleError(_0x4fb81d,null));};exports['create']=function(_0x54abff,_0x24fdc5){return db['FreshsalesField'][_0xe1eb('0x4e')](_0x54abff[_0xe1eb('0x4f')],{})[_0xe1eb('0x29')](respondWithResult(_0x24fdc5,0xc9))[_0xe1eb('0x49')](handleError(_0x24fdc5,null));};exports[_0xe1eb('0x28')]=function(_0x26bc77,_0x454d5b){if(_0x26bc77[_0xe1eb('0x4f')]['id']){delete _0x26bc77['body']['id'];}return db['FreshsalesField'][_0xe1eb('0x4d')]({'where':{'id':_0x26bc77['params']['id']}})[_0xe1eb('0x29')](handleEntityNotFound(_0x454d5b,null))[_0xe1eb('0x29')](saveUpdates(_0x26bc77['body'],null))[_0xe1eb('0x29')](respondWithResult(_0x454d5b,null))[_0xe1eb('0x49')](handleError(_0x454d5b,null));};exports['destroy']=function(_0x2a1664,_0x3b2dec){return db[_0xe1eb('0x31')][_0xe1eb('0x4d')]({'where':{'id':_0x2a1664[_0xe1eb('0x4b')]['id']}})[_0xe1eb('0x29')](handleEntityNotFound(_0x3b2dec,null))[_0xe1eb('0x29')](removeEntity(_0x3b2dec,null))[_0xe1eb('0x49')](handleError(_0x3b2dec,null));}; \ No newline at end of file +var _0x7051=['end','json','offset','limit','count','apply','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesField','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','params','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x7051,0x15a));var _0x1705=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x7051[_0x51c819];return _0x15c5d2;};'use strict';var emlformat=require(_0x1705('0x0'));var rimraf=require(_0x1705('0x1'));var zipdir=require(_0x1705('0x2'));var jsonpatch=require(_0x1705('0x3'));var rp=require(_0x1705('0x4'));var moment=require('moment');var BPromise=require(_0x1705('0x5'));var Mustache=require(_0x1705('0x6'));var util=require(_0x1705('0x7'));var path=require(_0x1705('0x8'));var sox=require(_0x1705('0x9'));var csv=require(_0x1705('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1705('0xb'));var _=require(_0x1705('0xc'));var squel=require(_0x1705('0xd'));var crypto=require(_0x1705('0xe'));var jsforce=require(_0x1705('0xf'));var deskjs=require(_0x1705('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1705('0x11'));var Redis=require(_0x1705('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1705('0x13'));var as=require(_0x1705('0x14'));var hardwareService=require(_0x1705('0x15'));var logger=require(_0x1705('0x16'))(_0x1705('0x17'));var utils=require('../../config/utils');var config=require(_0x1705('0x18'));var licenseUtil=require(_0x1705('0x19'));var db=require(_0x1705('0x1a'))['db'];function respondWithStatusCode(_0x108c17,_0x176634){_0x176634=_0x176634||0xcc;return function(_0x490600){if(_0x490600){return _0x108c17[_0x1705('0x1b')](_0x176634);}return _0x108c17[_0x1705('0x1c')](_0x176634)[_0x1705('0x1d')]();};}function respondWithResult(_0x1f127a,_0x374f69){_0x374f69=_0x374f69||0xc8;return function(_0x159066){if(_0x159066){return _0x1f127a[_0x1705('0x1c')](_0x374f69)[_0x1705('0x1e')](_0x159066);}};}function respondWithFilteredResult(_0x309480,_0x5bad5a){return function(_0x27e270){if(_0x27e270){var _0x44e520=typeof _0x5bad5a[_0x1705('0x1f')]==='undefined'&&typeof _0x5bad5a[_0x1705('0x20')]==='undefined';var _0x186b0e=_0x27e270[_0x1705('0x21')];var _0x531574=_0x44e520?0x0:_0x5bad5a[_0x1705('0x1f')];var _0x442026=_0x44e520?_0x27e270['count']:_0x5bad5a['offset']+_0x5bad5a[_0x1705('0x20')];var _0x36ec71;if(_0x442026>=_0x186b0e){_0x442026=_0x186b0e;_0x36ec71=0xc8;}else{_0x36ec71=0xce;}_0x309480['status'](_0x36ec71);return _0x309480['set']('Content-Range',_0x531574+'-'+_0x442026+'/'+_0x186b0e)['json'](_0x27e270);}return null;};}function patchUpdates(_0x3b0855){return function(_0x3a2640){try{jsonpatch[_0x1705('0x22')](_0x3a2640,_0x3b0855,!![]);}catch(_0x2bce2c){return BPromise['reject'](_0x2bce2c);}return _0x3a2640[_0x1705('0x23')]();};}function saveUpdates(_0x211ac2,_0x4fb680){return function(_0x5d562f){if(_0x5d562f){return _0x5d562f[_0x1705('0x24')](_0x211ac2)['then'](function(_0x148ac2){return _0x148ac2;});}return null;};}function removeEntity(_0x55eb60,_0x5b0488){return function(_0x109c47){if(_0x109c47){return _0x109c47[_0x1705('0x25')]()[_0x1705('0x26')](function(){_0x55eb60[_0x1705('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x163683,_0x34cb3f){return function(_0x1f9717){if(!_0x1f9717){_0x163683[_0x1705('0x1b')](0x194);}return _0x1f9717;};}function handleError(_0x5cc1c1,_0x5c5dfd){_0x5c5dfd=_0x5c5dfd||0x1f4;return function(_0xd20468){logger[_0x1705('0x27')](_0xd20468[_0x1705('0x28')]);if(_0xd20468[_0x1705('0x29')]){delete _0xd20468[_0x1705('0x29')];}_0x5cc1c1[_0x1705('0x1c')](_0x5c5dfd)[_0x1705('0x2a')](_0xd20468);};}exports[_0x1705('0x2b')]=function(_0x492c73,_0x184a68){var _0x418075={},_0x5f40be={},_0x376b0b={'count':0x0,'rows':[]};var _0xf7fef7=_[_0x1705('0x2c')](db[_0x1705('0x2d')]['rawAttributes'],function(_0x4ee90d){return{'name':_0x4ee90d[_0x1705('0x2e')],'type':_0x4ee90d[_0x1705('0x2f')][_0x1705('0x30')]};});_0x5f40be['model']=_[_0x1705('0x2c')](_0xf7fef7,_0x1705('0x29'));_0x5f40be[_0x1705('0x31')]=_[_0x1705('0x32')](_0x492c73[_0x1705('0x31')]);_0x5f40be[_0x1705('0x33')]=_[_0x1705('0x34')](_0x5f40be[_0x1705('0x35')],_0x5f40be[_0x1705('0x31')]);_0x418075[_0x1705('0x36')]=_[_0x1705('0x34')](_0x5f40be[_0x1705('0x35')],qs[_0x1705('0x37')](_0x492c73[_0x1705('0x31')][_0x1705('0x37')]));_0x418075['attributes']=_0x418075['attributes'][_0x1705('0x38')]?_0x418075[_0x1705('0x36')]:_0x5f40be[_0x1705('0x35')];if(!_0x492c73[_0x1705('0x31')][_0x1705('0x39')](_0x1705('0x3a'))){_0x418075[_0x1705('0x20')]=qs[_0x1705('0x20')](_0x492c73['query'][_0x1705('0x20')]);_0x418075[_0x1705('0x1f')]=qs[_0x1705('0x1f')](_0x492c73[_0x1705('0x31')][_0x1705('0x1f')]);}_0x418075[_0x1705('0x3b')]=qs[_0x1705('0x3c')](_0x492c73[_0x1705('0x31')]['sort']);_0x418075['where']=qs[_0x1705('0x33')](_[_0x1705('0x3d')](_0x492c73[_0x1705('0x31')],_0x5f40be[_0x1705('0x33')]),_0xf7fef7);if(_0x492c73[_0x1705('0x31')][_0x1705('0x3e')]){_0x418075[_0x1705('0x3f')]=_[_0x1705('0x40')](_0x418075[_0x1705('0x3f')],{'$or':_[_0x1705('0x2c')](_0xf7fef7,function(_0x2c80da){if(_0x2c80da[_0x1705('0x2f')]!==_0x1705('0x41')){var _0x122c4a={};_0x122c4a[_0x2c80da[_0x1705('0x29')]]={'$like':'%'+_0x492c73[_0x1705('0x31')][_0x1705('0x3e')]+'%'};return _0x122c4a;}})});}_0x418075=_[_0x1705('0x40')]({},_0x418075,_0x492c73['options']);var _0x2d078d={'where':_0x418075[_0x1705('0x3f')]};return db[_0x1705('0x2d')]['count'](_0x2d078d)['then'](function(_0x487de1){_0x376b0b[_0x1705('0x21')]=_0x487de1;if(_0x492c73['query'][_0x1705('0x42')]){_0x418075[_0x1705('0x43')]=[{'all':!![]}];}return db[_0x1705('0x2d')][_0x1705('0x44')](_0x418075);})[_0x1705('0x26')](function(_0x306c5c){_0x376b0b['rows']=_0x306c5c;return _0x376b0b;})[_0x1705('0x26')](respondWithFilteredResult(_0x184a68,_0x418075))[_0x1705('0x45')](handleError(_0x184a68,null));};exports['show']=function(_0x4deb88,_0x2aeb0f){var _0x1460be={'raw':!![],'where':{'id':_0x4deb88[_0x1705('0x46')]['id']}},_0x3b75e8={};_0x3b75e8[_0x1705('0x35')]=_['keys'](db[_0x1705('0x2d')]['rawAttributes']);_0x3b75e8[_0x1705('0x31')]=_[_0x1705('0x32')](_0x4deb88[_0x1705('0x31')]);_0x3b75e8['filters']=_[_0x1705('0x34')](_0x3b75e8[_0x1705('0x35')],_0x3b75e8[_0x1705('0x31')]);_0x1460be[_0x1705('0x36')]=_[_0x1705('0x34')](_0x3b75e8[_0x1705('0x35')],qs['fields'](_0x4deb88[_0x1705('0x31')][_0x1705('0x37')]));_0x1460be[_0x1705('0x36')]=_0x1460be['attributes'][_0x1705('0x38')]?_0x1460be['attributes']:_0x3b75e8[_0x1705('0x35')];if(_0x4deb88['query'][_0x1705('0x42')]){_0x1460be[_0x1705('0x43')]=[{'all':!![]}];}_0x1460be=_['merge']({},_0x1460be,_0x4deb88[_0x1705('0x47')]);return db[_0x1705('0x2d')]['find'](_0x1460be)[_0x1705('0x26')](handleEntityNotFound(_0x2aeb0f,null))['then'](respondWithResult(_0x2aeb0f,null))[_0x1705('0x45')](handleError(_0x2aeb0f,null));};exports[_0x1705('0x48')]=function(_0xea5ca7,_0x1d7e06){return db[_0x1705('0x2d')][_0x1705('0x48')](_0xea5ca7['body'],{})[_0x1705('0x26')](respondWithResult(_0x1d7e06,0xc9))[_0x1705('0x45')](handleError(_0x1d7e06,null));};exports[_0x1705('0x24')]=function(_0x396129,_0x4fea4f){if(_0x396129['body']['id']){delete _0x396129[_0x1705('0x49')]['id'];}return db[_0x1705('0x2d')][_0x1705('0x4a')]({'where':{'id':_0x396129[_0x1705('0x46')]['id']}})['then'](handleEntityNotFound(_0x4fea4f,null))[_0x1705('0x26')](saveUpdates(_0x396129[_0x1705('0x49')],null))['then'](respondWithResult(_0x4fea4f,null))[_0x1705('0x45')](handleError(_0x4fea4f,null));};exports[_0x1705('0x25')]=function(_0xb7dbfe,_0x11882b){return db[_0x1705('0x2d')]['find']({'where':{'id':_0xb7dbfe[_0x1705('0x46')]['id']}})[_0x1705('0x26')](handleEntityNotFound(_0x11882b,null))['then'](removeEntity(_0x11882b,null))[_0x1705('0x45')](handleError(_0x11882b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 6f08c15..941ddd9 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 _0x7fb3=['FreshsalesField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','exports','define'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x7fb3,0xf9));var _0x37fb=function(_0x5d72c8,_0x85e2e1){_0x5d72c8=_0x5d72c8-0x0;var _0x3abc9e=_0x7fb3[_0x5d72c8];return _0x3abc9e;};'use strict';var _=require(_0x37fb('0x0'));var util=require(_0x37fb('0x1'));var logger=require(_0x37fb('0x2'))(_0x37fb('0x3'));var moment=require('moment');var BPromise=require(_0x37fb('0x4'));var rp=require(_0x37fb('0x5'));var fs=require('fs');var path=require(_0x37fb('0x6'));var rimraf=require(_0x37fb('0x7'));var config=require('../../config/environment');var attributes=require(_0x37fb('0x8'));module[_0x37fb('0x9')]=function(_0x2443bd,_0x23a839){return _0x2443bd[_0x37fb('0xa')](_0x37fb('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0x37fb('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fb3=['FreshsalesField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','exports','define'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x7fb3,0xf9));var _0x37fb=function(_0x5930aa,_0xf07ae){_0x5930aa=_0x5930aa-0x0;var _0x274e6c=_0x7fb3[_0x5930aa];return _0x274e6c;};'use strict';var _=require(_0x37fb('0x0'));var util=require(_0x37fb('0x1'));var logger=require(_0x37fb('0x2'))(_0x37fb('0x3'));var moment=require('moment');var BPromise=require(_0x37fb('0x4'));var rp=require(_0x37fb('0x5'));var fs=require('fs');var path=require(_0x37fb('0x6'));var rimraf=require(_0x37fb('0x7'));var config=require('../../config/environment');var attributes=require(_0x37fb('0x8'));module[_0x37fb('0x9')]=function(_0x2443bd,_0x23a839){return _0x2443bd[_0x37fb('0xa')](_0x37fb('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0x37fb('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 ba86e55..62129f2 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 _0x1261=['then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x32baef,_0x5716fc){var _0x35281a=function(_0x2b16bc){while(--_0x2b16bc){_0x32baef['push'](_0x32baef['shift']());}};_0x35281a(++_0x5716fc);}(_0x1261,0x144));var _0x1126=function(_0x326d35,_0x4f65b3){_0x326d35=_0x326d35-0x0;var _0xd3f8f3=_0x1261[_0x326d35];return _0xd3f8f3;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x53ec,0x192));var _0xc53e=function(_0x1ca7c4,_0x1436c8){_0x1ca7c4=_0x1ca7c4-0x0;var _0x5399c7=_0x53ec[_0x1ca7c4];return _0x5399c7;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 88c95af..90b90e8 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(_0x250c04,_0x3f55b7){var _0x5eb860=function(_0x3706d2){while(--_0x3706d2){_0x250c04['push'](_0x250c04['shift']());}};_0x5eb860(++_0x3f55b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 _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(_0xa4eb63,_0x35d6b5){var _0x58e616=function(_0x2a76d9){while(--_0x2a76d9){_0xa4eb63['push'](_0xa4eb63['shift']());}};_0x58e616(++_0x35d6b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 27aae3f..d8b58a3 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 _0x202a=['exports','STRING','username','integrationTab'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x202a,0xc0));var _0xa202=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x202a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xa202('0x0')]={'name':{'type':Sequelize[_0xa202('0x1')]},'description':{'type':Sequelize[_0xa202('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xa202('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xa202('0x1')]},'securityToken':{'type':Sequelize[_0xa202('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa202('0x3'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xb145=['username','ENUM','integrationTab','exports','STRING'];(function(_0x4d66cc,_0x38bae9){var _0x5f37ef=function(_0x101d36){while(--_0x101d36){_0x4d66cc['push'](_0x4d66cc['shift']());}};_0x5f37ef(++_0x38bae9);}(_0xb145,0xa3));var _0x5b14=function(_0x4caf57,_0x372554){_0x4caf57=_0x4caf57-0x0;var _0x20ce07=_0xb145[_0x4caf57];return _0x20ce07;};'use strict';var Sequelize=require('sequelize');module[_0x5b14('0x0')]={'name':{'type':Sequelize[_0x5b14('0x1')]},'description':{'type':Sequelize[_0x5b14('0x1')]},'username':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x2')},'remoteUri':{'type':Sequelize[_0x5b14('0x1')]},'password':{'type':Sequelize[_0x5b14('0x1')]},'clientId':{'type':Sequelize[_0x5b14('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x5b14('0x1')]},'serverUrl':{'type':Sequelize[_0x5b14('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5b14('0x3')](_0x5b14('0x4'),'newTab'),'defaultValue':_0x5b14('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 05b32dd..8d3f4ea 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 _0x0060=['concat','isNil','ticketType','sobject','ActivityDate','IsReminderSet','IsRecurrence','Description','string','int','boolean','email','textarea','remove','includes','custom','picklistValues','value','True','true','false','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','map','VIRTUAL','filter','merge','SalesforceAccount','includeAll','include','findAll','rows','catch','show','options','create','body','update','find','params','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','password','securityToken','remoteUri','slice','substring','lastIndexOf','Connection','clientId','clientSecret','username'];(function(_0x5b6373,_0x57c264){var _0x3c268c=function(_0x4e09d1){while(--_0x4e09d1){_0x5b6373['push'](_0x5b6373['shift']());}};_0x3c268c(++_0x57c264);}(_0x0060,0x93));var _0x0006=function(_0x40d69c,_0x17a711){_0x40d69c=_0x40d69c-0x0;var _0xb7f3c=_0x0060[_0x40d69c];return _0xb7f3c;};'use strict';var emlformat=require(_0x0006('0x0'));var rimraf=require(_0x0006('0x1'));var zipdir=require(_0x0006('0x2'));var jsonpatch=require(_0x0006('0x3'));var rp=require(_0x0006('0x4'));var moment=require(_0x0006('0x5'));var BPromise=require(_0x0006('0x6'));var Mustache=require('mustache');var util=require(_0x0006('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0006('0x8'));var ejs=require(_0x0006('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0006('0xa'));var squel=require('squel');var crypto=require(_0x0006('0xb'));var jsforce=require(_0x0006('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0006('0xd'));var Papa=require(_0x0006('0xe'));var Redis=require(_0x0006('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0006('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0006('0x11'));var logger=require(_0x0006('0x12'))('api');var utils=require(_0x0006('0x13'));var config=require(_0x0006('0x14'));var licenseUtil=require(_0x0006('0x15'));var db=require(_0x0006('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2ed1bc,_0x3ebe02){_0x3ebe02=_0x3ebe02||0xcc;return function(_0x54de86){if(_0x54de86){return _0x2ed1bc[_0x0006('0x17')](_0x3ebe02);}return _0x2ed1bc[_0x0006('0x18')](_0x3ebe02)[_0x0006('0x19')]();};}function respondWithResult(_0x1f2691,_0x5a3004){_0x5a3004=_0x5a3004||0xc8;return function(_0x5e4b19){if(_0x5e4b19){return _0x1f2691[_0x0006('0x18')](_0x5a3004)[_0x0006('0x1a')](_0x5e4b19);}};}function respondWithFilteredResult(_0x3bcd15,_0x376946){return function(_0x46a05d){if(_0x46a05d){var _0x2b52f7=typeof _0x376946[_0x0006('0x1b')]==='undefined'&&typeof _0x376946[_0x0006('0x1c')]==='undefined';var _0x1baa95=_0x46a05d[_0x0006('0x1d')];var _0x5e347e=_0x2b52f7?0x0:_0x376946['offset'];var _0x3f2322=_0x2b52f7?_0x46a05d[_0x0006('0x1d')]:_0x376946[_0x0006('0x1b')]+_0x376946[_0x0006('0x1c')];var _0x539b71;if(_0x3f2322>=_0x1baa95){_0x3f2322=_0x1baa95;_0x539b71=0xc8;}else{_0x539b71=0xce;}_0x3bcd15[_0x0006('0x18')](_0x539b71);return _0x3bcd15[_0x0006('0x1e')](_0x0006('0x1f'),_0x5e347e+'-'+_0x3f2322+'/'+_0x1baa95)[_0x0006('0x1a')](_0x46a05d);}return null;};}function patchUpdates(_0x2403b1){return function(_0x4f1a07){try{jsonpatch[_0x0006('0x20')](_0x4f1a07,_0x2403b1,!![]);}catch(_0x5bde09){return BPromise[_0x0006('0x21')](_0x5bde09);}return _0x4f1a07['save']();};}function saveUpdates(_0x380b0a,_0x578363){return function(_0x240fa5){if(_0x240fa5){return _0x240fa5['update'](_0x380b0a)[_0x0006('0x22')](function(_0x18f44f){return _0x18f44f;});}return null;};}function removeEntity(_0x18f6f0,_0x143867){return function(_0x4ecfd3){if(_0x4ecfd3){return _0x4ecfd3[_0x0006('0x23')]()['then'](function(){_0x18f6f0[_0x0006('0x18')](0xcc)[_0x0006('0x19')]();});}};}function handleEntityNotFound(_0x157d4f,_0xd18ba1){return function(_0xa948a){if(!_0xa948a){_0x157d4f[_0x0006('0x17')](0x194);}return _0xa948a;};}function handleError(_0x552f5a,_0x47553b){_0x47553b=_0x47553b||0x1f4;return function(_0x49a941){logger[_0x0006('0x24')](_0x49a941[_0x0006('0x25')]);if(_0x49a941[_0x0006('0x26')]){delete _0x49a941[_0x0006('0x26')];}_0x552f5a[_0x0006('0x18')](_0x47553b)[_0x0006('0x27')](_0x49a941);};}exports[_0x0006('0x28')]=function(_0x3247a4,_0xbf5e69){var _0x28ba92={},_0x2de08b={},_0x40e4fd={'count':0x0,'rows':[]};var _0x3ffd84=_['map'](db['SalesforceAccount'][_0x0006('0x29')],function(_0x1a1f2e){return{'name':_0x1a1f2e['fieldName'],'type':_0x1a1f2e[_0x0006('0x2a')][_0x0006('0x2b')]};});_0x2de08b[_0x0006('0x2c')]=_['map'](_0x3ffd84,_0x0006('0x26'));_0x2de08b['query']=_[_0x0006('0x2d')](_0x3247a4['query']);_0x2de08b[_0x0006('0x2e')]=_[_0x0006('0x2f')](_0x2de08b[_0x0006('0x2c')],_0x2de08b[_0x0006('0x30')]);_0x28ba92[_0x0006('0x31')]=_['intersection'](_0x2de08b['model'],qs['fields'](_0x3247a4[_0x0006('0x30')][_0x0006('0x32')]));_0x28ba92[_0x0006('0x31')]=_0x28ba92[_0x0006('0x31')][_0x0006('0x33')]?_0x28ba92[_0x0006('0x31')]:_0x2de08b['model'];if(!_0x3247a4[_0x0006('0x30')][_0x0006('0x34')](_0x0006('0x35'))){_0x28ba92[_0x0006('0x1c')]=qs[_0x0006('0x1c')](_0x3247a4[_0x0006('0x30')][_0x0006('0x1c')]);_0x28ba92[_0x0006('0x1b')]=qs[_0x0006('0x1b')](_0x3247a4['query'][_0x0006('0x1b')]);}_0x28ba92[_0x0006('0x36')]=qs[_0x0006('0x37')](_0x3247a4[_0x0006('0x30')][_0x0006('0x37')]);_0x28ba92[_0x0006('0x38')]=qs['filters'](_['pick'](_0x3247a4[_0x0006('0x30')],_0x2de08b[_0x0006('0x2e')]),_0x3ffd84);if(_0x3247a4['query']['filter']){_0x28ba92['where']=_['merge'](_0x28ba92[_0x0006('0x38')],{'$or':_[_0x0006('0x39')](_0x3ffd84,function(_0x5a1add){if(_0x5a1add[_0x0006('0x2a')]!==_0x0006('0x3a')){var _0x220a02={};_0x220a02[_0x5a1add[_0x0006('0x26')]]={'$like':'%'+_0x3247a4[_0x0006('0x30')][_0x0006('0x3b')]+'%'};return _0x220a02;}})});}_0x28ba92=_[_0x0006('0x3c')]({},_0x28ba92,_0x3247a4['options']);var _0x2e8a03={'where':_0x28ba92[_0x0006('0x38')]};return db[_0x0006('0x3d')][_0x0006('0x1d')](_0x2e8a03)[_0x0006('0x22')](function(_0x83c79a){_0x40e4fd[_0x0006('0x1d')]=_0x83c79a;if(_0x3247a4[_0x0006('0x30')][_0x0006('0x3e')]){_0x28ba92[_0x0006('0x3f')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x0006('0x40')](_0x28ba92);})['then'](function(_0x23ad34){_0x40e4fd[_0x0006('0x41')]=_0x23ad34;return _0x40e4fd;})['then'](respondWithFilteredResult(_0xbf5e69,_0x28ba92))[_0x0006('0x42')](handleError(_0xbf5e69,null));};exports[_0x0006('0x43')]=function(_0x27bb90,_0x6aa47c){var _0x54f59f={'raw':![],'where':{'id':_0x27bb90['params']['id']}},_0x48edd7={};_0x48edd7[_0x0006('0x2c')]=_[_0x0006('0x2d')](db[_0x0006('0x3d')][_0x0006('0x29')]);_0x48edd7[_0x0006('0x30')]=_['keys'](_0x27bb90[_0x0006('0x30')]);_0x48edd7[_0x0006('0x2e')]=_[_0x0006('0x2f')](_0x48edd7[_0x0006('0x2c')],_0x48edd7[_0x0006('0x30')]);_0x54f59f[_0x0006('0x31')]=_['intersection'](_0x48edd7[_0x0006('0x2c')],qs[_0x0006('0x32')](_0x27bb90[_0x0006('0x30')][_0x0006('0x32')]));_0x54f59f[_0x0006('0x31')]=_0x54f59f[_0x0006('0x31')][_0x0006('0x33')]?_0x54f59f[_0x0006('0x31')]:_0x48edd7['model'];if(_0x27bb90[_0x0006('0x30')][_0x0006('0x3e')]){_0x54f59f['include']=[{'all':!![]}];}_0x54f59f=_[_0x0006('0x3c')]({},_0x54f59f,_0x27bb90[_0x0006('0x44')]);return db['SalesforceAccount']['find'](_0x54f59f)[_0x0006('0x22')](handleEntityNotFound(_0x6aa47c,null))[_0x0006('0x22')](respondWithResult(_0x6aa47c,null))[_0x0006('0x42')](handleError(_0x6aa47c,null));};exports[_0x0006('0x45')]=function(_0x831eb4,_0x132bb1){return db['SalesforceAccount'][_0x0006('0x45')](_0x831eb4[_0x0006('0x46')],{})[_0x0006('0x22')](respondWithResult(_0x132bb1,0xc9))[_0x0006('0x42')](handleError(_0x132bb1,null));};exports[_0x0006('0x47')]=function(_0x374f00,_0x42179c){if(_0x374f00['body']['id']){delete _0x374f00[_0x0006('0x46')]['id'];}return db['SalesforceAccount'][_0x0006('0x48')]({'where':{'id':_0x374f00[_0x0006('0x49')]['id']}})[_0x0006('0x22')](handleEntityNotFound(_0x42179c,null))['then'](saveUpdates(_0x374f00[_0x0006('0x46')],null))[_0x0006('0x22')](respondWithResult(_0x42179c,null))[_0x0006('0x42')](handleError(_0x42179c,null));};exports[_0x0006('0x23')]=function(_0x2f95d1,_0x3fc6af){return db[_0x0006('0x3d')][_0x0006('0x48')]({'where':{'id':_0x2f95d1[_0x0006('0x49')]['id']}})[_0x0006('0x22')](handleEntityNotFound(_0x3fc6af,null))['then'](removeEntity(_0x3fc6af,null))[_0x0006('0x42')](handleError(_0x3fc6af,null));};exports[_0x0006('0x4a')]=function(_0x586353,_0x590007,_0x18a91e){var _0xd8ee1e={};var _0x32edda={};var _0x2830e2;var _0x3cfeee;return db['SalesforceAccount'][_0x0006('0x4b')]({'where':{'id':_0x586353[_0x0006('0x49')]['id']}})['then'](handleEntityNotFound(_0x590007,null))[_0x0006('0x22')](function(_0x55bf92){if(_0x55bf92){_0x2830e2=_0x55bf92;_0x32edda[_0x0006('0x2c')]=_[_0x0006('0x2d')](db['SalesforceConfiguration'][_0x0006('0x29')]);_0x32edda[_0x0006('0x30')]=_['keys'](_0x586353[_0x0006('0x30')]);_0x32edda[_0x0006('0x2e')]=_[_0x0006('0x2f')](_0x32edda[_0x0006('0x2c')],_0x32edda[_0x0006('0x30')]);_0xd8ee1e[_0x0006('0x31')]=_['intersection'](_0x32edda[_0x0006('0x2c')],qs[_0x0006('0x32')](_0x586353['query'][_0x0006('0x32')]));_0xd8ee1e[_0x0006('0x31')]=_0xd8ee1e[_0x0006('0x31')][_0x0006('0x33')]?_0xd8ee1e[_0x0006('0x31')]:_0x32edda['model'];_0xd8ee1e['order']=qs[_0x0006('0x37')](_0x586353[_0x0006('0x30')][_0x0006('0x37')]);_0xd8ee1e['where']=qs[_0x0006('0x2e')](_[_0x0006('0x4c')](_0x586353[_0x0006('0x30')],_0x32edda[_0x0006('0x2e')]));if(_0x586353['query']['filter']){_0xd8ee1e[_0x0006('0x38')]=_[_0x0006('0x3c')](_0xd8ee1e['where'],{'$or':_[_0x0006('0x39')](_0xd8ee1e[_0x0006('0x31')],function(_0x5d45f0){var _0x382f6f={};_0x382f6f[_0x5d45f0]={'$like':'%'+_0x586353[_0x0006('0x30')][_0x0006('0x3b')]+'%'};return _0x382f6f;})});}_0xd8ee1e=_[_0x0006('0x3c')]({},_0xd8ee1e,_0x586353[_0x0006('0x44')]);return _0x2830e2['getConfigurations'](_0xd8ee1e);}})[_0x0006('0x22')](function(_0x2a66c1){if(_0x2a66c1){_0x3cfeee=_0x2a66c1[_0x0006('0x33')];if(!_0x586353[_0x0006('0x30')][_0x0006('0x34')](_0x0006('0x35'))){_0xd8ee1e[_0x0006('0x1c')]=qs[_0x0006('0x1c')](_0x586353[_0x0006('0x30')]['limit']);_0xd8ee1e['offset']=qs['offset'](_0x586353['query'][_0x0006('0x1b')]);}return _0x2830e2[_0x0006('0x4a')](_0xd8ee1e);}})[_0x0006('0x22')](function(_0x39af6a){if(_0x39af6a){return _0x39af6a?{'count':_0x3cfeee,'rows':_0x39af6a}:null;}})[_0x0006('0x22')](respondWithResult(_0x590007,null))[_0x0006('0x42')](handleError(_0x590007,null));};exports[_0x0006('0x4d')]=function(_0x1ba52b,_0x756268,_0x1e69e7){if(_0x1ba52b['body']['id']){delete _0x1ba52b[_0x0006('0x46')]['id'];}return db['SalesforceAccount'][_0x0006('0x4b')]({'where':{'id':_0x1ba52b[_0x0006('0x49')]['id']}})[_0x0006('0x22')](handleEntityNotFound(_0x756268,null))['then'](function(_0xc4697b){if(_0xc4697b){_0x1ba52b[_0x0006('0x46')][_0x0006('0x4e')]=_0xc4697b['id'];_0x1ba52b[_0x0006('0x46')][_0x0006('0x4f')]=integrations['getSubjects'](_0x1ba52b[_0x0006('0x46')][_0x0006('0x50')],_0x1ba52b[_0x0006('0x46')][_0x0006('0x2a')]);_0x1ba52b[_0x0006('0x46')][_0x0006('0x51')]=integrations[_0x0006('0x52')](_0x1ba52b[_0x0006('0x46')][_0x0006('0x50')],_0x1ba52b['body']['type']);return db[_0x0006('0x53')]['create'](_0x1ba52b['body'],{'include':[{'model':db[_0x0006('0x54')],'as':_0x0006('0x4f')},{'model':db[_0x0006('0x54')],'as':_0x0006('0x51')}]});}return null;})[_0x0006('0x22')](respondWithResult(_0x756268,null))[_0x0006('0x42')](handleError(_0x756268,null));};exports[_0x0006('0x55')]=function(_0x2720eb,_0x2c719d,_0x1b2b40){var _0x4ad1ec;var _0x93c95f='';var _0x5bd9b1=_0x0006('0x56');return db[_0x0006('0x3d')]['findOne']({'where':{'id':_0x2720eb[_0x0006('0x49')]['id']},'attributes':['id','remoteUri','clientId','clientSecret','username',_0x0006('0x57'),_0x0006('0x58')]})[_0x0006('0x22')](handleEntityNotFound(_0x2c719d,null))[_0x0006('0x22')](function(_0x48a60d){if(_0x48a60d){_0x93c95f=_0x48a60d[_0x0006('0x59')];var _0x1e7fa4=_0x93c95f[_0x0006('0x5a')](-0x1);if(_0x1e7fa4==='/'){_0x93c95f=_0x93c95f[_0x0006('0x5b')](0x0,_0x93c95f[_0x0006('0x5c')](_0x1e7fa4));}_0x4ad1ec=new jsforce[(_0x0006('0x5d'))]({'oauth2':{'loginUrl':_0x93c95f,'clientId':_0x48a60d[_0x0006('0x5e')],'clientSecret':_0x48a60d[_0x0006('0x5f')]}});return _0x4ad1ec['login'](_0x48a60d[_0x0006('0x60')],_0x48a60d[_0x0006('0x57')][_0x0006('0x61')](_0x48a60d[_0x0006('0x58')]));}})['then'](function(_0x10c9a2){if(_0x10c9a2){if(!_[_0x0006('0x62')](_0x2720eb['query'][_0x0006('0x63')])){_0x5bd9b1=_0x2720eb[_0x0006('0x30')]['ticketType'];}return _0x4ad1ec[_0x0006('0x64')](_0x5bd9b1)['describe']();}})['then'](function(_0xcf4a75){var _0x1a2b9a=['OwnerId',_0x0006('0x65'),_0x0006('0x66'),_0x0006('0x67'),'Subject',_0x0006('0x68')];var _0x1460b6=[_0x0006('0x69'),_0x0006('0x6a'),'picklist',_0x0006('0x6b'),_0x0006('0x6c'),_0x0006('0x6d'),'phone'];if(_0xcf4a75){_[_0x0006('0x6e')](_0xcf4a75['fields'],function(_0x3fd9c9){return _0x1a2b9a[_0x0006('0x6f')](_0x3fd9c9[_0x0006('0x26')])||!_0x1460b6[_0x0006('0x6f')](_0x3fd9c9[_0x0006('0x2a')]);});return{'count':_0xcf4a75[_0x0006('0x32')]['length'],'rows':_['map'](_0xcf4a75[_0x0006('0x32')],function(_0x3747c9){return{'id':_0x3747c9[_0x0006('0x26')],'name':_0x3747c9['label'],'custom':_0x3747c9[_0x0006('0x70')],'options':_0x3747c9[_0x0006('0x71')]['length']>0x0?_[_0x0006('0x39')](_0x3747c9[_0x0006('0x71')],function(_0x504c2b){return{'name':_0x504c2b['label'],'value':_0x504c2b[_0x0006('0x72')]};}):_0x3747c9['type']=='boolean'?[{'name':_0x0006('0x73'),'value':_0x0006('0x74')},{'name':'False','value':_0x0006('0x75')}]:[]};})};}})[_0x0006('0x22')](respondWithResult(_0x2c719d,null))['catch'](function(_0x4df14e){var _0x169e6b=_0x2720eb[_0x0006('0x30')]['test']?0x1f4:_0x4df14e[_0x0006('0x76')]||0x1f4;logger[_0x0006('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x0006('0x55'),_0x169e6b,JSON[_0x0006('0x77')](_0x4df14e));delete _0x4df14e[_0x0006('0x26')];if(_0x169e6b===0x191){_0x169e6b=0x190;}_0x2c719d[_0x0006('0x18')](_0x169e6b)[_0x0006('0x27')](_0x2720eb[_0x0006('0x30')][_0x0006('0x78')]?{'message':_0x0006('0x79'),'statusCode':_0x4df14e[_0x0006('0x76')]}:_0x4df14e);});}; \ No newline at end of file +var _0x7457=['getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','SalesforceConfiguration','rawAttributes','getConfigurations','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','clientSecret','username','password','slice','lastIndexOf','Connection','login','concat','securityToken','ticketType','sobject','OwnerId','IsReminderSet','IsRecurrence','string','int','picklist','boolean','email','textarea','phone','includes','label','custom','picklistValues','value','True','False','test'];(function(_0x3ed82d,_0x3ae5fc){var _0x558669=function(_0x51c035){while(--_0x51c035){_0x3ed82d['push'](_0x3ed82d['shift']());}};_0x558669(++_0x3ae5fc);}(_0x7457,0x7a));var _0x7745=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x7457[_0x2d2c16];return _0x53f2fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7745('0x0'));var zipdir=require(_0x7745('0x1'));var jsonpatch=require(_0x7745('0x2'));var rp=require(_0x7745('0x3'));var moment=require('moment');var BPromise=require(_0x7745('0x4'));var Mustache=require(_0x7745('0x5'));var util=require(_0x7745('0x6'));var path=require(_0x7745('0x7'));var sox=require('sox');var csv=require(_0x7745('0x8'));var ejs=require(_0x7745('0x9'));var fs=require('fs');var fs_extra=require(_0x7745('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7745('0xb'));var jsforce=require(_0x7745('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7745('0x8'));var querystring=require(_0x7745('0xd'));var Papa=require(_0x7745('0xe'));var Redis=require(_0x7745('0xf'));var authService=require(_0x7745('0x10'));var qs=require(_0x7745('0x11'));var as=require(_0x7745('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7745('0x13'));var config=require(_0x7745('0x14'));var licenseUtil=require(_0x7745('0x15'));var db=require(_0x7745('0x16'))['db'];var integrations=require(_0x7745('0x17'));function respondWithStatusCode(_0x146177,_0x16c7fd){_0x16c7fd=_0x16c7fd||0xcc;return function(_0x4b60f4){if(_0x4b60f4){return _0x146177['sendStatus'](_0x16c7fd);}return _0x146177[_0x7745('0x18')](_0x16c7fd)[_0x7745('0x19')]();};}function respondWithResult(_0x326367,_0x14ac10){_0x14ac10=_0x14ac10||0xc8;return function(_0x54880a){if(_0x54880a){return _0x326367[_0x7745('0x18')](_0x14ac10)[_0x7745('0x1a')](_0x54880a);}};}function respondWithFilteredResult(_0x5acfef,_0x276e22){return function(_0x31e855){if(_0x31e855){var _0x15c5d3=typeof _0x276e22[_0x7745('0x1b')]==='undefined'&&typeof _0x276e22[_0x7745('0x1c')]===_0x7745('0x1d');var _0xa9fe91=_0x31e855[_0x7745('0x1e')];var _0x2d0509=_0x15c5d3?0x0:_0x276e22[_0x7745('0x1b')];var _0x484e43=_0x15c5d3?_0x31e855[_0x7745('0x1e')]:_0x276e22[_0x7745('0x1b')]+_0x276e22[_0x7745('0x1c')];var _0x4c2d87;if(_0x484e43>=_0xa9fe91){_0x484e43=_0xa9fe91;_0x4c2d87=0xc8;}else{_0x4c2d87=0xce;}_0x5acfef[_0x7745('0x18')](_0x4c2d87);return _0x5acfef[_0x7745('0x1f')](_0x7745('0x20'),_0x2d0509+'-'+_0x484e43+'/'+_0xa9fe91)[_0x7745('0x1a')](_0x31e855);}return null;};}function patchUpdates(_0x4368){return function(_0x26409b){try{jsonpatch[_0x7745('0x21')](_0x26409b,_0x4368,!![]);}catch(_0x4b1a5e){return BPromise['reject'](_0x4b1a5e);}return _0x26409b[_0x7745('0x22')]();};}function saveUpdates(_0x31fed7,_0x50332a){return function(_0x27ccba){if(_0x27ccba){return _0x27ccba[_0x7745('0x23')](_0x31fed7)[_0x7745('0x24')](function(_0x15281b){return _0x15281b;});}return null;};}function removeEntity(_0x4c5467,_0x22ed85){return function(_0x277572){if(_0x277572){return _0x277572[_0x7745('0x25')]()[_0x7745('0x24')](function(){_0x4c5467[_0x7745('0x18')](0xcc)[_0x7745('0x19')]();});}};}function handleEntityNotFound(_0x5b91b7,_0x4ac0bc){return function(_0x3a136c){if(!_0x3a136c){_0x5b91b7['sendStatus'](0x194);}return _0x3a136c;};}function handleError(_0x348e78,_0x37abb5){_0x37abb5=_0x37abb5||0x1f4;return function(_0x57ccf0){logger[_0x7745('0x26')](_0x57ccf0[_0x7745('0x27')]);if(_0x57ccf0[_0x7745('0x28')]){delete _0x57ccf0[_0x7745('0x28')];}_0x348e78['status'](_0x37abb5)[_0x7745('0x29')](_0x57ccf0);};}exports[_0x7745('0x2a')]=function(_0x3858f4,_0x260459){var _0x3b029d={},_0x38814e={},_0x5f125b={'count':0x0,'rows':[]};var _0x1f1a8a=_[_0x7745('0x2b')](db[_0x7745('0x2c')]['rawAttributes'],function(_0x3e4364){return{'name':_0x3e4364[_0x7745('0x2d')],'type':_0x3e4364[_0x7745('0x2e')]['key']};});_0x38814e[_0x7745('0x2f')]=_['map'](_0x1f1a8a,_0x7745('0x28'));_0x38814e['query']=_[_0x7745('0x30')](_0x3858f4[_0x7745('0x31')]);_0x38814e[_0x7745('0x32')]=_['intersection'](_0x38814e[_0x7745('0x2f')],_0x38814e[_0x7745('0x31')]);_0x3b029d[_0x7745('0x33')]=_[_0x7745('0x34')](_0x38814e[_0x7745('0x2f')],qs[_0x7745('0x35')](_0x3858f4['query'][_0x7745('0x35')]));_0x3b029d[_0x7745('0x33')]=_0x3b029d[_0x7745('0x33')][_0x7745('0x36')]?_0x3b029d[_0x7745('0x33')]:_0x38814e[_0x7745('0x2f')];if(!_0x3858f4[_0x7745('0x31')][_0x7745('0x37')](_0x7745('0x38'))){_0x3b029d[_0x7745('0x1c')]=qs[_0x7745('0x1c')](_0x3858f4[_0x7745('0x31')]['limit']);_0x3b029d[_0x7745('0x1b')]=qs[_0x7745('0x1b')](_0x3858f4[_0x7745('0x31')][_0x7745('0x1b')]);}_0x3b029d[_0x7745('0x39')]=qs['sort'](_0x3858f4[_0x7745('0x31')][_0x7745('0x3a')]);_0x3b029d['where']=qs[_0x7745('0x32')](_[_0x7745('0x3b')](_0x3858f4[_0x7745('0x31')],_0x38814e[_0x7745('0x32')]),_0x1f1a8a);if(_0x3858f4[_0x7745('0x31')][_0x7745('0x3c')]){_0x3b029d[_0x7745('0x3d')]=_[_0x7745('0x3e')](_0x3b029d[_0x7745('0x3d')],{'$or':_[_0x7745('0x2b')](_0x1f1a8a,function(_0x3592f0){if(_0x3592f0[_0x7745('0x2e')]!==_0x7745('0x3f')){var _0x23e633={};_0x23e633[_0x3592f0[_0x7745('0x28')]]={'$like':'%'+_0x3858f4[_0x7745('0x31')][_0x7745('0x3c')]+'%'};return _0x23e633;}})});}_0x3b029d=_['merge']({},_0x3b029d,_0x3858f4['options']);var _0x3300db={'where':_0x3b029d[_0x7745('0x3d')]};return db[_0x7745('0x2c')][_0x7745('0x1e')](_0x3300db)[_0x7745('0x24')](function(_0x4ce39d){_0x5f125b['count']=_0x4ce39d;if(_0x3858f4[_0x7745('0x31')][_0x7745('0x40')]){_0x3b029d[_0x7745('0x41')]=[{'all':!![]}];}return db[_0x7745('0x2c')][_0x7745('0x42')](_0x3b029d);})[_0x7745('0x24')](function(_0x235ebf){_0x5f125b[_0x7745('0x43')]=_0x235ebf;return _0x5f125b;})[_0x7745('0x24')](respondWithFilteredResult(_0x260459,_0x3b029d))[_0x7745('0x44')](handleError(_0x260459,null));};exports[_0x7745('0x45')]=function(_0x174379,_0x76349e){var _0x1aad63={'raw':![],'where':{'id':_0x174379['params']['id']}},_0x22a30f={};_0x22a30f['model']=_[_0x7745('0x30')](db['SalesforceAccount']['rawAttributes']);_0x22a30f[_0x7745('0x31')]=_[_0x7745('0x30')](_0x174379['query']);_0x22a30f['filters']=_[_0x7745('0x34')](_0x22a30f[_0x7745('0x2f')],_0x22a30f['query']);_0x1aad63[_0x7745('0x33')]=_[_0x7745('0x34')](_0x22a30f[_0x7745('0x2f')],qs['fields'](_0x174379['query']['fields']));_0x1aad63[_0x7745('0x33')]=_0x1aad63[_0x7745('0x33')]['length']?_0x1aad63[_0x7745('0x33')]:_0x22a30f['model'];if(_0x174379[_0x7745('0x31')]['includeAll']){_0x1aad63[_0x7745('0x41')]=[{'all':!![]}];}_0x1aad63=_['merge']({},_0x1aad63,_0x174379[_0x7745('0x46')]);return db[_0x7745('0x2c')][_0x7745('0x47')](_0x1aad63)[_0x7745('0x24')](handleEntityNotFound(_0x76349e,null))[_0x7745('0x24')](respondWithResult(_0x76349e,null))[_0x7745('0x44')](handleError(_0x76349e,null));};exports['create']=function(_0x1104e6,_0x521b8b){return db[_0x7745('0x2c')][_0x7745('0x48')](_0x1104e6['body'],{})['then'](respondWithResult(_0x521b8b,0xc9))[_0x7745('0x44')](handleError(_0x521b8b,null));};exports[_0x7745('0x23')]=function(_0x370f65,_0x262e2c){if(_0x370f65[_0x7745('0x49')]['id']){delete _0x370f65['body']['id'];}return db[_0x7745('0x2c')][_0x7745('0x47')]({'where':{'id':_0x370f65[_0x7745('0x4a')]['id']}})['then'](handleEntityNotFound(_0x262e2c,null))[_0x7745('0x24')](saveUpdates(_0x370f65[_0x7745('0x49')],null))[_0x7745('0x24')](respondWithResult(_0x262e2c,null))[_0x7745('0x44')](handleError(_0x262e2c,null));};exports[_0x7745('0x25')]=function(_0x1d0ea2,_0x1a0083){return db[_0x7745('0x2c')][_0x7745('0x47')]({'where':{'id':_0x1d0ea2['params']['id']}})[_0x7745('0x24')](handleEntityNotFound(_0x1a0083,null))['then'](removeEntity(_0x1a0083,null))[_0x7745('0x44')](handleError(_0x1a0083,null));};exports['getConfigurations']=function(_0x2f21a6,_0x128c4f,_0x5f077b){var _0x32d0b5={};var _0x49e5fb={};var _0x36e450;var _0x2928ff;return db[_0x7745('0x2c')]['findOne']({'where':{'id':_0x2f21a6[_0x7745('0x4a')]['id']}})['then'](handleEntityNotFound(_0x128c4f,null))[_0x7745('0x24')](function(_0x5d8cd7){if(_0x5d8cd7){_0x36e450=_0x5d8cd7;_0x49e5fb[_0x7745('0x2f')]=_[_0x7745('0x30')](db[_0x7745('0x4b')][_0x7745('0x4c')]);_0x49e5fb[_0x7745('0x31')]=_['keys'](_0x2f21a6[_0x7745('0x31')]);_0x49e5fb[_0x7745('0x32')]=_[_0x7745('0x34')](_0x49e5fb[_0x7745('0x2f')],_0x49e5fb[_0x7745('0x31')]);_0x32d0b5[_0x7745('0x33')]=_['intersection'](_0x49e5fb['model'],qs['fields'](_0x2f21a6['query']['fields']));_0x32d0b5[_0x7745('0x33')]=_0x32d0b5[_0x7745('0x33')][_0x7745('0x36')]?_0x32d0b5[_0x7745('0x33')]:_0x49e5fb[_0x7745('0x2f')];_0x32d0b5[_0x7745('0x39')]=qs['sort'](_0x2f21a6[_0x7745('0x31')][_0x7745('0x3a')]);_0x32d0b5[_0x7745('0x3d')]=qs[_0x7745('0x32')](_[_0x7745('0x3b')](_0x2f21a6[_0x7745('0x31')],_0x49e5fb[_0x7745('0x32')]));if(_0x2f21a6[_0x7745('0x31')][_0x7745('0x3c')]){_0x32d0b5[_0x7745('0x3d')]=_[_0x7745('0x3e')](_0x32d0b5[_0x7745('0x3d')],{'$or':_[_0x7745('0x2b')](_0x32d0b5[_0x7745('0x33')],function(_0x2537a9){var _0x252d91={};_0x252d91[_0x2537a9]={'$like':'%'+_0x2f21a6[_0x7745('0x31')][_0x7745('0x3c')]+'%'};return _0x252d91;})});}_0x32d0b5=_[_0x7745('0x3e')]({},_0x32d0b5,_0x2f21a6[_0x7745('0x46')]);return _0x36e450[_0x7745('0x4d')](_0x32d0b5);}})['then'](function(_0x16adc0){if(_0x16adc0){_0x2928ff=_0x16adc0['length'];if(!_0x2f21a6[_0x7745('0x31')][_0x7745('0x37')](_0x7745('0x38'))){_0x32d0b5[_0x7745('0x1c')]=qs['limit'](_0x2f21a6[_0x7745('0x31')][_0x7745('0x1c')]);_0x32d0b5['offset']=qs[_0x7745('0x1b')](_0x2f21a6[_0x7745('0x31')][_0x7745('0x1b')]);}return _0x36e450[_0x7745('0x4d')](_0x32d0b5);}})[_0x7745('0x24')](function(_0x3917f9){if(_0x3917f9){return _0x3917f9?{'count':_0x2928ff,'rows':_0x3917f9}:null;}})['then'](respondWithResult(_0x128c4f,null))[_0x7745('0x44')](handleError(_0x128c4f,null));};exports['addConfiguration']=function(_0x442d98,_0x5be0c3,_0x226fc5){if(_0x442d98['body']['id']){delete _0x442d98['body']['id'];}return db[_0x7745('0x2c')]['findOne']({'where':{'id':_0x442d98[_0x7745('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5be0c3,null))[_0x7745('0x24')](function(_0x2432db){if(_0x2432db){_0x442d98['body']['AccountId']=_0x2432db['id'];_0x442d98[_0x7745('0x49')]['Subjects']=integrations['getSubjects'](_0x442d98[_0x7745('0x49')][_0x7745('0x4e')],_0x442d98['body'][_0x7745('0x2e')]);_0x442d98['body'][_0x7745('0x4f')]=integrations[_0x7745('0x50')](_0x442d98[_0x7745('0x49')]['channel'],_0x442d98[_0x7745('0x49')][_0x7745('0x2e')]);return db[_0x7745('0x4b')][_0x7745('0x48')](_0x442d98[_0x7745('0x49')],{'include':[{'model':db[_0x7745('0x51')],'as':_0x7745('0x52')},{'model':db[_0x7745('0x51')],'as':_0x7745('0x4f')}]});}return null;})[_0x7745('0x24')](respondWithResult(_0x5be0c3,null))[_0x7745('0x44')](handleError(_0x5be0c3,null));};exports[_0x7745('0x53')]=function(_0x1d7207,_0xb430e6,_0x59a520){var _0x1f0439;var _0x303ab7='';var _0x4a0475=_0x7745('0x54');return db['SalesforceAccount']['findOne']({'where':{'id':_0x1d7207[_0x7745('0x4a')]['id']},'attributes':['id',_0x7745('0x55'),_0x7745('0x56'),_0x7745('0x57'),_0x7745('0x58'),_0x7745('0x59'),'securityToken']})[_0x7745('0x24')](handleEntityNotFound(_0xb430e6,null))[_0x7745('0x24')](function(_0x3d9603){if(_0x3d9603){_0x303ab7=_0x3d9603[_0x7745('0x55')];var _0x4bcf81=_0x303ab7[_0x7745('0x5a')](-0x1);if(_0x4bcf81==='/'){_0x303ab7=_0x303ab7['substring'](0x0,_0x303ab7[_0x7745('0x5b')](_0x4bcf81));}_0x1f0439=new jsforce[(_0x7745('0x5c'))]({'oauth2':{'loginUrl':_0x303ab7,'clientId':_0x3d9603[_0x7745('0x56')],'clientSecret':_0x3d9603['clientSecret']}});return _0x1f0439[_0x7745('0x5d')](_0x3d9603[_0x7745('0x58')],_0x3d9603[_0x7745('0x59')][_0x7745('0x5e')](_0x3d9603[_0x7745('0x5f')]));}})[_0x7745('0x24')](function(_0x1ba297){if(_0x1ba297){if(!_['isNil'](_0x1d7207[_0x7745('0x31')][_0x7745('0x60')])){_0x4a0475=_0x1d7207[_0x7745('0x31')][_0x7745('0x60')];}return _0x1f0439[_0x7745('0x61')](_0x4a0475)['describe']();}})[_0x7745('0x24')](function(_0x490cd5){var _0x55b7f0=[_0x7745('0x62'),'ActivityDate',_0x7745('0x63'),_0x7745('0x64'),'Subject','Description'];var _0x2df430=[_0x7745('0x65'),_0x7745('0x66'),_0x7745('0x67'),_0x7745('0x68'),_0x7745('0x69'),_0x7745('0x6a'),_0x7745('0x6b')];if(_0x490cd5){_['remove'](_0x490cd5[_0x7745('0x35')],function(_0x1c1399){return _0x55b7f0[_0x7745('0x6c')](_0x1c1399[_0x7745('0x28')])||!_0x2df430['includes'](_0x1c1399[_0x7745('0x2e')]);});return{'count':_0x490cd5[_0x7745('0x35')]['length'],'rows':_[_0x7745('0x2b')](_0x490cd5[_0x7745('0x35')],function(_0x248ebb){return{'id':_0x248ebb[_0x7745('0x28')],'name':_0x248ebb[_0x7745('0x6d')],'custom':_0x248ebb[_0x7745('0x6e')],'options':_0x248ebb[_0x7745('0x6f')][_0x7745('0x36')]>0x0?_[_0x7745('0x2b')](_0x248ebb[_0x7745('0x6f')],function(_0x465523){return{'name':_0x465523['label'],'value':_0x465523[_0x7745('0x70')]};}):_0x248ebb[_0x7745('0x2e')]==_0x7745('0x68')?[{'name':_0x7745('0x71'),'value':'true'},{'name':_0x7745('0x72'),'value':'false'}]:[]};})};}})[_0x7745('0x24')](respondWithResult(_0xb430e6,null))[_0x7745('0x44')](function(_0xad637){var _0x3f414b=_0x1d7207[_0x7745('0x31')][_0x7745('0x73')]?0x1f4:_0xad637['statusCode']||0x1f4;logger[_0x7745('0x26')](_0x7745('0x74'),_0x7745('0x53'),_0x3f414b,JSON['stringify'](_0xad637));delete _0xad637[_0x7745('0x28')];if(_0x3f414b===0x191){_0x3f414b=0x190;}_0xb430e6[_0x7745('0x18')](_0x3f414b)[_0x7745('0x29')](_0x1d7207[_0x7745('0x31')][_0x7745('0x73')]?{'message':_0x7745('0x75'),'statusCode':_0xad637[_0x7745('0x76')]}:_0xad637);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 4c9a96c..599d854 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 _0xe630=['../../config/environment','../../components/integrations/configuration','exports','define','int_salesforce_accounts','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x55bab7,_0x3da64a){var _0x2ec3cd=function(_0x2c218e){while(--_0x2c218e){_0x55bab7['push'](_0x55bab7['shift']());}};_0x2ec3cd(++_0x3da64a);}(_0xe630,0x149));var _0x0e63=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe630[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x0e63('0x0'));var util=require(_0x0e63('0x1'));var logger=require('../../config/logger')(_0x0e63('0x2'));var moment=require(_0x0e63('0x3'));var BPromise=require(_0x0e63('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e63('0x5'));var rimraf=require(_0x0e63('0x6'));var config=require(_0x0e63('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x0e63('0x8'));module[_0x0e63('0x9')]=function(_0x356abb,_0x3e461b){return _0x356abb[_0x0e63('0xa')]('SalesforceAccount',attributes,{'tableName':_0x0e63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ea4=['../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','api','moment','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x1d5b54,_0x9ab87){var _0x2773f1=function(_0x143e32){while(--_0x143e32){_0x1d5b54['push'](_0x1d5b54['shift']());}};_0x2773f1(++_0x9ab87);}(_0x8ea4,0x1b2));var _0x48ea=function(_0x5645ad,_0x580ea3){_0x5645ad=_0x5645ad-0x0;var _0x17d292=_0x8ea4[_0x5645ad];return _0x17d292;};'use strict';var _=require(_0x48ea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x48ea('0x1'));var moment=require(_0x48ea('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x48ea('0x3'));var config=require(_0x48ea('0x4'));var attributes=require(_0x48ea('0x5'));var integrations=require(_0x48ea('0x6'));module[_0x48ea('0x7')]=function(_0x2c4d02,_0x2e53db){return _0x2c4d02[_0x48ea('0x8')](_0x48ea('0x9'),attributes,{'tableName':_0x48ea('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 ef4fe21..8ed6dcf 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 _0x803f=['message','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','map','include','model','catch','find','ShowSalesforceAccount','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0x4a7fea,_0x31174e){var _0xfd25ed=function(_0x33507a){while(--_0x33507a){_0x4a7fea['push'](_0x4a7fea['shift']());}};_0xfd25ed(++_0x31174e);}(_0x803f,0x144));var _0xf803=function(_0x428b23,_0x2f1f0b){_0x428b23=_0x428b23-0x0;var _0x37130c=_0x803f[_0x428b23];return _0x37130c;};'use strict';var _=require('lodash');var util=require(_0xf803('0x0'));var moment=require(_0xf803('0x1'));var BPromise=require(_0xf803('0x2'));var rs=require(_0xf803('0x3'));var fs=require('fs');var Redis=require(_0xf803('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf803('0x5'));var logger=require(_0xf803('0x6'))(_0xf803('0x7'));var config=require(_0xf803('0x8'));var jayson=require(_0xf803('0x9'));var client=jayson[_0xf803('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b5413,_0x4291f2,_0x43ea35){return new BPromise(function(_0x38ebfe,_0x56ab14){return client['request'](_0x2b5413,_0x43ea35)[_0xf803('0xb')](function(_0x58620e){logger[_0xf803('0xc')](_0xf803('0xd'),_0x4291f2,'request\x20sent');logger[_0xf803('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4291f2,_0xf803('0xf'),JSON['stringify'](_0x58620e));if(_0x58620e['error']){if(_0x58620e[_0xf803('0x10')]['code']===0x1f4){logger['error'](_0xf803('0xd'),_0x4291f2,_0x58620e[_0xf803('0x10')][_0xf803('0x11')]);return _0x56ab14(_0x58620e['error'][_0xf803('0x11')]);}logger[_0xf803('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x4291f2,_0x58620e['error'][_0xf803('0x11')]);return _0x38ebfe(_0x58620e[_0xf803('0x10')][_0xf803('0x11')]);}else{logger[_0xf803('0xc')](_0xf803('0xd'),_0x4291f2,_0xf803('0xf'));_0x38ebfe(_0x58620e['result'][_0xf803('0x11')]);}})['catch'](function(_0x27338a){logger[_0xf803('0x10')](_0xf803('0xd'),_0x4291f2,_0x27338a);_0x56ab14(_0x27338a);});});}exports[_0xf803('0x12')]=function(_0x5641a0){var _0x232bc8=this;return new Promise(function(_0x4d2ce7,_0x4594de){return db[_0xf803('0x13')][_0xf803('0x14')]({'raw':_0x5641a0[_0xf803('0x15')]?_0x5641a0['options'][_0xf803('0x16')]===undefined?!![]:![]:!![],'where':_0x5641a0['options']?_0x5641a0['options'][_0xf803('0x17')]||null:null,'attributes':_0x5641a0[_0xf803('0x15')]?_0x5641a0[_0xf803('0x15')][_0xf803('0x18')]||null:null,'limit':_0x5641a0[_0xf803('0x15')]?_0x5641a0[_0xf803('0x15')]['limit']||null:null,'include':_0x5641a0[_0xf803('0x15')]?_0x5641a0['options']['include']?_[_0xf803('0x19')](_0x5641a0[_0xf803('0x15')][_0xf803('0x1a')],function(_0x4cd887){return{'model':db[_0x4cd887[_0xf803('0x1b')]],'as':_0x4cd887['as'],'attributes':_0x4cd887['attributes'],'include':_0x4cd887[_0xf803('0x1a')]?_[_0xf803('0x19')](_0x4cd887[_0xf803('0x1a')],function(_0x5390a8){return{'model':db[_0x5390a8[_0xf803('0x1b')]],'as':_0x5390a8['as'],'attributes':_0x5390a8[_0xf803('0x18')],'include':_0x5390a8[_0xf803('0x1a')]?_['map'](_0x5390a8[_0xf803('0x1a')],function(_0xf28b04){return{'model':db[_0xf28b04[_0xf803('0x1b')]],'as':_0xf28b04['as'],'attributes':_0xf28b04[_0xf803('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ad8b6){logger['info'](_0xf803('0x12'),_0x5641a0);logger[_0xf803('0xe')](_0xf803('0x12'),_0x5641a0,JSON['stringify'](_0x3ad8b6));_0x4d2ce7(_0x3ad8b6);})[_0xf803('0x1c')](function(_0x4b82d3){logger[_0xf803('0x10')](_0xf803('0x12'),_0x4b82d3[_0xf803('0x11')],_0x5641a0);_0x4594de(_0x232bc8[_0xf803('0x10')](0x1f4,_0x4b82d3[_0xf803('0x11')]));});});};exports['ShowSalesforceAccount']=function(_0x1335bc){var _0x4c77ff=this;return new Promise(function(_0x467543,_0x1a0b38){return db[_0xf803('0x13')][_0xf803('0x1d')]({'raw':_0x1335bc[_0xf803('0x15')]?_0x1335bc[_0xf803('0x15')][_0xf803('0x16')]===undefined?!![]:![]:!![],'where':_0x1335bc[_0xf803('0x15')]?_0x1335bc['options'][_0xf803('0x17')]||null:null,'attributes':_0x1335bc[_0xf803('0x15')]?_0x1335bc[_0xf803('0x15')][_0xf803('0x18')]||null:null,'include':_0x1335bc['options']?_0x1335bc[_0xf803('0x15')][_0xf803('0x1a')]?_[_0xf803('0x19')](_0x1335bc[_0xf803('0x15')][_0xf803('0x1a')],function(_0x30bc17){return{'model':db[_0x30bc17[_0xf803('0x1b')]],'as':_0x30bc17['as'],'attributes':_0x30bc17[_0xf803('0x18')],'include':_0x30bc17['include']?_[_0xf803('0x19')](_0x30bc17['include'],function(_0x2774be){return{'model':db[_0x2774be[_0xf803('0x1b')]],'as':_0x2774be['as'],'attributes':_0x2774be[_0xf803('0x18')],'include':_0x2774be[_0xf803('0x1a')]?_[_0xf803('0x19')](_0x2774be[_0xf803('0x1a')],function(_0x4ef36a){return{'model':db[_0x4ef36a[_0xf803('0x1b')]],'as':_0x4ef36a['as'],'attributes':_0x4ef36a[_0xf803('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x462f37){logger[_0xf803('0xc')](_0xf803('0x1e'),_0x1335bc);logger[_0xf803('0xe')](_0xf803('0x1e'),_0x1335bc,JSON['stringify'](_0x462f37));_0x467543(_0x462f37);})[_0xf803('0x1c')](function(_0x5c82a4){logger[_0xf803('0x10')](_0xf803('0x1e'),_0x5c82a4[_0xf803('0x11')],_0x1335bc);_0x1a0b38(_0x4c77ff[_0xf803('0x10')](0x1f4,_0x5c82a4[_0xf803('0x11')]));});});}; \ No newline at end of file +var _0x0e1a=['model','attributes','GetSalesforceAccount','stringify','ShowSalesforceAccount','find','raw','then','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','SalesforceAccount','options','where','limit','include','map'];(function(_0x2a72df,_0x368e1b){var _0x3a2bdf=function(_0x272150){while(--_0x272150){_0x2a72df['push'](_0x2a72df['shift']());}};_0x3a2bdf(++_0x368e1b);}(_0x0e1a,0xef));var _0xa0e1=function(_0x4a4fa3,_0x370daf){_0x4a4fa3=_0x4a4fa3-0x0;var _0x4393a=_0x0e1a[_0x4a4fa3];return _0x4393a;};'use strict';var _=require('lodash');var util=require(_0xa0e1('0x0'));var moment=require(_0xa0e1('0x1'));var BPromise=require(_0xa0e1('0x2'));var rs=require(_0xa0e1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa0e1('0x4'));var logger=require(_0xa0e1('0x5'))('rpc');var config=require(_0xa0e1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa0e1('0x7')][_0xa0e1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b3b63,_0x25a2d7,_0x5924b4){return new BPromise(function(_0x2303ed,_0x48a3cb){return client[_0xa0e1('0x9')](_0x3b3b63,_0x5924b4)['then'](function(_0x339f73){logger['info'](_0xa0e1('0xa'),_0x25a2d7,'request\x20sent');logger[_0xa0e1('0xb')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x25a2d7,_0xa0e1('0xc'),JSON['stringify'](_0x339f73));if(_0x339f73[_0xa0e1('0xd')]){if(_0x339f73[_0xa0e1('0xd')][_0xa0e1('0xe')]===0x1f4){logger[_0xa0e1('0xd')](_0xa0e1('0xa'),_0x25a2d7,_0x339f73['error'][_0xa0e1('0xf')]);return _0x48a3cb(_0x339f73[_0xa0e1('0xd')][_0xa0e1('0xf')]);}logger[_0xa0e1('0xd')](_0xa0e1('0xa'),_0x25a2d7,_0x339f73['error'][_0xa0e1('0xf')]);return _0x2303ed(_0x339f73[_0xa0e1('0xd')]['message']);}else{logger[_0xa0e1('0x10')](_0xa0e1('0xa'),_0x25a2d7,_0xa0e1('0xc'));_0x2303ed(_0x339f73[_0xa0e1('0x11')]['message']);}})[_0xa0e1('0x12')](function(_0x49a1e2){logger[_0xa0e1('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x25a2d7,_0x49a1e2);_0x48a3cb(_0x49a1e2);});});}exports['GetSalesforceAccount']=function(_0x560535){var _0x5aa0c3=this;return new Promise(function(_0x5aabad,_0x392f0f){return db[_0xa0e1('0x13')]['findAll']({'raw':_0x560535[_0xa0e1('0x14')]?_0x560535[_0xa0e1('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x560535[_0xa0e1('0x14')]?_0x560535[_0xa0e1('0x14')][_0xa0e1('0x15')]||null:null,'attributes':_0x560535[_0xa0e1('0x14')]?_0x560535[_0xa0e1('0x14')]['attributes']||null:null,'limit':_0x560535[_0xa0e1('0x14')]?_0x560535['options'][_0xa0e1('0x16')]||null:null,'include':_0x560535[_0xa0e1('0x14')]?_0x560535[_0xa0e1('0x14')][_0xa0e1('0x17')]?_[_0xa0e1('0x18')](_0x560535[_0xa0e1('0x14')]['include'],function(_0x2ca7e8){return{'model':db[_0x2ca7e8[_0xa0e1('0x19')]],'as':_0x2ca7e8['as'],'attributes':_0x2ca7e8['attributes'],'include':_0x2ca7e8['include']?_['map'](_0x2ca7e8[_0xa0e1('0x17')],function(_0x1296cc){return{'model':db[_0x1296cc['model']],'as':_0x1296cc['as'],'attributes':_0x1296cc[_0xa0e1('0x1a')],'include':_0x1296cc['include']?_[_0xa0e1('0x18')](_0x1296cc['include'],function(_0x306e9f){return{'model':db[_0x306e9f[_0xa0e1('0x19')]],'as':_0x306e9f['as'],'attributes':_0x306e9f[_0xa0e1('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x152098){logger[_0xa0e1('0x10')](_0xa0e1('0x1b'),_0x560535);logger[_0xa0e1('0xb')](_0xa0e1('0x1b'),_0x560535,JSON[_0xa0e1('0x1c')](_0x152098));_0x5aabad(_0x152098);})[_0xa0e1('0x12')](function(_0x139d94){logger[_0xa0e1('0xd')](_0xa0e1('0x1b'),_0x139d94[_0xa0e1('0xf')],_0x560535);_0x392f0f(_0x5aa0c3[_0xa0e1('0xd')](0x1f4,_0x139d94[_0xa0e1('0xf')]));});});};exports[_0xa0e1('0x1d')]=function(_0x2c4a87){var _0x24b421=this;return new Promise(function(_0x4d1995,_0x178be7){return db[_0xa0e1('0x13')][_0xa0e1('0x1e')]({'raw':_0x2c4a87[_0xa0e1('0x14')]?_0x2c4a87[_0xa0e1('0x14')][_0xa0e1('0x1f')]===undefined?!![]:![]:!![],'where':_0x2c4a87[_0xa0e1('0x14')]?_0x2c4a87[_0xa0e1('0x14')][_0xa0e1('0x15')]||null:null,'attributes':_0x2c4a87[_0xa0e1('0x14')]?_0x2c4a87[_0xa0e1('0x14')]['attributes']||null:null,'include':_0x2c4a87[_0xa0e1('0x14')]?_0x2c4a87[_0xa0e1('0x14')]['include']?_['map'](_0x2c4a87[_0xa0e1('0x14')]['include'],function(_0x2618c2){return{'model':db[_0x2618c2['model']],'as':_0x2618c2['as'],'attributes':_0x2618c2[_0xa0e1('0x1a')],'include':_0x2618c2[_0xa0e1('0x17')]?_['map'](_0x2618c2['include'],function(_0x2e8b5e){return{'model':db[_0x2e8b5e['model']],'as':_0x2e8b5e['as'],'attributes':_0x2e8b5e[_0xa0e1('0x1a')],'include':_0x2e8b5e[_0xa0e1('0x17')]?_[_0xa0e1('0x18')](_0x2e8b5e['include'],function(_0x2163fc){return{'model':db[_0x2163fc[_0xa0e1('0x19')]],'as':_0x2163fc['as'],'attributes':_0x2163fc[_0xa0e1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa0e1('0x20')](function(_0x46ad39){logger['info']('ShowSalesforceAccount',_0x2c4a87);logger[_0xa0e1('0xb')](_0xa0e1('0x1d'),_0x2c4a87,JSON[_0xa0e1('0x1c')](_0x46ad39));_0x4d1995(_0x46ad39);})[_0xa0e1('0x12')](function(_0x33cf59){logger[_0xa0e1('0xd')](_0xa0e1('0x1d'),_0x33cf59['message'],_0x2c4a87);_0x178be7(_0x24b421[_0xa0e1('0xd')](0x1f4,_0x33cf59[_0xa0e1('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index fb6d1d9..e9bfda6 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(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xdb28,0x106));var _0x8db2=function(_0x2ae3f8,_0x35756a){_0x2ae3f8=_0x2ae3f8-0x0;var _0x54eb5b=_0xdb28[_0x2ae3f8];return _0x54eb5b;};'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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x5ef14f,_0x4d8f47){var _0x8780da=function(_0x12f772){while(--_0x12f772){_0x5ef14f['push'](_0x5ef14f['shift']());}};_0x8780da(++_0x4d8f47);}(_0xadb5,0xad));var _0x5adb=function(_0x5d9ba0,_0x4272f1){_0x5d9ba0=_0x5d9ba0-0x0;var _0x42fc0c=_0xadb5[_0x5d9ba0];return _0x42fc0c;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 454d8a3..4b463bd 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 _0xb7d0=['lead','account','nothing','STRING','ENUM','Case','Task','contact_lead','contact'];(function(_0x622351,_0x536243){var _0x4a04ee=function(_0x30e5eb){while(--_0x30e5eb){_0x622351['push'](_0x622351['shift']());}};_0x4a04ee(++_0x536243);}(_0xb7d0,0x93));var _0x0b7d=function(_0x103b91,_0x25f9da){_0x103b91=_0x103b91-0x0;var _0x281218=_0xb7d0[_0x103b91];return _0x281218;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0b7d('0x0')]},'description':{'type':Sequelize[_0x0b7d('0x0')]},'ticketType':{'type':Sequelize[_0x0b7d('0x1')]('Task',_0x0b7d('0x2')),'defaultValue':_0x0b7d('0x3')},'moduleSearch':{'type':Sequelize[_0x0b7d('0x1')](_0x0b7d('0x4'),_0x0b7d('0x5'),_0x0b7d('0x6'),'account_contact_lead',_0x0b7d('0x7')),'defaultValue':_0x0b7d('0x4')},'moduleCreate':{'type':Sequelize[_0x0b7d('0x1')](_0x0b7d('0x8'),_0x0b7d('0x5'),_0x0b7d('0x6'),_0x0b7d('0x7')),'defaultValue':_0x0b7d('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x0b7d('0x0')]}}; \ No newline at end of file +var _0xa69a=['ENUM','contact_lead','contact','lead','account_contact_lead','account','nothing','STRING','exports','Case'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa69a,0x1de));var _0xaa69=function(_0x27be12,_0x164836){_0x27be12=_0x27be12-0x0;var _0x138628=_0xa69a[_0x27be12];return _0x138628;};'use strict';var Sequelize=require('sequelize');module[_0xaa69('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('Task',_0xaa69('0x1')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xaa69('0x2')](_0xaa69('0x3'),_0xaa69('0x4'),_0xaa69('0x5'),_0xaa69('0x6'),_0xaa69('0x7')),'defaultValue':_0xaa69('0x3')},'moduleCreate':{'type':Sequelize[_0xaa69('0x2')](_0xaa69('0x8'),_0xaa69('0x4'),_0xaa69('0x5'),'account'),'defaultValue':_0xaa69('0x5')},'leadId':{'type':Sequelize[_0xaa69('0x9')]},'additionalSearchAccount':{'type':Sequelize[_0xaa69('0x9')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index e227704..64541a6 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 _0xf6af=['merge','options','rows','keys','rawAttributes','includeAll','include','find','create','body','params','catch','SalesforceField','pick','getFields','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','name','send','index','SalesforceConfiguration','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','map'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xf6af,0xb0));var _0xff6a=function(_0x218b10,_0x583589){_0x218b10=_0x218b10-0x0;var _0x53aa57=_0xf6af[_0x218b10];return _0x53aa57;};'use strict';var emlformat=require(_0xff6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff6a('0x1'));var jsonpatch=require(_0xff6a('0x2'));var rp=require('request-promise');var moment=require(_0xff6a('0x3'));var BPromise=require(_0xff6a('0x4'));var Mustache=require(_0xff6a('0x5'));var util=require(_0xff6a('0x6'));var path=require(_0xff6a('0x7'));var sox=require(_0xff6a('0x8'));var csv=require(_0xff6a('0x9'));var ejs=require(_0xff6a('0xa'));var fs=require('fs');var fs_extra=require(_0xff6a('0xb'));var _=require(_0xff6a('0xc'));var squel=require(_0xff6a('0xd'));var crypto=require(_0xff6a('0xe'));var jsforce=require(_0xff6a('0xf'));var deskjs=require(_0xff6a('0x10'));var toCsv=require(_0xff6a('0x9'));var querystring=require(_0xff6a('0x11'));var Papa=require('papaparse');var Redis=require(_0xff6a('0x12'));var authService=require(_0xff6a('0x13'));var qs=require(_0xff6a('0x14'));var as=require(_0xff6a('0x15'));var hardwareService=require(_0xff6a('0x16'));var logger=require('../../config/logger')(_0xff6a('0x17'));var utils=require(_0xff6a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xff6a('0x19'));var db=require(_0xff6a('0x1a'))['db'];function respondWithStatusCode(_0x4630de,_0x35e8cb){_0x35e8cb=_0x35e8cb||0xcc;return function(_0x53e2e5){if(_0x53e2e5){return _0x4630de[_0xff6a('0x1b')](_0x35e8cb);}return _0x4630de[_0xff6a('0x1c')](_0x35e8cb)[_0xff6a('0x1d')]();};}function respondWithResult(_0x248cf7,_0x3e47f4){_0x3e47f4=_0x3e47f4||0xc8;return function(_0x16d4bf){if(_0x16d4bf){return _0x248cf7['status'](_0x3e47f4)['json'](_0x16d4bf);}};}function respondWithFilteredResult(_0x583305,_0x27bed9){return function(_0x34697b){if(_0x34697b){var _0x266517=typeof _0x27bed9[_0xff6a('0x1e')]===_0xff6a('0x1f')&&typeof _0x27bed9['limit']===_0xff6a('0x1f');var _0x2d4165=_0x34697b[_0xff6a('0x20')];var _0x412711=_0x266517?0x0:_0x27bed9['offset'];var _0x2ca4dd=_0x266517?_0x34697b[_0xff6a('0x20')]:_0x27bed9[_0xff6a('0x1e')]+_0x27bed9['limit'];var _0x16d286;if(_0x2ca4dd>=_0x2d4165){_0x2ca4dd=_0x2d4165;_0x16d286=0xc8;}else{_0x16d286=0xce;}_0x583305[_0xff6a('0x1c')](_0x16d286);return _0x583305[_0xff6a('0x21')](_0xff6a('0x22'),_0x412711+'-'+_0x2ca4dd+'/'+_0x2d4165)[_0xff6a('0x23')](_0x34697b);}return null;};}function patchUpdates(_0xff525b){return function(_0x157e83){try{jsonpatch['apply'](_0x157e83,_0xff525b,!![]);}catch(_0x45a812){return BPromise[_0xff6a('0x24')](_0x45a812);}return _0x157e83[_0xff6a('0x25')]();};}function saveUpdates(_0x58b139,_0x147e25){return function(_0xa56bae){if(_0xa56bae){return _0xa56bae[_0xff6a('0x26')](_0x58b139)[_0xff6a('0x27')](function(_0x2e92d9){return _0x2e92d9;});}return null;};}function removeEntity(_0x43ba74,_0x21f432){return function(_0x1e1e87){if(_0x1e1e87){return _0x1e1e87[_0xff6a('0x28')]()[_0xff6a('0x27')](function(){_0x43ba74[_0xff6a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e7f7b,_0x2c28ce){return function(_0x9a58c2){if(!_0x9a58c2){_0x4e7f7b[_0xff6a('0x1b')](0x194);}return _0x9a58c2;};}function handleError(_0x5dc782,_0x19a124){_0x19a124=_0x19a124||0x1f4;return function(_0x3eb9a0){logger['error'](_0x3eb9a0['stack']);if(_0x3eb9a0[_0xff6a('0x29')]){delete _0x3eb9a0[_0xff6a('0x29')];}_0x5dc782[_0xff6a('0x1c')](_0x19a124)[_0xff6a('0x2a')](_0x3eb9a0);};}exports[_0xff6a('0x2b')]=function(_0x401938,_0x2e8f27){var _0x312ff9={},_0x4aa3a3={},_0x15c679={'count':0x0,'rows':[]};var _0xa612eb=_['map'](db[_0xff6a('0x2c')]['rawAttributes'],function(_0x57c285){return{'name':_0x57c285['fieldName'],'type':_0x57c285[_0xff6a('0x2d')]['key']};});_0x4aa3a3[_0xff6a('0x2e')]=_['map'](_0xa612eb,_0xff6a('0x29'));_0x4aa3a3[_0xff6a('0x2f')]=_['keys'](_0x401938[_0xff6a('0x2f')]);_0x4aa3a3[_0xff6a('0x30')]=_[_0xff6a('0x31')](_0x4aa3a3[_0xff6a('0x2e')],_0x4aa3a3[_0xff6a('0x2f')]);_0x312ff9[_0xff6a('0x32')]=_['intersection'](_0x4aa3a3['model'],qs[_0xff6a('0x33')](_0x401938[_0xff6a('0x2f')][_0xff6a('0x33')]));_0x312ff9['attributes']=_0x312ff9[_0xff6a('0x32')][_0xff6a('0x34')]?_0x312ff9[_0xff6a('0x32')]:_0x4aa3a3[_0xff6a('0x2e')];if(!_0x401938[_0xff6a('0x2f')][_0xff6a('0x35')](_0xff6a('0x36'))){_0x312ff9[_0xff6a('0x37')]=qs[_0xff6a('0x37')](_0x401938[_0xff6a('0x2f')][_0xff6a('0x37')]);_0x312ff9[_0xff6a('0x1e')]=qs[_0xff6a('0x1e')](_0x401938[_0xff6a('0x2f')][_0xff6a('0x1e')]);}_0x312ff9[_0xff6a('0x38')]=qs[_0xff6a('0x39')](_0x401938[_0xff6a('0x2f')]['sort']);_0x312ff9['where']=qs[_0xff6a('0x30')](_['pick'](_0x401938['query'],_0x4aa3a3[_0xff6a('0x30')]),_0xa612eb);if(_0x401938[_0xff6a('0x2f')][_0xff6a('0x3a')]){_0x312ff9['where']=_['merge'](_0x312ff9[_0xff6a('0x3b')],{'$or':_[_0xff6a('0x3c')](_0xa612eb,function(_0x45790c){if(_0x45790c[_0xff6a('0x2d')]!=='VIRTUAL'){var _0x36f140={};_0x36f140[_0x45790c[_0xff6a('0x29')]]={'$like':'%'+_0x401938[_0xff6a('0x2f')]['filter']+'%'};return _0x36f140;}})});}_0x312ff9=_[_0xff6a('0x3d')]({},_0x312ff9,_0x401938[_0xff6a('0x3e')]);var _0x3a609b={'where':_0x312ff9[_0xff6a('0x3b')]};return db[_0xff6a('0x2c')][_0xff6a('0x20')](_0x3a609b)[_0xff6a('0x27')](function(_0x473c5e){_0x15c679[_0xff6a('0x20')]=_0x473c5e;if(_0x401938[_0xff6a('0x2f')]['includeAll']){_0x312ff9['include']=[{'all':!![]}];}return db[_0xff6a('0x2c')]['findAll'](_0x312ff9);})[_0xff6a('0x27')](function(_0x3f8f0c){_0x15c679[_0xff6a('0x3f')]=_0x3f8f0c;return _0x15c679;})[_0xff6a('0x27')](respondWithFilteredResult(_0x2e8f27,_0x312ff9))['catch'](handleError(_0x2e8f27,null));};exports['show']=function(_0xeb9eaf,_0x2c62ab){var _0x3776af={'raw':![],'where':{'id':_0xeb9eaf['params']['id']}},_0xae96cd={};_0xae96cd[_0xff6a('0x2e')]=_[_0xff6a('0x40')](db[_0xff6a('0x2c')][_0xff6a('0x41')]);_0xae96cd['query']=_[_0xff6a('0x40')](_0xeb9eaf[_0xff6a('0x2f')]);_0xae96cd[_0xff6a('0x30')]=_[_0xff6a('0x31')](_0xae96cd[_0xff6a('0x2e')],_0xae96cd['query']);_0x3776af[_0xff6a('0x32')]=_[_0xff6a('0x31')](_0xae96cd[_0xff6a('0x2e')],qs['fields'](_0xeb9eaf[_0xff6a('0x2f')][_0xff6a('0x33')]));_0x3776af[_0xff6a('0x32')]=_0x3776af['attributes'][_0xff6a('0x34')]?_0x3776af[_0xff6a('0x32')]:_0xae96cd['model'];if(_0xeb9eaf[_0xff6a('0x2f')][_0xff6a('0x42')]){_0x3776af[_0xff6a('0x43')]=[{'all':!![]}];}_0x3776af=_['merge']({},_0x3776af,_0xeb9eaf['options']);return db['SalesforceConfiguration'][_0xff6a('0x44')](_0x3776af)[_0xff6a('0x27')](handleEntityNotFound(_0x2c62ab,null))['then'](respondWithResult(_0x2c62ab,null))['catch'](handleError(_0x2c62ab,null));};exports[_0xff6a('0x45')]=function(_0x2faffe,_0x14dd3e){return db[_0xff6a('0x2c')][_0xff6a('0x45')](_0x2faffe[_0xff6a('0x46')],{})[_0xff6a('0x27')](respondWithResult(_0x14dd3e,0xc9))['catch'](handleError(_0x14dd3e,null));};exports['update']=function(_0x5cc080,_0x29378c){if(_0x5cc080[_0xff6a('0x46')]['id']){delete _0x5cc080[_0xff6a('0x46')]['id'];}return db[_0xff6a('0x2c')]['find']({'where':{'id':_0x5cc080[_0xff6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x29378c,null))[_0xff6a('0x27')](saveUpdates(_0x5cc080[_0xff6a('0x46')],null))['then'](respondWithResult(_0x29378c,null))['catch'](handleError(_0x29378c,null));};exports[_0xff6a('0x28')]=function(_0x3784c8,_0xd261c4){return db[_0xff6a('0x2c')][_0xff6a('0x44')]({'where':{'id':_0x3784c8['params']['id']}})['then'](handleEntityNotFound(_0xd261c4,null))['then'](removeEntity(_0xd261c4,null))[_0xff6a('0x48')](handleError(_0xd261c4,null));};exports['getFields']=function(_0x5132d3,_0x4014fc,_0x308b75){var _0x4741ca={};var _0x3a899b={};var _0x445ff2;var _0x305379;return db[_0xff6a('0x2c')]['findOne']({'where':{'id':_0x5132d3[_0xff6a('0x47')]['id']}})[_0xff6a('0x27')](handleEntityNotFound(_0x4014fc,null))['then'](function(_0x4de5b0){if(_0x4de5b0){_0x445ff2=_0x4de5b0;_0x3a899b[_0xff6a('0x2e')]=_[_0xff6a('0x40')](db[_0xff6a('0x49')][_0xff6a('0x41')]);_0x3a899b[_0xff6a('0x2f')]=_['keys'](_0x5132d3['query']);_0x3a899b[_0xff6a('0x30')]=_[_0xff6a('0x31')](_0x3a899b[_0xff6a('0x2e')],_0x3a899b[_0xff6a('0x2f')]);_0x4741ca[_0xff6a('0x32')]=_[_0xff6a('0x31')](_0x3a899b['model'],qs[_0xff6a('0x33')](_0x5132d3['query']['fields']));_0x4741ca[_0xff6a('0x32')]=_0x4741ca['attributes'][_0xff6a('0x34')]?_0x4741ca[_0xff6a('0x32')]:_0x3a899b[_0xff6a('0x2e')];_0x4741ca[_0xff6a('0x38')]=qs['sort'](_0x5132d3['query'][_0xff6a('0x39')]);_0x4741ca[_0xff6a('0x3b')]=qs[_0xff6a('0x30')](_[_0xff6a('0x4a')](_0x5132d3[_0xff6a('0x2f')],_0x3a899b[_0xff6a('0x30')]));if(_0x5132d3[_0xff6a('0x2f')][_0xff6a('0x3a')]){_0x4741ca[_0xff6a('0x3b')]=_['merge'](_0x4741ca[_0xff6a('0x3b')],{'$or':_['map'](_0x4741ca['attributes'],function(_0x5693ad){var _0x19bb50={};_0x19bb50[_0x5693ad]={'$like':'%'+_0x5132d3['query'][_0xff6a('0x3a')]+'%'};return _0x19bb50;})});}_0x4741ca=_[_0xff6a('0x3d')]({},_0x4741ca,_0x5132d3[_0xff6a('0x3e')]);return _0x445ff2['getFields'](_0x4741ca);}})[_0xff6a('0x27')](function(_0x256a0b){if(_0x256a0b){_0x305379=_0x256a0b[_0xff6a('0x34')];if(!_0x5132d3[_0xff6a('0x2f')]['hasOwnProperty']('nolimit')){_0x4741ca['limit']=qs[_0xff6a('0x37')](_0x5132d3[_0xff6a('0x2f')][_0xff6a('0x37')]);_0x4741ca['offset']=qs['offset'](_0x5132d3[_0xff6a('0x2f')][_0xff6a('0x1e')]);}return _0x445ff2[_0xff6a('0x4b')](_0x4741ca);}})[_0xff6a('0x27')](function(_0x221257){if(_0x221257){return _0x221257?{'count':_0x305379,'rows':_0x221257}:null;}})[_0xff6a('0x27')](respondWithResult(_0x4014fc,null))['catch'](handleError(_0x4014fc,null));};exports[_0xff6a('0x4c')]=function(_0x387b35,_0x34c87c,_0x480b46){var _0x1ed814={};var _0x5686da={};var _0x58e3ff;var _0x37f902;return db['SalesforceConfiguration'][_0xff6a('0x4d')]({'where':{'id':_0x387b35['params']['id']}})[_0xff6a('0x27')](handleEntityNotFound(_0x34c87c,null))['then'](function(_0x137d30){if(_0x137d30){_0x58e3ff=_0x137d30;_0x5686da[_0xff6a('0x2e')]=_[_0xff6a('0x40')](db[_0xff6a('0x49')][_0xff6a('0x41')]);_0x5686da[_0xff6a('0x2f')]=_['keys'](_0x387b35[_0xff6a('0x2f')]);_0x5686da[_0xff6a('0x30')]=_[_0xff6a('0x31')](_0x5686da['model'],_0x5686da[_0xff6a('0x2f')]);_0x1ed814[_0xff6a('0x32')]=_[_0xff6a('0x31')](_0x5686da[_0xff6a('0x2e')],qs[_0xff6a('0x33')](_0x387b35[_0xff6a('0x2f')][_0xff6a('0x33')]));_0x1ed814[_0xff6a('0x32')]=_0x1ed814[_0xff6a('0x32')][_0xff6a('0x34')]?_0x1ed814[_0xff6a('0x32')]:_0x5686da[_0xff6a('0x2e')];_0x1ed814['order']=qs['sort'](_0x387b35[_0xff6a('0x2f')][_0xff6a('0x39')]);_0x1ed814[_0xff6a('0x3b')]=qs[_0xff6a('0x30')](_[_0xff6a('0x4a')](_0x387b35[_0xff6a('0x2f')],_0x5686da[_0xff6a('0x30')]));if(_0x387b35[_0xff6a('0x2f')]['filter']){_0x1ed814[_0xff6a('0x3b')]=_['merge'](_0x1ed814[_0xff6a('0x3b')],{'$or':_[_0xff6a('0x3c')](_0x1ed814[_0xff6a('0x32')],function(_0x3a237d){var _0x5d4855={};_0x5d4855[_0x3a237d]={'$like':'%'+_0x387b35[_0xff6a('0x2f')]['filter']+'%'};return _0x5d4855;})});}_0x1ed814=_['merge']({},_0x1ed814,_0x387b35['options']);return _0x58e3ff['getSubjects'](_0x1ed814);}})[_0xff6a('0x27')](function(_0x4f0d5e){if(_0x4f0d5e){_0x37f902=_0x4f0d5e[_0xff6a('0x34')];if(!_0x387b35[_0xff6a('0x2f')][_0xff6a('0x35')](_0xff6a('0x36'))){_0x1ed814[_0xff6a('0x37')]=qs[_0xff6a('0x37')](_0x387b35[_0xff6a('0x2f')]['limit']);_0x1ed814[_0xff6a('0x1e')]=qs[_0xff6a('0x1e')](_0x387b35[_0xff6a('0x2f')][_0xff6a('0x1e')]);}return _0x58e3ff[_0xff6a('0x4c')](_0x1ed814);}})[_0xff6a('0x27')](function(_0x446eff){if(_0x446eff){return _0x446eff?{'count':_0x37f902,'rows':_0x446eff}:null;}})['then'](respondWithResult(_0x34c87c,null))[_0xff6a('0x48')](handleError(_0x34c87c,null));};exports['getDescriptions']=function(_0x196ec3,_0x3283e7,_0x3b8957){var _0x2b955d={};var _0xa87039={};var _0xbd083d;var _0x3e445e;return db[_0xff6a('0x2c')][_0xff6a('0x4d')]({'where':{'id':_0x196ec3['params']['id']}})['then'](handleEntityNotFound(_0x3283e7,null))[_0xff6a('0x27')](function(_0xe8f441){if(_0xe8f441){_0xbd083d=_0xe8f441;_0xa87039[_0xff6a('0x2e')]=_['keys'](db['SalesforceField'][_0xff6a('0x41')]);_0xa87039[_0xff6a('0x2f')]=_[_0xff6a('0x40')](_0x196ec3[_0xff6a('0x2f')]);_0xa87039['filters']=_[_0xff6a('0x31')](_0xa87039[_0xff6a('0x2e')],_0xa87039[_0xff6a('0x2f')]);_0x2b955d[_0xff6a('0x32')]=_['intersection'](_0xa87039[_0xff6a('0x2e')],qs[_0xff6a('0x33')](_0x196ec3[_0xff6a('0x2f')]['fields']));_0x2b955d['attributes']=_0x2b955d[_0xff6a('0x32')][_0xff6a('0x34')]?_0x2b955d[_0xff6a('0x32')]:_0xa87039[_0xff6a('0x2e')];_0x2b955d['order']=qs[_0xff6a('0x39')](_0x196ec3[_0xff6a('0x2f')][_0xff6a('0x39')]);_0x2b955d['where']=qs['filters'](_[_0xff6a('0x4a')](_0x196ec3[_0xff6a('0x2f')],_0xa87039[_0xff6a('0x30')]));if(_0x196ec3['query']['filter']){_0x2b955d[_0xff6a('0x3b')]=_[_0xff6a('0x3d')](_0x2b955d['where'],{'$or':_[_0xff6a('0x3c')](_0x2b955d['attributes'],function(_0x1d65ba){var _0x1bcb6c={};_0x1bcb6c[_0x1d65ba]={'$like':'%'+_0x196ec3[_0xff6a('0x2f')]['filter']+'%'};return _0x1bcb6c;})});}_0x2b955d=_[_0xff6a('0x3d')]({},_0x2b955d,_0x196ec3['options']);return _0xbd083d[_0xff6a('0x4e')](_0x2b955d);}})[_0xff6a('0x27')](function(_0xe75d4f){if(_0xe75d4f){_0x3e445e=_0xe75d4f[_0xff6a('0x34')];if(!_0x196ec3['query']['hasOwnProperty'](_0xff6a('0x36'))){_0x2b955d[_0xff6a('0x37')]=qs[_0xff6a('0x37')](_0x196ec3[_0xff6a('0x2f')]['limit']);_0x2b955d[_0xff6a('0x1e')]=qs[_0xff6a('0x1e')](_0x196ec3[_0xff6a('0x2f')][_0xff6a('0x1e')]);}return _0xbd083d[_0xff6a('0x4e')](_0x2b955d);}})[_0xff6a('0x27')](function(_0xccc36c){if(_0xccc36c){return _0xccc36c?{'count':_0x3e445e,'rows':_0xccc36c}:null;}})['then'](respondWithResult(_0x3283e7,null))['catch'](handleError(_0x3283e7,null));}; \ No newline at end of file +var _0x5a96=['length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SalesforceConfiguration','includeAll','rows','show','rawAttributes','include','find','catch','create','body','params','destroy','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0x5d3f51,_0x3025b6){var _0x24bcdb=function(_0x3d2ed1){while(--_0x3d2ed1){_0x5d3f51['push'](_0x5d3f51['shift']());}};_0x24bcdb(++_0x3025b6);}(_0x5a96,0xbc));var _0x65a9=function(_0x123f94,_0x4810dd){_0x123f94=_0x123f94-0x0;var _0x39666e=_0x5a96[_0x123f94];return _0x39666e;};'use strict';var emlformat=require(_0x65a9('0x0'));var rimraf=require(_0x65a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65a9('0x2'));var rp=require(_0x65a9('0x3'));var moment=require(_0x65a9('0x4'));var BPromise=require(_0x65a9('0x5'));var Mustache=require(_0x65a9('0x6'));var util=require(_0x65a9('0x7'));var path=require('path');var sox=require(_0x65a9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x65a9('0x9'));var squel=require(_0x65a9('0xa'));var crypto=require(_0x65a9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x65a9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x65a9('0xd'));var Papa=require(_0x65a9('0xe'));var Redis=require(_0x65a9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x65a9('0x10'));var as=require(_0x65a9('0x11'));var hardwareService=require(_0x65a9('0x12'));var logger=require(_0x65a9('0x13'))('api');var utils=require(_0x65a9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x65a9('0x15'));var db=require(_0x65a9('0x16'))['db'];function respondWithStatusCode(_0x21240d,_0x59643f){_0x59643f=_0x59643f||0xcc;return function(_0x5ac610){if(_0x5ac610){return _0x21240d[_0x65a9('0x17')](_0x59643f);}return _0x21240d[_0x65a9('0x18')](_0x59643f)['end']();};}function respondWithResult(_0x558cfe,_0x230317){_0x230317=_0x230317||0xc8;return function(_0x20cc94){if(_0x20cc94){return _0x558cfe[_0x65a9('0x18')](_0x230317)[_0x65a9('0x19')](_0x20cc94);}};}function respondWithFilteredResult(_0xa1842c,_0x47a11d){return function(_0x5769f1){if(_0x5769f1){var _0x42cbda=typeof _0x47a11d[_0x65a9('0x1a')]===_0x65a9('0x1b')&&typeof _0x47a11d[_0x65a9('0x1c')]===_0x65a9('0x1b');var _0x1ec5b8=_0x5769f1['count'];var _0x3355d2=_0x42cbda?0x0:_0x47a11d[_0x65a9('0x1a')];var _0x51eedc=_0x42cbda?_0x5769f1[_0x65a9('0x1d')]:_0x47a11d[_0x65a9('0x1a')]+_0x47a11d['limit'];var _0x375903;if(_0x51eedc>=_0x1ec5b8){_0x51eedc=_0x1ec5b8;_0x375903=0xc8;}else{_0x375903=0xce;}_0xa1842c['status'](_0x375903);return _0xa1842c[_0x65a9('0x1e')](_0x65a9('0x1f'),_0x3355d2+'-'+_0x51eedc+'/'+_0x1ec5b8)['json'](_0x5769f1);}return null;};}function patchUpdates(_0x37386c){return function(_0x51c9eb){try{jsonpatch[_0x65a9('0x20')](_0x51c9eb,_0x37386c,!![]);}catch(_0x3cda2c){return BPromise[_0x65a9('0x21')](_0x3cda2c);}return _0x51c9eb[_0x65a9('0x22')]();};}function saveUpdates(_0x187cfe,_0x3b14a1){return function(_0x319d28){if(_0x319d28){return _0x319d28[_0x65a9('0x23')](_0x187cfe)[_0x65a9('0x24')](function(_0x4b0db6){return _0x4b0db6;});}return null;};}function removeEntity(_0x1af517,_0x1d6449){return function(_0x58c423){if(_0x58c423){return _0x58c423['destroy']()[_0x65a9('0x24')](function(){_0x1af517[_0x65a9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a0246,_0x1ca32f){return function(_0x4b465b){if(!_0x4b465b){_0x4a0246[_0x65a9('0x17')](0x194);}return _0x4b465b;};}function handleError(_0x4e857c,_0x2add38){_0x2add38=_0x2add38||0x1f4;return function(_0x3cae9b){logger[_0x65a9('0x25')](_0x3cae9b[_0x65a9('0x26')]);if(_0x3cae9b[_0x65a9('0x27')]){delete _0x3cae9b[_0x65a9('0x27')];}_0x4e857c[_0x65a9('0x18')](_0x2add38)['send'](_0x3cae9b);};}exports[_0x65a9('0x28')]=function(_0x3b2aa2,_0x51712){var _0x2af089={},_0x574e15={},_0x42b0c4={'count':0x0,'rows':[]};var _0x10d82e=_[_0x65a9('0x29')](db['SalesforceConfiguration']['rawAttributes'],function(_0x5126c8){return{'name':_0x5126c8[_0x65a9('0x2a')],'type':_0x5126c8[_0x65a9('0x2b')][_0x65a9('0x2c')]};});_0x574e15[_0x65a9('0x2d')]=_[_0x65a9('0x29')](_0x10d82e,'name');_0x574e15['query']=_[_0x65a9('0x2e')](_0x3b2aa2[_0x65a9('0x2f')]);_0x574e15[_0x65a9('0x30')]=_[_0x65a9('0x31')](_0x574e15['model'],_0x574e15['query']);_0x2af089[_0x65a9('0x32')]=_['intersection'](_0x574e15[_0x65a9('0x2d')],qs[_0x65a9('0x33')](_0x3b2aa2[_0x65a9('0x2f')][_0x65a9('0x33')]));_0x2af089[_0x65a9('0x32')]=_0x2af089[_0x65a9('0x32')][_0x65a9('0x34')]?_0x2af089[_0x65a9('0x32')]:_0x574e15[_0x65a9('0x2d')];if(!_0x3b2aa2[_0x65a9('0x2f')][_0x65a9('0x35')](_0x65a9('0x36'))){_0x2af089[_0x65a9('0x1c')]=qs['limit'](_0x3b2aa2['query'][_0x65a9('0x1c')]);_0x2af089[_0x65a9('0x1a')]=qs[_0x65a9('0x1a')](_0x3b2aa2['query']['offset']);}_0x2af089[_0x65a9('0x37')]=qs[_0x65a9('0x38')](_0x3b2aa2[_0x65a9('0x2f')][_0x65a9('0x38')]);_0x2af089[_0x65a9('0x39')]=qs['filters'](_[_0x65a9('0x3a')](_0x3b2aa2['query'],_0x574e15[_0x65a9('0x30')]),_0x10d82e);if(_0x3b2aa2[_0x65a9('0x2f')]['filter']){_0x2af089[_0x65a9('0x39')]=_[_0x65a9('0x3b')](_0x2af089['where'],{'$or':_[_0x65a9('0x29')](_0x10d82e,function(_0x54f123){if(_0x54f123[_0x65a9('0x2b')]!==_0x65a9('0x3c')){var _0x25207b={};_0x25207b[_0x54f123[_0x65a9('0x27')]]={'$like':'%'+_0x3b2aa2[_0x65a9('0x2f')][_0x65a9('0x3d')]+'%'};return _0x25207b;}})});}_0x2af089=_[_0x65a9('0x3b')]({},_0x2af089,_0x3b2aa2[_0x65a9('0x3e')]);var _0x678703={'where':_0x2af089['where']};return db[_0x65a9('0x3f')]['count'](_0x678703)[_0x65a9('0x24')](function(_0xdf82c0){_0x42b0c4[_0x65a9('0x1d')]=_0xdf82c0;if(_0x3b2aa2[_0x65a9('0x2f')][_0x65a9('0x40')]){_0x2af089['include']=[{'all':!![]}];}return db[_0x65a9('0x3f')]['findAll'](_0x2af089);})[_0x65a9('0x24')](function(_0x170c15){_0x42b0c4[_0x65a9('0x41')]=_0x170c15;return _0x42b0c4;})[_0x65a9('0x24')](respondWithFilteredResult(_0x51712,_0x2af089))['catch'](handleError(_0x51712,null));};exports[_0x65a9('0x42')]=function(_0xb8c184,_0x271020){var _0x24406a={'raw':![],'where':{'id':_0xb8c184['params']['id']}},_0x8e1ce5={};_0x8e1ce5[_0x65a9('0x2d')]=_[_0x65a9('0x2e')](db['SalesforceConfiguration'][_0x65a9('0x43')]);_0x8e1ce5[_0x65a9('0x2f')]=_[_0x65a9('0x2e')](_0xb8c184[_0x65a9('0x2f')]);_0x8e1ce5['filters']=_[_0x65a9('0x31')](_0x8e1ce5[_0x65a9('0x2d')],_0x8e1ce5[_0x65a9('0x2f')]);_0x24406a[_0x65a9('0x32')]=_[_0x65a9('0x31')](_0x8e1ce5[_0x65a9('0x2d')],qs['fields'](_0xb8c184[_0x65a9('0x2f')][_0x65a9('0x33')]));_0x24406a['attributes']=_0x24406a['attributes'][_0x65a9('0x34')]?_0x24406a[_0x65a9('0x32')]:_0x8e1ce5[_0x65a9('0x2d')];if(_0xb8c184['query']['includeAll']){_0x24406a[_0x65a9('0x44')]=[{'all':!![]}];}_0x24406a=_['merge']({},_0x24406a,_0xb8c184['options']);return db[_0x65a9('0x3f')][_0x65a9('0x45')](_0x24406a)[_0x65a9('0x24')](handleEntityNotFound(_0x271020,null))[_0x65a9('0x24')](respondWithResult(_0x271020,null))[_0x65a9('0x46')](handleError(_0x271020,null));};exports[_0x65a9('0x47')]=function(_0x4dcb83,_0x13b374){return db[_0x65a9('0x3f')][_0x65a9('0x47')](_0x4dcb83[_0x65a9('0x48')],{})[_0x65a9('0x24')](respondWithResult(_0x13b374,0xc9))[_0x65a9('0x46')](handleError(_0x13b374,null));};exports[_0x65a9('0x23')]=function(_0x38be18,_0x255287){if(_0x38be18[_0x65a9('0x48')]['id']){delete _0x38be18[_0x65a9('0x48')]['id'];}return db[_0x65a9('0x3f')][_0x65a9('0x45')]({'where':{'id':_0x38be18[_0x65a9('0x49')]['id']}})[_0x65a9('0x24')](handleEntityNotFound(_0x255287,null))['then'](saveUpdates(_0x38be18[_0x65a9('0x48')],null))[_0x65a9('0x24')](respondWithResult(_0x255287,null))[_0x65a9('0x46')](handleError(_0x255287,null));};exports[_0x65a9('0x4a')]=function(_0x3ab8dc,_0x901de4){return db['SalesforceConfiguration'][_0x65a9('0x45')]({'where':{'id':_0x3ab8dc[_0x65a9('0x49')]['id']}})[_0x65a9('0x24')](handleEntityNotFound(_0x901de4,null))[_0x65a9('0x24')](removeEntity(_0x901de4,null))[_0x65a9('0x46')](handleError(_0x901de4,null));};exports[_0x65a9('0x4b')]=function(_0x72d4ed,_0x130cc9,_0x8810b8){var _0xaae894={};var _0xed004a={};var _0x59791f;var _0xa9d3bf;return db[_0x65a9('0x3f')][_0x65a9('0x4c')]({'where':{'id':_0x72d4ed[_0x65a9('0x49')]['id']}})[_0x65a9('0x24')](handleEntityNotFound(_0x130cc9,null))[_0x65a9('0x24')](function(_0x45fb65){if(_0x45fb65){_0x59791f=_0x45fb65;_0xed004a[_0x65a9('0x2d')]=_[_0x65a9('0x2e')](db['SalesforceField'][_0x65a9('0x43')]);_0xed004a[_0x65a9('0x2f')]=_['keys'](_0x72d4ed[_0x65a9('0x2f')]);_0xed004a['filters']=_[_0x65a9('0x31')](_0xed004a['model'],_0xed004a['query']);_0xaae894['attributes']=_[_0x65a9('0x31')](_0xed004a[_0x65a9('0x2d')],qs['fields'](_0x72d4ed['query']['fields']));_0xaae894[_0x65a9('0x32')]=_0xaae894[_0x65a9('0x32')][_0x65a9('0x34')]?_0xaae894[_0x65a9('0x32')]:_0xed004a['model'];_0xaae894[_0x65a9('0x37')]=qs[_0x65a9('0x38')](_0x72d4ed[_0x65a9('0x2f')][_0x65a9('0x38')]);_0xaae894['where']=qs[_0x65a9('0x30')](_[_0x65a9('0x3a')](_0x72d4ed[_0x65a9('0x2f')],_0xed004a[_0x65a9('0x30')]));if(_0x72d4ed[_0x65a9('0x2f')][_0x65a9('0x3d')]){_0xaae894['where']=_[_0x65a9('0x3b')](_0xaae894[_0x65a9('0x39')],{'$or':_[_0x65a9('0x29')](_0xaae894[_0x65a9('0x32')],function(_0x16d46f){var _0x33cd24={};_0x33cd24[_0x16d46f]={'$like':'%'+_0x72d4ed[_0x65a9('0x2f')][_0x65a9('0x3d')]+'%'};return _0x33cd24;})});}_0xaae894=_[_0x65a9('0x3b')]({},_0xaae894,_0x72d4ed[_0x65a9('0x3e')]);return _0x59791f['getFields'](_0xaae894);}})['then'](function(_0x114044){if(_0x114044){_0xa9d3bf=_0x114044['length'];if(!_0x72d4ed[_0x65a9('0x2f')][_0x65a9('0x35')](_0x65a9('0x36'))){_0xaae894[_0x65a9('0x1c')]=qs[_0x65a9('0x1c')](_0x72d4ed[_0x65a9('0x2f')]['limit']);_0xaae894['offset']=qs['offset'](_0x72d4ed[_0x65a9('0x2f')]['offset']);}return _0x59791f[_0x65a9('0x4b')](_0xaae894);}})[_0x65a9('0x24')](function(_0x40f65d){if(_0x40f65d){return _0x40f65d?{'count':_0xa9d3bf,'rows':_0x40f65d}:null;}})['then'](respondWithResult(_0x130cc9,null))[_0x65a9('0x46')](handleError(_0x130cc9,null));};exports['getSubjects']=function(_0x16c886,_0x562dbf,_0x47fcb2){var _0x4429c9={};var _0x2a56e5={};var _0x1ef3fa;var _0x525d4f;return db[_0x65a9('0x3f')][_0x65a9('0x4c')]({'where':{'id':_0x16c886[_0x65a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x562dbf,null))['then'](function(_0x3e7429){if(_0x3e7429){_0x1ef3fa=_0x3e7429;_0x2a56e5[_0x65a9('0x2d')]=_['keys'](db[_0x65a9('0x4d')]['rawAttributes']);_0x2a56e5[_0x65a9('0x2f')]=_['keys'](_0x16c886[_0x65a9('0x2f')]);_0x2a56e5[_0x65a9('0x30')]=_[_0x65a9('0x31')](_0x2a56e5[_0x65a9('0x2d')],_0x2a56e5['query']);_0x4429c9[_0x65a9('0x32')]=_['intersection'](_0x2a56e5[_0x65a9('0x2d')],qs[_0x65a9('0x33')](_0x16c886[_0x65a9('0x2f')][_0x65a9('0x33')]));_0x4429c9[_0x65a9('0x32')]=_0x4429c9[_0x65a9('0x32')][_0x65a9('0x34')]?_0x4429c9[_0x65a9('0x32')]:_0x2a56e5[_0x65a9('0x2d')];_0x4429c9[_0x65a9('0x37')]=qs[_0x65a9('0x38')](_0x16c886[_0x65a9('0x2f')][_0x65a9('0x38')]);_0x4429c9[_0x65a9('0x39')]=qs[_0x65a9('0x30')](_[_0x65a9('0x3a')](_0x16c886['query'],_0x2a56e5['filters']));if(_0x16c886[_0x65a9('0x2f')]['filter']){_0x4429c9[_0x65a9('0x39')]=_[_0x65a9('0x3b')](_0x4429c9['where'],{'$or':_[_0x65a9('0x29')](_0x4429c9[_0x65a9('0x32')],function(_0x3f97c4){var _0x246ba7={};_0x246ba7[_0x3f97c4]={'$like':'%'+_0x16c886[_0x65a9('0x2f')][_0x65a9('0x3d')]+'%'};return _0x246ba7;})});}_0x4429c9=_['merge']({},_0x4429c9,_0x16c886[_0x65a9('0x3e')]);return _0x1ef3fa[_0x65a9('0x4e')](_0x4429c9);}})[_0x65a9('0x24')](function(_0x3c4d37){if(_0x3c4d37){_0x525d4f=_0x3c4d37[_0x65a9('0x34')];if(!_0x16c886[_0x65a9('0x2f')][_0x65a9('0x35')](_0x65a9('0x36'))){_0x4429c9['limit']=qs[_0x65a9('0x1c')](_0x16c886[_0x65a9('0x2f')][_0x65a9('0x1c')]);_0x4429c9[_0x65a9('0x1a')]=qs[_0x65a9('0x1a')](_0x16c886['query'][_0x65a9('0x1a')]);}return _0x1ef3fa[_0x65a9('0x4e')](_0x4429c9);}})[_0x65a9('0x24')](function(_0x2a091a){if(_0x2a091a){return _0x2a091a?{'count':_0x525d4f,'rows':_0x2a091a}:null;}})[_0x65a9('0x24')](respondWithResult(_0x562dbf,null))[_0x65a9('0x46')](handleError(_0x562dbf,null));};exports[_0x65a9('0x4f')]=function(_0x3c7292,_0x53f8f2,_0x4bf812){var _0x56be45={};var _0x3e747b={};var _0x1d8c06;var _0x47f1ae;return db[_0x65a9('0x3f')][_0x65a9('0x4c')]({'where':{'id':_0x3c7292[_0x65a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x53f8f2,null))['then'](function(_0x41104b){if(_0x41104b){_0x1d8c06=_0x41104b;_0x3e747b['model']=_[_0x65a9('0x2e')](db['SalesforceField'][_0x65a9('0x43')]);_0x3e747b[_0x65a9('0x2f')]=_[_0x65a9('0x2e')](_0x3c7292[_0x65a9('0x2f')]);_0x3e747b[_0x65a9('0x30')]=_['intersection'](_0x3e747b[_0x65a9('0x2d')],_0x3e747b[_0x65a9('0x2f')]);_0x56be45[_0x65a9('0x32')]=_[_0x65a9('0x31')](_0x3e747b[_0x65a9('0x2d')],qs[_0x65a9('0x33')](_0x3c7292[_0x65a9('0x2f')][_0x65a9('0x33')]));_0x56be45['attributes']=_0x56be45['attributes']['length']?_0x56be45[_0x65a9('0x32')]:_0x3e747b[_0x65a9('0x2d')];_0x56be45['order']=qs[_0x65a9('0x38')](_0x3c7292[_0x65a9('0x2f')][_0x65a9('0x38')]);_0x56be45['where']=qs[_0x65a9('0x30')](_[_0x65a9('0x3a')](_0x3c7292[_0x65a9('0x2f')],_0x3e747b[_0x65a9('0x30')]));if(_0x3c7292[_0x65a9('0x2f')]['filter']){_0x56be45[_0x65a9('0x39')]=_[_0x65a9('0x3b')](_0x56be45[_0x65a9('0x39')],{'$or':_[_0x65a9('0x29')](_0x56be45[_0x65a9('0x32')],function(_0x207526){var _0x1366a4={};_0x1366a4[_0x207526]={'$like':'%'+_0x3c7292[_0x65a9('0x2f')][_0x65a9('0x3d')]+'%'};return _0x1366a4;})});}_0x56be45=_['merge']({},_0x56be45,_0x3c7292[_0x65a9('0x3e')]);return _0x1d8c06[_0x65a9('0x4f')](_0x56be45);}})['then'](function(_0x215d1f){if(_0x215d1f){_0x47f1ae=_0x215d1f[_0x65a9('0x34')];if(!_0x3c7292[_0x65a9('0x2f')]['hasOwnProperty'](_0x65a9('0x36'))){_0x56be45[_0x65a9('0x1c')]=qs[_0x65a9('0x1c')](_0x3c7292[_0x65a9('0x2f')][_0x65a9('0x1c')]);_0x56be45[_0x65a9('0x1a')]=qs[_0x65a9('0x1a')](_0x3c7292['query']['offset']);}return _0x1d8c06[_0x65a9('0x4f')](_0x56be45);}})[_0x65a9('0x24')](function(_0x436314){if(_0x436314){return _0x436314?{'count':_0x47f1ae,'rows':_0x436314}:null;}})['then'](respondWithResult(_0x53f8f2,null))['catch'](handleError(_0x53f8f2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 160c772..bae1dea 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 _0x1d42=['util','../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration'];(function(_0x5e7849,_0x2c98ad){var _0x5172c0=function(_0x58ac2a){while(--_0x58ac2a){_0x5e7849['push'](_0x5e7849['shift']());}};_0x5172c0(++_0x2c98ad);}(_0x1d42,0x104));var _0x21d4=function(_0xb99421,_0xaab133){_0xb99421=_0xb99421-0x0;var _0x4b3ec7=_0x1d42[_0xb99421];return _0x4b3ec7;};'use strict';var _=require('lodash');var util=require(_0x21d4('0x0'));var logger=require(_0x21d4('0x1'))(_0x21d4('0x2'));var moment=require(_0x21d4('0x3'));var BPromise=require(_0x21d4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x21d4('0x5'));var rimraf=require(_0x21d4('0x6'));var config=require('../../config/environment');var attributes=require(_0x21d4('0x7'));module['exports']=function(_0x32781d,_0x55c800){return _0x32781d[_0x21d4('0x8')](_0x21d4('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed04=['define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','request-promise','path','rimraf','./intSalesforceConfiguration.attributes'];(function(_0x4b7ae3,_0x5dc0c9){var _0x46d4b0=function(_0x5e9634){while(--_0x5e9634){_0x4b7ae3['push'](_0x4b7ae3['shift']());}};_0x46d4b0(++_0x5dc0c9);}(_0xed04,0x10b));var _0x4ed0=function(_0xec90e4,_0x5646b6){_0xec90e4=_0xec90e4-0x0;var _0x1b4605=_0xed04[_0xec90e4];return _0x1b4605;};'use strict';var _=require(_0x4ed0('0x0'));var util=require(_0x4ed0('0x1'));var logger=require(_0x4ed0('0x2'))(_0x4ed0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4ed0('0x4'));var fs=require('fs');var path=require(_0x4ed0('0x5'));var rimraf=require(_0x4ed0('0x6'));var config=require('../../config/environment');var attributes=require(_0x4ed0('0x7'));module['exports']=function(_0x40b4b2,_0x557801){return _0x40b4b2[_0x4ed0('0x8')](_0x4ed0('0x9'),attributes,{'tableName':_0x4ed0('0xa'),'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 f66a234..94e6d4d 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 _0xf9f5=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x52cbc6,_0x3a9e07){var _0x5b7ee5=function(_0x5caebb){while(--_0x5caebb){_0x52cbc6['push'](_0x52cbc6['shift']());}};_0x5b7ee5(++_0x3a9e07);}(_0xf9f5,0x79));var _0x5f9f=function(_0xf5b92d,_0x4fb1a9){_0xf5b92d=_0xf5b92d-0x0;var _0x396ada=_0xf9f5[_0xf5b92d];return _0x396ada;};'use strict';var _=require(_0x5f9f('0x0'));var util=require(_0x5f9f('0x1'));var moment=require('moment');var BPromise=require(_0x5f9f('0x2'));var rs=require(_0x5f9f('0x3'));var fs=require('fs');var Redis=require(_0x5f9f('0x4'));var db=require(_0x5f9f('0x5'))['db'];var utils=require(_0x5f9f('0x6'));var logger=require(_0x5f9f('0x7'))(_0x5f9f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5f9f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3593e1,_0x433630,_0x45251b){return new BPromise(function(_0x4b53a1,_0xb2d7b9){return client['request'](_0x3593e1,_0x45251b)[_0x5f9f('0xa')](function(_0x1eb125){logger[_0x5f9f('0xb')](_0x5f9f('0xc'),_0x433630,_0x5f9f('0xd'));logger[_0x5f9f('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x433630,_0x5f9f('0xd'),JSON[_0x5f9f('0xf')](_0x1eb125));if(_0x1eb125[_0x5f9f('0x10')]){if(_0x1eb125[_0x5f9f('0x10')]['code']===0x1f4){logger[_0x5f9f('0x10')](_0x5f9f('0xc'),_0x433630,_0x1eb125[_0x5f9f('0x10')][_0x5f9f('0x11')]);return _0xb2d7b9(_0x1eb125[_0x5f9f('0x10')][_0x5f9f('0x11')]);}logger['error'](_0x5f9f('0xc'),_0x433630,_0x1eb125['error'][_0x5f9f('0x11')]);return _0x4b53a1(_0x1eb125['error'][_0x5f9f('0x11')]);}else{logger[_0x5f9f('0xb')](_0x5f9f('0xc'),_0x433630,_0x5f9f('0xd'));_0x4b53a1(_0x1eb125[_0x5f9f('0x12')][_0x5f9f('0x11')]);}})[_0x5f9f('0x13')](function(_0x273e21){logger[_0x5f9f('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x433630,_0x273e21);_0xb2d7b9(_0x273e21);});});} \ No newline at end of file +var _0x53a0=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x421e3a,_0xd69d11){var _0x3f9abd=function(_0x4b9bb4){while(--_0x4b9bb4){_0x421e3a['push'](_0x421e3a['shift']());}};_0x3f9abd(++_0xd69d11);}(_0x53a0,0xb6));var _0x053a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x53a0[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x053a('0x0'));var util=require(_0x053a('0x1'));var moment=require(_0x053a('0x2'));var BPromise=require(_0x053a('0x3'));var rs=require(_0x053a('0x4'));var fs=require('fs');var Redis=require(_0x053a('0x5'));var db=require(_0x053a('0x6'))['db'];var utils=require(_0x053a('0x7'));var logger=require('../../config/logger')(_0x053a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x053a('0x9')][_0x053a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52f4d0,_0x3e20b2,_0x50e5ef){return new BPromise(function(_0x911653,_0x58bd94){return client['request'](_0x52f4d0,_0x50e5ef)[_0x053a('0xb')](function(_0x14a521){logger[_0x053a('0xc')](_0x053a('0xd'),_0x3e20b2,'request\x20sent');logger[_0x053a('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3e20b2,_0x053a('0xf'),JSON['stringify'](_0x14a521));if(_0x14a521[_0x053a('0x10')]){if(_0x14a521[_0x053a('0x10')][_0x053a('0x11')]===0x1f4){logger[_0x053a('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3e20b2,_0x14a521['error'][_0x053a('0x12')]);return _0x58bd94(_0x14a521[_0x053a('0x10')][_0x053a('0x12')]);}logger[_0x053a('0x10')](_0x053a('0xd'),_0x3e20b2,_0x14a521['error'][_0x053a('0x12')]);return _0x911653(_0x14a521[_0x053a('0x10')][_0x053a('0x12')]);}else{logger['info'](_0x053a('0xd'),_0x3e20b2,'request\x20sent');_0x911653(_0x14a521['result'][_0x053a('0x12')]);}})[_0x053a('0x13')](function(_0x55d621){logger[_0x053a('0x10')](_0x053a('0xd'),_0x3e20b2,_0x55d621);_0x58bd94(_0x55d621);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index b125dac..11ff495 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 _0x3c83=['isAuthenticated','show','post','create','put','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3c83,0x14a));var _0x33c8=function(_0x9a6161,_0x364521){_0x9a6161=_0x9a6161-0x0;var _0x34903b=_0x3c83[_0x9a6161];return _0x34903b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x33c8('0x0'));var timeout=require(_0x33c8('0x1'));var express=require(_0x33c8('0x2'));var router=express[_0x33c8('0x3')]();var fs_extra=require(_0x33c8('0x4'));var auth=require(_0x33c8('0x5'));var interaction=require(_0x33c8('0x6'));var config=require(_0x33c8('0x7'));var controller=require(_0x33c8('0x8'));router[_0x33c8('0x9')]('/',auth['isAuthenticated'](),controller[_0x33c8('0xa')]);router[_0x33c8('0x9')](_0x33c8('0xb'),auth[_0x33c8('0xc')](),controller[_0x33c8('0xd')]);router[_0x33c8('0xe')]('/',auth[_0x33c8('0xc')](),controller[_0x33c8('0xf')]);router[_0x33c8('0x10')](_0x33c8('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x33c8('0x11')](_0x33c8('0xb'),auth[_0x33c8('0xc')](),controller[_0x33c8('0x12')]);module['exports']=router; \ No newline at end of file +var _0x85a4=['index','/:id','isAuthenticated','post','create','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x57ac76,_0x26239d){var _0x37560e=function(_0x3ae2b4){while(--_0x3ae2b4){_0x57ac76['push'](_0x57ac76['shift']());}};_0x37560e(++_0x26239d);}(_0x85a4,0x1ef));var _0x485a=function(_0x7b71d,_0x9130d7){_0x7b71d=_0x7b71d-0x0;var _0x37e905=_0x85a4[_0x7b71d];return _0x37e905;};'use strict';var multer=require(_0x485a('0x0'));var util=require(_0x485a('0x1'));var path=require(_0x485a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x485a('0x3'));var auth=require(_0x485a('0x4'));var interaction=require(_0x485a('0x5'));var config=require(_0x485a('0x6'));var controller=require(_0x485a('0x7'));router[_0x485a('0x8')]('/',auth['isAuthenticated'](),controller[_0x485a('0x9')]);router['get'](_0x485a('0xa'),auth[_0x485a('0xb')](),controller['show']);router[_0x485a('0xc')]('/',auth[_0x485a('0xb')](),controller[_0x485a('0xd')]);router['put'](_0x485a('0xa'),auth[_0x485a('0xb')](),controller[_0x485a('0xe')]);router[_0x485a('0xf')](_0x485a('0xa'),auth[_0x485a('0xb')](),controller[_0x485a('0x10')]);module[_0x485a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 23b8620..3216fa2 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 _0xcec4=['variable','sequelize','ENUM','customVariable','picklist','string','STRING'];(function(_0x7fd61e,_0x5e438b){var _0x56124a=function(_0x483cfa){while(--_0x483cfa){_0x7fd61e['push'](_0x7fd61e['shift']());}};_0x56124a(++_0x5e438b);}(_0xcec4,0xef));var _0x4cec=function(_0x81bd84,_0x27b02b){_0x81bd84=_0x81bd84-0x0;var _0x293c4e=_0xcec4[_0x81bd84];return _0x293c4e;};'use strict';var Sequelize=require(_0x4cec('0x0'));module['exports']={'type':{'type':Sequelize[_0x4cec('0x1')]('string','variable',_0x4cec('0x2'),'keyValue',_0x4cec('0x3')),'defaultValue':_0x4cec('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4cec('0x5')]},'keyType':{'type':Sequelize[_0x4cec('0x1')](_0x4cec('0x4'),_0x4cec('0x6'),_0x4cec('0x2'))},'keyContent':{'type':Sequelize[_0x4cec('0x5')]},'idField':{'type':Sequelize[_0x4cec('0x5')]},'variableName':{'type':Sequelize[_0x4cec('0x5')]}}; \ No newline at end of file +var _0x5efb=['variable','customVariable','STRING','sequelize','exports','ENUM','string'];(function(_0x3758bc,_0x40e87e){var _0x158922=function(_0x3db84f){while(--_0x3db84f){_0x3758bc['push'](_0x3758bc['shift']());}};_0x158922(++_0x40e87e);}(_0x5efb,0xb2));var _0xb5ef=function(_0x12b449,_0x2b8a36){_0x12b449=_0x12b449-0x0;var _0x4e3784=_0x5efb[_0x12b449];return _0x4e3784;};'use strict';var Sequelize=require(_0xb5ef('0x0'));module[_0xb5ef('0x1')]={'type':{'type':Sequelize[_0xb5ef('0x2')](_0xb5ef('0x3'),_0xb5ef('0x4'),_0xb5ef('0x5'),'keyValue','picklist'),'defaultValue':_0xb5ef('0x3')},'content':{'type':Sequelize[_0xb5ef('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xb5ef('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xb5ef('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 2edcbd8..87c1390 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 _0x13e2=['map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','SalesforceField','includeAll','include','findAll','rows','catch','show','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index'];(function(_0x2cdb48,_0x36aa6e){var _0x490c27=function(_0x7f9584){while(--_0x7f9584){_0x2cdb48['push'](_0x2cdb48['shift']());}};_0x490c27(++_0x36aa6e);}(_0x13e2,0x14f));var _0x213e=function(_0x103dbb,_0x2aa1b6){_0x103dbb=_0x103dbb-0x0;var _0x34a8f2=_0x13e2[_0x103dbb];return _0x34a8f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x213e('0x0'));var zipdir=require(_0x213e('0x1'));var jsonpatch=require(_0x213e('0x2'));var rp=require(_0x213e('0x3'));var moment=require(_0x213e('0x4'));var BPromise=require(_0x213e('0x5'));var Mustache=require(_0x213e('0x6'));var util=require(_0x213e('0x7'));var path=require(_0x213e('0x8'));var sox=require(_0x213e('0x9'));var csv=require(_0x213e('0xa'));var ejs=require(_0x213e('0xb'));var fs=require('fs');var fs_extra=require(_0x213e('0xc'));var _=require(_0x213e('0xd'));var squel=require('squel');var crypto=require(_0x213e('0xe'));var jsforce=require(_0x213e('0xf'));var deskjs=require(_0x213e('0x10'));var toCsv=require(_0x213e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x213e('0x11'));var authService=require(_0x213e('0x12'));var qs=require(_0x213e('0x13'));var as=require(_0x213e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x213e('0x15'))(_0x213e('0x16'));var utils=require(_0x213e('0x17'));var config=require(_0x213e('0x18'));var licenseUtil=require(_0x213e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13824f,_0x2fecb6){_0x2fecb6=_0x2fecb6||0xcc;return function(_0x136761){if(_0x136761){return _0x13824f[_0x213e('0x1a')](_0x2fecb6);}return _0x13824f[_0x213e('0x1b')](_0x2fecb6)[_0x213e('0x1c')]();};}function respondWithResult(_0x5606d6,_0xb216d4){_0xb216d4=_0xb216d4||0xc8;return function(_0x89c604){if(_0x89c604){return _0x5606d6['status'](_0xb216d4)[_0x213e('0x1d')](_0x89c604);}};}function respondWithFilteredResult(_0x569e4b,_0xfa15c3){return function(_0x1d9b44){if(_0x1d9b44){var _0x47b5f1=typeof _0xfa15c3['offset']===_0x213e('0x1e')&&typeof _0xfa15c3[_0x213e('0x1f')]===_0x213e('0x1e');var _0x16d97c=_0x1d9b44[_0x213e('0x20')];var _0x856c9b=_0x47b5f1?0x0:_0xfa15c3[_0x213e('0x21')];var _0x508f6d=_0x47b5f1?_0x1d9b44[_0x213e('0x20')]:_0xfa15c3[_0x213e('0x21')]+_0xfa15c3[_0x213e('0x1f')];var _0x1bc035;if(_0x508f6d>=_0x16d97c){_0x508f6d=_0x16d97c;_0x1bc035=0xc8;}else{_0x1bc035=0xce;}_0x569e4b[_0x213e('0x1b')](_0x1bc035);return _0x569e4b['set'](_0x213e('0x22'),_0x856c9b+'-'+_0x508f6d+'/'+_0x16d97c)[_0x213e('0x1d')](_0x1d9b44);}return null;};}function patchUpdates(_0x4667ca){return function(_0x26ce78){try{jsonpatch[_0x213e('0x23')](_0x26ce78,_0x4667ca,!![]);}catch(_0x26929a){return BPromise['reject'](_0x26929a);}return _0x26ce78[_0x213e('0x24')]();};}function saveUpdates(_0xc2ad4b,_0x37ea19){return function(_0x4d1444){if(_0x4d1444){return _0x4d1444[_0x213e('0x25')](_0xc2ad4b)[_0x213e('0x26')](function(_0x5451ad){return _0x5451ad;});}return null;};}function removeEntity(_0x1ebef9,_0x31208a){return function(_0x3bf2f8){if(_0x3bf2f8){return _0x3bf2f8[_0x213e('0x27')]()[_0x213e('0x26')](function(){_0x1ebef9[_0x213e('0x1b')](0xcc)[_0x213e('0x1c')]();});}};}function handleEntityNotFound(_0xd5b73a,_0x17a96f){return function(_0x2f141d){if(!_0x2f141d){_0xd5b73a[_0x213e('0x1a')](0x194);}return _0x2f141d;};}function handleError(_0x5b4520,_0x2532b1){_0x2532b1=_0x2532b1||0x1f4;return function(_0x69e3c1){logger[_0x213e('0x28')](_0x69e3c1[_0x213e('0x29')]);if(_0x69e3c1[_0x213e('0x2a')]){delete _0x69e3c1[_0x213e('0x2a')];}_0x5b4520[_0x213e('0x1b')](_0x2532b1)[_0x213e('0x2b')](_0x69e3c1);};}exports[_0x213e('0x2c')]=function(_0x443a39,_0xbae73b){var _0x41d0a0={},_0x1c9f6e={},_0xe52e8e={'count':0x0,'rows':[]};var _0x2e61a4=_[_0x213e('0x2d')](db['SalesforceField'][_0x213e('0x2e')],function(_0x4100eb){return{'name':_0x4100eb[_0x213e('0x2f')],'type':_0x4100eb[_0x213e('0x30')]['key']};});_0x1c9f6e[_0x213e('0x31')]=_[_0x213e('0x2d')](_0x2e61a4,_0x213e('0x2a'));_0x1c9f6e[_0x213e('0x32')]=_[_0x213e('0x33')](_0x443a39[_0x213e('0x32')]);_0x1c9f6e[_0x213e('0x34')]=_[_0x213e('0x35')](_0x1c9f6e['model'],_0x1c9f6e[_0x213e('0x32')]);_0x41d0a0[_0x213e('0x36')]=_['intersection'](_0x1c9f6e['model'],qs['fields'](_0x443a39[_0x213e('0x32')][_0x213e('0x37')]));_0x41d0a0[_0x213e('0x36')]=_0x41d0a0['attributes'][_0x213e('0x38')]?_0x41d0a0['attributes']:_0x1c9f6e[_0x213e('0x31')];if(!_0x443a39['query'][_0x213e('0x39')]('nolimit')){_0x41d0a0[_0x213e('0x1f')]=qs[_0x213e('0x1f')](_0x443a39[_0x213e('0x32')][_0x213e('0x1f')]);_0x41d0a0[_0x213e('0x21')]=qs[_0x213e('0x21')](_0x443a39[_0x213e('0x32')][_0x213e('0x21')]);}_0x41d0a0[_0x213e('0x3a')]=qs[_0x213e('0x3b')](_0x443a39[_0x213e('0x32')][_0x213e('0x3b')]);_0x41d0a0['where']=qs[_0x213e('0x34')](_[_0x213e('0x3c')](_0x443a39[_0x213e('0x32')],_0x1c9f6e['filters']),_0x2e61a4);if(_0x443a39[_0x213e('0x32')][_0x213e('0x3d')]){_0x41d0a0[_0x213e('0x3e')]=_[_0x213e('0x3f')](_0x41d0a0[_0x213e('0x3e')],{'$or':_[_0x213e('0x2d')](_0x2e61a4,function(_0x565c07){if(_0x565c07[_0x213e('0x30')]!==_0x213e('0x40')){var _0x10888c={};_0x10888c[_0x565c07['name']]={'$like':'%'+_0x443a39[_0x213e('0x32')][_0x213e('0x3d')]+'%'};return _0x10888c;}})});}_0x41d0a0=_[_0x213e('0x3f')]({},_0x41d0a0,_0x443a39[_0x213e('0x41')]);var _0x217dd1={'where':_0x41d0a0['where']};return db[_0x213e('0x42')][_0x213e('0x20')](_0x217dd1)[_0x213e('0x26')](function(_0x3d6ce8){_0xe52e8e[_0x213e('0x20')]=_0x3d6ce8;if(_0x443a39['query'][_0x213e('0x43')]){_0x41d0a0[_0x213e('0x44')]=[{'all':!![]}];}return db[_0x213e('0x42')][_0x213e('0x45')](_0x41d0a0);})[_0x213e('0x26')](function(_0x989eab){_0xe52e8e[_0x213e('0x46')]=_0x989eab;return _0xe52e8e;})[_0x213e('0x26')](respondWithFilteredResult(_0xbae73b,_0x41d0a0))[_0x213e('0x47')](handleError(_0xbae73b,null));};exports[_0x213e('0x48')]=function(_0x17f2d2,_0x26bbd0){var _0x14781c={'raw':!![],'where':{'id':_0x17f2d2['params']['id']}},_0x188297={};_0x188297[_0x213e('0x31')]=_[_0x213e('0x33')](db[_0x213e('0x42')][_0x213e('0x2e')]);_0x188297['query']=_[_0x213e('0x33')](_0x17f2d2[_0x213e('0x32')]);_0x188297[_0x213e('0x34')]=_[_0x213e('0x35')](_0x188297['model'],_0x188297[_0x213e('0x32')]);_0x14781c[_0x213e('0x36')]=_[_0x213e('0x35')](_0x188297[_0x213e('0x31')],qs['fields'](_0x17f2d2[_0x213e('0x32')][_0x213e('0x37')]));_0x14781c[_0x213e('0x36')]=_0x14781c[_0x213e('0x36')][_0x213e('0x38')]?_0x14781c['attributes']:_0x188297[_0x213e('0x31')];if(_0x17f2d2[_0x213e('0x32')][_0x213e('0x43')]){_0x14781c[_0x213e('0x44')]=[{'all':!![]}];}_0x14781c=_[_0x213e('0x3f')]({},_0x14781c,_0x17f2d2['options']);return db[_0x213e('0x42')]['find'](_0x14781c)[_0x213e('0x26')](handleEntityNotFound(_0x26bbd0,null))[_0x213e('0x26')](respondWithResult(_0x26bbd0,null))['catch'](handleError(_0x26bbd0,null));};exports['create']=function(_0x1fe762,_0x53f2e3){return db['SalesforceField']['create'](_0x1fe762[_0x213e('0x49')],{})[_0x213e('0x26')](respondWithResult(_0x53f2e3,0xc9))[_0x213e('0x47')](handleError(_0x53f2e3,null));};exports[_0x213e('0x25')]=function(_0x37f56b,_0x26b7fb){if(_0x37f56b[_0x213e('0x49')]['id']){delete _0x37f56b[_0x213e('0x49')]['id'];}return db[_0x213e('0x42')][_0x213e('0x4a')]({'where':{'id':_0x37f56b[_0x213e('0x4b')]['id']}})[_0x213e('0x26')](handleEntityNotFound(_0x26b7fb,null))['then'](saveUpdates(_0x37f56b[_0x213e('0x49')],null))[_0x213e('0x26')](respondWithResult(_0x26b7fb,null))[_0x213e('0x47')](handleError(_0x26b7fb,null));};exports[_0x213e('0x27')]=function(_0x453790,_0x178375){return db[_0x213e('0x42')][_0x213e('0x4a')]({'where':{'id':_0x453790[_0x213e('0x4b')]['id']}})[_0x213e('0x26')](handleEntityNotFound(_0x178375,null))[_0x213e('0x26')](removeEntity(_0x178375,null))[_0x213e('0x47')](handleError(_0x178375,null));}; \ No newline at end of file +var _0xe9b7=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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','sendStatus','status','undefined','count','limit','set','save','update','then','destroy','end','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','params','keys','find','create'];(function(_0x205631,_0x2415c1){var _0x59c36d=function(_0x4d7ccd){while(--_0x4d7ccd){_0x205631['push'](_0x205631['shift']());}};_0x59c36d(++_0x2415c1);}(_0xe9b7,0xdc));var _0x7e9b=function(_0x16252d,_0xaad177){_0x16252d=_0x16252d-0x0;var _0xeb5dd5=_0xe9b7[_0x16252d];return _0xeb5dd5;};'use strict';var emlformat=require(_0x7e9b('0x0'));var rimraf=require(_0x7e9b('0x1'));var zipdir=require(_0x7e9b('0x2'));var jsonpatch=require(_0x7e9b('0x3'));var rp=require(_0x7e9b('0x4'));var moment=require(_0x7e9b('0x5'));var BPromise=require(_0x7e9b('0x6'));var Mustache=require(_0x7e9b('0x7'));var util=require(_0x7e9b('0x8'));var path=require(_0x7e9b('0x9'));var sox=require('sox');var csv=require(_0x7e9b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e9b('0xb'));var squel=require('squel');var crypto=require(_0x7e9b('0xc'));var jsforce=require(_0x7e9b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7e9b('0xa'));var querystring=require(_0x7e9b('0xe'));var Papa=require(_0x7e9b('0xf'));var Redis=require(_0x7e9b('0x10'));var authService=require(_0x7e9b('0x11'));var qs=require(_0x7e9b('0x12'));var as=require(_0x7e9b('0x13'));var hardwareService=require(_0x7e9b('0x14'));var logger=require(_0x7e9b('0x15'))(_0x7e9b('0x16'));var utils=require(_0x7e9b('0x17'));var config=require(_0x7e9b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7e9b('0x19'))['db'];function respondWithStatusCode(_0x38802c,_0xea60de){_0xea60de=_0xea60de||0xcc;return function(_0x45ec63){if(_0x45ec63){return _0x38802c[_0x7e9b('0x1a')](_0xea60de);}return _0x38802c['status'](_0xea60de)['end']();};}function respondWithResult(_0x534a5d,_0x56ca59){_0x56ca59=_0x56ca59||0xc8;return function(_0x2185e3){if(_0x2185e3){return _0x534a5d[_0x7e9b('0x1b')](_0x56ca59)['json'](_0x2185e3);}};}function respondWithFilteredResult(_0x33b1c6,_0x2d109e){return function(_0x52e63f){if(_0x52e63f){var _0x12f887=typeof _0x2d109e['offset']===_0x7e9b('0x1c')&&typeof _0x2d109e['limit']===_0x7e9b('0x1c');var _0x776d19=_0x52e63f[_0x7e9b('0x1d')];var _0x3a2328=_0x12f887?0x0:_0x2d109e['offset'];var _0x2b3039=_0x12f887?_0x52e63f[_0x7e9b('0x1d')]:_0x2d109e['offset']+_0x2d109e[_0x7e9b('0x1e')];var _0x43765b;if(_0x2b3039>=_0x776d19){_0x2b3039=_0x776d19;_0x43765b=0xc8;}else{_0x43765b=0xce;}_0x33b1c6[_0x7e9b('0x1b')](_0x43765b);return _0x33b1c6[_0x7e9b('0x1f')]('Content-Range',_0x3a2328+'-'+_0x2b3039+'/'+_0x776d19)['json'](_0x52e63f);}return null;};}function patchUpdates(_0x4797d1){return function(_0x5bfeac){try{jsonpatch['apply'](_0x5bfeac,_0x4797d1,!![]);}catch(_0x57f14f){return BPromise['reject'](_0x57f14f);}return _0x5bfeac[_0x7e9b('0x20')]();};}function saveUpdates(_0x299ed6,_0x41c84c){return function(_0x445dad){if(_0x445dad){return _0x445dad[_0x7e9b('0x21')](_0x299ed6)[_0x7e9b('0x22')](function(_0x50decc){return _0x50decc;});}return null;};}function removeEntity(_0x8b2248,_0x5f0bfc){return function(_0x5b0148){if(_0x5b0148){return _0x5b0148[_0x7e9b('0x23')]()['then'](function(){_0x8b2248[_0x7e9b('0x1b')](0xcc)[_0x7e9b('0x24')]();});}};}function handleEntityNotFound(_0x3d2274,_0x2f1d4d){return function(_0x4684c4){if(!_0x4684c4){_0x3d2274[_0x7e9b('0x1a')](0x194);}return _0x4684c4;};}function handleError(_0x202480,_0x318e4c){_0x318e4c=_0x318e4c||0x1f4;return function(_0x18dbf3){logger['error'](_0x18dbf3[_0x7e9b('0x25')]);if(_0x18dbf3[_0x7e9b('0x26')]){delete _0x18dbf3['name'];}_0x202480[_0x7e9b('0x1b')](_0x318e4c)[_0x7e9b('0x27')](_0x18dbf3);};}exports[_0x7e9b('0x28')]=function(_0x17374c,_0xa634c3){var _0xdaf46c={},_0x4e5fa4={},_0x17d322={'count':0x0,'rows':[]};var _0x486ba2=_[_0x7e9b('0x29')](db[_0x7e9b('0x2a')][_0x7e9b('0x2b')],function(_0x481d24){return{'name':_0x481d24[_0x7e9b('0x2c')],'type':_0x481d24[_0x7e9b('0x2d')][_0x7e9b('0x2e')]};});_0x4e5fa4[_0x7e9b('0x2f')]=_[_0x7e9b('0x29')](_0x486ba2,'name');_0x4e5fa4[_0x7e9b('0x30')]=_['keys'](_0x17374c['query']);_0x4e5fa4[_0x7e9b('0x31')]=_['intersection'](_0x4e5fa4[_0x7e9b('0x2f')],_0x4e5fa4[_0x7e9b('0x30')]);_0xdaf46c[_0x7e9b('0x32')]=_[_0x7e9b('0x33')](_0x4e5fa4[_0x7e9b('0x2f')],qs[_0x7e9b('0x34')](_0x17374c[_0x7e9b('0x30')]['fields']));_0xdaf46c[_0x7e9b('0x32')]=_0xdaf46c[_0x7e9b('0x32')][_0x7e9b('0x35')]?_0xdaf46c['attributes']:_0x4e5fa4[_0x7e9b('0x2f')];if(!_0x17374c[_0x7e9b('0x30')][_0x7e9b('0x36')](_0x7e9b('0x37'))){_0xdaf46c[_0x7e9b('0x1e')]=qs[_0x7e9b('0x1e')](_0x17374c[_0x7e9b('0x30')][_0x7e9b('0x1e')]);_0xdaf46c['offset']=qs[_0x7e9b('0x38')](_0x17374c['query'][_0x7e9b('0x38')]);}_0xdaf46c[_0x7e9b('0x39')]=qs[_0x7e9b('0x3a')](_0x17374c['query'][_0x7e9b('0x3a')]);_0xdaf46c[_0x7e9b('0x3b')]=qs['filters'](_[_0x7e9b('0x3c')](_0x17374c[_0x7e9b('0x30')],_0x4e5fa4[_0x7e9b('0x31')]),_0x486ba2);if(_0x17374c[_0x7e9b('0x30')]['filter']){_0xdaf46c[_0x7e9b('0x3b')]=_[_0x7e9b('0x3d')](_0xdaf46c[_0x7e9b('0x3b')],{'$or':_[_0x7e9b('0x29')](_0x486ba2,function(_0x419ede){if(_0x419ede['type']!==_0x7e9b('0x3e')){var _0x33f390={};_0x33f390[_0x419ede[_0x7e9b('0x26')]]={'$like':'%'+_0x17374c['query'][_0x7e9b('0x3f')]+'%'};return _0x33f390;}})});}_0xdaf46c=_['merge']({},_0xdaf46c,_0x17374c[_0x7e9b('0x40')]);var _0x30ed87={'where':_0xdaf46c[_0x7e9b('0x3b')]};return db[_0x7e9b('0x2a')][_0x7e9b('0x1d')](_0x30ed87)[_0x7e9b('0x22')](function(_0x1be599){_0x17d322['count']=_0x1be599;if(_0x17374c[_0x7e9b('0x30')][_0x7e9b('0x41')]){_0xdaf46c['include']=[{'all':!![]}];}return db['SalesforceField'][_0x7e9b('0x42')](_0xdaf46c);})[_0x7e9b('0x22')](function(_0x386bb1){_0x17d322['rows']=_0x386bb1;return _0x17d322;})[_0x7e9b('0x22')](respondWithFilteredResult(_0xa634c3,_0xdaf46c))[_0x7e9b('0x43')](handleError(_0xa634c3,null));};exports['show']=function(_0x141a4b,_0x1e6973){var _0xd8feec={'raw':!![],'where':{'id':_0x141a4b[_0x7e9b('0x44')]['id']}},_0x56e9b6={};_0x56e9b6[_0x7e9b('0x2f')]=_[_0x7e9b('0x45')](db[_0x7e9b('0x2a')][_0x7e9b('0x2b')]);_0x56e9b6[_0x7e9b('0x30')]=_[_0x7e9b('0x45')](_0x141a4b[_0x7e9b('0x30')]);_0x56e9b6['filters']=_['intersection'](_0x56e9b6[_0x7e9b('0x2f')],_0x56e9b6['query']);_0xd8feec['attributes']=_[_0x7e9b('0x33')](_0x56e9b6[_0x7e9b('0x2f')],qs[_0x7e9b('0x34')](_0x141a4b[_0x7e9b('0x30')][_0x7e9b('0x34')]));_0xd8feec[_0x7e9b('0x32')]=_0xd8feec[_0x7e9b('0x32')][_0x7e9b('0x35')]?_0xd8feec[_0x7e9b('0x32')]:_0x56e9b6[_0x7e9b('0x2f')];if(_0x141a4b[_0x7e9b('0x30')][_0x7e9b('0x41')]){_0xd8feec['include']=[{'all':!![]}];}_0xd8feec=_[_0x7e9b('0x3d')]({},_0xd8feec,_0x141a4b['options']);return db[_0x7e9b('0x2a')][_0x7e9b('0x46')](_0xd8feec)['then'](handleEntityNotFound(_0x1e6973,null))['then'](respondWithResult(_0x1e6973,null))[_0x7e9b('0x43')](handleError(_0x1e6973,null));};exports[_0x7e9b('0x47')]=function(_0x24108d,_0x482c96){return db[_0x7e9b('0x2a')]['create'](_0x24108d[_0x7e9b('0x48')],{})[_0x7e9b('0x22')](respondWithResult(_0x482c96,0xc9))[_0x7e9b('0x43')](handleError(_0x482c96,null));};exports['update']=function(_0x18516f,_0x227963){if(_0x18516f['body']['id']){delete _0x18516f[_0x7e9b('0x48')]['id'];}return db[_0x7e9b('0x2a')][_0x7e9b('0x46')]({'where':{'id':_0x18516f[_0x7e9b('0x44')]['id']}})['then'](handleEntityNotFound(_0x227963,null))['then'](saveUpdates(_0x18516f[_0x7e9b('0x48')],null))[_0x7e9b('0x22')](respondWithResult(_0x227963,null))[_0x7e9b('0x43')](handleError(_0x227963,null));};exports[_0x7e9b('0x23')]=function(_0x2f7b6c,_0x2083f2){return db[_0x7e9b('0x2a')][_0x7e9b('0x46')]({'where':{'id':_0x2f7b6c[_0x7e9b('0x44')]['id']}})[_0x7e9b('0x22')](handleEntityNotFound(_0x2083f2,null))[_0x7e9b('0x22')](removeEntity(_0x2083f2,null))[_0x7e9b('0x43')](handleError(_0x2083f2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index c887531..96d781e 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 _0x16d1=['idField','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf','define','int_salesforce_fields','salesforce_unique_index'];(function(_0x70a97b,_0x48639c){var _0x7972df=function(_0x190ebe){while(--_0x190ebe){_0x70a97b['push'](_0x70a97b['shift']());}};_0x7972df(++_0x48639c);}(_0x16d1,0x92));var _0x116d=function(_0x4f8c89,_0x452e99){_0x4f8c89=_0x4f8c89-0x0;var _0x376dba=_0x16d1[_0x4f8c89];return _0x376dba;};'use strict';var _=require(_0x116d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x116d('0x1'));var moment=require(_0x116d('0x2'));var BPromise=require(_0x116d('0x3'));var rp=require(_0x116d('0x4'));var fs=require('fs');var path=require(_0x116d('0x5'));var rimraf=require(_0x116d('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x328a76,_0xe83b07){return _0x328a76[_0x116d('0x7')]('SalesforceField',attributes,{'tableName':_0x116d('0x8'),'paranoid':![],'indexes':[{'name':_0x116d('0x9'),'fields':[_0x116d('0xa'),_0x116d('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb32=['idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intSalesforceField.attributes','SalesforceField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb32,0x120));var _0x2bb3=function(_0x39ca94,_0x378f98){_0x39ca94=_0x39ca94-0x0;var _0x484538=_0xbb32[_0x39ca94];return _0x484538;};'use strict';var _=require('lodash');var util=require(_0x2bb3('0x0'));var logger=require(_0x2bb3('0x1'))(_0x2bb3('0x2'));var moment=require(_0x2bb3('0x3'));var BPromise=require(_0x2bb3('0x4'));var rp=require(_0x2bb3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2bb3('0x6'));var config=require('../../config/environment');var attributes=require(_0x2bb3('0x7'));module['exports']=function(_0x1dec61,_0x415e53){return _0x1dec61['define'](_0x2bb3('0x8'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x2bb3('0x9'),_0x2bb3('0xa')],'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 aae46ad..c20fe00 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 _0x613a=['stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','SalesforceField,\x20%s,\x20%s','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x613a,0x1bf));var _0xa613=function(_0x3d3e2e,_0x20be3e){_0x3d3e2e=_0x3d3e2e-0x0;var _0xfb2975=_0x613a[_0x3d3e2e];return _0xfb2975;};'use strict';var _=require(_0xa613('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa613('0x1'));var rs=require(_0xa613('0x2'));var fs=require('fs');var Redis=require(_0xa613('0x3'));var db=require(_0xa613('0x4'))['db'];var utils=require(_0xa613('0x5'));var logger=require(_0xa613('0x6'))(_0xa613('0x7'));var config=require(_0xa613('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa613('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4abb16,_0x2b7c4c,_0x4a5498){return new BPromise(function(_0x230ed5,_0x3ca6e0){return client[_0xa613('0xa')](_0x4abb16,_0x4a5498)[_0xa613('0xb')](function(_0x1009d9){logger['info'](_0xa613('0xc'),_0x2b7c4c,'request\x20sent');logger['debug'](_0xa613('0xd'),_0x2b7c4c,_0xa613('0xe'),JSON[_0xa613('0xf')](_0x1009d9));if(_0x1009d9[_0xa613('0x10')]){if(_0x1009d9['error'][_0xa613('0x11')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x2b7c4c,_0x1009d9[_0xa613('0x10')]['message']);return _0x3ca6e0(_0x1009d9[_0xa613('0x10')][_0xa613('0x12')]);}logger[_0xa613('0x10')](_0xa613('0xc'),_0x2b7c4c,_0x1009d9[_0xa613('0x10')]['message']);return _0x230ed5(_0x1009d9['error'][_0xa613('0x12')]);}else{logger[_0xa613('0x13')](_0xa613('0xc'),_0x2b7c4c,_0xa613('0xe'));_0x230ed5(_0x1009d9[_0xa613('0x14')][_0xa613('0x12')]);}})['catch'](function(_0x483ed1){logger[_0xa613('0x10')](_0xa613('0xc'),_0x2b7c4c,_0x483ed1);_0x3ca6e0(_0x483ed1);});});} \ No newline at end of file +var _0x9072=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xace521,_0x5dd706){var _0x5d040c=function(_0x473721){while(--_0x473721){_0xace521['push'](_0xace521['shift']());}};_0x5d040c(++_0x5dd706);}(_0x9072,0x1b2));var _0x2907=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9072[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2907('0x0'));var util=require('util');var moment=require(_0x2907('0x1'));var BPromise=require(_0x2907('0x2'));var rs=require(_0x2907('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2907('0x4'))['db'];var utils=require(_0x2907('0x5'));var logger=require(_0x2907('0x6'))(_0x2907('0x7'));var config=require(_0x2907('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2907('0x9')][_0x2907('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x133bea,_0x5b520c,_0x594cee){return new BPromise(function(_0x417ed8,_0x501997){return client[_0x2907('0xb')](_0x133bea,_0x594cee)[_0x2907('0xc')](function(_0x4ca52b){logger[_0x2907('0xd')](_0x2907('0xe'),_0x5b520c,_0x2907('0xf'));logger[_0x2907('0x10')](_0x2907('0x11'),_0x5b520c,_0x2907('0xf'),JSON[_0x2907('0x12')](_0x4ca52b));if(_0x4ca52b['error']){if(_0x4ca52b[_0x2907('0x13')][_0x2907('0x14')]===0x1f4){logger['error'](_0x2907('0xe'),_0x5b520c,_0x4ca52b['error']['message']);return _0x501997(_0x4ca52b['error'][_0x2907('0x15')]);}logger[_0x2907('0x13')](_0x2907('0xe'),_0x5b520c,_0x4ca52b[_0x2907('0x13')][_0x2907('0x15')]);return _0x417ed8(_0x4ca52b[_0x2907('0x13')][_0x2907('0x15')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x5b520c,_0x2907('0xf'));_0x417ed8(_0x4ca52b[_0x2907('0x16')][_0x2907('0x15')]);}})[_0x2907('0x17')](function(_0x3e2ac2){logger[_0x2907('0x13')](_0x2907('0xe'),_0x5b520c,_0x3e2ac2);_0x501997(_0x3e2ac2);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 9e8fd1c..5e3ed42 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 _0x91ff=['show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id'];(function(_0x36fc47,_0x354b21){var _0x1867fc=function(_0x566509){while(--_0x566509){_0x36fc47['push'](_0x36fc47['shift']());}};_0x1867fc(++_0x354b21);}(_0x91ff,0x15b));var _0xf91f=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x91ff[_0xf50820];return _0x2a9b10;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf91f('0x0'));var timeout=require('connect-timeout');var express=require(_0xf91f('0x1'));var router=express['Router']();var fs_extra=require(_0xf91f('0x2'));var auth=require(_0xf91f('0x3'));var interaction=require(_0xf91f('0x4'));var config=require(_0xf91f('0x5'));var controller=require(_0xf91f('0x6'));router[_0xf91f('0x7')]('/',auth[_0xf91f('0x8')](),controller['index']);router[_0xf91f('0x7')](_0xf91f('0x9'),auth['isAuthenticated'](),controller[_0xf91f('0xa')]);router['get'](_0xf91f('0xb'),auth[_0xf91f('0x8')](),controller['getConfigurations']);router[_0xf91f('0x7')](_0xf91f('0xc'),auth[_0xf91f('0x8')](),controller[_0xf91f('0xd')]);router[_0xf91f('0xe')]('/',auth[_0xf91f('0x8')](),controller['create']);router[_0xf91f('0xe')](_0xf91f('0xb'),auth[_0xf91f('0x8')](),controller[_0xf91f('0xf')]);router[_0xf91f('0x10')](_0xf91f('0x9'),auth[_0xf91f('0x8')](),controller[_0xf91f('0x11')]);router[_0xf91f('0x12')](_0xf91f('0x9'),auth[_0xf91f('0x8')](),controller[_0xf91f('0x13')]);module[_0xf91f('0x14')]=router; \ No newline at end of file +var _0x3cb9=['index','/:id','show','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1f1fb4,_0x15a561){var _0x12fa15=function(_0x5ecc9b){while(--_0x5ecc9b){_0x1f1fb4['push'](_0x1f1fb4['shift']());}};_0x12fa15(++_0x15a561);}(_0x3cb9,0x187));var _0x93cb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3cb9[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x93cb('0x0'));var timeout=require(_0x93cb('0x1'));var express=require(_0x93cb('0x2'));var router=express[_0x93cb('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x93cb('0x4'));var config=require(_0x93cb('0x5'));var controller=require('./intServicenowAccount.controller');router[_0x93cb('0x6')]('/',auth[_0x93cb('0x7')](),controller[_0x93cb('0x8')]);router[_0x93cb('0x6')](_0x93cb('0x9'),auth[_0x93cb('0x7')](),controller[_0x93cb('0xa')]);router[_0x93cb('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x93cb('0x6')](_0x93cb('0xb'),auth[_0x93cb('0x7')](),controller[_0x93cb('0xc')]);router['post']('/',auth[_0x93cb('0x7')](),controller[_0x93cb('0xd')]);router[_0x93cb('0xe')](_0x93cb('0xf'),auth[_0x93cb('0x7')](),controller[_0x93cb('0x10')]);router[_0x93cb('0x11')](_0x93cb('0x9'),auth[_0x93cb('0x7')](),controller[_0x93cb('0x12')]);router[_0x93cb('0x13')](_0x93cb('0x9'),auth[_0x93cb('0x7')](),controller['destroy']);module[_0x93cb('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 8218e46..8cca11b 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 _0xe8bc=['STRING','username','remoteUri','sequelize','exports'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xe8bc,0x67));var _0xce8b=function(_0x30496b,_0x542481){_0x30496b=_0x30496b-0x0;var _0xd4bee2=_0xe8bc[_0x30496b];return _0xd4bee2;};'use strict';var Sequelize=require(_0xce8b('0x0'));module[_0xce8b('0x1')]={'name':{'type':Sequelize[_0xce8b('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xce8b('0x2')],'unique':_0xce8b('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xce8b('0x4')},'serverUrl':{'type':Sequelize[_0xce8b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xde07=['sequelize','exports','STRING','remoteUri'];(function(_0x2ebde9,_0x1a7200){var _0x16cb7a=function(_0x3a5d11){while(--_0x3a5d11){_0x2ebde9['push'](_0x2ebde9['shift']());}};_0x16cb7a(++_0x1a7200);}(_0xde07,0x188));var _0x7de0=function(_0x35cf87,_0xd20f61){_0x35cf87=_0x35cf87-0x0;var _0x49a385=_0xde07[_0x35cf87];return _0x49a385;};'use strict';var Sequelize=require(_0x7de0('0x0'));module[_0x7de0('0x1')]={'name':{'type':Sequelize[_0x7de0('0x2')]},'description':{'type':Sequelize[_0x7de0('0x2')]},'username':{'type':Sequelize[_0x7de0('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x7de0('0x2')]},'email':{'type':Sequelize[_0x7de0('0x2')]},'remoteUri':{'type':Sequelize[_0x7de0('0x2')],'unique':_0x7de0('0x3')},'serverUrl':{'type':Sequelize[_0x7de0('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 758d52b..98a29f3 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 _0x8ace=['boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','false','value','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','limit','count','offset','apply','save','then','destroy','end','sendStatus','error','stack','name','send','index','ServicenowAccount','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','options','create','body','update','find','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','made_sla','hold_reason','knowledge','subcategory','incident_state','category','parent','caused_by','watch_list','upon_reject','child_incidents','number','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','cmdb_ci','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','work_end','resolved_at','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','email','remoteUri','serverUrl','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','includes','internalType','label','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','push','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials'];(function(_0x34a47b,_0x109857){var _0x3bd3d7=function(_0x30e79a){while(--_0x30e79a){_0x34a47b['push'](_0x34a47b['shift']());}};_0x3bd3d7(++_0x109857);}(_0x8ace,0xbd));var _0xe8ac=function(_0x3f0b15,_0xb88473){_0x3f0b15=_0x3f0b15-0x0;var _0x38f95f=_0x8ace[_0x3f0b15];return _0x38f95f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe8ac('0x0'));var rp=require(_0xe8ac('0x1'));var moment=require(_0xe8ac('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe8ac('0x3'));var util=require(_0xe8ac('0x4'));var path=require(_0xe8ac('0x5'));var sox=require(_0xe8ac('0x6'));var csv=require('to-csv');var ejs=require(_0xe8ac('0x7'));var fs=require('fs');var fs_extra=require(_0xe8ac('0x8'));var _=require('lodash');var squel=require(_0xe8ac('0x9'));var crypto=require(_0xe8ac('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe8ac('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe8ac('0xc'));var authService=require(_0xe8ac('0xd'));var qs=require(_0xe8ac('0xe'));var as=require(_0xe8ac('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8ac('0x10'))(_0xe8ac('0x11'));var utils=require(_0xe8ac('0x12'));var config=require(_0xe8ac('0x13'));var licenseUtil=require(_0xe8ac('0x14'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x28135e,_0x19dd1e){_0x19dd1e=_0x19dd1e||0xcc;return function(_0x58c517){if(_0x58c517){return _0x28135e['sendStatus'](_0x19dd1e);}return _0x28135e[_0xe8ac('0x15')](_0x19dd1e)['end']();};}function respondWithResult(_0x819b1b,_0x1cfa48){_0x1cfa48=_0x1cfa48||0xc8;return function(_0x541879){if(_0x541879){return _0x819b1b[_0xe8ac('0x15')](_0x1cfa48)['json'](_0x541879);}};}function respondWithFilteredResult(_0x2d462b,_0x541b76){return function(_0x22dd7a){if(_0x22dd7a){var _0x217cde=typeof _0x541b76['offset']==='undefined'&&typeof _0x541b76[_0xe8ac('0x16')]==='undefined';var _0x372301=_0x22dd7a[_0xe8ac('0x17')];var _0x3342c4=_0x217cde?0x0:_0x541b76[_0xe8ac('0x18')];var _0x268bfd=_0x217cde?_0x22dd7a[_0xe8ac('0x17')]:_0x541b76[_0xe8ac('0x18')]+_0x541b76['limit'];var _0x37064f;if(_0x268bfd>=_0x372301){_0x268bfd=_0x372301;_0x37064f=0xc8;}else{_0x37064f=0xce;}_0x2d462b[_0xe8ac('0x15')](_0x37064f);return _0x2d462b['set']('Content-Range',_0x3342c4+'-'+_0x268bfd+'/'+_0x372301)['json'](_0x22dd7a);}return null;};}function patchUpdates(_0x319a80){return function(_0x5a5e76){try{jsonpatch[_0xe8ac('0x19')](_0x5a5e76,_0x319a80,!![]);}catch(_0x2a6b7f){return BPromise['reject'](_0x2a6b7f);}return _0x5a5e76[_0xe8ac('0x1a')]();};}function saveUpdates(_0x358e79,_0x756998){return function(_0x59318a){if(_0x59318a){return _0x59318a['update'](_0x358e79)[_0xe8ac('0x1b')](function(_0x23c248){return _0x23c248;});}return null;};}function removeEntity(_0x351ec7,_0x4b9c34){return function(_0x3f2a2e){if(_0x3f2a2e){return _0x3f2a2e[_0xe8ac('0x1c')]()[_0xe8ac('0x1b')](function(){_0x351ec7[_0xe8ac('0x15')](0xcc)[_0xe8ac('0x1d')]();});}};}function handleEntityNotFound(_0x410a89,_0x2ee376){return function(_0x265e51){if(!_0x265e51){_0x410a89[_0xe8ac('0x1e')](0x194);}return _0x265e51;};}function handleError(_0x124aee,_0x2238e1){_0x2238e1=_0x2238e1||0x1f4;return function(_0x17216d){logger[_0xe8ac('0x1f')](_0x17216d[_0xe8ac('0x20')]);if(_0x17216d[_0xe8ac('0x21')]){delete _0x17216d[_0xe8ac('0x21')];}_0x124aee[_0xe8ac('0x15')](_0x2238e1)[_0xe8ac('0x22')](_0x17216d);};}exports[_0xe8ac('0x23')]=function(_0x159e46,_0x3235c1){var _0x17dd5e={},_0x7efc4b={},_0x1798cf={'count':0x0,'rows':[]};var _0x283ffb=_['map'](db[_0xe8ac('0x24')]['rawAttributes'],function(_0x4845d5){return{'name':_0x4845d5[_0xe8ac('0x25')],'type':_0x4845d5[_0xe8ac('0x26')][_0xe8ac('0x27')]};});_0x7efc4b[_0xe8ac('0x28')]=_[_0xe8ac('0x29')](_0x283ffb,_0xe8ac('0x21'));_0x7efc4b[_0xe8ac('0x2a')]=_[_0xe8ac('0x2b')](_0x159e46[_0xe8ac('0x2a')]);_0x7efc4b[_0xe8ac('0x2c')]=_['intersection'](_0x7efc4b[_0xe8ac('0x28')],_0x7efc4b[_0xe8ac('0x2a')]);_0x17dd5e[_0xe8ac('0x2d')]=_['intersection'](_0x7efc4b[_0xe8ac('0x28')],qs['fields'](_0x159e46[_0xe8ac('0x2a')][_0xe8ac('0x2e')]));_0x17dd5e[_0xe8ac('0x2d')]=_0x17dd5e[_0xe8ac('0x2d')][_0xe8ac('0x2f')]?_0x17dd5e[_0xe8ac('0x2d')]:_0x7efc4b[_0xe8ac('0x28')];if(!_0x159e46[_0xe8ac('0x2a')]['hasOwnProperty'](_0xe8ac('0x30'))){_0x17dd5e[_0xe8ac('0x16')]=qs[_0xe8ac('0x16')](_0x159e46[_0xe8ac('0x2a')][_0xe8ac('0x16')]);_0x17dd5e[_0xe8ac('0x18')]=qs[_0xe8ac('0x18')](_0x159e46[_0xe8ac('0x2a')]['offset']);}_0x17dd5e['order']=qs[_0xe8ac('0x31')](_0x159e46['query'][_0xe8ac('0x31')]);_0x17dd5e['where']=qs[_0xe8ac('0x2c')](_[_0xe8ac('0x32')](_0x159e46[_0xe8ac('0x2a')],_0x7efc4b[_0xe8ac('0x2c')]),_0x283ffb);if(_0x159e46['query'][_0xe8ac('0x33')]){_0x17dd5e[_0xe8ac('0x34')]=_[_0xe8ac('0x35')](_0x17dd5e[_0xe8ac('0x34')],{'$or':_[_0xe8ac('0x29')](_0x283ffb,function(_0x1eb5ed){if(_0x1eb5ed[_0xe8ac('0x26')]!==_0xe8ac('0x36')){var _0x53066c={};_0x53066c[_0x1eb5ed['name']]={'$like':'%'+_0x159e46[_0xe8ac('0x2a')][_0xe8ac('0x33')]+'%'};return _0x53066c;}})});}_0x17dd5e=_[_0xe8ac('0x35')]({},_0x17dd5e,_0x159e46['options']);var _0xbe32fe={'where':_0x17dd5e['where']};return db[_0xe8ac('0x24')][_0xe8ac('0x17')](_0xbe32fe)[_0xe8ac('0x1b')](function(_0x1a5e43){_0x1798cf[_0xe8ac('0x17')]=_0x1a5e43;if(_0x159e46[_0xe8ac('0x2a')][_0xe8ac('0x37')]){_0x17dd5e[_0xe8ac('0x38')]=[{'all':!![]}];}return db[_0xe8ac('0x24')][_0xe8ac('0x39')](_0x17dd5e);})[_0xe8ac('0x1b')](function(_0x58b811){_0x1798cf[_0xe8ac('0x3a')]=_0x58b811;return _0x1798cf;})[_0xe8ac('0x1b')](respondWithFilteredResult(_0x3235c1,_0x17dd5e))[_0xe8ac('0x3b')](handleError(_0x3235c1,null));};exports[_0xe8ac('0x3c')]=function(_0x1ff007,_0x39a9e8){var _0x53dc4b={'raw':![],'where':{'id':_0x1ff007[_0xe8ac('0x3d')]['id']}},_0x2c16db={};_0x2c16db[_0xe8ac('0x28')]=_[_0xe8ac('0x2b')](db[_0xe8ac('0x24')][_0xe8ac('0x3e')]);_0x2c16db['query']=_['keys'](_0x1ff007[_0xe8ac('0x2a')]);_0x2c16db[_0xe8ac('0x2c')]=_[_0xe8ac('0x3f')](_0x2c16db[_0xe8ac('0x28')],_0x2c16db['query']);_0x53dc4b[_0xe8ac('0x2d')]=_[_0xe8ac('0x3f')](_0x2c16db[_0xe8ac('0x28')],qs[_0xe8ac('0x2e')](_0x1ff007[_0xe8ac('0x2a')]['fields']));_0x53dc4b[_0xe8ac('0x2d')]=_0x53dc4b[_0xe8ac('0x2d')][_0xe8ac('0x2f')]?_0x53dc4b['attributes']:_0x2c16db[_0xe8ac('0x28')];if(_0x1ff007[_0xe8ac('0x2a')][_0xe8ac('0x37')]){_0x53dc4b[_0xe8ac('0x38')]=[{'all':!![]}];}_0x53dc4b=_['merge']({},_0x53dc4b,_0x1ff007[_0xe8ac('0x40')]);return db[_0xe8ac('0x24')]['find'](_0x53dc4b)[_0xe8ac('0x1b')](handleEntityNotFound(_0x39a9e8,null))['then'](respondWithResult(_0x39a9e8,null))['catch'](handleError(_0x39a9e8,null));};exports['create']=function(_0x29ecee,_0x3ade28){return db[_0xe8ac('0x24')][_0xe8ac('0x41')](_0x29ecee[_0xe8ac('0x42')],{})[_0xe8ac('0x1b')](respondWithResult(_0x3ade28,0xc9))['catch'](handleError(_0x3ade28,null));};exports[_0xe8ac('0x43')]=function(_0x1eed20,_0x1666a5){if(_0x1eed20[_0xe8ac('0x42')]['id']){delete _0x1eed20[_0xe8ac('0x42')]['id'];}return db['ServicenowAccount'][_0xe8ac('0x44')]({'where':{'id':_0x1eed20[_0xe8ac('0x3d')]['id']}})[_0xe8ac('0x1b')](handleEntityNotFound(_0x1666a5,null))[_0xe8ac('0x1b')](saveUpdates(_0x1eed20['body'],null))['then'](respondWithResult(_0x1666a5,null))[_0xe8ac('0x3b')](handleError(_0x1666a5,null));};exports[_0xe8ac('0x1c')]=function(_0x4674cb,_0x35906a){return db[_0xe8ac('0x24')][_0xe8ac('0x44')]({'where':{'id':_0x4674cb[_0xe8ac('0x3d')]['id']}})[_0xe8ac('0x1b')](handleEntityNotFound(_0x35906a,null))['then'](removeEntity(_0x35906a,null))[_0xe8ac('0x3b')](handleError(_0x35906a,null));};exports['getConfigurations']=function(_0x57adea,_0x100e3e,_0x440789){var _0x13ba04={};var _0x3e30c7={};var _0x1958a4;var _0x18145b;return db[_0xe8ac('0x24')]['findOne']({'where':{'id':_0x57adea['params']['id']}})[_0xe8ac('0x1b')](handleEntityNotFound(_0x100e3e,null))['then'](function(_0x5ec7c0){if(_0x5ec7c0){_0x1958a4=_0x5ec7c0;_0x3e30c7['model']=_[_0xe8ac('0x2b')](db['ServicenowConfiguration'][_0xe8ac('0x3e')]);_0x3e30c7[_0xe8ac('0x2a')]=_[_0xe8ac('0x2b')](_0x57adea[_0xe8ac('0x2a')]);_0x3e30c7[_0xe8ac('0x2c')]=_[_0xe8ac('0x3f')](_0x3e30c7[_0xe8ac('0x28')],_0x3e30c7['query']);_0x13ba04[_0xe8ac('0x2d')]=_[_0xe8ac('0x3f')](_0x3e30c7[_0xe8ac('0x28')],qs[_0xe8ac('0x2e')](_0x57adea['query'][_0xe8ac('0x2e')]));_0x13ba04[_0xe8ac('0x2d')]=_0x13ba04[_0xe8ac('0x2d')][_0xe8ac('0x2f')]?_0x13ba04[_0xe8ac('0x2d')]:_0x3e30c7[_0xe8ac('0x28')];_0x13ba04['order']=qs['sort'](_0x57adea['query']['sort']);_0x13ba04[_0xe8ac('0x34')]=qs['filters'](_[_0xe8ac('0x32')](_0x57adea[_0xe8ac('0x2a')],_0x3e30c7[_0xe8ac('0x2c')]));if(_0x57adea[_0xe8ac('0x2a')]['filter']){_0x13ba04[_0xe8ac('0x34')]=_[_0xe8ac('0x35')](_0x13ba04[_0xe8ac('0x34')],{'$or':_['map'](_0x13ba04[_0xe8ac('0x2d')],function(_0x19c41c){var _0x176741={};_0x176741[_0x19c41c]={'$like':'%'+_0x57adea[_0xe8ac('0x2a')][_0xe8ac('0x33')]+'%'};return _0x176741;})});}_0x13ba04=_[_0xe8ac('0x35')]({},_0x13ba04,_0x57adea[_0xe8ac('0x40')]);return _0x1958a4[_0xe8ac('0x45')](_0x13ba04);}})['then'](function(_0x325814){if(_0x325814){_0x18145b=_0x325814[_0xe8ac('0x2f')];if(!_0x57adea[_0xe8ac('0x2a')][_0xe8ac('0x46')](_0xe8ac('0x30'))){_0x13ba04[_0xe8ac('0x16')]=qs[_0xe8ac('0x16')](_0x57adea[_0xe8ac('0x2a')][_0xe8ac('0x16')]);_0x13ba04[_0xe8ac('0x18')]=qs['offset'](_0x57adea['query'][_0xe8ac('0x18')]);}return _0x1958a4[_0xe8ac('0x45')](_0x13ba04);}})[_0xe8ac('0x1b')](function(_0xdb1fec){if(_0xdb1fec){return _0xdb1fec?{'count':_0x18145b,'rows':_0xdb1fec}:null;}})[_0xe8ac('0x1b')](respondWithResult(_0x100e3e,null))['catch'](handleError(_0x100e3e,null));};exports[_0xe8ac('0x47')]=function(_0x52f3e7,_0x38fc6e,_0x558675){if(_0x52f3e7[_0xe8ac('0x42')]['id']){delete _0x52f3e7[_0xe8ac('0x42')]['id'];}return db['ServicenowAccount'][_0xe8ac('0x48')]({'where':{'id':_0x52f3e7[_0xe8ac('0x3d')]['id']}})[_0xe8ac('0x1b')](handleEntityNotFound(_0x38fc6e,null))['then'](function(_0x4f6dbc){if(_0x4f6dbc){_0x52f3e7[_0xe8ac('0x42')][_0xe8ac('0x49')]=_0x4f6dbc['id'];_0x52f3e7[_0xe8ac('0x42')][_0xe8ac('0x4a')]=integrations[_0xe8ac('0x4b')](_0x52f3e7[_0xe8ac('0x42')][_0xe8ac('0x4c')],_0x52f3e7[_0xe8ac('0x42')][_0xe8ac('0x26')]);_0x52f3e7[_0xe8ac('0x42')][_0xe8ac('0x4d')]=integrations[_0xe8ac('0x4e')](_0x52f3e7[_0xe8ac('0x42')][_0xe8ac('0x4c')],_0x52f3e7[_0xe8ac('0x42')]['type']);return db[_0xe8ac('0x4f')][_0xe8ac('0x41')](_0x52f3e7[_0xe8ac('0x42')],{'include':[{'model':db[_0xe8ac('0x50')],'as':_0xe8ac('0x4a')},{'model':db[_0xe8ac('0x50')],'as':_0xe8ac('0x4d')}]});}return null;})[_0xe8ac('0x1b')](respondWithResult(_0x38fc6e,null))['catch'](handleError(_0x38fc6e,null));};exports['getFields']=function(_0x438ef7,_0x507841,_0xadf0d7){var _0x519328=[_0xe8ac('0x51'),_0xe8ac('0x52'),_0xe8ac('0x53'),_0xe8ac('0x54'),'close_code','notify',_0xe8ac('0x55'),'severity',_0xe8ac('0x56')];var _0x41686b=[_0xe8ac('0x57'),_0xe8ac('0x51'),_0xe8ac('0x58'),_0xe8ac('0x59'),_0xe8ac('0x5a'),'sys_updated_on',_0xe8ac('0x5b'),_0xe8ac('0x52'),'approval_history',_0xe8ac('0x5c'),'resolved_by','sys_updated_by',_0xe8ac('0x5d'),_0xe8ac('0x5e'),_0xe8ac('0x5f'),_0xe8ac('0x60'),_0xe8ac('0x61'),'sys_created_by',_0xe8ac('0x53'),'order',_0xe8ac('0x62'),_0xe8ac('0x63'),_0xe8ac('0x64'),'delivery_plan',_0xe8ac('0x65'),_0xe8ac('0x66'),'work_notes_list',_0xe8ac('0x67'),_0xe8ac('0x68'),_0xe8ac('0x69'),_0xe8ac('0x6a'),_0xe8ac('0x6b'),_0xe8ac('0x6c'),'opened_at',_0xe8ac('0x6d'),'group_list',_0xe8ac('0x6e'),'reopened_time',_0xe8ac('0x6f'),'caller_id','approval_set',_0xe8ac('0x54'),_0xe8ac('0x70'),_0xe8ac('0x71'),_0xe8ac('0x72'),_0xe8ac('0x73'),_0xe8ac('0x74'),_0xe8ac('0x75'),_0xe8ac('0x76'),_0xe8ac('0x77'),_0xe8ac('0x78'),_0xe8ac('0x79'),_0xe8ac('0x7a'),_0xe8ac('0x7b'),_0xe8ac('0x7c'),_0xe8ac('0x7d'),'closed_by',_0xe8ac('0x7e'),_0xe8ac('0x7f'),_0xe8ac('0x80'),_0xe8ac('0x81'),_0xe8ac('0x82'),'incident_state',_0xe8ac('0x83'),_0xe8ac('0x84'),'company',_0xe8ac('0x85'),'activity_due',_0xe8ac('0x86'),_0xe8ac('0x87'),_0xe8ac('0x88'),_0xe8ac('0x89'),_0xe8ac('0x8a'),_0xe8ac('0x8b'),'due_date',_0xe8ac('0x8c'),_0xe8ac('0x8d'),_0xe8ac('0x8e'),_0xe8ac('0x8f'),_0xe8ac('0x90'),_0xe8ac('0x91'),_0xe8ac('0x92'),_0xe8ac('0x56')];var _0x1403e0='';var _0x5f4509='';var _0x811468=[];var _0x5933ba='';var _0x543d44='';var _0x158195=[];var _0x2112b6='';var _0x935ae0='';var _0xb04f32={};var _0x24dfa9='';return db[_0xe8ac('0x24')][_0xe8ac('0x48')]({'where':{'id':_0x438ef7[_0xe8ac('0x3d')]['id']},'attributes':['id','username',_0xe8ac('0x93'),_0xe8ac('0x94'),_0xe8ac('0x95'),_0xe8ac('0x96')]})[_0xe8ac('0x1b')](handleEntityNotFound(_0x507841,null))['then'](function(_0x1d8040){if(_0x1d8040){_0x24dfa9=_0x1d8040[_0xe8ac('0x95')];var _0x1d65fb=_0x24dfa9['slice'](-0x1);if(_0x1d65fb==='/'){_0x24dfa9=_0x24dfa9['substring'](0x0,_0x24dfa9[_0xe8ac('0x97')](_0x1d65fb));}_0x935ae0=util[_0xe8ac('0x98')](_0xe8ac('0x99'),_0x24dfa9);_0x2112b6=util['format'](_0xe8ac('0x9a'),_0x24dfa9);_0xb04f32={'user':_0x1d8040[_0xe8ac('0x9b')],'pass':_0x1d8040[_0xe8ac('0x93')]};var _0x4fc535={'method':_0xe8ac('0x9c'),'uri':_0x935ae0+_0xe8ac('0x9d'),'auth':_0xb04f32,'json':!![]};return rp(_0x4fc535);}})[_0xe8ac('0x1b')](function(_0xbe8aa7){if(_0xbe8aa7[_0xe8ac('0x9e')][_0xe8ac('0x2f')]>0x0){_0x1403e0=_0xbe8aa7[_0xe8ac('0x9e')];}console[_0xe8ac('0x9f')](_0xe8ac('0xa0'),_0x1403e0);_0x158195=[];_0x5f4509=Object['assign']([],_0x1403e0);_['remove'](_0x5f4509,function(_0x370e7c){return!_0x519328[_0xe8ac('0xa1')](_0x370e7c['name']);});_0x5f4509['forEach'](function(_0xc3aba4){var _0x3e438f=createFieldObject(_0x2112b6,_0xb04f32,_0xc3aba4[_0xe8ac('0xa2')],_0xc3aba4['name'],_0xc3aba4[_0xe8ac('0xa3')],![]);_0x158195['push'](_0x3e438f);});return Promise[_0xe8ac('0xa4')](_0x158195);})[_0xe8ac('0x1b')](function(_0x44ef04){_0x811468=_0x44ef04;_0x5933ba=Object[_0xe8ac('0xa5')]([],_0x1403e0);console['log'](_0xe8ac('0xa6'),_0x1403e0);_['remove'](_0x5933ba,function(_0x28373d){return _0x41686b['includes'](_0x28373d[_0xe8ac('0x21')]);});console[_0xe8ac('0x9f')](_0xe8ac('0xa7'),_0x5933ba);_0x158195=[];_0x5933ba[_0xe8ac('0xa8')](function(_0x2e1f65){var _0x206209=createFieldObject(_0x2112b6,_0xb04f32,_0x2e1f65[_0xe8ac('0xa2')],_0x2e1f65[_0xe8ac('0x21')],_0x2e1f65[_0xe8ac('0xa3')],!![]);_0x158195[_0xe8ac('0xa9')](_0x206209);});return Promise[_0xe8ac('0xa4')](_0x158195);})['then'](function(_0x2faef9){_0x543d44=_0x2faef9;var _0xc1bfc7=_0x811468[_0xe8ac('0xaa')](_0x543d44);return{'count':_0xc1bfc7[_0xe8ac('0x2f')],'rows':_0xc1bfc7};})[_0xe8ac('0x1b')](respondWithResult(_0x507841,null))[_0xe8ac('0x3b')](function(_0x1ae1c1){console[_0xe8ac('0x9f')](_0xe8ac('0xab')+_0x1ae1c1);var _0x422f21=_0x438ef7[_0xe8ac('0x2a')][_0xe8ac('0xac')]?0x1f4:_0x1ae1c1[_0xe8ac('0xad')]||0x1f4;logger[_0xe8ac('0x1f')](_0x1ae1c1[_0xe8ac('0x20')]);delete _0x1ae1c1[_0xe8ac('0x21')];if(_0x422f21===0x191){_0x422f21=0x190;}_0x507841[_0xe8ac('0x15')](_0x422f21)[_0xe8ac('0x22')](_0x438ef7[_0xe8ac('0x2a')][_0xe8ac('0xac')]?{'message':_0xe8ac('0xae'),'statusCode':_0x1ae1c1['statusCode']}:_0x1ae1c1);});};function createFieldObject(_0x329770,_0x53f574,_0x406711,_0x957649,_0x2f2dd1,_0x222de7){return new Promise(function(_0x2adb99,_0xd71c2c){var _0x5b2ff4={'id':_0x957649,'name':_0x2f2dd1,'custom':_0x222de7};if(_0x406711===_0xe8ac('0xaf')){_0x5b2ff4[_0xe8ac('0x40')]=[{'name':_0xe8ac('0xb0'),'value':_0xe8ac('0xb1')},{'name':_0xe8ac('0xb2'),'value':'false'}];_0x2adb99(_0x5b2ff4);}else{var _0x482b66={'method':_0xe8ac('0x9c'),'uri':_0x329770+_0xe8ac('0xb3')+_0x957649,'auth':_0x53f574,'json':!![]};return rp(_0x482b66)[_0xe8ac('0x1b')](function(_0x25eb35){var _0x466604=[];if(_0x25eb35['result'][_0xe8ac('0x2f')]>0x0){_0x25eb35[_0xe8ac('0x9e')][_0xe8ac('0xa8')](function(_0xe8ea8b){if(_0xe8ea8b['inactive']===_0xe8ac('0xb4')){var _0x16fbb4={'name':_0xe8ea8b['label'],'value':_0xe8ea8b[_0xe8ac('0xb5')]};_0x466604[_0xe8ac('0xa9')](_0x16fbb4);}});}_0x5b2ff4[_0xe8ac('0x40')]=_0x466604;if(_0x5b2ff4[_0xe8ac('0x40')][_0xe8ac('0x2f')]>0x0){_0x2adb99(_0x5b2ff4);}else{if(_0x222de7==![]){_0x2adb99();}else{_0x2adb99(_0x5b2ff4);}}});}});} \ No newline at end of file +var _0x56c4=['json','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','key','query','keys','attributes','intersection','fields','model','nolimit','order','where','filters','pick','filter','merge','type','VIRTUAL','options','ServicenowAccount','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','findOne','ServicenowConfiguration','sort','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','severity','category','parent','caused_by','sys_updated_on','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','reopened_time','resolved_at','approval_set','work_notes','short_description','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','True','False','false','result','value','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status'];(function(_0x263ee5,_0x1a366a){var _0x41e351=function(_0x4cc739){while(--_0x4cc739){_0x263ee5['push'](_0x263ee5['shift']());}};_0x41e351(++_0x1a366a);}(_0x56c4,0x163));var _0x456c=function(_0x40ec4e,_0x5d8b1b){_0x40ec4e=_0x40ec4e-0x0;var _0x333401=_0x56c4[_0x40ec4e];return _0x333401;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x456c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x456c('0x1'));var rp=require('request-promise');var moment=require(_0x456c('0x2'));var BPromise=require(_0x456c('0x3'));var Mustache=require(_0x456c('0x4'));var util=require(_0x456c('0x5'));var path=require(_0x456c('0x6'));var sox=require(_0x456c('0x7'));var csv=require(_0x456c('0x8'));var ejs=require(_0x456c('0x9'));var fs=require('fs');var fs_extra=require(_0x456c('0xa'));var _=require('lodash');var squel=require(_0x456c('0xb'));var crypto=require(_0x456c('0xc'));var jsforce=require(_0x456c('0xd'));var deskjs=require(_0x456c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x456c('0xf'));var Papa=require('papaparse');var Redis=require(_0x456c('0x10'));var authService=require(_0x456c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x456c('0x12'));var hardwareService=require(_0x456c('0x13'));var logger=require(_0x456c('0x14'))(_0x456c('0x15'));var utils=require('../../config/utils');var config=require(_0x456c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x456c('0x17'))['db'];var integrations=require(_0x456c('0x18'));function respondWithStatusCode(_0x4a7211,_0x27dc1e){_0x27dc1e=_0x27dc1e||0xcc;return function(_0x5b1150){if(_0x5b1150){return _0x4a7211[_0x456c('0x19')](_0x27dc1e);}return _0x4a7211['status'](_0x27dc1e)['end']();};}function respondWithResult(_0x2612c3,_0xabb75d){_0xabb75d=_0xabb75d||0xc8;return function(_0x4a24bc){if(_0x4a24bc){return _0x2612c3[_0x456c('0x1a')](_0xabb75d)[_0x456c('0x1b')](_0x4a24bc);}};}function respondWithFilteredResult(_0xc1d4a7,_0x2f77cb){return function(_0x51a812){if(_0x51a812){var _0x10fc56=typeof _0x2f77cb['offset']==='undefined'&&typeof _0x2f77cb[_0x456c('0x1c')]==='undefined';var _0x58f70c=_0x51a812[_0x456c('0x1d')];var _0x29c91c=_0x10fc56?0x0:_0x2f77cb[_0x456c('0x1e')];var _0x90ff71=_0x10fc56?_0x51a812['count']:_0x2f77cb[_0x456c('0x1e')]+_0x2f77cb['limit'];var _0x42f690;if(_0x90ff71>=_0x58f70c){_0x90ff71=_0x58f70c;_0x42f690=0xc8;}else{_0x42f690=0xce;}_0xc1d4a7['status'](_0x42f690);return _0xc1d4a7[_0x456c('0x1f')](_0x456c('0x20'),_0x29c91c+'-'+_0x90ff71+'/'+_0x58f70c)['json'](_0x51a812);}return null;};}function patchUpdates(_0x25aa2a){return function(_0x16acf7){try{jsonpatch['apply'](_0x16acf7,_0x25aa2a,!![]);}catch(_0x1ce9c2){return BPromise[_0x456c('0x21')](_0x1ce9c2);}return _0x16acf7[_0x456c('0x22')]();};}function saveUpdates(_0x4f60d2,_0x292ff2){return function(_0x2068ca){if(_0x2068ca){return _0x2068ca[_0x456c('0x23')](_0x4f60d2)[_0x456c('0x24')](function(_0x259762){return _0x259762;});}return null;};}function removeEntity(_0x41a9b5,_0x607835){return function(_0x349c6d){if(_0x349c6d){return _0x349c6d[_0x456c('0x25')]()[_0x456c('0x24')](function(){_0x41a9b5[_0x456c('0x1a')](0xcc)[_0x456c('0x26')]();});}};}function handleEntityNotFound(_0x383012,_0x155018){return function(_0x1dfbf){if(!_0x1dfbf){_0x383012[_0x456c('0x19')](0x194);}return _0x1dfbf;};}function handleError(_0x1b3e75,_0x4eb86b){_0x4eb86b=_0x4eb86b||0x1f4;return function(_0x2545f1){logger[_0x456c('0x27')](_0x2545f1[_0x456c('0x28')]);if(_0x2545f1[_0x456c('0x29')]){delete _0x2545f1['name'];}_0x1b3e75['status'](_0x4eb86b)[_0x456c('0x2a')](_0x2545f1);};}exports[_0x456c('0x2b')]=function(_0x53de3d,_0x4d3640){var _0x44ceed={},_0x3caabe={},_0x96b3d5={'count':0x0,'rows':[]};var _0x4a3b1c=_[_0x456c('0x2c')](db['ServicenowAccount'][_0x456c('0x2d')],function(_0x32f6f0){return{'name':_0x32f6f0['fieldName'],'type':_0x32f6f0['type'][_0x456c('0x2e')]};});_0x3caabe['model']=_[_0x456c('0x2c')](_0x4a3b1c,_0x456c('0x29'));_0x3caabe[_0x456c('0x2f')]=_[_0x456c('0x30')](_0x53de3d['query']);_0x3caabe['filters']=_['intersection'](_0x3caabe['model'],_0x3caabe['query']);_0x44ceed[_0x456c('0x31')]=_[_0x456c('0x32')](_0x3caabe['model'],qs['fields'](_0x53de3d['query'][_0x456c('0x33')]));_0x44ceed['attributes']=_0x44ceed['attributes']['length']?_0x44ceed['attributes']:_0x3caabe[_0x456c('0x34')];if(!_0x53de3d['query']['hasOwnProperty'](_0x456c('0x35'))){_0x44ceed['limit']=qs[_0x456c('0x1c')](_0x53de3d[_0x456c('0x2f')][_0x456c('0x1c')]);_0x44ceed[_0x456c('0x1e')]=qs[_0x456c('0x1e')](_0x53de3d[_0x456c('0x2f')]['offset']);}_0x44ceed[_0x456c('0x36')]=qs['sort'](_0x53de3d[_0x456c('0x2f')]['sort']);_0x44ceed[_0x456c('0x37')]=qs[_0x456c('0x38')](_[_0x456c('0x39')](_0x53de3d['query'],_0x3caabe[_0x456c('0x38')]),_0x4a3b1c);if(_0x53de3d[_0x456c('0x2f')][_0x456c('0x3a')]){_0x44ceed[_0x456c('0x37')]=_[_0x456c('0x3b')](_0x44ceed[_0x456c('0x37')],{'$or':_[_0x456c('0x2c')](_0x4a3b1c,function(_0x1434c2){if(_0x1434c2[_0x456c('0x3c')]!==_0x456c('0x3d')){var _0x3194ef={};_0x3194ef[_0x1434c2['name']]={'$like':'%'+_0x53de3d['query'][_0x456c('0x3a')]+'%'};return _0x3194ef;}})});}_0x44ceed=_[_0x456c('0x3b')]({},_0x44ceed,_0x53de3d[_0x456c('0x3e')]);var _0x154e9a={'where':_0x44ceed[_0x456c('0x37')]};return db[_0x456c('0x3f')][_0x456c('0x1d')](_0x154e9a)[_0x456c('0x24')](function(_0x74dbef){_0x96b3d5[_0x456c('0x1d')]=_0x74dbef;if(_0x53de3d[_0x456c('0x2f')][_0x456c('0x40')]){_0x44ceed['include']=[{'all':!![]}];}return db[_0x456c('0x3f')][_0x456c('0x41')](_0x44ceed);})[_0x456c('0x24')](function(_0x791bb){_0x96b3d5[_0x456c('0x42')]=_0x791bb;return _0x96b3d5;})[_0x456c('0x24')](respondWithFilteredResult(_0x4d3640,_0x44ceed))[_0x456c('0x43')](handleError(_0x4d3640,null));};exports[_0x456c('0x44')]=function(_0x2421d6,_0x4d0ac9){var _0x5f0557={'raw':![],'where':{'id':_0x2421d6[_0x456c('0x45')]['id']}},_0x233abc={};_0x233abc[_0x456c('0x34')]=_[_0x456c('0x30')](db[_0x456c('0x3f')][_0x456c('0x2d')]);_0x233abc[_0x456c('0x2f')]=_[_0x456c('0x30')](_0x2421d6[_0x456c('0x2f')]);_0x233abc[_0x456c('0x38')]=_[_0x456c('0x32')](_0x233abc['model'],_0x233abc[_0x456c('0x2f')]);_0x5f0557[_0x456c('0x31')]=_[_0x456c('0x32')](_0x233abc[_0x456c('0x34')],qs[_0x456c('0x33')](_0x2421d6[_0x456c('0x2f')][_0x456c('0x33')]));_0x5f0557[_0x456c('0x31')]=_0x5f0557[_0x456c('0x31')][_0x456c('0x46')]?_0x5f0557[_0x456c('0x31')]:_0x233abc[_0x456c('0x34')];if(_0x2421d6[_0x456c('0x2f')]['includeAll']){_0x5f0557[_0x456c('0x47')]=[{'all':!![]}];}_0x5f0557=_[_0x456c('0x3b')]({},_0x5f0557,_0x2421d6[_0x456c('0x3e')]);return db[_0x456c('0x3f')][_0x456c('0x48')](_0x5f0557)[_0x456c('0x24')](handleEntityNotFound(_0x4d0ac9,null))['then'](respondWithResult(_0x4d0ac9,null))['catch'](handleError(_0x4d0ac9,null));};exports['create']=function(_0x153507,_0x1c8c4e){return db['ServicenowAccount'][_0x456c('0x49')](_0x153507[_0x456c('0x4a')],{})['then'](respondWithResult(_0x1c8c4e,0xc9))[_0x456c('0x43')](handleError(_0x1c8c4e,null));};exports['update']=function(_0x4257f6,_0x2889d5){if(_0x4257f6[_0x456c('0x4a')]['id']){delete _0x4257f6[_0x456c('0x4a')]['id'];}return db[_0x456c('0x3f')]['find']({'where':{'id':_0x4257f6['params']['id']}})[_0x456c('0x24')](handleEntityNotFound(_0x2889d5,null))[_0x456c('0x24')](saveUpdates(_0x4257f6[_0x456c('0x4a')],null))[_0x456c('0x24')](respondWithResult(_0x2889d5,null))[_0x456c('0x43')](handleError(_0x2889d5,null));};exports[_0x456c('0x25')]=function(_0x2e7352,_0xf94e1d){return db[_0x456c('0x3f')][_0x456c('0x48')]({'where':{'id':_0x2e7352[_0x456c('0x45')]['id']}})[_0x456c('0x24')](handleEntityNotFound(_0xf94e1d,null))[_0x456c('0x24')](removeEntity(_0xf94e1d,null))[_0x456c('0x43')](handleError(_0xf94e1d,null));};exports['getConfigurations']=function(_0x895154,_0x253a55,_0x9fd659){var _0x5d1d44={};var _0x570c68={};var _0x3bde60;var _0x5d8f90;return db[_0x456c('0x3f')][_0x456c('0x4b')]({'where':{'id':_0x895154[_0x456c('0x45')]['id']}})[_0x456c('0x24')](handleEntityNotFound(_0x253a55,null))[_0x456c('0x24')](function(_0x46f453){if(_0x46f453){_0x3bde60=_0x46f453;_0x570c68[_0x456c('0x34')]=_['keys'](db[_0x456c('0x4c')][_0x456c('0x2d')]);_0x570c68[_0x456c('0x2f')]=_[_0x456c('0x30')](_0x895154['query']);_0x570c68[_0x456c('0x38')]=_[_0x456c('0x32')](_0x570c68[_0x456c('0x34')],_0x570c68[_0x456c('0x2f')]);_0x5d1d44[_0x456c('0x31')]=_[_0x456c('0x32')](_0x570c68[_0x456c('0x34')],qs[_0x456c('0x33')](_0x895154[_0x456c('0x2f')][_0x456c('0x33')]));_0x5d1d44[_0x456c('0x31')]=_0x5d1d44['attributes'][_0x456c('0x46')]?_0x5d1d44[_0x456c('0x31')]:_0x570c68['model'];_0x5d1d44[_0x456c('0x36')]=qs[_0x456c('0x4d')](_0x895154['query'][_0x456c('0x4d')]);_0x5d1d44['where']=qs[_0x456c('0x38')](_[_0x456c('0x39')](_0x895154['query'],_0x570c68[_0x456c('0x38')]));if(_0x895154[_0x456c('0x2f')][_0x456c('0x3a')]){_0x5d1d44['where']=_['merge'](_0x5d1d44[_0x456c('0x37')],{'$or':_['map'](_0x5d1d44[_0x456c('0x31')],function(_0x2a6cb){var _0x36ce49={};_0x36ce49[_0x2a6cb]={'$like':'%'+_0x895154[_0x456c('0x2f')]['filter']+'%'};return _0x36ce49;})});}_0x5d1d44=_['merge']({},_0x5d1d44,_0x895154[_0x456c('0x3e')]);return _0x3bde60[_0x456c('0x4e')](_0x5d1d44);}})[_0x456c('0x24')](function(_0x1d07e4){if(_0x1d07e4){_0x5d8f90=_0x1d07e4['length'];if(!_0x895154[_0x456c('0x2f')][_0x456c('0x4f')](_0x456c('0x35'))){_0x5d1d44[_0x456c('0x1c')]=qs['limit'](_0x895154['query'][_0x456c('0x1c')]);_0x5d1d44[_0x456c('0x1e')]=qs[_0x456c('0x1e')](_0x895154[_0x456c('0x2f')][_0x456c('0x1e')]);}return _0x3bde60[_0x456c('0x4e')](_0x5d1d44);}})['then'](function(_0x1869f2){if(_0x1869f2){return _0x1869f2?{'count':_0x5d8f90,'rows':_0x1869f2}:null;}})['then'](respondWithResult(_0x253a55,null))['catch'](handleError(_0x253a55,null));};exports[_0x456c('0x50')]=function(_0x460219,_0x36e601,_0x46b8e6){if(_0x460219[_0x456c('0x4a')]['id']){delete _0x460219[_0x456c('0x4a')]['id'];}return db[_0x456c('0x3f')]['findOne']({'where':{'id':_0x460219[_0x456c('0x45')]['id']}})['then'](handleEntityNotFound(_0x36e601,null))[_0x456c('0x24')](function(_0x10ac9f){if(_0x10ac9f){_0x460219[_0x456c('0x4a')][_0x456c('0x51')]=_0x10ac9f['id'];_0x460219[_0x456c('0x4a')][_0x456c('0x52')]=integrations[_0x456c('0x53')](_0x460219[_0x456c('0x4a')][_0x456c('0x54')],_0x460219['body'][_0x456c('0x3c')]);_0x460219[_0x456c('0x4a')][_0x456c('0x55')]=integrations[_0x456c('0x56')](_0x460219[_0x456c('0x4a')][_0x456c('0x54')],_0x460219[_0x456c('0x4a')]['type']);return db[_0x456c('0x4c')][_0x456c('0x49')](_0x460219['body'],{'include':[{'model':db['ServicenowField'],'as':_0x456c('0x52')},{'model':db[_0x456c('0x57')],'as':_0x456c('0x55')}]});}return null;})[_0x456c('0x24')](respondWithResult(_0x36e601,null))[_0x456c('0x43')](handleError(_0x36e601,null));};exports[_0x456c('0x58')]=function(_0x42bd9f,_0x2ca8ca,_0x8f1cfc){var _0x328c96=[_0x456c('0x59'),_0x456c('0x5a'),_0x456c('0x5b'),_0x456c('0x5c'),_0x456c('0x5d'),_0x456c('0x5e'),'incident_state',_0x456c('0x5f'),_0x456c('0x60')];var _0x522ae1=[_0x456c('0x61'),'made_sla',_0x456c('0x62'),'watch_list','upon_reject',_0x456c('0x63'),'child_incidents',_0x456c('0x5a'),'approval_history',_0x456c('0x64'),_0x456c('0x65'),_0x456c('0x66'),_0x456c('0x67'),_0x456c('0x68'),'sys_created_on',_0x456c('0x69'),_0x456c('0x6a'),_0x456c('0x6b'),_0x456c('0x5b'),_0x456c('0x36'),_0x456c('0x6c'),'closed_at',_0x456c('0x6d'),_0x456c('0x6e'),_0x456c('0x6f'),_0x456c('0x70'),_0x456c('0x71'),'business_service',_0x456c('0x72'),_0x456c('0x73'),_0x456c('0x74'),_0x456c('0x75'),_0x456c('0x76'),'opened_at',_0x456c('0x77'),_0x456c('0x78'),'work_end',_0x456c('0x79'),_0x456c('0x7a'),'caller_id',_0x456c('0x7b'),_0x456c('0x5c'),_0x456c('0x7c'),_0x456c('0x7d'),_0x456c('0x5d'),'correlation_display',_0x456c('0x7e'),'work_start',_0x456c('0x7f'),_0x456c('0x80'),_0x456c('0x81'),_0x456c('0x82'),_0x456c('0x83'),'notify',_0x456c('0x84'),'close_notes',_0x456c('0x85'),_0x456c('0x86'),_0x456c('0x87'),_0x456c('0x88'),_0x456c('0x89'),_0x456c('0x8a'),_0x456c('0x8b'),_0x456c('0x8c'),_0x456c('0x8d'),'company','reassignment_count',_0x456c('0x8e'),_0x456c('0x8f'),_0x456c('0x5f'),_0x456c('0x90'),_0x456c('0x91'),_0x456c('0x92'),_0x456c('0x93'),_0x456c('0x94'),_0x456c('0x95'),_0x456c('0x96'),_0x456c('0x97'),_0x456c('0x98'),_0x456c('0x99'),_0x456c('0x9a'),_0x456c('0x9b'),_0x456c('0x60')];var _0x223003='';var _0x11971d='';var _0x1e73e4=[];var _0x28b3df='';var _0x2379e2='';var _0x1e8a50=[];var _0x471c45='';var _0x30a43c='';var _0x1007a6={};var _0x14700b='';return db[_0x456c('0x3f')][_0x456c('0x4b')]({'where':{'id':_0x42bd9f[_0x456c('0x45')]['id']},'attributes':['id',_0x456c('0x9c'),_0x456c('0x9d'),_0x456c('0x9e'),_0x456c('0x9f'),_0x456c('0xa0')]})[_0x456c('0x24')](handleEntityNotFound(_0x2ca8ca,null))['then'](function(_0x44fc93){if(_0x44fc93){_0x14700b=_0x44fc93[_0x456c('0x9f')];var _0x27a26e=_0x14700b[_0x456c('0xa1')](-0x1);if(_0x27a26e==='/'){_0x14700b=_0x14700b[_0x456c('0xa2')](0x0,_0x14700b[_0x456c('0xa3')](_0x27a26e));}_0x30a43c=util[_0x456c('0xa4')](_0x456c('0xa5'),_0x14700b);_0x471c45=util[_0x456c('0xa4')](_0x456c('0xa6'),_0x14700b);_0x1007a6={'user':_0x44fc93['username'],'pass':_0x44fc93[_0x456c('0x9d')]};var _0x42cba3={'method':_0x456c('0xa7'),'uri':_0x30a43c+_0x456c('0xa8'),'auth':_0x1007a6,'json':!![]};return rp(_0x42cba3);}})['then'](function(_0x722946){if(_0x722946['result']['length']>0x0){_0x223003=_0x722946['result'];}console['log'](_0x456c('0xa9'),_0x223003);_0x1e8a50=[];_0x11971d=Object[_0x456c('0xaa')]([],_0x223003);_[_0x456c('0xab')](_0x11971d,function(_0x1dfb5c){return!_0x328c96[_0x456c('0xac')](_0x1dfb5c[_0x456c('0x29')]);});_0x11971d[_0x456c('0xad')](function(_0x4af1a9){var _0xf80978=createFieldObject(_0x471c45,_0x1007a6,_0x4af1a9[_0x456c('0xae')],_0x4af1a9['name'],_0x4af1a9[_0x456c('0xaf')],![]);_0x1e8a50[_0x456c('0xb0')](_0xf80978);});return Promise[_0x456c('0xb1')](_0x1e8a50);})[_0x456c('0x24')](function(_0x2683a4){_0x1e73e4=_0x2683a4;_0x28b3df=Object[_0x456c('0xaa')]([],_0x223003);console[_0x456c('0xb2')](_0x456c('0xb3'),_0x223003);_[_0x456c('0xab')](_0x28b3df,function(_0x529ff5){return _0x522ae1[_0x456c('0xac')](_0x529ff5[_0x456c('0x29')]);});console[_0x456c('0xb2')](_0x456c('0xb4'),_0x28b3df);_0x1e8a50=[];_0x28b3df['forEach'](function(_0x396400){var _0x8b333f=createFieldObject(_0x471c45,_0x1007a6,_0x396400[_0x456c('0xae')],_0x396400[_0x456c('0x29')],_0x396400[_0x456c('0xaf')],!![]);_0x1e8a50[_0x456c('0xb0')](_0x8b333f);});return Promise[_0x456c('0xb1')](_0x1e8a50);})[_0x456c('0x24')](function(_0x5d811e){_0x2379e2=_0x5d811e;var _0x27ac32=_0x1e73e4[_0x456c('0xb5')](_0x2379e2);return{'count':_0x27ac32['length'],'rows':_0x27ac32};})['then'](respondWithResult(_0x2ca8ca,null))[_0x456c('0x43')](function(_0x4c605e){console['log'](_0x456c('0xb6')+_0x4c605e);var _0x53d105=_0x42bd9f[_0x456c('0x2f')]['test']?0x1f4:_0x4c605e[_0x456c('0xb7')]||0x1f4;logger[_0x456c('0x27')](_0x4c605e['stack']);delete _0x4c605e['name'];if(_0x53d105===0x191){_0x53d105=0x190;}_0x2ca8ca[_0x456c('0x1a')](_0x53d105)[_0x456c('0x2a')](_0x42bd9f[_0x456c('0x2f')][_0x456c('0xb8')]?{'message':_0x456c('0xb9'),'statusCode':_0x4c605e[_0x456c('0xb7')]}:_0x4c605e);});};function createFieldObject(_0x43999e,_0x4766be,_0x450713,_0x10037e,_0x2c10ae,_0x54d7b6){return new Promise(function(_0x588463,_0xeda531){var _0x328a86={'id':_0x10037e,'name':_0x2c10ae,'custom':_0x54d7b6};if(_0x450713==='boolean'){_0x328a86[_0x456c('0x3e')]=[{'name':_0x456c('0xba'),'value':'true'},{'name':_0x456c('0xbb'),'value':_0x456c('0xbc')}];_0x588463(_0x328a86);}else{var _0x377565={'method':'GET','uri':_0x43999e+'sys_choice?sysparm_query=name=incident^element='+_0x10037e,'auth':_0x4766be,'json':!![]};return rp(_0x377565)[_0x456c('0x24')](function(_0x4cd90a){var _0x5c31d4=[];if(_0x4cd90a[_0x456c('0xbd')]['length']>0x0){_0x4cd90a[_0x456c('0xbd')][_0x456c('0xad')](function(_0x36aa9){if(_0x36aa9['inactive']===_0x456c('0xbc')){var _0x2cda27={'name':_0x36aa9[_0x456c('0xaf')],'value':_0x36aa9[_0x456c('0xbe')]};_0x5c31d4[_0x456c('0xb0')](_0x2cda27);}});}_0x328a86[_0x456c('0x3e')]=_0x5c31d4;if(_0x328a86['options'][_0x456c('0x46')]>0x0){_0x588463(_0x328a86);}else{if(_0x54d7b6==![]){_0x588463();}else{_0x588463(_0x328a86);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 51c1fcd..712b73f 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 _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x1177cc,_0x2aa606){var _0x113f89=function(_0x153fbf){while(--_0x153fbf){_0x1177cc['push'](_0x1177cc['shift']());}};_0x113f89(++_0x2aa606);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x3c7c06,_0x2d15f5){_0x3c7c06=_0x3c7c06-0x0;var _0x55d6ff=_0xdbf5[_0x3c7c06];return _0x55d6ff;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));var integrations=require(_0x5dbf('0x8'));module[_0x5dbf('0x9')]=function(_0x3f8222,_0x209b7d){return _0x3f8222[_0x5dbf('0xa')](_0x5dbf('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc97=['request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash','util','../../config/logger','moment'];(function(_0x213b9b,_0x2d2e08){var _0x44adf7=function(_0x4c59ca){while(--_0x4c59ca){_0x213b9b['push'](_0x213b9b['shift']());}};_0x44adf7(++_0x2d2e08);}(_0xdc97,0x13b));var _0x7dc9=function(_0x10484d,_0x339fbc){_0x10484d=_0x10484d-0x0;var _0x517771=_0xdc97[_0x10484d];return _0x517771;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));var integrations=require(_0x7dc9('0x8'));module[_0x7dc9('0x9')]=function(_0x589f02,_0x2636ef){return _0x589f02['define']('ServicenowAccount',attributes,{'tableName':_0x7dc9('0xa'),'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 7791f51..d28fbf5 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 _0xf612=['error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','options','attributes','limit','include','map','model','ShowServicenowAccount','raw','where','info','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s'];(function(_0x48025b,_0x2ea208){var _0x13c139=function(_0x309d8d){while(--_0x309d8d){_0x48025b['push'](_0x48025b['shift']());}};_0x13c139(++_0x2ea208);}(_0xf612,0x7f));var _0x2f61=function(_0x4c566c,_0x3df6b2){_0x4c566c=_0x4c566c-0x0;var _0x5510be=_0xf612[_0x4c566c];return _0x5510be;};'use strict';var _=require(_0x2f61('0x0'));var util=require(_0x2f61('0x1'));var moment=require(_0x2f61('0x2'));var BPromise=require(_0x2f61('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f61('0x4'));var db=require(_0x2f61('0x5'))['db'];var utils=require(_0x2f61('0x6'));var logger=require(_0x2f61('0x7'))(_0x2f61('0x8'));var config=require(_0x2f61('0x9'));var jayson=require(_0x2f61('0xa'));var client=jayson[_0x2f61('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fd024,_0x361cdd,_0x57dc63){return new BPromise(function(_0x3b4818,_0xc82cf8){return client[_0x2f61('0xc')](_0x4fd024,_0x57dc63)[_0x2f61('0xd')](function(_0x347b7b){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x361cdd,_0x2f61('0xe'));logger[_0x2f61('0xf')](_0x2f61('0x10'),_0x361cdd,_0x2f61('0xe'),JSON['stringify'](_0x347b7b));if(_0x347b7b['error']){if(_0x347b7b[_0x2f61('0x11')][_0x2f61('0x12')]===0x1f4){logger[_0x2f61('0x11')](_0x2f61('0x13'),_0x361cdd,_0x347b7b['error']['message']);return _0xc82cf8(_0x347b7b['error'][_0x2f61('0x14')]);}logger[_0x2f61('0x11')](_0x2f61('0x13'),_0x361cdd,_0x347b7b[_0x2f61('0x11')][_0x2f61('0x14')]);return _0x3b4818(_0x347b7b['error'][_0x2f61('0x14')]);}else{logger['info'](_0x2f61('0x13'),_0x361cdd,_0x2f61('0xe'));_0x3b4818(_0x347b7b[_0x2f61('0x15')][_0x2f61('0x14')]);}})[_0x2f61('0x16')](function(_0x44e6f1){logger[_0x2f61('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x361cdd,_0x44e6f1);_0xc82cf8(_0x44e6f1);});});}exports[_0x2f61('0x17')]=function(_0x5e3c20){var _0x461b67=this;return new Promise(function(_0x384a79,_0x528c8c){return db[_0x2f61('0x18')]['findAll']({'raw':_0x5e3c20[_0x2f61('0x19')]?_0x5e3c20[_0x2f61('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5e3c20[_0x2f61('0x19')]?_0x5e3c20[_0x2f61('0x19')]['where']||null:null,'attributes':_0x5e3c20[_0x2f61('0x19')]?_0x5e3c20[_0x2f61('0x19')][_0x2f61('0x1a')]||null:null,'limit':_0x5e3c20[_0x2f61('0x19')]?_0x5e3c20['options'][_0x2f61('0x1b')]||null:null,'include':_0x5e3c20[_0x2f61('0x19')]?_0x5e3c20['options'][_0x2f61('0x1c')]?_[_0x2f61('0x1d')](_0x5e3c20['options'][_0x2f61('0x1c')],function(_0x439873){return{'model':db[_0x439873['model']],'as':_0x439873['as'],'attributes':_0x439873[_0x2f61('0x1a')],'include':_0x439873[_0x2f61('0x1c')]?_[_0x2f61('0x1d')](_0x439873['include'],function(_0x3281ec){return{'model':db[_0x3281ec[_0x2f61('0x1e')]],'as':_0x3281ec['as'],'attributes':_0x3281ec[_0x2f61('0x1a')],'include':_0x3281ec[_0x2f61('0x1c')]?_['map'](_0x3281ec['include'],function(_0x314c40){return{'model':db[_0x314c40[_0x2f61('0x1e')]],'as':_0x314c40['as'],'attributes':_0x314c40[_0x2f61('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48cb03){logger['info'](_0x2f61('0x17'),_0x5e3c20);logger['debug'](_0x2f61('0x17'),_0x5e3c20,JSON['stringify'](_0x48cb03));_0x384a79(_0x48cb03);})['catch'](function(_0x151da0){logger['error'](_0x2f61('0x17'),_0x151da0['message'],_0x5e3c20);_0x528c8c(_0x461b67['error'](0x1f4,_0x151da0['message']));});});};exports[_0x2f61('0x1f')]=function(_0xb15460){var _0x1d9417=this;return new Promise(function(_0x55a3e1,_0x5a16b6){return db[_0x2f61('0x18')]['find']({'raw':_0xb15460['options']?_0xb15460[_0x2f61('0x19')][_0x2f61('0x20')]===undefined?!![]:![]:!![],'where':_0xb15460[_0x2f61('0x19')]?_0xb15460[_0x2f61('0x19')][_0x2f61('0x21')]||null:null,'attributes':_0xb15460['options']?_0xb15460[_0x2f61('0x19')][_0x2f61('0x1a')]||null:null,'include':_0xb15460[_0x2f61('0x19')]?_0xb15460[_0x2f61('0x19')]['include']?_['map'](_0xb15460[_0x2f61('0x19')]['include'],function(_0x1608b1){return{'model':db[_0x1608b1[_0x2f61('0x1e')]],'as':_0x1608b1['as'],'attributes':_0x1608b1[_0x2f61('0x1a')],'include':_0x1608b1[_0x2f61('0x1c')]?_[_0x2f61('0x1d')](_0x1608b1[_0x2f61('0x1c')],function(_0x4cb4cd){return{'model':db[_0x4cb4cd[_0x2f61('0x1e')]],'as':_0x4cb4cd['as'],'attributes':_0x4cb4cd['attributes'],'include':_0x4cb4cd[_0x2f61('0x1c')]?_[_0x2f61('0x1d')](_0x4cb4cd['include'],function(_0x5d3a7f){return{'model':db[_0x5d3a7f[_0x2f61('0x1e')]],'as':_0x5d3a7f['as'],'attributes':_0x5d3a7f[_0x2f61('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2f61('0xd')](function(_0x4d6c19){logger[_0x2f61('0x22')]('ShowServicenowAccount',_0xb15460);logger[_0x2f61('0xf')](_0x2f61('0x1f'),_0xb15460,JSON[_0x2f61('0x23')](_0x4d6c19));_0x55a3e1(_0x4d6c19);})[_0x2f61('0x16')](function(_0x18911d){logger[_0x2f61('0x11')](_0x2f61('0x1f'),_0x18911d[_0x2f61('0x14')],_0xb15460);_0x5a16b6(_0x1d9417[_0x2f61('0x11')](0x1f4,_0x18911d[_0x2f61('0x14')]));});});}; \ No newline at end of file +var _0x4599=['limit','include','map','model','then','info','stringify','ShowServicenowAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x4599,0x131));var _0x9459=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4599[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9459('0x0'));var util=require(_0x9459('0x1'));var moment=require(_0x9459('0x2'));var BPromise=require(_0x9459('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9459('0x4'));var db=require(_0x9459('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9459('0x6'));var config=require(_0x9459('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9459('0x8')][_0x9459('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c4919,_0x30070b,_0x16f866){return new BPromise(function(_0x4ab026,_0x3b22ca){return client['request'](_0x5c4919,_0x16f866)['then'](function(_0x881dc8){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x30070b,'request\x20sent');logger['debug'](_0x9459('0xa'),_0x30070b,_0x9459('0xb'),JSON['stringify'](_0x881dc8));if(_0x881dc8[_0x9459('0xc')]){if(_0x881dc8[_0x9459('0xc')][_0x9459('0xd')]===0x1f4){logger[_0x9459('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x30070b,_0x881dc8[_0x9459('0xc')][_0x9459('0xe')]);return _0x3b22ca(_0x881dc8[_0x9459('0xc')]['message']);}logger[_0x9459('0xc')](_0x9459('0xf'),_0x30070b,_0x881dc8[_0x9459('0xc')][_0x9459('0xe')]);return _0x4ab026(_0x881dc8['error'][_0x9459('0xe')]);}else{logger['info'](_0x9459('0xf'),_0x30070b,'request\x20sent');_0x4ab026(_0x881dc8[_0x9459('0x10')][_0x9459('0xe')]);}})[_0x9459('0x11')](function(_0x371080){logger[_0x9459('0xc')](_0x9459('0xf'),_0x30070b,_0x371080);_0x3b22ca(_0x371080);});});}exports[_0x9459('0x12')]=function(_0x23dd5f){var _0x4f650d=this;return new Promise(function(_0x5ac698,_0x1c5797){return db[_0x9459('0x13')][_0x9459('0x14')]({'raw':_0x23dd5f[_0x9459('0x15')]?_0x23dd5f[_0x9459('0x15')][_0x9459('0x16')]===undefined?!![]:![]:!![],'where':_0x23dd5f[_0x9459('0x15')]?_0x23dd5f['options'][_0x9459('0x17')]||null:null,'attributes':_0x23dd5f[_0x9459('0x15')]?_0x23dd5f['options'][_0x9459('0x18')]||null:null,'limit':_0x23dd5f[_0x9459('0x15')]?_0x23dd5f[_0x9459('0x15')][_0x9459('0x19')]||null:null,'include':_0x23dd5f['options']?_0x23dd5f[_0x9459('0x15')][_0x9459('0x1a')]?_[_0x9459('0x1b')](_0x23dd5f[_0x9459('0x15')][_0x9459('0x1a')],function(_0x40b9e3){return{'model':db[_0x40b9e3[_0x9459('0x1c')]],'as':_0x40b9e3['as'],'attributes':_0x40b9e3[_0x9459('0x18')],'include':_0x40b9e3[_0x9459('0x1a')]?_['map'](_0x40b9e3[_0x9459('0x1a')],function(_0x34e7d4){return{'model':db[_0x34e7d4[_0x9459('0x1c')]],'as':_0x34e7d4['as'],'attributes':_0x34e7d4[_0x9459('0x18')],'include':_0x34e7d4['include']?_[_0x9459('0x1b')](_0x34e7d4[_0x9459('0x1a')],function(_0x2e319e){return{'model':db[_0x2e319e[_0x9459('0x1c')]],'as':_0x2e319e['as'],'attributes':_0x2e319e['attributes']};}):[]};}):[]};}):[]:[]})[_0x9459('0x1d')](function(_0x21c161){logger[_0x9459('0x1e')](_0x9459('0x12'),_0x23dd5f);logger['debug'](_0x9459('0x12'),_0x23dd5f,JSON[_0x9459('0x1f')](_0x21c161));_0x5ac698(_0x21c161);})[_0x9459('0x11')](function(_0xa123f3){logger['error']('GetServicenowAccount',_0xa123f3[_0x9459('0xe')],_0x23dd5f);_0x1c5797(_0x4f650d[_0x9459('0xc')](0x1f4,_0xa123f3['message']));});});};exports[_0x9459('0x20')]=function(_0x1e2a9e){var _0x96d4be=this;return new Promise(function(_0x13d151,_0x1f5e35){return db['ServicenowAccount']['find']({'raw':_0x1e2a9e['options']?_0x1e2a9e[_0x9459('0x15')][_0x9459('0x16')]===undefined?!![]:![]:!![],'where':_0x1e2a9e[_0x9459('0x15')]?_0x1e2a9e['options'][_0x9459('0x17')]||null:null,'attributes':_0x1e2a9e['options']?_0x1e2a9e['options']['attributes']||null:null,'include':_0x1e2a9e[_0x9459('0x15')]?_0x1e2a9e[_0x9459('0x15')][_0x9459('0x1a')]?_[_0x9459('0x1b')](_0x1e2a9e[_0x9459('0x15')]['include'],function(_0x105715){return{'model':db[_0x105715[_0x9459('0x1c')]],'as':_0x105715['as'],'attributes':_0x105715[_0x9459('0x18')],'include':_0x105715[_0x9459('0x1a')]?_['map'](_0x105715['include'],function(_0x40d7f2){return{'model':db[_0x40d7f2[_0x9459('0x1c')]],'as':_0x40d7f2['as'],'attributes':_0x40d7f2['attributes'],'include':_0x40d7f2['include']?_['map'](_0x40d7f2['include'],function(_0x1f54a1){return{'model':db[_0x1f54a1[_0x9459('0x1c')]],'as':_0x1f54a1['as'],'attributes':_0x1f54a1[_0x9459('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9459('0x1d')](function(_0x51ac53){logger['info'](_0x9459('0x20'),_0x1e2a9e);logger['debug'](_0x9459('0x20'),_0x1e2a9e,JSON[_0x9459('0x1f')](_0x51ac53));_0x13d151(_0x51ac53);})[_0x9459('0x11')](function(_0x54107f){logger[_0x9459('0xc')](_0x9459('0x20'),_0x54107f[_0x9459('0xe')],_0x1e2a9e);_0x1f5e35(_0x96d4be[_0x9459('0xc')](0x1f4,_0x54107f[_0x9459('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index aea6262..018e629 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 _0xa94d=['connect-timeout','express','fs-extra','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2edea8,_0x56b134){var _0x98d4=function(_0x10c36c){while(--_0x10c36c){_0x2edea8['push'](_0x2edea8['shift']());}};_0x98d4(++_0x56b134);}(_0xa94d,0x11c));var _0xda94=function(_0x12c522,_0x3e539a){_0x12c522=_0x12c522-0x0;var _0x502f91=_0xa94d[_0x12c522];return _0x502f91;};'use strict';var multer=require(_0xda94('0x0'));var util=require(_0xda94('0x1'));var path=require('path');var timeout=require(_0xda94('0x2'));var express=require(_0xda94('0x3'));var router=express['Router']();var fs_extra=require(_0xda94('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xda94('0x5'));var controller=require(_0xda94('0x6'));router['get']('/',auth[_0xda94('0x7')](),controller[_0xda94('0x8')]);router[_0xda94('0x9')](_0xda94('0xa'),auth[_0xda94('0x7')](),controller['show']);router[_0xda94('0x9')](_0xda94('0xb'),auth[_0xda94('0x7')](),controller[_0xda94('0xc')]);router['get'](_0xda94('0xd'),auth[_0xda94('0x7')](),controller['getSubjects']);router[_0xda94('0x9')](_0xda94('0xe'),auth[_0xda94('0x7')](),controller[_0xda94('0xf')]);router['post']('/',auth[_0xda94('0x7')](),controller[_0xda94('0x10')]);router[_0xda94('0x11')](_0xda94('0xa'),auth[_0xda94('0x7')](),controller[_0xda94('0x12')]);router[_0xda94('0x13')]('/:id',auth[_0xda94('0x7')](),controller[_0xda94('0x14')]);module[_0xda94('0x15')]=router; \ No newline at end of file +var _0xe67a=['fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x52b395,_0x1afa64){var _0x55d9d4=function(_0x35614d){while(--_0x35614d){_0x52b395['push'](_0x52b395['shift']());}};_0x55d9d4(++_0x1afa64);}(_0xe67a,0x1ab));var _0xae67=function(_0x328962,_0x504707){_0x328962=_0x328962-0x0;var _0x19797f=_0xe67a[_0x328962];return _0x19797f;};'use strict';var multer=require(_0xae67('0x0'));var util=require(_0xae67('0x1'));var path=require(_0xae67('0x2'));var timeout=require(_0xae67('0x3'));var express=require(_0xae67('0x4'));var router=express['Router']();var fs_extra=require(_0xae67('0x5'));var auth=require(_0xae67('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae67('0x7'));var controller=require(_0xae67('0x8'));router[_0xae67('0x9')]('/',auth[_0xae67('0xa')](),controller[_0xae67('0xb')]);router['get'](_0xae67('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xae67('0x9')](_0xae67('0xd'),auth[_0xae67('0xa')](),controller[_0xae67('0xe')]);router[_0xae67('0x9')](_0xae67('0xf'),auth[_0xae67('0xa')](),controller['getSubjects']);router[_0xae67('0x9')](_0xae67('0x10'),auth['isAuthenticated'](),controller[_0xae67('0x11')]);router[_0xae67('0x12')]('/',auth[_0xae67('0xa')](),controller[_0xae67('0x13')]);router[_0xae67('0x14')]('/:id',auth[_0xae67('0xa')](),controller[_0xae67('0x15')]);router[_0xae67('0x16')](_0xae67('0xc'),auth[_0xae67('0xa')](),controller['destroy']);module[_0xae67('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 10e6cc4..96a0dc2 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 _0x2038=['sequelize','STRING'];(function(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0x2038,0x1f2));var _0x8203=function(_0x56e8d0,_0x5ba958){_0x56e8d0=_0x56e8d0-0x0;var _0x254c2c=_0x2038[_0x56e8d0];return _0x254c2c;};'use strict';var Sequelize=require(_0x8203('0x0'));module['exports']={'name':{'type':Sequelize[_0x8203('0x1')]},'description':{'type':Sequelize[_0x8203('0x1')]}}; \ No newline at end of file +var _0xfd55=['STRING','exports'];(function(_0xccf946,_0x379ed9){var _0x5c9254=function(_0x248784){while(--_0x248784){_0xccf946['push'](_0xccf946['shift']());}};_0x5c9254(++_0x379ed9);}(_0xfd55,0x9d));var _0x5fd5=function(_0x48cc31,_0x5aa6e9){_0x48cc31=_0x48cc31-0x0;var _0x2f45e8=_0xfd55[_0x48cc31];return _0x2f45e8;};'use strict';var Sequelize=require('sequelize');module[_0x5fd5('0x0')]={'name':{'type':Sequelize[_0x5fd5('0x1')]},'description':{'type':Sequelize[_0x5fd5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index dd0c673..e88222b 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 _0xf767=['type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','update','body','getFields','findOne','order','pick','getSubjects','ServicenowField','hasOwnProperty','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName'];(function(_0x577e9a,_0x556ee7){var _0x49d606=function(_0x2e9202){while(--_0x2e9202){_0x577e9a['push'](_0x577e9a['shift']());}};_0x49d606(++_0x556ee7);}(_0xf767,0x16f));var _0x7f76=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0xf767[_0x49c057];return _0xd8f0e6;};'use strict';var emlformat=require(_0x7f76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7f76('0x1'));var jsonpatch=require(_0x7f76('0x2'));var rp=require(_0x7f76('0x3'));var moment=require(_0x7f76('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7f76('0x5'));var util=require(_0x7f76('0x6'));var path=require(_0x7f76('0x7'));var sox=require(_0x7f76('0x8'));var csv=require(_0x7f76('0x9'));var ejs=require(_0x7f76('0xa'));var fs=require('fs');var fs_extra=require(_0x7f76('0xb'));var _=require('lodash');var squel=require(_0x7f76('0xc'));var crypto=require('crypto');var jsforce=require(_0x7f76('0xd'));var deskjs=require(_0x7f76('0xe'));var toCsv=require(_0x7f76('0x9'));var querystring=require(_0x7f76('0xf'));var Papa=require(_0x7f76('0x10'));var Redis=require(_0x7f76('0x11'));var authService=require(_0x7f76('0x12'));var qs=require(_0x7f76('0x13'));var as=require(_0x7f76('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7f76('0x15'));var utils=require(_0x7f76('0x16'));var config=require(_0x7f76('0x17'));var licenseUtil=require(_0x7f76('0x18'));var db=require(_0x7f76('0x19'))['db'];function respondWithStatusCode(_0x4d05a7,_0x2299aa){_0x2299aa=_0x2299aa||0xcc;return function(_0x7e8e3a){if(_0x7e8e3a){return _0x4d05a7['sendStatus'](_0x2299aa);}return _0x4d05a7[_0x7f76('0x1a')](_0x2299aa)[_0x7f76('0x1b')]();};}function respondWithResult(_0x55dee6,_0x59da02){_0x59da02=_0x59da02||0xc8;return function(_0x21762d){if(_0x21762d){return _0x55dee6[_0x7f76('0x1a')](_0x59da02)['json'](_0x21762d);}};}function respondWithFilteredResult(_0x66e8eb,_0x44bc78){return function(_0x14e61d){if(_0x14e61d){var _0x7bb53c=typeof _0x44bc78[_0x7f76('0x1c')]==='undefined'&&typeof _0x44bc78[_0x7f76('0x1d')]===_0x7f76('0x1e');var _0x57cb6b=_0x14e61d[_0x7f76('0x1f')];var _0x616b2b=_0x7bb53c?0x0:_0x44bc78[_0x7f76('0x1c')];var _0x4e1b47=_0x7bb53c?_0x14e61d[_0x7f76('0x1f')]:_0x44bc78[_0x7f76('0x1c')]+_0x44bc78['limit'];var _0x20468f;if(_0x4e1b47>=_0x57cb6b){_0x4e1b47=_0x57cb6b;_0x20468f=0xc8;}else{_0x20468f=0xce;}_0x66e8eb[_0x7f76('0x1a')](_0x20468f);return _0x66e8eb['set'](_0x7f76('0x20'),_0x616b2b+'-'+_0x4e1b47+'/'+_0x57cb6b)[_0x7f76('0x21')](_0x14e61d);}return null;};}function patchUpdates(_0x3601ae){return function(_0xe1e774){try{jsonpatch[_0x7f76('0x22')](_0xe1e774,_0x3601ae,!![]);}catch(_0x399f1a){return BPromise[_0x7f76('0x23')](_0x399f1a);}return _0xe1e774[_0x7f76('0x24')]();};}function saveUpdates(_0x48df84,_0x20b7f4){return function(_0x5d6d5c){if(_0x5d6d5c){return _0x5d6d5c['update'](_0x48df84)[_0x7f76('0x25')](function(_0x337c28){return _0x337c28;});}return null;};}function removeEntity(_0x4a6977,_0x17c032){return function(_0x582de3){if(_0x582de3){return _0x582de3[_0x7f76('0x26')]()['then'](function(){_0x4a6977['status'](0xcc)[_0x7f76('0x1b')]();});}};}function handleEntityNotFound(_0x8bf88f,_0x43d7f0){return function(_0x583574){if(!_0x583574){_0x8bf88f[_0x7f76('0x27')](0x194);}return _0x583574;};}function handleError(_0x15486b,_0x16b3a5){_0x16b3a5=_0x16b3a5||0x1f4;return function(_0x3ef6b4){logger[_0x7f76('0x28')](_0x3ef6b4['stack']);if(_0x3ef6b4[_0x7f76('0x29')]){delete _0x3ef6b4[_0x7f76('0x29')];}_0x15486b[_0x7f76('0x1a')](_0x16b3a5)[_0x7f76('0x2a')](_0x3ef6b4);};}exports[_0x7f76('0x2b')]=function(_0xcad2c7,_0x4b9289){var _0x26a3e6={},_0x56d07b={},_0x34ea8b={'count':0x0,'rows':[]};var _0x1af606=_[_0x7f76('0x2c')](db[_0x7f76('0x2d')][_0x7f76('0x2e')],function(_0x302351){return{'name':_0x302351[_0x7f76('0x2f')],'type':_0x302351[_0x7f76('0x30')][_0x7f76('0x31')]};});_0x56d07b[_0x7f76('0x32')]=_[_0x7f76('0x2c')](_0x1af606,'name');_0x56d07b[_0x7f76('0x33')]=_[_0x7f76('0x34')](_0xcad2c7[_0x7f76('0x33')]);_0x56d07b[_0x7f76('0x35')]=_[_0x7f76('0x36')](_0x56d07b[_0x7f76('0x32')],_0x56d07b[_0x7f76('0x33')]);_0x26a3e6[_0x7f76('0x37')]=_['intersection'](_0x56d07b[_0x7f76('0x32')],qs['fields'](_0xcad2c7[_0x7f76('0x33')][_0x7f76('0x38')]));_0x26a3e6[_0x7f76('0x37')]=_0x26a3e6[_0x7f76('0x37')][_0x7f76('0x39')]?_0x26a3e6[_0x7f76('0x37')]:_0x56d07b[_0x7f76('0x32')];if(!_0xcad2c7[_0x7f76('0x33')]['hasOwnProperty'](_0x7f76('0x3a'))){_0x26a3e6[_0x7f76('0x1d')]=qs[_0x7f76('0x1d')](_0xcad2c7[_0x7f76('0x33')][_0x7f76('0x1d')]);_0x26a3e6[_0x7f76('0x1c')]=qs['offset'](_0xcad2c7[_0x7f76('0x33')]['offset']);}_0x26a3e6['order']=qs[_0x7f76('0x3b')](_0xcad2c7[_0x7f76('0x33')]['sort']);_0x26a3e6[_0x7f76('0x3c')]=qs[_0x7f76('0x35')](_['pick'](_0xcad2c7[_0x7f76('0x33')],_0x56d07b['filters']),_0x1af606);if(_0xcad2c7[_0x7f76('0x33')][_0x7f76('0x3d')]){_0x26a3e6['where']=_[_0x7f76('0x3e')](_0x26a3e6[_0x7f76('0x3c')],{'$or':_[_0x7f76('0x2c')](_0x1af606,function(_0x4b974e){if(_0x4b974e[_0x7f76('0x30')]!==_0x7f76('0x3f')){var _0x54c9d4={};_0x54c9d4[_0x4b974e[_0x7f76('0x29')]]={'$like':'%'+_0xcad2c7[_0x7f76('0x33')][_0x7f76('0x3d')]+'%'};return _0x54c9d4;}})});}_0x26a3e6=_['merge']({},_0x26a3e6,_0xcad2c7[_0x7f76('0x40')]);var _0x270bb6={'where':_0x26a3e6[_0x7f76('0x3c')]};return db[_0x7f76('0x2d')][_0x7f76('0x1f')](_0x270bb6)[_0x7f76('0x25')](function(_0x23b7b9){_0x34ea8b['count']=_0x23b7b9;if(_0xcad2c7[_0x7f76('0x33')][_0x7f76('0x41')]){_0x26a3e6[_0x7f76('0x42')]=[{'all':!![]}];}return db[_0x7f76('0x2d')][_0x7f76('0x43')](_0x26a3e6);})[_0x7f76('0x25')](function(_0x43ee64){_0x34ea8b[_0x7f76('0x44')]=_0x43ee64;return _0x34ea8b;})[_0x7f76('0x25')](respondWithFilteredResult(_0x4b9289,_0x26a3e6))[_0x7f76('0x45')](handleError(_0x4b9289,null));};exports['show']=function(_0x49df0d,_0x2507e1){var _0x4896d1={'raw':![],'where':{'id':_0x49df0d[_0x7f76('0x46')]['id']}},_0x52dad1={};_0x52dad1[_0x7f76('0x32')]=_['keys'](db[_0x7f76('0x2d')]['rawAttributes']);_0x52dad1['query']=_['keys'](_0x49df0d[_0x7f76('0x33')]);_0x52dad1[_0x7f76('0x35')]=_[_0x7f76('0x36')](_0x52dad1[_0x7f76('0x32')],_0x52dad1[_0x7f76('0x33')]);_0x4896d1[_0x7f76('0x37')]=_[_0x7f76('0x36')](_0x52dad1[_0x7f76('0x32')],qs[_0x7f76('0x38')](_0x49df0d[_0x7f76('0x33')][_0x7f76('0x38')]));_0x4896d1[_0x7f76('0x37')]=_0x4896d1['attributes']['length']?_0x4896d1[_0x7f76('0x37')]:_0x52dad1[_0x7f76('0x32')];if(_0x49df0d[_0x7f76('0x33')][_0x7f76('0x41')]){_0x4896d1[_0x7f76('0x42')]=[{'all':!![]}];}_0x4896d1=_[_0x7f76('0x3e')]({},_0x4896d1,_0x49df0d[_0x7f76('0x40')]);return db[_0x7f76('0x2d')][_0x7f76('0x47')](_0x4896d1)[_0x7f76('0x25')](handleEntityNotFound(_0x2507e1,null))[_0x7f76('0x25')](respondWithResult(_0x2507e1,null))[_0x7f76('0x45')](handleError(_0x2507e1,null));};exports[_0x7f76('0x48')]=function(_0x6efdc7,_0xe37d80){return db[_0x7f76('0x2d')][_0x7f76('0x48')](_0x6efdc7['body'],{})[_0x7f76('0x25')](respondWithResult(_0xe37d80,0xc9))[_0x7f76('0x45')](handleError(_0xe37d80,null));};exports[_0x7f76('0x49')]=function(_0x23282d,_0x7836af){if(_0x23282d[_0x7f76('0x4a')]['id']){delete _0x23282d[_0x7f76('0x4a')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x23282d['params']['id']}})['then'](handleEntityNotFound(_0x7836af,null))[_0x7f76('0x25')](saveUpdates(_0x23282d[_0x7f76('0x4a')],null))[_0x7f76('0x25')](respondWithResult(_0x7836af,null))[_0x7f76('0x45')](handleError(_0x7836af,null));};exports[_0x7f76('0x26')]=function(_0xe69fb7,_0x8d6503){return db[_0x7f76('0x2d')][_0x7f76('0x47')]({'where':{'id':_0xe69fb7[_0x7f76('0x46')]['id']}})[_0x7f76('0x25')](handleEntityNotFound(_0x8d6503,null))[_0x7f76('0x25')](removeEntity(_0x8d6503,null))[_0x7f76('0x45')](handleError(_0x8d6503,null));};exports[_0x7f76('0x4b')]=function(_0x3ca6b1,_0x18a6f9,_0x1468f7){var _0x25cf0={};var _0x1a851d={};var _0x1a9626;var _0xb91214;return db['ServicenowConfiguration'][_0x7f76('0x4c')]({'where':{'id':_0x3ca6b1[_0x7f76('0x46')]['id']}})[_0x7f76('0x25')](handleEntityNotFound(_0x18a6f9,null))[_0x7f76('0x25')](function(_0x1ba647){if(_0x1ba647){_0x1a9626=_0x1ba647;_0x1a851d[_0x7f76('0x32')]=_['keys'](db['ServicenowField'][_0x7f76('0x2e')]);_0x1a851d[_0x7f76('0x33')]=_['keys'](_0x3ca6b1[_0x7f76('0x33')]);_0x1a851d['filters']=_['intersection'](_0x1a851d['model'],_0x1a851d[_0x7f76('0x33')]);_0x25cf0[_0x7f76('0x37')]=_[_0x7f76('0x36')](_0x1a851d[_0x7f76('0x32')],qs[_0x7f76('0x38')](_0x3ca6b1[_0x7f76('0x33')]['fields']));_0x25cf0[_0x7f76('0x37')]=_0x25cf0['attributes'][_0x7f76('0x39')]?_0x25cf0[_0x7f76('0x37')]:_0x1a851d['model'];_0x25cf0[_0x7f76('0x4d')]=qs[_0x7f76('0x3b')](_0x3ca6b1[_0x7f76('0x33')][_0x7f76('0x3b')]);_0x25cf0[_0x7f76('0x3c')]=qs['filters'](_[_0x7f76('0x4e')](_0x3ca6b1[_0x7f76('0x33')],_0x1a851d['filters']));if(_0x3ca6b1[_0x7f76('0x33')][_0x7f76('0x3d')]){_0x25cf0['where']=_['merge'](_0x25cf0[_0x7f76('0x3c')],{'$or':_['map'](_0x25cf0[_0x7f76('0x37')],function(_0x491de6){var _0x29b38b={};_0x29b38b[_0x491de6]={'$like':'%'+_0x3ca6b1[_0x7f76('0x33')]['filter']+'%'};return _0x29b38b;})});}_0x25cf0=_['merge']({},_0x25cf0,_0x3ca6b1[_0x7f76('0x40')]);return _0x1a9626['getFields'](_0x25cf0);}})[_0x7f76('0x25')](function(_0x582701){if(_0x582701){_0xb91214=_0x582701[_0x7f76('0x39')];if(!_0x3ca6b1[_0x7f76('0x33')]['hasOwnProperty'](_0x7f76('0x3a'))){_0x25cf0['limit']=qs[_0x7f76('0x1d')](_0x3ca6b1['query'][_0x7f76('0x1d')]);_0x25cf0[_0x7f76('0x1c')]=qs['offset'](_0x3ca6b1[_0x7f76('0x33')][_0x7f76('0x1c')]);}return _0x1a9626['getFields'](_0x25cf0);}})['then'](function(_0x5b54a0){if(_0x5b54a0){return _0x5b54a0?{'count':_0xb91214,'rows':_0x5b54a0}:null;}})['then'](respondWithResult(_0x18a6f9,null))[_0x7f76('0x45')](handleError(_0x18a6f9,null));};exports[_0x7f76('0x4f')]=function(_0x3fbfd8,_0x539256,_0x2fe695){var _0x32b0b3={};var _0x37bfc3={};var _0x52200c;var _0x45ef7a;return db[_0x7f76('0x2d')][_0x7f76('0x4c')]({'where':{'id':_0x3fbfd8[_0x7f76('0x46')]['id']}})[_0x7f76('0x25')](handleEntityNotFound(_0x539256,null))[_0x7f76('0x25')](function(_0x17c328){if(_0x17c328){_0x52200c=_0x17c328;_0x37bfc3[_0x7f76('0x32')]=_[_0x7f76('0x34')](db[_0x7f76('0x50')][_0x7f76('0x2e')]);_0x37bfc3[_0x7f76('0x33')]=_[_0x7f76('0x34')](_0x3fbfd8[_0x7f76('0x33')]);_0x37bfc3[_0x7f76('0x35')]=_[_0x7f76('0x36')](_0x37bfc3['model'],_0x37bfc3[_0x7f76('0x33')]);_0x32b0b3['attributes']=_['intersection'](_0x37bfc3['model'],qs[_0x7f76('0x38')](_0x3fbfd8[_0x7f76('0x33')][_0x7f76('0x38')]));_0x32b0b3[_0x7f76('0x37')]=_0x32b0b3[_0x7f76('0x37')][_0x7f76('0x39')]?_0x32b0b3[_0x7f76('0x37')]:_0x37bfc3[_0x7f76('0x32')];_0x32b0b3['order']=qs['sort'](_0x3fbfd8[_0x7f76('0x33')]['sort']);_0x32b0b3['where']=qs['filters'](_[_0x7f76('0x4e')](_0x3fbfd8[_0x7f76('0x33')],_0x37bfc3['filters']));if(_0x3fbfd8['query'][_0x7f76('0x3d')]){_0x32b0b3[_0x7f76('0x3c')]=_[_0x7f76('0x3e')](_0x32b0b3[_0x7f76('0x3c')],{'$or':_['map'](_0x32b0b3['attributes'],function(_0x118fef){var _0x4a0e79={};_0x4a0e79[_0x118fef]={'$like':'%'+_0x3fbfd8['query']['filter']+'%'};return _0x4a0e79;})});}_0x32b0b3=_[_0x7f76('0x3e')]({},_0x32b0b3,_0x3fbfd8['options']);return _0x52200c[_0x7f76('0x4f')](_0x32b0b3);}})[_0x7f76('0x25')](function(_0x281848){if(_0x281848){_0x45ef7a=_0x281848[_0x7f76('0x39')];if(!_0x3fbfd8[_0x7f76('0x33')][_0x7f76('0x51')]('nolimit')){_0x32b0b3[_0x7f76('0x1d')]=qs[_0x7f76('0x1d')](_0x3fbfd8[_0x7f76('0x33')]['limit']);_0x32b0b3[_0x7f76('0x1c')]=qs[_0x7f76('0x1c')](_0x3fbfd8[_0x7f76('0x33')]['offset']);}return _0x52200c[_0x7f76('0x4f')](_0x32b0b3);}})[_0x7f76('0x25')](function(_0x3e9a8f){if(_0x3e9a8f){return _0x3e9a8f?{'count':_0x45ef7a,'rows':_0x3e9a8f}:null;}})[_0x7f76('0x25')](respondWithResult(_0x539256,null))[_0x7f76('0x45')](handleError(_0x539256,null));};exports[_0x7f76('0x52')]=function(_0x538355,_0x2d5b90,_0x22491e){var _0x2816ed={};var _0x5582c6={};var _0x10561b;var _0x3b4910;return db[_0x7f76('0x2d')][_0x7f76('0x4c')]({'where':{'id':_0x538355[_0x7f76('0x46')]['id']}})[_0x7f76('0x25')](handleEntityNotFound(_0x2d5b90,null))[_0x7f76('0x25')](function(_0xcda11){if(_0xcda11){_0x10561b=_0xcda11;_0x5582c6[_0x7f76('0x32')]=_['keys'](db[_0x7f76('0x50')][_0x7f76('0x2e')]);_0x5582c6[_0x7f76('0x33')]=_['keys'](_0x538355[_0x7f76('0x33')]);_0x5582c6[_0x7f76('0x35')]=_[_0x7f76('0x36')](_0x5582c6[_0x7f76('0x32')],_0x5582c6[_0x7f76('0x33')]);_0x2816ed[_0x7f76('0x37')]=_['intersection'](_0x5582c6[_0x7f76('0x32')],qs[_0x7f76('0x38')](_0x538355[_0x7f76('0x33')][_0x7f76('0x38')]));_0x2816ed['attributes']=_0x2816ed[_0x7f76('0x37')][_0x7f76('0x39')]?_0x2816ed[_0x7f76('0x37')]:_0x5582c6[_0x7f76('0x32')];_0x2816ed[_0x7f76('0x4d')]=qs[_0x7f76('0x3b')](_0x538355[_0x7f76('0x33')][_0x7f76('0x3b')]);_0x2816ed[_0x7f76('0x3c')]=qs['filters'](_[_0x7f76('0x4e')](_0x538355[_0x7f76('0x33')],_0x5582c6[_0x7f76('0x35')]));if(_0x538355[_0x7f76('0x33')][_0x7f76('0x3d')]){_0x2816ed[_0x7f76('0x3c')]=_[_0x7f76('0x3e')](_0x2816ed[_0x7f76('0x3c')],{'$or':_['map'](_0x2816ed[_0x7f76('0x37')],function(_0xe9a5de){var _0x546281={};_0x546281[_0xe9a5de]={'$like':'%'+_0x538355[_0x7f76('0x33')][_0x7f76('0x3d')]+'%'};return _0x546281;})});}_0x2816ed=_[_0x7f76('0x3e')]({},_0x2816ed,_0x538355[_0x7f76('0x40')]);return _0x10561b[_0x7f76('0x52')](_0x2816ed);}})[_0x7f76('0x25')](function(_0x59841a){if(_0x59841a){_0x3b4910=_0x59841a[_0x7f76('0x39')];if(!_0x538355['query'][_0x7f76('0x51')](_0x7f76('0x3a'))){_0x2816ed[_0x7f76('0x1d')]=qs[_0x7f76('0x1d')](_0x538355[_0x7f76('0x33')][_0x7f76('0x1d')]);_0x2816ed['offset']=qs['offset'](_0x538355['query']['offset']);}return _0x10561b[_0x7f76('0x52')](_0x2816ed);}})['then'](function(_0x2b1729){if(_0x2b1729){return _0x2b1729?{'count':_0x3b4910,'rows':_0x2b1729}:null;}})['then'](respondWithResult(_0x2d5b90,null))[_0x7f76('0x45')](handleError(_0x2d5b90,null));}; \ No newline at end of file +var _0x6e56=['intersection','find','create','body','findOne','ServicenowField','rawAttributes','order','getFields','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','name','send','index','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowConfiguration','includeAll','include','findAll','catch','show','params'];(function(_0x4dcc4f,_0x3a31a0){var _0x3ab310=function(_0x1d65c1){while(--_0x1d65c1){_0x4dcc4f['push'](_0x4dcc4f['shift']());}};_0x3ab310(++_0x3a31a0);}(_0x6e56,0x19a));var _0x66e5=function(_0x254076,_0x5e7b8d){_0x254076=_0x254076-0x0;var _0x21a93e=_0x6e56[_0x254076];return _0x21a93e;};'use strict';var emlformat=require(_0x66e5('0x0'));var rimraf=require(_0x66e5('0x1'));var zipdir=require(_0x66e5('0x2'));var jsonpatch=require(_0x66e5('0x3'));var rp=require(_0x66e5('0x4'));var moment=require('moment');var BPromise=require(_0x66e5('0x5'));var Mustache=require(_0x66e5('0x6'));var util=require(_0x66e5('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x66e5('0x8'));var ejs=require(_0x66e5('0x9'));var fs=require('fs');var fs_extra=require(_0x66e5('0xa'));var _=require('lodash');var squel=require(_0x66e5('0xb'));var crypto=require(_0x66e5('0xc'));var jsforce=require(_0x66e5('0xd'));var deskjs=require(_0x66e5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x66e5('0xf'));var Papa=require(_0x66e5('0x10'));var Redis=require(_0x66e5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x66e5('0x12'));var as=require(_0x66e5('0x13'));var hardwareService=require(_0x66e5('0x14'));var logger=require(_0x66e5('0x15'))(_0x66e5('0x16'));var utils=require(_0x66e5('0x17'));var config=require(_0x66e5('0x18'));var licenseUtil=require(_0x66e5('0x19'));var db=require(_0x66e5('0x1a'))['db'];function respondWithStatusCode(_0x244f29,_0x32de21){_0x32de21=_0x32de21||0xcc;return function(_0x269076){if(_0x269076){return _0x244f29['sendStatus'](_0x32de21);}return _0x244f29[_0x66e5('0x1b')](_0x32de21)[_0x66e5('0x1c')]();};}function respondWithResult(_0x41af1c,_0x2960c6){_0x2960c6=_0x2960c6||0xc8;return function(_0x12d786){if(_0x12d786){return _0x41af1c['status'](_0x2960c6)['json'](_0x12d786);}};}function respondWithFilteredResult(_0x1a71ad,_0x4ebb19){return function(_0x14a257){if(_0x14a257){var _0x4aa2e1=typeof _0x4ebb19[_0x66e5('0x1d')]===_0x66e5('0x1e')&&typeof _0x4ebb19[_0x66e5('0x1f')]===_0x66e5('0x1e');var _0x4f3467=_0x14a257['count'];var _0x1f446f=_0x4aa2e1?0x0:_0x4ebb19[_0x66e5('0x1d')];var _0x1ac4cf=_0x4aa2e1?_0x14a257[_0x66e5('0x20')]:_0x4ebb19[_0x66e5('0x1d')]+_0x4ebb19[_0x66e5('0x1f')];var _0x15c2bb;if(_0x1ac4cf>=_0x4f3467){_0x1ac4cf=_0x4f3467;_0x15c2bb=0xc8;}else{_0x15c2bb=0xce;}_0x1a71ad[_0x66e5('0x1b')](_0x15c2bb);return _0x1a71ad[_0x66e5('0x21')]('Content-Range',_0x1f446f+'-'+_0x1ac4cf+'/'+_0x4f3467)[_0x66e5('0x22')](_0x14a257);}return null;};}function patchUpdates(_0xc9c9a3){return function(_0x2693b8){try{jsonpatch[_0x66e5('0x23')](_0x2693b8,_0xc9c9a3,!![]);}catch(_0x33fcb4){return BPromise[_0x66e5('0x24')](_0x33fcb4);}return _0x2693b8[_0x66e5('0x25')]();};}function saveUpdates(_0x150819,_0x39340b){return function(_0x45239f){if(_0x45239f){return _0x45239f[_0x66e5('0x26')](_0x150819)[_0x66e5('0x27')](function(_0x840a30){return _0x840a30;});}return null;};}function removeEntity(_0x109183,_0x4d3bd7){return function(_0x3d9643){if(_0x3d9643){return _0x3d9643[_0x66e5('0x28')]()[_0x66e5('0x27')](function(){_0x109183[_0x66e5('0x1b')](0xcc)[_0x66e5('0x1c')]();});}};}function handleEntityNotFound(_0x14e5c5,_0x424886){return function(_0x316c74){if(!_0x316c74){_0x14e5c5['sendStatus'](0x194);}return _0x316c74;};}function handleError(_0x473bdf,_0x5a9d0d){_0x5a9d0d=_0x5a9d0d||0x1f4;return function(_0x292f72){logger['error'](_0x292f72['stack']);if(_0x292f72[_0x66e5('0x29')]){delete _0x292f72[_0x66e5('0x29')];}_0x473bdf[_0x66e5('0x1b')](_0x5a9d0d)[_0x66e5('0x2a')](_0x292f72);};}exports[_0x66e5('0x2b')]=function(_0x2a9e32,_0x327185){var _0x4cba03={},_0xf8833c={},_0x1064e6={'count':0x0,'rows':[]};var _0x4366f4=_['map'](db['ServicenowConfiguration']['rawAttributes'],function(_0x315827){return{'name':_0x315827[_0x66e5('0x2c')],'type':_0x315827[_0x66e5('0x2d')]['key']};});_0xf8833c[_0x66e5('0x2e')]=_[_0x66e5('0x2f')](_0x4366f4,_0x66e5('0x29'));_0xf8833c[_0x66e5('0x30')]=_[_0x66e5('0x31')](_0x2a9e32[_0x66e5('0x30')]);_0xf8833c[_0x66e5('0x32')]=_['intersection'](_0xf8833c[_0x66e5('0x2e')],_0xf8833c[_0x66e5('0x30')]);_0x4cba03[_0x66e5('0x33')]=_['intersection'](_0xf8833c[_0x66e5('0x2e')],qs[_0x66e5('0x34')](_0x2a9e32[_0x66e5('0x30')][_0x66e5('0x34')]));_0x4cba03[_0x66e5('0x33')]=_0x4cba03[_0x66e5('0x33')][_0x66e5('0x35')]?_0x4cba03[_0x66e5('0x33')]:_0xf8833c[_0x66e5('0x2e')];if(!_0x2a9e32[_0x66e5('0x30')][_0x66e5('0x36')](_0x66e5('0x37'))){_0x4cba03[_0x66e5('0x1f')]=qs[_0x66e5('0x1f')](_0x2a9e32['query'][_0x66e5('0x1f')]);_0x4cba03[_0x66e5('0x1d')]=qs[_0x66e5('0x1d')](_0x2a9e32[_0x66e5('0x30')][_0x66e5('0x1d')]);}_0x4cba03['order']=qs[_0x66e5('0x38')](_0x2a9e32[_0x66e5('0x30')]['sort']);_0x4cba03[_0x66e5('0x39')]=qs[_0x66e5('0x32')](_[_0x66e5('0x3a')](_0x2a9e32[_0x66e5('0x30')],_0xf8833c[_0x66e5('0x32')]),_0x4366f4);if(_0x2a9e32['query'][_0x66e5('0x3b')]){_0x4cba03[_0x66e5('0x39')]=_[_0x66e5('0x3c')](_0x4cba03[_0x66e5('0x39')],{'$or':_['map'](_0x4366f4,function(_0x5a03e9){if(_0x5a03e9[_0x66e5('0x2d')]!==_0x66e5('0x3d')){var _0x194c21={};_0x194c21[_0x5a03e9[_0x66e5('0x29')]]={'$like':'%'+_0x2a9e32[_0x66e5('0x30')][_0x66e5('0x3b')]+'%'};return _0x194c21;}})});}_0x4cba03=_[_0x66e5('0x3c')]({},_0x4cba03,_0x2a9e32[_0x66e5('0x3e')]);var _0x4ade41={'where':_0x4cba03[_0x66e5('0x39')]};return db[_0x66e5('0x3f')][_0x66e5('0x20')](_0x4ade41)[_0x66e5('0x27')](function(_0x4a797f){_0x1064e6[_0x66e5('0x20')]=_0x4a797f;if(_0x2a9e32[_0x66e5('0x30')][_0x66e5('0x40')]){_0x4cba03[_0x66e5('0x41')]=[{'all':!![]}];}return db[_0x66e5('0x3f')][_0x66e5('0x42')](_0x4cba03);})[_0x66e5('0x27')](function(_0x34a4e4){_0x1064e6['rows']=_0x34a4e4;return _0x1064e6;})[_0x66e5('0x27')](respondWithFilteredResult(_0x327185,_0x4cba03))[_0x66e5('0x43')](handleError(_0x327185,null));};exports[_0x66e5('0x44')]=function(_0x2092b7,_0x11db4c){var _0x549434={'raw':![],'where':{'id':_0x2092b7[_0x66e5('0x45')]['id']}},_0x441ada={};_0x441ada[_0x66e5('0x2e')]=_[_0x66e5('0x31')](db['ServicenowConfiguration']['rawAttributes']);_0x441ada[_0x66e5('0x30')]=_[_0x66e5('0x31')](_0x2092b7[_0x66e5('0x30')]);_0x441ada['filters']=_[_0x66e5('0x46')](_0x441ada[_0x66e5('0x2e')],_0x441ada[_0x66e5('0x30')]);_0x549434[_0x66e5('0x33')]=_[_0x66e5('0x46')](_0x441ada[_0x66e5('0x2e')],qs['fields'](_0x2092b7[_0x66e5('0x30')]['fields']));_0x549434['attributes']=_0x549434[_0x66e5('0x33')]['length']?_0x549434['attributes']:_0x441ada[_0x66e5('0x2e')];if(_0x2092b7['query'][_0x66e5('0x40')]){_0x549434[_0x66e5('0x41')]=[{'all':!![]}];}_0x549434=_[_0x66e5('0x3c')]({},_0x549434,_0x2092b7['options']);return db[_0x66e5('0x3f')][_0x66e5('0x47')](_0x549434)[_0x66e5('0x27')](handleEntityNotFound(_0x11db4c,null))[_0x66e5('0x27')](respondWithResult(_0x11db4c,null))['catch'](handleError(_0x11db4c,null));};exports['create']=function(_0x3ff1c5,_0x520074){return db[_0x66e5('0x3f')][_0x66e5('0x48')](_0x3ff1c5['body'],{})[_0x66e5('0x27')](respondWithResult(_0x520074,0xc9))[_0x66e5('0x43')](handleError(_0x520074,null));};exports[_0x66e5('0x26')]=function(_0x1027aa,_0x2d2866){if(_0x1027aa[_0x66e5('0x49')]['id']){delete _0x1027aa[_0x66e5('0x49')]['id'];}return db[_0x66e5('0x3f')][_0x66e5('0x47')]({'where':{'id':_0x1027aa[_0x66e5('0x45')]['id']}})[_0x66e5('0x27')](handleEntityNotFound(_0x2d2866,null))['then'](saveUpdates(_0x1027aa[_0x66e5('0x49')],null))[_0x66e5('0x27')](respondWithResult(_0x2d2866,null))[_0x66e5('0x43')](handleError(_0x2d2866,null));};exports[_0x66e5('0x28')]=function(_0x303655,_0xdf4acb){return db[_0x66e5('0x3f')][_0x66e5('0x47')]({'where':{'id':_0x303655['params']['id']}})[_0x66e5('0x27')](handleEntityNotFound(_0xdf4acb,null))[_0x66e5('0x27')](removeEntity(_0xdf4acb,null))['catch'](handleError(_0xdf4acb,null));};exports['getFields']=function(_0x5a855e,_0x3adde2,_0x83aa84){var _0x43c35b={};var _0x3593b8={};var _0x4b4bcf;var _0x4ab25d;return db[_0x66e5('0x3f')][_0x66e5('0x4a')]({'where':{'id':_0x5a855e['params']['id']}})[_0x66e5('0x27')](handleEntityNotFound(_0x3adde2,null))[_0x66e5('0x27')](function(_0x563c3d){if(_0x563c3d){_0x4b4bcf=_0x563c3d;_0x3593b8[_0x66e5('0x2e')]=_[_0x66e5('0x31')](db[_0x66e5('0x4b')][_0x66e5('0x4c')]);_0x3593b8[_0x66e5('0x30')]=_[_0x66e5('0x31')](_0x5a855e[_0x66e5('0x30')]);_0x3593b8[_0x66e5('0x32')]=_[_0x66e5('0x46')](_0x3593b8[_0x66e5('0x2e')],_0x3593b8[_0x66e5('0x30')]);_0x43c35b[_0x66e5('0x33')]=_[_0x66e5('0x46')](_0x3593b8['model'],qs[_0x66e5('0x34')](_0x5a855e[_0x66e5('0x30')]['fields']));_0x43c35b[_0x66e5('0x33')]=_0x43c35b['attributes'][_0x66e5('0x35')]?_0x43c35b[_0x66e5('0x33')]:_0x3593b8[_0x66e5('0x2e')];_0x43c35b[_0x66e5('0x4d')]=qs[_0x66e5('0x38')](_0x5a855e[_0x66e5('0x30')][_0x66e5('0x38')]);_0x43c35b[_0x66e5('0x39')]=qs[_0x66e5('0x32')](_[_0x66e5('0x3a')](_0x5a855e[_0x66e5('0x30')],_0x3593b8[_0x66e5('0x32')]));if(_0x5a855e['query']['filter']){_0x43c35b[_0x66e5('0x39')]=_[_0x66e5('0x3c')](_0x43c35b['where'],{'$or':_['map'](_0x43c35b[_0x66e5('0x33')],function(_0x1280dd){var _0x14d6ee={};_0x14d6ee[_0x1280dd]={'$like':'%'+_0x5a855e[_0x66e5('0x30')][_0x66e5('0x3b')]+'%'};return _0x14d6ee;})});}_0x43c35b=_[_0x66e5('0x3c')]({},_0x43c35b,_0x5a855e['options']);return _0x4b4bcf[_0x66e5('0x4e')](_0x43c35b);}})[_0x66e5('0x27')](function(_0x4e0d70){if(_0x4e0d70){_0x4ab25d=_0x4e0d70['length'];if(!_0x5a855e[_0x66e5('0x30')][_0x66e5('0x36')]('nolimit')){_0x43c35b['limit']=qs['limit'](_0x5a855e[_0x66e5('0x30')][_0x66e5('0x1f')]);_0x43c35b['offset']=qs['offset'](_0x5a855e['query'][_0x66e5('0x1d')]);}return _0x4b4bcf[_0x66e5('0x4e')](_0x43c35b);}})[_0x66e5('0x27')](function(_0x31a61){if(_0x31a61){return _0x31a61?{'count':_0x4ab25d,'rows':_0x31a61}:null;}})[_0x66e5('0x27')](respondWithResult(_0x3adde2,null))[_0x66e5('0x43')](handleError(_0x3adde2,null));};exports['getSubjects']=function(_0x1eb6fd,_0x2fd25f,_0x226904){var _0x760668={};var _0x1fb31a={};var _0x5d39a8;var _0x261b72;return db[_0x66e5('0x3f')][_0x66e5('0x4a')]({'where':{'id':_0x1eb6fd[_0x66e5('0x45')]['id']}})[_0x66e5('0x27')](handleEntityNotFound(_0x2fd25f,null))[_0x66e5('0x27')](function(_0x37e55f){if(_0x37e55f){_0x5d39a8=_0x37e55f;_0x1fb31a[_0x66e5('0x2e')]=_[_0x66e5('0x31')](db['ServicenowField'][_0x66e5('0x4c')]);_0x1fb31a[_0x66e5('0x30')]=_['keys'](_0x1eb6fd[_0x66e5('0x30')]);_0x1fb31a['filters']=_[_0x66e5('0x46')](_0x1fb31a[_0x66e5('0x2e')],_0x1fb31a['query']);_0x760668[_0x66e5('0x33')]=_[_0x66e5('0x46')](_0x1fb31a['model'],qs[_0x66e5('0x34')](_0x1eb6fd[_0x66e5('0x30')][_0x66e5('0x34')]));_0x760668[_0x66e5('0x33')]=_0x760668[_0x66e5('0x33')][_0x66e5('0x35')]?_0x760668[_0x66e5('0x33')]:_0x1fb31a[_0x66e5('0x2e')];_0x760668[_0x66e5('0x4d')]=qs[_0x66e5('0x38')](_0x1eb6fd[_0x66e5('0x30')][_0x66e5('0x38')]);_0x760668['where']=qs['filters'](_[_0x66e5('0x3a')](_0x1eb6fd[_0x66e5('0x30')],_0x1fb31a[_0x66e5('0x32')]));if(_0x1eb6fd[_0x66e5('0x30')][_0x66e5('0x3b')]){_0x760668[_0x66e5('0x39')]=_[_0x66e5('0x3c')](_0x760668['where'],{'$or':_[_0x66e5('0x2f')](_0x760668[_0x66e5('0x33')],function(_0x2f2fe6){var _0x27b44b={};_0x27b44b[_0x2f2fe6]={'$like':'%'+_0x1eb6fd[_0x66e5('0x30')]['filter']+'%'};return _0x27b44b;})});}_0x760668=_[_0x66e5('0x3c')]({},_0x760668,_0x1eb6fd[_0x66e5('0x3e')]);return _0x5d39a8['getSubjects'](_0x760668);}})[_0x66e5('0x27')](function(_0x11a203){if(_0x11a203){_0x261b72=_0x11a203[_0x66e5('0x35')];if(!_0x1eb6fd[_0x66e5('0x30')][_0x66e5('0x36')](_0x66e5('0x37'))){_0x760668[_0x66e5('0x1f')]=qs[_0x66e5('0x1f')](_0x1eb6fd[_0x66e5('0x30')]['limit']);_0x760668[_0x66e5('0x1d')]=qs[_0x66e5('0x1d')](_0x1eb6fd[_0x66e5('0x30')][_0x66e5('0x1d')]);}return _0x5d39a8['getSubjects'](_0x760668);}})[_0x66e5('0x27')](function(_0x335e85){if(_0x335e85){return _0x335e85?{'count':_0x261b72,'rows':_0x335e85}:null;}})['then'](respondWithResult(_0x2fd25f,null))[_0x66e5('0x43')](handleError(_0x2fd25f,null));};exports[_0x66e5('0x4f')]=function(_0x3eaf8b,_0x485ea0,_0x388bf0){var _0x54c9c7={};var _0x143083={};var _0x617b79;var _0x2b0adf;return db[_0x66e5('0x3f')][_0x66e5('0x4a')]({'where':{'id':_0x3eaf8b[_0x66e5('0x45')]['id']}})['then'](handleEntityNotFound(_0x485ea0,null))[_0x66e5('0x27')](function(_0x4d9516){if(_0x4d9516){_0x617b79=_0x4d9516;_0x143083['model']=_[_0x66e5('0x31')](db['ServicenowField']['rawAttributes']);_0x143083[_0x66e5('0x30')]=_[_0x66e5('0x31')](_0x3eaf8b['query']);_0x143083['filters']=_[_0x66e5('0x46')](_0x143083[_0x66e5('0x2e')],_0x143083[_0x66e5('0x30')]);_0x54c9c7[_0x66e5('0x33')]=_['intersection'](_0x143083[_0x66e5('0x2e')],qs['fields'](_0x3eaf8b[_0x66e5('0x30')][_0x66e5('0x34')]));_0x54c9c7[_0x66e5('0x33')]=_0x54c9c7[_0x66e5('0x33')][_0x66e5('0x35')]?_0x54c9c7[_0x66e5('0x33')]:_0x143083[_0x66e5('0x2e')];_0x54c9c7[_0x66e5('0x4d')]=qs[_0x66e5('0x38')](_0x3eaf8b[_0x66e5('0x30')][_0x66e5('0x38')]);_0x54c9c7[_0x66e5('0x39')]=qs[_0x66e5('0x32')](_['pick'](_0x3eaf8b[_0x66e5('0x30')],_0x143083[_0x66e5('0x32')]));if(_0x3eaf8b[_0x66e5('0x30')]['filter']){_0x54c9c7[_0x66e5('0x39')]=_[_0x66e5('0x3c')](_0x54c9c7[_0x66e5('0x39')],{'$or':_[_0x66e5('0x2f')](_0x54c9c7[_0x66e5('0x33')],function(_0x33253c){var _0x316e63={};_0x316e63[_0x33253c]={'$like':'%'+_0x3eaf8b[_0x66e5('0x30')][_0x66e5('0x3b')]+'%'};return _0x316e63;})});}_0x54c9c7=_[_0x66e5('0x3c')]({},_0x54c9c7,_0x3eaf8b[_0x66e5('0x3e')]);return _0x617b79[_0x66e5('0x4f')](_0x54c9c7);}})['then'](function(_0x3cc420){if(_0x3cc420){_0x2b0adf=_0x3cc420['length'];if(!_0x3eaf8b[_0x66e5('0x30')][_0x66e5('0x36')](_0x66e5('0x37'))){_0x54c9c7[_0x66e5('0x1f')]=qs[_0x66e5('0x1f')](_0x3eaf8b[_0x66e5('0x30')]['limit']);_0x54c9c7[_0x66e5('0x1d')]=qs[_0x66e5('0x1d')](_0x3eaf8b['query'][_0x66e5('0x1d')]);}return _0x617b79['getDescriptions'](_0x54c9c7);}})['then'](function(_0x4ca81f){if(_0x4ca81f){return _0x4ca81f?{'count':_0x2b0adf,'rows':_0x4ca81f}:null;}})[_0x66e5('0x27')](respondWithResult(_0x485ea0,null))[_0x66e5('0x43')](handleError(_0x485ea0,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index f4a42ac..d19d672 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 _0x9c1d=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x4bdadb,_0x1c0542){var _0x18b9f1=function(_0x27ea6f){while(--_0x27ea6f){_0x4bdadb['push'](_0x4bdadb['shift']());}};_0x18b9f1(++_0x1c0542);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x435ed3,_0x1206cf){_0x435ed3=_0x435ed3-0x0;var _0x1705d3=_0x9c1d[_0x435ed3];return _0x1705d3;};'use strict';var _=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var logger=require(_0xd9c1('0x2'))('api');var moment=require(_0xd9c1('0x3'));var BPromise=require(_0xd9c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9c1('0x5'));var rimraf=require(_0xd9c1('0x6'));var config=require('../../config/environment');var attributes=require(_0xd9c1('0x7'));module[_0xd9c1('0x8')]=function(_0x206639,_0x29840f){return _0x206639[_0xd9c1('0x9')](_0xd9c1('0xa'),attributes,{'tableName':_0xd9c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8cb=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x3905ac,_0x16e7b5){_0x3905ac=_0x3905ac-0x0;var _0x1e30b1=_0xb8cb[_0x3905ac];return _0x1e30b1;};'use strict';var _=require(_0xbb8c('0x0'));var util=require(_0xbb8c('0x1'));var logger=require(_0xbb8c('0x2'))(_0xbb8c('0x3'));var moment=require(_0xbb8c('0x4'));var BPromise=require(_0xbb8c('0x5'));var rp=require(_0xbb8c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb8c('0x7'));var config=require(_0xbb8c('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x3b2ad2,_0x27c59e){return _0x3b2ad2[_0xbb8c('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0xbb8c('0xa'),'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 7879e8e..4b34733 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 _0x148c=['http','request','then','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x528ada,_0x2f422d){var _0x6df480=function(_0x3f7eaa){while(--_0x3f7eaa){_0x528ada['push'](_0x528ada['shift']());}};_0x6df480(++_0x2f422d);}(_0x148c,0xd3));var _0xc148=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x148c[_0x432682];return _0x463d05;};'use strict';var _=require(_0xc148('0x0'));var util=require(_0xc148('0x1'));var moment=require(_0xc148('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc148('0x3'))['db'];var utils=require(_0xc148('0x4'));var logger=require(_0xc148('0x5'))(_0xc148('0x6'));var config=require(_0xc148('0x7'));var jayson=require(_0xc148('0x8'));var client=jayson['client'][_0xc148('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45108d,_0x4d4680,_0x30498d){return new BPromise(function(_0x5879fc,_0x4c48d6){return client[_0xc148('0xa')](_0x45108d,_0x30498d)[_0xc148('0xb')](function(_0x152e52){logger['info'](_0xc148('0xc'),_0x4d4680,'request\x20sent');logger[_0xc148('0xd')](_0xc148('0xe'),_0x4d4680,'request\x20sent',JSON['stringify'](_0x152e52));if(_0x152e52[_0xc148('0xf')]){if(_0x152e52[_0xc148('0xf')]['code']===0x1f4){logger[_0xc148('0xf')](_0xc148('0xc'),_0x4d4680,_0x152e52[_0xc148('0xf')][_0xc148('0x10')]);return _0x4c48d6(_0x152e52['error'][_0xc148('0x10')]);}logger[_0xc148('0xf')](_0xc148('0xc'),_0x4d4680,_0x152e52['error'][_0xc148('0x10')]);return _0x5879fc(_0x152e52['error'][_0xc148('0x10')]);}else{logger['info'](_0xc148('0xc'),_0x4d4680,_0xc148('0x11'));_0x5879fc(_0x152e52[_0xc148('0x12')][_0xc148('0x10')]);}})[_0xc148('0x13')](function(_0x51b2da){logger[_0xc148('0xf')](_0xc148('0xc'),_0x4d4680,_0x51b2da);_0x4c48d6(_0x51b2da);});});} \ No newline at end of file +var _0xd9a5=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x5c4175,_0x36fede){var _0x4983f2=function(_0x3b9367){while(--_0x3b9367){_0x5c4175['push'](_0x5c4175['shift']());}};_0x4983f2(++_0x36fede);}(_0xd9a5,0x135));var _0x5d9a=function(_0x4bcf59,_0x146ebc){_0x4bcf59=_0x4bcf59-0x0;var _0x434985=_0xd9a5[_0x4bcf59];return _0x434985;};'use strict';var _=require(_0x5d9a('0x0'));var util=require(_0x5d9a('0x1'));var moment=require(_0x5d9a('0x2'));var BPromise=require(_0x5d9a('0x3'));var rs=require(_0x5d9a('0x4'));var fs=require('fs');var Redis=require(_0x5d9a('0x5'));var db=require(_0x5d9a('0x6'))['db'];var utils=require(_0x5d9a('0x7'));var logger=require(_0x5d9a('0x8'))('rpc');var config=require(_0x5d9a('0x9'));var jayson=require(_0x5d9a('0xa'));var client=jayson[_0x5d9a('0xb')][_0x5d9a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1718de,_0x43692c,_0x3cc160){return new BPromise(function(_0x1276fd,_0x34208f){return client['request'](_0x1718de,_0x3cc160)[_0x5d9a('0xd')](function(_0x4333b8){logger[_0x5d9a('0xe')](_0x5d9a('0xf'),_0x43692c,'request\x20sent');logger[_0x5d9a('0x10')](_0x5d9a('0x11'),_0x43692c,'request\x20sent',JSON[_0x5d9a('0x12')](_0x4333b8));if(_0x4333b8[_0x5d9a('0x13')]){if(_0x4333b8['error'][_0x5d9a('0x14')]===0x1f4){logger['error'](_0x5d9a('0xf'),_0x43692c,_0x4333b8[_0x5d9a('0x13')][_0x5d9a('0x15')]);return _0x34208f(_0x4333b8[_0x5d9a('0x13')][_0x5d9a('0x15')]);}logger['error'](_0x5d9a('0xf'),_0x43692c,_0x4333b8['error'][_0x5d9a('0x15')]);return _0x1276fd(_0x4333b8[_0x5d9a('0x13')][_0x5d9a('0x15')]);}else{logger[_0x5d9a('0xe')](_0x5d9a('0xf'),_0x43692c,_0x5d9a('0x16'));_0x1276fd(_0x4333b8[_0x5d9a('0x17')][_0x5d9a('0x15')]);}})[_0x5d9a('0x18')](function(_0x5bda57){logger[_0x5d9a('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x43692c,_0x5bda57);_0x34208f(_0x5bda57);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 79f9c20..47769a6 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 _0x2060=['index','/:id','isAuthenticated','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowField.controller','get'];(function(_0x15ed34,_0x3c6bff){var _0x5b36db=function(_0x56a352){while(--_0x56a352){_0x15ed34['push'](_0x15ed34['shift']());}};_0x5b36db(++_0x3c6bff);}(_0x2060,0x1b8));var _0x0206=function(_0x162ff3,_0x146983){_0x162ff3=_0x162ff3-0x0;var _0x36ab76=_0x2060[_0x162ff3];return _0x36ab76;};'use strict';var multer=require(_0x0206('0x0'));var util=require(_0x0206('0x1'));var path=require(_0x0206('0x2'));var timeout=require(_0x0206('0x3'));var express=require(_0x0206('0x4'));var router=express[_0x0206('0x5')]();var fs_extra=require(_0x0206('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0206('0x7'));var controller=require(_0x0206('0x8'));router[_0x0206('0x9')]('/',auth['isAuthenticated'](),controller[_0x0206('0xa')]);router[_0x0206('0x9')](_0x0206('0xb'),auth[_0x0206('0xc')](),controller['show']);router[_0x0206('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0206('0xe')](_0x0206('0xb'),auth[_0x0206('0xc')](),controller['update']);router[_0x0206('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x0206('0x10')]);module[_0x0206('0x11')]=router; \ No newline at end of file +var _0xdaed=['put','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post'];(function(_0x116954,_0xaf38d8){var _0x39aa7a=function(_0x3bf757){while(--_0x3bf757){_0x116954['push'](_0x116954['shift']());}};_0x39aa7a(++_0xaf38d8);}(_0xdaed,0x15d));var _0xddae=function(_0x5cfc83,_0x68eb0){_0x5cfc83=_0x5cfc83-0x0;var _0x67322e=_0xdaed[_0x5cfc83];return _0x67322e;};'use strict';var multer=require(_0xddae('0x0'));var util=require(_0xddae('0x1'));var path=require(_0xddae('0x2'));var timeout=require('connect-timeout');var express=require(_0xddae('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xddae('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xddae('0x5'));var controller=require('./intServicenowField.controller');router[_0xddae('0x6')]('/',auth[_0xddae('0x7')](),controller['index']);router[_0xddae('0x6')](_0xddae('0x8'),auth[_0xddae('0x7')](),controller[_0xddae('0x9')]);router[_0xddae('0xa')]('/',auth[_0xddae('0x7')](),controller['create']);router[_0xddae('0xb')](_0xddae('0x8'),auth['isAuthenticated'](),controller[_0xddae('0xc')]);router['delete'](_0xddae('0x8'),auth[_0xddae('0x7')](),controller[_0xddae('0xd')]);module[_0xddae('0xe')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 476bc6b..3ee98a8 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 _0xb7af=['string','customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x38a6c6,_0x4062ca){var _0x142f0a=function(_0x1531ce){while(--_0x1531ce){_0x38a6c6['push'](_0x38a6c6['shift']());}};_0x142f0a(++_0x4062ca);}(_0xb7af,0x1f2));var _0xfb7a=function(_0x1956c9,_0x2ad6b4){_0x1956c9=_0x1956c9-0x0;var _0x499d4=_0xb7af[_0x1956c9];return _0x499d4;};'use strict';var Sequelize=require(_0xfb7a('0x0'));module[_0xfb7a('0x1')]={'type':{'type':Sequelize['ENUM'](_0xfb7a('0x2'),'variable',_0xfb7a('0x3'),_0xfb7a('0x4'),_0xfb7a('0x5')),'defaultValue':_0xfb7a('0x2')},'content':{'type':Sequelize[_0xfb7a('0x6')]},'key':{'type':Sequelize[_0xfb7a('0x6')]},'keyType':{'type':Sequelize[_0xfb7a('0x7')](_0xfb7a('0x2'),_0xfb7a('0x8'),_0xfb7a('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfb7a('0x6')]},'nameField':{'type':Sequelize[_0xfb7a('0x6')]},'customField':{'type':Sequelize[_0xfb7a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfb7a('0x6')]}}; \ No newline at end of file +var _0xad88=['string','picklist','STRING','customVariable','sequelize','exports','ENUM'];(function(_0xcf0e,_0x1d3e15){var _0x8d0e30=function(_0x194735){while(--_0x194735){_0xcf0e['push'](_0xcf0e['shift']());}};_0x8d0e30(++_0x1d3e15);}(_0xad88,0x169));var _0x8ad8=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xad88[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x8ad8('0x0'));module[_0x8ad8('0x1')]={'type':{'type':Sequelize[_0x8ad8('0x2')](_0x8ad8('0x3'),'variable','customVariable','keyValue',_0x8ad8('0x4')),'defaultValue':_0x8ad8('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8ad8('0x5')]},'keyType':{'type':Sequelize[_0x8ad8('0x2')](_0x8ad8('0x3'),'variable',_0x8ad8('0x6'))},'keyContent':{'type':Sequelize[_0x8ad8('0x5')]},'idField':{'type':Sequelize[_0x8ad8('0x5')]},'nameField':{'type':Sequelize[_0x8ad8('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8ad8('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index c9c6968..62888f4 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 _0x1126=['name','send','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','ServicenowField','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','end','stack'];(function(_0x4999a7,_0x3b33b0){var _0x589197=function(_0x392f12){while(--_0x392f12){_0x4999a7['push'](_0x4999a7['shift']());}};_0x589197(++_0x3b33b0);}(_0x1126,0xe5));var _0x6112=function(_0x5ce6d6,_0x1a1748){_0x5ce6d6=_0x5ce6d6-0x0;var _0x3d9be7=_0x1126[_0x5ce6d6];return _0x3d9be7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6112('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6112('0x1'));var BPromise=require(_0x6112('0x2'));var Mustache=require('mustache');var util=require(_0x6112('0x3'));var path=require(_0x6112('0x4'));var sox=require(_0x6112('0x5'));var csv=require(_0x6112('0x6'));var ejs=require(_0x6112('0x7'));var fs=require('fs');var fs_extra=require(_0x6112('0x8'));var _=require(_0x6112('0x9'));var squel=require('squel');var crypto=require(_0x6112('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6112('0x6'));var querystring=require(_0x6112('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6112('0xc'));var qs=require(_0x6112('0xd'));var as=require(_0x6112('0xe'));var hardwareService=require(_0x6112('0xf'));var logger=require(_0x6112('0x10'))(_0x6112('0x11'));var utils=require('../../config/utils');var config=require(_0x6112('0x12'));var licenseUtil=require(_0x6112('0x13'));var db=require(_0x6112('0x14'))['db'];function respondWithStatusCode(_0x51f349,_0x58ecbf){_0x58ecbf=_0x58ecbf||0xcc;return function(_0x2f4195){if(_0x2f4195){return _0x51f349[_0x6112('0x15')](_0x58ecbf);}return _0x51f349[_0x6112('0x16')](_0x58ecbf)['end']();};}function respondWithResult(_0x4d4e03,_0x26cafb){_0x26cafb=_0x26cafb||0xc8;return function(_0x1a5dd7){if(_0x1a5dd7){return _0x4d4e03[_0x6112('0x16')](_0x26cafb)[_0x6112('0x17')](_0x1a5dd7);}};}function respondWithFilteredResult(_0x52947b,_0x541944){return function(_0xe90a15){if(_0xe90a15){var _0x5501fe=typeof _0x541944['offset']==='undefined'&&typeof _0x541944['limit']==='undefined';var _0x204343=_0xe90a15[_0x6112('0x18')];var _0x1cfec5=_0x5501fe?0x0:_0x541944[_0x6112('0x19')];var _0x1e0016=_0x5501fe?_0xe90a15['count']:_0x541944[_0x6112('0x19')]+_0x541944[_0x6112('0x1a')];var _0x4f0c8a;if(_0x1e0016>=_0x204343){_0x1e0016=_0x204343;_0x4f0c8a=0xc8;}else{_0x4f0c8a=0xce;}_0x52947b[_0x6112('0x16')](_0x4f0c8a);return _0x52947b['set'](_0x6112('0x1b'),_0x1cfec5+'-'+_0x1e0016+'/'+_0x204343)[_0x6112('0x17')](_0xe90a15);}return null;};}function patchUpdates(_0x411323){return function(_0x41459c){try{jsonpatch['apply'](_0x41459c,_0x411323,!![]);}catch(_0x176414){return BPromise[_0x6112('0x1c')](_0x176414);}return _0x41459c[_0x6112('0x1d')]();};}function saveUpdates(_0xef5ea1,_0x309543){return function(_0x402c0f){if(_0x402c0f){return _0x402c0f[_0x6112('0x1e')](_0xef5ea1)[_0x6112('0x1f')](function(_0x407718){return _0x407718;});}return null;};}function removeEntity(_0x190d53,_0x319b68){return function(_0x1fd260){if(_0x1fd260){return _0x1fd260[_0x6112('0x20')]()[_0x6112('0x1f')](function(){_0x190d53[_0x6112('0x16')](0xcc)[_0x6112('0x21')]();});}};}function handleEntityNotFound(_0x38f1bf,_0x21146e){return function(_0x5b1c88){if(!_0x5b1c88){_0x38f1bf[_0x6112('0x15')](0x194);}return _0x5b1c88;};}function handleError(_0x19ef3c,_0x4ddd7f){_0x4ddd7f=_0x4ddd7f||0x1f4;return function(_0x16222c){logger['error'](_0x16222c[_0x6112('0x22')]);if(_0x16222c[_0x6112('0x23')]){delete _0x16222c['name'];}_0x19ef3c[_0x6112('0x16')](_0x4ddd7f)[_0x6112('0x24')](_0x16222c);};}exports['index']=function(_0x1df4a4,_0x509dc2){var _0x25dcf1={},_0xe1455f={},_0x46a2be={'count':0x0,'rows':[]};var _0x7efb22=_[_0x6112('0x25')](db['ServicenowField']['rawAttributes'],function(_0x14508e){return{'name':_0x14508e['fieldName'],'type':_0x14508e[_0x6112('0x26')][_0x6112('0x27')]};});_0xe1455f[_0x6112('0x28')]=_[_0x6112('0x25')](_0x7efb22,_0x6112('0x23'));_0xe1455f[_0x6112('0x29')]=_[_0x6112('0x2a')](_0x1df4a4['query']);_0xe1455f[_0x6112('0x2b')]=_[_0x6112('0x2c')](_0xe1455f[_0x6112('0x28')],_0xe1455f[_0x6112('0x29')]);_0x25dcf1[_0x6112('0x2d')]=_['intersection'](_0xe1455f[_0x6112('0x28')],qs[_0x6112('0x2e')](_0x1df4a4['query'][_0x6112('0x2e')]));_0x25dcf1[_0x6112('0x2d')]=_0x25dcf1[_0x6112('0x2d')][_0x6112('0x2f')]?_0x25dcf1[_0x6112('0x2d')]:_0xe1455f[_0x6112('0x28')];if(!_0x1df4a4[_0x6112('0x29')]['hasOwnProperty'](_0x6112('0x30'))){_0x25dcf1[_0x6112('0x1a')]=qs['limit'](_0x1df4a4['query'][_0x6112('0x1a')]);_0x25dcf1['offset']=qs['offset'](_0x1df4a4['query']['offset']);}_0x25dcf1['order']=qs['sort'](_0x1df4a4[_0x6112('0x29')][_0x6112('0x31')]);_0x25dcf1[_0x6112('0x32')]=qs[_0x6112('0x2b')](_[_0x6112('0x33')](_0x1df4a4[_0x6112('0x29')],_0xe1455f[_0x6112('0x2b')]),_0x7efb22);if(_0x1df4a4[_0x6112('0x29')]['filter']){_0x25dcf1[_0x6112('0x32')]=_['merge'](_0x25dcf1[_0x6112('0x32')],{'$or':_['map'](_0x7efb22,function(_0x5e2e33){if(_0x5e2e33[_0x6112('0x26')]!==_0x6112('0x34')){var _0x62c25b={};_0x62c25b[_0x5e2e33['name']]={'$like':'%'+_0x1df4a4['query'][_0x6112('0x35')]+'%'};return _0x62c25b;}})});}_0x25dcf1=_[_0x6112('0x36')]({},_0x25dcf1,_0x1df4a4['options']);var _0x4b82bc={'where':_0x25dcf1['where']};return db[_0x6112('0x37')][_0x6112('0x18')](_0x4b82bc)['then'](function(_0x179005){_0x46a2be[_0x6112('0x18')]=_0x179005;if(_0x1df4a4[_0x6112('0x29')]['includeAll']){_0x25dcf1[_0x6112('0x38')]=[{'all':!![]}];}return db[_0x6112('0x37')][_0x6112('0x39')](_0x25dcf1);})[_0x6112('0x1f')](function(_0x93bd63){_0x46a2be[_0x6112('0x3a')]=_0x93bd63;return _0x46a2be;})[_0x6112('0x1f')](respondWithFilteredResult(_0x509dc2,_0x25dcf1))[_0x6112('0x3b')](handleError(_0x509dc2,null));};exports[_0x6112('0x3c')]=function(_0x26781e,_0x2ec2d5){var _0x5ba01f={'raw':!![],'where':{'id':_0x26781e[_0x6112('0x3d')]['id']}},_0x541abd={};_0x541abd['model']=_[_0x6112('0x2a')](db['ServicenowField'][_0x6112('0x3e')]);_0x541abd[_0x6112('0x29')]=_[_0x6112('0x2a')](_0x26781e[_0x6112('0x29')]);_0x541abd[_0x6112('0x2b')]=_[_0x6112('0x2c')](_0x541abd[_0x6112('0x28')],_0x541abd['query']);_0x5ba01f['attributes']=_[_0x6112('0x2c')](_0x541abd[_0x6112('0x28')],qs[_0x6112('0x2e')](_0x26781e[_0x6112('0x29')]['fields']));_0x5ba01f['attributes']=_0x5ba01f['attributes'][_0x6112('0x2f')]?_0x5ba01f[_0x6112('0x2d')]:_0x541abd[_0x6112('0x28')];if(_0x26781e[_0x6112('0x29')]['includeAll']){_0x5ba01f[_0x6112('0x38')]=[{'all':!![]}];}_0x5ba01f=_[_0x6112('0x36')]({},_0x5ba01f,_0x26781e['options']);return db[_0x6112('0x37')][_0x6112('0x3f')](_0x5ba01f)[_0x6112('0x1f')](handleEntityNotFound(_0x2ec2d5,null))[_0x6112('0x1f')](respondWithResult(_0x2ec2d5,null))[_0x6112('0x3b')](handleError(_0x2ec2d5,null));};exports[_0x6112('0x40')]=function(_0x23a6e3,_0x51beb2){return db[_0x6112('0x37')][_0x6112('0x40')](_0x23a6e3[_0x6112('0x41')],{})[_0x6112('0x1f')](respondWithResult(_0x51beb2,0xc9))[_0x6112('0x3b')](handleError(_0x51beb2,null));};exports[_0x6112('0x1e')]=function(_0x561d3c,_0x2ff87d){if(_0x561d3c[_0x6112('0x41')]['id']){delete _0x561d3c[_0x6112('0x41')]['id'];}return db['ServicenowField'][_0x6112('0x3f')]({'where':{'id':_0x561d3c[_0x6112('0x3d')]['id']}})[_0x6112('0x1f')](handleEntityNotFound(_0x2ff87d,null))[_0x6112('0x1f')](saveUpdates(_0x561d3c[_0x6112('0x41')],null))[_0x6112('0x1f')](respondWithResult(_0x2ff87d,null))[_0x6112('0x3b')](handleError(_0x2ff87d,null));};exports[_0x6112('0x20')]=function(_0x302640,_0x16da3c){return db[_0x6112('0x37')][_0x6112('0x3f')]({'where':{'id':_0x302640[_0x6112('0x3d')]['id']}})[_0x6112('0x1f')](handleEntityNotFound(_0x16da3c,null))[_0x6112('0x1f')](removeEntity(_0x16da3c,null))[_0x6112('0x3b')](handleError(_0x16da3c,null));}; \ No newline at end of file +var _0x0e31=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','ServicenowField','findAll','catch','show','params','length','includeAll','include','find','create','body','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x0e31,0x197));var _0x10e3=function(_0x57d160,_0x381043){_0x57d160=_0x57d160-0x0;var _0x30c242=_0x0e31[_0x57d160];return _0x30c242;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x10e3('0x0'));var jsonpatch=require(_0x10e3('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x10e3('0x2'));var Mustache=require('mustache');var util=require(_0x10e3('0x3'));var path=require(_0x10e3('0x4'));var sox=require('sox');var csv=require(_0x10e3('0x5'));var ejs=require(_0x10e3('0x6'));var fs=require('fs');var fs_extra=require(_0x10e3('0x7'));var _=require(_0x10e3('0x8'));var squel=require('squel');var crypto=require(_0x10e3('0x9'));var jsforce=require(_0x10e3('0xa'));var deskjs=require(_0x10e3('0xb'));var toCsv=require(_0x10e3('0x5'));var querystring=require(_0x10e3('0xc'));var Papa=require(_0x10e3('0xd'));var Redis=require(_0x10e3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x10e3('0xf'));var as=require(_0x10e3('0x10'));var hardwareService=require(_0x10e3('0x11'));var logger=require(_0x10e3('0x12'))('api');var utils=require(_0x10e3('0x13'));var config=require(_0x10e3('0x14'));var licenseUtil=require(_0x10e3('0x15'));var db=require(_0x10e3('0x16'))['db'];function respondWithStatusCode(_0x293ee4,_0x128ec2){_0x128ec2=_0x128ec2||0xcc;return function(_0xe1e3b6){if(_0xe1e3b6){return _0x293ee4[_0x10e3('0x17')](_0x128ec2);}return _0x293ee4[_0x10e3('0x18')](_0x128ec2)['end']();};}function respondWithResult(_0x37c645,_0x2bbb00){_0x2bbb00=_0x2bbb00||0xc8;return function(_0x585acc){if(_0x585acc){return _0x37c645['status'](_0x2bbb00)[_0x10e3('0x19')](_0x585acc);}};}function respondWithFilteredResult(_0x510cc6,_0x3f8be6){return function(_0x2b672b){if(_0x2b672b){var _0x2c3a4f=typeof _0x3f8be6[_0x10e3('0x1a')]===_0x10e3('0x1b')&&typeof _0x3f8be6[_0x10e3('0x1c')]===_0x10e3('0x1b');var _0x534e49=_0x2b672b['count'];var _0x3ce9d4=_0x2c3a4f?0x0:_0x3f8be6[_0x10e3('0x1a')];var _0x13ce25=_0x2c3a4f?_0x2b672b[_0x10e3('0x1d')]:_0x3f8be6['offset']+_0x3f8be6[_0x10e3('0x1c')];var _0x37e9ac;if(_0x13ce25>=_0x534e49){_0x13ce25=_0x534e49;_0x37e9ac=0xc8;}else{_0x37e9ac=0xce;}_0x510cc6[_0x10e3('0x18')](_0x37e9ac);return _0x510cc6[_0x10e3('0x1e')](_0x10e3('0x1f'),_0x3ce9d4+'-'+_0x13ce25+'/'+_0x534e49)[_0x10e3('0x19')](_0x2b672b);}return null;};}function patchUpdates(_0x5d91dd){return function(_0x3177c2){try{jsonpatch[_0x10e3('0x20')](_0x3177c2,_0x5d91dd,!![]);}catch(_0xe5e213){return BPromise[_0x10e3('0x21')](_0xe5e213);}return _0x3177c2['save']();};}function saveUpdates(_0x289ba5,_0x3d8507){return function(_0x4cdc5d){if(_0x4cdc5d){return _0x4cdc5d[_0x10e3('0x22')](_0x289ba5)[_0x10e3('0x23')](function(_0x2c57fc){return _0x2c57fc;});}return null;};}function removeEntity(_0x378669,_0x5f4004){return function(_0xa28d1a){if(_0xa28d1a){return _0xa28d1a[_0x10e3('0x24')]()['then'](function(){_0x378669[_0x10e3('0x18')](0xcc)[_0x10e3('0x25')]();});}};}function handleEntityNotFound(_0x1cb2fd,_0x49e1be){return function(_0x20b06a){if(!_0x20b06a){_0x1cb2fd[_0x10e3('0x17')](0x194);}return _0x20b06a;};}function handleError(_0x514a71,_0xf88b20){_0xf88b20=_0xf88b20||0x1f4;return function(_0x11bda9){logger[_0x10e3('0x26')](_0x11bda9[_0x10e3('0x27')]);if(_0x11bda9[_0x10e3('0x28')]){delete _0x11bda9[_0x10e3('0x28')];}_0x514a71[_0x10e3('0x18')](_0xf88b20)['send'](_0x11bda9);};}exports['index']=function(_0x414fd4,_0x4bd0a8){var _0xf4da1d={},_0x51a324={},_0x3cc687={'count':0x0,'rows':[]};var _0x227110=_[_0x10e3('0x29')](db['ServicenowField'][_0x10e3('0x2a')],function(_0x31f5dd){return{'name':_0x31f5dd[_0x10e3('0x2b')],'type':_0x31f5dd[_0x10e3('0x2c')][_0x10e3('0x2d')]};});_0x51a324[_0x10e3('0x2e')]=_[_0x10e3('0x29')](_0x227110,_0x10e3('0x28'));_0x51a324[_0x10e3('0x2f')]=_[_0x10e3('0x30')](_0x414fd4[_0x10e3('0x2f')]);_0x51a324[_0x10e3('0x31')]=_[_0x10e3('0x32')](_0x51a324[_0x10e3('0x2e')],_0x51a324[_0x10e3('0x2f')]);_0xf4da1d[_0x10e3('0x33')]=_['intersection'](_0x51a324[_0x10e3('0x2e')],qs[_0x10e3('0x34')](_0x414fd4[_0x10e3('0x2f')][_0x10e3('0x34')]));_0xf4da1d[_0x10e3('0x33')]=_0xf4da1d['attributes']['length']?_0xf4da1d[_0x10e3('0x33')]:_0x51a324[_0x10e3('0x2e')];if(!_0x414fd4['query'][_0x10e3('0x35')](_0x10e3('0x36'))){_0xf4da1d[_0x10e3('0x1c')]=qs[_0x10e3('0x1c')](_0x414fd4[_0x10e3('0x2f')]['limit']);_0xf4da1d['offset']=qs[_0x10e3('0x1a')](_0x414fd4[_0x10e3('0x2f')][_0x10e3('0x1a')]);}_0xf4da1d[_0x10e3('0x37')]=qs[_0x10e3('0x38')](_0x414fd4[_0x10e3('0x2f')][_0x10e3('0x38')]);_0xf4da1d[_0x10e3('0x39')]=qs[_0x10e3('0x31')](_['pick'](_0x414fd4[_0x10e3('0x2f')],_0x51a324['filters']),_0x227110);if(_0x414fd4[_0x10e3('0x2f')][_0x10e3('0x3a')]){_0xf4da1d[_0x10e3('0x39')]=_[_0x10e3('0x3b')](_0xf4da1d[_0x10e3('0x39')],{'$or':_[_0x10e3('0x29')](_0x227110,function(_0xb4f6d7){if(_0xb4f6d7[_0x10e3('0x2c')]!=='VIRTUAL'){var _0x11aa80={};_0x11aa80[_0xb4f6d7[_0x10e3('0x28')]]={'$like':'%'+_0x414fd4[_0x10e3('0x2f')]['filter']+'%'};return _0x11aa80;}})});}_0xf4da1d=_[_0x10e3('0x3b')]({},_0xf4da1d,_0x414fd4[_0x10e3('0x3c')]);var _0x416b89={'where':_0xf4da1d['where']};return db['ServicenowField'][_0x10e3('0x1d')](_0x416b89)['then'](function(_0x137f8f){_0x3cc687[_0x10e3('0x1d')]=_0x137f8f;if(_0x414fd4[_0x10e3('0x2f')]['includeAll']){_0xf4da1d['include']=[{'all':!![]}];}return db[_0x10e3('0x3d')][_0x10e3('0x3e')](_0xf4da1d);})['then'](function(_0x5ba48d){_0x3cc687['rows']=_0x5ba48d;return _0x3cc687;})[_0x10e3('0x23')](respondWithFilteredResult(_0x4bd0a8,_0xf4da1d))[_0x10e3('0x3f')](handleError(_0x4bd0a8,null));};exports[_0x10e3('0x40')]=function(_0x118be6,_0x411475){var _0x5a07af={'raw':!![],'where':{'id':_0x118be6[_0x10e3('0x41')]['id']}},_0x5284ec={};_0x5284ec[_0x10e3('0x2e')]=_[_0x10e3('0x30')](db['ServicenowField'][_0x10e3('0x2a')]);_0x5284ec[_0x10e3('0x2f')]=_['keys'](_0x118be6['query']);_0x5284ec['filters']=_[_0x10e3('0x32')](_0x5284ec[_0x10e3('0x2e')],_0x5284ec[_0x10e3('0x2f')]);_0x5a07af[_0x10e3('0x33')]=_[_0x10e3('0x32')](_0x5284ec[_0x10e3('0x2e')],qs['fields'](_0x118be6[_0x10e3('0x2f')]['fields']));_0x5a07af['attributes']=_0x5a07af[_0x10e3('0x33')][_0x10e3('0x42')]?_0x5a07af[_0x10e3('0x33')]:_0x5284ec[_0x10e3('0x2e')];if(_0x118be6[_0x10e3('0x2f')][_0x10e3('0x43')]){_0x5a07af[_0x10e3('0x44')]=[{'all':!![]}];}_0x5a07af=_[_0x10e3('0x3b')]({},_0x5a07af,_0x118be6[_0x10e3('0x3c')]);return db[_0x10e3('0x3d')][_0x10e3('0x45')](_0x5a07af)['then'](handleEntityNotFound(_0x411475,null))[_0x10e3('0x23')](respondWithResult(_0x411475,null))[_0x10e3('0x3f')](handleError(_0x411475,null));};exports['create']=function(_0x264e93,_0x46c56a){return db[_0x10e3('0x3d')][_0x10e3('0x46')](_0x264e93[_0x10e3('0x47')],{})[_0x10e3('0x23')](respondWithResult(_0x46c56a,0xc9))[_0x10e3('0x3f')](handleError(_0x46c56a,null));};exports[_0x10e3('0x22')]=function(_0x22bcb8,_0x81e8fb){if(_0x22bcb8['body']['id']){delete _0x22bcb8[_0x10e3('0x47')]['id'];}return db['ServicenowField'][_0x10e3('0x45')]({'where':{'id':_0x22bcb8[_0x10e3('0x41')]['id']}})['then'](handleEntityNotFound(_0x81e8fb,null))[_0x10e3('0x23')](saveUpdates(_0x22bcb8[_0x10e3('0x47')],null))[_0x10e3('0x23')](respondWithResult(_0x81e8fb,null))[_0x10e3('0x3f')](handleError(_0x81e8fb,null));};exports[_0x10e3('0x24')]=function(_0x416016,_0x4e5e5c){return db[_0x10e3('0x3d')][_0x10e3('0x45')]({'where':{'id':_0x416016[_0x10e3('0x41')]['id']}})[_0x10e3('0x23')](handleEntityNotFound(_0x4e5e5c,null))[_0x10e3('0x23')](removeEntity(_0x4e5e5c,null))[_0x10e3('0x3f')](handleError(_0x4e5e5c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 46f0944..c92478b 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 _0x897f=['int_servicenow_fields','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ServicenowField'];(function(_0x4de97b,_0x4ed904){var _0x150c07=function(_0x45ff52){while(--_0x45ff52){_0x4de97b['push'](_0x4de97b['shift']());}};_0x150c07(++_0x4ed904);}(_0x897f,0x1b5));var _0xf897=function(_0x9e76d,_0x44e7a0){_0x9e76d=_0x9e76d-0x0;var _0x320985=_0x897f[_0x9e76d];return _0x320985;};'use strict';var _=require(_0xf897('0x0'));var util=require('util');var logger=require(_0xf897('0x1'))(_0xf897('0x2'));var moment=require(_0xf897('0x3'));var BPromise=require(_0xf897('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf897('0x5'));var rimraf=require(_0xf897('0x6'));var config=require(_0xf897('0x7'));var attributes=require('./intServicenowField.attributes');module[_0xf897('0x8')]=function(_0x28b643,_0x5f2058){return _0x28b643[_0xf897('0x9')](_0xf897('0xa'),attributes,{'tableName':_0xf897('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xf897('0xc'),_0xf897('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd47f=['int_servicenow_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x196e1b,_0x55fa06){var _0x5e1f18=function(_0x3bdb41){while(--_0x3bdb41){_0x196e1b['push'](_0x196e1b['shift']());}};_0x5e1f18(++_0x55fa06);}(_0xd47f,0x1bd));var _0xfd47=function(_0x5be1d6,_0x52ab2a){_0x5be1d6=_0x5be1d6-0x0;var _0x5d9bd4=_0xd47f[_0x5be1d6];return _0x5d9bd4;};'use strict';var _=require(_0xfd47('0x0'));var util=require('util');var logger=require(_0xfd47('0x1'))(_0xfd47('0x2'));var moment=require(_0xfd47('0x3'));var BPromise=require(_0xfd47('0x4'));var rp=require(_0xfd47('0x5'));var fs=require('fs');var path=require(_0xfd47('0x6'));var rimraf=require(_0xfd47('0x7'));var config=require(_0xfd47('0x8'));var attributes=require(_0xfd47('0x9'));module[_0xfd47('0xa')]=function(_0x29f81d,_0x2103a0){return _0x29f81d['define']('ServicenowField',attributes,{'tableName':_0xfd47('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField','FieldId'],'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 0b51f9b..48a539b 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x34dd0e,_0x1f965b){_0x34dd0e=_0x34dd0e-0x0;var _0x7ac476=_0xbdb7[_0x34dd0e];return _0x7ac476;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x843547,_0x2d3002){var _0x1f4e30=function(_0x25787d){while(--_0x25787d){_0x843547['push'](_0x843547['shift']());}};_0x1f4e30(++_0x2d3002);}(_0x70e0,0x17b));var _0x070e=function(_0x245d96,_0x2a398c){_0x245d96=_0x245d96-0x0;var _0x2bb8b1=_0x70e0[_0x245d96];return _0x2bb8b1;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 48674ad..1796871 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(_0x993da8,_0x4637f9){var _0x38f22b=function(_0x4394a1){while(--_0x4394a1){_0x993da8['push'](_0x993da8['shift']());}};_0x38f22b(++_0x4637f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 _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(_0x3aa52d,_0x10ccf1){var _0x1108b8=function(_0x10a516){while(--_0x10a516){_0x3aa52d['push'](_0x3aa52d['shift']());}};_0x1108b8(++_0x10ccf1);}(_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 diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 02c94c3..8c5a7a3 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(_0x296caa,_0xaa639d){var _0x23e450=function(_0x2739ff){while(--_0x2739ff){_0x296caa['push'](_0x296caa['shift']());}};_0x23e450(++_0xaa639d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x590d76,_0x248f9e){var _0xa0afd4=function(_0x5f2a95){while(--_0x5f2a95){_0x590d76['push'](_0x590d76['shift']());}};_0xa0afd4(++_0x248f9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 f904136..ac39933 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 _0xeea7=['substring','POST','%s%s','/service/v4_1/rest.php','login','stringify','username','password','PLAIN','Password\x20Expired','format','JSON','Calls','values','remove','label','value','test','statusCode','error','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','then','send','map','SugarcrmAccount','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','include','create','update','body','find','destroy','findOne','SugarcrmConfiguration','order','addConfiguration','Descriptions','channel','SugarcrmField','Subjects','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','slice'];(function(_0x345a02,_0x448c3f){var _0x5d44c2=function(_0x71cc74){while(--_0x71cc74){_0x345a02['push'](_0x345a02['shift']());}};_0x5d44c2(++_0x448c3f);}(_0xeea7,0xf3));var _0x7eea=function(_0x1c1a78,_0x1db675){_0x1c1a78=_0x1c1a78-0x0;var _0x4977b9=_0xeea7[_0x1c1a78];return _0x4977b9;};'use strict';var emlformat=require(_0x7eea('0x0'));var rimraf=require(_0x7eea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7eea('0x2'));var moment=require(_0x7eea('0x3'));var BPromise=require(_0x7eea('0x4'));var Mustache=require(_0x7eea('0x5'));var util=require('util');var path=require(_0x7eea('0x6'));var sox=require(_0x7eea('0x7'));var csv=require(_0x7eea('0x8'));var ejs=require(_0x7eea('0x9'));var fs=require('fs');var fs_extra=require(_0x7eea('0xa'));var _=require('lodash');var squel=require(_0x7eea('0xb'));var crypto=require('crypto');var jsforce=require(_0x7eea('0xc'));var deskjs=require(_0x7eea('0xd'));var toCsv=require(_0x7eea('0x8'));var querystring=require(_0x7eea('0xe'));var Papa=require(_0x7eea('0xf'));var Redis=require(_0x7eea('0x10'));var authService=require(_0x7eea('0x11'));var qs=require(_0x7eea('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7eea('0x13'))(_0x7eea('0x14'));var utils=require(_0x7eea('0x15'));var config=require(_0x7eea('0x16'));var licenseUtil=require(_0x7eea('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7eea('0x18'));function respondWithStatusCode(_0x357b34,_0x31a58f){_0x31a58f=_0x31a58f||0xcc;return function(_0x2aa74c){if(_0x2aa74c){return _0x357b34[_0x7eea('0x19')](_0x31a58f);}return _0x357b34[_0x7eea('0x1a')](_0x31a58f)[_0x7eea('0x1b')]();};}function respondWithResult(_0x20db65,_0x547c78){_0x547c78=_0x547c78||0xc8;return function(_0x591572){if(_0x591572){return _0x20db65['status'](_0x547c78)['json'](_0x591572);}};}function respondWithFilteredResult(_0x11ba5a,_0x5ce5c8){return function(_0x20f9d7){if(_0x20f9d7){var _0x4e4a33=typeof _0x5ce5c8[_0x7eea('0x1c')]===_0x7eea('0x1d')&&typeof _0x5ce5c8['limit']===_0x7eea('0x1d');var _0x209f0c=_0x20f9d7[_0x7eea('0x1e')];var _0xfa200f=_0x4e4a33?0x0:_0x5ce5c8['offset'];var _0xfdc4e0=_0x4e4a33?_0x20f9d7[_0x7eea('0x1e')]:_0x5ce5c8[_0x7eea('0x1c')]+_0x5ce5c8[_0x7eea('0x1f')];var _0x3fed9c;if(_0xfdc4e0>=_0x209f0c){_0xfdc4e0=_0x209f0c;_0x3fed9c=0xc8;}else{_0x3fed9c=0xce;}_0x11ba5a['status'](_0x3fed9c);return _0x11ba5a[_0x7eea('0x20')](_0x7eea('0x21'),_0xfa200f+'-'+_0xfdc4e0+'/'+_0x209f0c)['json'](_0x20f9d7);}return null;};}function patchUpdates(_0x16a46f){return function(_0x5f27a4){try{jsonpatch[_0x7eea('0x22')](_0x5f27a4,_0x16a46f,!![]);}catch(_0x5b8782){return BPromise[_0x7eea('0x23')](_0x5b8782);}return _0x5f27a4['save']();};}function saveUpdates(_0x5135dc,_0x55f0b9){return function(_0x116945){if(_0x116945){return _0x116945['update'](_0x5135dc)['then'](function(_0x15b243){return _0x15b243;});}return null;};}function removeEntity(_0x206556,_0x4f32a3){return function(_0x20c31e){if(_0x20c31e){return _0x20c31e['destroy']()[_0x7eea('0x24')](function(){_0x206556['status'](0xcc)[_0x7eea('0x1b')]();});}};}function handleEntityNotFound(_0x1f068e,_0x5395e7){return function(_0x332632){if(!_0x332632){_0x1f068e[_0x7eea('0x19')](0x194);}return _0x332632;};}function handleError(_0x1f341e,_0x1534f1){_0x1534f1=_0x1534f1||0x1f4;return function(_0x450c88){logger['error'](_0x450c88['stack']);if(_0x450c88['name']){delete _0x450c88['name'];}_0x1f341e[_0x7eea('0x1a')](_0x1534f1)[_0x7eea('0x25')](_0x450c88);};}exports['index']=function(_0x319891,_0x539b08){var _0x2d9b41={},_0x8bc1c2={},_0x22d62d={'count':0x0,'rows':[]};var _0x42eed5=_[_0x7eea('0x26')](db[_0x7eea('0x27')][_0x7eea('0x28')],function(_0x7c2c2b){return{'name':_0x7c2c2b['fieldName'],'type':_0x7c2c2b[_0x7eea('0x29')][_0x7eea('0x2a')]};});_0x8bc1c2['model']=_['map'](_0x42eed5,_0x7eea('0x2b'));_0x8bc1c2[_0x7eea('0x2c')]=_[_0x7eea('0x2d')](_0x319891[_0x7eea('0x2c')]);_0x8bc1c2[_0x7eea('0x2e')]=_[_0x7eea('0x2f')](_0x8bc1c2[_0x7eea('0x30')],_0x8bc1c2[_0x7eea('0x2c')]);_0x2d9b41[_0x7eea('0x31')]=_[_0x7eea('0x2f')](_0x8bc1c2[_0x7eea('0x30')],qs[_0x7eea('0x32')](_0x319891['query'][_0x7eea('0x32')]));_0x2d9b41[_0x7eea('0x31')]=_0x2d9b41['attributes'][_0x7eea('0x33')]?_0x2d9b41['attributes']:_0x8bc1c2[_0x7eea('0x30')];if(!_0x319891[_0x7eea('0x2c')][_0x7eea('0x34')](_0x7eea('0x35'))){_0x2d9b41[_0x7eea('0x1f')]=qs[_0x7eea('0x1f')](_0x319891[_0x7eea('0x2c')][_0x7eea('0x1f')]);_0x2d9b41[_0x7eea('0x1c')]=qs[_0x7eea('0x1c')](_0x319891['query']['offset']);}_0x2d9b41['order']=qs[_0x7eea('0x36')](_0x319891['query'][_0x7eea('0x36')]);_0x2d9b41[_0x7eea('0x37')]=qs[_0x7eea('0x2e')](_[_0x7eea('0x38')](_0x319891[_0x7eea('0x2c')],_0x8bc1c2['filters']),_0x42eed5);if(_0x319891['query']['filter']){_0x2d9b41[_0x7eea('0x37')]=_[_0x7eea('0x39')](_0x2d9b41[_0x7eea('0x37')],{'$or':_[_0x7eea('0x26')](_0x42eed5,function(_0x188248){if(_0x188248['type']!==_0x7eea('0x3a')){var _0x5a98d2={};_0x5a98d2[_0x188248[_0x7eea('0x2b')]]={'$like':'%'+_0x319891[_0x7eea('0x2c')][_0x7eea('0x3b')]+'%'};return _0x5a98d2;}})});}_0x2d9b41=_[_0x7eea('0x39')]({},_0x2d9b41,_0x319891[_0x7eea('0x3c')]);var _0x1e6dd0={'where':_0x2d9b41[_0x7eea('0x37')]};return db['SugarcrmAccount'][_0x7eea('0x1e')](_0x1e6dd0)[_0x7eea('0x24')](function(_0x1b01df){_0x22d62d[_0x7eea('0x1e')]=_0x1b01df;if(_0x319891[_0x7eea('0x2c')][_0x7eea('0x3d')]){_0x2d9b41['include']=[{'all':!![]}];}return db[_0x7eea('0x27')][_0x7eea('0x3e')](_0x2d9b41);})[_0x7eea('0x24')](function(_0x5ed7fd){_0x22d62d['rows']=_0x5ed7fd;return _0x22d62d;})[_0x7eea('0x24')](respondWithFilteredResult(_0x539b08,_0x2d9b41))[_0x7eea('0x3f')](handleError(_0x539b08,null));};exports[_0x7eea('0x40')]=function(_0x5b0bc9,_0x1ed02e){var _0x5cde1b={'raw':![],'where':{'id':_0x5b0bc9[_0x7eea('0x41')]['id']}},_0x18a858={};_0x18a858[_0x7eea('0x30')]=_[_0x7eea('0x2d')](db[_0x7eea('0x27')][_0x7eea('0x28')]);_0x18a858[_0x7eea('0x2c')]=_[_0x7eea('0x2d')](_0x5b0bc9[_0x7eea('0x2c')]);_0x18a858[_0x7eea('0x2e')]=_['intersection'](_0x18a858[_0x7eea('0x30')],_0x18a858[_0x7eea('0x2c')]);_0x5cde1b[_0x7eea('0x31')]=_['intersection'](_0x18a858[_0x7eea('0x30')],qs[_0x7eea('0x32')](_0x5b0bc9[_0x7eea('0x2c')]['fields']));_0x5cde1b[_0x7eea('0x31')]=_0x5cde1b[_0x7eea('0x31')]['length']?_0x5cde1b[_0x7eea('0x31')]:_0x18a858[_0x7eea('0x30')];if(_0x5b0bc9[_0x7eea('0x2c')]['includeAll']){_0x5cde1b[_0x7eea('0x42')]=[{'all':!![]}];}_0x5cde1b=_['merge']({},_0x5cde1b,_0x5b0bc9[_0x7eea('0x3c')]);return db['SugarcrmAccount']['find'](_0x5cde1b)[_0x7eea('0x24')](handleEntityNotFound(_0x1ed02e,null))[_0x7eea('0x24')](respondWithResult(_0x1ed02e,null))['catch'](handleError(_0x1ed02e,null));};exports[_0x7eea('0x43')]=function(_0x422a68,_0x28255d){return db['SugarcrmAccount'][_0x7eea('0x43')](_0x422a68['body'],{})[_0x7eea('0x24')](respondWithResult(_0x28255d,0xc9))[_0x7eea('0x3f')](handleError(_0x28255d,null));};exports[_0x7eea('0x44')]=function(_0xd1dd60,_0x1d1d07){if(_0xd1dd60[_0x7eea('0x45')]['id']){delete _0xd1dd60['body']['id'];}return db[_0x7eea('0x27')][_0x7eea('0x46')]({'where':{'id':_0xd1dd60[_0x7eea('0x41')]['id']}})[_0x7eea('0x24')](handleEntityNotFound(_0x1d1d07,null))[_0x7eea('0x24')](saveUpdates(_0xd1dd60[_0x7eea('0x45')],null))[_0x7eea('0x24')](respondWithResult(_0x1d1d07,null))[_0x7eea('0x3f')](handleError(_0x1d1d07,null));};exports[_0x7eea('0x47')]=function(_0x4affe9,_0x264b2c){return db['SugarcrmAccount'][_0x7eea('0x46')]({'where':{'id':_0x4affe9[_0x7eea('0x41')]['id']}})[_0x7eea('0x24')](handleEntityNotFound(_0x264b2c,null))[_0x7eea('0x24')](removeEntity(_0x264b2c,null))[_0x7eea('0x3f')](handleError(_0x264b2c,null));};exports['getConfigurations']=function(_0x447ee9,_0x2f3b65,_0x16485b){var _0x2c5da8={};var _0x1b5235={};var _0x12bab9;var _0x5f55f7;return db['SugarcrmAccount'][_0x7eea('0x48')]({'where':{'id':_0x447ee9['params']['id']}})['then'](handleEntityNotFound(_0x2f3b65,null))[_0x7eea('0x24')](function(_0x1e70d5){if(_0x1e70d5){_0x12bab9=_0x1e70d5;_0x1b5235[_0x7eea('0x30')]=_[_0x7eea('0x2d')](db[_0x7eea('0x49')][_0x7eea('0x28')]);_0x1b5235[_0x7eea('0x2c')]=_[_0x7eea('0x2d')](_0x447ee9[_0x7eea('0x2c')]);_0x1b5235[_0x7eea('0x2e')]=_[_0x7eea('0x2f')](_0x1b5235[_0x7eea('0x30')],_0x1b5235[_0x7eea('0x2c')]);_0x2c5da8[_0x7eea('0x31')]=_[_0x7eea('0x2f')](_0x1b5235['model'],qs[_0x7eea('0x32')](_0x447ee9[_0x7eea('0x2c')]['fields']));_0x2c5da8['attributes']=_0x2c5da8['attributes'][_0x7eea('0x33')]?_0x2c5da8[_0x7eea('0x31')]:_0x1b5235['model'];_0x2c5da8[_0x7eea('0x4a')]=qs['sort'](_0x447ee9[_0x7eea('0x2c')]['sort']);_0x2c5da8['where']=qs['filters'](_[_0x7eea('0x38')](_0x447ee9[_0x7eea('0x2c')],_0x1b5235['filters']));if(_0x447ee9[_0x7eea('0x2c')][_0x7eea('0x3b')]){_0x2c5da8[_0x7eea('0x37')]=_[_0x7eea('0x39')](_0x2c5da8['where'],{'$or':_['map'](_0x2c5da8[_0x7eea('0x31')],function(_0x51124f){var _0xeaec72={};_0xeaec72[_0x51124f]={'$like':'%'+_0x447ee9['query'][_0x7eea('0x3b')]+'%'};return _0xeaec72;})});}_0x2c5da8=_[_0x7eea('0x39')]({},_0x2c5da8,_0x447ee9[_0x7eea('0x3c')]);return _0x12bab9['getConfigurations'](_0x2c5da8);}})['then'](function(_0x4bf1c2){if(_0x4bf1c2){_0x5f55f7=_0x4bf1c2[_0x7eea('0x33')];if(!_0x447ee9[_0x7eea('0x2c')][_0x7eea('0x34')](_0x7eea('0x35'))){_0x2c5da8[_0x7eea('0x1f')]=qs[_0x7eea('0x1f')](_0x447ee9[_0x7eea('0x2c')][_0x7eea('0x1f')]);_0x2c5da8['offset']=qs[_0x7eea('0x1c')](_0x447ee9[_0x7eea('0x2c')][_0x7eea('0x1c')]);}return _0x12bab9['getConfigurations'](_0x2c5da8);}})[_0x7eea('0x24')](function(_0x41f548){if(_0x41f548){return _0x41f548?{'count':_0x5f55f7,'rows':_0x41f548}:null;}})[_0x7eea('0x24')](respondWithResult(_0x2f3b65,null))['catch'](handleError(_0x2f3b65,null));};exports[_0x7eea('0x4b')]=function(_0x2f1cc1,_0x2a2367,_0x52a7d8){if(_0x2f1cc1[_0x7eea('0x45')]['id']){delete _0x2f1cc1[_0x7eea('0x45')]['id'];}return db[_0x7eea('0x27')][_0x7eea('0x48')]({'where':{'id':_0x2f1cc1[_0x7eea('0x41')]['id']}})[_0x7eea('0x24')](handleEntityNotFound(_0x2a2367,null))[_0x7eea('0x24')](function(_0x3594a5){if(_0x3594a5){_0x2f1cc1[_0x7eea('0x45')]['AccountId']=_0x3594a5['id'];_0x2f1cc1[_0x7eea('0x45')]['Subjects']=integrations['getSubjects'](_0x2f1cc1[_0x7eea('0x45')]['channel'],_0x2f1cc1['body'][_0x7eea('0x29')]);_0x2f1cc1[_0x7eea('0x45')][_0x7eea('0x4c')]=integrations['getDescriptions'](_0x2f1cc1[_0x7eea('0x45')][_0x7eea('0x4d')],_0x2f1cc1[_0x7eea('0x45')][_0x7eea('0x29')]);return db['SugarcrmConfiguration'][_0x7eea('0x43')](_0x2f1cc1[_0x7eea('0x45')],{'include':[{'model':db[_0x7eea('0x4e')],'as':_0x7eea('0x4f')},{'model':db[_0x7eea('0x4e')],'as':_0x7eea('0x4c')}]});}return null;})[_0x7eea('0x24')](respondWithResult(_0x2a2367,null))['catch'](handleError(_0x2a2367,null));};exports['getFields']=function(_0x2da2d5,_0x24183d,_0x350775){var _0xc5529f='';var _0xd2a63=['id',_0x7eea('0x2b'),_0x7eea('0x50'),_0x7eea('0x51'),'description',_0x7eea('0x52'),_0x7eea('0x53'),_0x7eea('0x54'),_0x7eea('0x55'),_0x7eea('0x56'),_0x7eea('0x57'),_0x7eea('0x58')];return db[_0x7eea('0x27')][_0x7eea('0x48')]({'where':{'id':_0x2da2d5[_0x7eea('0x41')]['id']},'attributes':['id','username','password','remoteUri']})[_0x7eea('0x24')](handleEntityNotFound(_0x24183d,null))['then'](function(_0x254146){if(_0x254146){_0xc5529f=_0x254146['remoteUri'];var _0xce6c91=_0xc5529f[_0x7eea('0x59')](-0x1);if(_0xce6c91==='/'){_0xc5529f=_0xc5529f[_0x7eea('0x5a')](0x0,_0xc5529f['lastIndexOf'](_0xce6c91));}return rp({'method':_0x7eea('0x5b'),'uri':util['format'](_0x7eea('0x5c'),_0xc5529f,_0x7eea('0x5d')),'json':!![],'form':{'method':_0x7eea('0x5e'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x7eea('0x5f')]({'user_auth':{'user_name':_0x254146[_0x7eea('0x60')],'password':_0x254146[_0x7eea('0x61')],'encryption':_0x7eea('0x62')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x7eea('0x24')](function(_0x1e7021){if(_0x1e7021&&_0x1e7021[_0x7eea('0x2b')]!=='Invalid\x20Login'&&_0x1e7021['name']!==_0x7eea('0x63')){return rp({'method':_0x7eea('0x5b'),'uri':util[_0x7eea('0x64')](_0x7eea('0x5c'),_0xc5529f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x7eea('0x65'),'response_type':_0x7eea('0x65'),'rest_data':JSON['stringify']({'session':_0x1e7021['id'],'module_name':_0x7eea('0x66')})}})[_0x7eea('0x24')](function(_0x448eb3){if(_0x448eb3){var _0x56c585=_[_0x7eea('0x67')](_0x448eb3['module_fields']);_[_0x7eea('0x68')](_0x56c585,function(_0x3ee6dd){return _0xd2a63['includes'](_0x3ee6dd[_0x7eea('0x2b')]);});return{'count':_0x56c585[_0x7eea('0x33')],'rows':_[_0x7eea('0x26')](_0x56c585,function(_0x179154){return{'id':_0x179154[_0x7eea('0x2b')],'name':_0x179154[_0x7eea('0x69')],'custom':_['endsWith'](_0x179154['name'],'_c')?!![]:![],'options':_0x179154[_0x7eea('0x3c')]?_[_0x7eea('0x26')](_[_0x7eea('0x67')](_0x179154[_0x7eea('0x3c')]),function(_0x29248c){return{'name':_0x29248c[_0x7eea('0x6a')],'value':_0x29248c[_0x7eea('0x2b')]};}):[]};})};}})[_0x7eea('0x24')](respondWithResult(_0x24183d,null))[_0x7eea('0x3f')](function(_0x1a3d9c){var _0x5d21f6=_0x2da2d5[_0x7eea('0x2c')][_0x7eea('0x6b')]?0x1f4:_0x1a3d9c[_0x7eea('0x6c')]||0x1f4;logger[_0x7eea('0x6d')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5d21f6,JSON['stringify'](_0x1a3d9c));delete _0x1a3d9c[_0x7eea('0x2b')];if(_0x5d21f6===0x191){_0x5d21f6=0x190;}_0x24183d[_0x7eea('0x1a')](_0x5d21f6)[_0x7eea('0x25')](_0x2da2d5[_0x7eea('0x2c')][_0x7eea('0x6b')]?{'message':_0x7eea('0x6e'),'statusCode':_0x1a3d9c['statusCode']}:_0x1a3d9c);});}else{var _0x2ea1aa=0x1f4;_0x24183d[_0x7eea('0x1a')](_0x2ea1aa)['send']({'message':_0x7eea('0x6e'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xd3f5=['params','length','include','options','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','AccountId','getSubjects','channel','type','Descriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','Calls','values','module_fields','remove','value','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','index','SugarcrmAccount','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show'];(function(_0x38a050,_0x146a74){var _0x373062=function(_0xde6d5d){while(--_0xde6d5d){_0x38a050['push'](_0x38a050['shift']());}};_0x373062(++_0x146a74);}(_0xd3f5,0x12b));var _0x5d3f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3f5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5d3f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d3f('0x1'));var jsonpatch=require(_0x5d3f('0x2'));var rp=require(_0x5d3f('0x3'));var moment=require(_0x5d3f('0x4'));var BPromise=require(_0x5d3f('0x5'));var Mustache=require(_0x5d3f('0x6'));var util=require(_0x5d3f('0x7'));var path=require(_0x5d3f('0x8'));var sox=require(_0x5d3f('0x9'));var csv=require(_0x5d3f('0xa'));var ejs=require(_0x5d3f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5d3f('0xc'));var crypto=require(_0x5d3f('0xd'));var jsforce=require(_0x5d3f('0xe'));var deskjs=require(_0x5d3f('0xf'));var toCsv=require(_0x5d3f('0xa'));var querystring=require('querystring');var Papa=require(_0x5d3f('0x10'));var Redis=require(_0x5d3f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5d3f('0x12'));var as=require(_0x5d3f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d3f('0x14'))('api');var utils=require(_0x5d3f('0x15'));var config=require(_0x5d3f('0x16'));var licenseUtil=require(_0x5d3f('0x17'));var db=require(_0x5d3f('0x18'))['db'];var integrations=require(_0x5d3f('0x19'));function respondWithStatusCode(_0x56c59d,_0x29137e){_0x29137e=_0x29137e||0xcc;return function(_0x57d048){if(_0x57d048){return _0x56c59d['sendStatus'](_0x29137e);}return _0x56c59d[_0x5d3f('0x1a')](_0x29137e)['end']();};}function respondWithResult(_0x23c564,_0x411f72){_0x411f72=_0x411f72||0xc8;return function(_0x34f507){if(_0x34f507){return _0x23c564['status'](_0x411f72)[_0x5d3f('0x1b')](_0x34f507);}};}function respondWithFilteredResult(_0x1fb6a7,_0x10ee8a){return function(_0x3366a8){if(_0x3366a8){var _0x16e8a2=typeof _0x10ee8a['offset']===_0x5d3f('0x1c')&&typeof _0x10ee8a[_0x5d3f('0x1d')]===_0x5d3f('0x1c');var _0x4c778c=_0x3366a8[_0x5d3f('0x1e')];var _0x2a4653=_0x16e8a2?0x0:_0x10ee8a[_0x5d3f('0x1f')];var _0x4d3d4b=_0x16e8a2?_0x3366a8['count']:_0x10ee8a[_0x5d3f('0x1f')]+_0x10ee8a[_0x5d3f('0x1d')];var _0x400632;if(_0x4d3d4b>=_0x4c778c){_0x4d3d4b=_0x4c778c;_0x400632=0xc8;}else{_0x400632=0xce;}_0x1fb6a7[_0x5d3f('0x1a')](_0x400632);return _0x1fb6a7['set'](_0x5d3f('0x20'),_0x2a4653+'-'+_0x4d3d4b+'/'+_0x4c778c)[_0x5d3f('0x1b')](_0x3366a8);}return null;};}function patchUpdates(_0x5cc5db){return function(_0x3146a7){try{jsonpatch[_0x5d3f('0x21')](_0x3146a7,_0x5cc5db,!![]);}catch(_0x26bfb7){return BPromise['reject'](_0x26bfb7);}return _0x3146a7['save']();};}function saveUpdates(_0x56730a,_0x3f4b91){return function(_0x1e3119){if(_0x1e3119){return _0x1e3119[_0x5d3f('0x22')](_0x56730a)[_0x5d3f('0x23')](function(_0x536ef4){return _0x536ef4;});}return null;};}function removeEntity(_0x3f554e,_0x3210c4){return function(_0x2b2bf2){if(_0x2b2bf2){return _0x2b2bf2[_0x5d3f('0x24')]()[_0x5d3f('0x23')](function(){_0x3f554e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a42c0,_0x1fd40d){return function(_0x1c9786){if(!_0x1c9786){_0x5a42c0[_0x5d3f('0x25')](0x194);}return _0x1c9786;};}function handleError(_0x4bf86f,_0xb61d97){_0xb61d97=_0xb61d97||0x1f4;return function(_0x2f59d0){logger[_0x5d3f('0x26')](_0x2f59d0[_0x5d3f('0x27')]);if(_0x2f59d0['name']){delete _0x2f59d0[_0x5d3f('0x28')];}_0x4bf86f[_0x5d3f('0x1a')](_0xb61d97)['send'](_0x2f59d0);};}exports[_0x5d3f('0x29')]=function(_0x813ebf,_0x15b951){var _0x1bfc9e={},_0x1cb8ab={},_0x30b299={'count':0x0,'rows':[]};var _0x184e25=_['map'](db[_0x5d3f('0x2a')][_0x5d3f('0x2b')],function(_0x5796cb){return{'name':_0x5796cb[_0x5d3f('0x2c')],'type':_0x5796cb['type'][_0x5d3f('0x2d')]};});_0x1cb8ab['model']=_[_0x5d3f('0x2e')](_0x184e25,_0x5d3f('0x28'));_0x1cb8ab[_0x5d3f('0x2f')]=_[_0x5d3f('0x30')](_0x813ebf[_0x5d3f('0x2f')]);_0x1cb8ab[_0x5d3f('0x31')]=_[_0x5d3f('0x32')](_0x1cb8ab[_0x5d3f('0x33')],_0x1cb8ab[_0x5d3f('0x2f')]);_0x1bfc9e[_0x5d3f('0x34')]=_['intersection'](_0x1cb8ab[_0x5d3f('0x33')],qs['fields'](_0x813ebf[_0x5d3f('0x2f')][_0x5d3f('0x35')]));_0x1bfc9e[_0x5d3f('0x34')]=_0x1bfc9e['attributes']['length']?_0x1bfc9e[_0x5d3f('0x34')]:_0x1cb8ab[_0x5d3f('0x33')];if(!_0x813ebf[_0x5d3f('0x2f')][_0x5d3f('0x36')](_0x5d3f('0x37'))){_0x1bfc9e[_0x5d3f('0x1d')]=qs[_0x5d3f('0x1d')](_0x813ebf[_0x5d3f('0x2f')][_0x5d3f('0x1d')]);_0x1bfc9e[_0x5d3f('0x1f')]=qs[_0x5d3f('0x1f')](_0x813ebf[_0x5d3f('0x2f')][_0x5d3f('0x1f')]);}_0x1bfc9e['order']=qs[_0x5d3f('0x38')](_0x813ebf[_0x5d3f('0x2f')][_0x5d3f('0x38')]);_0x1bfc9e[_0x5d3f('0x39')]=qs['filters'](_[_0x5d3f('0x3a')](_0x813ebf['query'],_0x1cb8ab['filters']),_0x184e25);if(_0x813ebf[_0x5d3f('0x2f')][_0x5d3f('0x3b')]){_0x1bfc9e[_0x5d3f('0x39')]=_[_0x5d3f('0x3c')](_0x1bfc9e[_0x5d3f('0x39')],{'$or':_[_0x5d3f('0x2e')](_0x184e25,function(_0x26f3a6){if(_0x26f3a6['type']!==_0x5d3f('0x3d')){var _0x5ceb31={};_0x5ceb31[_0x26f3a6[_0x5d3f('0x28')]]={'$like':'%'+_0x813ebf[_0x5d3f('0x2f')][_0x5d3f('0x3b')]+'%'};return _0x5ceb31;}})});}_0x1bfc9e=_[_0x5d3f('0x3c')]({},_0x1bfc9e,_0x813ebf['options']);var _0x41ffa1={'where':_0x1bfc9e['where']};return db[_0x5d3f('0x2a')][_0x5d3f('0x1e')](_0x41ffa1)['then'](function(_0x5cc7ab){_0x30b299[_0x5d3f('0x1e')]=_0x5cc7ab;if(_0x813ebf[_0x5d3f('0x2f')][_0x5d3f('0x3e')]){_0x1bfc9e['include']=[{'all':!![]}];}return db[_0x5d3f('0x2a')][_0x5d3f('0x3f')](_0x1bfc9e);})['then'](function(_0x3e16e7){_0x30b299[_0x5d3f('0x40')]=_0x3e16e7;return _0x30b299;})[_0x5d3f('0x23')](respondWithFilteredResult(_0x15b951,_0x1bfc9e))[_0x5d3f('0x41')](handleError(_0x15b951,null));};exports[_0x5d3f('0x42')]=function(_0x506b58,_0x55c53f){var _0x5ecb51={'raw':![],'where':{'id':_0x506b58[_0x5d3f('0x43')]['id']}},_0x14af92={};_0x14af92[_0x5d3f('0x33')]=_[_0x5d3f('0x30')](db['SugarcrmAccount'][_0x5d3f('0x2b')]);_0x14af92[_0x5d3f('0x2f')]=_['keys'](_0x506b58[_0x5d3f('0x2f')]);_0x14af92[_0x5d3f('0x31')]=_[_0x5d3f('0x32')](_0x14af92[_0x5d3f('0x33')],_0x14af92[_0x5d3f('0x2f')]);_0x5ecb51['attributes']=_[_0x5d3f('0x32')](_0x14af92[_0x5d3f('0x33')],qs['fields'](_0x506b58[_0x5d3f('0x2f')]['fields']));_0x5ecb51[_0x5d3f('0x34')]=_0x5ecb51[_0x5d3f('0x34')][_0x5d3f('0x44')]?_0x5ecb51[_0x5d3f('0x34')]:_0x14af92[_0x5d3f('0x33')];if(_0x506b58['query'][_0x5d3f('0x3e')]){_0x5ecb51[_0x5d3f('0x45')]=[{'all':!![]}];}_0x5ecb51=_[_0x5d3f('0x3c')]({},_0x5ecb51,_0x506b58[_0x5d3f('0x46')]);return db[_0x5d3f('0x2a')][_0x5d3f('0x47')](_0x5ecb51)[_0x5d3f('0x23')](handleEntityNotFound(_0x55c53f,null))[_0x5d3f('0x23')](respondWithResult(_0x55c53f,null))[_0x5d3f('0x41')](handleError(_0x55c53f,null));};exports[_0x5d3f('0x48')]=function(_0x530dd1,_0x2ca680){return db[_0x5d3f('0x2a')][_0x5d3f('0x48')](_0x530dd1['body'],{})[_0x5d3f('0x23')](respondWithResult(_0x2ca680,0xc9))[_0x5d3f('0x41')](handleError(_0x2ca680,null));};exports[_0x5d3f('0x22')]=function(_0x3facb7,_0x319d4e){if(_0x3facb7[_0x5d3f('0x49')]['id']){delete _0x3facb7[_0x5d3f('0x49')]['id'];}return db['SugarcrmAccount'][_0x5d3f('0x47')]({'where':{'id':_0x3facb7[_0x5d3f('0x43')]['id']}})['then'](handleEntityNotFound(_0x319d4e,null))[_0x5d3f('0x23')](saveUpdates(_0x3facb7[_0x5d3f('0x49')],null))[_0x5d3f('0x23')](respondWithResult(_0x319d4e,null))['catch'](handleError(_0x319d4e,null));};exports[_0x5d3f('0x24')]=function(_0xc70396,_0x298747){return db[_0x5d3f('0x2a')]['find']({'where':{'id':_0xc70396[_0x5d3f('0x43')]['id']}})[_0x5d3f('0x23')](handleEntityNotFound(_0x298747,null))[_0x5d3f('0x23')](removeEntity(_0x298747,null))[_0x5d3f('0x41')](handleError(_0x298747,null));};exports[_0x5d3f('0x4a')]=function(_0x23e19c,_0x40db89,_0x57d0c9){var _0x1de9a5={};var _0x289d24={};var _0x477574;var _0x5429ae;return db[_0x5d3f('0x2a')][_0x5d3f('0x4b')]({'where':{'id':_0x23e19c[_0x5d3f('0x43')]['id']}})[_0x5d3f('0x23')](handleEntityNotFound(_0x40db89,null))['then'](function(_0x2a909e){if(_0x2a909e){_0x477574=_0x2a909e;_0x289d24['model']=_[_0x5d3f('0x30')](db[_0x5d3f('0x4c')][_0x5d3f('0x2b')]);_0x289d24['query']=_[_0x5d3f('0x30')](_0x23e19c[_0x5d3f('0x2f')]);_0x289d24['filters']=_[_0x5d3f('0x32')](_0x289d24[_0x5d3f('0x33')],_0x289d24['query']);_0x1de9a5['attributes']=_['intersection'](_0x289d24['model'],qs[_0x5d3f('0x35')](_0x23e19c[_0x5d3f('0x2f')][_0x5d3f('0x35')]));_0x1de9a5[_0x5d3f('0x34')]=_0x1de9a5[_0x5d3f('0x34')][_0x5d3f('0x44')]?_0x1de9a5[_0x5d3f('0x34')]:_0x289d24[_0x5d3f('0x33')];_0x1de9a5[_0x5d3f('0x4d')]=qs[_0x5d3f('0x38')](_0x23e19c[_0x5d3f('0x2f')][_0x5d3f('0x38')]);_0x1de9a5[_0x5d3f('0x39')]=qs[_0x5d3f('0x31')](_[_0x5d3f('0x3a')](_0x23e19c['query'],_0x289d24[_0x5d3f('0x31')]));if(_0x23e19c[_0x5d3f('0x2f')][_0x5d3f('0x3b')]){_0x1de9a5[_0x5d3f('0x39')]=_[_0x5d3f('0x3c')](_0x1de9a5[_0x5d3f('0x39')],{'$or':_['map'](_0x1de9a5[_0x5d3f('0x34')],function(_0x1d7777){var _0x124300={};_0x124300[_0x1d7777]={'$like':'%'+_0x23e19c[_0x5d3f('0x2f')]['filter']+'%'};return _0x124300;})});}_0x1de9a5=_[_0x5d3f('0x3c')]({},_0x1de9a5,_0x23e19c[_0x5d3f('0x46')]);return _0x477574[_0x5d3f('0x4a')](_0x1de9a5);}})[_0x5d3f('0x23')](function(_0x5c2a88){if(_0x5c2a88){_0x5429ae=_0x5c2a88[_0x5d3f('0x44')];if(!_0x23e19c[_0x5d3f('0x2f')]['hasOwnProperty']('nolimit')){_0x1de9a5[_0x5d3f('0x1d')]=qs['limit'](_0x23e19c['query'][_0x5d3f('0x1d')]);_0x1de9a5[_0x5d3f('0x1f')]=qs[_0x5d3f('0x1f')](_0x23e19c['query'][_0x5d3f('0x1f')]);}return _0x477574[_0x5d3f('0x4a')](_0x1de9a5);}})['then'](function(_0x17c669){if(_0x17c669){return _0x17c669?{'count':_0x5429ae,'rows':_0x17c669}:null;}})[_0x5d3f('0x23')](respondWithResult(_0x40db89,null))['catch'](handleError(_0x40db89,null));};exports['addConfiguration']=function(_0x89b04e,_0x1af5d8,_0x42da71){if(_0x89b04e['body']['id']){delete _0x89b04e[_0x5d3f('0x49')]['id'];}return db[_0x5d3f('0x2a')]['findOne']({'where':{'id':_0x89b04e[_0x5d3f('0x43')]['id']}})[_0x5d3f('0x23')](handleEntityNotFound(_0x1af5d8,null))[_0x5d3f('0x23')](function(_0x391c54){if(_0x391c54){_0x89b04e[_0x5d3f('0x49')][_0x5d3f('0x4e')]=_0x391c54['id'];_0x89b04e[_0x5d3f('0x49')]['Subjects']=integrations[_0x5d3f('0x4f')](_0x89b04e[_0x5d3f('0x49')][_0x5d3f('0x50')],_0x89b04e[_0x5d3f('0x49')][_0x5d3f('0x51')]);_0x89b04e[_0x5d3f('0x49')][_0x5d3f('0x52')]=integrations['getDescriptions'](_0x89b04e[_0x5d3f('0x49')][_0x5d3f('0x50')],_0x89b04e['body'][_0x5d3f('0x51')]);return db[_0x5d3f('0x4c')][_0x5d3f('0x48')](_0x89b04e[_0x5d3f('0x49')],{'include':[{'model':db[_0x5d3f('0x53')],'as':_0x5d3f('0x54')},{'model':db[_0x5d3f('0x53')],'as':_0x5d3f('0x52')}]});}return null;})[_0x5d3f('0x23')](respondWithResult(_0x1af5d8,null))[_0x5d3f('0x41')](handleError(_0x1af5d8,null));};exports[_0x5d3f('0x55')]=function(_0x48fca9,_0x3b77bf,_0x56f5a4){var _0x4a7bda='';var _0x347127=['id',_0x5d3f('0x28'),_0x5d3f('0x56'),_0x5d3f('0x57'),_0x5d3f('0x58'),_0x5d3f('0x59'),_0x5d3f('0x5a'),_0x5d3f('0x5b'),_0x5d3f('0x5c'),_0x5d3f('0x5d'),_0x5d3f('0x5e'),_0x5d3f('0x5f')];return db[_0x5d3f('0x2a')][_0x5d3f('0x4b')]({'where':{'id':_0x48fca9[_0x5d3f('0x43')]['id']},'attributes':['id',_0x5d3f('0x60'),'password',_0x5d3f('0x61')]})[_0x5d3f('0x23')](handleEntityNotFound(_0x3b77bf,null))['then'](function(_0x2d0ae4){if(_0x2d0ae4){_0x4a7bda=_0x2d0ae4[_0x5d3f('0x61')];var _0x552cce=_0x4a7bda[_0x5d3f('0x62')](-0x1);if(_0x552cce==='/'){_0x4a7bda=_0x4a7bda[_0x5d3f('0x63')](0x0,_0x4a7bda[_0x5d3f('0x64')](_0x552cce));}return rp({'method':'POST','uri':util[_0x5d3f('0x65')](_0x5d3f('0x66'),_0x4a7bda,_0x5d3f('0x67')),'json':!![],'form':{'method':_0x5d3f('0x68'),'input_type':_0x5d3f('0x69'),'response_type':_0x5d3f('0x69'),'rest_data':JSON[_0x5d3f('0x6a')]({'user_auth':{'user_name':_0x2d0ae4[_0x5d3f('0x60')],'password':_0x2d0ae4['password'],'encryption':_0x5d3f('0x6b')},'application':_0x5d3f('0x6c')})}});}})[_0x5d3f('0x23')](function(_0x346f21){if(_0x346f21&&_0x346f21[_0x5d3f('0x28')]!==_0x5d3f('0x6d')&&_0x346f21['name']!==_0x5d3f('0x6e')){return rp({'method':_0x5d3f('0x6f'),'uri':util[_0x5d3f('0x65')](_0x5d3f('0x66'),_0x4a7bda,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x5d3f('0x69'),'response_type':_0x5d3f('0x69'),'rest_data':JSON[_0x5d3f('0x6a')]({'session':_0x346f21['id'],'module_name':_0x5d3f('0x70')})}})[_0x5d3f('0x23')](function(_0x1bfd2f){if(_0x1bfd2f){var _0x1b8443=_[_0x5d3f('0x71')](_0x1bfd2f[_0x5d3f('0x72')]);_[_0x5d3f('0x73')](_0x1b8443,function(_0x7c2b9){return _0x347127['includes'](_0x7c2b9[_0x5d3f('0x28')]);});return{'count':_0x1b8443['length'],'rows':_['map'](_0x1b8443,function(_0x34299c){return{'id':_0x34299c['name'],'name':_0x34299c['label'],'custom':_['endsWith'](_0x34299c[_0x5d3f('0x28')],'_c')?!![]:![],'options':_0x34299c[_0x5d3f('0x46')]?_[_0x5d3f('0x2e')](_[_0x5d3f('0x71')](_0x34299c[_0x5d3f('0x46')]),function(_0x1f882a){return{'name':_0x1f882a[_0x5d3f('0x74')],'value':_0x1f882a[_0x5d3f('0x28')]};}):[]};})};}})[_0x5d3f('0x23')](respondWithResult(_0x3b77bf,null))[_0x5d3f('0x41')](function(_0x4d48bb){var _0x147b83=_0x48fca9[_0x5d3f('0x2f')][_0x5d3f('0x75')]?0x1f4:_0x4d48bb['statusCode']||0x1f4;logger[_0x5d3f('0x26')](_0x5d3f('0x76'),_0x5d3f('0x55'),_0x147b83,JSON['stringify'](_0x4d48bb));delete _0x4d48bb[_0x5d3f('0x28')];if(_0x147b83===0x191){_0x147b83=0x190;}_0x3b77bf[_0x5d3f('0x1a')](_0x147b83)[_0x5d3f('0x77')](_0x48fca9[_0x5d3f('0x2f')][_0x5d3f('0x75')]?{'message':_0x5d3f('0x78'),'statusCode':_0x4d48bb[_0x5d3f('0x79')]}:_0x4d48bb);});}else{var _0x12dcce=0x1f4;_0x3b77bf['status'](_0x12dcce)[_0x5d3f('0x77')]({'message':_0x5d3f('0x78'),'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 1ca664e..7d97cfc 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 _0xc997=['moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api'];(function(_0xa7df1c,_0x263fa2){var _0x2de200=function(_0x12c1c6){while(--_0x12c1c6){_0xa7df1c['push'](_0xa7df1c['shift']());}};_0x2de200(++_0x263fa2);}(_0xc997,0x1a1));var _0x7c99=function(_0x14feeb,_0x5f1276){_0x14feeb=_0x14feeb-0x0;var _0x29b9de=_0xc997[_0x14feeb];return _0x29b9de;};'use strict';var _=require(_0x7c99('0x0'));var util=require(_0x7c99('0x1'));var logger=require('../../config/logger')(_0x7c99('0x2'));var moment=require(_0x7c99('0x3'));var BPromise=require(_0x7c99('0x4'));var rp=require(_0x7c99('0x5'));var fs=require('fs');var path=require(_0x7c99('0x6'));var rimraf=require('rimraf');var config=require(_0x7c99('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x7c99('0x8'));module['exports']=function(_0x4880a1,_0x46a3dd){return _0x4880a1[_0x7c99('0x9')](_0x7c99('0xa'),attributes,{'tableName':_0x7c99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa94=['path','rimraf','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x25cfa3,_0x1eafb4){var _0x1e0cd6=function(_0x180b51){while(--_0x180b51){_0x25cfa3['push'](_0x25cfa3['shift']());}};_0x1e0cd6(++_0x1eafb4);}(_0xfa94,0x1f2));var _0x4fa9=function(_0x5384ae,_0x32e603){_0x5384ae=_0x5384ae-0x0;var _0x4bcf2d=_0xfa94[_0x5384ae];return _0x4bcf2d;};'use strict';var _=require(_0x4fa9('0x0'));var util=require(_0x4fa9('0x1'));var logger=require(_0x4fa9('0x2'))(_0x4fa9('0x3'));var moment=require('moment');var BPromise=require(_0x4fa9('0x4'));var rp=require(_0x4fa9('0x5'));var fs=require('fs');var path=require(_0x4fa9('0x6'));var rimraf=require(_0x4fa9('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x4fa9('0x8'));module['exports']=function(_0x366aa1,_0x58fc0a){return _0x366aa1[_0x4fa9('0x9')](_0x4fa9('0xa'),attributes,{'tableName':_0x4fa9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index eb967b7..79fcffa 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 _0x3b49=['result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','info','ShowSugarcrmAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x279cc9,_0x4ecc5b){var _0x29e3f8=function(_0x409874){while(--_0x409874){_0x279cc9['push'](_0x279cc9['shift']());}};_0x29e3f8(++_0x4ecc5b);}(_0x3b49,0xfb));var _0x93b4=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x3b49[_0xa148b7];return _0x51efd3;};'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(_0x93b4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x93b4('0x6'));var logger=require(_0x93b4('0x7'))(_0x93b4('0x8'));var config=require(_0x93b4('0x9'));var jayson=require(_0x93b4('0xa'));var client=jayson[_0x93b4('0xb')][_0x93b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29b3bc,_0x43d8c9,_0x29d683){return new BPromise(function(_0x493d4e,_0x369f9c){return client[_0x93b4('0xd')](_0x29b3bc,_0x29d683)['then'](function(_0x3c1436){logger['info'](_0x93b4('0xe'),_0x43d8c9,_0x93b4('0xf'));logger[_0x93b4('0x10')](_0x93b4('0x11'),_0x43d8c9,'request\x20sent',JSON[_0x93b4('0x12')](_0x3c1436));if(_0x3c1436['error']){if(_0x3c1436[_0x93b4('0x13')][_0x93b4('0x14')]===0x1f4){logger['error'](_0x93b4('0xe'),_0x43d8c9,_0x3c1436[_0x93b4('0x13')][_0x93b4('0x15')]);return _0x369f9c(_0x3c1436['error'][_0x93b4('0x15')]);}logger[_0x93b4('0x13')](_0x93b4('0xe'),_0x43d8c9,_0x3c1436[_0x93b4('0x13')][_0x93b4('0x15')]);return _0x493d4e(_0x3c1436[_0x93b4('0x13')][_0x93b4('0x15')]);}else{logger['info'](_0x93b4('0xe'),_0x43d8c9,_0x93b4('0xf'));_0x493d4e(_0x3c1436[_0x93b4('0x16')][_0x93b4('0x15')]);}})[_0x93b4('0x17')](function(_0x25355f){logger[_0x93b4('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x43d8c9,_0x25355f);_0x369f9c(_0x25355f);});});}exports[_0x93b4('0x18')]=function(_0x30f4){var _0x3742ba=this;return new Promise(function(_0x1bedd0,_0x2aa754){return db[_0x93b4('0x19')][_0x93b4('0x1a')]({'raw':_0x30f4[_0x93b4('0x1b')]?_0x30f4[_0x93b4('0x1b')][_0x93b4('0x1c')]===undefined?!![]:![]:!![],'where':_0x30f4[_0x93b4('0x1b')]?_0x30f4['options'][_0x93b4('0x1d')]||null:null,'attributes':_0x30f4[_0x93b4('0x1b')]?_0x30f4['options'][_0x93b4('0x1e')]||null:null,'limit':_0x30f4[_0x93b4('0x1b')]?_0x30f4[_0x93b4('0x1b')][_0x93b4('0x1f')]||null:null,'include':_0x30f4[_0x93b4('0x1b')]?_0x30f4['options']['include']?_[_0x93b4('0x20')](_0x30f4[_0x93b4('0x1b')][_0x93b4('0x21')],function(_0x419407){return{'model':db[_0x419407[_0x93b4('0x22')]],'as':_0x419407['as'],'attributes':_0x419407[_0x93b4('0x1e')],'include':_0x419407[_0x93b4('0x21')]?_[_0x93b4('0x20')](_0x419407[_0x93b4('0x21')],function(_0x235a74){return{'model':db[_0x235a74[_0x93b4('0x22')]],'as':_0x235a74['as'],'attributes':_0x235a74[_0x93b4('0x1e')],'include':_0x235a74[_0x93b4('0x21')]?_[_0x93b4('0x20')](_0x235a74[_0x93b4('0x21')],function(_0x45a5cc){return{'model':db[_0x45a5cc['model']],'as':_0x45a5cc['as'],'attributes':_0x45a5cc[_0x93b4('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5873f4){logger[_0x93b4('0x23')](_0x93b4('0x18'),_0x30f4);logger[_0x93b4('0x10')](_0x93b4('0x18'),_0x30f4,JSON['stringify'](_0x5873f4));_0x1bedd0(_0x5873f4);})['catch'](function(_0x18e029){logger[_0x93b4('0x13')](_0x93b4('0x18'),_0x18e029['message'],_0x30f4);_0x2aa754(_0x3742ba[_0x93b4('0x13')](0x1f4,_0x18e029[_0x93b4('0x15')]));});});};exports[_0x93b4('0x24')]=function(_0x143373){var _0x4d4d39=this;return new Promise(function(_0x3b7581,_0x5c6499){return db[_0x93b4('0x19')][_0x93b4('0x25')]({'raw':_0x143373[_0x93b4('0x1b')]?_0x143373['options'][_0x93b4('0x1c')]===undefined?!![]:![]:!![],'where':_0x143373['options']?_0x143373[_0x93b4('0x1b')][_0x93b4('0x1d')]||null:null,'attributes':_0x143373[_0x93b4('0x1b')]?_0x143373[_0x93b4('0x1b')][_0x93b4('0x1e')]||null:null,'include':_0x143373[_0x93b4('0x1b')]?_0x143373['options'][_0x93b4('0x21')]?_[_0x93b4('0x20')](_0x143373['options'][_0x93b4('0x21')],function(_0x997554){return{'model':db[_0x997554['model']],'as':_0x997554['as'],'attributes':_0x997554[_0x93b4('0x1e')],'include':_0x997554[_0x93b4('0x21')]?_[_0x93b4('0x20')](_0x997554[_0x93b4('0x21')],function(_0x95db5a){return{'model':db[_0x95db5a[_0x93b4('0x22')]],'as':_0x95db5a['as'],'attributes':_0x95db5a[_0x93b4('0x1e')],'include':_0x95db5a[_0x93b4('0x21')]?_[_0x93b4('0x20')](_0x95db5a['include'],function(_0x4ff3d4){return{'model':db[_0x4ff3d4[_0x93b4('0x22')]],'as':_0x4ff3d4['as'],'attributes':_0x4ff3d4[_0x93b4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x93b4('0x26')](function(_0x3c0097){logger[_0x93b4('0x23')](_0x93b4('0x24'),_0x143373);logger[_0x93b4('0x10')]('ShowSugarcrmAccount',_0x143373,JSON[_0x93b4('0x12')](_0x3c0097));_0x3b7581(_0x3c0097);})[_0x93b4('0x17')](function(_0x2669c9){logger[_0x93b4('0x13')](_0x93b4('0x24'),_0x2669c9[_0x93b4('0x15')],_0x143373);_0x5c6499(_0x4d4d39[_0x93b4('0x13')](0x1f4,_0x2669c9['message']));});});}; \ No newline at end of file +var _0x214a=['../../config/environment','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','find','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x214a,0x7e));var _0xa214=function(_0x425890,_0x384987){_0x425890=_0x425890-0x0;var _0x2e30fc=_0x214a[_0x425890];return _0x2e30fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa214('0x0'));var rs=require(_0xa214('0x1'));var fs=require('fs');var Redis=require(_0xa214('0x2'));var db=require(_0xa214('0x3'))['db'];var utils=require(_0xa214('0x4'));var logger=require(_0xa214('0x5'))('rpc');var config=require(_0xa214('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa214('0x7')][_0xa214('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25dd62,_0x1f55f7,_0x17346a){return new BPromise(function(_0x287ee7,_0x546ccc){return client['request'](_0x25dd62,_0x17346a)[_0xa214('0x9')](function(_0x42ac3d){logger['info'](_0xa214('0xa'),_0x1f55f7,_0xa214('0xb'));logger[_0xa214('0xc')](_0xa214('0xd'),_0x1f55f7,'request\x20sent',JSON[_0xa214('0xe')](_0x42ac3d));if(_0x42ac3d['error']){if(_0x42ac3d[_0xa214('0xf')][_0xa214('0x10')]===0x1f4){logger[_0xa214('0xf')](_0xa214('0xa'),_0x1f55f7,_0x42ac3d[_0xa214('0xf')][_0xa214('0x11')]);return _0x546ccc(_0x42ac3d[_0xa214('0xf')][_0xa214('0x11')]);}logger[_0xa214('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x1f55f7,_0x42ac3d[_0xa214('0xf')][_0xa214('0x11')]);return _0x287ee7(_0x42ac3d[_0xa214('0xf')]['message']);}else{logger[_0xa214('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x1f55f7,_0xa214('0xb'));_0x287ee7(_0x42ac3d['result']['message']);}})[_0xa214('0x13')](function(_0x5ded71){logger[_0xa214('0xf')](_0xa214('0xa'),_0x1f55f7,_0x5ded71);_0x546ccc(_0x5ded71);});});}exports['GetSugarcrmAccount']=function(_0x53e552){var _0xb194d3=this;return new Promise(function(_0x247a8c,_0x419910){return db[_0xa214('0x14')][_0xa214('0x15')]({'raw':_0x53e552[_0xa214('0x16')]?_0x53e552[_0xa214('0x16')][_0xa214('0x17')]===undefined?!![]:![]:!![],'where':_0x53e552['options']?_0x53e552[_0xa214('0x16')][_0xa214('0x18')]||null:null,'attributes':_0x53e552['options']?_0x53e552[_0xa214('0x16')][_0xa214('0x19')]||null:null,'limit':_0x53e552[_0xa214('0x16')]?_0x53e552[_0xa214('0x16')][_0xa214('0x1a')]||null:null,'include':_0x53e552[_0xa214('0x16')]?_0x53e552[_0xa214('0x16')][_0xa214('0x1b')]?_[_0xa214('0x1c')](_0x53e552['options'][_0xa214('0x1b')],function(_0x58174a){return{'model':db[_0x58174a[_0xa214('0x1d')]],'as':_0x58174a['as'],'attributes':_0x58174a[_0xa214('0x19')],'include':_0x58174a[_0xa214('0x1b')]?_[_0xa214('0x1c')](_0x58174a[_0xa214('0x1b')],function(_0x3ef526){return{'model':db[_0x3ef526[_0xa214('0x1d')]],'as':_0x3ef526['as'],'attributes':_0x3ef526[_0xa214('0x19')],'include':_0x3ef526['include']?_[_0xa214('0x1c')](_0x3ef526[_0xa214('0x1b')],function(_0xd9c095){return{'model':db[_0xd9c095['model']],'as':_0xd9c095['as'],'attributes':_0xd9c095[_0xa214('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa214('0x9')](function(_0x457653){logger[_0xa214('0x12')](_0xa214('0x1e'),_0x53e552);logger[_0xa214('0xc')](_0xa214('0x1e'),_0x53e552,JSON[_0xa214('0xe')](_0x457653));_0x247a8c(_0x457653);})[_0xa214('0x13')](function(_0x1fcaf4){logger[_0xa214('0xf')](_0xa214('0x1e'),_0x1fcaf4[_0xa214('0x11')],_0x53e552);_0x419910(_0xb194d3[_0xa214('0xf')](0x1f4,_0x1fcaf4[_0xa214('0x11')]));});});};exports[_0xa214('0x1f')]=function(_0x3fce63){var _0x50f008=this;return new Promise(function(_0x5f161f,_0x3b145f){return db[_0xa214('0x14')][_0xa214('0x20')]({'raw':_0x3fce63[_0xa214('0x16')]?_0x3fce63['options']['raw']===undefined?!![]:![]:!![],'where':_0x3fce63[_0xa214('0x16')]?_0x3fce63[_0xa214('0x16')]['where']||null:null,'attributes':_0x3fce63[_0xa214('0x16')]?_0x3fce63['options'][_0xa214('0x19')]||null:null,'include':_0x3fce63[_0xa214('0x16')]?_0x3fce63[_0xa214('0x16')][_0xa214('0x1b')]?_[_0xa214('0x1c')](_0x3fce63[_0xa214('0x16')][_0xa214('0x1b')],function(_0x277543){return{'model':db[_0x277543[_0xa214('0x1d')]],'as':_0x277543['as'],'attributes':_0x277543[_0xa214('0x19')],'include':_0x277543['include']?_[_0xa214('0x1c')](_0x277543[_0xa214('0x1b')],function(_0xce8ef1){return{'model':db[_0xce8ef1[_0xa214('0x1d')]],'as':_0xce8ef1['as'],'attributes':_0xce8ef1[_0xa214('0x19')],'include':_0xce8ef1[_0xa214('0x1b')]?_[_0xa214('0x1c')](_0xce8ef1[_0xa214('0x1b')],function(_0x3d6ac0){return{'model':db[_0x3d6ac0[_0xa214('0x1d')]],'as':_0x3d6ac0['as'],'attributes':_0x3d6ac0[_0xa214('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x189d64){logger['info'](_0xa214('0x1f'),_0x3fce63);logger['debug']('ShowSugarcrmAccount',_0x3fce63,JSON[_0xa214('0xe')](_0x189d64));_0x5f161f(_0x189d64);})[_0xa214('0x13')](function(_0x157198){logger[_0xa214('0xf')]('ShowSugarcrmAccount',_0x157198[_0xa214('0x11')],_0x3fce63);_0x3b145f(_0x50f008[_0xa214('0xf')](0x1f4,_0x157198[_0xa214('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index ff7b877..5534eaa 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 _0x895e=['put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','post','create'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x895e,0xab));var _0xe895=function(_0x1954a0,_0x142ae0){_0x1954a0=_0x1954a0-0x0;var _0x40ccfc=_0x895e[_0x1954a0];return _0x40ccfc;};'use strict';var multer=require('multer');var util=require(_0xe895('0x0'));var path=require(_0xe895('0x1'));var timeout=require(_0xe895('0x2'));var express=require(_0xe895('0x3'));var router=express[_0xe895('0x4')]();var fs_extra=require(_0xe895('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe895('0x6'));var config=require('../../config/environment');var controller=require(_0xe895('0x7'));router[_0xe895('0x8')]('/',auth[_0xe895('0x9')](),controller['index']);router[_0xe895('0x8')](_0xe895('0xa'),auth['isAuthenticated'](),controller[_0xe895('0xb')]);router[_0xe895('0x8')](_0xe895('0xc'),auth[_0xe895('0x9')](),controller[_0xe895('0xd')]);router['get'](_0xe895('0xe'),auth[_0xe895('0x9')](),controller[_0xe895('0xf')]);router[_0xe895('0x8')]('/:id/descriptions',auth[_0xe895('0x9')](),controller['getDescriptions']);router[_0xe895('0x10')]('/',auth['isAuthenticated'](),controller[_0xe895('0x11')]);router[_0xe895('0x12')](_0xe895('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe895('0x13')]('/:id',auth[_0xe895('0x9')](),controller[_0xe895('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1dd6=['create','update','delete','exports','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0xe075e8,_0x4fe11a){var _0x240582=function(_0xdf5765){while(--_0xdf5765){_0xe075e8['push'](_0xe075e8['shift']());}};_0x240582(++_0x4fe11a);}(_0x1dd6,0x90));var _0x61dd=function(_0x304d73,_0x54b61f){_0x304d73=_0x304d73-0x0;var _0x1335a9=_0x1dd6[_0x304d73];return _0x1335a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x61dd('0x0'));var timeout=require(_0x61dd('0x1'));var express=require('express');var router=express[_0x61dd('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x61dd('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x61dd('0x4'));var controller=require(_0x61dd('0x5'));router['get']('/',auth[_0x61dd('0x6')](),controller['index']);router[_0x61dd('0x7')](_0x61dd('0x8'),auth[_0x61dd('0x6')](),controller[_0x61dd('0x9')]);router[_0x61dd('0x7')](_0x61dd('0xa'),auth[_0x61dd('0x6')](),controller[_0x61dd('0xb')]);router[_0x61dd('0x7')](_0x61dd('0xc'),auth[_0x61dd('0x6')](),controller[_0x61dd('0xd')]);router['get'](_0x61dd('0xe'),auth[_0x61dd('0x6')](),controller[_0x61dd('0xf')]);router['post']('/',auth[_0x61dd('0x6')](),controller[_0x61dd('0x10')]);router['put'](_0x61dd('0x8'),auth[_0x61dd('0x6')](),controller[_0x61dd('0x11')]);router[_0x61dd('0x12')](_0x61dd('0x8'),auth[_0x61dd('0x6')](),controller['destroy']);module[_0x61dd('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 380d38c..dfa5094 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 _0x2922=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2922,0xce));var _0x2292=function(_0x3f17fd,_0x471cfe){_0x3f17fd=_0x3f17fd-0x0;var _0x589c54=_0x2922[_0x3f17fd];return _0x589c54;};'use strict';var Sequelize=require(_0x2292('0x0'));module[_0x2292('0x1')]={'name':{'type':Sequelize[_0x2292('0x2')]},'description':{'type':Sequelize[_0x2292('0x2')]}}; \ No newline at end of file +var _0x1954=['STRING','sequelize','exports'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x1954,0xeb));var _0x4195=function(_0xf5549,_0x3268d8){_0xf5549=_0xf5549-0x0;var _0x31f992=_0x1954[_0xf5549];return _0x31f992;};'use strict';var Sequelize=require(_0x4195('0x0'));module[_0x4195('0x1')]={'name':{'type':Sequelize[_0x4195('0x2')]},'description':{'type':Sequelize[_0x4195('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index d191113..b0dd36f 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 _0x9eb5=['update','destroy','then','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','length','find','create','body','params','getFields','findOne','SugarcrmField','getSubjects','hasOwnProperty','getDescriptions','eml-format','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0x9eb5,0x79));var _0x59eb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9eb5[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x59eb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59eb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x59eb('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x59eb('0x3'));var util=require(_0x59eb('0x4'));var path=require(_0x59eb('0x5'));var sox=require(_0x59eb('0x6'));var csv=require('to-csv');var ejs=require(_0x59eb('0x7'));var fs=require('fs');var fs_extra=require(_0x59eb('0x8'));var _=require('lodash');var squel=require(_0x59eb('0x9'));var crypto=require(_0x59eb('0xa'));var jsforce=require(_0x59eb('0xb'));var deskjs=require(_0x59eb('0xc'));var toCsv=require(_0x59eb('0xd'));var querystring=require(_0x59eb('0xe'));var Papa=require(_0x59eb('0xf'));var Redis=require(_0x59eb('0x10'));var authService=require(_0x59eb('0x11'));var qs=require(_0x59eb('0x12'));var as=require(_0x59eb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x59eb('0x14'))(_0x59eb('0x15'));var utils=require(_0x59eb('0x16'));var config=require(_0x59eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x59eb('0x18'))['db'];function respondWithStatusCode(_0x3a6804,_0x329c70){_0x329c70=_0x329c70||0xcc;return function(_0x5367e7){if(_0x5367e7){return _0x3a6804['sendStatus'](_0x329c70);}return _0x3a6804[_0x59eb('0x19')](_0x329c70)[_0x59eb('0x1a')]();};}function respondWithResult(_0x11135c,_0x11703b){_0x11703b=_0x11703b||0xc8;return function(_0x31e13f){if(_0x31e13f){return _0x11135c['status'](_0x11703b)[_0x59eb('0x1b')](_0x31e13f);}};}function respondWithFilteredResult(_0x3149b5,_0x11ab4b){return function(_0x2dd259){if(_0x2dd259){var _0x54755f=typeof _0x11ab4b[_0x59eb('0x1c')]===_0x59eb('0x1d')&&typeof _0x11ab4b[_0x59eb('0x1e')]===_0x59eb('0x1d');var _0x1ede50=_0x2dd259[_0x59eb('0x1f')];var _0x546def=_0x54755f?0x0:_0x11ab4b[_0x59eb('0x1c')];var _0x167b78=_0x54755f?_0x2dd259['count']:_0x11ab4b[_0x59eb('0x1c')]+_0x11ab4b['limit'];var _0x15f5c9;if(_0x167b78>=_0x1ede50){_0x167b78=_0x1ede50;_0x15f5c9=0xc8;}else{_0x15f5c9=0xce;}_0x3149b5[_0x59eb('0x19')](_0x15f5c9);return _0x3149b5[_0x59eb('0x20')](_0x59eb('0x21'),_0x546def+'-'+_0x167b78+'/'+_0x1ede50)[_0x59eb('0x1b')](_0x2dd259);}return null;};}function patchUpdates(_0x312f38){return function(_0x381a06){try{jsonpatch['apply'](_0x381a06,_0x312f38,!![]);}catch(_0x584d6b){return BPromise['reject'](_0x584d6b);}return _0x381a06[_0x59eb('0x22')]();};}function saveUpdates(_0x1406bf,_0x1826a2){return function(_0x114a51){if(_0x114a51){return _0x114a51[_0x59eb('0x23')](_0x1406bf)['then'](function(_0x2cc332){return _0x2cc332;});}return null;};}function removeEntity(_0x3890c3,_0x2e08e0){return function(_0x1671ef){if(_0x1671ef){return _0x1671ef[_0x59eb('0x24')]()[_0x59eb('0x25')](function(){_0x3890c3[_0x59eb('0x19')](0xcc)[_0x59eb('0x1a')]();});}};}function handleEntityNotFound(_0x3479d0,_0x566f46){return function(_0x4d4b85){if(!_0x4d4b85){_0x3479d0['sendStatus'](0x194);}return _0x4d4b85;};}function handleError(_0x168416,_0x3c0770){_0x3c0770=_0x3c0770||0x1f4;return function(_0x199491){logger['error'](_0x199491[_0x59eb('0x26')]);if(_0x199491[_0x59eb('0x27')]){delete _0x199491['name'];}_0x168416[_0x59eb('0x19')](_0x3c0770)[_0x59eb('0x28')](_0x199491);};}exports['index']=function(_0x40d977,_0x307a48){var _0x245233={},_0x5c8f48={},_0x4c13cc={'count':0x0,'rows':[]};var _0x158b86=_[_0x59eb('0x29')](db[_0x59eb('0x2a')][_0x59eb('0x2b')],function(_0x40a277){return{'name':_0x40a277[_0x59eb('0x2c')],'type':_0x40a277[_0x59eb('0x2d')][_0x59eb('0x2e')]};});_0x5c8f48[_0x59eb('0x2f')]=_[_0x59eb('0x29')](_0x158b86,'name');_0x5c8f48[_0x59eb('0x30')]=_[_0x59eb('0x31')](_0x40d977[_0x59eb('0x30')]);_0x5c8f48[_0x59eb('0x32')]=_[_0x59eb('0x33')](_0x5c8f48[_0x59eb('0x2f')],_0x5c8f48[_0x59eb('0x30')]);_0x245233[_0x59eb('0x34')]=_[_0x59eb('0x33')](_0x5c8f48[_0x59eb('0x2f')],qs[_0x59eb('0x35')](_0x40d977['query'][_0x59eb('0x35')]));_0x245233['attributes']=_0x245233['attributes']['length']?_0x245233[_0x59eb('0x34')]:_0x5c8f48[_0x59eb('0x2f')];if(!_0x40d977['query']['hasOwnProperty'](_0x59eb('0x36'))){_0x245233['limit']=qs[_0x59eb('0x1e')](_0x40d977[_0x59eb('0x30')][_0x59eb('0x1e')]);_0x245233[_0x59eb('0x1c')]=qs['offset'](_0x40d977[_0x59eb('0x30')][_0x59eb('0x1c')]);}_0x245233[_0x59eb('0x37')]=qs[_0x59eb('0x38')](_0x40d977['query'][_0x59eb('0x38')]);_0x245233[_0x59eb('0x39')]=qs[_0x59eb('0x32')](_[_0x59eb('0x3a')](_0x40d977['query'],_0x5c8f48[_0x59eb('0x32')]),_0x158b86);if(_0x40d977['query'][_0x59eb('0x3b')]){_0x245233[_0x59eb('0x39')]=_[_0x59eb('0x3c')](_0x245233['where'],{'$or':_[_0x59eb('0x29')](_0x158b86,function(_0x4bac8b){if(_0x4bac8b['type']!=='VIRTUAL'){var _0x10e247={};_0x10e247[_0x4bac8b[_0x59eb('0x27')]]={'$like':'%'+_0x40d977[_0x59eb('0x30')][_0x59eb('0x3b')]+'%'};return _0x10e247;}})});}_0x245233=_[_0x59eb('0x3c')]({},_0x245233,_0x40d977[_0x59eb('0x3d')]);var _0x566128={'where':_0x245233[_0x59eb('0x39')]};return db[_0x59eb('0x2a')]['count'](_0x566128)[_0x59eb('0x25')](function(_0x297fb2){_0x4c13cc['count']=_0x297fb2;if(_0x40d977[_0x59eb('0x30')][_0x59eb('0x3e')]){_0x245233[_0x59eb('0x3f')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x245233);})[_0x59eb('0x25')](function(_0x491908){_0x4c13cc[_0x59eb('0x40')]=_0x491908;return _0x4c13cc;})[_0x59eb('0x25')](respondWithFilteredResult(_0x307a48,_0x245233))[_0x59eb('0x41')](handleError(_0x307a48,null));};exports[_0x59eb('0x42')]=function(_0x587bc6,_0x36e8bf){var _0x25ee68={'raw':![],'where':{'id':_0x587bc6['params']['id']}},_0x448945={};_0x448945[_0x59eb('0x2f')]=_[_0x59eb('0x31')](db['SugarcrmConfiguration'][_0x59eb('0x2b')]);_0x448945[_0x59eb('0x30')]=_['keys'](_0x587bc6['query']);_0x448945['filters']=_[_0x59eb('0x33')](_0x448945[_0x59eb('0x2f')],_0x448945[_0x59eb('0x30')]);_0x25ee68['attributes']=_[_0x59eb('0x33')](_0x448945['model'],qs[_0x59eb('0x35')](_0x587bc6['query']['fields']));_0x25ee68['attributes']=_0x25ee68['attributes'][_0x59eb('0x43')]?_0x25ee68['attributes']:_0x448945[_0x59eb('0x2f')];if(_0x587bc6['query'][_0x59eb('0x3e')]){_0x25ee68[_0x59eb('0x3f')]=[{'all':!![]}];}_0x25ee68=_[_0x59eb('0x3c')]({},_0x25ee68,_0x587bc6['options']);return db[_0x59eb('0x2a')][_0x59eb('0x44')](_0x25ee68)[_0x59eb('0x25')](handleEntityNotFound(_0x36e8bf,null))[_0x59eb('0x25')](respondWithResult(_0x36e8bf,null))[_0x59eb('0x41')](handleError(_0x36e8bf,null));};exports['create']=function(_0x424771,_0x1fec25){return db[_0x59eb('0x2a')][_0x59eb('0x45')](_0x424771['body'],{})[_0x59eb('0x25')](respondWithResult(_0x1fec25,0xc9))[_0x59eb('0x41')](handleError(_0x1fec25,null));};exports[_0x59eb('0x23')]=function(_0x3fe6ca,_0xa96955){if(_0x3fe6ca[_0x59eb('0x46')]['id']){delete _0x3fe6ca[_0x59eb('0x46')]['id'];}return db['SugarcrmConfiguration'][_0x59eb('0x44')]({'where':{'id':_0x3fe6ca[_0x59eb('0x47')]['id']}})[_0x59eb('0x25')](handleEntityNotFound(_0xa96955,null))['then'](saveUpdates(_0x3fe6ca[_0x59eb('0x46')],null))['then'](respondWithResult(_0xa96955,null))['catch'](handleError(_0xa96955,null));};exports[_0x59eb('0x24')]=function(_0x5bcec2,_0x170911){return db[_0x59eb('0x2a')][_0x59eb('0x44')]({'where':{'id':_0x5bcec2[_0x59eb('0x47')]['id']}})['then'](handleEntityNotFound(_0x170911,null))[_0x59eb('0x25')](removeEntity(_0x170911,null))[_0x59eb('0x41')](handleError(_0x170911,null));};exports[_0x59eb('0x48')]=function(_0x3b15ac,_0x4d47fd,_0x1ff1e6){var _0x156769={};var _0x499398={};var _0x401067;var _0x45ff84;return db[_0x59eb('0x2a')][_0x59eb('0x49')]({'where':{'id':_0x3b15ac['params']['id']}})[_0x59eb('0x25')](handleEntityNotFound(_0x4d47fd,null))[_0x59eb('0x25')](function(_0x3545ce){if(_0x3545ce){_0x401067=_0x3545ce;_0x499398['model']=_[_0x59eb('0x31')](db[_0x59eb('0x4a')][_0x59eb('0x2b')]);_0x499398[_0x59eb('0x30')]=_[_0x59eb('0x31')](_0x3b15ac[_0x59eb('0x30')]);_0x499398[_0x59eb('0x32')]=_[_0x59eb('0x33')](_0x499398['model'],_0x499398['query']);_0x156769[_0x59eb('0x34')]=_[_0x59eb('0x33')](_0x499398[_0x59eb('0x2f')],qs[_0x59eb('0x35')](_0x3b15ac[_0x59eb('0x30')][_0x59eb('0x35')]));_0x156769[_0x59eb('0x34')]=_0x156769[_0x59eb('0x34')][_0x59eb('0x43')]?_0x156769[_0x59eb('0x34')]:_0x499398[_0x59eb('0x2f')];_0x156769[_0x59eb('0x37')]=qs['sort'](_0x3b15ac[_0x59eb('0x30')]['sort']);_0x156769[_0x59eb('0x39')]=qs[_0x59eb('0x32')](_[_0x59eb('0x3a')](_0x3b15ac[_0x59eb('0x30')],_0x499398[_0x59eb('0x32')]));if(_0x3b15ac[_0x59eb('0x30')][_0x59eb('0x3b')]){_0x156769['where']=_['merge'](_0x156769[_0x59eb('0x39')],{'$or':_[_0x59eb('0x29')](_0x156769[_0x59eb('0x34')],function(_0x4f6650){var _0x178bbb={};_0x178bbb[_0x4f6650]={'$like':'%'+_0x3b15ac[_0x59eb('0x30')][_0x59eb('0x3b')]+'%'};return _0x178bbb;})});}_0x156769=_[_0x59eb('0x3c')]({},_0x156769,_0x3b15ac[_0x59eb('0x3d')]);return _0x401067[_0x59eb('0x48')](_0x156769);}})[_0x59eb('0x25')](function(_0xdad51b){if(_0xdad51b){_0x45ff84=_0xdad51b['length'];if(!_0x3b15ac[_0x59eb('0x30')]['hasOwnProperty'](_0x59eb('0x36'))){_0x156769[_0x59eb('0x1e')]=qs[_0x59eb('0x1e')](_0x3b15ac[_0x59eb('0x30')]['limit']);_0x156769[_0x59eb('0x1c')]=qs[_0x59eb('0x1c')](_0x3b15ac['query'][_0x59eb('0x1c')]);}return _0x401067[_0x59eb('0x48')](_0x156769);}})[_0x59eb('0x25')](function(_0x189dd3){if(_0x189dd3){return _0x189dd3?{'count':_0x45ff84,'rows':_0x189dd3}:null;}})[_0x59eb('0x25')](respondWithResult(_0x4d47fd,null))[_0x59eb('0x41')](handleError(_0x4d47fd,null));};exports[_0x59eb('0x4b')]=function(_0x2aa73f,_0x20925a,_0x2f37bd){var _0x44dfa3={};var _0x1d19bf={};var _0x448f8d;var _0x305f63;return db[_0x59eb('0x2a')]['findOne']({'where':{'id':_0x2aa73f[_0x59eb('0x47')]['id']}})[_0x59eb('0x25')](handleEntityNotFound(_0x20925a,null))[_0x59eb('0x25')](function(_0x5b5942){if(_0x5b5942){_0x448f8d=_0x5b5942;_0x1d19bf['model']=_[_0x59eb('0x31')](db[_0x59eb('0x4a')][_0x59eb('0x2b')]);_0x1d19bf['query']=_[_0x59eb('0x31')](_0x2aa73f[_0x59eb('0x30')]);_0x1d19bf[_0x59eb('0x32')]=_[_0x59eb('0x33')](_0x1d19bf[_0x59eb('0x2f')],_0x1d19bf['query']);_0x44dfa3[_0x59eb('0x34')]=_[_0x59eb('0x33')](_0x1d19bf[_0x59eb('0x2f')],qs['fields'](_0x2aa73f['query']['fields']));_0x44dfa3[_0x59eb('0x34')]=_0x44dfa3[_0x59eb('0x34')][_0x59eb('0x43')]?_0x44dfa3[_0x59eb('0x34')]:_0x1d19bf[_0x59eb('0x2f')];_0x44dfa3['order']=qs[_0x59eb('0x38')](_0x2aa73f[_0x59eb('0x30')][_0x59eb('0x38')]);_0x44dfa3[_0x59eb('0x39')]=qs[_0x59eb('0x32')](_[_0x59eb('0x3a')](_0x2aa73f[_0x59eb('0x30')],_0x1d19bf[_0x59eb('0x32')]));if(_0x2aa73f[_0x59eb('0x30')][_0x59eb('0x3b')]){_0x44dfa3['where']=_[_0x59eb('0x3c')](_0x44dfa3['where'],{'$or':_[_0x59eb('0x29')](_0x44dfa3[_0x59eb('0x34')],function(_0x3274a7){var _0x3e1fa9={};_0x3e1fa9[_0x3274a7]={'$like':'%'+_0x2aa73f[_0x59eb('0x30')][_0x59eb('0x3b')]+'%'};return _0x3e1fa9;})});}_0x44dfa3=_[_0x59eb('0x3c')]({},_0x44dfa3,_0x2aa73f[_0x59eb('0x3d')]);return _0x448f8d[_0x59eb('0x4b')](_0x44dfa3);}})[_0x59eb('0x25')](function(_0x5d7a91){if(_0x5d7a91){_0x305f63=_0x5d7a91['length'];if(!_0x2aa73f[_0x59eb('0x30')][_0x59eb('0x4c')](_0x59eb('0x36'))){_0x44dfa3[_0x59eb('0x1e')]=qs[_0x59eb('0x1e')](_0x2aa73f[_0x59eb('0x30')]['limit']);_0x44dfa3['offset']=qs[_0x59eb('0x1c')](_0x2aa73f[_0x59eb('0x30')][_0x59eb('0x1c')]);}return _0x448f8d[_0x59eb('0x4b')](_0x44dfa3);}})['then'](function(_0x3592cd){if(_0x3592cd){return _0x3592cd?{'count':_0x305f63,'rows':_0x3592cd}:null;}})[_0x59eb('0x25')](respondWithResult(_0x20925a,null))[_0x59eb('0x41')](handleError(_0x20925a,null));};exports[_0x59eb('0x4d')]=function(_0x840605,_0x1afed9,_0xcc9ce4){var _0x3ae508={};var _0xa99bd3={};var _0x5599fa;var _0x25b720;return db[_0x59eb('0x2a')]['findOne']({'where':{'id':_0x840605[_0x59eb('0x47')]['id']}})[_0x59eb('0x25')](handleEntityNotFound(_0x1afed9,null))[_0x59eb('0x25')](function(_0x9eefa0){if(_0x9eefa0){_0x5599fa=_0x9eefa0;_0xa99bd3[_0x59eb('0x2f')]=_[_0x59eb('0x31')](db[_0x59eb('0x4a')][_0x59eb('0x2b')]);_0xa99bd3[_0x59eb('0x30')]=_[_0x59eb('0x31')](_0x840605[_0x59eb('0x30')]);_0xa99bd3['filters']=_[_0x59eb('0x33')](_0xa99bd3[_0x59eb('0x2f')],_0xa99bd3[_0x59eb('0x30')]);_0x3ae508[_0x59eb('0x34')]=_[_0x59eb('0x33')](_0xa99bd3[_0x59eb('0x2f')],qs[_0x59eb('0x35')](_0x840605[_0x59eb('0x30')][_0x59eb('0x35')]));_0x3ae508[_0x59eb('0x34')]=_0x3ae508[_0x59eb('0x34')]['length']?_0x3ae508[_0x59eb('0x34')]:_0xa99bd3[_0x59eb('0x2f')];_0x3ae508[_0x59eb('0x37')]=qs[_0x59eb('0x38')](_0x840605[_0x59eb('0x30')][_0x59eb('0x38')]);_0x3ae508[_0x59eb('0x39')]=qs[_0x59eb('0x32')](_['pick'](_0x840605[_0x59eb('0x30')],_0xa99bd3['filters']));if(_0x840605[_0x59eb('0x30')]['filter']){_0x3ae508['where']=_[_0x59eb('0x3c')](_0x3ae508[_0x59eb('0x39')],{'$or':_['map'](_0x3ae508[_0x59eb('0x34')],function(_0x264658){var _0x24fc8c={};_0x24fc8c[_0x264658]={'$like':'%'+_0x840605[_0x59eb('0x30')][_0x59eb('0x3b')]+'%'};return _0x24fc8c;})});}_0x3ae508=_[_0x59eb('0x3c')]({},_0x3ae508,_0x840605[_0x59eb('0x3d')]);return _0x5599fa[_0x59eb('0x4d')](_0x3ae508);}})['then'](function(_0x3909e3){if(_0x3909e3){_0x25b720=_0x3909e3[_0x59eb('0x43')];if(!_0x840605['query'][_0x59eb('0x4c')](_0x59eb('0x36'))){_0x3ae508[_0x59eb('0x1e')]=qs[_0x59eb('0x1e')](_0x840605[_0x59eb('0x30')][_0x59eb('0x1e')]);_0x3ae508[_0x59eb('0x1c')]=qs['offset'](_0x840605[_0x59eb('0x30')]['offset']);}return _0x5599fa[_0x59eb('0x4d')](_0x3ae508);}})[_0x59eb('0x25')](function(_0x534296){if(_0x534296){return _0x534296?{'count':_0x25b720,'rows':_0x534296}:null;}})[_0x59eb('0x25')](respondWithResult(_0x1afed9,null))[_0x59eb('0x41')](handleError(_0x1afed9,null));}; \ No newline at end of file +var _0x0301=['find','create','body','destroy','getFields','findOne','SugarcrmField','filter','options','getSubjects','getDescriptions','rimraf','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','SugarcrmConfiguration','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','include','rows','catch','show','params','rawAttributes','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0301,0x1a0));var _0x1030=function(_0xbd926,_0x3c5a91){_0xbd926=_0xbd926-0x0;var _0x1d384b=_0x0301[_0xbd926];return _0x1d384b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1030('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1030('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x1030('0x2'));var util=require(_0x1030('0x3'));var path=require(_0x1030('0x4'));var sox=require(_0x1030('0x5'));var csv=require('to-csv');var ejs=require(_0x1030('0x6'));var fs=require('fs');var fs_extra=require(_0x1030('0x7'));var _=require(_0x1030('0x8'));var squel=require(_0x1030('0x9'));var crypto=require(_0x1030('0xa'));var jsforce=require(_0x1030('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1030('0xc'));var querystring=require(_0x1030('0xd'));var Papa=require(_0x1030('0xe'));var Redis=require(_0x1030('0xf'));var authService=require(_0x1030('0x10'));var qs=require(_0x1030('0x11'));var as=require(_0x1030('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1030('0x13'))(_0x1030('0x14'));var utils=require('../../config/utils');var config=require(_0x1030('0x15'));var licenseUtil=require(_0x1030('0x16'));var db=require(_0x1030('0x17'))['db'];function respondWithStatusCode(_0x74369d,_0x363614){_0x363614=_0x363614||0xcc;return function(_0x1db074){if(_0x1db074){return _0x74369d[_0x1030('0x18')](_0x363614);}return _0x74369d[_0x1030('0x19')](_0x363614)[_0x1030('0x1a')]();};}function respondWithResult(_0x24c189,_0xe9b9f0){_0xe9b9f0=_0xe9b9f0||0xc8;return function(_0x3b258b){if(_0x3b258b){return _0x24c189['status'](_0xe9b9f0)[_0x1030('0x1b')](_0x3b258b);}};}function respondWithFilteredResult(_0x2d20ef,_0x1d349c){return function(_0x2ac148){if(_0x2ac148){var _0x18bb2b=typeof _0x1d349c[_0x1030('0x1c')]===_0x1030('0x1d')&&typeof _0x1d349c[_0x1030('0x1e')]==='undefined';var _0x50a537=_0x2ac148[_0x1030('0x1f')];var _0x5aa075=_0x18bb2b?0x0:_0x1d349c['offset'];var _0x3d1f02=_0x18bb2b?_0x2ac148[_0x1030('0x1f')]:_0x1d349c['offset']+_0x1d349c[_0x1030('0x1e')];var _0x50740a;if(_0x3d1f02>=_0x50a537){_0x3d1f02=_0x50a537;_0x50740a=0xc8;}else{_0x50740a=0xce;}_0x2d20ef[_0x1030('0x19')](_0x50740a);return _0x2d20ef[_0x1030('0x20')](_0x1030('0x21'),_0x5aa075+'-'+_0x3d1f02+'/'+_0x50a537)[_0x1030('0x1b')](_0x2ac148);}return null;};}function patchUpdates(_0x54ee0b){return function(_0x510bd1){try{jsonpatch[_0x1030('0x22')](_0x510bd1,_0x54ee0b,!![]);}catch(_0x511be5){return BPromise[_0x1030('0x23')](_0x511be5);}return _0x510bd1[_0x1030('0x24')]();};}function saveUpdates(_0x1f4e57,_0x1489aa){return function(_0x3b3183){if(_0x3b3183){return _0x3b3183[_0x1030('0x25')](_0x1f4e57)[_0x1030('0x26')](function(_0x36c45c){return _0x36c45c;});}return null;};}function removeEntity(_0x46e1f,_0x79e1fc){return function(_0x259872){if(_0x259872){return _0x259872['destroy']()['then'](function(){_0x46e1f[_0x1030('0x19')](0xcc)[_0x1030('0x1a')]();});}};}function handleEntityNotFound(_0x4ca297,_0x4561c6){return function(_0x4d8c5b){if(!_0x4d8c5b){_0x4ca297['sendStatus'](0x194);}return _0x4d8c5b;};}function handleError(_0x5415c9,_0x980167){_0x980167=_0x980167||0x1f4;return function(_0x508893){logger[_0x1030('0x27')](_0x508893[_0x1030('0x28')]);if(_0x508893[_0x1030('0x29')]){delete _0x508893[_0x1030('0x29')];}_0x5415c9[_0x1030('0x19')](_0x980167)[_0x1030('0x2a')](_0x508893);};}exports[_0x1030('0x2b')]=function(_0x440f95,_0x441235){var _0xffac67={},_0x96fba1={},_0x487ca8={'count':0x0,'rows':[]};var _0x3c5c6d=_['map'](db[_0x1030('0x2c')]['rawAttributes'],function(_0x102544){return{'name':_0x102544[_0x1030('0x2d')],'type':_0x102544[_0x1030('0x2e')]['key']};});_0x96fba1[_0x1030('0x2f')]=_[_0x1030('0x30')](_0x3c5c6d,_0x1030('0x29'));_0x96fba1[_0x1030('0x31')]=_[_0x1030('0x32')](_0x440f95[_0x1030('0x31')]);_0x96fba1['filters']=_[_0x1030('0x33')](_0x96fba1[_0x1030('0x2f')],_0x96fba1[_0x1030('0x31')]);_0xffac67[_0x1030('0x34')]=_['intersection'](_0x96fba1[_0x1030('0x2f')],qs[_0x1030('0x35')](_0x440f95[_0x1030('0x31')][_0x1030('0x35')]));_0xffac67['attributes']=_0xffac67['attributes'][_0x1030('0x36')]?_0xffac67[_0x1030('0x34')]:_0x96fba1[_0x1030('0x2f')];if(!_0x440f95['query'][_0x1030('0x37')](_0x1030('0x38'))){_0xffac67['limit']=qs[_0x1030('0x1e')](_0x440f95[_0x1030('0x31')][_0x1030('0x1e')]);_0xffac67[_0x1030('0x1c')]=qs[_0x1030('0x1c')](_0x440f95[_0x1030('0x31')][_0x1030('0x1c')]);}_0xffac67[_0x1030('0x39')]=qs['sort'](_0x440f95['query'][_0x1030('0x3a')]);_0xffac67['where']=qs[_0x1030('0x3b')](_[_0x1030('0x3c')](_0x440f95[_0x1030('0x31')],_0x96fba1[_0x1030('0x3b')]),_0x3c5c6d);if(_0x440f95['query']['filter']){_0xffac67['where']=_['merge'](_0xffac67[_0x1030('0x3d')],{'$or':_[_0x1030('0x30')](_0x3c5c6d,function(_0x151b1a){if(_0x151b1a[_0x1030('0x2e')]!=='VIRTUAL'){var _0x12b70a={};_0x12b70a[_0x151b1a[_0x1030('0x29')]]={'$like':'%'+_0x440f95[_0x1030('0x31')]['filter']+'%'};return _0x12b70a;}})});}_0xffac67=_[_0x1030('0x3e')]({},_0xffac67,_0x440f95['options']);var _0x29426b={'where':_0xffac67[_0x1030('0x3d')]};return db[_0x1030('0x2c')][_0x1030('0x1f')](_0x29426b)[_0x1030('0x26')](function(_0x5715cf){_0x487ca8[_0x1030('0x1f')]=_0x5715cf;if(_0x440f95[_0x1030('0x31')]['includeAll']){_0xffac67[_0x1030('0x3f')]=[{'all':!![]}];}return db[_0x1030('0x2c')]['findAll'](_0xffac67);})[_0x1030('0x26')](function(_0x389760){_0x487ca8[_0x1030('0x40')]=_0x389760;return _0x487ca8;})[_0x1030('0x26')](respondWithFilteredResult(_0x441235,_0xffac67))[_0x1030('0x41')](handleError(_0x441235,null));};exports[_0x1030('0x42')]=function(_0x1650b4,_0x1dbaf9){var _0x27fa8d={'raw':![],'where':{'id':_0x1650b4[_0x1030('0x43')]['id']}},_0x1562cf={};_0x1562cf['model']=_[_0x1030('0x32')](db['SugarcrmConfiguration'][_0x1030('0x44')]);_0x1562cf[_0x1030('0x31')]=_[_0x1030('0x32')](_0x1650b4[_0x1030('0x31')]);_0x1562cf['filters']=_[_0x1030('0x33')](_0x1562cf[_0x1030('0x2f')],_0x1562cf['query']);_0x27fa8d[_0x1030('0x34')]=_[_0x1030('0x33')](_0x1562cf[_0x1030('0x2f')],qs[_0x1030('0x35')](_0x1650b4[_0x1030('0x31')][_0x1030('0x35')]));_0x27fa8d[_0x1030('0x34')]=_0x27fa8d[_0x1030('0x34')]['length']?_0x27fa8d[_0x1030('0x34')]:_0x1562cf['model'];if(_0x1650b4[_0x1030('0x31')][_0x1030('0x45')]){_0x27fa8d[_0x1030('0x3f')]=[{'all':!![]}];}_0x27fa8d=_[_0x1030('0x3e')]({},_0x27fa8d,_0x1650b4['options']);return db[_0x1030('0x2c')][_0x1030('0x46')](_0x27fa8d)['then'](handleEntityNotFound(_0x1dbaf9,null))[_0x1030('0x26')](respondWithResult(_0x1dbaf9,null))[_0x1030('0x41')](handleError(_0x1dbaf9,null));};exports['create']=function(_0x5173c2,_0x5c8285){return db[_0x1030('0x2c')][_0x1030('0x47')](_0x5173c2[_0x1030('0x48')],{})[_0x1030('0x26')](respondWithResult(_0x5c8285,0xc9))[_0x1030('0x41')](handleError(_0x5c8285,null));};exports[_0x1030('0x25')]=function(_0x2addd4,_0x331879){if(_0x2addd4[_0x1030('0x48')]['id']){delete _0x2addd4[_0x1030('0x48')]['id'];}return db[_0x1030('0x2c')][_0x1030('0x46')]({'where':{'id':_0x2addd4[_0x1030('0x43')]['id']}})['then'](handleEntityNotFound(_0x331879,null))[_0x1030('0x26')](saveUpdates(_0x2addd4['body'],null))[_0x1030('0x26')](respondWithResult(_0x331879,null))[_0x1030('0x41')](handleError(_0x331879,null));};exports[_0x1030('0x49')]=function(_0x53bfb1,_0x5e431e){return db[_0x1030('0x2c')][_0x1030('0x46')]({'where':{'id':_0x53bfb1[_0x1030('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e431e,null))[_0x1030('0x26')](removeEntity(_0x5e431e,null))[_0x1030('0x41')](handleError(_0x5e431e,null));};exports[_0x1030('0x4a')]=function(_0x1d2004,_0x3db492,_0x3cf580){var _0x4a4fe4={};var _0x15373a={};var _0x3d459a;var _0x5dbcde;return db['SugarcrmConfiguration'][_0x1030('0x4b')]({'where':{'id':_0x1d2004[_0x1030('0x43')]['id']}})[_0x1030('0x26')](handleEntityNotFound(_0x3db492,null))[_0x1030('0x26')](function(_0x477657){if(_0x477657){_0x3d459a=_0x477657;_0x15373a[_0x1030('0x2f')]=_[_0x1030('0x32')](db[_0x1030('0x4c')][_0x1030('0x44')]);_0x15373a[_0x1030('0x31')]=_['keys'](_0x1d2004['query']);_0x15373a[_0x1030('0x3b')]=_[_0x1030('0x33')](_0x15373a[_0x1030('0x2f')],_0x15373a[_0x1030('0x31')]);_0x4a4fe4['attributes']=_[_0x1030('0x33')](_0x15373a['model'],qs[_0x1030('0x35')](_0x1d2004['query'][_0x1030('0x35')]));_0x4a4fe4[_0x1030('0x34')]=_0x4a4fe4[_0x1030('0x34')][_0x1030('0x36')]?_0x4a4fe4['attributes']:_0x15373a['model'];_0x4a4fe4[_0x1030('0x39')]=qs[_0x1030('0x3a')](_0x1d2004['query'][_0x1030('0x3a')]);_0x4a4fe4[_0x1030('0x3d')]=qs[_0x1030('0x3b')](_[_0x1030('0x3c')](_0x1d2004[_0x1030('0x31')],_0x15373a[_0x1030('0x3b')]));if(_0x1d2004['query'][_0x1030('0x4d')]){_0x4a4fe4['where']=_[_0x1030('0x3e')](_0x4a4fe4['where'],{'$or':_[_0x1030('0x30')](_0x4a4fe4['attributes'],function(_0x1f54dd){var _0x5559c9={};_0x5559c9[_0x1f54dd]={'$like':'%'+_0x1d2004[_0x1030('0x31')][_0x1030('0x4d')]+'%'};return _0x5559c9;})});}_0x4a4fe4=_[_0x1030('0x3e')]({},_0x4a4fe4,_0x1d2004[_0x1030('0x4e')]);return _0x3d459a[_0x1030('0x4a')](_0x4a4fe4);}})['then'](function(_0x2a22f3){if(_0x2a22f3){_0x5dbcde=_0x2a22f3[_0x1030('0x36')];if(!_0x1d2004[_0x1030('0x31')][_0x1030('0x37')]('nolimit')){_0x4a4fe4[_0x1030('0x1e')]=qs[_0x1030('0x1e')](_0x1d2004[_0x1030('0x31')][_0x1030('0x1e')]);_0x4a4fe4[_0x1030('0x1c')]=qs[_0x1030('0x1c')](_0x1d2004[_0x1030('0x31')][_0x1030('0x1c')]);}return _0x3d459a[_0x1030('0x4a')](_0x4a4fe4);}})[_0x1030('0x26')](function(_0x2c9776){if(_0x2c9776){return _0x2c9776?{'count':_0x5dbcde,'rows':_0x2c9776}:null;}})[_0x1030('0x26')](respondWithResult(_0x3db492,null))[_0x1030('0x41')](handleError(_0x3db492,null));};exports['getSubjects']=function(_0x21f486,_0x246135,_0x68c7e4){var _0x5dab6d={};var _0x4f6c53={};var _0x3caae9;var _0x3e6404;return db[_0x1030('0x2c')]['findOne']({'where':{'id':_0x21f486['params']['id']}})[_0x1030('0x26')](handleEntityNotFound(_0x246135,null))['then'](function(_0x483a4e){if(_0x483a4e){_0x3caae9=_0x483a4e;_0x4f6c53[_0x1030('0x2f')]=_[_0x1030('0x32')](db[_0x1030('0x4c')][_0x1030('0x44')]);_0x4f6c53['query']=_[_0x1030('0x32')](_0x21f486[_0x1030('0x31')]);_0x4f6c53[_0x1030('0x3b')]=_[_0x1030('0x33')](_0x4f6c53[_0x1030('0x2f')],_0x4f6c53['query']);_0x5dab6d[_0x1030('0x34')]=_[_0x1030('0x33')](_0x4f6c53['model'],qs[_0x1030('0x35')](_0x21f486[_0x1030('0x31')][_0x1030('0x35')]));_0x5dab6d[_0x1030('0x34')]=_0x5dab6d['attributes']['length']?_0x5dab6d[_0x1030('0x34')]:_0x4f6c53[_0x1030('0x2f')];_0x5dab6d[_0x1030('0x39')]=qs[_0x1030('0x3a')](_0x21f486[_0x1030('0x31')][_0x1030('0x3a')]);_0x5dab6d[_0x1030('0x3d')]=qs[_0x1030('0x3b')](_['pick'](_0x21f486['query'],_0x4f6c53[_0x1030('0x3b')]));if(_0x21f486[_0x1030('0x31')][_0x1030('0x4d')]){_0x5dab6d[_0x1030('0x3d')]=_[_0x1030('0x3e')](_0x5dab6d[_0x1030('0x3d')],{'$or':_['map'](_0x5dab6d[_0x1030('0x34')],function(_0x8c159f){var _0x439ccd={};_0x439ccd[_0x8c159f]={'$like':'%'+_0x21f486[_0x1030('0x31')][_0x1030('0x4d')]+'%'};return _0x439ccd;})});}_0x5dab6d=_['merge']({},_0x5dab6d,_0x21f486['options']);return _0x3caae9[_0x1030('0x4f')](_0x5dab6d);}})[_0x1030('0x26')](function(_0x39c5e0){if(_0x39c5e0){_0x3e6404=_0x39c5e0[_0x1030('0x36')];if(!_0x21f486[_0x1030('0x31')]['hasOwnProperty'](_0x1030('0x38'))){_0x5dab6d[_0x1030('0x1e')]=qs[_0x1030('0x1e')](_0x21f486[_0x1030('0x31')]['limit']);_0x5dab6d[_0x1030('0x1c')]=qs['offset'](_0x21f486[_0x1030('0x31')][_0x1030('0x1c')]);}return _0x3caae9['getSubjects'](_0x5dab6d);}})['then'](function(_0x2dcd02){if(_0x2dcd02){return _0x2dcd02?{'count':_0x3e6404,'rows':_0x2dcd02}:null;}})[_0x1030('0x26')](respondWithResult(_0x246135,null))[_0x1030('0x41')](handleError(_0x246135,null));};exports['getDescriptions']=function(_0x35362d,_0x10e3d9,_0x799d4b){var _0xd4e389={};var _0x7f15d={};var _0x3bbf67;var _0x4023c9;return db[_0x1030('0x2c')][_0x1030('0x4b')]({'where':{'id':_0x35362d[_0x1030('0x43')]['id']}})[_0x1030('0x26')](handleEntityNotFound(_0x10e3d9,null))[_0x1030('0x26')](function(_0x25bf2c){if(_0x25bf2c){_0x3bbf67=_0x25bf2c;_0x7f15d[_0x1030('0x2f')]=_[_0x1030('0x32')](db[_0x1030('0x4c')][_0x1030('0x44')]);_0x7f15d['query']=_[_0x1030('0x32')](_0x35362d['query']);_0x7f15d['filters']=_['intersection'](_0x7f15d[_0x1030('0x2f')],_0x7f15d['query']);_0xd4e389['attributes']=_[_0x1030('0x33')](_0x7f15d[_0x1030('0x2f')],qs[_0x1030('0x35')](_0x35362d[_0x1030('0x31')][_0x1030('0x35')]));_0xd4e389[_0x1030('0x34')]=_0xd4e389[_0x1030('0x34')]['length']?_0xd4e389['attributes']:_0x7f15d[_0x1030('0x2f')];_0xd4e389[_0x1030('0x39')]=qs[_0x1030('0x3a')](_0x35362d[_0x1030('0x31')][_0x1030('0x3a')]);_0xd4e389['where']=qs[_0x1030('0x3b')](_[_0x1030('0x3c')](_0x35362d[_0x1030('0x31')],_0x7f15d[_0x1030('0x3b')]));if(_0x35362d[_0x1030('0x31')][_0x1030('0x4d')]){_0xd4e389[_0x1030('0x3d')]=_[_0x1030('0x3e')](_0xd4e389[_0x1030('0x3d')],{'$or':_[_0x1030('0x30')](_0xd4e389['attributes'],function(_0x135fc5){var _0x3cc5fe={};_0x3cc5fe[_0x135fc5]={'$like':'%'+_0x35362d[_0x1030('0x31')][_0x1030('0x4d')]+'%'};return _0x3cc5fe;})});}_0xd4e389=_[_0x1030('0x3e')]({},_0xd4e389,_0x35362d[_0x1030('0x4e')]);return _0x3bbf67[_0x1030('0x50')](_0xd4e389);}})[_0x1030('0x26')](function(_0x2de9d2){if(_0x2de9d2){_0x4023c9=_0x2de9d2[_0x1030('0x36')];if(!_0x35362d[_0x1030('0x31')]['hasOwnProperty']('nolimit')){_0xd4e389[_0x1030('0x1e')]=qs[_0x1030('0x1e')](_0x35362d[_0x1030('0x31')]['limit']);_0xd4e389[_0x1030('0x1c')]=qs[_0x1030('0x1c')](_0x35362d[_0x1030('0x31')][_0x1030('0x1c')]);}return _0x3bbf67['getDescriptions'](_0xd4e389);}})[_0x1030('0x26')](function(_0x5a649d){if(_0x5a649d){return _0x5a649d?{'count':_0x4023c9,'rows':_0x5a649d}:null;}})[_0x1030('0x26')](respondWithResult(_0x10e3d9,null))[_0x1030('0x41')](handleError(_0x10e3d9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index d89c772..f940dce 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 _0x43ea=['lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','SugarcrmConfiguration'];(function(_0x34edbb,_0x36fd38){var _0x4bf32f=function(_0x326111){while(--_0x326111){_0x34edbb['push'](_0x34edbb['shift']());}};_0x4bf32f(++_0x36fd38);}(_0x43ea,0x1c2));var _0xa43e=function(_0x3c8843,_0xeb83f5){_0x3c8843=_0x3c8843-0x0;var _0x1db153=_0x43ea[_0x3c8843];return _0x1db153;};'use strict';var _=require(_0xa43e('0x0'));var util=require('util');var logger=require(_0xa43e('0x1'))(_0xa43e('0x2'));var moment=require(_0xa43e('0x3'));var BPromise=require('bluebird');var rp=require(_0xa43e('0x4'));var fs=require('fs');var path=require(_0xa43e('0x5'));var rimraf=require('rimraf');var config=require(_0xa43e('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xa43e('0x7')]=function(_0x50d67f,_0x25b8d3){return _0x50d67f['define'](_0xa43e('0x8'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8b6=['int_sugarcrm_configurations','util','../../config/logger','api','moment','bluebird','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf8b6,0xd3));var _0x6f8b=function(_0x3fe5a9,_0x1d3099){_0x3fe5a9=_0x3fe5a9-0x0;var _0x59c606=_0xf8b6[_0x3fe5a9];return _0x59c606;};'use strict';var _=require('lodash');var util=require(_0x6f8b('0x0'));var logger=require(_0x6f8b('0x1'))(_0x6f8b('0x2'));var moment=require(_0x6f8b('0x3'));var BPromise=require(_0x6f8b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6f8b('0x5'));var attributes=require(_0x6f8b('0x6'));module[_0x6f8b('0x7')]=function(_0x491cc6,_0x4fe7a0){return _0x491cc6['define'](_0x6f8b('0x8'),attributes,{'tableName':_0x6f8b('0x9'),'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 e24b2f8..230dd74 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 _0x78d4=['request','then','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5a3959,_0x39dec0){var _0x5ba3c8=function(_0x51ad55){while(--_0x51ad55){_0x5a3959['push'](_0x5a3959['shift']());}};_0x5ba3c8(++_0x39dec0);}(_0x78d4,0x1a9));var _0x478d=function(_0x433093,_0x198cba){_0x433093=_0x433093-0x0;var _0x31d3c3=_0x78d4[_0x433093];return _0x31d3c3;};'use strict';var _=require(_0x478d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x478d('0x1'));var rs=require(_0x478d('0x2'));var fs=require('fs');var Redis=require(_0x478d('0x3'));var db=require(_0x478d('0x4'))['db'];var utils=require(_0x478d('0x5'));var logger=require(_0x478d('0x6'))(_0x478d('0x7'));var config=require(_0x478d('0x8'));var jayson=require(_0x478d('0x9'));var client=jayson[_0x478d('0xa')][_0x478d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e3df5,_0x27c95b,_0x221e30){return new BPromise(function(_0x36af47,_0x11bb49){return client[_0x478d('0xc')](_0x2e3df5,_0x221e30)[_0x478d('0xd')](function(_0x1ed500){logger[_0x478d('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x27c95b,_0x478d('0xf'));logger['debug'](_0x478d('0x10'),_0x27c95b,'request\x20sent',JSON[_0x478d('0x11')](_0x1ed500));if(_0x1ed500[_0x478d('0x12')]){if(_0x1ed500[_0x478d('0x12')][_0x478d('0x13')]===0x1f4){logger['error'](_0x478d('0x14'),_0x27c95b,_0x1ed500[_0x478d('0x12')][_0x478d('0x15')]);return _0x11bb49(_0x1ed500['error']['message']);}logger[_0x478d('0x12')](_0x478d('0x14'),_0x27c95b,_0x1ed500[_0x478d('0x12')][_0x478d('0x15')]);return _0x36af47(_0x1ed500[_0x478d('0x12')][_0x478d('0x15')]);}else{logger[_0x478d('0xe')](_0x478d('0x14'),_0x27c95b,_0x478d('0xf'));_0x36af47(_0x1ed500[_0x478d('0x16')][_0x478d('0x15')]);}})['catch'](function(_0x36d725){logger[_0x478d('0x12')](_0x478d('0x14'),_0x27c95b,_0x36d725);_0x11bb49(_0x36d725);});});} \ No newline at end of file +var _0x0bc5=['jayson/promise','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x0bc5,0x1b1));var _0x50bc=function(_0x21ddfe,_0x4b0d5c){_0x21ddfe=_0x21ddfe-0x0;var _0x5e086f=_0x0bc5[_0x21ddfe];return _0x5e086f;};'use strict';var _=require(_0x50bc('0x0'));var util=require(_0x50bc('0x1'));var moment=require(_0x50bc('0x2'));var BPromise=require(_0x50bc('0x3'));var rs=require(_0x50bc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50bc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x50bc('0x6'));var config=require(_0x50bc('0x7'));var jayson=require(_0x50bc('0x8'));var client=jayson['client'][_0x50bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54e6d9,_0x2eece3,_0x18ceb3){return new BPromise(function(_0x4b5538,_0x12b928){return client[_0x50bc('0xa')](_0x54e6d9,_0x18ceb3)['then'](function(_0x886f93){logger[_0x50bc('0xb')](_0x50bc('0xc'),_0x2eece3,_0x50bc('0xd'));logger[_0x50bc('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x2eece3,_0x50bc('0xd'),JSON[_0x50bc('0xf')](_0x886f93));if(_0x886f93['error']){if(_0x886f93[_0x50bc('0x10')][_0x50bc('0x11')]===0x1f4){logger[_0x50bc('0x10')](_0x50bc('0xc'),_0x2eece3,_0x886f93[_0x50bc('0x10')][_0x50bc('0x12')]);return _0x12b928(_0x886f93[_0x50bc('0x10')][_0x50bc('0x12')]);}logger['error'](_0x50bc('0xc'),_0x2eece3,_0x886f93[_0x50bc('0x10')][_0x50bc('0x12')]);return _0x4b5538(_0x886f93[_0x50bc('0x10')]['message']);}else{logger[_0x50bc('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2eece3,_0x50bc('0xd'));_0x4b5538(_0x886f93[_0x50bc('0x13')][_0x50bc('0x12')]);}})[_0x50bc('0x14')](function(_0x51f88a){logger[_0x50bc('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2eece3,_0x51f88a);_0x12b928(_0x51f88a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index e36cdaf..b269529 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 _0x4432=['../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x4432,0xf9));var _0x2443=function(_0x2317aa,_0x477c65){_0x2317aa=_0x2317aa-0x0;var _0x2c3dd4=_0x4432[_0x2317aa];return _0x2c3dd4;};'use strict';var multer=require(_0x2443('0x0'));var util=require(_0x2443('0x1'));var path=require(_0x2443('0x2'));var timeout=require(_0x2443('0x3'));var express=require('express');var router=express[_0x2443('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2443('0x5'));var interaction=require(_0x2443('0x6'));var config=require(_0x2443('0x7'));var controller=require(_0x2443('0x8'));router[_0x2443('0x9')]('/',auth['isAuthenticated'](),controller[_0x2443('0xa')]);router['get'](_0x2443('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x2443('0xc')](),controller['create']);router[_0x2443('0xd')](_0x2443('0xb'),auth['isAuthenticated'](),controller[_0x2443('0xe')]);router['delete']('/:id',auth[_0x2443('0xc')](),controller[_0x2443('0xf')]);module[_0x2443('0x10')]=router; \ No newline at end of file +var _0x225f=['update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x370c4d,_0x38ac8d){var _0x3d2648=function(_0x32b19c){while(--_0x32b19c){_0x370c4d['push'](_0x370c4d['shift']());}};_0x3d2648(++_0x38ac8d);}(_0x225f,0x147));var _0xf225=function(_0x4451d4,_0x5a9d1d){_0x4451d4=_0x4451d4-0x0;var _0x4dde20=_0x225f[_0x4451d4];return _0x4dde20;};'use strict';var multer=require(_0xf225('0x0'));var util=require('util');var path=require(_0xf225('0x1'));var timeout=require(_0xf225('0x2'));var express=require(_0xf225('0x3'));var router=express[_0xf225('0x4')]();var fs_extra=require(_0xf225('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf225('0x6'));var config=require(_0xf225('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xf225('0x8')]('/',auth[_0xf225('0x9')](),controller[_0xf225('0xa')]);router[_0xf225('0x8')](_0xf225('0xb'),auth[_0xf225('0x9')](),controller[_0xf225('0xc')]);router[_0xf225('0xd')]('/',auth[_0xf225('0x9')](),controller[_0xf225('0xe')]);router['put'](_0xf225('0xb'),auth[_0xf225('0x9')](),controller[_0xf225('0xf')]);router[_0xf225('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf225('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 5d22235..61ce839 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 _0x860a=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','STRING'];(function(_0x2602a2,_0x2210ad){var _0x283286=function(_0x299f6a){while(--_0x299f6a){_0x2602a2['push'](_0x2602a2['shift']());}};_0x283286(++_0x2210ad);}(_0x860a,0x110));var _0xa860=function(_0x5cfa4f,_0x136582){_0x5cfa4f=_0x5cfa4f-0x0;var _0x5d66cf=_0x860a[_0x5cfa4f];return _0x5d66cf;};'use strict';var Sequelize=require(_0xa860('0x0'));module[_0xa860('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa860('0x2'),_0xa860('0x3'),_0xa860('0x4'),_0xa860('0x5'),'picklist'),'defaultValue':_0xa860('0x2')},'content':{'type':Sequelize[_0xa860('0x6')]},'key':{'type':Sequelize[_0xa860('0x6')]},'keyType':{'type':Sequelize[_0xa860('0x7')]('string',_0xa860('0x3'),_0xa860('0x4'))},'keyContent':{'type':Sequelize[_0xa860('0x6')]},'idField':{'type':Sequelize[_0xa860('0x6')]},'nameField':{'type':Sequelize[_0xa860('0x6')]},'customField':{'type':Sequelize[_0xa860('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa860('0x6')]}}; \ No newline at end of file +var _0x095e=['sequelize','ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN'];(function(_0x22bc48,_0x59b5ee){var _0x545e3a=function(_0x2c07ec){while(--_0x2c07ec){_0x22bc48['push'](_0x22bc48['shift']());}};_0x545e3a(++_0x59b5ee);}(_0x095e,0xe8));var _0xe095=function(_0x361a73,_0x33eff4){_0x361a73=_0x361a73-0x0;var _0x4ebb4b=_0x095e[_0x361a73];return _0x4ebb4b;};'use strict';var Sequelize=require(_0xe095('0x0'));module['exports']={'type':{'type':Sequelize[_0xe095('0x1')](_0xe095('0x2'),'variable',_0xe095('0x3'),'keyValue',_0xe095('0x4')),'defaultValue':_0xe095('0x2')},'content':{'type':Sequelize[_0xe095('0x5')]},'key':{'type':Sequelize[_0xe095('0x5')]},'keyType':{'type':Sequelize[_0xe095('0x1')](_0xe095('0x2'),_0xe095('0x6'),_0xe095('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe095('0x5')]},'nameField':{'type':Sequelize[_0xe095('0x5')]},'customField':{'type':Sequelize[_0xe095('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe095('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c70c733..1609a97 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 _0x2a37=['find','then','create','body','update','destroy','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','error','stack','name','index','SugarcrmField','fieldName','type','key','model','map','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','fields'];(function(_0x5f23ea,_0x433cb5){var _0x4c36ab=function(_0x28a01a){while(--_0x28a01a){_0x5f23ea['push'](_0x5f23ea['shift']());}};_0x4c36ab(++_0x433cb5);}(_0x2a37,0xdb));var _0x72a3=function(_0x1d39de,_0xf43f7b){_0x1d39de=_0x1d39de-0x0;var _0x2e6677=_0x2a37[_0x1d39de];return _0x2e6677;};'use strict';var emlformat=require(_0x72a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72a3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x72a3('0x2'));var moment=require('moment');var BPromise=require(_0x72a3('0x3'));var Mustache=require(_0x72a3('0x4'));var util=require(_0x72a3('0x5'));var path=require(_0x72a3('0x6'));var sox=require(_0x72a3('0x7'));var csv=require(_0x72a3('0x8'));var ejs=require(_0x72a3('0x9'));var fs=require('fs');var fs_extra=require(_0x72a3('0xa'));var _=require(_0x72a3('0xb'));var squel=require(_0x72a3('0xc'));var crypto=require('crypto');var jsforce=require(_0x72a3('0xd'));var deskjs=require(_0x72a3('0xe'));var toCsv=require(_0x72a3('0x8'));var querystring=require(_0x72a3('0xf'));var Papa=require(_0x72a3('0x10'));var Redis=require(_0x72a3('0x11'));var authService=require(_0x72a3('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a3('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x72a3('0x14'));var config=require(_0x72a3('0x15'));var licenseUtil=require(_0x72a3('0x16'));var db=require(_0x72a3('0x17'))['db'];function respondWithStatusCode(_0x5b8223,_0x13e9f2){_0x13e9f2=_0x13e9f2||0xcc;return function(_0x991485){if(_0x991485){return _0x5b8223[_0x72a3('0x18')](_0x13e9f2);}return _0x5b8223[_0x72a3('0x19')](_0x13e9f2)[_0x72a3('0x1a')]();};}function respondWithResult(_0x288cbf,_0x32eef6){_0x32eef6=_0x32eef6||0xc8;return function(_0x1d2893){if(_0x1d2893){return _0x288cbf[_0x72a3('0x19')](_0x32eef6)['json'](_0x1d2893);}};}function respondWithFilteredResult(_0x5ad911,_0x32f67e){return function(_0x25ab6d){if(_0x25ab6d){var _0x13ea2e=typeof _0x32f67e[_0x72a3('0x1b')]===_0x72a3('0x1c')&&typeof _0x32f67e[_0x72a3('0x1d')]===_0x72a3('0x1c');var _0x158b49=_0x25ab6d[_0x72a3('0x1e')];var _0x1563f6=_0x13ea2e?0x0:_0x32f67e[_0x72a3('0x1b')];var _0x220d0e=_0x13ea2e?_0x25ab6d[_0x72a3('0x1e')]:_0x32f67e[_0x72a3('0x1b')]+_0x32f67e[_0x72a3('0x1d')];var _0x7ee09b;if(_0x220d0e>=_0x158b49){_0x220d0e=_0x158b49;_0x7ee09b=0xc8;}else{_0x7ee09b=0xce;}_0x5ad911[_0x72a3('0x19')](_0x7ee09b);return _0x5ad911[_0x72a3('0x1f')](_0x72a3('0x20'),_0x1563f6+'-'+_0x220d0e+'/'+_0x158b49)['json'](_0x25ab6d);}return null;};}function patchUpdates(_0xe7e787){return function(_0x40e4ab){try{jsonpatch['apply'](_0x40e4ab,_0xe7e787,!![]);}catch(_0xd6caf9){return BPromise[_0x72a3('0x21')](_0xd6caf9);}return _0x40e4ab[_0x72a3('0x22')]();};}function saveUpdates(_0xa08087,_0x3fa448){return function(_0x2bdfc9){if(_0x2bdfc9){return _0x2bdfc9['update'](_0xa08087)['then'](function(_0x4af9d6){return _0x4af9d6;});}return null;};}function removeEntity(_0x4a2f95,_0x17f21b){return function(_0x2214ea){if(_0x2214ea){return _0x2214ea['destroy']()['then'](function(){_0x4a2f95[_0x72a3('0x19')](0xcc)[_0x72a3('0x1a')]();});}};}function handleEntityNotFound(_0x2202fc,_0x1da440){return function(_0x56bd3f){if(!_0x56bd3f){_0x2202fc[_0x72a3('0x18')](0x194);}return _0x56bd3f;};}function handleError(_0x3238d9,_0xa2d460){_0xa2d460=_0xa2d460||0x1f4;return function(_0x361343){logger[_0x72a3('0x23')](_0x361343[_0x72a3('0x24')]);if(_0x361343[_0x72a3('0x25')]){delete _0x361343[_0x72a3('0x25')];}_0x3238d9['status'](_0xa2d460)['send'](_0x361343);};}exports[_0x72a3('0x26')]=function(_0x2ebfb2,_0x12831f){var _0x1a5b97={},_0x5d8f8c={},_0x4f72df={'count':0x0,'rows':[]};var _0x1336fc=_['map'](db[_0x72a3('0x27')]['rawAttributes'],function(_0x42d6a0){return{'name':_0x42d6a0[_0x72a3('0x28')],'type':_0x42d6a0[_0x72a3('0x29')][_0x72a3('0x2a')]};});_0x5d8f8c[_0x72a3('0x2b')]=_[_0x72a3('0x2c')](_0x1336fc,_0x72a3('0x25'));_0x5d8f8c[_0x72a3('0x2d')]=_['keys'](_0x2ebfb2[_0x72a3('0x2d')]);_0x5d8f8c['filters']=_[_0x72a3('0x2e')](_0x5d8f8c[_0x72a3('0x2b')],_0x5d8f8c[_0x72a3('0x2d')]);_0x1a5b97['attributes']=_['intersection'](_0x5d8f8c[_0x72a3('0x2b')],qs['fields'](_0x2ebfb2[_0x72a3('0x2d')]['fields']));_0x1a5b97[_0x72a3('0x2f')]=_0x1a5b97[_0x72a3('0x2f')][_0x72a3('0x30')]?_0x1a5b97[_0x72a3('0x2f')]:_0x5d8f8c[_0x72a3('0x2b')];if(!_0x2ebfb2[_0x72a3('0x2d')][_0x72a3('0x31')](_0x72a3('0x32'))){_0x1a5b97[_0x72a3('0x1d')]=qs['limit'](_0x2ebfb2[_0x72a3('0x2d')][_0x72a3('0x1d')]);_0x1a5b97[_0x72a3('0x1b')]=qs[_0x72a3('0x1b')](_0x2ebfb2[_0x72a3('0x2d')][_0x72a3('0x1b')]);}_0x1a5b97['order']=qs[_0x72a3('0x33')](_0x2ebfb2['query'][_0x72a3('0x33')]);_0x1a5b97[_0x72a3('0x34')]=qs[_0x72a3('0x35')](_['pick'](_0x2ebfb2[_0x72a3('0x2d')],_0x5d8f8c[_0x72a3('0x35')]),_0x1336fc);if(_0x2ebfb2[_0x72a3('0x2d')]['filter']){_0x1a5b97[_0x72a3('0x34')]=_['merge'](_0x1a5b97[_0x72a3('0x34')],{'$or':_[_0x72a3('0x2c')](_0x1336fc,function(_0x32c935){if(_0x32c935[_0x72a3('0x29')]!=='VIRTUAL'){var _0x457136={};_0x457136[_0x32c935[_0x72a3('0x25')]]={'$like':'%'+_0x2ebfb2[_0x72a3('0x2d')]['filter']+'%'};return _0x457136;}})});}_0x1a5b97=_[_0x72a3('0x36')]({},_0x1a5b97,_0x2ebfb2[_0x72a3('0x37')]);var _0x9cd63a={'where':_0x1a5b97[_0x72a3('0x34')]};return db[_0x72a3('0x27')][_0x72a3('0x1e')](_0x9cd63a)['then'](function(_0x276034){_0x4f72df['count']=_0x276034;if(_0x2ebfb2[_0x72a3('0x2d')][_0x72a3('0x38')]){_0x1a5b97[_0x72a3('0x39')]=[{'all':!![]}];}return db[_0x72a3('0x27')][_0x72a3('0x3a')](_0x1a5b97);})['then'](function(_0x1d7480){_0x4f72df['rows']=_0x1d7480;return _0x4f72df;})['then'](respondWithFilteredResult(_0x12831f,_0x1a5b97))[_0x72a3('0x3b')](handleError(_0x12831f,null));};exports[_0x72a3('0x3c')]=function(_0x440280,_0x1da52d){var _0x108202={'raw':!![],'where':{'id':_0x440280[_0x72a3('0x3d')]['id']}},_0x48e7a4={};_0x48e7a4[_0x72a3('0x2b')]=_[_0x72a3('0x3e')](db['SugarcrmField'][_0x72a3('0x3f')]);_0x48e7a4[_0x72a3('0x2d')]=_[_0x72a3('0x3e')](_0x440280[_0x72a3('0x2d')]);_0x48e7a4[_0x72a3('0x35')]=_['intersection'](_0x48e7a4[_0x72a3('0x2b')],_0x48e7a4[_0x72a3('0x2d')]);_0x108202[_0x72a3('0x2f')]=_['intersection'](_0x48e7a4[_0x72a3('0x2b')],qs[_0x72a3('0x40')](_0x440280[_0x72a3('0x2d')][_0x72a3('0x40')]));_0x108202[_0x72a3('0x2f')]=_0x108202['attributes'][_0x72a3('0x30')]?_0x108202['attributes']:_0x48e7a4[_0x72a3('0x2b')];if(_0x440280[_0x72a3('0x2d')][_0x72a3('0x38')]){_0x108202[_0x72a3('0x39')]=[{'all':!![]}];}_0x108202=_[_0x72a3('0x36')]({},_0x108202,_0x440280[_0x72a3('0x37')]);return db[_0x72a3('0x27')][_0x72a3('0x41')](_0x108202)[_0x72a3('0x42')](handleEntityNotFound(_0x1da52d,null))[_0x72a3('0x42')](respondWithResult(_0x1da52d,null))[_0x72a3('0x3b')](handleError(_0x1da52d,null));};exports[_0x72a3('0x43')]=function(_0x5c6815,_0x1b9d11){return db[_0x72a3('0x27')][_0x72a3('0x43')](_0x5c6815[_0x72a3('0x44')],{})[_0x72a3('0x42')](respondWithResult(_0x1b9d11,0xc9))[_0x72a3('0x3b')](handleError(_0x1b9d11,null));};exports[_0x72a3('0x45')]=function(_0x35dd00,_0x83576a){if(_0x35dd00[_0x72a3('0x44')]['id']){delete _0x35dd00[_0x72a3('0x44')]['id'];}return db[_0x72a3('0x27')][_0x72a3('0x41')]({'where':{'id':_0x35dd00[_0x72a3('0x3d')]['id']}})[_0x72a3('0x42')](handleEntityNotFound(_0x83576a,null))[_0x72a3('0x42')](saveUpdates(_0x35dd00[_0x72a3('0x44')],null))[_0x72a3('0x42')](respondWithResult(_0x83576a,null))['catch'](handleError(_0x83576a,null));};exports[_0x72a3('0x46')]=function(_0x55fa10,_0x4fb7f6){return db[_0x72a3('0x27')][_0x72a3('0x41')]({'where':{'id':_0x55fa10[_0x72a3('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4fb7f6,null))[_0x72a3('0x42')](removeEntity(_0x4fb7f6,null))[_0x72a3('0x3b')](handleError(_0x4fb7f6,null));}; \ No newline at end of file +var _0x2fb4=['sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','SugarcrmField','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x13a1cf,_0x5ecbb4){var _0x825fe1=function(_0x45f848){while(--_0x45f848){_0x13a1cf['push'](_0x13a1cf['shift']());}};_0x825fe1(++_0x5ecbb4);}(_0x2fb4,0x15e));var _0x42fb=function(_0x4f1d1d,_0x458057){_0x4f1d1d=_0x4f1d1d-0x0;var _0x54dd3e=_0x2fb4[_0x4f1d1d];return _0x54dd3e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x42fb('0x0'));var zipdir=require(_0x42fb('0x1'));var jsonpatch=require(_0x42fb('0x2'));var rp=require(_0x42fb('0x3'));var moment=require('moment');var BPromise=require(_0x42fb('0x4'));var Mustache=require(_0x42fb('0x5'));var util=require(_0x42fb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x42fb('0x7'));var ejs=require(_0x42fb('0x8'));var fs=require('fs');var fs_extra=require(_0x42fb('0x9'));var _=require(_0x42fb('0xa'));var squel=require(_0x42fb('0xb'));var crypto=require(_0x42fb('0xc'));var jsforce=require(_0x42fb('0xd'));var deskjs=require(_0x42fb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x42fb('0xf'));var Papa=require('papaparse');var Redis=require(_0x42fb('0x10'));var authService=require(_0x42fb('0x11'));var qs=require(_0x42fb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x42fb('0x13'))(_0x42fb('0x14'));var utils=require(_0x42fb('0x15'));var config=require(_0x42fb('0x16'));var licenseUtil=require(_0x42fb('0x17'));var db=require(_0x42fb('0x18'))['db'];function respondWithStatusCode(_0x4374cb,_0x17310b){_0x17310b=_0x17310b||0xcc;return function(_0x27d987){if(_0x27d987){return _0x4374cb[_0x42fb('0x19')](_0x17310b);}return _0x4374cb[_0x42fb('0x1a')](_0x17310b)[_0x42fb('0x1b')]();};}function respondWithResult(_0x5c39ed,_0x16e0cb){_0x16e0cb=_0x16e0cb||0xc8;return function(_0x3595b9){if(_0x3595b9){return _0x5c39ed[_0x42fb('0x1a')](_0x16e0cb)[_0x42fb('0x1c')](_0x3595b9);}};}function respondWithFilteredResult(_0x317534,_0x412fe9){return function(_0x3e7d44){if(_0x3e7d44){var _0x809760=typeof _0x412fe9['offset']===_0x42fb('0x1d')&&typeof _0x412fe9[_0x42fb('0x1e')]===_0x42fb('0x1d');var _0x30795c=_0x3e7d44[_0x42fb('0x1f')];var _0x46f400=_0x809760?0x0:_0x412fe9[_0x42fb('0x20')];var _0x56ff2d=_0x809760?_0x3e7d44['count']:_0x412fe9[_0x42fb('0x20')]+_0x412fe9[_0x42fb('0x1e')];var _0x5105f6;if(_0x56ff2d>=_0x30795c){_0x56ff2d=_0x30795c;_0x5105f6=0xc8;}else{_0x5105f6=0xce;}_0x317534[_0x42fb('0x1a')](_0x5105f6);return _0x317534[_0x42fb('0x21')](_0x42fb('0x22'),_0x46f400+'-'+_0x56ff2d+'/'+_0x30795c)[_0x42fb('0x1c')](_0x3e7d44);}return null;};}function patchUpdates(_0xdd0037){return function(_0x6b207a){try{jsonpatch[_0x42fb('0x23')](_0x6b207a,_0xdd0037,!![]);}catch(_0x3983a9){return BPromise['reject'](_0x3983a9);}return _0x6b207a[_0x42fb('0x24')]();};}function saveUpdates(_0x5c4987,_0x1771e7){return function(_0x12a09f){if(_0x12a09f){return _0x12a09f[_0x42fb('0x25')](_0x5c4987)[_0x42fb('0x26')](function(_0x2f7bc3){return _0x2f7bc3;});}return null;};}function removeEntity(_0x173cf9,_0x88c170){return function(_0x18e313){if(_0x18e313){return _0x18e313['destroy']()[_0x42fb('0x26')](function(){_0x173cf9['status'](0xcc)[_0x42fb('0x1b')]();});}};}function handleEntityNotFound(_0x18d9b5,_0x542d12){return function(_0x42508a){if(!_0x42508a){_0x18d9b5['sendStatus'](0x194);}return _0x42508a;};}function handleError(_0x2adcdf,_0x2178a8){_0x2178a8=_0x2178a8||0x1f4;return function(_0x4c36e6){logger['error'](_0x4c36e6[_0x42fb('0x27')]);if(_0x4c36e6[_0x42fb('0x28')]){delete _0x4c36e6[_0x42fb('0x28')];}_0x2adcdf[_0x42fb('0x1a')](_0x2178a8)[_0x42fb('0x29')](_0x4c36e6);};}exports['index']=function(_0x1ca624,_0xa79d20){var _0x298f01={},_0x3fb0da={},_0x3cac91={'count':0x0,'rows':[]};var _0x5560c3=_['map'](db[_0x42fb('0x2a')][_0x42fb('0x2b')],function(_0xc78fb0){return{'name':_0xc78fb0[_0x42fb('0x2c')],'type':_0xc78fb0[_0x42fb('0x2d')]['key']};});_0x3fb0da[_0x42fb('0x2e')]=_[_0x42fb('0x2f')](_0x5560c3,'name');_0x3fb0da[_0x42fb('0x30')]=_[_0x42fb('0x31')](_0x1ca624['query']);_0x3fb0da[_0x42fb('0x32')]=_['intersection'](_0x3fb0da[_0x42fb('0x2e')],_0x3fb0da[_0x42fb('0x30')]);_0x298f01[_0x42fb('0x33')]=_[_0x42fb('0x34')](_0x3fb0da['model'],qs[_0x42fb('0x35')](_0x1ca624['query']['fields']));_0x298f01['attributes']=_0x298f01[_0x42fb('0x33')][_0x42fb('0x36')]?_0x298f01[_0x42fb('0x33')]:_0x3fb0da[_0x42fb('0x2e')];if(!_0x1ca624[_0x42fb('0x30')]['hasOwnProperty'](_0x42fb('0x37'))){_0x298f01[_0x42fb('0x1e')]=qs[_0x42fb('0x1e')](_0x1ca624[_0x42fb('0x30')][_0x42fb('0x1e')]);_0x298f01[_0x42fb('0x20')]=qs[_0x42fb('0x20')](_0x1ca624[_0x42fb('0x30')]['offset']);}_0x298f01[_0x42fb('0x38')]=qs[_0x42fb('0x39')](_0x1ca624['query'][_0x42fb('0x39')]);_0x298f01[_0x42fb('0x3a')]=qs['filters'](_[_0x42fb('0x3b')](_0x1ca624[_0x42fb('0x30')],_0x3fb0da['filters']),_0x5560c3);if(_0x1ca624[_0x42fb('0x30')][_0x42fb('0x3c')]){_0x298f01[_0x42fb('0x3a')]=_['merge'](_0x298f01[_0x42fb('0x3a')],{'$or':_[_0x42fb('0x2f')](_0x5560c3,function(_0x3a26b1){if(_0x3a26b1['type']!==_0x42fb('0x3d')){var _0x429b25={};_0x429b25[_0x3a26b1[_0x42fb('0x28')]]={'$like':'%'+_0x1ca624[_0x42fb('0x30')][_0x42fb('0x3c')]+'%'};return _0x429b25;}})});}_0x298f01=_[_0x42fb('0x3e')]({},_0x298f01,_0x1ca624['options']);var _0x293599={'where':_0x298f01[_0x42fb('0x3a')]};return db[_0x42fb('0x2a')][_0x42fb('0x1f')](_0x293599)[_0x42fb('0x26')](function(_0x155210){_0x3cac91['count']=_0x155210;if(_0x1ca624['query'][_0x42fb('0x3f')]){_0x298f01['include']=[{'all':!![]}];}return db[_0x42fb('0x2a')][_0x42fb('0x40')](_0x298f01);})[_0x42fb('0x26')](function(_0x55a287){_0x3cac91[_0x42fb('0x41')]=_0x55a287;return _0x3cac91;})[_0x42fb('0x26')](respondWithFilteredResult(_0xa79d20,_0x298f01))[_0x42fb('0x42')](handleError(_0xa79d20,null));};exports[_0x42fb('0x43')]=function(_0x2302ad,_0x24632f){var _0x3f574a={'raw':!![],'where':{'id':_0x2302ad[_0x42fb('0x44')]['id']}},_0x1c5d06={};_0x1c5d06[_0x42fb('0x2e')]=_['keys'](db[_0x42fb('0x2a')]['rawAttributes']);_0x1c5d06['query']=_[_0x42fb('0x31')](_0x2302ad[_0x42fb('0x30')]);_0x1c5d06['filters']=_['intersection'](_0x1c5d06[_0x42fb('0x2e')],_0x1c5d06['query']);_0x3f574a[_0x42fb('0x33')]=_[_0x42fb('0x34')](_0x1c5d06['model'],qs[_0x42fb('0x35')](_0x2302ad[_0x42fb('0x30')][_0x42fb('0x35')]));_0x3f574a['attributes']=_0x3f574a['attributes']['length']?_0x3f574a[_0x42fb('0x33')]:_0x1c5d06[_0x42fb('0x2e')];if(_0x2302ad['query'][_0x42fb('0x3f')]){_0x3f574a[_0x42fb('0x45')]=[{'all':!![]}];}_0x3f574a=_['merge']({},_0x3f574a,_0x2302ad[_0x42fb('0x46')]);return db[_0x42fb('0x2a')][_0x42fb('0x47')](_0x3f574a)[_0x42fb('0x26')](handleEntityNotFound(_0x24632f,null))['then'](respondWithResult(_0x24632f,null))[_0x42fb('0x42')](handleError(_0x24632f,null));};exports[_0x42fb('0x48')]=function(_0x5e49ec,_0x3beb29){return db['SugarcrmField'][_0x42fb('0x48')](_0x5e49ec[_0x42fb('0x49')],{})['then'](respondWithResult(_0x3beb29,0xc9))['catch'](handleError(_0x3beb29,null));};exports[_0x42fb('0x25')]=function(_0xbbd605,_0x367450){if(_0xbbd605[_0x42fb('0x49')]['id']){delete _0xbbd605[_0x42fb('0x49')]['id'];}return db['SugarcrmField'][_0x42fb('0x47')]({'where':{'id':_0xbbd605[_0x42fb('0x44')]['id']}})['then'](handleEntityNotFound(_0x367450,null))[_0x42fb('0x26')](saveUpdates(_0xbbd605[_0x42fb('0x49')],null))[_0x42fb('0x26')](respondWithResult(_0x367450,null))['catch'](handleError(_0x367450,null));};exports[_0x42fb('0x4a')]=function(_0x3709e9,_0x3db726){return db[_0x42fb('0x2a')][_0x42fb('0x47')]({'where':{'id':_0x3709e9[_0x42fb('0x44')]['id']}})[_0x42fb('0x26')](handleEntityNotFound(_0x3db726,null))[_0x42fb('0x26')](removeEntity(_0x3db726,null))[_0x42fb('0x42')](handleError(_0x3db726,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index b5542f7..81e8857 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 _0x57ce=['idField','FieldId','lodash','util','api','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0x57ce,0x70));var _0xe57c=function(_0x162b97,_0x59775e){_0x162b97=_0x162b97-0x0;var _0x430395=_0x57ce[_0x162b97];return _0x430395;};'use strict';var _=require(_0xe57c('0x0'));var util=require(_0xe57c('0x1'));var logger=require('../../config/logger')(_0xe57c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe57c('0x3'));var rimraf=require(_0xe57c('0x4'));var config=require(_0xe57c('0x5'));var attributes=require(_0xe57c('0x6'));module['exports']=function(_0x1bf275,_0x40a7ff){return _0x1bf275[_0xe57c('0x7')](_0xe57c('0x8'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xe57c('0x9'),_0xe57c('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9e64=['exports','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','moment','request-promise','../../config/environment','./intSugarcrmField.attributes'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0x9e64,0x73));var _0x49e6=function(_0x2b4fa4,_0x8d607f){_0x2b4fa4=_0x2b4fa4-0x0;var _0x4d2824=_0x9e64[_0x2b4fa4];return _0x4d2824;};'use strict';var _=require(_0x49e6('0x0'));var util=require(_0x49e6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x49e6('0x2'));var BPromise=require('bluebird');var rp=require(_0x49e6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x49e6('0x4'));var attributes=require(_0x49e6('0x5'));module[_0x49e6('0x6')]=function(_0x53053a,_0x5eecff){return _0x53053a['define'](_0x49e6('0x7'),attributes,{'tableName':_0x49e6('0x8'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x49e6('0x9'),_0x49e6('0xa')],'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 995df53..3af7756 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 _0xe592=['rpc','../../config/environment','jayson/promise','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x23b040,_0x2d0d7a){var _0xcff28d=function(_0x3ba8fd){while(--_0x3ba8fd){_0x23b040['push'](_0x23b040['shift']());}};_0xcff28d(++_0x2d0d7a);}(_0xe592,0x133));var _0x2e59=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xe592[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x2e59('0x0'));var util=require(_0x2e59('0x1'));var moment=require(_0x2e59('0x2'));var BPromise=require(_0x2e59('0x3'));var rs=require(_0x2e59('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e59('0x5'))['db'];var utils=require(_0x2e59('0x6'));var logger=require(_0x2e59('0x7'))(_0x2e59('0x8'));var config=require(_0x2e59('0x9'));var jayson=require(_0x2e59('0xa'));var client=jayson['client'][_0x2e59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ce883,_0x1fadc3,_0x89c330){return new BPromise(function(_0x2ec51d,_0x26061c){return client[_0x2e59('0xc')](_0x4ce883,_0x89c330)[_0x2e59('0xd')](function(_0xf8c2ef){logger['info'](_0x2e59('0xe'),_0x1fadc3,'request\x20sent');logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x1fadc3,_0x2e59('0xf'),JSON[_0x2e59('0x10')](_0xf8c2ef));if(_0xf8c2ef[_0x2e59('0x11')]){if(_0xf8c2ef[_0x2e59('0x11')]['code']===0x1f4){logger[_0x2e59('0x11')](_0x2e59('0xe'),_0x1fadc3,_0xf8c2ef['error'][_0x2e59('0x12')]);return _0x26061c(_0xf8c2ef[_0x2e59('0x11')][_0x2e59('0x12')]);}logger[_0x2e59('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x1fadc3,_0xf8c2ef['error']['message']);return _0x2ec51d(_0xf8c2ef['error'][_0x2e59('0x12')]);}else{logger[_0x2e59('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x1fadc3,'request\x20sent');_0x2ec51d(_0xf8c2ef[_0x2e59('0x14')][_0x2e59('0x12')]);}})['catch'](function(_0xa94cd5){logger[_0x2e59('0x11')](_0x2e59('0xe'),_0x1fadc3,_0xa94cd5);_0x26061c(_0xa94cd5);});});} \ No newline at end of file +var _0x792a=['SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmField,\x20%s,\x20%s','debug'];(function(_0xd8da0d,_0x224c76){var _0x44e178=function(_0x48ef0d){while(--_0x48ef0d){_0xd8da0d['push'](_0xd8da0d['shift']());}};_0x44e178(++_0x224c76);}(_0x792a,0x75));var _0xa792=function(_0x34818b,_0x456a31){_0x34818b=_0x34818b-0x0;var _0x4e857f=_0x792a[_0x34818b];return _0x4e857f;};'use strict';var _=require(_0xa792('0x0'));var util=require('util');var moment=require(_0xa792('0x1'));var BPromise=require(_0xa792('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa792('0x3'));var db=require(_0xa792('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa792('0x5'))(_0xa792('0x6'));var config=require(_0xa792('0x7'));var jayson=require(_0xa792('0x8'));var client=jayson[_0xa792('0x9')][_0xa792('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3695dc,_0x4b30b5,_0x12e889){return new BPromise(function(_0x527a46,_0x3b72cd){return client['request'](_0x3695dc,_0x12e889)[_0xa792('0xb')](function(_0x4977b1){logger[_0xa792('0xc')](_0xa792('0xd'),_0x4b30b5,'request\x20sent');logger[_0xa792('0xe')](_0xa792('0xf'),_0x4b30b5,_0xa792('0x10'),JSON[_0xa792('0x11')](_0x4977b1));if(_0x4977b1[_0xa792('0x12')]){if(_0x4977b1[_0xa792('0x12')]['code']===0x1f4){logger[_0xa792('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x4b30b5,_0x4977b1[_0xa792('0x12')][_0xa792('0x13')]);return _0x3b72cd(_0x4977b1['error'][_0xa792('0x13')]);}logger[_0xa792('0x12')](_0xa792('0xd'),_0x4b30b5,_0x4977b1[_0xa792('0x12')][_0xa792('0x13')]);return _0x527a46(_0x4977b1[_0xa792('0x12')]['message']);}else{logger[_0xa792('0xc')](_0xa792('0xd'),_0x4b30b5,_0xa792('0x10'));_0x527a46(_0x4977b1[_0xa792('0x14')]['message']);}})[_0xa792('0x15')](function(_0x35925e){logger[_0xa792('0x12')](_0xa792('0xd'),_0x4b30b5,_0x35925e);_0x3b72cd(_0x35925e);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 644f200..f8870d4 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 _0x61e6=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util'];(function(_0xafd12,_0x36979c){var _0x46f8d2=function(_0x33026f){while(--_0x33026f){_0xafd12['push'](_0xafd12['shift']());}};_0x46f8d2(++_0x36979c);}(_0x61e6,0x9a));var _0x661e=function(_0x4cef80,_0x1fa2f3){_0x4cef80=_0x4cef80-0x0;var _0x5f5ede=_0x61e6[_0x4cef80];return _0x5f5ede;};'use strict';var multer=require(_0x661e('0x0'));var util=require(_0x661e('0x1'));var path=require(_0x661e('0x2'));var timeout=require('connect-timeout');var express=require(_0x661e('0x3'));var router=express[_0x661e('0x4')]();var fs_extra=require(_0x661e('0x5'));var auth=require(_0x661e('0x6'));var interaction=require(_0x661e('0x7'));var config=require(_0x661e('0x8'));var controller=require(_0x661e('0x9'));router[_0x661e('0xa')]('/',auth[_0x661e('0xb')](),controller[_0x661e('0xc')]);router[_0x661e('0xa')](_0x661e('0xd'),auth[_0x661e('0xb')](),controller[_0x661e('0xe')]);router[_0x661e('0xa')](_0x661e('0xf'),auth[_0x661e('0xb')](),controller[_0x661e('0x10')]);router[_0x661e('0xa')](_0x661e('0x11'),auth[_0x661e('0xb')](),controller[_0x661e('0x12')]);router['post']('/',auth[_0x661e('0xb')](),controller['create']);router[_0x661e('0x13')](_0x661e('0xf'),auth[_0x661e('0xb')](),controller[_0x661e('0x14')]);router[_0x661e('0x15')](_0x661e('0xd'),auth[_0x661e('0xb')](),controller[_0x661e('0x16')]);router[_0x661e('0x17')](_0x661e('0xd'),auth[_0x661e('0xb')](),controller[_0x661e('0x18')]);module[_0x661e('0x19')]=router; \ No newline at end of file +var _0x6a17=['/:id','/:id/configurations','getConfigurations','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x41681b,_0x177d2a){var _0x2d0840=function(_0x56182f){while(--_0x56182f){_0x41681b['push'](_0x41681b['shift']());}};_0x2d0840(++_0x177d2a);}(_0x6a17,0x1e8));var _0x76a1=function(_0x493009,_0x4aaec9){_0x493009=_0x493009-0x0;var _0x1c1b4d=_0x6a17[_0x493009];return _0x1c1b4d;};'use strict';var multer=require(_0x76a1('0x0'));var util=require(_0x76a1('0x1'));var path=require(_0x76a1('0x2'));var timeout=require(_0x76a1('0x3'));var express=require(_0x76a1('0x4'));var router=express[_0x76a1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x76a1('0x6'));var interaction=require(_0x76a1('0x7'));var config=require(_0x76a1('0x8'));var controller=require(_0x76a1('0x9'));router[_0x76a1('0xa')]('/',auth[_0x76a1('0xb')](),controller['index']);router[_0x76a1('0xa')](_0x76a1('0xc'),auth[_0x76a1('0xb')](),controller['show']);router['get'](_0x76a1('0xd'),auth[_0x76a1('0xb')](),controller[_0x76a1('0xe')]);router[_0x76a1('0xa')]('/:id/fields',auth[_0x76a1('0xb')](),controller['getFields']);router[_0x76a1('0xf')]('/',auth[_0x76a1('0xb')](),controller[_0x76a1('0x10')]);router[_0x76a1('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0x76a1('0xb')](),controller[_0x76a1('0x11')]);router[_0x76a1('0x12')](_0x76a1('0xc'),auth[_0x76a1('0xb')](),controller[_0x76a1('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 5d2842f..5832e81 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 _0x3c4a=['sequelize','exports','STRING','HelpDesk'];(function(_0x21ecd6,_0x53e0a6){var _0x5b2b5a=function(_0x13e95b){while(--_0x13e95b){_0x21ecd6['push'](_0x21ecd6['shift']());}};_0x5b2b5a(++_0x53e0a6);}(_0x3c4a,0xac));var _0xa3c4=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0x3c4a[_0x3e8270];return _0x1ccde9;};'use strict';var Sequelize=require(_0xa3c4('0x0'));module[_0xa3c4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa3c4('0x2')]},'username':{'type':Sequelize[_0xa3c4('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xa3c4('0x2')],'allowNull':![],'defaultValue':_0xa3c4('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa3c4('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xa3c4('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0d9d=['HelpDesk','sequelize','exports','STRING'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x0d9d,0x1a1));var _0xd0d9=function(_0x31b11d,_0x5d7fa9){_0x31b11d=_0x31b11d-0x0;var _0x1c1668=_0x0d9d[_0x31b11d];return _0x1c1668;};'use strict';var Sequelize=require(_0xd0d9('0x0'));module[_0xd0d9('0x1')]={'name':{'type':Sequelize[_0xd0d9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd0d9('0x2')]},'username':{'type':Sequelize[_0xd0d9('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd0d9('0x3')},'remoteUri':{'type':Sequelize[_0xd0d9('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xd0d9('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xd0d9('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 6d820f6..72d91f1 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 _0x17ce=['picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','end','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','catch','params','keys','include','find','create','update','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','format','%s/webservice.php','GET','getchallenge','success','login','result','token','describe','autogenerated','remove','includes','editable'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0x17ce,0x1d3));var _0xe17c=function(_0x2976d6,_0x256f01){_0x2976d6=_0x2976d6-0x0;var _0x26f92e=_0x17ce[_0x2976d6];return _0x26f92e;};'use strict';var emlformat=require(_0xe17c('0x0'));var rimraf=require(_0xe17c('0x1'));var zipdir=require(_0xe17c('0x2'));var jsonpatch=require(_0xe17c('0x3'));var rp=require(_0xe17c('0x4'));var moment=require(_0xe17c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe17c('0x6'));var util=require(_0xe17c('0x7'));var path=require(_0xe17c('0x8'));var sox=require('sox');var csv=require(_0xe17c('0x9'));var ejs=require(_0xe17c('0xa'));var fs=require('fs');var fs_extra=require(_0xe17c('0xb'));var _=require(_0xe17c('0xc'));var squel=require(_0xe17c('0xd'));var crypto=require(_0xe17c('0xe'));var jsforce=require(_0xe17c('0xf'));var deskjs=require(_0xe17c('0x10'));var toCsv=require(_0xe17c('0x9'));var querystring=require('querystring');var Papa=require(_0xe17c('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe17c('0x12'));var as=require(_0xe17c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe17c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe17c('0x15'));var db=require(_0xe17c('0x16'))['db'];var integrations=require(_0xe17c('0x17'));function respondWithStatusCode(_0x7599b1,_0x4527b9){_0x4527b9=_0x4527b9||0xcc;return function(_0x19f4b5){if(_0x19f4b5){return _0x7599b1[_0xe17c('0x18')](_0x4527b9);}return _0x7599b1['status'](_0x4527b9)['end']();};}function respondWithResult(_0x1efadc,_0x470856){_0x470856=_0x470856||0xc8;return function(_0x32bfc4){if(_0x32bfc4){return _0x1efadc[_0xe17c('0x19')](_0x470856)[_0xe17c('0x1a')](_0x32bfc4);}};}function respondWithFilteredResult(_0x2602c3,_0x4c5290){return function(_0x162eef){if(_0x162eef){var _0x39656e=typeof _0x4c5290[_0xe17c('0x1b')]===_0xe17c('0x1c')&&typeof _0x4c5290['limit']===_0xe17c('0x1c');var _0x3d1236=_0x162eef[_0xe17c('0x1d')];var _0x131e88=_0x39656e?0x0:_0x4c5290['offset'];var _0x37af79=_0x39656e?_0x162eef[_0xe17c('0x1d')]:_0x4c5290[_0xe17c('0x1b')]+_0x4c5290[_0xe17c('0x1e')];var _0x5da7f7;if(_0x37af79>=_0x3d1236){_0x37af79=_0x3d1236;_0x5da7f7=0xc8;}else{_0x5da7f7=0xce;}_0x2602c3[_0xe17c('0x19')](_0x5da7f7);return _0x2602c3[_0xe17c('0x1f')](_0xe17c('0x20'),_0x131e88+'-'+_0x37af79+'/'+_0x3d1236)['json'](_0x162eef);}return null;};}function patchUpdates(_0xde9e2c){return function(_0x5c397e){try{jsonpatch['apply'](_0x5c397e,_0xde9e2c,!![]);}catch(_0x396f9a){return BPromise[_0xe17c('0x21')](_0x396f9a);}return _0x5c397e[_0xe17c('0x22')]();};}function saveUpdates(_0x377f04,_0x541573){return function(_0x4d24ed){if(_0x4d24ed){return _0x4d24ed['update'](_0x377f04)[_0xe17c('0x23')](function(_0x5753ab){return _0x5753ab;});}return null;};}function removeEntity(_0x5a4075,_0x1bb66c){return function(_0x1dde7a){if(_0x1dde7a){return _0x1dde7a[_0xe17c('0x24')]()[_0xe17c('0x23')](function(){_0x5a4075['status'](0xcc)[_0xe17c('0x25')]();});}};}function handleEntityNotFound(_0x32b4cb,_0x2342ad){return function(_0x1044d5){if(!_0x1044d5){_0x32b4cb[_0xe17c('0x18')](0x194);}return _0x1044d5;};}function handleError(_0x22e347,_0x366862){_0x366862=_0x366862||0x1f4;return function(_0x3dc876){logger['error'](_0x3dc876[_0xe17c('0x26')]);if(_0x3dc876['name']){delete _0x3dc876[_0xe17c('0x27')];}_0x22e347[_0xe17c('0x19')](_0x366862)[_0xe17c('0x28')](_0x3dc876);};}exports['index']=function(_0x213ddd,_0x52112f){var _0x168b0c={},_0x25d9ce={},_0x4e0db5={'count':0x0,'rows':[]};var _0x372466=_[_0xe17c('0x29')](db[_0xe17c('0x2a')][_0xe17c('0x2b')],function(_0x1abf6e){return{'name':_0x1abf6e[_0xe17c('0x2c')],'type':_0x1abf6e[_0xe17c('0x2d')][_0xe17c('0x2e')]};});_0x25d9ce['model']=_[_0xe17c('0x29')](_0x372466,_0xe17c('0x27'));_0x25d9ce[_0xe17c('0x2f')]=_['keys'](_0x213ddd[_0xe17c('0x2f')]);_0x25d9ce[_0xe17c('0x30')]=_[_0xe17c('0x31')](_0x25d9ce['model'],_0x25d9ce[_0xe17c('0x2f')]);_0x168b0c[_0xe17c('0x32')]=_[_0xe17c('0x31')](_0x25d9ce[_0xe17c('0x33')],qs[_0xe17c('0x34')](_0x213ddd[_0xe17c('0x2f')][_0xe17c('0x34')]));_0x168b0c['attributes']=_0x168b0c[_0xe17c('0x32')][_0xe17c('0x35')]?_0x168b0c[_0xe17c('0x32')]:_0x25d9ce[_0xe17c('0x33')];if(!_0x213ddd[_0xe17c('0x2f')][_0xe17c('0x36')](_0xe17c('0x37'))){_0x168b0c[_0xe17c('0x1e')]=qs[_0xe17c('0x1e')](_0x213ddd[_0xe17c('0x2f')]['limit']);_0x168b0c[_0xe17c('0x1b')]=qs['offset'](_0x213ddd[_0xe17c('0x2f')]['offset']);}_0x168b0c[_0xe17c('0x38')]=qs[_0xe17c('0x39')](_0x213ddd[_0xe17c('0x2f')][_0xe17c('0x39')]);_0x168b0c[_0xe17c('0x3a')]=qs[_0xe17c('0x30')](_['pick'](_0x213ddd[_0xe17c('0x2f')],_0x25d9ce['filters']),_0x372466);if(_0x213ddd[_0xe17c('0x2f')][_0xe17c('0x3b')]){_0x168b0c[_0xe17c('0x3a')]=_['merge'](_0x168b0c[_0xe17c('0x3a')],{'$or':_['map'](_0x372466,function(_0x1a84c6){if(_0x1a84c6[_0xe17c('0x2d')]!==_0xe17c('0x3c')){var _0x39b4d7={};_0x39b4d7[_0x1a84c6[_0xe17c('0x27')]]={'$like':'%'+_0x213ddd[_0xe17c('0x2f')]['filter']+'%'};return _0x39b4d7;}})});}_0x168b0c=_[_0xe17c('0x3d')]({},_0x168b0c,_0x213ddd[_0xe17c('0x3e')]);var _0x559d0b={'where':_0x168b0c['where']};return db[_0xe17c('0x2a')][_0xe17c('0x1d')](_0x559d0b)[_0xe17c('0x23')](function(_0x39d34c){_0x4e0db5[_0xe17c('0x1d')]=_0x39d34c;if(_0x213ddd['query'][_0xe17c('0x3f')]){_0x168b0c['include']=[{'all':!![]}];}return db[_0xe17c('0x2a')][_0xe17c('0x40')](_0x168b0c);})[_0xe17c('0x23')](function(_0x2e509f){_0x4e0db5['rows']=_0x2e509f;return _0x4e0db5;})[_0xe17c('0x23')](respondWithFilteredResult(_0x52112f,_0x168b0c))[_0xe17c('0x41')](handleError(_0x52112f,null));};exports['show']=function(_0x7fcc8a,_0x4c128c){var _0xdc47b={'raw':![],'where':{'id':_0x7fcc8a[_0xe17c('0x42')]['id']}},_0x351cc9={};_0x351cc9[_0xe17c('0x33')]=_[_0xe17c('0x43')](db[_0xe17c('0x2a')][_0xe17c('0x2b')]);_0x351cc9['query']=_['keys'](_0x7fcc8a['query']);_0x351cc9['filters']=_['intersection'](_0x351cc9[_0xe17c('0x33')],_0x351cc9[_0xe17c('0x2f')]);_0xdc47b[_0xe17c('0x32')]=_['intersection'](_0x351cc9['model'],qs[_0xe17c('0x34')](_0x7fcc8a['query'][_0xe17c('0x34')]));_0xdc47b[_0xe17c('0x32')]=_0xdc47b[_0xe17c('0x32')]['length']?_0xdc47b[_0xe17c('0x32')]:_0x351cc9[_0xe17c('0x33')];if(_0x7fcc8a['query'][_0xe17c('0x3f')]){_0xdc47b[_0xe17c('0x44')]=[{'all':!![]}];}_0xdc47b=_[_0xe17c('0x3d')]({},_0xdc47b,_0x7fcc8a['options']);return db[_0xe17c('0x2a')][_0xe17c('0x45')](_0xdc47b)[_0xe17c('0x23')](handleEntityNotFound(_0x4c128c,null))[_0xe17c('0x23')](respondWithResult(_0x4c128c,null))[_0xe17c('0x41')](handleError(_0x4c128c,null));};exports[_0xe17c('0x46')]=function(_0x3d3090,_0xc99f7d){return db['VtigerAccount']['create'](_0x3d3090['body'],{})[_0xe17c('0x23')](respondWithResult(_0xc99f7d,0xc9))[_0xe17c('0x41')](handleError(_0xc99f7d,null));};exports[_0xe17c('0x47')]=function(_0xe3c81b,_0x44a3d8){if(_0xe3c81b[_0xe17c('0x48')]['id']){delete _0xe3c81b[_0xe17c('0x48')]['id'];}return db[_0xe17c('0x2a')]['find']({'where':{'id':_0xe3c81b['params']['id']}})[_0xe17c('0x23')](handleEntityNotFound(_0x44a3d8,null))[_0xe17c('0x23')](saveUpdates(_0xe3c81b[_0xe17c('0x48')],null))[_0xe17c('0x23')](respondWithResult(_0x44a3d8,null))['catch'](handleError(_0x44a3d8,null));};exports[_0xe17c('0x24')]=function(_0x1292ce,_0x201c27){return db[_0xe17c('0x2a')][_0xe17c('0x45')]({'where':{'id':_0x1292ce[_0xe17c('0x42')]['id']}})['then'](handleEntityNotFound(_0x201c27,null))['then'](removeEntity(_0x201c27,null))[_0xe17c('0x41')](handleError(_0x201c27,null));};exports[_0xe17c('0x49')]=function(_0x314a15,_0x1f8e53,_0x1de1c9){var _0x3344d1={};var _0x282d87={};var _0x363e3a;var _0x3af407;return db[_0xe17c('0x2a')][_0xe17c('0x4a')]({'where':{'id':_0x314a15[_0xe17c('0x42')]['id']}})[_0xe17c('0x23')](handleEntityNotFound(_0x1f8e53,null))[_0xe17c('0x23')](function(_0x1a0cc7){if(_0x1a0cc7){_0x363e3a=_0x1a0cc7;_0x282d87['model']=_[_0xe17c('0x43')](db[_0xe17c('0x4b')][_0xe17c('0x2b')]);_0x282d87[_0xe17c('0x2f')]=_[_0xe17c('0x43')](_0x314a15[_0xe17c('0x2f')]);_0x282d87[_0xe17c('0x30')]=_[_0xe17c('0x31')](_0x282d87[_0xe17c('0x33')],_0x282d87[_0xe17c('0x2f')]);_0x3344d1['attributes']=_['intersection'](_0x282d87[_0xe17c('0x33')],qs[_0xe17c('0x34')](_0x314a15[_0xe17c('0x2f')][_0xe17c('0x34')]));_0x3344d1[_0xe17c('0x32')]=_0x3344d1[_0xe17c('0x32')][_0xe17c('0x35')]?_0x3344d1['attributes']:_0x282d87['model'];_0x3344d1[_0xe17c('0x38')]=qs[_0xe17c('0x39')](_0x314a15[_0xe17c('0x2f')][_0xe17c('0x39')]);_0x3344d1[_0xe17c('0x3a')]=qs[_0xe17c('0x30')](_['pick'](_0x314a15[_0xe17c('0x2f')],_0x282d87[_0xe17c('0x30')]));if(_0x314a15[_0xe17c('0x2f')][_0xe17c('0x3b')]){_0x3344d1[_0xe17c('0x3a')]=_['merge'](_0x3344d1[_0xe17c('0x3a')],{'$or':_['map'](_0x3344d1[_0xe17c('0x32')],function(_0xbf049e){var _0x45462d={};_0x45462d[_0xbf049e]={'$like':'%'+_0x314a15[_0xe17c('0x2f')][_0xe17c('0x3b')]+'%'};return _0x45462d;})});}_0x3344d1=_[_0xe17c('0x3d')]({},_0x3344d1,_0x314a15[_0xe17c('0x3e')]);return _0x363e3a[_0xe17c('0x49')](_0x3344d1);}})[_0xe17c('0x23')](function(_0x5d8776){if(_0x5d8776){_0x3af407=_0x5d8776[_0xe17c('0x35')];if(!_0x314a15[_0xe17c('0x2f')][_0xe17c('0x36')]('nolimit')){_0x3344d1[_0xe17c('0x1e')]=qs[_0xe17c('0x1e')](_0x314a15['query'][_0xe17c('0x1e')]);_0x3344d1[_0xe17c('0x1b')]=qs[_0xe17c('0x1b')](_0x314a15[_0xe17c('0x2f')][_0xe17c('0x1b')]);}return _0x363e3a[_0xe17c('0x49')](_0x3344d1);}})[_0xe17c('0x23')](function(_0x2cf08b){if(_0x2cf08b){return _0x2cf08b?{'count':_0x3af407,'rows':_0x2cf08b}:null;}})[_0xe17c('0x23')](respondWithResult(_0x1f8e53,null))[_0xe17c('0x41')](handleError(_0x1f8e53,null));};exports[_0xe17c('0x4c')]=function(_0x1b8926,_0x246332,_0x190525){if(_0x1b8926[_0xe17c('0x48')]['id']){delete _0x1b8926[_0xe17c('0x48')]['id'];}return db[_0xe17c('0x2a')]['findOne']({'where':{'id':_0x1b8926[_0xe17c('0x42')]['id']}})[_0xe17c('0x23')](handleEntityNotFound(_0x246332,null))[_0xe17c('0x23')](function(_0x5e1455){if(_0x5e1455){_0x1b8926['body'][_0xe17c('0x4d')]=_0x5e1455['id'];_0x1b8926[_0xe17c('0x48')][_0xe17c('0x4e')]=integrations['getSubjects'](_0x1b8926['body'][_0xe17c('0x4f')],_0x1b8926[_0xe17c('0x48')][_0xe17c('0x2d')]);_0x1b8926[_0xe17c('0x48')][_0xe17c('0x50')]=integrations[_0xe17c('0x51')](_0x1b8926['body'][_0xe17c('0x4f')],_0x1b8926[_0xe17c('0x48')]['type']);return db[_0xe17c('0x4b')][_0xe17c('0x46')](_0x1b8926[_0xe17c('0x48')],{'include':[{'model':db[_0xe17c('0x52')],'as':_0xe17c('0x4e')},{'model':db[_0xe17c('0x52')],'as':'Descriptions'}]});}return null;})[_0xe17c('0x23')](respondWithResult(_0x246332,null))['catch'](handleError(_0x246332,null));};var md5=require('md5');exports['getFields']=function(_0x48d3cb,_0x49d3cb,_0x281511){var _0x598cfe=null;var _0x3a36c3=null;var _0x17aabe=null;var _0x1c1678=null;var _0x367fe6='';return db[_0xe17c('0x2a')][_0xe17c('0x4a')]({'where':{'id':_0x48d3cb[_0xe17c('0x42')]['id']},'attributes':['id',_0xe17c('0x27'),_0xe17c('0x53'),'description',_0xe17c('0x54'),_0xe17c('0x55'),_0xe17c('0x56'),'accessKey']})[_0xe17c('0x23')](handleEntityNotFound(_0x49d3cb,null))['then'](function(_0x18a2f7){if(_0x18a2f7){_0x598cfe=_0x18a2f7['username'];_0x3a36c3=_0x18a2f7[_0xe17c('0x57')];_0x17aabe=_0x18a2f7[_0xe17c('0x54')];_0x367fe6=_0x18a2f7['remoteUri'];var _0x11faa6=_0x367fe6[_0xe17c('0x58')](-0x1);if(_0x11faa6==='/'){_0x367fe6=_0x367fe6[_0xe17c('0x59')](0x0,_0x367fe6['lastIndexOf'](_0x11faa6));}_0x1c1678=util[_0xe17c('0x5a')](_0xe17c('0x5b'),_0x367fe6);var _0x11b26e={'method':_0xe17c('0x5c'),'uri':_0x1c1678,'qs':{'operation':_0xe17c('0x5d'),'username':_0x18a2f7[_0xe17c('0x53')]},'json':!![]};return rp(_0x11b26e);}})[_0xe17c('0x23')](function(_0x3eded2){if(_0x3eded2[_0xe17c('0x5e')]){var _0x448bfe={'method':'POST','uri':_0x1c1678,'form':{'operation':_0xe17c('0x5f'),'username':_0x598cfe,'accessKey':md5(_0x3eded2[_0xe17c('0x60')][_0xe17c('0x61')]+_0x3a36c3)},'json':!![]};return rp(_0x448bfe);}})[_0xe17c('0x23')](function(_0x46f127){if(_0x46f127[_0xe17c('0x5e')]){var _0x12dd28={'method':_0xe17c('0x5c'),'uri':_0x1c1678,'qs':{'operation':_0xe17c('0x62'),'username':_0x598cfe,'sessionName':_0x46f127['result']['sessionName'],'elementType':_0x17aabe},'json':!![]};return rp(_0x12dd28);}})[_0xe17c('0x23')](function(_0x4493db){if(_0x4493db[_0xe17c('0x5e')]){var _0x181f9d=[_0xe17c('0x63'),'reference','owner'];_[_0xe17c('0x64')](_0x4493db[_0xe17c('0x60')]['fields'],function(_0x361e94){return _0x181f9d[_0xe17c('0x65')](_0x361e94[_0xe17c('0x2d')][_0xe17c('0x27')]);});_[_0xe17c('0x64')](_0x4493db['result'][_0xe17c('0x34')],function(_0x1a1089){return _0x1a1089[_0xe17c('0x66')]==='false';});return{'count':_0x4493db[_0xe17c('0x60')][_0xe17c('0x34')][_0xe17c('0x35')],'rows':_[_0xe17c('0x29')](_0x4493db['result'][_0xe17c('0x34')],function(_0x28569e){return{'id':_0x28569e[_0xe17c('0x27')],'name':_0x28569e['label'],'custom':_['startsWith'](_0x28569e[_0xe17c('0x27')],'cf_')?!![]:![],'options':_0x28569e[_0xe17c('0x2d')][_0xe17c('0x27')]===_0xe17c('0x67')&&_0x28569e[_0xe17c('0x2d')][_0xe17c('0x68')][_0xe17c('0x35')]>0x0?_[_0xe17c('0x29')](_0x28569e['type'][_0xe17c('0x68')],function(_0x1aefef){return{'name':_0x1aefef['label'],'value':_0x1aefef['value']};}):[]};})};}})[_0xe17c('0x23')](respondWithResult(_0x49d3cb,null))[_0xe17c('0x41')](function(_0x349ae6){console[_0xe17c('0x69')](_0xe17c('0x6a')+_0x349ae6);var _0x38a179=_0x48d3cb[_0xe17c('0x2f')][_0xe17c('0x6b')]?0x1f4:_0x349ae6[_0xe17c('0x6c')]||0x1f4;logger[_0xe17c('0x6d')](_0xe17c('0x6e'),_0xe17c('0x6f'),_0x38a179,JSON[_0xe17c('0x70')](_0x349ae6));delete _0x349ae6[_0xe17c('0x27')];if(_0x38a179===0x191){_0x38a179=0x190;}_0x49d3cb[_0xe17c('0x19')](_0x38a179)['send'](_0x48d3cb[_0xe17c('0x2f')][_0xe17c('0x6b')]?{'message':_0xe17c('0x71'),'statusCode':_0x349ae6['statusCode']}:_0x349ae6);});}; \ No newline at end of file +var _0xa882=['filter','merge','options','VtigerAccount','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','nolimit','Subjects','getSubjects','getDescriptions','VtigerField','Descriptions','md5','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','format','%s/webservice.php','GET','getchallenge','login','result','token','success','describe','autogenerated','owner','remove','includes','false','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','type','map','keys','filters','intersection','model','query','fields','attributes','hasOwnProperty','order','sort','pick','where','VIRTUAL'];(function(_0x30e225,_0x249f0f){var _0xb9d531=function(_0x386f33){while(--_0x386f33){_0x30e225['push'](_0x30e225['shift']());}};_0xb9d531(++_0x249f0f);}(_0xa882,0x122));var _0x2a88=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xa882[_0x209941];return _0x1e8729;};'use strict';var emlformat=require(_0x2a88('0x0'));var rimraf=require(_0x2a88('0x1'));var zipdir=require(_0x2a88('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2a88('0x3'));var Mustache=require('mustache');var util=require(_0x2a88('0x4'));var path=require('path');var sox=require(_0x2a88('0x5'));var csv=require(_0x2a88('0x6'));var ejs=require(_0x2a88('0x7'));var fs=require('fs');var fs_extra=require(_0x2a88('0x8'));var _=require(_0x2a88('0x9'));var squel=require(_0x2a88('0xa'));var crypto=require(_0x2a88('0xb'));var jsforce=require(_0x2a88('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2a88('0xd'));var authService=require(_0x2a88('0xe'));var qs=require(_0x2a88('0xf'));var as=require(_0x2a88('0x10'));var hardwareService=require(_0x2a88('0x11'));var logger=require(_0x2a88('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x2a88('0x13'));var licenseUtil=require(_0x2a88('0x14'));var db=require(_0x2a88('0x15'))['db'];var integrations=require(_0x2a88('0x16'));function respondWithStatusCode(_0x3aac1e,_0x5e2988){_0x5e2988=_0x5e2988||0xcc;return function(_0x324245){if(_0x324245){return _0x3aac1e[_0x2a88('0x17')](_0x5e2988);}return _0x3aac1e[_0x2a88('0x18')](_0x5e2988)[_0x2a88('0x19')]();};}function respondWithResult(_0x5e933f,_0x4ce0f1){_0x4ce0f1=_0x4ce0f1||0xc8;return function(_0x16001e){if(_0x16001e){return _0x5e933f[_0x2a88('0x18')](_0x4ce0f1)[_0x2a88('0x1a')](_0x16001e);}};}function respondWithFilteredResult(_0x50c488,_0x2a5213){return function(_0x315c2e){if(_0x315c2e){var _0x4dedc3=typeof _0x2a5213[_0x2a88('0x1b')]==='undefined'&&typeof _0x2a5213['limit']===_0x2a88('0x1c');var _0x143865=_0x315c2e[_0x2a88('0x1d')];var _0x5158a8=_0x4dedc3?0x0:_0x2a5213[_0x2a88('0x1b')];var _0x1ca9be=_0x4dedc3?_0x315c2e['count']:_0x2a5213[_0x2a88('0x1b')]+_0x2a5213[_0x2a88('0x1e')];var _0x44df3c;if(_0x1ca9be>=_0x143865){_0x1ca9be=_0x143865;_0x44df3c=0xc8;}else{_0x44df3c=0xce;}_0x50c488[_0x2a88('0x18')](_0x44df3c);return _0x50c488[_0x2a88('0x1f')](_0x2a88('0x20'),_0x5158a8+'-'+_0x1ca9be+'/'+_0x143865)['json'](_0x315c2e);}return null;};}function patchUpdates(_0x248709){return function(_0x3b9e43){try{jsonpatch['apply'](_0x3b9e43,_0x248709,!![]);}catch(_0x5f54d7){return BPromise[_0x2a88('0x21')](_0x5f54d7);}return _0x3b9e43[_0x2a88('0x22')]();};}function saveUpdates(_0x4e89ce,_0x2ebec0){return function(_0x2cd5fd){if(_0x2cd5fd){return _0x2cd5fd[_0x2a88('0x23')](_0x4e89ce)[_0x2a88('0x24')](function(_0x2d9f94){return _0x2d9f94;});}return null;};}function removeEntity(_0x542184,_0x229d7d){return function(_0x3d1022){if(_0x3d1022){return _0x3d1022[_0x2a88('0x25')]()['then'](function(){_0x542184[_0x2a88('0x18')](0xcc)[_0x2a88('0x19')]();});}};}function handleEntityNotFound(_0x9c1f65,_0x10aa82){return function(_0xda0f48){if(!_0xda0f48){_0x9c1f65['sendStatus'](0x194);}return _0xda0f48;};}function handleError(_0x1b4214,_0x533924){_0x533924=_0x533924||0x1f4;return function(_0x1cfbc8){logger[_0x2a88('0x26')](_0x1cfbc8[_0x2a88('0x27')]);if(_0x1cfbc8[_0x2a88('0x28')]){delete _0x1cfbc8[_0x2a88('0x28')];}_0x1b4214[_0x2a88('0x18')](_0x533924)[_0x2a88('0x29')](_0x1cfbc8);};}exports['index']=function(_0x32f23f,_0x35a7e5){var _0x46c1dc={},_0x48e8b1={},_0x21c7ae={'count':0x0,'rows':[]};var _0x1e35da=_['map'](db['VtigerAccount'][_0x2a88('0x2a')],function(_0x4937fb){return{'name':_0x4937fb['fieldName'],'type':_0x4937fb[_0x2a88('0x2b')]['key']};});_0x48e8b1['model']=_[_0x2a88('0x2c')](_0x1e35da,_0x2a88('0x28'));_0x48e8b1['query']=_[_0x2a88('0x2d')](_0x32f23f['query']);_0x48e8b1[_0x2a88('0x2e')]=_[_0x2a88('0x2f')](_0x48e8b1[_0x2a88('0x30')],_0x48e8b1[_0x2a88('0x31')]);_0x46c1dc['attributes']=_[_0x2a88('0x2f')](_0x48e8b1['model'],qs[_0x2a88('0x32')](_0x32f23f[_0x2a88('0x31')][_0x2a88('0x32')]));_0x46c1dc[_0x2a88('0x33')]=_0x46c1dc[_0x2a88('0x33')]['length']?_0x46c1dc[_0x2a88('0x33')]:_0x48e8b1[_0x2a88('0x30')];if(!_0x32f23f[_0x2a88('0x31')][_0x2a88('0x34')]('nolimit')){_0x46c1dc[_0x2a88('0x1e')]=qs[_0x2a88('0x1e')](_0x32f23f[_0x2a88('0x31')][_0x2a88('0x1e')]);_0x46c1dc[_0x2a88('0x1b')]=qs['offset'](_0x32f23f[_0x2a88('0x31')][_0x2a88('0x1b')]);}_0x46c1dc[_0x2a88('0x35')]=qs[_0x2a88('0x36')](_0x32f23f[_0x2a88('0x31')][_0x2a88('0x36')]);_0x46c1dc['where']=qs['filters'](_[_0x2a88('0x37')](_0x32f23f['query'],_0x48e8b1['filters']),_0x1e35da);if(_0x32f23f[_0x2a88('0x31')]['filter']){_0x46c1dc[_0x2a88('0x38')]=_['merge'](_0x46c1dc[_0x2a88('0x38')],{'$or':_['map'](_0x1e35da,function(_0x27f0eb){if(_0x27f0eb['type']!==_0x2a88('0x39')){var _0x2c8be1={};_0x2c8be1[_0x27f0eb['name']]={'$like':'%'+_0x32f23f[_0x2a88('0x31')][_0x2a88('0x3a')]+'%'};return _0x2c8be1;}})});}_0x46c1dc=_[_0x2a88('0x3b')]({},_0x46c1dc,_0x32f23f[_0x2a88('0x3c')]);var _0x9cbcab={'where':_0x46c1dc[_0x2a88('0x38')]};return db[_0x2a88('0x3d')][_0x2a88('0x1d')](_0x9cbcab)[_0x2a88('0x24')](function(_0x2e82ef){_0x21c7ae[_0x2a88('0x1d')]=_0x2e82ef;if(_0x32f23f[_0x2a88('0x31')][_0x2a88('0x3e')]){_0x46c1dc[_0x2a88('0x3f')]=[{'all':!![]}];}return db['VtigerAccount'][_0x2a88('0x40')](_0x46c1dc);})[_0x2a88('0x24')](function(_0x3e3696){_0x21c7ae[_0x2a88('0x41')]=_0x3e3696;return _0x21c7ae;})[_0x2a88('0x24')](respondWithFilteredResult(_0x35a7e5,_0x46c1dc))[_0x2a88('0x42')](handleError(_0x35a7e5,null));};exports[_0x2a88('0x43')]=function(_0x33ce2d,_0x441dd6){var _0x10a690={'raw':![],'where':{'id':_0x33ce2d[_0x2a88('0x44')]['id']}},_0x5d10f1={};_0x5d10f1[_0x2a88('0x30')]=_[_0x2a88('0x2d')](db[_0x2a88('0x3d')][_0x2a88('0x2a')]);_0x5d10f1[_0x2a88('0x31')]=_[_0x2a88('0x2d')](_0x33ce2d[_0x2a88('0x31')]);_0x5d10f1[_0x2a88('0x2e')]=_[_0x2a88('0x2f')](_0x5d10f1[_0x2a88('0x30')],_0x5d10f1[_0x2a88('0x31')]);_0x10a690['attributes']=_[_0x2a88('0x2f')](_0x5d10f1[_0x2a88('0x30')],qs['fields'](_0x33ce2d[_0x2a88('0x31')][_0x2a88('0x32')]));_0x10a690['attributes']=_0x10a690['attributes'][_0x2a88('0x45')]?_0x10a690[_0x2a88('0x33')]:_0x5d10f1[_0x2a88('0x30')];if(_0x33ce2d[_0x2a88('0x31')][_0x2a88('0x3e')]){_0x10a690[_0x2a88('0x3f')]=[{'all':!![]}];}_0x10a690=_[_0x2a88('0x3b')]({},_0x10a690,_0x33ce2d['options']);return db[_0x2a88('0x3d')][_0x2a88('0x46')](_0x10a690)[_0x2a88('0x24')](handleEntityNotFound(_0x441dd6,null))[_0x2a88('0x24')](respondWithResult(_0x441dd6,null))['catch'](handleError(_0x441dd6,null));};exports[_0x2a88('0x47')]=function(_0x273d73,_0xc5327f){return db[_0x2a88('0x3d')]['create'](_0x273d73['body'],{})[_0x2a88('0x24')](respondWithResult(_0xc5327f,0xc9))[_0x2a88('0x42')](handleError(_0xc5327f,null));};exports[_0x2a88('0x23')]=function(_0x355cf1,_0x183715){if(_0x355cf1[_0x2a88('0x48')]['id']){delete _0x355cf1[_0x2a88('0x48')]['id'];}return db[_0x2a88('0x3d')][_0x2a88('0x46')]({'where':{'id':_0x355cf1[_0x2a88('0x44')]['id']}})[_0x2a88('0x24')](handleEntityNotFound(_0x183715,null))[_0x2a88('0x24')](saveUpdates(_0x355cf1['body'],null))['then'](respondWithResult(_0x183715,null))['catch'](handleError(_0x183715,null));};exports[_0x2a88('0x25')]=function(_0x5dc005,_0x45bdcc){return db[_0x2a88('0x3d')][_0x2a88('0x46')]({'where':{'id':_0x5dc005['params']['id']}})['then'](handleEntityNotFound(_0x45bdcc,null))['then'](removeEntity(_0x45bdcc,null))[_0x2a88('0x42')](handleError(_0x45bdcc,null));};exports[_0x2a88('0x49')]=function(_0x5a4191,_0x4e1aba,_0x481439){var _0x18bd53={};var _0x5ba2c9={};var _0x3e79b8;var _0x1c38fd;return db[_0x2a88('0x3d')][_0x2a88('0x4a')]({'where':{'id':_0x5a4191[_0x2a88('0x44')]['id']}})[_0x2a88('0x24')](handleEntityNotFound(_0x4e1aba,null))['then'](function(_0xa469f9){if(_0xa469f9){_0x3e79b8=_0xa469f9;_0x5ba2c9[_0x2a88('0x30')]=_[_0x2a88('0x2d')](db['VtigerConfiguration'][_0x2a88('0x2a')]);_0x5ba2c9[_0x2a88('0x31')]=_[_0x2a88('0x2d')](_0x5a4191['query']);_0x5ba2c9['filters']=_[_0x2a88('0x2f')](_0x5ba2c9[_0x2a88('0x30')],_0x5ba2c9['query']);_0x18bd53[_0x2a88('0x33')]=_['intersection'](_0x5ba2c9[_0x2a88('0x30')],qs[_0x2a88('0x32')](_0x5a4191[_0x2a88('0x31')][_0x2a88('0x32')]));_0x18bd53[_0x2a88('0x33')]=_0x18bd53[_0x2a88('0x33')]['length']?_0x18bd53[_0x2a88('0x33')]:_0x5ba2c9['model'];_0x18bd53['order']=qs[_0x2a88('0x36')](_0x5a4191['query'][_0x2a88('0x36')]);_0x18bd53[_0x2a88('0x38')]=qs[_0x2a88('0x2e')](_['pick'](_0x5a4191[_0x2a88('0x31')],_0x5ba2c9['filters']));if(_0x5a4191['query'][_0x2a88('0x3a')]){_0x18bd53[_0x2a88('0x38')]=_[_0x2a88('0x3b')](_0x18bd53[_0x2a88('0x38')],{'$or':_['map'](_0x18bd53['attributes'],function(_0x56a159){var _0x2453f7={};_0x2453f7[_0x56a159]={'$like':'%'+_0x5a4191['query']['filter']+'%'};return _0x2453f7;})});}_0x18bd53=_[_0x2a88('0x3b')]({},_0x18bd53,_0x5a4191[_0x2a88('0x3c')]);return _0x3e79b8[_0x2a88('0x49')](_0x18bd53);}})[_0x2a88('0x24')](function(_0x461cac){if(_0x461cac){_0x1c38fd=_0x461cac[_0x2a88('0x45')];if(!_0x5a4191[_0x2a88('0x31')][_0x2a88('0x34')](_0x2a88('0x4b'))){_0x18bd53[_0x2a88('0x1e')]=qs[_0x2a88('0x1e')](_0x5a4191['query']['limit']);_0x18bd53[_0x2a88('0x1b')]=qs['offset'](_0x5a4191[_0x2a88('0x31')][_0x2a88('0x1b')]);}return _0x3e79b8[_0x2a88('0x49')](_0x18bd53);}})['then'](function(_0x5eda72){if(_0x5eda72){return _0x5eda72?{'count':_0x1c38fd,'rows':_0x5eda72}:null;}})[_0x2a88('0x24')](respondWithResult(_0x4e1aba,null))[_0x2a88('0x42')](handleError(_0x4e1aba,null));};exports['addConfiguration']=function(_0x3dd29f,_0x356fb6,_0x52a3a7){if(_0x3dd29f[_0x2a88('0x48')]['id']){delete _0x3dd29f[_0x2a88('0x48')]['id'];}return db[_0x2a88('0x3d')][_0x2a88('0x4a')]({'where':{'id':_0x3dd29f[_0x2a88('0x44')]['id']}})[_0x2a88('0x24')](handleEntityNotFound(_0x356fb6,null))[_0x2a88('0x24')](function(_0x431278){if(_0x431278){_0x3dd29f['body']['AccountId']=_0x431278['id'];_0x3dd29f['body'][_0x2a88('0x4c')]=integrations[_0x2a88('0x4d')](_0x3dd29f[_0x2a88('0x48')]['channel'],_0x3dd29f[_0x2a88('0x48')]['type']);_0x3dd29f[_0x2a88('0x48')]['Descriptions']=integrations[_0x2a88('0x4e')](_0x3dd29f['body']['channel'],_0x3dd29f[_0x2a88('0x48')]['type']);return db['VtigerConfiguration'][_0x2a88('0x47')](_0x3dd29f[_0x2a88('0x48')],{'include':[{'model':db[_0x2a88('0x4f')],'as':'Subjects'},{'model':db[_0x2a88('0x4f')],'as':_0x2a88('0x50')}]});}return null;})[_0x2a88('0x24')](respondWithResult(_0x356fb6,null))['catch'](handleError(_0x356fb6,null));};var md5=require(_0x2a88('0x51'));exports['getFields']=function(_0x1cd7bf,_0x5f4076,_0x42f291){var _0x349ced=null;var _0x5b93ef=null;var _0x376ad5=null;var _0x5dc95c=null;var _0x14e5a6='';return db[_0x2a88('0x3d')][_0x2a88('0x4a')]({'where':{'id':_0x1cd7bf['params']['id']},'attributes':['id',_0x2a88('0x28'),_0x2a88('0x52'),_0x2a88('0x53'),'moduleName',_0x2a88('0x54'),_0x2a88('0x55'),_0x2a88('0x56')]})['then'](handleEntityNotFound(_0x5f4076,null))[_0x2a88('0x24')](function(_0x36967d){if(_0x36967d){_0x349ced=_0x36967d['username'];_0x5b93ef=_0x36967d['accessKey'];_0x376ad5=_0x36967d[_0x2a88('0x57')];_0x14e5a6=_0x36967d[_0x2a88('0x54')];var _0x9e8477=_0x14e5a6[_0x2a88('0x58')](-0x1);if(_0x9e8477==='/'){_0x14e5a6=_0x14e5a6[_0x2a88('0x59')](0x0,_0x14e5a6['lastIndexOf'](_0x9e8477));}_0x5dc95c=util[_0x2a88('0x5a')](_0x2a88('0x5b'),_0x14e5a6);var _0x25ccbd={'method':_0x2a88('0x5c'),'uri':_0x5dc95c,'qs':{'operation':_0x2a88('0x5d'),'username':_0x36967d[_0x2a88('0x52')]},'json':!![]};return rp(_0x25ccbd);}})['then'](function(_0xe7104a){if(_0xe7104a['success']){var _0x2f54d0={'method':'POST','uri':_0x5dc95c,'form':{'operation':_0x2a88('0x5e'),'username':_0x349ced,'accessKey':md5(_0xe7104a[_0x2a88('0x5f')][_0x2a88('0x60')]+_0x5b93ef)},'json':!![]};return rp(_0x2f54d0);}})[_0x2a88('0x24')](function(_0x14c71b){if(_0x14c71b[_0x2a88('0x61')]){var _0x24bba1={'method':_0x2a88('0x5c'),'uri':_0x5dc95c,'qs':{'operation':_0x2a88('0x62'),'username':_0x349ced,'sessionName':_0x14c71b['result']['sessionName'],'elementType':_0x376ad5},'json':!![]};return rp(_0x24bba1);}})['then'](function(_0x166358){if(_0x166358[_0x2a88('0x61')]){var _0x47caf3=[_0x2a88('0x63'),'reference',_0x2a88('0x64')];_[_0x2a88('0x65')](_0x166358[_0x2a88('0x5f')][_0x2a88('0x32')],function(_0x419ca1){return _0x47caf3[_0x2a88('0x66')](_0x419ca1[_0x2a88('0x2b')][_0x2a88('0x28')]);});_[_0x2a88('0x65')](_0x166358[_0x2a88('0x5f')][_0x2a88('0x32')],function(_0x56b71f){return _0x56b71f['editable']===_0x2a88('0x67');});return{'count':_0x166358[_0x2a88('0x5f')][_0x2a88('0x32')][_0x2a88('0x45')],'rows':_['map'](_0x166358['result'][_0x2a88('0x32')],function(_0x246bd1){return{'id':_0x246bd1[_0x2a88('0x28')],'name':_0x246bd1[_0x2a88('0x68')],'custom':_[_0x2a88('0x69')](_0x246bd1[_0x2a88('0x28')],_0x2a88('0x6a'))?!![]:![],'options':_0x246bd1['type'][_0x2a88('0x28')]===_0x2a88('0x6b')&&_0x246bd1[_0x2a88('0x2b')][_0x2a88('0x6c')][_0x2a88('0x45')]>0x0?_[_0x2a88('0x2c')](_0x246bd1['type'][_0x2a88('0x6c')],function(_0x208e36){return{'name':_0x208e36[_0x2a88('0x68')],'value':_0x208e36[_0x2a88('0x6d')]};}):[]};})};}})[_0x2a88('0x24')](respondWithResult(_0x5f4076,null))[_0x2a88('0x42')](function(_0x14fe84){console['log'](_0x2a88('0x6e')+_0x14fe84);var _0x1cacce=_0x1cd7bf[_0x2a88('0x31')][_0x2a88('0x6f')]?0x1f4:_0x14fe84['statusCode']||0x1f4;logger['error'](_0x2a88('0x70'),'getFields',_0x1cacce,JSON[_0x2a88('0x71')](_0x14fe84));delete _0x14fe84[_0x2a88('0x28')];if(_0x1cacce===0x191){_0x1cacce=0x190;}_0x5f4076['status'](_0x1cacce)[_0x2a88('0x29')](_0x1cd7bf[_0x2a88('0x31')][_0x2a88('0x6f')]?{'message':_0x2a88('0x72'),'statusCode':_0x14fe84[_0x2a88('0x73')]}:_0x14fe84);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index cc94fee..a147d36 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 _0xd4bf=['bluebird','path','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','moment'];(function(_0x52ddb2,_0x532954){var _0x247ba8=function(_0x3c70bc){while(--_0x3c70bc){_0x52ddb2['push'](_0x52ddb2['shift']());}};_0x247ba8(++_0x532954);}(_0xd4bf,0x74));var _0xfd4b=function(_0x1ce89a,_0x43a252){_0x1ce89a=_0x1ce89a-0x0;var _0x3837a3=_0xd4bf[_0x1ce89a];return _0x3837a3;};'use strict';var _=require('lodash');var util=require(_0xfd4b('0x0'));var logger=require(_0xfd4b('0x1'))(_0xfd4b('0x2'));var moment=require(_0xfd4b('0x3'));var BPromise=require(_0xfd4b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd4b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfd4b('0x6'));var integrations=require(_0xfd4b('0x7'));module[_0xfd4b('0x8')]=function(_0x3dac56,_0x117595){return _0x3dac56[_0xfd4b('0x9')](_0xfd4b('0xa'),attributes,{'tableName':_0xfd4b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16ee=['moment','bluebird','request-promise','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','api'];(function(_0x40022c,_0x3df287){var _0x2af2ec=function(_0x32d13d){while(--_0x32d13d){_0x40022c['push'](_0x40022c['shift']());}};_0x2af2ec(++_0x3df287);}(_0x16ee,0x14f));var _0xe16e=function(_0x238830,_0x545f75){_0x238830=_0x238830-0x0;var _0x5917f0=_0x16ee[_0x238830];return _0x5917f0;};'use strict';var _=require(_0xe16e('0x0'));var util=require(_0xe16e('0x1'));var logger=require('../../config/logger')(_0xe16e('0x2'));var moment=require(_0xe16e('0x3'));var BPromise=require(_0xe16e('0x4'));var rp=require(_0xe16e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe16e('0x6'));var config=require('../../config/environment');var attributes=require(_0xe16e('0x7'));var integrations=require(_0xe16e('0x8'));module[_0xe16e('0x9')]=function(_0x5158fc,_0x48d3eb){return _0x5158fc[_0xe16e('0xa')](_0xe16e('0xb'),attributes,{'tableName':_0xe16e('0xc'),'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 aacf74d..e2fa37e 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 _0x1339=['stringify','error','code','message','result','catch','VtigerAccount','findAll','options','attributes','map','include','model','GetVtigerAccount','debug','raw','ShowVtigerAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x382168,_0xe03b6a){var _0x3ecf7e=function(_0x17b089){while(--_0x17b089){_0x382168['push'](_0x382168['shift']());}};_0x3ecf7e(++_0xe03b6a);}(_0x1339,0x1ed));var _0x9133=function(_0x2d9ff5,_0x3f98b0){_0x2d9ff5=_0x2d9ff5-0x0;var _0x56c113=_0x1339[_0x2d9ff5];return _0x56c113;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539af6,_0x2758e2,_0x334dcd){return new BPromise(function(_0x3059c4,_0x431a55){return client[_0x9133('0xb')](_0x539af6,_0x334dcd)[_0x9133('0xc')](function(_0x4294b7){logger[_0x9133('0xd')](_0x9133('0xe'),_0x2758e2,_0x9133('0xf'));logger['debug'](_0x9133('0x10'),_0x2758e2,_0x9133('0xf'),JSON[_0x9133('0x11')](_0x4294b7));if(_0x4294b7[_0x9133('0x12')]){if(_0x4294b7[_0x9133('0x12')][_0x9133('0x13')]===0x1f4){logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')]['message']);return _0x431a55(_0x4294b7['error'][_0x9133('0x14')]);}logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);return _0x3059c4(_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);}else{logger[_0x9133('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x2758e2,_0x9133('0xf'));_0x3059c4(_0x4294b7[_0x9133('0x15')]['message']);}})[_0x9133('0x16')](function(_0xa46eb1){logger[_0x9133('0x12')](_0x9133('0xe'),_0x2758e2,_0xa46eb1);_0x431a55(_0xa46eb1);});});}exports['GetVtigerAccount']=function(_0x1f3484){var _0x573998=this;return new Promise(function(_0x3c48ef,_0x5d4a77){return db[_0x9133('0x17')][_0x9133('0x18')]({'raw':_0x1f3484['options']?_0x1f3484[_0x9133('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1f3484[_0x9133('0x19')]?_0x1f3484['options']['where']||null:null,'attributes':_0x1f3484[_0x9133('0x19')]?_0x1f3484['options'][_0x9133('0x1a')]||null:null,'limit':_0x1f3484['options']?_0x1f3484['options']['limit']||null:null,'include':_0x1f3484[_0x9133('0x19')]?_0x1f3484[_0x9133('0x19')]['include']?_[_0x9133('0x1b')](_0x1f3484[_0x9133('0x19')][_0x9133('0x1c')],function(_0x26190c){return{'model':db[_0x26190c['model']],'as':_0x26190c['as'],'attributes':_0x26190c[_0x9133('0x1a')],'include':_0x26190c['include']?_[_0x9133('0x1b')](_0x26190c[_0x9133('0x1c')],function(_0x3f278d){return{'model':db[_0x3f278d[_0x9133('0x1d')]],'as':_0x3f278d['as'],'attributes':_0x3f278d[_0x9133('0x1a')],'include':_0x3f278d[_0x9133('0x1c')]?_[_0x9133('0x1b')](_0x3f278d[_0x9133('0x1c')],function(_0x1b6b3e){return{'model':db[_0x1b6b3e[_0x9133('0x1d')]],'as':_0x1b6b3e['as'],'attributes':_0x1b6b3e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x477bf1){logger[_0x9133('0xd')](_0x9133('0x1e'),_0x1f3484);logger[_0x9133('0x1f')]('GetVtigerAccount',_0x1f3484,JSON['stringify'](_0x477bf1));_0x3c48ef(_0x477bf1);})[_0x9133('0x16')](function(_0x45966d){logger[_0x9133('0x12')](_0x9133('0x1e'),_0x45966d[_0x9133('0x14')],_0x1f3484);_0x5d4a77(_0x573998[_0x9133('0x12')](0x1f4,_0x45966d['message']));});});};exports['ShowVtigerAccount']=function(_0x5a27c1){var _0x1ad222=this;return new Promise(function(_0x4a4a8e,_0x43b5f3){return db[_0x9133('0x17')]['find']({'raw':_0x5a27c1[_0x9133('0x19')]?_0x5a27c1['options'][_0x9133('0x20')]===undefined?!![]:![]:!![],'where':_0x5a27c1[_0x9133('0x19')]?_0x5a27c1[_0x9133('0x19')]['where']||null:null,'attributes':_0x5a27c1[_0x9133('0x19')]?_0x5a27c1[_0x9133('0x19')][_0x9133('0x1a')]||null:null,'include':_0x5a27c1['options']?_0x5a27c1[_0x9133('0x19')][_0x9133('0x1c')]?_[_0x9133('0x1b')](_0x5a27c1['options'][_0x9133('0x1c')],function(_0x20da68){return{'model':db[_0x20da68[_0x9133('0x1d')]],'as':_0x20da68['as'],'attributes':_0x20da68[_0x9133('0x1a')],'include':_0x20da68['include']?_[_0x9133('0x1b')](_0x20da68[_0x9133('0x1c')],function(_0x56719e){return{'model':db[_0x56719e[_0x9133('0x1d')]],'as':_0x56719e['as'],'attributes':_0x56719e[_0x9133('0x1a')],'include':_0x56719e[_0x9133('0x1c')]?_[_0x9133('0x1b')](_0x56719e[_0x9133('0x1c')],function(_0x2db377){return{'model':db[_0x2db377[_0x9133('0x1d')]],'as':_0x2db377['as'],'attributes':_0x2db377[_0x9133('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9133('0xc')](function(_0x335217){logger[_0x9133('0xd')]('ShowVtigerAccount',_0x5a27c1);logger[_0x9133('0x1f')](_0x9133('0x21'),_0x5a27c1,JSON['stringify'](_0x335217));_0x4a4a8e(_0x335217);})[_0x9133('0x16')](function(_0x3a2d1f){logger[_0x9133('0x12')](_0x9133('0x21'),_0x3a2d1f[_0x9133('0x14')],_0x5a27c1);_0x43b5f3(_0x1ad222[_0x9133('0x12')](0x1f4,_0x3a2d1f['message']));});});}; \ No newline at end of file +var _0x04b8=['jayson/promise','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','map','model','include','debug','catch','ShowVtigerAccount','find','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x1bda09,_0x1d8be5){var _0x17be2d=function(_0x637732){while(--_0x637732){_0x1bda09['push'](_0x1bda09['shift']());}};_0x17be2d(++_0x1d8be5);}(_0x04b8,0x159));var _0x804b=function(_0x533d36,_0x41ba56){_0x533d36=_0x533d36-0x0;var _0x5556e1=_0x04b8[_0x533d36];return _0x5556e1;};'use strict';var _=require('lodash');var util=require(_0x804b('0x0'));var moment=require('moment');var BPromise=require(_0x804b('0x1'));var rs=require(_0x804b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x804b('0x3'))['db'];var utils=require(_0x804b('0x4'));var logger=require('../../config/logger')(_0x804b('0x5'));var config=require(_0x804b('0x6'));var jayson=require(_0x804b('0x7'));var client=jayson['client'][_0x804b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c5404,_0x476262,_0x50826d){return new BPromise(function(_0x27e950,_0x1071b4){return client['request'](_0x3c5404,_0x50826d)[_0x804b('0x9')](function(_0x336325){logger[_0x804b('0xa')](_0x804b('0xb'),_0x476262,_0x804b('0xc'));logger['debug'](_0x804b('0xd'),_0x476262,_0x804b('0xc'),JSON[_0x804b('0xe')](_0x336325));if(_0x336325[_0x804b('0xf')]){if(_0x336325[_0x804b('0xf')][_0x804b('0x10')]===0x1f4){logger['error'](_0x804b('0xb'),_0x476262,_0x336325['error'][_0x804b('0x11')]);return _0x1071b4(_0x336325[_0x804b('0xf')][_0x804b('0x11')]);}logger[_0x804b('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x476262,_0x336325[_0x804b('0xf')][_0x804b('0x11')]);return _0x27e950(_0x336325[_0x804b('0xf')][_0x804b('0x11')]);}else{logger['info'](_0x804b('0xb'),_0x476262,_0x804b('0xc'));_0x27e950(_0x336325['result'][_0x804b('0x11')]);}})['catch'](function(_0x2c90b9){logger[_0x804b('0xf')](_0x804b('0xb'),_0x476262,_0x2c90b9);_0x1071b4(_0x2c90b9);});});}exports[_0x804b('0x12')]=function(_0x3a05c0){var _0x5a0a82=this;return new Promise(function(_0x871d6c,_0x50b4fe){return db[_0x804b('0x13')][_0x804b('0x14')]({'raw':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')][_0x804b('0x16')]||null:null,'attributes':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')][_0x804b('0x17')]||null:null,'limit':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')][_0x804b('0x18')]||null:null,'include':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')]['include']?_[_0x804b('0x19')](_0x3a05c0[_0x804b('0x15')]['include'],function(_0x44a921){return{'model':db[_0x44a921[_0x804b('0x1a')]],'as':_0x44a921['as'],'attributes':_0x44a921[_0x804b('0x17')],'include':_0x44a921[_0x804b('0x1b')]?_[_0x804b('0x19')](_0x44a921['include'],function(_0x2de812){return{'model':db[_0x2de812[_0x804b('0x1a')]],'as':_0x2de812['as'],'attributes':_0x2de812['attributes'],'include':_0x2de812[_0x804b('0x1b')]?_[_0x804b('0x19')](_0x2de812[_0x804b('0x1b')],function(_0x27d5ec){return{'model':db[_0x27d5ec[_0x804b('0x1a')]],'as':_0x27d5ec['as'],'attributes':_0x27d5ec['attributes']};}):[]};}):[]};}):[]:[]})[_0x804b('0x9')](function(_0x22f822){logger[_0x804b('0xa')](_0x804b('0x12'),_0x3a05c0);logger[_0x804b('0x1c')]('GetVtigerAccount',_0x3a05c0,JSON[_0x804b('0xe')](_0x22f822));_0x871d6c(_0x22f822);})[_0x804b('0x1d')](function(_0x410871){logger['error'](_0x804b('0x12'),_0x410871[_0x804b('0x11')],_0x3a05c0);_0x50b4fe(_0x5a0a82[_0x804b('0xf')](0x1f4,_0x410871['message']));});});};exports[_0x804b('0x1e')]=function(_0x471c04){var _0x5e8f85=this;return new Promise(function(_0x391376,_0x37dd3e){return db[_0x804b('0x13')][_0x804b('0x1f')]({'raw':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')][_0x804b('0x16')]||null:null,'attributes':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')][_0x804b('0x17')]||null:null,'include':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')][_0x804b('0x1b')]?_[_0x804b('0x19')](_0x471c04[_0x804b('0x15')][_0x804b('0x1b')],function(_0x34d5d0){return{'model':db[_0x34d5d0[_0x804b('0x1a')]],'as':_0x34d5d0['as'],'attributes':_0x34d5d0[_0x804b('0x17')],'include':_0x34d5d0[_0x804b('0x1b')]?_[_0x804b('0x19')](_0x34d5d0[_0x804b('0x1b')],function(_0xf47023){return{'model':db[_0xf47023[_0x804b('0x1a')]],'as':_0xf47023['as'],'attributes':_0xf47023[_0x804b('0x17')],'include':_0xf47023[_0x804b('0x1b')]?_[_0x804b('0x19')](_0xf47023[_0x804b('0x1b')],function(_0x35150b){return{'model':db[_0x35150b['model']],'as':_0x35150b['as'],'attributes':_0x35150b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3da331){logger[_0x804b('0xa')](_0x804b('0x1e'),_0x471c04);logger['debug']('ShowVtigerAccount',_0x471c04,JSON['stringify'](_0x3da331));_0x391376(_0x3da331);})[_0x804b('0x1d')](function(_0x1aaa47){logger[_0x804b('0xf')](_0x804b('0x1e'),_0x1aaa47[_0x804b('0x11')],_0x471c04);_0x37dd3e(_0x5e8f85[_0x804b('0xf')](0x1f4,_0x1aaa47[_0x804b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index f695987..0a7ceca 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 _0x4e89=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x50f7db,_0x563379){var _0x176c7a=function(_0x173583){while(--_0x173583){_0x50f7db['push'](_0x50f7db['shift']());}};_0x176c7a(++_0x563379);}(_0x4e89,0x126));var _0x94e8=function(_0x1d5c99,_0x1ee3f1){_0x1d5c99=_0x1d5c99-0x0;var _0x1794a8=_0x4e89[_0x1d5c99];return _0x1794a8;};'use strict';var multer=require(_0x94e8('0x0'));var util=require(_0x94e8('0x1'));var path=require(_0x94e8('0x2'));var timeout=require(_0x94e8('0x3'));var express=require(_0x94e8('0x4'));var router=express[_0x94e8('0x5')]();var fs_extra=require(_0x94e8('0x6'));var auth=require(_0x94e8('0x7'));var interaction=require(_0x94e8('0x8'));var config=require(_0x94e8('0x9'));var controller=require(_0x94e8('0xa'));router[_0x94e8('0xb')]('/',auth[_0x94e8('0xc')](),controller['index']);router['get']('/:id',auth[_0x94e8('0xc')](),controller[_0x94e8('0xd')]);router['get'](_0x94e8('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x94e8('0xb')](_0x94e8('0xf'),auth[_0x94e8('0xc')](),controller[_0x94e8('0x10')]);router[_0x94e8('0xb')](_0x94e8('0x11'),auth['isAuthenticated'](),controller[_0x94e8('0x12')]);router['post']('/',auth[_0x94e8('0xc')](),controller['create']);router[_0x94e8('0x13')](_0x94e8('0x14'),auth['isAuthenticated'](),controller[_0x94e8('0x15')]);router[_0x94e8('0x16')](_0x94e8('0x14'),auth[_0x94e8('0xc')](),controller[_0x94e8('0x17')]);module[_0x94e8('0x18')]=router; \ No newline at end of file +var _0x91e6=['isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create','put','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get'];(function(_0x53665b,_0xb5d5cb){var _0x266edd=function(_0x2623ed){while(--_0x2623ed){_0x53665b['push'](_0x53665b['shift']());}};_0x266edd(++_0xb5d5cb);}(_0x91e6,0x19b));var _0x691e=function(_0x5efe63,_0x5aeb0f){_0x5efe63=_0x5efe63-0x0;var _0x44ff5b=_0x91e6[_0x5efe63];return _0x44ff5b;};'use strict';var multer=require(_0x691e('0x0'));var util=require(_0x691e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x691e('0x2'));var router=express[_0x691e('0x3')]();var fs_extra=require(_0x691e('0x4'));var auth=require(_0x691e('0x5'));var interaction=require(_0x691e('0x6'));var config=require('../../config/environment');var controller=require(_0x691e('0x7'));router[_0x691e('0x8')]('/',auth[_0x691e('0x9')](),controller['index']);router['get'](_0x691e('0xa'),auth[_0x691e('0x9')](),controller['show']);router['get'](_0x691e('0xb'),auth['isAuthenticated'](),controller[_0x691e('0xc')]);router['get'](_0x691e('0xd'),auth[_0x691e('0x9')](),controller['getSubjects']);router['get'](_0x691e('0xe'),auth[_0x691e('0x9')](),controller['getDescriptions']);router[_0x691e('0xf')]('/',auth[_0x691e('0x9')](),controller[_0x691e('0x10')]);router[_0x691e('0x11')](_0x691e('0xa'),auth[_0x691e('0x9')](),controller['update']);router[_0x691e('0x12')](_0x691e('0xa'),auth[_0x691e('0x9')](),controller['destroy']);module[_0x691e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index c39ed10..21e4084 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 _0x1268=['STRING','sequelize','exports'];(function(_0x231c59,_0x3ec965){var _0x5299e1=function(_0x1808f1){while(--_0x1808f1){_0x231c59['push'](_0x231c59['shift']());}};_0x5299e1(++_0x3ec965);}(_0x1268,0x16c));var _0x8126=function(_0x5ad787,_0x801d15){_0x5ad787=_0x5ad787-0x0;var _0x1a29f1=_0x1268[_0x5ad787];return _0x1a29f1;};'use strict';var Sequelize=require(_0x8126('0x0'));module[_0x8126('0x1')]={'name':{'type':Sequelize[_0x8126('0x2')]},'description':{'type':Sequelize[_0x8126('0x2')]}}; \ No newline at end of file +var _0xfdd1=['STRING','sequelize','exports'];(function(_0x19499a,_0x211fac){var _0x71ec31=function(_0x23531d){while(--_0x23531d){_0x19499a['push'](_0x19499a['shift']());}};_0x71ec31(++_0x211fac);}(_0xfdd1,0x14e));var _0x1fdd=function(_0x7b7f5f,_0x2d472b){_0x7b7f5f=_0x7b7f5f-0x0;var _0x35e97f=_0xfdd1[_0x7b7f5f];return _0x35e97f;};'use strict';var Sequelize=require(_0x1fdd('0x0'));module[_0x1fdd('0x1')]={'name':{'type':Sequelize[_0x1fdd('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 1f5b4de..6f62806 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 _0xe9da=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../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','VtigerConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','sort','getFields','getSubjects','VtigerField','options','moment','bluebird','mustache'];(function(_0x437ef0,_0x5e58f9){var _0x16056b=function(_0x59132e){while(--_0x59132e){_0x437ef0['push'](_0x437ef0['shift']());}};_0x16056b(++_0x5e58f9);}(_0xe9da,0x1dd));var _0xae9d=function(_0x26d1d8,_0x58fcff){_0x26d1d8=_0x26d1d8-0x0;var _0x15d26f=_0xe9da[_0x26d1d8];return _0x15d26f;};'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(_0xae9d('0x0'));var BPromise=require(_0xae9d('0x1'));var Mustache=require(_0xae9d('0x2'));var util=require('util');var path=require(_0xae9d('0x3'));var sox=require(_0xae9d('0x4'));var csv=require(_0xae9d('0x5'));var ejs=require(_0xae9d('0x6'));var fs=require('fs');var fs_extra=require(_0xae9d('0x7'));var _=require(_0xae9d('0x8'));var squel=require(_0xae9d('0x9'));var crypto=require(_0xae9d('0xa'));var jsforce=require(_0xae9d('0xb'));var deskjs=require(_0xae9d('0xc'));var toCsv=require(_0xae9d('0x5'));var querystring=require('querystring');var Papa=require(_0xae9d('0xd'));var Redis=require(_0xae9d('0xe'));var authService=require(_0xae9d('0xf'));var qs=require(_0xae9d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae9d('0x11'));var logger=require(_0xae9d('0x12'))(_0xae9d('0x13'));var utils=require('../../config/utils');var config=require(_0xae9d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xae9d('0x15'))['db'];function respondWithStatusCode(_0x2de6b7,_0x3ec098){_0x3ec098=_0x3ec098||0xcc;return function(_0x467310){if(_0x467310){return _0x2de6b7[_0xae9d('0x16')](_0x3ec098);}return _0x2de6b7[_0xae9d('0x17')](_0x3ec098)['end']();};}function respondWithResult(_0x49a86b,_0x5ddf88){_0x5ddf88=_0x5ddf88||0xc8;return function(_0x2b807e){if(_0x2b807e){return _0x49a86b['status'](_0x5ddf88)[_0xae9d('0x18')](_0x2b807e);}};}function respondWithFilteredResult(_0x365ae5,_0x30a2af){return function(_0x54010c){if(_0x54010c){var _0x2ca924=typeof _0x30a2af[_0xae9d('0x19')]===_0xae9d('0x1a')&&typeof _0x30a2af[_0xae9d('0x1b')]===_0xae9d('0x1a');var _0x2b61c9=_0x54010c[_0xae9d('0x1c')];var _0x548fac=_0x2ca924?0x0:_0x30a2af[_0xae9d('0x19')];var _0x12aef0=_0x2ca924?_0x54010c[_0xae9d('0x1c')]:_0x30a2af[_0xae9d('0x19')]+_0x30a2af[_0xae9d('0x1b')];var _0x2ddf62;if(_0x12aef0>=_0x2b61c9){_0x12aef0=_0x2b61c9;_0x2ddf62=0xc8;}else{_0x2ddf62=0xce;}_0x365ae5[_0xae9d('0x17')](_0x2ddf62);return _0x365ae5[_0xae9d('0x1d')](_0xae9d('0x1e'),_0x548fac+'-'+_0x12aef0+'/'+_0x2b61c9)[_0xae9d('0x18')](_0x54010c);}return null;};}function patchUpdates(_0x1cfe5f){return function(_0x332cd9){try{jsonpatch[_0xae9d('0x1f')](_0x332cd9,_0x1cfe5f,!![]);}catch(_0x3136c0){return BPromise[_0xae9d('0x20')](_0x3136c0);}return _0x332cd9[_0xae9d('0x21')]();};}function saveUpdates(_0x439659,_0x2c3080){return function(_0x85f0ed){if(_0x85f0ed){return _0x85f0ed[_0xae9d('0x22')](_0x439659)[_0xae9d('0x23')](function(_0x4af195){return _0x4af195;});}return null;};}function removeEntity(_0x136363,_0x58f1ee){return function(_0x2da5c0){if(_0x2da5c0){return _0x2da5c0[_0xae9d('0x24')]()[_0xae9d('0x23')](function(){_0x136363[_0xae9d('0x17')](0xcc)[_0xae9d('0x25')]();});}};}function handleEntityNotFound(_0x4a6254,_0x483d90){return function(_0x3ddb4c){if(!_0x3ddb4c){_0x4a6254[_0xae9d('0x16')](0x194);}return _0x3ddb4c;};}function handleError(_0xf7ce01,_0xae5e84){_0xae5e84=_0xae5e84||0x1f4;return function(_0x5e98bc){logger[_0xae9d('0x26')](_0x5e98bc[_0xae9d('0x27')]);if(_0x5e98bc[_0xae9d('0x28')]){delete _0x5e98bc[_0xae9d('0x28')];}_0xf7ce01['status'](_0xae5e84)[_0xae9d('0x29')](_0x5e98bc);};}exports[_0xae9d('0x2a')]=function(_0x4cb785,_0x166379){var _0x37315a={},_0x3543c3={},_0xc7eeee={'count':0x0,'rows':[]};var _0x4db893=_[_0xae9d('0x2b')](db[_0xae9d('0x2c')][_0xae9d('0x2d')],function(_0x3746c2){return{'name':_0x3746c2[_0xae9d('0x2e')],'type':_0x3746c2[_0xae9d('0x2f')]['key']};});_0x3543c3[_0xae9d('0x30')]=_[_0xae9d('0x2b')](_0x4db893,_0xae9d('0x28'));_0x3543c3['query']=_[_0xae9d('0x31')](_0x4cb785[_0xae9d('0x32')]);_0x3543c3[_0xae9d('0x33')]=_[_0xae9d('0x34')](_0x3543c3['model'],_0x3543c3[_0xae9d('0x32')]);_0x37315a[_0xae9d('0x35')]=_[_0xae9d('0x34')](_0x3543c3['model'],qs[_0xae9d('0x36')](_0x4cb785[_0xae9d('0x32')][_0xae9d('0x36')]));_0x37315a['attributes']=_0x37315a[_0xae9d('0x35')][_0xae9d('0x37')]?_0x37315a[_0xae9d('0x35')]:_0x3543c3[_0xae9d('0x30')];if(!_0x4cb785[_0xae9d('0x32')][_0xae9d('0x38')](_0xae9d('0x39'))){_0x37315a[_0xae9d('0x1b')]=qs[_0xae9d('0x1b')](_0x4cb785[_0xae9d('0x32')][_0xae9d('0x1b')]);_0x37315a[_0xae9d('0x19')]=qs['offset'](_0x4cb785['query'][_0xae9d('0x19')]);}_0x37315a[_0xae9d('0x3a')]=qs['sort'](_0x4cb785[_0xae9d('0x32')]['sort']);_0x37315a['where']=qs[_0xae9d('0x33')](_[_0xae9d('0x3b')](_0x4cb785[_0xae9d('0x32')],_0x3543c3[_0xae9d('0x33')]),_0x4db893);if(_0x4cb785[_0xae9d('0x32')][_0xae9d('0x3c')]){_0x37315a['where']=_[_0xae9d('0x3d')](_0x37315a['where'],{'$or':_[_0xae9d('0x2b')](_0x4db893,function(_0x1bbe12){if(_0x1bbe12[_0xae9d('0x2f')]!==_0xae9d('0x3e')){var _0x3334f9={};_0x3334f9[_0x1bbe12['name']]={'$like':'%'+_0x4cb785['query'][_0xae9d('0x3c')]+'%'};return _0x3334f9;}})});}_0x37315a=_[_0xae9d('0x3d')]({},_0x37315a,_0x4cb785['options']);var _0x3f49e8={'where':_0x37315a[_0xae9d('0x3f')]};return db[_0xae9d('0x2c')][_0xae9d('0x1c')](_0x3f49e8)[_0xae9d('0x23')](function(_0x5c87ef){_0xc7eeee['count']=_0x5c87ef;if(_0x4cb785['query'][_0xae9d('0x40')]){_0x37315a[_0xae9d('0x41')]=[{'all':!![]}];}return db[_0xae9d('0x2c')][_0xae9d('0x42')](_0x37315a);})[_0xae9d('0x23')](function(_0x192fd0){_0xc7eeee[_0xae9d('0x43')]=_0x192fd0;return _0xc7eeee;})['then'](respondWithFilteredResult(_0x166379,_0x37315a))[_0xae9d('0x44')](handleError(_0x166379,null));};exports[_0xae9d('0x45')]=function(_0x10ce2a,_0x175996){var _0x4e776f={'raw':![],'where':{'id':_0x10ce2a[_0xae9d('0x46')]['id']}},_0x4743b4={};_0x4743b4[_0xae9d('0x30')]=_[_0xae9d('0x31')](db['VtigerConfiguration']['rawAttributes']);_0x4743b4[_0xae9d('0x32')]=_[_0xae9d('0x31')](_0x10ce2a[_0xae9d('0x32')]);_0x4743b4['filters']=_[_0xae9d('0x34')](_0x4743b4['model'],_0x4743b4[_0xae9d('0x32')]);_0x4e776f['attributes']=_[_0xae9d('0x34')](_0x4743b4[_0xae9d('0x30')],qs[_0xae9d('0x36')](_0x10ce2a[_0xae9d('0x32')][_0xae9d('0x36')]));_0x4e776f[_0xae9d('0x35')]=_0x4e776f[_0xae9d('0x35')][_0xae9d('0x37')]?_0x4e776f['attributes']:_0x4743b4['model'];if(_0x10ce2a[_0xae9d('0x32')]['includeAll']){_0x4e776f[_0xae9d('0x41')]=[{'all':!![]}];}_0x4e776f=_[_0xae9d('0x3d')]({},_0x4e776f,_0x10ce2a['options']);return db[_0xae9d('0x2c')][_0xae9d('0x47')](_0x4e776f)[_0xae9d('0x23')](handleEntityNotFound(_0x175996,null))[_0xae9d('0x23')](respondWithResult(_0x175996,null))['catch'](handleError(_0x175996,null));};exports[_0xae9d('0x48')]=function(_0xfccf82,_0x550bfa){return db['VtigerConfiguration']['create'](_0xfccf82['body'],{})['then'](respondWithResult(_0x550bfa,0xc9))[_0xae9d('0x44')](handleError(_0x550bfa,null));};exports[_0xae9d('0x22')]=function(_0x2c86cc,_0x58ba7c){if(_0x2c86cc[_0xae9d('0x49')]['id']){delete _0x2c86cc['body']['id'];}return db[_0xae9d('0x2c')][_0xae9d('0x47')]({'where':{'id':_0x2c86cc[_0xae9d('0x46')]['id']}})[_0xae9d('0x23')](handleEntityNotFound(_0x58ba7c,null))[_0xae9d('0x23')](saveUpdates(_0x2c86cc[_0xae9d('0x49')],null))['then'](respondWithResult(_0x58ba7c,null))[_0xae9d('0x44')](handleError(_0x58ba7c,null));};exports[_0xae9d('0x24')]=function(_0x276434,_0x543af0){return db['VtigerConfiguration'][_0xae9d('0x47')]({'where':{'id':_0x276434[_0xae9d('0x46')]['id']}})['then'](handleEntityNotFound(_0x543af0,null))[_0xae9d('0x23')](removeEntity(_0x543af0,null))[_0xae9d('0x44')](handleError(_0x543af0,null));};exports['getFields']=function(_0x1e506b,_0x2579d0,_0x315613){var _0x4d7aed={};var _0x1926bd={};var _0x30eb04;var _0x4455ba;return db[_0xae9d('0x2c')][_0xae9d('0x4a')]({'where':{'id':_0x1e506b[_0xae9d('0x46')]['id']}})['then'](handleEntityNotFound(_0x2579d0,null))['then'](function(_0x569582){if(_0x569582){_0x30eb04=_0x569582;_0x1926bd[_0xae9d('0x30')]=_['keys'](db['VtigerField']['rawAttributes']);_0x1926bd[_0xae9d('0x32')]=_[_0xae9d('0x31')](_0x1e506b[_0xae9d('0x32')]);_0x1926bd['filters']=_[_0xae9d('0x34')](_0x1926bd['model'],_0x1926bd[_0xae9d('0x32')]);_0x4d7aed[_0xae9d('0x35')]=_[_0xae9d('0x34')](_0x1926bd[_0xae9d('0x30')],qs['fields'](_0x1e506b[_0xae9d('0x32')][_0xae9d('0x36')]));_0x4d7aed[_0xae9d('0x35')]=_0x4d7aed[_0xae9d('0x35')][_0xae9d('0x37')]?_0x4d7aed[_0xae9d('0x35')]:_0x1926bd[_0xae9d('0x30')];_0x4d7aed[_0xae9d('0x3a')]=qs[_0xae9d('0x4b')](_0x1e506b[_0xae9d('0x32')][_0xae9d('0x4b')]);_0x4d7aed[_0xae9d('0x3f')]=qs[_0xae9d('0x33')](_['pick'](_0x1e506b[_0xae9d('0x32')],_0x1926bd[_0xae9d('0x33')]));if(_0x1e506b[_0xae9d('0x32')][_0xae9d('0x3c')]){_0x4d7aed['where']=_[_0xae9d('0x3d')](_0x4d7aed[_0xae9d('0x3f')],{'$or':_[_0xae9d('0x2b')](_0x4d7aed[_0xae9d('0x35')],function(_0x5ef477){var _0x1d2fb0={};_0x1d2fb0[_0x5ef477]={'$like':'%'+_0x1e506b[_0xae9d('0x32')][_0xae9d('0x3c')]+'%'};return _0x1d2fb0;})});}_0x4d7aed=_[_0xae9d('0x3d')]({},_0x4d7aed,_0x1e506b['options']);return _0x30eb04[_0xae9d('0x4c')](_0x4d7aed);}})['then'](function(_0x55d3c9){if(_0x55d3c9){_0x4455ba=_0x55d3c9[_0xae9d('0x37')];if(!_0x1e506b['query']['hasOwnProperty'](_0xae9d('0x39'))){_0x4d7aed[_0xae9d('0x1b')]=qs[_0xae9d('0x1b')](_0x1e506b[_0xae9d('0x32')][_0xae9d('0x1b')]);_0x4d7aed[_0xae9d('0x19')]=qs[_0xae9d('0x19')](_0x1e506b[_0xae9d('0x32')][_0xae9d('0x19')]);}return _0x30eb04[_0xae9d('0x4c')](_0x4d7aed);}})[_0xae9d('0x23')](function(_0x556e3c){if(_0x556e3c){return _0x556e3c?{'count':_0x4455ba,'rows':_0x556e3c}:null;}})['then'](respondWithResult(_0x2579d0,null))['catch'](handleError(_0x2579d0,null));};exports[_0xae9d('0x4d')]=function(_0x2a5fa4,_0x498f36,_0x3b74e6){var _0x5b8baf={};var _0x51097f={};var _0x589f8d;var _0x17cbbb;return db['VtigerConfiguration'][_0xae9d('0x4a')]({'where':{'id':_0x2a5fa4['params']['id']}})[_0xae9d('0x23')](handleEntityNotFound(_0x498f36,null))[_0xae9d('0x23')](function(_0x5175e9){if(_0x5175e9){_0x589f8d=_0x5175e9;_0x51097f[_0xae9d('0x30')]=_[_0xae9d('0x31')](db[_0xae9d('0x4e')][_0xae9d('0x2d')]);_0x51097f[_0xae9d('0x32')]=_[_0xae9d('0x31')](_0x2a5fa4['query']);_0x51097f[_0xae9d('0x33')]=_[_0xae9d('0x34')](_0x51097f['model'],_0x51097f[_0xae9d('0x32')]);_0x5b8baf[_0xae9d('0x35')]=_[_0xae9d('0x34')](_0x51097f['model'],qs['fields'](_0x2a5fa4[_0xae9d('0x32')][_0xae9d('0x36')]));_0x5b8baf['attributes']=_0x5b8baf['attributes'][_0xae9d('0x37')]?_0x5b8baf[_0xae9d('0x35')]:_0x51097f['model'];_0x5b8baf[_0xae9d('0x3a')]=qs[_0xae9d('0x4b')](_0x2a5fa4[_0xae9d('0x32')][_0xae9d('0x4b')]);_0x5b8baf['where']=qs['filters'](_['pick'](_0x2a5fa4[_0xae9d('0x32')],_0x51097f[_0xae9d('0x33')]));if(_0x2a5fa4[_0xae9d('0x32')][_0xae9d('0x3c')]){_0x5b8baf[_0xae9d('0x3f')]=_[_0xae9d('0x3d')](_0x5b8baf[_0xae9d('0x3f')],{'$or':_[_0xae9d('0x2b')](_0x5b8baf[_0xae9d('0x35')],function(_0xa2430c){var _0x1b68ee={};_0x1b68ee[_0xa2430c]={'$like':'%'+_0x2a5fa4[_0xae9d('0x32')][_0xae9d('0x3c')]+'%'};return _0x1b68ee;})});}_0x5b8baf=_['merge']({},_0x5b8baf,_0x2a5fa4[_0xae9d('0x4f')]);return _0x589f8d[_0xae9d('0x4d')](_0x5b8baf);}})[_0xae9d('0x23')](function(_0x5df25c){if(_0x5df25c){_0x17cbbb=_0x5df25c[_0xae9d('0x37')];if(!_0x2a5fa4[_0xae9d('0x32')][_0xae9d('0x38')](_0xae9d('0x39'))){_0x5b8baf[_0xae9d('0x1b')]=qs[_0xae9d('0x1b')](_0x2a5fa4[_0xae9d('0x32')][_0xae9d('0x1b')]);_0x5b8baf[_0xae9d('0x19')]=qs['offset'](_0x2a5fa4[_0xae9d('0x32')][_0xae9d('0x19')]);}return _0x589f8d[_0xae9d('0x4d')](_0x5b8baf);}})['then'](function(_0x47c53d){if(_0x47c53d){return _0x47c53d?{'count':_0x17cbbb,'rows':_0x47c53d}:null;}})[_0xae9d('0x23')](respondWithResult(_0x498f36,null))[_0xae9d('0x44')](handleError(_0x498f36,null));};exports['getDescriptions']=function(_0x17b9b5,_0x4bd8fd,_0x1ce081){var _0x3bf253={};var _0xb6558d={};var _0xfd565;var _0x36cec6;return db[_0xae9d('0x2c')][_0xae9d('0x4a')]({'where':{'id':_0x17b9b5[_0xae9d('0x46')]['id']}})[_0xae9d('0x23')](handleEntityNotFound(_0x4bd8fd,null))[_0xae9d('0x23')](function(_0x3cd305){if(_0x3cd305){_0xfd565=_0x3cd305;_0xb6558d[_0xae9d('0x30')]=_[_0xae9d('0x31')](db[_0xae9d('0x4e')][_0xae9d('0x2d')]);_0xb6558d[_0xae9d('0x32')]=_['keys'](_0x17b9b5['query']);_0xb6558d[_0xae9d('0x33')]=_[_0xae9d('0x34')](_0xb6558d['model'],_0xb6558d[_0xae9d('0x32')]);_0x3bf253[_0xae9d('0x35')]=_[_0xae9d('0x34')](_0xb6558d[_0xae9d('0x30')],qs['fields'](_0x17b9b5[_0xae9d('0x32')][_0xae9d('0x36')]));_0x3bf253[_0xae9d('0x35')]=_0x3bf253[_0xae9d('0x35')]['length']?_0x3bf253['attributes']:_0xb6558d[_0xae9d('0x30')];_0x3bf253[_0xae9d('0x3a')]=qs['sort'](_0x17b9b5['query']['sort']);_0x3bf253[_0xae9d('0x3f')]=qs[_0xae9d('0x33')](_[_0xae9d('0x3b')](_0x17b9b5[_0xae9d('0x32')],_0xb6558d[_0xae9d('0x33')]));if(_0x17b9b5['query'][_0xae9d('0x3c')]){_0x3bf253[_0xae9d('0x3f')]=_[_0xae9d('0x3d')](_0x3bf253['where'],{'$or':_[_0xae9d('0x2b')](_0x3bf253[_0xae9d('0x35')],function(_0xa7734b){var _0x282214={};_0x282214[_0xa7734b]={'$like':'%'+_0x17b9b5[_0xae9d('0x32')][_0xae9d('0x3c')]+'%'};return _0x282214;})});}_0x3bf253=_['merge']({},_0x3bf253,_0x17b9b5[_0xae9d('0x4f')]);return _0xfd565['getDescriptions'](_0x3bf253);}})[_0xae9d('0x23')](function(_0x6ddafb){if(_0x6ddafb){_0x36cec6=_0x6ddafb['length'];if(!_0x17b9b5[_0xae9d('0x32')][_0xae9d('0x38')](_0xae9d('0x39'))){_0x3bf253[_0xae9d('0x1b')]=qs[_0xae9d('0x1b')](_0x17b9b5['query'][_0xae9d('0x1b')]);_0x3bf253[_0xae9d('0x19')]=qs['offset'](_0x17b9b5['query'][_0xae9d('0x19')]);}return _0xfd565['getDescriptions'](_0x3bf253);}})[_0xae9d('0x23')](function(_0x4828da){if(_0x4828da){return _0x4828da?{'count':_0x36cec6,'rows':_0x4828da}:null;}})[_0xae9d('0x23')](respondWithResult(_0x4bd8fd,null))['catch'](handleError(_0x4bd8fd,null));}; \ No newline at end of file +var _0xc4a7=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','destroy','then','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','getFields','findOne','VtigerField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x221f71,_0x221c04){var _0x2df2e5=function(_0x242926){while(--_0x242926){_0x221f71['push'](_0x221f71['shift']());}};_0x2df2e5(++_0x221c04);}(_0xc4a7,0x132));var _0x7c4a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc4a7[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x7c4a('0x0'));var rimraf=require(_0x7c4a('0x1'));var zipdir=require(_0x7c4a('0x2'));var jsonpatch=require(_0x7c4a('0x3'));var rp=require(_0x7c4a('0x4'));var moment=require(_0x7c4a('0x5'));var BPromise=require(_0x7c4a('0x6'));var Mustache=require(_0x7c4a('0x7'));var util=require(_0x7c4a('0x8'));var path=require('path');var sox=require(_0x7c4a('0x9'));var csv=require(_0x7c4a('0xa'));var ejs=require(_0x7c4a('0xb'));var fs=require('fs');var fs_extra=require(_0x7c4a('0xc'));var _=require(_0x7c4a('0xd'));var squel=require(_0x7c4a('0xe'));var crypto=require('crypto');var jsforce=require(_0x7c4a('0xf'));var deskjs=require(_0x7c4a('0x10'));var toCsv=require(_0x7c4a('0xa'));var querystring=require(_0x7c4a('0x11'));var Papa=require(_0x7c4a('0x12'));var Redis=require(_0x7c4a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7c4a('0x14'));var as=require(_0x7c4a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c4a('0x16'))('api');var utils=require(_0x7c4a('0x17'));var config=require(_0x7c4a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c4a('0x19'))['db'];function respondWithStatusCode(_0x50523c,_0x302983){_0x302983=_0x302983||0xcc;return function(_0x4d9663){if(_0x4d9663){return _0x50523c[_0x7c4a('0x1a')](_0x302983);}return _0x50523c[_0x7c4a('0x1b')](_0x302983)[_0x7c4a('0x1c')]();};}function respondWithResult(_0xe9cdfb,_0x137472){_0x137472=_0x137472||0xc8;return function(_0x3f45a4){if(_0x3f45a4){return _0xe9cdfb['status'](_0x137472)['json'](_0x3f45a4);}};}function respondWithFilteredResult(_0x3c60bc,_0x161d09){return function(_0x14f203){if(_0x14f203){var _0x1a5578=typeof _0x161d09[_0x7c4a('0x1d')]===_0x7c4a('0x1e')&&typeof _0x161d09[_0x7c4a('0x1f')]===_0x7c4a('0x1e');var _0x541e4a=_0x14f203[_0x7c4a('0x20')];var _0x29eac5=_0x1a5578?0x0:_0x161d09['offset'];var _0x7719d9=_0x1a5578?_0x14f203[_0x7c4a('0x20')]:_0x161d09[_0x7c4a('0x1d')]+_0x161d09[_0x7c4a('0x1f')];var _0x59984b;if(_0x7719d9>=_0x541e4a){_0x7719d9=_0x541e4a;_0x59984b=0xc8;}else{_0x59984b=0xce;}_0x3c60bc[_0x7c4a('0x1b')](_0x59984b);return _0x3c60bc[_0x7c4a('0x21')](_0x7c4a('0x22'),_0x29eac5+'-'+_0x7719d9+'/'+_0x541e4a)[_0x7c4a('0x23')](_0x14f203);}return null;};}function patchUpdates(_0x402314){return function(_0x3f92d0){try{jsonpatch[_0x7c4a('0x24')](_0x3f92d0,_0x402314,!![]);}catch(_0x355e3f){return BPromise['reject'](_0x355e3f);}return _0x3f92d0['save']();};}function saveUpdates(_0x145ff7,_0x4e64a0){return function(_0x1ffef5){if(_0x1ffef5){return _0x1ffef5[_0x7c4a('0x25')](_0x145ff7)['then'](function(_0xb15125){return _0xb15125;});}return null;};}function removeEntity(_0x4d5e4a,_0x2a8967){return function(_0x297f75){if(_0x297f75){return _0x297f75[_0x7c4a('0x26')]()[_0x7c4a('0x27')](function(){_0x4d5e4a[_0x7c4a('0x1b')](0xcc)[_0x7c4a('0x1c')]();});}};}function handleEntityNotFound(_0x42abb7,_0x567c09){return function(_0x2fa266){if(!_0x2fa266){_0x42abb7[_0x7c4a('0x1a')](0x194);}return _0x2fa266;};}function handleError(_0x3f800e,_0x37259f){_0x37259f=_0x37259f||0x1f4;return function(_0x2d10bf){logger['error'](_0x2d10bf[_0x7c4a('0x28')]);if(_0x2d10bf[_0x7c4a('0x29')]){delete _0x2d10bf['name'];}_0x3f800e['status'](_0x37259f)[_0x7c4a('0x2a')](_0x2d10bf);};}exports['index']=function(_0x3ce1da,_0x398be5){var _0x2fd098={},_0x195c2b={},_0xff967b={'count':0x0,'rows':[]};var _0x9120b4=_[_0x7c4a('0x2b')](db[_0x7c4a('0x2c')][_0x7c4a('0x2d')],function(_0x21b0c2){return{'name':_0x21b0c2[_0x7c4a('0x2e')],'type':_0x21b0c2['type'][_0x7c4a('0x2f')]};});_0x195c2b[_0x7c4a('0x30')]=_['map'](_0x9120b4,_0x7c4a('0x29'));_0x195c2b[_0x7c4a('0x31')]=_['keys'](_0x3ce1da[_0x7c4a('0x31')]);_0x195c2b[_0x7c4a('0x32')]=_['intersection'](_0x195c2b[_0x7c4a('0x30')],_0x195c2b[_0x7c4a('0x31')]);_0x2fd098[_0x7c4a('0x33')]=_[_0x7c4a('0x34')](_0x195c2b[_0x7c4a('0x30')],qs[_0x7c4a('0x35')](_0x3ce1da[_0x7c4a('0x31')][_0x7c4a('0x35')]));_0x2fd098[_0x7c4a('0x33')]=_0x2fd098[_0x7c4a('0x33')][_0x7c4a('0x36')]?_0x2fd098[_0x7c4a('0x33')]:_0x195c2b[_0x7c4a('0x30')];if(!_0x3ce1da[_0x7c4a('0x31')][_0x7c4a('0x37')](_0x7c4a('0x38'))){_0x2fd098[_0x7c4a('0x1f')]=qs[_0x7c4a('0x1f')](_0x3ce1da[_0x7c4a('0x31')][_0x7c4a('0x1f')]);_0x2fd098[_0x7c4a('0x1d')]=qs[_0x7c4a('0x1d')](_0x3ce1da[_0x7c4a('0x31')][_0x7c4a('0x1d')]);}_0x2fd098[_0x7c4a('0x39')]=qs[_0x7c4a('0x3a')](_0x3ce1da[_0x7c4a('0x31')]['sort']);_0x2fd098[_0x7c4a('0x3b')]=qs['filters'](_['pick'](_0x3ce1da[_0x7c4a('0x31')],_0x195c2b['filters']),_0x9120b4);if(_0x3ce1da[_0x7c4a('0x31')]['filter']){_0x2fd098[_0x7c4a('0x3b')]=_[_0x7c4a('0x3c')](_0x2fd098['where'],{'$or':_[_0x7c4a('0x2b')](_0x9120b4,function(_0x1b596d){if(_0x1b596d[_0x7c4a('0x3d')]!==_0x7c4a('0x3e')){var _0x10dd0c={};_0x10dd0c[_0x1b596d[_0x7c4a('0x29')]]={'$like':'%'+_0x3ce1da['query'][_0x7c4a('0x3f')]+'%'};return _0x10dd0c;}})});}_0x2fd098=_[_0x7c4a('0x3c')]({},_0x2fd098,_0x3ce1da[_0x7c4a('0x40')]);var _0x2a5402={'where':_0x2fd098[_0x7c4a('0x3b')]};return db['VtigerConfiguration'][_0x7c4a('0x20')](_0x2a5402)['then'](function(_0x27c934){_0xff967b[_0x7c4a('0x20')]=_0x27c934;if(_0x3ce1da[_0x7c4a('0x31')][_0x7c4a('0x41')]){_0x2fd098['include']=[{'all':!![]}];}return db[_0x7c4a('0x2c')][_0x7c4a('0x42')](_0x2fd098);})['then'](function(_0x3cd224){_0xff967b[_0x7c4a('0x43')]=_0x3cd224;return _0xff967b;})[_0x7c4a('0x27')](respondWithFilteredResult(_0x398be5,_0x2fd098))['catch'](handleError(_0x398be5,null));};exports[_0x7c4a('0x44')]=function(_0x16c337,_0x14d96f){var _0x3714c4={'raw':![],'where':{'id':_0x16c337[_0x7c4a('0x45')]['id']}},_0x6e2098={};_0x6e2098[_0x7c4a('0x30')]=_[_0x7c4a('0x46')](db[_0x7c4a('0x2c')][_0x7c4a('0x2d')]);_0x6e2098['query']=_[_0x7c4a('0x46')](_0x16c337[_0x7c4a('0x31')]);_0x6e2098[_0x7c4a('0x32')]=_['intersection'](_0x6e2098['model'],_0x6e2098[_0x7c4a('0x31')]);_0x3714c4[_0x7c4a('0x33')]=_[_0x7c4a('0x34')](_0x6e2098[_0x7c4a('0x30')],qs[_0x7c4a('0x35')](_0x16c337[_0x7c4a('0x31')][_0x7c4a('0x35')]));_0x3714c4[_0x7c4a('0x33')]=_0x3714c4[_0x7c4a('0x33')][_0x7c4a('0x36')]?_0x3714c4[_0x7c4a('0x33')]:_0x6e2098[_0x7c4a('0x30')];if(_0x16c337[_0x7c4a('0x31')][_0x7c4a('0x41')]){_0x3714c4[_0x7c4a('0x47')]=[{'all':!![]}];}_0x3714c4=_[_0x7c4a('0x3c')]({},_0x3714c4,_0x16c337[_0x7c4a('0x40')]);return db['VtigerConfiguration'][_0x7c4a('0x48')](_0x3714c4)[_0x7c4a('0x27')](handleEntityNotFound(_0x14d96f,null))['then'](respondWithResult(_0x14d96f,null))[_0x7c4a('0x49')](handleError(_0x14d96f,null));};exports['create']=function(_0x14ab37,_0x47e224){return db[_0x7c4a('0x2c')][_0x7c4a('0x4a')](_0x14ab37['body'],{})[_0x7c4a('0x27')](respondWithResult(_0x47e224,0xc9))['catch'](handleError(_0x47e224,null));};exports[_0x7c4a('0x25')]=function(_0x12be82,_0x4276d0){if(_0x12be82['body']['id']){delete _0x12be82[_0x7c4a('0x4b')]['id'];}return db['VtigerConfiguration'][_0x7c4a('0x48')]({'where':{'id':_0x12be82[_0x7c4a('0x45')]['id']}})[_0x7c4a('0x27')](handleEntityNotFound(_0x4276d0,null))[_0x7c4a('0x27')](saveUpdates(_0x12be82[_0x7c4a('0x4b')],null))[_0x7c4a('0x27')](respondWithResult(_0x4276d0,null))[_0x7c4a('0x49')](handleError(_0x4276d0,null));};exports[_0x7c4a('0x26')]=function(_0x435a9a,_0x28a554){return db[_0x7c4a('0x2c')][_0x7c4a('0x48')]({'where':{'id':_0x435a9a[_0x7c4a('0x45')]['id']}})['then'](handleEntityNotFound(_0x28a554,null))['then'](removeEntity(_0x28a554,null))[_0x7c4a('0x49')](handleError(_0x28a554,null));};exports[_0x7c4a('0x4c')]=function(_0x30ba65,_0x1fb7a2,_0xa32445){var _0x170c6f={};var _0x59b077={};var _0x595c32;var _0x16caed;return db[_0x7c4a('0x2c')][_0x7c4a('0x4d')]({'where':{'id':_0x30ba65[_0x7c4a('0x45')]['id']}})[_0x7c4a('0x27')](handleEntityNotFound(_0x1fb7a2,null))[_0x7c4a('0x27')](function(_0x487d79){if(_0x487d79){_0x595c32=_0x487d79;_0x59b077[_0x7c4a('0x30')]=_[_0x7c4a('0x46')](db[_0x7c4a('0x4e')][_0x7c4a('0x2d')]);_0x59b077['query']=_[_0x7c4a('0x46')](_0x30ba65[_0x7c4a('0x31')]);_0x59b077['filters']=_[_0x7c4a('0x34')](_0x59b077[_0x7c4a('0x30')],_0x59b077[_0x7c4a('0x31')]);_0x170c6f[_0x7c4a('0x33')]=_[_0x7c4a('0x34')](_0x59b077[_0x7c4a('0x30')],qs[_0x7c4a('0x35')](_0x30ba65['query']['fields']));_0x170c6f[_0x7c4a('0x33')]=_0x170c6f[_0x7c4a('0x33')][_0x7c4a('0x36')]?_0x170c6f[_0x7c4a('0x33')]:_0x59b077[_0x7c4a('0x30')];_0x170c6f[_0x7c4a('0x39')]=qs[_0x7c4a('0x3a')](_0x30ba65[_0x7c4a('0x31')][_0x7c4a('0x3a')]);_0x170c6f[_0x7c4a('0x3b')]=qs['filters'](_[_0x7c4a('0x4f')](_0x30ba65[_0x7c4a('0x31')],_0x59b077[_0x7c4a('0x32')]));if(_0x30ba65[_0x7c4a('0x31')][_0x7c4a('0x3f')]){_0x170c6f[_0x7c4a('0x3b')]=_[_0x7c4a('0x3c')](_0x170c6f[_0x7c4a('0x3b')],{'$or':_[_0x7c4a('0x2b')](_0x170c6f['attributes'],function(_0x58fd2c){var _0x4ae08e={};_0x4ae08e[_0x58fd2c]={'$like':'%'+_0x30ba65[_0x7c4a('0x31')][_0x7c4a('0x3f')]+'%'};return _0x4ae08e;})});}_0x170c6f=_[_0x7c4a('0x3c')]({},_0x170c6f,_0x30ba65[_0x7c4a('0x40')]);return _0x595c32['getFields'](_0x170c6f);}})[_0x7c4a('0x27')](function(_0x51e660){if(_0x51e660){_0x16caed=_0x51e660['length'];if(!_0x30ba65[_0x7c4a('0x31')][_0x7c4a('0x37')](_0x7c4a('0x38'))){_0x170c6f[_0x7c4a('0x1f')]=qs[_0x7c4a('0x1f')](_0x30ba65['query']['limit']);_0x170c6f[_0x7c4a('0x1d')]=qs[_0x7c4a('0x1d')](_0x30ba65[_0x7c4a('0x31')]['offset']);}return _0x595c32[_0x7c4a('0x4c')](_0x170c6f);}})['then'](function(_0x127bd9){if(_0x127bd9){return _0x127bd9?{'count':_0x16caed,'rows':_0x127bd9}:null;}})[_0x7c4a('0x27')](respondWithResult(_0x1fb7a2,null))[_0x7c4a('0x49')](handleError(_0x1fb7a2,null));};exports[_0x7c4a('0x50')]=function(_0x1d540f,_0x4bece6,_0x55e77e){var _0x5aefb6={};var _0x24a963={};var _0x5e2b5a;var _0x279bc6;return db[_0x7c4a('0x2c')][_0x7c4a('0x4d')]({'where':{'id':_0x1d540f['params']['id']}})[_0x7c4a('0x27')](handleEntityNotFound(_0x4bece6,null))[_0x7c4a('0x27')](function(_0x5bfb65){if(_0x5bfb65){_0x5e2b5a=_0x5bfb65;_0x24a963['model']=_[_0x7c4a('0x46')](db[_0x7c4a('0x4e')][_0x7c4a('0x2d')]);_0x24a963['query']=_[_0x7c4a('0x46')](_0x1d540f[_0x7c4a('0x31')]);_0x24a963[_0x7c4a('0x32')]=_[_0x7c4a('0x34')](_0x24a963[_0x7c4a('0x30')],_0x24a963[_0x7c4a('0x31')]);_0x5aefb6['attributes']=_[_0x7c4a('0x34')](_0x24a963[_0x7c4a('0x30')],qs[_0x7c4a('0x35')](_0x1d540f[_0x7c4a('0x31')][_0x7c4a('0x35')]));_0x5aefb6[_0x7c4a('0x33')]=_0x5aefb6[_0x7c4a('0x33')][_0x7c4a('0x36')]?_0x5aefb6[_0x7c4a('0x33')]:_0x24a963[_0x7c4a('0x30')];_0x5aefb6['order']=qs['sort'](_0x1d540f[_0x7c4a('0x31')][_0x7c4a('0x3a')]);_0x5aefb6[_0x7c4a('0x3b')]=qs[_0x7c4a('0x32')](_[_0x7c4a('0x4f')](_0x1d540f['query'],_0x24a963[_0x7c4a('0x32')]));if(_0x1d540f['query']['filter']){_0x5aefb6[_0x7c4a('0x3b')]=_[_0x7c4a('0x3c')](_0x5aefb6[_0x7c4a('0x3b')],{'$or':_[_0x7c4a('0x2b')](_0x5aefb6[_0x7c4a('0x33')],function(_0x147f75){var _0x39dbc6={};_0x39dbc6[_0x147f75]={'$like':'%'+_0x1d540f[_0x7c4a('0x31')][_0x7c4a('0x3f')]+'%'};return _0x39dbc6;})});}_0x5aefb6=_[_0x7c4a('0x3c')]({},_0x5aefb6,_0x1d540f['options']);return _0x5e2b5a[_0x7c4a('0x50')](_0x5aefb6);}})[_0x7c4a('0x27')](function(_0x56e331){if(_0x56e331){_0x279bc6=_0x56e331['length'];if(!_0x1d540f[_0x7c4a('0x31')][_0x7c4a('0x37')](_0x7c4a('0x38'))){_0x5aefb6['limit']=qs[_0x7c4a('0x1f')](_0x1d540f[_0x7c4a('0x31')][_0x7c4a('0x1f')]);_0x5aefb6['offset']=qs[_0x7c4a('0x1d')](_0x1d540f[_0x7c4a('0x31')][_0x7c4a('0x1d')]);}return _0x5e2b5a[_0x7c4a('0x50')](_0x5aefb6);}})[_0x7c4a('0x27')](function(_0x36de05){if(_0x36de05){return _0x36de05?{'count':_0x279bc6,'rows':_0x36de05}:null;}})[_0x7c4a('0x27')](respondWithResult(_0x4bece6,null))[_0x7c4a('0x49')](handleError(_0x4bece6,null));};exports[_0x7c4a('0x51')]=function(_0x4a7401,_0x1a747f,_0x261558){var _0x5aaa95={};var _0x2cc57c={};var _0x808b9f;var _0x1edb51;return db[_0x7c4a('0x2c')][_0x7c4a('0x4d')]({'where':{'id':_0x4a7401[_0x7c4a('0x45')]['id']}})[_0x7c4a('0x27')](handleEntityNotFound(_0x1a747f,null))[_0x7c4a('0x27')](function(_0x3b0aba){if(_0x3b0aba){_0x808b9f=_0x3b0aba;_0x2cc57c[_0x7c4a('0x30')]=_[_0x7c4a('0x46')](db['VtigerField'][_0x7c4a('0x2d')]);_0x2cc57c['query']=_[_0x7c4a('0x46')](_0x4a7401[_0x7c4a('0x31')]);_0x2cc57c[_0x7c4a('0x32')]=_[_0x7c4a('0x34')](_0x2cc57c[_0x7c4a('0x30')],_0x2cc57c[_0x7c4a('0x31')]);_0x5aaa95[_0x7c4a('0x33')]=_[_0x7c4a('0x34')](_0x2cc57c[_0x7c4a('0x30')],qs['fields'](_0x4a7401[_0x7c4a('0x31')]['fields']));_0x5aaa95[_0x7c4a('0x33')]=_0x5aaa95['attributes'][_0x7c4a('0x36')]?_0x5aaa95[_0x7c4a('0x33')]:_0x2cc57c[_0x7c4a('0x30')];_0x5aaa95['order']=qs[_0x7c4a('0x3a')](_0x4a7401[_0x7c4a('0x31')][_0x7c4a('0x3a')]);_0x5aaa95[_0x7c4a('0x3b')]=qs[_0x7c4a('0x32')](_[_0x7c4a('0x4f')](_0x4a7401['query'],_0x2cc57c[_0x7c4a('0x32')]));if(_0x4a7401['query'][_0x7c4a('0x3f')]){_0x5aaa95['where']=_['merge'](_0x5aaa95['where'],{'$or':_[_0x7c4a('0x2b')](_0x5aaa95[_0x7c4a('0x33')],function(_0x643059){var _0x396ce5={};_0x396ce5[_0x643059]={'$like':'%'+_0x4a7401[_0x7c4a('0x31')][_0x7c4a('0x3f')]+'%'};return _0x396ce5;})});}_0x5aaa95=_[_0x7c4a('0x3c')]({},_0x5aaa95,_0x4a7401[_0x7c4a('0x40')]);return _0x808b9f[_0x7c4a('0x51')](_0x5aaa95);}})[_0x7c4a('0x27')](function(_0x2388ba){if(_0x2388ba){_0x1edb51=_0x2388ba['length'];if(!_0x4a7401['query'][_0x7c4a('0x37')](_0x7c4a('0x38'))){_0x5aaa95[_0x7c4a('0x1f')]=qs[_0x7c4a('0x1f')](_0x4a7401[_0x7c4a('0x31')][_0x7c4a('0x1f')]);_0x5aaa95[_0x7c4a('0x1d')]=qs[_0x7c4a('0x1d')](_0x4a7401['query']['offset']);}return _0x808b9f[_0x7c4a('0x51')](_0x5aaa95);}})[_0x7c4a('0x27')](function(_0x5ee1d6){if(_0x5ee1d6){return _0x5ee1d6?{'count':_0x1edb51,'rows':_0x5ee1d6}:null;}})[_0x7c4a('0x27')](respondWithResult(_0x1a747f,null))[_0x7c4a('0x49')](handleError(_0x1a747f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index bf75d53..75fb4b9 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 _0x8836=['api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger'];(function(_0xe359d4,_0x12c64c){var _0x2d0091=function(_0x83923){while(--_0x83923){_0xe359d4['push'](_0xe359d4['shift']());}};_0x2d0091(++_0x12c64c);}(_0x8836,0x1cc));var _0x6883=function(_0x38570a,_0xaac9ea){_0x38570a=_0x38570a-0x0;var _0x12f77f=_0x8836[_0x38570a];return _0x12f77f;};'use strict';var _=require(_0x6883('0x0'));var util=require('util');var logger=require(_0x6883('0x1'))(_0x6883('0x2'));var moment=require(_0x6883('0x3'));var BPromise=require(_0x6883('0x4'));var rp=require(_0x6883('0x5'));var fs=require('fs');var path=require(_0x6883('0x6'));var rimraf=require('rimraf');var config=require(_0x6883('0x7'));var attributes=require(_0x6883('0x8'));module['exports']=function(_0x303521,_0x378abc){return _0x303521['define'](_0x6883('0x9'),attributes,{'tableName':_0x6883('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11e2=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api','moment'];(function(_0x329421,_0x414a49){var _0x5b31e8=function(_0x598ef4){while(--_0x598ef4){_0x329421['push'](_0x329421['shift']());}};_0x5b31e8(++_0x414a49);}(_0x11e2,0xf8));var _0x211e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x11e2[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x211e('0x0'));var logger=require(_0x211e('0x1'))(_0x211e('0x2'));var moment=require(_0x211e('0x3'));var BPromise=require(_0x211e('0x4'));var rp=require(_0x211e('0x5'));var fs=require('fs');var path=require(_0x211e('0x6'));var rimraf=require(_0x211e('0x7'));var config=require(_0x211e('0x8'));var attributes=require(_0x211e('0x9'));module[_0x211e('0xa')]=function(_0x5a7057,_0x18d9c5){return _0x5a7057[_0x211e('0xb')](_0x211e('0xc'),attributes,{'tableName':_0x211e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 72c63b0..0b4959e 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 _0x0910=['info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x36e4d0,_0x4e4a92){var _0x4f71e0=function(_0xd92e92){while(--_0xd92e92){_0x36e4d0['push'](_0x36e4d0['shift']());}};_0x4f71e0(++_0x4e4a92);}(_0x0910,0x122));var _0x0091=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0910[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0091('0x0'));var util=require('util');var moment=require(_0x0091('0x1'));var BPromise=require('bluebird');var rs=require(_0x0091('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0091('0x3'))['db'];var utils=require(_0x0091('0x4'));var logger=require(_0x0091('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0091('0x6')][_0x0091('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2deca6,_0x155021,_0x4dbe5d){return new BPromise(function(_0x46c0b3,_0x8cd4bd){return client[_0x0091('0x8')](_0x2deca6,_0x4dbe5d)[_0x0091('0x9')](function(_0xd7b4f0){logger[_0x0091('0xa')](_0x0091('0xb'),_0x155021,_0x0091('0xc'));logger[_0x0091('0xd')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x155021,'request\x20sent',JSON[_0x0091('0xe')](_0xd7b4f0));if(_0xd7b4f0[_0x0091('0xf')]){if(_0xd7b4f0[_0x0091('0xf')][_0x0091('0x10')]===0x1f4){logger[_0x0091('0xf')](_0x0091('0xb'),_0x155021,_0xd7b4f0[_0x0091('0xf')]['message']);return _0x8cd4bd(_0xd7b4f0[_0x0091('0xf')][_0x0091('0x11')]);}logger[_0x0091('0xf')](_0x0091('0xb'),_0x155021,_0xd7b4f0[_0x0091('0xf')][_0x0091('0x11')]);return _0x46c0b3(_0xd7b4f0['error'][_0x0091('0x11')]);}else{logger[_0x0091('0xa')](_0x0091('0xb'),_0x155021,'request\x20sent');_0x46c0b3(_0xd7b4f0[_0x0091('0x12')][_0x0091('0x11')]);}})[_0x0091('0x13')](function(_0x3e9e8a){logger[_0x0091('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x155021,_0x3e9e8a);_0x8cd4bd(_0x3e9e8a);});});} \ No newline at end of file +var _0x636e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x636e,0xe3));var _0xe636=function(_0x2a81c1,_0x19e721){_0x2a81c1=_0x2a81c1-0x0;var _0x495f38=_0x636e[_0x2a81c1];return _0x495f38;};'use strict';var _=require(_0xe636('0x0'));var util=require(_0xe636('0x1'));var moment=require('moment');var BPromise=require(_0xe636('0x2'));var rs=require(_0xe636('0x3'));var fs=require('fs');var Redis=require(_0xe636('0x4'));var db=require(_0xe636('0x5'))['db'];var utils=require(_0xe636('0x6'));var logger=require(_0xe636('0x7'))(_0xe636('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe636('0x9')][_0xe636('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x137fb1,_0x24e92e,_0xf05893){return new BPromise(function(_0x134de2,_0x50e76e){return client['request'](_0x137fb1,_0xf05893)[_0xe636('0xb')](function(_0x828f09){logger[_0xe636('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x24e92e,'request\x20sent');logger[_0xe636('0xd')](_0xe636('0xe'),_0x24e92e,_0xe636('0xf'),JSON['stringify'](_0x828f09));if(_0x828f09[_0xe636('0x10')]){if(_0x828f09[_0xe636('0x10')][_0xe636('0x11')]===0x1f4){logger[_0xe636('0x10')](_0xe636('0x12'),_0x24e92e,_0x828f09[_0xe636('0x10')][_0xe636('0x13')]);return _0x50e76e(_0x828f09[_0xe636('0x10')]['message']);}logger[_0xe636('0x10')](_0xe636('0x12'),_0x24e92e,_0x828f09[_0xe636('0x10')][_0xe636('0x13')]);return _0x134de2(_0x828f09[_0xe636('0x10')][_0xe636('0x13')]);}else{logger[_0xe636('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x24e92e,_0xe636('0xf'));_0x134de2(_0x828f09[_0xe636('0x14')]['message']);}})['catch'](function(_0x491169){logger[_0xe636('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x24e92e,_0x491169);_0x50e76e(_0x491169);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 7d9aa5d..a2adcd8 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 _0x692b=['update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','isAuthenticated','index','get','/:id','post','create','put'];(function(_0x3a8dc1,_0x2f03b8){var _0x4b3595=function(_0x1c19e7){while(--_0x1c19e7){_0x3a8dc1['push'](_0x3a8dc1['shift']());}};_0x4b3595(++_0x2f03b8);}(_0x692b,0xa5));var _0xb692=function(_0x562df6,_0x18b34f){_0x562df6=_0x562df6-0x0;var _0xdbbbcc=_0x692b[_0x562df6];return _0xdbbbcc;};'use strict';var multer=require(_0xb692('0x0'));var util=require(_0xb692('0x1'));var path=require(_0xb692('0x2'));var timeout=require(_0xb692('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb692('0x4'));var auth=require(_0xb692('0x5'));var interaction=require(_0xb692('0x6'));var config=require('../../config/environment');var controller=require(_0xb692('0x7'));router['get']('/',auth[_0xb692('0x8')](),controller[_0xb692('0x9')]);router[_0xb692('0xa')](_0xb692('0xb'),auth[_0xb692('0x8')](),controller['show']);router[_0xb692('0xc')]('/',auth[_0xb692('0x8')](),controller[_0xb692('0xd')]);router[_0xb692('0xe')](_0xb692('0xb'),auth[_0xb692('0x8')](),controller[_0xb692('0xf')]);router[_0xb692('0x10')](_0xb692('0xb'),auth[_0xb692('0x8')](),controller['destroy']);module[_0xb692('0x11')]=router; \ No newline at end of file +var _0x5436=['put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','create'];(function(_0x9d3fdd,_0x1ff22b){var _0x4b424e=function(_0x5b8f2f){while(--_0x5b8f2f){_0x9d3fdd['push'](_0x9d3fdd['shift']());}};_0x4b424e(++_0x1ff22b);}(_0x5436,0xb7));var _0x6543=function(_0x19e081,_0x5934bf){_0x19e081=_0x19e081-0x0;var _0x552861=_0x5436[_0x19e081];return _0x552861;};'use strict';var multer=require(_0x6543('0x0'));var util=require(_0x6543('0x1'));var path=require(_0x6543('0x2'));var timeout=require(_0x6543('0x3'));var express=require(_0x6543('0x4'));var router=express[_0x6543('0x5')]();var fs_extra=require(_0x6543('0x6'));var auth=require(_0x6543('0x7'));var interaction=require(_0x6543('0x8'));var config=require(_0x6543('0x9'));var controller=require(_0x6543('0xa'));router['get']('/',auth[_0x6543('0xb')](),controller[_0x6543('0xc')]);router[_0x6543('0xd')](_0x6543('0xe'),auth[_0x6543('0xb')](),controller[_0x6543('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6543('0x10')]);router[_0x6543('0x11')](_0x6543('0xe'),auth[_0x6543('0xb')](),controller['update']);router['delete'](_0x6543('0xe'),auth[_0x6543('0xb')](),controller[_0x6543('0x12')]);module[_0x6543('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 58b38f4..20038e1 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 _0xb2b2=['STRING','ENUM','customVariable','exports','string','picklist'];(function(_0x1abeb2,_0x79f462){var _0x48da20=function(_0x42a90b){while(--_0x42a90b){_0x1abeb2['push'](_0x1abeb2['shift']());}};_0x48da20(++_0x79f462);}(_0xb2b2,0x111));var _0x2b2b=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xb2b2[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require('sequelize');module[_0x2b2b('0x0')]={'type':{'type':Sequelize['ENUM'](_0x2b2b('0x1'),'variable','customVariable','keyValue',_0x2b2b('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2b2b('0x3')]},'key':{'type':Sequelize[_0x2b2b('0x3')]},'keyType':{'type':Sequelize[_0x2b2b('0x4')](_0x2b2b('0x1'),'variable',_0x2b2b('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2b2b('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2b2b('0x3')]}}; \ No newline at end of file +var _0x37fc=['picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x405464,_0x38e62e){var _0x1cec0b=function(_0x19f55a){while(--_0x19f55a){_0x405464['push'](_0x405464['shift']());}};_0x1cec0b(++_0x38e62e);}(_0x37fc,0x162));var _0xc37f=function(_0x151256,_0x17027e){_0x151256=_0x151256-0x0;var _0x5d29dc=_0x37fc[_0x151256];return _0x5d29dc;};'use strict';var Sequelize=require(_0xc37f('0x0'));module[_0xc37f('0x1')]={'type':{'type':Sequelize[_0xc37f('0x2')](_0xc37f('0x3'),'variable',_0xc37f('0x4'),_0xc37f('0x5'),_0xc37f('0x6')),'defaultValue':_0xc37f('0x3')},'content':{'type':Sequelize[_0xc37f('0x7')]},'key':{'type':Sequelize[_0xc37f('0x7')]},'keyType':{'type':Sequelize[_0xc37f('0x2')](_0xc37f('0x3'),_0xc37f('0x8'),_0xc37f('0x4'))},'keyContent':{'type':Sequelize[_0xc37f('0x7')]},'idField':{'type':Sequelize[_0xc37f('0x7')]},'nameField':{'type':Sequelize[_0xc37f('0x7')]},'customField':{'type':Sequelize[_0xc37f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc37f('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 8ee43fe..eaf2d2a 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 _0x370e=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','show','length','include','find','create','body','params','rimraf','zip-dir','request-promise','moment','bluebird','util','path'];(function(_0x296d9d,_0x4d286b){var _0x53f5d0=function(_0x2ebcf9){while(--_0x2ebcf9){_0x296d9d['push'](_0x296d9d['shift']());}};_0x53f5d0(++_0x4d286b);}(_0x370e,0x1b5));var _0xe370=function(_0x5ad9a6,_0x5f3978){_0x5ad9a6=_0x5ad9a6-0x0;var _0x296d45=_0x370e[_0x5ad9a6];return _0x296d45;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe370('0x0'));var zipdir=require(_0xe370('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe370('0x2'));var moment=require(_0xe370('0x3'));var BPromise=require(_0xe370('0x4'));var Mustache=require('mustache');var util=require(_0xe370('0x5'));var path=require(_0xe370('0x6'));var sox=require(_0xe370('0x7'));var csv=require(_0xe370('0x8'));var ejs=require(_0xe370('0x9'));var fs=require('fs');var fs_extra=require(_0xe370('0xa'));var _=require(_0xe370('0xb'));var squel=require(_0xe370('0xc'));var crypto=require('crypto');var jsforce=require(_0xe370('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe370('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe370('0xe'));var authService=require(_0xe370('0xf'));var qs=require(_0xe370('0x10'));var as=require(_0xe370('0x11'));var hardwareService=require(_0xe370('0x12'));var logger=require(_0xe370('0x13'))(_0xe370('0x14'));var utils=require('../../config/utils');var config=require(_0xe370('0x15'));var licenseUtil=require(_0xe370('0x16'));var db=require(_0xe370('0x17'))['db'];function respondWithStatusCode(_0x47ce29,_0x249fc1){_0x249fc1=_0x249fc1||0xcc;return function(_0x547e06){if(_0x547e06){return _0x47ce29['sendStatus'](_0x249fc1);}return _0x47ce29['status'](_0x249fc1)[_0xe370('0x18')]();};}function respondWithResult(_0x416b1c,_0x2d4012){_0x2d4012=_0x2d4012||0xc8;return function(_0x5bb5dd){if(_0x5bb5dd){return _0x416b1c['status'](_0x2d4012)[_0xe370('0x19')](_0x5bb5dd);}};}function respondWithFilteredResult(_0x101cba,_0x1b38d5){return function(_0x107076){if(_0x107076){var _0x3f1c78=typeof _0x1b38d5[_0xe370('0x1a')]===_0xe370('0x1b')&&typeof _0x1b38d5[_0xe370('0x1c')]===_0xe370('0x1b');var _0x56f56e=_0x107076['count'];var _0x42bc00=_0x3f1c78?0x0:_0x1b38d5['offset'];var _0x43845e=_0x3f1c78?_0x107076[_0xe370('0x1d')]:_0x1b38d5[_0xe370('0x1a')]+_0x1b38d5[_0xe370('0x1c')];var _0x2d857e;if(_0x43845e>=_0x56f56e){_0x43845e=_0x56f56e;_0x2d857e=0xc8;}else{_0x2d857e=0xce;}_0x101cba[_0xe370('0x1e')](_0x2d857e);return _0x101cba['set']('Content-Range',_0x42bc00+'-'+_0x43845e+'/'+_0x56f56e)[_0xe370('0x19')](_0x107076);}return null;};}function patchUpdates(_0x2a90f6){return function(_0x23ea36){try{jsonpatch['apply'](_0x23ea36,_0x2a90f6,!![]);}catch(_0x53ac31){return BPromise[_0xe370('0x1f')](_0x53ac31);}return _0x23ea36['save']();};}function saveUpdates(_0x5e8e8b,_0x7e1a1f){return function(_0xe1ec95){if(_0xe1ec95){return _0xe1ec95[_0xe370('0x20')](_0x5e8e8b)[_0xe370('0x21')](function(_0x13d6a9){return _0x13d6a9;});}return null;};}function removeEntity(_0x37beac,_0x3ea06e){return function(_0x3350c3){if(_0x3350c3){return _0x3350c3[_0xe370('0x22')]()[_0xe370('0x21')](function(){_0x37beac[_0xe370('0x1e')](0xcc)[_0xe370('0x18')]();});}};}function handleEntityNotFound(_0xf03396,_0x150cea){return function(_0xe97bee){if(!_0xe97bee){_0xf03396[_0xe370('0x23')](0x194);}return _0xe97bee;};}function handleError(_0x813260,_0x240a58){_0x240a58=_0x240a58||0x1f4;return function(_0x37d5b8){logger[_0xe370('0x24')](_0x37d5b8[_0xe370('0x25')]);if(_0x37d5b8['name']){delete _0x37d5b8[_0xe370('0x26')];}_0x813260[_0xe370('0x1e')](_0x240a58)[_0xe370('0x27')](_0x37d5b8);};}exports[_0xe370('0x28')]=function(_0x29a93d,_0x353038){var _0xd5113={},_0x210c98={},_0x548a25={'count':0x0,'rows':[]};var _0x7227ae=_[_0xe370('0x29')](db[_0xe370('0x2a')][_0xe370('0x2b')],function(_0x3d7182){return{'name':_0x3d7182[_0xe370('0x2c')],'type':_0x3d7182[_0xe370('0x2d')][_0xe370('0x2e')]};});_0x210c98[_0xe370('0x2f')]=_[_0xe370('0x29')](_0x7227ae,_0xe370('0x26'));_0x210c98[_0xe370('0x30')]=_[_0xe370('0x31')](_0x29a93d[_0xe370('0x30')]);_0x210c98[_0xe370('0x32')]=_[_0xe370('0x33')](_0x210c98[_0xe370('0x2f')],_0x210c98['query']);_0xd5113[_0xe370('0x34')]=_[_0xe370('0x33')](_0x210c98[_0xe370('0x2f')],qs[_0xe370('0x35')](_0x29a93d[_0xe370('0x30')][_0xe370('0x35')]));_0xd5113[_0xe370('0x34')]=_0xd5113[_0xe370('0x34')]['length']?_0xd5113[_0xe370('0x34')]:_0x210c98[_0xe370('0x2f')];if(!_0x29a93d[_0xe370('0x30')][_0xe370('0x36')](_0xe370('0x37'))){_0xd5113['limit']=qs[_0xe370('0x1c')](_0x29a93d[_0xe370('0x30')][_0xe370('0x1c')]);_0xd5113[_0xe370('0x1a')]=qs[_0xe370('0x1a')](_0x29a93d[_0xe370('0x30')][_0xe370('0x1a')]);}_0xd5113[_0xe370('0x38')]=qs[_0xe370('0x39')](_0x29a93d['query'][_0xe370('0x39')]);_0xd5113[_0xe370('0x3a')]=qs['filters'](_[_0xe370('0x3b')](_0x29a93d[_0xe370('0x30')],_0x210c98['filters']),_0x7227ae);if(_0x29a93d[_0xe370('0x30')][_0xe370('0x3c')]){_0xd5113[_0xe370('0x3a')]=_['merge'](_0xd5113[_0xe370('0x3a')],{'$or':_[_0xe370('0x29')](_0x7227ae,function(_0x3fd52c){if(_0x3fd52c['type']!==_0xe370('0x3d')){var _0x45c67e={};_0x45c67e[_0x3fd52c['name']]={'$like':'%'+_0x29a93d['query'][_0xe370('0x3c')]+'%'};return _0x45c67e;}})});}_0xd5113=_[_0xe370('0x3e')]({},_0xd5113,_0x29a93d[_0xe370('0x3f')]);var _0x403387={'where':_0xd5113['where']};return db[_0xe370('0x2a')][_0xe370('0x1d')](_0x403387)[_0xe370('0x21')](function(_0x4428df){_0x548a25[_0xe370('0x1d')]=_0x4428df;if(_0x29a93d[_0xe370('0x30')][_0xe370('0x40')]){_0xd5113['include']=[{'all':!![]}];}return db['VtigerField']['findAll'](_0xd5113);})['then'](function(_0x52da19){_0x548a25[_0xe370('0x41')]=_0x52da19;return _0x548a25;})[_0xe370('0x21')](respondWithFilteredResult(_0x353038,_0xd5113))[_0xe370('0x42')](handleError(_0x353038,null));};exports[_0xe370('0x43')]=function(_0x3f15d4,_0xb364ce){var _0x1c717b={'raw':!![],'where':{'id':_0x3f15d4['params']['id']}},_0x18e5b4={};_0x18e5b4['model']=_[_0xe370('0x31')](db[_0xe370('0x2a')]['rawAttributes']);_0x18e5b4[_0xe370('0x30')]=_[_0xe370('0x31')](_0x3f15d4['query']);_0x18e5b4[_0xe370('0x32')]=_[_0xe370('0x33')](_0x18e5b4[_0xe370('0x2f')],_0x18e5b4['query']);_0x1c717b['attributes']=_['intersection'](_0x18e5b4[_0xe370('0x2f')],qs[_0xe370('0x35')](_0x3f15d4[_0xe370('0x30')]['fields']));_0x1c717b[_0xe370('0x34')]=_0x1c717b[_0xe370('0x34')][_0xe370('0x44')]?_0x1c717b['attributes']:_0x18e5b4['model'];if(_0x3f15d4[_0xe370('0x30')][_0xe370('0x40')]){_0x1c717b[_0xe370('0x45')]=[{'all':!![]}];}_0x1c717b=_[_0xe370('0x3e')]({},_0x1c717b,_0x3f15d4['options']);return db[_0xe370('0x2a')][_0xe370('0x46')](_0x1c717b)[_0xe370('0x21')](handleEntityNotFound(_0xb364ce,null))['then'](respondWithResult(_0xb364ce,null))[_0xe370('0x42')](handleError(_0xb364ce,null));};exports[_0xe370('0x47')]=function(_0x3226d7,_0x49def8){return db['VtigerField']['create'](_0x3226d7[_0xe370('0x48')],{})[_0xe370('0x21')](respondWithResult(_0x49def8,0xc9))['catch'](handleError(_0x49def8,null));};exports[_0xe370('0x20')]=function(_0x24ad58,_0x5d71ff){if(_0x24ad58[_0xe370('0x48')]['id']){delete _0x24ad58[_0xe370('0x48')]['id'];}return db[_0xe370('0x2a')][_0xe370('0x46')]({'where':{'id':_0x24ad58[_0xe370('0x49')]['id']}})['then'](handleEntityNotFound(_0x5d71ff,null))[_0xe370('0x21')](saveUpdates(_0x24ad58[_0xe370('0x48')],null))[_0xe370('0x21')](respondWithResult(_0x5d71ff,null))[_0xe370('0x42')](handleError(_0x5d71ff,null));};exports[_0xe370('0x22')]=function(_0xa5f542,_0x2c6489){return db['VtigerField']['find']({'where':{'id':_0xa5f542[_0xe370('0x49')]['id']}})[_0xe370('0x21')](handleEntityNotFound(_0x2c6489,null))[_0xe370('0x21')](removeEntity(_0x2c6489,null))['catch'](handleError(_0x2c6489,null));}; \ No newline at end of file +var _0x652c=['save','update','then','destroy','error','name','map','rawAttributes','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','VtigerField','includeAll','findAll','catch','params','keys','intersection','include','find','create','body','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','offset','limit','undefined','count','set','reject'];(function(_0x44b1e7,_0x2d22dd){var _0x110a0e=function(_0x532820){while(--_0x532820){_0x44b1e7['push'](_0x44b1e7['shift']());}};_0x110a0e(++_0x2d22dd);}(_0x652c,0x6a));var _0xc652=function(_0x1e868d,_0x30aef8){_0x1e868d=_0x1e868d-0x0;var _0x39db88=_0x652c[_0x1e868d];return _0x39db88;};'use strict';var emlformat=require(_0xc652('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc652('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc652('0x2'));var moment=require('moment');var BPromise=require(_0xc652('0x3'));var Mustache=require(_0xc652('0x4'));var util=require(_0xc652('0x5'));var path=require(_0xc652('0x6'));var sox=require(_0xc652('0x7'));var csv=require(_0xc652('0x8'));var ejs=require(_0xc652('0x9'));var fs=require('fs');var fs_extra=require(_0xc652('0xa'));var _=require(_0xc652('0xb'));var squel=require(_0xc652('0xc'));var crypto=require(_0xc652('0xd'));var jsforce=require(_0xc652('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc652('0xf'));var Papa=require('papaparse');var Redis=require(_0xc652('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc652('0x11'));var as=require(_0xc652('0x12'));var hardwareService=require(_0xc652('0x13'));var logger=require(_0xc652('0x14'))(_0xc652('0x15'));var utils=require(_0xc652('0x16'));var config=require(_0xc652('0x17'));var licenseUtil=require(_0xc652('0x18'));var db=require(_0xc652('0x19'))['db'];function respondWithStatusCode(_0x2f1120,_0xbe9c5c){_0xbe9c5c=_0xbe9c5c||0xcc;return function(_0x3460c1){if(_0x3460c1){return _0x2f1120[_0xc652('0x1a')](_0xbe9c5c);}return _0x2f1120[_0xc652('0x1b')](_0xbe9c5c)[_0xc652('0x1c')]();};}function respondWithResult(_0x52e440,_0x543f3c){_0x543f3c=_0x543f3c||0xc8;return function(_0x2ede41){if(_0x2ede41){return _0x52e440['status'](_0x543f3c)[_0xc652('0x1d')](_0x2ede41);}};}function respondWithFilteredResult(_0x264e1d,_0x37c4b8){return function(_0x522e05){if(_0x522e05){var _0x3ac74c=typeof _0x37c4b8[_0xc652('0x1e')]==='undefined'&&typeof _0x37c4b8[_0xc652('0x1f')]===_0xc652('0x20');var _0x149856=_0x522e05[_0xc652('0x21')];var _0x3e1e3b=_0x3ac74c?0x0:_0x37c4b8['offset'];var _0x33b302=_0x3ac74c?_0x522e05[_0xc652('0x21')]:_0x37c4b8[_0xc652('0x1e')]+_0x37c4b8[_0xc652('0x1f')];var _0x1d37a6;if(_0x33b302>=_0x149856){_0x33b302=_0x149856;_0x1d37a6=0xc8;}else{_0x1d37a6=0xce;}_0x264e1d[_0xc652('0x1b')](_0x1d37a6);return _0x264e1d[_0xc652('0x22')]('Content-Range',_0x3e1e3b+'-'+_0x33b302+'/'+_0x149856)['json'](_0x522e05);}return null;};}function patchUpdates(_0x39799b){return function(_0x283d9b){try{jsonpatch['apply'](_0x283d9b,_0x39799b,!![]);}catch(_0x52778f){return BPromise[_0xc652('0x23')](_0x52778f);}return _0x283d9b[_0xc652('0x24')]();};}function saveUpdates(_0x511397,_0x2dce7b){return function(_0x3f60b4){if(_0x3f60b4){return _0x3f60b4[_0xc652('0x25')](_0x511397)[_0xc652('0x26')](function(_0x20b74a){return _0x20b74a;});}return null;};}function removeEntity(_0x205c71,_0x5a2814){return function(_0x46a14c){if(_0x46a14c){return _0x46a14c[_0xc652('0x27')]()['then'](function(){_0x205c71['status'](0xcc)[_0xc652('0x1c')]();});}};}function handleEntityNotFound(_0x47238f,_0x1750bb){return function(_0x2ebdff){if(!_0x2ebdff){_0x47238f[_0xc652('0x1a')](0x194);}return _0x2ebdff;};}function handleError(_0x59a0fc,_0xc27fa1){_0xc27fa1=_0xc27fa1||0x1f4;return function(_0x343f2c){logger[_0xc652('0x28')](_0x343f2c['stack']);if(_0x343f2c[_0xc652('0x29')]){delete _0x343f2c[_0xc652('0x29')];}_0x59a0fc['status'](_0xc27fa1)['send'](_0x343f2c);};}exports['index']=function(_0x3c2aee,_0x4c7125){var _0x1a3f39={},_0x41f47a={},_0x2d4ec9={'count':0x0,'rows':[]};var _0x3ab17d=_[_0xc652('0x2a')](db['VtigerField'][_0xc652('0x2b')],function(_0x38ef85){return{'name':_0x38ef85['fieldName'],'type':_0x38ef85[_0xc652('0x2c')][_0xc652('0x2d')]};});_0x41f47a['model']=_[_0xc652('0x2a')](_0x3ab17d,'name');_0x41f47a['query']=_['keys'](_0x3c2aee[_0xc652('0x2e')]);_0x41f47a[_0xc652('0x2f')]=_['intersection'](_0x41f47a[_0xc652('0x30')],_0x41f47a['query']);_0x1a3f39[_0xc652('0x31')]=_['intersection'](_0x41f47a[_0xc652('0x30')],qs[_0xc652('0x32')](_0x3c2aee[_0xc652('0x2e')][_0xc652('0x32')]));_0x1a3f39[_0xc652('0x31')]=_0x1a3f39[_0xc652('0x31')][_0xc652('0x33')]?_0x1a3f39[_0xc652('0x31')]:_0x41f47a[_0xc652('0x30')];if(!_0x3c2aee[_0xc652('0x2e')][_0xc652('0x34')](_0xc652('0x35'))){_0x1a3f39[_0xc652('0x1f')]=qs['limit'](_0x3c2aee[_0xc652('0x2e')]['limit']);_0x1a3f39['offset']=qs[_0xc652('0x1e')](_0x3c2aee['query'][_0xc652('0x1e')]);}_0x1a3f39[_0xc652('0x36')]=qs[_0xc652('0x37')](_0x3c2aee['query'][_0xc652('0x37')]);_0x1a3f39[_0xc652('0x38')]=qs[_0xc652('0x2f')](_['pick'](_0x3c2aee[_0xc652('0x2e')],_0x41f47a[_0xc652('0x2f')]),_0x3ab17d);if(_0x3c2aee[_0xc652('0x2e')]['filter']){_0x1a3f39[_0xc652('0x38')]=_['merge'](_0x1a3f39[_0xc652('0x38')],{'$or':_[_0xc652('0x2a')](_0x3ab17d,function(_0x24c21f){if(_0x24c21f['type']!==_0xc652('0x39')){var _0x2bedbd={};_0x2bedbd[_0x24c21f[_0xc652('0x29')]]={'$like':'%'+_0x3c2aee[_0xc652('0x2e')]['filter']+'%'};return _0x2bedbd;}})});}_0x1a3f39=_[_0xc652('0x3a')]({},_0x1a3f39,_0x3c2aee[_0xc652('0x3b')]);var _0x321dd2={'where':_0x1a3f39[_0xc652('0x38')]};return db[_0xc652('0x3c')]['count'](_0x321dd2)['then'](function(_0x19f70a){_0x2d4ec9['count']=_0x19f70a;if(_0x3c2aee[_0xc652('0x2e')][_0xc652('0x3d')]){_0x1a3f39['include']=[{'all':!![]}];}return db[_0xc652('0x3c')][_0xc652('0x3e')](_0x1a3f39);})['then'](function(_0x4acb08){_0x2d4ec9['rows']=_0x4acb08;return _0x2d4ec9;})[_0xc652('0x26')](respondWithFilteredResult(_0x4c7125,_0x1a3f39))[_0xc652('0x3f')](handleError(_0x4c7125,null));};exports['show']=function(_0x22da84,_0x2fbd95){var _0x20f279={'raw':!![],'where':{'id':_0x22da84[_0xc652('0x40')]['id']}},_0x30ce94={};_0x30ce94[_0xc652('0x30')]=_['keys'](db[_0xc652('0x3c')][_0xc652('0x2b')]);_0x30ce94['query']=_[_0xc652('0x41')](_0x22da84[_0xc652('0x2e')]);_0x30ce94[_0xc652('0x2f')]=_['intersection'](_0x30ce94[_0xc652('0x30')],_0x30ce94['query']);_0x20f279['attributes']=_[_0xc652('0x42')](_0x30ce94[_0xc652('0x30')],qs[_0xc652('0x32')](_0x22da84[_0xc652('0x2e')][_0xc652('0x32')]));_0x20f279[_0xc652('0x31')]=_0x20f279['attributes'][_0xc652('0x33')]?_0x20f279[_0xc652('0x31')]:_0x30ce94[_0xc652('0x30')];if(_0x22da84[_0xc652('0x2e')]['includeAll']){_0x20f279[_0xc652('0x43')]=[{'all':!![]}];}_0x20f279=_[_0xc652('0x3a')]({},_0x20f279,_0x22da84[_0xc652('0x3b')]);return db[_0xc652('0x3c')][_0xc652('0x44')](_0x20f279)[_0xc652('0x26')](handleEntityNotFound(_0x2fbd95,null))['then'](respondWithResult(_0x2fbd95,null))[_0xc652('0x3f')](handleError(_0x2fbd95,null));};exports[_0xc652('0x45')]=function(_0x58d91a,_0x3dc60b){return db[_0xc652('0x3c')][_0xc652('0x45')](_0x58d91a['body'],{})[_0xc652('0x26')](respondWithResult(_0x3dc60b,0xc9))['catch'](handleError(_0x3dc60b,null));};exports[_0xc652('0x25')]=function(_0x539098,_0x24d1c8){if(_0x539098['body']['id']){delete _0x539098[_0xc652('0x46')]['id'];}return db['VtigerField'][_0xc652('0x44')]({'where':{'id':_0x539098[_0xc652('0x40')]['id']}})[_0xc652('0x26')](handleEntityNotFound(_0x24d1c8,null))[_0xc652('0x26')](saveUpdates(_0x539098[_0xc652('0x46')],null))['then'](respondWithResult(_0x24d1c8,null))[_0xc652('0x3f')](handleError(_0x24d1c8,null));};exports[_0xc652('0x27')]=function(_0x9ffa88,_0x43f21c){return db[_0xc652('0x3c')][_0xc652('0x44')]({'where':{'id':_0x9ffa88[_0xc652('0x40')]['id']}})[_0xc652('0x26')](handleEntityNotFound(_0x43f21c,null))['then'](removeEntity(_0x43f21c,null))[_0xc652('0x3f')](handleError(_0x43f21c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 5b7fa8d..c6460e5 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 _0xdbc5=['request-promise','../../config/environment','define','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0xdbc5,0x132));var _0x5dbc=function(_0x1aeaad,_0x3749bb){_0x1aeaad=_0x1aeaad-0x0;var _0x368c7b=_0xdbc5[_0x1aeaad];return _0x368c7b;};'use strict';var _=require(_0x5dbc('0x0'));var util=require(_0x5dbc('0x1'));var logger=require(_0x5dbc('0x2'))(_0x5dbc('0x3'));var moment=require(_0x5dbc('0x4'));var BPromise=require(_0x5dbc('0x5'));var rp=require(_0x5dbc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5dbc('0x7'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x5697fa,_0x39fb28){return _0x5697fa[_0x5dbc('0x8')]('VtigerField',attributes,{'tableName':_0x5dbc('0x9'),'paranoid':![],'indexes':[{'name':_0x5dbc('0xa'),'fields':[_0x5dbc('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xebaf=['../../config/environment','define','int_vtiger_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x9d8631,_0x457907){var _0x562999=function(_0x2c85da){while(--_0x2c85da){_0x9d8631['push'](_0x9d8631['shift']());}};_0x562999(++_0x457907);}(_0xebaf,0x119));var _0xfeba=function(_0x5cf67b,_0x1fac69){_0x5cf67b=_0x5cf67b-0x0;var _0x3a429a=_0xebaf[_0x5cf67b];return _0x3a429a;};'use strict';var _=require(_0xfeba('0x0'));var util=require(_0xfeba('0x1'));var logger=require(_0xfeba('0x2'))('api');var moment=require(_0xfeba('0x3'));var BPromise=require(_0xfeba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfeba('0x5'));var rimraf=require(_0xfeba('0x6'));var config=require(_0xfeba('0x7'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x160556,_0x3469d5){return _0x160556[_0xfeba('0x8')]('VtigerField',attributes,{'tableName':_0xfeba('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xfeba('0xa'),_0xfeba('0xb')],'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 dcdbf60..f47b0f7 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 _0x4a93=['request','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http'];(function(_0x569bf4,_0x29b463){var _0xec1366=function(_0x252a5b){while(--_0x252a5b){_0x569bf4['push'](_0x569bf4['shift']());}};_0xec1366(++_0x29b463);}(_0x4a93,0x15b));var _0x34a9=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x4a93[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x34a9('0x0'));var util=require(_0x34a9('0x1'));var moment=require(_0x34a9('0x2'));var BPromise=require(_0x34a9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34a9('0x4'));var db=require(_0x34a9('0x5'))['db'];var utils=require(_0x34a9('0x6'));var logger=require(_0x34a9('0x7'))('rpc');var config=require(_0x34a9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x34a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d31cb,_0x3a5fd5,_0x12e41f){return new BPromise(function(_0x1cb1d1,_0x5e71a9){return client[_0x34a9('0xa')](_0x2d31cb,_0x12e41f)['then'](function(_0x480afd){logger['info']('VtigerField,\x20%s,\x20%s',_0x3a5fd5,'request\x20sent');logger[_0x34a9('0xb')](_0x34a9('0xc'),_0x3a5fd5,'request\x20sent',JSON[_0x34a9('0xd')](_0x480afd));if(_0x480afd['error']){if(_0x480afd[_0x34a9('0xe')][_0x34a9('0xf')]===0x1f4){logger[_0x34a9('0xe')](_0x34a9('0x10'),_0x3a5fd5,_0x480afd[_0x34a9('0xe')][_0x34a9('0x11')]);return _0x5e71a9(_0x480afd['error']['message']);}logger['error'](_0x34a9('0x10'),_0x3a5fd5,_0x480afd[_0x34a9('0xe')][_0x34a9('0x11')]);return _0x1cb1d1(_0x480afd[_0x34a9('0xe')][_0x34a9('0x11')]);}else{logger['info'](_0x34a9('0x10'),_0x3a5fd5,_0x34a9('0x12'));_0x1cb1d1(_0x480afd[_0x34a9('0x13')][_0x34a9('0x11')]);}})[_0x34a9('0x14')](function(_0x2c64a6){logger[_0x34a9('0xe')](_0x34a9('0x10'),_0x3a5fd5,_0x2c64a6);_0x5e71a9(_0x2c64a6);});});} \ No newline at end of file +var _0xe599=['util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x147cca,_0x4c900c){var _0x4fe2c4=function(_0x474855){while(--_0x474855){_0x147cca['push'](_0x147cca['shift']());}};_0x4fe2c4(++_0x4c900c);}(_0xe599,0x7d));var _0x9e59=function(_0x4f7d6d,_0x44d326){_0x4f7d6d=_0x4f7d6d-0x0;var _0xbf0dc9=_0xe599[_0x4f7d6d];return _0xbf0dc9;};'use strict';var _=require(_0x9e59('0x0'));var util=require(_0x9e59('0x1'));var moment=require(_0x9e59('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e59('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9e59('0x4'));var logger=require(_0x9e59('0x5'))(_0x9e59('0x6'));var config=require('../../config/environment');var jayson=require(_0x9e59('0x7'));var client=jayson['client'][_0x9e59('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33bd6d,_0x2b0cea,_0xb35a11){return new BPromise(function(_0x5a6f1b,_0x2f3230){return client[_0x9e59('0x9')](_0x33bd6d,_0xb35a11)[_0x9e59('0xa')](function(_0xfd7d9){logger[_0x9e59('0xb')](_0x9e59('0xc'),_0x2b0cea,_0x9e59('0xd'));logger[_0x9e59('0xe')](_0x9e59('0xf'),_0x2b0cea,_0x9e59('0xd'),JSON['stringify'](_0xfd7d9));if(_0xfd7d9[_0x9e59('0x10')]){if(_0xfd7d9[_0x9e59('0x10')][_0x9e59('0x11')]===0x1f4){logger[_0x9e59('0x10')](_0x9e59('0xc'),_0x2b0cea,_0xfd7d9[_0x9e59('0x10')][_0x9e59('0x12')]);return _0x2f3230(_0xfd7d9['error'][_0x9e59('0x12')]);}logger[_0x9e59('0x10')]('VtigerField,\x20%s,\x20%s',_0x2b0cea,_0xfd7d9[_0x9e59('0x10')]['message']);return _0x5a6f1b(_0xfd7d9[_0x9e59('0x10')][_0x9e59('0x12')]);}else{logger[_0x9e59('0xb')](_0x9e59('0xc'),_0x2b0cea,_0x9e59('0xd'));_0x5a6f1b(_0xfd7d9[_0x9e59('0x13')]['message']);}})[_0x9e59('0x14')](function(_0x289ba8){logger[_0x9e59('0x10')]('VtigerField,\x20%s,\x20%s',_0x2b0cea,_0x289ba8);_0x2f3230(_0x289ba8);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 3e0af61..384c1ca 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 _0x7c35=['show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','exports','multer','path','connect-timeout','express','../../components/interaction/service','isAuthenticated','index','get','/:id'];(function(_0x5a7d42,_0x6dab51){var _0x32e47b=function(_0x159aa5){while(--_0x159aa5){_0x5a7d42['push'](_0x5a7d42['shift']());}};_0x32e47b(++_0x6dab51);}(_0x7c35,0x13a));var _0x57c3=function(_0x283495,_0x3f59ac){_0x283495=_0x283495-0x0;var _0xb131fb=_0x7c35[_0x283495];return _0xb131fb;};'use strict';var multer=require(_0x57c3('0x0'));var util=require('util');var path=require(_0x57c3('0x1'));var timeout=require(_0x57c3('0x2'));var express=require(_0x57c3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x57c3('0x4'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x57c3('0x5')](),controller[_0x57c3('0x6')]);router[_0x57c3('0x7')](_0x57c3('0x8'),auth[_0x57c3('0x5')](),controller[_0x57c3('0x9')]);router[_0x57c3('0x7')](_0x57c3('0xa'),auth['isAuthenticated'](),controller[_0x57c3('0xb')]);router['get'](_0x57c3('0xc'),auth[_0x57c3('0x5')](),controller['getFields']);router[_0x57c3('0xd')]('/',auth[_0x57c3('0x5')](),controller['create']);router[_0x57c3('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x57c3('0xe')]);router[_0x57c3('0xf')](_0x57c3('0x8'),auth['isAuthenticated'](),controller[_0x57c3('0x10')]);router[_0x57c3('0x11')](_0x57c3('0x8'),auth[_0x57c3('0x5')](),controller['destroy']);module[_0x57c3('0x12')]=router; \ No newline at end of file +var _0xbd4a=['../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','index','get','/:id','isAuthenticated','getConfigurations','/:id/fields','post','create','/:id/configurations','update','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x433c11,_0x509a13){var _0x1bbb06=function(_0x54697b){while(--_0x54697b){_0x433c11['push'](_0x433c11['shift']());}};_0x1bbb06(++_0x509a13);}(_0xbd4a,0xeb));var _0xabd4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xbd4a[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xabd4('0x0'));var util=require(_0xabd4('0x1'));var path=require(_0xabd4('0x2'));var timeout=require(_0xabd4('0x3'));var express=require('express');var router=express[_0xabd4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xabd4('0x5'));var config=require(_0xabd4('0x6'));var controller=require(_0xabd4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xabd4('0x8')]);router[_0xabd4('0x9')](_0xabd4('0xa'),auth[_0xabd4('0xb')](),controller['show']);router[_0xabd4('0x9')]('/:id/configurations',auth[_0xabd4('0xb')](),controller[_0xabd4('0xc')]);router['get'](_0xabd4('0xd'),auth[_0xabd4('0xb')](),controller['getFields']);router[_0xabd4('0xe')]('/',auth[_0xabd4('0xb')](),controller[_0xabd4('0xf')]);router['post'](_0xabd4('0x10'),auth[_0xabd4('0xb')](),controller['addConfiguration']);router['put'](_0xabd4('0xa'),auth['isAuthenticated'](),controller[_0xabd4('0x11')]);router[_0xabd4('0x12')](_0xabd4('0xa'),auth[_0xabd4('0xb')](),controller['destroy']);module[_0xabd4('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 7bdfd6e..647ef0f 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 _0xce22=['sequelize','exports','STRING','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0xf8ec86,_0xa55749){var _0x4584db=function(_0x1f1c2f){while(--_0x1f1c2f){_0xf8ec86['push'](_0xf8ec86['shift']());}};_0x4584db(++_0xa55749);}(_0xce22,0xea));var _0x2ce2=function(_0x3a1de8,_0x492290){_0x3a1de8=_0x3a1de8-0x0;var _0x3e4975=_0xce22[_0x3a1de8];return _0x3e4975;};'use strict';var Sequelize=require(_0x2ce2('0x0'));module[_0x2ce2('0x1')]={'name':{'type':Sequelize[_0x2ce2('0x2')]},'description':{'type':Sequelize[_0x2ce2('0x2')]},'username':{'type':Sequelize[_0x2ce2('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x2ce2('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2ce2('0x2')],'unique':_0x2ce2('0x3')},'authType':{'type':Sequelize[_0x2ce2('0x4')](_0x2ce2('0x5'),_0x2ce2('0x6')),'defaultValue':_0x2ce2('0x5')},'serverUrl':{'type':Sequelize[_0x2ce2('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x2ce2('0x7'),_0x2ce2('0x8')),'defaultValue':_0x2ce2('0x7')}}; \ No newline at end of file +var _0xbedb=['integrationTab','sequelize','STRING','remoteUri','ENUM','password','token'];(function(_0x1de43c,_0xaa29de){var _0x296d3e=function(_0x50b76f){while(--_0x50b76f){_0x1de43c['push'](_0x1de43c['shift']());}};_0x296d3e(++_0xaa29de);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xbbed('0x0'));module['exports']={'name':{'type':Sequelize[_0xbbed('0x1')]},'description':{'type':Sequelize[_0xbbed('0x1')]},'username':{'type':Sequelize[_0xbbed('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xbbed('0x1')]},'remoteUri':{'type':Sequelize[_0xbbed('0x1')],'unique':_0xbbed('0x2')},'authType':{'type':Sequelize[_0xbbed('0x3')](_0xbbed('0x4'),_0xbbed('0x5')),'defaultValue':_0xbbed('0x4')},'serverUrl':{'type':Sequelize[_0xbbed('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbbed('0x3')](_0xbbed('0x6'),'newTab'),'defaultValue':_0xbbed('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 0d70d62..0842203 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.controller.js +++ b/server/api/intZendeskAccount/intZendeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02ce=['sendStatus','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','include','findAll','rows','catch','show','params','length','merge','find','create','body','ZendeskConfiguration','getConfigurations','addConfiguration','findOne','channel','getDescriptions','Subjects','ZendeskField','Descriptions','username','password','authType','remoteUri','GET','format','%s/%s','ticket_fields','headers','toString','base64','%s/token:%s','token','Sequelize','ValidationError','subject','description','group','assignee','remove','title','position','system_field_options','custom_field_options','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','limit','undefined','count','set','reject','update','then','destroy'];(function(_0x1ed937,_0xe8a9c4){var _0x34c453=function(_0x30a68e){while(--_0x30a68e){_0x1ed937['push'](_0x1ed937['shift']());}};_0x34c453(++_0xe8a9c4);}(_0x02ce,0x1ac));var _0xe02c=function(_0x4d8c70,_0x5a3a02){_0x4d8c70=_0x4d8c70-0x0;var _0x5bff02=_0x02ce[_0x4d8c70];return _0x5bff02;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];var integrations=require(_0xe02c('0x1c'));function respondWithStatusCode(_0x32fc45,_0x5d6d13){_0x5d6d13=_0x5d6d13||0xcc;return function(_0x43079c){if(_0x43079c){return _0x32fc45['sendStatus'](_0x5d6d13);}return _0x32fc45['status'](_0x5d6d13)[_0xe02c('0x1d')]();};}function respondWithResult(_0x56405a,_0x221910){_0x221910=_0x221910||0xc8;return function(_0x59614c){if(_0x59614c){return _0x56405a[_0xe02c('0x1e')](_0x221910)['json'](_0x59614c);}};}function respondWithFilteredResult(_0x256311,_0x366893){return function(_0x59f2f6){if(_0x59f2f6){var _0x10a2a6=typeof _0x366893[_0xe02c('0x1f')]==='undefined'&&typeof _0x366893[_0xe02c('0x20')]===_0xe02c('0x21');var _0x5a4583=_0x59f2f6['count'];var _0x3e37bf=_0x10a2a6?0x0:_0x366893['offset'];var _0x1f8f37=_0x10a2a6?_0x59f2f6[_0xe02c('0x22')]:_0x366893[_0xe02c('0x1f')]+_0x366893[_0xe02c('0x20')];var _0x3898dc;if(_0x1f8f37>=_0x5a4583){_0x1f8f37=_0x5a4583;_0x3898dc=0xc8;}else{_0x3898dc=0xce;}_0x256311['status'](_0x3898dc);return _0x256311[_0xe02c('0x23')]('Content-Range',_0x3e37bf+'-'+_0x1f8f37+'/'+_0x5a4583)['json'](_0x59f2f6);}return null;};}function patchUpdates(_0x393621){return function(_0x4514ac){try{jsonpatch['apply'](_0x4514ac,_0x393621,!![]);}catch(_0x3fe8f7){return BPromise[_0xe02c('0x24')](_0x3fe8f7);}return _0x4514ac['save']();};}function saveUpdates(_0x38dce2,_0x45fd82){return function(_0x39b00c){if(_0x39b00c){return _0x39b00c[_0xe02c('0x25')](_0x38dce2)[_0xe02c('0x26')](function(_0x557142){return _0x557142;});}return null;};}function removeEntity(_0x3e80e3,_0xf41d4c){return function(_0xeae877){if(_0xeae877){return _0xeae877[_0xe02c('0x27')]()[_0xe02c('0x26')](function(){_0x3e80e3['status'](0xcc)[_0xe02c('0x1d')]();});}};}function handleEntityNotFound(_0x4411d8,_0x3592ca){return function(_0x14ffba){if(!_0x14ffba){_0x4411d8[_0xe02c('0x28')](0x194);}return _0x14ffba;};}function handleError(_0x303d24,_0x43dc78){_0x43dc78=_0x43dc78||0x1f4;return function(_0x1c14d6){logger['error'](_0x1c14d6[_0xe02c('0x29')]);if(_0x1c14d6[_0xe02c('0x2a')]){delete _0x1c14d6[_0xe02c('0x2a')];}_0x303d24['status'](_0x43dc78)[_0xe02c('0x2b')](_0x1c14d6);};}exports[_0xe02c('0x2c')]=function(_0x445421,_0x287f7e){var _0x1e7eab={},_0x35a309={},_0x22a285={'count':0x0,'rows':[]};var _0x1b8f21=_[_0xe02c('0x2d')](db[_0xe02c('0x2e')][_0xe02c('0x2f')],function(_0x5a2da0){return{'name':_0x5a2da0[_0xe02c('0x30')],'type':_0x5a2da0[_0xe02c('0x31')][_0xe02c('0x32')]};});_0x35a309[_0xe02c('0x33')]=_[_0xe02c('0x2d')](_0x1b8f21,_0xe02c('0x2a'));_0x35a309['query']=_[_0xe02c('0x34')](_0x445421[_0xe02c('0x35')]);_0x35a309['filters']=_[_0xe02c('0x36')](_0x35a309[_0xe02c('0x33')],_0x35a309[_0xe02c('0x35')]);_0x1e7eab[_0xe02c('0x37')]=_[_0xe02c('0x36')](_0x35a309['model'],qs['fields'](_0x445421[_0xe02c('0x35')][_0xe02c('0x38')]));_0x1e7eab['attributes']=_0x1e7eab[_0xe02c('0x37')]['length']?_0x1e7eab[_0xe02c('0x37')]:_0x35a309[_0xe02c('0x33')];if(!_0x445421[_0xe02c('0x35')][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x1e7eab['limit']=qs[_0xe02c('0x20')](_0x445421['query'][_0xe02c('0x20')]);_0x1e7eab[_0xe02c('0x1f')]=qs[_0xe02c('0x1f')](_0x445421[_0xe02c('0x35')][_0xe02c('0x1f')]);}_0x1e7eab[_0xe02c('0x3b')]=qs['sort'](_0x445421[_0xe02c('0x35')][_0xe02c('0x3c')]);_0x1e7eab['where']=qs[_0xe02c('0x3d')](_[_0xe02c('0x3e')](_0x445421['query'],_0x35a309[_0xe02c('0x3d')]),_0x1b8f21);if(_0x445421['query'][_0xe02c('0x3f')]){_0x1e7eab[_0xe02c('0x40')]=_['merge'](_0x1e7eab[_0xe02c('0x40')],{'$or':_[_0xe02c('0x2d')](_0x1b8f21,function(_0x2502c8){if(_0x2502c8[_0xe02c('0x31')]!==_0xe02c('0x41')){var _0x28922a={};_0x28922a[_0x2502c8['name']]={'$like':'%'+_0x445421[_0xe02c('0x35')]['filter']+'%'};return _0x28922a;}})});}_0x1e7eab=_['merge']({},_0x1e7eab,_0x445421[_0xe02c('0x42')]);var _0x1095fb={'where':_0x1e7eab[_0xe02c('0x40')]};return db[_0xe02c('0x2e')]['count'](_0x1095fb)[_0xe02c('0x26')](function(_0x17830e){_0x22a285[_0xe02c('0x22')]=_0x17830e;if(_0x445421['query']['includeAll']){_0x1e7eab[_0xe02c('0x43')]=[{'all':!![]}];}return db[_0xe02c('0x2e')][_0xe02c('0x44')](_0x1e7eab);})[_0xe02c('0x26')](function(_0x1b0876){_0x22a285[_0xe02c('0x45')]=_0x1b0876;return _0x22a285;})[_0xe02c('0x26')](respondWithFilteredResult(_0x287f7e,_0x1e7eab))[_0xe02c('0x46')](handleError(_0x287f7e,null));};exports[_0xe02c('0x47')]=function(_0x53d123,_0xc7e935){var _0x5ef4a1={'raw':![],'where':{'id':_0x53d123[_0xe02c('0x48')]['id']}},_0x4d4be5={};_0x4d4be5[_0xe02c('0x33')]=_[_0xe02c('0x34')](db[_0xe02c('0x2e')][_0xe02c('0x2f')]);_0x4d4be5[_0xe02c('0x35')]=_[_0xe02c('0x34')](_0x53d123[_0xe02c('0x35')]);_0x4d4be5['filters']=_['intersection'](_0x4d4be5[_0xe02c('0x33')],_0x4d4be5[_0xe02c('0x35')]);_0x5ef4a1[_0xe02c('0x37')]=_['intersection'](_0x4d4be5[_0xe02c('0x33')],qs[_0xe02c('0x38')](_0x53d123[_0xe02c('0x35')][_0xe02c('0x38')]));_0x5ef4a1[_0xe02c('0x37')]=_0x5ef4a1[_0xe02c('0x37')][_0xe02c('0x49')]?_0x5ef4a1[_0xe02c('0x37')]:_0x4d4be5[_0xe02c('0x33')];if(_0x53d123[_0xe02c('0x35')]['includeAll']){_0x5ef4a1[_0xe02c('0x43')]=[{'all':!![]}];}_0x5ef4a1=_[_0xe02c('0x4a')]({},_0x5ef4a1,_0x53d123[_0xe02c('0x42')]);return db[_0xe02c('0x2e')][_0xe02c('0x4b')](_0x5ef4a1)[_0xe02c('0x26')](handleEntityNotFound(_0xc7e935,null))[_0xe02c('0x26')](respondWithResult(_0xc7e935,null))[_0xe02c('0x46')](handleError(_0xc7e935,null));};exports[_0xe02c('0x4c')]=function(_0x1176c9,_0xfed475){return db[_0xe02c('0x2e')][_0xe02c('0x4c')](_0x1176c9['body'],{})[_0xe02c('0x26')](respondWithResult(_0xfed475,0xc9))['catch'](handleError(_0xfed475,null));};exports[_0xe02c('0x25')]=function(_0x324911,_0x45a6df){if(_0x324911[_0xe02c('0x4d')]['id']){delete _0x324911[_0xe02c('0x4d')]['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x4b')]({'where':{'id':_0x324911[_0xe02c('0x48')]['id']}})[_0xe02c('0x26')](handleEntityNotFound(_0x45a6df,null))[_0xe02c('0x26')](saveUpdates(_0x324911['body'],null))[_0xe02c('0x26')](respondWithResult(_0x45a6df,null))[_0xe02c('0x46')](handleError(_0x45a6df,null));};exports[_0xe02c('0x27')]=function(_0x536cf7,_0xdab6cb){return db['ZendeskAccount'][_0xe02c('0x4b')]({'where':{'id':_0x536cf7['params']['id']}})['then'](handleEntityNotFound(_0xdab6cb,null))['then'](removeEntity(_0xdab6cb,null))['catch'](handleError(_0xdab6cb,null));};exports['getConfigurations']=function(_0x5740df,_0x107f3f,_0x3ac0a5){var _0x1510aa={};var _0x35fbe2={};var _0x5d963d;var _0x274beb;return db[_0xe02c('0x2e')]['findOne']({'where':{'id':_0x5740df[_0xe02c('0x48')]['id']}})[_0xe02c('0x26')](handleEntityNotFound(_0x107f3f,null))[_0xe02c('0x26')](function(_0x51f940){if(_0x51f940){_0x5d963d=_0x51f940;_0x35fbe2['model']=_[_0xe02c('0x34')](db[_0xe02c('0x4e')][_0xe02c('0x2f')]);_0x35fbe2['query']=_[_0xe02c('0x34')](_0x5740df['query']);_0x35fbe2['filters']=_[_0xe02c('0x36')](_0x35fbe2[_0xe02c('0x33')],_0x35fbe2['query']);_0x1510aa[_0xe02c('0x37')]=_[_0xe02c('0x36')](_0x35fbe2[_0xe02c('0x33')],qs['fields'](_0x5740df[_0xe02c('0x35')][_0xe02c('0x38')]));_0x1510aa['attributes']=_0x1510aa[_0xe02c('0x37')][_0xe02c('0x49')]?_0x1510aa[_0xe02c('0x37')]:_0x35fbe2[_0xe02c('0x33')];_0x1510aa[_0xe02c('0x3b')]=qs[_0xe02c('0x3c')](_0x5740df[_0xe02c('0x35')][_0xe02c('0x3c')]);_0x1510aa[_0xe02c('0x40')]=qs['filters'](_['pick'](_0x5740df['query'],_0x35fbe2[_0xe02c('0x3d')]));if(_0x5740df[_0xe02c('0x35')][_0xe02c('0x3f')]){_0x1510aa['where']=_['merge'](_0x1510aa[_0xe02c('0x40')],{'$or':_[_0xe02c('0x2d')](_0x1510aa[_0xe02c('0x37')],function(_0xb50cfa){var _0xe02798={};_0xe02798[_0xb50cfa]={'$like':'%'+_0x5740df['query'][_0xe02c('0x3f')]+'%'};return _0xe02798;})});}_0x1510aa=_[_0xe02c('0x4a')]({},_0x1510aa,_0x5740df['options']);return _0x5d963d['getConfigurations'](_0x1510aa);}})[_0xe02c('0x26')](function(_0x566204){if(_0x566204){_0x274beb=_0x566204['length'];if(!_0x5740df['query'][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x1510aa[_0xe02c('0x20')]=qs[_0xe02c('0x20')](_0x5740df[_0xe02c('0x35')][_0xe02c('0x20')]);_0x1510aa['offset']=qs[_0xe02c('0x1f')](_0x5740df['query']['offset']);}return _0x5d963d[_0xe02c('0x4f')](_0x1510aa);}})[_0xe02c('0x26')](function(_0x44ba68){if(_0x44ba68){return _0x44ba68?{'count':_0x274beb,'rows':_0x44ba68}:null;}})[_0xe02c('0x26')](respondWithResult(_0x107f3f,null))['catch'](handleError(_0x107f3f,null));};exports[_0xe02c('0x50')]=function(_0x31c287,_0x5d2119,_0xa7133f){if(_0x31c287[_0xe02c('0x4d')]['id']){delete _0x31c287['body']['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x51')]({'where':{'id':_0x31c287[_0xe02c('0x48')]['id']}})[_0xe02c('0x26')](handleEntityNotFound(_0x5d2119,null))[_0xe02c('0x26')](function(_0x3a62a2){if(_0x3a62a2){_0x31c287[_0xe02c('0x4d')]['AccountId']=_0x3a62a2['id'];_0x31c287[_0xe02c('0x4d')]['Subjects']=integrations['getSubjects'](_0x31c287['body'][_0xe02c('0x52')],_0x31c287[_0xe02c('0x4d')][_0xe02c('0x31')]);_0x31c287[_0xe02c('0x4d')]['Descriptions']=integrations[_0xe02c('0x53')](_0x31c287[_0xe02c('0x4d')]['channel'],_0x31c287['body']['type']);return db[_0xe02c('0x4e')][_0xe02c('0x4c')](_0x31c287['body'],{'include':[{'model':db['ZendeskField'],'as':_0xe02c('0x54')},{'model':db[_0xe02c('0x55')],'as':_0xe02c('0x56')}]});}return null;})[_0xe02c('0x26')](respondWithResult(_0x5d2119,null))[_0xe02c('0x46')](handleError(_0x5d2119,null));};exports['getFields']=function(_0x39c7db,_0x12ac9f,_0x3f277b){var _0x2776c0='';return db[_0xe02c('0x2e')][_0xe02c('0x51')]({'where':{'id':_0x39c7db['params']['id']},'attributes':['id',_0xe02c('0x57'),_0xe02c('0x58'),'token',_0xe02c('0x59'),_0xe02c('0x5a')]})[_0xe02c('0x26')](handleEntityNotFound(_0x12ac9f,null))[_0xe02c('0x26')](function(_0x5d2455){if(_0x5d2455){_0x2776c0=_0x5d2455[_0xe02c('0x5a')];var _0x2229ae=_0x2776c0['slice'](-0x1);if(_0x2229ae==='/'){_0x2776c0=_0x2776c0['substring'](0x0,_0x2776c0['lastIndexOf'](_0x2229ae));}var _0x43977c={'method':_0xe02c('0x5b'),'uri':util[_0xe02c('0x5c')](_0xe02c('0x5d'),_0x2776c0,_0xe02c('0x5e')),'json':!![]};switch(_0x5d2455['authType']){case _0xe02c('0x58'):_0x43977c[_0xe02c('0x5f')]={'Authorization':util[_0xe02c('0x5c')]('Basic\x20%s',new Buffer(util['format']('%s:%s',_0x5d2455[_0xe02c('0x57')],_0x5d2455[_0xe02c('0x58')]))[_0xe02c('0x60')](_0xe02c('0x61')))};break;case'token':_0x43977c[_0xe02c('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xe02c('0x5c')](_0xe02c('0x62'),_0x5d2455[_0xe02c('0x57')],_0x5d2455[_0xe02c('0x63')]))[_0xe02c('0x60')](_0xe02c('0x61')))};break;default:throw new db[(_0xe02c('0x64'))][(_0xe02c('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x43977c);}})[_0xe02c('0x26')](function(_0x21049f){if(_0x21049f){var _0x2386cf=[_0xe02c('0x66'),_0xe02c('0x67'),_0xe02c('0x68'),_0xe02c('0x69')];_[_0xe02c('0x6a')](_0x21049f[_0xe02c('0x5e')],function(_0x411cd5){return _0x2386cf['includes'](_0x411cd5['type']);});return{'count':_0x21049f[_0xe02c('0x5e')][_0xe02c('0x49')],'rows':_[_0xe02c('0x2d')](_0x21049f[_0xe02c('0x5e')],function(_0x108566){return{'id':_0x108566['id'],'name':_0x108566['position']>0x7?_0x108566[_0xe02c('0x6b')]:_0x108566[_0xe02c('0x31')],'custom':_0x108566[_0xe02c('0x6c')]>0x7?!![]:![],'options':_0x108566[_0xe02c('0x6d')]?_0x108566[_0xe02c('0x6d')]:_0x108566[_0xe02c('0x6e')]?_0x108566[_0xe02c('0x6e')]:[]};})};}})[_0xe02c('0x26')](respondWithResult(_0x12ac9f,null))[_0xe02c('0x46')](function(_0x159f58){var _0x287eca=_0x39c7db[_0xe02c('0x35')]['test']?0x1f4:_0x159f58['statusCode']||0x1f4;logger[_0xe02c('0x6f')](_0xe02c('0x70'),'getFields',_0x287eca,JSON[_0xe02c('0x71')](_0x159f58));delete _0x159f58['name'];if(_0x287eca===0x191){_0x287eca=0x190;}_0x12ac9f[_0xe02c('0x1e')](_0x287eca)['send'](_0x39c7db[_0xe02c('0x35')][_0xe02c('0x72')]?{'message':_0xe02c('0x73'),'statusCode':_0x159f58[_0xe02c('0x74')]}:_0x159f58);});}; \ No newline at end of file +var _0x96cc=['includes','position','title','system_field_options','custom_field_options','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','ZendeskAccount','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','options','find','create','body','ZendeskConfiguration','pick','getConfigurations','findOne','AccountId','Subjects','Descriptions','channel','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','%s:%s','base64','Basic\x20%s','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','group','assignee'];(function(_0x43d2b3,_0x3d22b1){var _0x5babaa=function(_0x4af92c){while(--_0x4af92c){_0x43d2b3['push'](_0x43d2b3['shift']());}};_0x5babaa(++_0x3d22b1);}(_0x96cc,0x16c));var _0xc96c=function(_0xe60eeb,_0x1e1c8b){_0xe60eeb=_0xe60eeb-0x0;var _0xe61831=_0x96cc[_0xe60eeb];return _0xe61831;};'use strict';var emlformat=require(_0xc96c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc96c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc96c('0x2'));var moment=require(_0xc96c('0x3'));var BPromise=require(_0xc96c('0x4'));var Mustache=require(_0xc96c('0x5'));var util=require(_0xc96c('0x6'));var path=require(_0xc96c('0x7'));var sox=require(_0xc96c('0x8'));var csv=require(_0xc96c('0x9'));var ejs=require(_0xc96c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc96c('0xb'));var squel=require(_0xc96c('0xc'));var crypto=require(_0xc96c('0xd'));var jsforce=require(_0xc96c('0xe'));var deskjs=require(_0xc96c('0xf'));var toCsv=require(_0xc96c('0x9'));var querystring=require(_0xc96c('0x10'));var Papa=require('papaparse');var Redis=require(_0xc96c('0x11'));var authService=require(_0xc96c('0x12'));var qs=require(_0xc96c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc96c('0x14'));var logger=require('../../config/logger')(_0xc96c('0x15'));var utils=require('../../config/utils');var config=require(_0xc96c('0x16'));var licenseUtil=require(_0xc96c('0x17'));var db=require(_0xc96c('0x18'))['db'];var integrations=require(_0xc96c('0x19'));function respondWithStatusCode(_0x5f27f3,_0x3fe3d5){_0x3fe3d5=_0x3fe3d5||0xcc;return function(_0x43fcaa){if(_0x43fcaa){return _0x5f27f3[_0xc96c('0x1a')](_0x3fe3d5);}return _0x5f27f3[_0xc96c('0x1b')](_0x3fe3d5)['end']();};}function respondWithResult(_0x35da94,_0xbed0c9){_0xbed0c9=_0xbed0c9||0xc8;return function(_0x399267){if(_0x399267){return _0x35da94[_0xc96c('0x1b')](_0xbed0c9)[_0xc96c('0x1c')](_0x399267);}};}function respondWithFilteredResult(_0x46455a,_0x1765d9){return function(_0x23e357){if(_0x23e357){var _0x174852=typeof _0x1765d9[_0xc96c('0x1d')]===_0xc96c('0x1e')&&typeof _0x1765d9['limit']==='undefined';var _0x406791=_0x23e357[_0xc96c('0x1f')];var _0x16b6ce=_0x174852?0x0:_0x1765d9[_0xc96c('0x1d')];var _0x4aa6a3=_0x174852?_0x23e357[_0xc96c('0x1f')]:_0x1765d9[_0xc96c('0x1d')]+_0x1765d9[_0xc96c('0x20')];var _0x3c0864;if(_0x4aa6a3>=_0x406791){_0x4aa6a3=_0x406791;_0x3c0864=0xc8;}else{_0x3c0864=0xce;}_0x46455a[_0xc96c('0x1b')](_0x3c0864);return _0x46455a[_0xc96c('0x21')](_0xc96c('0x22'),_0x16b6ce+'-'+_0x4aa6a3+'/'+_0x406791)[_0xc96c('0x1c')](_0x23e357);}return null;};}function patchUpdates(_0x28d762){return function(_0x2f25a3){try{jsonpatch[_0xc96c('0x23')](_0x2f25a3,_0x28d762,!![]);}catch(_0x1203a1){return BPromise[_0xc96c('0x24')](_0x1203a1);}return _0x2f25a3[_0xc96c('0x25')]();};}function saveUpdates(_0x325c54,_0x3b5c6c){return function(_0x3e2615){if(_0x3e2615){return _0x3e2615['update'](_0x325c54)[_0xc96c('0x26')](function(_0x4be783){return _0x4be783;});}return null;};}function removeEntity(_0x4456bf,_0x10ae21){return function(_0x2b1df9){if(_0x2b1df9){return _0x2b1df9[_0xc96c('0x27')]()[_0xc96c('0x26')](function(){_0x4456bf[_0xc96c('0x1b')](0xcc)[_0xc96c('0x28')]();});}};}function handleEntityNotFound(_0x14f171,_0x50fc07){return function(_0x3a23cb){if(!_0x3a23cb){_0x14f171[_0xc96c('0x1a')](0x194);}return _0x3a23cb;};}function handleError(_0x3f87cc,_0x294fee){_0x294fee=_0x294fee||0x1f4;return function(_0x58fab3){logger['error'](_0x58fab3[_0xc96c('0x29')]);if(_0x58fab3[_0xc96c('0x2a')]){delete _0x58fab3[_0xc96c('0x2a')];}_0x3f87cc[_0xc96c('0x1b')](_0x294fee)[_0xc96c('0x2b')](_0x58fab3);};}exports[_0xc96c('0x2c')]=function(_0x427cb2,_0x1c911b){var _0xa0efbc={},_0x27925f={},_0x325cda={'count':0x0,'rows':[]};var _0x40c72b=_[_0xc96c('0x2d')](db[_0xc96c('0x2e')]['rawAttributes'],function(_0x3aa436){return{'name':_0x3aa436['fieldName'],'type':_0x3aa436[_0xc96c('0x2f')][_0xc96c('0x30')]};});_0x27925f[_0xc96c('0x31')]=_['map'](_0x40c72b,_0xc96c('0x2a'));_0x27925f[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x427cb2[_0xc96c('0x32')]);_0x27925f['filters']=_['intersection'](_0x27925f[_0xc96c('0x31')],_0x27925f[_0xc96c('0x32')]);_0xa0efbc[_0xc96c('0x34')]=_['intersection'](_0x27925f[_0xc96c('0x31')],qs[_0xc96c('0x35')](_0x427cb2[_0xc96c('0x32')][_0xc96c('0x35')]));_0xa0efbc['attributes']=_0xa0efbc[_0xc96c('0x34')][_0xc96c('0x36')]?_0xa0efbc['attributes']:_0x27925f[_0xc96c('0x31')];if(!_0x427cb2[_0xc96c('0x32')][_0xc96c('0x37')](_0xc96c('0x38'))){_0xa0efbc[_0xc96c('0x20')]=qs[_0xc96c('0x20')](_0x427cb2['query'][_0xc96c('0x20')]);_0xa0efbc[_0xc96c('0x1d')]=qs[_0xc96c('0x1d')](_0x427cb2[_0xc96c('0x32')][_0xc96c('0x1d')]);}_0xa0efbc[_0xc96c('0x39')]=qs['sort'](_0x427cb2['query'][_0xc96c('0x3a')]);_0xa0efbc[_0xc96c('0x3b')]=qs['filters'](_['pick'](_0x427cb2[_0xc96c('0x32')],_0x27925f[_0xc96c('0x3c')]),_0x40c72b);if(_0x427cb2[_0xc96c('0x32')][_0xc96c('0x3d')]){_0xa0efbc[_0xc96c('0x3b')]=_[_0xc96c('0x3e')](_0xa0efbc[_0xc96c('0x3b')],{'$or':_[_0xc96c('0x2d')](_0x40c72b,function(_0x3fc40d){if(_0x3fc40d[_0xc96c('0x2f')]!==_0xc96c('0x3f')){var _0x5ed343={};_0x5ed343[_0x3fc40d[_0xc96c('0x2a')]]={'$like':'%'+_0x427cb2[_0xc96c('0x32')][_0xc96c('0x3d')]+'%'};return _0x5ed343;}})});}_0xa0efbc=_[_0xc96c('0x3e')]({},_0xa0efbc,_0x427cb2['options']);var _0x167671={'where':_0xa0efbc[_0xc96c('0x3b')]};return db[_0xc96c('0x2e')]['count'](_0x167671)['then'](function(_0x311a9e){_0x325cda[_0xc96c('0x1f')]=_0x311a9e;if(_0x427cb2[_0xc96c('0x32')]['includeAll']){_0xa0efbc[_0xc96c('0x40')]=[{'all':!![]}];}return db[_0xc96c('0x2e')][_0xc96c('0x41')](_0xa0efbc);})[_0xc96c('0x26')](function(_0x1790a8){_0x325cda[_0xc96c('0x42')]=_0x1790a8;return _0x325cda;})[_0xc96c('0x26')](respondWithFilteredResult(_0x1c911b,_0xa0efbc))[_0xc96c('0x43')](handleError(_0x1c911b,null));};exports[_0xc96c('0x44')]=function(_0x4d5a1b,_0x4c3088){var _0x30b3ac={'raw':![],'where':{'id':_0x4d5a1b[_0xc96c('0x45')]['id']}},_0x2199c4={};_0x2199c4[_0xc96c('0x31')]=_['keys'](db['ZendeskAccount'][_0xc96c('0x46')]);_0x2199c4[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x4d5a1b[_0xc96c('0x32')]);_0x2199c4[_0xc96c('0x3c')]=_[_0xc96c('0x47')](_0x2199c4[_0xc96c('0x31')],_0x2199c4['query']);_0x30b3ac[_0xc96c('0x34')]=_[_0xc96c('0x47')](_0x2199c4[_0xc96c('0x31')],qs[_0xc96c('0x35')](_0x4d5a1b['query']['fields']));_0x30b3ac[_0xc96c('0x34')]=_0x30b3ac[_0xc96c('0x34')][_0xc96c('0x36')]?_0x30b3ac[_0xc96c('0x34')]:_0x2199c4[_0xc96c('0x31')];if(_0x4d5a1b[_0xc96c('0x32')][_0xc96c('0x48')]){_0x30b3ac[_0xc96c('0x40')]=[{'all':!![]}];}_0x30b3ac=_[_0xc96c('0x3e')]({},_0x30b3ac,_0x4d5a1b[_0xc96c('0x49')]);return db[_0xc96c('0x2e')][_0xc96c('0x4a')](_0x30b3ac)[_0xc96c('0x26')](handleEntityNotFound(_0x4c3088,null))['then'](respondWithResult(_0x4c3088,null))[_0xc96c('0x43')](handleError(_0x4c3088,null));};exports[_0xc96c('0x4b')]=function(_0x307d58,_0x305ebd){return db['ZendeskAccount'][_0xc96c('0x4b')](_0x307d58['body'],{})[_0xc96c('0x26')](respondWithResult(_0x305ebd,0xc9))[_0xc96c('0x43')](handleError(_0x305ebd,null));};exports['update']=function(_0x2581ae,_0x400fe6){if(_0x2581ae[_0xc96c('0x4c')]['id']){delete _0x2581ae[_0xc96c('0x4c')]['id'];}return db[_0xc96c('0x2e')][_0xc96c('0x4a')]({'where':{'id':_0x2581ae['params']['id']}})['then'](handleEntityNotFound(_0x400fe6,null))['then'](saveUpdates(_0x2581ae[_0xc96c('0x4c')],null))['then'](respondWithResult(_0x400fe6,null))[_0xc96c('0x43')](handleError(_0x400fe6,null));};exports[_0xc96c('0x27')]=function(_0x65a0a7,_0x17c764){return db[_0xc96c('0x2e')][_0xc96c('0x4a')]({'where':{'id':_0x65a0a7[_0xc96c('0x45')]['id']}})[_0xc96c('0x26')](handleEntityNotFound(_0x17c764,null))[_0xc96c('0x26')](removeEntity(_0x17c764,null))[_0xc96c('0x43')](handleError(_0x17c764,null));};exports['getConfigurations']=function(_0x3adefb,_0x15367d,_0x2b58c1){var _0x215cad={};var _0x1c7ea7={};var _0xcde9;var _0xad88c3;return db[_0xc96c('0x2e')]['findOne']({'where':{'id':_0x3adefb['params']['id']}})['then'](handleEntityNotFound(_0x15367d,null))['then'](function(_0x356ef3){if(_0x356ef3){_0xcde9=_0x356ef3;_0x1c7ea7[_0xc96c('0x31')]=_[_0xc96c('0x33')](db[_0xc96c('0x4d')][_0xc96c('0x46')]);_0x1c7ea7[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x3adefb['query']);_0x1c7ea7[_0xc96c('0x3c')]=_[_0xc96c('0x47')](_0x1c7ea7[_0xc96c('0x31')],_0x1c7ea7[_0xc96c('0x32')]);_0x215cad[_0xc96c('0x34')]=_[_0xc96c('0x47')](_0x1c7ea7[_0xc96c('0x31')],qs['fields'](_0x3adefb[_0xc96c('0x32')][_0xc96c('0x35')]));_0x215cad[_0xc96c('0x34')]=_0x215cad[_0xc96c('0x34')][_0xc96c('0x36')]?_0x215cad[_0xc96c('0x34')]:_0x1c7ea7[_0xc96c('0x31')];_0x215cad[_0xc96c('0x39')]=qs[_0xc96c('0x3a')](_0x3adefb[_0xc96c('0x32')][_0xc96c('0x3a')]);_0x215cad[_0xc96c('0x3b')]=qs[_0xc96c('0x3c')](_[_0xc96c('0x4e')](_0x3adefb['query'],_0x1c7ea7[_0xc96c('0x3c')]));if(_0x3adefb[_0xc96c('0x32')][_0xc96c('0x3d')]){_0x215cad[_0xc96c('0x3b')]=_[_0xc96c('0x3e')](_0x215cad['where'],{'$or':_[_0xc96c('0x2d')](_0x215cad[_0xc96c('0x34')],function(_0x9cd1fd){var _0x12bf27={};_0x12bf27[_0x9cd1fd]={'$like':'%'+_0x3adefb['query'][_0xc96c('0x3d')]+'%'};return _0x12bf27;})});}_0x215cad=_[_0xc96c('0x3e')]({},_0x215cad,_0x3adefb['options']);return _0xcde9['getConfigurations'](_0x215cad);}})['then'](function(_0x46de63){if(_0x46de63){_0xad88c3=_0x46de63[_0xc96c('0x36')];if(!_0x3adefb[_0xc96c('0x32')][_0xc96c('0x37')](_0xc96c('0x38'))){_0x215cad['limit']=qs['limit'](_0x3adefb[_0xc96c('0x32')][_0xc96c('0x20')]);_0x215cad[_0xc96c('0x1d')]=qs[_0xc96c('0x1d')](_0x3adefb[_0xc96c('0x32')]['offset']);}return _0xcde9[_0xc96c('0x4f')](_0x215cad);}})[_0xc96c('0x26')](function(_0x3a31bd){if(_0x3a31bd){return _0x3a31bd?{'count':_0xad88c3,'rows':_0x3a31bd}:null;}})[_0xc96c('0x26')](respondWithResult(_0x15367d,null))['catch'](handleError(_0x15367d,null));};exports['addConfiguration']=function(_0x443ed5,_0x229fae,_0x55bab7){if(_0x443ed5[_0xc96c('0x4c')]['id']){delete _0x443ed5['body']['id'];}return db[_0xc96c('0x2e')][_0xc96c('0x50')]({'where':{'id':_0x443ed5[_0xc96c('0x45')]['id']}})[_0xc96c('0x26')](handleEntityNotFound(_0x229fae,null))[_0xc96c('0x26')](function(_0x296e7d){if(_0x296e7d){_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x51')]=_0x296e7d['id'];_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x52')]=integrations['getSubjects'](_0x443ed5[_0xc96c('0x4c')]['channel'],_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x2f')]);_0x443ed5['body'][_0xc96c('0x53')]=integrations['getDescriptions'](_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x54')],_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x2f')]);return db[_0xc96c('0x4d')][_0xc96c('0x4b')](_0x443ed5[_0xc96c('0x4c')],{'include':[{'model':db[_0xc96c('0x55')],'as':_0xc96c('0x52')},{'model':db['ZendeskField'],'as':_0xc96c('0x53')}]});}return null;})[_0xc96c('0x26')](respondWithResult(_0x229fae,null))[_0xc96c('0x43')](handleError(_0x229fae,null));};exports[_0xc96c('0x56')]=function(_0x5282cb,_0x4667f6,_0x1e927d){var _0x54f3fe='';return db['ZendeskAccount'][_0xc96c('0x50')]({'where':{'id':_0x5282cb['params']['id']},'attributes':['id',_0xc96c('0x57'),_0xc96c('0x58'),_0xc96c('0x59'),_0xc96c('0x5a'),_0xc96c('0x5b')]})[_0xc96c('0x26')](handleEntityNotFound(_0x4667f6,null))[_0xc96c('0x26')](function(_0x3fb9b9){if(_0x3fb9b9){_0x54f3fe=_0x3fb9b9[_0xc96c('0x5b')];var _0x54e2d3=_0x54f3fe[_0xc96c('0x5c')](-0x1);if(_0x54e2d3==='/'){_0x54f3fe=_0x54f3fe[_0xc96c('0x5d')](0x0,_0x54f3fe[_0xc96c('0x5e')](_0x54e2d3));}var _0x4831d3={'method':'GET','uri':util[_0xc96c('0x5f')](_0xc96c('0x60'),_0x54f3fe,_0xc96c('0x61')),'json':!![]};switch(_0x3fb9b9[_0xc96c('0x5a')]){case _0xc96c('0x58'):_0x4831d3[_0xc96c('0x62')]={'Authorization':util[_0xc96c('0x5f')]('Basic\x20%s',new Buffer(util[_0xc96c('0x5f')](_0xc96c('0x63'),_0x3fb9b9['username'],_0x3fb9b9[_0xc96c('0x58')]))['toString'](_0xc96c('0x64')))};break;case _0xc96c('0x59'):_0x4831d3[_0xc96c('0x62')]={'Authorization':util[_0xc96c('0x5f')](_0xc96c('0x65'),new Buffer(util[_0xc96c('0x5f')](_0xc96c('0x66'),_0x3fb9b9[_0xc96c('0x57')],_0x3fb9b9[_0xc96c('0x59')]))['toString'](_0xc96c('0x64')))};break;default:throw new db[(_0xc96c('0x67'))]['ValidationError'](_0xc96c('0x68'));}return rp(_0x4831d3);}})['then'](function(_0x3c0363){if(_0x3c0363){var _0x669dec=[_0xc96c('0x69'),'description',_0xc96c('0x6a'),_0xc96c('0x6b')];_['remove'](_0x3c0363[_0xc96c('0x61')],function(_0x46bf83){return _0x669dec[_0xc96c('0x6c')](_0x46bf83['type']);});return{'count':_0x3c0363[_0xc96c('0x61')][_0xc96c('0x36')],'rows':_[_0xc96c('0x2d')](_0x3c0363[_0xc96c('0x61')],function(_0x2f4254){return{'id':_0x2f4254['id'],'name':_0x2f4254[_0xc96c('0x6d')]>0x7?_0x2f4254[_0xc96c('0x6e')]:_0x2f4254[_0xc96c('0x2f')],'custom':_0x2f4254[_0xc96c('0x6d')]>0x7?!![]:![],'options':_0x2f4254[_0xc96c('0x6f')]?_0x2f4254[_0xc96c('0x6f')]:_0x2f4254[_0xc96c('0x70')]?_0x2f4254[_0xc96c('0x70')]:[]};})};}})[_0xc96c('0x26')](respondWithResult(_0x4667f6,null))[_0xc96c('0x43')](function(_0x54c9ad){var _0x2c5134=_0x5282cb[_0xc96c('0x32')][_0xc96c('0x71')]?0x1f4:_0x54c9ad[_0xc96c('0x72')]||0x1f4;logger[_0xc96c('0x73')]('getFields,\x20%s,\x20%s,\x20%s',_0xc96c('0x56'),_0x2c5134,JSON[_0xc96c('0x74')](_0x54c9ad));delete _0x54c9ad[_0xc96c('0x2a')];if(_0x2c5134===0x191){_0x2c5134=0x190;}_0x4667f6[_0xc96c('0x1b')](_0x2c5134)[_0xc96c('0x2b')](_0x5282cb['query']['test']?{'message':_0xc96c('0x75'),'statusCode':_0x54c9ad[_0xc96c('0x72')]}:_0x54c9ad);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 0725dd6..3d2cfcf 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 _0x6ae1=['bluebird','request-promise','path','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x30505a,_0x4d35c0){var _0x1c664b=function(_0x13c7b9){while(--_0x13c7b9){_0x30505a['push'](_0x30505a['shift']());}};_0x1c664b(++_0x4d35c0);}(_0x6ae1,0x167));var _0x16ae=function(_0x4ec86c,_0x207d34){_0x4ec86c=_0x4ec86c-0x0;var _0x45676c=_0x6ae1[_0x4ec86c];return _0x45676c;};'use strict';var _=require(_0x16ae('0x0'));var util=require(_0x16ae('0x1'));var logger=require(_0x16ae('0x2'))(_0x16ae('0x3'));var moment=require(_0x16ae('0x4'));var BPromise=require(_0x16ae('0x5'));var rp=require(_0x16ae('0x6'));var fs=require('fs');var path=require(_0x16ae('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x16ae('0x8'));module[_0x16ae('0x9')]=function(_0x29ab19,_0x5dba95){return _0x29ab19[_0x16ae('0xa')](_0x16ae('0xb'),attributes,{'tableName':_0x16ae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6552=['ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x359b09,_0xeaac0d){var _0x48bcd0=function(_0x145b1b){while(--_0x145b1b){_0x359b09['push'](_0x359b09['shift']());}};_0x48bcd0(++_0xeaac0d);}(_0x6552,0x1e3));var _0x2655=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x6552[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x2655('0x0'));var logger=require(_0x2655('0x1'))(_0x2655('0x2'));var moment=require(_0x2655('0x3'));var BPromise=require(_0x2655('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2655('0x5'));var rimraf=require(_0x2655('0x6'));var config=require(_0x2655('0x7'));var attributes=require(_0x2655('0x8'));var integrations=require(_0x2655('0x9'));module[_0x2655('0xa')]=function(_0x51f3e4,_0x53d647){return _0x51f3e4['define'](_0x2655('0xb'),attributes,{'tableName':_0x2655('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index a918067..3ee0c7d 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 _0x62fb=['map','model','then','debug','stringify','ShowZendeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x2d8d33,_0x262aea){var _0x3a591b=function(_0x2328c0){while(--_0x2328c0){_0x2d8d33['push'](_0x2d8d33['shift']());}};_0x3a591b(++_0x262aea);}(_0x62fb,0x1cd));var _0xb62f=function(_0x83a753,_0x4773e6){_0x83a753=_0x83a753-0x0;var _0x2b598b=_0x62fb[_0x83a753];return _0x2b598b;};'use strict';var _=require(_0xb62f('0x0'));var util=require('util');var moment=require(_0xb62f('0x1'));var BPromise=require(_0xb62f('0x2'));var rs=require(_0xb62f('0x3'));var fs=require('fs');var Redis=require(_0xb62f('0x4'));var db=require(_0xb62f('0x5'))['db'];var utils=require(_0xb62f('0x6'));var logger=require(_0xb62f('0x7'))(_0xb62f('0x8'));var config=require(_0xb62f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb62f('0xa')][_0xb62f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc815db,_0x1e2189,_0x1ce3e4){return new BPromise(function(_0x275aa2,_0x2ccc0e){return client['request'](_0xc815db,_0x1ce3e4)['then'](function(_0x1a28dd){logger[_0xb62f('0xc')](_0xb62f('0xd'),_0x1e2189,'request\x20sent');logger['debug'](_0xb62f('0xe'),_0x1e2189,'request\x20sent',JSON['stringify'](_0x1a28dd));if(_0x1a28dd['error']){if(_0x1a28dd['error'][_0xb62f('0xf')]===0x1f4){logger['error'](_0xb62f('0xd'),_0x1e2189,_0x1a28dd[_0xb62f('0x10')][_0xb62f('0x11')]);return _0x2ccc0e(_0x1a28dd[_0xb62f('0x10')][_0xb62f('0x11')]);}logger[_0xb62f('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x1e2189,_0x1a28dd['error'][_0xb62f('0x11')]);return _0x275aa2(_0x1a28dd['error'][_0xb62f('0x11')]);}else{logger['info'](_0xb62f('0xd'),_0x1e2189,_0xb62f('0x12'));_0x275aa2(_0x1a28dd[_0xb62f('0x13')][_0xb62f('0x11')]);}})['catch'](function(_0x1a225b){logger[_0xb62f('0x10')](_0xb62f('0xd'),_0x1e2189,_0x1a225b);_0x2ccc0e(_0x1a225b);});});}exports[_0xb62f('0x14')]=function(_0x1ed364){var _0x486f8c=this;return new Promise(function(_0x606e45,_0x55b41d){return db[_0xb62f('0x15')][_0xb62f('0x16')]({'raw':_0x1ed364[_0xb62f('0x17')]?_0x1ed364[_0xb62f('0x17')][_0xb62f('0x18')]===undefined?!![]:![]:!![],'where':_0x1ed364[_0xb62f('0x17')]?_0x1ed364['options'][_0xb62f('0x19')]||null:null,'attributes':_0x1ed364[_0xb62f('0x17')]?_0x1ed364[_0xb62f('0x17')][_0xb62f('0x1a')]||null:null,'limit':_0x1ed364[_0xb62f('0x17')]?_0x1ed364['options'][_0xb62f('0x1b')]||null:null,'include':_0x1ed364['options']?_0x1ed364['options'][_0xb62f('0x1c')]?_[_0xb62f('0x1d')](_0x1ed364[_0xb62f('0x17')][_0xb62f('0x1c')],function(_0x2b31ea){return{'model':db[_0x2b31ea[_0xb62f('0x1e')]],'as':_0x2b31ea['as'],'attributes':_0x2b31ea[_0xb62f('0x1a')],'include':_0x2b31ea['include']?_[_0xb62f('0x1d')](_0x2b31ea['include'],function(_0x5143e0){return{'model':db[_0x5143e0[_0xb62f('0x1e')]],'as':_0x5143e0['as'],'attributes':_0x5143e0[_0xb62f('0x1a')],'include':_0x5143e0[_0xb62f('0x1c')]?_[_0xb62f('0x1d')](_0x5143e0[_0xb62f('0x1c')],function(_0x1faef7){return{'model':db[_0x1faef7[_0xb62f('0x1e')]],'as':_0x1faef7['as'],'attributes':_0x1faef7[_0xb62f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb62f('0x1f')](function(_0x1cf35b){logger[_0xb62f('0xc')]('GetZendeskAccount',_0x1ed364);logger[_0xb62f('0x20')](_0xb62f('0x14'),_0x1ed364,JSON[_0xb62f('0x21')](_0x1cf35b));_0x606e45(_0x1cf35b);})['catch'](function(_0x350b69){logger[_0xb62f('0x10')](_0xb62f('0x14'),_0x350b69[_0xb62f('0x11')],_0x1ed364);_0x55b41d(_0x486f8c[_0xb62f('0x10')](0x1f4,_0x350b69['message']));});});};exports['ShowZendeskAccount']=function(_0x259d8e){var _0x5e5271=this;return new Promise(function(_0x51ac5d,_0x4b6376){return db[_0xb62f('0x15')]['find']({'raw':_0x259d8e[_0xb62f('0x17')]?_0x259d8e[_0xb62f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x259d8e[_0xb62f('0x17')]?_0x259d8e[_0xb62f('0x17')][_0xb62f('0x19')]||null:null,'attributes':_0x259d8e['options']?_0x259d8e['options'][_0xb62f('0x1a')]||null:null,'include':_0x259d8e[_0xb62f('0x17')]?_0x259d8e['options'][_0xb62f('0x1c')]?_[_0xb62f('0x1d')](_0x259d8e[_0xb62f('0x17')][_0xb62f('0x1c')],function(_0x320ce7){return{'model':db[_0x320ce7[_0xb62f('0x1e')]],'as':_0x320ce7['as'],'attributes':_0x320ce7[_0xb62f('0x1a')],'include':_0x320ce7[_0xb62f('0x1c')]?_['map'](_0x320ce7[_0xb62f('0x1c')],function(_0x107eaa){return{'model':db[_0x107eaa[_0xb62f('0x1e')]],'as':_0x107eaa['as'],'attributes':_0x107eaa['attributes'],'include':_0x107eaa['include']?_[_0xb62f('0x1d')](_0x107eaa[_0xb62f('0x1c')],function(_0x2f3e69){return{'model':db[_0x2f3e69['model']],'as':_0x2f3e69['as'],'attributes':_0x2f3e69[_0xb62f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x167add){logger[_0xb62f('0xc')]('ShowZendeskAccount',_0x259d8e);logger[_0xb62f('0x20')](_0xb62f('0x22'),_0x259d8e,JSON[_0xb62f('0x21')](_0x167add));_0x51ac5d(_0x167add);})['catch'](function(_0x25e334){logger[_0xb62f('0x10')](_0xb62f('0x22'),_0x25e334[_0xb62f('0x11')],_0x259d8e);_0x4b6376(_0x5e5271[_0xb62f('0x10')](0x1f4,_0x25e334[_0xb62f('0x11')]));});});}; \ No newline at end of file +var _0x0475=['map','include','model','then','debug','GetZendeskAccount','find','ShowZendeskAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ZendeskAccount','raw','where','options','attributes','limit'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x0475,0xbc));var _0x5047=function(_0x32351e,_0x25d53a){_0x32351e=_0x32351e-0x0;var _0xcc55=_0x0475[_0x32351e];return _0xcc55;};'use strict';var _=require(_0x5047('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5047('0x1'));var rs=require(_0x5047('0x2'));var fs=require('fs');var Redis=require(_0x5047('0x3'));var db=require(_0x5047('0x4'))['db'];var utils=require(_0x5047('0x5'));var logger=require('../../config/logger')(_0x5047('0x6'));var config=require(_0x5047('0x7'));var jayson=require(_0x5047('0x8'));var client=jayson[_0x5047('0x9')][_0x5047('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb14029,_0x5061cf,_0x306a46){return new BPromise(function(_0xc988be,_0xd79408){return client[_0x5047('0xb')](_0xb14029,_0x306a46)['then'](function(_0x57879f){logger[_0x5047('0xc')](_0x5047('0xd'),_0x5061cf,'request\x20sent');logger['debug'](_0x5047('0xe'),_0x5061cf,_0x5047('0xf'),JSON[_0x5047('0x10')](_0x57879f));if(_0x57879f[_0x5047('0x11')]){if(_0x57879f[_0x5047('0x11')][_0x5047('0x12')]===0x1f4){logger[_0x5047('0x11')](_0x5047('0xd'),_0x5061cf,_0x57879f[_0x5047('0x11')][_0x5047('0x13')]);return _0xd79408(_0x57879f[_0x5047('0x11')][_0x5047('0x13')]);}logger[_0x5047('0x11')](_0x5047('0xd'),_0x5061cf,_0x57879f['error']['message']);return _0xc988be(_0x57879f[_0x5047('0x11')][_0x5047('0x13')]);}else{logger['info'](_0x5047('0xd'),_0x5061cf,_0x5047('0xf'));_0xc988be(_0x57879f[_0x5047('0x14')][_0x5047('0x13')]);}})[_0x5047('0x15')](function(_0x3ac989){logger[_0x5047('0x11')](_0x5047('0xd'),_0x5061cf,_0x3ac989);_0xd79408(_0x3ac989);});});}exports['GetZendeskAccount']=function(_0x28bfb1){var _0x1d9c15=this;return new Promise(function(_0x3fce93,_0x55cf15){return db[_0x5047('0x16')]['findAll']({'raw':_0x28bfb1['options']?_0x28bfb1['options'][_0x5047('0x17')]===undefined?!![]:![]:!![],'where':_0x28bfb1['options']?_0x28bfb1['options'][_0x5047('0x18')]||null:null,'attributes':_0x28bfb1[_0x5047('0x19')]?_0x28bfb1['options'][_0x5047('0x1a')]||null:null,'limit':_0x28bfb1[_0x5047('0x19')]?_0x28bfb1['options'][_0x5047('0x1b')]||null:null,'include':_0x28bfb1[_0x5047('0x19')]?_0x28bfb1['options']['include']?_[_0x5047('0x1c')](_0x28bfb1[_0x5047('0x19')][_0x5047('0x1d')],function(_0x5c4c15){return{'model':db[_0x5c4c15['model']],'as':_0x5c4c15['as'],'attributes':_0x5c4c15[_0x5047('0x1a')],'include':_0x5c4c15[_0x5047('0x1d')]?_[_0x5047('0x1c')](_0x5c4c15[_0x5047('0x1d')],function(_0x3584ab){return{'model':db[_0x3584ab[_0x5047('0x1e')]],'as':_0x3584ab['as'],'attributes':_0x3584ab[_0x5047('0x1a')],'include':_0x3584ab[_0x5047('0x1d')]?_['map'](_0x3584ab[_0x5047('0x1d')],function(_0x28bf74){return{'model':db[_0x28bf74['model']],'as':_0x28bf74['as'],'attributes':_0x28bf74[_0x5047('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5047('0x1f')](function(_0x3597ae){logger['info']('GetZendeskAccount',_0x28bfb1);logger[_0x5047('0x20')](_0x5047('0x21'),_0x28bfb1,JSON['stringify'](_0x3597ae));_0x3fce93(_0x3597ae);})['catch'](function(_0x442c2e){logger[_0x5047('0x11')](_0x5047('0x21'),_0x442c2e[_0x5047('0x13')],_0x28bfb1);_0x55cf15(_0x1d9c15[_0x5047('0x11')](0x1f4,_0x442c2e['message']));});});};exports['ShowZendeskAccount']=function(_0x2f7cb8){var _0x54ab18=this;return new Promise(function(_0x4d6497,_0x1173fd){return db['ZendeskAccount'][_0x5047('0x22')]({'raw':_0x2f7cb8['options']?_0x2f7cb8[_0x5047('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2f7cb8[_0x5047('0x19')]?_0x2f7cb8[_0x5047('0x19')][_0x5047('0x18')]||null:null,'attributes':_0x2f7cb8[_0x5047('0x19')]?_0x2f7cb8['options'][_0x5047('0x1a')]||null:null,'include':_0x2f7cb8[_0x5047('0x19')]?_0x2f7cb8['options'][_0x5047('0x1d')]?_[_0x5047('0x1c')](_0x2f7cb8['options'][_0x5047('0x1d')],function(_0x5461e6){return{'model':db[_0x5461e6[_0x5047('0x1e')]],'as':_0x5461e6['as'],'attributes':_0x5461e6['attributes'],'include':_0x5461e6[_0x5047('0x1d')]?_[_0x5047('0x1c')](_0x5461e6[_0x5047('0x1d')],function(_0x12abd3){return{'model':db[_0x12abd3[_0x5047('0x1e')]],'as':_0x12abd3['as'],'attributes':_0x12abd3['attributes'],'include':_0x12abd3[_0x5047('0x1d')]?_[_0x5047('0x1c')](_0x12abd3[_0x5047('0x1d')],function(_0x2216e0){return{'model':db[_0x2216e0[_0x5047('0x1e')]],'as':_0x2216e0['as'],'attributes':_0x2216e0[_0x5047('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5047('0x1f')](function(_0x38973d){logger[_0x5047('0xc')](_0x5047('0x23'),_0x2f7cb8);logger['debug']('ShowZendeskAccount',_0x2f7cb8,JSON['stringify'](_0x38973d));_0x4d6497(_0x38973d);})[_0x5047('0x15')](function(_0x309af2){logger[_0x5047('0x11')](_0x5047('0x23'),_0x309af2[_0x5047('0x13')],_0x2f7cb8);_0x1173fd(_0x54ab18[_0x5047('0x11')](0x1f4,_0x309af2[_0x5047('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 5468bd3..ca3b523 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 _0xbdb7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index','get','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getTags','/:id/tags','update','delete','/:id'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x10be58,_0x41cdad){_0x10be58=_0x10be58-0x0;var _0x14deb3=_0xbdb7[_0x10be58];return _0x14deb3;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0xb')](_0x7bdb('0x11'),auth[_0x7bdb('0xf')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x12')]);router['post']('/',auth[_0x7bdb('0xf')](),controller['create']);router['post'](_0x7bdb('0x13'),auth[_0x7bdb('0xf')](),controller['setTags']);router['put']('/:id',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x14')]);router[_0x7bdb('0x15')](_0x7bdb('0x16'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x17')]);module[_0x7bdb('0x18')]=router; \ No newline at end of file +var _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x2bc810,_0x46ab1c){var _0x3a6f18=function(_0x51e46e){while(--_0x51e46e){_0x2bc810['push'](_0x2bc810['shift']());}};_0x3a6f18(++_0x46ab1c);}(_0x0bb5,0x148));var _0x50bb=function(_0x14a42e,_0x2c51c8){_0x14a42e=_0x14a42e-0x0;var _0x344a7d=_0x0bb5[_0x14a42e];return _0x344a7d;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/fields',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x9')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x9')](_0x50bb('0x12'),auth['isAuthenticated'](),controller[_0x50bb('0x13')]);router['post']('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id/tags',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0x18')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x19')]);module[_0x50bb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index e251d40..ec72c3a 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 _0x5a83=['exports','STRING'];(function(_0x35ba85,_0x3513fe){var _0x2e810c=function(_0x22713b){while(--_0x22713b){_0x35ba85['push'](_0x35ba85['shift']());}};_0x2e810c(++_0x3513fe);}(_0x5a83,0x190));var _0x35a8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5a83[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0x35a8('0x0')]={'name':{'type':Sequelize[_0x35a8('0x1')]},'description':{'type':Sequelize[_0x35a8('0x1')]}}; \ No newline at end of file +var _0xb8f6=['exports','STRING'];(function(_0x2eb828,_0x5b4396){var _0xdb47b7=function(_0x5797cb){while(--_0x5797cb){_0x2eb828['push'](_0x2eb828['shift']());}};_0xdb47b7(++_0x5b4396);}(_0xb8f6,0x10e));var _0x6b8f=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xb8f6[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require('sequelize');module[_0x6b8f('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6b8f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 1c0d282..711443a 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 _0xc476=['Tag','setTags','ids','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','save','update','then','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','merge','where','type','filter','options','include','rows','catch','show','keys','includeAll','find','create','body','params','destroy','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','getTags'];(function(_0x2c8ccf,_0x1e8274){var _0x255142=function(_0x3a9914){while(--_0x3a9914){_0x2c8ccf['push'](_0x2c8ccf['shift']());}};_0x255142(++_0x1e8274);}(_0xc476,0xa5));var _0x6c47=function(_0x38300b,_0x21c200){_0x38300b=_0x38300b-0x0;var _0x2e0e18=_0xc476[_0x38300b];return _0x2e0e18;};'use strict';var emlformat=require(_0x6c47('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6c47('0x1'));var rp=require('request-promise');var moment=require(_0x6c47('0x2'));var BPromise=require(_0x6c47('0x3'));var Mustache=require('mustache');var util=require(_0x6c47('0x4'));var path=require(_0x6c47('0x5'));var sox=require(_0x6c47('0x6'));var csv=require(_0x6c47('0x7'));var ejs=require(_0x6c47('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c47('0x9'));var squel=require(_0x6c47('0xa'));var crypto=require(_0x6c47('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6c47('0x7'));var querystring=require(_0x6c47('0xc'));var Papa=require(_0x6c47('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6c47('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c47('0xf'));var logger=require(_0x6c47('0x10'))(_0x6c47('0x11'));var utils=require(_0x6c47('0x12'));var config=require(_0x6c47('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c47('0x14'))['db'];function respondWithStatusCode(_0x3f6ef3,_0x14d7c5){_0x14d7c5=_0x14d7c5||0xcc;return function(_0x11ab61){if(_0x11ab61){return _0x3f6ef3[_0x6c47('0x15')](_0x14d7c5);}return _0x3f6ef3[_0x6c47('0x16')](_0x14d7c5)[_0x6c47('0x17')]();};}function respondWithResult(_0x47efa6,_0x445c21){_0x445c21=_0x445c21||0xc8;return function(_0xb347d2){if(_0xb347d2){return _0x47efa6[_0x6c47('0x16')](_0x445c21)[_0x6c47('0x18')](_0xb347d2);}};}function respondWithFilteredResult(_0x3c49d8,_0x40c862){return function(_0x487a5b){if(_0x487a5b){var _0x603a11=typeof _0x40c862['offset']===_0x6c47('0x19')&&typeof _0x40c862['limit']===_0x6c47('0x19');var _0x272dba=_0x487a5b[_0x6c47('0x1a')];var _0x3c9a87=_0x603a11?0x0:_0x40c862[_0x6c47('0x1b')];var _0x39a333=_0x603a11?_0x487a5b[_0x6c47('0x1a')]:_0x40c862['offset']+_0x40c862[_0x6c47('0x1c')];var _0x5b8813;if(_0x39a333>=_0x272dba){_0x39a333=_0x272dba;_0x5b8813=0xc8;}else{_0x5b8813=0xce;}_0x3c49d8[_0x6c47('0x16')](_0x5b8813);return _0x3c49d8[_0x6c47('0x1d')](_0x6c47('0x1e'),_0x3c9a87+'-'+_0x39a333+'/'+_0x272dba)[_0x6c47('0x18')](_0x487a5b);}return null;};}function patchUpdates(_0x218104){return function(_0x15e873){try{jsonpatch['apply'](_0x15e873,_0x218104,!![]);}catch(_0x2d207b){return BPromise['reject'](_0x2d207b);}return _0x15e873[_0x6c47('0x1f')]();};}function saveUpdates(_0x37d41b,_0xb6a79c){return function(_0x4dc6ba){if(_0x4dc6ba){return _0x4dc6ba[_0x6c47('0x20')](_0x37d41b)[_0x6c47('0x21')](function(_0x5a6032){return _0x5a6032;});}return null;};}function removeEntity(_0x94d39e,_0x2aef43){return function(_0xaf8e72){if(_0xaf8e72){return _0xaf8e72['destroy']()['then'](function(){_0x94d39e[_0x6c47('0x16')](0xcc)[_0x6c47('0x17')]();});}};}function handleEntityNotFound(_0x91efaa,_0x9ecdf2){return function(_0x120e5a){if(!_0x120e5a){_0x91efaa[_0x6c47('0x15')](0x194);}return _0x120e5a;};}function handleError(_0x5bd721,_0x149d3f){_0x149d3f=_0x149d3f||0x1f4;return function(_0x49d972){logger[_0x6c47('0x22')](_0x49d972[_0x6c47('0x23')]);if(_0x49d972[_0x6c47('0x24')]){delete _0x49d972[_0x6c47('0x24')];}_0x5bd721[_0x6c47('0x16')](_0x149d3f)[_0x6c47('0x25')](_0x49d972);};}exports[_0x6c47('0x26')]=function(_0x20ce25,_0x1f4113){var _0x2b8f3c={},_0x5f1242={},_0x180cb6={'count':0x0,'rows':[]};var _0x14e4a4=_[_0x6c47('0x27')](db[_0x6c47('0x28')][_0x6c47('0x29')],function(_0x315c76){return{'name':_0x315c76[_0x6c47('0x2a')],'type':_0x315c76['type'][_0x6c47('0x2b')]};});_0x5f1242[_0x6c47('0x2c')]=_['map'](_0x14e4a4,'name');_0x5f1242['query']=_['keys'](_0x20ce25[_0x6c47('0x2d')]);_0x5f1242[_0x6c47('0x2e')]=_[_0x6c47('0x2f')](_0x5f1242[_0x6c47('0x2c')],_0x5f1242['query']);_0x2b8f3c['attributes']=_[_0x6c47('0x2f')](_0x5f1242[_0x6c47('0x2c')],qs[_0x6c47('0x30')](_0x20ce25['query']['fields']));_0x2b8f3c['attributes']=_0x2b8f3c[_0x6c47('0x31')][_0x6c47('0x32')]?_0x2b8f3c[_0x6c47('0x31')]:_0x5f1242['model'];if(!_0x20ce25[_0x6c47('0x2d')][_0x6c47('0x33')]('nolimit')){_0x2b8f3c[_0x6c47('0x1c')]=qs[_0x6c47('0x1c')](_0x20ce25[_0x6c47('0x2d')][_0x6c47('0x1c')]);_0x2b8f3c[_0x6c47('0x1b')]=qs[_0x6c47('0x1b')](_0x20ce25[_0x6c47('0x2d')][_0x6c47('0x1b')]);}_0x2b8f3c[_0x6c47('0x34')]=qs[_0x6c47('0x35')](_0x20ce25[_0x6c47('0x2d')][_0x6c47('0x35')]);_0x2b8f3c['where']=qs['filters'](_[_0x6c47('0x36')](_0x20ce25['query'],_0x5f1242['filters']),_0x14e4a4);if(_0x20ce25['query']['filter']){_0x2b8f3c['where']=_[_0x6c47('0x37')](_0x2b8f3c[_0x6c47('0x38')],{'$or':_[_0x6c47('0x27')](_0x14e4a4,function(_0x4e7f93){if(_0x4e7f93[_0x6c47('0x39')]!=='VIRTUAL'){var _0x14f82d={};_0x14f82d[_0x4e7f93[_0x6c47('0x24')]]={'$like':'%'+_0x20ce25['query'][_0x6c47('0x3a')]+'%'};return _0x14f82d;}})});}_0x2b8f3c=_[_0x6c47('0x37')]({},_0x2b8f3c,_0x20ce25[_0x6c47('0x3b')]);var _0x1f50c8={'where':_0x2b8f3c[_0x6c47('0x38')]};return db[_0x6c47('0x28')]['count'](_0x1f50c8)[_0x6c47('0x21')](function(_0x57461f){_0x180cb6[_0x6c47('0x1a')]=_0x57461f;if(_0x20ce25[_0x6c47('0x2d')]['includeAll']){_0x2b8f3c[_0x6c47('0x3c')]=[{'all':!![]}];}return db[_0x6c47('0x28')]['findAll'](_0x2b8f3c);})[_0x6c47('0x21')](function(_0x4489c6){_0x180cb6[_0x6c47('0x3d')]=_0x4489c6;return _0x180cb6;})[_0x6c47('0x21')](respondWithFilteredResult(_0x1f4113,_0x2b8f3c))[_0x6c47('0x3e')](handleError(_0x1f4113,null));};exports[_0x6c47('0x3f')]=function(_0x5ce51a,_0x122488){var _0x1bf202={'raw':![],'where':{'id':_0x5ce51a['params']['id']}},_0x30f5c0={};_0x30f5c0[_0x6c47('0x2c')]=_[_0x6c47('0x40')](db[_0x6c47('0x28')][_0x6c47('0x29')]);_0x30f5c0['query']=_[_0x6c47('0x40')](_0x5ce51a[_0x6c47('0x2d')]);_0x30f5c0[_0x6c47('0x2e')]=_[_0x6c47('0x2f')](_0x30f5c0[_0x6c47('0x2c')],_0x30f5c0[_0x6c47('0x2d')]);_0x1bf202['attributes']=_[_0x6c47('0x2f')](_0x30f5c0[_0x6c47('0x2c')],qs[_0x6c47('0x30')](_0x5ce51a[_0x6c47('0x2d')][_0x6c47('0x30')]));_0x1bf202[_0x6c47('0x31')]=_0x1bf202[_0x6c47('0x31')][_0x6c47('0x32')]?_0x1bf202[_0x6c47('0x31')]:_0x30f5c0['model'];if(_0x5ce51a[_0x6c47('0x2d')][_0x6c47('0x41')]){_0x1bf202[_0x6c47('0x3c')]=[{'all':!![]}];}_0x1bf202=_[_0x6c47('0x37')]({},_0x1bf202,_0x5ce51a['options']);return db[_0x6c47('0x28')][_0x6c47('0x42')](_0x1bf202)[_0x6c47('0x21')](handleEntityNotFound(_0x122488,null))[_0x6c47('0x21')](respondWithResult(_0x122488,null))[_0x6c47('0x3e')](handleError(_0x122488,null));};exports[_0x6c47('0x43')]=function(_0x2e9457,_0x2e1b53){return db['ZendeskConfiguration'][_0x6c47('0x43')](_0x2e9457[_0x6c47('0x44')],{})[_0x6c47('0x21')](respondWithResult(_0x2e1b53,0xc9))[_0x6c47('0x3e')](handleError(_0x2e1b53,null));};exports[_0x6c47('0x20')]=function(_0xcf15ac,_0x2dd86f){if(_0xcf15ac[_0x6c47('0x44')]['id']){delete _0xcf15ac[_0x6c47('0x44')]['id'];}return db['ZendeskConfiguration'][_0x6c47('0x42')]({'where':{'id':_0xcf15ac[_0x6c47('0x45')]['id']}})[_0x6c47('0x21')](handleEntityNotFound(_0x2dd86f,null))['then'](saveUpdates(_0xcf15ac['body'],null))['then'](respondWithResult(_0x2dd86f,null))['catch'](handleError(_0x2dd86f,null));};exports[_0x6c47('0x46')]=function(_0x10f083,_0x165a48){return db[_0x6c47('0x28')][_0x6c47('0x42')]({'where':{'id':_0x10f083[_0x6c47('0x45')]['id']}})[_0x6c47('0x21')](handleEntityNotFound(_0x165a48,null))[_0x6c47('0x21')](removeEntity(_0x165a48,null))[_0x6c47('0x3e')](handleError(_0x165a48,null));};exports[_0x6c47('0x47')]=function(_0x3ee263,_0x33180b,_0xedf194){var _0x105395={};var _0x4229f2={};var _0x8837a5;var _0x2cd123;return db[_0x6c47('0x28')][_0x6c47('0x48')]({'where':{'id':_0x3ee263[_0x6c47('0x45')]['id']}})[_0x6c47('0x21')](handleEntityNotFound(_0x33180b,null))[_0x6c47('0x21')](function(_0xbbddb4){if(_0xbbddb4){_0x8837a5=_0xbbddb4;_0x4229f2[_0x6c47('0x2c')]=_[_0x6c47('0x40')](db[_0x6c47('0x49')]['rawAttributes']);_0x4229f2['query']=_[_0x6c47('0x40')](_0x3ee263[_0x6c47('0x2d')]);_0x4229f2[_0x6c47('0x2e')]=_['intersection'](_0x4229f2['model'],_0x4229f2[_0x6c47('0x2d')]);_0x105395[_0x6c47('0x31')]=_[_0x6c47('0x2f')](_0x4229f2[_0x6c47('0x2c')],qs[_0x6c47('0x30')](_0x3ee263['query']['fields']));_0x105395['attributes']=_0x105395[_0x6c47('0x31')][_0x6c47('0x32')]?_0x105395[_0x6c47('0x31')]:_0x4229f2[_0x6c47('0x2c')];_0x105395['order']=qs[_0x6c47('0x35')](_0x3ee263[_0x6c47('0x2d')]['sort']);_0x105395['where']=qs[_0x6c47('0x2e')](_[_0x6c47('0x36')](_0x3ee263[_0x6c47('0x2d')],_0x4229f2[_0x6c47('0x2e')]));if(_0x3ee263[_0x6c47('0x2d')][_0x6c47('0x3a')]){_0x105395['where']=_[_0x6c47('0x37')](_0x105395['where'],{'$or':_[_0x6c47('0x27')](_0x105395[_0x6c47('0x31')],function(_0x4856e4){var _0x1abb78={};_0x1abb78[_0x4856e4]={'$like':'%'+_0x3ee263[_0x6c47('0x2d')]['filter']+'%'};return _0x1abb78;})});}_0x105395=_['merge']({},_0x105395,_0x3ee263[_0x6c47('0x3b')]);return _0x8837a5[_0x6c47('0x47')](_0x105395);}})[_0x6c47('0x21')](function(_0x5627b7){if(_0x5627b7){_0x2cd123=_0x5627b7[_0x6c47('0x32')];if(!_0x3ee263[_0x6c47('0x2d')][_0x6c47('0x33')](_0x6c47('0x4a'))){_0x105395['limit']=qs[_0x6c47('0x1c')](_0x3ee263[_0x6c47('0x2d')][_0x6c47('0x1c')]);_0x105395[_0x6c47('0x1b')]=qs['offset'](_0x3ee263[_0x6c47('0x2d')][_0x6c47('0x1b')]);}return _0x8837a5[_0x6c47('0x47')](_0x105395);}})[_0x6c47('0x21')](function(_0x1b1eb3){if(_0x1b1eb3){return _0x1b1eb3?{'count':_0x2cd123,'rows':_0x1b1eb3}:null;}})['then'](respondWithResult(_0x33180b,null))[_0x6c47('0x3e')](handleError(_0x33180b,null));};exports[_0x6c47('0x4b')]=function(_0x3ce20d,_0x2a5eee,_0x25cafc){var _0x26d3af={};var _0x17f252={};var _0x56fb9e;var _0x58c972;return db[_0x6c47('0x28')][_0x6c47('0x48')]({'where':{'id':_0x3ce20d[_0x6c47('0x45')]['id']}})[_0x6c47('0x21')](handleEntityNotFound(_0x2a5eee,null))['then'](function(_0x438593){if(_0x438593){_0x56fb9e=_0x438593;_0x17f252[_0x6c47('0x2c')]=_[_0x6c47('0x40')](db[_0x6c47('0x49')][_0x6c47('0x29')]);_0x17f252[_0x6c47('0x2d')]=_[_0x6c47('0x40')](_0x3ce20d[_0x6c47('0x2d')]);_0x17f252[_0x6c47('0x2e')]=_[_0x6c47('0x2f')](_0x17f252['model'],_0x17f252[_0x6c47('0x2d')]);_0x26d3af[_0x6c47('0x31')]=_[_0x6c47('0x2f')](_0x17f252[_0x6c47('0x2c')],qs[_0x6c47('0x30')](_0x3ce20d[_0x6c47('0x2d')][_0x6c47('0x30')]));_0x26d3af[_0x6c47('0x31')]=_0x26d3af[_0x6c47('0x31')][_0x6c47('0x32')]?_0x26d3af[_0x6c47('0x31')]:_0x17f252[_0x6c47('0x2c')];_0x26d3af[_0x6c47('0x34')]=qs[_0x6c47('0x35')](_0x3ce20d[_0x6c47('0x2d')]['sort']);_0x26d3af[_0x6c47('0x38')]=qs['filters'](_['pick'](_0x3ce20d[_0x6c47('0x2d')],_0x17f252[_0x6c47('0x2e')]));if(_0x3ce20d[_0x6c47('0x2d')][_0x6c47('0x3a')]){_0x26d3af[_0x6c47('0x38')]=_[_0x6c47('0x37')](_0x26d3af[_0x6c47('0x38')],{'$or':_[_0x6c47('0x27')](_0x26d3af[_0x6c47('0x31')],function(_0x16107c){var _0xf57432={};_0xf57432[_0x16107c]={'$like':'%'+_0x3ce20d[_0x6c47('0x2d')][_0x6c47('0x3a')]+'%'};return _0xf57432;})});}_0x26d3af=_['merge']({},_0x26d3af,_0x3ce20d['options']);return _0x56fb9e[_0x6c47('0x4b')](_0x26d3af);}})[_0x6c47('0x21')](function(_0x4682b7){if(_0x4682b7){_0x58c972=_0x4682b7[_0x6c47('0x32')];if(!_0x3ce20d[_0x6c47('0x2d')][_0x6c47('0x33')]('nolimit')){_0x26d3af[_0x6c47('0x1c')]=qs[_0x6c47('0x1c')](_0x3ce20d['query'][_0x6c47('0x1c')]);_0x26d3af[_0x6c47('0x1b')]=qs['offset'](_0x3ce20d['query'][_0x6c47('0x1b')]);}return _0x56fb9e[_0x6c47('0x4b')](_0x26d3af);}})[_0x6c47('0x21')](function(_0x1f716e){if(_0x1f716e){return _0x1f716e?{'count':_0x58c972,'rows':_0x1f716e}:null;}})[_0x6c47('0x21')](respondWithResult(_0x2a5eee,null))['catch'](handleError(_0x2a5eee,null));};exports[_0x6c47('0x4c')]=function(_0x17dc08,_0x4b7077,_0x4df2d8){var _0x467481={};var _0xe468ac={};var _0x2092fc;var _0x3f87cb;return db[_0x6c47('0x28')][_0x6c47('0x48')]({'where':{'id':_0x17dc08['params']['id']}})[_0x6c47('0x21')](handleEntityNotFound(_0x4b7077,null))['then'](function(_0x11d4fd){if(_0x11d4fd){_0x2092fc=_0x11d4fd;_0xe468ac['model']=_['keys'](db[_0x6c47('0x49')][_0x6c47('0x29')]);_0xe468ac[_0x6c47('0x2d')]=_[_0x6c47('0x40')](_0x17dc08['query']);_0xe468ac[_0x6c47('0x2e')]=_[_0x6c47('0x2f')](_0xe468ac[_0x6c47('0x2c')],_0xe468ac[_0x6c47('0x2d')]);_0x467481[_0x6c47('0x31')]=_[_0x6c47('0x2f')](_0xe468ac[_0x6c47('0x2c')],qs[_0x6c47('0x30')](_0x17dc08[_0x6c47('0x2d')][_0x6c47('0x30')]));_0x467481['attributes']=_0x467481['attributes'][_0x6c47('0x32')]?_0x467481[_0x6c47('0x31')]:_0xe468ac['model'];_0x467481[_0x6c47('0x34')]=qs['sort'](_0x17dc08[_0x6c47('0x2d')][_0x6c47('0x35')]);_0x467481[_0x6c47('0x38')]=qs['filters'](_[_0x6c47('0x36')](_0x17dc08[_0x6c47('0x2d')],_0xe468ac['filters']));if(_0x17dc08['query'][_0x6c47('0x3a')]){_0x467481[_0x6c47('0x38')]=_[_0x6c47('0x37')](_0x467481['where'],{'$or':_['map'](_0x467481[_0x6c47('0x31')],function(_0xc5123){var _0x20a655={};_0x20a655[_0xc5123]={'$like':'%'+_0x17dc08[_0x6c47('0x2d')]['filter']+'%'};return _0x20a655;})});}_0x467481=_['merge']({},_0x467481,_0x17dc08['options']);return _0x2092fc[_0x6c47('0x4c')](_0x467481);}})['then'](function(_0x11b96c){if(_0x11b96c){_0x3f87cb=_0x11b96c[_0x6c47('0x32')];if(!_0x17dc08['query'][_0x6c47('0x33')](_0x6c47('0x4a'))){_0x467481[_0x6c47('0x1c')]=qs[_0x6c47('0x1c')](_0x17dc08[_0x6c47('0x2d')][_0x6c47('0x1c')]);_0x467481[_0x6c47('0x1b')]=qs[_0x6c47('0x1b')](_0x17dc08[_0x6c47('0x2d')][_0x6c47('0x1b')]);}return _0x2092fc[_0x6c47('0x4c')](_0x467481);}})[_0x6c47('0x21')](function(_0x55f152){if(_0x55f152){return _0x55f152?{'count':_0x3f87cb,'rows':_0x55f152}:null;}})[_0x6c47('0x21')](respondWithResult(_0x4b7077,null))[_0x6c47('0x3e')](handleError(_0x4b7077,null));};exports[_0x6c47('0x4d')]=function(_0x1988fc,_0x36cd3a,_0x3db9f2){var _0x323c79={};var _0x5aef53={};var _0x4e1646;var _0x122354;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1988fc[_0x6c47('0x45')]['id']}})['then'](handleEntityNotFound(_0x36cd3a,null))['then'](function(_0x59794f){if(_0x59794f){_0x4e1646=_0x59794f;_0x5aef53['model']=_['keys'](db[_0x6c47('0x4e')][_0x6c47('0x29')]);_0x5aef53[_0x6c47('0x2d')]=_[_0x6c47('0x40')](_0x1988fc[_0x6c47('0x2d')]);_0x5aef53[_0x6c47('0x2e')]=_['intersection'](_0x5aef53[_0x6c47('0x2c')],_0x5aef53[_0x6c47('0x2d')]);_0x323c79[_0x6c47('0x31')]=_[_0x6c47('0x2f')](_0x5aef53[_0x6c47('0x2c')],qs[_0x6c47('0x30')](_0x1988fc[_0x6c47('0x2d')][_0x6c47('0x30')]));_0x323c79[_0x6c47('0x31')]=_0x323c79[_0x6c47('0x31')]['length']?_0x323c79[_0x6c47('0x31')]:_0x5aef53[_0x6c47('0x2c')];_0x323c79[_0x6c47('0x34')]=qs['sort'](_0x1988fc['query'][_0x6c47('0x35')]);_0x323c79[_0x6c47('0x38')]=qs['filters'](_['pick'](_0x1988fc[_0x6c47('0x2d')],_0x5aef53['filters']));if(_0x1988fc['query'][_0x6c47('0x3a')]){_0x323c79[_0x6c47('0x38')]=_[_0x6c47('0x37')](_0x323c79[_0x6c47('0x38')],{'$or':_['map'](_0x323c79[_0x6c47('0x31')],function(_0x3ebe8d){var _0x560e9d={};_0x560e9d[_0x3ebe8d]={'$like':'%'+_0x1988fc[_0x6c47('0x2d')]['filter']+'%'};return _0x560e9d;})});}_0x323c79=_[_0x6c47('0x37')]({},_0x323c79,_0x1988fc[_0x6c47('0x3b')]);return _0x4e1646[_0x6c47('0x4d')](_0x323c79);}})[_0x6c47('0x21')](function(_0x2ee030){if(_0x2ee030){_0x122354=_0x2ee030[_0x6c47('0x32')];if(!_0x1988fc[_0x6c47('0x2d')]['hasOwnProperty'](_0x6c47('0x4a'))){_0x323c79['limit']=qs[_0x6c47('0x1c')](_0x1988fc[_0x6c47('0x2d')][_0x6c47('0x1c')]);_0x323c79['offset']=qs['offset'](_0x1988fc[_0x6c47('0x2d')][_0x6c47('0x1b')]);}return _0x4e1646[_0x6c47('0x4d')](_0x323c79);}})[_0x6c47('0x21')](function(_0x463039){if(_0x463039){return _0x463039?{'count':_0x122354,'rows':_0x463039}:null;}})[_0x6c47('0x21')](respondWithResult(_0x36cd3a,null))[_0x6c47('0x3e')](handleError(_0x36cd3a,null));};exports[_0x6c47('0x4f')]=function(_0x2aeeb9,_0x550bfe,_0x4c48ae){if(_0x2aeeb9[_0x6c47('0x44')]['id']){delete _0x2aeeb9['body']['id'];}return db[_0x6c47('0x28')][_0x6c47('0x48')]({'where':{'id':_0x2aeeb9[_0x6c47('0x45')]['id']}})[_0x6c47('0x21')](handleEntityNotFound(_0x550bfe,null))[_0x6c47('0x21')](function(_0x209c53){if(_0x209c53){return _0x209c53[_0x6c47('0x4f')](_0x2aeeb9[_0x6c47('0x44')][_0x6c47('0x50')]||[]);}return null;})['then'](respondWithResult(_0x550bfe,null))[_0x6c47('0x3e')](handleError(_0x550bfe,null));}; \ No newline at end of file +var _0x23ec=['model','includeAll','include','find','create','catch','body','getFields','findOne','ZendeskField','order','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','filter','options','findAll','show','params'];(function(_0x50ae15,_0x5381d){var _0x3469ea=function(_0x1c03a1){while(--_0x1c03a1){_0x50ae15['push'](_0x50ae15['shift']());}};_0x3469ea(++_0x5381d);}(_0x23ec,0x64));var _0xc23e=function(_0x74af3c,_0x4f53aa){_0x74af3c=_0x74af3c-0x0;var _0x1fca3e=_0x23ec[_0x74af3c];return _0x1fca3e;};'use strict';var emlformat=require(_0xc23e('0x0'));var rimraf=require(_0xc23e('0x1'));var zipdir=require(_0xc23e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc23e('0x3'));var moment=require(_0xc23e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc23e('0x5'));var util=require(_0xc23e('0x6'));var path=require('path');var sox=require(_0xc23e('0x7'));var csv=require(_0xc23e('0x8'));var ejs=require(_0xc23e('0x9'));var fs=require('fs');var fs_extra=require(_0xc23e('0xa'));var _=require(_0xc23e('0xb'));var squel=require(_0xc23e('0xc'));var crypto=require(_0xc23e('0xd'));var jsforce=require(_0xc23e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc23e('0x8'));var querystring=require(_0xc23e('0xf'));var Papa=require(_0xc23e('0x10'));var Redis=require('ioredis');var authService=require(_0xc23e('0x11'));var qs=require(_0xc23e('0x12'));var as=require(_0xc23e('0x13'));var hardwareService=require(_0xc23e('0x14'));var logger=require(_0xc23e('0x15'))(_0xc23e('0x16'));var utils=require('../../config/utils');var config=require(_0xc23e('0x17'));var licenseUtil=require(_0xc23e('0x18'));var db=require(_0xc23e('0x19'))['db'];function respondWithStatusCode(_0x1c28f0,_0x134199){_0x134199=_0x134199||0xcc;return function(_0x54f3ff){if(_0x54f3ff){return _0x1c28f0[_0xc23e('0x1a')](_0x134199);}return _0x1c28f0[_0xc23e('0x1b')](_0x134199)[_0xc23e('0x1c')]();};}function respondWithResult(_0x503666,_0x1cf787){_0x1cf787=_0x1cf787||0xc8;return function(_0x4ef6ba){if(_0x4ef6ba){return _0x503666[_0xc23e('0x1b')](_0x1cf787)[_0xc23e('0x1d')](_0x4ef6ba);}};}function respondWithFilteredResult(_0x4df2b1,_0x5482dc){return function(_0x501606){if(_0x501606){var _0x4cdc03=typeof _0x5482dc['offset']==='undefined'&&typeof _0x5482dc[_0xc23e('0x1e')]==='undefined';var _0x341a99=_0x501606['count'];var _0x5ad0c3=_0x4cdc03?0x0:_0x5482dc[_0xc23e('0x1f')];var _0x8b0cc0=_0x4cdc03?_0x501606[_0xc23e('0x20')]:_0x5482dc[_0xc23e('0x1f')]+_0x5482dc[_0xc23e('0x1e')];var _0x30d5aa;if(_0x8b0cc0>=_0x341a99){_0x8b0cc0=_0x341a99;_0x30d5aa=0xc8;}else{_0x30d5aa=0xce;}_0x4df2b1[_0xc23e('0x1b')](_0x30d5aa);return _0x4df2b1[_0xc23e('0x21')]('Content-Range',_0x5ad0c3+'-'+_0x8b0cc0+'/'+_0x341a99)[_0xc23e('0x1d')](_0x501606);}return null;};}function patchUpdates(_0x47993d){return function(_0x221c60){try{jsonpatch['apply'](_0x221c60,_0x47993d,!![]);}catch(_0x45a2e1){return BPromise[_0xc23e('0x22')](_0x45a2e1);}return _0x221c60[_0xc23e('0x23')]();};}function saveUpdates(_0x2603c9,_0x15dac7){return function(_0x5f18e9){if(_0x5f18e9){return _0x5f18e9[_0xc23e('0x24')](_0x2603c9)[_0xc23e('0x25')](function(_0x82c80e){return _0x82c80e;});}return null;};}function removeEntity(_0x5b0029,_0x8f1372){return function(_0x32f712){if(_0x32f712){return _0x32f712[_0xc23e('0x26')]()[_0xc23e('0x25')](function(){_0x5b0029[_0xc23e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19217a,_0x47c163){return function(_0x5e536d){if(!_0x5e536d){_0x19217a[_0xc23e('0x1a')](0x194);}return _0x5e536d;};}function handleError(_0x157605,_0x323dfe){_0x323dfe=_0x323dfe||0x1f4;return function(_0x5b8161){logger[_0xc23e('0x27')](_0x5b8161[_0xc23e('0x28')]);if(_0x5b8161[_0xc23e('0x29')]){delete _0x5b8161[_0xc23e('0x29')];}_0x157605['status'](_0x323dfe)[_0xc23e('0x2a')](_0x5b8161);};}exports[_0xc23e('0x2b')]=function(_0x5986ab,_0x3e8925){var _0x3113eb={},_0x3732b3={},_0x2cc007={'count':0x0,'rows':[]};var _0x17237c=_[_0xc23e('0x2c')](db[_0xc23e('0x2d')][_0xc23e('0x2e')],function(_0x40f41c){return{'name':_0x40f41c[_0xc23e('0x2f')],'type':_0x40f41c[_0xc23e('0x30')]['key']};});_0x3732b3['model']=_[_0xc23e('0x2c')](_0x17237c,_0xc23e('0x29'));_0x3732b3[_0xc23e('0x31')]=_[_0xc23e('0x32')](_0x5986ab[_0xc23e('0x31')]);_0x3732b3[_0xc23e('0x33')]=_[_0xc23e('0x34')](_0x3732b3['model'],_0x3732b3[_0xc23e('0x31')]);_0x3113eb[_0xc23e('0x35')]=_[_0xc23e('0x34')](_0x3732b3['model'],qs['fields'](_0x5986ab[_0xc23e('0x31')][_0xc23e('0x36')]));_0x3113eb[_0xc23e('0x35')]=_0x3113eb[_0xc23e('0x35')][_0xc23e('0x37')]?_0x3113eb[_0xc23e('0x35')]:_0x3732b3['model'];if(!_0x5986ab['query'][_0xc23e('0x38')]('nolimit')){_0x3113eb[_0xc23e('0x1e')]=qs[_0xc23e('0x1e')](_0x5986ab['query']['limit']);_0x3113eb['offset']=qs[_0xc23e('0x1f')](_0x5986ab[_0xc23e('0x31')]['offset']);}_0x3113eb['order']=qs['sort'](_0x5986ab['query'][_0xc23e('0x39')]);_0x3113eb[_0xc23e('0x3a')]=qs[_0xc23e('0x33')](_[_0xc23e('0x3b')](_0x5986ab[_0xc23e('0x31')],_0x3732b3[_0xc23e('0x33')]),_0x17237c);if(_0x5986ab['query']['filter']){_0x3113eb[_0xc23e('0x3a')]=_[_0xc23e('0x3c')](_0x3113eb[_0xc23e('0x3a')],{'$or':_[_0xc23e('0x2c')](_0x17237c,function(_0x16e9ff){if(_0x16e9ff[_0xc23e('0x30')]!=='VIRTUAL'){var _0xd46001={};_0xd46001[_0x16e9ff[_0xc23e('0x29')]]={'$like':'%'+_0x5986ab[_0xc23e('0x31')][_0xc23e('0x3d')]+'%'};return _0xd46001;}})});}_0x3113eb=_[_0xc23e('0x3c')]({},_0x3113eb,_0x5986ab[_0xc23e('0x3e')]);var _0x210fe4={'where':_0x3113eb[_0xc23e('0x3a')]};return db[_0xc23e('0x2d')][_0xc23e('0x20')](_0x210fe4)['then'](function(_0xa2103a){_0x2cc007['count']=_0xa2103a;if(_0x5986ab[_0xc23e('0x31')]['includeAll']){_0x3113eb['include']=[{'all':!![]}];}return db[_0xc23e('0x2d')][_0xc23e('0x3f')](_0x3113eb);})[_0xc23e('0x25')](function(_0x134253){_0x2cc007['rows']=_0x134253;return _0x2cc007;})[_0xc23e('0x25')](respondWithFilteredResult(_0x3e8925,_0x3113eb))['catch'](handleError(_0x3e8925,null));};exports[_0xc23e('0x40')]=function(_0x31bc8f,_0x15f16c){var _0x105977={'raw':![],'where':{'id':_0x31bc8f[_0xc23e('0x41')]['id']}},_0x1cd20f={};_0x1cd20f[_0xc23e('0x42')]=_[_0xc23e('0x32')](db['ZendeskConfiguration']['rawAttributes']);_0x1cd20f['query']=_['keys'](_0x31bc8f[_0xc23e('0x31')]);_0x1cd20f[_0xc23e('0x33')]=_['intersection'](_0x1cd20f[_0xc23e('0x42')],_0x1cd20f[_0xc23e('0x31')]);_0x105977[_0xc23e('0x35')]=_[_0xc23e('0x34')](_0x1cd20f['model'],qs[_0xc23e('0x36')](_0x31bc8f[_0xc23e('0x31')][_0xc23e('0x36')]));_0x105977[_0xc23e('0x35')]=_0x105977[_0xc23e('0x35')][_0xc23e('0x37')]?_0x105977[_0xc23e('0x35')]:_0x1cd20f['model'];if(_0x31bc8f[_0xc23e('0x31')][_0xc23e('0x43')]){_0x105977[_0xc23e('0x44')]=[{'all':!![]}];}_0x105977=_[_0xc23e('0x3c')]({},_0x105977,_0x31bc8f[_0xc23e('0x3e')]);return db[_0xc23e('0x2d')][_0xc23e('0x45')](_0x105977)[_0xc23e('0x25')](handleEntityNotFound(_0x15f16c,null))[_0xc23e('0x25')](respondWithResult(_0x15f16c,null))['catch'](handleError(_0x15f16c,null));};exports[_0xc23e('0x46')]=function(_0x45e8db,_0x3506a5){return db[_0xc23e('0x2d')][_0xc23e('0x46')](_0x45e8db['body'],{})[_0xc23e('0x25')](respondWithResult(_0x3506a5,0xc9))[_0xc23e('0x47')](handleError(_0x3506a5,null));};exports[_0xc23e('0x24')]=function(_0x492319,_0x56a5c5){if(_0x492319[_0xc23e('0x48')]['id']){delete _0x492319[_0xc23e('0x48')]['id'];}return db['ZendeskConfiguration'][_0xc23e('0x45')]({'where':{'id':_0x492319[_0xc23e('0x41')]['id']}})[_0xc23e('0x25')](handleEntityNotFound(_0x56a5c5,null))[_0xc23e('0x25')](saveUpdates(_0x492319[_0xc23e('0x48')],null))[_0xc23e('0x25')](respondWithResult(_0x56a5c5,null))[_0xc23e('0x47')](handleError(_0x56a5c5,null));};exports[_0xc23e('0x26')]=function(_0x272390,_0x2aa121){return db[_0xc23e('0x2d')][_0xc23e('0x45')]({'where':{'id':_0x272390[_0xc23e('0x41')]['id']}})['then'](handleEntityNotFound(_0x2aa121,null))[_0xc23e('0x25')](removeEntity(_0x2aa121,null))[_0xc23e('0x47')](handleError(_0x2aa121,null));};exports[_0xc23e('0x49')]=function(_0x36d086,_0x2b33cc,_0x3a9d64){var _0x5c62da={};var _0x460f5f={};var _0x1199b9;var _0x5dd413;return db['ZendeskConfiguration'][_0xc23e('0x4a')]({'where':{'id':_0x36d086['params']['id']}})[_0xc23e('0x25')](handleEntityNotFound(_0x2b33cc,null))[_0xc23e('0x25')](function(_0x2339ed){if(_0x2339ed){_0x1199b9=_0x2339ed;_0x460f5f[_0xc23e('0x42')]=_[_0xc23e('0x32')](db[_0xc23e('0x4b')]['rawAttributes']);_0x460f5f[_0xc23e('0x31')]=_[_0xc23e('0x32')](_0x36d086[_0xc23e('0x31')]);_0x460f5f[_0xc23e('0x33')]=_['intersection'](_0x460f5f['model'],_0x460f5f[_0xc23e('0x31')]);_0x5c62da[_0xc23e('0x35')]=_[_0xc23e('0x34')](_0x460f5f['model'],qs[_0xc23e('0x36')](_0x36d086[_0xc23e('0x31')]['fields']));_0x5c62da[_0xc23e('0x35')]=_0x5c62da['attributes'][_0xc23e('0x37')]?_0x5c62da[_0xc23e('0x35')]:_0x460f5f[_0xc23e('0x42')];_0x5c62da[_0xc23e('0x4c')]=qs[_0xc23e('0x39')](_0x36d086[_0xc23e('0x31')][_0xc23e('0x39')]);_0x5c62da[_0xc23e('0x3a')]=qs[_0xc23e('0x33')](_['pick'](_0x36d086[_0xc23e('0x31')],_0x460f5f[_0xc23e('0x33')]));if(_0x36d086['query'][_0xc23e('0x3d')]){_0x5c62da[_0xc23e('0x3a')]=_['merge'](_0x5c62da[_0xc23e('0x3a')],{'$or':_['map'](_0x5c62da[_0xc23e('0x35')],function(_0x771402){var _0x557f68={};_0x557f68[_0x771402]={'$like':'%'+_0x36d086[_0xc23e('0x31')][_0xc23e('0x3d')]+'%'};return _0x557f68;})});}_0x5c62da=_['merge']({},_0x5c62da,_0x36d086[_0xc23e('0x3e')]);return _0x1199b9[_0xc23e('0x49')](_0x5c62da);}})['then'](function(_0xaa9bcf){if(_0xaa9bcf){_0x5dd413=_0xaa9bcf[_0xc23e('0x37')];if(!_0x36d086[_0xc23e('0x31')][_0xc23e('0x38')](_0xc23e('0x4d'))){_0x5c62da[_0xc23e('0x1e')]=qs[_0xc23e('0x1e')](_0x36d086[_0xc23e('0x31')][_0xc23e('0x1e')]);_0x5c62da[_0xc23e('0x1f')]=qs[_0xc23e('0x1f')](_0x36d086[_0xc23e('0x31')][_0xc23e('0x1f')]);}return _0x1199b9[_0xc23e('0x49')](_0x5c62da);}})[_0xc23e('0x25')](function(_0x399a21){if(_0x399a21){return _0x399a21?{'count':_0x5dd413,'rows':_0x399a21}:null;}})['then'](respondWithResult(_0x2b33cc,null))[_0xc23e('0x47')](handleError(_0x2b33cc,null));};exports[_0xc23e('0x4e')]=function(_0x335f32,_0x4362f0,_0x132d4a){var _0x2ea5a6={};var _0x1c1a07={};var _0x3b00be;var _0x19f4f2;return db[_0xc23e('0x2d')]['findOne']({'where':{'id':_0x335f32[_0xc23e('0x41')]['id']}})[_0xc23e('0x25')](handleEntityNotFound(_0x4362f0,null))[_0xc23e('0x25')](function(_0x3c4887){if(_0x3c4887){_0x3b00be=_0x3c4887;_0x1c1a07[_0xc23e('0x42')]=_['keys'](db[_0xc23e('0x4b')]['rawAttributes']);_0x1c1a07[_0xc23e('0x31')]=_['keys'](_0x335f32['query']);_0x1c1a07[_0xc23e('0x33')]=_['intersection'](_0x1c1a07['model'],_0x1c1a07[_0xc23e('0x31')]);_0x2ea5a6[_0xc23e('0x35')]=_[_0xc23e('0x34')](_0x1c1a07[_0xc23e('0x42')],qs[_0xc23e('0x36')](_0x335f32[_0xc23e('0x31')][_0xc23e('0x36')]));_0x2ea5a6['attributes']=_0x2ea5a6[_0xc23e('0x35')][_0xc23e('0x37')]?_0x2ea5a6[_0xc23e('0x35')]:_0x1c1a07[_0xc23e('0x42')];_0x2ea5a6[_0xc23e('0x4c')]=qs[_0xc23e('0x39')](_0x335f32[_0xc23e('0x31')]['sort']);_0x2ea5a6['where']=qs[_0xc23e('0x33')](_[_0xc23e('0x3b')](_0x335f32['query'],_0x1c1a07[_0xc23e('0x33')]));if(_0x335f32['query'][_0xc23e('0x3d')]){_0x2ea5a6[_0xc23e('0x3a')]=_[_0xc23e('0x3c')](_0x2ea5a6[_0xc23e('0x3a')],{'$or':_[_0xc23e('0x2c')](_0x2ea5a6[_0xc23e('0x35')],function(_0x347eb3){var _0x284b63={};_0x284b63[_0x347eb3]={'$like':'%'+_0x335f32[_0xc23e('0x31')]['filter']+'%'};return _0x284b63;})});}_0x2ea5a6=_[_0xc23e('0x3c')]({},_0x2ea5a6,_0x335f32['options']);return _0x3b00be['getSubjects'](_0x2ea5a6);}})[_0xc23e('0x25')](function(_0x5ab92c){if(_0x5ab92c){_0x19f4f2=_0x5ab92c['length'];if(!_0x335f32[_0xc23e('0x31')]['hasOwnProperty'](_0xc23e('0x4d'))){_0x2ea5a6['limit']=qs['limit'](_0x335f32['query'][_0xc23e('0x1e')]);_0x2ea5a6['offset']=qs[_0xc23e('0x1f')](_0x335f32[_0xc23e('0x31')][_0xc23e('0x1f')]);}return _0x3b00be[_0xc23e('0x4e')](_0x2ea5a6);}})['then'](function(_0x4a42da){if(_0x4a42da){return _0x4a42da?{'count':_0x19f4f2,'rows':_0x4a42da}:null;}})[_0xc23e('0x25')](respondWithResult(_0x4362f0,null))[_0xc23e('0x47')](handleError(_0x4362f0,null));};exports[_0xc23e('0x4f')]=function(_0x1c7108,_0x41eef6,_0x29771e){var _0x4020a6={};var _0x1aad92={};var _0x1ed9ea;var _0x45a02e;return db[_0xc23e('0x2d')][_0xc23e('0x4a')]({'where':{'id':_0x1c7108[_0xc23e('0x41')]['id']}})['then'](handleEntityNotFound(_0x41eef6,null))[_0xc23e('0x25')](function(_0x147893){if(_0x147893){_0x1ed9ea=_0x147893;_0x1aad92[_0xc23e('0x42')]=_[_0xc23e('0x32')](db['ZendeskField']['rawAttributes']);_0x1aad92[_0xc23e('0x31')]=_[_0xc23e('0x32')](_0x1c7108['query']);_0x1aad92['filters']=_[_0xc23e('0x34')](_0x1aad92[_0xc23e('0x42')],_0x1aad92['query']);_0x4020a6[_0xc23e('0x35')]=_[_0xc23e('0x34')](_0x1aad92[_0xc23e('0x42')],qs['fields'](_0x1c7108[_0xc23e('0x31')]['fields']));_0x4020a6[_0xc23e('0x35')]=_0x4020a6['attributes'][_0xc23e('0x37')]?_0x4020a6['attributes']:_0x1aad92[_0xc23e('0x42')];_0x4020a6[_0xc23e('0x4c')]=qs['sort'](_0x1c7108['query'][_0xc23e('0x39')]);_0x4020a6[_0xc23e('0x3a')]=qs[_0xc23e('0x33')](_[_0xc23e('0x3b')](_0x1c7108['query'],_0x1aad92['filters']));if(_0x1c7108[_0xc23e('0x31')][_0xc23e('0x3d')]){_0x4020a6[_0xc23e('0x3a')]=_[_0xc23e('0x3c')](_0x4020a6[_0xc23e('0x3a')],{'$or':_['map'](_0x4020a6[_0xc23e('0x35')],function(_0x336006){var _0x438a1e={};_0x438a1e[_0x336006]={'$like':'%'+_0x1c7108[_0xc23e('0x31')][_0xc23e('0x3d')]+'%'};return _0x438a1e;})});}_0x4020a6=_[_0xc23e('0x3c')]({},_0x4020a6,_0x1c7108['options']);return _0x1ed9ea['getDescriptions'](_0x4020a6);}})[_0xc23e('0x25')](function(_0x596c81){if(_0x596c81){_0x45a02e=_0x596c81[_0xc23e('0x37')];if(!_0x1c7108['query'][_0xc23e('0x38')](_0xc23e('0x4d'))){_0x4020a6[_0xc23e('0x1e')]=qs[_0xc23e('0x1e')](_0x1c7108[_0xc23e('0x31')][_0xc23e('0x1e')]);_0x4020a6[_0xc23e('0x1f')]=qs['offset'](_0x1c7108['query'][_0xc23e('0x1f')]);}return _0x1ed9ea[_0xc23e('0x4f')](_0x4020a6);}})[_0xc23e('0x25')](function(_0x5c9bb4){if(_0x5c9bb4){return _0x5c9bb4?{'count':_0x45a02e,'rows':_0x5c9bb4}:null;}})[_0xc23e('0x25')](respondWithResult(_0x41eef6,null))['catch'](handleError(_0x41eef6,null));};exports[_0xc23e('0x50')]=function(_0x59de8f,_0xad3daa,_0xf35b8e){var _0x5f28b0={};var _0x64d61d={};var _0x42485b;var _0xb5a18e;return db['ZendeskConfiguration'][_0xc23e('0x4a')]({'where':{'id':_0x59de8f['params']['id']}})[_0xc23e('0x25')](handleEntityNotFound(_0xad3daa,null))[_0xc23e('0x25')](function(_0x573779){if(_0x573779){_0x42485b=_0x573779;_0x64d61d[_0xc23e('0x42')]=_[_0xc23e('0x32')](db[_0xc23e('0x51')]['rawAttributes']);_0x64d61d[_0xc23e('0x31')]=_[_0xc23e('0x32')](_0x59de8f[_0xc23e('0x31')]);_0x64d61d['filters']=_[_0xc23e('0x34')](_0x64d61d[_0xc23e('0x42')],_0x64d61d[_0xc23e('0x31')]);_0x5f28b0[_0xc23e('0x35')]=_[_0xc23e('0x34')](_0x64d61d[_0xc23e('0x42')],qs[_0xc23e('0x36')](_0x59de8f['query'][_0xc23e('0x36')]));_0x5f28b0[_0xc23e('0x35')]=_0x5f28b0['attributes']['length']?_0x5f28b0['attributes']:_0x64d61d['model'];_0x5f28b0['order']=qs[_0xc23e('0x39')](_0x59de8f[_0xc23e('0x31')]['sort']);_0x5f28b0[_0xc23e('0x3a')]=qs[_0xc23e('0x33')](_[_0xc23e('0x3b')](_0x59de8f['query'],_0x64d61d[_0xc23e('0x33')]));if(_0x59de8f['query']['filter']){_0x5f28b0[_0xc23e('0x3a')]=_['merge'](_0x5f28b0[_0xc23e('0x3a')],{'$or':_[_0xc23e('0x2c')](_0x5f28b0[_0xc23e('0x35')],function(_0x579a9c){var _0x3f2cc2={};_0x3f2cc2[_0x579a9c]={'$like':'%'+_0x59de8f[_0xc23e('0x31')]['filter']+'%'};return _0x3f2cc2;})});}_0x5f28b0=_[_0xc23e('0x3c')]({},_0x5f28b0,_0x59de8f[_0xc23e('0x3e')]);return _0x42485b[_0xc23e('0x50')](_0x5f28b0);}})[_0xc23e('0x25')](function(_0x1e6a20){if(_0x1e6a20){_0xb5a18e=_0x1e6a20['length'];if(!_0x59de8f[_0xc23e('0x31')][_0xc23e('0x38')]('nolimit')){_0x5f28b0['limit']=qs['limit'](_0x59de8f[_0xc23e('0x31')][_0xc23e('0x1e')]);_0x5f28b0['offset']=qs[_0xc23e('0x1f')](_0x59de8f[_0xc23e('0x31')]['offset']);}return _0x42485b[_0xc23e('0x50')](_0x5f28b0);}})['then'](function(_0x37839f){if(_0x37839f){return _0x37839f?{'count':_0xb5a18e,'rows':_0x37839f}:null;}})['then'](respondWithResult(_0xad3daa,null))[_0xc23e('0x47')](handleError(_0xad3daa,null));};exports[_0xc23e('0x52')]=function(_0x2e647f,_0x2d3580,_0x498ed2){if(_0x2e647f['body']['id']){delete _0x2e647f[_0xc23e('0x48')]['id'];}return db[_0xc23e('0x2d')][_0xc23e('0x4a')]({'where':{'id':_0x2e647f[_0xc23e('0x41')]['id']}})[_0xc23e('0x25')](handleEntityNotFound(_0x2d3580,null))[_0xc23e('0x25')](function(_0x9249de){if(_0x9249de){return _0x9249de[_0xc23e('0x52')](_0x2e647f[_0xc23e('0x48')]['ids']||[]);}return null;})[_0xc23e('0x25')](respondWithResult(_0x2d3580,null))[_0xc23e('0x47')](handleError(_0x2d3580,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index a84ea6c..84e9dd1 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 _0x8952=['exports','int_zendesk_configurations','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x357b6d,_0x4a602e){var _0x4ca58c=function(_0x4ae88a){while(--_0x4ae88a){_0x357b6d['push'](_0x357b6d['shift']());}};_0x4ca58c(++_0x4a602e);}(_0x8952,0x17e));var _0x2895=function(_0x217dff,_0x559024){_0x217dff=_0x217dff-0x0;var _0x31540a=_0x8952[_0x217dff];return _0x31540a;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var logger=require(_0x2895('0x1'))(_0x2895('0x2'));var moment=require(_0x2895('0x3'));var BPromise=require(_0x2895('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2895('0x5'));var rimraf=require(_0x2895('0x6'));var config=require(_0x2895('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x2895('0x8')]=function(_0x73c245,_0x37305b){return _0x73c245['define']('ZendeskConfiguration',attributes,{'tableName':_0x2895('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb44a=['../../config/logger','moment','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x14cc11,_0x3fb4e3){var _0x581260=function(_0x47a6c4){while(--_0x47a6c4){_0x14cc11['push'](_0x14cc11['shift']());}};_0x581260(++_0x3fb4e3);}(_0xb44a,0x1c2));var _0xab44=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0xb44a[_0x13843f];return _0x1063ae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab44('0x0'))('api');var moment=require(_0xab44('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab44('0x2'));var rimraf=require('rimraf');var config=require(_0xab44('0x3'));var attributes=require(_0xab44('0x4'));module[_0xab44('0x5')]=function(_0x28681a,_0x2f3948){return _0x28681a[_0xab44('0x6')](_0xab44('0x7'),attributes,{'tableName':_0xab44('0x8'),'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 da9663e..8671107 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 _0x6cb0=['debug','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','info','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request\x20sent'];(function(_0x258ec6,_0x34dd32){var _0x5bd9a7=function(_0x14fb6b){while(--_0x14fb6b){_0x258ec6['push'](_0x258ec6['shift']());}};_0x5bd9a7(++_0x34dd32);}(_0x6cb0,0x128));var _0x06cb=function(_0xed6ed0,_0x28e1ad){_0xed6ed0=_0xed6ed0-0x0;var _0x20a428=_0x6cb0[_0xed6ed0];return _0x20a428;};'use strict';var _=require(_0x06cb('0x0'));var util=require('util');var moment=require(_0x06cb('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06cb('0x2'));var db=require(_0x06cb('0x3'))['db'];var utils=require(_0x06cb('0x4'));var logger=require(_0x06cb('0x5'))(_0x06cb('0x6'));var config=require('../../config/environment');var jayson=require(_0x06cb('0x7'));var client=jayson['client'][_0x06cb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x37f49f,_0x2f67c9,_0x2be8d1){return new BPromise(function(_0x4ddcea,_0x707465){return client['request'](_0x37f49f,_0x2be8d1)['then'](function(_0x4f2697){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x2f67c9,_0x06cb('0x9'));logger[_0x06cb('0xa')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2f67c9,'request\x20sent',JSON['stringify'](_0x4f2697));if(_0x4f2697[_0x06cb('0xb')]){if(_0x4f2697[_0x06cb('0xb')][_0x06cb('0xc')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x2f67c9,_0x4f2697[_0x06cb('0xb')]['message']);return _0x707465(_0x4f2697[_0x06cb('0xb')][_0x06cb('0xd')]);}logger[_0x06cb('0xb')](_0x06cb('0xe'),_0x2f67c9,_0x4f2697[_0x06cb('0xb')][_0x06cb('0xd')]);return _0x4ddcea(_0x4f2697[_0x06cb('0xb')][_0x06cb('0xd')]);}else{logger[_0x06cb('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2f67c9,_0x06cb('0x9'));_0x4ddcea(_0x4f2697[_0x06cb('0x10')][_0x06cb('0xd')]);}})[_0x06cb('0x11')](function(_0x3c2707){logger[_0x06cb('0xb')](_0x06cb('0xe'),_0x2f67c9,_0x3c2707);_0x707465(_0x3c2707);});});} \ No newline at end of file +var _0xb4ba=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb4ba,0x16b));var _0xab4b=function(_0xcdac34,_0x43f665){_0xcdac34=_0xcdac34-0x0;var _0x269d23=_0xb4ba[_0xcdac34];return _0x269d23;};'use strict';var _=require(_0xab4b('0x0'));var util=require(_0xab4b('0x1'));var moment=require('moment');var BPromise=require(_0xab4b('0x2'));var rs=require(_0xab4b('0x3'));var fs=require('fs');var Redis=require(_0xab4b('0x4'));var db=require(_0xab4b('0x5'))['db'];var utils=require(_0xab4b('0x6'));var logger=require(_0xab4b('0x7'))(_0xab4b('0x8'));var config=require(_0xab4b('0x9'));var jayson=require(_0xab4b('0xa'));var client=jayson[_0xab4b('0xb')][_0xab4b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6fc7ac,_0x2af34d,_0x4cb0dc){return new BPromise(function(_0x35ad9f,_0x415b7a){return client[_0xab4b('0xd')](_0x6fc7ac,_0x4cb0dc)[_0xab4b('0xe')](function(_0x20ed1a){logger['info'](_0xab4b('0xf'),_0x2af34d,_0xab4b('0x10'));logger[_0xab4b('0x11')](_0xab4b('0x12'),_0x2af34d,_0xab4b('0x10'),JSON[_0xab4b('0x13')](_0x20ed1a));if(_0x20ed1a[_0xab4b('0x14')]){if(_0x20ed1a[_0xab4b('0x14')][_0xab4b('0x15')]===0x1f4){logger[_0xab4b('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2af34d,_0x20ed1a[_0xab4b('0x14')]['message']);return _0x415b7a(_0x20ed1a[_0xab4b('0x14')][_0xab4b('0x16')]);}logger['error'](_0xab4b('0xf'),_0x2af34d,_0x20ed1a[_0xab4b('0x14')]['message']);return _0x35ad9f(_0x20ed1a[_0xab4b('0x14')][_0xab4b('0x16')]);}else{logger['info'](_0xab4b('0xf'),_0x2af34d,_0xab4b('0x10'));_0x35ad9f(_0x20ed1a[_0xab4b('0x17')][_0xab4b('0x16')]);}})['catch'](function(_0x19337b){logger['error'](_0xab4b('0xf'),_0x2af34d,_0x19337b);_0x415b7a(_0x19337b);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 41924d6..abc6965 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 _0x767a=['/:id','show','post','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x767a,0x1d0));var _0xa767=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x767a[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa767('0x0'));var timeout=require(_0xa767('0x1'));var express=require('express');var router=express[_0xa767('0x2')]();var fs_extra=require(_0xa767('0x3'));var auth=require(_0xa767('0x4'));var interaction=require(_0xa767('0x5'));var config=require(_0xa767('0x6'));var controller=require(_0xa767('0x7'));router['get']('/',auth[_0xa767('0x8')](),controller[_0xa767('0x9')]);router[_0xa767('0xa')](_0xa767('0xb'),auth['isAuthenticated'](),controller[_0xa767('0xc')]);router[_0xa767('0xd')]('/',auth[_0xa767('0x8')](),controller['create']);router[_0xa767('0xe')](_0xa767('0xb'),auth[_0xa767('0x8')](),controller[_0xa767('0xf')]);router[_0xa767('0x10')](_0xa767('0xb'),auth[_0xa767('0x8')](),controller[_0xa767('0x11')]);module[_0xa767('0x12')]=router; \ No newline at end of file +var _0xd176=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd176,0x7b));var _0x6d17=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0xd176[_0x587ba2];return _0x50ec73;};'use strict';var multer=require(_0x6d17('0x0'));var util=require('util');var path=require(_0x6d17('0x1'));var timeout=require(_0x6d17('0x2'));var express=require(_0x6d17('0x3'));var router=express[_0x6d17('0x4')]();var fs_extra=require(_0x6d17('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6d17('0x6'));var config=require(_0x6d17('0x7'));var controller=require(_0x6d17('0x8'));router[_0x6d17('0x9')]('/',auth[_0x6d17('0xa')](),controller[_0x6d17('0xb')]);router[_0x6d17('0x9')](_0x6d17('0xc'),auth[_0x6d17('0xa')](),controller[_0x6d17('0xd')]);router[_0x6d17('0xe')]('/',auth[_0x6d17('0xa')](),controller[_0x6d17('0xf')]);router['put'](_0x6d17('0xc'),auth['isAuthenticated'](),controller[_0x6d17('0x10')]);router[_0x6d17('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6d17('0x12')]);module[_0x6d17('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 8f96f53..5333bf4 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 _0x2d56=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2d56,0x163));var _0x62d5=function(_0x561b3d,_0x387dfe){_0x561b3d=_0x561b3d-0x0;var _0x46b183=_0x2d56[_0x561b3d];return _0x46b183;};'use strict';var Sequelize=require(_0x62d5('0x0'));module[_0x62d5('0x1')]={'type':{'type':Sequelize[_0x62d5('0x2')](_0x62d5('0x3'),_0x62d5('0x4'),_0x62d5('0x5'),_0x62d5('0x6'),_0x62d5('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x62d5('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x62d5('0x3'),_0x62d5('0x4'),_0x62d5('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x62d5('0x8')]},'nameField':{'type':Sequelize[_0x62d5('0x8')]},'customField':{'type':Sequelize[_0x62d5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x62d5('0x8')]}}; \ No newline at end of file +var _0x5031=['keyValue','picklist','STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x415573,_0x573a74){var _0x428256=function(_0x53cee5){while(--_0x53cee5){_0x415573['push'](_0x415573['shift']());}};_0x428256(++_0x573a74);}(_0x5031,0x1aa));var _0x1503=function(_0x532e04,_0x453d11){_0x532e04=_0x532e04-0x0;var _0x38b88b=_0x5031[_0x532e04];return _0x38b88b;};'use strict';var Sequelize=require(_0x1503('0x0'));module[_0x1503('0x1')]={'type':{'type':Sequelize[_0x1503('0x2')](_0x1503('0x3'),'variable','customVariable',_0x1503('0x4'),_0x1503('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1503('0x6')]},'keyType':{'type':Sequelize[_0x1503('0x2')](_0x1503('0x3'),_0x1503('0x7'),_0x1503('0x8'))},'keyContent':{'type':Sequelize[_0x1503('0x6')]},'idField':{'type':Sequelize[_0x1503('0x6')]},'nameField':{'type':Sequelize[_0x1503('0x6')]},'customField':{'type':Sequelize[_0x1503('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1503('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 6b34d69..81fce07 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 _0x1a52=['status','json','undefined','limit','count','offset','apply','reject','save','then','destroy','end','error','name','send','index','map','ZendeskField','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','include','find','catch','create','body','update','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x455bba,_0x497fbe){var _0x4a14a0=function(_0x182dfa){while(--_0x182dfa){_0x455bba['push'](_0x455bba['shift']());}};_0x4a14a0(++_0x497fbe);}(_0x1a52,0x115));var _0x21a5=function(_0xe8c3b1,_0x1efd42){_0xe8c3b1=_0xe8c3b1-0x0;var _0x1947b5=_0x1a52[_0xe8c3b1];return _0x1947b5;};'use strict';var emlformat=require(_0x21a5('0x0'));var rimraf=require(_0x21a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x21a5('0x2'));var moment=require(_0x21a5('0x3'));var BPromise=require(_0x21a5('0x4'));var Mustache=require(_0x21a5('0x5'));var util=require(_0x21a5('0x6'));var path=require(_0x21a5('0x7'));var sox=require(_0x21a5('0x8'));var csv=require(_0x21a5('0x9'));var ejs=require(_0x21a5('0xa'));var fs=require('fs');var fs_extra=require(_0x21a5('0xb'));var _=require(_0x21a5('0xc'));var squel=require(_0x21a5('0xd'));var crypto=require(_0x21a5('0xe'));var jsforce=require(_0x21a5('0xf'));var deskjs=require(_0x21a5('0x10'));var toCsv=require(_0x21a5('0x9'));var querystring=require(_0x21a5('0x11'));var Papa=require(_0x21a5('0x12'));var Redis=require(_0x21a5('0x13'));var authService=require(_0x21a5('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x21a5('0x15'));var hardwareService=require(_0x21a5('0x16'));var logger=require(_0x21a5('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x21a5('0x18'));var db=require(_0x21a5('0x19'))['db'];function respondWithStatusCode(_0x502fd5,_0x26016c){_0x26016c=_0x26016c||0xcc;return function(_0xb0fbcc){if(_0xb0fbcc){return _0x502fd5[_0x21a5('0x1a')](_0x26016c);}return _0x502fd5[_0x21a5('0x1b')](_0x26016c)['end']();};}function respondWithResult(_0x286b9e,_0x352916){_0x352916=_0x352916||0xc8;return function(_0x199c11){if(_0x199c11){return _0x286b9e['status'](_0x352916)[_0x21a5('0x1c')](_0x199c11);}};}function respondWithFilteredResult(_0x96fb39,_0x53c545){return function(_0x1ee4db){if(_0x1ee4db){var _0x413a83=typeof _0x53c545['offset']===_0x21a5('0x1d')&&typeof _0x53c545[_0x21a5('0x1e')]==='undefined';var _0x179444=_0x1ee4db[_0x21a5('0x1f')];var _0x43585f=_0x413a83?0x0:_0x53c545[_0x21a5('0x20')];var _0x36ddb9=_0x413a83?_0x1ee4db[_0x21a5('0x1f')]:_0x53c545[_0x21a5('0x20')]+_0x53c545[_0x21a5('0x1e')];var _0x2c60be;if(_0x36ddb9>=_0x179444){_0x36ddb9=_0x179444;_0x2c60be=0xc8;}else{_0x2c60be=0xce;}_0x96fb39[_0x21a5('0x1b')](_0x2c60be);return _0x96fb39['set']('Content-Range',_0x43585f+'-'+_0x36ddb9+'/'+_0x179444)[_0x21a5('0x1c')](_0x1ee4db);}return null;};}function patchUpdates(_0x2ab1c7){return function(_0x630e14){try{jsonpatch[_0x21a5('0x21')](_0x630e14,_0x2ab1c7,!![]);}catch(_0x4e855b){return BPromise[_0x21a5('0x22')](_0x4e855b);}return _0x630e14[_0x21a5('0x23')]();};}function saveUpdates(_0x47623a,_0x4b2a0e){return function(_0x367c2d){if(_0x367c2d){return _0x367c2d['update'](_0x47623a)[_0x21a5('0x24')](function(_0x495186){return _0x495186;});}return null;};}function removeEntity(_0x4a4ea0,_0x5f37e4){return function(_0x1eb288){if(_0x1eb288){return _0x1eb288[_0x21a5('0x25')]()['then'](function(){_0x4a4ea0['status'](0xcc)[_0x21a5('0x26')]();});}};}function handleEntityNotFound(_0x2c5533,_0x48e44c){return function(_0x38661c){if(!_0x38661c){_0x2c5533[_0x21a5('0x1a')](0x194);}return _0x38661c;};}function handleError(_0x1d5c20,_0x2e27aa){_0x2e27aa=_0x2e27aa||0x1f4;return function(_0x4c9d27){logger[_0x21a5('0x27')](_0x4c9d27['stack']);if(_0x4c9d27[_0x21a5('0x28')]){delete _0x4c9d27[_0x21a5('0x28')];}_0x1d5c20['status'](_0x2e27aa)[_0x21a5('0x29')](_0x4c9d27);};}exports[_0x21a5('0x2a')]=function(_0x43f8df,_0x120c86){var _0x6ca47f={},_0x12a021={},_0x208b28={'count':0x0,'rows':[]};var _0x1030ef=_[_0x21a5('0x2b')](db[_0x21a5('0x2c')][_0x21a5('0x2d')],function(_0x124f30){return{'name':_0x124f30['fieldName'],'type':_0x124f30[_0x21a5('0x2e')][_0x21a5('0x2f')]};});_0x12a021[_0x21a5('0x30')]=_[_0x21a5('0x2b')](_0x1030ef,_0x21a5('0x28'));_0x12a021['query']=_[_0x21a5('0x31')](_0x43f8df['query']);_0x12a021[_0x21a5('0x32')]=_[_0x21a5('0x33')](_0x12a021[_0x21a5('0x30')],_0x12a021[_0x21a5('0x34')]);_0x6ca47f[_0x21a5('0x35')]=_[_0x21a5('0x33')](_0x12a021[_0x21a5('0x30')],qs[_0x21a5('0x36')](_0x43f8df['query']['fields']));_0x6ca47f[_0x21a5('0x35')]=_0x6ca47f[_0x21a5('0x35')][_0x21a5('0x37')]?_0x6ca47f[_0x21a5('0x35')]:_0x12a021[_0x21a5('0x30')];if(!_0x43f8df[_0x21a5('0x34')][_0x21a5('0x38')](_0x21a5('0x39'))){_0x6ca47f[_0x21a5('0x1e')]=qs[_0x21a5('0x1e')](_0x43f8df[_0x21a5('0x34')][_0x21a5('0x1e')]);_0x6ca47f[_0x21a5('0x20')]=qs['offset'](_0x43f8df['query']['offset']);}_0x6ca47f[_0x21a5('0x3a')]=qs[_0x21a5('0x3b')](_0x43f8df[_0x21a5('0x34')][_0x21a5('0x3b')]);_0x6ca47f[_0x21a5('0x3c')]=qs[_0x21a5('0x32')](_[_0x21a5('0x3d')](_0x43f8df[_0x21a5('0x34')],_0x12a021[_0x21a5('0x32')]),_0x1030ef);if(_0x43f8df[_0x21a5('0x34')][_0x21a5('0x3e')]){_0x6ca47f['where']=_[_0x21a5('0x3f')](_0x6ca47f[_0x21a5('0x3c')],{'$or':_[_0x21a5('0x2b')](_0x1030ef,function(_0x2c6b26){if(_0x2c6b26[_0x21a5('0x2e')]!==_0x21a5('0x40')){var _0x21a3bf={};_0x21a3bf[_0x2c6b26['name']]={'$like':'%'+_0x43f8df['query'][_0x21a5('0x3e')]+'%'};return _0x21a3bf;}})});}_0x6ca47f=_[_0x21a5('0x3f')]({},_0x6ca47f,_0x43f8df[_0x21a5('0x41')]);var _0x40781c={'where':_0x6ca47f[_0x21a5('0x3c')]};return db['ZendeskField'][_0x21a5('0x1f')](_0x40781c)[_0x21a5('0x24')](function(_0x329925){_0x208b28[_0x21a5('0x1f')]=_0x329925;if(_0x43f8df[_0x21a5('0x34')]['includeAll']){_0x6ca47f['include']=[{'all':!![]}];}return db['ZendeskField'][_0x21a5('0x42')](_0x6ca47f);})[_0x21a5('0x24')](function(_0x225113){_0x208b28[_0x21a5('0x43')]=_0x225113;return _0x208b28;})['then'](respondWithFilteredResult(_0x120c86,_0x6ca47f))['catch'](handleError(_0x120c86,null));};exports[_0x21a5('0x44')]=function(_0x553dfb,_0x3c0c24){var _0x1b4a13={'raw':!![],'where':{'id':_0x553dfb[_0x21a5('0x45')]['id']}},_0x47f2be={};_0x47f2be[_0x21a5('0x30')]=_['keys'](db[_0x21a5('0x2c')][_0x21a5('0x2d')]);_0x47f2be[_0x21a5('0x34')]=_[_0x21a5('0x31')](_0x553dfb['query']);_0x47f2be[_0x21a5('0x32')]=_[_0x21a5('0x33')](_0x47f2be[_0x21a5('0x30')],_0x47f2be[_0x21a5('0x34')]);_0x1b4a13[_0x21a5('0x35')]=_[_0x21a5('0x33')](_0x47f2be['model'],qs[_0x21a5('0x36')](_0x553dfb[_0x21a5('0x34')][_0x21a5('0x36')]));_0x1b4a13['attributes']=_0x1b4a13['attributes'][_0x21a5('0x37')]?_0x1b4a13[_0x21a5('0x35')]:_0x47f2be['model'];if(_0x553dfb[_0x21a5('0x34')]['includeAll']){_0x1b4a13[_0x21a5('0x46')]=[{'all':!![]}];}_0x1b4a13=_[_0x21a5('0x3f')]({},_0x1b4a13,_0x553dfb[_0x21a5('0x41')]);return db['ZendeskField'][_0x21a5('0x47')](_0x1b4a13)[_0x21a5('0x24')](handleEntityNotFound(_0x3c0c24,null))[_0x21a5('0x24')](respondWithResult(_0x3c0c24,null))[_0x21a5('0x48')](handleError(_0x3c0c24,null));};exports['create']=function(_0x13d494,_0x4d6aea){return db[_0x21a5('0x2c')][_0x21a5('0x49')](_0x13d494[_0x21a5('0x4a')],{})[_0x21a5('0x24')](respondWithResult(_0x4d6aea,0xc9))[_0x21a5('0x48')](handleError(_0x4d6aea,null));};exports[_0x21a5('0x4b')]=function(_0x3a6036,_0x539afa){if(_0x3a6036['body']['id']){delete _0x3a6036[_0x21a5('0x4a')]['id'];}return db[_0x21a5('0x2c')]['find']({'where':{'id':_0x3a6036[_0x21a5('0x45')]['id']}})[_0x21a5('0x24')](handleEntityNotFound(_0x539afa,null))[_0x21a5('0x24')](saveUpdates(_0x3a6036[_0x21a5('0x4a')],null))[_0x21a5('0x24')](respondWithResult(_0x539afa,null))['catch'](handleError(_0x539afa,null));};exports[_0x21a5('0x25')]=function(_0x25e276,_0x5ee7a9){return db[_0x21a5('0x2c')][_0x21a5('0x47')]({'where':{'id':_0x25e276['params']['id']}})[_0x21a5('0x24')](handleEntityNotFound(_0x5ee7a9,null))[_0x21a5('0x24')](removeEntity(_0x5ee7a9,null))[_0x21a5('0x48')](handleError(_0x5ee7a9,null));}; \ No newline at end of file +var _0x0de8=['options','include','findAll','params','rawAttributes','intersection','includeAll','find','create','body','update','catch','destroy','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','name','send','index','map','ZendeskField','fieldName','type','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','filter','merge'];(function(_0x7a112,_0x2eb4a0){var _0x136dc5=function(_0x437650){while(--_0x437650){_0x7a112['push'](_0x7a112['shift']());}};_0x136dc5(++_0x2eb4a0);}(_0x0de8,0x1e9));var _0x80de=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0x0de8[_0x30c2ae];return _0x1ee1cc;};'use strict';var emlformat=require(_0x80de('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x80de('0x1'));var moment=require(_0x80de('0x2'));var BPromise=require(_0x80de('0x3'));var Mustache=require(_0x80de('0x4'));var util=require(_0x80de('0x5'));var path=require('path');var sox=require(_0x80de('0x6'));var csv=require(_0x80de('0x7'));var ejs=require(_0x80de('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x80de('0x9'));var squel=require(_0x80de('0xa'));var crypto=require('crypto');var jsforce=require(_0x80de('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x80de('0x7'));var querystring=require(_0x80de('0xc'));var Papa=require('papaparse');var Redis=require(_0x80de('0xd'));var authService=require(_0x80de('0xe'));var qs=require(_0x80de('0xf'));var as=require(_0x80de('0x10'));var hardwareService=require(_0x80de('0x11'));var logger=require(_0x80de('0x12'))(_0x80de('0x13'));var utils=require(_0x80de('0x14'));var config=require(_0x80de('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53ba37,_0x2ca447){_0x2ca447=_0x2ca447||0xcc;return function(_0x32e53e){if(_0x32e53e){return _0x53ba37[_0x80de('0x16')](_0x2ca447);}return _0x53ba37['status'](_0x2ca447)[_0x80de('0x17')]();};}function respondWithResult(_0x21efc4,_0x452883){_0x452883=_0x452883||0xc8;return function(_0x22c444){if(_0x22c444){return _0x21efc4[_0x80de('0x18')](_0x452883)[_0x80de('0x19')](_0x22c444);}};}function respondWithFilteredResult(_0x3ea303,_0x5f7fab){return function(_0x1df2d6){if(_0x1df2d6){var _0x37f4b6=typeof _0x5f7fab[_0x80de('0x1a')]===_0x80de('0x1b')&&typeof _0x5f7fab[_0x80de('0x1c')]===_0x80de('0x1b');var _0x5ce960=_0x1df2d6[_0x80de('0x1d')];var _0x4bce59=_0x37f4b6?0x0:_0x5f7fab[_0x80de('0x1a')];var _0x4adcf4=_0x37f4b6?_0x1df2d6[_0x80de('0x1d')]:_0x5f7fab[_0x80de('0x1a')]+_0x5f7fab[_0x80de('0x1c')];var _0x5e8345;if(_0x4adcf4>=_0x5ce960){_0x4adcf4=_0x5ce960;_0x5e8345=0xc8;}else{_0x5e8345=0xce;}_0x3ea303[_0x80de('0x18')](_0x5e8345);return _0x3ea303['set'](_0x80de('0x1e'),_0x4bce59+'-'+_0x4adcf4+'/'+_0x5ce960)[_0x80de('0x19')](_0x1df2d6);}return null;};}function patchUpdates(_0x230ffb){return function(_0xce8938){try{jsonpatch[_0x80de('0x1f')](_0xce8938,_0x230ffb,!![]);}catch(_0x3a5b5b){return BPromise[_0x80de('0x20')](_0x3a5b5b);}return _0xce8938[_0x80de('0x21')]();};}function saveUpdates(_0x42daa9,_0x2bcfff){return function(_0x2b2caf){if(_0x2b2caf){return _0x2b2caf['update'](_0x42daa9)[_0x80de('0x22')](function(_0x2c0e9a){return _0x2c0e9a;});}return null;};}function removeEntity(_0x319588,_0x3e4feb){return function(_0x2efce5){if(_0x2efce5){return _0x2efce5['destroy']()[_0x80de('0x22')](function(){_0x319588['status'](0xcc)[_0x80de('0x17')]();});}};}function handleEntityNotFound(_0x2df904,_0xb50a5c){return function(_0x906ca8){if(!_0x906ca8){_0x2df904[_0x80de('0x16')](0x194);}return _0x906ca8;};}function handleError(_0x20770c,_0x3298d2){_0x3298d2=_0x3298d2||0x1f4;return function(_0x46bf68){logger['error'](_0x46bf68['stack']);if(_0x46bf68[_0x80de('0x23')]){delete _0x46bf68[_0x80de('0x23')];}_0x20770c[_0x80de('0x18')](_0x3298d2)[_0x80de('0x24')](_0x46bf68);};}exports[_0x80de('0x25')]=function(_0x48674e,_0x46c8a8){var _0x1f6392={},_0x4ed141={},_0x2c614b={'count':0x0,'rows':[]};var _0x4e7d1a=_[_0x80de('0x26')](db[_0x80de('0x27')]['rawAttributes'],function(_0x160131){return{'name':_0x160131[_0x80de('0x28')],'type':_0x160131[_0x80de('0x29')]['key']};});_0x4ed141[_0x80de('0x2a')]=_['map'](_0x4e7d1a,_0x80de('0x23'));_0x4ed141[_0x80de('0x2b')]=_[_0x80de('0x2c')](_0x48674e[_0x80de('0x2b')]);_0x4ed141[_0x80de('0x2d')]=_['intersection'](_0x4ed141['model'],_0x4ed141[_0x80de('0x2b')]);_0x1f6392[_0x80de('0x2e')]=_['intersection'](_0x4ed141[_0x80de('0x2a')],qs[_0x80de('0x2f')](_0x48674e[_0x80de('0x2b')][_0x80de('0x2f')]));_0x1f6392['attributes']=_0x1f6392[_0x80de('0x2e')][_0x80de('0x30')]?_0x1f6392['attributes']:_0x4ed141[_0x80de('0x2a')];if(!_0x48674e[_0x80de('0x2b')]['hasOwnProperty'](_0x80de('0x31'))){_0x1f6392[_0x80de('0x1c')]=qs['limit'](_0x48674e[_0x80de('0x2b')][_0x80de('0x1c')]);_0x1f6392[_0x80de('0x1a')]=qs[_0x80de('0x1a')](_0x48674e[_0x80de('0x2b')][_0x80de('0x1a')]);}_0x1f6392[_0x80de('0x32')]=qs[_0x80de('0x33')](_0x48674e[_0x80de('0x2b')]['sort']);_0x1f6392[_0x80de('0x34')]=qs[_0x80de('0x2d')](_['pick'](_0x48674e[_0x80de('0x2b')],_0x4ed141[_0x80de('0x2d')]),_0x4e7d1a);if(_0x48674e[_0x80de('0x2b')][_0x80de('0x35')]){_0x1f6392['where']=_[_0x80de('0x36')](_0x1f6392[_0x80de('0x34')],{'$or':_[_0x80de('0x26')](_0x4e7d1a,function(_0xb73e74){if(_0xb73e74[_0x80de('0x29')]!=='VIRTUAL'){var _0x5c96b1={};_0x5c96b1[_0xb73e74[_0x80de('0x23')]]={'$like':'%'+_0x48674e[_0x80de('0x2b')]['filter']+'%'};return _0x5c96b1;}})});}_0x1f6392=_[_0x80de('0x36')]({},_0x1f6392,_0x48674e[_0x80de('0x37')]);var _0x1fea7a={'where':_0x1f6392[_0x80de('0x34')]};return db[_0x80de('0x27')][_0x80de('0x1d')](_0x1fea7a)[_0x80de('0x22')](function(_0x2c79a8){_0x2c614b[_0x80de('0x1d')]=_0x2c79a8;if(_0x48674e[_0x80de('0x2b')]['includeAll']){_0x1f6392[_0x80de('0x38')]=[{'all':!![]}];}return db[_0x80de('0x27')][_0x80de('0x39')](_0x1f6392);})[_0x80de('0x22')](function(_0x5eccf3){_0x2c614b['rows']=_0x5eccf3;return _0x2c614b;})['then'](respondWithFilteredResult(_0x46c8a8,_0x1f6392))['catch'](handleError(_0x46c8a8,null));};exports['show']=function(_0x123e36,_0x1ee1e7){var _0xf35b1f={'raw':!![],'where':{'id':_0x123e36[_0x80de('0x3a')]['id']}},_0x324719={};_0x324719[_0x80de('0x2a')]=_[_0x80de('0x2c')](db['ZendeskField'][_0x80de('0x3b')]);_0x324719['query']=_['keys'](_0x123e36[_0x80de('0x2b')]);_0x324719[_0x80de('0x2d')]=_[_0x80de('0x3c')](_0x324719[_0x80de('0x2a')],_0x324719['query']);_0xf35b1f['attributes']=_['intersection'](_0x324719['model'],qs[_0x80de('0x2f')](_0x123e36[_0x80de('0x2b')]['fields']));_0xf35b1f[_0x80de('0x2e')]=_0xf35b1f['attributes'][_0x80de('0x30')]?_0xf35b1f['attributes']:_0x324719[_0x80de('0x2a')];if(_0x123e36['query'][_0x80de('0x3d')]){_0xf35b1f[_0x80de('0x38')]=[{'all':!![]}];}_0xf35b1f=_[_0x80de('0x36')]({},_0xf35b1f,_0x123e36[_0x80de('0x37')]);return db['ZendeskField'][_0x80de('0x3e')](_0xf35b1f)[_0x80de('0x22')](handleEntityNotFound(_0x1ee1e7,null))[_0x80de('0x22')](respondWithResult(_0x1ee1e7,null))['catch'](handleError(_0x1ee1e7,null));};exports[_0x80de('0x3f')]=function(_0x5c0541,_0x252051){return db[_0x80de('0x27')][_0x80de('0x3f')](_0x5c0541[_0x80de('0x40')],{})[_0x80de('0x22')](respondWithResult(_0x252051,0xc9))['catch'](handleError(_0x252051,null));};exports[_0x80de('0x41')]=function(_0x40145b,_0x4880ba){if(_0x40145b[_0x80de('0x40')]['id']){delete _0x40145b['body']['id'];}return db[_0x80de('0x27')][_0x80de('0x3e')]({'where':{'id':_0x40145b['params']['id']}})[_0x80de('0x22')](handleEntityNotFound(_0x4880ba,null))[_0x80de('0x22')](saveUpdates(_0x40145b['body'],null))[_0x80de('0x22')](respondWithResult(_0x4880ba,null))[_0x80de('0x42')](handleError(_0x4880ba,null));};exports[_0x80de('0x43')]=function(_0x19d799,_0x367f97){return db[_0x80de('0x27')]['find']({'where':{'id':_0x19d799[_0x80de('0x3a')]['id']}})[_0x80de('0x22')](handleEntityNotFound(_0x367f97,null))[_0x80de('0x22')](removeEntity(_0x367f97,null))[_0x80de('0x42')](handleError(_0x367f97,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 2a166ec..7b7aa25 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 _0x546d=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','FieldId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x546d,0x1ba));var _0xd546=function(_0x3d2eae,_0x53592e){_0x3d2eae=_0x3d2eae-0x0;var _0x4ac161=_0x546d[_0x3d2eae];return _0x4ac161;};'use strict';var _=require(_0xd546('0x0'));var util=require(_0xd546('0x1'));var logger=require('../../config/logger')(_0xd546('0x2'));var moment=require(_0xd546('0x3'));var BPromise=require(_0xd546('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd546('0x5'));var rimraf=require(_0xd546('0x6'));var config=require(_0xd546('0x7'));var attributes=require(_0xd546('0x8'));module[_0xd546('0x9')]=function(_0x1f9a66,_0x473e33){return _0x1f9a66[_0xd546('0xa')](_0xd546('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xd546('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x18e1=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','FieldId'];(function(_0x2bad99,_0x1150fd){var _0x48fe3a=function(_0x3debc6){while(--_0x3debc6){_0x2bad99['push'](_0x2bad99['shift']());}};_0x48fe3a(++_0x1150fd);}(_0x18e1,0xfc));var _0x118e=function(_0x324d38,_0x51ba2b){_0x324d38=_0x324d38-0x0;var _0x3cce69=_0x18e1[_0x324d38];return _0x3cce69;};'use strict';var _=require('lodash');var util=require(_0x118e('0x0'));var logger=require(_0x118e('0x1'))(_0x118e('0x2'));var moment=require(_0x118e('0x3'));var BPromise=require(_0x118e('0x4'));var rp=require(_0x118e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x118e('0x6'));var config=require(_0x118e('0x7'));var attributes=require(_0x118e('0x8'));module[_0x118e('0x9')]=function(_0x4b54cd,_0x1a14f3){return _0x4b54cd[_0x118e('0xa')](_0x118e('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x118e('0xc'),'fields':['idField',_0x118e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 82f02e6..dc9c226 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 _0x9fd5=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x9fd5,0xda));var _0x59fd=function(_0x12936c,_0x406f3c){_0x12936c=_0x12936c-0x0;var _0x4893da=_0x9fd5[_0x12936c];return _0x4893da;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x59fd('0x0'));var BPromise=require(_0x59fd('0x1'));var rs=require(_0x59fd('0x2'));var fs=require('fs');var Redis=require(_0x59fd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x59fd('0x4'));var logger=require(_0x59fd('0x5'))(_0x59fd('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x59fd('0x7')][_0x59fd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c2f3e,_0x514273,_0x7e5ea6){return new BPromise(function(_0x3247b6,_0x531bc2){return client[_0x59fd('0x9')](_0x1c2f3e,_0x7e5ea6)[_0x59fd('0xa')](function(_0x30f99d){logger['info'](_0x59fd('0xb'),_0x514273,_0x59fd('0xc'));logger[_0x59fd('0xd')](_0x59fd('0xe'),_0x514273,_0x59fd('0xc'),JSON[_0x59fd('0xf')](_0x30f99d));if(_0x30f99d[_0x59fd('0x10')]){if(_0x30f99d[_0x59fd('0x10')][_0x59fd('0x11')]===0x1f4){logger['error'](_0x59fd('0xb'),_0x514273,_0x30f99d['error'][_0x59fd('0x12')]);return _0x531bc2(_0x30f99d[_0x59fd('0x10')][_0x59fd('0x12')]);}logger[_0x59fd('0x10')](_0x59fd('0xb'),_0x514273,_0x30f99d[_0x59fd('0x10')]['message']);return _0x3247b6(_0x30f99d[_0x59fd('0x10')][_0x59fd('0x12')]);}else{logger[_0x59fd('0x13')](_0x59fd('0xb'),_0x514273,_0x59fd('0xc'));_0x3247b6(_0x30f99d[_0x59fd('0x14')][_0x59fd('0x12')]);}})[_0x59fd('0x15')](function(_0x5ad14f){logger[_0x59fd('0x10')](_0x59fd('0xb'),_0x514273,_0x5ad14f);_0x531bc2(_0x5ad14f);});});} \ No newline at end of file +var _0x9fff=['error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x553502,_0x4d2c0c){var _0x246c37=function(_0x36698a){while(--_0x36698a){_0x553502['push'](_0x553502['shift']());}};_0x246c37(++_0x4d2c0c);}(_0x9fff,0x1a1));var _0xf9ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf9ff('0x0'));var util=require(_0xf9ff('0x1'));var moment=require(_0xf9ff('0x2'));var BPromise=require(_0xf9ff('0x3'));var rs=require(_0xf9ff('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf9ff('0x5'))['db'];var utils=require(_0xf9ff('0x6'));var logger=require(_0xf9ff('0x7'))(_0xf9ff('0x8'));var config=require(_0xf9ff('0x9'));var jayson=require(_0xf9ff('0xa'));var client=jayson[_0xf9ff('0xb')][_0xf9ff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a6063,_0x19fcb7,_0x2fdf6c){return new BPromise(function(_0x832c6f,_0x569871){return client['request'](_0x3a6063,_0x2fdf6c)[_0xf9ff('0xd')](function(_0x429386){logger[_0xf9ff('0xe')](_0xf9ff('0xf'),_0x19fcb7,_0xf9ff('0x10'));logger[_0xf9ff('0x11')](_0xf9ff('0x12'),_0x19fcb7,_0xf9ff('0x10'),JSON[_0xf9ff('0x13')](_0x429386));if(_0x429386['error']){if(_0x429386[_0xf9ff('0x14')]['code']===0x1f4){logger[_0xf9ff('0x14')]('ZendeskField,\x20%s,\x20%s',_0x19fcb7,_0x429386[_0xf9ff('0x14')][_0xf9ff('0x15')]);return _0x569871(_0x429386[_0xf9ff('0x14')][_0xf9ff('0x15')]);}logger[_0xf9ff('0x14')](_0xf9ff('0xf'),_0x19fcb7,_0x429386[_0xf9ff('0x14')][_0xf9ff('0x15')]);return _0x832c6f(_0x429386[_0xf9ff('0x14')]['message']);}else{logger[_0xf9ff('0xe')](_0xf9ff('0xf'),_0x19fcb7,_0xf9ff('0x10'));_0x832c6f(_0x429386[_0xf9ff('0x16')]['message']);}})['catch'](function(_0x240ad0){logger[_0xf9ff('0x14')]('ZendeskField,\x20%s,\x20%s',_0x19fcb7,_0x240ad0);_0x569871(_0x240ad0);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index d41d0af..1c16651 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 _0xe386=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe386,0x1af));var _0x6e38=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe386[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x6e38('0x0'));var path=require(_0x6e38('0x1'));var timeout=require('connect-timeout');var express=require(_0x6e38('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6e38('0x3'));var interaction=require(_0x6e38('0x4'));var config=require(_0x6e38('0x5'));var controller=require(_0x6e38('0x6'));router[_0x6e38('0x7')]('/',auth[_0x6e38('0x8')](),controller[_0x6e38('0x9')]);router[_0x6e38('0x7')](_0x6e38('0xa'),auth[_0x6e38('0x8')](),controller[_0x6e38('0xb')]);router[_0x6e38('0x7')](_0x6e38('0xc'),auth[_0x6e38('0x8')](),controller[_0x6e38('0xd')]);router[_0x6e38('0x7')](_0x6e38('0xe'),auth[_0x6e38('0x8')](),controller[_0x6e38('0xf')]);router[_0x6e38('0x10')]('/',auth[_0x6e38('0x8')](),controller[_0x6e38('0x11')]);router[_0x6e38('0x10')]('/:id/configurations',auth[_0x6e38('0x8')](),controller[_0x6e38('0x12')]);router[_0x6e38('0x13')](_0x6e38('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x6e38('0x14')](_0x6e38('0xa'),auth[_0x6e38('0x8')](),controller['destroy']);module[_0x6e38('0x15')]=router; \ No newline at end of file +var _0x9c39=['getFields','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x1a9d92,_0x3e6e1a){var _0x409e2f=function(_0x2bff10){while(--_0x2bff10){_0x1a9d92['push'](_0x1a9d92['shift']());}};_0x409e2f(++_0x3e6e1a);}(_0x9c39,0x1ea));var _0x99c3=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x9c39[_0x1562a2];return _0x39a636;};'use strict';var multer=require(_0x99c3('0x0'));var util=require('util');var path=require(_0x99c3('0x1'));var timeout=require(_0x99c3('0x2'));var express=require(_0x99c3('0x3'));var router=express[_0x99c3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x99c3('0x5'));var interaction=require(_0x99c3('0x6'));var config=require(_0x99c3('0x7'));var controller=require(_0x99c3('0x8'));router[_0x99c3('0x9')]('/',auth['isAuthenticated'](),controller[_0x99c3('0xa')]);router['get'](_0x99c3('0xb'),auth[_0x99c3('0xc')](),controller['show']);router[_0x99c3('0x9')](_0x99c3('0xd'),auth['isAuthenticated'](),controller[_0x99c3('0xe')]);router[_0x99c3('0x9')](_0x99c3('0xf'),auth[_0x99c3('0xc')](),controller[_0x99c3('0x10')]);router[_0x99c3('0x11')]('/',auth[_0x99c3('0xc')](),controller[_0x99c3('0x12')]);router[_0x99c3('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0x99c3('0xc')](),controller[_0x99c3('0x13')]);router[_0x99c3('0x14')](_0x99c3('0xb'),auth['isAuthenticated'](),controller[_0x99c3('0x15')]);module[_0x99c3('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index e4f43c9..6c056f8 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 _0xaa88=['exports','STRING','sequelize'];(function(_0x3f05eb,_0x3302e8){var _0x1dd588=function(_0x40b9cd){while(--_0x40b9cd){_0x3f05eb['push'](_0x3f05eb['shift']());}};_0x1dd588(++_0x3302e8);}(_0xaa88,0x137));var _0x8aa8=function(_0x4d9bb2,_0x3db50d){_0x4d9bb2=_0x4d9bb2-0x0;var _0x3179fe=_0xaa88[_0x4d9bb2];return _0x3179fe;};'use strict';var Sequelize=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]={'name':{'type':Sequelize[_0x8aa8('0x2')]},'description':{'type':Sequelize[_0x8aa8('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8aa8('0x2')]},'clientId':{'type':Sequelize[_0x8aa8('0x2')]},'clientSecret':{'type':Sequelize[_0x8aa8('0x2')]},'serverUrl':{'type':Sequelize[_0x8aa8('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8aa8('0x2')]},'refreshToken':{'type':Sequelize[_0x8aa8('0x2')]}}; \ No newline at end of file +var _0x9bde=['STRING','exports'];(function(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0x9bde,0xe1));var _0xe9bd=function(_0x23f5f3,_0x5ee75c){_0x23f5f3=_0x23f5f3-0x0;var _0x437ee7=_0x9bde[_0x23f5f3];return _0x437ee7;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe9bd('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xe9bd('0x1')]},'clientId':{'type':Sequelize[_0xe9bd('0x1')]},'clientSecret':{'type':Sequelize[_0xe9bd('0x1')]},'serverUrl':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xe9bd('0x1')]},'refreshToken':{'type':Sequelize[_0xe9bd('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 40e64ca..bd0fc29 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 _0x1a4a=['map','ZohoAccount','fieldName','type','model','keys','query','intersection','attributes','fields','limit','order','sort','filters','filter','VIRTUAL','merge','options','where','includeAll','include','rows','catch','find','create','body','params','getConfigurations','rawAttributes','pick','length','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','code','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Call_Duration','Call_Result','remove','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','end','json','offset','undefined','count','set','save','update','destroy','then','status','sendStatus','error','stack','name','send','index'];(function(_0x9cfa0d,_0x4b9135){var _0x35e218=function(_0x411401){while(--_0x411401){_0x9cfa0d['push'](_0x9cfa0d['shift']());}};_0x35e218(++_0x4b9135);}(_0x1a4a,0xce));var _0xa1a4=function(_0x44cd44,_0x140eff){_0x44cd44=_0x44cd44-0x0;var _0x24ea7d=_0x1a4a[_0x44cd44];return _0x24ea7d;};'use strict';var emlformat=require(_0xa1a4('0x0'));var rimraf=require(_0xa1a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1a4('0x2'));var rp=require(_0xa1a4('0x3'));var moment=require(_0xa1a4('0x4'));var BPromise=require(_0xa1a4('0x5'));var Mustache=require(_0xa1a4('0x6'));var util=require(_0xa1a4('0x7'));var path=require('path');var sox=require(_0xa1a4('0x8'));var csv=require(_0xa1a4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1a4('0xa'));var _=require('lodash');var squel=require(_0xa1a4('0xb'));var crypto=require(_0xa1a4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa1a4('0xd'));var toCsv=require(_0xa1a4('0x9'));var querystring=require(_0xa1a4('0xe'));var Papa=require(_0xa1a4('0xf'));var Redis=require('ioredis');var authService=require(_0xa1a4('0x10'));var qs=require(_0xa1a4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1a4('0x12'));var logger=require(_0xa1a4('0x13'))(_0xa1a4('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa1a4('0x15'))['db'];var integrations=require(_0xa1a4('0x16'));function respondWithStatusCode(_0x34d402,_0x860398){_0x860398=_0x860398||0xcc;return function(_0x151119){if(_0x151119){return _0x34d402['sendStatus'](_0x860398);}return _0x34d402['status'](_0x860398)[_0xa1a4('0x17')]();};}function respondWithResult(_0x4ecc1,_0x196e5b){_0x196e5b=_0x196e5b||0xc8;return function(_0x570aef){if(_0x570aef){return _0x4ecc1['status'](_0x196e5b)[_0xa1a4('0x18')](_0x570aef);}};}function respondWithFilteredResult(_0x521ab5,_0x310eaa){return function(_0x3ac95e){if(_0x3ac95e){var _0x1bcc52=typeof _0x310eaa[_0xa1a4('0x19')]==='undefined'&&typeof _0x310eaa['limit']===_0xa1a4('0x1a');var _0x50ebb1=_0x3ac95e[_0xa1a4('0x1b')];var _0x102bb2=_0x1bcc52?0x0:_0x310eaa[_0xa1a4('0x19')];var _0x3d326f=_0x1bcc52?_0x3ac95e[_0xa1a4('0x1b')]:_0x310eaa[_0xa1a4('0x19')]+_0x310eaa['limit'];var _0x8049f3;if(_0x3d326f>=_0x50ebb1){_0x3d326f=_0x50ebb1;_0x8049f3=0xc8;}else{_0x8049f3=0xce;}_0x521ab5['status'](_0x8049f3);return _0x521ab5[_0xa1a4('0x1c')]('Content-Range',_0x102bb2+'-'+_0x3d326f+'/'+_0x50ebb1)[_0xa1a4('0x18')](_0x3ac95e);}return null;};}function patchUpdates(_0x419d6d){return function(_0x22895f){try{jsonpatch['apply'](_0x22895f,_0x419d6d,!![]);}catch(_0x4bc06e){return BPromise['reject'](_0x4bc06e);}return _0x22895f[_0xa1a4('0x1d')]();};}function saveUpdates(_0x202a58,_0x438d9f){return function(_0x5d3b45){if(_0x5d3b45){return _0x5d3b45[_0xa1a4('0x1e')](_0x202a58)['then'](function(_0x1fdf9f){return _0x1fdf9f;});}return null;};}function removeEntity(_0x5dde75,_0x5217aa){return function(_0x4f598d){if(_0x4f598d){return _0x4f598d[_0xa1a4('0x1f')]()[_0xa1a4('0x20')](function(){_0x5dde75[_0xa1a4('0x21')](0xcc)[_0xa1a4('0x17')]();});}};}function handleEntityNotFound(_0x2ff3da,_0x5e7fe2){return function(_0x5f35a1){if(!_0x5f35a1){_0x2ff3da[_0xa1a4('0x22')](0x194);}return _0x5f35a1;};}function handleError(_0x109ea4,_0x5dfb5c){_0x5dfb5c=_0x5dfb5c||0x1f4;return function(_0x5eb180){logger[_0xa1a4('0x23')](_0x5eb180[_0xa1a4('0x24')]);if(_0x5eb180[_0xa1a4('0x25')]){delete _0x5eb180[_0xa1a4('0x25')];}_0x109ea4[_0xa1a4('0x21')](_0x5dfb5c)[_0xa1a4('0x26')](_0x5eb180);};}exports[_0xa1a4('0x27')]=function(_0x36f67d,_0x36b210){var _0x504b71={},_0x4ec41c={},_0x1dd46b={'count':0x0,'rows':[]};var _0xe3d26a=_[_0xa1a4('0x28')](db[_0xa1a4('0x29')]['rawAttributes'],function(_0x28efec){return{'name':_0x28efec[_0xa1a4('0x2a')],'type':_0x28efec[_0xa1a4('0x2b')]['key']};});_0x4ec41c[_0xa1a4('0x2c')]=_[_0xa1a4('0x28')](_0xe3d26a,_0xa1a4('0x25'));_0x4ec41c['query']=_[_0xa1a4('0x2d')](_0x36f67d[_0xa1a4('0x2e')]);_0x4ec41c['filters']=_[_0xa1a4('0x2f')](_0x4ec41c[_0xa1a4('0x2c')],_0x4ec41c[_0xa1a4('0x2e')]);_0x504b71[_0xa1a4('0x30')]=_[_0xa1a4('0x2f')](_0x4ec41c[_0xa1a4('0x2c')],qs['fields'](_0x36f67d[_0xa1a4('0x2e')][_0xa1a4('0x31')]));_0x504b71[_0xa1a4('0x30')]=_0x504b71['attributes']['length']?_0x504b71[_0xa1a4('0x30')]:_0x4ec41c['model'];if(!_0x36f67d[_0xa1a4('0x2e')]['hasOwnProperty']('nolimit')){_0x504b71[_0xa1a4('0x32')]=qs[_0xa1a4('0x32')](_0x36f67d[_0xa1a4('0x2e')][_0xa1a4('0x32')]);_0x504b71[_0xa1a4('0x19')]=qs[_0xa1a4('0x19')](_0x36f67d[_0xa1a4('0x2e')][_0xa1a4('0x19')]);}_0x504b71[_0xa1a4('0x33')]=qs['sort'](_0x36f67d[_0xa1a4('0x2e')][_0xa1a4('0x34')]);_0x504b71['where']=qs[_0xa1a4('0x35')](_['pick'](_0x36f67d[_0xa1a4('0x2e')],_0x4ec41c['filters']),_0xe3d26a);if(_0x36f67d['query'][_0xa1a4('0x36')]){_0x504b71['where']=_['merge'](_0x504b71['where'],{'$or':_[_0xa1a4('0x28')](_0xe3d26a,function(_0x18773c){if(_0x18773c[_0xa1a4('0x2b')]!==_0xa1a4('0x37')){var _0x2256f4={};_0x2256f4[_0x18773c[_0xa1a4('0x25')]]={'$like':'%'+_0x36f67d[_0xa1a4('0x2e')][_0xa1a4('0x36')]+'%'};return _0x2256f4;}})});}_0x504b71=_[_0xa1a4('0x38')]({},_0x504b71,_0x36f67d[_0xa1a4('0x39')]);var _0x577b27={'where':_0x504b71[_0xa1a4('0x3a')]};return db[_0xa1a4('0x29')][_0xa1a4('0x1b')](_0x577b27)[_0xa1a4('0x20')](function(_0x4f0f37){_0x1dd46b['count']=_0x4f0f37;if(_0x36f67d['query'][_0xa1a4('0x3b')]){_0x504b71[_0xa1a4('0x3c')]=[{'all':!![]}];}return db[_0xa1a4('0x29')]['findAll'](_0x504b71);})[_0xa1a4('0x20')](function(_0x77afd5){_0x1dd46b[_0xa1a4('0x3d')]=_0x77afd5;return _0x1dd46b;})[_0xa1a4('0x20')](respondWithFilteredResult(_0x36b210,_0x504b71))[_0xa1a4('0x3e')](handleError(_0x36b210,null));};exports['show']=function(_0xd64bc3,_0x39b3b9){var _0x21b991={'raw':![],'where':{'id':_0xd64bc3['params']['id']}},_0x5622e5={};_0x5622e5['model']=_[_0xa1a4('0x2d')](db[_0xa1a4('0x29')]['rawAttributes']);_0x5622e5[_0xa1a4('0x2e')]=_[_0xa1a4('0x2d')](_0xd64bc3[_0xa1a4('0x2e')]);_0x5622e5[_0xa1a4('0x35')]=_[_0xa1a4('0x2f')](_0x5622e5['model'],_0x5622e5[_0xa1a4('0x2e')]);_0x21b991[_0xa1a4('0x30')]=_[_0xa1a4('0x2f')](_0x5622e5[_0xa1a4('0x2c')],qs['fields'](_0xd64bc3[_0xa1a4('0x2e')][_0xa1a4('0x31')]));_0x21b991[_0xa1a4('0x30')]=_0x21b991[_0xa1a4('0x30')]['length']?_0x21b991[_0xa1a4('0x30')]:_0x5622e5[_0xa1a4('0x2c')];if(_0xd64bc3[_0xa1a4('0x2e')][_0xa1a4('0x3b')]){_0x21b991[_0xa1a4('0x3c')]=[{'all':!![]}];}_0x21b991=_[_0xa1a4('0x38')]({},_0x21b991,_0xd64bc3['options']);return db[_0xa1a4('0x29')][_0xa1a4('0x3f')](_0x21b991)[_0xa1a4('0x20')](handleEntityNotFound(_0x39b3b9,null))[_0xa1a4('0x20')](respondWithResult(_0x39b3b9,null))[_0xa1a4('0x3e')](handleError(_0x39b3b9,null));};exports[_0xa1a4('0x40')]=function(_0x4e92ac,_0x2c526d){return db['ZohoAccount'][_0xa1a4('0x40')](_0x4e92ac[_0xa1a4('0x41')],{})[_0xa1a4('0x20')](respondWithResult(_0x2c526d,0xc9))[_0xa1a4('0x3e')](handleError(_0x2c526d,null));};exports[_0xa1a4('0x1e')]=function(_0x56ed36,_0xf18785){if(_0x56ed36[_0xa1a4('0x41')]['id']){delete _0x56ed36['body']['id'];}return db[_0xa1a4('0x29')][_0xa1a4('0x3f')]({'where':{'id':_0x56ed36[_0xa1a4('0x42')]['id']}})[_0xa1a4('0x20')](handleEntityNotFound(_0xf18785,null))['then'](saveUpdates(_0x56ed36[_0xa1a4('0x41')],null))[_0xa1a4('0x20')](respondWithResult(_0xf18785,null))[_0xa1a4('0x3e')](handleError(_0xf18785,null));};exports['destroy']=function(_0x3e4135,_0x2290cc){return db[_0xa1a4('0x29')][_0xa1a4('0x3f')]({'where':{'id':_0x3e4135['params']['id']}})['then'](handleEntityNotFound(_0x2290cc,null))[_0xa1a4('0x20')](removeEntity(_0x2290cc,null))[_0xa1a4('0x3e')](handleError(_0x2290cc,null));};exports[_0xa1a4('0x43')]=function(_0x1ea1f9,_0x4d4463,_0xc092c4){var _0x35dd43={};var _0x2efa41={};var _0x4b1ac7;var _0x33922a;return db[_0xa1a4('0x29')]['findOne']({'where':{'id':_0x1ea1f9[_0xa1a4('0x42')]['id']}})[_0xa1a4('0x20')](handleEntityNotFound(_0x4d4463,null))['then'](function(_0x45242b){if(_0x45242b){_0x4b1ac7=_0x45242b;_0x2efa41[_0xa1a4('0x2c')]=_[_0xa1a4('0x2d')](db['ZohoConfiguration'][_0xa1a4('0x44')]);_0x2efa41[_0xa1a4('0x2e')]=_[_0xa1a4('0x2d')](_0x1ea1f9['query']);_0x2efa41['filters']=_[_0xa1a4('0x2f')](_0x2efa41[_0xa1a4('0x2c')],_0x2efa41[_0xa1a4('0x2e')]);_0x35dd43[_0xa1a4('0x30')]=_[_0xa1a4('0x2f')](_0x2efa41['model'],qs[_0xa1a4('0x31')](_0x1ea1f9['query'][_0xa1a4('0x31')]));_0x35dd43[_0xa1a4('0x30')]=_0x35dd43[_0xa1a4('0x30')]['length']?_0x35dd43[_0xa1a4('0x30')]:_0x2efa41[_0xa1a4('0x2c')];_0x35dd43[_0xa1a4('0x33')]=qs[_0xa1a4('0x34')](_0x1ea1f9[_0xa1a4('0x2e')][_0xa1a4('0x34')]);_0x35dd43[_0xa1a4('0x3a')]=qs[_0xa1a4('0x35')](_[_0xa1a4('0x45')](_0x1ea1f9[_0xa1a4('0x2e')],_0x2efa41[_0xa1a4('0x35')]));if(_0x1ea1f9[_0xa1a4('0x2e')][_0xa1a4('0x36')]){_0x35dd43[_0xa1a4('0x3a')]=_[_0xa1a4('0x38')](_0x35dd43['where'],{'$or':_[_0xa1a4('0x28')](_0x35dd43['attributes'],function(_0x3a9d1e){var _0x5790ae={};_0x5790ae[_0x3a9d1e]={'$like':'%'+_0x1ea1f9[_0xa1a4('0x2e')]['filter']+'%'};return _0x5790ae;})});}_0x35dd43=_[_0xa1a4('0x38')]({},_0x35dd43,_0x1ea1f9[_0xa1a4('0x39')]);return _0x4b1ac7[_0xa1a4('0x43')](_0x35dd43);}})['then'](function(_0x3ba666){if(_0x3ba666){_0x33922a=_0x3ba666[_0xa1a4('0x46')];if(!_0x1ea1f9[_0xa1a4('0x2e')][_0xa1a4('0x47')]('nolimit')){_0x35dd43['limit']=qs[_0xa1a4('0x32')](_0x1ea1f9[_0xa1a4('0x2e')]['limit']);_0x35dd43['offset']=qs[_0xa1a4('0x19')](_0x1ea1f9[_0xa1a4('0x2e')][_0xa1a4('0x19')]);}return _0x4b1ac7[_0xa1a4('0x43')](_0x35dd43);}})[_0xa1a4('0x20')](function(_0x3af3c6){if(_0x3af3c6){return _0x3af3c6?{'count':_0x33922a,'rows':_0x3af3c6}:null;}})[_0xa1a4('0x20')](respondWithResult(_0x4d4463,null))[_0xa1a4('0x3e')](handleError(_0x4d4463,null));};exports[_0xa1a4('0x48')]=function(_0x5dcc90,_0x24d9f2,_0x3ce2a8){if(_0x5dcc90[_0xa1a4('0x41')]['id']){delete _0x5dcc90[_0xa1a4('0x41')]['id'];}return db[_0xa1a4('0x29')][_0xa1a4('0x49')]({'where':{'id':_0x5dcc90[_0xa1a4('0x42')]['id']}})['then'](handleEntityNotFound(_0x24d9f2,null))[_0xa1a4('0x20')](function(_0x544ffe){if(_0x544ffe){_0x5dcc90[_0xa1a4('0x41')][_0xa1a4('0x4a')]=_0x544ffe['id'];_0x5dcc90[_0xa1a4('0x41')][_0xa1a4('0x4b')]=integrations[_0xa1a4('0x4c')](_0x5dcc90['body']['channel'],_0x5dcc90['body'][_0xa1a4('0x2b')]);_0x5dcc90[_0xa1a4('0x41')][_0xa1a4('0x4d')]=integrations[_0xa1a4('0x4e')](_0x5dcc90['body'][_0xa1a4('0x4f')],_0x5dcc90['body'][_0xa1a4('0x2b')]);return db[_0xa1a4('0x50')][_0xa1a4('0x40')](_0x5dcc90[_0xa1a4('0x41')],{'include':[{'model':db['ZohoField'],'as':_0xa1a4('0x4b')},{'model':db[_0xa1a4('0x51')],'as':'Descriptions'}]});}return null;})[_0xa1a4('0x20')](respondWithResult(_0x24d9f2,null))[_0xa1a4('0x3e')](handleError(_0x24d9f2,null));};function getAccessToken(_0x5960b9){return new Promise(function(_0x44eea3,_0x12db55){var _0x57c891;switch(_0x5960b9[_0xa1a4('0x52')]){case'US':_0x57c891=_0xa1a4('0x53');break;case'AU':_0x57c891='https://accounts.zoho.com.au';break;case'EU':_0x57c891=_0xa1a4('0x54');break;case'IN':_0x57c891=_0xa1a4('0x55');break;case'CN':_0x57c891=_0xa1a4('0x56');break;default:_0x57c891='https://accounts.zoho.eu';break;}var _0x6f12ac={'method':'POST','uri':_0x57c891+'/oauth/v2/token','qs':{'refresh_token':_0x5960b9['refreshToken'],'client_id':_0x5960b9['clientId'],'client_secret':_0x5960b9[_0xa1a4('0x57')],'grant_type':_0xa1a4('0x58')},'json':!![]};return rp(_0x6f12ac)[_0xa1a4('0x20')](function(_0x51c13b){if(_0x51c13b[_0xa1a4('0x59')]){_0x44eea3(_0x51c13b[_0xa1a4('0x59')]);}else{_0x12db55(_0xa1a4('0x5a'));}})[_0xa1a4('0x3e')](function(_0x31c41d){_0x12db55(_0x31c41d);});});}exports[_0xa1a4('0x5b')]=function(_0x4a3ebc,_0x54c0d4,_0x56661c){var _0x594733,_0x1839d4,_0x5f9db0,_0x31d5c1,_0x2aa2cd;return db[_0xa1a4('0x29')][_0xa1a4('0x49')]({'where':{'id':_0x4a3ebc[_0xa1a4('0x42')]['id']},'attributes':['id',_0xa1a4('0x5c'),_0xa1a4('0x52'),_0xa1a4('0x5d'),_0xa1a4('0x57'),'serverUrl',_0xa1a4('0x5e'),'refreshToken']})[_0xa1a4('0x20')](handleEntityNotFound(_0x54c0d4,null))[_0xa1a4('0x20')](function(_0x2465dc){_0x2aa2cd=_0x2465dc;_0x594733=_0x2aa2cd[_0xa1a4('0x5c')];_0x1839d4=_0x594733==='zoho.eu'?'eu':_0xa1a4('0x5f');_0x5f9db0=_0x2aa2cd[_0xa1a4('0x60')];var _0x1c293d=_0x5f9db0[_0xa1a4('0x61')](-0x1);if(_0x1c293d==='/'||_0x1c293d==='\x5c'||_0x1c293d===':'){_0x5f9db0=_0x5f9db0[_0xa1a4('0x62')](0x0,_0x5f9db0[_0xa1a4('0x63')](_0x1c293d));}if(!_0x2aa2cd['refreshToken']){throw new Error(_0xa1a4('0x64'));}return getAccessToken(_0x2aa2cd);})[_0xa1a4('0x20')](function(_0x2ae725){if(_0x2ae725){return rp({'method':_0xa1a4('0x65'),'uri':util[_0xa1a4('0x66')](_0xa1a4('0x67'),_0x1839d4),'qs':{'module':'Calls'},'headers':{'Authorization':_0xa1a4('0x68')+_0x2ae725},'json':!![]});}})[_0xa1a4('0x20')](function(_0xf8c17d){if(_0xf8c17d){if(_0xf8c17d[_0xa1a4('0x69')]&&_0xf8c17d['response'][_0xa1a4('0x23')]){throw new Error(_0xf8c17d[_0xa1a4('0x69')][_0xa1a4('0x23')][_0xa1a4('0x6a')]);}var _0x34d6cc=[];var _0x4015c3=[];var _0x3514b7=[_0xa1a4('0x6b'),_0xa1a4('0x6c'),'Description','WhoId',_0xa1a4('0x6d'),_0xa1a4('0x6e'),'Call_Start_Time','Call_Type'];_0x4015c3=_[_0xa1a4('0x6f')](_0xf8c17d[_0xa1a4('0x31')],function(_0x2d53de){return _0x3514b7['includes'](_0x2d53de['api_name']);});for(var _0x208d0b=0x0;_0x208d0b<_0x4015c3[_0xa1a4('0x46')];_0x208d0b++){if(_0x4015c3[_0x208d0b][_0xa1a4('0x70')]===![]){_0x34d6cc[_0xa1a4('0x71')]({'id':_0x4015c3[_0x208d0b]['id'],'name':_0x4015c3[_0x208d0b][_0xa1a4('0x72')],'custom':_0x4015c3[_0x208d0b][_0xa1a4('0x73')],'options':_0x4015c3[_0x208d0b][_0xa1a4('0x74')]===_0xa1a4('0x75')&&_0x4015c3[_0x208d0b][_0xa1a4('0x76')][_0xa1a4('0x46')]>-0x1?_[_0xa1a4('0x28')](_0x4015c3[_0x208d0b][_0xa1a4('0x76')],function(_0x436caf){return{'name':_0x436caf,'value':_0x436caf};}):[]});}}return{'count':_0x34d6cc[_0xa1a4('0x46')],'rows':_0x34d6cc};}else{return{'count':0x0,'rows':[]};}})[_0xa1a4('0x20')](respondWithResult(_0x54c0d4,null))['catch'](function(_0x568320){var _0x456200=_0x4a3ebc['query']['test']?0x1f4:_0x568320[_0xa1a4('0x77')]||0x1f4;logger[_0xa1a4('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xa1a4('0x5b'),_0x456200,JSON[_0xa1a4('0x78')](_0x568320));delete _0x568320[_0xa1a4('0x25')];if(_0x456200===0x191){_0x456200=0x190;}_0x54c0d4[_0xa1a4('0x21')](_0x456200)[_0xa1a4('0x26')](_0x4a3ebc[_0xa1a4('0x2e')][_0xa1a4('0x79')]?{'message':_0xa1a4('0x7a'),'statusCode':_0x568320[_0xa1a4('0x77')]}:_0x568320);});}; \ No newline at end of file +var _0x12a1=['model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','findOne','ZohoConfiguration','order','pick','filter','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','includes','api_name','push','display_label','custom_field','picklist','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','limit','undefined','count','offset','status','set','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','ZohoAccount','fieldName','type','key'];(function(_0x21c068,_0x369d6a){var _0x5cf199=function(_0x2c0159){while(--_0x2c0159){_0x21c068['push'](_0x21c068['shift']());}};_0x5cf199(++_0x369d6a);}(_0x12a1,0x153));var _0x112a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x12a1[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x112a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x112a('0x1'));var rp=require(_0x112a('0x2'));var moment=require(_0x112a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x112a('0x4'));var path=require(_0x112a('0x5'));var sox=require(_0x112a('0x6'));var csv=require(_0x112a('0x7'));var ejs=require(_0x112a('0x8'));var fs=require('fs');var fs_extra=require(_0x112a('0x9'));var _=require(_0x112a('0xa'));var squel=require(_0x112a('0xb'));var crypto=require(_0x112a('0xc'));var jsforce=require(_0x112a('0xd'));var deskjs=require(_0x112a('0xe'));var toCsv=require(_0x112a('0x7'));var querystring=require(_0x112a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x112a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x112a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x112a('0x12'))(_0x112a('0x13'));var utils=require(_0x112a('0x14'));var config=require(_0x112a('0x15'));var licenseUtil=require(_0x112a('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x112a('0x17'));function respondWithStatusCode(_0x7bf24c,_0x2c5df3){_0x2c5df3=_0x2c5df3||0xcc;return function(_0x2be0ba){if(_0x2be0ba){return _0x7bf24c[_0x112a('0x18')](_0x2c5df3);}return _0x7bf24c['status'](_0x2c5df3)[_0x112a('0x19')]();};}function respondWithResult(_0x9fb61c,_0x4056f1){_0x4056f1=_0x4056f1||0xc8;return function(_0x2c7f93){if(_0x2c7f93){return _0x9fb61c['status'](_0x4056f1)['json'](_0x2c7f93);}};}function respondWithFilteredResult(_0x226594,_0x61220a){return function(_0x15e69b){if(_0x15e69b){var _0x4938d6=typeof _0x61220a['offset']==='undefined'&&typeof _0x61220a[_0x112a('0x1a')]===_0x112a('0x1b');var _0x5a1439=_0x15e69b[_0x112a('0x1c')];var _0x183d03=_0x4938d6?0x0:_0x61220a[_0x112a('0x1d')];var _0x2d7a9d=_0x4938d6?_0x15e69b[_0x112a('0x1c')]:_0x61220a[_0x112a('0x1d')]+_0x61220a[_0x112a('0x1a')];var _0x3531fa;if(_0x2d7a9d>=_0x5a1439){_0x2d7a9d=_0x5a1439;_0x3531fa=0xc8;}else{_0x3531fa=0xce;}_0x226594[_0x112a('0x1e')](_0x3531fa);return _0x226594[_0x112a('0x1f')]('Content-Range',_0x183d03+'-'+_0x2d7a9d+'/'+_0x5a1439)[_0x112a('0x20')](_0x15e69b);}return null;};}function patchUpdates(_0x2a863b){return function(_0x5c9d95){try{jsonpatch[_0x112a('0x21')](_0x5c9d95,_0x2a863b,!![]);}catch(_0x50b863){return BPromise[_0x112a('0x22')](_0x50b863);}return _0x5c9d95[_0x112a('0x23')]();};}function saveUpdates(_0x1d13c3,_0x2487eb){return function(_0x6bc06b){if(_0x6bc06b){return _0x6bc06b['update'](_0x1d13c3)[_0x112a('0x24')](function(_0x40a045){return _0x40a045;});}return null;};}function removeEntity(_0x1f4e9d,_0x463652){return function(_0xd747b3){if(_0xd747b3){return _0xd747b3[_0x112a('0x25')]()[_0x112a('0x24')](function(){_0x1f4e9d[_0x112a('0x1e')](0xcc)[_0x112a('0x19')]();});}};}function handleEntityNotFound(_0x20967a,_0x329d7a){return function(_0x38aa77){if(!_0x38aa77){_0x20967a[_0x112a('0x18')](0x194);}return _0x38aa77;};}function handleError(_0x2b3594,_0x35e652){_0x35e652=_0x35e652||0x1f4;return function(_0xcff622){logger[_0x112a('0x26')](_0xcff622[_0x112a('0x27')]);if(_0xcff622[_0x112a('0x28')]){delete _0xcff622[_0x112a('0x28')];}_0x2b3594['status'](_0x35e652)[_0x112a('0x29')](_0xcff622);};}exports[_0x112a('0x2a')]=function(_0x43f0c3,_0x486706){var _0x5cb134={},_0x49bafa={},_0x2c6d5a={'count':0x0,'rows':[]};var _0x126218=_[_0x112a('0x2b')](db[_0x112a('0x2c')]['rawAttributes'],function(_0x245c61){return{'name':_0x245c61[_0x112a('0x2d')],'type':_0x245c61[_0x112a('0x2e')][_0x112a('0x2f')]};});_0x49bafa[_0x112a('0x30')]=_[_0x112a('0x2b')](_0x126218,_0x112a('0x28'));_0x49bafa[_0x112a('0x31')]=_[_0x112a('0x32')](_0x43f0c3[_0x112a('0x31')]);_0x49bafa['filters']=_['intersection'](_0x49bafa[_0x112a('0x30')],_0x49bafa[_0x112a('0x31')]);_0x5cb134['attributes']=_[_0x112a('0x33')](_0x49bafa[_0x112a('0x30')],qs[_0x112a('0x34')](_0x43f0c3[_0x112a('0x31')]['fields']));_0x5cb134[_0x112a('0x35')]=_0x5cb134[_0x112a('0x35')][_0x112a('0x36')]?_0x5cb134[_0x112a('0x35')]:_0x49bafa[_0x112a('0x30')];if(!_0x43f0c3[_0x112a('0x31')][_0x112a('0x37')](_0x112a('0x38'))){_0x5cb134[_0x112a('0x1a')]=qs[_0x112a('0x1a')](_0x43f0c3[_0x112a('0x31')][_0x112a('0x1a')]);_0x5cb134[_0x112a('0x1d')]=qs[_0x112a('0x1d')](_0x43f0c3[_0x112a('0x31')][_0x112a('0x1d')]);}_0x5cb134['order']=qs[_0x112a('0x39')](_0x43f0c3[_0x112a('0x31')]['sort']);_0x5cb134[_0x112a('0x3a')]=qs[_0x112a('0x3b')](_['pick'](_0x43f0c3[_0x112a('0x31')],_0x49bafa[_0x112a('0x3b')]),_0x126218);if(_0x43f0c3[_0x112a('0x31')]['filter']){_0x5cb134[_0x112a('0x3a')]=_[_0x112a('0x3c')](_0x5cb134[_0x112a('0x3a')],{'$or':_[_0x112a('0x2b')](_0x126218,function(_0x3450ba){if(_0x3450ba[_0x112a('0x2e')]!==_0x112a('0x3d')){var _0x507937={};_0x507937[_0x3450ba['name']]={'$like':'%'+_0x43f0c3[_0x112a('0x31')]['filter']+'%'};return _0x507937;}})});}_0x5cb134=_[_0x112a('0x3c')]({},_0x5cb134,_0x43f0c3[_0x112a('0x3e')]);var _0x25dc2f={'where':_0x5cb134[_0x112a('0x3a')]};return db[_0x112a('0x2c')][_0x112a('0x1c')](_0x25dc2f)['then'](function(_0x554b25){_0x2c6d5a[_0x112a('0x1c')]=_0x554b25;if(_0x43f0c3[_0x112a('0x31')][_0x112a('0x3f')]){_0x5cb134[_0x112a('0x40')]=[{'all':!![]}];}return db[_0x112a('0x2c')][_0x112a('0x41')](_0x5cb134);})['then'](function(_0x56a360){_0x2c6d5a[_0x112a('0x42')]=_0x56a360;return _0x2c6d5a;})[_0x112a('0x24')](respondWithFilteredResult(_0x486706,_0x5cb134))[_0x112a('0x43')](handleError(_0x486706,null));};exports[_0x112a('0x44')]=function(_0x9711c3,_0x1f6434){var _0x61f303={'raw':![],'where':{'id':_0x9711c3['params']['id']}},_0x2ee4d6={};_0x2ee4d6[_0x112a('0x30')]=_[_0x112a('0x32')](db[_0x112a('0x2c')][_0x112a('0x45')]);_0x2ee4d6[_0x112a('0x31')]=_[_0x112a('0x32')](_0x9711c3[_0x112a('0x31')]);_0x2ee4d6['filters']=_[_0x112a('0x33')](_0x2ee4d6[_0x112a('0x30')],_0x2ee4d6['query']);_0x61f303[_0x112a('0x35')]=_['intersection'](_0x2ee4d6[_0x112a('0x30')],qs[_0x112a('0x34')](_0x9711c3[_0x112a('0x31')][_0x112a('0x34')]));_0x61f303[_0x112a('0x35')]=_0x61f303[_0x112a('0x35')][_0x112a('0x36')]?_0x61f303['attributes']:_0x2ee4d6['model'];if(_0x9711c3[_0x112a('0x31')][_0x112a('0x3f')]){_0x61f303[_0x112a('0x40')]=[{'all':!![]}];}_0x61f303=_['merge']({},_0x61f303,_0x9711c3['options']);return db['ZohoAccount']['find'](_0x61f303)[_0x112a('0x24')](handleEntityNotFound(_0x1f6434,null))['then'](respondWithResult(_0x1f6434,null))[_0x112a('0x43')](handleError(_0x1f6434,null));};exports[_0x112a('0x46')]=function(_0x40cab6,_0x503d97){return db[_0x112a('0x2c')]['create'](_0x40cab6[_0x112a('0x47')],{})[_0x112a('0x24')](respondWithResult(_0x503d97,0xc9))[_0x112a('0x43')](handleError(_0x503d97,null));};exports['update']=function(_0x470128,_0x2d53d3){if(_0x470128['body']['id']){delete _0x470128[_0x112a('0x47')]['id'];}return db[_0x112a('0x2c')][_0x112a('0x48')]({'where':{'id':_0x470128[_0x112a('0x49')]['id']}})[_0x112a('0x24')](handleEntityNotFound(_0x2d53d3,null))[_0x112a('0x24')](saveUpdates(_0x470128[_0x112a('0x47')],null))[_0x112a('0x24')](respondWithResult(_0x2d53d3,null))[_0x112a('0x43')](handleError(_0x2d53d3,null));};exports['destroy']=function(_0x1a66d7,_0x3343fe){return db[_0x112a('0x2c')][_0x112a('0x48')]({'where':{'id':_0x1a66d7['params']['id']}})[_0x112a('0x24')](handleEntityNotFound(_0x3343fe,null))[_0x112a('0x24')](removeEntity(_0x3343fe,null))[_0x112a('0x43')](handleError(_0x3343fe,null));};exports['getConfigurations']=function(_0x4d00a6,_0x49a159,_0x2368eb){var _0x540feb={};var _0x52d373={};var _0x478afb;var _0x594c81;return db[_0x112a('0x2c')][_0x112a('0x4a')]({'where':{'id':_0x4d00a6['params']['id']}})[_0x112a('0x24')](handleEntityNotFound(_0x49a159,null))[_0x112a('0x24')](function(_0xdd0860){if(_0xdd0860){_0x478afb=_0xdd0860;_0x52d373[_0x112a('0x30')]=_[_0x112a('0x32')](db[_0x112a('0x4b')]['rawAttributes']);_0x52d373[_0x112a('0x31')]=_[_0x112a('0x32')](_0x4d00a6[_0x112a('0x31')]);_0x52d373['filters']=_[_0x112a('0x33')](_0x52d373[_0x112a('0x30')],_0x52d373[_0x112a('0x31')]);_0x540feb['attributes']=_[_0x112a('0x33')](_0x52d373[_0x112a('0x30')],qs['fields'](_0x4d00a6[_0x112a('0x31')]['fields']));_0x540feb[_0x112a('0x35')]=_0x540feb[_0x112a('0x35')]['length']?_0x540feb[_0x112a('0x35')]:_0x52d373[_0x112a('0x30')];_0x540feb[_0x112a('0x4c')]=qs[_0x112a('0x39')](_0x4d00a6[_0x112a('0x31')][_0x112a('0x39')]);_0x540feb[_0x112a('0x3a')]=qs[_0x112a('0x3b')](_[_0x112a('0x4d')](_0x4d00a6[_0x112a('0x31')],_0x52d373[_0x112a('0x3b')]));if(_0x4d00a6[_0x112a('0x31')][_0x112a('0x4e')]){_0x540feb[_0x112a('0x3a')]=_[_0x112a('0x3c')](_0x540feb['where'],{'$or':_[_0x112a('0x2b')](_0x540feb[_0x112a('0x35')],function(_0x3905cc){var _0x3e8ab9={};_0x3e8ab9[_0x3905cc]={'$like':'%'+_0x4d00a6[_0x112a('0x31')][_0x112a('0x4e')]+'%'};return _0x3e8ab9;})});}_0x540feb=_[_0x112a('0x3c')]({},_0x540feb,_0x4d00a6[_0x112a('0x3e')]);return _0x478afb['getConfigurations'](_0x540feb);}})[_0x112a('0x24')](function(_0x29c630){if(_0x29c630){_0x594c81=_0x29c630[_0x112a('0x36')];if(!_0x4d00a6[_0x112a('0x31')][_0x112a('0x37')](_0x112a('0x38'))){_0x540feb[_0x112a('0x1a')]=qs[_0x112a('0x1a')](_0x4d00a6['query'][_0x112a('0x1a')]);_0x540feb['offset']=qs[_0x112a('0x1d')](_0x4d00a6[_0x112a('0x31')][_0x112a('0x1d')]);}return _0x478afb[_0x112a('0x4f')](_0x540feb);}})[_0x112a('0x24')](function(_0x3a0674){if(_0x3a0674){return _0x3a0674?{'count':_0x594c81,'rows':_0x3a0674}:null;}})[_0x112a('0x24')](respondWithResult(_0x49a159,null))['catch'](handleError(_0x49a159,null));};exports[_0x112a('0x50')]=function(_0x421f64,_0x2a4986,_0x535caf){if(_0x421f64[_0x112a('0x47')]['id']){delete _0x421f64['body']['id'];}return db[_0x112a('0x2c')][_0x112a('0x4a')]({'where':{'id':_0x421f64[_0x112a('0x49')]['id']}})[_0x112a('0x24')](handleEntityNotFound(_0x2a4986,null))[_0x112a('0x24')](function(_0x4c430e){if(_0x4c430e){_0x421f64[_0x112a('0x47')][_0x112a('0x51')]=_0x4c430e['id'];_0x421f64[_0x112a('0x47')][_0x112a('0x52')]=integrations[_0x112a('0x53')](_0x421f64['body']['channel'],_0x421f64[_0x112a('0x47')][_0x112a('0x2e')]);_0x421f64[_0x112a('0x47')][_0x112a('0x54')]=integrations[_0x112a('0x55')](_0x421f64['body'][_0x112a('0x56')],_0x421f64['body']['type']);return db['ZohoConfiguration'][_0x112a('0x46')](_0x421f64[_0x112a('0x47')],{'include':[{'model':db[_0x112a('0x57')],'as':_0x112a('0x52')},{'model':db['ZohoField'],'as':_0x112a('0x54')}]});}return null;})[_0x112a('0x24')](respondWithResult(_0x2a4986,null))[_0x112a('0x43')](handleError(_0x2a4986,null));};function getAccessToken(_0x5f2d76){return new Promise(function(_0xfc2025,_0xebc34){var _0x39b57a;switch(_0x5f2d76[_0x112a('0x58')]){case'US':_0x39b57a=_0x112a('0x59');break;case'AU':_0x39b57a=_0x112a('0x5a');break;case'EU':_0x39b57a=_0x112a('0x5b');break;case'IN':_0x39b57a=_0x112a('0x5c');break;case'CN':_0x39b57a='https://accounts.zoho.com.cn';break;default:_0x39b57a=_0x112a('0x5b');break;}var _0x5dff14={'method':_0x112a('0x5d'),'uri':_0x39b57a+_0x112a('0x5e'),'qs':{'refresh_token':_0x5f2d76[_0x112a('0x5f')],'client_id':_0x5f2d76[_0x112a('0x60')],'client_secret':_0x5f2d76[_0x112a('0x61')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5dff14)['then'](function(_0x4c446f){if(_0x4c446f[_0x112a('0x62')]){_0xfc2025(_0x4c446f[_0x112a('0x62')]);}else{_0xebc34(_0x112a('0x63'));}})['catch'](function(_0x43df4c){_0xebc34(_0x43df4c);});});}exports[_0x112a('0x64')]=function(_0x33d2e7,_0x5993db,_0xd49080){var _0x5df4f9,_0x39807e,_0x112746,_0x18a595,_0xe075b4;return db[_0x112a('0x2c')]['findOne']({'where':{'id':_0x33d2e7['params']['id']},'attributes':['id',_0x112a('0x65'),'zone',_0x112a('0x60'),_0x112a('0x61'),_0x112a('0x66'),_0x112a('0x67'),_0x112a('0x5f')]})[_0x112a('0x24')](handleEntityNotFound(_0x5993db,null))[_0x112a('0x24')](function(_0x21efe1){_0xe075b4=_0x21efe1;_0x5df4f9=_0xe075b4[_0x112a('0x65')];_0x39807e=_0x5df4f9==='zoho.eu'?'eu':_0x112a('0x68');_0x112746=_0xe075b4[_0x112a('0x66')];var _0x59447f=_0x112746[_0x112a('0x69')](-0x1);if(_0x59447f==='/'||_0x59447f==='\x5c'||_0x59447f===':'){_0x112746=_0x112746[_0x112a('0x6a')](0x0,_0x112746[_0x112a('0x6b')](_0x59447f));}if(!_0xe075b4[_0x112a('0x5f')]){throw new Error(_0x112a('0x6c'));}return getAccessToken(_0xe075b4);})[_0x112a('0x24')](function(_0x41fae7){if(_0x41fae7){return rp({'method':'GET','uri':util[_0x112a('0x6d')](_0x112a('0x6e'),_0x39807e),'qs':{'module':_0x112a('0x6f')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x41fae7},'json':!![]});}})['then'](function(_0x15cd19){if(_0x15cd19){if(_0x15cd19[_0x112a('0x70')]&&_0x15cd19[_0x112a('0x70')][_0x112a('0x26')]){throw new Error(_0x15cd19[_0x112a('0x70')][_0x112a('0x26')][_0x112a('0x71')]);}var _0x32e0e1=[];var _0x46d5fb=[];var _0xf19d07=[_0x112a('0x72'),'Subject',_0x112a('0x73'),_0x112a('0x74'),_0x112a('0x75'),_0x112a('0x76'),_0x112a('0x77'),'Call_Type'];_0x46d5fb=_['remove'](_0x15cd19['fields'],function(_0x171b37){return _0xf19d07[_0x112a('0x78')](_0x171b37[_0x112a('0x79')]);});for(var _0x462f12=0x0;_0x462f12<_0x46d5fb[_0x112a('0x36')];_0x462f12++){if(_0x46d5fb[_0x462f12]['system_mandatory']===![]){_0x32e0e1[_0x112a('0x7a')]({'id':_0x46d5fb[_0x462f12]['id'],'name':_0x46d5fb[_0x462f12][_0x112a('0x7b')],'custom':_0x46d5fb[_0x462f12][_0x112a('0x7c')],'options':_0x46d5fb[_0x462f12]['data_type']===_0x112a('0x7d')&&_0x46d5fb[_0x462f12]['pick_list_values'][_0x112a('0x36')]>-0x1?_['map'](_0x46d5fb[_0x462f12]['pick_list_values'],function(_0xa93d3e){return{'name':_0xa93d3e,'value':_0xa93d3e};}):[]});}}return{'count':_0x32e0e1[_0x112a('0x36')],'rows':_0x32e0e1};}else{return{'count':0x0,'rows':[]};}})[_0x112a('0x24')](respondWithResult(_0x5993db,null))[_0x112a('0x43')](function(_0x4ad6b2){var _0x45b2bf=_0x33d2e7[_0x112a('0x31')]['test']?0x1f4:_0x4ad6b2[_0x112a('0x7e')]||0x1f4;logger[_0x112a('0x26')](_0x112a('0x7f'),_0x112a('0x64'),_0x45b2bf,JSON[_0x112a('0x80')](_0x4ad6b2));delete _0x4ad6b2['name'];if(_0x45b2bf===0x191){_0x45b2bf=0x190;}_0x5993db['status'](_0x45b2bf)['send'](_0x33d2e7[_0x112a('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4ad6b2[_0x112a('0x7e')]}:_0x4ad6b2);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 83f1c4e..97857cc 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 _0xe7d6=['../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','code','host','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','clientSecret','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','https://accounts.zoho.com.cn','authorization_code','parse','catch','lodash','../../config/logger','api','moment','rimraf'];(function(_0x33b62d,_0x507d01){var _0x215d79=function(_0x3b7c4f){while(--_0x3b7c4f){_0x33b62d['push'](_0x33b62d['shift']());}};_0x215d79(++_0x507d01);}(_0xe7d6,0xa3));var _0x6e7d=function(_0x569294,_0x196aad){_0x569294=_0x569294-0x0;var _0x3daeaf=_0xe7d6[_0x569294];return _0x3daeaf;};'use strict';var _=require(_0x6e7d('0x0'));var util=require('util');var logger=require(_0x6e7d('0x1'))(_0x6e7d('0x2'));var moment=require(_0x6e7d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6e7d('0x4'));var config=require(_0x6e7d('0x5'));var attributes=require(_0x6e7d('0x6'));var integrations=require(_0x6e7d('0x7'));module[_0x6e7d('0x8')]=function(_0xb68904,_0x374f6d){return _0xb68904[_0x6e7d('0x9')](_0x6e7d('0xa'),attributes,{'tableName':_0x6e7d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x39f6cd,_0x76dcf1,_0x1b0c8a){if(_0x39f6cd[_0x6e7d('0xc')](_0x6e7d('0xd'))||_0x39f6cd[_0x6e7d('0xc')]('serverUrl')||_0x39f6cd['changed'](_0x6e7d('0xe'))||_0x39f6cd['changed']('clientSecret')||_0x39f6cd['changed'](_0x6e7d('0xf'))||_0x39f6cd[_0x6e7d('0xc')](_0x6e7d('0x10'))){var _0x2fc8f0,_0x24b7ff;_0x2fc8f0=_0x39f6cd[_0x6e7d('0x11')];var _0x761a2d=_0x2fc8f0[_0x6e7d('0x12')](-0x1);if(_0x761a2d==='/'||_0x761a2d==='\x5c'||_0x761a2d===':'){_0x2fc8f0=_0x2fc8f0[_0x6e7d('0x13')](0x0,_0x2fc8f0[_0x6e7d('0x14')](_0x761a2d));}switch(_0x39f6cd[_0x6e7d('0xd')]){case'US':_0x24b7ff=_0x6e7d('0x15');break;case'AU':_0x24b7ff=_0x6e7d('0x16');break;case'IN':_0x24b7ff=_0x6e7d('0x17');break;case'CN':_0x24b7ff='https://accounts.zoho.com.cn';break;default:_0x24b7ff='https://accounts.zoho.eu';break;}var _0x5cb3dc={'method':_0x6e7d('0x18'),'uri':_0x24b7ff+_0x6e7d('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x39f6cd[_0x6e7d('0xe')],'client_secret':_0x39f6cd[_0x6e7d('0x1a')],'redirect_uri':_0x39f6cd[_0x6e7d('0x11')],'code':_0x39f6cd[_0x6e7d('0xf')]},'headers':{'Content-Type':_0x6e7d('0x1b')}};return rp(_0x5cb3dc)[_0x6e7d('0x1c')](function(_0x5c1dca){var _0x4561ff=JSON['parse'](_0x5c1dca);if(_0x4561ff[_0x6e7d('0x1d')]){_0x39f6cd[_0x6e7d('0x1e')]=_0x4561ff[_0x6e7d('0x1d')];logger[_0x6e7d('0x1f')](util[_0x6e7d('0x20')](_0x6e7d('0x21'),_0x39f6cd[_0x6e7d('0x22')],_0x39f6cd['id']));}else{logger[_0x6e7d('0x23')](util[_0x6e7d('0x20')](_0x6e7d('0x24'),_0x39f6cd[_0x6e7d('0x22')],_0x39f6cd['id']),util[_0x6e7d('0x25')](_0x4561ff,{'showHidden':![],'depth':null}));}return _0x1b0c8a(null,_0x76dcf1);})['catch'](function(_0x9841a0){logger[_0x6e7d('0x23')](util[_0x6e7d('0x20')](_0x6e7d('0x24'),_0x39f6cd['name'],_0x39f6cd['id']),util[_0x6e7d('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x1b0c8a(_0x9841a0);});}else{return _0x1b0c8a(null,_0x76dcf1);}},'beforeUpdate':function(_0x4b9bb7,_0x158be0,_0x16f7ff){if(_0x4b9bb7[_0x6e7d('0xc')](_0x6e7d('0xd'))||_0x4b9bb7[_0x6e7d('0xc')](_0x6e7d('0x11'))||_0x4b9bb7['changed'](_0x6e7d('0xe'))||_0x4b9bb7['changed']('clientSecret')||_0x4b9bb7[_0x6e7d('0xc')]('code')||_0x4b9bb7[_0x6e7d('0xc')]('host')){var _0x43641f,_0x5c892f;_0x43641f=_0x4b9bb7[_0x6e7d('0x11')];var _0xcbb42d=_0x43641f['slice'](-0x1);if(_0xcbb42d==='/'||_0xcbb42d==='\x5c'||_0xcbb42d===':'){_0x43641f=_0x43641f['substring'](0x0,_0x43641f[_0x6e7d('0x14')](_0xcbb42d));}switch(_0x4b9bb7['zone']){case'US':_0x5c892f='https://accounts.zoho.com';break;case'AU':_0x5c892f='https://accounts.zoho.com.au';break;case'IN':_0x5c892f=_0x6e7d('0x17');break;case'CN':_0x5c892f=_0x6e7d('0x26');break;default:_0x5c892f='https://accounts.zoho.eu';break;}var _0xd8376e={'method':_0x6e7d('0x18'),'uri':_0x5c892f+_0x6e7d('0x19'),'form':{'grant_type':_0x6e7d('0x27'),'client_id':_0x4b9bb7[_0x6e7d('0xe')],'client_secret':_0x4b9bb7[_0x6e7d('0x1a')],'redirect_uri':_0x4b9bb7[_0x6e7d('0x11')],'code':_0x4b9bb7[_0x6e7d('0xf')]},'headers':{'Content-Type':_0x6e7d('0x1b')}};return rp(_0xd8376e)[_0x6e7d('0x1c')](function(_0x33f795){var _0x4fcdd4=JSON[_0x6e7d('0x28')](_0x33f795);if(_0x4fcdd4['refresh_token']){_0x4b9bb7[_0x6e7d('0x1e')]=_0x4fcdd4['refresh_token'];logger[_0x6e7d('0x1f')](util[_0x6e7d('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4b9bb7[_0x6e7d('0x22')],_0x4b9bb7['id']));}else{logger[_0x6e7d('0x23')](util[_0x6e7d('0x20')](_0x6e7d('0x24'),_0x4b9bb7[_0x6e7d('0x22')],_0x4b9bb7['id']),util[_0x6e7d('0x25')](_0x4fcdd4,{'showHidden':![],'depth':null}));}return _0x16f7ff(null,_0x158be0);})[_0x6e7d('0x29')](function(_0x33a83b){logger[_0x6e7d('0x23')](util[_0x6e7d('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4b9bb7[_0x6e7d('0x22')],_0x4b9bb7['id']),util[_0x6e7d('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x16f7ff(_0x33a83b);});}else{return _0x16f7ff(null,_0x158be0);}}}});}; \ No newline at end of file +var _0x8e5e=['/oauth/v2/token','authorization_code','serverUrl','application/x-www-form-urlencoded','then','refresh_token','refreshToken','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','slice','parse','info','util','../../config/logger','api','moment','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','clientId','clientSecret','code','host','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST'];(function(_0x39e555,_0x473aae){var _0x385306=function(_0x5c6b61){while(--_0x5c6b61){_0x39e555['push'](_0x39e555['shift']());}};_0x385306(++_0x473aae);}(_0x8e5e,0x181));var _0xe8e5=function(_0x4b2693,_0x29f874){_0x4b2693=_0x4b2693-0x0;var _0x1957d7=_0x8e5e[_0x4b2693];return _0x1957d7;};'use strict';var _=require('lodash');var util=require(_0xe8e5('0x0'));var logger=require(_0xe8e5('0x1'))(_0xe8e5('0x2'));var moment=require(_0xe8e5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8e5('0x4'));var rimraf=require(_0xe8e5('0x5'));var config=require('../../config/environment');var attributes=require(_0xe8e5('0x6'));var integrations=require(_0xe8e5('0x7'));module[_0xe8e5('0x8')]=function(_0x5d7bef,_0x30de43){return _0x5d7bef[_0xe8e5('0x9')]('ZohoAccount',attributes,{'tableName':_0xe8e5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x15b2db,_0x48a1b1,_0x11ae48){if(_0x15b2db[_0xe8e5('0xb')]('zone')||_0x15b2db['changed']('serverUrl')||_0x15b2db[_0xe8e5('0xb')](_0xe8e5('0xc'))||_0x15b2db[_0xe8e5('0xb')](_0xe8e5('0xd'))||_0x15b2db[_0xe8e5('0xb')](_0xe8e5('0xe'))||_0x15b2db[_0xe8e5('0xb')](_0xe8e5('0xf'))){var _0x26a74c,_0x2b1e16;_0x26a74c=_0x15b2db['serverUrl'];var _0xc8958e=_0x26a74c['slice'](-0x1);if(_0xc8958e==='/'||_0xc8958e==='\x5c'||_0xc8958e===':'){_0x26a74c=_0x26a74c[_0xe8e5('0x10')](0x0,_0x26a74c[_0xe8e5('0x11')](_0xc8958e));}switch(_0x15b2db[_0xe8e5('0x12')]){case'US':_0x2b1e16=_0xe8e5('0x13');break;case'AU':_0x2b1e16=_0xe8e5('0x14');break;case'IN':_0x2b1e16=_0xe8e5('0x15');break;case'CN':_0x2b1e16=_0xe8e5('0x16');break;default:_0x2b1e16=_0xe8e5('0x17');break;}var _0x1cc1de={'method':_0xe8e5('0x18'),'uri':_0x2b1e16+_0xe8e5('0x19'),'form':{'grant_type':_0xe8e5('0x1a'),'client_id':_0x15b2db['clientId'],'client_secret':_0x15b2db[_0xe8e5('0xd')],'redirect_uri':_0x15b2db[_0xe8e5('0x1b')],'code':_0x15b2db[_0xe8e5('0xe')]},'headers':{'Content-Type':_0xe8e5('0x1c')}};return rp(_0x1cc1de)[_0xe8e5('0x1d')](function(_0x1f2c77){var _0x3cc266=JSON['parse'](_0x1f2c77);if(_0x3cc266[_0xe8e5('0x1e')]){_0x15b2db[_0xe8e5('0x1f')]=_0x3cc266[_0xe8e5('0x1e')];logger['info'](util[_0xe8e5('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x15b2db[_0xe8e5('0x21')],_0x15b2db['id']));}else{logger[_0xe8e5('0x22')](util['format'](_0xe8e5('0x23'),_0x15b2db[_0xe8e5('0x21')],_0x15b2db['id']),util['inspect'](_0x3cc266,{'showHidden':![],'depth':null}));}return _0x11ae48(null,_0x48a1b1);})[_0xe8e5('0x24')](function(_0x17cb63){logger[_0xe8e5('0x22')](util[_0xe8e5('0x20')](_0xe8e5('0x23'),_0x15b2db[_0xe8e5('0x21')],_0x15b2db['id']),util[_0xe8e5('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x11ae48(_0x17cb63);});}else{return _0x11ae48(null,_0x48a1b1);}},'beforeUpdate':function(_0x205ce5,_0x146e86,_0x1defec){if(_0x205ce5[_0xe8e5('0xb')]('zone')||_0x205ce5['changed']('serverUrl')||_0x205ce5[_0xe8e5('0xb')](_0xe8e5('0xc'))||_0x205ce5['changed'](_0xe8e5('0xd'))||_0x205ce5[_0xe8e5('0xb')](_0xe8e5('0xe'))||_0x205ce5[_0xe8e5('0xb')]('host')){var _0x110a9c,_0x5440a2;_0x110a9c=_0x205ce5[_0xe8e5('0x1b')];var _0x15c196=_0x110a9c[_0xe8e5('0x26')](-0x1);if(_0x15c196==='/'||_0x15c196==='\x5c'||_0x15c196===':'){_0x110a9c=_0x110a9c['substring'](0x0,_0x110a9c[_0xe8e5('0x11')](_0x15c196));}switch(_0x205ce5[_0xe8e5('0x12')]){case'US':_0x5440a2=_0xe8e5('0x13');break;case'AU':_0x5440a2=_0xe8e5('0x14');break;case'IN':_0x5440a2=_0xe8e5('0x15');break;case'CN':_0x5440a2=_0xe8e5('0x16');break;default:_0x5440a2=_0xe8e5('0x17');break;}var _0x32abdf={'method':_0xe8e5('0x18'),'uri':_0x5440a2+'/oauth/v2/token','form':{'grant_type':_0xe8e5('0x1a'),'client_id':_0x205ce5[_0xe8e5('0xc')],'client_secret':_0x205ce5['clientSecret'],'redirect_uri':_0x205ce5[_0xe8e5('0x1b')],'code':_0x205ce5[_0xe8e5('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x32abdf)[_0xe8e5('0x1d')](function(_0x2829fb){var _0x3f2af5=JSON[_0xe8e5('0x27')](_0x2829fb);if(_0x3f2af5[_0xe8e5('0x1e')]){_0x205ce5[_0xe8e5('0x1f')]=_0x3f2af5[_0xe8e5('0x1e')];logger[_0xe8e5('0x28')](util[_0xe8e5('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x205ce5[_0xe8e5('0x21')],_0x205ce5['id']));}else{logger[_0xe8e5('0x22')](util[_0xe8e5('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x205ce5[_0xe8e5('0x21')],_0x205ce5['id']),util[_0xe8e5('0x25')](_0x3f2af5,{'showHidden':![],'depth':null}));}return _0x1defec(null,_0x146e86);})['catch'](function(_0x49bec8){logger[_0xe8e5('0x22')](util[_0xe8e5('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x205ce5[_0xe8e5('0x21')],_0x205ce5['id']),util[_0xe8e5('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x1defec(_0x49bec8);});}else{return _0x1defec(null,_0x146e86);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 9560c0d..247b49a 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 _0xa064=['message','ZohoAccount,\x20%s,\x20%s','result','catch','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetZohoAccount','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xa064,0x192));var _0x4a06=function(_0x36e0f6,_0x4da6a7){_0x36e0f6=_0x36e0f6-0x0;var _0xc90479=_0xa064[_0x36e0f6];return _0xc90479;};'use strict';var _=require(_0x4a06('0x0'));var util=require(_0x4a06('0x1'));var moment=require(_0x4a06('0x2'));var BPromise=require(_0x4a06('0x3'));var rs=require(_0x4a06('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4a06('0x5'));var logger=require('../../config/logger')(_0x4a06('0x6'));var config=require(_0x4a06('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a06('0x8')][_0x4a06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55d4e3,_0x3b01cc,_0x454574){return new BPromise(function(_0x4c966b,_0x5e3342){return client[_0x4a06('0xa')](_0x55d4e3,_0x454574)[_0x4a06('0xb')](function(_0x3a8db5){logger[_0x4a06('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x3b01cc,_0x4a06('0xd'));logger[_0x4a06('0xe')](_0x4a06('0xf'),_0x3b01cc,_0x4a06('0xd'),JSON[_0x4a06('0x10')](_0x3a8db5));if(_0x3a8db5[_0x4a06('0x11')]){if(_0x3a8db5[_0x4a06('0x11')]['code']===0x1f4){logger[_0x4a06('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x3b01cc,_0x3a8db5[_0x4a06('0x11')][_0x4a06('0x12')]);return _0x5e3342(_0x3a8db5[_0x4a06('0x11')]['message']);}logger[_0x4a06('0x11')](_0x4a06('0x13'),_0x3b01cc,_0x3a8db5[_0x4a06('0x11')]['message']);return _0x4c966b(_0x3a8db5[_0x4a06('0x11')][_0x4a06('0x12')]);}else{logger[_0x4a06('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x3b01cc,_0x4a06('0xd'));_0x4c966b(_0x3a8db5[_0x4a06('0x14')][_0x4a06('0x12')]);}})[_0x4a06('0x15')](function(_0x15b067){logger['error'](_0x4a06('0x13'),_0x3b01cc,_0x15b067);_0x5e3342(_0x15b067);});});}exports['GetZohoAccount']=function(_0x4fd47f){var _0x9ea060=this;return new Promise(function(_0x463aca,_0x29e98b){return db[_0x4a06('0x16')][_0x4a06('0x17')]({'raw':_0x4fd47f[_0x4a06('0x18')]?_0x4fd47f[_0x4a06('0x18')][_0x4a06('0x19')]===undefined?!![]:![]:!![],'where':_0x4fd47f[_0x4a06('0x18')]?_0x4fd47f['options'][_0x4a06('0x1a')]||null:null,'attributes':_0x4fd47f[_0x4a06('0x18')]?_0x4fd47f[_0x4a06('0x18')][_0x4a06('0x1b')]||null:null,'limit':_0x4fd47f[_0x4a06('0x18')]?_0x4fd47f[_0x4a06('0x18')][_0x4a06('0x1c')]||null:null,'include':_0x4fd47f[_0x4a06('0x18')]?_0x4fd47f[_0x4a06('0x18')][_0x4a06('0x1d')]?_[_0x4a06('0x1e')](_0x4fd47f[_0x4a06('0x18')][_0x4a06('0x1d')],function(_0x5ebd7c){return{'model':db[_0x5ebd7c['model']],'as':_0x5ebd7c['as'],'attributes':_0x5ebd7c[_0x4a06('0x1b')],'include':_0x5ebd7c[_0x4a06('0x1d')]?_[_0x4a06('0x1e')](_0x5ebd7c[_0x4a06('0x1d')],function(_0x5b5a43){return{'model':db[_0x5b5a43['model']],'as':_0x5b5a43['as'],'attributes':_0x5b5a43[_0x4a06('0x1b')],'include':_0x5b5a43[_0x4a06('0x1d')]?_['map'](_0x5b5a43[_0x4a06('0x1d')],function(_0x54613e){return{'model':db[_0x54613e[_0x4a06('0x1f')]],'as':_0x54613e['as'],'attributes':_0x54613e[_0x4a06('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a47be){logger[_0x4a06('0xc')](_0x4a06('0x20'),_0x4fd47f);logger[_0x4a06('0xe')](_0x4a06('0x20'),_0x4fd47f,JSON[_0x4a06('0x10')](_0x1a47be));_0x463aca(_0x1a47be);})['catch'](function(_0x255924){logger[_0x4a06('0x11')](_0x4a06('0x20'),_0x255924['message'],_0x4fd47f);_0x29e98b(_0x9ea060[_0x4a06('0x11')](0x1f4,_0x255924[_0x4a06('0x12')]));});});};exports[_0x4a06('0x21')]=function(_0x5de4ed){var _0x5a440c=this;return new Promise(function(_0x424e8e,_0x235804){return db[_0x4a06('0x16')][_0x4a06('0x22')]({'raw':_0x5de4ed[_0x4a06('0x18')]?_0x5de4ed[_0x4a06('0x18')][_0x4a06('0x19')]===undefined?!![]:![]:!![],'where':_0x5de4ed[_0x4a06('0x18')]?_0x5de4ed['options'][_0x4a06('0x1a')]||null:null,'attributes':_0x5de4ed[_0x4a06('0x18')]?_0x5de4ed[_0x4a06('0x18')][_0x4a06('0x1b')]||null:null,'include':_0x5de4ed[_0x4a06('0x18')]?_0x5de4ed['options'][_0x4a06('0x1d')]?_['map'](_0x5de4ed[_0x4a06('0x18')][_0x4a06('0x1d')],function(_0x4c0d58){return{'model':db[_0x4c0d58[_0x4a06('0x1f')]],'as':_0x4c0d58['as'],'attributes':_0x4c0d58[_0x4a06('0x1b')],'include':_0x4c0d58[_0x4a06('0x1d')]?_[_0x4a06('0x1e')](_0x4c0d58[_0x4a06('0x1d')],function(_0x4de43c){return{'model':db[_0x4de43c[_0x4a06('0x1f')]],'as':_0x4de43c['as'],'attributes':_0x4de43c['attributes'],'include':_0x4de43c[_0x4a06('0x1d')]?_[_0x4a06('0x1e')](_0x4de43c[_0x4a06('0x1d')],function(_0x4a0a1e){return{'model':db[_0x4a0a1e[_0x4a06('0x1f')]],'as':_0x4a0a1e['as'],'attributes':_0x4a0a1e[_0x4a06('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4a06('0xb')](function(_0x1095f8){logger[_0x4a06('0xc')](_0x4a06('0x21'),_0x5de4ed);logger['debug'](_0x4a06('0x21'),_0x5de4ed,JSON['stringify'](_0x1095f8));_0x424e8e(_0x1095f8);})[_0x4a06('0x15')](function(_0x301bb4){logger[_0x4a06('0x11')]('ShowZohoAccount',_0x301bb4[_0x4a06('0x12')],_0x5de4ed);_0x235804(_0x5a440c['error'](0x1f4,_0x301bb4[_0x4a06('0x12')]));});});}; \ No newline at end of file +var _0x1c52=['ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','GetZohoAccount','ZohoAccount','options','where','attributes','limit','include','map','model','catch','ShowZohoAccount','find','raw','stringify','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x45f44e,_0x2039e8){var _0x34b920=function(_0x147913){while(--_0x147913){_0x45f44e['push'](_0x45f44e['shift']());}};_0x34b920(++_0x2039e8);}(_0x1c52,0x7c));var _0x21c5=function(_0x40bc4b,_0x2fbb54){_0x40bc4b=_0x40bc4b-0x0;var _0x342f74=_0x1c52[_0x40bc4b];return _0x342f74;};'use strict';var _=require(_0x21c5('0x0'));var util=require(_0x21c5('0x1'));var moment=require(_0x21c5('0x2'));var BPromise=require(_0x21c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x21c5('0x4'));var logger=require(_0x21c5('0x5'))('rpc');var config=require(_0x21c5('0x6'));var jayson=require(_0x21c5('0x7'));var client=jayson[_0x21c5('0x8')][_0x21c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b12d5,_0xed0195,_0xb4b1e4){return new BPromise(function(_0x4c5a4f,_0xd34da2){return client[_0x21c5('0xa')](_0x5b12d5,_0xb4b1e4)[_0x21c5('0xb')](function(_0x27389f){logger['info'](_0x21c5('0xc'),_0xed0195,_0x21c5('0xd'));logger[_0x21c5('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xed0195,_0x21c5('0xd'),JSON['stringify'](_0x27389f));if(_0x27389f[_0x21c5('0xf')]){if(_0x27389f[_0x21c5('0xf')][_0x21c5('0x10')]===0x1f4){logger[_0x21c5('0xf')]('ZohoAccount,\x20%s,\x20%s',_0xed0195,_0x27389f[_0x21c5('0xf')]['message']);return _0xd34da2(_0x27389f[_0x21c5('0xf')][_0x21c5('0x11')]);}logger['error'](_0x21c5('0xc'),_0xed0195,_0x27389f['error']['message']);return _0x4c5a4f(_0x27389f[_0x21c5('0xf')][_0x21c5('0x11')]);}else{logger[_0x21c5('0x12')](_0x21c5('0xc'),_0xed0195,_0x21c5('0xd'));_0x4c5a4f(_0x27389f[_0x21c5('0x13')][_0x21c5('0x11')]);}})['catch'](function(_0x331080){logger['error']('ZohoAccount,\x20%s,\x20%s',_0xed0195,_0x331080);_0xd34da2(_0x331080);});});}exports[_0x21c5('0x14')]=function(_0x56696e){var _0x4daf4d=this;return new Promise(function(_0x1bc8a4,_0x4e630f){return db[_0x21c5('0x15')]['findAll']({'raw':_0x56696e[_0x21c5('0x16')]?_0x56696e['options']['raw']===undefined?!![]:![]:!![],'where':_0x56696e[_0x21c5('0x16')]?_0x56696e[_0x21c5('0x16')][_0x21c5('0x17')]||null:null,'attributes':_0x56696e[_0x21c5('0x16')]?_0x56696e[_0x21c5('0x16')][_0x21c5('0x18')]||null:null,'limit':_0x56696e[_0x21c5('0x16')]?_0x56696e[_0x21c5('0x16')][_0x21c5('0x19')]||null:null,'include':_0x56696e['options']?_0x56696e[_0x21c5('0x16')][_0x21c5('0x1a')]?_[_0x21c5('0x1b')](_0x56696e[_0x21c5('0x16')][_0x21c5('0x1a')],function(_0x4bf186){return{'model':db[_0x4bf186[_0x21c5('0x1c')]],'as':_0x4bf186['as'],'attributes':_0x4bf186[_0x21c5('0x18')],'include':_0x4bf186[_0x21c5('0x1a')]?_[_0x21c5('0x1b')](_0x4bf186[_0x21c5('0x1a')],function(_0x4d3215){return{'model':db[_0x4d3215['model']],'as':_0x4d3215['as'],'attributes':_0x4d3215[_0x21c5('0x18')],'include':_0x4d3215[_0x21c5('0x1a')]?_[_0x21c5('0x1b')](_0x4d3215[_0x21c5('0x1a')],function(_0x2ae029){return{'model':db[_0x2ae029[_0x21c5('0x1c')]],'as':_0x2ae029['as'],'attributes':_0x2ae029['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5918df){logger[_0x21c5('0x12')](_0x21c5('0x14'),_0x56696e);logger[_0x21c5('0xe')](_0x21c5('0x14'),_0x56696e,JSON['stringify'](_0x5918df));_0x1bc8a4(_0x5918df);})[_0x21c5('0x1d')](function(_0x428b60){logger[_0x21c5('0xf')](_0x21c5('0x14'),_0x428b60[_0x21c5('0x11')],_0x56696e);_0x4e630f(_0x4daf4d['error'](0x1f4,_0x428b60['message']));});});};exports[_0x21c5('0x1e')]=function(_0x29a15b){var _0x3353b3=this;return new Promise(function(_0x177ca1,_0x39662b){return db[_0x21c5('0x15')][_0x21c5('0x1f')]({'raw':_0x29a15b[_0x21c5('0x16')]?_0x29a15b[_0x21c5('0x16')][_0x21c5('0x20')]===undefined?!![]:![]:!![],'where':_0x29a15b['options']?_0x29a15b['options'][_0x21c5('0x17')]||null:null,'attributes':_0x29a15b['options']?_0x29a15b[_0x21c5('0x16')][_0x21c5('0x18')]||null:null,'include':_0x29a15b[_0x21c5('0x16')]?_0x29a15b[_0x21c5('0x16')]['include']?_[_0x21c5('0x1b')](_0x29a15b['options'][_0x21c5('0x1a')],function(_0x5a3308){return{'model':db[_0x5a3308[_0x21c5('0x1c')]],'as':_0x5a3308['as'],'attributes':_0x5a3308[_0x21c5('0x18')],'include':_0x5a3308[_0x21c5('0x1a')]?_['map'](_0x5a3308[_0x21c5('0x1a')],function(_0x4d52ca){return{'model':db[_0x4d52ca[_0x21c5('0x1c')]],'as':_0x4d52ca['as'],'attributes':_0x4d52ca[_0x21c5('0x18')],'include':_0x4d52ca[_0x21c5('0x1a')]?_['map'](_0x4d52ca[_0x21c5('0x1a')],function(_0x535498){return{'model':db[_0x535498['model']],'as':_0x535498['as'],'attributes':_0x535498[_0x21c5('0x18')]};}):[]};}):[]};}):[]:[]})[_0x21c5('0xb')](function(_0x1a25b7){logger[_0x21c5('0x12')]('ShowZohoAccount',_0x29a15b);logger[_0x21c5('0xe')](_0x21c5('0x1e'),_0x29a15b,JSON[_0x21c5('0x21')](_0x1a25b7));_0x177ca1(_0x1a25b7);})[_0x21c5('0x1d')](function(_0x20ec3a){logger[_0x21c5('0xf')](_0x21c5('0x1e'),_0x20ec3a[_0x21c5('0x11')],_0x29a15b);_0x39662b(_0x3353b3['error'](0x1f4,_0x20ec3a[_0x21c5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 68de638..9f7fecc 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 _0x9297=['getSubjects','getDescriptions','post','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects'];(function(_0x3f20a7,_0x1d4944){var _0x46de78=function(_0x446489){while(--_0x446489){_0x3f20a7['push'](_0x3f20a7['shift']());}};_0x46de78(++_0x1d4944);}(_0x9297,0x14a));var _0x7929=function(_0x122e8c,_0x14aa34){_0x122e8c=_0x122e8c-0x0;var _0x5f4c5f=_0x9297[_0x122e8c];return _0x5f4c5f;};'use strict';var multer=require('multer');var util=require(_0x7929('0x0'));var path=require(_0x7929('0x1'));var timeout=require(_0x7929('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7929('0x3'));var auth=require(_0x7929('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7929('0x5'));var controller=require('./intZohoConfiguration.controller');router[_0x7929('0x6')]('/',auth[_0x7929('0x7')](),controller[_0x7929('0x8')]);router[_0x7929('0x6')](_0x7929('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x7929('0x6')](_0x7929('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x7929('0x6')](_0x7929('0xb'),auth[_0x7929('0x7')](),controller[_0x7929('0xc')]);router[_0x7929('0x6')]('/:id/descriptions',auth[_0x7929('0x7')](),controller[_0x7929('0xd')]);router[_0x7929('0xe')]('/',auth['isAuthenticated'](),controller[_0x7929('0xf')]);router[_0x7929('0x10')]('/:id',auth[_0x7929('0x7')](),controller[_0x7929('0x11')]);router['delete'](_0x7929('0x9'),auth[_0x7929('0x7')](),controller['destroy']);module[_0x7929('0x12')]=router; \ No newline at end of file +var _0x1c96=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','multer'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x1c96,0x1b4));var _0x61c9=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x1c96[_0x3b231a];return _0x18d67a;};'use strict';var multer=require(_0x61c9('0x0'));var util=require(_0x61c9('0x1'));var path=require(_0x61c9('0x2'));var timeout=require('connect-timeout');var express=require(_0x61c9('0x3'));var router=express[_0x61c9('0x4')]();var fs_extra=require(_0x61c9('0x5'));var auth=require(_0x61c9('0x6'));var interaction=require(_0x61c9('0x7'));var config=require(_0x61c9('0x8'));var controller=require(_0x61c9('0x9'));router[_0x61c9('0xa')]('/',auth[_0x61c9('0xb')](),controller[_0x61c9('0xc')]);router[_0x61c9('0xa')](_0x61c9('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x61c9('0xa')](_0x61c9('0xe'),auth[_0x61c9('0xb')](),controller[_0x61c9('0xf')]);router[_0x61c9('0xa')](_0x61c9('0x10'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x61c9('0xa')](_0x61c9('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x61c9('0x12')]('/',auth[_0x61c9('0xb')](),controller[_0x61c9('0x13')]);router[_0x61c9('0x14')](_0x61c9('0xd'),auth[_0x61c9('0xb')](),controller[_0x61c9('0x15')]);router[_0x61c9('0x16')]('/:id',auth[_0x61c9('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index ce9f150..bfe4478 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 _0xcc1b=['sequelize','STRING','lead','contact','nothing','ENUM','contact_lead'];(function(_0x2a53c3,_0xe38745){var _0xcdaf2=function(_0x1637e6){while(--_0x1637e6){_0x2a53c3['push'](_0x2a53c3['shift']());}};_0xcdaf2(++_0xe38745);}(_0xcc1b,0x8c));var _0xbcc1=function(_0x17f4e9,_0x2dc448){_0x17f4e9=_0x17f4e9-0x0;var _0x31e1cd=_0xcc1b[_0x17f4e9];return _0x31e1cd;};'use strict';var Sequelize=require(_0xbcc1('0x0'));module['exports']={'name':{'type':Sequelize[_0xbcc1('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xbcc1('0x2'),_0xbcc1('0x3'),_0xbcc1('0x4')),'defaultValue':_0xbcc1('0x2')},'moduleSearch':{'type':Sequelize[_0xbcc1('0x5')](_0xbcc1('0x6'),_0xbcc1('0x3'),'lead'),'defaultValue':_0xbcc1('0x6')},'description':{'type':Sequelize[_0xbcc1('0x1')]}}; \ No newline at end of file +var _0xb1b6=['nothing','contact_lead','sequelize','exports','STRING','ENUM','lead','contact'];(function(_0x466ee0,_0x19f04a){var _0x53ea41=function(_0x17b933){while(--_0x17b933){_0x466ee0['push'](_0x466ee0['shift']());}};_0x53ea41(++_0x19f04a);}(_0xb1b6,0x9a));var _0x6b1b=function(_0x55a4d1,_0x24b8d1){_0x55a4d1=_0x55a4d1-0x0;var _0x3f4ee3=_0xb1b6[_0x55a4d1];return _0x3f4ee3;};'use strict';var Sequelize=require(_0x6b1b('0x0'));module[_0x6b1b('0x1')]={'name':{'type':Sequelize[_0x6b1b('0x2')]},'moduleCreate':{'type':Sequelize[_0x6b1b('0x3')](_0x6b1b('0x4'),_0x6b1b('0x5'),_0x6b1b('0x6')),'defaultValue':_0x6b1b('0x4')},'moduleSearch':{'type':Sequelize[_0x6b1b('0x3')](_0x6b1b('0x7'),_0x6b1b('0x5'),_0x6b1b('0x4')),'defaultValue':_0x6b1b('0x7')},'description':{'type':Sequelize[_0x6b1b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 976d8a8..58d1848 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 _0xe75f=['intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','includeAll','include','findAll','catch','show','length','options','find','create','body','params','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','send','index','ZohoConfiguration','rawAttributes','fieldName','type','map','keys','query','filters'];(function(_0x243719,_0x5b47c9){var _0x57e145=function(_0x2dfcb7){while(--_0x2dfcb7){_0x243719['push'](_0x243719['shift']());}};_0x57e145(++_0x5b47c9);}(_0xe75f,0x19a));var _0xfe75=function(_0xf519ef,_0x8d9703){_0xf519ef=_0xf519ef-0x0;var _0x57a8c0=_0xe75f[_0xf519ef];return _0x57a8c0;};'use strict';var emlformat=require(_0xfe75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe75('0x1'));var jsonpatch=require(_0xfe75('0x2'));var rp=require(_0xfe75('0x3'));var moment=require('moment');var BPromise=require(_0xfe75('0x4'));var Mustache=require('mustache');var util=require(_0xfe75('0x5'));var path=require('path');var sox=require(_0xfe75('0x6'));var csv=require(_0xfe75('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe75('0x8'));var _=require(_0xfe75('0x9'));var squel=require(_0xfe75('0xa'));var crypto=require('crypto');var jsforce=require(_0xfe75('0xb'));var deskjs=require(_0xfe75('0xc'));var toCsv=require(_0xfe75('0x7'));var querystring=require('querystring');var Papa=require(_0xfe75('0xd'));var Redis=require(_0xfe75('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfe75('0xf'));var hardwareService=require(_0xfe75('0x10'));var logger=require(_0xfe75('0x11'))('api');var utils=require(_0xfe75('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xfe75('0x13'));var db=require(_0xfe75('0x14'))['db'];function respondWithStatusCode(_0x582775,_0x5a5c3e){_0x5a5c3e=_0x5a5c3e||0xcc;return function(_0xaa141){if(_0xaa141){return _0x582775['sendStatus'](_0x5a5c3e);}return _0x582775[_0xfe75('0x15')](_0x5a5c3e)[_0xfe75('0x16')]();};}function respondWithResult(_0x49e64b,_0x4bde00){_0x4bde00=_0x4bde00||0xc8;return function(_0x1c3039){if(_0x1c3039){return _0x49e64b['status'](_0x4bde00)['json'](_0x1c3039);}};}function respondWithFilteredResult(_0x2a8cb5,_0x2f210e){return function(_0x344dbe){if(_0x344dbe){var _0x218d93=typeof _0x2f210e[_0xfe75('0x17')]===_0xfe75('0x18')&&typeof _0x2f210e[_0xfe75('0x19')]===_0xfe75('0x18');var _0x66f09b=_0x344dbe[_0xfe75('0x1a')];var _0x1ed6dc=_0x218d93?0x0:_0x2f210e[_0xfe75('0x17')];var _0x1901a2=_0x218d93?_0x344dbe[_0xfe75('0x1a')]:_0x2f210e[_0xfe75('0x17')]+_0x2f210e['limit'];var _0x16700e;if(_0x1901a2>=_0x66f09b){_0x1901a2=_0x66f09b;_0x16700e=0xc8;}else{_0x16700e=0xce;}_0x2a8cb5[_0xfe75('0x15')](_0x16700e);return _0x2a8cb5[_0xfe75('0x1b')](_0xfe75('0x1c'),_0x1ed6dc+'-'+_0x1901a2+'/'+_0x66f09b)['json'](_0x344dbe);}return null;};}function patchUpdates(_0x963c67){return function(_0x54da67){try{jsonpatch[_0xfe75('0x1d')](_0x54da67,_0x963c67,!![]);}catch(_0x3381ac){return BPromise[_0xfe75('0x1e')](_0x3381ac);}return _0x54da67[_0xfe75('0x1f')]();};}function saveUpdates(_0x39f060,_0x790f43){return function(_0x38eaff){if(_0x38eaff){return _0x38eaff[_0xfe75('0x20')](_0x39f060)[_0xfe75('0x21')](function(_0x408934){return _0x408934;});}return null;};}function removeEntity(_0x493315,_0x5351e2){return function(_0x618bf2){if(_0x618bf2){return _0x618bf2[_0xfe75('0x22')]()[_0xfe75('0x21')](function(){_0x493315[_0xfe75('0x15')](0xcc)[_0xfe75('0x16')]();});}};}function handleEntityNotFound(_0xbc85e2,_0x22aa3b){return function(_0x6211b8){if(!_0x6211b8){_0xbc85e2[_0xfe75('0x23')](0x194);}return _0x6211b8;};}function handleError(_0x2b595b,_0x540bbd){_0x540bbd=_0x540bbd||0x1f4;return function(_0x276fea){logger['error'](_0x276fea['stack']);if(_0x276fea['name']){delete _0x276fea['name'];}_0x2b595b[_0xfe75('0x15')](_0x540bbd)[_0xfe75('0x24')](_0x276fea);};}exports[_0xfe75('0x25')]=function(_0x5ac836,_0x1a95d1){var _0x222515={},_0x253aa8={},_0x5f23cc={'count':0x0,'rows':[]};var _0x4ee536=_['map'](db[_0xfe75('0x26')][_0xfe75('0x27')],function(_0x5910ae){return{'name':_0x5910ae[_0xfe75('0x28')],'type':_0x5910ae[_0xfe75('0x29')]['key']};});_0x253aa8['model']=_[_0xfe75('0x2a')](_0x4ee536,'name');_0x253aa8['query']=_[_0xfe75('0x2b')](_0x5ac836[_0xfe75('0x2c')]);_0x253aa8[_0xfe75('0x2d')]=_[_0xfe75('0x2e')](_0x253aa8[_0xfe75('0x2f')],_0x253aa8[_0xfe75('0x2c')]);_0x222515[_0xfe75('0x30')]=_[_0xfe75('0x2e')](_0x253aa8[_0xfe75('0x2f')],qs[_0xfe75('0x31')](_0x5ac836[_0xfe75('0x2c')][_0xfe75('0x31')]));_0x222515[_0xfe75('0x30')]=_0x222515['attributes']['length']?_0x222515[_0xfe75('0x30')]:_0x253aa8[_0xfe75('0x2f')];if(!_0x5ac836['query'][_0xfe75('0x32')](_0xfe75('0x33'))){_0x222515[_0xfe75('0x19')]=qs[_0xfe75('0x19')](_0x5ac836[_0xfe75('0x2c')][_0xfe75('0x19')]);_0x222515[_0xfe75('0x17')]=qs[_0xfe75('0x17')](_0x5ac836[_0xfe75('0x2c')]['offset']);}_0x222515[_0xfe75('0x34')]=qs[_0xfe75('0x35')](_0x5ac836[_0xfe75('0x2c')][_0xfe75('0x35')]);_0x222515[_0xfe75('0x36')]=qs[_0xfe75('0x2d')](_[_0xfe75('0x37')](_0x5ac836[_0xfe75('0x2c')],_0x253aa8['filters']),_0x4ee536);if(_0x5ac836[_0xfe75('0x2c')][_0xfe75('0x38')]){_0x222515[_0xfe75('0x36')]=_[_0xfe75('0x39')](_0x222515[_0xfe75('0x36')],{'$or':_[_0xfe75('0x2a')](_0x4ee536,function(_0x32fcab){if(_0x32fcab[_0xfe75('0x29')]!==_0xfe75('0x3a')){var _0x25b3f7={};_0x25b3f7[_0x32fcab[_0xfe75('0x3b')]]={'$like':'%'+_0x5ac836['query'][_0xfe75('0x38')]+'%'};return _0x25b3f7;}})});}_0x222515=_['merge']({},_0x222515,_0x5ac836['options']);var _0x361427={'where':_0x222515[_0xfe75('0x36')]};return db[_0xfe75('0x26')][_0xfe75('0x1a')](_0x361427)[_0xfe75('0x21')](function(_0x16eee4){_0x5f23cc[_0xfe75('0x1a')]=_0x16eee4;if(_0x5ac836[_0xfe75('0x2c')][_0xfe75('0x3c')]){_0x222515[_0xfe75('0x3d')]=[{'all':!![]}];}return db[_0xfe75('0x26')][_0xfe75('0x3e')](_0x222515);})[_0xfe75('0x21')](function(_0x18a7ec){_0x5f23cc['rows']=_0x18a7ec;return _0x5f23cc;})['then'](respondWithFilteredResult(_0x1a95d1,_0x222515))[_0xfe75('0x3f')](handleError(_0x1a95d1,null));};exports[_0xfe75('0x40')]=function(_0xf3968e,_0x2b1aac){var _0x3c8fac={'raw':![],'where':{'id':_0xf3968e['params']['id']}},_0x11f4c4={};_0x11f4c4['model']=_[_0xfe75('0x2b')](db['ZohoConfiguration']['rawAttributes']);_0x11f4c4[_0xfe75('0x2c')]=_[_0xfe75('0x2b')](_0xf3968e[_0xfe75('0x2c')]);_0x11f4c4[_0xfe75('0x2d')]=_[_0xfe75('0x2e')](_0x11f4c4[_0xfe75('0x2f')],_0x11f4c4['query']);_0x3c8fac[_0xfe75('0x30')]=_[_0xfe75('0x2e')](_0x11f4c4[_0xfe75('0x2f')],qs['fields'](_0xf3968e[_0xfe75('0x2c')][_0xfe75('0x31')]));_0x3c8fac[_0xfe75('0x30')]=_0x3c8fac[_0xfe75('0x30')][_0xfe75('0x41')]?_0x3c8fac[_0xfe75('0x30')]:_0x11f4c4['model'];if(_0xf3968e[_0xfe75('0x2c')][_0xfe75('0x3c')]){_0x3c8fac[_0xfe75('0x3d')]=[{'all':!![]}];}_0x3c8fac=_[_0xfe75('0x39')]({},_0x3c8fac,_0xf3968e[_0xfe75('0x42')]);return db[_0xfe75('0x26')][_0xfe75('0x43')](_0x3c8fac)['then'](handleEntityNotFound(_0x2b1aac,null))['then'](respondWithResult(_0x2b1aac,null))['catch'](handleError(_0x2b1aac,null));};exports['create']=function(_0x294cca,_0x25cceb){return db[_0xfe75('0x26')][_0xfe75('0x44')](_0x294cca['body'],{})[_0xfe75('0x21')](respondWithResult(_0x25cceb,0xc9))[_0xfe75('0x3f')](handleError(_0x25cceb,null));};exports[_0xfe75('0x20')]=function(_0x5608b6,_0x2a70a7){if(_0x5608b6['body']['id']){delete _0x5608b6[_0xfe75('0x45')]['id'];}return db[_0xfe75('0x26')]['find']({'where':{'id':_0x5608b6[_0xfe75('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a70a7,null))[_0xfe75('0x21')](saveUpdates(_0x5608b6[_0xfe75('0x45')],null))[_0xfe75('0x21')](respondWithResult(_0x2a70a7,null))[_0xfe75('0x3f')](handleError(_0x2a70a7,null));};exports[_0xfe75('0x22')]=function(_0xef3c2c,_0x5f24d8){return db['ZohoConfiguration'][_0xfe75('0x43')]({'where':{'id':_0xef3c2c[_0xfe75('0x46')]['id']}})[_0xfe75('0x21')](handleEntityNotFound(_0x5f24d8,null))['then'](removeEntity(_0x5f24d8,null))[_0xfe75('0x3f')](handleError(_0x5f24d8,null));};exports[_0xfe75('0x47')]=function(_0xfebe08,_0x3f7fb8,_0x4121a8){var _0x4f2786={};var _0x5eced1={};var _0x1198d0;var _0x316732;return db[_0xfe75('0x26')][_0xfe75('0x48')]({'where':{'id':_0xfebe08[_0xfe75('0x46')]['id']}})[_0xfe75('0x21')](handleEntityNotFound(_0x3f7fb8,null))[_0xfe75('0x21')](function(_0x5c3b76){if(_0x5c3b76){_0x1198d0=_0x5c3b76;_0x5eced1['model']=_['keys'](db[_0xfe75('0x49')][_0xfe75('0x27')]);_0x5eced1['query']=_['keys'](_0xfebe08[_0xfe75('0x2c')]);_0x5eced1[_0xfe75('0x2d')]=_[_0xfe75('0x2e')](_0x5eced1[_0xfe75('0x2f')],_0x5eced1['query']);_0x4f2786[_0xfe75('0x30')]=_[_0xfe75('0x2e')](_0x5eced1[_0xfe75('0x2f')],qs['fields'](_0xfebe08[_0xfe75('0x2c')][_0xfe75('0x31')]));_0x4f2786['attributes']=_0x4f2786[_0xfe75('0x30')][_0xfe75('0x41')]?_0x4f2786[_0xfe75('0x30')]:_0x5eced1[_0xfe75('0x2f')];_0x4f2786[_0xfe75('0x34')]=qs[_0xfe75('0x35')](_0xfebe08['query'][_0xfe75('0x35')]);_0x4f2786[_0xfe75('0x36')]=qs[_0xfe75('0x2d')](_[_0xfe75('0x37')](_0xfebe08['query'],_0x5eced1[_0xfe75('0x2d')]));if(_0xfebe08[_0xfe75('0x2c')][_0xfe75('0x38')]){_0x4f2786[_0xfe75('0x36')]=_['merge'](_0x4f2786['where'],{'$or':_['map'](_0x4f2786[_0xfe75('0x30')],function(_0x42655d){var _0x1b6643={};_0x1b6643[_0x42655d]={'$like':'%'+_0xfebe08[_0xfe75('0x2c')]['filter']+'%'};return _0x1b6643;})});}_0x4f2786=_[_0xfe75('0x39')]({},_0x4f2786,_0xfebe08[_0xfe75('0x42')]);return _0x1198d0['getFields'](_0x4f2786);}})['then'](function(_0x2c58f2){if(_0x2c58f2){_0x316732=_0x2c58f2[_0xfe75('0x41')];if(!_0xfebe08[_0xfe75('0x2c')][_0xfe75('0x32')]('nolimit')){_0x4f2786[_0xfe75('0x19')]=qs[_0xfe75('0x19')](_0xfebe08['query']['limit']);_0x4f2786[_0xfe75('0x17')]=qs[_0xfe75('0x17')](_0xfebe08[_0xfe75('0x2c')][_0xfe75('0x17')]);}return _0x1198d0[_0xfe75('0x47')](_0x4f2786);}})[_0xfe75('0x21')](function(_0x5eb260){if(_0x5eb260){return _0x5eb260?{'count':_0x316732,'rows':_0x5eb260}:null;}})[_0xfe75('0x21')](respondWithResult(_0x3f7fb8,null))[_0xfe75('0x3f')](handleError(_0x3f7fb8,null));};exports[_0xfe75('0x4a')]=function(_0x422389,_0x4f70d1,_0x38aa45){var _0x586e9a={};var _0xdc7392={};var _0x3e6bdf;var _0x36d9cf;return db[_0xfe75('0x26')][_0xfe75('0x48')]({'where':{'id':_0x422389[_0xfe75('0x46')]['id']}})[_0xfe75('0x21')](handleEntityNotFound(_0x4f70d1,null))[_0xfe75('0x21')](function(_0x3d1f84){if(_0x3d1f84){_0x3e6bdf=_0x3d1f84;_0xdc7392[_0xfe75('0x2f')]=_['keys'](db['ZohoField']['rawAttributes']);_0xdc7392['query']=_[_0xfe75('0x2b')](_0x422389['query']);_0xdc7392['filters']=_['intersection'](_0xdc7392[_0xfe75('0x2f')],_0xdc7392[_0xfe75('0x2c')]);_0x586e9a[_0xfe75('0x30')]=_['intersection'](_0xdc7392['model'],qs['fields'](_0x422389[_0xfe75('0x2c')][_0xfe75('0x31')]));_0x586e9a[_0xfe75('0x30')]=_0x586e9a[_0xfe75('0x30')][_0xfe75('0x41')]?_0x586e9a[_0xfe75('0x30')]:_0xdc7392['model'];_0x586e9a[_0xfe75('0x34')]=qs['sort'](_0x422389[_0xfe75('0x2c')][_0xfe75('0x35')]);_0x586e9a['where']=qs[_0xfe75('0x2d')](_[_0xfe75('0x37')](_0x422389[_0xfe75('0x2c')],_0xdc7392[_0xfe75('0x2d')]));if(_0x422389[_0xfe75('0x2c')][_0xfe75('0x38')]){_0x586e9a[_0xfe75('0x36')]=_[_0xfe75('0x39')](_0x586e9a['where'],{'$or':_[_0xfe75('0x2a')](_0x586e9a[_0xfe75('0x30')],function(_0x245ab6){var _0xe3ef88={};_0xe3ef88[_0x245ab6]={'$like':'%'+_0x422389[_0xfe75('0x2c')][_0xfe75('0x38')]+'%'};return _0xe3ef88;})});}_0x586e9a=_[_0xfe75('0x39')]({},_0x586e9a,_0x422389['options']);return _0x3e6bdf[_0xfe75('0x4a')](_0x586e9a);}})[_0xfe75('0x21')](function(_0x3f0891){if(_0x3f0891){_0x36d9cf=_0x3f0891[_0xfe75('0x41')];if(!_0x422389[_0xfe75('0x2c')][_0xfe75('0x32')]('nolimit')){_0x586e9a[_0xfe75('0x19')]=qs['limit'](_0x422389[_0xfe75('0x2c')][_0xfe75('0x19')]);_0x586e9a['offset']=qs[_0xfe75('0x17')](_0x422389[_0xfe75('0x2c')]['offset']);}return _0x3e6bdf[_0xfe75('0x4a')](_0x586e9a);}})[_0xfe75('0x21')](function(_0x3f0b4c){if(_0x3f0b4c){return _0x3f0b4c?{'count':_0x36d9cf,'rows':_0x3f0b4c}:null;}})[_0xfe75('0x21')](respondWithResult(_0x4f70d1,null))[_0xfe75('0x3f')](handleError(_0x4f70d1,null));};exports['getDescriptions']=function(_0xaa315b,_0x8a5ae6,_0x53f7b8){var _0x6d7ef={};var _0x545341={};var _0xfa0887;var _0x2954fe;return db['ZohoConfiguration']['findOne']({'where':{'id':_0xaa315b[_0xfe75('0x46')]['id']}})[_0xfe75('0x21')](handleEntityNotFound(_0x8a5ae6,null))[_0xfe75('0x21')](function(_0x39399f){if(_0x39399f){_0xfa0887=_0x39399f;_0x545341[_0xfe75('0x2f')]=_[_0xfe75('0x2b')](db['ZohoField'][_0xfe75('0x27')]);_0x545341[_0xfe75('0x2c')]=_[_0xfe75('0x2b')](_0xaa315b[_0xfe75('0x2c')]);_0x545341['filters']=_['intersection'](_0x545341[_0xfe75('0x2f')],_0x545341[_0xfe75('0x2c')]);_0x6d7ef[_0xfe75('0x30')]=_['intersection'](_0x545341['model'],qs[_0xfe75('0x31')](_0xaa315b[_0xfe75('0x2c')][_0xfe75('0x31')]));_0x6d7ef[_0xfe75('0x30')]=_0x6d7ef['attributes']['length']?_0x6d7ef[_0xfe75('0x30')]:_0x545341['model'];_0x6d7ef['order']=qs[_0xfe75('0x35')](_0xaa315b['query'][_0xfe75('0x35')]);_0x6d7ef[_0xfe75('0x36')]=qs[_0xfe75('0x2d')](_['pick'](_0xaa315b[_0xfe75('0x2c')],_0x545341['filters']));if(_0xaa315b[_0xfe75('0x2c')][_0xfe75('0x38')]){_0x6d7ef[_0xfe75('0x36')]=_[_0xfe75('0x39')](_0x6d7ef[_0xfe75('0x36')],{'$or':_[_0xfe75('0x2a')](_0x6d7ef[_0xfe75('0x30')],function(_0x55e275){var _0x410360={};_0x410360[_0x55e275]={'$like':'%'+_0xaa315b[_0xfe75('0x2c')][_0xfe75('0x38')]+'%'};return _0x410360;})});}_0x6d7ef=_[_0xfe75('0x39')]({},_0x6d7ef,_0xaa315b[_0xfe75('0x42')]);return _0xfa0887[_0xfe75('0x4b')](_0x6d7ef);}})[_0xfe75('0x21')](function(_0x4d8f82){if(_0x4d8f82){_0x2954fe=_0x4d8f82[_0xfe75('0x41')];if(!_0xaa315b[_0xfe75('0x2c')][_0xfe75('0x32')](_0xfe75('0x33'))){_0x6d7ef[_0xfe75('0x19')]=qs['limit'](_0xaa315b['query'][_0xfe75('0x19')]);_0x6d7ef[_0xfe75('0x17')]=qs[_0xfe75('0x17')](_0xaa315b[_0xfe75('0x2c')][_0xfe75('0x17')]);}return _0xfa0887[_0xfe75('0x4b')](_0x6d7ef);}})['then'](function(_0x448e9d){if(_0x448e9d){return _0x448e9d?{'count':_0x2954fe,'rows':_0x448e9d}:null;}})['then'](respondWithResult(_0x8a5ae6,null))['catch'](handleError(_0x8a5ae6,null));}; \ No newline at end of file +var _0xb8ed=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','ZohoConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','length','includeAll','find','create','body','getFields','params','ZohoField','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x4cec2a,_0x36e7e7){var _0x5e3bd3=function(_0x303637){while(--_0x303637){_0x4cec2a['push'](_0x4cec2a['shift']());}};_0x5e3bd3(++_0x36e7e7);}(_0xb8ed,0xe1));var _0xdb8e=function(_0x124fc6,_0xa6e0e0){_0x124fc6=_0x124fc6-0x0;var _0xd6d6f2=_0xb8ed[_0x124fc6];return _0xd6d6f2;};'use strict';var emlformat=require(_0xdb8e('0x0'));var rimraf=require(_0xdb8e('0x1'));var zipdir=require(_0xdb8e('0x2'));var jsonpatch=require(_0xdb8e('0x3'));var rp=require(_0xdb8e('0x4'));var moment=require(_0xdb8e('0x5'));var BPromise=require(_0xdb8e('0x6'));var Mustache=require(_0xdb8e('0x7'));var util=require(_0xdb8e('0x8'));var path=require('path');var sox=require(_0xdb8e('0x9'));var csv=require(_0xdb8e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb8e('0xb'));var _=require(_0xdb8e('0xc'));var squel=require(_0xdb8e('0xd'));var crypto=require(_0xdb8e('0xe'));var jsforce=require(_0xdb8e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdb8e('0xa'));var querystring=require(_0xdb8e('0x10'));var Papa=require(_0xdb8e('0x11'));var Redis=require(_0xdb8e('0x12'));var authService=require(_0xdb8e('0x13'));var qs=require(_0xdb8e('0x14'));var as=require(_0xdb8e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb8e('0x16'))(_0xdb8e('0x17'));var utils=require(_0xdb8e('0x18'));var config=require(_0xdb8e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb8e('0x1a'))['db'];function respondWithStatusCode(_0x23ae87,_0x2d0e23){_0x2d0e23=_0x2d0e23||0xcc;return function(_0x22ab49){if(_0x22ab49){return _0x23ae87['sendStatus'](_0x2d0e23);}return _0x23ae87['status'](_0x2d0e23)[_0xdb8e('0x1b')]();};}function respondWithResult(_0x30f915,_0x67cea3){_0x67cea3=_0x67cea3||0xc8;return function(_0x3a89b7){if(_0x3a89b7){return _0x30f915[_0xdb8e('0x1c')](_0x67cea3)[_0xdb8e('0x1d')](_0x3a89b7);}};}function respondWithFilteredResult(_0x4d6d22,_0x23eb46){return function(_0x466ea7){if(_0x466ea7){var _0x1c7c11=typeof _0x23eb46[_0xdb8e('0x1e')]===_0xdb8e('0x1f')&&typeof _0x23eb46[_0xdb8e('0x20')]===_0xdb8e('0x1f');var _0x31be42=_0x466ea7[_0xdb8e('0x21')];var _0x1f82f9=_0x1c7c11?0x0:_0x23eb46[_0xdb8e('0x1e')];var _0x10f239=_0x1c7c11?_0x466ea7[_0xdb8e('0x21')]:_0x23eb46[_0xdb8e('0x1e')]+_0x23eb46['limit'];var _0x53726f;if(_0x10f239>=_0x31be42){_0x10f239=_0x31be42;_0x53726f=0xc8;}else{_0x53726f=0xce;}_0x4d6d22[_0xdb8e('0x1c')](_0x53726f);return _0x4d6d22[_0xdb8e('0x22')](_0xdb8e('0x23'),_0x1f82f9+'-'+_0x10f239+'/'+_0x31be42)[_0xdb8e('0x1d')](_0x466ea7);}return null;};}function patchUpdates(_0x20100f){return function(_0x192082){try{jsonpatch[_0xdb8e('0x24')](_0x192082,_0x20100f,!![]);}catch(_0x1fd344){return BPromise[_0xdb8e('0x25')](_0x1fd344);}return _0x192082[_0xdb8e('0x26')]();};}function saveUpdates(_0x3624cf,_0x489e2b){return function(_0x2f83cf){if(_0x2f83cf){return _0x2f83cf[_0xdb8e('0x27')](_0x3624cf)[_0xdb8e('0x28')](function(_0x11b237){return _0x11b237;});}return null;};}function removeEntity(_0xbd3185,_0x1a4878){return function(_0x128c27){if(_0x128c27){return _0x128c27[_0xdb8e('0x29')]()[_0xdb8e('0x28')](function(){_0xbd3185[_0xdb8e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35183e,_0x440fc7){return function(_0x332aea){if(!_0x332aea){_0x35183e[_0xdb8e('0x2a')](0x194);}return _0x332aea;};}function handleError(_0x9e72f7,_0x14c891){_0x14c891=_0x14c891||0x1f4;return function(_0x16ee5d){logger['error'](_0x16ee5d['stack']);if(_0x16ee5d[_0xdb8e('0x2b')]){delete _0x16ee5d[_0xdb8e('0x2b')];}_0x9e72f7[_0xdb8e('0x1c')](_0x14c891)[_0xdb8e('0x2c')](_0x16ee5d);};}exports['index']=function(_0x10a92b,_0x4325a7){var _0xee4b6c={},_0x16a47b={},_0x12bbaf={'count':0x0,'rows':[]};var _0x504096=_['map'](db[_0xdb8e('0x2d')][_0xdb8e('0x2e')],function(_0x268388){return{'name':_0x268388['fieldName'],'type':_0x268388[_0xdb8e('0x2f')][_0xdb8e('0x30')]};});_0x16a47b[_0xdb8e('0x31')]=_[_0xdb8e('0x32')](_0x504096,'name');_0x16a47b[_0xdb8e('0x33')]=_[_0xdb8e('0x34')](_0x10a92b[_0xdb8e('0x33')]);_0x16a47b[_0xdb8e('0x35')]=_[_0xdb8e('0x36')](_0x16a47b[_0xdb8e('0x31')],_0x16a47b[_0xdb8e('0x33')]);_0xee4b6c[_0xdb8e('0x37')]=_[_0xdb8e('0x36')](_0x16a47b[_0xdb8e('0x31')],qs[_0xdb8e('0x38')](_0x10a92b[_0xdb8e('0x33')]['fields']));_0xee4b6c[_0xdb8e('0x37')]=_0xee4b6c[_0xdb8e('0x37')]['length']?_0xee4b6c[_0xdb8e('0x37')]:_0x16a47b[_0xdb8e('0x31')];if(!_0x10a92b[_0xdb8e('0x33')][_0xdb8e('0x39')](_0xdb8e('0x3a'))){_0xee4b6c[_0xdb8e('0x20')]=qs[_0xdb8e('0x20')](_0x10a92b[_0xdb8e('0x33')][_0xdb8e('0x20')]);_0xee4b6c[_0xdb8e('0x1e')]=qs['offset'](_0x10a92b[_0xdb8e('0x33')]['offset']);}_0xee4b6c[_0xdb8e('0x3b')]=qs['sort'](_0x10a92b['query'][_0xdb8e('0x3c')]);_0xee4b6c[_0xdb8e('0x3d')]=qs[_0xdb8e('0x35')](_[_0xdb8e('0x3e')](_0x10a92b[_0xdb8e('0x33')],_0x16a47b[_0xdb8e('0x35')]),_0x504096);if(_0x10a92b[_0xdb8e('0x33')][_0xdb8e('0x3f')]){_0xee4b6c[_0xdb8e('0x3d')]=_[_0xdb8e('0x40')](_0xee4b6c['where'],{'$or':_[_0xdb8e('0x32')](_0x504096,function(_0x485dea){if(_0x485dea['type']!==_0xdb8e('0x41')){var _0x9c7bca={};_0x9c7bca[_0x485dea[_0xdb8e('0x2b')]]={'$like':'%'+_0x10a92b['query']['filter']+'%'};return _0x9c7bca;}})});}_0xee4b6c=_[_0xdb8e('0x40')]({},_0xee4b6c,_0x10a92b[_0xdb8e('0x42')]);var _0x546b27={'where':_0xee4b6c[_0xdb8e('0x3d')]};return db[_0xdb8e('0x2d')]['count'](_0x546b27)[_0xdb8e('0x28')](function(_0x44b0ce){_0x12bbaf[_0xdb8e('0x21')]=_0x44b0ce;if(_0x10a92b[_0xdb8e('0x33')]['includeAll']){_0xee4b6c[_0xdb8e('0x43')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0xee4b6c);})[_0xdb8e('0x28')](function(_0x274d57){_0x12bbaf[_0xdb8e('0x44')]=_0x274d57;return _0x12bbaf;})['then'](respondWithFilteredResult(_0x4325a7,_0xee4b6c))[_0xdb8e('0x45')](handleError(_0x4325a7,null));};exports['show']=function(_0x4e1da9,_0x5374ec){var _0x540edf={'raw':![],'where':{'id':_0x4e1da9['params']['id']}},_0x2eb90a={};_0x2eb90a[_0xdb8e('0x31')]=_['keys'](db[_0xdb8e('0x2d')][_0xdb8e('0x2e')]);_0x2eb90a[_0xdb8e('0x33')]=_[_0xdb8e('0x34')](_0x4e1da9[_0xdb8e('0x33')]);_0x2eb90a[_0xdb8e('0x35')]=_[_0xdb8e('0x36')](_0x2eb90a[_0xdb8e('0x31')],_0x2eb90a['query']);_0x540edf[_0xdb8e('0x37')]=_[_0xdb8e('0x36')](_0x2eb90a['model'],qs[_0xdb8e('0x38')](_0x4e1da9[_0xdb8e('0x33')][_0xdb8e('0x38')]));_0x540edf['attributes']=_0x540edf[_0xdb8e('0x37')][_0xdb8e('0x46')]?_0x540edf[_0xdb8e('0x37')]:_0x2eb90a[_0xdb8e('0x31')];if(_0x4e1da9[_0xdb8e('0x33')][_0xdb8e('0x47')]){_0x540edf[_0xdb8e('0x43')]=[{'all':!![]}];}_0x540edf=_[_0xdb8e('0x40')]({},_0x540edf,_0x4e1da9[_0xdb8e('0x42')]);return db[_0xdb8e('0x2d')][_0xdb8e('0x48')](_0x540edf)[_0xdb8e('0x28')](handleEntityNotFound(_0x5374ec,null))[_0xdb8e('0x28')](respondWithResult(_0x5374ec,null))[_0xdb8e('0x45')](handleError(_0x5374ec,null));};exports[_0xdb8e('0x49')]=function(_0x39405d,_0x4829bc){return db['ZohoConfiguration']['create'](_0x39405d[_0xdb8e('0x4a')],{})[_0xdb8e('0x28')](respondWithResult(_0x4829bc,0xc9))[_0xdb8e('0x45')](handleError(_0x4829bc,null));};exports[_0xdb8e('0x27')]=function(_0x57756e,_0x19b512){if(_0x57756e[_0xdb8e('0x4a')]['id']){delete _0x57756e['body']['id'];}return db[_0xdb8e('0x2d')]['find']({'where':{'id':_0x57756e['params']['id']}})[_0xdb8e('0x28')](handleEntityNotFound(_0x19b512,null))[_0xdb8e('0x28')](saveUpdates(_0x57756e[_0xdb8e('0x4a')],null))[_0xdb8e('0x28')](respondWithResult(_0x19b512,null))[_0xdb8e('0x45')](handleError(_0x19b512,null));};exports[_0xdb8e('0x29')]=function(_0x2d12c9,_0x41f2f4){return db[_0xdb8e('0x2d')]['find']({'where':{'id':_0x2d12c9['params']['id']}})[_0xdb8e('0x28')](handleEntityNotFound(_0x41f2f4,null))[_0xdb8e('0x28')](removeEntity(_0x41f2f4,null))[_0xdb8e('0x45')](handleError(_0x41f2f4,null));};exports[_0xdb8e('0x4b')]=function(_0xcfce46,_0x1879f7,_0x59585b){var _0x31d74a={};var _0x3cc5bc={};var _0x1943db;var _0x4de8a2;return db[_0xdb8e('0x2d')]['findOne']({'where':{'id':_0xcfce46[_0xdb8e('0x4c')]['id']}})[_0xdb8e('0x28')](handleEntityNotFound(_0x1879f7,null))['then'](function(_0x577782){if(_0x577782){_0x1943db=_0x577782;_0x3cc5bc['model']=_[_0xdb8e('0x34')](db[_0xdb8e('0x4d')]['rawAttributes']);_0x3cc5bc['query']=_[_0xdb8e('0x34')](_0xcfce46[_0xdb8e('0x33')]);_0x3cc5bc[_0xdb8e('0x35')]=_['intersection'](_0x3cc5bc[_0xdb8e('0x31')],_0x3cc5bc[_0xdb8e('0x33')]);_0x31d74a['attributes']=_[_0xdb8e('0x36')](_0x3cc5bc[_0xdb8e('0x31')],qs['fields'](_0xcfce46[_0xdb8e('0x33')][_0xdb8e('0x38')]));_0x31d74a[_0xdb8e('0x37')]=_0x31d74a[_0xdb8e('0x37')][_0xdb8e('0x46')]?_0x31d74a[_0xdb8e('0x37')]:_0x3cc5bc[_0xdb8e('0x31')];_0x31d74a['order']=qs['sort'](_0xcfce46[_0xdb8e('0x33')][_0xdb8e('0x3c')]);_0x31d74a['where']=qs[_0xdb8e('0x35')](_[_0xdb8e('0x3e')](_0xcfce46[_0xdb8e('0x33')],_0x3cc5bc[_0xdb8e('0x35')]));if(_0xcfce46[_0xdb8e('0x33')]['filter']){_0x31d74a['where']=_[_0xdb8e('0x40')](_0x31d74a[_0xdb8e('0x3d')],{'$or':_['map'](_0x31d74a[_0xdb8e('0x37')],function(_0x566247){var _0x228b40={};_0x228b40[_0x566247]={'$like':'%'+_0xcfce46[_0xdb8e('0x33')][_0xdb8e('0x3f')]+'%'};return _0x228b40;})});}_0x31d74a=_[_0xdb8e('0x40')]({},_0x31d74a,_0xcfce46[_0xdb8e('0x42')]);return _0x1943db[_0xdb8e('0x4b')](_0x31d74a);}})[_0xdb8e('0x28')](function(_0x5ccdcf){if(_0x5ccdcf){_0x4de8a2=_0x5ccdcf['length'];if(!_0xcfce46['query']['hasOwnProperty'](_0xdb8e('0x3a'))){_0x31d74a[_0xdb8e('0x20')]=qs['limit'](_0xcfce46['query'][_0xdb8e('0x20')]);_0x31d74a[_0xdb8e('0x1e')]=qs[_0xdb8e('0x1e')](_0xcfce46[_0xdb8e('0x33')]['offset']);}return _0x1943db[_0xdb8e('0x4b')](_0x31d74a);}})['then'](function(_0x4cc6e7){if(_0x4cc6e7){return _0x4cc6e7?{'count':_0x4de8a2,'rows':_0x4cc6e7}:null;}})['then'](respondWithResult(_0x1879f7,null))['catch'](handleError(_0x1879f7,null));};exports[_0xdb8e('0x4e')]=function(_0x5bc5a9,_0x5708fa,_0x13c93c){var _0xa3465d={};var _0x3ff054={};var _0xad516a;var _0x3670d2;return db['ZohoConfiguration'][_0xdb8e('0x4f')]({'where':{'id':_0x5bc5a9[_0xdb8e('0x4c')]['id']}})[_0xdb8e('0x28')](handleEntityNotFound(_0x5708fa,null))['then'](function(_0x545ae8){if(_0x545ae8){_0xad516a=_0x545ae8;_0x3ff054['model']=_[_0xdb8e('0x34')](db[_0xdb8e('0x4d')]['rawAttributes']);_0x3ff054['query']=_['keys'](_0x5bc5a9[_0xdb8e('0x33')]);_0x3ff054[_0xdb8e('0x35')]=_[_0xdb8e('0x36')](_0x3ff054['model'],_0x3ff054[_0xdb8e('0x33')]);_0xa3465d['attributes']=_[_0xdb8e('0x36')](_0x3ff054['model'],qs[_0xdb8e('0x38')](_0x5bc5a9[_0xdb8e('0x33')][_0xdb8e('0x38')]));_0xa3465d[_0xdb8e('0x37')]=_0xa3465d[_0xdb8e('0x37')][_0xdb8e('0x46')]?_0xa3465d[_0xdb8e('0x37')]:_0x3ff054['model'];_0xa3465d[_0xdb8e('0x3b')]=qs[_0xdb8e('0x3c')](_0x5bc5a9[_0xdb8e('0x33')][_0xdb8e('0x3c')]);_0xa3465d['where']=qs[_0xdb8e('0x35')](_[_0xdb8e('0x3e')](_0x5bc5a9['query'],_0x3ff054['filters']));if(_0x5bc5a9['query'][_0xdb8e('0x3f')]){_0xa3465d['where']=_[_0xdb8e('0x40')](_0xa3465d[_0xdb8e('0x3d')],{'$or':_[_0xdb8e('0x32')](_0xa3465d[_0xdb8e('0x37')],function(_0xe47e4d){var _0x4e5590={};_0x4e5590[_0xe47e4d]={'$like':'%'+_0x5bc5a9[_0xdb8e('0x33')][_0xdb8e('0x3f')]+'%'};return _0x4e5590;})});}_0xa3465d=_[_0xdb8e('0x40')]({},_0xa3465d,_0x5bc5a9['options']);return _0xad516a['getSubjects'](_0xa3465d);}})['then'](function(_0x35f200){if(_0x35f200){_0x3670d2=_0x35f200[_0xdb8e('0x46')];if(!_0x5bc5a9[_0xdb8e('0x33')][_0xdb8e('0x39')]('nolimit')){_0xa3465d[_0xdb8e('0x20')]=qs[_0xdb8e('0x20')](_0x5bc5a9[_0xdb8e('0x33')][_0xdb8e('0x20')]);_0xa3465d[_0xdb8e('0x1e')]=qs['offset'](_0x5bc5a9[_0xdb8e('0x33')][_0xdb8e('0x1e')]);}return _0xad516a[_0xdb8e('0x4e')](_0xa3465d);}})['then'](function(_0x321b22){if(_0x321b22){return _0x321b22?{'count':_0x3670d2,'rows':_0x321b22}:null;}})[_0xdb8e('0x28')](respondWithResult(_0x5708fa,null))[_0xdb8e('0x45')](handleError(_0x5708fa,null));};exports[_0xdb8e('0x50')]=function(_0x1db24e,_0x11a988,_0x3dc2df){var _0x394490={};var _0x2a8754={};var _0x4b054f;var _0x229c1c;return db[_0xdb8e('0x2d')]['findOne']({'where':{'id':_0x1db24e[_0xdb8e('0x4c')]['id']}})[_0xdb8e('0x28')](handleEntityNotFound(_0x11a988,null))['then'](function(_0x55c4a9){if(_0x55c4a9){_0x4b054f=_0x55c4a9;_0x2a8754[_0xdb8e('0x31')]=_['keys'](db[_0xdb8e('0x4d')][_0xdb8e('0x2e')]);_0x2a8754[_0xdb8e('0x33')]=_['keys'](_0x1db24e[_0xdb8e('0x33')]);_0x2a8754[_0xdb8e('0x35')]=_['intersection'](_0x2a8754[_0xdb8e('0x31')],_0x2a8754[_0xdb8e('0x33')]);_0x394490[_0xdb8e('0x37')]=_[_0xdb8e('0x36')](_0x2a8754[_0xdb8e('0x31')],qs[_0xdb8e('0x38')](_0x1db24e[_0xdb8e('0x33')][_0xdb8e('0x38')]));_0x394490['attributes']=_0x394490[_0xdb8e('0x37')][_0xdb8e('0x46')]?_0x394490[_0xdb8e('0x37')]:_0x2a8754[_0xdb8e('0x31')];_0x394490['order']=qs[_0xdb8e('0x3c')](_0x1db24e[_0xdb8e('0x33')][_0xdb8e('0x3c')]);_0x394490[_0xdb8e('0x3d')]=qs[_0xdb8e('0x35')](_['pick'](_0x1db24e[_0xdb8e('0x33')],_0x2a8754[_0xdb8e('0x35')]));if(_0x1db24e[_0xdb8e('0x33')][_0xdb8e('0x3f')]){_0x394490['where']=_[_0xdb8e('0x40')](_0x394490['where'],{'$or':_[_0xdb8e('0x32')](_0x394490[_0xdb8e('0x37')],function(_0x59070a){var _0x203e48={};_0x203e48[_0x59070a]={'$like':'%'+_0x1db24e[_0xdb8e('0x33')][_0xdb8e('0x3f')]+'%'};return _0x203e48;})});}_0x394490=_[_0xdb8e('0x40')]({},_0x394490,_0x1db24e[_0xdb8e('0x42')]);return _0x4b054f[_0xdb8e('0x50')](_0x394490);}})[_0xdb8e('0x28')](function(_0x579b2f){if(_0x579b2f){_0x229c1c=_0x579b2f[_0xdb8e('0x46')];if(!_0x1db24e['query'][_0xdb8e('0x39')](_0xdb8e('0x3a'))){_0x394490[_0xdb8e('0x20')]=qs[_0xdb8e('0x20')](_0x1db24e[_0xdb8e('0x33')][_0xdb8e('0x20')]);_0x394490[_0xdb8e('0x1e')]=qs[_0xdb8e('0x1e')](_0x1db24e['query'][_0xdb8e('0x1e')]);}return _0x4b054f['getDescriptions'](_0x394490);}})['then'](function(_0x54cbd6){if(_0x54cbd6){return _0x54cbd6?{'count':_0x229c1c,'rows':_0x54cbd6}:null;}})[_0xdb8e('0x28')](respondWithResult(_0x11a988,null))[_0xdb8e('0x45')](handleError(_0x11a988,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 882725c..c4bc911 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 _0xd245=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','util','api','moment','request-promise'];(function(_0x4f1c2b,_0x4feda3){var _0x4340d0=function(_0x5283ae){while(--_0x5283ae){_0x4f1c2b['push'](_0x4f1c2b['shift']());}};_0x4340d0(++_0x4feda3);}(_0xd245,0x1db));var _0x5d24=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xd245[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x5d24('0x0'));var util=require(_0x5d24('0x1'));var logger=require('../../config/logger')(_0x5d24('0x2'));var moment=require(_0x5d24('0x3'));var BPromise=require('bluebird');var rp=require(_0x5d24('0x4'));var fs=require('fs');var path=require(_0x5d24('0x5'));var rimraf=require(_0x5d24('0x6'));var config=require(_0x5d24('0x7'));var attributes=require(_0x5d24('0x8'));module[_0x5d24('0x9')]=function(_0xb3dc62,_0x2bd8ae){return _0xb3dc62['define'](_0x5d24('0xa'),attributes,{'tableName':_0x5d24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2e3=['ZohoConfiguration','int_zoho_configurations','lodash','util','bluebird','request-promise','path','./intZohoConfiguration.attributes','exports','define'];(function(_0x5f54b1,_0xdcbf41){var _0x30f200=function(_0x8080ed){while(--_0x8080ed){_0x5f54b1['push'](_0x5f54b1['shift']());}};_0x30f200(++_0xdcbf41);}(_0xc2e3,0x1a6));var _0x3c2e=function(_0x3a9350,_0x41f650){_0x3a9350=_0x3a9350-0x0;var _0x168710=_0xc2e3[_0x3a9350];return _0x168710;};'use strict';var _=require(_0x3c2e('0x0'));var util=require(_0x3c2e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3c2e('0x2'));var rp=require(_0x3c2e('0x3'));var fs=require('fs');var path=require(_0x3c2e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3c2e('0x5'));module[_0x3c2e('0x6')]=function(_0x26c976,_0x33397a){return _0x26c976[_0x3c2e('0x7')](_0x3c2e('0x8'),attributes,{'tableName':_0x3c2e('0x9'),'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 d0a19dd..d1c5e8c 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 _0xe5f6=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../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'];(function(_0x3030ee,_0x2fda9b){var _0x1262b7=function(_0x42b12f){while(--_0x42b12f){_0x3030ee['push'](_0x3030ee['shift']());}};_0x1262b7(++_0x2fda9b);}(_0xe5f6,0x13c));var _0x6e5f=function(_0x268b28,_0x168c61){_0x268b28=_0x268b28-0x0;var _0x22a4a9=_0xe5f6[_0x268b28];return _0x22a4a9;};'use strict';var _=require(_0x6e5f('0x0'));var util=require(_0x6e5f('0x1'));var moment=require(_0x6e5f('0x2'));var BPromise=require(_0x6e5f('0x3'));var rs=require(_0x6e5f('0x4'));var fs=require('fs');var Redis=require(_0x6e5f('0x5'));var db=require(_0x6e5f('0x6'))['db'];var utils=require(_0x6e5f('0x7'));var logger=require(_0x6e5f('0x8'))('rpc');var config=require(_0x6e5f('0x9'));var jayson=require(_0x6e5f('0xa'));var client=jayson[_0x6e5f('0xb')][_0x6e5f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42cad8,_0x3a4347,_0x5a65d2){return new BPromise(function(_0x4d08b7,_0x22be10){return client[_0x6e5f('0xd')](_0x42cad8,_0x5a65d2)[_0x6e5f('0xe')](function(_0x21ed70){logger[_0x6e5f('0xf')](_0x6e5f('0x10'),_0x3a4347,_0x6e5f('0x11'));logger[_0x6e5f('0x12')](_0x6e5f('0x13'),_0x3a4347,'request\x20sent',JSON[_0x6e5f('0x14')](_0x21ed70));if(_0x21ed70[_0x6e5f('0x15')]){if(_0x21ed70['error'][_0x6e5f('0x16')]===0x1f4){logger['error'](_0x6e5f('0x10'),_0x3a4347,_0x21ed70['error'][_0x6e5f('0x17')]);return _0x22be10(_0x21ed70[_0x6e5f('0x15')]['message']);}logger[_0x6e5f('0x15')](_0x6e5f('0x10'),_0x3a4347,_0x21ed70['error'][_0x6e5f('0x17')]);return _0x4d08b7(_0x21ed70['error'][_0x6e5f('0x17')]);}else{logger[_0x6e5f('0xf')](_0x6e5f('0x10'),_0x3a4347,_0x6e5f('0x11'));_0x4d08b7(_0x21ed70[_0x6e5f('0x18')][_0x6e5f('0x17')]);}})[_0x6e5f('0x19')](function(_0x2bc2df){logger['error'](_0x6e5f('0x10'),_0x3a4347,_0x2bc2df);_0x22be10(_0x2bc2df);});});} \ No newline at end of file +var _0x9a0d=['error','message','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x9a0d,0x1f0));var _0xd9a0=function(_0x2de81b,_0x322f1d){_0x2de81b=_0x2de81b-0x0;var _0x3df553=_0x9a0d[_0x2de81b];return _0x3df553;};'use strict';var _=require(_0xd9a0('0x0'));var util=require(_0xd9a0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd9a0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9a0('0x3'))['db'];var utils=require(_0xd9a0('0x4'));var logger=require(_0xd9a0('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd9a0('0x6'));var client=jayson[_0xd9a0('0x7')][_0xd9a0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30fceb,_0x2155a6,_0x354940){return new BPromise(function(_0x1947a0,_0xeb00f){return client[_0xd9a0('0x9')](_0x30fceb,_0x354940)[_0xd9a0('0xa')](function(_0x4b0357){logger[_0xd9a0('0xb')](_0xd9a0('0xc'),_0x2155a6,'request\x20sent');logger['debug'](_0xd9a0('0xd'),_0x2155a6,'request\x20sent',JSON['stringify'](_0x4b0357));if(_0x4b0357[_0xd9a0('0xe')]){if(_0x4b0357[_0xd9a0('0xe')]['code']===0x1f4){logger[_0xd9a0('0xe')](_0xd9a0('0xc'),_0x2155a6,_0x4b0357[_0xd9a0('0xe')][_0xd9a0('0xf')]);return _0xeb00f(_0x4b0357[_0xd9a0('0xe')]['message']);}logger[_0xd9a0('0xe')](_0xd9a0('0xc'),_0x2155a6,_0x4b0357[_0xd9a0('0xe')][_0xd9a0('0xf')]);return _0x1947a0(_0x4b0357[_0xd9a0('0xe')]['message']);}else{logger[_0xd9a0('0xb')](_0xd9a0('0xc'),_0x2155a6,'request\x20sent');_0x1947a0(_0x4b0357['result'][_0xd9a0('0xf')]);}})[_0xd9a0('0x10')](function(_0x1c23e3){logger[_0xd9a0('0xe')](_0xd9a0('0xc'),_0x2155a6,_0x1c23e3);_0xeb00f(_0x1c23e3);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index b9e86c4..d3501ef 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 _0x564e=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x564e,0x120));var _0xe564=function(_0x817662,_0x538155){_0x817662=_0x817662-0x0;var _0x192b3d=_0x564e[_0x817662];return _0x192b3d;};'use strict';var multer=require(_0xe564('0x0'));var util=require(_0xe564('0x1'));var path=require('path');var timeout=require(_0xe564('0x2'));var express=require(_0xe564('0x3'));var router=express['Router']();var fs_extra=require(_0xe564('0x4'));var auth=require(_0xe564('0x5'));var interaction=require(_0xe564('0x6'));var config=require(_0xe564('0x7'));var controller=require('./intZohoField.controller');router[_0xe564('0x8')]('/',auth[_0xe564('0x9')](),controller[_0xe564('0xa')]);router[_0xe564('0x8')](_0xe564('0xb'),auth[_0xe564('0x9')](),controller[_0xe564('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe564('0xd')]);router[_0xe564('0xe')](_0xe564('0xb'),auth[_0xe564('0x9')](),controller[_0xe564('0xf')]);router[_0xe564('0x10')]('/:id',auth[_0xe564('0x9')](),controller[_0xe564('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4f7b=['get','/:id','isAuthenticated','create','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoField.controller','index'];(function(_0x554594,_0x44882b){var _0x1dc535=function(_0x3866d8){while(--_0x3866d8){_0x554594['push'](_0x554594['shift']());}};_0x1dc535(++_0x44882b);}(_0x4f7b,0x1d8));var _0xb4f7=function(_0xc45b29,_0x2ecb3c){_0xc45b29=_0xc45b29-0x0;var _0x20445b=_0x4f7b[_0xc45b29];return _0x20445b;};'use strict';var multer=require('multer');var util=require(_0xb4f7('0x0'));var path=require('path');var timeout=require(_0xb4f7('0x1'));var express=require(_0xb4f7('0x2'));var router=express[_0xb4f7('0x3')]();var fs_extra=require(_0xb4f7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb4f7('0x5'));var controller=require(_0xb4f7('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb4f7('0x7')]);router[_0xb4f7('0x8')](_0xb4f7('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb4f7('0xa')](),controller[_0xb4f7('0xb')]);router[_0xb4f7('0xc')](_0xb4f7('0x9'),auth['isAuthenticated'](),controller[_0xb4f7('0xd')]);router[_0xb4f7('0xe')](_0xb4f7('0x9'),auth[_0xb4f7('0xa')](),controller['destroy']);module[_0xb4f7('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 0645363..88db5d9 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 _0x733a=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x733a,0x121));var _0xa733=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x733a[_0x3740fe];return _0x55492b;};'use strict';var Sequelize=require(_0xa733('0x0'));module[_0xa733('0x1')]={'type':{'type':Sequelize[_0xa733('0x2')](_0xa733('0x3'),_0xa733('0x4'),_0xa733('0x5'),_0xa733('0x6'),_0xa733('0x7')),'defaultValue':_0xa733('0x3')},'content':{'type':Sequelize[_0xa733('0x8')]},'key':{'type':Sequelize[_0xa733('0x8')]},'keyType':{'type':Sequelize[_0xa733('0x2')](_0xa733('0x3'),_0xa733('0x4'),_0xa733('0x5'))},'keyContent':{'type':Sequelize[_0xa733('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa733('0x8')]},'customField':{'type':Sequelize[_0xa733('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa733('0x8')]}}; \ No newline at end of file +var _0xf06a=['sequelize','exports','variable','keyValue','STRING','ENUM','string','customVariable','BOOLEAN'];(function(_0x30be1d,_0x3d275f){var _0x11646b=function(_0x4c86a5){while(--_0x4c86a5){_0x30be1d['push'](_0x30be1d['shift']());}};_0x11646b(++_0x3d275f);}(_0xf06a,0x105));var _0xaf06=function(_0x37aba0,_0x21e179){_0x37aba0=_0x37aba0-0x0;var _0x3660a7=_0xf06a[_0x37aba0];return _0x3660a7;};'use strict';var Sequelize=require(_0xaf06('0x0'));module[_0xaf06('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xaf06('0x2'),'customVariable',_0xaf06('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xaf06('0x4')]},'key':{'type':Sequelize[_0xaf06('0x4')]},'keyType':{'type':Sequelize[_0xaf06('0x5')](_0xaf06('0x6'),_0xaf06('0x2'),_0xaf06('0x7'))},'keyContent':{'type':Sequelize[_0xaf06('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xaf06('0x4')]},'customField':{'type':Sequelize[_0xaf06('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaf06('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index b27171f..05b9450 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 _0x5ce3=['../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','sendStatus','error','name','index','map','ZohoField','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','body','catch','update','destroy','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x2bb25a,_0x3eeec7){var _0x133717=function(_0x2820cd){while(--_0x2820cd){_0x2bb25a['push'](_0x2bb25a['shift']());}};_0x133717(++_0x3eeec7);}(_0x5ce3,0x80));var _0x35ce=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x5ce3[_0x4063a4];return _0x17908d;};'use strict';var emlformat=require(_0x35ce('0x0'));var rimraf=require(_0x35ce('0x1'));var zipdir=require(_0x35ce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35ce('0x3'));var moment=require('moment');var BPromise=require(_0x35ce('0x4'));var Mustache=require(_0x35ce('0x5'));var util=require(_0x35ce('0x6'));var path=require(_0x35ce('0x7'));var sox=require(_0x35ce('0x8'));var csv=require(_0x35ce('0x9'));var ejs=require(_0x35ce('0xa'));var fs=require('fs');var fs_extra=require(_0x35ce('0xb'));var _=require(_0x35ce('0xc'));var squel=require(_0x35ce('0xd'));var crypto=require('crypto');var jsforce=require(_0x35ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x35ce('0x9'));var querystring=require(_0x35ce('0xf'));var Papa=require('papaparse');var Redis=require(_0x35ce('0x10'));var authService=require(_0x35ce('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x35ce('0x12'));var hardwareService=require(_0x35ce('0x13'));var logger=require(_0x35ce('0x14'))('api');var utils=require(_0x35ce('0x15'));var config=require(_0x35ce('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x35ce('0x17'))['db'];function respondWithStatusCode(_0x51f07c,_0x485eb9){_0x485eb9=_0x485eb9||0xcc;return function(_0x478864){if(_0x478864){return _0x51f07c['sendStatus'](_0x485eb9);}return _0x51f07c[_0x35ce('0x18')](_0x485eb9)[_0x35ce('0x19')]();};}function respondWithResult(_0x1d65c1,_0x421991){_0x421991=_0x421991||0xc8;return function(_0x27af92){if(_0x27af92){return _0x1d65c1['status'](_0x421991)[_0x35ce('0x1a')](_0x27af92);}};}function respondWithFilteredResult(_0x5952b6,_0x35ede2){return function(_0x3f9445){if(_0x3f9445){var _0x48afa1=typeof _0x35ede2[_0x35ce('0x1b')]===_0x35ce('0x1c')&&typeof _0x35ede2[_0x35ce('0x1d')]===_0x35ce('0x1c');var _0xc5adc7=_0x3f9445[_0x35ce('0x1e')];var _0xcece86=_0x48afa1?0x0:_0x35ede2['offset'];var _0x501421=_0x48afa1?_0x3f9445['count']:_0x35ede2[_0x35ce('0x1b')]+_0x35ede2[_0x35ce('0x1d')];var _0x3c7011;if(_0x501421>=_0xc5adc7){_0x501421=_0xc5adc7;_0x3c7011=0xc8;}else{_0x3c7011=0xce;}_0x5952b6[_0x35ce('0x18')](_0x3c7011);return _0x5952b6[_0x35ce('0x1f')](_0x35ce('0x20'),_0xcece86+'-'+_0x501421+'/'+_0xc5adc7)[_0x35ce('0x1a')](_0x3f9445);}return null;};}function patchUpdates(_0x4b3e85){return function(_0x197175){try{jsonpatch[_0x35ce('0x21')](_0x197175,_0x4b3e85,!![]);}catch(_0x5984f0){return BPromise['reject'](_0x5984f0);}return _0x197175[_0x35ce('0x22')]();};}function saveUpdates(_0x534bde,_0x27bee0){return function(_0x363ae3){if(_0x363ae3){return _0x363ae3['update'](_0x534bde)[_0x35ce('0x23')](function(_0x383418){return _0x383418;});}return null;};}function removeEntity(_0x4c5861,_0x4c0890){return function(_0x1c8bab){if(_0x1c8bab){return _0x1c8bab['destroy']()[_0x35ce('0x23')](function(){_0x4c5861[_0x35ce('0x18')](0xcc)[_0x35ce('0x19')]();});}};}function handleEntityNotFound(_0x2e0a4f,_0x2f6f97){return function(_0x3803a2){if(!_0x3803a2){_0x2e0a4f[_0x35ce('0x24')](0x194);}return _0x3803a2;};}function handleError(_0x3e777c,_0x40a5e7){_0x40a5e7=_0x40a5e7||0x1f4;return function(_0x3bbd6a){logger[_0x35ce('0x25')](_0x3bbd6a['stack']);if(_0x3bbd6a[_0x35ce('0x26')]){delete _0x3bbd6a[_0x35ce('0x26')];}_0x3e777c[_0x35ce('0x18')](_0x40a5e7)['send'](_0x3bbd6a);};}exports[_0x35ce('0x27')]=function(_0x2d6333,_0x2a6d77){var _0x343073={},_0x255c29={},_0x859c34={'count':0x0,'rows':[]};var _0xb4247=_[_0x35ce('0x28')](db[_0x35ce('0x29')][_0x35ce('0x2a')],function(_0x47f784){return{'name':_0x47f784[_0x35ce('0x2b')],'type':_0x47f784[_0x35ce('0x2c')]['key']};});_0x255c29[_0x35ce('0x2d')]=_[_0x35ce('0x28')](_0xb4247,_0x35ce('0x26'));_0x255c29['query']=_['keys'](_0x2d6333[_0x35ce('0x2e')]);_0x255c29['filters']=_[_0x35ce('0x2f')](_0x255c29[_0x35ce('0x2d')],_0x255c29[_0x35ce('0x2e')]);_0x343073[_0x35ce('0x30')]=_['intersection'](_0x255c29['model'],qs['fields'](_0x2d6333[_0x35ce('0x2e')][_0x35ce('0x31')]));_0x343073[_0x35ce('0x30')]=_0x343073[_0x35ce('0x30')]['length']?_0x343073[_0x35ce('0x30')]:_0x255c29[_0x35ce('0x2d')];if(!_0x2d6333[_0x35ce('0x2e')][_0x35ce('0x32')](_0x35ce('0x33'))){_0x343073[_0x35ce('0x1d')]=qs[_0x35ce('0x1d')](_0x2d6333['query'][_0x35ce('0x1d')]);_0x343073[_0x35ce('0x1b')]=qs[_0x35ce('0x1b')](_0x2d6333[_0x35ce('0x2e')][_0x35ce('0x1b')]);}_0x343073[_0x35ce('0x34')]=qs[_0x35ce('0x35')](_0x2d6333[_0x35ce('0x2e')][_0x35ce('0x35')]);_0x343073['where']=qs['filters'](_[_0x35ce('0x36')](_0x2d6333[_0x35ce('0x2e')],_0x255c29[_0x35ce('0x37')]),_0xb4247);if(_0x2d6333[_0x35ce('0x2e')][_0x35ce('0x38')]){_0x343073[_0x35ce('0x39')]=_[_0x35ce('0x3a')](_0x343073[_0x35ce('0x39')],{'$or':_[_0x35ce('0x28')](_0xb4247,function(_0x3eb06c){if(_0x3eb06c['type']!==_0x35ce('0x3b')){var _0x4b8f75={};_0x4b8f75[_0x3eb06c['name']]={'$like':'%'+_0x2d6333[_0x35ce('0x2e')][_0x35ce('0x38')]+'%'};return _0x4b8f75;}})});}_0x343073=_[_0x35ce('0x3a')]({},_0x343073,_0x2d6333[_0x35ce('0x3c')]);var _0x7ec05f={'where':_0x343073[_0x35ce('0x39')]};return db[_0x35ce('0x29')][_0x35ce('0x1e')](_0x7ec05f)[_0x35ce('0x23')](function(_0x1794e5){_0x859c34[_0x35ce('0x1e')]=_0x1794e5;if(_0x2d6333[_0x35ce('0x2e')][_0x35ce('0x3d')]){_0x343073[_0x35ce('0x3e')]=[{'all':!![]}];}return db[_0x35ce('0x29')][_0x35ce('0x3f')](_0x343073);})[_0x35ce('0x23')](function(_0x2da90c){_0x859c34[_0x35ce('0x40')]=_0x2da90c;return _0x859c34;})['then'](respondWithFilteredResult(_0x2a6d77,_0x343073))['catch'](handleError(_0x2a6d77,null));};exports[_0x35ce('0x41')]=function(_0x5d74d3,_0x123a9a){var _0x455d2a={'raw':!![],'where':{'id':_0x5d74d3[_0x35ce('0x42')]['id']}},_0x1797a5={};_0x1797a5[_0x35ce('0x2d')]=_[_0x35ce('0x43')](db['ZohoField'][_0x35ce('0x2a')]);_0x1797a5[_0x35ce('0x2e')]=_[_0x35ce('0x43')](_0x5d74d3[_0x35ce('0x2e')]);_0x1797a5[_0x35ce('0x37')]=_[_0x35ce('0x2f')](_0x1797a5[_0x35ce('0x2d')],_0x1797a5[_0x35ce('0x2e')]);_0x455d2a['attributes']=_['intersection'](_0x1797a5[_0x35ce('0x2d')],qs[_0x35ce('0x31')](_0x5d74d3[_0x35ce('0x2e')]['fields']));_0x455d2a[_0x35ce('0x30')]=_0x455d2a[_0x35ce('0x30')][_0x35ce('0x44')]?_0x455d2a[_0x35ce('0x30')]:_0x1797a5[_0x35ce('0x2d')];if(_0x5d74d3[_0x35ce('0x2e')][_0x35ce('0x3d')]){_0x455d2a['include']=[{'all':!![]}];}_0x455d2a=_[_0x35ce('0x3a')]({},_0x455d2a,_0x5d74d3[_0x35ce('0x3c')]);return db['ZohoField'][_0x35ce('0x45')](_0x455d2a)[_0x35ce('0x23')](handleEntityNotFound(_0x123a9a,null))['then'](respondWithResult(_0x123a9a,null))['catch'](handleError(_0x123a9a,null));};exports[_0x35ce('0x46')]=function(_0x2c01d8,_0x2de0b0){return db[_0x35ce('0x29')][_0x35ce('0x46')](_0x2c01d8[_0x35ce('0x47')],{})[_0x35ce('0x23')](respondWithResult(_0x2de0b0,0xc9))[_0x35ce('0x48')](handleError(_0x2de0b0,null));};exports[_0x35ce('0x49')]=function(_0x142100,_0xf64dea){if(_0x142100[_0x35ce('0x47')]['id']){delete _0x142100['body']['id'];}return db[_0x35ce('0x29')]['find']({'where':{'id':_0x142100[_0x35ce('0x42')]['id']}})[_0x35ce('0x23')](handleEntityNotFound(_0xf64dea,null))[_0x35ce('0x23')](saveUpdates(_0x142100[_0x35ce('0x47')],null))['then'](respondWithResult(_0xf64dea,null))[_0x35ce('0x48')](handleError(_0xf64dea,null));};exports[_0x35ce('0x4a')]=function(_0x3637f1,_0x48feeb){return db[_0x35ce('0x29')][_0x35ce('0x45')]({'where':{'id':_0x3637f1[_0x35ce('0x42')]['id']}})[_0x35ce('0x23')](handleEntityNotFound(_0x48feeb,null))['then'](removeEntity(_0x48feeb,null))['catch'](handleError(_0x48feeb,null));}; \ No newline at end of file +var _0xe775=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','Content-Range','apply','reject','save','destroy','end','sendStatus','error','stack','name','send','index','map','ZohoField','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','update','body','eml-format','fast-json-patch','moment','bluebird','mustache'];(function(_0x4887ef,_0xf947c1){var _0x44dd61=function(_0x22e6e9){while(--_0x22e6e9){_0x4887ef['push'](_0x4887ef['shift']());}};_0x44dd61(++_0xf947c1);}(_0xe775,0x91));var _0x5e77=function(_0x2b305c,_0x5ae303){_0x2b305c=_0x2b305c-0x0;var _0x5d8c85=_0xe775[_0x2b305c];return _0x5d8c85;};'use strict';var emlformat=require(_0x5e77('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5e77('0x1'));var rp=require('request-promise');var moment=require(_0x5e77('0x2'));var BPromise=require(_0x5e77('0x3'));var Mustache=require(_0x5e77('0x4'));var util=require(_0x5e77('0x5'));var path=require(_0x5e77('0x6'));var sox=require(_0x5e77('0x7'));var csv=require(_0x5e77('0x8'));var ejs=require(_0x5e77('0x9'));var fs=require('fs');var fs_extra=require(_0x5e77('0xa'));var _=require(_0x5e77('0xb'));var squel=require(_0x5e77('0xc'));var crypto=require(_0x5e77('0xd'));var jsforce=require(_0x5e77('0xe'));var deskjs=require(_0x5e77('0xf'));var toCsv=require(_0x5e77('0x8'));var querystring=require(_0x5e77('0x10'));var Papa=require(_0x5e77('0x11'));var Redis=require('ioredis');var authService=require(_0x5e77('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5e77('0x13'));var hardwareService=require(_0x5e77('0x14'));var logger=require(_0x5e77('0x15'))(_0x5e77('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5e77('0x17'));var db=require(_0x5e77('0x18'))['db'];function respondWithStatusCode(_0x54a0e6,_0x281d6f){_0x281d6f=_0x281d6f||0xcc;return function(_0x12cedd){if(_0x12cedd){return _0x54a0e6['sendStatus'](_0x281d6f);}return _0x54a0e6[_0x5e77('0x19')](_0x281d6f)['end']();};}function respondWithResult(_0x31b108,_0x8f8db){_0x8f8db=_0x8f8db||0xc8;return function(_0x5a59bc){if(_0x5a59bc){return _0x31b108[_0x5e77('0x19')](_0x8f8db)[_0x5e77('0x1a')](_0x5a59bc);}};}function respondWithFilteredResult(_0x35cd13,_0x25595e){return function(_0x55c275){if(_0x55c275){var _0x15fb72=typeof _0x25595e[_0x5e77('0x1b')]==='undefined'&&typeof _0x25595e[_0x5e77('0x1c')]==='undefined';var _0x536b22=_0x55c275[_0x5e77('0x1d')];var _0x579d5a=_0x15fb72?0x0:_0x25595e[_0x5e77('0x1b')];var _0x302423=_0x15fb72?_0x55c275['count']:_0x25595e[_0x5e77('0x1b')]+_0x25595e[_0x5e77('0x1c')];var _0x472dba;if(_0x302423>=_0x536b22){_0x302423=_0x536b22;_0x472dba=0xc8;}else{_0x472dba=0xce;}_0x35cd13[_0x5e77('0x19')](_0x472dba);return _0x35cd13[_0x5e77('0x1e')](_0x5e77('0x1f'),_0x579d5a+'-'+_0x302423+'/'+_0x536b22)[_0x5e77('0x1a')](_0x55c275);}return null;};}function patchUpdates(_0x47e235){return function(_0x493536){try{jsonpatch[_0x5e77('0x20')](_0x493536,_0x47e235,!![]);}catch(_0x3724e0){return BPromise[_0x5e77('0x21')](_0x3724e0);}return _0x493536[_0x5e77('0x22')]();};}function saveUpdates(_0x137f1f,_0xe64c1b){return function(_0x2a7c0c){if(_0x2a7c0c){return _0x2a7c0c['update'](_0x137f1f)['then'](function(_0x29eea2){return _0x29eea2;});}return null;};}function removeEntity(_0x17a82a,_0x48bf57){return function(_0x5e6e22){if(_0x5e6e22){return _0x5e6e22[_0x5e77('0x23')]()['then'](function(){_0x17a82a[_0x5e77('0x19')](0xcc)[_0x5e77('0x24')]();});}};}function handleEntityNotFound(_0x24c400,_0x48a370){return function(_0x47579b){if(!_0x47579b){_0x24c400[_0x5e77('0x25')](0x194);}return _0x47579b;};}function handleError(_0x381cda,_0x4a148f){_0x4a148f=_0x4a148f||0x1f4;return function(_0x1bad4b){logger[_0x5e77('0x26')](_0x1bad4b[_0x5e77('0x27')]);if(_0x1bad4b[_0x5e77('0x28')]){delete _0x1bad4b['name'];}_0x381cda['status'](_0x4a148f)[_0x5e77('0x29')](_0x1bad4b);};}exports[_0x5e77('0x2a')]=function(_0xcdf89b,_0x4d494e){var _0x355c8b={},_0x40715c={},_0x5180ab={'count':0x0,'rows':[]};var _0x12309b=_[_0x5e77('0x2b')](db[_0x5e77('0x2c')]['rawAttributes'],function(_0x16aa91){return{'name':_0x16aa91[_0x5e77('0x2d')],'type':_0x16aa91['type'][_0x5e77('0x2e')]};});_0x40715c[_0x5e77('0x2f')]=_['map'](_0x12309b,_0x5e77('0x28'));_0x40715c['query']=_[_0x5e77('0x30')](_0xcdf89b[_0x5e77('0x31')]);_0x40715c[_0x5e77('0x32')]=_[_0x5e77('0x33')](_0x40715c['model'],_0x40715c[_0x5e77('0x31')]);_0x355c8b['attributes']=_[_0x5e77('0x33')](_0x40715c[_0x5e77('0x2f')],qs[_0x5e77('0x34')](_0xcdf89b[_0x5e77('0x31')][_0x5e77('0x34')]));_0x355c8b[_0x5e77('0x35')]=_0x355c8b['attributes']['length']?_0x355c8b['attributes']:_0x40715c['model'];if(!_0xcdf89b[_0x5e77('0x31')][_0x5e77('0x36')]('nolimit')){_0x355c8b[_0x5e77('0x1c')]=qs[_0x5e77('0x1c')](_0xcdf89b[_0x5e77('0x31')][_0x5e77('0x1c')]);_0x355c8b[_0x5e77('0x1b')]=qs[_0x5e77('0x1b')](_0xcdf89b[_0x5e77('0x31')][_0x5e77('0x1b')]);}_0x355c8b[_0x5e77('0x37')]=qs[_0x5e77('0x38')](_0xcdf89b['query']['sort']);_0x355c8b[_0x5e77('0x39')]=qs[_0x5e77('0x32')](_['pick'](_0xcdf89b[_0x5e77('0x31')],_0x40715c[_0x5e77('0x32')]),_0x12309b);if(_0xcdf89b[_0x5e77('0x31')][_0x5e77('0x3a')]){_0x355c8b[_0x5e77('0x39')]=_[_0x5e77('0x3b')](_0x355c8b['where'],{'$or':_[_0x5e77('0x2b')](_0x12309b,function(_0x525022){if(_0x525022[_0x5e77('0x3c')]!==_0x5e77('0x3d')){var _0x2c9617={};_0x2c9617[_0x525022[_0x5e77('0x28')]]={'$like':'%'+_0xcdf89b[_0x5e77('0x31')][_0x5e77('0x3a')]+'%'};return _0x2c9617;}})});}_0x355c8b=_[_0x5e77('0x3b')]({},_0x355c8b,_0xcdf89b[_0x5e77('0x3e')]);var _0x227e65={'where':_0x355c8b[_0x5e77('0x39')]};return db['ZohoField'][_0x5e77('0x1d')](_0x227e65)[_0x5e77('0x3f')](function(_0x1d4bf3){_0x5180ab[_0x5e77('0x1d')]=_0x1d4bf3;if(_0xcdf89b[_0x5e77('0x31')][_0x5e77('0x40')]){_0x355c8b[_0x5e77('0x41')]=[{'all':!![]}];}return db[_0x5e77('0x2c')][_0x5e77('0x42')](_0x355c8b);})['then'](function(_0x477756){_0x5180ab['rows']=_0x477756;return _0x5180ab;})[_0x5e77('0x3f')](respondWithFilteredResult(_0x4d494e,_0x355c8b))[_0x5e77('0x43')](handleError(_0x4d494e,null));};exports[_0x5e77('0x44')]=function(_0x43a4f4,_0x41850c){var _0x446def={'raw':!![],'where':{'id':_0x43a4f4[_0x5e77('0x45')]['id']}},_0x213296={};_0x213296[_0x5e77('0x2f')]=_[_0x5e77('0x30')](db[_0x5e77('0x2c')][_0x5e77('0x46')]);_0x213296['query']=_[_0x5e77('0x30')](_0x43a4f4[_0x5e77('0x31')]);_0x213296['filters']=_[_0x5e77('0x33')](_0x213296[_0x5e77('0x2f')],_0x213296[_0x5e77('0x31')]);_0x446def['attributes']=_['intersection'](_0x213296[_0x5e77('0x2f')],qs[_0x5e77('0x34')](_0x43a4f4[_0x5e77('0x31')][_0x5e77('0x34')]));_0x446def[_0x5e77('0x35')]=_0x446def[_0x5e77('0x35')]['length']?_0x446def[_0x5e77('0x35')]:_0x213296[_0x5e77('0x2f')];if(_0x43a4f4[_0x5e77('0x31')][_0x5e77('0x40')]){_0x446def['include']=[{'all':!![]}];}_0x446def=_[_0x5e77('0x3b')]({},_0x446def,_0x43a4f4['options']);return db[_0x5e77('0x2c')][_0x5e77('0x47')](_0x446def)['then'](handleEntityNotFound(_0x41850c,null))[_0x5e77('0x3f')](respondWithResult(_0x41850c,null))['catch'](handleError(_0x41850c,null));};exports['create']=function(_0x4bac34,_0x4ddc18){return db[_0x5e77('0x2c')][_0x5e77('0x48')](_0x4bac34['body'],{})[_0x5e77('0x3f')](respondWithResult(_0x4ddc18,0xc9))[_0x5e77('0x43')](handleError(_0x4ddc18,null));};exports[_0x5e77('0x49')]=function(_0xc88671,_0x3e6168){if(_0xc88671[_0x5e77('0x4a')]['id']){delete _0xc88671['body']['id'];}return db[_0x5e77('0x2c')]['find']({'where':{'id':_0xc88671['params']['id']}})[_0x5e77('0x3f')](handleEntityNotFound(_0x3e6168,null))['then'](saveUpdates(_0xc88671[_0x5e77('0x4a')],null))[_0x5e77('0x3f')](respondWithResult(_0x3e6168,null))['catch'](handleError(_0x3e6168,null));};exports[_0x5e77('0x23')]=function(_0x2b2470,_0x10fae4){return db['ZohoField'][_0x5e77('0x47')]({'where':{'id':_0x2b2470[_0x5e77('0x45')]['id']}})[_0x5e77('0x3f')](handleEntityNotFound(_0x10fae4,null))[_0x5e77('0x3f')](removeEntity(_0x10fae4,null))['catch'](handleError(_0x10fae4,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 8099dc0..7ef42ae 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 _0xb145=['api','moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','util','../../config/logger'];(function(_0xf69ea2,_0x4b0d5c){var _0x2c88ec=function(_0x25c12f){while(--_0x25c12f){_0xf69ea2['push'](_0xf69ea2['shift']());}};_0x2c88ec(++_0x4b0d5c);}(_0xb145,0xa3));var _0x5b14=function(_0x6edc12,_0x12402a){_0x6edc12=_0x6edc12-0x0;var _0x571dd3=_0xb145[_0x6edc12];return _0x571dd3;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var logger=require(_0x5b14('0x1'))(_0x5b14('0x2'));var moment=require(_0x5b14('0x3'));var BPromise=require(_0x5b14('0x4'));var rp=require(_0x5b14('0x5'));var fs=require('fs');var path=require(_0x5b14('0x6'));var rimraf=require(_0x5b14('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b14('0x8'));module[_0x5b14('0x9')]=function(_0x392425,_0x4d82ad){return _0x392425['define'](_0x5b14('0xa'),attributes,{'tableName':_0x5b14('0xb'),'paranoid':![],'indexes':[{'name':_0x5b14('0xc'),'fields':[_0x5b14('0xd'),_0x5b14('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd943=['api','bluebird','request-promise','path','rimraf','../../config/environment','int_zoho_fields','zoho_unique_index','lodash','util','../../config/logger'];(function(_0x5c5a43,_0x516ced){var _0x42339a=function(_0x23d267){while(--_0x23d267){_0x5c5a43['push'](_0x5c5a43['shift']());}};_0x42339a(++_0x516ced);}(_0xd943,0x15d));var _0x3d94=function(_0x51a1a5,_0x14981e){_0x51a1a5=_0x51a1a5-0x0;var _0x2d8385=_0xd943[_0x51a1a5];return _0x2d8385;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var logger=require(_0x3d94('0x2'))(_0x3d94('0x3'));var moment=require('moment');var BPromise=require(_0x3d94('0x4'));var rp=require(_0x3d94('0x5'));var fs=require('fs');var path=require(_0x3d94('0x6'));var rimraf=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x34c9c3,_0x51cf1f){return _0x34c9c3['define']('ZohoField',attributes,{'tableName':_0x3d94('0x9'),'paranoid':![],'indexes':[{'name':_0x3d94('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 9d957a5..7116ea9 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 _0x0a5f=['lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x2b0fea,_0x1064e4){var _0x18c47f=function(_0x246781){while(--_0x246781){_0x2b0fea['push'](_0x2b0fea['shift']());}};_0x18c47f(++_0x1064e4);}(_0x0a5f,0x8c));var _0xf0a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a5f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf0a5('0x0'));var util=require('util');var moment=require(_0xf0a5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0a5('0x2'));var db=require(_0xf0a5('0x3'))['db'];var utils=require(_0xf0a5('0x4'));var logger=require('../../config/logger')(_0xf0a5('0x5'));var config=require('../../config/environment');var jayson=require(_0xf0a5('0x6'));var client=jayson[_0xf0a5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e7684,_0x4d27b4,_0x4630f1){return new BPromise(function(_0x211d19,_0x29e645){return client[_0xf0a5('0x8')](_0x3e7684,_0x4630f1)[_0xf0a5('0x9')](function(_0x36b47c){logger[_0xf0a5('0xa')](_0xf0a5('0xb'),_0x4d27b4,'request\x20sent');logger[_0xf0a5('0xc')](_0xf0a5('0xd'),_0x4d27b4,_0xf0a5('0xe'),JSON[_0xf0a5('0xf')](_0x36b47c));if(_0x36b47c[_0xf0a5('0x10')]){if(_0x36b47c[_0xf0a5('0x10')][_0xf0a5('0x11')]===0x1f4){logger[_0xf0a5('0x10')](_0xf0a5('0xb'),_0x4d27b4,_0x36b47c[_0xf0a5('0x10')]['message']);return _0x29e645(_0x36b47c[_0xf0a5('0x10')][_0xf0a5('0x12')]);}logger[_0xf0a5('0x10')](_0xf0a5('0xb'),_0x4d27b4,_0x36b47c[_0xf0a5('0x10')][_0xf0a5('0x12')]);return _0x211d19(_0x36b47c[_0xf0a5('0x10')][_0xf0a5('0x12')]);}else{logger[_0xf0a5('0xa')]('ZohoField,\x20%s,\x20%s',_0x4d27b4,'request\x20sent');_0x211d19(_0x36b47c['result']['message']);}})[_0xf0a5('0x13')](function(_0x1204c5){logger[_0xf0a5('0x10')](_0xf0a5('0xb'),_0x4d27b4,_0x1204c5);_0x29e645(_0x1204c5);});});} \ No newline at end of file +var _0x11fd=['info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x386f4f,_0x156de6){var _0x122b9c=function(_0x3a51b5){while(--_0x3a51b5){_0x386f4f['push'](_0x386f4f['shift']());}};_0x122b9c(++_0x156de6);}(_0x11fd,0xd9));var _0xd11f=function(_0x2f4bf9,_0x3dff59){_0x2f4bf9=_0x2f4bf9-0x0;var _0x43fd0e=_0x11fd[_0x2f4bf9];return _0x43fd0e;};'use strict';var _=require(_0xd11f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd11f('0x1'));var rs=require(_0xd11f('0x2'));var fs=require('fs');var Redis=require(_0xd11f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd11f('0x4'))(_0xd11f('0x5'));var config=require('../../config/environment');var jayson=require(_0xd11f('0x6'));var client=jayson[_0xd11f('0x7')][_0xd11f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40940b,_0x3d8f36,_0x131f5b){return new BPromise(function(_0x28c74d,_0x508e3c){return client[_0xd11f('0x9')](_0x40940b,_0x131f5b)[_0xd11f('0xa')](function(_0x3eea42){logger[_0xd11f('0xb')](_0xd11f('0xc'),_0x3d8f36,_0xd11f('0xd'));logger[_0xd11f('0xe')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x3d8f36,'request\x20sent',JSON[_0xd11f('0xf')](_0x3eea42));if(_0x3eea42[_0xd11f('0x10')]){if(_0x3eea42[_0xd11f('0x10')][_0xd11f('0x11')]===0x1f4){logger[_0xd11f('0x10')](_0xd11f('0xc'),_0x3d8f36,_0x3eea42['error'][_0xd11f('0x12')]);return _0x508e3c(_0x3eea42[_0xd11f('0x10')][_0xd11f('0x12')]);}logger[_0xd11f('0x10')](_0xd11f('0xc'),_0x3d8f36,_0x3eea42[_0xd11f('0x10')][_0xd11f('0x12')]);return _0x28c74d(_0x3eea42[_0xd11f('0x10')]['message']);}else{logger[_0xd11f('0xb')](_0xd11f('0xc'),_0x3d8f36,'request\x20sent');_0x28c74d(_0x3eea42['result'][_0xd11f('0x12')]);}})['catch'](function(_0x5f1983){logger[_0xd11f('0x10')](_0xd11f('0xc'),_0x3d8f36,_0x5f1983);_0x508e3c(_0x5f1983);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index c86566e..5c61b23 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4e2943,_0x311fc7){var _0x36d518=function(_0x3fe3e8){while(--_0x3fe3e8){_0x4e2943['push'](_0x4e2943['shift']());}};_0x36d518(++_0x311fc7);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 2803052..12f27f2 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 _0x943f=['BOOLEAN','state','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x683416,_0x1faac5){var _0x5f3294=function(_0x1cf2bb){while(--_0x1cf2bb){_0x683416['push'](_0x683416['shift']());}};_0x5f3294(++_0x1faac5);}(_0x943f,0x6b));var _0xf943=function(_0x47c12d,_0x4eedf0){_0x47c12d=_0x47c12d-0x0;var _0x234039=_0x943f[_0x47c12d];return _0x234039;};'use strict';var Sequelize=require('sequelize');module[_0xf943('0x0')]={'name':{'type':Sequelize[_0xf943('0x1')],'allowNull':![],'unique':_0xf943('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf943('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xf943('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf943('0x1')]},'size':{'type':Sequelize[_0xf943('0x4')]},'active':{'type':Sequelize[_0xf943('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xf943('0x1')]},'logo':{'type':Sequelize[_0xf943('0x1')]},'state':{'type':Sequelize[_0xf943('0x1')],'unique':_0xf943('0x6')},'description':{'type':Sequelize[_0xf943('0x1')]},'title':{'type':Sequelize[_0xf943('0x1')]},'remoteUri':{'type':Sequelize[_0xf943('0x1')]},'link':{'type':Sequelize[_0xf943('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x1e36=['exports','unique_name_and_version','STRING','INTEGER','BOOLEAN'];(function(_0x2bb848,_0x3b0c28){var _0x457be0=function(_0x4cd86c){while(--_0x4cd86c){_0x2bb848['push'](_0x2bb848['shift']());}};_0x457be0(++_0x3b0c28);}(_0x1e36,0x131));var _0x61e3=function(_0x1e081a,_0x482d6b){_0x1e081a=_0x1e081a-0x0;var _0x428209=_0x1e36[_0x1e081a];return _0x428209;};'use strict';var Sequelize=require('sequelize');module[_0x61e3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x61e3('0x1')},'version':{'type':Sequelize[_0x61e3('0x2')],'allowNull':![],'unique':_0x61e3('0x1')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x61e3('0x2')]},'path':{'type':Sequelize[_0x61e3('0x2')]},'type':{'type':Sequelize[_0x61e3('0x2')]},'size':{'type':Sequelize[_0x61e3('0x3')]},'active':{'type':Sequelize[_0x61e3('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x61e3('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x61e3('0x2')]},'title':{'type':Sequelize[_0x61e3('0x2')]},'remoteUri':{'type':Sequelize[_0x61e3('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 c59084d..ee7aec4 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 _0xd943=['mustache','util','path','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','Integration','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x53b585,_0x16e0cd){var _0x2e089a=function(_0x4baa7a){while(--_0x4baa7a){_0x53b585['push'](_0x53b585['shift']());}};_0x2e089a(++_0x16e0cd);}(_0xd943,0x15d));var _0x3d94=function(_0x40ba24,_0xb3df9e){_0x40ba24=_0x40ba24-0x0;var _0x131819=_0xd943[_0x40ba24];return _0x131819;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));}; \ No newline at end of file +var _0xd117=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','Integration','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length'];(function(_0x47cf26,_0x374b70){var _0x3f229e=function(_0x2e1953){while(--_0x2e1953){_0x47cf26['push'](_0x47cf26['shift']());}};_0x3f229e(++_0x374b70);}(_0xd117,0x182));var _0x7d11=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0xd117[_0xd1c39b];return _0x58f5bc;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['Integration'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 6fd4459..4a3c17b 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 _0x5ad6=['../../config/logger','moment','bluebird','../../config/environment','./integration.attributes','define','Integration','integrations'];(function(_0x4dedbc,_0x3bfdcd){var _0x5977a8=function(_0x5051eb){while(--_0x5051eb){_0x4dedbc['push'](_0x4dedbc['shift']());}};_0x5977a8(++_0x3bfdcd);}(_0x5ad6,0xc0));var _0x65ad=function(_0x5745d2,_0x536b58){_0x5745d2=_0x5745d2-0x0;var _0xd6df54=_0x5ad6[_0x5745d2];return _0xd6df54;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x65ad('0x0'))('api');var moment=require(_0x65ad('0x1'));var BPromise=require(_0x65ad('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x65ad('0x3'));var attributes=require(_0x65ad('0x4'));module['exports']=function(_0x1eacc2,_0xbd9747){return _0x1eacc2[_0x65ad('0x5')](_0x65ad('0x6'),attributes,{'tableName':_0x65ad('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccda=['integrations','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x43079f,_0x4bd39){var _0x1d1fa8=function(_0x36b8fd){while(--_0x36b8fd){_0x43079f['push'](_0x43079f['shift']());}};_0x1d1fa8(++_0x4bd39);}(_0xccda,0xab));var _0xaccd=function(_0xce4604,_0x5e98ad){_0xce4604=_0xce4604-0x0;var _0x474352=_0xccda[_0xce4604];return _0x474352;};'use strict';var _=require(_0xaccd('0x0'));var util=require(_0xaccd('0x1'));var logger=require(_0xaccd('0x2'))(_0xaccd('0x3'));var moment=require('moment');var BPromise=require(_0xaccd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaccd('0x5'));var config=require(_0xaccd('0x6'));var attributes=require('./integration.attributes');module[_0xaccd('0x7')]=function(_0x42eac8,_0x15fbc0){return _0x42eac8[_0xaccd('0x8')]('Integration',attributes,{'tableName':_0xaccd('0x9'),'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 82387f5..331efc1 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x60155a,_0x5e8257){var _0x181370=function(_0x52dc58){while(--_0x52dc58){_0x60155a['push'](_0x60155a['shift']());}};_0x181370(++_0x5e8257);}(_0xadb5,0xad));var _0x5adb=function(_0x36cc2d,_0x58db52){_0x36cc2d=_0x36cc2d-0x0;var _0x5d8e60=_0xadb5[_0x36cc2d];return _0x5d8e60;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xc2c7,0x134));var _0x7c2c=function(_0x5c71a4,_0x3180f3){_0x5c71a4=_0x5c71a4-0x0;var _0x331f69=_0xc2c7[_0x5c71a4];return _0x331f69;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('Integration,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 87d63d6..b14ed84 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 _0x1a85=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0x3b67e4,_0x2a5d46){var _0x21adcf=function(_0x3b0243){while(--_0x3b0243){_0x3b67e4['push'](_0x3b67e4['shift']());}};_0x21adcf(++_0x2a5d46);}(_0x1a85,0x178));var _0x51a8=function(_0x575228,_0x3f9bc1){_0x575228=_0x575228-0x0;var _0x4cb11e=_0x1a85[_0x575228];return _0x4cb11e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./integrationReport.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')]('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0xd')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xf')]);router[_0x51a8('0x10')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x11')]);module[_0x51a8('0x12')]=router; \ No newline at end of file +var _0x0b0e=['get','isAuthenticated','index','describe','/:id','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller'];(function(_0x369ebf,_0x13f3ba){var _0x39797d=function(_0xf009d0){while(--_0xf009d0){_0x369ebf['push'](_0x369ebf['shift']());}};_0x39797d(++_0x13f3ba);}(_0x0b0e,0x187));var _0xe0b0=function(_0x9d9d58,_0x7bf873){_0x9d9d58=_0x9d9d58-0x0;var _0x51d4d3=_0x0b0e[_0x9d9d58];return _0x51d4d3;};'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')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0xe')]('/',auth[_0xe0b0('0xa')](),controller['create']);router[_0xe0b0('0xf')](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);module[_0xe0b0('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 1552c50..970af6c 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 _0xa69d=['SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x10113d,_0x13a861){var _0xf52f5d=function(_0x5b6479){while(--_0x5b6479){_0x10113d['push'](_0x10113d['shift']());}};_0xf52f5d(++_0x13a861);}(_0xa69d,0xf5));var _0xda69=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa69d[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require('sequelize');module[_0xda69('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xda69('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xda69('0x2')]},'contacts':{'type':Sequelize[_0xda69('0x1')]},'uniqueid':{'type':Sequelize[_0xda69('0x1')]},'calleridnum':{'type':Sequelize[_0xda69('0x1')]},'calleridname':{'type':Sequelize[_0xda69('0x1')]},'queue':{'type':Sequelize[_0xda69('0x1')]},'interface':{'type':Sequelize[_0xda69('0x1')]},'membername':{'type':Sequelize[_0xda69('0x1')]},'agentcalledAt':{'type':Sequelize[_0xda69('0x3')]},'agentconnectAt':{'type':Sequelize[_0xda69('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xda69('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xda69('0x2')]},'agentacw':{'type':Sequelize[_0xda69('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xda69('0x2')]},'reason':{'type':Sequelize[_0xda69('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xda69('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xda69('0x3')]},'lastevent':{'type':Sequelize[_0xda69('0x1')]},'channel':{'type':Sequelize[_0xda69('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xda69('0x1')]},'connectedlinenum':{'type':Sequelize[_0xda69('0x1')]},'connectedlinename':{'type':Sequelize[_0xda69('0x1')]},'language':{'type':Sequelize[_0xda69('0x1')]},'accountcode':{'type':Sequelize[_0xda69('0x1')]},'context':{'type':Sequelize[_0xda69('0x1')]},'exten':{'type':Sequelize[_0xda69('0x1')]},'priority':{'type':Sequelize[_0xda69('0x1')]},'destchannel':{'type':Sequelize[_0xda69('0x1')]},'destchannelstate':{'type':Sequelize[_0xda69('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xda69('0x1')]},'destcalleridname':{'type':Sequelize[_0xda69('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xda69('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xda69('0x1')]},'destlanguage':{'type':Sequelize[_0xda69('0x1')]},'destaccountcode':{'type':Sequelize[_0xda69('0x1')]},'destcontext':{'type':Sequelize[_0xda69('0x1')]},'destexten':{'type':Sequelize[_0xda69('0x1')]},'destpriority':{'type':Sequelize[_0xda69('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xda69('0x1')]},'inReplyTo':{'type':Sequelize[_0xda69('0x1')]},'subject':{'type':Sequelize[_0xda69('0x1')]},'from':{'type':Sequelize[_0xda69('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xda69('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xda69('0x5')]},'text':{'type':Sequelize[_0xda69('0x5')]},'status':{'type':Sequelize[_0xda69('0x6')](_0xda69('0x7'),_0xda69('0x8'),_0xda69('0x9'),_0xda69('0xa'))},'url':{'type':Sequelize[_0xda69('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xda69('0x1')]},'projectId':{'type':Sequelize[_0xda69('0x2')]}}; \ No newline at end of file +var _0x9263=['SENDING','RECEIVED','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT'];(function(_0xc79f2e,_0x594942){var _0x3219dc=function(_0x4f563b){while(--_0x4f563b){_0xc79f2e['push'](_0xc79f2e['shift']());}};_0x3219dc(++_0x594942);}(_0x9263,0x18e));var _0x3926=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x9263[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x3926('0x0')]},'exitStatus':{'type':Sequelize[_0x3926('0x0')]},'ticketId':{'type':Sequelize[_0x3926('0x0')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x3926('0x0')]},'uniqueid':{'type':Sequelize[_0x3926('0x0')]},'calleridnum':{'type':Sequelize[_0x3926('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3926('0x0')]},'interface':{'type':Sequelize[_0x3926('0x0')]},'membername':{'type':Sequelize[_0x3926('0x0')]},'agentcalledAt':{'type':Sequelize[_0x3926('0x1')]},'agentconnectAt':{'type':Sequelize[_0x3926('0x1')]},'holdtime':{'type':Sequelize[_0x3926('0x2')]},'agentcomplete':{'type':Sequelize[_0x3926('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x3926('0x2')]},'agentacw':{'type':Sequelize[_0x3926('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3926('0x2')]},'reason':{'type':Sequelize[_0x3926('0x0')]},'agentringnoanswer':{'type':Sequelize[_0x3926('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3926('0x1')]},'agentdump':{'type':Sequelize[_0x3926('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3926('0x1')]},'lastevent':{'type':Sequelize[_0x3926('0x0')]},'channel':{'type':Sequelize[_0x3926('0x0')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x3926('0x0')]},'connectedlinenum':{'type':Sequelize[_0x3926('0x0')]},'connectedlinename':{'type':Sequelize[_0x3926('0x0')]},'language':{'type':Sequelize[_0x3926('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3926('0x0')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3926('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x3926('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3926('0x0')]},'destcalleridnum':{'type':Sequelize[_0x3926('0x0')]},'destcalleridname':{'type':Sequelize[_0x3926('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x3926('0x0')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x3926('0x0')]},'destexten':{'type':Sequelize[_0x3926('0x0')]},'destpriority':{'type':Sequelize[_0x3926('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x3926('0x0')]},'inReplyTo':{'type':Sequelize[_0x3926('0x0')]},'subject':{'type':Sequelize[_0x3926('0x0')]},'from':{'type':Sequelize[_0x3926('0x0')]},'to':{'type':Sequelize[_0x3926('0x0')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x3926('0x4')]},'html':{'type':Sequelize[_0x3926('0x4')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x3926('0x5')](_0x3926('0x6'),_0x3926('0x7'),_0x3926('0x8'),'FAILED')},'url':{'type':Sequelize[_0x3926('0x0')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x3926('0x0')]},'projectId':{'type':Sequelize[_0x3926('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 696d472..37ec049 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 _0x8912=['name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','params','body','describe','eml-format','zip-dir','fast-json-patch','moment','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error'];(function(_0x22cf6e,_0x336300){var _0x7dcf4b=function(_0x1ce984){while(--_0x1ce984){_0x22cf6e['push'](_0x22cf6e['shift']());}};_0x7dcf4b(++_0x336300);}(_0x8912,0x6c));var _0x2891=function(_0x24259e,_0x4c2c01){_0x24259e=_0x24259e-0x0;var _0x404a0e=_0x8912[_0x24259e];return _0x404a0e;};'use strict';var emlformat=require(_0x2891('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2891('0x1'));var jsonpatch=require(_0x2891('0x2'));var rp=require('request-promise');var moment=require(_0x2891('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2891('0x4'));var sox=require('sox');var csv=require(_0x2891('0x5'));var ejs=require(_0x2891('0x6'));var fs=require('fs');var fs_extra=require(_0x2891('0x7'));var _=require('lodash');var squel=require(_0x2891('0x8'));var crypto=require(_0x2891('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x2891('0xa'));var toCsv=require(_0x2891('0x5'));var querystring=require(_0x2891('0xb'));var Papa=require(_0x2891('0xc'));var Redis=require(_0x2891('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2891('0xe'));var as=require(_0x2891('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2891('0x10'));var utils=require(_0x2891('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x2891('0x12'));var db=require(_0x2891('0x13'))['db'];function respondWithStatusCode(_0xbbb42a,_0x148b96){_0x148b96=_0x148b96||0xcc;return function(_0xc8ec58){if(_0xc8ec58){return _0xbbb42a['sendStatus'](_0x148b96);}return _0xbbb42a[_0x2891('0x14')](_0x148b96)[_0x2891('0x15')]();};}function respondWithResult(_0x412c30,_0x77cf1a){_0x77cf1a=_0x77cf1a||0xc8;return function(_0x347870){if(_0x347870){return _0x412c30[_0x2891('0x14')](_0x77cf1a)['json'](_0x347870);}};}function respondWithFilteredResult(_0x4145ff,_0x5545b6){return function(_0x15d3c2){if(_0x15d3c2){var _0x1ca5aa=typeof _0x5545b6[_0x2891('0x16')]==='undefined'&&typeof _0x5545b6[_0x2891('0x17')]===_0x2891('0x18');var _0x1899b1=_0x15d3c2[_0x2891('0x19')];var _0x26844f=_0x1ca5aa?0x0:_0x5545b6[_0x2891('0x16')];var _0x4be583=_0x1ca5aa?_0x15d3c2['count']:_0x5545b6[_0x2891('0x16')]+_0x5545b6[_0x2891('0x17')];var _0x310482;if(_0x4be583>=_0x1899b1){_0x4be583=_0x1899b1;_0x310482=0xc8;}else{_0x310482=0xce;}_0x4145ff['status'](_0x310482);return _0x4145ff[_0x2891('0x1a')](_0x2891('0x1b'),_0x26844f+'-'+_0x4be583+'/'+_0x1899b1)[_0x2891('0x1c')](_0x15d3c2);}return null;};}function patchUpdates(_0x5399e0){return function(_0x62ee78){try{jsonpatch[_0x2891('0x1d')](_0x62ee78,_0x5399e0,!![]);}catch(_0x452bc8){return BPromise[_0x2891('0x1e')](_0x452bc8);}return _0x62ee78['save']();};}function saveUpdates(_0x37bdb9,_0x35e5e5){return function(_0x58771b){if(_0x58771b){return _0x58771b[_0x2891('0x1f')](_0x37bdb9)[_0x2891('0x20')](function(_0x2674e2){return _0x2674e2;});}return null;};}function removeEntity(_0x5e45a8,_0x38d045){return function(_0x2f8707){if(_0x2f8707){return _0x2f8707[_0x2891('0x21')]()[_0x2891('0x20')](function(){_0x5e45a8[_0x2891('0x14')](0xcc)[_0x2891('0x15')]();});}};}function handleEntityNotFound(_0x276a82,_0x3800ce){return function(_0x3caf34){if(!_0x3caf34){_0x276a82[_0x2891('0x22')](0x194);}return _0x3caf34;};}function handleError(_0x1f704a,_0x3d153f){_0x3d153f=_0x3d153f||0x1f4;return function(_0x57bef2){logger[_0x2891('0x23')](_0x57bef2['stack']);if(_0x57bef2[_0x2891('0x24')]){delete _0x57bef2[_0x2891('0x24')];}_0x1f704a[_0x2891('0x14')](_0x3d153f)[_0x2891('0x25')](_0x57bef2);};}exports[_0x2891('0x26')]=function(_0x59078c,_0x886e19){var _0x5d896f={},_0x9810e2={},_0x5c2c7c={'count':0x0,'rows':[]};var _0x219b10=_[_0x2891('0x27')](db[_0x2891('0x28')][_0x2891('0x29')],function(_0x5cfc93){return{'name':_0x5cfc93[_0x2891('0x2a')],'type':_0x5cfc93[_0x2891('0x2b')][_0x2891('0x2c')]};});_0x9810e2[_0x2891('0x2d')]=_['map'](_0x219b10,_0x2891('0x24'));_0x9810e2[_0x2891('0x2e')]=_[_0x2891('0x2f')](_0x59078c[_0x2891('0x2e')]);_0x9810e2[_0x2891('0x30')]=_[_0x2891('0x31')](_0x9810e2[_0x2891('0x2d')],_0x9810e2[_0x2891('0x2e')]);_0x5d896f[_0x2891('0x32')]=_[_0x2891('0x31')](_0x9810e2['model'],qs['fields'](_0x59078c['query'][_0x2891('0x33')]));_0x5d896f[_0x2891('0x32')]=_0x5d896f[_0x2891('0x32')]['length']?_0x5d896f[_0x2891('0x32')]:_0x9810e2['model'];if(!_0x59078c[_0x2891('0x2e')][_0x2891('0x34')]('nolimit')){_0x5d896f[_0x2891('0x17')]=qs['limit'](_0x59078c['query'][_0x2891('0x17')]);_0x5d896f[_0x2891('0x16')]=qs[_0x2891('0x16')](_0x59078c['query'][_0x2891('0x16')]);}_0x5d896f[_0x2891('0x35')]=qs[_0x2891('0x36')](_0x59078c[_0x2891('0x2e')][_0x2891('0x36')]);_0x5d896f[_0x2891('0x37')]=qs['filters'](_[_0x2891('0x38')](_0x59078c[_0x2891('0x2e')],_0x9810e2[_0x2891('0x30')]),_0x219b10);if(_0x59078c['query'][_0x2891('0x39')]){_0x5d896f[_0x2891('0x37')]=_[_0x2891('0x3a')](_0x5d896f['where'],{'$or':_[_0x2891('0x27')](_0x219b10,function(_0xf8052a){if(_0xf8052a[_0x2891('0x2b')]!==_0x2891('0x3b')){var _0x1940ba={};_0x1940ba[_0xf8052a[_0x2891('0x24')]]={'$like':'%'+_0x59078c[_0x2891('0x2e')][_0x2891('0x39')]+'%'};return _0x1940ba;}})});}_0x5d896f=_[_0x2891('0x3a')]({},_0x5d896f,_0x59078c[_0x2891('0x3c')]);var _0x3654ab={'where':_0x5d896f[_0x2891('0x37')]};return db['IntegrationReport'][_0x2891('0x19')](_0x3654ab)[_0x2891('0x20')](function(_0x36c0c6){_0x5c2c7c[_0x2891('0x19')]=_0x36c0c6;if(_0x59078c[_0x2891('0x2e')][_0x2891('0x3d')]){_0x5d896f[_0x2891('0x3e')]=[{'all':!![]}];}return db[_0x2891('0x28')][_0x2891('0x3f')](_0x5d896f);})['then'](function(_0x3f9f07){_0x5c2c7c['rows']=_0x3f9f07;return _0x5c2c7c;})[_0x2891('0x20')](respondWithFilteredResult(_0x886e19,_0x5d896f))[_0x2891('0x40')](handleError(_0x886e19,null));};exports[_0x2891('0x41')]=function(_0x493603,_0x47ee4b){var _0xabbea5={'raw':![],'where':{'id':_0x493603['params']['id']}},_0x1f210b={};_0x1f210b[_0x2891('0x2d')]=_[_0x2891('0x2f')](db[_0x2891('0x28')][_0x2891('0x29')]);_0x1f210b[_0x2891('0x2e')]=_[_0x2891('0x2f')](_0x493603[_0x2891('0x2e')]);_0x1f210b[_0x2891('0x30')]=_[_0x2891('0x31')](_0x1f210b[_0x2891('0x2d')],_0x1f210b['query']);_0xabbea5[_0x2891('0x32')]=_[_0x2891('0x31')](_0x1f210b['model'],qs[_0x2891('0x33')](_0x493603[_0x2891('0x2e')][_0x2891('0x33')]));_0xabbea5[_0x2891('0x32')]=_0xabbea5['attributes'][_0x2891('0x42')]?_0xabbea5[_0x2891('0x32')]:_0x1f210b['model'];if(_0x493603[_0x2891('0x2e')]['includeAll']){_0xabbea5['include']=[{'all':!![]}];}_0xabbea5=_[_0x2891('0x3a')]({},_0xabbea5,_0x493603[_0x2891('0x3c')]);return db[_0x2891('0x28')][_0x2891('0x43')](_0xabbea5)['then'](handleEntityNotFound(_0x47ee4b,null))[_0x2891('0x20')](respondWithResult(_0x47ee4b,null))[_0x2891('0x40')](handleError(_0x47ee4b,null));};exports['create']=function(_0x2687c8,_0x3c7afa){return db[_0x2891('0x28')][_0x2891('0x44')](_0x2687c8['body'],{})['then'](respondWithResult(_0x3c7afa,0xc9))[_0x2891('0x40')](handleError(_0x3c7afa,null));};exports[_0x2891('0x1f')]=function(_0x43aa76,_0x5ae25c){if(_0x43aa76['body']['id']){delete _0x43aa76['body']['id'];}return db[_0x2891('0x28')][_0x2891('0x43')]({'where':{'id':_0x43aa76[_0x2891('0x45')]['id']}})[_0x2891('0x20')](handleEntityNotFound(_0x5ae25c,null))[_0x2891('0x20')](saveUpdates(_0x43aa76[_0x2891('0x46')],null))['then'](respondWithResult(_0x5ae25c,null))[_0x2891('0x40')](handleError(_0x5ae25c,null));};exports[_0x2891('0x21')]=function(_0x409e0c,_0x11dece){return db[_0x2891('0x28')]['find']({'where':{'id':_0x409e0c[_0x2891('0x45')]['id']}})[_0x2891('0x20')](handleEntityNotFound(_0x11dece,null))[_0x2891('0x20')](removeEntity(_0x11dece,null))['catch'](handleError(_0x11dece,null));};exports[_0x2891('0x47')]=function(_0x292f75,_0xf9df49){return db['IntegrationReport'][_0x2891('0x47')]()[_0x2891('0x20')](respondWithResult(_0xf9df49,null))[_0x2891('0x40')](handleError(_0xf9df49,null));}; \ No newline at end of file +var _0x656f=['count','include','rows','catch','show','keys','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','limit','offset','set','json','apply','save','update','then','destroy','sendStatus','error','name','index','map','IntegrationReport','rawAttributes','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options'];(function(_0x476c5b,_0x182b80){var _0x24e2f1=function(_0x2ecc1f){while(--_0x2ecc1f){_0x476c5b['push'](_0x476c5b['shift']());}};_0x24e2f1(++_0x182b80);}(_0x656f,0x1ee));var _0xf656=function(_0x37db28,_0x48855b){_0x37db28=_0x37db28-0x0;var _0x31ba05=_0x656f[_0x37db28];return _0x31ba05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf656('0x0'));var zipdir=require(_0xf656('0x1'));var jsonpatch=require(_0xf656('0x2'));var rp=require(_0xf656('0x3'));var moment=require(_0xf656('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf656('0x5'));var util=require(_0xf656('0x6'));var path=require('path');var sox=require(_0xf656('0x7'));var csv=require(_0xf656('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf656('0x9'));var _=require(_0xf656('0xa'));var squel=require(_0xf656('0xb'));var crypto=require(_0xf656('0xc'));var jsforce=require(_0xf656('0xd'));var deskjs=require(_0xf656('0xe'));var toCsv=require(_0xf656('0x8'));var querystring=require(_0xf656('0xf'));var Papa=require(_0xf656('0x10'));var Redis=require(_0xf656('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf656('0x12'));var as=require(_0xf656('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf656('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf656('0x15'));var db=require(_0xf656('0x16'))['db'];function respondWithStatusCode(_0x5bcfae,_0x38e0d9){_0x38e0d9=_0x38e0d9||0xcc;return function(_0x31c03e){if(_0x31c03e){return _0x5bcfae['sendStatus'](_0x38e0d9);}return _0x5bcfae[_0xf656('0x17')](_0x38e0d9)[_0xf656('0x18')]();};}function respondWithResult(_0x2d9719,_0x44af54){_0x44af54=_0x44af54||0xc8;return function(_0x51134a){if(_0x51134a){return _0x2d9719[_0xf656('0x17')](_0x44af54)['json'](_0x51134a);}};}function respondWithFilteredResult(_0x4ceabe,_0x4ce17f){return function(_0x524af3){if(_0x524af3){var _0x5777c9=typeof _0x4ce17f['offset']===_0xf656('0x19')&&typeof _0x4ce17f[_0xf656('0x1a')]===_0xf656('0x19');var _0x2cca08=_0x524af3['count'];var _0x5ba8b7=_0x5777c9?0x0:_0x4ce17f[_0xf656('0x1b')];var _0x49e6a0=_0x5777c9?_0x524af3['count']:_0x4ce17f['offset']+_0x4ce17f['limit'];var _0x2c6001;if(_0x49e6a0>=_0x2cca08){_0x49e6a0=_0x2cca08;_0x2c6001=0xc8;}else{_0x2c6001=0xce;}_0x4ceabe[_0xf656('0x17')](_0x2c6001);return _0x4ceabe[_0xf656('0x1c')]('Content-Range',_0x5ba8b7+'-'+_0x49e6a0+'/'+_0x2cca08)[_0xf656('0x1d')](_0x524af3);}return null;};}function patchUpdates(_0x5a0517){return function(_0x3b42a3){try{jsonpatch[_0xf656('0x1e')](_0x3b42a3,_0x5a0517,!![]);}catch(_0x3a8216){return BPromise['reject'](_0x3a8216);}return _0x3b42a3[_0xf656('0x1f')]();};}function saveUpdates(_0x44a6b0,_0x49d00c){return function(_0xa43a4b){if(_0xa43a4b){return _0xa43a4b[_0xf656('0x20')](_0x44a6b0)[_0xf656('0x21')](function(_0x194521){return _0x194521;});}return null;};}function removeEntity(_0x5cd627,_0x43aff3){return function(_0x16e49b){if(_0x16e49b){return _0x16e49b[_0xf656('0x22')]()[_0xf656('0x21')](function(){_0x5cd627[_0xf656('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bc656,_0x308e47){return function(_0x361938){if(!_0x361938){_0x1bc656[_0xf656('0x23')](0x194);}return _0x361938;};}function handleError(_0x4dbd24,_0xda9e3c){_0xda9e3c=_0xda9e3c||0x1f4;return function(_0x2b607e){logger[_0xf656('0x24')](_0x2b607e['stack']);if(_0x2b607e[_0xf656('0x25')]){delete _0x2b607e[_0xf656('0x25')];}_0x4dbd24[_0xf656('0x17')](_0xda9e3c)['send'](_0x2b607e);};}exports[_0xf656('0x26')]=function(_0x2430a6,_0xdeb1a9){var _0x47d69e={},_0x40fb05={},_0x3c5047={'count':0x0,'rows':[]};var _0x27c445=_[_0xf656('0x27')](db[_0xf656('0x28')][_0xf656('0x29')],function(_0xf7bae3){return{'name':_0xf7bae3['fieldName'],'type':_0xf7bae3['type'][_0xf656('0x2a')]};});_0x40fb05[_0xf656('0x2b')]=_['map'](_0x27c445,'name');_0x40fb05['query']=_['keys'](_0x2430a6[_0xf656('0x2c')]);_0x40fb05['filters']=_[_0xf656('0x2d')](_0x40fb05['model'],_0x40fb05[_0xf656('0x2c')]);_0x47d69e[_0xf656('0x2e')]=_[_0xf656('0x2d')](_0x40fb05['model'],qs[_0xf656('0x2f')](_0x2430a6[_0xf656('0x2c')]['fields']));_0x47d69e[_0xf656('0x2e')]=_0x47d69e[_0xf656('0x2e')][_0xf656('0x30')]?_0x47d69e[_0xf656('0x2e')]:_0x40fb05[_0xf656('0x2b')];if(!_0x2430a6[_0xf656('0x2c')]['hasOwnProperty'](_0xf656('0x31'))){_0x47d69e[_0xf656('0x1a')]=qs[_0xf656('0x1a')](_0x2430a6[_0xf656('0x2c')][_0xf656('0x1a')]);_0x47d69e[_0xf656('0x1b')]=qs['offset'](_0x2430a6['query'][_0xf656('0x1b')]);}_0x47d69e[_0xf656('0x32')]=qs[_0xf656('0x33')](_0x2430a6[_0xf656('0x2c')][_0xf656('0x33')]);_0x47d69e[_0xf656('0x34')]=qs[_0xf656('0x35')](_[_0xf656('0x36')](_0x2430a6[_0xf656('0x2c')],_0x40fb05[_0xf656('0x35')]),_0x27c445);if(_0x2430a6[_0xf656('0x2c')][_0xf656('0x37')]){_0x47d69e[_0xf656('0x34')]=_['merge'](_0x47d69e[_0xf656('0x34')],{'$or':_['map'](_0x27c445,function(_0x4be7cf){if(_0x4be7cf['type']!=='VIRTUAL'){var _0x2ded8b={};_0x2ded8b[_0x4be7cf['name']]={'$like':'%'+_0x2430a6[_0xf656('0x2c')][_0xf656('0x37')]+'%'};return _0x2ded8b;}})});}_0x47d69e=_[_0xf656('0x38')]({},_0x47d69e,_0x2430a6[_0xf656('0x39')]);var _0x5d46b6={'where':_0x47d69e['where']};return db[_0xf656('0x28')][_0xf656('0x3a')](_0x5d46b6)[_0xf656('0x21')](function(_0x21fd46){_0x3c5047[_0xf656('0x3a')]=_0x21fd46;if(_0x2430a6[_0xf656('0x2c')]['includeAll']){_0x47d69e[_0xf656('0x3b')]=[{'all':!![]}];}return db[_0xf656('0x28')]['findAll'](_0x47d69e);})[_0xf656('0x21')](function(_0x3335a6){_0x3c5047[_0xf656('0x3c')]=_0x3335a6;return _0x3c5047;})[_0xf656('0x21')](respondWithFilteredResult(_0xdeb1a9,_0x47d69e))[_0xf656('0x3d')](handleError(_0xdeb1a9,null));};exports[_0xf656('0x3e')]=function(_0x4b4c86,_0x4b7e35){var _0x29bf0f={'raw':![],'where':{'id':_0x4b4c86['params']['id']}},_0x4df9f9={};_0x4df9f9['model']=_[_0xf656('0x3f')](db[_0xf656('0x28')][_0xf656('0x29')]);_0x4df9f9[_0xf656('0x2c')]=_[_0xf656('0x3f')](_0x4b4c86['query']);_0x4df9f9['filters']=_[_0xf656('0x2d')](_0x4df9f9[_0xf656('0x2b')],_0x4df9f9[_0xf656('0x2c')]);_0x29bf0f[_0xf656('0x2e')]=_[_0xf656('0x2d')](_0x4df9f9[_0xf656('0x2b')],qs[_0xf656('0x2f')](_0x4b4c86[_0xf656('0x2c')][_0xf656('0x2f')]));_0x29bf0f['attributes']=_0x29bf0f['attributes'][_0xf656('0x30')]?_0x29bf0f[_0xf656('0x2e')]:_0x4df9f9[_0xf656('0x2b')];if(_0x4b4c86['query']['includeAll']){_0x29bf0f['include']=[{'all':!![]}];}_0x29bf0f=_[_0xf656('0x38')]({},_0x29bf0f,_0x4b4c86[_0xf656('0x39')]);return db[_0xf656('0x28')]['find'](_0x29bf0f)[_0xf656('0x21')](handleEntityNotFound(_0x4b7e35,null))['then'](respondWithResult(_0x4b7e35,null))[_0xf656('0x3d')](handleError(_0x4b7e35,null));};exports['create']=function(_0x26bb3a,_0x1a1695){return db[_0xf656('0x28')][_0xf656('0x40')](_0x26bb3a[_0xf656('0x41')],{})[_0xf656('0x21')](respondWithResult(_0x1a1695,0xc9))[_0xf656('0x3d')](handleError(_0x1a1695,null));};exports[_0xf656('0x20')]=function(_0x1cef7b,_0xa3a73b){if(_0x1cef7b['body']['id']){delete _0x1cef7b[_0xf656('0x41')]['id'];}return db[_0xf656('0x28')][_0xf656('0x42')]({'where':{'id':_0x1cef7b['params']['id']}})[_0xf656('0x21')](handleEntityNotFound(_0xa3a73b,null))['then'](saveUpdates(_0x1cef7b[_0xf656('0x41')],null))['then'](respondWithResult(_0xa3a73b,null))['catch'](handleError(_0xa3a73b,null));};exports[_0xf656('0x22')]=function(_0x94a81f,_0x505e36){return db[_0xf656('0x28')][_0xf656('0x42')]({'where':{'id':_0x94a81f[_0xf656('0x43')]['id']}})['then'](handleEntityNotFound(_0x505e36,null))[_0xf656('0x21')](removeEntity(_0x505e36,null))[_0xf656('0x3d')](handleError(_0x505e36,null));};exports[_0xf656('0x44')]=function(_0x300272,_0x1bb2f3){return db[_0xf656('0x28')][_0xf656('0x44')]()[_0xf656('0x21')](respondWithResult(_0x1bb2f3,null))[_0xf656('0x3d')](handleError(_0x1bb2f3,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 33b71ef..0f70644 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 _0x129d=['path','rimraf','./integrationReport.attributes','exports','lodash','util','../../config/logger','api','request-promise'];(function(_0x3b5e99,_0x1e6b8a){var _0x47674c=function(_0x2e45f7){while(--_0x2e45f7){_0x3b5e99['push'](_0x3b5e99['shift']());}};_0x47674c(++_0x1e6b8a);}(_0x129d,0x1b4));var _0xd129=function(_0x22b1ca,_0x15f31e){_0x22b1ca=_0x22b1ca-0x0;var _0x5785d4=_0x129d[_0x22b1ca];return _0x5785d4;};'use strict';var _=require(_0xd129('0x0'));var util=require(_0xd129('0x1'));var logger=require(_0xd129('0x2'))(_0xd129('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd129('0x4'));var fs=require('fs');var path=require(_0xd129('0x5'));var rimraf=require(_0xd129('0x6'));var config=require('../../config/environment');var attributes=require(_0xd129('0x7'));module[_0xd129('0x8')]=function(_0x17f835,_0x187c63){return _0x17f835['define']('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab80=['report_integration','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0x54363d,_0x161cf6){var _0x50edf4=function(_0x53b33b){while(--_0x53b33b){_0x54363d['push'](_0x54363d['shift']());}};_0x50edf4(++_0x161cf6);}(_0xab80,0x151));var _0x0ab8=function(_0x37f862,_0x18e364){_0x37f862=_0x37f862-0x0;var _0x12fdb0=_0xab80[_0x37f862];return _0x12fdb0;};'use strict';var _=require(_0x0ab8('0x0'));var util=require(_0x0ab8('0x1'));var logger=require(_0x0ab8('0x2'))(_0x0ab8('0x3'));var moment=require(_0x0ab8('0x4'));var BPromise=require(_0x0ab8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ab8('0x6'));var rimraf=require(_0x0ab8('0x7'));var config=require(_0x0ab8('0x8'));var attributes=require(_0x0ab8('0x9'));module[_0x0ab8('0xa')]=function(_0x33a011,_0x233932){return _0x33a011[_0x0ab8('0xb')](_0x0ab8('0xc'),attributes,{'tableName':_0x0ab8('0xd'),'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 d4f7ea7..f15ffa2 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 _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x213465,_0x52d888){var _0x3f1e03=function(_0xaf73e3){while(--_0xaf73e3){_0x213465['push'](_0x213465['shift']());}};_0x3f1e03(++_0x52d888);}(_0x4819,0xcd));var _0x9481=function(_0x401d08,_0x3afbb4){_0x401d08=_0x401d08-0x0;var _0x3a7297=_0x4819[_0x401d08];return _0x3a7297;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x5c784c,_0x498276){var _0x4f8eb0=function(_0x421abf){while(--_0x421abf){_0x5c784c['push'](_0x5c784c['shift']());}};_0x4f8eb0(++_0x498276);}(_0xdb28,0x106));var _0x8db2=function(_0x5352ae,_0x2b4503){_0x5352ae=_0x5352ae-0x0;var _0x1ff29f=_0xdb28[_0x5352ae];return _0x1ff29f;};'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')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index a193c72..58b545c 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 _0x3f27=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','addIntervals','put','update','delete','destroy','exports'];(function(_0xd0cbf1,_0x59be9b){var _0x327baf=function(_0xd72ef9){while(--_0xd72ef9){_0xd0cbf1['push'](_0xd0cbf1['shift']());}};_0x327baf(++_0x59be9b);}(_0x3f27,0x1f4));var _0x73f2=function(_0x221b34,_0x3b82da){_0x221b34=_0x221b34-0x0;var _0x394b87=_0x3f27[_0x221b34];return _0x394b87;};'use strict';var multer=require(_0x73f2('0x0'));var util=require(_0x73f2('0x1'));var path=require(_0x73f2('0x2'));var timeout=require(_0x73f2('0x3'));var express=require(_0x73f2('0x4'));var router=express['Router']();var fs_extra=require(_0x73f2('0x5'));var auth=require(_0x73f2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x73f2('0x7')]('/',auth[_0x73f2('0x8')](),controller[_0x73f2('0x9')]);router[_0x73f2('0x7')](_0x73f2('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x73f2('0x7')](_0x73f2('0xb'),auth[_0x73f2('0x8')](),controller[_0x73f2('0xc')]);router[_0x73f2('0xd')]('/',auth[_0x73f2('0x8')](),controller['create']);router[_0x73f2('0xd')](_0x73f2('0xb'),auth[_0x73f2('0x8')](),controller['addInterval']);router['post']('/:id/sub_intervals/create_many',auth[_0x73f2('0x8')](),controller[_0x73f2('0xe')]);router[_0x73f2('0xf')](_0x73f2('0xa'),auth[_0x73f2('0x8')](),controller[_0x73f2('0x10')]);router[_0x73f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x73f2('0x12')]);module[_0x73f2('0x13')]=router; \ No newline at end of file +var _0x972c=['path','connect-timeout','Router','fs-extra','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','show','getIntervals','create','post','/:id/sub_intervals','addInterval','addIntervals','put','update','delete','destroy','exports'];(function(_0x5f6048,_0x3c480b){var _0xc2de08=function(_0xa78919){while(--_0xa78919){_0x5f6048['push'](_0x5f6048['shift']());}};_0xc2de08(++_0x3c480b);}(_0x972c,0xf2));var _0xc972=function(_0x1c73cf,_0x21ca62){_0x1c73cf=_0x1c73cf-0x0;var _0x43921e=_0x972c[_0x1c73cf];return _0x43921e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc972('0x0'));var timeout=require(_0xc972('0x1'));var express=require('express');var router=express[_0xc972('0x2')]();var fs_extra=require(_0xc972('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc972('0x4'));var controller=require(_0xc972('0x5'));router[_0xc972('0x6')]('/',auth['isAuthenticated'](),controller[_0xc972('0x7')]);router['get'](_0xc972('0x8'),auth[_0xc972('0x9')](),controller[_0xc972('0xa')]);router['get']('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xc972('0xb')]);router['post']('/',auth[_0xc972('0x9')](),controller[_0xc972('0xc')]);router[_0xc972('0xd')](_0xc972('0xe'),auth[_0xc972('0x9')](),controller[_0xc972('0xf')]);router[_0xc972('0xd')]('/:id/sub_intervals/create_many',auth[_0xc972('0x9')](),controller[_0xc972('0x10')]);router[_0xc972('0x11')]('/:id',auth[_0xc972('0x9')](),controller[_0xc972('0x12')]);router[_0xc972('0x13')]('/:id',auth[_0xc972('0x9')](),controller[_0xc972('0x14')]);module[_0xc972('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index f107dc4..0f52bdc 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 _0xd7f6=['sequelize','exports','STRING'];(function(_0x53782d,_0x160f43){var _0x115814=function(_0x24d32c){while(--_0x24d32c){_0x53782d['push'](_0x53782d['shift']());}};_0x115814(++_0x160f43);}(_0xd7f6,0x75));var _0x6d7f=function(_0x267575,_0x46a0ef){_0x267575=_0x267575-0x0;var _0x1f09da=_0xd7f6[_0x267575];return _0x1f09da;};'use strict';var Sequelize=require(_0x6d7f('0x0'));module[_0x6d7f('0x1')]={'name':{'type':Sequelize[_0x6d7f('0x2')]},'description':{'type':Sequelize[_0x6d7f('0x2')]},'interval':{'type':Sequelize[_0x6d7f('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x3b12=['STRING','exports'];(function(_0x27216c,_0x2d8876){var _0x5f1960=function(_0x17157c){while(--_0x17157c){_0x27216c['push'](_0x27216c['shift']());}};_0x5f1960(++_0x2d8876);}(_0x3b12,0x1ef));var _0x23b1=function(_0x442084,_0x3de807){_0x442084=_0x442084-0x0;var _0x409526=_0x3b12[_0x442084];return _0x409526;};'use strict';var Sequelize=require('sequelize');module[_0x23b1('0x0')]={'name':{'type':Sequelize[_0x23b1('0x1')]},'description':{'type':Sequelize[_0x23b1('0x1')]},'interval':{'type':Sequelize[_0x23b1('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 2e9a10b..11c6552 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 _0x28e3=['mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','name','send','index','map','Interval','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','find','create','user','role','autoAssociation','body','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1d6337,_0x38ac20){var _0x11d95a=function(_0x2a054a){while(--_0x2a054a){_0x1d6337['push'](_0x1d6337['shift']());}};_0x11d95a(++_0x38ac20);}(_0x28e3,0x105));var _0x328e=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x28e3[_0x266618];return _0x54dbf5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x328e('0x0'));var zipdir=require(_0x328e('0x1'));var jsonpatch=require(_0x328e('0x2'));var rp=require(_0x328e('0x3'));var moment=require(_0x328e('0x4'));var BPromise=require(_0x328e('0x5'));var Mustache=require(_0x328e('0x6'));var util=require('util');var path=require(_0x328e('0x7'));var sox=require(_0x328e('0x8'));var csv=require(_0x328e('0x9'));var ejs=require(_0x328e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x328e('0xb'));var squel=require('squel');var crypto=require(_0x328e('0xc'));var jsforce=require(_0x328e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x328e('0x9'));var querystring=require(_0x328e('0xe'));var Papa=require(_0x328e('0xf'));var Redis=require(_0x328e('0x10'));var authService=require(_0x328e('0x11'));var qs=require(_0x328e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x328e('0x13'));var logger=require(_0x328e('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x328e('0x15'));var licenseUtil=require(_0x328e('0x16'));var db=require('../../mysqldb')['db'];var extensions=require(_0x328e('0x17'));function respondWithStatusCode(_0x579a0b,_0x91fefd){_0x91fefd=_0x91fefd||0xcc;return function(_0x51445c){if(_0x51445c){return _0x579a0b[_0x328e('0x18')](_0x91fefd);}return _0x579a0b[_0x328e('0x19')](_0x91fefd)[_0x328e('0x1a')]();};}function respondWithResult(_0x5a87ad,_0x4d0fa0){_0x4d0fa0=_0x4d0fa0||0xc8;return function(_0x10b895){if(_0x10b895){return _0x5a87ad[_0x328e('0x19')](_0x4d0fa0)['json'](_0x10b895);}};}function respondWithFilteredResult(_0x94b2ab,_0x582fe8){return function(_0x1657b4){if(_0x1657b4){var _0x312826=typeof _0x582fe8['offset']==='undefined'&&typeof _0x582fe8['limit']===_0x328e('0x1b');var _0x4e8523=_0x1657b4[_0x328e('0x1c')];var _0x304002=_0x312826?0x0:_0x582fe8[_0x328e('0x1d')];var _0x132309=_0x312826?_0x1657b4[_0x328e('0x1c')]:_0x582fe8[_0x328e('0x1d')]+_0x582fe8[_0x328e('0x1e')];var _0x32b587;if(_0x132309>=_0x4e8523){_0x132309=_0x4e8523;_0x32b587=0xc8;}else{_0x32b587=0xce;}_0x94b2ab[_0x328e('0x19')](_0x32b587);return _0x94b2ab[_0x328e('0x1f')](_0x328e('0x20'),_0x304002+'-'+_0x132309+'/'+_0x4e8523)[_0x328e('0x21')](_0x1657b4);}return null;};}function patchUpdates(_0x571035){return function(_0x33cd87){try{jsonpatch[_0x328e('0x22')](_0x33cd87,_0x571035,!![]);}catch(_0x1fe7bd){return BPromise[_0x328e('0x23')](_0x1fe7bd);}return _0x33cd87[_0x328e('0x24')]();};}function saveUpdates(_0x186756,_0x46d929){return function(_0x41f9af){if(_0x41f9af){return _0x41f9af[_0x328e('0x25')](_0x186756)[_0x328e('0x26')](function(_0x3fe35b){return _0x3fe35b;});}return null;};}function removeEntity(_0x34ce7a,_0x2addd7){return function(_0x43248b){if(_0x43248b){return _0x43248b[_0x328e('0x27')]()[_0x328e('0x26')](function(){var _0x972303=_0x43248b[_0x328e('0x28')]({'plain':!![]});var _0xaef84f=_0x328e('0x29');return db[_0x328e('0x2a')][_0x328e('0x27')]({'where':{'type':_0xaef84f,'resourceId':_0x972303['id']}})[_0x328e('0x26')](function(){return _0x43248b;});})[_0x328e('0x26')](function(){_0x34ce7a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf62bfb,_0x370355){return function(_0x53f307){if(!_0x53f307){_0xf62bfb[_0x328e('0x18')](0x194);}return _0x53f307;};}function handleError(_0x559c4d,_0x561fc1){_0x561fc1=_0x561fc1||0x1f4;return function(_0x170e3b){logger[_0x328e('0x2b')](_0x170e3b['stack']);if(_0x170e3b[_0x328e('0x2c')]){delete _0x170e3b[_0x328e('0x2c')];}_0x559c4d[_0x328e('0x19')](_0x561fc1)[_0x328e('0x2d')](_0x170e3b);};}exports[_0x328e('0x2e')]=function(_0x4f0eb7,_0x33a558){var _0x1c4594={},_0x13c4b4={},_0xa47c41={'count':0x0,'rows':[]};var _0x2dcd08=_[_0x328e('0x2f')](db[_0x328e('0x30')][_0x328e('0x31')],function(_0x3a8085){return{'name':_0x3a8085[_0x328e('0x32')],'type':_0x3a8085[_0x328e('0x33')]['key']};});_0x13c4b4[_0x328e('0x34')]=_['map'](_0x2dcd08,_0x328e('0x2c'));_0x13c4b4[_0x328e('0x35')]=_['keys'](_0x4f0eb7[_0x328e('0x35')]);_0x13c4b4['filters']=_[_0x328e('0x36')](_0x13c4b4[_0x328e('0x34')],_0x13c4b4[_0x328e('0x35')]);_0x1c4594[_0x328e('0x37')]=_[_0x328e('0x36')](_0x13c4b4[_0x328e('0x34')],qs[_0x328e('0x38')](_0x4f0eb7['query'][_0x328e('0x38')]));_0x1c4594[_0x328e('0x37')]=_0x1c4594[_0x328e('0x37')][_0x328e('0x39')]?_0x1c4594['attributes']:_0x13c4b4['model'];if(!_0x4f0eb7[_0x328e('0x35')][_0x328e('0x3a')](_0x328e('0x3b'))){_0x1c4594[_0x328e('0x1e')]=qs['limit'](_0x4f0eb7[_0x328e('0x35')][_0x328e('0x1e')]);_0x1c4594[_0x328e('0x1d')]=qs[_0x328e('0x1d')](_0x4f0eb7[_0x328e('0x35')]['offset']);}_0x1c4594[_0x328e('0x3c')]=qs[_0x328e('0x3d')](_0x4f0eb7[_0x328e('0x35')]['sort']);_0x1c4594['where']=qs['filters'](_[_0x328e('0x3e')](_0x4f0eb7['query'],_0x13c4b4[_0x328e('0x3f')]),_0x2dcd08);if(_0x4f0eb7[_0x328e('0x35')][_0x328e('0x40')]){_0x1c4594['where']=_[_0x328e('0x41')](_0x1c4594[_0x328e('0x42')],{'$or':_['map'](_0x2dcd08,function(_0x2e2730){if(_0x2e2730[_0x328e('0x33')]!==_0x328e('0x43')){var _0x58d1dd={};_0x58d1dd[_0x2e2730[_0x328e('0x2c')]]={'$like':'%'+_0x4f0eb7[_0x328e('0x35')]['filter']+'%'};return _0x58d1dd;}})});}_0x1c4594=_[_0x328e('0x41')]({},_0x1c4594,_0x4f0eb7[_0x328e('0x44')]);var _0x4ea231={'where':_0x1c4594[_0x328e('0x42')]};return db[_0x328e('0x30')][_0x328e('0x1c')](_0x4ea231)['then'](function(_0x59587b){_0xa47c41['count']=_0x59587b;if(_0x4f0eb7[_0x328e('0x35')][_0x328e('0x45')]){_0x1c4594['include']=[{'all':!![]}];}return db[_0x328e('0x30')][_0x328e('0x46')](_0x1c4594);})[_0x328e('0x26')](function(_0x48aca5){_0xa47c41['rows']=_0x48aca5;return _0xa47c41;})[_0x328e('0x26')](respondWithFilteredResult(_0x33a558,_0x1c4594))[_0x328e('0x47')](handleError(_0x33a558,null));};exports[_0x328e('0x48')]=function(_0x150f36,_0x1548f3){var _0x4f45ca={'raw':!![],'where':{'id':_0x150f36[_0x328e('0x49')]['id']}},_0x5edf13={};_0x5edf13[_0x328e('0x34')]=_[_0x328e('0x4a')](db[_0x328e('0x30')][_0x328e('0x31')]);_0x5edf13[_0x328e('0x35')]=_['keys'](_0x150f36['query']);_0x5edf13[_0x328e('0x3f')]=_[_0x328e('0x36')](_0x5edf13['model'],_0x5edf13[_0x328e('0x35')]);_0x4f45ca['attributes']=_[_0x328e('0x36')](_0x5edf13[_0x328e('0x34')],qs[_0x328e('0x38')](_0x150f36[_0x328e('0x35')][_0x328e('0x38')]));_0x4f45ca[_0x328e('0x37')]=_0x4f45ca[_0x328e('0x37')][_0x328e('0x39')]?_0x4f45ca[_0x328e('0x37')]:_0x5edf13[_0x328e('0x34')];if(_0x150f36['query'][_0x328e('0x45')]){_0x4f45ca[_0x328e('0x4b')]=[{'all':!![]}];}_0x4f45ca=_['merge']({},_0x4f45ca,_0x150f36['options']);return db['Interval'][_0x328e('0x4c')](_0x4f45ca)['then'](handleEntityNotFound(_0x1548f3,null))[_0x328e('0x26')](respondWithResult(_0x1548f3,null))[_0x328e('0x47')](handleError(_0x1548f3,null));};exports['create']=function(_0x18c52a,_0x400e72){return db['Interval'][_0x328e('0x4d')](_0x18c52a['body'],{})[_0x328e('0x26')](function(_0x5e5d04){var _0x6c175f=_0x18c52a[_0x328e('0x4e')]['get']({'plain':!![]});if(!_0x6c175f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6c175f[_0x328e('0x4f')]===_0x328e('0x4e')){var _0x59f358=_0x5e5d04[_0x328e('0x28')]({'plain':!![]});var _0x28798b='Intervals';return db['UserProfileSection']['find']({'where':{'name':_0x28798b,'userProfileId':_0x6c175f['userProfileId']},'raw':!![]})['then'](function(_0x3d9dbf){if(_0x3d9dbf&&_0x3d9dbf[_0x328e('0x50')]===0x0){return db['UserProfileResource'][_0x328e('0x4d')]({'name':_0x59f358[_0x328e('0x2c')],'resourceId':_0x59f358['id'],'type':_0x3d9dbf[_0x328e('0x2c')],'sectionId':_0x3d9dbf['id']},{})['then'](function(){return _0x5e5d04;});}else{return _0x5e5d04;}})[_0x328e('0x47')](function(_0x19ffa7){logger[_0x328e('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19ffa7);throw _0x19ffa7;});}return _0x5e5d04;})[_0x328e('0x26')](respondWithResult(_0x400e72,0xc9))['catch'](handleError(_0x400e72,null));};exports[_0x328e('0x25')]=function(_0x4b84ea,_0xcfed88){if(_0x4b84ea['body']['id']){delete _0x4b84ea[_0x328e('0x51')]['id'];}return db[_0x328e('0x30')]['find']({'where':{'id':_0x4b84ea['params']['id']}})[_0x328e('0x26')](handleEntityNotFound(_0xcfed88,null))['then'](saveUpdates(_0x4b84ea[_0x328e('0x51')],null))[_0x328e('0x26')](respondWithResult(_0xcfed88,null))[_0x328e('0x47')](handleError(_0xcfed88,null));};exports['destroy']=function(_0x49d569,_0x2738cd){return db[_0x328e('0x30')][_0x328e('0x4c')]({'where':{'id':_0x49d569['params']['id']}})['then'](handleEntityNotFound(_0x2738cd,null))[_0x328e('0x26')](removeEntity(_0x2738cd,null))[_0x328e('0x47')](handleError(_0x2738cd,null));};exports[_0x328e('0x52')]=function(_0x31604f,_0x9b9017,_0x9cb601){if(_0x31604f[_0x328e('0x51')]['id']){delete _0x31604f[_0x328e('0x51')]['id'];}return db[_0x328e('0x30')][_0x328e('0x4c')]({'where':{'id':_0x31604f[_0x328e('0x49')]['id']}})[_0x328e('0x26')](handleEntityNotFound(_0x9b9017,null))[_0x328e('0x26')](function(_0x436204){if(_0x436204){_0x31604f[_0x328e('0x51')][_0x328e('0x53')]=_0x436204['id'];return db[_0x328e('0x30')][_0x328e('0x4d')](_0x31604f[_0x328e('0x51')]);}})[_0x328e('0x26')](respondWithResult(_0x9b9017,null))[_0x328e('0x47')](handleError(_0x9b9017,null));};exports[_0x328e('0x54')]=function(_0x38945e,_0x4f47c8,_0x149b6e){var _0x425ee1={};var _0x26ada2={};var _0x118bd8;var _0xa3034b;return db['Interval'][_0x328e('0x55')]({'where':{'id':_0x38945e[_0x328e('0x49')]['id']}})[_0x328e('0x26')](handleEntityNotFound(_0x4f47c8,null))['then'](function(_0x5dc67e){if(_0x5dc67e){_0x118bd8=_0x5dc67e;_0x26ada2[_0x328e('0x34')]=_[_0x328e('0x4a')](db['Interval'][_0x328e('0x31')]);_0x26ada2['query']=_['keys'](_0x38945e['query']);_0x26ada2[_0x328e('0x3f')]=_['intersection'](_0x26ada2[_0x328e('0x34')],_0x26ada2[_0x328e('0x35')]);_0x425ee1['attributes']=_['intersection'](_0x26ada2[_0x328e('0x34')],qs[_0x328e('0x38')](_0x38945e[_0x328e('0x35')]['fields']));_0x425ee1[_0x328e('0x37')]=_0x425ee1['attributes']['length']?_0x425ee1[_0x328e('0x37')]:_0x26ada2[_0x328e('0x34')];_0x425ee1[_0x328e('0x3c')]=qs[_0x328e('0x3d')](_0x38945e['query'][_0x328e('0x3d')]);_0x425ee1[_0x328e('0x42')]=qs[_0x328e('0x3f')](_['pick'](_0x38945e[_0x328e('0x35')],_0x26ada2[_0x328e('0x3f')]));if(_0x38945e[_0x328e('0x35')]['filter']){_0x425ee1['where']=_[_0x328e('0x41')](_0x425ee1['where'],{'$or':_[_0x328e('0x2f')](_0x425ee1['attributes'],function(_0x1e4033){var _0x2bc6ee={};_0x2bc6ee[_0x1e4033]={'$like':'%'+_0x38945e[_0x328e('0x35')][_0x328e('0x40')]+'%'};return _0x2bc6ee;})});}_0x425ee1=_[_0x328e('0x41')]({},_0x425ee1,_0x38945e[_0x328e('0x44')]);return _0x118bd8[_0x328e('0x54')](_0x425ee1);}})[_0x328e('0x26')](function(_0x1a1bbd){if(_0x1a1bbd){_0xa3034b=_0x1a1bbd[_0x328e('0x39')];if(!_0x38945e[_0x328e('0x35')]['hasOwnProperty'](_0x328e('0x3b'))){_0x425ee1[_0x328e('0x1e')]=qs[_0x328e('0x1e')](_0x38945e['query'][_0x328e('0x1e')]);_0x425ee1[_0x328e('0x1d')]=qs[_0x328e('0x1d')](_0x38945e[_0x328e('0x35')]['offset']);}return _0x118bd8[_0x328e('0x54')](_0x425ee1);}})[_0x328e('0x26')](function(_0x3b918f){if(_0x3b918f){return _0x3b918f?{'count':_0xa3034b,'rows':_0x3b918f}:null;}})[_0x328e('0x26')](respondWithResult(_0x4f47c8,null))[_0x328e('0x47')](handleError(_0x4f47c8,null));};exports[_0x328e('0x56')]=function(_0x102ce5,_0xec50f0,_0x5cfc6c){return db['Interval'][_0x328e('0x55')]({'where':{'id':_0x102ce5[_0x328e('0x49')]['id']}})[_0x328e('0x26')](handleEntityNotFound(_0xec50f0,null))['then'](function(_0x35c8a7){if(_0x35c8a7){return db[_0x328e('0x57')]['transaction'](function(_0x454249){return db[_0x328e('0x30')][_0x328e('0x27')]({'where':{'IntervalId':_0x102ce5['params']['id']},'transaction':_0x454249})[_0x328e('0x26')](function(_0x398cc6){var _0x33daee=_[_0x328e('0x2f')](_0x102ce5[_0x328e('0x51')],function(_0xf505e7){delete _0xf505e7['id'];_0xf505e7[_0x328e('0x53')]=_0x102ce5[_0x328e('0x49')]['id'];return _0xf505e7;});return db['Interval'][_0x328e('0x58')](_0x33daee,{'transaction':_0x454249});});})['then'](function(){return db[_0x328e('0x30')][_0x328e('0x46')]({'where':{'IntervalId':_0x102ce5[_0x328e('0x49')]['id']}});});}})['then'](respondWithResult(_0xec50f0,null))[_0x328e('0x47')](handleError(_0xec50f0,null));}; \ No newline at end of file +var _0x97fe=['undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','Intervals','sendStatus','error','stack','name','index','Interval','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','getIntervals','findOne','addIntervals','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset'];(function(_0xb21e1c,_0x484c17){var _0x480c6d=function(_0x2829b7){while(--_0x2829b7){_0xb21e1c['push'](_0xb21e1c['shift']());}};_0x480c6d(++_0x484c17);}(_0x97fe,0x14f));var _0xe97f=function(_0x554505,_0x2522c6){_0x554505=_0x554505-0x0;var _0x1989ab=_0x97fe[_0x554505];return _0x1989ab;};'use strict';var emlformat=require(_0xe97f('0x0'));var rimraf=require(_0xe97f('0x1'));var zipdir=require(_0xe97f('0x2'));var jsonpatch=require(_0xe97f('0x3'));var rp=require(_0xe97f('0x4'));var moment=require(_0xe97f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe97f('0x6'));var csv=require(_0xe97f('0x7'));var ejs=require(_0xe97f('0x8'));var fs=require('fs');var fs_extra=require(_0xe97f('0x9'));var _=require(_0xe97f('0xa'));var squel=require('squel');var crypto=require(_0xe97f('0xb'));var jsforce=require(_0xe97f('0xc'));var deskjs=require(_0xe97f('0xd'));var toCsv=require(_0xe97f('0x7'));var querystring=require(_0xe97f('0xe'));var Papa=require(_0xe97f('0xf'));var Redis=require('ioredis');var authService=require(_0xe97f('0x10'));var qs=require(_0xe97f('0x11'));var as=require(_0xe97f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe97f('0x13'))(_0xe97f('0x14'));var utils=require('../../config/utils');var config=require(_0xe97f('0x15'));var licenseUtil=require(_0xe97f('0x16'));var db=require(_0xe97f('0x17'))['db'];var extensions=require(_0xe97f('0x18'));function respondWithStatusCode(_0x58d1c7,_0x545802){_0x545802=_0x545802||0xcc;return function(_0x59c372){if(_0x59c372){return _0x58d1c7['sendStatus'](_0x545802);}return _0x58d1c7[_0xe97f('0x19')](_0x545802)[_0xe97f('0x1a')]();};}function respondWithResult(_0x22465d,_0x92bf4a){_0x92bf4a=_0x92bf4a||0xc8;return function(_0x53615c){if(_0x53615c){return _0x22465d[_0xe97f('0x19')](_0x92bf4a)[_0xe97f('0x1b')](_0x53615c);}};}function respondWithFilteredResult(_0x5b3c61,_0x41d84f){return function(_0x566729){if(_0x566729){var _0x677794=typeof _0x41d84f[_0xe97f('0x1c')]===_0xe97f('0x1d')&&typeof _0x41d84f[_0xe97f('0x1e')]===_0xe97f('0x1d');var _0x49557e=_0x566729[_0xe97f('0x1f')];var _0x3b9c7b=_0x677794?0x0:_0x41d84f[_0xe97f('0x1c')];var _0x40d9f6=_0x677794?_0x566729['count']:_0x41d84f[_0xe97f('0x1c')]+_0x41d84f[_0xe97f('0x1e')];var _0x319255;if(_0x40d9f6>=_0x49557e){_0x40d9f6=_0x49557e;_0x319255=0xc8;}else{_0x319255=0xce;}_0x5b3c61[_0xe97f('0x19')](_0x319255);return _0x5b3c61[_0xe97f('0x20')](_0xe97f('0x21'),_0x3b9c7b+'-'+_0x40d9f6+'/'+_0x49557e)[_0xe97f('0x1b')](_0x566729);}return null;};}function patchUpdates(_0x32cd06){return function(_0x5f21e1){try{jsonpatch[_0xe97f('0x22')](_0x5f21e1,_0x32cd06,!![]);}catch(_0x14a89b){return BPromise['reject'](_0x14a89b);}return _0x5f21e1[_0xe97f('0x23')]();};}function saveUpdates(_0x191866,_0x3be13c){return function(_0x1476eb){if(_0x1476eb){return _0x1476eb[_0xe97f('0x24')](_0x191866)[_0xe97f('0x25')](function(_0x440b44){return _0x440b44;});}return null;};}function removeEntity(_0x1efb42,_0x21bde4){return function(_0x3de3c9){if(_0x3de3c9){return _0x3de3c9[_0xe97f('0x26')]()[_0xe97f('0x25')](function(){var _0x1cc1af=_0x3de3c9['get']({'plain':!![]});var _0x579af8=_0xe97f('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x579af8,'resourceId':_0x1cc1af['id']}})[_0xe97f('0x25')](function(){return _0x3de3c9;});})[_0xe97f('0x25')](function(){_0x1efb42[_0xe97f('0x19')](0xcc)[_0xe97f('0x1a')]();});}};}function handleEntityNotFound(_0x4a0ecf,_0x54fb2f){return function(_0xa425b0){if(!_0xa425b0){_0x4a0ecf[_0xe97f('0x28')](0x194);}return _0xa425b0;};}function handleError(_0x383312,_0x314b78){_0x314b78=_0x314b78||0x1f4;return function(_0x4e55d1){logger[_0xe97f('0x29')](_0x4e55d1[_0xe97f('0x2a')]);if(_0x4e55d1['name']){delete _0x4e55d1[_0xe97f('0x2b')];}_0x383312[_0xe97f('0x19')](_0x314b78)['send'](_0x4e55d1);};}exports[_0xe97f('0x2c')]=function(_0x33eb00,_0x2ec717){var _0x544025={},_0x94c10c={},_0x3d9e09={'count':0x0,'rows':[]};var _0x43610e=_['map'](db[_0xe97f('0x2d')][_0xe97f('0x2e')],function(_0x418367){return{'name':_0x418367[_0xe97f('0x2f')],'type':_0x418367['type'][_0xe97f('0x30')]};});_0x94c10c[_0xe97f('0x31')]=_[_0xe97f('0x32')](_0x43610e,_0xe97f('0x2b'));_0x94c10c['query']=_[_0xe97f('0x33')](_0x33eb00[_0xe97f('0x34')]);_0x94c10c[_0xe97f('0x35')]=_['intersection'](_0x94c10c['model'],_0x94c10c['query']);_0x544025[_0xe97f('0x36')]=_[_0xe97f('0x37')](_0x94c10c[_0xe97f('0x31')],qs[_0xe97f('0x38')](_0x33eb00[_0xe97f('0x34')]['fields']));_0x544025[_0xe97f('0x36')]=_0x544025[_0xe97f('0x36')][_0xe97f('0x39')]?_0x544025[_0xe97f('0x36')]:_0x94c10c[_0xe97f('0x31')];if(!_0x33eb00['query'][_0xe97f('0x3a')](_0xe97f('0x3b'))){_0x544025[_0xe97f('0x1e')]=qs['limit'](_0x33eb00[_0xe97f('0x34')][_0xe97f('0x1e')]);_0x544025[_0xe97f('0x1c')]=qs[_0xe97f('0x1c')](_0x33eb00[_0xe97f('0x34')][_0xe97f('0x1c')]);}_0x544025[_0xe97f('0x3c')]=qs[_0xe97f('0x3d')](_0x33eb00['query'][_0xe97f('0x3d')]);_0x544025[_0xe97f('0x3e')]=qs[_0xe97f('0x35')](_['pick'](_0x33eb00[_0xe97f('0x34')],_0x94c10c['filters']),_0x43610e);if(_0x33eb00[_0xe97f('0x34')][_0xe97f('0x3f')]){_0x544025[_0xe97f('0x3e')]=_[_0xe97f('0x40')](_0x544025[_0xe97f('0x3e')],{'$or':_[_0xe97f('0x32')](_0x43610e,function(_0x57c417){if(_0x57c417[_0xe97f('0x41')]!==_0xe97f('0x42')){var _0x419515={};_0x419515[_0x57c417[_0xe97f('0x2b')]]={'$like':'%'+_0x33eb00[_0xe97f('0x34')][_0xe97f('0x3f')]+'%'};return _0x419515;}})});}_0x544025=_[_0xe97f('0x40')]({},_0x544025,_0x33eb00[_0xe97f('0x43')]);var _0x29b184={'where':_0x544025['where']};return db['Interval'][_0xe97f('0x1f')](_0x29b184)[_0xe97f('0x25')](function(_0x154c5c){_0x3d9e09[_0xe97f('0x1f')]=_0x154c5c;if(_0x33eb00[_0xe97f('0x34')][_0xe97f('0x44')]){_0x544025[_0xe97f('0x45')]=[{'all':!![]}];}return db[_0xe97f('0x2d')][_0xe97f('0x46')](_0x544025);})[_0xe97f('0x25')](function(_0x72342d){_0x3d9e09[_0xe97f('0x47')]=_0x72342d;return _0x3d9e09;})['then'](respondWithFilteredResult(_0x2ec717,_0x544025))[_0xe97f('0x48')](handleError(_0x2ec717,null));};exports[_0xe97f('0x49')]=function(_0x3c1429,_0x3d17f6){var _0xe058cf={'raw':!![],'where':{'id':_0x3c1429[_0xe97f('0x4a')]['id']}},_0x598bd2={};_0x598bd2[_0xe97f('0x31')]=_['keys'](db['Interval'][_0xe97f('0x2e')]);_0x598bd2[_0xe97f('0x34')]=_[_0xe97f('0x33')](_0x3c1429[_0xe97f('0x34')]);_0x598bd2['filters']=_[_0xe97f('0x37')](_0x598bd2['model'],_0x598bd2[_0xe97f('0x34')]);_0xe058cf[_0xe97f('0x36')]=_[_0xe97f('0x37')](_0x598bd2['model'],qs[_0xe97f('0x38')](_0x3c1429[_0xe97f('0x34')][_0xe97f('0x38')]));_0xe058cf[_0xe97f('0x36')]=_0xe058cf[_0xe97f('0x36')]['length']?_0xe058cf['attributes']:_0x598bd2[_0xe97f('0x31')];if(_0x3c1429['query']['includeAll']){_0xe058cf[_0xe97f('0x45')]=[{'all':!![]}];}_0xe058cf=_[_0xe97f('0x40')]({},_0xe058cf,_0x3c1429[_0xe97f('0x43')]);return db[_0xe97f('0x2d')][_0xe97f('0x4b')](_0xe058cf)['then'](handleEntityNotFound(_0x3d17f6,null))['then'](respondWithResult(_0x3d17f6,null))['catch'](handleError(_0x3d17f6,null));};exports[_0xe97f('0x4c')]=function(_0x5b74a9,_0x5754dc){return db[_0xe97f('0x2d')][_0xe97f('0x4c')](_0x5b74a9['body'],{})[_0xe97f('0x25')](function(_0x1fb8c0){var _0x3e9f28=_0x5b74a9[_0xe97f('0x4d')][_0xe97f('0x4e')]({'plain':!![]});if(!_0x3e9f28)throw new Error(_0xe97f('0x4f'));if(_0x3e9f28[_0xe97f('0x50')]===_0xe97f('0x4d')){var _0x293f1d=_0x1fb8c0['get']({'plain':!![]});var _0x6c47bc=_0xe97f('0x27');return db['UserProfileSection'][_0xe97f('0x4b')]({'where':{'name':_0x6c47bc,'userProfileId':_0x3e9f28['userProfileId']},'raw':!![]})[_0xe97f('0x25')](function(_0x52c999){if(_0x52c999&&_0x52c999[_0xe97f('0x51')]===0x0){return db[_0xe97f('0x52')][_0xe97f('0x4c')]({'name':_0x293f1d[_0xe97f('0x2b')],'resourceId':_0x293f1d['id'],'type':_0x52c999[_0xe97f('0x2b')],'sectionId':_0x52c999['id']},{})[_0xe97f('0x25')](function(){return _0x1fb8c0;});}else{return _0x1fb8c0;}})['catch'](function(_0x8ef71b){logger[_0xe97f('0x29')](_0xe97f('0x53'),_0x8ef71b);throw _0x8ef71b;});}return _0x1fb8c0;})[_0xe97f('0x25')](respondWithResult(_0x5754dc,0xc9))[_0xe97f('0x48')](handleError(_0x5754dc,null));};exports[_0xe97f('0x24')]=function(_0x209735,_0x5e1f65){if(_0x209735[_0xe97f('0x54')]['id']){delete _0x209735['body']['id'];}return db[_0xe97f('0x2d')][_0xe97f('0x4b')]({'where':{'id':_0x209735[_0xe97f('0x4a')]['id']}})[_0xe97f('0x25')](handleEntityNotFound(_0x5e1f65,null))[_0xe97f('0x25')](saveUpdates(_0x209735[_0xe97f('0x54')],null))[_0xe97f('0x25')](respondWithResult(_0x5e1f65,null))[_0xe97f('0x48')](handleError(_0x5e1f65,null));};exports[_0xe97f('0x26')]=function(_0x4e9074,_0x3e60c7){return db[_0xe97f('0x2d')]['find']({'where':{'id':_0x4e9074[_0xe97f('0x4a')]['id']}})[_0xe97f('0x25')](handleEntityNotFound(_0x3e60c7,null))['then'](removeEntity(_0x3e60c7,null))['catch'](handleError(_0x3e60c7,null));};exports[_0xe97f('0x55')]=function(_0x2dd8cf,_0x35eb69,_0x42e4a2){if(_0x2dd8cf[_0xe97f('0x54')]['id']){delete _0x2dd8cf[_0xe97f('0x54')]['id'];}return db[_0xe97f('0x2d')][_0xe97f('0x4b')]({'where':{'id':_0x2dd8cf[_0xe97f('0x4a')]['id']}})[_0xe97f('0x25')](handleEntityNotFound(_0x35eb69,null))[_0xe97f('0x25')](function(_0x88153a){if(_0x88153a){_0x2dd8cf['body'][_0xe97f('0x56')]=_0x88153a['id'];return db[_0xe97f('0x2d')][_0xe97f('0x4c')](_0x2dd8cf[_0xe97f('0x54')]);}})[_0xe97f('0x25')](respondWithResult(_0x35eb69,null))[_0xe97f('0x48')](handleError(_0x35eb69,null));};exports[_0xe97f('0x57')]=function(_0x3305dd,_0x3dbc5f,_0x44a204){var _0x2ba524={};var _0x2ffa4b={};var _0x14e9e3;var _0x41eabb;return db['Interval'][_0xe97f('0x58')]({'where':{'id':_0x3305dd[_0xe97f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3dbc5f,null))[_0xe97f('0x25')](function(_0x1d753d){if(_0x1d753d){_0x14e9e3=_0x1d753d;_0x2ffa4b[_0xe97f('0x31')]=_[_0xe97f('0x33')](db['Interval'][_0xe97f('0x2e')]);_0x2ffa4b['query']=_[_0xe97f('0x33')](_0x3305dd[_0xe97f('0x34')]);_0x2ffa4b[_0xe97f('0x35')]=_['intersection'](_0x2ffa4b['model'],_0x2ffa4b[_0xe97f('0x34')]);_0x2ba524[_0xe97f('0x36')]=_[_0xe97f('0x37')](_0x2ffa4b['model'],qs[_0xe97f('0x38')](_0x3305dd[_0xe97f('0x34')][_0xe97f('0x38')]));_0x2ba524['attributes']=_0x2ba524[_0xe97f('0x36')]['length']?_0x2ba524[_0xe97f('0x36')]:_0x2ffa4b['model'];_0x2ba524[_0xe97f('0x3c')]=qs['sort'](_0x3305dd[_0xe97f('0x34')][_0xe97f('0x3d')]);_0x2ba524[_0xe97f('0x3e')]=qs['filters'](_['pick'](_0x3305dd[_0xe97f('0x34')],_0x2ffa4b[_0xe97f('0x35')]));if(_0x3305dd['query'][_0xe97f('0x3f')]){_0x2ba524[_0xe97f('0x3e')]=_[_0xe97f('0x40')](_0x2ba524[_0xe97f('0x3e')],{'$or':_['map'](_0x2ba524[_0xe97f('0x36')],function(_0x5f0b65){var _0xde4ade={};_0xde4ade[_0x5f0b65]={'$like':'%'+_0x3305dd['query'][_0xe97f('0x3f')]+'%'};return _0xde4ade;})});}_0x2ba524=_['merge']({},_0x2ba524,_0x3305dd[_0xe97f('0x43')]);return _0x14e9e3[_0xe97f('0x57')](_0x2ba524);}})['then'](function(_0x2507e0){if(_0x2507e0){_0x41eabb=_0x2507e0[_0xe97f('0x39')];if(!_0x3305dd[_0xe97f('0x34')][_0xe97f('0x3a')](_0xe97f('0x3b'))){_0x2ba524[_0xe97f('0x1e')]=qs[_0xe97f('0x1e')](_0x3305dd[_0xe97f('0x34')]['limit']);_0x2ba524[_0xe97f('0x1c')]=qs['offset'](_0x3305dd[_0xe97f('0x34')][_0xe97f('0x1c')]);}return _0x14e9e3[_0xe97f('0x57')](_0x2ba524);}})[_0xe97f('0x25')](function(_0x42a6c){if(_0x42a6c){return _0x42a6c?{'count':_0x41eabb,'rows':_0x42a6c}:null;}})[_0xe97f('0x25')](respondWithResult(_0x3dbc5f,null))[_0xe97f('0x48')](handleError(_0x3dbc5f,null));};exports[_0xe97f('0x59')]=function(_0x4ab4fe,_0x5a1b1c,_0x3a566c){return db[_0xe97f('0x2d')][_0xe97f('0x58')]({'where':{'id':_0x4ab4fe['params']['id']}})[_0xe97f('0x25')](handleEntityNotFound(_0x5a1b1c,null))[_0xe97f('0x25')](function(_0xa4c7a8){if(_0xa4c7a8){return db['sequelize'][_0xe97f('0x5a')](function(_0x354e8d){return db['Interval'][_0xe97f('0x26')]({'where':{'IntervalId':_0x4ab4fe['params']['id']},'transaction':_0x354e8d})[_0xe97f('0x25')](function(_0x3708dc){var _0xe66c98=_[_0xe97f('0x32')](_0x4ab4fe[_0xe97f('0x54')],function(_0x3c1e43){delete _0x3c1e43['id'];_0x3c1e43[_0xe97f('0x56')]=_0x4ab4fe[_0xe97f('0x4a')]['id'];return _0x3c1e43;});return db[_0xe97f('0x2d')]['bulkCreate'](_0xe66c98,{'transaction':_0x354e8d});});})[_0xe97f('0x25')](function(){return db[_0xe97f('0x2d')]['findAll']({'where':{'IntervalId':_0x4ab4fe[_0xe97f('0x4a')]['id']}});});}})['then'](respondWithResult(_0x5a1b1c,null))[_0xe97f('0x48')](handleError(_0x5a1b1c,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index c648219..e8f9215 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 _0x9f34=['api','moment','request-promise','../../config/environment','./interval.attributes','exports','Interval','tools_intervals','rewrite','lodash','util'];(function(_0xc1a4cf,_0x17141b){var _0x2930d1=function(_0x2e6e7a){while(--_0x2e6e7a){_0xc1a4cf['push'](_0xc1a4cf['shift']());}};_0x2930d1(++_0x17141b);}(_0x9f34,0x1c1));var _0x49f3=function(_0x11890b,_0x14fc9c){_0x11890b=_0x11890b-0x0;var _0xa6f05a=_0x9f34[_0x11890b];return _0xa6f05a;};'use strict';var _=require(_0x49f3('0x0'));var util=require(_0x49f3('0x1'));var logger=require('../../config/logger')(_0x49f3('0x2'));var moment=require(_0x49f3('0x3'));var BPromise=require('bluebird');var rp=require(_0x49f3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x49f3('0x5'));var attributes=require(_0x49f3('0x6'));var extensions=require('../../components/extensions/rewrite');module[_0x49f3('0x7')]=function(_0x23e729,_0x4a6182){return _0x23e729['define'](_0x49f3('0x8'),attributes,{'tableName':_0x49f3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x52a9e0,_0x5b129b){extensions[_0x49f3('0xa')](_0x23e729,_0x52a9e0);},'afterBulkCreate':function(_0x40d1d8,_0x11baa6,_0x11fc44){_0x11fc44();extensions['rewrite'](_0x23e729,_0x40d1d8[0x0]);},'afterUpdate':function(_0x5c250f,_0x3d7429){extensions[_0x49f3('0xa')](_0x23e729,_0x5c250f);},'afterDestroy':function(_0x2f07e2,_0x60327b){extensions[_0x49f3('0xa')](_0x23e729,_0x2f07e2);}}});}; \ No newline at end of file +var _0x4ed1=['./interval.attributes','../../components/extensions/rewrite','Interval','tools_intervals','rewrite','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x4ed1,0x18b));var _0x14ed=function(_0x205b54,_0x2d1f95){_0x205b54=_0x205b54-0x0;var _0x5b3916=_0x4ed1[_0x205b54];return _0x5b3916;};'use strict';var _=require(_0x14ed('0x0'));var util=require(_0x14ed('0x1'));var logger=require('../../config/logger')(_0x14ed('0x2'));var moment=require(_0x14ed('0x3'));var BPromise=require(_0x14ed('0x4'));var rp=require(_0x14ed('0x5'));var fs=require('fs');var path=require(_0x14ed('0x6'));var rimraf=require('rimraf');var config=require(_0x14ed('0x7'));var attributes=require(_0x14ed('0x8'));var extensions=require(_0x14ed('0x9'));module['exports']=function(_0xf38558,_0x465372){return _0xf38558['define'](_0x14ed('0xa'),attributes,{'tableName':_0x14ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3dab73,_0x29e0b3){extensions[_0x14ed('0xc')](_0xf38558,_0x3dab73);},'afterBulkCreate':function(_0x49fa43,_0x27c62f,_0x40ee7e){_0x40ee7e();extensions[_0x14ed('0xc')](_0xf38558,_0x49fa43[0x0]);},'afterUpdate':function(_0x27f8c4,_0x2cfe6f){extensions['rewrite'](_0xf38558,_0x27f8c4);},'afterDestroy':function(_0x36f555,_0x40b738){extensions[_0x14ed('0xc')](_0xf38558,_0x36f555);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 7cd850e..1215c2e 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index ba5f037..279d5de 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(_0x4956d1,_0x153757){var _0x5b932f=function(_0x2d38fd){while(--_0x2d38fd){_0x4956d1['push'](_0x4956d1['shift']());}};_0x5b932f(++_0x153757);}(_0xadb5,0xad));var _0x5adb=function(_0x207fc6,_0x928233){_0x207fc6=_0x207fc6-0x0;var _0x4ec78b=_0xadb5[_0x207fc6];return _0x4ec78b;};'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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('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 6d74bae..03681d0 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 _0x5266=['statusCode','json','parse','error','write','openIssue','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','support','key','MOTGUI','summary','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','request','setEncoding','data','end','status'];(function(_0x1ecd9b,_0x569516){var _0x277a88=function(_0x57e7e2){while(--_0x57e7e2){_0x1ecd9b['push'](_0x1ecd9b['shift']());}};_0x277a88(++_0x569516);}(_0x5266,0x15b));var _0x6526=function(_0x46640c,_0x4d27c5){_0x46640c=_0x46640c-0x0;var _0x32fb77=_0x5266[_0x46640c];return _0x32fb77;};'use strict';var BPromise=require(_0x6526('0x0'));var https=require(_0x6526('0x1'));var logger=require(_0x6526('0x2'))('api');var USERNAME=_0x6526('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x2d2622,_0x220145){var _0x1f3b21={'fields':{'project':{'key':_0x2d2622[_0x6526('0x4')]||_0x6526('0x5')},'summary':(_0x2d2622[_0x6526('0x6')]||'Report')+_0x6526('0x7')+_0x2d2622['ip'],'description':_0x2d2622['description']||JSON[_0x6526('0x8')](_0x2d2622),'issuetype':{'name':_0x2d2622[_0x6526('0x9')]||_0x6526('0xa')}}};_0x1f3b21[_0x6526('0xb')][_0x6526('0xc')]=_0x2d2622['email'];_0x1f3b21['fields']['customfield_11501']=_0x2d2622[_0x6526('0xd')];_0x1f3b21[_0x6526('0xb')][_0x6526('0xe')]=_0x2d2622[_0x6526('0xf')];_0x1f3b21[_0x6526('0xb')][_0x6526('0x10')]=_0x2d2622[_0x6526('0x11')];_0x1f3b21['fields'][_0x6526('0x12')]=_0x2d2622[_0x6526('0x13')];_0x1f3b21['fields'][_0x6526('0x14')]=_0x2d2622['ip'];var _0x16c52b={'host':_0x6526('0x15'),'port':0x1bb,'path':_0x6526('0x16'),'method':_0x6526('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x6526('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x6526('0x19')]('base64')}};var _0x215bce=JSON[_0x6526('0x8')](_0x1f3b21);var _0x17ee6b=https[_0x6526('0x1a')](_0x16c52b,function(_0x103c15){_0x103c15[_0x6526('0x1b')]('utf8');var _0x2180fb='';_0x103c15['on'](_0x6526('0x1c'),function(_0x2d33cb){_0x2180fb+=_0x2d33cb;});_0x103c15['on'](_0x6526('0x1d'),function(){if(_0x220145){return _0x220145[_0x6526('0x1e')](_0x103c15[_0x6526('0x1f')])[_0x6526('0x20')](JSON[_0x6526('0x21')](_0x2180fb));}});});_0x17ee6b['on'](_0x6526('0x22'),function(_0x12310a){if(_0x220145){return _0x220145[_0x6526('0x1e')](0x1f4)[_0x6526('0x20')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x17ee6b[_0x6526('0x23')](_0x215bce);_0x17ee6b['end']();}exports[_0x6526('0x24')]=openIssue;exports['send']=function(_0x521966,_0x249e01){_0x521966[_0x6526('0x25')]['ip']=_0x521966['headers'][_0x6526('0x26')]||_0x521966[_0x6526('0x27')][_0x6526('0x28')]||_0x521966['socket'][_0x6526('0x28')]||_0x521966['connection'][_0x6526('0x29')][_0x6526('0x28')];return openIssue(_0x521966[_0x6526('0x25')],_0x249e01);}; \ No newline at end of file +var _0x007f=['newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','application/json','Basic\x20','toString','base64','request','setEncoding','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','body','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','support','key','MOTGUI','summary','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x007f,0xd0));var _0xf007=function(_0x57c4ec,_0xfb1ad0){_0x57c4ec=_0x57c4ec-0x0;var _0x157f3c=_0x007f[_0x57c4ec];return _0x157f3c;};'use strict';var BPromise=require('bluebird');var https=require(_0xf007('0x0'));var logger=require(_0xf007('0x1'))(_0xf007('0x2'));var USERNAME=_0xf007('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x41a414,_0x1f9ae2){var _0x461081={'fields':{'project':{'key':_0x41a414[_0xf007('0x4')]||_0xf007('0x5')},'summary':(_0x41a414[_0xf007('0x6')]||'Report')+'\x20from\x20'+_0x41a414['ip'],'description':_0x41a414[_0xf007('0x7')]||JSON[_0xf007('0x8')](_0x41a414),'issuetype':{'name':_0x41a414[_0xf007('0x9')]||_0xf007('0xa')}}};_0x461081[_0xf007('0xb')][_0xf007('0xc')]=_0x41a414[_0xf007('0xd')];_0x461081[_0xf007('0xb')][_0xf007('0xe')]=_0x41a414[_0xf007('0xf')];_0x461081['fields'][_0xf007('0x10')]=_0x41a414[_0xf007('0x11')];_0x461081[_0xf007('0xb')][_0xf007('0x12')]=_0x41a414[_0xf007('0x13')];_0x461081['fields']['customfield_11504']=_0x41a414[_0xf007('0x14')];_0x461081[_0xf007('0xb')][_0xf007('0x15')]=_0x41a414['ip'];var _0x395b0c={'host':_0xf007('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xf007('0x17'),'Authorization':_0xf007('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xf007('0x19')](_0xf007('0x1a'))}};var _0x1c0b7f=JSON[_0xf007('0x8')](_0x461081);var _0x5428c3=https[_0xf007('0x1b')](_0x395b0c,function(_0x1cf0d7){_0x1cf0d7[_0xf007('0x1c')]('utf8');var _0x1c129c='';_0x1cf0d7['on'](_0xf007('0x1d'),function(_0xb2aba1){_0x1c129c+=_0xb2aba1;});_0x1cf0d7['on'](_0xf007('0x1e'),function(){if(_0x1f9ae2){return _0x1f9ae2[_0xf007('0x1f')](_0x1cf0d7[_0xf007('0x20')])[_0xf007('0x21')](JSON[_0xf007('0x22')](_0x1c129c));}});});_0x5428c3['on'](_0xf007('0x23'),function(_0x2f0b05){if(_0x1f9ae2){return _0x1f9ae2[_0xf007('0x1f')](0x1f4)[_0xf007('0x21')]({'errors':[{'message':_0xf007('0x24'),'type':_0xf007('0x25')}]});}});_0x5428c3[_0xf007('0x26')](_0x1c0b7f);_0x5428c3[_0xf007('0x1e')]();}exports['openIssue']=openIssue;exports[_0xf007('0x27')]=function(_0x524572,_0x27e93e){_0x524572[_0xf007('0x28')]['ip']=_0x524572['headers'][_0xf007('0x29')]||_0x524572[_0xf007('0x2a')][_0xf007('0x2b')]||_0x524572[_0xf007('0x2c')][_0xf007('0x2b')]||_0x524572[_0xf007('0x2a')]['socket']['remoteAddress'];return openIssue(_0x524572[_0xf007('0x28')],_0x27e93e);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 5873d1f..f187872 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 _0x4ea3=['multer','util','path','connect-timeout','Router','../../components/auth/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','post','update','destroy','exports'];(function(_0x58d5d4,_0x4f05a3){var _0x596a07=function(_0x34a6c6){while(--_0x34a6c6){_0x58d5d4['push'](_0x58d5d4['shift']());}};_0x596a07(++_0x4f05a3);}(_0x4ea3,0x70));var _0x34ea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4ea3[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller['describe']);router[_0x34ea('0x7')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller['show']);router[_0x34ea('0xc')]('/',auth[_0x34ea('0x8')](),controller['create']);router['put'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xd')]);router['delete'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xe')]);module[_0x34ea('0xf')]=router; \ No newline at end of file +var _0x70e0=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','describe','get','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x24be82,_0x385b17){var _0x3c78d5=function(_0x2f2c82){while(--_0x2f2c82){_0x24be82['push'](_0x24be82['shift']());}};_0x3c78d5(++_0x385b17);}(_0x70e0,0x17b));var _0x070e=function(_0x15b63d,_0x9e4f52){_0x15b63d=_0x15b63d-0x0;var _0x4f644f=_0x70e0[_0x15b63d];return _0x4f644f;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x070e('0xe')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x11')]);module[_0x070e('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 0e2d818..17b8ddc 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(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7a54,0x106));var _0x47a5=function(_0x3587e2,_0x2749a8){_0x3587e2=_0x3587e2-0x0;var _0x34b167=_0x7a54[_0x3587e2];return _0x34b167;};'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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0x559185,_0x4d3d99){_0x559185=_0x559185-0x0;var _0x4f30a2=_0x7a54[_0x559185];return _0x4f30a2;};'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 5eb42d3..de63cd0 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 _0x0a6b=['destroy','then','error','name','send','index','map','JscriptyAnswerReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','length','find','catch','create','body','params','describe','eml-format','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0x3e4e5c,_0x4d2966){var _0x46f0bf=function(_0x2d1982){while(--_0x2d1982){_0x3e4e5c['push'](_0x3e4e5c['shift']());}};_0x46f0bf(++_0x4d2966);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x288285,_0x222a9e){_0x288285=_0x288285-0x0;var _0x1d1328=_0x0a6b[_0x288285];return _0x1d1328;};'use strict';var emlformat=require(_0xb0a6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb0a6('0x1'));var moment=require('moment');var BPromise=require(_0xb0a6('0x2'));var Mustache=require(_0xb0a6('0x3'));var util=require(_0xb0a6('0x4'));var path=require('path');var sox=require(_0xb0a6('0x5'));var csv=require('to-csv');var ejs=require(_0xb0a6('0x6'));var fs=require('fs');var fs_extra=require(_0xb0a6('0x7'));var _=require('lodash');var squel=require(_0xb0a6('0x8'));var crypto=require(_0xb0a6('0x9'));var jsforce=require(_0xb0a6('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb0a6('0xb'));var Redis=require(_0xb0a6('0xc'));var authService=require(_0xb0a6('0xd'));var qs=require(_0xb0a6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0a6('0xf'));var logger=require(_0xb0a6('0x10'))('api');var utils=require(_0xb0a6('0x11'));var config=require(_0xb0a6('0x12'));var licenseUtil=require(_0xb0a6('0x13'));var db=require(_0xb0a6('0x14'))['db'];function respondWithStatusCode(_0x471d0f,_0x3e06df){_0x3e06df=_0x3e06df||0xcc;return function(_0x3d607f){if(_0x3d607f){return _0x471d0f[_0xb0a6('0x15')](_0x3e06df);}return _0x471d0f[_0xb0a6('0x16')](_0x3e06df)[_0xb0a6('0x17')]();};}function respondWithResult(_0x513853,_0x2b801a){_0x2b801a=_0x2b801a||0xc8;return function(_0x54016c){if(_0x54016c){return _0x513853[_0xb0a6('0x16')](_0x2b801a)['json'](_0x54016c);}};}function respondWithFilteredResult(_0x25582f,_0x59730e){return function(_0x1d837f){if(_0x1d837f){var _0x382c2f=typeof _0x59730e[_0xb0a6('0x18')]==='undefined'&&typeof _0x59730e['limit']===_0xb0a6('0x19');var _0x295b53=_0x1d837f[_0xb0a6('0x1a')];var _0x18f994=_0x382c2f?0x0:_0x59730e[_0xb0a6('0x18')];var _0x13a1c8=_0x382c2f?_0x1d837f['count']:_0x59730e[_0xb0a6('0x18')]+_0x59730e[_0xb0a6('0x1b')];var _0x372457;if(_0x13a1c8>=_0x295b53){_0x13a1c8=_0x295b53;_0x372457=0xc8;}else{_0x372457=0xce;}_0x25582f[_0xb0a6('0x16')](_0x372457);return _0x25582f[_0xb0a6('0x1c')](_0xb0a6('0x1d'),_0x18f994+'-'+_0x13a1c8+'/'+_0x295b53)['json'](_0x1d837f);}return null;};}function patchUpdates(_0x2fb60a){return function(_0x6d2003){try{jsonpatch[_0xb0a6('0x1e')](_0x6d2003,_0x2fb60a,!![]);}catch(_0x6bdcc1){return BPromise[_0xb0a6('0x1f')](_0x6bdcc1);}return _0x6d2003[_0xb0a6('0x20')]();};}function saveUpdates(_0x27db00,_0x16e053){return function(_0x4b9a6c){if(_0x4b9a6c){return _0x4b9a6c[_0xb0a6('0x21')](_0x27db00)['then'](function(_0x1322ec){return _0x1322ec;});}return null;};}function removeEntity(_0x2f1e97,_0x4997df){return function(_0x4aa68d){if(_0x4aa68d){return _0x4aa68d[_0xb0a6('0x22')]()[_0xb0a6('0x23')](function(){_0x2f1e97['status'](0xcc)[_0xb0a6('0x17')]();});}};}function handleEntityNotFound(_0x24574a,_0x259f47){return function(_0x5b19c1){if(!_0x5b19c1){_0x24574a['sendStatus'](0x194);}return _0x5b19c1;};}function handleError(_0x5e2a7c,_0x43adfa){_0x43adfa=_0x43adfa||0x1f4;return function(_0x1e9947){logger[_0xb0a6('0x24')](_0x1e9947['stack']);if(_0x1e9947[_0xb0a6('0x25')]){delete _0x1e9947[_0xb0a6('0x25')];}_0x5e2a7c[_0xb0a6('0x16')](_0x43adfa)[_0xb0a6('0x26')](_0x1e9947);};}exports[_0xb0a6('0x27')]=function(_0x3aef2b,_0x94d47f){var _0x305661={},_0x4255b9={},_0x4ced9f={'count':0x0,'rows':[]};var _0x12d683=_[_0xb0a6('0x28')](db[_0xb0a6('0x29')]['rawAttributes'],function(_0x31c332){return{'name':_0x31c332['fieldName'],'type':_0x31c332[_0xb0a6('0x2a')][_0xb0a6('0x2b')]};});_0x4255b9[_0xb0a6('0x2c')]=_[_0xb0a6('0x28')](_0x12d683,_0xb0a6('0x25'));_0x4255b9[_0xb0a6('0x2d')]=_[_0xb0a6('0x2e')](_0x3aef2b[_0xb0a6('0x2d')]);_0x4255b9[_0xb0a6('0x2f')]=_[_0xb0a6('0x30')](_0x4255b9['model'],_0x4255b9['query']);_0x305661[_0xb0a6('0x31')]=_[_0xb0a6('0x30')](_0x4255b9[_0xb0a6('0x2c')],qs[_0xb0a6('0x32')](_0x3aef2b[_0xb0a6('0x2d')][_0xb0a6('0x32')]));_0x305661[_0xb0a6('0x31')]=_0x305661[_0xb0a6('0x31')]['length']?_0x305661[_0xb0a6('0x31')]:_0x4255b9[_0xb0a6('0x2c')];if(!_0x3aef2b['query'][_0xb0a6('0x33')](_0xb0a6('0x34'))){_0x305661['limit']=qs['limit'](_0x3aef2b[_0xb0a6('0x2d')][_0xb0a6('0x1b')]);_0x305661[_0xb0a6('0x18')]=qs[_0xb0a6('0x18')](_0x3aef2b[_0xb0a6('0x2d')][_0xb0a6('0x18')]);}_0x305661['order']=qs[_0xb0a6('0x35')](_0x3aef2b['query'][_0xb0a6('0x35')]);_0x305661[_0xb0a6('0x36')]=qs['filters'](_['pick'](_0x3aef2b['query'],_0x4255b9[_0xb0a6('0x2f')]),_0x12d683);if(_0x3aef2b[_0xb0a6('0x2d')][_0xb0a6('0x37')]){_0x305661[_0xb0a6('0x36')]=_[_0xb0a6('0x38')](_0x305661['where'],{'$or':_[_0xb0a6('0x28')](_0x12d683,function(_0x3696d9){if(_0x3696d9[_0xb0a6('0x2a')]!==_0xb0a6('0x39')){var _0x4ab405={};_0x4ab405[_0x3696d9[_0xb0a6('0x25')]]={'$like':'%'+_0x3aef2b[_0xb0a6('0x2d')][_0xb0a6('0x37')]+'%'};return _0x4ab405;}})});}_0x305661=_[_0xb0a6('0x38')]({},_0x305661,_0x3aef2b[_0xb0a6('0x3a')]);var _0x5d5df6={'where':_0x305661['where']};return db[_0xb0a6('0x29')][_0xb0a6('0x1a')](_0x5d5df6)[_0xb0a6('0x23')](function(_0x253488){_0x4ced9f[_0xb0a6('0x1a')]=_0x253488;if(_0x3aef2b[_0xb0a6('0x2d')][_0xb0a6('0x3b')]){_0x305661[_0xb0a6('0x3c')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xb0a6('0x3d')](_0x305661);})[_0xb0a6('0x23')](function(_0x381067){_0x4ced9f[_0xb0a6('0x3e')]=_0x381067;return _0x4ced9f;})[_0xb0a6('0x23')](respondWithFilteredResult(_0x94d47f,_0x305661))['catch'](handleError(_0x94d47f,null));};exports[_0xb0a6('0x3f')]=function(_0x50e5b1,_0xaf5ef8){var _0x53a6d5={'raw':!![],'where':{'id':_0x50e5b1['params']['id']}},_0x144683={};_0x144683[_0xb0a6('0x2c')]=_[_0xb0a6('0x2e')](db[_0xb0a6('0x29')][_0xb0a6('0x40')]);_0x144683[_0xb0a6('0x2d')]=_[_0xb0a6('0x2e')](_0x50e5b1[_0xb0a6('0x2d')]);_0x144683[_0xb0a6('0x2f')]=_[_0xb0a6('0x30')](_0x144683[_0xb0a6('0x2c')],_0x144683[_0xb0a6('0x2d')]);_0x53a6d5[_0xb0a6('0x31')]=_['intersection'](_0x144683[_0xb0a6('0x2c')],qs[_0xb0a6('0x32')](_0x50e5b1['query'][_0xb0a6('0x32')]));_0x53a6d5['attributes']=_0x53a6d5[_0xb0a6('0x31')][_0xb0a6('0x41')]?_0x53a6d5[_0xb0a6('0x31')]:_0x144683['model'];if(_0x50e5b1[_0xb0a6('0x2d')][_0xb0a6('0x3b')]){_0x53a6d5[_0xb0a6('0x3c')]=[{'all':!![]}];}_0x53a6d5=_[_0xb0a6('0x38')]({},_0x53a6d5,_0x50e5b1[_0xb0a6('0x3a')]);return db[_0xb0a6('0x29')][_0xb0a6('0x42')](_0x53a6d5)[_0xb0a6('0x23')](handleEntityNotFound(_0xaf5ef8,null))['then'](respondWithResult(_0xaf5ef8,null))[_0xb0a6('0x43')](handleError(_0xaf5ef8,null));};exports[_0xb0a6('0x44')]=function(_0x47645a,_0x448197){return db['JscriptyAnswerReport']['create'](_0x47645a['body'],{})['then'](respondWithResult(_0x448197,0xc9))['catch'](handleError(_0x448197,null));};exports['update']=function(_0x512539,_0xafbe9d){if(_0x512539[_0xb0a6('0x45')]['id']){delete _0x512539[_0xb0a6('0x45')]['id'];}return db[_0xb0a6('0x29')][_0xb0a6('0x42')]({'where':{'id':_0x512539[_0xb0a6('0x46')]['id']}})[_0xb0a6('0x23')](handleEntityNotFound(_0xafbe9d,null))[_0xb0a6('0x23')](saveUpdates(_0x512539[_0xb0a6('0x45')],null))[_0xb0a6('0x23')](respondWithResult(_0xafbe9d,null))[_0xb0a6('0x43')](handleError(_0xafbe9d,null));};exports[_0xb0a6('0x22')]=function(_0x4dc961,_0x42fff4){return db[_0xb0a6('0x29')][_0xb0a6('0x42')]({'where':{'id':_0x4dc961['params']['id']}})[_0xb0a6('0x23')](handleEntityNotFound(_0x42fff4,null))[_0xb0a6('0x23')](removeEntity(_0x42fff4,null))[_0xb0a6('0x43')](handleError(_0x42fff4,null));};exports[_0xb0a6('0x47')]=function(_0x23cf46,_0x907ece){return db[_0xb0a6('0x29')][_0xb0a6('0x47')]()[_0xb0a6('0x23')](respondWithResult(_0x907ece,null))['catch'](handleError(_0x907ece,null));}; \ No newline at end of file +var _0xdc59=['bluebird','mustache','util','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','JscriptyAnswerReport','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','moment'];(function(_0x2bac6e,_0x1b2eb6){var _0xe6be07=function(_0x541d83){while(--_0x541d83){_0x2bac6e['push'](_0x2bac6e['shift']());}};_0xe6be07(++_0x1b2eb6);}(_0xdc59,0x12c));var _0x9dc5=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xdc59[_0x45bf86];return _0x1f02b7;};'use strict';var emlformat=require(_0x9dc5('0x0'));var rimraf=require(_0x9dc5('0x1'));var zipdir=require(_0x9dc5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9dc5('0x3'));var BPromise=require(_0x9dc5('0x4'));var Mustache=require(_0x9dc5('0x5'));var util=require(_0x9dc5('0x6'));var path=require(_0x9dc5('0x7'));var sox=require(_0x9dc5('0x8'));var csv=require(_0x9dc5('0x9'));var ejs=require(_0x9dc5('0xa'));var fs=require('fs');var fs_extra=require(_0x9dc5('0xb'));var _=require('lodash');var squel=require(_0x9dc5('0xc'));var crypto=require(_0x9dc5('0xd'));var jsforce=require(_0x9dc5('0xe'));var deskjs=require(_0x9dc5('0xf'));var toCsv=require(_0x9dc5('0x9'));var querystring=require(_0x9dc5('0x10'));var Papa=require(_0x9dc5('0x11'));var Redis=require(_0x9dc5('0x12'));var authService=require(_0x9dc5('0x13'));var qs=require(_0x9dc5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9dc5('0x15'));var logger=require(_0x9dc5('0x16'))(_0x9dc5('0x17'));var utils=require(_0x9dc5('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9dc5('0x19'));var db=require(_0x9dc5('0x1a'))['db'];function respondWithStatusCode(_0x36d236,_0x5612dc){_0x5612dc=_0x5612dc||0xcc;return function(_0x11427e){if(_0x11427e){return _0x36d236[_0x9dc5('0x1b')](_0x5612dc);}return _0x36d236[_0x9dc5('0x1c')](_0x5612dc)[_0x9dc5('0x1d')]();};}function respondWithResult(_0x312fe2,_0x239a0d){_0x239a0d=_0x239a0d||0xc8;return function(_0x786239){if(_0x786239){return _0x312fe2[_0x9dc5('0x1c')](_0x239a0d)[_0x9dc5('0x1e')](_0x786239);}};}function respondWithFilteredResult(_0x45912d,_0x4ac27c){return function(_0x26302e){if(_0x26302e){var _0x5ebe8b=typeof _0x4ac27c[_0x9dc5('0x1f')]===_0x9dc5('0x20')&&typeof _0x4ac27c['limit']===_0x9dc5('0x20');var _0x2f195a=_0x26302e[_0x9dc5('0x21')];var _0x16fca8=_0x5ebe8b?0x0:_0x4ac27c['offset'];var _0x4493c7=_0x5ebe8b?_0x26302e[_0x9dc5('0x21')]:_0x4ac27c[_0x9dc5('0x1f')]+_0x4ac27c[_0x9dc5('0x22')];var _0x4100e7;if(_0x4493c7>=_0x2f195a){_0x4493c7=_0x2f195a;_0x4100e7=0xc8;}else{_0x4100e7=0xce;}_0x45912d['status'](_0x4100e7);return _0x45912d[_0x9dc5('0x23')](_0x9dc5('0x24'),_0x16fca8+'-'+_0x4493c7+'/'+_0x2f195a)[_0x9dc5('0x1e')](_0x26302e);}return null;};}function patchUpdates(_0x4e6388){return function(_0x4ada0c){try{jsonpatch[_0x9dc5('0x25')](_0x4ada0c,_0x4e6388,!![]);}catch(_0x5e2da8){return BPromise[_0x9dc5('0x26')](_0x5e2da8);}return _0x4ada0c['save']();};}function saveUpdates(_0x191c88,_0x5c8956){return function(_0x100ae7){if(_0x100ae7){return _0x100ae7['update'](_0x191c88)[_0x9dc5('0x27')](function(_0x1c3726){return _0x1c3726;});}return null;};}function removeEntity(_0x255bff,_0x4ddea4){return function(_0x184d78){if(_0x184d78){return _0x184d78[_0x9dc5('0x28')]()[_0x9dc5('0x27')](function(){_0x255bff[_0x9dc5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ba5d2,_0xdeab68){return function(_0xf6da02){if(!_0xf6da02){_0x4ba5d2[_0x9dc5('0x1b')](0x194);}return _0xf6da02;};}function handleError(_0x21e4fb,_0x5ea9b4){_0x5ea9b4=_0x5ea9b4||0x1f4;return function(_0x59a0bf){logger[_0x9dc5('0x29')](_0x59a0bf[_0x9dc5('0x2a')]);if(_0x59a0bf['name']){delete _0x59a0bf[_0x9dc5('0x2b')];}_0x21e4fb[_0x9dc5('0x1c')](_0x5ea9b4)[_0x9dc5('0x2c')](_0x59a0bf);};}exports['index']=function(_0x4777f0,_0x311dfc){var _0x4630e2={},_0x3fadbf={},_0x3659a6={'count':0x0,'rows':[]};var _0x2d73e5=_['map'](db[_0x9dc5('0x2d')][_0x9dc5('0x2e')],function(_0x21b243){return{'name':_0x21b243[_0x9dc5('0x2f')],'type':_0x21b243[_0x9dc5('0x30')]['key']};});_0x3fadbf['model']=_[_0x9dc5('0x31')](_0x2d73e5,_0x9dc5('0x2b'));_0x3fadbf['query']=_[_0x9dc5('0x32')](_0x4777f0[_0x9dc5('0x33')]);_0x3fadbf[_0x9dc5('0x34')]=_[_0x9dc5('0x35')](_0x3fadbf[_0x9dc5('0x36')],_0x3fadbf[_0x9dc5('0x33')]);_0x4630e2[_0x9dc5('0x37')]=_[_0x9dc5('0x35')](_0x3fadbf[_0x9dc5('0x36')],qs['fields'](_0x4777f0[_0x9dc5('0x33')][_0x9dc5('0x38')]));_0x4630e2[_0x9dc5('0x37')]=_0x4630e2[_0x9dc5('0x37')][_0x9dc5('0x39')]?_0x4630e2[_0x9dc5('0x37')]:_0x3fadbf['model'];if(!_0x4777f0[_0x9dc5('0x33')]['hasOwnProperty'](_0x9dc5('0x3a'))){_0x4630e2['limit']=qs[_0x9dc5('0x22')](_0x4777f0[_0x9dc5('0x33')][_0x9dc5('0x22')]);_0x4630e2[_0x9dc5('0x1f')]=qs[_0x9dc5('0x1f')](_0x4777f0[_0x9dc5('0x33')][_0x9dc5('0x1f')]);}_0x4630e2[_0x9dc5('0x3b')]=qs[_0x9dc5('0x3c')](_0x4777f0[_0x9dc5('0x33')][_0x9dc5('0x3c')]);_0x4630e2['where']=qs[_0x9dc5('0x34')](_['pick'](_0x4777f0[_0x9dc5('0x33')],_0x3fadbf[_0x9dc5('0x34')]),_0x2d73e5);if(_0x4777f0[_0x9dc5('0x33')]['filter']){_0x4630e2[_0x9dc5('0x3d')]=_[_0x9dc5('0x3e')](_0x4630e2[_0x9dc5('0x3d')],{'$or':_['map'](_0x2d73e5,function(_0x1781a7){if(_0x1781a7[_0x9dc5('0x30')]!==_0x9dc5('0x3f')){var _0x3f097e={};_0x3f097e[_0x1781a7['name']]={'$like':'%'+_0x4777f0[_0x9dc5('0x33')][_0x9dc5('0x40')]+'%'};return _0x3f097e;}})});}_0x4630e2=_[_0x9dc5('0x3e')]({},_0x4630e2,_0x4777f0[_0x9dc5('0x41')]);var _0x594b5e={'where':_0x4630e2[_0x9dc5('0x3d')]};return db['JscriptyAnswerReport'][_0x9dc5('0x21')](_0x594b5e)[_0x9dc5('0x27')](function(_0x222662){_0x3659a6[_0x9dc5('0x21')]=_0x222662;if(_0x4777f0['query']['includeAll']){_0x4630e2['include']=[{'all':!![]}];}return db[_0x9dc5('0x2d')][_0x9dc5('0x42')](_0x4630e2);})[_0x9dc5('0x27')](function(_0x1a9162){_0x3659a6['rows']=_0x1a9162;return _0x3659a6;})[_0x9dc5('0x27')](respondWithFilteredResult(_0x311dfc,_0x4630e2))[_0x9dc5('0x43')](handleError(_0x311dfc,null));};exports[_0x9dc5('0x44')]=function(_0x30ef89,_0x1781fa){var _0x4a7262={'raw':!![],'where':{'id':_0x30ef89[_0x9dc5('0x45')]['id']}},_0x5d2fe7={};_0x5d2fe7['model']=_[_0x9dc5('0x32')](db[_0x9dc5('0x2d')]['rawAttributes']);_0x5d2fe7[_0x9dc5('0x33')]=_[_0x9dc5('0x32')](_0x30ef89[_0x9dc5('0x33')]);_0x5d2fe7[_0x9dc5('0x34')]=_[_0x9dc5('0x35')](_0x5d2fe7[_0x9dc5('0x36')],_0x5d2fe7[_0x9dc5('0x33')]);_0x4a7262[_0x9dc5('0x37')]=_[_0x9dc5('0x35')](_0x5d2fe7['model'],qs[_0x9dc5('0x38')](_0x30ef89[_0x9dc5('0x33')]['fields']));_0x4a7262['attributes']=_0x4a7262[_0x9dc5('0x37')]['length']?_0x4a7262['attributes']:_0x5d2fe7[_0x9dc5('0x36')];if(_0x30ef89[_0x9dc5('0x33')][_0x9dc5('0x46')]){_0x4a7262[_0x9dc5('0x47')]=[{'all':!![]}];}_0x4a7262=_['merge']({},_0x4a7262,_0x30ef89[_0x9dc5('0x41')]);return db['JscriptyAnswerReport'][_0x9dc5('0x48')](_0x4a7262)[_0x9dc5('0x27')](handleEntityNotFound(_0x1781fa,null))[_0x9dc5('0x27')](respondWithResult(_0x1781fa,null))['catch'](handleError(_0x1781fa,null));};exports['create']=function(_0x44f8a3,_0x26d54e){return db[_0x9dc5('0x2d')][_0x9dc5('0x49')](_0x44f8a3['body'],{})[_0x9dc5('0x27')](respondWithResult(_0x26d54e,0xc9))[_0x9dc5('0x43')](handleError(_0x26d54e,null));};exports['update']=function(_0x5ca7e8,_0x188338){if(_0x5ca7e8[_0x9dc5('0x4a')]['id']){delete _0x5ca7e8[_0x9dc5('0x4a')]['id'];}return db[_0x9dc5('0x2d')][_0x9dc5('0x48')]({'where':{'id':_0x5ca7e8[_0x9dc5('0x45')]['id']}})['then'](handleEntityNotFound(_0x188338,null))[_0x9dc5('0x27')](saveUpdates(_0x5ca7e8[_0x9dc5('0x4a')],null))['then'](respondWithResult(_0x188338,null))[_0x9dc5('0x43')](handleError(_0x188338,null));};exports[_0x9dc5('0x28')]=function(_0x3d6260,_0x3ac2f2){return db['JscriptyAnswerReport'][_0x9dc5('0x48')]({'where':{'id':_0x3d6260[_0x9dc5('0x45')]['id']}})[_0x9dc5('0x27')](handleEntityNotFound(_0x3ac2f2,null))[_0x9dc5('0x27')](removeEntity(_0x3ac2f2,null))[_0x9dc5('0x43')](handleError(_0x3ac2f2,null));};exports[_0x9dc5('0x4b')]=function(_0x23f6cc,_0x171e33){return db[_0x9dc5('0x2d')]['describe']()[_0x9dc5('0x27')](respondWithResult(_0x171e33,null))[_0x9dc5('0x43')](handleError(_0x171e33,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 0144ca4..eb35e68 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 _0xdb48=['report_jscripty_answers','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','JscriptyAnswerReport'];(function(_0x289a67,_0x1e5a3c){var _0x572b49=function(_0x22e036){while(--_0x22e036){_0x289a67['push'](_0x289a67['shift']());}};_0x572b49(++_0x1e5a3c);}(_0xdb48,0x181));var _0x8db4=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xdb48[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0x8db4('0x0'));var util=require(_0x8db4('0x1'));var logger=require('../../config/logger')(_0x8db4('0x2'));var moment=require(_0x8db4('0x3'));var BPromise=require(_0x8db4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8db4('0x5'));var rimraf=require(_0x8db4('0x6'));var config=require(_0x8db4('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x8db4('0x8')]=function(_0x136f3b,_0x4e3ec3){return _0x136f3b[_0x8db4('0x9')](_0x8db4('0xa'),attributes,{'tableName':_0x8db4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4049=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','report_jscripty_answers','lodash'];(function(_0x1914d2,_0x116fe8){var _0x2526ad=function(_0xa19830){while(--_0xa19830){_0x1914d2['push'](_0x1914d2['shift']());}};_0x2526ad(++_0x116fe8);}(_0x4049,0x133));var _0x9404=function(_0x214c08,_0x2e903a){_0x214c08=_0x214c08-0x0;var _0x67963a=_0x4049[_0x214c08];return _0x67963a;};'use strict';var _=require(_0x9404('0x0'));var util=require(_0x9404('0x1'));var logger=require(_0x9404('0x2'))('api');var moment=require(_0x9404('0x3'));var BPromise=require('bluebird');var rp=require(_0x9404('0x4'));var fs=require('fs');var path=require(_0x9404('0x5'));var rimraf=require(_0x9404('0x6'));var config=require(_0x9404('0x7'));var attributes=require(_0x9404('0x8'));module[_0x9404('0x9')]=function(_0x220c18,_0x3bfa1d){return _0x220c18['define']('JscriptyAnswerReport',attributes,{'tableName':_0x9404('0xa'),'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 9d11b37..d1f429d 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 _0x552f=['info','catch','lodash','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x552f,0x87));var _0xf552=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x552f[_0x81dcac];return _0xc7803b;};'use strict';var _=require(_0xf552('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf552('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf552('0x2'));var logger=require(_0xf552('0x3'))(_0xf552('0x4'));var config=require('../../config/environment');var jayson=require(_0xf552('0x5'));var client=jayson[_0xf552('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d171c,_0x27df96,_0x3f962d){return new BPromise(function(_0x524ec6,_0x26695c){return client[_0xf552('0x7')](_0x2d171c,_0x3f962d)[_0xf552('0x8')](function(_0x33443f){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x27df96,'request\x20sent');logger[_0xf552('0x9')](_0xf552('0xa'),_0x27df96,_0xf552('0xb'),JSON[_0xf552('0xc')](_0x33443f));if(_0x33443f[_0xf552('0xd')]){if(_0x33443f[_0xf552('0xd')][_0xf552('0xe')]===0x1f4){logger['error'](_0xf552('0xf'),_0x27df96,_0x33443f['error']['message']);return _0x26695c(_0x33443f[_0xf552('0xd')]['message']);}logger[_0xf552('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x27df96,_0x33443f[_0xf552('0xd')][_0xf552('0x10')]);return _0x524ec6(_0x33443f[_0xf552('0xd')]['message']);}else{logger[_0xf552('0x11')](_0xf552('0xf'),_0x27df96,_0xf552('0xb'));_0x524ec6(_0x33443f['result']['message']);}})[_0xf552('0x12')](function(_0x4109b8){logger[_0xf552('0xd')](_0xf552('0xf'),_0x27df96,_0x4109b8);_0x26695c(_0x4109b8);});});} \ No newline at end of file +var _0x9ca8=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x71b8fa,_0x25e85d){var _0x31cecc=function(_0x285392){while(--_0x285392){_0x71b8fa['push'](_0x71b8fa['shift']());}};_0x31cecc(++_0x25e85d);}(_0x9ca8,0x150));var _0x89ca=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0x9ca8[_0x3861f7];return _0x50879f;};'use strict';var _=require(_0x89ca('0x0'));var util=require('util');var moment=require(_0x89ca('0x1'));var BPromise=require(_0x89ca('0x2'));var rs=require(_0x89ca('0x3'));var fs=require('fs');var Redis=require(_0x89ca('0x4'));var db=require(_0x89ca('0x5'))['db'];var utils=require(_0x89ca('0x6'));var logger=require(_0x89ca('0x7'))(_0x89ca('0x8'));var config=require(_0x89ca('0x9'));var jayson=require(_0x89ca('0xa'));var client=jayson[_0x89ca('0xb')][_0x89ca('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22440e,_0x2bdd3c,_0x5a02b4){return new BPromise(function(_0x5593b3,_0xc58fa2){return client['request'](_0x22440e,_0x5a02b4)[_0x89ca('0xd')](function(_0x395e42){logger[_0x89ca('0xe')](_0x89ca('0xf'),_0x2bdd3c,'request\x20sent');logger[_0x89ca('0x10')](_0x89ca('0x11'),_0x2bdd3c,_0x89ca('0x12'),JSON[_0x89ca('0x13')](_0x395e42));if(_0x395e42[_0x89ca('0x14')]){if(_0x395e42[_0x89ca('0x14')][_0x89ca('0x15')]===0x1f4){logger[_0x89ca('0x14')](_0x89ca('0xf'),_0x2bdd3c,_0x395e42[_0x89ca('0x14')][_0x89ca('0x16')]);return _0xc58fa2(_0x395e42[_0x89ca('0x14')][_0x89ca('0x16')]);}logger[_0x89ca('0x14')](_0x89ca('0xf'),_0x2bdd3c,_0x395e42[_0x89ca('0x14')][_0x89ca('0x16')]);return _0x5593b3(_0x395e42[_0x89ca('0x14')]['message']);}else{logger[_0x89ca('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2bdd3c,_0x89ca('0x12'));_0x5593b3(_0x395e42[_0x89ca('0x17')][_0x89ca('0x16')]);}})['catch'](function(_0x5704b0){logger[_0x89ca('0x14')](_0x89ca('0xf'),_0x2bdd3c,_0x5704b0);_0xc58fa2(_0x5704b0);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 4338b6d..7935101 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 _0x7112=['../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','getSummary','post','put','update','exports','util','path','express'];(function(_0x3ef54a,_0x492a4a){var _0x2bdbbe=function(_0x50970e){while(--_0x50970e){_0x3ef54a['push'](_0x3ef54a['shift']());}};_0x2bdbbe(++_0x492a4a);}(_0x7112,0x1dd));var _0x2711=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7112[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x2711('0x0'));var path=require(_0x2711('0x1'));var timeout=require('connect-timeout');var express=require(_0x2711('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2711('0x3'));var config=require(_0x2711('0x4'));var controller=require(_0x2711('0x5'));router[_0x2711('0x6')]('/',auth[_0x2711('0x7')](),controller[_0x2711('0x8')]);router[_0x2711('0x6')](_0x2711('0x9'),auth[_0x2711('0x7')](),controller[_0x2711('0xa')]);router[_0x2711('0x6')](_0x2711('0xb'),auth['isAuthenticated'](),controller[_0x2711('0xc')]);router[_0x2711('0x6')](_0x2711('0xd'),auth[_0x2711('0x7')](),controller['getAnswers']);router[_0x2711('0x6')](_0x2711('0xe'),auth[_0x2711('0x7')](),timeout('30s'),controller[_0x2711('0xf')]);router[_0x2711('0x10')]('/',auth[_0x2711('0x7')](),controller['create']);router['post']('/:id/clone',auth[_0x2711('0x7')](),controller['clone']);router[_0x2711('0x11')](_0x2711('0x9'),auth[_0x2711('0x7')](),controller[_0x2711('0x12')]);router['delete'](_0x2711('0x9'),auth[_0x2711('0x7')](),controller['destroy']);module[_0x2711('0x13')]=router; \ No newline at end of file +var _0x5c3c=['/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x506ab4,_0x2fe64a){var _0x23caeb=function(_0x5243eb){while(--_0x5243eb){_0x506ab4['push'](_0x506ab4['shift']());}};_0x23caeb(++_0x2fe64a);}(_0x5c3c,0x123));var _0xc5c3=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x5c3c[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require(_0xc5c3('0x4'));var router=express[_0xc5c3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc5c3('0x6'));var interaction=require(_0xc5c3('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0xc5c3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc5c3('0x8')](_0xc5c3('0x9'),auth[_0xc5c3('0xa')](),controller[_0xc5c3('0xb')]);router[_0xc5c3('0x8')](_0xc5c3('0xc'),auth[_0xc5c3('0xa')](),controller[_0xc5c3('0xd')]);router['get'](_0xc5c3('0xe'),auth[_0xc5c3('0xa')](),controller[_0xc5c3('0xf')]);router[_0xc5c3('0x8')](_0xc5c3('0x10'),auth[_0xc5c3('0xa')](),timeout(_0xc5c3('0x11')),controller[_0xc5c3('0x12')]);router[_0xc5c3('0x13')]('/',auth['isAuthenticated'](),controller[_0xc5c3('0x14')]);router[_0xc5c3('0x13')]('/:id/clone',auth[_0xc5c3('0xa')](),controller['clone']);router[_0xc5c3('0x15')](_0xc5c3('0x9'),auth[_0xc5c3('0xa')](),controller[_0xc5c3('0x16')]);router[_0xc5c3('0x17')](_0xc5c3('0x9'),auth[_0xc5c3('0xa')](),controller[_0xc5c3('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 803a3aa..f734bab 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 _0x8049=['exports','STRING','TEXT','long','isObjectLike','setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','BOOLEAN','sequelize'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8049,0x6b));var _0x9804=function(_0xe0420f,_0x52f31b){_0xe0420f=_0xe0420f-0x0;var _0x3b3234=_0x8049[_0xe0420f];return _0x3b3234;};'use strict';var Sequelize=require(_0x9804('0x0'));var _=require('lodash');var util=require('util');module[_0x9804('0x1')]={'name':{'type':Sequelize[_0x9804('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x9804('0x2')]},'formData':{'type':Sequelize[_0x9804('0x3')](_0x9804('0x4')),'set':function(_0x5010ec){if(_[_0x9804('0x5')](_0x5010ec)){this[_0x9804('0x6')](_0x9804('0x7'),JSON['stringify'](_0x5010ec));}else if(_['isString'](_0x5010ec)){this[_0x9804('0x6')](_0x9804('0x7'),_0x5010ec);}else{this[_0x9804('0x6')](_0x9804('0x7'),util['format'](_0x9804('0x8'),this[_0x9804('0x9')](_0x9804('0xa'))||'',this[_0x9804('0x9')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x9804('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x9804('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0xf3d6=['isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','sequelize','lodash','exports','STRING','name','long','isObjectLike','setDataValue','formData'];(function(_0x328e3c,_0x4251c8){var _0x108fcd=function(_0x204b3d){while(--_0x204b3d){_0x328e3c['push'](_0x328e3c['shift']());}};_0x108fcd(++_0x4251c8);}(_0xf3d6,0x155));var _0x6f3d=function(_0x11acac,_0x37d55f){_0x11acac=_0x11acac-0x0;var _0x1daa7e=_0xf3d6[_0x11acac];return _0x1daa7e;};'use strict';var Sequelize=require(_0x6f3d('0x0'));var _=require(_0x6f3d('0x1'));var util=require('util');module[_0x6f3d('0x2')]={'name':{'type':Sequelize[_0x6f3d('0x3')],'unique':_0x6f3d('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x6f3d('0x5')),'set':function(_0x2c460b){if(_[_0x6f3d('0x6')](_0x2c460b)){this[_0x6f3d('0x7')](_0x6f3d('0x8'),JSON['stringify'](_0x2c460b));}else if(_[_0x6f3d('0x9')](_0x2c460b)){this[_0x6f3d('0x7')](_0x6f3d('0x8'),_0x2c460b);}else{this[_0x6f3d('0x7')]('formData',util[_0x6f3d('0xa')](_0x6f3d('0xb'),this[_0x6f3d('0xc')](_0x6f3d('0x4'))||'',this['getDataValue'](_0x6f3d('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 0566ef8..6d22325 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 _0xe211=['setHeader','attachment;\x20filename=','Content-type','/tmp/Jscripty_Project_%d_Summary_%s.csv','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','json','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','order','sort','where','pick','filter','merge','options','count','includeAll','include','JscriptyProject','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','role','autoAssociation','getSessions','JscriptySessionReport','hasOwnProperty','findAll','getAnswers','findOne','JscriptyAnswerReport','nolimit','ProjectId','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync'];(function(_0x47159c,_0x1c8216){var _0x454dbe=function(_0x2b54f7){while(--_0x2b54f7){_0x47159c['push'](_0x47159c['shift']());}};_0x454dbe(++_0x1c8216);}(_0xe211,0x166));var _0x1e21=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe211[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1e21('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e21('0x1'));var moment=require(_0x1e21('0x2'));var BPromise=require(_0x1e21('0x3'));var Mustache=require(_0x1e21('0x4'));var util=require(_0x1e21('0x5'));var path=require('path');var sox=require(_0x1e21('0x6'));var csv=require(_0x1e21('0x7'));var ejs=require(_0x1e21('0x8'));var fs=require('fs');var fs_extra=require(_0x1e21('0x9'));var _=require(_0x1e21('0xa'));var squel=require('squel');var crypto=require(_0x1e21('0xb'));var jsforce=require(_0x1e21('0xc'));var deskjs=require(_0x1e21('0xd'));var toCsv=require(_0x1e21('0x7'));var querystring=require(_0x1e21('0xe'));var Papa=require(_0x1e21('0xf'));var Redis=require(_0x1e21('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1e21('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e21('0x12'));var logger=require(_0x1e21('0x13'))('api');var utils=require(_0x1e21('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1e21('0x15'));var db=require(_0x1e21('0x16'))['db'];function respondWithStatusCode(_0x18e9da,_0x306300){_0x306300=_0x306300||0xcc;return function(_0x3783c2){if(_0x3783c2){return _0x18e9da[_0x1e21('0x17')](_0x306300);}return _0x18e9da[_0x1e21('0x18')](_0x306300)[_0x1e21('0x19')]();};}function respondWithResult(_0x3a76ce,_0x23b7b0){_0x23b7b0=_0x23b7b0||0xc8;return function(_0x5111a8){if(_0x5111a8){return _0x3a76ce[_0x1e21('0x18')](_0x23b7b0)['json'](_0x5111a8);}};}function respondWithFilteredResult(_0x32a2a0,_0x32773f){return function(_0x30c686){if(_0x30c686){var _0x195abd=typeof _0x32773f['offset']===_0x1e21('0x1a')&&typeof _0x32773f[_0x1e21('0x1b')]===_0x1e21('0x1a');var _0x4af62f=_0x30c686['count'];var _0x542851=_0x195abd?0x0:_0x32773f[_0x1e21('0x1c')];var _0x100522=_0x195abd?_0x30c686['count']:_0x32773f['offset']+_0x32773f[_0x1e21('0x1b')];var _0x563445;if(_0x100522>=_0x4af62f){_0x100522=_0x4af62f;_0x563445=0xc8;}else{_0x563445=0xce;}_0x32a2a0['status'](_0x563445);return _0x32a2a0[_0x1e21('0x1d')]('Content-Range',_0x542851+'-'+_0x100522+'/'+_0x4af62f)[_0x1e21('0x1e')](_0x30c686);}return null;};}function patchUpdates(_0xf07ea5){return function(_0x370a17){try{jsonpatch[_0x1e21('0x1f')](_0x370a17,_0xf07ea5,!![]);}catch(_0x2108ae){return BPromise[_0x1e21('0x20')](_0x2108ae);}return _0x370a17[_0x1e21('0x21')]();};}function saveUpdates(_0x4c9547,_0x1c5701){return function(_0x316c40){if(_0x316c40){return _0x316c40['update'](_0x4c9547)[_0x1e21('0x22')](function(_0x73381f){return _0x73381f;});}return null;};}function removeEntity(_0x2a58f0,_0x114b8e){return function(_0x4817e0){if(_0x4817e0){return _0x4817e0['destroy']()[_0x1e21('0x22')](function(){var _0x208f79=_0x4817e0[_0x1e21('0x23')]({'plain':!![]});var _0x4addd2='Projects';return db[_0x1e21('0x24')][_0x1e21('0x25')]({'where':{'type':_0x4addd2,'resourceId':_0x208f79['id']}})[_0x1e21('0x22')](function(){return _0x4817e0;});})[_0x1e21('0x22')](function(){_0x2a58f0[_0x1e21('0x18')](0xcc)[_0x1e21('0x19')]();});}};}function handleEntityNotFound(_0x176319,_0x17c83a){return function(_0x1bba21){if(!_0x1bba21){_0x176319[_0x1e21('0x17')](0x194);}return _0x1bba21;};}function handleError(_0x45ee6a,_0x588000){_0x588000=_0x588000||0x1f4;return function(_0x22f178){logger[_0x1e21('0x26')](_0x22f178[_0x1e21('0x27')]);if(_0x22f178[_0x1e21('0x28')]){delete _0x22f178[_0x1e21('0x28')];}_0x45ee6a[_0x1e21('0x18')](_0x588000)[_0x1e21('0x29')](_0x22f178);};}exports[_0x1e21('0x2a')]=function(_0x9327f3,_0x4a5610){var _0x3587d5={},_0x10b90d={},_0x55d3b5={'count':0x0,'rows':[]};var _0x1a6c46=_[_0x1e21('0x2b')](db['JscriptyProject'][_0x1e21('0x2c')],function(_0x528e09){return{'name':_0x528e09[_0x1e21('0x2d')],'type':_0x528e09[_0x1e21('0x2e')][_0x1e21('0x2f')]};});_0x10b90d['model']=_[_0x1e21('0x2b')](_0x1a6c46,_0x1e21('0x28'));_0x10b90d['query']=_[_0x1e21('0x30')](_0x9327f3[_0x1e21('0x31')]);_0x10b90d[_0x1e21('0x32')]=_[_0x1e21('0x33')](_0x10b90d['model'],_0x10b90d[_0x1e21('0x31')]);_0x3587d5[_0x1e21('0x34')]=_[_0x1e21('0x33')](_0x10b90d[_0x1e21('0x35')],qs[_0x1e21('0x36')](_0x9327f3[_0x1e21('0x31')]['fields']));_0x3587d5['attributes']=_0x3587d5[_0x1e21('0x34')][_0x1e21('0x37')]?_0x3587d5[_0x1e21('0x34')]:_0x10b90d['model'];if(!_0x9327f3[_0x1e21('0x31')]['hasOwnProperty']('nolimit')){_0x3587d5[_0x1e21('0x1b')]=qs[_0x1e21('0x1b')](_0x9327f3[_0x1e21('0x31')]['limit']);_0x3587d5['offset']=qs[_0x1e21('0x1c')](_0x9327f3[_0x1e21('0x31')][_0x1e21('0x1c')]);}_0x3587d5[_0x1e21('0x38')]=qs[_0x1e21('0x39')](_0x9327f3[_0x1e21('0x31')]['sort']);_0x3587d5[_0x1e21('0x3a')]=qs[_0x1e21('0x32')](_[_0x1e21('0x3b')](_0x9327f3[_0x1e21('0x31')],_0x10b90d[_0x1e21('0x32')]),_0x1a6c46);if(_0x9327f3['query'][_0x1e21('0x3c')]){_0x3587d5[_0x1e21('0x3a')]=_[_0x1e21('0x3d')](_0x3587d5[_0x1e21('0x3a')],{'$or':_[_0x1e21('0x2b')](_0x1a6c46,function(_0x566ffe){if(_0x566ffe['type']!=='VIRTUAL'){var _0x2f4511={};_0x2f4511[_0x566ffe[_0x1e21('0x28')]]={'$like':'%'+_0x9327f3[_0x1e21('0x31')]['filter']+'%'};return _0x2f4511;}})});}_0x3587d5=_[_0x1e21('0x3d')]({},_0x3587d5,_0x9327f3[_0x1e21('0x3e')]);var _0x4df68f={'where':_0x3587d5['where']};return db['JscriptyProject'][_0x1e21('0x3f')](_0x4df68f)[_0x1e21('0x22')](function(_0x364e07){_0x55d3b5[_0x1e21('0x3f')]=_0x364e07;if(_0x9327f3['query'][_0x1e21('0x40')]){_0x3587d5[_0x1e21('0x41')]=[{'all':!![]}];}return db[_0x1e21('0x42')]['findAll'](_0x3587d5);})['then'](function(_0x5b1c9d){_0x55d3b5[_0x1e21('0x43')]=_0x5b1c9d;return _0x55d3b5;})[_0x1e21('0x22')](respondWithFilteredResult(_0x4a5610,_0x3587d5))['catch'](handleError(_0x4a5610,null));};exports[_0x1e21('0x44')]=function(_0x2e8fde,_0x2444e5){var _0x219352={'raw':![],'where':{'id':_0x2e8fde[_0x1e21('0x45')]['id']}},_0x26e1a7={};_0x26e1a7[_0x1e21('0x35')]=_[_0x1e21('0x30')](db[_0x1e21('0x42')]['rawAttributes']);_0x26e1a7[_0x1e21('0x31')]=_[_0x1e21('0x30')](_0x2e8fde[_0x1e21('0x31')]);_0x26e1a7[_0x1e21('0x32')]=_['intersection'](_0x26e1a7[_0x1e21('0x35')],_0x26e1a7[_0x1e21('0x31')]);_0x219352['attributes']=_[_0x1e21('0x33')](_0x26e1a7[_0x1e21('0x35')],qs['fields'](_0x2e8fde['query'][_0x1e21('0x36')]));_0x219352[_0x1e21('0x34')]=_0x219352[_0x1e21('0x34')]['length']?_0x219352[_0x1e21('0x34')]:_0x26e1a7[_0x1e21('0x35')];if(_0x2e8fde['query'][_0x1e21('0x40')]){_0x219352['include']=[{'all':!![]}];}_0x219352=_['merge']({},_0x219352,_0x2e8fde[_0x1e21('0x3e')]);return db[_0x1e21('0x42')]['find'](_0x219352)[_0x1e21('0x22')](handleEntityNotFound(_0x2444e5,null))[_0x1e21('0x22')](respondWithResult(_0x2444e5,null))['catch'](handleError(_0x2444e5,null));};exports[_0x1e21('0x46')]=function(_0x549222,_0x45b186){return db['JscriptyProject'][_0x1e21('0x46')](_0x549222[_0x1e21('0x47')],{})[_0x1e21('0x22')](function(_0x44071a){var _0x29795b=_0x549222[_0x1e21('0x48')]['get']({'plain':!![]});if(!_0x29795b)throw new Error(_0x1e21('0x49'));if(_0x29795b['role']===_0x1e21('0x48')){var _0x22c678=_0x44071a[_0x1e21('0x23')]({'plain':!![]});var _0x1da050=_0x1e21('0x4a');return db[_0x1e21('0x4b')][_0x1e21('0x4c')]({'where':{'name':_0x1da050,'userProfileId':_0x29795b[_0x1e21('0x4d')]},'raw':!![]})['then'](function(_0x3443ad){if(_0x3443ad&&_0x3443ad['autoAssociation']===0x0){return db[_0x1e21('0x24')]['create']({'name':_0x22c678[_0x1e21('0x28')],'resourceId':_0x22c678['id'],'type':_0x3443ad[_0x1e21('0x28')],'sectionId':_0x3443ad['id']},{})[_0x1e21('0x22')](function(){return _0x44071a;});}else{return _0x44071a;}})[_0x1e21('0x4e')](function(_0x2cf9d0){logger['error'](_0x1e21('0x4f'),_0x2cf9d0);throw _0x2cf9d0;});}return _0x44071a;})[_0x1e21('0x22')](respondWithResult(_0x45b186,0xc9))['catch'](handleError(_0x45b186,null));};exports['clone']=function(_0x424e6b,_0x1f92b0){var _0xa5f009={'where':{'id':_0x424e6b['params']['id']}},_0x51ba36={};_0x51ba36['model']=_[_0x1e21('0x30')](db['JscriptyProject'][_0x1e21('0x2c')]);_0xa5f009[_0x1e21('0x34')]=_[_0x1e21('0x33')](_0x51ba36[_0x1e21('0x35')],qs['fields'](_0x424e6b[_0x1e21('0x31')][_0x1e21('0x36')]));_0xa5f009[_0x1e21('0x34')]=_0xa5f009['attributes']['length']?_0xa5f009[_0x1e21('0x34')]:_0x51ba36[_0x1e21('0x35')];if(_0x424e6b[_0x1e21('0x31')][_0x1e21('0x40')]){_0xa5f009[_0x1e21('0x41')]=[{'all':!![]}];}_0xa5f009=_[_0x1e21('0x3d')]({},_0xa5f009,_0x424e6b['options']);return db[_0x1e21('0x42')][_0x1e21('0x4c')](_0xa5f009)[_0x1e21('0x22')](handleEntityNotFound(_0x1f92b0,null))[_0x1e21('0x22')](function(_0x1ebb58){if(_0x1ebb58){var _0x210ddd=_0x1ebb58[_0x1e21('0x23')]({'plain':!![]});_0x210ddd=qs[_0x1e21('0x50')](_0x210ddd,['id',_0x1e21('0x51'),'updatedAt']);_0x424e6b['body']=_[_0x1e21('0x50')](_0x424e6b[_0x1e21('0x47')],['id',_0x1e21('0x51'),_0x1e21('0x52')]);return db['JscriptyProject'][_0x1e21('0x46')](_['merge'](_0x210ddd,_0x424e6b[_0x1e21('0x47')]),{'include':_0x424e6b[_0x1e21('0x31')]['includeAll']?[{'all':!![]}]:undefined})[_0x1e21('0x22')](function(_0x5b9faa){var _0x3da8b8=_0x424e6b[_0x1e21('0x48')][_0x1e21('0x23')]({'plain':!![]});if(!_0x3da8b8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3da8b8[_0x1e21('0x53')]===_0x1e21('0x48')){var _0x4e2e5d=_0x5b9faa[_0x1e21('0x23')]({'plain':!![]});var _0x32625d=_0x1e21('0x4a');return db['UserProfileSection'][_0x1e21('0x4c')]({'where':{'name':_0x32625d,'userProfileId':_0x3da8b8[_0x1e21('0x4d')]},'raw':!![]})[_0x1e21('0x22')](function(_0x9d0a14){if(_0x9d0a14&&_0x9d0a14[_0x1e21('0x54')]===0x0){return db['UserProfileResource'][_0x1e21('0x46')]({'name':_0x4e2e5d[_0x1e21('0x28')],'resourceId':_0x4e2e5d['id'],'type':_0x9d0a14[_0x1e21('0x28')],'sectionId':_0x9d0a14['id']},{})[_0x1e21('0x22')](function(){return _0x5b9faa;});}else{return _0x5b9faa;}})[_0x1e21('0x4e')](function(_0x229a4f){logger[_0x1e21('0x26')](_0x1e21('0x4f'),_0x229a4f);throw _0x229a4f;});}return _0x5b9faa;});}})[_0x1e21('0x22')](respondWithResult(_0x1f92b0,0xc9))['catch'](handleError(_0x1f92b0,null));};exports['update']=function(_0xf34355,_0x30ada6){if(_0xf34355[_0x1e21('0x47')]['id']){delete _0xf34355['body']['id'];}return db[_0x1e21('0x42')][_0x1e21('0x4c')]({'where':{'id':_0xf34355['params']['id']}})['then'](handleEntityNotFound(_0x30ada6,null))[_0x1e21('0x22')](saveUpdates(_0xf34355[_0x1e21('0x47')],null))[_0x1e21('0x22')](respondWithResult(_0x30ada6,null))[_0x1e21('0x4e')](handleError(_0x30ada6,null));};exports[_0x1e21('0x25')]=function(_0x6536c5,_0x581055){return db['JscriptyProject'][_0x1e21('0x4c')]({'where':{'id':_0x6536c5[_0x1e21('0x45')]['id']}})[_0x1e21('0x22')](handleEntityNotFound(_0x581055,null))[_0x1e21('0x22')](removeEntity(_0x581055,null))[_0x1e21('0x4e')](handleError(_0x581055,null));};exports[_0x1e21('0x55')]=function(_0x50e64b,_0x38aeb9,_0x22ef89){var _0x39bb34={'raw':!![],'where':{}};var _0x430e43={};var _0x390c70={'count':0x0,'rows':[]};return db[_0x1e21('0x42')]['findOne']({'where':{'id':_0x50e64b[_0x1e21('0x45')]['id']}})[_0x1e21('0x22')](handleEntityNotFound(_0x38aeb9,null))['then'](function(_0x34cc1e){if(_0x34cc1e){_0x430e43[_0x1e21('0x35')]=_[_0x1e21('0x30')](db[_0x1e21('0x56')][_0x1e21('0x2c')]);_0x430e43[_0x1e21('0x31')]=_[_0x1e21('0x30')](_0x50e64b['query']);_0x430e43[_0x1e21('0x32')]=_['intersection'](_0x430e43[_0x1e21('0x35')],_0x430e43[_0x1e21('0x31')]);_0x39bb34[_0x1e21('0x34')]=_[_0x1e21('0x33')](_0x430e43[_0x1e21('0x35')],qs[_0x1e21('0x36')](_0x50e64b[_0x1e21('0x31')]['fields']));_0x39bb34['attributes']=_0x39bb34['attributes']['length']?_0x39bb34['attributes']:_0x430e43[_0x1e21('0x35')];if(!_0x50e64b[_0x1e21('0x31')][_0x1e21('0x57')]('nolimit')){_0x39bb34['limit']=qs[_0x1e21('0x1b')](_0x50e64b[_0x1e21('0x31')][_0x1e21('0x1b')]);_0x39bb34[_0x1e21('0x1c')]=qs[_0x1e21('0x1c')](_0x50e64b[_0x1e21('0x31')][_0x1e21('0x1c')]);}_0x39bb34[_0x1e21('0x38')]=qs[_0x1e21('0x39')](_0x50e64b[_0x1e21('0x31')]['sort']);_0x39bb34[_0x1e21('0x3a')]=qs[_0x1e21('0x32')](_['pick'](_0x50e64b[_0x1e21('0x31')],_0x430e43[_0x1e21('0x32')]));_0x39bb34[_0x1e21('0x3a')]['ProjectId']=_0x34cc1e['id'];if(_0x50e64b[_0x1e21('0x31')][_0x1e21('0x3c')]){_0x39bb34['where']=_[_0x1e21('0x3d')](_0x39bb34[_0x1e21('0x3a')],{'$or':_[_0x1e21('0x2b')](_0x39bb34[_0x1e21('0x34')],function(_0x57c810){var _0xb48822={};_0xb48822[_0x57c810]={'$like':'%'+_0x50e64b[_0x1e21('0x31')][_0x1e21('0x3c')]+'%'};return _0xb48822;})});}_0x39bb34=_[_0x1e21('0x3d')]({},_0x39bb34,_0x50e64b[_0x1e21('0x3e')]);return db[_0x1e21('0x56')][_0x1e21('0x3f')]({'where':_0x39bb34[_0x1e21('0x3a')]})[_0x1e21('0x22')](function(_0x50a285){_0x390c70[_0x1e21('0x3f')]=_0x50a285;if(_0x50e64b[_0x1e21('0x31')][_0x1e21('0x40')]){_0x39bb34[_0x1e21('0x41')]=[{'all':!![]}];}return db[_0x1e21('0x56')][_0x1e21('0x58')](_0x39bb34);})[_0x1e21('0x22')](function(_0x2d9c43){_0x390c70['rows']=_0x2d9c43;return _0x390c70;});}})['then'](respondWithFilteredResult(_0x38aeb9,_0x39bb34))[_0x1e21('0x4e')](handleError(_0x38aeb9,null));};exports[_0x1e21('0x59')]=function(_0xe54ffa,_0x202f38,_0xd3f792){var _0x3af785={'raw':!![],'where':{}};var _0x3b6b9a={};var _0x533575={'count':0x0,'rows':[]};return db[_0x1e21('0x42')][_0x1e21('0x5a')]({'where':{'id':_0xe54ffa['params']['id']}})[_0x1e21('0x22')](handleEntityNotFound(_0x202f38,null))[_0x1e21('0x22')](function(_0x35c43f){if(_0x35c43f){_0x3b6b9a[_0x1e21('0x35')]=_[_0x1e21('0x30')](db[_0x1e21('0x5b')][_0x1e21('0x2c')]);_0x3b6b9a['query']=_[_0x1e21('0x30')](_0xe54ffa[_0x1e21('0x31')]);_0x3b6b9a[_0x1e21('0x32')]=_['intersection'](_0x3b6b9a['model'],_0x3b6b9a[_0x1e21('0x31')]);_0x3af785['attributes']=_[_0x1e21('0x33')](_0x3b6b9a['model'],qs['fields'](_0xe54ffa['query'][_0x1e21('0x36')]));_0x3af785[_0x1e21('0x34')]=_0x3af785[_0x1e21('0x34')]['length']?_0x3af785[_0x1e21('0x34')]:_0x3b6b9a[_0x1e21('0x35')];if(!_0xe54ffa[_0x1e21('0x31')][_0x1e21('0x57')](_0x1e21('0x5c'))){_0x3af785[_0x1e21('0x1b')]=qs[_0x1e21('0x1b')](_0xe54ffa[_0x1e21('0x31')][_0x1e21('0x1b')]);_0x3af785[_0x1e21('0x1c')]=qs[_0x1e21('0x1c')](_0xe54ffa[_0x1e21('0x31')][_0x1e21('0x1c')]);}_0x3af785[_0x1e21('0x38')]=qs[_0x1e21('0x39')](_0xe54ffa[_0x1e21('0x31')][_0x1e21('0x39')]);_0x3af785[_0x1e21('0x3a')]=qs[_0x1e21('0x32')](_[_0x1e21('0x3b')](_0xe54ffa[_0x1e21('0x31')],_0x3b6b9a[_0x1e21('0x32')]));_0x3af785['where'][_0x1e21('0x5d')]=_0x35c43f['id'];if(_0xe54ffa[_0x1e21('0x31')]['filter']){_0x3af785[_0x1e21('0x3a')]=_[_0x1e21('0x3d')](_0x3af785[_0x1e21('0x3a')],{'$or':_[_0x1e21('0x2b')](_0x3af785['attributes'],function(_0x2e3d82){var _0x5a6695={};_0x5a6695[_0x2e3d82]={'$like':'%'+_0xe54ffa[_0x1e21('0x31')][_0x1e21('0x3c')]+'%'};return _0x5a6695;})});}_0x3af785=_['merge']({},_0x3af785,_0xe54ffa[_0x1e21('0x3e')]);return db[_0x1e21('0x5b')]['count']({'where':_0x3af785['where']})[_0x1e21('0x22')](function(_0x1f437a){_0x533575[_0x1e21('0x3f')]=_0x1f437a;if(_0xe54ffa[_0x1e21('0x31')][_0x1e21('0x40')]){_0x3af785[_0x1e21('0x41')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x1e21('0x58')](_0x3af785);})[_0x1e21('0x22')](function(_0x174a96){_0x533575['rows']=_0x174a96;return _0x533575;});}})[_0x1e21('0x22')](respondWithFilteredResult(_0x202f38,_0x3af785))[_0x1e21('0x4e')](handleError(_0x202f38,null));};function char(_0x440d55){return'number'===typeof _0x440d55?String[_0x1e21('0x5e')][_0x1e21('0x1f')](null,arguments):_0x440d55;}function needsEncapsulation(_0x4ba98d){return!!_0x4ba98d&&(_0x4ba98d[_0x1e21('0x5f')]()[_0x1e21('0x60')](char(0xd))>=0x0||_0x4ba98d[_0x1e21('0x5f')]()[_0x1e21('0x60')](char(0xa))>=0x0||_0x4ba98d[_0x1e21('0x5f')]()[_0x1e21('0x60')](char(0x2c))>=0x0||_0x4ba98d[_0x1e21('0x5f')]()[_0x1e21('0x60')](char(0x22))>=0x0);}function encapsulate(_0x463f1d){var _0x27527e=char(0x22),_0x4e17e0='\x5c'+char(0x22),_0x7b8d08=_0x463f1d['toString']()[_0x1e21('0x61')](new RegExp(_0x27527e,'g'),_0x4e17e0);return _0x27527e+_0x7b8d08+_0x27527e;}exports[_0x1e21('0x62')]=function(_0x3df6e4,_0x572b6f,_0x31ea6d){var _0x49763c,_0xe3c880;var _0x4acb5d={'where':{'ProjectId':_0x3df6e4['params']['id']}};if(_0x3df6e4[_0x1e21('0x31')][_0x1e21('0x63')]){_0x4acb5d[_0x1e21('0x3a')][_0x1e21('0x64')]=JSON[_0x1e21('0x65')](_0x3df6e4['query'][_0x1e21('0x63')]);}return db[_0x1e21('0x56')][_0x1e21('0x58')](_0x4acb5d)[_0x1e21('0x22')](handleEntityNotFound(_0x572b6f,null))['then'](function(_0x407d49){if(_0x407d49){_0x49763c=_0x407d49;return db[_0x1e21('0x66')][_0x1e21('0x58')]({'where':{'SessionId':{'$in':_[_0x1e21('0x2b')](_0x49763c,'id')},'ProjectId':_0x3df6e4[_0x1e21('0x45')]['id']},'order':_0x1e21('0x67')});}})[_0x1e21('0x22')](handleEntityNotFound(_0x572b6f,null))['then'](function(_0xb351df){if(_0xb351df){_0xe3c880=_0xb351df;var _0x541a07={};for(var _0x17f4c1=0x0,_0x94e3bf=_0xe3c880[_0x1e21('0x37')];_0x17f4c1<_0x94e3bf;_0x17f4c1++){if(!_0x541a07['hasOwnProperty'](_0xe3c880[_0x17f4c1][_0x1e21('0x68')])){_0x541a07[_0xe3c880[_0x17f4c1][_0x1e21('0x68')]]=needsEncapsulation(_0xe3c880[_0x17f4c1][_0x1e21('0x69')])?encapsulate(_0xe3c880[_0x17f4c1][_0x1e21('0x69')]):_0xe3c880[_0x17f4c1][_0x1e21('0x69')];}}var _0x2dac5e=[],_0xea9812={};for(var _0x5a5a47=0x0,_0x4d5e67=_0x49763c[_0x1e21('0x37')];_0x5a5a47<_0x4d5e67;_0x5a5a47++){_0xea9812={'ProjectId':_0x3df6e4[_0x1e21('0x45')]['id'],'SessionId':_0x49763c[_0x5a5a47]['id'],'StartTime':moment(_0x49763c[_0x5a5a47]['starttime'])[_0x1e21('0x6a')](_0x1e21('0x6b'))};for(var _0xc3f370=0x0,_0x2ff259=_0xe3c880[_0x1e21('0x37')];_0xc3f370<_0x2ff259;_0xc3f370++){if(_0xe3c880[_0xc3f370][_0x1e21('0x6c')]==_0x49763c[_0x5a5a47]['id']&&_0x541a07['hasOwnProperty'](_0xe3c880[_0xc3f370]['questionId'])){_0xea9812[_0x541a07[_0xe3c880[_0xc3f370][_0x1e21('0x68')]]]=_0xe3c880[_0xc3f370][_0x1e21('0x6d')];}}for(var _0x19f9bb in _0x541a07){if(!_0xea9812[_0x1e21('0x57')](_0x541a07[_0x19f9bb])){_0xea9812[_0x541a07[_0x19f9bb]]=null;}}_0x2dac5e[_0x1e21('0x6e')](_0xea9812);}return _0x2dac5e;}})[_0x1e21('0x22')](function(_0x53f63b){if(!_[_0x1e21('0x6f')](_0x53f63b)){var _0xf5aea3=toCsv(_0x53f63b);var _0x58c56a=Date[_0x1e21('0x70')]();fs[_0x1e21('0x71')](util[_0x1e21('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3df6e4[_0x1e21('0x45')]['id'],_0x58c56a),_0xf5aea3);_0x572b6f[_0x1e21('0x72')]('Content-disposition',_0x1e21('0x73')+util[_0x1e21('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x3df6e4[_0x1e21('0x45')]['id'],_0x58c56a));_0x572b6f[_0x1e21('0x72')](_0x1e21('0x74'),'text/csv');return _0x572b6f['download'](util[_0x1e21('0x6a')](_0x1e21('0x75'),_0x3df6e4[_0x1e21('0x45')]['id'],_0x58c56a));}else{return _0x572b6f[_0x1e21('0x17')](0xcc);}})[_0x1e21('0x4e')](handleError(_0x572b6f,null));}; \ No newline at end of file +var _0xf4f2=['filter','merge','JscriptyProject','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','updatedAt','autoAssociation','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','options','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','question','starttime','format','SessionId','questionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','eml-format','rimraf','fast-json-patch','request-promise','bluebird','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','Projects','UserProfileResource','end','error','stack','name','send','index','map','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf4f2,0x12e));var _0x2f4f=function(_0x56a184,_0x20446a){_0x56a184=_0x56a184-0x0;var _0x372900=_0xf4f2[_0x56a184];return _0x372900;};'use strict';var emlformat=require(_0x2f4f('0x0'));var rimraf=require(_0x2f4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2f4f('0x2'));var rp=require(_0x2f4f('0x3'));var moment=require('moment');var BPromise=require(_0x2f4f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2f4f('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f4f('0x6'));var _=require(_0x2f4f('0x7'));var squel=require('squel');var crypto=require(_0x2f4f('0x8'));var jsforce=require(_0x2f4f('0x9'));var deskjs=require(_0x2f4f('0xa'));var toCsv=require(_0x2f4f('0xb'));var querystring=require(_0x2f4f('0xc'));var Papa=require(_0x2f4f('0xd'));var Redis=require(_0x2f4f('0xe'));var authService=require(_0x2f4f('0xf'));var qs=require(_0x2f4f('0x10'));var as=require(_0x2f4f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f4f('0x12'))(_0x2f4f('0x13'));var utils=require(_0x2f4f('0x14'));var config=require(_0x2f4f('0x15'));var licenseUtil=require(_0x2f4f('0x16'));var db=require(_0x2f4f('0x17'))['db'];function respondWithStatusCode(_0x2c71b1,_0x42fccb){_0x42fccb=_0x42fccb||0xcc;return function(_0xca4e5){if(_0xca4e5){return _0x2c71b1[_0x2f4f('0x18')](_0x42fccb);}return _0x2c71b1[_0x2f4f('0x19')](_0x42fccb)['end']();};}function respondWithResult(_0xc286f1,_0x476afd){_0x476afd=_0x476afd||0xc8;return function(_0x5aae4c){if(_0x5aae4c){return _0xc286f1[_0x2f4f('0x19')](_0x476afd)['json'](_0x5aae4c);}};}function respondWithFilteredResult(_0x3668c0,_0x50fa62){return function(_0x4f09ad){if(_0x4f09ad){var _0xf27c75=typeof _0x50fa62[_0x2f4f('0x1a')]==='undefined'&&typeof _0x50fa62[_0x2f4f('0x1b')]===_0x2f4f('0x1c');var _0x234536=_0x4f09ad[_0x2f4f('0x1d')];var _0xe9d69b=_0xf27c75?0x0:_0x50fa62['offset'];var _0x1432bf=_0xf27c75?_0x4f09ad[_0x2f4f('0x1d')]:_0x50fa62[_0x2f4f('0x1a')]+_0x50fa62['limit'];var _0x41bd29;if(_0x1432bf>=_0x234536){_0x1432bf=_0x234536;_0x41bd29=0xc8;}else{_0x41bd29=0xce;}_0x3668c0[_0x2f4f('0x19')](_0x41bd29);return _0x3668c0[_0x2f4f('0x1e')](_0x2f4f('0x1f'),_0xe9d69b+'-'+_0x1432bf+'/'+_0x234536)['json'](_0x4f09ad);}return null;};}function patchUpdates(_0x2022f9){return function(_0x3a6d7f){try{jsonpatch['apply'](_0x3a6d7f,_0x2022f9,!![]);}catch(_0x7028b7){return BPromise[_0x2f4f('0x20')](_0x7028b7);}return _0x3a6d7f[_0x2f4f('0x21')]();};}function saveUpdates(_0x31feef,_0x196d86){return function(_0x11590){if(_0x11590){return _0x11590[_0x2f4f('0x22')](_0x31feef)[_0x2f4f('0x23')](function(_0x51b4b7){return _0x51b4b7;});}return null;};}function removeEntity(_0x482395,_0xa479b2){return function(_0x451933){if(_0x451933){return _0x451933[_0x2f4f('0x24')]()[_0x2f4f('0x23')](function(){var _0x140749=_0x451933[_0x2f4f('0x25')]({'plain':!![]});var _0x2e8d5b=_0x2f4f('0x26');return db[_0x2f4f('0x27')][_0x2f4f('0x24')]({'where':{'type':_0x2e8d5b,'resourceId':_0x140749['id']}})['then'](function(){return _0x451933;});})[_0x2f4f('0x23')](function(){_0x482395[_0x2f4f('0x19')](0xcc)[_0x2f4f('0x28')]();});}};}function handleEntityNotFound(_0x2452e9,_0x4984cc){return function(_0x44a64c){if(!_0x44a64c){_0x2452e9['sendStatus'](0x194);}return _0x44a64c;};}function handleError(_0x18527d,_0x5c8539){_0x5c8539=_0x5c8539||0x1f4;return function(_0x24e788){logger[_0x2f4f('0x29')](_0x24e788[_0x2f4f('0x2a')]);if(_0x24e788['name']){delete _0x24e788[_0x2f4f('0x2b')];}_0x18527d[_0x2f4f('0x19')](_0x5c8539)[_0x2f4f('0x2c')](_0x24e788);};}exports[_0x2f4f('0x2d')]=function(_0x9a9861,_0x5a666c){var _0x46ce4a={},_0x500e74={},_0x28bdf0={'count':0x0,'rows':[]};var _0x5f5a14=_[_0x2f4f('0x2e')](db['JscriptyProject']['rawAttributes'],function(_0x252a93){return{'name':_0x252a93['fieldName'],'type':_0x252a93[_0x2f4f('0x2f')][_0x2f4f('0x30')]};});_0x500e74[_0x2f4f('0x31')]=_['map'](_0x5f5a14,_0x2f4f('0x2b'));_0x500e74['query']=_['keys'](_0x9a9861[_0x2f4f('0x32')]);_0x500e74[_0x2f4f('0x33')]=_['intersection'](_0x500e74[_0x2f4f('0x31')],_0x500e74[_0x2f4f('0x32')]);_0x46ce4a[_0x2f4f('0x34')]=_[_0x2f4f('0x35')](_0x500e74[_0x2f4f('0x31')],qs['fields'](_0x9a9861[_0x2f4f('0x32')][_0x2f4f('0x36')]));_0x46ce4a[_0x2f4f('0x34')]=_0x46ce4a['attributes'][_0x2f4f('0x37')]?_0x46ce4a[_0x2f4f('0x34')]:_0x500e74['model'];if(!_0x9a9861['query'][_0x2f4f('0x38')]('nolimit')){_0x46ce4a[_0x2f4f('0x1b')]=qs[_0x2f4f('0x1b')](_0x9a9861[_0x2f4f('0x32')][_0x2f4f('0x1b')]);_0x46ce4a[_0x2f4f('0x1a')]=qs['offset'](_0x9a9861[_0x2f4f('0x32')]['offset']);}_0x46ce4a[_0x2f4f('0x39')]=qs[_0x2f4f('0x3a')](_0x9a9861[_0x2f4f('0x32')][_0x2f4f('0x3a')]);_0x46ce4a[_0x2f4f('0x3b')]=qs[_0x2f4f('0x33')](_[_0x2f4f('0x3c')](_0x9a9861[_0x2f4f('0x32')],_0x500e74['filters']),_0x5f5a14);if(_0x9a9861[_0x2f4f('0x32')][_0x2f4f('0x3d')]){_0x46ce4a['where']=_[_0x2f4f('0x3e')](_0x46ce4a[_0x2f4f('0x3b')],{'$or':_[_0x2f4f('0x2e')](_0x5f5a14,function(_0x1a35c2){if(_0x1a35c2[_0x2f4f('0x2f')]!=='VIRTUAL'){var _0x49a40e={};_0x49a40e[_0x1a35c2[_0x2f4f('0x2b')]]={'$like':'%'+_0x9a9861[_0x2f4f('0x32')]['filter']+'%'};return _0x49a40e;}})});}_0x46ce4a=_[_0x2f4f('0x3e')]({},_0x46ce4a,_0x9a9861['options']);var _0x3cce66={'where':_0x46ce4a[_0x2f4f('0x3b')]};return db[_0x2f4f('0x3f')][_0x2f4f('0x1d')](_0x3cce66)['then'](function(_0x571adf){_0x28bdf0[_0x2f4f('0x1d')]=_0x571adf;if(_0x9a9861[_0x2f4f('0x32')][_0x2f4f('0x40')]){_0x46ce4a[_0x2f4f('0x41')]=[{'all':!![]}];}return db['JscriptyProject'][_0x2f4f('0x42')](_0x46ce4a);})[_0x2f4f('0x23')](function(_0x2f2191){_0x28bdf0[_0x2f4f('0x43')]=_0x2f2191;return _0x28bdf0;})[_0x2f4f('0x23')](respondWithFilteredResult(_0x5a666c,_0x46ce4a))[_0x2f4f('0x44')](handleError(_0x5a666c,null));};exports[_0x2f4f('0x45')]=function(_0x6e6913,_0xb68d75){var _0x4a25c0={'raw':![],'where':{'id':_0x6e6913[_0x2f4f('0x46')]['id']}},_0x21a363={};_0x21a363[_0x2f4f('0x31')]=_[_0x2f4f('0x47')](db[_0x2f4f('0x3f')]['rawAttributes']);_0x21a363['query']=_['keys'](_0x6e6913[_0x2f4f('0x32')]);_0x21a363[_0x2f4f('0x33')]=_[_0x2f4f('0x35')](_0x21a363[_0x2f4f('0x31')],_0x21a363[_0x2f4f('0x32')]);_0x4a25c0[_0x2f4f('0x34')]=_['intersection'](_0x21a363[_0x2f4f('0x31')],qs[_0x2f4f('0x36')](_0x6e6913[_0x2f4f('0x32')]['fields']));_0x4a25c0[_0x2f4f('0x34')]=_0x4a25c0[_0x2f4f('0x34')][_0x2f4f('0x37')]?_0x4a25c0[_0x2f4f('0x34')]:_0x21a363[_0x2f4f('0x31')];if(_0x6e6913['query'][_0x2f4f('0x40')]){_0x4a25c0[_0x2f4f('0x41')]=[{'all':!![]}];}_0x4a25c0=_[_0x2f4f('0x3e')]({},_0x4a25c0,_0x6e6913['options']);return db['JscriptyProject'][_0x2f4f('0x48')](_0x4a25c0)[_0x2f4f('0x23')](handleEntityNotFound(_0xb68d75,null))['then'](respondWithResult(_0xb68d75,null))[_0x2f4f('0x44')](handleError(_0xb68d75,null));};exports[_0x2f4f('0x49')]=function(_0x5a254a,_0x5c6dc0){return db[_0x2f4f('0x3f')][_0x2f4f('0x49')](_0x5a254a[_0x2f4f('0x4a')],{})[_0x2f4f('0x23')](function(_0x29b5c6){var _0x16204c=_0x5a254a[_0x2f4f('0x4b')][_0x2f4f('0x25')]({'plain':!![]});if(!_0x16204c)throw new Error(_0x2f4f('0x4c'));if(_0x16204c[_0x2f4f('0x4d')]===_0x2f4f('0x4b')){var _0x16d591=_0x29b5c6[_0x2f4f('0x25')]({'plain':!![]});var _0x18844c=_0x2f4f('0x26');return db[_0x2f4f('0x4e')][_0x2f4f('0x48')]({'where':{'name':_0x18844c,'userProfileId':_0x16204c[_0x2f4f('0x4f')]},'raw':!![]})[_0x2f4f('0x23')](function(_0x5cd4c9){if(_0x5cd4c9&&_0x5cd4c9['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16d591[_0x2f4f('0x2b')],'resourceId':_0x16d591['id'],'type':_0x5cd4c9[_0x2f4f('0x2b')],'sectionId':_0x5cd4c9['id']},{})[_0x2f4f('0x23')](function(){return _0x29b5c6;});}else{return _0x29b5c6;}})[_0x2f4f('0x44')](function(_0x2e130c){logger[_0x2f4f('0x29')](_0x2f4f('0x50'),_0x2e130c);throw _0x2e130c;});}return _0x29b5c6;})[_0x2f4f('0x23')](respondWithResult(_0x5c6dc0,0xc9))[_0x2f4f('0x44')](handleError(_0x5c6dc0,null));};exports[_0x2f4f('0x51')]=function(_0x108fe3,_0x1efae0){var _0x777238={'where':{'id':_0x108fe3[_0x2f4f('0x46')]['id']}},_0x1e4e3c={};_0x1e4e3c[_0x2f4f('0x31')]=_['keys'](db[_0x2f4f('0x3f')][_0x2f4f('0x52')]);_0x777238[_0x2f4f('0x34')]=_[_0x2f4f('0x35')](_0x1e4e3c[_0x2f4f('0x31')],qs['fields'](_0x108fe3[_0x2f4f('0x32')][_0x2f4f('0x36')]));_0x777238[_0x2f4f('0x34')]=_0x777238[_0x2f4f('0x34')][_0x2f4f('0x37')]?_0x777238[_0x2f4f('0x34')]:_0x1e4e3c['model'];if(_0x108fe3['query'][_0x2f4f('0x40')]){_0x777238[_0x2f4f('0x41')]=[{'all':!![]}];}_0x777238=_['merge']({},_0x777238,_0x108fe3['options']);return db[_0x2f4f('0x3f')]['find'](_0x777238)[_0x2f4f('0x23')](handleEntityNotFound(_0x1efae0,null))[_0x2f4f('0x23')](function(_0x32ebdd){if(_0x32ebdd){var _0x47ef31=_0x32ebdd['get']({'plain':!![]});_0x47ef31=qs[_0x2f4f('0x53')](_0x47ef31,['id','createdAt',_0x2f4f('0x54')]);_0x108fe3[_0x2f4f('0x4a')]=_[_0x2f4f('0x53')](_0x108fe3[_0x2f4f('0x4a')],['id','createdAt',_0x2f4f('0x54')]);return db['JscriptyProject'][_0x2f4f('0x49')](_[_0x2f4f('0x3e')](_0x47ef31,_0x108fe3['body']),{'include':_0x108fe3[_0x2f4f('0x32')][_0x2f4f('0x40')]?[{'all':!![]}]:undefined})[_0x2f4f('0x23')](function(_0x3120d3){var _0x55e94f=_0x108fe3[_0x2f4f('0x4b')][_0x2f4f('0x25')]({'plain':!![]});if(!_0x55e94f)throw new Error(_0x2f4f('0x4c'));if(_0x55e94f[_0x2f4f('0x4d')]===_0x2f4f('0x4b')){var _0x3d8c4e=_0x3120d3[_0x2f4f('0x25')]({'plain':!![]});var _0x5ea5f0=_0x2f4f('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x5ea5f0,'userProfileId':_0x55e94f[_0x2f4f('0x4f')]},'raw':!![]})[_0x2f4f('0x23')](function(_0x457744){if(_0x457744&&_0x457744[_0x2f4f('0x55')]===0x0){return db[_0x2f4f('0x27')]['create']({'name':_0x3d8c4e[_0x2f4f('0x2b')],'resourceId':_0x3d8c4e['id'],'type':_0x457744[_0x2f4f('0x2b')],'sectionId':_0x457744['id']},{})[_0x2f4f('0x23')](function(){return _0x3120d3;});}else{return _0x3120d3;}})['catch'](function(_0x471dd3){logger[_0x2f4f('0x29')](_0x2f4f('0x50'),_0x471dd3);throw _0x471dd3;});}return _0x3120d3;});}})[_0x2f4f('0x23')](respondWithResult(_0x1efae0,0xc9))['catch'](handleError(_0x1efae0,null));};exports[_0x2f4f('0x22')]=function(_0x1cfb42,_0x223a33){if(_0x1cfb42[_0x2f4f('0x4a')]['id']){delete _0x1cfb42[_0x2f4f('0x4a')]['id'];}return db[_0x2f4f('0x3f')][_0x2f4f('0x48')]({'where':{'id':_0x1cfb42[_0x2f4f('0x46')]['id']}})[_0x2f4f('0x23')](handleEntityNotFound(_0x223a33,null))[_0x2f4f('0x23')](saveUpdates(_0x1cfb42['body'],null))[_0x2f4f('0x23')](respondWithResult(_0x223a33,null))[_0x2f4f('0x44')](handleError(_0x223a33,null));};exports[_0x2f4f('0x24')]=function(_0x53ba34,_0x1d6ad4){return db[_0x2f4f('0x3f')][_0x2f4f('0x48')]({'where':{'id':_0x53ba34[_0x2f4f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d6ad4,null))[_0x2f4f('0x23')](removeEntity(_0x1d6ad4,null))[_0x2f4f('0x44')](handleError(_0x1d6ad4,null));};exports[_0x2f4f('0x56')]=function(_0x31ac8a,_0x294068,_0x42805f){var _0x56d7b1={'raw':!![],'where':{}};var _0x3d53b5={};var _0x2b46cf={'count':0x0,'rows':[]};return db[_0x2f4f('0x3f')][_0x2f4f('0x57')]({'where':{'id':_0x31ac8a[_0x2f4f('0x46')]['id']}})[_0x2f4f('0x23')](handleEntityNotFound(_0x294068,null))[_0x2f4f('0x23')](function(_0x51eeb0){if(_0x51eeb0){_0x3d53b5['model']=_['keys'](db[_0x2f4f('0x58')]['rawAttributes']);_0x3d53b5[_0x2f4f('0x32')]=_['keys'](_0x31ac8a['query']);_0x3d53b5['filters']=_[_0x2f4f('0x35')](_0x3d53b5[_0x2f4f('0x31')],_0x3d53b5[_0x2f4f('0x32')]);_0x56d7b1['attributes']=_[_0x2f4f('0x35')](_0x3d53b5[_0x2f4f('0x31')],qs[_0x2f4f('0x36')](_0x31ac8a[_0x2f4f('0x32')]['fields']));_0x56d7b1[_0x2f4f('0x34')]=_0x56d7b1[_0x2f4f('0x34')][_0x2f4f('0x37')]?_0x56d7b1[_0x2f4f('0x34')]:_0x3d53b5[_0x2f4f('0x31')];if(!_0x31ac8a['query'][_0x2f4f('0x38')](_0x2f4f('0x59'))){_0x56d7b1[_0x2f4f('0x1b')]=qs[_0x2f4f('0x1b')](_0x31ac8a['query']['limit']);_0x56d7b1[_0x2f4f('0x1a')]=qs['offset'](_0x31ac8a[_0x2f4f('0x32')]['offset']);}_0x56d7b1[_0x2f4f('0x39')]=qs[_0x2f4f('0x3a')](_0x31ac8a[_0x2f4f('0x32')]['sort']);_0x56d7b1[_0x2f4f('0x3b')]=qs[_0x2f4f('0x33')](_[_0x2f4f('0x3c')](_0x31ac8a[_0x2f4f('0x32')],_0x3d53b5[_0x2f4f('0x33')]));_0x56d7b1[_0x2f4f('0x3b')][_0x2f4f('0x5a')]=_0x51eeb0['id'];if(_0x31ac8a[_0x2f4f('0x32')][_0x2f4f('0x3d')]){_0x56d7b1[_0x2f4f('0x3b')]=_[_0x2f4f('0x3e')](_0x56d7b1[_0x2f4f('0x3b')],{'$or':_['map'](_0x56d7b1[_0x2f4f('0x34')],function(_0x5b76e8){var _0x3b151d={};_0x3b151d[_0x5b76e8]={'$like':'%'+_0x31ac8a[_0x2f4f('0x32')][_0x2f4f('0x3d')]+'%'};return _0x3b151d;})});}_0x56d7b1=_[_0x2f4f('0x3e')]({},_0x56d7b1,_0x31ac8a[_0x2f4f('0x5b')]);return db['JscriptySessionReport']['count']({'where':_0x56d7b1['where']})[_0x2f4f('0x23')](function(_0x5f0ca5){_0x2b46cf[_0x2f4f('0x1d')]=_0x5f0ca5;if(_0x31ac8a[_0x2f4f('0x32')][_0x2f4f('0x40')]){_0x56d7b1[_0x2f4f('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x2f4f('0x42')](_0x56d7b1);})[_0x2f4f('0x23')](function(_0x14925a){_0x2b46cf[_0x2f4f('0x43')]=_0x14925a;return _0x2b46cf;});}})[_0x2f4f('0x23')](respondWithFilteredResult(_0x294068,_0x56d7b1))[_0x2f4f('0x44')](handleError(_0x294068,null));};exports[_0x2f4f('0x5c')]=function(_0x59aa8e,_0x15a10c,_0x4ea163){var _0x30d2a6={'raw':!![],'where':{}};var _0x5b23bb={};var _0x3a940b={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x2f4f('0x57')]({'where':{'id':_0x59aa8e[_0x2f4f('0x46')]['id']}})[_0x2f4f('0x23')](handleEntityNotFound(_0x15a10c,null))[_0x2f4f('0x23')](function(_0x32a7a9){if(_0x32a7a9){_0x5b23bb[_0x2f4f('0x31')]=_['keys'](db[_0x2f4f('0x5d')][_0x2f4f('0x52')]);_0x5b23bb[_0x2f4f('0x32')]=_[_0x2f4f('0x47')](_0x59aa8e[_0x2f4f('0x32')]);_0x5b23bb[_0x2f4f('0x33')]=_['intersection'](_0x5b23bb[_0x2f4f('0x31')],_0x5b23bb[_0x2f4f('0x32')]);_0x30d2a6['attributes']=_[_0x2f4f('0x35')](_0x5b23bb[_0x2f4f('0x31')],qs[_0x2f4f('0x36')](_0x59aa8e[_0x2f4f('0x32')][_0x2f4f('0x36')]));_0x30d2a6[_0x2f4f('0x34')]=_0x30d2a6['attributes'][_0x2f4f('0x37')]?_0x30d2a6[_0x2f4f('0x34')]:_0x5b23bb[_0x2f4f('0x31')];if(!_0x59aa8e[_0x2f4f('0x32')][_0x2f4f('0x38')](_0x2f4f('0x59'))){_0x30d2a6[_0x2f4f('0x1b')]=qs[_0x2f4f('0x1b')](_0x59aa8e[_0x2f4f('0x32')][_0x2f4f('0x1b')]);_0x30d2a6[_0x2f4f('0x1a')]=qs[_0x2f4f('0x1a')](_0x59aa8e[_0x2f4f('0x32')][_0x2f4f('0x1a')]);}_0x30d2a6[_0x2f4f('0x39')]=qs[_0x2f4f('0x3a')](_0x59aa8e[_0x2f4f('0x32')]['sort']);_0x30d2a6[_0x2f4f('0x3b')]=qs[_0x2f4f('0x33')](_[_0x2f4f('0x3c')](_0x59aa8e['query'],_0x5b23bb[_0x2f4f('0x33')]));_0x30d2a6[_0x2f4f('0x3b')][_0x2f4f('0x5a')]=_0x32a7a9['id'];if(_0x59aa8e['query'][_0x2f4f('0x3d')]){_0x30d2a6[_0x2f4f('0x3b')]=_[_0x2f4f('0x3e')](_0x30d2a6[_0x2f4f('0x3b')],{'$or':_[_0x2f4f('0x2e')](_0x30d2a6[_0x2f4f('0x34')],function(_0x174d47){var _0x53bb17={};_0x53bb17[_0x174d47]={'$like':'%'+_0x59aa8e['query'][_0x2f4f('0x3d')]+'%'};return _0x53bb17;})});}_0x30d2a6=_[_0x2f4f('0x3e')]({},_0x30d2a6,_0x59aa8e[_0x2f4f('0x5b')]);return db[_0x2f4f('0x5d')][_0x2f4f('0x1d')]({'where':_0x30d2a6[_0x2f4f('0x3b')]})['then'](function(_0x418de4){_0x3a940b[_0x2f4f('0x1d')]=_0x418de4;if(_0x59aa8e[_0x2f4f('0x32')][_0x2f4f('0x40')]){_0x30d2a6[_0x2f4f('0x41')]=[{'all':!![]}];}return db[_0x2f4f('0x5d')][_0x2f4f('0x42')](_0x30d2a6);})['then'](function(_0x1b0b67){_0x3a940b['rows']=_0x1b0b67;return _0x3a940b;});}})[_0x2f4f('0x23')](respondWithFilteredResult(_0x15a10c,_0x30d2a6))[_0x2f4f('0x44')](handleError(_0x15a10c,null));};function char(_0x4da623){return _0x2f4f('0x5e')===typeof _0x4da623?String[_0x2f4f('0x5f')][_0x2f4f('0x60')](null,arguments):_0x4da623;}function needsEncapsulation(_0x18447e){return!!_0x18447e&&(_0x18447e[_0x2f4f('0x61')]()[_0x2f4f('0x62')](char(0xd))>=0x0||_0x18447e[_0x2f4f('0x61')]()[_0x2f4f('0x62')](char(0xa))>=0x0||_0x18447e['toString']()['indexOf'](char(0x2c))>=0x0||_0x18447e['toString']()[_0x2f4f('0x62')](char(0x22))>=0x0);}function encapsulate(_0x2282a4){var _0x400f7b=char(0x22),_0x2aa7d1='\x5c'+char(0x22),_0x4edcd0=_0x2282a4['toString']()[_0x2f4f('0x63')](new RegExp(_0x400f7b,'g'),_0x2aa7d1);return _0x400f7b+_0x4edcd0+_0x400f7b;}exports[_0x2f4f('0x64')]=function(_0x46c9b8,_0x5ca737,_0x12f443){var _0x1c918c,_0x29c963;var _0x54d9ef={'where':{'ProjectId':_0x46c9b8['params']['id']}};if(_0x46c9b8[_0x2f4f('0x32')][_0x2f4f('0x65')]){_0x54d9ef[_0x2f4f('0x3b')]['starttime']=JSON[_0x2f4f('0x66')](_0x46c9b8[_0x2f4f('0x32')][_0x2f4f('0x65')]);}return db[_0x2f4f('0x58')][_0x2f4f('0x42')](_0x54d9ef)[_0x2f4f('0x23')](handleEntityNotFound(_0x5ca737,null))['then'](function(_0x1edc94){if(_0x1edc94){_0x1c918c=_0x1edc94;return db[_0x2f4f('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0x2f4f('0x2e')](_0x1c918c,'id')},'ProjectId':_0x46c9b8['params']['id']},'order':_0x2f4f('0x68')});}})['then'](handleEntityNotFound(_0x5ca737,null))[_0x2f4f('0x23')](function(_0x147b1b){if(_0x147b1b){_0x29c963=_0x147b1b;var _0x31c6e1={};for(var _0x10a945=0x0,_0xacb717=_0x29c963['length'];_0x10a945<_0xacb717;_0x10a945++){if(!_0x31c6e1[_0x2f4f('0x38')](_0x29c963[_0x10a945]['questionId'])){_0x31c6e1[_0x29c963[_0x10a945]['questionId']]=needsEncapsulation(_0x29c963[_0x10a945][_0x2f4f('0x69')])?encapsulate(_0x29c963[_0x10a945][_0x2f4f('0x69')]):_0x29c963[_0x10a945][_0x2f4f('0x69')];}}var _0x243ebe=[],_0x1aa593={};for(var _0x29523d=0x0,_0x1b70b1=_0x1c918c[_0x2f4f('0x37')];_0x29523d<_0x1b70b1;_0x29523d++){_0x1aa593={'ProjectId':_0x46c9b8[_0x2f4f('0x46')]['id'],'SessionId':_0x1c918c[_0x29523d]['id'],'StartTime':moment(_0x1c918c[_0x29523d][_0x2f4f('0x6a')])[_0x2f4f('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x48a221=0x0,_0x2b6fbf=_0x29c963[_0x2f4f('0x37')];_0x48a221<_0x2b6fbf;_0x48a221++){if(_0x29c963[_0x48a221][_0x2f4f('0x6c')]==_0x1c918c[_0x29523d]['id']&&_0x31c6e1[_0x2f4f('0x38')](_0x29c963[_0x48a221]['questionId'])){_0x1aa593[_0x31c6e1[_0x29c963[_0x48a221][_0x2f4f('0x6d')]]]=_0x29c963[_0x48a221][_0x2f4f('0x6e')];}}for(var _0x47ff06 in _0x31c6e1){if(!_0x1aa593[_0x2f4f('0x38')](_0x31c6e1[_0x47ff06])){_0x1aa593[_0x31c6e1[_0x47ff06]]=null;}}_0x243ebe[_0x2f4f('0x6f')](_0x1aa593);}return _0x243ebe;}})[_0x2f4f('0x23')](function(_0x1aa4a6){if(!_[_0x2f4f('0x70')](_0x1aa4a6)){var _0x317b1a=toCsv(_0x1aa4a6);var _0x59e6bb=Date[_0x2f4f('0x71')]();fs[_0x2f4f('0x72')](util[_0x2f4f('0x6b')](_0x2f4f('0x73'),_0x46c9b8['params']['id'],_0x59e6bb),_0x317b1a);_0x5ca737[_0x2f4f('0x74')]('Content-disposition',_0x2f4f('0x75')+util['format'](_0x2f4f('0x76'),_0x46c9b8[_0x2f4f('0x46')]['id'],_0x59e6bb));_0x5ca737[_0x2f4f('0x74')](_0x2f4f('0x77'),_0x2f4f('0x78'));return _0x5ca737['download'](util[_0x2f4f('0x6b')](_0x2f4f('0x73'),_0x46c9b8[_0x2f4f('0x46')]['id'],_0x59e6bb));}else{return _0x5ca737['sendStatus'](0xcc);}})[_0x2f4f('0x44')](handleError(_0x5ca737,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 0af05b9..8c2487c 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 _0xe198=['define','JscriptyProject','jscripty_projects','lodash','util','moment','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','exports'];(function(_0x16ac69,_0x1ae811){var _0x1c98f5=function(_0x18a188){while(--_0x18a188){_0x16ac69['push'](_0x16ac69['shift']());}};_0x1c98f5(++_0x1ae811);}(_0xe198,0x6f));var _0x8e19=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe198[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x8e19('0x0'));var util=require(_0x8e19('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8e19('0x2'));var BPromise=require(_0x8e19('0x3'));var rp=require(_0x8e19('0x4'));var fs=require('fs');var path=require(_0x8e19('0x5'));var rimraf=require(_0x8e19('0x6'));var config=require('../../config/environment');var attributes=require(_0x8e19('0x7'));module[_0x8e19('0x8')]=function(_0x2fb138,_0x188ce0){return _0x2fb138[_0x8e19('0x9')](_0x8e19('0xa'),attributes,{'tableName':_0x8e19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5162=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash'];(function(_0x4283e8,_0x3adec4){var _0x4c598f=function(_0x35acc2){while(--_0x35acc2){_0x4283e8['push'](_0x4283e8['shift']());}};_0x4c598f(++_0x3adec4);}(_0x5162,0x103));var _0x2516=function(_0x3520a3,_0x585b4e){_0x3520a3=_0x3520a3-0x0;var _0x266257=_0x5162[_0x3520a3];return _0x266257;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2516('0x1'));var rp=require(_0x2516('0x2'));var fs=require('fs');var path=require(_0x2516('0x3'));var rimraf=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var attributes=require(_0x2516('0x6'));module[_0x2516('0x7')]=function(_0x5b71b5,_0x48f411){return _0x5b71b5['define'](_0x2516('0x8'),attributes,{'tableName':_0x2516('0x9'),'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 7b75f01..07e7417 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 _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x185b05,_0x4b400a){var _0x224828=function(_0x168f55){while(--_0x168f55){_0x185b05['push'](_0x185b05['shift']());}};_0x224828(++_0x4b400a);}(_0x70e0,0x17b));var _0x070e=function(_0x193f9b,_0x3c630a){_0x193f9b=_0x193f9b-0x0;var _0xcdb8b4=_0x70e0[_0x193f9b];return _0xcdb8b4;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xac4a,0x13f));var _0xaac4=function(_0x364e65,_0x1d3451){_0x364e65=_0x364e65-0x0;var _0x288eaa=_0xac4a[_0x364e65];return _0x288eaa;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 7770453..49fa971 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 _0x13ad=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0x13ad,0x189));var _0xd13a=function(_0x2df5da,_0x281c72){_0x2df5da=_0x2df5da-0x0;var _0x340d4c=_0x13ad[_0x2df5da];return _0x340d4c;};'use strict';var multer=require(_0xd13a('0x0'));var util=require(_0xd13a('0x1'));var path=require(_0xd13a('0x2'));var timeout=require('connect-timeout');var express=require(_0xd13a('0x3'));var router=express[_0xd13a('0x4')]();var fs_extra=require(_0xd13a('0x5'));var auth=require(_0xd13a('0x6'));var interaction=require(_0xd13a('0x7'));var config=require('../../config/environment');var controller=require(_0xd13a('0x8'));router[_0xd13a('0x9')]('/',auth[_0xd13a('0xa')](),controller[_0xd13a('0xb')]);router[_0xd13a('0x9')](_0xd13a('0xc'),auth[_0xd13a('0xa')](),controller[_0xd13a('0xd')]);router['get'](_0xd13a('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xd13a('0xf')]('/',auth[_0xd13a('0xa')](),controller[_0xd13a('0x10')]);router[_0xd13a('0x11')](_0xd13a('0xe'),auth[_0xd13a('0xa')](),controller[_0xd13a('0x12')]);router[_0xd13a('0x13')](_0xd13a('0xe'),auth[_0xd13a('0xa')](),controller[_0xd13a('0x14')]);module[_0xd13a('0x15')]=router; \ No newline at end of file +var _0x4688=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','index','/describe','describe','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x8c2bb1,_0x103666){var _0x27bfde=function(_0x404dfb){while(--_0x404dfb){_0x8c2bb1['push'](_0x8c2bb1['shift']());}};_0x27bfde(++_0x103666);}(_0x4688,0x14d));var _0x8468=function(_0x50c7d6,_0x43aaed){_0x50c7d6=_0x50c7d6-0x0;var _0x4e1b11=_0x4688[_0x50c7d6];return _0x4e1b11;};'use strict';var multer=require(_0x8468('0x0'));var util=require(_0x8468('0x1'));var path=require(_0x8468('0x2'));var timeout=require(_0x8468('0x3'));var express=require(_0x8468('0x4'));var router=express[_0x8468('0x5')]();var fs_extra=require(_0x8468('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8468('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0x8468('0x8')]('/',auth['isAuthenticated'](),controller[_0x8468('0x9')]);router[_0x8468('0x8')](_0x8468('0xa'),auth['isAuthenticated'](),controller[_0x8468('0xb')]);router['get'](_0x8468('0xc'),auth[_0x8468('0xd')](),controller[_0x8468('0xe')]);router[_0x8468('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8468('0x10')](_0x8468('0xc'),auth[_0x8468('0xd')](),controller[_0x8468('0x11')]);router[_0x8468('0x12')]('/:id',auth[_0x8468('0xd')](),controller[_0x8468('0x13')]);module[_0x8468('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 5bf6d95..32da077 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x4fcf88,_0x1f1717){_0x4fcf88=_0x4fcf88-0x0;var _0x7018b8=_0x7a54[_0x4fcf88];return _0x7018b8;};'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(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x7a54,0x106));var _0x47a5=function(_0x3b21a6,_0x50f337){_0x3b21a6=_0x3b21a6-0x0;var _0x34dfca=_0x7a54[_0x3b21a6];return _0x34dfca;};'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 ce4a5d9..732553b 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 _0xbdc4=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','reject','save','update','error','stack','name','send','index','map','JscriptyQuestionReport','type','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','then','includeAll','include','rows','catch','rawAttributes','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2b27ff,_0x269d70){var _0xc85af5=function(_0x56c95d){while(--_0x56c95d){_0x2b27ff['push'](_0x2b27ff['shift']());}};_0xc85af5(++_0x269d70);}(_0xbdc4,0x81));var _0x4bdc=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xbdc4[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0x4bdc('0x0'));var rimraf=require(_0x4bdc('0x1'));var zipdir=require(_0x4bdc('0x2'));var jsonpatch=require(_0x4bdc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4bdc('0x4'));var Mustache=require('mustache');var util=require(_0x4bdc('0x5'));var path=require(_0x4bdc('0x6'));var sox=require(_0x4bdc('0x7'));var csv=require(_0x4bdc('0x8'));var ejs=require(_0x4bdc('0x9'));var fs=require('fs');var fs_extra=require(_0x4bdc('0xa'));var _=require(_0x4bdc('0xb'));var squel=require(_0x4bdc('0xc'));var crypto=require(_0x4bdc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4bdc('0xe'));var toCsv=require(_0x4bdc('0x8'));var querystring=require(_0x4bdc('0xf'));var Papa=require('papaparse');var Redis=require(_0x4bdc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4bdc('0x11'));var hardwareService=require(_0x4bdc('0x12'));var logger=require(_0x4bdc('0x13'))(_0x4bdc('0x14'));var utils=require(_0x4bdc('0x15'));var config=require(_0x4bdc('0x16'));var licenseUtil=require(_0x4bdc('0x17'));var db=require(_0x4bdc('0x18'))['db'];function respondWithStatusCode(_0x16bf4a,_0x509e6b){_0x509e6b=_0x509e6b||0xcc;return function(_0x4e0883){if(_0x4e0883){return _0x16bf4a[_0x4bdc('0x19')](_0x509e6b);}return _0x16bf4a[_0x4bdc('0x1a')](_0x509e6b)[_0x4bdc('0x1b')]();};}function respondWithResult(_0x44aec1,_0x587d9a){_0x587d9a=_0x587d9a||0xc8;return function(_0x97ee09){if(_0x97ee09){return _0x44aec1[_0x4bdc('0x1a')](_0x587d9a)['json'](_0x97ee09);}};}function respondWithFilteredResult(_0x287be4,_0x23652f){return function(_0x1067e9){if(_0x1067e9){var _0x55d3dd=typeof _0x23652f[_0x4bdc('0x1c')]===_0x4bdc('0x1d')&&typeof _0x23652f['limit']===_0x4bdc('0x1d');var _0x238309=_0x1067e9[_0x4bdc('0x1e')];var _0x5a93e0=_0x55d3dd?0x0:_0x23652f['offset'];var _0x55e790=_0x55d3dd?_0x1067e9[_0x4bdc('0x1e')]:_0x23652f[_0x4bdc('0x1c')]+_0x23652f['limit'];var _0x9f3493;if(_0x55e790>=_0x238309){_0x55e790=_0x238309;_0x9f3493=0xc8;}else{_0x9f3493=0xce;}_0x287be4[_0x4bdc('0x1a')](_0x9f3493);return _0x287be4[_0x4bdc('0x1f')](_0x4bdc('0x20'),_0x5a93e0+'-'+_0x55e790+'/'+_0x238309)[_0x4bdc('0x21')](_0x1067e9);}return null;};}function patchUpdates(_0x3c5b3d){return function(_0x4ad676){try{jsonpatch['apply'](_0x4ad676,_0x3c5b3d,!![]);}catch(_0x871c45){return BPromise[_0x4bdc('0x22')](_0x871c45);}return _0x4ad676[_0x4bdc('0x23')]();};}function saveUpdates(_0x219538,_0x5ef108){return function(_0x19367f){if(_0x19367f){return _0x19367f[_0x4bdc('0x24')](_0x219538)['then'](function(_0x38fa7f){return _0x38fa7f;});}return null;};}function removeEntity(_0x58e8e9,_0x5ab2ee){return function(_0x4eb8aa){if(_0x4eb8aa){return _0x4eb8aa['destroy']()['then'](function(){_0x58e8e9[_0x4bdc('0x1a')](0xcc)[_0x4bdc('0x1b')]();});}};}function handleEntityNotFound(_0x31c258,_0x131948){return function(_0x58273e){if(!_0x58273e){_0x31c258[_0x4bdc('0x19')](0x194);}return _0x58273e;};}function handleError(_0x4debc4,_0x263805){_0x263805=_0x263805||0x1f4;return function(_0x204673){logger[_0x4bdc('0x25')](_0x204673[_0x4bdc('0x26')]);if(_0x204673['name']){delete _0x204673[_0x4bdc('0x27')];}_0x4debc4[_0x4bdc('0x1a')](_0x263805)[_0x4bdc('0x28')](_0x204673);};}exports[_0x4bdc('0x29')]=function(_0x4a0001,_0xa52141){var _0x4269d1={},_0x59157d={},_0x2d960a={'count':0x0,'rows':[]};var _0x9afd61=_[_0x4bdc('0x2a')](db[_0x4bdc('0x2b')]['rawAttributes'],function(_0x71ddf6){return{'name':_0x71ddf6['fieldName'],'type':_0x71ddf6[_0x4bdc('0x2c')][_0x4bdc('0x2d')]};});_0x59157d['model']=_[_0x4bdc('0x2a')](_0x9afd61,_0x4bdc('0x27'));_0x59157d[_0x4bdc('0x2e')]=_[_0x4bdc('0x2f')](_0x4a0001[_0x4bdc('0x2e')]);_0x59157d[_0x4bdc('0x30')]=_['intersection'](_0x59157d[_0x4bdc('0x31')],_0x59157d[_0x4bdc('0x2e')]);_0x4269d1['attributes']=_[_0x4bdc('0x32')](_0x59157d[_0x4bdc('0x31')],qs['fields'](_0x4a0001[_0x4bdc('0x2e')][_0x4bdc('0x33')]));_0x4269d1[_0x4bdc('0x34')]=_0x4269d1[_0x4bdc('0x34')][_0x4bdc('0x35')]?_0x4269d1[_0x4bdc('0x34')]:_0x59157d[_0x4bdc('0x31')];if(!_0x4a0001[_0x4bdc('0x2e')]['hasOwnProperty'](_0x4bdc('0x36'))){_0x4269d1[_0x4bdc('0x37')]=qs[_0x4bdc('0x37')](_0x4a0001[_0x4bdc('0x2e')][_0x4bdc('0x37')]);_0x4269d1[_0x4bdc('0x1c')]=qs[_0x4bdc('0x1c')](_0x4a0001['query'][_0x4bdc('0x1c')]);}_0x4269d1[_0x4bdc('0x38')]=qs['sort'](_0x4a0001[_0x4bdc('0x2e')][_0x4bdc('0x39')]);_0x4269d1['where']=qs[_0x4bdc('0x30')](_[_0x4bdc('0x3a')](_0x4a0001[_0x4bdc('0x2e')],_0x59157d[_0x4bdc('0x30')]),_0x9afd61);if(_0x4a0001['query'][_0x4bdc('0x3b')]){_0x4269d1['where']=_[_0x4bdc('0x3c')](_0x4269d1[_0x4bdc('0x3d')],{'$or':_[_0x4bdc('0x2a')](_0x9afd61,function(_0x29597f){if(_0x29597f[_0x4bdc('0x2c')]!==_0x4bdc('0x3e')){var _0x4bd786={};_0x4bd786[_0x29597f[_0x4bdc('0x27')]]={'$like':'%'+_0x4a0001['query'][_0x4bdc('0x3b')]+'%'};return _0x4bd786;}})});}_0x4269d1=_[_0x4bdc('0x3c')]({},_0x4269d1,_0x4a0001['options']);var _0x33fe03={'where':_0x4269d1[_0x4bdc('0x3d')]};return db[_0x4bdc('0x2b')][_0x4bdc('0x1e')](_0x33fe03)[_0x4bdc('0x3f')](function(_0x165201){_0x2d960a[_0x4bdc('0x1e')]=_0x165201;if(_0x4a0001[_0x4bdc('0x2e')][_0x4bdc('0x40')]){_0x4269d1[_0x4bdc('0x41')]=[{'all':!![]}];}return db[_0x4bdc('0x2b')]['findAll'](_0x4269d1);})[_0x4bdc('0x3f')](function(_0x4fd173){_0x2d960a[_0x4bdc('0x42')]=_0x4fd173;return _0x2d960a;})[_0x4bdc('0x3f')](respondWithFilteredResult(_0xa52141,_0x4269d1))[_0x4bdc('0x43')](handleError(_0xa52141,null));};exports['show']=function(_0xa0f39f,_0x402304){var _0x31481a={'raw':!![],'where':{'id':_0xa0f39f['params']['id']}},_0x23f94a={};_0x23f94a['model']=_[_0x4bdc('0x2f')](db[_0x4bdc('0x2b')][_0x4bdc('0x44')]);_0x23f94a[_0x4bdc('0x2e')]=_[_0x4bdc('0x2f')](_0xa0f39f['query']);_0x23f94a[_0x4bdc('0x30')]=_[_0x4bdc('0x32')](_0x23f94a[_0x4bdc('0x31')],_0x23f94a['query']);_0x31481a[_0x4bdc('0x34')]=_[_0x4bdc('0x32')](_0x23f94a[_0x4bdc('0x31')],qs[_0x4bdc('0x33')](_0xa0f39f[_0x4bdc('0x2e')][_0x4bdc('0x33')]));_0x31481a[_0x4bdc('0x34')]=_0x31481a['attributes']['length']?_0x31481a[_0x4bdc('0x34')]:_0x23f94a[_0x4bdc('0x31')];if(_0xa0f39f['query']['includeAll']){_0x31481a['include']=[{'all':!![]}];}_0x31481a=_['merge']({},_0x31481a,_0xa0f39f['options']);return db['JscriptyQuestionReport'][_0x4bdc('0x45')](_0x31481a)[_0x4bdc('0x3f')](handleEntityNotFound(_0x402304,null))[_0x4bdc('0x3f')](respondWithResult(_0x402304,null))[_0x4bdc('0x43')](handleError(_0x402304,null));};exports[_0x4bdc('0x46')]=function(_0x54da77,_0x455c0b){return db[_0x4bdc('0x2b')]['create'](_0x54da77[_0x4bdc('0x47')],{})[_0x4bdc('0x3f')](respondWithResult(_0x455c0b,0xc9))['catch'](handleError(_0x455c0b,null));};exports[_0x4bdc('0x24')]=function(_0x938551,_0x1123a4){if(_0x938551[_0x4bdc('0x47')]['id']){delete _0x938551[_0x4bdc('0x47')]['id'];}return db[_0x4bdc('0x2b')][_0x4bdc('0x45')]({'where':{'id':_0x938551[_0x4bdc('0x48')]['id']}})['then'](handleEntityNotFound(_0x1123a4,null))[_0x4bdc('0x3f')](saveUpdates(_0x938551[_0x4bdc('0x47')],null))[_0x4bdc('0x3f')](respondWithResult(_0x1123a4,null))[_0x4bdc('0x43')](handleError(_0x1123a4,null));};exports[_0x4bdc('0x49')]=function(_0x213fd9,_0x38dcda){return db['JscriptyQuestionReport'][_0x4bdc('0x45')]({'where':{'id':_0x213fd9[_0x4bdc('0x48')]['id']}})[_0x4bdc('0x3f')](handleEntityNotFound(_0x38dcda,null))[_0x4bdc('0x3f')](removeEntity(_0x38dcda,null))['catch'](handleError(_0x38dcda,null));};exports[_0x4bdc('0x4a')]=function(_0x2d5053,_0x404ebb){return db[_0x4bdc('0x2b')]['describe']()[_0x4bdc('0x3f')](respondWithResult(_0x404ebb,null))[_0x4bdc('0x43')](handleError(_0x404ebb,null));}; \ No newline at end of file +var _0x6d92=['undefined','count','limit','set','apply','reject','then','sendStatus','name','send','index','map','JscriptyQuestionReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x4a7fea,_0x31174e){var _0xfd25ed=function(_0x33507a){while(--_0x33507a){_0x4a7fea['push'](_0x4a7fea['shift']());}};_0xfd25ed(++_0x31174e);}(_0x6d92,0xc2));var _0x26d9=function(_0x1e74c6,_0x56a205){_0x1e74c6=_0x1e74c6-0x0;var _0x495599=_0x6d92[_0x1e74c6];return _0x495599;};'use strict';var emlformat=require(_0x26d9('0x0'));var rimraf=require(_0x26d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x26d9('0x2'));var moment=require(_0x26d9('0x3'));var BPromise=require(_0x26d9('0x4'));var Mustache=require(_0x26d9('0x5'));var util=require(_0x26d9('0x6'));var path=require('path');var sox=require(_0x26d9('0x7'));var csv=require(_0x26d9('0x8'));var ejs=require(_0x26d9('0x9'));var fs=require('fs');var fs_extra=require(_0x26d9('0xa'));var _=require(_0x26d9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x26d9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x26d9('0x8'));var querystring=require(_0x26d9('0xd'));var Papa=require(_0x26d9('0xe'));var Redis=require('ioredis');var authService=require(_0x26d9('0xf'));var qs=require(_0x26d9('0x10'));var as=require(_0x26d9('0x11'));var hardwareService=require(_0x26d9('0x12'));var logger=require('../../config/logger')(_0x26d9('0x13'));var utils=require(_0x26d9('0x14'));var config=require(_0x26d9('0x15'));var licenseUtil=require(_0x26d9('0x16'));var db=require(_0x26d9('0x17'))['db'];function respondWithStatusCode(_0x57069e,_0x2bb495){_0x2bb495=_0x2bb495||0xcc;return function(_0x2121b0){if(_0x2121b0){return _0x57069e['sendStatus'](_0x2bb495);}return _0x57069e[_0x26d9('0x18')](_0x2bb495)[_0x26d9('0x19')]();};}function respondWithResult(_0x32ac94,_0x51c4cd){_0x51c4cd=_0x51c4cd||0xc8;return function(_0x1371d3){if(_0x1371d3){return _0x32ac94[_0x26d9('0x18')](_0x51c4cd)[_0x26d9('0x1a')](_0x1371d3);}};}function respondWithFilteredResult(_0x14618e,_0x2fec55){return function(_0x53d8cf){if(_0x53d8cf){var _0x3fc6b8=typeof _0x2fec55[_0x26d9('0x1b')]==='undefined'&&typeof _0x2fec55['limit']===_0x26d9('0x1c');var _0x19d9e4=_0x53d8cf[_0x26d9('0x1d')];var _0x2c4359=_0x3fc6b8?0x0:_0x2fec55[_0x26d9('0x1b')];var _0xcf0aa6=_0x3fc6b8?_0x53d8cf['count']:_0x2fec55['offset']+_0x2fec55[_0x26d9('0x1e')];var _0x47e055;if(_0xcf0aa6>=_0x19d9e4){_0xcf0aa6=_0x19d9e4;_0x47e055=0xc8;}else{_0x47e055=0xce;}_0x14618e[_0x26d9('0x18')](_0x47e055);return _0x14618e[_0x26d9('0x1f')]('Content-Range',_0x2c4359+'-'+_0xcf0aa6+'/'+_0x19d9e4)[_0x26d9('0x1a')](_0x53d8cf);}return null;};}function patchUpdates(_0x8a6e6b){return function(_0x563747){try{jsonpatch[_0x26d9('0x20')](_0x563747,_0x8a6e6b,!![]);}catch(_0x20d351){return BPromise[_0x26d9('0x21')](_0x20d351);}return _0x563747['save']();};}function saveUpdates(_0x12c540,_0x464e9f){return function(_0x31318b){if(_0x31318b){return _0x31318b['update'](_0x12c540)[_0x26d9('0x22')](function(_0x28df28){return _0x28df28;});}return null;};}function removeEntity(_0x273500,_0x50fbbf){return function(_0x3dacee){if(_0x3dacee){return _0x3dacee['destroy']()['then'](function(){_0x273500['status'](0xcc)[_0x26d9('0x19')]();});}};}function handleEntityNotFound(_0x2bd9f2,_0x38b10b){return function(_0x1ffd66){if(!_0x1ffd66){_0x2bd9f2[_0x26d9('0x23')](0x194);}return _0x1ffd66;};}function handleError(_0x5e55a7,_0x1da4cb){_0x1da4cb=_0x1da4cb||0x1f4;return function(_0x42466a){logger['error'](_0x42466a['stack']);if(_0x42466a[_0x26d9('0x24')]){delete _0x42466a[_0x26d9('0x24')];}_0x5e55a7[_0x26d9('0x18')](_0x1da4cb)[_0x26d9('0x25')](_0x42466a);};}exports[_0x26d9('0x26')]=function(_0x47a3cf,_0x5267e0){var _0x53efb3={},_0x1da721={},_0x120b70={'count':0x0,'rows':[]};var _0x1f9ae6=_[_0x26d9('0x27')](db[_0x26d9('0x28')][_0x26d9('0x29')],function(_0x17513c){return{'name':_0x17513c['fieldName'],'type':_0x17513c[_0x26d9('0x2a')][_0x26d9('0x2b')]};});_0x1da721[_0x26d9('0x2c')]=_[_0x26d9('0x27')](_0x1f9ae6,_0x26d9('0x24'));_0x1da721[_0x26d9('0x2d')]=_[_0x26d9('0x2e')](_0x47a3cf[_0x26d9('0x2d')]);_0x1da721[_0x26d9('0x2f')]=_[_0x26d9('0x30')](_0x1da721['model'],_0x1da721['query']);_0x53efb3[_0x26d9('0x31')]=_[_0x26d9('0x30')](_0x1da721[_0x26d9('0x2c')],qs[_0x26d9('0x32')](_0x47a3cf[_0x26d9('0x2d')]['fields']));_0x53efb3[_0x26d9('0x31')]=_0x53efb3[_0x26d9('0x31')]['length']?_0x53efb3['attributes']:_0x1da721['model'];if(!_0x47a3cf['query'][_0x26d9('0x33')](_0x26d9('0x34'))){_0x53efb3[_0x26d9('0x1e')]=qs[_0x26d9('0x1e')](_0x47a3cf[_0x26d9('0x2d')][_0x26d9('0x1e')]);_0x53efb3[_0x26d9('0x1b')]=qs[_0x26d9('0x1b')](_0x47a3cf[_0x26d9('0x2d')][_0x26d9('0x1b')]);}_0x53efb3[_0x26d9('0x35')]=qs[_0x26d9('0x36')](_0x47a3cf[_0x26d9('0x2d')][_0x26d9('0x36')]);_0x53efb3[_0x26d9('0x37')]=qs['filters'](_[_0x26d9('0x38')](_0x47a3cf[_0x26d9('0x2d')],_0x1da721[_0x26d9('0x2f')]),_0x1f9ae6);if(_0x47a3cf[_0x26d9('0x2d')][_0x26d9('0x39')]){_0x53efb3[_0x26d9('0x37')]=_[_0x26d9('0x3a')](_0x53efb3[_0x26d9('0x37')],{'$or':_[_0x26d9('0x27')](_0x1f9ae6,function(_0x5ee67b){if(_0x5ee67b[_0x26d9('0x2a')]!==_0x26d9('0x3b')){var _0x28cece={};_0x28cece[_0x5ee67b['name']]={'$like':'%'+_0x47a3cf['query'][_0x26d9('0x39')]+'%'};return _0x28cece;}})});}_0x53efb3=_[_0x26d9('0x3a')]({},_0x53efb3,_0x47a3cf[_0x26d9('0x3c')]);var _0x4a4843={'where':_0x53efb3[_0x26d9('0x37')]};return db[_0x26d9('0x28')][_0x26d9('0x1d')](_0x4a4843)[_0x26d9('0x22')](function(_0x1aa0eb){_0x120b70['count']=_0x1aa0eb;if(_0x47a3cf[_0x26d9('0x2d')][_0x26d9('0x3d')]){_0x53efb3[_0x26d9('0x3e')]=[{'all':!![]}];}return db[_0x26d9('0x28')][_0x26d9('0x3f')](_0x53efb3);})[_0x26d9('0x22')](function(_0x2a2a2e){_0x120b70[_0x26d9('0x40')]=_0x2a2a2e;return _0x120b70;})[_0x26d9('0x22')](respondWithFilteredResult(_0x5267e0,_0x53efb3))['catch'](handleError(_0x5267e0,null));};exports[_0x26d9('0x41')]=function(_0x8a44bc,_0x5609d7){var _0x5ca4e1={'raw':!![],'where':{'id':_0x8a44bc[_0x26d9('0x42')]['id']}},_0x2a9fc8={};_0x2a9fc8[_0x26d9('0x2c')]=_[_0x26d9('0x2e')](db['JscriptyQuestionReport'][_0x26d9('0x29')]);_0x2a9fc8[_0x26d9('0x2d')]=_[_0x26d9('0x2e')](_0x8a44bc[_0x26d9('0x2d')]);_0x2a9fc8[_0x26d9('0x2f')]=_[_0x26d9('0x30')](_0x2a9fc8[_0x26d9('0x2c')],_0x2a9fc8[_0x26d9('0x2d')]);_0x5ca4e1['attributes']=_[_0x26d9('0x30')](_0x2a9fc8[_0x26d9('0x2c')],qs[_0x26d9('0x32')](_0x8a44bc[_0x26d9('0x2d')][_0x26d9('0x32')]));_0x5ca4e1['attributes']=_0x5ca4e1[_0x26d9('0x31')]['length']?_0x5ca4e1[_0x26d9('0x31')]:_0x2a9fc8['model'];if(_0x8a44bc['query'][_0x26d9('0x3d')]){_0x5ca4e1[_0x26d9('0x3e')]=[{'all':!![]}];}_0x5ca4e1=_[_0x26d9('0x3a')]({},_0x5ca4e1,_0x8a44bc[_0x26d9('0x3c')]);return db['JscriptyQuestionReport'][_0x26d9('0x43')](_0x5ca4e1)[_0x26d9('0x22')](handleEntityNotFound(_0x5609d7,null))[_0x26d9('0x22')](respondWithResult(_0x5609d7,null))[_0x26d9('0x44')](handleError(_0x5609d7,null));};exports['create']=function(_0x30497b,_0x4f4eba){return db['JscriptyQuestionReport'][_0x26d9('0x45')](_0x30497b[_0x26d9('0x46')],{})[_0x26d9('0x22')](respondWithResult(_0x4f4eba,0xc9))[_0x26d9('0x44')](handleError(_0x4f4eba,null));};exports[_0x26d9('0x47')]=function(_0x2d6b03,_0x320ac9){if(_0x2d6b03['body']['id']){delete _0x2d6b03[_0x26d9('0x46')]['id'];}return db[_0x26d9('0x28')][_0x26d9('0x43')]({'where':{'id':_0x2d6b03[_0x26d9('0x42')]['id']}})[_0x26d9('0x22')](handleEntityNotFound(_0x320ac9,null))[_0x26d9('0x22')](saveUpdates(_0x2d6b03['body'],null))[_0x26d9('0x22')](respondWithResult(_0x320ac9,null))[_0x26d9('0x44')](handleError(_0x320ac9,null));};exports[_0x26d9('0x48')]=function(_0x64b296,_0x1ff42a){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x64b296[_0x26d9('0x42')]['id']}})['then'](handleEntityNotFound(_0x1ff42a,null))[_0x26d9('0x22')](removeEntity(_0x1ff42a,null))[_0x26d9('0x44')](handleError(_0x1ff42a,null));};exports[_0x26d9('0x49')]=function(_0x2f9a7f,_0x1cdd19){return db[_0x26d9('0x28')][_0x26d9('0x49')]()[_0x26d9('0x22')](respondWithResult(_0x1cdd19,null))[_0x26d9('0x44')](handleError(_0x1cdd19,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 15085e4..2a94496 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 _0xaa12=['JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define'];(function(_0x4edb1a,_0x57e008){var _0x311dd8=function(_0x1d9442){while(--_0x1d9442){_0x4edb1a['push'](_0x4edb1a['shift']());}};_0x311dd8(++_0x57e008);}(_0xaa12,0x195));var _0x2aa1=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xaa12[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x2aa1('0x0'));var logger=require(_0x2aa1('0x1'))(_0x2aa1('0x2'));var moment=require(_0x2aa1('0x3'));var BPromise=require(_0x2aa1('0x4'));var rp=require(_0x2aa1('0x5'));var fs=require('fs');var path=require(_0x2aa1('0x6'));var rimraf=require(_0x2aa1('0x7'));var config=require(_0x2aa1('0x8'));var attributes=require(_0x2aa1('0x9'));module['exports']=function(_0xe0bbf0,_0x5510e4){return _0xe0bbf0[_0x2aa1('0xa')](_0x2aa1('0xb'),attributes,{'tableName':_0x2aa1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaba6=['../../config/environment','./jscriptyQuestionReport.attributes','define','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xbe5f8a,_0x2d2d31){var _0x4e36e1=function(_0x5b8038){while(--_0x5b8038){_0xbe5f8a['push'](_0xbe5f8a['shift']());}};_0x4e36e1(++_0x2d2d31);}(_0xaba6,0x160));var _0x6aba=function(_0x1da80f,_0x59f7c8){_0x1da80f=_0x1da80f-0x0;var _0x382ff6=_0xaba6[_0x1da80f];return _0x382ff6;};'use strict';var _=require(_0x6aba('0x0'));var util=require('util');var logger=require(_0x6aba('0x1'))(_0x6aba('0x2'));var moment=require(_0x6aba('0x3'));var BPromise=require(_0x6aba('0x4'));var rp=require(_0x6aba('0x5'));var fs=require('fs');var path=require(_0x6aba('0x6'));var rimraf=require(_0x6aba('0x7'));var config=require(_0x6aba('0x8'));var attributes=require(_0x6aba('0x9'));module['exports']=function(_0x1988a6,_0x5898e5){return _0x1988a6[_0x6aba('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0x6aba('0xb'),'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 34c0661..e630f60 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 _0x2189=['request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x3f81c9,_0x28c67c){var _0x3e841b=function(_0x3deb73){while(--_0x3deb73){_0x3f81c9['push'](_0x3f81c9['shift']());}};_0x3e841b(++_0x28c67c);}(_0x2189,0xaa));var _0x9218=function(_0x385f4f,_0x2bf891){_0x385f4f=_0x385f4f-0x0;var _0x21e53f=_0x2189[_0x385f4f];return _0x21e53f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9218('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9218('0x1'));var db=require(_0x9218('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x9218('0x3'))('rpc');var config=require(_0x9218('0x4'));var jayson=require(_0x9218('0x5'));var client=jayson[_0x9218('0x6')][_0x9218('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x464af5,_0x1c250a,_0x4414f8){return new BPromise(function(_0x279053,_0x136e86){return client['request'](_0x464af5,_0x4414f8)['then'](function(_0x4a1c47){logger[_0x9218('0x8')](_0x9218('0x9'),_0x1c250a,_0x9218('0xa'));logger[_0x9218('0xb')](_0x9218('0xc'),_0x1c250a,'request\x20sent',JSON['stringify'](_0x4a1c47));if(_0x4a1c47[_0x9218('0xd')]){if(_0x4a1c47[_0x9218('0xd')][_0x9218('0xe')]===0x1f4){logger[_0x9218('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1c250a,_0x4a1c47['error']['message']);return _0x136e86(_0x4a1c47[_0x9218('0xd')][_0x9218('0xf')]);}logger[_0x9218('0xd')](_0x9218('0x9'),_0x1c250a,_0x4a1c47[_0x9218('0xd')][_0x9218('0xf')]);return _0x279053(_0x4a1c47[_0x9218('0xd')][_0x9218('0xf')]);}else{logger[_0x9218('0x8')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1c250a,_0x9218('0xa'));_0x279053(_0x4a1c47[_0x9218('0x10')][_0x9218('0xf')]);}})[_0x9218('0x11')](function(_0x5d92db){logger[_0x9218('0xd')](_0x9218('0x9'),_0x1c250a,_0x5d92db);_0x136e86(_0x5d92db);});});} \ No newline at end of file +var _0x1ad7=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','util','moment','bluebird','randomstring'];(function(_0x46750a,_0x57fbe2){var _0x252db7=function(_0x11a5f3){while(--_0x11a5f3){_0x46750a['push'](_0x46750a['shift']());}};_0x252db7(++_0x57fbe2);}(_0x1ad7,0xba));var _0x71ad=function(_0x271934,_0x236c06){_0x271934=_0x271934-0x0;var _0x26db69=_0x1ad7[_0x271934];return _0x26db69;};'use strict';var _=require('lodash');var util=require(_0x71ad('0x0'));var moment=require(_0x71ad('0x1'));var BPromise=require(_0x71ad('0x2'));var rs=require(_0x71ad('0x3'));var fs=require('fs');var Redis=require(_0x71ad('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x71ad('0x5'));var logger=require('../../config/logger')(_0x71ad('0x6'));var config=require(_0x71ad('0x7'));var jayson=require(_0x71ad('0x8'));var client=jayson[_0x71ad('0x9')][_0x71ad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e8f5b,_0x1c45ff,_0x446ef9){return new BPromise(function(_0x2e5f36,_0x133c0f){return client[_0x71ad('0xb')](_0x5e8f5b,_0x446ef9)['then'](function(_0x12f74a){logger[_0x71ad('0xc')](_0x71ad('0xd'),_0x1c45ff,_0x71ad('0xe'));logger['debug'](_0x71ad('0xf'),_0x1c45ff,'request\x20sent',JSON['stringify'](_0x12f74a));if(_0x12f74a['error']){if(_0x12f74a[_0x71ad('0x10')][_0x71ad('0x11')]===0x1f4){logger[_0x71ad('0x10')](_0x71ad('0xd'),_0x1c45ff,_0x12f74a[_0x71ad('0x10')][_0x71ad('0x12')]);return _0x133c0f(_0x12f74a['error'][_0x71ad('0x12')]);}logger[_0x71ad('0x10')](_0x71ad('0xd'),_0x1c45ff,_0x12f74a[_0x71ad('0x10')]['message']);return _0x2e5f36(_0x12f74a[_0x71ad('0x10')]['message']);}else{logger['info'](_0x71ad('0xd'),_0x1c45ff,_0x71ad('0xe'));_0x2e5f36(_0x12f74a['result'][_0x71ad('0x12')]);}})['catch'](function(_0x3d48be){logger[_0x71ad('0x10')](_0x71ad('0xd'),_0x1c45ff,_0x3d48be);_0x133c0f(_0x3d48be);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 8e4eba4..edb35a9 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 _0x9b1a=['../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','describe','show','/:id/questions','getQuestions','post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2f6144,_0x2e42e5){var _0x5b0f9e=function(_0x144917){while(--_0x144917){_0x2f6144['push'](_0x2f6144['shift']());}};_0x5b0f9e(++_0x2e42e5);}(_0x9b1a,0x7d));var _0xa9b1=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x9b1a[_0x4f5108];return _0x2d56ca;};'use strict';var multer=require(_0xa9b1('0x0'));var util=require(_0xa9b1('0x1'));var path=require(_0xa9b1('0x2'));var timeout=require(_0xa9b1('0x3'));var express=require(_0xa9b1('0x4'));var router=express[_0xa9b1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa9b1('0x6'));var interaction=require(_0xa9b1('0x7'));var config=require('../../config/environment');var controller=require(_0xa9b1('0x8'));router[_0xa9b1('0x9')]('/',auth[_0xa9b1('0xa')](),controller['index']);router[_0xa9b1('0x9')]('/describe',auth[_0xa9b1('0xa')](),controller[_0xa9b1('0xb')]);router[_0xa9b1('0x9')]('/:id',auth[_0xa9b1('0xa')](),controller[_0xa9b1('0xc')]);router[_0xa9b1('0x9')](_0xa9b1('0xd'),auth['isAuthenticated'](),controller[_0xa9b1('0xe')]);router[_0xa9b1('0xf')]('/',auth[_0xa9b1('0xa')](),controller[_0xa9b1('0x10')]);router['put']('/:id',auth[_0xa9b1('0xa')](),controller[_0xa9b1('0x11')]);router[_0xa9b1('0x12')](_0xa9b1('0x13'),auth['isAuthenticated'](),controller[_0xa9b1('0x14')]);module[_0xa9b1('0x15')]=router; \ No newline at end of file +var _0xa1ac=['/:id/questions','getQuestions','post','create','put','update','/:id','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','isAuthenticated','describe','show'];(function(_0x1a77e2,_0x2bbcf8){var _0xdd2be9=function(_0xc85908){while(--_0xc85908){_0x1a77e2['push'](_0x1a77e2['shift']());}};_0xdd2be9(++_0x2bbcf8);}(_0xa1ac,0xb0));var _0xca1a=function(_0x4d42a8,_0x1a2c82){_0x4d42a8=_0x4d42a8-0x0;var _0x3ff295=_0xa1ac[_0x4d42a8];return _0x3ff295;};'use strict';var multer=require(_0xca1a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xca1a('0x1'));var express=require(_0xca1a('0x2'));var router=express['Router']();var fs_extra=require(_0xca1a('0x3'));var auth=require(_0xca1a('0x4'));var interaction=require(_0xca1a('0x5'));var config=require(_0xca1a('0x6'));var controller=require(_0xca1a('0x7'));router[_0xca1a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xca1a('0x8')](_0xca1a('0x9'),auth[_0xca1a('0xa')](),controller[_0xca1a('0xb')]);router['get']('/:id',auth[_0xca1a('0xa')](),controller[_0xca1a('0xc')]);router[_0xca1a('0x8')](_0xca1a('0xd'),auth[_0xca1a('0xa')](),controller[_0xca1a('0xe')]);router[_0xca1a('0xf')]('/',auth[_0xca1a('0xa')](),controller[_0xca1a('0x10')]);router[_0xca1a('0x11')]('/:id',auth[_0xca1a('0xa')](),controller[_0xca1a('0x12')]);router['delete'](_0xca1a('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0xca1a('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index ef78156..ae3aebb 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 _0xf5f1=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue','starttime','format'];(function(_0x5f037d,_0x1345b8){var _0x36980c=function(_0x2836f0){while(--_0x2836f0){_0x5f037d['push'](_0x5f037d['shift']());}};_0x36980c(++_0x1345b8);}(_0xf5f1,0x9c));var _0x1f5f=function(_0x179de3,_0x3d46f6){_0x179de3=_0x179de3-0x0;var _0x2d15e8=_0xf5f1[_0x179de3];return _0x2d15e8;};'use strict';var moment=require(_0x1f5f('0x0'));var Sequelize=require(_0x1f5f('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x1f5f('0x2')],'set':function(_0x8c71f9){this[_0x1f5f('0x3')](_0x1f5f('0x4'),_0x8c71f9);this[_0x1f5f('0x3')]('endtime',moment()[_0x1f5f('0x5')](_0x1f5f('0x6')));}},'endtime':{'type':Sequelize[_0x1f5f('0x2')]},'membername':{'type':Sequelize[_0x1f5f('0x7')]},'projectname':{'type':Sequelize[_0x1f5f('0x7')]},'queue':{'type':Sequelize[_0x1f5f('0x7')]},'uniqueid':{'type':Sequelize[_0x1f5f('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1f5f('0x7')]},'completed':{'type':Sequelize[_0x1f5f('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x9953=['BOOLEAN','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0x9953,0x1d7));var _0x3995=function(_0x15329c,_0x44a0a2){_0x15329c=_0x15329c-0x0;var _0x566604=_0x9953[_0x15329c];return _0x566604;};'use strict';var moment=require('moment');var Sequelize=require(_0x3995('0x0'));module[_0x3995('0x1')]={'starttime':{'type':Sequelize[_0x3995('0x2')],'set':function(_0x4f0c7d){this[_0x3995('0x3')](_0x3995('0x4'),_0x4f0c7d);this[_0x3995('0x3')](_0x3995('0x5'),moment()[_0x3995('0x6')](_0x3995('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x3995('0x8')]},'projectname':{'type':Sequelize[_0x3995('0x8')]},'queue':{'type':Sequelize[_0x3995('0x8')]},'uniqueid':{'type':Sequelize[_0x3995('0x8')]},'calleridname':{'type':Sequelize[_0x3995('0x8')]},'calleridnum':{'type':Sequelize[_0x3995('0x8')]},'completed':{'type':Sequelize[_0x3995('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 2b44f54..c5d9b63 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 _0x7c4d=['findOne','order','JscriptyQuestionReport','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','reject','then','destroy','end','error','name','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','getQuestions'];(function(_0x32d599,_0x5d43cf){var _0x5c16fb=function(_0x4c6c96){while(--_0x4c6c96){_0x32d599['push'](_0x32d599['shift']());}};_0x5c16fb(++_0x5d43cf);}(_0x7c4d,0xe1));var _0xd7c4=function(_0x4783fa,_0x30625a){_0x4783fa=_0x4783fa-0x0;var _0x5354e7=_0x7c4d[_0x4783fa];return _0x5354e7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd7c4('0x0'));var jsonpatch=require(_0xd7c4('0x1'));var rp=require(_0xd7c4('0x2'));var moment=require(_0xd7c4('0x3'));var BPromise=require(_0xd7c4('0x4'));var Mustache=require(_0xd7c4('0x5'));var util=require(_0xd7c4('0x6'));var path=require(_0xd7c4('0x7'));var sox=require('sox');var csv=require(_0xd7c4('0x8'));var ejs=require(_0xd7c4('0x9'));var fs=require('fs');var fs_extra=require(_0xd7c4('0xa'));var _=require('lodash');var squel=require(_0xd7c4('0xb'));var crypto=require(_0xd7c4('0xc'));var jsforce=require(_0xd7c4('0xd'));var deskjs=require(_0xd7c4('0xe'));var toCsv=require(_0xd7c4('0x8'));var querystring=require(_0xd7c4('0xf'));var Papa=require(_0xd7c4('0x10'));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('../../config/license/hardware');var logger=require(_0xd7c4('0x11'))(_0xd7c4('0x12'));var utils=require(_0xd7c4('0x13'));var config=require(_0xd7c4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd7c4('0x15'))['db'];function respondWithStatusCode(_0x57475b,_0x1701c4){_0x1701c4=_0x1701c4||0xcc;return function(_0x36cb47){if(_0x36cb47){return _0x57475b[_0xd7c4('0x16')](_0x1701c4);}return _0x57475b[_0xd7c4('0x17')](_0x1701c4)['end']();};}function respondWithResult(_0xb936d1,_0x64e4d6){_0x64e4d6=_0x64e4d6||0xc8;return function(_0x5be80f){if(_0x5be80f){return _0xb936d1[_0xd7c4('0x17')](_0x64e4d6)[_0xd7c4('0x18')](_0x5be80f);}};}function respondWithFilteredResult(_0x3ee0be,_0x967913){return function(_0x3598b0){if(_0x3598b0){var _0x50138d=typeof _0x967913[_0xd7c4('0x19')]===_0xd7c4('0x1a')&&typeof _0x967913['limit']===_0xd7c4('0x1a');var _0x54d9b5=_0x3598b0[_0xd7c4('0x1b')];var _0x4a33a3=_0x50138d?0x0:_0x967913[_0xd7c4('0x19')];var _0x318e39=_0x50138d?_0x3598b0[_0xd7c4('0x1b')]:_0x967913[_0xd7c4('0x19')]+_0x967913['limit'];var _0x3ad927;if(_0x318e39>=_0x54d9b5){_0x318e39=_0x54d9b5;_0x3ad927=0xc8;}else{_0x3ad927=0xce;}_0x3ee0be[_0xd7c4('0x17')](_0x3ad927);return _0x3ee0be[_0xd7c4('0x1c')]('Content-Range',_0x4a33a3+'-'+_0x318e39+'/'+_0x54d9b5)['json'](_0x3598b0);}return null;};}function patchUpdates(_0x1209ee){return function(_0x270e9a){try{jsonpatch['apply'](_0x270e9a,_0x1209ee,!![]);}catch(_0x26825f){return BPromise[_0xd7c4('0x1d')](_0x26825f);}return _0x270e9a['save']();};}function saveUpdates(_0x177dfc,_0x1b61b4){return function(_0x382e1c){if(_0x382e1c){return _0x382e1c['update'](_0x177dfc)[_0xd7c4('0x1e')](function(_0x1f85f1){return _0x1f85f1;});}return null;};}function removeEntity(_0x9de521,_0x175262){return function(_0x1bd92b){if(_0x1bd92b){return _0x1bd92b[_0xd7c4('0x1f')]()['then'](function(){_0x9de521[_0xd7c4('0x17')](0xcc)[_0xd7c4('0x20')]();});}};}function handleEntityNotFound(_0x47dfd0,_0x34e164){return function(_0x263dfa){if(!_0x263dfa){_0x47dfd0[_0xd7c4('0x16')](0x194);}return _0x263dfa;};}function handleError(_0x42e5d7,_0x28c052){_0x28c052=_0x28c052||0x1f4;return function(_0x30e395){logger[_0xd7c4('0x21')](_0x30e395['stack']);if(_0x30e395[_0xd7c4('0x22')]){delete _0x30e395[_0xd7c4('0x22')];}_0x42e5d7[_0xd7c4('0x17')](_0x28c052)['send'](_0x30e395);};}exports[_0xd7c4('0x23')]=function(_0xd5c5d0,_0x11a74a){var _0x20027b={},_0x11c466={},_0x18315f={'count':0x0,'rows':[]};var _0x3b5e5b=_['map'](db['JscriptySessionReport'][_0xd7c4('0x24')],function(_0x31aa75){return{'name':_0x31aa75['fieldName'],'type':_0x31aa75[_0xd7c4('0x25')][_0xd7c4('0x26')]};});_0x11c466[_0xd7c4('0x27')]=_[_0xd7c4('0x28')](_0x3b5e5b,_0xd7c4('0x22'));_0x11c466['query']=_[_0xd7c4('0x29')](_0xd5c5d0[_0xd7c4('0x2a')]);_0x11c466[_0xd7c4('0x2b')]=_[_0xd7c4('0x2c')](_0x11c466[_0xd7c4('0x27')],_0x11c466[_0xd7c4('0x2a')]);_0x20027b['attributes']=_[_0xd7c4('0x2c')](_0x11c466[_0xd7c4('0x27')],qs[_0xd7c4('0x2d')](_0xd5c5d0[_0xd7c4('0x2a')]['fields']));_0x20027b[_0xd7c4('0x2e')]=_0x20027b[_0xd7c4('0x2e')][_0xd7c4('0x2f')]?_0x20027b['attributes']:_0x11c466['model'];if(!_0xd5c5d0[_0xd7c4('0x2a')][_0xd7c4('0x30')](_0xd7c4('0x31'))){_0x20027b[_0xd7c4('0x32')]=qs['limit'](_0xd5c5d0['query'][_0xd7c4('0x32')]);_0x20027b[_0xd7c4('0x19')]=qs[_0xd7c4('0x19')](_0xd5c5d0[_0xd7c4('0x2a')][_0xd7c4('0x19')]);}_0x20027b['order']=qs[_0xd7c4('0x33')](_0xd5c5d0[_0xd7c4('0x2a')][_0xd7c4('0x33')]);_0x20027b[_0xd7c4('0x34')]=qs[_0xd7c4('0x2b')](_[_0xd7c4('0x35')](_0xd5c5d0[_0xd7c4('0x2a')],_0x11c466[_0xd7c4('0x2b')]),_0x3b5e5b);if(_0xd5c5d0[_0xd7c4('0x2a')][_0xd7c4('0x36')]){_0x20027b['where']=_[_0xd7c4('0x37')](_0x20027b[_0xd7c4('0x34')],{'$or':_[_0xd7c4('0x28')](_0x3b5e5b,function(_0x4c35d7){if(_0x4c35d7[_0xd7c4('0x25')]!=='VIRTUAL'){var _0x59d215={};_0x59d215[_0x4c35d7[_0xd7c4('0x22')]]={'$like':'%'+_0xd5c5d0[_0xd7c4('0x2a')]['filter']+'%'};return _0x59d215;}})});}_0x20027b=_[_0xd7c4('0x37')]({},_0x20027b,_0xd5c5d0[_0xd7c4('0x38')]);var _0xb5f3a1={'where':_0x20027b[_0xd7c4('0x34')]};return db[_0xd7c4('0x39')]['count'](_0xb5f3a1)[_0xd7c4('0x1e')](function(_0x3e60d4){_0x18315f[_0xd7c4('0x1b')]=_0x3e60d4;if(_0xd5c5d0[_0xd7c4('0x2a')][_0xd7c4('0x3a')]){_0x20027b[_0xd7c4('0x3b')]=[{'all':!![]}];}return db[_0xd7c4('0x39')][_0xd7c4('0x3c')](_0x20027b);})['then'](function(_0x120cf0){_0x18315f[_0xd7c4('0x3d')]=_0x120cf0;return _0x18315f;})[_0xd7c4('0x1e')](respondWithFilteredResult(_0x11a74a,_0x20027b))[_0xd7c4('0x3e')](handleError(_0x11a74a,null));};exports[_0xd7c4('0x3f')]=function(_0x1f6fab,_0x39f838){var _0x2059dc={'raw':!![],'where':{'id':_0x1f6fab[_0xd7c4('0x40')]['id']}},_0x5ab191={};_0x5ab191[_0xd7c4('0x27')]=_[_0xd7c4('0x29')](db['JscriptySessionReport'][_0xd7c4('0x24')]);_0x5ab191[_0xd7c4('0x2a')]=_[_0xd7c4('0x29')](_0x1f6fab[_0xd7c4('0x2a')]);_0x5ab191[_0xd7c4('0x2b')]=_['intersection'](_0x5ab191[_0xd7c4('0x27')],_0x5ab191[_0xd7c4('0x2a')]);_0x2059dc[_0xd7c4('0x2e')]=_[_0xd7c4('0x2c')](_0x5ab191[_0xd7c4('0x27')],qs['fields'](_0x1f6fab['query']['fields']));_0x2059dc[_0xd7c4('0x2e')]=_0x2059dc[_0xd7c4('0x2e')][_0xd7c4('0x2f')]?_0x2059dc['attributes']:_0x5ab191[_0xd7c4('0x27')];if(_0x1f6fab[_0xd7c4('0x2a')]['includeAll']){_0x2059dc['include']=[{'all':!![]}];}_0x2059dc=_[_0xd7c4('0x37')]({},_0x2059dc,_0x1f6fab[_0xd7c4('0x38')]);return db[_0xd7c4('0x39')][_0xd7c4('0x41')](_0x2059dc)['then'](handleEntityNotFound(_0x39f838,null))[_0xd7c4('0x1e')](respondWithResult(_0x39f838,null))[_0xd7c4('0x3e')](handleError(_0x39f838,null));};exports[_0xd7c4('0x42')]=function(_0x188a7a,_0x3d8c2d){return db[_0xd7c4('0x39')]['create'](_0x188a7a[_0xd7c4('0x43')],{})[_0xd7c4('0x1e')](respondWithResult(_0x3d8c2d,0xc9))[_0xd7c4('0x3e')](handleError(_0x3d8c2d,null));};exports[_0xd7c4('0x44')]=function(_0x386613,_0x2756d7){if(_0x386613[_0xd7c4('0x43')]['id']){delete _0x386613[_0xd7c4('0x43')]['id'];}return db[_0xd7c4('0x39')][_0xd7c4('0x41')]({'where':{'id':_0x386613[_0xd7c4('0x40')]['id']}})['then'](handleEntityNotFound(_0x2756d7,null))[_0xd7c4('0x1e')](saveUpdates(_0x386613[_0xd7c4('0x43')],null))[_0xd7c4('0x1e')](respondWithResult(_0x2756d7,null))[_0xd7c4('0x3e')](handleError(_0x2756d7,null));};exports[_0xd7c4('0x1f')]=function(_0x408052,_0x3883ba){return db[_0xd7c4('0x39')]['find']({'where':{'id':_0x408052[_0xd7c4('0x40')]['id']}})[_0xd7c4('0x1e')](handleEntityNotFound(_0x3883ba,null))[_0xd7c4('0x1e')](removeEntity(_0x3883ba,null))[_0xd7c4('0x3e')](handleError(_0x3883ba,null));};exports[_0xd7c4('0x45')]=function(_0x2f152d,_0x46ca32){return db['JscriptySessionReport'][_0xd7c4('0x45')]()[_0xd7c4('0x1e')](respondWithResult(_0x46ca32,null))[_0xd7c4('0x3e')](handleError(_0x46ca32,null));};exports[_0xd7c4('0x46')]=function(_0x69aa94,_0x50f7c3,_0x5b6554){var _0x5d5021={'raw':!![],'where':{}};var _0x50cd27={};var _0x2a1b06={'count':0x0,'rows':[]};return db[_0xd7c4('0x39')][_0xd7c4('0x47')]({'where':{'id':_0x69aa94[_0xd7c4('0x40')]['id']}})[_0xd7c4('0x1e')](handleEntityNotFound(_0x50f7c3,null))[_0xd7c4('0x1e')](function(_0x5e6af4){if(_0x5e6af4){_0x50cd27['model']=_[_0xd7c4('0x29')](db['JscriptyQuestionReport'][_0xd7c4('0x24')]);_0x50cd27[_0xd7c4('0x2a')]=_[_0xd7c4('0x29')](_0x69aa94['query']);_0x50cd27[_0xd7c4('0x2b')]=_[_0xd7c4('0x2c')](_0x50cd27[_0xd7c4('0x27')],_0x50cd27[_0xd7c4('0x2a')]);_0x5d5021[_0xd7c4('0x2e')]=_[_0xd7c4('0x2c')](_0x50cd27[_0xd7c4('0x27')],qs[_0xd7c4('0x2d')](_0x69aa94['query'][_0xd7c4('0x2d')]));_0x5d5021['attributes']=_0x5d5021['attributes'][_0xd7c4('0x2f')]?_0x5d5021['attributes']:_0x50cd27[_0xd7c4('0x27')];if(!_0x69aa94[_0xd7c4('0x2a')][_0xd7c4('0x30')](_0xd7c4('0x31'))){_0x5d5021[_0xd7c4('0x32')]=qs['limit'](_0x69aa94[_0xd7c4('0x2a')]['limit']);_0x5d5021[_0xd7c4('0x19')]=qs[_0xd7c4('0x19')](_0x69aa94[_0xd7c4('0x2a')][_0xd7c4('0x19')]);}_0x5d5021[_0xd7c4('0x48')]=qs[_0xd7c4('0x33')](_0x69aa94['query'][_0xd7c4('0x33')]);_0x5d5021[_0xd7c4('0x34')]=qs[_0xd7c4('0x2b')](_[_0xd7c4('0x35')](_0x69aa94[_0xd7c4('0x2a')],_0x50cd27['filters']));_0x5d5021['where']['SessionId']=_0x5e6af4['id'];if(_0x69aa94[_0xd7c4('0x2a')]['filter']){_0x5d5021['where']=_[_0xd7c4('0x37')](_0x5d5021[_0xd7c4('0x34')],{'$or':_[_0xd7c4('0x28')](_0x5d5021['attributes'],function(_0x25bcbe){var _0x2d24b9={};_0x2d24b9[_0x25bcbe]={'$like':'%'+_0x69aa94['query'][_0xd7c4('0x36')]+'%'};return _0x2d24b9;})});}_0x5d5021=_[_0xd7c4('0x37')]({},_0x5d5021,_0x69aa94[_0xd7c4('0x38')]);return db[_0xd7c4('0x49')][_0xd7c4('0x1b')]({'where':_0x5d5021['where']})[_0xd7c4('0x1e')](function(_0xc538ee){_0x2a1b06['count']=_0xc538ee;if(_0x69aa94[_0xd7c4('0x2a')][_0xd7c4('0x3a')]){_0x5d5021['include']=[{'all':!![]}];}return db[_0xd7c4('0x49')][_0xd7c4('0x3c')](_0x5d5021);})[_0xd7c4('0x1e')](function(_0x23b219){_0x2a1b06[_0xd7c4('0x3d')]=_0x23b219;return _0x2a1b06;});}})['then'](respondWithFilteredResult(_0x50f7c3,_0x5d5021))[_0xd7c4('0x3e')](handleError(_0x50f7c3,null));}; \ No newline at end of file +var _0x4e59=['../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','error','stack','name','index','JscriptySessionReport','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','update','destroy','findOne','order','SessionId','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4a8dab,_0x37fd02){var _0xe7b444=function(_0x586d00){while(--_0x586d00){_0x4a8dab['push'](_0x4a8dab['shift']());}};_0xe7b444(++_0x37fd02);}(_0x4e59,0x1c6));var _0x94e5=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4e59[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x94e5('0x0'));var rimraf=require(_0x94e5('0x1'));var zipdir=require(_0x94e5('0x2'));var jsonpatch=require(_0x94e5('0x3'));var rp=require(_0x94e5('0x4'));var moment=require(_0x94e5('0x5'));var BPromise=require(_0x94e5('0x6'));var Mustache=require(_0x94e5('0x7'));var util=require(_0x94e5('0x8'));var path=require(_0x94e5('0x9'));var sox=require(_0x94e5('0xa'));var csv=require(_0x94e5('0xb'));var ejs=require(_0x94e5('0xc'));var fs=require('fs');var fs_extra=require(_0x94e5('0xd'));var _=require('lodash');var squel=require(_0x94e5('0xe'));var crypto=require(_0x94e5('0xf'));var jsforce=require(_0x94e5('0x10'));var deskjs=require(_0x94e5('0x11'));var toCsv=require(_0x94e5('0xb'));var querystring=require(_0x94e5('0x12'));var Papa=require(_0x94e5('0x13'));var Redis=require('ioredis');var authService=require(_0x94e5('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94e5('0x15'));var logger=require('../../config/logger')(_0x94e5('0x16'));var utils=require('../../config/utils');var config=require(_0x94e5('0x17'));var licenseUtil=require(_0x94e5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36f003,_0x363d64){_0x363d64=_0x363d64||0xcc;return function(_0x165c76){if(_0x165c76){return _0x36f003[_0x94e5('0x19')](_0x363d64);}return _0x36f003[_0x94e5('0x1a')](_0x363d64)[_0x94e5('0x1b')]();};}function respondWithResult(_0x11978a,_0x4e8e9f){_0x4e8e9f=_0x4e8e9f||0xc8;return function(_0xcb7730){if(_0xcb7730){return _0x11978a['status'](_0x4e8e9f)[_0x94e5('0x1c')](_0xcb7730);}};}function respondWithFilteredResult(_0x49bee5,_0x80d65d){return function(_0x520ffc){if(_0x520ffc){var _0x4705bf=typeof _0x80d65d[_0x94e5('0x1d')]===_0x94e5('0x1e')&&typeof _0x80d65d[_0x94e5('0x1f')]==='undefined';var _0x142dc4=_0x520ffc[_0x94e5('0x20')];var _0x2b65ce=_0x4705bf?0x0:_0x80d65d[_0x94e5('0x1d')];var _0x47d5e4=_0x4705bf?_0x520ffc['count']:_0x80d65d[_0x94e5('0x1d')]+_0x80d65d['limit'];var _0x36420f;if(_0x47d5e4>=_0x142dc4){_0x47d5e4=_0x142dc4;_0x36420f=0xc8;}else{_0x36420f=0xce;}_0x49bee5[_0x94e5('0x1a')](_0x36420f);return _0x49bee5[_0x94e5('0x21')](_0x94e5('0x22'),_0x2b65ce+'-'+_0x47d5e4+'/'+_0x142dc4)['json'](_0x520ffc);}return null;};}function patchUpdates(_0x26a55e){return function(_0xc121e7){try{jsonpatch['apply'](_0xc121e7,_0x26a55e,!![]);}catch(_0x2de96f){return BPromise[_0x94e5('0x23')](_0x2de96f);}return _0xc121e7['save']();};}function saveUpdates(_0x1f4ac6,_0x2220ba){return function(_0x28676a){if(_0x28676a){return _0x28676a['update'](_0x1f4ac6)['then'](function(_0x1076f0){return _0x1076f0;});}return null;};}function removeEntity(_0xd72555,_0x1262a8){return function(_0x159c12){if(_0x159c12){return _0x159c12['destroy']()[_0x94e5('0x24')](function(){_0xd72555['status'](0xcc)[_0x94e5('0x1b')]();});}};}function handleEntityNotFound(_0x1c266d,_0x29dbb9){return function(_0x3e3caf){if(!_0x3e3caf){_0x1c266d[_0x94e5('0x19')](0x194);}return _0x3e3caf;};}function handleError(_0x355a60,_0x1c144b){_0x1c144b=_0x1c144b||0x1f4;return function(_0x2f63d3){logger[_0x94e5('0x25')](_0x2f63d3[_0x94e5('0x26')]);if(_0x2f63d3[_0x94e5('0x27')]){delete _0x2f63d3['name'];}_0x355a60['status'](_0x1c144b)['send'](_0x2f63d3);};}exports[_0x94e5('0x28')]=function(_0x457178,_0x4851c4){var _0x29e9ae={},_0x4cd0d9={},_0x1a6a00={'count':0x0,'rows':[]};var _0x4d0da0=_['map'](db[_0x94e5('0x29')]['rawAttributes'],function(_0x296423){return{'name':_0x296423[_0x94e5('0x2a')],'type':_0x296423['type'][_0x94e5('0x2b')]};});_0x4cd0d9[_0x94e5('0x2c')]=_[_0x94e5('0x2d')](_0x4d0da0,_0x94e5('0x27'));_0x4cd0d9['query']=_[_0x94e5('0x2e')](_0x457178[_0x94e5('0x2f')]);_0x4cd0d9['filters']=_[_0x94e5('0x30')](_0x4cd0d9[_0x94e5('0x2c')],_0x4cd0d9[_0x94e5('0x2f')]);_0x29e9ae[_0x94e5('0x31')]=_[_0x94e5('0x30')](_0x4cd0d9['model'],qs[_0x94e5('0x32')](_0x457178[_0x94e5('0x2f')]['fields']));_0x29e9ae['attributes']=_0x29e9ae[_0x94e5('0x31')]['length']?_0x29e9ae[_0x94e5('0x31')]:_0x4cd0d9[_0x94e5('0x2c')];if(!_0x457178[_0x94e5('0x2f')][_0x94e5('0x33')](_0x94e5('0x34'))){_0x29e9ae[_0x94e5('0x1f')]=qs['limit'](_0x457178[_0x94e5('0x2f')]['limit']);_0x29e9ae[_0x94e5('0x1d')]=qs['offset'](_0x457178['query'][_0x94e5('0x1d')]);}_0x29e9ae['order']=qs[_0x94e5('0x35')](_0x457178[_0x94e5('0x2f')][_0x94e5('0x35')]);_0x29e9ae[_0x94e5('0x36')]=qs[_0x94e5('0x37')](_[_0x94e5('0x38')](_0x457178['query'],_0x4cd0d9[_0x94e5('0x37')]),_0x4d0da0);if(_0x457178[_0x94e5('0x2f')][_0x94e5('0x39')]){_0x29e9ae[_0x94e5('0x36')]=_[_0x94e5('0x3a')](_0x29e9ae[_0x94e5('0x36')],{'$or':_['map'](_0x4d0da0,function(_0x55f5f4){if(_0x55f5f4[_0x94e5('0x3b')]!=='VIRTUAL'){var _0x103c2f={};_0x103c2f[_0x55f5f4['name']]={'$like':'%'+_0x457178[_0x94e5('0x2f')][_0x94e5('0x39')]+'%'};return _0x103c2f;}})});}_0x29e9ae=_[_0x94e5('0x3a')]({},_0x29e9ae,_0x457178['options']);var _0x1365f={'where':_0x29e9ae[_0x94e5('0x36')]};return db[_0x94e5('0x29')]['count'](_0x1365f)[_0x94e5('0x24')](function(_0x568c38){_0x1a6a00[_0x94e5('0x20')]=_0x568c38;if(_0x457178[_0x94e5('0x2f')][_0x94e5('0x3c')]){_0x29e9ae[_0x94e5('0x3d')]=[{'all':!![]}];}return db[_0x94e5('0x29')][_0x94e5('0x3e')](_0x29e9ae);})[_0x94e5('0x24')](function(_0x365eb4){_0x1a6a00[_0x94e5('0x3f')]=_0x365eb4;return _0x1a6a00;})[_0x94e5('0x24')](respondWithFilteredResult(_0x4851c4,_0x29e9ae))[_0x94e5('0x40')](handleError(_0x4851c4,null));};exports[_0x94e5('0x41')]=function(_0x24e337,_0xc17bad){var _0xde11a3={'raw':!![],'where':{'id':_0x24e337[_0x94e5('0x42')]['id']}},_0x86b877={};_0x86b877[_0x94e5('0x2c')]=_[_0x94e5('0x2e')](db['JscriptySessionReport'][_0x94e5('0x43')]);_0x86b877[_0x94e5('0x2f')]=_[_0x94e5('0x2e')](_0x24e337[_0x94e5('0x2f')]);_0x86b877['filters']=_[_0x94e5('0x30')](_0x86b877[_0x94e5('0x2c')],_0x86b877['query']);_0xde11a3[_0x94e5('0x31')]=_['intersection'](_0x86b877[_0x94e5('0x2c')],qs[_0x94e5('0x32')](_0x24e337[_0x94e5('0x2f')][_0x94e5('0x32')]));_0xde11a3[_0x94e5('0x31')]=_0xde11a3[_0x94e5('0x31')][_0x94e5('0x44')]?_0xde11a3[_0x94e5('0x31')]:_0x86b877[_0x94e5('0x2c')];if(_0x24e337[_0x94e5('0x2f')][_0x94e5('0x3c')]){_0xde11a3[_0x94e5('0x3d')]=[{'all':!![]}];}_0xde11a3=_[_0x94e5('0x3a')]({},_0xde11a3,_0x24e337[_0x94e5('0x45')]);return db['JscriptySessionReport'][_0x94e5('0x46')](_0xde11a3)[_0x94e5('0x24')](handleEntityNotFound(_0xc17bad,null))['then'](respondWithResult(_0xc17bad,null))['catch'](handleError(_0xc17bad,null));};exports[_0x94e5('0x47')]=function(_0x92e0e1,_0x47813d){return db[_0x94e5('0x29')][_0x94e5('0x47')](_0x92e0e1[_0x94e5('0x48')],{})[_0x94e5('0x24')](respondWithResult(_0x47813d,0xc9))[_0x94e5('0x40')](handleError(_0x47813d,null));};exports[_0x94e5('0x49')]=function(_0x35e2f3,_0x720454){if(_0x35e2f3[_0x94e5('0x48')]['id']){delete _0x35e2f3[_0x94e5('0x48')]['id'];}return db[_0x94e5('0x29')]['find']({'where':{'id':_0x35e2f3[_0x94e5('0x42')]['id']}})[_0x94e5('0x24')](handleEntityNotFound(_0x720454,null))[_0x94e5('0x24')](saveUpdates(_0x35e2f3[_0x94e5('0x48')],null))[_0x94e5('0x24')](respondWithResult(_0x720454,null))[_0x94e5('0x40')](handleError(_0x720454,null));};exports[_0x94e5('0x4a')]=function(_0x4b03c8,_0x2cbd1d){return db[_0x94e5('0x29')][_0x94e5('0x46')]({'where':{'id':_0x4b03c8[_0x94e5('0x42')]['id']}})[_0x94e5('0x24')](handleEntityNotFound(_0x2cbd1d,null))[_0x94e5('0x24')](removeEntity(_0x2cbd1d,null))[_0x94e5('0x40')](handleError(_0x2cbd1d,null));};exports['describe']=function(_0x22f401,_0x5977e8){return db['JscriptySessionReport']['describe']()[_0x94e5('0x24')](respondWithResult(_0x5977e8,null))[_0x94e5('0x40')](handleError(_0x5977e8,null));};exports['getQuestions']=function(_0x4fa1bf,_0xec4c25,_0x25d16d){var _0x4dacda={'raw':!![],'where':{}};var _0x2f1a2={};var _0x597b75={'count':0x0,'rows':[]};return db[_0x94e5('0x29')][_0x94e5('0x4b')]({'where':{'id':_0x4fa1bf['params']['id']}})['then'](handleEntityNotFound(_0xec4c25,null))['then'](function(_0x4b4c4a){if(_0x4b4c4a){_0x2f1a2[_0x94e5('0x2c')]=_[_0x94e5('0x2e')](db['JscriptyQuestionReport'][_0x94e5('0x43')]);_0x2f1a2[_0x94e5('0x2f')]=_[_0x94e5('0x2e')](_0x4fa1bf[_0x94e5('0x2f')]);_0x2f1a2[_0x94e5('0x37')]=_[_0x94e5('0x30')](_0x2f1a2[_0x94e5('0x2c')],_0x2f1a2[_0x94e5('0x2f')]);_0x4dacda['attributes']=_[_0x94e5('0x30')](_0x2f1a2[_0x94e5('0x2c')],qs[_0x94e5('0x32')](_0x4fa1bf[_0x94e5('0x2f')][_0x94e5('0x32')]));_0x4dacda['attributes']=_0x4dacda[_0x94e5('0x31')]['length']?_0x4dacda[_0x94e5('0x31')]:_0x2f1a2[_0x94e5('0x2c')];if(!_0x4fa1bf[_0x94e5('0x2f')][_0x94e5('0x33')](_0x94e5('0x34'))){_0x4dacda[_0x94e5('0x1f')]=qs['limit'](_0x4fa1bf['query'][_0x94e5('0x1f')]);_0x4dacda[_0x94e5('0x1d')]=qs['offset'](_0x4fa1bf[_0x94e5('0x2f')]['offset']);}_0x4dacda[_0x94e5('0x4c')]=qs[_0x94e5('0x35')](_0x4fa1bf[_0x94e5('0x2f')][_0x94e5('0x35')]);_0x4dacda['where']=qs[_0x94e5('0x37')](_['pick'](_0x4fa1bf[_0x94e5('0x2f')],_0x2f1a2[_0x94e5('0x37')]));_0x4dacda[_0x94e5('0x36')][_0x94e5('0x4d')]=_0x4b4c4a['id'];if(_0x4fa1bf[_0x94e5('0x2f')][_0x94e5('0x39')]){_0x4dacda[_0x94e5('0x36')]=_[_0x94e5('0x3a')](_0x4dacda[_0x94e5('0x36')],{'$or':_[_0x94e5('0x2d')](_0x4dacda[_0x94e5('0x31')],function(_0x2dae0a){var _0x3ffb7d={};_0x3ffb7d[_0x2dae0a]={'$like':'%'+_0x4fa1bf[_0x94e5('0x2f')][_0x94e5('0x39')]+'%'};return _0x3ffb7d;})});}_0x4dacda=_[_0x94e5('0x3a')]({},_0x4dacda,_0x4fa1bf[_0x94e5('0x45')]);return db[_0x94e5('0x4e')][_0x94e5('0x20')]({'where':_0x4dacda[_0x94e5('0x36')]})['then'](function(_0x458dd2){_0x597b75[_0x94e5('0x20')]=_0x458dd2;if(_0x4fa1bf[_0x94e5('0x2f')]['includeAll']){_0x4dacda['include']=[{'all':!![]}];}return db[_0x94e5('0x4e')][_0x94e5('0x3e')](_0x4dacda);})[_0x94e5('0x24')](function(_0x10c2f6){_0x597b75[_0x94e5('0x3f')]=_0x10c2f6;return _0x597b75;});}})[_0x94e5('0x24')](respondWithFilteredResult(_0xec4c25,_0x4dacda))['catch'](handleError(_0xec4c25,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index d8c7279..03ac65b 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(_0x4f0eb8,_0xdc5789){var _0x366a5a=function(_0x347b05){while(--_0x347b05){_0x4f0eb8['push'](_0x4f0eb8['shift']());}};_0x366a5a(++_0xdc5789);}(_0xf072,0x1cf));var _0x2f07=function(_0x356f64,_0x3a1bf1){_0x356f64=_0x356f64-0x0;var _0x3b3061=_0xf072[_0x356f64];return _0x3b3061;};'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 _0x7c09=['rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0x7c09,0x102));var _0x97c0=function(_0x157c68,_0x1e95f8){_0x157c68=_0x157c68-0x0;var _0x3ea428=_0x7c09[_0x157c68];return _0x3ea428;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'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 b606b69..30c3c8d 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 _0xfcf0=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util','bluebird'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xfcf0,0x138));var _0x0fcf=function(_0x47f7ec,_0x369f9d){_0x47f7ec=_0x47f7ec-0x0;var _0x415101=_0xfcf0[_0x47f7ec];return _0x415101;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});} \ No newline at end of file +var _0x1261=['then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x2ed522,_0x328f0f){var _0x56e49b=function(_0x290579){while(--_0x290579){_0x2ed522['push'](_0x2ed522['shift']());}};_0x56e49b(++_0x328f0f);}(_0x1261,0x144));var _0x1126=function(_0x514bd1,_0x25ea3e){_0x514bd1=_0x514bd1-0x0;var _0x58a281=_0x1261[_0x514bd1];return _0x58a281;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index ca30865..281debc 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 _0xab21=['index','put','/:id','isAuthenticated','downloadLogFile','exports','multer','util','connect-timeout','express','../../config/environment','./license.controller','get'];(function(_0x5f3dcb,_0x35321d){var _0x35ef9d=function(_0x41edeb){while(--_0x41edeb){_0x5f3dcb['push'](_0x5f3dcb['shift']());}};_0x35ef9d(++_0x35321d);}(_0xab21,0x10a));var _0x1ab2=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xab21[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0x1ab2('0x0'));var util=require(_0x1ab2('0x1'));var path=require('path');var timeout=require(_0x1ab2('0x2'));var express=require(_0x1ab2('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1ab2('0x4'));var controller=require(_0x1ab2('0x5'));router[_0x1ab2('0x6')]('/',controller[_0x1ab2('0x7')]);router[_0x1ab2('0x8')](_0x1ab2('0x9'),auth[_0x1ab2('0xa')](),controller['update']);router[_0x1ab2('0x6')]('/download_log_file',auth[_0x1ab2('0xa')](),controller[_0x1ab2('0xb')]);module[_0x1ab2('0xc')]=router; \ No newline at end of file +var _0xa102=['util','path','Router','fs-extra','../../components/interaction/service','put','/:id','get','isAuthenticated','downloadLogFile','exports'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0xa102,0xc6));var _0x2a10=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xa102[_0x5f0089];return _0x193892;};'use strict';var multer=require('multer');var util=require(_0x2a10('0x0'));var path=require(_0x2a10('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2a10('0x2')]();var fs_extra=require(_0x2a10('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2a10('0x4'));var config=require('../../config/environment');var controller=require('./license.controller');router['get']('/',controller['index']);router[_0x2a10('0x5')](_0x2a10('0x6'),auth['isAuthenticated'](),controller['update']);router[_0x2a10('0x7')]('/download_log_file',auth[_0x2a10('0x8')](),controller[_0x2a10('0x9')]);module[_0x2a10('0xa')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 1428e98..8be319b 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 _0xa290=['exports','TEXT','INTEGER','sequelize'];(function(_0x200e0a,_0x4bfcfc){var _0x222ca4=function(_0x3c57b5){while(--_0x3c57b5){_0x200e0a['push'](_0x200e0a['shift']());}};_0x222ca4(++_0x4bfcfc);}(_0xa290,0x16f));var _0x0a29=function(_0x50279a,_0x481795){_0x50279a=_0x50279a-0x0;var _0x621887=_0xa290[_0x50279a];return _0x621887;};'use strict';var Sequelize=require(_0x0a29('0x0'));module[_0x0a29('0x1')]={'license':{'type':Sequelize[_0x0a29('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x0a29('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9b35=['exports','STRING','sequelize'];(function(_0x340907,_0x4a9781){var _0x1cd555=function(_0x29b4b5){while(--_0x29b4b5){_0x340907['push'](_0x340907['shift']());}};_0x1cd555(++_0x4a9781);}(_0x9b35,0x6b));var _0x59b3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x9b35[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x59b3('0x0'));module[_0x59b3('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x59b3('0x2')]},'data2':{'type':Sequelize['STRING']},'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 68e19bb..be00bf9 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 _0x879c=['index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','options','getLicense','catch','body','License','find','params','get','key','demo','downloadLogFile','license-info.log','join','log','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0x879c,0xb4));var _0xc879=function(_0x29dacd,_0x131b04){_0x29dacd=_0x29dacd-0x0;var _0x111d0b=_0x879c[_0x29dacd];return _0x111d0b;};'use strict';var emlformat=require(_0xc879('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc879('0x1'));var jsonpatch=require(_0xc879('0x2'));var rp=require(_0xc879('0x3'));var moment=require('moment');var BPromise=require(_0xc879('0x4'));var Mustache=require(_0xc879('0x5'));var util=require(_0xc879('0x6'));var path=require(_0xc879('0x7'));var sox=require('sox');var csv=require(_0xc879('0x8'));var ejs=require(_0xc879('0x9'));var fs=require('fs');var fs_extra=require(_0xc879('0xa'));var _=require(_0xc879('0xb'));var squel=require(_0xc879('0xc'));var crypto=require(_0xc879('0xd'));var jsforce=require(_0xc879('0xe'));var deskjs=require(_0xc879('0xf'));var toCsv=require(_0xc879('0x8'));var querystring=require(_0xc879('0x10'));var Papa=require(_0xc879('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc879('0x12'));var as=require(_0xc879('0x13'));var hardwareService=require(_0xc879('0x14'));var logger=require(_0xc879('0x15'))(_0xc879('0x16'));var utils=require(_0xc879('0x17'));var config=require(_0xc879('0x18'));var licenseUtil=require(_0xc879('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28fe45,_0xdd7e0f){_0xdd7e0f=_0xdd7e0f||0xcc;return function(_0x110147){if(_0x110147){return _0x28fe45[_0xc879('0x1a')](_0xdd7e0f);}return _0x28fe45[_0xc879('0x1b')](_0xdd7e0f)[_0xc879('0x1c')]();};}function respondWithResult(_0x49075d,_0x375a2a){_0x375a2a=_0x375a2a||0xc8;return function(_0xe1e53c){if(_0xe1e53c){return _0x49075d[_0xc879('0x1b')](_0x375a2a)[_0xc879('0x1d')](_0xe1e53c);}};}function respondWithFilteredResult(_0x1d304,_0x1ecfd6){return function(_0x511354){if(_0x511354){var _0x2ef528=typeof _0x1ecfd6[_0xc879('0x1e')]===_0xc879('0x1f')&&typeof _0x1ecfd6['limit']==='undefined';var _0x3d51c3=_0x511354[_0xc879('0x20')];var _0x3165ba=_0x2ef528?0x0:_0x1ecfd6[_0xc879('0x1e')];var _0x464eb1=_0x2ef528?_0x511354['count']:_0x1ecfd6[_0xc879('0x1e')]+_0x1ecfd6[_0xc879('0x21')];var _0x30a021;if(_0x464eb1>=_0x3d51c3){_0x464eb1=_0x3d51c3;_0x30a021=0xc8;}else{_0x30a021=0xce;}_0x1d304[_0xc879('0x1b')](_0x30a021);return _0x1d304[_0xc879('0x22')](_0xc879('0x23'),_0x3165ba+'-'+_0x464eb1+'/'+_0x3d51c3)[_0xc879('0x1d')](_0x511354);}return null;};}function patchUpdates(_0x12e354){return function(_0x1b77ef){try{jsonpatch[_0xc879('0x24')](_0x1b77ef,_0x12e354,!![]);}catch(_0x485c63){return BPromise[_0xc879('0x25')](_0x485c63);}return _0x1b77ef[_0xc879('0x26')]();};}function saveUpdates(_0x4f2ae8,_0x40d6f0){return function(_0x57afbb){if(_0x57afbb){return _0x57afbb[_0xc879('0x27')](_0x4f2ae8)[_0xc879('0x28')](function(_0x3bfd88){return _0x3bfd88;});}return null;};}function removeEntity(_0x367d03,_0x1bc783){return function(_0x1b8ff9){if(_0x1b8ff9){return _0x1b8ff9[_0xc879('0x29')]()[_0xc879('0x28')](function(){_0x367d03[_0xc879('0x1b')](0xcc)[_0xc879('0x1c')]();});}};}function handleEntityNotFound(_0x35fecc,_0x19ead4){return function(_0x5e19f4){if(!_0x5e19f4){_0x35fecc[_0xc879('0x1a')](0x194);}return _0x5e19f4;};}function handleError(_0x5861ff,_0x296232){_0x296232=_0x296232||0x1f4;return function(_0x53ff19){logger[_0xc879('0x2a')](_0x53ff19[_0xc879('0x2b')]);if(_0x53ff19[_0xc879('0x2c')]){delete _0x53ff19[_0xc879('0x2c')];}_0x5861ff[_0xc879('0x1b')](_0x296232)['send'](_0x53ff19);};}var utilLicense=require(_0xc879('0x19'));exports[_0xc879('0x2d')]=function(_0x1d97aa,_0x713fc2){var _0x45f136={'raw':!![],'where':{'id':0x1}},_0x11c915={};_0x11c915[_0xc879('0x2e')]=_[_0xc879('0x2f')](db['License'][_0xc879('0x30')]);_0x11c915[_0xc879('0x31')]=_['keys'](_0x1d97aa[_0xc879('0x31')]);_0x11c915[_0xc879('0x32')]=_[_0xc879('0x33')](_0x11c915[_0xc879('0x2e')],_0x11c915[_0xc879('0x31')]);_0x45f136[_0xc879('0x34')]=_[_0xc879('0x33')](_0x11c915[_0xc879('0x2e')],qs[_0xc879('0x35')](_0x1d97aa[_0xc879('0x31')]['fields']));_0x45f136['attributes']=_0x45f136[_0xc879('0x34')][_0xc879('0x36')]?_0x45f136[_0xc879('0x34')]:_0x11c915['model'];_0x45f136=_['merge']({},_0x45f136,_0x1d97aa[_0xc879('0x37')]);return utilLicense[_0xc879('0x38')](_0x45f136)[_0xc879('0x28')](respondWithResult(_0x713fc2,null))[_0xc879('0x39')](handleError(_0x713fc2,null));};exports['update']=function(_0x371a34,_0x379a01){if(_0x371a34[_0xc879('0x3a')]['id']){delete _0x371a34[_0xc879('0x3a')]['id'];}return db[_0xc879('0x3b')][_0xc879('0x3c')]({'where':{'id':_0x371a34[_0xc879('0x3d')]['id']}})[_0xc879('0x28')](handleEntityNotFound(_0x379a01,null))[_0xc879('0x28')](function(_0x34fdf3){var _0x537117=_0x34fdf3[_0xc879('0x3e')]({'plain':!![]});return utilLicense['checkLicense'](_0x537117,_0x371a34[_0xc879('0x3a')][_0xc879('0x3f')]);})[_0xc879('0x28')](function(_0x9227e0){if(!_0x9227e0[_0xc879('0x40')]){return saveUpdates(_0x371a34[_0xc879('0x3a')],null);}return _0x9227e0;})[_0xc879('0x28')](respondWithResult(_0x379a01,null))[_0xc879('0x39')](handleError(_0x379a01,null));};exports[_0xc879('0x41')]=function(_0x39210d,_0x5c8e3a){var _0x1924e0=_0xc879('0x42');var _0x5b3dbf=path[_0xc879('0x43')]('/var',_0xc879('0x44'),_0xc879('0x45'),_0x1924e0);_0x5c8e3a['setHeader'](_0xc879('0x46'),_0xc879('0x47')+_0x1924e0);_0x5c8e3a[_0xc879('0x22')](_0xc879('0x48'),_0xc879('0x49'));_0x5c8e3a[_0xc879('0x4a')](_0x5b3dbf);}; \ No newline at end of file +var _0xb685=['get','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined','count','offset','limit','status','Content-Range','json','reject','save','update','then','error','name','index','model','keys','License','rawAttributes','query','intersection','attributes','fields','length','merge','options','catch','body','find','params'];(function(_0x1effc9,_0x4496d1){var _0x1cb7e5=function(_0x57ab6c){while(--_0x57ab6c){_0x1effc9['push'](_0x1effc9['shift']());}};_0x1cb7e5(++_0x4496d1);}(_0xb685,0xe2));var _0x5b68=function(_0x1d6fce,_0x4671c9){_0x1d6fce=_0x1d6fce-0x0;var _0x556c10=_0xb685[_0x1d6fce];return _0x556c10;};'use strict';var emlformat=require(_0x5b68('0x0'));var rimraf=require(_0x5b68('0x1'));var zipdir=require(_0x5b68('0x2'));var jsonpatch=require(_0x5b68('0x3'));var rp=require('request-promise');var moment=require(_0x5b68('0x4'));var BPromise=require(_0x5b68('0x5'));var Mustache=require(_0x5b68('0x6'));var util=require(_0x5b68('0x7'));var path=require(_0x5b68('0x8'));var sox=require(_0x5b68('0x9'));var csv=require(_0x5b68('0xa'));var ejs=require(_0x5b68('0xb'));var fs=require('fs');var fs_extra=require(_0x5b68('0xc'));var _=require(_0x5b68('0xd'));var squel=require(_0x5b68('0xe'));var crypto=require(_0x5b68('0xf'));var jsforce=require(_0x5b68('0x10'));var deskjs=require(_0x5b68('0x11'));var toCsv=require(_0x5b68('0xa'));var querystring=require(_0x5b68('0x12'));var Papa=require(_0x5b68('0x13'));var Redis=require('ioredis');var authService=require(_0x5b68('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5b68('0x15'));var hardwareService=require(_0x5b68('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x5b68('0x17'));var config=require(_0x5b68('0x18'));var licenseUtil=require(_0x5b68('0x19'));var db=require(_0x5b68('0x1a'))['db'];function respondWithStatusCode(_0x5c081d,_0x55dbb7){_0x55dbb7=_0x55dbb7||0xcc;return function(_0x437b01){if(_0x437b01){return _0x5c081d[_0x5b68('0x1b')](_0x55dbb7);}return _0x5c081d['status'](_0x55dbb7)[_0x5b68('0x1c')]();};}function respondWithResult(_0x3d48b7,_0x4ee3c3){_0x4ee3c3=_0x4ee3c3||0xc8;return function(_0x171daa){if(_0x171daa){return _0x3d48b7['status'](_0x4ee3c3)['json'](_0x171daa);}};}function respondWithFilteredResult(_0x12e95a,_0x193eb0){return function(_0x493863){if(_0x493863){var _0x5f3272=typeof _0x193eb0['offset']===_0x5b68('0x1d')&&typeof _0x193eb0['limit']===_0x5b68('0x1d');var _0x1e764e=_0x493863[_0x5b68('0x1e')];var _0x498228=_0x5f3272?0x0:_0x193eb0[_0x5b68('0x1f')];var _0x5e6531=_0x5f3272?_0x493863[_0x5b68('0x1e')]:_0x193eb0[_0x5b68('0x1f')]+_0x193eb0[_0x5b68('0x20')];var _0x5099e5;if(_0x5e6531>=_0x1e764e){_0x5e6531=_0x1e764e;_0x5099e5=0xc8;}else{_0x5099e5=0xce;}_0x12e95a[_0x5b68('0x21')](_0x5099e5);return _0x12e95a['set'](_0x5b68('0x22'),_0x498228+'-'+_0x5e6531+'/'+_0x1e764e)[_0x5b68('0x23')](_0x493863);}return null;};}function patchUpdates(_0x422520){return function(_0x518c2e){try{jsonpatch['apply'](_0x518c2e,_0x422520,!![]);}catch(_0x415438){return BPromise[_0x5b68('0x24')](_0x415438);}return _0x518c2e[_0x5b68('0x25')]();};}function saveUpdates(_0x5d6fd0,_0x1e2a92){return function(_0x5a9d13){if(_0x5a9d13){return _0x5a9d13[_0x5b68('0x26')](_0x5d6fd0)[_0x5b68('0x27')](function(_0xced31d){return _0xced31d;});}return null;};}function removeEntity(_0x401c2d,_0x315f59){return function(_0x159fe8){if(_0x159fe8){return _0x159fe8['destroy']()[_0x5b68('0x27')](function(){_0x401c2d[_0x5b68('0x21')](0xcc)[_0x5b68('0x1c')]();});}};}function handleEntityNotFound(_0x44dbab,_0x3188e3){return function(_0x2a7c63){if(!_0x2a7c63){_0x44dbab[_0x5b68('0x1b')](0x194);}return _0x2a7c63;};}function handleError(_0x22afb6,_0xd264d7){_0xd264d7=_0xd264d7||0x1f4;return function(_0x1260f3){logger[_0x5b68('0x28')](_0x1260f3['stack']);if(_0x1260f3[_0x5b68('0x29')]){delete _0x1260f3[_0x5b68('0x29')];}_0x22afb6[_0x5b68('0x21')](_0xd264d7)['send'](_0x1260f3);};}var utilLicense=require(_0x5b68('0x19'));exports[_0x5b68('0x2a')]=function(_0x328315,_0x3ff943){var _0x46741f={'raw':!![],'where':{'id':0x1}},_0x528ffc={};_0x528ffc[_0x5b68('0x2b')]=_[_0x5b68('0x2c')](db[_0x5b68('0x2d')][_0x5b68('0x2e')]);_0x528ffc['query']=_[_0x5b68('0x2c')](_0x328315[_0x5b68('0x2f')]);_0x528ffc['filters']=_[_0x5b68('0x30')](_0x528ffc['model'],_0x528ffc[_0x5b68('0x2f')]);_0x46741f[_0x5b68('0x31')]=_[_0x5b68('0x30')](_0x528ffc['model'],qs[_0x5b68('0x32')](_0x328315['query'][_0x5b68('0x32')]));_0x46741f[_0x5b68('0x31')]=_0x46741f['attributes'][_0x5b68('0x33')]?_0x46741f['attributes']:_0x528ffc[_0x5b68('0x2b')];_0x46741f=_[_0x5b68('0x34')]({},_0x46741f,_0x328315[_0x5b68('0x35')]);return utilLicense['getLicense'](_0x46741f)[_0x5b68('0x27')](respondWithResult(_0x3ff943,null))[_0x5b68('0x36')](handleError(_0x3ff943,null));};exports[_0x5b68('0x26')]=function(_0x2686d2,_0x26b168){if(_0x2686d2[_0x5b68('0x37')]['id']){delete _0x2686d2[_0x5b68('0x37')]['id'];}return db[_0x5b68('0x2d')][_0x5b68('0x38')]({'where':{'id':_0x2686d2[_0x5b68('0x39')]['id']}})[_0x5b68('0x27')](handleEntityNotFound(_0x26b168,null))[_0x5b68('0x27')](function(_0x493be8){var _0x3e203d=_0x493be8[_0x5b68('0x3a')]({'plain':!![]});return utilLicense['checkLicense'](_0x3e203d,_0x2686d2[_0x5b68('0x37')]['key']);})[_0x5b68('0x27')](function(_0x564793){if(!_0x564793['demo']){return saveUpdates(_0x2686d2['body'],null);}return _0x564793;})[_0x5b68('0x27')](respondWithResult(_0x26b168,null))[_0x5b68('0x36')](handleError(_0x26b168,null));};exports[_0x5b68('0x3b')]=function(_0x3e7f57,_0x434cf9){var _0x49a26d=_0x5b68('0x3c');var _0x5a7130=path[_0x5b68('0x3d')](_0x5b68('0x3e'),_0x5b68('0x3f'),_0x5b68('0x40'),_0x49a26d);_0x434cf9[_0x5b68('0x41')](_0x5b68('0x42'),_0x5b68('0x43')+_0x49a26d);_0x434cf9[_0x5b68('0x44')](_0x5b68('0x45'),_0x5b68('0x46'));_0x434cf9['download'](_0x5a7130);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index c00c011..c95021b 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 _0x310b=['define','lodash','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x310b,0x19e));var _0xb310=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x310b[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xb310('0x0'));var util=require('util');var logger=require(_0xb310('0x1'))(_0xb310('0x2'));var moment=require(_0xb310('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb310('0x4'));var config=require(_0xb310('0x5'));var attributes=require('./license.attributes');module['exports']=function(_0x449ad6,_0x1193c1){return _0x449ad6[_0xb310('0x6')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cec=['bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','license','lodash','util','../../config/logger','api','moment'];(function(_0x361231,_0xaf4ab){var _0x97daa3=function(_0x1e2966){while(--_0x1e2966){_0x361231['push'](_0x361231['shift']());}};_0x97daa3(++_0xaf4ab);}(_0x8cec,0x1f3));var _0xc8ce=function(_0x48f26c,_0x4e385e){_0x48f26c=_0x48f26c-0x0;var _0x411869=_0x8cec[_0x48f26c];return _0x411869;};'use strict';var _=require(_0xc8ce('0x0'));var util=require(_0xc8ce('0x1'));var logger=require(_0xc8ce('0x2'))(_0xc8ce('0x3'));var moment=require(_0xc8ce('0x4'));var BPromise=require(_0xc8ce('0x5'));var rp=require(_0xc8ce('0x6'));var fs=require('fs');var path=require(_0xc8ce('0x7'));var rimraf=require(_0xc8ce('0x8'));var config=require(_0xc8ce('0x9'));var attributes=require(_0xc8ce('0xa'));module['exports']=function(_0x868d35,_0x14d084){return _0x868d35['define']('License',attributes,{'tableName':_0xc8ce('0xb'),'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 4116c90..95eb10d 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 _0xbd97=['../../config/utils','../../config/logger','../../config/environment','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3d1ce2,_0x2a9d26){var _0x43c682=function(_0x1d3031){while(--_0x1d3031){_0x3d1ce2['push'](_0x3d1ce2['shift']());}};_0x43c682(++_0x2a9d26);}(_0xbd97,0xb2));var _0x7bd9=function(_0xd82263,_0x2cacf7){_0xd82263=_0xd82263-0x0;var _0x39cf23=_0xbd97[_0xd82263];return _0x39cf23;};'use strict';var _=require('lodash');var util=require(_0x7bd9('0x0'));var moment=require(_0x7bd9('0x1'));var BPromise=require(_0x7bd9('0x2'));var rs=require(_0x7bd9('0x3'));var fs=require('fs');var Redis=require(_0x7bd9('0x4'));var db=require(_0x7bd9('0x5'))['db'];var utils=require(_0x7bd9('0x6'));var logger=require(_0x7bd9('0x7'))('rpc');var config=require(_0x7bd9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bd9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59966c,_0x4ec93c,_0xfb2039){return new BPromise(function(_0x26c6a3,_0x1aaa33){return client[_0x7bd9('0xa')](_0x59966c,_0xfb2039)[_0x7bd9('0xb')](function(_0x330bc8){logger[_0x7bd9('0xc')](_0x7bd9('0xd'),_0x4ec93c,_0x7bd9('0xe'));logger[_0x7bd9('0xf')](_0x7bd9('0x10'),_0x4ec93c,_0x7bd9('0xe'),JSON[_0x7bd9('0x11')](_0x330bc8));if(_0x330bc8[_0x7bd9('0x12')]){if(_0x330bc8[_0x7bd9('0x12')][_0x7bd9('0x13')]===0x1f4){logger[_0x7bd9('0x12')]('License,\x20%s,\x20%s',_0x4ec93c,_0x330bc8['error'][_0x7bd9('0x14')]);return _0x1aaa33(_0x330bc8['error'][_0x7bd9('0x14')]);}logger['error']('License,\x20%s,\x20%s',_0x4ec93c,_0x330bc8[_0x7bd9('0x12')][_0x7bd9('0x14')]);return _0x26c6a3(_0x330bc8[_0x7bd9('0x12')]['message']);}else{logger[_0x7bd9('0xc')](_0x7bd9('0xd'),_0x4ec93c,'request\x20sent');_0x26c6a3(_0x330bc8[_0x7bd9('0x15')]['message']);}})[_0x7bd9('0x16')](function(_0x135f07){logger['error'](_0x7bd9('0xd'),_0x4ec93c,_0x135f07);_0x1aaa33(_0x135f07);});});} \ No newline at end of file +var _0x2215=['info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x4d27b6,_0x26be29){var _0x855eac=function(_0x1dee0f){while(--_0x1dee0f){_0x4d27b6['push'](_0x4d27b6['shift']());}};_0x855eac(++_0x26be29);}(_0x2215,0x11a));var _0x5221=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2215[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5221('0x0'));var util=require(_0x5221('0x1'));var moment=require(_0x5221('0x2'));var BPromise=require(_0x5221('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5221('0x4'));var db=require(_0x5221('0x5'))['db'];var utils=require(_0x5221('0x6'));var logger=require(_0x5221('0x7'))('rpc');var config=require(_0x5221('0x8'));var jayson=require(_0x5221('0x9'));var client=jayson[_0x5221('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x333435,_0x4ec3c7,_0x22143d){return new BPromise(function(_0x5bfc2f,_0x26eb6a){return client[_0x5221('0xb')](_0x333435,_0x22143d)['then'](function(_0x5ce0a2){logger[_0x5221('0xc')](_0x5221('0xd'),_0x4ec3c7,_0x5221('0xe'));logger[_0x5221('0xf')](_0x5221('0x10'),_0x4ec3c7,_0x5221('0xe'),JSON['stringify'](_0x5ce0a2));if(_0x5ce0a2[_0x5221('0x11')]){if(_0x5ce0a2[_0x5221('0x11')][_0x5221('0x12')]===0x1f4){logger[_0x5221('0x11')](_0x5221('0xd'),_0x4ec3c7,_0x5ce0a2[_0x5221('0x11')]['message']);return _0x26eb6a(_0x5ce0a2[_0x5221('0x11')][_0x5221('0x13')]);}logger[_0x5221('0x11')](_0x5221('0xd'),_0x4ec3c7,_0x5ce0a2[_0x5221('0x11')][_0x5221('0x13')]);return _0x5bfc2f(_0x5ce0a2['error']['message']);}else{logger[_0x5221('0xc')](_0x5221('0xd'),_0x4ec3c7,_0x5221('0xe'));_0x5bfc2f(_0x5ce0a2[_0x5221('0x14')]['message']);}})['catch'](function(_0x31f7af){logger[_0x5221('0x11')](_0x5221('0xd'),_0x4ec3c7,_0x31f7af);_0x26eb6a(_0x31f7af);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index e2784a1..e16b982 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 _0x9dbe=['/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put','/:id','delete','removeDispositions','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','addDisposition','create'];(function(_0x4788ca,_0x5cda70){var _0x28a6f5=function(_0xa6db8){while(--_0xa6db8){_0x4788ca['push'](_0x4788ca['shift']());}};_0x28a6f5(++_0x5cda70);}(_0x9dbe,0x13e));var _0xe9db=function(_0x11fc2c,_0x8dfa82){_0x11fc2c=_0x11fc2c-0x0;var _0x3df667=_0x9dbe[_0x11fc2c];return _0x3df667;};'use strict';var multer=require(_0xe9db('0x0'));var util=require(_0xe9db('0x1'));var path=require('path');var timeout=require(_0xe9db('0x2'));var express=require('express');var router=express[_0xe9db('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe9db('0x4'));var config=require(_0xe9db('0x5'));var controller=require('./mailAccount.controller');router[_0xe9db('0x6')]('/',auth[_0xe9db('0x7')](),controller['index']);router['get'](_0xe9db('0x8'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xe9db('0x7')](),controller[_0xe9db('0x9')]);router[_0xe9db('0x6')](_0xe9db('0xa'),auth[_0xe9db('0x7')](),controller[_0xe9db('0xb')]);router[_0xe9db('0x6')](_0xe9db('0xc'),auth[_0xe9db('0x7')](),controller[_0xe9db('0xd')]);router[_0xe9db('0x6')](_0xe9db('0xe'),auth['isAuthenticated'](),controller['getImap']);router[_0xe9db('0x6')]('/:id/out_servers',auth[_0xe9db('0x7')](),controller[_0xe9db('0xf')]);router[_0xe9db('0x6')](_0xe9db('0x10'),auth['isAuthenticated'](),controller[_0xe9db('0x11')]);router[_0xe9db('0x6')](_0xe9db('0x12'),auth[_0xe9db('0x7')](),controller[_0xe9db('0x13')]);router[_0xe9db('0x6')](_0xe9db('0x14'),auth['isAuthenticated'](),controller[_0xe9db('0x15')]);router[_0xe9db('0x6')]('/:id/verify',auth[_0xe9db('0x7')](),controller['verifySmtp']);router[_0xe9db('0x6')]('/:id/users',auth[_0xe9db('0x7')](),controller[_0xe9db('0x16')]);router[_0xe9db('0x17')](_0xe9db('0xa'),auth[_0xe9db('0x7')](),controller[_0xe9db('0x18')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0xe9db('0x17')]('/',auth['isAuthenticated'](),controller[_0xe9db('0x19')]);router[_0xe9db('0x17')](_0xe9db('0xe'),auth[_0xe9db('0x7')](),controller['addImap']);router[_0xe9db('0x17')](_0xe9db('0x1a'),auth[_0xe9db('0x7')](),controller[_0xe9db('0x1b')]);router[_0xe9db('0x17')](_0xe9db('0x10'),auth[_0xe9db('0x7')](),controller[_0xe9db('0x1c')]);router[_0xe9db('0x17')](_0xe9db('0x12'),auth[_0xe9db('0x7')](),controller[_0xe9db('0x1d')]);router['post'](_0xe9db('0x1e'),auth[_0xe9db('0x7')](),controller[_0xe9db('0x1f')]);router[_0xe9db('0x17')](_0xe9db('0x20'),auth[_0xe9db('0x7')](),controller[_0xe9db('0x21')]);router[_0xe9db('0x22')](_0xe9db('0x23'),auth[_0xe9db('0x7')](),controller['update']);router[_0xe9db('0x24')](_0xe9db('0xa'),auth['isAuthenticated'](),controller[_0xe9db('0x25')]);router[_0xe9db('0x24')](_0xe9db('0xc'),auth[_0xe9db('0x7')](),controller['removeAnswers']);router[_0xe9db('0x24')](_0xe9db('0xe'),auth[_0xe9db('0x7')](),controller[_0xe9db('0x26')]);router[_0xe9db('0x24')](_0xe9db('0x1a'),auth[_0xe9db('0x7')](),controller[_0xe9db('0x27')]);router[_0xe9db('0x24')](_0xe9db('0x23'),auth[_0xe9db('0x7')](),controller[_0xe9db('0x28')]);router[_0xe9db('0x24')](_0xe9db('0x20'),auth[_0xe9db('0x7')](),controller[_0xe9db('0x29')]);module[_0xe9db('0x2a')]=router; \ No newline at end of file +var _0x861d=['/:id/in_servers','getImap','/:id/interactions','getInteractions','/:id/applications','/:id/messages','verifySmtp','getAgents','addDisposition','post','addAnswer','create','addSmtp','addInteraction','addApplications','put','/:id','update','delete','removeDispositions','removeAnswers','/:id/out_servers','destroy','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','/describe','describe','get','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0xcbcda0,_0x2dde33){var _0x2b6d52=function(_0x8f4c60){while(--_0x8f4c60){_0xcbcda0['push'](_0xcbcda0['shift']());}};_0x2b6d52(++_0x2dde33);}(_0x861d,0xa4));var _0xd861=function(_0x36750c,_0x244ede){_0x36750c=_0x36750c-0x0;var _0x4ad347=_0x861d[_0x36750c];return _0x4ad347;};'use strict';var multer=require(_0xd861('0x0'));var util=require('util');var path=require(_0xd861('0x1'));var timeout=require(_0xd861('0x2'));var express=require(_0xd861('0x3'));var router=express[_0xd861('0x4')]();var fs_extra=require(_0xd861('0x5'));var auth=require(_0xd861('0x6'));var interaction=require(_0xd861('0x7'));var config=require(_0xd861('0x8'));var controller=require(_0xd861('0x9'));router['get']('/',auth[_0xd861('0xa')](),controller[_0xd861('0xb')]);router['get'](_0xd861('0xc'),auth[_0xd861('0xa')](),controller[_0xd861('0xd')]);router[_0xd861('0xe')]('/:id',auth[_0xd861('0xa')](),controller[_0xd861('0xf')]);router[_0xd861('0xe')](_0xd861('0x10'),auth[_0xd861('0xa')](),controller[_0xd861('0x11')]);router['get'](_0xd861('0x12'),auth[_0xd861('0xa')](),controller[_0xd861('0x13')]);router[_0xd861('0xe')](_0xd861('0x14'),auth[_0xd861('0xa')](),controller[_0xd861('0x15')]);router[_0xd861('0xe')]('/:id/out_servers',auth['isAuthenticated'](),controller['getSmtp']);router[_0xd861('0xe')](_0xd861('0x16'),auth['isAuthenticated'](),controller[_0xd861('0x17')]);router[_0xd861('0xe')](_0xd861('0x18'),auth[_0xd861('0xa')](),controller['getApplications']);router['get'](_0xd861('0x19'),auth[_0xd861('0xa')](),controller['getMessages']);router[_0xd861('0xe')]('/:id/verify',auth['isAuthenticated'](),controller[_0xd861('0x1a')]);router[_0xd861('0xe')]('/:id/users',auth[_0xd861('0xa')](),controller[_0xd861('0x1b')]);router['post'](_0xd861('0x10'),auth[_0xd861('0xa')](),controller[_0xd861('0x1c')]);router[_0xd861('0x1d')](_0xd861('0x12'),auth[_0xd861('0xa')](),controller[_0xd861('0x1e')]);router[_0xd861('0x1d')]('/',auth[_0xd861('0xa')](),controller[_0xd861('0x1f')]);router[_0xd861('0x1d')](_0xd861('0x14'),auth[_0xd861('0xa')](),controller['addImap']);router[_0xd861('0x1d')]('/:id/out_servers',auth[_0xd861('0xa')](),controller[_0xd861('0x20')]);router['post'](_0xd861('0x16'),auth['isAuthenticated'](),controller[_0xd861('0x21')]);router[_0xd861('0x1d')]('/:id/applications',auth[_0xd861('0xa')](),controller[_0xd861('0x22')]);router[_0xd861('0x1d')]('/:id/send',auth[_0xd861('0xa')](),controller['send']);router[_0xd861('0x1d')]('/:id/users',auth[_0xd861('0xa')](),controller['addAgents']);router[_0xd861('0x23')](_0xd861('0x24'),auth['isAuthenticated'](),controller[_0xd861('0x25')]);router[_0xd861('0x26')](_0xd861('0x10'),auth[_0xd861('0xa')](),controller[_0xd861('0x27')]);router['delete'](_0xd861('0x12'),auth[_0xd861('0xa')](),controller[_0xd861('0x28')]);router[_0xd861('0x26')]('/:id/in_servers',auth[_0xd861('0xa')](),controller['removeImap']);router['delete'](_0xd861('0x29'),auth[_0xd861('0xa')](),controller['removeSmtp']);router[_0xd861('0x26')](_0xd861('0x24'),auth[_0xd861('0xa')](),controller[_0xd861('0x2a')]);router[_0xd861('0x26')](_0xd861('0x2b'),auth[_0xd861('0xa')](),controller[_0xd861('0x2c')]);module[_0xd861('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 8c81468..b8e5241 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 _0x0782=['sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','custom','provider'];(function(_0x44e07f,_0x2b1e46){var _0x4bdf0d=function(_0x304ef0){while(--_0x304ef0){_0x44e07f['push'](_0x44e07f['shift']());}};_0x4bdf0d(++_0x2b1e46);}(_0x0782,0x1a4));var _0x2078=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x0782[_0x3b96cf];return _0x2e315a;};'use strict';var Sequelize=require(_0x2078('0x0'));module[_0x2078('0x1')]={'description':{'type':Sequelize[_0x2078('0x2')]},'name':{'type':Sequelize[_0x2078('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2078('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x2078('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x2078('0x4')]},'markAsUnread':{'type':Sequelize[_0x2078('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2078('0x2')],'allowNull':![],'defaultValue':_0x2078('0x5')},'fontSize':{'type':Sequelize[_0x2078('0x6')](0x2)[_0x2078('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2078('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[_0x2078('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2078('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2078('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2078('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2078('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2078('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2078('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2078('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x2078('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x2078('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4b909e){if(!_0x4b909e)this[_0x2078('0x9')](_0x2078('0xa'),null);this[_0x2078('0x9')](_0x2078('0xb'),_0x4b909e);}},'provider':{'type':Sequelize[_0x2078('0xc')](_0x2078('0xd'),_0x2078('0xe'),_0x2078('0xf'),_0x2078('0x10')),'defaultValue':null,'get':function(){if(!this[_0x2078('0x11')]('provider'))return _0x2078('0x12');return this[_0x2078('0x11')](_0x2078('0x13'));},'set':function(_0x324ae2){if(_0x324ae2==='custom')_0x324ae2=null;return this[_0x2078('0x9')](_0x2078('0x13'),_0x324ae2);}}}; \ No newline at end of file +var _0x1b23=['sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','ENUM','gmail','outlook365','custom','getDataValue','setDataValue'];(function(_0x1d4422,_0x2f5b5e){var _0x203a8f=function(_0x76265c){while(--_0x76265c){_0x1d4422['push'](_0x1d4422['shift']());}};_0x203a8f(++_0x2f5b5e);}(_0x1b23,0x186));var _0x31b2=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1b23[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x31b2('0x0'));module[_0x31b2('0x1')]={'description':{'type':Sequelize[_0x31b2('0x2')]},'name':{'type':Sequelize[_0x31b2('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x31b2('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x31b2('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x31b2('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x31b2('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x31b2('0x4')]},'markAsUnread':{'type':Sequelize[_0x31b2('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x31b2('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x31b2('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x31b2('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['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x31b2('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x31b2('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x31b2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x31b2('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x31b2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x31b2('0x6')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x31b2('0x7'),'set':function(_0x54f5da){if(!_0x54f5da)this['setDataValue'](_0x31b2('0x8'),null);this['setDataValue']('mandatoryDisposition',_0x54f5da);}},'provider':{'type':Sequelize[_0x31b2('0x9')](_0x31b2('0xa'),'hotmail','yahoo',_0x31b2('0xb')),'defaultValue':null,'get':function(){if(!this['getDataValue']('provider'))return _0x31b2('0xc');return this[_0x31b2('0xd')]('provider');},'set':function(_0x1289e7){if(_0x1289e7==='custom')_0x1289e7=null;return this[_0x31b2('0xe')]('provider',_0x1289e7);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index cf519ae..1ee2d94 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 _0x5e67=['fieldName','key','model','query','keys','filters','attributes','intersection','nolimit','order','sort','where','pick','filter','merge','type','options','MailAccount','includeAll','include','findAll','rows','show','params','Imap','Pause','rawAttributes','fields','length','find','body','modernAuthentication','CloudProviderId','describe','addDisposition','Disposition','create','getDispositions','hasOwnProperty','MailAccountId','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','provider','custom','email','ListId','isNil','description','user','username','password','pass','service','host','port','authentication','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','getImap','removeImap','setImap','getSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','fullname','Tag','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','Contacts','DESC','from','%s\x20<%s>','attachments','join','root','basename','auth','secure','sendMail','List\x20not\x20found','defaults','subject','attach','out','Interaction','Messages','CloudProvider','data5','verifySmtp','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','MailAccount,\x20%s,\x20%s','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','update','destroy','get','UserProfileResource','name','send','index','MailServerIn','MailServerOut','Smtp','mandatoryDispositionPause','map'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5e67,0x1e4));var _0x75e6=function(_0x24c621,_0x32480c){_0x24c621=_0x24c621-0x0;var _0x4046ff=_0x5e67[_0x24c621];return _0x4046ff;};'use strict';var moment=require(_0x75e6('0x0'));var BPromise=require(_0x75e6('0x1'));var util=require(_0x75e6('0x2'));var path=require('path');var _=require(_0x75e6('0x3'));var juice=require(_0x75e6('0x4'));var Redis=require(_0x75e6('0x5'));var qs=require(_0x75e6('0x6'));var logger=require(_0x75e6('0x7'))(_0x75e6('0x8'));var config=require(_0x75e6('0x9'));var db=require(_0x75e6('0xa'))['db'];config[_0x75e6('0xb')]=_['defaults'](config[_0x75e6('0xb')],{'host':_0x75e6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x75e6('0xb')]));require(_0x75e6('0xd'))[_0x75e6('0xe')](socket);var jayson=require(_0x75e6('0xf'));var client=jayson[_0x75e6('0x10')][_0x75e6('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x40073c,_0x49d230,_0xc19f5b,_0x36bd5f){return new BPromise(function(_0x3d4d74,_0xb57283){var _0x31df2f=_0x36bd5f||client;return _0x31df2f[_0x75e6('0x12')](_0x40073c,_0xc19f5b)[_0x75e6('0x13')](function(_0x29b2f0){logger[_0x75e6('0x14')]('MailAccount,\x20%s,\x20%s',_0x49d230,_0x75e6('0x15'));logger[_0x75e6('0x16')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x49d230,_0x75e6('0x15'),JSON[_0x75e6('0x17')](_0x29b2f0));if(_0x29b2f0['error']){if(_0x29b2f0[_0x75e6('0x18')]['code']===0x1f4){logger[_0x75e6('0x18')]('MailAccount,\x20%s,\x20%s',_0x49d230,_0x29b2f0['error'][_0x75e6('0x19')]);return _0xb57283(_0x29b2f0['error'][_0x75e6('0x19')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x49d230,_0x29b2f0[_0x75e6('0x18')]['message']);return _0x3d4d74(_0x29b2f0[_0x75e6('0x18')][_0x75e6('0x19')]);}else{logger[_0x75e6('0x14')](_0x75e6('0x1a'),_0x49d230,_0x75e6('0x15'));_0x3d4d74(_0x29b2f0['result'][_0x75e6('0x19')]);}})[_0x75e6('0x1b')](function(_0x28c60e){logger[_0x75e6('0x18')](_0x75e6('0x1a'),_0x49d230,_0x28c60e);_0xb57283(_0x28c60e);});});}function respondWithStatusCode(_0x2e5bbe,_0x2e598b){_0x2e598b=_0x2e598b||0xcc;return function(_0x1b494e){if(_0x1b494e){return _0x2e5bbe[_0x75e6('0x1c')](_0x2e598b);}return _0x2e5bbe[_0x75e6('0x1d')](_0x2e598b)[_0x75e6('0x1e')]();};}function respondWithResult(_0x51f28a,_0x3cd9b1){_0x3cd9b1=_0x3cd9b1||0xc8;return function(_0x352d2d){if(_0x352d2d){return _0x51f28a[_0x75e6('0x1d')](_0x3cd9b1)[_0x75e6('0x1f')](_0x352d2d);}};}function respondWithFilteredResult(_0x326d4b,_0x2cfe98){return function(_0x35c33b){if(_0x35c33b){var _0xdbbae1=typeof _0x2cfe98['offset']===_0x75e6('0x20')&&typeof _0x2cfe98[_0x75e6('0x21')]==='undefined';var _0x3d2aa3=_0x35c33b['count'];var _0x496f53=_0xdbbae1?0x0:_0x2cfe98[_0x75e6('0x22')];var _0x3500d2=_0xdbbae1?_0x35c33b[_0x75e6('0x23')]:_0x2cfe98[_0x75e6('0x22')]+_0x2cfe98[_0x75e6('0x21')];var _0xacd98;if(_0x3500d2>=_0x3d2aa3){_0x3500d2=_0x3d2aa3;_0xacd98=0xc8;}else{_0xacd98=0xce;}_0x326d4b[_0x75e6('0x1d')](_0xacd98);return _0x326d4b[_0x75e6('0x24')](_0x75e6('0x25'),_0x496f53+'-'+_0x3500d2+'/'+_0x3d2aa3)['json'](_0x35c33b);}return null;};}function saveUpdates(_0xf066ce){return function(_0x11db36){if(_0x11db36){return _0x11db36[_0x75e6('0x26')](_0xf066ce)['then'](function(_0xa9c821){return _0xa9c821;});}return null;};}function removeEntity(_0x39e485){return function(_0x26994b){if(_0x26994b){return _0x26994b[_0x75e6('0x27')]()['then'](function(){var _0x5edd87=_0x26994b[_0x75e6('0x28')]({'plain':!![]});var _0x43db7b='MailAccounts';return db[_0x75e6('0x29')]['destroy']({'where':{'type':_0x43db7b,'resourceId':_0x5edd87['id']}})[_0x75e6('0x13')](function(){return _0x26994b;});})[_0x75e6('0x13')](function(){_0x39e485[_0x75e6('0x1d')](0xcc)[_0x75e6('0x1e')]();});}};}function handleEntityNotFound(_0x972490){return function(_0x540eda){if(!_0x540eda){_0x972490[_0x75e6('0x1c')](0x194);}return _0x540eda;};}function handleError(_0x311f1c,_0x282b40){_0x282b40=_0x282b40||0x1f4;return function(_0x116992){logger[_0x75e6('0x18')](_0x116992['stack']);if(_0x116992[_0x75e6('0x2a')]){delete _0x116992['name'];}_0x311f1c[_0x75e6('0x1d')](_0x282b40)[_0x75e6('0x2b')](_0x116992);};}exports[_0x75e6('0x2c')]=function(_0x509d88,_0xe4c423){var _0x361d29={'include':[{'model':db[_0x75e6('0x2d')],'as':'Imap'},{'model':db[_0x75e6('0x2e')],'as':_0x75e6('0x2f')},{'model':db['Pause'],'as':_0x75e6('0x30')}]},_0x40b096={},_0x186e55={'count':0x0,'rows':[]};var _0x293456=_[_0x75e6('0x31')](db['MailAccount']['rawAttributes'],function(_0x9d6a87){return{'name':_0x9d6a87[_0x75e6('0x32')],'type':_0x9d6a87['type'][_0x75e6('0x33')]};});_0x40b096[_0x75e6('0x34')]=_[_0x75e6('0x31')](_0x293456,'name');_0x40b096[_0x75e6('0x35')]=_[_0x75e6('0x36')](_0x509d88[_0x75e6('0x35')]);_0x40b096[_0x75e6('0x37')]=_['intersection'](_0x40b096['model'],_0x40b096[_0x75e6('0x35')]);_0x361d29[_0x75e6('0x38')]=_[_0x75e6('0x39')](_0x40b096[_0x75e6('0x34')],qs['fields'](_0x509d88['query']['fields']));_0x361d29[_0x75e6('0x38')]=_0x361d29[_0x75e6('0x38')]['length']?_0x361d29[_0x75e6('0x38')]:_0x40b096[_0x75e6('0x34')];if(!_0x509d88[_0x75e6('0x35')]['hasOwnProperty'](_0x75e6('0x3a'))){_0x361d29[_0x75e6('0x21')]=qs[_0x75e6('0x21')](_0x509d88[_0x75e6('0x35')][_0x75e6('0x21')]);_0x361d29[_0x75e6('0x22')]=qs[_0x75e6('0x22')](_0x509d88['query']['offset']);}_0x361d29[_0x75e6('0x3b')]=qs['sort'](_0x509d88[_0x75e6('0x35')][_0x75e6('0x3c')]);_0x361d29[_0x75e6('0x3d')]=qs['filters'](_[_0x75e6('0x3e')](_0x509d88[_0x75e6('0x35')],_0x40b096[_0x75e6('0x37')]),_0x293456);if(_0x509d88[_0x75e6('0x35')][_0x75e6('0x3f')]){_0x361d29['where']=_[_0x75e6('0x40')](_0x361d29[_0x75e6('0x3d')],{'$or':_[_0x75e6('0x31')](_0x293456,function(_0x317bde){if(_0x317bde[_0x75e6('0x41')]!=='VIRTUAL'){var _0x284a6c={};_0x284a6c[_0x317bde[_0x75e6('0x2a')]]={'$like':'%'+_0x509d88[_0x75e6('0x35')]['filter']+'%'};return _0x284a6c;}})});}_0x361d29=_['merge']({},_0x361d29,_0x509d88[_0x75e6('0x42')]);var _0x1fbcf0={'where':_0x361d29[_0x75e6('0x3d')]};return db[_0x75e6('0x43')][_0x75e6('0x23')](_0x1fbcf0)[_0x75e6('0x13')](function(_0x4eb1e7){_0x186e55[_0x75e6('0x23')]=_0x4eb1e7;if(_0x509d88[_0x75e6('0x35')][_0x75e6('0x44')]){_0x361d29[_0x75e6('0x45')]=[{'all':!![]}];}return db[_0x75e6('0x43')][_0x75e6('0x46')](_0x361d29);})[_0x75e6('0x13')](function(_0x4611b3){_0x186e55[_0x75e6('0x47')]=_0x4611b3;return _0x186e55;})['then'](respondWithFilteredResult(_0xe4c423,_0x361d29))[_0x75e6('0x1b')](handleError(_0xe4c423,null));};exports[_0x75e6('0x48')]=function(_0x15eb04,_0x1ac80f){var _0x30f0b7={'raw':![],'where':{'id':_0x15eb04[_0x75e6('0x49')]['id']},'include':[{'model':db[_0x75e6('0x2d')],'as':_0x75e6('0x4a')},{'model':db[_0x75e6('0x2e')],'as':_0x75e6('0x2f')},{'model':db[_0x75e6('0x4b')],'as':_0x75e6('0x30')}]},_0x4e9865={};_0x4e9865[_0x75e6('0x34')]=_['keys'](db['MailAccount'][_0x75e6('0x4c')]);_0x4e9865[_0x75e6('0x35')]=_[_0x75e6('0x36')](_0x15eb04[_0x75e6('0x35')]);_0x4e9865['filters']=_[_0x75e6('0x39')](_0x4e9865['model'],_0x4e9865['query']);_0x30f0b7['attributes']=_[_0x75e6('0x39')](_0x4e9865[_0x75e6('0x34')],qs[_0x75e6('0x4d')](_0x15eb04[_0x75e6('0x35')][_0x75e6('0x4d')]));_0x30f0b7[_0x75e6('0x38')]=_0x30f0b7['attributes'][_0x75e6('0x4e')]?_0x30f0b7['attributes']:_0x4e9865['model'];if(_0x15eb04[_0x75e6('0x35')]['includeAll']){_0x30f0b7['include']=[{'all':!![]}];}_0x30f0b7=_[_0x75e6('0x40')]({},_0x30f0b7,_0x15eb04[_0x75e6('0x42')]);return db[_0x75e6('0x43')][_0x75e6('0x4f')](_0x30f0b7)[_0x75e6('0x13')](handleEntityNotFound(_0x1ac80f,null))[_0x75e6('0x13')](respondWithResult(_0x1ac80f,null))[_0x75e6('0x1b')](handleError(_0x1ac80f,null));};exports['update']=function(_0x4cca90,_0x1df1bd){if(_0x4cca90[_0x75e6('0x50')]['id']){delete _0x4cca90['body']['id'];}if(_0x4cca90['body'][_0x75e6('0x4a')]){if(!_0x4cca90['body']['Imap'][_0x75e6('0x51')]){_0x4cca90[_0x75e6('0x50')]['Imap']['CloudProviderId']=null;}}if(_0x4cca90['body'][_0x75e6('0x2f')]){if(!_0x4cca90[_0x75e6('0x50')]['Smtp'][_0x75e6('0x51')]){_0x4cca90[_0x75e6('0x50')][_0x75e6('0x2f')][_0x75e6('0x52')]=null;}}return db[_0x75e6('0x43')]['find']({'where':{'id':_0x4cca90[_0x75e6('0x49')]['id']},'include':[{'model':db[_0x75e6('0x2d')],'as':_0x75e6('0x4a')},{'model':db['MailServerOut'],'as':_0x75e6('0x2f')},{'model':db[_0x75e6('0x4b')],'as':_0x75e6('0x30')}]})[_0x75e6('0x13')](handleEntityNotFound(_0x1df1bd,null))[_0x75e6('0x13')](saveUpdates(_0x4cca90[_0x75e6('0x50')],null))['then'](function(_0x443961){if(_0x443961&&_0x4cca90[_0x75e6('0x50')][_0x75e6('0x4a')]){return db[_0x75e6('0x2d')][_0x75e6('0x26')](_0x4cca90[_0x75e6('0x50')][_0x75e6('0x4a')],{'where':{'MailAccountId':_0x443961['id']}})['then'](function(){return _0x443961;});}return _0x443961;})['then'](function(_0x56681c){if(_0x56681c&&_0x4cca90[_0x75e6('0x50')][_0x75e6('0x2f')]){return db[_0x75e6('0x2e')][_0x75e6('0x26')](_0x4cca90[_0x75e6('0x50')][_0x75e6('0x2f')],{'where':{'MailAccountId':_0x56681c['id']}})[_0x75e6('0x13')](function(){return _0x56681c;});}return _0x56681c;})[_0x75e6('0x13')](respondWithResult(_0x1df1bd,null))[_0x75e6('0x1b')](handleError(_0x1df1bd,null));};exports[_0x75e6('0x53')]=function(_0x320d21,_0x36b4b2){return db[_0x75e6('0x43')]['describe']()[_0x75e6('0x13')](respondWithResult(_0x36b4b2,null))[_0x75e6('0x1b')](handleError(_0x36b4b2,null));};exports[_0x75e6('0x54')]=function(_0x4ceb3c,_0x2b7108){if(_0x4ceb3c[_0x75e6('0x50')]['id']){delete _0x4ceb3c[_0x75e6('0x50')]['id'];}return db[_0x75e6('0x43')][_0x75e6('0x4f')]({'where':{'id':_0x4ceb3c[_0x75e6('0x49')]['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0x2b7108,null))[_0x75e6('0x13')](function(_0x215687){if(_0x215687){_0x4ceb3c[_0x75e6('0x50')]['MailAccountId']=_0x215687['id'];return db[_0x75e6('0x55')][_0x75e6('0x56')](_0x4ceb3c[_0x75e6('0x50')]);}})[_0x75e6('0x13')](respondWithResult(_0x2b7108,null))[_0x75e6('0x1b')](handleError(_0x2b7108,null));};exports[_0x75e6('0x57')]=function(_0x211c1c,_0x41e942){var _0x42f114={'raw':![],'where':{}};var _0x4cc48d={};var _0xfe5908={'count':0x0,'rows':[]};return db[_0x75e6('0x43')]['findOne']({'where':{'id':_0x211c1c[_0x75e6('0x49')]['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0x41e942,null))[_0x75e6('0x13')](function(_0x4f3312){if(_0x4f3312){_0x4cc48d[_0x75e6('0x34')]=_[_0x75e6('0x36')](db[_0x75e6('0x55')]['rawAttributes']);_0x4cc48d[_0x75e6('0x35')]=_[_0x75e6('0x36')](_0x211c1c[_0x75e6('0x35')]);_0x4cc48d['filters']=_[_0x75e6('0x39')](_0x4cc48d[_0x75e6('0x34')],_0x4cc48d[_0x75e6('0x35')]);_0x42f114['attributes']=_['intersection'](_0x4cc48d[_0x75e6('0x34')],qs[_0x75e6('0x4d')](_0x211c1c['query'][_0x75e6('0x4d')]));_0x42f114[_0x75e6('0x38')]=_0x42f114[_0x75e6('0x38')][_0x75e6('0x4e')]?_0x42f114[_0x75e6('0x38')]:_0x4cc48d[_0x75e6('0x34')];if(!_0x211c1c[_0x75e6('0x35')][_0x75e6('0x58')](_0x75e6('0x3a'))){_0x42f114[_0x75e6('0x21')]=qs[_0x75e6('0x21')](_0x211c1c[_0x75e6('0x35')][_0x75e6('0x21')]);_0x42f114['offset']=qs['offset'](_0x211c1c[_0x75e6('0x35')][_0x75e6('0x22')]);}_0x42f114[_0x75e6('0x3b')]=qs[_0x75e6('0x3c')](_0x211c1c['query'][_0x75e6('0x3c')]);_0x42f114[_0x75e6('0x3d')]=qs['filters'](_[_0x75e6('0x3e')](_0x211c1c['query'],_0x4cc48d[_0x75e6('0x37')]));_0x42f114['where'][_0x75e6('0x59')]=_0x4f3312['id'];if(_0x211c1c[_0x75e6('0x35')][_0x75e6('0x3f')]){_0x42f114[_0x75e6('0x3d')]=_[_0x75e6('0x40')](_0x42f114[_0x75e6('0x3d')],{'$or':_[_0x75e6('0x31')](_0x42f114['attributes'],function(_0x459cec){var _0x30ef00={};_0x30ef00[_0x459cec]={'$like':'%'+_0x211c1c['query'][_0x75e6('0x3f')]+'%'};return _0x30ef00;})});}_0x42f114=_['merge']({},_0x42f114,_0x211c1c[_0x75e6('0x42')]);return db[_0x75e6('0x55')][_0x75e6('0x23')]({'where':_0x42f114['where']})[_0x75e6('0x13')](function(_0x37097b){_0xfe5908[_0x75e6('0x23')]=_0x37097b;if(_0x211c1c[_0x75e6('0x35')][_0x75e6('0x44')]){_0x42f114['include']=[{'all':!![]}];}return db[_0x75e6('0x55')][_0x75e6('0x46')](_0x42f114);})[_0x75e6('0x13')](function(_0x4efc26){_0xfe5908[_0x75e6('0x47')]=_0x4efc26;return _0xfe5908;});}})[_0x75e6('0x13')](respondWithFilteredResult(_0x41e942,_0x42f114))['catch'](handleError(_0x41e942,null));};exports[_0x75e6('0x5a')]=function(_0x644298,_0x7f75aa){return db[_0x75e6('0x43')][_0x75e6('0x4f')]({'where':{'id':_0x644298['params']['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0x7f75aa,null))['then'](function(_0x329ed6){if(_0x329ed6){return _0x329ed6[_0x75e6('0x5a')](_0x644298['query'][_0x75e6('0x5b')]);}})['then'](respondWithStatusCode(_0x7f75aa,null))[_0x75e6('0x1b')](handleError(_0x7f75aa,null));};exports['addAnswer']=function(_0x200514,_0x381281){if(_0x200514[_0x75e6('0x50')]['id']){delete _0x200514[_0x75e6('0x50')]['id'];}return db[_0x75e6('0x43')][_0x75e6('0x4f')]({'where':{'id':_0x200514['params']['id']}})['then'](handleEntityNotFound(_0x381281,null))[_0x75e6('0x13')](function(_0x942244){if(_0x942244){_0x200514[_0x75e6('0x50')][_0x75e6('0x59')]=_0x942244['id'];return db[_0x75e6('0x5c')][_0x75e6('0x56')](_0x200514['body']);}})[_0x75e6('0x13')](respondWithResult(_0x381281,null))[_0x75e6('0x1b')](handleError(_0x381281,null));};exports[_0x75e6('0x5d')]=function(_0x3c11cf,_0xe5251e){var _0x4fb567={'raw':![],'where':{}};var _0x86430e={};var _0x53f15e={'count':0x0,'rows':[]};return db['MailAccount'][_0x75e6('0x5e')]({'where':{'id':_0x3c11cf['params']['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0xe5251e,null))['then'](function(_0xc936ad){if(_0xc936ad){_0x86430e[_0x75e6('0x34')]=_[_0x75e6('0x36')](db[_0x75e6('0x5c')][_0x75e6('0x4c')]);_0x86430e[_0x75e6('0x35')]=_['keys'](_0x3c11cf[_0x75e6('0x35')]);_0x86430e[_0x75e6('0x37')]=_[_0x75e6('0x39')](_0x86430e[_0x75e6('0x34')],_0x86430e[_0x75e6('0x35')]);_0x4fb567[_0x75e6('0x38')]=_[_0x75e6('0x39')](_0x86430e[_0x75e6('0x34')],qs[_0x75e6('0x4d')](_0x3c11cf[_0x75e6('0x35')][_0x75e6('0x4d')]));_0x4fb567[_0x75e6('0x38')]=_0x4fb567[_0x75e6('0x38')][_0x75e6('0x4e')]?_0x4fb567[_0x75e6('0x38')]:_0x86430e[_0x75e6('0x34')];if(!_0x3c11cf['query'][_0x75e6('0x58')](_0x75e6('0x3a'))){_0x4fb567[_0x75e6('0x21')]=qs[_0x75e6('0x21')](_0x3c11cf[_0x75e6('0x35')]['limit']);_0x4fb567[_0x75e6('0x22')]=qs[_0x75e6('0x22')](_0x3c11cf['query'][_0x75e6('0x22')]);}_0x4fb567['order']=qs[_0x75e6('0x3c')](_0x3c11cf['query'][_0x75e6('0x3c')]);_0x4fb567[_0x75e6('0x3d')]=qs[_0x75e6('0x37')](_[_0x75e6('0x3e')](_0x3c11cf[_0x75e6('0x35')],_0x86430e[_0x75e6('0x37')]));_0x4fb567[_0x75e6('0x3d')][_0x75e6('0x59')]=_0xc936ad['id'];if(_0x3c11cf[_0x75e6('0x35')][_0x75e6('0x3f')]){_0x4fb567[_0x75e6('0x3d')]=_[_0x75e6('0x40')](_0x4fb567[_0x75e6('0x3d')],{'$or':_[_0x75e6('0x31')](_0x4fb567['attributes'],function(_0x222e97){var _0x5c215b={};_0x5c215b[_0x222e97]={'$like':'%'+_0x3c11cf[_0x75e6('0x35')][_0x75e6('0x3f')]+'%'};return _0x5c215b;})});}_0x4fb567=_[_0x75e6('0x40')]({},_0x4fb567,_0x3c11cf[_0x75e6('0x42')]);return db[_0x75e6('0x5c')][_0x75e6('0x23')]({'where':_0x4fb567[_0x75e6('0x3d')]})[_0x75e6('0x13')](function(_0x523648){_0x53f15e[_0x75e6('0x23')]=_0x523648;if(_0x3c11cf['query'][_0x75e6('0x44')]){_0x4fb567['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x75e6('0x46')](_0x4fb567);})[_0x75e6('0x13')](function(_0x3d6b44){_0x53f15e[_0x75e6('0x47')]=_0x3d6b44;return _0x53f15e;});}})[_0x75e6('0x13')](respondWithFilteredResult(_0xe5251e,_0x4fb567))['catch'](handleError(_0xe5251e,null));};exports[_0x75e6('0x5f')]=function(_0x4ea8f7,_0x44cd18){return db['MailAccount'][_0x75e6('0x4f')]({'where':{'id':_0x4ea8f7[_0x75e6('0x49')]['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0x44cd18,null))[_0x75e6('0x13')](function(_0x2ca143){if(_0x2ca143){return _0x2ca143[_0x75e6('0x5f')](_0x4ea8f7[_0x75e6('0x35')][_0x75e6('0x5b')]);}})[_0x75e6('0x13')](respondWithStatusCode(_0x44cd18,null))[_0x75e6('0x1b')](handleError(_0x44cd18,null));};exports[_0x75e6('0x56')]=function(_0x37c63f,_0x2e3d84){var _0x1fcf32={'name':_0x37c63f['body'][_0x75e6('0x2a')],'key':_0x37c63f['body'][_0x75e6('0x33')],'provider':_0x37c63f['body'][_0x75e6('0x60')]===_0x75e6('0x61')?null:_0x37c63f[_0x75e6('0x50')]['provider'],'email':_0x37c63f[_0x75e6('0x50')][_0x75e6('0x62')],'ListId':_0x37c63f['body'][_0x75e6('0x63')],'active':!_[_0x75e6('0x64')](_0x37c63f['body']['active'])?_0x37c63f[_0x75e6('0x50')]['active']:!![],'description':_0x37c63f[_0x75e6('0x50')][_0x75e6('0x65')]||null,'Imap':{},'Smtp':{}};if(_0x1fcf32[_0x75e6('0x60')]){_0x1fcf32['Imap']['user']=_0x1fcf32[_0x75e6('0x2f')][_0x75e6('0x66')]=_0x37c63f['body'][_0x75e6('0x67')];_0x1fcf32[_0x75e6('0x4a')]['password']=_0x1fcf32[_0x75e6('0x2f')]['pass']=_0x37c63f[_0x75e6('0x50')][_0x75e6('0x68')];if(_0x37c63f['body'][_0x75e6('0x51')]){_0x1fcf32['Imap']['modernAuthentication']=_0x1fcf32[_0x75e6('0x2f')][_0x75e6('0x51')]=!![];_0x1fcf32[_0x75e6('0x4a')]['CloudProviderId']=_0x1fcf32['Smtp']['CloudProviderId']=_0x37c63f[_0x75e6('0x50')][_0x75e6('0x52')];_0x1fcf32[_0x75e6('0x4a')][_0x75e6('0x68')]=_0x1fcf32[_0x75e6('0x2f')][_0x75e6('0x69')]=null;}else{_0x1fcf32[_0x75e6('0x4a')]['CloudProviderId']=_0x1fcf32[_0x75e6('0x2f')][_0x75e6('0x52')]=null;}_0x1fcf32['Imap'][_0x75e6('0x6a')]=_0x1fcf32[_0x75e6('0x2f')][_0x75e6('0x6a')]=null;_0x1fcf32[_0x75e6('0x4a')][_0x75e6('0x6b')]=_0x1fcf32[_0x75e6('0x2f')][_0x75e6('0x6b')]=null;_0x1fcf32[_0x75e6('0x4a')][_0x75e6('0x6c')]=_0x1fcf32[_0x75e6('0x2f')][_0x75e6('0x6c')]=null;}else{if(_0x37c63f['body']['authentication']){_0x1fcf32[_0x75e6('0x4a')][_0x75e6('0x66')]=_0x1fcf32[_0x75e6('0x2f')][_0x75e6('0x66')]=_0x37c63f[_0x75e6('0x50')]['username'];_0x1fcf32[_0x75e6('0x4a')]['password']=_0x1fcf32[_0x75e6('0x2f')][_0x75e6('0x69')]=_0x37c63f[_0x75e6('0x50')][_0x75e6('0x68')];}else{_0x1fcf32[_0x75e6('0x4a')][_0x75e6('0x6d')]=_0x1fcf32['Smtp'][_0x75e6('0x6d')]=![];_0x1fcf32[_0x75e6('0x4a')]['user']=_0x1fcf32[_0x75e6('0x2f')]['user']=null;_0x1fcf32[_0x75e6('0x4a')][_0x75e6('0x68')]=_0x1fcf32[_0x75e6('0x2f')][_0x75e6('0x69')]=null;}_0x1fcf32[_0x75e6('0x4a')]['host']=_0x37c63f[_0x75e6('0x50')][_0x75e6('0x4a')][_0x75e6('0x6b')];_0x1fcf32[_0x75e6('0x4a')][_0x75e6('0x6c')]=_0x37c63f[_0x75e6('0x50')][_0x75e6('0x4a')][_0x75e6('0x6c')];_0x1fcf32['Smtp']['host']=_0x37c63f[_0x75e6('0x50')][_0x75e6('0x2f')][_0x75e6('0x6b')];_0x1fcf32[_0x75e6('0x2f')]['port']=_0x37c63f['body']['Smtp'][_0x75e6('0x6c')];}return db[_0x75e6('0x43')][_0x75e6('0x56')](_0x1fcf32,{'include':[{'model':db['MailServerOut'],'as':_0x75e6('0x2f')},{'model':db[_0x75e6('0x2d')],'as':_0x75e6('0x4a')}]})[_0x75e6('0x13')](function(_0x5a66c2){var _0x4e9a74=_0x37c63f[_0x75e6('0x66')][_0x75e6('0x28')]({'plain':!![]});if(!_0x4e9a74)throw new Error(_0x75e6('0x6e'));if(_0x4e9a74[_0x75e6('0x6f')]===_0x75e6('0x66')){var _0x35cb27=_0x5a66c2['get']({'plain':!![]});return db[_0x75e6('0x70')]['find']({'where':{'name':_0x75e6('0x71'),'userProfileId':_0x4e9a74[_0x75e6('0x72')]},'raw':!![]})['then'](function(_0xd405bb){if(_0xd405bb&&_0xd405bb[_0x75e6('0x73')]===0x0){return db[_0x75e6('0x29')]['create']({'name':_0x35cb27[_0x75e6('0x2a')],'resourceId':_0x35cb27['id'],'type':_0xd405bb[_0x75e6('0x2a')],'sectionId':_0xd405bb['id']},{})[_0x75e6('0x13')](function(){return _0x5a66c2;});}else{return _0x5a66c2;}})[_0x75e6('0x1b')](function(_0x2a96d6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a96d6);throw _0x2a96d6;});}return _0x5a66c2;})[_0x75e6('0x13')](respondWithResult(_0x2e3d84,0xc9))[_0x75e6('0x1b')](handleError(_0x2e3d84,null));};exports['getImap']=function(_0x2f2056,_0xb6f4a7){return db[_0x75e6('0x43')][_0x75e6('0x5e')]({'where':{'id':_0x2f2056[_0x75e6('0x49')]['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0xb6f4a7,null))[_0x75e6('0x13')](function(_0x523df2){if(_0x523df2){return _0x523df2[_0x75e6('0x74')]();}return null;})[_0x75e6('0x13')](respondWithResult(_0xb6f4a7,null))[_0x75e6('0x1b')](handleError(_0xb6f4a7,null));};exports['addImap']=function(_0x45414e,_0x5cb99f){if(_0x45414e[_0x75e6('0x50')]['id']){delete _0x45414e['body']['id'];}return db[_0x75e6('0x43')][_0x75e6('0x4f')]({'where':{'id':_0x45414e['params']['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0x5cb99f,null))[_0x75e6('0x13')](function(_0x2f7365){if(_0x2f7365){_0x45414e[_0x75e6('0x50')][_0x75e6('0x59')]=_0x2f7365['id'];return db[_0x75e6('0x2d')][_0x75e6('0x56')](_0x45414e[_0x75e6('0x50')]);}})[_0x75e6('0x13')](respondWithResult(_0x5cb99f,null))[_0x75e6('0x1b')](handleError(_0x5cb99f,null));};exports[_0x75e6('0x75')]=function(_0x42768f,_0x1ca1a7){return db[_0x75e6('0x43')][_0x75e6('0x5e')]({'where':{'id':_0x42768f['params']['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0x1ca1a7,null))['then'](function(_0x329240){if(_0x329240){return _0x329240[_0x75e6('0x76')](null);}return null;})[_0x75e6('0x13')](respondWithStatusCode(_0x1ca1a7,null))[_0x75e6('0x1b')](handleError(_0x1ca1a7,null));};exports[_0x75e6('0x77')]=function(_0x428b77,_0xc6628e){return db['MailAccount'][_0x75e6('0x5e')]({'where':{'id':_0x428b77[_0x75e6('0x49')]['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0xc6628e,null))[_0x75e6('0x13')](function(_0x150291){if(_0x150291){return _0x150291[_0x75e6('0x77')]();}return null;})['then'](respondWithResult(_0xc6628e,null))['catch'](handleError(_0xc6628e,null));};exports['addSmtp']=function(_0x19adf5,_0x5d3090){if(_0x19adf5['body']['id']){delete _0x19adf5[_0x75e6('0x50')]['id'];}return db[_0x75e6('0x43')]['find']({'where':{'id':_0x19adf5[_0x75e6('0x49')]['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0x5d3090,null))[_0x75e6('0x13')](function(_0x18f723){if(_0x18f723){_0x19adf5[_0x75e6('0x50')][_0x75e6('0x59')]=_0x18f723['id'];return db[_0x75e6('0x2e')][_0x75e6('0x56')](_0x19adf5['body']);}})['then'](respondWithResult(_0x5d3090,null))[_0x75e6('0x1b')](handleError(_0x5d3090,null));};exports['removeSmtp']=function(_0x59c1ed,_0x52a244){return db['MailAccount'][_0x75e6('0x5e')]({'where':{'id':_0x59c1ed[_0x75e6('0x49')]['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0x52a244,null))[_0x75e6('0x13')](function(_0x10c992){if(_0x10c992){return _0x10c992['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x52a244,null))[_0x75e6('0x1b')](handleError(_0x52a244,null));};exports[_0x75e6('0x78')]=function(_0x31bf22,_0x5d6a4d){return db[_0x75e6('0x79')][_0x75e6('0x4f')]({'where':{'id':_0x31bf22[_0x75e6('0x49')]['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0x5d6a4d,null))[_0x75e6('0x13')](function(_0x88ec0a){if(_0x88ec0a){return _0x88ec0a['addInteraction'](_0x31bf22[_0x75e6('0x50')][_0x75e6('0x5b')],_['omit'](_0x31bf22[_0x75e6('0x50')],['ids','id'])||{});}})[_0x75e6('0x13')](respondWithResult(_0x5d6a4d,null))[_0x75e6('0x1b')](handleError(_0x5d6a4d,null));};exports[_0x75e6('0x7a')]=function(_0x2f810d,_0x12a073){var _0x44cd0f={'raw':![],'where':{}};var _0x2106de={};var _0x3bf6c2={'count':0x0,'rows':[]};return db[_0x75e6('0x43')][_0x75e6('0x5e')]({'where':{'id':_0x2f810d[_0x75e6('0x49')]['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0x12a073,null))['then'](function(_0x372559){if(_0x372559){_0x2106de[_0x75e6('0x34')]=_[_0x75e6('0x36')](db[_0x75e6('0x79')][_0x75e6('0x4c')]);_0x2106de[_0x75e6('0x35')]=_[_0x75e6('0x36')](_0x2f810d[_0x75e6('0x35')]);_0x2106de[_0x75e6('0x37')]=_[_0x75e6('0x39')](_0x2106de[_0x75e6('0x34')],_0x2106de[_0x75e6('0x35')]);_0x44cd0f['attributes']=_[_0x75e6('0x39')](_0x2106de[_0x75e6('0x34')],qs[_0x75e6('0x4d')](_0x2f810d[_0x75e6('0x35')]['fields']));_0x44cd0f['attributes']=_0x44cd0f[_0x75e6('0x38')]['length']?_0x44cd0f['attributes']:_0x2106de['model'];if(!_0x2f810d['query'][_0x75e6('0x58')](_0x75e6('0x3a'))){_0x44cd0f[_0x75e6('0x21')]=qs[_0x75e6('0x21')](_0x2f810d[_0x75e6('0x35')][_0x75e6('0x21')]);_0x44cd0f[_0x75e6('0x22')]=qs[_0x75e6('0x22')](_0x2f810d['query']['offset']);}_0x44cd0f['order']=qs[_0x75e6('0x3c')](_0x2f810d[_0x75e6('0x35')][_0x75e6('0x3c')]);_0x44cd0f[_0x75e6('0x3d')]=qs[_0x75e6('0x37')](_[_0x75e6('0x3e')](_0x2f810d[_0x75e6('0x35')],_0x2106de[_0x75e6('0x37')]));_0x44cd0f[_0x75e6('0x3d')][_0x75e6('0x59')]=_0x372559['id'];if(_0x2f810d[_0x75e6('0x35')]['filter']){_0x44cd0f['where']=_[_0x75e6('0x40')](_0x44cd0f[_0x75e6('0x3d')],{'$or':_[_0x75e6('0x31')](_0x44cd0f[_0x75e6('0x38')],function(_0x3626d5){var _0x1a8bac={};_0x1a8bac[_0x3626d5]={'$like':'%'+_0x2f810d['query'][_0x75e6('0x3f')]+'%'};return _0x1a8bac;})});}_0x44cd0f=_[_0x75e6('0x40')]({},_0x44cd0f,_0x2f810d[_0x75e6('0x42')]);return db['MailInteraction'][_0x75e6('0x23')]({'where':_0x44cd0f[_0x75e6('0x3d')]})[_0x75e6('0x13')](function(_0x5ab86c){_0x3bf6c2['count']=_0x5ab86c;if(_0x2f810d[_0x75e6('0x35')]['includeAll']){_0x44cd0f[_0x75e6('0x45')]=[{'model':db[_0x75e6('0x7b')],'as':_0x75e6('0x7c'),'required':![]},{'model':db[_0x75e6('0x7d')],'as':'Owner','attributes':['name',_0x75e6('0x7e'),'internal'],'required':![]},{'model':db[_0x75e6('0x7f')],'as':'Tags','attributes':['id','name',_0x75e6('0x80')],'where':_0x2f810d['query']['tag']?{'id':_0x2f810d['query'][_0x75e6('0x81')]}:undefined,'required':_0x2f810d[_0x75e6('0x35')][_0x75e6('0x81')]?!![]:![]}];}return db['MailInteraction'][_0x75e6('0x46')](_0x44cd0f);})[_0x75e6('0x13')](function(_0x527914){_0x3bf6c2[_0x75e6('0x47')]=_0x527914;return _0x3bf6c2;});}})[_0x75e6('0x13')](respondWithFilteredResult(_0x12a073,_0x44cd0f))[_0x75e6('0x1b')](handleError(_0x12a073,null));};exports[_0x75e6('0x82')]=function addApplications(_0x23b1ca,_0x4cfc0e){var _0x5b3e5e=_0x23b1ca['params']['id'];var _0xfd26e3=_0x23b1ca[_0x75e6('0x50')];var _0x109c8a=0xc8;var _0x537c88=null;return db[_0x75e6('0x83')]['transaction']({'isolationLevel':db[_0x75e6('0x83')]['Transaction'][_0x75e6('0x84')][_0x75e6('0x85')]},function(_0x1e4332){return db['MailAccount'][_0x75e6('0x5e')]({'where':{'id':_0x5b3e5e},'transaction':_0x1e4332})['then'](function(_0x1dd946){if(_0x1dd946){return db[_0x75e6('0x86')][_0x75e6('0x27')]({'where':{'MailAccountId':_0x5b3e5e},'transaction':_0x1e4332})[_0x75e6('0x13')](function(){var _0x39ce3f=_[_0x75e6('0x31')](_0xfd26e3,function(_0x118548){_0x118548['MailAccountId']=_0x5b3e5e;return _0x118548;});return db[_0x75e6('0x86')][_0x75e6('0x87')](_0x39ce3f,{'transaction':_0x1e4332});});}else{_0x109c8a=0x194;_0x537c88=[];}});})['then'](function(){if(_0x109c8a!==0x194){return db[_0x75e6('0x86')][_0x75e6('0x88')]({'where':{'MailAccountId':_0x5b3e5e},'order':_0x75e6('0x89')})['then'](function(_0x57339b){_0x537c88=_0x57339b;});}})['catch'](function(_0x3176d3){_0x109c8a=0x1f4;logger[_0x75e6('0x18')](_0x3176d3[_0x75e6('0x8a')]);if(_0x3176d3[_0x75e6('0x2a')]){delete _0x3176d3[_0x75e6('0x2a')];}_0x537c88=_0x3176d3;})['finally'](function(){if(_0x537c88===null){_0x4cfc0e['sendStatus'](_0x109c8a);}else{if(_0x109c8a===0x1f4){_0x4cfc0e[_0x75e6('0x1d')](_0x109c8a)['send'](_0x537c88);}else{_0x4cfc0e[_0x75e6('0x1d')](_0x109c8a)[_0x75e6('0x1f')](_0x537c88);}}});};exports['getApplications']=function(_0x1dc82c,_0x315467){var _0x58d87a={};var _0x417e1f={};var _0x28a53a;var _0x48d220;return db[_0x75e6('0x43')]['findOne']({'where':{'id':_0x1dc82c['params']['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0x315467,null))[_0x75e6('0x13')](function(_0x39f0c5){if(_0x39f0c5){_0x28a53a=_0x39f0c5;_0x417e1f['model']=_['keys'](db[_0x75e6('0x86')][_0x75e6('0x4c')]);_0x417e1f[_0x75e6('0x35')]=_[_0x75e6('0x36')](_0x1dc82c[_0x75e6('0x35')]);_0x417e1f[_0x75e6('0x37')]=_['intersection'](_0x417e1f[_0x75e6('0x34')],_0x417e1f['query']);_0x58d87a[_0x75e6('0x38')]=_[_0x75e6('0x39')](_0x417e1f[_0x75e6('0x34')],qs[_0x75e6('0x4d')](_0x1dc82c[_0x75e6('0x35')]['fields']));_0x58d87a[_0x75e6('0x38')]=_0x58d87a[_0x75e6('0x38')]['length']?_0x58d87a[_0x75e6('0x38')]:_0x417e1f['model'];_0x58d87a['order']=qs['sort'](_0x1dc82c[_0x75e6('0x35')][_0x75e6('0x3c')]);_0x58d87a[_0x75e6('0x3d')]=qs['filters'](_['pick'](_0x1dc82c[_0x75e6('0x35')],_0x417e1f['filters']));if(_0x1dc82c[_0x75e6('0x35')][_0x75e6('0x3f')]){_0x58d87a[_0x75e6('0x3d')]=_['merge'](_0x58d87a[_0x75e6('0x3d')],{'$or':_['map'](_0x58d87a['attributes'],function(_0x12eb47){var _0x3ee30e={};_0x3ee30e[_0x12eb47]={'$like':'%'+_0x1dc82c[_0x75e6('0x35')][_0x75e6('0x3f')]+'%'};return _0x3ee30e;})});}_0x58d87a=_[_0x75e6('0x40')]({},_0x58d87a,_0x1dc82c['options']);return _0x28a53a[_0x75e6('0x8b')](_0x58d87a);}})[_0x75e6('0x13')](function(_0x4e8240){if(_0x4e8240){_0x48d220=_0x4e8240['length'];if(!_0x1dc82c[_0x75e6('0x35')][_0x75e6('0x58')]('nolimit')){_0x58d87a[_0x75e6('0x21')]=qs['limit'](_0x1dc82c[_0x75e6('0x35')]['limit']);_0x58d87a[_0x75e6('0x22')]=qs[_0x75e6('0x22')](_0x1dc82c[_0x75e6('0x35')][_0x75e6('0x22')]);}return _0x28a53a[_0x75e6('0x8b')](_0x58d87a);}})['then'](function(_0x5adb51){if(_0x5adb51){return _0x5adb51?{'count':_0x48d220,'rows':_0x5adb51}:null;}})['then'](respondWithResult(_0x315467,null))[_0x75e6('0x1b')](handleError(_0x315467,null));};exports[_0x75e6('0x8c')]=function(_0x4e95aa,_0x5510e1){var _0x5c149e={'raw':!![],'where':{}};var _0x1f7463={};var _0x4d7c34={'count':0x0,'rows':[]};return db[_0x75e6('0x43')][_0x75e6('0x5e')]({'where':{'id':_0x4e95aa[_0x75e6('0x49')]['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0x5510e1,null))[_0x75e6('0x13')](function(_0x223f2d){if(_0x223f2d){_0x1f7463[_0x75e6('0x34')]=_[_0x75e6('0x36')](db[_0x75e6('0x8d')]['rawAttributes']);_0x1f7463[_0x75e6('0x35')]=_[_0x75e6('0x36')](_0x4e95aa['query']);_0x1f7463[_0x75e6('0x37')]=_[_0x75e6('0x39')](_0x1f7463[_0x75e6('0x34')],_0x1f7463[_0x75e6('0x35')]);_0x5c149e[_0x75e6('0x38')]=_[_0x75e6('0x39')](_0x1f7463['model'],qs[_0x75e6('0x4d')](_0x4e95aa[_0x75e6('0x35')][_0x75e6('0x4d')]));_0x5c149e['attributes']=_0x5c149e['attributes'][_0x75e6('0x4e')]?_0x5c149e['attributes']:_0x1f7463[_0x75e6('0x34')];if(!_0x4e95aa[_0x75e6('0x35')][_0x75e6('0x58')](_0x75e6('0x3a'))){_0x5c149e[_0x75e6('0x21')]=qs[_0x75e6('0x21')](_0x4e95aa[_0x75e6('0x35')][_0x75e6('0x21')]);_0x5c149e[_0x75e6('0x22')]=qs[_0x75e6('0x22')](_0x4e95aa['query'][_0x75e6('0x22')]);}_0x5c149e[_0x75e6('0x3b')]=qs[_0x75e6('0x3c')](_0x4e95aa[_0x75e6('0x35')]['sort']);_0x5c149e[_0x75e6('0x3d')]=qs[_0x75e6('0x37')](_[_0x75e6('0x3e')](_0x4e95aa['query'],_0x1f7463[_0x75e6('0x37')]));_0x5c149e[_0x75e6('0x3d')][_0x75e6('0x59')]=_0x223f2d['id'];if(_0x4e95aa[_0x75e6('0x35')][_0x75e6('0x3f')]){_0x5c149e[_0x75e6('0x3d')]=_['merge'](_0x5c149e[_0x75e6('0x3d')],{'$or':_[_0x75e6('0x31')](_0x5c149e['attributes'],function(_0x165e4b){var _0x4c79c2={};_0x4c79c2[_0x165e4b]={'$like':'%'+_0x4e95aa['query'][_0x75e6('0x3f')]+'%'};return _0x4c79c2;})});}if(_0x4e95aa[_0x75e6('0x35')][_0x75e6('0x8e')]){var _0x4a7e2f=_0x4e95aa[_0x75e6('0x35')][_0x75e6('0x8e')][_0x75e6('0x8f')](',');var _0xb30a22={};_0xb30a22[_0x4a7e2f[0x0]]={'$gte':moment(_0x4a7e2f[0x1])[_0x75e6('0x90')](_0x75e6('0x91'))};_0x5c149e[_0x75e6('0x3d')]=_[_0x75e6('0x40')](_0x5c149e[_0x75e6('0x3d')],_0xb30a22);}_0x5c149e=_['merge']({},_0x5c149e,_0x4e95aa[_0x75e6('0x42')]);return db[_0x75e6('0x8d')][_0x75e6('0x23')]({'where':_0x5c149e['where']})[_0x75e6('0x13')](function(_0x57f607){_0x4d7c34[_0x75e6('0x23')]=_0x57f607;if(_0x4e95aa['query'][_0x75e6('0x44')]){_0x5c149e[_0x75e6('0x45')]=[{'all':!![]}];}return db[_0x75e6('0x8d')][_0x75e6('0x46')](_0x5c149e);})[_0x75e6('0x13')](function(_0x205134){if(_0x4e95aa[_0x75e6('0x35')]['inlineCss']===_0x75e6('0x92')){for(var _0xddb735=0x0;_0xddb735<_0x205134[_0x75e6('0x4e')];_0xddb735++){_0x205134[_0xddb735]['body']=juice(_0x205134[_0xddb735][_0x75e6('0x50')]);}}_0x4d7c34[_0x75e6('0x47')]=_0x205134;return _0x4d7c34;});}})[_0x75e6('0x13')](respondWithFilteredResult(_0x5510e1,_0x5c149e))[_0x75e6('0x1b')](handleError(_0x5510e1,null));};exports[_0x75e6('0x2b')]=function(_0x59c6f5,_0x467b3e){var _0x407b49,_0x92491b={},_0xfdc03e;if(_0x59c6f5[_0x75e6('0x50')]['to']){_0xfdc03e=_0x59c6f5[_0x75e6('0x50')]['to'][_0x75e6('0x8f')](',')[0x0];}return db['MailAccount'][_0x75e6('0x4f')]({'where':{'id':_0x59c6f5[_0x75e6('0x49')]['id']},'include':[{'model':db[_0x75e6('0x93')],'as':_0x75e6('0x94'),'include':[{'model':db[_0x75e6('0x7b')],'as':_0x75e6('0x95'),'where':{'email':_0xfdc03e},'limit':0x1,'order':[['updatedAt',_0x75e6('0x96')]]}]},{'model':db[_0x75e6('0x2e')],'as':_0x75e6('0x2f'),'raw':!![]}]})['then'](handleEntityNotFound(_0x467b3e,null))[_0x75e6('0x13')](function(_0x426d23){if(_0x426d23){_0x407b49=_0x426d23;if(_0x426d23[_0x75e6('0x2f')]){if(_['isNil'](_0x59c6f5[_0x75e6('0x50')][_0x75e6('0x97')])){_0x59c6f5[_0x75e6('0x50')][_0x75e6('0x97')]=util[_0x75e6('0x90')](_0x75e6('0x98'),_0x426d23[_0x75e6('0x2a')],_0x426d23[_0x75e6('0x62')]||_0x426d23[_0x75e6('0x2f')][_0x75e6('0x66')]);}if(_0x59c6f5[_0x75e6('0x50')]['attachments']&&_0x59c6f5[_0x75e6('0x50')][_0x75e6('0x99')][_0x75e6('0x4e')]){for(var _0x131910=0x0;_0x131910<_0x59c6f5[_0x75e6('0x50')]['attachments'][_0x75e6('0x4e')];_0x131910+=0x1){_0x59c6f5[_0x75e6('0x50')][_0x75e6('0x99')][_0x131910]={'filename':_0x59c6f5['body'][_0x75e6('0x99')][_0x131910][_0x75e6('0x2a')],'path':path[_0x75e6('0x9a')](config[_0x75e6('0x9b')],'server/files/attachments',_0x59c6f5['body'][_0x75e6('0x99')][_0x131910][_0x75e6('0x9c')])};}}var _0x5de463={'tls':{'rejectUnauthorized':![]}};if(_[_0x75e6('0x64')](_0x426d23[_0x75e6('0x2f')][_0x75e6('0x6a')])){if(_0x426d23['Smtp'][_0x75e6('0x6d')]){_0x5de463[_0x75e6('0x9d')]={'user':_0x426d23[_0x75e6('0x2f')][_0x75e6('0x66')],'pass':_0x426d23[_0x75e6('0x2f')]['pass']};}_0x5de463['host']=_0x426d23['Smtp']['host'];_0x5de463[_0x75e6('0x6c')]=_0x426d23['Smtp']['port'];_0x5de463[_0x75e6('0x9e')]=_0x426d23[_0x75e6('0x2f')][_0x75e6('0x9e')];}else{_0x5de463[_0x75e6('0x6a')]=_0x426d23[_0x75e6('0x2f')][_0x75e6('0x6a')];_0x5de463['auth']={'user':_0x426d23[_0x75e6('0x2f')]['user'],'pass':_0x426d23[_0x75e6('0x2f')][_0x75e6('0x69')]};}return respondWithRpcPromise('SendMail',_0x75e6('0x9f'),{'account':_0x5de463,'message':_0x59c6f5['body']});}else{throw new Error(_0x75e6('0xa0'));}}})[_0x75e6('0x13')](function(_0x25921d){if(_0x25921d){_0x92491b=_0x25921d;if(_0x407b49[_0x75e6('0x94')]){if(_0x407b49[_0x75e6('0x94')]['Contacts'][_0x75e6('0x4e')]){return _0x407b49[_0x75e6('0x94')][_0x75e6('0x95')][0x0];}else{return db[_0x75e6('0x7b')][_0x75e6('0x56')](_[_0x75e6('0xa1')](_0x59c6f5['body'],{'firstName':_0x59c6f5[_0x75e6('0x50')]['to'],'email':_0x59c6f5[_0x75e6('0x50')]['to'],'phone':_0x59c6f5[_0x75e6('0x50')]['to'],'ListId':_0x407b49[_0x75e6('0x63')]}));}}else{throw new Error(_0x75e6('0xa0'));}}})[_0x75e6('0x13')](function(_0x3353d2){if(_0x3353d2){var _0x299649={'UserId':_0x59c6f5[_0x75e6('0x66')]['id'],'ContactId':_0x3353d2['id'],'MailAccountId':_0x407b49['id'],'inReplyTo':_0x92491b['messageId'],'to':_0x59c6f5['body'][_0x75e6('0x97')],'cc':_0x59c6f5[_0x75e6('0x50')]['cc'],'subject':_0x59c6f5['body'][_0x75e6('0xa2')],'attach':_0x59c6f5['body'][_0x75e6('0xa3')],'firstMsgDirection':_0x75e6('0xa4'),'lastMsgAt':moment()[_0x75e6('0x90')](_0x75e6('0x91')),'lastMsgDirection':_0x75e6('0xa4'),'Messages':[_['merge'](_0x59c6f5['body'],{'messageId':_0x92491b['messageId'],'sentAt':moment()[_0x75e6('0x90')](_0x75e6('0x91')),'read':!![],'MailAccountId':_0x407b49['id'],'UserId':_0x59c6f5[_0x75e6('0x66')]['id'],'ContactId':_0x3353d2['id']})]};if(_0x59c6f5['body'][_0x75e6('0xa5')]){_0x299649=_[_0x75e6('0x40')](_0x299649,_0x59c6f5['body']['Interaction']);}return db[_0x75e6('0x79')][_0x75e6('0x56')](_0x299649,{'include':[{'model':db[_0x75e6('0x8d')],'as':_0x75e6('0xa6')}]});}})[_0x75e6('0x13')](respondWithResult(_0x467b3e,null))['catch'](handleError(_0x467b3e,null));};exports['verifySmtp']=function(_0x1921fe,_0x441a00){return db[_0x75e6('0x43')][_0x75e6('0x4f')]({'where':{'id':_0x1921fe[_0x75e6('0x49')]['id']},'include':[{'model':db[_0x75e6('0x2e')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x75e6('0xa7')],'as':_0x75e6('0xa7'),'raw':!![]}]}]})[_0x75e6('0x13')](handleEntityNotFound(_0x441a00,null))[_0x75e6('0x13')](function(_0x478312){if(!_0x478312[_0x75e6('0x2f')])return;var _0x578189={'id':_0x478312['id'],'tls':{'rejectUnauthorized':![]}};if(_0x478312[_0x75e6('0x60')]!==_0x75e6('0x61')){_0x578189[_0x75e6('0x6a')]=_0x478312[_0x75e6('0x60')];}else{_0x578189[_0x75e6('0x6b')]=_0x478312['Smtp'][_0x75e6('0x6b')];_0x578189[_0x75e6('0x6c')]=_0x478312[_0x75e6('0x2f')]['port'];_0x578189['secure']=_0x478312[_0x75e6('0x2f')][_0x75e6('0x9e')];}if(_0x478312[_0x75e6('0x2f')]['authentication']){if(_0x478312[_0x75e6('0x2f')][_0x75e6('0x51')]){_0x578189['auth']={'type':'OAuth2','user':_0x478312[_0x75e6('0x2f')][_0x75e6('0x66')],'accessToken':_0x478312[_0x75e6('0x2f')][_0x75e6('0xa7')][_0x75e6('0xa8')]};}else{_0x578189['auth']={'user':_0x478312[_0x75e6('0x2f')]['user'],'pass':_0x478312['Smtp'][_0x75e6('0x69')]};}}return respondWithRpcPromise('VerifySmtp',_0x75e6('0xa9'),{'account':_0x578189});})[_0x75e6('0x13')](respondWithResult(_0x441a00,null))['catch'](handleError(_0x441a00,null));};exports[_0x75e6('0x27')]=function(_0x12752d,_0x5c8651){return db[_0x75e6('0x43')]['find']({'where':{'id':_0x12752d[_0x75e6('0x49')]['id']}})['then'](handleEntityNotFound(_0x5c8651,null))[_0x75e6('0x13')](function(_0x312dfa){if(_0x312dfa&&_0x312dfa[_0x75e6('0x6a')]){throw new db['Sequelize']['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x312dfa;})[_0x75e6('0x13')](removeEntity(_0x5c8651,null))[_0x75e6('0x1b')](handleError(_0x5c8651,null));};exports[_0x75e6('0xaa')]=function(_0xc387e1,_0x1f54a2){return db['MailAccount'][_0x75e6('0x4f')]({'where':{'id':_0xc387e1[_0x75e6('0x49')]['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0x1f54a2,null))[_0x75e6('0x13')](function(_0x9f419e){if(_0x9f419e){return _0x9f419e[_0x75e6('0xaa')](_0xc387e1[_0x75e6('0x50')]['ids'],_[_0x75e6('0xab')](_0xc387e1[_0x75e6('0x50')],[_0x75e6('0x5b'),'id'])||{})[_0x75e6('0xac')](function(_0x428d2d){for(var _0xa8236d=0x0;_0xa8236d<_0xc387e1['body']['ids']['length'];_0xa8236d+=0x1){socket['emit'](_0x75e6('0xad'),{'UserId':Number(_0xc387e1[_0x75e6('0x50')][_0x75e6('0x5b')][_0xa8236d]),'MailAccountId':Number(_0xc387e1[_0x75e6('0x49')]['id'])});}return _0x428d2d;});}})[_0x75e6('0x13')](respondWithResult(_0x1f54a2,null))['catch'](handleError(_0x1f54a2,null));};exports[_0x75e6('0xae')]=function(_0x3b0aa9,_0x428ffa){return db[_0x75e6('0x43')][_0x75e6('0x4f')]({'where':{'id':_0x3b0aa9[_0x75e6('0x49')]['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0x428ffa,null))[_0x75e6('0x13')](function(_0x5b0624){if(_0x5b0624){return _0x5b0624[_0x75e6('0xae')](_0x3b0aa9[_0x75e6('0x35')]['ids'])[_0x75e6('0x13')](function(){if(_[_0x75e6('0xaf')](_0x3b0aa9[_0x75e6('0x35')][_0x75e6('0x5b')])){for(var _0x4111cd=0x0;_0x4111cd<_0x3b0aa9['query'][_0x75e6('0x5b')][_0x75e6('0x4e')];_0x4111cd+=0x1){socket['emit'](_0x75e6('0xb0'),{'UserId':Number(_0x3b0aa9['query']['ids'][_0x4111cd]),'MailAccountId':Number(_0x3b0aa9[_0x75e6('0x49')]['id'])});}}else{socket['emit'](_0x75e6('0xb0'),{'UserId':Number(_0x3b0aa9[_0x75e6('0x35')][_0x75e6('0x5b')]),'MailAccountId':Number(_0x3b0aa9[_0x75e6('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x428ffa,null))[_0x75e6('0x1b')](handleError(_0x428ffa,null));};exports[_0x75e6('0xb1')]=function(_0x3ffd00,_0x2b13fa){var _0x5e659c={};var _0x22cd0a={};var _0x47dc9c;var _0x5d8e0b;return db[_0x75e6('0x43')][_0x75e6('0x5e')]({'where':{'id':_0x3ffd00[_0x75e6('0x49')]['id']}})[_0x75e6('0x13')](handleEntityNotFound(_0x2b13fa,null))[_0x75e6('0x13')](function(_0x1f8fea){if(_0x1f8fea){_0x47dc9c=_0x1f8fea;_0x22cd0a[_0x75e6('0x34')]=_[_0x75e6('0x36')](db[_0x75e6('0x7d')][_0x75e6('0x4c')]);_0x22cd0a['query']=_[_0x75e6('0x36')](_0x3ffd00['query']);_0x22cd0a['filters']=_[_0x75e6('0x39')](_0x22cd0a[_0x75e6('0x34')],_0x22cd0a[_0x75e6('0x35')]);_0x5e659c[_0x75e6('0x38')]=_[_0x75e6('0x39')](_0x22cd0a[_0x75e6('0x34')],qs[_0x75e6('0x4d')](_0x3ffd00[_0x75e6('0x35')]['fields']));_0x5e659c[_0x75e6('0x38')]=_0x5e659c['attributes']['length']?_0x5e659c['attributes']:_0x22cd0a[_0x75e6('0x34')];_0x5e659c[_0x75e6('0x3b')]=qs[_0x75e6('0x3c')](_0x3ffd00[_0x75e6('0x35')][_0x75e6('0x3c')]);_0x5e659c[_0x75e6('0x3d')]=qs['filters'](_[_0x75e6('0x3e')](_0x3ffd00['query'],_0x22cd0a[_0x75e6('0x37')]));if(_0x3ffd00['query'][_0x75e6('0x3f')]){_0x5e659c[_0x75e6('0x3d')]=_[_0x75e6('0x40')](_0x5e659c[_0x75e6('0x3d')],{'$or':_[_0x75e6('0x31')](_0x5e659c[_0x75e6('0x38')],function(_0x3099c3){var _0xb429f7={};_0xb429f7[_0x3099c3]={'$like':'%'+_0x3ffd00[_0x75e6('0x35')][_0x75e6('0x3f')]+'%'};return _0xb429f7;})});}_0x5e659c=_[_0x75e6('0x40')]({},_0x5e659c,_0x3ffd00[_0x75e6('0x42')]);return _0x47dc9c[_0x75e6('0xb1')](_0x5e659c);}})[_0x75e6('0x13')](function(_0x476efc){if(_0x476efc){_0x5d8e0b=_0x476efc[_0x75e6('0x4e')];if(!_0x3ffd00[_0x75e6('0x35')]['hasOwnProperty'](_0x75e6('0x3a'))){_0x5e659c[_0x75e6('0x21')]=qs[_0x75e6('0x21')](_0x3ffd00[_0x75e6('0x35')][_0x75e6('0x21')]);_0x5e659c['offset']=qs['offset'](_0x3ffd00[_0x75e6('0x35')][_0x75e6('0x22')]);}return _0x47dc9c[_0x75e6('0xb1')](_0x5e659c);}})[_0x75e6('0x13')](function(_0x2d606d){if(_0x2d606d){return _0x2d606d?{'count':_0x5d8e0b,'rows':_0x2d606d}:null;}})[_0x75e6('0x13')](respondWithResult(_0x2b13fa,null))[_0x75e6('0x1b')](handleError(_0x2b13fa,null));}; \ No newline at end of file +var _0xe10f=['VIRTUAL','options','count','includeAll','include','findAll','rows','show','MailServerOut','find','update','body','modernAuthentication','CloudProviderId','describe','addDisposition','params','MailAccountId','Disposition','create','findOne','length','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','nolimit','removeAnswers','email','ListId','isNil','active','description','provider','user','username','pass','password','service','host','port','authentication','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','fullname','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','attach','out','Interaction','Messages','verifySmtp','CloudProvider','custom','data5','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','bluebird','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','register','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','destroy','get','UserProfileResource','stack','name','send','index','MailServerIn','Imap','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','filter','merge'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0xe10f,0x78));var _0xfe10=function(_0x437ec1,_0x1c8777){_0x437ec1=_0x437ec1-0x0;var _0x14b24c=_0xe10f[_0x437ec1];return _0x14b24c;};'use strict';var moment=require('moment');var BPromise=require(_0xfe10('0x0'));var util=require('util');var path=require(_0xfe10('0x1'));var _=require(_0xfe10('0x2'));var juice=require('juice');var Redis=require(_0xfe10('0x3'));var qs=require(_0xfe10('0x4'));var logger=require(_0xfe10('0x5'))(_0xfe10('0x6'));var config=require(_0xfe10('0x7'));var db=require('../../mysqldb')['db'];config[_0xfe10('0x8')]=_[_0xfe10('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfe10('0xa'))(new Redis(config[_0xfe10('0x8')]));require('./mailAccount.socket')[_0xfe10('0xb')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfe10('0xc')]({'port':0x232b});function respondWithRpcPromise(_0x4edda0,_0x31a7fc,_0x1fd719,_0x5d3ecc){return new BPromise(function(_0x247a99,_0x42aea6){var _0xbf0289=_0x5d3ecc||client;return _0xbf0289[_0xfe10('0xd')](_0x4edda0,_0x1fd719)[_0xfe10('0xe')](function(_0x3af1f9){logger[_0xfe10('0xf')](_0xfe10('0x10'),_0x31a7fc,'request\x20sent');logger[_0xfe10('0x11')](_0xfe10('0x12'),_0x31a7fc,_0xfe10('0x13'),JSON[_0xfe10('0x14')](_0x3af1f9));if(_0x3af1f9[_0xfe10('0x15')]){if(_0x3af1f9[_0xfe10('0x15')][_0xfe10('0x16')]===0x1f4){logger[_0xfe10('0x15')](_0xfe10('0x10'),_0x31a7fc,_0x3af1f9[_0xfe10('0x15')][_0xfe10('0x17')]);return _0x42aea6(_0x3af1f9[_0xfe10('0x15')][_0xfe10('0x17')]);}logger[_0xfe10('0x15')]('MailAccount,\x20%s,\x20%s',_0x31a7fc,_0x3af1f9['error'][_0xfe10('0x17')]);return _0x247a99(_0x3af1f9['error']['message']);}else{logger[_0xfe10('0xf')](_0xfe10('0x10'),_0x31a7fc,'request\x20sent');_0x247a99(_0x3af1f9['result']['message']);}})[_0xfe10('0x18')](function(_0x19991e){logger[_0xfe10('0x15')](_0xfe10('0x10'),_0x31a7fc,_0x19991e);_0x42aea6(_0x19991e);});});}function respondWithStatusCode(_0x58c139,_0x4ebdbe){_0x4ebdbe=_0x4ebdbe||0xcc;return function(_0x3128fd){if(_0x3128fd){return _0x58c139[_0xfe10('0x19')](_0x4ebdbe);}return _0x58c139[_0xfe10('0x1a')](_0x4ebdbe)[_0xfe10('0x1b')]();};}function respondWithResult(_0x96835f,_0x50f394){_0x50f394=_0x50f394||0xc8;return function(_0x378681){if(_0x378681){return _0x96835f['status'](_0x50f394)[_0xfe10('0x1c')](_0x378681);}};}function respondWithFilteredResult(_0xcf502e,_0xfef8c3){return function(_0x20dbb3){if(_0x20dbb3){var _0x59ea26=typeof _0xfef8c3[_0xfe10('0x1d')]===_0xfe10('0x1e')&&typeof _0xfef8c3[_0xfe10('0x1f')]===_0xfe10('0x1e');var _0x55b6f7=_0x20dbb3['count'];var _0x442863=_0x59ea26?0x0:_0xfef8c3[_0xfe10('0x1d')];var _0x3473a5=_0x59ea26?_0x20dbb3['count']:_0xfef8c3[_0xfe10('0x1d')]+_0xfef8c3[_0xfe10('0x1f')];var _0x25b243;if(_0x3473a5>=_0x55b6f7){_0x3473a5=_0x55b6f7;_0x25b243=0xc8;}else{_0x25b243=0xce;}_0xcf502e['status'](_0x25b243);return _0xcf502e[_0xfe10('0x20')](_0xfe10('0x21'),_0x442863+'-'+_0x3473a5+'/'+_0x55b6f7)[_0xfe10('0x1c')](_0x20dbb3);}return null;};}function saveUpdates(_0xf8d75c){return function(_0x3796a3){if(_0x3796a3){return _0x3796a3['update'](_0xf8d75c)[_0xfe10('0xe')](function(_0x1bbd91){return _0x1bbd91;});}return null;};}function removeEntity(_0x46b324){return function(_0x170f11){if(_0x170f11){return _0x170f11[_0xfe10('0x22')]()[_0xfe10('0xe')](function(){var _0x2c29ee=_0x170f11[_0xfe10('0x23')]({'plain':!![]});var _0x3b0d9e='MailAccounts';return db[_0xfe10('0x24')]['destroy']({'where':{'type':_0x3b0d9e,'resourceId':_0x2c29ee['id']}})[_0xfe10('0xe')](function(){return _0x170f11;});})['then'](function(){_0x46b324[_0xfe10('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2da082){return function(_0x21e0b5){if(!_0x21e0b5){_0x2da082['sendStatus'](0x194);}return _0x21e0b5;};}function handleError(_0x349f7b,_0x2adf1d){_0x2adf1d=_0x2adf1d||0x1f4;return function(_0x19a936){logger[_0xfe10('0x15')](_0x19a936[_0xfe10('0x25')]);if(_0x19a936['name']){delete _0x19a936[_0xfe10('0x26')];}_0x349f7b[_0xfe10('0x1a')](_0x2adf1d)[_0xfe10('0x27')](_0x19a936);};}exports[_0xfe10('0x28')]=function(_0x43c1c7,_0x4e9172){var _0x39787d={'include':[{'model':db[_0xfe10('0x29')],'as':_0xfe10('0x2a')},{'model':db['MailServerOut'],'as':_0xfe10('0x2b')},{'model':db[_0xfe10('0x2c')],'as':_0xfe10('0x2d')}]},_0x3c8339={},_0x276026={'count':0x0,'rows':[]};var _0x151507=_[_0xfe10('0x2e')](db[_0xfe10('0x2f')][_0xfe10('0x30')],function(_0x26ed41){return{'name':_0x26ed41[_0xfe10('0x31')],'type':_0x26ed41['type'][_0xfe10('0x32')]};});_0x3c8339[_0xfe10('0x33')]=_[_0xfe10('0x2e')](_0x151507,_0xfe10('0x26'));_0x3c8339['query']=_[_0xfe10('0x34')](_0x43c1c7['query']);_0x3c8339[_0xfe10('0x35')]=_[_0xfe10('0x36')](_0x3c8339[_0xfe10('0x33')],_0x3c8339[_0xfe10('0x37')]);_0x39787d[_0xfe10('0x38')]=_[_0xfe10('0x36')](_0x3c8339[_0xfe10('0x33')],qs[_0xfe10('0x39')](_0x43c1c7['query'][_0xfe10('0x39')]));_0x39787d[_0xfe10('0x38')]=_0x39787d[_0xfe10('0x38')]['length']?_0x39787d[_0xfe10('0x38')]:_0x3c8339[_0xfe10('0x33')];if(!_0x43c1c7[_0xfe10('0x37')][_0xfe10('0x3a')]('nolimit')){_0x39787d[_0xfe10('0x1f')]=qs[_0xfe10('0x1f')](_0x43c1c7[_0xfe10('0x37')][_0xfe10('0x1f')]);_0x39787d[_0xfe10('0x1d')]=qs['offset'](_0x43c1c7[_0xfe10('0x37')][_0xfe10('0x1d')]);}_0x39787d[_0xfe10('0x3b')]=qs[_0xfe10('0x3c')](_0x43c1c7[_0xfe10('0x37')][_0xfe10('0x3c')]);_0x39787d[_0xfe10('0x3d')]=qs['filters'](_['pick'](_0x43c1c7[_0xfe10('0x37')],_0x3c8339[_0xfe10('0x35')]),_0x151507);if(_0x43c1c7[_0xfe10('0x37')][_0xfe10('0x3e')]){_0x39787d[_0xfe10('0x3d')]=_[_0xfe10('0x3f')](_0x39787d[_0xfe10('0x3d')],{'$or':_[_0xfe10('0x2e')](_0x151507,function(_0x42e961){if(_0x42e961['type']!==_0xfe10('0x40')){var _0x437caa={};_0x437caa[_0x42e961[_0xfe10('0x26')]]={'$like':'%'+_0x43c1c7[_0xfe10('0x37')]['filter']+'%'};return _0x437caa;}})});}_0x39787d=_[_0xfe10('0x3f')]({},_0x39787d,_0x43c1c7[_0xfe10('0x41')]);var _0x2f7bc5={'where':_0x39787d['where']};return db[_0xfe10('0x2f')][_0xfe10('0x42')](_0x2f7bc5)[_0xfe10('0xe')](function(_0x22791f){_0x276026['count']=_0x22791f;if(_0x43c1c7[_0xfe10('0x37')][_0xfe10('0x43')]){_0x39787d[_0xfe10('0x44')]=[{'all':!![]}];}return db[_0xfe10('0x2f')][_0xfe10('0x45')](_0x39787d);})['then'](function(_0x1428d4){_0x276026[_0xfe10('0x46')]=_0x1428d4;return _0x276026;})[_0xfe10('0xe')](respondWithFilteredResult(_0x4e9172,_0x39787d))[_0xfe10('0x18')](handleError(_0x4e9172,null));};exports[_0xfe10('0x47')]=function(_0x7eb6b8,_0x3c162e){var _0x1f8cc0={'raw':![],'where':{'id':_0x7eb6b8['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xfe10('0x2a')},{'model':db[_0xfe10('0x48')],'as':_0xfe10('0x2b')},{'model':db[_0xfe10('0x2c')],'as':_0xfe10('0x2d')}]},_0x2374a9={};_0x2374a9[_0xfe10('0x33')]=_[_0xfe10('0x34')](db[_0xfe10('0x2f')]['rawAttributes']);_0x2374a9[_0xfe10('0x37')]=_[_0xfe10('0x34')](_0x7eb6b8[_0xfe10('0x37')]);_0x2374a9['filters']=_[_0xfe10('0x36')](_0x2374a9[_0xfe10('0x33')],_0x2374a9['query']);_0x1f8cc0[_0xfe10('0x38')]=_[_0xfe10('0x36')](_0x2374a9[_0xfe10('0x33')],qs['fields'](_0x7eb6b8[_0xfe10('0x37')][_0xfe10('0x39')]));_0x1f8cc0[_0xfe10('0x38')]=_0x1f8cc0[_0xfe10('0x38')]['length']?_0x1f8cc0[_0xfe10('0x38')]:_0x2374a9['model'];if(_0x7eb6b8[_0xfe10('0x37')][_0xfe10('0x43')]){_0x1f8cc0[_0xfe10('0x44')]=[{'all':!![]}];}_0x1f8cc0=_[_0xfe10('0x3f')]({},_0x1f8cc0,_0x7eb6b8[_0xfe10('0x41')]);return db['MailAccount'][_0xfe10('0x49')](_0x1f8cc0)[_0xfe10('0xe')](handleEntityNotFound(_0x3c162e,null))[_0xfe10('0xe')](respondWithResult(_0x3c162e,null))['catch'](handleError(_0x3c162e,null));};exports[_0xfe10('0x4a')]=function(_0x225513,_0x39eb1f){if(_0x225513[_0xfe10('0x4b')]['id']){delete _0x225513[_0xfe10('0x4b')]['id'];}if(_0x225513[_0xfe10('0x4b')]['Imap']){if(!_0x225513[_0xfe10('0x4b')][_0xfe10('0x2a')][_0xfe10('0x4c')]){_0x225513['body']['Imap'][_0xfe10('0x4d')]=null;}}if(_0x225513[_0xfe10('0x4b')]['Smtp']){if(!_0x225513['body'][_0xfe10('0x2b')][_0xfe10('0x4c')]){_0x225513['body'][_0xfe10('0x2b')]['CloudProviderId']=null;}}return db['MailAccount']['find']({'where':{'id':_0x225513['params']['id']},'include':[{'model':db[_0xfe10('0x29')],'as':_0xfe10('0x2a')},{'model':db[_0xfe10('0x48')],'as':'Smtp'},{'model':db[_0xfe10('0x2c')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x39eb1f,null))[_0xfe10('0xe')](saveUpdates(_0x225513[_0xfe10('0x4b')],null))[_0xfe10('0xe')](function(_0x12b0d6){if(_0x12b0d6&&_0x225513[_0xfe10('0x4b')][_0xfe10('0x2a')]){return db[_0xfe10('0x29')][_0xfe10('0x4a')](_0x225513['body'][_0xfe10('0x2a')],{'where':{'MailAccountId':_0x12b0d6['id']}})[_0xfe10('0xe')](function(){return _0x12b0d6;});}return _0x12b0d6;})[_0xfe10('0xe')](function(_0x2829b1){if(_0x2829b1&&_0x225513['body'][_0xfe10('0x2b')]){return db[_0xfe10('0x48')]['update'](_0x225513[_0xfe10('0x4b')][_0xfe10('0x2b')],{'where':{'MailAccountId':_0x2829b1['id']}})[_0xfe10('0xe')](function(){return _0x2829b1;});}return _0x2829b1;})['then'](respondWithResult(_0x39eb1f,null))[_0xfe10('0x18')](handleError(_0x39eb1f,null));};exports[_0xfe10('0x4e')]=function(_0x2b5481,_0x576e11){return db['MailAccount'][_0xfe10('0x4e')]()[_0xfe10('0xe')](respondWithResult(_0x576e11,null))[_0xfe10('0x18')](handleError(_0x576e11,null));};exports[_0xfe10('0x4f')]=function(_0x5c5242,_0x511fc1){if(_0x5c5242[_0xfe10('0x4b')]['id']){delete _0x5c5242[_0xfe10('0x4b')]['id'];}return db[_0xfe10('0x2f')][_0xfe10('0x49')]({'where':{'id':_0x5c5242[_0xfe10('0x50')]['id']}})['then'](handleEntityNotFound(_0x511fc1,null))[_0xfe10('0xe')](function(_0x561f93){if(_0x561f93){_0x5c5242[_0xfe10('0x4b')][_0xfe10('0x51')]=_0x561f93['id'];return db[_0xfe10('0x52')][_0xfe10('0x53')](_0x5c5242[_0xfe10('0x4b')]);}})[_0xfe10('0xe')](respondWithResult(_0x511fc1,null))[_0xfe10('0x18')](handleError(_0x511fc1,null));};exports['getDispositions']=function(_0x26a730,_0x5b7e9e){var _0x4be275={'raw':![],'where':{}};var _0x2afd6d={};var _0xd35bda={'count':0x0,'rows':[]};return db[_0xfe10('0x2f')][_0xfe10('0x54')]({'where':{'id':_0x26a730['params']['id']}})['then'](handleEntityNotFound(_0x5b7e9e,null))['then'](function(_0x1f846c){if(_0x1f846c){_0x2afd6d[_0xfe10('0x33')]=_[_0xfe10('0x34')](db['Disposition'][_0xfe10('0x30')]);_0x2afd6d[_0xfe10('0x37')]=_[_0xfe10('0x34')](_0x26a730[_0xfe10('0x37')]);_0x2afd6d['filters']=_[_0xfe10('0x36')](_0x2afd6d[_0xfe10('0x33')],_0x2afd6d[_0xfe10('0x37')]);_0x4be275[_0xfe10('0x38')]=_[_0xfe10('0x36')](_0x2afd6d[_0xfe10('0x33')],qs[_0xfe10('0x39')](_0x26a730[_0xfe10('0x37')][_0xfe10('0x39')]));_0x4be275[_0xfe10('0x38')]=_0x4be275['attributes'][_0xfe10('0x55')]?_0x4be275[_0xfe10('0x38')]:_0x2afd6d['model'];if(!_0x26a730['query'][_0xfe10('0x3a')]('nolimit')){_0x4be275[_0xfe10('0x1f')]=qs[_0xfe10('0x1f')](_0x26a730[_0xfe10('0x37')]['limit']);_0x4be275[_0xfe10('0x1d')]=qs[_0xfe10('0x1d')](_0x26a730[_0xfe10('0x37')][_0xfe10('0x1d')]);}_0x4be275['order']=qs[_0xfe10('0x3c')](_0x26a730['query'][_0xfe10('0x3c')]);_0x4be275[_0xfe10('0x3d')]=qs[_0xfe10('0x35')](_[_0xfe10('0x56')](_0x26a730[_0xfe10('0x37')],_0x2afd6d[_0xfe10('0x35')]));_0x4be275['where'][_0xfe10('0x51')]=_0x1f846c['id'];if(_0x26a730[_0xfe10('0x37')]['filter']){_0x4be275[_0xfe10('0x3d')]=_['merge'](_0x4be275['where'],{'$or':_[_0xfe10('0x2e')](_0x4be275['attributes'],function(_0x2306c4){var _0x44d8e8={};_0x44d8e8[_0x2306c4]={'$like':'%'+_0x26a730[_0xfe10('0x37')][_0xfe10('0x3e')]+'%'};return _0x44d8e8;})});}_0x4be275=_[_0xfe10('0x3f')]({},_0x4be275,_0x26a730[_0xfe10('0x41')]);return db[_0xfe10('0x52')][_0xfe10('0x42')]({'where':_0x4be275[_0xfe10('0x3d')]})[_0xfe10('0xe')](function(_0x409c8a){_0xd35bda['count']=_0x409c8a;if(_0x26a730['query']['includeAll']){_0x4be275[_0xfe10('0x44')]=[{'all':!![]}];}return db[_0xfe10('0x52')]['findAll'](_0x4be275);})[_0xfe10('0xe')](function(_0x4a7b7a){_0xd35bda[_0xfe10('0x46')]=_0x4a7b7a;return _0xd35bda;});}})[_0xfe10('0xe')](respondWithFilteredResult(_0x5b7e9e,_0x4be275))['catch'](handleError(_0x5b7e9e,null));};exports[_0xfe10('0x57')]=function(_0x2df14f,_0x62504){return db[_0xfe10('0x2f')]['find']({'where':{'id':_0x2df14f[_0xfe10('0x50')]['id']}})['then'](handleEntityNotFound(_0x62504,null))[_0xfe10('0xe')](function(_0x2d35c3){if(_0x2d35c3){return _0x2d35c3[_0xfe10('0x57')](_0x2df14f['query'][_0xfe10('0x58')]);}})['then'](respondWithStatusCode(_0x62504,null))['catch'](handleError(_0x62504,null));};exports[_0xfe10('0x59')]=function(_0xc6fb0,_0x353b76){if(_0xc6fb0[_0xfe10('0x4b')]['id']){delete _0xc6fb0[_0xfe10('0x4b')]['id'];}return db[_0xfe10('0x2f')][_0xfe10('0x49')]({'where':{'id':_0xc6fb0[_0xfe10('0x50')]['id']}})['then'](handleEntityNotFound(_0x353b76,null))[_0xfe10('0xe')](function(_0x3976eb){if(_0x3976eb){_0xc6fb0[_0xfe10('0x4b')]['MailAccountId']=_0x3976eb['id'];return db['CannedAnswer']['create'](_0xc6fb0[_0xfe10('0x4b')]);}})[_0xfe10('0xe')](respondWithResult(_0x353b76,null))[_0xfe10('0x18')](handleError(_0x353b76,null));};exports[_0xfe10('0x5a')]=function(_0x48c064,_0x1e3bf0){var _0x40710f={'raw':![],'where':{}};var _0x50e2fc={};var _0x1e4dea={'count':0x0,'rows':[]};return db[_0xfe10('0x2f')][_0xfe10('0x54')]({'where':{'id':_0x48c064[_0xfe10('0x50')]['id']}})[_0xfe10('0xe')](handleEntityNotFound(_0x1e3bf0,null))[_0xfe10('0xe')](function(_0x3eb219){if(_0x3eb219){_0x50e2fc[_0xfe10('0x33')]=_['keys'](db[_0xfe10('0x5b')][_0xfe10('0x30')]);_0x50e2fc[_0xfe10('0x37')]=_[_0xfe10('0x34')](_0x48c064[_0xfe10('0x37')]);_0x50e2fc[_0xfe10('0x35')]=_[_0xfe10('0x36')](_0x50e2fc['model'],_0x50e2fc[_0xfe10('0x37')]);_0x40710f[_0xfe10('0x38')]=_[_0xfe10('0x36')](_0x50e2fc[_0xfe10('0x33')],qs[_0xfe10('0x39')](_0x48c064[_0xfe10('0x37')][_0xfe10('0x39')]));_0x40710f['attributes']=_0x40710f[_0xfe10('0x38')][_0xfe10('0x55')]?_0x40710f[_0xfe10('0x38')]:_0x50e2fc[_0xfe10('0x33')];if(!_0x48c064[_0xfe10('0x37')]['hasOwnProperty'](_0xfe10('0x5c'))){_0x40710f['limit']=qs[_0xfe10('0x1f')](_0x48c064['query'][_0xfe10('0x1f')]);_0x40710f[_0xfe10('0x1d')]=qs[_0xfe10('0x1d')](_0x48c064[_0xfe10('0x37')][_0xfe10('0x1d')]);}_0x40710f[_0xfe10('0x3b')]=qs[_0xfe10('0x3c')](_0x48c064['query'][_0xfe10('0x3c')]);_0x40710f[_0xfe10('0x3d')]=qs[_0xfe10('0x35')](_['pick'](_0x48c064[_0xfe10('0x37')],_0x50e2fc[_0xfe10('0x35')]));_0x40710f['where'][_0xfe10('0x51')]=_0x3eb219['id'];if(_0x48c064['query']['filter']){_0x40710f['where']=_[_0xfe10('0x3f')](_0x40710f[_0xfe10('0x3d')],{'$or':_[_0xfe10('0x2e')](_0x40710f[_0xfe10('0x38')],function(_0x34d549){var _0x4981df={};_0x4981df[_0x34d549]={'$like':'%'+_0x48c064['query'][_0xfe10('0x3e')]+'%'};return _0x4981df;})});}_0x40710f=_[_0xfe10('0x3f')]({},_0x40710f,_0x48c064[_0xfe10('0x41')]);return db[_0xfe10('0x5b')][_0xfe10('0x42')]({'where':_0x40710f[_0xfe10('0x3d')]})[_0xfe10('0xe')](function(_0xb5214d){_0x1e4dea[_0xfe10('0x42')]=_0xb5214d;if(_0x48c064['query'][_0xfe10('0x43')]){_0x40710f['include']=[{'all':!![]}];}return db[_0xfe10('0x5b')]['findAll'](_0x40710f);})[_0xfe10('0xe')](function(_0x56497d){_0x1e4dea[_0xfe10('0x46')]=_0x56497d;return _0x1e4dea;});}})[_0xfe10('0xe')](respondWithFilteredResult(_0x1e3bf0,_0x40710f))[_0xfe10('0x18')](handleError(_0x1e3bf0,null));};exports[_0xfe10('0x5d')]=function(_0x55d5ff,_0x23d679){return db[_0xfe10('0x2f')][_0xfe10('0x49')]({'where':{'id':_0x55d5ff['params']['id']}})[_0xfe10('0xe')](handleEntityNotFound(_0x23d679,null))['then'](function(_0x153773){if(_0x153773){return _0x153773[_0xfe10('0x5d')](_0x55d5ff['query'][_0xfe10('0x58')]);}})[_0xfe10('0xe')](respondWithStatusCode(_0x23d679,null))[_0xfe10('0x18')](handleError(_0x23d679,null));};exports[_0xfe10('0x53')]=function(_0x1ae7a4,_0x5443aa){var _0x469f10={'name':_0x1ae7a4[_0xfe10('0x4b')][_0xfe10('0x26')],'key':_0x1ae7a4[_0xfe10('0x4b')]['key'],'provider':_0x1ae7a4[_0xfe10('0x4b')]['provider']==='custom'?null:_0x1ae7a4['body']['provider'],'email':_0x1ae7a4[_0xfe10('0x4b')][_0xfe10('0x5e')],'ListId':_0x1ae7a4[_0xfe10('0x4b')][_0xfe10('0x5f')],'active':!_[_0xfe10('0x60')](_0x1ae7a4[_0xfe10('0x4b')][_0xfe10('0x61')])?_0x1ae7a4[_0xfe10('0x4b')][_0xfe10('0x61')]:!![],'description':_0x1ae7a4[_0xfe10('0x4b')][_0xfe10('0x62')]||null,'Imap':{},'Smtp':{}};if(_0x469f10[_0xfe10('0x63')]){_0x469f10[_0xfe10('0x2a')][_0xfe10('0x64')]=_0x469f10[_0xfe10('0x2b')][_0xfe10('0x64')]=_0x1ae7a4[_0xfe10('0x4b')][_0xfe10('0x65')];_0x469f10[_0xfe10('0x2a')]['password']=_0x469f10[_0xfe10('0x2b')][_0xfe10('0x66')]=_0x1ae7a4[_0xfe10('0x4b')][_0xfe10('0x67')];if(_0x1ae7a4[_0xfe10('0x4b')][_0xfe10('0x4c')]){_0x469f10[_0xfe10('0x2a')]['modernAuthentication']=_0x469f10[_0xfe10('0x2b')][_0xfe10('0x4c')]=!![];_0x469f10[_0xfe10('0x2a')][_0xfe10('0x4d')]=_0x469f10[_0xfe10('0x2b')]['CloudProviderId']=_0x1ae7a4[_0xfe10('0x4b')][_0xfe10('0x4d')];_0x469f10[_0xfe10('0x2a')][_0xfe10('0x67')]=_0x469f10[_0xfe10('0x2b')][_0xfe10('0x66')]=null;}else{_0x469f10[_0xfe10('0x2a')][_0xfe10('0x4d')]=_0x469f10[_0xfe10('0x2b')][_0xfe10('0x4d')]=null;}_0x469f10[_0xfe10('0x2a')][_0xfe10('0x68')]=_0x469f10[_0xfe10('0x2b')]['service']=null;_0x469f10['Imap']['host']=_0x469f10['Smtp'][_0xfe10('0x69')]=null;_0x469f10['Imap'][_0xfe10('0x6a')]=_0x469f10['Smtp']['port']=null;}else{if(_0x1ae7a4[_0xfe10('0x4b')][_0xfe10('0x6b')]){_0x469f10[_0xfe10('0x2a')]['user']=_0x469f10['Smtp']['user']=_0x1ae7a4[_0xfe10('0x4b')][_0xfe10('0x65')];_0x469f10[_0xfe10('0x2a')][_0xfe10('0x67')]=_0x469f10[_0xfe10('0x2b')]['pass']=_0x1ae7a4[_0xfe10('0x4b')][_0xfe10('0x67')];}else{_0x469f10[_0xfe10('0x2a')]['authentication']=_0x469f10[_0xfe10('0x2b')]['authentication']=![];_0x469f10[_0xfe10('0x2a')]['user']=_0x469f10[_0xfe10('0x2b')][_0xfe10('0x64')]=null;_0x469f10['Imap'][_0xfe10('0x67')]=_0x469f10[_0xfe10('0x2b')]['pass']=null;}_0x469f10[_0xfe10('0x2a')][_0xfe10('0x69')]=_0x1ae7a4['body'][_0xfe10('0x2a')]['host'];_0x469f10[_0xfe10('0x2a')][_0xfe10('0x6a')]=_0x1ae7a4['body'][_0xfe10('0x2a')][_0xfe10('0x6a')];_0x469f10[_0xfe10('0x2b')][_0xfe10('0x69')]=_0x1ae7a4[_0xfe10('0x4b')][_0xfe10('0x2b')][_0xfe10('0x69')];_0x469f10[_0xfe10('0x2b')][_0xfe10('0x6a')]=_0x1ae7a4[_0xfe10('0x4b')]['Smtp'][_0xfe10('0x6a')];}return db[_0xfe10('0x2f')]['create'](_0x469f10,{'include':[{'model':db[_0xfe10('0x48')],'as':_0xfe10('0x2b')},{'model':db[_0xfe10('0x29')],'as':_0xfe10('0x2a')}]})['then'](function(_0x5bb047){var _0x7a8bee=_0x1ae7a4[_0xfe10('0x64')][_0xfe10('0x23')]({'plain':!![]});if(!_0x7a8bee)throw new Error(_0xfe10('0x6c'));if(_0x7a8bee[_0xfe10('0x6d')]===_0xfe10('0x64')){var _0x41d260=_0x5bb047[_0xfe10('0x23')]({'plain':!![]});return db[_0xfe10('0x6e')]['find']({'where':{'name':_0xfe10('0x6f'),'userProfileId':_0x7a8bee[_0xfe10('0x70')]},'raw':!![]})[_0xfe10('0xe')](function(_0x35607a){if(_0x35607a&&_0x35607a[_0xfe10('0x71')]===0x0){return db[_0xfe10('0x24')][_0xfe10('0x53')]({'name':_0x41d260[_0xfe10('0x26')],'resourceId':_0x41d260['id'],'type':_0x35607a[_0xfe10('0x26')],'sectionId':_0x35607a['id']},{})[_0xfe10('0xe')](function(){return _0x5bb047;});}else{return _0x5bb047;}})['catch'](function(_0x299ab4){logger[_0xfe10('0x15')](_0xfe10('0x72'),_0x299ab4);throw _0x299ab4;});}return _0x5bb047;})['then'](respondWithResult(_0x5443aa,0xc9))[_0xfe10('0x18')](handleError(_0x5443aa,null));};exports[_0xfe10('0x73')]=function(_0x50ce10,_0x177f0f){return db['MailAccount'][_0xfe10('0x54')]({'where':{'id':_0x50ce10[_0xfe10('0x50')]['id']}})['then'](handleEntityNotFound(_0x177f0f,null))[_0xfe10('0xe')](function(_0x644a80){if(_0x644a80){return _0x644a80['getImap']();}return null;})[_0xfe10('0xe')](respondWithResult(_0x177f0f,null))[_0xfe10('0x18')](handleError(_0x177f0f,null));};exports[_0xfe10('0x74')]=function(_0x1fdce4,_0x455760){if(_0x1fdce4[_0xfe10('0x4b')]['id']){delete _0x1fdce4[_0xfe10('0x4b')]['id'];}return db[_0xfe10('0x2f')][_0xfe10('0x49')]({'where':{'id':_0x1fdce4[_0xfe10('0x50')]['id']}})[_0xfe10('0xe')](handleEntityNotFound(_0x455760,null))['then'](function(_0x3b82c8){if(_0x3b82c8){_0x1fdce4[_0xfe10('0x4b')][_0xfe10('0x51')]=_0x3b82c8['id'];return db['MailServerIn'][_0xfe10('0x53')](_0x1fdce4['body']);}})[_0xfe10('0xe')](respondWithResult(_0x455760,null))[_0xfe10('0x18')](handleError(_0x455760,null));};exports[_0xfe10('0x75')]=function(_0x188096,_0x2ddfbb){return db[_0xfe10('0x2f')][_0xfe10('0x54')]({'where':{'id':_0x188096[_0xfe10('0x50')]['id']}})[_0xfe10('0xe')](handleEntityNotFound(_0x2ddfbb,null))['then'](function(_0x23fa94){if(_0x23fa94){return _0x23fa94[_0xfe10('0x76')](null);}return null;})[_0xfe10('0xe')](respondWithStatusCode(_0x2ddfbb,null))[_0xfe10('0x18')](handleError(_0x2ddfbb,null));};exports[_0xfe10('0x77')]=function(_0x24ce8e,_0x215dad){return db[_0xfe10('0x2f')][_0xfe10('0x54')]({'where':{'id':_0x24ce8e[_0xfe10('0x50')]['id']}})[_0xfe10('0xe')](handleEntityNotFound(_0x215dad,null))[_0xfe10('0xe')](function(_0x551151){if(_0x551151){return _0x551151[_0xfe10('0x77')]();}return null;})[_0xfe10('0xe')](respondWithResult(_0x215dad,null))[_0xfe10('0x18')](handleError(_0x215dad,null));};exports[_0xfe10('0x78')]=function(_0xf7d315,_0x251570){if(_0xf7d315[_0xfe10('0x4b')]['id']){delete _0xf7d315[_0xfe10('0x4b')]['id'];}return db[_0xfe10('0x2f')]['find']({'where':{'id':_0xf7d315[_0xfe10('0x50')]['id']}})['then'](handleEntityNotFound(_0x251570,null))['then'](function(_0x204e6e){if(_0x204e6e){_0xf7d315[_0xfe10('0x4b')]['MailAccountId']=_0x204e6e['id'];return db[_0xfe10('0x48')][_0xfe10('0x53')](_0xf7d315[_0xfe10('0x4b')]);}})['then'](respondWithResult(_0x251570,null))[_0xfe10('0x18')](handleError(_0x251570,null));};exports[_0xfe10('0x79')]=function(_0x2aac5e,_0x2ab99d){return db[_0xfe10('0x2f')][_0xfe10('0x54')]({'where':{'id':_0x2aac5e['params']['id']}})[_0xfe10('0xe')](handleEntityNotFound(_0x2ab99d,null))[_0xfe10('0xe')](function(_0x27f2ea){if(_0x27f2ea){return _0x27f2ea[_0xfe10('0x7a')](null);}return null;})[_0xfe10('0xe')](respondWithStatusCode(_0x2ab99d,null))[_0xfe10('0x18')](handleError(_0x2ab99d,null));};exports['addInteraction']=function(_0x124a50,_0x57be84){return db[_0xfe10('0x7b')][_0xfe10('0x49')]({'where':{'id':_0x124a50[_0xfe10('0x50')]['id']}})[_0xfe10('0xe')](handleEntityNotFound(_0x57be84,null))['then'](function(_0x2bf203){if(_0x2bf203){return _0x2bf203[_0xfe10('0x7c')](_0x124a50[_0xfe10('0x4b')][_0xfe10('0x58')],_[_0xfe10('0x7d')](_0x124a50[_0xfe10('0x4b')],[_0xfe10('0x58'),'id'])||{});}})[_0xfe10('0xe')](respondWithResult(_0x57be84,null))[_0xfe10('0x18')](handleError(_0x57be84,null));};exports[_0xfe10('0x7e')]=function(_0x491486,_0x4a9cae){var _0x49a719={'raw':![],'where':{}};var _0x3a3d7a={};var _0x159988={'count':0x0,'rows':[]};return db['MailAccount'][_0xfe10('0x54')]({'where':{'id':_0x491486[_0xfe10('0x50')]['id']}})[_0xfe10('0xe')](handleEntityNotFound(_0x4a9cae,null))[_0xfe10('0xe')](function(_0x31f9ea){if(_0x31f9ea){_0x3a3d7a[_0xfe10('0x33')]=_[_0xfe10('0x34')](db[_0xfe10('0x7b')][_0xfe10('0x30')]);_0x3a3d7a[_0xfe10('0x37')]=_[_0xfe10('0x34')](_0x491486[_0xfe10('0x37')]);_0x3a3d7a[_0xfe10('0x35')]=_['intersection'](_0x3a3d7a['model'],_0x3a3d7a[_0xfe10('0x37')]);_0x49a719['attributes']=_[_0xfe10('0x36')](_0x3a3d7a[_0xfe10('0x33')],qs[_0xfe10('0x39')](_0x491486['query'][_0xfe10('0x39')]));_0x49a719[_0xfe10('0x38')]=_0x49a719['attributes'][_0xfe10('0x55')]?_0x49a719['attributes']:_0x3a3d7a[_0xfe10('0x33')];if(!_0x491486[_0xfe10('0x37')][_0xfe10('0x3a')](_0xfe10('0x5c'))){_0x49a719[_0xfe10('0x1f')]=qs['limit'](_0x491486[_0xfe10('0x37')][_0xfe10('0x1f')]);_0x49a719[_0xfe10('0x1d')]=qs['offset'](_0x491486[_0xfe10('0x37')][_0xfe10('0x1d')]);}_0x49a719[_0xfe10('0x3b')]=qs[_0xfe10('0x3c')](_0x491486[_0xfe10('0x37')][_0xfe10('0x3c')]);_0x49a719[_0xfe10('0x3d')]=qs['filters'](_[_0xfe10('0x56')](_0x491486[_0xfe10('0x37')],_0x3a3d7a['filters']));_0x49a719[_0xfe10('0x3d')][_0xfe10('0x51')]=_0x31f9ea['id'];if(_0x491486[_0xfe10('0x37')][_0xfe10('0x3e')]){_0x49a719[_0xfe10('0x3d')]=_[_0xfe10('0x3f')](_0x49a719['where'],{'$or':_[_0xfe10('0x2e')](_0x49a719[_0xfe10('0x38')],function(_0x4e94ed){var _0x4ed362={};_0x4ed362[_0x4e94ed]={'$like':'%'+_0x491486[_0xfe10('0x37')][_0xfe10('0x3e')]+'%'};return _0x4ed362;})});}_0x49a719=_[_0xfe10('0x3f')]({},_0x49a719,_0x491486[_0xfe10('0x41')]);return db['MailInteraction'][_0xfe10('0x42')]({'where':_0x49a719[_0xfe10('0x3d')]})[_0xfe10('0xe')](function(_0x3f6800){_0x159988[_0xfe10('0x42')]=_0x3f6800;if(_0x491486[_0xfe10('0x37')][_0xfe10('0x43')]){_0x49a719[_0xfe10('0x44')]=[{'model':db[_0xfe10('0x7f')],'as':_0xfe10('0x80'),'required':![]},{'model':db[_0xfe10('0x81')],'as':'Owner','attributes':[_0xfe10('0x26'),_0xfe10('0x82'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xfe10('0x83'),'attributes':['id','name','color'],'where':_0x491486[_0xfe10('0x37')]['tag']?{'id':_0x491486[_0xfe10('0x37')][_0xfe10('0x84')]}:undefined,'required':_0x491486[_0xfe10('0x37')][_0xfe10('0x84')]?!![]:![]}];}return db[_0xfe10('0x7b')][_0xfe10('0x45')](_0x49a719);})[_0xfe10('0xe')](function(_0x46be5b){_0x159988[_0xfe10('0x46')]=_0x46be5b;return _0x159988;});}})[_0xfe10('0xe')](respondWithFilteredResult(_0x4a9cae,_0x49a719))[_0xfe10('0x18')](handleError(_0x4a9cae,null));};exports[_0xfe10('0x85')]=function addApplications(_0x108ad4,_0xbfc717){var _0x33bae3=_0x108ad4['params']['id'];var _0x3ec094=_0x108ad4['body'];var _0x13b62d=0xc8;var _0x49539d=null;return db[_0xfe10('0x86')][_0xfe10('0x87')]({'isolationLevel':db[_0xfe10('0x86')][_0xfe10('0x88')][_0xfe10('0x89')][_0xfe10('0x8a')]},function(_0x5a470b){return db[_0xfe10('0x2f')]['findOne']({'where':{'id':_0x33bae3},'transaction':_0x5a470b})[_0xfe10('0xe')](function(_0x4c15b5){if(_0x4c15b5){return db[_0xfe10('0x8b')][_0xfe10('0x22')]({'where':{'MailAccountId':_0x33bae3},'transaction':_0x5a470b})['then'](function(){var _0x1ee021=_[_0xfe10('0x2e')](_0x3ec094,function(_0x5c3edb){_0x5c3edb[_0xfe10('0x51')]=_0x33bae3;return _0x5c3edb;});return db[_0xfe10('0x8b')]['bulkCreate'](_0x1ee021,{'transaction':_0x5a470b});});}else{_0x13b62d=0x194;_0x49539d=[];}});})['then'](function(){if(_0x13b62d!==0x194){return db['MailApplication'][_0xfe10('0x8c')]({'where':{'MailAccountId':_0x33bae3},'order':_0xfe10('0x8d')})[_0xfe10('0xe')](function(_0x3a559c){_0x49539d=_0x3a559c;});}})['catch'](function(_0x521581){_0x13b62d=0x1f4;logger[_0xfe10('0x15')](_0x521581[_0xfe10('0x25')]);if(_0x521581['name']){delete _0x521581['name'];}_0x49539d=_0x521581;})[_0xfe10('0x8e')](function(){if(_0x49539d===null){_0xbfc717['sendStatus'](_0x13b62d);}else{if(_0x13b62d===0x1f4){_0xbfc717[_0xfe10('0x1a')](_0x13b62d)[_0xfe10('0x27')](_0x49539d);}else{_0xbfc717[_0xfe10('0x1a')](_0x13b62d)[_0xfe10('0x1c')](_0x49539d);}}});};exports[_0xfe10('0x8f')]=function(_0x367d13,_0x50fe2c){var _0x5ae89e={};var _0x42c435={};var _0x3e99ff;var _0x536a6f;return db[_0xfe10('0x2f')][_0xfe10('0x54')]({'where':{'id':_0x367d13[_0xfe10('0x50')]['id']}})[_0xfe10('0xe')](handleEntityNotFound(_0x50fe2c,null))[_0xfe10('0xe')](function(_0xef7491){if(_0xef7491){_0x3e99ff=_0xef7491;_0x42c435['model']=_[_0xfe10('0x34')](db[_0xfe10('0x8b')][_0xfe10('0x30')]);_0x42c435[_0xfe10('0x37')]=_[_0xfe10('0x34')](_0x367d13[_0xfe10('0x37')]);_0x42c435[_0xfe10('0x35')]=_[_0xfe10('0x36')](_0x42c435['model'],_0x42c435[_0xfe10('0x37')]);_0x5ae89e['attributes']=_[_0xfe10('0x36')](_0x42c435[_0xfe10('0x33')],qs[_0xfe10('0x39')](_0x367d13[_0xfe10('0x37')][_0xfe10('0x39')]));_0x5ae89e[_0xfe10('0x38')]=_0x5ae89e[_0xfe10('0x38')][_0xfe10('0x55')]?_0x5ae89e[_0xfe10('0x38')]:_0x42c435[_0xfe10('0x33')];_0x5ae89e['order']=qs[_0xfe10('0x3c')](_0x367d13[_0xfe10('0x37')]['sort']);_0x5ae89e[_0xfe10('0x3d')]=qs['filters'](_[_0xfe10('0x56')](_0x367d13[_0xfe10('0x37')],_0x42c435['filters']));if(_0x367d13[_0xfe10('0x37')][_0xfe10('0x3e')]){_0x5ae89e[_0xfe10('0x3d')]=_[_0xfe10('0x3f')](_0x5ae89e[_0xfe10('0x3d')],{'$or':_['map'](_0x5ae89e[_0xfe10('0x38')],function(_0x33d642){var _0x4fc79e={};_0x4fc79e[_0x33d642]={'$like':'%'+_0x367d13['query'][_0xfe10('0x3e')]+'%'};return _0x4fc79e;})});}_0x5ae89e=_[_0xfe10('0x3f')]({},_0x5ae89e,_0x367d13['options']);return _0x3e99ff[_0xfe10('0x8f')](_0x5ae89e);}})[_0xfe10('0xe')](function(_0x31693e){if(_0x31693e){_0x536a6f=_0x31693e[_0xfe10('0x55')];if(!_0x367d13[_0xfe10('0x37')][_0xfe10('0x3a')]('nolimit')){_0x5ae89e['limit']=qs['limit'](_0x367d13[_0xfe10('0x37')][_0xfe10('0x1f')]);_0x5ae89e[_0xfe10('0x1d')]=qs[_0xfe10('0x1d')](_0x367d13[_0xfe10('0x37')][_0xfe10('0x1d')]);}return _0x3e99ff[_0xfe10('0x8f')](_0x5ae89e);}})[_0xfe10('0xe')](function(_0x557e6a){if(_0x557e6a){return _0x557e6a?{'count':_0x536a6f,'rows':_0x557e6a}:null;}})[_0xfe10('0xe')](respondWithResult(_0x50fe2c,null))['catch'](handleError(_0x50fe2c,null));};exports[_0xfe10('0x90')]=function(_0x4809eb,_0x4ea3b6){var _0x4e749a={'raw':!![],'where':{}};var _0x5ab7ae={};var _0x55ad41={'count':0x0,'rows':[]};return db[_0xfe10('0x2f')][_0xfe10('0x54')]({'where':{'id':_0x4809eb[_0xfe10('0x50')]['id']}})[_0xfe10('0xe')](handleEntityNotFound(_0x4ea3b6,null))[_0xfe10('0xe')](function(_0x4e10d3){if(_0x4e10d3){_0x5ab7ae['model']=_[_0xfe10('0x34')](db[_0xfe10('0x91')][_0xfe10('0x30')]);_0x5ab7ae[_0xfe10('0x37')]=_[_0xfe10('0x34')](_0x4809eb[_0xfe10('0x37')]);_0x5ab7ae[_0xfe10('0x35')]=_[_0xfe10('0x36')](_0x5ab7ae[_0xfe10('0x33')],_0x5ab7ae[_0xfe10('0x37')]);_0x4e749a[_0xfe10('0x38')]=_[_0xfe10('0x36')](_0x5ab7ae[_0xfe10('0x33')],qs[_0xfe10('0x39')](_0x4809eb[_0xfe10('0x37')][_0xfe10('0x39')]));_0x4e749a[_0xfe10('0x38')]=_0x4e749a[_0xfe10('0x38')][_0xfe10('0x55')]?_0x4e749a['attributes']:_0x5ab7ae[_0xfe10('0x33')];if(!_0x4809eb[_0xfe10('0x37')][_0xfe10('0x3a')](_0xfe10('0x5c'))){_0x4e749a['limit']=qs['limit'](_0x4809eb[_0xfe10('0x37')][_0xfe10('0x1f')]);_0x4e749a[_0xfe10('0x1d')]=qs[_0xfe10('0x1d')](_0x4809eb[_0xfe10('0x37')]['offset']);}_0x4e749a[_0xfe10('0x3b')]=qs['sort'](_0x4809eb[_0xfe10('0x37')][_0xfe10('0x3c')]);_0x4e749a[_0xfe10('0x3d')]=qs[_0xfe10('0x35')](_[_0xfe10('0x56')](_0x4809eb[_0xfe10('0x37')],_0x5ab7ae[_0xfe10('0x35')]));_0x4e749a['where'][_0xfe10('0x51')]=_0x4e10d3['id'];if(_0x4809eb[_0xfe10('0x37')][_0xfe10('0x3e')]){_0x4e749a[_0xfe10('0x3d')]=_[_0xfe10('0x3f')](_0x4e749a[_0xfe10('0x3d')],{'$or':_[_0xfe10('0x2e')](_0x4e749a[_0xfe10('0x38')],function(_0xd72747){var _0x4936e0={};_0x4936e0[_0xd72747]={'$like':'%'+_0x4809eb[_0xfe10('0x37')][_0xfe10('0x3e')]+'%'};return _0x4936e0;})});}if(_0x4809eb[_0xfe10('0x37')]['$gte']){var _0x3c0343=_0x4809eb[_0xfe10('0x37')]['$gte'][_0xfe10('0x92')](',');var _0x12ac51={};_0x12ac51[_0x3c0343[0x0]]={'$gte':moment(_0x3c0343[0x1])[_0xfe10('0x93')](_0xfe10('0x94'))};_0x4e749a['where']=_['merge'](_0x4e749a[_0xfe10('0x3d')],_0x12ac51);}_0x4e749a=_[_0xfe10('0x3f')]({},_0x4e749a,_0x4809eb[_0xfe10('0x41')]);return db[_0xfe10('0x91')]['count']({'where':_0x4e749a[_0xfe10('0x3d')]})[_0xfe10('0xe')](function(_0x219e63){_0x55ad41[_0xfe10('0x42')]=_0x219e63;if(_0x4809eb[_0xfe10('0x37')][_0xfe10('0x43')]){_0x4e749a[_0xfe10('0x44')]=[{'all':!![]}];}return db['MailMessage'][_0xfe10('0x45')](_0x4e749a);})[_0xfe10('0xe')](function(_0x53bf0f){if(_0x4809eb[_0xfe10('0x37')]['inlineCss']===_0xfe10('0x95')){for(var _0x1b6c06=0x0;_0x1b6c06<_0x53bf0f[_0xfe10('0x55')];_0x1b6c06++){_0x53bf0f[_0x1b6c06]['body']=juice(_0x53bf0f[_0x1b6c06][_0xfe10('0x4b')]);}}_0x55ad41['rows']=_0x53bf0f;return _0x55ad41;});}})[_0xfe10('0xe')](respondWithFilteredResult(_0x4ea3b6,_0x4e749a))[_0xfe10('0x18')](handleError(_0x4ea3b6,null));};exports['send']=function(_0x27672f,_0x493e22){var _0x321c0c,_0x30d0aa={},_0x129c44;if(_0x27672f[_0xfe10('0x4b')]['to']){_0x129c44=_0x27672f[_0xfe10('0x4b')]['to'][_0xfe10('0x92')](',')[0x0];}return db[_0xfe10('0x2f')][_0xfe10('0x49')]({'where':{'id':_0x27672f[_0xfe10('0x50')]['id']},'include':[{'model':db[_0xfe10('0x96')],'as':_0xfe10('0x97'),'include':[{'model':db['CmContact'],'as':_0xfe10('0x98'),'where':{'email':_0x129c44},'limit':0x1,'order':[[_0xfe10('0x99'),_0xfe10('0x9a')]]}]},{'model':db[_0xfe10('0x48')],'as':_0xfe10('0x2b'),'raw':!![]}]})[_0xfe10('0xe')](handleEntityNotFound(_0x493e22,null))[_0xfe10('0xe')](function(_0x3ab898){if(_0x3ab898){_0x321c0c=_0x3ab898;if(_0x3ab898[_0xfe10('0x2b')]){if(_[_0xfe10('0x60')](_0x27672f['body'][_0xfe10('0x9b')])){_0x27672f['body']['from']=util['format'](_0xfe10('0x9c'),_0x3ab898[_0xfe10('0x26')],_0x3ab898['email']||_0x3ab898[_0xfe10('0x2b')][_0xfe10('0x64')]);}if(_0x27672f['body'][_0xfe10('0x9d')]&&_0x27672f[_0xfe10('0x4b')][_0xfe10('0x9d')][_0xfe10('0x55')]){for(var _0x6b6140=0x0;_0x6b6140<_0x27672f['body'][_0xfe10('0x9d')][_0xfe10('0x55')];_0x6b6140+=0x1){_0x27672f['body'][_0xfe10('0x9d')][_0x6b6140]={'filename':_0x27672f[_0xfe10('0x4b')][_0xfe10('0x9d')][_0x6b6140][_0xfe10('0x26')],'path':path['join'](config['root'],_0xfe10('0x9e'),_0x27672f[_0xfe10('0x4b')][_0xfe10('0x9d')][_0x6b6140][_0xfe10('0x9f')])};}}var _0x4838f3={'tls':{'rejectUnauthorized':![]}};if(_[_0xfe10('0x60')](_0x3ab898['Smtp'][_0xfe10('0x68')])){if(_0x3ab898[_0xfe10('0x2b')][_0xfe10('0x6b')]){_0x4838f3[_0xfe10('0xa0')]={'user':_0x3ab898[_0xfe10('0x2b')]['user'],'pass':_0x3ab898[_0xfe10('0x2b')][_0xfe10('0x66')]};}_0x4838f3[_0xfe10('0x69')]=_0x3ab898['Smtp']['host'];_0x4838f3['port']=_0x3ab898[_0xfe10('0x2b')]['port'];_0x4838f3[_0xfe10('0xa1')]=_0x3ab898['Smtp'][_0xfe10('0xa1')];}else{_0x4838f3[_0xfe10('0x68')]=_0x3ab898[_0xfe10('0x2b')]['service'];_0x4838f3['auth']={'user':_0x3ab898['Smtp'][_0xfe10('0x64')],'pass':_0x3ab898[_0xfe10('0x2b')][_0xfe10('0x66')]};}return respondWithRpcPromise(_0xfe10('0xa2'),'sendMail',{'account':_0x4838f3,'message':_0x27672f['body']});}else{throw new Error(_0xfe10('0xa3'));}}})[_0xfe10('0xe')](function(_0x3e77bc){if(_0x3e77bc){_0x30d0aa=_0x3e77bc;if(_0x321c0c[_0xfe10('0x97')]){if(_0x321c0c[_0xfe10('0x97')][_0xfe10('0x98')][_0xfe10('0x55')]){return _0x321c0c[_0xfe10('0x97')][_0xfe10('0x98')][0x0];}else{return db[_0xfe10('0x7f')][_0xfe10('0x53')](_[_0xfe10('0x9')](_0x27672f[_0xfe10('0x4b')],{'firstName':_0x27672f[_0xfe10('0x4b')]['to'],'email':_0x27672f[_0xfe10('0x4b')]['to'],'phone':_0x27672f[_0xfe10('0x4b')]['to'],'ListId':_0x321c0c[_0xfe10('0x5f')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0xfe10('0xe')](function(_0x594d11){if(_0x594d11){var _0x1aa4ef={'UserId':_0x27672f[_0xfe10('0x64')]['id'],'ContactId':_0x594d11['id'],'MailAccountId':_0x321c0c['id'],'inReplyTo':_0x30d0aa['messageId'],'to':_0x27672f['body']['from'],'cc':_0x27672f[_0xfe10('0x4b')]['cc'],'subject':_0x27672f[_0xfe10('0x4b')]['subject'],'attach':_0x27672f[_0xfe10('0x4b')][_0xfe10('0xa4')],'firstMsgDirection':_0xfe10('0xa5'),'lastMsgAt':moment()[_0xfe10('0x93')](_0xfe10('0x94')),'lastMsgDirection':'out','Messages':[_[_0xfe10('0x3f')](_0x27672f['body'],{'messageId':_0x30d0aa['messageId'],'sentAt':moment()[_0xfe10('0x93')](_0xfe10('0x94')),'read':!![],'MailAccountId':_0x321c0c['id'],'UserId':_0x27672f[_0xfe10('0x64')]['id'],'ContactId':_0x594d11['id']})]};if(_0x27672f[_0xfe10('0x4b')][_0xfe10('0xa6')]){_0x1aa4ef=_[_0xfe10('0x3f')](_0x1aa4ef,_0x27672f[_0xfe10('0x4b')][_0xfe10('0xa6')]);}return db[_0xfe10('0x7b')]['create'](_0x1aa4ef,{'include':[{'model':db[_0xfe10('0x91')],'as':_0xfe10('0xa7')}]});}})[_0xfe10('0xe')](respondWithResult(_0x493e22,null))['catch'](handleError(_0x493e22,null));};exports[_0xfe10('0xa8')]=function(_0x4c1808,_0x50c419){return db[_0xfe10('0x2f')][_0xfe10('0x49')]({'where':{'id':_0x4c1808['params']['id']},'include':[{'model':db[_0xfe10('0x48')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xfe10('0xa9')],'as':_0xfe10('0xa9'),'raw':!![]}]}]})[_0xfe10('0xe')](handleEntityNotFound(_0x50c419,null))[_0xfe10('0xe')](function(_0x512b79){if(!_0x512b79[_0xfe10('0x2b')])return;var _0xe4bfc2={'id':_0x512b79['id'],'tls':{'rejectUnauthorized':![]}};if(_0x512b79[_0xfe10('0x63')]!==_0xfe10('0xaa')){_0xe4bfc2[_0xfe10('0x68')]=_0x512b79[_0xfe10('0x63')];}else{_0xe4bfc2[_0xfe10('0x69')]=_0x512b79['Smtp']['host'];_0xe4bfc2[_0xfe10('0x6a')]=_0x512b79[_0xfe10('0x2b')][_0xfe10('0x6a')];_0xe4bfc2[_0xfe10('0xa1')]=_0x512b79['Smtp'][_0xfe10('0xa1')];}if(_0x512b79[_0xfe10('0x2b')]['authentication']){if(_0x512b79['Smtp'][_0xfe10('0x4c')]){_0xe4bfc2[_0xfe10('0xa0')]={'type':'OAuth2','user':_0x512b79[_0xfe10('0x2b')]['user'],'accessToken':_0x512b79[_0xfe10('0x2b')][_0xfe10('0xa9')][_0xfe10('0xab')]};}else{_0xe4bfc2[_0xfe10('0xa0')]={'user':_0x512b79[_0xfe10('0x2b')][_0xfe10('0x64')],'pass':_0x512b79[_0xfe10('0x2b')][_0xfe10('0x66')]};}}return respondWithRpcPromise(_0xfe10('0xac'),'verifySmtp',{'account':_0xe4bfc2});})['then'](respondWithResult(_0x50c419,null))[_0xfe10('0x18')](handleError(_0x50c419,null));};exports[_0xfe10('0x22')]=function(_0x2c38e8,_0x2c4a94){return db[_0xfe10('0x2f')][_0xfe10('0x49')]({'where':{'id':_0x2c38e8[_0xfe10('0x50')]['id']}})[_0xfe10('0xe')](handleEntityNotFound(_0x2c4a94,null))['then'](function(_0x15fb1e){if(_0x15fb1e&&_0x15fb1e[_0xfe10('0x68')]){throw new db[(_0xfe10('0xad'))][(_0xfe10('0xae'))](_0xfe10('0xaf'));}return _0x15fb1e;})[_0xfe10('0xe')](removeEntity(_0x2c4a94,null))[_0xfe10('0x18')](handleError(_0x2c4a94,null));};exports[_0xfe10('0xb0')]=function(_0x1290c1,_0xa2845a){return db['MailAccount'][_0xfe10('0x49')]({'where':{'id':_0x1290c1[_0xfe10('0x50')]['id']}})['then'](handleEntityNotFound(_0xa2845a,null))[_0xfe10('0xe')](function(_0x43712c){if(_0x43712c){return _0x43712c['addAgents'](_0x1290c1['body'][_0xfe10('0x58')],_[_0xfe10('0x7d')](_0x1290c1[_0xfe10('0x4b')],[_0xfe10('0x58'),'id'])||{})[_0xfe10('0xb1')](function(_0x43345c){for(var _0x250d80=0x0;_0x250d80<_0x1290c1[_0xfe10('0x4b')]['ids'][_0xfe10('0x55')];_0x250d80+=0x1){socket['emit'](_0xfe10('0xb2'),{'UserId':Number(_0x1290c1['body'][_0xfe10('0x58')][_0x250d80]),'MailAccountId':Number(_0x1290c1['params']['id'])});}return _0x43345c;});}})[_0xfe10('0xe')](respondWithResult(_0xa2845a,null))[_0xfe10('0x18')](handleError(_0xa2845a,null));};exports[_0xfe10('0xb3')]=function(_0x7987ff,_0x15f8fe){return db[_0xfe10('0x2f')]['find']({'where':{'id':_0x7987ff['params']['id']}})[_0xfe10('0xe')](handleEntityNotFound(_0x15f8fe,null))[_0xfe10('0xe')](function(_0x68ce29){if(_0x68ce29){return _0x68ce29[_0xfe10('0xb3')](_0x7987ff[_0xfe10('0x37')][_0xfe10('0x58')])[_0xfe10('0xe')](function(){if(_[_0xfe10('0xb4')](_0x7987ff[_0xfe10('0x37')][_0xfe10('0x58')])){for(var _0x372d09=0x0;_0x372d09<_0x7987ff['query']['ids'][_0xfe10('0x55')];_0x372d09+=0x1){socket[_0xfe10('0xb5')]('userMailAccount:remove',{'UserId':Number(_0x7987ff['query']['ids'][_0x372d09]),'MailAccountId':Number(_0x7987ff['params']['id'])});}}else{socket[_0xfe10('0xb5')](_0xfe10('0xb6'),{'UserId':Number(_0x7987ff[_0xfe10('0x37')][_0xfe10('0x58')]),'MailAccountId':Number(_0x7987ff[_0xfe10('0x50')]['id'])});}});}})[_0xfe10('0xe')](respondWithStatusCode(_0x15f8fe,null))[_0xfe10('0x18')](handleError(_0x15f8fe,null));};exports[_0xfe10('0xb7')]=function(_0x276130,_0x2187cd){var _0x39b264={};var _0x699888={};var _0x46e355;var _0x483c0b;return db[_0xfe10('0x2f')][_0xfe10('0x54')]({'where':{'id':_0x276130[_0xfe10('0x50')]['id']}})['then'](handleEntityNotFound(_0x2187cd,null))['then'](function(_0x29c2a8){if(_0x29c2a8){_0x46e355=_0x29c2a8;_0x699888[_0xfe10('0x33')]=_[_0xfe10('0x34')](db[_0xfe10('0x81')][_0xfe10('0x30')]);_0x699888[_0xfe10('0x37')]=_[_0xfe10('0x34')](_0x276130[_0xfe10('0x37')]);_0x699888['filters']=_['intersection'](_0x699888[_0xfe10('0x33')],_0x699888[_0xfe10('0x37')]);_0x39b264[_0xfe10('0x38')]=_[_0xfe10('0x36')](_0x699888['model'],qs[_0xfe10('0x39')](_0x276130['query']['fields']));_0x39b264['attributes']=_0x39b264[_0xfe10('0x38')]['length']?_0x39b264[_0xfe10('0x38')]:_0x699888[_0xfe10('0x33')];_0x39b264[_0xfe10('0x3b')]=qs[_0xfe10('0x3c')](_0x276130['query'][_0xfe10('0x3c')]);_0x39b264[_0xfe10('0x3d')]=qs[_0xfe10('0x35')](_[_0xfe10('0x56')](_0x276130[_0xfe10('0x37')],_0x699888[_0xfe10('0x35')]));if(_0x276130[_0xfe10('0x37')][_0xfe10('0x3e')]){_0x39b264[_0xfe10('0x3d')]=_[_0xfe10('0x3f')](_0x39b264['where'],{'$or':_[_0xfe10('0x2e')](_0x39b264['attributes'],function(_0x99d389){var _0xa3e02c={};_0xa3e02c[_0x99d389]={'$like':'%'+_0x276130[_0xfe10('0x37')][_0xfe10('0x3e')]+'%'};return _0xa3e02c;})});}_0x39b264=_[_0xfe10('0x3f')]({},_0x39b264,_0x276130['options']);return _0x46e355['getAgents'](_0x39b264);}})[_0xfe10('0xe')](function(_0x2a7122){if(_0x2a7122){_0x483c0b=_0x2a7122[_0xfe10('0x55')];if(!_0x276130[_0xfe10('0x37')]['hasOwnProperty']('nolimit')){_0x39b264[_0xfe10('0x1f')]=qs[_0xfe10('0x1f')](_0x276130[_0xfe10('0x37')][_0xfe10('0x1f')]);_0x39b264['offset']=qs['offset'](_0x276130['query']['offset']);}return _0x46e355[_0xfe10('0xb7')](_0x39b264);}})[_0xfe10('0xe')](function(_0x335856){if(_0x335856){return _0x335856?{'count':_0x483c0b,'rows':_0x335856}:null;}})[_0xfe10('0xe')](respondWithResult(_0x2187cd,null))[_0xfe10('0x18')](handleError(_0x2187cd,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 24b92eb..1751de6 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 _0x6455=['exports','events','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x19fc16,_0x4ac32b){var _0x4bb290=function(_0x1b9fe7){while(--_0x1b9fe7){_0x19fc16['push'](_0x19fc16['shift']());}};_0x4bb290(++_0x4ac32b);}(_0x6455,0x97));var _0x5645=function(_0x5ddbf8,_0x4321b9){_0x5ddbf8=_0x5ddbf8-0x0;var _0x162b32=_0x6455[_0x5ddbf8];return _0x162b32;};'use strict';var EventEmitter=require(_0x5645('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x5645('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5645('0x2')](0x0);var events={'afterCreate':_0x5645('0x3'),'afterUpdate':_0x5645('0x4'),'afterDestroy':_0x5645('0x5')};function emitEvent(_0x35c21e){return function(_0x5388ff,_0x233875,_0x29cefe){MailAccountEvents[_0x5645('0x6')](_0x35c21e+':'+_0x5388ff['id'],_0x5388ff);MailAccountEvents[_0x5645('0x6')](_0x35c21e,_0x5388ff);_0x29cefe(null);};}for(var e in events){if(events[_0x5645('0x7')](e)){var event=events[e];MailAccount[_0x5645('0x8')](e,emitEvent(event));}}module[_0x5645('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x58ea=['MailAccount','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5c048f,_0x52c03d){var _0x43f28a=function(_0x2cebe6){while(--_0x2cebe6){_0x5c048f['push'](_0x5c048f['shift']());}};_0x43f28a(++_0x52c03d);}(_0x58ea,0xe7));var _0xa58e=function(_0x5d0a7b,_0x116063){_0x5d0a7b=_0x5d0a7b-0x0;var _0x1ba43b=_0x58ea[_0x5d0a7b];return _0x1ba43b;};'use strict';var EventEmitter=require(_0xa58e('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xa58e('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa58e('0x2'),'afterDestroy':_0xa58e('0x3')};function emitEvent(_0x4be1d8){return function(_0x223b5a,_0x54be28,_0x5a3685){MailAccountEvents[_0xa58e('0x4')](_0x4be1d8+':'+_0x223b5a['id'],_0x223b5a);MailAccountEvents['emit'](_0x4be1d8,_0x223b5a);_0x5a3685(null);};}for(var e in events){if(events[_0xa58e('0x5')](e)){var event=events[e];MailAccount[_0xa58e('0x6')](e,emitEvent(event));}}module[_0xa58e('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 fe0aa8d..eef5d65 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 _0x41d7=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailAccount.attributes','exports','MailAccount','mail_accounts','lodash','util','api'];(function(_0x53b585,_0x16e0cd){var _0x2e089a=function(_0x4baa7a){while(--_0x4baa7a){_0x53b585['push'](_0x53b585['shift']());}};_0x2e089a(++_0x16e0cd);}(_0x41d7,0x8d));var _0x741d=function(_0x5dd6e4,_0x2d36c5){_0x5dd6e4=_0x5dd6e4-0x0;var _0x11c7c5=_0x41d7[_0x5dd6e4];return _0x11c7c5;};'use strict';var _=require(_0x741d('0x0'));var util=require(_0x741d('0x1'));var logger=require('../../config/logger')(_0x741d('0x2'));var moment=require(_0x741d('0x3'));var BPromise=require(_0x741d('0x4'));var rp=require(_0x741d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x741d('0x6'));var config=require(_0x741d('0x7'));var attributes=require(_0x741d('0x8'));module[_0x741d('0x9')]=function(_0x3984dd,_0x5943c5){return _0x3984dd['define'](_0x741d('0xa'),attributes,{'tableName':_0x741d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x163e=['bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','../../config/logger','api'];(function(_0x3afe1c,_0x5936b8){var _0x18dd11=function(_0x20d47e){while(--_0x20d47e){_0x3afe1c['push'](_0x3afe1c['shift']());}};_0x18dd11(++_0x5936b8);}(_0x163e,0x1c4));var _0xe163=function(_0x561f76,_0x3c0bef){_0x561f76=_0x561f76-0x0;var _0x48b8e4=_0x163e[_0x561f76];return _0x48b8e4;};'use strict';var _=require(_0xe163('0x0'));var util=require('util');var logger=require(_0xe163('0x1'))(_0xe163('0x2'));var moment=require('moment');var BPromise=require(_0xe163('0x3'));var rp=require(_0xe163('0x4'));var fs=require('fs');var path=require(_0xe163('0x5'));var rimraf=require(_0xe163('0x6'));var config=require(_0xe163('0x7'));var attributes=require(_0xe163('0x8'));module[_0xe163('0x9')]=function(_0x4a91fd,_0x1c998f){return _0x4a91fd[_0xe163('0xa')](_0xe163('0xb'),attributes,{'tableName':_0xe163('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index b33c66d..2c5dd4f 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 _0x9505=['originCc','bcc','originChannel','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','then','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','GetMailAccount','findAll','options','where','limit','include','map','model','debug','catch','ShowMailAccount','MailAccount','raw','attributes','NotifyMailAccount','mail','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','MailApplication','Applications','MailServerOut','Smtp','List','account','omit','applications','list','priority','autoclose','push','length','close','*,*,*,*','Contacts','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','spread','update','interaction','created','attachments'];(function(_0x19db4a,_0x39f04d){var _0x274fd4=function(_0x558813){while(--_0x558813){_0x19db4a['push'](_0x19db4a['shift']());}};_0x274fd4(++_0x39f04d);}(_0x9505,0xd7));var _0x5950=function(_0x2e7c27,_0x1919e0){_0x2e7c27=_0x2e7c27-0x0;var _0x52df8c=_0x9505[_0x2e7c27];return _0x52df8c;};'use strict';var _=require('lodash');var util=require(_0x5950('0x0'));var moment=require('moment');var BPromise=require(_0x5950('0x1'));var rs=require(_0x5950('0x2'));var fs=require('fs');var Redis=require(_0x5950('0x3'));var db=require(_0x5950('0x4'))['db'];var utils=require(_0x5950('0x5'));var logger=require('../../config/logger')(_0x5950('0x6'));var config=require(_0x5950('0x7'));var jayson=require(_0x5950('0x8'));var client=jayson[_0x5950('0x9')][_0x5950('0xa')]({'port':0x232c});config[_0x5950('0xb')]=_[_0x5950('0xc')](config[_0x5950('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5950('0xb')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4fbffc,_0x2deffb,_0x79f563){return new BPromise(function(_0x18a2f5,_0x49be81){return client['request'](_0x4fbffc,_0x79f563)[_0x5950('0xd')](function(_0x18fc7c){logger['info'](_0x5950('0xe'),_0x2deffb,'request\x20sent');logger['debug'](_0x5950('0xf'),_0x2deffb,'request\x20sent',JSON[_0x5950('0x10')](_0x18fc7c));if(_0x18fc7c[_0x5950('0x11')]){if(_0x18fc7c[_0x5950('0x11')][_0x5950('0x12')]===0x1f4){logger[_0x5950('0x11')](_0x5950('0xe'),_0x2deffb,_0x18fc7c[_0x5950('0x11')][_0x5950('0x13')]);return _0x49be81(_0x18fc7c['error'][_0x5950('0x13')]);}logger[_0x5950('0x11')](_0x5950('0xe'),_0x2deffb,_0x18fc7c[_0x5950('0x11')][_0x5950('0x13')]);return _0x18a2f5(_0x18fc7c[_0x5950('0x11')][_0x5950('0x13')]);}else{logger[_0x5950('0x14')](_0x5950('0xe'),_0x2deffb,_0x5950('0x15'));_0x18a2f5(_0x18fc7c[_0x5950('0x16')]['message']);}})['catch'](function(_0x2ec7df){logger['error']('MailAccount,\x20%s,\x20%s',_0x2deffb,_0x2ec7df);_0x49be81(_0x2ec7df);});});}exports[_0x5950('0x17')]=function(_0x6b12a1){var _0x1fd453=this;return new Promise(function(_0x303628,_0x12023b){return db['MailAccount'][_0x5950('0x18')]({'raw':_0x6b12a1['options']?_0x6b12a1[_0x5950('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x6b12a1['options']?_0x6b12a1[_0x5950('0x19')][_0x5950('0x1a')]||null:null,'attributes':_0x6b12a1[_0x5950('0x19')]?_0x6b12a1[_0x5950('0x19')]['attributes']||null:null,'limit':_0x6b12a1[_0x5950('0x19')]?_0x6b12a1[_0x5950('0x19')][_0x5950('0x1b')]||null:null,'include':_0x6b12a1[_0x5950('0x19')]?_0x6b12a1[_0x5950('0x19')][_0x5950('0x1c')]?_[_0x5950('0x1d')](_0x6b12a1['options']['include'],function(_0x451c3b){return{'model':db[_0x451c3b[_0x5950('0x1e')]],'as':_0x451c3b['as'],'attributes':_0x451c3b['attributes'],'include':_0x451c3b[_0x5950('0x1c')]?_['map'](_0x451c3b[_0x5950('0x1c')],function(_0x5f11bf){return{'model':db[_0x5f11bf['model']],'as':_0x5f11bf['as'],'attributes':_0x5f11bf['attributes'],'include':_0x5f11bf['include']?_[_0x5950('0x1d')](_0x5f11bf[_0x5950('0x1c')],function(_0x3ad8d2){return{'model':db[_0x3ad8d2[_0x5950('0x1e')]],'as':_0x3ad8d2['as'],'attributes':_0x3ad8d2['attributes']};}):[]};}):[]};}):[]:[]})[_0x5950('0xd')](function(_0x1aedc9){logger['info'](_0x5950('0x17'),_0x6b12a1);logger[_0x5950('0x1f')](_0x5950('0x17'),_0x6b12a1,JSON[_0x5950('0x10')](_0x1aedc9));_0x303628(_0x1aedc9);})[_0x5950('0x20')](function(_0xc7b65f){logger[_0x5950('0x11')]('GetMailAccount',_0xc7b65f['message'],_0x6b12a1);_0x12023b(_0x1fd453[_0x5950('0x11')](0x1f4,_0xc7b65f[_0x5950('0x13')]));});});};exports[_0x5950('0x21')]=function(_0x3d228c){var _0x520ac3=this;return new Promise(function(_0x1aae34,_0x170ebd){return db[_0x5950('0x22')]['find']({'raw':_0x3d228c[_0x5950('0x19')]?_0x3d228c['options'][_0x5950('0x23')]===undefined?!![]:![]:!![],'where':_0x3d228c[_0x5950('0x19')]?_0x3d228c[_0x5950('0x19')][_0x5950('0x1a')]||null:null,'attributes':_0x3d228c[_0x5950('0x19')]?_0x3d228c[_0x5950('0x19')][_0x5950('0x24')]||null:null,'include':_0x3d228c[_0x5950('0x19')]?_0x3d228c[_0x5950('0x19')][_0x5950('0x1c')]?_[_0x5950('0x1d')](_0x3d228c[_0x5950('0x19')]['include'],function(_0x4a5776){return{'model':db[_0x4a5776[_0x5950('0x1e')]],'as':_0x4a5776['as'],'attributes':_0x4a5776['attributes'],'include':_0x4a5776['include']?_[_0x5950('0x1d')](_0x4a5776[_0x5950('0x1c')],function(_0x2c2a96){return{'model':db[_0x2c2a96['model']],'as':_0x2c2a96['as'],'attributes':_0x2c2a96[_0x5950('0x24')],'include':_0x2c2a96[_0x5950('0x1c')]?_[_0x5950('0x1d')](_0x2c2a96[_0x5950('0x1c')],function(_0x33f7af){return{'model':db[_0x33f7af[_0x5950('0x1e')]],'as':_0x33f7af['as'],'attributes':_0x33f7af[_0x5950('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5950('0xd')](function(_0x59d1c7){logger[_0x5950('0x14')]('ShowMailAccount',_0x3d228c);logger['debug'](_0x5950('0x21'),_0x3d228c,JSON[_0x5950('0x10')](_0x59d1c7));_0x1aae34(_0x59d1c7);})['catch'](function(_0x390c58){logger[_0x5950('0x11')](_0x5950('0x21'),_0x390c58[_0x5950('0x13')],_0x3d228c);_0x170ebd(_0x520ac3[_0x5950('0x11')](0x1f4,_0x390c58[_0x5950('0x13')]));});});};exports[_0x5950('0x25')]=function(_0x15b597){var _0x3053b7=this;return new Promise(function(_0x378bb9,_0x13d04b){var _0x378814={'body':_0x15b597['body'],'channel':_0x5950('0x26')};var _0x5607cb=_['difference'](_[_0x5950('0x27')](db[_0x5950('0x28')]['rawAttributes']),[_0x5950('0x29'),_0x5950('0x2a'),_0x5950('0x2b'),_0x5950('0x2c')]);var _0x5bdd53=![];if(_0x15b597['body']['id']){delete _0x15b597[_0x5950('0x2d')]['id'];}if(_[_0x5950('0x2e')](_0x15b597['body'][_0x5950('0x2f')])){return _0x13d04b(_0x3053b7['error'](0x1f4,_0x5950('0x30')));}if(_[_0x5950('0x2e')](_0x15b597[_0x5950('0x2d')][_0x5950('0x2d')])||_0x15b597[_0x5950('0x2d')][_0x5950('0x2d')]===''){return _0x13d04b(_0x3053b7['error'](0x1f4,_0x5950('0x31')));}if(_[_0x5950('0x2e')](_0x15b597['body'][_0x5950('0x32')])){return _0x13d04b(_0x3053b7[_0x5950('0x11')](0x1f4,_0x5950('0x33')+_0x5607cb));}if(!_['includes'](_0x5607cb,_0x15b597[_0x5950('0x2d')][_0x5950('0x32')])){return _0x13d04b(_0x3053b7[_0x5950('0x11')](0x1f4,_0x5950('0x34')+_0x5607cb));}var _0x4083a0={};_0x4083a0[_0x15b597[_0x5950('0x2d')][_0x5950('0x32')]]=_0x15b597[_0x5950('0x2d')][_0x5950('0x2f')];return db[_0x5950('0x22')][_0x5950('0x35')]({'where':{'id':_0x15b597['account']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x5950('0x28')],'as':'Contacts','where':_0x4083a0,'limit':0x1,'order':[[_0x5950('0x2a'),'DESC']]}]},{'model':db[_0x5950('0x36')],'as':_0x5950('0x37')},{'model':db[_0x5950('0x38')],'as':_0x5950('0x39')}]})[_0x5950('0xd')](function(_0x4a84e4){if(_0x4a84e4&&_0x4a84e4[_0x5950('0x3a')]){var _0x11f282=_0x4a84e4['get']({'plain':!![]});_0x378814[_0x5950('0x3b')]=_[_0x5950('0x3c')](_0x11f282,[_0x5950('0x37'),'List']);_0x378814[_0x5950('0x3d')]=_0x11f282[_0x5950('0x37')];_0x378814[_0x5950('0x3e')]=_0x11f282[_0x5950('0x3a')];_0x378814[_0x5950('0x3d')]=_['orderBy'](_0x378814['applications'],[_0x5950('0x3f')],['asc']);if(_0x378814['account']&&_0x378814[_0x5950('0x3b')][_0x5950('0x40')]){_0x378814[_0x5950('0x3d')][_0x5950('0x41')]({'id':0x0,'priority':_0x378814['applications'][_0x5950('0x42')]+0x1,'app':_0x5950('0x43'),'appdata':_0x5950('0x40'),'interval':_0x5950('0x44')});}if(_0x378814['account'][_0x5950('0x37')]){delete _0x378814['account'][_0x5950('0x37')];}if(_0x378814[_0x5950('0x3b')]['List']){delete _0x378814['account'][_0x5950('0x3a')];}if(_0x11f282[_0x5950('0x3a')][_0x5950('0x45')][_0x5950('0x42')]){return _0x11f282[_0x5950('0x3a')][_0x5950('0x45')][0x0];}var _0x4b225a=_[_0x5950('0xc')](_0x15b597['body'],{'firstName':_0x15b597[_0x5950('0x2d')][_0x5950('0x2f')],'ListId':_0x11f282['ListId']});_0x4b225a[_0x15b597['body'][_0x5950('0x32')]]=_0x15b597[_0x5950('0x2d')]['from'];return db[_0x5950('0x28')][_0x5950('0x46')](_0x4b225a);}else{throw new Error(_0x5950('0x47'));}})[_0x5950('0xd')](function(_0x46fcf5){_0x378814[_0x5950('0x48')]=_0x46fcf5;if(_0x46fcf5){if(!_0x15b597[_0x5950('0x2d')][_0x5950('0x13')]['messageId']){_0x15b597[_0x5950('0x2d')][_0x5950('0x13')][_0x5950('0x49')]=rs[_0x5950('0x4a')]()+'\x20'+_0x15b597['body'][_0x5950('0x13')][_0x5950('0x2f')];}var _0x360e72={'ContactId':_0x46fcf5['id'],'MailAccountId':_0x15b597['account']['id'],'inReplyTo':_0x15b597['body'][_0x5950('0x13')][_0x5950('0x49')],'to':_0x15b597[_0x5950('0x2d')][_0x5950('0x13')][_0x5950('0x2f')],'cc':_0x15b597[_0x5950('0x2d')][_0x5950('0x13')]['cc'],'subject':_0x15b597[_0x5950('0x2d')][_0x5950('0x13')][_0x5950('0x4b')],'attach':_0x15b597[_0x5950('0x2d')][_0x5950('0x13')][_0x5950('0x4c')],'lastMsgAt':moment()[_0x5950('0x4d')](_0x5950('0x4e')),'lastMsgDirection':'in'};return db[_0x5950('0x4f')][_0x5950('0x35')]({'where':{'closed':![],'MailAccountId':_0x15b597[_0x5950('0x3b')]['id']},'include':[{'model':db[_0x5950('0x50')],'as':_0x5950('0x51'),'attributes':[_0x5950('0x49')],'where':{'messageId':_0x15b597[_0x5950('0x2d')][_0x5950('0x13')]['inReplyTo']}}]})[_0x5950('0xd')](function(_0x45f5f6){if(_0x45f5f6){return[_0x45f5f6,![]];}return db[_0x5950('0x4f')]['create'](_0x360e72)[_0x5950('0xd')](function(_0x36e40f){return[_0x36e40f,!![]];});});}else{throw new Error(_0x5950('0x52'));}})[_0x5950('0x53')](function(_0x322f11,_0x24ba73){if(_0x322f11){_0x5bdd53=_0x24ba73;if(!_0x24ba73){return _0x322f11[_0x5950('0x54')]({'inReplyTo':_0x15b597[_0x5950('0x2d')][_0x5950('0x13')][_0x5950('0x49')],'to':_0x15b597[_0x5950('0x2d')][_0x5950('0x13')][_0x5950('0x2f')],'cc':_0x15b597['body'][_0x5950('0x13')]['cc'],'subject':_0x15b597[_0x5950('0x2d')][_0x5950('0x13')][_0x5950('0x4b')],'attach':_0x322f11['attach']?_0x322f11[_0x5950('0x4c')]:_0x15b597[_0x5950('0x2d')][_0x5950('0x13')][_0x5950('0x4c')],'substatus':null,'substatusAt':moment()[_0x5950('0x4d')](_0x5950('0x4e')),'lastMsgAt':moment()[_0x5950('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x322f11;}}})['then'](function(_0x43297f){_0x378814['interaction']=_0x43297f['get']({'plain':!![]});_0x378814[_0x5950('0x55')][_0x5950('0x56')]=_0x5bdd53;return db[_0x5950('0x50')][_0x5950('0x46')]({'body':_0x15b597[_0x5950('0x2d')][_0x5950('0x2d')],'MailAccountId':_0x15b597[_0x5950('0x3b')]['id'],'MailInteractionId':_0x43297f['id'],'direction':'in','ContactId':_0x378814[_0x5950('0x48')]['id'],'messageId':_0x15b597[_0x5950('0x2d')]['message']['messageId'],'from':_0x15b597[_0x5950('0x2d')]['message'][_0x5950('0x2f')],'to':_0x15b597[_0x5950('0x2d')]['message']['to'],'cc':_0x15b597[_0x5950('0x2d')][_0x5950('0x13')]['cc'],'subject':_0x15b597[_0x5950('0x2d')][_0x5950('0x13')]['subject'],'attach':_0x15b597['body']['message']['attach'],'Attachments':_0x15b597[_0x5950('0x2d')][_0x5950('0x13')][_0x5950('0x57')],'originTo':_0x15b597[_0x5950('0x2d')]['message']['originTo'],'originCc':_0x15b597[_0x5950('0x2d')]['message'][_0x5950('0x58')],'bcc':_0x15b597['body'][_0x5950('0x13')][_0x5950('0x59')],'ChatWebsiteId':_0x15b597[_0x5950('0x2d')][_0x5950('0x13')]['ChatWebsiteId']||null,'originChannel':_0x15b597[_0x5950('0x2d')][_0x5950('0x13')][_0x5950('0x5a')]||'Email','ChatOfflineMessageId':_0x15b597[_0x5950('0x2d')][_0x5950('0x13')][_0x5950('0x5b')]||null},{'include':[{'model':db[_0x5950('0x5c')],'as':'Attachments'}]});})[_0x5950('0xd')](function(_0x4005c8){_0x378814[_0x5950('0x13')]=_0x4005c8;if(_0x378814[_0x5950('0x55')][_0x5950('0x5d')]){return db[_0x5950('0x5e')][_0x5950('0x35')]({'attributes':['id',_0x5950('0x5f')],'where':{'id':_0x378814['interaction']['UserId']}})[_0x5950('0xd')](function(_0x2575b4){if(_0x2575b4){_0x378814[_0x5950('0x3d')][_0x5950('0x60')]({'id':0x0,'priority':0x0,'app':_0x5950('0x61'),'appdata':_0x2575b4[_0x5950('0x5f')]+','+(_0x378814[_0x5950('0x3b')][_0x5950('0x62')]||0xa),'interval':_0x5950('0x44')});}return respondWithRpcPromise(_0x5950('0x63'),_0x5950('0x64'),_0x378814);});}return respondWithRpcPromise('Start',_0x5950('0x64'),_0x378814);})[_0x5950('0xd')](function(_0x46719e){_0x378bb9(_0x46719e);})[_0x5950('0x20')](function(_0x5e4e72){_0x13d04b(_0x3053b7[_0x5950('0x11')](0x1f4,_0x5e4e72['message']));});});}; \ No newline at end of file +var _0xa9bf=['name','unshift','agent','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','GetMailAccount','MailAccount','findAll','raw','options','where','attributes','include','map','model','then','catch','ShowMailAccount','NotifyMailAccount','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','body','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','MailApplication','get','omit','Applications','applications','orderBy','priority','autoclose','*,*,*,*','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','format','created','attachments','originTo','originCc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','interaction','UserId','User'];(function(_0x42dea5,_0x310751){var _0x3dfcbe=function(_0x24e239){while(--_0x24e239){_0x42dea5['push'](_0x42dea5['shift']());}};_0x3dfcbe(++_0x310751);}(_0xa9bf,0xcb));var _0xfa9b=function(_0xa74e1,_0x5771c0){_0xa74e1=_0xa74e1-0x0;var _0x3d24be=_0xa9bf[_0xa74e1];return _0x3d24be;};'use strict';var _=require(_0xfa9b('0x0'));var util=require(_0xfa9b('0x1'));var moment=require(_0xfa9b('0x2'));var BPromise=require(_0xfa9b('0x3'));var rs=require(_0xfa9b('0x4'));var fs=require('fs');var Redis=require(_0xfa9b('0x5'));var db=require(_0xfa9b('0x6'))['db'];var utils=require(_0xfa9b('0x7'));var logger=require('../../config/logger')(_0xfa9b('0x8'));var config=require('../../config/environment');var jayson=require(_0xfa9b('0x9'));var client=jayson[_0xfa9b('0xa')][_0xfa9b('0xb')]({'port':0x232c});config[_0xfa9b('0xc')]=_[_0xfa9b('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfa9b('0xe'))(new Redis(config[_0xfa9b('0xc')]));require(_0xfa9b('0xf'))[_0xfa9b('0x10')](socket);function respondWithRpcPromise(_0x483e60,_0x30c805,_0x5424f4){return new BPromise(function(_0x996166,_0x833a38){return client[_0xfa9b('0x11')](_0x483e60,_0x5424f4)['then'](function(_0x464d31){logger[_0xfa9b('0x12')]('MailAccount,\x20%s,\x20%s',_0x30c805,_0xfa9b('0x13'));logger[_0xfa9b('0x14')](_0xfa9b('0x15'),_0x30c805,_0xfa9b('0x13'),JSON[_0xfa9b('0x16')](_0x464d31));if(_0x464d31['error']){if(_0x464d31[_0xfa9b('0x17')][_0xfa9b('0x18')]===0x1f4){logger[_0xfa9b('0x17')](_0xfa9b('0x19'),_0x30c805,_0x464d31['error']['message']);return _0x833a38(_0x464d31[_0xfa9b('0x17')][_0xfa9b('0x1a')]);}logger[_0xfa9b('0x17')](_0xfa9b('0x19'),_0x30c805,_0x464d31[_0xfa9b('0x17')]['message']);return _0x996166(_0x464d31[_0xfa9b('0x17')][_0xfa9b('0x1a')]);}else{logger[_0xfa9b('0x12')](_0xfa9b('0x19'),_0x30c805,_0xfa9b('0x13'));_0x996166(_0x464d31['result'][_0xfa9b('0x1a')]);}})['catch'](function(_0xe0b83b){logger[_0xfa9b('0x17')](_0xfa9b('0x19'),_0x30c805,_0xe0b83b);_0x833a38(_0xe0b83b);});});}exports[_0xfa9b('0x1b')]=function(_0x26bc5b){var _0x42fc57=this;return new Promise(function(_0x1ab82e,_0x27fae9){return db[_0xfa9b('0x1c')][_0xfa9b('0x1d')]({'raw':_0x26bc5b['options']?_0x26bc5b['options'][_0xfa9b('0x1e')]===undefined?!![]:![]:!![],'where':_0x26bc5b[_0xfa9b('0x1f')]?_0x26bc5b[_0xfa9b('0x1f')][_0xfa9b('0x20')]||null:null,'attributes':_0x26bc5b['options']?_0x26bc5b[_0xfa9b('0x1f')][_0xfa9b('0x21')]||null:null,'limit':_0x26bc5b[_0xfa9b('0x1f')]?_0x26bc5b[_0xfa9b('0x1f')]['limit']||null:null,'include':_0x26bc5b['options']?_0x26bc5b[_0xfa9b('0x1f')][_0xfa9b('0x22')]?_[_0xfa9b('0x23')](_0x26bc5b[_0xfa9b('0x1f')][_0xfa9b('0x22')],function(_0x3192d4){return{'model':db[_0x3192d4[_0xfa9b('0x24')]],'as':_0x3192d4['as'],'attributes':_0x3192d4['attributes'],'include':_0x3192d4[_0xfa9b('0x22')]?_[_0xfa9b('0x23')](_0x3192d4[_0xfa9b('0x22')],function(_0x5074f3){return{'model':db[_0x5074f3[_0xfa9b('0x24')]],'as':_0x5074f3['as'],'attributes':_0x5074f3[_0xfa9b('0x21')],'include':_0x5074f3[_0xfa9b('0x22')]?_[_0xfa9b('0x23')](_0x5074f3['include'],function(_0x9f63ef){return{'model':db[_0x9f63ef[_0xfa9b('0x24')]],'as':_0x9f63ef['as'],'attributes':_0x9f63ef['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa9b('0x25')](function(_0x42e33e){logger[_0xfa9b('0x12')]('GetMailAccount',_0x26bc5b);logger['debug'](_0xfa9b('0x1b'),_0x26bc5b,JSON[_0xfa9b('0x16')](_0x42e33e));_0x1ab82e(_0x42e33e);})[_0xfa9b('0x26')](function(_0x1704f5){logger[_0xfa9b('0x17')]('GetMailAccount',_0x1704f5[_0xfa9b('0x1a')],_0x26bc5b);_0x27fae9(_0x42fc57[_0xfa9b('0x17')](0x1f4,_0x1704f5[_0xfa9b('0x1a')]));});});};exports[_0xfa9b('0x27')]=function(_0x4814e1){var _0x2d9784=this;return new Promise(function(_0x43813c,_0x3b690d){return db[_0xfa9b('0x1c')]['find']({'raw':_0x4814e1[_0xfa9b('0x1f')]?_0x4814e1[_0xfa9b('0x1f')][_0xfa9b('0x1e')]===undefined?!![]:![]:!![],'where':_0x4814e1[_0xfa9b('0x1f')]?_0x4814e1[_0xfa9b('0x1f')][_0xfa9b('0x20')]||null:null,'attributes':_0x4814e1[_0xfa9b('0x1f')]?_0x4814e1[_0xfa9b('0x1f')][_0xfa9b('0x21')]||null:null,'include':_0x4814e1[_0xfa9b('0x1f')]?_0x4814e1[_0xfa9b('0x1f')][_0xfa9b('0x22')]?_['map'](_0x4814e1[_0xfa9b('0x1f')][_0xfa9b('0x22')],function(_0x4cb56b){return{'model':db[_0x4cb56b[_0xfa9b('0x24')]],'as':_0x4cb56b['as'],'attributes':_0x4cb56b[_0xfa9b('0x21')],'include':_0x4cb56b[_0xfa9b('0x22')]?_[_0xfa9b('0x23')](_0x4cb56b[_0xfa9b('0x22')],function(_0x40a2a1){return{'model':db[_0x40a2a1[_0xfa9b('0x24')]],'as':_0x40a2a1['as'],'attributes':_0x40a2a1['attributes'],'include':_0x40a2a1[_0xfa9b('0x22')]?_[_0xfa9b('0x23')](_0x40a2a1['include'],function(_0x56418d){return{'model':db[_0x56418d[_0xfa9b('0x24')]],'as':_0x56418d['as'],'attributes':_0x56418d[_0xfa9b('0x21')]};}):[]};}):[]};}):[]:[]})[_0xfa9b('0x25')](function(_0xb02644){logger[_0xfa9b('0x12')](_0xfa9b('0x27'),_0x4814e1);logger[_0xfa9b('0x14')](_0xfa9b('0x27'),_0x4814e1,JSON['stringify'](_0xb02644));_0x43813c(_0xb02644);})[_0xfa9b('0x26')](function(_0x3d69b5){logger['error'](_0xfa9b('0x27'),_0x3d69b5[_0xfa9b('0x1a')],_0x4814e1);_0x3b690d(_0x2d9784[_0xfa9b('0x17')](0x1f4,_0x3d69b5[_0xfa9b('0x1a')]));});});};exports[_0xfa9b('0x28')]=function(_0x1a08ee){var _0x23d815=this;return new Promise(function(_0x48baff,_0x376efd){var _0x12ef35={'body':_0x1a08ee['body'],'channel':'mail'};var _0x23afdc=_[_0xfa9b('0x29')](_[_0xfa9b('0x2a')](db[_0xfa9b('0x2b')][_0xfa9b('0x2c')]),[_0xfa9b('0x2d'),_0xfa9b('0x2e'),'CompanyId',_0xfa9b('0x2f')]);var _0x25a3f3=![];if(_0x1a08ee[_0xfa9b('0x30')]['id']){delete _0x1a08ee[_0xfa9b('0x30')]['id'];}if(_[_0xfa9b('0x31')](_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x32')])){return _0x376efd(_0x23d815[_0xfa9b('0x17')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xfa9b('0x31')](_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x30')])||_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x30')]===''){return _0x376efd(_0x23d815[_0xfa9b('0x17')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xfa9b('0x31')](_0x1a08ee['body'][_0xfa9b('0x33')])){return _0x376efd(_0x23d815[_0xfa9b('0x17')](0x1f4,_0xfa9b('0x34')+_0x23afdc));}if(!_['includes'](_0x23afdc,_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x33')])){return _0x376efd(_0x23d815['error'](0x1f4,_0xfa9b('0x35')+_0x23afdc));}var _0x47e584={};_0x47e584[_0x1a08ee[_0xfa9b('0x30')]['mapKey']]=_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x32')];return db[_0xfa9b('0x1c')][_0xfa9b('0x36')]({'where':{'id':_0x1a08ee[_0xfa9b('0x37')]['id']},'include':[{'model':db[_0xfa9b('0x38')],'as':_0xfa9b('0x39'),'include':[{'model':db[_0xfa9b('0x2b')],'as':_0xfa9b('0x3a'),'where':_0x47e584,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xfa9b('0x3b')],'as':'Applications'},{'model':db['MailServerOut'],'as':'Smtp'}]})[_0xfa9b('0x25')](function(_0x571f19){if(_0x571f19&&_0x571f19[_0xfa9b('0x39')]){var _0x4c034e=_0x571f19[_0xfa9b('0x3c')]({'plain':!![]});_0x12ef35['account']=_[_0xfa9b('0x3d')](_0x4c034e,[_0xfa9b('0x3e'),'List']);_0x12ef35[_0xfa9b('0x3f')]=_0x4c034e['Applications'];_0x12ef35['list']=_0x4c034e[_0xfa9b('0x39')];_0x12ef35[_0xfa9b('0x3f')]=_[_0xfa9b('0x40')](_0x12ef35['applications'],[_0xfa9b('0x41')],['asc']);if(_0x12ef35[_0xfa9b('0x37')]&&_0x12ef35['account'][_0xfa9b('0x42')]){_0x12ef35[_0xfa9b('0x3f')]['push']({'id':0x0,'priority':_0x12ef35[_0xfa9b('0x3f')]['length']+0x1,'app':'close','appdata':_0xfa9b('0x42'),'interval':_0xfa9b('0x43')});}if(_0x12ef35[_0xfa9b('0x37')][_0xfa9b('0x3e')]){delete _0x12ef35[_0xfa9b('0x37')][_0xfa9b('0x3e')];}if(_0x12ef35[_0xfa9b('0x37')][_0xfa9b('0x39')]){delete _0x12ef35[_0xfa9b('0x37')][_0xfa9b('0x39')];}if(_0x4c034e['List'][_0xfa9b('0x3a')][_0xfa9b('0x44')]){return _0x4c034e[_0xfa9b('0x39')][_0xfa9b('0x3a')][0x0];}var _0x4c1b08=_[_0xfa9b('0xd')](_0x1a08ee[_0xfa9b('0x30')],{'firstName':_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x32')],'ListId':_0x4c034e['ListId']});_0x4c1b08[_0x1a08ee['body'][_0xfa9b('0x33')]]=_0x1a08ee['body']['from'];return db['CmContact'][_0xfa9b('0x45')](_0x4c1b08);}else{throw new Error(_0xfa9b('0x46'));}})[_0xfa9b('0x25')](function(_0x1712e7){_0x12ef35[_0xfa9b('0x47')]=_0x1712e7;if(_0x1712e7){if(!_0x1a08ee[_0xfa9b('0x30')]['message']['messageId']){_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x1a')][_0xfa9b('0x48')]=rs[_0xfa9b('0x49')]()+'\x20'+_0x1a08ee['body'][_0xfa9b('0x1a')][_0xfa9b('0x32')];}var _0x151ad0={'ContactId':_0x1712e7['id'],'MailAccountId':_0x1a08ee[_0xfa9b('0x37')]['id'],'inReplyTo':_0x1a08ee[_0xfa9b('0x30')]['message'][_0xfa9b('0x48')],'to':_0x1a08ee[_0xfa9b('0x30')]['message']['from'],'cc':_0x1a08ee[_0xfa9b('0x30')]['message']['cc'],'subject':_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x1a')][_0xfa9b('0x4a')],'attach':_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x1a')][_0xfa9b('0x4b')],'lastMsgAt':moment()['format'](_0xfa9b('0x4c')),'lastMsgDirection':'in'};return db[_0xfa9b('0x4d')]['find']({'where':{'closed':![],'MailAccountId':_0x1a08ee[_0xfa9b('0x37')]['id']},'include':[{'model':db[_0xfa9b('0x4e')],'as':_0xfa9b('0x4f'),'attributes':[_0xfa9b('0x48')],'where':{'messageId':_0x1a08ee['body'][_0xfa9b('0x1a')][_0xfa9b('0x50')]}}]})[_0xfa9b('0x25')](function(_0x4dec64){if(_0x4dec64){return[_0x4dec64,![]];}return db[_0xfa9b('0x4d')][_0xfa9b('0x45')](_0x151ad0)[_0xfa9b('0x25')](function(_0x290474){return[_0x290474,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xfa9b('0x51')](function(_0x286dfa,_0x415249){if(_0x286dfa){_0x25a3f3=_0x415249;if(!_0x415249){return _0x286dfa['update']({'inReplyTo':_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x1a')][_0xfa9b('0x48')],'to':_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x1a')][_0xfa9b('0x32')],'cc':_0x1a08ee['body']['message']['cc'],'subject':_0x1a08ee['body']['message']['subject'],'attach':_0x286dfa[_0xfa9b('0x4b')]?_0x286dfa['attach']:_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x1a')]['attach'],'substatus':null,'substatusAt':moment()[_0xfa9b('0x52')](_0xfa9b('0x4c')),'lastMsgAt':moment()[_0xfa9b('0x52')](_0xfa9b('0x4c')),'lastMsgDirection':'in'});}else{return _0x286dfa;}}})['then'](function(_0x4c102f){_0x12ef35['interaction']=_0x4c102f[_0xfa9b('0x3c')]({'plain':!![]});_0x12ef35['interaction'][_0xfa9b('0x53')]=_0x25a3f3;return db[_0xfa9b('0x4e')]['create']({'body':_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x30')],'MailAccountId':_0x1a08ee[_0xfa9b('0x37')]['id'],'MailInteractionId':_0x4c102f['id'],'direction':'in','ContactId':_0x12ef35[_0xfa9b('0x47')]['id'],'messageId':_0x1a08ee[_0xfa9b('0x30')]['message'][_0xfa9b('0x48')],'from':_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x1a')]['from'],'to':_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x1a')]['to'],'cc':_0x1a08ee['body']['message']['cc'],'subject':_0x1a08ee['body'][_0xfa9b('0x1a')][_0xfa9b('0x4a')],'attach':_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x1a')][_0xfa9b('0x4b')],'Attachments':_0x1a08ee['body'][_0xfa9b('0x1a')][_0xfa9b('0x54')],'originTo':_0x1a08ee['body']['message'][_0xfa9b('0x55')],'originCc':_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x1a')][_0xfa9b('0x56')],'bcc':_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x1a')]['bcc'],'ChatWebsiteId':_0x1a08ee[_0xfa9b('0x30')][_0xfa9b('0x1a')][_0xfa9b('0x57')]||null,'originChannel':_0x1a08ee[_0xfa9b('0x30')]['message']['originChannel']||_0xfa9b('0x58'),'ChatOfflineMessageId':_0x1a08ee['body'][_0xfa9b('0x1a')][_0xfa9b('0x59')]||null},{'include':[{'model':db['Attachment'],'as':_0xfa9b('0x5a')}]});})['then'](function(_0x12ce75){_0x12ef35[_0xfa9b('0x1a')]=_0x12ce75;if(_0x12ef35[_0xfa9b('0x5b')][_0xfa9b('0x5c')]){return db[_0xfa9b('0x5d')][_0xfa9b('0x36')]({'attributes':['id',_0xfa9b('0x5e')],'where':{'id':_0x12ef35[_0xfa9b('0x5b')][_0xfa9b('0x5c')]}})[_0xfa9b('0x25')](function(_0x1ef23e){if(_0x1ef23e){_0x12ef35['applications'][_0xfa9b('0x5f')]({'id':0x0,'priority':0x0,'app':_0xfa9b('0x60'),'appdata':_0x1ef23e['name']+','+(_0x12ef35['account']['waitForTheAssignedAgent']||0xa),'interval':_0xfa9b('0x43')});}return respondWithRpcPromise('Start',_0xfa9b('0x61'),_0x12ef35);});}return respondWithRpcPromise(_0xfa9b('0x62'),_0xfa9b('0x61'),_0x12ef35);})[_0xfa9b('0x25')](function(_0x5d4b78){_0x48baff(_0x5d4b78);})[_0xfa9b('0x26')](function(_0x26d1b3){_0x376efd(_0x23d815[_0xfa9b('0x17')](0x1f4,_0x26d1b3[_0xfa9b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index eed5fff..d9abcf2 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 _0x7d0c=['removeListener','register','mailAccount:','./mailAccount.events','remove','update','emit'];(function(_0x402637,_0x447506){var _0x4b8afa=function(_0x1f0d4d){while(--_0x1f0d4d){_0x402637['push'](_0x402637['shift']());}};_0x4b8afa(++_0x447506);}(_0x7d0c,0xce));var _0xc7d0=function(_0x18f391,_0x2320e9){_0x18f391=_0x18f391-0x0;var _0x3e3aac=_0x7d0c[_0x18f391];return _0x3e3aac;};'use strict';var MailAccountEvents=require(_0xc7d0('0x0'));var events=['save',_0xc7d0('0x1'),_0xc7d0('0x2')];function createListener(_0x42f325,_0x45af23){return function(_0x13ab4a){_0x45af23[_0xc7d0('0x3')](_0x42f325,_0x13ab4a);};}function removeListener(_0x4fa7d9,_0x27695a){return function(){MailAccountEvents[_0xc7d0('0x4')](_0x4fa7d9,_0x27695a);};}exports[_0xc7d0('0x5')]=function(_0x4736fb){for(var _0x5f59a8=0x0,_0x31ac6f=events['length'];_0x5f59a8<_0x31ac6f;_0x5f59a8++){var _0x43e2f7=events[_0x5f59a8];var _0x34a8eb=createListener(_0xc7d0('0x6')+_0x43e2f7,_0x4736fb);MailAccountEvents['on'](_0x43e2f7,_0x34a8eb);}}; \ No newline at end of file +var _0x8e7a=['length','mailAccount:','save','remove','removeListener','register'];(function(_0x4fea19,_0x150b18){var _0x24b109=function(_0x2c2cc9){while(--_0x2c2cc9){_0x4fea19['push'](_0x4fea19['shift']());}};_0x24b109(++_0x150b18);}(_0x8e7a,0x1ac));var _0xa8e7=function(_0x203f49,_0x409b10){_0x203f49=_0x203f49-0x0;var _0x2cf51c=_0x8e7a[_0x203f49];return _0x2cf51c;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xa8e7('0x0'),_0xa8e7('0x1'),'update'];function createListener(_0x306242,_0x4332a4){return function(_0x50a404){_0x4332a4['emit'](_0x306242,_0x50a404);};}function removeListener(_0x1f27f1,_0x3cb7ca){return function(){MailAccountEvents[_0xa8e7('0x2')](_0x1f27f1,_0x3cb7ca);};}exports[_0xa8e7('0x3')]=function(_0x4e63cc){for(var _0x517e42=0x0,_0x3b1ab0=events[_0xa8e7('0x4')];_0x517e42<_0x3b1ab0;_0x517e42++){var _0x5cb539=events[_0x517e42];var _0x5f3a64=createListener(_0xa8e7('0x5')+_0x5cb539,_0x4e63cc);MailAccountEvents['on'](_0x5cb539,_0x5f3a64);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index c88aca4..abad838 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 _0xf61e=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy'];(function(_0x271a3e,_0x4ebe5f){var _0x14ebb9=function(_0x4c5884){while(--_0x4c5884){_0x271a3e['push'](_0x271a3e['shift']());}};_0x14ebb9(++_0x4ebe5f);}(_0xf61e,0x71));var _0xef61=function(_0x5e128e,_0x318736){_0x5e128e=_0x5e128e-0x0;var _0x5d4f78=_0xf61e[_0x5e128e];return _0x5d4f78;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require(_0xef61('0x3'));var express=require('express');var router=express[_0xef61('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xef61('0x5'));var interaction=require(_0xef61('0x6'));var config=require('../../config/environment');var controller=require(_0xef61('0x7'));router[_0xef61('0x8')](_0xef61('0x9'),auth[_0xef61('0xa')](),controller[_0xef61('0xb')]);router[_0xef61('0xc')]('/:id',auth[_0xef61('0xa')](),controller[_0xef61('0xd')]);router['delete']('/:id',auth[_0xef61('0xa')](),controller[_0xef61('0xe')]);module[_0xef61('0xf')]=router; \ No newline at end of file +var _0x7d1b=['destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x7da00b,_0x3f0f18){var _0x1ec8c0=function(_0x28f6b3){while(--_0x28f6b3){_0x7da00b['push'](_0x7da00b['shift']());}};_0x1ec8c0(++_0x3f0f18);}(_0x7d1b,0x88));var _0xb7d1=function(_0x3fe893,_0x170ff0){_0x3fe893=_0x3fe893-0x0;var _0x5dda1d=_0x7d1b[_0x3fe893];return _0x5dda1d;};'use strict';var multer=require(_0xb7d1('0x0'));var util=require(_0xb7d1('0x1'));var path=require(_0xb7d1('0x2'));var timeout=require(_0xb7d1('0x3'));var express=require(_0xb7d1('0x4'));var router=express[_0xb7d1('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb7d1('0x6'));var controller=require(_0xb7d1('0x7'));router[_0xb7d1('0x8')](_0xb7d1('0x9'),auth[_0xb7d1('0xa')](),controller[_0xb7d1('0xb')]);router[_0xb7d1('0xc')](_0xb7d1('0x9'),auth[_0xb7d1('0xa')](),controller[_0xb7d1('0xd')]);router['delete']('/:id',auth[_0xb7d1('0xa')](),controller[_0xb7d1('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 463ff6f..6d4619b 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 _0x2416=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x599b15,_0x2bd1fd){var _0x19e2a4=function(_0xc597f7){while(--_0xc597f7){_0x599b15['push'](_0x599b15['shift']());}};_0x19e2a4(++_0x2bd1fd);}(_0x2416,0x127));var _0x6241=function(_0x2dc2d5,_0x545925){_0x2dc2d5=_0x2dc2d5-0x0;var _0x34907a=_0x2416[_0x2dc2d5];return _0x34907a;};'use strict';var Sequelize=require(_0x6241('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6241('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6241('0x2')],'allowNull':![],'defaultValue':_0x6241('0x3')},'appdata':{'type':Sequelize[_0x6241('0x4')]()},'description':{'type':Sequelize[_0x6241('0x2')]},'interval':{'type':Sequelize[_0x6241('0x2')],'defaultValue':_0x6241('0x5')}}; \ No newline at end of file +var _0x801c=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x1f9025,_0x2d367b){var _0x2e0d25=function(_0x57a7ab){while(--_0x57a7ab){_0x1f9025['push'](_0x1f9025['shift']());}};_0x2e0d25(++_0x2d367b);}(_0x801c,0xda));var _0xc801=function(_0x1baecd,_0x2e1010){_0x1baecd=_0x1baecd-0x0;var _0x1fdd66=_0x801c[_0x1baecd];return _0x1fdd66;};'use strict';var Sequelize=require(_0xc801('0x0'));module[_0xc801('0x1')]={'priority':{'type':Sequelize[_0xc801('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc801('0x3')],'allowNull':![],'defaultValue':_0xc801('0x4')},'appdata':{'type':Sequelize[_0xc801('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc801('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 2afb09b..fae7bf4 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 _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x50811d,_0x17d91c){var _0x4f1582=function(_0x8450cc){while(--_0x8450cc){_0x50811d['push'](_0x50811d['shift']());}};_0x4f1582(++_0x17d91c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1c67ab,_0x2bfd2f){_0x1c67ab=_0x1c67ab-0x0;var _0x51a1c4=_0x9bde[_0x1c67ab];return _0x51a1c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x5c21b4,_0x32a80d){var _0x452bea=function(_0x39c97c){while(--_0x39c97c){_0x5c21b4['push'](_0x5c21b4['shift']());}};_0x452bea(++_0x32a80d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 590a322..a34e291 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 _0x03d1=['moment','request-promise','path','rimraf','exports','define','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x37c852,_0x5adcdb){var _0x39d76c=function(_0x17186c){while(--_0x17186c){_0x37c852['push'](_0x37c852['shift']());}};_0x39d76c(++_0x5adcdb);}(_0x03d1,0x1d0));var _0x103d=function(_0x1a9c3b,_0xa2b539){_0x1a9c3b=_0x1a9c3b-0x0;var _0x1797e6=_0x03d1[_0x1a9c3b];return _0x1797e6;};'use strict';var _=require(_0x103d('0x0'));var util=require(_0x103d('0x1'));var logger=require(_0x103d('0x2'))(_0x103d('0x3'));var moment=require(_0x103d('0x4'));var BPromise=require('bluebird');var rp=require(_0x103d('0x5'));var fs=require('fs');var path=require(_0x103d('0x6'));var rimraf=require(_0x103d('0x7'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0x103d('0x8')]=function(_0xae16e2,_0x167d22){return _0xae16e2[_0x103d('0x9')](_0x103d('0xa'),attributes,{'tableName':_0x103d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x103d('0xc')});}; \ No newline at end of file +var _0x88a0=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4'];(function(_0x2d6ab8,_0x1b6b82){var _0x339c56=function(_0xe1741d){while(--_0xe1741d){_0x2d6ab8['push'](_0x2d6ab8['shift']());}};_0x339c56(++_0x1b6b82);}(_0x88a0,0x1ad));var _0x088a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x88a0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x088a('0x0'));var util=require(_0x088a('0x1'));var logger=require(_0x088a('0x2'))(_0x088a('0x3'));var moment=require(_0x088a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x088a('0x5'));var rimraf=require(_0x088a('0x6'));var config=require(_0x088a('0x7'));var attributes=require(_0x088a('0x8'));module['exports']=function(_0xaee830,_0x11c5c0){return _0xaee830[_0x088a('0x9')](_0x088a('0xa'),attributes,{'tableName':_0x088a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x088a('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 149c13c..1606d99 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 _0x4f57=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateMailApplication','update','options','raw','limit','lodash','util','bluebird'];(function(_0x3867c1,_0x52cdf2){var _0x25c17e=function(_0x29653f){while(--_0x29653f){_0x3867c1['push'](_0x3867c1['shift']());}};_0x25c17e(++_0x52cdf2);}(_0x4f57,0xc1));var _0x74f5=function(_0x167a6e,_0x381510){_0x167a6e=_0x167a6e-0x0;var _0x2e610d=_0x4f57[_0x167a6e];return _0x2e610d;};'use strict';var _=require(_0x74f5('0x0'));var util=require(_0x74f5('0x1'));var moment=require('moment');var BPromise=require(_0x74f5('0x2'));var rs=require(_0x74f5('0x3'));var fs=require('fs');var Redis=require(_0x74f5('0x4'));var db=require(_0x74f5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x74f5('0x6'))(_0x74f5('0x7'));var config=require(_0x74f5('0x8'));var jayson=require(_0x74f5('0x9'));var client=jayson['client'][_0x74f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9645f3,_0x2a9bb0,_0x197851){return new BPromise(function(_0x590310,_0x1aa1a5){return client[_0x74f5('0xb')](_0x9645f3,_0x197851)[_0x74f5('0xc')](function(_0x1752d1){logger['info'](_0x74f5('0xd'),_0x2a9bb0,_0x74f5('0xe'));logger[_0x74f5('0xf')](_0x74f5('0x10'),_0x2a9bb0,_0x74f5('0xe'),JSON[_0x74f5('0x11')](_0x1752d1));if(_0x1752d1[_0x74f5('0x12')]){if(_0x1752d1[_0x74f5('0x12')]['code']===0x1f4){logger[_0x74f5('0x12')](_0x74f5('0xd'),_0x2a9bb0,_0x1752d1['error'][_0x74f5('0x13')]);return _0x1aa1a5(_0x1752d1[_0x74f5('0x12')]['message']);}logger[_0x74f5('0x12')]('MailApplication,\x20%s,\x20%s',_0x2a9bb0,_0x1752d1[_0x74f5('0x12')][_0x74f5('0x13')]);return _0x590310(_0x1752d1['error'][_0x74f5('0x13')]);}else{logger[_0x74f5('0x14')](_0x74f5('0xd'),_0x2a9bb0,'request\x20sent');_0x590310(_0x1752d1[_0x74f5('0x15')][_0x74f5('0x13')]);}})[_0x74f5('0x16')](function(_0x3000e0){logger[_0x74f5('0x12')](_0x74f5('0xd'),_0x2a9bb0,_0x3000e0);_0x1aa1a5(_0x3000e0);});});}exports[_0x74f5('0x17')]=function(_0x4f4070){var _0x13469b=this;return new Promise(function(_0x5f553c,_0x2490a8){return db['MailApplication'][_0x74f5('0x18')](_0x4f4070['body'],{'raw':_0x4f4070[_0x74f5('0x19')]?_0x4f4070[_0x74f5('0x19')][_0x74f5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f4070[_0x74f5('0x19')]?_0x4f4070[_0x74f5('0x19')]['where']||null:null,'attributes':_0x4f4070['options']?_0x4f4070[_0x74f5('0x19')]['attributes']||null:null,'limit':_0x4f4070[_0x74f5('0x19')]?_0x4f4070[_0x74f5('0x19')][_0x74f5('0x1b')]||null:null})[_0x74f5('0xc')](function(_0x522871){logger[_0x74f5('0x14')](_0x74f5('0x17'),_0x4f4070);logger[_0x74f5('0xf')](_0x74f5('0x17'),_0x4f4070,JSON['stringify'](_0x522871));_0x5f553c(_0x522871);})[_0x74f5('0x16')](function(_0x5970b7){logger[_0x74f5('0x12')](_0x74f5('0x17'),_0x5970b7[_0x74f5('0x13')],_0x4f4070);_0x2490a8(_0x13469b[_0x74f5('0x12')](0x1f4,_0x5970b7[_0x74f5('0x13')]));});});}; \ No newline at end of file +var _0xd374=['body','options','raw','where','attributes','limit','info','stringify','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','request','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateMailApplication','update'];(function(_0x2d9535,_0x4bc592){var _0xb4e710=function(_0x50b9a9){while(--_0x50b9a9){_0x2d9535['push'](_0x2d9535['shift']());}};_0xb4e710(++_0x4bc592);}(_0xd374,0xbc));var _0x4d37=function(_0x2dd4f4,_0xcb3e2e){_0x2dd4f4=_0x2dd4f4-0x0;var _0x4b1552=_0xd374[_0x2dd4f4];return _0x4b1552;};'use strict';var _=require(_0x4d37('0x0'));var util=require(_0x4d37('0x1'));var moment=require('moment');var BPromise=require(_0x4d37('0x2'));var rs=require(_0x4d37('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4d37('0x4'))(_0x4d37('0x5'));var config=require(_0x4d37('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4d37('0x7')][_0x4d37('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xed8bf8,_0x580724,_0x4cede5){return new BPromise(function(_0x36923a,_0x12991b){return client[_0x4d37('0x9')](_0xed8bf8,_0x4cede5)[_0x4d37('0xa')](function(_0x2465c5){logger['info'](_0x4d37('0xb'),_0x580724,'request\x20sent');logger[_0x4d37('0xc')](_0x4d37('0xd'),_0x580724,_0x4d37('0xe'),JSON['stringify'](_0x2465c5));if(_0x2465c5[_0x4d37('0xf')]){if(_0x2465c5[_0x4d37('0xf')][_0x4d37('0x10')]===0x1f4){logger[_0x4d37('0xf')](_0x4d37('0xb'),_0x580724,_0x2465c5[_0x4d37('0xf')][_0x4d37('0x11')]);return _0x12991b(_0x2465c5[_0x4d37('0xf')][_0x4d37('0x11')]);}logger[_0x4d37('0xf')](_0x4d37('0xb'),_0x580724,_0x2465c5['error'][_0x4d37('0x11')]);return _0x36923a(_0x2465c5['error'][_0x4d37('0x11')]);}else{logger['info'](_0x4d37('0xb'),_0x580724,_0x4d37('0xe'));_0x36923a(_0x2465c5[_0x4d37('0x12')]['message']);}})[_0x4d37('0x13')](function(_0x3a3452){logger['error'](_0x4d37('0xb'),_0x580724,_0x3a3452);_0x12991b(_0x3a3452);});});}exports[_0x4d37('0x14')]=function(_0x24a25d){var _0x57e5c0=this;return new Promise(function(_0x382505,_0x1be6a0){return db['MailApplication'][_0x4d37('0x15')](_0x24a25d[_0x4d37('0x16')],{'raw':_0x24a25d[_0x4d37('0x17')]?_0x24a25d['options'][_0x4d37('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24a25d[_0x4d37('0x17')]?_0x24a25d[_0x4d37('0x17')][_0x4d37('0x19')]||null:null,'attributes':_0x24a25d['options']?_0x24a25d[_0x4d37('0x17')][_0x4d37('0x1a')]||null:null,'limit':_0x24a25d['options']?_0x24a25d['options'][_0x4d37('0x1b')]||null:null})[_0x4d37('0xa')](function(_0x308a96){logger[_0x4d37('0x1c')](_0x4d37('0x14'),_0x24a25d);logger['debug']('UpdateMailApplication',_0x24a25d,JSON[_0x4d37('0x1d')](_0x308a96));_0x382505(_0x308a96);})[_0x4d37('0x13')](function(_0x55e68b){logger[_0x4d37('0xf')](_0x4d37('0x14'),_0x55e68b[_0x4d37('0x11')],_0x24a25d);_0x1be6a0(_0x57e5c0[_0x4d37('0xf')](0x1f4,_0x55e68b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index f59dc9c..732950a 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 _0x9a1c=['post','/:id/tags','mail','mailinteraction:addtags','put','/:id','tracked','mailinteraction:update','update','delete','destroy','removeTags','exports','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create'];(function(_0x2ce593,_0x303504){var _0x439631=function(_0x3b4f37){while(--_0x3b4f37){_0x2ce593['push'](_0x2ce593['shift']());}};_0x439631(++_0x303504);}(_0x9a1c,0x187));var _0xc9a1=function(_0x2d0ac3,_0x32ca25){_0x2d0ac3=_0x2d0ac3-0x0;var _0x360481=_0x9a1c[_0x2d0ac3];return _0x360481;};'use strict';var express=require('express');var router=express[_0xc9a1('0x0')]();var auth=require('../../components/auth/service');var interaction=require(_0xc9a1('0x1'));var controller=require(_0xc9a1('0x2'));router[_0xc9a1('0x3')]('/',auth[_0xc9a1('0x4')](),controller[_0xc9a1('0x5')]);router[_0xc9a1('0x3')](_0xc9a1('0x6'),auth[_0xc9a1('0x4')](),controller[_0xc9a1('0x7')]);router['get']('/:id',auth[_0xc9a1('0x4')](),controller[_0xc9a1('0x8')]);router['get'](_0xc9a1('0x9'),auth['isAuthenticated'](),controller[_0xc9a1('0xa')]);router[_0xc9a1('0x3')](_0xc9a1('0xb'),auth['isAuthenticated'](),controller[_0xc9a1('0xc')]);router['post']('/',auth[_0xc9a1('0x4')](),controller[_0xc9a1('0xd')]);router[_0xc9a1('0xe')](_0xc9a1('0x9'),auth[_0xc9a1('0x4')](),controller['addMessage']);router[_0xc9a1('0xe')](_0xc9a1('0xf'),auth[_0xc9a1('0x4')](),interaction['tracked'](_0xc9a1('0x10'),_0xc9a1('0x11')),controller['addTags']);router[_0xc9a1('0x12')](_0xc9a1('0x13'),auth[_0xc9a1('0x4')](),interaction[_0xc9a1('0x14')](_0xc9a1('0x10'),_0xc9a1('0x15')),controller[_0xc9a1('0x16')]);router[_0xc9a1('0x17')](_0xc9a1('0x13'),auth[_0xc9a1('0x4')](),interaction[_0xc9a1('0x14')]('mail','mailinteraction:destroy'),controller[_0xc9a1('0x18')]);router['delete'](_0xc9a1('0xf'),auth[_0xc9a1('0x4')](),controller[_0xc9a1('0x19')]);module[_0xc9a1('0x1a')]=router; \ No newline at end of file +var _0xaf66=['addTags','put','/:id','tracked','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','express','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','post','create','addMessage','mail','mailinteraction:addtags'];(function(_0x1c5ef6,_0x1bfc94){var _0x2280ac=function(_0x29354a){while(--_0x29354a){_0x1c5ef6['push'](_0x1c5ef6['shift']());}};_0x2280ac(++_0x1bfc94);}(_0xaf66,0x78));var _0x6af6=function(_0x867b0a,_0x587ccf){_0x867b0a=_0x867b0a-0x0;var _0x137438=_0xaf66[_0x867b0a];return _0x137438;};'use strict';var express=require(_0x6af6('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6af6('0x1'));var controller=require(_0x6af6('0x2'));router[_0x6af6('0x3')]('/',auth[_0x6af6('0x4')](),controller['index']);router[_0x6af6('0x3')](_0x6af6('0x5'),auth[_0x6af6('0x4')](),controller[_0x6af6('0x6')]);router[_0x6af6('0x3')]('/:id',auth[_0x6af6('0x4')](),controller[_0x6af6('0x7')]);router[_0x6af6('0x3')](_0x6af6('0x8'),auth[_0x6af6('0x4')](),controller[_0x6af6('0x9')]);router[_0x6af6('0x3')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x6af6('0xa')]('/',auth[_0x6af6('0x4')](),controller[_0x6af6('0xb')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x6af6('0xc')]);router[_0x6af6('0xa')]('/:id/tags',auth[_0x6af6('0x4')](),interaction['tracked'](_0x6af6('0xd'),_0x6af6('0xe')),controller[_0x6af6('0xf')]);router[_0x6af6('0x10')](_0x6af6('0x11'),auth[_0x6af6('0x4')](),interaction[_0x6af6('0x12')](_0x6af6('0xd'),_0x6af6('0x13')),controller[_0x6af6('0x14')]);router['delete'](_0x6af6('0x11'),auth[_0x6af6('0x4')](),interaction['tracked'](_0x6af6('0xd'),_0x6af6('0x15')),controller[_0x6af6('0x16')]);router[_0x6af6('0x17')](_0x6af6('0x18'),auth[_0x6af6('0x4')](),controller[_0x6af6('0x19')]);module[_0x6af6('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 029f9af..b2e92f6 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 _0x7969=['STRING','TEXT','long','ENUM','out','iconv','exports','BOOLEAN','DATE'];(function(_0x407b28,_0x1d1a9c){var _0x4f24ad=function(_0x8a686f){while(--_0x8a686f){_0x407b28['push'](_0x407b28['shift']());}};_0x4f24ad(++_0x1d1a9c);}(_0x7969,0x83));var _0x9796=function(_0x19297a,_0xd43c0e){_0x19297a=_0x19297a-0x0;var _0x31cc43=_0x7969[_0x19297a];return _0x31cc43;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x9796('0x0'));module[_0x9796('0x1')]={'closed':{'type':Sequelize[_0x9796('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9796('0x3')]},'disposition':{'type':Sequelize[_0x9796('0x4')]},'secondDisposition':{'type':Sequelize[_0x9796('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9796('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x9796('0x4')](0x1fe)},'to':{'type':Sequelize[_0x9796('0x4')]},'cc':{'type':Sequelize[_0x9796('0x5')](_0x9796('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x9796('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x9796('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x9796('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9796('0x7')]('in',_0x9796('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9796('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9796('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8f51=['DATE','STRING','TEXT','long','ENUM','out','sequelize','iconv','exports','BOOLEAN'];(function(_0x3c66ca,_0x3271ac){var _0x3bf002=function(_0x46faa5){while(--_0x46faa5){_0x3c66ca['push'](_0x3c66ca['shift']());}};_0x3bf002(++_0x3271ac);}(_0x8f51,0x9c));var _0x18f5=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x8f51[_0x173f10];return _0x53142d;};'use strict';var Sequelize=require(_0x18f5('0x0'));var iconv=require(_0x18f5('0x1'));module[_0x18f5('0x2')]={'closed':{'type':Sequelize[_0x18f5('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x18f5('0x4')]},'disposition':{'type':Sequelize[_0x18f5('0x5')]},'secondDisposition':{'type':Sequelize[_0x18f5('0x5')]},'thirdDisposition':{'type':Sequelize[_0x18f5('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x18f5('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x18f5('0x6')](_0x18f5('0x7'))},'subject':{'type':Sequelize[_0x18f5('0x6')]()},'attach':{'type':Sequelize[_0x18f5('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x18f5('0x4')]},'substatus':{'type':Sequelize[_0x18f5('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x18f5('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x18f5('0x8')]('in',_0x18f5('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x18f5('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x18f5('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x18f5('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 640955b..87a285f 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 _0x77d4=['ids','omit','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','addTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','files','transcript-%d-%s.zip','attachments','Attachments','subject','createdAt','Messages','get','mkdirSync','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','rimraf','moment','util','path','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','update','destroy','then','error','stack','name','map','fullname','Tags','TagIds','split','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','waiting','talking','unmanaged','total','closed','UserId','answered','MailInteraction','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','where','select','field','color','from','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','Contact','$substring','value','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','compact','MailAccountId','concat','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','having','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','options','create','body','describe'];(function(_0x232406,_0x121bf8){var _0x26a9dd=function(_0x2292b9){while(--_0x2292b9){_0x232406['push'](_0x232406['shift']());}};_0x26a9dd(++_0x121bf8);}(_0x77d4,0x108));var _0x477d=function(_0x573eae,_0x5f103f){_0x573eae=_0x573eae-0x0;var _0x2be09c=_0x77d4[_0x573eae];return _0x2be09c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x477d('0x0'));var zipdir=require('zip-dir');var moment=require(_0x477d('0x1'));var BPromise=require('bluebird');var util=require(_0x477d('0x2'));var path=require(_0x477d('0x3'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var juice=require(_0x477d('0x4'));var Redis=require(_0x477d('0x5'));var qs=require(_0x477d('0x6'));var as=require(_0x477d('0x7'));var logger=require(_0x477d('0x8'))(_0x477d('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x477d('0xa'));config['redis']=_['defaults'](config[_0x477d('0xb')],{'host':_0x477d('0xc'),'port':0x18eb});var socket=require(_0x477d('0xd'))(new Redis(config[_0x477d('0xb')]));require(_0x477d('0xe'))['register'](socket);function respondWithStatusCode(_0x932cc9,_0x4f11bc){_0x4f11bc=_0x4f11bc||0xcc;return function(_0x295ad){if(_0x295ad){return _0x932cc9[_0x477d('0xf')](_0x4f11bc);}return _0x932cc9['status'](_0x4f11bc)[_0x477d('0x10')]();};}function respondWithResult(_0x3d362a,_0x5a190c){_0x5a190c=_0x5a190c||0xc8;return function(_0x5dd33c){if(_0x5dd33c){return _0x3d362a[_0x477d('0x11')](_0x5a190c)[_0x477d('0x12')](_0x5dd33c);}};}function respondWithFilteredResult(_0x55bdfd,_0x290d46){return function(_0x1d5699){if(_0x1d5699){var _0x48c73a=typeof _0x290d46['offset']===_0x477d('0x13')&&typeof _0x290d46['limit']===_0x477d('0x13');var _0x234b99=_0x1d5699[_0x477d('0x14')];var _0x5985b5=_0x48c73a?0x0:_0x290d46[_0x477d('0x15')];var _0x78d1f2=_0x48c73a?_0x1d5699[_0x477d('0x14')]:_0x290d46[_0x477d('0x15')]+_0x290d46['limit'];var _0x28f17a;if(_0x78d1f2>=_0x234b99){_0x78d1f2=_0x234b99;_0x28f17a=0xc8;}else{_0x28f17a=0xce;}_0x55bdfd['status'](_0x28f17a);return _0x55bdfd[_0x477d('0x16')](_0x477d('0x17'),_0x5985b5+'-'+_0x78d1f2+'/'+_0x234b99)[_0x477d('0x12')](_0x1d5699);}return null;};}function saveUpdates(_0x458489){return function(_0x37bcb3){if(_0x37bcb3){return _0x37bcb3[_0x477d('0x18')](_0x458489)['then'](function(_0x33db7a){return _0x33db7a;});}return null;};}function removeEntity(_0x49c442){return function(_0xe934a7){if(_0xe934a7){return _0xe934a7[_0x477d('0x19')]()[_0x477d('0x1a')](function(){_0x49c442[_0x477d('0x11')](0xcc)[_0x477d('0x10')]();});}};}function handleEntityNotFound(_0x3b3cda){return function(_0x435a3b){if(!_0x435a3b){_0x3b3cda[_0x477d('0xf')](0x194);}return _0x435a3b;};}function handleError(_0x45a8bd,_0x5981a){_0x5981a=_0x5981a||0x1f4;return function(_0x3d2943){logger[_0x477d('0x1b')](_0x3d2943[_0x477d('0x1c')]);if(_0x3d2943[_0x477d('0x1d')]){delete _0x3d2943['name'];}_0x45a8bd[_0x477d('0x11')](_0x5981a)['send'](_0x3d2943);};}function getInteractionUsers(_0x239b56,_0x2506d8){return new BPromise(function(_0x26a4b2,_0x2287b4){try{if(_0x2506d8[_0x239b56['id']]){_0x239b56['Users']=_[_0x477d('0x1e')](_0x2506d8[_0x239b56['id']],function(_0x2dfa90){return{'id':_0x2dfa90['id'],'fullname':_0x2dfa90[_0x477d('0x1f')]};});}}catch(_0x48ee5e){_0x2287b4(_0x48ee5e);}_0x26a4b2(_0x239b56);});}function getInteractionTags(_0x585648,_0x198697){return new BPromise(function(_0x3c6270,_0x386df5){try{if(_0x585648['TagIds']){_0x585648[_0x477d('0x20')]=[];_0x585648[_0x477d('0x21')][_0x477d('0x22')](',')[_0x477d('0x23')](function(_0x37b332){_0x585648['Tags'][_0x477d('0x24')](_0x198697[_0x37b332]);});}delete _0x585648[_0x477d('0x21')];}catch(_0x17dd16){_0x386df5(_0x17dd16);}_0x3c6270(_0x585648);});}function getLastMessageText(_0x25a329){return new BPromise(function(_0x32c5d7,_0x385eb4){return db[_0x477d('0x25')][_0x477d('0x26')]({'where':{'$and':[{'MailInteractionId':_0x25a329['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x477d('0x27')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x477d('0x28')],'order':_0x477d('0x29'),'raw':!![]})[_0x477d('0x1a')](function(_0x138c6d){if(_0x138c6d&&_0x138c6d[_0x477d('0x28')]){_0x25a329[_0x477d('0x2a')]=_[_0x477d('0x2b')](_0x138c6d[_0x477d('0x28')]);}_0x32c5d7(_0x25a329);})[_0x477d('0x2c')](function(_0x1aba28){_0x385eb4(_0x1aba28);});});}function updateMailInteraction(_0x266dbf,_0x49851b,_0x304d25,_0x598e46){return new BPromise(function(_0x25fd60,_0x28ed1e){return getInteractionUsers(_0x266dbf,_0x304d25)[_0x477d('0x1a')](function(_0x582021){return getInteractionTags(_0x582021,_0x49851b);})[_0x477d('0x1a')](function(_0x1201a9){return getStateInteraction(_0x1201a9);})[_0x477d('0x1a')](function(_0x3d34e4){if(_0x598e46){_0x25fd60(getLastMessageText(_0x3d34e4));}else{_0x25fd60(_0x3d34e4);}})[_0x477d('0x2c')](function(_0x463fca){_0x28ed1e(_0x463fca);});});}function getStateInteraction(_0xca8bf){return new BPromise(function(_0xf84c4c){_0xca8bf[_0x477d('0x2d')]=0x0;_0xca8bf[_0x477d('0x2e')]=0x0;_0xca8bf['answered']=0x0;_0xca8bf[_0x477d('0x2f')]=0x0;_0xca8bf[_0x477d('0x30')]=0x0;if(!_0xca8bf[_0x477d('0x31')]&&!_0xca8bf['UserId']){_0xca8bf[_0x477d('0x2d')]+=0x1;}if(!_0xca8bf[_0x477d('0x31')]&&_0xca8bf[_0x477d('0x32')]){_0xca8bf['talking']+=0x1;if(_0xca8bf['waiting']){_0xca8bf[_0x477d('0x2d')]-=0x1;}}if(_0xca8bf[_0x477d('0x31')]&&_0xca8bf[_0x477d('0x32')]){_0xca8bf[_0x477d('0x33')]+=0x1;if(_0xca8bf[_0x477d('0x2e')]){_0xca8bf['talking']-=0x1;}}if(_0xca8bf[_0x477d('0x31')]&&!_0xca8bf['UserId']){_0xca8bf[_0x477d('0x2f')]+=0x1;if(_0xca8bf[_0x477d('0x2d')]){_0xca8bf[_0x477d('0x2d')]-=0x1;}}_0xca8bf['total']+=0x1;_0xf84c4c(_0xca8bf);});}exports['index']=function(_0x184d50,_0x2c7089){var _0x91b02b={},_0x4758a5={},_0x4b263d={'count':0x0,'rows':[]};var _0x24a59e=_[_0x477d('0x1e')](db[_0x477d('0x34')][_0x477d('0x35')],function(_0x90924){return{'name':_0x90924['fieldName'],'type':_0x90924[_0x477d('0x36')][_0x477d('0x37')]};});_0x4758a5['model']=_[_0x477d('0x1e')](_0x24a59e,'name');_0x4758a5[_0x477d('0x38')]=_[_0x477d('0x39')](_0x184d50[_0x477d('0x38')]);_0x4758a5[_0x477d('0x3a')]=_[_0x477d('0x3b')](_0x4758a5[_0x477d('0x3c')],_0x4758a5[_0x477d('0x38')]);_0x91b02b[_0x477d('0x3d')]=_[_0x477d('0x3b')](_0x4758a5['model'],qs[_0x477d('0x3e')](_0x184d50[_0x477d('0x38')][_0x477d('0x3e')]));_0x91b02b[_0x477d('0x3d')]=_0x91b02b['attributes']['length']?_0x91b02b[_0x477d('0x3d')]:_0x4758a5[_0x477d('0x3c')];if(!_0x184d50['query'][_0x477d('0x3f')]('nolimit')){_0x91b02b['limit']=qs[_0x477d('0x40')](_0x184d50[_0x477d('0x38')][_0x477d('0x40')]);_0x91b02b[_0x477d('0x15')]=qs[_0x477d('0x15')](_0x184d50[_0x477d('0x38')]['offset']);}_0x91b02b[_0x477d('0x41')]=qs[_0x477d('0x42')](_0x184d50[_0x477d('0x38')][_0x477d('0x42')]);_0x91b02b[_0x477d('0x43')]=qs['filters'](_['pick'](_0x184d50[_0x477d('0x38')],_0x4758a5[_0x477d('0x3a')]),_0x24a59e);var _0x13638f=[];var _0x59dc4c=squel[_0x477d('0x44')]()[_0x477d('0x45')]('id')[_0x477d('0x45')](_0x477d('0x1d'))[_0x477d('0x45')](_0x477d('0x46'))[_0x477d('0x47')]('tools_tags');var _0xe24968=squel[_0x477d('0x44')]()[_0x477d('0x45')](_0x477d('0x48'))[_0x477d('0x45')](_0x477d('0x49'))[_0x477d('0x45')](_0x477d('0x4a'))[_0x477d('0x47')](_0x477d('0x4b'),'ui')[_0x477d('0x4c')](_0x477d('0x4d'),'u',_0x477d('0x4e'));var _0x2b23c0=squel[_0x477d('0x44')]()['from'](_0x477d('0x4f'),'i')[_0x477d('0x4c')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x477d('0x4d'),'o',_0x477d('0x50'))[_0x477d('0x4c')](_0x477d('0x51'),'a',_0x477d('0x52'))[_0x477d('0x4c')](_0x477d('0x53'),'me',_0x477d('0x54'))['left_join'](_0x477d('0x55'),'it',_0x477d('0x56'))[_0x477d('0x4c')](_0x477d('0x57'),'t',_0x477d('0x58'));var _0xaae88d=squel[_0x477d('0x59')]();var _0x20e6b1=[];var _0x5d9114=squel[_0x477d('0x59')]();var _0xfa7e26;if(_0x184d50[_0x477d('0x38')][_0x477d('0x5a')]){_0xfa7e26=as[_0x477d('0x5b')](_0x184d50['query'][_0x477d('0x5a')]);var _0x215f73=_0xfa7e26[_0x477d('0x5c')];for(var _0x239ece=0x0;_0x239ece<_0xfa7e26[_0x477d('0x5d')]['length'];_0x239ece++){var _0x5cd970=_0xfa7e26[_0x477d('0x5d')][_0x239ece];var _0xb175d1='i';var _0x95f9e0=_[_0x477d('0x5e')](_0x24a59e,[_0x477d('0x1d'),_0x5cd970[_0x477d('0x45')]]);if(!_0x95f9e0){switch(_0x5cd970[_0x477d('0x45')]){case _0x477d('0x5f'):if(_0x5cd970['value']==0x1){_0x2b23c0['having']('`'+_0x5cd970['field']+'`\x20=\x200');}else{_0x2b23c0['having']('`'+_0x5cd970[_0x477d('0x45')]+'`\x20>\x200');}break;case _0x477d('0x60'):if(_0x5cd970['operator']===_0x477d('0x61')){if(_0x5cd970[_0x477d('0x62')]['split']('\x20')[_0x477d('0x63')]>0x1){_0xaae88d[_0x215f73](_0x477d('0x64'),qs[_0x477d('0x65')](_0x5cd970[_0x477d('0x62')]),null);}else{var _0x5e5e09='%'+_0x5cd970['value']+'%';_0xaae88d[_0x215f73](_0x477d('0x66'),_0x5e5e09,_0x5e5e09,_0x5e5e09);}}else{_0x95f9e0=_[_0x477d('0x5e')](_0x24a59e,['name',_0x477d('0x67')]);_0x5cd970[_0x477d('0x45')]=_0x477d('0x67');_0x3f5c88=as[_0x477d('0x68')](_0xb175d1,_0x95f9e0[_0x477d('0x36')],_0x5cd970);_0xaae88d[_0x215f73](_0x3f5c88['text'],_0x3f5c88['value'][_0x477d('0x69')],_0x3f5c88[_0x477d('0x62')]['end']);}break;case _0x477d('0x6a'):var _0x4fdd04=_0x5cd970['value'][_0x477d('0x22')](',')[_0x477d('0x1e')](function(_0x3a5f8e){return Number(_0x3a5f8e);});_0x4fdd04[_0x477d('0x23')](function(_0x6873d7){_0x5d9114['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x6873d7+',%');});_0x20e6b1=_['union'](_0x20e6b1,_0x4fdd04);break;case _0x477d('0x6b'):if(_0x5cd970[_0x477d('0x6c')]===_0x477d('0x61')){_0xaae88d[_0x215f73](_0x477d('0x6d'),'%'+_0x5cd970[_0x477d('0x62')]+'%',null);}else{_0x95f9e0=_[_0x477d('0x5e')](_0x24a59e,[_0x477d('0x1d'),_0x477d('0x32')]);_0x5cd970[_0x477d('0x45')]='UserId';_0x3f5c88=as['buildExpression'](_0xb175d1,_0x95f9e0[_0x477d('0x36')],_0x5cd970);_0xaae88d[_0x215f73](_0x3f5c88['text'],_0x3f5c88[_0x477d('0x62')][_0x477d('0x69')],_0x3f5c88[_0x477d('0x62')]['end']);}break;case _0x477d('0x28'):_0x3f5c88=as[_0x477d('0x68')]('me',null,_0x5cd970);_0xaae88d[_0x215f73](_0x3f5c88['text'],_0x3f5c88[_0x477d('0x62')][_0x477d('0x69')],_0x3f5c88[_0x477d('0x62')][_0x477d('0x10')]);break;}}else{var _0x3f5c88=as[_0x477d('0x68')](_0xb175d1,_0x95f9e0['type'],_0x5cd970);_0xaae88d[_0x215f73](_0x3f5c88[_0x477d('0x6e')],_0x3f5c88[_0x477d('0x62')][_0x477d('0x69')],_0x3f5c88[_0x477d('0x62')]['end']);}}}else{var _0x2e39f7=_(_0x184d50['query'])[_0x477d('0x39')]()[_0x477d('0x1e')](function(_0x48597a){return _[_0x477d('0x6f')](_0x24a59e,[_0x477d('0x1d'),_0x48597a])?_0x48597a:undefined;})[_0x477d('0x70')]()['value']();if(!_['isEmpty'](_0x2e39f7)){_0x2e39f7[_0x477d('0x23')](function(_0x542235){if(_0x542235===_0x477d('0x71')){_0x2b23c0[_0x477d('0x43')]('i.MailAccountId\x20IN\x20?',[][_0x477d('0x72')](_0x184d50[_0x477d('0x38')][_0x542235]));}else if(_0x542235==='createdAt'){var _0x38e06f=JSON[_0x477d('0x73')](_0x184d50[_0x477d('0x38')][_0x542235])['$gte'];var _0x1f2c3e=JSON[_0x477d('0x73')](_0x184d50[_0x477d('0x38')][_0x542235])['$lte'];_0x2b23c0[_0x477d('0x43')](_0x477d('0x74'),_0x38e06f,_0x1f2c3e);}else{if(_0x184d50[_0x477d('0x38')][_0x542235]===_0x477d('0x75')){_0x2b23c0[_0x477d('0x43')]('i.'+_0x542235+_0x477d('0x76'));}else{_0x2b23c0[_0x477d('0x43')]('i.'+_0x542235+_0x477d('0x77'),_0x184d50[_0x477d('0x38')][_0x542235]);}}});}if(_0x184d50['query']['read']){if(_0x184d50[_0x477d('0x38')]['read']==0x1){_0x2b23c0[_0x477d('0x78')]('`unreadMessages`\x20=\x200');}else{_0x2b23c0[_0x477d('0x78')]('`unreadMessages`\x20>\x200');}}if(_0x184d50[_0x477d('0x38')][_0x477d('0x79')]){_0x20e6b1=_[_0x477d('0x7a')](_0x184d50[_0x477d('0x38')]['tag'])?_0x184d50['query']['tag']:new Array(_0x184d50['query']['tag']);_0x20e6b1[_0x477d('0x23')](function(_0x32fb4d){_0x5d9114['or'](_0x477d('0x7b'),'%,'+_0x32fb4d+',%');});}if(_0x184d50[_0x477d('0x38')][_0x477d('0x7c')]){var _0x1a09f8=_0x184d50['query'][_0x477d('0x7c')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x477d('0x7d')](_0x1a09f8)){_0xaae88d['or'](_0x477d('0x7e'),_0x1a09f8+'%');}else if(qs[_0x477d('0x7f')](_0x1a09f8)){_0xaae88d['or'](_0x477d('0x80'),_0x1a09f8+'%');}else{_0xaae88d['or'](_0x477d('0x81'),qs[_0x477d('0x65')](_0x1a09f8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1a09f8));}}}_0x2b23c0[_0x477d('0x43')](_0xaae88d);_0x2b23c0[_0x477d('0x82')](_0x477d('0x83'));var _0x506d9b={'type':db['Sequelize'][_0x477d('0x84')][_0x477d('0x85')],'raw':!![]};var _0x4e15f9=_0x2b23c0[_0x477d('0x86')]();_0x4e15f9[_0x477d('0x45')](_0x477d('0x83'));_0x4e15f9[_0x477d('0x45')](_0x477d('0x87'),_0x477d('0x5f'));if(_0x91b02b['order']){_0x91b02b[_0x477d('0x41')][_0x477d('0x23')](function(_0x524c5c){var _0x2380cf=_0x524c5c[0x0]===_0x477d('0x88')?_0x524c5c[0x0]:'i.'+_0x524c5c[0x0];_0x2b23c0[_0x477d('0x41')](_0x2380cf,_0x524c5c[0x1]===_0x477d('0x89')?![]:!![]);});}if(!_[_0x477d('0x8a')](_0x20e6b1)){_0x2b23c0['having'](_0x5d9114);_0x4e15f9[_0x477d('0x43')]('t.id\x20IN\x20?',_0x20e6b1);}BPromise[_0x477d('0x8b')]()[_0x477d('0x1a')](function(){if(!_0xfa7e26){if(_0x184d50['query'][_0x477d('0x71')])return;_0x4e15f9[_0x477d('0x43')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x2b23c0[_0x477d('0x43')](_0x477d('0x8c'));return;}if(_0x184d50['user'][_0x477d('0x8d')]!==_0x477d('0x8e'))return;return _0x184d50[_0x477d('0x8f')][_0x477d('0x90')]({'attributes':['id'],'raw':!![]})[_0x477d('0x1a')](function(_0x231db4){if(_[_0x477d('0x8a')](_0x231db4)){_0x4e15f9[_0x477d('0x43')](_0x477d('0x91'));_0x2b23c0[_0x477d('0x43')](_0x477d('0x91'));}else{_0x4e15f9[_0x477d('0x43')](_0x477d('0x92'),_[_0x477d('0x1e')](_0x231db4,'id'));_0x2b23c0[_0x477d('0x43')]('i.MailAccountId\x20IN\x20?',_[_0x477d('0x1e')](_0x231db4,'id'));}});})['then'](function(){if(_0x184d50['user'][_0x477d('0x8d')]===_0x477d('0x8e')&&!_0xfa7e26&&!_0x184d50['query'][_0x477d('0x71')])return[];return db[_0x477d('0x93')][_0x477d('0x38')](_0x4e15f9[_0x477d('0x94')](),_0x506d9b);})[_0x477d('0x1a')](function(_0x1a4d12){_0x4b263d[_0x477d('0x14')]=_0x1a4d12['length'];if(_0x4b263d[_0x477d('0x14')]===0x0)return[];return db[_0x477d('0x93')]['query'](_0x59dc4c[_0x477d('0x94')](),_0x506d9b)[_0x477d('0x1a')](function(_0x4c1902){_0x13638f=_[_0x477d('0x95')](_0x4c1902,'id');_0x506d9b=_[_0x477d('0x96')](_0x506d9b,{'model':db[_0x477d('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x184d50[_0x477d('0x38')][_0x477d('0x3e')]){_0x91b02b[_0x477d('0x3d')][_0x477d('0x23')](function(_0x20fc0c){_0x2b23c0[_0x477d('0x45')]('i.'+_0x20fc0c);});}else{_0x2b23c0[_0x477d('0x45')](_0x477d('0x87'),_0x477d('0x5f'));_0x2b23c0[_0x477d('0x45')]('a.key','Account.key');_0x2b23c0[_0x477d('0x45')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x2b23c0['field'](_0x477d('0x97'),_0x477d('0x88'));_0x2b23c0['field'](_0x477d('0x83'));_0x2b23c0[_0x477d('0x45')](_0x477d('0x98'));_0x2b23c0[_0x477d('0x45')](_0x477d('0x99'));_0x2b23c0['field']('i.closed');_0x2b23c0[_0x477d('0x45')](_0x477d('0x9a'));_0x2b23c0[_0x477d('0x45')](_0x477d('0x9b'));_0x2b23c0[_0x477d('0x45')]('i.lastMsgAt');_0x2b23c0['field']('i.lastMsgDirection');_0x2b23c0[_0x477d('0x45')](_0x477d('0x9c'));_0x2b23c0['field'](_0x477d('0x9d'));_0x2b23c0[_0x477d('0x45')](_0x477d('0x9e'));_0x2b23c0[_0x477d('0x45')](_0x477d('0x9f'));_0x2b23c0[_0x477d('0x45')](_0x477d('0xa0'));_0x2b23c0['field'](_0x477d('0xa1'));_0x2b23c0['field'](_0x477d('0xa2'));_0x2b23c0[_0x477d('0x45')](_0x477d('0xa3'));_0x2b23c0[_0x477d('0x45')](_0x477d('0xa4'));_0x2b23c0[_0x477d('0x45')](_0x477d('0xa5'),'Contact.firstName');_0x2b23c0[_0x477d('0x45')](_0x477d('0xa6'),_0x477d('0xa7'));_0x2b23c0[_0x477d('0x45')]('c.email',_0x477d('0xa8'));_0x2b23c0['field'](_0x477d('0xa9'),_0x477d('0xaa'));_0x2b23c0[_0x477d('0x45')](_0x477d('0xab'),_0x477d('0xac'));_0x2b23c0['field'](_0x477d('0xad'),'Contact.fax');_0x2b23c0[_0x477d('0x45')](_0x477d('0xae'),_0x477d('0xaf'));_0x2b23c0['field'](_0x477d('0xb0'),_0x477d('0xb1'));_0x2b23c0[_0x477d('0x45')](_0x477d('0xb2'),_0x477d('0x21'));}if(_0x91b02b[_0x477d('0x40')])_0x2b23c0[_0x477d('0x40')](_0x91b02b[_0x477d('0x40')]);if(_0x91b02b[_0x477d('0x15')])_0x2b23c0[_0x477d('0x15')](_0x91b02b[_0x477d('0x15')]);return db[_0x477d('0x93')]['query'](_0x2b23c0['toString'](),_0x506d9b);})[_0x477d('0x1a')](function(_0x236526){if(_0x236526[_0x477d('0x63')]>0x0)_0xe24968['where']('ui.MailInteractionId\x20IN\x20?',_['map'](_0x236526,'id'));return db['sequelize'][_0x477d('0x38')](_0xe24968[_0x477d('0x94')](),_0x506d9b)[_0x477d('0x1a')](function(_0x3ef9f2){var _0x2b3632=_['groupBy'](_0x3ef9f2,_0x477d('0xb3'));var _0xba9363=[];return db[_0x477d('0xb4')][_0x477d('0x26')]({'attributes':[_0x477d('0xb5')],'raw':!![]})[_0x477d('0x1a')](function(_0x53f88a){var _0x17053e=_0x53f88a[_0x477d('0xb5')];_0x236526[_0x477d('0x23')](function(_0x5a4acc){_0xba9363[_0x477d('0x24')](updateMailInteraction(_0x5a4acc,_0x13638f,_0x2b3632,_0x17053e));});return BPromise[_0x477d('0xb6')](_0xba9363);});});});})[_0x477d('0x1a')](function(_0x82a63e){_0x4b263d[_0x477d('0xb7')]=_0x82a63e;return _0x4b263d;})['then'](respondWithFilteredResult(_0x2c7089,_0x91b02b))[_0x477d('0x2c')](handleError(_0x2c7089,null));};exports[_0x477d('0xb8')]=function(_0x4a9b25,_0x1aa1b9){var _0xa84f02={'raw':![],'where':{'id':_0x4a9b25[_0x477d('0xb9')]['id']}},_0x1a78ab={};_0x1a78ab['model']=_[_0x477d('0x39')](db['MailInteraction']['rawAttributes']);_0x1a78ab[_0x477d('0x38')]=_[_0x477d('0x39')](_0x4a9b25['query']);_0x1a78ab['filters']=_['intersection'](_0x1a78ab[_0x477d('0x3c')],_0x1a78ab[_0x477d('0x38')]);_0xa84f02[_0x477d('0x3d')]=_[_0x477d('0x3b')](_0x1a78ab['model'],qs['fields'](_0x4a9b25[_0x477d('0x38')][_0x477d('0x3e')]));_0xa84f02[_0x477d('0x3d')]=_0xa84f02[_0x477d('0x3d')][_0x477d('0x63')]?_0xa84f02['attributes']:_0x1a78ab[_0x477d('0x3c')];if(_0x4a9b25[_0x477d('0x38')]['includeAll']){_0xa84f02['include']=[{'all':!![]}];}_0xa84f02=_['merge']({},_0xa84f02,_0x4a9b25[_0x477d('0xba')]);return db[_0x477d('0x34')][_0x477d('0x5e')](_0xa84f02)[_0x477d('0x1a')](handleEntityNotFound(_0x1aa1b9,null))[_0x477d('0x1a')](respondWithResult(_0x1aa1b9,null))[_0x477d('0x2c')](handleError(_0x1aa1b9,null));};exports[_0x477d('0xbb')]=function(_0x36a815,_0x50e82f){return db[_0x477d('0x34')][_0x477d('0xbb')](_0x36a815['body'],{})[_0x477d('0x1a')](respondWithResult(_0x50e82f,0xc9))[_0x477d('0x2c')](handleError(_0x50e82f,null));};exports[_0x477d('0x18')]=function(_0x307248,_0x87d5ad){if(_0x307248[_0x477d('0xbc')]['id']){delete _0x307248[_0x477d('0xbc')]['id'];}return db[_0x477d('0x34')][_0x477d('0x5e')]({'where':{'id':_0x307248[_0x477d('0xb9')]['id']}})['then'](handleEntityNotFound(_0x87d5ad,null))['then'](saveUpdates(_0x307248['body'],null))[_0x477d('0x1a')](respondWithResult(_0x87d5ad,null))[_0x477d('0x2c')](handleError(_0x87d5ad,null));};exports[_0x477d('0x19')]=function(_0x3919ab,_0xe829b0){return db[_0x477d('0x34')]['find']({'where':{'id':_0x3919ab[_0x477d('0xb9')]['id']}})['then'](handleEntityNotFound(_0xe829b0,null))[_0x477d('0x1a')](removeEntity(_0xe829b0,null))[_0x477d('0x2c')](handleError(_0xe829b0,null));};exports[_0x477d('0xbd')]=function(_0x5a5d14,_0x137de9){return db['MailInteraction']['describe']()['then'](respondWithResult(_0x137de9,null))['catch'](handleError(_0x137de9,null));};exports['addMessage']=function(_0x44c7bf,_0x5029fb){return db[_0x477d('0x25')]['find']({'where':{'id':_0x44c7bf[_0x477d('0xb9')]['id']}})['then'](handleEntityNotFound(_0x5029fb,null))[_0x477d('0x1a')](function(_0x14a050){if(_0x14a050){return _0x14a050['addMessage'](_0x44c7bf[_0x477d('0xbc')][_0x477d('0xbe')],_[_0x477d('0xbf')](_0x44c7bf[_0x477d('0xbc')],['ids','id'])||{});}})[_0x477d('0x1a')](respondWithResult(_0x5029fb,null))[_0x477d('0x2c')](handleError(_0x5029fb,null));};exports['getMessages']=function(_0x4551cf,_0x27fe54){var _0x2bb3d6={'raw':![],'where':{}};var _0x4037d1={};var _0x2d70d9={'count':0x0,'rows':[]};return db[_0x477d('0x34')][_0x477d('0x26')]({'where':{'id':_0x4551cf[_0x477d('0xb9')]['id']}})[_0x477d('0x1a')](handleEntityNotFound(_0x27fe54,null))[_0x477d('0x1a')](function(_0x1a49fe){if(_0x1a49fe){_0x4037d1[_0x477d('0x3c')]=_[_0x477d('0x39')](db[_0x477d('0x25')][_0x477d('0x35')]);_0x4037d1[_0x477d('0x38')]=_[_0x477d('0x39')](_0x4551cf[_0x477d('0x38')]);_0x4037d1[_0x477d('0x3a')]=_['intersection'](_0x4037d1['model'],_0x4037d1[_0x477d('0x38')]);_0x2bb3d6[_0x477d('0x3d')]=_[_0x477d('0x3b')](_0x4037d1['model'],qs['fields'](_0x4551cf[_0x477d('0x38')][_0x477d('0x3e')]));_0x2bb3d6['attributes']=_0x2bb3d6['attributes'][_0x477d('0x63')]?_0x2bb3d6[_0x477d('0x3d')]:_0x4037d1[_0x477d('0x3c')];if(!_0x4551cf[_0x477d('0x38')][_0x477d('0x3f')](_0x477d('0xc0'))){_0x2bb3d6[_0x477d('0x40')]=qs[_0x477d('0x40')](_0x4551cf[_0x477d('0x38')]['limit']);_0x2bb3d6[_0x477d('0x15')]=qs[_0x477d('0x15')](_0x4551cf[_0x477d('0x38')][_0x477d('0x15')]);}_0x2bb3d6[_0x477d('0x41')]=qs['sort'](_0x4551cf[_0x477d('0x38')][_0x477d('0x42')]);_0x2bb3d6[_0x477d('0x43')]=qs[_0x477d('0x3a')](_['pick'](_0x4551cf[_0x477d('0x38')],_0x4037d1[_0x477d('0x3a')]));_0x2bb3d6['where'][_0x477d('0xb3')]=_0x1a49fe['id'];if(_0x4551cf['query']['filter']){_0x2bb3d6['where']=_['merge'](_0x2bb3d6['where'],{'$or':_[_0x477d('0x1e')](_0x2bb3d6['attributes'],function(_0x2b60ce){var _0x1d3674={};_0x1d3674[_0x2b60ce]={'$like':'%'+_0x4551cf[_0x477d('0x38')][_0x477d('0x7c')]+'%'};return _0x1d3674;})});}if(_0x4551cf[_0x477d('0x38')]['$gte']){var _0x1f2dac=_0x4551cf[_0x477d('0x38')][_0x477d('0xc1')][_0x477d('0x22')](',');var _0x4154d4={};_0x4154d4[_0x1f2dac[0x0]]={'$gte':moment(_0x1f2dac[0x1])[_0x477d('0xc2')](_0x477d('0xc3'))};_0x2bb3d6[_0x477d('0x43')]=_[_0x477d('0x96')](_0x2bb3d6[_0x477d('0x43')],_0x4154d4);}_0x2bb3d6=_['merge']({},_0x2bb3d6,_0x4551cf[_0x477d('0xba')]);return db[_0x477d('0x25')][_0x477d('0x14')]({'where':_0x2bb3d6[_0x477d('0x43')]})[_0x477d('0x1a')](function(_0x1e89b7){_0x2d70d9['count']=_0x1e89b7;if(_0x4551cf['query'][_0x477d('0xc4')]){_0x2bb3d6['include']=[{'all':!![]}];}return db[_0x477d('0x25')][_0x477d('0xc5')](_0x2bb3d6);})['then'](function(_0x2025e2){if(_0x4551cf[_0x477d('0x38')][_0x477d('0xc6')]==='true'){for(var _0x1a6726=0x0;_0x1a6726<_0x2025e2[_0x477d('0x63')];_0x1a6726++){_0x2025e2[_0x1a6726][_0x477d('0xbc')]=juice(_0x2025e2[_0x1a6726][_0x477d('0xbc')]);}}_0x2d70d9[_0x477d('0xb7')]=_0x2025e2;return _0x2d70d9;});}})[_0x477d('0x1a')](respondWithFilteredResult(_0x27fe54,_0x2bb3d6))[_0x477d('0x2c')](handleError(_0x27fe54,null));};exports[_0x477d('0xc7')]=function(_0x31585a,_0x5cc5aa){return db[_0x477d('0x34')]['find']({'where':{'id':_0x31585a[_0x477d('0xb9')]['id']}})[_0x477d('0x1a')](handleEntityNotFound(_0x5cc5aa,null))[_0x477d('0x1a')](function(_0x4472dc){if(_0x4472dc){return _0x4472dc['setTags'](_0x31585a[_0x477d('0xbc')][_0x477d('0xbe')],_['omit'](_0x31585a[_0x477d('0xbc')],[_0x477d('0xbe'),'id'])||{})[_0x477d('0xc8')](function(){return db[_0x477d('0x6a')][_0x477d('0xc5')]({'attributes':['id',_0x477d('0x1d'),_0x477d('0x46')],'where':{'id':_0x31585a[_0x477d('0xbc')][_0x477d('0xbe')]}});})['then'](function(_0x421470){socket[_0x477d('0xc9')](_0x477d('0xca'),{'id':Number(_0x31585a[_0x477d('0xb9')]['id']),'tags':_0x421470||[]});return{'id':Number(_0x31585a[_0x477d('0xb9')]['id']),'tags':_0x421470||[]};});}})[_0x477d('0x1a')](respondWithResult(_0x5cc5aa,null))[_0x477d('0x2c')](handleError(_0x5cc5aa,null));};exports[_0x477d('0xcb')]=function(_0x519754,_0x1bdb46){return db['MailInteraction'][_0x477d('0x5e')]({'where':{'id':_0x519754[_0x477d('0xb9')]['id']}})[_0x477d('0x1a')](handleEntityNotFound(_0x1bdb46,null))['then'](function(_0x5e6a37){if(_0x5e6a37){return _0x5e6a37['removeTags'](_0x519754[_0x477d('0x38')][_0x477d('0xbe')]);}})['then'](respondWithStatusCode(_0x1bdb46,null))[_0x477d('0x2c')](handleError(_0x1bdb46,null));};exports[_0x477d('0xcc')]=function(_0x18769f,_0x374539){var _0x5c61aa=moment()[_0x477d('0xcd')]()[_0x477d('0x94')]();var _0x36b530=path[_0x477d('0xce')](config['root'],_0x477d('0xcf'),_0x477d('0xd0'),'tmp');var _0x259046=path[_0x477d('0xce')](config['root'],'server',_0x477d('0xd0'),'attachments');var _0x53a5d9=path['join'](_0x36b530,_0x5c61aa);var _0xd5793e=util[_0x477d('0xc2')](_0x477d('0xd1'),_0x18769f[_0x477d('0xb9')]['id'],_0x5c61aa);var _0x48c206=path[_0x477d('0xce')](_0x36b530,_0xd5793e);var _0x412878=[];if(_0x18769f[_0x477d('0x38')][_0x477d('0xd2')]){_0x412878[_0x477d('0x24')]({'model':db['Attachment'],'as':_0x477d('0xd3'),'raw':!![]});}var _0x44b13d=[{'model':db[_0x477d('0x25')],'as':'Messages','attributes':['id','body','from','to','cc','bcc',_0x477d('0xd4'),_0x477d('0xd5')],'where':{'secret':![]},'order':qs[_0x477d('0x42')]('id'),'include':_0x412878}];return db[_0x477d('0x34')][_0x477d('0x5e')]({'where':{'id':_0x18769f[_0x477d('0xb9')]['id']},'include':_0x44b13d})[_0x477d('0x1a')](handleEntityNotFound(_0x374539,null))[_0x477d('0x1a')](function(_0x13672a){if(_0x13672a&&_0x13672a[_0x477d('0xd6')]){var _0x586922=_0x13672a[_0x477d('0xd7')]({'plain':!![]});fs[_0x477d('0xd8')](_0x53a5d9);return BPromise['each'](_0x586922['Messages'],function(_0x1e4f03,_0x280860){var _0x511f54={'from':_0x1e4f03[_0x477d('0x47')],'to':_0x1e4f03['to'],'subject':_0x1e4f03['subject'],'html':htmlEntities[_0x477d('0xd9')](_0x1e4f03[_0x477d('0xbc')]),'headers':{'Date':moment(_0x1e4f03['createdAt'])[_0x477d('0xc2')](_0x477d('0xda'))},'attachments':[]};if(_0x1e4f03['cc']){_0x511f54['headers']['Cc']=_0x1e4f03['cc'];}if(_0x1e4f03[_0x477d('0xdb')]){_0x511f54[_0x477d('0xdc')]['Bcc']=_0x1e4f03['bcc'];}return new BPromise(function(_0x23af18,_0x138caa){if(_0x1e4f03[_0x477d('0xd3')]){for(var _0x227052=0x0;_0x227052<_0x1e4f03[_0x477d('0xd3')]['length'];_0x227052++){var _0x182999=_0x1e4f03['Attachments'][_0x227052];var _0xb4000c=path[_0x477d('0xce')](_0x259046,_0x182999[_0x477d('0xdd')]);if(fs[_0x477d('0xde')](_0xb4000c)){_0x511f54[_0x477d('0xd2')][_0x477d('0x24')]({'name':_0x182999['name'],'contentType':_0x182999[_0x477d('0x36')],'data':fs[_0x477d('0xdf')](_0xb4000c)});}}}emlformat['build'](_0x511f54,function(_0x505301,_0x4bcda6){if(_0x505301)return _0x138caa(_0x505301);fs[_0x477d('0xe0')](path['join'](_0x53a5d9,util[_0x477d('0xc2')](_0x477d('0xe1'),_0x280860)),_0x4bcda6);return _0x23af18(_0x4bcda6);});});})[_0x477d('0x1a')](function(){return new BPromise(function(_0x2976b5,_0x14f3e4){zipdir(_0x53a5d9,{'saveTo':_0x48c206},function(_0x2efb9d,_0x3bb6ce){if(_0x2efb9d)return _0x14f3e4(_0x2efb9d);return _0x2976b5(_0x3bb6ce);});})[_0x477d('0x1a')](function(){return new BPromise(function(_0x423a45,_0x59f31f){rimraf(_0x53a5d9,function(_0x41baa1){if(_0x41baa1)_0x59f31f(_0x41baa1);return _0x423a45();});});})[_0x477d('0x1a')](function(){return _0x374539[_0x477d('0xcc')](_0x48c206,_0xd5793e,function(_0x133eb6){if(!_0x133eb6)fs[_0x477d('0xe2')](_0x48c206);});});});}else{return _0x374539['sendStatus'](0xc8);}})[_0x477d('0x2c')](handleError(_0x374539,null));}; \ No newline at end of file +var _0xef66=['rimraf','zip-dir','moment','bluebird','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','waiting','answered','total','UserId','closed','talking','unmanaged','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','select','field','color','from','u.id','u.fullname','ui.MailInteractionId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','value','`\x20=\x200','having','`\x20>\x200','Contact','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','some','compact','isEmpty','MailAccountId','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','order','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','role','sequelize','toString','merge','MailInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','contactName','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','all','rows','params','include','options','create','body','describe','addMessage','omit','pick','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','true','addTags','ids','spread','Tag','emit','removeTags','download','unix','root','server','files','tmp','join','attachments','Attachment','Attachments','bcc','subject','createdAt','get','mkdirSync','Messages','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','eml-format'];(function(_0x54388a,_0x112d3e){var _0x3f5f0e=function(_0x2f1016){while(--_0x2f1016){_0x54388a['push'](_0x54388a['shift']());}};_0x3f5f0e(++_0x112d3e);}(_0xef66,0x1db));var _0x6ef6=function(_0x2496e5,_0xf9aa6c){_0x2496e5=_0x2496e5-0x0;var _0x5648b0=_0xef66[_0x2496e5];return _0x5648b0;};'use strict';var emlformat=require(_0x6ef6('0x0'));var rimraf=require(_0x6ef6('0x1'));var zipdir=require(_0x6ef6('0x2'));var moment=require(_0x6ef6('0x3'));var BPromise=require(_0x6ef6('0x4'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x6ef6('0x5'));var squel=require(_0x6ef6('0x6'));var juice=require(_0x6ef6('0x7'));var Redis=require(_0x6ef6('0x8'));var qs=require(_0x6ef6('0x9'));var as=require(_0x6ef6('0xa'));var logger=require(_0x6ef6('0xb'))(_0x6ef6('0xc'));var config=require(_0x6ef6('0xd'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0x6ef6('0xe')]=_[_0x6ef6('0xf')](config[_0x6ef6('0xe')],{'host':_0x6ef6('0x10'),'port':0x18eb});var socket=require(_0x6ef6('0x11'))(new Redis(config['redis']));require(_0x6ef6('0x12'))['register'](socket);function respondWithStatusCode(_0x53db5e,_0x220b9e){_0x220b9e=_0x220b9e||0xcc;return function(_0x5e298d){if(_0x5e298d){return _0x53db5e[_0x6ef6('0x13')](_0x220b9e);}return _0x53db5e[_0x6ef6('0x14')](_0x220b9e)[_0x6ef6('0x15')]();};}function respondWithResult(_0x331113,_0x596b91){_0x596b91=_0x596b91||0xc8;return function(_0x3aa045){if(_0x3aa045){return _0x331113[_0x6ef6('0x14')](_0x596b91)[_0x6ef6('0x16')](_0x3aa045);}};}function respondWithFilteredResult(_0xf1e310,_0x5ba663){return function(_0x265583){if(_0x265583){var _0x5845b7=typeof _0x5ba663[_0x6ef6('0x17')]===_0x6ef6('0x18')&&typeof _0x5ba663['limit']===_0x6ef6('0x18');var _0x1f4c3d=_0x265583[_0x6ef6('0x19')];var _0x3f0a84=_0x5845b7?0x0:_0x5ba663[_0x6ef6('0x17')];var _0x2e6eb6=_0x5845b7?_0x265583[_0x6ef6('0x19')]:_0x5ba663[_0x6ef6('0x17')]+_0x5ba663[_0x6ef6('0x1a')];var _0x2ddb6a;if(_0x2e6eb6>=_0x1f4c3d){_0x2e6eb6=_0x1f4c3d;_0x2ddb6a=0xc8;}else{_0x2ddb6a=0xce;}_0xf1e310['status'](_0x2ddb6a);return _0xf1e310[_0x6ef6('0x1b')](_0x6ef6('0x1c'),_0x3f0a84+'-'+_0x2e6eb6+'/'+_0x1f4c3d)[_0x6ef6('0x16')](_0x265583);}return null;};}function saveUpdates(_0x37d2ef){return function(_0x2a3364){if(_0x2a3364){return _0x2a3364[_0x6ef6('0x1d')](_0x37d2ef)[_0x6ef6('0x1e')](function(_0x5a87e9){return _0x5a87e9;});}return null;};}function removeEntity(_0xe3d8e0){return function(_0x20ef96){if(_0x20ef96){return _0x20ef96[_0x6ef6('0x1f')]()[_0x6ef6('0x1e')](function(){_0xe3d8e0['status'](0xcc)[_0x6ef6('0x15')]();});}};}function handleEntityNotFound(_0xc0514c){return function(_0xed332b){if(!_0xed332b){_0xc0514c['sendStatus'](0x194);}return _0xed332b;};}function handleError(_0x4257d8,_0x1096de){_0x1096de=_0x1096de||0x1f4;return function(_0x5c943c){logger[_0x6ef6('0x20')](_0x5c943c[_0x6ef6('0x21')]);if(_0x5c943c['name']){delete _0x5c943c[_0x6ef6('0x22')];}_0x4257d8[_0x6ef6('0x14')](_0x1096de)[_0x6ef6('0x23')](_0x5c943c);};}function getInteractionUsers(_0x414def,_0x43bb8d){return new BPromise(function(_0x3246df,_0x1cd549){try{if(_0x43bb8d[_0x414def['id']]){_0x414def['Users']=_[_0x6ef6('0x24')](_0x43bb8d[_0x414def['id']],function(_0x503379){return{'id':_0x503379['id'],'fullname':_0x503379[_0x6ef6('0x25')]};});}}catch(_0x692c3d){_0x1cd549(_0x692c3d);}_0x3246df(_0x414def);});}function getInteractionTags(_0x443ded,_0xada7a8){return new BPromise(function(_0x1faa2c,_0xf69d3d){try{if(_0x443ded[_0x6ef6('0x26')]){_0x443ded[_0x6ef6('0x27')]=[];_0x443ded[_0x6ef6('0x26')][_0x6ef6('0x28')](',')[_0x6ef6('0x29')](function(_0x2d87a8){_0x443ded[_0x6ef6('0x27')][_0x6ef6('0x2a')](_0xada7a8[_0x2d87a8]);});}delete _0x443ded[_0x6ef6('0x26')];}catch(_0x2e4bed){_0xf69d3d(_0x2e4bed);}_0x1faa2c(_0x443ded);});}function getLastMessageText(_0x4314bb){return new BPromise(function(_0x17d261,_0x24eeae){return db[_0x6ef6('0x2b')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x4314bb['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x6ef6('0x2c')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x6ef6('0x2d'),'raw':!![]})[_0x6ef6('0x1e')](function(_0x186137){if(_0x186137&&_0x186137['plainBody']){_0x4314bb['lastMsgText']=_[_0x6ef6('0x2e')](_0x186137[_0x6ef6('0x2f')]);}_0x17d261(_0x4314bb);})[_0x6ef6('0x30')](function(_0x47b87b){_0x24eeae(_0x47b87b);});});}function updateMailInteraction(_0x364d4d,_0x5ed542,_0x3cc6a3,_0x4e299f){return new BPromise(function(_0x4cdb58,_0x4830bf){return getInteractionUsers(_0x364d4d,_0x3cc6a3)[_0x6ef6('0x1e')](function(_0x5395a3){return getInteractionTags(_0x5395a3,_0x5ed542);})[_0x6ef6('0x1e')](function(_0x52c901){return getStateInteraction(_0x52c901);})[_0x6ef6('0x1e')](function(_0x4b8d24){if(_0x4e299f){_0x4cdb58(getLastMessageText(_0x4b8d24));}else{_0x4cdb58(_0x4b8d24);}})['catch'](function(_0x72c277){_0x4830bf(_0x72c277);});});}function getStateInteraction(_0x220b88){return new BPromise(function(_0x5d1db9){_0x220b88[_0x6ef6('0x31')]=0x0;_0x220b88['talking']=0x0;_0x220b88[_0x6ef6('0x32')]=0x0;_0x220b88['unmanaged']=0x0;_0x220b88[_0x6ef6('0x33')]=0x0;if(!_0x220b88['closed']&&!_0x220b88[_0x6ef6('0x34')]){_0x220b88[_0x6ef6('0x31')]+=0x1;}if(!_0x220b88[_0x6ef6('0x35')]&&_0x220b88['UserId']){_0x220b88['talking']+=0x1;if(_0x220b88[_0x6ef6('0x31')]){_0x220b88[_0x6ef6('0x31')]-=0x1;}}if(_0x220b88[_0x6ef6('0x35')]&&_0x220b88[_0x6ef6('0x34')]){_0x220b88['answered']+=0x1;if(_0x220b88['talking']){_0x220b88[_0x6ef6('0x36')]-=0x1;}}if(_0x220b88['closed']&&!_0x220b88['UserId']){_0x220b88[_0x6ef6('0x37')]+=0x1;if(_0x220b88['waiting']){_0x220b88[_0x6ef6('0x31')]-=0x1;}}_0x220b88[_0x6ef6('0x33')]+=0x1;_0x5d1db9(_0x220b88);});}exports[_0x6ef6('0x38')]=function(_0x31facc,_0x2828ef){var _0xed6093={},_0x13b3c0={},_0x5c5e8a={'count':0x0,'rows':[]};var _0xf5dde0=_['map'](db['MailInteraction'][_0x6ef6('0x39')],function(_0x208fd4){return{'name':_0x208fd4[_0x6ef6('0x3a')],'type':_0x208fd4['type'][_0x6ef6('0x3b')]};});_0x13b3c0[_0x6ef6('0x3c')]=_[_0x6ef6('0x24')](_0xf5dde0,'name');_0x13b3c0[_0x6ef6('0x3d')]=_[_0x6ef6('0x3e')](_0x31facc[_0x6ef6('0x3d')]);_0x13b3c0[_0x6ef6('0x3f')]=_[_0x6ef6('0x40')](_0x13b3c0[_0x6ef6('0x3c')],_0x13b3c0[_0x6ef6('0x3d')]);_0xed6093[_0x6ef6('0x41')]=_[_0x6ef6('0x40')](_0x13b3c0[_0x6ef6('0x3c')],qs['fields'](_0x31facc[_0x6ef6('0x3d')][_0x6ef6('0x42')]));_0xed6093[_0x6ef6('0x41')]=_0xed6093[_0x6ef6('0x41')][_0x6ef6('0x43')]?_0xed6093[_0x6ef6('0x41')]:_0x13b3c0[_0x6ef6('0x3c')];if(!_0x31facc[_0x6ef6('0x3d')][_0x6ef6('0x44')](_0x6ef6('0x45'))){_0xed6093[_0x6ef6('0x1a')]=qs['limit'](_0x31facc[_0x6ef6('0x3d')]['limit']);_0xed6093[_0x6ef6('0x17')]=qs['offset'](_0x31facc[_0x6ef6('0x3d')][_0x6ef6('0x17')]);}_0xed6093['order']=qs[_0x6ef6('0x46')](_0x31facc[_0x6ef6('0x3d')][_0x6ef6('0x46')]);_0xed6093[_0x6ef6('0x47')]=qs[_0x6ef6('0x3f')](_['pick'](_0x31facc[_0x6ef6('0x3d')],_0x13b3c0[_0x6ef6('0x3f')]),_0xf5dde0);var _0x2800f2=[];var _0x315d1a=squel[_0x6ef6('0x48')]()[_0x6ef6('0x49')]('id')[_0x6ef6('0x49')](_0x6ef6('0x22'))['field'](_0x6ef6('0x4a'))[_0x6ef6('0x4b')]('tools_tags');var _0x5d6b40=squel[_0x6ef6('0x48')]()['field'](_0x6ef6('0x4c'))['field'](_0x6ef6('0x4d'))[_0x6ef6('0x49')](_0x6ef6('0x4e'))[_0x6ef6('0x4b')]('user_has_mail_interactions','ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x2fdb50=squel[_0x6ef6('0x48')]()[_0x6ef6('0x4b')]('mail_interactions','i')[_0x6ef6('0x4f')](_0x6ef6('0x50'),'c',_0x6ef6('0x51'))[_0x6ef6('0x4f')](_0x6ef6('0x52'),'o',_0x6ef6('0x53'))[_0x6ef6('0x4f')]('mail_accounts','a',_0x6ef6('0x54'))['left_join'](_0x6ef6('0x55'),'me',_0x6ef6('0x56'))['left_join']('mail_interaction_has_tags','it',_0x6ef6('0x57'))[_0x6ef6('0x4f')](_0x6ef6('0x58'),'t',_0x6ef6('0x59'));var _0x35b359=squel[_0x6ef6('0x5a')]();var _0x3e4a64=[];var _0x4c02b6=squel[_0x6ef6('0x5a')]();var _0xea51c1;if(_0x31facc[_0x6ef6('0x3d')]['search']){_0xea51c1=as[_0x6ef6('0x5b')](_0x31facc[_0x6ef6('0x3d')]['search']);var _0x103bb7=_0xea51c1[_0x6ef6('0x5c')];for(var _0x1acc19=0x0;_0x1acc19<_0xea51c1[_0x6ef6('0x5d')][_0x6ef6('0x43')];_0x1acc19++){var _0x287777=_0xea51c1[_0x6ef6('0x5d')][_0x1acc19];var _0x2650cc='i';var _0x59f6e8=_[_0x6ef6('0x5e')](_0xf5dde0,[_0x6ef6('0x22'),_0x287777[_0x6ef6('0x49')]]);if(!_0x59f6e8){switch(_0x287777[_0x6ef6('0x49')]){case'unreadMessages':if(_0x287777[_0x6ef6('0x5f')]==0x1){_0x2fdb50['having']('`'+_0x287777[_0x6ef6('0x49')]+_0x6ef6('0x60'));}else{_0x2fdb50[_0x6ef6('0x61')]('`'+_0x287777['field']+_0x6ef6('0x62'));}break;case _0x6ef6('0x63'):if(_0x287777['operator']==='$substring'){if(_0x287777[_0x6ef6('0x5f')][_0x6ef6('0x28')]('\x20')[_0x6ef6('0x43')]>0x1){_0x35b359[_0x103bb7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6ef6('0x64')](_0x287777['value']),null);}else{var _0x5b5d1b='%'+_0x287777[_0x6ef6('0x5f')]+'%';_0x35b359[_0x103bb7](_0x6ef6('0x65'),_0x5b5d1b,_0x5b5d1b,_0x5b5d1b);}}else{_0x59f6e8=_['find'](_0xf5dde0,[_0x6ef6('0x22'),_0x6ef6('0x66')]);_0x287777[_0x6ef6('0x49')]=_0x6ef6('0x66');_0x5aed05=as['buildExpression'](_0x2650cc,_0x59f6e8[_0x6ef6('0x67')],_0x287777);_0x35b359[_0x103bb7](_0x5aed05[_0x6ef6('0x68')],_0x5aed05[_0x6ef6('0x5f')][_0x6ef6('0x69')],_0x5aed05[_0x6ef6('0x5f')][_0x6ef6('0x15')]);}break;case'Tag':var _0x4c9630=_0x287777['value'][_0x6ef6('0x28')](',')[_0x6ef6('0x24')](function(_0x1bc1dd){return Number(_0x1bc1dd);});_0x4c9630[_0x6ef6('0x29')](function(_0x2354fc){_0x4c02b6['or'](_0x6ef6('0x6a'),'%,'+_0x2354fc+',%');});_0x3e4a64=_[_0x6ef6('0x6b')](_0x3e4a64,_0x4c9630);break;case _0x6ef6('0x6c'):if(_0x287777[_0x6ef6('0x6d')]===_0x6ef6('0x6e')){_0x35b359[_0x103bb7](_0x6ef6('0x6f'),'%'+_0x287777['value']+'%',null);}else{_0x59f6e8=_[_0x6ef6('0x5e')](_0xf5dde0,[_0x6ef6('0x22'),_0x6ef6('0x34')]);_0x287777[_0x6ef6('0x49')]=_0x6ef6('0x34');_0x5aed05=as[_0x6ef6('0x70')](_0x2650cc,_0x59f6e8[_0x6ef6('0x67')],_0x287777);_0x35b359[_0x103bb7](_0x5aed05[_0x6ef6('0x68')],_0x5aed05['value'][_0x6ef6('0x69')],_0x5aed05['value'][_0x6ef6('0x15')]);}break;case _0x6ef6('0x2f'):_0x5aed05=as[_0x6ef6('0x70')]('me',null,_0x287777);_0x35b359[_0x103bb7](_0x5aed05['text'],_0x5aed05[_0x6ef6('0x5f')][_0x6ef6('0x69')],_0x5aed05[_0x6ef6('0x5f')][_0x6ef6('0x15')]);break;}}else{var _0x5aed05=as[_0x6ef6('0x70')](_0x2650cc,_0x59f6e8[_0x6ef6('0x67')],_0x287777);_0x35b359[_0x103bb7](_0x5aed05[_0x6ef6('0x68')],_0x5aed05[_0x6ef6('0x5f')][_0x6ef6('0x69')],_0x5aed05[_0x6ef6('0x5f')][_0x6ef6('0x15')]);}}}else{var _0x164fa3=_(_0x31facc[_0x6ef6('0x3d')])[_0x6ef6('0x3e')]()['map'](function(_0x18df75){return _[_0x6ef6('0x71')](_0xf5dde0,[_0x6ef6('0x22'),_0x18df75])?_0x18df75:undefined;})[_0x6ef6('0x72')]()['value']();if(!_[_0x6ef6('0x73')](_0x164fa3)){_0x164fa3[_0x6ef6('0x29')](function(_0x2ed2ec){if(_0x2ed2ec===_0x6ef6('0x74')){_0x2fdb50[_0x6ef6('0x47')]('i.MailAccountId\x20IN\x20?',[]['concat'](_0x31facc[_0x6ef6('0x3d')][_0x2ed2ec]));}else if(_0x2ed2ec==='createdAt'){var _0x34f9ea=JSON[_0x6ef6('0x75')](_0x31facc[_0x6ef6('0x3d')][_0x2ed2ec])[_0x6ef6('0x76')];var _0x290e99=JSON[_0x6ef6('0x75')](_0x31facc[_0x6ef6('0x3d')][_0x2ed2ec])[_0x6ef6('0x77')];_0x2fdb50['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x34f9ea,_0x290e99);}else{if(_0x31facc['query'][_0x2ed2ec]===_0x6ef6('0x78')){_0x2fdb50[_0x6ef6('0x47')]('i.'+_0x2ed2ec+_0x6ef6('0x79'));}else{_0x2fdb50['where']('i.'+_0x2ed2ec+_0x6ef6('0x7a'),_0x31facc['query'][_0x2ed2ec]);}}});}if(_0x31facc['query'][_0x6ef6('0x7b')]){if(_0x31facc[_0x6ef6('0x3d')]['read']==0x1){_0x2fdb50['having'](_0x6ef6('0x7c'));}else{_0x2fdb50['having']('`unreadMessages`\x20>\x200');}}if(_0x31facc[_0x6ef6('0x3d')][_0x6ef6('0x7d')]){_0x3e4a64=_[_0x6ef6('0x7e')](_0x31facc[_0x6ef6('0x3d')][_0x6ef6('0x7d')])?_0x31facc[_0x6ef6('0x3d')]['tag']:new Array(_0x31facc[_0x6ef6('0x3d')][_0x6ef6('0x7d')]);_0x3e4a64[_0x6ef6('0x29')](function(_0x4af6cf){_0x4c02b6['or'](_0x6ef6('0x6a'),'%,'+_0x4af6cf+',%');});}if(_0x31facc[_0x6ef6('0x3d')][_0x6ef6('0x7f')]){var _0x17d5e7=_0x31facc['query'][_0x6ef6('0x7f')]['replace']('\x5c','\x5c\x5c')[_0x6ef6('0x80')](/'/g,'\x27\x27');if(qs[_0x6ef6('0x81')](_0x17d5e7)){_0x35b359['or'](_0x6ef6('0x82'),_0x17d5e7+'%');}else if(qs[_0x6ef6('0x83')](_0x17d5e7)){_0x35b359['or'](_0x6ef6('0x84'),_0x17d5e7+'%');}else{_0x35b359['or'](_0x6ef6('0x85'),qs[_0x6ef6('0x64')](_0x17d5e7))['or'](_0x6ef6('0x86'),qs[_0x6ef6('0x64')](_0x17d5e7));}}}_0x2fdb50[_0x6ef6('0x47')](_0x35b359);_0x2fdb50['group'](_0x6ef6('0x87'));var _0x36d59c={'type':db[_0x6ef6('0x88')][_0x6ef6('0x89')][_0x6ef6('0x8a')],'raw':!![]};var _0x283896=_0x2fdb50[_0x6ef6('0x8b')]();_0x283896[_0x6ef6('0x49')]('i.id');_0x283896[_0x6ef6('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6ef6('0x8c'));if(_0xed6093['order']){_0xed6093[_0x6ef6('0x8d')][_0x6ef6('0x29')](function(_0x28a8d4){var _0x5248ac=_0x28a8d4[0x0]==='contactName'?_0x28a8d4[0x0]:'i.'+_0x28a8d4[0x0];_0x2fdb50[_0x6ef6('0x8d')](_0x5248ac,_0x28a8d4[0x1]===_0x6ef6('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x3e4a64)){_0x2fdb50[_0x6ef6('0x61')](_0x4c02b6);_0x283896[_0x6ef6('0x47')](_0x6ef6('0x8f'),_0x3e4a64);}BPromise[_0x6ef6('0x90')]()[_0x6ef6('0x1e')](function(){if(!_0xea51c1){if(_0x31facc[_0x6ef6('0x3d')][_0x6ef6('0x74')])return;_0x283896[_0x6ef6('0x47')](_0x6ef6('0x91'));_0x2fdb50[_0x6ef6('0x47')](_0x6ef6('0x91'));return;}if(_0x31facc[_0x6ef6('0x92')]['role']!==_0x6ef6('0x93'))return;return _0x31facc[_0x6ef6('0x92')]['getMailAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x79816c){if(_[_0x6ef6('0x73')](_0x79816c)){_0x283896[_0x6ef6('0x47')](_0x6ef6('0x94'));_0x2fdb50[_0x6ef6('0x47')](_0x6ef6('0x94'));}else{_0x283896[_0x6ef6('0x47')]('i.MailAccountId\x20IN\x20?',_[_0x6ef6('0x24')](_0x79816c,'id'));_0x2fdb50['where'](_0x6ef6('0x95'),_[_0x6ef6('0x24')](_0x79816c,'id'));}});})[_0x6ef6('0x1e')](function(){if(_0x31facc[_0x6ef6('0x92')][_0x6ef6('0x96')]==='agent'&&!_0xea51c1&&!_0x31facc[_0x6ef6('0x3d')][_0x6ef6('0x74')])return[];return db[_0x6ef6('0x97')]['query'](_0x283896[_0x6ef6('0x98')](),_0x36d59c);})['then'](function(_0x19c241){_0x5c5e8a['count']=_0x19c241['length'];if(_0x5c5e8a['count']===0x0)return[];return db[_0x6ef6('0x97')][_0x6ef6('0x3d')](_0x315d1a[_0x6ef6('0x98')](),_0x36d59c)[_0x6ef6('0x1e')](function(_0x31d0d4){_0x2800f2=_['keyBy'](_0x31d0d4,'id');_0x36d59c=_[_0x6ef6('0x99')](_0x36d59c,{'model':db[_0x6ef6('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x31facc['query'][_0x6ef6('0x42')]){_0xed6093[_0x6ef6('0x41')][_0x6ef6('0x29')](function(_0x4d953e){_0x2fdb50[_0x6ef6('0x49')]('i.'+_0x4d953e);});}else{_0x2fdb50['field'](_0x6ef6('0x9b'),_0x6ef6('0x8c'));_0x2fdb50[_0x6ef6('0x49')](_0x6ef6('0x9c'),_0x6ef6('0x9d'));_0x2fdb50['field']('a.mandatoryDisposition',_0x6ef6('0x9e'));_0x2fdb50[_0x6ef6('0x49')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x6ef6('0x9f'));_0x2fdb50[_0x6ef6('0x49')](_0x6ef6('0x87'));_0x2fdb50[_0x6ef6('0x49')](_0x6ef6('0xa0'));_0x2fdb50['field'](_0x6ef6('0xa1'));_0x2fdb50['field']('i.closed');_0x2fdb50[_0x6ef6('0x49')](_0x6ef6('0xa2'));_0x2fdb50[_0x6ef6('0x49')](_0x6ef6('0xa3'));_0x2fdb50[_0x6ef6('0x49')](_0x6ef6('0xa4'));_0x2fdb50['field'](_0x6ef6('0xa5'));_0x2fdb50[_0x6ef6('0x49')]('i.subject');_0x2fdb50[_0x6ef6('0x49')]('i.disposition');_0x2fdb50[_0x6ef6('0x49')](_0x6ef6('0xa6'));_0x2fdb50[_0x6ef6('0x49')]('i.thirdDisposition');_0x2fdb50[_0x6ef6('0x49')](_0x6ef6('0xa7'));_0x2fdb50[_0x6ef6('0x49')](_0x6ef6('0xa8'));_0x2fdb50['field'](_0x6ef6('0xa9'));_0x2fdb50[_0x6ef6('0x49')](_0x6ef6('0xaa'));_0x2fdb50[_0x6ef6('0x49')](_0x6ef6('0xab'));_0x2fdb50['field'](_0x6ef6('0xac'),_0x6ef6('0xad'));_0x2fdb50[_0x6ef6('0x49')](_0x6ef6('0xae'),_0x6ef6('0xaf'));_0x2fdb50[_0x6ef6('0x49')](_0x6ef6('0xb0'),_0x6ef6('0xb1'));_0x2fdb50['field'](_0x6ef6('0xb2'),_0x6ef6('0xb3'));_0x2fdb50[_0x6ef6('0x49')]('c.mobile','Contact.mobile');_0x2fdb50[_0x6ef6('0x49')](_0x6ef6('0xb4'),_0x6ef6('0xb5'));_0x2fdb50['field'](_0x6ef6('0xb6'),_0x6ef6('0xb7'));_0x2fdb50['field']('o.internal','Owner.internal');_0x2fdb50['field'](_0x6ef6('0xb8'),'TagIds');}if(_0xed6093[_0x6ef6('0x1a')])_0x2fdb50[_0x6ef6('0x1a')](_0xed6093[_0x6ef6('0x1a')]);if(_0xed6093[_0x6ef6('0x17')])_0x2fdb50[_0x6ef6('0x17')](_0xed6093[_0x6ef6('0x17')]);return db[_0x6ef6('0x97')]['query'](_0x2fdb50[_0x6ef6('0x98')](),_0x36d59c);})[_0x6ef6('0x1e')](function(_0x306288){if(_0x306288[_0x6ef6('0x43')]>0x0)_0x5d6b40[_0x6ef6('0x47')]('ui.MailInteractionId\x20IN\x20?',_[_0x6ef6('0x24')](_0x306288,'id'));return db[_0x6ef6('0x97')]['query'](_0x5d6b40[_0x6ef6('0x98')](),_0x36d59c)[_0x6ef6('0x1e')](function(_0x5e1cbd){var _0x450517=_[_0x6ef6('0xb9')](_0x5e1cbd,_0x6ef6('0xba'));var _0x1419cd=[];return db[_0x6ef6('0xbb')][_0x6ef6('0xbc')]({'attributes':[_0x6ef6('0xbd')],'raw':!![]})['then'](function(_0x58424a){var _0x4efe8a=_0x58424a['enableEmailPreview'];_0x306288[_0x6ef6('0x29')](function(_0x1f61d3){_0x1419cd[_0x6ef6('0x2a')](updateMailInteraction(_0x1f61d3,_0x2800f2,_0x450517,_0x4efe8a));});return BPromise[_0x6ef6('0xbe')](_0x1419cd);});});});})[_0x6ef6('0x1e')](function(_0x45ab3c){_0x5c5e8a[_0x6ef6('0xbf')]=_0x45ab3c;return _0x5c5e8a;})['then'](respondWithFilteredResult(_0x2828ef,_0xed6093))[_0x6ef6('0x30')](handleError(_0x2828ef,null));};exports['show']=function(_0x3d67cd,_0x2e46b6){var _0x264240={'raw':![],'where':{'id':_0x3d67cd[_0x6ef6('0xc0')]['id']}},_0x578c7a={};_0x578c7a[_0x6ef6('0x3c')]=_[_0x6ef6('0x3e')](db[_0x6ef6('0x9a')]['rawAttributes']);_0x578c7a[_0x6ef6('0x3d')]=_['keys'](_0x3d67cd[_0x6ef6('0x3d')]);_0x578c7a[_0x6ef6('0x3f')]=_[_0x6ef6('0x40')](_0x578c7a['model'],_0x578c7a['query']);_0x264240['attributes']=_[_0x6ef6('0x40')](_0x578c7a['model'],qs['fields'](_0x3d67cd[_0x6ef6('0x3d')][_0x6ef6('0x42')]));_0x264240['attributes']=_0x264240[_0x6ef6('0x41')][_0x6ef6('0x43')]?_0x264240[_0x6ef6('0x41')]:_0x578c7a[_0x6ef6('0x3c')];if(_0x3d67cd[_0x6ef6('0x3d')]['includeAll']){_0x264240[_0x6ef6('0xc1')]=[{'all':!![]}];}_0x264240=_[_0x6ef6('0x99')]({},_0x264240,_0x3d67cd[_0x6ef6('0xc2')]);return db[_0x6ef6('0x9a')][_0x6ef6('0x5e')](_0x264240)[_0x6ef6('0x1e')](handleEntityNotFound(_0x2e46b6,null))['then'](respondWithResult(_0x2e46b6,null))['catch'](handleError(_0x2e46b6,null));};exports['create']=function(_0x1663e4,_0x2a96d7){return db[_0x6ef6('0x9a')][_0x6ef6('0xc3')](_0x1663e4[_0x6ef6('0xc4')],{})[_0x6ef6('0x1e')](respondWithResult(_0x2a96d7,0xc9))['catch'](handleError(_0x2a96d7,null));};exports[_0x6ef6('0x1d')]=function(_0x47a73e,_0x423633){if(_0x47a73e[_0x6ef6('0xc4')]['id']){delete _0x47a73e['body']['id'];}return db[_0x6ef6('0x9a')][_0x6ef6('0x5e')]({'where':{'id':_0x47a73e[_0x6ef6('0xc0')]['id']}})['then'](handleEntityNotFound(_0x423633,null))[_0x6ef6('0x1e')](saveUpdates(_0x47a73e[_0x6ef6('0xc4')],null))[_0x6ef6('0x1e')](respondWithResult(_0x423633,null))[_0x6ef6('0x30')](handleError(_0x423633,null));};exports[_0x6ef6('0x1f')]=function(_0x2a29e9,_0x2f22b3){return db[_0x6ef6('0x9a')]['find']({'where':{'id':_0x2a29e9['params']['id']}})[_0x6ef6('0x1e')](handleEntityNotFound(_0x2f22b3,null))['then'](removeEntity(_0x2f22b3,null))[_0x6ef6('0x30')](handleError(_0x2f22b3,null));};exports[_0x6ef6('0xc5')]=function(_0x1cd4ee,_0x214c68){return db[_0x6ef6('0x9a')]['describe']()[_0x6ef6('0x1e')](respondWithResult(_0x214c68,null))[_0x6ef6('0x30')](handleError(_0x214c68,null));};exports[_0x6ef6('0xc6')]=function(_0x1b5900,_0x106159){return db[_0x6ef6('0x2b')][_0x6ef6('0x5e')]({'where':{'id':_0x1b5900['params']['id']}})[_0x6ef6('0x1e')](handleEntityNotFound(_0x106159,null))[_0x6ef6('0x1e')](function(_0x1b0afb){if(_0x1b0afb){return _0x1b0afb['addMessage'](_0x1b5900[_0x6ef6('0xc4')]['ids'],_[_0x6ef6('0xc7')](_0x1b5900[_0x6ef6('0xc4')],['ids','id'])||{});}})['then'](respondWithResult(_0x106159,null))[_0x6ef6('0x30')](handleError(_0x106159,null));};exports['getMessages']=function(_0x59683b,_0x25d6a7){var _0xce0f94={'raw':![],'where':{}};var _0x3fa524={};var _0x308905={'count':0x0,'rows':[]};return db[_0x6ef6('0x9a')][_0x6ef6('0xbc')]({'where':{'id':_0x59683b[_0x6ef6('0xc0')]['id']}})[_0x6ef6('0x1e')](handleEntityNotFound(_0x25d6a7,null))[_0x6ef6('0x1e')](function(_0x209a75){if(_0x209a75){_0x3fa524[_0x6ef6('0x3c')]=_[_0x6ef6('0x3e')](db[_0x6ef6('0x2b')][_0x6ef6('0x39')]);_0x3fa524['query']=_[_0x6ef6('0x3e')](_0x59683b['query']);_0x3fa524[_0x6ef6('0x3f')]=_['intersection'](_0x3fa524[_0x6ef6('0x3c')],_0x3fa524['query']);_0xce0f94[_0x6ef6('0x41')]=_['intersection'](_0x3fa524[_0x6ef6('0x3c')],qs['fields'](_0x59683b[_0x6ef6('0x3d')][_0x6ef6('0x42')]));_0xce0f94[_0x6ef6('0x41')]=_0xce0f94[_0x6ef6('0x41')][_0x6ef6('0x43')]?_0xce0f94[_0x6ef6('0x41')]:_0x3fa524[_0x6ef6('0x3c')];if(!_0x59683b[_0x6ef6('0x3d')][_0x6ef6('0x44')]('nolimit')){_0xce0f94[_0x6ef6('0x1a')]=qs['limit'](_0x59683b[_0x6ef6('0x3d')][_0x6ef6('0x1a')]);_0xce0f94[_0x6ef6('0x17')]=qs[_0x6ef6('0x17')](_0x59683b[_0x6ef6('0x3d')]['offset']);}_0xce0f94['order']=qs[_0x6ef6('0x46')](_0x59683b['query'][_0x6ef6('0x46')]);_0xce0f94['where']=qs[_0x6ef6('0x3f')](_[_0x6ef6('0xc8')](_0x59683b[_0x6ef6('0x3d')],_0x3fa524[_0x6ef6('0x3f')]));_0xce0f94[_0x6ef6('0x47')][_0x6ef6('0xba')]=_0x209a75['id'];if(_0x59683b[_0x6ef6('0x3d')][_0x6ef6('0x7f')]){_0xce0f94['where']=_[_0x6ef6('0x99')](_0xce0f94[_0x6ef6('0x47')],{'$or':_['map'](_0xce0f94[_0x6ef6('0x41')],function(_0x17c399){var _0xb02e05={};_0xb02e05[_0x17c399]={'$like':'%'+_0x59683b['query'][_0x6ef6('0x7f')]+'%'};return _0xb02e05;})});}if(_0x59683b['query'][_0x6ef6('0x76')]){var _0x1619aa=_0x59683b[_0x6ef6('0x3d')][_0x6ef6('0x76')][_0x6ef6('0x28')](',');var _0x361e0e={};_0x361e0e[_0x1619aa[0x0]]={'$gte':moment(_0x1619aa[0x1])[_0x6ef6('0xc9')](_0x6ef6('0xca'))};_0xce0f94[_0x6ef6('0x47')]=_[_0x6ef6('0x99')](_0xce0f94['where'],_0x361e0e);}_0xce0f94=_[_0x6ef6('0x99')]({},_0xce0f94,_0x59683b[_0x6ef6('0xc2')]);return db[_0x6ef6('0x2b')][_0x6ef6('0x19')]({'where':_0xce0f94[_0x6ef6('0x47')]})[_0x6ef6('0x1e')](function(_0x3e25d6){_0x308905[_0x6ef6('0x19')]=_0x3e25d6;if(_0x59683b[_0x6ef6('0x3d')][_0x6ef6('0xcb')]){_0xce0f94[_0x6ef6('0xc1')]=[{'all':!![]}];}return db[_0x6ef6('0x2b')][_0x6ef6('0xcc')](_0xce0f94);})['then'](function(_0x2a5a63){if(_0x59683b['query'][_0x6ef6('0xcd')]===_0x6ef6('0xce')){for(var _0x38d1b4=0x0;_0x38d1b4<_0x2a5a63[_0x6ef6('0x43')];_0x38d1b4++){_0x2a5a63[_0x38d1b4][_0x6ef6('0xc4')]=juice(_0x2a5a63[_0x38d1b4]['body']);}}_0x308905[_0x6ef6('0xbf')]=_0x2a5a63;return _0x308905;});}})[_0x6ef6('0x1e')](respondWithFilteredResult(_0x25d6a7,_0xce0f94))[_0x6ef6('0x30')](handleError(_0x25d6a7,null));};exports[_0x6ef6('0xcf')]=function(_0x1572f6,_0x127fd7){return db['MailInteraction'][_0x6ef6('0x5e')]({'where':{'id':_0x1572f6[_0x6ef6('0xc0')]['id']}})[_0x6ef6('0x1e')](handleEntityNotFound(_0x127fd7,null))[_0x6ef6('0x1e')](function(_0x42fe71){if(_0x42fe71){return _0x42fe71['setTags'](_0x1572f6[_0x6ef6('0xc4')][_0x6ef6('0xd0')],_[_0x6ef6('0xc7')](_0x1572f6[_0x6ef6('0xc4')],[_0x6ef6('0xd0'),'id'])||{})[_0x6ef6('0xd1')](function(){return db[_0x6ef6('0xd2')][_0x6ef6('0xcc')]({'attributes':['id',_0x6ef6('0x22'),_0x6ef6('0x4a')],'where':{'id':_0x1572f6[_0x6ef6('0xc4')][_0x6ef6('0xd0')]}});})['then'](function(_0x53b9cc){socket[_0x6ef6('0xd3')]('mailInteractionTags:save',{'id':Number(_0x1572f6[_0x6ef6('0xc0')]['id']),'tags':_0x53b9cc||[]});return{'id':Number(_0x1572f6[_0x6ef6('0xc0')]['id']),'tags':_0x53b9cc||[]};});}})[_0x6ef6('0x1e')](respondWithResult(_0x127fd7,null))[_0x6ef6('0x30')](handleError(_0x127fd7,null));};exports['removeTags']=function(_0x8db77e,_0x139d00){return db['MailInteraction'][_0x6ef6('0x5e')]({'where':{'id':_0x8db77e[_0x6ef6('0xc0')]['id']}})[_0x6ef6('0x1e')](handleEntityNotFound(_0x139d00,null))['then'](function(_0x38c08c){if(_0x38c08c){return _0x38c08c[_0x6ef6('0xd4')](_0x8db77e[_0x6ef6('0x3d')][_0x6ef6('0xd0')]);}})[_0x6ef6('0x1e')](respondWithStatusCode(_0x139d00,null))['catch'](handleError(_0x139d00,null));};exports[_0x6ef6('0xd5')]=function(_0x5c5a55,_0xee89c9){var _0x176702=moment()[_0x6ef6('0xd6')]()[_0x6ef6('0x98')]();var _0x2390d1=path['join'](config[_0x6ef6('0xd7')],_0x6ef6('0xd8'),_0x6ef6('0xd9'),_0x6ef6('0xda'));var _0x49b133=path[_0x6ef6('0xdb')](config['root'],_0x6ef6('0xd8'),'files',_0x6ef6('0xdc'));var _0x5a00c7=path['join'](_0x2390d1,_0x176702);var _0x1f8c84=util[_0x6ef6('0xc9')]('transcript-%d-%s.zip',_0x5c5a55['params']['id'],_0x176702);var _0xee13cd=path['join'](_0x2390d1,_0x1f8c84);var _0x27eb7d=[];if(_0x5c5a55['query'][_0x6ef6('0xdc')]){_0x27eb7d[_0x6ef6('0x2a')]({'model':db[_0x6ef6('0xdd')],'as':_0x6ef6('0xde'),'raw':!![]});}var _0x5c952e=[{'model':db['MailMessage'],'as':'Messages','attributes':['id','body',_0x6ef6('0x4b'),'to','cc',_0x6ef6('0xdf'),_0x6ef6('0xe0'),_0x6ef6('0xe1')],'where':{'secret':![]},'order':qs[_0x6ef6('0x46')]('id'),'include':_0x27eb7d}];return db[_0x6ef6('0x9a')][_0x6ef6('0x5e')]({'where':{'id':_0x5c5a55[_0x6ef6('0xc0')]['id']},'include':_0x5c952e})[_0x6ef6('0x1e')](handleEntityNotFound(_0xee89c9,null))['then'](function(_0x49386a){if(_0x49386a&&_0x49386a['Messages']){var _0x498916=_0x49386a[_0x6ef6('0xe2')]({'plain':!![]});fs[_0x6ef6('0xe3')](_0x5a00c7);return BPromise['each'](_0x498916[_0x6ef6('0xe4')],function(_0x5b2fb4,_0x3691a0){var _0x2803a9={'from':_0x5b2fb4[_0x6ef6('0x4b')],'to':_0x5b2fb4['to'],'subject':_0x5b2fb4['subject'],'html':htmlEntities[_0x6ef6('0xe5')](_0x5b2fb4[_0x6ef6('0xc4')]),'headers':{'Date':moment(_0x5b2fb4[_0x6ef6('0xe1')])[_0x6ef6('0xc9')](_0x6ef6('0xe6'))},'attachments':[]};if(_0x5b2fb4['cc']){_0x2803a9['headers']['Cc']=_0x5b2fb4['cc'];}if(_0x5b2fb4['bcc']){_0x2803a9[_0x6ef6('0xe7')][_0x6ef6('0xe8')]=_0x5b2fb4[_0x6ef6('0xdf')];}return new BPromise(function(_0x1cdc5d,_0x55bfef){if(_0x5b2fb4[_0x6ef6('0xde')]){for(var _0x36dfe3=0x0;_0x36dfe3<_0x5b2fb4['Attachments']['length'];_0x36dfe3++){var _0x33b500=_0x5b2fb4['Attachments'][_0x36dfe3];var _0x2eac13=path[_0x6ef6('0xdb')](_0x49b133,_0x33b500[_0x6ef6('0xe9')]);if(fs[_0x6ef6('0xea')](_0x2eac13)){_0x2803a9['attachments'][_0x6ef6('0x2a')]({'name':_0x33b500[_0x6ef6('0x22')],'contentType':_0x33b500[_0x6ef6('0x67')],'data':fs[_0x6ef6('0xeb')](_0x2eac13)});}}}emlformat[_0x6ef6('0xec')](_0x2803a9,function(_0x3d48cb,_0x107f06){if(_0x3d48cb)return _0x55bfef(_0x3d48cb);fs[_0x6ef6('0xed')](path[_0x6ef6('0xdb')](_0x5a00c7,util[_0x6ef6('0xc9')]('message%d.eml',_0x3691a0)),_0x107f06);return _0x1cdc5d(_0x107f06);});});})['then'](function(){return new BPromise(function(_0x34d59e,_0x4c5a8a){zipdir(_0x5a00c7,{'saveTo':_0xee13cd},function(_0x495e43,_0x32b9d5){if(_0x495e43)return _0x4c5a8a(_0x495e43);return _0x34d59e(_0x32b9d5);});})[_0x6ef6('0x1e')](function(){return new BPromise(function(_0x5dee07,_0x4701a7){rimraf(_0x5a00c7,function(_0x248c75){if(_0x248c75)_0x4701a7(_0x248c75);return _0x5dee07();});});})[_0x6ef6('0x1e')](function(){return _0xee89c9[_0x6ef6('0xd5')](_0xee13cd,_0x1f8c84,function(_0x229de1){if(!_0x229de1)fs['unlinkSync'](_0xee13cd);});});});}else{return _0xee89c9[_0x6ef6('0x13')](0xc8);}})[_0x6ef6('0x30')](handleError(_0xee89c9,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index d670dad..8e23de9 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 _0x01f7=['length','emit','catch','hasOwnProperty','events','MailInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages'];(function(_0x2e2ab1,_0x3f1f55){var _0x437e4e=function(_0x10592a){while(--_0x10592a){_0x2e2ab1['push'](_0x2e2ab1['shift']());}};_0x437e4e(++_0x3f1f55);}(_0x01f7,0x16c));var _0x701f=function(_0x7d8e66,_0x599dbd){_0x7d8e66=_0x7d8e66-0x0;var _0x190e52=_0x01f7[_0x7d8e66];return _0x190e52;};'use strict';var EventEmitter=require(_0x701f('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x701f('0x1')];var MailMessage=require(_0x701f('0x2'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x701f('0x3')](0x0);var events={'afterCreate':_0x701f('0x4'),'afterUpdate':_0x701f('0x5'),'afterDestroy':_0x701f('0x6')};function emitEvent(_0x2a3824){return function(_0x8df956,_0xbf68cf,_0x402ac0){_0x8df956[_0x701f('0x7')]({'attributes':['id'],'raw':!![]})[_0x701f('0x8')](function(_0x4cd29){_0x8df956['setDataValue'](_0x701f('0x9'),_0x4cd29[_0x701f('0xa')](function(_0x23deca){return{'id':_0x23deca['id']};}));return MailMessage[_0x701f('0xb')]({'where':{'MailInteractionId':_0x8df956['id'],'direction':'in','read':![]},'raw':!![]});})[_0x701f('0x8')](function(_0x34710c){_0x8df956[_0x701f('0xc')](_0x701f('0xd'),_0x34710c[_0x701f('0xe')]);MailInteractionEvents['emit'](_0x2a3824+':'+_0x8df956['id'],_0x8df956);MailInteractionEvents[_0x701f('0xf')](_0x2a3824,_0x8df956);_0x402ac0(null);})[_0x701f('0x10')](_0x402ac0(null));};}for(var e in events){if(events[_0x701f('0x11')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x0e08=['MailMessage','setMaxListeners','save','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction'];(function(_0xf18d80,_0xb4afe1){var _0x1bea3d=function(_0x241d82){while(--_0x241d82){_0xf18d80['push'](_0xf18d80['shift']());}};_0x1bea3d(++_0xb4afe1);}(_0x0e08,0x96));var _0x80e0=function(_0x572036,_0x7eb58f){_0x572036=_0x572036-0x0;var _0x33446c=_0x0e08[_0x572036];return _0x33446c;};'use strict';var EventEmitter=require(_0x80e0('0x0'));var MailInteraction=require(_0x80e0('0x1'))['db'][_0x80e0('0x2')];var MailMessage=require(_0x80e0('0x1'))['db'][_0x80e0('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x80e0('0x4')](0x0);var events={'afterCreate':_0x80e0('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4feb4c){return function(_0x4b9edd,_0x371b57,_0x26a4ff){_0x4b9edd['getUsers']({'attributes':['id'],'raw':!![]})[_0x80e0('0x6')](function(_0x262739){_0x4b9edd[_0x80e0('0x7')]('Users',_0x262739[_0x80e0('0x8')](function(_0x141f5b){return{'id':_0x141f5b['id']};}));return MailMessage[_0x80e0('0x9')]({'where':{'MailInteractionId':_0x4b9edd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x80e0('0x6')](function(_0x176e66){_0x4b9edd[_0x80e0('0x7')](_0x80e0('0xa'),_0x176e66[_0x80e0('0xb')]);MailInteractionEvents[_0x80e0('0xc')](_0x4feb4c+':'+_0x4b9edd['id'],_0x4b9edd);MailInteractionEvents['emit'](_0x4feb4c,_0x4b9edd);_0x26a4ff(null);})[_0x80e0('0xd')](_0x26a4ff(null));};}for(var e in events){if(events[_0x80e0('0xe')](e)){var event=events[e];MailInteraction[_0x80e0('0xf')](e,emitEvent(event));}}module[_0x80e0('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index ad72a1b..2efdd6a 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 _0x5e43=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','subject','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','format','models','get','MailMessage','catch','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x3f9d2d,_0x1092f8){var _0x1679f7=function(_0x46ac5a){while(--_0x46ac5a){_0x3f9d2d['push'](_0x3f9d2d['shift']());}};_0x1679f7(++_0x1092f8);}(_0x5e43,0x1d3));var _0x35e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e43[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x35e4('0x0'));var util=require('util');var logger=require(_0x35e4('0x1'))('api');var moment=require(_0x35e4('0x2'));var BPromise=require(_0x35e4('0x3'));var rp=require(_0x35e4('0x4'));var fs=require('fs');var path=require(_0x35e4('0x5'));var rimraf=require(_0x35e4('0x6'));var config=require(_0x35e4('0x7'));var attributes=require('./mailInteraction.attributes');module[_0x35e4('0x8')]=function(_0x29f0f8,_0x3eeb04){return _0x29f0f8[_0x35e4('0x9')](_0x35e4('0xa'),attributes,{'tableName':_0x35e4('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x35e4('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xed1e21,_0x2d624f,_0x5bb4a3){if(_0xed1e21[_0x35e4('0xd')]){_0xed1e21[_0x35e4('0xe')]=moment()['format'](_0x35e4('0xf'));}if(_0xed1e21[_0x35e4('0x10')]){_0xed1e21[_0x35e4('0x11')]=moment()['format'](_0x35e4('0xf'));}_0x5bb4a3(null,_0x2d624f);},'beforeUpdate':function(_0x1bf178,_0x5ba1ef,_0xe06c3e){if(_0x1bf178[_0x35e4('0x12')]('substatus')){_0x1bf178[_0x35e4('0xe')]=_0x1bf178[_0x35e4('0xd')]?moment()[_0x35e4('0x13')](_0x35e4('0xf')):null;}if(_0x1bf178['changed'](_0x35e4('0x10'))){_0x1bf178[_0x35e4('0x11')]=moment()['format'](_0x35e4('0xf'));_0x1bf178[_0x35e4('0xd')]=null;_0x1bf178['substatusAt']=null;}_0xe06c3e(null,_0x1bf178);},'afterUpdate':function(_0x13daf9,_0x57589e,_0x34bdbb){var _0x4b1b9f=_0x29f0f8[_0x35e4('0x14')];var _0x5d048d=_0x13daf9[_0x35e4('0x15')]({'plain':!![]});if(_0x5d048d[_0x35e4('0x10')]){return _0x4b1b9f[_0x35e4('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x5d048d['id']}})['then'](function(){_0x34bdbb();})[_0x35e4('0x17')](function(_0x328c19){_0x34bdbb(_0x328c19);});}else{_0x34bdbb();}}},'charset':_0x35e4('0x18'),'collate':_0x35e4('0x19')});}; \ No newline at end of file +var _0xbd9c=['substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatusAt','closedAt','models','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT'];(function(_0x6779e,_0x33e185){var _0x4824cd=function(_0x3c305c){while(--_0x3c305c){_0x6779e['push'](_0x6779e['shift']());}};_0x4824cd(++_0x33e185);}(_0xbd9c,0x152));var _0xcbd9=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0xbd9c[_0x316c42];return _0x2b38f7;};'use strict';var _=require('lodash');var util=require(_0xcbd9('0x0'));var logger=require(_0xcbd9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcbd9('0x2'));var rp=require(_0xcbd9('0x3'));var fs=require('fs');var path=require(_0xcbd9('0x4'));var rimraf=require(_0xcbd9('0x5'));var config=require(_0xcbd9('0x6'));var attributes=require('./mailInteraction.attributes');module[_0xcbd9('0x7')]=function(_0x4eab62,_0x20e56e){return _0x4eab62['define'](_0xcbd9('0x8'),attributes,{'tableName':_0xcbd9('0x9'),'paranoid':![],'indexes':[{'name':_0xcbd9('0xa'),'fields':[_0xcbd9('0xb'),'to'],'type':_0xcbd9('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xa636d9,_0x11a41b,_0xca35e2){if(_0xa636d9[_0xcbd9('0xd')]){_0xa636d9['substatusAt']=moment()[_0xcbd9('0xe')](_0xcbd9('0xf'));}if(_0xa636d9[_0xcbd9('0x10')]){_0xa636d9['closedAt']=moment()['format'](_0xcbd9('0xf'));}_0xca35e2(null,_0x11a41b);},'beforeUpdate':function(_0x151fd2,_0x1cef37,_0x5536ff){if(_0x151fd2[_0xcbd9('0x11')](_0xcbd9('0xd'))){_0x151fd2[_0xcbd9('0x12')]=_0x151fd2[_0xcbd9('0xd')]?moment()[_0xcbd9('0xe')](_0xcbd9('0xf')):null;}if(_0x151fd2[_0xcbd9('0x11')]('closed')){_0x151fd2[_0xcbd9('0x13')]=moment()[_0xcbd9('0xe')](_0xcbd9('0xf'));_0x151fd2['substatus']=null;_0x151fd2[_0xcbd9('0x12')]=null;}_0x5536ff(null,_0x151fd2);},'afterUpdate':function(_0x1e561f,_0x27ea36,_0x3c6f97){var _0x5b4db6=_0x4eab62[_0xcbd9('0x14')];var _0x21f84d=_0x1e561f[_0xcbd9('0x15')]({'plain':!![]});if(_0x21f84d[_0xcbd9('0x10')]){return _0x5b4db6['MailMessage'][_0xcbd9('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x21f84d['id']}})[_0xcbd9('0x17')](function(){_0x3c6f97();})[_0xcbd9('0x18')](function(_0x1910ec){_0x3c6f97(_0x1910ec);});}else{_0x3c6f97();}}},'charset':_0xcbd9('0x19'),'collate':_0xcbd9('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 4ac3da4..c716c3e 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 _0x9d5c=['request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','options','raw','attributes','limit','debug','AddTagsToMailInteraction','find','where','addTags','ids','omit','body','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register'];(function(_0x45e635,_0x376349){var _0x32e70e=function(_0x10985e){while(--_0x10985e){_0x45e635['push'](_0x45e635['shift']());}};_0x32e70e(++_0x376349);}(_0x9d5c,0x98));var _0xc9d5=function(_0xd9cd57,_0x2a0904){_0xd9cd57=_0xd9cd57-0x0;var _0x5cffbd=_0x9d5c[_0xd9cd57];return _0x5cffbd;};'use strict';var _=require(_0xc9d5('0x0'));var util=require('util');var moment=require(_0xc9d5('0x1'));var BPromise=require(_0xc9d5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9d5('0x3'));var db=require(_0xc9d5('0x4'))['db'];var utils=require(_0xc9d5('0x5'));var logger=require('../../config/logger')(_0xc9d5('0x6'));var config=require(_0xc9d5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc9d5('0x8')][_0xc9d5('0x9')]({'port':0x232a});config[_0xc9d5('0xa')]=_[_0xc9d5('0xb')](config[_0xc9d5('0xa')],{'host':_0xc9d5('0xc'),'port':0x18eb});var socket=require(_0xc9d5('0xd'))(new Redis(config[_0xc9d5('0xa')]));require(_0xc9d5('0xe'))[_0xc9d5('0xf')](socket);function respondWithRpcPromise(_0x4b2a27,_0x5aeab3,_0x53816b){return new BPromise(function(_0x4d4fde,_0x15dcdf){return client[_0xc9d5('0x10')](_0x4b2a27,_0x53816b)[_0xc9d5('0x11')](function(_0x23d32e){logger[_0xc9d5('0x12')](_0xc9d5('0x13'),_0x5aeab3,_0xc9d5('0x14'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x5aeab3,'request\x20sent',JSON[_0xc9d5('0x15')](_0x23d32e));if(_0x23d32e[_0xc9d5('0x16')]){if(_0x23d32e[_0xc9d5('0x16')][_0xc9d5('0x17')]===0x1f4){logger['error'](_0xc9d5('0x13'),_0x5aeab3,_0x23d32e[_0xc9d5('0x16')]['message']);return _0x15dcdf(_0x23d32e[_0xc9d5('0x16')][_0xc9d5('0x18')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x5aeab3,_0x23d32e[_0xc9d5('0x16')][_0xc9d5('0x18')]);return _0x4d4fde(_0x23d32e[_0xc9d5('0x16')]['message']);}else{logger[_0xc9d5('0x12')]('MailInteraction,\x20%s,\x20%s',_0x5aeab3,_0xc9d5('0x14'));_0x4d4fde(_0x23d32e[_0xc9d5('0x19')][_0xc9d5('0x18')]);}})[_0xc9d5('0x1a')](function(_0x55aae9){logger[_0xc9d5('0x16')]('MailInteraction,\x20%s,\x20%s',_0x5aeab3,_0x55aae9);_0x15dcdf(_0x55aae9);});});}exports[_0xc9d5('0x1b')]=function(_0x331772){var _0x866f42=this;return new Promise(function(_0x24f1fd,_0x4c0139){return db[_0xc9d5('0x1c')]['update'](_0x331772['body'],{'raw':_0x331772[_0xc9d5('0x1d')]?_0x331772[_0xc9d5('0x1d')][_0xc9d5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x331772[_0xc9d5('0x1d')]?_0x331772[_0xc9d5('0x1d')]['where']||null:null,'attributes':_0x331772['options']?_0x331772[_0xc9d5('0x1d')][_0xc9d5('0x1f')]||null:null,'limit':_0x331772[_0xc9d5('0x1d')]?_0x331772[_0xc9d5('0x1d')][_0xc9d5('0x20')]||null:null})[_0xc9d5('0x11')](function(_0x237ae7){logger[_0xc9d5('0x12')](_0xc9d5('0x1b'),_0x331772);logger[_0xc9d5('0x21')]('UpdateMailInteraction',_0x331772,JSON[_0xc9d5('0x15')](_0x237ae7));_0x24f1fd(_0x237ae7);})[_0xc9d5('0x1a')](function(_0x3e5b54){logger[_0xc9d5('0x16')](_0xc9d5('0x1b'),_0x3e5b54[_0xc9d5('0x18')],_0x331772);_0x4c0139(_0x866f42[_0xc9d5('0x16')](0x1f4,_0x3e5b54['message']));});});};exports[_0xc9d5('0x22')]=function(_0x28fb0e){return new Promise(function(_0x5e06f2,_0x42ec08){return db[_0xc9d5('0x1c')][_0xc9d5('0x23')]({'where':_0x28fb0e[_0xc9d5('0x1d')]?_0x28fb0e[_0xc9d5('0x1d')][_0xc9d5('0x24')]||null:null})[_0xc9d5('0x11')](function(_0x463b8f){if(_0x463b8f){return _0x463b8f[_0xc9d5('0x25')](_0x28fb0e['body'][_0xc9d5('0x26')],_[_0xc9d5('0x27')](_0x28fb0e[_0xc9d5('0x28')],['ids','id'])||{});}})['spread'](function(_0x5c5bfb){logger['info'](_0xc9d5('0x29'),_0x28fb0e);logger[_0xc9d5('0x21')](_0xc9d5('0x29'),_0x28fb0e,JSON[_0xc9d5('0x15')](_0x5c5bfb));_0x5e06f2(_0x5c5bfb);})[_0xc9d5('0x1a')](function(_0x3caee1){logger['error'](_0xc9d5('0x29'),_0x3caee1[_0xc9d5('0x18')],_0x28fb0e);_0x42ec08(_this[_0xc9d5('0x16')](0x1f4,_0x3caee1[_0xc9d5('0x18')]));});});}; \ No newline at end of file +var _0x1115=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailInteraction','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','find','omit','AddTags','util','moment'];(function(_0x239b31,_0x44a64d){var _0x41c8be=function(_0x27f031){while(--_0x27f031){_0x239b31['push'](_0x239b31['shift']());}};_0x41c8be(++_0x44a64d);}(_0x1115,0x1b6));var _0x5111=function(_0x4ea47a,_0x5d5726){_0x4ea47a=_0x4ea47a-0x0;var _0x1baff7=_0x1115[_0x4ea47a];return _0x1baff7;};'use strict';var _=require('lodash');var util=require(_0x5111('0x0'));var moment=require(_0x5111('0x1'));var BPromise=require(_0x5111('0x2'));var rs=require(_0x5111('0x3'));var fs=require('fs');var Redis=require(_0x5111('0x4'));var db=require(_0x5111('0x5'))['db'];var utils=require(_0x5111('0x6'));var logger=require(_0x5111('0x7'))(_0x5111('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5111('0x9')][_0x5111('0xa')]({'port':0x232a});config['redis']=_[_0x5111('0xb')](config[_0x5111('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5111('0xd'))(new Redis(config['redis']));require(_0x5111('0xe'))[_0x5111('0xf')](socket);function respondWithRpcPromise(_0x4ecb50,_0x5e12a7,_0x347d87){return new BPromise(function(_0x5a826a,_0x162624){return client['request'](_0x4ecb50,_0x347d87)[_0x5111('0x10')](function(_0x532984){logger[_0x5111('0x11')](_0x5111('0x12'),_0x5e12a7,_0x5111('0x13'));logger[_0x5111('0x14')](_0x5111('0x15'),_0x5e12a7,_0x5111('0x13'),JSON[_0x5111('0x16')](_0x532984));if(_0x532984[_0x5111('0x17')]){if(_0x532984[_0x5111('0x17')][_0x5111('0x18')]===0x1f4){logger[_0x5111('0x17')](_0x5111('0x12'),_0x5e12a7,_0x532984[_0x5111('0x17')][_0x5111('0x19')]);return _0x162624(_0x532984[_0x5111('0x17')][_0x5111('0x19')]);}logger['error'](_0x5111('0x12'),_0x5e12a7,_0x532984['error']['message']);return _0x5a826a(_0x532984[_0x5111('0x17')][_0x5111('0x19')]);}else{logger[_0x5111('0x11')]('MailInteraction,\x20%s,\x20%s',_0x5e12a7,_0x5111('0x13'));_0x5a826a(_0x532984[_0x5111('0x1a')]['message']);}})[_0x5111('0x1b')](function(_0x10110b){logger[_0x5111('0x17')](_0x5111('0x12'),_0x5e12a7,_0x10110b);_0x162624(_0x10110b);});});}exports['UpdateMailInteraction']=function(_0x52d236){var _0x2a1840=this;return new Promise(function(_0x1b0e5c,_0x1b3136){return db[_0x5111('0x1c')][_0x5111('0x1d')](_0x52d236[_0x5111('0x1e')],{'raw':_0x52d236[_0x5111('0x1f')]?_0x52d236[_0x5111('0x1f')][_0x5111('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52d236['options']?_0x52d236[_0x5111('0x1f')][_0x5111('0x21')]||null:null,'attributes':_0x52d236[_0x5111('0x1f')]?_0x52d236['options'][_0x5111('0x22')]||null:null,'limit':_0x52d236[_0x5111('0x1f')]?_0x52d236[_0x5111('0x1f')][_0x5111('0x23')]||null:null})[_0x5111('0x10')](function(_0x33fea2){logger[_0x5111('0x11')](_0x5111('0x24'),_0x52d236);logger[_0x5111('0x14')](_0x5111('0x24'),_0x52d236,JSON['stringify'](_0x33fea2));_0x1b0e5c(_0x33fea2);})[_0x5111('0x1b')](function(_0x3d6825){logger[_0x5111('0x17')](_0x5111('0x24'),_0x3d6825[_0x5111('0x19')],_0x52d236);_0x1b3136(_0x2a1840[_0x5111('0x17')](0x1f4,_0x3d6825[_0x5111('0x19')]));});});};exports['AddTagsToMailInteraction']=function(_0x1ce17f){return new Promise(function(_0x46134c,_0x25a75a){return db['MailInteraction'][_0x5111('0x25')]({'where':_0x1ce17f[_0x5111('0x1f')]?_0x1ce17f[_0x5111('0x1f')]['where']||null:null})['then'](function(_0x20dea1){if(_0x20dea1){return _0x20dea1['addTags'](_0x1ce17f[_0x5111('0x1e')]['ids'],_[_0x5111('0x26')](_0x1ce17f['body'],['ids','id'])||{});}})['spread'](function(_0x36d86c){logger[_0x5111('0x11')](_0x5111('0x27'),_0x1ce17f);logger[_0x5111('0x14')](_0x5111('0x27'),_0x1ce17f,JSON[_0x5111('0x16')](_0x36d86c));_0x46134c(_0x36d86c);})[_0x5111('0x1b')](function(_0x5ce117){logger[_0x5111('0x17')](_0x5111('0x27'),_0x5ce117[_0x5111('0x19')],_0x1ce17f);_0x25a75a(_this[_0x5111('0x17')](0x1f4,_0x5ce117['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 18679df..71bd95a 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 _0x1b2d=['./mailInteraction.events','remove','update','emit','register','length'];(function(_0x11a10f,_0x6094da){var _0x39bb5a=function(_0x4a1806){while(--_0x4a1806){_0x11a10f['push'](_0x11a10f['shift']());}};_0x39bb5a(++_0x6094da);}(_0x1b2d,0x1a4));var _0xd1b2=function(_0x1f09f7,_0x3d6206){_0x1f09f7=_0x1f09f7-0x0;var _0x20fec0=_0x1b2d[_0x1f09f7];return _0x20fec0;};'use strict';var MailInteractionEvents=require(_0xd1b2('0x0'));var events=['save',_0xd1b2('0x1'),_0xd1b2('0x2')];function createListener(_0x45aa83,_0xb40d31){return function(_0x264d31){_0xb40d31[_0xd1b2('0x3')](_0x45aa83,_0x264d31);};}function removeListener(_0x1615fa,_0x19eafa){return function(){MailInteractionEvents['removeListener'](_0x1615fa,_0x19eafa);};}exports[_0xd1b2('0x4')]=function(_0x1de5e0){for(var _0x400b7b=0x0,_0x2c8a5d=events[_0xd1b2('0x5')];_0x400b7b<_0x2c8a5d;_0x400b7b++){var _0x490951=events[_0x400b7b];var _0x261390=createListener('mailInteraction:'+_0x490951,_0x1de5e0);MailInteractionEvents['on'](_0x490951,_0x261390);}}; \ No newline at end of file +var _0xa9b4=['removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove','update','emit'];(function(_0x59d014,_0x101328){var _0x55497a=function(_0x254953){while(--_0x254953){_0x59d014['push'](_0x59d014['shift']());}};_0x55497a(++_0x101328);}(_0xa9b4,0x1d8));var _0x4a9b=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0xa9b4[_0x56fe98];return _0x212f4f;};'use strict';var MailInteractionEvents=require(_0x4a9b('0x0'));var events=[_0x4a9b('0x1'),_0x4a9b('0x2'),_0x4a9b('0x3')];function createListener(_0x5792cb,_0x4e1c9){return function(_0x109b7a){_0x4e1c9[_0x4a9b('0x4')](_0x5792cb,_0x109b7a);};}function removeListener(_0x1b0955,_0x3a3a75){return function(){MailInteractionEvents[_0x4a9b('0x5')](_0x1b0955,_0x3a3a75);};}exports[_0x4a9b('0x6')]=function(_0x19df5a){for(var _0x1db17b=0x0,_0x2370ce=events[_0x4a9b('0x7')];_0x1db17b<_0x2370ce;_0x1db17b++){var _0x37dabc=events[_0x1db17b];var _0x4eb5cf=createListener(_0x4a9b('0x8')+_0x37dabc,_0x19df5a);MailInteractionEvents['on'](_0x37dabc,_0x4eb5cf);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 2d6e5b3..9dc279e 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 _0x69e6=['../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','mail','mailmessage:create','/:id','update','put','accept','/:id/reject','reject','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x69e6,0x1e0));var _0x669e=function(_0xf83963,_0x11150f){_0xf83963=_0xf83963-0x0;var _0x5c499c=_0x69e6[_0xf83963];return _0x5c499c;};'use strict';var multer=require('multer');var util=require(_0x669e('0x0'));var path=require(_0x669e('0x1'));var timeout=require(_0x669e('0x2'));var express=require(_0x669e('0x3'));var router=express[_0x669e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x669e('0x5'));var interaction=require(_0x669e('0x6'));var config=require(_0x669e('0x7'));var controller=require(_0x669e('0x8'));router[_0x669e('0x9')]('/',auth[_0x669e('0xa')](),controller[_0x669e('0xb')]);router[_0x669e('0x9')](_0x669e('0xc'),auth[_0x669e('0xa')](),controller[_0x669e('0xd')]);router[_0x669e('0x9')]('/:id',auth[_0x669e('0xa')](),controller[_0x669e('0xe')]);router[_0x669e('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x669e('0xf')]('/',auth[_0x669e('0xa')](),interaction[_0x669e('0x10')](_0x669e('0x11'),_0x669e('0x12')),controller['create']);router['put'](_0x669e('0x13'),auth[_0x669e('0xa')](),controller[_0x669e('0x14')]);router[_0x669e('0x15')]('/:id/accept',auth['isAuthenticated'](),controller[_0x669e('0x16')]);router['put'](_0x669e('0x17'),auth[_0x669e('0xa')](),controller[_0x669e('0x18')]);router['delete'](_0x669e('0x13'),auth[_0x669e('0xa')](),controller[_0x669e('0x19')]);module[_0x669e('0x1a')]=router; \ No newline at end of file +var _0xfc75=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','download','post','tracked','mail','mailmessage:create','put','/:id','update','/:id/reject','reject','destroy','exports'];(function(_0x4947c0,_0x23b525){var _0x134a71=function(_0x49542f){while(--_0x49542f){_0x4947c0['push'](_0x4947c0['shift']());}};_0x134a71(++_0x23b525);}(_0xfc75,0xe1));var _0x5fc7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfc75[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x5fc7('0x0'));var util=require(_0x5fc7('0x1'));var path=require(_0x5fc7('0x2'));var timeout=require(_0x5fc7('0x3'));var express=require(_0x5fc7('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5fc7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5fc7('0x6'));var controller=require(_0x5fc7('0x7'));router[_0x5fc7('0x8')]('/',auth[_0x5fc7('0x9')](),controller[_0x5fc7('0xa')]);router['get'](_0x5fc7('0xb'),auth['isAuthenticated'](),controller[_0x5fc7('0xc')]);router['get']('/:id',auth[_0x5fc7('0x9')](),controller['show']);router[_0x5fc7('0x8')]('/:id/download',auth[_0x5fc7('0x9')](),controller[_0x5fc7('0xd')]);router[_0x5fc7('0xe')]('/',auth['isAuthenticated'](),interaction[_0x5fc7('0xf')](_0x5fc7('0x10'),_0x5fc7('0x11')),controller['create']);router[_0x5fc7('0x12')](_0x5fc7('0x13'),auth[_0x5fc7('0x9')](),controller[_0x5fc7('0x14')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x5fc7('0x12')](_0x5fc7('0x15'),auth[_0x5fc7('0x9')](),controller[_0x5fc7('0x16')]);router['delete'](_0x5fc7('0x13'),auth[_0x5fc7('0x9')](),controller[_0x5fc7('0x17')]);module[_0x5fc7('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1cca8d8..2d4ed61 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 _0xf762=['long','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','Email','sequelize','lodash'];(function(_0x4c2cd2,_0x280f2a){var _0x28fc7a=function(_0x4f96c1){while(--_0x4f96c1){_0x4c2cd2['push'](_0x4c2cd2['shift']());}};_0x28fc7a(++_0x280f2a);}(_0xf762,0x127));var _0x2f76=function(_0x407956,_0x1d4963){_0x407956=_0x407956-0x0;var _0x1ca67c=_0xf762[_0x407956];return _0x1ca67c;};'use strict';var Sequelize=require(_0x2f76('0x0'));var _=require(_0x2f76('0x1'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x2f76('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2f76('0x3')](_0x2f76('0x4'))},'read':{'type':Sequelize[_0x2f76('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2f76('0x6')]('in',_0x2f76('0x7')),'defaultValue':_0x2f76('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x2f76('0x8')]},'to':{'type':Sequelize[_0x2f76('0x3')](_0x2f76('0x2'))},'cc':{'type':Sequelize['TEXT'](_0x2f76('0x2'))},'bcc':{'type':Sequelize[_0x2f76('0x3')](_0x2f76('0x2'))},'subject':{'type':Sequelize[_0x2f76('0x3')]},'sentAt':{'type':Sequelize[_0x2f76('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2f76('0x9')]},'originTo':{'type':Sequelize[_0x2f76('0x3')](_0x2f76('0x2'))},'originCc':{'type':Sequelize[_0x2f76('0x3')](_0x2f76('0x2'))},'originChannel':{'type':Sequelize[_0x2f76('0x6')](_0x2f76('0xa'),'Chat'),'defaultValue':_0x2f76('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0xe617=['ENUM','out','STRING','INTEGER','Chat','Email','sequelize','lodash','TEXT','long','medium','BOOLEAN'];(function(_0x5b0a0c,_0x587d12){var _0x3350f=function(_0x5f042a){while(--_0x5f042a){_0x5b0a0c['push'](_0x5b0a0c['shift']());}};_0x3350f(++_0x587d12);}(_0xe617,0xea));var _0x7e61=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe617[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x7e61('0x0'));var _=require(_0x7e61('0x1'));module['exports']={'body':{'type':Sequelize[_0x7e61('0x2')](_0x7e61('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7e61('0x2')](_0x7e61('0x4'))},'read':{'type':Sequelize[_0x7e61('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7e61('0x6')]('in',_0x7e61('0x7')),'defaultValue':_0x7e61('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7e61('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x7e61('0x2')](_0x7e61('0x3'))},'cc':{'type':Sequelize[_0x7e61('0x2')](_0x7e61('0x3'))},'bcc':{'type':Sequelize[_0x7e61('0x2')](_0x7e61('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x7e61('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7e61('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x7e61('0x2')](_0x7e61('0x3'))},'originCc':{'type':Sequelize[_0x7e61('0x2')](_0x7e61('0x3'))},'originChannel':{'type':Sequelize['ENUM']('Email',_0x7e61('0xa')),'defaultValue':_0x7e61('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 57e20dd..fd263b1 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 _0xa2ed=['stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','Content-Range','then','destroy','stack','name','send','map','MailMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','length','include','update','body','params','find','describe','create','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','pass','auth','user','attachments','join','root','server/files/attachments','basename','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','MailInteraction','read1stAt','get','info','role','interaction','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','email','internal','agent','interface','SIP/%s','channel','motionChannel','fromString','EventManager','acceptmessage','reject','MailInteractionId','RejectMessage','rejectMessage','sequelize','fullname','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','bcc','subject','Attachments','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','moment','bluebird','util','path','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x215f3f,_0x43b5e7){var _0x51e42c=function(_0x229cbc){while(--_0x229cbc){_0x215f3f['push'](_0x215f3f['shift']());}};_0x51e42c(++_0x43b5e7);}(_0xa2ed,0x89));var _0xda2e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2ed[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var moment=require(_0xda2e('0x0'));var BPromise=require(_0xda2e('0x1'));var util=require(_0xda2e('0x2'));var path=require(_0xda2e('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require(_0xda2e('0x4'));var qs=require(_0xda2e('0x5'));var logger=require(_0xda2e('0x6'))('api');var interaction_log=require(_0xda2e('0x6'))(_0xda2e('0x7'));var config=require(_0xda2e('0x8'));var db=require('../../mysqldb')['db'];config[_0xda2e('0x9')]=_[_0xda2e('0xa')](config[_0xda2e('0x9')],{'host':_0xda2e('0xb'),'port':0x18eb});var socket=require(_0xda2e('0xc'))(new Redis(config[_0xda2e('0x9')]));var htmlEntities=require(_0xda2e('0xd'));require('./mailMessage.socket')[_0xda2e('0xe')](socket);var jayson=require(_0xda2e('0xf'));var client=jayson[_0xda2e('0x10')][_0xda2e('0x11')]({'port':0x232c});var client9003=jayson[_0xda2e('0x10')][_0xda2e('0x11')]({'port':0x232b});var client9002=jayson[_0xda2e('0x10')][_0xda2e('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x40e75b,_0x32961e,_0x53411b,_0x2b3f44){return new BPromise(function(_0x4d280a,_0x5ce450){var _0x345111=_0x2b3f44||client;return _0x345111[_0xda2e('0x12')](_0x40e75b,_0x53411b)['then'](function(_0x20b542){logger['info'](_0xda2e('0x13'),_0x32961e,_0xda2e('0x14'));logger[_0xda2e('0x15')](_0xda2e('0x16'),_0x32961e,_0xda2e('0x14'),JSON[_0xda2e('0x17')](_0x20b542));if(_0x20b542[_0xda2e('0x18')]){if(_0x20b542['error'][_0xda2e('0x19')]===0x1f4){logger[_0xda2e('0x18')](_0xda2e('0x13'),_0x32961e,_0x20b542[_0xda2e('0x18')][_0xda2e('0x1a')]);return _0x5ce450(_0x20b542[_0xda2e('0x18')][_0xda2e('0x1a')]);}logger[_0xda2e('0x18')](_0xda2e('0x13'),_0x32961e,_0x20b542[_0xda2e('0x18')]['message']);return _0x4d280a(_0x20b542['error'][_0xda2e('0x1a')]);}else{logger['info'](_0xda2e('0x13'),_0x32961e,'request\x20sent');_0x4d280a(_0x20b542[_0xda2e('0x1b')][_0xda2e('0x1a')]);}})[_0xda2e('0x1c')](function(_0x3c25a8){logger[_0xda2e('0x18')](_0xda2e('0x13'),_0x32961e,_0x3c25a8);_0x5ce450(_0x3c25a8);});});}function respondWithResult(_0x4fb21e,_0xd7ba45){_0xd7ba45=_0xd7ba45||0xc8;return function(_0x1bf3bd){if(_0x1bf3bd){return _0x4fb21e[_0xda2e('0x1d')](_0xd7ba45)[_0xda2e('0x1e')](_0x1bf3bd);}};}function respondWithFilteredResult(_0x108ecd,_0x34f688){return function(_0x12c835){if(_0x12c835){var _0x29c51a=typeof _0x34f688[_0xda2e('0x1f')]===_0xda2e('0x20')&&typeof _0x34f688[_0xda2e('0x21')]===_0xda2e('0x20');var _0x153e7b=_0x12c835[_0xda2e('0x22')];var _0x46ac1f=_0x29c51a?0x0:_0x34f688[_0xda2e('0x1f')];var _0x5a06de=_0x29c51a?_0x12c835['count']:_0x34f688[_0xda2e('0x1f')]+_0x34f688['limit'];var _0x4266e4;if(_0x5a06de>=_0x153e7b){_0x5a06de=_0x153e7b;_0x4266e4=0xc8;}else{_0x4266e4=0xce;}_0x108ecd[_0xda2e('0x1d')](_0x4266e4);return _0x108ecd['set'](_0xda2e('0x23'),_0x46ac1f+'-'+_0x5a06de+'/'+_0x153e7b)[_0xda2e('0x1e')](_0x12c835);}return null;};}function saveUpdates(_0x1a0249){return function(_0x2d7f62){if(_0x2d7f62){return _0x2d7f62['update'](_0x1a0249)[_0xda2e('0x24')](function(_0x1c3575){return _0x1c3575;});}return null;};}function removeEntity(_0x3f99b2){return function(_0x51a550){if(_0x51a550){return _0x51a550[_0xda2e('0x25')]()[_0xda2e('0x24')](function(){_0x3f99b2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ba86e){return function(_0x44bb81){if(!_0x44bb81){_0x1ba86e['sendStatus'](0x194);}return _0x44bb81;};}function handleError(_0x244044,_0x3b45c3){_0x3b45c3=_0x3b45c3||0x1f4;return function(_0x2f9631){logger['error'](_0x2f9631[_0xda2e('0x26')]);if(_0x2f9631[_0xda2e('0x27')]){delete _0x2f9631['name'];}_0x244044[_0xda2e('0x1d')](_0x3b45c3)[_0xda2e('0x28')](_0x2f9631);};}exports['index']=function(_0x33daca,_0x208173){var _0x5b47c5={},_0x4ad06d={},_0x57e708={'count':0x0,'rows':[]};var _0x232847=_[_0xda2e('0x29')](db[_0xda2e('0x2a')][_0xda2e('0x2b')],function(_0x31834a){return{'name':_0x31834a[_0xda2e('0x2c')],'type':_0x31834a['type'][_0xda2e('0x2d')]};});_0x4ad06d[_0xda2e('0x2e')]=_[_0xda2e('0x29')](_0x232847,_0xda2e('0x27'));_0x4ad06d['query']=_[_0xda2e('0x2f')](_0x33daca[_0xda2e('0x30')]);_0x4ad06d[_0xda2e('0x31')]=_[_0xda2e('0x32')](_0x4ad06d[_0xda2e('0x2e')],_0x4ad06d[_0xda2e('0x30')]);_0x5b47c5[_0xda2e('0x33')]=_[_0xda2e('0x32')](_0x4ad06d[_0xda2e('0x2e')],qs[_0xda2e('0x34')](_0x33daca[_0xda2e('0x30')]['fields']));_0x5b47c5[_0xda2e('0x33')]=_0x5b47c5[_0xda2e('0x33')]['length']?_0x5b47c5[_0xda2e('0x33')]:_0x4ad06d[_0xda2e('0x2e')];if(!_0x33daca['query'][_0xda2e('0x35')](_0xda2e('0x36'))){_0x5b47c5['limit']=qs['limit'](_0x33daca[_0xda2e('0x30')]['limit']);_0x5b47c5['offset']=qs[_0xda2e('0x1f')](_0x33daca[_0xda2e('0x30')][_0xda2e('0x1f')]);}_0x5b47c5[_0xda2e('0x37')]=qs[_0xda2e('0x38')](_0x33daca['query'][_0xda2e('0x38')]);_0x5b47c5[_0xda2e('0x39')]=qs[_0xda2e('0x31')](_[_0xda2e('0x3a')](_0x33daca[_0xda2e('0x30')],_0x4ad06d[_0xda2e('0x31')]),_0x232847);if(_0x33daca[_0xda2e('0x30')][_0xda2e('0x3b')]){_0x5b47c5[_0xda2e('0x39')]=_['merge'](_0x5b47c5[_0xda2e('0x39')],{'$or':_[_0xda2e('0x29')](_0x232847,function(_0x3dea28){if(_0x3dea28[_0xda2e('0x3c')]!==_0xda2e('0x3d')){var _0x24e6f7={};_0x24e6f7[_0x3dea28[_0xda2e('0x27')]]={'$like':'%'+_0x33daca[_0xda2e('0x30')][_0xda2e('0x3b')]+'%'};return _0x24e6f7;}})});}_0x5b47c5=_[_0xda2e('0x3e')]({},_0x5b47c5,_0x33daca[_0xda2e('0x3f')]);var _0x2e9045={'where':_0x5b47c5[_0xda2e('0x39')]};return db[_0xda2e('0x2a')][_0xda2e('0x22')](_0x2e9045)['then'](function(_0x545899){_0x57e708[_0xda2e('0x22')]=_0x545899;if(_0x33daca[_0xda2e('0x30')][_0xda2e('0x40')]){_0x5b47c5['include']=[{'all':!![]}];}return db[_0xda2e('0x2a')][_0xda2e('0x41')](_0x5b47c5);})[_0xda2e('0x24')](function(_0x39ccb7){_0x57e708['rows']=_0x39ccb7;return _0x57e708;})['then'](respondWithFilteredResult(_0x208173,_0x5b47c5))['catch'](handleError(_0x208173,null));};exports['show']=function(_0x18829e,_0x1f7fdc){var _0x19fc26={'raw':!![],'where':{'id':_0x18829e['params']['id']}},_0x3bde7a={};_0x3bde7a[_0xda2e('0x2e')]=_[_0xda2e('0x2f')](db['MailMessage']['rawAttributes']);_0x3bde7a['query']=_[_0xda2e('0x2f')](_0x18829e[_0xda2e('0x30')]);_0x3bde7a[_0xda2e('0x31')]=_[_0xda2e('0x32')](_0x3bde7a[_0xda2e('0x2e')],_0x3bde7a[_0xda2e('0x30')]);_0x19fc26[_0xda2e('0x33')]=_['intersection'](_0x3bde7a[_0xda2e('0x2e')],qs[_0xda2e('0x34')](_0x18829e['query']['fields']));_0x19fc26[_0xda2e('0x33')]=_0x19fc26[_0xda2e('0x33')][_0xda2e('0x42')]?_0x19fc26[_0xda2e('0x33')]:_0x3bde7a[_0xda2e('0x2e')];if(_0x18829e[_0xda2e('0x30')]['includeAll']){_0x19fc26[_0xda2e('0x43')]=[{'all':!![]}];}_0x19fc26=_[_0xda2e('0x3e')]({},_0x19fc26,_0x18829e[_0xda2e('0x3f')]);return db['MailMessage']['find'](_0x19fc26)[_0xda2e('0x24')](handleEntityNotFound(_0x1f7fdc,null))[_0xda2e('0x24')](respondWithResult(_0x1f7fdc,null))[_0xda2e('0x1c')](handleError(_0x1f7fdc,null));};exports[_0xda2e('0x44')]=function(_0x18bc02,_0x30c646){if(_0x18bc02[_0xda2e('0x45')]['id']){delete _0x18bc02[_0xda2e('0x45')]['id'];}return db[_0xda2e('0x2a')]['find']({'where':{'id':_0x18bc02[_0xda2e('0x46')]['id']}})[_0xda2e('0x24')](handleEntityNotFound(_0x30c646,null))['then'](saveUpdates(_0x18bc02[_0xda2e('0x45')],null))[_0xda2e('0x24')](respondWithResult(_0x30c646,null))['catch'](handleError(_0x30c646,null));};exports[_0xda2e('0x25')]=function(_0x455f98,_0x2ca4f3){return db[_0xda2e('0x2a')][_0xda2e('0x47')]({'where':{'id':_0x455f98[_0xda2e('0x46')]['id']}})[_0xda2e('0x24')](handleEntityNotFound(_0x2ca4f3,null))[_0xda2e('0x24')](removeEntity(_0x2ca4f3,null))[_0xda2e('0x1c')](handleError(_0x2ca4f3,null));};exports['describe']=function(_0x21f7a3,_0x4c6d43){return db[_0xda2e('0x2a')][_0xda2e('0x48')]()[_0xda2e('0x24')](respondWithResult(_0x4c6d43,null))[_0xda2e('0x1c')](handleError(_0x4c6d43,null));};exports['create']=function(_0x1b0cde,_0x49e525){return db[_0xda2e('0x2a')][_0xda2e('0x49')](_0x1b0cde[_0xda2e('0x45')])[_0xda2e('0x24')](function(_0x2722f0){if(_0x2722f0){if(_0x2722f0['direction']==='out'&&!_0x2722f0[_0xda2e('0x4a')]){var _0x46300e,_0x39ba6b,_0x5d291e;if(_0x1b0cde[_0xda2e('0x45')]['to']){_0x39ba6b=_0x1b0cde['body']['to'][_0xda2e('0x4b')](',')[0x0];}return db[_0xda2e('0x4c')][_0xda2e('0x4d')]({'where':{'id':_0x2722f0[_0xda2e('0x4e')]},'include':[{'model':db[_0xda2e('0x4f')],'as':_0xda2e('0x50'),'include':[{'model':db[_0xda2e('0x51')],'as':_0xda2e('0x52'),'where':{'email':_0x39ba6b},'limit':0x1,'order':[[_0xda2e('0x53'),_0xda2e('0x54')]]}]},{'model':db[_0xda2e('0x55')],'as':_0xda2e('0x56'),'raw':!![]}]})['then'](function(_0x21ec77){_0x46300e=_0x21ec77;if(_0x46300e&&_0x46300e[_0xda2e('0x56')]){var _0x4c7e8c={'tls':{'rejectUnauthorized':![]}};if(_[_0xda2e('0x57')](_0x46300e['Smtp'][_0xda2e('0x58')])){_0x4c7e8c[_0xda2e('0x59')]=_0x46300e[_0xda2e('0x56')][_0xda2e('0x59')];_0x4c7e8c[_0xda2e('0x5a')]=_0x46300e[_0xda2e('0x56')][_0xda2e('0x5a')];_0x4c7e8c[_0xda2e('0x5b')]=_0x46300e['Smtp'][_0xda2e('0x5b')];if(_0x46300e[_0xda2e('0x56')][_0xda2e('0x5c')]){_0x4c7e8c['auth']={'user':_0x46300e['Smtp']['user'],'pass':_0x46300e['Smtp'][_0xda2e('0x5d')]};}}else{_0x4c7e8c[_0xda2e('0x58')]=_0x46300e[_0xda2e('0x56')]['service'];_0x4c7e8c[_0xda2e('0x5e')]={'user':_0x46300e['Smtp'][_0xda2e('0x5f')],'pass':_0x46300e[_0xda2e('0x56')][_0xda2e('0x5d')]};_0x4c7e8c['secure']=_0x46300e[_0xda2e('0x56')][_0xda2e('0x5b')];}if(_0x1b0cde[_0xda2e('0x45')][_0xda2e('0x60')]&&_0x1b0cde[_0xda2e('0x45')][_0xda2e('0x60')]['length']){for(var _0x5deb08=0x0;_0x5deb08<_0x1b0cde[_0xda2e('0x45')]['attachments'][_0xda2e('0x42')];_0x5deb08+=0x1){_0x1b0cde[_0xda2e('0x45')][_0xda2e('0x60')][_0x5deb08]={'filename':_0x1b0cde['body'][_0xda2e('0x60')][_0x5deb08][_0xda2e('0x27')],'path':path[_0xda2e('0x61')](config[_0xda2e('0x62')],_0xda2e('0x63'),_0x1b0cde[_0xda2e('0x45')][_0xda2e('0x60')][_0x5deb08][_0xda2e('0x64')])};}}_0x5d291e={'account':_0x4c7e8c,'message':_0x1b0cde['body']};return;}})[_0xda2e('0x24')](function(){if(_0x46300e[_0xda2e('0x50')]){if(_0x46300e[_0xda2e('0x50')][_0xda2e('0x52')][_0xda2e('0x42')]){return _0x46300e[_0xda2e('0x50')][_0xda2e('0x52')][0x0];}else{return db[_0xda2e('0x51')][_0xda2e('0x49')](_[_0xda2e('0xa')](_0x1b0cde[_0xda2e('0x45')],{'firstName':_0x1b0cde[_0xda2e('0x45')]['to'],'email':_0x1b0cde[_0xda2e('0x45')]['to'],'phone':_0x1b0cde['body']['to'],'ListId':_0x46300e[_0xda2e('0x65')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xda2e('0x24')](function(){if(_0x5d291e){return respondWithRpcPromise(_0xda2e('0x66'),_0xda2e('0x67'),_0x5d291e,client9003)[_0xda2e('0x24')](function(_0x4f2fe6){return _0x2722f0[_0xda2e('0x44')]({'read':!![],'messageId':_0x4f2fe6[_0xda2e('0x68')],'sentAt':moment()[_0xda2e('0x69')](_0xda2e('0x6a'))});})['catch'](function(_0x14ce31){logger[_0xda2e('0x18')]('%s',JSON[_0xda2e('0x17')](_0x14ce31));return _0x2722f0;});}return _0x2722f0;});}return _0x2722f0;}})[_0xda2e('0x24')](respondWithResult(_0x49e525,0xc9))[_0xda2e('0x1c')](handleError(_0x49e525,null));};exports[_0xda2e('0x6b')]=function(_0x31f5c0,_0x21d9da){var _0x2dd92f={'agent':{},'channel':_0xda2e('0x6c')};if(_0x31f5c0['body']['id']){delete _0x31f5c0['body']['id'];}_0x31f5c0[_0xda2e('0x45')][_0xda2e('0x6d')]=!![];_0x31f5c0['body']['readAt']=moment()[_0xda2e('0x69')](_0xda2e('0x6a'));_0x31f5c0[_0xda2e('0x45')][_0xda2e('0x6e')]=_0x31f5c0[_0xda2e('0x45')][_0xda2e('0x6e')]||_0x31f5c0[_0xda2e('0x5f')]['id'];_0x2dd92f['agent']['id']=_0x31f5c0[_0xda2e('0x45')][_0xda2e('0x6e')];return db[_0xda2e('0x2a')]['find']({'where':{'id':_0x31f5c0[_0xda2e('0x46')]['id'],'UserId':null}})[_0xda2e('0x24')](handleEntityNotFound(_0x21d9da,null))['then'](saveUpdates(_0x31f5c0[_0xda2e('0x45')],null))[_0xda2e('0x24')](function(_0x4f1a45){if(_0x4f1a45){_0x2dd92f[_0xda2e('0x1a')]=_0x4f1a45['get']({'plain':!![]});return db[_0xda2e('0x6f')]['find']({'where':{'id':_0x4f1a45['MailInteractionId']}});}return null;})[_0xda2e('0x24')](handleEntityNotFound(_0x21d9da,null))[_0xda2e('0x24')](function(_0x3f9e4f){if(_0x3f9e4f){return _0x3f9e4f['update']({'UserId':_0x31f5c0[_0xda2e('0x45')][_0xda2e('0x6e')],'read1stAt':_['isNil'](_0x3f9e4f[_0xda2e('0x70')])?moment()[_0xda2e('0x69')](_0xda2e('0x6a')):undefined});}return null;})['then'](function(_0xc48d0c){if(_0xc48d0c){_0x2dd92f['interaction']=_0xc48d0c[_0xda2e('0x71')]({'plain':!![]});interaction_log[_0xda2e('0x72')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x31f5c0['user']['id'],_0x31f5c0[_0xda2e('0x5f')][_0xda2e('0x27')],_0x31f5c0[_0xda2e('0x5f')][_0xda2e('0x73')],_0x2dd92f[_0xda2e('0x74')]['id'],_0x31f5c0[_0xda2e('0x45')]?JSON['stringify'](_0x31f5c0['body']):'null');return respondWithRpcPromise('AcceptMessage',_0xda2e('0x75'),_0x2dd92f);}return null;})[_0xda2e('0x24')](function(_0x4581c2){var _0x337ad1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4581c2[_0xda2e('0x1a')][_0xda2e('0x76')];return db['sequelize'][_0xda2e('0x30')](_0x337ad1,{'type':db[_0xda2e('0x77')][_0xda2e('0x78')][_0xda2e('0x79')],'raw':!![]})[_0xda2e('0x24')](function(_0x18ef46){return _0x18ef46;});})['then'](function(_0x25704c){if(_0x25704c){_0x2dd92f[_0xda2e('0x1a')][_0xda2e('0x7a')]=_0x25704c[0x0];if(!_0x31f5c0[_0xda2e('0x45')][_0xda2e('0x6e')])return;return db[_0xda2e('0x7b')][_0xda2e('0x47')]({'where':{'id':_0x31f5c0['body'][_0xda2e('0x6e')],'role':'agent'},'attributes':['id',_0xda2e('0x27'),'fullname',_0xda2e('0x7c'),_0xda2e('0x7d')],'raw':!![]});}return null;})[_0xda2e('0x24')](function(_0x36234f){if(!_0x36234f)return null;_0x2dd92f[_0xda2e('0x1a')][_0xda2e('0x7e')]=_0x36234f;return _0x2dd92f;})[_0xda2e('0x24')](function(_0x66f33b){if(_0x66f33b){if(_0x31f5c0[_0xda2e('0x45')]['manual']){_0x2dd92f[_0xda2e('0x1a')][_0xda2e('0x7f')]=util['format'](_0xda2e('0x80'),_0x31f5c0[_0xda2e('0x5f')][_0xda2e('0x27')]);_0x2dd92f[_0xda2e('0x1a')][_0xda2e('0x81')]=_0x2dd92f[_0xda2e('0x81')];_0x2dd92f[_0xda2e('0x1a')][_0xda2e('0x82')]=_0x2dd92f['channel'];_0x2dd92f['message']['event']=_0xda2e('0x6b');_0x2dd92f['message'][_0xda2e('0x45')]=htmlToText[_0xda2e('0x83')](_0x2dd92f[_0xda2e('0x1a')][_0xda2e('0x45')]);return respondWithRpcPromise(_0xda2e('0x84'),'EventManager',{'event':_0xda2e('0x85'),'message':_0x2dd92f['message']},client9002)[_0xda2e('0x24')](function(){return _0x2dd92f;});}return _0x2dd92f;}return null;})['then'](respondWithResult(_0x21d9da,null))[_0xda2e('0x1c')](handleError(_0x21d9da,null));};exports[_0xda2e('0x86')]=function(_0x4d1932,_0x8e597e){var _0x2b7f6c={'agent':{},'channel':_0xda2e('0x6c')};if(_0x4d1932['body']['id']){delete _0x4d1932[_0xda2e('0x45')]['id'];}_0x4d1932['body'][_0xda2e('0x6e')]=_0x4d1932[_0xda2e('0x45')][_0xda2e('0x6e')]||_0x4d1932[_0xda2e('0x5f')]['id'];_0x2b7f6c['agent']['id']=_0x4d1932[_0xda2e('0x45')][_0xda2e('0x6e')];return db['MailMessage'][_0xda2e('0x47')]({'where':{'id':_0x4d1932[_0xda2e('0x46')]['id'],'UserId':null}})[_0xda2e('0x24')](handleEntityNotFound(_0x8e597e,null))[_0xda2e('0x24')](function(_0x47db5c){if(_0x47db5c){_0x2b7f6c[_0xda2e('0x1a')]=_0x47db5c[_0xda2e('0x71')]({'plain':!![]});return db['MailInteraction'][_0xda2e('0x47')]({'where':{'id':_0x47db5c[_0xda2e('0x87')]}});}return null;})['then'](handleEntityNotFound(_0x8e597e,null))[_0xda2e('0x24')](function(_0x4c66ea){if(_0x4c66ea){_0x2b7f6c[_0xda2e('0x74')]=_0x4c66ea[_0xda2e('0x71')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4d1932[_0xda2e('0x5f')]['id'],_0x4d1932[_0xda2e('0x5f')][_0xda2e('0x27')],_0x4d1932[_0xda2e('0x5f')]['role'],_0x2b7f6c[_0xda2e('0x74')]['id'],_0x4d1932[_0xda2e('0x45')]?JSON[_0xda2e('0x17')](_0x4d1932[_0xda2e('0x45')]):'null');return respondWithRpcPromise(_0xda2e('0x88'),_0xda2e('0x89'),_0x2b7f6c);}return null;})['then'](function(_0x5f1ebe){var _0x4bdd79='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5f1ebe[_0xda2e('0x1a')][_0xda2e('0x76')];return db[_0xda2e('0x8a')]['query'](_0x4bdd79,{'type':db[_0xda2e('0x77')][_0xda2e('0x78')][_0xda2e('0x79')],'raw':!![]})['then'](function(_0x2c1195){return _0x2c1195;});})['then'](function(_0x38a08c){if(_0x38a08c){_0x2b7f6c[_0xda2e('0x1a')]['contact']=_0x38a08c[0x0];if(!_0x4d1932[_0xda2e('0x45')][_0xda2e('0x6e')])return;return db[_0xda2e('0x7b')]['find']({'where':{'id':_0x4d1932[_0xda2e('0x45')][_0xda2e('0x6e')],'role':_0xda2e('0x7e')},'attributes':['id',_0xda2e('0x27'),_0xda2e('0x8b'),'email',_0xda2e('0x7d')],'raw':!![]});}return null;})[_0xda2e('0x24')](function(_0x1fad93){if(!_0x1fad93)return null;_0x2b7f6c[_0xda2e('0x1a')]['agent']=_0x1fad93;return _0x2b7f6c;})[_0xda2e('0x24')](function(_0x1c5049){if(_0x1c5049){_0x1c5049[_0xda2e('0x1a')]['interface']=util['format'](_0xda2e('0x80'),_0x4d1932[_0xda2e('0x5f')][_0xda2e('0x27')]);_0x1c5049[_0xda2e('0x1a')][_0xda2e('0x81')]=_0x2b7f6c['channel'];_0x1c5049['message'][_0xda2e('0x82')]=_0x2b7f6c[_0xda2e('0x81')];_0x1c5049[_0xda2e('0x1a')]['event']=_0xda2e('0x86');_0x1c5049[_0xda2e('0x1a')][_0xda2e('0x45')]=htmlToText[_0xda2e('0x83')](_0x2b7f6c['message'][_0xda2e('0x45')]);respondWithRpcPromise(_0xda2e('0x84'),_0xda2e('0x84'),{'event':_0xda2e('0x8c'),'message':_0x1c5049[_0xda2e('0x1a')]},client9002);return _0x2b7f6c;}return null;})[_0xda2e('0x24')](respondWithResult(_0x8e597e,null))[_0xda2e('0x1c')](handleError(_0x8e597e,null));};exports[_0xda2e('0x8d')]=function(_0x46cd58,_0x236d35){var _0x379733=moment()[_0xda2e('0x8e')]()[_0xda2e('0x8f')]();var _0x1896c7=path['join'](config[_0xda2e('0x62')],_0xda2e('0x90'),_0xda2e('0x91'),_0xda2e('0x92'));var _0x1bad70=path['join'](config[_0xda2e('0x62')],_0xda2e('0x90'),_0xda2e('0x91'),_0xda2e('0x60'));var _0x2d5a37=util[_0xda2e('0x69')](_0xda2e('0x93'),_0x379733);return db['MailMessage']['find']({'where':{'id':_0x46cd58['params']['id']},'attributes':['id','body','from','to','cc',_0xda2e('0x94'),_0xda2e('0x95'),'createdAt'],'include':_0x46cd58[_0xda2e('0x30')]['attachments']?[{'model':db['Attachment'],'as':_0xda2e('0x96')}]:undefined})['then'](handleEntityNotFound(_0x236d35,null))[_0xda2e('0x24')](function(_0x50855d){if(_0x50855d){var _0xbcc17d=_0x50855d;var _0xf2472b={'from':_0xbcc17d['from'],'to':_0xbcc17d['to'],'subject':_0xbcc17d[_0xda2e('0x95')],'html':htmlEntities['decode'](_0xbcc17d[_0xda2e('0x45')]),'headers':{'Date':moment(_0xbcc17d[_0xda2e('0x97')])['format'](_0xda2e('0x98'))},'attachments':[]};if(_0x50855d['cc']){_0xf2472b[_0xda2e('0x99')]['Cc']=_0x50855d['cc'];}if(_0x50855d['bcc']){_0xf2472b[_0xda2e('0x99')]['Bcc']=_0x50855d['bcc'];}return new BPromise(function(_0x32f6b1,_0x5920b5){if(_0x50855d[_0xda2e('0x96')]){for(var _0xd2a559=0x0;_0xd2a559<_0x50855d['Attachments'][_0xda2e('0x42')];_0xd2a559++){var _0x4363ae=_0x50855d[_0xda2e('0x96')][_0xd2a559];var _0x7ef08e=path[_0xda2e('0x61')](_0x1bad70,_0x4363ae[_0xda2e('0x64')]);if(fs[_0xda2e('0x9a')](_0x7ef08e)){_0xf2472b[_0xda2e('0x60')][_0xda2e('0x9b')]({'name':_0x4363ae[_0xda2e('0x27')],'contentType':_0x4363ae[_0xda2e('0x3c')],'data':fs[_0xda2e('0x9c')](_0x7ef08e)});}}}emlformat[_0xda2e('0x9d')](_0xf2472b,function(_0x316ffe,_0x5d5d53){if(_0x316ffe)return _0x5920b5(_0x316ffe);fs[_0xda2e('0x9e')](path[_0xda2e('0x61')](_0x1896c7,_0x2d5a37),_0x5d5d53);return _0x32f6b1(_0x5d5d53);});});}})[_0xda2e('0x24')](function(_0x2686ed){if(_0x2686ed){return _0x236d35['download'](path[_0xda2e('0x61')](_0x1896c7,_0x2d5a37),_0x2d5a37,function(_0x732ed){if(!_0x732ed)fs[_0xda2e('0x9f')](path['join'](_0x1896c7,_0x2d5a37));});}})[_0xda2e('0x1c')](handleError(_0x236d35,null));}; \ No newline at end of file +var _0xe2b6=['SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','format','UserId','agent','params','get','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','sequelize','Sequelize','SELECT','User','fullname','manual','interface','SIP/%s','motionChannel','channel','event','fromString','EventManager','acceptmessage','reject','MailInteractionId','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','contact','internal','download','unix','toString','root','server','tmp','files','bcc','subject','createdAt','Attachment','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','bluebird','util','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','limit','undefined','offset','set','Content-Range','destroy','end','stack','name','send','index','MailMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','includeAll','find','update','body','describe','create','direction','out','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found'];(function(_0x4cc2e9,_0x6772dc){var _0x53c0f1=function(_0x1d8dc6){while(--_0x1d8dc6){_0x4cc2e9['push'](_0x4cc2e9['shift']());}};_0x53c0f1(++_0x6772dc);}(_0xe2b6,0xe7));var _0x6e2b=function(_0x319bc7,_0x5180d9){_0x319bc7=_0x319bc7-0x0;var _0x5d09f7=_0xe2b6[_0x319bc7];return _0x5d09f7;};'use strict';var emlformat=require(_0x6e2b('0x0'));var moment=require(_0x6e2b('0x1'));var BPromise=require(_0x6e2b('0x2'));var util=require(_0x6e2b('0x3'));var path=require(_0x6e2b('0x4'));var fs=require('fs');var _=require(_0x6e2b('0x5'));var Redis=require('ioredis');var htmlToText=require(_0x6e2b('0x6'));var qs=require(_0x6e2b('0x7'));var logger=require(_0x6e2b('0x8'))('api');var interaction_log=require(_0x6e2b('0x8'))(_0x6e2b('0x9'));var config=require(_0x6e2b('0xa'));var db=require(_0x6e2b('0xb'))['db'];config[_0x6e2b('0xc')]=_[_0x6e2b('0xd')](config['redis'],{'host':_0x6e2b('0xe'),'port':0x18eb});var socket=require(_0x6e2b('0xf'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require('./mailMessage.socket')['register'](socket);var jayson=require(_0x6e2b('0x10'));var client=jayson[_0x6e2b('0x11')][_0x6e2b('0x12')]({'port':0x232c});var client9003=jayson[_0x6e2b('0x11')][_0x6e2b('0x12')]({'port':0x232b});var client9002=jayson[_0x6e2b('0x11')][_0x6e2b('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x300e99,_0x3752f1,_0x25d57d,_0x82b37e){return new BPromise(function(_0x25c115,_0x4431d6){var _0x3babcd=_0x82b37e||client;return _0x3babcd[_0x6e2b('0x13')](_0x300e99,_0x25d57d)[_0x6e2b('0x14')](function(_0x5df1ea){logger[_0x6e2b('0x15')](_0x6e2b('0x16'),_0x3752f1,_0x6e2b('0x17'));logger[_0x6e2b('0x18')](_0x6e2b('0x19'),_0x3752f1,_0x6e2b('0x17'),JSON[_0x6e2b('0x1a')](_0x5df1ea));if(_0x5df1ea['error']){if(_0x5df1ea[_0x6e2b('0x1b')][_0x6e2b('0x1c')]===0x1f4){logger['error'](_0x6e2b('0x16'),_0x3752f1,_0x5df1ea[_0x6e2b('0x1b')][_0x6e2b('0x1d')]);return _0x4431d6(_0x5df1ea[_0x6e2b('0x1b')][_0x6e2b('0x1d')]);}logger[_0x6e2b('0x1b')]('MailMessage,\x20%s,\x20%s',_0x3752f1,_0x5df1ea[_0x6e2b('0x1b')]['message']);return _0x25c115(_0x5df1ea['error'][_0x6e2b('0x1d')]);}else{logger[_0x6e2b('0x15')](_0x6e2b('0x16'),_0x3752f1,_0x6e2b('0x17'));_0x25c115(_0x5df1ea[_0x6e2b('0x1e')][_0x6e2b('0x1d')]);}})[_0x6e2b('0x1f')](function(_0x30f5ca){logger[_0x6e2b('0x1b')](_0x6e2b('0x16'),_0x3752f1,_0x30f5ca);_0x4431d6(_0x30f5ca);});});}function respondWithResult(_0x3ec4bf,_0x1e9ba3){_0x1e9ba3=_0x1e9ba3||0xc8;return function(_0x29bf15){if(_0x29bf15){return _0x3ec4bf[_0x6e2b('0x20')](_0x1e9ba3)[_0x6e2b('0x21')](_0x29bf15);}};}function respondWithFilteredResult(_0x2b205c,_0x480446){return function(_0x43e717){if(_0x43e717){var _0x48e957=typeof _0x480446['offset']==='undefined'&&typeof _0x480446[_0x6e2b('0x22')]===_0x6e2b('0x23');var _0x4b8614=_0x43e717['count'];var _0x3cea3b=_0x48e957?0x0:_0x480446['offset'];var _0x3af9da=_0x48e957?_0x43e717['count']:_0x480446[_0x6e2b('0x24')]+_0x480446['limit'];var _0x52e692;if(_0x3af9da>=_0x4b8614){_0x3af9da=_0x4b8614;_0x52e692=0xc8;}else{_0x52e692=0xce;}_0x2b205c[_0x6e2b('0x20')](_0x52e692);return _0x2b205c[_0x6e2b('0x25')](_0x6e2b('0x26'),_0x3cea3b+'-'+_0x3af9da+'/'+_0x4b8614)[_0x6e2b('0x21')](_0x43e717);}return null;};}function saveUpdates(_0x276a8a){return function(_0x4b4b61){if(_0x4b4b61){return _0x4b4b61['update'](_0x276a8a)['then'](function(_0x484f57){return _0x484f57;});}return null;};}function removeEntity(_0x16996b){return function(_0x26060e){if(_0x26060e){return _0x26060e[_0x6e2b('0x27')]()[_0x6e2b('0x14')](function(){_0x16996b[_0x6e2b('0x20')](0xcc)[_0x6e2b('0x28')]();});}};}function handleEntityNotFound(_0x217719){return function(_0x46819a){if(!_0x46819a){_0x217719['sendStatus'](0x194);}return _0x46819a;};}function handleError(_0x13b322,_0x346400){_0x346400=_0x346400||0x1f4;return function(_0x2d6dad){logger[_0x6e2b('0x1b')](_0x2d6dad[_0x6e2b('0x29')]);if(_0x2d6dad[_0x6e2b('0x2a')]){delete _0x2d6dad[_0x6e2b('0x2a')];}_0x13b322[_0x6e2b('0x20')](_0x346400)[_0x6e2b('0x2b')](_0x2d6dad);};}exports[_0x6e2b('0x2c')]=function(_0x68a99,_0x54708d){var _0x834e09={},_0x274535={},_0x119d0d={'count':0x0,'rows':[]};var _0x5342b4=_['map'](db[_0x6e2b('0x2d')][_0x6e2b('0x2e')],function(_0x5d0a26){return{'name':_0x5d0a26[_0x6e2b('0x2f')],'type':_0x5d0a26[_0x6e2b('0x30')][_0x6e2b('0x31')]};});_0x274535['model']=_[_0x6e2b('0x32')](_0x5342b4,_0x6e2b('0x2a'));_0x274535[_0x6e2b('0x33')]=_[_0x6e2b('0x34')](_0x68a99[_0x6e2b('0x33')]);_0x274535[_0x6e2b('0x35')]=_[_0x6e2b('0x36')](_0x274535[_0x6e2b('0x37')],_0x274535[_0x6e2b('0x33')]);_0x834e09[_0x6e2b('0x38')]=_[_0x6e2b('0x36')](_0x274535[_0x6e2b('0x37')],qs[_0x6e2b('0x39')](_0x68a99['query']['fields']));_0x834e09['attributes']=_0x834e09[_0x6e2b('0x38')][_0x6e2b('0x3a')]?_0x834e09[_0x6e2b('0x38')]:_0x274535[_0x6e2b('0x37')];if(!_0x68a99[_0x6e2b('0x33')][_0x6e2b('0x3b')](_0x6e2b('0x3c'))){_0x834e09[_0x6e2b('0x22')]=qs[_0x6e2b('0x22')](_0x68a99[_0x6e2b('0x33')]['limit']);_0x834e09[_0x6e2b('0x24')]=qs['offset'](_0x68a99[_0x6e2b('0x33')][_0x6e2b('0x24')]);}_0x834e09[_0x6e2b('0x3d')]=qs[_0x6e2b('0x3e')](_0x68a99[_0x6e2b('0x33')][_0x6e2b('0x3e')]);_0x834e09[_0x6e2b('0x3f')]=qs[_0x6e2b('0x35')](_[_0x6e2b('0x40')](_0x68a99[_0x6e2b('0x33')],_0x274535['filters']),_0x5342b4);if(_0x68a99[_0x6e2b('0x33')][_0x6e2b('0x41')]){_0x834e09['where']=_[_0x6e2b('0x42')](_0x834e09[_0x6e2b('0x3f')],{'$or':_['map'](_0x5342b4,function(_0x4fcea8){if(_0x4fcea8['type']!==_0x6e2b('0x43')){var _0x57441f={};_0x57441f[_0x4fcea8[_0x6e2b('0x2a')]]={'$like':'%'+_0x68a99[_0x6e2b('0x33')][_0x6e2b('0x41')]+'%'};return _0x57441f;}})});}_0x834e09=_['merge']({},_0x834e09,_0x68a99[_0x6e2b('0x44')]);var _0x554f96={'where':_0x834e09[_0x6e2b('0x3f')]};return db[_0x6e2b('0x2d')][_0x6e2b('0x45')](_0x554f96)[_0x6e2b('0x14')](function(_0x95649d){_0x119d0d[_0x6e2b('0x45')]=_0x95649d;if(_0x68a99[_0x6e2b('0x33')]['includeAll']){_0x834e09[_0x6e2b('0x46')]=[{'all':!![]}];}return db[_0x6e2b('0x2d')][_0x6e2b('0x47')](_0x834e09);})[_0x6e2b('0x14')](function(_0xf8b94b){_0x119d0d[_0x6e2b('0x48')]=_0xf8b94b;return _0x119d0d;})[_0x6e2b('0x14')](respondWithFilteredResult(_0x54708d,_0x834e09))[_0x6e2b('0x1f')](handleError(_0x54708d,null));};exports[_0x6e2b('0x49')]=function(_0x3d85a0,_0x25f73d){var _0x1c73f7={'raw':!![],'where':{'id':_0x3d85a0['params']['id']}},_0x1a330e={};_0x1a330e[_0x6e2b('0x37')]=_[_0x6e2b('0x34')](db[_0x6e2b('0x2d')][_0x6e2b('0x2e')]);_0x1a330e['query']=_[_0x6e2b('0x34')](_0x3d85a0[_0x6e2b('0x33')]);_0x1a330e[_0x6e2b('0x35')]=_['intersection'](_0x1a330e['model'],_0x1a330e[_0x6e2b('0x33')]);_0x1c73f7[_0x6e2b('0x38')]=_[_0x6e2b('0x36')](_0x1a330e[_0x6e2b('0x37')],qs['fields'](_0x3d85a0[_0x6e2b('0x33')][_0x6e2b('0x39')]));_0x1c73f7[_0x6e2b('0x38')]=_0x1c73f7[_0x6e2b('0x38')]['length']?_0x1c73f7[_0x6e2b('0x38')]:_0x1a330e[_0x6e2b('0x37')];if(_0x3d85a0[_0x6e2b('0x33')][_0x6e2b('0x4a')]){_0x1c73f7[_0x6e2b('0x46')]=[{'all':!![]}];}_0x1c73f7=_[_0x6e2b('0x42')]({},_0x1c73f7,_0x3d85a0[_0x6e2b('0x44')]);return db['MailMessage'][_0x6e2b('0x4b')](_0x1c73f7)[_0x6e2b('0x14')](handleEntityNotFound(_0x25f73d,null))[_0x6e2b('0x14')](respondWithResult(_0x25f73d,null))[_0x6e2b('0x1f')](handleError(_0x25f73d,null));};exports[_0x6e2b('0x4c')]=function(_0x52aaa2,_0x5c4747){if(_0x52aaa2['body']['id']){delete _0x52aaa2[_0x6e2b('0x4d')]['id'];}return db[_0x6e2b('0x2d')][_0x6e2b('0x4b')]({'where':{'id':_0x52aaa2['params']['id']}})[_0x6e2b('0x14')](handleEntityNotFound(_0x5c4747,null))[_0x6e2b('0x14')](saveUpdates(_0x52aaa2[_0x6e2b('0x4d')],null))[_0x6e2b('0x14')](respondWithResult(_0x5c4747,null))['catch'](handleError(_0x5c4747,null));};exports[_0x6e2b('0x27')]=function(_0x59e3ea,_0x2ee1d2){return db[_0x6e2b('0x2d')][_0x6e2b('0x4b')]({'where':{'id':_0x59e3ea['params']['id']}})['then'](handleEntityNotFound(_0x2ee1d2,null))[_0x6e2b('0x14')](removeEntity(_0x2ee1d2,null))[_0x6e2b('0x1f')](handleError(_0x2ee1d2,null));};exports[_0x6e2b('0x4e')]=function(_0x5d0c0d,_0x284f4a){return db[_0x6e2b('0x2d')][_0x6e2b('0x4e')]()[_0x6e2b('0x14')](respondWithResult(_0x284f4a,null))[_0x6e2b('0x1f')](handleError(_0x284f4a,null));};exports[_0x6e2b('0x4f')]=function(_0x5f1bbb,_0x261a3d){return db[_0x6e2b('0x2d')][_0x6e2b('0x4f')](_0x5f1bbb[_0x6e2b('0x4d')])[_0x6e2b('0x14')](function(_0x12ee88){if(_0x12ee88){if(_0x12ee88[_0x6e2b('0x50')]===_0x6e2b('0x51')&&!_0x12ee88['secret']){var _0x1f00a0,_0x5ab323,_0x221b02;if(_0x5f1bbb[_0x6e2b('0x4d')]['to']){_0x5ab323=_0x5f1bbb[_0x6e2b('0x4d')]['to']['split'](',')[0x0];}return db[_0x6e2b('0x52')][_0x6e2b('0x53')]({'where':{'id':_0x12ee88[_0x6e2b('0x54')]},'include':[{'model':db['CmList'],'as':_0x6e2b('0x55'),'include':[{'model':db[_0x6e2b('0x56')],'as':_0x6e2b('0x57'),'where':{'email':_0x5ab323},'limit':0x1,'order':[[_0x6e2b('0x58'),_0x6e2b('0x59')]]}]},{'model':db[_0x6e2b('0x5a')],'as':_0x6e2b('0x5b'),'raw':!![]}]})[_0x6e2b('0x14')](function(_0x21b7a1){_0x1f00a0=_0x21b7a1;if(_0x1f00a0&&_0x1f00a0[_0x6e2b('0x5b')]){var _0x58cd34={'tls':{'rejectUnauthorized':![]}};if(_[_0x6e2b('0x5c')](_0x1f00a0[_0x6e2b('0x5b')][_0x6e2b('0x5d')])){_0x58cd34[_0x6e2b('0x5e')]=_0x1f00a0['Smtp'][_0x6e2b('0x5e')];_0x58cd34[_0x6e2b('0x5f')]=_0x1f00a0[_0x6e2b('0x5b')][_0x6e2b('0x5f')];_0x58cd34['secure']=_0x1f00a0[_0x6e2b('0x5b')][_0x6e2b('0x60')];if(_0x1f00a0[_0x6e2b('0x5b')][_0x6e2b('0x61')]){_0x58cd34[_0x6e2b('0x62')]={'user':_0x1f00a0['Smtp']['user'],'pass':_0x1f00a0[_0x6e2b('0x5b')]['pass']};}}else{_0x58cd34[_0x6e2b('0x5d')]=_0x1f00a0['Smtp'][_0x6e2b('0x5d')];_0x58cd34[_0x6e2b('0x62')]={'user':_0x1f00a0[_0x6e2b('0x5b')][_0x6e2b('0x63')],'pass':_0x1f00a0['Smtp'][_0x6e2b('0x64')]};_0x58cd34[_0x6e2b('0x60')]=_0x1f00a0[_0x6e2b('0x5b')][_0x6e2b('0x60')];}if(_0x5f1bbb[_0x6e2b('0x4d')][_0x6e2b('0x65')]&&_0x5f1bbb['body'][_0x6e2b('0x65')][_0x6e2b('0x3a')]){for(var _0x52c295=0x0;_0x52c295<_0x5f1bbb[_0x6e2b('0x4d')][_0x6e2b('0x65')][_0x6e2b('0x3a')];_0x52c295+=0x1){_0x5f1bbb[_0x6e2b('0x4d')][_0x6e2b('0x65')][_0x52c295]={'filename':_0x5f1bbb['body'][_0x6e2b('0x65')][_0x52c295][_0x6e2b('0x2a')],'path':path[_0x6e2b('0x66')](config['root'],_0x6e2b('0x67'),_0x5f1bbb[_0x6e2b('0x4d')][_0x6e2b('0x65')][_0x52c295][_0x6e2b('0x68')])};}}_0x221b02={'account':_0x58cd34,'message':_0x5f1bbb['body']};return;}})[_0x6e2b('0x14')](function(){if(_0x1f00a0[_0x6e2b('0x55')]){if(_0x1f00a0[_0x6e2b('0x55')][_0x6e2b('0x57')][_0x6e2b('0x3a')]){return _0x1f00a0[_0x6e2b('0x55')][_0x6e2b('0x57')][0x0];}else{return db[_0x6e2b('0x56')][_0x6e2b('0x4f')](_[_0x6e2b('0xd')](_0x5f1bbb[_0x6e2b('0x4d')],{'firstName':_0x5f1bbb['body']['to'],'email':_0x5f1bbb[_0x6e2b('0x4d')]['to'],'phone':_0x5f1bbb[_0x6e2b('0x4d')]['to'],'ListId':_0x1f00a0[_0x6e2b('0x69')]}));}}else{throw new Error(_0x6e2b('0x6a'));}})[_0x6e2b('0x14')](function(){if(_0x221b02){return respondWithRpcPromise(_0x6e2b('0x6b'),_0x6e2b('0x6c'),_0x221b02,client9003)[_0x6e2b('0x14')](function(_0x597fa7){return _0x12ee88[_0x6e2b('0x4c')]({'read':!![],'messageId':_0x597fa7[_0x6e2b('0x6d')],'sentAt':moment()['format'](_0x6e2b('0x6e'))});})[_0x6e2b('0x1f')](function(_0x4c21a7){logger['error']('%s',JSON[_0x6e2b('0x1a')](_0x4c21a7));return _0x12ee88;});}return _0x12ee88;});}return _0x12ee88;}})['then'](respondWithResult(_0x261a3d,0xc9))[_0x6e2b('0x1f')](handleError(_0x261a3d,null));};exports[_0x6e2b('0x6f')]=function(_0x4d56cf,_0x4fa238){var _0x32bc51={'agent':{},'channel':_0x6e2b('0x70')};if(_0x4d56cf['body']['id']){delete _0x4d56cf[_0x6e2b('0x4d')]['id'];}_0x4d56cf[_0x6e2b('0x4d')][_0x6e2b('0x71')]=!![];_0x4d56cf[_0x6e2b('0x4d')][_0x6e2b('0x72')]=moment()[_0x6e2b('0x73')](_0x6e2b('0x6e'));_0x4d56cf[_0x6e2b('0x4d')][_0x6e2b('0x74')]=_0x4d56cf[_0x6e2b('0x4d')][_0x6e2b('0x74')]||_0x4d56cf['user']['id'];_0x32bc51[_0x6e2b('0x75')]['id']=_0x4d56cf[_0x6e2b('0x4d')]['UserId'];return db[_0x6e2b('0x2d')][_0x6e2b('0x4b')]({'where':{'id':_0x4d56cf[_0x6e2b('0x76')]['id'],'UserId':null}})[_0x6e2b('0x14')](handleEntityNotFound(_0x4fa238,null))['then'](saveUpdates(_0x4d56cf[_0x6e2b('0x4d')],null))['then'](function(_0x8ea76a){if(_0x8ea76a){_0x32bc51['message']=_0x8ea76a[_0x6e2b('0x77')]({'plain':!![]});return db['MailInteraction'][_0x6e2b('0x4b')]({'where':{'id':_0x8ea76a['MailInteractionId']}});}return null;})[_0x6e2b('0x14')](handleEntityNotFound(_0x4fa238,null))[_0x6e2b('0x14')](function(_0x439e67){if(_0x439e67){return _0x439e67['update']({'UserId':_0x4d56cf[_0x6e2b('0x4d')][_0x6e2b('0x74')],'read1stAt':_[_0x6e2b('0x5c')](_0x439e67[_0x6e2b('0x78')])?moment()[_0x6e2b('0x73')](_0x6e2b('0x6e')):undefined});}return null;})[_0x6e2b('0x14')](function(_0x3ed0d9){if(_0x3ed0d9){_0x32bc51[_0x6e2b('0x79')]=_0x3ed0d9[_0x6e2b('0x77')]({'plain':!![]});interaction_log[_0x6e2b('0x15')](_0x6e2b('0x7a'),_0x4d56cf[_0x6e2b('0x63')]['id'],_0x4d56cf['user'][_0x6e2b('0x2a')],_0x4d56cf[_0x6e2b('0x63')][_0x6e2b('0x7b')],_0x32bc51[_0x6e2b('0x79')]['id'],_0x4d56cf[_0x6e2b('0x4d')]?JSON[_0x6e2b('0x1a')](_0x4d56cf['body']):_0x6e2b('0x7c'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x32bc51);}return null;})[_0x6e2b('0x14')](function(_0x720a9d){var _0x2d71f5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x720a9d[_0x6e2b('0x1d')]['ContactId'];return db[_0x6e2b('0x7d')][_0x6e2b('0x33')](_0x2d71f5,{'type':db[_0x6e2b('0x7e')]['QueryTypes'][_0x6e2b('0x7f')],'raw':!![]})[_0x6e2b('0x14')](function(_0x196768){return _0x196768;});})[_0x6e2b('0x14')](function(_0x5dc4aa){if(_0x5dc4aa){_0x32bc51[_0x6e2b('0x1d')]['contact']=_0x5dc4aa[0x0];if(!_0x4d56cf[_0x6e2b('0x4d')][_0x6e2b('0x74')])return;return db[_0x6e2b('0x80')][_0x6e2b('0x4b')]({'where':{'id':_0x4d56cf[_0x6e2b('0x4d')][_0x6e2b('0x74')],'role':_0x6e2b('0x75')},'attributes':['id',_0x6e2b('0x2a'),_0x6e2b('0x81'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x50dd69){if(!_0x50dd69)return null;_0x32bc51['message'][_0x6e2b('0x75')]=_0x50dd69;return _0x32bc51;})['then'](function(_0x16ba9e){if(_0x16ba9e){if(_0x4d56cf[_0x6e2b('0x4d')][_0x6e2b('0x82')]){_0x32bc51[_0x6e2b('0x1d')][_0x6e2b('0x83')]=util['format'](_0x6e2b('0x84'),_0x4d56cf['user'][_0x6e2b('0x2a')]);_0x32bc51[_0x6e2b('0x1d')]['channel']=_0x32bc51['channel'];_0x32bc51[_0x6e2b('0x1d')][_0x6e2b('0x85')]=_0x32bc51[_0x6e2b('0x86')];_0x32bc51[_0x6e2b('0x1d')][_0x6e2b('0x87')]=_0x6e2b('0x6f');_0x32bc51[_0x6e2b('0x1d')][_0x6e2b('0x4d')]=htmlToText[_0x6e2b('0x88')](_0x32bc51['message'][_0x6e2b('0x4d')]);return respondWithRpcPromise(_0x6e2b('0x89'),_0x6e2b('0x89'),{'event':_0x6e2b('0x8a'),'message':_0x32bc51[_0x6e2b('0x1d')]},client9002)['then'](function(){return _0x32bc51;});}return _0x32bc51;}return null;})[_0x6e2b('0x14')](respondWithResult(_0x4fa238,null))[_0x6e2b('0x1f')](handleError(_0x4fa238,null));};exports[_0x6e2b('0x8b')]=function(_0x3681cf,_0x3531b4){var _0x4e507b={'agent':{},'channel':_0x6e2b('0x70')};if(_0x3681cf[_0x6e2b('0x4d')]['id']){delete _0x3681cf[_0x6e2b('0x4d')]['id'];}_0x3681cf[_0x6e2b('0x4d')][_0x6e2b('0x74')]=_0x3681cf['body'][_0x6e2b('0x74')]||_0x3681cf[_0x6e2b('0x63')]['id'];_0x4e507b[_0x6e2b('0x75')]['id']=_0x3681cf['body']['UserId'];return db[_0x6e2b('0x2d')]['find']({'where':{'id':_0x3681cf[_0x6e2b('0x76')]['id'],'UserId':null}})[_0x6e2b('0x14')](handleEntityNotFound(_0x3531b4,null))[_0x6e2b('0x14')](function(_0x4b41a6){if(_0x4b41a6){_0x4e507b['message']=_0x4b41a6[_0x6e2b('0x77')]({'plain':!![]});return db['MailInteraction'][_0x6e2b('0x4b')]({'where':{'id':_0x4b41a6[_0x6e2b('0x8c')]}});}return null;})[_0x6e2b('0x14')](handleEntityNotFound(_0x3531b4,null))[_0x6e2b('0x14')](function(_0x5739cc){if(_0x5739cc){_0x4e507b[_0x6e2b('0x79')]=_0x5739cc[_0x6e2b('0x77')]({'plain':!![]});interaction_log[_0x6e2b('0x15')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3681cf[_0x6e2b('0x63')]['id'],_0x3681cf[_0x6e2b('0x63')][_0x6e2b('0x2a')],_0x3681cf[_0x6e2b('0x63')][_0x6e2b('0x7b')],_0x4e507b[_0x6e2b('0x79')]['id'],_0x3681cf[_0x6e2b('0x4d')]?JSON[_0x6e2b('0x1a')](_0x3681cf[_0x6e2b('0x4d')]):_0x6e2b('0x7c'));return respondWithRpcPromise(_0x6e2b('0x8d'),_0x6e2b('0x8e'),_0x4e507b);}return null;})[_0x6e2b('0x14')](function(_0x1a6a68){var _0x5c8aa8=_0x6e2b('0x8f')+_0x1a6a68['message'][_0x6e2b('0x90')];return db[_0x6e2b('0x7d')][_0x6e2b('0x33')](_0x5c8aa8,{'type':db[_0x6e2b('0x7e')][_0x6e2b('0x91')][_0x6e2b('0x7f')],'raw':!![]})[_0x6e2b('0x14')](function(_0x2891bb){return _0x2891bb;});})[_0x6e2b('0x14')](function(_0x332dba){if(_0x332dba){_0x4e507b[_0x6e2b('0x1d')][_0x6e2b('0x92')]=_0x332dba[0x0];if(!_0x3681cf[_0x6e2b('0x4d')][_0x6e2b('0x74')])return;return db[_0x6e2b('0x80')]['find']({'where':{'id':_0x3681cf[_0x6e2b('0x4d')]['UserId'],'role':'agent'},'attributes':['id',_0x6e2b('0x2a'),'fullname','email',_0x6e2b('0x93')],'raw':!![]});}return null;})['then'](function(_0x47c6d7){if(!_0x47c6d7)return null;_0x4e507b[_0x6e2b('0x1d')]['agent']=_0x47c6d7;return _0x4e507b;})[_0x6e2b('0x14')](function(_0x4ea11c){if(_0x4ea11c){_0x4ea11c[_0x6e2b('0x1d')][_0x6e2b('0x83')]=util[_0x6e2b('0x73')]('SIP/%s',_0x3681cf[_0x6e2b('0x63')][_0x6e2b('0x2a')]);_0x4ea11c[_0x6e2b('0x1d')]['channel']=_0x4e507b[_0x6e2b('0x86')];_0x4ea11c[_0x6e2b('0x1d')]['motionChannel']=_0x4e507b[_0x6e2b('0x86')];_0x4ea11c[_0x6e2b('0x1d')][_0x6e2b('0x87')]=_0x6e2b('0x8b');_0x4ea11c[_0x6e2b('0x1d')]['body']=htmlToText[_0x6e2b('0x88')](_0x4e507b[_0x6e2b('0x1d')][_0x6e2b('0x4d')]);respondWithRpcPromise(_0x6e2b('0x89'),_0x6e2b('0x89'),{'event':'rejectmessage','message':_0x4ea11c[_0x6e2b('0x1d')]},client9002);return _0x4e507b;}return null;})[_0x6e2b('0x14')](respondWithResult(_0x3531b4,null))['catch'](handleError(_0x3531b4,null));};exports[_0x6e2b('0x94')]=function(_0x59a099,_0x3cb580){var _0x382738=moment()[_0x6e2b('0x95')]()[_0x6e2b('0x96')]();var _0x11cba1=path['join'](config[_0x6e2b('0x97')],_0x6e2b('0x98'),'files',_0x6e2b('0x99'));var _0x5b4225=path[_0x6e2b('0x66')](config['root'],'server',_0x6e2b('0x9a'),'attachments');var _0x332445=util[_0x6e2b('0x73')]('message-%s.eml',_0x382738);return db[_0x6e2b('0x2d')][_0x6e2b('0x4b')]({'where':{'id':_0x59a099[_0x6e2b('0x76')]['id']},'attributes':['id',_0x6e2b('0x4d'),'from','to','cc',_0x6e2b('0x9b'),_0x6e2b('0x9c'),_0x6e2b('0x9d')],'include':_0x59a099[_0x6e2b('0x33')][_0x6e2b('0x65')]?[{'model':db[_0x6e2b('0x9e')],'as':'Attachments'}]:undefined})[_0x6e2b('0x14')](handleEntityNotFound(_0x3cb580,null))[_0x6e2b('0x14')](function(_0xf4e62b){if(_0xf4e62b){var _0x103564=_0xf4e62b;var _0x582a33={'from':_0x103564[_0x6e2b('0x9f')],'to':_0x103564['to'],'subject':_0x103564[_0x6e2b('0x9c')],'html':htmlEntities['decode'](_0x103564[_0x6e2b('0x4d')]),'headers':{'Date':moment(_0x103564[_0x6e2b('0x9d')])['format'](_0x6e2b('0xa0'))},'attachments':[]};if(_0xf4e62b['cc']){_0x582a33[_0x6e2b('0xa1')]['Cc']=_0xf4e62b['cc'];}if(_0xf4e62b['bcc']){_0x582a33[_0x6e2b('0xa1')][_0x6e2b('0xa2')]=_0xf4e62b['bcc'];}return new BPromise(function(_0x1e06f7,_0x28cc95){if(_0xf4e62b['Attachments']){for(var _0x1b4160=0x0;_0x1b4160<_0xf4e62b[_0x6e2b('0xa3')]['length'];_0x1b4160++){var _0x47de0b=_0xf4e62b['Attachments'][_0x1b4160];var _0x417f0e=path[_0x6e2b('0x66')](_0x5b4225,_0x47de0b[_0x6e2b('0x68')]);if(fs[_0x6e2b('0xa4')](_0x417f0e)){_0x582a33[_0x6e2b('0x65')][_0x6e2b('0xa5')]({'name':_0x47de0b[_0x6e2b('0x2a')],'contentType':_0x47de0b[_0x6e2b('0x30')],'data':fs[_0x6e2b('0xa6')](_0x417f0e)});}}}emlformat[_0x6e2b('0xa7')](_0x582a33,function(_0x296f26,_0x3bac84){if(_0x296f26)return _0x28cc95(_0x296f26);fs[_0x6e2b('0xa8')](path['join'](_0x11cba1,_0x332445),_0x3bac84);return _0x1e06f7(_0x3bac84);});});}})[_0x6e2b('0x14')](function(_0x154b48){if(_0x154b48){return _0x3cb580[_0x6e2b('0x94')](path['join'](_0x11cba1,_0x332445),_0x332445,function(_0x23dab8){if(!_0x23dab8)fs['unlinkSync'](path['join'](_0x11cba1,_0x332445));});}})[_0x6e2b('0x1f')](handleError(_0x3cb580,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 0b03459..08857a0 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 _0x5d7f=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x1775af,_0x896ee1){var _0x3fbafc=function(_0x704a8c){while(--_0x704a8c){_0x1775af['push'](_0x1775af['shift']());}};_0x3fbafc(++_0x896ee1);}(_0x5d7f,0x191));var _0xf5d7=function(_0x5df671,_0x2f9724){_0x5df671=_0x5df671-0x0;var _0x38e0c7=_0x5d7f[_0x5df671];return _0x38e0c7;};'use strict';var EventEmitter=require(_0xf5d7('0x0'));var MailMessage=require(_0xf5d7('0x1'))['db'][_0xf5d7('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf5d7('0x3')](0x0);var events={'afterCreate':_0xf5d7('0x4'),'afterUpdate':_0xf5d7('0x5'),'afterDestroy':'remove'};function emitEvent(_0x141001){return function(_0x312902,_0x3bca5b,_0x5afbed){MailMessageEvents[_0xf5d7('0x6')](_0x141001+':'+_0x312902['id'],_0x312902);MailMessageEvents['emit'](_0x141001,_0x312902);_0x5afbed(null);};}for(var e in events){if(events[_0xf5d7('0x7')](e)){var event=events[e];MailMessage[_0xf5d7('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x8f81=['remove','emit','hasOwnProperty','hook','exports','MailMessage','save'];(function(_0x4c01a0,_0x40e1ca){var _0x51a5a3=function(_0x107480){while(--_0x107480){_0x4c01a0['push'](_0x4c01a0['shift']());}};_0x51a5a3(++_0x40e1ca);}(_0x8f81,0x7c));var _0x18f8=function(_0x2830a7,_0x11433e){_0x2830a7=_0x2830a7-0x0;var _0x2ab0af=_0x8f81[_0x2830a7];return _0x2ab0af;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x18f8('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x18f8('0x1'),'afterUpdate':'update','afterDestroy':_0x18f8('0x2')};function emitEvent(_0x1e4763){return function(_0x559e57,_0x5a981e,_0x5e1b62){MailMessageEvents[_0x18f8('0x3')](_0x1e4763+':'+_0x559e57['id'],_0x559e57);MailMessageEvents[_0x18f8('0x3')](_0x1e4763,_0x559e57);_0x5e1b62(null);};}for(var e in events){if(events[_0x18f8('0x4')](e)){var event=events[e];MailMessage[_0x18f8('0x5')](e,emitEvent(event));}}module[_0x18f8('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 65c6eb1..3251c6e 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 _0x5bc1=['path','rimraf','../../config/environment','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','toLowerCase','direction','out','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x16af29,_0x4974e9){var _0x5a6cd2=function(_0x310652){while(--_0x310652){_0x16af29['push'](_0x16af29['shift']());}};_0x5a6cd2(++_0x4974e9);}(_0x5bc1,0x128));var _0x15bc=function(_0x2215d2,_0x563782){_0x2215d2=_0x2215d2-0x0;var _0x2bb13a=_0x5bc1[_0x2215d2];return _0x2bb13a;};'use strict';var _=require(_0x15bc('0x0'));var util=require('util');var logger=require(_0x15bc('0x1'))(_0x15bc('0x2'));var moment=require(_0x15bc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x15bc('0x4'));var rimraf=require(_0x15bc('0x5'));var config=require(_0x15bc('0x6'));var attributes=require('./mailMessage.attributes');module[_0x15bc('0x7')]=function(_0xeababf,_0x7b8bdc){return _0xeababf[_0x15bc('0x8')](_0x15bc('0x9'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x15bc('0xa'),'fields':['messageId']},{'name':_0x15bc('0xb'),'fields':[_0x15bc('0xc'),'subject'],'type':_0x15bc('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3b3a0d,_0x419cc5,_0x4945de){if(_0x3b3a0d[_0x15bc('0xe')]){_0x3b3a0d[_0x15bc('0xc')]=htmlToText[_0x15bc('0xf')](_0x3b3a0d[_0x15bc('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4945de(null,_0x419cc5);},'afterCreate':function(_0x290a3c,_0x5e905e,_0x2b602d){var _0x59297c=_0xeababf[_0x15bc('0x10')];var _0x469587=_0x290a3c['get']({'plain':!![]});if(_0x469587['direction'][_0x15bc('0x11')]()==='in'||_0x469587[_0x15bc('0x12')]['toLowerCase']()===_0x15bc('0x13')&&!_0x469587['secret']&&!_['isNil'](_0x469587[_0x15bc('0x14')])){_0x59297c[_0x15bc('0x15')][_0x15bc('0x16')]({'where':{'id':_0x469587[_0x15bc('0x17')]}})[_0x15bc('0x18')](function(_0x11036a){if(_0x11036a){_0x11036a[_0x15bc('0x19')]({'lastMsgAt':_0x469587[_0x15bc('0x1a')],'lastMsgDirection':_0x469587['direction'][_0x15bc('0x11')]()});}})[_0x15bc('0x1b')](function(_0x23c8b0){console['error'](_0x23c8b0);});}_0x2b602d();}},'charset':_0x15bc('0x1c'),'collate':_0x15bc('0x1d')});}; \ No newline at end of file +var _0x4c12=['define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4c12,0x1d6));var _0x24c1=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x4c12[_0x100682];return _0xcb6e87;};'use strict';var _=require(_0x24c1('0x0'));var util=require(_0x24c1('0x1'));var logger=require(_0x24c1('0x2'))(_0x24c1('0x3'));var moment=require(_0x24c1('0x4'));var BPromise=require('bluebird');var rp=require(_0x24c1('0x5'));var htmlToText=require(_0x24c1('0x6'));var fs=require('fs');var path=require(_0x24c1('0x7'));var rimraf=require(_0x24c1('0x8'));var config=require(_0x24c1('0x9'));var attributes=require(_0x24c1('0xa'));module['exports']=function(_0x2d4cc7,_0x3ae111){return _0x2d4cc7[_0x24c1('0xb')](_0x24c1('0xc'),attributes,{'tableName':_0x24c1('0xd'),'paranoid':![],'indexes':[{'name':_0x24c1('0xe'),'fields':[_0x24c1('0xe')]},{'name':_0x24c1('0xf'),'fields':[_0x24c1('0x10'),_0x24c1('0x11')],'type':_0x24c1('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x39a172,_0x5675cb,_0x6cf87e){if(_0x39a172[_0x24c1('0x13')]){_0x39a172[_0x24c1('0x10')]=htmlToText[_0x24c1('0x14')](_0x39a172[_0x24c1('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x6cf87e(null,_0x5675cb);},'afterCreate':function(_0x2e8393,_0x3a6a38,_0x4aeb64){var _0x466087=_0x2d4cc7[_0x24c1('0x15')];var _0x5a2515=_0x2e8393[_0x24c1('0x16')]({'plain':!![]});if(_0x5a2515[_0x24c1('0x17')][_0x24c1('0x18')]()==='in'||_0x5a2515[_0x24c1('0x17')][_0x24c1('0x18')]()===_0x24c1('0x19')&&!_0x5a2515[_0x24c1('0x1a')]&&!_[_0x24c1('0x1b')](_0x5a2515[_0x24c1('0x1c')])){_0x466087['MailInteraction']['findOne']({'where':{'id':_0x5a2515[_0x24c1('0x1d')]}})[_0x24c1('0x1e')](function(_0x211fab){if(_0x211fab){_0x211fab[_0x24c1('0x1f')]({'lastMsgAt':_0x5a2515[_0x24c1('0x20')],'lastMsgDirection':_0x5a2515[_0x24c1('0x17')]['toLowerCase']()});}})[_0x24c1('0x21')](function(_0x3c39e4){console[_0x24c1('0x22')](_0x3c39e4);});}_0x4aeb64();}},'charset':_0x24c1('0x23'),'collate':_0x24c1('0x24')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index af4668c..9594aab 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 _0x5464=['localhost','socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','error','message','catch','CreateMailMessage','MailMessage','body','options','raw','then','debug','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0x5464,0x15d));var _0x4546=function(_0x213e3c,_0x25a2fa){_0x213e3c=_0x213e3c-0x0;var _0x583d22=_0x5464[_0x213e3c];return _0x583d22;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var BPromise=require('bluebird');var rs=require(_0x4546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4546('0x5'))(_0x4546('0x6'));var config=require(_0x4546('0x7'));var jayson=require(_0x4546('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x4546('0x9')](config[_0x4546('0xa')],{'host':_0x4546('0xb'),'port':0x18eb});var socket=require(_0x4546('0xc'))(new Redis(config[_0x4546('0xa')]));require(_0x4546('0xd'))[_0x4546('0xe')](socket);function respondWithRpcPromise(_0x430b2e,_0x383bf2,_0x4ac723){return new BPromise(function(_0x1dd3f5,_0x8a15e2){return client[_0x4546('0xf')](_0x430b2e,_0x4ac723)['then'](function(_0x1f82c9){logger[_0x4546('0x10')](_0x4546('0x11'),_0x383bf2,_0x4546('0x12'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x383bf2,_0x4546('0x12'),JSON['stringify'](_0x1f82c9));if(_0x1f82c9['error']){if(_0x1f82c9['error']['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x383bf2,_0x1f82c9[_0x4546('0x13')]['message']);return _0x8a15e2(_0x1f82c9[_0x4546('0x13')]['message']);}logger[_0x4546('0x13')]('MailMessage,\x20%s,\x20%s',_0x383bf2,_0x1f82c9[_0x4546('0x13')][_0x4546('0x14')]);return _0x1dd3f5(_0x1f82c9[_0x4546('0x13')][_0x4546('0x14')]);}else{logger[_0x4546('0x10')](_0x4546('0x11'),_0x383bf2,'request\x20sent');_0x1dd3f5(_0x1f82c9['result']['message']);}})[_0x4546('0x15')](function(_0x39f552){logger[_0x4546('0x13')](_0x4546('0x11'),_0x383bf2,_0x39f552);_0x8a15e2(_0x39f552);});});}exports[_0x4546('0x16')]=function(_0x337a44){var _0x3ec009=this;return new Promise(function(_0x2f6329,_0x4034a5){return db[_0x4546('0x17')]['create'](_0x337a44[_0x4546('0x18')],{'raw':_0x337a44[_0x4546('0x19')]?_0x337a44['options'][_0x4546('0x1a')]===undefined?!![]:![]:!![]})[_0x4546('0x1b')](function(_0x1a1984){logger[_0x4546('0x10')](_0x4546('0x16'),_0x337a44);logger[_0x4546('0x1c')]('CreateMailMessage',_0x337a44,JSON[_0x4546('0x1d')](_0x1a1984));_0x2f6329(_0x1a1984);})[_0x4546('0x15')](function(_0x4f9fcf){logger[_0x4546('0x13')](_0x4546('0x16'),_0x4f9fcf[_0x4546('0x14')],_0x337a44);_0x4034a5(_0x3ec009[_0x4546('0x13')](0x1f4,_0x4f9fcf[_0x4546('0x14')]));});});}; \ No newline at end of file +var _0x4fc2=['message','info','result','catch','CreateMailMessage','MailMessage','body','options','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0x4fc2,0x111));var _0x24fc=function(_0x507965,_0x4944f4){_0x507965=_0x507965-0x0;var _0x3608fc=_0x4fc2[_0x507965];return _0x3608fc;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});config['redis']=_[_0x24fc('0xb')](config[_0x24fc('0xc')],{'host':_0x24fc('0xd'),'port':0x18eb});var socket=require(_0x24fc('0xe'))(new Redis(config[_0x24fc('0xc')]));require(_0x24fc('0xf'))['register'](socket);function respondWithRpcPromise(_0x44caca,_0x1819a5,_0x1a4462){return new BPromise(function(_0x133438,_0x24998d){return client[_0x24fc('0x10')](_0x44caca,_0x1a4462)[_0x24fc('0x11')](function(_0x9a1673){logger['info'](_0x24fc('0x12'),_0x1819a5,_0x24fc('0x13'));logger['debug'](_0x24fc('0x14'),_0x1819a5,_0x24fc('0x13'),JSON[_0x24fc('0x15')](_0x9a1673));if(_0x9a1673[_0x24fc('0x16')]){if(_0x9a1673[_0x24fc('0x16')][_0x24fc('0x17')]===0x1f4){logger['error'](_0x24fc('0x12'),_0x1819a5,_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);return _0x24998d(_0x9a1673[_0x24fc('0x16')]['message']);}logger[_0x24fc('0x16')]('MailMessage,\x20%s,\x20%s',_0x1819a5,_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);return _0x133438(_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);}else{logger[_0x24fc('0x19')]('MailMessage,\x20%s,\x20%s',_0x1819a5,_0x24fc('0x13'));_0x133438(_0x9a1673[_0x24fc('0x1a')][_0x24fc('0x18')]);}})[_0x24fc('0x1b')](function(_0x4c5a43){logger[_0x24fc('0x16')](_0x24fc('0x12'),_0x1819a5,_0x4c5a43);_0x24998d(_0x4c5a43);});});}exports[_0x24fc('0x1c')]=function(_0x5b0516){var _0x32a57d=this;return new Promise(function(_0x36a771,_0xbf1d6b){return db[_0x24fc('0x1d')]['create'](_0x5b0516[_0x24fc('0x1e')],{'raw':_0x5b0516['options']?_0x5b0516[_0x24fc('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x24fc('0x11')](function(_0x44c121){logger[_0x24fc('0x19')]('CreateMailMessage',_0x5b0516);logger[_0x24fc('0x20')]('CreateMailMessage',_0x5b0516,JSON[_0x24fc('0x15')](_0x44c121));_0x36a771(_0x44c121);})[_0x24fc('0x1b')](function(_0x36a9b4){logger[_0x24fc('0x16')](_0x24fc('0x1c'),_0x36a9b4[_0x24fc('0x18')],_0x5b0516);_0xbf1d6b(_0x32a57d[_0x24fc('0x16')](0x1f4,_0x36a9b4[_0x24fc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 875ce35..2482223 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 _0x2af3=['register','length','./mailMessage.events','remove','update','emit'];(function(_0x265304,_0xa4ee0){var _0x2f6530=function(_0x209874){while(--_0x209874){_0x265304['push'](_0x265304['shift']());}};_0x2f6530(++_0xa4ee0);}(_0x2af3,0xbc));var _0x32af=function(_0x4fd2d1,_0x43f306){_0x4fd2d1=_0x4fd2d1-0x0;var _0x564564=_0x2af3[_0x4fd2d1];return _0x564564;};'use strict';var MailMessageEvents=require(_0x32af('0x0'));var events=['save',_0x32af('0x1'),_0x32af('0x2')];function createListener(_0x36a398,_0x27ac7e){return function(_0x58f21d){_0x27ac7e[_0x32af('0x3')](_0x36a398,_0x58f21d);};}function removeListener(_0x585782,_0x485634){return function(){MailMessageEvents['removeListener'](_0x585782,_0x485634);};}exports[_0x32af('0x4')]=function(_0x346938){for(var _0x4ac619=0x0,_0x4f0358=events[_0x32af('0x5')];_0x4ac619<_0x4f0358;_0x4ac619++){var _0x3ecac1=events[_0x4ac619];var _0x28f5c0=createListener('mailMessage:'+_0x3ecac1,_0x346938);MailMessageEvents['on'](_0x3ecac1,_0x28f5c0);}}; \ No newline at end of file +var _0x78f0=['save','remove','update','removeListener','register','length','mailMessage:'];(function(_0x46d68b,_0x154971){var _0x3a7893=function(_0x17e56a){while(--_0x17e56a){_0x46d68b['push'](_0x46d68b['shift']());}};_0x3a7893(++_0x154971);}(_0x78f0,0x1dc));var _0x078f=function(_0x21e0ea,_0x1dd58c){_0x21e0ea=_0x21e0ea-0x0;var _0x2d4ea4=_0x78f0[_0x21e0ea];return _0x2d4ea4;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x078f('0x0'),_0x078f('0x1'),_0x078f('0x2')];function createListener(_0x2cad6e,_0x1221dc){return function(_0x4ceeca){_0x1221dc['emit'](_0x2cad6e,_0x4ceeca);};}function removeListener(_0x2c61b4,_0x478069){return function(){MailMessageEvents[_0x078f('0x3')](_0x2c61b4,_0x478069);};}exports[_0x078f('0x4')]=function(_0x14761f){for(var _0x332899=0x0,_0x4b0413=events[_0x078f('0x5')];_0x332899<_0x4b0413;_0x332899++){var _0x1f31e1=events[_0x332899];var _0x4f6f4d=createListener(_0x078f('0x6')+_0x1f31e1,_0x14761f);MailMessageEvents['on'](_0x1f31e1,_0x4f6f4d);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index e2f6818..8871673 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 _0xccdc=['getMembers','/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','addAgents','put','update','removeTeams','delete','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0xccdc,0x10f));var _0xcccd=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xccdc[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xcccd('0x0'));var util=require(_0xcccd('0x1'));var path=require('path');var timeout=require(_0xcccd('0x2'));var express=require(_0xcccd('0x3'));var router=express[_0xcccd('0x4')]();var fs_extra=require(_0xcccd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcccd('0x6'));var config=require(_0xcccd('0x7'));var controller=require(_0xcccd('0x8'));router[_0xcccd('0x9')]('/',auth[_0xcccd('0xa')](),controller[_0xcccd('0xb')]);router[_0xcccd('0x9')](_0xcccd('0xc'),auth[_0xcccd('0xa')](),controller[_0xcccd('0xd')]);router[_0xcccd('0x9')](_0xcccd('0xe'),auth[_0xcccd('0xa')](),controller[_0xcccd('0xf')]);router[_0xcccd('0x9')](_0xcccd('0x10'),auth[_0xcccd('0xa')](),controller[_0xcccd('0x11')]);router[_0xcccd('0x9')](_0xcccd('0x12'),auth[_0xcccd('0xa')](),controller[_0xcccd('0x13')]);router['get']('/:id/users',auth[_0xcccd('0xa')](),controller[_0xcccd('0x14')]);router['post']('/',auth[_0xcccd('0xa')](),controller[_0xcccd('0x15')]);router[_0xcccd('0x16')](_0xcccd('0x12'),auth[_0xcccd('0xa')](),controller[_0xcccd('0x17')]);router[_0xcccd('0x16')](_0xcccd('0x18'),auth[_0xcccd('0xa')](),controller[_0xcccd('0x19')]);router[_0xcccd('0x1a')](_0xcccd('0xe'),auth[_0xcccd('0xa')](),controller[_0xcccd('0x1b')]);router['delete'](_0xcccd('0xe'),auth[_0xcccd('0xa')](),controller['destroy']);router['delete'](_0xcccd('0x12'),auth[_0xcccd('0xa')](),controller[_0xcccd('0x1c')]);router[_0xcccd('0x1d')](_0xcccd('0x18'),auth[_0xcccd('0xa')](),controller[_0xcccd('0x1e')]);module[_0xcccd('0x1f')]=router; \ No newline at end of file +var _0xb370=['path','connect-timeout','express','Router','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util'];(function(_0x32e2f3,_0x3b1901){var _0x141bf8=function(_0x1f1fa7){while(--_0x1f1fa7){_0x32e2f3['push'](_0x32e2f3['shift']());}};_0x141bf8(++_0x3b1901);}(_0xb370,0x1da));var _0x0b37=function(_0x2c0627,_0x3417af){_0x2c0627=_0x2c0627-0x0;var _0x54c109=_0xb370[_0x2c0627];return _0x54c109;};'use strict';var multer=require(_0x0b37('0x0'));var util=require(_0x0b37('0x1'));var path=require(_0x0b37('0x2'));var timeout=require(_0x0b37('0x3'));var express=require(_0x0b37('0x4'));var router=express[_0x0b37('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0b37('0x6'));router[_0x0b37('0x7')]('/',auth[_0x0b37('0x8')](),controller[_0x0b37('0x9')]);router[_0x0b37('0x7')](_0x0b37('0xa'),auth[_0x0b37('0x8')](),controller[_0x0b37('0xb')]);router['get'](_0x0b37('0xc'),auth[_0x0b37('0x8')](),controller[_0x0b37('0xd')]);router['get']('/:id/members',auth[_0x0b37('0x8')](),controller[_0x0b37('0xe')]);router[_0x0b37('0x7')](_0x0b37('0xf'),auth[_0x0b37('0x8')](),controller[_0x0b37('0x10')]);router[_0x0b37('0x7')](_0x0b37('0x11'),auth[_0x0b37('0x8')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x0b37('0x12')]);router[_0x0b37('0x13')](_0x0b37('0xf'),auth[_0x0b37('0x8')](),controller[_0x0b37('0x14')]);router['post'](_0x0b37('0x11'),auth['isAuthenticated'](),controller[_0x0b37('0x15')]);router[_0x0b37('0x16')](_0x0b37('0xc'),auth[_0x0b37('0x8')](),controller[_0x0b37('0x17')]);router[_0x0b37('0x18')](_0x0b37('0xc'),auth['isAuthenticated'](),controller[_0x0b37('0x19')]);router[_0x0b37('0x18')](_0x0b37('0xf'),auth[_0x0b37('0x8')](),controller['removeTeams']);router[_0x0b37('0x18')](_0x0b37('0x11'),auth[_0x0b37('0x8')](),controller[_0x0b37('0x1a')]);module[_0x0b37('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 f52aa54..6bb7ca9 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 _0xd8f7=['STRING','INTEGER','rrmemory','exports','name'];(function(_0x228cf2,_0x1744a7){var _0x3ebdaf=function(_0xf134c0){while(--_0xf134c0){_0x228cf2['push'](_0x228cf2['shift']());}};_0x3ebdaf(++_0x1744a7);}(_0xd8f7,0x1ac));var _0x7d8f=function(_0x3e17ad,_0x2f84e9){_0x3e17ad=_0x3e17ad-0x0;var _0x436a12=_0xd8f7[_0x3e17ad];return _0x436a12;};'use strict';var Sequelize=require('sequelize');module[_0x7d8f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7d8f('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7d8f('0x2')]},'timeout':{'type':Sequelize[_0x7d8f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7d8f('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x74b4=['name','STRING','ENUM','rrmemory','sequelize','exports'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0x74b4,0x154));var _0x474b=function(_0x19db93,_0x51086c){_0x19db93=_0x19db93-0x0;var _0x3e3f8c=_0x74b4[_0x19db93];return _0x3e3f8c;};'use strict';var Sequelize=require(_0x474b('0x0'));module[_0x474b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x474b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x474b('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x474b('0x4')](_0x474b('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a39ec18..1e5e835 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 _0xf81b=['getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','Agents','clone','toString','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','emit','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','include','MailQueue','rows','catch','show','params','includeAll','options','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserMailQueue','nolimit','pick','MailQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','mailPause','Team'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf81b,0x1cc));var _0xbf81=function(_0x1a200a,_0x28a27e){_0x1a200a=_0x1a200a-0x0;var _0x50fba1=_0xf81b[_0x1a200a];return _0x50fba1;};'use strict';var emlformat=require(_0xbf81('0x0'));var rimraf=require(_0xbf81('0x1'));var zipdir=require(_0xbf81('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf81('0x3'));var moment=require('moment');var BPromise=require(_0xbf81('0x4'));var Mustache=require(_0xbf81('0x5'));var util=require(_0xbf81('0x6'));var path=require(_0xbf81('0x7'));var sox=require(_0xbf81('0x8'));var csv=require(_0xbf81('0x9'));var ejs=require(_0xbf81('0xa'));var fs=require('fs');var fs_extra=require(_0xbf81('0xb'));var _=require('lodash');var squel=require(_0xbf81('0xc'));var crypto=require(_0xbf81('0xd'));var jsforce=require(_0xbf81('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbf81('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf81('0x10'))('api');var utils=require(_0xbf81('0x11'));var config=require(_0xbf81('0x12'));var licenseUtil=require(_0xbf81('0x13'));var db=require(_0xbf81('0x14'))['db'];config[_0xbf81('0x15')]=_[_0xbf81('0x16')](config[_0xbf81('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xbf81('0x17'))(new Redis(config[_0xbf81('0x15')]));require(_0xbf81('0x18'))[_0xbf81('0x19')](socket);function respondWithStatusCode(_0x2dd19e,_0x303f01){_0x303f01=_0x303f01||0xcc;return function(_0x6e6afd){if(_0x6e6afd){return _0x2dd19e[_0xbf81('0x1a')](_0x303f01);}return _0x2dd19e[_0xbf81('0x1b')](_0x303f01)['end']();};}function respondWithResult(_0x1e78d1,_0x1aecf8){_0x1aecf8=_0x1aecf8||0xc8;return function(_0x2f5361){if(_0x2f5361){return _0x1e78d1[_0xbf81('0x1b')](_0x1aecf8)[_0xbf81('0x1c')](_0x2f5361);}};}function respondWithFilteredResult(_0x1021d5,_0x426877){return function(_0x2b95f1){if(_0x2b95f1){var _0x445c81=typeof _0x426877[_0xbf81('0x1d')]===_0xbf81('0x1e')&&typeof _0x426877[_0xbf81('0x1f')]===_0xbf81('0x1e');var _0x4a6f7c=_0x2b95f1['count'];var _0x53da67=_0x445c81?0x0:_0x426877['offset'];var _0x3e4e43=_0x445c81?_0x2b95f1[_0xbf81('0x20')]:_0x426877['offset']+_0x426877[_0xbf81('0x1f')];var _0x3770c6;if(_0x3e4e43>=_0x4a6f7c){_0x3e4e43=_0x4a6f7c;_0x3770c6=0xc8;}else{_0x3770c6=0xce;}_0x1021d5[_0xbf81('0x1b')](_0x3770c6);return _0x1021d5['set'](_0xbf81('0x21'),_0x53da67+'-'+_0x3e4e43+'/'+_0x4a6f7c)[_0xbf81('0x1c')](_0x2b95f1);}return null;};}function patchUpdates(_0x2c3618){return function(_0x3b6b96){try{jsonpatch[_0xbf81('0x22')](_0x3b6b96,_0x2c3618,!![]);}catch(_0xc51c36){return BPromise[_0xbf81('0x23')](_0xc51c36);}return _0x3b6b96[_0xbf81('0x24')]();};}function saveUpdates(_0x27ab40,_0x1425f0){return function(_0x41b2cf){if(_0x41b2cf){return _0x41b2cf[_0xbf81('0x25')](_0x27ab40)[_0xbf81('0x26')](function(_0x57078c){return _0x57078c;});}return null;};}function removeEntity(_0x1d070e,_0x46d650){return function(_0x4263af){if(_0x4263af){return _0x4263af[_0xbf81('0x27')]()[_0xbf81('0x26')](function(){var _0x4f7e61=_0x4263af['get']({'plain':!![]});var _0x31116c='MailQueues';return db['UserProfileResource'][_0xbf81('0x27')]({'where':{'type':_0x31116c,'resourceId':_0x4f7e61['id']}})[_0xbf81('0x26')](function(){return _0x4263af;});})[_0xbf81('0x26')](function(){_0x1d070e['status'](0xcc)[_0xbf81('0x28')]();});}};}function handleEntityNotFound(_0x31a788,_0x501a72){return function(_0x183258){if(!_0x183258){_0x31a788['sendStatus'](0x194);}return _0x183258;};}function handleError(_0x46c037,_0x43c5fd){_0x43c5fd=_0x43c5fd||0x1f4;return function(_0x3f7b5b){logger['error'](_0x3f7b5b[_0xbf81('0x29')]);if(_0x3f7b5b[_0xbf81('0x2a')]){delete _0x3f7b5b[_0xbf81('0x2a')];}_0x46c037[_0xbf81('0x1b')](_0x43c5fd)[_0xbf81('0x2b')](_0x3f7b5b);};}exports['index']=function(_0x3cb2f7,_0x1cb38d){var _0x1bf705={},_0x257252={},_0x4b7551={'count':0x0,'rows':[]};var _0x57940f=_[_0xbf81('0x2c')](db['MailQueue'][_0xbf81('0x2d')],function(_0x227047){return{'name':_0x227047[_0xbf81('0x2e')],'type':_0x227047[_0xbf81('0x2f')]['key']};});_0x257252[_0xbf81('0x30')]=_[_0xbf81('0x2c')](_0x57940f,_0xbf81('0x2a'));_0x257252[_0xbf81('0x31')]=_[_0xbf81('0x32')](_0x3cb2f7[_0xbf81('0x31')]);_0x257252['filters']=_['intersection'](_0x257252[_0xbf81('0x30')],_0x257252[_0xbf81('0x31')]);_0x1bf705[_0xbf81('0x33')]=_[_0xbf81('0x34')](_0x257252['model'],qs[_0xbf81('0x35')](_0x3cb2f7[_0xbf81('0x31')][_0xbf81('0x35')]));_0x1bf705['attributes']=_0x1bf705['attributes'][_0xbf81('0x36')]?_0x1bf705['attributes']:_0x257252[_0xbf81('0x30')];if(!_0x3cb2f7['query'][_0xbf81('0x37')]('nolimit')){_0x1bf705[_0xbf81('0x1f')]=qs[_0xbf81('0x1f')](_0x3cb2f7['query'][_0xbf81('0x1f')]);_0x1bf705[_0xbf81('0x1d')]=qs['offset'](_0x3cb2f7['query'][_0xbf81('0x1d')]);}_0x1bf705[_0xbf81('0x38')]=qs[_0xbf81('0x39')](_0x3cb2f7[_0xbf81('0x31')][_0xbf81('0x39')]);_0x1bf705['where']=qs[_0xbf81('0x3a')](_['pick'](_0x3cb2f7[_0xbf81('0x31')],_0x257252[_0xbf81('0x3a')]),_0x57940f);if(_0x3cb2f7['query'][_0xbf81('0x3b')]){_0x1bf705[_0xbf81('0x3c')]=_[_0xbf81('0x3d')](_0x1bf705[_0xbf81('0x3c')],{'$or':_['map'](_0x57940f,function(_0x3e19c9){if(_0x3e19c9['type']!=='VIRTUAL'){var _0x42e7ae={};_0x42e7ae[_0x3e19c9[_0xbf81('0x2a')]]={'$like':'%'+_0x3cb2f7[_0xbf81('0x31')][_0xbf81('0x3b')]+'%'};return _0x42e7ae;}})});}_0x1bf705=_[_0xbf81('0x3d')]({},_0x1bf705,_0x3cb2f7['options']);var _0x165c4b={'where':_0x1bf705['where']};return db['MailQueue']['count'](_0x165c4b)[_0xbf81('0x26')](function(_0x94ad44){_0x4b7551[_0xbf81('0x20')]=_0x94ad44;if(_0x3cb2f7[_0xbf81('0x31')]['includeAll']){_0x1bf705[_0xbf81('0x3e')]=[{'all':!![]}];}return db[_0xbf81('0x3f')]['findAll'](_0x1bf705);})['then'](function(_0x4d2bdb){_0x4b7551[_0xbf81('0x40')]=_0x4d2bdb;return _0x4b7551;})[_0xbf81('0x26')](respondWithFilteredResult(_0x1cb38d,_0x1bf705))[_0xbf81('0x41')](handleError(_0x1cb38d,null));};exports[_0xbf81('0x42')]=function(_0x520843,_0x19e630){var _0x441b81={'raw':!![],'where':{'id':_0x520843[_0xbf81('0x43')]['id']}},_0x113f3b={};_0x113f3b[_0xbf81('0x30')]=_[_0xbf81('0x32')](db[_0xbf81('0x3f')][_0xbf81('0x2d')]);_0x113f3b[_0xbf81('0x31')]=_[_0xbf81('0x32')](_0x520843['query']);_0x113f3b[_0xbf81('0x3a')]=_[_0xbf81('0x34')](_0x113f3b[_0xbf81('0x30')],_0x113f3b[_0xbf81('0x31')]);_0x441b81[_0xbf81('0x33')]=_[_0xbf81('0x34')](_0x113f3b[_0xbf81('0x30')],qs['fields'](_0x520843[_0xbf81('0x31')][_0xbf81('0x35')]));_0x441b81['attributes']=_0x441b81[_0xbf81('0x33')]['length']?_0x441b81[_0xbf81('0x33')]:_0x113f3b[_0xbf81('0x30')];if(_0x520843['query'][_0xbf81('0x44')]){_0x441b81[_0xbf81('0x3e')]=[{'all':!![]}];}_0x441b81=_['merge']({},_0x441b81,_0x520843[_0xbf81('0x45')]);return db[_0xbf81('0x3f')]['find'](_0x441b81)[_0xbf81('0x26')](handleEntityNotFound(_0x19e630,null))[_0xbf81('0x26')](respondWithResult(_0x19e630,null))[_0xbf81('0x41')](handleError(_0x19e630,null));};exports['create']=function(_0x49519b,_0x1e4c04){return db[_0xbf81('0x3f')][_0xbf81('0x46')](_0x49519b['body'],{})['then'](function(_0x5978f3){var _0x2a7d62=_0x49519b['user'][_0xbf81('0x47')]({'plain':!![]});if(!_0x2a7d62)throw new Error(_0xbf81('0x48'));if(_0x2a7d62[_0xbf81('0x49')]==='user'){var _0x31318a=_0x5978f3[_0xbf81('0x47')]({'plain':!![]});var _0x5957fb=_0xbf81('0x4a');return db[_0xbf81('0x4b')][_0xbf81('0x4c')]({'where':{'name':_0x5957fb,'userProfileId':_0x2a7d62[_0xbf81('0x4d')]},'raw':!![]})[_0xbf81('0x26')](function(_0xafb488){if(_0xafb488&&_0xafb488[_0xbf81('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x31318a['name'],'resourceId':_0x31318a['id'],'type':_0xafb488[_0xbf81('0x2a')],'sectionId':_0xafb488['id']},{})[_0xbf81('0x26')](function(){return _0x5978f3;});}else{return _0x5978f3;}})[_0xbf81('0x41')](function(_0x4034a8){logger[_0xbf81('0x4f')](_0xbf81('0x50'),_0x4034a8);throw _0x4034a8;});}return _0x5978f3;})[_0xbf81('0x26')](respondWithResult(_0x1e4c04,0xc9))[_0xbf81('0x41')](handleError(_0x1e4c04,null));};exports[_0xbf81('0x25')]=function(_0x1de0df,_0x531465){if(_0x1de0df[_0xbf81('0x51')]['id']){delete _0x1de0df[_0xbf81('0x51')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x1de0df[_0xbf81('0x43')]['id']}})['then'](handleEntityNotFound(_0x531465,null))['then'](saveUpdates(_0x1de0df[_0xbf81('0x51')],null))['then'](respondWithResult(_0x531465,null))['catch'](handleError(_0x531465,null));};exports[_0xbf81('0x27')]=function(_0x5e67e7,_0x4a09ab){return db[_0xbf81('0x3f')][_0xbf81('0x4c')]({'where':{'id':_0x5e67e7['params']['id']}})[_0xbf81('0x26')](handleEntityNotFound(_0x4a09ab,null))['then'](removeEntity(_0x4a09ab,null))['catch'](handleError(_0x4a09ab,null));};exports[_0xbf81('0x52')]=function(_0x4441d1,_0x423d9c){return db[_0xbf81('0x3f')][_0xbf81('0x52')]()[_0xbf81('0x26')](respondWithResult(_0x423d9c,null))[_0xbf81('0x41')](handleError(_0x423d9c,null));};exports[_0xbf81('0x53')]=function(_0x503b06,_0x9c2c9d,_0x3dc7d8){var _0x30a381={'raw':!![],'where':{}},_0xf12b4d={},_0x12090a;return db[_0xbf81('0x3f')][_0xbf81('0x54')]({'where':{'id':_0x503b06[_0xbf81('0x43')]['id']}})[_0xbf81('0x26')](handleEntityNotFound(_0x9c2c9d,null))['then'](function(_0x17d1cc){if(_0x17d1cc){_0x12090a=_0x17d1cc[_0xbf81('0x47')]({'plain':!![]});_0xf12b4d[_0xbf81('0x30')]=_[_0xbf81('0x32')](db[_0xbf81('0x55')][_0xbf81('0x2d')]);_0xf12b4d['query']=_['keys'](_0x503b06[_0xbf81('0x31')]);_0xf12b4d[_0xbf81('0x3a')]=_[_0xbf81('0x34')](_0xf12b4d['model'],_0xf12b4d['query']);_0x30a381[_0xbf81('0x33')]=_[_0xbf81('0x34')](_0xf12b4d[_0xbf81('0x30')],qs[_0xbf81('0x35')](_0x503b06['query']['fields']));_0x30a381[_0xbf81('0x33')]=_0x30a381[_0xbf81('0x33')][_0xbf81('0x36')]?_0x30a381[_0xbf81('0x33')]:_0xf12b4d['model'];if(!_0x503b06['query'][_0xbf81('0x37')](_0xbf81('0x56'))){_0x30a381['limit']=qs['limit'](_0x503b06[_0xbf81('0x31')]['limit']);_0x30a381[_0xbf81('0x1d')]=qs[_0xbf81('0x1d')](_0x503b06[_0xbf81('0x31')][_0xbf81('0x1d')]);}_0x30a381[_0xbf81('0x38')]=qs[_0xbf81('0x39')](_0x503b06[_0xbf81('0x31')][_0xbf81('0x39')]);_0x30a381['where']=qs[_0xbf81('0x3a')](_[_0xbf81('0x57')](_0x503b06[_0xbf81('0x31')],_0xf12b4d[_0xbf81('0x3a')]));_0x30a381[_0xbf81('0x3c')][_0xbf81('0x58')]=_0x17d1cc['id'];if(_0x503b06[_0xbf81('0x31')][_0xbf81('0x3b')]){_0x30a381['where']=_[_0xbf81('0x3d')](_0x30a381['where'],{'$or':_[_0xbf81('0x2c')](_0x30a381[_0xbf81('0x33')],function(_0x2a45cb){var _0x10908={};_0x10908[_0x2a45cb]={'$like':'%'+_0x503b06[_0xbf81('0x31')][_0xbf81('0x3b')]+'%'};return _0x10908;})});}_0x30a381=_[_0xbf81('0x3d')]({},_0x30a381,_0x503b06[_0xbf81('0x45')]);return db[_0xbf81('0x55')]['findAll'](_0x30a381);}})[_0xbf81('0x26')](function(_0x357e4d){if(_0x357e4d){return db[_0xbf81('0x59')][_0xbf81('0x5a')]({'where':{'id':_[_0xbf81('0x2c')](_0x357e4d,_0xbf81('0x5b')),'role':_0xbf81('0x5c')},'attributes':['id','name','mailPause',_0xbf81('0x5d'),_0xbf81('0x5e')]});}})[_0xbf81('0x26')](function(_0x5bc794){if(_0x5bc794){return{'count':_0x5bc794['count'],'rows':_[_0xbf81('0x2c')](_0x5bc794[_0xbf81('0x40')],function(_0x2fe59d){return{'membername':_0x2fe59d[_0xbf81('0x2a')],'UserId':_0x2fe59d['id'],'queue_name':_0x12090a[_0xbf81('0x2a')],'MailQueueId':_0x12090a['id'],'interface':util[_0xbf81('0x5f')](_0xbf81('0x60'),_0xbf81('0x61'),_0x2fe59d[_0xbf81('0x2a')]),'penalty':0x0,'paused':_0x2fe59d[_0xbf81('0x62')],'createdAt':_0x2fe59d['createdAt'],'updatedAt':_0x2fe59d[_0xbf81('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x9c2c9d,_0x30a381))[_0xbf81('0x41')](handleError(_0x9c2c9d,null));};exports['getTeams']=function(_0x4ff992,_0x445339,_0x2947b0){var _0x36339e={};var _0x277fde={};var _0x42fadb;var _0x3a3768;return db['MailQueue']['findOne']({'where':{'id':_0x4ff992[_0xbf81('0x43')]['id']}})[_0xbf81('0x26')](handleEntityNotFound(_0x445339,null))['then'](function(_0x3b39dc){if(_0x3b39dc){_0x42fadb=_0x3b39dc;_0x277fde[_0xbf81('0x30')]=_[_0xbf81('0x32')](db[_0xbf81('0x63')][_0xbf81('0x2d')]);_0x277fde[_0xbf81('0x31')]=_[_0xbf81('0x32')](_0x4ff992[_0xbf81('0x31')]);_0x277fde[_0xbf81('0x3a')]=_[_0xbf81('0x34')](_0x277fde[_0xbf81('0x30')],_0x277fde[_0xbf81('0x31')]);_0x36339e['attributes']=_[_0xbf81('0x34')](_0x277fde[_0xbf81('0x30')],qs[_0xbf81('0x35')](_0x4ff992[_0xbf81('0x31')][_0xbf81('0x35')]));_0x36339e[_0xbf81('0x33')]=_0x36339e[_0xbf81('0x33')][_0xbf81('0x36')]?_0x36339e[_0xbf81('0x33')]:_0x277fde[_0xbf81('0x30')];_0x36339e[_0xbf81('0x38')]=qs[_0xbf81('0x39')](_0x4ff992[_0xbf81('0x31')][_0xbf81('0x39')]);_0x36339e[_0xbf81('0x3c')]=qs['filters'](_[_0xbf81('0x57')](_0x4ff992[_0xbf81('0x31')],_0x277fde[_0xbf81('0x3a')]));if(_0x4ff992[_0xbf81('0x31')][_0xbf81('0x3b')]){_0x36339e[_0xbf81('0x3c')]=_[_0xbf81('0x3d')](_0x36339e[_0xbf81('0x3c')],{'$or':_['map'](_0x36339e[_0xbf81('0x33')],function(_0x31555d){var _0x351b2b={};_0x351b2b[_0x31555d]={'$like':'%'+_0x4ff992[_0xbf81('0x31')]['filter']+'%'};return _0x351b2b;})});}_0x36339e=_['merge']({},_0x36339e,_0x4ff992[_0xbf81('0x45')]);return _0x42fadb['getTeams'](_0x36339e);}})[_0xbf81('0x26')](function(_0x3e45ee){if(_0x3e45ee){_0x3a3768=_0x3e45ee[_0xbf81('0x36')];if(!_0x4ff992[_0xbf81('0x31')][_0xbf81('0x37')](_0xbf81('0x56'))){_0x36339e['limit']=qs[_0xbf81('0x1f')](_0x4ff992[_0xbf81('0x31')][_0xbf81('0x1f')]);_0x36339e[_0xbf81('0x1d')]=qs[_0xbf81('0x1d')](_0x4ff992['query']['offset']);}return _0x42fadb[_0xbf81('0x64')](_0x36339e);}})[_0xbf81('0x26')](function(_0x1189c3){if(_0x1189c3){return _0x1189c3?{'count':_0x3a3768,'rows':_0x1189c3}:null;}})[_0xbf81('0x26')](respondWithResult(_0x445339,null))[_0xbf81('0x41')](handleError(_0x445339,null));};exports[_0xbf81('0x65')]=function(_0x20dc4d,_0x19fdce,_0x430dc5){var _0x4b25c6=_0x20dc4d[_0xbf81('0x51')][_0xbf81('0x66')];return db[_0xbf81('0x63')][_0xbf81('0x67')]({'where':{'id':_0x4b25c6},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xbf81('0x2a'),_0xbf81('0x68'),_0xbf81('0x69'),_0xbf81('0x6a')],'raw':!![]}]})[_0xbf81('0x26')](function(_0x797ff3){if(_0x797ff3){var _0x30835a=_[_0xbf81('0x6b')](_0x797ff3,function(_0x11112a){var _0x39f662=_0x11112a[_0xbf81('0x47')]({'plain':!![]});return _0x39f662['Agents'];});return db[_0xbf81('0x3f')][_0xbf81('0x4c')]({'where':{'id':_0x20dc4d[_0xbf81('0x43')]['id']}})['then'](function(_0x504112){return db[_0xbf81('0x6c')][_0xbf81('0x6d')](function(_0x14f90e){return _0x504112[_0xbf81('0x65')](_0x4b25c6,{'transaction':_0x14f90e})['then'](function(){return BPromise[_0xbf81('0x6e')](_0x30835a,function(_0x20599c){return db[_0xbf81('0x55')][_0xbf81('0x6f')]({'where':{'UserId':_0x20599c['id'],'MailQueueId':_0x20dc4d['params']['id']},'transaction':_0x14f90e});});})[_0xbf81('0x26')](function(){_0x30835a[_0xbf81('0x70')](function(_0x1dc5b7){socket['emit']('userMailQueue:save',{'UserId':_0x1dc5b7['id'],'MailQueueId':_0x504112['id']});});});});});}})['then'](respondWithStatusCode(_0x19fdce,null))['catch'](handleError(_0x19fdce,null));};exports['removeTeams']=function(_0x49214d,_0x1c4725,_0x2ec739){return db[_0xbf81('0x63')][_0xbf81('0x67')]({'where':{'id':_0x49214d[_0xbf81('0x31')]['ids']},'attributes':['id'],'include':[{'model':db[_0xbf81('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbf81('0x26')](handleEntityNotFound(_0x1c4725,null))[_0xbf81('0x26')](function(_0x553b38){var _0x4591df=_[_0xbf81('0x2c')](_0x553b38,'id');var _0x3e1aac=[];var _0x5dc7b4=[];var _0x48377a=squel[_0xbf81('0x71')]();_0x48377a[_0xbf81('0x72')](_0xbf81('0x73'))[_0xbf81('0x74')](_0xbf81('0x75'),'tq')[_0xbf81('0x76')](_0xbf81('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xbf81('0x78'),_0x49214d[_0xbf81('0x43')]['id']);for(var _0x5362eb=0x0;_0x5362eb<_0x553b38[_0xbf81('0x36')];_0x5362eb+=0x1){let _0x436a19=_0x553b38[_0x5362eb];for(var _0x29695b=0x0;_0x29695b<_0x436a19['Agents'][_0xbf81('0x36')];_0x29695b+=0x1){let _0x59f0e7=_0x436a19[_0xbf81('0x79')][_0x29695b];var _0x5f5cfa=_0x48377a[_0xbf81('0x7a')]();_0x5f5cfa[_0xbf81('0x3c')]('ut.UserId\x20=\x20?',_0x59f0e7['id']);_0x5dc7b4['push'](db[_0xbf81('0x6c')]['query'](_0x5f5cfa[_0xbf81('0x7b')](),{'type':db[_0xbf81('0x6c')]['QueryTypes']['SELECT']})[_0xbf81('0x26')](function(_0x283e72){if(_0x283e72[_0xbf81('0x36')]===0x1){return _0x59f0e7['id'];}else{var _0x2396c4=_[_0xbf81('0x7c')](_[_0xbf81('0x2c')](_0x283e72,_0xbf81('0x7d')),function(_0x167b44){return _[_0xbf81('0x7e')](_0x4591df,_0x167b44);});if(_0x2396c4){return _0x59f0e7['id'];}}}));}}return BPromise[_0xbf81('0x7f')](_0x5dc7b4)[_0xbf81('0x26')](function(_0x1d1ed3){_0x3e1aac=_(_0x3e1aac)['union'](_0x1d1ed3)[_0xbf81('0x80')]()[_0xbf81('0x81')]();return db['MailQueue'][_0xbf81('0x4c')]({'where':{'id':_0x49214d[_0xbf81('0x43')]['id']}})[_0xbf81('0x26')](function(_0x5962dd){return db[_0xbf81('0x6c')]['transaction'](function(_0x5d6e1d){return _0x5962dd['removeTeams'](_0x49214d[_0xbf81('0x31')][_0xbf81('0x66')],{'transaction':_0x5d6e1d})[_0xbf81('0x26')](function(){if(!_[_0xbf81('0x82')](_0x3e1aac)){return _0x5962dd[_0xbf81('0x83')](_0x3e1aac,{'transaction':_0x5d6e1d});}})['then'](function(){_0x3e1aac[_0xbf81('0x70')](function(_0x295f2c){socket['emit'](_0xbf81('0x84'),{'UserId':_0x295f2c,'MailQueueId':_0x5962dd['id']});});});});});});})[_0xbf81('0x26')](respondWithStatusCode(_0x1c4725,null))[_0xbf81('0x41')](handleError(_0x1c4725,null));};exports['addAgents']=function(_0x52f091,_0x462513,_0x27b2e9){return db[_0xbf81('0x3f')][_0xbf81('0x4c')]({'where':{'id':_0x52f091[_0xbf81('0x43')]['id']}})[_0xbf81('0x26')](handleEntityNotFound(_0x462513,null))[_0xbf81('0x26')](function(_0x336838){if(_0x336838){return _0x336838[_0xbf81('0x85')](_0x52f091[_0xbf81('0x51')][_0xbf81('0x66')],_[_0xbf81('0x86')](_0x52f091['body'],[_0xbf81('0x66'),'id'])||{})[_0xbf81('0x87')](function(_0x320dc6){for(var _0x255351=0x0;_0x255351<_0x52f091[_0xbf81('0x51')][_0xbf81('0x66')]['length'];_0x255351+=0x1){socket['emit'](_0xbf81('0x88'),{'UserId':Number(_0x52f091[_0xbf81('0x51')]['ids'][_0x255351]),'MailQueueId':Number(_0x52f091[_0xbf81('0x43')]['id'])});}return _0x320dc6;});}})[_0xbf81('0x26')](respondWithResult(_0x462513,null))['catch'](handleError(_0x462513,null));};exports[_0xbf81('0x83')]=function(_0x4f53ed,_0x3146fa,_0x26876a){return db[_0xbf81('0x3f')][_0xbf81('0x4c')]({'where':{'id':_0x4f53ed[_0xbf81('0x43')]['id']}})[_0xbf81('0x26')](handleEntityNotFound(_0x3146fa,null))[_0xbf81('0x26')](function(_0x37b089){if(_0x37b089){return _0x37b089['removeAgents'](_0x4f53ed[_0xbf81('0x31')][_0xbf81('0x66')])['then'](function(){if(_[_0xbf81('0x89')](_0x4f53ed[_0xbf81('0x31')][_0xbf81('0x66')])){for(var _0x203a05=0x0;_0x203a05<_0x4f53ed[_0xbf81('0x31')][_0xbf81('0x66')][_0xbf81('0x36')];_0x203a05+=0x1){socket[_0xbf81('0x8a')](_0xbf81('0x84'),{'UserId':Number(_0x4f53ed[_0xbf81('0x31')][_0xbf81('0x66')][_0x203a05]),'MailQueueId':Number(_0x4f53ed[_0xbf81('0x43')]['id'])});}}else{socket[_0xbf81('0x8a')](_0xbf81('0x84'),{'UserId':Number(_0x4f53ed[_0xbf81('0x31')][_0xbf81('0x66')]),'MailQueueId':Number(_0x4f53ed[_0xbf81('0x43')]['id'])});}});}})[_0xbf81('0x26')](respondWithStatusCode(_0x3146fa,null))['catch'](handleError(_0x3146fa,null));};exports['getAgents']=function(_0x16feb3,_0x3a993d,_0x55d063){var _0x1a8538={};var _0xa5bc30={};var _0x3d3709;var _0x4723e3;return db[_0xbf81('0x3f')][_0xbf81('0x54')]({'where':{'id':_0x16feb3['params']['id']}})[_0xbf81('0x26')](handleEntityNotFound(_0x3a993d,null))[_0xbf81('0x26')](function(_0x41894c){if(_0x41894c){_0x3d3709=_0x41894c;_0xa5bc30[_0xbf81('0x30')]=_[_0xbf81('0x32')](db[_0xbf81('0x59')][_0xbf81('0x2d')]);_0xa5bc30[_0xbf81('0x31')]=_[_0xbf81('0x32')](_0x16feb3[_0xbf81('0x31')]);_0xa5bc30[_0xbf81('0x3a')]=_[_0xbf81('0x34')](_0xa5bc30[_0xbf81('0x30')],_0xa5bc30[_0xbf81('0x31')]);_0x1a8538['attributes']=_[_0xbf81('0x34')](_0xa5bc30[_0xbf81('0x30')],qs[_0xbf81('0x35')](_0x16feb3[_0xbf81('0x31')][_0xbf81('0x35')]));_0x1a8538['attributes']=_0x1a8538[_0xbf81('0x33')]['length']?_0x1a8538[_0xbf81('0x33')]:_0xa5bc30[_0xbf81('0x30')];_0x1a8538['order']=qs[_0xbf81('0x39')](_0x16feb3[_0xbf81('0x31')][_0xbf81('0x39')]);_0x1a8538[_0xbf81('0x3c')]=qs[_0xbf81('0x3a')](_['pick'](_0x16feb3['query'],_0xa5bc30[_0xbf81('0x3a')]));if(_0x16feb3[_0xbf81('0x31')]['filter']){_0x1a8538['where']=_[_0xbf81('0x3d')](_0x1a8538[_0xbf81('0x3c')],{'$or':_[_0xbf81('0x2c')](_0x1a8538[_0xbf81('0x33')],function(_0x25f35f){var _0x3fd2f9={};_0x3fd2f9[_0x25f35f]={'$like':'%'+_0x16feb3[_0xbf81('0x31')][_0xbf81('0x3b')]+'%'};return _0x3fd2f9;})});}_0x1a8538=_[_0xbf81('0x3d')]({},_0x1a8538,_0x16feb3[_0xbf81('0x45')]);return _0x3d3709['getAgents'](_0x1a8538);}})[_0xbf81('0x26')](function(_0x4409ba){if(_0x4409ba){_0x4723e3=_0x4409ba['length'];if(!_0x16feb3[_0xbf81('0x31')]['hasOwnProperty']('nolimit')){_0x1a8538['limit']=qs[_0xbf81('0x1f')](_0x16feb3['query'][_0xbf81('0x1f')]);_0x1a8538[_0xbf81('0x1d')]=qs[_0xbf81('0x1d')](_0x16feb3[_0xbf81('0x31')][_0xbf81('0x1d')]);}return _0x3d3709[_0xbf81('0x8b')](_0x1a8538);}})[_0xbf81('0x26')](function(_0x1b1f26){if(_0x1b1f26){return _0x1b1f26?{'count':_0x4723e3,'rows':_0x1b1f26}:null;}})[_0xbf81('0x26')](respondWithResult(_0x3a993d,null))['catch'](handleError(_0x3a993d,null));}; \ No newline at end of file +var _0xb95d=['Agents','online','voicePause','flatMap','sequelize','transaction','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./mailQueue.socket','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','MailQueues','sendStatus','error','name','send','index','MailQueue','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','MailQueueId','map','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','%s/%s','getTeams','filter','addTeams','ids','Team'];(function(_0x29b43d,_0x5980c7){var _0x3d650e=function(_0x530065){while(--_0x530065){_0x29b43d['push'](_0x29b43d['shift']());}};_0x3d650e(++_0x5980c7);}(_0xb95d,0x1c5));var _0xdb95=function(_0xfb8e9c,_0x4bfaec){_0xfb8e9c=_0xfb8e9c-0x0;var _0x432968=_0xb95d[_0xfb8e9c];return _0x432968;};'use strict';var emlformat=require(_0xdb95('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb95('0x1'));var jsonpatch=require(_0xdb95('0x2'));var rp=require(_0xdb95('0x3'));var moment=require(_0xdb95('0x4'));var BPromise=require(_0xdb95('0x5'));var Mustache=require('mustache');var util=require(_0xdb95('0x6'));var path=require(_0xdb95('0x7'));var sox=require(_0xdb95('0x8'));var csv=require('to-csv');var ejs=require(_0xdb95('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdb95('0xa'));var jsforce=require(_0xdb95('0xb'));var deskjs=require(_0xdb95('0xc'));var toCsv=require(_0xdb95('0xd'));var querystring=require('querystring');var Papa=require(_0xdb95('0xe'));var Redis=require(_0xdb95('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdb95('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb95('0x11'))(_0xdb95('0x12'));var utils=require(_0xdb95('0x13'));var config=require(_0xdb95('0x14'));var licenseUtil=require(_0xdb95('0x15'));var db=require(_0xdb95('0x16'))['db'];config[_0xdb95('0x17')]=_[_0xdb95('0x18')](config[_0xdb95('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb95('0x17')]));require(_0xdb95('0x19'))['register'](socket);function respondWithStatusCode(_0x3e9210,_0x26fc84){_0x26fc84=_0x26fc84||0xcc;return function(_0x35e33d){if(_0x35e33d){return _0x3e9210['sendStatus'](_0x26fc84);}return _0x3e9210[_0xdb95('0x1a')](_0x26fc84)[_0xdb95('0x1b')]();};}function respondWithResult(_0x13edc3,_0x2aae66){_0x2aae66=_0x2aae66||0xc8;return function(_0xf9a838){if(_0xf9a838){return _0x13edc3[_0xdb95('0x1a')](_0x2aae66)['json'](_0xf9a838);}};}function respondWithFilteredResult(_0x5c7ff6,_0x6b3971){return function(_0x1ac252){if(_0x1ac252){var _0x1416ab=typeof _0x6b3971[_0xdb95('0x1c')]==='undefined'&&typeof _0x6b3971[_0xdb95('0x1d')]===_0xdb95('0x1e');var _0x5c9e63=_0x1ac252[_0xdb95('0x1f')];var _0x599af5=_0x1416ab?0x0:_0x6b3971[_0xdb95('0x1c')];var _0x26e419=_0x1416ab?_0x1ac252['count']:_0x6b3971[_0xdb95('0x1c')]+_0x6b3971[_0xdb95('0x1d')];var _0x20d7aa;if(_0x26e419>=_0x5c9e63){_0x26e419=_0x5c9e63;_0x20d7aa=0xc8;}else{_0x20d7aa=0xce;}_0x5c7ff6[_0xdb95('0x1a')](_0x20d7aa);return _0x5c7ff6[_0xdb95('0x20')](_0xdb95('0x21'),_0x599af5+'-'+_0x26e419+'/'+_0x5c9e63)[_0xdb95('0x22')](_0x1ac252);}return null;};}function patchUpdates(_0x5aa7b0){return function(_0x3ed2fb){try{jsonpatch[_0xdb95('0x23')](_0x3ed2fb,_0x5aa7b0,!![]);}catch(_0x2ad432){return BPromise[_0xdb95('0x24')](_0x2ad432);}return _0x3ed2fb[_0xdb95('0x25')]();};}function saveUpdates(_0xba9d34,_0x18d0b1){return function(_0x1f3854){if(_0x1f3854){return _0x1f3854[_0xdb95('0x26')](_0xba9d34)[_0xdb95('0x27')](function(_0x506452){return _0x506452;});}return null;};}function removeEntity(_0x1707ad,_0x2dfabf){return function(_0x463b3d){if(_0x463b3d){return _0x463b3d[_0xdb95('0x28')]()[_0xdb95('0x27')](function(){var _0x2dda22=_0x463b3d[_0xdb95('0x29')]({'plain':!![]});var _0x47a26a=_0xdb95('0x2a');return db['UserProfileResource'][_0xdb95('0x28')]({'where':{'type':_0x47a26a,'resourceId':_0x2dda22['id']}})[_0xdb95('0x27')](function(){return _0x463b3d;});})[_0xdb95('0x27')](function(){_0x1707ad[_0xdb95('0x1a')](0xcc)[_0xdb95('0x1b')]();});}};}function handleEntityNotFound(_0x1ca950,_0xe8bfc){return function(_0x4cba47){if(!_0x4cba47){_0x1ca950[_0xdb95('0x2b')](0x194);}return _0x4cba47;};}function handleError(_0x129a56,_0x111223){_0x111223=_0x111223||0x1f4;return function(_0x1de675){logger[_0xdb95('0x2c')](_0x1de675['stack']);if(_0x1de675[_0xdb95('0x2d')]){delete _0x1de675[_0xdb95('0x2d')];}_0x129a56['status'](_0x111223)[_0xdb95('0x2e')](_0x1de675);};}exports[_0xdb95('0x2f')]=function(_0x12df25,_0x5175a1){var _0x1050e8={},_0x568482={},_0x45ba27={'count':0x0,'rows':[]};var _0x402712=_['map'](db[_0xdb95('0x30')][_0xdb95('0x31')],function(_0x4fb241){return{'name':_0x4fb241[_0xdb95('0x32')],'type':_0x4fb241[_0xdb95('0x33')]['key']};});_0x568482[_0xdb95('0x34')]=_['map'](_0x402712,_0xdb95('0x2d'));_0x568482[_0xdb95('0x35')]=_['keys'](_0x12df25[_0xdb95('0x35')]);_0x568482[_0xdb95('0x36')]=_[_0xdb95('0x37')](_0x568482[_0xdb95('0x34')],_0x568482[_0xdb95('0x35')]);_0x1050e8[_0xdb95('0x38')]=_[_0xdb95('0x37')](_0x568482['model'],qs[_0xdb95('0x39')](_0x12df25['query'][_0xdb95('0x39')]));_0x1050e8[_0xdb95('0x38')]=_0x1050e8[_0xdb95('0x38')][_0xdb95('0x3a')]?_0x1050e8['attributes']:_0x568482[_0xdb95('0x34')];if(!_0x12df25['query']['hasOwnProperty']('nolimit')){_0x1050e8[_0xdb95('0x1d')]=qs[_0xdb95('0x1d')](_0x12df25[_0xdb95('0x35')][_0xdb95('0x1d')]);_0x1050e8[_0xdb95('0x1c')]=qs['offset'](_0x12df25[_0xdb95('0x35')][_0xdb95('0x1c')]);}_0x1050e8[_0xdb95('0x3b')]=qs[_0xdb95('0x3c')](_0x12df25[_0xdb95('0x35')][_0xdb95('0x3c')]);_0x1050e8[_0xdb95('0x3d')]=qs[_0xdb95('0x36')](_[_0xdb95('0x3e')](_0x12df25['query'],_0x568482[_0xdb95('0x36')]),_0x402712);if(_0x12df25[_0xdb95('0x35')]['filter']){_0x1050e8['where']=_['merge'](_0x1050e8[_0xdb95('0x3d')],{'$or':_['map'](_0x402712,function(_0x119716){if(_0x119716[_0xdb95('0x33')]!==_0xdb95('0x3f')){var _0x23e335={};_0x23e335[_0x119716[_0xdb95('0x2d')]]={'$like':'%'+_0x12df25[_0xdb95('0x35')]['filter']+'%'};return _0x23e335;}})});}_0x1050e8=_[_0xdb95('0x40')]({},_0x1050e8,_0x12df25[_0xdb95('0x41')]);var _0x2b268a={'where':_0x1050e8[_0xdb95('0x3d')]};return db['MailQueue'][_0xdb95('0x1f')](_0x2b268a)[_0xdb95('0x27')](function(_0xa5c20a){_0x45ba27[_0xdb95('0x1f')]=_0xa5c20a;if(_0x12df25['query'][_0xdb95('0x42')]){_0x1050e8[_0xdb95('0x43')]=[{'all':!![]}];}return db[_0xdb95('0x30')][_0xdb95('0x44')](_0x1050e8);})[_0xdb95('0x27')](function(_0x1c0cb0){_0x45ba27[_0xdb95('0x45')]=_0x1c0cb0;return _0x45ba27;})[_0xdb95('0x27')](respondWithFilteredResult(_0x5175a1,_0x1050e8))[_0xdb95('0x46')](handleError(_0x5175a1,null));};exports[_0xdb95('0x47')]=function(_0x2f32cb,_0xa68135){var _0x585a59={'raw':!![],'where':{'id':_0x2f32cb[_0xdb95('0x48')]['id']}},_0x30922c={};_0x30922c['model']=_[_0xdb95('0x49')](db[_0xdb95('0x30')][_0xdb95('0x31')]);_0x30922c[_0xdb95('0x35')]=_[_0xdb95('0x49')](_0x2f32cb[_0xdb95('0x35')]);_0x30922c[_0xdb95('0x36')]=_[_0xdb95('0x37')](_0x30922c[_0xdb95('0x34')],_0x30922c[_0xdb95('0x35')]);_0x585a59[_0xdb95('0x38')]=_[_0xdb95('0x37')](_0x30922c['model'],qs['fields'](_0x2f32cb[_0xdb95('0x35')]['fields']));_0x585a59['attributes']=_0x585a59[_0xdb95('0x38')][_0xdb95('0x3a')]?_0x585a59[_0xdb95('0x38')]:_0x30922c[_0xdb95('0x34')];if(_0x2f32cb['query']['includeAll']){_0x585a59[_0xdb95('0x43')]=[{'all':!![]}];}_0x585a59=_['merge']({},_0x585a59,_0x2f32cb[_0xdb95('0x41')]);return db[_0xdb95('0x30')][_0xdb95('0x4a')](_0x585a59)[_0xdb95('0x27')](handleEntityNotFound(_0xa68135,null))[_0xdb95('0x27')](respondWithResult(_0xa68135,null))[_0xdb95('0x46')](handleError(_0xa68135,null));};exports[_0xdb95('0x4b')]=function(_0x3373e1,_0x2bd026){return db[_0xdb95('0x30')][_0xdb95('0x4b')](_0x3373e1['body'],{})[_0xdb95('0x27')](function(_0xb2547){var _0x46b880=_0x3373e1[_0xdb95('0x4c')][_0xdb95('0x29')]({'plain':!![]});if(!_0x46b880)throw new Error(_0xdb95('0x4d'));if(_0x46b880['role']===_0xdb95('0x4c')){var _0xa5ad42=_0xb2547[_0xdb95('0x29')]({'plain':!![]});var _0x405e27='MailQueues';return db[_0xdb95('0x4e')][_0xdb95('0x4a')]({'where':{'name':_0x405e27,'userProfileId':_0x46b880['userProfileId']},'raw':!![]})[_0xdb95('0x27')](function(_0x1f9452){if(_0x1f9452&&_0x1f9452['autoAssociation']===0x0){return db[_0xdb95('0x4f')]['create']({'name':_0xa5ad42[_0xdb95('0x2d')],'resourceId':_0xa5ad42['id'],'type':_0x1f9452[_0xdb95('0x2d')],'sectionId':_0x1f9452['id']},{})[_0xdb95('0x27')](function(){return _0xb2547;});}else{return _0xb2547;}})[_0xdb95('0x46')](function(_0x2b5c05){logger[_0xdb95('0x2c')](_0xdb95('0x50'),_0x2b5c05);throw _0x2b5c05;});}return _0xb2547;})[_0xdb95('0x27')](respondWithResult(_0x2bd026,0xc9))[_0xdb95('0x46')](handleError(_0x2bd026,null));};exports[_0xdb95('0x26')]=function(_0xe2bae,_0x5a5365){if(_0xe2bae[_0xdb95('0x51')]['id']){delete _0xe2bae['body']['id'];}return db[_0xdb95('0x30')]['find']({'where':{'id':_0xe2bae[_0xdb95('0x48')]['id']}})['then'](handleEntityNotFound(_0x5a5365,null))['then'](saveUpdates(_0xe2bae[_0xdb95('0x51')],null))['then'](respondWithResult(_0x5a5365,null))[_0xdb95('0x46')](handleError(_0x5a5365,null));};exports['destroy']=function(_0x1b3584,_0x237af4){return db[_0xdb95('0x30')][_0xdb95('0x4a')]({'where':{'id':_0x1b3584[_0xdb95('0x48')]['id']}})[_0xdb95('0x27')](handleEntityNotFound(_0x237af4,null))[_0xdb95('0x27')](removeEntity(_0x237af4,null))[_0xdb95('0x46')](handleError(_0x237af4,null));};exports['describe']=function(_0x4a29f4,_0x58a756){return db[_0xdb95('0x30')][_0xdb95('0x52')]()[_0xdb95('0x27')](respondWithResult(_0x58a756,null))[_0xdb95('0x46')](handleError(_0x58a756,null));};exports[_0xdb95('0x53')]=function(_0x3633c8,_0x386325,_0x441cf4){var _0x2330de={'raw':!![],'where':{}},_0x93f12e={},_0x6a9fa9;return db['MailQueue'][_0xdb95('0x54')]({'where':{'id':_0x3633c8[_0xdb95('0x48')]['id']}})[_0xdb95('0x27')](handleEntityNotFound(_0x386325,null))[_0xdb95('0x27')](function(_0x22ed9e){if(_0x22ed9e){_0x6a9fa9=_0x22ed9e[_0xdb95('0x29')]({'plain':!![]});_0x93f12e[_0xdb95('0x34')]=_[_0xdb95('0x49')](db[_0xdb95('0x55')]['rawAttributes']);_0x93f12e[_0xdb95('0x35')]=_[_0xdb95('0x49')](_0x3633c8[_0xdb95('0x35')]);_0x93f12e['filters']=_[_0xdb95('0x37')](_0x93f12e[_0xdb95('0x34')],_0x93f12e[_0xdb95('0x35')]);_0x2330de[_0xdb95('0x38')]=_[_0xdb95('0x37')](_0x93f12e[_0xdb95('0x34')],qs['fields'](_0x3633c8[_0xdb95('0x35')][_0xdb95('0x39')]));_0x2330de['attributes']=_0x2330de[_0xdb95('0x38')][_0xdb95('0x3a')]?_0x2330de['attributes']:_0x93f12e[_0xdb95('0x34')];if(!_0x3633c8[_0xdb95('0x35')][_0xdb95('0x56')](_0xdb95('0x57'))){_0x2330de[_0xdb95('0x1d')]=qs[_0xdb95('0x1d')](_0x3633c8[_0xdb95('0x35')][_0xdb95('0x1d')]);_0x2330de[_0xdb95('0x1c')]=qs[_0xdb95('0x1c')](_0x3633c8[_0xdb95('0x35')]['offset']);}_0x2330de['order']=qs[_0xdb95('0x3c')](_0x3633c8[_0xdb95('0x35')][_0xdb95('0x3c')]);_0x2330de[_0xdb95('0x3d')]=qs[_0xdb95('0x36')](_[_0xdb95('0x3e')](_0x3633c8[_0xdb95('0x35')],_0x93f12e[_0xdb95('0x36')]));_0x2330de[_0xdb95('0x3d')][_0xdb95('0x58')]=_0x22ed9e['id'];if(_0x3633c8[_0xdb95('0x35')]['filter']){_0x2330de[_0xdb95('0x3d')]=_[_0xdb95('0x40')](_0x2330de['where'],{'$or':_[_0xdb95('0x59')](_0x2330de['attributes'],function(_0x232404){var _0x1d858e={};_0x1d858e[_0x232404]={'$like':'%'+_0x3633c8[_0xdb95('0x35')]['filter']+'%'};return _0x1d858e;})});}_0x2330de=_[_0xdb95('0x40')]({},_0x2330de,_0x3633c8['options']);return db[_0xdb95('0x55')][_0xdb95('0x44')](_0x2330de);}})[_0xdb95('0x27')](function(_0xde6550){if(_0xde6550){return db[_0xdb95('0x5a')][_0xdb95('0x5b')]({'where':{'id':_['map'](_0xde6550,_0xdb95('0x5c')),'role':_0xdb95('0x5d')},'attributes':['id',_0xdb95('0x2d'),_0xdb95('0x5e'),_0xdb95('0x5f'),_0xdb95('0x60')]});}})[_0xdb95('0x27')](function(_0x11431a){if(_0x11431a){return{'count':_0x11431a['count'],'rows':_[_0xdb95('0x59')](_0x11431a[_0xdb95('0x45')],function(_0x231d5c){return{'membername':_0x231d5c[_0xdb95('0x2d')],'UserId':_0x231d5c['id'],'queue_name':_0x6a9fa9[_0xdb95('0x2d')],'MailQueueId':_0x6a9fa9['id'],'interface':util['format'](_0xdb95('0x61'),'SIP',_0x231d5c[_0xdb95('0x2d')]),'penalty':0x0,'paused':_0x231d5c['mailPause'],'createdAt':_0x231d5c['createdAt'],'updatedAt':_0x231d5c[_0xdb95('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdb95('0x27')](respondWithFilteredResult(_0x386325,_0x2330de))[_0xdb95('0x46')](handleError(_0x386325,null));};exports[_0xdb95('0x62')]=function(_0x264c79,_0x43f2bc,_0x1fd8c4){var _0x582307={};var _0x73a8a1={};var _0x5dbbd7;var _0x291045;return db[_0xdb95('0x30')][_0xdb95('0x54')]({'where':{'id':_0x264c79['params']['id']}})[_0xdb95('0x27')](handleEntityNotFound(_0x43f2bc,null))[_0xdb95('0x27')](function(_0x2db10a){if(_0x2db10a){_0x5dbbd7=_0x2db10a;_0x73a8a1[_0xdb95('0x34')]=_[_0xdb95('0x49')](db['Team'][_0xdb95('0x31')]);_0x73a8a1[_0xdb95('0x35')]=_['keys'](_0x264c79['query']);_0x73a8a1[_0xdb95('0x36')]=_[_0xdb95('0x37')](_0x73a8a1[_0xdb95('0x34')],_0x73a8a1[_0xdb95('0x35')]);_0x582307[_0xdb95('0x38')]=_[_0xdb95('0x37')](_0x73a8a1[_0xdb95('0x34')],qs[_0xdb95('0x39')](_0x264c79[_0xdb95('0x35')][_0xdb95('0x39')]));_0x582307[_0xdb95('0x38')]=_0x582307[_0xdb95('0x38')]['length']?_0x582307[_0xdb95('0x38')]:_0x73a8a1[_0xdb95('0x34')];_0x582307[_0xdb95('0x3b')]=qs['sort'](_0x264c79[_0xdb95('0x35')]['sort']);_0x582307['where']=qs[_0xdb95('0x36')](_[_0xdb95('0x3e')](_0x264c79[_0xdb95('0x35')],_0x73a8a1[_0xdb95('0x36')]));if(_0x264c79[_0xdb95('0x35')][_0xdb95('0x63')]){_0x582307[_0xdb95('0x3d')]=_['merge'](_0x582307[_0xdb95('0x3d')],{'$or':_[_0xdb95('0x59')](_0x582307[_0xdb95('0x38')],function(_0xd4e349){var _0x35abdc={};_0x35abdc[_0xd4e349]={'$like':'%'+_0x264c79[_0xdb95('0x35')][_0xdb95('0x63')]+'%'};return _0x35abdc;})});}_0x582307=_[_0xdb95('0x40')]({},_0x582307,_0x264c79[_0xdb95('0x41')]);return _0x5dbbd7[_0xdb95('0x62')](_0x582307);}})[_0xdb95('0x27')](function(_0x4bc565){if(_0x4bc565){_0x291045=_0x4bc565['length'];if(!_0x264c79[_0xdb95('0x35')][_0xdb95('0x56')](_0xdb95('0x57'))){_0x582307['limit']=qs['limit'](_0x264c79[_0xdb95('0x35')][_0xdb95('0x1d')]);_0x582307[_0xdb95('0x1c')]=qs[_0xdb95('0x1c')](_0x264c79['query']['offset']);}return _0x5dbbd7[_0xdb95('0x62')](_0x582307);}})['then'](function(_0xb61164){if(_0xb61164){return _0xb61164?{'count':_0x291045,'rows':_0xb61164}:null;}})[_0xdb95('0x27')](respondWithResult(_0x43f2bc,null))[_0xdb95('0x46')](handleError(_0x43f2bc,null));};exports[_0xdb95('0x64')]=function(_0x170ccd,_0x5e0df7,_0x51b4af){var _0x5c48df=_0x170ccd[_0xdb95('0x51')][_0xdb95('0x65')];return db[_0xdb95('0x66')]['findAll']({'where':{'id':_0x5c48df},'attributes':['id'],'include':[{'model':db[_0xdb95('0x5a')],'as':_0xdb95('0x67'),'attributes':['id',_0xdb95('0x2d'),_0xdb95('0x68'),_0xdb95('0x69'),'interface'],'raw':!![]}]})['then'](function(_0x27f4d5){if(_0x27f4d5){var _0x276608=_[_0xdb95('0x6a')](_0x27f4d5,function(_0x6780f6){var _0x80a21f=_0x6780f6[_0xdb95('0x29')]({'plain':!![]});return _0x80a21f[_0xdb95('0x67')];});return db[_0xdb95('0x30')][_0xdb95('0x4a')]({'where':{'id':_0x170ccd[_0xdb95('0x48')]['id']}})['then'](function(_0x59c61c){return db[_0xdb95('0x6b')][_0xdb95('0x6c')](function(_0x3c71fd){return _0x59c61c[_0xdb95('0x64')](_0x5c48df,{'transaction':_0x3c71fd})[_0xdb95('0x27')](function(){return BPromise['each'](_0x276608,function(_0x160749){return db[_0xdb95('0x55')]['findOrCreate']({'where':{'UserId':_0x160749['id'],'MailQueueId':_0x170ccd['params']['id']},'transaction':_0x3c71fd});});})[_0xdb95('0x27')](function(){_0x276608[_0xdb95('0x6d')](function(_0x1b9d4b){socket['emit'](_0xdb95('0x6e'),{'UserId':_0x1b9d4b['id'],'MailQueueId':_0x59c61c['id']});});});});});}})['then'](respondWithStatusCode(_0x5e0df7,null))[_0xdb95('0x46')](handleError(_0x5e0df7,null));};exports[_0xdb95('0x6f')]=function(_0x1a415a,_0x266ae7,_0x31db6a){return db['Team'][_0xdb95('0x44')]({'where':{'id':_0x1a415a['query'][_0xdb95('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdb95('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x266ae7,null))['then'](function(_0x2bbfcb){var _0x53ac25=_[_0xdb95('0x59')](_0x2bbfcb,'id');var _0x3096b4=[];var _0x2eb52=[];var _0x207a35=squel[_0xdb95('0x70')]();_0x207a35[_0xdb95('0x71')](_0xdb95('0x72'))[_0xdb95('0x73')]('team_has_mail_queues','tq')[_0xdb95('0x74')](_0xdb95('0x75'),'ut',_0xdb95('0x76'))[_0xdb95('0x3d')](_0xdb95('0x77'),_0x1a415a['params']['id']);for(var _0x11f4c1=0x0;_0x11f4c1<_0x2bbfcb[_0xdb95('0x3a')];_0x11f4c1+=0x1){let _0x2e44b2=_0x2bbfcb[_0x11f4c1];for(var _0x518e23=0x0;_0x518e23<_0x2e44b2[_0xdb95('0x67')]['length'];_0x518e23+=0x1){let _0x2e2459=_0x2e44b2[_0xdb95('0x67')][_0x518e23];var _0x3a6e33=_0x207a35[_0xdb95('0x78')]();_0x3a6e33[_0xdb95('0x3d')](_0xdb95('0x79'),_0x2e2459['id']);_0x2eb52[_0xdb95('0x7a')](db[_0xdb95('0x6b')][_0xdb95('0x35')](_0x3a6e33[_0xdb95('0x7b')](),{'type':db[_0xdb95('0x6b')][_0xdb95('0x7c')][_0xdb95('0x7d')]})[_0xdb95('0x27')](function(_0x47a452){if(_0x47a452[_0xdb95('0x3a')]===0x1){return _0x2e2459['id'];}else{var _0x5e5675=_[_0xdb95('0x7e')](_[_0xdb95('0x59')](_0x47a452,_0xdb95('0x7f')),function(_0x332fe6){return _['includes'](_0x53ac25,_0x332fe6);});if(_0x5e5675){return _0x2e2459['id'];}}}));}}return BPromise[_0xdb95('0x80')](_0x2eb52)[_0xdb95('0x27')](function(_0x55ad6a){_0x3096b4=_(_0x3096b4)[_0xdb95('0x81')](_0x55ad6a)[_0xdb95('0x82')]()['value']();return db[_0xdb95('0x30')][_0xdb95('0x4a')]({'where':{'id':_0x1a415a['params']['id']}})[_0xdb95('0x27')](function(_0x281a1f){return db['sequelize']['transaction'](function(_0x5c2c98){return _0x281a1f[_0xdb95('0x6f')](_0x1a415a[_0xdb95('0x35')]['ids'],{'transaction':_0x5c2c98})['then'](function(){if(!_[_0xdb95('0x83')](_0x3096b4)){return _0x281a1f[_0xdb95('0x84')](_0x3096b4,{'transaction':_0x5c2c98});}})[_0xdb95('0x27')](function(){_0x3096b4['forEach'](function(_0x434f53){socket[_0xdb95('0x85')](_0xdb95('0x86'),{'UserId':_0x434f53,'MailQueueId':_0x281a1f['id']});});});});});});})[_0xdb95('0x27')](respondWithStatusCode(_0x266ae7,null))['catch'](handleError(_0x266ae7,null));};exports['addAgents']=function(_0x1a007f,_0x33a6ab,_0x19855b){return db[_0xdb95('0x30')][_0xdb95('0x4a')]({'where':{'id':_0x1a007f[_0xdb95('0x48')]['id']}})['then'](handleEntityNotFound(_0x33a6ab,null))[_0xdb95('0x27')](function(_0xbb48d0){if(_0xbb48d0){return _0xbb48d0[_0xdb95('0x87')](_0x1a007f[_0xdb95('0x51')][_0xdb95('0x65')],_[_0xdb95('0x88')](_0x1a007f[_0xdb95('0x51')],[_0xdb95('0x65'),'id'])||{})[_0xdb95('0x89')](function(_0x4a2d7b){for(var _0x5a4dc3=0x0;_0x5a4dc3<_0x1a007f[_0xdb95('0x51')][_0xdb95('0x65')][_0xdb95('0x3a')];_0x5a4dc3+=0x1){socket['emit'](_0xdb95('0x6e'),{'UserId':Number(_0x1a007f[_0xdb95('0x51')][_0xdb95('0x65')][_0x5a4dc3]),'MailQueueId':Number(_0x1a007f[_0xdb95('0x48')]['id'])});}return _0x4a2d7b;});}})[_0xdb95('0x27')](respondWithResult(_0x33a6ab,null))[_0xdb95('0x46')](handleError(_0x33a6ab,null));};exports['removeAgents']=function(_0x1896d9,_0x38f303,_0x597423){return db['MailQueue'][_0xdb95('0x4a')]({'where':{'id':_0x1896d9[_0xdb95('0x48')]['id']}})[_0xdb95('0x27')](handleEntityNotFound(_0x38f303,null))['then'](function(_0x3abf23){if(_0x3abf23){return _0x3abf23['removeAgents'](_0x1896d9[_0xdb95('0x35')]['ids'])[_0xdb95('0x27')](function(){if(_['isArray'](_0x1896d9['query'][_0xdb95('0x65')])){for(var _0x55a6e1=0x0;_0x55a6e1<_0x1896d9[_0xdb95('0x35')]['ids']['length'];_0x55a6e1+=0x1){socket['emit'](_0xdb95('0x86'),{'UserId':Number(_0x1896d9[_0xdb95('0x35')][_0xdb95('0x65')][_0x55a6e1]),'MailQueueId':Number(_0x1896d9[_0xdb95('0x48')]['id'])});}}else{socket[_0xdb95('0x85')]('userMailQueue:remove',{'UserId':Number(_0x1896d9[_0xdb95('0x35')][_0xdb95('0x65')]),'MailQueueId':Number(_0x1896d9[_0xdb95('0x48')]['id'])});}});}})[_0xdb95('0x27')](respondWithStatusCode(_0x38f303,null))[_0xdb95('0x46')](handleError(_0x38f303,null));};exports['getAgents']=function(_0x30d9c0,_0x57ba4e,_0x157c5b){var _0x3f25a1={};var _0x28b118={};var _0x337754;var _0x192af8;return db[_0xdb95('0x30')][_0xdb95('0x54')]({'where':{'id':_0x30d9c0[_0xdb95('0x48')]['id']}})[_0xdb95('0x27')](handleEntityNotFound(_0x57ba4e,null))[_0xdb95('0x27')](function(_0x5ba6c5){if(_0x5ba6c5){_0x337754=_0x5ba6c5;_0x28b118[_0xdb95('0x34')]=_['keys'](db[_0xdb95('0x5a')][_0xdb95('0x31')]);_0x28b118[_0xdb95('0x35')]=_[_0xdb95('0x49')](_0x30d9c0[_0xdb95('0x35')]);_0x28b118[_0xdb95('0x36')]=_[_0xdb95('0x37')](_0x28b118['model'],_0x28b118['query']);_0x3f25a1[_0xdb95('0x38')]=_[_0xdb95('0x37')](_0x28b118[_0xdb95('0x34')],qs[_0xdb95('0x39')](_0x30d9c0[_0xdb95('0x35')][_0xdb95('0x39')]));_0x3f25a1['attributes']=_0x3f25a1[_0xdb95('0x38')][_0xdb95('0x3a')]?_0x3f25a1[_0xdb95('0x38')]:_0x28b118[_0xdb95('0x34')];_0x3f25a1['order']=qs[_0xdb95('0x3c')](_0x30d9c0[_0xdb95('0x35')][_0xdb95('0x3c')]);_0x3f25a1[_0xdb95('0x3d')]=qs[_0xdb95('0x36')](_[_0xdb95('0x3e')](_0x30d9c0[_0xdb95('0x35')],_0x28b118[_0xdb95('0x36')]));if(_0x30d9c0[_0xdb95('0x35')]['filter']){_0x3f25a1[_0xdb95('0x3d')]=_[_0xdb95('0x40')](_0x3f25a1[_0xdb95('0x3d')],{'$or':_['map'](_0x3f25a1[_0xdb95('0x38')],function(_0x30fc1b){var _0x4a211b={};_0x4a211b[_0x30fc1b]={'$like':'%'+_0x30d9c0['query'][_0xdb95('0x63')]+'%'};return _0x4a211b;})});}_0x3f25a1=_['merge']({},_0x3f25a1,_0x30d9c0[_0xdb95('0x41')]);return _0x337754['getAgents'](_0x3f25a1);}})['then'](function(_0x293041){if(_0x293041){_0x192af8=_0x293041[_0xdb95('0x3a')];if(!_0x30d9c0['query'][_0xdb95('0x56')](_0xdb95('0x57'))){_0x3f25a1[_0xdb95('0x1d')]=qs['limit'](_0x30d9c0[_0xdb95('0x35')]['limit']);_0x3f25a1[_0xdb95('0x1c')]=qs['offset'](_0x30d9c0[_0xdb95('0x35')][_0xdb95('0x1c')]);}return _0x337754[_0xdb95('0x8a')](_0x3f25a1);}})[_0xdb95('0x27')](function(_0x1416d3){if(_0x1416d3){return _0x1416d3?{'count':_0x192af8,'rows':_0x1416d3}:null;}})['then'](respondWithResult(_0x57ba4e,null))[_0xdb95('0x46')](handleError(_0x57ba4e,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index b3d32e8..8d3279e 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 _0x868b=['remove','emit','hook','exports','events','../../mysqldb','MailQueue'];(function(_0x475191,_0x5bce86){var _0x189e96=function(_0x46d6a2){while(--_0x46d6a2){_0x475191['push'](_0x475191['shift']());}};_0x189e96(++_0x5bce86);}(_0x868b,0x138));var _0xb868=function(_0x3c9001,_0x113a6a){_0x3c9001=_0x3c9001-0x0;var _0x597135=_0x868b[_0x3c9001];return _0x597135;};'use strict';var EventEmitter=require(_0xb868('0x0'));var MailQueue=require(_0xb868('0x1'))['db'][_0xb868('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb868('0x3')};function emitEvent(_0x3b4d83){return function(_0x125619,_0x4d6eec,_0x46da6b){MailQueueEvents[_0xb868('0x4')](_0x3b4d83+':'+_0x125619['id'],_0x125619);MailQueueEvents[_0xb868('0x4')](_0x3b4d83,_0x125619);_0x46da6b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xb868('0x5')](e,emitEvent(event));}}module[_0xb868('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x02da=['remove','emit','hasOwnProperty','hook','exports','MailQueue','setMaxListeners','update'];(function(_0x3982a8,_0x24d418){var _0x16cf89=function(_0x310d71){while(--_0x310d71){_0x3982a8['push'](_0x3982a8['shift']());}};_0x16cf89(++_0x24d418);}(_0x02da,0x105));var _0xa02d=function(_0x574a4c,_0x1104d1){_0x574a4c=_0x574a4c-0x0;var _0x50e796=_0x02da[_0x574a4c];return _0x50e796;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0xa02d('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa02d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa02d('0x2'),'afterDestroy':_0xa02d('0x3')};function emitEvent(_0x38d4d9){return function(_0x490f60,_0x1c6633,_0x21809e){MailQueueEvents['emit'](_0x38d4d9+':'+_0x490f60['id'],_0x490f60);MailQueueEvents[_0xa02d('0x4')](_0x38d4d9,_0x490f60);_0x21809e(null);};}for(var e in events){if(events[_0xa02d('0x5')](e)){var event=events[e];MailQueue[_0xa02d('0x6')](e,emitEvent(event));}}module[_0xa02d('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 3c5669f..5903f1d 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 _0xb323=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailQueue','lodash','util','../../config/logger'];(function(_0x4bf923,_0x527f7a){var _0x4162eb=function(_0x94d84c){while(--_0x94d84c){_0x4bf923['push'](_0x4bf923['shift']());}};_0x4162eb(++_0x527f7a);}(_0xb323,0x152));var _0x3b32=function(_0x57214a,_0x59cbb2){_0x57214a=_0x57214a-0x0;var _0x3c079d=_0xb323[_0x57214a];return _0x3c079d;};'use strict';var _=require(_0x3b32('0x0'));var util=require(_0x3b32('0x1'));var logger=require(_0x3b32('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3b32('0x3'));var rp=require(_0x3b32('0x4'));var fs=require('fs');var path=require(_0x3b32('0x5'));var rimraf=require(_0x3b32('0x6'));var config=require(_0x3b32('0x7'));var attributes=require('./mailQueue.attributes');module[_0x3b32('0x8')]=function(_0x499fd1,_0x2dcd46){return _0x499fd1[_0x3b32('0x9')](_0x3b32('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd348=['rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x267dd5,_0x22a657){var _0x3ba9d4=function(_0x38667e){while(--_0x38667e){_0x267dd5['push'](_0x267dd5['shift']());}};_0x3ba9d4(++_0x22a657);}(_0xd348,0xaf));var _0x8d34=function(_0xc7cb34,_0xe3bb16){_0xc7cb34=_0xc7cb34-0x0;var _0x5dfdb7=_0xd348[_0xc7cb34];return _0x5dfdb7;};'use strict';var _=require(_0x8d34('0x0'));var util=require(_0x8d34('0x1'));var logger=require(_0x8d34('0x2'))(_0x8d34('0x3'));var moment=require(_0x8d34('0x4'));var BPromise=require('bluebird');var rp=require(_0x8d34('0x5'));var fs=require('fs');var path=require(_0x8d34('0x6'));var rimraf=require(_0x8d34('0x7'));var config=require(_0x8d34('0x8'));var attributes=require(_0x8d34('0x9'));module['exports']=function(_0x1d0202,_0x2ff227){return _0x1d0202[_0x8d34('0xa')](_0x8d34('0xb'),attributes,{'tableName':_0x8d34('0xc'),'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 550caf9..d171561 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 _0x2ccd=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','MailQueue,\x20%s,\x20%s','message','catch','GetMailQueue','findAll','options','where','attributes','limit','map','model','include','stringify','ShowMailQueue','MailQueue','find','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x1d4cc9,_0x5cd4a9){var _0x266b4a=function(_0xdfc494){while(--_0xdfc494){_0x1d4cc9['push'](_0x1d4cc9['shift']());}};_0x266b4a(++_0x5cd4a9);}(_0x2ccd,0x1e6));var _0xd2cc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2ccd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd2cc('0x0'));var util=require(_0xd2cc('0x1'));var moment=require('moment');var BPromise=require(_0xd2cc('0x2'));var rs=require(_0xd2cc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd2cc('0x4'));var logger=require(_0xd2cc('0x5'))(_0xd2cc('0x6'));var config=require(_0xd2cc('0x7'));var jayson=require(_0xd2cc('0x8'));var client=jayson[_0xd2cc('0x9')][_0xd2cc('0xa')]({'port':0x232a});config[_0xd2cc('0xb')]=_[_0xd2cc('0xc')](config[_0xd2cc('0xb')],{'host':_0xd2cc('0xd'),'port':0x18eb});var socket=require(_0xd2cc('0xe'))(new Redis(config[_0xd2cc('0xb')]));require(_0xd2cc('0xf'))[_0xd2cc('0x10')](socket);function respondWithRpcPromise(_0x44846b,_0x48cb89,_0x466627){return new BPromise(function(_0xfb6664,_0x48909b){return client[_0xd2cc('0x11')](_0x44846b,_0x466627)[_0xd2cc('0x12')](function(_0x209f6b){logger[_0xd2cc('0x13')]('MailQueue,\x20%s,\x20%s',_0x48cb89,_0xd2cc('0x14'));logger[_0xd2cc('0x15')](_0xd2cc('0x16'),_0x48cb89,_0xd2cc('0x14'),JSON['stringify'](_0x209f6b));if(_0x209f6b[_0xd2cc('0x17')]){if(_0x209f6b[_0xd2cc('0x17')][_0xd2cc('0x18')]===0x1f4){logger[_0xd2cc('0x17')](_0xd2cc('0x19'),_0x48cb89,_0x209f6b[_0xd2cc('0x17')][_0xd2cc('0x1a')]);return _0x48909b(_0x209f6b[_0xd2cc('0x17')]['message']);}logger[_0xd2cc('0x17')](_0xd2cc('0x19'),_0x48cb89,_0x209f6b[_0xd2cc('0x17')][_0xd2cc('0x1a')]);return _0xfb6664(_0x209f6b[_0xd2cc('0x17')][_0xd2cc('0x1a')]);}else{logger['info'](_0xd2cc('0x19'),_0x48cb89,_0xd2cc('0x14'));_0xfb6664(_0x209f6b['result'][_0xd2cc('0x1a')]);}})[_0xd2cc('0x1b')](function(_0x3efdf6){logger[_0xd2cc('0x17')](_0xd2cc('0x19'),_0x48cb89,_0x3efdf6);_0x48909b(_0x3efdf6);});});}exports[_0xd2cc('0x1c')]=function(_0x2c3c51){var _0x358e09=this;return new Promise(function(_0x1122fc,_0x5d0d7e){return db['MailQueue'][_0xd2cc('0x1d')]({'raw':_0x2c3c51['options']?_0x2c3c51[_0xd2cc('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2c3c51[_0xd2cc('0x1e')]?_0x2c3c51[_0xd2cc('0x1e')][_0xd2cc('0x1f')]||null:null,'attributes':_0x2c3c51[_0xd2cc('0x1e')]?_0x2c3c51[_0xd2cc('0x1e')][_0xd2cc('0x20')]||null:null,'limit':_0x2c3c51[_0xd2cc('0x1e')]?_0x2c3c51[_0xd2cc('0x1e')][_0xd2cc('0x21')]||null:null,'include':_0x2c3c51[_0xd2cc('0x1e')]?_0x2c3c51[_0xd2cc('0x1e')]['include']?_[_0xd2cc('0x22')](_0x2c3c51[_0xd2cc('0x1e')]['include'],function(_0x48c1df){return{'model':db[_0x48c1df[_0xd2cc('0x23')]],'as':_0x48c1df['as'],'attributes':_0x48c1df[_0xd2cc('0x20')],'include':_0x48c1df[_0xd2cc('0x24')]?_['map'](_0x48c1df['include'],function(_0x1ce9c3){return{'model':db[_0x1ce9c3[_0xd2cc('0x23')]],'as':_0x1ce9c3['as'],'attributes':_0x1ce9c3[_0xd2cc('0x20')],'include':_0x1ce9c3['include']?_[_0xd2cc('0x22')](_0x1ce9c3[_0xd2cc('0x24')],function(_0x112788){return{'model':db[_0x112788[_0xd2cc('0x23')]],'as':_0x112788['as'],'attributes':_0x112788[_0xd2cc('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd2cc('0x12')](function(_0x1fa2c9){logger[_0xd2cc('0x13')](_0xd2cc('0x1c'),_0x2c3c51);logger[_0xd2cc('0x15')](_0xd2cc('0x1c'),_0x2c3c51,JSON[_0xd2cc('0x25')](_0x1fa2c9));_0x1122fc(_0x1fa2c9);})[_0xd2cc('0x1b')](function(_0xf40302){logger[_0xd2cc('0x17')]('GetMailQueue',_0xf40302[_0xd2cc('0x1a')],_0x2c3c51);_0x5d0d7e(_0x358e09[_0xd2cc('0x17')](0x1f4,_0xf40302[_0xd2cc('0x1a')]));});});};exports[_0xd2cc('0x26')]=function(_0x3bbd12){var _0x368441=this;return new Promise(function(_0x13101d,_0x59d342){return db[_0xd2cc('0x27')][_0xd2cc('0x28')]({'raw':_0x3bbd12[_0xd2cc('0x1e')]?_0x3bbd12[_0xd2cc('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3bbd12[_0xd2cc('0x1e')]?_0x3bbd12[_0xd2cc('0x1e')][_0xd2cc('0x1f')]||null:null,'attributes':_0x3bbd12['options']?_0x3bbd12['options'][_0xd2cc('0x20')]||null:null,'include':_0x3bbd12[_0xd2cc('0x1e')]?_0x3bbd12[_0xd2cc('0x1e')]['include']?_[_0xd2cc('0x22')](_0x3bbd12['options'][_0xd2cc('0x24')],function(_0x2d0931){return{'model':db[_0x2d0931[_0xd2cc('0x23')]],'as':_0x2d0931['as'],'attributes':_0x2d0931[_0xd2cc('0x20')],'include':_0x2d0931['include']?_[_0xd2cc('0x22')](_0x2d0931[_0xd2cc('0x24')],function(_0x2c523b){return{'model':db[_0x2c523b[_0xd2cc('0x23')]],'as':_0x2c523b['as'],'attributes':_0x2c523b[_0xd2cc('0x20')],'include':_0x2c523b['include']?_[_0xd2cc('0x22')](_0x2c523b[_0xd2cc('0x24')],function(_0x1940c7){return{'model':db[_0x1940c7[_0xd2cc('0x23')]],'as':_0x1940c7['as'],'attributes':_0x1940c7[_0xd2cc('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd2cc('0x12')](function(_0x2e1753){logger[_0xd2cc('0x13')]('ShowMailQueue',_0x3bbd12);logger['debug'](_0xd2cc('0x26'),_0x3bbd12,JSON[_0xd2cc('0x25')](_0x2e1753));_0x13101d(_0x2e1753);})[_0xd2cc('0x1b')](function(_0x15641a){logger[_0xd2cc('0x17')]('ShowMailQueue',_0x15641a[_0xd2cc('0x1a')],_0x3bbd12);_0x59d342(_0x368441[_0xd2cc('0x17')](0x1f4,_0x15641a[_0xd2cc('0x1a')]));});});}; \ No newline at end of file +var _0xa74b=['include','map','model','attributes','then','catch','ShowMailQueue','find','lodash','util','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','request\x20sent','debug','stringify','error','code','message','MailQueue,\x20%s,\x20%s','result','GetMailQueue','MailQueue','findAll','options','raw','where','limit'];(function(_0x37c2ee,_0x2dcbd6){var _0x10d7c2=function(_0x861852){while(--_0x861852){_0x37c2ee['push'](_0x37c2ee['shift']());}};_0x10d7c2(++_0x2dcbd6);}(_0xa74b,0x140));var _0xba74=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa74b[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xba74('0x0'));var util=require(_0xba74('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba74('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xba74('0x3'))(_0xba74('0x4'));var config=require('../../config/environment');var jayson=require(_0xba74('0x5'));var client=jayson[_0xba74('0x6')][_0xba74('0x7')]({'port':0x232a});config[_0xba74('0x8')]=_[_0xba74('0x9')](config[_0xba74('0x8')],{'host':_0xba74('0xa'),'port':0x18eb});var socket=require(_0xba74('0xb'))(new Redis(config[_0xba74('0x8')]));require(_0xba74('0xc'))[_0xba74('0xd')](socket);function respondWithRpcPromise(_0x26c8a6,_0x3dbb25,_0x37819a){return new BPromise(function(_0x1a45a7,_0xd20e64){return client[_0xba74('0xe')](_0x26c8a6,_0x37819a)['then'](function(_0x503d16){logger[_0xba74('0xf')]('MailQueue,\x20%s,\x20%s',_0x3dbb25,_0xba74('0x10'));logger[_0xba74('0x11')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x3dbb25,_0xba74('0x10'),JSON[_0xba74('0x12')](_0x503d16));if(_0x503d16[_0xba74('0x13')]){if(_0x503d16[_0xba74('0x13')][_0xba74('0x14')]===0x1f4){logger[_0xba74('0x13')]('MailQueue,\x20%s,\x20%s',_0x3dbb25,_0x503d16[_0xba74('0x13')][_0xba74('0x15')]);return _0xd20e64(_0x503d16[_0xba74('0x13')][_0xba74('0x15')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x3dbb25,_0x503d16[_0xba74('0x13')]['message']);return _0x1a45a7(_0x503d16[_0xba74('0x13')][_0xba74('0x15')]);}else{logger[_0xba74('0xf')](_0xba74('0x16'),_0x3dbb25,'request\x20sent');_0x1a45a7(_0x503d16[_0xba74('0x17')]['message']);}})['catch'](function(_0x1c31d6){logger[_0xba74('0x13')]('MailQueue,\x20%s,\x20%s',_0x3dbb25,_0x1c31d6);_0xd20e64(_0x1c31d6);});});}exports[_0xba74('0x18')]=function(_0x2f1d2f){var _0x3f9ed5=this;return new Promise(function(_0x2a4cc1,_0x568a92){return db[_0xba74('0x19')][_0xba74('0x1a')]({'raw':_0x2f1d2f[_0xba74('0x1b')]?_0x2f1d2f[_0xba74('0x1b')][_0xba74('0x1c')]===undefined?!![]:![]:!![],'where':_0x2f1d2f[_0xba74('0x1b')]?_0x2f1d2f[_0xba74('0x1b')][_0xba74('0x1d')]||null:null,'attributes':_0x2f1d2f[_0xba74('0x1b')]?_0x2f1d2f[_0xba74('0x1b')]['attributes']||null:null,'limit':_0x2f1d2f[_0xba74('0x1b')]?_0x2f1d2f[_0xba74('0x1b')][_0xba74('0x1e')]||null:null,'include':_0x2f1d2f[_0xba74('0x1b')]?_0x2f1d2f[_0xba74('0x1b')][_0xba74('0x1f')]?_[_0xba74('0x20')](_0x2f1d2f[_0xba74('0x1b')][_0xba74('0x1f')],function(_0x3726ec){return{'model':db[_0x3726ec[_0xba74('0x21')]],'as':_0x3726ec['as'],'attributes':_0x3726ec['attributes'],'include':_0x3726ec[_0xba74('0x1f')]?_[_0xba74('0x20')](_0x3726ec[_0xba74('0x1f')],function(_0xa9fe9b){return{'model':db[_0xa9fe9b['model']],'as':_0xa9fe9b['as'],'attributes':_0xa9fe9b[_0xba74('0x22')],'include':_0xa9fe9b['include']?_[_0xba74('0x20')](_0xa9fe9b[_0xba74('0x1f')],function(_0x3642e0){return{'model':db[_0x3642e0[_0xba74('0x21')]],'as':_0x3642e0['as'],'attributes':_0x3642e0[_0xba74('0x22')]};}):[]};}):[]};}):[]:[]})[_0xba74('0x23')](function(_0x7ea243){logger['info'](_0xba74('0x18'),_0x2f1d2f);logger[_0xba74('0x11')](_0xba74('0x18'),_0x2f1d2f,JSON['stringify'](_0x7ea243));_0x2a4cc1(_0x7ea243);})[_0xba74('0x24')](function(_0x3616dd){logger['error'](_0xba74('0x18'),_0x3616dd['message'],_0x2f1d2f);_0x568a92(_0x3f9ed5[_0xba74('0x13')](0x1f4,_0x3616dd[_0xba74('0x15')]));});});};exports[_0xba74('0x25')]=function(_0x166ea4){var _0x27415f=this;return new Promise(function(_0x41254e,_0x559809){return db[_0xba74('0x19')][_0xba74('0x26')]({'raw':_0x166ea4['options']?_0x166ea4[_0xba74('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x166ea4[_0xba74('0x1b')]?_0x166ea4['options'][_0xba74('0x1d')]||null:null,'attributes':_0x166ea4[_0xba74('0x1b')]?_0x166ea4[_0xba74('0x1b')][_0xba74('0x22')]||null:null,'include':_0x166ea4[_0xba74('0x1b')]?_0x166ea4[_0xba74('0x1b')]['include']?_[_0xba74('0x20')](_0x166ea4[_0xba74('0x1b')]['include'],function(_0x529a88){return{'model':db[_0x529a88[_0xba74('0x21')]],'as':_0x529a88['as'],'attributes':_0x529a88['attributes'],'include':_0x529a88[_0xba74('0x1f')]?_['map'](_0x529a88[_0xba74('0x1f')],function(_0x586b3c){return{'model':db[_0x586b3c[_0xba74('0x21')]],'as':_0x586b3c['as'],'attributes':_0x586b3c[_0xba74('0x22')],'include':_0x586b3c[_0xba74('0x1f')]?_[_0xba74('0x20')](_0x586b3c[_0xba74('0x1f')],function(_0x4a03ff){return{'model':db[_0x4a03ff[_0xba74('0x21')]],'as':_0x4a03ff['as'],'attributes':_0x4a03ff[_0xba74('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f64de){logger['info']('ShowMailQueue',_0x166ea4);logger[_0xba74('0x11')](_0xba74('0x25'),_0x166ea4,JSON[_0xba74('0x12')](_0x2f64de));_0x41254e(_0x2f64de);})['catch'](function(_0x496b2a){logger[_0xba74('0x13')](_0xba74('0x25'),_0x496b2a['message'],_0x166ea4);_0x559809(_0x27415f[_0xba74('0x13')](0x1f4,_0x496b2a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 47c1d4d..54e3bc9 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 _0x2bc5=['removeListener','register','mailQueue:','update'];(function(_0x4880fd,_0x2cc70d){var _0x4a4b50=function(_0xafeb91){while(--_0xafeb91){_0x4880fd['push'](_0x4880fd['shift']());}};_0x4a4b50(++_0x2cc70d);}(_0x2bc5,0x1bb));var _0x52bc=function(_0x35245d,_0x193583){_0x35245d=_0x35245d-0x0;var _0x184a83=_0x2bc5[_0x35245d];return _0x184a83;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save','remove',_0x52bc('0x0')];function createListener(_0x35a696,_0x19e2da){return function(_0x42ef8c){_0x19e2da['emit'](_0x35a696,_0x42ef8c);};}function removeListener(_0x1bd380,_0x2fd964){return function(){MailQueueEvents[_0x52bc('0x1')](_0x1bd380,_0x2fd964);};}exports[_0x52bc('0x2')]=function(_0x25e067){for(var _0xfe74af=0x0,_0x1802c9=events['length'];_0xfe74af<_0x1802c9;_0xfe74af++){var _0x4e99d8=events[_0xfe74af];var _0x3f85aa=createListener(_0x52bc('0x3')+_0x4e99d8,_0x25e067);MailQueueEvents['on'](_0x4e99d8,_0x3f85aa);}}; \ No newline at end of file +var _0x6afd=['length','mailQueue:','save','remove','update','emit','removeListener','register'];(function(_0x4b2f6e,_0x8f9747){var _0x2c77f6=function(_0x297f51){while(--_0x297f51){_0x4b2f6e['push'](_0x4b2f6e['shift']());}};_0x2c77f6(++_0x8f9747);}(_0x6afd,0x9a));var _0xd6af=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x6afd[_0x12d033];return _0x3b4e80;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xd6af('0x0'),_0xd6af('0x1'),_0xd6af('0x2')];function createListener(_0x4a35a4,_0x435c0f){return function(_0x39de8a){_0x435c0f[_0xd6af('0x3')](_0x4a35a4,_0x39de8a);};}function removeListener(_0x5e4286,_0x2ec2f5){return function(){MailQueueEvents[_0xd6af('0x4')](_0x5e4286,_0x2ec2f5);};}exports[_0xd6af('0x5')]=function(_0x565aaf){for(var _0x647903=0x0,_0x36fa8f=events[_0xd6af('0x6')];_0x647903<_0x36fa8f;_0x647903++){var _0x3610cc=events[_0x647903];var _0x1c28fb=createListener(_0xd6af('0x7')+_0x3610cc,_0x565aaf);MailQueueEvents['on'](_0x3610cc,_0x1c28fb);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 442416c..cac2370 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 _0xa724=['get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller'];(function(_0x3be0c4,_0x5b7eff){var _0x11af9f=function(_0x3f5113){while(--_0x3f5113){_0x3be0c4['push'](_0x3be0c4['shift']());}};_0x11af9f(++_0x5b7eff);}(_0xa724,0xf3));var _0x4a72=function(_0x38d5a2,_0xb0c589){_0x38d5a2=_0x38d5a2-0x0;var _0xba6e14=_0xa724[_0x38d5a2];return _0xba6e14;};'use strict';var multer=require(_0x4a72('0x0'));var util=require(_0x4a72('0x1'));var path=require(_0x4a72('0x2'));var timeout=require(_0x4a72('0x3'));var express=require(_0x4a72('0x4'));var router=express[_0x4a72('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4a72('0x6'));var interaction=require(_0x4a72('0x7'));var config=require(_0x4a72('0x8'));var controller=require(_0x4a72('0x9'));router[_0x4a72('0xa')]('/',auth[_0x4a72('0xb')](),controller[_0x4a72('0xc')]);router[_0x4a72('0xa')](_0x4a72('0xd'),auth[_0x4a72('0xb')](),controller[_0x4a72('0xe')]);router[_0x4a72('0xa')]('/:id',auth[_0x4a72('0xb')](),controller[_0x4a72('0xf')]);router[_0x4a72('0x10')]('/',auth[_0x4a72('0xb')](),controller[_0x4a72('0x11')]);router[_0x4a72('0x12')](_0x4a72('0x13'),auth[_0x4a72('0xb')](),controller[_0x4a72('0x14')]);router[_0x4a72('0x15')](_0x4a72('0x13'),auth[_0x4a72('0xb')](),controller['destroy']);module[_0x4a72('0x16')]=router; \ No newline at end of file +var _0x2951=['get','index','/describe','/:id','post','create','put','isAuthenticated','delete','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailQueueReport.controller'];(function(_0x492d4a,_0x5cd9f4){var _0x6b5831=function(_0x2ed9d3){while(--_0x2ed9d3){_0x492d4a['push'](_0x492d4a['shift']());}};_0x6b5831(++_0x5cd9f4);}(_0x2951,0x1da));var _0x1295=function(_0x271537,_0x8b7b3b){_0x271537=_0x271537-0x0;var _0x19dc22=_0x2951[_0x271537];return _0x19dc22;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1295('0x0'));var express=require(_0x1295('0x1'));var router=express[_0x1295('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1295('0x3'));var config=require(_0x1295('0x4'));var controller=require(_0x1295('0x5'));router[_0x1295('0x6')]('/',auth['isAuthenticated'](),controller[_0x1295('0x7')]);router['get'](_0x1295('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x1295('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x1295('0xa')]('/',auth['isAuthenticated'](),controller[_0x1295('0xb')]);router[_0x1295('0xc')](_0x1295('0x9'),auth[_0x1295('0xd')](),controller['update']);router[_0x1295('0xe')](_0x1295('0x9'),auth[_0x1295('0xd')](),controller['destroy']);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 40973e4..089456b 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 _0x0428=['moment','exports','STRING','DATE'];(function(_0x5ed06a,_0x36c0e5){var _0x829b45=function(_0x25fd8d){while(--_0x25fd8d){_0x5ed06a['push'](_0x5ed06a['shift']());}};_0x829b45(++_0x36c0e5);}(_0x0428,0x138));var _0x8042=function(_0x45db17,_0x260e62){_0x45db17=_0x45db17-0x0;var _0x1cdfe3=_0x0428[_0x45db17];return _0x1cdfe3;};'use strict';var moment=require(_0x8042('0x0'));var Sequelize=require('sequelize');module[_0x8042('0x1')]={'uniqueid':{'type':Sequelize[_0x8042('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x8042('0x2')]},'joinAt':{'type':Sequelize[_0x8042('0x3')]},'leaveAt':{'type':Sequelize[_0x8042('0x3')]},'acceptAt':{'type':Sequelize[_0x8042('0x3')]},'exitAt':{'type':Sequelize[_0x8042('0x3')]},'reason':{'type':Sequelize[_0x8042('0x2')]}}; \ No newline at end of file +var _0xee14=['STRING','DATE','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee14,0x13a));var _0x4ee1=function(_0x548079,_0x294ea2){_0x548079=_0x548079-0x0;var _0x1c4dbd=_0xee14[_0x548079];return _0x1c4dbd;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x4ee1('0x0')]={'uniqueid':{'type':Sequelize[_0x4ee1('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x4ee1('0x1')]},'joinAt':{'type':Sequelize[_0x4ee1('0x2')]},'leaveAt':{'type':Sequelize[_0x4ee1('0x2')]},'acceptAt':{'type':Sequelize[_0x4ee1('0x2')]},'exitAt':{'type':Sequelize[_0x4ee1('0x2')]},'reason':{'type':Sequelize[_0x4ee1('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 287c4a2..32cacd8 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 _0xa30a=['destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','apply','save','update','then','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','includeAll','find','body'];(function(_0x528fc9,_0x41fc66){var _0x241f68=function(_0x16e5ea){while(--_0x16e5ea){_0x528fc9['push'](_0x528fc9['shift']());}};_0x241f68(++_0x41fc66);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaa30('0x0'));var rimraf=require(_0xaa30('0x1'));var zipdir=require(_0xaa30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa30('0x3'));var moment=require(_0xaa30('0x4'));var BPromise=require(_0xaa30('0x5'));var Mustache=require(_0xaa30('0x6'));var util=require(_0xaa30('0x7'));var path=require(_0xaa30('0x8'));var sox=require(_0xaa30('0x9'));var csv=require('to-csv');var ejs=require(_0xaa30('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xf'));var querystring=require(_0xaa30('0x10'));var Papa=require(_0xaa30('0x11'));var Redis=require(_0xaa30('0x12'));var authService=require(_0xaa30('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x14'));var logger=require('../../config/logger')(_0xaa30('0x15'));var utils=require(_0xaa30('0x16'));var config=require(_0xaa30('0x17'));var licenseUtil=require(_0xaa30('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec992f,_0x3de2d1){_0x3de2d1=_0x3de2d1||0xcc;return function(_0xcd1d3b){if(_0xcd1d3b){return _0xec992f['sendStatus'](_0x3de2d1);}return _0xec992f[_0xaa30('0x19')](_0x3de2d1)[_0xaa30('0x1a')]();};}function respondWithResult(_0x25c02e,_0x14de74){_0x14de74=_0x14de74||0xc8;return function(_0x41f1d9){if(_0x41f1d9){return _0x25c02e[_0xaa30('0x19')](_0x14de74)[_0xaa30('0x1b')](_0x41f1d9);}};}function respondWithFilteredResult(_0x3b8095,_0x2e37af){return function(_0xfae724){if(_0xfae724){var _0x519518=typeof _0x2e37af[_0xaa30('0x1c')]==='undefined'&&typeof _0x2e37af['limit']===_0xaa30('0x1d');var _0x153939=_0xfae724[_0xaa30('0x1e')];var _0x540e36=_0x519518?0x0:_0x2e37af['offset'];var _0x53f9fd=_0x519518?_0xfae724[_0xaa30('0x1e')]:_0x2e37af['offset']+_0x2e37af[_0xaa30('0x1f')];var _0x332a0a;if(_0x53f9fd>=_0x153939){_0x53f9fd=_0x153939;_0x332a0a=0xc8;}else{_0x332a0a=0xce;}_0x3b8095['status'](_0x332a0a);return _0x3b8095['set']('Content-Range',_0x540e36+'-'+_0x53f9fd+'/'+_0x153939)[_0xaa30('0x1b')](_0xfae724);}return null;};}function patchUpdates(_0x3e4f1d){return function(_0x61b85){try{jsonpatch[_0xaa30('0x20')](_0x61b85,_0x3e4f1d,!![]);}catch(_0x43a526){return BPromise['reject'](_0x43a526);}return _0x61b85[_0xaa30('0x21')]();};}function saveUpdates(_0x24bb25,_0x2e16e7){return function(_0x2d9e35){if(_0x2d9e35){return _0x2d9e35[_0xaa30('0x22')](_0x24bb25)['then'](function(_0x325b42){return _0x325b42;});}return null;};}function removeEntity(_0x13128a,_0x2fecdd){return function(_0x326f84){if(_0x326f84){return _0x326f84['destroy']()[_0xaa30('0x23')](function(){_0x13128a[_0xaa30('0x19')](0xcc)[_0xaa30('0x1a')]();});}};}function handleEntityNotFound(_0x12da2f,_0x97b038){return function(_0x2a59ce){if(!_0x2a59ce){_0x12da2f['sendStatus'](0x194);}return _0x2a59ce;};}function handleError(_0x467850,_0x465701){_0x465701=_0x465701||0x1f4;return function(_0x5d4da8){logger[_0xaa30('0x24')](_0x5d4da8['stack']);if(_0x5d4da8[_0xaa30('0x25')]){delete _0x5d4da8[_0xaa30('0x25')];}_0x467850[_0xaa30('0x19')](_0x465701)[_0xaa30('0x26')](_0x5d4da8);};}exports[_0xaa30('0x27')]=function(_0xc10b8f,_0x6ff09a){var _0x39f708={},_0x1f288c={},_0x43fb30={'count':0x0,'rows':[]};var _0x44aa9b=_[_0xaa30('0x28')](db[_0xaa30('0x29')][_0xaa30('0x2a')],function(_0x40e4ee){return{'name':_0x40e4ee[_0xaa30('0x2b')],'type':_0x40e4ee[_0xaa30('0x2c')][_0xaa30('0x2d')]};});_0x1f288c['model']=_[_0xaa30('0x28')](_0x44aa9b,_0xaa30('0x25'));_0x1f288c[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0xc10b8f[_0xaa30('0x2e')]);_0x1f288c[_0xaa30('0x30')]=_['intersection'](_0x1f288c['model'],_0x1f288c['query']);_0x39f708[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x1f288c[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0xc10b8f[_0xaa30('0x2e')]['fields']));_0x39f708['attributes']=_0x39f708[_0xaa30('0x31')][_0xaa30('0x35')]?_0x39f708['attributes']:_0x1f288c[_0xaa30('0x33')];if(!_0xc10b8f['query'][_0xaa30('0x36')]('nolimit')){_0x39f708[_0xaa30('0x1f')]=qs[_0xaa30('0x1f')](_0xc10b8f['query'][_0xaa30('0x1f')]);_0x39f708[_0xaa30('0x1c')]=qs[_0xaa30('0x1c')](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x1c')]);}_0x39f708[_0xaa30('0x37')]=qs['sort'](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x38')]);_0x39f708['where']=qs[_0xaa30('0x30')](_[_0xaa30('0x39')](_0xc10b8f[_0xaa30('0x2e')],_0x1f288c['filters']),_0x44aa9b);if(_0xc10b8f['query'][_0xaa30('0x3a')]){_0x39f708[_0xaa30('0x3b')]=_[_0xaa30('0x3c')](_0x39f708[_0xaa30('0x3b')],{'$or':_[_0xaa30('0x28')](_0x44aa9b,function(_0x291854){if(_0x291854['type']!=='VIRTUAL'){var _0x120c43={};_0x120c43[_0x291854[_0xaa30('0x25')]]={'$like':'%'+_0xc10b8f[_0xaa30('0x2e')]['filter']+'%'};return _0x120c43;}})});}_0x39f708=_[_0xaa30('0x3c')]({},_0x39f708,_0xc10b8f[_0xaa30('0x3d')]);var _0x8fb95e={'where':_0x39f708[_0xaa30('0x3b')]};return db['MailQueueReport'][_0xaa30('0x1e')](_0x8fb95e)[_0xaa30('0x23')](function(_0x2c5ddb){_0x43fb30[_0xaa30('0x1e')]=_0x2c5ddb;if(_0xc10b8f[_0xaa30('0x2e')]['includeAll']){_0x39f708[_0xaa30('0x3e')]=[{'all':!![]}];}return db[_0xaa30('0x29')][_0xaa30('0x3f')](_0x39f708);})[_0xaa30('0x23')](function(_0x13f08f){_0x43fb30[_0xaa30('0x40')]=_0x13f08f;return _0x43fb30;})[_0xaa30('0x23')](respondWithFilteredResult(_0x6ff09a,_0x39f708))[_0xaa30('0x41')](handleError(_0x6ff09a,null));};exports['show']=function(_0x59ef25,_0x18771d){var _0x4a170a={'raw':!![],'where':{'id':_0x59ef25['params']['id']}},_0x5208f8={};_0x5208f8[_0xaa30('0x33')]=_['keys'](db[_0xaa30('0x29')]['rawAttributes']);_0x5208f8[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0x59ef25[_0xaa30('0x2e')]);_0x5208f8[_0xaa30('0x30')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],_0x5208f8[_0xaa30('0x2e')]);_0x4a170a[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0x59ef25['query'][_0xaa30('0x34')]));_0x4a170a[_0xaa30('0x31')]=_0x4a170a[_0xaa30('0x31')][_0xaa30('0x35')]?_0x4a170a[_0xaa30('0x31')]:_0x5208f8['model'];if(_0x59ef25['query'][_0xaa30('0x42')]){_0x4a170a['include']=[{'all':!![]}];}_0x4a170a=_[_0xaa30('0x3c')]({},_0x4a170a,_0x59ef25[_0xaa30('0x3d')]);return db[_0xaa30('0x29')][_0xaa30('0x43')](_0x4a170a)[_0xaa30('0x23')](handleEntityNotFound(_0x18771d,null))[_0xaa30('0x23')](respondWithResult(_0x18771d,null))[_0xaa30('0x41')](handleError(_0x18771d,null));};exports['create']=function(_0x3cf0bb,_0x6c9da6){return db[_0xaa30('0x29')]['create'](_0x3cf0bb[_0xaa30('0x44')],{})[_0xaa30('0x23')](respondWithResult(_0x6c9da6,0xc9))['catch'](handleError(_0x6c9da6,null));};exports[_0xaa30('0x22')]=function(_0x4a8fcc,_0x25d227){if(_0x4a8fcc['body']['id']){delete _0x4a8fcc['body']['id'];}return db[_0xaa30('0x29')]['find']({'where':{'id':_0x4a8fcc['params']['id']}})[_0xaa30('0x23')](handleEntityNotFound(_0x25d227,null))[_0xaa30('0x23')](saveUpdates(_0x4a8fcc[_0xaa30('0x44')],null))[_0xaa30('0x23')](respondWithResult(_0x25d227,null))[_0xaa30('0x41')](handleError(_0x25d227,null));};exports[_0xaa30('0x45')]=function(_0x5616cd,_0x17d75d){return db[_0xaa30('0x29')][_0xaa30('0x43')]({'where':{'id':_0x5616cd['params']['id']}})['then'](handleEntityNotFound(_0x17d75d,null))['then'](removeEntity(_0x17d75d,null))['catch'](handleError(_0x17d75d,null));};exports[_0xaa30('0x46')]=function(_0x1ba164,_0xdc32bc){return db[_0xaa30('0x29')][_0xaa30('0x46')]()[_0xaa30('0x23')](respondWithResult(_0xdc32bc,null))['catch'](handleError(_0xdc32bc,null));}; \ No newline at end of file +var _0x14a0=['mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x14a0,0x8e));var _0x014a=function(_0xeb9ff0,_0x26e7ea){_0xeb9ff0=_0xeb9ff0-0x0;var _0x6698f3=_0x14a0[_0xeb9ff0];return _0x6698f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];function respondWithStatusCode(_0x43bfeb,_0x1bcd1){_0x1bcd1=_0x1bcd1||0xcc;return function(_0x20cb56){if(_0x20cb56){return _0x43bfeb[_0x014a('0x14')](_0x1bcd1);}return _0x43bfeb[_0x014a('0x15')](_0x1bcd1)[_0x014a('0x16')]();};}function respondWithResult(_0x71535d,_0x45cd80){_0x45cd80=_0x45cd80||0xc8;return function(_0x3c54c8){if(_0x3c54c8){return _0x71535d['status'](_0x45cd80)[_0x014a('0x17')](_0x3c54c8);}};}function respondWithFilteredResult(_0x3cf92f,_0x59f207){return function(_0x3a836f){if(_0x3a836f){var _0x128c46=typeof _0x59f207['offset']===_0x014a('0x18')&&typeof _0x59f207[_0x014a('0x19')]===_0x014a('0x18');var _0x12da95=_0x3a836f[_0x014a('0x1a')];var _0x12d339=_0x128c46?0x0:_0x59f207[_0x014a('0x1b')];var _0x263b07=_0x128c46?_0x3a836f[_0x014a('0x1a')]:_0x59f207[_0x014a('0x1b')]+_0x59f207[_0x014a('0x19')];var _0x89e132;if(_0x263b07>=_0x12da95){_0x263b07=_0x12da95;_0x89e132=0xc8;}else{_0x89e132=0xce;}_0x3cf92f[_0x014a('0x15')](_0x89e132);return _0x3cf92f[_0x014a('0x1c')]('Content-Range',_0x12d339+'-'+_0x263b07+'/'+_0x12da95)[_0x014a('0x17')](_0x3a836f);}return null;};}function patchUpdates(_0x109a9c){return function(_0x11065f){try{jsonpatch[_0x014a('0x1d')](_0x11065f,_0x109a9c,!![]);}catch(_0xc9a563){return BPromise[_0x014a('0x1e')](_0xc9a563);}return _0x11065f[_0x014a('0x1f')]();};}function saveUpdates(_0x3dd2d0,_0x290b86){return function(_0x486e66){if(_0x486e66){return _0x486e66[_0x014a('0x20')](_0x3dd2d0)['then'](function(_0x1a1318){return _0x1a1318;});}return null;};}function removeEntity(_0x26718b,_0x44d921){return function(_0x36d52b){if(_0x36d52b){return _0x36d52b[_0x014a('0x21')]()[_0x014a('0x22')](function(){_0x26718b[_0x014a('0x15')](0xcc)[_0x014a('0x16')]();});}};}function handleEntityNotFound(_0x165a42,_0x4c2627){return function(_0x3b4b92){if(!_0x3b4b92){_0x165a42['sendStatus'](0x194);}return _0x3b4b92;};}function handleError(_0x39a432,_0x28701e){_0x28701e=_0x28701e||0x1f4;return function(_0x4f1c44){logger['error'](_0x4f1c44[_0x014a('0x23')]);if(_0x4f1c44[_0x014a('0x24')]){delete _0x4f1c44[_0x014a('0x24')];}_0x39a432['status'](_0x28701e)[_0x014a('0x25')](_0x4f1c44);};}exports[_0x014a('0x26')]=function(_0x598179,_0x31dc95){var _0x2560a6={},_0x496040={},_0x4f9c1c={'count':0x0,'rows':[]};var _0x397850=_[_0x014a('0x27')](db[_0x014a('0x28')][_0x014a('0x29')],function(_0x4ea00c){return{'name':_0x4ea00c[_0x014a('0x2a')],'type':_0x4ea00c[_0x014a('0x2b')][_0x014a('0x2c')]};});_0x496040[_0x014a('0x2d')]=_[_0x014a('0x27')](_0x397850,_0x014a('0x24'));_0x496040[_0x014a('0x2e')]=_[_0x014a('0x2f')](_0x598179[_0x014a('0x2e')]);_0x496040[_0x014a('0x30')]=_[_0x014a('0x31')](_0x496040['model'],_0x496040[_0x014a('0x2e')]);_0x2560a6[_0x014a('0x32')]=_[_0x014a('0x31')](_0x496040[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x598179[_0x014a('0x2e')][_0x014a('0x33')]));_0x2560a6['attributes']=_0x2560a6[_0x014a('0x32')][_0x014a('0x34')]?_0x2560a6['attributes']:_0x496040[_0x014a('0x2d')];if(!_0x598179[_0x014a('0x2e')][_0x014a('0x35')](_0x014a('0x36'))){_0x2560a6[_0x014a('0x19')]=qs[_0x014a('0x19')](_0x598179[_0x014a('0x2e')][_0x014a('0x19')]);_0x2560a6['offset']=qs[_0x014a('0x1b')](_0x598179[_0x014a('0x2e')][_0x014a('0x1b')]);}_0x2560a6[_0x014a('0x37')]=qs['sort'](_0x598179[_0x014a('0x2e')][_0x014a('0x38')]);_0x2560a6[_0x014a('0x39')]=qs[_0x014a('0x30')](_[_0x014a('0x3a')](_0x598179[_0x014a('0x2e')],_0x496040[_0x014a('0x30')]),_0x397850);if(_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]){_0x2560a6['where']=_[_0x014a('0x3c')](_0x2560a6['where'],{'$or':_[_0x014a('0x27')](_0x397850,function(_0xc11492){if(_0xc11492[_0x014a('0x2b')]!==_0x014a('0x3d')){var _0x43376c={};_0x43376c[_0xc11492['name']]={'$like':'%'+_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]+'%'};return _0x43376c;}})});}_0x2560a6=_['merge']({},_0x2560a6,_0x598179[_0x014a('0x3e')]);var _0x2990df={'where':_0x2560a6[_0x014a('0x39')]};return db[_0x014a('0x28')][_0x014a('0x1a')](_0x2990df)[_0x014a('0x22')](function(_0x17b1b6){_0x4f9c1c[_0x014a('0x1a')]=_0x17b1b6;if(_0x598179[_0x014a('0x2e')]['includeAll']){_0x2560a6[_0x014a('0x3f')]=[{'all':!![]}];}return db[_0x014a('0x28')][_0x014a('0x40')](_0x2560a6);})[_0x014a('0x22')](function(_0x5f1a91){_0x4f9c1c[_0x014a('0x41')]=_0x5f1a91;return _0x4f9c1c;})[_0x014a('0x22')](respondWithFilteredResult(_0x31dc95,_0x2560a6))[_0x014a('0x42')](handleError(_0x31dc95,null));};exports[_0x014a('0x43')]=function(_0x1dc647,_0x430a56){var _0x5f2969={'raw':!![],'where':{'id':_0x1dc647[_0x014a('0x44')]['id']}},_0x361866={};_0x361866['model']=_[_0x014a('0x2f')](db[_0x014a('0x28')][_0x014a('0x29')]);_0x361866['query']=_[_0x014a('0x2f')](_0x1dc647['query']);_0x361866['filters']=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],_0x361866['query']);_0x5f2969[_0x014a('0x32')]=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x1dc647[_0x014a('0x2e')][_0x014a('0x33')]));_0x5f2969['attributes']=_0x5f2969[_0x014a('0x32')][_0x014a('0x34')]?_0x5f2969[_0x014a('0x32')]:_0x361866['model'];if(_0x1dc647['query'][_0x014a('0x45')]){_0x5f2969['include']=[{'all':!![]}];}_0x5f2969=_['merge']({},_0x5f2969,_0x1dc647[_0x014a('0x3e')]);return db['MailQueueReport'][_0x014a('0x46')](_0x5f2969)[_0x014a('0x22')](handleEntityNotFound(_0x430a56,null))[_0x014a('0x22')](respondWithResult(_0x430a56,null))['catch'](handleError(_0x430a56,null));};exports[_0x014a('0x47')]=function(_0x23be18,_0x12cd9b){return db[_0x014a('0x28')][_0x014a('0x47')](_0x23be18[_0x014a('0x48')],{})['then'](respondWithResult(_0x12cd9b,0xc9))[_0x014a('0x42')](handleError(_0x12cd9b,null));};exports[_0x014a('0x20')]=function(_0x5a861c,_0x1a4df9){if(_0x5a861c[_0x014a('0x48')]['id']){delete _0x5a861c[_0x014a('0x48')]['id'];}return db[_0x014a('0x28')][_0x014a('0x46')]({'where':{'id':_0x5a861c[_0x014a('0x44')]['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x1a4df9,null))[_0x014a('0x22')](saveUpdates(_0x5a861c['body'],null))[_0x014a('0x22')](respondWithResult(_0x1a4df9,null))[_0x014a('0x42')](handleError(_0x1a4df9,null));};exports[_0x014a('0x21')]=function(_0x135e7e,_0x312c7a){return db['MailQueueReport'][_0x014a('0x46')]({'where':{'id':_0x135e7e['params']['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x312c7a,null))[_0x014a('0x22')](removeEntity(_0x312c7a,null))[_0x014a('0x42')](handleError(_0x312c7a,null));};exports[_0x014a('0x49')]=function(_0x3caa6e,_0x4f8547){return db['MailQueueReport']['describe']()['then'](respondWithResult(_0x4f8547,null))[_0x014a('0x42')](handleError(_0x4f8547,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index a93f2c5..faa7de1 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 _0x9eba=['define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./mailQueueReport.attributes','exports'];(function(_0x84a51e,_0x4fbde3){var _0x5d1da7=function(_0x14abe3){while(--_0x14abe3){_0x84a51e['push'](_0x84a51e['shift']());}};_0x5d1da7(++_0x4fbde3);}(_0x9eba,0x9e));var _0xa9eb=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9eba[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xa9eb('0x0'));var util=require(_0xa9eb('0x1'));var logger=require(_0xa9eb('0x2'))(_0xa9eb('0x3'));var moment=require(_0xa9eb('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9eb('0x5'));var fs=require('fs');var path=require(_0xa9eb('0x6'));var rimraf=require(_0xa9eb('0x7'));var config=require('../../config/environment');var attributes=require(_0xa9eb('0x8'));module[_0xa9eb('0x9')]=function(_0x14e3d8,_0x134f32){return _0x14e3d8[_0xa9eb('0xa')](_0xa9eb('0xb'),attributes,{'tableName':_0xa9eb('0xc'),'paranoid':![],'indexes':[{'name':_0xa9eb('0xd'),'fields':[_0xa9eb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x14ae=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports','report_mail_queue','uniqueid'];(function(_0x3af62a,_0x3e13dd){var _0x1601df=function(_0x5addcd){while(--_0x5addcd){_0x3af62a['push'](_0x3af62a['shift']());}};_0x1601df(++_0x3e13dd);}(_0x14ae,0x1b0));var _0xe14a=function(_0x4f2e13,_0x2f5278){_0x4f2e13=_0x4f2e13-0x0;var _0x428323=_0x14ae[_0x4f2e13];return _0x428323;};'use strict';var _=require(_0xe14a('0x0'));var util=require(_0xe14a('0x1'));var logger=require('../../config/logger')(_0xe14a('0x2'));var moment=require(_0xe14a('0x3'));var BPromise=require(_0xe14a('0x4'));var rp=require(_0xe14a('0x5'));var fs=require('fs');var path=require(_0xe14a('0x6'));var rimraf=require('rimraf');var config=require(_0xe14a('0x7'));var attributes=require(_0xe14a('0x8'));module[_0xe14a('0x9')]=function(_0x36bc27,_0x33521e){return _0x36bc27['define']('MailQueueReport',attributes,{'tableName':_0xe14a('0xa'),'paranoid':![],'indexes':[{'name':_0xe14a('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 6212b1a..3404b18 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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x3aeb9b,_0x3f3ff2){var _0x5e318f=function(_0x47e3e8){while(--_0x47e3e8){_0x3aeb9b['push'](_0x3aeb9b['shift']());}};_0x5e318f(++_0x3f3ff2);}(_0xdb28,0x106));var _0x8db2=function(_0x39fc91,_0x3cb65c){_0x39fc91=_0x39fc91-0x0;var _0x22db74=_0xdb28[_0x39fc91];return _0x22db74;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x145b18,_0x45ce03){var _0x4da09e=function(_0x3b991b){while(--_0x3b991b){_0x145b18['push'](_0x145b18['shift']());}};_0x4da09e(++_0x45ce03);}(_0x1261,0x144));var _0x1126=function(_0x397004,_0x7949f){_0x397004=_0x397004-0x0;var _0xa7a10=_0x1261[_0x397004];return _0xa7a10;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index cbdf03c..751a33e 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x146df8,_0x2a27e9){var _0x1c3052=function(_0x2160e8){while(--_0x2160e8){_0x146df8['push'](_0x146df8['shift']());}};_0x1c3052(++_0x2a27e9);}(_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(_0x417733,_0x1872c){var _0x43a2d3=function(_0x5f0fe0){while(--_0x5f0fe0){_0x417733['push'](_0x417733['shift']());}};_0x43a2d3(++_0x1872c);}(_0x70e0,0x17b));var _0x070e=function(_0x532344,_0x248346){_0x532344=_0x532344-0x0;var _0x18c31d=_0x70e0[_0x532344];return _0x18c31d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 662f89c..909c55f 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 _0xefe1=['STRING','BOOLEAN','INBOX','INTEGER','sequelize'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0xefe1,0x86));var _0x1efe=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xefe1[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x1efe('0x0'));module['exports']={'description':{'type':Sequelize[_0x1efe('0x1')]},'host':{'type':Sequelize[_0x1efe('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x1efe('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x1efe('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1efe('0x1')],'defaultValue':_0x1efe('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1efe('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x1efe('0x1')]},'modernAuthentication':{'type':Sequelize[_0x1efe('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xf68e=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x48669d,_0x210ab1){var _0x1e108f=function(_0x384d0f){while(--_0x384d0f){_0x48669d['push'](_0x48669d['shift']());}};_0x1e108f(++_0x210ab1);}(_0xf68e,0x13a));var _0xef68=function(_0x5062be,_0x1a7d0c){_0x5062be=_0x5062be-0x0;var _0x531168=_0xf68e[_0x5062be];return _0x531168;};'use strict';var Sequelize=require(_0xef68('0x0'));module[_0xef68('0x1')]={'description':{'type':Sequelize[_0xef68('0x2')]},'host':{'type':Sequelize[_0xef68('0x2')]},'authentication':{'type':Sequelize[_0xef68('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xef68('0x2')]},'password':{'type':Sequelize[_0xef68('0x2')]},'port':{'type':Sequelize[_0xef68('0x4')]},'tls':{'type':Sequelize[_0xef68('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xef68('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xef68('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index e45d164..d4c0c8a 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 _0x185d=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0x185d,0x194));var _0xd185=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x185d[_0x424501];return _0xb719af;};'use strict';var _=require(_0xd185('0x0'));var util=require(_0xd185('0x1'));var logger=require(_0xd185('0x2'))(_0xd185('0x3'));var moment=require(_0xd185('0x4'));var BPromise=require(_0xd185('0x5'));var rp=require(_0xd185('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd185('0x7'));var config=require(_0xd185('0x8'));var attributes=require(_0xd185('0x9'));module[_0xd185('0xa')]=function(_0x171ef8,_0x3dbe3c){return _0x171ef8[_0xd185('0xb')](_0xd185('0xc'),attributes,{'tableName':_0xd185('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd316=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2ec0cc,_0x21c744){var _0x3d662=function(_0x1fc2ae){while(--_0x1fc2ae){_0x2ec0cc['push'](_0x2ec0cc['shift']());}};_0x3d662(++_0x21c744);}(_0xd316,0x11e));var _0x6d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd316[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6d31('0x0'));var util=require(_0x6d31('0x1'));var logger=require(_0x6d31('0x2'))(_0x6d31('0x3'));var moment=require(_0x6d31('0x4'));var BPromise=require(_0x6d31('0x5'));var rp=require(_0x6d31('0x6'));var fs=require('fs');var path=require(_0x6d31('0x7'));var rimraf=require('rimraf');var config=require(_0x6d31('0x8'));var attributes=require(_0x6d31('0x9'));module[_0x6d31('0xa')]=function(_0x4bee5b,_0x2cc177){return _0x4bee5b[_0x6d31('0xb')](_0x6d31('0xc'),attributes,{'tableName':_0x6d31('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 9bc4919..70c3442 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 _0xa87e=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','MailServerIn,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','debug','util'];(function(_0x28a1aa,_0x5abbbf){var _0x37748f=function(_0x59ecfb){while(--_0x59ecfb){_0x28a1aa['push'](_0x28a1aa['shift']());}};_0x37748f(++_0x5abbbf);}(_0xa87e,0x173));var _0xea87=function(_0x2c468b,_0xe380bc){_0x2c468b=_0x2c468b-0x0;var _0x20a988=_0xa87e[_0x2c468b];return _0x20a988;};'use strict';var _=require('lodash');var util=require(_0xea87('0x0'));var moment=require(_0xea87('0x1'));var BPromise=require(_0xea87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea87('0x3'));var db=require(_0xea87('0x4'))['db'];var utils=require(_0xea87('0x5'));var logger=require(_0xea87('0x6'))(_0xea87('0x7'));var config=require('../../config/environment');var jayson=require(_0xea87('0x8'));var client=jayson[_0xea87('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3c3a,_0x1b566a,_0x36352b){return new BPromise(function(_0xd0dd3b,_0xa7d4f){return client['request'](_0x2f3c3a,_0x36352b)[_0xea87('0xa')](function(_0x1ea786){logger['info'](_0xea87('0xb'),_0x1b566a,_0xea87('0xc'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x1b566a,_0xea87('0xc'),JSON[_0xea87('0xd')](_0x1ea786));if(_0x1ea786[_0xea87('0xe')]){if(_0x1ea786[_0xea87('0xe')][_0xea87('0xf')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x1b566a,_0x1ea786[_0xea87('0xe')][_0xea87('0x10')]);return _0xa7d4f(_0x1ea786['error'][_0xea87('0x10')]);}logger[_0xea87('0xe')]('MailServerIn,\x20%s,\x20%s',_0x1b566a,_0x1ea786[_0xea87('0xe')][_0xea87('0x10')]);return _0xd0dd3b(_0x1ea786[_0xea87('0xe')][_0xea87('0x10')]);}else{logger[_0xea87('0x11')](_0xea87('0xb'),_0x1b566a,'request\x20sent');_0xd0dd3b(_0x1ea786[_0xea87('0x12')][_0xea87('0x10')]);}})['catch'](function(_0x22b62d){logger[_0xea87('0xe')](_0xea87('0xb'),_0x1b566a,_0x22b62d);_0xa7d4f(_0x22b62d);});});}exports[_0xea87('0x13')]=function(_0x8df0c){var _0x4f3939=this;return new Promise(function(_0x29621e,_0x2caf35){return db[_0xea87('0x14')][_0xea87('0x15')]({'raw':_0x8df0c[_0xea87('0x16')]?_0x8df0c['options'][_0xea87('0x17')]===undefined?!![]:![]:!![],'where':_0x8df0c[_0xea87('0x16')]?_0x8df0c[_0xea87('0x16')][_0xea87('0x18')]||null:null,'attributes':_0x8df0c[_0xea87('0x16')]?_0x8df0c[_0xea87('0x16')][_0xea87('0x19')]||null:null,'limit':_0x8df0c[_0xea87('0x16')]?_0x8df0c[_0xea87('0x16')][_0xea87('0x1a')]||null:null,'include':_0x8df0c[_0xea87('0x16')]?_0x8df0c[_0xea87('0x16')][_0xea87('0x1b')]?_[_0xea87('0x1c')](_0x8df0c[_0xea87('0x16')]['include'],function(_0x170929){return{'model':db[_0x170929[_0xea87('0x1d')]],'as':_0x170929['as'],'attributes':_0x170929[_0xea87('0x19')],'include':_0x170929[_0xea87('0x1b')]?_['map'](_0x170929[_0xea87('0x1b')],function(_0x96a3c4){return{'model':db[_0x96a3c4[_0xea87('0x1d')]],'as':_0x96a3c4['as'],'attributes':_0x96a3c4[_0xea87('0x19')],'include':_0x96a3c4['include']?_[_0xea87('0x1c')](_0x96a3c4['include'],function(_0xd183d0){return{'model':db[_0xd183d0['model']],'as':_0xd183d0['as'],'attributes':_0xd183d0[_0xea87('0x19')]};}):[]};}):[]};}):[]:[]})[_0xea87('0xa')](function(_0xec5a6d){logger['info'](_0xea87('0x13'),_0x8df0c);logger[_0xea87('0x1e')](_0xea87('0x13'),_0x8df0c,JSON['stringify'](_0xec5a6d));_0x29621e(_0xec5a6d);})['catch'](function(_0x2f72f0){logger['error'](_0xea87('0x13'),_0x2f72f0[_0xea87('0x10')],_0x8df0c);_0x2caf35(_0x4f3939[_0xea87('0xe')](0x1f4,_0x2f72f0['message']));});});}; \ No newline at end of file +var _0xd757=['then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMailServerIn','MailServerIn','findAll','raw','options','where','attributes','limit','include','map','model','stringify','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request'];(function(_0x28859b,_0x2fec11){var _0x31c7c5=function(_0x1aceb3){while(--_0x1aceb3){_0x28859b['push'](_0x28859b['shift']());}};_0x31c7c5(++_0x2fec11);}(_0xd757,0x1e5));var _0x7d75=function(_0x95b014,_0x1e6230){_0x95b014=_0x95b014-0x0;var _0x583d71=_0xd757[_0x95b014];return _0x583d71;};'use strict';var _=require(_0x7d75('0x0'));var util=require(_0x7d75('0x1'));var moment=require(_0x7d75('0x2'));var BPromise=require(_0x7d75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d75('0x4'))['db'];var utils=require(_0x7d75('0x5'));var logger=require('../../config/logger')(_0x7d75('0x6'));var config=require(_0x7d75('0x7'));var jayson=require(_0x7d75('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x108c0d,_0x3fde33,_0x1cf272){return new BPromise(function(_0x276fb0,_0x4030ee){return client[_0x7d75('0x9')](_0x108c0d,_0x1cf272)[_0x7d75('0xa')](function(_0x3720c7){logger[_0x7d75('0xb')](_0x7d75('0xc'),_0x3fde33,_0x7d75('0xd'));logger[_0x7d75('0xe')](_0x7d75('0xf'),_0x3fde33,'request\x20sent',JSON['stringify'](_0x3720c7));if(_0x3720c7[_0x7d75('0x10')]){if(_0x3720c7[_0x7d75('0x10')][_0x7d75('0x11')]===0x1f4){logger['error'](_0x7d75('0xc'),_0x3fde33,_0x3720c7[_0x7d75('0x10')]['message']);return _0x4030ee(_0x3720c7[_0x7d75('0x10')][_0x7d75('0x12')]);}logger[_0x7d75('0x10')](_0x7d75('0xc'),_0x3fde33,_0x3720c7[_0x7d75('0x10')][_0x7d75('0x12')]);return _0x276fb0(_0x3720c7['error'][_0x7d75('0x12')]);}else{logger[_0x7d75('0xb')](_0x7d75('0xc'),_0x3fde33,_0x7d75('0xd'));_0x276fb0(_0x3720c7[_0x7d75('0x13')][_0x7d75('0x12')]);}})['catch'](function(_0x15ba5f){logger['error'](_0x7d75('0xc'),_0x3fde33,_0x15ba5f);_0x4030ee(_0x15ba5f);});});}exports[_0x7d75('0x14')]=function(_0x40edfc){var _0x3bcb3e=this;return new Promise(function(_0x356b44,_0x12295a){return db[_0x7d75('0x15')][_0x7d75('0x16')]({'raw':_0x40edfc['options']?_0x40edfc['options'][_0x7d75('0x17')]===undefined?!![]:![]:!![],'where':_0x40edfc[_0x7d75('0x18')]?_0x40edfc[_0x7d75('0x18')][_0x7d75('0x19')]||null:null,'attributes':_0x40edfc['options']?_0x40edfc[_0x7d75('0x18')][_0x7d75('0x1a')]||null:null,'limit':_0x40edfc[_0x7d75('0x18')]?_0x40edfc[_0x7d75('0x18')][_0x7d75('0x1b')]||null:null,'include':_0x40edfc[_0x7d75('0x18')]?_0x40edfc[_0x7d75('0x18')][_0x7d75('0x1c')]?_[_0x7d75('0x1d')](_0x40edfc[_0x7d75('0x18')][_0x7d75('0x1c')],function(_0x21211b){return{'model':db[_0x21211b[_0x7d75('0x1e')]],'as':_0x21211b['as'],'attributes':_0x21211b[_0x7d75('0x1a')],'include':_0x21211b[_0x7d75('0x1c')]?_[_0x7d75('0x1d')](_0x21211b[_0x7d75('0x1c')],function(_0x3103d6){return{'model':db[_0x3103d6['model']],'as':_0x3103d6['as'],'attributes':_0x3103d6[_0x7d75('0x1a')],'include':_0x3103d6[_0x7d75('0x1c')]?_['map'](_0x3103d6[_0x7d75('0x1c')],function(_0x50d798){return{'model':db[_0x50d798[_0x7d75('0x1e')]],'as':_0x50d798['as'],'attributes':_0x50d798[_0x7d75('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7d75('0xa')](function(_0xe66bff){logger[_0x7d75('0xb')]('GetMailServerIn',_0x40edfc);logger[_0x7d75('0xe')](_0x7d75('0x14'),_0x40edfc,JSON[_0x7d75('0x1f')](_0xe66bff));_0x356b44(_0xe66bff);})[_0x7d75('0x20')](function(_0x1121a6){logger[_0x7d75('0x10')]('GetMailServerIn',_0x1121a6[_0x7d75('0x12')],_0x40edfc);_0x12295a(_0x3bcb3e[_0x7d75('0x10')](0x1f4,_0x1121a6[_0x7d75('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index f32303b..51f8652 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x7a54,0x106));var _0x47a5=function(_0x26a8b4,_0x285cc0){_0x26a8b4=_0x26a8b4-0x0;var _0x546559=_0x7a54[_0x26a8b4];return _0x546559;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 6f211a5..001cf57 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 _0xb9a7=['BOOLEAN','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9a7,0x112));var _0x7b9a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xb9a7[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x7b9a('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x7b9a('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x7b9a('0x1')]},'authentication':{'type':Sequelize[_0x7b9a('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x7b9a('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4483=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x2334d1,_0x2518f5){var _0x475585=function(_0x59aabb){while(--_0x59aabb){_0x2334d1['push'](_0x2334d1['shift']());}};_0x475585(++_0x2518f5);}(_0x4483,0x1a3));var _0x3448=function(_0x2d80aa,_0x319df7){_0x2d80aa=_0x2d80aa-0x0;var _0x24bf00=_0x4483[_0x2d80aa];return _0x24bf00;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'description':{'type':Sequelize[_0x3448('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x3448('0x2')]},'pass':{'type':Sequelize[_0x3448('0x2')]},'port':{'type':Sequelize[_0x3448('0x3')]},'secure':{'type':Sequelize[_0x3448('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x3448('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3448('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index e7ddacd..fa5c50c 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 _0xb349=['end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','then','rows','show','params','keys','includeAll','find','create','catch','body','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','status'];(function(_0x20bedd,_0x39694b){var _0x3041f3=function(_0x1f53ee){while(--_0x1f53ee){_0x20bedd['push'](_0x20bedd['shift']());}};_0x3041f3(++_0x39694b);}(_0xb349,0x7b));var _0x9b34=function(_0x1140cb,_0x59a2f3){_0x1140cb=_0x1140cb-0x0;var _0x4f42ba=_0xb349[_0x1140cb];return _0x4f42ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b34('0x0'));var zipdir=require(_0x9b34('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b34('0x2'));var moment=require(_0x9b34('0x3'));var BPromise=require(_0x9b34('0x4'));var Mustache=require('mustache');var util=require(_0x9b34('0x5'));var path=require(_0x9b34('0x6'));var sox=require(_0x9b34('0x7'));var csv=require(_0x9b34('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9b34('0x9'));var _=require(_0x9b34('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9b34('0xb'));var deskjs=require(_0x9b34('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9b34('0xd'));var Papa=require('papaparse');var Redis=require(_0x9b34('0xe'));var authService=require(_0x9b34('0xf'));var qs=require(_0x9b34('0x10'));var as=require(_0x9b34('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b34('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x9b34('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7ee759,_0x520f68){_0x520f68=_0x520f68||0xcc;return function(_0x166aab){if(_0x166aab){return _0x7ee759['sendStatus'](_0x520f68);}return _0x7ee759[_0x9b34('0x14')](_0x520f68)[_0x9b34('0x15')]();};}function respondWithResult(_0x5a5b42,_0x84e7e8){_0x84e7e8=_0x84e7e8||0xc8;return function(_0x15384c){if(_0x15384c){return _0x5a5b42['status'](_0x84e7e8)[_0x9b34('0x16')](_0x15384c);}};}function respondWithFilteredResult(_0x1a5e6c,_0x221b80){return function(_0x81693d){if(_0x81693d){var _0x33d17b=typeof _0x221b80['offset']===_0x9b34('0x17')&&typeof _0x221b80[_0x9b34('0x18')]===_0x9b34('0x17');var _0x5f3400=_0x81693d['count'];var _0x2c33b3=_0x33d17b?0x0:_0x221b80['offset'];var _0x34609b=_0x33d17b?_0x81693d[_0x9b34('0x19')]:_0x221b80[_0x9b34('0x1a')]+_0x221b80['limit'];var _0x4a18db;if(_0x34609b>=_0x5f3400){_0x34609b=_0x5f3400;_0x4a18db=0xc8;}else{_0x4a18db=0xce;}_0x1a5e6c['status'](_0x4a18db);return _0x1a5e6c[_0x9b34('0x1b')](_0x9b34('0x1c'),_0x2c33b3+'-'+_0x34609b+'/'+_0x5f3400)['json'](_0x81693d);}return null;};}function patchUpdates(_0x3bd4a2){return function(_0x12ccec){try{jsonpatch[_0x9b34('0x1d')](_0x12ccec,_0x3bd4a2,!![]);}catch(_0x45c081){return BPromise[_0x9b34('0x1e')](_0x45c081);}return _0x12ccec[_0x9b34('0x1f')]();};}function saveUpdates(_0x3e2845,_0x50e22c){return function(_0xf1f67b){if(_0xf1f67b){return _0xf1f67b[_0x9b34('0x20')](_0x3e2845)['then'](function(_0x357e10){return _0x357e10;});}return null;};}function removeEntity(_0x491965,_0x35a804){return function(_0x2afc36){if(_0x2afc36){return _0x2afc36[_0x9b34('0x21')]()['then'](function(){_0x491965[_0x9b34('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31a12e,_0x20fda4){return function(_0x29b16c){if(!_0x29b16c){_0x31a12e[_0x9b34('0x22')](0x194);}return _0x29b16c;};}function handleError(_0x357005,_0xeee474){_0xeee474=_0xeee474||0x1f4;return function(_0x3fc166){logger[_0x9b34('0x23')](_0x3fc166[_0x9b34('0x24')]);if(_0x3fc166[_0x9b34('0x25')]){delete _0x3fc166[_0x9b34('0x25')];}_0x357005[_0x9b34('0x14')](_0xeee474)[_0x9b34('0x26')](_0x3fc166);};}exports[_0x9b34('0x27')]=function(_0x23e2ff,_0x4ff9b2){var _0x3f658e={},_0x4a2337={},_0x519c6a={'count':0x0,'rows':[]};var _0x421049=_['map'](db[_0x9b34('0x28')][_0x9b34('0x29')],function(_0x546a8d){return{'name':_0x546a8d[_0x9b34('0x2a')],'type':_0x546a8d[_0x9b34('0x2b')][_0x9b34('0x2c')]};});_0x4a2337[_0x9b34('0x2d')]=_['map'](_0x421049,_0x9b34('0x25'));_0x4a2337['query']=_['keys'](_0x23e2ff[_0x9b34('0x2e')]);_0x4a2337[_0x9b34('0x2f')]=_[_0x9b34('0x30')](_0x4a2337[_0x9b34('0x2d')],_0x4a2337[_0x9b34('0x2e')]);_0x3f658e['attributes']=_[_0x9b34('0x30')](_0x4a2337['model'],qs[_0x9b34('0x31')](_0x23e2ff['query'][_0x9b34('0x31')]));_0x3f658e[_0x9b34('0x32')]=_0x3f658e['attributes'][_0x9b34('0x33')]?_0x3f658e[_0x9b34('0x32')]:_0x4a2337[_0x9b34('0x2d')];if(!_0x23e2ff[_0x9b34('0x2e')][_0x9b34('0x34')](_0x9b34('0x35'))){_0x3f658e[_0x9b34('0x18')]=qs[_0x9b34('0x18')](_0x23e2ff[_0x9b34('0x2e')][_0x9b34('0x18')]);_0x3f658e[_0x9b34('0x1a')]=qs[_0x9b34('0x1a')](_0x23e2ff[_0x9b34('0x2e')][_0x9b34('0x1a')]);}_0x3f658e[_0x9b34('0x36')]=qs[_0x9b34('0x37')](_0x23e2ff[_0x9b34('0x2e')][_0x9b34('0x37')]);_0x3f658e[_0x9b34('0x38')]=qs[_0x9b34('0x2f')](_['pick'](_0x23e2ff[_0x9b34('0x2e')],_0x4a2337['filters']),_0x421049);if(_0x23e2ff[_0x9b34('0x2e')][_0x9b34('0x39')]){_0x3f658e['where']=_[_0x9b34('0x3a')](_0x3f658e[_0x9b34('0x38')],{'$or':_[_0x9b34('0x3b')](_0x421049,function(_0x3d4ffc){if(_0x3d4ffc['type']!==_0x9b34('0x3c')){var _0x1dcd84={};_0x1dcd84[_0x3d4ffc[_0x9b34('0x25')]]={'$like':'%'+_0x23e2ff[_0x9b34('0x2e')]['filter']+'%'};return _0x1dcd84;}})});}_0x3f658e=_[_0x9b34('0x3a')]({},_0x3f658e,_0x23e2ff[_0x9b34('0x3d')]);var _0x153c12={'where':_0x3f658e[_0x9b34('0x38')]};return db[_0x9b34('0x28')][_0x9b34('0x19')](_0x153c12)[_0x9b34('0x3e')](function(_0x58db0e){_0x519c6a['count']=_0x58db0e;if(_0x23e2ff['query']['includeAll']){_0x3f658e['include']=[{'all':!![]}];}return db[_0x9b34('0x28')]['findAll'](_0x3f658e);})[_0x9b34('0x3e')](function(_0x164025){_0x519c6a[_0x9b34('0x3f')]=_0x164025;return _0x519c6a;})[_0x9b34('0x3e')](respondWithFilteredResult(_0x4ff9b2,_0x3f658e))['catch'](handleError(_0x4ff9b2,null));};exports[_0x9b34('0x40')]=function(_0x47cabc,_0x3d3d3f){var _0xba5e45={'raw':!![],'where':{'id':_0x47cabc[_0x9b34('0x41')]['id']}},_0x51ec01={};_0x51ec01[_0x9b34('0x2d')]=_[_0x9b34('0x42')](db[_0x9b34('0x28')][_0x9b34('0x29')]);_0x51ec01[_0x9b34('0x2e')]=_[_0x9b34('0x42')](_0x47cabc[_0x9b34('0x2e')]);_0x51ec01['filters']=_['intersection'](_0x51ec01['model'],_0x51ec01[_0x9b34('0x2e')]);_0xba5e45['attributes']=_[_0x9b34('0x30')](_0x51ec01['model'],qs[_0x9b34('0x31')](_0x47cabc[_0x9b34('0x2e')][_0x9b34('0x31')]));_0xba5e45['attributes']=_0xba5e45[_0x9b34('0x32')][_0x9b34('0x33')]?_0xba5e45[_0x9b34('0x32')]:_0x51ec01['model'];if(_0x47cabc[_0x9b34('0x2e')][_0x9b34('0x43')]){_0xba5e45['include']=[{'all':!![]}];}_0xba5e45=_[_0x9b34('0x3a')]({},_0xba5e45,_0x47cabc['options']);return db[_0x9b34('0x28')][_0x9b34('0x44')](_0xba5e45)[_0x9b34('0x3e')](handleEntityNotFound(_0x3d3d3f,null))[_0x9b34('0x3e')](respondWithResult(_0x3d3d3f,null))['catch'](handleError(_0x3d3d3f,null));};exports['create']=function(_0x4407d1,_0x19b406){return db[_0x9b34('0x28')][_0x9b34('0x45')](_0x4407d1['body'],{})[_0x9b34('0x3e')](respondWithResult(_0x19b406,0xc9))[_0x9b34('0x46')](handleError(_0x19b406,null));};exports[_0x9b34('0x20')]=function(_0x46ac68,_0x4128d6){if(_0x46ac68[_0x9b34('0x47')]['id']){delete _0x46ac68[_0x9b34('0x47')]['id'];}return db['MailServerOut'][_0x9b34('0x44')]({'where':{'id':_0x46ac68[_0x9b34('0x41')]['id']}})[_0x9b34('0x3e')](handleEntityNotFound(_0x4128d6,null))[_0x9b34('0x3e')](saveUpdates(_0x46ac68[_0x9b34('0x47')],null))[_0x9b34('0x3e')](respondWithResult(_0x4128d6,null))[_0x9b34('0x46')](handleError(_0x4128d6,null));};exports[_0x9b34('0x21')]=function(_0x3b2d01,_0x3414c7){return db[_0x9b34('0x28')][_0x9b34('0x44')]({'where':{'id':_0x3b2d01[_0x9b34('0x41')]['id']}})[_0x9b34('0x3e')](handleEntityNotFound(_0x3414c7,null))[_0x9b34('0x3e')](removeEntity(_0x3414c7,null))[_0x9b34('0x46')](handleError(_0x3414c7,null));}; \ No newline at end of file +var _0xd368=['show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xd368,0x139));var _0x8d36=function(_0x47db7e,_0x1b0869){_0x47db7e=_0x47db7e-0x0;var _0x4325c3=_0xd368[_0x47db7e];return _0x4325c3;};'use strict';var emlformat=require(_0x8d36('0x0'));var rimraf=require(_0x8d36('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8d36('0x2'));var rp=require(_0x8d36('0x3'));var moment=require(_0x8d36('0x4'));var BPromise=require(_0x8d36('0x5'));var Mustache=require(_0x8d36('0x6'));var util=require(_0x8d36('0x7'));var path=require('path');var sox=require(_0x8d36('0x8'));var csv=require('to-csv');var ejs=require(_0x8d36('0x9'));var fs=require('fs');var fs_extra=require(_0x8d36('0xa'));var _=require('lodash');var squel=require(_0x8d36('0xb'));var crypto=require(_0x8d36('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8d36('0xd'));var toCsv=require(_0x8d36('0xe'));var querystring=require('querystring');var Papa=require(_0x8d36('0xf'));var Redis=require(_0x8d36('0x10'));var authService=require(_0x8d36('0x11'));var qs=require(_0x8d36('0x12'));var as=require(_0x8d36('0x13'));var hardwareService=require(_0x8d36('0x14'));var logger=require(_0x8d36('0x15'))(_0x8d36('0x16'));var utils=require(_0x8d36('0x17'));var config=require(_0x8d36('0x18'));var licenseUtil=require(_0x8d36('0x19'));var db=require(_0x8d36('0x1a'))['db'];function respondWithStatusCode(_0x10edfe,_0x2c02ed){_0x2c02ed=_0x2c02ed||0xcc;return function(_0x4b73cb){if(_0x4b73cb){return _0x10edfe['sendStatus'](_0x2c02ed);}return _0x10edfe[_0x8d36('0x1b')](_0x2c02ed)[_0x8d36('0x1c')]();};}function respondWithResult(_0x1b72b0,_0x166204){_0x166204=_0x166204||0xc8;return function(_0x177881){if(_0x177881){return _0x1b72b0[_0x8d36('0x1b')](_0x166204)[_0x8d36('0x1d')](_0x177881);}};}function respondWithFilteredResult(_0x417653,_0x4aa1f7){return function(_0x1bde32){if(_0x1bde32){var _0x1a0b55=typeof _0x4aa1f7[_0x8d36('0x1e')]===_0x8d36('0x1f')&&typeof _0x4aa1f7[_0x8d36('0x20')]===_0x8d36('0x1f');var _0x580cef=_0x1bde32[_0x8d36('0x21')];var _0x376656=_0x1a0b55?0x0:_0x4aa1f7[_0x8d36('0x1e')];var _0x4ba55f=_0x1a0b55?_0x1bde32[_0x8d36('0x21')]:_0x4aa1f7[_0x8d36('0x1e')]+_0x4aa1f7['limit'];var _0x2c9df5;if(_0x4ba55f>=_0x580cef){_0x4ba55f=_0x580cef;_0x2c9df5=0xc8;}else{_0x2c9df5=0xce;}_0x417653[_0x8d36('0x1b')](_0x2c9df5);return _0x417653[_0x8d36('0x22')](_0x8d36('0x23'),_0x376656+'-'+_0x4ba55f+'/'+_0x580cef)[_0x8d36('0x1d')](_0x1bde32);}return null;};}function patchUpdates(_0x25b0bb){return function(_0x5ab188){try{jsonpatch[_0x8d36('0x24')](_0x5ab188,_0x25b0bb,!![]);}catch(_0x1d87a4){return BPromise[_0x8d36('0x25')](_0x1d87a4);}return _0x5ab188[_0x8d36('0x26')]();};}function saveUpdates(_0xb5410b,_0x4c7e33){return function(_0x31ff07){if(_0x31ff07){return _0x31ff07[_0x8d36('0x27')](_0xb5410b)[_0x8d36('0x28')](function(_0x24d5f4){return _0x24d5f4;});}return null;};}function removeEntity(_0x42ecf7,_0x53729a){return function(_0x557c0e){if(_0x557c0e){return _0x557c0e[_0x8d36('0x29')]()[_0x8d36('0x28')](function(){_0x42ecf7[_0x8d36('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e2987,_0x566385){return function(_0x593f5d){if(!_0x593f5d){_0x4e2987['sendStatus'](0x194);}return _0x593f5d;};}function handleError(_0x453a5f,_0x1b3348){_0x1b3348=_0x1b3348||0x1f4;return function(_0x5220f6){logger[_0x8d36('0x2a')](_0x5220f6[_0x8d36('0x2b')]);if(_0x5220f6[_0x8d36('0x2c')]){delete _0x5220f6[_0x8d36('0x2c')];}_0x453a5f[_0x8d36('0x1b')](_0x1b3348)[_0x8d36('0x2d')](_0x5220f6);};}exports[_0x8d36('0x2e')]=function(_0x148394,_0x16a545){var _0x1625c2={},_0xf91ef7={},_0x449de6={'count':0x0,'rows':[]};var _0x164ba3=_[_0x8d36('0x2f')](db[_0x8d36('0x30')][_0x8d36('0x31')],function(_0x2194ae){return{'name':_0x2194ae['fieldName'],'type':_0x2194ae[_0x8d36('0x32')]['key']};});_0xf91ef7[_0x8d36('0x33')]=_['map'](_0x164ba3,_0x8d36('0x2c'));_0xf91ef7[_0x8d36('0x34')]=_[_0x8d36('0x35')](_0x148394[_0x8d36('0x34')]);_0xf91ef7[_0x8d36('0x36')]=_[_0x8d36('0x37')](_0xf91ef7['model'],_0xf91ef7['query']);_0x1625c2[_0x8d36('0x38')]=_['intersection'](_0xf91ef7[_0x8d36('0x33')],qs[_0x8d36('0x39')](_0x148394['query'][_0x8d36('0x39')]));_0x1625c2[_0x8d36('0x38')]=_0x1625c2[_0x8d36('0x38')][_0x8d36('0x3a')]?_0x1625c2[_0x8d36('0x38')]:_0xf91ef7['model'];if(!_0x148394[_0x8d36('0x34')][_0x8d36('0x3b')](_0x8d36('0x3c'))){_0x1625c2[_0x8d36('0x20')]=qs[_0x8d36('0x20')](_0x148394[_0x8d36('0x34')][_0x8d36('0x20')]);_0x1625c2[_0x8d36('0x1e')]=qs[_0x8d36('0x1e')](_0x148394[_0x8d36('0x34')][_0x8d36('0x1e')]);}_0x1625c2[_0x8d36('0x3d')]=qs[_0x8d36('0x3e')](_0x148394['query'][_0x8d36('0x3e')]);_0x1625c2[_0x8d36('0x3f')]=qs['filters'](_['pick'](_0x148394[_0x8d36('0x34')],_0xf91ef7[_0x8d36('0x36')]),_0x164ba3);if(_0x148394[_0x8d36('0x34')][_0x8d36('0x40')]){_0x1625c2['where']=_[_0x8d36('0x41')](_0x1625c2[_0x8d36('0x3f')],{'$or':_[_0x8d36('0x2f')](_0x164ba3,function(_0x5201d5){if(_0x5201d5[_0x8d36('0x32')]!==_0x8d36('0x42')){var _0x246242={};_0x246242[_0x5201d5[_0x8d36('0x2c')]]={'$like':'%'+_0x148394['query']['filter']+'%'};return _0x246242;}})});}_0x1625c2=_[_0x8d36('0x41')]({},_0x1625c2,_0x148394[_0x8d36('0x43')]);var _0x227b61={'where':_0x1625c2['where']};return db[_0x8d36('0x30')][_0x8d36('0x21')](_0x227b61)[_0x8d36('0x28')](function(_0x4f3a2b){_0x449de6[_0x8d36('0x21')]=_0x4f3a2b;if(_0x148394[_0x8d36('0x34')][_0x8d36('0x44')]){_0x1625c2[_0x8d36('0x45')]=[{'all':!![]}];}return db[_0x8d36('0x30')]['findAll'](_0x1625c2);})['then'](function(_0x3615e0){_0x449de6[_0x8d36('0x46')]=_0x3615e0;return _0x449de6;})['then'](respondWithFilteredResult(_0x16a545,_0x1625c2))[_0x8d36('0x47')](handleError(_0x16a545,null));};exports[_0x8d36('0x48')]=function(_0x321796,_0x522f09){var _0x3ed208={'raw':!![],'where':{'id':_0x321796[_0x8d36('0x49')]['id']}},_0x509cf0={};_0x509cf0[_0x8d36('0x33')]=_[_0x8d36('0x35')](db[_0x8d36('0x30')][_0x8d36('0x31')]);_0x509cf0[_0x8d36('0x34')]=_[_0x8d36('0x35')](_0x321796[_0x8d36('0x34')]);_0x509cf0[_0x8d36('0x36')]=_['intersection'](_0x509cf0[_0x8d36('0x33')],_0x509cf0[_0x8d36('0x34')]);_0x3ed208[_0x8d36('0x38')]=_[_0x8d36('0x37')](_0x509cf0[_0x8d36('0x33')],qs[_0x8d36('0x39')](_0x321796[_0x8d36('0x34')][_0x8d36('0x39')]));_0x3ed208[_0x8d36('0x38')]=_0x3ed208[_0x8d36('0x38')]['length']?_0x3ed208['attributes']:_0x509cf0[_0x8d36('0x33')];if(_0x321796['query'][_0x8d36('0x44')]){_0x3ed208[_0x8d36('0x45')]=[{'all':!![]}];}_0x3ed208=_['merge']({},_0x3ed208,_0x321796[_0x8d36('0x43')]);return db['MailServerOut'][_0x8d36('0x4a')](_0x3ed208)[_0x8d36('0x28')](handleEntityNotFound(_0x522f09,null))['then'](respondWithResult(_0x522f09,null))[_0x8d36('0x47')](handleError(_0x522f09,null));};exports[_0x8d36('0x4b')]=function(_0x220c3d,_0x3a5d2b){return db[_0x8d36('0x30')]['create'](_0x220c3d['body'],{})[_0x8d36('0x28')](respondWithResult(_0x3a5d2b,0xc9))[_0x8d36('0x47')](handleError(_0x3a5d2b,null));};exports[_0x8d36('0x27')]=function(_0x266b17,_0x371f2f){if(_0x266b17[_0x8d36('0x4c')]['id']){delete _0x266b17[_0x8d36('0x4c')]['id'];}return db[_0x8d36('0x30')][_0x8d36('0x4a')]({'where':{'id':_0x266b17[_0x8d36('0x49')]['id']}})[_0x8d36('0x28')](handleEntityNotFound(_0x371f2f,null))[_0x8d36('0x28')](saveUpdates(_0x266b17[_0x8d36('0x4c')],null))[_0x8d36('0x28')](respondWithResult(_0x371f2f,null))[_0x8d36('0x47')](handleError(_0x371f2f,null));};exports['destroy']=function(_0x50757a,_0x6969ed){return db['MailServerOut'][_0x8d36('0x4a')]({'where':{'id':_0x50757a[_0x8d36('0x49')]['id']}})['then'](handleEntityNotFound(_0x6969ed,null))[_0x8d36('0x28')](removeEntity(_0x6969ed,null))[_0x8d36('0x47')](handleError(_0x6969ed,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index be3dd8b..894db0d 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 _0xa16f=['mail_servers_out','lodash','util','api','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xa16f,0xd9));var _0xfa16=function(_0x5a4ecf,_0x4f5633){_0x5a4ecf=_0x5a4ecf-0x0;var _0x59d216=_0xa16f[_0x5a4ecf];return _0x59d216;};'use strict';var _=require(_0xfa16('0x0'));var util=require(_0xfa16('0x1'));var logger=require('../../config/logger')(_0xfa16('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfa16('0x3'));var fs=require('fs');var path=require(_0xfa16('0x4'));var rimraf=require(_0xfa16('0x5'));var config=require(_0xfa16('0x6'));var attributes=require(_0xfa16('0x7'));module[_0xfa16('0x8')]=function(_0x44a937,_0x26e032){return _0x44a937[_0xfa16('0x9')](_0xfa16('0xa'),attributes,{'tableName':_0xfa16('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe155=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','mail_servers_out','util'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0xe155,0x17f));var _0x5e15=function(_0x3b621d,_0x7b4adf){_0x3b621d=_0x3b621d-0x0;var _0x38ddc1=_0xe155[_0x3b621d];return _0x38ddc1;};'use strict';var _=require('lodash');var util=require(_0x5e15('0x0'));var logger=require(_0x5e15('0x1'))('api');var moment=require(_0x5e15('0x2'));var BPromise=require(_0x5e15('0x3'));var rp=require(_0x5e15('0x4'));var fs=require('fs');var path=require(_0x5e15('0x5'));var rimraf=require(_0x5e15('0x6'));var config=require(_0x5e15('0x7'));var attributes=require(_0x5e15('0x8'));module[_0x5e15('0x9')]=function(_0x1c369a,_0x18f62c){return _0x1c369a[_0x5e15('0xa')]('MailServerOut',attributes,{'tableName':_0x5e15('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index c48a64f..9f6ea33 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x579d6b,_0x5806b5){var _0x474bb8=function(_0x5f5436){while(--_0x5f5436){_0x579d6b['push'](_0x579d6b['shift']());}};_0x474bb8(++_0x5806b5);}(_0x5f2f,0x73));var _0xf5f2=function(_0xa59eb9,_0x39e45e){_0xa59eb9=_0xa59eb9-0x0;var _0x2146fd=_0x5f2f[_0xa59eb9];return _0x2146fd;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x52ff55,_0x53ea52){var _0x1ac434=function(_0x434dfa){while(--_0x434dfa){_0x52ff55['push'](_0x52ff55['shift']());}};_0x1ac434(++_0x53ea52);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 30e6a49..a62ec04 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 _0xe508=['/:id','post','create','put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5a18e5,_0x44df84){var _0xfb9328=function(_0x3ee4ee){while(--_0x3ee4ee){_0x5a18e5['push'](_0x5a18e5['shift']());}};_0xfb9328(++_0x44df84);}(_0xe508,0x1ea));var _0x8e50=function(_0x218846,_0x2d0f07){_0x218846=_0x218846-0x0;var _0x25fa07=_0xe508[_0x218846];return _0x25fa07;};'use strict';var multer=require(_0x8e50('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8e50('0x1'));var express=require(_0x8e50('0x2'));var router=express[_0x8e50('0x3')]();var fs_extra=require(_0x8e50('0x4'));var auth=require(_0x8e50('0x5'));var interaction=require(_0x8e50('0x6'));var config=require(_0x8e50('0x7'));var controller=require(_0x8e50('0x8'));router[_0x8e50('0x9')]('/',auth[_0x8e50('0xa')](),controller[_0x8e50('0xb')]);router[_0x8e50('0x9')](_0x8e50('0xc'),auth['isAuthenticated'](),controller[_0x8e50('0xd')]);router[_0x8e50('0x9')](_0x8e50('0xe'),auth[_0x8e50('0xa')](),controller['show']);router[_0x8e50('0xf')]('/',auth[_0x8e50('0xa')](),controller[_0x8e50('0x10')]);router[_0x8e50('0x11')](_0x8e50('0xe'),auth[_0x8e50('0xa')](),controller[_0x8e50('0x12')]);router[_0x8e50('0x13')](_0x8e50('0xe'),auth[_0x8e50('0xa')](),controller[_0x8e50('0x14')]);module['exports']=router; \ No newline at end of file +var _0xec67=['isAuthenticated','show','post','create','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./mailSubstatus.controller','get'];(function(_0x4e215b,_0x597fbc){var _0x56d77a=function(_0x349d7d){while(--_0x349d7d){_0x4e215b['push'](_0x4e215b['shift']());}};_0x56d77a(++_0x597fbc);}(_0xec67,0x13a));var _0x7ec6=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xec67[_0x58547b];return _0x1d3fd2;};'use strict';var multer=require(_0x7ec6('0x0'));var util=require(_0x7ec6('0x1'));var path=require(_0x7ec6('0x2'));var timeout=require(_0x7ec6('0x3'));var express=require('express');var router=express[_0x7ec6('0x4')]();var fs_extra=require(_0x7ec6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7ec6('0x6'));var config=require('../../config/environment');var controller=require(_0x7ec6('0x7'));router[_0x7ec6('0x8')]('/',auth[_0x7ec6('0x9')](),controller['index']);router[_0x7ec6('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7ec6('0xa')]);router[_0x7ec6('0xb')]('/',auth[_0x7ec6('0x9')](),controller[_0x7ec6('0xc')]);router['put'](_0x7ec6('0xd'),auth[_0x7ec6('0x9')](),controller[_0x7ec6('0xe')]);router[_0x7ec6('0xf')](_0x7ec6('0xd'),auth[_0x7ec6('0x9')](),controller['destroy']);module[_0x7ec6('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 4f34e89..2d7091b 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 _0xbeea=['sequelize','STRING','name'];(function(_0x2858de,_0x2f42e4){var _0x174534=function(_0x3ac655){while(--_0x3ac655){_0x2858de['push'](_0x2858de['shift']());}};_0x174534(++_0x2f42e4);}(_0xbeea,0xb1));var _0xabee=function(_0x8cba84,_0x50ffdb){_0x8cba84=_0x8cba84-0x0;var _0x4ca689=_0xbeea[_0x8cba84];return _0x4ca689;};'use strict';var Sequelize=require(_0xabee('0x0'));module['exports']={'name':{'type':Sequelize[_0xabee('0x1')],'unique':_0xabee('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xabee('0x1')]}}; \ No newline at end of file +var _0xffd6=['STRING','sequelize','exports'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xffd6,0x97));var _0x6ffd=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0xffd6[_0x1d6a82];return _0x5834ac;};'use strict';var Sequelize=require(_0x6ffd('0x0'));module[_0x6ffd('0x1')]={'name':{'type':Sequelize[_0x6ffd('0x2')],'unique':'name','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 3853abc..82f1736 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 _0x12c9=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','MailSubstatus','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','save','then','destroy','error','stack','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x12c9,0x1c9));var _0x912c=function(_0xdce07d,_0x230e49){_0xdce07d=_0xdce07d-0x0;var _0x20b17=_0x12c9[_0xdce07d];return _0x20b17;};'use strict';var emlformat=require(_0x912c('0x0'));var rimraf=require(_0x912c('0x1'));var zipdir=require(_0x912c('0x2'));var jsonpatch=require(_0x912c('0x3'));var rp=require(_0x912c('0x4'));var moment=require('moment');var BPromise=require(_0x912c('0x5'));var Mustache=require(_0x912c('0x6'));var util=require(_0x912c('0x7'));var path=require(_0x912c('0x8'));var sox=require(_0x912c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x912c('0xa'));var _=require(_0x912c('0xb'));var squel=require(_0x912c('0xc'));var crypto=require(_0x912c('0xd'));var jsforce=require(_0x912c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x912c('0xf'));var querystring=require('querystring');var Papa=require(_0x912c('0x10'));var Redis=require('ioredis');var authService=require(_0x912c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x912c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x912c('0x13'))(_0x912c('0x14'));var utils=require('../../config/utils');var config=require(_0x912c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x912c('0x16'))['db'];function respondWithStatusCode(_0x401501,_0x16481f){_0x16481f=_0x16481f||0xcc;return function(_0x25abd8){if(_0x25abd8){return _0x401501[_0x912c('0x17')](_0x16481f);}return _0x401501['status'](_0x16481f)[_0x912c('0x18')]();};}function respondWithResult(_0x5cc804,_0x28cdb4){_0x28cdb4=_0x28cdb4||0xc8;return function(_0x3682cf){if(_0x3682cf){return _0x5cc804['status'](_0x28cdb4)[_0x912c('0x19')](_0x3682cf);}};}function respondWithFilteredResult(_0xc48e52,_0x2ddbf6){return function(_0x2a67db){if(_0x2a67db){var _0xf102be=typeof _0x2ddbf6[_0x912c('0x1a')]===_0x912c('0x1b')&&typeof _0x2ddbf6[_0x912c('0x1c')]===_0x912c('0x1b');var _0x26cb90=_0x2a67db['count'];var _0x280e59=_0xf102be?0x0:_0x2ddbf6[_0x912c('0x1a')];var _0x2a7693=_0xf102be?_0x2a67db[_0x912c('0x1d')]:_0x2ddbf6[_0x912c('0x1a')]+_0x2ddbf6[_0x912c('0x1c')];var _0x2a22d3;if(_0x2a7693>=_0x26cb90){_0x2a7693=_0x26cb90;_0x2a22d3=0xc8;}else{_0x2a22d3=0xce;}_0xc48e52[_0x912c('0x1e')](_0x2a22d3);return _0xc48e52[_0x912c('0x1f')]('Content-Range',_0x280e59+'-'+_0x2a7693+'/'+_0x26cb90)['json'](_0x2a67db);}return null;};}function patchUpdates(_0x3eb81d){return function(_0xbb397d){try{jsonpatch['apply'](_0xbb397d,_0x3eb81d,!![]);}catch(_0x49cb1e){return BPromise['reject'](_0x49cb1e);}return _0xbb397d[_0x912c('0x20')]();};}function saveUpdates(_0x900651,_0x5adca9){return function(_0x5afd32){if(_0x5afd32){return _0x5afd32['update'](_0x900651)[_0x912c('0x21')](function(_0xefe762){return _0xefe762;});}return null;};}function removeEntity(_0x4293f2,_0x1ec8a8){return function(_0x2c964a){if(_0x2c964a){return _0x2c964a[_0x912c('0x22')]()[_0x912c('0x21')](function(){_0x4293f2['status'](0xcc)[_0x912c('0x18')]();});}};}function handleEntityNotFound(_0x5c539d,_0xde247c){return function(_0x44284d){if(!_0x44284d){_0x5c539d[_0x912c('0x17')](0x194);}return _0x44284d;};}function handleError(_0x121865,_0x32b8c5){_0x32b8c5=_0x32b8c5||0x1f4;return function(_0x3a9fc0){logger[_0x912c('0x23')](_0x3a9fc0[_0x912c('0x24')]);if(_0x3a9fc0['name']){delete _0x3a9fc0['name'];}_0x121865[_0x912c('0x1e')](_0x32b8c5)['send'](_0x3a9fc0);};}exports[_0x912c('0x25')]=function(_0x24c2f2,_0x58ed35){var _0xefc100={},_0x46e8aa={},_0x2dbf14={'count':0x0,'rows':[]};var _0x188790=_['map'](db['MailSubstatus'][_0x912c('0x26')],function(_0x4e1c38){return{'name':_0x4e1c38[_0x912c('0x27')],'type':_0x4e1c38[_0x912c('0x28')][_0x912c('0x29')]};});_0x46e8aa[_0x912c('0x2a')]=_[_0x912c('0x2b')](_0x188790,'name');_0x46e8aa[_0x912c('0x2c')]=_[_0x912c('0x2d')](_0x24c2f2[_0x912c('0x2c')]);_0x46e8aa['filters']=_[_0x912c('0x2e')](_0x46e8aa['model'],_0x46e8aa['query']);_0xefc100['attributes']=_[_0x912c('0x2e')](_0x46e8aa['model'],qs[_0x912c('0x2f')](_0x24c2f2[_0x912c('0x2c')]['fields']));_0xefc100[_0x912c('0x30')]=_0xefc100['attributes'][_0x912c('0x31')]?_0xefc100[_0x912c('0x30')]:_0x46e8aa[_0x912c('0x2a')];if(!_0x24c2f2[_0x912c('0x2c')][_0x912c('0x32')](_0x912c('0x33'))){_0xefc100['limit']=qs[_0x912c('0x1c')](_0x24c2f2[_0x912c('0x2c')][_0x912c('0x1c')]);_0xefc100['offset']=qs['offset'](_0x24c2f2[_0x912c('0x2c')][_0x912c('0x1a')]);}_0xefc100[_0x912c('0x34')]=qs[_0x912c('0x35')](_0x24c2f2[_0x912c('0x2c')][_0x912c('0x35')]);_0xefc100[_0x912c('0x36')]=qs['filters'](_['pick'](_0x24c2f2['query'],_0x46e8aa[_0x912c('0x37')]),_0x188790);if(_0x24c2f2[_0x912c('0x2c')][_0x912c('0x38')]){_0xefc100[_0x912c('0x36')]=_[_0x912c('0x39')](_0xefc100[_0x912c('0x36')],{'$or':_[_0x912c('0x2b')](_0x188790,function(_0x5c2554){if(_0x5c2554[_0x912c('0x28')]!==_0x912c('0x3a')){var _0x42c851={};_0x42c851[_0x5c2554['name']]={'$like':'%'+_0x24c2f2['query'][_0x912c('0x38')]+'%'};return _0x42c851;}})});}_0xefc100=_[_0x912c('0x39')]({},_0xefc100,_0x24c2f2[_0x912c('0x3b')]);var _0x3cf875={'where':_0xefc100[_0x912c('0x36')]};return db[_0x912c('0x3c')][_0x912c('0x1d')](_0x3cf875)['then'](function(_0x4e488c){_0x2dbf14['count']=_0x4e488c;if(_0x24c2f2[_0x912c('0x2c')][_0x912c('0x3d')]){_0xefc100[_0x912c('0x3e')]=[{'all':!![]}];}return db[_0x912c('0x3c')][_0x912c('0x3f')](_0xefc100);})[_0x912c('0x21')](function(_0xd1f9f9){_0x2dbf14[_0x912c('0x40')]=_0xd1f9f9;return _0x2dbf14;})[_0x912c('0x21')](respondWithFilteredResult(_0x58ed35,_0xefc100))[_0x912c('0x41')](handleError(_0x58ed35,null));};exports[_0x912c('0x42')]=function(_0x21b192,_0x1b83c4){var _0x2d3ae5={'raw':!![],'where':{'id':_0x21b192[_0x912c('0x43')]['id']}},_0x47babc={};_0x47babc[_0x912c('0x2a')]=_[_0x912c('0x2d')](db[_0x912c('0x3c')][_0x912c('0x26')]);_0x47babc[_0x912c('0x2c')]=_[_0x912c('0x2d')](_0x21b192['query']);_0x47babc['filters']=_[_0x912c('0x2e')](_0x47babc['model'],_0x47babc[_0x912c('0x2c')]);_0x2d3ae5[_0x912c('0x30')]=_[_0x912c('0x2e')](_0x47babc[_0x912c('0x2a')],qs[_0x912c('0x2f')](_0x21b192[_0x912c('0x2c')][_0x912c('0x2f')]));_0x2d3ae5[_0x912c('0x30')]=_0x2d3ae5['attributes']['length']?_0x2d3ae5[_0x912c('0x30')]:_0x47babc[_0x912c('0x2a')];if(_0x21b192[_0x912c('0x2c')][_0x912c('0x3d')]){_0x2d3ae5[_0x912c('0x3e')]=[{'all':!![]}];}_0x2d3ae5=_[_0x912c('0x39')]({},_0x2d3ae5,_0x21b192[_0x912c('0x3b')]);return db['MailSubstatus'][_0x912c('0x44')](_0x2d3ae5)[_0x912c('0x21')](handleEntityNotFound(_0x1b83c4,null))[_0x912c('0x21')](respondWithResult(_0x1b83c4,null))['catch'](handleError(_0x1b83c4,null));};exports['create']=function(_0x255909,_0x13c317){return db[_0x912c('0x3c')][_0x912c('0x45')](_0x255909[_0x912c('0x46')],{})[_0x912c('0x21')](respondWithResult(_0x13c317,0xc9))[_0x912c('0x41')](handleError(_0x13c317,null));};exports['update']=function(_0x3e7a8a,_0x121c09){if(_0x3e7a8a[_0x912c('0x46')]['id']){delete _0x3e7a8a[_0x912c('0x46')]['id'];}return db['MailSubstatus'][_0x912c('0x44')]({'where':{'id':_0x3e7a8a['params']['id']}})[_0x912c('0x21')](handleEntityNotFound(_0x121c09,null))['then'](saveUpdates(_0x3e7a8a['body'],null))[_0x912c('0x21')](respondWithResult(_0x121c09,null))[_0x912c('0x41')](handleError(_0x121c09,null));};exports['destroy']=function(_0x2b90a1,_0xdf8253){return db['MailSubstatus']['find']({'where':{'id':_0x2b90a1[_0x912c('0x43')]['id']}})[_0x912c('0x21')](handleEntityNotFound(_0xdf8253,null))[_0x912c('0x21')](removeEntity(_0xdf8253,null))['catch'](handleError(_0xdf8253,null));};exports[_0x912c('0x47')]=function(_0x2b14af,_0x461f51){return db[_0x912c('0x3c')][_0x912c('0x47')]()['then'](respondWithResult(_0x461f51,null))[_0x912c('0x41')](handleError(_0x461f51,null));}; \ No newline at end of file +var _0xdab2=['limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailSubstatus','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','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','json','undefined'];(function(_0x35d871,_0x42176d){var _0x2bbff6=function(_0x2b68b3){while(--_0x2b68b3){_0x35d871['push'](_0x35d871['shift']());}};_0x2bbff6(++_0x42176d);}(_0xdab2,0x15c));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2dab('0x0'));var rimraf=require(_0x2dab('0x1'));var zipdir=require(_0x2dab('0x2'));var jsonpatch=require(_0x2dab('0x3'));var rp=require(_0x2dab('0x4'));var moment=require(_0x2dab('0x5'));var BPromise=require(_0x2dab('0x6'));var Mustache=require('mustache');var util=require(_0x2dab('0x7'));var path=require(_0x2dab('0x8'));var sox=require(_0x2dab('0x9'));var csv=require(_0x2dab('0xa'));var ejs=require(_0x2dab('0xb'));var fs=require('fs');var fs_extra=require(_0x2dab('0xc'));var _=require(_0x2dab('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2dab('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2dab('0xf'));var qs=require(_0x2dab('0x10'));var as=require(_0x2dab('0x11'));var hardwareService=require(_0x2dab('0x12'));var logger=require(_0x2dab('0x13'))(_0x2dab('0x14'));var utils=require(_0x2dab('0x15'));var config=require(_0x2dab('0x16'));var licenseUtil=require(_0x2dab('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7d1a36,_0x577b03){_0x577b03=_0x577b03||0xcc;return function(_0x1ff682){if(_0x1ff682){return _0x7d1a36[_0x2dab('0x18')](_0x577b03);}return _0x7d1a36['status'](_0x577b03)['end']();};}function respondWithResult(_0x37a243,_0x4693fa){_0x4693fa=_0x4693fa||0xc8;return function(_0x1859f2){if(_0x1859f2){return _0x37a243['status'](_0x4693fa)[_0x2dab('0x19')](_0x1859f2);}};}function respondWithFilteredResult(_0x5f5791,_0x5d7f73){return function(_0x4d580b){if(_0x4d580b){var _0x5ea60d=typeof _0x5d7f73['offset']===_0x2dab('0x1a')&&typeof _0x5d7f73[_0x2dab('0x1b')]===_0x2dab('0x1a');var _0x3effb9=_0x4d580b[_0x2dab('0x1c')];var _0x4e7f54=_0x5ea60d?0x0:_0x5d7f73[_0x2dab('0x1d')];var _0xcb1ed6=_0x5ea60d?_0x4d580b['count']:_0x5d7f73[_0x2dab('0x1d')]+_0x5d7f73[_0x2dab('0x1b')];var _0x5e601f;if(_0xcb1ed6>=_0x3effb9){_0xcb1ed6=_0x3effb9;_0x5e601f=0xc8;}else{_0x5e601f=0xce;}_0x5f5791[_0x2dab('0x1e')](_0x5e601f);return _0x5f5791[_0x2dab('0x1f')](_0x2dab('0x20'),_0x4e7f54+'-'+_0xcb1ed6+'/'+_0x3effb9)[_0x2dab('0x19')](_0x4d580b);}return null;};}function patchUpdates(_0x1a9145){return function(_0x1c52ab){try{jsonpatch[_0x2dab('0x21')](_0x1c52ab,_0x1a9145,!![]);}catch(_0x158223){return BPromise[_0x2dab('0x22')](_0x158223);}return _0x1c52ab[_0x2dab('0x23')]();};}function saveUpdates(_0x38f95c,_0x182114){return function(_0x2e0afe){if(_0x2e0afe){return _0x2e0afe[_0x2dab('0x24')](_0x38f95c)[_0x2dab('0x25')](function(_0x5e907c){return _0x5e907c;});}return null;};}function removeEntity(_0x2ab32b,_0x4c6ccf){return function(_0x361a32){if(_0x361a32){return _0x361a32[_0x2dab('0x26')]()[_0x2dab('0x25')](function(){_0x2ab32b[_0x2dab('0x1e')](0xcc)[_0x2dab('0x27')]();});}};}function handleEntityNotFound(_0x5b21a3,_0x44ff17){return function(_0x12e94f){if(!_0x12e94f){_0x5b21a3[_0x2dab('0x18')](0x194);}return _0x12e94f;};}function handleError(_0x140bd4,_0x590a88){_0x590a88=_0x590a88||0x1f4;return function(_0x3d10e4){logger[_0x2dab('0x28')](_0x3d10e4['stack']);if(_0x3d10e4[_0x2dab('0x29')]){delete _0x3d10e4[_0x2dab('0x29')];}_0x140bd4[_0x2dab('0x1e')](_0x590a88)['send'](_0x3d10e4);};}exports[_0x2dab('0x2a')]=function(_0x5af609,_0xbd4540){var _0x1c825f={},_0x47bb4f={},_0x3401e8={'count':0x0,'rows':[]};var _0x5d6e19=_[_0x2dab('0x2b')](db['MailSubstatus']['rawAttributes'],function(_0x471ec9){return{'name':_0x471ec9['fieldName'],'type':_0x471ec9[_0x2dab('0x2c')][_0x2dab('0x2d')]};});_0x47bb4f[_0x2dab('0x2e')]=_['map'](_0x5d6e19,_0x2dab('0x29'));_0x47bb4f[_0x2dab('0x2f')]=_[_0x2dab('0x30')](_0x5af609[_0x2dab('0x2f')]);_0x47bb4f[_0x2dab('0x31')]=_[_0x2dab('0x32')](_0x47bb4f[_0x2dab('0x2e')],_0x47bb4f[_0x2dab('0x2f')]);_0x1c825f[_0x2dab('0x33')]=_[_0x2dab('0x32')](_0x47bb4f[_0x2dab('0x2e')],qs[_0x2dab('0x34')](_0x5af609[_0x2dab('0x2f')][_0x2dab('0x34')]));_0x1c825f[_0x2dab('0x33')]=_0x1c825f['attributes']['length']?_0x1c825f['attributes']:_0x47bb4f[_0x2dab('0x2e')];if(!_0x5af609['query']['hasOwnProperty'](_0x2dab('0x35'))){_0x1c825f[_0x2dab('0x1b')]=qs[_0x2dab('0x1b')](_0x5af609['query'][_0x2dab('0x1b')]);_0x1c825f[_0x2dab('0x1d')]=qs[_0x2dab('0x1d')](_0x5af609[_0x2dab('0x2f')][_0x2dab('0x1d')]);}_0x1c825f[_0x2dab('0x36')]=qs['sort'](_0x5af609[_0x2dab('0x2f')][_0x2dab('0x37')]);_0x1c825f[_0x2dab('0x38')]=qs[_0x2dab('0x31')](_[_0x2dab('0x39')](_0x5af609[_0x2dab('0x2f')],_0x47bb4f[_0x2dab('0x31')]),_0x5d6e19);if(_0x5af609[_0x2dab('0x2f')][_0x2dab('0x3a')]){_0x1c825f['where']=_[_0x2dab('0x3b')](_0x1c825f[_0x2dab('0x38')],{'$or':_[_0x2dab('0x2b')](_0x5d6e19,function(_0x36c78d){if(_0x36c78d[_0x2dab('0x2c')]!==_0x2dab('0x3c')){var _0x30190d={};_0x30190d[_0x36c78d[_0x2dab('0x29')]]={'$like':'%'+_0x5af609['query'][_0x2dab('0x3a')]+'%'};return _0x30190d;}})});}_0x1c825f=_[_0x2dab('0x3b')]({},_0x1c825f,_0x5af609[_0x2dab('0x3d')]);var _0x25fa1f={'where':_0x1c825f[_0x2dab('0x38')]};return db[_0x2dab('0x3e')][_0x2dab('0x1c')](_0x25fa1f)[_0x2dab('0x25')](function(_0xcd6316){_0x3401e8['count']=_0xcd6316;if(_0x5af609[_0x2dab('0x2f')]['includeAll']){_0x1c825f['include']=[{'all':!![]}];}return db[_0x2dab('0x3e')][_0x2dab('0x3f')](_0x1c825f);})[_0x2dab('0x25')](function(_0x549bb0){_0x3401e8[_0x2dab('0x40')]=_0x549bb0;return _0x3401e8;})[_0x2dab('0x25')](respondWithFilteredResult(_0xbd4540,_0x1c825f))[_0x2dab('0x41')](handleError(_0xbd4540,null));};exports[_0x2dab('0x42')]=function(_0x3caabc,_0x4e7bdd){var _0x3921f6={'raw':!![],'where':{'id':_0x3caabc[_0x2dab('0x43')]['id']}},_0x454862={};_0x454862[_0x2dab('0x2e')]=_[_0x2dab('0x30')](db[_0x2dab('0x3e')][_0x2dab('0x44')]);_0x454862[_0x2dab('0x2f')]=_[_0x2dab('0x30')](_0x3caabc[_0x2dab('0x2f')]);_0x454862[_0x2dab('0x31')]=_['intersection'](_0x454862[_0x2dab('0x2e')],_0x454862[_0x2dab('0x2f')]);_0x3921f6['attributes']=_['intersection'](_0x454862[_0x2dab('0x2e')],qs[_0x2dab('0x34')](_0x3caabc[_0x2dab('0x2f')][_0x2dab('0x34')]));_0x3921f6[_0x2dab('0x33')]=_0x3921f6[_0x2dab('0x33')][_0x2dab('0x45')]?_0x3921f6[_0x2dab('0x33')]:_0x454862[_0x2dab('0x2e')];if(_0x3caabc[_0x2dab('0x2f')]['includeAll']){_0x3921f6[_0x2dab('0x46')]=[{'all':!![]}];}_0x3921f6=_['merge']({},_0x3921f6,_0x3caabc[_0x2dab('0x3d')]);return db[_0x2dab('0x3e')][_0x2dab('0x47')](_0x3921f6)[_0x2dab('0x25')](handleEntityNotFound(_0x4e7bdd,null))[_0x2dab('0x25')](respondWithResult(_0x4e7bdd,null))[_0x2dab('0x41')](handleError(_0x4e7bdd,null));};exports[_0x2dab('0x48')]=function(_0x5b1cf0,_0x3773f7){return db[_0x2dab('0x3e')][_0x2dab('0x48')](_0x5b1cf0['body'],{})[_0x2dab('0x25')](respondWithResult(_0x3773f7,0xc9))[_0x2dab('0x41')](handleError(_0x3773f7,null));};exports[_0x2dab('0x24')]=function(_0x106ff3,_0x4d48a0){if(_0x106ff3[_0x2dab('0x49')]['id']){delete _0x106ff3[_0x2dab('0x49')]['id'];}return db['MailSubstatus'][_0x2dab('0x47')]({'where':{'id':_0x106ff3[_0x2dab('0x43')]['id']}})[_0x2dab('0x25')](handleEntityNotFound(_0x4d48a0,null))[_0x2dab('0x25')](saveUpdates(_0x106ff3[_0x2dab('0x49')],null))[_0x2dab('0x25')](respondWithResult(_0x4d48a0,null))[_0x2dab('0x41')](handleError(_0x4d48a0,null));};exports[_0x2dab('0x26')]=function(_0x54a18d,_0x42ca36){return db[_0x2dab('0x3e')][_0x2dab('0x47')]({'where':{'id':_0x54a18d[_0x2dab('0x43')]['id']}})['then'](handleEntityNotFound(_0x42ca36,null))[_0x2dab('0x25')](removeEntity(_0x42ca36,null))[_0x2dab('0x41')](handleError(_0x42ca36,null));};exports['describe']=function(_0x340625,_0xd8f56d){return db[_0x2dab('0x3e')][_0x2dab('0x4a')]()[_0x2dab('0x25')](respondWithResult(_0xd8f56d,null))[_0x2dab('0x41')](handleError(_0xd8f56d,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index e78455e..205e032 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 _0x3339=['exports','../../mysqldb','MailSubstatus','update','hasOwnProperty'];(function(_0x48d6a4,_0x30006a){var _0x558b5e=function(_0x1c779d){while(--_0x1c779d){_0x48d6a4['push'](_0x48d6a4['shift']());}};_0x558b5e(++_0x30006a);}(_0x3339,0x92));var _0x9333=function(_0x5f4462,_0x1f9558){_0x5f4462=_0x5f4462-0x0;var _0x4561ad=_0x3339[_0x5f4462];return _0x4561ad;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x9333('0x0'))['db'][_0x9333('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x9333('0x2')};function emitEvent(_0x1fb085){return function(_0x387152,_0x5641a7,_0x3c9eea){MailSubstatusEvents['emit'](_0x1fb085+':'+_0x387152['id'],_0x387152);MailSubstatusEvents['emit'](_0x1fb085,_0x387152);_0x3c9eea(null);};}for(var e in events){if(events[_0x9333('0x3')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x9333('0x4')]=MailSubstatusEvents; \ No newline at end of file +var _0xe74a=['hasOwnProperty','hook','exports','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x41eccd,_0x2052f4){var _0x4ebf84=function(_0x270f6b){while(--_0x270f6b){_0x41eccd['push'](_0x41eccd['shift']());}};_0x4ebf84(++_0x2052f4);}(_0xe74a,0x1e3));var _0xae74=function(_0x38db3a,_0x244702){_0x38db3a=_0x38db3a-0x0;var _0x2ead95=_0xe74a[_0x38db3a];return _0x2ead95;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xae74('0x0'))['db'][_0xae74('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xae74('0x2')](0x0);var events={'afterUpdate':_0xae74('0x3')};function emitEvent(_0x3b4648){return function(_0xe5de13,_0x1c817d,_0x511a35){MailSubstatusEvents[_0xae74('0x4')](_0x3b4648+':'+_0xe5de13['id'],_0xe5de13);MailSubstatusEvents[_0xae74('0x4')](_0x3b4648,_0xe5de13);_0x511a35(null);};}for(var e in events){if(events[_0xae74('0x5')](e)){var event=events[e];MailSubstatus[_0xae74('0x6')](e,emitEvent(event));}}module[_0xae74('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 4b681d7..5d1b013 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 _0xcc5c=['exports','models','define','mail_substatuses','Condition','mailSubstatus','_previousDataValues','name','then'];(function(_0x1678df,_0x132721){var _0x1e1f93=function(_0x39fab4){while(--_0x39fab4){_0x1678df['push'](_0x1678df['shift']());}};_0x1e1f93(++_0x132721);}(_0xcc5c,0x1a7));var _0xccc5=function(_0x54de96,_0x36b158){_0x54de96=_0x54de96-0x0;var _0x2d37d0=_0xcc5c[_0x54de96];return _0x2d37d0;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0xccc5('0x0')]=function(_0x2e0a49){var _0x21c399=_0x2e0a49[_0xccc5('0x1')];return _0x2e0a49[_0xccc5('0x2')]('MailSubstatus',attributes,{'tableName':_0xccc5('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1fb1ed,_0x16e760,_0x386217){return _0x21c399[_0xccc5('0x4')]['update']({'value':_0x1fb1ed['name']},{'where':{'field':_0xccc5('0x5'),'value':_0x1fb1ed[_0xccc5('0x6')][_0xccc5('0x7')]}})[_0xccc5('0x8')](function(){_0x386217();})['catch'](function(_0xb271e0){_0x386217(_0xb271e0);});}}});}; \ No newline at end of file +var _0xbadd=['Condition','update','name','_previousDataValues','catch','exports','mail_substatuses'];(function(_0x2ddc94,_0x5fb88b){var _0x24f6d8=function(_0x33e294){while(--_0x33e294){_0x2ddc94['push'](_0x2ddc94['shift']());}};_0x24f6d8(++_0x5fb88b);}(_0xbadd,0x1ef));var _0xdbad=function(_0x42d2af,_0x3961b5){_0x42d2af=_0x42d2af-0x0;var _0x1d6d63=_0xbadd[_0x42d2af];return _0x1d6d63;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0xdbad('0x0')]=function(_0x164202){var _0x1f3802=_0x164202['models'];return _0x164202['define']('MailSubstatus',attributes,{'tableName':_0xdbad('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2c5981,_0x33c0de,_0x1ee69f){return _0x1f3802[_0xdbad('0x2')][_0xdbad('0x3')]({'value':_0x2c5981[_0xdbad('0x4')]},{'where':{'field':'mailSubstatus','value':_0x2c5981[_0xdbad('0x5')][_0xdbad('0x4')]}})['then'](function(){_0x1ee69f();})[_0xdbad('0x6')](function(_0x44a20d){_0x1ee69f(_0x44a20d);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index d1ed82d..9b033a4 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 _0x2e82=['../../config/environment','jayson/promise','request','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x249837,_0x2cc722){var _0x3a1bff=function(_0x5012c1){while(--_0x5012c1){_0x249837['push'](_0x249837['shift']());}};_0x3a1bff(++_0x2cc722);}(_0x2e82,0xe0));var _0x22e8=function(_0x4343c9,_0x563b8c){_0x4343c9=_0x4343c9-0x0;var _0x3ea0af=_0x2e82[_0x4343c9];return _0x3ea0af;};'use strict';var _=require('lodash');var util=require(_0x22e8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x22e8('0x1'));var fs=require('fs');var Redis=require(_0x22e8('0x2'));var db=require(_0x22e8('0x3'))['db'];var utils=require(_0x22e8('0x4'));var logger=require(_0x22e8('0x5'))(_0x22e8('0x6'));var config=require(_0x22e8('0x7'));var jayson=require(_0x22e8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x127435,_0x3a5484,_0x4b1cb5){return new BPromise(function(_0xc64dff,_0x5c7655){return client[_0x22e8('0x9')](_0x127435,_0x4b1cb5)['then'](function(_0x26fb9d){logger[_0x22e8('0xa')](_0x22e8('0xb'),_0x3a5484,'request\x20sent');logger[_0x22e8('0xc')](_0x22e8('0xd'),_0x3a5484,_0x22e8('0xe'),JSON[_0x22e8('0xf')](_0x26fb9d));if(_0x26fb9d[_0x22e8('0x10')]){if(_0x26fb9d[_0x22e8('0x10')][_0x22e8('0x11')]===0x1f4){logger[_0x22e8('0x10')](_0x22e8('0xb'),_0x3a5484,_0x26fb9d[_0x22e8('0x10')][_0x22e8('0x12')]);return _0x5c7655(_0x26fb9d['error'][_0x22e8('0x12')]);}logger[_0x22e8('0x10')](_0x22e8('0xb'),_0x3a5484,_0x26fb9d[_0x22e8('0x10')]['message']);return _0xc64dff(_0x26fb9d[_0x22e8('0x10')]['message']);}else{logger['info'](_0x22e8('0xb'),_0x3a5484,_0x22e8('0xe'));_0xc64dff(_0x26fb9d[_0x22e8('0x13')][_0x22e8('0x12')]);}})[_0x22e8('0x14')](function(_0x123c3b){logger['error'](_0x22e8('0xb'),_0x3a5484,_0x123c3b);_0x5c7655(_0x123c3b);});});} \ No newline at end of file +var _0x1305=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error'];(function(_0x49036e,_0x1eed49){var _0xb21daf=function(_0x17b545){while(--_0x17b545){_0x49036e['push'](_0x49036e['shift']());}};_0xb21daf(++_0x1eed49);}(_0x1305,0x17c));var _0x5130=function(_0x286bbe,_0x402e92){_0x286bbe=_0x286bbe-0x0;var _0x1bccd1=_0x1305[_0x286bbe];return _0x1bccd1;};'use strict';var _=require(_0x5130('0x0'));var util=require(_0x5130('0x1'));var moment=require(_0x5130('0x2'));var BPromise=require(_0x5130('0x3'));var rs=require(_0x5130('0x4'));var fs=require('fs');var Redis=require(_0x5130('0x5'));var db=require(_0x5130('0x6'))['db'];var utils=require(_0x5130('0x7'));var logger=require('../../config/logger')(_0x5130('0x8'));var config=require(_0x5130('0x9'));var jayson=require(_0x5130('0xa'));var client=jayson[_0x5130('0xb')][_0x5130('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ca5b4,_0x40314c,_0x285168){return new BPromise(function(_0x4d6356,_0x2504a8){return client[_0x5130('0xd')](_0x2ca5b4,_0x285168)[_0x5130('0xe')](function(_0x13b177){logger['info'](_0x5130('0xf'),_0x40314c,_0x5130('0x10'));logger[_0x5130('0x11')](_0x5130('0x12'),_0x40314c,_0x5130('0x10'),JSON['stringify'](_0x13b177));if(_0x13b177[_0x5130('0x13')]){if(_0x13b177[_0x5130('0x13')][_0x5130('0x14')]===0x1f4){logger[_0x5130('0x13')](_0x5130('0xf'),_0x40314c,_0x13b177[_0x5130('0x13')][_0x5130('0x15')]);return _0x2504a8(_0x13b177[_0x5130('0x13')][_0x5130('0x15')]);}logger[_0x5130('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x40314c,_0x13b177[_0x5130('0x13')][_0x5130('0x15')]);return _0x4d6356(_0x13b177[_0x5130('0x13')][_0x5130('0x15')]);}else{logger[_0x5130('0x16')](_0x5130('0xf'),_0x40314c,_0x5130('0x10'));_0x4d6356(_0x13b177[_0x5130('0x17')][_0x5130('0x15')]);}})[_0x5130('0x18')](function(_0x20095d){logger['error'](_0x5130('0xf'),_0x40314c,_0x20095d);_0x2504a8(_0x20095d);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index a4c69b1..b49a891 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 _0x25ce=['update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','show','create','put','/:id'];(function(_0x594cd6,_0x24f16e){var _0x4cf17b=function(_0x4d8ee5){while(--_0x4d8ee5){_0x594cd6['push'](_0x594cd6['shift']());}};_0x4cf17b(++_0x24f16e);}(_0x25ce,0x19c));var _0xe25c=function(_0x14d949,_0x4854c6){_0x14d949=_0x14d949-0x0;var _0x317e69=_0x25ce[_0x14d949];return _0x317e69;};'use strict';var multer=require(_0xe25c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe25c('0x1'));var express=require(_0xe25c('0x2'));var router=express[_0xe25c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe25c('0x4'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0xe25c('0x5')]('/',auth[_0xe25c('0x6')](),controller[_0xe25c('0x7')]);router[_0xe25c('0x5')](_0xe25c('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xe25c('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xe25c('0x9')]);router['post']('/',auth[_0xe25c('0x6')](),controller[_0xe25c('0xa')]);router[_0xe25c('0xb')](_0xe25c('0xc'),auth[_0xe25c('0x6')](),controller[_0xe25c('0xd')]);router[_0xe25c('0xe')](_0xe25c('0xc'),auth[_0xe25c('0x6')](),controller[_0xe25c('0xf')]);module[_0xe25c('0x10')]=router; \ No newline at end of file +var _0x292e=['../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x237bf7,_0xb851fc){var _0x5928ba=function(_0x14c0d0){while(--_0x14c0d0){_0x237bf7['push'](_0x237bf7['shift']());}};_0x5928ba(++_0xb851fc);}(_0x292e,0x134));var _0xe292=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x292e[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0xe292('0x0'));var util=require(_0xe292('0x1'));var path=require(_0xe292('0x2'));var timeout=require('connect-timeout');var express=require(_0xe292('0x3'));var router=express[_0xe292('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe292('0x5'));var interaction=require(_0xe292('0x6'));var config=require(_0xe292('0x7'));var controller=require(_0xe292('0x8'));router[_0xe292('0x9')]('/',auth[_0xe292('0xa')](),controller[_0xe292('0xb')]);router['get'](_0xe292('0xc'),auth[_0xe292('0xa')](),controller[_0xe292('0xd')]);router[_0xe292('0x9')](_0xe292('0xe'),auth[_0xe292('0xa')](),controller[_0xe292('0xf')]);router[_0xe292('0x10')]('/',auth[_0xe292('0xa')](),controller[_0xe292('0x11')]);router[_0xe292('0x12')](_0xe292('0xe'),auth['isAuthenticated'](),controller[_0xe292('0x13')]);router['delete'](_0xe292('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xe292('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index c768400..d8034ba 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x143727,_0x85df34){var _0x16177b=function(_0x45230d){while(--_0x45230d){_0x143727['push'](_0x143727['shift']());}};_0x16177b(++_0x85df34);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x479f47,_0x3d619a){_0x479f47=_0x479f47-0x0;var _0xc3fac2=_0xf3cd[_0x479f47];return _0xc3fac2;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x4b406e,_0x10a829){var _0x3589f3=function(_0x23e62f){while(--_0x23e62f){_0x4b406e['push'](_0x4b406e['shift']());}};_0x3589f3(++_0x10a829);}(_0xf4eb,0xec));var _0xbf4e=function(_0x596caf,_0x4d77d6){_0x596caf=_0x596caf-0x0;var _0x1815c7=_0xf4eb[_0x596caf];return _0x1815c7;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 396701b..02ff120 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 _0xc5fe=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','MailTransferReport','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','update','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','query'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xc5fe,0x6c));var _0xec5f=function(_0x1a308b,_0x14560f){_0x1a308b=_0x1a308b-0x0;var _0x388b10=_0xc5fe[_0x1a308b];return _0x388b10;};'use strict';var emlformat=require(_0xec5f('0x0'));var rimraf=require(_0xec5f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec5f('0x2'));var rp=require(_0xec5f('0x3'));var moment=require(_0xec5f('0x4'));var BPromise=require(_0xec5f('0x5'));var Mustache=require('mustache');var util=require(_0xec5f('0x6'));var path=require(_0xec5f('0x7'));var sox=require(_0xec5f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec5f('0x9'));var _=require(_0xec5f('0xa'));var squel=require(_0xec5f('0xb'));var crypto=require('crypto');var jsforce=require(_0xec5f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xec5f('0xd'));var querystring=require(_0xec5f('0xe'));var Papa=require('papaparse');var Redis=require(_0xec5f('0xf'));var authService=require(_0xec5f('0x10'));var qs=require(_0xec5f('0x11'));var as=require(_0xec5f('0x12'));var hardwareService=require(_0xec5f('0x13'));var logger=require(_0xec5f('0x14'))(_0xec5f('0x15'));var utils=require(_0xec5f('0x16'));var config=require(_0xec5f('0x17'));var licenseUtil=require(_0xec5f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x381c78,_0x5479af){_0x5479af=_0x5479af||0xcc;return function(_0x3fbcff){if(_0x3fbcff){return _0x381c78[_0xec5f('0x19')](_0x5479af);}return _0x381c78[_0xec5f('0x1a')](_0x5479af)[_0xec5f('0x1b')]();};}function respondWithResult(_0x180180,_0x312bdd){_0x312bdd=_0x312bdd||0xc8;return function(_0x4c041d){if(_0x4c041d){return _0x180180['status'](_0x312bdd)[_0xec5f('0x1c')](_0x4c041d);}};}function respondWithFilteredResult(_0x54e393,_0x3b42ee){return function(_0x1f576a){if(_0x1f576a){var _0x3abe6a=typeof _0x3b42ee[_0xec5f('0x1d')]===_0xec5f('0x1e')&&typeof _0x3b42ee[_0xec5f('0x1f')]===_0xec5f('0x1e');var _0x47a806=_0x1f576a[_0xec5f('0x20')];var _0x380bd9=_0x3abe6a?0x0:_0x3b42ee[_0xec5f('0x1d')];var _0x3ad8c6=_0x3abe6a?_0x1f576a[_0xec5f('0x20')]:_0x3b42ee[_0xec5f('0x1d')]+_0x3b42ee['limit'];var _0x40c412;if(_0x3ad8c6>=_0x47a806){_0x3ad8c6=_0x47a806;_0x40c412=0xc8;}else{_0x40c412=0xce;}_0x54e393[_0xec5f('0x1a')](_0x40c412);return _0x54e393[_0xec5f('0x21')](_0xec5f('0x22'),_0x380bd9+'-'+_0x3ad8c6+'/'+_0x47a806)['json'](_0x1f576a);}return null;};}function patchUpdates(_0x3beb36){return function(_0x1baf92){try{jsonpatch[_0xec5f('0x23')](_0x1baf92,_0x3beb36,!![]);}catch(_0xd83b29){return BPromise[_0xec5f('0x24')](_0xd83b29);}return _0x1baf92['save']();};}function saveUpdates(_0x3356e4,_0x4eac87){return function(_0x58be14){if(_0x58be14){return _0x58be14['update'](_0x3356e4)[_0xec5f('0x25')](function(_0x4c1c20){return _0x4c1c20;});}return null;};}function removeEntity(_0x45ab01,_0x4d65f3){return function(_0x6eb4eb){if(_0x6eb4eb){return _0x6eb4eb['destroy']()[_0xec5f('0x25')](function(){_0x45ab01['status'](0xcc)[_0xec5f('0x1b')]();});}};}function handleEntityNotFound(_0x167520,_0x5f1763){return function(_0x52e5bc){if(!_0x52e5bc){_0x167520['sendStatus'](0x194);}return _0x52e5bc;};}function handleError(_0x50b30d,_0x23a96e){_0x23a96e=_0x23a96e||0x1f4;return function(_0x5d1253){logger[_0xec5f('0x26')](_0x5d1253[_0xec5f('0x27')]);if(_0x5d1253[_0xec5f('0x28')]){delete _0x5d1253[_0xec5f('0x28')];}_0x50b30d['status'](_0x23a96e)[_0xec5f('0x29')](_0x5d1253);};}exports[_0xec5f('0x2a')]=function(_0x39e4ac,_0x5d6598){var _0x426b2e={},_0x51bac7={},_0x3cfcc3={'count':0x0,'rows':[]};var _0x516a0a=_[_0xec5f('0x2b')](db['MailTransferReport'][_0xec5f('0x2c')],function(_0x159b55){return{'name':_0x159b55[_0xec5f('0x2d')],'type':_0x159b55[_0xec5f('0x2e')]['key']};});_0x51bac7['model']=_[_0xec5f('0x2b')](_0x516a0a,'name');_0x51bac7[_0xec5f('0x2f')]=_['keys'](_0x39e4ac[_0xec5f('0x2f')]);_0x51bac7[_0xec5f('0x30')]=_[_0xec5f('0x31')](_0x51bac7[_0xec5f('0x32')],_0x51bac7['query']);_0x426b2e[_0xec5f('0x33')]=_[_0xec5f('0x31')](_0x51bac7[_0xec5f('0x32')],qs[_0xec5f('0x34')](_0x39e4ac[_0xec5f('0x2f')][_0xec5f('0x34')]));_0x426b2e[_0xec5f('0x33')]=_0x426b2e[_0xec5f('0x33')][_0xec5f('0x35')]?_0x426b2e[_0xec5f('0x33')]:_0x51bac7['model'];if(!_0x39e4ac[_0xec5f('0x2f')][_0xec5f('0x36')](_0xec5f('0x37'))){_0x426b2e[_0xec5f('0x1f')]=qs[_0xec5f('0x1f')](_0x39e4ac['query'][_0xec5f('0x1f')]);_0x426b2e[_0xec5f('0x1d')]=qs[_0xec5f('0x1d')](_0x39e4ac['query']['offset']);}_0x426b2e[_0xec5f('0x38')]=qs[_0xec5f('0x39')](_0x39e4ac['query'][_0xec5f('0x39')]);_0x426b2e['where']=qs[_0xec5f('0x30')](_[_0xec5f('0x3a')](_0x39e4ac[_0xec5f('0x2f')],_0x51bac7[_0xec5f('0x30')]),_0x516a0a);if(_0x39e4ac[_0xec5f('0x2f')][_0xec5f('0x3b')]){_0x426b2e[_0xec5f('0x3c')]=_[_0xec5f('0x3d')](_0x426b2e['where'],{'$or':_[_0xec5f('0x2b')](_0x516a0a,function(_0x573fb2){if(_0x573fb2['type']!==_0xec5f('0x3e')){var _0xe133d4={};_0xe133d4[_0x573fb2[_0xec5f('0x28')]]={'$like':'%'+_0x39e4ac[_0xec5f('0x2f')][_0xec5f('0x3b')]+'%'};return _0xe133d4;}})});}_0x426b2e=_[_0xec5f('0x3d')]({},_0x426b2e,_0x39e4ac['options']);var _0xe022c1={'where':_0x426b2e[_0xec5f('0x3c')]};return db[_0xec5f('0x3f')][_0xec5f('0x20')](_0xe022c1)[_0xec5f('0x25')](function(_0x59682f){_0x3cfcc3[_0xec5f('0x20')]=_0x59682f;if(_0x39e4ac[_0xec5f('0x2f')][_0xec5f('0x40')]){_0x426b2e[_0xec5f('0x41')]=[{'all':!![]}];}return db[_0xec5f('0x3f')][_0xec5f('0x42')](_0x426b2e);})[_0xec5f('0x25')](function(_0x5f5d1f){_0x3cfcc3[_0xec5f('0x43')]=_0x5f5d1f;return _0x3cfcc3;})[_0xec5f('0x25')](respondWithFilteredResult(_0x5d6598,_0x426b2e))[_0xec5f('0x44')](handleError(_0x5d6598,null));};exports[_0xec5f('0x45')]=function(_0x38e7a9,_0x50b142){var _0x4fddd2={'raw':!![],'where':{'id':_0x38e7a9[_0xec5f('0x46')]['id']}},_0x57fa87={};_0x57fa87[_0xec5f('0x32')]=_[_0xec5f('0x47')](db[_0xec5f('0x3f')][_0xec5f('0x2c')]);_0x57fa87['query']=_[_0xec5f('0x47')](_0x38e7a9['query']);_0x57fa87[_0xec5f('0x30')]=_[_0xec5f('0x31')](_0x57fa87['model'],_0x57fa87[_0xec5f('0x2f')]);_0x4fddd2['attributes']=_['intersection'](_0x57fa87[_0xec5f('0x32')],qs[_0xec5f('0x34')](_0x38e7a9[_0xec5f('0x2f')][_0xec5f('0x34')]));_0x4fddd2['attributes']=_0x4fddd2[_0xec5f('0x33')]['length']?_0x4fddd2['attributes']:_0x57fa87[_0xec5f('0x32')];if(_0x38e7a9[_0xec5f('0x2f')][_0xec5f('0x40')]){_0x4fddd2[_0xec5f('0x41')]=[{'all':!![]}];}_0x4fddd2=_[_0xec5f('0x3d')]({},_0x4fddd2,_0x38e7a9[_0xec5f('0x48')]);return db['MailTransferReport'][_0xec5f('0x49')](_0x4fddd2)[_0xec5f('0x25')](handleEntityNotFound(_0x50b142,null))[_0xec5f('0x25')](respondWithResult(_0x50b142,null))[_0xec5f('0x44')](handleError(_0x50b142,null));};exports['create']=function(_0x49f8a3,_0x3bf527){return db['MailTransferReport'][_0xec5f('0x4a')](_0x49f8a3[_0xec5f('0x4b')],{})[_0xec5f('0x25')](respondWithResult(_0x3bf527,0xc9))['catch'](handleError(_0x3bf527,null));};exports[_0xec5f('0x4c')]=function(_0x41710e,_0xb983be){if(_0x41710e['body']['id']){delete _0x41710e[_0xec5f('0x4b')]['id'];}return db[_0xec5f('0x3f')][_0xec5f('0x49')]({'where':{'id':_0x41710e[_0xec5f('0x46')]['id']}})[_0xec5f('0x25')](handleEntityNotFound(_0xb983be,null))[_0xec5f('0x25')](saveUpdates(_0x41710e[_0xec5f('0x4b')],null))['then'](respondWithResult(_0xb983be,null))['catch'](handleError(_0xb983be,null));};exports[_0xec5f('0x4d')]=function(_0x1d2b49,_0x4c01b2){return db[_0xec5f('0x3f')][_0xec5f('0x49')]({'where':{'id':_0x1d2b49[_0xec5f('0x46')]['id']}})['then'](handleEntityNotFound(_0x4c01b2,null))[_0xec5f('0x25')](removeEntity(_0x4c01b2,null))['catch'](handleError(_0x4c01b2,null));};exports['describe']=function(_0x3116b6,_0x54d5ad){return db[_0xec5f('0x3f')]['describe']()[_0xec5f('0x25')](respondWithResult(_0x54d5ad,null))['catch'](handleError(_0x54d5ad,null));}; \ No newline at end of file +var _0xf98f=['MailTransferReport','rawAttributes','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../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','update','destroy','then','error','stack','name','send','index','map'];(function(_0x305453,_0x54018f){var _0x44e8e3=function(_0x4340e1){while(--_0x4340e1){_0x305453['push'](_0x305453['shift']());}};_0x44e8e3(++_0x54018f);}(_0xf98f,0x17c));var _0xff98=function(_0x59ae4e,_0x4eaa5d){_0x59ae4e=_0x59ae4e-0x0;var _0x2f4f29=_0xf98f[_0x59ae4e];return _0x2f4f29;};'use strict';var emlformat=require(_0xff98('0x0'));var rimraf=require(_0xff98('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff98('0x2'));var rp=require(_0xff98('0x3'));var moment=require(_0xff98('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xff98('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xff98('0x6'));var ejs=require(_0xff98('0x7'));var fs=require('fs');var fs_extra=require(_0xff98('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xff98('0x9'));var jsforce=require(_0xff98('0xa'));var deskjs=require(_0xff98('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xff98('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xff98('0xd'));var as=require(_0xff98('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff98('0xf'))(_0xff98('0x10'));var utils=require(_0xff98('0x11'));var config=require(_0xff98('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xff98('0x13'))['db'];function respondWithStatusCode(_0x531032,_0x56e31e){_0x56e31e=_0x56e31e||0xcc;return function(_0x2b17d3){if(_0x2b17d3){return _0x531032[_0xff98('0x14')](_0x56e31e);}return _0x531032['status'](_0x56e31e)['end']();};}function respondWithResult(_0x2dd5fc,_0x41e4a4){_0x41e4a4=_0x41e4a4||0xc8;return function(_0x5c6830){if(_0x5c6830){return _0x2dd5fc[_0xff98('0x15')](_0x41e4a4)[_0xff98('0x16')](_0x5c6830);}};}function respondWithFilteredResult(_0xb022ed,_0x566410){return function(_0x548dde){if(_0x548dde){var _0x45c2ca=typeof _0x566410[_0xff98('0x17')]===_0xff98('0x18')&&typeof _0x566410[_0xff98('0x19')]===_0xff98('0x18');var _0x2ac20e=_0x548dde[_0xff98('0x1a')];var _0x33b054=_0x45c2ca?0x0:_0x566410[_0xff98('0x17')];var _0x38808e=_0x45c2ca?_0x548dde[_0xff98('0x1a')]:_0x566410[_0xff98('0x17')]+_0x566410[_0xff98('0x19')];var _0x11b916;if(_0x38808e>=_0x2ac20e){_0x38808e=_0x2ac20e;_0x11b916=0xc8;}else{_0x11b916=0xce;}_0xb022ed[_0xff98('0x15')](_0x11b916);return _0xb022ed[_0xff98('0x1b')](_0xff98('0x1c'),_0x33b054+'-'+_0x38808e+'/'+_0x2ac20e)[_0xff98('0x16')](_0x548dde);}return null;};}function patchUpdates(_0x5d74c5){return function(_0x267f88){try{jsonpatch[_0xff98('0x1d')](_0x267f88,_0x5d74c5,!![]);}catch(_0x3cb74e){return BPromise[_0xff98('0x1e')](_0x3cb74e);}return _0x267f88['save']();};}function saveUpdates(_0x162f70,_0x44b1fa){return function(_0x2ef959){if(_0x2ef959){return _0x2ef959[_0xff98('0x1f')](_0x162f70)['then'](function(_0x2c0c16){return _0x2c0c16;});}return null;};}function removeEntity(_0x30c972,_0x17e12a){return function(_0x15a799){if(_0x15a799){return _0x15a799[_0xff98('0x20')]()[_0xff98('0x21')](function(){_0x30c972[_0xff98('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe3ff6,_0x2ca6c1){return function(_0x2937a7){if(!_0x2937a7){_0xe3ff6[_0xff98('0x14')](0x194);}return _0x2937a7;};}function handleError(_0x3e41c9,_0x2c9ed6){_0x2c9ed6=_0x2c9ed6||0x1f4;return function(_0x3bafe1){logger[_0xff98('0x22')](_0x3bafe1[_0xff98('0x23')]);if(_0x3bafe1[_0xff98('0x24')]){delete _0x3bafe1[_0xff98('0x24')];}_0x3e41c9[_0xff98('0x15')](_0x2c9ed6)[_0xff98('0x25')](_0x3bafe1);};}exports[_0xff98('0x26')]=function(_0x319cbe,_0x34fad8){var _0x2839cd={},_0x21feba={},_0x1cafb3={'count':0x0,'rows':[]};var _0x5b4951=_[_0xff98('0x27')](db[_0xff98('0x28')][_0xff98('0x29')],function(_0x465b85){return{'name':_0x465b85['fieldName'],'type':_0x465b85['type']['key']};});_0x21feba[_0xff98('0x2a')]=_[_0xff98('0x27')](_0x5b4951,_0xff98('0x24'));_0x21feba[_0xff98('0x2b')]=_[_0xff98('0x2c')](_0x319cbe[_0xff98('0x2b')]);_0x21feba['filters']=_['intersection'](_0x21feba[_0xff98('0x2a')],_0x21feba[_0xff98('0x2b')]);_0x2839cd['attributes']=_[_0xff98('0x2d')](_0x21feba[_0xff98('0x2a')],qs['fields'](_0x319cbe[_0xff98('0x2b')]['fields']));_0x2839cd[_0xff98('0x2e')]=_0x2839cd['attributes'][_0xff98('0x2f')]?_0x2839cd['attributes']:_0x21feba[_0xff98('0x2a')];if(!_0x319cbe[_0xff98('0x2b')][_0xff98('0x30')](_0xff98('0x31'))){_0x2839cd['limit']=qs[_0xff98('0x19')](_0x319cbe[_0xff98('0x2b')][_0xff98('0x19')]);_0x2839cd[_0xff98('0x17')]=qs[_0xff98('0x17')](_0x319cbe['query'][_0xff98('0x17')]);}_0x2839cd[_0xff98('0x32')]=qs['sort'](_0x319cbe[_0xff98('0x2b')][_0xff98('0x33')]);_0x2839cd[_0xff98('0x34')]=qs[_0xff98('0x35')](_[_0xff98('0x36')](_0x319cbe[_0xff98('0x2b')],_0x21feba[_0xff98('0x35')]),_0x5b4951);if(_0x319cbe[_0xff98('0x2b')][_0xff98('0x37')]){_0x2839cd['where']=_[_0xff98('0x38')](_0x2839cd[_0xff98('0x34')],{'$or':_[_0xff98('0x27')](_0x5b4951,function(_0x13dc18){if(_0x13dc18[_0xff98('0x39')]!==_0xff98('0x3a')){var _0x710721={};_0x710721[_0x13dc18[_0xff98('0x24')]]={'$like':'%'+_0x319cbe[_0xff98('0x2b')][_0xff98('0x37')]+'%'};return _0x710721;}})});}_0x2839cd=_[_0xff98('0x38')]({},_0x2839cd,_0x319cbe[_0xff98('0x3b')]);var _0x1788df={'where':_0x2839cd[_0xff98('0x34')]};return db[_0xff98('0x28')]['count'](_0x1788df)[_0xff98('0x21')](function(_0x52e030){_0x1cafb3[_0xff98('0x1a')]=_0x52e030;if(_0x319cbe[_0xff98('0x2b')][_0xff98('0x3c')]){_0x2839cd[_0xff98('0x3d')]=[{'all':!![]}];}return db[_0xff98('0x28')][_0xff98('0x3e')](_0x2839cd);})[_0xff98('0x21')](function(_0x5effe7){_0x1cafb3[_0xff98('0x3f')]=_0x5effe7;return _0x1cafb3;})[_0xff98('0x21')](respondWithFilteredResult(_0x34fad8,_0x2839cd))[_0xff98('0x40')](handleError(_0x34fad8,null));};exports['show']=function(_0x4f10f5,_0x54711d){var _0x291012={'raw':!![],'where':{'id':_0x4f10f5[_0xff98('0x41')]['id']}},_0x46744c={};_0x46744c[_0xff98('0x2a')]=_[_0xff98('0x2c')](db[_0xff98('0x28')][_0xff98('0x29')]);_0x46744c[_0xff98('0x2b')]=_[_0xff98('0x2c')](_0x4f10f5[_0xff98('0x2b')]);_0x46744c[_0xff98('0x35')]=_[_0xff98('0x2d')](_0x46744c[_0xff98('0x2a')],_0x46744c['query']);_0x291012[_0xff98('0x2e')]=_[_0xff98('0x2d')](_0x46744c[_0xff98('0x2a')],qs['fields'](_0x4f10f5[_0xff98('0x2b')]['fields']));_0x291012[_0xff98('0x2e')]=_0x291012[_0xff98('0x2e')][_0xff98('0x2f')]?_0x291012[_0xff98('0x2e')]:_0x46744c['model'];if(_0x4f10f5[_0xff98('0x2b')][_0xff98('0x3c')]){_0x291012['include']=[{'all':!![]}];}_0x291012=_[_0xff98('0x38')]({},_0x291012,_0x4f10f5[_0xff98('0x3b')]);return db[_0xff98('0x28')][_0xff98('0x42')](_0x291012)[_0xff98('0x21')](handleEntityNotFound(_0x54711d,null))['then'](respondWithResult(_0x54711d,null))[_0xff98('0x40')](handleError(_0x54711d,null));};exports[_0xff98('0x43')]=function(_0x29f3eb,_0x25dfcd){return db[_0xff98('0x28')][_0xff98('0x43')](_0x29f3eb[_0xff98('0x44')],{})['then'](respondWithResult(_0x25dfcd,0xc9))[_0xff98('0x40')](handleError(_0x25dfcd,null));};exports[_0xff98('0x1f')]=function(_0x233ea7,_0x3c36e0){if(_0x233ea7[_0xff98('0x44')]['id']){delete _0x233ea7[_0xff98('0x44')]['id'];}return db[_0xff98('0x28')][_0xff98('0x42')]({'where':{'id':_0x233ea7[_0xff98('0x41')]['id']}})[_0xff98('0x21')](handleEntityNotFound(_0x3c36e0,null))[_0xff98('0x21')](saveUpdates(_0x233ea7['body'],null))['then'](respondWithResult(_0x3c36e0,null))[_0xff98('0x40')](handleError(_0x3c36e0,null));};exports[_0xff98('0x20')]=function(_0x560bdf,_0x14b736){return db['MailTransferReport']['find']({'where':{'id':_0x560bdf[_0xff98('0x41')]['id']}})[_0xff98('0x21')](handleEntityNotFound(_0x14b736,null))['then'](removeEntity(_0x14b736,null))[_0xff98('0x40')](handleError(_0x14b736,null));};exports[_0xff98('0x45')]=function(_0x30d6d9,_0x4dc1df){return db['MailTransferReport'][_0xff98('0x45')]()[_0xff98('0x21')](respondWithResult(_0x4dc1df,null))[_0xff98('0x40')](handleError(_0x4dc1df,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 514f69f..8858458 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 _0x8a28=['path','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x8a28,0xfd));var _0x88a2=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x8a28[_0x3e112d];return _0x531c31;};'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':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x88a2('0xc'),'fields':[_0x88a2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc70b=['MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','exports','define'];(function(_0x3c9731,_0x2dba2a){var _0x10a163=function(_0x6c9317){while(--_0x6c9317){_0x3c9731['push'](_0x3c9731['shift']());}};_0x10a163(++_0x2dba2a);}(_0xc70b,0x13b));var _0xbc70=function(_0xd89190,_0x59b801){_0xd89190=_0xd89190-0x0;var _0x5aec56=_0xc70b[_0xd89190];return _0x5aec56;};'use strict';var _=require(_0xbc70('0x0'));var util=require('util');var logger=require(_0xbc70('0x1'))('api');var moment=require(_0xbc70('0x2'));var BPromise=require(_0xbc70('0x3'));var rp=require(_0xbc70('0x4'));var fs=require('fs');var path=require(_0xbc70('0x5'));var rimraf=require(_0xbc70('0x6'));var config=require('../../config/environment');var attributes=require(_0xbc70('0x7'));module[_0xbc70('0x8')]=function(_0x3722cd,_0x3a29ec){return _0x3722cd[_0xbc70('0x9')](_0xbc70('0xa'),attributes,{'tableName':_0xbc70('0xb'),'paranoid':![],'indexes':[{'name':_0xbc70('0xc'),'fields':[_0xbc70('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index b9bb738..98c15af 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 _0xfcda=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1739f5,_0x500140){var _0x4d556b=function(_0x12729f){while(--_0x12729f){_0x1739f5['push'](_0x1739f5['shift']());}};_0x4d556b(++_0x500140);}(_0xfcda,0x1c6));var _0xafcd=function(_0x211f6a,_0x1a2e20){_0x211f6a=_0x211f6a-0x0;var _0x3aaff0=_0xfcda[_0x211f6a];return _0x3aaff0;};'use strict';var _=require(_0xafcd('0x0'));var util=require(_0xafcd('0x1'));var moment=require('moment');var BPromise=require(_0xafcd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafcd('0x3'));var db=require(_0xafcd('0x4'))['db'];var utils=require(_0xafcd('0x5'));var logger=require(_0xafcd('0x6'))(_0xafcd('0x7'));var config=require(_0xafcd('0x8'));var jayson=require(_0xafcd('0x9'));var client=jayson['client'][_0xafcd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcc2439,_0x26c800,_0xea1814){return new BPromise(function(_0x23d9ea,_0x43f6a8){return client['request'](_0xcc2439,_0xea1814)[_0xafcd('0xb')](function(_0x2a5f85){logger[_0xafcd('0xc')](_0xafcd('0xd'),_0x26c800,_0xafcd('0xe'));logger[_0xafcd('0xf')](_0xafcd('0x10'),_0x26c800,_0xafcd('0xe'),JSON[_0xafcd('0x11')](_0x2a5f85));if(_0x2a5f85[_0xafcd('0x12')]){if(_0x2a5f85[_0xafcd('0x12')][_0xafcd('0x13')]===0x1f4){logger[_0xafcd('0x12')](_0xafcd('0xd'),_0x26c800,_0x2a5f85['error'][_0xafcd('0x14')]);return _0x43f6a8(_0x2a5f85[_0xafcd('0x12')]['message']);}logger[_0xafcd('0x12')](_0xafcd('0xd'),_0x26c800,_0x2a5f85[_0xafcd('0x12')]['message']);return _0x23d9ea(_0x2a5f85[_0xafcd('0x12')][_0xafcd('0x14')]);}else{logger[_0xafcd('0xc')](_0xafcd('0xd'),_0x26c800,'request\x20sent');_0x23d9ea(_0x2a5f85[_0xafcd('0x15')][_0xafcd('0x14')]);}})[_0xafcd('0x16')](function(_0x119af8){logger[_0xafcd('0x12')](_0xafcd('0xd'),_0x26c800,_0x119af8);_0x43f6a8(_0x119af8);});});} \ No newline at end of file +var _0x4999=['MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x4999,0x11d));var _0x9499=function(_0x4cd226,_0x489a22){_0x4cd226=_0x4cd226-0x0;var _0x19c008=_0x4999[_0x4cd226];return _0x19c008;};'use strict';var _=require('lodash');var util=require(_0x9499('0x0'));var moment=require(_0x9499('0x1'));var BPromise=require(_0x9499('0x2'));var rs=require(_0x9499('0x3'));var fs=require('fs');var Redis=require(_0x9499('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9499('0x5'));var logger=require(_0x9499('0x6'))(_0x9499('0x7'));var config=require(_0x9499('0x8'));var jayson=require(_0x9499('0x9'));var client=jayson[_0x9499('0xa')][_0x9499('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b1730,_0x324d68,_0x22d2e8){return new BPromise(function(_0x30673c,_0x4883c3){return client[_0x9499('0xc')](_0x1b1730,_0x22d2e8)[_0x9499('0xd')](function(_0x361b81){logger[_0x9499('0xe')](_0x9499('0xf'),_0x324d68,_0x9499('0x10'));logger[_0x9499('0x11')](_0x9499('0x12'),_0x324d68,_0x9499('0x10'),JSON[_0x9499('0x13')](_0x361b81));if(_0x361b81[_0x9499('0x14')]){if(_0x361b81['error'][_0x9499('0x15')]===0x1f4){logger[_0x9499('0x14')](_0x9499('0xf'),_0x324d68,_0x361b81[_0x9499('0x14')][_0x9499('0x16')]);return _0x4883c3(_0x361b81[_0x9499('0x14')][_0x9499('0x16')]);}logger[_0x9499('0x14')](_0x9499('0xf'),_0x324d68,_0x361b81['error']['message']);return _0x30673c(_0x361b81[_0x9499('0x14')][_0x9499('0x16')]);}else{logger[_0x9499('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x324d68,_0x9499('0x10'));_0x30673c(_0x361b81[_0x9499('0x17')]['message']);}})[_0x9499('0x18')](function(_0x2d4943){logger[_0x9499('0x14')](_0x9499('0xf'),_0x324d68,_0x2d4943);_0x4883c3(_0x2d4943);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 66c5141..dc1fe38 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 _0x95d0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./memberReport.controller','get','/describe','isAuthenticated','describe','show','put','/:id','update','delete','destroy','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x95d0,0x10f));var _0x095d=function(_0x25d95a,_0x3ff226){_0x25d95a=_0x25d95a-0x0;var _0xc596b7=_0x95d0[_0x25d95a];return _0xc596b7;};'use strict';var multer=require('multer');var util=require(_0x095d('0x0'));var path=require('path');var timeout=require(_0x095d('0x1'));var express=require(_0x095d('0x2'));var router=express[_0x095d('0x3')]();var fs_extra=require(_0x095d('0x4'));var auth=require(_0x095d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x095d('0x6'));router[_0x095d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x095d('0x7')](_0x095d('0x8'),auth[_0x095d('0x9')](),controller[_0x095d('0xa')]);router[_0x095d('0x7')]('/:id',auth[_0x095d('0x9')](),controller[_0x095d('0xb')]);router['post']('/',auth[_0x095d('0x9')](),controller['create']);router[_0x095d('0xc')](_0x095d('0xd'),auth[_0x095d('0x9')](),controller[_0x095d('0xe')]);router[_0x095d('0xf')](_0x095d('0xd'),auth[_0x095d('0x9')](),controller[_0x095d('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9feb=['delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update'];(function(_0x1e16b4,_0x1ff1ce){var _0xe828a8=function(_0x37187f){while(--_0x37187f){_0x1e16b4['push'](_0x1e16b4['shift']());}};_0xe828a8(++_0x1ff1ce);}(_0x9feb,0x192));var _0xb9fe=function(_0x25738b,_0x4c5218){_0x25738b=_0x25738b-0x0;var _0x4a8d51=_0x9feb[_0x25738b];return _0x4a8d51;};'use strict';var multer=require('multer');var util=require(_0xb9fe('0x0'));var path=require('path');var timeout=require(_0xb9fe('0x1'));var express=require('express');var router=express[_0xb9fe('0x2')]();var fs_extra=require(_0xb9fe('0x3'));var auth=require(_0xb9fe('0x4'));var interaction=require(_0xb9fe('0x5'));var config=require(_0xb9fe('0x6'));var controller=require(_0xb9fe('0x7'));router[_0xb9fe('0x8')]('/',auth[_0xb9fe('0x9')](),controller[_0xb9fe('0xa')]);router['get'](_0xb9fe('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xb9fe('0x8')](_0xb9fe('0xc'),auth['isAuthenticated'](),controller[_0xb9fe('0xd')]);router[_0xb9fe('0xe')]('/',auth[_0xb9fe('0x9')](),controller[_0xb9fe('0xf')]);router[_0xb9fe('0x10')](_0xb9fe('0xc'),auth['isAuthenticated'](),controller[_0xb9fe('0x11')]);router[_0xb9fe('0x12')]('/:id',auth[_0xb9fe('0x9')](),controller[_0xb9fe('0x13')]);module[_0xb9fe('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 86b0b97..9edb73e 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 _0xb51c=['seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xb51c,0x1a9));var _0xcb51=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xb51c[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require(_0xcb51('0x0'));var moment=require(_0xcb51('0x1'));module[_0xcb51('0x2')]={'channel':{'type':Sequelize[_0xcb51('0x3')]},'membername':{'type':Sequelize[_0xcb51('0x3')]},'interface':{'type':Sequelize[_0xcb51('0x3')]},'type':{'type':Sequelize[_0xcb51('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xcb51('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xcb51('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x1e7943){var _0x32c490=moment(_0x1e7943);var _0x356ca7=moment(this[_0xcb51('0x6')]('enterAt'));var _0x3c35ac=_0x32c490['diff'](_0x356ca7,_0xcb51('0x7'));this[_0xcb51('0x8')](_0xcb51('0x9'),_0x1e7943);this[_0xcb51('0x8')](_0xcb51('0xa'),_0x3c35ac>=0x0?_0x3c35ac:null);}},'data1':{'type':Sequelize[_0xcb51('0x3')],'comment':_0xcb51('0xb')},'data2':{'type':Sequelize[_0xcb51('0x3')],'comment':_0xcb51('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0xcb51('0xd')},'data4':{'type':Sequelize[_0xcb51('0x3')],'comment':_0xcb51('0xe')},'data5':{'type':Sequelize[_0xcb51('0x3')],'comment':_0xcb51('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xcb51('0x3')]}}; \ No newline at end of file +var _0x9ac2=['INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x51652a,_0x5144fc){var _0xae7099=function(_0x4b239b){while(--_0x4b239b){_0x51652a['push'](_0x51652a['shift']());}};_0xae7099(++_0x5144fc);}(_0x9ac2,0x14a));var _0x29ac=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x9ac2[_0x2f87cd];return _0x5d7eda;};'use strict';var Sequelize=require(_0x29ac('0x0'));var moment=require(_0x29ac('0x1'));module[_0x29ac('0x2')]={'channel':{'type':Sequelize[_0x29ac('0x3')]},'membername':{'type':Sequelize[_0x29ac('0x3')]},'interface':{'type':Sequelize[_0x29ac('0x3')]},'type':{'type':Sequelize[_0x29ac('0x3')],'defaultValue':_0x29ac('0x4'),'comment':_0x29ac('0x5')},'duration':{'type':Sequelize[_0x29ac('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x29ac('0x7')],'set':function(_0x5edd6b){var _0x4d8248=moment(_0x5edd6b);var _0x440e88=moment(this[_0x29ac('0x8')](_0x29ac('0x9')));var _0x46e3f9=_0x4d8248[_0x29ac('0xa')](_0x440e88,_0x29ac('0xb'));this[_0x29ac('0xc')]('exitAt',_0x5edd6b);this[_0x29ac('0xc')](_0x29ac('0xd'),_0x46e3f9>=0x0?_0x46e3f9:null);}},'data1':{'type':Sequelize[_0x29ac('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x29ac('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x29ac('0x3')],'comment':_0x29ac('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0x29ac('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 0d40df4..0f4045b 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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x21bc74,_0x42fcc5){var _0x30f788=function(_0x36bd51){while(--_0x36bd51){_0x21bc74['push'](_0x21bc74['shift']());}};_0x30f788(++_0x42fcc5);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x55ca,0x126));var _0xa55c=function(_0x1aec28,_0x556b6f){_0x1aec28=_0x1aec28-0x0;var _0x2398c7=_0x55ca[_0x1aec28];return _0x2398c7;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index f3154cf..869dcce 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 _0x7f59=['MemberReport','report_member','membername_interface','interface','util','api','moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','define'];(function(_0x145cef,_0x2c6ddc){var _0xb94a4e=function(_0x102872){while(--_0x102872){_0x145cef['push'](_0x145cef['shift']());}};_0xb94a4e(++_0x2c6ddc);}(_0x7f59,0x156));var _0x97f5=function(_0x368059,_0x1e2756){_0x368059=_0x368059-0x0;var _0x3d5341=_0x7f59[_0x368059];return _0x3d5341;};'use strict';var _=require('lodash');var util=require(_0x97f5('0x0'));var logger=require('../../config/logger')(_0x97f5('0x1'));var moment=require(_0x97f5('0x2'));var BPromise=require(_0x97f5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x97f5('0x4'));var rimraf=require(_0x97f5('0x5'));var config=require(_0x97f5('0x6'));var attributes=require(_0x97f5('0x7'));module['exports']=function(_0x22854f,_0x52396c){return _0x22854f[_0x97f5('0x8')](_0x97f5('0x9'),attributes,{'tableName':_0x97f5('0xa'),'paranoid':![],'indexes':[{'name':_0x97f5('0xb'),'fields':['membername',_0x97f5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf47e=['moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','api'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xf47e,0x1bf));var _0xef47=function(_0x4f8093,_0x334a57){_0x4f8093=_0x4f8093-0x0;var _0x22278b=_0xf47e[_0x4f8093];return _0x22278b;};'use strict';var _=require(_0xef47('0x0'));var util=require(_0xef47('0x1'));var logger=require('../../config/logger')(_0xef47('0x2'));var moment=require(_0xef47('0x3'));var BPromise=require(_0xef47('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef47('0x5'));var rimraf=require(_0xef47('0x6'));var config=require(_0xef47('0x7'));var attributes=require(_0xef47('0x8'));module['exports']=function(_0x3628e5,_0x1453a0){return _0x3628e5[_0xef47('0x9')](_0xef47('0xa'),attributes,{'tableName':_0xef47('0xb'),'paranoid':![],'indexes':[{'name':_0xef47('0xc'),'fields':[_0xef47('0xd'),_0xef47('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index ebe21b9..ee91900 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 _0xd663=['MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetMemberReport','MemberReport','findAll','options','raw','where','limit','include','map','model','attributes','CreateMemberReport','create','body','stringify','UpdateMemberReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','then','info'];(function(_0x300739,_0x5d19a9){var _0x92499d=function(_0xa3ee20){while(--_0xa3ee20){_0x300739['push'](_0x300739['shift']());}};_0x92499d(++_0x5d19a9);}(_0xd663,0x1ed));var _0x3d66=function(_0x4b9864,_0x1f1c8d){_0x4b9864=_0x4b9864-0x0;var _0x4aeb18=_0xd663[_0x4b9864];return _0x4aeb18;};'use strict';var _=require(_0x3d66('0x0'));var util=require(_0x3d66('0x1'));var moment=require('moment');var BPromise=require(_0x3d66('0x2'));var rs=require(_0x3d66('0x3'));var fs=require('fs');var Redis=require(_0x3d66('0x4'));var db=require(_0x3d66('0x5'))['db'];var utils=require(_0x3d66('0x6'));var logger=require('../../config/logger')(_0x3d66('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2783f6,_0x4ad571,_0x50a1aa){return new BPromise(function(_0x3b6a81,_0x10a510){return client[_0x3d66('0x8')](_0x2783f6,_0x50a1aa)[_0x3d66('0x9')](function(_0x8cc498){logger[_0x3d66('0xa')](_0x3d66('0xb'),_0x4ad571,'request\x20sent');logger[_0x3d66('0xc')](_0x3d66('0xd'),_0x4ad571,_0x3d66('0xe'),JSON['stringify'](_0x8cc498));if(_0x8cc498[_0x3d66('0xf')]){if(_0x8cc498[_0x3d66('0xf')][_0x3d66('0x10')]===0x1f4){logger['error'](_0x3d66('0xb'),_0x4ad571,_0x8cc498[_0x3d66('0xf')][_0x3d66('0x11')]);return _0x10a510(_0x8cc498[_0x3d66('0xf')]['message']);}logger[_0x3d66('0xf')]('MemberReport,\x20%s,\x20%s',_0x4ad571,_0x8cc498[_0x3d66('0xf')][_0x3d66('0x11')]);return _0x3b6a81(_0x8cc498[_0x3d66('0xf')][_0x3d66('0x11')]);}else{logger[_0x3d66('0xa')](_0x3d66('0xb'),_0x4ad571,'request\x20sent');_0x3b6a81(_0x8cc498['result'][_0x3d66('0x11')]);}})[_0x3d66('0x12')](function(_0x4bd10f){logger[_0x3d66('0xf')](_0x3d66('0xb'),_0x4ad571,_0x4bd10f);_0x10a510(_0x4bd10f);});});}exports[_0x3d66('0x13')]=function(_0x1dfd81){var _0xe13f0f=this;return new Promise(function(_0x239ffb,_0x133cb8){return db[_0x3d66('0x14')][_0x3d66('0x15')]({'raw':_0x1dfd81[_0x3d66('0x16')]?_0x1dfd81[_0x3d66('0x16')][_0x3d66('0x17')]===undefined?!![]:![]:!![],'where':_0x1dfd81[_0x3d66('0x16')]?_0x1dfd81[_0x3d66('0x16')][_0x3d66('0x18')]||null:null,'attributes':_0x1dfd81['options']?_0x1dfd81[_0x3d66('0x16')]['attributes']||null:null,'limit':_0x1dfd81[_0x3d66('0x16')]?_0x1dfd81[_0x3d66('0x16')][_0x3d66('0x19')]||null:null,'include':_0x1dfd81[_0x3d66('0x16')]?_0x1dfd81[_0x3d66('0x16')][_0x3d66('0x1a')]?_[_0x3d66('0x1b')](_0x1dfd81[_0x3d66('0x16')][_0x3d66('0x1a')],function(_0x4e2c42){return{'model':db[_0x4e2c42[_0x3d66('0x1c')]],'as':_0x4e2c42['as'],'attributes':_0x4e2c42[_0x3d66('0x1d')],'include':_0x4e2c42[_0x3d66('0x1a')]?_[_0x3d66('0x1b')](_0x4e2c42['include'],function(_0x59fe0a){return{'model':db[_0x59fe0a[_0x3d66('0x1c')]],'as':_0x59fe0a['as'],'attributes':_0x59fe0a[_0x3d66('0x1d')],'include':_0x59fe0a[_0x3d66('0x1a')]?_['map'](_0x59fe0a[_0x3d66('0x1a')],function(_0x3e6712){return{'model':db[_0x3e6712[_0x3d66('0x1c')]],'as':_0x3e6712['as'],'attributes':_0x3e6712[_0x3d66('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3d66('0x9')](function(_0x77dc85){logger[_0x3d66('0xa')](_0x3d66('0x13'),_0x1dfd81);logger[_0x3d66('0xc')](_0x3d66('0x13'),_0x1dfd81,JSON['stringify'](_0x77dc85));_0x239ffb(_0x77dc85);})[_0x3d66('0x12')](function(_0x1dff3b){logger[_0x3d66('0xf')](_0x3d66('0x13'),_0x1dff3b[_0x3d66('0x11')],_0x1dfd81);_0x133cb8(_0xe13f0f[_0x3d66('0xf')](0x1f4,_0x1dff3b[_0x3d66('0x11')]));});});};exports[_0x3d66('0x1e')]=function(_0x3044f2){var _0xab45d5=this;return new Promise(function(_0x2fbff5,_0x5f4221){return db['MemberReport'][_0x3d66('0x1f')](_0x3044f2[_0x3d66('0x20')],{'raw':_0x3044f2[_0x3d66('0x16')]?_0x3044f2[_0x3d66('0x16')][_0x3d66('0x17')]===undefined?!![]:![]:!![]})[_0x3d66('0x9')](function(_0x248b5a){logger[_0x3d66('0xa')](_0x3d66('0x1e'),_0x3044f2);logger[_0x3d66('0xc')](_0x3d66('0x1e'),_0x3044f2,JSON[_0x3d66('0x21')](_0x248b5a));_0x2fbff5(_0x248b5a);})[_0x3d66('0x12')](function(_0x216f36){logger[_0x3d66('0xf')](_0x3d66('0x1e'),_0x216f36[_0x3d66('0x11')],_0x3044f2);_0x5f4221(_0xab45d5[_0x3d66('0xf')](0x1f4,_0x216f36[_0x3d66('0x11')]));});});};exports[_0x3d66('0x22')]=function(_0x44874c){var _0x13bd16=this;return new Promise(function(_0x443d0c,_0x5b08a5){return db[_0x3d66('0x14')][_0x3d66('0x23')](_0x44874c[_0x3d66('0x20')],{'raw':_0x44874c['options']?_0x44874c[_0x3d66('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44874c[_0x3d66('0x16')]?_0x44874c[_0x3d66('0x16')]['where']||null:null,'attributes':_0x44874c[_0x3d66('0x16')]?_0x44874c[_0x3d66('0x16')]['attributes']||null:null,'limit':_0x44874c[_0x3d66('0x16')]?_0x44874c[_0x3d66('0x16')]['limit']||null:null})[_0x3d66('0x9')](function(_0x20c924){logger[_0x3d66('0xa')](_0x3d66('0x22'),_0x44874c);logger['debug'](_0x3d66('0x22'),_0x44874c,JSON['stringify'](_0x20c924));_0x443d0c(_0x20c924);})[_0x3d66('0x12')](function(_0x533f23){logger[_0x3d66('0xf')](_0x3d66('0x22'),_0x533f23[_0x3d66('0x11')],_0x44874c);_0x5b08a5(_0x13bd16['error'](0x1f4,_0x533f23[_0x3d66('0x11')]));});});}; \ No newline at end of file +var _0x74f3=['options','where','limit','include','map','model','attributes','then','CreateMemberReport','create','UpdateMemberReport','MemberReport','update','body','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMemberReport','findAll'];(function(_0x516d17,_0x33afaf){var _0x841c1d=function(_0xdcac6c){while(--_0xdcac6c){_0x516d17['push'](_0x516d17['shift']());}};_0x841c1d(++_0x33afaf);}(_0x74f3,0x164));var _0x374f=function(_0x5e73de,_0x48194d){_0x5e73de=_0x5e73de-0x0;var _0x1b1f6b=_0x74f3[_0x5e73de];return _0x1b1f6b;};'use strict';var _=require(_0x374f('0x0'));var util=require(_0x374f('0x1'));var moment=require(_0x374f('0x2'));var BPromise=require('bluebird');var rs=require(_0x374f('0x3'));var fs=require('fs');var Redis=require(_0x374f('0x4'));var db=require(_0x374f('0x5'))['db'];var utils=require(_0x374f('0x6'));var logger=require('../../config/logger')(_0x374f('0x7'));var config=require(_0x374f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x374f('0x9')][_0x374f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x405e93,_0x407df1,_0x3bcc86){return new BPromise(function(_0x394073,_0x32861f){return client[_0x374f('0xb')](_0x405e93,_0x3bcc86)['then'](function(_0x2b0d45){logger[_0x374f('0xc')](_0x374f('0xd'),_0x407df1,_0x374f('0xe'));logger[_0x374f('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x407df1,_0x374f('0xe'),JSON[_0x374f('0x10')](_0x2b0d45));if(_0x2b0d45['error']){if(_0x2b0d45[_0x374f('0x11')][_0x374f('0x12')]===0x1f4){logger[_0x374f('0x11')]('MemberReport,\x20%s,\x20%s',_0x407df1,_0x2b0d45[_0x374f('0x11')][_0x374f('0x13')]);return _0x32861f(_0x2b0d45['error'][_0x374f('0x13')]);}logger[_0x374f('0x11')]('MemberReport,\x20%s,\x20%s',_0x407df1,_0x2b0d45[_0x374f('0x11')]['message']);return _0x394073(_0x2b0d45[_0x374f('0x11')][_0x374f('0x13')]);}else{logger[_0x374f('0xc')](_0x374f('0xd'),_0x407df1,_0x374f('0xe'));_0x394073(_0x2b0d45[_0x374f('0x14')][_0x374f('0x13')]);}})[_0x374f('0x15')](function(_0x250e33){logger[_0x374f('0x11')](_0x374f('0xd'),_0x407df1,_0x250e33);_0x32861f(_0x250e33);});});}exports[_0x374f('0x16')]=function(_0x13c210){var _0x58cdc5=this;return new Promise(function(_0x55eb4f,_0xac879a){return db['MemberReport'][_0x374f('0x17')]({'raw':_0x13c210[_0x374f('0x18')]?_0x13c210[_0x374f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x13c210[_0x374f('0x18')]?_0x13c210['options'][_0x374f('0x19')]||null:null,'attributes':_0x13c210[_0x374f('0x18')]?_0x13c210[_0x374f('0x18')]['attributes']||null:null,'limit':_0x13c210[_0x374f('0x18')]?_0x13c210['options'][_0x374f('0x1a')]||null:null,'include':_0x13c210[_0x374f('0x18')]?_0x13c210[_0x374f('0x18')][_0x374f('0x1b')]?_[_0x374f('0x1c')](_0x13c210[_0x374f('0x18')]['include'],function(_0x4d7ccf){return{'model':db[_0x4d7ccf[_0x374f('0x1d')]],'as':_0x4d7ccf['as'],'attributes':_0x4d7ccf[_0x374f('0x1e')],'include':_0x4d7ccf[_0x374f('0x1b')]?_['map'](_0x4d7ccf['include'],function(_0x2d13e4){return{'model':db[_0x2d13e4['model']],'as':_0x2d13e4['as'],'attributes':_0x2d13e4['attributes'],'include':_0x2d13e4['include']?_['map'](_0x2d13e4[_0x374f('0x1b')],function(_0x253239){return{'model':db[_0x253239['model']],'as':_0x253239['as'],'attributes':_0x253239[_0x374f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x374f('0x1f')](function(_0x1ef2c9){logger[_0x374f('0xc')]('GetMemberReport',_0x13c210);logger[_0x374f('0xf')](_0x374f('0x16'),_0x13c210,JSON[_0x374f('0x10')](_0x1ef2c9));_0x55eb4f(_0x1ef2c9);})[_0x374f('0x15')](function(_0x2a21d6){logger[_0x374f('0x11')](_0x374f('0x16'),_0x2a21d6[_0x374f('0x13')],_0x13c210);_0xac879a(_0x58cdc5[_0x374f('0x11')](0x1f4,_0x2a21d6[_0x374f('0x13')]));});});};exports[_0x374f('0x20')]=function(_0x2b86e7){var _0x5614a0=this;return new Promise(function(_0x197746,_0x6a58da){return db['MemberReport'][_0x374f('0x21')](_0x2b86e7['body'],{'raw':_0x2b86e7[_0x374f('0x18')]?_0x2b86e7[_0x374f('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x374f('0x1f')](function(_0x559794){logger[_0x374f('0xc')](_0x374f('0x20'),_0x2b86e7);logger[_0x374f('0xf')]('CreateMemberReport',_0x2b86e7,JSON[_0x374f('0x10')](_0x559794));_0x197746(_0x559794);})[_0x374f('0x15')](function(_0x2dab12){logger[_0x374f('0x11')]('CreateMemberReport',_0x2dab12[_0x374f('0x13')],_0x2b86e7);_0x6a58da(_0x5614a0[_0x374f('0x11')](0x1f4,_0x2dab12['message']));});});};exports[_0x374f('0x22')]=function(_0x4c1d04){var _0x5af952=this;return new Promise(function(_0x482e25,_0x1b84ac){return db[_0x374f('0x23')][_0x374f('0x24')](_0x4c1d04[_0x374f('0x25')],{'raw':_0x4c1d04[_0x374f('0x18')]?_0x4c1d04[_0x374f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c1d04[_0x374f('0x18')]?_0x4c1d04['options']['where']||null:null,'attributes':_0x4c1d04[_0x374f('0x18')]?_0x4c1d04['options'][_0x374f('0x1e')]||null:null,'limit':_0x4c1d04['options']?_0x4c1d04['options'][_0x374f('0x1a')]||null:null})[_0x374f('0x1f')](function(_0x19d7a5){logger[_0x374f('0xc')](_0x374f('0x22'),_0x4c1d04);logger[_0x374f('0xf')](_0x374f('0x22'),_0x4c1d04,JSON[_0x374f('0x10')](_0x19d7a5));_0x482e25(_0x19d7a5);})['catch'](function(_0x3b20b5){logger['error'](_0x374f('0x22'),_0x3b20b5[_0x374f('0x13')],_0x4c1d04);_0x1b84ac(_0x5af952['error'](0x1f4,_0x3b20b5[_0x374f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 3f38112..e6f24f0 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 _0x54bd=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get'];(function(_0x3816c2,_0xb221e1){var _0x144669=function(_0x149c29){while(--_0x149c29){_0x3816c2['push'](_0x3816c2['shift']());}};_0x144669(++_0xb221e1);}(_0x54bd,0x177));var _0xd54b=function(_0x15a52b,_0x520feb){_0x15a52b=_0x15a52b-0x0;var _0x2de4e7=_0x54bd[_0x15a52b];return _0x2de4e7;};'use strict';var multer=require(_0xd54b('0x0'));var util=require(_0xd54b('0x1'));var path=require('path');var timeout=require(_0xd54b('0x2'));var express=require(_0xd54b('0x3'));var router=express[_0xd54b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd54b('0x5'));var interaction=require(_0xd54b('0x6'));var config=require(_0xd54b('0x7'));var controller=require(_0xd54b('0x8'));router[_0xd54b('0x9')]('/',controller['index']);module[_0xd54b('0xa')]=router; \ No newline at end of file +var _0x0b31=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x33c37f,_0x4b1c05){var _0x5a2f8f=function(_0x3a6c63){while(--_0x3a6c63){_0x33c37f['push'](_0x33c37f['shift']());}};_0x5a2f8f(++_0x4b1c05);}(_0x0b31,0x1a2));var _0x10b3=function(_0x83600c,_0x4d0ec8){_0x83600c=_0x83600c-0x0;var _0x1c0e6a=_0x0b31[_0x83600c];return _0x1c0e6a;};'use strict';var multer=require(_0x10b3('0x0'));var util=require(_0x10b3('0x1'));var path=require(_0x10b3('0x2'));var timeout=require('connect-timeout');var express=require(_0x10b3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x10b3('0x4'));var interaction=require(_0x10b3('0x5'));var config=require(_0x10b3('0x6'));var controller=require(_0x10b3('0x7'));router[_0x10b3('0x8')]('/',controller[_0x10b3('0x9')]);module[_0x10b3('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index adf1720..03d92d8 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 _0xf50c=['version'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0xf50c,0x18f));var _0xcf50=function(_0x5d279b,_0x350959){_0x5d279b=_0x5d279b-0x0;var _0x2e53f8=_0xf50c[_0x5d279b];return _0x2e53f8;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0xcf50('0x0')}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'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 c826ce8..4c17bd1 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 _0xb044=['filters','pick','filter','merge','options','includeAll','findAll','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','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/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','name','send','index','map','Migration','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x1d6000,_0x3b26eb){var _0x2dfb35=function(_0xa29d81){while(--_0xa29d81){_0x1d6000['push'](_0x1d6000['shift']());}};_0x2dfb35(++_0x3b26eb);}(_0xb044,0x83));var _0x4b04=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xb044[_0x51020b];return _0x371e47;};'use strict';var emlformat=require(_0x4b04('0x0'));var rimraf=require(_0x4b04('0x1'));var zipdir=require(_0x4b04('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4b04('0x3'));var BPromise=require(_0x4b04('0x4'));var Mustache=require('mustache');var util=require(_0x4b04('0x5'));var path=require('path');var sox=require(_0x4b04('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b04('0x7'));var _=require(_0x4b04('0x8'));var squel=require(_0x4b04('0x9'));var crypto=require(_0x4b04('0xa'));var jsforce=require(_0x4b04('0xb'));var deskjs=require(_0x4b04('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4b04('0xd'));var Papa=require('papaparse');var Redis=require(_0x4b04('0xe'));var authService=require(_0x4b04('0xf'));var qs=require(_0x4b04('0x10'));var as=require(_0x4b04('0x11'));var hardwareService=require(_0x4b04('0x12'));var logger=require(_0x4b04('0x13'))('api');var utils=require(_0x4b04('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4b04('0x15'));var db=require(_0x4b04('0x16'))['db'];function respondWithStatusCode(_0x3662b2,_0x3bb143){_0x3bb143=_0x3bb143||0xcc;return function(_0x9c35ff){if(_0x9c35ff){return _0x3662b2[_0x4b04('0x17')](_0x3bb143);}return _0x3662b2[_0x4b04('0x18')](_0x3bb143)['end']();};}function respondWithResult(_0x9296b0,_0x519b72){_0x519b72=_0x519b72||0xc8;return function(_0x4e7172){if(_0x4e7172){return _0x9296b0[_0x4b04('0x18')](_0x519b72)[_0x4b04('0x19')](_0x4e7172);}};}function respondWithFilteredResult(_0x3a9d93,_0x23342e){return function(_0x4889d6){if(_0x4889d6){var _0x472e2e=typeof _0x23342e[_0x4b04('0x1a')]===_0x4b04('0x1b')&&typeof _0x23342e[_0x4b04('0x1c')]===_0x4b04('0x1b');var _0x281486=_0x4889d6[_0x4b04('0x1d')];var _0x597384=_0x472e2e?0x0:_0x23342e[_0x4b04('0x1a')];var _0x4c882c=_0x472e2e?_0x4889d6[_0x4b04('0x1d')]:_0x23342e[_0x4b04('0x1a')]+_0x23342e['limit'];var _0x48afe6;if(_0x4c882c>=_0x281486){_0x4c882c=_0x281486;_0x48afe6=0xc8;}else{_0x48afe6=0xce;}_0x3a9d93[_0x4b04('0x18')](_0x48afe6);return _0x3a9d93[_0x4b04('0x1e')]('Content-Range',_0x597384+'-'+_0x4c882c+'/'+_0x281486)[_0x4b04('0x19')](_0x4889d6);}return null;};}function patchUpdates(_0x401d1c){return function(_0x6d9ea8){try{jsonpatch[_0x4b04('0x1f')](_0x6d9ea8,_0x401d1c,!![]);}catch(_0x55a22b){return BPromise[_0x4b04('0x20')](_0x55a22b);}return _0x6d9ea8[_0x4b04('0x21')]();};}function saveUpdates(_0x57397b,_0x165efb){return function(_0x775346){if(_0x775346){return _0x775346[_0x4b04('0x22')](_0x57397b)[_0x4b04('0x23')](function(_0x44d491){return _0x44d491;});}return null;};}function removeEntity(_0x2b8252,_0x218b20){return function(_0x393fc8){if(_0x393fc8){return _0x393fc8[_0x4b04('0x24')]()[_0x4b04('0x23')](function(){_0x2b8252[_0x4b04('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2281c0,_0x5066c8){return function(_0x1a86e2){if(!_0x1a86e2){_0x2281c0[_0x4b04('0x17')](0x194);}return _0x1a86e2;};}function handleError(_0x3c39e9,_0x11f63c){_0x11f63c=_0x11f63c||0x1f4;return function(_0x22770f){logger['error'](_0x22770f['stack']);if(_0x22770f[_0x4b04('0x25')]){delete _0x22770f[_0x4b04('0x25')];}_0x3c39e9[_0x4b04('0x18')](_0x11f63c)[_0x4b04('0x26')](_0x22770f);};}exports[_0x4b04('0x27')]=function(_0x4f934b,_0x1a81a4){var _0x57560e={},_0x5c2804={},_0x2553ee={'count':0x0,'rows':[]};var _0x194684=_[_0x4b04('0x28')](db[_0x4b04('0x29')]['rawAttributes'],function(_0x35a847){return{'name':_0x35a847[_0x4b04('0x2a')],'type':_0x35a847[_0x4b04('0x2b')]['key']};});_0x5c2804[_0x4b04('0x2c')]=_[_0x4b04('0x28')](_0x194684,_0x4b04('0x25'));_0x5c2804[_0x4b04('0x2d')]=_[_0x4b04('0x2e')](_0x4f934b['query']);_0x5c2804['filters']=_[_0x4b04('0x2f')](_0x5c2804[_0x4b04('0x2c')],_0x5c2804[_0x4b04('0x2d')]);_0x57560e[_0x4b04('0x30')]=_['intersection'](_0x5c2804['model'],qs[_0x4b04('0x31')](_0x4f934b[_0x4b04('0x2d')][_0x4b04('0x31')]));_0x57560e[_0x4b04('0x30')]=_0x57560e[_0x4b04('0x30')][_0x4b04('0x32')]?_0x57560e['attributes']:_0x5c2804['model'];if(!_0x4f934b['query'][_0x4b04('0x33')]('nolimit')){_0x57560e['limit']=qs['limit'](_0x4f934b[_0x4b04('0x2d')][_0x4b04('0x1c')]);_0x57560e[_0x4b04('0x1a')]=qs[_0x4b04('0x1a')](_0x4f934b[_0x4b04('0x2d')][_0x4b04('0x1a')]);}_0x57560e[_0x4b04('0x34')]=qs[_0x4b04('0x35')](_0x4f934b[_0x4b04('0x2d')][_0x4b04('0x35')]);_0x57560e[_0x4b04('0x36')]=qs[_0x4b04('0x37')](_[_0x4b04('0x38')](_0x4f934b[_0x4b04('0x2d')],_0x5c2804[_0x4b04('0x37')]),_0x194684);if(_0x4f934b['query'][_0x4b04('0x39')]){_0x57560e[_0x4b04('0x36')]=_[_0x4b04('0x3a')](_0x57560e['where'],{'$or':_[_0x4b04('0x28')](_0x194684,function(_0x1dcc74){if(_0x1dcc74[_0x4b04('0x2b')]!=='VIRTUAL'){var _0x5184e4={};_0x5184e4[_0x1dcc74[_0x4b04('0x25')]]={'$like':'%'+_0x4f934b[_0x4b04('0x2d')]['filter']+'%'};return _0x5184e4;}})});}_0x57560e=_[_0x4b04('0x3a')]({},_0x57560e,_0x4f934b[_0x4b04('0x3b')]);var _0x4a850f={'where':_0x57560e[_0x4b04('0x36')]};return db[_0x4b04('0x29')]['count'](_0x4a850f)[_0x4b04('0x23')](function(_0x26a339){_0x2553ee[_0x4b04('0x1d')]=_0x26a339;if(_0x4f934b[_0x4b04('0x2d')][_0x4b04('0x3c')]){_0x57560e['include']=[{'all':!![]}];}return db[_0x4b04('0x29')][_0x4b04('0x3d')](_0x57560e);})[_0x4b04('0x23')](function(_0xad3f0f){_0x2553ee['rows']=_0xad3f0f;return _0x2553ee;})[_0x4b04('0x23')](respondWithFilteredResult(_0x1a81a4,_0x57560e))['catch'](handleError(_0x1a81a4,null));}; \ No newline at end of file +var _0xcac6=['end','error','name','send','index','rawAttributes','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','Migration','includeAll','findAll','catch','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','status'];(function(_0x18ae4b,_0x3fccea){var _0x409b8b=function(_0x2d611c){while(--_0x2d611c){_0x18ae4b['push'](_0x18ae4b['shift']());}};_0x409b8b(++_0x3fccea);}(_0xcac6,0xa3));var _0x6cac=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcac6[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6cac('0x0'));var zipdir=require(_0x6cac('0x1'));var jsonpatch=require(_0x6cac('0x2'));var rp=require(_0x6cac('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6cac('0x4'));var util=require(_0x6cac('0x5'));var path=require(_0x6cac('0x6'));var sox=require(_0x6cac('0x7'));var csv=require(_0x6cac('0x8'));var ejs=require(_0x6cac('0x9'));var fs=require('fs');var fs_extra=require(_0x6cac('0xa'));var _=require('lodash');var squel=require(_0x6cac('0xb'));var crypto=require(_0x6cac('0xc'));var jsforce=require(_0x6cac('0xd'));var deskjs=require(_0x6cac('0xe'));var toCsv=require(_0x6cac('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6cac('0xf'));var authService=require(_0x6cac('0x10'));var qs=require(_0x6cac('0x11'));var as=require(_0x6cac('0x12'));var hardwareService=require(_0x6cac('0x13'));var logger=require(_0x6cac('0x14'))('api');var utils=require(_0x6cac('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6cac('0x16'));var db=require(_0x6cac('0x17'))['db'];function respondWithStatusCode(_0x2d21fd,_0x25f307){_0x25f307=_0x25f307||0xcc;return function(_0x25d5e0){if(_0x25d5e0){return _0x2d21fd[_0x6cac('0x18')](_0x25f307);}return _0x2d21fd['status'](_0x25f307)['end']();};}function respondWithResult(_0x4fd561,_0x2e4f43){_0x2e4f43=_0x2e4f43||0xc8;return function(_0x189107){if(_0x189107){return _0x4fd561['status'](_0x2e4f43)[_0x6cac('0x19')](_0x189107);}};}function respondWithFilteredResult(_0x47e205,_0x2a619f){return function(_0x14a13b){if(_0x14a13b){var _0x5b002c=typeof _0x2a619f[_0x6cac('0x1a')]===_0x6cac('0x1b')&&typeof _0x2a619f[_0x6cac('0x1c')]==='undefined';var _0x11b86f=_0x14a13b['count'];var _0x1a392b=_0x5b002c?0x0:_0x2a619f[_0x6cac('0x1a')];var _0x3c8e59=_0x5b002c?_0x14a13b[_0x6cac('0x1d')]:_0x2a619f[_0x6cac('0x1a')]+_0x2a619f[_0x6cac('0x1c')];var _0x1ae1cf;if(_0x3c8e59>=_0x11b86f){_0x3c8e59=_0x11b86f;_0x1ae1cf=0xc8;}else{_0x1ae1cf=0xce;}_0x47e205['status'](_0x1ae1cf);return _0x47e205[_0x6cac('0x1e')]('Content-Range',_0x1a392b+'-'+_0x3c8e59+'/'+_0x11b86f)[_0x6cac('0x19')](_0x14a13b);}return null;};}function patchUpdates(_0x2de26f){return function(_0x683b3){try{jsonpatch[_0x6cac('0x1f')](_0x683b3,_0x2de26f,!![]);}catch(_0xfd4168){return BPromise[_0x6cac('0x20')](_0xfd4168);}return _0x683b3[_0x6cac('0x21')]();};}function saveUpdates(_0x5a7bc2,_0x63875a){return function(_0x55a844){if(_0x55a844){return _0x55a844[_0x6cac('0x22')](_0x5a7bc2)[_0x6cac('0x23')](function(_0x49fae7){return _0x49fae7;});}return null;};}function removeEntity(_0x660e82,_0x375260){return function(_0x58f38c){if(_0x58f38c){return _0x58f38c[_0x6cac('0x24')]()[_0x6cac('0x23')](function(){_0x660e82[_0x6cac('0x25')](0xcc)[_0x6cac('0x26')]();});}};}function handleEntityNotFound(_0x55b371,_0x27872e){return function(_0x400645){if(!_0x400645){_0x55b371[_0x6cac('0x18')](0x194);}return _0x400645;};}function handleError(_0x30ab79,_0x46b19f){_0x46b19f=_0x46b19f||0x1f4;return function(_0x50161e){logger[_0x6cac('0x27')](_0x50161e['stack']);if(_0x50161e['name']){delete _0x50161e[_0x6cac('0x28')];}_0x30ab79[_0x6cac('0x25')](_0x46b19f)[_0x6cac('0x29')](_0x50161e);};}exports[_0x6cac('0x2a')]=function(_0x4ec964,_0x37a65a){var _0x322555={},_0x2dff82={},_0x4d1e45={'count':0x0,'rows':[]};var _0x247014=_['map'](db['Migration'][_0x6cac('0x2b')],function(_0xa2ae28){return{'name':_0xa2ae28['fieldName'],'type':_0xa2ae28[_0x6cac('0x2c')][_0x6cac('0x2d')]};});_0x2dff82[_0x6cac('0x2e')]=_[_0x6cac('0x2f')](_0x247014,_0x6cac('0x28'));_0x2dff82['query']=_[_0x6cac('0x30')](_0x4ec964[_0x6cac('0x31')]);_0x2dff82['filters']=_[_0x6cac('0x32')](_0x2dff82[_0x6cac('0x2e')],_0x2dff82[_0x6cac('0x31')]);_0x322555[_0x6cac('0x33')]=_[_0x6cac('0x32')](_0x2dff82[_0x6cac('0x2e')],qs['fields'](_0x4ec964[_0x6cac('0x31')][_0x6cac('0x34')]));_0x322555[_0x6cac('0x33')]=_0x322555['attributes'][_0x6cac('0x35')]?_0x322555[_0x6cac('0x33')]:_0x2dff82[_0x6cac('0x2e')];if(!_0x4ec964['query'][_0x6cac('0x36')]('nolimit')){_0x322555[_0x6cac('0x1c')]=qs[_0x6cac('0x1c')](_0x4ec964[_0x6cac('0x31')][_0x6cac('0x1c')]);_0x322555[_0x6cac('0x1a')]=qs[_0x6cac('0x1a')](_0x4ec964[_0x6cac('0x31')][_0x6cac('0x1a')]);}_0x322555[_0x6cac('0x37')]=qs[_0x6cac('0x38')](_0x4ec964[_0x6cac('0x31')]['sort']);_0x322555['where']=qs[_0x6cac('0x39')](_[_0x6cac('0x3a')](_0x4ec964[_0x6cac('0x31')],_0x2dff82[_0x6cac('0x39')]),_0x247014);if(_0x4ec964[_0x6cac('0x31')][_0x6cac('0x3b')]){_0x322555[_0x6cac('0x3c')]=_[_0x6cac('0x3d')](_0x322555[_0x6cac('0x3c')],{'$or':_['map'](_0x247014,function(_0x5cd066){if(_0x5cd066[_0x6cac('0x2c')]!==_0x6cac('0x3e')){var _0x64f8a9={};_0x64f8a9[_0x5cd066[_0x6cac('0x28')]]={'$like':'%'+_0x4ec964[_0x6cac('0x31')]['filter']+'%'};return _0x64f8a9;}})});}_0x322555=_[_0x6cac('0x3d')]({},_0x322555,_0x4ec964['options']);var _0x2d9908={'where':_0x322555[_0x6cac('0x3c')]};return db[_0x6cac('0x3f')][_0x6cac('0x1d')](_0x2d9908)[_0x6cac('0x23')](function(_0x250df3){_0x4d1e45['count']=_0x250df3;if(_0x4ec964[_0x6cac('0x31')][_0x6cac('0x40')]){_0x322555['include']=[{'all':!![]}];}return db[_0x6cac('0x3f')][_0x6cac('0x41')](_0x322555);})['then'](function(_0x36e585){_0x4d1e45['rows']=_0x36e585;return _0x4d1e45;})[_0x6cac('0x23')](respondWithFilteredResult(_0x37a65a,_0x322555))[_0x6cac('0x42')](handleError(_0x37a65a,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 3b34af6..0192f8d 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 _0xf22c=['bluebird','rimraf','./migration.attributes','exports','define','Migration','migrations','lodash','../../config/logger','api','moment'];(function(_0x48ba0a,_0x144423){var _0xb5ff99=function(_0xc1a11a){while(--_0xc1a11a){_0x48ba0a['push'](_0x48ba0a['shift']());}};_0xb5ff99(++_0x144423);}(_0xf22c,0x104));var _0xcf22=function(_0x133b86,_0xa6c790){_0x133b86=_0x133b86-0x0;var _0x40672e=_0xf22c[_0x133b86];return _0x40672e;};'use strict';var _=require(_0xcf22('0x0'));var util=require('util');var logger=require(_0xcf22('0x1'))(_0xcf22('0x2'));var moment=require(_0xcf22('0x3'));var BPromise=require(_0xcf22('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcf22('0x5'));var config=require('../../config/environment');var attributes=require(_0xcf22('0x6'));module[_0xcf22('0x7')]=function(_0x4652b1,_0x18f961){return _0x4652b1[_0xcf22('0x8')](_0xcf22('0x9'),attributes,{'tableName':_0xcf22('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc855=['../../config/logger','api','moment','path','../../config/environment','./migration.attributes','exports','Migration','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc855,0xf8));var _0x5c85=function(_0x5d28fb,_0x3c192c){_0x5d28fb=_0x5d28fb-0x0;var _0x33eee5=_0xc855[_0x5d28fb];return _0x33eee5;};'use strict';var _=require(_0x5c85('0x0'));var util=require(_0x5c85('0x1'));var logger=require(_0x5c85('0x2'))(_0x5c85('0x3'));var moment=require(_0x5c85('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c85('0x5'));var rimraf=require('rimraf');var config=require(_0x5c85('0x6'));var attributes=require(_0x5c85('0x7'));module[_0x5c85('0x8')]=function(_0x45923b,_0x347622){return _0x45923b['define'](_0x5c85('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index b332547..37274ef 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 _0x534d=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x520721,_0x495b4d){var _0xcb7f65=function(_0x165b33){while(--_0x165b33){_0x520721['push'](_0x520721['shift']());}};_0xcb7f65(++_0x495b4d);}(_0x534d,0x79));var _0xd534=function(_0x5169a7,_0x1a05d9){_0x5169a7=_0x5169a7-0x0;var _0x5aaf29=_0x534d[_0x5169a7];return _0x5aaf29;};'use strict';var _=require(_0xd534('0x0'));var util=require(_0xd534('0x1'));var moment=require(_0xd534('0x2'));var BPromise=require(_0xd534('0x3'));var rs=require(_0xd534('0x4'));var fs=require('fs');var Redis=require(_0xd534('0x5'));var db=require(_0xd534('0x6'))['db'];var utils=require(_0xd534('0x7'));var logger=require(_0xd534('0x8'))(_0xd534('0x9'));var config=require(_0xd534('0xa'));var jayson=require(_0xd534('0xb'));var client=jayson[_0xd534('0xc')][_0xd534('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1db778,_0x3c8772,_0x4419ee){return new BPromise(function(_0x1a00af,_0x2be8e1){return client['request'](_0x1db778,_0x4419ee)[_0xd534('0xe')](function(_0x37a2c8){logger[_0xd534('0xf')](_0xd534('0x10'),_0x3c8772,_0xd534('0x11'));logger['debug'](_0xd534('0x12'),_0x3c8772,_0xd534('0x11'),JSON[_0xd534('0x13')](_0x37a2c8));if(_0x37a2c8[_0xd534('0x14')]){if(_0x37a2c8[_0xd534('0x14')][_0xd534('0x15')]===0x1f4){logger[_0xd534('0x14')](_0xd534('0x10'),_0x3c8772,_0x37a2c8['error']['message']);return _0x2be8e1(_0x37a2c8[_0xd534('0x14')][_0xd534('0x16')]);}logger[_0xd534('0x14')](_0xd534('0x10'),_0x3c8772,_0x37a2c8[_0xd534('0x14')][_0xd534('0x16')]);return _0x1a00af(_0x37a2c8[_0xd534('0x14')][_0xd534('0x16')]);}else{logger[_0xd534('0xf')](_0xd534('0x10'),_0x3c8772,'request\x20sent');_0x1a00af(_0x37a2c8['result'][_0xd534('0x16')]);}})[_0xd534('0x17')](function(_0x398435){logger['error']('Migration,\x20%s,\x20%s',_0x3c8772,_0x398435);_0x2be8e1(_0x398435);});});} \ No newline at end of file +var _0xbbfa=['Migration,\x20%s,\x20%s,\x20%s','error','code','Migration,\x20%s,\x20%s','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x5db2aa,_0xdc10c7){var _0x5c716d=function(_0x174b70){while(--_0x174b70){_0x5db2aa['push'](_0x5db2aa['shift']());}};_0x5c716d(++_0xdc10c7);}(_0xbbfa,0x1e9));var _0xabbf=function(_0x15b33d,_0x3a17b0){_0x15b33d=_0x15b33d-0x0;var _0x3b09b6=_0xbbfa[_0x15b33d];return _0x3b09b6;};'use strict';var _=require(_0xabbf('0x0'));var util=require('util');var moment=require(_0xabbf('0x1'));var BPromise=require('bluebird');var rs=require(_0xabbf('0x2'));var fs=require('fs');var Redis=require(_0xabbf('0x3'));var db=require(_0xabbf('0x4'))['db'];var utils=require(_0xabbf('0x5'));var logger=require(_0xabbf('0x6'))(_0xabbf('0x7'));var config=require(_0xabbf('0x8'));var jayson=require(_0xabbf('0x9'));var client=jayson[_0xabbf('0xa')][_0xabbf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45b7d6,_0x58f0a8,_0x5b471b){return new BPromise(function(_0x536a4c,_0x1380cd){return client[_0xabbf('0xc')](_0x45b7d6,_0x5b471b)['then'](function(_0x5f35ee){logger[_0xabbf('0xd')]('Migration,\x20%s,\x20%s',_0x58f0a8,_0xabbf('0xe'));logger['debug'](_0xabbf('0xf'),_0x58f0a8,'request\x20sent',JSON['stringify'](_0x5f35ee));if(_0x5f35ee[_0xabbf('0x10')]){if(_0x5f35ee[_0xabbf('0x10')][_0xabbf('0x11')]===0x1f4){logger[_0xabbf('0x10')](_0xabbf('0x12'),_0x58f0a8,_0x5f35ee[_0xabbf('0x10')][_0xabbf('0x13')]);return _0x1380cd(_0x5f35ee[_0xabbf('0x10')][_0xabbf('0x13')]);}logger['error'](_0xabbf('0x12'),_0x58f0a8,_0x5f35ee['error'][_0xabbf('0x13')]);return _0x536a4c(_0x5f35ee['error'][_0xabbf('0x13')]);}else{logger[_0xabbf('0xd')](_0xabbf('0x12'),_0x58f0a8,_0xabbf('0xe'));_0x536a4c(_0x5f35ee['result'][_0xabbf('0x13')]);}})[_0xabbf('0x14')](function(_0x31245d){logger[_0xabbf('0x10')](_0xabbf('0x12'),_0x58f0a8,_0x31245d);_0x1380cd(_0x31245d);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index b78bc3f..35a941a 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 _0xcb1a=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra'];(function(_0x159349,_0x14b2b5){var _0xe7aa00=function(_0x59ddf9){while(--_0x59ddf9){_0x159349['push'](_0x159349['shift']());}};_0xe7aa00(++_0x14b2b5);}(_0xcb1a,0xb6));var _0xacb1=function(_0x299a99,_0x2f51a3){_0x299a99=_0x299a99-0x0;var _0x499906=_0xcb1a[_0x299a99];return _0x499906;};'use strict';var multer=require(_0xacb1('0x0'));var util=require(_0xacb1('0x1'));var path=require(_0xacb1('0x2'));var timeout=require(_0xacb1('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xacb1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xacb1('0x5'));var config=require(_0xacb1('0x6'));var controller=require('./network.controller');router[_0xacb1('0x7')]('/',auth[_0xacb1('0x8')](),controller[_0xacb1('0x9')]);router[_0xacb1('0x7')](_0xacb1('0xa'),auth[_0xacb1('0x8')](),controller['show']);router[_0xacb1('0xb')]('/',auth[_0xacb1('0x8')](),controller[_0xacb1('0xc')]);router[_0xacb1('0xd')](_0xacb1('0xa'),auth[_0xacb1('0x8')](),controller[_0xacb1('0xe')]);router[_0xacb1('0xf')](_0xacb1('0xa'),auth[_0xacb1('0x8')](),controller[_0xacb1('0x10')]);module['exports']=router; \ No newline at end of file +var _0x524e=['../../config/environment','./network.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x24c8e4,_0x352ede){var _0x20ee63=function(_0x2419d9){while(--_0x2419d9){_0x24c8e4['push'](_0x24c8e4['shift']());}};_0x20ee63(++_0x352ede);}(_0x524e,0x15e));var _0xe524=function(_0x19e808,_0x5ce1df){_0x19e808=_0x19e808-0x0;var _0x3220ac=_0x524e[_0x19e808];return _0x3220ac;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0xd')]('/',auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x10')](_0xe524('0xb'),auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x12')](_0xe524('0xb'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);module[_0xe524('0x14')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 8373ed5..1093388 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 _0xa6a8=['STRING','exports','externip','stun','turn'];(function(_0x47bdaf,_0x225188){var _0x461fc2=function(_0x5655cc){while(--_0x5655cc){_0x47bdaf['push'](_0x47bdaf['shift']());}};_0x461fc2(++_0x225188);}(_0xa6a8,0x1aa));var _0x8a6a=function(_0x19883a,_0x98963a){_0x19883a=_0x19883a-0x0;var _0x529e8a=_0xa6a8[_0x19883a];return _0x529e8a;};'use strict';var Sequelize=require('sequelize');module[_0x8a6a('0x0')]={'type':{'type':Sequelize['ENUM']('localnet',_0x8a6a('0x1'),_0x8a6a('0x2'),_0x8a6a('0x3'))},'value':{'type':Sequelize[_0x8a6a('0x4')]},'username':{'type':Sequelize[_0x8a6a('0x4')]},'password':{'type':Sequelize[_0x8a6a('0x4')]}}; \ No newline at end of file +var _0x514b=['stun','turn','STRING','sequelize','exports','ENUM'];(function(_0x58d1ee,_0x153b20){var _0x26c081=function(_0x2d67b9){while(--_0x2d67b9){_0x58d1ee['push'](_0x58d1ee['shift']());}};_0x26c081(++_0x153b20);}(_0x514b,0x16b));var _0xb514=function(_0x3be2e3,_0x4c1f40){_0x3be2e3=_0x3be2e3-0x0;var _0x476517=_0x514b[_0x3be2e3];return _0x476517;};'use strict';var Sequelize=require(_0xb514('0x0'));module[_0xb514('0x1')]={'type':{'type':Sequelize[_0xb514('0x2')]('localnet','externip',_0xb514('0x3'),_0xb514('0x4'))},'value':{'type':Sequelize[_0xb514('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb514('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index dffbc61..dd20454 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 _0x23cd=['request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','offset','limit','undefined','set','Content-Range','reject','update','stack','name','map','Network','fieldName','type','key','keys','query','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','attributes','length','find','sequelize','transaction','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','create','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','join','server/files/templates/network.ejs','format','toLowerCase','params','destroy','/etc/asterisk/sip_xcally_%s.conf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23cd,0x182));var _0xd23c=function(_0x4578d7,_0xb2a804){_0x4578d7=_0x4578d7-0x0;var _0x3e671a=_0x23cd[_0x4578d7];return _0x3e671a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd23c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd23c('0x1'));var rp=require(_0xd23c('0x2'));var moment=require(_0xd23c('0x3'));var BPromise=require(_0xd23c('0x4'));var Mustache=require('mustache');var util=require(_0xd23c('0x5'));var path=require(_0xd23c('0x6'));var sox=require(_0xd23c('0x7'));var csv=require(_0xd23c('0x8'));var ejs=require(_0xd23c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd23c('0xa'));var squel=require(_0xd23c('0xb'));var crypto=require(_0xd23c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd23c('0xd'));var toCsv=require(_0xd23c('0x8'));var querystring=require('querystring');var Papa=require(_0xd23c('0xe'));var Redis=require(_0xd23c('0xf'));var authService=require(_0xd23c('0x10'));var qs=require(_0xd23c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd23c('0x12'));var logger=require('../../config/logger')(_0xd23c('0x13'));var utils=require(_0xd23c('0x14'));var config=require(_0xd23c('0x15'));var licenseUtil=require(_0xd23c('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd23c('0x17'));var client=jayson[_0xd23c('0x18')][_0xd23c('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x292fe7,_0x4c19b5,_0x583fba,_0x1da194){return new BPromise(function(_0x383f94,_0x2bac4f){var _0x5dc479=_0x1da194||client;return _0x5dc479[_0xd23c('0x1a')](_0x292fe7,_0x583fba)[_0xd23c('0x1b')](function(_0x40acc3){logger[_0xd23c('0x1c')](_0xd23c('0x1d'),_0x4c19b5,_0xd23c('0x1e'));logger[_0xd23c('0x1f')](_0xd23c('0x20'),_0x4c19b5,_0xd23c('0x1e'),JSON['stringify'](_0x40acc3));if(_0x40acc3['error']){if(_0x40acc3[_0xd23c('0x21')]['code']===0x1f4){logger[_0xd23c('0x21')]('Network,\x20%s,\x20%s',_0x4c19b5,_0x40acc3['error']['message']);return _0x2bac4f(_0x40acc3['error']['message']);}logger[_0xd23c('0x21')](_0xd23c('0x1d'),_0x4c19b5,_0x40acc3[_0xd23c('0x21')][_0xd23c('0x22')]);return _0x383f94(_0x40acc3[_0xd23c('0x21')]['message']);}else{logger[_0xd23c('0x1c')](_0xd23c('0x1d'),_0x4c19b5,_0xd23c('0x1e'));_0x383f94(_0x40acc3[_0xd23c('0x23')][_0xd23c('0x22')]);}})['catch'](function(_0x1c1864){logger[_0xd23c('0x21')]('Network,\x20%s,\x20%s',_0x4c19b5,_0x1c1864);_0x2bac4f(_0x1c1864);});});}function respondWithStatusCode(_0xf69971,_0x534a6e){_0x534a6e=_0x534a6e||0xcc;return function(_0x28fc2e){if(_0x28fc2e){return _0xf69971[_0xd23c('0x24')](_0x534a6e);}return _0xf69971[_0xd23c('0x25')](_0x534a6e)[_0xd23c('0x26')]();};}function respondWithResult(_0x288acd,_0x207231){_0x207231=_0x207231||0xc8;return function(_0x10df9){if(_0x10df9){return _0x288acd[_0xd23c('0x25')](_0x207231)['json'](_0x10df9);}};}function respondWithFilteredResult(_0x2d472b,_0x2f395d){return function(_0x334084){if(_0x334084){var _0x4fb332=typeof _0x2f395d[_0xd23c('0x27')]==='undefined'&&typeof _0x2f395d[_0xd23c('0x28')]===_0xd23c('0x29');var _0xdb3bd6=_0x334084['count'];var _0x359e5d=_0x4fb332?0x0:_0x2f395d[_0xd23c('0x27')];var _0x25b0bb=_0x4fb332?_0x334084['count']:_0x2f395d[_0xd23c('0x27')]+_0x2f395d[_0xd23c('0x28')];var _0x1a26b1;if(_0x25b0bb>=_0xdb3bd6){_0x25b0bb=_0xdb3bd6;_0x1a26b1=0xc8;}else{_0x1a26b1=0xce;}_0x2d472b['status'](_0x1a26b1);return _0x2d472b[_0xd23c('0x2a')](_0xd23c('0x2b'),_0x359e5d+'-'+_0x25b0bb+'/'+_0xdb3bd6)['json'](_0x334084);}return null;};}function patchUpdates(_0x31bb24){return function(_0x16b44c){try{jsonpatch['apply'](_0x16b44c,_0x31bb24,!![]);}catch(_0x127d1b){return BPromise[_0xd23c('0x2c')](_0x127d1b);}return _0x16b44c['save']();};}function saveUpdates(_0x450887,_0x28b2ea){return function(_0x31e3bd){if(_0x31e3bd){return _0x31e3bd[_0xd23c('0x2d')](_0x450887)[_0xd23c('0x1b')](function(_0x1b0383){return _0x1b0383;});}return null;};}function removeEntity(_0x38949e,_0xe0e593){return function(_0x5c30a4){if(_0x5c30a4){return _0x5c30a4['destroy']()['then'](function(){_0x38949e[_0xd23c('0x25')](0xcc)[_0xd23c('0x26')]();});}};}function handleEntityNotFound(_0x38e7fa,_0x2839b9){return function(_0x1438ad){if(!_0x1438ad){_0x38e7fa['sendStatus'](0x194);}return _0x1438ad;};}function handleError(_0x21fcba,_0x3908f8){_0x3908f8=_0x3908f8||0x1f4;return function(_0x2bb856){logger['error'](_0x2bb856[_0xd23c('0x2e')]);if(_0x2bb856[_0xd23c('0x2f')]){delete _0x2bb856[_0xd23c('0x2f')];}_0x21fcba[_0xd23c('0x25')](_0x3908f8)['send'](_0x2bb856);};}exports['index']=function(_0x497ebe,_0x3323dd){var _0x23cee6={},_0x41b562={},_0xe70c92={'count':0x0,'rows':[]};var _0x6a1bda=_[_0xd23c('0x30')](db[_0xd23c('0x31')]['rawAttributes'],function(_0x58dd4d){return{'name':_0x58dd4d[_0xd23c('0x32')],'type':_0x58dd4d[_0xd23c('0x33')][_0xd23c('0x34')]};});_0x41b562['model']=_[_0xd23c('0x30')](_0x6a1bda,'name');_0x41b562['query']=_[_0xd23c('0x35')](_0x497ebe[_0xd23c('0x36')]);_0x41b562['filters']=_[_0xd23c('0x37')](_0x41b562[_0xd23c('0x38')],_0x41b562[_0xd23c('0x36')]);_0x23cee6['attributes']=_[_0xd23c('0x37')](_0x41b562[_0xd23c('0x38')],qs['fields'](_0x497ebe['query'][_0xd23c('0x39')]));_0x23cee6['attributes']=_0x23cee6['attributes']['length']?_0x23cee6['attributes']:_0x41b562['model'];if(!_0x497ebe[_0xd23c('0x36')][_0xd23c('0x3a')](_0xd23c('0x3b'))){_0x23cee6['limit']=qs[_0xd23c('0x28')](_0x497ebe[_0xd23c('0x36')]['limit']);_0x23cee6[_0xd23c('0x27')]=qs['offset'](_0x497ebe[_0xd23c('0x36')][_0xd23c('0x27')]);}_0x23cee6[_0xd23c('0x3c')]=qs[_0xd23c('0x3d')](_0x497ebe[_0xd23c('0x36')][_0xd23c('0x3d')]);_0x23cee6[_0xd23c('0x3e')]=qs[_0xd23c('0x3f')](_[_0xd23c('0x40')](_0x497ebe['query'],_0x41b562[_0xd23c('0x3f')]),_0x6a1bda);if(_0x497ebe[_0xd23c('0x36')][_0xd23c('0x41')]){_0x23cee6[_0xd23c('0x3e')]=_[_0xd23c('0x42')](_0x23cee6[_0xd23c('0x3e')],{'$or':_['map'](_0x6a1bda,function(_0x321a9d){if(_0x321a9d['type']!==_0xd23c('0x43')){var _0x17cb95={};_0x17cb95[_0x321a9d[_0xd23c('0x2f')]]={'$like':'%'+_0x497ebe['query'][_0xd23c('0x41')]+'%'};return _0x17cb95;}})});}_0x23cee6=_[_0xd23c('0x42')]({},_0x23cee6,_0x497ebe[_0xd23c('0x44')]);var _0x3eda2e={'where':_0x23cee6[_0xd23c('0x3e')]};return db[_0xd23c('0x31')]['count'](_0x3eda2e)[_0xd23c('0x1b')](function(_0x2dbc28){_0xe70c92[_0xd23c('0x45')]=_0x2dbc28;if(_0x497ebe[_0xd23c('0x36')][_0xd23c('0x46')]){_0x23cee6[_0xd23c('0x47')]=[{'all':!![]}];}return db['Network'][_0xd23c('0x48')](_0x23cee6);})[_0xd23c('0x1b')](function(_0x5bd277){_0xe70c92['rows']=_0x5bd277;return _0xe70c92;})[_0xd23c('0x1b')](respondWithFilteredResult(_0x3323dd,_0x23cee6))[_0xd23c('0x49')](handleError(_0x3323dd,null));};exports[_0xd23c('0x4a')]=function(_0x2e43d5,_0x22c3d7){var _0x35502f={'raw':!![],'where':{'id':_0x2e43d5['params']['id']}},_0x4659ae={};_0x4659ae[_0xd23c('0x38')]=_[_0xd23c('0x35')](db[_0xd23c('0x31')]['rawAttributes']);_0x4659ae['query']=_['keys'](_0x2e43d5['query']);_0x4659ae[_0xd23c('0x3f')]=_['intersection'](_0x4659ae[_0xd23c('0x38')],_0x4659ae[_0xd23c('0x36')]);_0x35502f[_0xd23c('0x4b')]=_[_0xd23c('0x37')](_0x4659ae[_0xd23c('0x38')],qs[_0xd23c('0x39')](_0x2e43d5[_0xd23c('0x36')][_0xd23c('0x39')]));_0x35502f[_0xd23c('0x4b')]=_0x35502f[_0xd23c('0x4b')][_0xd23c('0x4c')]?_0x35502f[_0xd23c('0x4b')]:_0x4659ae['model'];if(_0x2e43d5[_0xd23c('0x36')][_0xd23c('0x46')]){_0x35502f['include']=[{'all':!![]}];}_0x35502f=_[_0xd23c('0x42')]({},_0x35502f,_0x2e43d5['options']);return db['Network'][_0xd23c('0x4d')](_0x35502f)[_0xd23c('0x1b')](handleEntityNotFound(_0x22c3d7,null))['then'](respondWithResult(_0x22c3d7,null))['catch'](handleError(_0x22c3d7,null));};exports['create']=function(_0x4daea8,_0x48a8e9,_0x5c2409){var _0x4efc5f;return db[_0xd23c('0x4e')][_0xd23c('0x4f')](function(_0x5f1bd0){return db[_0xd23c('0x31')]['create'](_0x4daea8[_0xd23c('0x50')],{'raw':!![]})[_0xd23c('0x1b')](function(_0x49e0ce){_0x4efc5f=_0x49e0ce;return db[_0xd23c('0x31')][_0xd23c('0x48')]({'where':{'type':_0x4daea8['body'][_0xd23c('0x33')]},'raw':!![]});})['then'](function(_0x6862b2){if(_0x4efc5f[_0xd23c('0x33')][_0xd23c('0x51')]()==_0xd23c('0x52')){var _0x13b49d=fs[_0xd23c('0x53')](path['join'](config[_0xd23c('0x54')],_0xd23c('0x55')),_0xd23c('0x56'));var _0x3c88a8=ejs[_0xd23c('0x57')](_0x13b49d,{'networks':_0x6862b2||[]});fs['writeFileSync'](_0xd23c('0x58'),_0x3c88a8);return respondWithRpcPromise(_0xd23c('0x59'),_0xd23c('0x5a'),{'module':_0xd23c('0x5b')});}else if(_0x4efc5f[_0xd23c('0x33')][_0xd23c('0x51')]()==_0xd23c('0x5c')){var _0x5cafc7=fs['readFileSync'](path['join'](config['root'],_0xd23c('0x5d')),_0xd23c('0x56'));var _0x339c31=ejs['render'](_0x5cafc7,{'networks':_0x6862b2||[]});fs[_0xd23c('0x5e')](_0xd23c('0x5f'),_0x339c31);return respondWithRpcPromise(_0xd23c('0x59'),_0xd23c('0x5a'),{'module':_0xd23c('0x5b')});}else{var _0x2a5fbe=fs[_0xd23c('0x53')](path[_0xd23c('0x60')](config['root'],_0xd23c('0x61')),_0xd23c('0x56'));var _0x20be16=ejs[_0xd23c('0x57')](_0x2a5fbe,{'networks':_0x6862b2||[]});fs[_0xd23c('0x5e')](util[_0xd23c('0x62')]('/etc/asterisk/sip_xcally_%s.conf',_0x4daea8[_0xd23c('0x50')][_0xd23c('0x33')][_0xd23c('0x63')]()),_0x20be16);return respondWithRpcPromise('Reload',_0xd23c('0x5a'),{'module':'chan_sip.so'});}return null;})[_0xd23c('0x1b')](function(){return _0x4efc5f;});})[_0xd23c('0x1b')](respondWithResult(_0x48a8e9,0xc9))['catch'](handleError(_0x48a8e9,null));};exports['update']=function(_0x5ae4c6,_0x46fcc0,_0x5edff4){var _0x4a474c;return db['sequelize'][_0xd23c('0x4f')](function(_0x34b4d4){return db['Network'][_0xd23c('0x4d')]({'where':{'id':_0x5ae4c6[_0xd23c('0x64')]['id']}})[_0xd23c('0x1b')](handleEntityNotFound(_0x46fcc0,null))[_0xd23c('0x1b')](saveUpdates(_0x5ae4c6['body'],null))[_0xd23c('0x1b')](function(_0x594f70){if(_0x594f70){_0x4a474c=_0x594f70;return db[_0xd23c('0x31')][_0xd23c('0x48')]({'where':{'type':_0x4a474c['type']},'raw':!![]});}return null;})[_0xd23c('0x1b')](function(_0x5a642a){if(_0x4a474c[_0xd23c('0x33')][_0xd23c('0x51')]()==_0xd23c('0x52')){var _0x50be35=fs['readFileSync'](path[_0xd23c('0x60')](config[_0xd23c('0x54')],_0xd23c('0x55')),'utf8');var _0x2525a2=ejs[_0xd23c('0x57')](_0x50be35,{'networks':_0x5a642a||[]});fs[_0xd23c('0x5e')](_0xd23c('0x58'),_0x2525a2);return respondWithRpcPromise('Reload',_0xd23c('0x2d'),{'module':'res_stun_monitor.so'});}else if(_0x4a474c['type'][_0xd23c('0x51')]()=='TURN'){var _0x212fa7=fs['readFileSync'](path['join'](config[_0xd23c('0x54')],_0xd23c('0x5d')),'utf8');var _0x266551=ejs[_0xd23c('0x57')](_0x212fa7,{'networks':_0x5a642a||[]});fs[_0xd23c('0x5e')](_0xd23c('0x5f'),_0x266551);return respondWithRpcPromise(_0xd23c('0x59'),_0xd23c('0x2d'),{'module':_0xd23c('0x5b')});}else{var _0x2966b1=fs[_0xd23c('0x53')](path[_0xd23c('0x60')](config['root'],_0xd23c('0x61')),_0xd23c('0x56'));var _0x47c0d4=ejs[_0xd23c('0x57')](_0x2966b1,{'networks':_0x5a642a||[]});fs['writeFileSync'](util[_0xd23c('0x62')]('/etc/asterisk/sip_xcally_%s.conf',_0x5ae4c6[_0xd23c('0x50')][_0xd23c('0x33')]['toLowerCase']()),_0x47c0d4);return respondWithRpcPromise(_0xd23c('0x59'),_0xd23c('0x2d'),{'module':'chan_sip.so'});}return null;})[_0xd23c('0x1b')](function(_0x59712b){if(_0x59712b){return _0x4a474c;}return null;});})[_0xd23c('0x1b')](respondWithResult(_0x46fcc0,null))[_0xd23c('0x49')](handleError(_0x46fcc0,null));};exports[_0xd23c('0x65')]=function(_0x5038c3,_0x5cff77,_0x28b78a){var _0x115561;return db[_0xd23c('0x31')][_0xd23c('0x4d')]({'where':{'id':_0x5038c3[_0xd23c('0x64')]['id']}})[_0xd23c('0x1b')](function(_0xf34ea6){_0x115561=_0xf34ea6;return _0xf34ea6;})[_0xd23c('0x1b')](handleEntityNotFound(_0x5cff77,null))[_0xd23c('0x1b')](removeEntity(_0x5cff77,null))['then'](function(){if(_0x115561){return db[_0xd23c('0x31')]['findAll']({'where':{'type':_0x115561['type']},'raw':!![]});}})[_0xd23c('0x1b')](function(_0x226299){if(_0x115561[_0xd23c('0x33')][_0xd23c('0x51')]()==_0xd23c('0x52')){var _0x41f2a4=fs[_0xd23c('0x53')](path[_0xd23c('0x60')](config[_0xd23c('0x54')],'server/files/templates/stun_multiple.ejs'),_0xd23c('0x56'));var _0x3296dd=ejs['render'](_0x41f2a4,{'networks':_0x226299||[]});fs[_0xd23c('0x5e')]('/etc/asterisk/stun_xcally.conf',_0x3296dd);return respondWithRpcPromise(_0xd23c('0x59'),_0xd23c('0x65'),{'module':_0xd23c('0x5b')});}else if(_0x115561['type'][_0xd23c('0x51')]()==_0xd23c('0x5c')){var _0x57bbe3=fs[_0xd23c('0x53')](path[_0xd23c('0x60')](config[_0xd23c('0x54')],_0xd23c('0x5d')),_0xd23c('0x56'));var _0x5dc268=ejs[_0xd23c('0x57')](_0x57bbe3,{'networks':_0x226299||[]});fs[_0xd23c('0x5e')](_0xd23c('0x5f'),_0x5dc268);return respondWithRpcPromise(_0xd23c('0x59'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x19b881=fs[_0xd23c('0x53')](path[_0xd23c('0x60')](config['root'],_0xd23c('0x61')),_0xd23c('0x56'));var _0x579865=ejs[_0xd23c('0x57')](_0x19b881,{'networks':_0x226299||[]});fs[_0xd23c('0x5e')](util[_0xd23c('0x62')](_0xd23c('0x66'),_0x5038c3[_0xd23c('0x50')][_0xd23c('0x33')][_0xd23c('0x63')]()),_0x579865);return respondWithRpcPromise(_0xd23c('0x59'),_0xd23c('0x65'),{'module':'chan_sip.so'});}return null;})[_0xd23c('0x49')](handleError(_0x5cff77,null));}; \ No newline at end of file +var _0xb66b=['attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','Network','findAll','rows','show','params','includeAll','find','create','transaction','body','toUpperCase','STUN','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','sequelize','server/files/templates/stun_multiple.ejs','chan_sip.so','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb66b,0x9a));var _0xbb66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb66b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb66('0x0'));var zipdir=require(_0xbb66('0x1'));var jsonpatch=require(_0xbb66('0x2'));var rp=require(_0xbb66('0x3'));var moment=require('moment');var BPromise=require(_0xbb66('0x4'));var Mustache=require(_0xbb66('0x5'));var util=require(_0xbb66('0x6'));var path=require(_0xbb66('0x7'));var sox=require(_0xbb66('0x8'));var csv=require('to-csv');var ejs=require(_0xbb66('0x9'));var fs=require('fs');var fs_extra=require(_0xbb66('0xa'));var _=require(_0xbb66('0xb'));var squel=require(_0xbb66('0xc'));var crypto=require(_0xbb66('0xd'));var jsforce=require(_0xbb66('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbb66('0xf'));var querystring=require(_0xbb66('0x10'));var Papa=require('papaparse');var Redis=require(_0xbb66('0x11'));var authService=require(_0xbb66('0x12'));var qs=require(_0xbb66('0x13'));var as=require(_0xbb66('0x14'));var hardwareService=require(_0xbb66('0x15'));var logger=require(_0xbb66('0x16'))(_0xbb66('0x17'));var utils=require(_0xbb66('0x18'));var config=require(_0xbb66('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xbb66('0x1a'));var client=jayson[_0xbb66('0x1b')][_0xbb66('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x21bdba,_0x9241aa,_0xd93f7e,_0x517499){return new BPromise(function(_0x42afce,_0x43a14e){var _0x24b029=_0x517499||client;return _0x24b029['request'](_0x21bdba,_0xd93f7e)['then'](function(_0x3b6f01){logger[_0xbb66('0x1d')](_0xbb66('0x1e'),_0x9241aa,'request\x20sent');logger[_0xbb66('0x1f')](_0xbb66('0x20'),_0x9241aa,_0xbb66('0x21'),JSON[_0xbb66('0x22')](_0x3b6f01));if(_0x3b6f01[_0xbb66('0x23')]){if(_0x3b6f01[_0xbb66('0x23')]['code']===0x1f4){logger['error'](_0xbb66('0x1e'),_0x9241aa,_0x3b6f01[_0xbb66('0x23')][_0xbb66('0x24')]);return _0x43a14e(_0x3b6f01[_0xbb66('0x23')][_0xbb66('0x24')]);}logger[_0xbb66('0x23')]('Network,\x20%s,\x20%s',_0x9241aa,_0x3b6f01[_0xbb66('0x23')][_0xbb66('0x24')]);return _0x42afce(_0x3b6f01[_0xbb66('0x23')][_0xbb66('0x24')]);}else{logger[_0xbb66('0x1d')]('Network,\x20%s,\x20%s',_0x9241aa,'request\x20sent');_0x42afce(_0x3b6f01[_0xbb66('0x25')][_0xbb66('0x24')]);}})[_0xbb66('0x26')](function(_0x26a9c0){logger[_0xbb66('0x23')]('Network,\x20%s,\x20%s',_0x9241aa,_0x26a9c0);_0x43a14e(_0x26a9c0);});});}function respondWithStatusCode(_0x1bc17f,_0x370dcd){_0x370dcd=_0x370dcd||0xcc;return function(_0xbdde8){if(_0xbdde8){return _0x1bc17f['sendStatus'](_0x370dcd);}return _0x1bc17f[_0xbb66('0x27')](_0x370dcd)[_0xbb66('0x28')]();};}function respondWithResult(_0x248bd1,_0x226003){_0x226003=_0x226003||0xc8;return function(_0x120b77){if(_0x120b77){return _0x248bd1[_0xbb66('0x27')](_0x226003)[_0xbb66('0x29')](_0x120b77);}};}function respondWithFilteredResult(_0x4a8003,_0xab4dee){return function(_0x203b40){if(_0x203b40){var _0xf9f34e=typeof _0xab4dee['offset']===_0xbb66('0x2a')&&typeof _0xab4dee[_0xbb66('0x2b')]===_0xbb66('0x2a');var _0x577246=_0x203b40['count'];var _0x2268af=_0xf9f34e?0x0:_0xab4dee[_0xbb66('0x2c')];var _0x507acf=_0xf9f34e?_0x203b40[_0xbb66('0x2d')]:_0xab4dee[_0xbb66('0x2c')]+_0xab4dee[_0xbb66('0x2b')];var _0x58dee9;if(_0x507acf>=_0x577246){_0x507acf=_0x577246;_0x58dee9=0xc8;}else{_0x58dee9=0xce;}_0x4a8003[_0xbb66('0x27')](_0x58dee9);return _0x4a8003[_0xbb66('0x2e')](_0xbb66('0x2f'),_0x2268af+'-'+_0x507acf+'/'+_0x577246)[_0xbb66('0x29')](_0x203b40);}return null;};}function patchUpdates(_0x266b62){return function(_0xc0783a){try{jsonpatch[_0xbb66('0x30')](_0xc0783a,_0x266b62,!![]);}catch(_0x39522a){return BPromise[_0xbb66('0x31')](_0x39522a);}return _0xc0783a[_0xbb66('0x32')]();};}function saveUpdates(_0x1baad7,_0x260980){return function(_0x2b3480){if(_0x2b3480){return _0x2b3480[_0xbb66('0x33')](_0x1baad7)[_0xbb66('0x34')](function(_0x5c068c){return _0x5c068c;});}return null;};}function removeEntity(_0x5de1af,_0x4c9b18){return function(_0x4df97e){if(_0x4df97e){return _0x4df97e[_0xbb66('0x35')]()['then'](function(){_0x5de1af[_0xbb66('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x362e83,_0x221e2f){return function(_0x51f5e7){if(!_0x51f5e7){_0x362e83[_0xbb66('0x36')](0x194);}return _0x51f5e7;};}function handleError(_0x2e0ff9,_0x41e8a6){_0x41e8a6=_0x41e8a6||0x1f4;return function(_0x5d2c54){logger[_0xbb66('0x23')](_0x5d2c54['stack']);if(_0x5d2c54[_0xbb66('0x37')]){delete _0x5d2c54['name'];}_0x2e0ff9[_0xbb66('0x27')](_0x41e8a6)[_0xbb66('0x38')](_0x5d2c54);};}exports[_0xbb66('0x39')]=function(_0x2b03f1,_0x368b78){var _0x409930={},_0x348e1c={},_0x519ce8={'count':0x0,'rows':[]};var _0x30709d=_[_0xbb66('0x3a')](db['Network'][_0xbb66('0x3b')],function(_0x3b00ac){return{'name':_0x3b00ac[_0xbb66('0x3c')],'type':_0x3b00ac[_0xbb66('0x3d')][_0xbb66('0x3e')]};});_0x348e1c['model']=_[_0xbb66('0x3a')](_0x30709d,'name');_0x348e1c[_0xbb66('0x3f')]=_[_0xbb66('0x40')](_0x2b03f1[_0xbb66('0x3f')]);_0x348e1c['filters']=_[_0xbb66('0x41')](_0x348e1c[_0xbb66('0x42')],_0x348e1c['query']);_0x409930['attributes']=_[_0xbb66('0x41')](_0x348e1c[_0xbb66('0x42')],qs[_0xbb66('0x43')](_0x2b03f1[_0xbb66('0x3f')][_0xbb66('0x43')]));_0x409930['attributes']=_0x409930[_0xbb66('0x44')][_0xbb66('0x45')]?_0x409930['attributes']:_0x348e1c[_0xbb66('0x42')];if(!_0x2b03f1[_0xbb66('0x3f')][_0xbb66('0x46')]('nolimit')){_0x409930[_0xbb66('0x2b')]=qs[_0xbb66('0x2b')](_0x2b03f1[_0xbb66('0x3f')][_0xbb66('0x2b')]);_0x409930[_0xbb66('0x2c')]=qs[_0xbb66('0x2c')](_0x2b03f1[_0xbb66('0x3f')][_0xbb66('0x2c')]);}_0x409930[_0xbb66('0x47')]=qs[_0xbb66('0x48')](_0x2b03f1[_0xbb66('0x3f')]['sort']);_0x409930[_0xbb66('0x49')]=qs[_0xbb66('0x4a')](_[_0xbb66('0x4b')](_0x2b03f1[_0xbb66('0x3f')],_0x348e1c[_0xbb66('0x4a')]),_0x30709d);if(_0x2b03f1[_0xbb66('0x3f')][_0xbb66('0x4c')]){_0x409930['where']=_['merge'](_0x409930[_0xbb66('0x49')],{'$or':_[_0xbb66('0x3a')](_0x30709d,function(_0x5bdc0b){if(_0x5bdc0b[_0xbb66('0x3d')]!==_0xbb66('0x4d')){var _0x374b43={};_0x374b43[_0x5bdc0b['name']]={'$like':'%'+_0x2b03f1[_0xbb66('0x3f')][_0xbb66('0x4c')]+'%'};return _0x374b43;}})});}_0x409930=_[_0xbb66('0x4e')]({},_0x409930,_0x2b03f1[_0xbb66('0x4f')]);var _0x469139={'where':_0x409930[_0xbb66('0x49')]};return db[_0xbb66('0x50')]['count'](_0x469139)[_0xbb66('0x34')](function(_0x2f28cf){_0x519ce8[_0xbb66('0x2d')]=_0x2f28cf;if(_0x2b03f1[_0xbb66('0x3f')]['includeAll']){_0x409930['include']=[{'all':!![]}];}return db[_0xbb66('0x50')][_0xbb66('0x51')](_0x409930);})[_0xbb66('0x34')](function(_0x308eeb){_0x519ce8[_0xbb66('0x52')]=_0x308eeb;return _0x519ce8;})[_0xbb66('0x34')](respondWithFilteredResult(_0x368b78,_0x409930))[_0xbb66('0x26')](handleError(_0x368b78,null));};exports[_0xbb66('0x53')]=function(_0x42077d,_0x111fe8){var _0x2c7235={'raw':!![],'where':{'id':_0x42077d[_0xbb66('0x54')]['id']}},_0x587d8b={};_0x587d8b[_0xbb66('0x42')]=_[_0xbb66('0x40')](db[_0xbb66('0x50')][_0xbb66('0x3b')]);_0x587d8b[_0xbb66('0x3f')]=_['keys'](_0x42077d[_0xbb66('0x3f')]);_0x587d8b[_0xbb66('0x4a')]=_[_0xbb66('0x41')](_0x587d8b[_0xbb66('0x42')],_0x587d8b['query']);_0x2c7235[_0xbb66('0x44')]=_[_0xbb66('0x41')](_0x587d8b['model'],qs['fields'](_0x42077d[_0xbb66('0x3f')][_0xbb66('0x43')]));_0x2c7235[_0xbb66('0x44')]=_0x2c7235['attributes'][_0xbb66('0x45')]?_0x2c7235['attributes']:_0x587d8b[_0xbb66('0x42')];if(_0x42077d[_0xbb66('0x3f')][_0xbb66('0x55')]){_0x2c7235['include']=[{'all':!![]}];}_0x2c7235=_[_0xbb66('0x4e')]({},_0x2c7235,_0x42077d[_0xbb66('0x4f')]);return db[_0xbb66('0x50')][_0xbb66('0x56')](_0x2c7235)[_0xbb66('0x34')](handleEntityNotFound(_0x111fe8,null))[_0xbb66('0x34')](respondWithResult(_0x111fe8,null))[_0xbb66('0x26')](handleError(_0x111fe8,null));};exports[_0xbb66('0x57')]=function(_0x2d514a,_0x5e41d0,_0x53e6f9){var _0x584bdb;return db['sequelize'][_0xbb66('0x58')](function(_0x4427a6){return db[_0xbb66('0x50')][_0xbb66('0x57')](_0x2d514a[_0xbb66('0x59')],{'raw':!![]})[_0xbb66('0x34')](function(_0x125b07){_0x584bdb=_0x125b07;return db['Network']['findAll']({'where':{'type':_0x2d514a[_0xbb66('0x59')]['type']},'raw':!![]});})['then'](function(_0x517d0b){if(_0x584bdb[_0xbb66('0x3d')][_0xbb66('0x5a')]()==_0xbb66('0x5b')){var _0x595550=fs[_0xbb66('0x5c')](path[_0xbb66('0x5d')](config[_0xbb66('0x5e')],'server/files/templates/stun_multiple.ejs'),_0xbb66('0x5f'));var _0x2e0b2c=ejs[_0xbb66('0x60')](_0x595550,{'networks':_0x517d0b||[]});fs[_0xbb66('0x61')](_0xbb66('0x62'),_0x2e0b2c);return respondWithRpcPromise('Reload',_0xbb66('0x57'),{'module':_0xbb66('0x63')});}else if(_0x584bdb[_0xbb66('0x3d')][_0xbb66('0x5a')]()==_0xbb66('0x64')){var _0x1d15cc=fs[_0xbb66('0x5c')](path[_0xbb66('0x5d')](config[_0xbb66('0x5e')],_0xbb66('0x65')),'utf8');var _0x381edf=ejs['render'](_0x1d15cc,{'networks':_0x517d0b||[]});fs['writeFileSync'](_0xbb66('0x66'),_0x381edf);return respondWithRpcPromise(_0xbb66('0x67'),_0xbb66('0x57'),{'module':_0xbb66('0x63')});}else{var _0x3bd2d4=fs[_0xbb66('0x5c')](path[_0xbb66('0x5d')](config[_0xbb66('0x5e')],_0xbb66('0x68')),'utf8');var _0x540143=ejs[_0xbb66('0x60')](_0x3bd2d4,{'networks':_0x517d0b||[]});fs['writeFileSync'](util[_0xbb66('0x69')](_0xbb66('0x6a'),_0x2d514a[_0xbb66('0x59')][_0xbb66('0x3d')][_0xbb66('0x6b')]()),_0x540143);return respondWithRpcPromise('Reload',_0xbb66('0x57'),{'module':'chan_sip.so'});}return null;})[_0xbb66('0x34')](function(){return _0x584bdb;});})['then'](respondWithResult(_0x5e41d0,0xc9))[_0xbb66('0x26')](handleError(_0x5e41d0,null));};exports['update']=function(_0x192c0c,_0xa551e5,_0x1bf58f){var _0x45821e;return db[_0xbb66('0x6c')][_0xbb66('0x58')](function(_0x472fe7){return db[_0xbb66('0x50')][_0xbb66('0x56')]({'where':{'id':_0x192c0c['params']['id']}})[_0xbb66('0x34')](handleEntityNotFound(_0xa551e5,null))[_0xbb66('0x34')](saveUpdates(_0x192c0c[_0xbb66('0x59')],null))[_0xbb66('0x34')](function(_0x405e27){if(_0x405e27){_0x45821e=_0x405e27;return db[_0xbb66('0x50')]['findAll']({'where':{'type':_0x45821e['type']},'raw':!![]});}return null;})[_0xbb66('0x34')](function(_0xc6ea17){if(_0x45821e[_0xbb66('0x3d')][_0xbb66('0x5a')]()==_0xbb66('0x5b')){var _0x533ee9=fs[_0xbb66('0x5c')](path['join'](config[_0xbb66('0x5e')],_0xbb66('0x6d')),_0xbb66('0x5f'));var _0x2845fb=ejs[_0xbb66('0x60')](_0x533ee9,{'networks':_0xc6ea17||[]});fs[_0xbb66('0x61')](_0xbb66('0x62'),_0x2845fb);return respondWithRpcPromise(_0xbb66('0x67'),_0xbb66('0x33'),{'module':_0xbb66('0x63')});}else if(_0x45821e[_0xbb66('0x3d')][_0xbb66('0x5a')]()=='TURN'){var _0x4391ad=fs[_0xbb66('0x5c')](path['join'](config[_0xbb66('0x5e')],_0xbb66('0x65')),_0xbb66('0x5f'));var _0x5ab0a8=ejs[_0xbb66('0x60')](_0x4391ad,{'networks':_0xc6ea17||[]});fs[_0xbb66('0x61')](_0xbb66('0x66'),_0x5ab0a8);return respondWithRpcPromise(_0xbb66('0x67'),'update',{'module':'res_stun_monitor.so'});}else{var _0xed7095=fs[_0xbb66('0x5c')](path[_0xbb66('0x5d')](config[_0xbb66('0x5e')],_0xbb66('0x68')),_0xbb66('0x5f'));var _0x374d8d=ejs[_0xbb66('0x60')](_0xed7095,{'networks':_0xc6ea17||[]});fs[_0xbb66('0x61')](util['format'](_0xbb66('0x6a'),_0x192c0c[_0xbb66('0x59')]['type'][_0xbb66('0x6b')]()),_0x374d8d);return respondWithRpcPromise(_0xbb66('0x67'),_0xbb66('0x33'),{'module':_0xbb66('0x6e')});}return null;})[_0xbb66('0x34')](function(_0x3b9344){if(_0x3b9344){return _0x45821e;}return null;});})[_0xbb66('0x34')](respondWithResult(_0xa551e5,null))[_0xbb66('0x26')](handleError(_0xa551e5,null));};exports[_0xbb66('0x35')]=function(_0xa1fb13,_0x42043e,_0x58bbd2){var _0x30a0b7;return db[_0xbb66('0x50')][_0xbb66('0x56')]({'where':{'id':_0xa1fb13[_0xbb66('0x54')]['id']}})['then'](function(_0x3b3745){_0x30a0b7=_0x3b3745;return _0x3b3745;})['then'](handleEntityNotFound(_0x42043e,null))[_0xbb66('0x34')](removeEntity(_0x42043e,null))[_0xbb66('0x34')](function(){if(_0x30a0b7){return db[_0xbb66('0x50')][_0xbb66('0x51')]({'where':{'type':_0x30a0b7['type']},'raw':!![]});}})[_0xbb66('0x34')](function(_0x11fa87){if(_0x30a0b7['type'][_0xbb66('0x5a')]()=='STUN'){var _0x2b8907=fs[_0xbb66('0x5c')](path[_0xbb66('0x5d')](config['root'],_0xbb66('0x6d')),_0xbb66('0x5f'));var _0x134e31=ejs['render'](_0x2b8907,{'networks':_0x11fa87||[]});fs[_0xbb66('0x61')](_0xbb66('0x62'),_0x134e31);return respondWithRpcPromise('Reload',_0xbb66('0x35'),{'module':_0xbb66('0x63')});}else if(_0x30a0b7[_0xbb66('0x3d')][_0xbb66('0x5a')]()==_0xbb66('0x64')){var _0x149bf4=fs[_0xbb66('0x5c')](path['join'](config[_0xbb66('0x5e')],'server/files/templates/turn_multiple.ejs'),_0xbb66('0x5f'));var _0x553f57=ejs[_0xbb66('0x60')](_0x149bf4,{'networks':_0x11fa87||[]});fs[_0xbb66('0x61')]('/etc/asterisk/turn_xcally.conf',_0x553f57);return respondWithRpcPromise(_0xbb66('0x67'),'destroy',{'module':_0xbb66('0x63')});}else{var _0x1a58f0=fs[_0xbb66('0x5c')](path[_0xbb66('0x5d')](config[_0xbb66('0x5e')],'server/files/templates/network.ejs'),_0xbb66('0x5f'));var _0x235ee7=ejs[_0xbb66('0x60')](_0x1a58f0,{'networks':_0x11fa87||[]});fs[_0xbb66('0x61')](util[_0xbb66('0x69')](_0xbb66('0x6a'),_0xa1fb13[_0xbb66('0x59')]['type'][_0xbb66('0x6b')]()),_0x235ee7);return respondWithRpcPromise(_0xbb66('0x67'),_0xbb66('0x35'),{'module':_0xbb66('0x6e')});}return null;})['catch'](handleError(_0x42043e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index d29974a..c23a7d8 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 _0xc874=['../../config/logger','api','request-promise','path','rimraf','./network.attributes','exports','define','Network','network','lodash'];(function(_0x14c240,_0x1d23fc){var _0x518d01=function(_0x4256b0){while(--_0x4256b0){_0x14c240['push'](_0x14c240['shift']());}};_0x518d01(++_0x1d23fc);}(_0xc874,0x154));var _0x4c87=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xc874[_0x32d457];return _0x338386;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var logger=require(_0x4c87('0x1'))(_0x4c87('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4c87('0x3'));var fs=require('fs');var path=require(_0x4c87('0x4'));var rimraf=require(_0x4c87('0x5'));var config=require('../../config/environment');var attributes=require(_0x4c87('0x6'));module[_0x4c87('0x7')]=function(_0x5d63ae,_0x46e0f5){return _0x5d63ae[_0x4c87('0x8')](_0x4c87('0x9'),attributes,{'tableName':_0x4c87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b32=['exports','define','Network','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes'];(function(_0x24e0a2,_0x22977e){var _0x9b9e2e=function(_0x5c632f){while(--_0x5c632f){_0x24e0a2['push'](_0x24e0a2['shift']());}};_0x9b9e2e(++_0x22977e);}(_0x1b32,0x85));var _0x21b3=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x1b32[_0x411017];return _0x2adeea;};'use strict';var _=require('lodash');var util=require(_0x21b3('0x0'));var logger=require(_0x21b3('0x1'))(_0x21b3('0x2'));var moment=require(_0x21b3('0x3'));var BPromise=require(_0x21b3('0x4'));var rp=require(_0x21b3('0x5'));var fs=require('fs');var path=require(_0x21b3('0x6'));var rimraf=require(_0x21b3('0x7'));var config=require(_0x21b3('0x8'));var attributes=require(_0x21b3('0x9'));module[_0x21b3('0xa')]=function(_0x403803,_0x37859f){return _0x403803[_0x21b3('0xb')](_0x21b3('0xc'),attributes,{'tableName':'network','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 8adfb10..b5ed71c 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x3c3b8f,_0x1fa3d6){_0x3c3b8f=_0x3c3b8f-0x0;var _0xdfbf17=_0x7a54[_0x3c3b8f];return _0xdfbf17;};'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 _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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x941dfe,_0x54fc9e){_0x941dfe=_0x941dfe-0x0;var _0x5cd77f=_0x7a54[_0x941dfe];return _0x5cd77f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 0748565..fd57df6 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 _0x5e49=['getApplications','getInteractions','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','send','put','/:id','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x5e49,0x119));var _0x95e4=function(_0x4b18ea,_0x2c070a){_0x4b18ea=_0x4b18ea-0x0;var _0x28ec1c=_0x5e49[_0x4b18ea];return _0x28ec1c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x95e4('0x0'));var timeout=require(_0x95e4('0x1'));var express=require(_0x95e4('0x2'));var router=express[_0x95e4('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x95e4('0x4'));var config=require(_0x95e4('0x5'));var controller=require('./openchannelAccount.controller');router[_0x95e4('0x6')]('/',auth[_0x95e4('0x7')](),controller[_0x95e4('0x8')]);router['get'](_0x95e4('0x9'),auth['isAuthenticated'](),controller[_0x95e4('0xa')]);router['get']('/:id',auth[_0x95e4('0x7')](),controller['show']);router[_0x95e4('0x6')](_0x95e4('0xb'),auth[_0x95e4('0x7')](),controller[_0x95e4('0xc')]);router[_0x95e4('0x6')](_0x95e4('0xd'),auth['isAuthenticated'](),controller[_0x95e4('0xe')]);router[_0x95e4('0x6')]('/:id/applications',auth[_0x95e4('0x7')](),controller[_0x95e4('0xf')]);router[_0x95e4('0x6')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x95e4('0x10')]);router['get']('/:id/users',auth[_0x95e4('0x7')](),controller[_0x95e4('0x11')]);router[_0x95e4('0x12')]('/',auth[_0x95e4('0x7')](),controller[_0x95e4('0x13')]);router[_0x95e4('0x12')](_0x95e4('0xb'),auth['isAuthenticated'](),controller[_0x95e4('0x14')]);router[_0x95e4('0x12')](_0x95e4('0xd'),auth[_0x95e4('0x7')](),controller[_0x95e4('0x15')]);router['post'](_0x95e4('0x16'),controller[_0x95e4('0x17')]);router[_0x95e4('0x12')](_0x95e4('0x18'),auth[_0x95e4('0x7')](),controller[_0x95e4('0x19')]);router[_0x95e4('0x12')]('/:id/users',auth[_0x95e4('0x7')](),controller[_0x95e4('0x1a')]);router['post'](_0x95e4('0x1b'),auth[_0x95e4('0x7')](),controller[_0x95e4('0x1c')]);router[_0x95e4('0x1d')](_0x95e4('0x1e'),auth[_0x95e4('0x7')](),controller['update']);router['delete'](_0x95e4('0x1e'),auth['isAuthenticated'](),controller[_0x95e4('0x1f')]);router[_0x95e4('0x20')](_0x95e4('0xb'),auth[_0x95e4('0x7')](),controller[_0x95e4('0x21')]);router[_0x95e4('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x95e4('0x22')]);router[_0x95e4('0x20')]('/:id/users',auth[_0x95e4('0x7')](),controller[_0x95e4('0x23')]);module[_0x95e4('0x24')]=router; \ No newline at end of file +var _0x898a=['getInteractions','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions'];(function(_0x37ae2e,_0x35be3a){var _0x19c50f=function(_0x49732a){while(--_0x49732a){_0x37ae2e['push'](_0x37ae2e['shift']());}};_0x19c50f(++_0x35be3a);}(_0x898a,0x8f));var _0xa898=function(_0x2d7a41,_0x9bc524){_0x2d7a41=_0x2d7a41-0x0;var _0x397ef3=_0x898a[_0x2d7a41];return _0x397ef3;};'use strict';var multer=require('multer');var util=require(_0xa898('0x0'));var path=require(_0xa898('0x1'));var timeout=require(_0xa898('0x2'));var express=require(_0xa898('0x3'));var router=express[_0xa898('0x4')]();var fs_extra=require(_0xa898('0x5'));var auth=require(_0xa898('0x6'));var interaction=require(_0xa898('0x7'));var config=require(_0xa898('0x8'));var controller=require(_0xa898('0x9'));router[_0xa898('0xa')]('/',auth[_0xa898('0xb')](),controller[_0xa898('0xc')]);router['get']('/describe',auth[_0xa898('0xb')](),controller[_0xa898('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa898('0xe')]);router[_0xa898('0xa')](_0xa898('0xf'),auth[_0xa898('0xb')](),controller[_0xa898('0x10')]);router['get'](_0xa898('0x11'),auth[_0xa898('0xb')](),controller['getAnswers']);router[_0xa898('0xa')](_0xa898('0x12'),auth[_0xa898('0xb')](),controller[_0xa898('0x13')]);router[_0xa898('0xa')](_0xa898('0x14'),auth[_0xa898('0xb')](),controller[_0xa898('0x15')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xa898('0x16')]);router[_0xa898('0x17')]('/',auth[_0xa898('0xb')](),controller[_0xa898('0x18')]);router[_0xa898('0x17')](_0xa898('0xf'),auth[_0xa898('0xb')](),controller[_0xa898('0x19')]);router['post'](_0xa898('0x11'),auth['isAuthenticated'](),controller[_0xa898('0x1a')]);router[_0xa898('0x17')](_0xa898('0x1b'),controller[_0xa898('0x1c')]);router[_0xa898('0x17')](_0xa898('0x12'),auth[_0xa898('0xb')](),controller[_0xa898('0x1d')]);router[_0xa898('0x17')](_0xa898('0x1e'),auth['isAuthenticated'](),controller[_0xa898('0x1f')]);router['post'](_0xa898('0x20'),auth[_0xa898('0xb')](),controller[_0xa898('0x21')]);router[_0xa898('0x22')](_0xa898('0x23'),auth[_0xa898('0xb')](),controller[_0xa898('0x24')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xa898('0x25')](_0xa898('0xf'),auth[_0xa898('0xb')](),controller[_0xa898('0x26')]);router[_0xa898('0x25')](_0xa898('0x11'),auth['isAuthenticated'](),controller[_0xa898('0x27')]);router[_0xa898('0x25')](_0xa898('0x1e'),auth[_0xa898('0xb')](),controller[_0xa898('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 78c396a..5c35f68 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 _0x8265=['generate','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name'];(function(_0x3eb457,_0x23e5c9){var _0x4298a4=function(_0x101cd6){while(--_0x101cd6){_0x3eb457['push'](_0x3eb457['shift']());}};_0x4298a4(++_0x23e5c9);}(_0x8265,0x188));var _0x5826=function(_0x47b0f2,_0x28c6a4){_0x47b0f2=_0x47b0f2-0x0;var _0x32dbd2=_0x8265[_0x47b0f2];return _0x32dbd2;};'use strict';var Sequelize=require(_0x5826('0x0'));var rs=require('randomstring');module[_0x5826('0x1')]={'name':{'type':Sequelize[_0x5826('0x2')],'unique':_0x5826('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x5826('0x2')],'defaultValue':function(){return rs[_0x5826('0x4')]();}},'replyUri':{'type':Sequelize[_0x5826('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5826('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5826('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x5826('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5826('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5826('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5826('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5826('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x5826('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x5826('0x5')],'defaultValue':![],'comment':_0x5826('0x8'),'set':function(_0x20fd08){if(!_0x20fd08)this[_0x5826('0x9')](_0x5826('0xa'),null);this[_0x5826('0x9')](_0x5826('0xb'),_0x20fd08);}}}; \ No newline at end of file +var _0x4e51=['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','randomstring','exports','STRING','name','generate','TEXT'];(function(_0x1238e0,_0x16bd9b){var _0x59dfc8=function(_0x3cd547){while(--_0x3cd547){_0x1238e0['push'](_0x1238e0['shift']());}};_0x59dfc8(++_0x16bd9b);}(_0x4e51,0x1a7));var _0x14e5=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0x4e51[_0xb83ec2];return _0x4d2fbf;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x14e5('0x0'));module[_0x14e5('0x1')]={'name':{'type':Sequelize[_0x14e5('0x2')],'unique':_0x14e5('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x14e5('0x2')],'defaultValue':function(){return rs[_0x14e5('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x14e5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x14e5('0x5')],'defaultValue':function(){return _0x14e5('0x6');}},'notificationSound':{'type':Sequelize[_0x14e5('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x14e5('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x14e5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x14e5('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x14e5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x14e5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x14e5('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x14e5('0x7')],'defaultValue':![],'comment':_0x14e5('0xa'),'set':function(_0x5b2482){if(!_0x5b2482)this[_0x14e5('0xb')]('mandatoryDispositionPauseId',null);this[_0x14e5('0xb')](_0x14e5('0xc'),_0x5b2482);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index b3a6ca1..c75e36e 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 _0x2b90=['Start','startRouting','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','Contact','Owner','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','end','status','json','offset','limit','count','set','apply','reject','update','destroy','get','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','show','params','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','include','removeDispositions','CannedAnswer','nolimit','order','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','DESC','OpenchannelApplication','List','account','applications','Applications','list','orderBy','priority','asc','from','ListId','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','UserId','User','unshift','agent','forcedOwnership'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x2b90,0x196));var _0x02b9=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x2b90[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x02b9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x02b9('0x1'));var moment=require('moment');var BPromise=require(_0x02b9('0x2'));var Mustache=require('mustache');var util=require(_0x02b9('0x3'));var path=require(_0x02b9('0x4'));var sox=require(_0x02b9('0x5'));var csv=require(_0x02b9('0x6'));var ejs=require(_0x02b9('0x7'));var fs=require('fs');var fs_extra=require(_0x02b9('0x8'));var _=require('lodash');var squel=require(_0x02b9('0x9'));var crypto=require(_0x02b9('0xa'));var jsforce=require(_0x02b9('0xb'));var deskjs=require(_0x02b9('0xc'));var toCsv=require(_0x02b9('0x6'));var querystring=require(_0x02b9('0xd'));var Papa=require(_0x02b9('0xe'));var Redis=require(_0x02b9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x02b9('0x10'));var as=require(_0x02b9('0x11'));var hardwareService=require(_0x02b9('0x12'));var logger=require('../../config/logger')(_0x02b9('0x13'));var utils=require('../../config/utils');var config=require(_0x02b9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x02b9('0x15'))['db'];config[_0x02b9('0x16')]=_[_0x02b9('0x17')](config[_0x02b9('0x16')],{'host':_0x02b9('0x18'),'port':0x18eb});var socket=require(_0x02b9('0x19'))(new Redis(config[_0x02b9('0x16')]));require(_0x02b9('0x1a'))[_0x02b9('0x1b')](socket);var jayson=require(_0x02b9('0x1c'));var client=jayson[_0x02b9('0x1d')][_0x02b9('0x1e')]({'port':0x232c});var client9002=jayson[_0x02b9('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54fc76,_0x21a623,_0x3e0670,_0x130c2f){return new BPromise(function(_0x2eb98b,_0x32d084){var _0x4fc8d7=_0x130c2f||client;return _0x4fc8d7['request'](_0x54fc76,_0x3e0670)[_0x02b9('0x1f')](function(_0x1092e6){logger['info'](_0x02b9('0x20'),_0x21a623,_0x02b9('0x21'));logger[_0x02b9('0x22')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x21a623,_0x02b9('0x21'),JSON['stringify'](_0x1092e6));if(_0x1092e6[_0x02b9('0x23')]){if(_0x1092e6[_0x02b9('0x23')][_0x02b9('0x24')]===0x1f4){logger['error'](_0x02b9('0x20'),_0x21a623,_0x1092e6[_0x02b9('0x23')][_0x02b9('0x25')]);return _0x32d084(_0x1092e6['error'][_0x02b9('0x25')]);}logger[_0x02b9('0x23')](_0x02b9('0x20'),_0x21a623,_0x1092e6[_0x02b9('0x23')][_0x02b9('0x25')]);return _0x2eb98b(_0x1092e6[_0x02b9('0x23')][_0x02b9('0x25')]);}else{logger['info'](_0x02b9('0x20'),_0x21a623,_0x02b9('0x21'));_0x2eb98b(_0x1092e6[_0x02b9('0x26')]['message']);}})['catch'](function(_0x4fdd8c){logger['error'](_0x02b9('0x20'),_0x21a623,_0x4fdd8c);_0x32d084(_0x4fdd8c);});});}function respondWithStatusCode(_0x18c35f,_0x54cb82){_0x54cb82=_0x54cb82||0xcc;return function(_0x403da3){if(_0x403da3){return _0x18c35f[_0x02b9('0x27')](_0x54cb82);}return _0x18c35f['status'](_0x54cb82)[_0x02b9('0x28')]();};}function respondWithResult(_0x486279,_0x475024){_0x475024=_0x475024||0xc8;return function(_0xa35324){if(_0xa35324){return _0x486279[_0x02b9('0x29')](_0x475024)[_0x02b9('0x2a')](_0xa35324);}};}function respondWithFilteredResult(_0x47aad7,_0x5f6a60){return function(_0x273f2f){if(_0x273f2f){var _0x5cc582=typeof _0x5f6a60[_0x02b9('0x2b')]==='undefined'&&typeof _0x5f6a60[_0x02b9('0x2c')]==='undefined';var _0x1b9e25=_0x273f2f[_0x02b9('0x2d')];var _0x145cf5=_0x5cc582?0x0:_0x5f6a60[_0x02b9('0x2b')];var _0x2dca3a=_0x5cc582?_0x273f2f[_0x02b9('0x2d')]:_0x5f6a60[_0x02b9('0x2b')]+_0x5f6a60['limit'];var _0x51be0e;if(_0x2dca3a>=_0x1b9e25){_0x2dca3a=_0x1b9e25;_0x51be0e=0xc8;}else{_0x51be0e=0xce;}_0x47aad7[_0x02b9('0x29')](_0x51be0e);return _0x47aad7[_0x02b9('0x2e')]('Content-Range',_0x145cf5+'-'+_0x2dca3a+'/'+_0x1b9e25)[_0x02b9('0x2a')](_0x273f2f);}return null;};}function patchUpdates(_0x4cb418){return function(_0x3ca6a7){try{jsonpatch[_0x02b9('0x2f')](_0x3ca6a7,_0x4cb418,!![]);}catch(_0x5f11c9){return BPromise[_0x02b9('0x30')](_0x5f11c9);}return _0x3ca6a7['save']();};}function saveUpdates(_0x8bbd0b,_0x515f67){return function(_0x44f72a){if(_0x44f72a){return _0x44f72a[_0x02b9('0x31')](_0x8bbd0b)[_0x02b9('0x1f')](function(_0xca0bdb){return _0xca0bdb;});}return null;};}function removeEntity(_0x110fb2,_0x30cd1b){return function(_0x1a90a7){if(_0x1a90a7){return _0x1a90a7[_0x02b9('0x32')]()['then'](function(){var _0x14cdc0=_0x1a90a7[_0x02b9('0x33')]({'plain':!![]});var _0x9cdbac='OpenchannelAccounts';return db[_0x02b9('0x34')]['destroy']({'where':{'type':_0x9cdbac,'resourceId':_0x14cdc0['id']}})[_0x02b9('0x1f')](function(){return _0x1a90a7;});})[_0x02b9('0x1f')](function(){_0x110fb2['status'](0xcc)[_0x02b9('0x28')]();});}};}function handleEntityNotFound(_0x2114e4,_0x23fe60){return function(_0x4c0695){if(!_0x4c0695){_0x2114e4[_0x02b9('0x27')](0x194);}return _0x4c0695;};}function handleError(_0x544e34,_0x48b5bc){_0x48b5bc=_0x48b5bc||0x1f4;return function(_0x16f2fa){logger[_0x02b9('0x23')](_0x16f2fa[_0x02b9('0x35')]);if(_0x16f2fa['name']){delete _0x16f2fa[_0x02b9('0x36')];}_0x544e34[_0x02b9('0x29')](_0x48b5bc)[_0x02b9('0x37')](_0x16f2fa);};}exports['index']=function(_0x1515f6,_0xbb1e2){var _0x1b05e3={'include':[{'model':db[_0x02b9('0x38')],'as':_0x02b9('0x39')}]},_0x3b46e7={},_0xf2d7c2={'count':0x0,'rows':[]};var _0x3ac020=_['map'](db[_0x02b9('0x3a')]['rawAttributes'],function(_0x54f13c){return{'name':_0x54f13c[_0x02b9('0x3b')],'type':_0x54f13c[_0x02b9('0x3c')][_0x02b9('0x3d')]};});_0x3b46e7[_0x02b9('0x3e')]=_[_0x02b9('0x3f')](_0x3ac020,_0x02b9('0x36'));_0x3b46e7[_0x02b9('0x40')]=_[_0x02b9('0x41')](_0x1515f6[_0x02b9('0x40')]);_0x3b46e7['filters']=_[_0x02b9('0x42')](_0x3b46e7['model'],_0x3b46e7[_0x02b9('0x40')]);_0x1b05e3[_0x02b9('0x43')]=_[_0x02b9('0x42')](_0x3b46e7['model'],qs[_0x02b9('0x44')](_0x1515f6['query'][_0x02b9('0x44')]));_0x1b05e3[_0x02b9('0x43')]=_0x1b05e3['attributes'][_0x02b9('0x45')]?_0x1b05e3[_0x02b9('0x43')]:_0x3b46e7[_0x02b9('0x3e')];if(!_0x1515f6[_0x02b9('0x40')][_0x02b9('0x46')]('nolimit')){_0x1b05e3['limit']=qs['limit'](_0x1515f6['query'][_0x02b9('0x2c')]);_0x1b05e3[_0x02b9('0x2b')]=qs[_0x02b9('0x2b')](_0x1515f6[_0x02b9('0x40')][_0x02b9('0x2b')]);}_0x1b05e3['order']=qs[_0x02b9('0x47')](_0x1515f6[_0x02b9('0x40')][_0x02b9('0x47')]);_0x1b05e3[_0x02b9('0x48')]=qs[_0x02b9('0x49')](_[_0x02b9('0x4a')](_0x1515f6[_0x02b9('0x40')],_0x3b46e7['filters']),_0x3ac020);if(_0x1515f6['query'][_0x02b9('0x4b')]){_0x1b05e3[_0x02b9('0x48')]=_[_0x02b9('0x4c')](_0x1b05e3['where'],{'$or':_[_0x02b9('0x3f')](_0x3ac020,function(_0x948795){if(_0x948795[_0x02b9('0x3c')]!=='VIRTUAL'){var _0x209252={};_0x209252[_0x948795[_0x02b9('0x36')]]={'$like':'%'+_0x1515f6[_0x02b9('0x40')][_0x02b9('0x4b')]+'%'};return _0x209252;}})});}_0x1b05e3=_[_0x02b9('0x4c')]({},_0x1b05e3,_0x1515f6[_0x02b9('0x4d')]);var _0x374a5a={'where':_0x1b05e3[_0x02b9('0x48')]};return db['OpenchannelAccount'][_0x02b9('0x2d')](_0x374a5a)[_0x02b9('0x1f')](function(_0x4c4d69){_0xf2d7c2[_0x02b9('0x2d')]=_0x4c4d69;if(_0x1515f6[_0x02b9('0x40')][_0x02b9('0x4e')]){_0x1b05e3['include']=[{'all':!![]}];}return db[_0x02b9('0x3a')][_0x02b9('0x4f')](_0x1b05e3);})[_0x02b9('0x1f')](function(_0x3722c5){_0xf2d7c2[_0x02b9('0x50')]=_0x3722c5;return _0xf2d7c2;})[_0x02b9('0x1f')](respondWithFilteredResult(_0xbb1e2,_0x1b05e3))['catch'](handleError(_0xbb1e2,null));};exports[_0x02b9('0x51')]=function(_0x93e15e,_0x4442ea){var _0x2318a1={'raw':![],'where':{'id':_0x93e15e[_0x02b9('0x52')]['id']},'include':[{'model':db[_0x02b9('0x38')],'as':_0x02b9('0x39')}]},_0xcee106={};_0xcee106[_0x02b9('0x3e')]=_['keys'](db['OpenchannelAccount'][_0x02b9('0x53')]);_0xcee106[_0x02b9('0x40')]=_['keys'](_0x93e15e[_0x02b9('0x40')]);_0xcee106[_0x02b9('0x49')]=_['intersection'](_0xcee106[_0x02b9('0x3e')],_0xcee106[_0x02b9('0x40')]);_0x2318a1['attributes']=_[_0x02b9('0x42')](_0xcee106[_0x02b9('0x3e')],qs[_0x02b9('0x44')](_0x93e15e[_0x02b9('0x40')][_0x02b9('0x44')]));_0x2318a1[_0x02b9('0x43')]=_0x2318a1[_0x02b9('0x43')][_0x02b9('0x45')]?_0x2318a1['attributes']:_0xcee106[_0x02b9('0x3e')];if(_0x93e15e['query'][_0x02b9('0x4e')]){_0x2318a1['include']=[{'all':!![]}];}_0x2318a1=_[_0x02b9('0x4c')]({},_0x2318a1,_0x93e15e[_0x02b9('0x4d')]);return db[_0x02b9('0x3a')]['find'](_0x2318a1)[_0x02b9('0x1f')](handleEntityNotFound(_0x4442ea,null))[_0x02b9('0x1f')](respondWithResult(_0x4442ea,null))[_0x02b9('0x54')](handleError(_0x4442ea,null));};exports[_0x02b9('0x55')]=function(_0x1093be,_0x4b7a25){return db[_0x02b9('0x3a')]['create'](_0x1093be[_0x02b9('0x56')],{})[_0x02b9('0x1f')](function(_0x44d88d){var _0x2059a7=_0x1093be[_0x02b9('0x57')][_0x02b9('0x33')]({'plain':!![]});if(!_0x2059a7)throw new Error(_0x02b9('0x58'));if(_0x2059a7[_0x02b9('0x59')]===_0x02b9('0x57')){var _0x4b17a6=_0x44d88d[_0x02b9('0x33')]({'plain':!![]});var _0x5037cc=_0x02b9('0x5a');return db[_0x02b9('0x5b')][_0x02b9('0x5c')]({'where':{'name':_0x5037cc,'userProfileId':_0x2059a7[_0x02b9('0x5d')]},'raw':!![]})[_0x02b9('0x1f')](function(_0x598782){if(_0x598782&&_0x598782[_0x02b9('0x5e')]===0x0){return db[_0x02b9('0x34')]['create']({'name':_0x4b17a6[_0x02b9('0x36')],'resourceId':_0x4b17a6['id'],'type':_0x598782['name'],'sectionId':_0x598782['id']},{})[_0x02b9('0x1f')](function(){return _0x44d88d;});}else{return _0x44d88d;}})['catch'](function(_0x26a27c){logger[_0x02b9('0x23')](_0x02b9('0x5f'),_0x26a27c);throw _0x26a27c;});}return _0x44d88d;})[_0x02b9('0x1f')](respondWithResult(_0x4b7a25,0xc9))[_0x02b9('0x54')](handleError(_0x4b7a25,null));};exports[_0x02b9('0x31')]=function(_0x1d9bf2,_0x267594){if(_0x1d9bf2[_0x02b9('0x56')]['id']){delete _0x1d9bf2['body']['id'];}return db[_0x02b9('0x3a')][_0x02b9('0x5c')]({'where':{'id':_0x1d9bf2[_0x02b9('0x52')]['id']},'include':[{'model':db[_0x02b9('0x38')],'as':_0x02b9('0x39')}]})[_0x02b9('0x1f')](handleEntityNotFound(_0x267594,null))[_0x02b9('0x1f')](saveUpdates(_0x1d9bf2[_0x02b9('0x56')],null))[_0x02b9('0x1f')](respondWithResult(_0x267594,null))['catch'](handleError(_0x267594,null));};exports[_0x02b9('0x32')]=function(_0x41d60c,_0x482267){return db[_0x02b9('0x3a')][_0x02b9('0x5c')]({'where':{'id':_0x41d60c[_0x02b9('0x52')]['id']}})[_0x02b9('0x1f')](handleEntityNotFound(_0x482267,null))[_0x02b9('0x1f')](removeEntity(_0x482267,null))['catch'](handleError(_0x482267,null));};exports[_0x02b9('0x60')]=function(_0x2c9b07,_0x2555b4){return db[_0x02b9('0x3a')][_0x02b9('0x60')]()[_0x02b9('0x1f')](respondWithResult(_0x2555b4,null))['catch'](handleError(_0x2555b4,null));};exports[_0x02b9('0x61')]=function(_0x1142bd,_0x55f7f9,_0x3a8063){if(_0x1142bd[_0x02b9('0x56')]['id']){delete _0x1142bd[_0x02b9('0x56')]['id'];}return db[_0x02b9('0x3a')]['find']({'where':{'id':_0x1142bd['params']['id']}})['then'](handleEntityNotFound(_0x55f7f9,null))['then'](function(_0x59fc1b){if(_0x59fc1b){_0x1142bd['body'][_0x02b9('0x62')]=_0x59fc1b['id'];return db['Disposition'][_0x02b9('0x55')](_0x1142bd[_0x02b9('0x56')]);}})[_0x02b9('0x1f')](respondWithResult(_0x55f7f9,null))[_0x02b9('0x54')](handleError(_0x55f7f9,null));};exports[_0x02b9('0x63')]=function(_0x34073e,_0xf00c40,_0xd16538){var _0x9b99ac={'raw':![],'where':{}};var _0x2e178c={};var _0x239080={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x02b9('0x64')]({'where':{'id':_0x34073e['params']['id']}})['then'](handleEntityNotFound(_0xf00c40,null))[_0x02b9('0x1f')](function(_0x5d17ed){if(_0x5d17ed){_0x2e178c[_0x02b9('0x3e')]=_[_0x02b9('0x41')](db[_0x02b9('0x65')]['rawAttributes']);_0x2e178c[_0x02b9('0x40')]=_[_0x02b9('0x41')](_0x34073e['query']);_0x2e178c[_0x02b9('0x49')]=_['intersection'](_0x2e178c[_0x02b9('0x3e')],_0x2e178c[_0x02b9('0x40')]);_0x9b99ac[_0x02b9('0x43')]=_[_0x02b9('0x42')](_0x2e178c['model'],qs[_0x02b9('0x44')](_0x34073e[_0x02b9('0x40')]['fields']));_0x9b99ac[_0x02b9('0x43')]=_0x9b99ac['attributes']['length']?_0x9b99ac['attributes']:_0x2e178c[_0x02b9('0x3e')];if(!_0x34073e[_0x02b9('0x40')]['hasOwnProperty']('nolimit')){_0x9b99ac[_0x02b9('0x2c')]=qs['limit'](_0x34073e['query'][_0x02b9('0x2c')]);_0x9b99ac[_0x02b9('0x2b')]=qs[_0x02b9('0x2b')](_0x34073e[_0x02b9('0x40')][_0x02b9('0x2b')]);}_0x9b99ac['order']=qs[_0x02b9('0x47')](_0x34073e[_0x02b9('0x40')][_0x02b9('0x47')]);_0x9b99ac['where']=qs[_0x02b9('0x49')](_[_0x02b9('0x4a')](_0x34073e[_0x02b9('0x40')],_0x2e178c[_0x02b9('0x49')]));_0x9b99ac[_0x02b9('0x48')]['OpenchannelAccountId']=_0x5d17ed['id'];if(_0x34073e['query']['filter']){_0x9b99ac[_0x02b9('0x48')]=_[_0x02b9('0x4c')](_0x9b99ac[_0x02b9('0x48')],{'$or':_['map'](_0x9b99ac[_0x02b9('0x43')],function(_0xde8711){var _0x4bb638={};_0x4bb638[_0xde8711]={'$like':'%'+_0x34073e[_0x02b9('0x40')][_0x02b9('0x4b')]+'%'};return _0x4bb638;})});}_0x9b99ac=_[_0x02b9('0x4c')]({},_0x9b99ac,_0x34073e[_0x02b9('0x4d')]);return db[_0x02b9('0x65')][_0x02b9('0x2d')]({'where':_0x9b99ac[_0x02b9('0x48')]})[_0x02b9('0x1f')](function(_0x34b25c){_0x239080[_0x02b9('0x2d')]=_0x34b25c;if(_0x34073e[_0x02b9('0x40')][_0x02b9('0x4e')]){_0x9b99ac[_0x02b9('0x66')]=[{'all':!![]}];}return db[_0x02b9('0x65')][_0x02b9('0x4f')](_0x9b99ac);})[_0x02b9('0x1f')](function(_0x1e7030){_0x239080['rows']=_0x1e7030;return _0x239080;});}})['then'](respondWithFilteredResult(_0xf00c40,_0x9b99ac))[_0x02b9('0x54')](handleError(_0xf00c40,null));};exports[_0x02b9('0x67')]=function(_0x4a3985,_0x55ad29,_0x175ca3){return db[_0x02b9('0x3a')][_0x02b9('0x5c')]({'where':{'id':_0x4a3985[_0x02b9('0x52')]['id']}})[_0x02b9('0x1f')](handleEntityNotFound(_0x55ad29,null))['then'](function(_0x1130d1){if(_0x1130d1){return _0x1130d1['removeDispositions'](_0x4a3985[_0x02b9('0x40')]['ids']);}})[_0x02b9('0x1f')](respondWithStatusCode(_0x55ad29,null))[_0x02b9('0x54')](handleError(_0x55ad29,null));};exports['addAnswer']=function(_0x1d4134,_0x2148a0,_0x423067){if(_0x1d4134[_0x02b9('0x56')]['id']){delete _0x1d4134['body']['id'];}return db[_0x02b9('0x3a')]['find']({'where':{'id':_0x1d4134[_0x02b9('0x52')]['id']}})['then'](handleEntityNotFound(_0x2148a0,null))['then'](function(_0x184e33){if(_0x184e33){_0x1d4134[_0x02b9('0x56')][_0x02b9('0x62')]=_0x184e33['id'];return db[_0x02b9('0x68')][_0x02b9('0x55')](_0x1d4134[_0x02b9('0x56')]);}})[_0x02b9('0x1f')](respondWithResult(_0x2148a0,null))[_0x02b9('0x54')](handleError(_0x2148a0,null));};exports['getAnswers']=function(_0x1f70e5,_0x36f463,_0x5607ff){var _0x36d597={'raw':![],'where':{}};var _0x4fa24c={};var _0x12d673={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x02b9('0x64')]({'where':{'id':_0x1f70e5[_0x02b9('0x52')]['id']}})['then'](handleEntityNotFound(_0x36f463,null))[_0x02b9('0x1f')](function(_0x45fcd6){if(_0x45fcd6){_0x4fa24c[_0x02b9('0x3e')]=_[_0x02b9('0x41')](db['CannedAnswer'][_0x02b9('0x53')]);_0x4fa24c[_0x02b9('0x40')]=_[_0x02b9('0x41')](_0x1f70e5[_0x02b9('0x40')]);_0x4fa24c['filters']=_[_0x02b9('0x42')](_0x4fa24c[_0x02b9('0x3e')],_0x4fa24c['query']);_0x36d597[_0x02b9('0x43')]=_[_0x02b9('0x42')](_0x4fa24c[_0x02b9('0x3e')],qs['fields'](_0x1f70e5['query'][_0x02b9('0x44')]));_0x36d597[_0x02b9('0x43')]=_0x36d597[_0x02b9('0x43')][_0x02b9('0x45')]?_0x36d597[_0x02b9('0x43')]:_0x4fa24c[_0x02b9('0x3e')];if(!_0x1f70e5[_0x02b9('0x40')]['hasOwnProperty'](_0x02b9('0x69'))){_0x36d597['limit']=qs['limit'](_0x1f70e5[_0x02b9('0x40')][_0x02b9('0x2c')]);_0x36d597[_0x02b9('0x2b')]=qs[_0x02b9('0x2b')](_0x1f70e5[_0x02b9('0x40')]['offset']);}_0x36d597[_0x02b9('0x6a')]=qs[_0x02b9('0x47')](_0x1f70e5['query']['sort']);_0x36d597['where']=qs[_0x02b9('0x49')](_[_0x02b9('0x4a')](_0x1f70e5['query'],_0x4fa24c[_0x02b9('0x49')]));_0x36d597[_0x02b9('0x48')][_0x02b9('0x62')]=_0x45fcd6['id'];if(_0x1f70e5[_0x02b9('0x40')]['filter']){_0x36d597[_0x02b9('0x48')]=_['merge'](_0x36d597[_0x02b9('0x48')],{'$or':_[_0x02b9('0x3f')](_0x36d597[_0x02b9('0x43')],function(_0x1acdc7){var _0x20bdad={};_0x20bdad[_0x1acdc7]={'$like':'%'+_0x1f70e5[_0x02b9('0x40')]['filter']+'%'};return _0x20bdad;})});}_0x36d597=_['merge']({},_0x36d597,_0x1f70e5['options']);return db['CannedAnswer'][_0x02b9('0x2d')]({'where':_0x36d597[_0x02b9('0x48')]})[_0x02b9('0x1f')](function(_0x6266b0){_0x12d673[_0x02b9('0x2d')]=_0x6266b0;if(_0x1f70e5[_0x02b9('0x40')]['includeAll']){_0x36d597[_0x02b9('0x66')]=[{'all':!![]}];}return db['CannedAnswer'][_0x02b9('0x4f')](_0x36d597);})[_0x02b9('0x1f')](function(_0x254bf7){_0x12d673[_0x02b9('0x50')]=_0x254bf7;return _0x12d673;});}})[_0x02b9('0x1f')](respondWithFilteredResult(_0x36f463,_0x36d597))['catch'](handleError(_0x36f463,null));};exports[_0x02b9('0x6b')]=function(_0x1ac6af,_0x17f949,_0x376cc8){return db[_0x02b9('0x3a')][_0x02b9('0x5c')]({'where':{'id':_0x1ac6af['params']['id']}})[_0x02b9('0x1f')](handleEntityNotFound(_0x17f949,null))[_0x02b9('0x1f')](function(_0x41420b){if(_0x41420b){return _0x41420b['removeAnswers'](_0x1ac6af[_0x02b9('0x40')][_0x02b9('0x6c')]);}})['then'](respondWithStatusCode(_0x17f949,null))[_0x02b9('0x54')](handleError(_0x17f949,null));};exports[_0x02b9('0x6d')]=function(_0x64ad33,_0x43211c,_0x2af98a){var _0x3ad516={'body':_0x64ad33['body'],'channel':_0x02b9('0x6e')};var _0x100e45=[];var _0x7d1d30=[];var _0x28d657={};var _0x44d077=![];return db[_0x02b9('0x6f')][_0x02b9('0x60')]()['then'](function(_0x11007b){if(!_0x11007b){throw new db[(_0x02b9('0x70'))][(_0x02b9('0x71'))](_0x02b9('0x72'));}_0x100e45=_[_0x02b9('0x73')](_[_0x02b9('0x41')](_0x11007b),[_0x02b9('0x74'),_0x02b9('0x75')]);_0x7d1d30=_[_0x02b9('0x73')](_[_0x02b9('0x41')](_0x11007b),['createdAt',_0x02b9('0x75'),_0x02b9('0x76'),'ListId']);if(_0x64ad33[_0x02b9('0x56')]['id']){delete _0x64ad33['body']['id'];}if(_[_0x02b9('0x77')](_0x64ad33['body']['from'])){throw new db[(_0x02b9('0x70'))][(_0x02b9('0x71'))](_0x02b9('0x78'));}if(_[_0x02b9('0x77')](_0x64ad33[_0x02b9('0x56')][_0x02b9('0x56')])||_0x64ad33[_0x02b9('0x56')]['body']===''){throw new db[(_0x02b9('0x70'))]['ValidationError'](_0x02b9('0x79'));}if(_[_0x02b9('0x77')](_0x64ad33[_0x02b9('0x56')][_0x02b9('0x7a')])){throw new db['Sequelize'][(_0x02b9('0x71'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x7d1d30);}if(!_[_0x02b9('0x7b')](_0x7d1d30,_0x64ad33[_0x02b9('0x56')][_0x02b9('0x7a')])){throw new db[(_0x02b9('0x70'))][(_0x02b9('0x71'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x7d1d30);}_0x28d657[_0x64ad33[_0x02b9('0x56')][_0x02b9('0x7a')]]=_0x64ad33[_0x02b9('0x56')]['from'];})[_0x02b9('0x1f')](function(){return db['OpenchannelAccount'][_0x02b9('0x5c')]({'where':{'id':_0x64ad33['params']['id']},'include':[{'model':db[_0x02b9('0x7c')],'as':'List','include':[{'model':db[_0x02b9('0x6f')],'as':_0x02b9('0x7d'),'where':_0x28d657,'limit':0x1,'order':[[_0x02b9('0x75'),_0x02b9('0x7e')]]}]},{'model':db[_0x02b9('0x7f')],'as':'Applications'}]});})[_0x02b9('0x1f')](handleEntityNotFound(_0x43211c,null))[_0x02b9('0x1f')](function(_0x23f178){if(_0x23f178&&_0x23f178[_0x02b9('0x80')]){_0x3ad516[_0x02b9('0x81')]=_0x23f178;_0x3ad516[_0x02b9('0x82')]=_0x23f178[_0x02b9('0x83')];_0x3ad516[_0x02b9('0x84')]=_0x23f178['List'];_0x3ad516[_0x02b9('0x82')]=_[_0x02b9('0x85')](_0x3ad516['applications'],[_0x02b9('0x86')],[_0x02b9('0x87')]);if(_0x3ad516[_0x02b9('0x81')][_0x02b9('0x83')]){delete _0x3ad516['account'][_0x02b9('0x83')];}if(_0x3ad516[_0x02b9('0x81')][_0x02b9('0x80')]&&_0x3ad516[_0x02b9('0x81')][_0x02b9('0x80')][_0x02b9('0x7d')][_0x02b9('0x45')]){return _0x3ad516[_0x02b9('0x81')]['List'][_0x02b9('0x7d')][0x0];}var _0x4ded0c=_['defaults'](_0x64ad33[_0x02b9('0x56')],{'firstName':_0x64ad33[_0x02b9('0x56')][_0x02b9('0x88')],'ListId':_0x23f178[_0x02b9('0x89')]});_0x4ded0c[_0x64ad33[_0x02b9('0x56')][_0x02b9('0x7a')]]=_0x64ad33['body']['from'];return db['CmContact']['create'](_0x4ded0c,{'fields':_0x100e45,'raw':!![]});}})[_0x02b9('0x1f')](handleEntityNotFound(_0x43211c,null))['then'](function(_0x1ac7de){_0x3ad516[_0x02b9('0x8a')]=_0x1ac7de;if(_0x1ac7de){var _0x3c89e4={'ContactId':_0x1ac7de['id'],'OpenchannelAccountId':_0x64ad33[_0x02b9('0x52')]['id'],'from':(_0x1ac7de[_0x02b9('0x8b')]||'')+'\x20'+(_0x1ac7de[_0x02b9('0x8c')]||'')};var _0x2b5968={'OpenchannelAccountId':_0x64ad33[_0x02b9('0x52')]['id'],'closed':![]};if(_0x64ad33[_0x02b9('0x56')][_0x02b9('0x8d')]){_0x2b5968[_0x02b9('0x8d')]=_0x64ad33[_0x02b9('0x56')][_0x02b9('0x8d')];return db['OpenchannelInteraction'][_0x02b9('0x5c')]({'where':_0x2b5968})[_0x02b9('0x1f')](function(_0x4cfece){if(_0x4cfece){return[_0x4cfece,![]];}_0x3c89e4[_0x02b9('0x8d')]=_0x64ad33[_0x02b9('0x56')][_0x02b9('0x8d')];_0x3c89e4[_0x02b9('0x8e')]=_0x64ad33['body'][_0x02b9('0x8e')];return db[_0x02b9('0x8f')]['create'](_0x3c89e4)['then'](function(_0x530602){return[_0x530602,!![]];});});}else{_0x2b5968[_0x02b9('0x8d')]=null;}_0x2b5968[_0x02b9('0x90')]=_0x1ac7de['id'];return db[_0x02b9('0x8f')][_0x02b9('0x5c')]({'where':_0x2b5968})[_0x02b9('0x1f')](function(_0x17f28a){if(_0x17f28a){return[_0x17f28a,![]];}return db[_0x02b9('0x8f')][_0x02b9('0x55')](_0x3c89e4)['then'](function(_0x5cd494){return[_0x5cd494,!![]];});});}})[_0x02b9('0x91')](function(_0x371539,_0x314c1e){if(_0x371539){_0x44d077=_0x314c1e;if(!_0x314c1e){var _0x5b1580={'from':(_0x3ad516[_0x02b9('0x8a')][_0x02b9('0x8b')]||'')+'\x20'+(_0x3ad516[_0x02b9('0x8a')][_0x02b9('0x8c')]||'')};if(_0x64ad33[_0x02b9('0x56')]['threadId']&&_0x64ad33[_0x02b9('0x56')][_0x02b9('0x92')]&&_0x64ad33['body'][_0x02b9('0x8d')]!=_0x64ad33[_0x02b9('0x56')][_0x02b9('0x92')]){_0x5b1580[_0x02b9('0x8d')]=_0x64ad33[_0x02b9('0x56')][_0x02b9('0x92')];}return _0x371539[_0x02b9('0x31')](_0x5b1580);}else{return _0x371539;}}})[_0x02b9('0x1f')](function(_0x5ccb6b){_0x3ad516[_0x02b9('0x93')]=_0x5ccb6b['get']({'plain':!![]});_0x3ad516[_0x02b9('0x93')][_0x02b9('0x94')]=_0x44d077;if(_0x3ad516[_0x02b9('0x93')]['created']){if(_0x3ad516[_0x02b9('0x81')][_0x02b9('0x95')]){_0x3ad516[_0x02b9('0x82')]['push']({'id':0x0,'priority':_0x3ad516[_0x02b9('0x82')][_0x02b9('0x45')]+0x1,'app':_0x02b9('0x96'),'appdata':'unmanaged','interval':_0x02b9('0x97')});}}return db[_0x02b9('0x98')][_0x02b9('0x55')]({'body':_0x64ad33[_0x02b9('0x56')][_0x02b9('0x56')],'OpenchannelAccountId':_0x64ad33[_0x02b9('0x52')]['id'],'OpenchannelInteractionId':_0x5ccb6b['id'],'direction':'in','ContactId':_0x3ad516[_0x02b9('0x8a')]['id'],'AttachmentId':_0x64ad33[_0x02b9('0x56')]['AttachmentId']});})[_0x02b9('0x1f')](function(_0x129c8c){_0x3ad516['message']=_0x129c8c;if(_0x3ad516['interaction'][_0x02b9('0x99')]){return db[_0x02b9('0x9a')][_0x02b9('0x5c')]({'attributes':['id',_0x02b9('0x36')],'where':{'id':_0x3ad516[_0x02b9('0x93')][_0x02b9('0x99')]}})[_0x02b9('0x1f')](function(_0x363d38){if(_0x363d38){_0x3ad516[_0x02b9('0x82')][_0x02b9('0x9b')]({'id':0x0,'priority':0x0,'app':_0x02b9('0x9c'),'appdata':_0x363d38[_0x02b9('0x36')]+','+(_0x3ad516[_0x02b9('0x81')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x3ad516[_0x02b9('0x9d')]=![];}return respondWithRpcPromise(_0x02b9('0x9e'),'startRouting',_0x3ad516);});}return respondWithRpcPromise(_0x02b9('0x9e'),_0x02b9('0x9f'),_0x3ad516);})[_0x02b9('0x1f')](function(_0x27f14d){respondWithRpcPromise(_0x02b9('0xa0'),_0x02b9('0xa0'),{'event':_0x02b9('0x6d'),'message':_0x27f14d},client9002);return _0x27f14d;})[_0x02b9('0x1f')](respondWithResult(_0x43211c,null))[_0x02b9('0x54')](handleError(_0x43211c,null));};exports['addApplications']=function(_0x517bce,_0x29d3e6){var _0x5b3f9b=_0x517bce['params']['id'];var _0x57adad=_0x517bce['body'];var _0x20bd24=0xc8;var _0x1c0fa3=null;return db[_0x02b9('0xa1')][_0x02b9('0xa2')]({'isolationLevel':db[_0x02b9('0xa1')][_0x02b9('0xa3')][_0x02b9('0xa4')][_0x02b9('0xa5')]},function(_0x211170){return db[_0x02b9('0x3a')]['findOne']({'where':{'id':_0x5b3f9b},'transaction':_0x211170})['then'](function(_0x5d50c5){if(_0x5d50c5){return db[_0x02b9('0x7f')]['destroy']({'where':{'OpenchannelAccountId':_0x5b3f9b},'transaction':_0x211170})[_0x02b9('0x1f')](function(){var _0x5d49e0=_['map'](_0x57adad,function(_0x36b0c2){_0x36b0c2[_0x02b9('0x62')]=_0x5b3f9b;return _0x36b0c2;});return db['OpenchannelApplication'][_0x02b9('0xa6')](_0x5d49e0,{'transaction':_0x211170});});}else{_0x20bd24=0x194;_0x1c0fa3=[];}});})[_0x02b9('0x1f')](function(){if(_0x20bd24!==0x194){return db[_0x02b9('0x7f')][_0x02b9('0xa7')]({'where':{'OpenchannelAccountId':_0x5b3f9b},'order':_0x02b9('0x86')})[_0x02b9('0x1f')](function(_0x164cc7){_0x1c0fa3=_0x164cc7;});}})[_0x02b9('0x54')](function(_0x57d1ff){_0x20bd24=0x1f4;logger[_0x02b9('0x23')](_0x57d1ff['stack']);if(_0x57d1ff[_0x02b9('0x36')]){delete _0x57d1ff[_0x02b9('0x36')];}_0x1c0fa3=_0x57d1ff;})[_0x02b9('0xa8')](function(){if(_0x1c0fa3===null){_0x29d3e6[_0x02b9('0x27')](_0x20bd24);}else{if(_0x20bd24===0x1f4){_0x29d3e6[_0x02b9('0x29')](_0x20bd24)[_0x02b9('0x37')](_0x1c0fa3);}else{_0x29d3e6['status'](_0x20bd24)[_0x02b9('0x2a')](_0x1c0fa3);}}});};exports[_0x02b9('0xa9')]=function(_0x2c1861,_0x1120ed,_0xdc872c){var _0x340cb8={};var _0x3f888b={};var _0x129bcb;var _0x154f60;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2c1861[_0x02b9('0x52')]['id']}})['then'](handleEntityNotFound(_0x1120ed,null))[_0x02b9('0x1f')](function(_0x55c7f7){if(_0x55c7f7){_0x129bcb=_0x55c7f7;_0x3f888b[_0x02b9('0x3e')]=_[_0x02b9('0x41')](db[_0x02b9('0x7f')][_0x02b9('0x53')]);_0x3f888b[_0x02b9('0x40')]=_[_0x02b9('0x41')](_0x2c1861[_0x02b9('0x40')]);_0x3f888b[_0x02b9('0x49')]=_['intersection'](_0x3f888b['model'],_0x3f888b[_0x02b9('0x40')]);_0x340cb8[_0x02b9('0x43')]=_[_0x02b9('0x42')](_0x3f888b[_0x02b9('0x3e')],qs[_0x02b9('0x44')](_0x2c1861[_0x02b9('0x40')][_0x02b9('0x44')]));_0x340cb8[_0x02b9('0x43')]=_0x340cb8[_0x02b9('0x43')]['length']?_0x340cb8[_0x02b9('0x43')]:_0x3f888b[_0x02b9('0x3e')];_0x340cb8[_0x02b9('0x6a')]=qs[_0x02b9('0x47')](_0x2c1861[_0x02b9('0x40')][_0x02b9('0x47')]);_0x340cb8['where']=qs['filters'](_['pick'](_0x2c1861[_0x02b9('0x40')],_0x3f888b['filters']));if(_0x2c1861[_0x02b9('0x40')]['filter']){_0x340cb8[_0x02b9('0x48')]=_[_0x02b9('0x4c')](_0x340cb8[_0x02b9('0x48')],{'$or':_[_0x02b9('0x3f')](_0x340cb8[_0x02b9('0x43')],function(_0x2cbbc7){var _0x442ee4={};_0x442ee4[_0x2cbbc7]={'$like':'%'+_0x2c1861[_0x02b9('0x40')][_0x02b9('0x4b')]+'%'};return _0x442ee4;})});}_0x340cb8=_[_0x02b9('0x4c')]({},_0x340cb8,_0x2c1861[_0x02b9('0x4d')]);return _0x129bcb[_0x02b9('0xa9')](_0x340cb8);}})[_0x02b9('0x1f')](function(_0xadf1b6){if(_0xadf1b6){_0x154f60=_0xadf1b6[_0x02b9('0x45')];if(!_0x2c1861[_0x02b9('0x40')][_0x02b9('0x46')](_0x02b9('0x69'))){_0x340cb8[_0x02b9('0x2c')]=qs['limit'](_0x2c1861[_0x02b9('0x40')][_0x02b9('0x2c')]);_0x340cb8['offset']=qs[_0x02b9('0x2b')](_0x2c1861[_0x02b9('0x40')][_0x02b9('0x2b')]);}return _0x129bcb['getApplications'](_0x340cb8);}})[_0x02b9('0x1f')](function(_0x25c6ea){if(_0x25c6ea){return _0x25c6ea?{'count':_0x154f60,'rows':_0x25c6ea}:null;}})[_0x02b9('0x1f')](respondWithResult(_0x1120ed,null))['catch'](handleError(_0x1120ed,null));};exports['getInteractions']=function(_0x365777,_0x17d414,_0x17fd6b){var _0x16998a={'raw':![],'where':{}};var _0x2466b3={};var _0x543228={'count':0x0,'rows':[]};return db[_0x02b9('0x3a')][_0x02b9('0x64')]({'where':{'id':_0x365777['params']['id']}})[_0x02b9('0x1f')](handleEntityNotFound(_0x17d414,null))[_0x02b9('0x1f')](function(_0x11400f){if(_0x11400f){_0x2466b3['model']=_[_0x02b9('0x41')](db[_0x02b9('0x8f')][_0x02b9('0x53')]);_0x2466b3['query']=_[_0x02b9('0x41')](_0x365777[_0x02b9('0x40')]);_0x2466b3[_0x02b9('0x49')]=_[_0x02b9('0x42')](_0x2466b3[_0x02b9('0x3e')],_0x2466b3[_0x02b9('0x40')]);_0x16998a['attributes']=_[_0x02b9('0x42')](_0x2466b3[_0x02b9('0x3e')],qs['fields'](_0x365777[_0x02b9('0x40')]['fields']));_0x16998a[_0x02b9('0x43')]=_0x16998a[_0x02b9('0x43')][_0x02b9('0x45')]?_0x16998a['attributes']:_0x2466b3[_0x02b9('0x3e')];if(!_0x365777[_0x02b9('0x40')][_0x02b9('0x46')](_0x02b9('0x69'))){_0x16998a[_0x02b9('0x2c')]=qs[_0x02b9('0x2c')](_0x365777[_0x02b9('0x40')]['limit']);_0x16998a[_0x02b9('0x2b')]=qs[_0x02b9('0x2b')](_0x365777[_0x02b9('0x40')]['offset']);}_0x16998a[_0x02b9('0x6a')]=qs[_0x02b9('0x47')](_0x365777[_0x02b9('0x40')][_0x02b9('0x47')]);_0x16998a[_0x02b9('0x48')]=qs[_0x02b9('0x49')](_[_0x02b9('0x4a')](_0x365777[_0x02b9('0x40')],_0x2466b3[_0x02b9('0x49')]));_0x16998a[_0x02b9('0x48')][_0x02b9('0x62')]=_0x11400f['id'];if(_0x365777[_0x02b9('0x40')][_0x02b9('0x4b')]){_0x16998a[_0x02b9('0x48')]=_[_0x02b9('0x4c')](_0x16998a[_0x02b9('0x48')],{'$or':_[_0x02b9('0x3f')](_0x16998a[_0x02b9('0x43')],function(_0x2ce9e2){var _0x402700={};_0x402700[_0x2ce9e2]={'$like':'%'+_0x365777[_0x02b9('0x40')][_0x02b9('0x4b')]+'%'};return _0x402700;})});}_0x16998a=_['merge']({},_0x16998a,_0x365777[_0x02b9('0x4d')]);return db[_0x02b9('0x8f')]['count']({'where':_0x16998a[_0x02b9('0x48')]})['then'](function(_0x4c92dd){_0x543228[_0x02b9('0x2d')]=_0x4c92dd;if(_0x365777[_0x02b9('0x40')][_0x02b9('0x4e')]){_0x16998a[_0x02b9('0x66')]=[{'model':db[_0x02b9('0x6f')],'as':_0x02b9('0xaa'),'required':![]},{'model':db[_0x02b9('0x9a')],'as':_0x02b9('0xab'),'attributes':[_0x02b9('0x36'),'fullname',_0x02b9('0xac')],'required':![]},{'model':db[_0x02b9('0xad')],'as':_0x02b9('0xae'),'attributes':['id','name',_0x02b9('0xaf')],'where':_0x365777[_0x02b9('0x40')][_0x02b9('0xb0')]?{'id':_0x365777[_0x02b9('0x40')][_0x02b9('0xb0')]}:undefined,'required':_0x365777['query'][_0x02b9('0xb0')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x02b9('0x4f')](_0x16998a);})[_0x02b9('0x1f')](function(_0x32ebe2){_0x543228[_0x02b9('0x50')]=_0x32ebe2;return _0x543228;});}})[_0x02b9('0x1f')](respondWithFilteredResult(_0x17d414,_0x16998a))[_0x02b9('0x54')](handleError(_0x17d414,null));};exports['addAgents']=function(_0x2589f1,_0x12dbc9,_0x565382){return db[_0x02b9('0x3a')][_0x02b9('0x5c')]({'where':{'id':_0x2589f1['params']['id']}})[_0x02b9('0x1f')](handleEntityNotFound(_0x12dbc9,null))['then'](function(_0x1b695e){if(_0x1b695e){return _0x1b695e[_0x02b9('0xb1')](_0x2589f1[_0x02b9('0x56')][_0x02b9('0x6c')],_[_0x02b9('0xb2')](_0x2589f1[_0x02b9('0x56')],[_0x02b9('0x6c'),'id'])||{})['spread'](function(_0x2617de){for(var _0x2efc1a=0x0;_0x2efc1a<_0x2589f1['body']['ids'][_0x02b9('0x45')];_0x2efc1a+=0x1){socket[_0x02b9('0xb3')]('userOpenchannelAccount:save',{'UserId':Number(_0x2589f1[_0x02b9('0x56')][_0x02b9('0x6c')][_0x2efc1a]),'OpenchannelAccountId':Number(_0x2589f1[_0x02b9('0x52')]['id'])});}return _0x2617de;});}})['then'](respondWithResult(_0x12dbc9,null))[_0x02b9('0x54')](handleError(_0x12dbc9,null));};exports[_0x02b9('0xb4')]=function(_0xd38471,_0x434d4b,_0x5cce7c){return db[_0x02b9('0x3a')][_0x02b9('0x5c')]({'where':{'id':_0xd38471['params']['id']}})[_0x02b9('0x1f')](handleEntityNotFound(_0x434d4b,null))[_0x02b9('0x1f')](function(_0x3c557b){if(_0x3c557b){return _0x3c557b['removeAgents'](_0xd38471[_0x02b9('0x40')][_0x02b9('0x6c')])[_0x02b9('0x1f')](function(){if(_[_0x02b9('0xb5')](_0xd38471[_0x02b9('0x40')]['ids'])){for(var _0x42b6fa=0x0;_0x42b6fa<_0xd38471['query'][_0x02b9('0x6c')][_0x02b9('0x45')];_0x42b6fa+=0x1){socket[_0x02b9('0xb3')](_0x02b9('0xb6'),{'UserId':Number(_0xd38471[_0x02b9('0x40')][_0x02b9('0x6c')][_0x42b6fa]),'OpenchannelAccountId':Number(_0xd38471[_0x02b9('0x52')]['id'])});}}else{socket[_0x02b9('0xb3')]('userOpenchannelAccount:remove',{'UserId':Number(_0xd38471['query'][_0x02b9('0x6c')]),'OpenchannelAccountId':Number(_0xd38471['params']['id'])});}});}})['then'](respondWithStatusCode(_0x434d4b,null))[_0x02b9('0x54')](handleError(_0x434d4b,null));};exports[_0x02b9('0xb7')]=function(_0x738da8,_0x25cf0e,_0x4e3570){var _0x4b7d28={};var _0x3fb90b={};var _0x44ed8f;var _0x2c1fd5;return db['OpenchannelAccount'][_0x02b9('0x64')]({'where':{'id':_0x738da8[_0x02b9('0x52')]['id']}})[_0x02b9('0x1f')](handleEntityNotFound(_0x25cf0e,null))['then'](function(_0x388d2b){if(_0x388d2b){_0x44ed8f=_0x388d2b;_0x3fb90b[_0x02b9('0x3e')]=_[_0x02b9('0x41')](db[_0x02b9('0x9a')][_0x02b9('0x53')]);_0x3fb90b['query']=_[_0x02b9('0x41')](_0x738da8[_0x02b9('0x40')]);_0x3fb90b[_0x02b9('0x49')]=_[_0x02b9('0x42')](_0x3fb90b['model'],_0x3fb90b[_0x02b9('0x40')]);_0x4b7d28[_0x02b9('0x43')]=_[_0x02b9('0x42')](_0x3fb90b['model'],qs[_0x02b9('0x44')](_0x738da8[_0x02b9('0x40')][_0x02b9('0x44')]));_0x4b7d28['attributes']=_0x4b7d28[_0x02b9('0x43')][_0x02b9('0x45')]?_0x4b7d28['attributes']:_0x3fb90b[_0x02b9('0x3e')];_0x4b7d28['order']=qs['sort'](_0x738da8[_0x02b9('0x40')][_0x02b9('0x47')]);_0x4b7d28[_0x02b9('0x48')]=qs[_0x02b9('0x49')](_[_0x02b9('0x4a')](_0x738da8[_0x02b9('0x40')],_0x3fb90b['filters']));if(_0x738da8[_0x02b9('0x40')][_0x02b9('0x4b')]){_0x4b7d28[_0x02b9('0x48')]=_[_0x02b9('0x4c')](_0x4b7d28['where'],{'$or':_['map'](_0x4b7d28['attributes'],function(_0xe7dd1d){var _0x31e124={};_0x31e124[_0xe7dd1d]={'$like':'%'+_0x738da8['query'][_0x02b9('0x4b')]+'%'};return _0x31e124;})});}_0x4b7d28=_[_0x02b9('0x4c')]({},_0x4b7d28,_0x738da8[_0x02b9('0x4d')]);return _0x44ed8f['getAgents'](_0x4b7d28);}})['then'](function(_0x139977){if(_0x139977){_0x2c1fd5=_0x139977[_0x02b9('0x45')];if(!_0x738da8[_0x02b9('0x40')]['hasOwnProperty'](_0x02b9('0x69'))){_0x4b7d28['limit']=qs['limit'](_0x738da8['query'][_0x02b9('0x2c')]);_0x4b7d28['offset']=qs[_0x02b9('0x2b')](_0x738da8[_0x02b9('0x40')][_0x02b9('0x2b')]);}return _0x44ed8f[_0x02b9('0xb7')](_0x4b7d28);}})['then'](function(_0x178d31){if(_0x178d31){return _0x178d31?{'count':_0x2c1fd5,'rows':_0x178d31}:null;}})[_0x02b9('0x1f')](respondWithResult(_0x25cf0e,null))[_0x02b9('0x54')](handleError(_0x25cf0e,null));};exports[_0x02b9('0x37')]=function(_0x58abfa,_0x166947,_0xaa3612){var _0x4d2f9e,_0x403fc2,_0x346295;if(_['isNil'](_0x58abfa[_0x02b9('0x56')]['body'])||_0x58abfa['body']['body']===''){throw new db[(_0x02b9('0x70'))][(_0x02b9('0x71'))](_0x02b9('0x79'));}if(_[_0x02b9('0x77')](_0x58abfa[_0x02b9('0x56')]['to'])){}_0x4d2f9e=_0x58abfa['body']['to'];return db[_0x02b9('0x3a')]['findOne']({'where':{'id':_0x58abfa[_0x02b9('0x52')]['id']}})[_0x02b9('0x1f')](handleEntityNotFound(_0x166947,null))['then'](function(_0x79bc1f){if(_0x79bc1f){return db[_0x02b9('0x3a')][_0x02b9('0x5c')]({'where':{'id':_0x79bc1f['id']},'include':[{'model':db[_0x02b9('0x7c')],'as':_0x02b9('0x80'),'include':[{'model':db[_0x02b9('0x6f')],'as':_0x02b9('0x7d'),'where':{[_0x79bc1f[_0x02b9('0x7a')]]:_0x4d2f9e},'limit':0x1,'order':[[_0x02b9('0x75'),_0x02b9('0x7e')]]}]}]})[_0x02b9('0x1f')](handleEntityNotFound(_0x166947,null))['then'](function(_0x372868){if(_0x372868&&_0x372868[_0x02b9('0x80')]){_0x403fc2=_0x372868['get']({'plain':!![]});if(_0x403fc2[_0x02b9('0x80')]&&_0x403fc2[_0x02b9('0x80')]['Contacts'][_0x02b9('0x45')]){return _0x403fc2[_0x02b9('0x80')][_0x02b9('0x7d')][0x0];}return db[_0x02b9('0x6f')]['create'](_[_0x02b9('0x17')](_0x58abfa[_0x02b9('0x56')],{'firstName':_0x4d2f9e,[_0x372868['mapKey']]:_0x4d2f9e,'phone':_0x4d2f9e,'ListId':_0x403fc2[_0x02b9('0x89')]}));}})[_0x02b9('0x1f')](handleEntityNotFound(_0x166947,null))['then'](function(_0x227cb8){if(_0x227cb8){_0x346295=_0x227cb8;return db['OpenchannelInteraction'][_0x02b9('0x5c')]({'where':{'ContactId':_0x346295['id'],'closed':![],'OpenchannelAccountId':_0x403fc2['id']}})[_0x02b9('0x1f')](function(_0x59d7e1){if(_0x59d7e1){return[_0x59d7e1,![]];}return db[_0x02b9('0x8f')][_0x02b9('0x55')]({'UserId':_0x58abfa[_0x02b9('0x57')]['id'],'ContactId':_0x346295['id'],'OpenchannelAccountId':_0x403fc2['id'],'lastMsgDirection':_0x02b9('0xb8'),'Messages':[_['merge'](_0x58abfa[_0x02b9('0x56')],{'read':![],'body':_0x58abfa[_0x02b9('0x56')][_0x02b9('0x56')],'OpenchannelAccountId':_0x403fc2['id'],'UserId':_0x58abfa[_0x02b9('0x57')]['id'],'ContactId':_0x346295['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})['then'](function(_0x2b82a9){return[_0x2b82a9,!![]];});});}})[_0x02b9('0x91')](function(_0x5b817b,_0xcdd1ed){if(_0xcdd1ed){return _0x5b817b;}return db[_0x02b9('0x98')][_0x02b9('0x55')](_[_0x02b9('0x4c')](_0x58abfa[_0x02b9('0x56')],{'read':![],'body':_0x58abfa[_0x02b9('0x56')][_0x02b9('0x56')],'OpenchannelAccountId':_0x403fc2['id'],'OpenchannelInteractionId':_0x5b817b['id'],'UserId':_0x58abfa['user']['id'],'ContactId':_0x346295['id']}))[_0x02b9('0x1f')](function(_0xd014c4){_0x5b817b['dataValues'][_0x02b9('0xb9')]=[];_0x5b817b[_0x02b9('0xba')][_0x02b9('0xb9')][_0x02b9('0xbb')](_0xd014c4['dataValues']);return _0x5b817b;});});}})[_0x02b9('0x1f')](respondWithResult(_0x166947,null))[_0x02b9('0x54')](handleError(_0x166947,null));}; \ No newline at end of file +var _0x63b7=['update','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','include','OpenchannelAccount','findAll','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','order','includeAll','rows','removeDispositions','ids','CannedAnswer','getAnswers','options','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','OpenchannelApplication','List','account','applications','Applications','list','orderBy','priority','asc','contact','lastName','threadId','OpenchannelInteraction','externalUrl','spread','firstName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','forcedOwnership','startRouting','Start','EventManager','addApplications','sequelize','transaction','Transaction','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','User','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x1e48d3,_0x5d8c43){var _0x2852b1=function(_0x11d7b3){while(--_0x11d7b3){_0x1e48d3['push'](_0x1e48d3['shift']());}};_0x2852b1(++_0x5d8c43);}(_0x63b7,0x14e));var _0x763b=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x63b7[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require(_0x763b('0x0'));var rimraf=require(_0x763b('0x1'));var zipdir=require(_0x763b('0x2'));var jsonpatch=require(_0x763b('0x3'));var rp=require(_0x763b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x763b('0x5'));var util=require('util');var path=require(_0x763b('0x6'));var sox=require(_0x763b('0x7'));var csv=require(_0x763b('0x8'));var ejs=require(_0x763b('0x9'));var fs=require('fs');var fs_extra=require(_0x763b('0xa'));var _=require(_0x763b('0xb'));var squel=require(_0x763b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x763b('0xd'));var toCsv=require(_0x763b('0x8'));var querystring=require(_0x763b('0xe'));var Papa=require(_0x763b('0xf'));var Redis=require(_0x763b('0x10'));var authService=require(_0x763b('0x11'));var qs=require(_0x763b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x763b('0x13'));var logger=require(_0x763b('0x14'))(_0x763b('0x15'));var utils=require(_0x763b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x763b('0x17'));var db=require(_0x763b('0x18'))['db'];config[_0x763b('0x19')]=_[_0x763b('0x1a')](config['redis'],{'host':_0x763b('0x1b'),'port':0x18eb});var socket=require(_0x763b('0x1c'))(new Redis(config[_0x763b('0x19')]));require('./openchannelAccount.socket')[_0x763b('0x1d')](socket);var jayson=require(_0x763b('0x1e'));var client=jayson[_0x763b('0x1f')][_0x763b('0x20')]({'port':0x232c});var client9002=jayson[_0x763b('0x1f')][_0x763b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x442549,_0x566323,_0x429ca9,_0x12be9e){return new BPromise(function(_0x4eeeba,_0x3c5375){var _0x21184e=_0x12be9e||client;return _0x21184e[_0x763b('0x21')](_0x442549,_0x429ca9)[_0x763b('0x22')](function(_0x480052){logger['info'](_0x763b('0x23'),_0x566323,_0x763b('0x24'));logger[_0x763b('0x25')](_0x763b('0x26'),_0x566323,_0x763b('0x24'),JSON['stringify'](_0x480052));if(_0x480052[_0x763b('0x27')]){if(_0x480052[_0x763b('0x27')][_0x763b('0x28')]===0x1f4){logger[_0x763b('0x27')](_0x763b('0x23'),_0x566323,_0x480052[_0x763b('0x27')]['message']);return _0x3c5375(_0x480052['error']['message']);}logger[_0x763b('0x27')](_0x763b('0x23'),_0x566323,_0x480052[_0x763b('0x27')][_0x763b('0x29')]);return _0x4eeeba(_0x480052['error'][_0x763b('0x29')]);}else{logger[_0x763b('0x2a')](_0x763b('0x23'),_0x566323,'request\x20sent');_0x4eeeba(_0x480052[_0x763b('0x2b')][_0x763b('0x29')]);}})['catch'](function(_0xcd599f){logger[_0x763b('0x27')](_0x763b('0x23'),_0x566323,_0xcd599f);_0x3c5375(_0xcd599f);});});}function respondWithStatusCode(_0x46709f,_0x1fbad5){_0x1fbad5=_0x1fbad5||0xcc;return function(_0x2e0e81){if(_0x2e0e81){return _0x46709f[_0x763b('0x2c')](_0x1fbad5);}return _0x46709f[_0x763b('0x2d')](_0x1fbad5)[_0x763b('0x2e')]();};}function respondWithResult(_0x41d789,_0x34430e){_0x34430e=_0x34430e||0xc8;return function(_0x4a94bd){if(_0x4a94bd){return _0x41d789['status'](_0x34430e)[_0x763b('0x2f')](_0x4a94bd);}};}function respondWithFilteredResult(_0x57720a,_0x17e13f){return function(_0x36f718){if(_0x36f718){var _0x93a4cc=typeof _0x17e13f[_0x763b('0x30')]===_0x763b('0x31')&&typeof _0x17e13f[_0x763b('0x32')]==='undefined';var _0x111392=_0x36f718['count'];var _0x5464b4=_0x93a4cc?0x0:_0x17e13f['offset'];var _0x2003dc=_0x93a4cc?_0x36f718[_0x763b('0x33')]:_0x17e13f[_0x763b('0x30')]+_0x17e13f[_0x763b('0x32')];var _0x171339;if(_0x2003dc>=_0x111392){_0x2003dc=_0x111392;_0x171339=0xc8;}else{_0x171339=0xce;}_0x57720a[_0x763b('0x2d')](_0x171339);return _0x57720a[_0x763b('0x34')](_0x763b('0x35'),_0x5464b4+'-'+_0x2003dc+'/'+_0x111392)[_0x763b('0x2f')](_0x36f718);}return null;};}function patchUpdates(_0x45a994){return function(_0x2a9d2a){try{jsonpatch[_0x763b('0x36')](_0x2a9d2a,_0x45a994,!![]);}catch(_0x974231){return BPromise[_0x763b('0x37')](_0x974231);}return _0x2a9d2a['save']();};}function saveUpdates(_0x224274,_0x868991){return function(_0x163699){if(_0x163699){return _0x163699[_0x763b('0x38')](_0x224274)[_0x763b('0x22')](function(_0x2486d9){return _0x2486d9;});}return null;};}function removeEntity(_0x2619bc,_0x5d4473){return function(_0x5555f4){if(_0x5555f4){return _0x5555f4[_0x763b('0x39')]()[_0x763b('0x22')](function(){var _0x5a054e=_0x5555f4[_0x763b('0x3a')]({'plain':!![]});var _0x3626a6=_0x763b('0x3b');return db[_0x763b('0x3c')][_0x763b('0x39')]({'where':{'type':_0x3626a6,'resourceId':_0x5a054e['id']}})[_0x763b('0x22')](function(){return _0x5555f4;});})['then'](function(){_0x2619bc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x441142,_0x1774bc){return function(_0x209db5){if(!_0x209db5){_0x441142[_0x763b('0x2c')](0x194);}return _0x209db5;};}function handleError(_0x39bb96,_0x434aa5){_0x434aa5=_0x434aa5||0x1f4;return function(_0x56782e){logger[_0x763b('0x27')](_0x56782e['stack']);if(_0x56782e[_0x763b('0x3d')]){delete _0x56782e[_0x763b('0x3d')];}_0x39bb96[_0x763b('0x2d')](_0x434aa5)[_0x763b('0x3e')](_0x56782e);};}exports[_0x763b('0x3f')]=function(_0x353f14,_0x3ba005){var _0x150781={'include':[{'model':db[_0x763b('0x40')],'as':_0x763b('0x41')}]},_0x52499a={},_0xa104c8={'count':0x0,'rows':[]};var _0x32478d=_[_0x763b('0x42')](db['OpenchannelAccount'][_0x763b('0x43')],function(_0x14d1f7){return{'name':_0x14d1f7[_0x763b('0x44')],'type':_0x14d1f7[_0x763b('0x45')][_0x763b('0x46')]};});_0x52499a['model']=_[_0x763b('0x42')](_0x32478d,_0x763b('0x3d'));_0x52499a[_0x763b('0x47')]=_[_0x763b('0x48')](_0x353f14[_0x763b('0x47')]);_0x52499a[_0x763b('0x49')]=_['intersection'](_0x52499a[_0x763b('0x4a')],_0x52499a[_0x763b('0x47')]);_0x150781[_0x763b('0x4b')]=_['intersection'](_0x52499a[_0x763b('0x4a')],qs['fields'](_0x353f14[_0x763b('0x47')][_0x763b('0x4c')]));_0x150781[_0x763b('0x4b')]=_0x150781[_0x763b('0x4b')][_0x763b('0x4d')]?_0x150781[_0x763b('0x4b')]:_0x52499a[_0x763b('0x4a')];if(!_0x353f14[_0x763b('0x47')][_0x763b('0x4e')](_0x763b('0x4f'))){_0x150781[_0x763b('0x32')]=qs[_0x763b('0x32')](_0x353f14[_0x763b('0x47')]['limit']);_0x150781[_0x763b('0x30')]=qs[_0x763b('0x30')](_0x353f14[_0x763b('0x47')][_0x763b('0x30')]);}_0x150781['order']=qs[_0x763b('0x50')](_0x353f14[_0x763b('0x47')][_0x763b('0x50')]);_0x150781[_0x763b('0x51')]=qs[_0x763b('0x49')](_[_0x763b('0x52')](_0x353f14[_0x763b('0x47')],_0x52499a[_0x763b('0x49')]),_0x32478d);if(_0x353f14['query']['filter']){_0x150781[_0x763b('0x51')]=_[_0x763b('0x53')](_0x150781[_0x763b('0x51')],{'$or':_['map'](_0x32478d,function(_0x234596){if(_0x234596[_0x763b('0x45')]!=='VIRTUAL'){var _0x547433={};_0x547433[_0x234596[_0x763b('0x3d')]]={'$like':'%'+_0x353f14[_0x763b('0x47')][_0x763b('0x54')]+'%'};return _0x547433;}})});}_0x150781=_['merge']({},_0x150781,_0x353f14['options']);var _0x35e778={'where':_0x150781['where']};return db['OpenchannelAccount'][_0x763b('0x33')](_0x35e778)[_0x763b('0x22')](function(_0x3d0757){_0xa104c8['count']=_0x3d0757;if(_0x353f14[_0x763b('0x47')]['includeAll']){_0x150781[_0x763b('0x55')]=[{'all':!![]}];}return db[_0x763b('0x56')][_0x763b('0x57')](_0x150781);})[_0x763b('0x22')](function(_0x2b13f6){_0xa104c8['rows']=_0x2b13f6;return _0xa104c8;})['then'](respondWithFilteredResult(_0x3ba005,_0x150781))[_0x763b('0x58')](handleError(_0x3ba005,null));};exports[_0x763b('0x59')]=function(_0x375b0f,_0x9ddf87){var _0x33cbe0={'raw':![],'where':{'id':_0x375b0f[_0x763b('0x5a')]['id']},'include':[{'model':db[_0x763b('0x40')],'as':_0x763b('0x41')}]},_0x56aecd={};_0x56aecd[_0x763b('0x4a')]=_[_0x763b('0x48')](db[_0x763b('0x56')][_0x763b('0x43')]);_0x56aecd[_0x763b('0x47')]=_[_0x763b('0x48')](_0x375b0f[_0x763b('0x47')]);_0x56aecd[_0x763b('0x49')]=_['intersection'](_0x56aecd[_0x763b('0x4a')],_0x56aecd['query']);_0x33cbe0[_0x763b('0x4b')]=_[_0x763b('0x5b')](_0x56aecd[_0x763b('0x4a')],qs[_0x763b('0x4c')](_0x375b0f[_0x763b('0x47')][_0x763b('0x4c')]));_0x33cbe0['attributes']=_0x33cbe0['attributes'][_0x763b('0x4d')]?_0x33cbe0['attributes']:_0x56aecd[_0x763b('0x4a')];if(_0x375b0f[_0x763b('0x47')]['includeAll']){_0x33cbe0['include']=[{'all':!![]}];}_0x33cbe0=_[_0x763b('0x53')]({},_0x33cbe0,_0x375b0f['options']);return db['OpenchannelAccount'][_0x763b('0x5c')](_0x33cbe0)[_0x763b('0x22')](handleEntityNotFound(_0x9ddf87,null))[_0x763b('0x22')](respondWithResult(_0x9ddf87,null))['catch'](handleError(_0x9ddf87,null));};exports[_0x763b('0x5d')]=function(_0x35c824,_0x43cdef){return db[_0x763b('0x56')][_0x763b('0x5d')](_0x35c824[_0x763b('0x5e')],{})[_0x763b('0x22')](function(_0x4b5c7b){var _0x2f79dd=_0x35c824[_0x763b('0x5f')][_0x763b('0x3a')]({'plain':!![]});if(!_0x2f79dd)throw new Error(_0x763b('0x60'));if(_0x2f79dd[_0x763b('0x61')]===_0x763b('0x5f')){var _0x1488ae=_0x4b5c7b[_0x763b('0x3a')]({'plain':!![]});var _0x5b191c=_0x763b('0x3b');return db[_0x763b('0x62')][_0x763b('0x5c')]({'where':{'name':_0x5b191c,'userProfileId':_0x2f79dd[_0x763b('0x63')]},'raw':!![]})[_0x763b('0x22')](function(_0x3514a0){if(_0x3514a0&&_0x3514a0[_0x763b('0x64')]===0x0){return db[_0x763b('0x3c')]['create']({'name':_0x1488ae['name'],'resourceId':_0x1488ae['id'],'type':_0x3514a0[_0x763b('0x3d')],'sectionId':_0x3514a0['id']},{})[_0x763b('0x22')](function(){return _0x4b5c7b;});}else{return _0x4b5c7b;}})[_0x763b('0x58')](function(_0x2dbddf){logger[_0x763b('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2dbddf);throw _0x2dbddf;});}return _0x4b5c7b;})[_0x763b('0x22')](respondWithResult(_0x43cdef,0xc9))[_0x763b('0x58')](handleError(_0x43cdef,null));};exports[_0x763b('0x38')]=function(_0x3f6c4d,_0x5e9dc4){if(_0x3f6c4d[_0x763b('0x5e')]['id']){delete _0x3f6c4d[_0x763b('0x5e')]['id'];}return db['OpenchannelAccount'][_0x763b('0x5c')]({'where':{'id':_0x3f6c4d['params']['id']},'include':[{'model':db[_0x763b('0x40')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x5e9dc4,null))[_0x763b('0x22')](saveUpdates(_0x3f6c4d['body'],null))['then'](respondWithResult(_0x5e9dc4,null))[_0x763b('0x58')](handleError(_0x5e9dc4,null));};exports[_0x763b('0x39')]=function(_0x1c4a56,_0x50767b){return db[_0x763b('0x56')][_0x763b('0x5c')]({'where':{'id':_0x1c4a56[_0x763b('0x5a')]['id']}})[_0x763b('0x22')](handleEntityNotFound(_0x50767b,null))[_0x763b('0x22')](removeEntity(_0x50767b,null))[_0x763b('0x58')](handleError(_0x50767b,null));};exports['describe']=function(_0x62e9ef,_0x4b725e){return db[_0x763b('0x56')][_0x763b('0x65')]()[_0x763b('0x22')](respondWithResult(_0x4b725e,null))[_0x763b('0x58')](handleError(_0x4b725e,null));};exports[_0x763b('0x66')]=function(_0xce9c1c,_0xc4f9de,_0x58a07a){if(_0xce9c1c['body']['id']){delete _0xce9c1c[_0x763b('0x5e')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0xce9c1c[_0x763b('0x5a')]['id']}})[_0x763b('0x22')](handleEntityNotFound(_0xc4f9de,null))[_0x763b('0x22')](function(_0x1351f1){if(_0x1351f1){_0xce9c1c[_0x763b('0x5e')][_0x763b('0x67')]=_0x1351f1['id'];return db[_0x763b('0x68')]['create'](_0xce9c1c[_0x763b('0x5e')]);}})['then'](respondWithResult(_0xc4f9de,null))[_0x763b('0x58')](handleError(_0xc4f9de,null));};exports[_0x763b('0x69')]=function(_0x59297f,_0x2c09d2,_0x55381a){var _0x4f890b={'raw':![],'where':{}};var _0x24d5c4={};var _0x17190e={'count':0x0,'rows':[]};return db[_0x763b('0x56')][_0x763b('0x6a')]({'where':{'id':_0x59297f['params']['id']}})['then'](handleEntityNotFound(_0x2c09d2,null))[_0x763b('0x22')](function(_0x32c19a){if(_0x32c19a){_0x24d5c4[_0x763b('0x4a')]=_[_0x763b('0x48')](db[_0x763b('0x68')][_0x763b('0x43')]);_0x24d5c4[_0x763b('0x47')]=_[_0x763b('0x48')](_0x59297f['query']);_0x24d5c4[_0x763b('0x49')]=_[_0x763b('0x5b')](_0x24d5c4[_0x763b('0x4a')],_0x24d5c4[_0x763b('0x47')]);_0x4f890b[_0x763b('0x4b')]=_['intersection'](_0x24d5c4[_0x763b('0x4a')],qs[_0x763b('0x4c')](_0x59297f[_0x763b('0x47')][_0x763b('0x4c')]));_0x4f890b[_0x763b('0x4b')]=_0x4f890b[_0x763b('0x4b')][_0x763b('0x4d')]?_0x4f890b['attributes']:_0x24d5c4[_0x763b('0x4a')];if(!_0x59297f[_0x763b('0x47')]['hasOwnProperty'](_0x763b('0x4f'))){_0x4f890b[_0x763b('0x32')]=qs[_0x763b('0x32')](_0x59297f[_0x763b('0x47')][_0x763b('0x32')]);_0x4f890b[_0x763b('0x30')]=qs[_0x763b('0x30')](_0x59297f[_0x763b('0x47')][_0x763b('0x30')]);}_0x4f890b[_0x763b('0x6b')]=qs[_0x763b('0x50')](_0x59297f[_0x763b('0x47')]['sort']);_0x4f890b[_0x763b('0x51')]=qs[_0x763b('0x49')](_[_0x763b('0x52')](_0x59297f[_0x763b('0x47')],_0x24d5c4['filters']));_0x4f890b[_0x763b('0x51')]['OpenchannelAccountId']=_0x32c19a['id'];if(_0x59297f['query'][_0x763b('0x54')]){_0x4f890b[_0x763b('0x51')]=_[_0x763b('0x53')](_0x4f890b[_0x763b('0x51')],{'$or':_[_0x763b('0x42')](_0x4f890b[_0x763b('0x4b')],function(_0x52d90e){var _0x374364={};_0x374364[_0x52d90e]={'$like':'%'+_0x59297f['query'][_0x763b('0x54')]+'%'};return _0x374364;})});}_0x4f890b=_[_0x763b('0x53')]({},_0x4f890b,_0x59297f['options']);return db[_0x763b('0x68')][_0x763b('0x33')]({'where':_0x4f890b[_0x763b('0x51')]})[_0x763b('0x22')](function(_0x79b19c){_0x17190e[_0x763b('0x33')]=_0x79b19c;if(_0x59297f[_0x763b('0x47')][_0x763b('0x6c')]){_0x4f890b[_0x763b('0x55')]=[{'all':!![]}];}return db[_0x763b('0x68')][_0x763b('0x57')](_0x4f890b);})[_0x763b('0x22')](function(_0x4a6c20){_0x17190e[_0x763b('0x6d')]=_0x4a6c20;return _0x17190e;});}})[_0x763b('0x22')](respondWithFilteredResult(_0x2c09d2,_0x4f890b))[_0x763b('0x58')](handleError(_0x2c09d2,null));};exports[_0x763b('0x6e')]=function(_0xfdb3db,_0x4c6022,_0x1ef128){return db[_0x763b('0x56')][_0x763b('0x5c')]({'where':{'id':_0xfdb3db[_0x763b('0x5a')]['id']}})[_0x763b('0x22')](handleEntityNotFound(_0x4c6022,null))[_0x763b('0x22')](function(_0x19e1cb){if(_0x19e1cb){return _0x19e1cb[_0x763b('0x6e')](_0xfdb3db[_0x763b('0x47')][_0x763b('0x6f')]);}})[_0x763b('0x22')](respondWithStatusCode(_0x4c6022,null))['catch'](handleError(_0x4c6022,null));};exports['addAnswer']=function(_0xbf2884,_0x1819bf,_0x1cbe75){if(_0xbf2884[_0x763b('0x5e')]['id']){delete _0xbf2884[_0x763b('0x5e')]['id'];}return db[_0x763b('0x56')][_0x763b('0x5c')]({'where':{'id':_0xbf2884[_0x763b('0x5a')]['id']}})[_0x763b('0x22')](handleEntityNotFound(_0x1819bf,null))['then'](function(_0x2749b4){if(_0x2749b4){_0xbf2884['body'][_0x763b('0x67')]=_0x2749b4['id'];return db[_0x763b('0x70')][_0x763b('0x5d')](_0xbf2884[_0x763b('0x5e')]);}})[_0x763b('0x22')](respondWithResult(_0x1819bf,null))[_0x763b('0x58')](handleError(_0x1819bf,null));};exports[_0x763b('0x71')]=function(_0x31250b,_0xdf6e81,_0x6cc97c){var _0x44b2e4={'raw':![],'where':{}};var _0x3706e8={};var _0x2c79aa={'count':0x0,'rows':[]};return db[_0x763b('0x56')][_0x763b('0x6a')]({'where':{'id':_0x31250b['params']['id']}})[_0x763b('0x22')](handleEntityNotFound(_0xdf6e81,null))[_0x763b('0x22')](function(_0x53f268){if(_0x53f268){_0x3706e8[_0x763b('0x4a')]=_[_0x763b('0x48')](db[_0x763b('0x70')][_0x763b('0x43')]);_0x3706e8['query']=_[_0x763b('0x48')](_0x31250b['query']);_0x3706e8['filters']=_[_0x763b('0x5b')](_0x3706e8[_0x763b('0x4a')],_0x3706e8[_0x763b('0x47')]);_0x44b2e4[_0x763b('0x4b')]=_[_0x763b('0x5b')](_0x3706e8[_0x763b('0x4a')],qs['fields'](_0x31250b[_0x763b('0x47')][_0x763b('0x4c')]));_0x44b2e4['attributes']=_0x44b2e4[_0x763b('0x4b')][_0x763b('0x4d')]?_0x44b2e4[_0x763b('0x4b')]:_0x3706e8[_0x763b('0x4a')];if(!_0x31250b['query'][_0x763b('0x4e')]('nolimit')){_0x44b2e4[_0x763b('0x32')]=qs['limit'](_0x31250b[_0x763b('0x47')][_0x763b('0x32')]);_0x44b2e4[_0x763b('0x30')]=qs[_0x763b('0x30')](_0x31250b['query'][_0x763b('0x30')]);}_0x44b2e4[_0x763b('0x6b')]=qs[_0x763b('0x50')](_0x31250b['query'][_0x763b('0x50')]);_0x44b2e4['where']=qs[_0x763b('0x49')](_[_0x763b('0x52')](_0x31250b[_0x763b('0x47')],_0x3706e8[_0x763b('0x49')]));_0x44b2e4[_0x763b('0x51')][_0x763b('0x67')]=_0x53f268['id'];if(_0x31250b[_0x763b('0x47')][_0x763b('0x54')]){_0x44b2e4[_0x763b('0x51')]=_['merge'](_0x44b2e4[_0x763b('0x51')],{'$or':_['map'](_0x44b2e4[_0x763b('0x4b')],function(_0x2592cc){var _0x5a8027={};_0x5a8027[_0x2592cc]={'$like':'%'+_0x31250b[_0x763b('0x47')][_0x763b('0x54')]+'%'};return _0x5a8027;})});}_0x44b2e4=_[_0x763b('0x53')]({},_0x44b2e4,_0x31250b[_0x763b('0x72')]);return db[_0x763b('0x70')][_0x763b('0x33')]({'where':_0x44b2e4[_0x763b('0x51')]})[_0x763b('0x22')](function(_0x444e5a){_0x2c79aa['count']=_0x444e5a;if(_0x31250b[_0x763b('0x47')][_0x763b('0x6c')]){_0x44b2e4[_0x763b('0x55')]=[{'all':!![]}];}return db[_0x763b('0x70')][_0x763b('0x57')](_0x44b2e4);})['then'](function(_0x44ea51){_0x2c79aa[_0x763b('0x6d')]=_0x44ea51;return _0x2c79aa;});}})['then'](respondWithFilteredResult(_0xdf6e81,_0x44b2e4))[_0x763b('0x58')](handleError(_0xdf6e81,null));};exports[_0x763b('0x73')]=function(_0x49e0bf,_0x14a8ed,_0x66ae6d){return db['OpenchannelAccount']['find']({'where':{'id':_0x49e0bf['params']['id']}})[_0x763b('0x22')](handleEntityNotFound(_0x14a8ed,null))[_0x763b('0x22')](function(_0x402314){if(_0x402314){return _0x402314['removeAnswers'](_0x49e0bf[_0x763b('0x47')][_0x763b('0x6f')]);}})[_0x763b('0x22')](respondWithStatusCode(_0x14a8ed,null))[_0x763b('0x58')](handleError(_0x14a8ed,null));};exports[_0x763b('0x74')]=function(_0x21779b,_0x23c6aa,_0x22825e){var _0x362d70={'body':_0x21779b[_0x763b('0x5e')],'channel':'openchannel'};var _0x1e687e=[];var _0x2c7783=[];var _0x2fde9c={};var _0xfea302=![];return db[_0x763b('0x75')]['describe']()[_0x763b('0x22')](function(_0x57224d){if(!_0x57224d){throw new db[(_0x763b('0x76'))][(_0x763b('0x77'))](_0x763b('0x78'));}_0x1e687e=_['difference'](_[_0x763b('0x48')](_0x57224d),['createdAt',_0x763b('0x79')]);_0x2c7783=_[_0x763b('0x7a')](_['keys'](_0x57224d),[_0x763b('0x7b'),'updatedAt',_0x763b('0x7c'),_0x763b('0x7d')]);if(_0x21779b[_0x763b('0x5e')]['id']){delete _0x21779b[_0x763b('0x5e')]['id'];}if(_['isNil'](_0x21779b['body'][_0x763b('0x7e')])){throw new db['Sequelize'][(_0x763b('0x77'))]('from\x20is\x20mandatory');}if(_[_0x763b('0x7f')](_0x21779b[_0x763b('0x5e')][_0x763b('0x5e')])||_0x21779b[_0x763b('0x5e')][_0x763b('0x5e')]===''){throw new db[(_0x763b('0x76'))][(_0x763b('0x77'))](_0x763b('0x80'));}if(_[_0x763b('0x7f')](_0x21779b['body'][_0x763b('0x81')])){throw new db[(_0x763b('0x76'))][(_0x763b('0x77'))](_0x763b('0x82')+_0x2c7783);}if(!_['includes'](_0x2c7783,_0x21779b['body']['mapKey'])){throw new db[(_0x763b('0x76'))]['ValidationError'](_0x763b('0x83')+_0x2c7783);}_0x2fde9c[_0x21779b[_0x763b('0x5e')][_0x763b('0x81')]]=_0x21779b[_0x763b('0x5e')][_0x763b('0x7e')];})[_0x763b('0x22')](function(){return db[_0x763b('0x56')]['find']({'where':{'id':_0x21779b['params']['id']},'include':[{'model':db[_0x763b('0x84')],'as':'List','include':[{'model':db['CmContact'],'as':_0x763b('0x85'),'where':_0x2fde9c,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x763b('0x86')],'as':'Applications'}]});})[_0x763b('0x22')](handleEntityNotFound(_0x23c6aa,null))[_0x763b('0x22')](function(_0x4f390c){if(_0x4f390c&&_0x4f390c[_0x763b('0x87')]){_0x362d70[_0x763b('0x88')]=_0x4f390c;_0x362d70[_0x763b('0x89')]=_0x4f390c[_0x763b('0x8a')];_0x362d70[_0x763b('0x8b')]=_0x4f390c[_0x763b('0x87')];_0x362d70[_0x763b('0x89')]=_[_0x763b('0x8c')](_0x362d70[_0x763b('0x89')],[_0x763b('0x8d')],[_0x763b('0x8e')]);if(_0x362d70[_0x763b('0x88')][_0x763b('0x8a')]){delete _0x362d70[_0x763b('0x88')][_0x763b('0x8a')];}if(_0x362d70[_0x763b('0x88')]['List']&&_0x362d70[_0x763b('0x88')][_0x763b('0x87')][_0x763b('0x85')]['length']){return _0x362d70[_0x763b('0x88')]['List'][_0x763b('0x85')][0x0];}var _0x29575a=_[_0x763b('0x1a')](_0x21779b[_0x763b('0x5e')],{'firstName':_0x21779b[_0x763b('0x5e')][_0x763b('0x7e')],'ListId':_0x4f390c['ListId']});_0x29575a[_0x21779b[_0x763b('0x5e')][_0x763b('0x81')]]=_0x21779b[_0x763b('0x5e')][_0x763b('0x7e')];return db['CmContact'][_0x763b('0x5d')](_0x29575a,{'fields':_0x1e687e,'raw':!![]});}})['then'](handleEntityNotFound(_0x23c6aa,null))['then'](function(_0xe68001){_0x362d70[_0x763b('0x8f')]=_0xe68001;if(_0xe68001){var _0x580c78={'ContactId':_0xe68001['id'],'OpenchannelAccountId':_0x21779b[_0x763b('0x5a')]['id'],'from':(_0xe68001['firstName']||'')+'\x20'+(_0xe68001[_0x763b('0x90')]||'')};var _0x12a514={'OpenchannelAccountId':_0x21779b[_0x763b('0x5a')]['id'],'closed':![]};if(_0x21779b[_0x763b('0x5e')][_0x763b('0x91')]){_0x12a514[_0x763b('0x91')]=_0x21779b['body']['threadId'];return db[_0x763b('0x92')]['find']({'where':_0x12a514})[_0x763b('0x22')](function(_0x1b7e6c){if(_0x1b7e6c){return[_0x1b7e6c,![]];}_0x580c78[_0x763b('0x91')]=_0x21779b[_0x763b('0x5e')][_0x763b('0x91')];_0x580c78[_0x763b('0x93')]=_0x21779b[_0x763b('0x5e')][_0x763b('0x93')];return db['OpenchannelInteraction'][_0x763b('0x5d')](_0x580c78)[_0x763b('0x22')](function(_0x318a45){return[_0x318a45,!![]];});});}else{_0x12a514[_0x763b('0x91')]=null;}_0x12a514['ContactId']=_0xe68001['id'];return db['OpenchannelInteraction'][_0x763b('0x5c')]({'where':_0x12a514})[_0x763b('0x22')](function(_0x3f5b5c){if(_0x3f5b5c){return[_0x3f5b5c,![]];}return db[_0x763b('0x92')]['create'](_0x580c78)[_0x763b('0x22')](function(_0x56a76a){return[_0x56a76a,!![]];});});}})[_0x763b('0x94')](function(_0x5c3d60,_0xc0a4ed){if(_0x5c3d60){_0xfea302=_0xc0a4ed;if(!_0xc0a4ed){var _0xf4d10f={'from':(_0x362d70[_0x763b('0x8f')][_0x763b('0x95')]||'')+'\x20'+(_0x362d70['contact'][_0x763b('0x90')]||'')};if(_0x21779b[_0x763b('0x5e')][_0x763b('0x91')]&&_0x21779b[_0x763b('0x5e')][_0x763b('0x96')]&&_0x21779b[_0x763b('0x5e')]['threadId']!=_0x21779b[_0x763b('0x5e')][_0x763b('0x96')]){_0xf4d10f['threadId']=_0x21779b[_0x763b('0x5e')]['messageId'];}return _0x5c3d60[_0x763b('0x38')](_0xf4d10f);}else{return _0x5c3d60;}}})['then'](function(_0xa0406e){_0x362d70['interaction']=_0xa0406e[_0x763b('0x3a')]({'plain':!![]});_0x362d70[_0x763b('0x97')][_0x763b('0x98')]=_0xfea302;if(_0x362d70[_0x763b('0x97')]['created']){if(_0x362d70[_0x763b('0x88')][_0x763b('0x99')]){_0x362d70[_0x763b('0x89')][_0x763b('0x9a')]({'id':0x0,'priority':_0x362d70['applications']['length']+0x1,'app':_0x763b('0x9b'),'appdata':_0x763b('0x9c'),'interval':_0x763b('0x9d')});}}return db['OpenchannelMessage'][_0x763b('0x5d')]({'body':_0x21779b['body'][_0x763b('0x5e')],'OpenchannelAccountId':_0x21779b['params']['id'],'OpenchannelInteractionId':_0xa0406e['id'],'direction':'in','ContactId':_0x362d70[_0x763b('0x8f')]['id'],'AttachmentId':_0x21779b['body'][_0x763b('0x9e')]});})[_0x763b('0x22')](function(_0x4243f5){_0x362d70[_0x763b('0x29')]=_0x4243f5;if(_0x362d70['interaction']['UserId']){return db['User']['find']({'attributes':['id',_0x763b('0x3d')],'where':{'id':_0x362d70['interaction'][_0x763b('0x9f')]}})[_0x763b('0x22')](function(_0x5a97df){if(_0x5a97df){_0x362d70[_0x763b('0x89')][_0x763b('0xa0')]({'id':0x0,'priority':0x0,'app':_0x763b('0xa1'),'appdata':_0x5a97df[_0x763b('0x3d')]+','+(_0x362d70[_0x763b('0x88')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x362d70[_0x763b('0xa2')]=![];}return respondWithRpcPromise('Start',_0x763b('0xa3'),_0x362d70);});}return respondWithRpcPromise(_0x763b('0xa4'),_0x763b('0xa3'),_0x362d70);})['then'](function(_0x37e784){respondWithRpcPromise(_0x763b('0xa5'),'EventManager',{'event':_0x763b('0x74'),'message':_0x37e784},client9002);return _0x37e784;})[_0x763b('0x22')](respondWithResult(_0x23c6aa,null))['catch'](handleError(_0x23c6aa,null));};exports[_0x763b('0xa6')]=function(_0x4d7946,_0x188c53){var _0x150a7d=_0x4d7946[_0x763b('0x5a')]['id'];var _0x461d05=_0x4d7946['body'];var _0x45b996=0xc8;var _0x2c7fc9=null;return db[_0x763b('0xa7')][_0x763b('0xa8')]({'isolationLevel':db[_0x763b('0xa7')][_0x763b('0xa9')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x5efe9a){return db[_0x763b('0x56')][_0x763b('0x6a')]({'where':{'id':_0x150a7d},'transaction':_0x5efe9a})['then'](function(_0x370cf9){if(_0x370cf9){return db[_0x763b('0x86')]['destroy']({'where':{'OpenchannelAccountId':_0x150a7d},'transaction':_0x5efe9a})['then'](function(){var _0x22410b=_['map'](_0x461d05,function(_0x4ba528){_0x4ba528[_0x763b('0x67')]=_0x150a7d;return _0x4ba528;});return db['OpenchannelApplication']['bulkCreate'](_0x22410b,{'transaction':_0x5efe9a});});}else{_0x45b996=0x194;_0x2c7fc9=[];}});})[_0x763b('0x22')](function(){if(_0x45b996!==0x194){return db['OpenchannelApplication'][_0x763b('0xaa')]({'where':{'OpenchannelAccountId':_0x150a7d},'order':_0x763b('0x8d')})['then'](function(_0x1df284){_0x2c7fc9=_0x1df284;});}})[_0x763b('0x58')](function(_0x1a4158){_0x45b996=0x1f4;logger[_0x763b('0x27')](_0x1a4158[_0x763b('0xab')]);if(_0x1a4158['name']){delete _0x1a4158[_0x763b('0x3d')];}_0x2c7fc9=_0x1a4158;})[_0x763b('0xac')](function(){if(_0x2c7fc9===null){_0x188c53[_0x763b('0x2c')](_0x45b996);}else{if(_0x45b996===0x1f4){_0x188c53['status'](_0x45b996)['send'](_0x2c7fc9);}else{_0x188c53['status'](_0x45b996)['json'](_0x2c7fc9);}}});};exports[_0x763b('0xad')]=function(_0x496b22,_0x54550e,_0x2e5e89){var _0x22765b={};var _0x32112a={};var _0x5e5dbe;var _0x29fe1b;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x496b22[_0x763b('0x5a')]['id']}})[_0x763b('0x22')](handleEntityNotFound(_0x54550e,null))['then'](function(_0x2e8e67){if(_0x2e8e67){_0x5e5dbe=_0x2e8e67;_0x32112a[_0x763b('0x4a')]=_[_0x763b('0x48')](db['OpenchannelApplication'][_0x763b('0x43')]);_0x32112a['query']=_['keys'](_0x496b22[_0x763b('0x47')]);_0x32112a[_0x763b('0x49')]=_[_0x763b('0x5b')](_0x32112a[_0x763b('0x4a')],_0x32112a[_0x763b('0x47')]);_0x22765b[_0x763b('0x4b')]=_[_0x763b('0x5b')](_0x32112a['model'],qs[_0x763b('0x4c')](_0x496b22[_0x763b('0x47')][_0x763b('0x4c')]));_0x22765b[_0x763b('0x4b')]=_0x22765b[_0x763b('0x4b')][_0x763b('0x4d')]?_0x22765b[_0x763b('0x4b')]:_0x32112a['model'];_0x22765b[_0x763b('0x6b')]=qs['sort'](_0x496b22[_0x763b('0x47')][_0x763b('0x50')]);_0x22765b[_0x763b('0x51')]=qs[_0x763b('0x49')](_['pick'](_0x496b22[_0x763b('0x47')],_0x32112a[_0x763b('0x49')]));if(_0x496b22['query'][_0x763b('0x54')]){_0x22765b[_0x763b('0x51')]=_[_0x763b('0x53')](_0x22765b[_0x763b('0x51')],{'$or':_[_0x763b('0x42')](_0x22765b[_0x763b('0x4b')],function(_0xd2b465){var _0x1e1ec4={};_0x1e1ec4[_0xd2b465]={'$like':'%'+_0x496b22[_0x763b('0x47')][_0x763b('0x54')]+'%'};return _0x1e1ec4;})});}_0x22765b=_[_0x763b('0x53')]({},_0x22765b,_0x496b22[_0x763b('0x72')]);return _0x5e5dbe[_0x763b('0xad')](_0x22765b);}})[_0x763b('0x22')](function(_0x4a8432){if(_0x4a8432){_0x29fe1b=_0x4a8432[_0x763b('0x4d')];if(!_0x496b22[_0x763b('0x47')][_0x763b('0x4e')](_0x763b('0x4f'))){_0x22765b[_0x763b('0x32')]=qs['limit'](_0x496b22[_0x763b('0x47')]['limit']);_0x22765b[_0x763b('0x30')]=qs['offset'](_0x496b22[_0x763b('0x47')]['offset']);}return _0x5e5dbe[_0x763b('0xad')](_0x22765b);}})[_0x763b('0x22')](function(_0x551269){if(_0x551269){return _0x551269?{'count':_0x29fe1b,'rows':_0x551269}:null;}})[_0x763b('0x22')](respondWithResult(_0x54550e,null))['catch'](handleError(_0x54550e,null));};exports[_0x763b('0xae')]=function(_0x4c331c,_0x3a809b,_0x5d6d3e){var _0x3bdcc2={'raw':![],'where':{}};var _0xb18f1a={};var _0xcf443c={'count':0x0,'rows':[]};return db[_0x763b('0x56')]['findOne']({'where':{'id':_0x4c331c['params']['id']}})[_0x763b('0x22')](handleEntityNotFound(_0x3a809b,null))['then'](function(_0xd97105){if(_0xd97105){_0xb18f1a[_0x763b('0x4a')]=_['keys'](db[_0x763b('0x92')][_0x763b('0x43')]);_0xb18f1a[_0x763b('0x47')]=_['keys'](_0x4c331c[_0x763b('0x47')]);_0xb18f1a[_0x763b('0x49')]=_['intersection'](_0xb18f1a[_0x763b('0x4a')],_0xb18f1a['query']);_0x3bdcc2['attributes']=_[_0x763b('0x5b')](_0xb18f1a['model'],qs[_0x763b('0x4c')](_0x4c331c[_0x763b('0x47')][_0x763b('0x4c')]));_0x3bdcc2[_0x763b('0x4b')]=_0x3bdcc2[_0x763b('0x4b')][_0x763b('0x4d')]?_0x3bdcc2['attributes']:_0xb18f1a[_0x763b('0x4a')];if(!_0x4c331c[_0x763b('0x47')][_0x763b('0x4e')]('nolimit')){_0x3bdcc2['limit']=qs[_0x763b('0x32')](_0x4c331c[_0x763b('0x47')][_0x763b('0x32')]);_0x3bdcc2['offset']=qs['offset'](_0x4c331c[_0x763b('0x47')][_0x763b('0x30')]);}_0x3bdcc2[_0x763b('0x6b')]=qs[_0x763b('0x50')](_0x4c331c[_0x763b('0x47')][_0x763b('0x50')]);_0x3bdcc2[_0x763b('0x51')]=qs[_0x763b('0x49')](_[_0x763b('0x52')](_0x4c331c[_0x763b('0x47')],_0xb18f1a[_0x763b('0x49')]));_0x3bdcc2['where'][_0x763b('0x67')]=_0xd97105['id'];if(_0x4c331c['query'][_0x763b('0x54')]){_0x3bdcc2[_0x763b('0x51')]=_[_0x763b('0x53')](_0x3bdcc2[_0x763b('0x51')],{'$or':_[_0x763b('0x42')](_0x3bdcc2[_0x763b('0x4b')],function(_0x1ce523){var _0x585121={};_0x585121[_0x1ce523]={'$like':'%'+_0x4c331c[_0x763b('0x47')][_0x763b('0x54')]+'%'};return _0x585121;})});}_0x3bdcc2=_[_0x763b('0x53')]({},_0x3bdcc2,_0x4c331c['options']);return db['OpenchannelInteraction'][_0x763b('0x33')]({'where':_0x3bdcc2['where']})['then'](function(_0x4af213){_0xcf443c[_0x763b('0x33')]=_0x4af213;if(_0x4c331c[_0x763b('0x47')][_0x763b('0x6c')]){_0x3bdcc2['include']=[{'model':db[_0x763b('0x75')],'as':_0x763b('0xaf'),'required':![]},{'model':db[_0x763b('0xb0')],'as':_0x763b('0xb1'),'attributes':[_0x763b('0x3d'),_0x763b('0xb2'),'internal'],'required':![]},{'model':db[_0x763b('0xb3')],'as':_0x763b('0xb4'),'attributes':['id',_0x763b('0x3d'),_0x763b('0xb5')],'where':_0x4c331c[_0x763b('0x47')][_0x763b('0xb6')]?{'id':_0x4c331c[_0x763b('0x47')][_0x763b('0xb6')]}:undefined,'required':_0x4c331c['query']['tag']?!![]:![]}];}return db[_0x763b('0x92')]['findAll'](_0x3bdcc2);})[_0x763b('0x22')](function(_0x57821f){_0xcf443c[_0x763b('0x6d')]=_0x57821f;return _0xcf443c;});}})[_0x763b('0x22')](respondWithFilteredResult(_0x3a809b,_0x3bdcc2))[_0x763b('0x58')](handleError(_0x3a809b,null));};exports[_0x763b('0xb7')]=function(_0x17395b,_0x298b13,_0x53ab29){return db[_0x763b('0x56')][_0x763b('0x5c')]({'where':{'id':_0x17395b['params']['id']}})[_0x763b('0x22')](handleEntityNotFound(_0x298b13,null))[_0x763b('0x22')](function(_0x5b74ca){if(_0x5b74ca){return _0x5b74ca[_0x763b('0xb7')](_0x17395b[_0x763b('0x5e')][_0x763b('0x6f')],_[_0x763b('0xb8')](_0x17395b[_0x763b('0x5e')],['ids','id'])||{})[_0x763b('0x94')](function(_0x4fe102){for(var _0x2f0002=0x0;_0x2f0002<_0x17395b[_0x763b('0x5e')][_0x763b('0x6f')][_0x763b('0x4d')];_0x2f0002+=0x1){socket[_0x763b('0xb9')](_0x763b('0xba'),{'UserId':Number(_0x17395b[_0x763b('0x5e')][_0x763b('0x6f')][_0x2f0002]),'OpenchannelAccountId':Number(_0x17395b[_0x763b('0x5a')]['id'])});}return _0x4fe102;});}})['then'](respondWithResult(_0x298b13,null))['catch'](handleError(_0x298b13,null));};exports['removeAgents']=function(_0x2df8d2,_0x1f2576,_0x28a33c){return db[_0x763b('0x56')]['find']({'where':{'id':_0x2df8d2[_0x763b('0x5a')]['id']}})[_0x763b('0x22')](handleEntityNotFound(_0x1f2576,null))[_0x763b('0x22')](function(_0x1a99c9){if(_0x1a99c9){return _0x1a99c9[_0x763b('0xbb')](_0x2df8d2[_0x763b('0x47')][_0x763b('0x6f')])[_0x763b('0x22')](function(){if(_[_0x763b('0xbc')](_0x2df8d2[_0x763b('0x47')][_0x763b('0x6f')])){for(var _0x22c546=0x0;_0x22c546<_0x2df8d2[_0x763b('0x47')][_0x763b('0x6f')][_0x763b('0x4d')];_0x22c546+=0x1){socket[_0x763b('0xb9')](_0x763b('0xbd'),{'UserId':Number(_0x2df8d2[_0x763b('0x47')][_0x763b('0x6f')][_0x22c546]),'OpenchannelAccountId':Number(_0x2df8d2[_0x763b('0x5a')]['id'])});}}else{socket[_0x763b('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2df8d2[_0x763b('0x47')][_0x763b('0x6f')]),'OpenchannelAccountId':Number(_0x2df8d2[_0x763b('0x5a')]['id'])});}});}})[_0x763b('0x22')](respondWithStatusCode(_0x1f2576,null))[_0x763b('0x58')](handleError(_0x1f2576,null));};exports[_0x763b('0xbe')]=function(_0x98399a,_0x4a983d,_0xe5e4e0){var _0x277619={};var _0x58dbc7={};var _0xbf5333;var _0x53f165;return db[_0x763b('0x56')][_0x763b('0x6a')]({'where':{'id':_0x98399a['params']['id']}})[_0x763b('0x22')](handleEntityNotFound(_0x4a983d,null))['then'](function(_0x183c79){if(_0x183c79){_0xbf5333=_0x183c79;_0x58dbc7['model']=_[_0x763b('0x48')](db[_0x763b('0xb0')]['rawAttributes']);_0x58dbc7[_0x763b('0x47')]=_[_0x763b('0x48')](_0x98399a[_0x763b('0x47')]);_0x58dbc7['filters']=_[_0x763b('0x5b')](_0x58dbc7[_0x763b('0x4a')],_0x58dbc7[_0x763b('0x47')]);_0x277619[_0x763b('0x4b')]=_[_0x763b('0x5b')](_0x58dbc7[_0x763b('0x4a')],qs['fields'](_0x98399a[_0x763b('0x47')][_0x763b('0x4c')]));_0x277619['attributes']=_0x277619[_0x763b('0x4b')][_0x763b('0x4d')]?_0x277619[_0x763b('0x4b')]:_0x58dbc7[_0x763b('0x4a')];_0x277619['order']=qs[_0x763b('0x50')](_0x98399a[_0x763b('0x47')]['sort']);_0x277619[_0x763b('0x51')]=qs[_0x763b('0x49')](_['pick'](_0x98399a[_0x763b('0x47')],_0x58dbc7[_0x763b('0x49')]));if(_0x98399a[_0x763b('0x47')]['filter']){_0x277619[_0x763b('0x51')]=_[_0x763b('0x53')](_0x277619[_0x763b('0x51')],{'$or':_[_0x763b('0x42')](_0x277619['attributes'],function(_0x2383b9){var _0x2dc15f={};_0x2dc15f[_0x2383b9]={'$like':'%'+_0x98399a[_0x763b('0x47')][_0x763b('0x54')]+'%'};return _0x2dc15f;})});}_0x277619=_[_0x763b('0x53')]({},_0x277619,_0x98399a['options']);return _0xbf5333[_0x763b('0xbe')](_0x277619);}})['then'](function(_0x5e7b21){if(_0x5e7b21){_0x53f165=_0x5e7b21['length'];if(!_0x98399a[_0x763b('0x47')][_0x763b('0x4e')]('nolimit')){_0x277619[_0x763b('0x32')]=qs['limit'](_0x98399a[_0x763b('0x47')][_0x763b('0x32')]);_0x277619[_0x763b('0x30')]=qs[_0x763b('0x30')](_0x98399a['query'][_0x763b('0x30')]);}return _0xbf5333[_0x763b('0xbe')](_0x277619);}})[_0x763b('0x22')](function(_0x2b037c){if(_0x2b037c){return _0x2b037c?{'count':_0x53f165,'rows':_0x2b037c}:null;}})[_0x763b('0x22')](respondWithResult(_0x4a983d,null))['catch'](handleError(_0x4a983d,null));};exports['send']=function(_0x2d1063,_0x5e49cd,_0x4a605d){var _0x23dfa5,_0x406880,_0x4eec89;if(_['isNil'](_0x2d1063[_0x763b('0x5e')][_0x763b('0x5e')])||_0x2d1063[_0x763b('0x5e')][_0x763b('0x5e')]===''){throw new db[(_0x763b('0x76'))][(_0x763b('0x77'))](_0x763b('0x80'));}if(_[_0x763b('0x7f')](_0x2d1063[_0x763b('0x5e')]['to'])){}_0x23dfa5=_0x2d1063[_0x763b('0x5e')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2d1063[_0x763b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5e49cd,null))[_0x763b('0x22')](function(_0x2ff109){if(_0x2ff109){return db['OpenchannelAccount']['find']({'where':{'id':_0x2ff109['id']},'include':[{'model':db[_0x763b('0x84')],'as':_0x763b('0x87'),'include':[{'model':db[_0x763b('0x75')],'as':_0x763b('0x85'),'where':{[_0x2ff109['mapKey']]:_0x23dfa5},'limit':0x1,'order':[[_0x763b('0x79'),'DESC']]}]}]})[_0x763b('0x22')](handleEntityNotFound(_0x5e49cd,null))['then'](function(_0x3c0ead){if(_0x3c0ead&&_0x3c0ead[_0x763b('0x87')]){_0x406880=_0x3c0ead[_0x763b('0x3a')]({'plain':!![]});if(_0x406880[_0x763b('0x87')]&&_0x406880[_0x763b('0x87')]['Contacts'][_0x763b('0x4d')]){return _0x406880['List']['Contacts'][0x0];}return db['CmContact'][_0x763b('0x5d')](_['defaults'](_0x2d1063[_0x763b('0x5e')],{'firstName':_0x23dfa5,[_0x3c0ead[_0x763b('0x81')]]:_0x23dfa5,'phone':_0x23dfa5,'ListId':_0x406880['ListId']}));}})[_0x763b('0x22')](handleEntityNotFound(_0x5e49cd,null))[_0x763b('0x22')](function(_0x10ced7){if(_0x10ced7){_0x4eec89=_0x10ced7;return db[_0x763b('0x92')][_0x763b('0x5c')]({'where':{'ContactId':_0x4eec89['id'],'closed':![],'OpenchannelAccountId':_0x406880['id']}})[_0x763b('0x22')](function(_0x29db1d){if(_0x29db1d){return[_0x29db1d,![]];}return db[_0x763b('0x92')]['create']({'UserId':_0x2d1063[_0x763b('0x5f')]['id'],'ContactId':_0x4eec89['id'],'OpenchannelAccountId':_0x406880['id'],'lastMsgDirection':_0x763b('0xbf'),'Messages':[_[_0x763b('0x53')](_0x2d1063[_0x763b('0x5e')],{'read':![],'body':_0x2d1063[_0x763b('0x5e')]['body'],'OpenchannelAccountId':_0x406880['id'],'UserId':_0x2d1063[_0x763b('0x5f')]['id'],'ContactId':_0x4eec89['id']})]},{'include':[{'model':db[_0x763b('0xc0')],'as':'Messages'}]})['then'](function(_0x2e58d8){return[_0x2e58d8,!![]];});});}})[_0x763b('0x94')](function(_0x8afdd2,_0x3a3729){if(_0x3a3729){return _0x8afdd2;}return db[_0x763b('0xc0')][_0x763b('0x5d')](_[_0x763b('0x53')](_0x2d1063[_0x763b('0x5e')],{'read':![],'body':_0x2d1063[_0x763b('0x5e')]['body'],'OpenchannelAccountId':_0x406880['id'],'OpenchannelInteractionId':_0x8afdd2['id'],'UserId':_0x2d1063[_0x763b('0x5f')]['id'],'ContactId':_0x4eec89['id']}))[_0x763b('0x22')](function(_0x4eb8d3){_0x8afdd2[_0x763b('0xc1')]['Messages']=[];_0x8afdd2['dataValues'][_0x763b('0xc2')]['push'](_0x4eb8d3[_0x763b('0xc1')]);return _0x8afdd2;});});}})['then'](respondWithResult(_0x5e49cd,null))['catch'](handleError(_0x5e49cd,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 1f567a5..5a59661 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1339=['update','remove','emit','hasOwnProperty','exports','OpenchannelAccount','setMaxListeners','save'];(function(_0x7e1e13,_0x5260f7){var _0x15e1ef=function(_0x35a565){while(--_0x35a565){_0x7e1e13['push'](_0x7e1e13['shift']());}};_0x15e1ef(++_0x5260f7);}(_0x1339,0x1ed));var _0x9133=function(_0x4006c7,_0x26caa0){_0x4006c7=_0x4006c7-0x0;var _0x5ad016=_0x1339[_0x4006c7];return _0x5ad016;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x9133('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9133('0x1')](0x0);var events={'afterCreate':_0x9133('0x2'),'afterUpdate':_0x9133('0x3'),'afterDestroy':_0x9133('0x4')};function emitEvent(_0x192d48){return function(_0x176e80,_0x110c51,_0x558345){OpenchannelAccountEvents[_0x9133('0x5')](_0x192d48+':'+_0x176e80['id'],_0x176e80);OpenchannelAccountEvents[_0x9133('0x5')](_0x192d48,_0x176e80);_0x558345(null);};}for(var e in events){if(events[_0x9133('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x9133('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x3c81=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x51a85c,_0x2660a3){var _0x55001f=function(_0x39ec46){while(--_0x39ec46){_0x51a85c['push'](_0x51a85c['shift']());}};_0x55001f(++_0x2660a3);}(_0x3c81,0x102));var _0x13c8=function(_0x23265e,_0x2905d9){_0x23265e=_0x23265e-0x0;var _0x31393d=_0x3c81[_0x23265e];return _0x31393d;};'use strict';var EventEmitter=require(_0x13c8('0x0'));var OpenchannelAccount=require(_0x13c8('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x13c8('0x2')](0x0);var events={'afterCreate':_0x13c8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c3ba4){return function(_0x548599,_0x101d4f,_0x3ec886){OpenchannelAccountEvents[_0x13c8('0x4')](_0x5c3ba4+':'+_0x548599['id'],_0x548599);OpenchannelAccountEvents[_0x13c8('0x4')](_0x5c3ba4,_0x548599);_0x3ec886(null);};}for(var e in events){if(events[_0x13c8('0x5')](e)){var event=events[e];OpenchannelAccount[_0x13c8('0x6')](e,emitEvent(event));}}module[_0x13c8('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 89d7ddf..3c7e9dc 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(_0x5e0d80,_0x11408a){var _0x2003a3=function(_0x4e219d){while(--_0x4e219d){_0x5e0d80['push'](_0x5e0d80['shift']());}};_0x2003a3(++_0x11408a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x164f20,_0x548106){var _0xd34997=function(_0x3bc22b){while(--_0x3bc22b){_0x164f20['push'](_0x164f20['shift']());}};_0xd34997(++_0x548106);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 8a6ccbb..c42a4f0 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 _0x76dc=['error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x12f475,_0x3a1332){var _0x4af6c0=function(_0x4e5998){while(--_0x4e5998){_0x12f475['push'](_0x12f475['shift']());}};_0x4af6c0(++_0x3a1332);}(_0x76dc,0x1f2));var _0xc76d=function(_0x2a0e3f,_0x21d447){_0x2a0e3f=_0x2a0e3f-0x0;var _0x52839c=_0x76dc[_0x2a0e3f];return _0x52839c;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var moment=require(_0xc76d('0x2'));var BPromise=require(_0xc76d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc76d('0x4'));var db=require(_0xc76d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc76d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc76d('0x7'));var client=jayson[_0xc76d('0x8')][_0xc76d('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc76d('0xa')],{'host':_0xc76d('0xb'),'port':0x18eb});var socket=require(_0xc76d('0xc'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xc76d('0xd')](socket);function respondWithRpcPromise(_0x2f81bd,_0x4d625c,_0x39a47f){return new BPromise(function(_0x583e46,_0xd5c042){return client[_0xc76d('0xe')](_0x2f81bd,_0x39a47f)[_0xc76d('0xf')](function(_0x95e06b){logger[_0xc76d('0x10')](_0xc76d('0x11'),_0x4d625c,_0xc76d('0x12'));logger[_0xc76d('0x13')](_0xc76d('0x14'),_0x4d625c,_0xc76d('0x12'),JSON[_0xc76d('0x15')](_0x95e06b));if(_0x95e06b[_0xc76d('0x16')]){if(_0x95e06b[_0xc76d('0x16')][_0xc76d('0x17')]===0x1f4){logger['error'](_0xc76d('0x11'),_0x4d625c,_0x95e06b[_0xc76d('0x16')]['message']);return _0xd5c042(_0x95e06b[_0xc76d('0x16')][_0xc76d('0x18')]);}logger[_0xc76d('0x16')](_0xc76d('0x11'),_0x4d625c,_0x95e06b['error'][_0xc76d('0x18')]);return _0x583e46(_0x95e06b['error']['message']);}else{logger[_0xc76d('0x10')](_0xc76d('0x11'),_0x4d625c,_0xc76d('0x12'));_0x583e46(_0x95e06b[_0xc76d('0x19')][_0xc76d('0x18')]);}})['catch'](function(_0x20a078){logger[_0xc76d('0x16')](_0xc76d('0x11'),_0x4d625c,_0x20a078);_0xd5c042(_0x20a078);});});} \ No newline at end of file +var _0xd523=['info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message'];(function(_0x239ac7,_0x32b6d7){var _0x5dc006=function(_0x268263){while(--_0x268263){_0x239ac7['push'](_0x239ac7['shift']());}};_0x5dc006(++_0x32b6d7);}(_0xd523,0x153));var _0x3d52=function(_0x44c05d,_0x16000d){_0x44c05d=_0x44c05d-0x0;var _0x199dd7=_0xd523[_0x44c05d];return _0x199dd7;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var moment=require(_0x3d52('0x2'));var BPromise=require(_0x3d52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d52('0x4'));var db=require(_0x3d52('0x5'))['db'];var utils=require(_0x3d52('0x6'));var logger=require('../../config/logger')(_0x3d52('0x7'));var config=require(_0x3d52('0x8'));var jayson=require(_0x3d52('0x9'));var client=jayson[_0x3d52('0xa')]['http']({'port':0x232a});config['redis']=_[_0x3d52('0xb')](config[_0x3d52('0xc')],{'host':_0x3d52('0xd'),'port':0x18eb});var socket=require(_0x3d52('0xe'))(new Redis(config[_0x3d52('0xc')]));require(_0x3d52('0xf'))[_0x3d52('0x10')](socket);function respondWithRpcPromise(_0x2d966e,_0x30ee09,_0x4a5a9a){return new BPromise(function(_0x46c2e6,_0x873de6){return client[_0x3d52('0x11')](_0x2d966e,_0x4a5a9a)[_0x3d52('0x12')](function(_0x2675d2){logger['info'](_0x3d52('0x13'),_0x30ee09,'request\x20sent');logger['debug'](_0x3d52('0x14'),_0x30ee09,_0x3d52('0x15'),JSON['stringify'](_0x2675d2));if(_0x2675d2['error']){if(_0x2675d2['error'][_0x3d52('0x16')]===0x1f4){logger[_0x3d52('0x17')](_0x3d52('0x13'),_0x30ee09,_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);return _0x873de6(_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);}logger[_0x3d52('0x17')](_0x3d52('0x13'),_0x30ee09,_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);return _0x46c2e6(_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);}else{logger[_0x3d52('0x19')](_0x3d52('0x13'),_0x30ee09,'request\x20sent');_0x46c2e6(_0x2675d2[_0x3d52('0x1a')][_0x3d52('0x18')]);}})[_0x3d52('0x1b')](function(_0x54a514){logger[_0x3d52('0x17')](_0x3d52('0x13'),_0x30ee09,_0x54a514);_0x873de6(_0x54a514);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 1017574..cbff429 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 _0x8482=['update','emit','removeListener','length','openchannelAccount:','save','remove'];(function(_0x57c762,_0xbbcdc0){var _0x8c3112=function(_0x55c189){while(--_0x55c189){_0x57c762['push'](_0x57c762['shift']());}};_0x8c3112(++_0xbbcdc0);}(_0x8482,0x14e));var _0x2848=function(_0x2a6cf5,_0x496ca1){_0x2a6cf5=_0x2a6cf5-0x0;var _0x368102=_0x8482[_0x2a6cf5];return _0x368102;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x2848('0x0'),_0x2848('0x1'),_0x2848('0x2')];function createListener(_0xecfb19,_0x3ac5ad){return function(_0x212891){_0x3ac5ad[_0x2848('0x3')](_0xecfb19,_0x212891);};}function removeListener(_0x4309c1,_0x467ee5){return function(){OpenchannelAccountEvents[_0x2848('0x4')](_0x4309c1,_0x467ee5);};}exports['register']=function(_0x1eb602){for(var _0x44e406=0x0,_0x503238=events[_0x2848('0x5')];_0x44e406<_0x503238;_0x44e406++){var _0x48c0f3=events[_0x44e406];var _0x53c865=createListener(_0x2848('0x6')+_0x48c0f3,_0x1eb602);OpenchannelAccountEvents['on'](_0x48c0f3,_0x53c865);}}; \ No newline at end of file +var _0x1339=['openchannelAccount:','remove','update','emit','register','length'];(function(_0x48b26a,_0x21dacf){var _0x4d71ef=function(_0x49eafa){while(--_0x49eafa){_0x48b26a['push'](_0x48b26a['shift']());}};_0x4d71ef(++_0x21dacf);}(_0x1339,0x1ed));var _0x9133=function(_0x2afda4,_0x54ac64){_0x2afda4=_0x2afda4-0x0;var _0x2895db=_0x1339[_0x2afda4];return _0x2895db;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x9133('0x0'),_0x9133('0x1')];function createListener(_0x4611be,_0x20aa4b){return function(_0x447096){_0x20aa4b[_0x9133('0x2')](_0x4611be,_0x447096);};}function removeListener(_0x176e80,_0x110c51){return function(){OpenchannelAccountEvents['removeListener'](_0x176e80,_0x110c51);};}exports[_0x9133('0x3')]=function(_0x855473){for(var _0x379915=0x0,_0x539af6=events[_0x9133('0x4')];_0x379915<_0x539af6;_0x379915++){var _0x334dcd=events[_0x379915];var _0x3059c4=createListener(_0x9133('0x5')+_0x334dcd,_0x855473);OpenchannelAccountEvents['on'](_0x334dcd,_0x3059c4);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 44b0e93..4e3e5d4 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 _0x77d4=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer'];(function(_0x5ec258,_0x11686f){var _0x390884=function(_0x387e67){while(--_0x387e67){_0x5ec258['push'](_0x5ec258['shift']());}};_0x390884(++_0x11686f);}(_0x77d4,0x167));var _0x477d=function(_0x4cbaec,_0x44ef3a){_0x4cbaec=_0x4cbaec-0x0;var _0x48243a=_0x77d4[_0x4cbaec];return _0x48243a;};'use strict';var multer=require(_0x477d('0x0'));var util=require(_0x477d('0x1'));var path=require(_0x477d('0x2'));var timeout=require('connect-timeout');var express=require(_0x477d('0x3'));var router=express[_0x477d('0x4')]();var fs_extra=require(_0x477d('0x5'));var auth=require(_0x477d('0x6'));var interaction=require(_0x477d('0x7'));var config=require(_0x477d('0x8'));var controller=require(_0x477d('0x9'));router[_0x477d('0xa')]('/',auth[_0x477d('0xb')](),controller[_0x477d('0xc')]);router[_0x477d('0xa')](_0x477d('0xd'),auth[_0x477d('0xb')](),controller['show']);router['post']('/',auth[_0x477d('0xb')](),controller[_0x477d('0xe')]);router[_0x477d('0xf')](_0x477d('0xd'),auth[_0x477d('0xb')](),controller[_0x477d('0x10')]);router[_0x477d('0x11')]('/:id',auth[_0x477d('0xb')](),controller[_0x477d('0x12')]);module[_0x477d('0x13')]=router; \ No newline at end of file +var _0xa916=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated'];(function(_0x4290a7,_0x955fee){var _0x28bc35=function(_0x7f0de3){while(--_0x7f0de3){_0x4290a7['push'](_0x4290a7['shift']());}};_0x28bc35(++_0x955fee);}(_0xa916,0xb9));var _0x6a91=function(_0x12f4d8,_0x1f6d82){_0x12f4d8=_0x12f4d8-0x0;var _0x265413=_0xa916[_0x12f4d8];return _0x265413;};'use strict';var multer=require(_0x6a91('0x0'));var util=require(_0x6a91('0x1'));var path=require(_0x6a91('0x2'));var timeout=require(_0x6a91('0x3'));var express=require(_0x6a91('0x4'));var router=express[_0x6a91('0x5')]();var fs_extra=require(_0x6a91('0x6'));var auth=require(_0x6a91('0x7'));var interaction=require(_0x6a91('0x8'));var config=require(_0x6a91('0x9'));var controller=require(_0x6a91('0xa'));router[_0x6a91('0xb')]('/',auth[_0x6a91('0xc')](),controller[_0x6a91('0xd')]);router[_0x6a91('0xb')](_0x6a91('0xe'),auth[_0x6a91('0xc')](),controller[_0x6a91('0xf')]);router[_0x6a91('0x10')]('/',auth['isAuthenticated'](),controller[_0x6a91('0x11')]);router[_0x6a91('0x12')](_0x6a91('0xe'),auth['isAuthenticated'](),controller[_0x6a91('0x13')]);router[_0x6a91('0x14')]('/:id',auth[_0x6a91('0xc')](),controller['destroy']);module[_0x6a91('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 001b4c9..00fcf7d 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 _0x39f3=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x859fd0,_0x440d27){var _0x342201=function(_0x31ab69){while(--_0x31ab69){_0x859fd0['push'](_0x859fd0['shift']());}};_0x342201(++_0x440d27);}(_0x39f3,0x1ab));var _0x339f=function(_0x364e1a,_0x19dcd9){_0x364e1a=_0x364e1a-0x0;var _0x343d47=_0x39f3[_0x364e1a];return _0x343d47;};'use strict';var Sequelize=require(_0x339f('0x0'));module[_0x339f('0x1')]={'priority':{'type':Sequelize[_0x339f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x339f('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x339f('0x4')]()},'description':{'type':Sequelize[_0x339f('0x3')]},'interval':{'type':Sequelize[_0x339f('0x3')],'defaultValue':_0x339f('0x5')}}; \ No newline at end of file +var _0x97e9=['exports','INTEGER','STRING','noop','sequelize'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x97e9,0x1cb));var _0x997e=function(_0x45f9a7,_0x347446){_0x45f9a7=_0x45f9a7-0x0;var _0x56e9a9=_0x97e9[_0x45f9a7];return _0x56e9a9;};'use strict';var Sequelize=require(_0x997e('0x0'));module[_0x997e('0x1')]={'priority':{'type':Sequelize[_0x997e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x997e('0x3')],'allowNull':![],'defaultValue':_0x997e('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x997e('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 8c48beb..31091b5 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 _0x5345=['destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','sendStatus','error','stack','name','send','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','find','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5345,0x183));var _0x5534=function(_0x4ecc95,_0x91d6){_0x4ecc95=_0x4ecc95-0x0;var _0x2ced71=_0x5345[_0x4ecc95];return _0x2ced71;};'use strict';var emlformat=require(_0x5534('0x0'));var rimraf=require(_0x5534('0x1'));var zipdir=require(_0x5534('0x2'));var jsonpatch=require(_0x5534('0x3'));var rp=require(_0x5534('0x4'));var moment=require('moment');var BPromise=require(_0x5534('0x5'));var Mustache=require(_0x5534('0x6'));var util=require(_0x5534('0x7'));var path=require(_0x5534('0x8'));var sox=require('sox');var csv=require(_0x5534('0x9'));var ejs=require(_0x5534('0xa'));var fs=require('fs');var fs_extra=require(_0x5534('0xb'));var _=require(_0x5534('0xc'));var squel=require(_0x5534('0xd'));var crypto=require(_0x5534('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5534('0xf'));var toCsv=require(_0x5534('0x9'));var querystring=require(_0x5534('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5534('0x11'));var qs=require(_0x5534('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5534('0x13'));var logger=require(_0x5534('0x14'))(_0x5534('0x15'));var utils=require(_0x5534('0x16'));var config=require(_0x5534('0x17'));var licenseUtil=require(_0x5534('0x18'));var db=require(_0x5534('0x19'))['db'];function respondWithStatusCode(_0x956641,_0xca3459){_0xca3459=_0xca3459||0xcc;return function(_0x5885ba){if(_0x5885ba){return _0x956641['sendStatus'](_0xca3459);}return _0x956641[_0x5534('0x1a')](_0xca3459)['end']();};}function respondWithResult(_0x280db3,_0x1bb339){_0x1bb339=_0x1bb339||0xc8;return function(_0x585827){if(_0x585827){return _0x280db3[_0x5534('0x1a')](_0x1bb339)[_0x5534('0x1b')](_0x585827);}};}function respondWithFilteredResult(_0xcf566d,_0x3eee3d){return function(_0x738b1b){if(_0x738b1b){var _0x167232=typeof _0x3eee3d['offset']===_0x5534('0x1c')&&typeof _0x3eee3d[_0x5534('0x1d')]===_0x5534('0x1c');var _0x48b336=_0x738b1b[_0x5534('0x1e')];var _0x1c51e6=_0x167232?0x0:_0x3eee3d[_0x5534('0x1f')];var _0x1d9860=_0x167232?_0x738b1b[_0x5534('0x1e')]:_0x3eee3d[_0x5534('0x1f')]+_0x3eee3d['limit'];var _0x57dde2;if(_0x1d9860>=_0x48b336){_0x1d9860=_0x48b336;_0x57dde2=0xc8;}else{_0x57dde2=0xce;}_0xcf566d[_0x5534('0x1a')](_0x57dde2);return _0xcf566d[_0x5534('0x20')](_0x5534('0x21'),_0x1c51e6+'-'+_0x1d9860+'/'+_0x48b336)[_0x5534('0x1b')](_0x738b1b);}return null;};}function patchUpdates(_0x4efd0a){return function(_0x32bc42){try{jsonpatch[_0x5534('0x22')](_0x32bc42,_0x4efd0a,!![]);}catch(_0x1f1858){return BPromise[_0x5534('0x23')](_0x1f1858);}return _0x32bc42[_0x5534('0x24')]();};}function saveUpdates(_0x419652,_0x28de0b){return function(_0x1aa3ad){if(_0x1aa3ad){return _0x1aa3ad[_0x5534('0x25')](_0x419652)['then'](function(_0x14876e){return _0x14876e;});}return null;};}function removeEntity(_0x5c02c5,_0x49ed28){return function(_0xea979e){if(_0xea979e){return _0xea979e['destroy']()['then'](function(){_0x5c02c5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aa12d,_0x105419){return function(_0x36bc14){if(!_0x36bc14){_0x5aa12d[_0x5534('0x26')](0x194);}return _0x36bc14;};}function handleError(_0x2db433,_0x17b6d3){_0x17b6d3=_0x17b6d3||0x1f4;return function(_0x134910){logger[_0x5534('0x27')](_0x134910[_0x5534('0x28')]);if(_0x134910[_0x5534('0x29')]){delete _0x134910[_0x5534('0x29')];}_0x2db433['status'](_0x17b6d3)[_0x5534('0x2a')](_0x134910);};}exports['index']=function(_0x387db9,_0x35cfa6){var _0x5878e5={},_0x2ec6f1={},_0x557b9a={'count':0x0,'rows':[]};var _0xa8f3de=_[_0x5534('0x2b')](db[_0x5534('0x2c')][_0x5534('0x2d')],function(_0x160806){return{'name':_0x160806[_0x5534('0x2e')],'type':_0x160806[_0x5534('0x2f')][_0x5534('0x30')]};});_0x2ec6f1[_0x5534('0x31')]=_['map'](_0xa8f3de,_0x5534('0x29'));_0x2ec6f1[_0x5534('0x32')]=_[_0x5534('0x33')](_0x387db9[_0x5534('0x32')]);_0x2ec6f1[_0x5534('0x34')]=_[_0x5534('0x35')](_0x2ec6f1[_0x5534('0x31')],_0x2ec6f1['query']);_0x5878e5[_0x5534('0x36')]=_[_0x5534('0x35')](_0x2ec6f1[_0x5534('0x31')],qs[_0x5534('0x37')](_0x387db9[_0x5534('0x32')]['fields']));_0x5878e5[_0x5534('0x36')]=_0x5878e5['attributes'][_0x5534('0x38')]?_0x5878e5['attributes']:_0x2ec6f1[_0x5534('0x31')];if(!_0x387db9[_0x5534('0x32')][_0x5534('0x39')](_0x5534('0x3a'))){_0x5878e5[_0x5534('0x1d')]=qs[_0x5534('0x1d')](_0x387db9[_0x5534('0x32')][_0x5534('0x1d')]);_0x5878e5[_0x5534('0x1f')]=qs['offset'](_0x387db9[_0x5534('0x32')][_0x5534('0x1f')]);}_0x5878e5['order']=qs[_0x5534('0x3b')](_0x387db9[_0x5534('0x32')]['sort']);_0x5878e5['where']=qs[_0x5534('0x34')](_[_0x5534('0x3c')](_0x387db9[_0x5534('0x32')],_0x2ec6f1['filters']),_0xa8f3de);if(_0x387db9[_0x5534('0x32')][_0x5534('0x3d')]){_0x5878e5[_0x5534('0x3e')]=_[_0x5534('0x3f')](_0x5878e5[_0x5534('0x3e')],{'$or':_[_0x5534('0x2b')](_0xa8f3de,function(_0x9b4229){if(_0x9b4229[_0x5534('0x2f')]!==_0x5534('0x40')){var _0xdc8bd3={};_0xdc8bd3[_0x9b4229[_0x5534('0x29')]]={'$like':'%'+_0x387db9[_0x5534('0x32')][_0x5534('0x3d')]+'%'};return _0xdc8bd3;}})});}_0x5878e5=_[_0x5534('0x3f')]({},_0x5878e5,_0x387db9[_0x5534('0x41')]);var _0x11924b={'where':_0x5878e5[_0x5534('0x3e')]};return db[_0x5534('0x2c')]['count'](_0x11924b)[_0x5534('0x42')](function(_0x4ca3b7){_0x557b9a[_0x5534('0x1e')]=_0x4ca3b7;if(_0x387db9[_0x5534('0x32')][_0x5534('0x43')]){_0x5878e5[_0x5534('0x44')]=[{'all':!![]}];}return db[_0x5534('0x2c')][_0x5534('0x45')](_0x5878e5);})['then'](function(_0x156e0d){_0x557b9a['rows']=_0x156e0d;return _0x557b9a;})['then'](respondWithFilteredResult(_0x35cfa6,_0x5878e5))[_0x5534('0x46')](handleError(_0x35cfa6,null));};exports[_0x5534('0x47')]=function(_0x3c31be,_0x335d13){var _0x493d72={'raw':!![],'where':{'id':_0x3c31be['params']['id']}},_0xbc3ca2={};_0xbc3ca2[_0x5534('0x31')]=_[_0x5534('0x33')](db[_0x5534('0x2c')][_0x5534('0x2d')]);_0xbc3ca2[_0x5534('0x32')]=_[_0x5534('0x33')](_0x3c31be['query']);_0xbc3ca2[_0x5534('0x34')]=_[_0x5534('0x35')](_0xbc3ca2[_0x5534('0x31')],_0xbc3ca2[_0x5534('0x32')]);_0x493d72[_0x5534('0x36')]=_[_0x5534('0x35')](_0xbc3ca2[_0x5534('0x31')],qs['fields'](_0x3c31be[_0x5534('0x32')][_0x5534('0x37')]));_0x493d72[_0x5534('0x36')]=_0x493d72[_0x5534('0x36')]['length']?_0x493d72[_0x5534('0x36')]:_0xbc3ca2[_0x5534('0x31')];if(_0x3c31be[_0x5534('0x32')][_0x5534('0x43')]){_0x493d72['include']=[{'all':!![]}];}_0x493d72=_[_0x5534('0x3f')]({},_0x493d72,_0x3c31be[_0x5534('0x41')]);return db[_0x5534('0x2c')][_0x5534('0x48')](_0x493d72)[_0x5534('0x42')](handleEntityNotFound(_0x335d13,null))[_0x5534('0x42')](respondWithResult(_0x335d13,null))[_0x5534('0x46')](handleError(_0x335d13,null));};exports[_0x5534('0x49')]=function(_0x536a09,_0x2acd61){return db[_0x5534('0x2c')][_0x5534('0x49')](_0x536a09[_0x5534('0x4a')],{})[_0x5534('0x42')](respondWithResult(_0x2acd61,0xc9))[_0x5534('0x46')](handleError(_0x2acd61,null));};exports['update']=function(_0x3780f7,_0x4e926f){if(_0x3780f7['body']['id']){delete _0x3780f7[_0x5534('0x4a')]['id'];}return db['OpenchannelApplication'][_0x5534('0x48')]({'where':{'id':_0x3780f7['params']['id']}})[_0x5534('0x42')](handleEntityNotFound(_0x4e926f,null))[_0x5534('0x42')](saveUpdates(_0x3780f7[_0x5534('0x4a')],null))[_0x5534('0x42')](respondWithResult(_0x4e926f,null))[_0x5534('0x46')](handleError(_0x4e926f,null));};exports[_0x5534('0x4b')]=function(_0x310452,_0x4ba592){return db[_0x5534('0x2c')]['find']({'where':{'id':_0x310452[_0x5534('0x4c')]['id']}})[_0x5534('0x42')](handleEntityNotFound(_0x4ba592,null))['then'](removeEntity(_0x4ba592,null))['catch'](handleError(_0x4ba592,null));}; \ No newline at end of file +var _0xc9cb=['OpenchannelApplication','rawAttributes','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','params','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map'];(function(_0x36658d,_0x101497){var _0x573660=function(_0x127476){while(--_0x127476){_0x36658d['push'](_0x36658d['shift']());}};_0x573660(++_0x101497);}(_0xc9cb,0x18d));var _0xbc9c=function(_0x4981e5,_0x52e824){_0x4981e5=_0x4981e5-0x0;var _0x470c18=_0xc9cb[_0x4981e5];return _0x470c18;};'use strict';var emlformat=require(_0xbc9c('0x0'));var rimraf=require(_0xbc9c('0x1'));var zipdir=require(_0xbc9c('0x2'));var jsonpatch=require(_0xbc9c('0x3'));var rp=require(_0xbc9c('0x4'));var moment=require(_0xbc9c('0x5'));var BPromise=require(_0xbc9c('0x6'));var Mustache=require(_0xbc9c('0x7'));var util=require(_0xbc9c('0x8'));var path=require(_0xbc9c('0x9'));var sox=require('sox');var csv=require(_0xbc9c('0xa'));var ejs=require(_0xbc9c('0xb'));var fs=require('fs');var fs_extra=require(_0xbc9c('0xc'));var _=require(_0xbc9c('0xd'));var squel=require(_0xbc9c('0xe'));var crypto=require(_0xbc9c('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbc9c('0x10'));var Papa=require(_0xbc9c('0x11'));var Redis=require(_0xbc9c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbc9c('0x13'));var as=require(_0xbc9c('0x14'));var hardwareService=require(_0xbc9c('0x15'));var logger=require(_0xbc9c('0x16'))(_0xbc9c('0x17'));var utils=require(_0xbc9c('0x18'));var config=require(_0xbc9c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc9c('0x1a'))['db'];function respondWithStatusCode(_0x21ca3e,_0x1a3763){_0x1a3763=_0x1a3763||0xcc;return function(_0x24c65b){if(_0x24c65b){return _0x21ca3e['sendStatus'](_0x1a3763);}return _0x21ca3e['status'](_0x1a3763)[_0xbc9c('0x1b')]();};}function respondWithResult(_0xf9d5d6,_0x3e34d0){_0x3e34d0=_0x3e34d0||0xc8;return function(_0x349e77){if(_0x349e77){return _0xf9d5d6[_0xbc9c('0x1c')](_0x3e34d0)[_0xbc9c('0x1d')](_0x349e77);}};}function respondWithFilteredResult(_0x150661,_0x16b285){return function(_0x4196be){if(_0x4196be){var _0x3f7a13=typeof _0x16b285[_0xbc9c('0x1e')]===_0xbc9c('0x1f')&&typeof _0x16b285[_0xbc9c('0x20')]===_0xbc9c('0x1f');var _0x23caa0=_0x4196be[_0xbc9c('0x21')];var _0x2662b4=_0x3f7a13?0x0:_0x16b285[_0xbc9c('0x1e')];var _0x1f557e=_0x3f7a13?_0x4196be[_0xbc9c('0x21')]:_0x16b285[_0xbc9c('0x1e')]+_0x16b285[_0xbc9c('0x20')];var _0x38e9b3;if(_0x1f557e>=_0x23caa0){_0x1f557e=_0x23caa0;_0x38e9b3=0xc8;}else{_0x38e9b3=0xce;}_0x150661[_0xbc9c('0x1c')](_0x38e9b3);return _0x150661[_0xbc9c('0x22')]('Content-Range',_0x2662b4+'-'+_0x1f557e+'/'+_0x23caa0)[_0xbc9c('0x1d')](_0x4196be);}return null;};}function patchUpdates(_0x1e8715){return function(_0x4bec39){try{jsonpatch[_0xbc9c('0x23')](_0x4bec39,_0x1e8715,!![]);}catch(_0x147e9c){return BPromise[_0xbc9c('0x24')](_0x147e9c);}return _0x4bec39[_0xbc9c('0x25')]();};}function saveUpdates(_0x59fb1b,_0x51fc8c){return function(_0x1cdd67){if(_0x1cdd67){return _0x1cdd67[_0xbc9c('0x26')](_0x59fb1b)[_0xbc9c('0x27')](function(_0x5889cb){return _0x5889cb;});}return null;};}function removeEntity(_0xe36932,_0x386f38){return function(_0x34cfa9){if(_0x34cfa9){return _0x34cfa9[_0xbc9c('0x28')]()['then'](function(){_0xe36932['status'](0xcc)[_0xbc9c('0x1b')]();});}};}function handleEntityNotFound(_0x47cd2d,_0x1a5a9c){return function(_0x5cf44d){if(!_0x5cf44d){_0x47cd2d[_0xbc9c('0x29')](0x194);}return _0x5cf44d;};}function handleError(_0x4fed4a,_0x4d7280){_0x4d7280=_0x4d7280||0x1f4;return function(_0x21184b){logger[_0xbc9c('0x2a')](_0x21184b[_0xbc9c('0x2b')]);if(_0x21184b[_0xbc9c('0x2c')]){delete _0x21184b[_0xbc9c('0x2c')];}_0x4fed4a[_0xbc9c('0x1c')](_0x4d7280)[_0xbc9c('0x2d')](_0x21184b);};}exports['index']=function(_0x37f793,_0x12f9e3){var _0x1631df={},_0x2e92a7={},_0xea3766={'count':0x0,'rows':[]};var _0x1cbb58=_[_0xbc9c('0x2e')](db[_0xbc9c('0x2f')][_0xbc9c('0x30')],function(_0x3aa118){return{'name':_0x3aa118['fieldName'],'type':_0x3aa118[_0xbc9c('0x31')]['key']};});_0x2e92a7[_0xbc9c('0x32')]=_['map'](_0x1cbb58,_0xbc9c('0x2c'));_0x2e92a7['query']=_[_0xbc9c('0x33')](_0x37f793[_0xbc9c('0x34')]);_0x2e92a7[_0xbc9c('0x35')]=_['intersection'](_0x2e92a7['model'],_0x2e92a7['query']);_0x1631df[_0xbc9c('0x36')]=_[_0xbc9c('0x37')](_0x2e92a7[_0xbc9c('0x32')],qs[_0xbc9c('0x38')](_0x37f793[_0xbc9c('0x34')][_0xbc9c('0x38')]));_0x1631df['attributes']=_0x1631df[_0xbc9c('0x36')][_0xbc9c('0x39')]?_0x1631df['attributes']:_0x2e92a7[_0xbc9c('0x32')];if(!_0x37f793[_0xbc9c('0x34')][_0xbc9c('0x3a')](_0xbc9c('0x3b'))){_0x1631df[_0xbc9c('0x20')]=qs['limit'](_0x37f793[_0xbc9c('0x34')][_0xbc9c('0x20')]);_0x1631df[_0xbc9c('0x1e')]=qs[_0xbc9c('0x1e')](_0x37f793[_0xbc9c('0x34')][_0xbc9c('0x1e')]);}_0x1631df[_0xbc9c('0x3c')]=qs['sort'](_0x37f793[_0xbc9c('0x34')]['sort']);_0x1631df[_0xbc9c('0x3d')]=qs[_0xbc9c('0x35')](_[_0xbc9c('0x3e')](_0x37f793['query'],_0x2e92a7[_0xbc9c('0x35')]),_0x1cbb58);if(_0x37f793[_0xbc9c('0x34')][_0xbc9c('0x3f')]){_0x1631df[_0xbc9c('0x3d')]=_[_0xbc9c('0x40')](_0x1631df['where'],{'$or':_[_0xbc9c('0x2e')](_0x1cbb58,function(_0x3ce7a9){if(_0x3ce7a9[_0xbc9c('0x31')]!==_0xbc9c('0x41')){var _0x437dca={};_0x437dca[_0x3ce7a9[_0xbc9c('0x2c')]]={'$like':'%'+_0x37f793[_0xbc9c('0x34')][_0xbc9c('0x3f')]+'%'};return _0x437dca;}})});}_0x1631df=_[_0xbc9c('0x40')]({},_0x1631df,_0x37f793[_0xbc9c('0x42')]);var _0x1f4e15={'where':_0x1631df[_0xbc9c('0x3d')]};return db[_0xbc9c('0x2f')][_0xbc9c('0x21')](_0x1f4e15)['then'](function(_0x59e74e){_0xea3766[_0xbc9c('0x21')]=_0x59e74e;if(_0x37f793[_0xbc9c('0x34')][_0xbc9c('0x43')]){_0x1631df['include']=[{'all':!![]}];}return db[_0xbc9c('0x2f')]['findAll'](_0x1631df);})[_0xbc9c('0x27')](function(_0x5e215f){_0xea3766['rows']=_0x5e215f;return _0xea3766;})[_0xbc9c('0x27')](respondWithFilteredResult(_0x12f9e3,_0x1631df))[_0xbc9c('0x44')](handleError(_0x12f9e3,null));};exports['show']=function(_0x5debcf,_0xe913b3){var _0x1c108c={'raw':!![],'where':{'id':_0x5debcf[_0xbc9c('0x45')]['id']}},_0x551a29={};_0x551a29[_0xbc9c('0x32')]=_[_0xbc9c('0x33')](db[_0xbc9c('0x2f')][_0xbc9c('0x30')]);_0x551a29[_0xbc9c('0x34')]=_[_0xbc9c('0x33')](_0x5debcf[_0xbc9c('0x34')]);_0x551a29[_0xbc9c('0x35')]=_[_0xbc9c('0x37')](_0x551a29[_0xbc9c('0x32')],_0x551a29[_0xbc9c('0x34')]);_0x1c108c[_0xbc9c('0x36')]=_[_0xbc9c('0x37')](_0x551a29[_0xbc9c('0x32')],qs[_0xbc9c('0x38')](_0x5debcf[_0xbc9c('0x34')][_0xbc9c('0x38')]));_0x1c108c[_0xbc9c('0x36')]=_0x1c108c[_0xbc9c('0x36')][_0xbc9c('0x39')]?_0x1c108c[_0xbc9c('0x36')]:_0x551a29[_0xbc9c('0x32')];if(_0x5debcf[_0xbc9c('0x34')][_0xbc9c('0x43')]){_0x1c108c[_0xbc9c('0x46')]=[{'all':!![]}];}_0x1c108c=_[_0xbc9c('0x40')]({},_0x1c108c,_0x5debcf['options']);return db[_0xbc9c('0x2f')]['find'](_0x1c108c)[_0xbc9c('0x27')](handleEntityNotFound(_0xe913b3,null))['then'](respondWithResult(_0xe913b3,null))[_0xbc9c('0x44')](handleError(_0xe913b3,null));};exports[_0xbc9c('0x47')]=function(_0x3cbf78,_0x5a1c05){return db['OpenchannelApplication']['create'](_0x3cbf78[_0xbc9c('0x48')],{})[_0xbc9c('0x27')](respondWithResult(_0x5a1c05,0xc9))['catch'](handleError(_0x5a1c05,null));};exports[_0xbc9c('0x26')]=function(_0x344872,_0x42e631){if(_0x344872['body']['id']){delete _0x344872['body']['id'];}return db[_0xbc9c('0x2f')][_0xbc9c('0x49')]({'where':{'id':_0x344872[_0xbc9c('0x45')]['id']}})[_0xbc9c('0x27')](handleEntityNotFound(_0x42e631,null))['then'](saveUpdates(_0x344872['body'],null))[_0xbc9c('0x27')](respondWithResult(_0x42e631,null))[_0xbc9c('0x44')](handleError(_0x42e631,null));};exports[_0xbc9c('0x28')]=function(_0x29fd62,_0x41127d){return db[_0xbc9c('0x2f')][_0xbc9c('0x49')]({'where':{'id':_0x29fd62[_0xbc9c('0x45')]['id']}})[_0xbc9c('0x27')](handleEntityNotFound(_0x41127d,null))[_0xbc9c('0x27')](removeEntity(_0x41127d,null))[_0xbc9c('0x44')](handleError(_0x41127d,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 7d0c605..81b4426 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 _0xf818=['request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird'];(function(_0x2b8aff,_0x2fc8a5){var _0x4457f2=function(_0x33a6c6){while(--_0x33a6c6){_0x2b8aff['push'](_0x2b8aff['shift']());}};_0x4457f2(++_0x2fc8a5);}(_0xf818,0x14d));var _0x8f81=function(_0x3ce0de,_0x12479d){_0x3ce0de=_0x3ce0de-0x0;var _0x5a62c8=_0xf818[_0x3ce0de];return _0x5a62c8;};'use strict';var _=require('lodash');var util=require(_0x8f81('0x0'));var logger=require('../../config/logger')(_0x8f81('0x1'));var moment=require('moment');var BPromise=require(_0x8f81('0x2'));var rp=require(_0x8f81('0x3'));var fs=require('fs');var path=require(_0x8f81('0x4'));var rimraf=require(_0x8f81('0x5'));var config=require(_0x8f81('0x6'));var attributes=require(_0x8f81('0x7'));module[_0x8f81('0x8')]=function(_0x5bf345,_0x5349ee){return _0x5bf345[_0x8f81('0x9')](_0x8f81('0xa'),attributes,{'tableName':_0x8f81('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8f81('0xc'),'collate':_0x8f81('0xd')});}; \ No newline at end of file +var _0x0d46=['define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x0d46,0xe5));var _0x60d4=function(_0x1b4b64,_0x26c8b8){_0x1b4b64=_0x1b4b64-0x0;var _0x50c988=_0x0d46[_0x1b4b64];return _0x50c988;};'use strict';var _=require(_0x60d4('0x0'));var util=require(_0x60d4('0x1'));var logger=require(_0x60d4('0x2'))(_0x60d4('0x3'));var moment=require('moment');var BPromise=require(_0x60d4('0x4'));var rp=require(_0x60d4('0x5'));var fs=require('fs');var path=require(_0x60d4('0x6'));var rimraf=require(_0x60d4('0x7'));var config=require(_0x60d4('0x8'));var attributes=require(_0x60d4('0x9'));module[_0x60d4('0xa')]=function(_0x598e00,_0x3367c5){return _0x598e00[_0x60d4('0xb')](_0x60d4('0xc'),attributes,{'tableName':_0x60d4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x60d4('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 8c96f6a..14f959d 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 _0x01c4=['limit','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','attributes'];(function(_0x52e0ee,_0x52f7c1){var _0x32534c=function(_0x535d65){while(--_0x535d65){_0x52e0ee['push'](_0x52e0ee['shift']());}};_0x32534c(++_0x52f7c1);}(_0x01c4,0x14c));var _0x401c=function(_0x4134d6,_0x12a9cf){_0x4134d6=_0x4134d6-0x0;var _0x81e604=_0x01c4[_0x4134d6];return _0x81e604;};'use strict';var _=require(_0x401c('0x0'));var util=require('util');var moment=require(_0x401c('0x1'));var BPromise=require(_0x401c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x401c('0x3'));var db=require(_0x401c('0x4'))['db'];var utils=require(_0x401c('0x5'));var logger=require('../../config/logger')(_0x401c('0x6'));var config=require(_0x401c('0x7'));var jayson=require(_0x401c('0x8'));var client=jayson[_0x401c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x466e7e,_0xd43031,_0x5c5a9a){return new BPromise(function(_0x43aa61,_0x2b0728){return client[_0x401c('0xa')](_0x466e7e,_0x5c5a9a)[_0x401c('0xb')](function(_0x29cec8){logger[_0x401c('0xc')](_0x401c('0xd'),_0xd43031,_0x401c('0xe'));logger[_0x401c('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0xd43031,_0x401c('0xe'),JSON['stringify'](_0x29cec8));if(_0x29cec8[_0x401c('0x10')]){if(_0x29cec8[_0x401c('0x10')][_0x401c('0x11')]===0x1f4){logger['error'](_0x401c('0xd'),_0xd43031,_0x29cec8[_0x401c('0x10')][_0x401c('0x12')]);return _0x2b0728(_0x29cec8[_0x401c('0x10')]['message']);}logger['error'](_0x401c('0xd'),_0xd43031,_0x29cec8[_0x401c('0x10')][_0x401c('0x12')]);return _0x43aa61(_0x29cec8[_0x401c('0x10')][_0x401c('0x12')]);}else{logger[_0x401c('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0xd43031,'request\x20sent');_0x43aa61(_0x29cec8[_0x401c('0x13')][_0x401c('0x12')]);}})[_0x401c('0x14')](function(_0x50f035){logger['error'](_0x401c('0xd'),_0xd43031,_0x50f035);_0x2b0728(_0x50f035);});});}exports[_0x401c('0x15')]=function(_0x810ddc){var _0x358feb=this;return new Promise(function(_0x1ddde2,_0x4ca05b){return db[_0x401c('0x16')]['update'](_0x810ddc[_0x401c('0x17')],{'raw':_0x810ddc[_0x401c('0x18')]?_0x810ddc['options'][_0x401c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x810ddc[_0x401c('0x18')]?_0x810ddc[_0x401c('0x18')][_0x401c('0x1a')]||null:null,'attributes':_0x810ddc[_0x401c('0x18')]?_0x810ddc['options'][_0x401c('0x1b')]||null:null,'limit':_0x810ddc[_0x401c('0x18')]?_0x810ddc[_0x401c('0x18')][_0x401c('0x1c')]||null:null})[_0x401c('0xb')](function(_0x37d064){logger[_0x401c('0xc')](_0x401c('0x15'),_0x810ddc);logger['debug'](_0x401c('0x15'),_0x810ddc,JSON[_0x401c('0x1d')](_0x37d064));_0x1ddde2(_0x37d064);})['catch'](function(_0xefcbe4){logger[_0x401c('0x10')](_0x401c('0x15'),_0xefcbe4['message'],_0x810ddc);_0x4ca05b(_0x358feb[_0x401c('0x10')](0x1f4,_0xefcbe4['message']));});});}; \ No newline at end of file +var _0x5d17=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','request\x20sent','result','catch','UpdateOpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','randomstring'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x5d17,0x114));var _0x75d1=function(_0x5a27e8,_0x492a2f){_0x5a27e8=_0x5a27e8-0x0;var _0x4e38f7=_0x5d17[_0x5a27e8];return _0x4e38f7;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75d1('0x2'));var fs=require('fs');var Redis=require(_0x75d1('0x3'));var db=require(_0x75d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75d1('0x5'))(_0x75d1('0x6'));var config=require(_0x75d1('0x7'));var jayson=require(_0x75d1('0x8'));var client=jayson['client'][_0x75d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x116a51,_0x5c957a,_0x1ee61b){return new BPromise(function(_0x3a9d5e,_0x105607){return client[_0x75d1('0xa')](_0x116a51,_0x1ee61b)['then'](function(_0x4cf632){logger[_0x75d1('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x5c957a,'request\x20sent');logger[_0x75d1('0xc')](_0x75d1('0xd'),_0x5c957a,'request\x20sent',JSON[_0x75d1('0xe')](_0x4cf632));if(_0x4cf632[_0x75d1('0xf')]){if(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x10')]===0x1f4){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x4cf632['error'][_0x75d1('0x12')]);return _0x105607(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}logger[_0x75d1('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x5c957a,_0x4cf632['error']['message']);return _0x3a9d5e(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}else{logger[_0x75d1('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x5c957a,_0x75d1('0x13'));_0x3a9d5e(_0x4cf632[_0x75d1('0x14')][_0x75d1('0x12')]);}})[_0x75d1('0x15')](function(_0x1160ca){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x1160ca);_0x105607(_0x1160ca);});});}exports[_0x75d1('0x16')]=function(_0x1bc5de){var _0x3d0717=this;return new Promise(function(_0x2c2a6d,_0x5761db){return db['OpenchannelApplication'][_0x75d1('0x17')](_0x1bc5de[_0x75d1('0x18')],{'raw':_0x1bc5de['options']?_0x1bc5de[_0x75d1('0x19')][_0x75d1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bc5de[_0x75d1('0x19')]?_0x1bc5de[_0x75d1('0x19')][_0x75d1('0x1b')]||null:null,'attributes':_0x1bc5de[_0x75d1('0x19')]?_0x1bc5de['options'][_0x75d1('0x1c')]||null:null,'limit':_0x1bc5de[_0x75d1('0x19')]?_0x1bc5de['options'][_0x75d1('0x1d')]||null:null})[_0x75d1('0x1e')](function(_0x526f6c){logger[_0x75d1('0xb')]('UpdateOpenchannelApplication',_0x1bc5de);logger[_0x75d1('0xc')](_0x75d1('0x16'),_0x1bc5de,JSON[_0x75d1('0xe')](_0x526f6c));_0x2c2a6d(_0x526f6c);})['catch'](function(_0x525588){logger[_0x75d1('0xf')](_0x75d1('0x16'),_0x525588[_0x75d1('0x12')],_0x1bc5de);_0x5761db(_0x3d0717[_0x75d1('0xf')](0x1f4,_0x525588['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index da39114..e017eb4 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 _0x6f6d=['openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6f6d,0x1ab));var _0xd6f6=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6f6d[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xd6f6('0x0'));var util=require(_0xd6f6('0x1'));var path=require(_0xd6f6('0x2'));var timeout=require(_0xd6f6('0x3'));var express=require(_0xd6f6('0x4'));var router=express[_0xd6f6('0x5')]();var fs_extra=require(_0xd6f6('0x6'));var auth=require(_0xd6f6('0x7'));var interaction=require(_0xd6f6('0x8'));var config=require(_0xd6f6('0x9'));var controller=require(_0xd6f6('0xa'));router[_0xd6f6('0xb')]('/',auth[_0xd6f6('0xc')](),controller['index']);router[_0xd6f6('0xb')](_0xd6f6('0xd'),auth['isAuthenticated'](),controller[_0xd6f6('0xe')]);router[_0xd6f6('0xb')](_0xd6f6('0xf'),auth[_0xd6f6('0xc')](),controller[_0xd6f6('0x10')]);router[_0xd6f6('0xb')]('/:id/messages',auth[_0xd6f6('0xc')](),controller[_0xd6f6('0x11')]);router[_0xd6f6('0xb')](_0xd6f6('0x12'),auth[_0xd6f6('0xc')](),controller[_0xd6f6('0x13')]);router[_0xd6f6('0x14')]('/',auth[_0xd6f6('0xc')](),controller[_0xd6f6('0x15')]);router[_0xd6f6('0x14')](_0xd6f6('0x16'),auth[_0xd6f6('0xc')](),controller[_0xd6f6('0x17')]);router[_0xd6f6('0x14')](_0xd6f6('0x18'),auth[_0xd6f6('0xc')](),interaction[_0xd6f6('0x19')](_0xd6f6('0x1a'),_0xd6f6('0x1b')),controller['addTags']);router['put'](_0xd6f6('0xf'),auth['isAuthenticated'](),interaction[_0xd6f6('0x19')](_0xd6f6('0x1a'),_0xd6f6('0x1c')),controller[_0xd6f6('0x1d')]);router['delete'](_0xd6f6('0xf'),auth[_0xd6f6('0xc')](),interaction[_0xd6f6('0x19')]('openchannel',_0xd6f6('0x1e')),controller[_0xd6f6('0x1f')]);router[_0xd6f6('0x20')](_0xd6f6('0x18'),auth[_0xd6f6('0xc')](),controller[_0xd6f6('0x21')]);module[_0xd6f6('0x22')]=router; \ No newline at end of file +var _0x4ef9=['getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/:id','/:id/messages'];(function(_0x4400f7,_0xe6e042){var _0x158216=function(_0x1b7e14){while(--_0x1b7e14){_0x4400f7['push'](_0x4400f7['shift']());}};_0x158216(++_0xe6e042);}(_0x4ef9,0xac));var _0x94ef=function(_0x46aaaa,_0x3af897){_0x46aaaa=_0x46aaaa-0x0;var _0x26d04e=_0x4ef9[_0x46aaaa];return _0x26d04e;};'use strict';var multer=require(_0x94ef('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x94ef('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x94ef('0x2'));var auth=require(_0x94ef('0x3'));var interaction=require(_0x94ef('0x4'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x94ef('0x5')]('/',auth[_0x94ef('0x6')](),controller['index']);router[_0x94ef('0x5')](_0x94ef('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0x94ef('0x5')](_0x94ef('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x94ef('0x5')](_0x94ef('0x9'),auth[_0x94ef('0x6')](),controller[_0x94ef('0xa')]);router[_0x94ef('0x5')](_0x94ef('0xb'),auth[_0x94ef('0x6')](),controller['download']);router[_0x94ef('0xc')]('/',auth['isAuthenticated'](),controller[_0x94ef('0xd')]);router['post'](_0x94ef('0x9'),auth[_0x94ef('0x6')](),controller[_0x94ef('0xe')]);router[_0x94ef('0xc')](_0x94ef('0xf'),auth[_0x94ef('0x6')](),interaction[_0x94ef('0x10')]('openchannel',_0x94ef('0x11')),controller[_0x94ef('0x12')]);router[_0x94ef('0x13')](_0x94ef('0x8'),auth[_0x94ef('0x6')](),interaction[_0x94ef('0x10')]('openchannel',_0x94ef('0x14')),controller[_0x94ef('0x15')]);router[_0x94ef('0x16')]('/:id',auth[_0x94ef('0x6')](),interaction[_0x94ef('0x10')]('openchannel',_0x94ef('0x17')),controller[_0x94ef('0x18')]);router[_0x94ef('0x16')](_0x94ef('0xf'),auth[_0x94ef('0x6')](),controller['removeTags']);module[_0x94ef('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 933d60f..9e61238 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 _0x7ec7=['BOOLEAN','DATE','STRING','ENUM','sequelize','exports'];(function(_0x52829f,_0x66074f){var _0x106f59=function(_0x34469a){while(--_0x34469a){_0x52829f['push'](_0x52829f['shift']());}};_0x106f59(++_0x66074f);}(_0x7ec7,0x1a2));var _0x77ec=function(_0x53c823,_0x1b5c9e){_0x53c823=_0x53c823-0x0;var _0x4e6881=_0x7ec7[_0x53c823];return _0x4e6881;};'use strict';var Sequelize=require(_0x77ec('0x0'));module[_0x77ec('0x1')]={'closed':{'type':Sequelize[_0x77ec('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x77ec('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x77ec('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x77ec('0x4')]},'read1stAt':{'type':Sequelize[_0x77ec('0x3')]},'threadId':{'type':Sequelize[_0x77ec('0x4')]},'externalUrl':{'type':Sequelize[_0x77ec('0x4')]},'lastMsgAt':{'type':Sequelize[_0x77ec('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x77ec('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x77ec('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb016=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x1ba628,_0x26f5be){var _0xa56a53=function(_0x3d3311){while(--_0x3d3311){_0x1ba628['push'](_0x1ba628['shift']());}};_0xa56a53(++_0x26f5be);}(_0xb016,0x129));var _0x6b01=function(_0x5590b7,_0x242ffb){_0x5590b7=_0x5590b7-0x0;var _0x1ec34e=_0xb016[_0x5590b7];return _0x1ec34e;};'use strict';var Sequelize=require(_0x6b01('0x0'));module[_0x6b01('0x1')]={'closed':{'type':Sequelize[_0x6b01('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6b01('0x3')]},'disposition':{'type':Sequelize[_0x6b01('0x4')]},'secondDisposition':{'type':Sequelize[_0x6b01('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6b01('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x6b01('0x3')]},'threadId':{'type':Sequelize[_0x6b01('0x4')]},'externalUrl':{'type':Sequelize[_0x6b01('0x4')]},'lastMsgAt':{'type':Sequelize[_0x6b01('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6b01('0x5')]('in',_0x6b01('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x6b01('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index bc93d13..cd92382 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 _0x51e5=['zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','register','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','Users','fullname','TagIds','Tags','push','catch','waiting','answered','unmanaged','total','UserId','closed','talking','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','pick','filters','select','from','field','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','tools_tags','expr','search','parseSearch','conditions','unreadMessages','value','`\x20=\x200','`\x20>\x200','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','forEach','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','map','isEmpty','where','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IN\x20?','sequelize','keyBy','OpenchannelInteraction','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','groupBy','OpenchannelInteractionId','all','rows','params','include','merge','options','find','create','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','User','Contact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format'];(function(_0xc501b0,_0x46a0e7){var _0x3c9941=function(_0xaaf8be){while(--_0xaaf8be){_0xc501b0['push'](_0xc501b0['shift']());}};_0x3c9941(++_0x46a0e7);}(_0x51e5,0x1e1));var _0x551e=function(_0x28b9e9,_0x276351){_0x28b9e9=_0x28b9e9-0x0;var _0x1b0808=_0x51e5[_0x28b9e9];return _0x1b0808;};'use strict';var emlformat=require(_0x551e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x551e('0x1'));var jsonpatch=require(_0x551e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x551e('0x3'));var Mustache=require(_0x551e('0x4'));var util=require(_0x551e('0x5'));var path=require(_0x551e('0x6'));var sox=require('sox');var csv=require(_0x551e('0x7'));var ejs=require(_0x551e('0x8'));var fs=require('fs');var fs_extra=require(_0x551e('0x9'));var _=require(_0x551e('0xa'));var squel=require(_0x551e('0xb'));var crypto=require(_0x551e('0xc'));var jsforce=require(_0x551e('0xd'));var deskjs=require(_0x551e('0xe'));var toCsv=require(_0x551e('0x7'));var querystring=require(_0x551e('0xf'));var Papa=require(_0x551e('0x10'));var Redis=require(_0x551e('0x11'));var authService=require(_0x551e('0x12'));var qs=require(_0x551e('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x551e('0x14'));var hardwareService=require(_0x551e('0x15'));var logger=require('../../config/logger')(_0x551e('0x16'));var utils=require(_0x551e('0x17'));var config=require(_0x551e('0x18'));var licenseUtil=require(_0x551e('0x19'));var db=require('../../mysqldb')['db'];config[_0x551e('0x1a')]=_[_0x551e('0x1b')](config[_0x551e('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x551e('0x1a')]));require('./openchannelInteraction.socket')[_0x551e('0x1c')](socket);function respondWithStatusCode(_0x175ad6,_0x317679){_0x317679=_0x317679||0xcc;return function(_0x489d8d){if(_0x489d8d){return _0x175ad6['sendStatus'](_0x317679);}return _0x175ad6['status'](_0x317679)[_0x551e('0x1d')]();};}function respondWithResult(_0x71af9a,_0x81b805){_0x81b805=_0x81b805||0xc8;return function(_0x4dac30){if(_0x4dac30){return _0x71af9a[_0x551e('0x1e')](_0x81b805)[_0x551e('0x1f')](_0x4dac30);}};}function respondWithFilteredResult(_0xa66a51,_0x155299){return function(_0x4afe4f){if(_0x4afe4f){var _0x244bf6=typeof _0x155299[_0x551e('0x20')]===_0x551e('0x21')&&typeof _0x155299[_0x551e('0x22')]===_0x551e('0x21');var _0x1bca21=_0x4afe4f[_0x551e('0x23')];var _0x3d1def=_0x244bf6?0x0:_0x155299[_0x551e('0x20')];var _0xd62e98=_0x244bf6?_0x4afe4f[_0x551e('0x23')]:_0x155299[_0x551e('0x20')]+_0x155299[_0x551e('0x22')];var _0x4b0b28;if(_0xd62e98>=_0x1bca21){_0xd62e98=_0x1bca21;_0x4b0b28=0xc8;}else{_0x4b0b28=0xce;}_0xa66a51[_0x551e('0x1e')](_0x4b0b28);return _0xa66a51['set'](_0x551e('0x24'),_0x3d1def+'-'+_0xd62e98+'/'+_0x1bca21)[_0x551e('0x1f')](_0x4afe4f);}return null;};}function patchUpdates(_0x55909e){return function(_0x3dd0ec){try{jsonpatch[_0x551e('0x25')](_0x3dd0ec,_0x55909e,!![]);}catch(_0x2ae4c8){return BPromise[_0x551e('0x26')](_0x2ae4c8);}return _0x3dd0ec[_0x551e('0x27')]();};}function saveUpdates(_0x2e608,_0x315381){return function(_0x180238){if(_0x180238){return _0x180238[_0x551e('0x28')](_0x2e608)[_0x551e('0x29')](function(_0x32c147){return _0x32c147;});}return null;};}function removeEntity(_0x3111e7,_0x53894f){return function(_0x347b62){if(_0x347b62){return _0x347b62[_0x551e('0x2a')]()[_0x551e('0x29')](function(){_0x3111e7['status'](0xcc)[_0x551e('0x1d')]();});}};}function handleEntityNotFound(_0x24d6f0,_0x14496a){return function(_0x31b0c1){if(!_0x31b0c1){_0x24d6f0[_0x551e('0x2b')](0x194);}return _0x31b0c1;};}function handleError(_0x246dd4,_0x3bbee2){_0x3bbee2=_0x3bbee2||0x1f4;return function(_0x35db24){logger['error'](_0x35db24[_0x551e('0x2c')]);if(_0x35db24['name']){delete _0x35db24[_0x551e('0x2d')];}_0x246dd4['status'](_0x3bbee2)['send'](_0x35db24);};}function getInteractionUsers(_0x12816d,_0x132b4f){return new BPromise(function(_0x5201ce,_0x5ee353){try{if(_0x132b4f[_0x12816d['id']]){_0x12816d[_0x551e('0x2e')]=_['map'](_0x132b4f[_0x12816d['id']],function(_0x19da20){return{'id':_0x19da20['id'],'fullname':_0x19da20[_0x551e('0x2f')]};});}}catch(_0x44da59){_0x5ee353(_0x44da59);}_0x5201ce(_0x12816d);});}function getInteractionTags(_0x4b043d,_0x50ad9d){return new BPromise(function(_0x4c930b,_0x2bd8db){try{if(_0x4b043d[_0x551e('0x30')]){_0x4b043d['Tags']=[];_0x4b043d[_0x551e('0x30')]['split'](',')['forEach'](function(_0x295a9c){_0x4b043d[_0x551e('0x31')][_0x551e('0x32')](_0x50ad9d[_0x295a9c]);});}delete _0x4b043d['TagIds'];}catch(_0x2d1f1e){_0x2bd8db(_0x2d1f1e);}_0x4c930b(_0x4b043d);});}function updateOpenchannelInteraction(_0x4158df,_0x377a01,_0x1fa376){return new BPromise(function(_0x46b0a8,_0x562fe8){return getInteractionUsers(_0x4158df,_0x1fa376)[_0x551e('0x29')](function(_0x2be6f8){return getInteractionTags(_0x2be6f8,_0x377a01);})[_0x551e('0x29')](function(_0x32bd18){return getStateInteraction(_0x32bd18);})[_0x551e('0x29')](function(_0x42ae41){_0x46b0a8(_0x42ae41);})[_0x551e('0x33')](function(_0x18efd2){_0x562fe8(_0x18efd2);});});}function getStateInteraction(_0x340fec){return new BPromise(function(_0x314581){_0x340fec[_0x551e('0x34')]=0x0;_0x340fec['talking']=0x0;_0x340fec[_0x551e('0x35')]=0x0;_0x340fec[_0x551e('0x36')]=0x0;_0x340fec[_0x551e('0x37')]=0x0;if(!_0x340fec['closed']&&!_0x340fec[_0x551e('0x38')]){_0x340fec[_0x551e('0x34')]+=0x1;}if(!_0x340fec[_0x551e('0x39')]&&_0x340fec[_0x551e('0x38')]){_0x340fec[_0x551e('0x3a')]+=0x1;if(_0x340fec[_0x551e('0x34')]){_0x340fec[_0x551e('0x34')]-=0x1;}}if(_0x340fec['closed']&&_0x340fec[_0x551e('0x38')]){_0x340fec[_0x551e('0x35')]+=0x1;if(_0x340fec[_0x551e('0x3a')]){_0x340fec[_0x551e('0x3a')]-=0x1;}}if(_0x340fec[_0x551e('0x39')]&&!_0x340fec[_0x551e('0x38')]){_0x340fec[_0x551e('0x36')]+=0x1;if(_0x340fec[_0x551e('0x34')]){_0x340fec[_0x551e('0x34')]-=0x1;}}_0x340fec['total']+=0x1;_0x314581(_0x340fec);});}exports[_0x551e('0x3b')]=function(_0xa8258b,_0x331307){var _0x20662c={},_0x937349={},_0xa9e9ff={'count':0x0,'rows':[]};var _0x988935=_['map'](db['OpenchannelInteraction'][_0x551e('0x3c')],function(_0x2ce2f2){return{'name':_0x2ce2f2[_0x551e('0x3d')],'type':_0x2ce2f2[_0x551e('0x3e')][_0x551e('0x3f')]};});_0x937349[_0x551e('0x40')]=_['map'](_0x988935,_0x551e('0x2d'));_0x937349[_0x551e('0x41')]=_[_0x551e('0x42')](_0xa8258b[_0x551e('0x41')]);_0x937349['filters']=_[_0x551e('0x43')](_0x937349['model'],_0x937349[_0x551e('0x41')]);_0x20662c[_0x551e('0x44')]=_[_0x551e('0x43')](_0x937349[_0x551e('0x40')],qs[_0x551e('0x45')](_0xa8258b[_0x551e('0x41')]['fields']));_0x20662c[_0x551e('0x44')]=_0x20662c[_0x551e('0x44')][_0x551e('0x46')]?_0x20662c['attributes']:_0x937349[_0x551e('0x40')];if(!_0xa8258b[_0x551e('0x41')]['hasOwnProperty'](_0x551e('0x47'))){_0x20662c[_0x551e('0x22')]=qs[_0x551e('0x22')](_0xa8258b[_0x551e('0x41')][_0x551e('0x22')]);_0x20662c[_0x551e('0x20')]=qs[_0x551e('0x20')](_0xa8258b['query'][_0x551e('0x20')]);}_0x20662c[_0x551e('0x48')]=qs[_0x551e('0x49')](_0xa8258b[_0x551e('0x41')][_0x551e('0x49')]);_0x20662c['where']=qs['filters'](_[_0x551e('0x4a')](_0xa8258b[_0x551e('0x41')],_0x937349[_0x551e('0x4b')]),_0x988935);var _0x3bb730=[];var _0x16fe9d=squel[_0x551e('0x4c')]()['field']('id')['field']('name')['field']('color')[_0x551e('0x4d')]('tools_tags');var _0x56ea39=squel[_0x551e('0x4c')]()[_0x551e('0x4e')](_0x551e('0x4f'))[_0x551e('0x4e')](_0x551e('0x50'))['field'](_0x551e('0x51'))[_0x551e('0x4d')]('user_has_openchannel_interactions','ui')[_0x551e('0x52')]('users','u','u.id\x20=\x20ui.UserId');var _0x4cd661=squel[_0x551e('0x4c')]()[_0x551e('0x4d')](_0x551e('0x53'),'i')[_0x551e('0x52')](_0x551e('0x54'),'c',_0x551e('0x55'))[_0x551e('0x52')](_0x551e('0x56'),'o',_0x551e('0x57'))['left_join']('openchannel_accounts','a',_0x551e('0x58'))[_0x551e('0x52')](_0x551e('0x59'),'me',_0x551e('0x5a'))['left_join'](_0x551e('0x5b'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x551e('0x52')](_0x551e('0x5c'),'t','t.id\x20=\x20it.TagId');var _0x34eab1=squel[_0x551e('0x5d')]();var _0x2f087c=[];var _0x4e2568=squel[_0x551e('0x5d')]();var _0x51b818;if(_0xa8258b[_0x551e('0x41')][_0x551e('0x5e')]){_0x51b818=as[_0x551e('0x5f')](_0xa8258b[_0x551e('0x41')][_0x551e('0x5e')]);var _0x519e18=_0x51b818['sqlOperator'];for(var _0x30fa0f=0x0;_0x30fa0f<_0x51b818['conditions'][_0x551e('0x46')];_0x30fa0f++){var _0x1207ee=_0x51b818[_0x551e('0x60')][_0x30fa0f];var _0x3ade65='i';var _0x2bed72=_['find'](_0x988935,[_0x551e('0x2d'),_0x1207ee[_0x551e('0x4e')]]);if(!_0x2bed72){switch(_0x1207ee[_0x551e('0x4e')]){case _0x551e('0x61'):if(_0x1207ee[_0x551e('0x62')]==0x1){_0x4cd661['having']('`'+_0x1207ee['field']+_0x551e('0x63'));}else{_0x4cd661['having']('`'+_0x1207ee[_0x551e('0x4e')]+_0x551e('0x64'));}break;case'Contact':if(_0x1207ee[_0x551e('0x65')]===_0x551e('0x66')){if(_0x1207ee['value'][_0x551e('0x67')]('\x20')['length']>0x1){_0x34eab1[_0x519e18](_0x551e('0x68'),qs[_0x551e('0x69')](_0x1207ee[_0x551e('0x62')]),null);}else{var _0x31fad8='%'+_0x1207ee[_0x551e('0x62')]+'%';_0x34eab1[_0x519e18](_0x551e('0x6a'),_0x31fad8,_0x31fad8,_0x31fad8);}}else{_0x2bed72=_['find'](_0x988935,['name',_0x551e('0x6b')]);_0x1207ee[_0x551e('0x4e')]=_0x551e('0x6b');_0x12ceaf=as[_0x551e('0x6c')](_0x3ade65,_0x2bed72[_0x551e('0x3e')],_0x1207ee);_0x34eab1[_0x519e18](_0x12ceaf[_0x551e('0x6d')],_0x12ceaf['value']['start'],_0x12ceaf[_0x551e('0x62')][_0x551e('0x1d')]);}break;case _0x551e('0x6e'):var _0x1ecfae=_0x1207ee[_0x551e('0x62')][_0x551e('0x67')](',')['map'](function(_0x3ec424){return Number(_0x3ec424);});_0x1ecfae[_0x551e('0x6f')](function(_0x1ac0ff){_0x4e2568['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1ac0ff+',%');});_0x2f087c=_[_0x551e('0x70')](_0x2f087c,_0x1ecfae);break;case'User':if(_0x1207ee['operator']===_0x551e('0x66')){_0x34eab1[_0x519e18](_0x551e('0x71'),'%'+_0x1207ee[_0x551e('0x62')]+'%',null);}else{_0x2bed72=_['find'](_0x988935,['name','UserId']);_0x1207ee[_0x551e('0x4e')]=_0x551e('0x38');_0x12ceaf=as['buildExpression'](_0x3ade65,_0x2bed72[_0x551e('0x3e')],_0x1207ee);_0x34eab1[_0x519e18](_0x12ceaf[_0x551e('0x6d')],_0x12ceaf[_0x551e('0x62')][_0x551e('0x72')],_0x12ceaf[_0x551e('0x62')][_0x551e('0x1d')]);}break;case _0x551e('0x73'):_0x12ceaf=as[_0x551e('0x6c')]('me',null,_0x1207ee);_0x34eab1[_0x519e18](_0x12ceaf[_0x551e('0x6d')],_0x12ceaf[_0x551e('0x62')][_0x551e('0x72')],_0x12ceaf['value']['end']);break;}}else{var _0x12ceaf=as[_0x551e('0x6c')](_0x3ade65,_0x2bed72['type'],_0x1207ee);_0x34eab1[_0x519e18](_0x12ceaf[_0x551e('0x6d')],_0x12ceaf[_0x551e('0x62')][_0x551e('0x72')],_0x12ceaf['value']['end']);}}}else{var _0x28b3a9=_(_0xa8258b[_0x551e('0x41')])[_0x551e('0x42')]()[_0x551e('0x74')](function(_0x200ca7){return _['some'](_0x988935,[_0x551e('0x2d'),_0x200ca7])?_0x200ca7:undefined;})['compact']()[_0x551e('0x62')]();if(!_[_0x551e('0x75')](_0x28b3a9)){_0x28b3a9[_0x551e('0x6f')](function(_0x37e67f){if(_0x37e67f==='OpenchannelAccountId'){_0x4cd661[_0x551e('0x76')]('i.OpenchannelAccountId\x20IN\x20?',[]['concat'](_0xa8258b['query'][_0x37e67f]));}else if(_0x37e67f===_0x551e('0x77')){var _0xb68469=JSON['parse'](_0xa8258b[_0x551e('0x41')][_0x37e67f])[_0x551e('0x78')];var _0xdb3448=JSON[_0x551e('0x79')](_0xa8258b[_0x551e('0x41')][_0x37e67f])[_0x551e('0x7a')];_0x4cd661[_0x551e('0x76')](_0x551e('0x7b'),_0xb68469,_0xdb3448);}else{if(_0xa8258b['query'][_0x37e67f]===_0x551e('0x7c')){_0x4cd661['where']('i.'+_0x37e67f+'\x20IS\x20NULL');}else{_0x4cd661['where']('i.'+_0x37e67f+'\x20=\x20?',_0xa8258b[_0x551e('0x41')][_0x37e67f]);}}});}if(_0xa8258b[_0x551e('0x41')][_0x551e('0x7d')]){if(_0xa8258b['query'][_0x551e('0x7d')]==0x1){_0x4cd661[_0x551e('0x7e')](_0x551e('0x7f'));}else{_0x4cd661['having'](_0x551e('0x80'));}}if(_0xa8258b[_0x551e('0x41')][_0x551e('0x81')]){_0x2f087c=_['isArray'](_0xa8258b[_0x551e('0x41')][_0x551e('0x81')])?_0xa8258b['query']['tag']:new Array(_0xa8258b['query'][_0x551e('0x81')]);_0x2f087c['forEach'](function(_0x558693){_0x4e2568['or'](_0x551e('0x82'),'%,'+_0x558693+',%');});}if(_0xa8258b[_0x551e('0x41')][_0x551e('0x83')]){var _0x494c3e=_0xa8258b[_0x551e('0x41')]['filter'][_0x551e('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x551e('0x85')](_0x494c3e)){_0x34eab1['or']('i.id\x20LIKE\x20?',_0x494c3e+'%');}else{_0x34eab1['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x494c3e))['or'](_0x551e('0x86'),_0x494c3e+'%')['or'](_0x551e('0x87'),_0x494c3e+'%');}}}_0x4cd661[_0x551e('0x76')](_0x34eab1);_0x4cd661[_0x551e('0x88')](_0x551e('0x89'));var _0x1833fc={'type':db[_0x551e('0x8a')]['QueryTypes'][_0x551e('0x8b')],'raw':!![]};var _0x27ae63=_0x4cd661[_0x551e('0x8c')]();_0x27ae63[_0x551e('0x4e')](_0x551e('0x89'));_0x27ae63[_0x551e('0x4e')](_0x551e('0x8d'),'unreadMessages');if(_0x20662c[_0x551e('0x48')]){_0x20662c['order'][_0x551e('0x6f')](function(_0x32ae6a){var _0x2089fe=_0x32ae6a[0x0]===_0x551e('0x8e')?_0x32ae6a[0x0]:'i.'+_0x32ae6a[0x0];_0x4cd661[_0x551e('0x48')](_0x2089fe,_0x32ae6a[0x1]===_0x551e('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x2f087c)){_0x4cd661[_0x551e('0x7e')](_0x4e2568);_0x27ae63[_0x551e('0x76')](_0x551e('0x90'),_0x2f087c);}BPromise['resolve']()[_0x551e('0x29')](function(){if(!_0x51b818){if(_0xa8258b[_0x551e('0x41')][_0x551e('0x91')])return;_0x27ae63[_0x551e('0x76')](_0x551e('0x92'));_0x4cd661['where'](_0x551e('0x92'));return;}if(_0xa8258b[_0x551e('0x93')][_0x551e('0x94')]!==_0x551e('0x95'))return;return _0xa8258b[_0x551e('0x93')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x549d1f){if(_[_0x551e('0x75')](_0x549d1f)){_0x27ae63[_0x551e('0x76')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x4cd661[_0x551e('0x76')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x27ae63[_0x551e('0x76')](_0x551e('0x96'),_[_0x551e('0x74')](_0x549d1f,'id'));_0x4cd661[_0x551e('0x76')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x551e('0x74')](_0x549d1f,'id'));}});})[_0x551e('0x29')](function(){if(_0xa8258b['user'][_0x551e('0x94')]==='agent'&&!_0x51b818&&!_0xa8258b['query'][_0x551e('0x91')])return[];return db[_0x551e('0x97')]['query'](_0x27ae63['toString'](),_0x1833fc);})[_0x551e('0x29')](function(_0x1608e8){_0xa9e9ff[_0x551e('0x23')]=_0x1608e8[_0x551e('0x46')];if(_0xa9e9ff[_0x551e('0x23')]===0x0)return[];return db['sequelize']['query'](_0x16fe9d['toString'](),_0x1833fc)['then'](function(_0x10ed4c){_0x3bb730=_[_0x551e('0x98')](_0x10ed4c,'id');_0x1833fc=_['merge'](_0x1833fc,{'model':db[_0x551e('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa8258b[_0x551e('0x41')][_0x551e('0x45')]){_0x20662c[_0x551e('0x44')][_0x551e('0x6f')](function(_0x2c7c27){_0x4cd661[_0x551e('0x4e')]('i.'+_0x2c7c27);});}else{_0x4cd661['field'](_0x551e('0x8d'),_0x551e('0x61'));_0x4cd661['field'](_0x551e('0x9a'),_0x551e('0x9b'));_0x4cd661['field']('a.mandatoryDisposition',_0x551e('0x9c'));_0x4cd661[_0x551e('0x4e')](_0x551e('0x9d'),_0x551e('0x8e'));_0x4cd661['field'](_0x551e('0x9e'));_0x4cd661['field']('c.firstName',_0x551e('0x9f'));_0x4cd661[_0x551e('0x4e')](_0x551e('0xa0'),_0x551e('0xa1'));_0x4cd661[_0x551e('0x4e')](_0x551e('0xa2'),_0x551e('0xa3'));_0x4cd661[_0x551e('0x4e')]('c.phone',_0x551e('0xa4'));_0x4cd661[_0x551e('0x4e')](_0x551e('0xa5'),_0x551e('0xa6'));_0x4cd661[_0x551e('0x4e')](_0x551e('0xa7'),_0x551e('0xa8'));_0x4cd661[_0x551e('0x4e')](_0x551e('0xa9'),'Owner.fullname');_0x4cd661[_0x551e('0x4e')](_0x551e('0xaa'),'Owner.internal');_0x4cd661['field'](_0x551e('0xab'),'TagIds');}if(_0x20662c[_0x551e('0x22')])_0x4cd661[_0x551e('0x22')](_0x20662c[_0x551e('0x22')]);if(_0x20662c[_0x551e('0x20')])_0x4cd661['offset'](_0x20662c[_0x551e('0x20')]);return db[_0x551e('0x97')]['query'](_0x4cd661[_0x551e('0xac')](),_0x1833fc);})['then'](function(_0x1d39cf){if(_0x1d39cf[_0x551e('0x46')]>0x0)_0x56ea39['where']('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x551e('0x74')](_0x1d39cf,'id'));return db['sequelize'][_0x551e('0x41')](_0x56ea39['toString'](),_0x1833fc)[_0x551e('0x29')](function(_0x3bd26f){var _0x4eccc7=_[_0x551e('0xad')](_0x3bd26f,_0x551e('0xae'));var _0x441b4c=[];_0x1d39cf[_0x551e('0x6f')](function(_0x575c66){_0x441b4c[_0x551e('0x32')](updateOpenchannelInteraction(_0x575c66,_0x3bb730,_0x4eccc7));});return BPromise[_0x551e('0xaf')](_0x441b4c);});});})['then'](function(_0x51bb72){_0xa9e9ff[_0x551e('0xb0')]=_0x51bb72;return _0xa9e9ff;})['then'](respondWithFilteredResult(_0x331307,_0x20662c))['catch'](handleError(_0x331307,null));};exports['show']=function(_0x56d3bd,_0x425b19){var _0x46d905={};if(_0x56d3bd[_0x551e('0x41')][_0x551e('0x3e')]&&_0x56d3bd[_0x551e('0x41')][_0x551e('0x3e')]===_0x551e('0x4d')){_0x46d905[_0x551e('0x4d')]=_0x56d3bd[_0x551e('0xb1')]['id'];}else{_0x46d905['id']=_0x56d3bd[_0x551e('0xb1')]['id'];}var _0xe1072d={'raw':![],'where':_0x46d905},_0x5c05eb={};_0x5c05eb[_0x551e('0x40')]=_[_0x551e('0x42')](db[_0x551e('0x99')][_0x551e('0x3c')]);_0x5c05eb[_0x551e('0x41')]=_[_0x551e('0x42')](_0x56d3bd[_0x551e('0x41')]);_0x5c05eb['filters']=_[_0x551e('0x43')](_0x5c05eb[_0x551e('0x40')],_0x5c05eb[_0x551e('0x41')]);_0xe1072d[_0x551e('0x44')]=_['intersection'](_0x5c05eb[_0x551e('0x40')],qs[_0x551e('0x45')](_0x56d3bd[_0x551e('0x41')]['fields']));_0xe1072d[_0x551e('0x44')]=_0xe1072d[_0x551e('0x44')][_0x551e('0x46')]?_0xe1072d[_0x551e('0x44')]:_0x5c05eb[_0x551e('0x40')];if(_0x56d3bd[_0x551e('0x41')]['includeAll']){_0xe1072d[_0x551e('0xb2')]=[{'all':!![]}];}_0xe1072d=_[_0x551e('0xb3')]({},_0xe1072d,_0x56d3bd[_0x551e('0xb4')]);return db['OpenchannelInteraction'][_0x551e('0xb5')](_0xe1072d)[_0x551e('0x29')](handleEntityNotFound(_0x425b19,null))[_0x551e('0x29')](respondWithResult(_0x425b19,null))[_0x551e('0x33')](handleError(_0x425b19,null));};exports[_0x551e('0xb6')]=function(_0x57fdf1,_0x34068e){return db[_0x551e('0x99')][_0x551e('0xb6')](_0x57fdf1['body'],{})[_0x551e('0x29')](respondWithResult(_0x34068e,0xc9))[_0x551e('0x33')](handleError(_0x34068e,null));};exports[_0x551e('0x28')]=function(_0x4d2f9c,_0x4eaf0d){if(_0x4d2f9c[_0x551e('0x73')]['id']){delete _0x4d2f9c['body']['id'];}return db[_0x551e('0x99')]['find']({'where':{'id':_0x4d2f9c[_0x551e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x4eaf0d,null))[_0x551e('0x29')](saveUpdates(_0x4d2f9c[_0x551e('0x73')],null))['then'](respondWithResult(_0x4eaf0d,null))['catch'](handleError(_0x4eaf0d,null));};exports[_0x551e('0x2a')]=function(_0x210c0b,_0x4dc945){return db[_0x551e('0x99')][_0x551e('0xb5')]({'where':{'id':_0x210c0b[_0x551e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x4dc945,null))[_0x551e('0x29')](removeEntity(_0x4dc945,null))[_0x551e('0x33')](handleError(_0x4dc945,null));};exports['describe']=function(_0x1f769e,_0x45c2ff){return db[_0x551e('0x99')][_0x551e('0xb7')]()[_0x551e('0x29')](respondWithResult(_0x45c2ff,null))['catch'](handleError(_0x45c2ff,null));};exports['addMessage']=function(_0x19aa66,_0x140263,_0x1cbeda){return db[_0x551e('0xb8')][_0x551e('0xb5')]({'where':{'id':_0x19aa66[_0x551e('0xb1')]['id']}})[_0x551e('0x29')](handleEntityNotFound(_0x140263,null))[_0x551e('0x29')](function(_0x3f6f58){if(_0x3f6f58){return _0x3f6f58[_0x551e('0xb9')](_0x19aa66[_0x551e('0x73')][_0x551e('0xba')],_[_0x551e('0xbb')](_0x19aa66[_0x551e('0x73')],[_0x551e('0xba'),'id'])||{});}})[_0x551e('0x29')](respondWithResult(_0x140263,null))[_0x551e('0x33')](handleError(_0x140263,null));};exports[_0x551e('0xbc')]=function(_0x386d46,_0x41ebfb,_0x3a5879){var _0x12d28e={'raw':![],'where':{}};var _0xc65d48={};var _0x193246={'count':0x0,'rows':[]};return db[_0x551e('0x99')][_0x551e('0xbd')]({'where':{'id':_0x386d46['params']['id']}})[_0x551e('0x29')](handleEntityNotFound(_0x41ebfb,null))['then'](function(_0x22dc5d){if(_0x22dc5d){_0xc65d48[_0x551e('0x40')]=_[_0x551e('0x42')](db[_0x551e('0xb8')][_0x551e('0x3c')]);_0xc65d48['query']=_[_0x551e('0x42')](_0x386d46[_0x551e('0x41')]);_0xc65d48['filters']=_[_0x551e('0x43')](_0xc65d48[_0x551e('0x40')],_0xc65d48[_0x551e('0x41')]);_0x12d28e[_0x551e('0x44')]=_[_0x551e('0x43')](_0xc65d48[_0x551e('0x40')],qs[_0x551e('0x45')](_0x386d46['query']['fields']));_0x12d28e[_0x551e('0x44')]=_0x12d28e['attributes'][_0x551e('0x46')]?_0x12d28e[_0x551e('0x44')]:_0xc65d48[_0x551e('0x40')];if(!_0x386d46[_0x551e('0x41')]['hasOwnProperty'](_0x551e('0x47'))){_0x12d28e[_0x551e('0x22')]=qs['limit'](_0x386d46[_0x551e('0x41')][_0x551e('0x22')]);_0x12d28e['offset']=qs[_0x551e('0x20')](_0x386d46['query'][_0x551e('0x20')]);}_0x12d28e[_0x551e('0x48')]=qs[_0x551e('0x49')](_0x386d46[_0x551e('0x41')][_0x551e('0x49')]);_0x12d28e['where']=qs[_0x551e('0x4b')](_[_0x551e('0x4a')](_0x386d46[_0x551e('0x41')],_0xc65d48['filters']));_0x12d28e[_0x551e('0x76')][_0x551e('0xae')]=_0x22dc5d['id'];if(_0x386d46[_0x551e('0x41')][_0x551e('0x83')]){_0x12d28e[_0x551e('0x76')]=_[_0x551e('0xb3')](_0x12d28e['where'],{'$or':_[_0x551e('0x74')](_0x12d28e['attributes'],function(_0xfc6429){var _0x57fee9={};_0x57fee9[_0xfc6429]={'$like':'%'+_0x386d46[_0x551e('0x41')]['filter']+'%'};return _0x57fee9;})});}if(_0x386d46[_0x551e('0x41')]['$gte']){var _0x5402d4=_0x386d46[_0x551e('0x41')][_0x551e('0x78')]['split'](',');var _0x5b6f19={};_0x5b6f19[_0x5402d4[0x0]]={'$gte':moment(_0x5402d4[0x1])[_0x551e('0xbe')](_0x551e('0xbf'))};_0x12d28e[_0x551e('0x76')]=_['merge'](_0x12d28e['where'],_0x5b6f19);}_0x12d28e=_[_0x551e('0xb3')]({},_0x12d28e,_0x386d46[_0x551e('0xb4')]);return db[_0x551e('0xb8')][_0x551e('0x23')]({'where':_0x12d28e[_0x551e('0x76')]})[_0x551e('0x29')](function(_0x4f663f){_0x193246[_0x551e('0x23')]=_0x4f663f;if(_0x386d46[_0x551e('0x41')][_0x551e('0xc0')]){_0x12d28e['include']=[{'all':!![]}];}return db[_0x551e('0xb8')][_0x551e('0xc1')](_0x12d28e);})[_0x551e('0x29')](function(_0xfb1527){_0x193246[_0x551e('0xb0')]=_0xfb1527;return _0x193246;});}})['then'](respondWithFilteredResult(_0x41ebfb,_0x12d28e))['catch'](handleError(_0x41ebfb,null));};exports['addTags']=function(_0x1f4517,_0x400a92,_0x4b20d8){return db[_0x551e('0x99')][_0x551e('0xb5')]({'where':{'id':_0x1f4517['params']['id']}})[_0x551e('0x29')](handleEntityNotFound(_0x400a92,null))['then'](function(_0x55e332){if(_0x55e332){return _0x55e332[_0x551e('0xc2')](_0x1f4517['body'][_0x551e('0xba')],_[_0x551e('0xbb')](_0x1f4517['body'],[_0x551e('0xba'),'id'])||{})[_0x551e('0xc3')](function(){return db[_0x551e('0x6e')]['findAll']({'attributes':['id',_0x551e('0x2d'),_0x551e('0xc4')],'where':{'id':_0x1f4517[_0x551e('0x73')][_0x551e('0xba')]}});})[_0x551e('0x29')](function(_0x29eda5){socket[_0x551e('0xc5')](_0x551e('0xc6'),{'id':Number(_0x1f4517[_0x551e('0xb1')]['id']),'tags':_0x29eda5||[]});return{'id':Number(_0x1f4517[_0x551e('0xb1')]['id']),'tags':_0x29eda5||[]};});}})[_0x551e('0x29')](respondWithResult(_0x400a92,null))[_0x551e('0x33')](handleError(_0x400a92,null));};exports[_0x551e('0xc7')]=function(_0x13e90c,_0x4d5c0c,_0xaad920){return db['OpenchannelInteraction']['find']({'where':{'id':_0x13e90c[_0x551e('0xb1')]['id']}})[_0x551e('0x29')](handleEntityNotFound(_0x4d5c0c,null))[_0x551e('0x29')](function(_0x40a06d){if(_0x40a06d){return _0x40a06d[_0x551e('0xc7')](_0x13e90c[_0x551e('0x41')]['ids']);}})[_0x551e('0x29')](respondWithStatusCode(_0x4d5c0c,null))[_0x551e('0x33')](handleError(_0x4d5c0c,null));};exports[_0x551e('0xc8')]=function(_0x566153,_0x2d6703){var _0x327169=moment()[_0x551e('0xc9')]()['toString']();var _0x406ef9=path[_0x551e('0xca')](config[_0x551e('0xcb')],_0x551e('0xcc'),_0x551e('0xcd'),_0x551e('0xce'));var _0x376a89=path[_0x551e('0xca')](config['root'],_0x551e('0xcc'),'files',_0x551e('0xcf'));var _0x8b0319=path[_0x551e('0xca')](_0x406ef9,_0x327169);var _0x3984b9=util['format']('transcript-%d-%s.zip',_0x566153['params']['id'],_0x327169);var _0x1f9eb1=path[_0x551e('0xca')](_0x406ef9,_0x3984b9);var _0x428175=[];_0x428175['push']({'model':db['User'],'as':_0x551e('0xd0'),'attributes':['id',_0x551e('0x2f')],'raw':!![]});_0x428175[_0x551e('0x32')]({'model':db['CmContact'],'as':_0x551e('0xd1'),'attributes':['id',_0x551e('0xd2'),_0x551e('0xd3')],'raw':!![]});if(_0x566153[_0x551e('0x41')]['attachments']){_0x428175['push']({'model':db['Attachment'],'as':_0x551e('0xd4'),'raw':!![]});}var _0x5d6fcc=[{'model':db[_0x551e('0xb8')],'as':'Messages','attributes':['id',_0x551e('0x73'),_0x551e('0x77'),_0x551e('0xd5'),_0x551e('0xd6'),_0x551e('0x7d')],'include':_0x428175}];_0x5d6fcc[_0x551e('0x32')]({'model':db[_0x551e('0xd7')],'as':_0x551e('0xd8'),'attributes':['id','name']});_0x5d6fcc[_0x551e('0x32')]({'model':db['User'],'as':_0x551e('0xd9'),'attributes':['id',_0x551e('0x2f')]});return db['OpenchannelInteraction'][_0x551e('0xb5')]({'where':{'id':_0x566153['params']['id']},'include':_0x5d6fcc})['then'](handleEntityNotFound(_0x2d6703,null))[_0x551e('0x29')](function(_0x502368){if(_0x502368){var _0x5e877c=_0x502368[_0x551e('0xda')]({'plain':!![]});fs[_0x551e('0xdb')](_0x8b0319);var _0x12c37e={'channel':_0x551e('0xdc'),'account':_0x5e877c[_0x551e('0xd8')]['name'],'agent':_0x5e877c[_0x551e('0xd9')]?_0x5e877c[_0x551e('0xd9')][_0x551e('0x2f')]:_0x551e('0xdd'),'createdAt':moment(_0x5e877c[_0x551e('0x77')])[_0x551e('0xbe')](_0x551e('0xbf'))[_0x551e('0xac')](),'closedAt':_0x5e877c[_0x551e('0x39')]?moment(_0x5e877c[_0x551e('0xde')])[_0x551e('0xbe')](_0x551e('0xbf'))[_0x551e('0xac')]():'','disposition':_0x5e877c[_0x551e('0xdf')],'visibility':_0x5e877c[_0x551e('0xe0')]?_0x551e('0xe1'):'Private','messages':_(_0x5e877c['Messages'])[_0x551e('0x83')]({'secret':![]})[_0x551e('0x74')](function(_0x4a8daa){if(_0x4a8daa['Attachment']){var _0x2d6046=path[_0x551e('0xca')](_0x376a89,_0x4a8daa[_0x551e('0xd4')][_0x551e('0xe2')]);if(fs[_0x551e('0xe3')](_0x2d6046)){fs[_0x551e('0xe4')](_0x2d6046)[_0x551e('0xe5')](fs[_0x551e('0xe6')](path[_0x551e('0xca')](_0x8b0319,_0x4a8daa[_0x551e('0xd4')][_0x551e('0xe2')])));}}return{'date':moment(_0x4a8daa['createdAt'])['format'](_0x551e('0xbf'))['toString'](),'sender':_0x4a8daa[_0x551e('0xd5')]===_0x551e('0xe7')?_0x4a8daa[_0x551e('0xd0')]?_0x4a8daa[_0x551e('0xd0')][_0x551e('0x2f')]:_0x551e('0xe8'):_0x4a8daa['Contact']['firstName']+(_0x4a8daa[_0x551e('0xd1')][_0x551e('0xd3')]?'\x20'+_0x4a8daa[_0x551e('0xd1')]['lastName']:''),'body':_0x4a8daa[_0x551e('0xd4')]?_0x4a8daa[_0x551e('0xd4')][_0x551e('0xe2')]:_0x4a8daa[_0x551e('0x73')],'direction':_0x4a8daa['direction']==='out'?'A':'C','secret':_0x4a8daa[_0x551e('0xd6')],'read':_0x4a8daa['read'],'attachment':_0x4a8daa['Attachment']};})[_0x551e('0x62')]()};return ejs[_0x551e('0xe9')](path[_0x551e('0xca')](config[_0x551e('0xcb')],'server',_0x551e('0xea'),_0x551e('0xeb')),{'interaction':_0x12c37e})['then'](function(_0x3f1bd3){var _0x54d4ec=path[_0x551e('0xca')](_0x8b0319,_0x551e('0xec')+_0x5e877c['id']+'-'+_0x327169+_0x551e('0xed'));var _0x55ab44={'path':_0x54d4ec,'channel':_0x551e('0xdc'),'interactionId':_0x5e877c['id']};return pdf['createPdfFromHTML'](_0x3f1bd3,_0x55ab44);})[_0x551e('0x29')](function(){return new BPromise(function(_0x5b0368,_0x48c725){zipdir(_0x8b0319,{'saveTo':_0x1f9eb1},function(_0x268da1,_0x2d1b49){if(_0x268da1)return _0x48c725(_0x268da1);return _0x5b0368(_0x2d1b49);});})[_0x551e('0x29')](function(){return new BPromise(function(_0x4059a4,_0x59bfcb){rimraf(_0x8b0319,function(_0x174001){if(_0x174001)_0x59bfcb(_0x174001);return _0x4059a4();});});})['then'](function(){return _0x2d6703['download'](_0x1f9eb1,_0x3984b9,function(_0x19f421){if(_0x19f421){console[_0x551e('0xee')](_0x551e('0xef'),_0x19f421);}else{fs[_0x551e('0xf0')](_0x1f9eb1);}});});});}else{return _0x2d6703[_0x551e('0x2b')](0xc8);}})[_0x551e('0x33')](handleError(_0x2d6703,null));}; \ No newline at end of file +var _0x9015=['util','path','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','save','then','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','push','talking','unmanaged','closed','UserId','waiting','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','sort','where','pick','select','field','color','from','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','buildExpression','some','compact','isEmpty','forEach','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','catch','show','params','keys','includeAll','include','merge','create','body','update','destroy','addMessage','ids','findOne','OpenchannelMessage','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','get','mkdirSync','Owner','N.A.','disposition','threadId','Public','Private','createReadStream','pipe','createWriteStream','basename','System','out','downloadInteraction.ejs','transcript-','.pdf','Openchannel','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3e1d0f,_0x4ed61d){var _0x54e687=function(_0x58e078){while(--_0x58e078){_0x3e1d0f['push'](_0x3e1d0f['shift']());}};_0x54e687(++_0x4ed61d);}(_0x9015,0xe4));var _0x5901=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x9015[_0xaa0309];return _0x5de7ce;};'use strict';var emlformat=require(_0x5901('0x0'));var rimraf=require(_0x5901('0x1'));var zipdir=require(_0x5901('0x2'));var jsonpatch=require(_0x5901('0x3'));var rp=require(_0x5901('0x4'));var moment=require(_0x5901('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5901('0x6'));var path=require(_0x5901('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5901('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5901('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5901('0xa'));var deskjs=require(_0x5901('0xb'));var toCsv=require(_0x5901('0xc'));var querystring=require('querystring');var Papa=require(_0x5901('0xd'));var Redis=require(_0x5901('0xe'));var authService=require(_0x5901('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x5901('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5901('0x11'));var config=require(_0x5901('0x12'));var licenseUtil=require(_0x5901('0x13'));var db=require(_0x5901('0x14'))['db'];config[_0x5901('0x15')]=_['defaults'](config[_0x5901('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x5901('0x16'))(new Redis(config[_0x5901('0x15')]));require('./openchannelInteraction.socket')[_0x5901('0x17')](socket);function respondWithStatusCode(_0x1b5675,_0xab015){_0xab015=_0xab015||0xcc;return function(_0x462def){if(_0x462def){return _0x1b5675[_0x5901('0x18')](_0xab015);}return _0x1b5675[_0x5901('0x19')](_0xab015)['end']();};}function respondWithResult(_0xcd786d,_0x645382){_0x645382=_0x645382||0xc8;return function(_0x3cdf80){if(_0x3cdf80){return _0xcd786d[_0x5901('0x19')](_0x645382)[_0x5901('0x1a')](_0x3cdf80);}};}function respondWithFilteredResult(_0x31e14c,_0x29999c){return function(_0x26904c){if(_0x26904c){var _0x529148=typeof _0x29999c[_0x5901('0x1b')]===_0x5901('0x1c')&&typeof _0x29999c[_0x5901('0x1d')]===_0x5901('0x1c');var _0x57f504=_0x26904c[_0x5901('0x1e')];var _0x2aa718=_0x529148?0x0:_0x29999c['offset'];var _0x2ff20=_0x529148?_0x26904c[_0x5901('0x1e')]:_0x29999c[_0x5901('0x1b')]+_0x29999c['limit'];var _0x302a55;if(_0x2ff20>=_0x57f504){_0x2ff20=_0x57f504;_0x302a55=0xc8;}else{_0x302a55=0xce;}_0x31e14c[_0x5901('0x19')](_0x302a55);return _0x31e14c[_0x5901('0x1f')]('Content-Range',_0x2aa718+'-'+_0x2ff20+'/'+_0x57f504)[_0x5901('0x1a')](_0x26904c);}return null;};}function patchUpdates(_0x2f12eb){return function(_0x2b46ae){try{jsonpatch['apply'](_0x2b46ae,_0x2f12eb,!![]);}catch(_0x313df6){return BPromise['reject'](_0x313df6);}return _0x2b46ae[_0x5901('0x20')]();};}function saveUpdates(_0x563ec0,_0x328275){return function(_0x25618b){if(_0x25618b){return _0x25618b['update'](_0x563ec0)[_0x5901('0x21')](function(_0x3aa6d8){return _0x3aa6d8;});}return null;};}function removeEntity(_0x49be3b,_0x898e67){return function(_0x170706){if(_0x170706){return _0x170706['destroy']()[_0x5901('0x21')](function(){_0x49be3b[_0x5901('0x19')](0xcc)[_0x5901('0x22')]();});}};}function handleEntityNotFound(_0x4c5f18,_0x1a17f1){return function(_0x29944f){if(!_0x29944f){_0x4c5f18[_0x5901('0x18')](0x194);}return _0x29944f;};}function handleError(_0x34b0d1,_0x4aeee5){_0x4aeee5=_0x4aeee5||0x1f4;return function(_0x1c36ea){logger[_0x5901('0x23')](_0x1c36ea[_0x5901('0x24')]);if(_0x1c36ea[_0x5901('0x25')]){delete _0x1c36ea[_0x5901('0x25')];}_0x34b0d1[_0x5901('0x19')](_0x4aeee5)[_0x5901('0x26')](_0x1c36ea);};}function getInteractionUsers(_0x3bc9a6,_0x5776cf){return new BPromise(function(_0x1dfe8c,_0x1e21b8){try{if(_0x5776cf[_0x3bc9a6['id']]){_0x3bc9a6[_0x5901('0x27')]=_[_0x5901('0x28')](_0x5776cf[_0x3bc9a6['id']],function(_0x182a39){return{'id':_0x182a39['id'],'fullname':_0x182a39[_0x5901('0x29')]};});}}catch(_0xdc3263){_0x1e21b8(_0xdc3263);}_0x1dfe8c(_0x3bc9a6);});}function getInteractionTags(_0x3a2299,_0x419122){return new BPromise(function(_0x169cd7,_0x50b662){try{if(_0x3a2299[_0x5901('0x2a')]){_0x3a2299[_0x5901('0x2b')]=[];_0x3a2299[_0x5901('0x2a')]['split'](',')['forEach'](function(_0x3089fa){_0x3a2299[_0x5901('0x2b')][_0x5901('0x2c')](_0x419122[_0x3089fa]);});}delete _0x3a2299[_0x5901('0x2a')];}catch(_0x1ddc27){_0x50b662(_0x1ddc27);}_0x169cd7(_0x3a2299);});}function updateOpenchannelInteraction(_0x4e7b6f,_0x31e5ba,_0x352c7a){return new BPromise(function(_0x3960ba,_0x663159){return getInteractionUsers(_0x4e7b6f,_0x352c7a)['then'](function(_0x134352){return getInteractionTags(_0x134352,_0x31e5ba);})[_0x5901('0x21')](function(_0x151280){return getStateInteraction(_0x151280);})[_0x5901('0x21')](function(_0x5c7aaf){_0x3960ba(_0x5c7aaf);})['catch'](function(_0x242049){_0x663159(_0x242049);});});}function getStateInteraction(_0x1a31ae){return new BPromise(function(_0x5793f6){_0x1a31ae['waiting']=0x0;_0x1a31ae[_0x5901('0x2d')]=0x0;_0x1a31ae['answered']=0x0;_0x1a31ae[_0x5901('0x2e')]=0x0;_0x1a31ae['total']=0x0;if(!_0x1a31ae[_0x5901('0x2f')]&&!_0x1a31ae[_0x5901('0x30')]){_0x1a31ae[_0x5901('0x31')]+=0x1;}if(!_0x1a31ae[_0x5901('0x2f')]&&_0x1a31ae['UserId']){_0x1a31ae[_0x5901('0x2d')]+=0x1;if(_0x1a31ae[_0x5901('0x31')]){_0x1a31ae['waiting']-=0x1;}}if(_0x1a31ae['closed']&&_0x1a31ae[_0x5901('0x30')]){_0x1a31ae['answered']+=0x1;if(_0x1a31ae[_0x5901('0x2d')]){_0x1a31ae[_0x5901('0x2d')]-=0x1;}}if(_0x1a31ae[_0x5901('0x2f')]&&!_0x1a31ae['UserId']){_0x1a31ae[_0x5901('0x2e')]+=0x1;if(_0x1a31ae['waiting']){_0x1a31ae[_0x5901('0x31')]-=0x1;}}_0x1a31ae['total']+=0x1;_0x5793f6(_0x1a31ae);});}exports[_0x5901('0x32')]=function(_0x1b8b80,_0x5a1bb7){var _0x7ec08e={},_0x31de8b={},_0xbbdfaf={'count':0x0,'rows':[]};var _0x2a170b=_[_0x5901('0x28')](db[_0x5901('0x33')][_0x5901('0x34')],function(_0x5ba059){return{'name':_0x5ba059[_0x5901('0x35')],'type':_0x5ba059[_0x5901('0x36')][_0x5901('0x37')]};});_0x31de8b[_0x5901('0x38')]=_['map'](_0x2a170b,_0x5901('0x25'));_0x31de8b[_0x5901('0x39')]=_['keys'](_0x1b8b80[_0x5901('0x39')]);_0x31de8b[_0x5901('0x3a')]=_[_0x5901('0x3b')](_0x31de8b[_0x5901('0x38')],_0x31de8b['query']);_0x7ec08e[_0x5901('0x3c')]=_[_0x5901('0x3b')](_0x31de8b[_0x5901('0x38')],qs[_0x5901('0x3d')](_0x1b8b80[_0x5901('0x39')]['fields']));_0x7ec08e[_0x5901('0x3c')]=_0x7ec08e[_0x5901('0x3c')][_0x5901('0x3e')]?_0x7ec08e[_0x5901('0x3c')]:_0x31de8b['model'];if(!_0x1b8b80[_0x5901('0x39')]['hasOwnProperty']('nolimit')){_0x7ec08e[_0x5901('0x1d')]=qs[_0x5901('0x1d')](_0x1b8b80['query'][_0x5901('0x1d')]);_0x7ec08e[_0x5901('0x1b')]=qs[_0x5901('0x1b')](_0x1b8b80[_0x5901('0x39')]['offset']);}_0x7ec08e['order']=qs['sort'](_0x1b8b80[_0x5901('0x39')][_0x5901('0x3f')]);_0x7ec08e[_0x5901('0x40')]=qs[_0x5901('0x3a')](_[_0x5901('0x41')](_0x1b8b80[_0x5901('0x39')],_0x31de8b[_0x5901('0x3a')]),_0x2a170b);var _0x3b877b=[];var _0xa96b66=squel[_0x5901('0x42')]()['field']('id')['field'](_0x5901('0x25'))[_0x5901('0x43')](_0x5901('0x44'))[_0x5901('0x45')]('tools_tags');var _0x4a3471=squel[_0x5901('0x42')]()['field']('u.id')[_0x5901('0x43')](_0x5901('0x46'))[_0x5901('0x43')](_0x5901('0x47'))[_0x5901('0x45')](_0x5901('0x48'),'ui')['left_join'](_0x5901('0x49'),'u',_0x5901('0x4a'));var _0x57183c=squel['select']()[_0x5901('0x45')](_0x5901('0x4b'),'i')[_0x5901('0x4c')](_0x5901('0x4d'),'c',_0x5901('0x4e'))[_0x5901('0x4c')](_0x5901('0x49'),'o','o.id\x20=\x20i.UserId')[_0x5901('0x4c')](_0x5901('0x4f'),'a',_0x5901('0x50'))[_0x5901('0x4c')](_0x5901('0x51'),'me',_0x5901('0x52'))['left_join']('openchannel_interaction_has_tags','it',_0x5901('0x53'))[_0x5901('0x4c')](_0x5901('0x54'),'t',_0x5901('0x55'));var _0x1a62d5=squel[_0x5901('0x56')]();var _0x18272f=[];var _0x5ef161=squel['expr']();var _0x2c4fab;if(_0x1b8b80[_0x5901('0x39')][_0x5901('0x57')]){_0x2c4fab=as[_0x5901('0x58')](_0x1b8b80['query']['search']);var _0x18e369=_0x2c4fab[_0x5901('0x59')];for(var _0x269d47=0x0;_0x269d47<_0x2c4fab[_0x5901('0x5a')][_0x5901('0x3e')];_0x269d47++){var _0x2b176b=_0x2c4fab[_0x5901('0x5a')][_0x269d47];var _0x2279fe='i';var _0x4f84cf=_[_0x5901('0x5b')](_0x2a170b,[_0x5901('0x25'),_0x2b176b[_0x5901('0x43')]]);if(!_0x4f84cf){switch(_0x2b176b[_0x5901('0x43')]){case _0x5901('0x5c'):if(_0x2b176b[_0x5901('0x5d')]==0x1){_0x57183c[_0x5901('0x5e')]('`'+_0x2b176b['field']+_0x5901('0x5f'));}else{_0x57183c['having']('`'+_0x2b176b[_0x5901('0x43')]+_0x5901('0x60'));}break;case _0x5901('0x61'):if(_0x2b176b[_0x5901('0x62')]===_0x5901('0x63')){if(_0x2b176b['value'][_0x5901('0x64')]('\x20')['length']>0x1){_0x1a62d5[_0x18e369]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2b176b['value']),null);}else{var _0x430499='%'+_0x2b176b[_0x5901('0x5d')]+'%';_0x1a62d5[_0x18e369](_0x5901('0x65'),_0x430499,_0x430499,_0x430499);}}else{_0x4f84cf=_[_0x5901('0x5b')](_0x2a170b,[_0x5901('0x25'),'ContactId']);_0x2b176b['field']=_0x5901('0x66');_0x33ae0d=as['buildExpression'](_0x2279fe,_0x4f84cf[_0x5901('0x36')],_0x2b176b);_0x1a62d5[_0x18e369](_0x33ae0d['text'],_0x33ae0d[_0x5901('0x5d')][_0x5901('0x67')],_0x33ae0d['value']['end']);}break;case _0x5901('0x68'):var _0x3b56cb=_0x2b176b[_0x5901('0x5d')][_0x5901('0x64')](',')[_0x5901('0x28')](function(_0x16346a){return Number(_0x16346a);});_0x3b56cb['forEach'](function(_0x16f4cb){_0x5ef161['or'](_0x5901('0x69'),'%,'+_0x16f4cb+',%');});_0x18272f=_[_0x5901('0x6a')](_0x18272f,_0x3b56cb);break;case _0x5901('0x6b'):if(_0x2b176b[_0x5901('0x62')]===_0x5901('0x63')){_0x1a62d5[_0x18e369](_0x5901('0x6c'),'%'+_0x2b176b['value']+'%',null);}else{_0x4f84cf=_[_0x5901('0x5b')](_0x2a170b,[_0x5901('0x25'),_0x5901('0x30')]);_0x2b176b['field']='UserId';_0x33ae0d=as['buildExpression'](_0x2279fe,_0x4f84cf[_0x5901('0x36')],_0x2b176b);_0x1a62d5[_0x18e369](_0x33ae0d[_0x5901('0x6d')],_0x33ae0d[_0x5901('0x5d')][_0x5901('0x67')],_0x33ae0d[_0x5901('0x5d')][_0x5901('0x22')]);}break;case'body':_0x33ae0d=as[_0x5901('0x6e')]('me',null,_0x2b176b);_0x1a62d5[_0x18e369](_0x33ae0d[_0x5901('0x6d')],_0x33ae0d[_0x5901('0x5d')][_0x5901('0x67')],_0x33ae0d[_0x5901('0x5d')][_0x5901('0x22')]);break;}}else{var _0x33ae0d=as[_0x5901('0x6e')](_0x2279fe,_0x4f84cf[_0x5901('0x36')],_0x2b176b);_0x1a62d5[_0x18e369](_0x33ae0d[_0x5901('0x6d')],_0x33ae0d[_0x5901('0x5d')]['start'],_0x33ae0d[_0x5901('0x5d')]['end']);}}}else{var _0x3dbe22=_(_0x1b8b80['query'])['keys']()[_0x5901('0x28')](function(_0x37c59b){return _[_0x5901('0x6f')](_0x2a170b,[_0x5901('0x25'),_0x37c59b])?_0x37c59b:undefined;})[_0x5901('0x70')]()[_0x5901('0x5d')]();if(!_[_0x5901('0x71')](_0x3dbe22)){_0x3dbe22[_0x5901('0x72')](function(_0x4d5f94){if(_0x4d5f94==='OpenchannelAccountId'){_0x57183c['where'](_0x5901('0x73'),[][_0x5901('0x74')](_0x1b8b80[_0x5901('0x39')][_0x4d5f94]));}else if(_0x4d5f94===_0x5901('0x75')){var _0x2aa45a=JSON[_0x5901('0x76')](_0x1b8b80[_0x5901('0x39')][_0x4d5f94])[_0x5901('0x77')];var _0x3f9569=JSON['parse'](_0x1b8b80[_0x5901('0x39')][_0x4d5f94])[_0x5901('0x78')];_0x57183c[_0x5901('0x40')](_0x5901('0x79'),_0x2aa45a,_0x3f9569);}else{if(_0x1b8b80[_0x5901('0x39')][_0x4d5f94]==='null'){_0x57183c[_0x5901('0x40')]('i.'+_0x4d5f94+'\x20IS\x20NULL');}else{_0x57183c[_0x5901('0x40')]('i.'+_0x4d5f94+_0x5901('0x7a'),_0x1b8b80[_0x5901('0x39')][_0x4d5f94]);}}});}if(_0x1b8b80[_0x5901('0x39')][_0x5901('0x7b')]){if(_0x1b8b80['query'][_0x5901('0x7b')]==0x1){_0x57183c['having']('`unreadMessages`\x20=\x200');}else{_0x57183c['having'](_0x5901('0x7c'));}}if(_0x1b8b80[_0x5901('0x39')][_0x5901('0x7d')]){_0x18272f=_[_0x5901('0x7e')](_0x1b8b80['query']['tag'])?_0x1b8b80[_0x5901('0x39')][_0x5901('0x7d')]:new Array(_0x1b8b80['query'][_0x5901('0x7d')]);_0x18272f[_0x5901('0x72')](function(_0x35bed3){_0x5ef161['or'](_0x5901('0x69'),'%,'+_0x35bed3+',%');});}if(_0x1b8b80[_0x5901('0x39')][_0x5901('0x7f')]){var _0x3bac37=_0x1b8b80['query'][_0x5901('0x7f')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3bac37)){_0x1a62d5['or'](_0x5901('0x80'),_0x3bac37+'%');}else{_0x1a62d5['or'](_0x5901('0x81'),qs[_0x5901('0x82')](_0x3bac37))['or'](_0x5901('0x83'),_0x3bac37+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3bac37+'%');}}}_0x57183c['where'](_0x1a62d5);_0x57183c[_0x5901('0x84')](_0x5901('0x85'));var _0x22a54a={'type':db['Sequelize'][_0x5901('0x86')][_0x5901('0x87')],'raw':!![]};var _0x332574=_0x57183c['clone']();_0x332574[_0x5901('0x43')]('i.id');_0x332574[_0x5901('0x43')](_0x5901('0x88'),_0x5901('0x5c'));if(_0x7ec08e['order']){_0x7ec08e[_0x5901('0x89')][_0x5901('0x72')](function(_0x339ca3){var _0x36ac43=_0x339ca3[0x0]===_0x5901('0x8a')?_0x339ca3[0x0]:'i.'+_0x339ca3[0x0];_0x57183c[_0x5901('0x89')](_0x36ac43,_0x339ca3[0x1]==='DESC'?![]:!![]);});}if(!_[_0x5901('0x71')](_0x18272f)){_0x57183c[_0x5901('0x5e')](_0x5ef161);_0x332574[_0x5901('0x40')](_0x5901('0x8b'),_0x18272f);}BPromise[_0x5901('0x8c')]()[_0x5901('0x21')](function(){if(!_0x2c4fab){if(_0x1b8b80[_0x5901('0x39')][_0x5901('0x8d')])return;_0x332574['where'](_0x5901('0x8e'));_0x57183c[_0x5901('0x40')](_0x5901('0x8e'));return;}if(_0x1b8b80[_0x5901('0x8f')][_0x5901('0x90')]!==_0x5901('0x91'))return;return _0x1b8b80[_0x5901('0x8f')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0xaf843a){if(_[_0x5901('0x71')](_0xaf843a)){_0x332574['where'](_0x5901('0x92'));_0x57183c[_0x5901('0x40')](_0x5901('0x92'));}else{_0x332574[_0x5901('0x40')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x5901('0x28')](_0xaf843a,'id'));_0x57183c[_0x5901('0x40')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x5901('0x28')](_0xaf843a,'id'));}});})[_0x5901('0x21')](function(){if(_0x1b8b80[_0x5901('0x8f')]['role']===_0x5901('0x91')&&!_0x2c4fab&&!_0x1b8b80[_0x5901('0x39')][_0x5901('0x8d')])return[];return db[_0x5901('0x93')][_0x5901('0x39')](_0x332574[_0x5901('0x94')](),_0x22a54a);})[_0x5901('0x21')](function(_0x39da55){_0xbbdfaf['count']=_0x39da55[_0x5901('0x3e')];if(_0xbbdfaf['count']===0x0)return[];return db[_0x5901('0x93')][_0x5901('0x39')](_0xa96b66['toString'](),_0x22a54a)['then'](function(_0xccc2f8){_0x3b877b=_['keyBy'](_0xccc2f8,'id');_0x22a54a=_['merge'](_0x22a54a,{'model':db[_0x5901('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1b8b80[_0x5901('0x39')][_0x5901('0x3d')]){_0x7ec08e[_0x5901('0x3c')]['forEach'](function(_0x3a1504){_0x57183c[_0x5901('0x43')]('i.'+_0x3a1504);});}else{_0x57183c[_0x5901('0x43')](_0x5901('0x88'),_0x5901('0x5c'));_0x57183c[_0x5901('0x43')](_0x5901('0x95'),'Account.key');_0x57183c[_0x5901('0x43')](_0x5901('0x96'),_0x5901('0x97'));_0x57183c[_0x5901('0x43')](_0x5901('0x98'),_0x5901('0x8a'));_0x57183c[_0x5901('0x43')](_0x5901('0x99'));_0x57183c['field']('c.firstName',_0x5901('0x9a'));_0x57183c[_0x5901('0x43')](_0x5901('0x9b'),_0x5901('0x9c'));_0x57183c[_0x5901('0x43')]('c.email','Contact.email');_0x57183c[_0x5901('0x43')]('c.phone',_0x5901('0x9d'));_0x57183c[_0x5901('0x43')](_0x5901('0x9e'),_0x5901('0x9f'));_0x57183c[_0x5901('0x43')](_0x5901('0xa0'),_0x5901('0xa1'));_0x57183c[_0x5901('0x43')]('o.fullname',_0x5901('0xa2'));_0x57183c[_0x5901('0x43')](_0x5901('0xa3'),_0x5901('0xa4'));_0x57183c[_0x5901('0x43')](_0x5901('0xa5'),'TagIds');}if(_0x7ec08e[_0x5901('0x1d')])_0x57183c['limit'](_0x7ec08e[_0x5901('0x1d')]);if(_0x7ec08e[_0x5901('0x1b')])_0x57183c[_0x5901('0x1b')](_0x7ec08e['offset']);return db['sequelize'][_0x5901('0x39')](_0x57183c[_0x5901('0x94')](),_0x22a54a);})['then'](function(_0x4c8123){if(_0x4c8123[_0x5901('0x3e')]>0x0)_0x4a3471[_0x5901('0x40')](_0x5901('0xa6'),_['map'](_0x4c8123,'id'));return db[_0x5901('0x93')]['query'](_0x4a3471[_0x5901('0x94')](),_0x22a54a)[_0x5901('0x21')](function(_0x37a147){var _0x9ec611=_[_0x5901('0xa7')](_0x37a147,_0x5901('0xa8'));var _0x22adbb=[];_0x4c8123[_0x5901('0x72')](function(_0xe73cfb){_0x22adbb[_0x5901('0x2c')](updateOpenchannelInteraction(_0xe73cfb,_0x3b877b,_0x9ec611));});return BPromise[_0x5901('0xa9')](_0x22adbb);});});})[_0x5901('0x21')](function(_0x4522e5){_0xbbdfaf[_0x5901('0xaa')]=_0x4522e5;return _0xbbdfaf;})[_0x5901('0x21')](respondWithFilteredResult(_0x5a1bb7,_0x7ec08e))[_0x5901('0xab')](handleError(_0x5a1bb7,null));};exports[_0x5901('0xac')]=function(_0x3dcfc3,_0x52b572){var _0x3bbca9={};if(_0x3dcfc3['query'][_0x5901('0x36')]&&_0x3dcfc3[_0x5901('0x39')][_0x5901('0x36')]===_0x5901('0x45')){_0x3bbca9[_0x5901('0x45')]=_0x3dcfc3[_0x5901('0xad')]['id'];}else{_0x3bbca9['id']=_0x3dcfc3[_0x5901('0xad')]['id'];}var _0x59ae24={'raw':![],'where':_0x3bbca9},_0x29bf21={};_0x29bf21[_0x5901('0x38')]=_[_0x5901('0xae')](db[_0x5901('0x33')][_0x5901('0x34')]);_0x29bf21[_0x5901('0x39')]=_[_0x5901('0xae')](_0x3dcfc3[_0x5901('0x39')]);_0x29bf21[_0x5901('0x3a')]=_[_0x5901('0x3b')](_0x29bf21['model'],_0x29bf21['query']);_0x59ae24[_0x5901('0x3c')]=_[_0x5901('0x3b')](_0x29bf21['model'],qs[_0x5901('0x3d')](_0x3dcfc3['query'][_0x5901('0x3d')]));_0x59ae24[_0x5901('0x3c')]=_0x59ae24[_0x5901('0x3c')][_0x5901('0x3e')]?_0x59ae24[_0x5901('0x3c')]:_0x29bf21[_0x5901('0x38')];if(_0x3dcfc3[_0x5901('0x39')][_0x5901('0xaf')]){_0x59ae24[_0x5901('0xb0')]=[{'all':!![]}];}_0x59ae24=_[_0x5901('0xb1')]({},_0x59ae24,_0x3dcfc3['options']);return db[_0x5901('0x33')][_0x5901('0x5b')](_0x59ae24)[_0x5901('0x21')](handleEntityNotFound(_0x52b572,null))[_0x5901('0x21')](respondWithResult(_0x52b572,null))[_0x5901('0xab')](handleError(_0x52b572,null));};exports[_0x5901('0xb2')]=function(_0x1a68bd,_0x11ea86){return db[_0x5901('0x33')][_0x5901('0xb2')](_0x1a68bd[_0x5901('0xb3')],{})[_0x5901('0x21')](respondWithResult(_0x11ea86,0xc9))[_0x5901('0xab')](handleError(_0x11ea86,null));};exports[_0x5901('0xb4')]=function(_0x4fe343,_0x3ae5a1){if(_0x4fe343[_0x5901('0xb3')]['id']){delete _0x4fe343[_0x5901('0xb3')]['id'];}return db['OpenchannelInteraction'][_0x5901('0x5b')]({'where':{'id':_0x4fe343[_0x5901('0xad')]['id']}})['then'](handleEntityNotFound(_0x3ae5a1,null))[_0x5901('0x21')](saveUpdates(_0x4fe343['body'],null))['then'](respondWithResult(_0x3ae5a1,null))[_0x5901('0xab')](handleError(_0x3ae5a1,null));};exports[_0x5901('0xb5')]=function(_0x1ee98c,_0x53f79e){return db[_0x5901('0x33')]['find']({'where':{'id':_0x1ee98c[_0x5901('0xad')]['id']}})[_0x5901('0x21')](handleEntityNotFound(_0x53f79e,null))[_0x5901('0x21')](removeEntity(_0x53f79e,null))[_0x5901('0xab')](handleError(_0x53f79e,null));};exports['describe']=function(_0x5e2175,_0x381a99){return db[_0x5901('0x33')]['describe']()[_0x5901('0x21')](respondWithResult(_0x381a99,null))['catch'](handleError(_0x381a99,null));};exports['addMessage']=function(_0x3d7818,_0x271d8f,_0x339312){return db['OpenchannelMessage'][_0x5901('0x5b')]({'where':{'id':_0x3d7818[_0x5901('0xad')]['id']}})[_0x5901('0x21')](handleEntityNotFound(_0x271d8f,null))[_0x5901('0x21')](function(_0x3ca5dd){if(_0x3ca5dd){return _0x3ca5dd[_0x5901('0xb6')](_0x3d7818[_0x5901('0xb3')][_0x5901('0xb7')],_['omit'](_0x3d7818[_0x5901('0xb3')],[_0x5901('0xb7'),'id'])||{});}})[_0x5901('0x21')](respondWithResult(_0x271d8f,null))['catch'](handleError(_0x271d8f,null));};exports['getMessages']=function(_0x4940c7,_0x5212ce,_0x58ae0e){var _0x3e7cf5={'raw':![],'where':{}};var _0x571645={};var _0x445804={'count':0x0,'rows':[]};return db[_0x5901('0x33')][_0x5901('0xb8')]({'where':{'id':_0x4940c7['params']['id']}})[_0x5901('0x21')](handleEntityNotFound(_0x5212ce,null))[_0x5901('0x21')](function(_0x5590d0){if(_0x5590d0){_0x571645['model']=_[_0x5901('0xae')](db[_0x5901('0xb9')][_0x5901('0x34')]);_0x571645[_0x5901('0x39')]=_[_0x5901('0xae')](_0x4940c7[_0x5901('0x39')]);_0x571645[_0x5901('0x3a')]=_['intersection'](_0x571645[_0x5901('0x38')],_0x571645[_0x5901('0x39')]);_0x3e7cf5[_0x5901('0x3c')]=_[_0x5901('0x3b')](_0x571645[_0x5901('0x38')],qs[_0x5901('0x3d')](_0x4940c7[_0x5901('0x39')][_0x5901('0x3d')]));_0x3e7cf5[_0x5901('0x3c')]=_0x3e7cf5['attributes']['length']?_0x3e7cf5['attributes']:_0x571645[_0x5901('0x38')];if(!_0x4940c7[_0x5901('0x39')]['hasOwnProperty'](_0x5901('0xba'))){_0x3e7cf5[_0x5901('0x1d')]=qs[_0x5901('0x1d')](_0x4940c7[_0x5901('0x39')]['limit']);_0x3e7cf5[_0x5901('0x1b')]=qs[_0x5901('0x1b')](_0x4940c7[_0x5901('0x39')]['offset']);}_0x3e7cf5['order']=qs[_0x5901('0x3f')](_0x4940c7[_0x5901('0x39')]['sort']);_0x3e7cf5[_0x5901('0x40')]=qs[_0x5901('0x3a')](_[_0x5901('0x41')](_0x4940c7[_0x5901('0x39')],_0x571645['filters']));_0x3e7cf5[_0x5901('0x40')][_0x5901('0xa8')]=_0x5590d0['id'];if(_0x4940c7[_0x5901('0x39')][_0x5901('0x7f')]){_0x3e7cf5[_0x5901('0x40')]=_[_0x5901('0xb1')](_0x3e7cf5[_0x5901('0x40')],{'$or':_[_0x5901('0x28')](_0x3e7cf5['attributes'],function(_0x455751){var _0x483ba5={};_0x483ba5[_0x455751]={'$like':'%'+_0x4940c7['query'][_0x5901('0x7f')]+'%'};return _0x483ba5;})});}if(_0x4940c7[_0x5901('0x39')][_0x5901('0x77')]){var _0x2f1f61=_0x4940c7[_0x5901('0x39')][_0x5901('0x77')][_0x5901('0x64')](',');var _0x12bb5a={};_0x12bb5a[_0x2f1f61[0x0]]={'$gte':moment(_0x2f1f61[0x1])[_0x5901('0xbb')](_0x5901('0xbc'))};_0x3e7cf5[_0x5901('0x40')]=_[_0x5901('0xb1')](_0x3e7cf5[_0x5901('0x40')],_0x12bb5a);}_0x3e7cf5=_[_0x5901('0xb1')]({},_0x3e7cf5,_0x4940c7['options']);return db[_0x5901('0xb9')][_0x5901('0x1e')]({'where':_0x3e7cf5[_0x5901('0x40')]})[_0x5901('0x21')](function(_0x2bfa86){_0x445804[_0x5901('0x1e')]=_0x2bfa86;if(_0x4940c7[_0x5901('0x39')][_0x5901('0xaf')]){_0x3e7cf5[_0x5901('0xb0')]=[{'all':!![]}];}return db[_0x5901('0xb9')][_0x5901('0xbd')](_0x3e7cf5);})[_0x5901('0x21')](function(_0x20d495){_0x445804[_0x5901('0xaa')]=_0x20d495;return _0x445804;});}})['then'](respondWithFilteredResult(_0x5212ce,_0x3e7cf5))[_0x5901('0xab')](handleError(_0x5212ce,null));};exports[_0x5901('0xbe')]=function(_0x242f94,_0x5f17ca,_0x24a685){return db['OpenchannelInteraction'][_0x5901('0x5b')]({'where':{'id':_0x242f94['params']['id']}})[_0x5901('0x21')](handleEntityNotFound(_0x5f17ca,null))[_0x5901('0x21')](function(_0x36db22){if(_0x36db22){return _0x36db22[_0x5901('0xbf')](_0x242f94[_0x5901('0xb3')][_0x5901('0xb7')],_['omit'](_0x242f94[_0x5901('0xb3')],[_0x5901('0xb7'),'id'])||{})[_0x5901('0xc0')](function(){return db[_0x5901('0x68')]['findAll']({'attributes':['id',_0x5901('0x25'),_0x5901('0x44')],'where':{'id':_0x242f94[_0x5901('0xb3')][_0x5901('0xb7')]}});})[_0x5901('0x21')](function(_0x8c61e4){socket[_0x5901('0xc1')](_0x5901('0xc2'),{'id':Number(_0x242f94['params']['id']),'tags':_0x8c61e4||[]});return{'id':Number(_0x242f94[_0x5901('0xad')]['id']),'tags':_0x8c61e4||[]};});}})[_0x5901('0x21')](respondWithResult(_0x5f17ca,null))['catch'](handleError(_0x5f17ca,null));};exports[_0x5901('0xc3')]=function(_0x597e67,_0x401ffd,_0x522917){return db[_0x5901('0x33')]['find']({'where':{'id':_0x597e67[_0x5901('0xad')]['id']}})[_0x5901('0x21')](handleEntityNotFound(_0x401ffd,null))[_0x5901('0x21')](function(_0x484ebf){if(_0x484ebf){return _0x484ebf[_0x5901('0xc3')](_0x597e67[_0x5901('0x39')][_0x5901('0xb7')]);}})['then'](respondWithStatusCode(_0x401ffd,null))['catch'](handleError(_0x401ffd,null));};exports[_0x5901('0xc4')]=function(_0x55357e,_0x1bc894){var _0x450047=moment()[_0x5901('0xc5')]()[_0x5901('0x94')]();var _0x599f1a=path[_0x5901('0xc6')](config[_0x5901('0xc7')],'server',_0x5901('0xc8'),_0x5901('0xc9'));var _0xa1d4d2=path[_0x5901('0xc6')](config[_0x5901('0xc7')],_0x5901('0xca'),_0x5901('0xc8'),_0x5901('0xcb'));var _0x53848a=path[_0x5901('0xc6')](_0x599f1a,_0x450047);var _0x3fa981=util['format']('transcript-%d-%s.zip',_0x55357e[_0x5901('0xad')]['id'],_0x450047);var _0x5445a8=path[_0x5901('0xc6')](_0x599f1a,_0x3fa981);var _0x4b8603=[];_0x4b8603['push']({'model':db['User'],'as':'User','attributes':['id',_0x5901('0x29')],'raw':!![]});_0x4b8603['push']({'model':db[_0x5901('0xcc')],'as':_0x5901('0x61'),'attributes':['id',_0x5901('0xcd'),_0x5901('0xce')],'raw':!![]});if(_0x55357e[_0x5901('0x39')][_0x5901('0xcb')]){_0x4b8603[_0x5901('0x2c')]({'model':db[_0x5901('0xcf')],'as':_0x5901('0xcf'),'raw':!![]});}var _0xa02900=[{'model':db['OpenchannelMessage'],'as':_0x5901('0xd0'),'attributes':['id',_0x5901('0xb3'),_0x5901('0x75'),_0x5901('0xd1'),_0x5901('0xd2'),_0x5901('0x7b')],'include':_0x4b8603}];_0xa02900[_0x5901('0x2c')]({'model':db[_0x5901('0xd3')],'as':_0x5901('0xd4'),'attributes':['id',_0x5901('0x25')]});_0xa02900[_0x5901('0x2c')]({'model':db['User'],'as':'Owner','attributes':['id',_0x5901('0x29')]});return db[_0x5901('0x33')]['find']({'where':{'id':_0x55357e[_0x5901('0xad')]['id']},'include':_0xa02900})['then'](handleEntityNotFound(_0x1bc894,null))[_0x5901('0x21')](function(_0x45b5db){if(_0x45b5db){var _0x3bfba6=_0x45b5db[_0x5901('0xd5')]({'plain':!![]});fs[_0x5901('0xd6')](_0x53848a);var _0x4d8589={'channel':'Openchannel','account':_0x3bfba6[_0x5901('0xd4')]['name'],'agent':_0x3bfba6[_0x5901('0xd7')]?_0x3bfba6['Owner'][_0x5901('0x29')]:_0x5901('0xd8'),'createdAt':moment(_0x3bfba6[_0x5901('0x75')])[_0x5901('0xbb')](_0x5901('0xbc'))['toString'](),'closedAt':_0x3bfba6[_0x5901('0x2f')]?moment(_0x3bfba6['closedAt'])['format'](_0x5901('0xbc'))['toString']():'','disposition':_0x3bfba6[_0x5901('0xd9')],'visibility':_0x3bfba6[_0x5901('0xda')]?_0x5901('0xdb'):_0x5901('0xdc'),'messages':_(_0x3bfba6[_0x5901('0xd0')])[_0x5901('0x7f')]({'secret':![]})[_0x5901('0x28')](function(_0x3b1fba){if(_0x3b1fba[_0x5901('0xcf')]){var _0x1132f5=path[_0x5901('0xc6')](_0xa1d4d2,_0x3b1fba[_0x5901('0xcf')]['basename']);if(fs['existsSync'](_0x1132f5)){fs[_0x5901('0xdd')](_0x1132f5)[_0x5901('0xde')](fs[_0x5901('0xdf')](path['join'](_0x53848a,_0x3b1fba[_0x5901('0xcf')][_0x5901('0xe0')])));}}return{'date':moment(_0x3b1fba[_0x5901('0x75')])[_0x5901('0xbb')](_0x5901('0xbc'))['toString'](),'sender':_0x3b1fba['direction']==='out'?_0x3b1fba[_0x5901('0x6b')]?_0x3b1fba[_0x5901('0x6b')][_0x5901('0x29')]:_0x5901('0xe1'):_0x3b1fba[_0x5901('0x61')][_0x5901('0xcd')]+(_0x3b1fba[_0x5901('0x61')][_0x5901('0xce')]?'\x20'+_0x3b1fba[_0x5901('0x61')][_0x5901('0xce')]:''),'body':_0x3b1fba[_0x5901('0xcf')]?_0x3b1fba[_0x5901('0xcf')]['basename']:_0x3b1fba[_0x5901('0xb3')],'direction':_0x3b1fba[_0x5901('0xd1')]===_0x5901('0xe2')?'A':'C','secret':_0x3b1fba['secret'],'read':_0x3b1fba['read'],'attachment':_0x3b1fba['Attachment']};})[_0x5901('0x5d')]()};return ejs['renderFile'](path[_0x5901('0xc6')](config[_0x5901('0xc7')],_0x5901('0xca'),'views',_0x5901('0xe3')),{'interaction':_0x4d8589})[_0x5901('0x21')](function(_0x4e9b47){var _0x5824c7=path['join'](_0x53848a,_0x5901('0xe4')+_0x3bfba6['id']+'-'+_0x450047+_0x5901('0xe5'));var _0x2ea95e={'path':_0x5824c7,'channel':_0x5901('0xe6'),'interactionId':_0x3bfba6['id']};return pdf['createPdfFromHTML'](_0x4e9b47,_0x2ea95e);})[_0x5901('0x21')](function(){return new BPromise(function(_0x2c88,_0x18bd17){zipdir(_0x53848a,{'saveTo':_0x5445a8},function(_0x3d26f0,_0x2a190d){if(_0x3d26f0)return _0x18bd17(_0x3d26f0);return _0x2c88(_0x2a190d);});})[_0x5901('0x21')](function(){return new BPromise(function(_0x522953,_0x1ffc6d){rimraf(_0x53848a,function(_0x1b24f5){if(_0x1b24f5)_0x1ffc6d(_0x1b24f5);return _0x522953();});});})[_0x5901('0x21')](function(){return _0x1bc894[_0x5901('0xc4')](_0x5445a8,_0x3fa981,function(_0x44a84b){if(_0x44a84b){console[_0x5901('0xe7')](_0x5901('0xe8'),_0x44a84b);}else{fs[_0x5901('0xe9')](_0x5445a8);}});});});}else{return _0x1bc894[_0x5901('0x18')](0xc8);}})[_0x5901('0xab')](handleError(_0x1bc894,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 6d4ca02..84cd14b 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 _0x00e1=['unreadMessages','length','emit','catch','hasOwnProperty','exports','events','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then','Users','map'];(function(_0x2fa1c6,_0x4a5b8d){var _0x5f3257=function(_0x195b53){while(--_0x195b53){_0x2fa1c6['push'](_0x2fa1c6['shift']());}};_0x5f3257(++_0x4a5b8d);}(_0x00e1,0x1e6));var _0x100e=function(_0x27e52d,_0x360312){_0x27e52d=_0x27e52d-0x0;var _0x1977f9=_0x00e1[_0x27e52d];return _0x1977f9;};'use strict';var EventEmitter=require(_0x100e('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x100e('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x100e('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x100e('0x3')](0x0);var events={'afterCreate':_0x100e('0x4'),'afterUpdate':'update','afterDestroy':_0x100e('0x5')};function emitEvent(_0xca0508){return function(_0x54a148,_0x1400c6,_0x93d2b2){_0x54a148[_0x100e('0x6')]({'attributes':['id'],'raw':!![]})[_0x100e('0x7')](function(_0x35af81){_0x54a148['setDataValue'](_0x100e('0x8'),_0x35af81[_0x100e('0x9')](function(_0x416e95){return{'id':_0x416e95['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x54a148['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x289d98){_0x54a148['setDataValue'](_0x100e('0xa'),_0x289d98[_0x100e('0xb')]);OpenchannelInteractionEvents[_0x100e('0xc')](_0xca0508+':'+_0x54a148['id'],_0x54a148);OpenchannelInteractionEvents[_0x100e('0xc')](_0xca0508,_0x54a148);_0x93d2b2(null);})[_0x100e('0xd')](_0x93d2b2(null));};}for(var e in events){if(events[_0x100e('0xe')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x100e('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x597d=['../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','getUsers','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x31c7b6,_0x5778bb){var _0x5ea4cc=function(_0xd624b4){while(--_0xd624b4){_0x31c7b6['push'](_0x31c7b6['shift']());}};_0x5ea4cc(++_0x5778bb);}(_0x597d,0x9f));var _0xd597=function(_0x101bb2,_0x30386e){_0x101bb2=_0x101bb2-0x0;var _0x306522=_0x597d[_0x101bb2];return _0x306522;};'use strict';var EventEmitter=require(_0xd597('0x0'));var OpenchannelInteraction=require(_0xd597('0x1'))['db'][_0xd597('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xd597('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd597('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x195411){return function(_0x353e0f,_0xd2022d,_0x47e95f){_0x353e0f[_0xd597('0x5')]({'attributes':['id'],'raw':!![]})[_0xd597('0x6')](function(_0x1b5405){_0x353e0f[_0xd597('0x7')](_0xd597('0x8'),_0x1b5405[_0xd597('0x9')](function(_0x4c90ce){return{'id':_0x4c90ce['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x353e0f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd597('0x6')](function(_0x4ee2d1){_0x353e0f[_0xd597('0x7')]('unreadMessages',_0x4ee2d1[_0xd597('0xa')]);OpenchannelInteractionEvents[_0xd597('0xb')](_0x195411+':'+_0x353e0f['id'],_0x353e0f);OpenchannelInteractionEvents['emit'](_0x195411,_0x353e0f);_0x47e95f(null);})[_0xd597('0xc')](_0x47e95f(null));};}for(var e in events){if(events[_0xd597('0xd')](e)){var event=events[e];OpenchannelInteraction[_0xd597('0xe')](e,emitEvent(event));}}module[_0xd597('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index ca1c69a..6d32ddb 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 _0xe293=['./openchannelInteraction.attributes','OpenchannelInteraction','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3fdcc0,_0x15b535){var _0x4baad9=function(_0x12d0db){while(--_0x12d0db){_0x3fdcc0['push'](_0x3fdcc0['shift']());}};_0x4baad9(++_0x15b535);}(_0xe293,0x117));var _0x3e29=function(_0x456032,_0x1a799d){_0x456032=_0x456032-0x0;var _0x1a53cd=_0xe293[_0x456032];return _0x1a53cd;};'use strict';var _=require('lodash');var util=require(_0x3e29('0x0'));var logger=require(_0x3e29('0x1'))(_0x3e29('0x2'));var moment=require(_0x3e29('0x3'));var BPromise=require(_0x3e29('0x4'));var rp=require(_0x3e29('0x5'));var fs=require('fs');var path=require(_0x3e29('0x6'));var rimraf=require(_0x3e29('0x7'));var config=require(_0x3e29('0x8'));var attributes=require(_0x3e29('0x9'));module['exports']=function(_0x143d3e,_0x3a58c8){return _0x143d3e['define'](_0x3e29('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3e29('0xb'),'hooks':{'beforeUpdate':function(_0x566926,_0x1242b1,_0x14fb40){if(_0x566926[_0x3e29('0xc')]('closed')){_0x566926[_0x3e29('0xd')]=moment()[_0x3e29('0xe')](_0x3e29('0xf'));}_0x14fb40(null,_0x566926);}}});}; \ No newline at end of file +var _0x6441=['moment','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0x6441,0x96));var _0x1644=function(_0x17eab0,_0x45d922){_0x17eab0=_0x17eab0-0x0;var _0x418a15=_0x6441[_0x17eab0];return _0x418a15;};'use strict';var _=require('lodash');var util=require(_0x1644('0x0'));var logger=require(_0x1644('0x1'))(_0x1644('0x2'));var moment=require(_0x1644('0x3'));var BPromise=require('bluebird');var rp=require(_0x1644('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1644('0x5'));var config=require(_0x1644('0x6'));var attributes=require(_0x1644('0x7'));module['exports']=function(_0x28dd39,_0x38c1dd){return _0x28dd39['define'](_0x1644('0x8'),attributes,{'tableName':_0x1644('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1644('0xa'),'collate':_0x1644('0xb'),'hooks':{'beforeUpdate':function(_0x39a698,_0x4658ad,_0x41929d){if(_0x39a698[_0x1644('0xc')](_0x1644('0xd'))){_0x39a698[_0x1644('0xe')]=moment()[_0x1644('0xf')](_0x1644('0x10'));}_0x41929d(null,_0x39a698);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index a2d4847..c0135fe 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 _0xdd6d=['raw','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','addTags','omit','ids','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','body','options'];(function(_0x250a16,_0x1df38d){var _0x4cfd3d=function(_0x15176b){while(--_0x15176b){_0x250a16['push'](_0x250a16['shift']());}};_0x4cfd3d(++_0x1df38d);}(_0xdd6d,0x8d));var _0xddd6=function(_0x118af2,_0x5cc196){_0x118af2=_0x118af2-0x0;var _0x2854b4=_0xdd6d[_0x118af2];return _0x2854b4;};'use strict';var _=require('lodash');var util=require(_0xddd6('0x0'));var moment=require(_0xddd6('0x1'));var BPromise=require(_0xddd6('0x2'));var rs=require(_0xddd6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xddd6('0x4'))['db'];var utils=require(_0xddd6('0x5'));var logger=require('../../config/logger')(_0xddd6('0x6'));var config=require(_0xddd6('0x7'));var jayson=require(_0xddd6('0x8'));var client=jayson[_0xddd6('0x9')][_0xddd6('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xddd6('0xb')],{'host':_0xddd6('0xc'),'port':0x18eb});var socket=require(_0xddd6('0xd'))(new Redis(config[_0xddd6('0xb')]));require(_0xddd6('0xe'))[_0xddd6('0xf')](socket);function respondWithRpcPromise(_0xe1a8d1,_0x4d78c5,_0x201237){return new BPromise(function(_0x3d9819,_0x1918ce){return client['request'](_0xe1a8d1,_0x201237)[_0xddd6('0x10')](function(_0x23fd27){logger[_0xddd6('0x11')](_0xddd6('0x12'),_0x4d78c5,_0xddd6('0x13'));logger[_0xddd6('0x14')](_0xddd6('0x15'),_0x4d78c5,_0xddd6('0x13'),JSON[_0xddd6('0x16')](_0x23fd27));if(_0x23fd27['error']){if(_0x23fd27[_0xddd6('0x17')][_0xddd6('0x18')]===0x1f4){logger[_0xddd6('0x17')](_0xddd6('0x12'),_0x4d78c5,_0x23fd27['error'][_0xddd6('0x19')]);return _0x1918ce(_0x23fd27['error']['message']);}logger['error'](_0xddd6('0x12'),_0x4d78c5,_0x23fd27[_0xddd6('0x17')]['message']);return _0x3d9819(_0x23fd27[_0xddd6('0x17')]['message']);}else{logger['info'](_0xddd6('0x12'),_0x4d78c5,'request\x20sent');_0x3d9819(_0x23fd27[_0xddd6('0x1a')][_0xddd6('0x19')]);}})[_0xddd6('0x1b')](function(_0x5c5af5){logger[_0xddd6('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4d78c5,_0x5c5af5);_0x1918ce(_0x5c5af5);});});}exports['UpdateOpenchannelInteraction']=function(_0x514d8c){var _0x3fd75c=this;return new Promise(function(_0x204858,_0x1b1cfb){return db['OpenchannelInteraction'][_0xddd6('0x1c')](_0x514d8c[_0xddd6('0x1d')],{'raw':_0x514d8c[_0xddd6('0x1e')]?_0x514d8c['options'][_0xddd6('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x514d8c[_0xddd6('0x1e')]?_0x514d8c['options']['where']||null:null,'attributes':_0x514d8c['options']?_0x514d8c['options'][_0xddd6('0x20')]||null:null,'limit':_0x514d8c[_0xddd6('0x1e')]?_0x514d8c[_0xddd6('0x1e')][_0xddd6('0x21')]||null:null})[_0xddd6('0x10')](function(_0x1731e8){logger['info'](_0xddd6('0x22'),_0x514d8c);logger[_0xddd6('0x14')](_0xddd6('0x22'),_0x514d8c,JSON[_0xddd6('0x16')](_0x1731e8));_0x204858(_0x1731e8);})[_0xddd6('0x1b')](function(_0x16b5cb){logger[_0xddd6('0x17')](_0xddd6('0x22'),_0x16b5cb[_0xddd6('0x19')],_0x514d8c);_0x1b1cfb(_0x3fd75c[_0xddd6('0x17')](0x1f4,_0x16b5cb[_0xddd6('0x19')]));});});};exports[_0xddd6('0x23')]=function(_0x57a5a0){return new Promise(function(_0x4d341c,_0x1cf335){return db[_0xddd6('0x24')][_0xddd6('0x25')]({'where':_0x57a5a0[_0xddd6('0x1e')]?_0x57a5a0['options'][_0xddd6('0x26')]||null:null})[_0xddd6('0x10')](function(_0x3e807e){if(_0x3e807e){return _0x3e807e[_0xddd6('0x27')](_0x57a5a0[_0xddd6('0x1d')]['ids'],_[_0xddd6('0x28')](_0x57a5a0['body'],[_0xddd6('0x29'),'id'])||{});}})['spread'](function(_0x3b2202){logger['info'](_0xddd6('0x2a'),_0x57a5a0);logger[_0xddd6('0x14')](_0xddd6('0x2a'),_0x57a5a0,JSON['stringify'](_0x3b2202));_0x4d341c(_0x3b2202);})[_0xddd6('0x1b')](function(_0x4e307b){logger[_0xddd6('0x17')](_0xddd6('0x2a'),_0x4e307b[_0xddd6('0x19')],_0x57a5a0);_0x1cf335(_this[_0xddd6('0x17')](0x1f4,_0x4e307b[_0xddd6('0x19')]));});});}; \ No newline at end of file +var _0x76e3=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags'];(function(_0x43bafa,_0x4b5baf){var _0x56041e=function(_0x3b09af){while(--_0x3b09af){_0x43bafa['push'](_0x43bafa['shift']());}};_0x56041e(++_0x4b5baf);}(_0x76e3,0x170));var _0x376e=function(_0x19c72f,_0x59592d){_0x19c72f=_0x19c72f-0x0;var _0x2dfe6a=_0x76e3[_0x19c72f];return _0x2dfe6a;};'use strict';var _=require('lodash');var util=require(_0x376e('0x0'));var moment=require(_0x376e('0x1'));var BPromise=require(_0x376e('0x2'));var rs=require(_0x376e('0x3'));var fs=require('fs');var Redis=require(_0x376e('0x4'));var db=require(_0x376e('0x5'))['db'];var utils=require(_0x376e('0x6'));var logger=require(_0x376e('0x7'))(_0x376e('0x8'));var config=require('../../config/environment');var jayson=require(_0x376e('0x9'));var client=jayson[_0x376e('0xa')][_0x376e('0xb')]({'port':0x232a});config[_0x376e('0xc')]=_[_0x376e('0xd')](config[_0x376e('0xc')],{'host':_0x376e('0xe'),'port':0x18eb});var socket=require(_0x376e('0xf'))(new Redis(config[_0x376e('0xc')]));require(_0x376e('0x10'))[_0x376e('0x11')](socket);function respondWithRpcPromise(_0x9179b4,_0x321755,_0x374bff){return new BPromise(function(_0xa8c24,_0x477ba1){return client[_0x376e('0x12')](_0x9179b4,_0x374bff)[_0x376e('0x13')](function(_0x166a48){logger[_0x376e('0x14')](_0x376e('0x15'),_0x321755,'request\x20sent');logger['debug'](_0x376e('0x16'),_0x321755,_0x376e('0x17'),JSON[_0x376e('0x18')](_0x166a48));if(_0x166a48[_0x376e('0x19')]){if(_0x166a48[_0x376e('0x19')][_0x376e('0x1a')]===0x1f4){logger[_0x376e('0x19')](_0x376e('0x15'),_0x321755,_0x166a48[_0x376e('0x19')][_0x376e('0x1b')]);return _0x477ba1(_0x166a48[_0x376e('0x19')]['message']);}logger[_0x376e('0x19')](_0x376e('0x15'),_0x321755,_0x166a48['error']['message']);return _0xa8c24(_0x166a48['error'][_0x376e('0x1b')]);}else{logger[_0x376e('0x14')](_0x376e('0x15'),_0x321755,_0x376e('0x17'));_0xa8c24(_0x166a48[_0x376e('0x1c')][_0x376e('0x1b')]);}})[_0x376e('0x1d')](function(_0x567554){logger[_0x376e('0x19')](_0x376e('0x15'),_0x321755,_0x567554);_0x477ba1(_0x567554);});});}exports[_0x376e('0x1e')]=function(_0x136a1b){var _0x3e1f5a=this;return new Promise(function(_0x18e7c7,_0x9d9149){return db[_0x376e('0x1f')][_0x376e('0x20')](_0x136a1b[_0x376e('0x21')],{'raw':_0x136a1b[_0x376e('0x22')]?_0x136a1b[_0x376e('0x22')][_0x376e('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x136a1b['options']?_0x136a1b['options'][_0x376e('0x24')]||null:null,'attributes':_0x136a1b[_0x376e('0x22')]?_0x136a1b['options'][_0x376e('0x25')]||null:null,'limit':_0x136a1b[_0x376e('0x22')]?_0x136a1b[_0x376e('0x22')][_0x376e('0x26')]||null:null})[_0x376e('0x13')](function(_0x14f98b){logger[_0x376e('0x14')]('UpdateOpenchannelInteraction',_0x136a1b);logger['debug'](_0x376e('0x1e'),_0x136a1b,JSON['stringify'](_0x14f98b));_0x18e7c7(_0x14f98b);})[_0x376e('0x1d')](function(_0x3b8569){logger['error'](_0x376e('0x1e'),_0x3b8569[_0x376e('0x1b')],_0x136a1b);_0x9d9149(_0x3e1f5a['error'](0x1f4,_0x3b8569[_0x376e('0x1b')]));});});};exports[_0x376e('0x27')]=function(_0x2043b1){return new Promise(function(_0x3446c6,_0x3a15ec){return db[_0x376e('0x1f')][_0x376e('0x28')]({'where':_0x2043b1[_0x376e('0x22')]?_0x2043b1[_0x376e('0x22')]['where']||null:null})[_0x376e('0x13')](function(_0x479fac){if(_0x479fac){return _0x479fac[_0x376e('0x29')](_0x2043b1[_0x376e('0x21')][_0x376e('0x2a')],_[_0x376e('0x2b')](_0x2043b1[_0x376e('0x21')],[_0x376e('0x2a'),'id'])||{});}})[_0x376e('0x2c')](function(_0x4f477a){logger[_0x376e('0x14')]('AddTags',_0x2043b1);logger['debug'](_0x376e('0x2d'),_0x2043b1,JSON[_0x376e('0x18')](_0x4f477a));_0x3446c6(_0x4f477a);})['catch'](function(_0x3e2dbd){logger[_0x376e('0x19')](_0x376e('0x2d'),_0x3e2dbd[_0x376e('0x1b')],_0x2043b1);_0x3a15ec(_this[_0x376e('0x19')](0x1f4,_0x3e2dbd[_0x376e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 93cf460..d6e8d33 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 _0xf976=['update','emit','removeListener','length','./openchannelInteraction.events','save','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf976,0x6d));var _0x6f97=function(_0xa20faa,_0x39f3f3){_0xa20faa=_0xa20faa-0x0;var _0xc6611b=_0xf976[_0xa20faa];return _0xc6611b;};'use strict';var OpenchannelInteractionEvents=require(_0x6f97('0x0'));var events=[_0x6f97('0x1'),_0x6f97('0x2'),_0x6f97('0x3')];function createListener(_0x212f42,_0x39a438){return function(_0x3379b8){_0x39a438[_0x6f97('0x4')](_0x212f42,_0x3379b8);};}function removeListener(_0x5b9ef8,_0x1e1d03){return function(){OpenchannelInteractionEvents[_0x6f97('0x5')](_0x5b9ef8,_0x1e1d03);};}exports['register']=function(_0x37c1ce){for(var _0xa2ce45=0x0,_0x18bd9d=events[_0x6f97('0x6')];_0xa2ce45<_0x18bd9d;_0xa2ce45++){var _0x158496=events[_0xa2ce45];var _0x104c55=createListener('openchannelInteraction:'+_0x158496,_0x37c1ce);OpenchannelInteractionEvents['on'](_0x158496,_0x104c55);}}; \ No newline at end of file +var _0x2d8d=['emit','openchannelInteraction:','./openchannelInteraction.events'];(function(_0xfe65d8,_0x27669c){var _0x37a0d1=function(_0x4b1101){while(--_0x4b1101){_0xfe65d8['push'](_0xfe65d8['shift']());}};_0x37a0d1(++_0x27669c);}(_0x2d8d,0x16a));var _0xd2d8=function(_0x2c0ded,_0x3de22c){_0x2c0ded=_0x2c0ded-0x0;var _0x4473e5=_0x2d8d[_0x2c0ded];return _0x4473e5;};'use strict';var OpenchannelInteractionEvents=require(_0xd2d8('0x0'));var events=['save','remove','update'];function createListener(_0x4e0ef8,_0x4d412e){return function(_0x3ef7e6){_0x4d412e[_0xd2d8('0x1')](_0x4e0ef8,_0x3ef7e6);};}function removeListener(_0x4c85b0,_0x1d05ce){return function(){OpenchannelInteractionEvents['removeListener'](_0x4c85b0,_0x1d05ce);};}exports['register']=function(_0x5360fe){for(var _0xc47c46=0x0,_0x323bea=events['length'];_0xc47c46<_0x323bea;_0xc47c46++){var _0x546554=events[_0xc47c46];var _0x32d88a=createListener(_0xd2d8('0x2')+_0x546554,_0x5360fe);OpenchannelInteractionEvents['on'](_0x546554,_0x32d88a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 84811d2..b262e28 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x50ce21,_0xd42d88){var _0x4ba27a=function(_0x26d832){while(--_0x26d832){_0x50ce21['push'](_0x50ce21['shift']());}};_0x4ba27a(++_0xd42d88);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x4959fd,_0x186515){var _0x97de01=function(_0x29e1d0){while(--_0x29e1d0){_0x4959fd['push'](_0x4959fd['shift']());}};_0x97de01(++_0x186515);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2bf5bd,_0x120787){_0x2bf5bd=_0x2bf5bd-0x0;var _0xc810c0=_0xcb91[_0x2bf5bd];return _0xc810c0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index cd6c5ca..02acbeb 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 _0x3495=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0xd9ce1,_0x517167){var _0x54be53=function(_0x27a6bd){while(--_0x27a6bd){_0xd9ce1['push'](_0xd9ce1['shift']());}};_0x54be53(++_0x517167);}(_0x3495,0x1de));var _0x5349=function(_0xa79da3,_0x1b295b){_0xa79da3=_0xa79da3-0x0;var _0x452af0=_0x3495[_0xa79da3];return _0x452af0;};'use strict';var Sequelize=require(_0x5349('0x0'));module[_0x5349('0x1')]={'body':{'type':Sequelize[_0x5349('0x2')](_0x5349('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5349('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5349('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5349('0x5')]('in',_0x5349('0x6')),'defaultValue':_0x5349('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x5349('0x7')]},'providerResponse':{'type':Sequelize[_0x5349('0x2')]}}; \ No newline at end of file +var _0x6d0c=['sequelize','exports','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x6d0c,0x8c));var _0xc6d0=function(_0x175080,_0x2a901d){_0x175080=_0x175080-0x0;var _0x29f1a5=_0x6d0c[_0x175080];return _0x29f1a5;};'use strict';var Sequelize=require(_0xc6d0('0x0'));module[_0xc6d0('0x1')]={'body':{'type':Sequelize[_0xc6d0('0x2')](_0xc6d0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc6d0('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc6d0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc6d0('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xc6d0('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 3edbc68..49b26aa 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 _0x07b5=['request\x20sent','stringify','error','message','info','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','destroy','stack','name','map','OpenchannelMessage','rawAttributes','fieldName','type','key','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','create','update','body','describe','read','readAt','YYYY-MM-DD\x20HH:mm:ss','user','UserId','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','email','SIP/%s','rejectmessage','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','debug'];(function(_0x188e1e,_0x534e6f){var _0x278c52=function(_0x3128fd){while(--_0x3128fd){_0x188e1e['push'](_0x188e1e['shift']());}};_0x278c52(++_0x534e6f);}(_0x07b5,0x1ed));var _0x507b=function(_0x15a634,_0x4feb86){_0x15a634=_0x15a634-0x0;var _0xf4f7a0=_0x07b5[_0x15a634];return _0xf4f7a0;};'use strict';var emlformat=require(_0x507b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x507b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x507b('0x2'));var moment=require('moment');var BPromise=require(_0x507b('0x3'));var Mustache=require(_0x507b('0x4'));var util=require(_0x507b('0x5'));var path=require('path');var sox=require(_0x507b('0x6'));var csv=require('to-csv');var ejs=require(_0x507b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x507b('0x8'));var squel=require('squel');var crypto=require(_0x507b('0x9'));var jsforce=require(_0x507b('0xa'));var deskjs=require(_0x507b('0xb'));var toCsv=require(_0x507b('0xc'));var querystring=require('querystring');var Papa=require(_0x507b('0xd'));var Redis=require(_0x507b('0xe'));var authService=require(_0x507b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x507b('0x10'));var hardwareService=require(_0x507b('0x11'));var logger=require(_0x507b('0x12'))('api');var utils=require(_0x507b('0x13'));var config=require(_0x507b('0x14'));var licenseUtil=require(_0x507b('0x15'));var db=require('../../mysqldb')['db'];config[_0x507b('0x16')]=_[_0x507b('0x17')](config['redis'],{'host':_0x507b('0x18'),'port':0x18eb});var socket=require(_0x507b('0x19'))(new Redis(config[_0x507b('0x16')]));require(_0x507b('0x1a'))[_0x507b('0x1b')](socket);var jayson=require(_0x507b('0x1c'));var client=jayson[_0x507b('0x1d')][_0x507b('0x1e')]({'port':0x232c});var client9002=jayson[_0x507b('0x1d')][_0x507b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1c4135,_0x5da013,_0x36cd49,_0x250ae5){return new BPromise(function(_0x623f25,_0x46171f){var _0x440abc=_0x250ae5||client;return _0x440abc[_0x507b('0x1f')](_0x1c4135,_0x36cd49)[_0x507b('0x20')](function(_0x122f8f){logger['info'](_0x507b('0x21'),_0x5da013,'request\x20sent');logger[_0x507b('0x22')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5da013,_0x507b('0x23'),JSON[_0x507b('0x24')](_0x122f8f));if(_0x122f8f[_0x507b('0x25')]){if(_0x122f8f[_0x507b('0x25')]['code']===0x1f4){logger[_0x507b('0x25')](_0x507b('0x21'),_0x5da013,_0x122f8f[_0x507b('0x25')][_0x507b('0x26')]);return _0x46171f(_0x122f8f['error'][_0x507b('0x26')]);}logger[_0x507b('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x5da013,_0x122f8f[_0x507b('0x25')]['message']);return _0x623f25(_0x122f8f['error'][_0x507b('0x26')]);}else{logger[_0x507b('0x27')](_0x507b('0x21'),_0x5da013,_0x507b('0x23'));_0x623f25(_0x122f8f[_0x507b('0x28')]['message']);}})[_0x507b('0x29')](function(_0xa7e713){logger[_0x507b('0x25')](_0x507b('0x21'),_0x5da013,_0xa7e713);_0x46171f(_0xa7e713);});});}function respondWithStatusCode(_0x3244e0,_0x472fe3){_0x472fe3=_0x472fe3||0xcc;return function(_0x1f6d20){if(_0x1f6d20){return _0x3244e0[_0x507b('0x2a')](_0x472fe3);}return _0x3244e0['status'](_0x472fe3)[_0x507b('0x2b')]();};}function respondWithResult(_0x983ade,_0x5184f8){_0x5184f8=_0x5184f8||0xc8;return function(_0x45152c){if(_0x45152c){return _0x983ade['status'](_0x5184f8)[_0x507b('0x2c')](_0x45152c);}};}function respondWithFilteredResult(_0x1ec49e,_0x3abb4b){return function(_0xfd373b){if(_0xfd373b){var _0x15026b=typeof _0x3abb4b[_0x507b('0x2d')]===_0x507b('0x2e')&&typeof _0x3abb4b[_0x507b('0x2f')]===_0x507b('0x2e');var _0x3ca87d=_0xfd373b[_0x507b('0x30')];var _0x34878b=_0x15026b?0x0:_0x3abb4b[_0x507b('0x2d')];var _0x2ccfa2=_0x15026b?_0xfd373b[_0x507b('0x30')]:_0x3abb4b[_0x507b('0x2d')]+_0x3abb4b[_0x507b('0x2f')];var _0x21417c;if(_0x2ccfa2>=_0x3ca87d){_0x2ccfa2=_0x3ca87d;_0x21417c=0xc8;}else{_0x21417c=0xce;}_0x1ec49e[_0x507b('0x31')](_0x21417c);return _0x1ec49e[_0x507b('0x32')](_0x507b('0x33'),_0x34878b+'-'+_0x2ccfa2+'/'+_0x3ca87d)[_0x507b('0x2c')](_0xfd373b);}return null;};}function patchUpdates(_0x4b0119){return function(_0x18e172){try{jsonpatch[_0x507b('0x34')](_0x18e172,_0x4b0119,!![]);}catch(_0x51d860){return BPromise[_0x507b('0x35')](_0x51d860);}return _0x18e172['save']();};}function saveUpdates(_0x33a41c,_0x580212){return function(_0x1bebe2){if(_0x1bebe2){return _0x1bebe2['update'](_0x33a41c)[_0x507b('0x20')](function(_0xe32c9){return _0xe32c9;});}return null;};}function removeEntity(_0x93b32f,_0x4c87ec){return function(_0x2e1faa){if(_0x2e1faa){return _0x2e1faa[_0x507b('0x36')]()[_0x507b('0x20')](function(){_0x93b32f[_0x507b('0x31')](0xcc)[_0x507b('0x2b')]();});}};}function handleEntityNotFound(_0x43ce4b,_0xb46047){return function(_0x1face9){if(!_0x1face9){_0x43ce4b[_0x507b('0x2a')](0x194);}return _0x1face9;};}function handleError(_0x5f585b,_0x46b019){_0x46b019=_0x46b019||0x1f4;return function(_0xa35ac9){logger[_0x507b('0x25')](_0xa35ac9[_0x507b('0x37')]);if(_0xa35ac9[_0x507b('0x38')]){delete _0xa35ac9['name'];}_0x5f585b['status'](_0x46b019)['send'](_0xa35ac9);};}exports['index']=function(_0x4dd0fd,_0x4ee884){var _0x16352={},_0xcfe1c7={},_0x669a01={'count':0x0,'rows':[]};var _0x31d3d8=_[_0x507b('0x39')](db[_0x507b('0x3a')][_0x507b('0x3b')],function(_0xf4aa3b){return{'name':_0xf4aa3b[_0x507b('0x3c')],'type':_0xf4aa3b[_0x507b('0x3d')][_0x507b('0x3e')]};});_0xcfe1c7['model']=_[_0x507b('0x39')](_0x31d3d8,_0x507b('0x38'));_0xcfe1c7['query']=_[_0x507b('0x3f')](_0x4dd0fd[_0x507b('0x40')]);_0xcfe1c7[_0x507b('0x41')]=_['intersection'](_0xcfe1c7[_0x507b('0x42')],_0xcfe1c7['query']);_0x16352['attributes']=_[_0x507b('0x43')](_0xcfe1c7[_0x507b('0x42')],qs[_0x507b('0x44')](_0x4dd0fd[_0x507b('0x40')][_0x507b('0x44')]));_0x16352[_0x507b('0x45')]=_0x16352[_0x507b('0x45')][_0x507b('0x46')]?_0x16352[_0x507b('0x45')]:_0xcfe1c7[_0x507b('0x42')];if(!_0x4dd0fd[_0x507b('0x40')][_0x507b('0x47')](_0x507b('0x48'))){_0x16352[_0x507b('0x2f')]=qs['limit'](_0x4dd0fd[_0x507b('0x40')][_0x507b('0x2f')]);_0x16352[_0x507b('0x2d')]=qs[_0x507b('0x2d')](_0x4dd0fd['query']['offset']);}_0x16352[_0x507b('0x49')]=qs[_0x507b('0x4a')](_0x4dd0fd['query']['sort']);_0x16352[_0x507b('0x4b')]=qs[_0x507b('0x41')](_[_0x507b('0x4c')](_0x4dd0fd[_0x507b('0x40')],_0xcfe1c7[_0x507b('0x41')]),_0x31d3d8);if(_0x4dd0fd[_0x507b('0x40')]['filter']){_0x16352[_0x507b('0x4b')]=_[_0x507b('0x4d')](_0x16352['where'],{'$or':_[_0x507b('0x39')](_0x31d3d8,function(_0x2030c4){if(_0x2030c4[_0x507b('0x3d')]!==_0x507b('0x4e')){var _0x30ddec={};_0x30ddec[_0x2030c4[_0x507b('0x38')]]={'$like':'%'+_0x4dd0fd[_0x507b('0x40')][_0x507b('0x4f')]+'%'};return _0x30ddec;}})});}_0x16352=_[_0x507b('0x4d')]({},_0x16352,_0x4dd0fd[_0x507b('0x50')]);var _0x4bc625={'where':_0x16352[_0x507b('0x4b')]};return db[_0x507b('0x3a')][_0x507b('0x30')](_0x4bc625)[_0x507b('0x20')](function(_0x311a5c){_0x669a01['count']=_0x311a5c;if(_0x4dd0fd[_0x507b('0x40')][_0x507b('0x51')]){_0x16352[_0x507b('0x52')]=[{'all':!![]}];}return db[_0x507b('0x3a')][_0x507b('0x53')](_0x16352);})[_0x507b('0x20')](function(_0x35931b){_0x669a01[_0x507b('0x54')]=_0x35931b;return _0x669a01;})['then'](respondWithFilteredResult(_0x4ee884,_0x16352))[_0x507b('0x29')](handleError(_0x4ee884,null));};exports['show']=function(_0x50f166,_0x343776){var _0x5795c0={'raw':!![],'where':{'id':_0x50f166[_0x507b('0x55')]['id']}},_0x4a2e55={};_0x4a2e55[_0x507b('0x42')]=_[_0x507b('0x3f')](db[_0x507b('0x3a')][_0x507b('0x3b')]);_0x4a2e55[_0x507b('0x40')]=_[_0x507b('0x3f')](_0x50f166[_0x507b('0x40')]);_0x4a2e55['filters']=_['intersection'](_0x4a2e55[_0x507b('0x42')],_0x4a2e55[_0x507b('0x40')]);_0x5795c0[_0x507b('0x45')]=_[_0x507b('0x43')](_0x4a2e55[_0x507b('0x42')],qs[_0x507b('0x44')](_0x50f166[_0x507b('0x40')]['fields']));_0x5795c0[_0x507b('0x45')]=_0x5795c0[_0x507b('0x45')][_0x507b('0x46')]?_0x5795c0[_0x507b('0x45')]:_0x4a2e55[_0x507b('0x42')];if(_0x50f166['query'][_0x507b('0x51')]){_0x5795c0[_0x507b('0x52')]=[{'all':!![]}];}_0x5795c0=_[_0x507b('0x4d')]({},_0x5795c0,_0x50f166[_0x507b('0x50')]);return db[_0x507b('0x3a')][_0x507b('0x56')](_0x5795c0)[_0x507b('0x20')](handleEntityNotFound(_0x343776,null))[_0x507b('0x20')](respondWithResult(_0x343776,null))[_0x507b('0x29')](handleError(_0x343776,null));};exports[_0x507b('0x57')]=function(_0x4d9b48,_0x178662){return db[_0x507b('0x3a')][_0x507b('0x57')](_0x4d9b48['body'],{})['then'](respondWithResult(_0x178662,0xc9))[_0x507b('0x29')](handleError(_0x178662,null));};exports[_0x507b('0x58')]=function(_0x2398f8,_0x30070f){if(_0x2398f8['body']['id']){delete _0x2398f8[_0x507b('0x59')]['id'];}return db['OpenchannelMessage'][_0x507b('0x56')]({'where':{'id':_0x2398f8[_0x507b('0x55')]['id']}})[_0x507b('0x20')](handleEntityNotFound(_0x30070f,null))['then'](saveUpdates(_0x2398f8['body'],null))['then'](respondWithResult(_0x30070f,null))[_0x507b('0x29')](handleError(_0x30070f,null));};exports[_0x507b('0x36')]=function(_0x25f753,_0x33fece){return db[_0x507b('0x3a')][_0x507b('0x56')]({'where':{'id':_0x25f753[_0x507b('0x55')]['id']}})[_0x507b('0x20')](handleEntityNotFound(_0x33fece,null))[_0x507b('0x20')](removeEntity(_0x33fece,null))[_0x507b('0x29')](handleError(_0x33fece,null));};exports[_0x507b('0x5a')]=function(_0x21b3be,_0x3d3bd7){return db[_0x507b('0x3a')]['describe']()[_0x507b('0x20')](respondWithResult(_0x3d3bd7,null))[_0x507b('0x29')](handleError(_0x3d3bd7,null));};var interaction_log=require(_0x507b('0x12'))('openchannel-interactions');exports['accept']=function(_0x1ebf18,_0x54f2e0,_0x47067b){var _0x248803={'agent':{},'channel':'openchannel'};if(_0x1ebf18[_0x507b('0x59')]['id']){delete _0x1ebf18[_0x507b('0x59')]['id'];}_0x1ebf18[_0x507b('0x59')][_0x507b('0x5b')]=!![];_0x1ebf18[_0x507b('0x59')][_0x507b('0x5c')]=moment()['format'](_0x507b('0x5d'));_0x1ebf18[_0x507b('0x59')]['UserId']=_0x1ebf18[_0x507b('0x59')]['UserId']||_0x1ebf18[_0x507b('0x5e')]['id'];_0x248803['agent']['id']=_0x1ebf18[_0x507b('0x59')][_0x507b('0x5f')];return db['OpenchannelMessage'][_0x507b('0x56')]({'where':{'id':_0x1ebf18['params']['id'],'UserId':null}})[_0x507b('0x20')](handleEntityNotFound(_0x54f2e0,null))[_0x507b('0x20')](saveUpdates(_0x1ebf18['body'],null))['then'](function(_0x357dbe){if(_0x357dbe){_0x248803[_0x507b('0x26')]=_0x357dbe['get']({'plain':!![]});return db[_0x507b('0x60')]['find']({'where':{'id':_0x357dbe[_0x507b('0x61')]}});}return null;})[_0x507b('0x20')](handleEntityNotFound(_0x54f2e0,null))[_0x507b('0x20')](function(_0x1f0029){if(_0x1f0029){return _0x1f0029[_0x507b('0x58')]({'UserId':_0x1ebf18['body'][_0x507b('0x5f')],'read1stAt':_[_0x507b('0x62')](_0x1f0029[_0x507b('0x63')])?moment()[_0x507b('0x64')](_0x507b('0x5d')):undefined});}return null;})['then'](function(_0x1f8438){if(_0x1f8438){_0x248803['interaction']=_0x1f8438['get']({'plain':!![]});interaction_log['info'](_0x507b('0x65'),_0x1ebf18[_0x507b('0x5e')]['id'],_0x1ebf18['user'][_0x507b('0x38')],_0x1ebf18['user']['role'],_0x248803[_0x507b('0x66')]['id'],_0x1ebf18[_0x507b('0x59')]?JSON['stringify'](_0x1ebf18[_0x507b('0x59')]):_0x507b('0x67'));return respondWithRpcPromise(_0x507b('0x68'),_0x507b('0x69'),_0x248803);}return null;})[_0x507b('0x20')](function(_0x44dd73){var _0x2b248e=_0x507b('0x6a')+_0x44dd73[_0x507b('0x26')][_0x507b('0x6b')];return db[_0x507b('0x6c')][_0x507b('0x40')](_0x2b248e,{'type':db[_0x507b('0x6d')][_0x507b('0x6e')][_0x507b('0x6f')],'raw':!![]})[_0x507b('0x20')](function(_0x4cfb30){return _0x4cfb30;});})[_0x507b('0x20')](function(_0xcd6077){if(_0xcd6077){_0x248803[_0x507b('0x26')][_0x507b('0x70')]=_0xcd6077[0x0];if(!_0x1ebf18['body'][_0x507b('0x5f')])return;return db[_0x507b('0x71')][_0x507b('0x56')]({'where':{'id':_0x1ebf18['body'][_0x507b('0x5f')],'role':_0x507b('0x72')},'attributes':['id','name','fullname','email',_0x507b('0x73')],'raw':!![]});}return null;})['then'](function(_0x17a082){if(!_0x17a082)return null;_0x248803[_0x507b('0x26')][_0x507b('0x72')]=_0x17a082;return _0x248803;})['then'](function(_0x3f6d3e){if(_0x3f6d3e){if(_0x1ebf18['body'][_0x507b('0x74')]){_0x248803[_0x507b('0x26')][_0x507b('0x75')]=util['format']('SIP/%s',_0x1ebf18[_0x507b('0x5e')][_0x507b('0x38')]);_0x248803[_0x507b('0x26')][_0x507b('0x76')]=_0x248803[_0x507b('0x76')];_0x248803[_0x507b('0x26')][_0x507b('0x77')]=_0x248803[_0x507b('0x76')];_0x248803[_0x507b('0x26')][_0x507b('0x78')]='accept';return respondWithRpcPromise(_0x507b('0x79'),'EventManager',{'event':_0x507b('0x7a'),'message':_0x248803[_0x507b('0x26')]},client9002)[_0x507b('0x20')](function(){return _0x248803;});}return _0x248803;}return null;})[_0x507b('0x20')](respondWithResult(_0x54f2e0,null))[_0x507b('0x29')](handleError(_0x54f2e0,null));};var interaction_log=require('../../config/logger')(_0x507b('0x7b'));exports['reject']=function(_0x5dfd6a,_0x2ef13e,_0x5b9354){var _0x4a3c4d={'agent':{},'channel':_0x507b('0x7c')};if(_0x5dfd6a[_0x507b('0x59')]['id']){delete _0x5dfd6a[_0x507b('0x59')]['id'];}_0x5dfd6a['body'][_0x507b('0x5f')]=_0x5dfd6a[_0x507b('0x59')][_0x507b('0x5f')]||_0x5dfd6a[_0x507b('0x5e')]['id'];_0x4a3c4d['agent']['id']=_0x5dfd6a['body'][_0x507b('0x5f')];return db[_0x507b('0x3a')]['find']({'where':{'id':_0x5dfd6a[_0x507b('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2ef13e,null))[_0x507b('0x20')](function(_0x14928b){if(_0x14928b){_0x4a3c4d[_0x507b('0x26')]=_0x14928b['get']({'plain':!![]});return db[_0x507b('0x60')]['find']({'where':{'id':_0x14928b[_0x507b('0x61')]}});}return null;})[_0x507b('0x20')](handleEntityNotFound(_0x2ef13e,null))['then'](function(_0x466a8e){if(_0x466a8e){_0x4a3c4d[_0x507b('0x66')]=_0x466a8e['get']({'plain':!![]});interaction_log[_0x507b('0x27')](_0x507b('0x7d'),_0x5dfd6a['user']['id'],_0x5dfd6a['user']['name'],_0x5dfd6a[_0x507b('0x5e')][_0x507b('0x7e')],_0x4a3c4d['interaction']['id'],_0x5dfd6a['body']?JSON['stringify'](_0x5dfd6a[_0x507b('0x59')]):_0x507b('0x67'));return respondWithRpcPromise(_0x507b('0x7f'),_0x507b('0x80'),_0x4a3c4d);}return null;})[_0x507b('0x20')](function(_0x552024){var _0x2f80df=_0x507b('0x6a')+_0x552024[_0x507b('0x26')][_0x507b('0x6b')];return db[_0x507b('0x6c')]['query'](_0x2f80df,{'type':db[_0x507b('0x6d')][_0x507b('0x6e')][_0x507b('0x6f')],'raw':!![]})[_0x507b('0x20')](function(_0x3c5a3b){return _0x3c5a3b;});})[_0x507b('0x20')](function(_0x1d70b3){if(_0x1d70b3){_0x4a3c4d[_0x507b('0x26')]['contact']=_0x1d70b3[0x0];if(!_0x5dfd6a[_0x507b('0x59')][_0x507b('0x5f')])return;return db[_0x507b('0x71')]['find']({'where':{'id':_0x5dfd6a[_0x507b('0x59')][_0x507b('0x5f')],'role':'agent'},'attributes':['id',_0x507b('0x38'),'fullname',_0x507b('0x81'),'internal'],'raw':!![]});}return null;})[_0x507b('0x20')](function(_0x4f6669){if(!_0x4f6669)return null;_0x4a3c4d[_0x507b('0x26')]['agent']=_0x4f6669;return _0x4a3c4d;})[_0x507b('0x20')](function(_0x59b477){if(_0x59b477){_0x59b477['message'][_0x507b('0x75')]=util[_0x507b('0x64')](_0x507b('0x82'),_0x5dfd6a[_0x507b('0x5e')][_0x507b('0x38')]);_0x59b477[_0x507b('0x26')][_0x507b('0x76')]=_0x4a3c4d[_0x507b('0x76')];_0x59b477['message'][_0x507b('0x77')]=_0x4a3c4d[_0x507b('0x76')];_0x59b477[_0x507b('0x26')]['event']=_0x507b('0x35');respondWithRpcPromise(_0x507b('0x79'),_0x507b('0x79'),{'event':_0x507b('0x83'),'message':_0x59b477[_0x507b('0x26')]},client9002);return _0x4a3c4d;}return null;})[_0x507b('0x20')](respondWithResult(_0x2ef13e,null))[_0x507b('0x29')](handleError(_0x2ef13e,null));}; \ No newline at end of file +var _0x6c25=['[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','openchannel-interactions','openchannel','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','motionChannel','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','reject','save','update','destroy','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','show','params','find','body','describe','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction'];(function(_0x5a08cf,_0x99017b){var _0x24d914=function(_0x22d1f5){while(--_0x22d1f5){_0x5a08cf['push'](_0x5a08cf['shift']());}};_0x24d914(++_0x99017b);}(_0x6c25,0x9d));var _0x56c2=function(_0x501f36,_0x62dc5b){_0x501f36=_0x501f36-0x0;var _0x21b79b=_0x6c25[_0x501f36];return _0x21b79b;};'use strict';var emlformat=require(_0x56c2('0x0'));var rimraf=require(_0x56c2('0x1'));var zipdir=require(_0x56c2('0x2'));var jsonpatch=require(_0x56c2('0x3'));var rp=require('request-promise');var moment=require(_0x56c2('0x4'));var BPromise=require(_0x56c2('0x5'));var Mustache=require(_0x56c2('0x6'));var util=require(_0x56c2('0x7'));var path=require(_0x56c2('0x8'));var sox=require(_0x56c2('0x9'));var csv=require(_0x56c2('0xa'));var ejs=require(_0x56c2('0xb'));var fs=require('fs');var fs_extra=require(_0x56c2('0xc'));var _=require('lodash');var squel=require(_0x56c2('0xd'));var crypto=require(_0x56c2('0xe'));var jsforce=require(_0x56c2('0xf'));var deskjs=require(_0x56c2('0x10'));var toCsv=require('to-csv');var querystring=require(_0x56c2('0x11'));var Papa=require(_0x56c2('0x12'));var Redis=require(_0x56c2('0x13'));var authService=require(_0x56c2('0x14'));var qs=require(_0x56c2('0x15'));var as=require(_0x56c2('0x16'));var hardwareService=require(_0x56c2('0x17'));var logger=require(_0x56c2('0x18'))('api');var utils=require(_0x56c2('0x19'));var config=require(_0x56c2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x56c2('0x1b'))['db'];config['redis']=_[_0x56c2('0x1c')](config[_0x56c2('0x1d')],{'host':_0x56c2('0x1e'),'port':0x18eb});var socket=require(_0x56c2('0x1f'))(new Redis(config['redis']));require(_0x56c2('0x20'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x56c2('0x21')][_0x56c2('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x57b40e,_0x436024,_0x1d0374,_0x5ab627){return new BPromise(function(_0x4fb634,_0x19905d){var _0x2b0470=_0x5ab627||client;return _0x2b0470['request'](_0x57b40e,_0x1d0374)[_0x56c2('0x23')](function(_0x2a87e0){logger[_0x56c2('0x24')](_0x56c2('0x25'),_0x436024,_0x56c2('0x26'));logger['debug'](_0x56c2('0x27'),_0x436024,'request\x20sent',JSON[_0x56c2('0x28')](_0x2a87e0));if(_0x2a87e0[_0x56c2('0x29')]){if(_0x2a87e0[_0x56c2('0x29')][_0x56c2('0x2a')]===0x1f4){logger[_0x56c2('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x436024,_0x2a87e0[_0x56c2('0x29')]['message']);return _0x19905d(_0x2a87e0[_0x56c2('0x29')][_0x56c2('0x2b')]);}logger['error'](_0x56c2('0x25'),_0x436024,_0x2a87e0[_0x56c2('0x29')][_0x56c2('0x2b')]);return _0x4fb634(_0x2a87e0[_0x56c2('0x29')][_0x56c2('0x2b')]);}else{logger[_0x56c2('0x24')](_0x56c2('0x25'),_0x436024,'request\x20sent');_0x4fb634(_0x2a87e0[_0x56c2('0x2c')][_0x56c2('0x2b')]);}})[_0x56c2('0x2d')](function(_0x4b326f){logger[_0x56c2('0x29')](_0x56c2('0x25'),_0x436024,_0x4b326f);_0x19905d(_0x4b326f);});});}function respondWithStatusCode(_0x4e6561,_0x1c97d5){_0x1c97d5=_0x1c97d5||0xcc;return function(_0x19780f){if(_0x19780f){return _0x4e6561[_0x56c2('0x2e')](_0x1c97d5);}return _0x4e6561[_0x56c2('0x2f')](_0x1c97d5)[_0x56c2('0x30')]();};}function respondWithResult(_0x3bd4eb,_0x2a2a71){_0x2a2a71=_0x2a2a71||0xc8;return function(_0x187079){if(_0x187079){return _0x3bd4eb[_0x56c2('0x2f')](_0x2a2a71)[_0x56c2('0x31')](_0x187079);}};}function respondWithFilteredResult(_0x232c0f,_0x3fabc7){return function(_0x56f161){if(_0x56f161){var _0xf0f454=typeof _0x3fabc7[_0x56c2('0x32')]===_0x56c2('0x33')&&typeof _0x3fabc7['limit']===_0x56c2('0x33');var _0x5bfd82=_0x56f161[_0x56c2('0x34')];var _0x13d5ff=_0xf0f454?0x0:_0x3fabc7[_0x56c2('0x32')];var _0x5d63e5=_0xf0f454?_0x56f161['count']:_0x3fabc7[_0x56c2('0x32')]+_0x3fabc7['limit'];var _0x3f5802;if(_0x5d63e5>=_0x5bfd82){_0x5d63e5=_0x5bfd82;_0x3f5802=0xc8;}else{_0x3f5802=0xce;}_0x232c0f[_0x56c2('0x2f')](_0x3f5802);return _0x232c0f[_0x56c2('0x35')]('Content-Range',_0x13d5ff+'-'+_0x5d63e5+'/'+_0x5bfd82)[_0x56c2('0x31')](_0x56f161);}return null;};}function patchUpdates(_0x2f5dbd){return function(_0x3434d5){try{jsonpatch['apply'](_0x3434d5,_0x2f5dbd,!![]);}catch(_0x2cb1ae){return BPromise[_0x56c2('0x36')](_0x2cb1ae);}return _0x3434d5[_0x56c2('0x37')]();};}function saveUpdates(_0x318ff6,_0x3ee92f){return function(_0x3052e6){if(_0x3052e6){return _0x3052e6[_0x56c2('0x38')](_0x318ff6)[_0x56c2('0x23')](function(_0x26a2fa){return _0x26a2fa;});}return null;};}function removeEntity(_0x1ddf2e,_0x9c6bb8){return function(_0x48af43){if(_0x48af43){return _0x48af43[_0x56c2('0x39')]()[_0x56c2('0x23')](function(){_0x1ddf2e[_0x56c2('0x2f')](0xcc)[_0x56c2('0x30')]();});}};}function handleEntityNotFound(_0xe8b81f,_0x14a4e8){return function(_0x2f0a48){if(!_0x2f0a48){_0xe8b81f[_0x56c2('0x2e')](0x194);}return _0x2f0a48;};}function handleError(_0xddf64b,_0x50f615){_0x50f615=_0x50f615||0x1f4;return function(_0x2a8187){logger['error'](_0x2a8187['stack']);if(_0x2a8187['name']){delete _0x2a8187[_0x56c2('0x3a')];}_0xddf64b['status'](_0x50f615)[_0x56c2('0x3b')](_0x2a8187);};}exports[_0x56c2('0x3c')]=function(_0x3e95a9,_0x14cad7){var _0x3d0696={},_0x5b9db0={},_0x25db36={'count':0x0,'rows':[]};var _0x2e1c3e=_[_0x56c2('0x3d')](db[_0x56c2('0x3e')][_0x56c2('0x3f')],function(_0x10c16c){return{'name':_0x10c16c[_0x56c2('0x40')],'type':_0x10c16c[_0x56c2('0x41')][_0x56c2('0x42')]};});_0x5b9db0['model']=_[_0x56c2('0x3d')](_0x2e1c3e,_0x56c2('0x3a'));_0x5b9db0['query']=_['keys'](_0x3e95a9[_0x56c2('0x43')]);_0x5b9db0[_0x56c2('0x44')]=_[_0x56c2('0x45')](_0x5b9db0[_0x56c2('0x46')],_0x5b9db0[_0x56c2('0x43')]);_0x3d0696[_0x56c2('0x47')]=_[_0x56c2('0x45')](_0x5b9db0['model'],qs['fields'](_0x3e95a9[_0x56c2('0x43')][_0x56c2('0x48')]));_0x3d0696[_0x56c2('0x47')]=_0x3d0696['attributes'][_0x56c2('0x49')]?_0x3d0696[_0x56c2('0x47')]:_0x5b9db0[_0x56c2('0x46')];if(!_0x3e95a9['query']['hasOwnProperty'](_0x56c2('0x4a'))){_0x3d0696['limit']=qs[_0x56c2('0x4b')](_0x3e95a9['query'][_0x56c2('0x4b')]);_0x3d0696[_0x56c2('0x32')]=qs['offset'](_0x3e95a9[_0x56c2('0x43')][_0x56c2('0x32')]);}_0x3d0696[_0x56c2('0x4c')]=qs[_0x56c2('0x4d')](_0x3e95a9[_0x56c2('0x43')][_0x56c2('0x4d')]);_0x3d0696['where']=qs[_0x56c2('0x44')](_['pick'](_0x3e95a9[_0x56c2('0x43')],_0x5b9db0[_0x56c2('0x44')]),_0x2e1c3e);if(_0x3e95a9[_0x56c2('0x43')][_0x56c2('0x4e')]){_0x3d0696[_0x56c2('0x4f')]=_[_0x56c2('0x50')](_0x3d0696[_0x56c2('0x4f')],{'$or':_[_0x56c2('0x3d')](_0x2e1c3e,function(_0x4a32ee){if(_0x4a32ee[_0x56c2('0x41')]!==_0x56c2('0x51')){var _0x89a99f={};_0x89a99f[_0x4a32ee['name']]={'$like':'%'+_0x3e95a9[_0x56c2('0x43')][_0x56c2('0x4e')]+'%'};return _0x89a99f;}})});}_0x3d0696=_[_0x56c2('0x50')]({},_0x3d0696,_0x3e95a9[_0x56c2('0x52')]);var _0x2bdb71={'where':_0x3d0696[_0x56c2('0x4f')]};return db[_0x56c2('0x3e')][_0x56c2('0x34')](_0x2bdb71)['then'](function(_0x40492d){_0x25db36[_0x56c2('0x34')]=_0x40492d;if(_0x3e95a9['query']['includeAll']){_0x3d0696[_0x56c2('0x53')]=[{'all':!![]}];}return db[_0x56c2('0x3e')][_0x56c2('0x54')](_0x3d0696);})[_0x56c2('0x23')](function(_0x1693ee){_0x25db36['rows']=_0x1693ee;return _0x25db36;})[_0x56c2('0x23')](respondWithFilteredResult(_0x14cad7,_0x3d0696))[_0x56c2('0x2d')](handleError(_0x14cad7,null));};exports[_0x56c2('0x55')]=function(_0x24fc75,_0x2c12b4){var _0x4cb5bb={'raw':!![],'where':{'id':_0x24fc75[_0x56c2('0x56')]['id']}},_0x419fc2={};_0x419fc2[_0x56c2('0x46')]=_['keys'](db[_0x56c2('0x3e')]['rawAttributes']);_0x419fc2[_0x56c2('0x43')]=_['keys'](_0x24fc75[_0x56c2('0x43')]);_0x419fc2['filters']=_[_0x56c2('0x45')](_0x419fc2['model'],_0x419fc2[_0x56c2('0x43')]);_0x4cb5bb[_0x56c2('0x47')]=_['intersection'](_0x419fc2[_0x56c2('0x46')],qs[_0x56c2('0x48')](_0x24fc75[_0x56c2('0x43')][_0x56c2('0x48')]));_0x4cb5bb['attributes']=_0x4cb5bb[_0x56c2('0x47')][_0x56c2('0x49')]?_0x4cb5bb[_0x56c2('0x47')]:_0x419fc2[_0x56c2('0x46')];if(_0x24fc75['query']['includeAll']){_0x4cb5bb[_0x56c2('0x53')]=[{'all':!![]}];}_0x4cb5bb=_[_0x56c2('0x50')]({},_0x4cb5bb,_0x24fc75[_0x56c2('0x52')]);return db[_0x56c2('0x3e')][_0x56c2('0x57')](_0x4cb5bb)[_0x56c2('0x23')](handleEntityNotFound(_0x2c12b4,null))['then'](respondWithResult(_0x2c12b4,null))['catch'](handleError(_0x2c12b4,null));};exports['create']=function(_0x2bab39,_0xb96ef0){return db['OpenchannelMessage']['create'](_0x2bab39[_0x56c2('0x58')],{})[_0x56c2('0x23')](respondWithResult(_0xb96ef0,0xc9))[_0x56c2('0x2d')](handleError(_0xb96ef0,null));};exports[_0x56c2('0x38')]=function(_0x5706d5,_0x1f105b){if(_0x5706d5[_0x56c2('0x58')]['id']){delete _0x5706d5[_0x56c2('0x58')]['id'];}return db['OpenchannelMessage'][_0x56c2('0x57')]({'where':{'id':_0x5706d5[_0x56c2('0x56')]['id']}})[_0x56c2('0x23')](handleEntityNotFound(_0x1f105b,null))[_0x56c2('0x23')](saveUpdates(_0x5706d5[_0x56c2('0x58')],null))[_0x56c2('0x23')](respondWithResult(_0x1f105b,null))[_0x56c2('0x2d')](handleError(_0x1f105b,null));};exports[_0x56c2('0x39')]=function(_0x2ef814,_0x5419a7){return db[_0x56c2('0x3e')][_0x56c2('0x57')]({'where':{'id':_0x2ef814[_0x56c2('0x56')]['id']}})['then'](handleEntityNotFound(_0x5419a7,null))[_0x56c2('0x23')](removeEntity(_0x5419a7,null))['catch'](handleError(_0x5419a7,null));};exports[_0x56c2('0x59')]=function(_0x1b5b27,_0x7d1e2f){return db['OpenchannelMessage'][_0x56c2('0x59')]()[_0x56c2('0x23')](respondWithResult(_0x7d1e2f,null))['catch'](handleError(_0x7d1e2f,null));};var interaction_log=require(_0x56c2('0x18'))('openchannel-interactions');exports[_0x56c2('0x5a')]=function(_0x2e8247,_0x324ca5,_0x132709){var _0x7a69a4={'agent':{},'channel':'openchannel'};if(_0x2e8247['body']['id']){delete _0x2e8247[_0x56c2('0x58')]['id'];}_0x2e8247[_0x56c2('0x58')][_0x56c2('0x5b')]=!![];_0x2e8247[_0x56c2('0x58')]['readAt']=moment()[_0x56c2('0x5c')](_0x56c2('0x5d'));_0x2e8247[_0x56c2('0x58')][_0x56c2('0x5e')]=_0x2e8247[_0x56c2('0x58')][_0x56c2('0x5e')]||_0x2e8247[_0x56c2('0x5f')]['id'];_0x7a69a4[_0x56c2('0x60')]['id']=_0x2e8247[_0x56c2('0x58')]['UserId'];return db[_0x56c2('0x3e')]['find']({'where':{'id':_0x2e8247[_0x56c2('0x56')]['id'],'UserId':null}})[_0x56c2('0x23')](handleEntityNotFound(_0x324ca5,null))['then'](saveUpdates(_0x2e8247[_0x56c2('0x58')],null))[_0x56c2('0x23')](function(_0x362ee8){if(_0x362ee8){_0x7a69a4[_0x56c2('0x2b')]=_0x362ee8[_0x56c2('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x56c2('0x57')]({'where':{'id':_0x362ee8['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x324ca5,null))[_0x56c2('0x23')](function(_0x8e3f4f){if(_0x8e3f4f){return _0x8e3f4f[_0x56c2('0x38')]({'UserId':_0x2e8247[_0x56c2('0x58')][_0x56c2('0x5e')],'read1stAt':_[_0x56c2('0x62')](_0x8e3f4f[_0x56c2('0x63')])?moment()[_0x56c2('0x5c')](_0x56c2('0x5d')):undefined});}return null;})[_0x56c2('0x23')](function(_0x4c522f){if(_0x4c522f){_0x7a69a4[_0x56c2('0x64')]=_0x4c522f[_0x56c2('0x61')]({'plain':!![]});interaction_log[_0x56c2('0x24')](_0x56c2('0x65'),_0x2e8247['user']['id'],_0x2e8247[_0x56c2('0x5f')][_0x56c2('0x3a')],_0x2e8247[_0x56c2('0x5f')][_0x56c2('0x66')],_0x7a69a4[_0x56c2('0x64')]['id'],_0x2e8247[_0x56c2('0x58')]?JSON[_0x56c2('0x28')](_0x2e8247[_0x56c2('0x58')]):'null');return respondWithRpcPromise(_0x56c2('0x67'),_0x56c2('0x68'),_0x7a69a4);}return null;})['then'](function(_0x4a41e7){var _0x4c956c=_0x56c2('0x69')+_0x4a41e7[_0x56c2('0x2b')]['ContactId'];return db['sequelize']['query'](_0x4c956c,{'type':db[_0x56c2('0x6a')][_0x56c2('0x6b')]['SELECT'],'raw':!![]})[_0x56c2('0x23')](function(_0x36537a){return _0x36537a;});})[_0x56c2('0x23')](function(_0x6a9e91){if(_0x6a9e91){_0x7a69a4[_0x56c2('0x2b')][_0x56c2('0x6c')]=_0x6a9e91[0x0];if(!_0x2e8247[_0x56c2('0x58')]['UserId'])return;return db[_0x56c2('0x6d')][_0x56c2('0x57')]({'where':{'id':_0x2e8247[_0x56c2('0x58')][_0x56c2('0x5e')],'role':_0x56c2('0x60')},'attributes':['id',_0x56c2('0x3a'),_0x56c2('0x6e'),_0x56c2('0x6f'),_0x56c2('0x70')],'raw':!![]});}return null;})[_0x56c2('0x23')](function(_0x14e4c5){if(!_0x14e4c5)return null;_0x7a69a4[_0x56c2('0x2b')][_0x56c2('0x60')]=_0x14e4c5;return _0x7a69a4;})[_0x56c2('0x23')](function(_0x19300f){if(_0x19300f){if(_0x2e8247[_0x56c2('0x58')][_0x56c2('0x71')]){_0x7a69a4[_0x56c2('0x2b')][_0x56c2('0x72')]=util[_0x56c2('0x5c')](_0x56c2('0x73'),_0x2e8247[_0x56c2('0x5f')][_0x56c2('0x3a')]);_0x7a69a4[_0x56c2('0x2b')][_0x56c2('0x74')]=_0x7a69a4[_0x56c2('0x74')];_0x7a69a4['message']['motionChannel']=_0x7a69a4[_0x56c2('0x74')];_0x7a69a4[_0x56c2('0x2b')]['event']=_0x56c2('0x5a');return respondWithRpcPromise('EventManager',_0x56c2('0x75'),{'event':'acceptmessage','message':_0x7a69a4[_0x56c2('0x2b')]},client9002)[_0x56c2('0x23')](function(){return _0x7a69a4;});}return _0x7a69a4;}return null;})['then'](respondWithResult(_0x324ca5,null))[_0x56c2('0x2d')](handleError(_0x324ca5,null));};var interaction_log=require('../../config/logger')(_0x56c2('0x76'));exports[_0x56c2('0x36')]=function(_0x1d7ae7,_0x4211b6,_0x3b877c){var _0x5cdfc5={'agent':{},'channel':_0x56c2('0x77')};if(_0x1d7ae7[_0x56c2('0x58')]['id']){delete _0x1d7ae7[_0x56c2('0x58')]['id'];}_0x1d7ae7[_0x56c2('0x58')][_0x56c2('0x5e')]=_0x1d7ae7['body'][_0x56c2('0x5e')]||_0x1d7ae7[_0x56c2('0x5f')]['id'];_0x5cdfc5[_0x56c2('0x60')]['id']=_0x1d7ae7['body']['UserId'];return db[_0x56c2('0x3e')][_0x56c2('0x57')]({'where':{'id':_0x1d7ae7[_0x56c2('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4211b6,null))[_0x56c2('0x23')](function(_0x113b29){if(_0x113b29){_0x5cdfc5['message']=_0x113b29[_0x56c2('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x56c2('0x57')]({'where':{'id':_0x113b29[_0x56c2('0x78')]}});}return null;})[_0x56c2('0x23')](handleEntityNotFound(_0x4211b6,null))[_0x56c2('0x23')](function(_0xf18e77){if(_0xf18e77){_0x5cdfc5['interaction']=_0xf18e77[_0x56c2('0x61')]({'plain':!![]});interaction_log[_0x56c2('0x24')](_0x56c2('0x79'),_0x1d7ae7[_0x56c2('0x5f')]['id'],_0x1d7ae7[_0x56c2('0x5f')][_0x56c2('0x3a')],_0x1d7ae7[_0x56c2('0x5f')][_0x56c2('0x66')],_0x5cdfc5['interaction']['id'],_0x1d7ae7[_0x56c2('0x58')]?JSON['stringify'](_0x1d7ae7['body']):_0x56c2('0x7a'));return respondWithRpcPromise(_0x56c2('0x7b'),_0x56c2('0x7c'),_0x5cdfc5);}return null;})[_0x56c2('0x23')](function(_0x47860c){var _0x218176='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x47860c['message'][_0x56c2('0x7d')];return db['sequelize'][_0x56c2('0x43')](_0x218176,{'type':db[_0x56c2('0x6a')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0xc85ef3){return _0xc85ef3;});})[_0x56c2('0x23')](function(_0x276ca0){if(_0x276ca0){_0x5cdfc5[_0x56c2('0x2b')][_0x56c2('0x6c')]=_0x276ca0[0x0];if(!_0x1d7ae7[_0x56c2('0x58')][_0x56c2('0x5e')])return;return db[_0x56c2('0x6d')][_0x56c2('0x57')]({'where':{'id':_0x1d7ae7[_0x56c2('0x58')][_0x56c2('0x5e')],'role':_0x56c2('0x60')},'attributes':['id',_0x56c2('0x3a'),'fullname',_0x56c2('0x6f'),_0x56c2('0x70')],'raw':!![]});}return null;})['then'](function(_0x28b4fe){if(!_0x28b4fe)return null;_0x5cdfc5['message'][_0x56c2('0x60')]=_0x28b4fe;return _0x5cdfc5;})['then'](function(_0x85fcf){if(_0x85fcf){_0x85fcf['message'][_0x56c2('0x72')]=util['format'](_0x56c2('0x73'),_0x1d7ae7[_0x56c2('0x5f')][_0x56c2('0x3a')]);_0x85fcf[_0x56c2('0x2b')][_0x56c2('0x74')]=_0x5cdfc5[_0x56c2('0x74')];_0x85fcf[_0x56c2('0x2b')][_0x56c2('0x7e')]=_0x5cdfc5['channel'];_0x85fcf[_0x56c2('0x2b')][_0x56c2('0x7f')]='reject';respondWithRpcPromise('EventManager',_0x56c2('0x75'),{'event':_0x56c2('0x80'),'message':_0x85fcf[_0x56c2('0x2b')]},client9002);return _0x5cdfc5;}return null;})[_0x56c2('0x23')](respondWithResult(_0x4211b6,null))['catch'](handleError(_0x4211b6,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b62626c..2951ed9 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 _0xa4ee=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x92ac7d,_0x2f5daf){var _0x5cb7da=function(_0x3f5d3a){while(--_0x3f5d3a){_0x92ac7d['push'](_0x92ac7d['shift']());}};_0x5cb7da(++_0x2f5daf);}(_0xa4ee,0x97));var _0xea4e=function(_0x3b5c38,_0x2c7022){_0x3b5c38=_0x3b5c38-0x0;var _0x442ebd=_0xa4ee[_0x3b5c38];return _0x442ebd;};'use strict';var EventEmitter=require(_0xea4e('0x0'));var OpenchannelMessage=require(_0xea4e('0x1'))['db'][_0xea4e('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xea4e('0x3')](0x0);var events={'afterCreate':_0xea4e('0x4'),'afterUpdate':_0xea4e('0x5'),'afterDestroy':_0xea4e('0x6')};function emitEvent(_0x458cd6){return function(_0x2461f7,_0x2f3578,_0x273247){OpenchannelMessageEvents['emit'](_0x458cd6+':'+_0x2461f7['id'],_0x2461f7);OpenchannelMessageEvents[_0xea4e('0x7')](_0x458cd6,_0x2461f7);_0x273247(null);};}for(var e in events){if(events[_0xea4e('0x8')](e)){var event=events[e];OpenchannelMessage[_0xea4e('0x9')](e,emitEvent(event));}}module[_0xea4e('0xa')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x54ab=['hasOwnProperty','hook','exports','OpenchannelMessage','setMaxListeners','update','emit'];(function(_0x2ff0fe,_0x7479b7){var _0xa2b9c8=function(_0x3b3c0f){while(--_0x3b3c0f){_0x2ff0fe['push'](_0x2ff0fe['shift']());}};_0xa2b9c8(++_0x7479b7);}(_0x54ab,0x11b));var _0xb54a=function(_0x494b60,_0x173fd8){_0x494b60=_0x494b60-0x0;var _0x40e0b2=_0x54ab[_0x494b60];return _0x40e0b2;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0xb54a('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb54a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb54a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1be64e){return function(_0x171aa0,_0x177d30,_0x3f8493){OpenchannelMessageEvents[_0xb54a('0x3')](_0x1be64e+':'+_0x171aa0['id'],_0x171aa0);OpenchannelMessageEvents[_0xb54a('0x3')](_0x1be64e,_0x171aa0);_0x3f8493(null);};}for(var e in events){if(events[_0xb54a('0x4')](e)){var event=events[e];OpenchannelMessage[_0xb54a('0x5')](e,emitEvent(event));}}module[_0xb54a('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 a8801bf..53e71cd 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 _0x3266=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','define','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','findOne','OpenchannelInteractionId','createdAt','catch','error','OpenchannelAccount','find','OpenchannelAccountId','CmContact','Contact','keys','then','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','length','Interaction','omit','method','POST','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelInteraction','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4ce493,_0x2791bc){var _0x361088=function(_0x49493f){while(--_0x49493f){_0x4ce493['push'](_0x4ce493['shift']());}};_0x361088(++_0x2791bc);}(_0x3266,0x6a));var _0x6326=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3266[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var logger=require(_0x6326('0x2'))(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var BPromise=require(_0x6326('0x5'));var rp=require(_0x6326('0x6'));var fs=require('fs');var path=require(_0x6326('0x7'));var rimraf=require(_0x6326('0x8'));var config=require('../../config/environment');var attributes=require(_0x6326('0x9'));module['exports']=function(_0x25ecd8,_0x44460c){return _0x25ecd8[_0x6326('0xa')]('OpenchannelMessage',attributes,{'tableName':_0x6326('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x6326('0xc')],'type':_0x6326('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x249eca,_0x1aee60,_0x37a23d){var _0x53c3e1=_0x25ecd8[_0x6326('0xe')];var _0x464a36=_0x249eca[_0x6326('0xf')]({'plain':!![]});if(_0x464a36[_0x6326('0x10')][_0x6326('0x11')]()==='in'||_0x464a36[_0x6326('0x10')][_0x6326('0x11')]()===_0x6326('0x12')&&!_0x464a36[_0x6326('0x13')]&&!_[_0x6326('0x14')](_0x464a36['UserId'])){_0x53c3e1['OpenchannelInteraction'][_0x6326('0x15')]({'where':{'id':_0x464a36[_0x6326('0x16')]}})['then'](function(_0x425878){if(_0x425878){_0x425878['update']({'lastMsgAt':_0x464a36[_0x6326('0x17')],'lastMsgDirection':_0x464a36[_0x6326('0x10')][_0x6326('0x11')]()});}})[_0x6326('0x18')](function(_0x1ed3a3){console[_0x6326('0x19')](_0x1ed3a3);});}if(_0x464a36['direction']===_0x6326('0x12')&&!_0x464a36['secret']){var _0x5945ee;_0x53c3e1['CmContact']['describe']()['then'](function(_0x58e960){return _0x53c3e1[_0x6326('0x1a')][_0x6326('0x1b')]({'where':{'id':_0x464a36[_0x6326('0x1c')]},'include':[{'model':_0x53c3e1['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x464a36[_0x6326('0x16')]},'limit':0x1,'include':[{'model':_0x53c3e1[_0x6326('0x1d')],'as':_0x6326('0x1e'),'attributes':_[_0x6326('0x1f')](_0x58e960)}]}]});})[_0x6326('0x20')](function(_0x25957a){_0x5945ee=_0x25957a[_0x6326('0xf')]({'plain':!![]});if(_0x5945ee&&_0x5945ee['replyUri']){logger[_0x6326('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x6326('0x22'),util[_0x6326('0x23')](_0x6326('0x24'),_0x464a36['id'],_0x5945ee[_0x6326('0x25')]));if(_0x5945ee[_0x6326('0x26')]&&_0x5945ee[_0x6326('0x26')][_0x6326('0x27')]){_0x464a36[_0x6326('0x28')]=_[_0x6326('0x29')](_0x5945ee[_0x6326('0x26')][0x0],_0x6326('0x1e'));_0x464a36['Contact']=_0x5945ee[_0x6326('0x26')][0x0][_0x6326('0x1e')];}var _0x1aee60={'method':'POST','uri':encodeURI(_0x5945ee['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1aee60[_0x6326('0x2a')]){case'GET':_0x1aee60['qs']=_0x464a36;break;case _0x6326('0x2b'):_0x1aee60[_0x6326('0xc')]=_0x464a36;break;}return rp(_0x1aee60)['then'](function(_0x15e33d){logger[_0x6326('0x21')](_0x6326('0x2c'),_0x6326('0x22'),util[_0x6326('0x23')](_0x6326('0x2d'),_0x464a36['id'],_0x5945ee[_0x6326('0x25')]));if(_0x15e33d[_0x6326('0xc')][_0x6326('0x2e')]&&_0x15e33d[_0x6326('0xc')][_0x6326('0x2e')]!=_0x464a36[_0x6326('0x28')][_0x6326('0x2e')]){return _0x53c3e1[_0x6326('0x2f')][_0x6326('0x30')]({'threadId':_0x15e33d[_0x6326('0xc')]['threadId']},{'logging':!![],'where':{'id':_0x464a36[_0x6326('0x28')]['id']}});}else{return;}})[_0x6326('0x20')](function(){return _0x249eca[_0x6326('0x30')]({'read':!![]});})['catch'](function(_0x1bd9a6){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x6326('0x22'),util[_0x6326('0x31')](_0x1bd9a6,{'showHidden':![],'depth':null}));_0x37a23d();});}else{_0x37a23d();}})[_0x6326('0x32')](function(){_0x37a23d();});}else{_0x37a23d();}}},'charset':_0x6326('0x33'),'collate':_0x6326('0x34')});}; \ No newline at end of file +var _0xefda=['request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','omit','POST','method','GET','format','threadId','inspect','finally','utf8mb4','lodash','api','moment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xefda,0x96));var _0xaefd=function(_0x32f0e2,_0x230534){_0x32f0e2=_0x32f0e2-0x0;var _0x1038b6=_0xefda[_0x32f0e2];return _0x1038b6;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xaefd('0xc')],'type':_0xaefd('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x463ce7,_0x4d44ed,_0x48a255){var _0x54a3b1=_0x497258[_0xaefd('0xe')];var _0x16b36e=_0x463ce7[_0xaefd('0xf')]({'plain':!![]});if(_0x16b36e[_0xaefd('0x10')][_0xaefd('0x11')]()==='in'||_0x16b36e[_0xaefd('0x10')][_0xaefd('0x11')]()===_0xaefd('0x12')&&!_0x16b36e[_0xaefd('0x13')]&&!_[_0xaefd('0x14')](_0x16b36e[_0xaefd('0x15')])){_0x54a3b1['OpenchannelInteraction'][_0xaefd('0x16')]({'where':{'id':_0x16b36e['OpenchannelInteractionId']}})[_0xaefd('0x17')](function(_0x1725af){if(_0x1725af){_0x1725af[_0xaefd('0x18')]({'lastMsgAt':_0x16b36e[_0xaefd('0x19')],'lastMsgDirection':_0x16b36e['direction'][_0xaefd('0x11')]()});}})[_0xaefd('0x1a')](function(_0x41f345){console[_0xaefd('0x1b')](_0x41f345);});}if(_0x16b36e[_0xaefd('0x10')]===_0xaefd('0x12')&&!_0x16b36e[_0xaefd('0x13')]){var _0x23d736;_0x54a3b1['CmContact'][_0xaefd('0x1c')]()[_0xaefd('0x17')](function(_0x9748f4){return _0x54a3b1[_0xaefd('0x1d')][_0xaefd('0x1e')]({'where':{'id':_0x16b36e[_0xaefd('0x1f')]},'include':[{'model':_0x54a3b1['OpenchannelInteraction'],'as':_0xaefd('0x20'),'where':{'id':_0x16b36e[_0xaefd('0x21')]},'limit':0x1,'include':[{'model':_0x54a3b1[_0xaefd('0x22')],'as':_0xaefd('0x23'),'attributes':_[_0xaefd('0x24')](_0x9748f4)}]}]});})[_0xaefd('0x17')](function(_0x5282ed){_0x23d736=_0x5282ed[_0xaefd('0xf')]({'plain':!![]});if(_0x23d736&&_0x23d736[_0xaefd('0x25')]){logger[_0xaefd('0x26')](_0xaefd('0x27'),_0xaefd('0x28'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x16b36e['id'],_0x23d736['replyUri']));if(_0x23d736[_0xaefd('0x20')]&&_0x23d736[_0xaefd('0x20')][_0xaefd('0x29')]){_0x16b36e['Interaction']=_[_0xaefd('0x2a')](_0x23d736['Interactions'][0x0],_0xaefd('0x23'));_0x16b36e[_0xaefd('0x23')]=_0x23d736[_0xaefd('0x20')][0x0]['Contact'];}var _0x4d44ed={'method':_0xaefd('0x2b'),'uri':encodeURI(_0x23d736[_0xaefd('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4d44ed[_0xaefd('0x2c')]){case _0xaefd('0x2d'):_0x4d44ed['qs']=_0x16b36e;break;case'POST':_0x4d44ed[_0xaefd('0xc')]=_0x16b36e;break;}return rp(_0x4d44ed)['then'](function(_0x810bf){logger[_0xaefd('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0xaefd('0x28'),util[_0xaefd('0x2e')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x16b36e['id'],_0x23d736[_0xaefd('0x25')]));if(_0x810bf[_0xaefd('0xc')][_0xaefd('0x2f')]&&_0x810bf['body'][_0xaefd('0x2f')]!=_0x16b36e['Interaction'][_0xaefd('0x2f')]){return _0x54a3b1['OpenchannelInteraction']['update']({'threadId':_0x810bf[_0xaefd('0xc')][_0xaefd('0x2f')]},{'logging':!![],'where':{'id':_0x16b36e['Interaction']['id']}});}else{return;}})['then'](function(){return _0x463ce7['update']({'read':!![]});})[_0xaefd('0x1a')](function(_0x280eab){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xaefd('0x28'),util[_0xaefd('0x30')](_0x280eab,{'showHidden':![],'depth':null}));_0x48a255();});}else{_0x48a255();}})[_0xaefd('0x31')](function(){_0x48a255();});}else{_0x48a255();}}},'charset':_0xaefd('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index cac66d8..869d86f 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x66b8ce,_0x51046d){var _0x30767b=function(_0x1686ae){while(--_0x1686ae){_0x66b8ce['push'](_0x66b8ce['shift']());}};_0x30767b(++_0x51046d);}(_0x1261,0x144));var _0x1126=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x1261[_0x8b8564];return _0x360c61;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0xbe6d5d,_0x308a41){var _0x2cb584=function(_0x11f2a2){while(--_0x11f2a2){_0xbe6d5d['push'](_0xbe6d5d['shift']());}};_0x2cb584(++_0x308a41);}(_0xdb28,0x106));var _0x8db2=function(_0x4a65d6,_0x20e310){_0x4a65d6=_0x4a65d6-0x0;var _0x4563d1=_0xdb28[_0x4a65d6];return _0x4563d1;};'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});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 00213f7..77feaa0 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 _0xe407=['openchannelMessage:','./openchannelMessage.events','save','emit','removeListener','length'];(function(_0x36f9fc,_0x10b9e3){var _0xa748e6=function(_0x2d84d2){while(--_0x2d84d2){_0x36f9fc['push'](_0x36f9fc['shift']());}};_0xa748e6(++_0x10b9e3);}(_0xe407,0x181));var _0x7e40=function(_0x2048ef,_0x28669b){_0x2048ef=_0x2048ef-0x0;var _0x45c5b6=_0xe407[_0x2048ef];return _0x45c5b6;};'use strict';var OpenchannelMessageEvents=require(_0x7e40('0x0'));var events=[_0x7e40('0x1'),'remove','update'];function createListener(_0xdead95,_0x22c83f){return function(_0x3bcecd){_0x22c83f[_0x7e40('0x2')](_0xdead95,_0x3bcecd);};}function removeListener(_0x4d40e9,_0x1dfc2a){return function(){OpenchannelMessageEvents[_0x7e40('0x3')](_0x4d40e9,_0x1dfc2a);};}exports['register']=function(_0x10188f){for(var _0x5a523d=0x0,_0x1a44bf=events[_0x7e40('0x4')];_0x5a523d<_0x1a44bf;_0x5a523d++){var _0x426810=events[_0x5a523d];var _0x28a5cf=createListener(_0x7e40('0x5')+_0x426810,_0x10188f);OpenchannelMessageEvents['on'](_0x426810,_0x28a5cf);}}; \ No newline at end of file +var _0xbc5d=['save','remove','update','emit','removeListener','length'];(function(_0x49e134,_0x2c789f){var _0x13ff4d=function(_0x24d870){while(--_0x24d870){_0x49e134['push'](_0x49e134['shift']());}};_0x13ff4d(++_0x2c789f);}(_0xbc5d,0x19e));var _0xdbc5=function(_0xfbd38,_0x59baf4){_0xfbd38=_0xfbd38-0x0;var _0x33792e=_0xbc5d[_0xfbd38];return _0x33792e;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xdbc5('0x0'),_0xdbc5('0x1'),_0xdbc5('0x2')];function createListener(_0x37391e,_0x2e3562){return function(_0x24034d){_0x2e3562[_0xdbc5('0x3')](_0x37391e,_0x24034d);};}function removeListener(_0x2e6d33,_0x270c3a){return function(){OpenchannelMessageEvents[_0xdbc5('0x4')](_0x2e6d33,_0x270c3a);};}exports['register']=function(_0x3e79ac){for(var _0x55da91=0x0,_0x1c6222=events[_0xdbc5('0x5')];_0x55da91<_0x1c6222;_0x55da91++){var _0x2d7747=events[_0x55da91];var _0x2932b4=createListener('openchannelMessage:'+_0x2d7747,_0x3e79ac);OpenchannelMessageEvents['on'](_0x2d7747,_0x2932b4);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index ed5b8a5..4a308de 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 _0xc1a6=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xc1a6,0x15a));var _0x6c1a=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xc1a6[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x6c1a('0x0'));var util=require(_0x6c1a('0x1'));var path=require('path');var timeout=require(_0x6c1a('0x2'));var express=require(_0x6c1a('0x3'));var router=express[_0x6c1a('0x4')]();var fs_extra=require(_0x6c1a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6c1a('0x6'));var config=require(_0x6c1a('0x7'));var controller=require(_0x6c1a('0x8'));router[_0x6c1a('0x9')]('/',auth[_0x6c1a('0xa')](),controller[_0x6c1a('0xb')]);router[_0x6c1a('0x9')](_0x6c1a('0xc'),auth['isAuthenticated'](),controller[_0x6c1a('0xd')]);router[_0x6c1a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6c1a('0xe')]);router[_0x6c1a('0x9')](_0x6c1a('0xf'),auth[_0x6c1a('0xa')](),controller[_0x6c1a('0x10')]);router[_0x6c1a('0x9')]('/:id/teams',auth[_0x6c1a('0xa')](),controller[_0x6c1a('0x11')]);router[_0x6c1a('0x9')](_0x6c1a('0x12'),auth[_0x6c1a('0xa')](),controller[_0x6c1a('0x13')]);router[_0x6c1a('0x14')]('/',auth[_0x6c1a('0xa')](),controller[_0x6c1a('0x15')]);router[_0x6c1a('0x14')]('/:id/teams',auth[_0x6c1a('0xa')](),controller[_0x6c1a('0x16')]);router[_0x6c1a('0x14')](_0x6c1a('0x12'),auth[_0x6c1a('0xa')](),controller['addAgents']);router['put'](_0x6c1a('0x17'),auth[_0x6c1a('0xa')](),controller[_0x6c1a('0x18')]);router[_0x6c1a('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x6c1a('0x1a')]);router[_0x6c1a('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6c1a('0x1b')]);router['delete'](_0x6c1a('0x12'),auth['isAuthenticated'](),controller[_0x6c1a('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x7a70=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','create','addTeams','post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x47ae88,_0x175067){var _0x9f5bf1=function(_0x57d5a9){while(--_0x57d5a9){_0x47ae88['push'](_0x47ae88['shift']());}};_0x9f5bf1(++_0x175067);}(_0x7a70,0x9c));var _0x07a7=function(_0xfdf349,_0x530b78){_0xfdf349=_0xfdf349-0x0;var _0x36b655=_0x7a70[_0xfdf349];return _0x36b655;};'use strict';var multer=require(_0x07a7('0x0'));var util=require(_0x07a7('0x1'));var path=require('path');var timeout=require(_0x07a7('0x2'));var express=require(_0x07a7('0x3'));var router=express['Router']();var fs_extra=require(_0x07a7('0x4'));var auth=require(_0x07a7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x07a7('0x6'));var controller=require(_0x07a7('0x7'));router[_0x07a7('0x8')]('/',auth[_0x07a7('0x9')](),controller['index']);router[_0x07a7('0x8')]('/describe',auth[_0x07a7('0x9')](),controller[_0x07a7('0xa')]);router[_0x07a7('0x8')](_0x07a7('0xb'),auth[_0x07a7('0x9')](),controller['show']);router[_0x07a7('0x8')](_0x07a7('0xc'),auth[_0x07a7('0x9')](),controller[_0x07a7('0xd')]);router[_0x07a7('0x8')]('/:id/teams',auth[_0x07a7('0x9')](),controller[_0x07a7('0xe')]);router['get'](_0x07a7('0xf'),auth[_0x07a7('0x9')](),controller['getAgents']);router['post']('/',auth[_0x07a7('0x9')](),controller[_0x07a7('0x10')]);router['post']('/:id/teams',auth[_0x07a7('0x9')](),controller[_0x07a7('0x11')]);router[_0x07a7('0x12')](_0x07a7('0xf'),auth[_0x07a7('0x9')](),controller[_0x07a7('0x13')]);router['put'](_0x07a7('0xb'),auth[_0x07a7('0x9')](),controller[_0x07a7('0x14')]);router[_0x07a7('0x15')](_0x07a7('0xb'),auth[_0x07a7('0x9')](),controller[_0x07a7('0x16')]);router[_0x07a7('0x15')]('/:id/teams',auth[_0x07a7('0x9')](),controller[_0x07a7('0x17')]);router[_0x07a7('0x15')]('/:id/users',auth[_0x07a7('0x9')](),controller[_0x07a7('0x18')]);module[_0x07a7('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 16edd42..c6ae184 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 _0xc0d7=['name','STRING','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0xff5c47,_0x152e64){var _0x42c097=function(_0x31d207){while(--_0x31d207){_0xff5c47['push'](_0xff5c47['shift']());}};_0x42c097(++_0x152e64);}(_0xc0d7,0x116));var _0x7c0d=function(_0x2fc954,_0x104b00){_0x2fc954=_0x2fc954-0x0;var _0x28e72e=_0xc0d7[_0x2fc954];return _0x28e72e;};'use strict';var Sequelize=require(_0x7c0d('0x0'));module[_0x7c0d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7c0d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7c0d('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7c0d('0x4')]('rrmemory',_0x7c0d('0x5'),_0x7c0d('0x6'))}}; \ No newline at end of file +var _0xfa7f=['beepall','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0xfa7f,0x146));var _0xffa7=function(_0x1ac26c,_0x120842){_0x1ac26c=_0x1ac26c-0x0;var _0x151997=_0xfa7f[_0x1ac26c];return _0x151997;};'use strict';var Sequelize=require(_0xffa7('0x0'));module[_0xffa7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xffa7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xffa7('0x3')]},'timeout':{'type':Sequelize[_0xffa7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xffa7('0x5')](_0xffa7('0x6'),_0xffa7('0x7'),_0xffa7('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index b8d6893..8fc7044 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 _0x74b2=['merge','options','includeAll','include','show','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','order','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','openchannelPause','updatedAt','rows','format','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','each','UserOpenchannelQueue','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','emit','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','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','redis','defaults','localhost','./openchannelQueue.socket','register','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','UserProfileResource','sendStatus','error','stack','name','index','map','OpenchannelQueue','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL'];(function(_0x2dbaa7,_0x458670){var _0xf7dda2=function(_0x4b01ff){while(--_0x4b01ff){_0x2dbaa7['push'](_0x2dbaa7['shift']());}};_0xf7dda2(++_0x458670);}(_0x74b2,0xe1));var _0x274b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x74b2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x274b('0x0'));var rimraf=require(_0x274b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x274b('0x2'));var rp=require('request-promise');var moment=require(_0x274b('0x3'));var BPromise=require(_0x274b('0x4'));var Mustache=require('mustache');var util=require(_0x274b('0x5'));var path=require(_0x274b('0x6'));var sox=require(_0x274b('0x7'));var csv=require(_0x274b('0x8'));var ejs=require(_0x274b('0x9'));var fs=require('fs');var fs_extra=require(_0x274b('0xa'));var _=require(_0x274b('0xb'));var squel=require(_0x274b('0xc'));var crypto=require(_0x274b('0xd'));var jsforce=require(_0x274b('0xe'));var deskjs=require(_0x274b('0xf'));var toCsv=require(_0x274b('0x8'));var querystring=require(_0x274b('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x274b('0x11'));var qs=require(_0x274b('0x12'));var as=require(_0x274b('0x13'));var hardwareService=require(_0x274b('0x14'));var logger=require(_0x274b('0x15'))(_0x274b('0x16'));var utils=require(_0x274b('0x17'));var config=require(_0x274b('0x18'));var licenseUtil=require(_0x274b('0x19'));var db=require('../../mysqldb')['db'];config[_0x274b('0x1a')]=_[_0x274b('0x1b')](config[_0x274b('0x1a')],{'host':_0x274b('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x274b('0x1a')]));require(_0x274b('0x1d'))[_0x274b('0x1e')](socket);function respondWithStatusCode(_0x5c224f,_0x519d80){_0x519d80=_0x519d80||0xcc;return function(_0x5ecaca){if(_0x5ecaca){return _0x5c224f['sendStatus'](_0x519d80);}return _0x5c224f['status'](_0x519d80)[_0x274b('0x1f')]();};}function respondWithResult(_0x4bc014,_0x16fa3b){_0x16fa3b=_0x16fa3b||0xc8;return function(_0x5e49d2){if(_0x5e49d2){return _0x4bc014[_0x274b('0x20')](_0x16fa3b)[_0x274b('0x21')](_0x5e49d2);}};}function respondWithFilteredResult(_0x1724f0,_0x27b0f9){return function(_0x235250){if(_0x235250){var _0x49e96b=typeof _0x27b0f9[_0x274b('0x22')]===_0x274b('0x23')&&typeof _0x27b0f9['limit']===_0x274b('0x23');var _0x520400=_0x235250[_0x274b('0x24')];var _0x3adbb8=_0x49e96b?0x0:_0x27b0f9[_0x274b('0x22')];var _0x46f40e=_0x49e96b?_0x235250[_0x274b('0x24')]:_0x27b0f9[_0x274b('0x22')]+_0x27b0f9[_0x274b('0x25')];var _0x278755;if(_0x46f40e>=_0x520400){_0x46f40e=_0x520400;_0x278755=0xc8;}else{_0x278755=0xce;}_0x1724f0['status'](_0x278755);return _0x1724f0[_0x274b('0x26')](_0x274b('0x27'),_0x3adbb8+'-'+_0x46f40e+'/'+_0x520400)[_0x274b('0x21')](_0x235250);}return null;};}function patchUpdates(_0x277ec8){return function(_0x25e542){try{jsonpatch[_0x274b('0x28')](_0x25e542,_0x277ec8,!![]);}catch(_0x1d2d99){return BPromise[_0x274b('0x29')](_0x1d2d99);}return _0x25e542[_0x274b('0x2a')]();};}function saveUpdates(_0x252194,_0x738eb){return function(_0x576500){if(_0x576500){return _0x576500[_0x274b('0x2b')](_0x252194)['then'](function(_0xf92be6){return _0xf92be6;});}return null;};}function removeEntity(_0x534042,_0x2afc24){return function(_0x20c042){if(_0x20c042){return _0x20c042[_0x274b('0x2c')]()[_0x274b('0x2d')](function(){var _0x520aeb=_0x20c042['get']({'plain':!![]});var _0x35b8c7='OpenchannelQueues';return db[_0x274b('0x2e')][_0x274b('0x2c')]({'where':{'type':_0x35b8c7,'resourceId':_0x520aeb['id']}})[_0x274b('0x2d')](function(){return _0x20c042;});})[_0x274b('0x2d')](function(){_0x534042[_0x274b('0x20')](0xcc)[_0x274b('0x1f')]();});}};}function handleEntityNotFound(_0x5a42b1,_0x43219d){return function(_0x5dc97a){if(!_0x5dc97a){_0x5a42b1[_0x274b('0x2f')](0x194);}return _0x5dc97a;};}function handleError(_0xbffcb7,_0x364347){_0x364347=_0x364347||0x1f4;return function(_0x1e06ad){logger[_0x274b('0x30')](_0x1e06ad[_0x274b('0x31')]);if(_0x1e06ad[_0x274b('0x32')]){delete _0x1e06ad[_0x274b('0x32')];}_0xbffcb7[_0x274b('0x20')](_0x364347)['send'](_0x1e06ad);};}exports[_0x274b('0x33')]=function(_0x3c4abd,_0x20f345){var _0x3f4d48={},_0x5ead15={},_0x1a76e0={'count':0x0,'rows':[]};var _0x255f37=_[_0x274b('0x34')](db[_0x274b('0x35')][_0x274b('0x36')],function(_0x5de51c){return{'name':_0x5de51c['fieldName'],'type':_0x5de51c[_0x274b('0x37')]['key']};});_0x5ead15[_0x274b('0x38')]=_[_0x274b('0x34')](_0x255f37,_0x274b('0x32'));_0x5ead15[_0x274b('0x39')]=_[_0x274b('0x3a')](_0x3c4abd[_0x274b('0x39')]);_0x5ead15['filters']=_[_0x274b('0x3b')](_0x5ead15[_0x274b('0x38')],_0x5ead15[_0x274b('0x39')]);_0x3f4d48['attributes']=_[_0x274b('0x3b')](_0x5ead15[_0x274b('0x38')],qs[_0x274b('0x3c')](_0x3c4abd[_0x274b('0x39')][_0x274b('0x3c')]));_0x3f4d48[_0x274b('0x3d')]=_0x3f4d48[_0x274b('0x3d')][_0x274b('0x3e')]?_0x3f4d48[_0x274b('0x3d')]:_0x5ead15[_0x274b('0x38')];if(!_0x3c4abd[_0x274b('0x39')][_0x274b('0x3f')](_0x274b('0x40'))){_0x3f4d48['limit']=qs[_0x274b('0x25')](_0x3c4abd[_0x274b('0x39')]['limit']);_0x3f4d48[_0x274b('0x22')]=qs[_0x274b('0x22')](_0x3c4abd['query'][_0x274b('0x22')]);}_0x3f4d48['order']=qs[_0x274b('0x41')](_0x3c4abd[_0x274b('0x39')][_0x274b('0x41')]);_0x3f4d48['where']=qs[_0x274b('0x42')](_[_0x274b('0x43')](_0x3c4abd[_0x274b('0x39')],_0x5ead15[_0x274b('0x42')]),_0x255f37);if(_0x3c4abd[_0x274b('0x39')][_0x274b('0x44')]){_0x3f4d48[_0x274b('0x45')]=_['merge'](_0x3f4d48[_0x274b('0x45')],{'$or':_[_0x274b('0x34')](_0x255f37,function(_0x3b93b9){if(_0x3b93b9[_0x274b('0x37')]!==_0x274b('0x46')){var _0x3f5a5f={};_0x3f5a5f[_0x3b93b9['name']]={'$like':'%'+_0x3c4abd[_0x274b('0x39')][_0x274b('0x44')]+'%'};return _0x3f5a5f;}})});}_0x3f4d48=_[_0x274b('0x47')]({},_0x3f4d48,_0x3c4abd[_0x274b('0x48')]);var _0x293bc3={'where':_0x3f4d48['where']};return db[_0x274b('0x35')][_0x274b('0x24')](_0x293bc3)['then'](function(_0x5340af){_0x1a76e0[_0x274b('0x24')]=_0x5340af;if(_0x3c4abd[_0x274b('0x39')][_0x274b('0x49')]){_0x3f4d48[_0x274b('0x4a')]=[{'all':!![]}];}return db[_0x274b('0x35')]['findAll'](_0x3f4d48);})[_0x274b('0x2d')](function(_0x7e23c4){_0x1a76e0['rows']=_0x7e23c4;return _0x1a76e0;})['then'](respondWithFilteredResult(_0x20f345,_0x3f4d48))['catch'](handleError(_0x20f345,null));};exports[_0x274b('0x4b')]=function(_0x3383c8,_0x55b3dc){var _0x2296ed={'raw':!![],'where':{'id':_0x3383c8[_0x274b('0x4c')]['id']}},_0x13d74e={};_0x13d74e[_0x274b('0x38')]=_[_0x274b('0x3a')](db[_0x274b('0x35')][_0x274b('0x36')]);_0x13d74e[_0x274b('0x39')]=_[_0x274b('0x3a')](_0x3383c8[_0x274b('0x39')]);_0x13d74e['filters']=_[_0x274b('0x3b')](_0x13d74e[_0x274b('0x38')],_0x13d74e[_0x274b('0x39')]);_0x2296ed[_0x274b('0x3d')]=_['intersection'](_0x13d74e[_0x274b('0x38')],qs[_0x274b('0x3c')](_0x3383c8[_0x274b('0x39')][_0x274b('0x3c')]));_0x2296ed[_0x274b('0x3d')]=_0x2296ed[_0x274b('0x3d')][_0x274b('0x3e')]?_0x2296ed['attributes']:_0x13d74e[_0x274b('0x38')];if(_0x3383c8['query'][_0x274b('0x49')]){_0x2296ed[_0x274b('0x4a')]=[{'all':!![]}];}_0x2296ed=_[_0x274b('0x47')]({},_0x2296ed,_0x3383c8[_0x274b('0x48')]);return db['OpenchannelQueue'][_0x274b('0x4d')](_0x2296ed)['then'](handleEntityNotFound(_0x55b3dc,null))[_0x274b('0x2d')](respondWithResult(_0x55b3dc,null))[_0x274b('0x4e')](handleError(_0x55b3dc,null));};exports['create']=function(_0x4f85a5,_0x25c28b){return db[_0x274b('0x35')][_0x274b('0x4f')](_0x4f85a5[_0x274b('0x50')],{})['then'](function(_0x1f4789){var _0x3034ea=_0x4f85a5[_0x274b('0x51')][_0x274b('0x52')]({'plain':!![]});if(!_0x3034ea)throw new Error(_0x274b('0x53'));if(_0x3034ea[_0x274b('0x54')]===_0x274b('0x51')){var _0x25145c=_0x1f4789[_0x274b('0x52')]({'plain':!![]});var _0x56f2e8=_0x274b('0x55');return db[_0x274b('0x56')]['find']({'where':{'name':_0x56f2e8,'userProfileId':_0x3034ea[_0x274b('0x57')]},'raw':!![]})['then'](function(_0x1cb120){if(_0x1cb120&&_0x1cb120['autoAssociation']===0x0){return db[_0x274b('0x2e')][_0x274b('0x4f')]({'name':_0x25145c['name'],'resourceId':_0x25145c['id'],'type':_0x1cb120[_0x274b('0x32')],'sectionId':_0x1cb120['id']},{})[_0x274b('0x2d')](function(){return _0x1f4789;});}else{return _0x1f4789;}})['catch'](function(_0x3e8ab0){logger[_0x274b('0x30')](_0x274b('0x58'),_0x3e8ab0);throw _0x3e8ab0;});}return _0x1f4789;})['then'](respondWithResult(_0x25c28b,0xc9))[_0x274b('0x4e')](handleError(_0x25c28b,null));};exports[_0x274b('0x2b')]=function(_0x290819,_0x1b96e8){if(_0x290819[_0x274b('0x50')]['id']){delete _0x290819[_0x274b('0x50')]['id'];}return db[_0x274b('0x35')][_0x274b('0x4d')]({'where':{'id':_0x290819[_0x274b('0x4c')]['id']}})[_0x274b('0x2d')](handleEntityNotFound(_0x1b96e8,null))[_0x274b('0x2d')](saveUpdates(_0x290819['body'],null))[_0x274b('0x2d')](respondWithResult(_0x1b96e8,null))[_0x274b('0x4e')](handleError(_0x1b96e8,null));};exports[_0x274b('0x2c')]=function(_0x4a6679,_0x180884){return db['OpenchannelQueue']['find']({'where':{'id':_0x4a6679['params']['id']}})[_0x274b('0x2d')](handleEntityNotFound(_0x180884,null))[_0x274b('0x2d')](removeEntity(_0x180884,null))[_0x274b('0x4e')](handleError(_0x180884,null));};exports[_0x274b('0x59')]=function(_0x405471,_0x195efa){return db[_0x274b('0x35')]['describe']()[_0x274b('0x2d')](respondWithResult(_0x195efa,null))[_0x274b('0x4e')](handleError(_0x195efa,null));};exports[_0x274b('0x5a')]=function(_0x474947,_0x470fe3,_0xe439ca){var _0x57d88e={'raw':!![],'where':{}},_0x575882={},_0x3cca1e;return db[_0x274b('0x35')][_0x274b('0x5b')]({'where':{'id':_0x474947[_0x274b('0x4c')]['id']}})[_0x274b('0x2d')](handleEntityNotFound(_0x470fe3,null))['then'](function(_0x502ed4){if(_0x502ed4){_0x3cca1e=_0x502ed4['get']({'plain':!![]});_0x575882[_0x274b('0x38')]=_[_0x274b('0x3a')](db['UserOpenchannelQueue'][_0x274b('0x36')]);_0x575882['query']=_[_0x274b('0x3a')](_0x474947['query']);_0x575882[_0x274b('0x42')]=_[_0x274b('0x3b')](_0x575882[_0x274b('0x38')],_0x575882['query']);_0x57d88e[_0x274b('0x3d')]=_[_0x274b('0x3b')](_0x575882[_0x274b('0x38')],qs[_0x274b('0x3c')](_0x474947[_0x274b('0x39')][_0x274b('0x3c')]));_0x57d88e['attributes']=_0x57d88e[_0x274b('0x3d')][_0x274b('0x3e')]?_0x57d88e[_0x274b('0x3d')]:_0x575882[_0x274b('0x38')];if(!_0x474947['query']['hasOwnProperty'](_0x274b('0x40'))){_0x57d88e[_0x274b('0x25')]=qs['limit'](_0x474947[_0x274b('0x39')][_0x274b('0x25')]);_0x57d88e[_0x274b('0x22')]=qs[_0x274b('0x22')](_0x474947[_0x274b('0x39')]['offset']);}_0x57d88e[_0x274b('0x5c')]=qs[_0x274b('0x41')](_0x474947[_0x274b('0x39')][_0x274b('0x41')]);_0x57d88e[_0x274b('0x45')]=qs[_0x274b('0x42')](_[_0x274b('0x43')](_0x474947[_0x274b('0x39')],_0x575882[_0x274b('0x42')]));_0x57d88e['where'][_0x274b('0x5d')]=_0x502ed4['id'];if(_0x474947[_0x274b('0x39')][_0x274b('0x44')]){_0x57d88e['where']=_['merge'](_0x57d88e['where'],{'$or':_[_0x274b('0x34')](_0x57d88e[_0x274b('0x3d')],function(_0x12aea9){var _0x4dcab9={};_0x4dcab9[_0x12aea9]={'$like':'%'+_0x474947['query'][_0x274b('0x44')]+'%'};return _0x4dcab9;})});}_0x57d88e=_[_0x274b('0x47')]({},_0x57d88e,_0x474947[_0x274b('0x48')]);return db['UserOpenchannelQueue'][_0x274b('0x5e')](_0x57d88e);}})[_0x274b('0x2d')](function(_0x1ffeb8){if(_0x1ffeb8){return db[_0x274b('0x5f')][_0x274b('0x60')]({'where':{'id':_[_0x274b('0x34')](_0x1ffeb8,_0x274b('0x61')),'role':'agent'},'attributes':['id',_0x274b('0x32'),_0x274b('0x62'),_0x274b('0x63'),'createdAt']});}})['then'](function(_0x2920be){if(_0x2920be){return{'count':_0x2920be[_0x274b('0x24')],'rows':_['map'](_0x2920be[_0x274b('0x64')],function(_0x366387){return{'membername':_0x366387[_0x274b('0x32')],'UserId':_0x366387['id'],'queue_name':_0x3cca1e[_0x274b('0x32')],'OpenchannelQueueId':_0x3cca1e['id'],'interface':util[_0x274b('0x65')]('%s/%s',_0x274b('0x66'),_0x366387[_0x274b('0x32')]),'penalty':0x0,'paused':_0x366387['openchannelPause'],'createdAt':_0x366387[_0x274b('0x67')],'updatedAt':_0x366387[_0x274b('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x274b('0x2d')](respondWithFilteredResult(_0x470fe3,_0x57d88e))[_0x274b('0x4e')](handleError(_0x470fe3,null));};exports[_0x274b('0x68')]=function(_0x336853,_0x1bfec8,_0x1dde22){var _0x487eec={};var _0x1add65={};var _0x5278ae;var _0x3fc509;return db[_0x274b('0x35')]['findOne']({'where':{'id':_0x336853[_0x274b('0x4c')]['id']}})[_0x274b('0x2d')](handleEntityNotFound(_0x1bfec8,null))[_0x274b('0x2d')](function(_0x192221){if(_0x192221){_0x5278ae=_0x192221;_0x1add65[_0x274b('0x38')]=_[_0x274b('0x3a')](db[_0x274b('0x69')][_0x274b('0x36')]);_0x1add65[_0x274b('0x39')]=_[_0x274b('0x3a')](_0x336853[_0x274b('0x39')]);_0x1add65[_0x274b('0x42')]=_[_0x274b('0x3b')](_0x1add65['model'],_0x1add65[_0x274b('0x39')]);_0x487eec['attributes']=_['intersection'](_0x1add65[_0x274b('0x38')],qs[_0x274b('0x3c')](_0x336853[_0x274b('0x39')]['fields']));_0x487eec[_0x274b('0x3d')]=_0x487eec[_0x274b('0x3d')]['length']?_0x487eec[_0x274b('0x3d')]:_0x1add65[_0x274b('0x38')];_0x487eec['order']=qs[_0x274b('0x41')](_0x336853[_0x274b('0x39')][_0x274b('0x41')]);_0x487eec[_0x274b('0x45')]=qs[_0x274b('0x42')](_[_0x274b('0x43')](_0x336853[_0x274b('0x39')],_0x1add65['filters']));if(_0x336853[_0x274b('0x39')][_0x274b('0x44')]){_0x487eec[_0x274b('0x45')]=_[_0x274b('0x47')](_0x487eec['where'],{'$or':_['map'](_0x487eec['attributes'],function(_0x10a18c){var _0x5670d6={};_0x5670d6[_0x10a18c]={'$like':'%'+_0x336853[_0x274b('0x39')]['filter']+'%'};return _0x5670d6;})});}_0x487eec=_[_0x274b('0x47')]({},_0x487eec,_0x336853[_0x274b('0x48')]);return _0x5278ae['getTeams'](_0x487eec);}})[_0x274b('0x2d')](function(_0x160681){if(_0x160681){_0x3fc509=_0x160681[_0x274b('0x3e')];if(!_0x336853['query'][_0x274b('0x3f')]('nolimit')){_0x487eec[_0x274b('0x25')]=qs[_0x274b('0x25')](_0x336853[_0x274b('0x39')][_0x274b('0x25')]);_0x487eec[_0x274b('0x22')]=qs[_0x274b('0x22')](_0x336853['query']['offset']);}return _0x5278ae['getTeams'](_0x487eec);}})['then'](function(_0x216b06){if(_0x216b06){return _0x216b06?{'count':_0x3fc509,'rows':_0x216b06}:null;}})[_0x274b('0x2d')](respondWithResult(_0x1bfec8,null))[_0x274b('0x4e')](handleError(_0x1bfec8,null));};exports[_0x274b('0x6a')]=function(_0x549f08,_0x48085c,_0x96c74b){var _0x364d66=_0x549f08[_0x274b('0x50')][_0x274b('0x6b')];return db[_0x274b('0x69')][_0x274b('0x5e')]({'where':{'id':_0x364d66},'attributes':['id'],'include':[{'model':db[_0x274b('0x5f')],'as':_0x274b('0x6c'),'attributes':['id',_0x274b('0x32'),'online',_0x274b('0x6d'),_0x274b('0x6e')],'raw':!![]}]})[_0x274b('0x2d')](function(_0x5a80c3){if(_0x5a80c3){var _0x26133a=_[_0x274b('0x6f')](_0x5a80c3,function(_0x576601){var _0x52f1b2=_0x576601['get']({'plain':!![]});return _0x52f1b2[_0x274b('0x6c')];});return db['OpenchannelQueue'][_0x274b('0x4d')]({'where':{'id':_0x549f08[_0x274b('0x4c')]['id']}})[_0x274b('0x2d')](function(_0x8acd44){return db['sequelize'][_0x274b('0x70')](function(_0x12048d){return _0x8acd44[_0x274b('0x6a')](_0x364d66,{'transaction':_0x12048d})[_0x274b('0x2d')](function(){return BPromise[_0x274b('0x71')](_0x26133a,function(_0x4e9305){return db[_0x274b('0x72')][_0x274b('0x73')]({'where':{'UserId':_0x4e9305['id'],'OpenchannelQueueId':_0x549f08[_0x274b('0x4c')]['id']},'transaction':_0x12048d});});})[_0x274b('0x2d')](function(){_0x26133a[_0x274b('0x74')](function(_0x4571d5){socket['emit'](_0x274b('0x75'),{'UserId':_0x4571d5['id'],'OpenchannelQueueId':_0x8acd44['id']});});});});});}})['then'](respondWithStatusCode(_0x48085c,null))[_0x274b('0x4e')](handleError(_0x48085c,null));};exports[_0x274b('0x76')]=function(_0x14e084,_0x269ce2,_0x2c8b60){return db[_0x274b('0x69')][_0x274b('0x5e')]({'where':{'id':_0x14e084[_0x274b('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x274b('0x5f')],'as':_0x274b('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x269ce2,null))[_0x274b('0x2d')](function(_0x360c06){var _0x21795f=_[_0x274b('0x34')](_0x360c06,'id');var _0x2bdd06=[];var _0x511540=[];var _0x55ba2f=squel['select']();_0x55ba2f[_0x274b('0x77')](_0x274b('0x78'))[_0x274b('0x79')](_0x274b('0x7a'),'tq')[_0x274b('0x7b')](_0x274b('0x7c'),'ut',_0x274b('0x7d'))[_0x274b('0x45')](_0x274b('0x7e'),_0x14e084[_0x274b('0x4c')]['id']);for(var _0x26a62a=0x0;_0x26a62a<_0x360c06['length'];_0x26a62a+=0x1){let _0x39a61a=_0x360c06[_0x26a62a];for(var _0x382502=0x0;_0x382502<_0x39a61a[_0x274b('0x6c')][_0x274b('0x3e')];_0x382502+=0x1){let _0x318400=_0x39a61a[_0x274b('0x6c')][_0x382502];var _0x116623=_0x55ba2f[_0x274b('0x7f')]();_0x116623['where'](_0x274b('0x80'),_0x318400['id']);_0x511540[_0x274b('0x81')](db[_0x274b('0x82')]['query'](_0x116623['toString'](),{'type':db[_0x274b('0x82')][_0x274b('0x83')][_0x274b('0x84')]})['then'](function(_0x68997e){if(_0x68997e[_0x274b('0x3e')]===0x1){return _0x318400['id'];}else{var _0x158fcd=_[_0x274b('0x85')](_[_0x274b('0x34')](_0x68997e,_0x274b('0x86')),function(_0x3bc5e9){return _['includes'](_0x21795f,_0x3bc5e9);});if(_0x158fcd){return _0x318400['id'];}}}));}}return BPromise[_0x274b('0x87')](_0x511540)[_0x274b('0x2d')](function(_0x570681){_0x2bdd06=_(_0x2bdd06)[_0x274b('0x88')](_0x570681)[_0x274b('0x89')]()[_0x274b('0x8a')]();return db[_0x274b('0x35')]['find']({'where':{'id':_0x14e084[_0x274b('0x4c')]['id']}})[_0x274b('0x2d')](function(_0x2a5d11){return db[_0x274b('0x82')][_0x274b('0x70')](function(_0x22747e){return _0x2a5d11[_0x274b('0x76')](_0x14e084['query'][_0x274b('0x6b')],{'transaction':_0x22747e})[_0x274b('0x2d')](function(){if(!_[_0x274b('0x8b')](_0x2bdd06)){return _0x2a5d11[_0x274b('0x8c')](_0x2bdd06,{'transaction':_0x22747e});}})[_0x274b('0x2d')](function(){_0x2bdd06[_0x274b('0x74')](function(_0x28f8a2){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x28f8a2,'OpenchannelQueueId':_0x2a5d11['id']});});});});});});})[_0x274b('0x2d')](respondWithStatusCode(_0x269ce2,null))[_0x274b('0x4e')](handleError(_0x269ce2,null));};exports[_0x274b('0x8d')]=function(_0x18f9f4,_0x48089d,_0x2ad1ea){return db['OpenchannelQueue'][_0x274b('0x4d')]({'where':{'id':_0x18f9f4[_0x274b('0x4c')]['id']}})[_0x274b('0x2d')](handleEntityNotFound(_0x48089d,null))['then'](function(_0x1d9e50){if(_0x1d9e50){return _0x1d9e50[_0x274b('0x8d')](_0x18f9f4[_0x274b('0x50')][_0x274b('0x6b')],_[_0x274b('0x8e')](_0x18f9f4[_0x274b('0x50')],[_0x274b('0x6b'),'id'])||{})[_0x274b('0x8f')](function(_0x36f6b9){for(var _0x36015e=0x0;_0x36015e<_0x18f9f4['body'][_0x274b('0x6b')][_0x274b('0x3e')];_0x36015e+=0x1){socket[_0x274b('0x90')]('userOpenchannelQueue:save',{'UserId':Number(_0x18f9f4[_0x274b('0x50')]['ids'][_0x36015e]),'OpenchannelQueueId':Number(_0x18f9f4[_0x274b('0x4c')]['id'])});}return _0x36f6b9;});}})[_0x274b('0x2d')](respondWithResult(_0x48089d,null))[_0x274b('0x4e')](handleError(_0x48089d,null));};exports[_0x274b('0x8c')]=function(_0x454c64,_0x4426b2,_0x599dc7){return db[_0x274b('0x35')][_0x274b('0x4d')]({'where':{'id':_0x454c64[_0x274b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4426b2,null))[_0x274b('0x2d')](function(_0xf4464c){if(_0xf4464c){return _0xf4464c[_0x274b('0x8c')](_0x454c64[_0x274b('0x39')][_0x274b('0x6b')])[_0x274b('0x2d')](function(){if(_[_0x274b('0x91')](_0x454c64[_0x274b('0x39')][_0x274b('0x6b')])){for(var _0x957cb=0x0;_0x957cb<_0x454c64['query']['ids'][_0x274b('0x3e')];_0x957cb+=0x1){socket[_0x274b('0x90')]('userOpenchannelQueue:remove',{'UserId':Number(_0x454c64[_0x274b('0x39')][_0x274b('0x6b')][_0x957cb]),'OpenchannelQueueId':Number(_0x454c64[_0x274b('0x4c')]['id'])});}}else{socket[_0x274b('0x90')](_0x274b('0x92'),{'UserId':Number(_0x454c64[_0x274b('0x39')][_0x274b('0x6b')]),'OpenchannelQueueId':Number(_0x454c64['params']['id'])});}});}})[_0x274b('0x2d')](respondWithStatusCode(_0x4426b2,null))[_0x274b('0x4e')](handleError(_0x4426b2,null));};exports[_0x274b('0x93')]=function(_0x24bbdc,_0x48dd3e,_0x53fd4e){var _0x577f27={};var _0x241efa={};var _0x56c178;var _0x5bc906;return db['OpenchannelQueue'][_0x274b('0x5b')]({'where':{'id':_0x24bbdc[_0x274b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x48dd3e,null))[_0x274b('0x2d')](function(_0x43c47c){if(_0x43c47c){_0x56c178=_0x43c47c;_0x241efa['model']=_[_0x274b('0x3a')](db['User'][_0x274b('0x36')]);_0x241efa['query']=_[_0x274b('0x3a')](_0x24bbdc['query']);_0x241efa[_0x274b('0x42')]=_[_0x274b('0x3b')](_0x241efa[_0x274b('0x38')],_0x241efa[_0x274b('0x39')]);_0x577f27[_0x274b('0x3d')]=_[_0x274b('0x3b')](_0x241efa[_0x274b('0x38')],qs[_0x274b('0x3c')](_0x24bbdc[_0x274b('0x39')][_0x274b('0x3c')]));_0x577f27['attributes']=_0x577f27[_0x274b('0x3d')]['length']?_0x577f27[_0x274b('0x3d')]:_0x241efa[_0x274b('0x38')];_0x577f27[_0x274b('0x5c')]=qs[_0x274b('0x41')](_0x24bbdc[_0x274b('0x39')]['sort']);_0x577f27[_0x274b('0x45')]=qs[_0x274b('0x42')](_[_0x274b('0x43')](_0x24bbdc['query'],_0x241efa[_0x274b('0x42')]));if(_0x24bbdc[_0x274b('0x39')]['filter']){_0x577f27[_0x274b('0x45')]=_[_0x274b('0x47')](_0x577f27[_0x274b('0x45')],{'$or':_[_0x274b('0x34')](_0x577f27['attributes'],function(_0x393467){var _0xc7b28e={};_0xc7b28e[_0x393467]={'$like':'%'+_0x24bbdc[_0x274b('0x39')][_0x274b('0x44')]+'%'};return _0xc7b28e;})});}_0x577f27=_[_0x274b('0x47')]({},_0x577f27,_0x24bbdc['options']);return _0x56c178[_0x274b('0x93')](_0x577f27);}})[_0x274b('0x2d')](function(_0x1c1ccc){if(_0x1c1ccc){_0x5bc906=_0x1c1ccc[_0x274b('0x3e')];if(!_0x24bbdc['query'][_0x274b('0x3f')](_0x274b('0x40'))){_0x577f27[_0x274b('0x25')]=qs['limit'](_0x24bbdc[_0x274b('0x39')][_0x274b('0x25')]);_0x577f27[_0x274b('0x22')]=qs[_0x274b('0x22')](_0x24bbdc[_0x274b('0x39')]['offset']);}return _0x56c178[_0x274b('0x93')](_0x577f27);}})[_0x274b('0x2d')](function(_0x2f4b05){if(_0x2f4b05){return _0x2f4b05?{'count':_0x5bc906,'rows':_0x2f4b05}:null;}})['then'](respondWithResult(_0x48dd3e,null))['catch'](handleError(_0x48dd3e,null));}; \ No newline at end of file +var _0xd340=['VIRTUAL','OpenchannelQueue','includeAll','include','findAll','rows','catch','keys','rawAttributes','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','describe','getMembers','nolimit','sort','UserOpenchannelQueue','User','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','forEach','userOpenchannelQueue:save','removeTeams','select','field','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','compact','value','ids','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','map','fieldName','type','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','pick','filter','where','merge'];(function(_0x484b09,_0x374e58){var _0x2e8c43=function(_0x17a10b){while(--_0x17a10b){_0x484b09['push'](_0x484b09['shift']());}};_0x2e8c43(++_0x374e58);}(_0xd340,0xd1));var _0x0d34=function(_0x3523c9,_0x450693){_0x3523c9=_0x3523c9-0x0;var _0x10d140=_0xd340[_0x3523c9];return _0x10d140;};'use strict';var emlformat=require(_0x0d34('0x0'));var rimraf=require(_0x0d34('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d34('0x2'));var rp=require(_0x0d34('0x3'));var moment=require(_0x0d34('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0d34('0x5'));var util=require(_0x0d34('0x6'));var path=require('path');var sox=require(_0x0d34('0x7'));var csv=require('to-csv');var ejs=require(_0x0d34('0x8'));var fs=require('fs');var fs_extra=require(_0x0d34('0x9'));var _=require(_0x0d34('0xa'));var squel=require(_0x0d34('0xb'));var crypto=require(_0x0d34('0xc'));var jsforce=require(_0x0d34('0xd'));var deskjs=require(_0x0d34('0xe'));var toCsv=require(_0x0d34('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0d34('0x10'));var authService=require(_0x0d34('0x11'));var qs=require(_0x0d34('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d34('0x13'));var logger=require('../../config/logger')(_0x0d34('0x14'));var utils=require(_0x0d34('0x15'));var config=require(_0x0d34('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d34('0x17'))['db'];config[_0x0d34('0x18')]=_[_0x0d34('0x19')](config[_0x0d34('0x18')],{'host':_0x0d34('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d34('0x18')]));require(_0x0d34('0x1b'))[_0x0d34('0x1c')](socket);function respondWithStatusCode(_0x2cf31d,_0x204fb6){_0x204fb6=_0x204fb6||0xcc;return function(_0x3d3fdc){if(_0x3d3fdc){return _0x2cf31d[_0x0d34('0x1d')](_0x204fb6);}return _0x2cf31d['status'](_0x204fb6)[_0x0d34('0x1e')]();};}function respondWithResult(_0x36cd0b,_0x5037ba){_0x5037ba=_0x5037ba||0xc8;return function(_0x41cdd8){if(_0x41cdd8){return _0x36cd0b[_0x0d34('0x1f')](_0x5037ba)['json'](_0x41cdd8);}};}function respondWithFilteredResult(_0x3a4154,_0x25838a){return function(_0x507e78){if(_0x507e78){var _0x36b17e=typeof _0x25838a[_0x0d34('0x20')]==='undefined'&&typeof _0x25838a['limit']===_0x0d34('0x21');var _0x3d85e1=_0x507e78[_0x0d34('0x22')];var _0x1d10e2=_0x36b17e?0x0:_0x25838a['offset'];var _0x5403dc=_0x36b17e?_0x507e78[_0x0d34('0x22')]:_0x25838a['offset']+_0x25838a[_0x0d34('0x23')];var _0x318a2c;if(_0x5403dc>=_0x3d85e1){_0x5403dc=_0x3d85e1;_0x318a2c=0xc8;}else{_0x318a2c=0xce;}_0x3a4154['status'](_0x318a2c);return _0x3a4154['set'](_0x0d34('0x24'),_0x1d10e2+'-'+_0x5403dc+'/'+_0x3d85e1)[_0x0d34('0x25')](_0x507e78);}return null;};}function patchUpdates(_0x34f73c){return function(_0x5ea3cc){try{jsonpatch[_0x0d34('0x26')](_0x5ea3cc,_0x34f73c,!![]);}catch(_0x277b51){return BPromise[_0x0d34('0x27')](_0x277b51);}return _0x5ea3cc[_0x0d34('0x28')]();};}function saveUpdates(_0x147347,_0xd85f97){return function(_0x494d6d){if(_0x494d6d){return _0x494d6d[_0x0d34('0x29')](_0x147347)['then'](function(_0x52029b){return _0x52029b;});}return null;};}function removeEntity(_0x1af681,_0x390033){return function(_0x50d443){if(_0x50d443){return _0x50d443['destroy']()[_0x0d34('0x2a')](function(){var _0x1c27e5=_0x50d443['get']({'plain':!![]});var _0x12cbdb='OpenchannelQueues';return db['UserProfileResource'][_0x0d34('0x2b')]({'where':{'type':_0x12cbdb,'resourceId':_0x1c27e5['id']}})[_0x0d34('0x2a')](function(){return _0x50d443;});})[_0x0d34('0x2a')](function(){_0x1af681['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e8be3,_0x4555fd){return function(_0x4a3484){if(!_0x4a3484){_0x3e8be3[_0x0d34('0x1d')](0x194);}return _0x4a3484;};}function handleError(_0x50638d,_0x7dff4){_0x7dff4=_0x7dff4||0x1f4;return function(_0x54027b){logger[_0x0d34('0x2c')](_0x54027b['stack']);if(_0x54027b['name']){delete _0x54027b[_0x0d34('0x2d')];}_0x50638d[_0x0d34('0x1f')](_0x7dff4)[_0x0d34('0x2e')](_0x54027b);};}exports['index']=function(_0x26133b,_0x5ecbf9){var _0x51c439={},_0x5f3980={},_0x2d9221={'count':0x0,'rows':[]};var _0x518765=_[_0x0d34('0x2f')](db['OpenchannelQueue']['rawAttributes'],function(_0x509cc1){return{'name':_0x509cc1[_0x0d34('0x30')],'type':_0x509cc1[_0x0d34('0x31')]['key']};});_0x5f3980['model']=_[_0x0d34('0x2f')](_0x518765,'name');_0x5f3980['query']=_['keys'](_0x26133b['query']);_0x5f3980[_0x0d34('0x32')]=_[_0x0d34('0x33')](_0x5f3980[_0x0d34('0x34')],_0x5f3980[_0x0d34('0x35')]);_0x51c439[_0x0d34('0x36')]=_[_0x0d34('0x33')](_0x5f3980[_0x0d34('0x34')],qs[_0x0d34('0x37')](_0x26133b[_0x0d34('0x35')][_0x0d34('0x37')]));_0x51c439[_0x0d34('0x36')]=_0x51c439[_0x0d34('0x36')][_0x0d34('0x38')]?_0x51c439['attributes']:_0x5f3980[_0x0d34('0x34')];if(!_0x26133b['query'][_0x0d34('0x39')]('nolimit')){_0x51c439[_0x0d34('0x23')]=qs[_0x0d34('0x23')](_0x26133b[_0x0d34('0x35')]['limit']);_0x51c439['offset']=qs[_0x0d34('0x20')](_0x26133b['query'][_0x0d34('0x20')]);}_0x51c439[_0x0d34('0x3a')]=qs['sort'](_0x26133b[_0x0d34('0x35')]['sort']);_0x51c439['where']=qs[_0x0d34('0x32')](_[_0x0d34('0x3b')](_0x26133b[_0x0d34('0x35')],_0x5f3980[_0x0d34('0x32')]),_0x518765);if(_0x26133b[_0x0d34('0x35')][_0x0d34('0x3c')]){_0x51c439[_0x0d34('0x3d')]=_[_0x0d34('0x3e')](_0x51c439['where'],{'$or':_['map'](_0x518765,function(_0x761def){if(_0x761def[_0x0d34('0x31')]!==_0x0d34('0x3f')){var _0xd06592={};_0xd06592[_0x761def[_0x0d34('0x2d')]]={'$like':'%'+_0x26133b['query'][_0x0d34('0x3c')]+'%'};return _0xd06592;}})});}_0x51c439=_[_0x0d34('0x3e')]({},_0x51c439,_0x26133b['options']);var _0x39384b={'where':_0x51c439[_0x0d34('0x3d')]};return db[_0x0d34('0x40')][_0x0d34('0x22')](_0x39384b)['then'](function(_0x9fd04a){_0x2d9221[_0x0d34('0x22')]=_0x9fd04a;if(_0x26133b[_0x0d34('0x35')][_0x0d34('0x41')]){_0x51c439[_0x0d34('0x42')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x0d34('0x43')](_0x51c439);})[_0x0d34('0x2a')](function(_0x353dd6){_0x2d9221[_0x0d34('0x44')]=_0x353dd6;return _0x2d9221;})[_0x0d34('0x2a')](respondWithFilteredResult(_0x5ecbf9,_0x51c439))[_0x0d34('0x45')](handleError(_0x5ecbf9,null));};exports['show']=function(_0x33d586,_0x535d46){var _0x5719e3={'raw':!![],'where':{'id':_0x33d586['params']['id']}},_0x47bbc1={};_0x47bbc1[_0x0d34('0x34')]=_[_0x0d34('0x46')](db[_0x0d34('0x40')][_0x0d34('0x47')]);_0x47bbc1[_0x0d34('0x35')]=_[_0x0d34('0x46')](_0x33d586[_0x0d34('0x35')]);_0x47bbc1[_0x0d34('0x32')]=_['intersection'](_0x47bbc1[_0x0d34('0x34')],_0x47bbc1[_0x0d34('0x35')]);_0x5719e3[_0x0d34('0x36')]=_['intersection'](_0x47bbc1[_0x0d34('0x34')],qs[_0x0d34('0x37')](_0x33d586['query'][_0x0d34('0x37')]));_0x5719e3[_0x0d34('0x36')]=_0x5719e3['attributes'][_0x0d34('0x38')]?_0x5719e3[_0x0d34('0x36')]:_0x47bbc1[_0x0d34('0x34')];if(_0x33d586[_0x0d34('0x35')][_0x0d34('0x41')]){_0x5719e3['include']=[{'all':!![]}];}_0x5719e3=_[_0x0d34('0x3e')]({},_0x5719e3,_0x33d586[_0x0d34('0x48')]);return db[_0x0d34('0x40')][_0x0d34('0x49')](_0x5719e3)['then'](handleEntityNotFound(_0x535d46,null))[_0x0d34('0x2a')](respondWithResult(_0x535d46,null))['catch'](handleError(_0x535d46,null));};exports['create']=function(_0x41a2b5,_0x298ba4){return db[_0x0d34('0x40')][_0x0d34('0x4a')](_0x41a2b5[_0x0d34('0x4b')],{})[_0x0d34('0x2a')](function(_0x249f4b){var _0x297195=_0x41a2b5['user'][_0x0d34('0x4c')]({'plain':!![]});if(!_0x297195)throw new Error(_0x0d34('0x4d'));if(_0x297195['role']===_0x0d34('0x4e')){var _0x529af0=_0x249f4b[_0x0d34('0x4c')]({'plain':!![]});var _0xad6a6=_0x0d34('0x4f');return db[_0x0d34('0x50')][_0x0d34('0x49')]({'where':{'name':_0xad6a6,'userProfileId':_0x297195[_0x0d34('0x51')]},'raw':!![]})[_0x0d34('0x2a')](function(_0x2893ff){if(_0x2893ff&&_0x2893ff[_0x0d34('0x52')]===0x0){return db[_0x0d34('0x53')][_0x0d34('0x4a')]({'name':_0x529af0[_0x0d34('0x2d')],'resourceId':_0x529af0['id'],'type':_0x2893ff[_0x0d34('0x2d')],'sectionId':_0x2893ff['id']},{})[_0x0d34('0x2a')](function(){return _0x249f4b;});}else{return _0x249f4b;}})['catch'](function(_0xc1709c){logger[_0x0d34('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc1709c);throw _0xc1709c;});}return _0x249f4b;})[_0x0d34('0x2a')](respondWithResult(_0x298ba4,0xc9))['catch'](handleError(_0x298ba4,null));};exports['update']=function(_0x47f45f,_0x2167e2){if(_0x47f45f[_0x0d34('0x4b')]['id']){delete _0x47f45f['body']['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x47f45f[_0x0d34('0x54')]['id']}})['then'](handleEntityNotFound(_0x2167e2,null))[_0x0d34('0x2a')](saveUpdates(_0x47f45f[_0x0d34('0x4b')],null))['then'](respondWithResult(_0x2167e2,null))[_0x0d34('0x45')](handleError(_0x2167e2,null));};exports['destroy']=function(_0x356510,_0x21f231){return db['OpenchannelQueue'][_0x0d34('0x49')]({'where':{'id':_0x356510[_0x0d34('0x54')]['id']}})[_0x0d34('0x2a')](handleEntityNotFound(_0x21f231,null))[_0x0d34('0x2a')](removeEntity(_0x21f231,null))[_0x0d34('0x45')](handleError(_0x21f231,null));};exports[_0x0d34('0x55')]=function(_0x408fc1,_0x32f19b){return db[_0x0d34('0x40')][_0x0d34('0x55')]()[_0x0d34('0x2a')](respondWithResult(_0x32f19b,null))[_0x0d34('0x45')](handleError(_0x32f19b,null));};exports[_0x0d34('0x56')]=function(_0x2c59fc,_0x4d53c3,_0x288151){var _0x4b23d0={'raw':!![],'where':{}},_0x2ba13c={},_0x40a27e;return db[_0x0d34('0x40')]['findOne']({'where':{'id':_0x2c59fc[_0x0d34('0x54')]['id']}})[_0x0d34('0x2a')](handleEntityNotFound(_0x4d53c3,null))[_0x0d34('0x2a')](function(_0xb5d295){if(_0xb5d295){_0x40a27e=_0xb5d295[_0x0d34('0x4c')]({'plain':!![]});_0x2ba13c['model']=_[_0x0d34('0x46')](db['UserOpenchannelQueue'][_0x0d34('0x47')]);_0x2ba13c[_0x0d34('0x35')]=_[_0x0d34('0x46')](_0x2c59fc[_0x0d34('0x35')]);_0x2ba13c[_0x0d34('0x32')]=_['intersection'](_0x2ba13c[_0x0d34('0x34')],_0x2ba13c[_0x0d34('0x35')]);_0x4b23d0[_0x0d34('0x36')]=_['intersection'](_0x2ba13c[_0x0d34('0x34')],qs[_0x0d34('0x37')](_0x2c59fc['query'][_0x0d34('0x37')]));_0x4b23d0[_0x0d34('0x36')]=_0x4b23d0[_0x0d34('0x36')]['length']?_0x4b23d0[_0x0d34('0x36')]:_0x2ba13c[_0x0d34('0x34')];if(!_0x2c59fc[_0x0d34('0x35')][_0x0d34('0x39')](_0x0d34('0x57'))){_0x4b23d0[_0x0d34('0x23')]=qs[_0x0d34('0x23')](_0x2c59fc[_0x0d34('0x35')][_0x0d34('0x23')]);_0x4b23d0['offset']=qs[_0x0d34('0x20')](_0x2c59fc[_0x0d34('0x35')][_0x0d34('0x20')]);}_0x4b23d0[_0x0d34('0x3a')]=qs[_0x0d34('0x58')](_0x2c59fc[_0x0d34('0x35')][_0x0d34('0x58')]);_0x4b23d0[_0x0d34('0x3d')]=qs[_0x0d34('0x32')](_[_0x0d34('0x3b')](_0x2c59fc[_0x0d34('0x35')],_0x2ba13c['filters']));_0x4b23d0[_0x0d34('0x3d')]['OpenchannelQueueId']=_0xb5d295['id'];if(_0x2c59fc[_0x0d34('0x35')][_0x0d34('0x3c')]){_0x4b23d0[_0x0d34('0x3d')]=_[_0x0d34('0x3e')](_0x4b23d0[_0x0d34('0x3d')],{'$or':_[_0x0d34('0x2f')](_0x4b23d0[_0x0d34('0x36')],function(_0x42ed30){var _0x1652b6={};_0x1652b6[_0x42ed30]={'$like':'%'+_0x2c59fc[_0x0d34('0x35')][_0x0d34('0x3c')]+'%'};return _0x1652b6;})});}_0x4b23d0=_['merge']({},_0x4b23d0,_0x2c59fc[_0x0d34('0x48')]);return db[_0x0d34('0x59')][_0x0d34('0x43')](_0x4b23d0);}})[_0x0d34('0x2a')](function(_0x143404){if(_0x143404){return db[_0x0d34('0x5a')][_0x0d34('0x5b')]({'where':{'id':_[_0x0d34('0x2f')](_0x143404,_0x0d34('0x5c')),'role':'agent'},'attributes':['id',_0x0d34('0x2d'),_0x0d34('0x5d'),_0x0d34('0x5e'),_0x0d34('0x5f')]});}})[_0x0d34('0x2a')](function(_0x13c7e0){if(_0x13c7e0){return{'count':_0x13c7e0['count'],'rows':_[_0x0d34('0x2f')](_0x13c7e0[_0x0d34('0x44')],function(_0x35dd58){return{'membername':_0x35dd58[_0x0d34('0x2d')],'UserId':_0x35dd58['id'],'queue_name':_0x40a27e[_0x0d34('0x2d')],'OpenchannelQueueId':_0x40a27e['id'],'interface':util[_0x0d34('0x60')]('%s/%s',_0x0d34('0x61'),_0x35dd58[_0x0d34('0x2d')]),'penalty':0x0,'paused':_0x35dd58[_0x0d34('0x5d')],'createdAt':_0x35dd58[_0x0d34('0x5f')],'updatedAt':_0x35dd58['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0d34('0x2a')](respondWithFilteredResult(_0x4d53c3,_0x4b23d0))[_0x0d34('0x45')](handleError(_0x4d53c3,null));};exports[_0x0d34('0x62')]=function(_0x8def,_0x2a54be,_0xfcb4e0){var _0x5a756f={};var _0x281045={};var _0x5afb10;var _0x2278c1;return db['OpenchannelQueue'][_0x0d34('0x63')]({'where':{'id':_0x8def[_0x0d34('0x54')]['id']}})[_0x0d34('0x2a')](handleEntityNotFound(_0x2a54be,null))[_0x0d34('0x2a')](function(_0x395091){if(_0x395091){_0x5afb10=_0x395091;_0x281045[_0x0d34('0x34')]=_[_0x0d34('0x46')](db[_0x0d34('0x64')][_0x0d34('0x47')]);_0x281045[_0x0d34('0x35')]=_[_0x0d34('0x46')](_0x8def[_0x0d34('0x35')]);_0x281045[_0x0d34('0x32')]=_[_0x0d34('0x33')](_0x281045['model'],_0x281045[_0x0d34('0x35')]);_0x5a756f[_0x0d34('0x36')]=_['intersection'](_0x281045['model'],qs[_0x0d34('0x37')](_0x8def[_0x0d34('0x35')]['fields']));_0x5a756f[_0x0d34('0x36')]=_0x5a756f['attributes'][_0x0d34('0x38')]?_0x5a756f[_0x0d34('0x36')]:_0x281045[_0x0d34('0x34')];_0x5a756f[_0x0d34('0x3a')]=qs[_0x0d34('0x58')](_0x8def['query'][_0x0d34('0x58')]);_0x5a756f[_0x0d34('0x3d')]=qs[_0x0d34('0x32')](_[_0x0d34('0x3b')](_0x8def['query'],_0x281045['filters']));if(_0x8def[_0x0d34('0x35')][_0x0d34('0x3c')]){_0x5a756f['where']=_[_0x0d34('0x3e')](_0x5a756f['where'],{'$or':_[_0x0d34('0x2f')](_0x5a756f[_0x0d34('0x36')],function(_0x4a5654){var _0x50e213={};_0x50e213[_0x4a5654]={'$like':'%'+_0x8def[_0x0d34('0x35')]['filter']+'%'};return _0x50e213;})});}_0x5a756f=_['merge']({},_0x5a756f,_0x8def[_0x0d34('0x48')]);return _0x5afb10[_0x0d34('0x62')](_0x5a756f);}})[_0x0d34('0x2a')](function(_0x5cb46b){if(_0x5cb46b){_0x2278c1=_0x5cb46b[_0x0d34('0x38')];if(!_0x8def[_0x0d34('0x35')][_0x0d34('0x39')](_0x0d34('0x57'))){_0x5a756f['limit']=qs[_0x0d34('0x23')](_0x8def[_0x0d34('0x35')][_0x0d34('0x23')]);_0x5a756f[_0x0d34('0x20')]=qs[_0x0d34('0x20')](_0x8def[_0x0d34('0x35')][_0x0d34('0x20')]);}return _0x5afb10[_0x0d34('0x62')](_0x5a756f);}})[_0x0d34('0x2a')](function(_0x3dcad3){if(_0x3dcad3){return _0x3dcad3?{'count':_0x2278c1,'rows':_0x3dcad3}:null;}})[_0x0d34('0x2a')](respondWithResult(_0x2a54be,null))[_0x0d34('0x45')](handleError(_0x2a54be,null));};exports['addTeams']=function(_0x4d54e1,_0x218f10,_0x3a9285){var _0x3d4267=_0x4d54e1['body']['ids'];return db['Team']['findAll']({'where':{'id':_0x3d4267},'attributes':['id'],'include':[{'model':db[_0x0d34('0x5a')],'as':_0x0d34('0x65'),'attributes':['id',_0x0d34('0x2d'),'online',_0x0d34('0x66'),_0x0d34('0x67')],'raw':!![]}]})[_0x0d34('0x2a')](function(_0x1cc663){if(_0x1cc663){var _0x1b80ac=_[_0x0d34('0x68')](_0x1cc663,function(_0x3549a7){var _0x4350f2=_0x3549a7[_0x0d34('0x4c')]({'plain':!![]});return _0x4350f2[_0x0d34('0x65')];});return db[_0x0d34('0x40')][_0x0d34('0x49')]({'where':{'id':_0x4d54e1[_0x0d34('0x54')]['id']}})[_0x0d34('0x2a')](function(_0x37250e){return db[_0x0d34('0x69')][_0x0d34('0x6a')](function(_0x57f0c0){return _0x37250e[_0x0d34('0x6b')](_0x3d4267,{'transaction':_0x57f0c0})[_0x0d34('0x2a')](function(){return BPromise[_0x0d34('0x6c')](_0x1b80ac,function(_0x4a0429){return db[_0x0d34('0x59')]['findOrCreate']({'where':{'UserId':_0x4a0429['id'],'OpenchannelQueueId':_0x4d54e1[_0x0d34('0x54')]['id']},'transaction':_0x57f0c0});});})['then'](function(){_0x1b80ac[_0x0d34('0x6d')](function(_0x320a0b){socket['emit'](_0x0d34('0x6e'),{'UserId':_0x320a0b['id'],'OpenchannelQueueId':_0x37250e['id']});});});});});}})[_0x0d34('0x2a')](respondWithStatusCode(_0x218f10,null))[_0x0d34('0x45')](handleError(_0x218f10,null));};exports[_0x0d34('0x6f')]=function(_0x3dc31f,_0x38910c,_0x4b1325){return db[_0x0d34('0x64')][_0x0d34('0x43')]({'where':{'id':_0x3dc31f[_0x0d34('0x35')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0d34('0x65'),'attributes':['id'],'raw':!![]}]})[_0x0d34('0x2a')](handleEntityNotFound(_0x38910c,null))[_0x0d34('0x2a')](function(_0x34df47){var _0x25d608=_[_0x0d34('0x2f')](_0x34df47,'id');var _0x5da49f=[];var _0x2b23ab=[];var _0x5de617=squel[_0x0d34('0x70')]();_0x5de617[_0x0d34('0x71')]('tq.TeamId')['from'](_0x0d34('0x72'),'tq')[_0x0d34('0x73')](_0x0d34('0x74'),'ut',_0x0d34('0x75'))[_0x0d34('0x3d')](_0x0d34('0x76'),_0x3dc31f[_0x0d34('0x54')]['id']);for(var _0x25f095=0x0;_0x25f095<_0x34df47['length'];_0x25f095+=0x1){let _0x41130c=_0x34df47[_0x25f095];for(var _0x4f2ffc=0x0;_0x4f2ffc<_0x41130c[_0x0d34('0x65')]['length'];_0x4f2ffc+=0x1){let _0x233dba=_0x41130c[_0x0d34('0x65')][_0x4f2ffc];var _0x215655=_0x5de617['clone']();_0x215655[_0x0d34('0x3d')](_0x0d34('0x77'),_0x233dba['id']);_0x2b23ab[_0x0d34('0x78')](db[_0x0d34('0x69')][_0x0d34('0x35')](_0x215655['toString'](),{'type':db['sequelize'][_0x0d34('0x79')]['SELECT']})[_0x0d34('0x2a')](function(_0x5f4cdc){if(_0x5f4cdc['length']===0x1){return _0x233dba['id'];}else{var _0x3d8c46=_[_0x0d34('0x7a')](_[_0x0d34('0x2f')](_0x5f4cdc,_0x0d34('0x7b')),function(_0x1c012d){return _['includes'](_0x25d608,_0x1c012d);});if(_0x3d8c46){return _0x233dba['id'];}}}));}}return BPromise['all'](_0x2b23ab)[_0x0d34('0x2a')](function(_0x125040){_0x5da49f=_(_0x5da49f)['union'](_0x125040)[_0x0d34('0x7c')]()[_0x0d34('0x7d')]();return db[_0x0d34('0x40')][_0x0d34('0x49')]({'where':{'id':_0x3dc31f[_0x0d34('0x54')]['id']}})[_0x0d34('0x2a')](function(_0x25216d){return db['sequelize'][_0x0d34('0x6a')](function(_0x5007f3){return _0x25216d[_0x0d34('0x6f')](_0x3dc31f['query'][_0x0d34('0x7e')],{'transaction':_0x5007f3})['then'](function(){if(!_[_0x0d34('0x7f')](_0x5da49f)){return _0x25216d[_0x0d34('0x80')](_0x5da49f,{'transaction':_0x5007f3});}})['then'](function(){_0x5da49f[_0x0d34('0x6d')](function(_0x5a5da8){socket['emit'](_0x0d34('0x81'),{'UserId':_0x5a5da8,'OpenchannelQueueId':_0x25216d['id']});});});});});});})[_0x0d34('0x2a')](respondWithStatusCode(_0x38910c,null))[_0x0d34('0x45')](handleError(_0x38910c,null));};exports['addAgents']=function(_0x162dbc,_0x2a7051,_0x4e5e2e){return db[_0x0d34('0x40')][_0x0d34('0x49')]({'where':{'id':_0x162dbc[_0x0d34('0x54')]['id']}})['then'](handleEntityNotFound(_0x2a7051,null))['then'](function(_0x31cf3e){if(_0x31cf3e){return _0x31cf3e[_0x0d34('0x82')](_0x162dbc[_0x0d34('0x4b')][_0x0d34('0x7e')],_[_0x0d34('0x83')](_0x162dbc[_0x0d34('0x4b')],[_0x0d34('0x7e'),'id'])||{})[_0x0d34('0x84')](function(_0x157538){for(var _0x3d91a4=0x0;_0x3d91a4<_0x162dbc['body']['ids'][_0x0d34('0x38')];_0x3d91a4+=0x1){socket[_0x0d34('0x85')](_0x0d34('0x6e'),{'UserId':Number(_0x162dbc[_0x0d34('0x4b')][_0x0d34('0x7e')][_0x3d91a4]),'OpenchannelQueueId':Number(_0x162dbc[_0x0d34('0x54')]['id'])});}return _0x157538;});}})[_0x0d34('0x2a')](respondWithResult(_0x2a7051,null))[_0x0d34('0x45')](handleError(_0x2a7051,null));};exports['removeAgents']=function(_0xf5781f,_0x5a1a25,_0x43d35b){return db[_0x0d34('0x40')][_0x0d34('0x49')]({'where':{'id':_0xf5781f[_0x0d34('0x54')]['id']}})['then'](handleEntityNotFound(_0x5a1a25,null))[_0x0d34('0x2a')](function(_0x48070c){if(_0x48070c){return _0x48070c[_0x0d34('0x80')](_0xf5781f[_0x0d34('0x35')][_0x0d34('0x7e')])['then'](function(){if(_[_0x0d34('0x86')](_0xf5781f[_0x0d34('0x35')][_0x0d34('0x7e')])){for(var _0x564ab1=0x0;_0x564ab1<_0xf5781f[_0x0d34('0x35')][_0x0d34('0x7e')][_0x0d34('0x38')];_0x564ab1+=0x1){socket['emit'](_0x0d34('0x81'),{'UserId':Number(_0xf5781f['query'][_0x0d34('0x7e')][_0x564ab1]),'OpenchannelQueueId':Number(_0xf5781f[_0x0d34('0x54')]['id'])});}}else{socket[_0x0d34('0x85')]('userOpenchannelQueue:remove',{'UserId':Number(_0xf5781f[_0x0d34('0x35')][_0x0d34('0x7e')]),'OpenchannelQueueId':Number(_0xf5781f[_0x0d34('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x5a1a25,null))[_0x0d34('0x45')](handleError(_0x5a1a25,null));};exports[_0x0d34('0x87')]=function(_0x2f981c,_0x49f484,_0x4c3d60){var _0xa8b3d5={};var _0x59ff43={};var _0x23d919;var _0x44d848;return db['OpenchannelQueue'][_0x0d34('0x63')]({'where':{'id':_0x2f981c[_0x0d34('0x54')]['id']}})[_0x0d34('0x2a')](handleEntityNotFound(_0x49f484,null))[_0x0d34('0x2a')](function(_0x40cb75){if(_0x40cb75){_0x23d919=_0x40cb75;_0x59ff43['model']=_[_0x0d34('0x46')](db[_0x0d34('0x5a')][_0x0d34('0x47')]);_0x59ff43[_0x0d34('0x35')]=_['keys'](_0x2f981c[_0x0d34('0x35')]);_0x59ff43[_0x0d34('0x32')]=_[_0x0d34('0x33')](_0x59ff43[_0x0d34('0x34')],_0x59ff43[_0x0d34('0x35')]);_0xa8b3d5[_0x0d34('0x36')]=_[_0x0d34('0x33')](_0x59ff43[_0x0d34('0x34')],qs[_0x0d34('0x37')](_0x2f981c[_0x0d34('0x35')][_0x0d34('0x37')]));_0xa8b3d5['attributes']=_0xa8b3d5[_0x0d34('0x36')]['length']?_0xa8b3d5[_0x0d34('0x36')]:_0x59ff43[_0x0d34('0x34')];_0xa8b3d5[_0x0d34('0x3a')]=qs[_0x0d34('0x58')](_0x2f981c[_0x0d34('0x35')][_0x0d34('0x58')]);_0xa8b3d5['where']=qs['filters'](_[_0x0d34('0x3b')](_0x2f981c[_0x0d34('0x35')],_0x59ff43[_0x0d34('0x32')]));if(_0x2f981c[_0x0d34('0x35')][_0x0d34('0x3c')]){_0xa8b3d5['where']=_[_0x0d34('0x3e')](_0xa8b3d5[_0x0d34('0x3d')],{'$or':_[_0x0d34('0x2f')](_0xa8b3d5[_0x0d34('0x36')],function(_0x27b850){var _0x48dede={};_0x48dede[_0x27b850]={'$like':'%'+_0x2f981c[_0x0d34('0x35')][_0x0d34('0x3c')]+'%'};return _0x48dede;})});}_0xa8b3d5=_['merge']({},_0xa8b3d5,_0x2f981c['options']);return _0x23d919[_0x0d34('0x87')](_0xa8b3d5);}})[_0x0d34('0x2a')](function(_0x197222){if(_0x197222){_0x44d848=_0x197222[_0x0d34('0x38')];if(!_0x2f981c[_0x0d34('0x35')][_0x0d34('0x39')]('nolimit')){_0xa8b3d5[_0x0d34('0x23')]=qs[_0x0d34('0x23')](_0x2f981c[_0x0d34('0x35')]['limit']);_0xa8b3d5[_0x0d34('0x20')]=qs[_0x0d34('0x20')](_0x2f981c[_0x0d34('0x35')][_0x0d34('0x20')]);}return _0x23d919[_0x0d34('0x87')](_0xa8b3d5);}})[_0x0d34('0x2a')](function(_0x33df27){if(_0x33df27){return _0x33df27?{'count':_0x44d848,'rows':_0x33df27}:null;}})[_0x0d34('0x2a')](respondWithResult(_0x49f484,null))[_0x0d34('0x45')](handleError(_0x49f484,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index dfbf9c4..e0707b0 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 _0x544a=['events','../../mysqldb','OpenchannelQueue','update','remove','emit','hasOwnProperty','hook'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x544a,0x118));var _0xa544=function(_0x22153b,_0x4528ec){_0x22153b=_0x22153b-0x0;var _0x217dae=_0x544a[_0x22153b];return _0x217dae;};'use strict';var EventEmitter=require(_0xa544('0x0'));var OpenchannelQueue=require(_0xa544('0x1'))['db'][_0xa544('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa544('0x3'),'afterDestroy':_0xa544('0x4')};function emitEvent(_0x1e1980){return function(_0xf2d6a0,_0x4b4677,_0x4cfd38){OpenchannelQueueEvents['emit'](_0x1e1980+':'+_0xf2d6a0['id'],_0xf2d6a0);OpenchannelQueueEvents[_0xa544('0x5')](_0x1e1980,_0xf2d6a0);_0x4cfd38(null);};}for(var e in events){if(events[_0xa544('0x6')](e)){var event=events[e];OpenchannelQueue[_0xa544('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x2573=['exports','OpenchannelQueue','save','emit','hook'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x2573,0x12d));var _0x3257=function(_0x590304,_0xe231e1){_0x590304=_0x590304-0x0;var _0x3ddff7=_0x2573[_0x590304];return _0x3ddff7;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0x3257('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3257('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x51d4e0){return function(_0x4e6945,_0x5831ed,_0x369b81){OpenchannelQueueEvents['emit'](_0x51d4e0+':'+_0x4e6945['id'],_0x4e6945);OpenchannelQueueEvents[_0x3257('0x2')](_0x51d4e0,_0x4e6945);_0x369b81(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x3257('0x3')](e,emitEvent(event));}}module[_0x3257('0x4')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index c46570e..0024d6f 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 _0x19ff=['path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19ff,0x11b));var _0xf19f=function(_0x15d098,_0xde1fe4){_0x15d098=_0x15d098-0x0;var _0x21abef=_0x19ff[_0x15d098];return _0x21abef;};'use strict';var _=require(_0xf19f('0x0'));var util=require(_0xf19f('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf19f('0x2'));var fs=require('fs');var path=require(_0xf19f('0x3'));var rimraf=require(_0xf19f('0x4'));var config=require(_0xf19f('0x5'));var attributes=require(_0xf19f('0x6'));module[_0xf19f('0x7')]=function(_0x82604a,_0x5bda8a){return _0x82604a[_0xf19f('0x8')](_0xf19f('0x9'),attributes,{'tableName':_0xf19f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd3e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue'];(function(_0x3b0934,_0x3a7f20){var _0x3983a2=function(_0x17a4ec){while(--_0x17a4ec){_0x3b0934['push'](_0x3b0934['shift']());}};_0x3983a2(++_0x3a7f20);}(_0xcd3e,0x79));var _0xecd3=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0xcd3e[_0x164af1];return _0x5d81a2;};'use strict';var _=require('lodash');var util=require(_0xecd3('0x0'));var logger=require(_0xecd3('0x1'))(_0xecd3('0x2'));var moment=require(_0xecd3('0x3'));var BPromise=require(_0xecd3('0x4'));var rp=require(_0xecd3('0x5'));var fs=require('fs');var path=require(_0xecd3('0x6'));var rimraf=require(_0xecd3('0x7'));var config=require(_0xecd3('0x8'));var attributes=require(_0xecd3('0x9'));module['exports']=function(_0x4c3502,_0x474935){return _0x4c3502['define'](_0xecd3('0xa'),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 601d94c..525d97a 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 _0x6256=['map','model','then','catch','ShowOpenchannelQueue','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','./openchannelQueue.socket','request','info','OpenchannelQueue,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x5df23e,_0x4e408b){var _0xe66fd2=function(_0x2fe9a4){while(--_0x2fe9a4){_0x5df23e['push'](_0x5df23e['shift']());}};_0xe66fd2(++_0x4e408b);}(_0x6256,0x1a8));var _0x6625=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6256[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6625('0x0'));var util=require(_0x6625('0x1'));var moment=require(_0x6625('0x2'));var BPromise=require(_0x6625('0x3'));var rs=require(_0x6625('0x4'));var fs=require('fs');var Redis=require(_0x6625('0x5'));var db=require(_0x6625('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6625('0x7'))('rpc');var config=require(_0x6625('0x8'));var jayson=require(_0x6625('0x9'));var client=jayson[_0x6625('0xa')][_0x6625('0xb')]({'port':0x232a});config['redis']=_[_0x6625('0xc')](config[_0x6625('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6625('0xd')]));require(_0x6625('0xe'))['register'](socket);function respondWithRpcPromise(_0x40af6b,_0x4634e1,_0x69660d){return new BPromise(function(_0x118e33,_0x530f77){return client[_0x6625('0xf')](_0x40af6b,_0x69660d)['then'](function(_0x1b9ebb){logger[_0x6625('0x10')](_0x6625('0x11'),_0x4634e1,'request\x20sent');logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4634e1,'request\x20sent',JSON[_0x6625('0x12')](_0x1b9ebb));if(_0x1b9ebb[_0x6625('0x13')]){if(_0x1b9ebb[_0x6625('0x13')][_0x6625('0x14')]===0x1f4){logger[_0x6625('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x4634e1,_0x1b9ebb[_0x6625('0x13')][_0x6625('0x15')]);return _0x530f77(_0x1b9ebb[_0x6625('0x13')][_0x6625('0x15')]);}logger['error'](_0x6625('0x11'),_0x4634e1,_0x1b9ebb[_0x6625('0x13')]['message']);return _0x118e33(_0x1b9ebb['error'][_0x6625('0x15')]);}else{logger[_0x6625('0x10')](_0x6625('0x11'),_0x4634e1,_0x6625('0x16'));_0x118e33(_0x1b9ebb['result'][_0x6625('0x15')]);}})['catch'](function(_0x4e7dcc){logger[_0x6625('0x13')](_0x6625('0x11'),_0x4634e1,_0x4e7dcc);_0x530f77(_0x4e7dcc);});});}exports[_0x6625('0x17')]=function(_0x51cd32){var _0x1b62d7=this;return new Promise(function(_0x39e737,_0x3db32d){return db[_0x6625('0x18')][_0x6625('0x19')]({'raw':_0x51cd32[_0x6625('0x1a')]?_0x51cd32[_0x6625('0x1a')][_0x6625('0x1b')]===undefined?!![]:![]:!![],'where':_0x51cd32[_0x6625('0x1a')]?_0x51cd32[_0x6625('0x1a')][_0x6625('0x1c')]||null:null,'attributes':_0x51cd32[_0x6625('0x1a')]?_0x51cd32[_0x6625('0x1a')][_0x6625('0x1d')]||null:null,'limit':_0x51cd32[_0x6625('0x1a')]?_0x51cd32[_0x6625('0x1a')][_0x6625('0x1e')]||null:null,'include':_0x51cd32[_0x6625('0x1a')]?_0x51cd32[_0x6625('0x1a')][_0x6625('0x1f')]?_[_0x6625('0x20')](_0x51cd32['options'][_0x6625('0x1f')],function(_0x4e3410){return{'model':db[_0x4e3410['model']],'as':_0x4e3410['as'],'attributes':_0x4e3410['attributes'],'include':_0x4e3410[_0x6625('0x1f')]?_[_0x6625('0x20')](_0x4e3410[_0x6625('0x1f')],function(_0x2c59d7){return{'model':db[_0x2c59d7[_0x6625('0x21')]],'as':_0x2c59d7['as'],'attributes':_0x2c59d7[_0x6625('0x1d')],'include':_0x2c59d7[_0x6625('0x1f')]?_[_0x6625('0x20')](_0x2c59d7[_0x6625('0x1f')],function(_0xaf5393){return{'model':db[_0xaf5393[_0x6625('0x21')]],'as':_0xaf5393['as'],'attributes':_0xaf5393[_0x6625('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6625('0x22')](function(_0x1db4f1){logger[_0x6625('0x10')](_0x6625('0x17'),_0x51cd32);logger['debug'](_0x6625('0x17'),_0x51cd32,JSON[_0x6625('0x12')](_0x1db4f1));_0x39e737(_0x1db4f1);})[_0x6625('0x23')](function(_0x6a31ad){logger['error'](_0x6625('0x17'),_0x6a31ad['message'],_0x51cd32);_0x3db32d(_0x1b62d7[_0x6625('0x13')](0x1f4,_0x6a31ad['message']));});});};exports[_0x6625('0x24')]=function(_0x276a4f){var _0x211f3c=this;return new Promise(function(_0x4a1189,_0x1dcff8){return db[_0x6625('0x18')]['find']({'raw':_0x276a4f['options']?_0x276a4f['options']['raw']===undefined?!![]:![]:!![],'where':_0x276a4f[_0x6625('0x1a')]?_0x276a4f[_0x6625('0x1a')][_0x6625('0x1c')]||null:null,'attributes':_0x276a4f[_0x6625('0x1a')]?_0x276a4f[_0x6625('0x1a')][_0x6625('0x1d')]||null:null,'include':_0x276a4f[_0x6625('0x1a')]?_0x276a4f[_0x6625('0x1a')][_0x6625('0x1f')]?_[_0x6625('0x20')](_0x276a4f['options'][_0x6625('0x1f')],function(_0x55a496){return{'model':db[_0x55a496[_0x6625('0x21')]],'as':_0x55a496['as'],'attributes':_0x55a496['attributes'],'include':_0x55a496[_0x6625('0x1f')]?_[_0x6625('0x20')](_0x55a496[_0x6625('0x1f')],function(_0x332cf5){return{'model':db[_0x332cf5['model']],'as':_0x332cf5['as'],'attributes':_0x332cf5['attributes'],'include':_0x332cf5[_0x6625('0x1f')]?_['map'](_0x332cf5[_0x6625('0x1f')],function(_0x35686e){return{'model':db[_0x35686e['model']],'as':_0x35686e['as'],'attributes':_0x35686e['attributes']};}):[]};}):[]};}):[]:[]})[_0x6625('0x22')](function(_0x4f71eb){logger[_0x6625('0x10')]('ShowOpenchannelQueue',_0x276a4f);logger[_0x6625('0x25')](_0x6625('0x24'),_0x276a4f,JSON['stringify'](_0x4f71eb));_0x4a1189(_0x4f71eb);})['catch'](function(_0x47d415){logger[_0x6625('0x13')](_0x6625('0x24'),_0x47d415[_0x6625('0x15')],_0x276a4f);_0x1dcff8(_0x211f3c[_0x6625('0x13')](0x1f4,_0x47d415[_0x6625('0x15')]));});});}; \ No newline at end of file +var _0x88bf=['localhost','socket.io-emitter','register','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','options','where','attributes','include','map','model','ShowOpenchannelQueue','raw','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x31ef20,_0x481d55){var _0xf2d20b=function(_0x457381){while(--_0x457381){_0x31ef20['push'](_0x31ef20['shift']());}};_0xf2d20b(++_0x481d55);}(_0x88bf,0x1bb));var _0xf88b=function(_0x167b19,_0x56081a){_0x167b19=_0x167b19-0x0;var _0x1fcca2=_0x88bf[_0x167b19];return _0x1fcca2;};'use strict';var _=require(_0xf88b('0x0'));var util=require(_0xf88b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf88b('0x2'));var db=require(_0xf88b('0x3'))['db'];var utils=require(_0xf88b('0x4'));var logger=require(_0xf88b('0x5'))(_0xf88b('0x6'));var config=require(_0xf88b('0x7'));var jayson=require(_0xf88b('0x8'));var client=jayson[_0xf88b('0x9')][_0xf88b('0xa')]({'port':0x232a});config['redis']=_[_0xf88b('0xb')](config[_0xf88b('0xc')],{'host':_0xf88b('0xd'),'port':0x18eb});var socket=require(_0xf88b('0xe'))(new Redis(config[_0xf88b('0xc')]));require('./openchannelQueue.socket')[_0xf88b('0xf')](socket);function respondWithRpcPromise(_0x50ffc3,_0x45a0af,_0x3668f9){return new BPromise(function(_0x3e2c0f,_0x5ed9ba){return client['request'](_0x50ffc3,_0x3668f9)[_0xf88b('0x10')](function(_0x48182d){logger[_0xf88b('0x11')](_0xf88b('0x12'),_0x45a0af,_0xf88b('0x13'));logger[_0xf88b('0x14')](_0xf88b('0x15'),_0x45a0af,_0xf88b('0x13'),JSON[_0xf88b('0x16')](_0x48182d));if(_0x48182d[_0xf88b('0x17')]){if(_0x48182d[_0xf88b('0x17')][_0xf88b('0x18')]===0x1f4){logger[_0xf88b('0x17')](_0xf88b('0x12'),_0x45a0af,_0x48182d['error'][_0xf88b('0x19')]);return _0x5ed9ba(_0x48182d[_0xf88b('0x17')][_0xf88b('0x19')]);}logger[_0xf88b('0x17')](_0xf88b('0x12'),_0x45a0af,_0x48182d[_0xf88b('0x17')]['message']);return _0x3e2c0f(_0x48182d[_0xf88b('0x17')][_0xf88b('0x19')]);}else{logger[_0xf88b('0x11')](_0xf88b('0x12'),_0x45a0af,'request\x20sent');_0x3e2c0f(_0x48182d[_0xf88b('0x1a')][_0xf88b('0x19')]);}})[_0xf88b('0x1b')](function(_0x4e38d3){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x45a0af,_0x4e38d3);_0x5ed9ba(_0x4e38d3);});});}exports[_0xf88b('0x1c')]=function(_0x2652d1){var _0x19e6ad=this;return new Promise(function(_0x5d2a86,_0x318b91){return db[_0xf88b('0x1d')]['findAll']({'raw':_0x2652d1[_0xf88b('0x1e')]?_0x2652d1[_0xf88b('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2652d1[_0xf88b('0x1e')]?_0x2652d1[_0xf88b('0x1e')][_0xf88b('0x1f')]||null:null,'attributes':_0x2652d1[_0xf88b('0x1e')]?_0x2652d1[_0xf88b('0x1e')][_0xf88b('0x20')]||null:null,'limit':_0x2652d1['options']?_0x2652d1[_0xf88b('0x1e')]['limit']||null:null,'include':_0x2652d1['options']?_0x2652d1[_0xf88b('0x1e')][_0xf88b('0x21')]?_['map'](_0x2652d1[_0xf88b('0x1e')]['include'],function(_0x5a0031){return{'model':db[_0x5a0031['model']],'as':_0x5a0031['as'],'attributes':_0x5a0031[_0xf88b('0x20')],'include':_0x5a0031[_0xf88b('0x21')]?_[_0xf88b('0x22')](_0x5a0031['include'],function(_0x36b344){return{'model':db[_0x36b344[_0xf88b('0x23')]],'as':_0x36b344['as'],'attributes':_0x36b344[_0xf88b('0x20')],'include':_0x36b344[_0xf88b('0x21')]?_[_0xf88b('0x22')](_0x36b344['include'],function(_0x2b2f15){return{'model':db[_0x2b2f15[_0xf88b('0x23')]],'as':_0x2b2f15['as'],'attributes':_0x2b2f15[_0xf88b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5045b6){logger['info'](_0xf88b('0x1c'),_0x2652d1);logger['debug']('GetOpenchannelQueue',_0x2652d1,JSON['stringify'](_0x5045b6));_0x5d2a86(_0x5045b6);})[_0xf88b('0x1b')](function(_0x3b5998){logger[_0xf88b('0x17')](_0xf88b('0x1c'),_0x3b5998[_0xf88b('0x19')],_0x2652d1);_0x318b91(_0x19e6ad[_0xf88b('0x17')](0x1f4,_0x3b5998[_0xf88b('0x19')]));});});};exports[_0xf88b('0x24')]=function(_0x164ddd){var _0xce115f=this;return new Promise(function(_0x9c8380,_0x2b69e8){return db['OpenchannelQueue']['find']({'raw':_0x164ddd['options']?_0x164ddd['options'][_0xf88b('0x25')]===undefined?!![]:![]:!![],'where':_0x164ddd[_0xf88b('0x1e')]?_0x164ddd[_0xf88b('0x1e')]['where']||null:null,'attributes':_0x164ddd[_0xf88b('0x1e')]?_0x164ddd[_0xf88b('0x1e')][_0xf88b('0x20')]||null:null,'include':_0x164ddd[_0xf88b('0x1e')]?_0x164ddd['options'][_0xf88b('0x21')]?_[_0xf88b('0x22')](_0x164ddd[_0xf88b('0x1e')][_0xf88b('0x21')],function(_0x37a12b){return{'model':db[_0x37a12b[_0xf88b('0x23')]],'as':_0x37a12b['as'],'attributes':_0x37a12b['attributes'],'include':_0x37a12b['include']?_[_0xf88b('0x22')](_0x37a12b[_0xf88b('0x21')],function(_0x4a2414){return{'model':db[_0x4a2414[_0xf88b('0x23')]],'as':_0x4a2414['as'],'attributes':_0x4a2414[_0xf88b('0x20')],'include':_0x4a2414[_0xf88b('0x21')]?_[_0xf88b('0x22')](_0x4a2414[_0xf88b('0x21')],function(_0x3cffd8){return{'model':db[_0x3cffd8[_0xf88b('0x23')]],'as':_0x3cffd8['as'],'attributes':_0x3cffd8['attributes']};}):[]};}):[]};}):[]:[]})[_0xf88b('0x10')](function(_0x1accb0){logger[_0xf88b('0x11')](_0xf88b('0x24'),_0x164ddd);logger[_0xf88b('0x14')](_0xf88b('0x24'),_0x164ddd,JSON['stringify'](_0x1accb0));_0x9c8380(_0x1accb0);})[_0xf88b('0x1b')](function(_0x4b0f0d){logger[_0xf88b('0x17')](_0xf88b('0x24'),_0x4b0f0d[_0xf88b('0x19')],_0x164ddd);_0x2b69e8(_0xce115f[_0xf88b('0x17')](0x1f4,_0x4b0f0d[_0xf88b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 0bd3c15..2803de7 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 _0x59b0=['removeListener','register','length','openchannelQueue:','save','update','emit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x59b0,0x12a));var _0x059b=function(_0x59ee91,_0x5ca1ef){_0x59ee91=_0x59ee91-0x0;var _0x51b0b7=_0x59b0[_0x59ee91];return _0x51b0b7;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x059b('0x0'),'remove',_0x059b('0x1')];function createListener(_0x381a5c,_0x1e50e2){return function(_0x56aec2){_0x1e50e2[_0x059b('0x2')](_0x381a5c,_0x56aec2);};}function removeListener(_0x4a9a94,_0x324080){return function(){OpenchannelQueueEvents[_0x059b('0x3')](_0x4a9a94,_0x324080);};}exports[_0x059b('0x4')]=function(_0x347b9e){for(var _0x132497=0x0,_0x124856=events[_0x059b('0x5')];_0x132497<_0x124856;_0x132497++){var _0x4ad41e=events[_0x132497];var _0x402464=createListener(_0x059b('0x6')+_0x4ad41e,_0x347b9e);OpenchannelQueueEvents['on'](_0x4ad41e,_0x402464);}}; \ No newline at end of file +var _0xb6a2=['save','update','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x45f8c5,_0x2bf79b){var _0x3e6f1d=function(_0x4bcd20){while(--_0x4bcd20){_0x45f8c5['push'](_0x45f8c5['shift']());}};_0x3e6f1d(++_0x2bf79b);}(_0xb6a2,0x15b));var _0x2b6a=function(_0x1680b9,_0x43e003){_0x1680b9=_0x1680b9-0x0;var _0x4dbee8=_0xb6a2[_0x1680b9];return _0x4dbee8;};'use strict';var OpenchannelQueueEvents=require(_0x2b6a('0x0'));var events=[_0x2b6a('0x1'),'remove',_0x2b6a('0x2')];function createListener(_0x3427e6,_0x264d00){return function(_0x282007){_0x264d00['emit'](_0x3427e6,_0x282007);};}function removeListener(_0x52fbb5,_0xf4a2f2){return function(){OpenchannelQueueEvents['removeListener'](_0x52fbb5,_0xf4a2f2);};}exports[_0x2b6a('0x3')]=function(_0x17e1ba){for(var _0x25f838=0x0,_0x2a2b68=events[_0x2b6a('0x4')];_0x25f838<_0x2a2b68;_0x25f838++){var _0x516ca1=events[_0x25f838];var _0x4fd623=createListener(_0x2b6a('0x5')+_0x516ca1,_0x17e1ba);OpenchannelQueueEvents['on'](_0x516ca1,_0x4fd623);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index a73807a..92f09e7 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 _0x4dbd=['/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','/describe','describe'];(function(_0x10bcc4,_0x1b5ddc){var _0x5018cf=function(_0x405bcd){while(--_0x405bcd){_0x10bcc4['push'](_0x10bcc4['shift']());}};_0x5018cf(++_0x1b5ddc);}(_0x4dbd,0x8d));var _0xd4db=function(_0x5548a3,_0x3766d6){_0x5548a3=_0x5548a3-0x0;var _0x4a6ebb=_0x4dbd[_0x5548a3];return _0x4a6ebb;};'use strict';var multer=require('multer');var util=require(_0xd4db('0x0'));var path=require('path');var timeout=require(_0xd4db('0x1'));var express=require(_0xd4db('0x2'));var router=express[_0xd4db('0x3')]();var fs_extra=require(_0xd4db('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd4db('0x5'));var controller=require(_0xd4db('0x6'));router['get']('/',auth[_0xd4db('0x7')](),controller[_0xd4db('0x8')]);router['get'](_0xd4db('0x9'),auth[_0xd4db('0x7')](),controller[_0xd4db('0xa')]);router['get'](_0xd4db('0xb'),auth[_0xd4db('0x7')](),controller[_0xd4db('0xc')]);router[_0xd4db('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd4db('0xe')](_0xd4db('0xb'),auth[_0xd4db('0x7')](),controller[_0xd4db('0xf')]);router[_0xd4db('0x10')](_0xd4db('0xb'),auth[_0xd4db('0x7')](),controller[_0xd4db('0x11')]);module[_0xd4db('0x12')]=router; \ No newline at end of file +var _0x7ea5=['index','/describe','describe','/:id','post','create','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x7ea5,0xbc));var _0x57ea=function(_0x31374a,_0x49d262){_0x31374a=_0x31374a-0x0;var _0x2f47f5=_0x7ea5[_0x31374a];return _0x2f47f5;};'use strict';var multer=require(_0x57ea('0x0'));var util=require(_0x57ea('0x1'));var path=require(_0x57ea('0x2'));var timeout=require(_0x57ea('0x3'));var express=require(_0x57ea('0x4'));var router=express[_0x57ea('0x5')]();var fs_extra=require(_0x57ea('0x6'));var auth=require(_0x57ea('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x57ea('0x8'));var controller=require(_0x57ea('0x9'));router[_0x57ea('0xa')]('/',auth[_0x57ea('0xb')](),controller[_0x57ea('0xc')]);router[_0x57ea('0xa')](_0x57ea('0xd'),auth[_0x57ea('0xb')](),controller[_0x57ea('0xe')]);router[_0x57ea('0xa')](_0x57ea('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x57ea('0x10')]('/',auth[_0x57ea('0xb')](),controller[_0x57ea('0x11')]);router['put'](_0x57ea('0xf'),auth[_0x57ea('0xb')](),controller[_0x57ea('0x12')]);router['delete'](_0x57ea('0xf'),auth['isAuthenticated'](),controller[_0x57ea('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index ad048bc..cdaff29 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 _0xb353=['DATE','moment','sequelize','exports','STRING'];(function(_0x254d9f,_0x54ddb5){var _0x1eedb9=function(_0x2d05f1){while(--_0x2d05f1){_0x254d9f['push'](_0x254d9f['shift']());}};_0x1eedb9(++_0x54ddb5);}(_0xb353,0xdd));var _0x3b35=function(_0x3003e8,_0x552a3b){_0x3003e8=_0x3003e8-0x0;var _0x5b5ea4=_0xb353[_0x3003e8];return _0x5b5ea4;};'use strict';var moment=require(_0x3b35('0x0'));var Sequelize=require(_0x3b35('0x1'));module[_0x3b35('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3b35('0x3')]},'joinAt':{'type':Sequelize[_0x3b35('0x4')]},'leaveAt':{'type':Sequelize[_0x3b35('0x4')]},'acceptAt':{'type':Sequelize[_0x3b35('0x4')]},'exitAt':{'type':Sequelize[_0x3b35('0x4')]},'reason':{'type':Sequelize[_0x3b35('0x3')]}}; \ No newline at end of file +var _0x5423=['moment','exports','STRING','DATE'];(function(_0x54a392,_0x203e11){var _0x4f1c32=function(_0x3b4bd3){while(--_0x3b4bd3){_0x54a392['push'](_0x54a392['shift']());}};_0x4f1c32(++_0x203e11);}(_0x5423,0x19c));var _0x3542=function(_0x361482,_0x3bede1){_0x361482=_0x361482-0x0;var _0x15b123=_0x5423[_0x361482];return _0x15b123;};'use strict';var moment=require(_0x3542('0x0'));var Sequelize=require('sequelize');module[_0x3542('0x1')]={'uniqueid':{'type':Sequelize[_0x3542('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3542('0x2')]},'joinAt':{'type':Sequelize[_0x3542('0x3')]},'leaveAt':{'type':Sequelize[_0x3542('0x3')]},'acceptAt':{'type':Sequelize[_0x3542('0x3')]},'exitAt':{'type':Sequelize[_0x3542('0x3')]},'reason':{'type':Sequelize[_0x3542('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 6e71422..1fc4240 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 _0x2d47=['bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','includeAll','findAll','rows','show','params','include','create','catch','body','find','describe','request-promise','moment'];(function(_0x5519e0,_0xec8f68){var _0x14dfb2=function(_0x46b753){while(--_0x46b753){_0x5519e0['push'](_0x5519e0['shift']());}};_0x14dfb2(++_0xec8f68);}(_0x2d47,0xdc));var _0x72d4=function(_0x27ebb9,_0x32661f){_0x27ebb9=_0x27ebb9-0x0;var _0x127afe=_0x2d47[_0x27ebb9];return _0x127afe;};'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(_0x72d4('0x0'));var moment=require(_0x72d4('0x1'));var BPromise=require(_0x72d4('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x72d4('0x3'));var sox=require(_0x72d4('0x4'));var csv=require(_0x72d4('0x5'));var ejs=require(_0x72d4('0x6'));var fs=require('fs');var fs_extra=require(_0x72d4('0x7'));var _=require(_0x72d4('0x8'));var squel=require('squel');var crypto=require(_0x72d4('0x9'));var jsforce=require(_0x72d4('0xa'));var deskjs=require(_0x72d4('0xb'));var toCsv=require(_0x72d4('0x5'));var querystring=require(_0x72d4('0xc'));var Papa=require(_0x72d4('0xd'));var Redis=require('ioredis');var authService=require(_0x72d4('0xe'));var qs=require(_0x72d4('0xf'));var as=require(_0x72d4('0x10'));var hardwareService=require(_0x72d4('0x11'));var logger=require('../../config/logger')(_0x72d4('0x12'));var utils=require(_0x72d4('0x13'));var config=require(_0x72d4('0x14'));var licenseUtil=require(_0x72d4('0x15'));var db=require(_0x72d4('0x16'))['db'];function respondWithStatusCode(_0x2b4de0,_0x268a67){_0x268a67=_0x268a67||0xcc;return function(_0x131569){if(_0x131569){return _0x2b4de0['sendStatus'](_0x268a67);}return _0x2b4de0['status'](_0x268a67)[_0x72d4('0x17')]();};}function respondWithResult(_0x12ecb4,_0x3fb44b){_0x3fb44b=_0x3fb44b||0xc8;return function(_0x55cd7a){if(_0x55cd7a){return _0x12ecb4['status'](_0x3fb44b)[_0x72d4('0x18')](_0x55cd7a);}};}function respondWithFilteredResult(_0x4434cb,_0x260bda){return function(_0x350886){if(_0x350886){var _0x47e319=typeof _0x260bda[_0x72d4('0x19')]==='undefined'&&typeof _0x260bda[_0x72d4('0x1a')]===_0x72d4('0x1b');var _0x3d5430=_0x350886['count'];var _0x4bbc9e=_0x47e319?0x0:_0x260bda[_0x72d4('0x19')];var _0x469566=_0x47e319?_0x350886[_0x72d4('0x1c')]:_0x260bda[_0x72d4('0x19')]+_0x260bda['limit'];var _0x2c90;if(_0x469566>=_0x3d5430){_0x469566=_0x3d5430;_0x2c90=0xc8;}else{_0x2c90=0xce;}_0x4434cb[_0x72d4('0x1d')](_0x2c90);return _0x4434cb[_0x72d4('0x1e')](_0x72d4('0x1f'),_0x4bbc9e+'-'+_0x469566+'/'+_0x3d5430)['json'](_0x350886);}return null;};}function patchUpdates(_0x21fd6a){return function(_0x5b0d16){try{jsonpatch[_0x72d4('0x20')](_0x5b0d16,_0x21fd6a,!![]);}catch(_0x3bc859){return BPromise['reject'](_0x3bc859);}return _0x5b0d16[_0x72d4('0x21')]();};}function saveUpdates(_0x59fa36,_0x50daff){return function(_0x55a0ed){if(_0x55a0ed){return _0x55a0ed[_0x72d4('0x22')](_0x59fa36)[_0x72d4('0x23')](function(_0x244547){return _0x244547;});}return null;};}function removeEntity(_0x4bf458,_0x2610fb){return function(_0x4fab2f){if(_0x4fab2f){return _0x4fab2f[_0x72d4('0x24')]()['then'](function(){_0x4bf458[_0x72d4('0x1d')](0xcc)[_0x72d4('0x17')]();});}};}function handleEntityNotFound(_0x586210,_0x414165){return function(_0x31350d){if(!_0x31350d){_0x586210['sendStatus'](0x194);}return _0x31350d;};}function handleError(_0x2ff958,_0x41a836){_0x41a836=_0x41a836||0x1f4;return function(_0x3b60eb){logger[_0x72d4('0x25')](_0x3b60eb[_0x72d4('0x26')]);if(_0x3b60eb[_0x72d4('0x27')]){delete _0x3b60eb[_0x72d4('0x27')];}_0x2ff958[_0x72d4('0x1d')](_0x41a836)[_0x72d4('0x28')](_0x3b60eb);};}exports[_0x72d4('0x29')]=function(_0xb814cb,_0x4a9de4){var _0x535540={},_0x7a5c9e={},_0x738e64={'count':0x0,'rows':[]};var _0x2a14cd=_['map'](db[_0x72d4('0x2a')][_0x72d4('0x2b')],function(_0x31f48b){return{'name':_0x31f48b[_0x72d4('0x2c')],'type':_0x31f48b[_0x72d4('0x2d')]['key']};});_0x7a5c9e[_0x72d4('0x2e')]=_[_0x72d4('0x2f')](_0x2a14cd,_0x72d4('0x27'));_0x7a5c9e['query']=_[_0x72d4('0x30')](_0xb814cb[_0x72d4('0x31')]);_0x7a5c9e[_0x72d4('0x32')]=_[_0x72d4('0x33')](_0x7a5c9e[_0x72d4('0x2e')],_0x7a5c9e[_0x72d4('0x31')]);_0x535540[_0x72d4('0x34')]=_['intersection'](_0x7a5c9e['model'],qs[_0x72d4('0x35')](_0xb814cb[_0x72d4('0x31')][_0x72d4('0x35')]));_0x535540[_0x72d4('0x34')]=_0x535540[_0x72d4('0x34')][_0x72d4('0x36')]?_0x535540['attributes']:_0x7a5c9e['model'];if(!_0xb814cb[_0x72d4('0x31')][_0x72d4('0x37')](_0x72d4('0x38'))){_0x535540['limit']=qs[_0x72d4('0x1a')](_0xb814cb['query']['limit']);_0x535540[_0x72d4('0x19')]=qs['offset'](_0xb814cb[_0x72d4('0x31')][_0x72d4('0x19')]);}_0x535540[_0x72d4('0x39')]=qs[_0x72d4('0x3a')](_0xb814cb[_0x72d4('0x31')][_0x72d4('0x3a')]);_0x535540['where']=qs[_0x72d4('0x32')](_[_0x72d4('0x3b')](_0xb814cb[_0x72d4('0x31')],_0x7a5c9e[_0x72d4('0x32')]),_0x2a14cd);if(_0xb814cb[_0x72d4('0x31')][_0x72d4('0x3c')]){_0x535540['where']=_[_0x72d4('0x3d')](_0x535540[_0x72d4('0x3e')],{'$or':_[_0x72d4('0x2f')](_0x2a14cd,function(_0x28b827){if(_0x28b827[_0x72d4('0x2d')]!=='VIRTUAL'){var _0x2184bd={};_0x2184bd[_0x28b827[_0x72d4('0x27')]]={'$like':'%'+_0xb814cb[_0x72d4('0x31')][_0x72d4('0x3c')]+'%'};return _0x2184bd;}})});}_0x535540=_['merge']({},_0x535540,_0xb814cb['options']);var _0x2284ae={'where':_0x535540[_0x72d4('0x3e')]};return db['OpenchannelQueueReport'][_0x72d4('0x1c')](_0x2284ae)[_0x72d4('0x23')](function(_0x13863b){_0x738e64[_0x72d4('0x1c')]=_0x13863b;if(_0xb814cb[_0x72d4('0x31')][_0x72d4('0x3f')]){_0x535540['include']=[{'all':!![]}];}return db[_0x72d4('0x2a')][_0x72d4('0x40')](_0x535540);})[_0x72d4('0x23')](function(_0x19e6bf){_0x738e64[_0x72d4('0x41')]=_0x19e6bf;return _0x738e64;})[_0x72d4('0x23')](respondWithFilteredResult(_0x4a9de4,_0x535540))['catch'](handleError(_0x4a9de4,null));};exports[_0x72d4('0x42')]=function(_0x39dca5,_0x3d5498){var _0x3992a9={'raw':!![],'where':{'id':_0x39dca5[_0x72d4('0x43')]['id']}},_0x145e4f={};_0x145e4f[_0x72d4('0x2e')]=_['keys'](db[_0x72d4('0x2a')][_0x72d4('0x2b')]);_0x145e4f['query']=_[_0x72d4('0x30')](_0x39dca5[_0x72d4('0x31')]);_0x145e4f[_0x72d4('0x32')]=_['intersection'](_0x145e4f['model'],_0x145e4f[_0x72d4('0x31')]);_0x3992a9[_0x72d4('0x34')]=_[_0x72d4('0x33')](_0x145e4f['model'],qs[_0x72d4('0x35')](_0x39dca5[_0x72d4('0x31')]['fields']));_0x3992a9[_0x72d4('0x34')]=_0x3992a9[_0x72d4('0x34')][_0x72d4('0x36')]?_0x3992a9[_0x72d4('0x34')]:_0x145e4f['model'];if(_0x39dca5[_0x72d4('0x31')][_0x72d4('0x3f')]){_0x3992a9[_0x72d4('0x44')]=[{'all':!![]}];}_0x3992a9=_[_0x72d4('0x3d')]({},_0x3992a9,_0x39dca5['options']);return db['OpenchannelQueueReport']['find'](_0x3992a9)[_0x72d4('0x23')](handleEntityNotFound(_0x3d5498,null))[_0x72d4('0x23')](respondWithResult(_0x3d5498,null))['catch'](handleError(_0x3d5498,null));};exports[_0x72d4('0x45')]=function(_0x27924c,_0x1c9171){return db[_0x72d4('0x2a')][_0x72d4('0x45')](_0x27924c['body'],{})[_0x72d4('0x23')](respondWithResult(_0x1c9171,0xc9))[_0x72d4('0x46')](handleError(_0x1c9171,null));};exports['update']=function(_0xebbbe0,_0x7207d1){if(_0xebbbe0['body']['id']){delete _0xebbbe0[_0x72d4('0x47')]['id'];}return db['OpenchannelQueueReport'][_0x72d4('0x48')]({'where':{'id':_0xebbbe0[_0x72d4('0x43')]['id']}})[_0x72d4('0x23')](handleEntityNotFound(_0x7207d1,null))[_0x72d4('0x23')](saveUpdates(_0xebbbe0['body'],null))['then'](respondWithResult(_0x7207d1,null))[_0x72d4('0x46')](handleError(_0x7207d1,null));};exports['destroy']=function(_0x3f2d2b,_0x409cfb){return db[_0x72d4('0x2a')]['find']({'where':{'id':_0x3f2d2b[_0x72d4('0x43')]['id']}})[_0x72d4('0x23')](handleEntityNotFound(_0x409cfb,null))[_0x72d4('0x23')](removeEntity(_0x409cfb,null))[_0x72d4('0x46')](handleError(_0x409cfb,null));};exports[_0x72d4('0x49')]=function(_0x461044,_0x1182af){return db[_0x72d4('0x2a')][_0x72d4('0x49')]()[_0x72d4('0x23')](respondWithResult(_0x1182af,null))['catch'](handleError(_0x1182af,null));}; \ No newline at end of file +var _0xe7c7=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','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','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','Content-Range','json','apply','reject','update','destroy','then','name','send','index','map','OpenchannelQueueReport','rawAttributes','key','keys','query','filters'];(function(_0xd9060e,_0x19d57c){var _0x5da4be=function(_0x23e515){while(--_0x23e515){_0xd9060e['push'](_0xd9060e['shift']());}};_0x5da4be(++_0x19d57c);}(_0xe7c7,0x1a0));var _0x7e7c=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xe7c7[_0x2235bf];return _0x4c3a64;};'use strict';var emlformat=require(_0x7e7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e7c('0x1'));var jsonpatch=require(_0x7e7c('0x2'));var rp=require(_0x7e7c('0x3'));var moment=require(_0x7e7c('0x4'));var BPromise=require(_0x7e7c('0x5'));var Mustache=require(_0x7e7c('0x6'));var util=require('util');var path=require(_0x7e7c('0x7'));var sox=require(_0x7e7c('0x8'));var csv=require(_0x7e7c('0x9'));var ejs=require(_0x7e7c('0xa'));var fs=require('fs');var fs_extra=require(_0x7e7c('0xb'));var _=require(_0x7e7c('0xc'));var squel=require(_0x7e7c('0xd'));var crypto=require(_0x7e7c('0xe'));var jsforce=require(_0x7e7c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7e7c('0x9'));var querystring=require(_0x7e7c('0x10'));var Papa=require(_0x7e7c('0x11'));var Redis=require(_0x7e7c('0x12'));var authService=require(_0x7e7c('0x13'));var qs=require(_0x7e7c('0x14'));var as=require(_0x7e7c('0x15'));var hardwareService=require(_0x7e7c('0x16'));var logger=require(_0x7e7c('0x17'))(_0x7e7c('0x18'));var utils=require(_0x7e7c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x7e7c('0x1a'));var db=require(_0x7e7c('0x1b'))['db'];function respondWithStatusCode(_0x276e45,_0x120cb){_0x120cb=_0x120cb||0xcc;return function(_0x5cb1e7){if(_0x5cb1e7){return _0x276e45[_0x7e7c('0x1c')](_0x120cb);}return _0x276e45['status'](_0x120cb)[_0x7e7c('0x1d')]();};}function respondWithResult(_0x20d46f,_0x55e36c){_0x55e36c=_0x55e36c||0xc8;return function(_0x57b74e){if(_0x57b74e){return _0x20d46f[_0x7e7c('0x1e')](_0x55e36c)['json'](_0x57b74e);}};}function respondWithFilteredResult(_0x18e046,_0x17fa01){return function(_0x13c28d){if(_0x13c28d){var _0x47d8dc=typeof _0x17fa01['offset']===_0x7e7c('0x1f')&&typeof _0x17fa01[_0x7e7c('0x20')]==='undefined';var _0x43f4b2=_0x13c28d[_0x7e7c('0x21')];var _0xb1a549=_0x47d8dc?0x0:_0x17fa01['offset'];var _0x11c63c=_0x47d8dc?_0x13c28d[_0x7e7c('0x21')]:_0x17fa01[_0x7e7c('0x22')]+_0x17fa01[_0x7e7c('0x20')];var _0x2922e9;if(_0x11c63c>=_0x43f4b2){_0x11c63c=_0x43f4b2;_0x2922e9=0xc8;}else{_0x2922e9=0xce;}_0x18e046['status'](_0x2922e9);return _0x18e046['set'](_0x7e7c('0x23'),_0xb1a549+'-'+_0x11c63c+'/'+_0x43f4b2)[_0x7e7c('0x24')](_0x13c28d);}return null;};}function patchUpdates(_0x2802ce){return function(_0xb5d346){try{jsonpatch[_0x7e7c('0x25')](_0xb5d346,_0x2802ce,!![]);}catch(_0x2fc550){return BPromise[_0x7e7c('0x26')](_0x2fc550);}return _0xb5d346['save']();};}function saveUpdates(_0x1c7425,_0x139982){return function(_0x6c07a){if(_0x6c07a){return _0x6c07a[_0x7e7c('0x27')](_0x1c7425)['then'](function(_0x4221c3){return _0x4221c3;});}return null;};}function removeEntity(_0x118b4b,_0x20f39e){return function(_0x3af385){if(_0x3af385){return _0x3af385[_0x7e7c('0x28')]()[_0x7e7c('0x29')](function(){_0x118b4b['status'](0xcc)[_0x7e7c('0x1d')]();});}};}function handleEntityNotFound(_0x3e32f8,_0x5bb942){return function(_0x17e734){if(!_0x17e734){_0x3e32f8[_0x7e7c('0x1c')](0x194);}return _0x17e734;};}function handleError(_0x368c37,_0x2c0266){_0x2c0266=_0x2c0266||0x1f4;return function(_0x4653f7){logger['error'](_0x4653f7['stack']);if(_0x4653f7['name']){delete _0x4653f7[_0x7e7c('0x2a')];}_0x368c37[_0x7e7c('0x1e')](_0x2c0266)[_0x7e7c('0x2b')](_0x4653f7);};}exports[_0x7e7c('0x2c')]=function(_0x32ba93,_0x136969){var _0xe63d68={},_0x10dd4c={},_0x40c3e5={'count':0x0,'rows':[]};var _0xe0d98f=_[_0x7e7c('0x2d')](db[_0x7e7c('0x2e')][_0x7e7c('0x2f')],function(_0x2f7cdf){return{'name':_0x2f7cdf['fieldName'],'type':_0x2f7cdf['type'][_0x7e7c('0x30')]};});_0x10dd4c['model']=_[_0x7e7c('0x2d')](_0xe0d98f,'name');_0x10dd4c['query']=_[_0x7e7c('0x31')](_0x32ba93[_0x7e7c('0x32')]);_0x10dd4c[_0x7e7c('0x33')]=_[_0x7e7c('0x34')](_0x10dd4c[_0x7e7c('0x35')],_0x10dd4c[_0x7e7c('0x32')]);_0xe63d68[_0x7e7c('0x36')]=_[_0x7e7c('0x34')](_0x10dd4c[_0x7e7c('0x35')],qs[_0x7e7c('0x37')](_0x32ba93['query'][_0x7e7c('0x37')]));_0xe63d68[_0x7e7c('0x36')]=_0xe63d68[_0x7e7c('0x36')][_0x7e7c('0x38')]?_0xe63d68[_0x7e7c('0x36')]:_0x10dd4c[_0x7e7c('0x35')];if(!_0x32ba93[_0x7e7c('0x32')][_0x7e7c('0x39')](_0x7e7c('0x3a'))){_0xe63d68[_0x7e7c('0x20')]=qs['limit'](_0x32ba93['query'][_0x7e7c('0x20')]);_0xe63d68['offset']=qs[_0x7e7c('0x22')](_0x32ba93[_0x7e7c('0x32')][_0x7e7c('0x22')]);}_0xe63d68['order']=qs[_0x7e7c('0x3b')](_0x32ba93[_0x7e7c('0x32')][_0x7e7c('0x3b')]);_0xe63d68[_0x7e7c('0x3c')]=qs['filters'](_[_0x7e7c('0x3d')](_0x32ba93['query'],_0x10dd4c['filters']),_0xe0d98f);if(_0x32ba93['query'][_0x7e7c('0x3e')]){_0xe63d68[_0x7e7c('0x3c')]=_[_0x7e7c('0x3f')](_0xe63d68[_0x7e7c('0x3c')],{'$or':_['map'](_0xe0d98f,function(_0x244744){if(_0x244744[_0x7e7c('0x40')]!==_0x7e7c('0x41')){var _0x2a6a51={};_0x2a6a51[_0x244744[_0x7e7c('0x2a')]]={'$like':'%'+_0x32ba93[_0x7e7c('0x32')][_0x7e7c('0x3e')]+'%'};return _0x2a6a51;}})});}_0xe63d68=_[_0x7e7c('0x3f')]({},_0xe63d68,_0x32ba93[_0x7e7c('0x42')]);var _0x3501cb={'where':_0xe63d68[_0x7e7c('0x3c')]};return db[_0x7e7c('0x2e')][_0x7e7c('0x21')](_0x3501cb)[_0x7e7c('0x29')](function(_0x4025b7){_0x40c3e5[_0x7e7c('0x21')]=_0x4025b7;if(_0x32ba93[_0x7e7c('0x32')][_0x7e7c('0x43')]){_0xe63d68['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x7e7c('0x44')](_0xe63d68);})['then'](function(_0x2c0970){_0x40c3e5[_0x7e7c('0x45')]=_0x2c0970;return _0x40c3e5;})['then'](respondWithFilteredResult(_0x136969,_0xe63d68))[_0x7e7c('0x46')](handleError(_0x136969,null));};exports[_0x7e7c('0x47')]=function(_0x24c288,_0x5530af){var _0x276453={'raw':!![],'where':{'id':_0x24c288[_0x7e7c('0x48')]['id']}},_0x80198a={};_0x80198a['model']=_['keys'](db[_0x7e7c('0x2e')][_0x7e7c('0x2f')]);_0x80198a[_0x7e7c('0x32')]=_[_0x7e7c('0x31')](_0x24c288['query']);_0x80198a[_0x7e7c('0x33')]=_[_0x7e7c('0x34')](_0x80198a[_0x7e7c('0x35')],_0x80198a[_0x7e7c('0x32')]);_0x276453[_0x7e7c('0x36')]=_[_0x7e7c('0x34')](_0x80198a[_0x7e7c('0x35')],qs['fields'](_0x24c288['query'][_0x7e7c('0x37')]));_0x276453['attributes']=_0x276453[_0x7e7c('0x36')][_0x7e7c('0x38')]?_0x276453[_0x7e7c('0x36')]:_0x80198a[_0x7e7c('0x35')];if(_0x24c288[_0x7e7c('0x32')][_0x7e7c('0x43')]){_0x276453[_0x7e7c('0x49')]=[{'all':!![]}];}_0x276453=_[_0x7e7c('0x3f')]({},_0x276453,_0x24c288[_0x7e7c('0x42')]);return db[_0x7e7c('0x2e')][_0x7e7c('0x4a')](_0x276453)[_0x7e7c('0x29')](handleEntityNotFound(_0x5530af,null))[_0x7e7c('0x29')](respondWithResult(_0x5530af,null))[_0x7e7c('0x46')](handleError(_0x5530af,null));};exports[_0x7e7c('0x4b')]=function(_0x45cf82,_0x4cb159){return db[_0x7e7c('0x2e')][_0x7e7c('0x4b')](_0x45cf82[_0x7e7c('0x4c')],{})[_0x7e7c('0x29')](respondWithResult(_0x4cb159,0xc9))[_0x7e7c('0x46')](handleError(_0x4cb159,null));};exports['update']=function(_0xb2bfd8,_0x2fc85b){if(_0xb2bfd8[_0x7e7c('0x4c')]['id']){delete _0xb2bfd8[_0x7e7c('0x4c')]['id'];}return db['OpenchannelQueueReport'][_0x7e7c('0x4a')]({'where':{'id':_0xb2bfd8[_0x7e7c('0x48')]['id']}})[_0x7e7c('0x29')](handleEntityNotFound(_0x2fc85b,null))[_0x7e7c('0x29')](saveUpdates(_0xb2bfd8[_0x7e7c('0x4c')],null))[_0x7e7c('0x29')](respondWithResult(_0x2fc85b,null))['catch'](handleError(_0x2fc85b,null));};exports[_0x7e7c('0x28')]=function(_0x375335,_0x24c442){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x375335[_0x7e7c('0x48')]['id']}})[_0x7e7c('0x29')](handleEntityNotFound(_0x24c442,null))[_0x7e7c('0x29')](removeEntity(_0x24c442,null))['catch'](handleError(_0x24c442,null));};exports[_0x7e7c('0x4d')]=function(_0x910387,_0x17bfb1){return db['OpenchannelQueueReport'][_0x7e7c('0x4d')]()[_0x7e7c('0x29')](respondWithResult(_0x17bfb1,null))[_0x7e7c('0x46')](handleError(_0x17bfb1,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4093a53..5198a0b 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(_0x21cb6d,_0x43618d){var _0x2d7440=function(_0x49e090){while(--_0x49e090){_0x21cb6d['push'](_0x21cb6d['shift']());}};_0x2d7440(++_0x43618d);}(_0x1261,0x144));var _0x1126=function(_0x3e9030,_0x16c384){_0x3e9030=_0x3e9030-0x0;var _0x526b49=_0x1261[_0x3e9030];return _0x526b49;};'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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x13c398,_0x5b1dbc){var _0x29d947=function(_0x4a601a){while(--_0x4a601a){_0x13c398['push'](_0x13c398['shift']());}};_0x29d947(++_0x5b1dbc);}(_0x326f,0xd1));var _0xf326=function(_0x13c9a0,_0x27f042){_0x13c9a0=_0x13c9a0-0x0;var _0xdab9e0=_0x326f[_0x13c9a0];return _0xdab9e0;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 76c79eb..83737a0 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 _0xd26f=['OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','update','body','attributes','limit','then','UpdateOpenchannelQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x4953ed,_0xe00d86){var _0x45e90d=function(_0x380874){while(--_0x380874){_0x4953ed['push'](_0x4953ed['shift']());}};_0x45e90d(++_0xe00d86);}(_0xd26f,0x113));var _0xfd26=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xd26f[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd26('0x2'));var fs=require('fs');var Redis=require(_0xfd26('0x3'));var db=require(_0xfd26('0x4'))['db'];var utils=require(_0xfd26('0x5'));var logger=require(_0xfd26('0x6'))(_0xfd26('0x7'));var config=require(_0xfd26('0x8'));var jayson=require(_0xfd26('0x9'));var client=jayson[_0xfd26('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22b353,_0x3c148d,_0x1905a2){return new BPromise(function(_0x3d405f,_0x3c9154){return client[_0xfd26('0xb')](_0x22b353,_0x1905a2)['then'](function(_0xcf2fdb){logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));logger[_0xfd26('0xf')](_0xfd26('0x10'),_0x3c148d,'request\x20sent',JSON[_0xfd26('0x11')](_0xcf2fdb));if(_0xcf2fdb['error']){if(_0xcf2fdb[_0xfd26('0x12')]['code']===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3c148d,_0xcf2fdb['error']['message']);return _0x3c9154(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}logger[_0xfd26('0x12')](_0xfd26('0xd'),_0x3c148d,_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);return _0x3d405f(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}else{logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));_0x3d405f(_0xcf2fdb[_0xfd26('0x14')][_0xfd26('0x13')]);}})[_0xfd26('0x15')](function(_0x2f9b37){logger['error'](_0xfd26('0xd'),_0x3c148d,_0x2f9b37);_0x3c9154(_0x2f9b37);});});}exports[_0xfd26('0x16')]=function(_0xeb7aeb){var _0x210dd4=this;return new Promise(function(_0x36a275,_0x5b3e8b){return db[_0xfd26('0x17')]['create'](_0xeb7aeb['body'],{'raw':_0xeb7aeb['options']?_0xeb7aeb[_0xfd26('0x18')][_0xfd26('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x523cbe){logger[_0xfd26('0xc')](_0xfd26('0x16'),_0xeb7aeb);logger['debug'](_0xfd26('0x16'),_0xeb7aeb,JSON['stringify'](_0x523cbe));_0x36a275(_0x523cbe);})[_0xfd26('0x15')](function(_0x531bf7){logger[_0xfd26('0x12')]('CreateOpenchannelQueueReport',_0x531bf7[_0xfd26('0x13')],_0xeb7aeb);_0x5b3e8b(_0x210dd4[_0xfd26('0x12')](0x1f4,_0x531bf7['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1194c2){var _0x4bc02c=this;return new Promise(function(_0x1d62c5,_0xebbab7){return db[_0xfd26('0x17')][_0xfd26('0x1a')](_0x1194c2[_0xfd26('0x1b')],{'raw':_0x1194c2['options']?_0x1194c2[_0xfd26('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1194c2[_0xfd26('0x18')]?_0x1194c2[_0xfd26('0x18')]['where']||null:null,'attributes':_0x1194c2[_0xfd26('0x18')]?_0x1194c2[_0xfd26('0x18')][_0xfd26('0x1c')]||null:null,'limit':_0x1194c2[_0xfd26('0x18')]?_0x1194c2[_0xfd26('0x18')][_0xfd26('0x1d')]||null:null})[_0xfd26('0x1e')](function(_0x565c0){logger[_0xfd26('0xc')]('UpdateOpenchannelQueueReport',_0x1194c2);logger['debug']('UpdateOpenchannelQueueReport',_0x1194c2,JSON['stringify'](_0x565c0));_0x1d62c5(_0x565c0);})[_0xfd26('0x15')](function(_0x5d0101){logger[_0xfd26('0x12')](_0xfd26('0x1f'),_0x5d0101['message'],_0x1194c2);_0xebbab7(_0x4bc02c['error'](0x1f4,_0x5d0101[_0xfd26('0x13')]));});});}; \ No newline at end of file +var _0xe605=['UpdateOpenchannelQueueReport','update','where','attributes','limit','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0xe605,0x92));var _0x5e60=function(_0x46d183,_0x2c3ccd){_0x46d183=_0x46d183-0x0;var _0x56dc55=_0xe605[_0x46d183];return _0x56dc55;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var moment=require('moment');var BPromise=require(_0x5e60('0x2'));var rs=require(_0x5e60('0x3'));var fs=require('fs');var Redis=require(_0x5e60('0x4'));var db=require(_0x5e60('0x5'))['db'];var utils=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var config=require(_0x5e60('0x9'));var jayson=require(_0x5e60('0xa'));var client=jayson[_0x5e60('0xb')][_0x5e60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x168a14,_0x4e3501,_0x1c5a6f){return new BPromise(function(_0x55ff5c,_0x593118){return client['request'](_0x168a14,_0x1c5a6f)[_0x5e60('0xd')](function(_0xe93f9c){logger[_0x5e60('0xe')](_0x5e60('0xf'),_0x4e3501,_0x5e60('0x10'));logger[_0x5e60('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x4e3501,_0x5e60('0x10'),JSON['stringify'](_0xe93f9c));if(_0xe93f9c[_0x5e60('0x12')]){if(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x13')]===0x1f4){logger['error'](_0x5e60('0xf'),_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x593118(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}logger[_0x5e60('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x55ff5c(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}else{logger['info'](_0x5e60('0xf'),_0x4e3501,'request\x20sent');_0x55ff5c(_0xe93f9c[_0x5e60('0x15')][_0x5e60('0x14')]);}})['catch'](function(_0x39be57){logger[_0x5e60('0x12')](_0x5e60('0xf'),_0x4e3501,_0x39be57);_0x593118(_0x39be57);});});}exports[_0x5e60('0x16')]=function(_0x5c485d){var _0xdd0a71=this;return new Promise(function(_0x22d718,_0x52cc15){return db[_0x5e60('0x17')][_0x5e60('0x18')](_0x5c485d[_0x5e60('0x19')],{'raw':_0x5c485d[_0x5e60('0x1a')]?_0x5c485d[_0x5e60('0x1a')][_0x5e60('0x1b')]===undefined?!![]:![]:!![]})[_0x5e60('0xd')](function(_0x524c93){logger[_0x5e60('0xe')](_0x5e60('0x16'),_0x5c485d);logger[_0x5e60('0x11')]('CreateOpenchannelQueueReport',_0x5c485d,JSON[_0x5e60('0x1c')](_0x524c93));_0x22d718(_0x524c93);})['catch'](function(_0x376069){logger[_0x5e60('0x12')](_0x5e60('0x16'),_0x376069[_0x5e60('0x14')],_0x5c485d);_0x52cc15(_0xdd0a71[_0x5e60('0x12')](0x1f4,_0x376069[_0x5e60('0x14')]));});});};exports[_0x5e60('0x1d')]=function(_0x5d2c03){var _0x18d527=this;return new Promise(function(_0x7dbdb7,_0x19f37b){return db['OpenchannelQueueReport'][_0x5e60('0x1e')](_0x5d2c03[_0x5e60('0x19')],{'raw':_0x5d2c03[_0x5e60('0x1a')]?_0x5d2c03[_0x5e60('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d2c03[_0x5e60('0x1a')]?_0x5d2c03['options'][_0x5e60('0x1f')]||null:null,'attributes':_0x5d2c03[_0x5e60('0x1a')]?_0x5d2c03['options'][_0x5e60('0x20')]||null:null,'limit':_0x5d2c03[_0x5e60('0x1a')]?_0x5d2c03['options'][_0x5e60('0x21')]||null:null})[_0x5e60('0xd')](function(_0x52c97c){logger['info']('UpdateOpenchannelQueueReport',_0x5d2c03);logger[_0x5e60('0x11')](_0x5e60('0x1d'),_0x5d2c03,JSON[_0x5e60('0x1c')](_0x52c97c));_0x7dbdb7(_0x52c97c);})[_0x5e60('0x22')](function(_0x3ccfee){logger['error'](_0x5e60('0x1d'),_0x3ccfee[_0x5e60('0x14')],_0x5d2c03);_0x19f37b(_0x18d527['error'](0x1f4,_0x3ccfee[_0x5e60('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 22d9150..ebf4f21 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 _0xe5ff=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','post','create','put','exports','multer','util'];(function(_0x5e3948,_0x433308){var _0x3adf39=function(_0x23a4cd){while(--_0x23a4cd){_0x5e3948['push'](_0x5e3948['shift']());}};_0x3adf39(++_0x433308);}(_0xe5ff,0x152));var _0xfe5f=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0xe5ff[_0x419550];return _0x55f9ef;};'use strict';var multer=require(_0xfe5f('0x0'));var util=require(_0xfe5f('0x1'));var path=require(_0xfe5f('0x2'));var timeout=require(_0xfe5f('0x3'));var express=require(_0xfe5f('0x4'));var router=express['Router']();var fs_extra=require(_0xfe5f('0x5'));var auth=require(_0xfe5f('0x6'));var interaction=require(_0xfe5f('0x7'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0xfe5f('0x8')](),controller[_0xfe5f('0x9')]);router[_0xfe5f('0xa')](_0xfe5f('0xb'),auth[_0xfe5f('0x8')](),controller['describe']);router['get'](_0xfe5f('0xc'),auth[_0xfe5f('0x8')](),controller['show']);router[_0xfe5f('0xd')]('/',auth['isAuthenticated'](),controller[_0xfe5f('0xe')]);router[_0xfe5f('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xfe5f('0x8')](),controller['destroy']);module[_0xfe5f('0x10')]=router; \ No newline at end of file +var _0xced8=['/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get'];(function(_0x51210e,_0x5ae298){var _0x2a0e5f=function(_0x4e9c8f){while(--_0x4e9c8f){_0x51210e['push'](_0x51210e['shift']());}};_0x2a0e5f(++_0x5ae298);}(_0xced8,0x128));var _0x8ced=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xced8[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x8ced('0x0'));var util=require(_0x8ced('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8ced('0x2'));var router=express[_0x8ced('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8ced('0x4'));var config=require(_0x8ced('0x5'));var controller=require(_0x8ced('0x6'));router[_0x8ced('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8ced('0x7')](_0x8ced('0x8'),auth[_0x8ced('0x9')](),controller[_0x8ced('0xa')]);router[_0x8ced('0x7')](_0x8ced('0xb'),auth[_0x8ced('0x9')](),controller['show']);router[_0x8ced('0xc')]('/',auth['isAuthenticated'](),controller[_0x8ced('0xd')]);router[_0x8ced('0xe')](_0x8ced('0xb'),auth['isAuthenticated'](),controller[_0x8ced('0xf')]);router[_0x8ced('0x10')](_0x8ced('0xb'),auth[_0x8ced('0x9')](),controller[_0x8ced('0x11')]);module[_0x8ced('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 4b17bd5..b2ce349 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x56223f,_0x4eba12){var _0x2892f4=function(_0xc93462){while(--_0xc93462){_0x56223f['push'](_0x56223f['shift']());}};_0x2892f4(++_0x4eba12);}(_0x008c,0x188));var _0xc008=function(_0xa339a9,_0x342371){_0xa339a9=_0xa339a9-0x0;var _0x125a36=_0x008c[_0xa339a9];return _0x125a36;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x13900e,_0x18fb63){var _0x2a1d2e=function(_0x2f5997){while(--_0x2f5997){_0x13900e['push'](_0x13900e['shift']());}};_0x2a1d2e(++_0x18fb63);}(_0xedd9,0xfc));var _0x9edd=function(_0x594494,_0x4d0ec5){_0x594494=_0x594494-0x0;var _0x22c327=_0xedd9[_0x594494];return _0x22c327;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 204fd2f..6ad874e 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 _0xc826=['sendStatus','status','offset','limit','undefined','count','json','save','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelTransferReport','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','catch','show','params','keys','rawAttributes','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x96dbf,_0x42f48a){var _0x43ce02=function(_0x5471ab){while(--_0x5471ab){_0x96dbf['push'](_0x96dbf['shift']());}};_0x43ce02(++_0x42f48a);}(_0xc826,0xbb));var _0x6c82=function(_0x1253d9,_0x4e8f3e){_0x1253d9=_0x1253d9-0x0;var _0x5d3a62=_0xc826[_0x1253d9];return _0x5d3a62;};'use strict';var emlformat=require(_0x6c82('0x0'));var rimraf=require(_0x6c82('0x1'));var zipdir=require(_0x6c82('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c82('0x3'));var moment=require(_0x6c82('0x4'));var BPromise=require(_0x6c82('0x5'));var Mustache=require('mustache');var util=require(_0x6c82('0x6'));var path=require(_0x6c82('0x7'));var sox=require(_0x6c82('0x8'));var csv=require(_0x6c82('0x9'));var ejs=require(_0x6c82('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c82('0xb'));var squel=require(_0x6c82('0xc'));var crypto=require(_0x6c82('0xd'));var jsforce=require(_0x6c82('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6c82('0x9'));var querystring=require(_0x6c82('0xf'));var Papa=require(_0x6c82('0x10'));var Redis=require(_0x6c82('0x11'));var authService=require(_0x6c82('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6c82('0x13'));var hardwareService=require(_0x6c82('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6c82('0x15'));var config=require(_0x6c82('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57b900,_0x12c1b5){_0x12c1b5=_0x12c1b5||0xcc;return function(_0x57fa6b){if(_0x57fa6b){return _0x57b900[_0x6c82('0x17')](_0x12c1b5);}return _0x57b900[_0x6c82('0x18')](_0x12c1b5)['end']();};}function respondWithResult(_0x6645bc,_0x333ea5){_0x333ea5=_0x333ea5||0xc8;return function(_0x36910b){if(_0x36910b){return _0x6645bc[_0x6c82('0x18')](_0x333ea5)['json'](_0x36910b);}};}function respondWithFilteredResult(_0xc9beb5,_0x4461b7){return function(_0x204af9){if(_0x204af9){var _0x2e1b31=typeof _0x4461b7[_0x6c82('0x19')]==='undefined'&&typeof _0x4461b7[_0x6c82('0x1a')]===_0x6c82('0x1b');var _0x124b5d=_0x204af9[_0x6c82('0x1c')];var _0x3358e5=_0x2e1b31?0x0:_0x4461b7[_0x6c82('0x19')];var _0x35b861=_0x2e1b31?_0x204af9['count']:_0x4461b7['offset']+_0x4461b7['limit'];var _0x32b550;if(_0x35b861>=_0x124b5d){_0x35b861=_0x124b5d;_0x32b550=0xc8;}else{_0x32b550=0xce;}_0xc9beb5['status'](_0x32b550);return _0xc9beb5['set']('Content-Range',_0x3358e5+'-'+_0x35b861+'/'+_0x124b5d)[_0x6c82('0x1d')](_0x204af9);}return null;};}function patchUpdates(_0x4011e0){return function(_0x3d826f){try{jsonpatch['apply'](_0x3d826f,_0x4011e0,!![]);}catch(_0x2b7c85){return BPromise['reject'](_0x2b7c85);}return _0x3d826f[_0x6c82('0x1e')]();};}function saveUpdates(_0x2265a3,_0x5bab4f){return function(_0x579235){if(_0x579235){return _0x579235[_0x6c82('0x1f')](_0x2265a3)[_0x6c82('0x20')](function(_0x4dd67c){return _0x4dd67c;});}return null;};}function removeEntity(_0x24e31e,_0x3b5ba5){return function(_0x5b5d44){if(_0x5b5d44){return _0x5b5d44[_0x6c82('0x21')]()[_0x6c82('0x20')](function(){_0x24e31e['status'](0xcc)[_0x6c82('0x22')]();});}};}function handleEntityNotFound(_0x2b713e,_0x1c89ca){return function(_0x4192c8){if(!_0x4192c8){_0x2b713e['sendStatus'](0x194);}return _0x4192c8;};}function handleError(_0x2adaad,_0x4e9339){_0x4e9339=_0x4e9339||0x1f4;return function(_0x102332){logger[_0x6c82('0x23')](_0x102332[_0x6c82('0x24')]);if(_0x102332[_0x6c82('0x25')]){delete _0x102332[_0x6c82('0x25')];}_0x2adaad[_0x6c82('0x18')](_0x4e9339)[_0x6c82('0x26')](_0x102332);};}exports[_0x6c82('0x27')]=function(_0x21e9da,_0x4bbdc4){var _0x208325={},_0x36af8c={},_0x528479={'count':0x0,'rows':[]};var _0x520614=_[_0x6c82('0x28')](db[_0x6c82('0x29')]['rawAttributes'],function(_0x5c3555){return{'name':_0x5c3555['fieldName'],'type':_0x5c3555[_0x6c82('0x2a')][_0x6c82('0x2b')]};});_0x36af8c[_0x6c82('0x2c')]=_[_0x6c82('0x28')](_0x520614,_0x6c82('0x25'));_0x36af8c[_0x6c82('0x2d')]=_['keys'](_0x21e9da[_0x6c82('0x2d')]);_0x36af8c['filters']=_[_0x6c82('0x2e')](_0x36af8c['model'],_0x36af8c['query']);_0x208325[_0x6c82('0x2f')]=_[_0x6c82('0x2e')](_0x36af8c[_0x6c82('0x2c')],qs[_0x6c82('0x30')](_0x21e9da[_0x6c82('0x2d')][_0x6c82('0x30')]));_0x208325[_0x6c82('0x2f')]=_0x208325[_0x6c82('0x2f')][_0x6c82('0x31')]?_0x208325[_0x6c82('0x2f')]:_0x36af8c['model'];if(!_0x21e9da['query'][_0x6c82('0x32')]('nolimit')){_0x208325[_0x6c82('0x1a')]=qs[_0x6c82('0x1a')](_0x21e9da[_0x6c82('0x2d')]['limit']);_0x208325['offset']=qs[_0x6c82('0x19')](_0x21e9da[_0x6c82('0x2d')][_0x6c82('0x19')]);}_0x208325[_0x6c82('0x33')]=qs[_0x6c82('0x34')](_0x21e9da[_0x6c82('0x2d')]['sort']);_0x208325[_0x6c82('0x35')]=qs[_0x6c82('0x36')](_['pick'](_0x21e9da['query'],_0x36af8c[_0x6c82('0x36')]),_0x520614);if(_0x21e9da['query'][_0x6c82('0x37')]){_0x208325[_0x6c82('0x35')]=_['merge'](_0x208325[_0x6c82('0x35')],{'$or':_[_0x6c82('0x28')](_0x520614,function(_0x4f72fc){if(_0x4f72fc[_0x6c82('0x2a')]!==_0x6c82('0x38')){var _0x10ce4a={};_0x10ce4a[_0x4f72fc['name']]={'$like':'%'+_0x21e9da['query'][_0x6c82('0x37')]+'%'};return _0x10ce4a;}})});}_0x208325=_[_0x6c82('0x39')]({},_0x208325,_0x21e9da[_0x6c82('0x3a')]);var _0x414a26={'where':_0x208325[_0x6c82('0x35')]};return db[_0x6c82('0x29')][_0x6c82('0x1c')](_0x414a26)[_0x6c82('0x20')](function(_0x3d56d3){_0x528479['count']=_0x3d56d3;if(_0x21e9da[_0x6c82('0x2d')][_0x6c82('0x3b')]){_0x208325['include']=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x208325);})['then'](function(_0x30fa7e){_0x528479['rows']=_0x30fa7e;return _0x528479;})[_0x6c82('0x20')](respondWithFilteredResult(_0x4bbdc4,_0x208325))[_0x6c82('0x3c')](handleError(_0x4bbdc4,null));};exports[_0x6c82('0x3d')]=function(_0x417e57,_0x5288a7){var _0x355428={'raw':!![],'where':{'id':_0x417e57[_0x6c82('0x3e')]['id']}},_0x118634={};_0x118634[_0x6c82('0x2c')]=_[_0x6c82('0x3f')](db[_0x6c82('0x29')][_0x6c82('0x40')]);_0x118634[_0x6c82('0x2d')]=_[_0x6c82('0x3f')](_0x417e57[_0x6c82('0x2d')]);_0x118634[_0x6c82('0x36')]=_[_0x6c82('0x2e')](_0x118634[_0x6c82('0x2c')],_0x118634[_0x6c82('0x2d')]);_0x355428[_0x6c82('0x2f')]=_['intersection'](_0x118634[_0x6c82('0x2c')],qs[_0x6c82('0x30')](_0x417e57['query'][_0x6c82('0x30')]));_0x355428[_0x6c82('0x2f')]=_0x355428[_0x6c82('0x2f')][_0x6c82('0x31')]?_0x355428[_0x6c82('0x2f')]:_0x118634['model'];if(_0x417e57[_0x6c82('0x2d')][_0x6c82('0x3b')]){_0x355428[_0x6c82('0x41')]=[{'all':!![]}];}_0x355428=_[_0x6c82('0x39')]({},_0x355428,_0x417e57['options']);return db[_0x6c82('0x29')][_0x6c82('0x42')](_0x355428)[_0x6c82('0x20')](handleEntityNotFound(_0x5288a7,null))[_0x6c82('0x20')](respondWithResult(_0x5288a7,null))[_0x6c82('0x3c')](handleError(_0x5288a7,null));};exports['create']=function(_0x39ec0e,_0x1f582b){return db['OpenchannelTransferReport'][_0x6c82('0x43')](_0x39ec0e['body'],{})[_0x6c82('0x20')](respondWithResult(_0x1f582b,0xc9))[_0x6c82('0x3c')](handleError(_0x1f582b,null));};exports[_0x6c82('0x1f')]=function(_0x516deb,_0x5bd04a){if(_0x516deb[_0x6c82('0x44')]['id']){delete _0x516deb[_0x6c82('0x44')]['id'];}return db[_0x6c82('0x29')][_0x6c82('0x42')]({'where':{'id':_0x516deb[_0x6c82('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5bd04a,null))[_0x6c82('0x20')](saveUpdates(_0x516deb[_0x6c82('0x44')],null))['then'](respondWithResult(_0x5bd04a,null))[_0x6c82('0x3c')](handleError(_0x5bd04a,null));};exports[_0x6c82('0x21')]=function(_0x4b2d57,_0x5cdfa5){return db[_0x6c82('0x29')][_0x6c82('0x42')]({'where':{'id':_0x4b2d57[_0x6c82('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5cdfa5,null))['then'](removeEntity(_0x5cdfa5,null))[_0x6c82('0x3c')](handleError(_0x5cdfa5,null));};exports[_0x6c82('0x45')]=function(_0x6c37db,_0x4cc5bc){return db['OpenchannelTransferReport'][_0x6c82('0x45')]()['then'](respondWithResult(_0x4cc5bc,null))['catch'](handleError(_0x4cc5bc,null));}; \ No newline at end of file +var _0xd902=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','length','includeAll','find','catch','create','body','params','destroy','describe','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd902,0xca));var _0x2d90=function(_0x209511,_0x231622){_0x209511=_0x209511-0x0;var _0x39b937=_0xd902[_0x209511];return _0x39b937;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d90('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d90('0x1'));var rp=require(_0x2d90('0x2'));var moment=require(_0x2d90('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2d90('0x4'));var sox=require(_0x2d90('0x5'));var csv=require(_0x2d90('0x6'));var ejs=require(_0x2d90('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d90('0x8'));var squel=require(_0x2d90('0x9'));var crypto=require('crypto');var jsforce=require(_0x2d90('0xa'));var deskjs=require(_0x2d90('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2d90('0xc'));var Papa=require(_0x2d90('0xd'));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(_0x2d90('0xe'));var logger=require(_0x2d90('0xf'))(_0x2d90('0x10'));var utils=require(_0x2d90('0x11'));var config=require(_0x2d90('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d90('0x13'))['db'];function respondWithStatusCode(_0x3f19ff,_0x254a38){_0x254a38=_0x254a38||0xcc;return function(_0xcb345c){if(_0xcb345c){return _0x3f19ff[_0x2d90('0x14')](_0x254a38);}return _0x3f19ff[_0x2d90('0x15')](_0x254a38)[_0x2d90('0x16')]();};}function respondWithResult(_0x2ff862,_0x1baa9d){_0x1baa9d=_0x1baa9d||0xc8;return function(_0x3a055f){if(_0x3a055f){return _0x2ff862[_0x2d90('0x15')](_0x1baa9d)[_0x2d90('0x17')](_0x3a055f);}};}function respondWithFilteredResult(_0x5e7e9c,_0x10262d){return function(_0x4f2fed){if(_0x4f2fed){var _0x542484=typeof _0x10262d[_0x2d90('0x18')]===_0x2d90('0x19')&&typeof _0x10262d[_0x2d90('0x1a')]===_0x2d90('0x19');var _0x3f3e43=_0x4f2fed[_0x2d90('0x1b')];var _0x31cc8e=_0x542484?0x0:_0x10262d['offset'];var _0x54e9d2=_0x542484?_0x4f2fed[_0x2d90('0x1b')]:_0x10262d[_0x2d90('0x18')]+_0x10262d[_0x2d90('0x1a')];var _0xd231a5;if(_0x54e9d2>=_0x3f3e43){_0x54e9d2=_0x3f3e43;_0xd231a5=0xc8;}else{_0xd231a5=0xce;}_0x5e7e9c[_0x2d90('0x15')](_0xd231a5);return _0x5e7e9c[_0x2d90('0x1c')]('Content-Range',_0x31cc8e+'-'+_0x54e9d2+'/'+_0x3f3e43)['json'](_0x4f2fed);}return null;};}function patchUpdates(_0x55ba6a){return function(_0x315e31){try{jsonpatch[_0x2d90('0x1d')](_0x315e31,_0x55ba6a,!![]);}catch(_0x3f84ad){return BPromise[_0x2d90('0x1e')](_0x3f84ad);}return _0x315e31[_0x2d90('0x1f')]();};}function saveUpdates(_0x517b98,_0x173078){return function(_0x2ad2d2){if(_0x2ad2d2){return _0x2ad2d2[_0x2d90('0x20')](_0x517b98)['then'](function(_0x5c717e){return _0x5c717e;});}return null;};}function removeEntity(_0x17fea4,_0x1a0e4d){return function(_0x3fff36){if(_0x3fff36){return _0x3fff36['destroy']()[_0x2d90('0x21')](function(){_0x17fea4[_0x2d90('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37c171,_0x4bc2c1){return function(_0x18561f){if(!_0x18561f){_0x37c171[_0x2d90('0x14')](0x194);}return _0x18561f;};}function handleError(_0x5daf05,_0x381ef9){_0x381ef9=_0x381ef9||0x1f4;return function(_0x517d75){logger[_0x2d90('0x22')](_0x517d75[_0x2d90('0x23')]);if(_0x517d75[_0x2d90('0x24')]){delete _0x517d75['name'];}_0x5daf05[_0x2d90('0x15')](_0x381ef9)[_0x2d90('0x25')](_0x517d75);};}exports[_0x2d90('0x26')]=function(_0x4a9963,_0xe39e0d){var _0x10bd8d={},_0x33b5a5={},_0xb079b0={'count':0x0,'rows':[]};var _0x54a4fc=_[_0x2d90('0x27')](db[_0x2d90('0x28')][_0x2d90('0x29')],function(_0x2140e0){return{'name':_0x2140e0[_0x2d90('0x2a')],'type':_0x2140e0[_0x2d90('0x2b')][_0x2d90('0x2c')]};});_0x33b5a5['model']=_['map'](_0x54a4fc,_0x2d90('0x24'));_0x33b5a5[_0x2d90('0x2d')]=_['keys'](_0x4a9963[_0x2d90('0x2d')]);_0x33b5a5[_0x2d90('0x2e')]=_[_0x2d90('0x2f')](_0x33b5a5['model'],_0x33b5a5[_0x2d90('0x2d')]);_0x10bd8d['attributes']=_[_0x2d90('0x2f')](_0x33b5a5[_0x2d90('0x30')],qs[_0x2d90('0x31')](_0x4a9963[_0x2d90('0x2d')]['fields']));_0x10bd8d[_0x2d90('0x32')]=_0x10bd8d['attributes']['length']?_0x10bd8d['attributes']:_0x33b5a5[_0x2d90('0x30')];if(!_0x4a9963['query'][_0x2d90('0x33')](_0x2d90('0x34'))){_0x10bd8d[_0x2d90('0x1a')]=qs[_0x2d90('0x1a')](_0x4a9963[_0x2d90('0x2d')]['limit']);_0x10bd8d[_0x2d90('0x18')]=qs[_0x2d90('0x18')](_0x4a9963['query'][_0x2d90('0x18')]);}_0x10bd8d[_0x2d90('0x35')]=qs[_0x2d90('0x36')](_0x4a9963[_0x2d90('0x2d')][_0x2d90('0x36')]);_0x10bd8d[_0x2d90('0x37')]=qs[_0x2d90('0x2e')](_['pick'](_0x4a9963[_0x2d90('0x2d')],_0x33b5a5[_0x2d90('0x2e')]),_0x54a4fc);if(_0x4a9963[_0x2d90('0x2d')][_0x2d90('0x38')]){_0x10bd8d[_0x2d90('0x37')]=_[_0x2d90('0x39')](_0x10bd8d[_0x2d90('0x37')],{'$or':_[_0x2d90('0x27')](_0x54a4fc,function(_0x540c80){if(_0x540c80[_0x2d90('0x2b')]!==_0x2d90('0x3a')){var _0x7e70ec={};_0x7e70ec[_0x540c80[_0x2d90('0x24')]]={'$like':'%'+_0x4a9963['query']['filter']+'%'};return _0x7e70ec;}})});}_0x10bd8d=_[_0x2d90('0x39')]({},_0x10bd8d,_0x4a9963[_0x2d90('0x3b')]);var _0x3bfae1={'where':_0x10bd8d[_0x2d90('0x37')]};return db[_0x2d90('0x28')][_0x2d90('0x1b')](_0x3bfae1)[_0x2d90('0x21')](function(_0xc51ba){_0xb079b0[_0x2d90('0x1b')]=_0xc51ba;if(_0x4a9963[_0x2d90('0x2d')]['includeAll']){_0x10bd8d[_0x2d90('0x3c')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x2d90('0x3d')](_0x10bd8d);})[_0x2d90('0x21')](function(_0x14299b){_0xb079b0[_0x2d90('0x3e')]=_0x14299b;return _0xb079b0;})[_0x2d90('0x21')](respondWithFilteredResult(_0xe39e0d,_0x10bd8d))['catch'](handleError(_0xe39e0d,null));};exports[_0x2d90('0x3f')]=function(_0x496cf4,_0x17a986){var _0x91f057={'raw':!![],'where':{'id':_0x496cf4['params']['id']}},_0xc9b615={};_0xc9b615[_0x2d90('0x30')]=_['keys'](db[_0x2d90('0x28')]['rawAttributes']);_0xc9b615[_0x2d90('0x2d')]=_['keys'](_0x496cf4[_0x2d90('0x2d')]);_0xc9b615['filters']=_[_0x2d90('0x2f')](_0xc9b615[_0x2d90('0x30')],_0xc9b615['query']);_0x91f057[_0x2d90('0x32')]=_[_0x2d90('0x2f')](_0xc9b615[_0x2d90('0x30')],qs[_0x2d90('0x31')](_0x496cf4[_0x2d90('0x2d')][_0x2d90('0x31')]));_0x91f057['attributes']=_0x91f057[_0x2d90('0x32')][_0x2d90('0x40')]?_0x91f057[_0x2d90('0x32')]:_0xc9b615[_0x2d90('0x30')];if(_0x496cf4[_0x2d90('0x2d')][_0x2d90('0x41')]){_0x91f057[_0x2d90('0x3c')]=[{'all':!![]}];}_0x91f057=_[_0x2d90('0x39')]({},_0x91f057,_0x496cf4[_0x2d90('0x3b')]);return db[_0x2d90('0x28')][_0x2d90('0x42')](_0x91f057)[_0x2d90('0x21')](handleEntityNotFound(_0x17a986,null))['then'](respondWithResult(_0x17a986,null))[_0x2d90('0x43')](handleError(_0x17a986,null));};exports['create']=function(_0x2e9ac6,_0x269f22){return db['OpenchannelTransferReport'][_0x2d90('0x44')](_0x2e9ac6[_0x2d90('0x45')],{})['then'](respondWithResult(_0x269f22,0xc9))['catch'](handleError(_0x269f22,null));};exports['update']=function(_0x19f90b,_0xb6ef2c){if(_0x19f90b[_0x2d90('0x45')]['id']){delete _0x19f90b[_0x2d90('0x45')]['id'];}return db['OpenchannelTransferReport'][_0x2d90('0x42')]({'where':{'id':_0x19f90b[_0x2d90('0x46')]['id']}})['then'](handleEntityNotFound(_0xb6ef2c,null))[_0x2d90('0x21')](saveUpdates(_0x19f90b[_0x2d90('0x45')],null))[_0x2d90('0x21')](respondWithResult(_0xb6ef2c,null))['catch'](handleError(_0xb6ef2c,null));};exports[_0x2d90('0x47')]=function(_0x179782,_0x1227c8){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x179782[_0x2d90('0x46')]['id']}})[_0x2d90('0x21')](handleEntityNotFound(_0x1227c8,null))[_0x2d90('0x21')](removeEntity(_0x1227c8,null))[_0x2d90('0x43')](handleError(_0x1227c8,null));};exports[_0x2d90('0x48')]=function(_0x3eac81,_0x5ac8fe){return db[_0x2d90('0x28')][_0x2d90('0x48')]()[_0x2d90('0x21')](respondWithResult(_0x5ac8fe,null))[_0x2d90('0x43')](handleError(_0x5ac8fe,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index fbaa0f7..24e6523 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 _0x6646=['request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4d4358,_0x36bc17){var _0x41e4f6=function(_0x2bb4f0){while(--_0x2bb4f0){_0x4d4358['push'](_0x4d4358['shift']());}};_0x41e4f6(++_0x36bc17);}(_0x6646,0x1cb));var _0x6664=function(_0x4f2e9e,_0x21fc36){_0x4f2e9e=_0x4f2e9e-0x0;var _0x1ec515=_0x6646[_0x4f2e9e];return _0x1ec515;};'use strict';var _=require(_0x6664('0x0'));var util=require(_0x6664('0x1'));var logger=require(_0x6664('0x2'))(_0x6664('0x3'));var moment=require(_0x6664('0x4'));var BPromise=require(_0x6664('0x5'));var rp=require(_0x6664('0x6'));var fs=require('fs');var path=require(_0x6664('0x7'));var rimraf=require(_0x6664('0x8'));var config=require(_0x6664('0x9'));var attributes=require(_0x6664('0xa'));module[_0x6664('0xb')]=function(_0x143921,_0x2180e2){return _0x143921[_0x6664('0xc')](_0x6664('0xd'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6664('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7faf=['rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','path'];(function(_0x108db1,_0x89896d){var _0x16848d=function(_0x2726f6){while(--_0x2726f6){_0x108db1['push'](_0x108db1['shift']());}};_0x16848d(++_0x89896d);}(_0x7faf,0x7f));var _0xf7fa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7faf[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf7fa('0x0'));var util=require('util');var logger=require(_0xf7fa('0x1'))('api');var moment=require(_0xf7fa('0x2'));var BPromise=require(_0xf7fa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7fa('0x4'));var rimraf=require(_0xf7fa('0x5'));var config=require('../../config/environment');var attributes=require(_0xf7fa('0x6'));module[_0xf7fa('0x7')]=function(_0x1bfcab,_0x518d74){return _0x1bfcab[_0xf7fa('0x8')](_0xf7fa('0x9'),attributes,{'tableName':_0xf7fa('0xa'),'paranoid':![],'indexes':[{'name':_0xf7fa('0xb'),'fields':[_0xf7fa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 068c767..c1f61a4 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 _0x2f74=['http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x568ebb,_0x5b4be0){var _0x19a438=function(_0x438535){while(--_0x438535){_0x568ebb['push'](_0x568ebb['shift']());}};_0x19a438(++_0x5b4be0);}(_0x2f74,0x7b));var _0x42f7=function(_0x5011f5,_0x92181b){_0x5011f5=_0x5011f5-0x0;var _0x2b0e3f=_0x2f74[_0x5011f5];return _0x2b0e3f;};'use strict';var _=require(_0x42f7('0x0'));var util=require('util');var moment=require(_0x42f7('0x1'));var BPromise=require(_0x42f7('0x2'));var rs=require(_0x42f7('0x3'));var fs=require('fs');var Redis=require(_0x42f7('0x4'));var db=require(_0x42f7('0x5'))['db'];var utils=require(_0x42f7('0x6'));var logger=require(_0x42f7('0x7'))(_0x42f7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x42f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cb6e0,_0x20ff46,_0x36b55e){return new BPromise(function(_0x2c64b2,_0x28fc83){return client[_0x42f7('0xa')](_0x1cb6e0,_0x36b55e)[_0x42f7('0xb')](function(_0x5772a8){logger[_0x42f7('0xc')](_0x42f7('0xd'),_0x20ff46,_0x42f7('0xe'));logger[_0x42f7('0xf')](_0x42f7('0x10'),_0x20ff46,_0x42f7('0xe'),JSON['stringify'](_0x5772a8));if(_0x5772a8[_0x42f7('0x11')]){if(_0x5772a8[_0x42f7('0x11')][_0x42f7('0x12')]===0x1f4){logger[_0x42f7('0x11')](_0x42f7('0xd'),_0x20ff46,_0x5772a8[_0x42f7('0x11')][_0x42f7('0x13')]);return _0x28fc83(_0x5772a8[_0x42f7('0x11')]['message']);}logger['error'](_0x42f7('0xd'),_0x20ff46,_0x5772a8[_0x42f7('0x11')][_0x42f7('0x13')]);return _0x2c64b2(_0x5772a8[_0x42f7('0x11')][_0x42f7('0x13')]);}else{logger['info'](_0x42f7('0xd'),_0x20ff46,'request\x20sent');_0x2c64b2(_0x5772a8[_0x42f7('0x14')][_0x42f7('0x13')]);}})[_0x42f7('0x15')](function(_0x19eff3){logger[_0x42f7('0x11')](_0x42f7('0xd'),_0x20ff46,_0x19eff3);_0x28fc83(_0x19eff3);});});} \ No newline at end of file +var _0x0dee=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x48f5c8,_0x4bc78c){var _0xbd1fbf=function(_0x2ed43f){while(--_0x2ed43f){_0x48f5c8['push'](_0x48f5c8['shift']());}};_0xbd1fbf(++_0x4bc78c);}(_0x0dee,0xf7));var _0xe0de=function(_0x389edf,_0x441a19){_0x389edf=_0x389edf-0x0;var _0x2bdf7e=_0x0dee[_0x389edf];return _0x2bdf7e;};'use strict';var _=require(_0xe0de('0x0'));var util=require(_0xe0de('0x1'));var moment=require('moment');var BPromise=require(_0xe0de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0de('0x3'));var db=require(_0xe0de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0de('0x5'))(_0xe0de('0x6'));var config=require(_0xe0de('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe0de('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe1fd9,_0x5e5250,_0x349fd2){return new BPromise(function(_0x5b644c,_0x25818f){return client['request'](_0xfe1fd9,_0x349fd2)[_0xe0de('0x9')](function(_0x4a5ecd){logger[_0xe0de('0xa')](_0xe0de('0xb'),_0x5e5250,_0xe0de('0xc'));logger[_0xe0de('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x5e5250,_0xe0de('0xc'),JSON[_0xe0de('0xe')](_0x4a5ecd));if(_0x4a5ecd[_0xe0de('0xf')]){if(_0x4a5ecd[_0xe0de('0xf')]['code']===0x1f4){logger['error'](_0xe0de('0xb'),_0x5e5250,_0x4a5ecd[_0xe0de('0xf')]['message']);return _0x25818f(_0x4a5ecd['error'][_0xe0de('0x10')]);}logger[_0xe0de('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5e5250,_0x4a5ecd['error']['message']);return _0x5b644c(_0x4a5ecd['error'][_0xe0de('0x10')]);}else{logger[_0xe0de('0xa')](_0xe0de('0xb'),_0x5e5250,_0xe0de('0xc'));_0x5b644c(_0x4a5ecd[_0xe0de('0x11')][_0xe0de('0x10')]);}})[_0xe0de('0x12')](function(_0x2d8c3d){logger[_0xe0de('0xf')](_0xe0de('0xb'),_0x5e5250,_0x2d8c3d);_0x25818f(_0x2d8c3d);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index ee1a653..250527b 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 _0x3438=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','path'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x3438,0x141));var _0x8343=function(_0x585500,_0x47665d){_0x585500=_0x585500-0x0;var _0x4413cb=_0x3438[_0x585500];return _0x4413cb;};'use strict';var multer=require(_0x8343('0x0'));var util=require('util');var path=require(_0x8343('0x1'));var timeout=require(_0x8343('0x2'));var express=require(_0x8343('0x3'));var router=express['Router']();var fs_extra=require(_0x8343('0x4'));var auth=require(_0x8343('0x5'));var interaction=require(_0x8343('0x6'));var config=require(_0x8343('0x7'));var controller=require(_0x8343('0x8'));router[_0x8343('0x9')]('/',auth[_0x8343('0xa')](),controller[_0x8343('0xb')]);router[_0x8343('0x9')](_0x8343('0xc'),auth[_0x8343('0xa')](),controller['show']);router[_0x8343('0xd')]('/',auth[_0x8343('0xa')](),controller['create']);router[_0x8343('0xe')](_0x8343('0xc'),auth[_0x8343('0xa')](),controller[_0x8343('0xf')]);router[_0x8343('0x10')](_0x8343('0xc'),auth[_0x8343('0xa')](),controller[_0x8343('0x11')]);module[_0x8343('0x12')]=router; \ No newline at end of file +var _0xcb93=['put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','index','show','post','create'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xcb93,0xdc));var _0x3cb9=function(_0x1caaa5,_0x2c1285){_0x1caaa5=_0x1caaa5-0x0;var _0x3f19c7=_0xcb93[_0x1caaa5];return _0x3f19c7;};'use strict';var multer=require(_0x3cb9('0x0'));var util=require(_0x3cb9('0x1'));var path=require(_0x3cb9('0x2'));var timeout=require('connect-timeout');var express=require(_0x3cb9('0x3'));var router=express[_0x3cb9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3cb9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3cb9('0x6'));var controller=require(_0x3cb9('0x7'));router[_0x3cb9('0x8')]('/',auth[_0x3cb9('0x9')](),controller[_0x3cb9('0xa')]);router[_0x3cb9('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3cb9('0xb')]);router[_0x3cb9('0xc')]('/',auth['isAuthenticated'](),controller[_0x3cb9('0xd')]);router[_0x3cb9('0xe')]('/:id',auth[_0x3cb9('0x9')](),controller['update']);router[_0x3cb9('0xf')]('/:id',auth[_0x3cb9('0x9')](),controller[_0x3cb9('0x10')]);module[_0x3cb9('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 1ecc4a3..0055552 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 _0x866e=['exports','STRING','name','sequelize'];(function(_0x278666,_0x4b41c7){var _0x28a7dd=function(_0x156453){while(--_0x156453){_0x278666['push'](_0x278666['shift']());}};_0x28a7dd(++_0x4b41c7);}(_0x866e,0xb7));var _0xe866=function(_0x52e8f6,_0x4809e8){_0x52e8f6=_0x52e8f6-0x0;var _0x1e34e9=_0x866e[_0x52e8f6];return _0x1e34e9;};'use strict';var Sequelize=require(_0xe866('0x0'));module[_0xe866('0x1')]={'name':{'type':Sequelize[_0xe866('0x2')],'unique':_0xe866('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xe866('0x2')]}}; \ No newline at end of file +var _0x38fd=['STRING','sequelize','exports','name'];(function(_0x39edff,_0x2aa400){var _0x33b783=function(_0x578301){while(--_0x578301){_0x39edff['push'](_0x39edff['shift']());}};_0x33b783(++_0x2aa400);}(_0x38fd,0xdd));var _0xd38f=function(_0x22eb92,_0x4e2ae8){_0x22eb92=_0x22eb92-0x0;var _0xd6cd94=_0x38fd[_0x22eb92];return _0xd6cd94;};'use strict';var Sequelize=require(_0xd38f('0x0'));module[_0xd38f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd38f('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xd38f('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index b400dd9..db01b63 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 _0x80d5=['map','Pause','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','findAll','rows','catch','show','params','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Pauses','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../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','destroy','UserProfileResource','sendStatus','error','name','send','index'];(function(_0x5dff0c,_0x2bdeb4){var _0x15615f=function(_0x22956e){while(--_0x22956e){_0x5dff0c['push'](_0x5dff0c['shift']());}};_0x15615f(++_0x2bdeb4);}(_0x80d5,0x76));var _0x580d=function(_0xb83e0b,_0xc4f911){_0xb83e0b=_0xb83e0b-0x0;var _0x41e85b=_0x80d5[_0xb83e0b];return _0x41e85b;};'use strict';var emlformat=require(_0x580d('0x0'));var rimraf=require(_0x580d('0x1'));var zipdir=require(_0x580d('0x2'));var jsonpatch=require(_0x580d('0x3'));var rp=require('request-promise');var moment=require(_0x580d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x580d('0x5'));var util=require(_0x580d('0x6'));var path=require(_0x580d('0x7'));var sox=require(_0x580d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x580d('0x9'));var _=require('lodash');var squel=require(_0x580d('0xa'));var crypto=require(_0x580d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x580d('0xc'));var toCsv=require(_0x580d('0xd'));var querystring=require(_0x580d('0xe'));var Papa=require(_0x580d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x580d('0x10'));var as=require(_0x580d('0x11'));var hardwareService=require(_0x580d('0x12'));var logger=require(_0x580d('0x13'))(_0x580d('0x14'));var utils=require(_0x580d('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x580d('0x16'))['db'];function respondWithStatusCode(_0x328916,_0x45afde){_0x45afde=_0x45afde||0xcc;return function(_0x14dff6){if(_0x14dff6){return _0x328916['sendStatus'](_0x45afde);}return _0x328916[_0x580d('0x17')](_0x45afde)[_0x580d('0x18')]();};}function respondWithResult(_0x4a7120,_0x47f44d){_0x47f44d=_0x47f44d||0xc8;return function(_0x48a407){if(_0x48a407){return _0x4a7120['status'](_0x47f44d)['json'](_0x48a407);}};}function respondWithFilteredResult(_0x15a434,_0x148f10){return function(_0x559bd5){if(_0x559bd5){var _0x3a235a=typeof _0x148f10[_0x580d('0x19')]===_0x580d('0x1a')&&typeof _0x148f10[_0x580d('0x1b')]==='undefined';var _0x225330=_0x559bd5[_0x580d('0x1c')];var _0x56b324=_0x3a235a?0x0:_0x148f10[_0x580d('0x19')];var _0x1522d5=_0x3a235a?_0x559bd5[_0x580d('0x1c')]:_0x148f10[_0x580d('0x19')]+_0x148f10['limit'];var _0x286858;if(_0x1522d5>=_0x225330){_0x1522d5=_0x225330;_0x286858=0xc8;}else{_0x286858=0xce;}_0x15a434[_0x580d('0x17')](_0x286858);return _0x15a434[_0x580d('0x1d')](_0x580d('0x1e'),_0x56b324+'-'+_0x1522d5+'/'+_0x225330)[_0x580d('0x1f')](_0x559bd5);}return null;};}function patchUpdates(_0x461f1f){return function(_0x2b7bab){try{jsonpatch['apply'](_0x2b7bab,_0x461f1f,!![]);}catch(_0x2b4579){return BPromise[_0x580d('0x20')](_0x2b4579);}return _0x2b7bab[_0x580d('0x21')]();};}function saveUpdates(_0x20f903,_0x37fd1c){return function(_0x1ef274){if(_0x1ef274){return _0x1ef274['update'](_0x20f903)[_0x580d('0x22')](function(_0x487bb4){return _0x487bb4;});}return null;};}function removeEntity(_0x38073a,_0x5d7c63){return function(_0x399091){if(_0x399091){return _0x399091[_0x580d('0x23')]()[_0x580d('0x22')](function(){var _0x5d6455=_0x399091['get']({'plain':!![]});var _0x2eb8e0='Pauses';return db[_0x580d('0x24')][_0x580d('0x23')]({'where':{'type':_0x2eb8e0,'resourceId':_0x5d6455['id']}})[_0x580d('0x22')](function(){return _0x399091;});})['then'](function(){_0x38073a[_0x580d('0x17')](0xcc)[_0x580d('0x18')]();});}};}function handleEntityNotFound(_0x43f8ad,_0x46665d){return function(_0x38c598){if(!_0x38c598){_0x43f8ad[_0x580d('0x25')](0x194);}return _0x38c598;};}function handleError(_0x2bc465,_0x5a7b50){_0x5a7b50=_0x5a7b50||0x1f4;return function(_0x34a896){logger[_0x580d('0x26')](_0x34a896['stack']);if(_0x34a896[_0x580d('0x27')]){delete _0x34a896[_0x580d('0x27')];}_0x2bc465['status'](_0x5a7b50)[_0x580d('0x28')](_0x34a896);};}exports[_0x580d('0x29')]=function(_0x1fd2c3,_0x2e54f9){var _0x24243a={},_0x44c411={},_0x59d5f2={'count':0x0,'rows':[]};var _0x3ea9aa=_[_0x580d('0x2a')](db[_0x580d('0x2b')][_0x580d('0x2c')],function(_0x42f915){return{'name':_0x42f915[_0x580d('0x2d')],'type':_0x42f915['type'][_0x580d('0x2e')]};});_0x44c411['model']=_[_0x580d('0x2a')](_0x3ea9aa,_0x580d('0x27'));_0x44c411[_0x580d('0x2f')]=_[_0x580d('0x30')](_0x1fd2c3[_0x580d('0x2f')]);_0x44c411[_0x580d('0x31')]=_[_0x580d('0x32')](_0x44c411[_0x580d('0x33')],_0x44c411['query']);_0x24243a['attributes']=_[_0x580d('0x32')](_0x44c411[_0x580d('0x33')],qs[_0x580d('0x34')](_0x1fd2c3[_0x580d('0x2f')][_0x580d('0x34')]));_0x24243a[_0x580d('0x35')]=_0x24243a[_0x580d('0x35')][_0x580d('0x36')]?_0x24243a[_0x580d('0x35')]:_0x44c411[_0x580d('0x33')];if(!_0x1fd2c3['query'][_0x580d('0x37')](_0x580d('0x38'))){_0x24243a[_0x580d('0x1b')]=qs[_0x580d('0x1b')](_0x1fd2c3[_0x580d('0x2f')][_0x580d('0x1b')]);_0x24243a[_0x580d('0x19')]=qs[_0x580d('0x19')](_0x1fd2c3['query'][_0x580d('0x19')]);}_0x24243a['order']=qs[_0x580d('0x39')](_0x1fd2c3[_0x580d('0x2f')][_0x580d('0x39')]);_0x24243a[_0x580d('0x3a')]=qs['filters'](_['pick'](_0x1fd2c3[_0x580d('0x2f')],_0x44c411[_0x580d('0x31')]),_0x3ea9aa);if(_0x1fd2c3[_0x580d('0x2f')][_0x580d('0x3b')]){_0x24243a[_0x580d('0x3a')]=_[_0x580d('0x3c')](_0x24243a[_0x580d('0x3a')],{'$or':_['map'](_0x3ea9aa,function(_0x5a5d4f){if(_0x5a5d4f['type']!=='VIRTUAL'){var _0x166e3e={};_0x166e3e[_0x5a5d4f['name']]={'$like':'%'+_0x1fd2c3['query']['filter']+'%'};return _0x166e3e;}})});}_0x24243a=_[_0x580d('0x3c')]({},_0x24243a,_0x1fd2c3[_0x580d('0x3d')]);var _0x1be5cb={'where':_0x24243a[_0x580d('0x3a')]};return db[_0x580d('0x2b')][_0x580d('0x1c')](_0x1be5cb)[_0x580d('0x22')](function(_0x544de2){_0x59d5f2[_0x580d('0x1c')]=_0x544de2;if(_0x1fd2c3[_0x580d('0x2f')]['includeAll']){_0x24243a['include']=[{'all':!![]}];}return db['Pause'][_0x580d('0x3e')](_0x24243a);})[_0x580d('0x22')](function(_0x2f3de8){_0x59d5f2[_0x580d('0x3f')]=_0x2f3de8;return _0x59d5f2;})[_0x580d('0x22')](respondWithFilteredResult(_0x2e54f9,_0x24243a))[_0x580d('0x40')](handleError(_0x2e54f9,null));};exports[_0x580d('0x41')]=function(_0x12ba5,_0x519eb5){var _0x2d1f4d={'raw':!![],'where':{'id':_0x12ba5[_0x580d('0x42')]['id']}},_0x373d27={};_0x373d27[_0x580d('0x33')]=_[_0x580d('0x30')](db['Pause'][_0x580d('0x2c')]);_0x373d27[_0x580d('0x2f')]=_[_0x580d('0x30')](_0x12ba5[_0x580d('0x2f')]);_0x373d27[_0x580d('0x31')]=_[_0x580d('0x32')](_0x373d27[_0x580d('0x33')],_0x373d27[_0x580d('0x2f')]);_0x2d1f4d['attributes']=_[_0x580d('0x32')](_0x373d27['model'],qs[_0x580d('0x34')](_0x12ba5[_0x580d('0x2f')]['fields']));_0x2d1f4d['attributes']=_0x2d1f4d[_0x580d('0x35')][_0x580d('0x36')]?_0x2d1f4d[_0x580d('0x35')]:_0x373d27['model'];if(_0x12ba5[_0x580d('0x2f')]['includeAll']){_0x2d1f4d[_0x580d('0x43')]=[{'all':!![]}];}_0x2d1f4d=_['merge']({},_0x2d1f4d,_0x12ba5['options']);return db[_0x580d('0x2b')][_0x580d('0x44')](_0x2d1f4d)[_0x580d('0x22')](handleEntityNotFound(_0x519eb5,null))[_0x580d('0x22')](respondWithResult(_0x519eb5,null))[_0x580d('0x40')](handleError(_0x519eb5,null));};exports[_0x580d('0x45')]=function(_0x4b8ed3,_0x3e4175){return db[_0x580d('0x2b')][_0x580d('0x45')](_0x4b8ed3[_0x580d('0x46')],{})[_0x580d('0x22')](function(_0x3747e6){var _0x1a6d5f=_0x4b8ed3['user'][_0x580d('0x47')]({'plain':!![]});if(!_0x1a6d5f)throw new Error(_0x580d('0x48'));if(_0x1a6d5f[_0x580d('0x49')]===_0x580d('0x4a')){var _0x4f35c1=_0x3747e6[_0x580d('0x47')]({'plain':!![]});var _0x515b40=_0x580d('0x4b');return db[_0x580d('0x4c')][_0x580d('0x44')]({'where':{'name':_0x515b40,'userProfileId':_0x1a6d5f[_0x580d('0x4d')]},'raw':!![]})[_0x580d('0x22')](function(_0x44d7f5){if(_0x44d7f5&&_0x44d7f5['autoAssociation']===0x0){return db[_0x580d('0x24')][_0x580d('0x45')]({'name':_0x4f35c1[_0x580d('0x27')],'resourceId':_0x4f35c1['id'],'type':_0x44d7f5[_0x580d('0x27')],'sectionId':_0x44d7f5['id']},{})[_0x580d('0x22')](function(){return _0x3747e6;});}else{return _0x3747e6;}})[_0x580d('0x40')](function(_0x8d44c5){logger[_0x580d('0x26')](_0x580d('0x4e'),_0x8d44c5);throw _0x8d44c5;});}return _0x3747e6;})['then'](respondWithResult(_0x3e4175,0xc9))[_0x580d('0x40')](handleError(_0x3e4175,null));};exports[_0x580d('0x4f')]=function(_0x5c3c18,_0xe0cdfb){if(_0x5c3c18[_0x580d('0x46')]['id']){delete _0x5c3c18['body']['id'];}return db[_0x580d('0x2b')][_0x580d('0x44')]({'where':{'id':_0x5c3c18[_0x580d('0x42')]['id']}})[_0x580d('0x22')](handleEntityNotFound(_0xe0cdfb,null))['then'](saveUpdates(_0x5c3c18[_0x580d('0x46')],null))[_0x580d('0x22')](respondWithResult(_0xe0cdfb,null))[_0x580d('0x40')](handleError(_0xe0cdfb,null));};exports[_0x580d('0x23')]=function(_0x2a1005,_0x1f4819){return db['Pause']['find']({'where':{'id':_0x2a1005[_0x580d('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f4819,null))[_0x580d('0x22')](removeEntity(_0x1f4819,null))[_0x580d('0x40')](handleError(_0x1f4819,null));}; \ No newline at end of file +var _0xd31a=['type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','rows','catch','show','rawAttributes','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','end','error','stack','name','map','Pause'];(function(_0xcbbc7d,_0x49e121){var _0x2c7d27=function(_0x801ba7){while(--_0x801ba7){_0xcbbc7d['push'](_0xcbbc7d['shift']());}};_0x2c7d27(++_0x49e121);}(_0xd31a,0x1c1));var _0xad31=function(_0x110f0d,_0x4c546d){_0x110f0d=_0x110f0d-0x0;var _0x4d4dff=_0xd31a[_0x110f0d];return _0x4d4dff;};'use strict';var emlformat=require(_0xad31('0x0'));var rimraf=require(_0xad31('0x1'));var zipdir=require(_0xad31('0x2'));var jsonpatch=require(_0xad31('0x3'));var rp=require(_0xad31('0x4'));var moment=require(_0xad31('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xad31('0x6'));var util=require(_0xad31('0x7'));var path=require(_0xad31('0x8'));var sox=require(_0xad31('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad31('0xa'));var squel=require(_0xad31('0xb'));var crypto=require(_0xad31('0xc'));var jsforce=require(_0xad31('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xad31('0xe'));var querystring=require(_0xad31('0xf'));var Papa=require(_0xad31('0x10'));var Redis=require('ioredis');var authService=require(_0xad31('0x11'));var qs=require(_0xad31('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad31('0x13'));var logger=require(_0xad31('0x14'))(_0xad31('0x15'));var utils=require(_0xad31('0x16'));var config=require(_0xad31('0x17'));var licenseUtil=require(_0xad31('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x388c65,_0x2983e1){_0x2983e1=_0x2983e1||0xcc;return function(_0x1beace){if(_0x1beace){return _0x388c65[_0xad31('0x19')](_0x2983e1);}return _0x388c65['status'](_0x2983e1)['end']();};}function respondWithResult(_0x547d3c,_0x3f3319){_0x3f3319=_0x3f3319||0xc8;return function(_0x12d6e1){if(_0x12d6e1){return _0x547d3c[_0xad31('0x1a')](_0x3f3319)[_0xad31('0x1b')](_0x12d6e1);}};}function respondWithFilteredResult(_0x17e841,_0x20f217){return function(_0xcbb0a2){if(_0xcbb0a2){var _0x443f3b=typeof _0x20f217[_0xad31('0x1c')]===_0xad31('0x1d')&&typeof _0x20f217[_0xad31('0x1e')]===_0xad31('0x1d');var _0x30e363=_0xcbb0a2[_0xad31('0x1f')];var _0x14b4cd=_0x443f3b?0x0:_0x20f217[_0xad31('0x1c')];var _0x59f7cb=_0x443f3b?_0xcbb0a2[_0xad31('0x1f')]:_0x20f217[_0xad31('0x1c')]+_0x20f217[_0xad31('0x1e')];var _0x339a19;if(_0x59f7cb>=_0x30e363){_0x59f7cb=_0x30e363;_0x339a19=0xc8;}else{_0x339a19=0xce;}_0x17e841[_0xad31('0x1a')](_0x339a19);return _0x17e841[_0xad31('0x20')](_0xad31('0x21'),_0x14b4cd+'-'+_0x59f7cb+'/'+_0x30e363)[_0xad31('0x1b')](_0xcbb0a2);}return null;};}function patchUpdates(_0x5dd0e2){return function(_0x2f6dbb){try{jsonpatch[_0xad31('0x22')](_0x2f6dbb,_0x5dd0e2,!![]);}catch(_0x10153c){return BPromise[_0xad31('0x23')](_0x10153c);}return _0x2f6dbb[_0xad31('0x24')]();};}function saveUpdates(_0x24d746,_0x4b92f0){return function(_0x1b2824){if(_0x1b2824){return _0x1b2824[_0xad31('0x25')](_0x24d746)[_0xad31('0x26')](function(_0x5727ae){return _0x5727ae;});}return null;};}function removeEntity(_0x1915c9,_0x758473){return function(_0xdbc003){if(_0xdbc003){return _0xdbc003[_0xad31('0x27')]()['then'](function(){var _0x1ddaa4=_0xdbc003[_0xad31('0x28')]({'plain':!![]});var _0x3205d3=_0xad31('0x29');return db[_0xad31('0x2a')][_0xad31('0x27')]({'where':{'type':_0x3205d3,'resourceId':_0x1ddaa4['id']}})[_0xad31('0x26')](function(){return _0xdbc003;});})['then'](function(){_0x1915c9[_0xad31('0x1a')](0xcc)[_0xad31('0x2b')]();});}};}function handleEntityNotFound(_0x3c520,_0xd858d4){return function(_0x5b8f3e){if(!_0x5b8f3e){_0x3c520[_0xad31('0x19')](0x194);}return _0x5b8f3e;};}function handleError(_0x500960,_0x1e434d){_0x1e434d=_0x1e434d||0x1f4;return function(_0x292379){logger[_0xad31('0x2c')](_0x292379[_0xad31('0x2d')]);if(_0x292379[_0xad31('0x2e')]){delete _0x292379[_0xad31('0x2e')];}_0x500960['status'](_0x1e434d)['send'](_0x292379);};}exports['index']=function(_0x302657,_0x3a188a){var _0x56440c={},_0x4940fb={},_0x19db61={'count':0x0,'rows':[]};var _0x4a9190=_[_0xad31('0x2f')](db[_0xad31('0x30')]['rawAttributes'],function(_0x2a24e9){return{'name':_0x2a24e9['fieldName'],'type':_0x2a24e9[_0xad31('0x31')][_0xad31('0x32')]};});_0x4940fb['model']=_[_0xad31('0x2f')](_0x4a9190,_0xad31('0x2e'));_0x4940fb[_0xad31('0x33')]=_[_0xad31('0x34')](_0x302657[_0xad31('0x33')]);_0x4940fb[_0xad31('0x35')]=_[_0xad31('0x36')](_0x4940fb[_0xad31('0x37')],_0x4940fb[_0xad31('0x33')]);_0x56440c[_0xad31('0x38')]=_[_0xad31('0x36')](_0x4940fb['model'],qs[_0xad31('0x39')](_0x302657[_0xad31('0x33')][_0xad31('0x39')]));_0x56440c[_0xad31('0x38')]=_0x56440c['attributes'][_0xad31('0x3a')]?_0x56440c[_0xad31('0x38')]:_0x4940fb[_0xad31('0x37')];if(!_0x302657[_0xad31('0x33')][_0xad31('0x3b')](_0xad31('0x3c'))){_0x56440c['limit']=qs[_0xad31('0x1e')](_0x302657['query']['limit']);_0x56440c['offset']=qs[_0xad31('0x1c')](_0x302657['query'][_0xad31('0x1c')]);}_0x56440c[_0xad31('0x3d')]=qs[_0xad31('0x3e')](_0x302657[_0xad31('0x33')]['sort']);_0x56440c[_0xad31('0x3f')]=qs[_0xad31('0x35')](_[_0xad31('0x40')](_0x302657['query'],_0x4940fb[_0xad31('0x35')]),_0x4a9190);if(_0x302657['query'][_0xad31('0x41')]){_0x56440c[_0xad31('0x3f')]=_[_0xad31('0x42')](_0x56440c[_0xad31('0x3f')],{'$or':_[_0xad31('0x2f')](_0x4a9190,function(_0x415c28){if(_0x415c28[_0xad31('0x31')]!=='VIRTUAL'){var _0x3efd75={};_0x3efd75[_0x415c28[_0xad31('0x2e')]]={'$like':'%'+_0x302657[_0xad31('0x33')]['filter']+'%'};return _0x3efd75;}})});}_0x56440c=_['merge']({},_0x56440c,_0x302657['options']);var _0x5ed0d0={'where':_0x56440c['where']};return db[_0xad31('0x30')][_0xad31('0x1f')](_0x5ed0d0)[_0xad31('0x26')](function(_0x3539c7){_0x19db61[_0xad31('0x1f')]=_0x3539c7;if(_0x302657[_0xad31('0x33')]['includeAll']){_0x56440c[_0xad31('0x43')]=[{'all':!![]}];}return db[_0xad31('0x30')]['findAll'](_0x56440c);})[_0xad31('0x26')](function(_0x3d7e94){_0x19db61[_0xad31('0x44')]=_0x3d7e94;return _0x19db61;})[_0xad31('0x26')](respondWithFilteredResult(_0x3a188a,_0x56440c))[_0xad31('0x45')](handleError(_0x3a188a,null));};exports[_0xad31('0x46')]=function(_0x7a4034,_0x2eb054){var _0xabcf5a={'raw':!![],'where':{'id':_0x7a4034['params']['id']}},_0x320755={};_0x320755[_0xad31('0x37')]=_[_0xad31('0x34')](db['Pause'][_0xad31('0x47')]);_0x320755[_0xad31('0x33')]=_['keys'](_0x7a4034['query']);_0x320755[_0xad31('0x35')]=_[_0xad31('0x36')](_0x320755['model'],_0x320755['query']);_0xabcf5a[_0xad31('0x38')]=_['intersection'](_0x320755[_0xad31('0x37')],qs[_0xad31('0x39')](_0x7a4034[_0xad31('0x33')][_0xad31('0x39')]));_0xabcf5a[_0xad31('0x38')]=_0xabcf5a['attributes'][_0xad31('0x3a')]?_0xabcf5a[_0xad31('0x38')]:_0x320755[_0xad31('0x37')];if(_0x7a4034[_0xad31('0x33')][_0xad31('0x48')]){_0xabcf5a[_0xad31('0x43')]=[{'all':!![]}];}_0xabcf5a=_['merge']({},_0xabcf5a,_0x7a4034[_0xad31('0x49')]);return db[_0xad31('0x30')]['find'](_0xabcf5a)[_0xad31('0x26')](handleEntityNotFound(_0x2eb054,null))[_0xad31('0x26')](respondWithResult(_0x2eb054,null))['catch'](handleError(_0x2eb054,null));};exports[_0xad31('0x4a')]=function(_0x5507d3,_0x3efda9){return db[_0xad31('0x30')]['create'](_0x5507d3['body'],{})[_0xad31('0x26')](function(_0x307f3d){var _0x52e0bc=_0x5507d3[_0xad31('0x4b')]['get']({'plain':!![]});if(!_0x52e0bc)throw new Error(_0xad31('0x4c'));if(_0x52e0bc['role']===_0xad31('0x4b')){var _0x3285c8=_0x307f3d[_0xad31('0x28')]({'plain':!![]});var _0x35b5e3='Pauses';return db[_0xad31('0x4d')][_0xad31('0x4e')]({'where':{'name':_0x35b5e3,'userProfileId':_0x52e0bc['userProfileId']},'raw':!![]})['then'](function(_0x355de0){if(_0x355de0&&_0x355de0[_0xad31('0x4f')]===0x0){return db[_0xad31('0x2a')][_0xad31('0x4a')]({'name':_0x3285c8[_0xad31('0x2e')],'resourceId':_0x3285c8['id'],'type':_0x355de0[_0xad31('0x2e')],'sectionId':_0x355de0['id']},{})[_0xad31('0x26')](function(){return _0x307f3d;});}else{return _0x307f3d;}})[_0xad31('0x45')](function(_0x430cc1){logger['error'](_0xad31('0x50'),_0x430cc1);throw _0x430cc1;});}return _0x307f3d;})[_0xad31('0x26')](respondWithResult(_0x3efda9,0xc9))['catch'](handleError(_0x3efda9,null));};exports[_0xad31('0x25')]=function(_0x443806,_0x4e3b50){if(_0x443806['body']['id']){delete _0x443806[_0xad31('0x51')]['id'];}return db[_0xad31('0x30')][_0xad31('0x4e')]({'where':{'id':_0x443806[_0xad31('0x52')]['id']}})[_0xad31('0x26')](handleEntityNotFound(_0x4e3b50,null))[_0xad31('0x26')](saveUpdates(_0x443806['body'],null))[_0xad31('0x26')](respondWithResult(_0x4e3b50,null))['catch'](handleError(_0x4e3b50,null));};exports['destroy']=function(_0x2682d3,_0x1c4a59){return db['Pause'][_0xad31('0x4e')]({'where':{'id':_0x2682d3[_0xad31('0x52')]['id']}})['then'](handleEntityNotFound(_0x1c4a59,null))[_0xad31('0x26')](removeEntity(_0x1c4a59,null))[_0xad31('0x45')](handleError(_0x1c4a59,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 88600e0..5f25d5d 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 _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x257c77,_0x5d449c){var _0x3edbf9=function(_0x2bbe9c){while(--_0x2bbe9c){_0x257c77['push'](_0x257c77['shift']());}};_0x3edbf9(++_0x5d449c);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5636ca,_0x1ed0af){_0x5636ca=_0x5636ca-0x0;var _0x2baad6=_0x8ef6[_0x5636ca];return _0x2baad6;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index b45df31..947f295 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x187e7c,_0xa4bace){var _0x5d70ad=function(_0x1628a9){while(--_0x1628a9){_0x187e7c['push'](_0x187e7c['shift']());}};_0x5d70ad(++_0xa4bace);}(_0xb10b,0x12a));var _0xbb10=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0xb10b[_0x590851];return _0x3b0115;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0xfe16a8,_0x33d2b7){var _0x318345=function(_0x1bcdb7){while(--_0x1bcdb7){_0xfe16a8['push'](_0xfe16a8['shift']());}};_0x318345(++_0x33d2b7);}(_0x7a54,0x106));var _0x47a5=function(_0x35c936,_0x4bdd02){_0x35c936=_0x35c936-0x0;var _0x47d824=_0x7a54[_0x35c936];return _0x47d824;};'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 026428b..a051905 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 _0x008c=['/:id','/:id/download','join','root','server/files/plugins','originalname','format','basename','extname','now','single','file','upload','post','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','webhookGet'];(function(_0x2cdd7e,_0x37590a){var _0x5583a9=function(_0xbb7aed){while(--_0xbb7aed){_0x2cdd7e['push'](_0x2cdd7e['shift']());}};_0x5583a9(++_0x37590a);}(_0x008c,0x188));var _0xc008=function(_0x2e612a,_0x106dd7){_0x2e612a=_0x2e612a-0x0;var _0x3cb97c=_0x008c[_0x2e612a];return _0x3cb97c;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/webhook',controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0xa')](_0xc008('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1eacfa,_0xc881aa,_0x5b2004){_0x5b2004(null,path[_0xc008('0x10')](config[_0xc008('0x11')],_0xc008('0x12')));},'filename':function(_0x2a5b4e,_0x9ffa93,_0x1819c6){_0x9ffa93[_0xc008('0x13')]=_0x9ffa93['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1819c6(null,util[_0xc008('0x14')]('%s-%s%s',path[_0xc008('0x15')](_0x9ffa93[_0xc008('0x13')],path[_0xc008('0x16')](_0x9ffa93[_0xc008('0x13')])),Date[_0xc008('0x17')](),path['extname'](_0x9ffa93['originalname'])));}})});router['post']('/',upload[_0xc008('0x18')](_0xc008('0x19')),controller[_0xc008('0x1a')]);router[_0xc008('0x1b')]('/webhook',controller['webhookPost']);router['put']('/:id',auth[_0xc008('0xb')](),controller[_0xc008('0x1c')]);router['delete'](_0xc008('0xe'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x6737=['diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','upload','webhookPost','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','isAuthenticated','index','/:id','show','get','download'];(function(_0x19aed7,_0x1c898e){var _0x36734a=function(_0x3ef04b){while(--_0x3ef04b){_0x19aed7['push'](_0x19aed7['shift']());}};_0x36734a(++_0x1c898e);}(_0x6737,0xe2));var _0x7673=function(_0x572c26,_0x5b2083){_0x572c26=_0x572c26-0x0;var _0x3a21be=_0x6737[_0x572c26];return _0x3a21be;};'use strict';var multer=require('multer');var util=require(_0x7673('0x0'));var path=require(_0x7673('0x1'));var timeout=require('connect-timeout');var express=require(_0x7673('0x2'));var router=express[_0x7673('0x3')]();var fs_extra=require(_0x7673('0x4'));var auth=require(_0x7673('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7673('0x6'));var controller=require(_0x7673('0x7'));router['get']('/',auth[_0x7673('0x8')](),controller[_0x7673('0x9')]);router['get']('/webhook',controller['webhookGet']);router['get'](_0x7673('0xa'),auth['isAuthenticated'](),controller[_0x7673('0xb')]);router[_0x7673('0xc')]('/:id/download',auth[_0x7673('0x8')](),controller[_0x7673('0xd')]);var upload=multer({'storage':multer[_0x7673('0xe')]({'destination':function(_0x4d40ce,_0x49fcb2,_0x3ca258){_0x3ca258(null,path['join'](config[_0x7673('0xf')],_0x7673('0x10')));},'filename':function(_0x38090f,_0x451c87,_0x41d6bd){_0x451c87[_0x7673('0x11')]=_0x451c87[_0x7673('0x11')][_0x7673('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41d6bd(null,util[_0x7673('0x13')](_0x7673('0x14'),path['basename'](_0x451c87[_0x7673('0x11')],path[_0x7673('0x15')](_0x451c87[_0x7673('0x11')])),Date[_0x7673('0x16')](),path[_0x7673('0x15')](_0x451c87[_0x7673('0x11')])));}})});router[_0x7673('0x17')]('/',upload['single']('file'),controller[_0x7673('0x18')]);router[_0x7673('0x17')]('/webhook',controller[_0x7673('0x19')]);router[_0x7673('0x1a')]('/:id',auth[_0x7673('0x8')](),controller[_0x7673('0x1b')]);router[_0x7673('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x7673('0x1c')]);module[_0x7673('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index c07b4c1..5771a61 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 _0x5b1d=['script','TEXT','STRING','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never','sequelize','exports','ENUM','html'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x5b1d,0xd8));var _0xd5b1=function(_0x16d867,_0x750c55){_0x16d867=_0x16d867-0x0;var _0x11ad59=_0x5b1d[_0x16d867];return _0x11ad59;};'use strict';var Sequelize=require(_0xd5b1('0x0'));module[_0xd5b1('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd5b1('0x2')](_0xd5b1('0x3'),_0xd5b1('0x4'))},'description':{'type':Sequelize[_0xd5b1('0x5')]},'version':{'type':Sequelize[_0xd5b1('0x5')]},'path':{'type':Sequelize[_0xd5b1('0x6')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd5b1('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0xd5b1('0x8'),'agentOnly',_0xd5b1('0x9'),_0xd5b1('0xa')),'defaultValue':_0xd5b1('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xd5b1('0x6')]},'adminUrl':{'type':Sequelize[_0xd5b1('0x6')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xd5b1('0x6')]},'scriptPath':{'type':Sequelize[_0xd5b1('0x6')]}}; \ No newline at end of file +var _0x3766=['exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','always'];(function(_0x141f25,_0x4f8656){var _0x235cbe=function(_0x3eca8e){while(--_0x3eca8e){_0x141f25['push'](_0x141f25['shift']());}};_0x235cbe(++_0x4f8656);}(_0x3766,0xc0));var _0x6376=function(_0x20d946,_0x5ae5b1){_0x20d946=_0x20d946-0x0;var _0x2f3cd8=_0x3766[_0x20d946];return _0x2f3cd8;};'use strict';var Sequelize=require('sequelize');module[_0x6376('0x0')]={'name':{'type':Sequelize[_0x6376('0x1')]},'type':{'type':Sequelize[_0x6376('0x2')](_0x6376('0x3'),'script')},'description':{'type':Sequelize[_0x6376('0x4')]},'version':{'type':Sequelize[_0x6376('0x4')]},'path':{'type':Sequelize[_0x6376('0x1')],'comment':_0x6376('0x5')},'active':{'type':Sequelize[_0x6376('0x6')],'defaultValue':0x0,'comment':_0x6376('0x7')},'sidebar':{'type':Sequelize[_0x6376('0x2')](_0x6376('0x8'),_0x6376('0x9'),'always',_0x6376('0xa')),'defaultValue':_0x6376('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x6376('0x1')]},'adminUrl':{'type':Sequelize[_0x6376('0x1')]},'agentUrl':{'type':Sequelize[_0x6376('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x6376('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 59e555e..14e5bae 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 _0x99c6=['dirname','attachments/**/*','close','existsSync','Plugin\x20not\x20found','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','filename','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','script','scriptPath','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','Plugins','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','method','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./plugin.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','then','error','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','Plugin','includeAll','include','findAll','rows','catch','show','params','find','download','join','server/files/plugins','format','basename','createWriteStream','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','root'];(function(_0x4307ff,_0x10ac51){var _0x4ed2fc=function(_0x39cef9){while(--_0x39cef9){_0x4307ff['push'](_0x4307ff['shift']());}};_0x4ed2fc(++_0x10ac51);}(_0x99c6,0xf9));var _0x699c=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x99c6[_0x45bf86];return _0x1f02b7;};'use strict';var emlformat=require(_0x699c('0x0'));var rimraf=require(_0x699c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x699c('0x2'));var rp=require(_0x699c('0x3'));var moment=require('moment');var BPromise=require(_0x699c('0x4'));var Mustache=require(_0x699c('0x5'));var util=require('util');var path=require(_0x699c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x699c('0x7'));var fs=require('fs');var fs_extra=require(_0x699c('0x8'));var _=require(_0x699c('0x9'));var squel=require(_0x699c('0xa'));var crypto=require(_0x699c('0xb'));var jsforce=require(_0x699c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x699c('0xd'));var querystring=require(_0x699c('0xe'));var Papa=require(_0x699c('0xf'));var extract=require('extract-zip');var rimraf=require(_0x699c('0x1'));var archiver=require(_0x699c('0x10'));var Redis=require('ioredis');var authService=require(_0x699c('0x11'));var qs=require(_0x699c('0x12'));var as=require(_0x699c('0x13'));var hardwareService=require(_0x699c('0x14'));var logger=require('../../config/logger')(_0x699c('0x15'));var utils=require(_0x699c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x699c('0x17'));var db=require('../../mysqldb')['db'];config[_0x699c('0x18')]=_[_0x699c('0x19')](config[_0x699c('0x18')],{'host':_0x699c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x699c('0x18')]));require(_0x699c('0x1b'))['register'](socket);function respondWithStatusCode(_0x4b6904,_0x45f071){_0x45f071=_0x45f071||0xcc;return function(_0x442a38){if(_0x442a38){return _0x4b6904[_0x699c('0x1c')](_0x45f071);}return _0x4b6904[_0x699c('0x1d')](_0x45f071)[_0x699c('0x1e')]();};}function respondWithResult(_0xdaab99,_0x48e9ad){_0x48e9ad=_0x48e9ad||0xc8;return function(_0x5d04f9){if(_0x5d04f9){return _0xdaab99[_0x699c('0x1d')](_0x48e9ad)[_0x699c('0x1f')](_0x5d04f9);}};}function respondWithFilteredResult(_0x58553c,_0x2d4860){return function(_0x6fe6dc){if(_0x6fe6dc){var _0x5c2e60=typeof _0x2d4860[_0x699c('0x20')]===_0x699c('0x21')&&typeof _0x2d4860['limit']===_0x699c('0x21');var _0x4d160a=_0x6fe6dc[_0x699c('0x22')];var _0x264c70=_0x5c2e60?0x0:_0x2d4860['offset'];var _0x26f828=_0x5c2e60?_0x6fe6dc[_0x699c('0x22')]:_0x2d4860['offset']+_0x2d4860[_0x699c('0x23')];var _0x36ac56;if(_0x26f828>=_0x4d160a){_0x26f828=_0x4d160a;_0x36ac56=0xc8;}else{_0x36ac56=0xce;}_0x58553c[_0x699c('0x1d')](_0x36ac56);return _0x58553c[_0x699c('0x24')]('Content-Range',_0x264c70+'-'+_0x26f828+'/'+_0x4d160a)[_0x699c('0x1f')](_0x6fe6dc);}return null;};}function patchUpdates(_0x2f6914){return function(_0x419f0d){try{jsonpatch['apply'](_0x419f0d,_0x2f6914,!![]);}catch(_0x51d2c3){return BPromise[_0x699c('0x25')](_0x51d2c3);}return _0x419f0d['save']();};}function saveUpdates(_0x1e1bc6,_0x331af6){return function(_0x415426){if(_0x415426){return _0x415426['update'](_0x1e1bc6)[_0x699c('0x26')](function(_0x3186b0){return _0x3186b0;});}return null;};}function removeEntity(_0x26f95c,_0xc8a85){return function(_0x59e9c4){if(_0x59e9c4){return _0x59e9c4['destroy']()['then'](function(){var _0x71def6=_0x59e9c4['get']({'plain':!![]});var _0x47b548='Plugins';return db['UserProfileResource']['destroy']({'where':{'type':_0x47b548,'resourceId':_0x71def6['id']}})['then'](function(){return _0x59e9c4;});})[_0x699c('0x26')](function(){_0x26f95c[_0x699c('0x1d')](0xcc)[_0x699c('0x1e')]();});}};}function handleEntityNotFound(_0x4cedd0,_0x15d6e5){return function(_0x34bf6d){if(!_0x34bf6d){_0x4cedd0[_0x699c('0x1c')](0x194);}return _0x34bf6d;};}function handleError(_0x1fe992,_0x4c0ac1){_0x4c0ac1=_0x4c0ac1||0x1f4;return function(_0x1296af){logger[_0x699c('0x27')](_0x1296af['stack']);if(_0x1296af[_0x699c('0x28')]){delete _0x1296af[_0x699c('0x28')];}_0x1fe992[_0x699c('0x1d')](_0x4c0ac1)['send'](_0x1296af);};}exports[_0x699c('0x29')]=function(_0x31f46d,_0x4d45b3){var _0x547a3e={},_0x54f0df={},_0x55c95d={'count':0x0,'rows':[]};var _0x3e3052=_[_0x699c('0x2a')](db['Plugin'][_0x699c('0x2b')],function(_0x3c4420){return{'name':_0x3c4420[_0x699c('0x2c')],'type':_0x3c4420['type']['key']};});_0x54f0df[_0x699c('0x2d')]=_[_0x699c('0x2a')](_0x3e3052,_0x699c('0x28'));_0x54f0df[_0x699c('0x2e')]=_[_0x699c('0x2f')](_0x31f46d[_0x699c('0x2e')]);_0x54f0df[_0x699c('0x30')]=_[_0x699c('0x31')](_0x54f0df[_0x699c('0x2d')],_0x54f0df[_0x699c('0x2e')]);_0x547a3e[_0x699c('0x32')]=_[_0x699c('0x31')](_0x54f0df[_0x699c('0x2d')],qs['fields'](_0x31f46d['query'][_0x699c('0x33')]));_0x547a3e[_0x699c('0x32')]=_0x547a3e[_0x699c('0x32')][_0x699c('0x34')]?_0x547a3e[_0x699c('0x32')]:_0x54f0df[_0x699c('0x2d')];if(!_0x31f46d['query'][_0x699c('0x35')](_0x699c('0x36'))){_0x547a3e[_0x699c('0x23')]=qs['limit'](_0x31f46d['query'][_0x699c('0x23')]);_0x547a3e[_0x699c('0x20')]=qs[_0x699c('0x20')](_0x31f46d['query'][_0x699c('0x20')]);}_0x547a3e[_0x699c('0x37')]=qs[_0x699c('0x38')](_0x31f46d[_0x699c('0x2e')][_0x699c('0x38')]);_0x547a3e[_0x699c('0x39')]=qs[_0x699c('0x30')](_[_0x699c('0x3a')](_0x31f46d[_0x699c('0x2e')],_0x54f0df[_0x699c('0x30')]),_0x3e3052);if(_0x31f46d[_0x699c('0x2e')][_0x699c('0x3b')]){_0x547a3e[_0x699c('0x39')]=_['merge'](_0x547a3e[_0x699c('0x39')],{'$or':_[_0x699c('0x2a')](_0x3e3052,function(_0x682a9f){if(_0x682a9f[_0x699c('0x3c')]!==_0x699c('0x3d')){var _0x210ff3={};_0x210ff3[_0x682a9f[_0x699c('0x28')]]={'$like':'%'+_0x31f46d[_0x699c('0x2e')][_0x699c('0x3b')]+'%'};return _0x210ff3;}})});}_0x547a3e=_[_0x699c('0x3e')]({},_0x547a3e,_0x31f46d[_0x699c('0x3f')]);var _0x1d35fd={'where':_0x547a3e[_0x699c('0x39')]};return db[_0x699c('0x40')][_0x699c('0x22')](_0x1d35fd)['then'](function(_0x27daef){_0x55c95d['count']=_0x27daef;if(_0x31f46d[_0x699c('0x2e')][_0x699c('0x41')]){_0x547a3e[_0x699c('0x42')]=[{'all':!![]}];}return db[_0x699c('0x40')][_0x699c('0x43')](_0x547a3e);})[_0x699c('0x26')](function(_0x3d592b){_0x55c95d[_0x699c('0x44')]=_0x3d592b;return _0x55c95d;})[_0x699c('0x26')](respondWithFilteredResult(_0x4d45b3,_0x547a3e))[_0x699c('0x45')](handleError(_0x4d45b3,null));};exports[_0x699c('0x46')]=function(_0x4a52af,_0x19d579){var _0x21171d={'raw':!![],'where':{'id':_0x4a52af[_0x699c('0x47')]['id']}},_0x2fe4e5={};_0x2fe4e5[_0x699c('0x2d')]=_[_0x699c('0x2f')](db[_0x699c('0x40')][_0x699c('0x2b')]);_0x2fe4e5[_0x699c('0x2e')]=_[_0x699c('0x2f')](_0x4a52af[_0x699c('0x2e')]);_0x2fe4e5['filters']=_[_0x699c('0x31')](_0x2fe4e5[_0x699c('0x2d')],_0x2fe4e5['query']);_0x21171d['attributes']=_[_0x699c('0x31')](_0x2fe4e5[_0x699c('0x2d')],qs[_0x699c('0x33')](_0x4a52af['query'][_0x699c('0x33')]));_0x21171d[_0x699c('0x32')]=_0x21171d['attributes'][_0x699c('0x34')]?_0x21171d[_0x699c('0x32')]:_0x2fe4e5['model'];if(_0x4a52af['query'][_0x699c('0x41')]){_0x21171d[_0x699c('0x42')]=[{'all':!![]}];}_0x21171d=_['merge']({},_0x21171d,_0x4a52af[_0x699c('0x3f')]);return db[_0x699c('0x40')][_0x699c('0x48')](_0x21171d)['then'](handleEntityNotFound(_0x19d579,null))[_0x699c('0x26')](respondWithResult(_0x19d579,null))[_0x699c('0x45')](handleError(_0x19d579,null));};exports[_0x699c('0x49')]=function(_0xb7a47c,_0xcf188,_0x2e2b7d){return db[_0x699c('0x40')][_0x699c('0x48')]({'where':{'id':_0xb7a47c['params']['id']},'attributes':[_0x699c('0x28'),_0x699c('0x6')],'raw':!![]})['then'](handleEntityNotFound(_0xcf188,null))[_0x699c('0x26')](function(_0x4816d2){if(_0x4816d2){var _0x2e91de=path[_0x699c('0x4a')](config['root'],_0x699c('0x4b'),util[_0x699c('0x4c')]('%s.zip',path[_0x699c('0x4d')](_0x4816d2[_0x699c('0x6')])));var _0x3b3242=fs[_0x699c('0x4e')](_0x2e91de);var _0x124a0c=archiver('zip',{'zlib':{'level':0x9}});_0x124a0c['on']('warning',function(_0x3aec7d){if(_0x3aec7d[_0x699c('0x4f')]===_0x699c('0x50')){logger[_0x699c('0x27')](_0x3aec7d);}else{throw new db[(_0x699c('0x51'))]['Error'](_0x699c('0x52'));}});_0x124a0c['on']('error',function(_0x45cc9b){throw new db['Sequelize'][(_0x699c('0x53'))](_0x699c('0x52'));});_0x124a0c['pipe'](_0x3b3242);_0x124a0c[_0x699c('0x54')](_0x699c('0x55'),{'cwd':path[_0x699c('0x4a')](config[_0x699c('0x56')],'server/files/plugins',path[_0x699c('0x57')](_0x4816d2[_0x699c('0x6')])),'ignore':[path[_0x699c('0x4a')](path[_0x699c('0x4d')](_0x4816d2[_0x699c('0x6')]),'node_modules/**/*'),path[_0x699c('0x4a')](path['basename'](_0x4816d2[_0x699c('0x6')]),_0x699c('0x58'))],'nodir':!![]})['finalize']();_0x3b3242['on'](_0x699c('0x59'),function(){if(!fs[_0x699c('0x5a')](_0x2e91de)){throw new db[(_0x699c('0x51'))]['Error'](_0x699c('0x5b'));}return _0xcf188[_0x699c('0x49')](_0x2e91de,util[_0x699c('0x4c')]('%s.zip',path['basename'](_0x4816d2['path'])),function(_0x42e61e){if(_0x42e61e){throw new db['Sequelize']['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x699c('0x5c')](_0x2e91de);logger['info'](_0x699c('0x5d'));logger[_0x699c('0x5e')](_0x699c('0x5f'));});});}return null;})['catch'](handleError(_0xcf188,null));};exports[_0x699c('0x60')]=function(_0x508f98,_0x43437a,_0x14f566){var _0x439edf=path[_0x699c('0x4d')](_0x508f98['file'][_0x699c('0x61')],path['extname'](_0x508f98[_0x699c('0x62')][_0x699c('0x61')]));var _0x18faac=path[_0x699c('0x4a')](config[_0x699c('0x56')],_0x699c('0x4b'),_0x508f98[_0x699c('0x62')][_0x699c('0x61')]);var _0x22328b=path['join'](config[_0x699c('0x56')],'server/files/plugins',_0x439edf);logger[_0x699c('0x5e')](_0x699c('0x63'),_0x18faac);logger[_0x699c('0x5e')](_0x699c('0x64'),_0x22328b);try{fs[_0x699c('0x65')](_0x18faac,parseInt(_0x699c('0x66'),0x8));extract(_0x18faac,{'dir':_0x22328b},function(_0x1e10d3){if(_0x1e10d3){logger[_0x699c('0x27')](_0x1e10d3);handleError(_0x1e10d3,!![]);};var _0x2176c4=fs[_0x699c('0x67')](_0x22328b);if(_0x2176c4[_0x699c('0x34')]>0x1){removeReferences(_0x18faac,_0x22328b);logger[_0x699c('0x27')]('Invalid\x20plugin\x20structure');return _0x14f566(new Error(_0x699c('0x68')));}var _0x4535f8=fs[_0x699c('0x69')](path[_0x699c('0x4a')](_0x22328b,_0x2176c4[0x0]));if(_0x4535f8[_0x699c('0x6a')]()){removeReferences(_0x18faac,_0x22328b);logger[_0x699c('0x27')](_0x699c('0x68'));return _0x14f566(new Error(_0x699c('0x68')));}if(_0x4535f8[_0x699c('0x6b')]()){var _0x1cde47=fs[_0x699c('0x67')](path[_0x699c('0x4a')](_0x22328b,_0x2176c4[0x0]));if(_0x1cde47['length']===0x0){removeReferences(_0x18faac,_0x22328b);logger['error']('Invalid\x20plugin\x20structure');return _0x14f566(new Error(_0x699c('0x68')));}var _0x59b121=_0x1cde47[_0x699c('0x6c')](function(_0x2b69c3){return _0x2b69c3===_0x699c('0x6d');});if(!_0x59b121){return _0x14f566(new Error(_0x699c('0x6e')));}var _0x5cf738=fs[_0x699c('0x6f')](path[_0x699c('0x4a')](_0x22328b,_0x2176c4[0x0],_0x699c('0x6d')));var _0x4561d0=JSON[_0x699c('0x70')](_0x5cf738);if(_0x699c('0x21')==typeof _0x4561d0[_0x699c('0x28')]){return _0x14f566(new Error(_0x699c('0x71')));}if(_0x699c('0x21')==typeof _0x4561d0[_0x699c('0x3c')]){return _0x14f566(new Error(_0x699c('0x72')));}if(_0x699c('0x21')==typeof _0x4561d0[_0x699c('0x73')]){return _0x14f566(new Error(_0x699c('0x74')));}if('undefined'==typeof _0x4561d0['parameters']){return _0x14f566(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4561d0[_0x699c('0x3c')]===_0x699c('0x75')){if('undefined'==typeof _0x4561d0[_0x699c('0x76')][_0x699c('0x77')]){return _0x14f566(new Error(_0x699c('0x78')));}if('undefined'==typeof _0x4561d0['parameters'][_0x699c('0x77')][_0x699c('0x79')]&&_0x699c('0x21')==typeof _0x4561d0[_0x699c('0x76')][_0x699c('0x77')][_0x699c('0x7a')]){return _0x14f566(new Error(_0x699c('0x7b')));}}else if(_0x4561d0[_0x699c('0x3c')]==='script'){if(_0x699c('0x21')==typeof _0x4561d0[_0x699c('0x76')][_0x699c('0x7c')]){return _0x14f566(new Error(_0x699c('0x7d')));}if(_0x699c('0x21')==typeof _0x4561d0['parameters']['scriptPath']){return _0x14f566(new Error(_0x699c('0x7e')));}}else{return _0x14f566(new Error(_0x699c('0x7f')));}var _0x408108=_0x4561d0[_0x699c('0x28')];var _0xc7598a=_0x4561d0[_0x699c('0x80')];var _0x220411=_0x4561d0[_0x699c('0x3c')];var _0x252d51=_0x4561d0[_0x699c('0x81')]?_0x4561d0[_0x699c('0x81')]:_0x699c('0x82');var _0x14f3cd=_0x4561d0[_0x699c('0x83')]?_0x4561d0[_0x699c('0x83')]:_0x699c('0x84');var _0x172d63='';var _0x5283ff='';var _0x18888a='';var _0x2318c1='';var _0x1332b3=_0x4561d0[_0x699c('0x73')];if(_0x220411===_0x699c('0x75')){if(_0x699c('0x21')!=typeof _0x4561d0[_0x699c('0x76')]['views'][_0x699c('0x79')]){var _0x4ca2d0=_0x4561d0['parameters'][_0x699c('0x77')][_0x699c('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x699c('0x85')](_0x4ca2d0)){_0x172d63=path[_0x699c('0x4a')]('plugins',_0x439edf,_0x2176c4[0x0],_0x4ca2d0);}else{_0x172d63=_0x4ca2d0;}}else{logger[_0x699c('0x5e')](_0x699c('0x86'));}if(_0x699c('0x21')!=typeof _0x4561d0[_0x699c('0x76')][_0x699c('0x77')]['agent']){var _0x2576c4=_0x4561d0['parameters'][_0x699c('0x77')][_0x699c('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x699c('0x85')](_0x2576c4)){_0x5283ff=path[_0x699c('0x4a')](_0x699c('0x87'),_0x439edf,_0x2176c4[0x0],_0x2576c4);}else{_0x5283ff=_0x2576c4;}}else{logger[_0x699c('0x5e')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x220411===_0x699c('0x88')){_0x18888a=_0x4561d0[_0x699c('0x76')][_0x699c('0x7c')];_0x2318c1=_0x4561d0['parameters'][_0x699c('0x89')];if(_0x699c('0x21')!=typeof _0x4561d0[_0x699c('0x76')][_0x699c('0x77')]){if(_0x699c('0x21')!=typeof _0x4561d0[_0x699c('0x76')][_0x699c('0x77')]['admin']){var _0x4ca2d0=_0x4561d0[_0x699c('0x76')][_0x699c('0x77')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x699c('0x85')](_0x4ca2d0)){_0x172d63=path[_0x699c('0x4a')]('plugins',_0x439edf,_0x2176c4[0x0],_0x4ca2d0);}else{_0x172d63=_0x4ca2d0;}}if(_0x699c('0x21')!=typeof _0x4561d0['parameters'][_0x699c('0x77')][_0x699c('0x7a')]){var _0x2576c4=_0x4561d0[_0x699c('0x76')][_0x699c('0x77')][_0x699c('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x699c('0x85')](_0x2576c4)){_0x5283ff=path[_0x699c('0x4a')]('plugins',_0x439edf,_0x2176c4[0x0],_0x2576c4);}else{_0x5283ff=_0x2576c4;}}}}var _0x378247={'name':_0x408108,'description':_0xc7598a,'path':path['join'](_0x439edf,_0x2176c4[0x0]),'type':_0x220411,'sidebar':_0x252d51,'icon':_0x14f3cd,'adminUrl':_0x172d63,'agentUrl':_0x5283ff,'scriptName':_0x18888a,'scriptPath':_0x2318c1,'version':_0x1332b3};removeReferences(_0x18faac,null);return db[_0x699c('0x40')]['create'](_0x378247)[_0x699c('0x26')](function(_0x2c5ebc){var _0x5bb74a={'role':_0x508f98['body'][_0x699c('0x8a')],'userProfileId':_0x508f98[_0x699c('0x8b')][_0x699c('0x8c')]};if(!_0x5bb74a)throw new Error(_0x699c('0x8d'));if(_0x5bb74a[_0x699c('0x8a')]===_0x699c('0x8e')){var _0x5c33d2=_0x2c5ebc[_0x699c('0x8f')]({'plain':!![]});return db[_0x699c('0x90')][_0x699c('0x48')]({'where':{'name':_0x699c('0x91'),'userProfileId':_0x5bb74a['userProfileId']},'raw':!![]})[_0x699c('0x26')](function(_0x379eb2){if(_0x379eb2&&_0x379eb2[_0x699c('0x92')]===0x0){return db[_0x699c('0x93')][_0x699c('0x94')]({'name':_0x5c33d2[_0x699c('0x28')],'resourceId':_0x5c33d2['id'],'type':_0x379eb2['name'],'sectionId':_0x379eb2['id']},{})[_0x699c('0x26')](function(){return _0x2c5ebc;});}else{return _0x2c5ebc;}})[_0x699c('0x45')](function(_0x330e45){logger['error'](_0x699c('0x95'),_0x330e45);throw _0x330e45;});}return _0x2c5ebc;})[_0x699c('0x26')](respondWithResult(_0x43437a,null))[_0x699c('0x45')](handleError(_0x43437a,null));}});}catch(_0xcb894a){_0x43437a['status'](0x1f4)['send'](_0xcb894a);}};function removeReferences(_0x5b50fd,_0x303718){try{if(_0x5b50fd){fs[_0x699c('0x5c')](_0x5b50fd);logger[_0x699c('0x5e')](_0x699c('0x96'));}if(_0x303718){rimraf(_0x303718,function(){});logger['info'](_0x699c('0x97'));}}catch(_0x296e8f){logger[_0x699c('0x27')](_0x296e8f);}}exports[_0x699c('0x98')]=function(_0x3d2660,_0x3219ca,_0x2abaaa){return db[_0x699c('0x40')][_0x699c('0x48')]({'where':{'id':_0x3d2660[_0x699c('0x47')]['id']}})[_0x699c('0x26')](handleEntityNotFound(_0x3219ca,null))[_0x699c('0x26')](saveUpdates(_0x3d2660[_0x699c('0x8b')],null))[_0x699c('0x26')](respondWithResult(_0x3219ca,null))['catch'](handleError(_0x3219ca,null));};exports['delete']=function(_0x2e223e,_0x45a753,_0x54b138){return db['Plugin']['find']({'where':{'id':_0x2e223e[_0x699c('0x47')]['id']}})[_0x699c('0x26')](function(_0x21adb9){if(_0x21adb9){return _0x21adb9['destroy']();}})['then'](function(_0x13bfd6){rimraf(path[_0x699c('0x4a')](config[_0x699c('0x56')],_0x699c('0x4b'),path[_0x699c('0x57')](_0x13bfd6['path'])),function(){});return _0x13bfd6;})[_0x699c('0x26')](handleEntityNotFound(_0x45a753,null))[_0x699c('0x26')](respondWithStatusCode(_0x45a753,null))[_0x699c('0x45')](handleError(_0x45a753,null));};exports['webhookGet']=function(_0x340e4c,_0x6eba49,_0x2481d3){return BPromise[_0x699c('0x99')]()[_0x699c('0x26')](function(){if(!_0x340e4c[_0x699c('0x2e')][_0x699c('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x340e4c[_0x699c('0x2e')][_0x699c('0x9a')]){throw new Error(_0x699c('0x9b'));}var _0x1d69f7=_0x340e4c['query'][_0x699c('0x9c')]?_0x340e4c[_0x699c('0x2e')]['hostname']+':'+_0x340e4c[_0x699c('0x2e')]['port']:_0x699c('0x9d')+_0x340e4c['query'][_0x699c('0x9a')];var _0xd2a0a0=_0x340e4c[_0x699c('0x2e')]['json']?_0x340e4c[_0x699c('0x2e')][_0x699c('0x1f')]:!![];var _0x16a41e=_0x340e4c[_0x699c('0x2e')][_0x699c('0x9e')]?_0x340e4c[_0x699c('0x2e')]['encoding']:null;var _0x37d79a={'method':_0x340e4c['method'],'uri':util[_0x699c('0x4c')](_0x699c('0x9f'),_0x1d69f7,_0x340e4c[_0x699c('0x2e')][_0x699c('0x6')]),'json':_0xd2a0a0,'resolveWithFullResponse':!![],'encoding':_0x16a41e,'qs':_0x340e4c[_0x699c('0x2e')]};if(_0x340e4c[_0x699c('0xa0')]){_0x37d79a[_0x699c('0xa0')]=_0x340e4c[_0x699c('0xa0')];if(_0x37d79a['headers'][_0x699c('0xa1')]){delete _0x37d79a[_0x699c('0xa0')][_0x699c('0xa1')];}}if(_0x37d79a[_0x699c('0xa0')][_0x699c('0xa2')]){delete _0x37d79a[_0x699c('0xa0')][_0x699c('0xa2')];}return rp(_0x37d79a);})[_0x699c('0x26')](function(_0x463982){if(_0x463982){_0x6eba49[_0x699c('0x24')](_0x463982[_0x699c('0xa0')]);logger[_0x699c('0x5e')](_0x463982[_0x699c('0x8b')]);if(_[_0x699c('0xa3')](_0x340e4c[_0x699c('0x2e')][_0x699c('0x6')],_0x699c('0x49'))&&_0x463982['statusCode']==0x1f4){return _0x6eba49['sendStatus'](_0x463982[_0x699c('0xa4')]);}else{return _0x6eba49[_0x699c('0x1d')](_0x463982[_0x699c('0xa4')])['send'](_0x463982[_0x699c('0x8b')]);}}else{return _0x6eba49[_0x699c('0x1c')](0xc8);}})[_0x699c('0x45')](handleError(_0x6eba49,null));};exports[_0x699c('0xa5')]=function(_0x19de21,_0x11344b,_0x50dcf5){return BPromise[_0x699c('0x99')]()[_0x699c('0x26')](function(){if(!_0x19de21[_0x699c('0x2e')][_0x699c('0x6')]){throw new Error(_0x699c('0xa6'));}if(!_0x19de21['query'][_0x699c('0x9a')]){throw new Error(_0x699c('0x9b'));}var _0x28c5a6=_0x19de21['query'][_0x699c('0x9c')]?_0x19de21[_0x699c('0x2e')][_0x699c('0x9c')]+':'+_0x19de21[_0x699c('0x2e')][_0x699c('0x9a')]:'http://localhost:'+_0x19de21[_0x699c('0x2e')][_0x699c('0x9a')];var _0x158df2=_0x19de21[_0x699c('0x2e')][_0x699c('0x1f')]?_0x19de21[_0x699c('0x2e')]['json']:!![];var _0x5bad33=_0x19de21[_0x699c('0x2e')][_0x699c('0x9e')]?_0x19de21[_0x699c('0x2e')][_0x699c('0x9e')]:null;var _0x41331f={'method':_0x19de21[_0x699c('0xa7')],'uri':util['format'](_0x699c('0x9f'),_0x28c5a6,_0x19de21[_0x699c('0x2e')][_0x699c('0x6')]),'json':_0x158df2,'resolveWithFullResponse':!![],'encoding':_0x5bad33,'body':_0x19de21[_0x699c('0x8b')]};if(_0x19de21[_0x699c('0xa0')]){_0x41331f[_0x699c('0xa0')]=_0x19de21[_0x699c('0xa0')];if(_0x41331f[_0x699c('0xa0')]['content-length']){delete _0x41331f[_0x699c('0xa0')][_0x699c('0xa1')];}}if(_0x41331f[_0x699c('0xa0')][_0x699c('0xa2')]){delete _0x41331f[_0x699c('0xa0')]['content-type'];}return rp(_0x41331f);})[_0x699c('0x26')](function(_0x4ca0be){if(_0x4ca0be){_0x11344b[_0x699c('0x24')](_0x4ca0be[_0x699c('0xa0')]);logger[_0x699c('0x5e')](_0x4ca0be[_0x699c('0x8b')]);return _0x11344b[_0x699c('0x1d')](_0x4ca0be['statusCode'])['send'](_0x4ca0be[_0x699c('0x8b')]);}else{return _0x11344b[_0x699c('0x1c')](0xc8);}})['catch'](handleError(_0x11344b,null));}; \ No newline at end of file +var _0x7fb8=['index','map','Plugin','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','params','find','download','path','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','catch','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','Zip\x20archive\x20removed','delete','resolve','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','extract-zip','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','error','stack','name','send'];(function(_0x5581ba,_0x268887){var _0x1e927f=function(_0x1803b2){while(--_0x1803b2){_0x5581ba['push'](_0x5581ba['shift']());}};_0x1e927f(++_0x268887);}(_0x7fb8,0x127));var _0x87fb=function(_0x1bf760,_0x19a378){_0x1bf760=_0x1bf760-0x0;var _0x14303b=_0x7fb8[_0x1bf760];return _0x14303b;};'use strict';var emlformat=require(_0x87fb('0x0'));var rimraf=require(_0x87fb('0x1'));var zipdir=require(_0x87fb('0x2'));var jsonpatch=require(_0x87fb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x87fb('0x4'));var Mustache=require(_0x87fb('0x5'));var util=require(_0x87fb('0x6'));var path=require('path');var sox=require(_0x87fb('0x7'));var csv=require(_0x87fb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87fb('0x9'));var squel=require(_0x87fb('0xa'));var crypto=require(_0x87fb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x87fb('0xc'));var toCsv=require(_0x87fb('0x8'));var querystring=require(_0x87fb('0xd'));var Papa=require(_0x87fb('0xe'));var extract=require(_0x87fb('0xf'));var rimraf=require(_0x87fb('0x1'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0x87fb('0x10'));var qs=require(_0x87fb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x87fb('0x12'));var logger=require(_0x87fb('0x13'))(_0x87fb('0x14'));var utils=require(_0x87fb('0x15'));var config=require(_0x87fb('0x16'));var licenseUtil=require(_0x87fb('0x17'));var db=require(_0x87fb('0x18'))['db'];config['redis']=_[_0x87fb('0x19')](config[_0x87fb('0x1a')],{'host':_0x87fb('0x1b'),'port':0x18eb});var socket=require(_0x87fb('0x1c'))(new Redis(config[_0x87fb('0x1a')]));require(_0x87fb('0x1d'))[_0x87fb('0x1e')](socket);function respondWithStatusCode(_0xdc6974,_0x426e6c){_0x426e6c=_0x426e6c||0xcc;return function(_0x4e84a6){if(_0x4e84a6){return _0xdc6974[_0x87fb('0x1f')](_0x426e6c);}return _0xdc6974[_0x87fb('0x20')](_0x426e6c)[_0x87fb('0x21')]();};}function respondWithResult(_0x19ffb6,_0x18af7e){_0x18af7e=_0x18af7e||0xc8;return function(_0xbe1b2d){if(_0xbe1b2d){return _0x19ffb6[_0x87fb('0x20')](_0x18af7e)[_0x87fb('0x22')](_0xbe1b2d);}};}function respondWithFilteredResult(_0x3563ea,_0x288c2a){return function(_0x2621aa){if(_0x2621aa){var _0x21bb6e=typeof _0x288c2a[_0x87fb('0x23')]===_0x87fb('0x24')&&typeof _0x288c2a[_0x87fb('0x25')]===_0x87fb('0x24');var _0x161afd=_0x2621aa[_0x87fb('0x26')];var _0x123552=_0x21bb6e?0x0:_0x288c2a[_0x87fb('0x23')];var _0x25c834=_0x21bb6e?_0x2621aa[_0x87fb('0x26')]:_0x288c2a['offset']+_0x288c2a['limit'];var _0x2fbe75;if(_0x25c834>=_0x161afd){_0x25c834=_0x161afd;_0x2fbe75=0xc8;}else{_0x2fbe75=0xce;}_0x3563ea[_0x87fb('0x20')](_0x2fbe75);return _0x3563ea[_0x87fb('0x27')](_0x87fb('0x28'),_0x123552+'-'+_0x25c834+'/'+_0x161afd)[_0x87fb('0x22')](_0x2621aa);}return null;};}function patchUpdates(_0x2dc760){return function(_0x5b5bba){try{jsonpatch[_0x87fb('0x29')](_0x5b5bba,_0x2dc760,!![]);}catch(_0x110c6c){return BPromise['reject'](_0x110c6c);}return _0x5b5bba['save']();};}function saveUpdates(_0x3ac3be,_0x9a1fba){return function(_0x3b1f73){if(_0x3b1f73){return _0x3b1f73[_0x87fb('0x2a')](_0x3ac3be)[_0x87fb('0x2b')](function(_0x463f14){return _0x463f14;});}return null;};}function removeEntity(_0x34260b,_0x191118){return function(_0x26844a){if(_0x26844a){return _0x26844a[_0x87fb('0x2c')]()[_0x87fb('0x2b')](function(){var _0x31df60=_0x26844a[_0x87fb('0x2d')]({'plain':!![]});var _0x491823='Plugins';return db[_0x87fb('0x2e')]['destroy']({'where':{'type':_0x491823,'resourceId':_0x31df60['id']}})[_0x87fb('0x2b')](function(){return _0x26844a;});})['then'](function(){_0x34260b[_0x87fb('0x20')](0xcc)[_0x87fb('0x21')]();});}};}function handleEntityNotFound(_0x12b84e,_0x3b6031){return function(_0x28dd41){if(!_0x28dd41){_0x12b84e[_0x87fb('0x1f')](0x194);}return _0x28dd41;};}function handleError(_0x4e37eb,_0x1e8b94){_0x1e8b94=_0x1e8b94||0x1f4;return function(_0x1695b6){logger[_0x87fb('0x2f')](_0x1695b6[_0x87fb('0x30')]);if(_0x1695b6[_0x87fb('0x31')]){delete _0x1695b6['name'];}_0x4e37eb['status'](_0x1e8b94)[_0x87fb('0x32')](_0x1695b6);};}exports[_0x87fb('0x33')]=function(_0x3c076b,_0x4b6f66){var _0xacb522={},_0x4be689={},_0x1981cf={'count':0x0,'rows':[]};var _0x2cb1da=_[_0x87fb('0x34')](db[_0x87fb('0x35')]['rawAttributes'],function(_0x583130){return{'name':_0x583130[_0x87fb('0x36')],'type':_0x583130[_0x87fb('0x37')][_0x87fb('0x38')]};});_0x4be689[_0x87fb('0x39')]=_[_0x87fb('0x34')](_0x2cb1da,'name');_0x4be689[_0x87fb('0x3a')]=_[_0x87fb('0x3b')](_0x3c076b[_0x87fb('0x3a')]);_0x4be689[_0x87fb('0x3c')]=_[_0x87fb('0x3d')](_0x4be689['model'],_0x4be689['query']);_0xacb522[_0x87fb('0x3e')]=_[_0x87fb('0x3d')](_0x4be689[_0x87fb('0x39')],qs[_0x87fb('0x3f')](_0x3c076b[_0x87fb('0x3a')]['fields']));_0xacb522[_0x87fb('0x3e')]=_0xacb522[_0x87fb('0x3e')][_0x87fb('0x40')]?_0xacb522[_0x87fb('0x3e')]:_0x4be689[_0x87fb('0x39')];if(!_0x3c076b[_0x87fb('0x3a')][_0x87fb('0x41')](_0x87fb('0x42'))){_0xacb522[_0x87fb('0x25')]=qs[_0x87fb('0x25')](_0x3c076b[_0x87fb('0x3a')][_0x87fb('0x25')]);_0xacb522[_0x87fb('0x23')]=qs['offset'](_0x3c076b['query'][_0x87fb('0x23')]);}_0xacb522[_0x87fb('0x43')]=qs[_0x87fb('0x44')](_0x3c076b['query']['sort']);_0xacb522[_0x87fb('0x45')]=qs[_0x87fb('0x3c')](_[_0x87fb('0x46')](_0x3c076b[_0x87fb('0x3a')],_0x4be689[_0x87fb('0x3c')]),_0x2cb1da);if(_0x3c076b['query'][_0x87fb('0x47')]){_0xacb522[_0x87fb('0x45')]=_['merge'](_0xacb522[_0x87fb('0x45')],{'$or':_['map'](_0x2cb1da,function(_0x317582){if(_0x317582['type']!==_0x87fb('0x48')){var _0x2a6e3b={};_0x2a6e3b[_0x317582[_0x87fb('0x31')]]={'$like':'%'+_0x3c076b['query'][_0x87fb('0x47')]+'%'};return _0x2a6e3b;}})});}_0xacb522=_[_0x87fb('0x49')]({},_0xacb522,_0x3c076b[_0x87fb('0x4a')]);var _0x48b35d={'where':_0xacb522[_0x87fb('0x45')]};return db[_0x87fb('0x35')][_0x87fb('0x26')](_0x48b35d)['then'](function(_0x1e4b93){_0x1981cf['count']=_0x1e4b93;if(_0x3c076b[_0x87fb('0x3a')][_0x87fb('0x4b')]){_0xacb522[_0x87fb('0x4c')]=[{'all':!![]}];}return db[_0x87fb('0x35')][_0x87fb('0x4d')](_0xacb522);})[_0x87fb('0x2b')](function(_0x338bc4){_0x1981cf['rows']=_0x338bc4;return _0x1981cf;})[_0x87fb('0x2b')](respondWithFilteredResult(_0x4b6f66,_0xacb522))['catch'](handleError(_0x4b6f66,null));};exports['show']=function(_0x1dfc0e,_0x4f147e){var _0x531642={'raw':!![],'where':{'id':_0x1dfc0e[_0x87fb('0x4e')]['id']}},_0x3b035f={};_0x3b035f[_0x87fb('0x39')]=_[_0x87fb('0x3b')](db[_0x87fb('0x35')]['rawAttributes']);_0x3b035f[_0x87fb('0x3a')]=_[_0x87fb('0x3b')](_0x1dfc0e['query']);_0x3b035f['filters']=_[_0x87fb('0x3d')](_0x3b035f['model'],_0x3b035f[_0x87fb('0x3a')]);_0x531642[_0x87fb('0x3e')]=_['intersection'](_0x3b035f[_0x87fb('0x39')],qs[_0x87fb('0x3f')](_0x1dfc0e[_0x87fb('0x3a')]['fields']));_0x531642['attributes']=_0x531642[_0x87fb('0x3e')]['length']?_0x531642[_0x87fb('0x3e')]:_0x3b035f[_0x87fb('0x39')];if(_0x1dfc0e['query']['includeAll']){_0x531642['include']=[{'all':!![]}];}_0x531642=_[_0x87fb('0x49')]({},_0x531642,_0x1dfc0e[_0x87fb('0x4a')]);return db[_0x87fb('0x35')][_0x87fb('0x4f')](_0x531642)[_0x87fb('0x2b')](handleEntityNotFound(_0x4f147e,null))[_0x87fb('0x2b')](respondWithResult(_0x4f147e,null))['catch'](handleError(_0x4f147e,null));};exports[_0x87fb('0x50')]=function(_0x4ff518,_0x53d106,_0x2198bb){return db[_0x87fb('0x35')][_0x87fb('0x4f')]({'where':{'id':_0x4ff518[_0x87fb('0x4e')]['id']},'attributes':['name',_0x87fb('0x51')],'raw':!![]})[_0x87fb('0x2b')](handleEntityNotFound(_0x53d106,null))['then'](function(_0x26edc7){if(_0x26edc7){var _0x32d60d=path['join'](config[_0x87fb('0x52')],_0x87fb('0x53'),util[_0x87fb('0x54')](_0x87fb('0x55'),path[_0x87fb('0x56')](_0x26edc7['path'])));var _0x1b8e30=fs[_0x87fb('0x57')](_0x32d60d);var _0x314797=archiver('zip',{'zlib':{'level':0x9}});_0x314797['on'](_0x87fb('0x58'),function(_0x21a75f){if(_0x21a75f[_0x87fb('0x59')]===_0x87fb('0x5a')){logger[_0x87fb('0x2f')](_0x21a75f);}else{throw new db[(_0x87fb('0x5b'))][(_0x87fb('0x5c'))](_0x87fb('0x5d'));}});_0x314797['on'](_0x87fb('0x2f'),function(_0x5e8f23){throw new db[(_0x87fb('0x5b'))]['Error'](_0x87fb('0x5d'));});_0x314797[_0x87fb('0x5e')](_0x1b8e30);_0x314797[_0x87fb('0x5f')](_0x87fb('0x60'),{'cwd':path[_0x87fb('0x61')](config['root'],_0x87fb('0x53'),path[_0x87fb('0x62')](_0x26edc7[_0x87fb('0x51')])),'ignore':[path[_0x87fb('0x61')](path['basename'](_0x26edc7['path']),_0x87fb('0x63')),path[_0x87fb('0x61')](path['basename'](_0x26edc7[_0x87fb('0x51')]),_0x87fb('0x64'))],'nodir':!![]})[_0x87fb('0x65')]();_0x1b8e30['on']('close',function(){if(!fs[_0x87fb('0x66')](_0x32d60d)){throw new db[(_0x87fb('0x5b'))][(_0x87fb('0x5c'))](_0x87fb('0x67'));}return _0x53d106[_0x87fb('0x50')](_0x32d60d,util[_0x87fb('0x54')](_0x87fb('0x55'),path[_0x87fb('0x56')](_0x26edc7['path'])),function(_0x168a80){if(_0x168a80){throw new db['Sequelize'][(_0x87fb('0x5c'))](_0x87fb('0x68'));}fs[_0x87fb('0x69')](_0x32d60d);logger[_0x87fb('0x6a')](_0x87fb('0x6b'));logger[_0x87fb('0x6a')](_0x87fb('0x6c'));});});}return null;})[_0x87fb('0x6d')](handleError(_0x53d106,null));};exports['upload']=function(_0x5a1819,_0x451784,_0x3340ee){var _0x387dac=path[_0x87fb('0x56')](_0x5a1819[_0x87fb('0x6e')][_0x87fb('0x6f')],path[_0x87fb('0x70')](_0x5a1819[_0x87fb('0x6e')]['filename']));var _0x2a8826=path[_0x87fb('0x61')](config[_0x87fb('0x52')],_0x87fb('0x53'),_0x5a1819[_0x87fb('0x6e')][_0x87fb('0x6f')]);var _0x4428c5=path['join'](config[_0x87fb('0x52')],'server/files/plugins',_0x387dac);logger[_0x87fb('0x6a')](_0x87fb('0x71'),_0x2a8826);logger[_0x87fb('0x6a')](_0x87fb('0x72'),_0x4428c5);try{fs[_0x87fb('0x73')](_0x2a8826,parseInt(_0x87fb('0x74'),0x8));extract(_0x2a8826,{'dir':_0x4428c5},function(_0x2dadd0){if(_0x2dadd0){logger[_0x87fb('0x2f')](_0x2dadd0);handleError(_0x2dadd0,!![]);};var _0x321ac3=fs[_0x87fb('0x75')](_0x4428c5);if(_0x321ac3[_0x87fb('0x40')]>0x1){removeReferences(_0x2a8826,_0x4428c5);logger['error'](_0x87fb('0x76'));return _0x3340ee(new Error(_0x87fb('0x76')));}var _0x55d459=fs[_0x87fb('0x77')](path[_0x87fb('0x61')](_0x4428c5,_0x321ac3[0x0]));if(_0x55d459[_0x87fb('0x78')]()){removeReferences(_0x2a8826,_0x4428c5);logger['error'](_0x87fb('0x76'));return _0x3340ee(new Error(_0x87fb('0x76')));}if(_0x55d459[_0x87fb('0x79')]()){var _0x17b943=fs['readdirSync'](path[_0x87fb('0x61')](_0x4428c5,_0x321ac3[0x0]));if(_0x17b943['length']===0x0){removeReferences(_0x2a8826,_0x4428c5);logger['error'](_0x87fb('0x76'));return _0x3340ee(new Error('Invalid\x20plugin\x20structure'));}var _0x15ddb6=_0x17b943[_0x87fb('0x7a')](function(_0x3e64eb){return _0x3e64eb==='manifest.json';});if(!_0x15ddb6){return _0x3340ee(new Error(_0x87fb('0x7b')));}var _0x36ef01=fs[_0x87fb('0x7c')](path[_0x87fb('0x61')](_0x4428c5,_0x321ac3[0x0],_0x87fb('0x7d')));var _0x5d3ed0=JSON[_0x87fb('0x7e')](_0x36ef01);if('undefined'==typeof _0x5d3ed0[_0x87fb('0x31')]){return _0x3340ee(new Error(_0x87fb('0x7f')));}if('undefined'==typeof _0x5d3ed0['type']){return _0x3340ee(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x87fb('0x24')==typeof _0x5d3ed0[_0x87fb('0x80')]){return _0x3340ee(new Error(_0x87fb('0x81')));}if(_0x87fb('0x24')==typeof _0x5d3ed0[_0x87fb('0x82')]){return _0x3340ee(new Error(_0x87fb('0x83')));}if(_0x5d3ed0[_0x87fb('0x37')]===_0x87fb('0x84')){if('undefined'==typeof _0x5d3ed0[_0x87fb('0x82')][_0x87fb('0x85')]){return _0x3340ee(new Error(_0x87fb('0x86')));}if(_0x87fb('0x24')==typeof _0x5d3ed0[_0x87fb('0x82')][_0x87fb('0x85')][_0x87fb('0x87')]&&_0x87fb('0x24')==typeof _0x5d3ed0[_0x87fb('0x82')][_0x87fb('0x85')][_0x87fb('0x88')]){return _0x3340ee(new Error(_0x87fb('0x89')));}}else if(_0x5d3ed0['type']===_0x87fb('0x8a')){if(_0x87fb('0x24')==typeof _0x5d3ed0[_0x87fb('0x82')][_0x87fb('0x8b')]){return _0x3340ee(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x87fb('0x24')==typeof _0x5d3ed0[_0x87fb('0x82')]['scriptPath']){return _0x3340ee(new Error(_0x87fb('0x8c')));}}else{return _0x3340ee(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x19c08c=_0x5d3ed0[_0x87fb('0x31')];var _0x4bbe34=_0x5d3ed0['description'];var _0x44fdb0=_0x5d3ed0['type'];var _0x2994e6=_0x5d3ed0['sidebar']?_0x5d3ed0[_0x87fb('0x8d')]:_0x87fb('0x8e');var _0x4091dc=_0x5d3ed0[_0x87fb('0x8f')]?_0x5d3ed0['icon']:_0x87fb('0x90');var _0x7b64ce='';var _0xeef92d='';var _0x2c0e2b='';var _0x125f5c='';var _0x3f18ca=_0x5d3ed0[_0x87fb('0x80')];if(_0x44fdb0===_0x87fb('0x84')){if(_0x87fb('0x24')!=typeof _0x5d3ed0[_0x87fb('0x82')][_0x87fb('0x85')][_0x87fb('0x87')]){var _0x418719=_0x5d3ed0['parameters'][_0x87fb('0x85')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x87fb('0x91')](_0x418719)){_0x7b64ce=path[_0x87fb('0x61')](_0x87fb('0x92'),_0x387dac,_0x321ac3[0x0],_0x418719);}else{_0x7b64ce=_0x418719;}}else{logger[_0x87fb('0x6a')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x87fb('0x24')!=typeof _0x5d3ed0[_0x87fb('0x82')][_0x87fb('0x85')][_0x87fb('0x88')]){var _0xe62cc3=_0x5d3ed0[_0x87fb('0x82')][_0x87fb('0x85')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0xe62cc3)){_0xeef92d=path[_0x87fb('0x61')](_0x87fb('0x92'),_0x387dac,_0x321ac3[0x0],_0xe62cc3);}else{_0xeef92d=_0xe62cc3;}}else{logger[_0x87fb('0x6a')](_0x87fb('0x93'));}}else if(_0x44fdb0==='script'){_0x2c0e2b=_0x5d3ed0[_0x87fb('0x82')][_0x87fb('0x8b')];_0x125f5c=_0x5d3ed0[_0x87fb('0x82')][_0x87fb('0x94')];if(_0x87fb('0x24')!=typeof _0x5d3ed0[_0x87fb('0x82')]['views']){if(_0x87fb('0x24')!=typeof _0x5d3ed0[_0x87fb('0x82')][_0x87fb('0x85')][_0x87fb('0x87')]){var _0x418719=_0x5d3ed0[_0x87fb('0x82')][_0x87fb('0x85')][_0x87fb('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x87fb('0x91')](_0x418719)){_0x7b64ce=path[_0x87fb('0x61')]('plugins',_0x387dac,_0x321ac3[0x0],_0x418719);}else{_0x7b64ce=_0x418719;}}if('undefined'!=typeof _0x5d3ed0[_0x87fb('0x82')][_0x87fb('0x85')][_0x87fb('0x88')]){var _0xe62cc3=_0x5d3ed0[_0x87fb('0x82')][_0x87fb('0x85')][_0x87fb('0x88')];if(!/^(f|ht)tps?:\/\//i[_0x87fb('0x91')](_0xe62cc3)){_0xeef92d=path[_0x87fb('0x61')]('plugins',_0x387dac,_0x321ac3[0x0],_0xe62cc3);}else{_0xeef92d=_0xe62cc3;}}}}var _0x3cc43e={'name':_0x19c08c,'description':_0x4bbe34,'path':path[_0x87fb('0x61')](_0x387dac,_0x321ac3[0x0]),'type':_0x44fdb0,'sidebar':_0x2994e6,'icon':_0x4091dc,'adminUrl':_0x7b64ce,'agentUrl':_0xeef92d,'scriptName':_0x2c0e2b,'scriptPath':_0x125f5c,'version':_0x3f18ca};removeReferences(_0x2a8826,null);return db['Plugin'][_0x87fb('0x95')](_0x3cc43e)[_0x87fb('0x2b')](function(_0x436679){var _0x5ad893={'role':_0x5a1819['body'][_0x87fb('0x96')],'userProfileId':_0x5a1819[_0x87fb('0x97')][_0x87fb('0x98')]};if(!_0x5ad893)throw new Error(_0x87fb('0x99'));if(_0x5ad893['role']===_0x87fb('0x9a')){var _0x5439fa=_0x436679['get']({'plain':!![]});return db[_0x87fb('0x9b')][_0x87fb('0x4f')]({'where':{'name':_0x87fb('0x9c'),'userProfileId':_0x5ad893['userProfileId']},'raw':!![]})['then'](function(_0xe038ac){if(_0xe038ac&&_0xe038ac['autoAssociation']===0x0){return db[_0x87fb('0x2e')][_0x87fb('0x95')]({'name':_0x5439fa['name'],'resourceId':_0x5439fa['id'],'type':_0xe038ac[_0x87fb('0x31')],'sectionId':_0xe038ac['id']},{})['then'](function(){return _0x436679;});}else{return _0x436679;}})[_0x87fb('0x6d')](function(_0x847941){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x847941);throw _0x847941;});}return _0x436679;})[_0x87fb('0x2b')](respondWithResult(_0x451784,null))['catch'](handleError(_0x451784,null));}});}catch(_0x253f77){_0x451784[_0x87fb('0x20')](0x1f4)['send'](_0x253f77);}};function removeReferences(_0x16f408,_0x323533){try{if(_0x16f408){fs[_0x87fb('0x69')](_0x16f408);logger[_0x87fb('0x6a')](_0x87fb('0x9d'));}if(_0x323533){rimraf(_0x323533,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x16b3d6){logger[_0x87fb('0x2f')](_0x16b3d6);}}exports['update']=function(_0x2ee936,_0x3ea155,_0x1057fa){return db[_0x87fb('0x35')]['find']({'where':{'id':_0x2ee936[_0x87fb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3ea155,null))[_0x87fb('0x2b')](saveUpdates(_0x2ee936['body'],null))[_0x87fb('0x2b')](respondWithResult(_0x3ea155,null))[_0x87fb('0x6d')](handleError(_0x3ea155,null));};exports[_0x87fb('0x9e')]=function(_0x2dd2ac,_0x5cc31d,_0x2c4e49){return db[_0x87fb('0x35')]['find']({'where':{'id':_0x2dd2ac[_0x87fb('0x4e')]['id']}})[_0x87fb('0x2b')](function(_0x494382){if(_0x494382){return _0x494382['destroy']();}})[_0x87fb('0x2b')](function(_0x462c0f){rimraf(path[_0x87fb('0x61')](config[_0x87fb('0x52')],_0x87fb('0x53'),path[_0x87fb('0x62')](_0x462c0f[_0x87fb('0x51')])),function(){});return _0x462c0f;})[_0x87fb('0x2b')](handleEntityNotFound(_0x5cc31d,null))[_0x87fb('0x2b')](respondWithStatusCode(_0x5cc31d,null))['catch'](handleError(_0x5cc31d,null));};exports['webhookGet']=function(_0x2d5ffb,_0x1b277b,_0x4ad781){return BPromise[_0x87fb('0x9f')]()[_0x87fb('0x2b')](function(){if(!_0x2d5ffb[_0x87fb('0x3a')][_0x87fb('0x51')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2d5ffb[_0x87fb('0x3a')][_0x87fb('0xa0')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2c4d5a=_0x2d5ffb[_0x87fb('0x3a')][_0x87fb('0xa1')]?_0x2d5ffb[_0x87fb('0x3a')]['hostname']+':'+_0x2d5ffb[_0x87fb('0x3a')][_0x87fb('0xa0')]:_0x87fb('0xa2')+_0x2d5ffb[_0x87fb('0x3a')][_0x87fb('0xa0')];var _0xa3e263=_0x2d5ffb[_0x87fb('0x3a')][_0x87fb('0x22')]?_0x2d5ffb['query'][_0x87fb('0x22')]:!![];var _0x42c063=_0x2d5ffb[_0x87fb('0x3a')][_0x87fb('0xa3')]?_0x2d5ffb[_0x87fb('0x3a')][_0x87fb('0xa3')]:null;var _0x331b24={'method':_0x2d5ffb[_0x87fb('0xa4')],'uri':util['format'](_0x87fb('0xa5'),_0x2c4d5a,_0x2d5ffb[_0x87fb('0x3a')]['path']),'json':_0xa3e263,'resolveWithFullResponse':!![],'encoding':_0x42c063,'qs':_0x2d5ffb['query']};if(_0x2d5ffb[_0x87fb('0xa6')]){_0x331b24[_0x87fb('0xa6')]=_0x2d5ffb['headers'];if(_0x331b24[_0x87fb('0xa6')][_0x87fb('0xa7')]){delete _0x331b24['headers'][_0x87fb('0xa7')];}}if(_0x331b24[_0x87fb('0xa6')][_0x87fb('0xa8')]){delete _0x331b24[_0x87fb('0xa6')][_0x87fb('0xa8')];}return rp(_0x331b24);})[_0x87fb('0x2b')](function(_0x4b0d2b){if(_0x4b0d2b){_0x1b277b[_0x87fb('0x27')](_0x4b0d2b[_0x87fb('0xa6')]);logger['info'](_0x4b0d2b[_0x87fb('0x97')]);if(_['endsWith'](_0x2d5ffb[_0x87fb('0x3a')][_0x87fb('0x51')],_0x87fb('0x50'))&&_0x4b0d2b[_0x87fb('0xa9')]==0x1f4){return _0x1b277b['sendStatus'](_0x4b0d2b[_0x87fb('0xa9')]);}else{return _0x1b277b['status'](_0x4b0d2b[_0x87fb('0xa9')])[_0x87fb('0x32')](_0x4b0d2b[_0x87fb('0x97')]);}}else{return _0x1b277b[_0x87fb('0x1f')](0xc8);}})['catch'](handleError(_0x1b277b,null));};exports[_0x87fb('0xaa')]=function(_0x5150d2,_0x3641b1,_0x1a1075){return BPromise[_0x87fb('0x9f')]()[_0x87fb('0x2b')](function(){if(!_0x5150d2[_0x87fb('0x3a')][_0x87fb('0x51')]){throw new Error(_0x87fb('0xab'));}if(!_0x5150d2[_0x87fb('0x3a')][_0x87fb('0xa0')]){throw new Error(_0x87fb('0xac'));}var _0x5d65cc=_0x5150d2[_0x87fb('0x3a')][_0x87fb('0xa1')]?_0x5150d2['query'][_0x87fb('0xa1')]+':'+_0x5150d2[_0x87fb('0x3a')]['port']:_0x87fb('0xa2')+_0x5150d2[_0x87fb('0x3a')][_0x87fb('0xa0')];var _0x4e8652=_0x5150d2['query'][_0x87fb('0x22')]?_0x5150d2['query'][_0x87fb('0x22')]:!![];var _0x2bfbf9=_0x5150d2['query'][_0x87fb('0xa3')]?_0x5150d2[_0x87fb('0x3a')][_0x87fb('0xa3')]:null;var _0x5710f3={'method':_0x5150d2['method'],'uri':util[_0x87fb('0x54')]('%s%s',_0x5d65cc,_0x5150d2['query'][_0x87fb('0x51')]),'json':_0x4e8652,'resolveWithFullResponse':!![],'encoding':_0x2bfbf9,'body':_0x5150d2[_0x87fb('0x97')]};if(_0x5150d2[_0x87fb('0xa6')]){_0x5710f3[_0x87fb('0xa6')]=_0x5150d2[_0x87fb('0xa6')];if(_0x5710f3[_0x87fb('0xa6')][_0x87fb('0xa7')]){delete _0x5710f3[_0x87fb('0xa6')]['content-length'];}}if(_0x5710f3[_0x87fb('0xa6')][_0x87fb('0xa8')]){delete _0x5710f3[_0x87fb('0xa6')][_0x87fb('0xa8')];}return rp(_0x5710f3);})['then'](function(_0x165e4e){if(_0x165e4e){_0x3641b1[_0x87fb('0x27')](_0x165e4e[_0x87fb('0xa6')]);logger['info'](_0x165e4e[_0x87fb('0x97')]);return _0x3641b1[_0x87fb('0x20')](_0x165e4e[_0x87fb('0xa9')])[_0x87fb('0x32')](_0x165e4e[_0x87fb('0x97')]);}else{return _0x3641b1[_0x87fb('0x1f')](0xc8);}})[_0x87fb('0x6d')](handleError(_0x3641b1,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index fda4a07..a85d462 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 _0x00b3=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','emit'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x00b3,0x157));var _0x300b=function(_0x2ff276,_0x5e397a){_0x2ff276=_0x2ff276-0x0;var _0x412fb5=_0x00b3[_0x2ff276];return _0x412fb5;};'use strict';var EventEmitter=require(_0x300b('0x0'));var Plugin=require(_0x300b('0x1'))['db'][_0x300b('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x300b('0x3')](0x0);var events={'afterCreate':_0x300b('0x4'),'afterUpdate':_0x300b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x968375){return function(_0x204f71,_0x494436,_0x2f3a41){PluginEvents['emit'](_0x968375+':'+_0x204f71['id'],_0x204f71);PluginEvents[_0x300b('0x6')](_0x968375,_0x204f71);_0x2f3a41(null);};}for(var e in events){if(events[_0x300b('0x7')](e)){var event=events[e];Plugin[_0x300b('0x8')](e,emitEvent(event));}}module[_0x300b('0x9')]=PluginEvents; \ No newline at end of file +var _0xe928=['exports','events','../../mysqldb','Plugin','save','remove','emit','hasOwnProperty','hook'];(function(_0x5785f5,_0x289cad){var _0xb76dee=function(_0x19e58f){while(--_0x19e58f){_0x5785f5['push'](_0x5785f5['shift']());}};_0xb76dee(++_0x289cad);}(_0xe928,0x145));var _0x8e92=function(_0x141c28,_0x274745){_0x141c28=_0x141c28-0x0;var _0x49f9db=_0xe928[_0x141c28];return _0x49f9db;};'use strict';var EventEmitter=require(_0x8e92('0x0'));var Plugin=require(_0x8e92('0x1'))['db'][_0x8e92('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8e92('0x3'),'afterUpdate':'update','afterDestroy':_0x8e92('0x4')};function emitEvent(_0x44fc50){return function(_0x1b9cbe,_0x1f6ce2,_0x59de3d){PluginEvents[_0x8e92('0x5')](_0x44fc50+':'+_0x1b9cbe['id'],_0x1b9cbe);PluginEvents['emit'](_0x44fc50,_0x1b9cbe);_0x59de3d(null);};}for(var e in events){if(events[_0x8e92('0x6')](e)){var event=events[e];Plugin[_0x8e92('0x7')](e,emitEvent(event));}}module[_0x8e92('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 61a27b3..6e89dba 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 _0x4e09=['rimraf','../../config/environment','define','plugins','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x33c597,_0x2aab4d){var _0x17e26b=function(_0x3791e8){while(--_0x3791e8){_0x33c597['push'](_0x33c597['shift']());}};_0x17e26b(++_0x2aab4d);}(_0x4e09,0x19e));var _0x94e0=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4e09[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x94e0('0x0'));var util=require(_0x94e0('0x1'));var logger=require(_0x94e0('0x2'))('api');var moment=require(_0x94e0('0x3'));var BPromise=require(_0x94e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94e0('0x5'));var rimraf=require(_0x94e0('0x6'));var config=require(_0x94e0('0x7'));var attributes=require('./plugin.attributes');module['exports']=function(_0x223c25,_0xf6c33d){return _0x223c25[_0x94e0('0x8')]('Plugin',attributes,{'tableName':_0x94e0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5547=['plugins','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0x5547,0x76));var _0x7554=function(_0x2430de,_0x40394d){_0x2430de=_0x2430de-0x0;var _0x30d356=_0x5547[_0x2430de];return _0x30d356;};'use strict';var _=require(_0x7554('0x0'));var util=require(_0x7554('0x1'));var logger=require(_0x7554('0x2'))(_0x7554('0x3'));var moment=require(_0x7554('0x4'));var BPromise=require('bluebird');var rp=require(_0x7554('0x5'));var fs=require('fs');var path=require(_0x7554('0x6'));var rimraf=require(_0x7554('0x7'));var config=require(_0x7554('0x8'));var attributes=require(_0x7554('0x9'));module[_0x7554('0xa')]=function(_0x2a80f4,_0x18dd1c){return _0x2a80f4['define'](_0x7554('0xb'),attributes,{'tableName':_0x7554('0xc'),'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 d7f4266..65bc193 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 _0xcb16=['defaults','localhost','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3a9758,_0x5e54c3){var _0x57bde8=function(_0x1440d1){while(--_0x1440d1){_0x3a9758['push'](_0x3a9758['shift']());}};_0x57bde8(++_0x5e54c3);}(_0xcb16,0x12e));var _0x6cb1=function(_0x5cd9b7,_0x3144e5){_0x5cd9b7=_0x5cd9b7-0x0;var _0x2718f8=_0xcb16[_0x5cd9b7];return _0x2718f8;};'use strict';var _=require(_0x6cb1('0x0'));var util=require(_0x6cb1('0x1'));var moment=require('moment');var BPromise=require(_0x6cb1('0x2'));var rs=require(_0x6cb1('0x3'));var fs=require('fs');var Redis=require(_0x6cb1('0x4'));var db=require(_0x6cb1('0x5'))['db'];var utils=require(_0x6cb1('0x6'));var logger=require(_0x6cb1('0x7'))('rpc');var config=require(_0x6cb1('0x8'));var jayson=require(_0x6cb1('0x9'));var client=jayson[_0x6cb1('0xa')][_0x6cb1('0xb')]({'port':0x232a});config[_0x6cb1('0xc')]=_[_0x6cb1('0xd')](config[_0x6cb1('0xc')],{'host':_0x6cb1('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6cb1('0xc')]));require('./plugin.socket')[_0x6cb1('0xf')](socket);function respondWithRpcPromise(_0x1eb7e7,_0x25a292,_0x1a1271){return new BPromise(function(_0x3c1003,_0x5bcacc){return client[_0x6cb1('0x10')](_0x1eb7e7,_0x1a1271)[_0x6cb1('0x11')](function(_0x303d72){logger[_0x6cb1('0x12')](_0x6cb1('0x13'),_0x25a292,_0x6cb1('0x14'));logger[_0x6cb1('0x15')](_0x6cb1('0x16'),_0x25a292,_0x6cb1('0x14'),JSON[_0x6cb1('0x17')](_0x303d72));if(_0x303d72[_0x6cb1('0x18')]){if(_0x303d72[_0x6cb1('0x18')][_0x6cb1('0x19')]===0x1f4){logger['error'](_0x6cb1('0x13'),_0x25a292,_0x303d72[_0x6cb1('0x18')][_0x6cb1('0x1a')]);return _0x5bcacc(_0x303d72[_0x6cb1('0x18')][_0x6cb1('0x1a')]);}logger[_0x6cb1('0x18')](_0x6cb1('0x13'),_0x25a292,_0x303d72[_0x6cb1('0x18')][_0x6cb1('0x1a')]);return _0x3c1003(_0x303d72[_0x6cb1('0x18')]['message']);}else{logger['info'](_0x6cb1('0x13'),_0x25a292,'request\x20sent');_0x3c1003(_0x303d72[_0x6cb1('0x1b')]['message']);}})[_0x6cb1('0x1c')](function(_0x7cc8e1){logger[_0x6cb1('0x18')](_0x6cb1('0x13'),_0x25a292,_0x7cc8e1);_0x5bcacc(_0x7cc8e1);});});}exports[_0x6cb1('0x1d')]=function(_0x2d1358){var _0x4b3a21=this;return new Promise(function(_0x181103,_0x44d758){return db[_0x6cb1('0x1e')][_0x6cb1('0x1f')](_0x2d1358[_0x6cb1('0x20')],{'raw':_0x2d1358[_0x6cb1('0x21')]?_0x2d1358[_0x6cb1('0x21')][_0x6cb1('0x22')]===undefined?!![]:![]:!![]})[_0x6cb1('0x11')](function(_0xddf20a){logger[_0x6cb1('0x12')](_0x6cb1('0x1d'),_0x2d1358);logger[_0x6cb1('0x15')](_0x6cb1('0x1d'),_0x2d1358,JSON['stringify'](_0xddf20a));_0x181103(_0xddf20a);})[_0x6cb1('0x1c')](function(_0x3d1e3a){logger[_0x6cb1('0x18')](_0x6cb1('0x1d'),_0x3d1e3a[_0x6cb1('0x1a')],_0x2d1358);_0x44d758(_0x4b3a21[_0x6cb1('0x18')](0x1f4,_0x3d1e3a['message']));});});}; \ No newline at end of file +var _0x95af=['localhost','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','CreatePlugin','create','body','options','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis'];(function(_0x50e704,_0x1cac35){var _0x21a84a=function(_0x30c626){while(--_0x30c626){_0x50e704['push'](_0x50e704['shift']());}};_0x21a84a(++_0x1cac35);}(_0x95af,0x173));var _0xf95a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x95af[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf95a('0x0'));var util=require(_0xf95a('0x1'));var moment=require('moment');var BPromise=require(_0xf95a('0x2'));var rs=require(_0xf95a('0x3'));var fs=require('fs');var Redis=require(_0xf95a('0x4'));var db=require(_0xf95a('0x5'))['db'];var utils=require(_0xf95a('0x6'));var logger=require(_0xf95a('0x7'))(_0xf95a('0x8'));var config=require('../../config/environment');var jayson=require(_0xf95a('0x9'));var client=jayson['client'][_0xf95a('0xa')]({'port':0x232a});config['redis']=_[_0xf95a('0xb')](config[_0xf95a('0xc')],{'host':_0xf95a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf95a('0xc')]));require(_0xf95a('0xe'))['register'](socket);function respondWithRpcPromise(_0x1e5aa3,_0x49656e,_0x28fc23){return new BPromise(function(_0x1058b6,_0x2a24bd){return client[_0xf95a('0xf')](_0x1e5aa3,_0x28fc23)[_0xf95a('0x10')](function(_0xf221e4){logger[_0xf95a('0x11')](_0xf95a('0x12'),_0x49656e,_0xf95a('0x13'));logger[_0xf95a('0x14')](_0xf95a('0x15'),_0x49656e,_0xf95a('0x13'),JSON['stringify'](_0xf221e4));if(_0xf221e4[_0xf95a('0x16')]){if(_0xf221e4[_0xf95a('0x16')][_0xf95a('0x17')]===0x1f4){logger['error'](_0xf95a('0x12'),_0x49656e,_0xf221e4['error'][_0xf95a('0x18')]);return _0x2a24bd(_0xf221e4['error'][_0xf95a('0x18')]);}logger[_0xf95a('0x16')](_0xf95a('0x12'),_0x49656e,_0xf221e4['error'][_0xf95a('0x18')]);return _0x1058b6(_0xf221e4[_0xf95a('0x16')][_0xf95a('0x18')]);}else{logger[_0xf95a('0x11')](_0xf95a('0x12'),_0x49656e,_0xf95a('0x13'));_0x1058b6(_0xf221e4[_0xf95a('0x19')][_0xf95a('0x18')]);}})['catch'](function(_0x185f7f){logger[_0xf95a('0x16')](_0xf95a('0x12'),_0x49656e,_0x185f7f);_0x2a24bd(_0x185f7f);});});}exports[_0xf95a('0x1a')]=function(_0x10da56){var _0x10386a=this;return new Promise(function(_0x2d2528,_0x53ffb1){return db['Plugin'][_0xf95a('0x1b')](_0x10da56[_0xf95a('0x1c')],{'raw':_0x10da56[_0xf95a('0x1d')]?_0x10da56[_0xf95a('0x1d')][_0xf95a('0x1e')]===undefined?!![]:![]:!![]})[_0xf95a('0x10')](function(_0xc8cf5b){logger['info'](_0xf95a('0x1a'),_0x10da56);logger[_0xf95a('0x14')](_0xf95a('0x1a'),_0x10da56,JSON['stringify'](_0xc8cf5b));_0x2d2528(_0xc8cf5b);})[_0xf95a('0x1f')](function(_0x245dc2){logger[_0xf95a('0x16')](_0xf95a('0x1a'),_0x245dc2[_0xf95a('0x18')],_0x10da56);_0x53ffb1(_0x10386a[_0xf95a('0x16')](0x1f4,_0x245dc2[_0xf95a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index a917850..49e51b2 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 _0x8c5a=['update','emit','removeListener','register','length','plugin:','./plugin.events','save','remove'];(function(_0xd05ee1,_0x21a5e7){var _0x123a98=function(_0xf076ae){while(--_0xf076ae){_0xd05ee1['push'](_0xd05ee1['shift']());}};_0x123a98(++_0x21a5e7);}(_0x8c5a,0x1b6));var _0xa8c5=function(_0x3d859e,_0x15bfc0){_0x3d859e=_0x3d859e-0x0;var _0x2d2f26=_0x8c5a[_0x3d859e];return _0x2d2f26;};'use strict';var PluginEvents=require(_0xa8c5('0x0'));var events=[_0xa8c5('0x1'),_0xa8c5('0x2'),_0xa8c5('0x3')];function createListener(_0x3959df,_0x12fa6c){return function(_0x2390c9){_0x12fa6c[_0xa8c5('0x4')](_0x3959df,_0x2390c9);};}function removeListener(_0x4dcf9a,_0x2b4bdf){return function(){PluginEvents[_0xa8c5('0x5')](_0x4dcf9a,_0x2b4bdf);};}exports[_0xa8c5('0x6')]=function(_0x1ffc0d){for(var _0x132476=0x0,_0x52840e=events[_0xa8c5('0x7')];_0x132476<_0x52840e;_0x132476++){var _0x369858=events[_0x132476];var _0x15531e=createListener(_0xa8c5('0x8')+_0x369858,_0x1ffc0d);PluginEvents['on'](_0x369858,_0x15531e);}}; \ No newline at end of file +var _0x3905=['length','plugin:','save','remove','update','emit','removeListener','register'];(function(_0x3cbaf5,_0x32988e){var _0x4bc50a=function(_0x1b16ae){while(--_0x1b16ae){_0x3cbaf5['push'](_0x3cbaf5['shift']());}};_0x4bc50a(++_0x32988e);}(_0x3905,0x142));var _0x5390=function(_0x598aa9,_0x36ce33){_0x598aa9=_0x598aa9-0x0;var _0x4ccbc3=_0x3905[_0x598aa9];return _0x4ccbc3;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x5390('0x0'),_0x5390('0x1'),_0x5390('0x2')];function createListener(_0x5ee63a,_0x14459f){return function(_0x6e9e3f){_0x14459f[_0x5390('0x3')](_0x5ee63a,_0x6e9e3f);};}function removeListener(_0x5d61d1,_0x5eb2fa){return function(){PluginEvents[_0x5390('0x4')](_0x5d61d1,_0x5eb2fa);};}exports[_0x5390('0x5')]=function(_0x4a050b){for(var _0xcdaec2=0x0,_0x498069=events[_0x5390('0x6')];_0xcdaec2<_0x498069;_0xcdaec2++){var _0x4d164c=events[_0xcdaec2];var _0x51ae79=createListener(_0x5390('0x7')+_0x4d164c,_0x4a050b);PluginEvents['on'](_0x4d164c,_0x51ae79);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index babe1e8..949fccd 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(_0x43dbd8,_0x4f70e6){var _0x4dac4d=function(_0x213056){while(--_0x213056){_0x43dbd8['push'](_0x43dbd8['shift']());}};_0x4dac4d(++_0x4f70e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x1fb73a,_0x53f872){var _0x2d4b57=function(_0x2b3cd5){while(--_0x2b3cd5){_0x1fb73a['push'](_0x1fb73a['shift']());}};_0x2d4b57(++_0x53f872);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 df202f5..829aff2 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 _0x3667=['lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','create','body','join','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','params','destroy','delete'];(function(_0x13d0fc,_0x391eba){var _0x124453=function(_0x956eba){while(--_0x956eba){_0x13d0fc['push'](_0x13d0fc['shift']());}};_0x124453(++_0x391eba);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var pm2=require(_0x7366('0x1'));var logger=require(_0x7366('0x2'))(_0x7366('0x3'));var path=require(_0x7366('0x4'));var exec=require('child_process')[_0x7366('0x5')];var BPromise=require(_0x7366('0x6'));function handleEntityNotFound(_0x4b32a7,_0x27726b){return function(_0x22bfc0){if(!_0x22bfc0){_0x4b32a7[_0x7366('0x7')](0x194);;}return _0x22bfc0;};}function respondWithResult(_0x1c0cf4,_0x101e3d){_0x101e3d=_0x101e3d||0xc8;return function(_0x589397){if(_0x589397){return _0x1c0cf4[_0x7366('0x8')](_0x101e3d)[_0x7366('0x9')](_0x589397);}return null;};}function handleError(_0x2dd32b,_0x26e9a9){_0x26e9a9=_0x26e9a9||0x1f4;return function(_0x171fe2){logger[_0x7366('0xa')](_0x171fe2[_0x7366('0xb')]);if(_0x171fe2[_0x7366('0xc')]){delete _0x171fe2[_0x7366('0xc')];}_0x2dd32b[_0x7366('0x8')](_0x26e9a9)[_0x7366('0xd')](_0x171fe2);};}function execChildProcess(){return new BPromise(function(_0x2d7e38,_0x57ea7f){exec(_0x7366('0xe'),function(_0x2694fc,_0xbcd488,_0x4718db){logger[_0x7366('0xf')](_0xbcd488);logger[_0x7366('0xf')](_0x4718db);if(_0x2694fc){logger[_0x7366('0xa')](_0x2694fc);return _0x57ea7f(_0x2694fc);}return _0x2d7e38(_0xbcd488);});});}exports[_0x7366('0x10')]=function(_0x37e47e,_0x1813b7){return pm2[_0x7366('0x11')]()[_0x7366('0x12')](function(_0x27500c){if(_0x27500c){var _0x22562f=_[_0x7366('0x13')](_0x27500c,function(_0x4dd111){return _0x4dd111[_0x7366('0xc')]===_0x7366('0x14')||_0x4dd111[_0x7366('0xc')]===_0x7366('0x15');});return{'rows':_0x22562f,'count':_0x22562f[_0x7366('0x16')]};}return null;})[_0x7366('0x12')](respondWithResult(_0x1813b7,null))[_0x7366('0x17')](handleError(_0x1813b7,null));};exports[_0x7366('0x18')]=function(_0x83e5d5,_0x41113f){return pm2[_0x7366('0x19')](_0x83e5d5['params']['id'])[_0x7366('0x12')](respondWithResult(_0x41113f,null))['then'](handleEntityNotFound(_0x41113f,null))[_0x7366('0x17')](handleError(_0x41113f,null));};exports[_0x7366('0x1a')]=function(_0x3f23cd,_0x52b43e){if(_0x3f23cd[_0x7366('0x1b')][_0x7366('0xc')]&&_0x3f23cd[_0x7366('0x1b')]['script']){var _0x16e038=path[_0x7366('0x1c')](__dirname,'../../files/plugins',_0x3f23cd[_0x7366('0x1b')][_0x7366('0x1d')]);var _0xaab659=process[_0x7366('0x1e')]();process[_0x7366('0x1f')](path[_0x7366('0x20')](_0x16e038));return execChildProcess()[_0x7366('0x12')](function(_0x22ed7e){process[_0x7366('0x1f')](_0xaab659);return pm2[_0x7366('0x21')]({'name':_0x3f23cd[_0x7366('0x1b')][_0x7366('0xc')],'script':_0x16e038});})[_0x7366('0x12')](function(_0x563b22){pm2[_0x7366('0x22')]();return _0x563b22[0x0];})['then'](respondWithResult(_0x52b43e,0xc9))[_0x7366('0x17')](handleError(_0x52b43e,null));}else{return _0x52b43e['status'](0x1f4)['send']({'message':_0x7366('0x23')});}};exports['update']=function(_0x254374,_0x4ac138){if(_0x254374[_0x7366('0x1b')]['id']){delete _0x254374[_0x7366('0x1b')]['id'];}var _0x5c37e2={'online':_0x7366('0x24'),'stopped':'stop'};if(_0x5c37e2[_0x7366('0x25')](_0x254374[_0x7366('0x1b')]['status'])){return pm2[_0x5c37e2[_0x254374[_0x7366('0x1b')]['status']]](_0x254374[_0x7366('0x26')]['id'])[_0x7366('0x12')](respondWithResult(_0x4ac138,0xc8))[_0x7366('0x17')](handleError(_0x4ac138,null));}else{return _0x4ac138[_0x7366('0x8')](0x1f4)[_0x7366('0xd')]({'message':'Unknown\x20status'});}};exports[_0x7366('0x27')]=function(_0x447807,_0x538d42){if(_0x447807['body']['id']){delete _0x447807['body']['id'];}if(_0x447807['params']['id']){return pm2[_0x7366('0x28')](_0x447807[_0x7366('0x26')]['id'])[_0x7366('0x12')](function(_0x15286a){pm2['dump']();return _0x15286a[0x0];})[_0x7366('0x12')](respondWithResult(_0x538d42,null))[_0x7366('0x17')](handleError(_0x538d42,null));}else{return _0x538d42[_0x7366('0x8')](0x1f4)[_0x7366('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xde2c=['start','dump','update','restart','stop','hasOwnProperty','params','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','list','reject','express','motion2','then','catch','show','create','body','script','cwd','chdir','dirname'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xde2c,0x7f));var _0xcde2=function(_0x313df3,_0x4fca45){_0x313df3=_0x313df3-0x0;var _0x241d59=_0xde2c[_0x313df3];return _0x241d59;};'use strict';var _=require(_0xcde2('0x0'));var pm2=require(_0xcde2('0x1'));var logger=require(_0xcde2('0x2'))(_0xcde2('0x3'));var path=require(_0xcde2('0x4'));var exec=require(_0xcde2('0x5'))[_0xcde2('0x6')];var BPromise=require(_0xcde2('0x7'));function handleEntityNotFound(_0x55c175,_0x4353c8){return function(_0x196898){if(!_0x196898){_0x55c175[_0xcde2('0x8')](0x194);;}return _0x196898;};}function respondWithResult(_0x1398de,_0x401b16){_0x401b16=_0x401b16||0xc8;return function(_0x53c558){if(_0x53c558){return _0x1398de[_0xcde2('0x9')](_0x401b16)[_0xcde2('0xa')](_0x53c558);}return null;};}function handleError(_0x9c7036,_0x544235){_0x544235=_0x544235||0x1f4;return function(_0x582a6c){logger[_0xcde2('0xb')](_0x582a6c[_0xcde2('0xc')]);if(_0x582a6c['name']){delete _0x582a6c[_0xcde2('0xd')];}_0x9c7036[_0xcde2('0x9')](_0x544235)[_0xcde2('0xe')](_0x582a6c);};}function execChildProcess(){return new BPromise(function(_0x127358,_0x54b7c5){exec('npm\x20install',function(_0x25677f,_0x1bc697,_0x3b1333){logger[_0xcde2('0xf')](_0x1bc697);logger[_0xcde2('0xf')](_0x3b1333);if(_0x25677f){logger[_0xcde2('0xb')](_0x25677f);return _0x54b7c5(_0x25677f);}return _0x127358(_0x1bc697);});});}exports['index']=function(_0x211215,_0x577062){return pm2[_0xcde2('0x10')]()['then'](function(_0x4b0e0e){if(_0x4b0e0e){var _0x34e079=_[_0xcde2('0x11')](_0x4b0e0e,function(_0x417505){return _0x417505[_0xcde2('0xd')]===_0xcde2('0x12')||_0x417505['name']===_0xcde2('0x13');});return{'rows':_0x34e079,'count':_0x34e079['length']};}return null;})[_0xcde2('0x14')](respondWithResult(_0x577062,null))[_0xcde2('0x15')](handleError(_0x577062,null));};exports[_0xcde2('0x16')]=function(_0x1f1858,_0x5223f1){return pm2['describe'](_0x1f1858['params']['id'])[_0xcde2('0x14')](respondWithResult(_0x5223f1,null))['then'](handleEntityNotFound(_0x5223f1,null))[_0xcde2('0x15')](handleError(_0x5223f1,null));};exports[_0xcde2('0x17')]=function(_0x252372,_0x481fc0){if(_0x252372[_0xcde2('0x18')][_0xcde2('0xd')]&&_0x252372[_0xcde2('0x18')][_0xcde2('0x19')]){var _0x43df7a=path['join'](__dirname,'../../files/plugins',_0x252372['body'][_0xcde2('0x19')]);var _0x3e5170=process[_0xcde2('0x1a')]();process[_0xcde2('0x1b')](path[_0xcde2('0x1c')](_0x43df7a));return execChildProcess()['then'](function(_0x1104b8){process['chdir'](_0x3e5170);return pm2[_0xcde2('0x1d')]({'name':_0x252372[_0xcde2('0x18')][_0xcde2('0xd')],'script':_0x43df7a});})['then'](function(_0x593aa4){pm2[_0xcde2('0x1e')]();return _0x593aa4[0x0];})[_0xcde2('0x14')](respondWithResult(_0x481fc0,0xc9))[_0xcde2('0x15')](handleError(_0x481fc0,null));}else{return _0x481fc0[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xcde2('0x1f')]=function(_0x45275a,_0x1dce65){if(_0x45275a['body']['id']){delete _0x45275a[_0xcde2('0x18')]['id'];}var _0x348ca1={'online':_0xcde2('0x20'),'stopped':_0xcde2('0x21')};if(_0x348ca1[_0xcde2('0x22')](_0x45275a[_0xcde2('0x18')][_0xcde2('0x9')])){return pm2[_0x348ca1[_0x45275a[_0xcde2('0x18')]['status']]](_0x45275a[_0xcde2('0x23')]['id'])['then'](respondWithResult(_0x1dce65,0xc8))[_0xcde2('0x15')](handleError(_0x1dce65,null));}else{return _0x1dce65[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Unknown\x20status'});}};exports[_0xcde2('0x24')]=function(_0x28fedd,_0x58afb1){if(_0x28fedd[_0xcde2('0x18')]['id']){delete _0x28fedd[_0xcde2('0x18')]['id'];}if(_0x28fedd[_0xcde2('0x23')]['id']){return pm2[_0xcde2('0x25')](_0x28fedd[_0xcde2('0x23')]['id'])[_0xcde2('0x14')](function(_0x11b817){pm2[_0xcde2('0x1e')]();return _0x11b817[0x0];})['then'](respondWithResult(_0x58afb1,null))[_0xcde2('0x15')](handleError(_0x58afb1,null));}else{return _0x58afb1[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':_0xcde2('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index b2d1458..ceb01d6 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 _0x29b3=['isAuthenticated','/queues','getQueues','express','Router','get','/agents'];(function(_0x535e3c,_0x1aa84d){var _0x444260=function(_0x1e13fa){while(--_0x1e13fa){_0x535e3c['push'](_0x535e3c['shift']());}};_0x444260(++_0x1aa84d);}(_0x29b3,0x114));var _0x329b=function(_0x26cfd3,_0x2e3280){_0x26cfd3=_0x26cfd3-0x0;var _0x370c75=_0x29b3[_0x26cfd3];return _0x370c75;};'use strict';var express=require(_0x329b('0x0'));var router=express[_0x329b('0x1')]();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router[_0x329b('0x2')](_0x329b('0x3'),auth[_0x329b('0x4')](),controller['getAgents']);router['get'](_0x329b('0x5'),auth[_0x329b('0x4')](),controller[_0x329b('0x6')]);module['exports']=router; \ No newline at end of file +var _0x940a=['getAgents','get','/queues','isAuthenticated','getQueues','exports','../../components/auth/service','./realtime.controller','/agents'];(function(_0x20f1fd,_0x409aa2){var _0x2e3d59=function(_0x5ce8eb){while(--_0x5ce8eb){_0x20f1fd['push'](_0x20f1fd['shift']());}};_0x2e3d59(++_0x409aa2);}(_0x940a,0x69));var _0xa940=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0x940a[_0x151418];return _0x40e29a;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xa940('0x0'));var controller=require(_0xa940('0x1'));router['get'](_0xa940('0x2'),auth['isAuthenticated'](),controller[_0xa940('0x3')]);router[_0xa940('0x4')](_0xa940('0x5'),auth[_0xa940('0x6')](),controller[_0xa940('0x7')]);module[_0xa940('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 846fcb7..d2b8536 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 _0x5fc3=['user','sort','getResources','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','pauseType','getQueues','mail','chat','openchannel','whatsapp','channel','includes','toLowerCase','Invalid\x20channel','userProfileId','QueueCampaigns','UserProfile','all','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','undefined','limit','count','offset','status','Content-Range','json','stack','name','send','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','request','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','loggedIn','available','talking','paused','outbound','push','pTalking','originated','message','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','map','get','agents','waiting','busy','length','some','internal','toString','getMembers','UserId','accountcode','voiceStatus','online','loggedInDb','Queue','Pause','find','idle','unknown','unavailable','isNil','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','pause','every','chatStatus','faxStatus','smsStatus','whatsappStatus','getAgents','userpic','lastLoginAt','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatus','chatStatusTime','mailStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','resolve','User','rawAttributes','fieldName','type','query','agent','getOptions'];(function(_0x4eec77,_0x49441a){var _0x321704=function(_0x2a0e2a){while(--_0x2a0e2a){_0x4eec77['push'](_0x4eec77['shift']());}};_0x321704(++_0x49441a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0x5fc3[_0x25fc41];return _0x1371d1;};'use strict';var util=require(_0x35fc('0x0'));var _=require(_0x35fc('0x1'));var jayson=require('jayson/promise');var qs=require(_0x35fc('0x2'));var logger=require(_0x35fc('0x3'))(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var amiClient=jayson[_0x35fc('0x6')]['http']({'port':0x232a});var routingClient=jayson[_0x35fc('0x6')][_0x35fc('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x186a06,_0x5b85ad){return function(_0x5754be){if(_0x5754be){var _0x19a0d1=typeof _0x5b85ad['offset']===_0x35fc('0x8')&&typeof _0x5b85ad[_0x35fc('0x9')]===_0x35fc('0x8');var _0x1e5f90=_0x5754be[_0x35fc('0xa')];var _0xf9d3a6=_0x19a0d1?0x0:_0x5b85ad[_0x35fc('0xb')];var _0x565f95=_0x19a0d1?_0x5754be[_0x35fc('0xa')]:_0x5b85ad[_0x35fc('0xb')]+_0x5b85ad['limit'];var _0x471549;if(_0x565f95>=_0x1e5f90){_0x565f95=_0x1e5f90;_0x471549=0xc8;}else{_0x471549=0xce;}_0x186a06[_0x35fc('0xc')](_0x471549);return _0x186a06['set'](_0x35fc('0xd'),_0xf9d3a6+'-'+_0x565f95+'/'+_0x1e5f90)[_0x35fc('0xe')](_0x5754be);}return null;};}function handleError(_0x5469f5,_0x4cbe74){_0x4cbe74=_0x4cbe74||0x1f4;return function(_0x409357){logger['error'](_0x409357[_0x35fc('0xf')]);if(_0x409357[_0x35fc('0x10')]){delete _0x409357[_0x35fc('0x10')];}_0x5469f5[_0x35fc('0xc')](_0x4cbe74)[_0x35fc('0x11')](_0x409357);};}function getRealtimeAgents(){return new Promise(function(_0x5cfe94,_0x59507a){return amiClient['request']('Agents',{})[_0x35fc('0x12')](function(_0x229d56){if(_0x229d56[_0x35fc('0x13')])throw new Error(_0x35fc('0x14'));var _0x227a49=_0x229d56[_0x35fc('0x15')];return routingClient['request'](_0x35fc('0x16'),{})[_0x35fc('0x12')](function(_0x553677){if(_0x553677[_0x35fc('0x13')])throw new Error(_0x35fc('0x17'));var _0x2e513b=_0x553677['result'];return _0x5cfe94(_[_0x35fc('0x18')]({},_0x227a49,_0x2e513b));});})[_0x35fc('0x19')](function(_0x465eb3){_0x59507a(_0x465eb3);});});}function getRealtimeQueues(_0x488234,_0x402cff){return new Promise(function(_0x350a27,_0x3229d1){var _0x251a1f=_0x402cff===_0x35fc('0x1a')?amiClient:routingClient;return _0x251a1f[_0x35fc('0x1b')](_[_0x35fc('0x1c')](_0x402cff)+_0x35fc('0x1d'),_0x488234)[_0x35fc('0x12')](function(_0x427eae){if(_0x427eae['error'])throw new Error(util[_0x35fc('0x1e')](_0x35fc('0x1f'),_0x402cff));return _0x350a27(_0x427eae[_0x35fc('0x15')]);})[_0x35fc('0x19')](function(_0x3b4743){_0x3229d1(_0x3b4743);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x55e9e7,_0x33f5e8){return amiClient[_0x35fc('0x1b')]('VoiceQueuesChannels',{})[_0x35fc('0x12')](function(_0x5a93df){if(_0x5a93df[_0x35fc('0x13')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x55e9e7(_0x5a93df[_0x35fc('0x15')]);})['catch'](function(_0x1bf180){_0x33f5e8(_0x1bf180);});});}function initializeQueues(_0xdfab9f,_0x5cb986,_0x519264,_0x47774c){var _0x58edb6=[_0x35fc('0x20'),_0x35fc('0x21'),'waiting',_0x35fc('0x22'),_0x35fc('0x23')];if(_0x519264===_0x35fc('0x1a')&&_0x47774c===_0x35fc('0x24')){_0x58edb6[_0x35fc('0x25')](_0x35fc('0x26'),_0x35fc('0x27'),_0x35fc('0x28'),'dialActive',_0x35fc('0x29'),_0x35fc('0x2a'),_0x35fc('0x2b'),'startProgressive',_0x35fc('0x2c'),_0x35fc('0x2d'),_0x35fc('0x2e'),_0x35fc('0x2f'),_0x35fc('0x30'),_0x35fc('0x31'),_0x35fc('0x32'),_0x35fc('0x33'),_0x35fc('0x34'),_0x35fc('0x35'),'predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x35fc('0x36'),'predictiveIntervalAvgTalktime');}return _0xdfab9f[_0x35fc('0x37')](function(_0x39454e){var _0x1c4b8b=_0x39454e[_0x35fc('0x38')]({'plain':!![]});_0x1c4b8b[_0x35fc('0x39')]=[];_0x1c4b8b[_0x35fc('0x23')]=0x0;_0x1c4b8b['loggedInDb']=0x0;_0x1c4b8b[_0x35fc('0x20')]=0x0;_0x1c4b8b[_0x35fc('0x21')]=0x0;_0x1c4b8b[_0x35fc('0x3a')]=0x0;if(_0x519264===_0x35fc('0x1a')){_0x1c4b8b[_0x35fc('0x22')]=0x0;_0x1c4b8b[_0x35fc('0x3b')]=0x0;if(_0x47774c==='outbound'){_0x1c4b8b[_0x35fc('0x26')]=0x0;_0x1c4b8b[_0x35fc('0x27')]=0x0;}}var _0x1fecdf=_['find'](_0x5cb986,['id',_0x1c4b8b['id']]);if(_0x1fecdf)_[_0x35fc('0x18')](_0x1c4b8b,_['pick'](_0x1fecdf,_0x58edb6));return _0x1c4b8b;});}function updateAgentVoiceStatus(_0x2ecb2e,_0x33a377,_0x266a11){var _0x2e00e3=_['filter'](_0x266a11,['queue',_0x33a377['name']]);if(_0x2e00e3[_0x35fc('0x3c')]===0x0)return _0x2ecb2e['busy']=!![];if(_[_0x35fc('0x3d')](_0x2e00e3,['connectedlinenum',_0x2ecb2e[_0x35fc('0x3e')][_0x35fc('0x3f')]()]))return _0x2ecb2e[_0x35fc('0x22')]=!![];if(!_0x2ecb2e[_0x35fc('0x22')])return _0x2ecb2e[_0x35fc('0x3b')]=!![];}function getVoiceQueueAgents(_0x3313fa,_0x9fe7d6,_0x4ec0dc,_0x4467f8){var _0x16087d=_['find'](_0x9fe7d6,['id',_0x3313fa['id']]);if(!_0x16087d)return _0x3313fa;return _0x16087d[_0x35fc('0x40')]({'raw':!![]})[_0x35fc('0x12')](function(_0x1aac67){for(var _0x1d2ffe=0x0;_0x1d2ffe<_0x1aac67[_0x35fc('0x3c')];_0x1d2ffe++){var _0x31d926=_['find'](_0x4ec0dc,['id',_0x1aac67[_0x1d2ffe][_0x35fc('0x41')]]);if(!_0x31d926){_0x31d926={'id':_0x1aac67[_0x1d2ffe][_0x35fc('0x41')],'name':_0x1aac67[_0x1d2ffe][_0x35fc('0x41')],'accountcode':'','online':![]};}var _0x52543b={'id':_0x31d926['id'],'name':_0x31d926[_0x35fc('0x10')],'internal':_0x31d926[_0x35fc('0x42')],'online':Boolean(_0x31d926['online']),'paused':Boolean(_0x1aac67[_0x1d2ffe][_0x35fc('0x23')])};if(_0x31d926[_0x35fc('0x43')]===_0x35fc('0x22'))updateAgentVoiceStatus(_0x52543b,_0x3313fa,_0x4467f8);if(_0x52543b[_0x35fc('0x44')])_0x3313fa[_0x35fc('0x45')]++;if(_0x52543b[_0x35fc('0x3b')])_0x3313fa[_0x35fc('0x3b')]++;if(_0x52543b[_0x35fc('0x23')]&&!_0x52543b['busy']&&!_0x52543b['talking'])_0x3313fa[_0x35fc('0x23')]++;_0x3313fa[_0x35fc('0x39')]['push'](_0x52543b);}return _0x3313fa;});}function getQueueAgents(_0x5c2e5c,_0x4ff202,_0x79677d){var _0x10f98b='User'+_[_0x35fc('0x1c')](_0x79677d)+_0x35fc('0x46');var _0x1fb0a6=_0x79677d+_0x35fc('0x47');return db[_0x10f98b]['findAll']({'where':{[_['startCase'](_0x79677d)+'QueueId']:_0x5c2e5c['id']},'raw':!![]})['then'](function(_0x56bdb9){for(var _0xb26e3f=0x0;_0xb26e3f<_0x56bdb9[_0x35fc('0x3c')];_0xb26e3f++){var _0x4fc5bc=_[_0x35fc('0x48')](_0x4ff202,['id',_0x56bdb9[_0xb26e3f]['UserId']]);if(!_0x4fc5bc){_0x4fc5bc={'id':_0x56bdb9[_0xb26e3f][_0x35fc('0x41')],'name':_0x56bdb9[_0xb26e3f][_0x35fc('0x41')],'online':![],['pauseField']:![]};}var _0x350237={'id':_0x4fc5bc['id'],'name':_0x4fc5bc[_0x35fc('0x10')],'online':Boolean(_0x4fc5bc[_0x35fc('0x44')]),'paused':Boolean(_0x4fc5bc[_0x1fb0a6])};if(_0x350237['online'])_0x5c2e5c[_0x35fc('0x45')]++;_0x5c2e5c[_0x35fc('0x39')]['push'](_0x350237);}return _0x5c2e5c;});}function isIdle(_0x18181b){return _0x18181b===_0x35fc('0x49')||_0x18181b===_0x35fc('0x4a')||_0x18181b===_0x35fc('0x4b')||_0x18181b==='ringing'||_[_0x35fc('0x4c')](_0x18181b);}function isAgentPaused(_0x4c82d8,_0x583f67){var _0x1b6160=[_0x4c82d8[_0x35fc('0x4d')],_0x4c82d8[_0x35fc('0x4e')],_0x4c82d8[_0x35fc('0x4f')],_0x4c82d8[_0x35fc('0x50')],_0x4c82d8[_0x35fc('0x51')],_0x4c82d8[_0x35fc('0x52')],_0x4c82d8[_0x35fc('0x53')]];if(!_0x583f67)return _['every'](_0x1b6160);var _0x3e2961=_[_0x35fc('0x54')](_0x1b6160);return _0x3e2961[_0x35fc('0x3c')]>0x0&&_0x3e2961[_0x35fc('0x3c')]<_0x1b6160[_0x35fc('0x3c')]?!![]:![];}function isAgentIdle(_0x1e3221){if(_0x1e3221[_0x35fc('0x43')]!==_0x35fc('0x49')&&_0x1e3221[_0x35fc('0x52')]){_0x1e3221[_0x35fc('0x43')]=_0x35fc('0x55');return![];}return _[_0x35fc('0x56')]([_0x1e3221[_0x35fc('0x57')],_0x1e3221[_0x35fc('0x58')],_0x1e3221['mailStatus'],_0x1e3221['openchannelStatus'],_0x1e3221[_0x35fc('0x59')],_0x1e3221[_0x35fc('0x43')],_0x1e3221[_0x35fc('0x5a')]],isIdle);}function getAgentStatus(_0x2bf0b0){var _0x3ee296=_0x35fc('0x4a');if(isAgentPaused(_0x2bf0b0))_0x3ee296='pause';else if(isAgentPaused(_0x2bf0b0,!![]))_0x3ee296='*pause';else if(isAgentIdle(_0x2bf0b0))_0x3ee296=_0x35fc('0x49');else _0x3ee296=_0x35fc('0x3b');return _0x3ee296;}exports[_0x35fc('0x5b')]=function(_0x38bc78,_0x5b2595){var _0x467980={'count':0x0,'rows':[]},_0x13281f={},_0x4965d2,_0x199a00,_0x2536d3=[_0x35fc('0x5c'),_0x35fc('0x44'),_0x35fc('0x5d'),_0x35fc('0x5e'),'pauseType','lastPauseAt','internal',_0x35fc('0x5f'),_0x35fc('0x4d'),'openchannelPause',_0x35fc('0x4f'),_0x35fc('0x51'),_0x35fc('0x53'),_0x35fc('0x4e'),_0x35fc('0x52'),'chatCapacity',_0x35fc('0x60'),_0x35fc('0x61'),_0x35fc('0x62'),'whatsappCapacity',_0x35fc('0x63'),_0x35fc('0x64'),'openchannelCurrentCapacity',_0x35fc('0x65'),_0x35fc('0x66'),_0x35fc('0x67'),_0x35fc('0x68'),_0x35fc('0x57'),_0x35fc('0x69'),_0x35fc('0x6a'),_0x35fc('0x59'),'whatsappStatus',_0x35fc('0x58'),_0x35fc('0x43'),_0x35fc('0x6b'),'openchannelStatusTime',_0x35fc('0x6c'),'smsStatusTime','whatsappStatusTime','faxStatusTime',_0x35fc('0x6d'),_0x35fc('0x6e'),_0x35fc('0x6f'),_0x35fc('0x70'),_0x35fc('0x71'),'phoneBarEnableAutomaticScreenRecording','routealias'],_0x590faa=['chatPause','openchannelPause','mailPause',_0x35fc('0x51'),_0x35fc('0x53'),_0x35fc('0x4e'),_0x35fc('0x52'),'online'];Promise[_0x35fc('0x72')]()[_0x35fc('0x12')](function(){var _0x390e16=_[_0x35fc('0x37')](db[_0x35fc('0x73')][_0x35fc('0x74')],function(_0x27071b){return{'name':_0x27071b[_0x35fc('0x75')],'type':_0x27071b[_0x35fc('0x76')]['key']};});_0x38bc78[_0x35fc('0x77')]['role']=_0x35fc('0x78');_0x38bc78[_0x35fc('0x77')][_0x35fc('0x44')]=!![];_0x13281f=qs[_0x35fc('0x79')](_0x390e16,_0x38bc78);_0x13281f['raw']=!![];if(_0x38bc78[_0x35fc('0x7a')]['role']==='user'){var _0x5f1d4a={'params':{'id':_0x38bc78[_0x35fc('0x7a')]['userProfileId']},'query':{'section':_0x35fc('0x16'),'role':'agent','online':!![],'nolimit':_0x38bc78[_0x35fc('0x77')]['nolimit'],'sort':_0x38bc78[_0x35fc('0x77')][_0x35fc('0x7b')],'filter':_0x38bc78[_0x35fc('0x77')][_0x35fc('0x54')],'raw':!![]}};return db['UserProfile'][_0x35fc('0x7c')](_0x5f1d4a);}return db[_0x35fc('0x73')][_0x35fc('0x7d')](_0x13281f);})['then'](function(_0x3aa7fa){_0x467980[_0x35fc('0xa')]=_0x3aa7fa[_0x35fc('0xa')];_0x4965d2=_0x3aa7fa[_0x35fc('0x7e')];return getRealtimeAgents();})[_0x35fc('0x12')](function(_0x2c4309){_0x199a00=_0x2c4309[_0x35fc('0x7e')];return _0x4965d2[_0x35fc('0x37')](function(_0x5159a0){var _0x28a44b=_[_0x35fc('0x48')](_0x199a00,['id',_0x5159a0['id']]);if(_0x28a44b)_[_0x35fc('0x18')](_0x5159a0,_['pick'](_[_0x35fc('0x7f')](_0x28a44b,_0x590faa),_0x2536d3));_0x5159a0[_0x35fc('0x80')]=getAgentStatus(_0x5159a0);return _0x5159a0;});})['then'](function(_0x4d09d4){if(_0x38bc78[_0x35fc('0x77')]['globalStatusFilter']){var _0x223ad3=_[_0x35fc('0x54')](_0x4d09d4,[_0x35fc('0x80'),_0x38bc78[_0x35fc('0x77')][_0x35fc('0x81')]]);if(_0x38bc78[_0x35fc('0x77')][_0x35fc('0x82')]){_0x223ad3=_[_0x35fc('0x54')](_0x223ad3,[_0x35fc('0x83'),_0x38bc78[_0x35fc('0x77')][_0x35fc('0x82')]]);}}_0x467980[_0x35fc('0x7e')]=_0x223ad3||_0x4d09d4;return _0x467980;})[_0x35fc('0x12')](respondWithFilteredResult(_0x5b2595,_0x13281f))[_0x35fc('0x19')](handleError(_0x5b2595,null));};exports[_0x35fc('0x84')]=function(_0xd1e7ed,_0x2d8219){var _0x2d7b16=[_0x35fc('0x85'),_0x35fc('0x86'),'sms',_0x35fc('0x87'),'fax',_0x35fc('0x88'),_0x35fc('0x1a')];var _0x2185ce={'count':0x0,'rows':[]},_0x516b26={},_0x25af78,_0x3f56f4,_0x2913ba,_0x32023a,_0x2fed7b;Promise[_0x35fc('0x72')]()[_0x35fc('0x12')](function(){if(_0xd1e7ed['query'][_0x35fc('0x89')]){if(!_[_0x35fc('0x8a')](_0x2d7b16,_0xd1e7ed[_0x35fc('0x77')][_0x35fc('0x89')][_0x35fc('0x8b')]()))throw new Error(_0x35fc('0x8c'));_0x25af78=_0xd1e7ed['query'][_0x35fc('0x89')][_0x35fc('0x8b')]();}var _0x277514=_[_0x35fc('0x1c')](_0x25af78)+_0x35fc('0x46');var _0x3e2a8e=_[_0x35fc('0x37')](db[_0x277514][_0x35fc('0x74')],function(_0xa92234){return{'name':_0xa92234['fieldName'],'type':_0xa92234[_0x35fc('0x76')]['key']};});_0x516b26=qs[_0x35fc('0x79')](_0x3e2a8e,_0xd1e7ed);if(_0xd1e7ed[_0x35fc('0x7a')]['role']===_0x35fc('0x7a')){var _0x41002a={'params':{'id':_0xd1e7ed[_0x35fc('0x7a')][_0x35fc('0x8d')]},'query':{'section':_0x25af78===_0x35fc('0x1a')&&_0xd1e7ed[_0x35fc('0x77')][_0x35fc('0x76')]===_0x35fc('0x24')?_0x35fc('0x8e'):_['startCase'](_0x25af78)+'Queues','type':_0xd1e7ed['query']['type'],'nolimit':!![],'sort':_0x35fc('0x10'),'filter':_0xd1e7ed[_0x35fc('0x77')][_0x35fc('0x54')]}};return db[_0x35fc('0x8f')][_0x35fc('0x7c')](_0x41002a);}return db[_0x277514]['findAndCountAll'](_0x516b26);})[_0x35fc('0x12')](function(_0x19682e){_0x2185ce[_0x35fc('0xa')]=_0x19682e[_0x35fc('0xa')];_0x3f56f4=_0x19682e['rows'];return getRealtimeQueues(_0xd1e7ed,_0x25af78);})[_0x35fc('0x12')](function(_0x3ddd21){_0x32023a=_0x3ddd21[_0x35fc('0x7e')];return getRealtimeAgents();})['then'](function(_0x314886){_0x2913ba=_0x314886[_0x35fc('0x7e')];if(_0x25af78!=_0x35fc('0x1a'))return;return getRealtimeVoiceQueueChannels();})[_0x35fc('0x12')](function(_0x99c2a7){_0x2fed7b=_0x99c2a7?_0x99c2a7[_0x35fc('0x7e')]:[];return initializeQueues(_0x3f56f4,_0x32023a,_0x25af78,_0xd1e7ed[_0x35fc('0x77')][_0x35fc('0x76')]);})['then'](function(_0x2faff7){var _0xa2c5f8=_0x2faff7[_0x35fc('0x37')](function(_0x2799c8){if(_0x25af78===_0x35fc('0x1a'))return getVoiceQueueAgents(_0x2799c8,_0x3f56f4,_0x2913ba,_0x2fed7b);else return getQueueAgents(_0x2799c8,_0x2913ba,_0x25af78);});return Promise[_0x35fc('0x90')](_0xa2c5f8);})['then'](function(_0x495cf6){_0x2185ce['rows']=_0x495cf6;return _0x2185ce;})['then'](respondWithFilteredResult(_0x2d8219,_0x516b26))[_0x35fc('0x19')](handleError(_0x2d8219,null));}; \ No newline at end of file +var _0x2ef3=['chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','phoneBarEnableAutomaticScreenRecording','resolve','map','fieldName','type','key','query','role','agent','getOptions','raw','user','userProfileId','nolimit','sort','UserProfile','getResources','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','mail','chat','openchannel','whatsapp','toLowerCase','Invalid\x20channel','channel','rawAttributes','QueueCampaigns','all','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','client','http','offset','undefined','limit','count','status','set','json','error','stack','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','catch','voice','startCase','Queues','format','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','talking','paused','outbound','push','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','get','agents','loggedInDb','busy','find','merge','pick','filter','queue','name','length','some','connectedlinenum','toString','getMembers','UserId','accountcode','online','User','Queue','Pause','idle','unknown','unavailable','ringing','isNil','chatPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','voiceStatus','pause','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','getAgents','userpic','lastLoginAt','pauseType','lastPauseAt','address','faxPause','chatCapacity','smsCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus'];(function(_0x2f0985,_0x40d30a){var _0x153d27=function(_0x58edf9){while(--_0x58edf9){_0x2f0985['push'](_0x2f0985['shift']());}};_0x153d27(++_0x40d30a);}(_0x2ef3,0xba));var _0x32ef=function(_0x3c19e5,_0x13e4ec){_0x3c19e5=_0x3c19e5-0x0;var _0x5335a8=_0x2ef3[_0x3c19e5];return _0x5335a8;};'use strict';var util=require(_0x32ef('0x0'));var _=require(_0x32ef('0x1'));var jayson=require(_0x32ef('0x2'));var qs=require(_0x32ef('0x3'));var logger=require(_0x32ef('0x4'))(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x32ef('0x6')][_0x32ef('0x7')]({'port':0x232a});var routingClient=jayson['client'][_0x32ef('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x37dd1d,_0x4c8104){return function(_0x5dfa09){if(_0x5dfa09){var _0x2c0089=typeof _0x4c8104[_0x32ef('0x8')]===_0x32ef('0x9')&&typeof _0x4c8104[_0x32ef('0xa')]===_0x32ef('0x9');var _0x298066=_0x5dfa09[_0x32ef('0xb')];var _0x2bbb50=_0x2c0089?0x0:_0x4c8104[_0x32ef('0x8')];var _0x77df79=_0x2c0089?_0x5dfa09['count']:_0x4c8104['offset']+_0x4c8104[_0x32ef('0xa')];var _0x33281d;if(_0x77df79>=_0x298066){_0x77df79=_0x298066;_0x33281d=0xc8;}else{_0x33281d=0xce;}_0x37dd1d[_0x32ef('0xc')](_0x33281d);return _0x37dd1d[_0x32ef('0xd')]('Content-Range',_0x2bbb50+'-'+_0x77df79+'/'+_0x298066)[_0x32ef('0xe')](_0x5dfa09);}return null;};}function handleError(_0x5afcc2,_0x1a5106){_0x1a5106=_0x1a5106||0x1f4;return function(_0x49d590){logger[_0x32ef('0xf')](_0x49d590[_0x32ef('0x10')]);if(_0x49d590['name']){delete _0x49d590['name'];}_0x5afcc2[_0x32ef('0xc')](_0x1a5106)['send'](_0x49d590);};}function getRealtimeAgents(){return new Promise(function(_0x326fce,_0x40a6e6){return amiClient[_0x32ef('0x11')](_0x32ef('0x12'),{})['then'](function(_0x55bf0b){if(_0x55bf0b['error'])throw new Error(_0x32ef('0x13'));var _0x3950e6=_0x55bf0b[_0x32ef('0x14')];return routingClient['request']('Agents',{})[_0x32ef('0x15')](function(_0x1a9476){if(_0x1a9476[_0x32ef('0xf')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0xbe37f6=_0x1a9476[_0x32ef('0x14')];return _0x326fce(_['merge']({},_0x3950e6,_0xbe37f6));});})[_0x32ef('0x16')](function(_0x314ef1){_0x40a6e6(_0x314ef1);});});}function getRealtimeQueues(_0x26aff3,_0x251084){return new Promise(function(_0x445cda,_0x3aec05){var _0x4de441=_0x251084===_0x32ef('0x17')?amiClient:routingClient;return _0x4de441['request'](_[_0x32ef('0x18')](_0x251084)+_0x32ef('0x19'),_0x26aff3)['then'](function(_0x1af371){if(_0x1af371[_0x32ef('0xf')])throw new Error(util[_0x32ef('0x1a')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x251084));return _0x445cda(_0x1af371['result']);})[_0x32ef('0x16')](function(_0xb30fab){_0x3aec05(_0xb30fab);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x225feb,_0x478bef){return amiClient['request'](_0x32ef('0x1b'),{})['then'](function(_0x51a412){if(_0x51a412[_0x32ef('0xf')])throw new Error(_0x32ef('0x1c'));return _0x225feb(_0x51a412[_0x32ef('0x14')]);})[_0x32ef('0x16')](function(_0x15ce54){_0x478bef(_0x15ce54);});});}function initializeQueues(_0x234175,_0x1874ea,_0x38aed5,_0x338f19){var _0x2f52d7=[_0x32ef('0x1d'),_0x32ef('0x1e'),'waiting',_0x32ef('0x1f'),_0x32ef('0x20')];if(_0x38aed5==='voice'&&_0x338f19===_0x32ef('0x21')){_0x2f52d7[_0x32ef('0x22')](_0x32ef('0x23'),_0x32ef('0x24'),'message',_0x32ef('0x25'),_0x32ef('0x26'),_0x32ef('0x27'),_0x32ef('0x28'),_0x32ef('0x29'),_0x32ef('0x2a'),_0x32ef('0x2b'),'erlangAbandonmentRate',_0x32ef('0x2c'),'dialPredictiveInterval',_0x32ef('0x2d'),_0x32ef('0x2e'),'predictiveIntervalAvailable',_0x32ef('0x2f'),_0x32ef('0x30'),_0x32ef('0x31'),_0x32ef('0x32'),_0x32ef('0x33'),'predictiveIntervalAvgTalktime');}return _0x234175['map'](function(_0x2a5eb5){var _0x5dadf7=_0x2a5eb5[_0x32ef('0x34')]({'plain':!![]});_0x5dadf7[_0x32ef('0x35')]=[];_0x5dadf7[_0x32ef('0x20')]=0x0;_0x5dadf7[_0x32ef('0x36')]=0x0;_0x5dadf7[_0x32ef('0x1d')]=0x0;_0x5dadf7[_0x32ef('0x1e')]=0x0;_0x5dadf7['waiting']=0x0;if(_0x38aed5==='voice'){_0x5dadf7['talking']=0x0;_0x5dadf7[_0x32ef('0x37')]=0x0;if(_0x338f19===_0x32ef('0x21')){_0x5dadf7[_0x32ef('0x23')]=0x0;_0x5dadf7['originated']=0x0;}}var _0x4fb402=_[_0x32ef('0x38')](_0x1874ea,['id',_0x5dadf7['id']]);if(_0x4fb402)_[_0x32ef('0x39')](_0x5dadf7,_[_0x32ef('0x3a')](_0x4fb402,_0x2f52d7));return _0x5dadf7;});}function updateAgentVoiceStatus(_0x480348,_0x4abbd6,_0xcbdec8){var _0x21706f=_[_0x32ef('0x3b')](_0xcbdec8,[_0x32ef('0x3c'),_0x4abbd6[_0x32ef('0x3d')]]);if(_0x21706f[_0x32ef('0x3e')]===0x0)return _0x480348[_0x32ef('0x37')]=!![];if(_[_0x32ef('0x3f')](_0x21706f,[_0x32ef('0x40'),_0x480348['internal'][_0x32ef('0x41')]()]))return _0x480348[_0x32ef('0x1f')]=!![];if(!_0x480348[_0x32ef('0x1f')])return _0x480348['busy']=!![];}function getVoiceQueueAgents(_0x365125,_0x17e489,_0x879e33,_0x393a89){var _0x1faf72=_[_0x32ef('0x38')](_0x17e489,['id',_0x365125['id']]);if(!_0x1faf72)return _0x365125;return _0x1faf72[_0x32ef('0x42')]({'raw':!![]})[_0x32ef('0x15')](function(_0x2ed5cb){for(var _0x57a3c0=0x0;_0x57a3c0<_0x2ed5cb[_0x32ef('0x3e')];_0x57a3c0++){var _0x4615b4=_['find'](_0x879e33,['id',_0x2ed5cb[_0x57a3c0][_0x32ef('0x43')]]);if(!_0x4615b4){_0x4615b4={'id':_0x2ed5cb[_0x57a3c0][_0x32ef('0x43')],'name':_0x2ed5cb[_0x57a3c0][_0x32ef('0x43')],'accountcode':'','online':![]};}var _0x1733e3={'id':_0x4615b4['id'],'name':_0x4615b4[_0x32ef('0x3d')],'internal':_0x4615b4[_0x32ef('0x44')],'online':Boolean(_0x4615b4[_0x32ef('0x45')]),'paused':Boolean(_0x2ed5cb[_0x57a3c0]['paused'])};if(_0x4615b4['voiceStatus']===_0x32ef('0x1f'))updateAgentVoiceStatus(_0x1733e3,_0x365125,_0x393a89);if(_0x1733e3[_0x32ef('0x45')])_0x365125[_0x32ef('0x36')]++;if(_0x1733e3[_0x32ef('0x37')])_0x365125['busy']++;if(_0x1733e3[_0x32ef('0x20')]&&!_0x1733e3[_0x32ef('0x37')]&&!_0x1733e3['talking'])_0x365125[_0x32ef('0x20')]++;_0x365125['agents'][_0x32ef('0x22')](_0x1733e3);}return _0x365125;});}function getQueueAgents(_0x100ec7,_0x37a497,_0x3be46d){var _0x2c2b62=_0x32ef('0x46')+_[_0x32ef('0x18')](_0x3be46d)+_0x32ef('0x47');var _0x3de659=_0x3be46d+_0x32ef('0x48');return db[_0x2c2b62]['findAll']({'where':{[_[_0x32ef('0x18')](_0x3be46d)+'QueueId']:_0x100ec7['id']},'raw':!![]})[_0x32ef('0x15')](function(_0x33c25b){for(var _0x2dd94f=0x0;_0x2dd94f<_0x33c25b['length'];_0x2dd94f++){var _0x502113=_[_0x32ef('0x38')](_0x37a497,['id',_0x33c25b[_0x2dd94f][_0x32ef('0x43')]]);if(!_0x502113){_0x502113={'id':_0x33c25b[_0x2dd94f][_0x32ef('0x43')],'name':_0x33c25b[_0x2dd94f][_0x32ef('0x43')],'online':![],['pauseField']:![]};}var _0x40bf12={'id':_0x502113['id'],'name':_0x502113[_0x32ef('0x3d')],'online':Boolean(_0x502113['online']),'paused':Boolean(_0x502113[_0x3de659])};if(_0x40bf12['online'])_0x100ec7[_0x32ef('0x36')]++;_0x100ec7[_0x32ef('0x35')][_0x32ef('0x22')](_0x40bf12);}return _0x100ec7;});}function isIdle(_0x13b270){return _0x13b270===_0x32ef('0x49')||_0x13b270===_0x32ef('0x4a')||_0x13b270===_0x32ef('0x4b')||_0x13b270===_0x32ef('0x4c')||_[_0x32ef('0x4d')](_0x13b270);}function isAgentPaused(_0x1ebedf,_0x35a294){var _0x30ad49=[_0x1ebedf[_0x32ef('0x4e')],_0x1ebedf['faxPause'],_0x1ebedf[_0x32ef('0x4f')],_0x1ebedf[_0x32ef('0x50')],_0x1ebedf[_0x32ef('0x51')],_0x1ebedf[_0x32ef('0x52')],_0x1ebedf[_0x32ef('0x53')]];if(!_0x35a294)return _[_0x32ef('0x54')](_0x30ad49);var _0x278696=_[_0x32ef('0x3b')](_0x30ad49);return _0x278696[_0x32ef('0x3e')]>0x0&&_0x278696[_0x32ef('0x3e')]<_0x30ad49[_0x32ef('0x3e')]?!![]:![];}function isAgentIdle(_0x29d456){if(_0x29d456[_0x32ef('0x55')]!==_0x32ef('0x49')&&_0x29d456[_0x32ef('0x52')]){_0x29d456[_0x32ef('0x55')]=_0x32ef('0x56');return![];}return _[_0x32ef('0x54')]([_0x29d456['chatStatus'],_0x29d456['faxStatus'],_0x29d456[_0x32ef('0x57')],_0x29d456[_0x32ef('0x58')],_0x29d456[_0x32ef('0x59')],_0x29d456[_0x32ef('0x55')],_0x29d456[_0x32ef('0x5a')]],isIdle);}function getAgentStatus(_0x42fc82){var _0x1572d9=_0x32ef('0x4a');if(isAgentPaused(_0x42fc82))_0x1572d9=_0x32ef('0x56');else if(isAgentPaused(_0x42fc82,!![]))_0x1572d9=_0x32ef('0x5b');else if(isAgentIdle(_0x42fc82))_0x1572d9=_0x32ef('0x49');else _0x1572d9='busy';return _0x1572d9;}exports[_0x32ef('0x5c')]=function(_0x316375,_0x233aa7){var _0x3fe01f={'count':0x0,'rows':[]},_0x38314a={},_0x387cf0,_0x52c588,_0x44a4e9=[_0x32ef('0x5d'),'online',_0x32ef('0x5e'),'lastPauseAt',_0x32ef('0x5f'),_0x32ef('0x60'),'internal',_0x32ef('0x61'),'chatPause',_0x32ef('0x50'),_0x32ef('0x4f'),_0x32ef('0x51'),_0x32ef('0x53'),_0x32ef('0x62'),_0x32ef('0x52'),_0x32ef('0x63'),'openchannelCapacity','mailCapacity',_0x32ef('0x64'),'whatsappCapacity','faxCapacity',_0x32ef('0x65'),_0x32ef('0x66'),_0x32ef('0x67'),_0x32ef('0x68'),_0x32ef('0x69'),_0x32ef('0x6a'),_0x32ef('0x6b'),_0x32ef('0x58'),_0x32ef('0x57'),_0x32ef('0x59'),'whatsappStatus','faxStatus',_0x32ef('0x55'),_0x32ef('0x6c'),'openchannelStatusTime',_0x32ef('0x6d'),_0x32ef('0x6e'),_0x32ef('0x6f'),'faxStatusTime',_0x32ef('0x70'),_0x32ef('0x3c'),_0x32ef('0x71'),'screenrecording','phoneBarEnableScreenRecordingByAgent',_0x32ef('0x72'),'routealias'],_0x1eeb3e=[_0x32ef('0x4e'),'openchannelPause','mailPause',_0x32ef('0x51'),_0x32ef('0x53'),_0x32ef('0x62'),'voicePause',_0x32ef('0x45')];Promise[_0x32ef('0x73')]()[_0x32ef('0x15')](function(){var _0x58ecbb=_[_0x32ef('0x74')](db[_0x32ef('0x46')]['rawAttributes'],function(_0x4a4eaa){return{'name':_0x4a4eaa[_0x32ef('0x75')],'type':_0x4a4eaa[_0x32ef('0x76')][_0x32ef('0x77')]};});_0x316375[_0x32ef('0x78')][_0x32ef('0x79')]=_0x32ef('0x7a');_0x316375['query'][_0x32ef('0x45')]=!![];_0x38314a=qs[_0x32ef('0x7b')](_0x58ecbb,_0x316375);_0x38314a[_0x32ef('0x7c')]=!![];if(_0x316375[_0x32ef('0x7d')][_0x32ef('0x79')]===_0x32ef('0x7d')){var _0x1dc755={'params':{'id':_0x316375[_0x32ef('0x7d')][_0x32ef('0x7e')]},'query':{'section':'Agents','role':_0x32ef('0x7a'),'online':!![],'nolimit':_0x316375[_0x32ef('0x78')][_0x32ef('0x7f')],'sort':_0x316375[_0x32ef('0x78')][_0x32ef('0x80')],'filter':_0x316375['query']['filter'],'raw':!![]}};return db[_0x32ef('0x81')][_0x32ef('0x82')](_0x1dc755);}return db[_0x32ef('0x46')][_0x32ef('0x83')](_0x38314a);})[_0x32ef('0x15')](function(_0x526fb1){_0x3fe01f[_0x32ef('0xb')]=_0x526fb1['count'];_0x387cf0=_0x526fb1[_0x32ef('0x84')];return getRealtimeAgents();})[_0x32ef('0x15')](function(_0x48b6f4){_0x52c588=_0x48b6f4['rows'];return _0x387cf0[_0x32ef('0x74')](function(_0x1538d0){var _0x2e0873=_['find'](_0x52c588,['id',_0x1538d0['id']]);if(_0x2e0873)_['merge'](_0x1538d0,_[_0x32ef('0x3a')](_[_0x32ef('0x85')](_0x2e0873,_0x1eeb3e),_0x44a4e9));_0x1538d0[_0x32ef('0x86')]=getAgentStatus(_0x1538d0);return _0x1538d0;});})[_0x32ef('0x15')](function(_0x4f4006){if(_0x316375[_0x32ef('0x78')][_0x32ef('0x87')]){var _0x974974=_[_0x32ef('0x3b')](_0x4f4006,[_0x32ef('0x86'),_0x316375[_0x32ef('0x78')][_0x32ef('0x87')]]);if(_0x316375[_0x32ef('0x78')][_0x32ef('0x88')]){_0x974974=_[_0x32ef('0x3b')](_0x974974,[_0x32ef('0x5f'),_0x316375[_0x32ef('0x78')]['pauseTypeFilter']]);}}_0x3fe01f['rows']=_0x974974||_0x4f4006;return _0x3fe01f;})[_0x32ef('0x15')](respondWithFilteredResult(_0x233aa7,_0x38314a))[_0x32ef('0x16')](handleError(_0x233aa7,null));};exports['getQueues']=function(_0x3a4be1,_0x5b3e58){var _0x390481=[_0x32ef('0x89'),_0x32ef('0x8a'),'sms',_0x32ef('0x8b'),'fax',_0x32ef('0x8c'),_0x32ef('0x17')];var _0x47e3cc={'count':0x0,'rows':[]},_0x4c70e0={},_0x3c9039,_0x5970db,_0x2b0098,_0x4ce588,_0xdbfb6f;Promise[_0x32ef('0x73')]()[_0x32ef('0x15')](function(){if(_0x3a4be1['query']['channel']){if(!_['includes'](_0x390481,_0x3a4be1[_0x32ef('0x78')]['channel'][_0x32ef('0x8d')]()))throw new Error(_0x32ef('0x8e'));_0x3c9039=_0x3a4be1[_0x32ef('0x78')][_0x32ef('0x8f')][_0x32ef('0x8d')]();}var _0x45a00d=_['startCase'](_0x3c9039)+_0x32ef('0x47');var _0x4e4a31=_['map'](db[_0x45a00d][_0x32ef('0x90')],function(_0x5c4f2a){return{'name':_0x5c4f2a[_0x32ef('0x75')],'type':_0x5c4f2a[_0x32ef('0x76')]['key']};});_0x4c70e0=qs[_0x32ef('0x7b')](_0x4e4a31,_0x3a4be1);if(_0x3a4be1[_0x32ef('0x7d')][_0x32ef('0x79')]===_0x32ef('0x7d')){var _0x1fa36d={'params':{'id':_0x3a4be1[_0x32ef('0x7d')]['userProfileId']},'query':{'section':_0x3c9039==='voice'&&_0x3a4be1[_0x32ef('0x78')]['type']===_0x32ef('0x21')?_0x32ef('0x91'):_[_0x32ef('0x18')](_0x3c9039)+_0x32ef('0x19'),'type':_0x3a4be1[_0x32ef('0x78')][_0x32ef('0x76')],'nolimit':!![],'sort':'name','filter':_0x3a4be1[_0x32ef('0x78')][_0x32ef('0x3b')]}};return db[_0x32ef('0x81')][_0x32ef('0x82')](_0x1fa36d);}return db[_0x45a00d][_0x32ef('0x83')](_0x4c70e0);})['then'](function(_0x4b7e72){_0x47e3cc[_0x32ef('0xb')]=_0x4b7e72[_0x32ef('0xb')];_0x5970db=_0x4b7e72['rows'];return getRealtimeQueues(_0x3a4be1,_0x3c9039);})[_0x32ef('0x15')](function(_0x2e333d){_0x4ce588=_0x2e333d[_0x32ef('0x84')];return getRealtimeAgents();})[_0x32ef('0x15')](function(_0xc3664d){_0x2b0098=_0xc3664d[_0x32ef('0x84')];if(_0x3c9039!=_0x32ef('0x17'))return;return getRealtimeVoiceQueueChannels();})[_0x32ef('0x15')](function(_0x353641){_0xdbfb6f=_0x353641?_0x353641['rows']:[];return initializeQueues(_0x5970db,_0x4ce588,_0x3c9039,_0x3a4be1[_0x32ef('0x78')][_0x32ef('0x76')]);})['then'](function(_0x35653b){var _0x5ea727=_0x35653b[_0x32ef('0x74')](function(_0x4cd376){if(_0x3c9039===_0x32ef('0x17'))return getVoiceQueueAgents(_0x4cd376,_0x5970db,_0x2b0098,_0xdbfb6f);else return getQueueAgents(_0x4cd376,_0x2b0098,_0x3c9039);});return Promise[_0x32ef('0x92')](_0x5ea727);})[_0x32ef('0x15')](function(_0x3e000c){_0x47e3cc['rows']=_0x3e000c;return _0x47e3cc;})[_0x32ef('0x15')](respondWithFilteredResult(_0x5b3e58,_0x4c70e0))[_0x32ef('0x16')](handleError(_0x5b3e58,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index e0b258b..085f268 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4e7f3f,_0x5c57da){var _0x441fd2=function(_0x177c74){while(--_0x177c74){_0x4e7f3f['push'](_0x4e7f3f['shift']());}};_0x441fd2(++_0x5c57da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x218389,_0x2bd114){var _0x519258=function(_0x4ba918){while(--_0x4ba918){_0x218389['push'](_0x218389['shift']());}};_0x519258(++_0x2bd114);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index a321bd4..97d4d81 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 _0xb194=['STRING','DATE','sequelize','INTEGER'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xb194,0x1b2));var _0x4b19=function(_0x57c3ab,_0x353af9){_0x57c3ab=_0x57c3ab-0x0;var _0x5dba29=_0xb194[_0x57c3ab];return _0x5dba29;};'use strict';var Sequelize=require(_0x4b19('0x0'));module['exports']={'state':{'type':Sequelize[_0x4b19('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4b19('0x2')]},'scheduledat':{'type':Sequelize[_0x4b19('0x3')]},'uniqueid':{'type':Sequelize[_0x4b19('0x2')]},'starttime':{'type':Sequelize[_0x4b19('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x4b19('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4b19('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4b19('0x2')]}}; \ No newline at end of file +var _0xa992=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x2d7d4e,_0x1647fe){var _0x175a71=function(_0x356941){while(--_0x356941){_0x2d7d4e['push'](_0x2d7d4e['shift']());}};_0x175a71(++_0x1647fe);}(_0xa992,0x18c));var _0x2a99=function(_0x372875,_0x357654){_0x372875=_0x372875-0x0;var _0x412ace=_0xa992[_0x372875];return _0x412ace;};'use strict';var Sequelize=require(_0x2a99('0x0'));module[_0x2a99('0x1')]={'state':{'type':Sequelize[_0x2a99('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x2a99('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x2a99('0x3')]},'starttime':{'type':Sequelize[_0x2a99('0x4')]},'responsetime':{'type':Sequelize[_0x2a99('0x4')]},'ringtime':{'type':Sequelize[_0x2a99('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x2a99('0x3')]},'campaigntype':{'type':Sequelize[_0x2a99('0x3')]},'membername':{'type':Sequelize[_0x2a99('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 31f0891..34a1dd4 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 _0xe501=['./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3f97f2,_0x36094a){var _0x59282d=function(_0x3ceb85){while(--_0x3ceb85){_0x3f97f2['push'](_0x3f97f2['shift']());}};_0x59282d(++_0x36094a);}(_0xe501,0x13c));var _0x1e50=function(_0x3041ce,_0x382f98){_0x3041ce=_0x3041ce-0x0;var _0x68a7f9=_0xe501[_0x3041ce];return _0x68a7f9;};'use strict';var _=require('lodash');var util=require(_0x1e50('0x0'));var logger=require(_0x1e50('0x1'))(_0x1e50('0x2'));var moment=require(_0x1e50('0x3'));var BPromise=require(_0x1e50('0x4'));var rp=require(_0x1e50('0x5'));var fs=require('fs');var path=require(_0x1e50('0x6'));var rimraf=require(_0x1e50('0x7'));var config=require(_0x1e50('0x8'));var attributes=require(_0x1e50('0x9'));module['exports']=function(_0x334035,_0x554665){return _0x334035[_0x1e50('0xa')](_0x1e50('0xb'),attributes,{'tableName':_0x1e50('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89ba=['ReportAgentPreview','report_agent_preview','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x89ba,0x1d0));var _0xa89b=function(_0x197c29,_0x51df0d){_0x197c29=_0x197c29-0x0;var _0x4cda74=_0x89ba[_0x197c29];return _0x4cda74;};'use strict';var _=require('lodash');var util=require(_0xa89b('0x0'));var logger=require('../../config/logger')(_0xa89b('0x1'));var moment=require(_0xa89b('0x2'));var BPromise=require(_0xa89b('0x3'));var rp=require(_0xa89b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa89b('0x5'));var config=require(_0xa89b('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0xa89b('0x7')]=function(_0x5ea958,_0x54c5f2){return _0x5ea958[_0xa89b('0x8')](_0xa89b('0x9'),attributes,{'tableName':_0xa89b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 451e7cc..99b62b2 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 _0x929a=['info','result','catch','ReportAgentPreview','create','options','CreateReportAgentPreview','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x19611a,_0x26736e){var _0xe7ab99=function(_0x544e04){while(--_0x544e04){_0x19611a['push'](_0x19611a['shift']());}};_0xe7ab99(++_0x26736e);}(_0x929a,0xf2));var _0xa929=function(_0x3d9806,_0x1a9fc9){_0x3d9806=_0x3d9806-0x0;var _0x39c64d=_0x929a[_0x3d9806];return _0x39c64d;};'use strict';var _=require(_0xa929('0x0'));var util=require(_0xa929('0x1'));var moment=require(_0xa929('0x2'));var BPromise=require(_0xa929('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa929('0x4'));var db=require(_0xa929('0x5'))['db'];var utils=require(_0xa929('0x6'));var logger=require('../../config/logger')(_0xa929('0x7'));var config=require(_0xa929('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa929('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16a741,_0x1d8332,_0x25f369){return new BPromise(function(_0x4457be,_0x79e348){return client[_0xa929('0xa')](_0x16a741,_0x25f369)[_0xa929('0xb')](function(_0x582dc8){logger['info'](_0xa929('0xc'),_0x1d8332,_0xa929('0xd'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x1d8332,_0xa929('0xd'),JSON[_0xa929('0xe')](_0x582dc8));if(_0x582dc8['error']){if(_0x582dc8[_0xa929('0xf')][_0xa929('0x10')]===0x1f4){logger[_0xa929('0xf')](_0xa929('0xc'),_0x1d8332,_0x582dc8[_0xa929('0xf')]['message']);return _0x79e348(_0x582dc8[_0xa929('0xf')][_0xa929('0x11')]);}logger['error'](_0xa929('0xc'),_0x1d8332,_0x582dc8[_0xa929('0xf')][_0xa929('0x11')]);return _0x4457be(_0x582dc8['error'][_0xa929('0x11')]);}else{logger[_0xa929('0x12')](_0xa929('0xc'),_0x1d8332,_0xa929('0xd'));_0x4457be(_0x582dc8[_0xa929('0x13')][_0xa929('0x11')]);}})[_0xa929('0x14')](function(_0x446f62){logger[_0xa929('0xf')](_0xa929('0xc'),_0x1d8332,_0x446f62);_0x79e348(_0x446f62);});});}exports['CreateReportAgentPreview']=function(_0x157b58){var _0x5b83a5=this;return new Promise(function(_0x518a65,_0x14b3c4){return db[_0xa929('0x15')][_0xa929('0x16')](_0x157b58['body'],{'raw':_0x157b58[_0xa929('0x17')]?_0x157b58['options']['raw']===undefined?!![]:![]:!![]})[_0xa929('0xb')](function(_0x4cf3ca){logger[_0xa929('0x12')](_0xa929('0x18'),_0x157b58);logger[_0xa929('0x19')](_0xa929('0x18'),_0x157b58,JSON['stringify'](_0x4cf3ca));_0x518a65(_0x4cf3ca);})['catch'](function(_0x39c4af){logger[_0xa929('0xf')](_0xa929('0x18'),_0x39c4af[_0xa929('0x11')],_0x157b58);_0x14b3c4(_0x5b83a5[_0xa929('0xf')](0x1f4,_0x39c4af[_0xa929('0x11')]));});});}; \ No newline at end of file +var _0x8227=['info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateReportAgentPreview','create','body','options','raw','debug','stringify','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0x8227,0xb1));var _0x7822=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8227[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7822('0x0'));var util=require(_0x7822('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7822('0x2'));var fs=require('fs');var Redis=require(_0x7822('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7822('0x4'));var logger=require(_0x7822('0x5'))(_0x7822('0x6'));var config=require(_0x7822('0x7'));var jayson=require(_0x7822('0x8'));var client=jayson['client'][_0x7822('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbd6668,_0x5d9423,_0x1c6bb4){return new BPromise(function(_0x1da940,_0x55bf29){return client[_0x7822('0xa')](_0xbd6668,_0x1c6bb4)[_0x7822('0xb')](function(_0x531ae2){logger[_0x7822('0xc')](_0x7822('0xd'),_0x5d9423,_0x7822('0xe'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x5d9423,_0x7822('0xe'),JSON['stringify'](_0x531ae2));if(_0x531ae2[_0x7822('0xf')]){if(_0x531ae2[_0x7822('0xf')][_0x7822('0x10')]===0x1f4){logger[_0x7822('0xf')](_0x7822('0xd'),_0x5d9423,_0x531ae2['error']['message']);return _0x55bf29(_0x531ae2[_0x7822('0xf')][_0x7822('0x11')]);}logger[_0x7822('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x5d9423,_0x531ae2[_0x7822('0xf')][_0x7822('0x11')]);return _0x1da940(_0x531ae2[_0x7822('0xf')][_0x7822('0x11')]);}else{logger['info'](_0x7822('0xd'),_0x5d9423,_0x7822('0xe'));_0x1da940(_0x531ae2[_0x7822('0x12')][_0x7822('0x11')]);}})['catch'](function(_0x5ea118){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x5d9423,_0x5ea118);_0x55bf29(_0x5ea118);});});}exports[_0x7822('0x13')]=function(_0x146930){var _0x3c2543=this;return new Promise(function(_0x37c800,_0x781a38){return db['ReportAgentPreview'][_0x7822('0x14')](_0x146930[_0x7822('0x15')],{'raw':_0x146930[_0x7822('0x16')]?_0x146930[_0x7822('0x16')][_0x7822('0x17')]===undefined?!![]:![]:!![]})[_0x7822('0xb')](function(_0x5df0ad){logger[_0x7822('0xc')](_0x7822('0x13'),_0x146930);logger[_0x7822('0x18')](_0x7822('0x13'),_0x146930,JSON[_0x7822('0x19')](_0x5df0ad));_0x37c800(_0x5df0ad);})[_0x7822('0x1a')](function(_0x2a41e4){logger[_0x7822('0xf')](_0x7822('0x13'),_0x2a41e4[_0x7822('0x11')],_0x146930);_0x781a38(_0x3c2543['error'](0x1f4,_0x2a41e4[_0x7822('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 0d5a9d5..410951d 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 _0x1529=['updateVoiceQueue','outbound','outboundChannels','agents','/agents/:id/capacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','post','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','multer','util','express','Router','./rpc.controller','/voice/channels','voiceChannels','get','voiceChannelMixMonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put'];(function(_0x3be875,_0x53eabe){var _0x4071d7=function(_0xf6ba4f){while(--_0xf6ba4f){_0x3be875['push'](_0x3be875['shift']());}};_0x4071d7(++_0x53eabe);}(_0x1529,0xc7));var _0x9152=function(_0xed9dd,_0x184eb5){_0xed9dd=_0xed9dd-0x0;var _0x2b0faf=_0x1529[_0xed9dd];return _0x2b0faf;};'use strict';var multer=require(_0x9152('0x0'));var util=require(_0x9152('0x1'));var path=require('path');var express=require(_0x9152('0x2'));var router=express[_0x9152('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x9152('0x4'));router['get'](_0x9152('0x5'),auth['isAuthenticated'](),controller[_0x9152('0x6')]);router[_0x9152('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x9152('0x8')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x9152('0x9')](),controller[_0x9152('0xa')]);router['get'](_0x9152('0xb'),auth['isAuthenticated'](),controller[_0x9152('0xc')]);router[_0x9152('0x7')]('/chat/queues',auth[_0x9152('0x9')](),controller[_0x9152('0xd')]);router[_0x9152('0x7')](_0x9152('0xe'),auth[_0x9152('0x9')](),controller[_0x9152('0xf')]);router[_0x9152('0x7')](_0x9152('0x10'),auth[_0x9152('0x9')](),controller[_0x9152('0x11')]);router[_0x9152('0x7')](_0x9152('0x12'),auth[_0x9152('0x9')](),controller[_0x9152('0x13')]);router['get'](_0x9152('0x14'),auth[_0x9152('0x9')](),controller[_0x9152('0x15')]);router[_0x9152('0x7')](_0x9152('0x16'),auth['isAuthenticated'](),controller[_0x9152('0x17')]);router[_0x9152('0x7')](_0x9152('0x18'),auth[_0x9152('0x9')](),controller[_0x9152('0x19')]);router[_0x9152('0x7')](_0x9152('0x1a'),auth[_0x9152('0x9')](),controller[_0x9152('0x1b')]);router['get']('/voice/queues/channels',auth[_0x9152('0x9')](),controller[_0x9152('0x1c')]);router[_0x9152('0x7')](_0x9152('0x1d'),auth[_0x9152('0x9')](),controller[_0x9152('0x1e')]);router[_0x9152('0x7')](_0x9152('0x1f'),auth[_0x9152('0x9')](),controller[_0x9152('0x20')]);router[_0x9152('0x7')](_0x9152('0x21'),auth[_0x9152('0x9')](),controller[_0x9152('0x22')]);router[_0x9152('0x7')](_0x9152('0x23'),auth[_0x9152('0x9')](),controller[_0x9152('0x24')]);router[_0x9152('0x25')](_0x9152('0x23'),auth[_0x9152('0x9')](),controller[_0x9152('0x26')]);router[_0x9152('0x7')]('/outbound',auth[_0x9152('0x9')](),controller[_0x9152('0x27')]);router[_0x9152('0x7')]('/outbound/channels',auth['isAuthenticated'](),controller[_0x9152('0x28')]);router['get']('/agents',auth['isAuthenticated'](),controller[_0x9152('0x29')]);router[_0x9152('0x25')](_0x9152('0x2a'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x9152('0x7')](_0x9152('0x2b'),auth[_0x9152('0x9')](),controller[_0x9152('0x2c')]);router[_0x9152('0x7')](_0x9152('0x2d'),auth[_0x9152('0x9')](),controller['trunks']);router[_0x9152('0x7')](_0x9152('0x2e'),auth[_0x9152('0x9')](),controller[_0x9152('0x2f')]);router[_0x9152('0x7')](_0x9152('0x30'),auth[_0x9152('0x9')](),controller[_0x9152('0x31')]);router[_0x9152('0x7')](_0x9152('0x32'),auth['isAuthenticated'](),controller[_0x9152('0x33')]);router[_0x9152('0x7')](_0x9152('0x34'),auth[_0x9152('0x9')](),controller[_0x9152('0x35')]);router['get'](_0x9152('0x36'),auth[_0x9152('0x9')](),controller['openchannelQueuesWaitingInteractions']);router[_0x9152('0x7')](_0x9152('0x37'),auth[_0x9152('0x9')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x9152('0x7')](_0x9152('0x38'),auth[_0x9152('0x9')](),controller[_0x9152('0x39')]);router['get']('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x9152('0x3a')]);router[_0x9152('0x7')](_0x9152('0x3b'),auth[_0x9152('0x9')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x9152('0x3c'),auth[_0x9152('0x9')](),controller[_0x9152('0x3d')]('mail'));router[_0x9152('0x7')]('/mail/queues/:id',auth['isAuthenticated'](),controller['showMailQueues']);router[_0x9152('0x3e')]('/chat/queues/:id/notify',auth[_0x9152('0x9')](),controller[_0x9152('0x3d')](_0x9152('0x3f')));router['get'](_0x9152('0x40'),auth['isAuthenticated'](),controller[_0x9152('0x41')]);router['post']('/fax/queues/:id/notify',auth[_0x9152('0x9')](),controller[_0x9152('0x3d')](_0x9152('0x42')));router[_0x9152('0x7')](_0x9152('0x43'),auth[_0x9152('0x9')](),controller[_0x9152('0x44')]);router[_0x9152('0x3e')](_0x9152('0x45'),auth[_0x9152('0x9')](),controller['queueNotify'](_0x9152('0x46')));router[_0x9152('0x7')](_0x9152('0x47'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x9152('0x3e')]('/sms/queues/:id/notify',auth[_0x9152('0x9')](),controller[_0x9152('0x3d')](_0x9152('0x48')));router[_0x9152('0x3e')](_0x9152('0x49'),auth[_0x9152('0x9')](),controller[_0x9152('0x3d')](_0x9152('0x4a')));router['get']('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x9152('0x4b')]);router['get'](_0x9152('0x4c'),auth[_0x9152('0x9')](),controller[_0x9152('0x4d')]);router[_0x9152('0x3e')](_0x9152('0x4e'),auth[_0x9152('0x9')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0x08c3=['/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','queueNotify','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','outbound','/outbound/channels','outboundChannels'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x08c3,0xc7));var _0x308c=function(_0x208d75,_0x92d742){_0x208d75=_0x208d75-0x0;var _0x382d27=_0x08c3[_0x208d75];return _0x382d27;};'use strict';var multer=require(_0x308c('0x0'));var util=require(_0x308c('0x1'));var path=require(_0x308c('0x2'));var express=require(_0x308c('0x3'));var router=express[_0x308c('0x4')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router['get'](_0x308c('0x5'),auth[_0x308c('0x6')](),controller[_0x308c('0x7')]);router[_0x308c('0x8')](_0x308c('0x9'),auth[_0x308c('0x6')](),controller[_0x308c('0xa')]);router[_0x308c('0x8')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x308c('0x6')](),controller[_0x308c('0xb')]);router[_0x308c('0x8')](_0x308c('0xc'),auth['isAuthenticated'](),controller[_0x308c('0xd')]);router[_0x308c('0x8')](_0x308c('0xe'),auth[_0x308c('0x6')](),controller[_0x308c('0xf')]);router['get']('/mail/queues',auth[_0x308c('0x6')](),controller[_0x308c('0x10')]);router[_0x308c('0x8')](_0x308c('0x11'),auth[_0x308c('0x6')](),controller['mailAccounts']);router[_0x308c('0x8')]('/openchannel/queues',auth[_0x308c('0x6')](),controller['openchannelQueues']);router[_0x308c('0x8')](_0x308c('0x12'),auth[_0x308c('0x6')](),controller[_0x308c('0x13')]);router[_0x308c('0x8')](_0x308c('0x14'),auth[_0x308c('0x6')](),controller[_0x308c('0x15')]);router[_0x308c('0x8')](_0x308c('0x16'),auth[_0x308c('0x6')](),controller[_0x308c('0x17')]);router['get']('/voice/queues/preview/:id',auth[_0x308c('0x6')](),controller['voiceQueuesPreview']);router['get'](_0x308c('0x18'),auth[_0x308c('0x6')](),controller[_0x308c('0x19')]);router['get'](_0x308c('0x1a'),auth[_0x308c('0x6')](),controller['voiceQueuesChannel']);router[_0x308c('0x8')](_0x308c('0x1b'),auth[_0x308c('0x6')](),controller[_0x308c('0x1c')]);router[_0x308c('0x8')](_0x308c('0x1d'),auth[_0x308c('0x6')](),controller[_0x308c('0x1e')]);router['get'](_0x308c('0x1f'),auth['isAuthenticated'](),controller[_0x308c('0x20')]);router[_0x308c('0x21')]('/voice/queues/:id',auth[_0x308c('0x6')](),controller[_0x308c('0x22')]);router[_0x308c('0x8')]('/outbound',auth['isAuthenticated'](),controller[_0x308c('0x23')]);router['get'](_0x308c('0x24'),auth[_0x308c('0x6')](),controller[_0x308c('0x25')]);router[_0x308c('0x8')](_0x308c('0x26'),auth['isAuthenticated'](),controller[_0x308c('0x27')]);router[_0x308c('0x21')](_0x308c('0x28'),auth[_0x308c('0x6')](),controller[_0x308c('0x29')]);router[_0x308c('0x8')](_0x308c('0x2a'),auth[_0x308c('0x6')](),controller[_0x308c('0x2b')]);router[_0x308c('0x8')](_0x308c('0x2c'),auth[_0x308c('0x6')](),controller[_0x308c('0x2d')]);router[_0x308c('0x8')]('/campaigns',auth[_0x308c('0x6')](),controller[_0x308c('0x2e')]);router['get'](_0x308c('0x2f'),auth[_0x308c('0x6')](),controller['faxAccounts']);router[_0x308c('0x8')]('/chat/queues/waitinginteractions',auth[_0x308c('0x6')](),controller[_0x308c('0x30')]);router['get'](_0x308c('0x31'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0x308c('0x8')](_0x308c('0x32'),auth['isAuthenticated'](),controller[_0x308c('0x33')]);router[_0x308c('0x8')](_0x308c('0x34'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x308c('0x8')](_0x308c('0x35'),auth[_0x308c('0x6')](),controller[_0x308c('0x36')]);router['get'](_0x308c('0x37'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0x308c('0x8')]('/fax/queues/waitinginteractions',auth[_0x308c('0x6')](),controller[_0x308c('0x38')]);router['post'](_0x308c('0x39'),auth[_0x308c('0x6')](),controller['queueNotify']('mail'));router[_0x308c('0x8')](_0x308c('0x3a'),auth[_0x308c('0x6')](),controller[_0x308c('0x3b')]);router[_0x308c('0x3c')](_0x308c('0x3d'),auth[_0x308c('0x6')](),controller[_0x308c('0x3e')]('chat'));router[_0x308c('0x8')]('/chat/queues/:id',auth[_0x308c('0x6')](),controller['showChatQueues']);router['post'](_0x308c('0x3f'),auth['isAuthenticated'](),controller[_0x308c('0x3e')](_0x308c('0x40')));router[_0x308c('0x8')](_0x308c('0x41'),auth[_0x308c('0x6')](),controller[_0x308c('0x42')]);router[_0x308c('0x3c')](_0x308c('0x43'),auth[_0x308c('0x6')](),controller['queueNotify'](_0x308c('0x44')));router['get'](_0x308c('0x45'),auth[_0x308c('0x6')](),controller[_0x308c('0x46')]);router[_0x308c('0x3c')](_0x308c('0x47'),auth[_0x308c('0x6')](),controller[_0x308c('0x3e')](_0x308c('0x48')));router[_0x308c('0x3c')](_0x308c('0x49'),auth['isAuthenticated'](),controller[_0x308c('0x3e')]('whatsapp'));router[_0x308c('0x8')]('/sms/queues/:id',auth[_0x308c('0x6')](),controller[_0x308c('0x4a')]);router[_0x308c('0x8')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x308c('0x4b')]);router['post'](_0x308c('0x4c'),auth[_0x308c('0x6')](),controller[_0x308c('0x4d')]);module[_0x308c('0x4e')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index ca7c400..9196079 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 _0x7dfd=['interface','format','SIP/%s','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','queue_id','uniq','filter','indexOf','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','findOne','InteractionId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes'];(function(_0xa6e9fa,_0x33372a){var _0x44592c=function(_0x53febe){while(--_0x53febe){_0xa6e9fa['push'](_0xa6e9fa['shift']());}};_0x44592c(++_0x33372a);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xd7df('0x0'));var moment=require(_0xd7df('0x1'));var _=require(_0xd7df('0x2'));var util=require(_0xd7df('0x3'));var db=require(_0xd7df('0x4'))['db'];var logger=require(_0xd7df('0x5'))(_0xd7df('0x6'));var jayson=require(_0xd7df('0x7'));var amiClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232a});var mailClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232b});var routingClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x354ea7,_0x16e50,_0x2c48a4){return new BPromise(function(_0x5c220a,_0xab6742){var _0xb3557a=_0x2c48a4?_0x2c48a4:amiClient;return _0xb3557a[_0xd7df('0xa')](_0x354ea7,_0x16e50)[_0xd7df('0xb')](function(_0x5e59c3){if(_0x5e59c3[_0xd7df('0xc')]){if(_0x5e59c3['error'][_0xd7df('0xd')]===0x1f4){return _0xab6742(_0x5e59c3['error'][_0xd7df('0xe')]);}return _0x5c220a(_0x5e59c3[_0xd7df('0xc')][_0xd7df('0xe')]);}else{_0x5c220a(_0x5e59c3[_0xd7df('0xf')]);}})[_0xd7df('0x10')](function(_0x174c88){_0xab6742(_0x174c88);});});}function respondWithResult(_0x2e8187,_0x3da618){_0x3da618=_0x3da618||0xc8;return function(_0x7ba3c){if(_0x7ba3c){return _0x2e8187[_0xd7df('0x11')](_0x3da618)[_0xd7df('0x12')](_0x7ba3c);}return _0x2e8187[_0xd7df('0x13')](0x194);};}function handleError(_0xe1595f,_0x196632){_0x196632=_0x196632||0x1f4;return function(_0x3b2559){logger[_0xd7df('0xc')](_0x3b2559[_0xd7df('0x14')]);if(_0x3b2559['name']){delete _0x3b2559[_0xd7df('0x15')];}_0xe1595f[_0xd7df('0x11')](_0x196632)['send'](_0x3b2559);};}function findById(_0x18d38f){return function(_0xbe1c5e){if(!_['isNil'](_0x18d38f)&&!_[_0xd7df('0x16')](_0xbe1c5e)&&!_[_0xd7df('0x16')](_0xbe1c5e[_0xd7df('0x17')])){return _['find'](_0xbe1c5e[_0xd7df('0x17')],function(_0x471621){return _0x471621['id']==_0x18d38f;});}return null;};}exports[_0xd7df('0x18')]=function(_0x5ba653,_0x96d86e){return respondWithRpcPromise(_0xd7df('0x19'),_0x5ba653[_0xd7df('0x1a')])['then'](respondWithResult(_0x96d86e,null))[_0xd7df('0x10')](handleError(_0x96d86e,null));};exports['voiceChannelMixMonitor']=function(_0x225e33,_0x5ab737){return respondWithRpcPromise(_0xd7df('0x1b'),_[_0xd7df('0x1c')](_0x225e33[_0xd7df('0x1a')],_0x225e33['params']))[_0xd7df('0xb')](respondWithResult(_0x5ab737,null))['catch'](handleError(_0x5ab737,null));};exports[_0xd7df('0x1d')]=function(_0x379e4a,_0x40e7af){return respondWithRpcPromise(_0xd7df('0x1e'),_[_0xd7df('0x1c')](_0x379e4a[_0xd7df('0x1a')],_0x379e4a[_0xd7df('0x1f')]))['then'](respondWithResult(_0x40e7af,null))['catch'](handleError(_0x40e7af,null));};exports[_0xd7df('0x20')]=function(_0x38db14,_0x26047f){return respondWithRpcPromise(_0xd7df('0x21'),_0x38db14[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x26047f,null))[_0xd7df('0x10')](handleError(_0x26047f,null));};exports[_0xd7df('0x22')]=function(_0x163904,_0x5c4d17){return respondWithRpcPromise(_0xd7df('0x21'),_0x163904[_0xd7df('0x1a')])[_0xd7df('0xb')](findById(_0x163904[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x5c4d17,null))[_0xd7df('0x10')](handleError(_0x5c4d17,null));};exports[_0xd7df('0x23')]=function(_0x36de76,_0x5195cf){return respondWithRpcPromise('UpdateVoiceQueue',_['merge'](_0x36de76['body'],_0x36de76['params']))[_0xd7df('0xb')](respondWithResult(_0x5195cf,null))['catch'](handleError(_0x5195cf,null));};exports[_0xd7df('0x24')]=function(_0x156612,_0x503a90){return respondWithRpcPromise(_0xd7df('0x25'),_[_0xd7df('0x1c')](_0x156612['query'],_0x156612[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x503a90,null))[_0xd7df('0x10')](handleError(_0x503a90,null));};exports[_0xd7df('0x26')]=function(_0x40f965,_0x3304c4){return respondWithRpcPromise('VoiceQueuesChannels',_0x40f965[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x3304c4,null))[_0xd7df('0x10')](handleError(_0x3304c4,null));};exports[_0xd7df('0x27')]=function(_0x363f2d,_0x4cecf2){return respondWithRpcPromise(_0xd7df('0x28'),_[_0xd7df('0x1c')](_0x363f2d[_0xd7df('0x1a')],_0x363f2d[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x4cecf2,null))['catch'](handleError(_0x4cecf2,null));};exports['voiceQueuesChannelHangup']=function(_0x4051fb,_0x564562){return respondWithRpcPromise(_0xd7df('0x29'),_[_0xd7df('0x1c')](_0x4051fb[_0xd7df('0x1a')],_0x4051fb[_0xd7df('0x1f')]))['then'](respondWithResult(_0x564562,null))['catch'](handleError(_0x564562,null));};exports['voiceQueuesChannelRedirect']=function(_0x2a96e3,_0x15e682){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xd7df('0x1c')](_0x2a96e3[_0xd7df('0x1a')],_0x2a96e3[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x15e682,null))['catch'](handleError(_0x15e682,null));};exports[_0xd7df('0x2a')]=function(_0x45642c,_0x5f0a6d){return respondWithRpcPromise(_0xd7df('0x2b'),_0x45642c['query'])[_0xd7df('0xb')](respondWithResult(_0x5f0a6d,null))[_0xd7df('0x10')](handleError(_0x5f0a6d,null));};exports[_0xd7df('0x2c')]=function(_0x59c755,_0x138391){return respondWithRpcPromise(_0xd7df('0x2d'),_0x59c755[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x138391,null))['catch'](handleError(_0x138391,null));};exports[_0xd7df('0x2e')]=function(_0x230857,_0x2314e6){var _0x4f6286;return respondWithRpcPromise(_0xd7df('0x2f'),_0x230857[_0xd7df('0x1a')])[_0xd7df('0xb')](function(_0x517824){_0x4f6286=_0x517824;return respondWithRpcPromise(_0xd7df('0x2f'),_0x230857[_0xd7df('0x1a')],routingClient);})['then'](function(_0x4b2561){return _[_0xd7df('0x1c')]({},_0x4b2561,_0x4f6286);})[_0xd7df('0xb')](respondWithResult(_0x2314e6,null))[_0xd7df('0x10')](handleError(_0x2314e6,null));};exports['agentCapacity']=function(_0x5e8cd0,_0x2c149e){if(_0x5e8cd0['body']&&_0x5e8cd0[_0xd7df('0x30')]['interaction']&&_0x5e8cd0['user']&&_0x5e8cd0[_0xd7df('0x31')]['name']){for(var _0x18ef10 in _0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')]){if(_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0xd7df('0x33')](_0x18ef10)){db[_0xd7df('0x34')][_0xd7df('0x35')]({'where':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')]['name'],'type':_0xd7df('0x36'),'exitAt':null,'uniqueid':_0x5e8cd0['body'][_0xd7df('0x32')][_0x18ef10]&&_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10][_0xd7df('0x37')]?{'$notIn':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10]}:{'$ne':null}}})[_0xd7df('0xb')](function(_0x38056b){var _0x3a3c1a=moment()['format'](_0xd7df('0x38'));for(var _0x563f90=0x0,_0x49085b=_0x38056b['length'];_0x563f90<_0x49085b;_0x563f90+=0x1){_0x38056b[_0x563f90][_0xd7df('0x39')]({'exitAt':_0x3a3c1a});}});for(var _0x162900=0x0;_0x162900<_0x5e8cd0[_0xd7df('0x30')]['interaction'][_0x18ef10]['length'];_0x162900+=0x1){db[_0xd7df('0x34')]['findOrCreate']({'where':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x15')],'type':_0xd7df('0x36'),'uniqueid':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10][_0x162900],'exitAt':null},'defaults':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x15')],'interface':_[_0xd7df('0x16')](_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3a')])?util[_0xd7df('0x3b')](_0xd7df('0x3c'),_0x5e8cd0['user'][_0xd7df('0x15')]):_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3a')],'type':_0xd7df('0x36'),'enterAt':moment()[_0xd7df('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xd7df('0x3d'),'internal':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3e')],'uniqueid':_0x5e8cd0['body'][_0xd7df('0x32')][_0x18ef10][_0x162900]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x5e8cd0[_0xd7df('0x1f')]['id'],'capacity':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x3f')]},routingClient)[_0xd7df('0xb')](respondWithResult(_0x2c149e,null))[_0xd7df('0x10')](handleError(_0x2c149e,null));};exports['telephones']=function(_0x4abe81,_0x53ec02){return respondWithRpcPromise(_0xd7df('0x40'),_0x4abe81['query'])[_0xd7df('0xb')](respondWithResult(_0x53ec02,null))[_0xd7df('0x10')](handleError(_0x53ec02,null));};exports[_0xd7df('0x41')]=function(_0xdf3046,_0x275af9){return respondWithRpcPromise(_0xd7df('0x42'),_0xdf3046[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x275af9,null))[_0xd7df('0x10')](handleError(_0x275af9,null));};exports[_0xd7df('0x43')]=function(_0x382d11,_0x327365){return respondWithRpcPromise(_0xd7df('0x44'),_0x382d11[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x327365,null))[_0xd7df('0x10')](handleError(_0x327365,null));};exports['chatQueues']=function(_0x332db5,_0x28c9b7){return respondWithRpcPromise('ChatQueues',_0x332db5['query'],routingClient)[_0xd7df('0xb')](respondWithResult(_0x28c9b7,null))['catch'](handleError(_0x28c9b7,null));};exports[_0xd7df('0x45')]=function(_0x4fb55a,_0x1f34c2){return respondWithRpcPromise(_0xd7df('0x46'),_0x4fb55a[_0xd7df('0x1a')],routingClient)['then'](findById(_0x4fb55a['params']['id']))['then'](respondWithResult(_0x1f34c2,null))[_0xd7df('0x10')](handleError(_0x1f34c2,null));};exports[_0xd7df('0x47')]=function(_0x19c387,_0x527b6f){return respondWithRpcPromise(_0xd7df('0x48'),_0x19c387[_0xd7df('0x1a')],routingClient)['then'](respondWithResult(_0x527b6f,null))[_0xd7df('0x10')](handleError(_0x527b6f,null));};exports[_0xd7df('0x49')]=function(_0x35204f,_0x25d187){return respondWithRpcPromise(_0xd7df('0x48'),_0x35204f[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x35204f[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x25d187,null))[_0xd7df('0x10')](handleError(_0x25d187,null));};exports[_0xd7df('0x4a')]=function(_0x398e43,_0x3dba78){return respondWithRpcPromise(_0xd7df('0x4b'),_0x398e43[_0xd7df('0x1a')],mailClient)[_0xd7df('0xb')](respondWithResult(_0x3dba78,null))[_0xd7df('0x10')](handleError(_0x3dba78,null));};exports[_0xd7df('0x4c')]=function(_0x3f2775,_0x1e6277){return respondWithRpcPromise(_0xd7df('0x4d'),_0x3f2775[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x1e6277,null))[_0xd7df('0x10')](handleError(_0x1e6277,null));};exports[_0xd7df('0x4e')]=function(_0x3912d6,_0x51ae2b){return respondWithRpcPromise('OpenchannelQueues',_0x3912d6[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x3912d6[_0xd7df('0x1f')]['id']))['then'](respondWithResult(_0x51ae2b,null))[_0xd7df('0x10')](handleError(_0x51ae2b,null));};exports[_0xd7df('0x4f')]=function(_0x1e87aa,_0x2786a6){return respondWithRpcPromise('SmsQueues',_0x1e87aa[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x2786a6,null))[_0xd7df('0x10')](handleError(_0x2786a6,null));};exports[_0xd7df('0x50')]=function(_0x19a25b,_0x2fbc53){return respondWithRpcPromise(_0xd7df('0x51'),_0x19a25b[_0xd7df('0x1a')],routingClient)['then'](findById(_0x19a25b[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x2fbc53,null))['catch'](handleError(_0x2fbc53,null));};exports['whatsappQueues']=function(_0x481fa5,_0x264c5b){return respondWithRpcPromise(_0xd7df('0x52'),_0x481fa5[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x264c5b,null))['catch'](handleError(_0x264c5b,null));};exports[_0xd7df('0x53')]=function(_0x3d45cf,_0x19df03){return respondWithRpcPromise(_0xd7df('0x52'),_0x3d45cf[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x3d45cf[_0xd7df('0x1f')]['id']))['then'](respondWithResult(_0x19df03,null))['catch'](handleError(_0x19df03,null));};exports[_0xd7df('0x54')]=function(_0x5c1e68,_0x588537){return respondWithRpcPromise(_0xd7df('0x55'),_0x5c1e68[_0xd7df('0x1a')],routingClient)['then'](respondWithResult(_0x588537,null))['catch'](handleError(_0x588537,null));};exports[_0xd7df('0x56')]=function(_0x44d824,_0x49bf7e){return respondWithRpcPromise(_0xd7df('0x55'),_0x44d824[_0xd7df('0x1a')],routingClient)['then'](findById(_0x44d824[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x49bf7e,null))['catch'](handleError(_0x49bf7e,null));};exports[_0xd7df('0x57')]=function(_0x519f72,_0x56f55d){return respondWithRpcPromise(_0xd7df('0x58'),_0x519f72[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x56f55d,null))[_0xd7df('0x10')](handleError(_0x56f55d,null));};exports[_0xd7df('0x59')]=function(_0x40b2a1,_0x5831c1){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x40b2a1[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x5831c1,null))[_0xd7df('0x10')](handleError(_0x5831c1,null));};exports[_0xd7df('0x5a')]=function(_0x19b0e6,_0x31f681){return respondWithRpcPromise(_0xd7df('0x5b'),_0x19b0e6[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x31f681,null))['catch'](handleError(_0x31f681,null));};exports[_0xd7df('0x5c')]=function(_0x1682ca,_0x4e9806){return respondWithRpcPromise(_0xd7df('0x5d'),_0x1682ca[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x4e9806,null))[_0xd7df('0x10')](handleError(_0x4e9806,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4e5363,_0x5628ed){return respondWithRpcPromise(_0xd7df('0x5d'),_0x4e5363['query'],routingClient)[_0xd7df('0xb')](function(_0x2b1b30){if(_0x4e5363[_0xd7df('0x1a')][_0xd7df('0x5e')]!==undefined){var _0x2d8a31=_(_0x2b1b30[_0xd7df('0x17')])['filter']([_0x4e5363[_0xd7df('0x1a')][_0xd7df('0x5e')],_0x4e5363[_0xd7df('0x1f')]['id']])['map'](_0xd7df('0x5f'))[_0xd7df('0x60')]()['value']();return _0x2b1b30[_0xd7df('0x17')][_0xd7df('0x61')](function(_0x157290){return _0x2d8a31[_0xd7df('0x62')](_0x157290[_0xd7df('0x5f')])>-0x1;});}else{return _0x2b1b30[_0xd7df('0x17')][_0xd7df('0x61')](function(_0x5e93cc){return _0x5e93cc[_0xd7df('0x5f')]===parseInt(_0x4e5363[_0xd7df('0x1f')]['id']);});}})[_0xd7df('0xb')](respondWithResult(_0x5628ed,null))[_0xd7df('0x10')](handleError(_0x5628ed,null));};exports['smsQueuesWaitingInteractions']=function(_0x531a07,_0x2e1e96){return respondWithRpcPromise(_0xd7df('0x63'),_0x531a07[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x2e1e96,null))[_0xd7df('0x10')](handleError(_0x2e1e96,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2329ce,_0x4f739b){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x2329ce[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x4f739b,null))[_0xd7df('0x10')](handleError(_0x4f739b,null));};exports[_0xd7df('0x64')]=function(_0x30c401,_0x3ece24){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x30c401['query'],routingClient)[_0xd7df('0xb')](respondWithResult(_0x3ece24,null))[_0xd7df('0x10')](handleError(_0x3ece24,null));};exports[_0xd7df('0x65')]=function(_0x175a36){return function(_0x5cb2b0,_0xac3b73){var _0x5df36d,_0x158bd9;var _0x5b73e5=_[_0xd7df('0x66')](_0x175a36);var _0x1ed032=_0x175a36===_0xd7df('0x67')?_0xd7df('0x68'):_0xd7df('0x69');return db[_0x5b73e5+_0xd7df('0x6a')]['findOne']({'raw':!![],'where':{'id':_0x5cb2b0[_0xd7df('0x1f')]['id']}})['then'](function(_0x1e2355){if(_[_0xd7df('0x16')](_0x1e2355)){throw new Error(_0x5b73e5+_0xd7df('0x6b'));}_0x5df36d=_0x1e2355;return db[_0x5b73e5+_0xd7df('0x6c')]['findOne']({'where':{'id':_0x5cb2b0[_0xd7df('0x30')][_0xd7df('0x6d')]},'include':[{'model':db[_0x5b73e5+_0xd7df('0x6e')],'as':_0xd7df('0x6e')},{'model':db[_0x5b73e5+_0x1ed032],'as':_0xd7df('0x69')}]});})[_0xd7df('0xb')](function(_0x40a665){if(_[_0xd7df('0x16')](_0x40a665)){throw new Error(_0x5b73e5+_0xd7df('0x6f'));}_0x158bd9=_0x40a665;return _0x40a665[_0xd7df('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd7df('0xb')](function(){var _0x15bd27={'uniqueid':_0x175a36+'.'+_0x158bd9['id']+'.'+_0x158bd9['Interaction']['id'],'FromUserId':_0x5cb2b0[_0xd7df('0x31')]['id'],'type':_0xd7df('0x71')};_0x15bd27[_0x5b73e5+_0xd7df('0x72')]=_0x158bd9['id'];_0x15bd27[_0x5b73e5+'InteractionId']=_0x158bd9['Interaction']['id'];_0x15bd27[_0xd7df('0x73')+_0x5b73e5+_0x1ed032+'Id']=_0x158bd9[_0xd7df('0x69')]['id'];_0x15bd27['To'+_0x5b73e5+_0xd7df('0x74')]=_0x5df36d['id'];return db[_0x5b73e5+_0xd7df('0x75')][_0xd7df('0x76')](_0x15bd27);})[_0xd7df('0xb')](function(){return respondWithRpcPromise(_0xd7df('0x77'),{'channel':_0x175a36,'interaction':_0x158bd9[_0xd7df('0x6e')],'message':_0x158bd9,'account':_0x158bd9[_0xd7df('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd7df('0x71'),'appdata':_0x5df36d['name']+','+(_0x158bd9[_0xd7df('0x69')][_0xd7df('0x78')]||0x12c),'interval':_0xd7df('0x79')}]},routingClient);})[_0xd7df('0xb')](respondWithResult(_0xac3b73,null))[_0xd7df('0x10')](handleError(_0xac3b73,null));};};exports[_0xd7df('0x7a')]=function(_0x50c5b9,_0x518092){var _0xa3ae43,_0x31b159;if(_[_0xd7df('0x16')](_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x7b')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x1a888c=_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x7b')];var _0x3d9fba=_[_0xd7df('0x66')](_0x1a888c);var _0x2861e3=_0x1a888c===_0xd7df('0x67')?'Website':_0xd7df('0x69');return db['User']['findOne']({'raw':!![],'where':{'id':_0x50c5b9[_0xd7df('0x1f')]['id'],'role':_0xd7df('0x3d')}})[_0xd7df('0xb')](function(_0x5092d2){if(_[_0xd7df('0x16')](_0x5092d2)){throw new Error('Agent\x20not\x20found');}_0xa3ae43=_0x5092d2;return db[_0x3d9fba+'Message'][_0xd7df('0x7c')]({'where':{'id':_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x6d')]},'include':[{'model':db[_0x3d9fba+_0xd7df('0x6e')],'as':_0xd7df('0x6e')},{'model':db[_0x3d9fba+_0x2861e3],'as':'Account'}]});})['then'](function(_0x3f2ecd){if(_[_0xd7df('0x16')](_0x3f2ecd)){throw new Error(_0x3d9fba+_0xd7df('0x6f'));}_0x31b159=_0x3f2ecd;return _0x3f2ecd[_0xd7df('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd7df('0xb')](function(){var _0xc447e8={'uniqueid':_0x1a888c+'.'+_0x31b159['id']+'.'+_0x31b159[_0xd7df('0x6e')]['id'],'FromUserId':_0x50c5b9[_0xd7df('0x31')]['id'],'type':_0xd7df('0x71'),'ToUserId':_0xa3ae43['id']};_0xc447e8[_0x3d9fba+_0xd7df('0x72')]=_0x31b159['id'];_0xc447e8[_0x3d9fba+_0xd7df('0x7d')]=_0x31b159[_0xd7df('0x6e')]['id'];_0xc447e8[_0xd7df('0x73')+_0x3d9fba+_0x2861e3+'Id']=_0x31b159['Account']['id'];return db[_0x3d9fba+_0xd7df('0x75')][_0xd7df('0x76')](_0xc447e8);})[_0xd7df('0xb')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a888c,'interaction':_0x31b159[_0xd7df('0x6e')],'message':_0x31b159,'account':_0x31b159['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xd7df('0x3d'),'appdata':_0xa3ae43[_0xd7df('0x15')]+','+(_0x31b159['Account'][_0xd7df('0x7e')]||0x12c),'interval':_0xd7df('0x79')}]},routingClient);})[_0xd7df('0xb')](respondWithResult(_0x518092,null))[_0xd7df('0x10')](handleError(_0x518092,null));}; \ No newline at end of file +var _0x6aa7=['rows','find','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','hasOwnProperty','MemberReport','findAll','user','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','queue_id','uniq','value','indexOf','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','Website','Account','Queue','\x20Queue\x20not\x20found','Message','messageId','\x20Message\x20not\x20found','update','Interaction','queue','MessageId','InteractionId','From','TransferReport','create','Start','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','User','findOne','Agent\x20not\x20found','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','error','code','message','result','catch','status','json','sendStatus','name','send','isNil'];(function(_0x547219,_0x3aa120){var _0x371245=function(_0xf3e0ba){while(--_0xf3e0ba){_0x547219['push'](_0x547219['shift']());}};_0x371245(++_0x3aa120);}(_0x6aa7,0x178));var _0x76aa=function(_0x56b358,_0x3fecab){_0x56b358=_0x56b358-0x0;var _0x21d5f5=_0x6aa7[_0x56b358];return _0x21d5f5;};'use strict';var BPromise=require(_0x76aa('0x0'));var moment=require('moment');var _=require(_0x76aa('0x1'));var util=require(_0x76aa('0x2'));var db=require(_0x76aa('0x3'))['db'];var logger=require(_0x76aa('0x4'))('api');var jayson=require(_0x76aa('0x5'));var amiClient=jayson[_0x76aa('0x6')][_0x76aa('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x76aa('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){var _0x266bd5=_0xa9b695?_0xa9b695:amiClient;return _0x266bd5[_0x76aa('0x8')](_0x32dee5,_0x36d12b)['then'](function(_0xcd99aa){if(_0xcd99aa[_0x76aa('0x9')]){if(_0xcd99aa[_0x76aa('0x9')][_0x76aa('0xa')]===0x1f4){return _0x3dae33(_0xcd99aa[_0x76aa('0x9')][_0x76aa('0xb')]);}return _0x56d6bc(_0xcd99aa[_0x76aa('0x9')][_0x76aa('0xb')]);}else{_0x56d6bc(_0xcd99aa[_0x76aa('0xc')]);}})[_0x76aa('0xd')](function(_0x5e5f47){_0x3dae33(_0x5e5f47);});});}function respondWithResult(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xc8;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0xe')](_0x5df49c)[_0x76aa('0xf')](_0x226536);}return _0x112c39[_0x76aa('0x10')](0x194);};}function handleError(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0x1f4;return function(_0x5f5b59){logger[_0x76aa('0x9')](_0x5f5b59['stack']);if(_0x5f5b59[_0x76aa('0x11')]){delete _0x5f5b59[_0x76aa('0x11')];}_0x10432c['status'](_0x4e309f)[_0x76aa('0x12')](_0x5f5b59);};}function findById(_0x550d9a){return function(_0x328381){if(!_['isNil'](_0x550d9a)&&!_[_0x76aa('0x13')](_0x328381)&&!_[_0x76aa('0x13')](_0x328381[_0x76aa('0x14')])){return _[_0x76aa('0x15')](_0x328381[_0x76aa('0x14')],function(_0x3ead3f){return _0x3ead3f['id']==_0x550d9a;});}return null;};}exports['voiceChannels']=function(_0x5d6202,_0x256636){return respondWithRpcPromise(_0x76aa('0x16'),_0x5d6202[_0x76aa('0x17')])[_0x76aa('0x18')](respondWithResult(_0x256636,null))[_0x76aa('0xd')](handleError(_0x256636,null));};exports[_0x76aa('0x19')]=function(_0x19af92,_0x2eaf48){return respondWithRpcPromise(_0x76aa('0x1a'),_['merge'](_0x19af92[_0x76aa('0x17')],_0x19af92[_0x76aa('0x1b')]))[_0x76aa('0x18')](respondWithResult(_0x2eaf48,null))['catch'](handleError(_0x2eaf48,null));};exports[_0x76aa('0x1c')]=function(_0x189cb6,_0x31252f){return respondWithRpcPromise(_0x76aa('0x1d'),_[_0x76aa('0x1e')](_0x189cb6[_0x76aa('0x17')],_0x189cb6[_0x76aa('0x1b')]))[_0x76aa('0x18')](respondWithResult(_0x31252f,null))[_0x76aa('0xd')](handleError(_0x31252f,null));};exports[_0x76aa('0x1f')]=function(_0x37f1ab,_0x26b75e){return respondWithRpcPromise(_0x76aa('0x20'),_0x37f1ab['query'])[_0x76aa('0x18')](respondWithResult(_0x26b75e,null))[_0x76aa('0xd')](handleError(_0x26b75e,null));};exports[_0x76aa('0x21')]=function(_0x2e7ab4,_0xa1e6){return respondWithRpcPromise(_0x76aa('0x20'),_0x2e7ab4[_0x76aa('0x17')])[_0x76aa('0x18')](findById(_0x2e7ab4[_0x76aa('0x1b')]['id']))[_0x76aa('0x18')](respondWithResult(_0xa1e6,null))['catch'](handleError(_0xa1e6,null));};exports[_0x76aa('0x22')]=function(_0x5a8030,_0x994550){return respondWithRpcPromise(_0x76aa('0x23'),_[_0x76aa('0x1e')](_0x5a8030[_0x76aa('0x24')],_0x5a8030[_0x76aa('0x1b')]))[_0x76aa('0x18')](respondWithResult(_0x994550,null))[_0x76aa('0xd')](handleError(_0x994550,null));};exports[_0x76aa('0x25')]=function(_0x19fd4f,_0x3ea05a){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x76aa('0x1e')](_0x19fd4f[_0x76aa('0x17')],_0x19fd4f[_0x76aa('0x1b')]))[_0x76aa('0x18')](respondWithResult(_0x3ea05a,null))[_0x76aa('0xd')](handleError(_0x3ea05a,null));};exports[_0x76aa('0x26')]=function(_0x35a705,_0x4eb57a){return respondWithRpcPromise(_0x76aa('0x27'),_0x35a705[_0x76aa('0x17')])['then'](respondWithResult(_0x4eb57a,null))[_0x76aa('0xd')](handleError(_0x4eb57a,null));};exports['voiceQueuesChannel']=function(_0x2e2ba3,_0x4c90b6){return respondWithRpcPromise(_0x76aa('0x28'),_['merge'](_0x2e2ba3['query'],_0x2e2ba3[_0x76aa('0x1b')]))[_0x76aa('0x18')](respondWithResult(_0x4c90b6,null))[_0x76aa('0xd')](handleError(_0x4c90b6,null));};exports[_0x76aa('0x29')]=function(_0x595a0f,_0x592596){return respondWithRpcPromise(_0x76aa('0x2a'),_[_0x76aa('0x1e')](_0x595a0f[_0x76aa('0x17')],_0x595a0f[_0x76aa('0x1b')]))[_0x76aa('0x18')](respondWithResult(_0x592596,null))['catch'](handleError(_0x592596,null));};exports[_0x76aa('0x2b')]=function(_0x5c77f1,_0x5086f5){return respondWithRpcPromise(_0x76aa('0x2c'),_[_0x76aa('0x1e')](_0x5c77f1[_0x76aa('0x17')],_0x5c77f1[_0x76aa('0x1b')]))['then'](respondWithResult(_0x5086f5,null))[_0x76aa('0xd')](handleError(_0x5086f5,null));};exports[_0x76aa('0x2d')]=function(_0x2eea79,_0x4e131a){return respondWithRpcPromise(_0x76aa('0x2e'),_0x2eea79[_0x76aa('0x17')])[_0x76aa('0x18')](respondWithResult(_0x4e131a,null))[_0x76aa('0xd')](handleError(_0x4e131a,null));};exports[_0x76aa('0x2f')]=function(_0x982e62,_0x878903){return respondWithRpcPromise(_0x76aa('0x30'),_0x982e62[_0x76aa('0x17')])['then'](respondWithResult(_0x878903,null))[_0x76aa('0xd')](handleError(_0x878903,null));};exports[_0x76aa('0x31')]=function(_0x4a5a96,_0xa824e8){var _0x64612e;return respondWithRpcPromise(_0x76aa('0x32'),_0x4a5a96['query'])['then'](function(_0x153a47){_0x64612e=_0x153a47;return respondWithRpcPromise(_0x76aa('0x32'),_0x4a5a96[_0x76aa('0x17')],routingClient);})[_0x76aa('0x18')](function(_0x50599f){return _[_0x76aa('0x1e')]({},_0x50599f,_0x64612e);})[_0x76aa('0x18')](respondWithResult(_0xa824e8,null))[_0x76aa('0xd')](handleError(_0xa824e8,null));};exports[_0x76aa('0x33')]=function(_0x1138b5,_0x4aa2f3){if(_0x1138b5[_0x76aa('0x24')]&&_0x1138b5['body'][_0x76aa('0x34')]&&_0x1138b5['user']&&_0x1138b5['user']['name']){for(var _0x144f0a in _0x1138b5['body']['interaction']){if(_0x1138b5['body'][_0x76aa('0x34')][_0x76aa('0x35')](_0x144f0a)){db[_0x76aa('0x36')][_0x76aa('0x37')]({'where':{'channel':_0x144f0a,'membername':_0x1138b5[_0x76aa('0x38')]['name'],'type':_0x76aa('0x39'),'exitAt':null,'uniqueid':_0x1138b5[_0x76aa('0x24')][_0x76aa('0x34')][_0x144f0a]&&_0x1138b5[_0x76aa('0x24')][_0x76aa('0x34')][_0x144f0a]['length']?{'$notIn':_0x1138b5[_0x76aa('0x24')][_0x76aa('0x34')][_0x144f0a]}:{'$ne':null}}})['then'](function(_0x2d3441){var _0x5a984e=moment()[_0x76aa('0x3a')](_0x76aa('0x3b'));for(var _0x31930b=0x0,_0x18fd3e=_0x2d3441[_0x76aa('0x3c')];_0x31930b<_0x18fd3e;_0x31930b+=0x1){_0x2d3441[_0x31930b][_0x76aa('0x3d')]({'exitAt':_0x5a984e});}});for(var _0x2e229d=0x0;_0x2e229d<_0x1138b5[_0x76aa('0x24')][_0x76aa('0x34')][_0x144f0a][_0x76aa('0x3c')];_0x2e229d+=0x1){db['MemberReport'][_0x76aa('0x3e')]({'where':{'channel':_0x144f0a,'membername':_0x1138b5['user'][_0x76aa('0x11')],'type':_0x76aa('0x39'),'uniqueid':_0x1138b5[_0x76aa('0x24')][_0x76aa('0x34')][_0x144f0a][_0x2e229d],'exitAt':null},'defaults':{'channel':_0x144f0a,'membername':_0x1138b5['user']['name'],'interface':_[_0x76aa('0x13')](_0x1138b5['user'][_0x76aa('0x3f')])?util[_0x76aa('0x3a')](_0x76aa('0x40'),_0x1138b5[_0x76aa('0x38')][_0x76aa('0x11')]):_0x1138b5[_0x76aa('0x38')]['interface'],'type':'INTERACTION','enterAt':moment()[_0x76aa('0x3a')](_0x76aa('0x3b')),'role':_0x76aa('0x41'),'internal':_0x1138b5[_0x76aa('0x38')][_0x76aa('0x42')],'uniqueid':_0x1138b5[_0x76aa('0x24')]['interaction'][_0x144f0a][_0x2e229d]}});}}}}return respondWithRpcPromise(_0x76aa('0x43'),{'id':_0x1138b5[_0x76aa('0x1b')]['id'],'capacity':_0x1138b5[_0x76aa('0x24')]['capacity']},routingClient)[_0x76aa('0x18')](respondWithResult(_0x4aa2f3,null))['catch'](handleError(_0x4aa2f3,null));};exports[_0x76aa('0x44')]=function(_0x5e1d84,_0x339b0d){return respondWithRpcPromise(_0x76aa('0x45'),_0x5e1d84[_0x76aa('0x17')])[_0x76aa('0x18')](respondWithResult(_0x339b0d,null))[_0x76aa('0xd')](handleError(_0x339b0d,null));};exports[_0x76aa('0x46')]=function(_0x953726,_0x4f2c2b){return respondWithRpcPromise(_0x76aa('0x47'),_0x953726['query'])[_0x76aa('0x18')](respondWithResult(_0x4f2c2b,null))[_0x76aa('0xd')](handleError(_0x4f2c2b,null));};exports[_0x76aa('0x48')]=function(_0x53be10,_0x3fa7ec){return respondWithRpcPromise(_0x76aa('0x49'),_0x53be10[_0x76aa('0x17')])['then'](respondWithResult(_0x3fa7ec,null))[_0x76aa('0xd')](handleError(_0x3fa7ec,null));};exports[_0x76aa('0x4a')]=function(_0x27fc84,_0x1fd2b6){return respondWithRpcPromise('ChatQueues',_0x27fc84[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](respondWithResult(_0x1fd2b6,null))[_0x76aa('0xd')](handleError(_0x1fd2b6,null));};exports[_0x76aa('0x4b')]=function(_0x2027f8,_0xf7732){return respondWithRpcPromise('ChatQueues',_0x2027f8[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](findById(_0x2027f8[_0x76aa('0x1b')]['id']))[_0x76aa('0x18')](respondWithResult(_0xf7732,null))[_0x76aa('0xd')](handleError(_0xf7732,null));};exports[_0x76aa('0x4c')]=function(_0x37babe,_0x51893b){return respondWithRpcPromise('MailQueues',_0x37babe[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](respondWithResult(_0x51893b,null))['catch'](handleError(_0x51893b,null));};exports[_0x76aa('0x4d')]=function(_0x1e6f3c,_0x4f832d){return respondWithRpcPromise(_0x76aa('0x4e'),_0x1e6f3c[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](findById(_0x1e6f3c[_0x76aa('0x1b')]['id']))[_0x76aa('0x18')](respondWithResult(_0x4f832d,null))[_0x76aa('0xd')](handleError(_0x4f832d,null));};exports[_0x76aa('0x4f')]=function(_0x30573a,_0x69b1af){return respondWithRpcPromise('MailAccounts',_0x30573a[_0x76aa('0x17')],mailClient)['then'](respondWithResult(_0x69b1af,null))[_0x76aa('0xd')](handleError(_0x69b1af,null));};exports[_0x76aa('0x50')]=function(_0x2fef92,_0x16cc85){return respondWithRpcPromise(_0x76aa('0x51'),_0x2fef92[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](respondWithResult(_0x16cc85,null))[_0x76aa('0xd')](handleError(_0x16cc85,null));};exports[_0x76aa('0x52')]=function(_0x5eceba,_0x267fcf){return respondWithRpcPromise(_0x76aa('0x51'),_0x5eceba[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](findById(_0x5eceba[_0x76aa('0x1b')]['id']))[_0x76aa('0x18')](respondWithResult(_0x267fcf,null))[_0x76aa('0xd')](handleError(_0x267fcf,null));};exports[_0x76aa('0x53')]=function(_0x5546b6,_0x364d05){return respondWithRpcPromise('SmsQueues',_0x5546b6[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](respondWithResult(_0x364d05,null))[_0x76aa('0xd')](handleError(_0x364d05,null));};exports[_0x76aa('0x54')]=function(_0x3a82fe,_0x234dc4){return respondWithRpcPromise(_0x76aa('0x55'),_0x3a82fe['query'],routingClient)[_0x76aa('0x18')](findById(_0x3a82fe[_0x76aa('0x1b')]['id']))['then'](respondWithResult(_0x234dc4,null))['catch'](handleError(_0x234dc4,null));};exports[_0x76aa('0x56')]=function(_0x13389d,_0x5295a7){return respondWithRpcPromise(_0x76aa('0x57'),_0x13389d[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](respondWithResult(_0x5295a7,null))['catch'](handleError(_0x5295a7,null));};exports[_0x76aa('0x58')]=function(_0x47f733,_0xf31e1f){return respondWithRpcPromise(_0x76aa('0x57'),_0x47f733[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](findById(_0x47f733['params']['id']))['then'](respondWithResult(_0xf31e1f,null))[_0x76aa('0xd')](handleError(_0xf31e1f,null));};exports['faxQueues']=function(_0x2a8fd3,_0x28feb2){return respondWithRpcPromise(_0x76aa('0x59'),_0x2a8fd3[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](respondWithResult(_0x28feb2,null))[_0x76aa('0xd')](handleError(_0x28feb2,null));};exports[_0x76aa('0x5a')]=function(_0x223c92,_0xa19c1c){return respondWithRpcPromise('FaxQueues',_0x223c92[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](findById(_0x223c92[_0x76aa('0x1b')]['id']))[_0x76aa('0x18')](respondWithResult(_0xa19c1c,null))['catch'](handleError(_0xa19c1c,null));};exports['faxAccounts']=function(_0x557c11,_0x1a01ac){return respondWithRpcPromise('FaxAccounts',_0x557c11[_0x76aa('0x17')])[_0x76aa('0x18')](respondWithResult(_0x1a01ac,null))[_0x76aa('0xd')](handleError(_0x1a01ac,null));};exports[_0x76aa('0x5b')]=function(_0x5754fa,_0x7eb34e){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5754fa[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](respondWithResult(_0x7eb34e,null))[_0x76aa('0xd')](handleError(_0x7eb34e,null));};exports[_0x76aa('0x5c')]=function(_0x1037fb,_0x496e66){return respondWithRpcPromise(_0x76aa('0x5d'),_0x1037fb[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](respondWithResult(_0x496e66,null))[_0x76aa('0xd')](handleError(_0x496e66,null));};exports[_0x76aa('0x5e')]=function(_0x22432d,_0x1d9c6e){return respondWithRpcPromise(_0x76aa('0x5f'),_0x22432d['query'],routingClient)[_0x76aa('0x18')](respondWithResult(_0x1d9c6e,null))[_0x76aa('0xd')](handleError(_0x1d9c6e,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x3c1b98,_0x215463){return respondWithRpcPromise(_0x76aa('0x5f'),_0x3c1b98[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](function(_0x51b101){if(_0x3c1b98[_0x76aa('0x17')]['type']!==undefined){var _0xdb821b=_(_0x51b101['rows'])['filter']([_0x3c1b98[_0x76aa('0x17')][_0x76aa('0x60')],_0x3c1b98['params']['id']])['map'](_0x76aa('0x61'))[_0x76aa('0x62')]()[_0x76aa('0x63')]();return _0x51b101['rows']['filter'](function(_0x17efc6){return _0xdb821b[_0x76aa('0x64')](_0x17efc6[_0x76aa('0x61')])>-0x1;});}else{return _0x51b101['rows'][_0x76aa('0x65')](function(_0x4c773a){return _0x4c773a[_0x76aa('0x61')]===parseInt(_0x3c1b98[_0x76aa('0x1b')]['id']);});}})[_0x76aa('0x18')](respondWithResult(_0x215463,null))[_0x76aa('0xd')](handleError(_0x215463,null));};exports[_0x76aa('0x66')]=function(_0x486d86,_0x5a79ba){return respondWithRpcPromise(_0x76aa('0x67'),_0x486d86[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](respondWithResult(_0x5a79ba,null))['catch'](handleError(_0x5a79ba,null));};exports[_0x76aa('0x68')]=function(_0x3b6e44,_0x2ce07f){return respondWithRpcPromise(_0x76aa('0x69'),_0x3b6e44[_0x76aa('0x17')],routingClient)['then'](respondWithResult(_0x2ce07f,null))[_0x76aa('0xd')](handleError(_0x2ce07f,null));};exports['faxQueuesWaitingInteractions']=function(_0x213f7f,_0xca8769){return respondWithRpcPromise(_0x76aa('0x6a'),_0x213f7f[_0x76aa('0x17')],routingClient)[_0x76aa('0x18')](respondWithResult(_0xca8769,null))[_0x76aa('0xd')](handleError(_0xca8769,null));};exports['queueNotify']=function(_0x555682){return function(_0x547411,_0x47dd29){var _0x490fa4,_0x2203c3;var _0x22f44f=_['capitalize'](_0x555682);var _0x5c2c91=_0x555682==='chat'?_0x76aa('0x6b'):_0x76aa('0x6c');return db[_0x22f44f+_0x76aa('0x6d')]['findOne']({'raw':!![],'where':{'id':_0x547411['params']['id']}})[_0x76aa('0x18')](function(_0x45edd0){if(_[_0x76aa('0x13')](_0x45edd0)){throw new Error(_0x22f44f+_0x76aa('0x6e'));}_0x490fa4=_0x45edd0;return db[_0x22f44f+_0x76aa('0x6f')]['findOne']({'where':{'id':_0x547411['body'][_0x76aa('0x70')]},'include':[{'model':db[_0x22f44f+'Interaction'],'as':'Interaction'},{'model':db[_0x22f44f+_0x5c2c91],'as':'Account'}]});})[_0x76aa('0x18')](function(_0xbb1ccd){if(_['isNil'](_0xbb1ccd)){throw new Error(_0x22f44f+_0x76aa('0x71'));}_0x2203c3=_0xbb1ccd;return _0xbb1ccd[_0x76aa('0x72')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x22063f={'uniqueid':_0x555682+'.'+_0x2203c3['id']+'.'+_0x2203c3[_0x76aa('0x73')]['id'],'FromUserId':_0x547411[_0x76aa('0x38')]['id'],'type':_0x76aa('0x74')};_0x22063f[_0x22f44f+_0x76aa('0x75')]=_0x2203c3['id'];_0x22063f[_0x22f44f+_0x76aa('0x76')]=_0x2203c3[_0x76aa('0x73')]['id'];_0x22063f[_0x76aa('0x77')+_0x22f44f+_0x5c2c91+'Id']=_0x2203c3[_0x76aa('0x6c')]['id'];_0x22063f['To'+_0x22f44f+'QueueId']=_0x490fa4['id'];return db[_0x22f44f+_0x76aa('0x78')][_0x76aa('0x79')](_0x22063f);})['then'](function(){return respondWithRpcPromise(_0x76aa('0x7a'),{'channel':_0x555682,'interaction':_0x2203c3[_0x76aa('0x73')],'message':_0x2203c3,'account':_0x2203c3[_0x76aa('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x490fa4[_0x76aa('0x11')]+','+(_0x2203c3[_0x76aa('0x6c')]['queueTransferTimeout']||0x12c),'interval':_0x76aa('0x7b')}]},routingClient);})[_0x76aa('0x18')](respondWithResult(_0x47dd29,null))[_0x76aa('0xd')](handleError(_0x47dd29,null));};};exports['agentNotify']=function(_0xae152a,_0x202acb){var _0x50a51f,_0x5aabe5;if(_['isNil'](_0xae152a[_0x76aa('0x24')][_0x76aa('0x7c')])){throw new Error(_0x76aa('0x7d'));}var _0x16643e=_0xae152a['body']['channel'];var _0x4a449c=_[_0x76aa('0x7e')](_0x16643e);var _0x59876c=_0x16643e===_0x76aa('0x7f')?_0x76aa('0x6b'):'Account';return db[_0x76aa('0x80')][_0x76aa('0x81')]({'raw':!![],'where':{'id':_0xae152a['params']['id'],'role':_0x76aa('0x41')}})[_0x76aa('0x18')](function(_0x41200c){if(_[_0x76aa('0x13')](_0x41200c)){throw new Error(_0x76aa('0x82'));}_0x50a51f=_0x41200c;return db[_0x4a449c+_0x76aa('0x6f')]['findOne']({'where':{'id':_0xae152a[_0x76aa('0x24')]['messageId']},'include':[{'model':db[_0x4a449c+'Interaction'],'as':'Interaction'},{'model':db[_0x4a449c+_0x59876c],'as':'Account'}]});})['then'](function(_0xb65e0b){if(_[_0x76aa('0x13')](_0xb65e0b)){throw new Error(_0x4a449c+_0x76aa('0x71'));}_0x5aabe5=_0xb65e0b;return _0xb65e0b[_0x76aa('0x72')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x447103={'uniqueid':_0x16643e+'.'+_0x5aabe5['id']+'.'+_0x5aabe5[_0x76aa('0x73')]['id'],'FromUserId':_0xae152a[_0x76aa('0x38')]['id'],'type':_0x76aa('0x74'),'ToUserId':_0x50a51f['id']};_0x447103[_0x4a449c+_0x76aa('0x75')]=_0x5aabe5['id'];_0x447103[_0x4a449c+'InteractionId']=_0x5aabe5[_0x76aa('0x73')]['id'];_0x447103[_0x76aa('0x77')+_0x4a449c+_0x59876c+'Id']=_0x5aabe5[_0x76aa('0x6c')]['id'];return db[_0x4a449c+_0x76aa('0x78')][_0x76aa('0x79')](_0x447103);})[_0x76aa('0x18')](function(){return respondWithRpcPromise(_0x76aa('0x7a'),{'channel':_0x16643e,'interaction':_0x5aabe5['Interaction'],'message':_0x5aabe5,'account':_0x5aabe5[_0x76aa('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x76aa('0x41'),'appdata':_0x50a51f['name']+','+(_0x5aabe5['Account'][_0x76aa('0x83')]||0x12c),'interval':_0x76aa('0x7b')}]},routingClient);})['then'](respondWithResult(_0x202acb,null))[_0x76aa('0xd')](handleError(_0x202acb,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 6913bce..ca5dcd8 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 _0x3c27=['./schedule.controller','get','index','/:id','isAuthenticated','show','/:id/run','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x61a89b,_0x33d4b8){var _0x31316d=function(_0x48ecea){while(--_0x48ecea){_0x61a89b['push'](_0x61a89b['shift']());}};_0x31316d(++_0x33d4b8);}(_0x3c27,0x1f1));var _0x73c2=function(_0x415005,_0x595685){_0x415005=_0x415005-0x0;var _0x50002f=_0x3c27[_0x415005];return _0x50002f;};'use strict';var multer=require(_0x73c2('0x0'));var util=require(_0x73c2('0x1'));var path=require(_0x73c2('0x2'));var timeout=require('connect-timeout');var express=require(_0x73c2('0x3'));var router=express[_0x73c2('0x4')]();var fs_extra=require(_0x73c2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x73c2('0x6'));var config=require('../../config/environment');var controller=require(_0x73c2('0x7'));router[_0x73c2('0x8')]('/',auth['isAuthenticated'](),controller[_0x73c2('0x9')]);router[_0x73c2('0x8')](_0x73c2('0xa'),auth[_0x73c2('0xb')](),controller[_0x73c2('0xc')]);router[_0x73c2('0x8')](_0x73c2('0xd'),auth[_0x73c2('0xb')](),controller['run']);router[_0x73c2('0xe')]('/',auth[_0x73c2('0xb')](),controller[_0x73c2('0xf')]);router[_0x73c2('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x73c2('0x11')]);router[_0x73c2('0x12')]('/:id',auth[_0x73c2('0xb')](),controller[_0x73c2('0x13')]);module[_0x73c2('0x14')]=router; \ No newline at end of file +var _0x9fa5=['delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','get','show','run','create','put','/:id'];(function(_0x2ded1e,_0x1584ac){var _0x321640=function(_0x31a626){while(--_0x31a626){_0x2ded1e['push'](_0x2ded1e['shift']());}};_0x321640(++_0x1584ac);}(_0x9fa5,0xac));var _0x59fa=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9fa5[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x59fa('0x0'));var path=require(_0x59fa('0x1'));var timeout=require(_0x59fa('0x2'));var express=require('express');var router=express[_0x59fa('0x3')]();var fs_extra=require(_0x59fa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x59fa('0x5'));var config=require(_0x59fa('0x6'));var controller=require(_0x59fa('0x7'));router['get']('/',auth[_0x59fa('0x8')](),controller['index']);router[_0x59fa('0x9')]('/:id',auth[_0x59fa('0x8')](),controller[_0x59fa('0xa')]);router[_0x59fa('0x9')]('/:id/run',auth[_0x59fa('0x8')](),controller[_0x59fa('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x59fa('0xc')]);router[_0x59fa('0xd')](_0x59fa('0xe'),auth[_0x59fa('0x8')](),controller['update']);router[_0x59fa('0xf')](_0x59fa('0xe'),auth['isAuthenticated'](),controller[_0x59fa('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index a8ad7da..8f71ecd 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 _0xaf08=['BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','months','weeks','hours','minutes','csv','pdf','xlsx','default','custom'];(function(_0x334ed,_0x1cc6f2){var _0x654907=function(_0x1c6fa5){while(--_0x1c6fa5){_0x334ed['push'](_0x334ed['shift']());}};_0x654907(++_0x1cc6f2);}(_0xaf08,0x145));var _0x8af0=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0xaf08[_0x381379];return _0x3e1063;};'use strict';var Sequelize=require(_0x8af0('0x0'));module[_0x8af0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8af0('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8af0('0x2')],'allowNull':![],'defaultValue':_0x8af0('0x3')},'startAt':{'type':Sequelize[_0x8af0('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8af0('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8af0('0x5')](_0x8af0('0x6'),_0x8af0('0x7'),_0x8af0('0x8'),_0x8af0('0x9'),'days',_0x8af0('0xa'),_0x8af0('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x8af0('0x5')](_0x8af0('0xc'),_0x8af0('0xd'),_0x8af0('0xe')),'allowNull':![],'defaultValue':_0x8af0('0xc')},'type':{'type':Sequelize[_0x8af0('0x5')]('custom',_0x8af0('0xf')),'allowNull':![],'defaultValue':_0x8af0('0x10')},'sendMail':{'type':Sequelize[_0x8af0('0x11')],'defaultValue':![]},'email':{'type':Sequelize[_0x8af0('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x8af0('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x8af0('0x11')],'defaultValue':!![]}}; \ No newline at end of file +var _0xeaba=['xlsx','custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours','minutes','days','pdf'];(function(_0x3e8cae,_0x4cb96a){var _0x45c4d6=function(_0x4bf3a5){while(--_0x4bf3a5){_0x3e8cae['push'](_0x3e8cae['shift']());}};_0x45c4d6(++_0x4cb96a);}(_0xeaba,0x89));var _0xaeab=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xeaba[_0x68ee8b];return _0x5148f7;};'use strict';var Sequelize=require(_0xaeab('0x0'));module['exports']={'name':{'type':Sequelize[_0xaeab('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xaeab('0x1')]},'active':{'type':Sequelize[_0xaeab('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xaeab('0x1')],'allowNull':![],'defaultValue':_0xaeab('0x3')},'startAt':{'type':Sequelize[_0xaeab('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xaeab('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xaeab('0x6')](_0xaeab('0x7'),_0xaeab('0x8'),_0xaeab('0x9'),_0xaeab('0xa'),'days',_0xaeab('0xb'),_0xaeab('0xc')),'allowNull':![],'defaultValue':_0xaeab('0xd')},'output':{'type':Sequelize['ENUM']('csv',_0xaeab('0xe'),_0xaeab('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xaeab('0x6')](_0xaeab('0x10'),_0xaeab('0x11')),'allowNull':![],'defaultValue':_0xaeab('0x10')},'sendMail':{'type':Sequelize[_0xaeab('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xaeab('0x1')]},'cc':{'type':Sequelize[_0xaeab('0x12')]},'bcc':{'type':Sequelize[_0xaeab('0x12')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index b6d5ea1..395bb3f 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 _0xd386=['set','Content-Range','apply','save','update','then','destroy','Scheduler','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','Schedule','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','run','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count'];(function(_0x398bcb,_0x5984f8){var _0x201924=function(_0xd0cce2){while(--_0xd0cce2){_0x398bcb['push'](_0x398bcb['shift']());}};_0x201924(++_0x5984f8);}(_0xd386,0x8d));var _0x6d38=function(_0x91e24e,_0x2eddb3){_0x91e24e=_0x91e24e-0x0;var _0x642ebd=_0xd386[_0x91e24e];return _0x642ebd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6d38('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d38('0x1'));var moment=require('moment');var BPromise=require(_0x6d38('0x2'));var Mustache=require(_0x6d38('0x3'));var util=require(_0x6d38('0x4'));var path=require('path');var sox=require(_0x6d38('0x5'));var csv=require(_0x6d38('0x6'));var ejs=require(_0x6d38('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d38('0x8'));var squel=require(_0x6d38('0x9'));var crypto=require(_0x6d38('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6d38('0xb'));var qs=require(_0x6d38('0xc'));var as=require(_0x6d38('0xd'));var hardwareService=require(_0x6d38('0xe'));var logger=require(_0x6d38('0xf'))('api');var utils=require(_0x6d38('0x10'));var config=require(_0x6d38('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d38('0x12'))['db'];function respondWithStatusCode(_0x461287,_0x34d31a){_0x34d31a=_0x34d31a||0xcc;return function(_0x917ab1){if(_0x917ab1){return _0x461287['sendStatus'](_0x34d31a);}return _0x461287[_0x6d38('0x13')](_0x34d31a)['end']();};}function respondWithResult(_0x457b16,_0x296440){_0x296440=_0x296440||0xc8;return function(_0x119af7){if(_0x119af7){return _0x457b16[_0x6d38('0x13')](_0x296440)[_0x6d38('0x14')](_0x119af7);}};}function respondWithFilteredResult(_0x3a09ad,_0x5d6f33){return function(_0x57201d){if(_0x57201d){var _0x27e05e=typeof _0x5d6f33[_0x6d38('0x15')]===_0x6d38('0x16')&&typeof _0x5d6f33[_0x6d38('0x17')]===_0x6d38('0x16');var _0xab49dd=_0x57201d['count'];var _0x286a59=_0x27e05e?0x0:_0x5d6f33[_0x6d38('0x15')];var _0x578160=_0x27e05e?_0x57201d[_0x6d38('0x18')]:_0x5d6f33[_0x6d38('0x15')]+_0x5d6f33[_0x6d38('0x17')];var _0x16b65a;if(_0x578160>=_0xab49dd){_0x578160=_0xab49dd;_0x16b65a=0xc8;}else{_0x16b65a=0xce;}_0x3a09ad[_0x6d38('0x13')](_0x16b65a);return _0x3a09ad[_0x6d38('0x19')](_0x6d38('0x1a'),_0x286a59+'-'+_0x578160+'/'+_0xab49dd)['json'](_0x57201d);}return null;};}function patchUpdates(_0x283261){return function(_0x525f32){try{jsonpatch[_0x6d38('0x1b')](_0x525f32,_0x283261,!![]);}catch(_0x3db70d){return BPromise['reject'](_0x3db70d);}return _0x525f32[_0x6d38('0x1c')]();};}function saveUpdates(_0x55b280,_0x50deb6){return function(_0x267113){if(_0x267113){return _0x267113[_0x6d38('0x1d')](_0x55b280)[_0x6d38('0x1e')](function(_0x55adcb){return _0x55adcb;});}return null;};}function removeEntity(_0x1b9b74,_0x24684f){return function(_0x14356b){if(_0x14356b){return _0x14356b[_0x6d38('0x1f')]()[_0x6d38('0x1e')](function(){var _0x413e58=_0x14356b['get']({'plain':!![]});var _0x49435e=_0x6d38('0x20');return db[_0x6d38('0x21')][_0x6d38('0x1f')]({'where':{'type':_0x49435e,'resourceId':_0x413e58['id']}})[_0x6d38('0x1e')](function(){return _0x14356b;});})[_0x6d38('0x1e')](function(){_0x1b9b74[_0x6d38('0x13')](0xcc)[_0x6d38('0x22')]();});}};}function handleEntityNotFound(_0x2b2836,_0x2a908f){return function(_0x2fcb5d){if(!_0x2fcb5d){_0x2b2836[_0x6d38('0x23')](0x194);}return _0x2fcb5d;};}function handleError(_0xa14b8c,_0x3c13fc){_0x3c13fc=_0x3c13fc||0x1f4;return function(_0x4dbe04){logger[_0x6d38('0x24')](_0x4dbe04[_0x6d38('0x25')]);if(_0x4dbe04[_0x6d38('0x26')]){delete _0x4dbe04[_0x6d38('0x26')];}_0xa14b8c[_0x6d38('0x13')](_0x3c13fc)[_0x6d38('0x27')](_0x4dbe04);};}exports[_0x6d38('0x28')]=function(_0x48e8c9,_0x2cfc90){var _0x400213={},_0x2a3e8f={},_0x575b26={'count':0x0,'rows':[]};var _0xae4494=_[_0x6d38('0x29')](db['Schedule'][_0x6d38('0x2a')],function(_0x30ee67){return{'name':_0x30ee67[_0x6d38('0x2b')],'type':_0x30ee67[_0x6d38('0x2c')][_0x6d38('0x2d')]};});_0x2a3e8f['model']=_[_0x6d38('0x29')](_0xae4494,_0x6d38('0x26'));_0x2a3e8f['query']=_[_0x6d38('0x2e')](_0x48e8c9['query']);_0x2a3e8f[_0x6d38('0x2f')]=_['intersection'](_0x2a3e8f[_0x6d38('0x30')],_0x2a3e8f[_0x6d38('0x31')]);_0x400213[_0x6d38('0x32')]=_[_0x6d38('0x33')](_0x2a3e8f[_0x6d38('0x30')],qs[_0x6d38('0x34')](_0x48e8c9[_0x6d38('0x31')][_0x6d38('0x34')]));_0x400213['attributes']=_0x400213[_0x6d38('0x32')][_0x6d38('0x35')]?_0x400213[_0x6d38('0x32')]:_0x2a3e8f[_0x6d38('0x30')];if(!_0x48e8c9[_0x6d38('0x31')][_0x6d38('0x36')](_0x6d38('0x37'))){_0x400213[_0x6d38('0x17')]=qs['limit'](_0x48e8c9['query'][_0x6d38('0x17')]);_0x400213[_0x6d38('0x15')]=qs['offset'](_0x48e8c9[_0x6d38('0x31')][_0x6d38('0x15')]);}_0x400213[_0x6d38('0x38')]=qs[_0x6d38('0x39')](_0x48e8c9[_0x6d38('0x31')][_0x6d38('0x39')]);_0x400213[_0x6d38('0x3a')]=qs[_0x6d38('0x2f')](_[_0x6d38('0x3b')](_0x48e8c9['query'],_0x2a3e8f[_0x6d38('0x2f')]),_0xae4494);if(_0x48e8c9[_0x6d38('0x31')][_0x6d38('0x3c')]){_0x400213[_0x6d38('0x3a')]=_[_0x6d38('0x3d')](_0x400213['where'],{'$or':_[_0x6d38('0x29')](_0xae4494,function(_0x2e1e49){if(_0x2e1e49[_0x6d38('0x2c')]!==_0x6d38('0x3e')){var _0x3b368b={};_0x3b368b[_0x2e1e49['name']]={'$like':'%'+_0x48e8c9[_0x6d38('0x31')]['filter']+'%'};return _0x3b368b;}})});}_0x400213=_['merge']({},_0x400213,_0x48e8c9[_0x6d38('0x3f')]);var _0xa3a844={'where':_0x400213[_0x6d38('0x3a')]};return db['Schedule'][_0x6d38('0x18')](_0xa3a844)['then'](function(_0x21dbc4){_0x575b26[_0x6d38('0x18')]=_0x21dbc4;if(_0x48e8c9[_0x6d38('0x31')]['includeAll']){_0x400213[_0x6d38('0x40')]=[{'all':!![]}];}return db['Schedule'][_0x6d38('0x41')](_0x400213);})[_0x6d38('0x1e')](function(_0x2612a8){_0x575b26[_0x6d38('0x42')]=_0x2612a8;return _0x575b26;})[_0x6d38('0x1e')](respondWithFilteredResult(_0x2cfc90,_0x400213))[_0x6d38('0x43')](handleError(_0x2cfc90,null));};exports[_0x6d38('0x44')]=function(_0xbfed60,_0x17b1c9){var _0x349396={'raw':![],'where':{'id':_0xbfed60[_0x6d38('0x45')]['id']}},_0x4723e3={};_0x4723e3[_0x6d38('0x30')]=_[_0x6d38('0x2e')](db['Schedule'][_0x6d38('0x2a')]);_0x4723e3[_0x6d38('0x31')]=_['keys'](_0xbfed60[_0x6d38('0x31')]);_0x4723e3[_0x6d38('0x2f')]=_[_0x6d38('0x33')](_0x4723e3['model'],_0x4723e3[_0x6d38('0x31')]);_0x349396[_0x6d38('0x32')]=_['intersection'](_0x4723e3[_0x6d38('0x30')],qs['fields'](_0xbfed60[_0x6d38('0x31')][_0x6d38('0x34')]));_0x349396['attributes']=_0x349396[_0x6d38('0x32')][_0x6d38('0x35')]?_0x349396[_0x6d38('0x32')]:_0x4723e3[_0x6d38('0x30')];if(_0xbfed60[_0x6d38('0x31')][_0x6d38('0x46')]){_0x349396[_0x6d38('0x40')]=[{'all':!![]}];}_0x349396=_[_0x6d38('0x3d')]({},_0x349396,_0xbfed60['options']);return db['Schedule'][_0x6d38('0x47')](_0x349396)[_0x6d38('0x1e')](handleEntityNotFound(_0x17b1c9,null))[_0x6d38('0x1e')](respondWithResult(_0x17b1c9,null))['catch'](handleError(_0x17b1c9,null));};exports[_0x6d38('0x48')]=function(_0x490f57,_0x41f4dc){return db[_0x6d38('0x49')][_0x6d38('0x48')](_0x490f57[_0x6d38('0x4a')],{})['then'](function(_0x3b9474){var _0x142af4=_0x490f57['user'][_0x6d38('0x4b')]({'plain':!![]});if(!_0x142af4)throw new Error(_0x6d38('0x4c'));if(_0x142af4[_0x6d38('0x4d')]===_0x6d38('0x4e')){var _0x1191b6=_0x3b9474['get']({'plain':!![]});var _0x53f0b3=_0x6d38('0x20');return db[_0x6d38('0x4f')][_0x6d38('0x47')]({'where':{'name':_0x53f0b3,'userProfileId':_0x142af4[_0x6d38('0x50')]},'raw':!![]})['then'](function(_0x525163){if(_0x525163&&_0x525163[_0x6d38('0x51')]===0x0){return db[_0x6d38('0x21')][_0x6d38('0x48')]({'name':_0x1191b6[_0x6d38('0x26')],'resourceId':_0x1191b6['id'],'type':_0x525163[_0x6d38('0x26')],'sectionId':_0x525163['id']},{})[_0x6d38('0x1e')](function(){return _0x3b9474;});}else{return _0x3b9474;}})['catch'](function(_0x2860be){logger[_0x6d38('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2860be);throw _0x2860be;});}return _0x3b9474;})[_0x6d38('0x1e')](respondWithResult(_0x41f4dc,0xc9))[_0x6d38('0x43')](handleError(_0x41f4dc,null));};exports[_0x6d38('0x1d')]=function(_0x3d0c4e,_0x1483c3){if(_0x3d0c4e[_0x6d38('0x4a')]['id']){delete _0x3d0c4e[_0x6d38('0x4a')]['id'];}return db[_0x6d38('0x49')][_0x6d38('0x47')]({'where':{'id':_0x3d0c4e['params']['id']}})[_0x6d38('0x1e')](handleEntityNotFound(_0x1483c3,null))[_0x6d38('0x1e')](saveUpdates(_0x3d0c4e[_0x6d38('0x4a')],null))['then'](respondWithResult(_0x1483c3,null))[_0x6d38('0x43')](handleError(_0x1483c3,null));};exports[_0x6d38('0x1f')]=function(_0x1c4f00,_0x394617){return db[_0x6d38('0x49')][_0x6d38('0x47')]({'where':{'id':_0x1c4f00[_0x6d38('0x45')]['id']}})[_0x6d38('0x1e')](handleEntityNotFound(_0x394617,null))['then'](removeEntity(_0x394617,null))[_0x6d38('0x43')](handleError(_0x394617,null));};exports['run']=function(_0x36edc1,_0x39ba07,_0x5e063d){var _0x5510dd=require('../../config/schedule');return db['Schedule'][_0x6d38('0x47')]({'where':{'id':_0x36edc1[_0x6d38('0x45')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x39ba07,null))[_0x6d38('0x1e')](function(){_0x5510dd[_0x6d38('0x52')](_0x36edc1[_0x6d38('0x45')]['id']);})[_0x6d38('0x1e')](respondWithStatusCode(_0x39ba07,null))['catch'](handleError(_0x39ba07,null));}; \ No newline at end of file +var _0xfc89=['end','json','offset','undefined','limit','count','set','Content-Range','reject','then','get','destroy','error','name','send','index','map','Schedule','rawAttributes','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','intersection','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfc89,0x1d9));var _0x9fc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc89[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9fc8('0x0'));var rimraf=require(_0x9fc8('0x1'));var zipdir=require(_0x9fc8('0x2'));var jsonpatch=require(_0x9fc8('0x3'));var rp=require(_0x9fc8('0x4'));var moment=require(_0x9fc8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9fc8('0x6'));var path=require(_0x9fc8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9fc8('0x8'));var fs=require('fs');var fs_extra=require(_0x9fc8('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9fc8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9fc8('0xb'));var toCsv=require(_0x9fc8('0xc'));var querystring=require('querystring');var Papa=require(_0x9fc8('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9fc8('0xe'));var as=require(_0x9fc8('0xf'));var hardwareService=require(_0x9fc8('0x10'));var logger=require(_0x9fc8('0x11'))(_0x9fc8('0x12'));var utils=require(_0x9fc8('0x13'));var config=require(_0x9fc8('0x14'));var licenseUtil=require(_0x9fc8('0x15'));var db=require(_0x9fc8('0x16'))['db'];function respondWithStatusCode(_0x5bee9f,_0x2352a0){_0x2352a0=_0x2352a0||0xcc;return function(_0x4d0126){if(_0x4d0126){return _0x5bee9f[_0x9fc8('0x17')](_0x2352a0);}return _0x5bee9f[_0x9fc8('0x18')](_0x2352a0)[_0x9fc8('0x19')]();};}function respondWithResult(_0x1d3e29,_0xdfb4f3){_0xdfb4f3=_0xdfb4f3||0xc8;return function(_0x1d823a){if(_0x1d823a){return _0x1d3e29['status'](_0xdfb4f3)[_0x9fc8('0x1a')](_0x1d823a);}};}function respondWithFilteredResult(_0x1f5758,_0x5236f2){return function(_0x4d39d0){if(_0x4d39d0){var _0x314ee8=typeof _0x5236f2[_0x9fc8('0x1b')]===_0x9fc8('0x1c')&&typeof _0x5236f2[_0x9fc8('0x1d')]==='undefined';var _0x3aca30=_0x4d39d0[_0x9fc8('0x1e')];var _0x1f28a1=_0x314ee8?0x0:_0x5236f2[_0x9fc8('0x1b')];var _0x320e2d=_0x314ee8?_0x4d39d0[_0x9fc8('0x1e')]:_0x5236f2[_0x9fc8('0x1b')]+_0x5236f2[_0x9fc8('0x1d')];var _0x2ae136;if(_0x320e2d>=_0x3aca30){_0x320e2d=_0x3aca30;_0x2ae136=0xc8;}else{_0x2ae136=0xce;}_0x1f5758['status'](_0x2ae136);return _0x1f5758[_0x9fc8('0x1f')](_0x9fc8('0x20'),_0x1f28a1+'-'+_0x320e2d+'/'+_0x3aca30)['json'](_0x4d39d0);}return null;};}function patchUpdates(_0x113016){return function(_0x23511e){try{jsonpatch['apply'](_0x23511e,_0x113016,!![]);}catch(_0x105a1a){return BPromise[_0x9fc8('0x21')](_0x105a1a);}return _0x23511e['save']();};}function saveUpdates(_0x355967,_0x30cbca){return function(_0x5dd955){if(_0x5dd955){return _0x5dd955['update'](_0x355967)[_0x9fc8('0x22')](function(_0x35d389){return _0x35d389;});}return null;};}function removeEntity(_0x8839a3,_0x1c7a9a){return function(_0x577459){if(_0x577459){return _0x577459['destroy']()[_0x9fc8('0x22')](function(){var _0x4e9c99=_0x577459[_0x9fc8('0x23')]({'plain':!![]});var _0x3afbb5='Scheduler';return db['UserProfileResource'][_0x9fc8('0x24')]({'where':{'type':_0x3afbb5,'resourceId':_0x4e9c99['id']}})[_0x9fc8('0x22')](function(){return _0x577459;});})[_0x9fc8('0x22')](function(){_0x8839a3['status'](0xcc)[_0x9fc8('0x19')]();});}};}function handleEntityNotFound(_0x1c9bd9,_0x377c64){return function(_0x1d5c56){if(!_0x1d5c56){_0x1c9bd9[_0x9fc8('0x17')](0x194);}return _0x1d5c56;};}function handleError(_0x51dd9f,_0x209ef1){_0x209ef1=_0x209ef1||0x1f4;return function(_0x39ee0e){logger[_0x9fc8('0x25')](_0x39ee0e['stack']);if(_0x39ee0e[_0x9fc8('0x26')]){delete _0x39ee0e['name'];}_0x51dd9f[_0x9fc8('0x18')](_0x209ef1)[_0x9fc8('0x27')](_0x39ee0e);};}exports[_0x9fc8('0x28')]=function(_0x4cc50c,_0xb39de9){var _0x943ad9={},_0x151ee5={},_0x283530={'count':0x0,'rows':[]};var _0x2635c0=_[_0x9fc8('0x29')](db[_0x9fc8('0x2a')][_0x9fc8('0x2b')],function(_0x3b7c44){return{'name':_0x3b7c44['fieldName'],'type':_0x3b7c44[_0x9fc8('0x2c')][_0x9fc8('0x2d')]};});_0x151ee5[_0x9fc8('0x2e')]=_[_0x9fc8('0x29')](_0x2635c0,'name');_0x151ee5[_0x9fc8('0x2f')]=_[_0x9fc8('0x30')](_0x4cc50c['query']);_0x151ee5['filters']=_['intersection'](_0x151ee5[_0x9fc8('0x2e')],_0x151ee5['query']);_0x943ad9[_0x9fc8('0x31')]=_['intersection'](_0x151ee5[_0x9fc8('0x2e')],qs['fields'](_0x4cc50c[_0x9fc8('0x2f')][_0x9fc8('0x32')]));_0x943ad9[_0x9fc8('0x31')]=_0x943ad9['attributes'][_0x9fc8('0x33')]?_0x943ad9[_0x9fc8('0x31')]:_0x151ee5['model'];if(!_0x4cc50c['query'][_0x9fc8('0x34')](_0x9fc8('0x35'))){_0x943ad9[_0x9fc8('0x1d')]=qs[_0x9fc8('0x1d')](_0x4cc50c[_0x9fc8('0x2f')][_0x9fc8('0x1d')]);_0x943ad9[_0x9fc8('0x1b')]=qs[_0x9fc8('0x1b')](_0x4cc50c[_0x9fc8('0x2f')][_0x9fc8('0x1b')]);}_0x943ad9[_0x9fc8('0x36')]=qs[_0x9fc8('0x37')](_0x4cc50c[_0x9fc8('0x2f')][_0x9fc8('0x37')]);_0x943ad9[_0x9fc8('0x38')]=qs[_0x9fc8('0x39')](_[_0x9fc8('0x3a')](_0x4cc50c[_0x9fc8('0x2f')],_0x151ee5[_0x9fc8('0x39')]),_0x2635c0);if(_0x4cc50c['query'][_0x9fc8('0x3b')]){_0x943ad9[_0x9fc8('0x38')]=_[_0x9fc8('0x3c')](_0x943ad9[_0x9fc8('0x38')],{'$or':_[_0x9fc8('0x29')](_0x2635c0,function(_0x5be7ff){if(_0x5be7ff['type']!==_0x9fc8('0x3d')){var _0x12cc4f={};_0x12cc4f[_0x5be7ff[_0x9fc8('0x26')]]={'$like':'%'+_0x4cc50c[_0x9fc8('0x2f')][_0x9fc8('0x3b')]+'%'};return _0x12cc4f;}})});}_0x943ad9=_[_0x9fc8('0x3c')]({},_0x943ad9,_0x4cc50c['options']);var _0x2cac51={'where':_0x943ad9[_0x9fc8('0x38')]};return db['Schedule'][_0x9fc8('0x1e')](_0x2cac51)[_0x9fc8('0x22')](function(_0x36671c){_0x283530[_0x9fc8('0x1e')]=_0x36671c;if(_0x4cc50c[_0x9fc8('0x2f')][_0x9fc8('0x3e')]){_0x943ad9[_0x9fc8('0x3f')]=[{'all':!![]}];}return db['Schedule'][_0x9fc8('0x40')](_0x943ad9);})[_0x9fc8('0x22')](function(_0x24f9af){_0x283530[_0x9fc8('0x41')]=_0x24f9af;return _0x283530;})[_0x9fc8('0x22')](respondWithFilteredResult(_0xb39de9,_0x943ad9))[_0x9fc8('0x42')](handleError(_0xb39de9,null));};exports['show']=function(_0x362054,_0x1b3fe8){var _0x261cd0={'raw':![],'where':{'id':_0x362054[_0x9fc8('0x43')]['id']}},_0x1bd973={};_0x1bd973[_0x9fc8('0x2e')]=_[_0x9fc8('0x30')](db[_0x9fc8('0x2a')][_0x9fc8('0x2b')]);_0x1bd973[_0x9fc8('0x2f')]=_[_0x9fc8('0x30')](_0x362054[_0x9fc8('0x2f')]);_0x1bd973[_0x9fc8('0x39')]=_[_0x9fc8('0x44')](_0x1bd973[_0x9fc8('0x2e')],_0x1bd973[_0x9fc8('0x2f')]);_0x261cd0[_0x9fc8('0x31')]=_[_0x9fc8('0x44')](_0x1bd973[_0x9fc8('0x2e')],qs[_0x9fc8('0x32')](_0x362054[_0x9fc8('0x2f')][_0x9fc8('0x32')]));_0x261cd0[_0x9fc8('0x31')]=_0x261cd0[_0x9fc8('0x31')][_0x9fc8('0x33')]?_0x261cd0[_0x9fc8('0x31')]:_0x1bd973[_0x9fc8('0x2e')];if(_0x362054[_0x9fc8('0x2f')]['includeAll']){_0x261cd0['include']=[{'all':!![]}];}_0x261cd0=_[_0x9fc8('0x3c')]({},_0x261cd0,_0x362054[_0x9fc8('0x45')]);return db['Schedule'][_0x9fc8('0x46')](_0x261cd0)['then'](handleEntityNotFound(_0x1b3fe8,null))['then'](respondWithResult(_0x1b3fe8,null))[_0x9fc8('0x42')](handleError(_0x1b3fe8,null));};exports[_0x9fc8('0x47')]=function(_0x50c8cf,_0x2875bc){return db['Schedule'][_0x9fc8('0x47')](_0x50c8cf['body'],{})[_0x9fc8('0x22')](function(_0x192d45){var _0x1eb043=_0x50c8cf[_0x9fc8('0x48')]['get']({'plain':!![]});if(!_0x1eb043)throw new Error(_0x9fc8('0x49'));if(_0x1eb043[_0x9fc8('0x4a')]===_0x9fc8('0x48')){var _0x1d6b9f=_0x192d45['get']({'plain':!![]});var _0x3ca602='Scheduler';return db[_0x9fc8('0x4b')][_0x9fc8('0x46')]({'where':{'name':_0x3ca602,'userProfileId':_0x1eb043['userProfileId']},'raw':!![]})[_0x9fc8('0x22')](function(_0xec07c0){if(_0xec07c0&&_0xec07c0[_0x9fc8('0x4c')]===0x0){return db[_0x9fc8('0x4d')][_0x9fc8('0x47')]({'name':_0x1d6b9f[_0x9fc8('0x26')],'resourceId':_0x1d6b9f['id'],'type':_0xec07c0[_0x9fc8('0x26')],'sectionId':_0xec07c0['id']},{})[_0x9fc8('0x22')](function(){return _0x192d45;});}else{return _0x192d45;}})[_0x9fc8('0x42')](function(_0x52ea73){logger['error'](_0x9fc8('0x4e'),_0x52ea73);throw _0x52ea73;});}return _0x192d45;})['then'](respondWithResult(_0x2875bc,0xc9))['catch'](handleError(_0x2875bc,null));};exports[_0x9fc8('0x4f')]=function(_0xb61a16,_0x9f9ed3){if(_0xb61a16['body']['id']){delete _0xb61a16[_0x9fc8('0x50')]['id'];}return db[_0x9fc8('0x2a')][_0x9fc8('0x46')]({'where':{'id':_0xb61a16[_0x9fc8('0x43')]['id']}})['then'](handleEntityNotFound(_0x9f9ed3,null))['then'](saveUpdates(_0xb61a16['body'],null))[_0x9fc8('0x22')](respondWithResult(_0x9f9ed3,null))[_0x9fc8('0x42')](handleError(_0x9f9ed3,null));};exports[_0x9fc8('0x24')]=function(_0x256b47,_0x5e884f){return db[_0x9fc8('0x2a')]['find']({'where':{'id':_0x256b47[_0x9fc8('0x43')]['id']}})[_0x9fc8('0x22')](handleEntityNotFound(_0x5e884f,null))[_0x9fc8('0x22')](removeEntity(_0x5e884f,null))[_0x9fc8('0x42')](handleError(_0x5e884f,null));};exports['run']=function(_0x5cb4e0,_0x5f3167,_0x7d6e79){var _0xb5468d=require(_0x9fc8('0x51'));return db[_0x9fc8('0x2a')]['find']({'where':{'id':_0x5cb4e0['params']['id']},'raw':!![]})[_0x9fc8('0x22')](handleEntityNotFound(_0x5f3167,null))['then'](function(){_0xb5468d[_0x9fc8('0x52')](_0x5cb4e0[_0x9fc8('0x43')]['id']);})[_0x9fc8('0x22')](respondWithStatusCode(_0x5f3167,null))[_0x9fc8('0x42')](handleError(_0x5f3167,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 42b26b0..2397590 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 _0xd290=['../../config/environment','./schedule.attributes','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2f8ff8,_0x1d924e){var _0x3d64de=function(_0x24e6a2){while(--_0x24e6a2){_0x2f8ff8['push'](_0x2f8ff8['shift']());}};_0x3d64de(++_0x1d924e);}(_0xd290,0x91));var _0x0d29=function(_0xdc28d2,_0x4d5645){_0xdc28d2=_0xdc28d2-0x0;var _0x56b864=_0xd290[_0xdc28d2];return _0x56b864;};'use strict';var _=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var logger=require(_0x0d29('0x2'))(_0x0d29('0x3'));var moment=require(_0x0d29('0x4'));var BPromise=require(_0x0d29('0x5'));var rp=require(_0x0d29('0x6'));var fs=require('fs');var path=require(_0x0d29('0x7'));var rimraf=require(_0x0d29('0x8'));var config=require(_0x0d29('0x9'));var attributes=require(_0x0d29('0xa'));module['exports']=function(_0x573342,_0x5bc398){return _0x573342[_0x0d29('0xb')](_0x0d29('0xc'),attributes,{'tableName':_0x0d29('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe89c=['exports','Schedule','tools_schedules','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes'];(function(_0x1c0f8b,_0x8c821d){var _0x3fb800=function(_0x2c9be6){while(--_0x2c9be6){_0x1c0f8b['push'](_0x1c0f8b['shift']());}};_0x3fb800(++_0x8c821d);}(_0xe89c,0x16b));var _0xce89=function(_0x2d88d5,_0x166b23){_0x2d88d5=_0x2d88d5-0x0;var _0x13edaa=_0xe89c[_0x2d88d5];return _0x13edaa;};'use strict';var _=require('lodash');var util=require(_0xce89('0x0'));var logger=require(_0xce89('0x1'))(_0xce89('0x2'));var moment=require(_0xce89('0x3'));var BPromise=require(_0xce89('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce89('0x5'));var rimraf=require(_0xce89('0x6'));var config=require(_0xce89('0x7'));var attributes=require(_0xce89('0x8'));module[_0xce89('0x9')]=function(_0x5efa09,_0x354486){return _0x5efa09['define'](_0xce89('0xa'),attributes,{'tableName':_0xce89('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index eb4e14f..5a8a5d2 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 _0x04c3=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','Schedule,\x20%s,\x20%s'];(function(_0x240fe9,_0x53f225){var _0x38a574=function(_0x3f69ec){while(--_0x3f69ec){_0x240fe9['push'](_0x240fe9['shift']());}};_0x38a574(++_0x53f225);}(_0x04c3,0x1cf));var _0x304c=function(_0xdc8d0b,_0x6af053){_0xdc8d0b=_0xdc8d0b-0x0;var _0x2a9842=_0x04c3[_0xdc8d0b];return _0x2a9842;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x304c('0x0'));var BPromise=require(_0x304c('0x1'));var rs=require(_0x304c('0x2'));var fs=require('fs');var Redis=require(_0x304c('0x3'));var db=require(_0x304c('0x4'))['db'];var utils=require(_0x304c('0x5'));var logger=require(_0x304c('0x6'))('rpc');var config=require(_0x304c('0x7'));var jayson=require(_0x304c('0x8'));var client=jayson[_0x304c('0x9')][_0x304c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24c36f,_0x386c4a,_0x35bfb1){return new BPromise(function(_0xe91383,_0x44cdb1){return client[_0x304c('0xb')](_0x24c36f,_0x35bfb1)[_0x304c('0xc')](function(_0x1a6da1){logger[_0x304c('0xd')]('Schedule,\x20%s,\x20%s',_0x386c4a,_0x304c('0xe'));logger[_0x304c('0xf')](_0x304c('0x10'),_0x386c4a,_0x304c('0xe'),JSON[_0x304c('0x11')](_0x1a6da1));if(_0x1a6da1[_0x304c('0x12')]){if(_0x1a6da1['error']['code']===0x1f4){logger[_0x304c('0x12')]('Schedule,\x20%s,\x20%s',_0x386c4a,_0x1a6da1['error'][_0x304c('0x13')]);return _0x44cdb1(_0x1a6da1[_0x304c('0x12')][_0x304c('0x13')]);}logger[_0x304c('0x12')](_0x304c('0x14'),_0x386c4a,_0x1a6da1[_0x304c('0x12')]['message']);return _0xe91383(_0x1a6da1['error'][_0x304c('0x13')]);}else{logger[_0x304c('0xd')](_0x304c('0x14'),_0x386c4a,_0x304c('0xe'));_0xe91383(_0x1a6da1['result'][_0x304c('0x13')]);}})[_0x304c('0x15')](function(_0xdd2495){logger[_0x304c('0x12')]('Schedule,\x20%s,\x20%s',_0x386c4a,_0xdd2495);_0x44cdb1(_0xdd2495);});});} \ No newline at end of file +var _0xd65c=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x4696d0,_0x5709ac){var _0x442166=function(_0x3af217){while(--_0x3af217){_0x4696d0['push'](_0x4696d0['shift']());}};_0x442166(++_0x5709ac);}(_0xd65c,0x1cd));var _0xcd65=function(_0x3eceb2,_0x509ff8){_0x3eceb2=_0x3eceb2-0x0;var _0x818bc4=_0xd65c[_0x3eceb2];return _0x818bc4;};'use strict';var _=require('lodash');var util=require(_0xcd65('0x0'));var moment=require(_0xcd65('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd65('0x2'));var db=require(_0xcd65('0x3'))['db'];var utils=require(_0xcd65('0x4'));var logger=require(_0xcd65('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcd65('0x6'));var client=jayson[_0xcd65('0x7')][_0xcd65('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31aa97,_0x5b73ef,_0xa530c9){return new BPromise(function(_0x16dee2,_0x57cb68){return client[_0xcd65('0x9')](_0x31aa97,_0xa530c9)[_0xcd65('0xa')](function(_0x3234c8){logger[_0xcd65('0xb')](_0xcd65('0xc'),_0x5b73ef,'request\x20sent');logger[_0xcd65('0xd')]('Schedule,\x20%s,\x20%s,\x20%s',_0x5b73ef,_0xcd65('0xe'),JSON[_0xcd65('0xf')](_0x3234c8));if(_0x3234c8[_0xcd65('0x10')]){if(_0x3234c8[_0xcd65('0x10')][_0xcd65('0x11')]===0x1f4){logger[_0xcd65('0x10')](_0xcd65('0xc'),_0x5b73ef,_0x3234c8[_0xcd65('0x10')][_0xcd65('0x12')]);return _0x57cb68(_0x3234c8[_0xcd65('0x10')][_0xcd65('0x12')]);}logger[_0xcd65('0x10')](_0xcd65('0xc'),_0x5b73ef,_0x3234c8[_0xcd65('0x10')]['message']);return _0x16dee2(_0x3234c8['error'][_0xcd65('0x12')]);}else{logger[_0xcd65('0xb')](_0xcd65('0xc'),_0x5b73ef,_0xcd65('0xe'));_0x16dee2(_0x3234c8[_0xcd65('0x13')]['message']);}})[_0xcd65('0x14')](function(_0x39b8d6){logger[_0xcd65('0x10')](_0xcd65('0xc'),_0x5b73ef,_0x39b8d6);_0x57cb68(_0x39b8d6);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index a64cb39..2de725d 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 _0x9041=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x1f653b,_0x55254f){var _0x1a8fed=function(_0x54e5b3){while(--_0x54e5b3){_0x1f653b['push'](_0x1f653b['shift']());}};_0x1a8fed(++_0x55254f);}(_0x9041,0xe2));var _0x1904=function(_0xf1af87,_0xf52f76){_0xf1af87=_0xf1af87-0x0;var _0x1348d5=_0x9041[_0xf1af87];return _0x1348d5;};'use strict';var multer=require(_0x1904('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1904('0x1'));var express=require(_0x1904('0x2'));var router=express[_0x1904('0x3')]();var fs_extra=require(_0x1904('0x4'));var auth=require(_0x1904('0x5'));var interaction=require(_0x1904('0x6'));var config=require(_0x1904('0x7'));var controller=require(_0x1904('0x8'));router[_0x1904('0x9')]('/',auth[_0x1904('0xa')](),controller['index']);router[_0x1904('0x9')](_0x1904('0xb'),auth[_0x1904('0xa')](),controller[_0x1904('0xc')]);router['get'](_0x1904('0xd'),auth[_0x1904('0xa')](),controller['show']);router[_0x1904('0x9')](_0x1904('0xe'),auth[_0x1904('0xa')](),controller[_0x1904('0xf')]);router[_0x1904('0x10')]('/',auth[_0x1904('0xa')](),controller[_0x1904('0x11')]);router[_0x1904('0x12')](_0x1904('0xd'),auth['isAuthenticated'](),controller[_0x1904('0x13')]);router[_0x1904('0x14')](_0x1904('0xd'),auth[_0x1904('0xa')](),controller[_0x1904('0x15')]);module[_0x1904('0x16')]=router; \ No newline at end of file +var _0x7f29=['exports','multer','util','path','express','Router','../../components/auth/service','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','put','destroy'];(function(_0x4e3c47,_0x42afc8){var _0x133890=function(_0x172c6c){while(--_0x172c6c){_0x4e3c47['push'](_0x4e3c47['shift']());}};_0x133890(++_0x42afc8);}(_0x7f29,0x17b));var _0x97f2=function(_0x35836a,_0xba898c){_0x35836a=_0x35836a-0x0;var _0x107ac9=_0x7f29[_0x35836a];return _0x107ac9;};'use strict';var multer=require(_0x97f2('0x0'));var util=require(_0x97f2('0x1'));var path=require(_0x97f2('0x2'));var timeout=require('connect-timeout');var express=require(_0x97f2('0x3'));var router=express[_0x97f2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x97f2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x97f2('0x6'));router[_0x97f2('0x7')]('/',auth[_0x97f2('0x8')](),controller[_0x97f2('0x9')]);router[_0x97f2('0x7')](_0x97f2('0xa'),auth[_0x97f2('0x8')](),controller[_0x97f2('0xb')]);router['get'](_0x97f2('0xc'),auth[_0x97f2('0x8')](),controller[_0x97f2('0xd')]);router['get'](_0x97f2('0xe'),auth[_0x97f2('0x8')](),controller[_0x97f2('0xf')]);router[_0x97f2('0x10')]('/',auth[_0x97f2('0x8')](),controller[_0x97f2('0x11')]);router[_0x97f2('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x97f2('0xc'),auth[_0x97f2('0x8')](),controller[_0x97f2('0x13')]);module[_0x97f2('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 1d4099b..fbc371d 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 _0x6b19=['VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','path','../../config/environment'];(function(_0x240f7e,_0x2fefb6){var _0x22a42d=function(_0x3cb108){while(--_0x3cb108){_0x240f7e['push'](_0x240f7e['shift']());}};_0x22a42d(++_0x2fefb6);}(_0x6b19,0xf4));var _0x96b1=function(_0x569de2,_0x5c6975){_0x569de2=_0x569de2-0x0;var _0x9e269a=_0x6b19[_0x569de2];return _0x9e269a;};'use strict';var Sequelize=require(_0x96b1('0x0'));var moment=require('moment');var path=require(_0x96b1('0x1'));var config=require(_0x96b1('0x2'));module['exports']={'format':{'type':Sequelize[_0x96b1('0x3')],'get':function(){return this[_0x96b1('0x4')](_0x96b1('0x5'))?path[_0x96b1('0x6')](this['getDataValue'](_0x96b1('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x96b1('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x288d77){var _0x2347c5=_0x288d77['replace'](/\\/g,'/');this[_0x96b1('0x8')](_0x96b1('0x5'),_0x2347c5);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x96b1('0x9')],'set':function(_0x6323a6){this[_0x96b1('0x8')](_0x96b1('0xa'),moment()[_0x96b1('0xb')](_0x6323a6,'ms'));this['setDataValue'](_0x96b1('0xc'),moment());this['setDataValue']('duration',_0x6323a6);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x96b1('0xa')))[_0x96b1('0xd')](_0x96b1('0xe'))[_0x96b1('0xf')]();}},'closedAt':{'type':Sequelize[_0x96b1('0x10')],'get':function(){return moment(this['getDataValue'](_0x96b1('0xc')))[_0x96b1('0xd')](_0x96b1('0xe'))[_0x96b1('0xf')]();}},'createdAt':{'type':Sequelize[_0x96b1('0x10')],'get':function(){return moment(this[_0x96b1('0x4')](_0x96b1('0x11')))[_0x96b1('0xd')](_0x96b1('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x96b1('0x10')],'get':function(){return moment(this[_0x96b1('0x4')](_0x96b1('0x12')))[_0x96b1('0xd')](_0x96b1('0xe'))[_0x96b1('0xf')]();}}}; \ No newline at end of file +var _0xccde=['startedAt','MM-DD-YYYY\x20HH:mm','toString','closedAt','format','createdAt','sequelize','path','exports','VIRTUAL','extname','getDataValue','value','STRING','replace','setDataValue','INTEGER','duration','DATE'];(function(_0x3beb4e,_0x2d1a69){var _0xd40198=function(_0x4a1f72){while(--_0x4a1f72){_0x3beb4e['push'](_0x3beb4e['shift']());}};_0xd40198(++_0x2d1a69);}(_0xccde,0x1e1));var _0xeccd=function(_0x5ba74f,_0x200bf4){_0x5ba74f=_0x5ba74f-0x0;var _0x534d79=_0xccde[_0x5ba74f];return _0x534d79;};'use strict';var Sequelize=require(_0xeccd('0x0'));var moment=require('moment');var path=require(_0xeccd('0x1'));var config=require('../../config/environment');module[_0xeccd('0x2')]={'format':{'type':Sequelize[_0xeccd('0x3')],'get':function(){return this['getDataValue']('value')?path[_0xeccd('0x4')](this[_0xeccd('0x5')](_0xeccd('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xeccd('0x7')]},'channel':{'type':Sequelize[_0xeccd('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x338742){var _0x130f1c=_0x338742[_0xeccd('0x8')](/\\/g,'/');this[_0xeccd('0x9')]('value',_0x130f1c);}},'rating':{'type':Sequelize[_0xeccd('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xeccd('0xa')],'set':function(_0x9dccd){this[_0xeccd('0x9')]('startedAt',moment()['subtract'](_0x9dccd,'ms'));this['setDataValue']('closedAt',moment());this[_0xeccd('0x9')](_0xeccd('0xb'),_0x9dccd);}},'startedAt':{'type':Sequelize[_0xeccd('0xc')],'get':function(){return moment(this[_0xeccd('0x5')](_0xeccd('0xd')))['format'](_0xeccd('0xe'))[_0xeccd('0xf')]();}},'closedAt':{'type':Sequelize[_0xeccd('0xc')],'get':function(){return moment(this[_0xeccd('0x5')](_0xeccd('0x10')))[_0xeccd('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0xeccd('0xc')],'get':function(){return moment(this[_0xeccd('0x5')](_0xeccd('0x12')))[_0xeccd('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xeccd('0xf')]();}},'updatedAt':{'type':Sequelize[_0xeccd('0xc')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0xeccd('0x11')](_0xeccd('0xe'))[_0xeccd('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index a57f2e6..8909544 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 _0xdbf5=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x50e877,_0x23644b){_0x50e877=_0x50e877-0x0;var _0x5d4c9b=_0xdbf5[_0x50e877];return _0x5d4c9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x22')]();});}};}function handleEntityNotFound(_0x20ab1b,_0x42f13b){return function(_0x15a790){if(!_0x15a790){_0x20ab1b[_0x5dbf('0x16')](0x194);}return _0x15a790;};}function handleError(_0x232c77,_0x3f9e60){_0x3f9e60=_0x3f9e60||0x1f4;return function(_0x407741){logger[_0x5dbf('0x23')](_0x407741[_0x5dbf('0x24')]);if(_0x407741[_0x5dbf('0x25')]){delete _0x407741[_0x5dbf('0x25')];}_0x232c77[_0x5dbf('0x17')](_0x3f9e60)[_0x5dbf('0x26')](_0x407741);};}exports[_0x5dbf('0x27')]=function(_0x471027,_0x21cd00){var _0x5768b7={},_0x2f71eb={},_0x24dc99={'count':0x0,'rows':[]};var _0xc4748=_[_0x5dbf('0x28')](db[_0x5dbf('0x29')][_0x5dbf('0x2a')],function(_0x2a65c5){return{'name':_0x2a65c5[_0x5dbf('0x2b')],'type':_0x2a65c5[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x2f71eb[_0x5dbf('0x2e')]=_['differenceBy'](_['map'](_0xc4748,_0x5dbf('0x25')),[_0x5dbf('0x2f')]);_0x2f71eb[_0x5dbf('0x30')]=_[_0x5dbf('0x31')](_0x471027[_0x5dbf('0x30')]);_0x2f71eb['filters']=_['intersection'](_0x2f71eb[_0x5dbf('0x2e')],_0x2f71eb[_0x5dbf('0x30')]);_0x5768b7['attributes']=_[_0x5dbf('0x32')](_0x2f71eb[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x5768b7['attributes']=_0x5768b7[_0x5dbf('0x34')][_0x5dbf('0x35')]?_0x5768b7[_0x5dbf('0x34')]:_0x2f71eb[_0x5dbf('0x2e')];if(!_0x471027[_0x5dbf('0x30')]['hasOwnProperty'](_0x5dbf('0x36'))){_0x5768b7[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x471027[_0x5dbf('0x30')]['limit']);_0x5768b7[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x19')]);}_0x5768b7[_0x5dbf('0x38')]=qs[_0x5dbf('0x39')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x39')]);_0x5768b7[_0x5dbf('0x3a')]=qs[_0x5dbf('0x3b')](_[_0x5dbf('0x3c')](_0x471027['query'],_0x2f71eb[_0x5dbf('0x3b')]),_0xc4748);if(_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]){_0x5768b7['where']=_[_0x5dbf('0x3e')](_0x5768b7[_0x5dbf('0x3a')],{'$or':_[_0x5dbf('0x28')](_0xc4748,function(_0x5b3738){if(_0x5b3738[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x9bd4c0={};_0x9bd4c0[_0x5b3738['name']]={'$like':'%'+_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]+'%'};return _0x9bd4c0;}})});}_0x5768b7=_[_0x5dbf('0x3e')]({},_0x5768b7,_0x471027[_0x5dbf('0x40')]);var _0x10537d={'where':_0x5768b7[_0x5dbf('0x3a')]};return db[_0x5dbf('0x29')][_0x5dbf('0x1b')](_0x10537d)['then'](function(_0x5be96b){_0x24dc99['count']=_0x5be96b;if(_0x471027['query'][_0x5dbf('0x41')]){_0x5768b7[_0x5dbf('0x42')]=[{'all':!![]}];}return db['ScreenRecording'][_0x5dbf('0x43')](_0x5768b7);})[_0x5dbf('0x20')](function(_0x5a60e8){_0x24dc99[_0x5dbf('0x44')]=_0x5a60e8;return _0x24dc99;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x21cd00,_0x5768b7))[_0x5dbf('0x45')](handleError(_0x21cd00,null));};exports[_0x5dbf('0x46')]=function(_0x21ae10,_0x7c390d){var _0x2745df={'raw':![],'where':{'id':_0x21ae10[_0x5dbf('0x47')]['id']}},_0x1c020a={};_0x1c020a[_0x5dbf('0x2e')]=_['keys'](db[_0x5dbf('0x29')][_0x5dbf('0x2a')]);_0x1c020a[_0x5dbf('0x30')]=_['keys'](_0x21ae10[_0x5dbf('0x30')]);_0x1c020a[_0x5dbf('0x3b')]=_[_0x5dbf('0x32')](_0x1c020a[_0x5dbf('0x2e')],_0x1c020a['query']);_0x2745df[_0x5dbf('0x34')]=_['intersection'](_0x1c020a[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x21ae10[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x2745df['attributes']=_0x2745df['attributes'][_0x5dbf('0x35')]?_0x2745df[_0x5dbf('0x34')]:_0x1c020a[_0x5dbf('0x2e')];if(_0x21ae10['query'][_0x5dbf('0x41')]){_0x2745df['include']=[{'all':!![]}];}_0x2745df=_['merge']({},_0x2745df,_0x21ae10['options']);return db['ScreenRecording'][_0x5dbf('0x48')](_0x2745df)[_0x5dbf('0x20')](handleEntityNotFound(_0x7c390d,null))['then'](respondWithResult(_0x7c390d,null))[_0x5dbf('0x45')](handleError(_0x7c390d,null));};exports[_0x5dbf('0x49')]=function(_0x4b6f30,_0x366102){return db[_0x5dbf('0x29')]['create'](_0x4b6f30[_0x5dbf('0x4a')],{})['then'](respondWithResult(_0x366102,0xc9))['catch'](handleError(_0x366102,null));};exports[_0x5dbf('0x1f')]=function(_0x2a3d30,_0x17a1c0){if(_0x2a3d30['body']['id']){delete _0x2a3d30['body']['id'];}delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4b')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4c')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4d')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4e')];return db['ScreenRecording'][_0x5dbf('0x48')]({'where':{'id':_0x2a3d30[_0x5dbf('0x47')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x17a1c0,null))[_0x5dbf('0x20')](saveUpdates(_0x2a3d30[_0x5dbf('0x4a')],null))[_0x5dbf('0x20')](respondWithResult(_0x17a1c0,null))[_0x5dbf('0x45')](handleError(_0x17a1c0,null));};exports['describe']=function(_0x1b0b13,_0x54f401){return db[_0x5dbf('0x29')][_0x5dbf('0x4f')]()[_0x5dbf('0x20')](respondWithResult(_0x54f401,null))[_0x5dbf('0x45')](handleError(_0x54f401,null));};exports[_0x5dbf('0x50')]=function(_0x1f165d,_0x353d0f,_0x48403a){var _0x5c3c0d=require('../../components/encryptor');var _0x1e1876=![];var _0xfdacc7={};if(_0x1f165d[_0x5dbf('0x30')]['type']&&_0x1f165d['query'][_0x5dbf('0x2c')]===_0x5dbf('0x51')){_0xfdacc7[_0x5dbf('0x51')]=_0x1f165d['params']['id'];}else{_0xfdacc7['id']=_0x1f165d[_0x5dbf('0x47')]['id'];}return db['ScreenRecording'][_0x5dbf('0x48')]({'where':_0xfdacc7,'attributes':['id',_0x5dbf('0x4e')],'raw':!![]})[_0x5dbf('0x20')](handleEntityNotFound(_0x353d0f,null))['then'](function(_0x55fd51){if(_0x55fd51){var _0x1b316d=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x55fd51['value']);var _0xfcc43c=util[_0x5dbf('0x2f')]('%s.cypher',_0x1b316d);if(fs['existsSync'](_0xfcc43c)){_0x1e1876=!![];return _0x5c3c0d[_0x5dbf('0x55')](_0xfcc43c,_0x1b316d,config[_0x5dbf('0x56')][_0x5dbf('0x57')])[_0x5dbf('0x20')](function(){return _0x55fd51;});}return _0x55fd51;}})[_0x5dbf('0x20')](function(_0x4711d5){if(_0x4711d5){var _0x50a029=path[_0x5dbf('0x52')](config['root'],'server/files/screen_recordings',_0x4711d5['value']);if(!fs[_0x5dbf('0x58')](_0x50a029)){throw new db['Sequelize'][(_0x5dbf('0x59'))](_0x5dbf('0x5a'));}if(_0x4711d5[_0x5dbf('0x5b')]){return _0x353d0f[_0x5dbf('0x50')](_0x50a029,_0x4711d5[_0x5dbf('0x5b')]+path[_0x5dbf('0x5c')](_0x50a029),function(){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}else{return _0x353d0f[_0x5dbf('0x50')](_0x50a029,function(_0x2c84d6){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}}})[_0x5dbf('0x45')](function(_0x2ca889){if(_0x2ca889[_0x5dbf('0x5e')]===_0x5dbf('0x5a')){_0x353d0f[_0x5dbf('0x17')](0x194)['send'](_0x5dbf('0x5f'));}else{return handleError(_0x353d0f,null);}});};exports['destroy']=function(_0xb0a9bf,_0xfc5817){return db[_0x5dbf('0x29')][_0x5dbf('0x48')]({'where':{'id':_0xb0a9bf['params']['id']}})[_0x5dbf('0x20')](function(_0x1ade34){if(_[_0x5dbf('0x60')](_0x1ade34)){throw new ReferenceError(_0x5dbf('0x61'));}return _0x1ade34;})[_0x5dbf('0x20')](function(_0x40982f){var _0x52efd7=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x40982f[_0x5dbf('0x4e')]);logger[_0x5dbf('0x62')](_0x5dbf('0x63'),_0x52efd7);if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs['unlinkSync'](_0x52efd7);}_0x52efd7=_0x52efd7+'.cypher';if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs[_0x5dbf('0x66')](_0x52efd7);}return _0x40982f;})[_0x5dbf('0x20')](function(_0x3a4001){if(!_0x3a4001)throw new InternalError();return _0x3a4001['destroy']();})['then'](function(){_0xfc5817['status'](0xcc)['end']();})[_0x5dbf('0x45')](handleError(_0xfc5817,null));}; \ No newline at end of file +var _0x5c12=['undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','filter','include','rows','catch','keys','includeAll','options','find','create','body','createdAt','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','limit'];(function(_0x2790e4,_0x115b27){var _0x3d001d=function(_0x4b2a3a){while(--_0x4b2a3a){_0x2790e4['push'](_0x2790e4['shift']());}};_0x3d001d(++_0x115b27);}(_0x5c12,0x188));var _0x25c1=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x5c12[_0xf79bae];return _0x5d2cb7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25c1('0x0'));var zipdir=require(_0x25c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25c1('0x2'));var moment=require(_0x25c1('0x3'));var BPromise=require(_0x25c1('0x4'));var Mustache=require(_0x25c1('0x5'));var util=require(_0x25c1('0x6'));var path=require(_0x25c1('0x7'));var sox=require(_0x25c1('0x8'));var csv=require('to-csv');var ejs=require(_0x25c1('0x9'));var fs=require('fs');var fs_extra=require(_0x25c1('0xa'));var _=require(_0x25c1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25c1('0xc'));var deskjs=require(_0x25c1('0xd'));var toCsv=require(_0x25c1('0xe'));var querystring=require(_0x25c1('0xf'));var Papa=require(_0x25c1('0x10'));var Redis=require('ioredis');var authService=require(_0x25c1('0x11'));var qs=require(_0x25c1('0x12'));var as=require(_0x25c1('0x13'));var hardwareService=require(_0x25c1('0x14'));var logger=require(_0x25c1('0x15'))('api');var utils=require(_0x25c1('0x16'));var config=require(_0x25c1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x25c1('0x18'))['db'];function respondWithStatusCode(_0x209af5,_0x323d3c){_0x323d3c=_0x323d3c||0xcc;return function(_0x329ba9){if(_0x329ba9){return _0x209af5['sendStatus'](_0x323d3c);}return _0x209af5['status'](_0x323d3c)['end']();};}function respondWithResult(_0x54f6f4,_0x3ef429){_0x3ef429=_0x3ef429||0xc8;return function(_0x1412ed){if(_0x1412ed){return _0x54f6f4[_0x25c1('0x19')](_0x3ef429)[_0x25c1('0x1a')](_0x1412ed);}};}function respondWithFilteredResult(_0x17a032,_0x4ea926){return function(_0x4638f0){if(_0x4638f0){var _0x55b62d=typeof _0x4ea926['offset']==='undefined'&&typeof _0x4ea926[_0x25c1('0x1b')]===_0x25c1('0x1c');var _0x4dc64b=_0x4638f0['count'];var _0x61a29f=_0x55b62d?0x0:_0x4ea926['offset'];var _0x7175d4=_0x55b62d?_0x4638f0[_0x25c1('0x1d')]:_0x4ea926['offset']+_0x4ea926['limit'];var _0x542768;if(_0x7175d4>=_0x4dc64b){_0x7175d4=_0x4dc64b;_0x542768=0xc8;}else{_0x542768=0xce;}_0x17a032[_0x25c1('0x19')](_0x542768);return _0x17a032[_0x25c1('0x1e')](_0x25c1('0x1f'),_0x61a29f+'-'+_0x7175d4+'/'+_0x4dc64b)[_0x25c1('0x1a')](_0x4638f0);}return null;};}function patchUpdates(_0x481c12){return function(_0x119639){try{jsonpatch[_0x25c1('0x20')](_0x119639,_0x481c12,!![]);}catch(_0x34454a){return BPromise[_0x25c1('0x21')](_0x34454a);}return _0x119639['save']();};}function saveUpdates(_0x4c3259,_0x2a8a84){return function(_0xac3335){if(_0xac3335){return _0xac3335[_0x25c1('0x22')](_0x4c3259)[_0x25c1('0x23')](function(_0x15cf2f){return _0x15cf2f;});}return null;};}function removeEntity(_0x1a4b89,_0x2ba595){return function(_0x324ea9){if(_0x324ea9){return _0x324ea9[_0x25c1('0x24')]()[_0x25c1('0x23')](function(){_0x1a4b89[_0x25c1('0x19')](0xcc)[_0x25c1('0x25')]();});}};}function handleEntityNotFound(_0x399d72,_0x4915cc){return function(_0x2dadae){if(!_0x2dadae){_0x399d72[_0x25c1('0x26')](0x194);}return _0x2dadae;};}function handleError(_0x1b1c96,_0x1fb59f){_0x1fb59f=_0x1fb59f||0x1f4;return function(_0x21fdb8){logger[_0x25c1('0x27')](_0x21fdb8['stack']);if(_0x21fdb8[_0x25c1('0x28')]){delete _0x21fdb8[_0x25c1('0x28')];}_0x1b1c96[_0x25c1('0x19')](_0x1fb59f)[_0x25c1('0x29')](_0x21fdb8);};}exports[_0x25c1('0x2a')]=function(_0x193a68,_0x5c56ab){var _0x1e498={},_0x478f1e={},_0x76b360={'count':0x0,'rows':[]};var _0x31c153=_[_0x25c1('0x2b')](db[_0x25c1('0x2c')][_0x25c1('0x2d')],function(_0x21069c){return{'name':_0x21069c[_0x25c1('0x2e')],'type':_0x21069c[_0x25c1('0x2f')][_0x25c1('0x30')]};});_0x478f1e['model']=_[_0x25c1('0x31')](_['map'](_0x31c153,'name'),[_0x25c1('0x32')]);_0x478f1e[_0x25c1('0x33')]=_['keys'](_0x193a68[_0x25c1('0x33')]);_0x478f1e['filters']=_[_0x25c1('0x34')](_0x478f1e['model'],_0x478f1e[_0x25c1('0x33')]);_0x1e498[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x478f1e[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1e498[_0x25c1('0x35')]=_0x1e498['attributes'][_0x25c1('0x38')]?_0x1e498['attributes']:_0x478f1e[_0x25c1('0x36')];if(!_0x193a68['query'][_0x25c1('0x39')](_0x25c1('0x3a'))){_0x1e498[_0x25c1('0x1b')]=qs[_0x25c1('0x1b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x1b')]);_0x1e498[_0x25c1('0x3b')]=qs[_0x25c1('0x3b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3b')]);}_0x1e498[_0x25c1('0x3c')]=qs[_0x25c1('0x3d')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3d')]);_0x1e498[_0x25c1('0x3e')]=qs[_0x25c1('0x3f')](_[_0x25c1('0x40')](_0x193a68[_0x25c1('0x33')],_0x478f1e[_0x25c1('0x3f')]),_0x31c153);if(_0x193a68[_0x25c1('0x33')]['filter']){_0x1e498[_0x25c1('0x3e')]=_[_0x25c1('0x41')](_0x1e498['where'],{'$or':_[_0x25c1('0x2b')](_0x31c153,function(_0x5eca99){if(_0x5eca99[_0x25c1('0x2f')]!=='VIRTUAL'){var _0x4326fb={};_0x4326fb[_0x5eca99[_0x25c1('0x28')]]={'$like':'%'+_0x193a68[_0x25c1('0x33')][_0x25c1('0x42')]+'%'};return _0x4326fb;}})});}_0x1e498=_[_0x25c1('0x41')]({},_0x1e498,_0x193a68['options']);var _0x1fe6d7={'where':_0x1e498['where']};return db[_0x25c1('0x2c')][_0x25c1('0x1d')](_0x1fe6d7)[_0x25c1('0x23')](function(_0x17fc23){_0x76b360['count']=_0x17fc23;if(_0x193a68['query']['includeAll']){_0x1e498[_0x25c1('0x43')]=[{'all':!![]}];}return db[_0x25c1('0x2c')]['findAll'](_0x1e498);})[_0x25c1('0x23')](function(_0x58792d){_0x76b360[_0x25c1('0x44')]=_0x58792d;return _0x76b360;})[_0x25c1('0x23')](respondWithFilteredResult(_0x5c56ab,_0x1e498))[_0x25c1('0x45')](handleError(_0x5c56ab,null));};exports['show']=function(_0x5502c1,_0x53f87b){var _0x1b1d17={'raw':![],'where':{'id':_0x5502c1['params']['id']}},_0x3cf9c0={};_0x3cf9c0[_0x25c1('0x36')]=_[_0x25c1('0x46')](db[_0x25c1('0x2c')]['rawAttributes']);_0x3cf9c0['query']=_['keys'](_0x5502c1['query']);_0x3cf9c0[_0x25c1('0x3f')]=_[_0x25c1('0x34')](_0x3cf9c0['model'],_0x3cf9c0[_0x25c1('0x33')]);_0x1b1d17[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x3cf9c0[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x5502c1[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1b1d17['attributes']=_0x1b1d17['attributes'][_0x25c1('0x38')]?_0x1b1d17[_0x25c1('0x35')]:_0x3cf9c0[_0x25c1('0x36')];if(_0x5502c1['query'][_0x25c1('0x47')]){_0x1b1d17[_0x25c1('0x43')]=[{'all':!![]}];}_0x1b1d17=_[_0x25c1('0x41')]({},_0x1b1d17,_0x5502c1[_0x25c1('0x48')]);return db['ScreenRecording'][_0x25c1('0x49')](_0x1b1d17)[_0x25c1('0x23')](handleEntityNotFound(_0x53f87b,null))[_0x25c1('0x23')](respondWithResult(_0x53f87b,null))[_0x25c1('0x45')](handleError(_0x53f87b,null));};exports['create']=function(_0x59e96b,_0x13ac06){return db[_0x25c1('0x2c')][_0x25c1('0x4a')](_0x59e96b[_0x25c1('0x4b')],{})['then'](respondWithResult(_0x13ac06,0xc9))[_0x25c1('0x45')](handleError(_0x13ac06,null));};exports[_0x25c1('0x22')]=function(_0x5770dd,_0x102f5){if(_0x5770dd[_0x25c1('0x4b')]['id']){delete _0x5770dd[_0x25c1('0x4b')]['id'];}delete _0x5770dd[_0x25c1('0x4b')]['duration'];delete _0x5770dd['body'][_0x25c1('0x4c')];delete _0x5770dd[_0x25c1('0x4b')][_0x25c1('0x4d')];delete _0x5770dd['body'][_0x25c1('0x4e')];return db[_0x25c1('0x2c')]['find']({'where':{'id':_0x5770dd[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](handleEntityNotFound(_0x102f5,null))[_0x25c1('0x23')](saveUpdates(_0x5770dd[_0x25c1('0x4b')],null))[_0x25c1('0x23')](respondWithResult(_0x102f5,null))[_0x25c1('0x45')](handleError(_0x102f5,null));};exports[_0x25c1('0x50')]=function(_0x5102a0,_0x5344da){return db['ScreenRecording'][_0x25c1('0x50')]()['then'](respondWithResult(_0x5344da,null))[_0x25c1('0x45')](handleError(_0x5344da,null));};exports[_0x25c1('0x51')]=function(_0x42fd6e,_0x153603,_0x40fe57){var _0x1b72e5=require('../../components/encryptor');var _0x4a876b=![];var _0x68e295={};if(_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]&&_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]==='uniqueid'){_0x68e295[_0x25c1('0x52')]=_0x42fd6e[_0x25c1('0x4f')]['id'];}else{_0x68e295['id']=_0x42fd6e[_0x25c1('0x4f')]['id'];}return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':_0x68e295,'attributes':['id','value'],'raw':!![]})[_0x25c1('0x23')](handleEntityNotFound(_0x153603,null))[_0x25c1('0x23')](function(_0x49b192){if(_0x49b192){var _0x1341d2=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x49b192[_0x25c1('0x4e')]);var _0x3d051a=util['format'](_0x25c1('0x56'),_0x1341d2);if(fs[_0x25c1('0x57')](_0x3d051a)){_0x4a876b=!![];return _0x1b72e5[_0x25c1('0x58')](_0x3d051a,_0x1341d2,config[_0x25c1('0x59')][_0x25c1('0x5a')])[_0x25c1('0x23')](function(){return _0x49b192;});}return _0x49b192;}})[_0x25c1('0x23')](function(_0x5d54cd){if(_0x5d54cd){var _0x321833=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x5d54cd[_0x25c1('0x4e')]);if(!fs[_0x25c1('0x57')](_0x321833)){throw new db['Sequelize'][(_0x25c1('0x5b'))](_0x25c1('0x5c'));}if(_0x5d54cd[_0x25c1('0x5d')]){return _0x153603[_0x25c1('0x51')](_0x321833,_0x5d54cd[_0x25c1('0x5d')]+path[_0x25c1('0x5e')](_0x321833),function(){if(_0x4a876b){fs[_0x25c1('0x5f')](_0x321833);}});}else{return _0x153603['download'](_0x321833,function(_0x44efc9){if(_0x4a876b){fs['unlink'](_0x321833);}});}}})[_0x25c1('0x45')](function(_0x24568c){if(_0x24568c[_0x25c1('0x60')]===_0x25c1('0x5c')){_0x153603[_0x25c1('0x19')](0x194)[_0x25c1('0x29')](_0x25c1('0x61'));}else{return handleError(_0x153603,null);}});};exports[_0x25c1('0x24')]=function(_0x4c435c,_0x7dbbe1){return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':{'id':_0x4c435c[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](function(_0x338f70){if(_[_0x25c1('0x62')](_0x338f70)){throw new ReferenceError('Entity\x20not\x20found');}return _0x338f70;})[_0x25c1('0x23')](function(_0x51e747){var _0x5e1517=path['join'](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x51e747[_0x25c1('0x4e')]);logger[_0x25c1('0x63')](_0x25c1('0x64'),_0x5e1517);if(!_['isNil'](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}_0x5e1517=_0x5e1517+_0x25c1('0x68');if(!_[_0x25c1('0x62')](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}return _0x51e747;})[_0x25c1('0x23')](function(_0x425f3e){if(!_0x425f3e)throw new InternalError();return _0x425f3e['destroy']();})[_0x25c1('0x23')](function(){_0x7dbbe1['status'](0xcc)[_0x25c1('0x25')]();})['catch'](handleError(_0x7dbbe1,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index c422b27..dc2dea7 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 _0x2b78=['../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x48a4c1,_0x41c6ff){var _0x575e6e=function(_0x1014dc){while(--_0x1014dc){_0x48a4c1['push'](_0x48a4c1['shift']());}};_0x575e6e(++_0x41c6ff);}(_0x2b78,0x132));var _0x82b7=function(_0x368dbc,_0x1b3ddc){_0x368dbc=_0x368dbc-0x0;var _0x257b6b=_0x2b78[_0x368dbc];return _0x257b6b;};'use strict';var _=require(_0x82b7('0x0'));var util=require(_0x82b7('0x1'));var logger=require(_0x82b7('0x2'))('api');var moment=require(_0x82b7('0x3'));var BPromise=require('bluebird');var rp=require(_0x82b7('0x4'));var fs=require('fs');var path=require(_0x82b7('0x5'));var rimraf=require('rimraf');var config=require(_0x82b7('0x6'));var attributes=require(_0x82b7('0x7'));module[_0x82b7('0x8')]=function(_0x2ef93a,_0x2415cc){return _0x2ef93a[_0x82b7('0x9')](_0x82b7('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x82b7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce55=['path','rimraf','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','bluebird'];(function(_0x56d014,_0x185cb9){var _0x1e1685=function(_0x32851d){while(--_0x32851d){_0x56d014['push'](_0x56d014['shift']());}};_0x1e1685(++_0x185cb9);}(_0xce55,0x187));var _0x5ce5=function(_0xb42da0,_0x5e98b4){_0xb42da0=_0xb42da0-0x0;var _0x4036c7=_0xce55[_0xb42da0];return _0x4036c7;};'use strict';var _=require(_0x5ce5('0x0'));var util=require(_0x5ce5('0x1'));var logger=require(_0x5ce5('0x2'))(_0x5ce5('0x3'));var moment=require('moment');var BPromise=require(_0x5ce5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ce5('0x5'));var rimraf=require(_0x5ce5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5ce5('0x7'));module[_0x5ce5('0x8')]=function(_0x3a944c,_0x515aa2){return _0x3a944c['define'](_0x5ce5('0x9'),attributes,{'tableName':_0x5ce5('0xa'),'paranoid':![],'indexes':[{'name':_0x5ce5('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index badf029..ecc9480 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 _0x9cf5=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9cf5,0x102));var _0x59cf=function(_0x53e067,_0x12e4c0){_0x53e067=_0x53e067-0x0;var _0x2da77b=_0x9cf5[_0x53e067];return _0x2da77b;};'use strict';var _=require('lodash');var util=require(_0x59cf('0x0'));var moment=require(_0x59cf('0x1'));var BPromise=require(_0x59cf('0x2'));var rs=require(_0x59cf('0x3'));var fs=require('fs');var Redis=require(_0x59cf('0x4'));var db=require(_0x59cf('0x5'))['db'];var utils=require(_0x59cf('0x6'));var logger=require(_0x59cf('0x7'))('rpc');var config=require(_0x59cf('0x8'));var jayson=require(_0x59cf('0x9'));var client=jayson['client'][_0x59cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6714f1,_0x501c70,_0x4fe802){return new BPromise(function(_0x20e4dd,_0x56c133){return client[_0x59cf('0xb')](_0x6714f1,_0x4fe802)[_0x59cf('0xc')](function(_0x511408){logger['info'](_0x59cf('0xd'),_0x501c70,_0x59cf('0xe'));logger['debug'](_0x59cf('0xf'),_0x501c70,_0x59cf('0xe'),JSON[_0x59cf('0x10')](_0x511408));if(_0x511408[_0x59cf('0x11')]){if(_0x511408[_0x59cf('0x11')][_0x59cf('0x12')]===0x1f4){logger[_0x59cf('0x11')](_0x59cf('0xd'),_0x501c70,_0x511408[_0x59cf('0x11')][_0x59cf('0x13')]);return _0x56c133(_0x511408[_0x59cf('0x11')]['message']);}logger[_0x59cf('0x11')](_0x59cf('0xd'),_0x501c70,_0x511408[_0x59cf('0x11')][_0x59cf('0x13')]);return _0x20e4dd(_0x511408[_0x59cf('0x11')][_0x59cf('0x13')]);}else{logger['info'](_0x59cf('0xd'),_0x501c70,'request\x20sent');_0x20e4dd(_0x511408[_0x59cf('0x14')]['message']);}})[_0x59cf('0x15')](function(_0x4bc465){logger[_0x59cf('0x11')](_0x59cf('0xd'),_0x501c70,_0x4bc465);_0x56c133(_0x4bc465);});});} \ No newline at end of file +var _0x5a3f=['ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ScreenRecording,\x20%s,\x20%s','debug'];(function(_0x1bb45b,_0x4c17bd){var _0x11eaee=function(_0x527240){while(--_0x527240){_0x1bb45b['push'](_0x1bb45b['shift']());}};_0x11eaee(++_0x4c17bd);}(_0x5a3f,0x1d0));var _0xf5a3=function(_0x3dc052,_0x5b0e0e){_0x3dc052=_0x3dc052-0x0;var _0x48aea8=_0x5a3f[_0x3dc052];return _0x48aea8;};'use strict';var _=require(_0xf5a3('0x0'));var util=require('util');var moment=require(_0xf5a3('0x1'));var BPromise=require(_0xf5a3('0x2'));var rs=require(_0xf5a3('0x3'));var fs=require('fs');var Redis=require(_0xf5a3('0x4'));var db=require(_0xf5a3('0x5'))['db'];var utils=require(_0xf5a3('0x6'));var logger=require('../../config/logger')(_0xf5a3('0x7'));var config=require(_0xf5a3('0x8'));var jayson=require(_0xf5a3('0x9'));var client=jayson[_0xf5a3('0xa')][_0xf5a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36bfb8,_0x3858ee,_0x59b9fd){return new BPromise(function(_0x445bdd,_0x50c3fa){return client['request'](_0x36bfb8,_0x59b9fd)[_0xf5a3('0xc')](function(_0x1b50c8){logger[_0xf5a3('0xd')](_0xf5a3('0xe'),_0x3858ee,'request\x20sent');logger[_0xf5a3('0xf')](_0xf5a3('0x10'),_0x3858ee,_0xf5a3('0x11'),JSON[_0xf5a3('0x12')](_0x1b50c8));if(_0x1b50c8[_0xf5a3('0x13')]){if(_0x1b50c8[_0xf5a3('0x13')][_0xf5a3('0x14')]===0x1f4){logger[_0xf5a3('0x13')](_0xf5a3('0xe'),_0x3858ee,_0x1b50c8['error'][_0xf5a3('0x15')]);return _0x50c3fa(_0x1b50c8[_0xf5a3('0x13')][_0xf5a3('0x15')]);}logger[_0xf5a3('0x13')](_0xf5a3('0xe'),_0x3858ee,_0x1b50c8['error'][_0xf5a3('0x15')]);return _0x445bdd(_0x1b50c8[_0xf5a3('0x13')][_0xf5a3('0x15')]);}else{logger[_0xf5a3('0xd')](_0xf5a3('0xe'),_0x3858ee,_0xf5a3('0x11'));_0x445bdd(_0x1b50c8[_0xf5a3('0x16')]['message']);}})[_0xf5a3('0x17')](function(_0x13c20d){logger['error'](_0xf5a3('0xe'),_0x3858ee,_0x13c20d);_0x50c3fa(_0x13c20d);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index d4c391a..54b6da3 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 _0x9a85=['/:id/logo_login','diskStorage','server/files/images/logos/','addPreferred','favicon','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','getDate','show','/:id/logo','getLogo','gdpr','/:id/preferred','getPreferred','join','root','format','%s%s','logo','originalname','single','file','addLogo','logologin','extname','post'];(function(_0x2133d0,_0xfebf4b){var _0x51b62d=function(_0x2d5889){while(--_0x2d5889){_0x2133d0['push'](_0x2133d0['shift']());}};_0x51b62d(++_0xfebf4b);}(_0x9a85,0x1c2));var _0x59a8=function(_0x511b76,_0x4727fa){_0x511b76=_0x511b76-0x0;var _0x5424ff=_0x9a85[_0x511b76];return _0x5424ff;};'use strict';var multer=require('multer');var util=require(_0x59a8('0x0'));var path=require('path');var timeout=require(_0x59a8('0x1'));var express=require(_0x59a8('0x2'));var router=express[_0x59a8('0x3')]();var fs_extra=require(_0x59a8('0x4'));var auth=require(_0x59a8('0x5'));var interaction=require(_0x59a8('0x6'));var config=require(_0x59a8('0x7'));var controller=require(_0x59a8('0x8'));router[_0x59a8('0x9')]('/',auth[_0x59a8('0xa')](),controller[_0x59a8('0xb')]);router['get']('/now',controller[_0x59a8('0xc')]);router[_0x59a8('0x9')]('/:id',controller[_0x59a8('0xd')]);router['get'](_0x59a8('0xe'),controller[_0x59a8('0xf')]);router[_0x59a8('0x9')]('/:id/logo_login',controller['getLogoLogin']);router[_0x59a8('0x9')]('/:id/gdpr',controller[_0x59a8('0x10')]);router['get'](_0x59a8('0x11'),controller[_0x59a8('0x12')]);router[_0x59a8('0x9')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x22b29a,_0x2415f7,_0xdcff3c){_0xdcff3c(null,path[_0x59a8('0x13')](config[_0x59a8('0x14')],'server/files/images/logos/'));},'filename':function(_0xb53bbb,_0x4dc375,_0x1ded07){_0x1ded07(null,util[_0x59a8('0x15')](_0x59a8('0x16'),_0x59a8('0x17'),path['extname'](_0x4dc375[_0x59a8('0x18')])));}})});router['post'](_0x59a8('0xe'),upload[_0x59a8('0x19')](_0x59a8('0x1a')),controller[_0x59a8('0x1b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x345754,_0x53d647,_0x57d264){_0x57d264(null,path[_0x59a8('0x13')](config[_0x59a8('0x14')],'server/files/images/logos/'));},'filename':function(_0x300927,_0x2afd3a,_0x2c98e7){_0x2c98e7(null,util[_0x59a8('0x15')](_0x59a8('0x16'),_0x59a8('0x1c'),path[_0x59a8('0x1d')](_0x2afd3a[_0x59a8('0x18')])));}})});router[_0x59a8('0x1e')](_0x59a8('0x1f'),upload[_0x59a8('0x19')](_0x59a8('0x1a')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x59a8('0x20')]({'destination':function(_0x4da3d8,_0x1fb8a1,_0x5b9f33){_0x5b9f33(null,path[_0x59a8('0x13')](config[_0x59a8('0x14')],_0x59a8('0x21')));},'filename':function(_0x4c81c2,_0x2fff05,_0x2d9a4b){_0x2d9a4b(null,util[_0x59a8('0x15')](_0x59a8('0x16'),'preferred',path[_0x59a8('0x1d')](_0x2fff05[_0x59a8('0x18')])));}})});router[_0x59a8('0x1e')](_0x59a8('0x11'),upload[_0x59a8('0x19')]('file'),controller[_0x59a8('0x22')]);var upload=multer({'storage':multer[_0x59a8('0x20')]({'destination':function(_0x5c1337,_0x199a04,_0xf5b646){_0xf5b646(null,path[_0x59a8('0x13')](config[_0x59a8('0x14')],_0x59a8('0x21')));},'filename':function(_0x6aeeb8,_0x241837,_0x4f0dc4){_0x4f0dc4(null,util[_0x59a8('0x15')](_0x59a8('0x16'),_0x59a8('0x23'),path[_0x59a8('0x1d')](_0x241837[_0x59a8('0x18')])));}})});router['post']('/:id/favicon',upload['single'](_0x59a8('0x1a')),controller['addFavicon']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);module[_0x59a8('0x24')]=router; \ No newline at end of file +var _0x6a80=['getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','addLogo','join','logologin','single','addLogoLogin','addPreferred','addFavicon','put','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','show','/:id/logo'];(function(_0x14ee59,_0x236373){var _0x46dcd3=function(_0x163663){while(--_0x163663){_0x14ee59['push'](_0x14ee59['shift']());}};_0x46dcd3(++_0x236373);}(_0x6a80,0xed));var _0x06a8=function(_0x54f861,_0x5af47e){_0x54f861=_0x54f861-0x0;var _0x47de2f=_0x6a80[_0x54f861];return _0x47de2f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x06a8('0x0'));var timeout=require(_0x06a8('0x1'));var express=require(_0x06a8('0x2'));var router=express[_0x06a8('0x3')]();var fs_extra=require(_0x06a8('0x4'));var auth=require(_0x06a8('0x5'));var interaction=require(_0x06a8('0x6'));var config=require(_0x06a8('0x7'));var controller=require(_0x06a8('0x8'));router[_0x06a8('0x9')]('/',auth[_0x06a8('0xa')](),controller[_0x06a8('0xb')]);router[_0x06a8('0x9')]('/now',controller['getDate']);router['get'](_0x06a8('0xc'),controller[_0x06a8('0xd')]);router[_0x06a8('0x9')](_0x06a8('0xe'),controller[_0x06a8('0xf')]);router[_0x06a8('0x9')](_0x06a8('0x10'),controller[_0x06a8('0x11')]);router[_0x06a8('0x9')](_0x06a8('0x12'),controller[_0x06a8('0x13')]);router[_0x06a8('0x9')](_0x06a8('0x14'),controller[_0x06a8('0x15')]);router['get'](_0x06a8('0x16'),controller['getFavicon']);var upload=multer({'storage':multer[_0x06a8('0x17')]({'destination':function(_0x3c0010,_0x4d7a5e,_0x2dbc41){_0x2dbc41(null,path['join'](config[_0x06a8('0x18')],_0x06a8('0x19')));},'filename':function(_0x5870ae,_0x3d9be3,_0x361727){_0x361727(null,util[_0x06a8('0x1a')](_0x06a8('0x1b'),_0x06a8('0x1c'),path[_0x06a8('0x1d')](_0x3d9be3[_0x06a8('0x1e')])));}})});router[_0x06a8('0x1f')](_0x06a8('0xe'),upload['single'](_0x06a8('0x20')),controller[_0x06a8('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x454f4d,_0x500665,_0x22e47e){_0x22e47e(null,path[_0x06a8('0x22')](config[_0x06a8('0x18')],_0x06a8('0x19')));},'filename':function(_0x509880,_0x23f6bb,_0x14464c){_0x14464c(null,util[_0x06a8('0x1a')](_0x06a8('0x1b'),_0x06a8('0x23'),path['extname'](_0x23f6bb[_0x06a8('0x1e')])));}})});router[_0x06a8('0x1f')](_0x06a8('0x10'),upload[_0x06a8('0x24')](_0x06a8('0x20')),controller[_0x06a8('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xdbba93,_0xab944a,_0x55f328){_0x55f328(null,path['join'](config[_0x06a8('0x18')],'server/files/images/logos/'));},'filename':function(_0x45dd58,_0x4c55c9,_0x16b3ec){_0x16b3ec(null,util[_0x06a8('0x1a')](_0x06a8('0x1b'),'preferred',path[_0x06a8('0x1d')](_0x4c55c9[_0x06a8('0x1e')])));}})});router[_0x06a8('0x1f')](_0x06a8('0x14'),upload['single'](_0x06a8('0x20')),controller[_0x06a8('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x228f87,_0x332430,_0x2ec84a){_0x2ec84a(null,path[_0x06a8('0x22')](config[_0x06a8('0x18')],_0x06a8('0x19')));},'filename':function(_0x21636f,_0x300e3d,_0x12fe0e){_0x12fe0e(null,util['format']('%s%s','favicon',path[_0x06a8('0x1d')](_0x300e3d[_0x06a8('0x1e')])));}})});router[_0x06a8('0x1f')](_0x06a8('0x16'),upload[_0x06a8('0x24')](_0x06a8('0x20')),controller[_0x06a8('0x27')]);router[_0x06a8('0x28')](_0x06a8('0xc'),auth['isAuthenticated'](),controller['update']);module[_0x06a8('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index ecec0cb..63a7efe 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 _0x8b35=['INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8b35,0x17a));var _0x58b3=function(_0x5e083e,_0x1e25a7){_0x5e083e=_0x5e083e-0x0;var _0xa583ba=_0x8b35[_0x5e083e];return _0xa583ba;};'use strict';var Sequelize=require(_0x58b3('0x0'));module[_0x58b3('0x1')]={'min_internal':{'type':Sequelize[_0x58b3('0x2')](0xb),'unique':_0x58b3('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x58b3('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x58b3('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x58b3('0x4')],'defaultValue':_0x58b3('0x5')},'logo':{'type':Sequelize[_0x58b3('0x4')]},'defaultLogo':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x58b3('0x4')]},'turnaddr':{'type':Sequelize[_0x58b3('0x4')]},'turnusername':{'type':Sequelize[_0x58b3('0x4')]},'turnpassword':{'type':Sequelize[_0x58b3('0x4')]},'pageTitle':{'type':Sequelize[_0x58b3('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x58b3('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x58b3('0x7')},'enableEmailPreview':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x58b3('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x58b3('0x4')],'defaultValue':_0x58b3('0x8')},'chatTimeout':{'type':Sequelize[_0x58b3('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x58b3('0x4')]},'defaultPreferred':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x58b3('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x58b3('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x58b3('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x58b3('0x2')]},'transcribeRegion':{'type':Sequelize[_0x58b3('0x4')]},'sentiment':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x58b3('0x4')]},'language':{'type':Sequelize[_0x58b3('0x4')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x58b3('0x2')](0x2)[_0x58b3('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x58b3('0x2')](0x2)[_0x58b3('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x58b3('0x2')](0x2)[_0x58b3('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x58b3('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x58b3('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x58b3('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x58b3('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x58b3('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x58b3('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x58b3('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xc971=['UNSIGNED','sequelize','exports','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0xc971,0x17b));var _0x1c97=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xc971[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x1c97('0x0'));module[_0x1c97('0x1')]={'min_internal':{'type':Sequelize[_0x1c97('0x2')](0xb),'unique':_0x1c97('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x1c97('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1c97('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1c97('0x4')],'defaultValue':_0x1c97('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x1c97('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x1c97('0x4')]},'turnusername':{'type':Sequelize[_0x1c97('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x1c97('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1c97('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1c97('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1c97('0x4')],'defaultValue':_0x1c97('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1c97('0x4')]},'defaultPreferred':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x1c97('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x1c97('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1c97('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x1c97('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1c97('0x2')]},'sentimentRegion':{'type':Sequelize[_0x1c97('0x4')]},'language':{'type':Sequelize[_0x1c97('0x4')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x1c97('0x2')](0x2)[_0x1c97('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x1c97('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1c97('0x2')](0x2)[_0x1c97('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x1c97('0x2')](0x2)[_0x1c97('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x1c97('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x1c97('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1c97('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x1c97('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x1c97('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x1c97('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x1c97('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 7324452..672597e 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 _0x37f8=['error','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','stack','name','send','index','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','type','VIRTUAL','merge','options','Setting','includeAll','include','findAll','rows','show','params','length','body','find','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','Sequelize','ValidationError','upperFirst','download','server/files/images/logos','default_loginLogo.svg','default','custom','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','defaultFavicon','default_preferred.png','addFavicon','getFavicon','getDate','utcOffset','now','format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x16d8d9,_0x2be9a4){var _0x274705=function(_0x33ba82){while(--_0x33ba82){_0x16d8d9['push'](_0x16d8d9['shift']());}};_0x274705(++_0x2be9a4);}(_0x37f8,0xd2));var _0x837f=function(_0x3b7508,_0x49506a){_0x3b7508=_0x3b7508-0x0;var _0x349699=_0x37f8[_0x3b7508];return _0x349699;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x837f('0x0'));var zipdir=require(_0x837f('0x1'));var jsonpatch=require(_0x837f('0x2'));var rp=require(_0x837f('0x3'));var moment=require('moment');var BPromise=require(_0x837f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x837f('0x5'));var fs=require('fs');var fs_extra=require(_0x837f('0x6'));var _=require(_0x837f('0x7'));var squel=require(_0x837f('0x8'));var crypto=require(_0x837f('0x9'));var jsforce=require(_0x837f('0xa'));var deskjs=require(_0x837f('0xb'));var toCsv=require(_0x837f('0xc'));var querystring=require(_0x837f('0xd'));var Papa=require(_0x837f('0xe'));var Redis=require(_0x837f('0xf'));var authService=require(_0x837f('0x10'));var qs=require(_0x837f('0x11'));var as=require(_0x837f('0x12'));var hardwareService=require(_0x837f('0x13'));var logger=require('../../config/logger')(_0x837f('0x14'));var utils=require(_0x837f('0x15'));var config=require(_0x837f('0x16'));var licenseUtil=require(_0x837f('0x17'));var db=require(_0x837f('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x837f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3ccec4,_0x20be3c,_0x3e38ea,_0x2b3cd6){return new BPromise(function(_0x483267,_0x18d8aa){var _0xb5b3f4=_0x2b3cd6||client;return _0xb5b3f4[_0x837f('0x1a')](_0x3ccec4,_0x3e38ea)[_0x837f('0x1b')](function(_0x2e4257){logger[_0x837f('0x1c')]('Setting,\x20%s,\x20%s',_0x20be3c,_0x837f('0x1d'));logger[_0x837f('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x20be3c,_0x837f('0x1d'),JSON[_0x837f('0x1f')](_0x2e4257));if(_0x2e4257[_0x837f('0x20')]){if(_0x2e4257[_0x837f('0x20')]['code']===0x1f4){logger[_0x837f('0x20')](_0x837f('0x21'),_0x20be3c,_0x2e4257[_0x837f('0x20')][_0x837f('0x22')]);return _0x18d8aa(_0x2e4257[_0x837f('0x20')]['message']);}logger[_0x837f('0x20')](_0x837f('0x21'),_0x20be3c,_0x2e4257[_0x837f('0x20')][_0x837f('0x22')]);return _0x483267(_0x2e4257[_0x837f('0x20')]['message']);}else{logger[_0x837f('0x1c')](_0x837f('0x21'),_0x20be3c,_0x837f('0x1d'));_0x483267(_0x2e4257[_0x837f('0x23')][_0x837f('0x22')]);}})[_0x837f('0x24')](function(_0x41d102){logger[_0x837f('0x20')](_0x837f('0x21'),_0x20be3c,_0x41d102);_0x18d8aa(_0x41d102);});});}function respondWithStatusCode(_0x168455,_0x3fa18e){_0x3fa18e=_0x3fa18e||0xcc;return function(_0xfb4df0){if(_0xfb4df0){return _0x168455[_0x837f('0x25')](_0x3fa18e);}return _0x168455[_0x837f('0x26')](_0x3fa18e)[_0x837f('0x27')]();};}function respondWithResult(_0x11eb55,_0x43ca7d){_0x43ca7d=_0x43ca7d||0xc8;return function(_0x38da9f){if(_0x38da9f){return _0x11eb55[_0x837f('0x26')](_0x43ca7d)[_0x837f('0x28')](_0x38da9f);}};}function respondWithFilteredResult(_0x2c6a90,_0x246637){return function(_0x21f826){if(_0x21f826){var _0x4d2c23=typeof _0x246637[_0x837f('0x29')]===_0x837f('0x2a')&&typeof _0x246637[_0x837f('0x2b')]==='undefined';var _0x530f6d=_0x21f826[_0x837f('0x2c')];var _0x1ab2e4=_0x4d2c23?0x0:_0x246637[_0x837f('0x29')];var _0x4072a4=_0x4d2c23?_0x21f826[_0x837f('0x2c')]:_0x246637[_0x837f('0x29')]+_0x246637[_0x837f('0x2b')];var _0x507984;if(_0x4072a4>=_0x530f6d){_0x4072a4=_0x530f6d;_0x507984=0xc8;}else{_0x507984=0xce;}_0x2c6a90[_0x837f('0x26')](_0x507984);return _0x2c6a90[_0x837f('0x2d')](_0x837f('0x2e'),_0x1ab2e4+'-'+_0x4072a4+'/'+_0x530f6d)[_0x837f('0x28')](_0x21f826);}return null;};}function patchUpdates(_0x5d53c6){return function(_0x4e4528){try{jsonpatch['apply'](_0x4e4528,_0x5d53c6,!![]);}catch(_0x282ecb){return BPromise[_0x837f('0x2f')](_0x282ecb);}return _0x4e4528[_0x837f('0x30')]();};}function saveUpdates(_0x422498,_0x5e186e){return function(_0x223bf8){if(_0x223bf8){return _0x223bf8['update'](_0x422498)[_0x837f('0x1b')](function(_0x48f651){return _0x48f651;});}return null;};}function removeEntity(_0x5e98b5,_0x12bcec){return function(_0x252ea2){if(_0x252ea2){return _0x252ea2[_0x837f('0x31')]()[_0x837f('0x1b')](function(){_0x5e98b5[_0x837f('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56ddfc,_0xb66cab){return function(_0x4c6710){if(!_0x4c6710){_0x56ddfc[_0x837f('0x25')](0x194);}return _0x4c6710;};}function handleError(_0x22a721,_0x59cdc4){_0x59cdc4=_0x59cdc4||0x1f4;return function(_0x245342){logger[_0x837f('0x20')](_0x245342[_0x837f('0x32')]);if(_0x245342[_0x837f('0x33')]){delete _0x245342[_0x837f('0x33')];}_0x22a721['status'](_0x59cdc4)[_0x837f('0x34')](_0x245342);};}exports[_0x837f('0x35')]=function(_0x2a8c50,_0x1cab29){var _0x901cf={},_0x53215a={},_0x562b48={'count':0x0,'rows':[]};var _0x452daa=_['map'](db['Setting'][_0x837f('0x36')],function(_0x1c7352){return{'name':_0x1c7352['fieldName'],'type':_0x1c7352['type'][_0x837f('0x37')]};});_0x53215a[_0x837f('0x38')]=_[_0x837f('0x39')](_0x452daa,'name');_0x53215a[_0x837f('0x3a')]=_[_0x837f('0x3b')](_0x2a8c50[_0x837f('0x3a')]);_0x53215a[_0x837f('0x3c')]=_[_0x837f('0x3d')](_0x53215a['model'],_0x53215a['query']);_0x901cf[_0x837f('0x3e')]=_[_0x837f('0x3d')](_0x53215a[_0x837f('0x38')],qs['fields'](_0x2a8c50['query'][_0x837f('0x3f')]));_0x901cf[_0x837f('0x3e')]=_0x901cf[_0x837f('0x3e')]['length']?_0x901cf[_0x837f('0x3e')]:_0x53215a[_0x837f('0x38')];if(!_0x2a8c50['query']['hasOwnProperty']('nolimit')){_0x901cf[_0x837f('0x2b')]=qs[_0x837f('0x2b')](_0x2a8c50[_0x837f('0x3a')][_0x837f('0x2b')]);_0x901cf[_0x837f('0x29')]=qs[_0x837f('0x29')](_0x2a8c50[_0x837f('0x3a')][_0x837f('0x29')]);}_0x901cf[_0x837f('0x40')]=qs[_0x837f('0x41')](_0x2a8c50['query'][_0x837f('0x41')]);_0x901cf[_0x837f('0x42')]=qs['filters'](_[_0x837f('0x43')](_0x2a8c50[_0x837f('0x3a')],_0x53215a[_0x837f('0x3c')]),_0x452daa);if(_0x2a8c50[_0x837f('0x3a')][_0x837f('0x44')]){_0x901cf[_0x837f('0x42')]=_['merge'](_0x901cf[_0x837f('0x42')],{'$or':_[_0x837f('0x39')](_0x452daa,function(_0x28377a){if(_0x28377a[_0x837f('0x45')]!==_0x837f('0x46')){var _0x4530ac={};_0x4530ac[_0x28377a[_0x837f('0x33')]]={'$like':'%'+_0x2a8c50[_0x837f('0x3a')]['filter']+'%'};return _0x4530ac;}})});}_0x901cf=_[_0x837f('0x47')]({},_0x901cf,_0x2a8c50[_0x837f('0x48')]);var _0x4f9dcf={'where':_0x901cf[_0x837f('0x42')]};return db[_0x837f('0x49')]['count'](_0x4f9dcf)[_0x837f('0x1b')](function(_0x259a70){_0x562b48[_0x837f('0x2c')]=_0x259a70;if(_0x2a8c50[_0x837f('0x3a')][_0x837f('0x4a')]){_0x901cf[_0x837f('0x4b')]=[{'all':!![]}];}return db['Setting'][_0x837f('0x4c')](_0x901cf);})['then'](function(_0x1146ef){_0x562b48[_0x837f('0x4d')]=_0x1146ef;return _0x562b48;})[_0x837f('0x1b')](respondWithFilteredResult(_0x1cab29,_0x901cf))[_0x837f('0x24')](handleError(_0x1cab29,null));};exports[_0x837f('0x4e')]=function(_0x1e82aa,_0x50bd1b){var _0x554f74={'raw':![],'where':{'id':_0x1e82aa[_0x837f('0x4f')]['id']}},_0x5edfcc={};_0x5edfcc[_0x837f('0x38')]=_['keys'](db[_0x837f('0x49')]['rawAttributes']);_0x5edfcc[_0x837f('0x3a')]=_[_0x837f('0x3b')](_0x1e82aa[_0x837f('0x3a')]);_0x5edfcc[_0x837f('0x3c')]=_[_0x837f('0x3d')](_0x5edfcc[_0x837f('0x38')],_0x5edfcc['query']);_0x554f74[_0x837f('0x3e')]=_['intersection'](_0x5edfcc[_0x837f('0x38')],qs[_0x837f('0x3f')](_0x1e82aa[_0x837f('0x3a')]['fields']));_0x554f74[_0x837f('0x3e')]=_0x554f74[_0x837f('0x3e')][_0x837f('0x50')]?_0x554f74[_0x837f('0x3e')]:_0x5edfcc[_0x837f('0x38')];if(_0x1e82aa[_0x837f('0x3a')]['includeAll']){_0x554f74[_0x837f('0x4b')]=[{'all':!![]}];}_0x554f74=_[_0x837f('0x47')]({},_0x554f74,_0x1e82aa[_0x837f('0x48')]);return db[_0x837f('0x49')]['find'](_0x554f74)[_0x837f('0x1b')](handleEntityNotFound(_0x50bd1b,null))['then'](respondWithResult(_0x50bd1b,null))[_0x837f('0x24')](handleError(_0x50bd1b,null));};exports['update']=function(_0x23d555,_0x4655fb){if(_0x23d555[_0x837f('0x51')]['id']){delete _0x23d555[_0x837f('0x51')]['id'];}return db[_0x837f('0x49')][_0x837f('0x52')]({'where':{'id':_0x23d555[_0x837f('0x4f')]['id']}})[_0x837f('0x1b')](handleEntityNotFound(_0x4655fb,null))[_0x837f('0x1b')](saveUpdates(_0x23d555[_0x837f('0x51')],null))[_0x837f('0x1b')](respondWithResult(_0x4655fb,null))[_0x837f('0x24')](handleError(_0x4655fb,null));};exports['addLogo']=function(_0x4ade1b,_0x16cb00,_0x53d46d){if(_0x4ade1b[_0x837f('0x53')]&&_0x4ade1b[_0x837f('0x53')][_0x837f('0x54')]){_0x4ade1b[_0x837f('0x51')][_0x837f('0x55')]=_0x4ade1b[_0x837f('0x53')][_0x837f('0x54')];}return db[_0x837f('0x49')][_0x837f('0x52')]({'where':{'id':_0x4ade1b[_0x837f('0x4f')]['id']}})[_0x837f('0x1b')](handleEntityNotFound(_0x16cb00,null))[_0x837f('0x1b')](saveUpdates(_0x4ade1b[_0x837f('0x51')],null))['then'](respondWithResult(_0x16cb00,null))[_0x837f('0x24')](handleError(_0x16cb00,null));};exports[_0x837f('0x56')]=function(_0xc595c9,_0x5acfab,_0x6db423){if(_0xc595c9[_0x837f('0x53')]&&_0xc595c9[_0x837f('0x53')][_0x837f('0x54')]){_0xc595c9[_0x837f('0x51')][_0x837f('0x57')]=_0xc595c9[_0x837f('0x53')]['filename'];}return db[_0x837f('0x49')][_0x837f('0x52')]({'where':{'id':_0xc595c9[_0x837f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5acfab,null))[_0x837f('0x1b')](saveUpdates(_0xc595c9[_0x837f('0x51')],null))[_0x837f('0x1b')](respondWithResult(_0x5acfab,null))[_0x837f('0x24')](handleError(_0x5acfab,null));};var utilLicense=require('../../config/license/util');exports[_0x837f('0x58')]=function(_0x19a371,_0x37621e,_0x5df561){var _0x53c966='server/files/images/logos';var _0x323344={'custom':![]};return utilLicense[_0x837f('0x59')]()[_0x837f('0x1b')](function(_0x19cbd4){if(_0x19cbd4){_0x323344=_0x19cbd4;}return db[_0x837f('0x49')][_0x837f('0x52')]({'where':{'id':_0x19a371[_0x837f('0x4f')]['id']},'attributes':[_0x837f('0x55'),_0x837f('0x57'),_0x837f('0x5a'),_0x837f('0x5b'),_0x837f('0x5c'),_0x837f('0x5d'),_0x837f('0x5e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x37621e,null))['then'](function(_0x128011){if(_0x128011){var _0x3b1c64=_0x128011[_0x837f('0x55')]&&fs[_0x837f('0x5f')](path[_0x837f('0x60')](config[_0x837f('0x61')],_0x53c966,_['toLower'](_0x128011[_0x837f('0x55')])))?path[_0x837f('0x60')](config['root'],_0x53c966,_[_0x837f('0x62')](_0x128011[_0x837f('0x55')])):path[_0x837f('0x60')](config['root'],_0x53c966,_[_0x837f('0x62')](_0x837f('0x63')));var _0x3016eb='default'+_['upperFirst'](_0x837f('0x55'));if(_0x128011[_0x3016eb]||!_0x323344['custom']){_0x3b1c64=path[_0x837f('0x60')](config[_0x837f('0x61')],_0x53c966,_[_0x837f('0x62')](_0x837f('0x63')));}if(!fs['existsSync'](_0x3b1c64)){throw new db[(_0x837f('0x64'))][(_0x837f('0x65'))](_[_0x837f('0x66')]('logo')+'\x20not\x20found');}return _0x37621e[_0x837f('0x67')](_0x3b1c64);}})[_0x837f('0x24')](handleError(_0x37621e,null));};var utilLicense=require(_0x837f('0x17'));exports['getLogoLogin']=function(_0x5c9d05,_0x5a78d3,_0x42071d){var _0x306ae2=_0x837f('0x68');var _0xf7a946={'custom':![]};return utilLicense['getLicense']()[_0x837f('0x1b')](function(_0x164ed4){if(_0x164ed4){_0xf7a946=_0x164ed4;}return db['Setting'][_0x837f('0x52')]({'where':{'id':_0x5c9d05['params']['id']},'attributes':[_0x837f('0x55'),_0x837f('0x57'),_0x837f('0x5a'),_0x837f('0x5b'),_0x837f('0x5c'),'defaultLoginLogo',_0x837f('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x837f('0x1b')](handleEntityNotFound(_0x5a78d3,null))[_0x837f('0x1b')](function(_0x882897){if(_0x882897){var _0x166b55=_0x882897['loginLogo']&&fs[_0x837f('0x5f')](path[_0x837f('0x60')](config['root'],_0x306ae2,_[_0x837f('0x62')](_0x882897['loginLogo'])))?path[_0x837f('0x60')](config[_0x837f('0x61')],_0x306ae2,_['toLower'](_0x882897[_0x837f('0x57')])):path[_0x837f('0x60')](config[_0x837f('0x61')],_0x306ae2,_[_0x837f('0x62')](_0x837f('0x69')));var _0x24e5f6=_0x837f('0x6a')+_[_0x837f('0x66')]('loginLogo');if(_0x882897[_0x24e5f6]||!_0xf7a946[_0x837f('0x6b')]){_0x166b55=path[_0x837f('0x60')](config[_0x837f('0x61')],_0x306ae2,_['toLower'](_0x837f('0x69')));}if(!fs[_0x837f('0x5f')](_0x166b55)){throw new db[(_0x837f('0x64'))]['ValidationError'](_[_0x837f('0x66')](_0x837f('0x57'))+_0x837f('0x6c'));}return _0x5a78d3['download'](_0x166b55);}})[_0x837f('0x24')](handleError(_0x5a78d3,null));};exports[_0x837f('0x6d')]=function(_0x2bf07f,_0x3a341a){return db['Setting'][_0x837f('0x52')]({'where':{'id':_0x2bf07f[_0x837f('0x4f')]['id']},'attributes':[_0x837f('0x6e')]})[_0x837f('0x1b')](respondWithResult(_0x3a341a,null))[_0x837f('0x24')](handleError(_0x3a341a,null));};exports[_0x837f('0x6f')]=function(_0x3e20f5,_0xef98af,_0x31f7c0){if(_0x3e20f5[_0x837f('0x53')]&&_0x3e20f5[_0x837f('0x53')][_0x837f('0x54')]){_0x3e20f5['body'][_0x837f('0x5a')]=_0x3e20f5[_0x837f('0x53')][_0x837f('0x54')];}return db[_0x837f('0x49')][_0x837f('0x52')]({'where':{'id':_0x3e20f5[_0x837f('0x4f')]['id']}})[_0x837f('0x1b')](handleEntityNotFound(_0xef98af,null))[_0x837f('0x1b')](saveUpdates(_0x3e20f5['body'],null))['then'](respondWithResult(_0xef98af,null))[_0x837f('0x24')](handleError(_0xef98af,null));};var utilLicense=require(_0x837f('0x17'));exports[_0x837f('0x70')]=function(_0xe7a459,_0x166a50,_0x471633){var _0x552778=_0x837f('0x68');var _0x2cc02a={'custom':![]};return utilLicense[_0x837f('0x59')]()[_0x837f('0x1b')](function(_0x31984f){if(_0x31984f){_0x2cc02a=_0x31984f;}return db[_0x837f('0x49')]['find']({'where':{'id':_0xe7a459[_0x837f('0x4f')]['id']},'attributes':[_0x837f('0x55'),_0x837f('0x57'),'preferred',_0x837f('0x5b'),'defaultLogo',_0x837f('0x5d'),'defaultPreferred',_0x837f('0x71')],'raw':!![]});})[_0x837f('0x1b')](handleEntityNotFound(_0x166a50,null))['then'](function(_0x48ddbf){if(_0x48ddbf){var _0x3289b7=_0x48ddbf[_0x837f('0x5a')]&&fs['existsSync'](path['join'](config[_0x837f('0x61')],_0x552778,_[_0x837f('0x62')](_0x48ddbf[_0x837f('0x5a')])))?path[_0x837f('0x60')](config[_0x837f('0x61')],_0x552778,_[_0x837f('0x62')](_0x48ddbf[_0x837f('0x5a')])):path[_0x837f('0x60')](config[_0x837f('0x61')],_0x552778,_[_0x837f('0x62')](_0x837f('0x72')));var _0x66c876='default'+_[_0x837f('0x66')](_0x837f('0x5a'));if(_0x48ddbf[_0x66c876]||!_0x2cc02a[_0x837f('0x6b')]||!_0x2cc02a[_0x837f('0x5a')]){_0x3289b7=path[_0x837f('0x60')](config[_0x837f('0x61')],_0x552778,_[_0x837f('0x62')]('default_preferred.png'));}if(!fs[_0x837f('0x5f')](_0x3289b7)){throw new db[(_0x837f('0x64'))][(_0x837f('0x65'))](_[_0x837f('0x66')]('preferred')+_0x837f('0x6c'));}return _0x166a50[_0x837f('0x67')](_0x3289b7);}})['catch'](handleError(_0x166a50,null));};exports[_0x837f('0x73')]=function(_0x41fc30,_0xef053c,_0x210ab8){if(_0x41fc30[_0x837f('0x53')]&&_0x41fc30[_0x837f('0x53')][_0x837f('0x54')]){_0x41fc30[_0x837f('0x51')]['favicon']=_0x41fc30[_0x837f('0x53')][_0x837f('0x54')];}return db[_0x837f('0x49')]['find']({'where':{'id':_0x41fc30[_0x837f('0x4f')]['id']}})[_0x837f('0x1b')](handleEntityNotFound(_0xef053c,null))[_0x837f('0x1b')](saveUpdates(_0x41fc30[_0x837f('0x51')],null))[_0x837f('0x1b')](respondWithResult(_0xef053c,null))['catch'](handleError(_0xef053c,null));};var utilLicense=require(_0x837f('0x17'));exports[_0x837f('0x74')]=function(_0x1000c3,_0xa9b002,_0x38e255){var _0x26ea4a='server/files/images/logos';var _0x4e4fb6={'custom':![]};return utilLicense[_0x837f('0x59')]()[_0x837f('0x1b')](function(_0xfc0905){if(_0xfc0905){_0x4e4fb6=_0xfc0905;}return db[_0x837f('0x49')]['find']({'where':{'id':_0x1000c3[_0x837f('0x4f')]['id']},'attributes':[_0x837f('0x55'),'loginLogo',_0x837f('0x5a'),_0x837f('0x5b'),'defaultLogo',_0x837f('0x5d'),'defaultPreferred',_0x837f('0x71')],'raw':!![]});})[_0x837f('0x1b')](handleEntityNotFound(_0xa9b002,null))['then'](function(_0x141aeb){if(_0x141aeb){var _0x585ee8=_0x141aeb[_0x837f('0x5b')]&&fs[_0x837f('0x5f')](path[_0x837f('0x60')](config['root'],_0x26ea4a,_[_0x837f('0x62')](_0x141aeb[_0x837f('0x5b')])))?path[_0x837f('0x60')](config[_0x837f('0x61')],_0x26ea4a,_[_0x837f('0x62')](_0x141aeb[_0x837f('0x5b')])):path[_0x837f('0x60')](config[_0x837f('0x61')],_0x26ea4a,_['toLower']('default_favicon.ico'));var _0x1f6a00=_0x837f('0x6a')+_[_0x837f('0x66')](_0x837f('0x5b'));if(_0x141aeb[_0x1f6a00]||!_0x4e4fb6['custom']){_0x585ee8=path[_0x837f('0x60')](config['root'],_0x26ea4a,_[_0x837f('0x62')]('default_favicon.ico'));}if(!fs['existsSync'](_0x585ee8)){throw new db[(_0x837f('0x64'))][(_0x837f('0x65'))](_[_0x837f('0x66')](_0x837f('0x5b'))+_0x837f('0x6c'));}return _0xa9b002['download'](_0x585ee8);}})[_0x837f('0x24')](handleError(_0xa9b002,null));};exports[_0x837f('0x75')]=function(_0xc92a78,_0x2ff476){var _0x52d3f8={'offset':moment()[_0x837f('0x76')]()};_0x52d3f8[_0x837f('0x77')]=moment()['utcOffset'](_0x52d3f8[_0x837f('0x29')])[_0x837f('0x78')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x2ff476['status'](0xc8)['send'](_0x52d3f8);}; \ No newline at end of file +var _0x37f8=['error','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','stack','name','send','index','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','type','VIRTUAL','merge','options','Setting','includeAll','include','findAll','rows','show','params','length','body','find','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','Sequelize','ValidationError','upperFirst','download','server/files/images/logos','default_loginLogo.svg','default','custom','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','defaultFavicon','default_preferred.png','addFavicon','getFavicon','getDate','utcOffset','now','format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x1fa98a,_0x21b0da){var _0x35133e=function(_0x300561){while(--_0x300561){_0x1fa98a['push'](_0x1fa98a['shift']());}};_0x35133e(++_0x21b0da);}(_0x37f8,0xd2));var _0x837f=function(_0x207a40,_0x3e2f48){_0x207a40=_0x207a40-0x0;var _0x4d73a4=_0x37f8[_0x207a40];return _0x4d73a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x837f('0x0'));var zipdir=require(_0x837f('0x1'));var jsonpatch=require(_0x837f('0x2'));var rp=require(_0x837f('0x3'));var moment=require('moment');var BPromise=require(_0x837f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x837f('0x5'));var fs=require('fs');var fs_extra=require(_0x837f('0x6'));var _=require(_0x837f('0x7'));var squel=require(_0x837f('0x8'));var crypto=require(_0x837f('0x9'));var jsforce=require(_0x837f('0xa'));var deskjs=require(_0x837f('0xb'));var toCsv=require(_0x837f('0xc'));var querystring=require(_0x837f('0xd'));var Papa=require(_0x837f('0xe'));var Redis=require(_0x837f('0xf'));var authService=require(_0x837f('0x10'));var qs=require(_0x837f('0x11'));var as=require(_0x837f('0x12'));var hardwareService=require(_0x837f('0x13'));var logger=require('../../config/logger')(_0x837f('0x14'));var utils=require(_0x837f('0x15'));var config=require(_0x837f('0x16'));var licenseUtil=require(_0x837f('0x17'));var db=require(_0x837f('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x837f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3ccec4,_0x20be3c,_0x3e38ea,_0x2b3cd6){return new BPromise(function(_0x483267,_0x18d8aa){var _0xb5b3f4=_0x2b3cd6||client;return _0xb5b3f4[_0x837f('0x1a')](_0x3ccec4,_0x3e38ea)[_0x837f('0x1b')](function(_0x2e4257){logger[_0x837f('0x1c')]('Setting,\x20%s,\x20%s',_0x20be3c,_0x837f('0x1d'));logger[_0x837f('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x20be3c,_0x837f('0x1d'),JSON[_0x837f('0x1f')](_0x2e4257));if(_0x2e4257[_0x837f('0x20')]){if(_0x2e4257[_0x837f('0x20')]['code']===0x1f4){logger[_0x837f('0x20')](_0x837f('0x21'),_0x20be3c,_0x2e4257[_0x837f('0x20')][_0x837f('0x22')]);return _0x18d8aa(_0x2e4257[_0x837f('0x20')]['message']);}logger[_0x837f('0x20')](_0x837f('0x21'),_0x20be3c,_0x2e4257[_0x837f('0x20')][_0x837f('0x22')]);return _0x483267(_0x2e4257[_0x837f('0x20')]['message']);}else{logger[_0x837f('0x1c')](_0x837f('0x21'),_0x20be3c,_0x837f('0x1d'));_0x483267(_0x2e4257[_0x837f('0x23')][_0x837f('0x22')]);}})[_0x837f('0x24')](function(_0x41d102){logger[_0x837f('0x20')](_0x837f('0x21'),_0x20be3c,_0x41d102);_0x18d8aa(_0x41d102);});});}function respondWithStatusCode(_0x168455,_0x3fa18e){_0x3fa18e=_0x3fa18e||0xcc;return function(_0xfb4df0){if(_0xfb4df0){return _0x168455[_0x837f('0x25')](_0x3fa18e);}return _0x168455[_0x837f('0x26')](_0x3fa18e)[_0x837f('0x27')]();};}function respondWithResult(_0x11eb55,_0x43ca7d){_0x43ca7d=_0x43ca7d||0xc8;return function(_0x38da9f){if(_0x38da9f){return _0x11eb55[_0x837f('0x26')](_0x43ca7d)[_0x837f('0x28')](_0x38da9f);}};}function respondWithFilteredResult(_0x2c6a90,_0x246637){return function(_0x21f826){if(_0x21f826){var _0x4d2c23=typeof _0x246637[_0x837f('0x29')]===_0x837f('0x2a')&&typeof _0x246637[_0x837f('0x2b')]==='undefined';var _0x530f6d=_0x21f826[_0x837f('0x2c')];var _0x1ab2e4=_0x4d2c23?0x0:_0x246637[_0x837f('0x29')];var _0x4072a4=_0x4d2c23?_0x21f826[_0x837f('0x2c')]:_0x246637[_0x837f('0x29')]+_0x246637[_0x837f('0x2b')];var _0x507984;if(_0x4072a4>=_0x530f6d){_0x4072a4=_0x530f6d;_0x507984=0xc8;}else{_0x507984=0xce;}_0x2c6a90[_0x837f('0x26')](_0x507984);return _0x2c6a90[_0x837f('0x2d')](_0x837f('0x2e'),_0x1ab2e4+'-'+_0x4072a4+'/'+_0x530f6d)[_0x837f('0x28')](_0x21f826);}return null;};}function patchUpdates(_0x5d53c6){return function(_0x4e4528){try{jsonpatch['apply'](_0x4e4528,_0x5d53c6,!![]);}catch(_0x282ecb){return BPromise[_0x837f('0x2f')](_0x282ecb);}return _0x4e4528[_0x837f('0x30')]();};}function saveUpdates(_0x422498,_0x5e186e){return function(_0x223bf8){if(_0x223bf8){return _0x223bf8['update'](_0x422498)[_0x837f('0x1b')](function(_0x48f651){return _0x48f651;});}return null;};}function removeEntity(_0x5e98b5,_0x12bcec){return function(_0x252ea2){if(_0x252ea2){return _0x252ea2[_0x837f('0x31')]()[_0x837f('0x1b')](function(){_0x5e98b5[_0x837f('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56ddfc,_0xb66cab){return function(_0x4c6710){if(!_0x4c6710){_0x56ddfc[_0x837f('0x25')](0x194);}return _0x4c6710;};}function handleError(_0x22a721,_0x59cdc4){_0x59cdc4=_0x59cdc4||0x1f4;return function(_0x245342){logger[_0x837f('0x20')](_0x245342[_0x837f('0x32')]);if(_0x245342[_0x837f('0x33')]){delete _0x245342[_0x837f('0x33')];}_0x22a721['status'](_0x59cdc4)[_0x837f('0x34')](_0x245342);};}exports[_0x837f('0x35')]=function(_0x2a8c50,_0x1cab29){var _0x901cf={},_0x53215a={},_0x562b48={'count':0x0,'rows':[]};var _0x452daa=_['map'](db['Setting'][_0x837f('0x36')],function(_0x1c7352){return{'name':_0x1c7352['fieldName'],'type':_0x1c7352['type'][_0x837f('0x37')]};});_0x53215a[_0x837f('0x38')]=_[_0x837f('0x39')](_0x452daa,'name');_0x53215a[_0x837f('0x3a')]=_[_0x837f('0x3b')](_0x2a8c50[_0x837f('0x3a')]);_0x53215a[_0x837f('0x3c')]=_[_0x837f('0x3d')](_0x53215a['model'],_0x53215a['query']);_0x901cf[_0x837f('0x3e')]=_[_0x837f('0x3d')](_0x53215a[_0x837f('0x38')],qs['fields'](_0x2a8c50['query'][_0x837f('0x3f')]));_0x901cf[_0x837f('0x3e')]=_0x901cf[_0x837f('0x3e')]['length']?_0x901cf[_0x837f('0x3e')]:_0x53215a[_0x837f('0x38')];if(!_0x2a8c50['query']['hasOwnProperty']('nolimit')){_0x901cf[_0x837f('0x2b')]=qs[_0x837f('0x2b')](_0x2a8c50[_0x837f('0x3a')][_0x837f('0x2b')]);_0x901cf[_0x837f('0x29')]=qs[_0x837f('0x29')](_0x2a8c50[_0x837f('0x3a')][_0x837f('0x29')]);}_0x901cf[_0x837f('0x40')]=qs[_0x837f('0x41')](_0x2a8c50['query'][_0x837f('0x41')]);_0x901cf[_0x837f('0x42')]=qs['filters'](_[_0x837f('0x43')](_0x2a8c50[_0x837f('0x3a')],_0x53215a[_0x837f('0x3c')]),_0x452daa);if(_0x2a8c50[_0x837f('0x3a')][_0x837f('0x44')]){_0x901cf[_0x837f('0x42')]=_['merge'](_0x901cf[_0x837f('0x42')],{'$or':_[_0x837f('0x39')](_0x452daa,function(_0x28377a){if(_0x28377a[_0x837f('0x45')]!==_0x837f('0x46')){var _0x4530ac={};_0x4530ac[_0x28377a[_0x837f('0x33')]]={'$like':'%'+_0x2a8c50[_0x837f('0x3a')]['filter']+'%'};return _0x4530ac;}})});}_0x901cf=_[_0x837f('0x47')]({},_0x901cf,_0x2a8c50[_0x837f('0x48')]);var _0x4f9dcf={'where':_0x901cf[_0x837f('0x42')]};return db[_0x837f('0x49')]['count'](_0x4f9dcf)[_0x837f('0x1b')](function(_0x259a70){_0x562b48[_0x837f('0x2c')]=_0x259a70;if(_0x2a8c50[_0x837f('0x3a')][_0x837f('0x4a')]){_0x901cf[_0x837f('0x4b')]=[{'all':!![]}];}return db['Setting'][_0x837f('0x4c')](_0x901cf);})['then'](function(_0x1146ef){_0x562b48[_0x837f('0x4d')]=_0x1146ef;return _0x562b48;})[_0x837f('0x1b')](respondWithFilteredResult(_0x1cab29,_0x901cf))[_0x837f('0x24')](handleError(_0x1cab29,null));};exports[_0x837f('0x4e')]=function(_0x1e82aa,_0x50bd1b){var _0x554f74={'raw':![],'where':{'id':_0x1e82aa[_0x837f('0x4f')]['id']}},_0x5edfcc={};_0x5edfcc[_0x837f('0x38')]=_['keys'](db[_0x837f('0x49')]['rawAttributes']);_0x5edfcc[_0x837f('0x3a')]=_[_0x837f('0x3b')](_0x1e82aa[_0x837f('0x3a')]);_0x5edfcc[_0x837f('0x3c')]=_[_0x837f('0x3d')](_0x5edfcc[_0x837f('0x38')],_0x5edfcc['query']);_0x554f74[_0x837f('0x3e')]=_['intersection'](_0x5edfcc[_0x837f('0x38')],qs[_0x837f('0x3f')](_0x1e82aa[_0x837f('0x3a')]['fields']));_0x554f74[_0x837f('0x3e')]=_0x554f74[_0x837f('0x3e')][_0x837f('0x50')]?_0x554f74[_0x837f('0x3e')]:_0x5edfcc[_0x837f('0x38')];if(_0x1e82aa[_0x837f('0x3a')]['includeAll']){_0x554f74[_0x837f('0x4b')]=[{'all':!![]}];}_0x554f74=_[_0x837f('0x47')]({},_0x554f74,_0x1e82aa[_0x837f('0x48')]);return db[_0x837f('0x49')]['find'](_0x554f74)[_0x837f('0x1b')](handleEntityNotFound(_0x50bd1b,null))['then'](respondWithResult(_0x50bd1b,null))[_0x837f('0x24')](handleError(_0x50bd1b,null));};exports['update']=function(_0x23d555,_0x4655fb){if(_0x23d555[_0x837f('0x51')]['id']){delete _0x23d555[_0x837f('0x51')]['id'];}return db[_0x837f('0x49')][_0x837f('0x52')]({'where':{'id':_0x23d555[_0x837f('0x4f')]['id']}})[_0x837f('0x1b')](handleEntityNotFound(_0x4655fb,null))[_0x837f('0x1b')](saveUpdates(_0x23d555[_0x837f('0x51')],null))[_0x837f('0x1b')](respondWithResult(_0x4655fb,null))[_0x837f('0x24')](handleError(_0x4655fb,null));};exports['addLogo']=function(_0x4ade1b,_0x16cb00,_0x53d46d){if(_0x4ade1b[_0x837f('0x53')]&&_0x4ade1b[_0x837f('0x53')][_0x837f('0x54')]){_0x4ade1b[_0x837f('0x51')][_0x837f('0x55')]=_0x4ade1b[_0x837f('0x53')][_0x837f('0x54')];}return db[_0x837f('0x49')][_0x837f('0x52')]({'where':{'id':_0x4ade1b[_0x837f('0x4f')]['id']}})[_0x837f('0x1b')](handleEntityNotFound(_0x16cb00,null))[_0x837f('0x1b')](saveUpdates(_0x4ade1b[_0x837f('0x51')],null))['then'](respondWithResult(_0x16cb00,null))[_0x837f('0x24')](handleError(_0x16cb00,null));};exports[_0x837f('0x56')]=function(_0xc595c9,_0x5acfab,_0x6db423){if(_0xc595c9[_0x837f('0x53')]&&_0xc595c9[_0x837f('0x53')][_0x837f('0x54')]){_0xc595c9[_0x837f('0x51')][_0x837f('0x57')]=_0xc595c9[_0x837f('0x53')]['filename'];}return db[_0x837f('0x49')][_0x837f('0x52')]({'where':{'id':_0xc595c9[_0x837f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5acfab,null))[_0x837f('0x1b')](saveUpdates(_0xc595c9[_0x837f('0x51')],null))[_0x837f('0x1b')](respondWithResult(_0x5acfab,null))[_0x837f('0x24')](handleError(_0x5acfab,null));};var utilLicense=require('../../config/license/util');exports[_0x837f('0x58')]=function(_0x19a371,_0x37621e,_0x5df561){var _0x53c966='server/files/images/logos';var _0x323344={'custom':![]};return utilLicense[_0x837f('0x59')]()[_0x837f('0x1b')](function(_0x19cbd4){if(_0x19cbd4){_0x323344=_0x19cbd4;}return db[_0x837f('0x49')][_0x837f('0x52')]({'where':{'id':_0x19a371[_0x837f('0x4f')]['id']},'attributes':[_0x837f('0x55'),_0x837f('0x57'),_0x837f('0x5a'),_0x837f('0x5b'),_0x837f('0x5c'),_0x837f('0x5d'),_0x837f('0x5e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x37621e,null))['then'](function(_0x128011){if(_0x128011){var _0x3b1c64=_0x128011[_0x837f('0x55')]&&fs[_0x837f('0x5f')](path[_0x837f('0x60')](config[_0x837f('0x61')],_0x53c966,_['toLower'](_0x128011[_0x837f('0x55')])))?path[_0x837f('0x60')](config['root'],_0x53c966,_[_0x837f('0x62')](_0x128011[_0x837f('0x55')])):path[_0x837f('0x60')](config['root'],_0x53c966,_[_0x837f('0x62')](_0x837f('0x63')));var _0x3016eb='default'+_['upperFirst'](_0x837f('0x55'));if(_0x128011[_0x3016eb]||!_0x323344['custom']){_0x3b1c64=path[_0x837f('0x60')](config[_0x837f('0x61')],_0x53c966,_[_0x837f('0x62')](_0x837f('0x63')));}if(!fs['existsSync'](_0x3b1c64)){throw new db[(_0x837f('0x64'))][(_0x837f('0x65'))](_[_0x837f('0x66')]('logo')+'\x20not\x20found');}return _0x37621e[_0x837f('0x67')](_0x3b1c64);}})[_0x837f('0x24')](handleError(_0x37621e,null));};var utilLicense=require(_0x837f('0x17'));exports['getLogoLogin']=function(_0x5c9d05,_0x5a78d3,_0x42071d){var _0x306ae2=_0x837f('0x68');var _0xf7a946={'custom':![]};return utilLicense['getLicense']()[_0x837f('0x1b')](function(_0x164ed4){if(_0x164ed4){_0xf7a946=_0x164ed4;}return db['Setting'][_0x837f('0x52')]({'where':{'id':_0x5c9d05['params']['id']},'attributes':[_0x837f('0x55'),_0x837f('0x57'),_0x837f('0x5a'),_0x837f('0x5b'),_0x837f('0x5c'),'defaultLoginLogo',_0x837f('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x837f('0x1b')](handleEntityNotFound(_0x5a78d3,null))[_0x837f('0x1b')](function(_0x882897){if(_0x882897){var _0x166b55=_0x882897['loginLogo']&&fs[_0x837f('0x5f')](path[_0x837f('0x60')](config['root'],_0x306ae2,_[_0x837f('0x62')](_0x882897['loginLogo'])))?path[_0x837f('0x60')](config[_0x837f('0x61')],_0x306ae2,_['toLower'](_0x882897[_0x837f('0x57')])):path[_0x837f('0x60')](config[_0x837f('0x61')],_0x306ae2,_[_0x837f('0x62')](_0x837f('0x69')));var _0x24e5f6=_0x837f('0x6a')+_[_0x837f('0x66')]('loginLogo');if(_0x882897[_0x24e5f6]||!_0xf7a946[_0x837f('0x6b')]){_0x166b55=path[_0x837f('0x60')](config[_0x837f('0x61')],_0x306ae2,_['toLower'](_0x837f('0x69')));}if(!fs[_0x837f('0x5f')](_0x166b55)){throw new db[(_0x837f('0x64'))]['ValidationError'](_[_0x837f('0x66')](_0x837f('0x57'))+_0x837f('0x6c'));}return _0x5a78d3['download'](_0x166b55);}})[_0x837f('0x24')](handleError(_0x5a78d3,null));};exports[_0x837f('0x6d')]=function(_0x2bf07f,_0x3a341a){return db['Setting'][_0x837f('0x52')]({'where':{'id':_0x2bf07f[_0x837f('0x4f')]['id']},'attributes':[_0x837f('0x6e')]})[_0x837f('0x1b')](respondWithResult(_0x3a341a,null))[_0x837f('0x24')](handleError(_0x3a341a,null));};exports[_0x837f('0x6f')]=function(_0x3e20f5,_0xef98af,_0x31f7c0){if(_0x3e20f5[_0x837f('0x53')]&&_0x3e20f5[_0x837f('0x53')][_0x837f('0x54')]){_0x3e20f5['body'][_0x837f('0x5a')]=_0x3e20f5[_0x837f('0x53')][_0x837f('0x54')];}return db[_0x837f('0x49')][_0x837f('0x52')]({'where':{'id':_0x3e20f5[_0x837f('0x4f')]['id']}})[_0x837f('0x1b')](handleEntityNotFound(_0xef98af,null))[_0x837f('0x1b')](saveUpdates(_0x3e20f5['body'],null))['then'](respondWithResult(_0xef98af,null))[_0x837f('0x24')](handleError(_0xef98af,null));};var utilLicense=require(_0x837f('0x17'));exports[_0x837f('0x70')]=function(_0xe7a459,_0x166a50,_0x471633){var _0x552778=_0x837f('0x68');var _0x2cc02a={'custom':![]};return utilLicense[_0x837f('0x59')]()[_0x837f('0x1b')](function(_0x31984f){if(_0x31984f){_0x2cc02a=_0x31984f;}return db[_0x837f('0x49')]['find']({'where':{'id':_0xe7a459[_0x837f('0x4f')]['id']},'attributes':[_0x837f('0x55'),_0x837f('0x57'),'preferred',_0x837f('0x5b'),'defaultLogo',_0x837f('0x5d'),'defaultPreferred',_0x837f('0x71')],'raw':!![]});})[_0x837f('0x1b')](handleEntityNotFound(_0x166a50,null))['then'](function(_0x48ddbf){if(_0x48ddbf){var _0x3289b7=_0x48ddbf[_0x837f('0x5a')]&&fs['existsSync'](path['join'](config[_0x837f('0x61')],_0x552778,_[_0x837f('0x62')](_0x48ddbf[_0x837f('0x5a')])))?path[_0x837f('0x60')](config[_0x837f('0x61')],_0x552778,_[_0x837f('0x62')](_0x48ddbf[_0x837f('0x5a')])):path[_0x837f('0x60')](config[_0x837f('0x61')],_0x552778,_[_0x837f('0x62')](_0x837f('0x72')));var _0x66c876='default'+_[_0x837f('0x66')](_0x837f('0x5a'));if(_0x48ddbf[_0x66c876]||!_0x2cc02a[_0x837f('0x6b')]||!_0x2cc02a[_0x837f('0x5a')]){_0x3289b7=path[_0x837f('0x60')](config[_0x837f('0x61')],_0x552778,_[_0x837f('0x62')]('default_preferred.png'));}if(!fs[_0x837f('0x5f')](_0x3289b7)){throw new db[(_0x837f('0x64'))][(_0x837f('0x65'))](_[_0x837f('0x66')]('preferred')+_0x837f('0x6c'));}return _0x166a50[_0x837f('0x67')](_0x3289b7);}})['catch'](handleError(_0x166a50,null));};exports[_0x837f('0x73')]=function(_0x41fc30,_0xef053c,_0x210ab8){if(_0x41fc30[_0x837f('0x53')]&&_0x41fc30[_0x837f('0x53')][_0x837f('0x54')]){_0x41fc30[_0x837f('0x51')]['favicon']=_0x41fc30[_0x837f('0x53')][_0x837f('0x54')];}return db[_0x837f('0x49')]['find']({'where':{'id':_0x41fc30[_0x837f('0x4f')]['id']}})[_0x837f('0x1b')](handleEntityNotFound(_0xef053c,null))[_0x837f('0x1b')](saveUpdates(_0x41fc30[_0x837f('0x51')],null))[_0x837f('0x1b')](respondWithResult(_0xef053c,null))['catch'](handleError(_0xef053c,null));};var utilLicense=require(_0x837f('0x17'));exports[_0x837f('0x74')]=function(_0x1000c3,_0xa9b002,_0x38e255){var _0x26ea4a='server/files/images/logos';var _0x4e4fb6={'custom':![]};return utilLicense[_0x837f('0x59')]()[_0x837f('0x1b')](function(_0xfc0905){if(_0xfc0905){_0x4e4fb6=_0xfc0905;}return db[_0x837f('0x49')]['find']({'where':{'id':_0x1000c3[_0x837f('0x4f')]['id']},'attributes':[_0x837f('0x55'),'loginLogo',_0x837f('0x5a'),_0x837f('0x5b'),'defaultLogo',_0x837f('0x5d'),'defaultPreferred',_0x837f('0x71')],'raw':!![]});})[_0x837f('0x1b')](handleEntityNotFound(_0xa9b002,null))['then'](function(_0x141aeb){if(_0x141aeb){var _0x585ee8=_0x141aeb[_0x837f('0x5b')]&&fs[_0x837f('0x5f')](path[_0x837f('0x60')](config['root'],_0x26ea4a,_[_0x837f('0x62')](_0x141aeb[_0x837f('0x5b')])))?path[_0x837f('0x60')](config[_0x837f('0x61')],_0x26ea4a,_[_0x837f('0x62')](_0x141aeb[_0x837f('0x5b')])):path[_0x837f('0x60')](config[_0x837f('0x61')],_0x26ea4a,_['toLower']('default_favicon.ico'));var _0x1f6a00=_0x837f('0x6a')+_[_0x837f('0x66')](_0x837f('0x5b'));if(_0x141aeb[_0x1f6a00]||!_0x4e4fb6['custom']){_0x585ee8=path[_0x837f('0x60')](config['root'],_0x26ea4a,_[_0x837f('0x62')]('default_favicon.ico'));}if(!fs['existsSync'](_0x585ee8)){throw new db[(_0x837f('0x64'))][(_0x837f('0x65'))](_[_0x837f('0x66')](_0x837f('0x5b'))+_0x837f('0x6c'));}return _0xa9b002['download'](_0x585ee8);}})[_0x837f('0x24')](handleError(_0xa9b002,null));};exports[_0x837f('0x75')]=function(_0xc92a78,_0x2ff476){var _0x52d3f8={'offset':moment()[_0x837f('0x76')]()};_0x52d3f8[_0x837f('0x77')]=moment()['utcOffset'](_0x52d3f8[_0x837f('0x29')])[_0x837f('0x78')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x2ff476['status'](0xc8)['send'](_0x52d3f8);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a084801..7972fd8 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 _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x289121,_0x245b5b){var _0x5d9bbb=function(_0x25a40e){while(--_0x25a40e){_0x289121['push'](_0x289121['shift']());}};_0x5d9bbb(++_0x245b5b);}(_0x34e8,0x12c));var _0x834e=function(_0x34d60a,_0x3a2f77){_0x34d60a=_0x34d60a-0x0;var _0x506646=_0x34e8[_0x34d60a];return _0x506646;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x26a5aa,_0x47ac88){var _0x33b592=function(_0x4ff14c){while(--_0x4ff14c){_0x26a5aa['push'](_0x26a5aa['shift']());}};_0x33b592(++_0x47ac88);}(_0xe14b,0x93));var _0xbe14=function(_0x250c66,_0x1eb84c){_0x250c66=_0x250c66-0x0;var _0x1ebfe1=_0xe14b[_0x250c66];return _0x1ebfe1;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('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 39598b4..bf285e9 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 _0x1e0e=['Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Setting','find','options','raw','where','include','map','model','attributes','ShowSetting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1e0e,0xbd));var _0xe1e0=function(_0x20ba4e,_0x5dd0f3){_0x20ba4e=_0x20ba4e-0x0;var _0x5d8911=_0x1e0e[_0x20ba4e];return _0x5d8911;};'use strict';var _=require(_0xe1e0('0x0'));var util=require(_0xe1e0('0x1'));var moment=require(_0xe1e0('0x2'));var BPromise=require(_0xe1e0('0x3'));var rs=require(_0xe1e0('0x4'));var fs=require('fs');var Redis=require(_0xe1e0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1e0('0x6'));var logger=require(_0xe1e0('0x7'))(_0xe1e0('0x8'));var config=require(_0xe1e0('0x9'));var jayson=require(_0xe1e0('0xa'));var client=jayson[_0xe1e0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15ac0a,_0x32637f,_0x30958a){return new BPromise(function(_0x2bfb4f,_0x150dc1){return client[_0xe1e0('0xc')](_0x15ac0a,_0x30958a)[_0xe1e0('0xd')](function(_0x275dc3){logger[_0xe1e0('0xe')](_0xe1e0('0xf'),_0x32637f,_0xe1e0('0x10'));logger[_0xe1e0('0x11')](_0xe1e0('0x12'),_0x32637f,_0xe1e0('0x10'),JSON[_0xe1e0('0x13')](_0x275dc3));if(_0x275dc3[_0xe1e0('0x14')]){if(_0x275dc3['error'][_0xe1e0('0x15')]===0x1f4){logger[_0xe1e0('0x14')](_0xe1e0('0xf'),_0x32637f,_0x275dc3[_0xe1e0('0x14')][_0xe1e0('0x16')]);return _0x150dc1(_0x275dc3[_0xe1e0('0x14')][_0xe1e0('0x16')]);}logger[_0xe1e0('0x14')](_0xe1e0('0xf'),_0x32637f,_0x275dc3['error'][_0xe1e0('0x16')]);return _0x2bfb4f(_0x275dc3[_0xe1e0('0x14')][_0xe1e0('0x16')]);}else{logger[_0xe1e0('0xe')](_0xe1e0('0xf'),_0x32637f,_0xe1e0('0x10'));_0x2bfb4f(_0x275dc3['result'][_0xe1e0('0x16')]);}})[_0xe1e0('0x17')](function(_0x446a08){logger[_0xe1e0('0x14')]('Setting,\x20%s,\x20%s',_0x32637f,_0x446a08);_0x150dc1(_0x446a08);});});}exports['ShowSetting']=function(_0x1a6ed3){var _0x6d9dbf=this;return new Promise(function(_0x1552e4,_0x4da55c){return db[_0xe1e0('0x18')][_0xe1e0('0x19')]({'raw':_0x1a6ed3[_0xe1e0('0x1a')]?_0x1a6ed3[_0xe1e0('0x1a')][_0xe1e0('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a6ed3['options']?_0x1a6ed3['options'][_0xe1e0('0x1c')]||null:null,'attributes':_0x1a6ed3[_0xe1e0('0x1a')]?_0x1a6ed3[_0xe1e0('0x1a')]['attributes']||null:null,'include':_0x1a6ed3[_0xe1e0('0x1a')]?_0x1a6ed3[_0xe1e0('0x1a')][_0xe1e0('0x1d')]?_[_0xe1e0('0x1e')](_0x1a6ed3[_0xe1e0('0x1a')][_0xe1e0('0x1d')],function(_0x391464){return{'model':db[_0x391464[_0xe1e0('0x1f')]],'as':_0x391464['as'],'attributes':_0x391464[_0xe1e0('0x20')],'include':_0x391464['include']?_[_0xe1e0('0x1e')](_0x391464[_0xe1e0('0x1d')],function(_0x5e8d73){return{'model':db[_0x5e8d73['model']],'as':_0x5e8d73['as'],'attributes':_0x5e8d73['attributes'],'include':_0x5e8d73[_0xe1e0('0x1d')]?_[_0xe1e0('0x1e')](_0x5e8d73[_0xe1e0('0x1d')],function(_0x40510f){return{'model':db[_0x40510f['model']],'as':_0x40510f['as'],'attributes':_0x40510f[_0xe1e0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe1e0('0xd')](function(_0x16f59f){logger[_0xe1e0('0xe')](_0xe1e0('0x21'),_0x1a6ed3);logger[_0xe1e0('0x11')](_0xe1e0('0x21'),_0x1a6ed3,JSON[_0xe1e0('0x13')](_0x16f59f));_0x1552e4(_0x16f59f);})[_0xe1e0('0x17')](function(_0x462da2){logger[_0xe1e0('0x14')](_0xe1e0('0x21'),_0x462da2[_0xe1e0('0x16')],_0x1a6ed3);_0x4da55c(_0x6d9dbf['error'](0x1f4,_0x462da2['message']));});});}; \ No newline at end of file +var _0xd2e7=['request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','options','raw','where','attributes','include','map','model','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0x57a069,_0x122f24){var _0x1347c8=function(_0x15f1eb){while(--_0x15f1eb){_0x57a069['push'](_0x57a069['shift']());}};_0x1347c8(++_0x122f24);}(_0xd2e7,0x16b));var _0x7d2e=function(_0x4aeee3,_0x1079cb){_0x4aeee3=_0x4aeee3-0x0;var _0x34ba72=_0xd2e7[_0x4aeee3];return _0x34ba72;};'use strict';var _=require(_0x7d2e('0x0'));var util=require('util');var moment=require(_0x7d2e('0x1'));var BPromise=require(_0x7d2e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d2e('0x3'));var db=require(_0x7d2e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d2e('0x5'))(_0x7d2e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7d2e('0x7')][_0x7d2e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x309250,_0x37b933,_0x43babe){return new BPromise(function(_0x21a4df,_0x3d8976){return client[_0x7d2e('0x9')](_0x309250,_0x43babe)[_0x7d2e('0xa')](function(_0x15e599){logger[_0x7d2e('0xb')](_0x7d2e('0xc'),_0x37b933,_0x7d2e('0xd'));logger[_0x7d2e('0xe')](_0x7d2e('0xf'),_0x37b933,_0x7d2e('0xd'),JSON[_0x7d2e('0x10')](_0x15e599));if(_0x15e599[_0x7d2e('0x11')]){if(_0x15e599[_0x7d2e('0x11')][_0x7d2e('0x12')]===0x1f4){logger[_0x7d2e('0x11')](_0x7d2e('0xc'),_0x37b933,_0x15e599[_0x7d2e('0x11')][_0x7d2e('0x13')]);return _0x3d8976(_0x15e599[_0x7d2e('0x11')][_0x7d2e('0x13')]);}logger[_0x7d2e('0x11')](_0x7d2e('0xc'),_0x37b933,_0x15e599[_0x7d2e('0x11')]['message']);return _0x21a4df(_0x15e599[_0x7d2e('0x11')][_0x7d2e('0x13')]);}else{logger[_0x7d2e('0xb')]('Setting,\x20%s,\x20%s',_0x37b933,_0x7d2e('0xd'));_0x21a4df(_0x15e599[_0x7d2e('0x14')][_0x7d2e('0x13')]);}})[_0x7d2e('0x15')](function(_0x1c9a05){logger[_0x7d2e('0x11')](_0x7d2e('0xc'),_0x37b933,_0x1c9a05);_0x3d8976(_0x1c9a05);});});}exports[_0x7d2e('0x16')]=function(_0x59eed7){var _0x43174b=this;return new Promise(function(_0x56fd6f,_0x48dbdd){return db[_0x7d2e('0x17')]['find']({'raw':_0x59eed7[_0x7d2e('0x18')]?_0x59eed7[_0x7d2e('0x18')][_0x7d2e('0x19')]===undefined?!![]:![]:!![],'where':_0x59eed7[_0x7d2e('0x18')]?_0x59eed7['options'][_0x7d2e('0x1a')]||null:null,'attributes':_0x59eed7[_0x7d2e('0x18')]?_0x59eed7[_0x7d2e('0x18')][_0x7d2e('0x1b')]||null:null,'include':_0x59eed7[_0x7d2e('0x18')]?_0x59eed7['options'][_0x7d2e('0x1c')]?_[_0x7d2e('0x1d')](_0x59eed7[_0x7d2e('0x18')][_0x7d2e('0x1c')],function(_0x1c726a){return{'model':db[_0x1c726a[_0x7d2e('0x1e')]],'as':_0x1c726a['as'],'attributes':_0x1c726a[_0x7d2e('0x1b')],'include':_0x1c726a[_0x7d2e('0x1c')]?_['map'](_0x1c726a[_0x7d2e('0x1c')],function(_0x362fc0){return{'model':db[_0x362fc0['model']],'as':_0x362fc0['as'],'attributes':_0x362fc0[_0x7d2e('0x1b')],'include':_0x362fc0[_0x7d2e('0x1c')]?_[_0x7d2e('0x1d')](_0x362fc0['include'],function(_0x4421a8){return{'model':db[_0x4421a8[_0x7d2e('0x1e')]],'as':_0x4421a8['as'],'attributes':_0x4421a8[_0x7d2e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7d2e('0xa')](function(_0x278fe4){logger[_0x7d2e('0xb')]('ShowSetting',_0x59eed7);logger['debug'](_0x7d2e('0x16'),_0x59eed7,JSON['stringify'](_0x278fe4));_0x56fd6f(_0x278fe4);})[_0x7d2e('0x15')](function(_0x3c2a8e){logger[_0x7d2e('0x11')]('ShowSetting',_0x3c2a8e[_0x7d2e('0x13')],_0x59eed7);_0x48dbdd(_0x43174b[_0x7d2e('0x11')](0x1f4,_0x3c2a8e[_0x7d2e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 5a34f2f..20087dd 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 _0x5fc3=['/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/status','statusGet','post','create','/:id/dispositions','addAnswer','/:id/notify','/:id/send','send','status','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','describe'];(function(_0x3a3ffe,_0x10fe59){var _0x1f86df=function(_0x166a1a){while(--_0x166a1a){_0x3a3ffe['push'](_0x3a3ffe['shift']());}};_0x1f86df(++_0x10fe59);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x5fc3[_0x1bbc08];return _0x5d825b;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/dispositions',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getAnswers']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x35fc('0x9')]('/:id/interactions',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x9')](_0x35fc('0x12'),controller[_0x35fc('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x14')]('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x14')](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller['addDisposition']);router[_0x35fc('0x14')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x14')](_0x35fc('0x18'),controller['notify']);router[_0x35fc('0x14')](_0x35fc('0x10'),auth[_0x35fc('0xa')](),controller['addApplications']);router[_0x35fc('0x14')](_0x35fc('0x19'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);router[_0x35fc('0x14')](_0x35fc('0x12'),controller[_0x35fc('0x1b')]);router[_0x35fc('0x14')](_0x35fc('0x1c'),auth[_0x35fc('0xa')](),controller['addAgents']);router[_0x35fc('0x1d')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1e')]);router[_0x35fc('0x1f')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x20')]);router['delete'](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x21')]);router['delete'](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x22')]);router[_0x35fc('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x35fc('0x23')]);module['exports']=router; \ No newline at end of file +var _0xe14b=['./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','/:id','destroy','removeDispositions','delete','/:id/users','removeAgents','multer','util','express','Router','../../components/auth/service'];(function(_0x2b2e44,_0x36b38a){var _0x2d0b45=function(_0x474e39){while(--_0x474e39){_0x2b2e44['push'](_0x2b2e44['shift']());}};_0x2d0b45(++_0x36b38a);}(_0xe14b,0x93));var _0xbe14=function(_0xfe5b9d,_0x2fcc61){_0xfe5b9d=_0xfe5b9d-0x0;var _0x55d39a=_0xe14b[_0xfe5b9d];return _0x55d39a;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x6')](_0xbe14('0x10'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x6')](_0xbe14('0x12'),controller[_0xbe14('0x13')]);router[_0xbe14('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x15')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x16')]);router['post'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x15')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);router['post'](_0xbe14('0x19'),controller[_0xbe14('0x1a')]);router[_0xbe14('0x15')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1b')]);router['post'](_0xbe14('0x1c'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1d')]);router[_0xbe14('0x15')](_0xbe14('0x12'),controller['status']);router[_0xbe14('0x15')]('/:id/users',auth[_0xbe14('0x7')](),controller['addAgents']);router[_0xbe14('0x1e')]('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0x1f')]);router['delete'](_0xbe14('0x20'),auth['isAuthenticated'](),controller[_0xbe14('0x21')]);router['delete'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x22')]);router[_0xbe14('0x23')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeAnswers']);router[_0xbe14('0x23')](_0xbe14('0x24'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 3fd8052..246e26d 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 _0x7164=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','STRING','generate','twilio','skebby','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x24817f,_0x2a1aae){var _0x56bf59=function(_0x26321a){while(--_0x26321a){_0x24817f['push'](_0x24817f['shift']());}};_0x56bf59(++_0x2a1aae);}(_0x7164,0x156));var _0x4716=function(_0x3fd750,_0x120661){_0x3fd750=_0x3fd750-0x0;var _0x4f15d9=_0x7164[_0x3fd750];return _0x4f15d9;};'use strict';var Sequelize=require(_0x4716('0x0'));var rs=require(_0x4716('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x4716('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x4716('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x4716('0x2')],'defaultValue':function(){return rs[_0x4716('0x3')]();}},'phone':{'type':Sequelize[_0x4716('0x2')]},'type':{'type':Sequelize['ENUM'](_0x4716('0x4'),_0x4716('0x5'),'connectel',_0x4716('0x6'),_0x4716('0x7'),_0x4716('0x8'),_0x4716('0x9'),_0x4716('0xa'),_0x4716('0xb'),_0x4716('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x4716('0x2')]},'authToken':{'type':Sequelize[_0x4716('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x4716('0x2')]},'password':{'type':Sequelize[_0x4716('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x4716('0x2')]},'accountId':{'type':Sequelize[_0x4716('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x4716('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x4716('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4716('0xe')],'defaultValue':function(){return _0x4716('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4716('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4716('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4716('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4716('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4716('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x4716('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4716('0x10')],'comment':_0x4716('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x4716('0xd')],'defaultValue':![],'comment':_0x4716('0x12'),'set':function(_0x45ed56){if(!_0x45ed56)this[_0x4716('0x13')]('mandatoryDispositionPauseId',null);this[_0x4716('0x13')]('mandatoryDisposition',_0x45ed56);}}}; \ No newline at end of file +var _0x32b5=['twilio','skebby','connectel','clicksend','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM'];(function(_0xb9868a,_0x4b351e){var _0x54f06f=function(_0x5923e2){while(--_0x5923e2){_0xb9868a['push'](_0xb9868a['shift']());}};_0x54f06f(++_0x4b351e);}(_0x32b5,0x1c6));var _0x532b=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x32b5[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x532b('0x0'));module[_0x532b('0x1')]={'name':{'type':Sequelize[_0x532b('0x2')],'unique':_0x532b('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x532b('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x532b('0x2')],'defaultValue':function(){return rs[_0x532b('0x4')]();}},'phone':{'type':Sequelize[_0x532b('0x2')]},'type':{'type':Sequelize[_0x532b('0x5')](_0x532b('0x6'),_0x532b('0x7'),_0x532b('0x8'),_0x532b('0x9'),'plivo','clickatell',_0x532b('0xa'),_0x532b('0xb'),_0x532b('0xc'),_0x532b('0xd'))},'accountSid':{'type':Sequelize[_0x532b('0x2')]},'authId':{'type':Sequelize[_0x532b('0x2')]},'authToken':{'type':Sequelize[_0x532b('0x2')]},'smsMethod':{'type':Sequelize[_0x532b('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x532b('0x2')]},'password':{'type':Sequelize[_0x532b('0x2')]},'apiKey':{'type':Sequelize[_0x532b('0x2')]},'applicationId':{'type':Sequelize[_0x532b('0x2')]},'accountId':{'type':Sequelize[_0x532b('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x532b('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x532b('0xf')],'defaultValue':function(){return _0x532b('0x10');}},'notificationSound':{'type':Sequelize[_0x532b('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x532b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x532b('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x532b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x532b('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x532b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x532b('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x532b('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x532b('0x13'),'set':function(_0x45aef3){if(!_0x45aef3)this[_0x532b('0x14')](_0x532b('0x15'),null);this[_0x532b('0x14')](_0x532b('0x16'),_0x45aef3);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 3e0656d..117c155 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 _0x41c1=['hasOwnProperty','limit','sort','where','merge','options','rows','show','params','includeAll','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','SmsAccountId','Disposition','getDispositions','findOne','nolimit','order','filter','findAll','removeDispositions','ids','addAnswer','CannedAnswer','length','pick','removeAnswers','notify','sms','SmsApplication','Applications','account','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','MessageSid','skebby','connectel','clicksend','plivo','Text','messageId','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','Sequelize','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','omit','SmsInteraction','spread','interaction','push','applications','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','addApplications','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','then','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0x41c1,0x98));var _0x141c=function(_0x1e9c70,_0x368b6b){_0x1e9c70=_0x1e9c70-0x0;var _0x517ec3=_0x41c1[_0x1e9c70];return _0x517ec3;};'use strict';var emlformat=require(_0x141c('0x0'));var rimraf=require(_0x141c('0x1'));var zipdir=require(_0x141c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x141c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x141c('0x4'));var path=require(_0x141c('0x5'));var sox=require(_0x141c('0x6'));var csv=require(_0x141c('0x7'));var ejs=require(_0x141c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x141c('0x9'));var squel=require('squel');var crypto=require(_0x141c('0xa'));var jsforce=require(_0x141c('0xb'));var deskjs=require(_0x141c('0xc'));var toCsv=require(_0x141c('0x7'));var querystring=require(_0x141c('0xd'));var Papa=require(_0x141c('0xe'));var Redis=require(_0x141c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x141c('0x10'));var as=require(_0x141c('0x11'));var hardwareService=require(_0x141c('0x12'));var logger=require(_0x141c('0x13'))(_0x141c('0x14'));var utils=require(_0x141c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x141c('0x16'));var db=require(_0x141c('0x17'))['db'];config['redis']=_[_0x141c('0x18')](config[_0x141c('0x19')],{'host':_0x141c('0x1a'),'port':0x18eb});var socket=require(_0x141c('0x1b'))(new Redis(config[_0x141c('0x19')]));require(_0x141c('0x1c'))[_0x141c('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x141c('0x1e')][_0x141c('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x5d82e,_0x537c75,_0x567bc4,_0x408f52){return new BPromise(function(_0x56c0bb,_0x6911dd){var _0x3b4e14=_0x408f52||client;return _0x3b4e14['request'](_0x5d82e,_0x567bc4)[_0x141c('0x20')](function(_0x2caca3){logger['info'](_0x141c('0x21'),_0x537c75,'request\x20sent');logger[_0x141c('0x22')](_0x141c('0x23'),_0x537c75,_0x141c('0x24'),JSON[_0x141c('0x25')](_0x2caca3));if(_0x2caca3[_0x141c('0x26')]){if(_0x2caca3[_0x141c('0x26')][_0x141c('0x27')]===0x1f4){logger[_0x141c('0x26')](_0x141c('0x21'),_0x537c75,_0x2caca3['error']['message']);return _0x6911dd(_0x2caca3['error']['message']);}logger['error'](_0x141c('0x21'),_0x537c75,_0x2caca3['error'][_0x141c('0x28')]);return _0x56c0bb(_0x2caca3[_0x141c('0x26')]['message']);}else{logger[_0x141c('0x29')]('SmsAccount,\x20%s,\x20%s',_0x537c75,_0x141c('0x24'));_0x56c0bb(_0x2caca3['result'][_0x141c('0x28')]);}})[_0x141c('0x2a')](function(_0xee274e){logger['error'](_0x141c('0x21'),_0x537c75,_0xee274e);_0x6911dd(_0xee274e);});});}function respondWithStatusCode(_0x365ce3,_0x10548c){_0x10548c=_0x10548c||0xcc;return function(_0x101d2d){if(_0x101d2d){return _0x365ce3[_0x141c('0x2b')](_0x10548c);}return _0x365ce3[_0x141c('0x2c')](_0x10548c)[_0x141c('0x2d')]();};}function respondWithResult(_0x37a803,_0x4c2b59){_0x4c2b59=_0x4c2b59||0xc8;return function(_0x1c44e2){if(_0x1c44e2){return _0x37a803['status'](_0x4c2b59)[_0x141c('0x2e')](_0x1c44e2);}};}function respondWithFilteredResult(_0x1747b8,_0x54ff41){return function(_0x16b58a){if(_0x16b58a){var _0x4c60c5=typeof _0x54ff41['offset']==='undefined'&&typeof _0x54ff41['limit']==='undefined';var _0x1c484a=_0x16b58a[_0x141c('0x2f')];var _0x17500d=_0x4c60c5?0x0:_0x54ff41[_0x141c('0x30')];var _0x4ef7ee=_0x4c60c5?_0x16b58a[_0x141c('0x2f')]:_0x54ff41['offset']+_0x54ff41['limit'];var _0x423cf8;if(_0x4ef7ee>=_0x1c484a){_0x4ef7ee=_0x1c484a;_0x423cf8=0xc8;}else{_0x423cf8=0xce;}_0x1747b8[_0x141c('0x2c')](_0x423cf8);return _0x1747b8[_0x141c('0x31')](_0x141c('0x32'),_0x17500d+'-'+_0x4ef7ee+'/'+_0x1c484a)[_0x141c('0x2e')](_0x16b58a);}return null;};}function patchUpdates(_0x51b263){return function(_0x4b740d){try{jsonpatch[_0x141c('0x33')](_0x4b740d,_0x51b263,!![]);}catch(_0x11d70d){return BPromise[_0x141c('0x34')](_0x11d70d);}return _0x4b740d[_0x141c('0x35')]();};}function saveUpdates(_0xcd6605,_0x406508){return function(_0x59db75){if(_0x59db75){return _0x59db75[_0x141c('0x36')](_0xcd6605)[_0x141c('0x20')](function(_0x3c8cdd){return _0x3c8cdd;});}return null;};}function removeEntity(_0x1cc1b5,_0x28765c){return function(_0x3147b9){if(_0x3147b9){return _0x3147b9[_0x141c('0x37')]()[_0x141c('0x20')](function(){var _0x47dbf2=_0x3147b9[_0x141c('0x38')]({'plain':!![]});var _0x4ca6cd=_0x141c('0x39');return db['UserProfileResource'][_0x141c('0x37')]({'where':{'type':_0x4ca6cd,'resourceId':_0x47dbf2['id']}})[_0x141c('0x20')](function(){return _0x3147b9;});})[_0x141c('0x20')](function(){_0x1cc1b5[_0x141c('0x2c')](0xcc)[_0x141c('0x2d')]();});}};}function handleEntityNotFound(_0x3ab75c,_0x53debe){return function(_0x59a856){if(!_0x59a856){_0x3ab75c['sendStatus'](0x194);}return _0x59a856;};}function handleError(_0x49162f,_0x2ab9d5){_0x2ab9d5=_0x2ab9d5||0x1f4;return function(_0xf7abed){logger['error'](_0xf7abed[_0x141c('0x3a')]);if(_0xf7abed[_0x141c('0x3b')]){delete _0xf7abed[_0x141c('0x3b')];}_0x49162f['status'](_0x2ab9d5)[_0x141c('0x3c')](_0xf7abed);};}exports[_0x141c('0x3d')]=function(_0x18a216,_0x7af17c){var _0x138d78={'include':[{'model':db[_0x141c('0x3e')],'as':_0x141c('0x3f')}]},_0x5e4b5d={},_0x237294={'count':0x0,'rows':[]};var _0x24b650=_[_0x141c('0x40')](db[_0x141c('0x41')][_0x141c('0x42')],function(_0x267d96){return{'name':_0x267d96['fieldName'],'type':_0x267d96[_0x141c('0x43')]['key']};});_0x5e4b5d['model']=_['map'](_0x24b650,_0x141c('0x3b'));_0x5e4b5d[_0x141c('0x44')]=_[_0x141c('0x45')](_0x18a216[_0x141c('0x44')]);_0x5e4b5d[_0x141c('0x46')]=_[_0x141c('0x47')](_0x5e4b5d[_0x141c('0x48')],_0x5e4b5d[_0x141c('0x44')]);_0x138d78['attributes']=_['intersection'](_0x5e4b5d[_0x141c('0x48')],qs[_0x141c('0x49')](_0x18a216[_0x141c('0x44')][_0x141c('0x49')]));_0x138d78[_0x141c('0x4a')]=_0x138d78['attributes']['length']?_0x138d78['attributes']:_0x5e4b5d['model'];if(!_0x18a216[_0x141c('0x44')][_0x141c('0x4b')]('nolimit')){_0x138d78[_0x141c('0x4c')]=qs[_0x141c('0x4c')](_0x18a216['query'][_0x141c('0x4c')]);_0x138d78[_0x141c('0x30')]=qs[_0x141c('0x30')](_0x18a216[_0x141c('0x44')][_0x141c('0x30')]);}_0x138d78['order']=qs[_0x141c('0x4d')](_0x18a216[_0x141c('0x44')][_0x141c('0x4d')]);_0x138d78[_0x141c('0x4e')]=qs[_0x141c('0x46')](_['pick'](_0x18a216['query'],_0x5e4b5d['filters']),_0x24b650);if(_0x18a216[_0x141c('0x44')]['filter']){_0x138d78[_0x141c('0x4e')]=_['merge'](_0x138d78[_0x141c('0x4e')],{'$or':_[_0x141c('0x40')](_0x24b650,function(_0x4eee6d){if(_0x4eee6d[_0x141c('0x43')]!=='VIRTUAL'){var _0x30b95f={};_0x30b95f[_0x4eee6d[_0x141c('0x3b')]]={'$like':'%'+_0x18a216[_0x141c('0x44')]['filter']+'%'};return _0x30b95f;}})});}_0x138d78=_[_0x141c('0x4f')]({},_0x138d78,_0x18a216[_0x141c('0x50')]);var _0x4eff11={'where':_0x138d78['where']};return db[_0x141c('0x41')]['count'](_0x4eff11)[_0x141c('0x20')](function(_0x162fd7){_0x237294[_0x141c('0x2f')]=_0x162fd7;if(_0x18a216[_0x141c('0x44')]['includeAll']){_0x138d78['include']=[{'all':!![]}];}return db[_0x141c('0x41')]['findAll'](_0x138d78);})[_0x141c('0x20')](function(_0x412546){_0x237294[_0x141c('0x51')]=_0x412546;return _0x237294;})['then'](respondWithFilteredResult(_0x7af17c,_0x138d78))[_0x141c('0x2a')](handleError(_0x7af17c,null));};exports[_0x141c('0x52')]=function(_0x56590d,_0xbdc869){var _0x48a39f={'raw':![],'where':{'id':_0x56590d[_0x141c('0x53')]['id']},'include':[{'model':db[_0x141c('0x3e')],'as':_0x141c('0x3f')}]},_0x5a860c={};_0x5a860c[_0x141c('0x48')]=_[_0x141c('0x45')](db[_0x141c('0x41')][_0x141c('0x42')]);_0x5a860c[_0x141c('0x44')]=_[_0x141c('0x45')](_0x56590d[_0x141c('0x44')]);_0x5a860c['filters']=_[_0x141c('0x47')](_0x5a860c[_0x141c('0x48')],_0x5a860c['query']);_0x48a39f['attributes']=_[_0x141c('0x47')](_0x5a860c[_0x141c('0x48')],qs[_0x141c('0x49')](_0x56590d[_0x141c('0x44')]['fields']));_0x48a39f['attributes']=_0x48a39f[_0x141c('0x4a')]['length']?_0x48a39f[_0x141c('0x4a')]:_0x5a860c['model'];if(_0x56590d[_0x141c('0x44')][_0x141c('0x54')]){_0x48a39f[_0x141c('0x55')]=[{'all':!![]}];}_0x48a39f=_[_0x141c('0x4f')]({},_0x48a39f,_0x56590d[_0x141c('0x50')]);return db[_0x141c('0x41')][_0x141c('0x56')](_0x48a39f)[_0x141c('0x20')](handleEntityNotFound(_0xbdc869,null))['then'](respondWithResult(_0xbdc869,null))['catch'](handleError(_0xbdc869,null));};exports[_0x141c('0x57')]=function(_0x81e937,_0x27c9b3){return db[_0x141c('0x41')][_0x141c('0x57')](_0x81e937['body'],{})[_0x141c('0x20')](function(_0x32fe9c){var _0x311dfc=_0x81e937['user'][_0x141c('0x38')]({'plain':!![]});if(!_0x311dfc)throw new Error(_0x141c('0x58'));if(_0x311dfc[_0x141c('0x59')]===_0x141c('0x5a')){var _0x539f78=_0x32fe9c[_0x141c('0x38')]({'plain':!![]});var _0x47cbd5=_0x141c('0x39');return db[_0x141c('0x5b')][_0x141c('0x56')]({'where':{'name':_0x47cbd5,'userProfileId':_0x311dfc['userProfileId']},'raw':!![]})[_0x141c('0x20')](function(_0x54bc68){if(_0x54bc68&&_0x54bc68['autoAssociation']===0x0){return db[_0x141c('0x5c')][_0x141c('0x57')]({'name':_0x539f78['name'],'resourceId':_0x539f78['id'],'type':_0x54bc68[_0x141c('0x3b')],'sectionId':_0x54bc68['id']},{})[_0x141c('0x20')](function(){return _0x32fe9c;});}else{return _0x32fe9c;}})[_0x141c('0x2a')](function(_0x195d85){logger['error'](_0x141c('0x5d'),_0x195d85);throw _0x195d85;});}return _0x32fe9c;})['then'](respondWithResult(_0x27c9b3,0xc9))[_0x141c('0x2a')](handleError(_0x27c9b3,null));};exports['update']=function(_0x5d7401,_0x55ae05){if(_0x5d7401[_0x141c('0x5e')]['id']){delete _0x5d7401['body']['id'];}return db[_0x141c('0x41')][_0x141c('0x56')]({'where':{'id':_0x5d7401[_0x141c('0x53')]['id']},'include':[{'model':db[_0x141c('0x3e')],'as':_0x141c('0x3f')}]})[_0x141c('0x20')](handleEntityNotFound(_0x55ae05,null))[_0x141c('0x20')](saveUpdates(_0x5d7401[_0x141c('0x5e')],null))[_0x141c('0x20')](respondWithResult(_0x55ae05,null))[_0x141c('0x2a')](handleError(_0x55ae05,null));};exports[_0x141c('0x37')]=function(_0x182ad0,_0x31cda5){return db['SmsAccount'][_0x141c('0x56')]({'where':{'id':_0x182ad0[_0x141c('0x53')]['id']}})['then'](handleEntityNotFound(_0x31cda5,null))[_0x141c('0x20')](removeEntity(_0x31cda5,null))[_0x141c('0x2a')](handleError(_0x31cda5,null));};exports[_0x141c('0x5f')]=function(_0x309b39,_0x5c4203){return db[_0x141c('0x41')][_0x141c('0x5f')]()[_0x141c('0x20')](respondWithResult(_0x5c4203,null))[_0x141c('0x2a')](handleError(_0x5c4203,null));};exports['addDisposition']=function(_0x28e60d,_0x248afb,_0x1117f3){if(_0x28e60d[_0x141c('0x5e')]['id']){delete _0x28e60d[_0x141c('0x5e')]['id'];}return db[_0x141c('0x41')][_0x141c('0x56')]({'where':{'id':_0x28e60d[_0x141c('0x53')]['id']}})[_0x141c('0x20')](handleEntityNotFound(_0x248afb,null))[_0x141c('0x20')](function(_0x11ebb9){if(_0x11ebb9){_0x28e60d[_0x141c('0x5e')][_0x141c('0x60')]=_0x11ebb9['id'];return db[_0x141c('0x61')][_0x141c('0x57')](_0x28e60d[_0x141c('0x5e')]);}})[_0x141c('0x20')](respondWithResult(_0x248afb,null))[_0x141c('0x2a')](handleError(_0x248afb,null));};exports[_0x141c('0x62')]=function(_0x2cac1c,_0x1eff67,_0x5e19a3){var _0x273244={'raw':![],'where':{}};var _0x3f8493={};var _0x1f3092={'count':0x0,'rows':[]};return db[_0x141c('0x41')][_0x141c('0x63')]({'where':{'id':_0x2cac1c['params']['id']}})[_0x141c('0x20')](handleEntityNotFound(_0x1eff67,null))[_0x141c('0x20')](function(_0x3fbb99){if(_0x3fbb99){_0x3f8493[_0x141c('0x48')]=_[_0x141c('0x45')](db[_0x141c('0x61')][_0x141c('0x42')]);_0x3f8493[_0x141c('0x44')]=_['keys'](_0x2cac1c['query']);_0x3f8493[_0x141c('0x46')]=_[_0x141c('0x47')](_0x3f8493[_0x141c('0x48')],_0x3f8493[_0x141c('0x44')]);_0x273244['attributes']=_[_0x141c('0x47')](_0x3f8493[_0x141c('0x48')],qs[_0x141c('0x49')](_0x2cac1c['query']['fields']));_0x273244[_0x141c('0x4a')]=_0x273244[_0x141c('0x4a')]['length']?_0x273244[_0x141c('0x4a')]:_0x3f8493[_0x141c('0x48')];if(!_0x2cac1c[_0x141c('0x44')][_0x141c('0x4b')](_0x141c('0x64'))){_0x273244['limit']=qs[_0x141c('0x4c')](_0x2cac1c[_0x141c('0x44')]['limit']);_0x273244[_0x141c('0x30')]=qs[_0x141c('0x30')](_0x2cac1c[_0x141c('0x44')][_0x141c('0x30')]);}_0x273244[_0x141c('0x65')]=qs[_0x141c('0x4d')](_0x2cac1c[_0x141c('0x44')]['sort']);_0x273244['where']=qs[_0x141c('0x46')](_['pick'](_0x2cac1c[_0x141c('0x44')],_0x3f8493[_0x141c('0x46')]));_0x273244['where'][_0x141c('0x60')]=_0x3fbb99['id'];if(_0x2cac1c[_0x141c('0x44')][_0x141c('0x66')]){_0x273244[_0x141c('0x4e')]=_[_0x141c('0x4f')](_0x273244[_0x141c('0x4e')],{'$or':_[_0x141c('0x40')](_0x273244[_0x141c('0x4a')],function(_0x4a0eb0){var _0x35b406={};_0x35b406[_0x4a0eb0]={'$like':'%'+_0x2cac1c['query'][_0x141c('0x66')]+'%'};return _0x35b406;})});}_0x273244=_[_0x141c('0x4f')]({},_0x273244,_0x2cac1c['options']);return db[_0x141c('0x61')]['count']({'where':_0x273244[_0x141c('0x4e')]})[_0x141c('0x20')](function(_0x3b4597){_0x1f3092['count']=_0x3b4597;if(_0x2cac1c['query'][_0x141c('0x54')]){_0x273244[_0x141c('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x141c('0x67')](_0x273244);})[_0x141c('0x20')](function(_0x34dbd4){_0x1f3092['rows']=_0x34dbd4;return _0x1f3092;});}})[_0x141c('0x20')](respondWithFilteredResult(_0x1eff67,_0x273244))['catch'](handleError(_0x1eff67,null));};exports[_0x141c('0x68')]=function(_0x50c8f7,_0x7ffe9,_0x3bdd47){return db[_0x141c('0x41')][_0x141c('0x56')]({'where':{'id':_0x50c8f7[_0x141c('0x53')]['id']}})[_0x141c('0x20')](handleEntityNotFound(_0x7ffe9,null))['then'](function(_0x4ab634){if(_0x4ab634){return _0x4ab634[_0x141c('0x68')](_0x50c8f7[_0x141c('0x44')][_0x141c('0x69')]);}})[_0x141c('0x20')](respondWithStatusCode(_0x7ffe9,null))['catch'](handleError(_0x7ffe9,null));};exports[_0x141c('0x6a')]=function(_0x4734f9,_0x486c56,_0x2c1664){if(_0x4734f9[_0x141c('0x5e')]['id']){delete _0x4734f9[_0x141c('0x5e')]['id'];}return db[_0x141c('0x41')][_0x141c('0x56')]({'where':{'id':_0x4734f9[_0x141c('0x53')]['id']}})[_0x141c('0x20')](handleEntityNotFound(_0x486c56,null))[_0x141c('0x20')](function(_0x22f207){if(_0x22f207){_0x4734f9[_0x141c('0x5e')][_0x141c('0x60')]=_0x22f207['id'];return db[_0x141c('0x6b')]['create'](_0x4734f9[_0x141c('0x5e')]);}})[_0x141c('0x20')](respondWithResult(_0x486c56,null))[_0x141c('0x2a')](handleError(_0x486c56,null));};exports['getAnswers']=function(_0x335621,_0x398808,_0x2e54c8){var _0x198a48={'raw':![],'where':{}};var _0x462274={};var _0x49df42={'count':0x0,'rows':[]};return db[_0x141c('0x41')]['findOne']({'where':{'id':_0x335621['params']['id']}})[_0x141c('0x20')](handleEntityNotFound(_0x398808,null))['then'](function(_0x1210f1){if(_0x1210f1){_0x462274[_0x141c('0x48')]=_['keys'](db[_0x141c('0x6b')][_0x141c('0x42')]);_0x462274['query']=_['keys'](_0x335621[_0x141c('0x44')]);_0x462274['filters']=_[_0x141c('0x47')](_0x462274[_0x141c('0x48')],_0x462274[_0x141c('0x44')]);_0x198a48['attributes']=_[_0x141c('0x47')](_0x462274[_0x141c('0x48')],qs['fields'](_0x335621[_0x141c('0x44')][_0x141c('0x49')]));_0x198a48[_0x141c('0x4a')]=_0x198a48[_0x141c('0x4a')][_0x141c('0x6c')]?_0x198a48[_0x141c('0x4a')]:_0x462274[_0x141c('0x48')];if(!_0x335621[_0x141c('0x44')][_0x141c('0x4b')](_0x141c('0x64'))){_0x198a48[_0x141c('0x4c')]=qs[_0x141c('0x4c')](_0x335621[_0x141c('0x44')][_0x141c('0x4c')]);_0x198a48[_0x141c('0x30')]=qs['offset'](_0x335621[_0x141c('0x44')][_0x141c('0x30')]);}_0x198a48[_0x141c('0x65')]=qs[_0x141c('0x4d')](_0x335621['query'][_0x141c('0x4d')]);_0x198a48[_0x141c('0x4e')]=qs['filters'](_[_0x141c('0x6d')](_0x335621['query'],_0x462274['filters']));_0x198a48[_0x141c('0x4e')][_0x141c('0x60')]=_0x1210f1['id'];if(_0x335621[_0x141c('0x44')][_0x141c('0x66')]){_0x198a48[_0x141c('0x4e')]=_[_0x141c('0x4f')](_0x198a48[_0x141c('0x4e')],{'$or':_[_0x141c('0x40')](_0x198a48['attributes'],function(_0x558662){var _0x572b87={};_0x572b87[_0x558662]={'$like':'%'+_0x335621[_0x141c('0x44')][_0x141c('0x66')]+'%'};return _0x572b87;})});}_0x198a48=_[_0x141c('0x4f')]({},_0x198a48,_0x335621['options']);return db[_0x141c('0x6b')]['count']({'where':_0x198a48[_0x141c('0x4e')]})[_0x141c('0x20')](function(_0x27be18){_0x49df42[_0x141c('0x2f')]=_0x27be18;if(_0x335621[_0x141c('0x44')][_0x141c('0x54')]){_0x198a48['include']=[{'all':!![]}];}return db[_0x141c('0x6b')][_0x141c('0x67')](_0x198a48);})[_0x141c('0x20')](function(_0x43adbd){_0x49df42[_0x141c('0x51')]=_0x43adbd;return _0x49df42;});}})[_0x141c('0x20')](respondWithFilteredResult(_0x398808,_0x198a48))[_0x141c('0x2a')](handleError(_0x398808,null));};exports['removeAnswers']=function(_0x428b86,_0x1b714d,_0x1cd3f9){return db[_0x141c('0x41')][_0x141c('0x56')]({'where':{'id':_0x428b86[_0x141c('0x53')]['id']}})[_0x141c('0x20')](handleEntityNotFound(_0x1b714d,null))[_0x141c('0x20')](function(_0xcad27e){if(_0xcad27e){return _0xcad27e[_0x141c('0x6e')](_0x428b86['query']['ids']);}})['then'](respondWithStatusCode(_0x1b714d,null))[_0x141c('0x2a')](handleError(_0x1b714d,null));};exports[_0x141c('0x6f')]=function(_0x5d071f,_0x2798b3,_0x2cd5df){var _0x40c391={'channel':_0x141c('0x70')};var _0xdafb84=[];var _0x2d3d5c=[];var _0x568df8={};return db[_0x141c('0x41')][_0x141c('0x56')]({'where':{'id':_0x5d071f[_0x141c('0x53')]['id']},'include':[{'model':db[_0x141c('0x71')],'as':_0x141c('0x72')}]})[_0x141c('0x20')](handleEntityNotFound(_0x2798b3,null))[_0x141c('0x20')](function(_0x24cd6c){_0x40c391[_0x141c('0x73')]=_0x24cd6c;_0x40c391['applications']=_['orderBy'](_0x24cd6c[_0x141c('0x72')],[_0x141c('0x74')],[_0x141c('0x75')]);if(_0x40c391['account'][_0x141c('0x72')]){delete _0x40c391[_0x141c('0x73')]['Applications'];}return db[_0x141c('0x76')][_0x141c('0x5f')]();})[_0x141c('0x20')](function(_0xdecc34){if(!_0xdecc34){throw new db['Sequelize'][(_0x141c('0x77'))](_0x141c('0x78'));}_0xdafb84=_[_0x141c('0x79')](_[_0x141c('0x45')](_0xdecc34),[_0x141c('0x7a'),_0x141c('0x7b')]);_0x2d3d5c=_[_0x141c('0x79')](_[_0x141c('0x45')](_0xdecc34),['createdAt',_0x141c('0x7b'),_0x141c('0x7c'),_0x141c('0x7d')]);_0x40c391['body']={'mapKey':_0x141c('0x7e')};if(_0x40c391[_0x141c('0x73')][_0x141c('0x43')]){switch(_0x40c391[_0x141c('0x73')]['type']){case _0x141c('0x7f'):_0x40c391['body'][_0x141c('0x80')]=_0x5d071f[_0x141c('0x5e')][_0x141c('0x81')];_0x40c391[_0x141c('0x5e')][_0x141c('0x5e')]=_0x5d071f[_0x141c('0x5e')][_0x141c('0x82')];_0x40c391[_0x141c('0x5e')]['messageId']=_0x5d071f['body'][_0x141c('0x83')];break;case _0x141c('0x84'):_0x40c391[_0x141c('0x5e')]['from']='+'+_0x5d071f[_0x141c('0x5e')]['sender'];_0x40c391[_0x141c('0x5e')][_0x141c('0x5e')]=_0x5d071f[_0x141c('0x5e')]['text'];break;case _0x141c('0x85'):_0x40c391['body'][_0x141c('0x80')]=_0x5d071f[_0x141c('0x5e')][_0x141c('0x80')];_0x40c391[_0x141c('0x5e')][_0x141c('0x5e')]=_0x5d071f[_0x141c('0x5e')][_0x141c('0x28')];break;case _0x141c('0x86'):_0x40c391[_0x141c('0x5e')][_0x141c('0x80')]=_0x5d071f['body'][_0x141c('0x80')];_0x40c391[_0x141c('0x5e')]['body']=_0x5d071f[_0x141c('0x5e')][_0x141c('0x5e')];_0x40c391[_0x141c('0x5e')]['messageId']=_0x5d071f['body']['message_id'];break;case _0x141c('0x87'):_0x40c391['body'][_0x141c('0x80')]=_0x5d071f[_0x141c('0x5e')]['From'];_0x40c391[_0x141c('0x5e')][_0x141c('0x5e')]=_0x5d071f[_0x141c('0x5e')][_0x141c('0x88')];_0x40c391[_0x141c('0x5e')][_0x141c('0x89')]=_0x5d071f['body'][_0x141c('0x8a')];break;case _0x141c('0x8b'):_0x40c391['body'][_0x141c('0x80')]='+'+_0x5d071f[_0x141c('0x5e')][_0x141c('0x8c')][0x0][_0x141c('0x80')];_0x40c391[_0x141c('0x5e')][_0x141c('0x5e')]=_0x5d071f[_0x141c('0x5e')][_0x141c('0x8c')][0x0]['text'];_0x40c391[_0x141c('0x5e')][_0x141c('0x89')]=_0x5d071f[_0x141c('0x5e')][_0x141c('0x8c')][0x0][_0x141c('0x89')];break;case _0x141c('0x8d'):_0x40c391['body'][_0x141c('0x80')]=_0x5d071f['body'][_0x141c('0x8e')];_0x40c391[_0x141c('0x5e')][_0x141c('0x5e')]=_0x5d071f['body'][_0x141c('0x8f')][_0x141c('0x28')];break;case _0x141c('0x90'):_0x40c391[_0x141c('0x5e')]['from']=_0x5d071f[_0x141c('0x5e')][_0x141c('0x91')];_0x40c391['body'][_0x141c('0x5e')]=_0x5d071f[_0x141c('0x5e')][_0x141c('0x92')];_0x40c391[_0x141c('0x5e')]['messageId']=_0x5d071f['body'][_0x141c('0x93')];break;case _0x141c('0x94'):_0x40c391[_0x141c('0x5e')]['messageId']=_0x5d071f[_0x141c('0x5e')][0x0][_0x141c('0x28')]['id'];_0x40c391['body']['from']=_0x5d071f[_0x141c('0x5e')][0x0][_0x141c('0x28')][_0x141c('0x80')];_0x40c391[_0x141c('0x5e')][_0x141c('0x5e')]=_0x5d071f['body'][0x0][_0x141c('0x28')][_0x141c('0x92')];break;case _0x141c('0x95'):_0x40c391[_0x141c('0x5e')]['from']=_0x5d071f[_0x141c('0x5e')][_0x141c('0x80')];_0x40c391[_0x141c('0x5e')][_0x141c('0x5e')]=_0x5d071f[_0x141c('0x5e')][_0x141c('0x28')];_0x40c391[_0x141c('0x5e')][_0x141c('0x89')]=_0x5d071f[_0x141c('0x5e')]['refid'];break;}}if(_0x40c391[_0x141c('0x5e')]['id']){delete _0x40c391[_0x141c('0x5e')]['id'];}if(_[_0x141c('0x96')](_0x40c391[_0x141c('0x5e')][_0x141c('0x80')])){throw new db['Sequelize'][(_0x141c('0x77'))](_0x141c('0x97'));}if(_[_0x141c('0x96')](_0x40c391[_0x141c('0x5e')]['body'])||_0x40c391[_0x141c('0x5e')][_0x141c('0x5e')]===''){throw new db[(_0x141c('0x98'))][(_0x141c('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x141c('0x96')](_0x40c391[_0x141c('0x5e')][_0x141c('0x99')])){throw new db[(_0x141c('0x98'))][(_0x141c('0x77'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d3d5c);}if(!_[_0x141c('0x9a')](_0x2d3d5c,_0x40c391[_0x141c('0x5e')][_0x141c('0x99')])){throw new db['Sequelize'][(_0x141c('0x77'))](_0x141c('0x9b')+_0x2d3d5c);}_0x568df8[_0x40c391['body'][_0x141c('0x99')]]=_0x40c391[_0x141c('0x5e')][_0x141c('0x80')];return db[_0x141c('0x9c')][_0x141c('0x56')]({'where':{'id':_0x40c391[_0x141c('0x73')][_0x141c('0x7d')]},'include':[{'model':db['CmContact'],'as':_0x141c('0x9d'),'where':_0x568df8,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x141c('0x20')](handleEntityNotFound(_0x2798b3,null))[_0x141c('0x20')](function(_0x7e656d){if(_0x7e656d){_0x40c391['list']=_[_0x141c('0x9e')](_0x7e656d,['Contacts']);if(_0x7e656d[_0x141c('0x9d')][_0x141c('0x6c')]){return _0x7e656d['Contacts'][0x0];}var _0x44cf65=_[_0x141c('0x18')](_0x40c391['body'],{'firstName':_0x40c391[_0x141c('0x5e')][_0x141c('0x80')],'ListId':_0x7e656d['id']});_0x44cf65[_0x40c391[_0x141c('0x5e')][_0x141c('0x99')]]=_0x40c391['body']['from'];return db[_0x141c('0x76')]['create'](_0x44cf65,{'fields':_0xdafb84,'raw':!![]});}})[_0x141c('0x20')](handleEntityNotFound(_0x2798b3,null))['then'](function(_0x2efe85){if(_0x2efe85){_0x40c391['contact']=_0x2efe85;var _0x290d07={'ContactId':_0x2efe85['id'],'phone':_0x40c391[_0x141c('0x5e')][_0x141c('0x80')],'SmsAccountId':_0x5d071f[_0x141c('0x53')]['id']};var _0x5d32ed={'ContactId':_0x2efe85['id'],'SmsAccountId':_0x5d071f['params']['id'],'closed':![]};return db[_0x141c('0x9f')][_0x141c('0x56')]({'where':_0x5d32ed})[_0x141c('0x20')](function(_0x2e870a){if(_0x2e870a){return[_0x2e870a,![]];}return db['SmsInteraction'][_0x141c('0x57')](_0x290d07)[_0x141c('0x20')](function(_0x30dc26){return[_0x30dc26,!![]];});});}})[_0x141c('0xa0')](function(_0x2cfe36,_0x53aa59){_0x40c391[_0x141c('0xa1')]=_0x2cfe36[_0x141c('0x38')]({'plain':!![]});_0x40c391['interaction']['created']=![];if(_0x53aa59){if(_0x40c391['account']['autoclose']){_0x40c391['applications'][_0x141c('0xa2')]({'id':0x0,'priority':_0x40c391[_0x141c('0xa3')][_0x141c('0x6c')]+0x1,'app':_0x141c('0xa4'),'appdata':_0x141c('0xa5'),'interval':_0x141c('0xa6')});}_0x40c391[_0x141c('0xa1')][_0x141c('0xa7')]=!![];}return db[_0x141c('0xa8')]['create']({'phone':_0x40c391[_0x141c('0x5e')][_0x141c('0x80')],'messageId':_0x40c391[_0x141c('0x5e')]['messageId'],'body':_0x40c391[_0x141c('0x5e')][_0x141c('0x5e')],'SmsAccountId':_0x5d071f[_0x141c('0x53')]['id'],'SmsInteractionId':_0x2cfe36['id'],'direction':'in','ContactId':_0x2cfe36[_0x141c('0xa9')],'AttachmentId':_0x40c391[_0x141c('0x5e')]['AttachmentId']});})[_0x141c('0x20')](function(_0x227d06){_0x40c391['message']=_0x227d06;if(_0x40c391[_0x141c('0xa1')]['UserId']){return db[_0x141c('0xaa')][_0x141c('0x56')]({'attributes':['id','name'],'where':{'id':_0x40c391['interaction']['UserId']}})[_0x141c('0x20')](function(_0x1ba58d){if(_0x1ba58d){_0x40c391['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x141c('0xab'),'appdata':_0x1ba58d[_0x141c('0x3b')]+','+(_0x40c391['account'][_0x141c('0xac')]||0xa),'interval':_0x141c('0xa6')});}return respondWithRpcPromise(_0x141c('0xad'),'startRouting',_0x40c391);});}return respondWithRpcPromise(_0x141c('0xad'),_0x141c('0xae'),_0x40c391);})[_0x141c('0x20')](function(_0x506909){if(_0x506909){var _0x1623bb=0xc8;var _0x54c23c=_0x141c('0xaf');logger[_0x141c('0x29')](_0x141c('0x23'),_0x54c23c,_0x1623bb,_0x141c('0xb0'));logger[_0x141c('0x22')](_0x141c('0xb1'),_0x54c23c,_0x1623bb,_0x141c('0xb0'),JSON[_0x141c('0x25')](_0x506909));if(_0x40c391['account'][_0x141c('0x43')]===_0x141c('0x7f')){return _0x2798b3[_0x141c('0x2c')](_0x1623bb)[_0x141c('0x31')](_0x141c('0xb2'),_0x141c('0xb3'))['send']('\x0a');}else{return _0x2798b3[_0x141c('0x2c')](_0x1623bb)[_0x141c('0x2e')](_0x506909);}}})[_0x141c('0x2a')](handleError(_0x2798b3,null));};exports[_0x141c('0xb4')]=function(_0x4bbf47,_0x41a55a){var _0x410a8e=_0x4bbf47['params']['id'];var _0x1a5ed9=_0x4bbf47[_0x141c('0x5e')];var _0x34c671=0xc8;var _0x581d7b=null;return db[_0x141c('0xb5')]['transaction']({'isolationLevel':db['sequelize'][_0x141c('0xb6')]['ISOLATION_LEVELS'][_0x141c('0xb7')]},function(_0x1f59ae){return db[_0x141c('0x41')][_0x141c('0x63')]({'where':{'id':_0x410a8e},'transaction':_0x1f59ae})['then'](function(_0x3a52fc){if(_0x3a52fc){return db[_0x141c('0x71')][_0x141c('0x37')]({'where':{'SmsAccountId':_0x410a8e},'transaction':_0x1f59ae})[_0x141c('0x20')](function(){var _0x6412f=_[_0x141c('0x40')](_0x1a5ed9,function(_0x230c03){_0x230c03[_0x141c('0x60')]=_0x410a8e;return _0x230c03;});return db['SmsApplication'][_0x141c('0xb8')](_0x6412f,{'transaction':_0x1f59ae});});}else{_0x34c671=0x194;_0x581d7b=[];}});})[_0x141c('0x20')](function(){if(_0x34c671!==0x194){return db[_0x141c('0x71')][_0x141c('0xb9')]({'where':{'SmsAccountId':_0x410a8e},'order':_0x141c('0x74')})[_0x141c('0x20')](function(_0x215f66){_0x581d7b=_0x215f66;});}})[_0x141c('0x2a')](function(_0x5853ac){_0x34c671=0x1f4;logger[_0x141c('0x26')](_0x5853ac[_0x141c('0x3a')]);if(_0x5853ac['name']){delete _0x5853ac[_0x141c('0x3b')];}_0x581d7b=_0x5853ac;})[_0x141c('0xba')](function(){if(_0x581d7b===null){_0x41a55a[_0x141c('0x2b')](_0x34c671);}else{if(_0x34c671===0x1f4){_0x41a55a[_0x141c('0x2c')](_0x34c671)[_0x141c('0x3c')](_0x581d7b);}else{_0x41a55a[_0x141c('0x2c')](_0x34c671)[_0x141c('0x2e')](_0x581d7b);}}});};exports[_0x141c('0xbb')]=function(_0x22bffb,_0x177e89,_0x13da1c){var _0x30d161={};var _0x5dcb04={};var _0x11f1ea;var _0x57bc32;return db['SmsAccount'][_0x141c('0x63')]({'where':{'id':_0x22bffb[_0x141c('0x53')]['id']}})[_0x141c('0x20')](handleEntityNotFound(_0x177e89,null))[_0x141c('0x20')](function(_0x28b088){if(_0x28b088){_0x11f1ea=_0x28b088;_0x5dcb04['model']=_[_0x141c('0x45')](db[_0x141c('0x71')]['rawAttributes']);_0x5dcb04['query']=_[_0x141c('0x45')](_0x22bffb[_0x141c('0x44')]);_0x5dcb04[_0x141c('0x46')]=_[_0x141c('0x47')](_0x5dcb04[_0x141c('0x48')],_0x5dcb04[_0x141c('0x44')]);_0x30d161['attributes']=_['intersection'](_0x5dcb04['model'],qs['fields'](_0x22bffb[_0x141c('0x44')][_0x141c('0x49')]));_0x30d161['attributes']=_0x30d161[_0x141c('0x4a')][_0x141c('0x6c')]?_0x30d161[_0x141c('0x4a')]:_0x5dcb04[_0x141c('0x48')];_0x30d161['order']=qs[_0x141c('0x4d')](_0x22bffb[_0x141c('0x44')]['sort']);_0x30d161[_0x141c('0x4e')]=qs['filters'](_[_0x141c('0x6d')](_0x22bffb[_0x141c('0x44')],_0x5dcb04[_0x141c('0x46')]));if(_0x22bffb['query']['filter']){_0x30d161[_0x141c('0x4e')]=_[_0x141c('0x4f')](_0x30d161[_0x141c('0x4e')],{'$or':_[_0x141c('0x40')](_0x30d161[_0x141c('0x4a')],function(_0x4208d5){var _0x54bf89={};_0x54bf89[_0x4208d5]={'$like':'%'+_0x22bffb[_0x141c('0x44')][_0x141c('0x66')]+'%'};return _0x54bf89;})});}_0x30d161=_[_0x141c('0x4f')]({},_0x30d161,_0x22bffb['options']);return _0x11f1ea['getApplications'](_0x30d161);}})['then'](function(_0x4ff588){if(_0x4ff588){_0x57bc32=_0x4ff588['length'];if(!_0x22bffb[_0x141c('0x44')]['hasOwnProperty']('nolimit')){_0x30d161[_0x141c('0x4c')]=qs[_0x141c('0x4c')](_0x22bffb['query'][_0x141c('0x4c')]);_0x30d161['offset']=qs[_0x141c('0x30')](_0x22bffb[_0x141c('0x44')][_0x141c('0x30')]);}return _0x11f1ea['getApplications'](_0x30d161);}})[_0x141c('0x20')](function(_0x534303){if(_0x534303){return _0x534303?{'count':_0x57bc32,'rows':_0x534303}:null;}})['then'](respondWithResult(_0x177e89,null))['catch'](handleError(_0x177e89,null));};exports[_0x141c('0xbc')]=function(_0x2e538c,_0x492814,_0x38078c){var _0xabb4a5={'raw':![],'where':{}};var _0x55a8e2={};var _0x5f3d82={'count':0x0,'rows':[]};return db['SmsAccount'][_0x141c('0x63')]({'where':{'id':_0x2e538c[_0x141c('0x53')]['id']}})[_0x141c('0x20')](handleEntityNotFound(_0x492814,null))['then'](function(_0x4b1f48){if(_0x4b1f48){_0x55a8e2[_0x141c('0x48')]=_[_0x141c('0x45')](db[_0x141c('0x9f')]['rawAttributes']);_0x55a8e2[_0x141c('0x44')]=_[_0x141c('0x45')](_0x2e538c[_0x141c('0x44')]);_0x55a8e2[_0x141c('0x46')]=_[_0x141c('0x47')](_0x55a8e2[_0x141c('0x48')],_0x55a8e2[_0x141c('0x44')]);_0xabb4a5[_0x141c('0x4a')]=_[_0x141c('0x47')](_0x55a8e2['model'],qs[_0x141c('0x49')](_0x2e538c[_0x141c('0x44')][_0x141c('0x49')]));_0xabb4a5[_0x141c('0x4a')]=_0xabb4a5[_0x141c('0x4a')][_0x141c('0x6c')]?_0xabb4a5[_0x141c('0x4a')]:_0x55a8e2[_0x141c('0x48')];if(!_0x2e538c[_0x141c('0x44')]['hasOwnProperty']('nolimit')){_0xabb4a5[_0x141c('0x4c')]=qs['limit'](_0x2e538c[_0x141c('0x44')][_0x141c('0x4c')]);_0xabb4a5['offset']=qs[_0x141c('0x30')](_0x2e538c[_0x141c('0x44')][_0x141c('0x30')]);}_0xabb4a5[_0x141c('0x65')]=qs[_0x141c('0x4d')](_0x2e538c['query'][_0x141c('0x4d')]);_0xabb4a5[_0x141c('0x4e')]=qs[_0x141c('0x46')](_['pick'](_0x2e538c[_0x141c('0x44')],_0x55a8e2[_0x141c('0x46')]));_0xabb4a5[_0x141c('0x4e')][_0x141c('0x60')]=_0x4b1f48['id'];if(_0x2e538c[_0x141c('0x44')][_0x141c('0x66')]){_0xabb4a5[_0x141c('0x4e')]=_['merge'](_0xabb4a5[_0x141c('0x4e')],{'$or':_[_0x141c('0x40')](_0xabb4a5[_0x141c('0x4a')],function(_0x33fa72){var _0x4db7ef={};_0x4db7ef[_0x33fa72]={'$like':'%'+_0x2e538c[_0x141c('0x44')][_0x141c('0x66')]+'%'};return _0x4db7ef;})});}_0xabb4a5=_[_0x141c('0x4f')]({},_0xabb4a5,_0x2e538c['options']);return db[_0x141c('0x9f')][_0x141c('0x2f')]({'where':_0xabb4a5['where']})['then'](function(_0x29e3d4){_0x5f3d82['count']=_0x29e3d4;if(_0x2e538c[_0x141c('0x44')][_0x141c('0x54')]){_0xabb4a5[_0x141c('0x55')]=[{'model':db[_0x141c('0x76')],'as':_0x141c('0xbd'),'required':![]},{'model':db[_0x141c('0xaa')],'as':_0x141c('0xbe'),'attributes':['name',_0x141c('0xbf'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x141c('0xc0'),'attributes':['id',_0x141c('0x3b'),_0x141c('0xc1')],'where':_0x2e538c[_0x141c('0x44')][_0x141c('0xc2')]?{'id':_0x2e538c[_0x141c('0x44')]['tag']}:undefined,'required':_0x2e538c[_0x141c('0x44')]['tag']?!![]:![]}];}return db[_0x141c('0x9f')][_0x141c('0x67')](_0xabb4a5);})[_0x141c('0x20')](function(_0x3c909d){_0x5f3d82['rows']=_0x3c909d;return _0x5f3d82;});}})[_0x141c('0x20')](respondWithFilteredResult(_0x492814,_0xabb4a5))[_0x141c('0x2a')](handleError(_0x492814,null));};exports['send']=function(_0x30bcb5,_0x7e22f3,_0x24ab33){var _0x1dcd07,_0x2aebce,_0x5e2956;if(_[_0x141c('0x96')](_0x30bcb5[_0x141c('0x5e')][_0x141c('0x5e')])||_0x30bcb5[_0x141c('0x5e')][_0x141c('0x5e')]===''){throw new db[(_0x141c('0x98'))][(_0x141c('0x77'))](_0x141c('0xc3'));}if(_[_0x141c('0x96')](_0x30bcb5[_0x141c('0x5e')]['to'])){throw new db[(_0x141c('0x98'))][(_0x141c('0x77'))](_0x141c('0xc4'));}_0x1dcd07=_0x30bcb5['body']['to'];return db['SmsAccount'][_0x141c('0x56')]({'where':{'id':_0x30bcb5[_0x141c('0x53')]['id']},'include':[{'model':db[_0x141c('0x9c')],'as':_0x141c('0xc5'),'include':[{'model':db[_0x141c('0x76')],'as':_0x141c('0x9d'),'where':{'mobile':_0x1dcd07},'limit':0x1,'order':[[_0x141c('0x7b'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x7e22f3,null))['then'](function(_0x50b81f){if(_0x50b81f&&_0x50b81f[_0x141c('0xc5')]){_0x2aebce=_0x50b81f[_0x141c('0x38')]({'plain':!![]});if(_0x2aebce[_0x141c('0xc5')]&&_0x2aebce[_0x141c('0xc5')][_0x141c('0x9d')][_0x141c('0x6c')]){return _0x2aebce['List']['Contacts'][0x0];}return db[_0x141c('0x76')][_0x141c('0x57')](_[_0x141c('0x18')](_0x30bcb5[_0x141c('0x5e')],{'firstName':_0x1dcd07,'mobile':_0x1dcd07,'phone':_0x1dcd07,'ListId':_0x2aebce[_0x141c('0x7d')]}));}})['then'](handleEntityNotFound(_0x7e22f3,null))[_0x141c('0x20')](function(_0x4a0667){if(_0x4a0667){_0x5e2956=_0x4a0667;return db[_0x141c('0x9f')]['find']({'where':{'ContactId':_0x5e2956['id'],'closed':![],'SmsAccountId':_0x2aebce['id']}})['then'](function(_0x1284db){if(_0x1284db){return[_0x1284db,![]];}return db[_0x141c('0x9f')][_0x141c('0x57')]({'UserId':_0x30bcb5[_0x141c('0x5a')]['id'],'ContactId':_0x5e2956['id'],'SmsAccountId':_0x2aebce['id'],'phone':_0x1dcd07,'firstMsgDirection':_0x141c('0xc6'),'Messages':[_['merge'](_0x30bcb5[_0x141c('0x5e')],{'read':![],'body':_0x30bcb5[_0x141c('0x5e')][_0x141c('0x5e')],'phone':_0x1dcd07,'SmsAccountId':_0x2aebce['id'],'UserId':_0x30bcb5[_0x141c('0x5a')]['id'],'ContactId':_0x5e2956['id']})]},{'include':[{'model':db[_0x141c('0xa8')],'as':'Messages'}]})[_0x141c('0x20')](function(_0x5b1cb6){return[_0x5b1cb6,!![]];});});}})[_0x141c('0xa0')](function(_0x3c8f0d,_0x672149){if(_0x672149){return _0x3c8f0d;}return db['SmsMessage']['create'](_[_0x141c('0x4f')](_0x30bcb5[_0x141c('0x5e')],{'read':![],'body':_0x30bcb5['body'][_0x141c('0x5e')],'phone':_0x1dcd07,'SmsAccountId':_0x2aebce['id'],'SmsInteractionId':_0x3c8f0d['id'],'UserId':_0x30bcb5[_0x141c('0x5a')]['id'],'ContactId':_0x5e2956['id']}))[_0x141c('0x20')](function(_0x25c563){_0x3c8f0d[_0x141c('0xc7')][_0x141c('0xc8')]=[];_0x3c8f0d[_0x141c('0xc7')][_0x141c('0xc8')][_0x141c('0xa2')](_0x25c563[_0x141c('0xc7')]);return _0x3c8f0d;});})['then'](respondWithResult(_0x7e22f3,null))[_0x141c('0x2a')](handleError(_0x7e22f3,null));};exports[_0x141c('0x2c')]=function(_0x25bee2,_0x57f2cd,_0x22e6bb){if(_0x25bee2[_0x141c('0x5e')]['id']){delete _0x25bee2[_0x141c('0x5e')]['id'];}var _0x5c3111,_0x1952f7,_0x2903bb;return db[_0x141c('0x41')][_0x141c('0x56')]({'where':{'id':_0x25bee2['params']['id']}})[_0x141c('0x20')](handleEntityNotFound(_0x57f2cd,null))[_0x141c('0x20')](function(_0x30097b){if(_0x30097b){_0x2903bb=_0x30097b;logger[_0x141c('0x22')](_0x141c('0x23'),_0x141c('0x2c'),_0x141c('0xc9'),_0x30097b[_0x141c('0x43')],util[_0x141c('0xca')](_0x25bee2[_0x141c('0x5e')],{'showHidden':![],'depth':null}));switch(_0x30097b[_0x141c('0x43')]){case _0x141c('0x84'):if(_0x25bee2[_0x141c('0x5e')][_0x141c('0xcb')]&&_0x25bee2[_0x141c('0x5e')]['status']){_0x1952f7=_0x25bee2[_0x141c('0x5e')]['status'];return db[_0x141c('0xa8')][_0x141c('0x56')]({'where':{'messageId':_0x25bee2[_0x141c('0x5e')][_0x141c('0xcb')]}});}break;case'connectel':if(_0x25bee2['body'][_0x141c('0xcc')]&&_0x25bee2[_0x141c('0x5e')][_0x141c('0xcd')]){_0x1952f7=_0x25bee2[_0x141c('0x5e')][_0x141c('0xcd')];return db[_0x141c('0xa8')][_0x141c('0x56')]({'where':{'messageId':_0x25bee2['body'][_0x141c('0xcc')]}});}break;case _0x141c('0x86'):if(_0x25bee2[_0x141c('0x5e')][_0x141c('0xce')]&&_0x25bee2[_0x141c('0x5e')][_0x141c('0xcf')]){_0x1952f7=_0x25bee2[_0x141c('0x5e')][_0x141c('0xcf')];return db[_0x141c('0xa8')][_0x141c('0x56')]({'where':{'messageId':_0x25bee2[_0x141c('0x5e')][_0x141c('0xce')]}});}break;case _0x141c('0x8b'):var _0xb79e11=_0x25bee2[_0x141c('0x5e')]['results'][0x0];if(_0xb79e11['messageId']&&_0xb79e11[_0x141c('0x2c')][_0x141c('0xd0')]===_0x141c('0xd1')){_0x1952f7=_0xb79e11['status'][_0x141c('0xd0')];return db[_0x141c('0xa8')][_0x141c('0x56')]({'where':{'messageId':_0xb79e11[_0x141c('0x89')]}});}break;case _0x141c('0x90'):if(_0x25bee2[_0x141c('0x5e')][_0x141c('0x89')]&&_0x25bee2['body'][_0x141c('0x2c')]){_0x1952f7=_0x25bee2[_0x141c('0x5e')]['status'];return db[_0x141c('0xa8')]['find']({'where':{'messageId':_0x25bee2[_0x141c('0x5e')]['messageId']}});}break;case _0x141c('0x94'):if(_0x25bee2['body'][0x0]['message']['id']){_0x1952f7=_0x25bee2['body'][0x0][_0x141c('0x43')];return db[_0x141c('0xa8')][_0x141c('0x56')]({'where':{'messageId':_0x25bee2[_0x141c('0x5e')][0x0]['message']['id']}});}break;case _0x141c('0x95'):if(_0x25bee2['body'][_0x141c('0xd2')]&&_0x25bee2[_0x141c('0x5e')][_0x141c('0x2c')]){_0x1952f7=_0x25bee2[_0x141c('0x5e')][_0x141c('0x2c')];return db['SmsMessage']['find']({'where':{'messageId':_0x25bee2[_0x141c('0x5e')]['redif']}});}break;}}})[_0x141c('0x20')](handleEntityNotFound(_0x57f2cd,null))[_0x141c('0x20')](function(_0x32c794){if(_0x32c794){_0x5c3111=_0x32c794;switch(_0x2903bb[_0x141c('0x43')]){case _0x141c('0x84'):if(_0x1952f7===_0x141c('0xd1')){return _0x5c3111[_0x141c('0x36')]({'read':!![]});}else{logger[_0x141c('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x141c('0x2c'),_0x141c('0x84'),util['inspect'](_0x25bee2[_0x141c('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x141c('0x85'):if(_0x1952f7==='1'){return _0x5c3111[_0x141c('0x36')]({'read':!![]});}else{logger[_0x141c('0x26')](_0x141c('0x23'),_0x141c('0x2c'),_0x141c('0x84'),util[_0x141c('0xca')](_0x25bee2['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x25bee2[_0x141c('0x5e')][_0x141c('0xd3')]&&_0x1952f7>=0xc8&&_0x1952f7<=0xce){return _0x5c3111[_0x141c('0x36')]({'read':!![]});}else{logger[_0x141c('0x26')](_0x141c('0x23'),_0x141c('0x2c'),_0x141c('0x86'),util[_0x141c('0xca')](_0x25bee2['body'],{'showHidden':![],'depth':null}));}break;case _0x141c('0x8b'):var _0x197926=_0x25bee2['body'][_0x141c('0x8c')][0x0];if(_0x197926[_0x141c('0x2c')][_0x141c('0xd0')]===_0x141c('0xd1')){return _0x5c3111[_0x141c('0x36')]({'read':!![]});}else{logger[_0x141c('0x26')](_0x141c('0x23'),'status',_0x141c('0x8b'),util['inspect'](_0x25bee2[_0x141c('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x141c('0x90'):if(_0x1952f7==_0x141c('0xd4')||_0x1952f7==_0x141c('0xd5')){return _0x5c3111['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x141c('0x2c'),_0x141c('0x90'),util[_0x141c('0xca')](_0x25bee2[_0x141c('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x141c('0x94'):if(_0x1952f7==_0x141c('0xd6')){return _0x5c3111[_0x141c('0x36')]({'read':!![]});}else{logger[_0x141c('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x141c('0x2c'),_0x141c('0x94'),util[_0x141c('0xca')](_0x25bee2['body'],{'showHidden':![],'depth':null}));}break;case _0x141c('0x95'):if(_0x1952f7===_0x141c('0xd7')||_0x1952f7===_0x141c('0xd8')){return _0x5c3111[_0x141c('0x36')]({'read':!![]});}else{logger[_0x141c('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x141c('0x2c'),_0x141c('0x95'),util[_0x141c('0xca')](_0x25bee2[_0x141c('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x5c3111;}})[_0x141c('0x20')](respondWithResult(_0x57f2cd,null))[_0x141c('0x2a')](handleError(_0x57f2cd,null));};exports[_0x141c('0xd9')]=function(_0x2fffff,_0x14860f,_0x224c30){var _0x2bc275,_0x38cf86,_0x319262;return db[_0x141c('0x41')]['find']({'where':{'id':_0x2fffff[_0x141c('0x53')]['id']}})[_0x141c('0x20')](handleEntityNotFound(_0x14860f,null))['then'](function(_0x35429d){if(_0x35429d){_0x319262=_0x35429d;logger[_0x141c('0x22')](_0x141c('0x23'),'status',_0x141c('0xc9'),_0x35429d[_0x141c('0x43')],util[_0x141c('0xca')](_0x2fffff[_0x141c('0x44')],{'showHidden':![],'depth':null}));switch(_0x35429d[_0x141c('0x43')]){case _0x141c('0x8d'):if(_0x2fffff[_0x141c('0x44')][_0x141c('0xda')]&&_0x2fffff['query'][_0x141c('0xdb')]){_0x38cf86=_0x2fffff[_0x141c('0x44')][_0x141c('0xdb')];return db[_0x141c('0xa8')][_0x141c('0x56')]({'where':{'messageId':_0x2fffff[_0x141c('0x44')][_0x141c('0xda')]}});}break;}}})['then'](handleEntityNotFound(_0x14860f,null))['then'](function(_0x5cd61a){if(_0x5cd61a){_0x2bc275=_0x5cd61a;switch(_0x319262[_0x141c('0x43')]){case'csc':if(_0x38cf86==='2'||_0x38cf86==='6'){return _0x2bc275[_0x141c('0x36')]({'read':!![]});}else{logger['error'](_0x141c('0x23'),'status','csc',util[_0x141c('0xca')](_0x2fffff['query'],{'showHidden':![],'depth':null}));};break;}return _0x2bc275;}})['then'](respondWithResult(_0x14860f,null))[_0x141c('0x2a')](handleError(_0x14860f,null));};exports[_0x141c('0xdc')]=function(_0x2a2126,_0x3f38d3,_0x3e893a){return db[_0x141c('0x41')][_0x141c('0x56')]({'where':{'id':_0x2a2126['params']['id']}})[_0x141c('0x20')](handleEntityNotFound(_0x3f38d3,null))[_0x141c('0x20')](function(_0x40effa){if(_0x40effa){return _0x40effa[_0x141c('0xdc')](_0x2a2126[_0x141c('0x5e')][_0x141c('0x69')],_[_0x141c('0x9e')](_0x2a2126[_0x141c('0x5e')],[_0x141c('0x69'),'id'])||{})[_0x141c('0xa0')](function(_0x3d1813){for(var _0x5b5bb8=0x0;_0x5b5bb8<_0x2a2126['body'][_0x141c('0x69')][_0x141c('0x6c')];_0x5b5bb8+=0x1){socket[_0x141c('0xdd')](_0x141c('0xde'),{'UserId':Number(_0x2a2126['body'][_0x141c('0x69')][_0x5b5bb8]),'SmsAccountId':Number(_0x2a2126['params']['id'])});}return _0x3d1813;});}})['then'](respondWithResult(_0x3f38d3,null))['catch'](handleError(_0x3f38d3,null));};exports[_0x141c('0xdf')]=function(_0x5f4999,_0x1b75f2,_0x33ebea){return db[_0x141c('0x41')]['find']({'where':{'id':_0x5f4999[_0x141c('0x53')]['id']}})[_0x141c('0x20')](handleEntityNotFound(_0x1b75f2,null))[_0x141c('0x20')](function(_0x243575){if(_0x243575){return _0x243575[_0x141c('0xdf')](_0x5f4999[_0x141c('0x44')][_0x141c('0x69')])[_0x141c('0x20')](function(){if(_[_0x141c('0xe0')](_0x5f4999[_0x141c('0x44')][_0x141c('0x69')])){for(var _0x12672a=0x0;_0x12672a<_0x5f4999[_0x141c('0x44')]['ids'][_0x141c('0x6c')];_0x12672a+=0x1){socket[_0x141c('0xdd')](_0x141c('0xe1'),{'UserId':Number(_0x5f4999[_0x141c('0x44')][_0x141c('0x69')][_0x12672a]),'SmsAccountId':Number(_0x5f4999['params']['id'])});}}else{socket[_0x141c('0xdd')]('userSmsAccount:remove',{'UserId':Number(_0x5f4999['query'][_0x141c('0x69')]),'SmsAccountId':Number(_0x5f4999[_0x141c('0x53')]['id'])});}});}})[_0x141c('0x20')](respondWithStatusCode(_0x1b75f2,null))[_0x141c('0x2a')](handleError(_0x1b75f2,null));};exports[_0x141c('0xe2')]=function(_0x5d8aef,_0x3e2545,_0x35f470){var _0x3b6976={};var _0x3ef653={};var _0x1a59a9;var _0x4417fd;return db[_0x141c('0x41')][_0x141c('0x63')]({'where':{'id':_0x5d8aef['params']['id']}})[_0x141c('0x20')](handleEntityNotFound(_0x3e2545,null))[_0x141c('0x20')](function(_0x52ca55){if(_0x52ca55){_0x1a59a9=_0x52ca55;_0x3ef653['model']=_['keys'](db[_0x141c('0xaa')]['rawAttributes']);_0x3ef653[_0x141c('0x44')]=_[_0x141c('0x45')](_0x5d8aef['query']);_0x3ef653['filters']=_['intersection'](_0x3ef653[_0x141c('0x48')],_0x3ef653[_0x141c('0x44')]);_0x3b6976[_0x141c('0x4a')]=_['intersection'](_0x3ef653[_0x141c('0x48')],qs[_0x141c('0x49')](_0x5d8aef[_0x141c('0x44')][_0x141c('0x49')]));_0x3b6976[_0x141c('0x4a')]=_0x3b6976[_0x141c('0x4a')]['length']?_0x3b6976[_0x141c('0x4a')]:_0x3ef653['model'];_0x3b6976[_0x141c('0x65')]=qs[_0x141c('0x4d')](_0x5d8aef['query'][_0x141c('0x4d')]);_0x3b6976['where']=qs[_0x141c('0x46')](_['pick'](_0x5d8aef[_0x141c('0x44')],_0x3ef653[_0x141c('0x46')]));if(_0x5d8aef['query'][_0x141c('0x66')]){_0x3b6976[_0x141c('0x4e')]=_['merge'](_0x3b6976[_0x141c('0x4e')],{'$or':_[_0x141c('0x40')](_0x3b6976[_0x141c('0x4a')],function(_0x3407b5){var _0x4066bd={};_0x4066bd[_0x3407b5]={'$like':'%'+_0x5d8aef['query']['filter']+'%'};return _0x4066bd;})});}_0x3b6976=_[_0x141c('0x4f')]({},_0x3b6976,_0x5d8aef[_0x141c('0x50')]);return _0x1a59a9['getAgents'](_0x3b6976);}})[_0x141c('0x20')](function(_0xe60a0f){if(_0xe60a0f){_0x4417fd=_0xe60a0f['length'];if(!_0x5d8aef[_0x141c('0x44')][_0x141c('0x4b')](_0x141c('0x64'))){_0x3b6976[_0x141c('0x4c')]=qs[_0x141c('0x4c')](_0x5d8aef[_0x141c('0x44')][_0x141c('0x4c')]);_0x3b6976['offset']=qs[_0x141c('0x30')](_0x5d8aef[_0x141c('0x44')][_0x141c('0x30')]);}return _0x1a59a9['getAgents'](_0x3b6976);}})[_0x141c('0x20')](function(_0x4aeae0){if(_0x4aeae0){return _0x4aeae0?{'count':_0x4417fd,'rows':_0x4aeae0}:null;}})[_0x141c('0x20')](respondWithResult(_0x3e2545,null))['catch'](handleError(_0x3e2545,null));}; \ No newline at end of file +var _0x49b0=['undefined','limit','count','status','Content-Range','reject','save','get','SmsAccounts','UserProfileResource','destroy','stack','name','index','Pause','map','SmsAccount','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','results','csc','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','Contacts','contact','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','User','fullname','internal','Tag','Tags','color','tag','List','Messages','spread','SmsMessage','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','redif','update','error_code','DELIVERED_TO_GATEWAY','DELIVRD','ACCEPTD','message-id','state','addAgents','omit','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','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','register','jayson/promise','client','http','request','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','end','json','offset'];(function(_0x8278ab,_0x4b7844){var _0x185305=function(_0x255268){while(--_0x255268){_0x8278ab['push'](_0x8278ab['shift']());}};_0x185305(++_0x4b7844);}(_0x49b0,0xb7));var _0x049b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x49b0[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x049b('0x0'));var rimraf=require(_0x049b('0x1'));var zipdir=require(_0x049b('0x2'));var jsonpatch=require(_0x049b('0x3'));var rp=require(_0x049b('0x4'));var moment=require(_0x049b('0x5'));var BPromise=require(_0x049b('0x6'));var Mustache=require(_0x049b('0x7'));var util=require(_0x049b('0x8'));var path=require(_0x049b('0x9'));var sox=require(_0x049b('0xa'));var csv=require(_0x049b('0xb'));var ejs=require(_0x049b('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x049b('0xd'));var squel=require('squel');var crypto=require(_0x049b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x049b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x049b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x049b('0x11'));var as=require(_0x049b('0x12'));var hardwareService=require(_0x049b('0x13'));var logger=require(_0x049b('0x14'))(_0x049b('0x15'));var utils=require(_0x049b('0x16'));var config=require(_0x049b('0x17'));var licenseUtil=require(_0x049b('0x18'));var db=require(_0x049b('0x19'))['db'];config['redis']=_[_0x049b('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x049b('0x1b'))(new Redis(config[_0x049b('0x1c')]));require('./smsAccount.socket')[_0x049b('0x1d')](socket);var jayson=require(_0x049b('0x1e'));var client=jayson[_0x049b('0x1f')][_0x049b('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x222854,_0x2d3988,_0x348020,_0x52f0c5){return new BPromise(function(_0x97b574,_0x4fac33){var _0x29898a=_0x52f0c5||client;return _0x29898a[_0x049b('0x21')](_0x222854,_0x348020)[_0x049b('0x22')](function(_0xc93b92){logger[_0x049b('0x23')]('SmsAccount,\x20%s,\x20%s',_0x2d3988,_0x049b('0x24'));logger['debug'](_0x049b('0x25'),_0x2d3988,_0x049b('0x24'),JSON[_0x049b('0x26')](_0xc93b92));if(_0xc93b92['error']){if(_0xc93b92[_0x049b('0x27')]['code']===0x1f4){logger['error'](_0x049b('0x28'),_0x2d3988,_0xc93b92[_0x049b('0x27')][_0x049b('0x29')]);return _0x4fac33(_0xc93b92[_0x049b('0x27')][_0x049b('0x29')]);}logger['error'](_0x049b('0x28'),_0x2d3988,_0xc93b92[_0x049b('0x27')][_0x049b('0x29')]);return _0x97b574(_0xc93b92['error']['message']);}else{logger[_0x049b('0x23')](_0x049b('0x28'),_0x2d3988,'request\x20sent');_0x97b574(_0xc93b92[_0x049b('0x2a')][_0x049b('0x29')]);}})['catch'](function(_0x3b0a4e){logger[_0x049b('0x27')](_0x049b('0x28'),_0x2d3988,_0x3b0a4e);_0x4fac33(_0x3b0a4e);});});}function respondWithStatusCode(_0x52c5c8,_0x3fe786){_0x3fe786=_0x3fe786||0xcc;return function(_0x479aac){if(_0x479aac){return _0x52c5c8[_0x049b('0x2b')](_0x3fe786);}return _0x52c5c8['status'](_0x3fe786)[_0x049b('0x2c')]();};}function respondWithResult(_0x8b6eb3,_0x23bc71){_0x23bc71=_0x23bc71||0xc8;return function(_0x1f5e8f){if(_0x1f5e8f){return _0x8b6eb3['status'](_0x23bc71)[_0x049b('0x2d')](_0x1f5e8f);}};}function respondWithFilteredResult(_0x8e225d,_0x53a861){return function(_0x309efa){if(_0x309efa){var _0x2a0f2f=typeof _0x53a861[_0x049b('0x2e')]===_0x049b('0x2f')&&typeof _0x53a861[_0x049b('0x30')]===_0x049b('0x2f');var _0x2d7dd5=_0x309efa[_0x049b('0x31')];var _0x9c2bd6=_0x2a0f2f?0x0:_0x53a861[_0x049b('0x2e')];var _0x42ad0c=_0x2a0f2f?_0x309efa[_0x049b('0x31')]:_0x53a861[_0x049b('0x2e')]+_0x53a861[_0x049b('0x30')];var _0x4aa243;if(_0x42ad0c>=_0x2d7dd5){_0x42ad0c=_0x2d7dd5;_0x4aa243=0xc8;}else{_0x4aa243=0xce;}_0x8e225d[_0x049b('0x32')](_0x4aa243);return _0x8e225d['set'](_0x049b('0x33'),_0x9c2bd6+'-'+_0x42ad0c+'/'+_0x2d7dd5)[_0x049b('0x2d')](_0x309efa);}return null;};}function patchUpdates(_0x464365){return function(_0x20b2cf){try{jsonpatch['apply'](_0x20b2cf,_0x464365,!![]);}catch(_0x1a3281){return BPromise[_0x049b('0x34')](_0x1a3281);}return _0x20b2cf[_0x049b('0x35')]();};}function saveUpdates(_0x2e1353,_0x325aeb){return function(_0x5acec8){if(_0x5acec8){return _0x5acec8['update'](_0x2e1353)[_0x049b('0x22')](function(_0x93a178){return _0x93a178;});}return null;};}function removeEntity(_0x40cf1f,_0x40cee6){return function(_0x1c8daa){if(_0x1c8daa){return _0x1c8daa['destroy']()['then'](function(){var _0x3cfc01=_0x1c8daa[_0x049b('0x36')]({'plain':!![]});var _0x4e0535=_0x049b('0x37');return db[_0x049b('0x38')][_0x049b('0x39')]({'where':{'type':_0x4e0535,'resourceId':_0x3cfc01['id']}})[_0x049b('0x22')](function(){return _0x1c8daa;});})[_0x049b('0x22')](function(){_0x40cf1f[_0x049b('0x32')](0xcc)[_0x049b('0x2c')]();});}};}function handleEntityNotFound(_0x50e7ec,_0xb08f8a){return function(_0x39fd0a){if(!_0x39fd0a){_0x50e7ec[_0x049b('0x2b')](0x194);}return _0x39fd0a;};}function handleError(_0x2b4b33,_0x5c057e){_0x5c057e=_0x5c057e||0x1f4;return function(_0x1f359f){logger[_0x049b('0x27')](_0x1f359f[_0x049b('0x3a')]);if(_0x1f359f[_0x049b('0x3b')]){delete _0x1f359f['name'];}_0x2b4b33[_0x049b('0x32')](_0x5c057e)['send'](_0x1f359f);};}exports[_0x049b('0x3c')]=function(_0xaad0ec,_0x1a9707){var _0x10f633={'include':[{'model':db[_0x049b('0x3d')],'as':'mandatoryDispositionPause'}]},_0xb67823={},_0x23afb0={'count':0x0,'rows':[]};var _0x398f14=_[_0x049b('0x3e')](db[_0x049b('0x3f')][_0x049b('0x40')],function(_0xebbb0c){return{'name':_0xebbb0c['fieldName'],'type':_0xebbb0c[_0x049b('0x41')][_0x049b('0x42')]};});_0xb67823[_0x049b('0x43')]=_[_0x049b('0x3e')](_0x398f14,'name');_0xb67823[_0x049b('0x44')]=_[_0x049b('0x45')](_0xaad0ec['query']);_0xb67823['filters']=_[_0x049b('0x46')](_0xb67823[_0x049b('0x43')],_0xb67823[_0x049b('0x44')]);_0x10f633[_0x049b('0x47')]=_[_0x049b('0x46')](_0xb67823[_0x049b('0x43')],qs['fields'](_0xaad0ec[_0x049b('0x44')][_0x049b('0x48')]));_0x10f633[_0x049b('0x47')]=_0x10f633['attributes'][_0x049b('0x49')]?_0x10f633['attributes']:_0xb67823[_0x049b('0x43')];if(!_0xaad0ec[_0x049b('0x44')][_0x049b('0x4a')](_0x049b('0x4b'))){_0x10f633[_0x049b('0x30')]=qs['limit'](_0xaad0ec[_0x049b('0x44')]['limit']);_0x10f633[_0x049b('0x2e')]=qs[_0x049b('0x2e')](_0xaad0ec[_0x049b('0x44')][_0x049b('0x2e')]);}_0x10f633[_0x049b('0x4c')]=qs[_0x049b('0x4d')](_0xaad0ec[_0x049b('0x44')][_0x049b('0x4d')]);_0x10f633['where']=qs[_0x049b('0x4e')](_[_0x049b('0x4f')](_0xaad0ec[_0x049b('0x44')],_0xb67823[_0x049b('0x4e')]),_0x398f14);if(_0xaad0ec[_0x049b('0x44')]['filter']){_0x10f633[_0x049b('0x50')]=_[_0x049b('0x51')](_0x10f633[_0x049b('0x50')],{'$or':_[_0x049b('0x3e')](_0x398f14,function(_0x3a39f8){if(_0x3a39f8[_0x049b('0x41')]!=='VIRTUAL'){var _0x177049={};_0x177049[_0x3a39f8['name']]={'$like':'%'+_0xaad0ec[_0x049b('0x44')][_0x049b('0x52')]+'%'};return _0x177049;}})});}_0x10f633=_[_0x049b('0x51')]({},_0x10f633,_0xaad0ec[_0x049b('0x53')]);var _0x1130ee={'where':_0x10f633[_0x049b('0x50')]};return db[_0x049b('0x3f')][_0x049b('0x31')](_0x1130ee)[_0x049b('0x22')](function(_0x5a280f){_0x23afb0[_0x049b('0x31')]=_0x5a280f;if(_0xaad0ec[_0x049b('0x44')][_0x049b('0x54')]){_0x10f633[_0x049b('0x55')]=[{'all':!![]}];}return db[_0x049b('0x3f')][_0x049b('0x56')](_0x10f633);})['then'](function(_0x25d86a){_0x23afb0[_0x049b('0x57')]=_0x25d86a;return _0x23afb0;})[_0x049b('0x22')](respondWithFilteredResult(_0x1a9707,_0x10f633))[_0x049b('0x58')](handleError(_0x1a9707,null));};exports[_0x049b('0x59')]=function(_0x5e4f5c,_0x16d815){var _0x393b53={'raw':![],'where':{'id':_0x5e4f5c[_0x049b('0x5a')]['id']},'include':[{'model':db[_0x049b('0x3d')],'as':_0x049b('0x5b')}]},_0x428b61={};_0x428b61['model']=_[_0x049b('0x45')](db[_0x049b('0x3f')][_0x049b('0x40')]);_0x428b61['query']=_['keys'](_0x5e4f5c[_0x049b('0x44')]);_0x428b61[_0x049b('0x4e')]=_[_0x049b('0x46')](_0x428b61[_0x049b('0x43')],_0x428b61[_0x049b('0x44')]);_0x393b53[_0x049b('0x47')]=_[_0x049b('0x46')](_0x428b61[_0x049b('0x43')],qs['fields'](_0x5e4f5c[_0x049b('0x44')]['fields']));_0x393b53[_0x049b('0x47')]=_0x393b53[_0x049b('0x47')]['length']?_0x393b53[_0x049b('0x47')]:_0x428b61[_0x049b('0x43')];if(_0x5e4f5c[_0x049b('0x44')]['includeAll']){_0x393b53[_0x049b('0x55')]=[{'all':!![]}];}_0x393b53=_[_0x049b('0x51')]({},_0x393b53,_0x5e4f5c['options']);return db['SmsAccount'][_0x049b('0x5c')](_0x393b53)[_0x049b('0x22')](handleEntityNotFound(_0x16d815,null))[_0x049b('0x22')](respondWithResult(_0x16d815,null))['catch'](handleError(_0x16d815,null));};exports[_0x049b('0x5d')]=function(_0x42abb6,_0x2aa86b){return db[_0x049b('0x3f')][_0x049b('0x5d')](_0x42abb6[_0x049b('0x5e')],{})[_0x049b('0x22')](function(_0x2cc32c){var _0x3ed60b=_0x42abb6['user'][_0x049b('0x36')]({'plain':!![]});if(!_0x3ed60b)throw new Error(_0x049b('0x5f'));if(_0x3ed60b['role']===_0x049b('0x60')){var _0x39f971=_0x2cc32c[_0x049b('0x36')]({'plain':!![]});var _0x224e36=_0x049b('0x37');return db[_0x049b('0x61')][_0x049b('0x5c')]({'where':{'name':_0x224e36,'userProfileId':_0x3ed60b[_0x049b('0x62')]},'raw':!![]})[_0x049b('0x22')](function(_0x241d3a){if(_0x241d3a&&_0x241d3a[_0x049b('0x63')]===0x0){return db[_0x049b('0x38')][_0x049b('0x5d')]({'name':_0x39f971[_0x049b('0x3b')],'resourceId':_0x39f971['id'],'type':_0x241d3a[_0x049b('0x3b')],'sectionId':_0x241d3a['id']},{})[_0x049b('0x22')](function(){return _0x2cc32c;});}else{return _0x2cc32c;}})[_0x049b('0x58')](function(_0x2f28ef){logger[_0x049b('0x27')](_0x049b('0x64'),_0x2f28ef);throw _0x2f28ef;});}return _0x2cc32c;})[_0x049b('0x22')](respondWithResult(_0x2aa86b,0xc9))['catch'](handleError(_0x2aa86b,null));};exports['update']=function(_0x36147e,_0x101c45){if(_0x36147e[_0x049b('0x5e')]['id']){delete _0x36147e[_0x049b('0x5e')]['id'];}return db['SmsAccount'][_0x049b('0x5c')]({'where':{'id':_0x36147e[_0x049b('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x101c45,null))[_0x049b('0x22')](saveUpdates(_0x36147e[_0x049b('0x5e')],null))['then'](respondWithResult(_0x101c45,null))[_0x049b('0x58')](handleError(_0x101c45,null));};exports[_0x049b('0x39')]=function(_0x562956,_0x2efd2b){return db[_0x049b('0x3f')][_0x049b('0x5c')]({'where':{'id':_0x562956[_0x049b('0x5a')]['id']}})[_0x049b('0x22')](handleEntityNotFound(_0x2efd2b,null))[_0x049b('0x22')](removeEntity(_0x2efd2b,null))[_0x049b('0x58')](handleError(_0x2efd2b,null));};exports[_0x049b('0x65')]=function(_0xa627d4,_0x3eb0bf){return db[_0x049b('0x3f')][_0x049b('0x65')]()[_0x049b('0x22')](respondWithResult(_0x3eb0bf,null))[_0x049b('0x58')](handleError(_0x3eb0bf,null));};exports[_0x049b('0x66')]=function(_0x2b0cc9,_0x4061d1,_0xbefa48){if(_0x2b0cc9['body']['id']){delete _0x2b0cc9['body']['id'];}return db[_0x049b('0x3f')][_0x049b('0x5c')]({'where':{'id':_0x2b0cc9['params']['id']}})[_0x049b('0x22')](handleEntityNotFound(_0x4061d1,null))[_0x049b('0x22')](function(_0x4bdecd){if(_0x4bdecd){_0x2b0cc9['body'][_0x049b('0x67')]=_0x4bdecd['id'];return db[_0x049b('0x68')][_0x049b('0x5d')](_0x2b0cc9[_0x049b('0x5e')]);}})[_0x049b('0x22')](respondWithResult(_0x4061d1,null))[_0x049b('0x58')](handleError(_0x4061d1,null));};exports[_0x049b('0x69')]=function(_0xef9308,_0x2e53c8,_0x2b5a99){var _0xd3b3c2={'raw':![],'where':{}};var _0x45b957={};var _0x4a828b={'count':0x0,'rows':[]};return db[_0x049b('0x3f')][_0x049b('0x6a')]({'where':{'id':_0xef9308[_0x049b('0x5a')]['id']}})[_0x049b('0x22')](handleEntityNotFound(_0x2e53c8,null))[_0x049b('0x22')](function(_0x447778){if(_0x447778){_0x45b957['model']=_[_0x049b('0x45')](db['Disposition'][_0x049b('0x40')]);_0x45b957[_0x049b('0x44')]=_['keys'](_0xef9308[_0x049b('0x44')]);_0x45b957[_0x049b('0x4e')]=_['intersection'](_0x45b957[_0x049b('0x43')],_0x45b957['query']);_0xd3b3c2[_0x049b('0x47')]=_[_0x049b('0x46')](_0x45b957[_0x049b('0x43')],qs[_0x049b('0x48')](_0xef9308['query'][_0x049b('0x48')]));_0xd3b3c2[_0x049b('0x47')]=_0xd3b3c2[_0x049b('0x47')][_0x049b('0x49')]?_0xd3b3c2[_0x049b('0x47')]:_0x45b957['model'];if(!_0xef9308[_0x049b('0x44')][_0x049b('0x4a')](_0x049b('0x4b'))){_0xd3b3c2[_0x049b('0x30')]=qs[_0x049b('0x30')](_0xef9308['query']['limit']);_0xd3b3c2[_0x049b('0x2e')]=qs[_0x049b('0x2e')](_0xef9308['query'][_0x049b('0x2e')]);}_0xd3b3c2[_0x049b('0x4c')]=qs[_0x049b('0x4d')](_0xef9308[_0x049b('0x44')][_0x049b('0x4d')]);_0xd3b3c2[_0x049b('0x50')]=qs['filters'](_['pick'](_0xef9308[_0x049b('0x44')],_0x45b957[_0x049b('0x4e')]));_0xd3b3c2[_0x049b('0x50')]['SmsAccountId']=_0x447778['id'];if(_0xef9308[_0x049b('0x44')]['filter']){_0xd3b3c2['where']=_[_0x049b('0x51')](_0xd3b3c2[_0x049b('0x50')],{'$or':_['map'](_0xd3b3c2[_0x049b('0x47')],function(_0x2acf3a){var _0x4f0fa8={};_0x4f0fa8[_0x2acf3a]={'$like':'%'+_0xef9308[_0x049b('0x44')][_0x049b('0x52')]+'%'};return _0x4f0fa8;})});}_0xd3b3c2=_[_0x049b('0x51')]({},_0xd3b3c2,_0xef9308[_0x049b('0x53')]);return db[_0x049b('0x68')]['count']({'where':_0xd3b3c2['where']})[_0x049b('0x22')](function(_0x1441f1){_0x4a828b['count']=_0x1441f1;if(_0xef9308['query'][_0x049b('0x54')]){_0xd3b3c2['include']=[{'all':!![]}];}return db[_0x049b('0x68')][_0x049b('0x56')](_0xd3b3c2);})[_0x049b('0x22')](function(_0x307f14){_0x4a828b['rows']=_0x307f14;return _0x4a828b;});}})[_0x049b('0x22')](respondWithFilteredResult(_0x2e53c8,_0xd3b3c2))[_0x049b('0x58')](handleError(_0x2e53c8,null));};exports[_0x049b('0x6b')]=function(_0x1a8217,_0x39f45b,_0x45ea02){return db[_0x049b('0x3f')]['find']({'where':{'id':_0x1a8217[_0x049b('0x5a')]['id']}})[_0x049b('0x22')](handleEntityNotFound(_0x39f45b,null))[_0x049b('0x22')](function(_0x578c41){if(_0x578c41){return _0x578c41[_0x049b('0x6b')](_0x1a8217[_0x049b('0x44')][_0x049b('0x6c')]);}})[_0x049b('0x22')](respondWithStatusCode(_0x39f45b,null))[_0x049b('0x58')](handleError(_0x39f45b,null));};exports['addAnswer']=function(_0xa8a1c7,_0x308eba,_0x58ca7c){if(_0xa8a1c7[_0x049b('0x5e')]['id']){delete _0xa8a1c7['body']['id'];}return db[_0x049b('0x3f')][_0x049b('0x5c')]({'where':{'id':_0xa8a1c7[_0x049b('0x5a')]['id']}})[_0x049b('0x22')](handleEntityNotFound(_0x308eba,null))[_0x049b('0x22')](function(_0x49ffaf){if(_0x49ffaf){_0xa8a1c7[_0x049b('0x5e')][_0x049b('0x67')]=_0x49ffaf['id'];return db[_0x049b('0x6d')][_0x049b('0x5d')](_0xa8a1c7[_0x049b('0x5e')]);}})[_0x049b('0x22')](respondWithResult(_0x308eba,null))[_0x049b('0x58')](handleError(_0x308eba,null));};exports[_0x049b('0x6e')]=function(_0x4373d9,_0x4417ef,_0x535fd8){var _0x101780={'raw':![],'where':{}};var _0x3972e9={};var _0x4b11a2={'count':0x0,'rows':[]};return db['SmsAccount'][_0x049b('0x6a')]({'where':{'id':_0x4373d9[_0x049b('0x5a')]['id']}})[_0x049b('0x22')](handleEntityNotFound(_0x4417ef,null))[_0x049b('0x22')](function(_0x488cdc){if(_0x488cdc){_0x3972e9[_0x049b('0x43')]=_['keys'](db[_0x049b('0x6d')]['rawAttributes']);_0x3972e9[_0x049b('0x44')]=_['keys'](_0x4373d9['query']);_0x3972e9['filters']=_[_0x049b('0x46')](_0x3972e9['model'],_0x3972e9[_0x049b('0x44')]);_0x101780[_0x049b('0x47')]=_[_0x049b('0x46')](_0x3972e9[_0x049b('0x43')],qs[_0x049b('0x48')](_0x4373d9[_0x049b('0x44')][_0x049b('0x48')]));_0x101780['attributes']=_0x101780[_0x049b('0x47')]['length']?_0x101780[_0x049b('0x47')]:_0x3972e9[_0x049b('0x43')];if(!_0x4373d9[_0x049b('0x44')]['hasOwnProperty'](_0x049b('0x4b'))){_0x101780[_0x049b('0x30')]=qs[_0x049b('0x30')](_0x4373d9[_0x049b('0x44')]['limit']);_0x101780['offset']=qs['offset'](_0x4373d9[_0x049b('0x44')][_0x049b('0x2e')]);}_0x101780[_0x049b('0x4c')]=qs[_0x049b('0x4d')](_0x4373d9[_0x049b('0x44')][_0x049b('0x4d')]);_0x101780[_0x049b('0x50')]=qs[_0x049b('0x4e')](_[_0x049b('0x4f')](_0x4373d9[_0x049b('0x44')],_0x3972e9['filters']));_0x101780[_0x049b('0x50')][_0x049b('0x67')]=_0x488cdc['id'];if(_0x4373d9[_0x049b('0x44')][_0x049b('0x52')]){_0x101780[_0x049b('0x50')]=_[_0x049b('0x51')](_0x101780['where'],{'$or':_[_0x049b('0x3e')](_0x101780[_0x049b('0x47')],function(_0x2b32b6){var _0x22310a={};_0x22310a[_0x2b32b6]={'$like':'%'+_0x4373d9[_0x049b('0x44')][_0x049b('0x52')]+'%'};return _0x22310a;})});}_0x101780=_[_0x049b('0x51')]({},_0x101780,_0x4373d9[_0x049b('0x53')]);return db[_0x049b('0x6d')][_0x049b('0x31')]({'where':_0x101780[_0x049b('0x50')]})[_0x049b('0x22')](function(_0x11d4e3){_0x4b11a2['count']=_0x11d4e3;if(_0x4373d9[_0x049b('0x44')][_0x049b('0x54')]){_0x101780['include']=[{'all':!![]}];}return db[_0x049b('0x6d')][_0x049b('0x56')](_0x101780);})[_0x049b('0x22')](function(_0x440176){_0x4b11a2[_0x049b('0x57')]=_0x440176;return _0x4b11a2;});}})['then'](respondWithFilteredResult(_0x4417ef,_0x101780))[_0x049b('0x58')](handleError(_0x4417ef,null));};exports['removeAnswers']=function(_0x45c7e4,_0x213b2c,_0x40727f){return db['SmsAccount']['find']({'where':{'id':_0x45c7e4[_0x049b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x213b2c,null))[_0x049b('0x22')](function(_0x26864c){if(_0x26864c){return _0x26864c[_0x049b('0x6f')](_0x45c7e4[_0x049b('0x44')][_0x049b('0x6c')]);}})[_0x049b('0x22')](respondWithStatusCode(_0x213b2c,null))[_0x049b('0x58')](handleError(_0x213b2c,null));};exports[_0x049b('0x70')]=function(_0x234930,_0x50fac6,_0x4a0976){var _0x3077bf={'channel':_0x049b('0x71')};var _0x4ada98=[];var _0x2f83b3=[];var _0x21cdb7={};return db[_0x049b('0x3f')][_0x049b('0x5c')]({'where':{'id':_0x234930['params']['id']},'include':[{'model':db[_0x049b('0x72')],'as':_0x049b('0x73')}]})['then'](handleEntityNotFound(_0x50fac6,null))[_0x049b('0x22')](function(_0x35f74c){_0x3077bf['account']=_0x35f74c;_0x3077bf[_0x049b('0x74')]=_[_0x049b('0x75')](_0x35f74c[_0x049b('0x73')],[_0x049b('0x76')],[_0x049b('0x77')]);if(_0x3077bf['account']['Applications']){delete _0x3077bf[_0x049b('0x78')][_0x049b('0x73')];}return db[_0x049b('0x79')][_0x049b('0x65')]();})[_0x049b('0x22')](function(_0x282e58){if(!_0x282e58){throw new db[(_0x049b('0x7a'))][(_0x049b('0x7b'))](_0x049b('0x7c'));}_0x4ada98=_[_0x049b('0x7d')](_[_0x049b('0x45')](_0x282e58),[_0x049b('0x7e'),_0x049b('0x7f')]);_0x2f83b3=_[_0x049b('0x7d')](_[_0x049b('0x45')](_0x282e58),[_0x049b('0x7e'),_0x049b('0x7f'),'CompanyId',_0x049b('0x80')]);_0x3077bf[_0x049b('0x5e')]={'mapKey':_0x049b('0x81')};if(_0x3077bf['account']['type']){switch(_0x3077bf[_0x049b('0x78')][_0x049b('0x41')]){case _0x049b('0x82'):_0x3077bf['body'][_0x049b('0x83')]=_0x234930[_0x049b('0x5e')][_0x049b('0x84')];_0x3077bf[_0x049b('0x5e')][_0x049b('0x5e')]=_0x234930[_0x049b('0x5e')]['Body'];_0x3077bf[_0x049b('0x5e')][_0x049b('0x85')]=_0x234930['body'][_0x049b('0x86')];break;case _0x049b('0x87'):_0x3077bf['body']['from']='+'+_0x234930[_0x049b('0x5e')][_0x049b('0x88')];_0x3077bf[_0x049b('0x5e')]['body']=_0x234930[_0x049b('0x5e')][_0x049b('0x89')];break;case _0x049b('0x8a'):_0x3077bf[_0x049b('0x5e')][_0x049b('0x83')]=_0x234930[_0x049b('0x5e')][_0x049b('0x83')];_0x3077bf['body'][_0x049b('0x5e')]=_0x234930[_0x049b('0x5e')][_0x049b('0x29')];break;case _0x049b('0x8b'):_0x3077bf['body']['from']=_0x234930['body'][_0x049b('0x83')];_0x3077bf[_0x049b('0x5e')]['body']=_0x234930[_0x049b('0x5e')][_0x049b('0x5e')];_0x3077bf[_0x049b('0x5e')]['messageId']=_0x234930[_0x049b('0x5e')][_0x049b('0x8c')];break;case _0x049b('0x8d'):_0x3077bf['body'][_0x049b('0x83')]=_0x234930['body'][_0x049b('0x84')];_0x3077bf[_0x049b('0x5e')]['body']=_0x234930[_0x049b('0x5e')][_0x049b('0x8e')];_0x3077bf[_0x049b('0x5e')]['messageId']=_0x234930['body']['MessageUUID'];break;case'infobip':_0x3077bf[_0x049b('0x5e')]['from']='+'+_0x234930[_0x049b('0x5e')][_0x049b('0x8f')][0x0][_0x049b('0x83')];_0x3077bf[_0x049b('0x5e')][_0x049b('0x5e')]=_0x234930[_0x049b('0x5e')][_0x049b('0x8f')][0x0]['text'];_0x3077bf['body']['messageId']=_0x234930[_0x049b('0x5e')][_0x049b('0x8f')][0x0]['messageId'];break;case _0x049b('0x90'):_0x3077bf[_0x049b('0x5e')][_0x049b('0x83')]=_0x234930[_0x049b('0x5e')]['originatingAddress'];_0x3077bf[_0x049b('0x5e')][_0x049b('0x5e')]=_0x234930[_0x049b('0x5e')]['segmentedMessage']['message'];break;case _0x049b('0x91'):_0x3077bf['body']['from']=_0x234930[_0x049b('0x5e')][_0x049b('0x92')];_0x3077bf['body']['body']=_0x234930[_0x049b('0x5e')][_0x049b('0x89')];_0x3077bf[_0x049b('0x5e')][_0x049b('0x85')]=_0x234930['body']['replyMessageId'];break;case _0x049b('0x93'):_0x3077bf['body'][_0x049b('0x85')]=_0x234930['body'][0x0][_0x049b('0x29')]['id'];_0x3077bf['body']['from']=_0x234930[_0x049b('0x5e')][0x0][_0x049b('0x29')]['from'];_0x3077bf[_0x049b('0x5e')]['body']=_0x234930['body'][0x0][_0x049b('0x29')][_0x049b('0x89')];break;case _0x049b('0x94'):_0x3077bf[_0x049b('0x5e')]['from']=_0x234930[_0x049b('0x5e')]['from'];_0x3077bf[_0x049b('0x5e')][_0x049b('0x5e')]=_0x234930[_0x049b('0x5e')]['message'];_0x3077bf[_0x049b('0x5e')][_0x049b('0x85')]=_0x234930['body'][_0x049b('0x95')];break;}}if(_0x3077bf[_0x049b('0x5e')]['id']){delete _0x3077bf[_0x049b('0x5e')]['id'];}if(_[_0x049b('0x96')](_0x3077bf[_0x049b('0x5e')][_0x049b('0x83')])){throw new db['Sequelize'][(_0x049b('0x7b'))]('from\x20is\x20mandatory');}if(_[_0x049b('0x96')](_0x3077bf[_0x049b('0x5e')][_0x049b('0x5e')])||_0x3077bf['body'][_0x049b('0x5e')]===''){throw new db['Sequelize']['ValidationError'](_0x049b('0x97'));}if(_[_0x049b('0x96')](_0x3077bf[_0x049b('0x5e')][_0x049b('0x98')])){throw new db[(_0x049b('0x7a'))][(_0x049b('0x7b'))](_0x049b('0x99')+_0x2f83b3);}if(!_[_0x049b('0x9a')](_0x2f83b3,_0x3077bf[_0x049b('0x5e')][_0x049b('0x98')])){throw new db['Sequelize']['ValidationError'](_0x049b('0x9b')+_0x2f83b3);}_0x21cdb7[_0x3077bf['body'][_0x049b('0x98')]]=_0x3077bf['body']['from'];return db[_0x049b('0x9c')][_0x049b('0x5c')]({'where':{'id':_0x3077bf['account'][_0x049b('0x80')]},'include':[{'model':db[_0x049b('0x79')],'as':'Contacts','where':_0x21cdb7,'limit':0x1,'order':[['updatedAt',_0x049b('0x9d')]]}]});})[_0x049b('0x22')](handleEntityNotFound(_0x50fac6,null))[_0x049b('0x22')](function(_0x41c0b6){if(_0x41c0b6){_0x3077bf['list']=_['omit'](_0x41c0b6,[_0x049b('0x9e')]);if(_0x41c0b6[_0x049b('0x9e')][_0x049b('0x49')]){return _0x41c0b6[_0x049b('0x9e')][0x0];}var _0x53fec5=_['defaults'](_0x3077bf['body'],{'firstName':_0x3077bf[_0x049b('0x5e')][_0x049b('0x83')],'ListId':_0x41c0b6['id']});_0x53fec5[_0x3077bf[_0x049b('0x5e')][_0x049b('0x98')]]=_0x3077bf['body'][_0x049b('0x83')];return db['CmContact'][_0x049b('0x5d')](_0x53fec5,{'fields':_0x4ada98,'raw':!![]});}})[_0x049b('0x22')](handleEntityNotFound(_0x50fac6,null))[_0x049b('0x22')](function(_0x108950){if(_0x108950){_0x3077bf[_0x049b('0x9f')]=_0x108950;var _0x3eea50={'ContactId':_0x108950['id'],'phone':_0x3077bf[_0x049b('0x5e')][_0x049b('0x83')],'SmsAccountId':_0x234930[_0x049b('0x5a')]['id']};var _0x472269={'ContactId':_0x108950['id'],'SmsAccountId':_0x234930[_0x049b('0x5a')]['id'],'closed':![]};return db[_0x049b('0xa0')][_0x049b('0x5c')]({'where':_0x472269})[_0x049b('0x22')](function(_0x363a38){if(_0x363a38){return[_0x363a38,![]];}return db['SmsInteraction'][_0x049b('0x5d')](_0x3eea50)[_0x049b('0x22')](function(_0x1e9a7e){return[_0x1e9a7e,!![]];});});}})['spread'](function(_0x38c501,_0x4869d3){_0x3077bf[_0x049b('0xa1')]=_0x38c501[_0x049b('0x36')]({'plain':!![]});_0x3077bf[_0x049b('0xa1')][_0x049b('0xa2')]=![];if(_0x4869d3){if(_0x3077bf[_0x049b('0x78')][_0x049b('0xa3')]){_0x3077bf[_0x049b('0x74')][_0x049b('0xa4')]({'id':0x0,'priority':_0x3077bf[_0x049b('0x74')][_0x049b('0x49')]+0x1,'app':_0x049b('0xa5'),'appdata':_0x049b('0xa6'),'interval':'*,*,*,*'});}_0x3077bf[_0x049b('0xa1')]['created']=!![];}return db['SmsMessage']['create']({'phone':_0x3077bf['body'][_0x049b('0x83')],'messageId':_0x3077bf[_0x049b('0x5e')][_0x049b('0x85')],'body':_0x3077bf[_0x049b('0x5e')][_0x049b('0x5e')],'SmsAccountId':_0x234930[_0x049b('0x5a')]['id'],'SmsInteractionId':_0x38c501['id'],'direction':'in','ContactId':_0x38c501[_0x049b('0xa7')],'AttachmentId':_0x3077bf[_0x049b('0x5e')][_0x049b('0xa8')]});})[_0x049b('0x22')](function(_0x277acb){_0x3077bf['message']=_0x277acb;if(_0x3077bf[_0x049b('0xa1')][_0x049b('0xa9')]){return db['User'][_0x049b('0x5c')]({'attributes':['id',_0x049b('0x3b')],'where':{'id':_0x3077bf['interaction'][_0x049b('0xa9')]}})[_0x049b('0x22')](function(_0x3cb570){if(_0x3cb570){_0x3077bf['applications'][_0x049b('0xaa')]({'id':0x0,'priority':0x0,'app':_0x049b('0xab'),'appdata':_0x3cb570['name']+','+(_0x3077bf[_0x049b('0x78')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x049b('0xac'),'startRouting',_0x3077bf);});}return respondWithRpcPromise(_0x049b('0xac'),_0x049b('0xad'),_0x3077bf);})[_0x049b('0x22')](function(_0x3d55c9){if(_0x3d55c9){var _0x35f7c3=0xc8;var _0x58d47d=_0x049b('0xae');logger[_0x049b('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x58d47d,_0x35f7c3,_0x049b('0xaf'));logger[_0x049b('0xb0')](_0x049b('0xb1'),_0x58d47d,_0x35f7c3,'entity\x20found',JSON[_0x049b('0x26')](_0x3d55c9));if(_0x3077bf[_0x049b('0x78')][_0x049b('0x41')]===_0x049b('0x82')){return _0x50fac6[_0x049b('0x32')](_0x35f7c3)['set'](_0x049b('0xb2'),_0x049b('0xb3'))[_0x049b('0xb4')](_0x049b('0xb5'));}else{return _0x50fac6[_0x049b('0x32')](_0x35f7c3)[_0x049b('0x2d')](_0x3d55c9);}}})[_0x049b('0x58')](handleError(_0x50fac6,null));};exports[_0x049b('0xb6')]=function(_0x171a4d,_0x341bb1){var _0x2743a5=_0x171a4d['params']['id'];var _0x5dd1e1=_0x171a4d[_0x049b('0x5e')];var _0x35d217=0xc8;var _0x25b083=null;return db[_0x049b('0xb7')][_0x049b('0xb8')]({'isolationLevel':db[_0x049b('0xb7')][_0x049b('0xb9')][_0x049b('0xba')][_0x049b('0xbb')]},function(_0x524226){return db['SmsAccount'][_0x049b('0x6a')]({'where':{'id':_0x2743a5},'transaction':_0x524226})['then'](function(_0x391ab1){if(_0x391ab1){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x2743a5},'transaction':_0x524226})[_0x049b('0x22')](function(){var _0x9b3818=_[_0x049b('0x3e')](_0x5dd1e1,function(_0x1a0753){_0x1a0753[_0x049b('0x67')]=_0x2743a5;return _0x1a0753;});return db[_0x049b('0x72')][_0x049b('0xbc')](_0x9b3818,{'transaction':_0x524226});});}else{_0x35d217=0x194;_0x25b083=[];}});})[_0x049b('0x22')](function(){if(_0x35d217!==0x194){return db[_0x049b('0x72')]['findAndCountAll']({'where':{'SmsAccountId':_0x2743a5},'order':_0x049b('0x76')})[_0x049b('0x22')](function(_0x42b409){_0x25b083=_0x42b409;});}})[_0x049b('0x58')](function(_0x325507){_0x35d217=0x1f4;logger[_0x049b('0x27')](_0x325507[_0x049b('0x3a')]);if(_0x325507[_0x049b('0x3b')]){delete _0x325507[_0x049b('0x3b')];}_0x25b083=_0x325507;})[_0x049b('0xbd')](function(){if(_0x25b083===null){_0x341bb1[_0x049b('0x2b')](_0x35d217);}else{if(_0x35d217===0x1f4){_0x341bb1[_0x049b('0x32')](_0x35d217)[_0x049b('0xb4')](_0x25b083);}else{_0x341bb1[_0x049b('0x32')](_0x35d217)[_0x049b('0x2d')](_0x25b083);}}});};exports[_0x049b('0xbe')]=function(_0x1e1fb4,_0x140e78,_0x3cdf03){var _0x10b362={};var _0x46450e={};var _0x5d4c21;var _0x4b3f92;return db[_0x049b('0x3f')][_0x049b('0x6a')]({'where':{'id':_0x1e1fb4[_0x049b('0x5a')]['id']}})[_0x049b('0x22')](handleEntityNotFound(_0x140e78,null))[_0x049b('0x22')](function(_0xd3fda3){if(_0xd3fda3){_0x5d4c21=_0xd3fda3;_0x46450e[_0x049b('0x43')]=_[_0x049b('0x45')](db[_0x049b('0x72')][_0x049b('0x40')]);_0x46450e['query']=_['keys'](_0x1e1fb4['query']);_0x46450e[_0x049b('0x4e')]=_[_0x049b('0x46')](_0x46450e['model'],_0x46450e['query']);_0x10b362[_0x049b('0x47')]=_[_0x049b('0x46')](_0x46450e['model'],qs[_0x049b('0x48')](_0x1e1fb4[_0x049b('0x44')][_0x049b('0x48')]));_0x10b362[_0x049b('0x47')]=_0x10b362[_0x049b('0x47')][_0x049b('0x49')]?_0x10b362['attributes']:_0x46450e[_0x049b('0x43')];_0x10b362[_0x049b('0x4c')]=qs[_0x049b('0x4d')](_0x1e1fb4['query']['sort']);_0x10b362[_0x049b('0x50')]=qs[_0x049b('0x4e')](_['pick'](_0x1e1fb4[_0x049b('0x44')],_0x46450e['filters']));if(_0x1e1fb4[_0x049b('0x44')][_0x049b('0x52')]){_0x10b362['where']=_['merge'](_0x10b362[_0x049b('0x50')],{'$or':_[_0x049b('0x3e')](_0x10b362[_0x049b('0x47')],function(_0x3c5ce9){var _0x3dfa06={};_0x3dfa06[_0x3c5ce9]={'$like':'%'+_0x1e1fb4[_0x049b('0x44')]['filter']+'%'};return _0x3dfa06;})});}_0x10b362=_[_0x049b('0x51')]({},_0x10b362,_0x1e1fb4[_0x049b('0x53')]);return _0x5d4c21[_0x049b('0xbe')](_0x10b362);}})[_0x049b('0x22')](function(_0x27aae8){if(_0x27aae8){_0x4b3f92=_0x27aae8[_0x049b('0x49')];if(!_0x1e1fb4[_0x049b('0x44')][_0x049b('0x4a')](_0x049b('0x4b'))){_0x10b362[_0x049b('0x30')]=qs[_0x049b('0x30')](_0x1e1fb4[_0x049b('0x44')][_0x049b('0x30')]);_0x10b362[_0x049b('0x2e')]=qs['offset'](_0x1e1fb4[_0x049b('0x44')]['offset']);}return _0x5d4c21[_0x049b('0xbe')](_0x10b362);}})[_0x049b('0x22')](function(_0x3fa98c){if(_0x3fa98c){return _0x3fa98c?{'count':_0x4b3f92,'rows':_0x3fa98c}:null;}})['then'](respondWithResult(_0x140e78,null))['catch'](handleError(_0x140e78,null));};exports[_0x049b('0xbf')]=function(_0x2e98a9,_0x1d1050,_0x566849){var _0x1ed574={'raw':![],'where':{}};var _0x2e7d51={};var _0x1b69ae={'count':0x0,'rows':[]};return db['SmsAccount'][_0x049b('0x6a')]({'where':{'id':_0x2e98a9[_0x049b('0x5a')]['id']}})[_0x049b('0x22')](handleEntityNotFound(_0x1d1050,null))['then'](function(_0x4ad19b){if(_0x4ad19b){_0x2e7d51['model']=_[_0x049b('0x45')](db['SmsInteraction']['rawAttributes']);_0x2e7d51['query']=_[_0x049b('0x45')](_0x2e98a9[_0x049b('0x44')]);_0x2e7d51[_0x049b('0x4e')]=_['intersection'](_0x2e7d51['model'],_0x2e7d51[_0x049b('0x44')]);_0x1ed574[_0x049b('0x47')]=_['intersection'](_0x2e7d51[_0x049b('0x43')],qs['fields'](_0x2e98a9['query'][_0x049b('0x48')]));_0x1ed574[_0x049b('0x47')]=_0x1ed574[_0x049b('0x47')][_0x049b('0x49')]?_0x1ed574[_0x049b('0x47')]:_0x2e7d51[_0x049b('0x43')];if(!_0x2e98a9[_0x049b('0x44')][_0x049b('0x4a')](_0x049b('0x4b'))){_0x1ed574[_0x049b('0x30')]=qs[_0x049b('0x30')](_0x2e98a9[_0x049b('0x44')][_0x049b('0x30')]);_0x1ed574[_0x049b('0x2e')]=qs['offset'](_0x2e98a9['query'][_0x049b('0x2e')]);}_0x1ed574[_0x049b('0x4c')]=qs[_0x049b('0x4d')](_0x2e98a9[_0x049b('0x44')][_0x049b('0x4d')]);_0x1ed574[_0x049b('0x50')]=qs[_0x049b('0x4e')](_[_0x049b('0x4f')](_0x2e98a9[_0x049b('0x44')],_0x2e7d51['filters']));_0x1ed574[_0x049b('0x50')][_0x049b('0x67')]=_0x4ad19b['id'];if(_0x2e98a9[_0x049b('0x44')][_0x049b('0x52')]){_0x1ed574['where']=_['merge'](_0x1ed574['where'],{'$or':_[_0x049b('0x3e')](_0x1ed574['attributes'],function(_0x2a5dcd){var _0x47c439={};_0x47c439[_0x2a5dcd]={'$like':'%'+_0x2e98a9['query']['filter']+'%'};return _0x47c439;})});}_0x1ed574=_['merge']({},_0x1ed574,_0x2e98a9[_0x049b('0x53')]);return db[_0x049b('0xa0')]['count']({'where':_0x1ed574['where']})[_0x049b('0x22')](function(_0x3ee9f8){_0x1b69ae[_0x049b('0x31')]=_0x3ee9f8;if(_0x2e98a9[_0x049b('0x44')][_0x049b('0x54')]){_0x1ed574[_0x049b('0x55')]=[{'model':db[_0x049b('0x79')],'as':_0x049b('0xc0'),'required':![]},{'model':db[_0x049b('0xc1')],'as':'Owner','attributes':[_0x049b('0x3b'),_0x049b('0xc2'),_0x049b('0xc3')],'required':![]},{'model':db[_0x049b('0xc4')],'as':_0x049b('0xc5'),'attributes':['id','name',_0x049b('0xc6')],'where':_0x2e98a9[_0x049b('0x44')][_0x049b('0xc7')]?{'id':_0x2e98a9[_0x049b('0x44')][_0x049b('0xc7')]}:undefined,'required':_0x2e98a9[_0x049b('0x44')][_0x049b('0xc7')]?!![]:![]}];}return db[_0x049b('0xa0')][_0x049b('0x56')](_0x1ed574);})[_0x049b('0x22')](function(_0x351a70){_0x1b69ae['rows']=_0x351a70;return _0x1b69ae;});}})['then'](respondWithFilteredResult(_0x1d1050,_0x1ed574))[_0x049b('0x58')](handleError(_0x1d1050,null));};exports[_0x049b('0xb4')]=function(_0x4be94a,_0xdb48bd,_0x5042c1){var _0x44fd1f,_0x496a77,_0x3772f5;if(_['isNil'](_0x4be94a['body']['body'])||_0x4be94a[_0x049b('0x5e')][_0x049b('0x5e')]===''){throw new db[(_0x049b('0x7a'))]['ValidationError'](_0x049b('0x97'));}if(_[_0x049b('0x96')](_0x4be94a['body']['to'])){throw new db[(_0x049b('0x7a'))][(_0x049b('0x7b'))]('to\x20is\x20mandatory');}_0x44fd1f=_0x4be94a[_0x049b('0x5e')]['to'];return db[_0x049b('0x3f')][_0x049b('0x5c')]({'where':{'id':_0x4be94a[_0x049b('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0x049b('0xc8'),'include':[{'model':db[_0x049b('0x79')],'as':_0x049b('0x9e'),'where':{'mobile':_0x44fd1f},'limit':0x1,'order':[[_0x049b('0x7f'),_0x049b('0x9d')]]}]}]})[_0x049b('0x22')](handleEntityNotFound(_0xdb48bd,null))[_0x049b('0x22')](function(_0x168efd){if(_0x168efd&&_0x168efd[_0x049b('0xc8')]){_0x496a77=_0x168efd[_0x049b('0x36')]({'plain':!![]});if(_0x496a77[_0x049b('0xc8')]&&_0x496a77['List'][_0x049b('0x9e')][_0x049b('0x49')]){return _0x496a77[_0x049b('0xc8')]['Contacts'][0x0];}return db[_0x049b('0x79')]['create'](_['defaults'](_0x4be94a[_0x049b('0x5e')],{'firstName':_0x44fd1f,'mobile':_0x44fd1f,'phone':_0x44fd1f,'ListId':_0x496a77[_0x049b('0x80')]}));}})[_0x049b('0x22')](handleEntityNotFound(_0xdb48bd,null))[_0x049b('0x22')](function(_0x4c58fe){if(_0x4c58fe){_0x3772f5=_0x4c58fe;return db[_0x049b('0xa0')][_0x049b('0x5c')]({'where':{'ContactId':_0x3772f5['id'],'closed':![],'SmsAccountId':_0x496a77['id']}})[_0x049b('0x22')](function(_0x15d0c6){if(_0x15d0c6){return[_0x15d0c6,![]];}return db[_0x049b('0xa0')][_0x049b('0x5d')]({'UserId':_0x4be94a[_0x049b('0x60')]['id'],'ContactId':_0x3772f5['id'],'SmsAccountId':_0x496a77['id'],'phone':_0x44fd1f,'firstMsgDirection':'out','Messages':[_['merge'](_0x4be94a['body'],{'read':![],'body':_0x4be94a[_0x049b('0x5e')][_0x049b('0x5e')],'phone':_0x44fd1f,'SmsAccountId':_0x496a77['id'],'UserId':_0x4be94a['user']['id'],'ContactId':_0x3772f5['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x049b('0xc9')}]})['then'](function(_0x83ef8c){return[_0x83ef8c,!![]];});});}})[_0x049b('0xca')](function(_0x375ff,_0xd0f576){if(_0xd0f576){return _0x375ff;}return db[_0x049b('0xcb')][_0x049b('0x5d')](_['merge'](_0x4be94a[_0x049b('0x5e')],{'read':![],'body':_0x4be94a[_0x049b('0x5e')][_0x049b('0x5e')],'phone':_0x44fd1f,'SmsAccountId':_0x496a77['id'],'SmsInteractionId':_0x375ff['id'],'UserId':_0x4be94a[_0x049b('0x60')]['id'],'ContactId':_0x3772f5['id']}))[_0x049b('0x22')](function(_0x24e1f1){_0x375ff[_0x049b('0xcc')][_0x049b('0xc9')]=[];_0x375ff[_0x049b('0xcc')][_0x049b('0xc9')]['push'](_0x24e1f1[_0x049b('0xcc')]);return _0x375ff;});})[_0x049b('0x22')](respondWithResult(_0xdb48bd,null))[_0x049b('0x58')](handleError(_0xdb48bd,null));};exports[_0x049b('0x32')]=function(_0x4db173,_0x3e7203,_0x4c6840){if(_0x4db173[_0x049b('0x5e')]['id']){delete _0x4db173[_0x049b('0x5e')]['id'];}var _0xfa9329,_0x58bb1a,_0x1efc93;return db[_0x049b('0x3f')]['find']({'where':{'id':_0x4db173['params']['id']}})[_0x049b('0x22')](handleEntityNotFound(_0x3e7203,null))[_0x049b('0x22')](function(_0x287cc5){if(_0x287cc5){_0x1efc93=_0x287cc5;logger[_0x049b('0xb0')](_0x049b('0x25'),_0x049b('0x32'),_0x049b('0xcd'),_0x287cc5[_0x049b('0x41')],util[_0x049b('0xce')](_0x4db173[_0x049b('0x5e')],{'showHidden':![],'depth':null}));switch(_0x287cc5[_0x049b('0x41')]){case _0x049b('0x87'):if(_0x4db173[_0x049b('0x5e')][_0x049b('0xcf')]&&_0x4db173[_0x049b('0x5e')][_0x049b('0x32')]){_0x58bb1a=_0x4db173['body'][_0x049b('0x32')];return db['SmsMessage'][_0x049b('0x5c')]({'where':{'messageId':_0x4db173['body'][_0x049b('0xcf')]}});}break;case _0x049b('0x8a'):if(_0x4db173[_0x049b('0x5e')][_0x049b('0xd0')]&&_0x4db173[_0x049b('0x5e')][_0x049b('0xd1')]){_0x58bb1a=_0x4db173[_0x049b('0x5e')]['statusInt'];return db[_0x049b('0xcb')][_0x049b('0x5c')]({'where':{'messageId':_0x4db173['body']['requestid']}});}break;case'clicksend':if(_0x4db173[_0x049b('0x5e')]['message_id']&&_0x4db173[_0x049b('0x5e')][_0x049b('0xd2')]){_0x58bb1a=_0x4db173[_0x049b('0x5e')]['status_code'];return db['SmsMessage'][_0x049b('0x5c')]({'where':{'messageId':_0x4db173[_0x049b('0x5e')][_0x049b('0x8c')]}});}break;case _0x049b('0xd3'):var _0x552d65=_0x4db173[_0x049b('0x5e')]['results'][0x0];if(_0x552d65[_0x049b('0x85')]&&_0x552d65['status'][_0x049b('0xd4')]===_0x049b('0xd5')){_0x58bb1a=_0x552d65[_0x049b('0x32')][_0x049b('0xd4')];return db[_0x049b('0xcb')][_0x049b('0x5c')]({'where':{'messageId':_0x552d65['messageId']}});}break;case _0x049b('0x91'):if(_0x4db173[_0x049b('0x5e')][_0x049b('0x85')]&&_0x4db173[_0x049b('0x5e')][_0x049b('0x32')]){_0x58bb1a=_0x4db173[_0x049b('0x5e')][_0x049b('0x32')];return db[_0x049b('0xcb')][_0x049b('0x5c')]({'where':{'messageId':_0x4db173[_0x049b('0x5e')]['messageId']}});}break;case _0x049b('0x93'):if(_0x4db173[_0x049b('0x5e')][0x0]['message']['id']){_0x58bb1a=_0x4db173[_0x049b('0x5e')][0x0][_0x049b('0x41')];return db[_0x049b('0xcb')][_0x049b('0x5c')]({'where':{'messageId':_0x4db173['body'][0x0][_0x049b('0x29')]['id']}});}break;case _0x049b('0x94'):if(_0x4db173[_0x049b('0x5e')][_0x049b('0xd6')]&&_0x4db173['body'][_0x049b('0x32')]){_0x58bb1a=_0x4db173[_0x049b('0x5e')][_0x049b('0x32')];return db[_0x049b('0xcb')][_0x049b('0x5c')]({'where':{'messageId':_0x4db173[_0x049b('0x5e')][_0x049b('0xd6')]}});}break;}}})[_0x049b('0x22')](handleEntityNotFound(_0x3e7203,null))[_0x049b('0x22')](function(_0x502219){if(_0x502219){_0xfa9329=_0x502219;switch(_0x1efc93[_0x049b('0x41')]){case'skebby':if(_0x58bb1a===_0x049b('0xd5')){return _0xfa9329[_0x049b('0xd7')]({'read':!![]});}else{logger[_0x049b('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x049b('0x32'),'skebby',util[_0x049b('0xce')](_0x4db173[_0x049b('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x049b('0x8a'):if(_0x58bb1a==='1'){return _0xfa9329[_0x049b('0xd7')]({'read':!![]});}else{logger[_0x049b('0x27')](_0x049b('0x25'),_0x049b('0x32'),_0x049b('0x87'),util[_0x049b('0xce')](_0x4db173[_0x049b('0x5e')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4db173[_0x049b('0x5e')][_0x049b('0xd8')]&&_0x58bb1a>=0xc8&&_0x58bb1a<=0xce){return _0xfa9329[_0x049b('0xd7')]({'read':!![]});}else{logger[_0x049b('0x27')](_0x049b('0x25'),'status','clicksend',util[_0x049b('0xce')](_0x4db173[_0x049b('0x5e')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5d85d8=_0x4db173[_0x049b('0x5e')][_0x049b('0x8f')][0x0];if(_0x5d85d8[_0x049b('0x32')][_0x049b('0xd4')]===_0x049b('0xd5')){return _0xfa9329[_0x049b('0xd7')]({'read':!![]});}else{logger['error'](_0x049b('0x25'),_0x049b('0x32'),'infobip',util[_0x049b('0xce')](_0x4db173[_0x049b('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x049b('0x91'):if(_0x58bb1a==_0x049b('0xd9')||_0x58bb1a=='RECEIVED_BY_RECIPIENT'){return _0xfa9329[_0x049b('0xd7')]({'read':!![]});}else{logger[_0x049b('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x049b('0x32'),_0x049b('0x91'),util[_0x049b('0xce')](_0x4db173[_0x049b('0x5e')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x58bb1a=='message-delivered'){return _0xfa9329[_0x049b('0xd7')]({'read':!![]});}else{logger[_0x049b('0x27')](_0x049b('0x25'),'status',_0x049b('0x93'),util[_0x049b('0xce')](_0x4db173['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x58bb1a===_0x049b('0xda')||_0x58bb1a===_0x049b('0xdb')){return _0xfa9329[_0x049b('0xd7')]({'read':!![]});}else{logger[_0x049b('0x27')](_0x049b('0x25'),_0x049b('0x32'),_0x049b('0x94'),util[_0x049b('0xce')](_0x4db173[_0x049b('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0xfa9329;}})[_0x049b('0x22')](respondWithResult(_0x3e7203,null))[_0x049b('0x58')](handleError(_0x3e7203,null));};exports['statusGet']=function(_0x102a30,_0x4c95fc,_0x8a7c22){var _0x79ce8,_0x2b1a8c,_0x2f6e42;return db[_0x049b('0x3f')][_0x049b('0x5c')]({'where':{'id':_0x102a30[_0x049b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4c95fc,null))[_0x049b('0x22')](function(_0x5b02e8){if(_0x5b02e8){_0x2f6e42=_0x5b02e8;logger[_0x049b('0xb0')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x049b('0x32'),_0x049b('0xcd'),_0x5b02e8[_0x049b('0x41')],util[_0x049b('0xce')](_0x102a30[_0x049b('0x44')],{'showHidden':![],'depth':null}));switch(_0x5b02e8[_0x049b('0x41')]){case _0x049b('0x90'):if(_0x102a30[_0x049b('0x44')][_0x049b('0xdc')]&&_0x102a30[_0x049b('0x44')]['state']){_0x2b1a8c=_0x102a30[_0x049b('0x44')][_0x049b('0xdd')];return db['SmsMessage'][_0x049b('0x5c')]({'where':{'messageId':_0x102a30['query']['message-id']}});}break;}}})[_0x049b('0x22')](handleEntityNotFound(_0x4c95fc,null))['then'](function(_0x4e548b){if(_0x4e548b){_0x79ce8=_0x4e548b;switch(_0x2f6e42[_0x049b('0x41')]){case _0x049b('0x90'):if(_0x2b1a8c==='2'||_0x2b1a8c==='6'){return _0x79ce8[_0x049b('0xd7')]({'read':!![]});}else{logger[_0x049b('0x27')](_0x049b('0x25'),_0x049b('0x32'),_0x049b('0x90'),util[_0x049b('0xce')](_0x102a30['query'],{'showHidden':![],'depth':null}));};break;}return _0x79ce8;}})['then'](respondWithResult(_0x4c95fc,null))[_0x049b('0x58')](handleError(_0x4c95fc,null));};exports[_0x049b('0xde')]=function(_0x75faf4,_0x440150,_0x17c6cb){return db['SmsAccount']['find']({'where':{'id':_0x75faf4['params']['id']}})[_0x049b('0x22')](handleEntityNotFound(_0x440150,null))[_0x049b('0x22')](function(_0x69e824){if(_0x69e824){return _0x69e824[_0x049b('0xde')](_0x75faf4['body'][_0x049b('0x6c')],_[_0x049b('0xdf')](_0x75faf4[_0x049b('0x5e')],[_0x049b('0x6c'),'id'])||{})[_0x049b('0xca')](function(_0x297a74){for(var _0x564fa4=0x0;_0x564fa4<_0x75faf4['body'][_0x049b('0x6c')]['length'];_0x564fa4+=0x1){socket[_0x049b('0xe0')](_0x049b('0xe1'),{'UserId':Number(_0x75faf4[_0x049b('0x5e')][_0x049b('0x6c')][_0x564fa4]),'SmsAccountId':Number(_0x75faf4[_0x049b('0x5a')]['id'])});}return _0x297a74;});}})[_0x049b('0x22')](respondWithResult(_0x440150,null))[_0x049b('0x58')](handleError(_0x440150,null));};exports[_0x049b('0xe2')]=function(_0x47e54e,_0x52fb16,_0x517866){return db[_0x049b('0x3f')][_0x049b('0x5c')]({'where':{'id':_0x47e54e[_0x049b('0x5a')]['id']}})[_0x049b('0x22')](handleEntityNotFound(_0x52fb16,null))[_0x049b('0x22')](function(_0x460809){if(_0x460809){return _0x460809[_0x049b('0xe2')](_0x47e54e[_0x049b('0x44')][_0x049b('0x6c')])[_0x049b('0x22')](function(){if(_[_0x049b('0xe3')](_0x47e54e['query'][_0x049b('0x6c')])){for(var _0x855d36=0x0;_0x855d36<_0x47e54e['query']['ids'][_0x049b('0x49')];_0x855d36+=0x1){socket[_0x049b('0xe0')](_0x049b('0xe4'),{'UserId':Number(_0x47e54e['query'][_0x049b('0x6c')][_0x855d36]),'SmsAccountId':Number(_0x47e54e[_0x049b('0x5a')]['id'])});}}else{socket[_0x049b('0xe0')](_0x049b('0xe4'),{'UserId':Number(_0x47e54e[_0x049b('0x44')][_0x049b('0x6c')]),'SmsAccountId':Number(_0x47e54e[_0x049b('0x5a')]['id'])});}});}})[_0x049b('0x22')](respondWithStatusCode(_0x52fb16,null))[_0x049b('0x58')](handleError(_0x52fb16,null));};exports[_0x049b('0xe5')]=function(_0x52c58d,_0x77bf7b,_0x2e064c){var _0x1d0e3e={};var _0x56361b={};var _0xa18e5f;var _0x31916d;return db['SmsAccount']['findOne']({'where':{'id':_0x52c58d[_0x049b('0x5a')]['id']}})[_0x049b('0x22')](handleEntityNotFound(_0x77bf7b,null))[_0x049b('0x22')](function(_0x2596ec){if(_0x2596ec){_0xa18e5f=_0x2596ec;_0x56361b[_0x049b('0x43')]=_['keys'](db[_0x049b('0xc1')][_0x049b('0x40')]);_0x56361b['query']=_[_0x049b('0x45')](_0x52c58d[_0x049b('0x44')]);_0x56361b['filters']=_[_0x049b('0x46')](_0x56361b[_0x049b('0x43')],_0x56361b[_0x049b('0x44')]);_0x1d0e3e[_0x049b('0x47')]=_['intersection'](_0x56361b[_0x049b('0x43')],qs[_0x049b('0x48')](_0x52c58d[_0x049b('0x44')][_0x049b('0x48')]));_0x1d0e3e[_0x049b('0x47')]=_0x1d0e3e[_0x049b('0x47')][_0x049b('0x49')]?_0x1d0e3e['attributes']:_0x56361b[_0x049b('0x43')];_0x1d0e3e[_0x049b('0x4c')]=qs['sort'](_0x52c58d[_0x049b('0x44')][_0x049b('0x4d')]);_0x1d0e3e[_0x049b('0x50')]=qs[_0x049b('0x4e')](_[_0x049b('0x4f')](_0x52c58d[_0x049b('0x44')],_0x56361b['filters']));if(_0x52c58d[_0x049b('0x44')]['filter']){_0x1d0e3e[_0x049b('0x50')]=_['merge'](_0x1d0e3e[_0x049b('0x50')],{'$or':_['map'](_0x1d0e3e[_0x049b('0x47')],function(_0x10b452){var _0x375eb5={};_0x375eb5[_0x10b452]={'$like':'%'+_0x52c58d['query'][_0x049b('0x52')]+'%'};return _0x375eb5;})});}_0x1d0e3e=_[_0x049b('0x51')]({},_0x1d0e3e,_0x52c58d[_0x049b('0x53')]);return _0xa18e5f[_0x049b('0xe5')](_0x1d0e3e);}})[_0x049b('0x22')](function(_0x26277f){if(_0x26277f){_0x31916d=_0x26277f['length'];if(!_0x52c58d['query'][_0x049b('0x4a')](_0x049b('0x4b'))){_0x1d0e3e['limit']=qs['limit'](_0x52c58d['query'][_0x049b('0x30')]);_0x1d0e3e[_0x049b('0x2e')]=qs['offset'](_0x52c58d['query'][_0x049b('0x2e')]);}return _0xa18e5f[_0x049b('0xe5')](_0x1d0e3e);}})['then'](function(_0x18fa59){if(_0x18fa59){return _0x18fa59?{'count':_0x31916d,'rows':_0x18fa59}:null;}})[_0x049b('0x22')](respondWithResult(_0x77bf7b,null))['catch'](handleError(_0x77bf7b,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index f27c32b..4f22bdf 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 _0xaac1=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x59946f,_0x5a12f3){var _0x3d4dd9=function(_0x401c2f){while(--_0x401c2f){_0x59946f['push'](_0x59946f['shift']());}};_0x3d4dd9(++_0x5a12f3);}(_0xaac1,0x1ad));var _0x1aac=function(_0x3420a0,_0x6b33df){_0x3420a0=_0x3420a0-0x0;var _0x5b6694=_0xaac1[_0x3420a0];return _0x5b6694;};'use strict';var EventEmitter=require(_0x1aac('0x0'));var SmsAccount=require(_0x1aac('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1aac('0x2')](0x0);var events={'afterCreate':_0x1aac('0x3'),'afterUpdate':_0x1aac('0x4'),'afterDestroy':_0x1aac('0x5')};function emitEvent(_0x65aa25){return function(_0x1a6f25,_0x5a45f3,_0x3f4380){SmsAccountEvents[_0x1aac('0x6')](_0x65aa25+':'+_0x1a6f25['id'],_0x1a6f25);SmsAccountEvents['emit'](_0x65aa25,_0x1a6f25);_0x3f4380(null);};}for(var e in events){if(events[_0x1aac('0x7')](e)){var event=events[e];SmsAccount[_0x1aac('0x8')](e,emitEvent(event));}}module[_0x1aac('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xf467=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf467,0xa1));var _0x7f46=function(_0x47c77d,_0x2d32a4){_0x47c77d=_0x47c77d-0x0;var _0xdbb39d=_0xf467[_0x47c77d];return _0xdbb39d;};'use strict';var EventEmitter=require(_0x7f46('0x0'));var SmsAccount=require(_0x7f46('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7f46('0x2')](0x0);var events={'afterCreate':_0x7f46('0x3'),'afterUpdate':_0x7f46('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21e2b2){return function(_0x232f7c,_0x1fb35c,_0x425920){SmsAccountEvents[_0x7f46('0x5')](_0x21e2b2+':'+_0x232f7c['id'],_0x232f7c);SmsAccountEvents[_0x7f46('0x5')](_0x21e2b2,_0x232f7c);_0x425920(null);};}for(var e in events){if(events[_0x7f46('0x6')](e)){var event=events[e];SmsAccount[_0x7f46('0x7')](e,emitEvent(event));}}module[_0x7f46('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 16e1a38..64d5b28 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 _0x2c2f=['../../config/environment','exports','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x19aa84,_0x549537){var _0x536146=function(_0x5da480){while(--_0x5da480){_0x19aa84['push'](_0x19aa84['shift']());}};_0x536146(++_0x549537);}(_0x2c2f,0xdc));var _0xf2c2=function(_0x18ea50,_0x403b06){_0x18ea50=_0x18ea50-0x0;var _0x1aae7d=_0x2c2f[_0x18ea50];return _0x1aae7d;};'use strict';var _=require(_0xf2c2('0x0'));var util=require(_0xf2c2('0x1'));var logger=require(_0xf2c2('0x2'))(_0xf2c2('0x3'));var moment=require(_0xf2c2('0x4'));var BPromise=require('bluebird');var rp=require(_0xf2c2('0x5'));var fs=require('fs');var path=require(_0xf2c2('0x6'));var rimraf=require(_0xf2c2('0x7'));var config=require(_0xf2c2('0x8'));var attributes=require('./smsAccount.attributes');module[_0xf2c2('0x9')]=function(_0x3adbbc,_0x4de742){return _0x3adbbc['define'](_0xf2c2('0xa'),attributes,{'tableName':_0xf2c2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce5b=['api','moment','request-promise','rimraf','../../config/environment','define','SmsAccount','sms_accounts','lodash','util','../../config/logger'];(function(_0x310e62,_0x3bb714){var _0x781566=function(_0x4bd2b7){while(--_0x4bd2b7){_0x310e62['push'](_0x310e62['shift']());}};_0x781566(++_0x3bb714);}(_0xce5b,0x76));var _0xbce5=function(_0x37104c,_0xc868e6){_0x37104c=_0x37104c-0x0;var _0x5e9544=_0xce5b[_0x37104c];return _0x5e9544;};'use strict';var _=require(_0xbce5('0x0'));var util=require(_0xbce5('0x1'));var logger=require(_0xbce5('0x2'))(_0xbce5('0x3'));var moment=require(_0xbce5('0x4'));var BPromise=require('bluebird');var rp=require(_0xbce5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbce5('0x6'));var config=require(_0xbce5('0x7'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x8def8,_0x154abc){return _0x8def8[_0xbce5('0x8')](_0xbce5('0x9'),attributes,{'tableName':_0xbce5('0xa'),'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 9d35e0e..3789540 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 _0x8119=['redis','localhost','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','ShowSmsAccount','SmsAccount','find','options','where','include','model','attributes','map','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x8119,0x1bc));var _0x9811=function(_0x55794e,_0xab3998){_0x55794e=_0x55794e-0x0;var _0x28213f=_0x8119[_0x55794e];return _0x28213f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9811('0x0'));var BPromise=require('bluebird');var rs=require(_0x9811('0x1'));var fs=require('fs');var Redis=require(_0x9811('0x2'));var db=require(_0x9811('0x3'))['db'];var utils=require(_0x9811('0x4'));var logger=require('../../config/logger')(_0x9811('0x5'));var config=require(_0x9811('0x6'));var jayson=require(_0x9811('0x7'));var client=jayson[_0x9811('0x8')][_0x9811('0x9')]({'port':0x232a});config['redis']=_[_0x9811('0xa')](config[_0x9811('0xb')],{'host':_0x9811('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9811('0xb')]));require(_0x9811('0xd'))[_0x9811('0xe')](socket);function respondWithRpcPromise(_0x307fd3,_0x2ce066,_0x1bf640){return new BPromise(function(_0x1b25e8,_0x12315f){return client[_0x9811('0xf')](_0x307fd3,_0x1bf640)[_0x9811('0x10')](function(_0x3ffeff){logger[_0x9811('0x11')](_0x9811('0x12'),_0x2ce066,_0x9811('0x13'));logger[_0x9811('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2ce066,'request\x20sent',JSON[_0x9811('0x15')](_0x3ffeff));if(_0x3ffeff[_0x9811('0x16')]){if(_0x3ffeff[_0x9811('0x16')]['code']===0x1f4){logger[_0x9811('0x16')](_0x9811('0x12'),_0x2ce066,_0x3ffeff[_0x9811('0x16')][_0x9811('0x17')]);return _0x12315f(_0x3ffeff[_0x9811('0x16')][_0x9811('0x17')]);}logger[_0x9811('0x16')](_0x9811('0x12'),_0x2ce066,_0x3ffeff[_0x9811('0x16')]['message']);return _0x1b25e8(_0x3ffeff['error'][_0x9811('0x17')]);}else{logger['info'](_0x9811('0x12'),_0x2ce066,'request\x20sent');_0x1b25e8(_0x3ffeff[_0x9811('0x18')][_0x9811('0x17')]);}})['catch'](function(_0x377cee){logger[_0x9811('0x16')]('SmsAccount,\x20%s,\x20%s',_0x2ce066,_0x377cee);_0x12315f(_0x377cee);});});}exports[_0x9811('0x19')]=function(_0x3bafb1){var _0x4b14dc=this;return new Promise(function(_0x599d14,_0x1fae7d){return db[_0x9811('0x1a')][_0x9811('0x1b')]({'raw':_0x3bafb1[_0x9811('0x1c')]?_0x3bafb1[_0x9811('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3bafb1[_0x9811('0x1c')]?_0x3bafb1[_0x9811('0x1c')][_0x9811('0x1d')]||null:null,'attributes':_0x3bafb1[_0x9811('0x1c')]?_0x3bafb1[_0x9811('0x1c')]['attributes']||null:null,'include':_0x3bafb1[_0x9811('0x1c')]?_0x3bafb1[_0x9811('0x1c')][_0x9811('0x1e')]?_['map'](_0x3bafb1['options'][_0x9811('0x1e')],function(_0x22de5d){return{'model':db[_0x22de5d[_0x9811('0x1f')]],'as':_0x22de5d['as'],'attributes':_0x22de5d[_0x9811('0x20')],'include':_0x22de5d[_0x9811('0x1e')]?_[_0x9811('0x21')](_0x22de5d[_0x9811('0x1e')],function(_0x3ce14f){return{'model':db[_0x3ce14f['model']],'as':_0x3ce14f['as'],'attributes':_0x3ce14f['attributes'],'include':_0x3ce14f[_0x9811('0x1e')]?_[_0x9811('0x21')](_0x3ce14f[_0x9811('0x1e')],function(_0x4a5a28){return{'model':db[_0x4a5a28['model']],'as':_0x4a5a28['as'],'attributes':_0x4a5a28[_0x9811('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e2813){logger[_0x9811('0x11')](_0x9811('0x19'),_0x3bafb1);logger[_0x9811('0x14')](_0x9811('0x19'),_0x3bafb1,JSON[_0x9811('0x15')](_0x4e2813));_0x599d14(_0x4e2813);})[_0x9811('0x22')](function(_0x1b73d7){logger[_0x9811('0x16')](_0x9811('0x19'),_0x1b73d7[_0x9811('0x17')],_0x3bafb1);_0x1fae7d(_0x4b14dc['error'](0x1f4,_0x1b73d7[_0x9811('0x17')]));});});}; \ No newline at end of file +var _0xcc89=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','ShowSmsAccount','find','options','raw','attributes','include','model','map','catch','util','moment','bluebird'];(function(_0x331db7,_0x1447c5){var _0x4614cf=function(_0x66591b){while(--_0x66591b){_0x331db7['push'](_0x331db7['shift']());}};_0x4614cf(++_0x1447c5);}(_0xcc89,0x16f));var _0x9cc8=function(_0x13874a,_0xe359a9){_0x13874a=_0x13874a-0x0;var _0x25c4d6=_0xcc89[_0x13874a];return _0x25c4d6;};'use strict';var _=require('lodash');var util=require(_0x9cc8('0x0'));var moment=require(_0x9cc8('0x1'));var BPromise=require(_0x9cc8('0x2'));var rs=require(_0x9cc8('0x3'));var fs=require('fs');var Redis=require(_0x9cc8('0x4'));var db=require(_0x9cc8('0x5'))['db'];var utils=require(_0x9cc8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9cc8('0x7'));var jayson=require(_0x9cc8('0x8'));var client=jayson[_0x9cc8('0x9')][_0x9cc8('0xa')]({'port':0x232a});config[_0x9cc8('0xb')]=_[_0x9cc8('0xc')](config['redis'],{'host':_0x9cc8('0xd'),'port':0x18eb});var socket=require(_0x9cc8('0xe'))(new Redis(config[_0x9cc8('0xb')]));require('./smsAccount.socket')[_0x9cc8('0xf')](socket);function respondWithRpcPromise(_0x7b6f39,_0x181bfc,_0x4e8e70){return new BPromise(function(_0x24cb39,_0x4379bf){return client[_0x9cc8('0x10')](_0x7b6f39,_0x4e8e70)[_0x9cc8('0x11')](function(_0x59e0d7){logger[_0x9cc8('0x12')]('SmsAccount,\x20%s,\x20%s',_0x181bfc,_0x9cc8('0x13'));logger[_0x9cc8('0x14')](_0x9cc8('0x15'),_0x181bfc,_0x9cc8('0x13'),JSON[_0x9cc8('0x16')](_0x59e0d7));if(_0x59e0d7[_0x9cc8('0x17')]){if(_0x59e0d7[_0x9cc8('0x17')][_0x9cc8('0x18')]===0x1f4){logger[_0x9cc8('0x17')](_0x9cc8('0x19'),_0x181bfc,_0x59e0d7[_0x9cc8('0x17')][_0x9cc8('0x1a')]);return _0x4379bf(_0x59e0d7[_0x9cc8('0x17')]['message']);}logger[_0x9cc8('0x17')]('SmsAccount,\x20%s,\x20%s',_0x181bfc,_0x59e0d7[_0x9cc8('0x17')][_0x9cc8('0x1a')]);return _0x24cb39(_0x59e0d7[_0x9cc8('0x17')]['message']);}else{logger[_0x9cc8('0x12')]('SmsAccount,\x20%s,\x20%s',_0x181bfc,_0x9cc8('0x13'));_0x24cb39(_0x59e0d7[_0x9cc8('0x1b')][_0x9cc8('0x1a')]);}})['catch'](function(_0x3d2f75){logger[_0x9cc8('0x17')](_0x9cc8('0x19'),_0x181bfc,_0x3d2f75);_0x4379bf(_0x3d2f75);});});}exports[_0x9cc8('0x1c')]=function(_0x35beeb){var _0x19d5f5=this;return new Promise(function(_0x43e183,_0x13ed4a){return db['SmsAccount'][_0x9cc8('0x1d')]({'raw':_0x35beeb[_0x9cc8('0x1e')]?_0x35beeb['options'][_0x9cc8('0x1f')]===undefined?!![]:![]:!![],'where':_0x35beeb['options']?_0x35beeb[_0x9cc8('0x1e')]['where']||null:null,'attributes':_0x35beeb[_0x9cc8('0x1e')]?_0x35beeb[_0x9cc8('0x1e')][_0x9cc8('0x20')]||null:null,'include':_0x35beeb[_0x9cc8('0x1e')]?_0x35beeb[_0x9cc8('0x1e')]['include']?_['map'](_0x35beeb[_0x9cc8('0x1e')][_0x9cc8('0x21')],function(_0x2459dc){return{'model':db[_0x2459dc[_0x9cc8('0x22')]],'as':_0x2459dc['as'],'attributes':_0x2459dc[_0x9cc8('0x20')],'include':_0x2459dc[_0x9cc8('0x21')]?_[_0x9cc8('0x23')](_0x2459dc['include'],function(_0x48c307){return{'model':db[_0x48c307[_0x9cc8('0x22')]],'as':_0x48c307['as'],'attributes':_0x48c307['attributes'],'include':_0x48c307['include']?_['map'](_0x48c307['include'],function(_0x573a80){return{'model':db[_0x573a80[_0x9cc8('0x22')]],'as':_0x573a80['as'],'attributes':_0x573a80[_0x9cc8('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9cc8('0x11')](function(_0x451da6){logger[_0x9cc8('0x12')](_0x9cc8('0x1c'),_0x35beeb);logger[_0x9cc8('0x14')](_0x9cc8('0x1c'),_0x35beeb,JSON['stringify'](_0x451da6));_0x43e183(_0x451da6);})[_0x9cc8('0x24')](function(_0x51e140){logger['error'](_0x9cc8('0x1c'),_0x51e140['message'],_0x35beeb);_0x13ed4a(_0x19d5f5[_0x9cc8('0x17')](0x1f4,_0x51e140[_0x9cc8('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 3c98150..c44d166 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 5fbe206..6923df0 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x5178fb,_0x121e19){var _0x348183=function(_0x52c2ec){while(--_0x52c2ec){_0x5178fb['push'](_0x5178fb['shift']());}};_0x348183(++_0x121e19);}(_0x3e74,0x175));var _0x43e7=function(_0xdd3a66,_0x2102f9){_0xdd3a66=_0xdd3a66-0x0;var _0x1db0a8=_0x3e74[_0xdd3a66];return _0x1db0a8;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x387442,_0x22cf1c){var _0x4def6d=function(_0x33743d){while(--_0x33743d){_0x387442['push'](_0x387442['shift']());}};_0x4def6d(++_0x22cf1c);}(_0x3e74,0x175));var _0x43e7=function(_0x5cb7c5,_0x1ab714){_0x5cb7c5=_0x5cb7c5-0x0;var _0x49e3e5=_0x3e74[_0x5cb7c5];return _0x49e3e5;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index ddabf74..4f6e525 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 _0x7935=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x21de2f,_0x1144b7){var _0x35dcf2=function(_0x4b5f6b){while(--_0x4b5f6b){_0x21de2f['push'](_0x21de2f['shift']());}};_0x35dcf2(++_0x1144b7);}(_0x7935,0x18e));var _0x5793=function(_0x4664f2,_0x2b0027){_0x4664f2=_0x4664f2-0x0;var _0x12e5f6=_0x7935[_0x4664f2];return _0x12e5f6;};'use strict';var Sequelize=require(_0x5793('0x0'));module[_0x5793('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5793('0x2')],'allowNull':![],'defaultValue':_0x5793('0x3')},'appdata':{'type':Sequelize[_0x5793('0x4')]()},'description':{'type':Sequelize[_0x5793('0x2')]},'interval':{'type':Sequelize[_0x5793('0x2')],'defaultValue':_0x5793('0x5')}}; \ No newline at end of file +var _0x5179=['noop','TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x35cb80,_0x2fab97){var _0x1d1cb5=function(_0xe7ae45){while(--_0xe7ae45){_0x35cb80['push'](_0x35cb80['shift']());}};_0x1d1cb5(++_0x2fab97);}(_0x5179,0x1d2));var _0x9517=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x5179[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require(_0x9517('0x0'));module[_0x9517('0x1')]={'priority':{'type':Sequelize[_0x9517('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9517('0x3')},'appdata':{'type':Sequelize[_0x9517('0x4')]()},'description':{'type':Sequelize[_0x9517('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9517('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 54de2cc..0ea5647 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 _0x8aa1=['params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','destroy','end','error','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','show','length','find','create','body'];(function(_0x41e7b9,_0x49eb4d){var _0xc4a6b3=function(_0x490885){while(--_0x490885){_0x41e7b9['push'](_0x41e7b9['shift']());}};_0xc4a6b3(++_0x49eb4d);}(_0x8aa1,0x97));var _0x18aa=function(_0x1a786f,_0x56b6d8){_0x1a786f=_0x1a786f-0x0;var _0x12c96a=_0x8aa1[_0x1a786f];return _0x12c96a;};'use strict';var emlformat=require(_0x18aa('0x0'));var rimraf=require(_0x18aa('0x1'));var zipdir=require(_0x18aa('0x2'));var jsonpatch=require(_0x18aa('0x3'));var rp=require(_0x18aa('0x4'));var moment=require(_0x18aa('0x5'));var BPromise=require(_0x18aa('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x18aa('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x18aa('0x8'));var squel=require(_0x18aa('0x9'));var crypto=require(_0x18aa('0xa'));var jsforce=require(_0x18aa('0xb'));var deskjs=require(_0x18aa('0xc'));var toCsv=require(_0x18aa('0x7'));var querystring=require('querystring');var Papa=require(_0x18aa('0xd'));var Redis=require(_0x18aa('0xe'));var authService=require(_0x18aa('0xf'));var qs=require(_0x18aa('0x10'));var as=require(_0x18aa('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x18aa('0x12'))(_0x18aa('0x13'));var utils=require(_0x18aa('0x14'));var config=require(_0x18aa('0x15'));var licenseUtil=require(_0x18aa('0x16'));var db=require(_0x18aa('0x17'))['db'];function respondWithStatusCode(_0x4e9667,_0x4c9654){_0x4c9654=_0x4c9654||0xcc;return function(_0x466dc1){if(_0x466dc1){return _0x4e9667[_0x18aa('0x18')](_0x4c9654);}return _0x4e9667[_0x18aa('0x19')](_0x4c9654)['end']();};}function respondWithResult(_0x5bc210,_0x2ca4d3){_0x2ca4d3=_0x2ca4d3||0xc8;return function(_0x52851b){if(_0x52851b){return _0x5bc210[_0x18aa('0x19')](_0x2ca4d3)['json'](_0x52851b);}};}function respondWithFilteredResult(_0x2cbef9,_0x42a423){return function(_0x7a8d9c){if(_0x7a8d9c){var _0x47d477=typeof _0x42a423[_0x18aa('0x1a')]===_0x18aa('0x1b')&&typeof _0x42a423[_0x18aa('0x1c')]===_0x18aa('0x1b');var _0xebc97c=_0x7a8d9c[_0x18aa('0x1d')];var _0x2b19b0=_0x47d477?0x0:_0x42a423['offset'];var _0x4e648a=_0x47d477?_0x7a8d9c[_0x18aa('0x1d')]:_0x42a423[_0x18aa('0x1a')]+_0x42a423[_0x18aa('0x1c')];var _0x37d997;if(_0x4e648a>=_0xebc97c){_0x4e648a=_0xebc97c;_0x37d997=0xc8;}else{_0x37d997=0xce;}_0x2cbef9['status'](_0x37d997);return _0x2cbef9[_0x18aa('0x1e')]('Content-Range',_0x2b19b0+'-'+_0x4e648a+'/'+_0xebc97c)[_0x18aa('0x1f')](_0x7a8d9c);}return null;};}function patchUpdates(_0x597724){return function(_0xcac0ad){try{jsonpatch[_0x18aa('0x20')](_0xcac0ad,_0x597724,!![]);}catch(_0x50ea80){return BPromise[_0x18aa('0x21')](_0x50ea80);}return _0xcac0ad['save']();};}function saveUpdates(_0x425570,_0x55e4a1){return function(_0x3d6ec9){if(_0x3d6ec9){return _0x3d6ec9[_0x18aa('0x22')](_0x425570)['then'](function(_0x1e39f1){return _0x1e39f1;});}return null;};}function removeEntity(_0xc9ec86,_0x5da656){return function(_0x468b1a){if(_0x468b1a){return _0x468b1a[_0x18aa('0x23')]()['then'](function(){_0xc9ec86[_0x18aa('0x19')](0xcc)[_0x18aa('0x24')]();});}};}function handleEntityNotFound(_0x182e25,_0x58012d){return function(_0x44e5f1){if(!_0x44e5f1){_0x182e25[_0x18aa('0x18')](0x194);}return _0x44e5f1;};}function handleError(_0x1d27c3,_0xb6d220){_0xb6d220=_0xb6d220||0x1f4;return function(_0x44f045){logger[_0x18aa('0x25')](_0x44f045['stack']);if(_0x44f045['name']){delete _0x44f045[_0x18aa('0x26')];}_0x1d27c3['status'](_0xb6d220)[_0x18aa('0x27')](_0x44f045);};}exports[_0x18aa('0x28')]=function(_0xf306de,_0x49ad75){var _0xe94f73={},_0x2ffd24={},_0x55ca82={'count':0x0,'rows':[]};var _0x1dbe49=_[_0x18aa('0x29')](db[_0x18aa('0x2a')][_0x18aa('0x2b')],function(_0x61b443){return{'name':_0x61b443[_0x18aa('0x2c')],'type':_0x61b443['type'][_0x18aa('0x2d')]};});_0x2ffd24[_0x18aa('0x2e')]=_[_0x18aa('0x29')](_0x1dbe49,_0x18aa('0x26'));_0x2ffd24[_0x18aa('0x2f')]=_[_0x18aa('0x30')](_0xf306de[_0x18aa('0x2f')]);_0x2ffd24['filters']=_[_0x18aa('0x31')](_0x2ffd24['model'],_0x2ffd24['query']);_0xe94f73[_0x18aa('0x32')]=_[_0x18aa('0x31')](_0x2ffd24['model'],qs[_0x18aa('0x33')](_0xf306de[_0x18aa('0x2f')][_0x18aa('0x33')]));_0xe94f73[_0x18aa('0x32')]=_0xe94f73['attributes']['length']?_0xe94f73[_0x18aa('0x32')]:_0x2ffd24['model'];if(!_0xf306de['query'][_0x18aa('0x34')](_0x18aa('0x35'))){_0xe94f73[_0x18aa('0x1c')]=qs[_0x18aa('0x1c')](_0xf306de[_0x18aa('0x2f')]['limit']);_0xe94f73['offset']=qs[_0x18aa('0x1a')](_0xf306de[_0x18aa('0x2f')][_0x18aa('0x1a')]);}_0xe94f73[_0x18aa('0x36')]=qs[_0x18aa('0x37')](_0xf306de[_0x18aa('0x2f')]['sort']);_0xe94f73[_0x18aa('0x38')]=qs[_0x18aa('0x39')](_[_0x18aa('0x3a')](_0xf306de[_0x18aa('0x2f')],_0x2ffd24[_0x18aa('0x39')]),_0x1dbe49);if(_0xf306de['query']['filter']){_0xe94f73[_0x18aa('0x38')]=_[_0x18aa('0x3b')](_0xe94f73['where'],{'$or':_[_0x18aa('0x29')](_0x1dbe49,function(_0x2422ce){if(_0x2422ce['type']!==_0x18aa('0x3c')){var _0x50f621={};_0x50f621[_0x2422ce['name']]={'$like':'%'+_0xf306de[_0x18aa('0x2f')][_0x18aa('0x3d')]+'%'};return _0x50f621;}})});}_0xe94f73=_[_0x18aa('0x3b')]({},_0xe94f73,_0xf306de[_0x18aa('0x3e')]);var _0x370725={'where':_0xe94f73[_0x18aa('0x38')]};return db[_0x18aa('0x2a')][_0x18aa('0x1d')](_0x370725)[_0x18aa('0x3f')](function(_0x59cc85){_0x55ca82[_0x18aa('0x1d')]=_0x59cc85;if(_0xf306de[_0x18aa('0x2f')][_0x18aa('0x40')]){_0xe94f73[_0x18aa('0x41')]=[{'all':!![]}];}return db['SmsApplication'][_0x18aa('0x42')](_0xe94f73);})[_0x18aa('0x3f')](function(_0x3de3fc){_0x55ca82[_0x18aa('0x43')]=_0x3de3fc;return _0x55ca82;})[_0x18aa('0x3f')](respondWithFilteredResult(_0x49ad75,_0xe94f73))[_0x18aa('0x44')](handleError(_0x49ad75,null));};exports[_0x18aa('0x45')]=function(_0x2b61f7,_0x3b88a7){var _0x1f23e0={'raw':!![],'where':{'id':_0x2b61f7['params']['id']}},_0x5e353b={};_0x5e353b[_0x18aa('0x2e')]=_[_0x18aa('0x30')](db[_0x18aa('0x2a')]['rawAttributes']);_0x5e353b[_0x18aa('0x2f')]=_[_0x18aa('0x30')](_0x2b61f7['query']);_0x5e353b['filters']=_['intersection'](_0x5e353b['model'],_0x5e353b[_0x18aa('0x2f')]);_0x1f23e0[_0x18aa('0x32')]=_[_0x18aa('0x31')](_0x5e353b[_0x18aa('0x2e')],qs[_0x18aa('0x33')](_0x2b61f7['query'][_0x18aa('0x33')]));_0x1f23e0[_0x18aa('0x32')]=_0x1f23e0[_0x18aa('0x32')][_0x18aa('0x46')]?_0x1f23e0[_0x18aa('0x32')]:_0x5e353b['model'];if(_0x2b61f7[_0x18aa('0x2f')]['includeAll']){_0x1f23e0['include']=[{'all':!![]}];}_0x1f23e0=_[_0x18aa('0x3b')]({},_0x1f23e0,_0x2b61f7[_0x18aa('0x3e')]);return db['SmsApplication'][_0x18aa('0x47')](_0x1f23e0)[_0x18aa('0x3f')](handleEntityNotFound(_0x3b88a7,null))[_0x18aa('0x3f')](respondWithResult(_0x3b88a7,null))[_0x18aa('0x44')](handleError(_0x3b88a7,null));};exports['create']=function(_0x18855,_0x1f310c){return db['SmsApplication'][_0x18aa('0x48')](_0x18855[_0x18aa('0x49')],{})[_0x18aa('0x3f')](respondWithResult(_0x1f310c,0xc9))['catch'](handleError(_0x1f310c,null));};exports['update']=function(_0x316c1d,_0xad3752){if(_0x316c1d[_0x18aa('0x49')]['id']){delete _0x316c1d[_0x18aa('0x49')]['id'];}return db[_0x18aa('0x2a')][_0x18aa('0x47')]({'where':{'id':_0x316c1d[_0x18aa('0x4a')]['id']}})['then'](handleEntityNotFound(_0xad3752,null))[_0x18aa('0x3f')](saveUpdates(_0x316c1d[_0x18aa('0x49')],null))['then'](respondWithResult(_0xad3752,null))['catch'](handleError(_0xad3752,null));};exports[_0x18aa('0x23')]=function(_0x1c71f5,_0xfec661){return db[_0x18aa('0x2a')][_0x18aa('0x47')]({'where':{'id':_0x1c71f5[_0x18aa('0x4a')]['id']}})[_0x18aa('0x3f')](handleEntityNotFound(_0xfec661,null))['then'](removeEntity(_0xfec661,null))[_0x18aa('0x44')](handleError(_0xfec661,null));}; \ No newline at end of file +var _0x68ed=['filters','merge','filter','options','includeAll','include','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','intersection','query','fields','attributes','length','order','sort','where'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x68ed,0xa0));var _0xd68e=function(_0x3a1a91,_0x395346){_0x3a1a91=_0x3a1a91-0x0;var _0x26268b=_0x68ed[_0x3a1a91];return _0x26268b;};'use strict';var emlformat=require(_0xd68e('0x0'));var rimraf=require(_0xd68e('0x1'));var zipdir=require(_0xd68e('0x2'));var jsonpatch=require(_0xd68e('0x3'));var rp=require(_0xd68e('0x4'));var moment=require(_0xd68e('0x5'));var BPromise=require(_0xd68e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd68e('0x7'));var sox=require(_0xd68e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd68e('0x9'));var _=require(_0xd68e('0xa'));var squel=require(_0xd68e('0xb'));var crypto=require(_0xd68e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd68e('0xd'));var toCsv=require(_0xd68e('0xe'));var querystring=require(_0xd68e('0xf'));var Papa=require(_0xd68e('0x10'));var Redis=require(_0xd68e('0x11'));var authService=require(_0xd68e('0x12'));var qs=require(_0xd68e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd68e('0x14'));var config=require(_0xd68e('0x15'));var licenseUtil=require(_0xd68e('0x16'));var db=require(_0xd68e('0x17'))['db'];function respondWithStatusCode(_0x530fa9,_0x5a1da9){_0x5a1da9=_0x5a1da9||0xcc;return function(_0x306416){if(_0x306416){return _0x530fa9[_0xd68e('0x18')](_0x5a1da9);}return _0x530fa9[_0xd68e('0x19')](_0x5a1da9)[_0xd68e('0x1a')]();};}function respondWithResult(_0xee7a69,_0x3cbc10){_0x3cbc10=_0x3cbc10||0xc8;return function(_0x161197){if(_0x161197){return _0xee7a69[_0xd68e('0x19')](_0x3cbc10)[_0xd68e('0x1b')](_0x161197);}};}function respondWithFilteredResult(_0x39017b,_0x383bfa){return function(_0x465fc4){if(_0x465fc4){var _0x2e6912=typeof _0x383bfa[_0xd68e('0x1c')]===_0xd68e('0x1d')&&typeof _0x383bfa[_0xd68e('0x1e')]===_0xd68e('0x1d');var _0x5e9579=_0x465fc4[_0xd68e('0x1f')];var _0x24f02b=_0x2e6912?0x0:_0x383bfa[_0xd68e('0x1c')];var _0x291f0b=_0x2e6912?_0x465fc4['count']:_0x383bfa['offset']+_0x383bfa[_0xd68e('0x1e')];var _0x1ebaba;if(_0x291f0b>=_0x5e9579){_0x291f0b=_0x5e9579;_0x1ebaba=0xc8;}else{_0x1ebaba=0xce;}_0x39017b[_0xd68e('0x19')](_0x1ebaba);return _0x39017b[_0xd68e('0x20')](_0xd68e('0x21'),_0x24f02b+'-'+_0x291f0b+'/'+_0x5e9579)[_0xd68e('0x1b')](_0x465fc4);}return null;};}function patchUpdates(_0x17758b){return function(_0x661f2a){try{jsonpatch[_0xd68e('0x22')](_0x661f2a,_0x17758b,!![]);}catch(_0x3443d5){return BPromise[_0xd68e('0x23')](_0x3443d5);}return _0x661f2a[_0xd68e('0x24')]();};}function saveUpdates(_0x4f7e1d,_0x30e359){return function(_0x3537d0){if(_0x3537d0){return _0x3537d0[_0xd68e('0x25')](_0x4f7e1d)[_0xd68e('0x26')](function(_0x10956d){return _0x10956d;});}return null;};}function removeEntity(_0x163c88,_0x37e36d){return function(_0xcf6649){if(_0xcf6649){return _0xcf6649['destroy']()['then'](function(){_0x163c88[_0xd68e('0x19')](0xcc)[_0xd68e('0x1a')]();});}};}function handleEntityNotFound(_0x1d2156,_0x3f8571){return function(_0x378c7a){if(!_0x378c7a){_0x1d2156['sendStatus'](0x194);}return _0x378c7a;};}function handleError(_0x57a41f,_0x284559){_0x284559=_0x284559||0x1f4;return function(_0xa7c8c){logger[_0xd68e('0x27')](_0xa7c8c[_0xd68e('0x28')]);if(_0xa7c8c[_0xd68e('0x29')]){delete _0xa7c8c[_0xd68e('0x29')];}_0x57a41f[_0xd68e('0x19')](_0x284559)[_0xd68e('0x2a')](_0xa7c8c);};}exports[_0xd68e('0x2b')]=function(_0x1090da,_0x9cf425){var _0x431023={},_0x3eca52={},_0x15bd56={'count':0x0,'rows':[]};var _0x238b8e=_['map'](db[_0xd68e('0x2c')][_0xd68e('0x2d')],function(_0x1e767b){return{'name':_0x1e767b[_0xd68e('0x2e')],'type':_0x1e767b[_0xd68e('0x2f')][_0xd68e('0x30')]};});_0x3eca52[_0xd68e('0x31')]=_[_0xd68e('0x32')](_0x238b8e,_0xd68e('0x29'));_0x3eca52['query']=_['keys'](_0x1090da['query']);_0x3eca52['filters']=_[_0xd68e('0x33')](_0x3eca52[_0xd68e('0x31')],_0x3eca52[_0xd68e('0x34')]);_0x431023['attributes']=_[_0xd68e('0x33')](_0x3eca52['model'],qs[_0xd68e('0x35')](_0x1090da['query'][_0xd68e('0x35')]));_0x431023[_0xd68e('0x36')]=_0x431023['attributes'][_0xd68e('0x37')]?_0x431023['attributes']:_0x3eca52['model'];if(!_0x1090da[_0xd68e('0x34')]['hasOwnProperty']('nolimit')){_0x431023['limit']=qs[_0xd68e('0x1e')](_0x1090da['query'][_0xd68e('0x1e')]);_0x431023[_0xd68e('0x1c')]=qs[_0xd68e('0x1c')](_0x1090da[_0xd68e('0x34')]['offset']);}_0x431023[_0xd68e('0x38')]=qs[_0xd68e('0x39')](_0x1090da['query']['sort']);_0x431023[_0xd68e('0x3a')]=qs[_0xd68e('0x3b')](_['pick'](_0x1090da[_0xd68e('0x34')],_0x3eca52['filters']),_0x238b8e);if(_0x1090da['query']['filter']){_0x431023[_0xd68e('0x3a')]=_[_0xd68e('0x3c')](_0x431023[_0xd68e('0x3a')],{'$or':_[_0xd68e('0x32')](_0x238b8e,function(_0xb518ad){if(_0xb518ad[_0xd68e('0x2f')]!=='VIRTUAL'){var _0x40a6f4={};_0x40a6f4[_0xb518ad[_0xd68e('0x29')]]={'$like':'%'+_0x1090da[_0xd68e('0x34')][_0xd68e('0x3d')]+'%'};return _0x40a6f4;}})});}_0x431023=_[_0xd68e('0x3c')]({},_0x431023,_0x1090da[_0xd68e('0x3e')]);var _0x367be3={'where':_0x431023[_0xd68e('0x3a')]};return db[_0xd68e('0x2c')][_0xd68e('0x1f')](_0x367be3)[_0xd68e('0x26')](function(_0xe34f99){_0x15bd56['count']=_0xe34f99;if(_0x1090da['query'][_0xd68e('0x3f')]){_0x431023[_0xd68e('0x40')]=[{'all':!![]}];}return db[_0xd68e('0x2c')]['findAll'](_0x431023);})['then'](function(_0x18b638){_0x15bd56[_0xd68e('0x41')]=_0x18b638;return _0x15bd56;})[_0xd68e('0x26')](respondWithFilteredResult(_0x9cf425,_0x431023))[_0xd68e('0x42')](handleError(_0x9cf425,null));};exports[_0xd68e('0x43')]=function(_0x4f9946,_0x10c87f){var _0x1a43a7={'raw':!![],'where':{'id':_0x4f9946['params']['id']}},_0x1d3605={};_0x1d3605['model']=_['keys'](db['SmsApplication'][_0xd68e('0x2d')]);_0x1d3605['query']=_[_0xd68e('0x44')](_0x4f9946[_0xd68e('0x34')]);_0x1d3605[_0xd68e('0x3b')]=_[_0xd68e('0x33')](_0x1d3605[_0xd68e('0x31')],_0x1d3605[_0xd68e('0x34')]);_0x1a43a7[_0xd68e('0x36')]=_['intersection'](_0x1d3605[_0xd68e('0x31')],qs['fields'](_0x4f9946['query'][_0xd68e('0x35')]));_0x1a43a7[_0xd68e('0x36')]=_0x1a43a7['attributes'][_0xd68e('0x37')]?_0x1a43a7['attributes']:_0x1d3605['model'];if(_0x4f9946[_0xd68e('0x34')]['includeAll']){_0x1a43a7[_0xd68e('0x40')]=[{'all':!![]}];}_0x1a43a7=_[_0xd68e('0x3c')]({},_0x1a43a7,_0x4f9946['options']);return db[_0xd68e('0x2c')][_0xd68e('0x45')](_0x1a43a7)['then'](handleEntityNotFound(_0x10c87f,null))[_0xd68e('0x26')](respondWithResult(_0x10c87f,null))['catch'](handleError(_0x10c87f,null));};exports[_0xd68e('0x46')]=function(_0x2bee8b,_0x2487d4){return db[_0xd68e('0x2c')]['create'](_0x2bee8b['body'],{})['then'](respondWithResult(_0x2487d4,0xc9))[_0xd68e('0x42')](handleError(_0x2487d4,null));};exports[_0xd68e('0x25')]=function(_0x1b56fc,_0x3e8c26){if(_0x1b56fc[_0xd68e('0x47')]['id']){delete _0x1b56fc[_0xd68e('0x47')]['id'];}return db[_0xd68e('0x2c')]['find']({'where':{'id':_0x1b56fc[_0xd68e('0x48')]['id']}})['then'](handleEntityNotFound(_0x3e8c26,null))[_0xd68e('0x26')](saveUpdates(_0x1b56fc[_0xd68e('0x47')],null))[_0xd68e('0x26')](respondWithResult(_0x3e8c26,null))[_0xd68e('0x42')](handleError(_0x3e8c26,null));};exports['destroy']=function(_0x87191,_0x1652d6){return db[_0xd68e('0x2c')][_0xd68e('0x45')]({'where':{'id':_0x87191['params']['id']}})[_0xd68e('0x26')](handleEntityNotFound(_0x1652d6,null))[_0xd68e('0x26')](removeEntity(_0x1652d6,null))['catch'](handleError(_0x1652d6,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b4fd458..89771cc 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 _0xf40b=['define','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','exports'];(function(_0x2c1397,_0x12fd4f){var _0x3b3e86=function(_0x29ce8a){while(--_0x29ce8a){_0x2c1397['push'](_0x2c1397['shift']());}};_0x3b3e86(++_0x12fd4f);}(_0xf40b,0xfb));var _0xbf40=function(_0x11a383,_0x4e05ae){_0x11a383=_0x11a383-0x0;var _0x49f2bb=_0xf40b[_0x11a383];return _0x49f2bb;};'use strict';var _=require('lodash');var util=require(_0xbf40('0x0'));var logger=require(_0xbf40('0x1'))('api');var moment=require(_0xbf40('0x2'));var BPromise=require(_0xbf40('0x3'));var rp=require(_0xbf40('0x4'));var fs=require('fs');var path=require(_0xbf40('0x5'));var rimraf=require(_0xbf40('0x6'));var config=require('../../config/environment');var attributes=require(_0xbf40('0x7'));module[_0xbf40('0x8')]=function(_0x26f871,_0x8d8bf7){return _0x26f871[_0xbf40('0x9')]('SmsApplication',attributes,{'tableName':_0xbf40('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbf40('0xb'),'collate':_0xbf40('0xc')});}; \ No newline at end of file +var _0xda34=['./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x39b088,_0x19f936){var _0x26352f=function(_0x454b01){while(--_0x454b01){_0x39b088['push'](_0x39b088['shift']());}};_0x26352f(++_0x19f936);}(_0xda34,0x1c2));var _0x4da3=function(_0x365533,_0x4efe43){_0x365533=_0x365533-0x0;var _0x50197b=_0xda34[_0x365533];return _0x50197b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4da3('0x0'))(_0x4da3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4da3('0x2'));var fs=require('fs');var path=require(_0x4da3('0x3'));var rimraf=require(_0x4da3('0x4'));var config=require(_0x4da3('0x5'));var attributes=require(_0x4da3('0x6'));module[_0x4da3('0x7')]=function(_0x35a847,_0x6171b1){return _0x35a847['define'](_0x4da3('0x8'),attributes,{'tableName':_0x4da3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4da3('0xa'),'collate':_0x4da3('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index df3da3d..d5bee33 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 _0xb5f3=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','SmsApplication,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring'];(function(_0x3974a3,_0x2f0664){var _0xb16e59=function(_0x4777c7){while(--_0x4777c7){_0x3974a3['push'](_0x3974a3['shift']());}};_0xb16e59(++_0x2f0664);}(_0xb5f3,0x137));var _0x3b5f=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0xb5f3[_0x326e79];return _0x37eb89;};'use strict';var _=require(_0x3b5f('0x0'));var util=require(_0x3b5f('0x1'));var moment=require(_0x3b5f('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b5f('0x3'));var fs=require('fs');var Redis=require(_0x3b5f('0x4'));var db=require(_0x3b5f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3b5f('0x6'));var config=require(_0x3b5f('0x7'));var jayson=require(_0x3b5f('0x8'));var client=jayson[_0x3b5f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2db4ad,_0x1b6d67,_0x4edb1a){return new BPromise(function(_0x2e213c,_0x48597e){return client[_0x3b5f('0xa')](_0x2db4ad,_0x4edb1a)[_0x3b5f('0xb')](function(_0x2c37f6){logger[_0x3b5f('0xc')]('SmsApplication,\x20%s,\x20%s',_0x1b6d67,_0x3b5f('0xd'));logger[_0x3b5f('0xe')](_0x3b5f('0xf'),_0x1b6d67,_0x3b5f('0xd'),JSON[_0x3b5f('0x10')](_0x2c37f6));if(_0x2c37f6['error']){if(_0x2c37f6['error']['code']===0x1f4){logger[_0x3b5f('0x11')](_0x3b5f('0x12'),_0x1b6d67,_0x2c37f6[_0x3b5f('0x11')][_0x3b5f('0x13')]);return _0x48597e(_0x2c37f6[_0x3b5f('0x11')][_0x3b5f('0x13')]);}logger[_0x3b5f('0x11')](_0x3b5f('0x12'),_0x1b6d67,_0x2c37f6['error'][_0x3b5f('0x13')]);return _0x2e213c(_0x2c37f6[_0x3b5f('0x11')][_0x3b5f('0x13')]);}else{logger['info'](_0x3b5f('0x12'),_0x1b6d67,'request\x20sent');_0x2e213c(_0x2c37f6[_0x3b5f('0x14')][_0x3b5f('0x13')]);}})['catch'](function(_0x28b6c1){logger[_0x3b5f('0x11')](_0x3b5f('0x12'),_0x1b6d67,_0x28b6c1);_0x48597e(_0x28b6c1);});});} \ No newline at end of file +var _0xffc0=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird'];(function(_0x857d28,_0x13fcd2){var _0x27bfa7=function(_0x156068){while(--_0x156068){_0x857d28['push'](_0x857d28['shift']());}};_0x27bfa7(++_0x13fcd2);}(_0xffc0,0x1a0));var _0x0ffc=function(_0x3589da,_0x1741e0){_0x3589da=_0x3589da-0x0;var _0x34a4a8=_0xffc0[_0x3589da];return _0x34a4a8;};'use strict';var _=require('lodash');var util=require(_0x0ffc('0x0'));var moment=require('moment');var BPromise=require(_0x0ffc('0x1'));var rs=require(_0x0ffc('0x2'));var fs=require('fs');var Redis=require(_0x0ffc('0x3'));var db=require(_0x0ffc('0x4'))['db'];var utils=require(_0x0ffc('0x5'));var logger=require(_0x0ffc('0x6'))(_0x0ffc('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ffc('0x8'));var client=jayson[_0x0ffc('0x9')][_0x0ffc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bbe45,_0x5f25b3,_0x292a77){return new BPromise(function(_0x3db9d4,_0x14a0a1){return client[_0x0ffc('0xb')](_0x4bbe45,_0x292a77)['then'](function(_0x18ebe){logger[_0x0ffc('0xc')](_0x0ffc('0xd'),_0x5f25b3,_0x0ffc('0xe'));logger[_0x0ffc('0xf')](_0x0ffc('0x10'),_0x5f25b3,_0x0ffc('0xe'),JSON[_0x0ffc('0x11')](_0x18ebe));if(_0x18ebe['error']){if(_0x18ebe[_0x0ffc('0x12')][_0x0ffc('0x13')]===0x1f4){logger['error'](_0x0ffc('0xd'),_0x5f25b3,_0x18ebe[_0x0ffc('0x12')][_0x0ffc('0x14')]);return _0x14a0a1(_0x18ebe['error'][_0x0ffc('0x14')]);}logger[_0x0ffc('0x12')]('SmsApplication,\x20%s,\x20%s',_0x5f25b3,_0x18ebe[_0x0ffc('0x12')][_0x0ffc('0x14')]);return _0x3db9d4(_0x18ebe[_0x0ffc('0x12')][_0x0ffc('0x14')]);}else{logger[_0x0ffc('0xc')]('SmsApplication,\x20%s,\x20%s',_0x5f25b3,_0x0ffc('0xe'));_0x3db9d4(_0x18ebe['result'][_0x0ffc('0x14')]);}})[_0x0ffc('0x15')](function(_0x4abd72){logger[_0x0ffc('0x12')]('SmsApplication,\x20%s,\x20%s',_0x5f25b3,_0x4abd72);_0x14a0a1(_0x4abd72);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 919e4af..978f992 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 _0x3c81=['express','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','addTags','tracked','sms','update','delete','smsinteraction:destroy','destroy','/:id/tags','exports','multer','util','connect-timeout'];(function(_0x1bd82d,_0x4966ad){var _0x169bed=function(_0x335073){while(--_0x335073){_0x1bd82d['push'](_0x1bd82d['shift']());}};_0x169bed(++_0x4966ad);}(_0x3c81,0x102));var _0x13c8=function(_0x5e5546,_0x54a2c6){_0x5e5546=_0x5e5546-0x0;var _0x133d5d=_0x3c81[_0x5e5546];return _0x133d5d;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0x6')](_0x13c8('0xf'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x10')]);router[_0x13c8('0x11')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x12')]);router['post'](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x13')]);router[_0x13c8('0x11')]('/:id/tags',auth[_0x13c8('0x7')](),interaction['tracked']('sms','smsinteraction:addtags'),controller[_0x13c8('0x14')]);router['put'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),'smsinteraction:update'),controller[_0x13c8('0x17')]);router[_0x13c8('0x18')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),_0x13c8('0x19')),controller[_0x13c8('0x1a')]);router[_0x13c8('0x18')](_0x13c8('0x1b'),auth[_0x13c8('0x7')](),controller['removeTags']);module[_0x13c8('0x1c')]=router; \ No newline at end of file +var _0xf7b4=['/describe','describe','/:id','show','getMessages','/:id/download','post','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index'];(function(_0x223420,_0x5e23c1){var _0x3b3cfe=function(_0x155d44){while(--_0x155d44){_0x223420['push'](_0x223420['shift']());}};_0x3b3cfe(++_0x5e23c1);}(_0xf7b4,0x152));var _0x4f7b=function(_0x2c1f96,_0x3331ab){_0x2c1f96=_0x2c1f96-0x0;var _0x2b25e4=_0xf7b4[_0x2c1f96];return _0x2b25e4;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0x7')](_0x4f7b('0xc'),auth['isAuthenticated'](),controller[_0x4f7b('0xd')]);router[_0x4f7b('0x7')]('/:id/messages',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0x7')](_0x4f7b('0xf'),auth[_0x4f7b('0x8')](),controller['download']);router[_0x4f7b('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f7b('0x10')](_0x4f7b('0x11'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x12')]);router['post'](_0x4f7b('0x13'),auth[_0x4f7b('0x8')](),interaction[_0x4f7b('0x14')](_0x4f7b('0x15'),_0x4f7b('0x16')),controller[_0x4f7b('0x17')]);router[_0x4f7b('0x18')](_0x4f7b('0xc'),auth[_0x4f7b('0x8')](),interaction[_0x4f7b('0x14')](_0x4f7b('0x15'),_0x4f7b('0x19')),controller['update']);router[_0x4f7b('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x4f7b('0x14')](_0x4f7b('0x15'),'smsinteraction:destroy'),controller[_0x4f7b('0x1b')]);router[_0x4f7b('0x1a')](_0x4f7b('0x13'),auth[_0x4f7b('0x8')](),controller['removeTags']);module[_0x4f7b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 9c787c9..cbee59f 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 _0xa7be=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0xa7be,0xfd));var _0xea7b=function(_0x193836,_0x47914d){_0x193836=_0x193836-0x0;var _0x56a179=_0xa7be[_0x193836];return _0x56a179;};'use strict';var Sequelize=require(_0xea7b('0x0'));var moment=require(_0xea7b('0x1'));module[_0xea7b('0x2')]={'closed':{'type':Sequelize[_0xea7b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xea7b('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xea7b('0x5')]},'note':{'type':Sequelize[_0xea7b('0x5')]},'phone':{'type':Sequelize[_0xea7b('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xea7b('0x6')]('in',_0xea7b('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xea7b('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xea7b('0x6')]('in',_0xea7b('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xea7b('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0738=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x287e09,_0x185de8){var _0x31ddc0=function(_0x107113){while(--_0x107113){_0x287e09['push'](_0x287e09['shift']());}};_0x31ddc0(++_0x185de8);}(_0x0738,0x6e));var _0x8073=function(_0x32358b,_0x5c7c35){_0x32358b=_0x32358b-0x0;var _0x58c21d=_0x0738[_0x32358b];return _0x58c21d;};'use strict';var Sequelize=require(_0x8073('0x0'));var moment=require('moment');module[_0x8073('0x1')]={'closed':{'type':Sequelize[_0x8073('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8073('0x3')]},'disposition':{'type':Sequelize[_0x8073('0x4')]},'secondDisposition':{'type':Sequelize[_0x8073('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8073('0x4')]},'note':{'type':Sequelize[_0x8073('0x4')]},'phone':{'type':Sequelize[_0x8073('0x4')]},'read1stAt':{'type':Sequelize[_0x8073('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8073('0x5')]('in',_0x8073('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8073('0x5')]('in',_0x8073('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8073('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 3420f01..1f7ce6d 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 _0x74e3=['answered','unmanaged','total','closed','UserId','waiting','index','map','SmsInteraction','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','field','from','select','u.fullname','ui.SmsInteractionId','left_join','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','unreadMessages','having','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','type','start','compact','isEmpty','SmsAccountId','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','forEach','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','user','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','role','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.lastName','c.email','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)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','show','params','includeAll','include','options','body','find','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','findAll','color','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','lastName','Messages','direction','secret','SmsAccount','Account','Owner','get','Sms','N.A.','closedAt','out','System','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','name','send','Users','fullname','TagIds','split','Tags','push','catch','talking'];(function(_0x241e88,_0x3245fa){var _0x1a7f77=function(_0x54661a){while(--_0x54661a){_0x241e88['push'](_0x241e88['shift']());}};_0x1a7f77(++_0x3245fa);}(_0x74e3,0xb4));var _0x374e=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x74e3[_0x455c6c];return _0x488242;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x374e('0x0'));var zipdir=require(_0x374e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x374e('0x2'));var moment=require(_0x374e('0x3'));var BPromise=require(_0x374e('0x4'));var Mustache=require(_0x374e('0x5'));var util=require(_0x374e('0x6'));var path=require(_0x374e('0x7'));var sox=require(_0x374e('0x8'));var csv=require('to-csv');var ejs=require(_0x374e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x374e('0xa'));var squel=require(_0x374e('0xb'));var crypto=require(_0x374e('0xc'));var jsforce=require(_0x374e('0xd'));var deskjs=require(_0x374e('0xe'));var toCsv=require(_0x374e('0xf'));var querystring=require(_0x374e('0x10'));var Papa=require(_0x374e('0x11'));var Redis=require('ioredis');var authService=require(_0x374e('0x12'));var qs=require(_0x374e('0x13'));var as=require(_0x374e('0x14'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x374e('0x15'));var logger=require(_0x374e('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x374e('0x17'));var licenseUtil=require(_0x374e('0x18'));var db=require(_0x374e('0x19'))['db'];config[_0x374e('0x1a')]=_[_0x374e('0x1b')](config[_0x374e('0x1a')],{'host':_0x374e('0x1c'),'port':0x18eb});var socket=require(_0x374e('0x1d'))(new Redis(config[_0x374e('0x1a')]));require('./smsInteraction.socket')[_0x374e('0x1e')](socket);function respondWithStatusCode(_0x34b9e2,_0x502fee){_0x502fee=_0x502fee||0xcc;return function(_0x5589b9){if(_0x5589b9){return _0x34b9e2[_0x374e('0x1f')](_0x502fee);}return _0x34b9e2[_0x374e('0x20')](_0x502fee)['end']();};}function respondWithResult(_0x508d83,_0x2ea125){_0x2ea125=_0x2ea125||0xc8;return function(_0x39e461){if(_0x39e461){return _0x508d83['status'](_0x2ea125)[_0x374e('0x21')](_0x39e461);}};}function respondWithFilteredResult(_0x10fb59,_0x5070da){return function(_0x4464a4){if(_0x4464a4){var _0x46b920=typeof _0x5070da[_0x374e('0x22')]===_0x374e('0x23')&&typeof _0x5070da[_0x374e('0x24')]===_0x374e('0x23');var _0x44b8a9=_0x4464a4[_0x374e('0x25')];var _0xf30053=_0x46b920?0x0:_0x5070da[_0x374e('0x22')];var _0x1e965e=_0x46b920?_0x4464a4[_0x374e('0x25')]:_0x5070da['offset']+_0x5070da['limit'];var _0x4486ce;if(_0x1e965e>=_0x44b8a9){_0x1e965e=_0x44b8a9;_0x4486ce=0xc8;}else{_0x4486ce=0xce;}_0x10fb59['status'](_0x4486ce);return _0x10fb59[_0x374e('0x26')](_0x374e('0x27'),_0xf30053+'-'+_0x1e965e+'/'+_0x44b8a9)[_0x374e('0x21')](_0x4464a4);}return null;};}function patchUpdates(_0x5445b5){return function(_0x58ec59){try{jsonpatch[_0x374e('0x28')](_0x58ec59,_0x5445b5,!![]);}catch(_0x12f7e4){return BPromise[_0x374e('0x29')](_0x12f7e4);}return _0x58ec59['save']();};}function saveUpdates(_0x2f499d,_0x5f5aa6){return function(_0x25b3d1){if(_0x25b3d1){return _0x25b3d1[_0x374e('0x2a')](_0x2f499d)['then'](function(_0x42d262){return _0x42d262;});}return null;};}function removeEntity(_0x11080c,_0x4e9909){return function(_0x551504){if(_0x551504){return _0x551504[_0x374e('0x2b')]()[_0x374e('0x2c')](function(){_0x11080c[_0x374e('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b3019,_0x1707a7){return function(_0x3ef9e1){if(!_0x3ef9e1){_0x5b3019[_0x374e('0x1f')](0x194);}return _0x3ef9e1;};}function handleError(_0x2ada6c,_0x30b893){_0x30b893=_0x30b893||0x1f4;return function(_0x2b8ee2){logger[_0x374e('0x2d')](_0x2b8ee2['stack']);if(_0x2b8ee2[_0x374e('0x2e')]){delete _0x2b8ee2[_0x374e('0x2e')];}_0x2ada6c[_0x374e('0x20')](_0x30b893)[_0x374e('0x2f')](_0x2b8ee2);};}function getInteractionUsers(_0xe7f029,_0xb9c227){return new BPromise(function(_0xe18141,_0x2a9f67){try{if(_0xb9c227[_0xe7f029['id']]){_0xe7f029[_0x374e('0x30')]=_['map'](_0xb9c227[_0xe7f029['id']],function(_0x2ab176){return{'id':_0x2ab176['id'],'fullname':_0x2ab176[_0x374e('0x31')]};});}}catch(_0x4fc6dd){_0x2a9f67(_0x4fc6dd);}_0xe18141(_0xe7f029);});}function getInteractionTags(_0x56e016,_0x68004f){return new BPromise(function(_0x15aa0,_0x14e20b){try{if(_0x56e016[_0x374e('0x32')]){_0x56e016['Tags']=[];_0x56e016[_0x374e('0x32')][_0x374e('0x33')](',')['forEach'](function(_0x5052f1){_0x56e016[_0x374e('0x34')][_0x374e('0x35')](_0x68004f[_0x5052f1]);});}delete _0x56e016['TagIds'];}catch(_0x234de7){_0x14e20b(_0x234de7);}_0x15aa0(_0x56e016);});}function updateSmsInteraction(_0x468e52,_0x87dcda,_0x313426){return new BPromise(function(_0x5b379f,_0x7ef0c0){return getInteractionUsers(_0x468e52,_0x313426)[_0x374e('0x2c')](function(_0x59ef47){return getInteractionTags(_0x59ef47,_0x87dcda);})[_0x374e('0x2c')](function(_0x1728b1){return getStateInteraction(_0x1728b1);})[_0x374e('0x2c')](function(_0x37248f){_0x5b379f(_0x37248f);})[_0x374e('0x36')](function(_0x463eb4){_0x7ef0c0(_0x463eb4);});});}function getStateInteraction(_0x3a2434){return new BPromise(function(_0x45792c){_0x3a2434['waiting']=0x0;_0x3a2434[_0x374e('0x37')]=0x0;_0x3a2434[_0x374e('0x38')]=0x0;_0x3a2434[_0x374e('0x39')]=0x0;_0x3a2434[_0x374e('0x3a')]=0x0;if(!_0x3a2434[_0x374e('0x3b')]&&!_0x3a2434[_0x374e('0x3c')]){_0x3a2434[_0x374e('0x3d')]+=0x1;}if(!_0x3a2434[_0x374e('0x3b')]&&_0x3a2434[_0x374e('0x3c')]){_0x3a2434[_0x374e('0x37')]+=0x1;if(_0x3a2434['waiting']){_0x3a2434[_0x374e('0x3d')]-=0x1;}}if(_0x3a2434[_0x374e('0x3b')]&&_0x3a2434[_0x374e('0x3c')]){_0x3a2434['answered']+=0x1;if(_0x3a2434[_0x374e('0x37')]){_0x3a2434[_0x374e('0x37')]-=0x1;}}if(_0x3a2434[_0x374e('0x3b')]&&!_0x3a2434['UserId']){_0x3a2434['unmanaged']+=0x1;if(_0x3a2434[_0x374e('0x3d')]){_0x3a2434[_0x374e('0x3d')]-=0x1;}}_0x3a2434[_0x374e('0x3a')]+=0x1;_0x45792c(_0x3a2434);});}exports[_0x374e('0x3e')]=function(_0x1f66a1,_0x1da698){var _0x200046={},_0x376de2={},_0x58ae91={'count':0x0,'rows':[]};var _0x2b887c=_[_0x374e('0x3f')](db[_0x374e('0x40')][_0x374e('0x41')],function(_0x4ce442){return{'name':_0x4ce442[_0x374e('0x42')],'type':_0x4ce442['type'][_0x374e('0x43')]};});_0x376de2['model']=_[_0x374e('0x3f')](_0x2b887c,_0x374e('0x2e'));_0x376de2[_0x374e('0x44')]=_[_0x374e('0x45')](_0x1f66a1['query']);_0x376de2['filters']=_[_0x374e('0x46')](_0x376de2[_0x374e('0x47')],_0x376de2[_0x374e('0x44')]);_0x200046[_0x374e('0x48')]=_['intersection'](_0x376de2['model'],qs[_0x374e('0x49')](_0x1f66a1[_0x374e('0x44')][_0x374e('0x49')]));_0x200046[_0x374e('0x48')]=_0x200046[_0x374e('0x48')][_0x374e('0x4a')]?_0x200046[_0x374e('0x48')]:_0x376de2['model'];if(!_0x1f66a1[_0x374e('0x44')][_0x374e('0x4b')](_0x374e('0x4c'))){_0x200046['limit']=qs['limit'](_0x1f66a1[_0x374e('0x44')][_0x374e('0x24')]);_0x200046['offset']=qs[_0x374e('0x22')](_0x1f66a1[_0x374e('0x44')][_0x374e('0x22')]);}_0x200046[_0x374e('0x4d')]=qs[_0x374e('0x4e')](_0x1f66a1['query'][_0x374e('0x4e')]);_0x200046[_0x374e('0x4f')]=qs[_0x374e('0x50')](_[_0x374e('0x51')](_0x1f66a1[_0x374e('0x44')],_0x376de2[_0x374e('0x50')]),_0x2b887c);var _0x3a9389=[];var _0x7868f7=squel['select']()[_0x374e('0x52')]('id')[_0x374e('0x52')](_0x374e('0x2e'))[_0x374e('0x52')]('color')[_0x374e('0x53')]('tools_tags');var _0x3020ac=squel[_0x374e('0x54')]()[_0x374e('0x52')]('u.id')[_0x374e('0x52')](_0x374e('0x55'))[_0x374e('0x52')](_0x374e('0x56'))[_0x374e('0x53')]('user_has_sms_interactions','ui')[_0x374e('0x57')]('users','u',_0x374e('0x58'));var _0x599e50=squel['select']()['from'](_0x374e('0x59'),'i')[_0x374e('0x57')]('cm_contacts','c',_0x374e('0x5a'))[_0x374e('0x57')]('users','o',_0x374e('0x5b'))[_0x374e('0x57')](_0x374e('0x5c'),'a',_0x374e('0x5d'))[_0x374e('0x57')](_0x374e('0x5e'),'me',_0x374e('0x5f'))[_0x374e('0x57')]('sms_interaction_has_tags','it',_0x374e('0x60'))[_0x374e('0x57')](_0x374e('0x61'),'t',_0x374e('0x62'));var _0x28ef1b=squel['expr']();var _0x5783c9=[];var _0x238649=squel[_0x374e('0x63')]();var _0x2f61f4;if(_0x1f66a1[_0x374e('0x44')]['search']){_0x2f61f4=as[_0x374e('0x64')](_0x1f66a1[_0x374e('0x44')][_0x374e('0x65')]);var _0x24982a=_0x2f61f4[_0x374e('0x66')];for(var _0x3ab0c9=0x0;_0x3ab0c9<_0x2f61f4['conditions'][_0x374e('0x4a')];_0x3ab0c9++){var _0x1914d3=_0x2f61f4[_0x374e('0x67')][_0x3ab0c9];var _0x3689b6='i';var _0x39d14c=_['find'](_0x2b887c,[_0x374e('0x2e'),_0x1914d3[_0x374e('0x52')]]);if(!_0x39d14c){switch(_0x1914d3[_0x374e('0x52')]){case _0x374e('0x68'):if(_0x1914d3['value']==0x1){_0x599e50[_0x374e('0x69')]('`'+_0x1914d3[_0x374e('0x52')]+'`\x20=\x200');}else{_0x599e50['having']('`'+_0x1914d3[_0x374e('0x52')]+'`\x20>\x200');}break;case _0x374e('0x6a'):if(_0x1914d3[_0x374e('0x6b')]===_0x374e('0x6c')){if(_0x1914d3[_0x374e('0x6d')][_0x374e('0x33')]('\x20')[_0x374e('0x4a')]>0x1){_0x28ef1b[_0x24982a](_0x374e('0x6e'),qs['getFullTextValue'](_0x1914d3[_0x374e('0x6d')]),null);}else{var _0x32f696='%'+_0x1914d3[_0x374e('0x6d')]+'%';_0x28ef1b[_0x24982a](_0x374e('0x6f'),_0x32f696,_0x32f696,_0x32f696);}}else{_0x39d14c=_['find'](_0x2b887c,[_0x374e('0x2e'),_0x374e('0x70')]);_0x1914d3[_0x374e('0x52')]=_0x374e('0x70');_0x453e35=as[_0x374e('0x71')](_0x3689b6,_0x39d14c['type'],_0x1914d3);_0x28ef1b[_0x24982a](_0x453e35[_0x374e('0x72')],_0x453e35[_0x374e('0x6d')]['start'],_0x453e35[_0x374e('0x6d')][_0x374e('0x73')]);}break;case _0x374e('0x74'):var _0x3eb321=_0x1914d3['value'][_0x374e('0x33')](',')[_0x374e('0x3f')](function(_0x4bdbfe){return Number(_0x4bdbfe);});_0x3eb321['forEach'](function(_0x5c4477){_0x238649['or'](_0x374e('0x75'),'%,'+_0x5c4477+',%');});_0x5783c9=_['union'](_0x5783c9,_0x3eb321);break;case _0x374e('0x76'):if(_0x1914d3[_0x374e('0x6b')]===_0x374e('0x6c')){_0x28ef1b[_0x24982a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1914d3[_0x374e('0x6d')]+'%',null);}else{_0x39d14c=_['find'](_0x2b887c,[_0x374e('0x2e'),_0x374e('0x3c')]);_0x1914d3[_0x374e('0x52')]=_0x374e('0x3c');_0x453e35=as[_0x374e('0x71')](_0x3689b6,_0x39d14c[_0x374e('0x77')],_0x1914d3);_0x28ef1b[_0x24982a](_0x453e35[_0x374e('0x72')],_0x453e35[_0x374e('0x6d')][_0x374e('0x78')],_0x453e35['value'][_0x374e('0x73')]);}break;case'body':_0x453e35=as[_0x374e('0x71')]('me',null,_0x1914d3);_0x28ef1b[_0x24982a](_0x453e35[_0x374e('0x72')],_0x453e35['value'][_0x374e('0x78')],_0x453e35['value'][_0x374e('0x73')]);break;}}else{var _0x453e35=as[_0x374e('0x71')](_0x3689b6,_0x39d14c['type'],_0x1914d3);_0x28ef1b[_0x24982a](_0x453e35[_0x374e('0x72')],_0x453e35[_0x374e('0x6d')][_0x374e('0x78')],_0x453e35['value']['end']);}}}else{var _0x3cd02d=_(_0x1f66a1[_0x374e('0x44')])['keys']()[_0x374e('0x3f')](function(_0x240b8a){return _['some'](_0x2b887c,['name',_0x240b8a])?_0x240b8a:undefined;})[_0x374e('0x79')]()[_0x374e('0x6d')]();if(!_[_0x374e('0x7a')](_0x3cd02d)){_0x3cd02d['forEach'](function(_0x5687b0){if(_0x5687b0===_0x374e('0x7b')){_0x599e50[_0x374e('0x4f')]('i.SmsAccountId\x20IN\x20?',[][_0x374e('0x7c')](_0x1f66a1['query'][_0x5687b0]));}else if(_0x5687b0===_0x374e('0x7d')){var _0x8bfb3=JSON['parse'](_0x1f66a1['query'][_0x5687b0])[_0x374e('0x7e')];var _0x5c2546=JSON[_0x374e('0x7f')](_0x1f66a1['query'][_0x5687b0])['$lte'];_0x599e50['where'](_0x374e('0x80'),_0x8bfb3,_0x5c2546);}else{if(_0x1f66a1[_0x374e('0x44')][_0x5687b0]==='null'){_0x599e50['where']('i.'+_0x5687b0+'\x20IS\x20NULL');}else{_0x599e50['where']('i.'+_0x5687b0+_0x374e('0x81'),_0x1f66a1[_0x374e('0x44')][_0x5687b0]);}}});}if(_0x1f66a1[_0x374e('0x44')][_0x374e('0x82')]){if(_0x1f66a1['query']['read']==0x1){_0x599e50[_0x374e('0x69')](_0x374e('0x83'));}else{_0x599e50['having'](_0x374e('0x84'));}}if(_0x1f66a1[_0x374e('0x44')][_0x374e('0x85')]){_0x5783c9=_['isArray'](_0x1f66a1[_0x374e('0x44')]['tag'])?_0x1f66a1[_0x374e('0x44')][_0x374e('0x85')]:new Array(_0x1f66a1[_0x374e('0x44')][_0x374e('0x85')]);_0x5783c9[_0x374e('0x86')](function(_0x599e34){_0x238649['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x599e34+',%');});}if(_0x1f66a1[_0x374e('0x44')][_0x374e('0x87')]){var _0x1cdd3d=_0x1f66a1[_0x374e('0x44')][_0x374e('0x87')][_0x374e('0x88')]('\x5c','\x5c\x5c')[_0x374e('0x88')](/'/g,'\x27\x27');if(qs[_0x374e('0x89')](_0x1cdd3d)){_0x28ef1b['or'](_0x374e('0x8a'),_0x1cdd3d+'%')['or'](_0x374e('0x8b'),_0x1cdd3d+'%');}else{_0x28ef1b['or'](_0x374e('0x8c'),qs[_0x374e('0x8d')](_0x1cdd3d))['or'](_0x374e('0x8e'),_0x1cdd3d+'%');}}}_0x599e50[_0x374e('0x4f')](_0x28ef1b);_0x599e50[_0x374e('0x8f')](_0x374e('0x90'));var _0x33a4cf={'type':db[_0x374e('0x91')][_0x374e('0x92')]['SELECT'],'raw':!![]};var _0x1f339a=_0x599e50[_0x374e('0x93')]();_0x1f339a[_0x374e('0x52')](_0x374e('0x90'));_0x1f339a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x374e('0x68'));if(_0x200046[_0x374e('0x4d')]){_0x200046[_0x374e('0x4d')][_0x374e('0x86')](function(_0x24a44d){var _0x1e1257=_0x24a44d[0x0]===_0x374e('0x94')?_0x24a44d[0x0]:'i.'+_0x24a44d[0x0];_0x599e50[_0x374e('0x4d')](_0x1e1257,_0x24a44d[0x1]===_0x374e('0x95')?![]:!![]);});}if(!_['isEmpty'](_0x5783c9)){_0x599e50['having'](_0x238649);_0x1f339a[_0x374e('0x4f')](_0x374e('0x96'),_0x5783c9);}BPromise[_0x374e('0x97')]()[_0x374e('0x2c')](function(){if(!_0x2f61f4){if(_0x1f66a1[_0x374e('0x44')][_0x374e('0x7b')])return;_0x1f339a[_0x374e('0x4f')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x599e50['where'](_0x374e('0x98'));return;}if(_0x1f66a1['user']['role']!==_0x374e('0x99'))return;return _0x1f66a1[_0x374e('0x9a')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x374e('0x2c')](function(_0xd514cc){if(_[_0x374e('0x7a')](_0xd514cc)){_0x1f339a[_0x374e('0x4f')](_0x374e('0x9b'));_0x599e50[_0x374e('0x4f')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x1f339a[_0x374e('0x4f')]('i.SmsAccountId\x20IN\x20?',_[_0x374e('0x3f')](_0xd514cc,'id'));_0x599e50['where'](_0x374e('0x9c'),_[_0x374e('0x3f')](_0xd514cc,'id'));}});})[_0x374e('0x2c')](function(){if(_0x1f66a1[_0x374e('0x9a')][_0x374e('0x9d')]===_0x374e('0x99')&&!_0x2f61f4&&!_0x1f66a1[_0x374e('0x44')][_0x374e('0x7b')])return[];return db[_0x374e('0x9e')][_0x374e('0x44')](_0x1f339a[_0x374e('0x9f')](),_0x33a4cf);})[_0x374e('0x2c')](function(_0x216cba){_0x58ae91[_0x374e('0x25')]=_0x216cba[_0x374e('0x4a')];if(_0x58ae91[_0x374e('0x25')]===0x0)return[];return db[_0x374e('0x9e')][_0x374e('0x44')](_0x7868f7[_0x374e('0x9f')](),_0x33a4cf)[_0x374e('0x2c')](function(_0x5cf261){_0x3a9389=_['keyBy'](_0x5cf261,'id');_0x33a4cf=_[_0x374e('0xa0')](_0x33a4cf,{'model':db[_0x374e('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f66a1[_0x374e('0x44')]['fields']){_0x200046[_0x374e('0x48')][_0x374e('0x86')](function(_0x29144e){_0x599e50[_0x374e('0x52')]('i.'+_0x29144e);});}else{_0x599e50[_0x374e('0x52')](_0x374e('0xa1'),_0x374e('0x68'));_0x599e50[_0x374e('0x52')]('a.key',_0x374e('0xa2'));_0x599e50[_0x374e('0x52')]('a.mandatoryDisposition',_0x374e('0xa3'));_0x599e50['field'](_0x374e('0xa4'),_0x374e('0x94'));_0x599e50[_0x374e('0x52')]('i.*');_0x599e50['field'](_0x374e('0xa5'),'Contact.firstName');_0x599e50[_0x374e('0x52')]('c.lastName',_0x374e('0xa6'));_0x599e50[_0x374e('0x52')](_0x374e('0xa7'),_0x374e('0xa8'));_0x599e50[_0x374e('0x52')](_0x374e('0xa9'),_0x374e('0xaa'));_0x599e50[_0x374e('0x52')](_0x374e('0xab'),_0x374e('0xac'));_0x599e50['field'](_0x374e('0xad'),_0x374e('0xae'));_0x599e50[_0x374e('0x52')](_0x374e('0xaf'),_0x374e('0xb0'));_0x599e50[_0x374e('0x52')](_0x374e('0xb1'),_0x374e('0xb2'));_0x599e50[_0x374e('0x52')](_0x374e('0xb3'),'TagIds');}if(_0x200046[_0x374e('0x24')])_0x599e50[_0x374e('0x24')](_0x200046[_0x374e('0x24')]);if(_0x200046['offset'])_0x599e50[_0x374e('0x22')](_0x200046['offset']);return db[_0x374e('0x9e')][_0x374e('0x44')](_0x599e50[_0x374e('0x9f')](),_0x33a4cf);})[_0x374e('0x2c')](function(_0x68867e){if(_0x68867e[_0x374e('0x4a')]>0x0)_0x3020ac[_0x374e('0x4f')](_0x374e('0xb4'),_[_0x374e('0x3f')](_0x68867e,'id'));return db[_0x374e('0x9e')][_0x374e('0x44')](_0x3020ac[_0x374e('0x9f')](),_0x33a4cf)[_0x374e('0x2c')](function(_0x378c03){var _0xcd92c0=_[_0x374e('0xb5')](_0x378c03,_0x374e('0xb6'));var _0xdc828=[];_0x68867e['forEach'](function(_0xa46fac){_0xdc828[_0x374e('0x35')](updateSmsInteraction(_0xa46fac,_0x3a9389,_0xcd92c0));});return BPromise[_0x374e('0xb7')](_0xdc828);});});})[_0x374e('0x2c')](function(_0x412ad7){_0x58ae91['rows']=_0x412ad7;return _0x58ae91;})[_0x374e('0x2c')](respondWithFilteredResult(_0x1da698,_0x200046))[_0x374e('0x36')](handleError(_0x1da698,null));};exports[_0x374e('0xb8')]=function(_0xebd8c3,_0x48e684){var _0x196b8c={'raw':![],'where':{'id':_0xebd8c3[_0x374e('0xb9')]['id']}},_0xbcf120={};_0xbcf120[_0x374e('0x47')]=_[_0x374e('0x45')](db['SmsInteraction'][_0x374e('0x41')]);_0xbcf120[_0x374e('0x44')]=_[_0x374e('0x45')](_0xebd8c3[_0x374e('0x44')]);_0xbcf120[_0x374e('0x50')]=_[_0x374e('0x46')](_0xbcf120['model'],_0xbcf120[_0x374e('0x44')]);_0x196b8c[_0x374e('0x48')]=_[_0x374e('0x46')](_0xbcf120[_0x374e('0x47')],qs[_0x374e('0x49')](_0xebd8c3[_0x374e('0x44')][_0x374e('0x49')]));_0x196b8c[_0x374e('0x48')]=_0x196b8c['attributes'][_0x374e('0x4a')]?_0x196b8c['attributes']:_0xbcf120[_0x374e('0x47')];if(_0xebd8c3['query'][_0x374e('0xba')]){_0x196b8c[_0x374e('0xbb')]=[{'all':!![]}];}_0x196b8c=_[_0x374e('0xa0')]({},_0x196b8c,_0xebd8c3[_0x374e('0xbc')]);return db[_0x374e('0x40')]['find'](_0x196b8c)['then'](handleEntityNotFound(_0x48e684,null))[_0x374e('0x2c')](respondWithResult(_0x48e684,null))[_0x374e('0x36')](handleError(_0x48e684,null));};exports['create']=function(_0x55a04a,_0x3c4ee0){return db[_0x374e('0x40')]['create'](_0x55a04a[_0x374e('0xbd')],{})[_0x374e('0x2c')](respondWithResult(_0x3c4ee0,0xc9))[_0x374e('0x36')](handleError(_0x3c4ee0,null));};exports[_0x374e('0x2a')]=function(_0x2839a5,_0x46364e){if(_0x2839a5['body']['id']){delete _0x2839a5[_0x374e('0xbd')]['id'];}return db[_0x374e('0x40')][_0x374e('0xbe')]({'where':{'id':_0x2839a5[_0x374e('0xb9')]['id']}})['then'](handleEntityNotFound(_0x46364e,null))['then'](saveUpdates(_0x2839a5[_0x374e('0xbd')],null))[_0x374e('0x2c')](respondWithResult(_0x46364e,null))['catch'](handleError(_0x46364e,null));};exports['destroy']=function(_0x35cb5f,_0x1b952d){return db[_0x374e('0x40')][_0x374e('0xbe')]({'where':{'id':_0x35cb5f[_0x374e('0xb9')]['id']}})[_0x374e('0x2c')](handleEntityNotFound(_0x1b952d,null))[_0x374e('0x2c')](removeEntity(_0x1b952d,null))['catch'](handleError(_0x1b952d,null));};exports[_0x374e('0xbf')]=function(_0x405eec,_0xac5874){return db[_0x374e('0x40')][_0x374e('0xbf')]()['then'](respondWithResult(_0xac5874,null))[_0x374e('0x36')](handleError(_0xac5874,null));};exports[_0x374e('0xc0')]=function(_0x3debf0,_0xd50d59,_0x24dd33){return db[_0x374e('0xc1')][_0x374e('0xbe')]({'where':{'id':_0x3debf0[_0x374e('0xb9')]['id']}})[_0x374e('0x2c')](handleEntityNotFound(_0xd50d59,null))[_0x374e('0x2c')](function(_0x2c6661){if(_0x2c6661){return _0x2c6661[_0x374e('0xc0')](_0x3debf0['body'][_0x374e('0xc2')],_[_0x374e('0xc3')](_0x3debf0[_0x374e('0xbd')],[_0x374e('0xc2'),'id'])||{});}})[_0x374e('0x2c')](respondWithResult(_0xd50d59,null))['catch'](handleError(_0xd50d59,null));};exports[_0x374e('0xc4')]=function(_0x3fdc55,_0x508247,_0x3e8765){var _0x4b33d5={'raw':![],'where':{}};var _0x1409e1={};var _0x153b20={'count':0x0,'rows':[]};return db[_0x374e('0x40')][_0x374e('0xc5')]({'where':{'id':_0x3fdc55[_0x374e('0xb9')]['id']}})[_0x374e('0x2c')](handleEntityNotFound(_0x508247,null))['then'](function(_0x1771da){if(_0x1771da){_0x1409e1['model']=_['keys'](db[_0x374e('0xc1')][_0x374e('0x41')]);_0x1409e1['query']=_[_0x374e('0x45')](_0x3fdc55[_0x374e('0x44')]);_0x1409e1[_0x374e('0x50')]=_[_0x374e('0x46')](_0x1409e1['model'],_0x1409e1[_0x374e('0x44')]);_0x4b33d5[_0x374e('0x48')]=_['intersection'](_0x1409e1[_0x374e('0x47')],qs['fields'](_0x3fdc55[_0x374e('0x44')][_0x374e('0x49')]));_0x4b33d5['attributes']=_0x4b33d5[_0x374e('0x48')][_0x374e('0x4a')]?_0x4b33d5[_0x374e('0x48')]:_0x1409e1[_0x374e('0x47')];if(!_0x3fdc55[_0x374e('0x44')][_0x374e('0x4b')](_0x374e('0x4c'))){_0x4b33d5['limit']=qs[_0x374e('0x24')](_0x3fdc55['query']['limit']);_0x4b33d5[_0x374e('0x22')]=qs[_0x374e('0x22')](_0x3fdc55['query']['offset']);}_0x4b33d5[_0x374e('0x4d')]=qs[_0x374e('0x4e')](_0x3fdc55[_0x374e('0x44')][_0x374e('0x4e')]);_0x4b33d5['where']=qs['filters'](_[_0x374e('0x51')](_0x3fdc55['query'],_0x1409e1[_0x374e('0x50')]));_0x4b33d5[_0x374e('0x4f')][_0x374e('0xb6')]=_0x1771da['id'];if(_0x3fdc55['query']['filter']){_0x4b33d5[_0x374e('0x4f')]=_[_0x374e('0xa0')](_0x4b33d5[_0x374e('0x4f')],{'$or':_['map'](_0x4b33d5[_0x374e('0x48')],function(_0x52c638){var _0x41a908={};_0x41a908[_0x52c638]={'$like':'%'+_0x3fdc55[_0x374e('0x44')][_0x374e('0x87')]+'%'};return _0x41a908;})});}if(_0x3fdc55[_0x374e('0x44')]['$gte']){var _0x58d3b3=_0x3fdc55['query']['$gte'][_0x374e('0x33')](',');var _0x2d6c16={};_0x2d6c16[_0x58d3b3[0x0]]={'$gte':moment(_0x58d3b3[0x1])[_0x374e('0xc6')](_0x374e('0xc7'))};_0x4b33d5['where']=_[_0x374e('0xa0')](_0x4b33d5[_0x374e('0x4f')],_0x2d6c16);}_0x4b33d5=_[_0x374e('0xa0')]({},_0x4b33d5,_0x3fdc55[_0x374e('0xbc')]);return db[_0x374e('0xc1')][_0x374e('0x25')]({'where':_0x4b33d5[_0x374e('0x4f')]})['then'](function(_0x267787){_0x153b20[_0x374e('0x25')]=_0x267787;if(_0x3fdc55['query'][_0x374e('0xba')]){_0x4b33d5[_0x374e('0xbb')]=[{'all':!![]}];}return db[_0x374e('0xc1')]['findAll'](_0x4b33d5);})[_0x374e('0x2c')](function(_0x304c9f){_0x153b20['rows']=_0x304c9f;return _0x153b20;});}})[_0x374e('0x2c')](respondWithFilteredResult(_0x508247,_0x4b33d5))[_0x374e('0x36')](handleError(_0x508247,null));};exports[_0x374e('0xc8')]=function(_0x5901ec,_0x1ec3a2,_0x17eea1){return db['SmsInteraction'][_0x374e('0xbe')]({'where':{'id':_0x5901ec[_0x374e('0xb9')]['id']}})[_0x374e('0x2c')](handleEntityNotFound(_0x1ec3a2,null))[_0x374e('0x2c')](function(_0x3dd654){if(_0x3dd654){return _0x3dd654[_0x374e('0xc9')](_0x5901ec['body'][_0x374e('0xc2')],_[_0x374e('0xc3')](_0x5901ec[_0x374e('0xbd')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x374e('0xca')]({'attributes':['id','name',_0x374e('0xcb')],'where':{'id':_0x5901ec[_0x374e('0xbd')][_0x374e('0xc2')]}});})['then'](function(_0x372eed){socket[_0x374e('0xcc')](_0x374e('0xcd'),{'id':Number(_0x5901ec[_0x374e('0xb9')]['id']),'tags':_0x372eed||[]});return{'id':Number(_0x5901ec[_0x374e('0xb9')]['id']),'tags':_0x372eed||[]};});}})['then'](respondWithResult(_0x1ec3a2,null))[_0x374e('0x36')](handleError(_0x1ec3a2,null));};exports['removeTags']=function(_0x128e2a,_0x2efa4e,_0x4c82bd){return db[_0x374e('0x40')]['find']({'where':{'id':_0x128e2a['params']['id']}})[_0x374e('0x2c')](handleEntityNotFound(_0x2efa4e,null))[_0x374e('0x2c')](function(_0x4c50c1){if(_0x4c50c1){return _0x4c50c1[_0x374e('0xce')](_0x128e2a[_0x374e('0x44')]['ids']);}})[_0x374e('0x2c')](respondWithStatusCode(_0x2efa4e,null))[_0x374e('0x36')](handleError(_0x2efa4e,null));};exports[_0x374e('0xcf')]=function(_0x3f5953,_0x465317){var _0x12a4f4=moment()[_0x374e('0xd0')]()[_0x374e('0x9f')]();var _0x672ee1=path[_0x374e('0xd1')](config[_0x374e('0xd2')],_0x374e('0xd3'),_0x374e('0xd4'),_0x374e('0xd5'));var _0x12af8c=path[_0x374e('0xd1')](config[_0x374e('0xd2')],_0x374e('0xd3'),_0x374e('0xd4'),_0x374e('0xd6'));var _0x325f1a=path['join'](_0x672ee1,_0x12a4f4);var _0x10153e=util[_0x374e('0xc6')](_0x374e('0xd7'),_0x3f5953['params']['id'],_0x12a4f4);var _0x1aa5fd=path[_0x374e('0xd1')](_0x672ee1,_0x10153e);var _0x542c76=[];_0x542c76[_0x374e('0x35')]({'model':db[_0x374e('0x76')],'as':_0x374e('0x76'),'attributes':['id',_0x374e('0x31')],'raw':!![]});_0x542c76[_0x374e('0x35')]({'model':db[_0x374e('0xd8')],'as':_0x374e('0x6a'),'attributes':['id','firstName',_0x374e('0xd9')],'raw':!![]});var _0x3d1b26=[{'model':db['SmsMessage'],'as':_0x374e('0xda'),'attributes':['id',_0x374e('0xbd'),_0x374e('0x7d'),_0x374e('0xdb'),_0x374e('0xdc'),_0x374e('0x82')],'include':_0x542c76}];_0x3d1b26['push']({'model':db[_0x374e('0xdd')],'as':_0x374e('0xde'),'attributes':['id',_0x374e('0x2e')]});_0x3d1b26[_0x374e('0x35')]({'model':db[_0x374e('0x76')],'as':_0x374e('0xdf'),'attributes':['id',_0x374e('0x31')]});return db[_0x374e('0x40')][_0x374e('0xbe')]({'where':{'id':_0x3f5953[_0x374e('0xb9')]['id']},'include':_0x3d1b26})[_0x374e('0x2c')](handleEntityNotFound(_0x465317,null))[_0x374e('0x2c')](function(_0x5683cc){if(_0x5683cc){var _0x58e35a=_0x5683cc[_0x374e('0xe0')]({'plain':!![]});fs['mkdirSync'](_0x325f1a);var _0x3740e4={'channel':_0x374e('0xe1'),'account':_0x58e35a[_0x374e('0xde')]['name'],'agent':_0x58e35a[_0x374e('0xdf')]?_0x58e35a[_0x374e('0xdf')][_0x374e('0x31')]:_0x374e('0xe2'),'createdAt':moment(_0x58e35a[_0x374e('0x7d')])[_0x374e('0xc6')](_0x374e('0xc7'))[_0x374e('0x9f')](),'closedAt':_0x58e35a[_0x374e('0x3b')]?moment(_0x58e35a[_0x374e('0xe3')])[_0x374e('0xc6')](_0x374e('0xc7'))[_0x374e('0x9f')]():'','disposition':_0x58e35a['disposition'],'messages':_(_0x58e35a['Messages'])[_0x374e('0x87')]({'secret':![]})[_0x374e('0x3f')](function(_0x4e0d8f){return{'date':moment(_0x4e0d8f[_0x374e('0x7d')])[_0x374e('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')[_0x374e('0x9f')](),'sender':_0x4e0d8f[_0x374e('0xdb')]===_0x374e('0xe4')?_0x4e0d8f[_0x374e('0x76')]?_0x4e0d8f[_0x374e('0x76')]['fullname']:_0x374e('0xe5'):_0x4e0d8f[_0x374e('0x6a')]['firstName']+(_0x4e0d8f['Contact'][_0x374e('0xd9')]?'\x20'+_0x4e0d8f[_0x374e('0x6a')][_0x374e('0xd9')]:''),'body':_0x4e0d8f[_0x374e('0xbd')],'direction':_0x4e0d8f[_0x374e('0xdb')]===_0x374e('0xe4')?'A':'C','secret':_0x4e0d8f[_0x374e('0xdc')],'read':_0x4e0d8f[_0x374e('0x82')]};})[_0x374e('0x6d')]()};return ejs['renderFile'](path[_0x374e('0xd1')](config[_0x374e('0xd2')],_0x374e('0xd3'),'views','downloadInteraction.ejs'),{'interaction':_0x3740e4})[_0x374e('0x2c')](function(_0x127e49){var _0x5cdc78=path['join'](_0x325f1a,_0x374e('0xe6')+_0x58e35a['id']+'-'+_0x12a4f4+_0x374e('0xe7'));var _0x246218={'path':_0x5cdc78,'channel':_0x374e('0xe1'),'interactionId':_0x58e35a['id']};return pdf[_0x374e('0xe8')](_0x127e49,_0x246218);})[_0x374e('0x2c')](function(){return new BPromise(function(_0x224316,_0xf30876){zipdir(_0x325f1a,{'saveTo':_0x1aa5fd},function(_0xffe5dd,_0x3eb45c){if(_0xffe5dd)return _0xf30876(_0xffe5dd);return _0x224316(_0x3eb45c);});})[_0x374e('0x2c')](function(){return new BPromise(function(_0xff5207,_0x21c95b){rimraf(_0x325f1a,function(_0x3265e7){if(_0x3265e7)_0x21c95b(_0x3265e7);return _0xff5207();});});})['then'](function(){return _0x465317[_0x374e('0xcf')](_0x1aa5fd,_0x10153e,function(_0x1a752f){if(_0x1a752f){console[_0x374e('0xe9')](_0x374e('0xea'),_0x1a752f);}else{fs[_0x374e('0xeb')](_0x1aa5fd);}});});});}else{return _0x465317[_0x374e('0x1f')](0xc8);}})[_0x374e('0x36')](handleError(_0x465317,null));}; \ No newline at end of file +var _0x4899=['t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','i.SmsAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','rows','params','fields','includeAll','options','update','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','color','smsInteractionTags:save','removeTags','download','unix','join','files','tmp','server','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','createdAt','direction','Account','Owner','get','mkdirSync','Sms','N.A.','closedAt','Messages','System','out','secret','renderFile','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','offset','undefined','limit','count','set','apply','reject','destroy','then','sendStatus','error','stack','name','send','Users','map','TagIds','Tags','forEach','push','catch','answered','closed','UserId','waiting','talking','total','index','SmsInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','start','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x4899,0x142));var _0x9489=function(_0x28ee5a,_0x87b6b4){_0x28ee5a=_0x28ee5a-0x0;var _0x5c3062=_0x4899[_0x28ee5a];return _0x5c3062;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9489('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9489('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9489('0x2'));var Mustache=require(_0x9489('0x3'));var util=require(_0x9489('0x4'));var path=require(_0x9489('0x5'));var sox=require(_0x9489('0x6'));var csv=require('to-csv');var ejs=require(_0x9489('0x7'));var fs=require('fs');var fs_extra=require(_0x9489('0x8'));var _=require(_0x9489('0x9'));var squel=require(_0x9489('0xa'));var crypto=require(_0x9489('0xb'));var jsforce=require(_0x9489('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9489('0xd'));var Papa=require(_0x9489('0xe'));var Redis=require(_0x9489('0xf'));var authService=require(_0x9489('0x10'));var qs=require(_0x9489('0x11'));var as=require(_0x9489('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x9489('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x9489('0x14'));var config=require(_0x9489('0x15'));var licenseUtil=require(_0x9489('0x16'));var db=require(_0x9489('0x17'))['db'];config[_0x9489('0x18')]=_[_0x9489('0x19')](config[_0x9489('0x18')],{'host':_0x9489('0x1a'),'port':0x18eb});var socket=require(_0x9489('0x1b'))(new Redis(config[_0x9489('0x18')]));require(_0x9489('0x1c'))[_0x9489('0x1d')](socket);function respondWithStatusCode(_0xd0e477,_0x264632){_0x264632=_0x264632||0xcc;return function(_0x2c88be){if(_0x2c88be){return _0xd0e477['sendStatus'](_0x264632);}return _0xd0e477[_0x9489('0x1e')](_0x264632)[_0x9489('0x1f')]();};}function respondWithResult(_0x4bb3e9,_0x9f0a34){_0x9f0a34=_0x9f0a34||0xc8;return function(_0xa2632f){if(_0xa2632f){return _0x4bb3e9[_0x9489('0x1e')](_0x9f0a34)['json'](_0xa2632f);}};}function respondWithFilteredResult(_0x2f11c4,_0xef4bf8){return function(_0x1b70f9){if(_0x1b70f9){var _0x1eb693=typeof _0xef4bf8[_0x9489('0x20')]===_0x9489('0x21')&&typeof _0xef4bf8[_0x9489('0x22')]===_0x9489('0x21');var _0x3e6164=_0x1b70f9['count'];var _0x2df7f9=_0x1eb693?0x0:_0xef4bf8[_0x9489('0x20')];var _0x4644a8=_0x1eb693?_0x1b70f9[_0x9489('0x23')]:_0xef4bf8[_0x9489('0x20')]+_0xef4bf8['limit'];var _0xf2b847;if(_0x4644a8>=_0x3e6164){_0x4644a8=_0x3e6164;_0xf2b847=0xc8;}else{_0xf2b847=0xce;}_0x2f11c4['status'](_0xf2b847);return _0x2f11c4[_0x9489('0x24')]('Content-Range',_0x2df7f9+'-'+_0x4644a8+'/'+_0x3e6164)['json'](_0x1b70f9);}return null;};}function patchUpdates(_0x3b5118){return function(_0x147fec){try{jsonpatch[_0x9489('0x25')](_0x147fec,_0x3b5118,!![]);}catch(_0x14c3ae){return BPromise[_0x9489('0x26')](_0x14c3ae);}return _0x147fec['save']();};}function saveUpdates(_0x400fb4,_0x57542c){return function(_0x26b732){if(_0x26b732){return _0x26b732['update'](_0x400fb4)['then'](function(_0x1ac1fb){return _0x1ac1fb;});}return null;};}function removeEntity(_0x1ac5f8,_0x50908c){return function(_0x28237e){if(_0x28237e){return _0x28237e[_0x9489('0x27')]()[_0x9489('0x28')](function(){_0x1ac5f8[_0x9489('0x1e')](0xcc)[_0x9489('0x1f')]();});}};}function handleEntityNotFound(_0x30303b,_0x31c846){return function(_0x3b1bda){if(!_0x3b1bda){_0x30303b[_0x9489('0x29')](0x194);}return _0x3b1bda;};}function handleError(_0x28c7f0,_0x191dee){_0x191dee=_0x191dee||0x1f4;return function(_0x1ecf15){logger[_0x9489('0x2a')](_0x1ecf15[_0x9489('0x2b')]);if(_0x1ecf15[_0x9489('0x2c')]){delete _0x1ecf15[_0x9489('0x2c')];}_0x28c7f0['status'](_0x191dee)[_0x9489('0x2d')](_0x1ecf15);};}function getInteractionUsers(_0x4239e0,_0x5c10ea){return new BPromise(function(_0x4b0d0c,_0x3db299){try{if(_0x5c10ea[_0x4239e0['id']]){_0x4239e0[_0x9489('0x2e')]=_[_0x9489('0x2f')](_0x5c10ea[_0x4239e0['id']],function(_0x226eb5){return{'id':_0x226eb5['id'],'fullname':_0x226eb5['fullname']};});}}catch(_0x1fe645){_0x3db299(_0x1fe645);}_0x4b0d0c(_0x4239e0);});}function getInteractionTags(_0x31aa73,_0x611c1c){return new BPromise(function(_0x5544dc,_0x3619f7){try{if(_0x31aa73[_0x9489('0x30')]){_0x31aa73[_0x9489('0x31')]=[];_0x31aa73[_0x9489('0x30')]['split'](',')[_0x9489('0x32')](function(_0x25ccf7){_0x31aa73[_0x9489('0x31')][_0x9489('0x33')](_0x611c1c[_0x25ccf7]);});}delete _0x31aa73[_0x9489('0x30')];}catch(_0x5cec37){_0x3619f7(_0x5cec37);}_0x5544dc(_0x31aa73);});}function updateSmsInteraction(_0xdf1a4a,_0x1c582f,_0x3ed10c){return new BPromise(function(_0x44a2ec,_0x5f6e3c){return getInteractionUsers(_0xdf1a4a,_0x3ed10c)[_0x9489('0x28')](function(_0x49f1e3){return getInteractionTags(_0x49f1e3,_0x1c582f);})[_0x9489('0x28')](function(_0x5973ea){return getStateInteraction(_0x5973ea);})[_0x9489('0x28')](function(_0x57fd20){_0x44a2ec(_0x57fd20);})[_0x9489('0x34')](function(_0x351e9a){_0x5f6e3c(_0x351e9a);});});}function getStateInteraction(_0x3f344c){return new BPromise(function(_0x4299fb){_0x3f344c['waiting']=0x0;_0x3f344c['talking']=0x0;_0x3f344c[_0x9489('0x35')]=0x0;_0x3f344c['unmanaged']=0x0;_0x3f344c['total']=0x0;if(!_0x3f344c[_0x9489('0x36')]&&!_0x3f344c[_0x9489('0x37')]){_0x3f344c[_0x9489('0x38')]+=0x1;}if(!_0x3f344c[_0x9489('0x36')]&&_0x3f344c[_0x9489('0x37')]){_0x3f344c['talking']+=0x1;if(_0x3f344c[_0x9489('0x38')]){_0x3f344c[_0x9489('0x38')]-=0x1;}}if(_0x3f344c[_0x9489('0x36')]&&_0x3f344c['UserId']){_0x3f344c[_0x9489('0x35')]+=0x1;if(_0x3f344c[_0x9489('0x39')]){_0x3f344c['talking']-=0x1;}}if(_0x3f344c[_0x9489('0x36')]&&!_0x3f344c[_0x9489('0x37')]){_0x3f344c['unmanaged']+=0x1;if(_0x3f344c[_0x9489('0x38')]){_0x3f344c[_0x9489('0x38')]-=0x1;}}_0x3f344c[_0x9489('0x3a')]+=0x1;_0x4299fb(_0x3f344c);});}exports[_0x9489('0x3b')]=function(_0xb1070,_0x1ae580){var _0x5b778c={},_0x46d3ba={},_0x42daa1={'count':0x0,'rows':[]};var _0x12b2a3=_[_0x9489('0x2f')](db[_0x9489('0x3c')][_0x9489('0x3d')],function(_0x535aaf){return{'name':_0x535aaf[_0x9489('0x3e')],'type':_0x535aaf[_0x9489('0x3f')][_0x9489('0x40')]};});_0x46d3ba[_0x9489('0x41')]=_[_0x9489('0x2f')](_0x12b2a3,_0x9489('0x2c'));_0x46d3ba['query']=_[_0x9489('0x42')](_0xb1070[_0x9489('0x43')]);_0x46d3ba[_0x9489('0x44')]=_[_0x9489('0x45')](_0x46d3ba['model'],_0x46d3ba[_0x9489('0x43')]);_0x5b778c['attributes']=_[_0x9489('0x45')](_0x46d3ba[_0x9489('0x41')],qs['fields'](_0xb1070[_0x9489('0x43')]['fields']));_0x5b778c['attributes']=_0x5b778c[_0x9489('0x46')][_0x9489('0x47')]?_0x5b778c[_0x9489('0x46')]:_0x46d3ba[_0x9489('0x41')];if(!_0xb1070['query'][_0x9489('0x48')]('nolimit')){_0x5b778c[_0x9489('0x22')]=qs[_0x9489('0x22')](_0xb1070[_0x9489('0x43')]['limit']);_0x5b778c[_0x9489('0x20')]=qs[_0x9489('0x20')](_0xb1070[_0x9489('0x43')][_0x9489('0x20')]);}_0x5b778c[_0x9489('0x49')]=qs[_0x9489('0x4a')](_0xb1070[_0x9489('0x43')][_0x9489('0x4a')]);_0x5b778c[_0x9489('0x4b')]=qs[_0x9489('0x44')](_[_0x9489('0x4c')](_0xb1070['query'],_0x46d3ba[_0x9489('0x44')]),_0x12b2a3);var _0x1637c4=[];var _0x46f588=squel[_0x9489('0x4d')]()['field']('id')[_0x9489('0x4e')](_0x9489('0x2c'))[_0x9489('0x4e')]('color')[_0x9489('0x4f')](_0x9489('0x50'));var _0x3c5c01=squel[_0x9489('0x4d')]()[_0x9489('0x4e')](_0x9489('0x51'))[_0x9489('0x4e')](_0x9489('0x52'))[_0x9489('0x4e')](_0x9489('0x53'))['from'](_0x9489('0x54'),'ui')[_0x9489('0x55')](_0x9489('0x56'),'u',_0x9489('0x57'));var _0x228f95=squel[_0x9489('0x4d')]()[_0x9489('0x4f')](_0x9489('0x58'),'i')['left_join'](_0x9489('0x59'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9489('0x55')](_0x9489('0x56'),'o',_0x9489('0x5a'))[_0x9489('0x55')](_0x9489('0x5b'),'a',_0x9489('0x5c'))[_0x9489('0x55')](_0x9489('0x5d'),'me',_0x9489('0x5e'))[_0x9489('0x55')](_0x9489('0x5f'),'it',_0x9489('0x60'))[_0x9489('0x55')](_0x9489('0x50'),'t',_0x9489('0x61'));var _0x3edb04=squel[_0x9489('0x62')]();var _0xdc25fd=[];var _0x2096e2=squel[_0x9489('0x62')]();var _0x34270b;if(_0xb1070[_0x9489('0x43')][_0x9489('0x63')]){_0x34270b=as[_0x9489('0x64')](_0xb1070['query'][_0x9489('0x63')]);var _0x72227f=_0x34270b[_0x9489('0x65')];for(var _0x36b4f1=0x0;_0x36b4f1<_0x34270b['conditions'][_0x9489('0x47')];_0x36b4f1++){var _0x259fd4=_0x34270b['conditions'][_0x36b4f1];var _0x584814='i';var _0x2b3923=_[_0x9489('0x66')](_0x12b2a3,['name',_0x259fd4[_0x9489('0x4e')]]);if(!_0x2b3923){switch(_0x259fd4[_0x9489('0x4e')]){case _0x9489('0x67'):if(_0x259fd4['value']==0x1){_0x228f95[_0x9489('0x68')]('`'+_0x259fd4[_0x9489('0x4e')]+'`\x20=\x200');}else{_0x228f95[_0x9489('0x68')]('`'+_0x259fd4[_0x9489('0x4e')]+_0x9489('0x69'));}break;case _0x9489('0x6a'):if(_0x259fd4[_0x9489('0x6b')]===_0x9489('0x6c')){if(_0x259fd4[_0x9489('0x6d')][_0x9489('0x6e')]('\x20')['length']>0x1){_0x3edb04[_0x72227f](_0x9489('0x6f'),qs[_0x9489('0x70')](_0x259fd4[_0x9489('0x6d')]),null);}else{var _0x18cd08='%'+_0x259fd4[_0x9489('0x6d')]+'%';_0x3edb04[_0x72227f](_0x9489('0x71'),_0x18cd08,_0x18cd08,_0x18cd08);}}else{_0x2b3923=_[_0x9489('0x66')](_0x12b2a3,[_0x9489('0x2c'),_0x9489('0x72')]);_0x259fd4['field']='ContactId';_0x3007d7=as['buildExpression'](_0x584814,_0x2b3923[_0x9489('0x3f')],_0x259fd4);_0x3edb04[_0x72227f](_0x3007d7[_0x9489('0x73')],_0x3007d7[_0x9489('0x6d')]['start'],_0x3007d7[_0x9489('0x6d')][_0x9489('0x1f')]);}break;case _0x9489('0x74'):var _0x14d40f=_0x259fd4['value']['split'](',')['map'](function(_0x182832){return Number(_0x182832);});_0x14d40f[_0x9489('0x32')](function(_0x576283){_0x2096e2['or'](_0x9489('0x75'),'%,'+_0x576283+',%');});_0xdc25fd=_[_0x9489('0x76')](_0xdc25fd,_0x14d40f);break;case _0x9489('0x77'):if(_0x259fd4[_0x9489('0x6b')]==='$substring'){_0x3edb04[_0x72227f](_0x9489('0x78'),'%'+_0x259fd4['value']+'%',null);}else{_0x2b3923=_['find'](_0x12b2a3,['name','UserId']);_0x259fd4[_0x9489('0x4e')]=_0x9489('0x37');_0x3007d7=as[_0x9489('0x79')](_0x584814,_0x2b3923[_0x9489('0x3f')],_0x259fd4);_0x3edb04[_0x72227f](_0x3007d7[_0x9489('0x73')],_0x3007d7[_0x9489('0x6d')][_0x9489('0x7a')],_0x3007d7['value']['end']);}break;case _0x9489('0x7b'):_0x3007d7=as[_0x9489('0x79')]('me',null,_0x259fd4);_0x3edb04[_0x72227f](_0x3007d7['text'],_0x3007d7[_0x9489('0x6d')][_0x9489('0x7a')],_0x3007d7['value']['end']);break;}}else{var _0x3007d7=as[_0x9489('0x79')](_0x584814,_0x2b3923['type'],_0x259fd4);_0x3edb04[_0x72227f](_0x3007d7[_0x9489('0x73')],_0x3007d7[_0x9489('0x6d')][_0x9489('0x7a')],_0x3007d7[_0x9489('0x6d')]['end']);}}}else{var _0x5b8917=_(_0xb1070[_0x9489('0x43')])[_0x9489('0x42')]()[_0x9489('0x2f')](function(_0xef10be){return _[_0x9489('0x7c')](_0x12b2a3,[_0x9489('0x2c'),_0xef10be])?_0xef10be:undefined;})[_0x9489('0x7d')]()[_0x9489('0x6d')]();if(!_[_0x9489('0x7e')](_0x5b8917)){_0x5b8917['forEach'](function(_0x4f7b72){if(_0x4f7b72===_0x9489('0x7f')){_0x228f95['where'](_0x9489('0x80'),[][_0x9489('0x81')](_0xb1070[_0x9489('0x43')][_0x4f7b72]));}else if(_0x4f7b72==='createdAt'){var _0x5e0126=JSON['parse'](_0xb1070['query'][_0x4f7b72])[_0x9489('0x82')];var _0x3ac836=JSON[_0x9489('0x83')](_0xb1070[_0x9489('0x43')][_0x4f7b72])[_0x9489('0x84')];_0x228f95[_0x9489('0x4b')](_0x9489('0x85'),_0x5e0126,_0x3ac836);}else{if(_0xb1070['query'][_0x4f7b72]===_0x9489('0x86')){_0x228f95[_0x9489('0x4b')]('i.'+_0x4f7b72+_0x9489('0x87'));}else{_0x228f95['where']('i.'+_0x4f7b72+_0x9489('0x88'),_0xb1070[_0x9489('0x43')][_0x4f7b72]);}}});}if(_0xb1070[_0x9489('0x43')][_0x9489('0x89')]){if(_0xb1070[_0x9489('0x43')]['read']==0x1){_0x228f95['having'](_0x9489('0x8a'));}else{_0x228f95['having'](_0x9489('0x8b'));}}if(_0xb1070[_0x9489('0x43')][_0x9489('0x8c')]){_0xdc25fd=_['isArray'](_0xb1070[_0x9489('0x43')][_0x9489('0x8c')])?_0xb1070[_0x9489('0x43')][_0x9489('0x8c')]:new Array(_0xb1070['query'][_0x9489('0x8c')]);_0xdc25fd[_0x9489('0x32')](function(_0x39f175){_0x2096e2['or'](_0x9489('0x75'),'%,'+_0x39f175+',%');});}if(_0xb1070['query'][_0x9489('0x8d')]){var _0x1e9daf=_0xb1070[_0x9489('0x43')][_0x9489('0x8d')]['replace']('\x5c','\x5c\x5c')[_0x9489('0x8e')](/'/g,'\x27\x27');if(qs[_0x9489('0x8f')](_0x1e9daf)){_0x3edb04['or'](_0x9489('0x90'),_0x1e9daf+'%')['or'](_0x9489('0x91'),_0x1e9daf+'%');}else{_0x3edb04['or'](_0x9489('0x92'),qs[_0x9489('0x70')](_0x1e9daf))['or'](_0x9489('0x93'),_0x1e9daf+'%');}}}_0x228f95[_0x9489('0x4b')](_0x3edb04);_0x228f95[_0x9489('0x94')](_0x9489('0x95'));var _0x4f9e19={'type':db[_0x9489('0x96')]['QueryTypes'][_0x9489('0x97')],'raw':!![]};var _0x4e62f4=_0x228f95[_0x9489('0x98')]();_0x4e62f4[_0x9489('0x4e')]('i.id');_0x4e62f4[_0x9489('0x4e')](_0x9489('0x99'),_0x9489('0x67'));if(_0x5b778c[_0x9489('0x49')]){_0x5b778c[_0x9489('0x49')]['forEach'](function(_0x187b98){var _0x3bb622=_0x187b98[0x0]===_0x9489('0x9a')?_0x187b98[0x0]:'i.'+_0x187b98[0x0];_0x228f95['order'](_0x3bb622,_0x187b98[0x1]===_0x9489('0x9b')?![]:!![]);});}if(!_[_0x9489('0x7e')](_0xdc25fd)){_0x228f95[_0x9489('0x68')](_0x2096e2);_0x4e62f4['where'](_0x9489('0x9c'),_0xdc25fd);}BPromise[_0x9489('0x9d')]()[_0x9489('0x28')](function(){if(!_0x34270b){if(_0xb1070[_0x9489('0x43')][_0x9489('0x7f')])return;_0x4e62f4[_0x9489('0x4b')](_0x9489('0x9e'));_0x228f95[_0x9489('0x4b')](_0x9489('0x9e'));return;}if(_0xb1070[_0x9489('0x9f')][_0x9489('0xa0')]!=='agent')return;return _0xb1070[_0x9489('0x9f')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x9489('0x28')](function(_0x5ba737){if(_['isEmpty'](_0x5ba737)){_0x4e62f4[_0x9489('0x4b')](_0x9489('0xa1'));_0x228f95[_0x9489('0x4b')](_0x9489('0xa1'));}else{_0x4e62f4[_0x9489('0x4b')](_0x9489('0x80'),_[_0x9489('0x2f')](_0x5ba737,'id'));_0x228f95[_0x9489('0x4b')](_0x9489('0x80'),_[_0x9489('0x2f')](_0x5ba737,'id'));}});})[_0x9489('0x28')](function(){if(_0xb1070['user'][_0x9489('0xa0')]===_0x9489('0xa2')&&!_0x34270b&&!_0xb1070[_0x9489('0x43')]['SmsAccountId'])return[];return db[_0x9489('0xa3')][_0x9489('0x43')](_0x4e62f4[_0x9489('0xa4')](),_0x4f9e19);})[_0x9489('0x28')](function(_0x37f751){_0x42daa1[_0x9489('0x23')]=_0x37f751[_0x9489('0x47')];if(_0x42daa1['count']===0x0)return[];return db[_0x9489('0xa3')][_0x9489('0x43')](_0x46f588['toString'](),_0x4f9e19)[_0x9489('0x28')](function(_0x2c2a00){_0x1637c4=_[_0x9489('0xa5')](_0x2c2a00,'id');_0x4f9e19=_[_0x9489('0xa6')](_0x4f9e19,{'model':db[_0x9489('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xb1070[_0x9489('0x43')]['fields']){_0x5b778c[_0x9489('0x46')][_0x9489('0x32')](function(_0x38104a){_0x228f95['field']('i.'+_0x38104a);});}else{_0x228f95[_0x9489('0x4e')](_0x9489('0x99'),_0x9489('0x67'));_0x228f95['field']('a.key','Account.key');_0x228f95[_0x9489('0x4e')](_0x9489('0xa7'),_0x9489('0xa8'));_0x228f95[_0x9489('0x4e')]('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',_0x9489('0x9a'));_0x228f95['field'](_0x9489('0xa9'));_0x228f95[_0x9489('0x4e')](_0x9489('0xaa'),_0x9489('0xab'));_0x228f95[_0x9489('0x4e')](_0x9489('0xac'),'Contact.lastName');_0x228f95['field']('c.email',_0x9489('0xad'));_0x228f95[_0x9489('0x4e')](_0x9489('0xae'),_0x9489('0xaf'));_0x228f95[_0x9489('0x4e')](_0x9489('0xb0'),_0x9489('0xb1'));_0x228f95[_0x9489('0x4e')](_0x9489('0xb2'),_0x9489('0xb3'));_0x228f95[_0x9489('0x4e')](_0x9489('0xb4'),'Owner.fullname');_0x228f95['field'](_0x9489('0xb5'),'Owner.internal');_0x228f95[_0x9489('0x4e')](_0x9489('0xb6'),_0x9489('0x30'));}if(_0x5b778c[_0x9489('0x22')])_0x228f95[_0x9489('0x22')](_0x5b778c[_0x9489('0x22')]);if(_0x5b778c[_0x9489('0x20')])_0x228f95[_0x9489('0x20')](_0x5b778c[_0x9489('0x20')]);return db['sequelize'][_0x9489('0x43')](_0x228f95['toString'](),_0x4f9e19);})[_0x9489('0x28')](function(_0x5c4c2a){if(_0x5c4c2a[_0x9489('0x47')]>0x0)_0x3c5c01[_0x9489('0x4b')]('ui.SmsInteractionId\x20IN\x20?',_[_0x9489('0x2f')](_0x5c4c2a,'id'));return db[_0x9489('0xa3')][_0x9489('0x43')](_0x3c5c01[_0x9489('0xa4')](),_0x4f9e19)[_0x9489('0x28')](function(_0x520613){var _0x272e31=_[_0x9489('0xb7')](_0x520613,_0x9489('0xb8'));var _0x522dd2=[];_0x5c4c2a['forEach'](function(_0x3d39b0){_0x522dd2[_0x9489('0x33')](updateSmsInteraction(_0x3d39b0,_0x1637c4,_0x272e31));});return BPromise['all'](_0x522dd2);});});})[_0x9489('0x28')](function(_0x2c6b00){_0x42daa1[_0x9489('0xb9')]=_0x2c6b00;return _0x42daa1;})[_0x9489('0x28')](respondWithFilteredResult(_0x1ae580,_0x5b778c))[_0x9489('0x34')](handleError(_0x1ae580,null));};exports['show']=function(_0x50679e,_0x552de7){var _0x3b6982={'raw':![],'where':{'id':_0x50679e[_0x9489('0xba')]['id']}},_0x2ef6dd={};_0x2ef6dd[_0x9489('0x41')]=_[_0x9489('0x42')](db[_0x9489('0x3c')][_0x9489('0x3d')]);_0x2ef6dd[_0x9489('0x43')]=_[_0x9489('0x42')](_0x50679e[_0x9489('0x43')]);_0x2ef6dd[_0x9489('0x44')]=_['intersection'](_0x2ef6dd[_0x9489('0x41')],_0x2ef6dd['query']);_0x3b6982[_0x9489('0x46')]=_[_0x9489('0x45')](_0x2ef6dd[_0x9489('0x41')],qs[_0x9489('0xbb')](_0x50679e[_0x9489('0x43')][_0x9489('0xbb')]));_0x3b6982['attributes']=_0x3b6982[_0x9489('0x46')][_0x9489('0x47')]?_0x3b6982['attributes']:_0x2ef6dd['model'];if(_0x50679e[_0x9489('0x43')][_0x9489('0xbc')]){_0x3b6982['include']=[{'all':!![]}];}_0x3b6982=_['merge']({},_0x3b6982,_0x50679e[_0x9489('0xbd')]);return db[_0x9489('0x3c')][_0x9489('0x66')](_0x3b6982)[_0x9489('0x28')](handleEntityNotFound(_0x552de7,null))['then'](respondWithResult(_0x552de7,null))['catch'](handleError(_0x552de7,null));};exports['create']=function(_0x3f89d7,_0x3f271c){return db[_0x9489('0x3c')]['create'](_0x3f89d7[_0x9489('0x7b')],{})[_0x9489('0x28')](respondWithResult(_0x3f271c,0xc9))[_0x9489('0x34')](handleError(_0x3f271c,null));};exports[_0x9489('0xbe')]=function(_0x4c594c,_0x1b8cd1){if(_0x4c594c['body']['id']){delete _0x4c594c[_0x9489('0x7b')]['id'];}return db[_0x9489('0x3c')][_0x9489('0x66')]({'where':{'id':_0x4c594c['params']['id']}})[_0x9489('0x28')](handleEntityNotFound(_0x1b8cd1,null))['then'](saveUpdates(_0x4c594c[_0x9489('0x7b')],null))['then'](respondWithResult(_0x1b8cd1,null))[_0x9489('0x34')](handleError(_0x1b8cd1,null));};exports['destroy']=function(_0x52608f,_0x4c53b4){return db[_0x9489('0x3c')]['find']({'where':{'id':_0x52608f[_0x9489('0xba')]['id']}})['then'](handleEntityNotFound(_0x4c53b4,null))['then'](removeEntity(_0x4c53b4,null))['catch'](handleError(_0x4c53b4,null));};exports['describe']=function(_0x42cdd8,_0x5ad46c){return db[_0x9489('0x3c')][_0x9489('0xbf')]()[_0x9489('0x28')](respondWithResult(_0x5ad46c,null))[_0x9489('0x34')](handleError(_0x5ad46c,null));};exports[_0x9489('0xc0')]=function(_0x4d7ca4,_0x3b8542,_0x3a139c){return db[_0x9489('0xc1')][_0x9489('0x66')]({'where':{'id':_0x4d7ca4[_0x9489('0xba')]['id']}})[_0x9489('0x28')](handleEntityNotFound(_0x3b8542,null))[_0x9489('0x28')](function(_0x440489){if(_0x440489){return _0x440489['addMessage'](_0x4d7ca4[_0x9489('0x7b')]['ids'],_[_0x9489('0xc2')](_0x4d7ca4['body'],[_0x9489('0xc3'),'id'])||{});}})[_0x9489('0x28')](respondWithResult(_0x3b8542,null))[_0x9489('0x34')](handleError(_0x3b8542,null));};exports[_0x9489('0xc4')]=function(_0x41ab49,_0x5b97f3,_0x3a8e50){var _0x49fcda={'raw':![],'where':{}};var _0x543615={};var _0x345695={'count':0x0,'rows':[]};return db[_0x9489('0x3c')][_0x9489('0xc5')]({'where':{'id':_0x41ab49[_0x9489('0xba')]['id']}})[_0x9489('0x28')](handleEntityNotFound(_0x5b97f3,null))[_0x9489('0x28')](function(_0x1f0efb){if(_0x1f0efb){_0x543615[_0x9489('0x41')]=_[_0x9489('0x42')](db[_0x9489('0xc1')][_0x9489('0x3d')]);_0x543615['query']=_[_0x9489('0x42')](_0x41ab49[_0x9489('0x43')]);_0x543615['filters']=_['intersection'](_0x543615['model'],_0x543615[_0x9489('0x43')]);_0x49fcda[_0x9489('0x46')]=_[_0x9489('0x45')](_0x543615[_0x9489('0x41')],qs[_0x9489('0xbb')](_0x41ab49[_0x9489('0x43')][_0x9489('0xbb')]));_0x49fcda[_0x9489('0x46')]=_0x49fcda[_0x9489('0x46')][_0x9489('0x47')]?_0x49fcda[_0x9489('0x46')]:_0x543615['model'];if(!_0x41ab49[_0x9489('0x43')]['hasOwnProperty'](_0x9489('0xc6'))){_0x49fcda['limit']=qs['limit'](_0x41ab49[_0x9489('0x43')][_0x9489('0x22')]);_0x49fcda[_0x9489('0x20')]=qs[_0x9489('0x20')](_0x41ab49[_0x9489('0x43')][_0x9489('0x20')]);}_0x49fcda[_0x9489('0x49')]=qs['sort'](_0x41ab49[_0x9489('0x43')][_0x9489('0x4a')]);_0x49fcda['where']=qs['filters'](_[_0x9489('0x4c')](_0x41ab49[_0x9489('0x43')],_0x543615[_0x9489('0x44')]));_0x49fcda['where']['SmsInteractionId']=_0x1f0efb['id'];if(_0x41ab49[_0x9489('0x43')][_0x9489('0x8d')]){_0x49fcda[_0x9489('0x4b')]=_['merge'](_0x49fcda[_0x9489('0x4b')],{'$or':_[_0x9489('0x2f')](_0x49fcda['attributes'],function(_0x4e092d){var _0x1078aa={};_0x1078aa[_0x4e092d]={'$like':'%'+_0x41ab49['query']['filter']+'%'};return _0x1078aa;})});}if(_0x41ab49[_0x9489('0x43')]['$gte']){var _0x410b9b=_0x41ab49['query'][_0x9489('0x82')][_0x9489('0x6e')](',');var _0xf8adf3={};_0xf8adf3[_0x410b9b[0x0]]={'$gte':moment(_0x410b9b[0x1])[_0x9489('0xc7')](_0x9489('0xc8'))};_0x49fcda[_0x9489('0x4b')]=_[_0x9489('0xa6')](_0x49fcda[_0x9489('0x4b')],_0xf8adf3);}_0x49fcda=_[_0x9489('0xa6')]({},_0x49fcda,_0x41ab49[_0x9489('0xbd')]);return db[_0x9489('0xc1')]['count']({'where':_0x49fcda[_0x9489('0x4b')]})[_0x9489('0x28')](function(_0x138309){_0x345695['count']=_0x138309;if(_0x41ab49[_0x9489('0x43')][_0x9489('0xbc')]){_0x49fcda[_0x9489('0xc9')]=[{'all':!![]}];}return db[_0x9489('0xc1')][_0x9489('0xca')](_0x49fcda);})[_0x9489('0x28')](function(_0x25ba48){_0x345695[_0x9489('0xb9')]=_0x25ba48;return _0x345695;});}})['then'](respondWithFilteredResult(_0x5b97f3,_0x49fcda))[_0x9489('0x34')](handleError(_0x5b97f3,null));};exports[_0x9489('0xcb')]=function(_0x129d45,_0x41aa8c,_0x4b904a){return db[_0x9489('0x3c')]['find']({'where':{'id':_0x129d45[_0x9489('0xba')]['id']}})[_0x9489('0x28')](handleEntityNotFound(_0x41aa8c,null))['then'](function(_0x4e544e){if(_0x4e544e){return _0x4e544e[_0x9489('0xcc')](_0x129d45[_0x9489('0x7b')][_0x9489('0xc3')],_[_0x9489('0xc2')](_0x129d45[_0x9489('0x7b')],[_0x9489('0xc3'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x9489('0x2c'),_0x9489('0xcd')],'where':{'id':_0x129d45[_0x9489('0x7b')][_0x9489('0xc3')]}});})['then'](function(_0x23a91d){socket['emit'](_0x9489('0xce'),{'id':Number(_0x129d45[_0x9489('0xba')]['id']),'tags':_0x23a91d||[]});return{'id':Number(_0x129d45['params']['id']),'tags':_0x23a91d||[]};});}})[_0x9489('0x28')](respondWithResult(_0x41aa8c,null))[_0x9489('0x34')](handleError(_0x41aa8c,null));};exports[_0x9489('0xcf')]=function(_0x43e9c0,_0x30d3da,_0x27a7b3){return db[_0x9489('0x3c')][_0x9489('0x66')]({'where':{'id':_0x43e9c0['params']['id']}})['then'](handleEntityNotFound(_0x30d3da,null))[_0x9489('0x28')](function(_0x2c9b78){if(_0x2c9b78){return _0x2c9b78[_0x9489('0xcf')](_0x43e9c0[_0x9489('0x43')][_0x9489('0xc3')]);}})['then'](respondWithStatusCode(_0x30d3da,null))[_0x9489('0x34')](handleError(_0x30d3da,null));};exports[_0x9489('0xd0')]=function(_0x57aaf5,_0x258f6e){var _0x447b4c=moment()[_0x9489('0xd1')]()['toString']();var _0x55e476=path[_0x9489('0xd2')](config['root'],'server',_0x9489('0xd3'),_0x9489('0xd4'));var _0x4ae99e=path[_0x9489('0xd2')](config['root'],_0x9489('0xd5'),'files',_0x9489('0xd6'));var _0x26f5d9=path[_0x9489('0xd2')](_0x55e476,_0x447b4c);var _0x4d59a5=util['format'](_0x9489('0xd7'),_0x57aaf5['params']['id'],_0x447b4c);var _0x42b01e=path['join'](_0x55e476,_0x4d59a5);var _0x18cbef=[];_0x18cbef[_0x9489('0x33')]({'model':db['User'],'as':_0x9489('0x77'),'attributes':['id',_0x9489('0xd8')],'raw':!![]});_0x18cbef[_0x9489('0x33')]({'model':db[_0x9489('0xd9')],'as':'Contact','attributes':['id',_0x9489('0xda'),_0x9489('0xdb')],'raw':!![]});var _0x13045e=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id','body',_0x9489('0xdc'),_0x9489('0xdd'),'secret',_0x9489('0x89')],'include':_0x18cbef}];_0x13045e[_0x9489('0x33')]({'model':db['SmsAccount'],'as':_0x9489('0xde'),'attributes':['id','name']});_0x13045e[_0x9489('0x33')]({'model':db['User'],'as':_0x9489('0xdf'),'attributes':['id',_0x9489('0xd8')]});return db[_0x9489('0x3c')][_0x9489('0x66')]({'where':{'id':_0x57aaf5[_0x9489('0xba')]['id']},'include':_0x13045e})[_0x9489('0x28')](handleEntityNotFound(_0x258f6e,null))[_0x9489('0x28')](function(_0x504c8f){if(_0x504c8f){var _0x39a400=_0x504c8f[_0x9489('0xe0')]({'plain':!![]});fs[_0x9489('0xe1')](_0x26f5d9);var _0x49a6ed={'channel':_0x9489('0xe2'),'account':_0x39a400[_0x9489('0xde')]['name'],'agent':_0x39a400[_0x9489('0xdf')]?_0x39a400[_0x9489('0xdf')][_0x9489('0xd8')]:_0x9489('0xe3'),'createdAt':moment(_0x39a400[_0x9489('0xdc')])[_0x9489('0xc7')](_0x9489('0xc8'))[_0x9489('0xa4')](),'closedAt':_0x39a400['closed']?moment(_0x39a400[_0x9489('0xe4')])[_0x9489('0xc7')](_0x9489('0xc8'))['toString']():'','disposition':_0x39a400['disposition'],'messages':_(_0x39a400[_0x9489('0xe5')])[_0x9489('0x8d')]({'secret':![]})[_0x9489('0x2f')](function(_0x283a39){return{'date':moment(_0x283a39['createdAt'])[_0x9489('0xc7')](_0x9489('0xc8'))[_0x9489('0xa4')](),'sender':_0x283a39[_0x9489('0xdd')]==='out'?_0x283a39['User']?_0x283a39[_0x9489('0x77')][_0x9489('0xd8')]:_0x9489('0xe6'):_0x283a39[_0x9489('0x6a')][_0x9489('0xda')]+(_0x283a39[_0x9489('0x6a')][_0x9489('0xdb')]?'\x20'+_0x283a39[_0x9489('0x6a')][_0x9489('0xdb')]:''),'body':_0x283a39[_0x9489('0x7b')],'direction':_0x283a39[_0x9489('0xdd')]===_0x9489('0xe7')?'A':'C','secret':_0x283a39[_0x9489('0xe8')],'read':_0x283a39[_0x9489('0x89')]};})[_0x9489('0x6d')]()};return ejs[_0x9489('0xe9')](path[_0x9489('0xd2')](config['root'],'server','views',_0x9489('0xea')),{'interaction':_0x49a6ed})['then'](function(_0x3352d0){var _0x1830d7=path[_0x9489('0xd2')](_0x26f5d9,'transcript-'+_0x39a400['id']+'-'+_0x447b4c+'.pdf');var _0x576193={'path':_0x1830d7,'channel':_0x9489('0xe2'),'interactionId':_0x39a400['id']};return pdf[_0x9489('0xeb')](_0x3352d0,_0x576193);})[_0x9489('0x28')](function(){return new BPromise(function(_0x33b4d7,_0x347e91){zipdir(_0x26f5d9,{'saveTo':_0x42b01e},function(_0x38ea6b,_0x8d6c39){if(_0x38ea6b)return _0x347e91(_0x38ea6b);return _0x33b4d7(_0x8d6c39);});})['then'](function(){return new BPromise(function(_0x370865,_0xf8940c){rimraf(_0x26f5d9,function(_0x59d53e){if(_0x59d53e)_0xf8940c(_0x59d53e);return _0x370865();});});})[_0x9489('0x28')](function(){return _0x258f6e[_0x9489('0xd0')](_0x42b01e,_0x4d59a5,function(_0x99f5d9){if(_0x99f5d9){console[_0x9489('0xec')](_0x9489('0xed'),_0x99f5d9);}else{fs[_0x9489('0xee')](_0x42b01e);}});});});}else{return _0x258f6e[_0x9489('0x29')](0xc8);}})[_0x9489('0x34')](handleError(_0x258f6e,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 6e74f9b..703eab2 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 _0xe511=['Users','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','getUsers','then'];(function(_0x13b916,_0x57f67c){var _0x572395=function(_0x48b2a2){while(--_0x48b2a2){_0x13b916['push'](_0x13b916['shift']());}};_0x572395(++_0x57f67c);}(_0xe511,0x16f));var _0x1e51=function(_0x27a3be,_0x5dea43){_0x27a3be=_0x27a3be-0x0;var _0x16d496=_0xe511[_0x27a3be];return _0x16d496;};'use strict';var EventEmitter=require(_0x1e51('0x0'));var SmsInteraction=require(_0x1e51('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x1e51('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1e51('0x2')](0x0);var events={'afterCreate':_0x1e51('0x3'),'afterUpdate':'update','afterDestroy':_0x1e51('0x4')};function emitEvent(_0x2be2b7){return function(_0x204da7,_0x16ec99,_0x480cca){_0x204da7[_0x1e51('0x5')]({'attributes':['id'],'raw':!![]})[_0x1e51('0x6')](function(_0x5c4590){_0x204da7['setDataValue'](_0x1e51('0x7'),_0x5c4590[_0x1e51('0x8')](function(_0x4fa8a9){return{'id':_0x4fa8a9['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x204da7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1e51('0x6')](function(_0x2712e0){_0x204da7[_0x1e51('0x9')](_0x1e51('0xa'),_0x2712e0[_0x1e51('0xb')]);SmsInteractionEvents[_0x1e51('0xc')](_0x2be2b7+':'+_0x204da7['id'],_0x204da7);SmsInteractionEvents['emit'](_0x2be2b7,_0x204da7);_0x480cca(null);})[_0x1e51('0xd')](_0x480cca(null));};}for(var e in events){if(events[_0x1e51('0xe')](e)){var event=events[e];SmsInteraction[_0x1e51('0xf')](e,emitEvent(event));}}module[_0x1e51('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x36ee=['getUsers','then','Users','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x478de7,_0x319ab7){var _0x10fb93=function(_0x2ab5c1){while(--_0x2ab5c1){_0x478de7['push'](_0x478de7['shift']());}};_0x10fb93(++_0x319ab7);}(_0x36ee,0xe8));var _0xe36e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x36ee[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0xe36e('0x0')];var SmsMessage=require('../../mysqldb')['db'][_0xe36e('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xe36e('0x2')](0x0);var events={'afterCreate':_0xe36e('0x3'),'afterUpdate':_0xe36e('0x4'),'afterDestroy':_0xe36e('0x5')};function emitEvent(_0x1118af){return function(_0x29e692,_0x3f29e1,_0x25a07d){_0x29e692[_0xe36e('0x6')]({'attributes':['id'],'raw':!![]})[_0xe36e('0x7')](function(_0x1aa596){_0x29e692['setDataValue'](_0xe36e('0x8'),_0x1aa596['map'](function(_0x2236e9){return{'id':_0x2236e9['id']};}));return SmsMessage[_0xe36e('0x9')]({'where':{'SmsInteractionId':_0x29e692['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe36e('0x7')](function(_0x47ce3a){_0x29e692[_0xe36e('0xa')]('unreadMessages',_0x47ce3a[_0xe36e('0xb')]);SmsInteractionEvents[_0xe36e('0xc')](_0x1118af+':'+_0x29e692['id'],_0x29e692);SmsInteractionEvents[_0xe36e('0xc')](_0x1118af,_0x29e692);_0x25a07d(null);})[_0xe36e('0xd')](_0x25a07d(null));};}for(var e in events){if(events[_0xe36e('0xe')](e)){var event=events[e];SmsInteraction[_0xe36e('0xf')](e,emitEvent(event));}}module[_0xe36e('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index fc9b321..dca6fd7 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 _0xc328=['sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','request-promise','path','rimraf'];(function(_0x37beb4,_0x4f207b){var _0x130c12=function(_0x1e8cf1){while(--_0x1e8cf1){_0x37beb4['push'](_0x37beb4['shift']());}};_0x130c12(++_0x4f207b);}(_0xc328,0xba));var _0x8c32=function(_0x34e05c,_0x17e777){_0x34e05c=_0x34e05c-0x0;var _0x2d7d57=_0xc328[_0x34e05c];return _0x2d7d57;};'use strict';var _=require('lodash');var util=require(_0x8c32('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8c32('0x1'));var fs=require('fs');var path=require(_0x8c32('0x2'));var rimraf=require(_0x8c32('0x3'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module['exports']=function(_0xb84166,_0x1d3fa3){return _0xb84166['define']('SmsInteraction',attributes,{'tableName':_0x8c32('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x80d6b5,_0x30129f,_0xae0ee0){if(_0x80d6b5[_0x8c32('0x5')](_0x8c32('0x6'))){_0x80d6b5[_0x8c32('0x7')]=moment()[_0x8c32('0x8')](_0x8c32('0x9'));}_0xae0ee0(null,_0x80d6b5);}}});}; \ No newline at end of file +var _0xfb10=['rimraf','../../config/environment','SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path'];(function(_0x1b4fe4,_0x544028){var _0x1275c3=function(_0x15bc8b){while(--_0x15bc8b){_0x1b4fe4['push'](_0x1b4fe4['shift']());}};_0x1275c3(++_0x544028);}(_0xfb10,0x120));var _0x0fb1=function(_0x50a016,_0x3b6d3c){_0x50a016=_0x50a016-0x0;var _0x5b51eb=_0xfb10[_0x50a016];return _0x5b51eb;};'use strict';var _=require('lodash');var util=require(_0x0fb1('0x0'));var logger=require(_0x0fb1('0x1'))(_0x0fb1('0x2'));var moment=require(_0x0fb1('0x3'));var BPromise=require('bluebird');var rp=require(_0x0fb1('0x4'));var fs=require('fs');var path=require(_0x0fb1('0x5'));var rimraf=require(_0x0fb1('0x6'));var config=require(_0x0fb1('0x7'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x2f816c,_0x23c3e5){return _0x2f816c['define'](_0x0fb1('0x8'),attributes,{'tableName':_0x0fb1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xa0ac5d,_0x4fa98a,_0xfb16f3){if(_0xa0ac5d[_0x0fb1('0xa')](_0x0fb1('0xb'))){_0xa0ac5d[_0x0fb1('0xc')]=moment()['format'](_0x0fb1('0xd'));}_0xfb16f3(null,_0xa0ac5d);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index f0a9997..4463bf8 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 _0xac70=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsInteraction','update','body','options','raw','where','attributes','then','UpdateSmsInteraction','debug','stringify','find','addTags','ids','omit','spread','AddTags','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xac70,0x15e));var _0x0ac7=function(_0x314b56,_0x292792){_0x314b56=_0x314b56-0x0;var _0x34e0d4=_0xac70[_0x314b56];return _0x34e0d4;};'use strict';var _=require(_0x0ac7('0x0'));var util=require('util');var moment=require(_0x0ac7('0x1'));var BPromise=require('bluebird');var rs=require(_0x0ac7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ac7('0x3'))['db'];var utils=require(_0x0ac7('0x4'));var logger=require(_0x0ac7('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0ac7('0x6')]({'port':0x232a});config[_0x0ac7('0x7')]=_['defaults'](config[_0x0ac7('0x7')],{'host':_0x0ac7('0x8'),'port':0x18eb});var socket=require(_0x0ac7('0x9'))(new Redis(config[_0x0ac7('0x7')]));require(_0x0ac7('0xa'))[_0x0ac7('0xb')](socket);function respondWithRpcPromise(_0x181eee,_0x3701e8,_0x194131){return new BPromise(function(_0x4693c7,_0x118bdf){return client[_0x0ac7('0xc')](_0x181eee,_0x194131)['then'](function(_0x4ff045){logger[_0x0ac7('0xd')](_0x0ac7('0xe'),_0x3701e8,_0x0ac7('0xf'));logger['debug'](_0x0ac7('0x10'),_0x3701e8,_0x0ac7('0xf'),JSON['stringify'](_0x4ff045));if(_0x4ff045[_0x0ac7('0x11')]){if(_0x4ff045[_0x0ac7('0x11')][_0x0ac7('0x12')]===0x1f4){logger[_0x0ac7('0x11')](_0x0ac7('0xe'),_0x3701e8,_0x4ff045[_0x0ac7('0x11')][_0x0ac7('0x13')]);return _0x118bdf(_0x4ff045['error'][_0x0ac7('0x13')]);}logger[_0x0ac7('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x3701e8,_0x4ff045[_0x0ac7('0x11')][_0x0ac7('0x13')]);return _0x4693c7(_0x4ff045['error'][_0x0ac7('0x13')]);}else{logger[_0x0ac7('0xd')](_0x0ac7('0xe'),_0x3701e8,_0x0ac7('0xf'));_0x4693c7(_0x4ff045[_0x0ac7('0x14')][_0x0ac7('0x13')]);}})[_0x0ac7('0x15')](function(_0x4c4abc){logger[_0x0ac7('0x11')](_0x0ac7('0xe'),_0x3701e8,_0x4c4abc);_0x118bdf(_0x4c4abc);});});}exports['UpdateSmsInteraction']=function(_0x2ccb89){var _0x31db0b=this;return new Promise(function(_0x4c8e73,_0x33b057){return db[_0x0ac7('0x16')][_0x0ac7('0x17')](_0x2ccb89[_0x0ac7('0x18')],{'raw':_0x2ccb89['options']?_0x2ccb89[_0x0ac7('0x19')][_0x0ac7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ccb89['options']?_0x2ccb89['options'][_0x0ac7('0x1b')]||null:null,'attributes':_0x2ccb89[_0x0ac7('0x19')]?_0x2ccb89[_0x0ac7('0x19')][_0x0ac7('0x1c')]||null:null,'limit':_0x2ccb89[_0x0ac7('0x19')]?_0x2ccb89[_0x0ac7('0x19')]['limit']||null:null})[_0x0ac7('0x1d')](function(_0x2da377){logger[_0x0ac7('0xd')](_0x0ac7('0x1e'),_0x2ccb89);logger[_0x0ac7('0x1f')](_0x0ac7('0x1e'),_0x2ccb89,JSON[_0x0ac7('0x20')](_0x2da377));_0x4c8e73(_0x2da377);})[_0x0ac7('0x15')](function(_0x2cd492){logger[_0x0ac7('0x11')](_0x0ac7('0x1e'),_0x2cd492[_0x0ac7('0x13')],_0x2ccb89);_0x33b057(_0x31db0b[_0x0ac7('0x11')](0x1f4,_0x2cd492[_0x0ac7('0x13')]));});});};exports['AddTagsToSmsInteraction']=function(_0x21f07e){return new Promise(function(_0x6edcc,_0x595fe4){return db['SmsInteraction'][_0x0ac7('0x21')]({'where':_0x21f07e['options']?_0x21f07e['options'][_0x0ac7('0x1b')]||null:null})[_0x0ac7('0x1d')](function(_0x343364){if(_0x343364){return _0x343364[_0x0ac7('0x22')](_0x21f07e[_0x0ac7('0x18')][_0x0ac7('0x23')],_[_0x0ac7('0x24')](_0x21f07e[_0x0ac7('0x18')],[_0x0ac7('0x23'),'id'])||{});}})[_0x0ac7('0x25')](function(_0x568f6b){logger[_0x0ac7('0xd')](_0x0ac7('0x26'),_0x21f07e);logger[_0x0ac7('0x1f')]('AddTags',_0x21f07e,JSON[_0x0ac7('0x20')](_0x568f6b));_0x6edcc(_0x568f6b);})[_0x0ac7('0x15')](function(_0x4b75bd){logger[_0x0ac7('0x11')]('AddTags',_0x4b75bd['message'],_0x21f07e);_0x595fe4(_this[_0x0ac7('0x11')](0x1f4,_0x4b75bd[_0x0ac7('0x13')]));});});}; \ No newline at end of file +var _0x6769=['body','ids','omit','spread','AddTags','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SmsInteraction','update','options','raw','where','attributes','limit','then','UpdateSmsInteraction','find','addTags'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6769,0x145));var _0x9676=function(_0x34dd74,_0x1bd3f1){_0x34dd74=_0x34dd74-0x0;var _0x53bec5=_0x6769[_0x34dd74];return _0x53bec5;};'use strict';var _=require('lodash');var util=require(_0x9676('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9676('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x9676('0x2'));var logger=require(_0x9676('0x3'))(_0x9676('0x4'));var config=require(_0x9676('0x5'));var jayson=require(_0x9676('0x6'));var client=jayson[_0x9676('0x7')][_0x9676('0x8')]({'port':0x232a});config[_0x9676('0x9')]=_[_0x9676('0xa')](config['redis'],{'host':_0x9676('0xb'),'port':0x18eb});var socket=require(_0x9676('0xc'))(new Redis(config[_0x9676('0x9')]));require(_0x9676('0xd'))['register'](socket);function respondWithRpcPromise(_0x466e52,_0xb52e63,_0x1cb44a){return new BPromise(function(_0x293fe0,_0x406c2f){return client[_0x9676('0xe')](_0x466e52,_0x1cb44a)['then'](function(_0x29d70a){logger[_0x9676('0xf')](_0x9676('0x10'),_0xb52e63,_0x9676('0x11'));logger[_0x9676('0x12')](_0x9676('0x13'),_0xb52e63,_0x9676('0x11'),JSON[_0x9676('0x14')](_0x29d70a));if(_0x29d70a['error']){if(_0x29d70a[_0x9676('0x15')]['code']===0x1f4){logger[_0x9676('0x15')](_0x9676('0x10'),_0xb52e63,_0x29d70a['error'][_0x9676('0x16')]);return _0x406c2f(_0x29d70a['error'][_0x9676('0x16')]);}logger[_0x9676('0x15')](_0x9676('0x10'),_0xb52e63,_0x29d70a[_0x9676('0x15')][_0x9676('0x16')]);return _0x293fe0(_0x29d70a['error'][_0x9676('0x16')]);}else{logger[_0x9676('0xf')](_0x9676('0x10'),_0xb52e63,_0x9676('0x11'));_0x293fe0(_0x29d70a['result'][_0x9676('0x16')]);}})[_0x9676('0x17')](function(_0x5be451){logger[_0x9676('0x15')](_0x9676('0x10'),_0xb52e63,_0x5be451);_0x406c2f(_0x5be451);});});}exports['UpdateSmsInteraction']=function(_0x5a6c72){var _0x75f983=this;return new Promise(function(_0x2b4c6a,_0x2abd61){return db[_0x9676('0x18')][_0x9676('0x19')](_0x5a6c72['body'],{'raw':_0x5a6c72[_0x9676('0x1a')]?_0x5a6c72[_0x9676('0x1a')][_0x9676('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a6c72[_0x9676('0x1a')]?_0x5a6c72[_0x9676('0x1a')][_0x9676('0x1c')]||null:null,'attributes':_0x5a6c72[_0x9676('0x1a')]?_0x5a6c72['options'][_0x9676('0x1d')]||null:null,'limit':_0x5a6c72[_0x9676('0x1a')]?_0x5a6c72[_0x9676('0x1a')][_0x9676('0x1e')]||null:null})[_0x9676('0x1f')](function(_0x11953a){logger[_0x9676('0xf')](_0x9676('0x20'),_0x5a6c72);logger[_0x9676('0x12')](_0x9676('0x20'),_0x5a6c72,JSON[_0x9676('0x14')](_0x11953a));_0x2b4c6a(_0x11953a);})[_0x9676('0x17')](function(_0x243121){logger['error'](_0x9676('0x20'),_0x243121[_0x9676('0x16')],_0x5a6c72);_0x2abd61(_0x75f983[_0x9676('0x15')](0x1f4,_0x243121[_0x9676('0x16')]));});});};exports['AddTagsToSmsInteraction']=function(_0x4be4c4){return new Promise(function(_0x555134,_0x347af1){return db['SmsInteraction'][_0x9676('0x21')]({'where':_0x4be4c4['options']?_0x4be4c4[_0x9676('0x1a')]['where']||null:null})[_0x9676('0x1f')](function(_0x1ff21f){if(_0x1ff21f){return _0x1ff21f[_0x9676('0x22')](_0x4be4c4[_0x9676('0x23')][_0x9676('0x24')],_[_0x9676('0x25')](_0x4be4c4[_0x9676('0x23')],[_0x9676('0x24'),'id'])||{});}})[_0x9676('0x26')](function(_0x4c9998){logger[_0x9676('0xf')](_0x9676('0x27'),_0x4be4c4);logger[_0x9676('0x12')]('AddTags',_0x4be4c4,JSON['stringify'](_0x4c9998));_0x555134(_0x4c9998);})['catch'](function(_0x1de6da){logger[_0x9676('0x15')](_0x9676('0x27'),_0x1de6da['message'],_0x4be4c4);_0x347af1(_this['error'](0x1f4,_0x1de6da['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 5b3d838..8aa9fdc 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 _0xa8d6=['removeListener','length','./smsInteraction.events','save','remove','update'];(function(_0x459506,_0x15e0d2){var _0x4942d7=function(_0x21f877){while(--_0x21f877){_0x459506['push'](_0x459506['shift']());}};_0x4942d7(++_0x15e0d2);}(_0xa8d6,0x6e));var _0x6a8d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xa8d6[_0x1035c1];return _0x308d67;};'use strict';var SmsInteractionEvents=require(_0x6a8d('0x0'));var events=[_0x6a8d('0x1'),_0x6a8d('0x2'),_0x6a8d('0x3')];function createListener(_0x4b0505,_0x4ca16c){return function(_0x24d317){_0x4ca16c['emit'](_0x4b0505,_0x24d317);};}function removeListener(_0x5dd66c,_0x322a82){return function(){SmsInteractionEvents[_0x6a8d('0x4')](_0x5dd66c,_0x322a82);};}exports['register']=function(_0x452363){for(var _0x47e640=0x0,_0x82e59a=events[_0x6a8d('0x5')];_0x47e640<_0x82e59a;_0x47e640++){var _0x56ccaf=events[_0x47e640];var _0x2524b0=createListener('smsInteraction:'+_0x56ccaf,_0x452363);SmsInteractionEvents['on'](_0x56ccaf,_0x2524b0);}}; \ No newline at end of file +var _0x70fb=['save','remove','update','emit','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x1852f7,_0x339696){var _0x3d7b39=function(_0x326ce8){while(--_0x326ce8){_0x1852f7['push'](_0x1852f7['shift']());}};_0x3d7b39(++_0x339696);}(_0x70fb,0x9f));var _0xb70f=function(_0x1a3ce1,_0x40ed90){_0x1a3ce1=_0x1a3ce1-0x0;var _0x24aaae=_0x70fb[_0x1a3ce1];return _0x24aaae;};'use strict';var SmsInteractionEvents=require(_0xb70f('0x0'));var events=[_0xb70f('0x1'),_0xb70f('0x2'),_0xb70f('0x3')];function createListener(_0x5d194d,_0x162abb){return function(_0x2720f5){_0x162abb[_0xb70f('0x4')](_0x5d194d,_0x2720f5);};}function removeListener(_0x4bc0ac,_0x59ca8e){return function(){SmsInteractionEvents[_0xb70f('0x5')](_0x4bc0ac,_0x59ca8e);};}exports['register']=function(_0x503038){for(var _0x546375=0x0,_0x236acb=events[_0xb70f('0x6')];_0x546375<_0x236acb;_0x546375++){var _0x56484f=events[_0x546375];var _0x60ffb4=createListener(_0xb70f('0x7')+_0x56484f,_0x503038);SmsInteractionEvents['on'](_0x56484f,_0x60ffb4);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index e70adba..de96679 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 _0xc288=['reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','post','sms','smsmessage:create','create','/:id/status','status','/:id','update','put','/:id/accept','/:id/reject'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0xc288,0x1d3));var _0x8c28=function(_0x54ae8d,_0x4c000d){_0x54ae8d=_0x54ae8d-0x0;var _0x47364b=_0xc288[_0x54ae8d];return _0x47364b;};'use strict';var multer=require(_0x8c28('0x0'));var util=require(_0x8c28('0x1'));var path=require(_0x8c28('0x2'));var timeout=require(_0x8c28('0x3'));var express=require(_0x8c28('0x4'));var router=express[_0x8c28('0x5')]();var fs_extra=require(_0x8c28('0x6'));var auth=require(_0x8c28('0x7'));var interaction=require(_0x8c28('0x8'));var config=require(_0x8c28('0x9'));var controller=require(_0x8c28('0xa'));router[_0x8c28('0xb')]('/',auth[_0x8c28('0xc')](),controller[_0x8c28('0xd')]);router[_0x8c28('0xb')](_0x8c28('0xe'),auth[_0x8c28('0xc')](),controller['describe']);router[_0x8c28('0xb')]('/:id',auth[_0x8c28('0xc')](),controller['show']);router[_0x8c28('0xf')]('/',auth[_0x8c28('0xc')](),interaction['tracked'](_0x8c28('0x10'),_0x8c28('0x11')),controller[_0x8c28('0x12')]);router['post'](_0x8c28('0x13'),controller[_0x8c28('0x14')]);router['put'](_0x8c28('0x15'),auth[_0x8c28('0xc')](),controller[_0x8c28('0x16')]);router[_0x8c28('0x17')](_0x8c28('0x18'),auth[_0x8c28('0xc')](),controller['accept']);router[_0x8c28('0x17')](_0x8c28('0x19'),auth['isAuthenticated'](),controller[_0x8c28('0x1a')]);router[_0x8c28('0x1b')](_0x8c28('0x15'),auth['isAuthenticated'](),controller[_0x8c28('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x2bca=['isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','status','put','update','accept','/:id/reject','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x388ccc,_0x2a24fd){var _0x570c20=function(_0x1addd1){while(--_0x1addd1){_0x388ccc['push'](_0x388ccc['shift']());}};_0x570c20(++_0x2a24fd);}(_0x2bca,0x19a));var _0xa2bc=function(_0xf5797a,_0x4c96dd){_0xf5797a=_0xf5797a-0x0;var _0x36a429=_0x2bca[_0xf5797a];return _0x36a429;};'use strict';var multer=require(_0xa2bc('0x0'));var util=require('util');var path=require(_0xa2bc('0x1'));var timeout=require(_0xa2bc('0x2'));var express=require(_0xa2bc('0x3'));var router=express[_0xa2bc('0x4')]();var fs_extra=require(_0xa2bc('0x5'));var auth=require(_0xa2bc('0x6'));var interaction=require(_0xa2bc('0x7'));var config=require(_0xa2bc('0x8'));var controller=require('./smsMessage.controller');router[_0xa2bc('0x9')]('/',auth[_0xa2bc('0xa')](),controller[_0xa2bc('0xb')]);router[_0xa2bc('0x9')](_0xa2bc('0xc'),auth[_0xa2bc('0xa')](),controller[_0xa2bc('0xd')]);router[_0xa2bc('0x9')](_0xa2bc('0xe'),auth[_0xa2bc('0xa')](),controller[_0xa2bc('0xf')]);router[_0xa2bc('0x10')]('/',auth['isAuthenticated'](),interaction[_0xa2bc('0x11')](_0xa2bc('0x12'),_0xa2bc('0x13')),controller[_0xa2bc('0x14')]);router['post']('/:id/status',controller[_0xa2bc('0x15')]);router[_0xa2bc('0x16')](_0xa2bc('0xe'),auth[_0xa2bc('0xa')](),controller[_0xa2bc('0x17')]);router[_0xa2bc('0x16')]('/:id/accept',auth['isAuthenticated'](),controller[_0xa2bc('0x18')]);router['put'](_0xa2bc('0x19'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xa2bc('0xe'),auth['isAuthenticated'](),controller[_0xa2bc('0x1a')]);module[_0xa2bc('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 c99ce58..105f499 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 _0xa67b=['BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0xa67b,0x10e));var _0xba67=function(_0x4d4fcc,_0xaa89a3){_0x4d4fcc=_0x4d4fcc-0x0;var _0x1efd89=_0xa67b[_0x4d4fcc];return _0x1efd89;};'use strict';var Sequelize=require(_0xba67('0x0'));module[_0xba67('0x1')]={'body':{'type':Sequelize[_0xba67('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xba67('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xba67('0x4')]('in','out'),'defaultValue':_0xba67('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xba67('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xba67('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xba67('0x6')]},'providerResponse':{'type':Sequelize[_0xba67('0x2')]}}; \ No newline at end of file +var _0x67f5=['exports','BOOLEAN','ENUM','out','DATE','TEXT','sequelize'];(function(_0x4cfc04,_0x31903b){var _0x3d26c9=function(_0x3da4bd){while(--_0x3da4bd){_0x4cfc04['push'](_0x4cfc04['shift']());}};_0x3d26c9(++_0x31903b);}(_0x67f5,0x99));var _0x567f=function(_0x343e44,_0x519af9){_0x343e44=_0x343e44-0x0;var _0xa5130e=_0x67f5[_0x343e44];return _0xa5130e;};'use strict';var Sequelize=require(_0x567f('0x0'));module[_0x567f('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x567f('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x567f('0x3')]('in',_0x567f('0x4')),'defaultValue':_0x567f('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x567f('0x5')]},'secret':{'type':Sequelize[_0x567f('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x567f('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 37f26c8..a812897 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 _0x02fe=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','find','body','update','destroy','describe','sms-interactions','accept','sms','read','readAt','UserId','user','agent','params','SmsInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','SmsInteraction','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','QueryTypes','User','email','SmsAccount','debug','received\x20delivery\x20report\x20from','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','MessageUUID','sent','delivered','plivio','infobip','results','DELIVERED','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4bd880,_0x2d1280){var _0x47273a=function(_0x34442e){while(--_0x34442e){_0x4bd880['push'](_0x4bd880['shift']());}};_0x47273a(++_0x2d1280);}(_0x02fe,0x1b8));var _0xe02f=function(_0x4583b3,_0x35a5d7){_0x4583b3=_0x4583b3-0x0;var _0x1568e1=_0x02fe[_0x4583b3];return _0x1568e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe02f('0x0'));var zipdir=require(_0xe02f('0x1'));var jsonpatch=require(_0xe02f('0x2'));var rp=require(_0xe02f('0x3'));var moment=require(_0xe02f('0x4'));var BPromise=require(_0xe02f('0x5'));var Mustache=require(_0xe02f('0x6'));var util=require(_0xe02f('0x7'));var path=require(_0xe02f('0x8'));var sox=require(_0xe02f('0x9'));var csv=require(_0xe02f('0xa'));var ejs=require(_0xe02f('0xb'));var fs=require('fs');var fs_extra=require(_0xe02f('0xc'));var _=require(_0xe02f('0xd'));var squel=require(_0xe02f('0xe'));var crypto=require(_0xe02f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe02f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe02f('0x11'));var Papa=require(_0xe02f('0x12'));var Redis=require(_0xe02f('0x13'));var authService=require(_0xe02f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe02f('0x15'));var hardwareService=require(_0xe02f('0x16'));var logger=require(_0xe02f('0x17'))(_0xe02f('0x18'));var utils=require(_0xe02f('0x19'));var config=require(_0xe02f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe02f('0x1b'))['db'];config[_0xe02f('0x1c')]=_[_0xe02f('0x1d')](config[_0xe02f('0x1c')],{'host':_0xe02f('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe02f('0x1f'))[_0xe02f('0x20')](socket);var jayson=require(_0xe02f('0x21'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xe02f('0x22')][_0xe02f('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x5ece1c,_0x489434,_0x4f1198,_0x3b1ff1){return new BPromise(function(_0x20d376,_0x4c5ed0){var _0x1ded9d=_0x3b1ff1||client;return _0x1ded9d['request'](_0x5ece1c,_0x4f1198)[_0xe02f('0x24')](function(_0x376fa1){logger[_0xe02f('0x25')](_0xe02f('0x26'),_0x489434,'request\x20sent');logger['debug'](_0xe02f('0x27'),_0x489434,'request\x20sent',JSON[_0xe02f('0x28')](_0x376fa1));if(_0x376fa1[_0xe02f('0x29')]){if(_0x376fa1[_0xe02f('0x29')][_0xe02f('0x2a')]===0x1f4){logger[_0xe02f('0x29')](_0xe02f('0x26'),_0x489434,_0x376fa1[_0xe02f('0x29')]['message']);return _0x4c5ed0(_0x376fa1['error'][_0xe02f('0x2b')]);}logger[_0xe02f('0x29')](_0xe02f('0x26'),_0x489434,_0x376fa1[_0xe02f('0x29')]['message']);return _0x20d376(_0x376fa1[_0xe02f('0x29')][_0xe02f('0x2b')]);}else{logger['info'](_0xe02f('0x26'),_0x489434,_0xe02f('0x2c'));_0x20d376(_0x376fa1[_0xe02f('0x2d')][_0xe02f('0x2b')]);}})[_0xe02f('0x2e')](function(_0x4a986a){logger[_0xe02f('0x29')]('SmsMessage,\x20%s,\x20%s',_0x489434,_0x4a986a);_0x4c5ed0(_0x4a986a);});});}function respondWithStatusCode(_0x1da72a,_0x4fa9ea){_0x4fa9ea=_0x4fa9ea||0xcc;return function(_0xd35be5){if(_0xd35be5){return _0x1da72a[_0xe02f('0x2f')](_0x4fa9ea);}return _0x1da72a[_0xe02f('0x30')](_0x4fa9ea)[_0xe02f('0x31')]();};}function respondWithResult(_0x18ce7c,_0x35b481){_0x35b481=_0x35b481||0xc8;return function(_0x174b49){if(_0x174b49){return _0x18ce7c[_0xe02f('0x30')](_0x35b481)[_0xe02f('0x32')](_0x174b49);}};}function respondWithFilteredResult(_0x3df08e,_0x530af1){return function(_0x1e1812){if(_0x1e1812){var _0x39451d=typeof _0x530af1[_0xe02f('0x33')]===_0xe02f('0x34')&&typeof _0x530af1[_0xe02f('0x35')]===_0xe02f('0x34');var _0x25601c=_0x1e1812[_0xe02f('0x36')];var _0x162b63=_0x39451d?0x0:_0x530af1[_0xe02f('0x33')];var _0x58fe33=_0x39451d?_0x1e1812['count']:_0x530af1[_0xe02f('0x33')]+_0x530af1[_0xe02f('0x35')];var _0x141267;if(_0x58fe33>=_0x25601c){_0x58fe33=_0x25601c;_0x141267=0xc8;}else{_0x141267=0xce;}_0x3df08e[_0xe02f('0x30')](_0x141267);return _0x3df08e['set'](_0xe02f('0x37'),_0x162b63+'-'+_0x58fe33+'/'+_0x25601c)[_0xe02f('0x32')](_0x1e1812);}return null;};}function patchUpdates(_0x47d4de){return function(_0x528d95){try{jsonpatch[_0xe02f('0x38')](_0x528d95,_0x47d4de,!![]);}catch(_0x38d6f2){return BPromise[_0xe02f('0x39')](_0x38d6f2);}return _0x528d95['save']();};}function saveUpdates(_0x2f7aa0,_0x2500fa){return function(_0x70e878){if(_0x70e878){return _0x70e878['update'](_0x2f7aa0)[_0xe02f('0x24')](function(_0x32feb4){return _0x32feb4;});}return null;};}function removeEntity(_0x5aafde,_0x394b6c){return function(_0x3b82ea){if(_0x3b82ea){return _0x3b82ea['destroy']()[_0xe02f('0x24')](function(){_0x5aafde['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fb321,_0x5bd86e){return function(_0x279576){if(!_0x279576){_0x3fb321['sendStatus'](0x194);}return _0x279576;};}function handleError(_0xa8b12d,_0x2de402){_0x2de402=_0x2de402||0x1f4;return function(_0x507fc7){logger['error'](_0x507fc7[_0xe02f('0x3a')]);if(_0x507fc7[_0xe02f('0x3b')]){delete _0x507fc7[_0xe02f('0x3b')];}_0xa8b12d[_0xe02f('0x30')](_0x2de402)[_0xe02f('0x3c')](_0x507fc7);};}exports[_0xe02f('0x3d')]=function(_0x66ea16,_0x169bf4){var _0x5282da={},_0x4667e7={},_0x502524={'count':0x0,'rows':[]};var _0x10ec85=_[_0xe02f('0x3e')](db[_0xe02f('0x3f')][_0xe02f('0x40')],function(_0x19ae2b){return{'name':_0x19ae2b[_0xe02f('0x41')],'type':_0x19ae2b['type'][_0xe02f('0x42')]};});_0x4667e7[_0xe02f('0x43')]=_[_0xe02f('0x3e')](_0x10ec85,_0xe02f('0x3b'));_0x4667e7[_0xe02f('0x44')]=_[_0xe02f('0x45')](_0x66ea16[_0xe02f('0x44')]);_0x4667e7[_0xe02f('0x46')]=_[_0xe02f('0x47')](_0x4667e7[_0xe02f('0x43')],_0x4667e7[_0xe02f('0x44')]);_0x5282da['attributes']=_['intersection'](_0x4667e7[_0xe02f('0x43')],qs[_0xe02f('0x48')](_0x66ea16['query'][_0xe02f('0x48')]));_0x5282da[_0xe02f('0x49')]=_0x5282da[_0xe02f('0x49')][_0xe02f('0x4a')]?_0x5282da[_0xe02f('0x49')]:_0x4667e7[_0xe02f('0x43')];if(!_0x66ea16['query']['hasOwnProperty']('nolimit')){_0x5282da[_0xe02f('0x35')]=qs['limit'](_0x66ea16[_0xe02f('0x44')][_0xe02f('0x35')]);_0x5282da[_0xe02f('0x33')]=qs['offset'](_0x66ea16[_0xe02f('0x44')][_0xe02f('0x33')]);}_0x5282da['order']=qs[_0xe02f('0x4b')](_0x66ea16[_0xe02f('0x44')][_0xe02f('0x4b')]);_0x5282da['where']=qs[_0xe02f('0x46')](_[_0xe02f('0x4c')](_0x66ea16['query'],_0x4667e7[_0xe02f('0x46')]),_0x10ec85);if(_0x66ea16[_0xe02f('0x44')][_0xe02f('0x4d')]){_0x5282da[_0xe02f('0x4e')]=_[_0xe02f('0x4f')](_0x5282da[_0xe02f('0x4e')],{'$or':_[_0xe02f('0x3e')](_0x10ec85,function(_0x11f24c){if(_0x11f24c[_0xe02f('0x50')]!=='VIRTUAL'){var _0x3031ab={};_0x3031ab[_0x11f24c['name']]={'$like':'%'+_0x66ea16[_0xe02f('0x44')]['filter']+'%'};return _0x3031ab;}})});}_0x5282da=_[_0xe02f('0x4f')]({},_0x5282da,_0x66ea16[_0xe02f('0x51')]);var _0x1ba6a3={'where':_0x5282da[_0xe02f('0x4e')]};return db[_0xe02f('0x3f')][_0xe02f('0x36')](_0x1ba6a3)[_0xe02f('0x24')](function(_0x2de3ce){_0x502524[_0xe02f('0x36')]=_0x2de3ce;if(_0x66ea16['query'][_0xe02f('0x52')]){_0x5282da[_0xe02f('0x53')]=[{'all':!![]}];}return db['SmsMessage'][_0xe02f('0x54')](_0x5282da);})[_0xe02f('0x24')](function(_0x33ad0c){_0x502524[_0xe02f('0x55')]=_0x33ad0c;return _0x502524;})[_0xe02f('0x24')](respondWithFilteredResult(_0x169bf4,_0x5282da))[_0xe02f('0x2e')](handleError(_0x169bf4,null));};exports['show']=function(_0x3ea85e,_0x55d6c1){var _0x22184f={'raw':!![],'where':{'id':_0x3ea85e['params']['id']}},_0x2649cd={};_0x2649cd['model']=_[_0xe02f('0x45')](db['SmsMessage']['rawAttributes']);_0x2649cd[_0xe02f('0x44')]=_[_0xe02f('0x45')](_0x3ea85e[_0xe02f('0x44')]);_0x2649cd[_0xe02f('0x46')]=_[_0xe02f('0x47')](_0x2649cd[_0xe02f('0x43')],_0x2649cd['query']);_0x22184f['attributes']=_[_0xe02f('0x47')](_0x2649cd[_0xe02f('0x43')],qs[_0xe02f('0x48')](_0x3ea85e[_0xe02f('0x44')]['fields']));_0x22184f[_0xe02f('0x49')]=_0x22184f[_0xe02f('0x49')][_0xe02f('0x4a')]?_0x22184f[_0xe02f('0x49')]:_0x2649cd[_0xe02f('0x43')];if(_0x3ea85e[_0xe02f('0x44')][_0xe02f('0x52')]){_0x22184f[_0xe02f('0x53')]=[{'all':!![]}];}_0x22184f=_[_0xe02f('0x4f')]({},_0x22184f,_0x3ea85e[_0xe02f('0x51')]);return db[_0xe02f('0x3f')][_0xe02f('0x56')](_0x22184f)[_0xe02f('0x24')](handleEntityNotFound(_0x55d6c1,null))[_0xe02f('0x24')](respondWithResult(_0x55d6c1,null))['catch'](handleError(_0x55d6c1,null));};exports['create']=function(_0x37411c,_0x4cd2e2){return db[_0xe02f('0x3f')]['create'](_0x37411c[_0xe02f('0x57')],{})['then'](respondWithResult(_0x4cd2e2,0xc9))[_0xe02f('0x2e')](handleError(_0x4cd2e2,null));};exports[_0xe02f('0x58')]=function(_0x8ed22b,_0x35ffcb){if(_0x8ed22b['body']['id']){delete _0x8ed22b[_0xe02f('0x57')]['id'];}return db['SmsMessage'][_0xe02f('0x56')]({'where':{'id':_0x8ed22b['params']['id']}})[_0xe02f('0x24')](handleEntityNotFound(_0x35ffcb,null))[_0xe02f('0x24')](saveUpdates(_0x8ed22b[_0xe02f('0x57')],null))[_0xe02f('0x24')](respondWithResult(_0x35ffcb,null))['catch'](handleError(_0x35ffcb,null));};exports[_0xe02f('0x59')]=function(_0x5e472d,_0xb4116b){return db[_0xe02f('0x3f')]['find']({'where':{'id':_0x5e472d['params']['id']}})[_0xe02f('0x24')](handleEntityNotFound(_0xb4116b,null))[_0xe02f('0x24')](removeEntity(_0xb4116b,null))[_0xe02f('0x2e')](handleError(_0xb4116b,null));};exports[_0xe02f('0x5a')]=function(_0xe65411,_0x221e12){return db['SmsMessage'][_0xe02f('0x5a')]()[_0xe02f('0x24')](respondWithResult(_0x221e12,null))[_0xe02f('0x2e')](handleError(_0x221e12,null));};var interaction_log=require(_0xe02f('0x17'))(_0xe02f('0x5b'));exports[_0xe02f('0x5c')]=function(_0x4fe505,_0x3ce900,_0x1c7d89){var _0x51e886={'agent':{},'channel':_0xe02f('0x5d')};if(_0x4fe505[_0xe02f('0x57')]['id']){delete _0x4fe505[_0xe02f('0x57')]['id'];}_0x4fe505[_0xe02f('0x57')][_0xe02f('0x5e')]=!![];_0x4fe505[_0xe02f('0x57')][_0xe02f('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4fe505[_0xe02f('0x57')][_0xe02f('0x60')]=_0x4fe505[_0xe02f('0x57')][_0xe02f('0x60')]||_0x4fe505[_0xe02f('0x61')]['id'];_0x51e886[_0xe02f('0x62')]['id']=_0x4fe505['body'][_0xe02f('0x60')];return db[_0xe02f('0x3f')][_0xe02f('0x56')]({'where':{'id':_0x4fe505[_0xe02f('0x63')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ce900,null))['then'](saveUpdates(_0x4fe505[_0xe02f('0x57')],null))[_0xe02f('0x24')](function(_0xcda017){if(_0xcda017){_0x51e886['message']=_0xcda017['get']({'plain':!![]});return db['SmsInteraction'][_0xe02f('0x56')]({'where':{'id':_0xcda017[_0xe02f('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x3ce900,null))[_0xe02f('0x24')](function(_0x2b9425){if(_0x2b9425){return _0x2b9425[_0xe02f('0x58')]({'UserId':_0x4fe505['body'][_0xe02f('0x60')],'read1stAt':_[_0xe02f('0x65')](_0x2b9425[_0xe02f('0x66')])?moment()[_0xe02f('0x67')](_0xe02f('0x68')):undefined});}return null;})['then'](function(_0x296e5e){if(_0x296e5e){_0x51e886['interaction']=_0x296e5e[_0xe02f('0x69')]({'plain':!![]});interaction_log[_0xe02f('0x25')](_0xe02f('0x6a'),_0x4fe505['user']['id'],_0x4fe505['user'][_0xe02f('0x3b')],_0x4fe505[_0xe02f('0x61')][_0xe02f('0x6b')],_0x51e886['interaction']['id'],_0x4fe505['body']?JSON[_0xe02f('0x28')](_0x4fe505['body']):'null');return respondWithRpcPromise(_0xe02f('0x6c'),'acceptMessage',_0x51e886);}return null;})[_0xe02f('0x24')](function(_0x13b54c){var _0x19f274=_0xe02f('0x6d')+_0x13b54c[_0xe02f('0x2b')][_0xe02f('0x6e')];return db[_0xe02f('0x6f')][_0xe02f('0x44')](_0x19f274,{'type':db[_0xe02f('0x70')]['QueryTypes'][_0xe02f('0x71')],'raw':!![]})['then'](function(_0x3eb6b3){return _0x3eb6b3;});})[_0xe02f('0x24')](function(_0x3167f5){if(_0x3167f5){_0x51e886[_0xe02f('0x2b')][_0xe02f('0x72')]=_0x3167f5[0x0];if(!_0x4fe505['body'][_0xe02f('0x60')])return;return db['User']['find']({'where':{'id':_0x4fe505[_0xe02f('0x57')][_0xe02f('0x60')],'role':_0xe02f('0x62')},'attributes':['id',_0xe02f('0x3b'),_0xe02f('0x73'),'email','internal'],'raw':!![]});}return null;})[_0xe02f('0x24')](function(_0x548036){if(!_0x548036)return null;_0x51e886[_0xe02f('0x2b')][_0xe02f('0x62')]=_0x548036;return _0x51e886;})['then'](function(_0x47596c){if(_0x47596c){if(_0x4fe505[_0xe02f('0x57')][_0xe02f('0x74')]){_0x51e886[_0xe02f('0x2b')][_0xe02f('0x75')]=util['format'](_0xe02f('0x76'),_0x4fe505['user'][_0xe02f('0x3b')]);_0x51e886['message'][_0xe02f('0x77')]=_0x51e886[_0xe02f('0x77')];_0x51e886[_0xe02f('0x2b')][_0xe02f('0x78')]=_0x51e886[_0xe02f('0x77')];_0x51e886['message'][_0xe02f('0x79')]=_0xe02f('0x5c');return respondWithRpcPromise(_0xe02f('0x7a'),'EventManager',{'event':_0xe02f('0x7b'),'message':_0x51e886[_0xe02f('0x2b')]},client9002)[_0xe02f('0x24')](function(){return _0x51e886;});}return _0x51e886;}return null;})[_0xe02f('0x24')](respondWithResult(_0x3ce900,null))[_0xe02f('0x2e')](handleError(_0x3ce900,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xe02f('0x39')]=function(_0x5e1fc6,_0x3e1ca2,_0xbab504){var _0x131634={'agent':{},'channel':'sms'};if(_0x5e1fc6[_0xe02f('0x57')]['id']){delete _0x5e1fc6[_0xe02f('0x57')]['id'];}_0x5e1fc6['body'][_0xe02f('0x60')]=_0x5e1fc6[_0xe02f('0x57')]['UserId']||_0x5e1fc6[_0xe02f('0x61')]['id'];_0x131634[_0xe02f('0x62')]['id']=_0x5e1fc6[_0xe02f('0x57')][_0xe02f('0x60')];return db[_0xe02f('0x3f')]['find']({'where':{'id':_0x5e1fc6[_0xe02f('0x63')]['id'],'UserId':null}})[_0xe02f('0x24')](handleEntityNotFound(_0x3e1ca2,null))[_0xe02f('0x24')](function(_0x4f4ed1){if(_0x4f4ed1){_0x131634[_0xe02f('0x2b')]=_0x4f4ed1['get']({'plain':!![]});return db[_0xe02f('0x7c')][_0xe02f('0x56')]({'where':{'id':_0x4f4ed1[_0xe02f('0x64')]}});}return null;})[_0xe02f('0x24')](handleEntityNotFound(_0x3e1ca2,null))[_0xe02f('0x24')](function(_0xc7c54b){if(_0xc7c54b){_0x131634[_0xe02f('0x7d')]=_0xc7c54b[_0xe02f('0x69')]({'plain':!![]});interaction_log['info'](_0xe02f('0x7e'),_0x5e1fc6[_0xe02f('0x61')]['id'],_0x5e1fc6[_0xe02f('0x61')][_0xe02f('0x3b')],_0x5e1fc6[_0xe02f('0x61')]['role'],_0x131634[_0xe02f('0x7d')]['id'],_0x5e1fc6[_0xe02f('0x57')]?JSON[_0xe02f('0x28')](_0x5e1fc6[_0xe02f('0x57')]):_0xe02f('0x7f'));return respondWithRpcPromise(_0xe02f('0x80'),_0xe02f('0x81'),_0x131634);}return null;})[_0xe02f('0x24')](function(_0x29ec54){var _0x5d7de='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x29ec54['message'][_0xe02f('0x6e')];return db[_0xe02f('0x6f')][_0xe02f('0x44')](_0x5d7de,{'type':db[_0xe02f('0x70')][_0xe02f('0x82')][_0xe02f('0x71')],'raw':!![]})['then'](function(_0x489775){return _0x489775;});})[_0xe02f('0x24')](function(_0x5221de){if(_0x5221de){_0x131634[_0xe02f('0x2b')][_0xe02f('0x72')]=_0x5221de[0x0];if(!_0x5e1fc6[_0xe02f('0x57')][_0xe02f('0x60')])return;return db[_0xe02f('0x83')][_0xe02f('0x56')]({'where':{'id':_0x5e1fc6[_0xe02f('0x57')][_0xe02f('0x60')],'role':_0xe02f('0x62')},'attributes':['id',_0xe02f('0x3b'),_0xe02f('0x73'),_0xe02f('0x84'),'internal'],'raw':!![]});}return null;})[_0xe02f('0x24')](function(_0x32491a){if(!_0x32491a)return null;_0x131634[_0xe02f('0x2b')]['agent']=_0x32491a;return _0x131634;})[_0xe02f('0x24')](function(_0x2101c3){if(_0x2101c3){_0x2101c3['message'][_0xe02f('0x75')]=util['format'](_0xe02f('0x76'),_0x5e1fc6[_0xe02f('0x61')][_0xe02f('0x3b')]);_0x2101c3[_0xe02f('0x2b')][_0xe02f('0x77')]=_0x131634[_0xe02f('0x77')];_0x2101c3[_0xe02f('0x2b')]['motionChannel']=_0x131634[_0xe02f('0x77')];_0x2101c3['message'][_0xe02f('0x79')]=_0xe02f('0x39');respondWithRpcPromise(_0xe02f('0x7a'),_0xe02f('0x7a'),{'event':'rejectmessage','message':_0x2101c3[_0xe02f('0x2b')]},client9002);return _0x131634;}return null;})[_0xe02f('0x24')](respondWithResult(_0x3e1ca2,null))[_0xe02f('0x2e')](handleError(_0x3e1ca2,null));};exports[_0xe02f('0x30')]=function(_0x4d7e86,_0x1b226c,_0x4ac5a3){if(_0x4d7e86['body']['id']){delete _0x4d7e86['body']['id'];}var _0x272f0c;return db[_0xe02f('0x3f')][_0xe02f('0x56')]({'where':{'id':_0x4d7e86[_0xe02f('0x63')]['id']}})['then'](handleEntityNotFound(_0x1b226c,null))[_0xe02f('0x24')](function(_0xe521df){if(_0xe521df){_0x272f0c=_0xe521df;return db[_0xe02f('0x85')][_0xe02f('0x56')]({'where':{'id':_0xe521df['SmsAccountId']}});}})[_0xe02f('0x24')](handleEntityNotFound(_0x1b226c,null))['then'](function(_0x41edcb){if(_0x41edcb){logger[_0xe02f('0x86')](_0xe02f('0x27'),_0xe02f('0x30'),_0xe02f('0x87'),_0x41edcb[_0xe02f('0x50')],util['inspect'](_0x4d7e86[_0xe02f('0x57')],{'showHidden':![],'depth':null}));switch(_0x41edcb[_0xe02f('0x50')]){case'twilio':if(_0x4d7e86['body'][_0xe02f('0x88')]&&_0x4d7e86[_0xe02f('0x57')][_0xe02f('0x88')]===_0x272f0c[_0xe02f('0x89')]){return _0x272f0c[_0xe02f('0x58')]({'read':!![]});}else{logger[_0xe02f('0x29')](_0xe02f('0x8a'),_0xe02f('0x30'),_0xe02f('0x8b'),util[_0xe02f('0x8c')](_0x4d7e86[_0xe02f('0x57')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x4d7e86[_0xe02f('0x57')][_0xe02f('0x8d')]&&_0x4d7e86[_0xe02f('0x57')][_0xe02f('0x8d')]===_0x272f0c['messageId']&&_['indexOf']([_0xe02f('0x8e'),_0xe02f('0x8f')],_0x4d7e86[_0xe02f('0x57')]['Status'])>=0x0){return _0x272f0c[_0xe02f('0x58')]({'read':!![]});}else{logger[_0xe02f('0x29')](_0xe02f('0x8a'),_0xe02f('0x30'),_0xe02f('0x90'),util[_0xe02f('0x8c')](_0x4d7e86['body'],{'showHidden':![],'depth':null}));}break;case _0xe02f('0x91'):var _0x265e26=_0x4d7e86[_0xe02f('0x57')][_0xe02f('0x92')][0x0];if(_0x265e26[_0xe02f('0x30')]['groupName']===_0xe02f('0x93')){return _0x272f0c[_0xe02f('0x58')]({'read':!![]});}else{logger[_0xe02f('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','infobip',util['inspect'](_0x4d7e86[_0xe02f('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x272f0c;}})[_0xe02f('0x24')](respondWithResult(_0x1b226c,null))['catch'](handleError(_0x1b226c,null));}; \ No newline at end of file +var _0x161c=['SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','Sequelize','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','MessageSid','twilio','inspect','plivo','MessageUUID','messageId','indexOf','sent','Status','results','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./smsMessage.socket','jayson/promise','client','http','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','end','status','json','offset','limit','undefined','count','set','apply','update','sendStatus','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface'];(function(_0x2ff532,_0x4e3625){var _0x6d1ee5=function(_0x545507){while(--_0x545507){_0x2ff532['push'](_0x2ff532['shift']());}};_0x6d1ee5(++_0x4e3625);}(_0x161c,0xb7));var _0xc161=function(_0x2a684e,_0x524828){_0x2a684e=_0x2a684e-0x0;var _0x425287=_0x161c[_0x2a684e];return _0x425287;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc161('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc161('0x1'));var rp=require('request-promise');var moment=require(_0xc161('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc161('0x3'));var util=require(_0xc161('0x4'));var path=require(_0xc161('0x5'));var sox=require(_0xc161('0x6'));var csv=require(_0xc161('0x7'));var ejs=require(_0xc161('0x8'));var fs=require('fs');var fs_extra=require(_0xc161('0x9'));var _=require(_0xc161('0xa'));var squel=require(_0xc161('0xb'));var crypto=require(_0xc161('0xc'));var jsforce=require(_0xc161('0xd'));var deskjs=require(_0xc161('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc161('0xf'));var Redis=require(_0xc161('0x10'));var authService=require(_0xc161('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc161('0x12'));var hardwareService=require(_0xc161('0x13'));var logger=require('../../config/logger')(_0xc161('0x14'));var utils=require(_0xc161('0x15'));var config=require(_0xc161('0x16'));var licenseUtil=require(_0xc161('0x17'));var db=require(_0xc161('0x18'))['db'];config[_0xc161('0x19')]=_['defaults'](config[_0xc161('0x19')],{'host':_0xc161('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc161('0x19')]));require(_0xc161('0x1b'))['register'](socket);var jayson=require(_0xc161('0x1c'));var client=jayson[_0xc161('0x1d')][_0xc161('0x1e')]({'port':0x232c});var client9002=jayson[_0xc161('0x1d')][_0xc161('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3dd910,_0x1c20de,_0x5e375b,_0x2cc56b){return new BPromise(function(_0x2e3112,_0x5e76b7){var _0x15b032=_0x2cc56b||client;return _0x15b032['request'](_0x3dd910,_0x5e375b)[_0xc161('0x1f')](function(_0x158c4d){logger[_0xc161('0x20')]('SmsMessage,\x20%s,\x20%s',_0x1c20de,_0xc161('0x21'));logger[_0xc161('0x22')](_0xc161('0x23'),_0x1c20de,_0xc161('0x21'),JSON[_0xc161('0x24')](_0x158c4d));if(_0x158c4d['error']){if(_0x158c4d[_0xc161('0x25')]['code']===0x1f4){logger[_0xc161('0x25')](_0xc161('0x26'),_0x1c20de,_0x158c4d[_0xc161('0x25')][_0xc161('0x27')]);return _0x5e76b7(_0x158c4d[_0xc161('0x25')][_0xc161('0x27')]);}logger['error'](_0xc161('0x26'),_0x1c20de,_0x158c4d['error']['message']);return _0x2e3112(_0x158c4d[_0xc161('0x25')][_0xc161('0x27')]);}else{logger[_0xc161('0x20')](_0xc161('0x26'),_0x1c20de,_0xc161('0x21'));_0x2e3112(_0x158c4d[_0xc161('0x28')][_0xc161('0x27')]);}})['catch'](function(_0x4dd356){logger['error'](_0xc161('0x26'),_0x1c20de,_0x4dd356);_0x5e76b7(_0x4dd356);});});}function respondWithStatusCode(_0x2efaf7,_0x3c98d8){_0x3c98d8=_0x3c98d8||0xcc;return function(_0x352c06){if(_0x352c06){return _0x2efaf7['sendStatus'](_0x3c98d8);}return _0x2efaf7['status'](_0x3c98d8)[_0xc161('0x29')]();};}function respondWithResult(_0x3bfe6a,_0x3111fa){_0x3111fa=_0x3111fa||0xc8;return function(_0x22ec72){if(_0x22ec72){return _0x3bfe6a[_0xc161('0x2a')](_0x3111fa)[_0xc161('0x2b')](_0x22ec72);}};}function respondWithFilteredResult(_0x52cba1,_0x1ff8a8){return function(_0x125459){if(_0x125459){var _0x4a38a6=typeof _0x1ff8a8[_0xc161('0x2c')]==='undefined'&&typeof _0x1ff8a8[_0xc161('0x2d')]===_0xc161('0x2e');var _0x3d4e95=_0x125459[_0xc161('0x2f')];var _0x283867=_0x4a38a6?0x0:_0x1ff8a8[_0xc161('0x2c')];var _0x2ed8ca=_0x4a38a6?_0x125459['count']:_0x1ff8a8[_0xc161('0x2c')]+_0x1ff8a8['limit'];var _0x48b702;if(_0x2ed8ca>=_0x3d4e95){_0x2ed8ca=_0x3d4e95;_0x48b702=0xc8;}else{_0x48b702=0xce;}_0x52cba1[_0xc161('0x2a')](_0x48b702);return _0x52cba1[_0xc161('0x30')]('Content-Range',_0x283867+'-'+_0x2ed8ca+'/'+_0x3d4e95)[_0xc161('0x2b')](_0x125459);}return null;};}function patchUpdates(_0x26259b){return function(_0x2f4837){try{jsonpatch[_0xc161('0x31')](_0x2f4837,_0x26259b,!![]);}catch(_0x3cc99c){return BPromise['reject'](_0x3cc99c);}return _0x2f4837['save']();};}function saveUpdates(_0x22e553,_0x22f98e){return function(_0x275115){if(_0x275115){return _0x275115[_0xc161('0x32')](_0x22e553)[_0xc161('0x1f')](function(_0xc4898e){return _0xc4898e;});}return null;};}function removeEntity(_0x3c77ff,_0x250d34){return function(_0x399654){if(_0x399654){return _0x399654['destroy']()['then'](function(){_0x3c77ff['status'](0xcc)[_0xc161('0x29')]();});}};}function handleEntityNotFound(_0x501984,_0x18f909){return function(_0xf4a2ff){if(!_0xf4a2ff){_0x501984[_0xc161('0x33')](0x194);}return _0xf4a2ff;};}function handleError(_0x5d8e52,_0x455768){_0x455768=_0x455768||0x1f4;return function(_0x475154){logger['error'](_0x475154['stack']);if(_0x475154[_0xc161('0x34')]){delete _0x475154[_0xc161('0x34')];}_0x5d8e52[_0xc161('0x2a')](_0x455768)[_0xc161('0x35')](_0x475154);};}exports[_0xc161('0x36')]=function(_0xc9ce7c,_0x2be0ed){var _0x238a4e={},_0x1bdd26={},_0x4f2c59={'count':0x0,'rows':[]};var _0x2b6f63=_[_0xc161('0x37')](db[_0xc161('0x38')][_0xc161('0x39')],function(_0x2d9803){return{'name':_0x2d9803[_0xc161('0x3a')],'type':_0x2d9803['type'][_0xc161('0x3b')]};});_0x1bdd26[_0xc161('0x3c')]=_['map'](_0x2b6f63,_0xc161('0x34'));_0x1bdd26[_0xc161('0x3d')]=_[_0xc161('0x3e')](_0xc9ce7c[_0xc161('0x3d')]);_0x1bdd26['filters']=_[_0xc161('0x3f')](_0x1bdd26[_0xc161('0x3c')],_0x1bdd26[_0xc161('0x3d')]);_0x238a4e[_0xc161('0x40')]=_['intersection'](_0x1bdd26[_0xc161('0x3c')],qs[_0xc161('0x41')](_0xc9ce7c['query'][_0xc161('0x41')]));_0x238a4e[_0xc161('0x40')]=_0x238a4e[_0xc161('0x40')][_0xc161('0x42')]?_0x238a4e[_0xc161('0x40')]:_0x1bdd26[_0xc161('0x3c')];if(!_0xc9ce7c[_0xc161('0x3d')][_0xc161('0x43')](_0xc161('0x44'))){_0x238a4e['limit']=qs['limit'](_0xc9ce7c[_0xc161('0x3d')][_0xc161('0x2d')]);_0x238a4e[_0xc161('0x2c')]=qs['offset'](_0xc9ce7c[_0xc161('0x3d')]['offset']);}_0x238a4e[_0xc161('0x45')]=qs[_0xc161('0x46')](_0xc9ce7c[_0xc161('0x3d')]['sort']);_0x238a4e[_0xc161('0x47')]=qs[_0xc161('0x48')](_[_0xc161('0x49')](_0xc9ce7c['query'],_0x1bdd26[_0xc161('0x48')]),_0x2b6f63);if(_0xc9ce7c[_0xc161('0x3d')][_0xc161('0x4a')]){_0x238a4e['where']=_[_0xc161('0x4b')](_0x238a4e[_0xc161('0x47')],{'$or':_['map'](_0x2b6f63,function(_0x1a777a){if(_0x1a777a[_0xc161('0x4c')]!=='VIRTUAL'){var _0xaf5bb0={};_0xaf5bb0[_0x1a777a[_0xc161('0x34')]]={'$like':'%'+_0xc9ce7c[_0xc161('0x3d')][_0xc161('0x4a')]+'%'};return _0xaf5bb0;}})});}_0x238a4e=_[_0xc161('0x4b')]({},_0x238a4e,_0xc9ce7c[_0xc161('0x4d')]);var _0x2342f4={'where':_0x238a4e[_0xc161('0x47')]};return db[_0xc161('0x38')]['count'](_0x2342f4)[_0xc161('0x1f')](function(_0x35a43){_0x4f2c59[_0xc161('0x2f')]=_0x35a43;if(_0xc9ce7c['query'][_0xc161('0x4e')]){_0x238a4e[_0xc161('0x4f')]=[{'all':!![]}];}return db[_0xc161('0x38')][_0xc161('0x50')](_0x238a4e);})['then'](function(_0x20315d){_0x4f2c59[_0xc161('0x51')]=_0x20315d;return _0x4f2c59;})[_0xc161('0x1f')](respondWithFilteredResult(_0x2be0ed,_0x238a4e))[_0xc161('0x52')](handleError(_0x2be0ed,null));};exports[_0xc161('0x53')]=function(_0x269641,_0x49df8a){var _0x5a4492={'raw':!![],'where':{'id':_0x269641['params']['id']}},_0x2471b7={};_0x2471b7['model']=_[_0xc161('0x3e')](db[_0xc161('0x38')]['rawAttributes']);_0x2471b7[_0xc161('0x3d')]=_[_0xc161('0x3e')](_0x269641[_0xc161('0x3d')]);_0x2471b7[_0xc161('0x48')]=_[_0xc161('0x3f')](_0x2471b7[_0xc161('0x3c')],_0x2471b7[_0xc161('0x3d')]);_0x5a4492[_0xc161('0x40')]=_[_0xc161('0x3f')](_0x2471b7[_0xc161('0x3c')],qs[_0xc161('0x41')](_0x269641[_0xc161('0x3d')][_0xc161('0x41')]));_0x5a4492['attributes']=_0x5a4492[_0xc161('0x40')]['length']?_0x5a4492[_0xc161('0x40')]:_0x2471b7[_0xc161('0x3c')];if(_0x269641[_0xc161('0x3d')][_0xc161('0x4e')]){_0x5a4492['include']=[{'all':!![]}];}_0x5a4492=_[_0xc161('0x4b')]({},_0x5a4492,_0x269641[_0xc161('0x4d')]);return db[_0xc161('0x38')][_0xc161('0x54')](_0x5a4492)[_0xc161('0x1f')](handleEntityNotFound(_0x49df8a,null))['then'](respondWithResult(_0x49df8a,null))[_0xc161('0x52')](handleError(_0x49df8a,null));};exports['create']=function(_0x3e7892,_0x48f251){return db[_0xc161('0x38')][_0xc161('0x55')](_0x3e7892[_0xc161('0x56')],{})[_0xc161('0x1f')](respondWithResult(_0x48f251,0xc9))['catch'](handleError(_0x48f251,null));};exports[_0xc161('0x32')]=function(_0x26378e,_0x403215){if(_0x26378e[_0xc161('0x56')]['id']){delete _0x26378e[_0xc161('0x56')]['id'];}return db['SmsMessage'][_0xc161('0x54')]({'where':{'id':_0x26378e[_0xc161('0x57')]['id']}})['then'](handleEntityNotFound(_0x403215,null))[_0xc161('0x1f')](saveUpdates(_0x26378e['body'],null))['then'](respondWithResult(_0x403215,null))[_0xc161('0x52')](handleError(_0x403215,null));};exports[_0xc161('0x58')]=function(_0x198740,_0x2177fd){return db[_0xc161('0x38')][_0xc161('0x54')]({'where':{'id':_0x198740[_0xc161('0x57')]['id']}})[_0xc161('0x1f')](handleEntityNotFound(_0x2177fd,null))[_0xc161('0x1f')](removeEntity(_0x2177fd,null))['catch'](handleError(_0x2177fd,null));};exports[_0xc161('0x59')]=function(_0x304e5b,_0x26040a){return db[_0xc161('0x38')][_0xc161('0x59')]()[_0xc161('0x1f')](respondWithResult(_0x26040a,null))[_0xc161('0x52')](handleError(_0x26040a,null));};var interaction_log=require(_0xc161('0x5a'))(_0xc161('0x5b'));exports[_0xc161('0x5c')]=function(_0x574d7d,_0x509caa,_0x2859ec){var _0x45cf4b={'agent':{},'channel':_0xc161('0x5d')};if(_0x574d7d[_0xc161('0x56')]['id']){delete _0x574d7d['body']['id'];}_0x574d7d[_0xc161('0x56')][_0xc161('0x5e')]=!![];_0x574d7d[_0xc161('0x56')][_0xc161('0x5f')]=moment()[_0xc161('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x574d7d[_0xc161('0x56')][_0xc161('0x61')]=_0x574d7d['body']['UserId']||_0x574d7d[_0xc161('0x62')]['id'];_0x45cf4b[_0xc161('0x63')]['id']=_0x574d7d['body'][_0xc161('0x61')];return db['SmsMessage'][_0xc161('0x54')]({'where':{'id':_0x574d7d[_0xc161('0x57')]['id'],'UserId':null}})[_0xc161('0x1f')](handleEntityNotFound(_0x509caa,null))[_0xc161('0x1f')](saveUpdates(_0x574d7d[_0xc161('0x56')],null))['then'](function(_0x89cf15){if(_0x89cf15){_0x45cf4b[_0xc161('0x27')]=_0x89cf15[_0xc161('0x64')]({'plain':!![]});return db[_0xc161('0x65')]['find']({'where':{'id':_0x89cf15['SmsInteractionId']}});}return null;})[_0xc161('0x1f')](handleEntityNotFound(_0x509caa,null))[_0xc161('0x1f')](function(_0xf142c){if(_0xf142c){return _0xf142c[_0xc161('0x32')]({'UserId':_0x574d7d[_0xc161('0x56')][_0xc161('0x61')],'read1stAt':_[_0xc161('0x66')](_0xf142c[_0xc161('0x67')])?moment()['format'](_0xc161('0x68')):undefined});}return null;})[_0xc161('0x1f')](function(_0x348a40){if(_0x348a40){_0x45cf4b[_0xc161('0x69')]=_0x348a40[_0xc161('0x64')]({'plain':!![]});interaction_log['info'](_0xc161('0x6a'),_0x574d7d[_0xc161('0x62')]['id'],_0x574d7d[_0xc161('0x62')][_0xc161('0x34')],_0x574d7d['user']['role'],_0x45cf4b[_0xc161('0x69')]['id'],_0x574d7d['body']?JSON['stringify'](_0x574d7d['body']):'null');return respondWithRpcPromise(_0xc161('0x6b'),_0xc161('0x6c'),_0x45cf4b);}return null;})['then'](function(_0x2260da){var _0x20f1a3=_0xc161('0x6d')+_0x2260da[_0xc161('0x27')][_0xc161('0x6e')];return db[_0xc161('0x6f')]['query'](_0x20f1a3,{'type':db['Sequelize'][_0xc161('0x70')][_0xc161('0x71')],'raw':!![]})[_0xc161('0x1f')](function(_0x2421ce){return _0x2421ce;});})[_0xc161('0x1f')](function(_0x2f8b8e){if(_0x2f8b8e){_0x45cf4b['message'][_0xc161('0x72')]=_0x2f8b8e[0x0];if(!_0x574d7d[_0xc161('0x56')]['UserId'])return;return db[_0xc161('0x73')][_0xc161('0x54')]({'where':{'id':_0x574d7d[_0xc161('0x56')][_0xc161('0x61')],'role':'agent'},'attributes':['id',_0xc161('0x34'),_0xc161('0x74'),_0xc161('0x75'),_0xc161('0x76')],'raw':!![]});}return null;})[_0xc161('0x1f')](function(_0x164ba2){if(!_0x164ba2)return null;_0x45cf4b[_0xc161('0x27')][_0xc161('0x63')]=_0x164ba2;return _0x45cf4b;})['then'](function(_0x113d0f){if(_0x113d0f){if(_0x574d7d['body'][_0xc161('0x77')]){_0x45cf4b[_0xc161('0x27')][_0xc161('0x78')]=util[_0xc161('0x60')](_0xc161('0x79'),_0x574d7d[_0xc161('0x62')][_0xc161('0x34')]);_0x45cf4b[_0xc161('0x27')][_0xc161('0x7a')]=_0x45cf4b[_0xc161('0x7a')];_0x45cf4b[_0xc161('0x27')][_0xc161('0x7b')]=_0x45cf4b['channel'];_0x45cf4b[_0xc161('0x27')][_0xc161('0x7c')]=_0xc161('0x5c');return respondWithRpcPromise(_0xc161('0x7d'),_0xc161('0x7d'),{'event':_0xc161('0x7e'),'message':_0x45cf4b[_0xc161('0x27')]},client9002)[_0xc161('0x1f')](function(){return _0x45cf4b;});}return _0x45cf4b;}return null;})[_0xc161('0x1f')](respondWithResult(_0x509caa,null))[_0xc161('0x52')](handleError(_0x509caa,null));};var interaction_log=require(_0xc161('0x5a'))(_0xc161('0x5b'));exports[_0xc161('0x7f')]=function(_0x2bc280,_0x4d5e45,_0x5280c7){var _0x224e6d={'agent':{},'channel':'sms'};if(_0x2bc280['body']['id']){delete _0x2bc280[_0xc161('0x56')]['id'];}_0x2bc280[_0xc161('0x56')][_0xc161('0x61')]=_0x2bc280[_0xc161('0x56')][_0xc161('0x61')]||_0x2bc280[_0xc161('0x62')]['id'];_0x224e6d[_0xc161('0x63')]['id']=_0x2bc280[_0xc161('0x56')][_0xc161('0x61')];return db[_0xc161('0x38')][_0xc161('0x54')]({'where':{'id':_0x2bc280[_0xc161('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4d5e45,null))[_0xc161('0x1f')](function(_0x5c6aeb){if(_0x5c6aeb){_0x224e6d[_0xc161('0x27')]=_0x5c6aeb[_0xc161('0x64')]({'plain':!![]});return db[_0xc161('0x65')][_0xc161('0x54')]({'where':{'id':_0x5c6aeb[_0xc161('0x80')]}});}return null;})[_0xc161('0x1f')](handleEntityNotFound(_0x4d5e45,null))[_0xc161('0x1f')](function(_0x54fe29){if(_0x54fe29){_0x224e6d['interaction']=_0x54fe29['get']({'plain':!![]});interaction_log[_0xc161('0x20')](_0xc161('0x81'),_0x2bc280['user']['id'],_0x2bc280[_0xc161('0x62')]['name'],_0x2bc280[_0xc161('0x62')][_0xc161('0x82')],_0x224e6d[_0xc161('0x69')]['id'],_0x2bc280[_0xc161('0x56')]?JSON[_0xc161('0x24')](_0x2bc280[_0xc161('0x56')]):_0xc161('0x83'));return respondWithRpcPromise(_0xc161('0x84'),_0xc161('0x85'),_0x224e6d);}return null;})[_0xc161('0x1f')](function(_0x5aa7fb){var _0x56c08b=_0xc161('0x6d')+_0x5aa7fb[_0xc161('0x27')][_0xc161('0x6e')];return db[_0xc161('0x6f')][_0xc161('0x3d')](_0x56c08b,{'type':db[_0xc161('0x86')][_0xc161('0x70')][_0xc161('0x71')],'raw':!![]})[_0xc161('0x1f')](function(_0x1b31ad){return _0x1b31ad;});})[_0xc161('0x1f')](function(_0x34dab0){if(_0x34dab0){_0x224e6d[_0xc161('0x27')][_0xc161('0x72')]=_0x34dab0[0x0];if(!_0x2bc280[_0xc161('0x56')][_0xc161('0x61')])return;return db[_0xc161('0x73')][_0xc161('0x54')]({'where':{'id':_0x2bc280[_0xc161('0x56')][_0xc161('0x61')],'role':_0xc161('0x63')},'attributes':['id',_0xc161('0x34'),_0xc161('0x74'),_0xc161('0x75'),_0xc161('0x76')],'raw':!![]});}return null;})['then'](function(_0x5b2ce5){if(!_0x5b2ce5)return null;_0x224e6d['message'][_0xc161('0x63')]=_0x5b2ce5;return _0x224e6d;})['then'](function(_0x3cb6a3){if(_0x3cb6a3){_0x3cb6a3[_0xc161('0x27')][_0xc161('0x78')]=util[_0xc161('0x60')](_0xc161('0x79'),_0x2bc280[_0xc161('0x62')]['name']);_0x3cb6a3[_0xc161('0x27')][_0xc161('0x7a')]=_0x224e6d[_0xc161('0x7a')];_0x3cb6a3[_0xc161('0x27')][_0xc161('0x7b')]=_0x224e6d[_0xc161('0x7a')];_0x3cb6a3[_0xc161('0x27')][_0xc161('0x7c')]=_0xc161('0x7f');respondWithRpcPromise(_0xc161('0x7d'),_0xc161('0x7d'),{'event':_0xc161('0x87'),'message':_0x3cb6a3[_0xc161('0x27')]},client9002);return _0x224e6d;}return null;})[_0xc161('0x1f')](respondWithResult(_0x4d5e45,null))['catch'](handleError(_0x4d5e45,null));};exports[_0xc161('0x2a')]=function(_0x5220a1,_0x48aa1f,_0x2b8283){if(_0x5220a1[_0xc161('0x56')]['id']){delete _0x5220a1[_0xc161('0x56')]['id'];}var _0x45a45c;return db[_0xc161('0x38')]['find']({'where':{'id':_0x5220a1['params']['id']}})[_0xc161('0x1f')](handleEntityNotFound(_0x48aa1f,null))['then'](function(_0x1df9c1){if(_0x1df9c1){_0x45a45c=_0x1df9c1;return db[_0xc161('0x88')][_0xc161('0x54')]({'where':{'id':_0x1df9c1[_0xc161('0x89')]}});}})[_0xc161('0x1f')](handleEntityNotFound(_0x48aa1f,null))[_0xc161('0x1f')](function(_0x5d2ee1){if(_0x5d2ee1){logger[_0xc161('0x22')](_0xc161('0x23'),_0xc161('0x2a'),_0xc161('0x8a'),_0x5d2ee1['type'],util['inspect'](_0x5220a1[_0xc161('0x56')],{'showHidden':![],'depth':null}));switch(_0x5d2ee1['type']){case'twilio':if(_0x5220a1['body'][_0xc161('0x8b')]&&_0x5220a1[_0xc161('0x56')][_0xc161('0x8b')]===_0x45a45c['messageId']){return _0x45a45c['update']({'read':!![]});}else{logger[_0xc161('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc161('0x2a'),_0xc161('0x8c'),util[_0xc161('0x8d')](_0x5220a1[_0xc161('0x56')],{'showHidden':![],'depth':null}));}break;case _0xc161('0x8e'):if(_0x5220a1['body']['MessageUUID']&&_0x5220a1[_0xc161('0x56')][_0xc161('0x8f')]===_0x45a45c[_0xc161('0x90')]&&_[_0xc161('0x91')]([_0xc161('0x92'),'delivered'],_0x5220a1[_0xc161('0x56')][_0xc161('0x93')])>=0x0){return _0x45a45c[_0xc161('0x32')]({'read':!![]});}else{logger[_0xc161('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc161('0x2a'),'plivio',util[_0xc161('0x8d')](_0x5220a1[_0xc161('0x56')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5dd0b9=_0x5220a1[_0xc161('0x56')][_0xc161('0x94')][0x0];if(_0x5dd0b9[_0xc161('0x2a')]['groupName']===_0xc161('0x95')){return _0x45a45c[_0xc161('0x32')]({'read':!![]});}else{logger[_0xc161('0x25')](_0xc161('0x96'),_0xc161('0x2a'),_0xc161('0x97'),util['inspect'](_0x5220a1[_0xc161('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x45a45c;}})[_0xc161('0x1f')](respondWithResult(_0x48aa1f,null))['catch'](handleError(_0x48aa1f,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index f7e7e95..44fdd45 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 _0xfed8=['remove','emit','hook','events','SmsMessage','setMaxListeners','save','update'];(function(_0x35aec6,_0x56404e){var _0x31f3a6=function(_0x5323ae){while(--_0x5323ae){_0x35aec6['push'](_0x35aec6['shift']());}};_0x31f3a6(++_0x56404e);}(_0xfed8,0x1cb));var _0x8fed=function(_0x3965b9,_0xe25795){_0x3965b9=_0x3965b9-0x0;var _0x5e1c6e=_0xfed8[_0x3965b9];return _0x5e1c6e;};'use strict';var EventEmitter=require(_0x8fed('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x8fed('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8fed('0x2')](0x0);var events={'afterCreate':_0x8fed('0x3'),'afterUpdate':_0x8fed('0x4'),'afterDestroy':_0x8fed('0x5')};function emitEvent(_0x312209){return function(_0x1a77d3,_0x35d094,_0x528808){SmsMessageEvents[_0x8fed('0x6')](_0x312209+':'+_0x1a77d3['id'],_0x1a77d3);SmsMessageEvents[_0x8fed('0x6')](_0x312209,_0x1a77d3);_0x528808(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x8fed('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x3770=['../../mysqldb','SmsMessage','setMaxListeners','save','emit','hasOwnProperty','hook','events'];(function(_0x54b283,_0x5eb8a6){var _0x2462b3=function(_0x13fca7){while(--_0x13fca7){_0x54b283['push'](_0x54b283['shift']());}};_0x2462b3(++_0x5eb8a6);}(_0x3770,0x9f));var _0x0377=function(_0x1e5219,_0x10e82c){_0x1e5219=_0x1e5219-0x0;var _0x308c1f=_0x3770[_0x1e5219];return _0x308c1f;};'use strict';var EventEmitter=require(_0x0377('0x0'));var SmsMessage=require(_0x0377('0x1'))['db'][_0x0377('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0377('0x3')](0x0);var events={'afterCreate':_0x0377('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x51ced8){return function(_0x3ed51c,_0x25ede6,_0x3e3867){SmsMessageEvents['emit'](_0x51ced8+':'+_0x3ed51c['id'],_0x3ed51c);SmsMessageEvents[_0x0377('0x5')](_0x51ced8,_0x3ed51c);_0x3e3867(null);};}for(var e in events){if(events[_0x0377('0x6')](e)){var event=events[e];SmsMessage[_0x0377('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 a7cf5eb..4ef3651 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 _0xda46=['finally','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsMessage','sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','error','SmsAccount','find','twilio','accountSid','authToken','phone','messages','/api/sms/messages/','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','plivo','remote','/status?token=','token','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','messageId','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','keys','sort','length','md5','signature=','/external/get/send.php?','id_sms','csc','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','message','Token\x20not\x20received'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xda46,0x1d2));var _0x6da4=function(_0x14ba64,_0x11db4a){_0x14ba64=_0x14ba64-0x0;var _0x4ff87a=_0xda46[_0x14ba64];return _0x4ff87a;};'use strict';var _=require(_0x6da4('0x0'));var util=require('util');var logger=require(_0x6da4('0x1'))(_0x6da4('0x2'));var moment=require('moment');var BPromise=require(_0x6da4('0x3'));var rp=require(_0x6da4('0x4'));var fs=require('fs');var path=require(_0x6da4('0x5'));var rimraf=require(_0x6da4('0x6'));var config=require(_0x6da4('0x7'));var attributes=require('./smsMessage.attributes');module[_0x6da4('0x8')]=function(_0x481e1e,_0x4df572){return _0x481e1e['define'](_0x6da4('0x9'),attributes,{'tableName':_0x6da4('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_sms_messages','fields':[_0x6da4('0xb')],'type':_0x6da4('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x228c98,_0x5b31e8,_0x5843ca){var _0x518847=_0x481e1e[_0x6da4('0xd')];var _0x754992=_0x228c98[_0x6da4('0xe')]({'plain':!![]});if(_0x754992[_0x6da4('0xf')][_0x6da4('0x10')]()==='in'||_0x754992[_0x6da4('0xf')][_0x6da4('0x10')]()===_0x6da4('0x11')&&!_0x754992[_0x6da4('0x12')]&&!_[_0x6da4('0x13')](_0x754992['UserId'])&&!_[_0x6da4('0x13')](_0x754992[_0x6da4('0x14')])){_0x518847[_0x6da4('0x15')][_0x6da4('0x16')]({'where':{'id':_0x754992[_0x6da4('0x14')]}})[_0x6da4('0x17')](function(_0x49cbda){if(_0x49cbda){_0x49cbda[_0x6da4('0x18')]({'lastMsgAt':_0x754992['createdAt'],'lastMsgDirection':_0x754992['direction']['toLowerCase']()});}})['catch'](function(_0x671789){console[_0x6da4('0x19')](_0x671789);});}if(_0x754992[_0x6da4('0xf')]==='out'&&!_0x754992[_0x6da4('0x12')]){var _0x497791;_0x518847[_0x6da4('0x1a')][_0x6da4('0x1b')]({'where':{'id':_0x754992['SmsAccountId']},'raw':!![]})[_0x6da4('0x17')](function(_0x4e5bb6){_0x497791=_0x4e5bb6;if(_0x497791&&_0x497791['type']){switch(_0x497791['type']){case _0x6da4('0x1c'):var _0x149b34=require(_0x6da4('0x1c'));if(_0x497791[_0x6da4('0x1d')]&&_0x497791[_0x6da4('0x1e')]&&_0x497791[_0x6da4('0x1f')]){var _0x20e0e6=new _0x149b34(_0x497791[_0x6da4('0x1d')],_0x497791[_0x6da4('0x1e')]);_0x20e0e6[_0x6da4('0x20')]['create']({'body':_0x754992[_0x6da4('0xb')],'to':_0x754992[_0x6da4('0x1f')],'from':_0x497791['phone'],'statusCallback':_0x497791['remote']+_0x6da4('0x21')+_0x754992['id']+'/status?token='+_0x497791['token']})[_0x6da4('0x17')](function(_0x55d48d){if(_0x55d48d[_0x6da4('0x22')]){return _0x228c98['update']({'messageId':_0x55d48d['sid']});}})[_0x6da4('0x23')](function(_0x22a958){logger[_0x6da4('0x19')](_0x6da4('0x24'),_0x6da4('0x25'),_0x6da4('0x1c'),util['inspect'](_0x22a958,{'showHidden':![],'depth':null}));});}else{logger[_0x6da4('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6da4('0x25'),_0x6da4('0x1c'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x6da4('0x26'):var _0x2914c9=_0x6da4('0x27');if(_0x497791[_0x6da4('0x28')]&&_0x497791['password']){var _0x3e520e={'recipient':[_0x754992[_0x6da4('0x1f')]],'message':_0x754992[_0x6da4('0xb')],'message_type':_0x497791[_0x6da4('0x29')]};if(_0x497791[_0x6da4('0x29')]&&_0x497791[_0x6da4('0x29')]!=='SI'){_0x3e520e[_0x6da4('0x2a')]=_0x497791[_0x6da4('0x1f')];}var _0x345f70={'url':_0x2914c9+_0x6da4('0x2b')+_0x497791[_0x6da4('0x28')]+_0x6da4('0x2c')+_0x497791[_0x6da4('0x2d')],'method':_0x6da4('0x2e')};rp(_0x345f70)[_0x6da4('0x17')](function(_0x15b0be){var _0x3bb5e1=_0x15b0be[_0x6da4('0x2f')](';');var _0x2f6f17={'user_key':_0x3bb5e1[0x0],'session_key':_0x3bb5e1[0x1]};_0x345f70={'url':_0x2914c9+_0x6da4('0x30'),'method':_0x6da4('0x31'),'headers':{'user_key':_0x2f6f17['user_key'],'Session_key':_0x2f6f17[_0x6da4('0x32')]},'json':!![],'body':_0x3e520e};return rp(_0x345f70);})[_0x6da4('0x17')](function(_0x232f8f){if(_0x232f8f[_0x6da4('0x33')]>=0x1){var _0x2ddeb3={'messageId':_0x232f8f[_0x6da4('0x34')]};if(_0x497791[_0x6da4('0x29')]!=='GP'||!_0x497791[_0x6da4('0x35')]){_0x2ddeb3[_0x6da4('0x36')]=!![];}return _0x228c98[_0x6da4('0x18')](_0x2ddeb3);}else{return logger[_0x6da4('0x19')](_0x6da4('0x24'),_0x6da4('0x25'),_0x6da4('0x26'),util[_0x6da4('0x37')](_0x232f8f,{'showHidden':![],'depth':null}));}})[_0x6da4('0x23')](function(_0x8aa736){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6da4('0x25'),_0x6da4('0x26'),util[_0x6da4('0x37')](_0x8aa736,{'showHidden':![],'depth':null}));});}else{logger[_0x6da4('0x19')](_0x6da4('0x24'),_0x6da4('0x25'),_0x6da4('0x26'),_0x6da4('0x38'));}break;case _0x6da4('0x39'):if(_0x497791['authToken']){var _0x2771fd={'recipient':_0x754992['phone'],'message':_0x754992[_0x6da4('0xb')],'sender':_0x497791[_0x6da4('0x3a')]||_0x497791[_0x6da4('0x1f')],'authorization':_0x497791[_0x6da4('0x1e')]};var _0x5b31e8={'method':_0x6da4('0x31'),'uri':_0x6da4('0x3b'),'body':_0x2771fd,'json':!![]};rp(_0x5b31e8)[_0x6da4('0x17')](function(_0x2d1cfa){var _0x60b94a={'messageId':_0x2d1cfa['requestid']};if(!_0x497791['deliveryReport']){_0x60b94a[_0x6da4('0x36')]=!![];}return _0x228c98[_0x6da4('0x18')](_0x60b94a);})['catch'](function(_0x410887){logger[_0x6da4('0x19')](_0x6da4('0x24'),_0x6da4('0x25'),_0x6da4('0x39'),util[_0x6da4('0x37')](_0x410887,{'showHidden':![],'depth':null}));});}else{logger[_0x6da4('0x19')](_0x6da4('0x24'),'afterCreate',_0x6da4('0x39'),_0x6da4('0x3c'));}break;case'clicksend':if(_0x497791[_0x6da4('0x28')]&&_0x497791[_0x6da4('0x2d')]){var _0x2771fd={'messages':[{'source':_0x6da4('0x3d'),'to':_0x754992[_0x6da4('0x1f')],'body':_0x754992['body'],'from':_0x497791['senderString']||_0x497791[_0x6da4('0x1f')]}]};var _0x11fe7a=util[_0x6da4('0x3e')](_0x6da4('0x3f'),_0x497791[_0x6da4('0x28')],_0x497791[_0x6da4('0x2d')]);var _0x5b31e8={'method':'POST','uri':_0x6da4('0x40'),'body':_0x2771fd,'headers':{'Authorization':util[_0x6da4('0x3e')](_0x6da4('0x41'),new Buffer(_0x11fe7a)[_0x6da4('0x42')](_0x6da4('0x43')))},'json':!![]};rp(_0x5b31e8)[_0x6da4('0x17')](function(_0x331fc9){if(_0x331fc9['http_code']>=0xc8&&_0x331fc9[_0x6da4('0x44')]<=0xce){if(_0x331fc9[_0x6da4('0x45')]&&_0x331fc9[_0x6da4('0x45')]['queued_count']>0x0){var _0xc1636=_[_0x6da4('0x46')](_0x331fc9['data'][_0x6da4('0x20')]);var _0x5f26c7={'messageId':_0xc1636[_0x6da4('0x47')]};if(!_0x497791[_0x6da4('0x35')]){_0x5f26c7[_0x6da4('0x36')]=!![];}return _0x228c98[_0x6da4('0x18')](_0x5f26c7);}else{logger[_0x6da4('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6da4('0x25'),'clickSend',util['inspect'](_0x331fc9,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x6da4('0x24'),_0x6da4('0x25'),'clickSend',util[_0x6da4('0x37')](_0x331fc9,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2a38c7){logger[_0x6da4('0x19')](_0x6da4('0x24'),_0x6da4('0x25'),_0x6da4('0x48'),util[_0x6da4('0x37')](_0x2a38c7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6da4('0x24'),_0x6da4('0x25'),_0x6da4('0x48'),_0x6da4('0x38'));}break;case _0x6da4('0x49'):if(_0x497791['authId']&&_0x497791[_0x6da4('0x1e')]){var _0x2771fd={'dst':_0x754992[_0x6da4('0x1f')],'text':_0x754992[_0x6da4('0xb')],'src':_0x497791[_0x6da4('0x3a')]||_0x497791[_0x6da4('0x1f')],'url':_0x497791[_0x6da4('0x4a')]+_0x6da4('0x21')+_0x754992['id']+_0x6da4('0x4b')+_0x497791[_0x6da4('0x4c')]};var _0x11fe7a=util[_0x6da4('0x3e')](_0x6da4('0x3f'),_0x497791[_0x6da4('0x4d')],_0x497791['authToken']);var _0x5b31e8={'method':_0x6da4('0x31'),'uri':util[_0x6da4('0x3e')]('https://api.plivo.com/v1/Account/%s/Message/',_0x497791['authId']),'body':_0x2771fd,'headers':{'Authorization':util[_0x6da4('0x3e')](_0x6da4('0x41'),new Buffer(_0x11fe7a)['toString'](_0x6da4('0x43')))},'json':!![]};rp(_0x5b31e8)[_0x6da4('0x17')](function(_0x1585c1){var _0x66ef74={'messageId':_0x1585c1[_0x6da4('0x4e')][0x0]};return _0x228c98[_0x6da4('0x18')](_0x66ef74);})['catch'](function(_0x562499){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6da4('0x25'),_0x6da4('0x49'),util[_0x6da4('0x37')](_0x562499,{'showHidden':![],'depth':null}));});}else{logger[_0x6da4('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6da4('0x25'),_0x6da4('0x49'),_0x6da4('0x4f'));}break;case _0x6da4('0x50'):if(_0x497791[_0x6da4('0x28')]&&_0x497791[_0x6da4('0x2d')]){if(_0x497791[_0x6da4('0x51')]){var _0x12ede9={'method':_0x6da4('0x31'),'uri':_0x497791['baseUrl']+_0x6da4('0x52'),'body':{'username':_0x497791[_0x6da4('0x28')],'password':_0x497791['password']},'json':!![]};return rp(_0x12ede9)[_0x6da4('0x17')](function(_0x5c1276){var _0x4fbdb7={'method':_0x6da4('0x31'),'uri':_0x497791[_0x6da4('0x51')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x497791[_0x6da4('0x1f')],'destinations':[{'to':_0x754992[_0x6da4('0x1f')]}],'text':_0x754992['body'],'notifyUrl':_0x497791[_0x6da4('0x4a')]+_0x6da4('0x21')+_0x754992['id']+'/status?token='+_0x497791['token'],'notifyContentType':_0x6da4('0x53'),'callbackData':_0x497791['phone']+';'+_0x754992[_0x6da4('0xb')]}]},'headers':{'Authorization':_0x6da4('0x54')+_0x5c1276['token']},'json':!![]};return rp(_0x4fbdb7)[_0x6da4('0x17')](function(_0x3ece27){if(_0x3ece27[_0x6da4('0x20')]){var _0x56ca6d={'messageId':_0x3ece27[_0x6da4('0x20')][0x0][_0x6da4('0x55')]};if(!_0x497791['deliveryReport']){_0x56ca6d[_0x6da4('0x36')]=!![];}return _0x228c98['update'](_0x56ca6d);}else{return logger[_0x6da4('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6da4('0x25'),_0x6da4('0x50'),util['inspect'](_0x3ece27,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x4af150){return logger[_0x6da4('0x19')](_0x6da4('0x24'),_0x6da4('0x25'),_0x6da4('0x50'),util[_0x6da4('0x37')](_0x4af150,{'showHidden':![],'depth':null}));});}else{logger[_0x6da4('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6da4('0x25'),_0x6da4('0x50'),_0x6da4('0x56'));}}else{logger[_0x6da4('0x19')](_0x6da4('0x24'),_0x6da4('0x25'),_0x6da4('0x50'),_0x6da4('0x38'));}break;case'csc':var _0x142774=require(_0x6da4('0x57'));if(_0x497791[_0x6da4('0x58')]){var _0x3a1b56={};_0x3a1b56[_0x6da4('0x59')]=_0x497791['username'];_0x3a1b56['phone']=_0x754992[_0x6da4('0x1f')];_0x3a1b56[_0x6da4('0x2a')]=_0x497791[_0x6da4('0x1f')];_0x3a1b56[_0x6da4('0x5a')]=_0x754992[_0x6da4('0xb')];_0x3a1b56['timestamp']=+new Date();var _0xe24ea7='';var _0x191c67='';var _0x5ee252=Object[_0x6da4('0x5b')](_0x3a1b56);_0x5ee252[_0x6da4('0x5c')]();for(var _0x46a26d=0x0;_0x46a26d<_0x5ee252[_0x6da4('0x5d')];_0x46a26d++){if(_0xe24ea7!=''){_0xe24ea7+='&';}_0xe24ea7+=_0x5ee252[_0x46a26d]+'='+encodeURIComponent(_0x3a1b56[_0x5ee252[_0x46a26d]]);_0x191c67+=_0x3a1b56[_0x5ee252[_0x46a26d]];}_0x191c67+=_0x497791[_0x6da4('0x58')];_0x191c67=_0x142774['createHash'](_0x6da4('0x5e'))[_0x6da4('0x18')](_0x191c67)['digest']('hex');if(_0xe24ea7!==''){_0xe24ea7+='&';}_0xe24ea7+=_0x6da4('0x5f')+_0x191c67;var _0x345f70={'method':_0x6da4('0x2e'),'uri':_0x497791['baseUrl']+_0x6da4('0x60')+_0xe24ea7,'json':!![]};return rp(_0x345f70)['then'](function(_0x5bc54d){var _0x16e483=Object[_0x6da4('0x5b')](_0x5bc54d);if(_0x5bc54d[_0x16e483[0x0]][_0x6da4('0x19')]&&parseInt(_0x5bc54d[_0x16e483[0x0]][_0x6da4('0x19')])===0x0){var _0x1b63c0={'messageId':_0x5bc54d[_0x16e483[0x0]][_0x6da4('0x61')]};if(!_0x497791[_0x6da4('0x35')]){_0x1b63c0['read']=!![];}return _0x228c98[_0x6da4('0x18')](_0x1b63c0);}else{return logger['error'](_0x6da4('0x24'),_0x6da4('0x25'),_0x6da4('0x62'),util[_0x6da4('0x37')](_0x5bc54d[_0x6da4('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1195de){return logger[_0x6da4('0x19')](_0x6da4('0x24'),_0x6da4('0x25'),'csc',util[_0x6da4('0x37')](_0x1195de,{'showHidden':![],'depth':null}));});}else{logger[_0x6da4('0x19')](_0x6da4('0x24'),'afterCreate','csc','Missing\x20parameters:\x20apiKey');}break;case _0x6da4('0x63'):if(_0x497791[_0x6da4('0x58')]){var _0x3f2199={'method':_0x6da4('0x31'),'uri':_0x6da4('0x64'),'headers':{'Authorization':_0x497791['apiKey']},'body':{'content':_0x754992[_0x6da4('0xb')],'to':[_0x754992[_0x6da4('0x1f')]],'from':_0x497791[_0x6da4('0x1f')],'binary':![],'clientMessageId':_0x6da4('0x65'),'charset':_0x6da4('0x66')},'json':!![]};rp(_0x3f2199)[_0x6da4('0x17')](function(_0x4136c9){if(!_0x4136c9[_0x6da4('0x19')]){var _0x306da4={'messageId':_0x4136c9[_0x6da4('0x20')][0x0]['apiMessageId']};if(!_0x497791[_0x6da4('0x35')]){_0x306da4[_0x6da4('0x36')]=!![];}return _0x228c98['update'](_0x306da4);}else{return logger[_0x6da4('0x19')](_0x6da4('0x24'),_0x6da4('0x25'),'clickatell',util[_0x6da4('0x37')](_0x4136c9[_0x6da4('0x19')],{'showHidden':![],'depth':null}));}})[_0x6da4('0x23')](function(_0x4a9a81){return logger[_0x6da4('0x19')](_0x6da4('0x24'),'afterCreate',_0x6da4('0x63'),util['inspect'](_0x4a9a81,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6da4('0x24'),_0x6da4('0x25'),_0x6da4('0x63'),'Missing\x20parameters:\x20apiKey');}break;case _0x6da4('0x67'):if(_0x497791[_0x6da4('0x28')]&&_0x497791['password']){var _0x11fe7a=util['format'](_0x6da4('0x3f'),_0x497791[_0x6da4('0x28')],_0x497791[_0x6da4('0x2d')]);var _0x5b31e8={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x497791[_0x6da4('0x68')]+'/messages','body':{'to':[_0x754992['phone']],'text':_0x754992[_0x6da4('0xb')],'from':_0x497791[_0x6da4('0x1f')],'applicationId':_0x497791[_0x6da4('0x69')]},'headers':{'Authorization':util[_0x6da4('0x3e')]('Basic\x20%s',new Buffer(_0x11fe7a)['toString'](_0x6da4('0x43')))},'json':!![]};rp(_0x5b31e8)['then'](function(_0x1756bc){if(_0x1756bc['id']){var _0x546b36={'messageId':_0x1756bc['id']};return _0x228c98[_0x6da4('0x18')](_0x546b36);}else{logger[_0x6da4('0x19')](_0x6da4('0x24'),_0x6da4('0x25'),_0x6da4('0x67'),util[_0x6da4('0x37')](_0x1756bc,{'showHidden':![],'depth':null}));}})[_0x6da4('0x23')](function(_0x5b5ff9){logger[_0x6da4('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6da4('0x25'),'bandwidth',util['inspect'](_0x5b5ff9,{'showHidden':![],'depth':null}));});}else{logger[_0x6da4('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6da4('0x67'),_0x6da4('0x38'));}break;case _0x6da4('0x6a'):if(_0x497791[_0x6da4('0x58')]){var _0x38d7cd={};var _0x345f70={'method':'POST','uri':_0x6da4('0x6b'),'headers':{'Authorization':'Bearer\x20'+_0x497791[_0x6da4('0x58')],'Content-Type':_0x6da4('0x53')},'body':{'from':_0x497791[_0x6da4('0x1f')],'to':_0x754992[_0x6da4('0x1f')],'text':_0x754992[_0x6da4('0xb')]},'json':!![]};return rp(_0x345f70)['then'](function(_0x3315a7){if(_0x3315a7[_0x6da4('0x6c')]==0xca){_0x38d7cd['message']=_0x3315a7;var _0x2e8536={'method':_0x6da4('0x31'),'uri':_0x6da4('0x6d'),'headers':{'Authorization':_0x6da4('0x6e')+_0x497791[_0x6da4('0x58')],'Content-Type':_0x6da4('0x53')},'body':{'refid':_0x38d7cd['message'][_0x6da4('0x6f')]},'json':!![]};return rp(_0x2e8536)[_0x6da4('0x17')](function(_0x384d69){_0x38d7cd['status']=_0x384d69;var _0xe5de34={'messageId':_0x38d7cd[_0x6da4('0x70')][_0x6da4('0x6f')],'read':!![]};return _0x228c98['update'](_0xe5de34);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6da4('0x6a'),util['inspect'](_0x3315a7,{'showHidden':![],'depth':null}));}})[_0x6da4('0x23')](function(_0x26f44a){return logger[_0x6da4('0x19')](_0x6da4('0x24'),_0x6da4('0x25'),_0x6da4('0x6a'),util[_0x6da4('0x37')](_0x26f44a,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6da4('0x25'),_0x6da4('0x6a'),_0x6da4('0x71'));}break;}}})[_0x6da4('0x72')](function(){_0x5843ca();});}else{_0x5843ca();}}},'charset':_0x6da4('0x73'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x86f3=['./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','create','body','phone','remote','/api/sms/messages/','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','username','xCALLY\x20Motion','format','Basic\x20%s','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','toString','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/status?token=','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','timestamp','keys','sort','length','createHash','md5','digest','hex','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','Missing\x20parameters:\x20apiKey','bandwidth','%s:%s','accountId','intelepeer','Bearer\x20','code','message','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4d45b4,_0x361f7){var _0x1a6a97=function(_0x5a4310){while(--_0x5a4310){_0x4d45b4['push'](_0x4d45b4['shift']());}};_0x1a6a97(++_0x361f7);}(_0x86f3,0x178));var _0x386f=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x86f3[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x386f('0x0'));var util=require('util');var logger=require(_0x386f('0x1'))(_0x386f('0x2'));var moment=require('moment');var BPromise=require(_0x386f('0x3'));var rp=require(_0x386f('0x4'));var fs=require('fs');var path=require(_0x386f('0x5'));var rimraf=require(_0x386f('0x6'));var config=require(_0x386f('0x7'));var attributes=require(_0x386f('0x8'));module[_0x386f('0x9')]=function(_0x8c20b5,_0x271a38){return _0x8c20b5[_0x386f('0xa')]('SmsMessage',attributes,{'tableName':_0x386f('0xb'),'paranoid':![],'indexes':[{'name':_0x386f('0xc'),'fields':[_0x386f('0xc')]},{'name':_0x386f('0xd'),'fields':['body'],'type':_0x386f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f0a04,_0x3cd042,_0x41988b){var _0x56341b=_0x8c20b5[_0x386f('0xf')];var _0x102b0c=_0x3f0a04[_0x386f('0x10')]({'plain':!![]});if(_0x102b0c[_0x386f('0x11')][_0x386f('0x12')]()==='in'||_0x102b0c[_0x386f('0x11')][_0x386f('0x12')]()===_0x386f('0x13')&&!_0x102b0c[_0x386f('0x14')]&&!_[_0x386f('0x15')](_0x102b0c[_0x386f('0x16')])&&!_['isNil'](_0x102b0c[_0x386f('0x17')])){_0x56341b[_0x386f('0x18')]['findOne']({'where':{'id':_0x102b0c[_0x386f('0x17')]}})['then'](function(_0x23e217){if(_0x23e217){_0x23e217[_0x386f('0x19')]({'lastMsgAt':_0x102b0c[_0x386f('0x1a')],'lastMsgDirection':_0x102b0c[_0x386f('0x11')][_0x386f('0x12')]()});}})[_0x386f('0x1b')](function(_0x39205d){console[_0x386f('0x1c')](_0x39205d);});}if(_0x102b0c[_0x386f('0x11')]===_0x386f('0x13')&&!_0x102b0c['secret']){var _0x3ab2f4;_0x56341b[_0x386f('0x1d')][_0x386f('0x1e')]({'where':{'id':_0x102b0c[_0x386f('0x1f')]},'raw':!![]})[_0x386f('0x20')](function(_0x203a95){_0x3ab2f4=_0x203a95;if(_0x3ab2f4&&_0x3ab2f4[_0x386f('0x21')]){switch(_0x3ab2f4[_0x386f('0x21')]){case _0x386f('0x22'):var _0x510673=require(_0x386f('0x22'));if(_0x3ab2f4[_0x386f('0x23')]&&_0x3ab2f4[_0x386f('0x24')]&&_0x3ab2f4['phone']){var _0x45d1dc=new _0x510673(_0x3ab2f4[_0x386f('0x23')],_0x3ab2f4['authToken']);_0x45d1dc['messages'][_0x386f('0x25')]({'body':_0x102b0c[_0x386f('0x26')],'to':_0x102b0c[_0x386f('0x27')],'from':_0x3ab2f4[_0x386f('0x27')],'statusCallback':_0x3ab2f4[_0x386f('0x28')]+_0x386f('0x29')+_0x102b0c['id']+'/status?token='+_0x3ab2f4['token']})[_0x386f('0x20')](function(_0x54d35a){if(_0x54d35a[_0x386f('0x2a')]){return _0x3f0a04[_0x386f('0x19')]({'messageId':_0x54d35a[_0x386f('0x2a')]});}})[_0x386f('0x1b')](function(_0x3b70a9){logger[_0x386f('0x1c')](_0x386f('0x2b'),'afterCreate',_0x386f('0x22'),util[_0x386f('0x2c')](_0x3b70a9,{'showHidden':![],'depth':null}));});}else{logger[_0x386f('0x1c')](_0x386f('0x2b'),_0x386f('0x2d'),'twilio',_0x386f('0x2e'));}break;case _0x386f('0x2f'):var _0x5f4142=_0x386f('0x30');if(_0x3ab2f4['username']&&_0x3ab2f4[_0x386f('0x31')]){var _0x5b7468={'recipient':[_0x102b0c['phone']],'message':_0x102b0c['body'],'message_type':_0x3ab2f4['smsMethod']};if(_0x3ab2f4['smsMethod']&&_0x3ab2f4[_0x386f('0x32')]!=='SI'){_0x5b7468[_0x386f('0x33')]=_0x3ab2f4[_0x386f('0x27')];}var _0x13ff69={'url':_0x5f4142+_0x386f('0x34')+_0x3ab2f4['username']+'&password='+_0x3ab2f4[_0x386f('0x31')],'method':_0x386f('0x35')};rp(_0x13ff69)[_0x386f('0x20')](function(_0x1af73c){var _0x2392e=_0x1af73c[_0x386f('0x36')](';');var _0x28c13e={'user_key':_0x2392e[0x0],'session_key':_0x2392e[0x1]};_0x13ff69={'url':_0x5f4142+_0x386f('0x37'),'method':_0x386f('0x38'),'headers':{'user_key':_0x28c13e[_0x386f('0x39')],'Session_key':_0x28c13e[_0x386f('0x3a')]},'json':!![],'body':_0x5b7468};return rp(_0x13ff69);})[_0x386f('0x20')](function(_0x497307){if(_0x497307[_0x386f('0x3b')]>=0x1){var _0x471468={'messageId':_0x497307[_0x386f('0x3c')]};if(_0x3ab2f4[_0x386f('0x32')]!=='GP'||!_0x3ab2f4[_0x386f('0x3d')]){_0x471468[_0x386f('0x3e')]=!![];}return _0x3f0a04['update'](_0x471468);}else{return logger[_0x386f('0x1c')](_0x386f('0x2b'),_0x386f('0x2d'),_0x386f('0x2f'),util[_0x386f('0x2c')](_0x497307,{'showHidden':![],'depth':null}));}})[_0x386f('0x1b')](function(_0x5adc05){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x386f('0x2f'),util[_0x386f('0x2c')](_0x5adc05,{'showHidden':![],'depth':null}));});}else{logger[_0x386f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x386f('0x2d'),_0x386f('0x2f'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x3ab2f4[_0x386f('0x24')]){var _0x2bc8={'recipient':_0x102b0c[_0x386f('0x27')],'message':_0x102b0c[_0x386f('0x26')],'sender':_0x3ab2f4[_0x386f('0x3f')]||_0x3ab2f4['phone'],'authorization':_0x3ab2f4[_0x386f('0x24')]};var _0x3cd042={'method':_0x386f('0x38'),'uri':_0x386f('0x40'),'body':_0x2bc8,'json':!![]};rp(_0x3cd042)['then'](function(_0x41610c){var _0x1aed50={'messageId':_0x41610c[_0x386f('0x41')]};if(!_0x3ab2f4[_0x386f('0x3d')]){_0x1aed50[_0x386f('0x3e')]=!![];}return _0x3f0a04['update'](_0x1aed50);})[_0x386f('0x1b')](function(_0x40cec6){logger[_0x386f('0x1c')](_0x386f('0x2b'),'afterCreate','connectel',util[_0x386f('0x2c')](_0x40cec6,{'showHidden':![],'depth':null}));});}else{logger[_0x386f('0x1c')](_0x386f('0x2b'),'afterCreate',_0x386f('0x42'),_0x386f('0x43'));}break;case _0x386f('0x44'):if(_0x3ab2f4[_0x386f('0x45')]&&_0x3ab2f4[_0x386f('0x31')]){var _0x2bc8={'messages':[{'source':_0x386f('0x46'),'to':_0x102b0c[_0x386f('0x27')],'body':_0x102b0c['body'],'from':_0x3ab2f4['senderString']||_0x3ab2f4['phone']}]};var _0x14b108=util[_0x386f('0x47')]('%s:%s',_0x3ab2f4[_0x386f('0x45')],_0x3ab2f4[_0x386f('0x31')]);var _0x3cd042={'method':_0x386f('0x38'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x2bc8,'headers':{'Authorization':util[_0x386f('0x47')](_0x386f('0x48'),new Buffer(_0x14b108)['toString']('base64'))},'json':!![]};rp(_0x3cd042)[_0x386f('0x20')](function(_0x3126bf){if(_0x3126bf['http_code']>=0xc8&&_0x3126bf[_0x386f('0x49')]<=0xce){if(_0x3126bf['data']&&_0x3126bf[_0x386f('0x4a')][_0x386f('0x4b')]>0x0){var _0xa4077e=_[_0x386f('0x4c')](_0x3126bf[_0x386f('0x4a')]['messages']);var _0x2f5169={'messageId':_0xa4077e[_0x386f('0x4d')]};if(!_0x3ab2f4[_0x386f('0x3d')]){_0x2f5169[_0x386f('0x3e')]=!![];}return _0x3f0a04[_0x386f('0x19')](_0x2f5169);}else{logger[_0x386f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x386f('0x2d'),_0x386f('0x4e'),util['inspect'](_0x3126bf,{'showHidden':![],'depth':null}));}}else{logger[_0x386f('0x1c')](_0x386f('0x2b'),_0x386f('0x2d'),_0x386f('0x4e'),util[_0x386f('0x2c')](_0x3126bf,{'showHidden':![],'depth':null}));}})['catch'](function(_0x20b4fc){logger[_0x386f('0x1c')](_0x386f('0x2b'),_0x386f('0x2d'),'clickSend',util[_0x386f('0x2c')](_0x20b4fc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x386f('0x2b'),_0x386f('0x2d'),_0x386f('0x4e'),_0x386f('0x4f'));}break;case _0x386f('0x50'):if(_0x3ab2f4[_0x386f('0x51')]&&_0x3ab2f4[_0x386f('0x24')]){var _0x2bc8={'dst':_0x102b0c['phone'],'text':_0x102b0c[_0x386f('0x26')],'src':_0x3ab2f4['senderString']||_0x3ab2f4[_0x386f('0x27')],'url':_0x3ab2f4[_0x386f('0x28')]+_0x386f('0x29')+_0x102b0c['id']+'/status?token='+_0x3ab2f4[_0x386f('0x52')]};var _0x14b108=util['format']('%s:%s',_0x3ab2f4[_0x386f('0x51')],_0x3ab2f4['authToken']);var _0x3cd042={'method':_0x386f('0x38'),'uri':util[_0x386f('0x47')](_0x386f('0x53'),_0x3ab2f4['authId']),'body':_0x2bc8,'headers':{'Authorization':util[_0x386f('0x47')]('Basic\x20%s',new Buffer(_0x14b108)[_0x386f('0x54')](_0x386f('0x55')))},'json':!![]};rp(_0x3cd042)[_0x386f('0x20')](function(_0x1d9517){var _0xada172={'messageId':_0x1d9517[_0x386f('0x56')][0x0]};return _0x3f0a04[_0x386f('0x19')](_0xada172);})['catch'](function(_0x318918){logger['error'](_0x386f('0x2b'),_0x386f('0x2d'),_0x386f('0x50'),util[_0x386f('0x2c')](_0x318918,{'showHidden':![],'depth':null}));});}else{logger[_0x386f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x386f('0x2d'),_0x386f('0x50'),_0x386f('0x57'));}break;case _0x386f('0x58'):if(_0x3ab2f4['username']&&_0x3ab2f4['password']){if(_0x3ab2f4[_0x386f('0x59')]){var _0x43fa21={'method':_0x386f('0x38'),'uri':_0x3ab2f4['baseUrl']+_0x386f('0x5a'),'body':{'username':_0x3ab2f4[_0x386f('0x45')],'password':_0x3ab2f4[_0x386f('0x31')]},'json':!![]};return rp(_0x43fa21)['then'](function(_0x1057a0){var _0x114ae5={'method':_0x386f('0x38'),'uri':_0x3ab2f4['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3ab2f4[_0x386f('0x27')],'destinations':[{'to':_0x102b0c[_0x386f('0x27')]}],'text':_0x102b0c['body'],'notifyUrl':_0x3ab2f4[_0x386f('0x28')]+_0x386f('0x29')+_0x102b0c['id']+_0x386f('0x5b')+_0x3ab2f4['token'],'notifyContentType':_0x386f('0x5c'),'callbackData':_0x3ab2f4[_0x386f('0x27')]+';'+_0x102b0c[_0x386f('0x26')]}]},'headers':{'Authorization':_0x386f('0x5d')+_0x1057a0[_0x386f('0x52')]},'json':!![]};return rp(_0x114ae5)[_0x386f('0x20')](function(_0x575ae6){if(_0x575ae6[_0x386f('0x5e')]){var _0x2344ed={'messageId':_0x575ae6[_0x386f('0x5e')][0x0]['messageId']};if(!_0x3ab2f4[_0x386f('0x3d')]){_0x2344ed[_0x386f('0x3e')]=!![];}return _0x3f0a04['update'](_0x2344ed);}else{return logger['error'](_0x386f('0x2b'),_0x386f('0x2d'),'infobip',util[_0x386f('0x2c')](_0x575ae6,{'showHidden':![],'depth':null}));}});})[_0x386f('0x1b')](function(_0x301fea){return logger[_0x386f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x386f('0x58'),util[_0x386f('0x2c')](_0x301fea,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x386f('0x2b'),_0x386f('0x2d'),_0x386f('0x58'),_0x386f('0x5f'));}}else{logger['error'](_0x386f('0x2b'),'afterCreate',_0x386f('0x58'),_0x386f('0x4f'));}break;case _0x386f('0x60'):var _0x50dfe8=require(_0x386f('0x61'));if(_0x3ab2f4[_0x386f('0x62')]){var _0x8bf092={};_0x8bf092['login']=_0x3ab2f4[_0x386f('0x45')];_0x8bf092[_0x386f('0x27')]=_0x102b0c[_0x386f('0x27')];_0x8bf092[_0x386f('0x33')]=_0x3ab2f4['phone'];_0x8bf092[_0x386f('0x63')]=_0x102b0c[_0x386f('0x26')];_0x8bf092[_0x386f('0x64')]=+new Date();var _0x123107='';var _0x5e9e30='';var _0x420c91=Object[_0x386f('0x65')](_0x8bf092);_0x420c91[_0x386f('0x66')]();for(var _0x47d6d7=0x0;_0x47d6d7<_0x420c91[_0x386f('0x67')];_0x47d6d7++){if(_0x123107!=''){_0x123107+='&';}_0x123107+=_0x420c91[_0x47d6d7]+'='+encodeURIComponent(_0x8bf092[_0x420c91[_0x47d6d7]]);_0x5e9e30+=_0x8bf092[_0x420c91[_0x47d6d7]];}_0x5e9e30+=_0x3ab2f4['apiKey'];_0x5e9e30=_0x50dfe8[_0x386f('0x68')](_0x386f('0x69'))[_0x386f('0x19')](_0x5e9e30)[_0x386f('0x6a')](_0x386f('0x6b'));if(_0x123107!==''){_0x123107+='&';}_0x123107+='signature='+_0x5e9e30;var _0x13ff69={'method':_0x386f('0x35'),'uri':_0x3ab2f4['baseUrl']+_0x386f('0x6c')+_0x123107,'json':!![]};return rp(_0x13ff69)[_0x386f('0x20')](function(_0x5e3168){var _0x492ae3=Object[_0x386f('0x65')](_0x5e3168);if(_0x5e3168[_0x492ae3[0x0]][_0x386f('0x1c')]&&parseInt(_0x5e3168[_0x492ae3[0x0]][_0x386f('0x1c')])===0x0){var _0x3de429={'messageId':_0x5e3168[_0x492ae3[0x0]][_0x386f('0x6d')]};if(!_0x3ab2f4[_0x386f('0x3d')]){_0x3de429[_0x386f('0x3e')]=!![];}return _0x3f0a04['update'](_0x3de429);}else{return logger[_0x386f('0x1c')](_0x386f('0x2b'),_0x386f('0x2d'),_0x386f('0x60'),util['inspect'](_0x5e3168[_0x386f('0x1c')],{'showHidden':![],'depth':null}));}})[_0x386f('0x1b')](function(_0x11d18b){return logger[_0x386f('0x1c')](_0x386f('0x2b'),_0x386f('0x2d'),'csc',util[_0x386f('0x2c')](_0x11d18b,{'showHidden':![],'depth':null}));});}else{logger[_0x386f('0x1c')](_0x386f('0x2b'),_0x386f('0x2d'),_0x386f('0x60'),'Missing\x20parameters:\x20apiKey');}break;case _0x386f('0x6e'):if(_0x3ab2f4[_0x386f('0x62')]){var _0x537a46={'method':_0x386f('0x38'),'uri':_0x386f('0x6f'),'headers':{'Authorization':_0x3ab2f4['apiKey']},'body':{'content':_0x102b0c['body'],'to':[_0x102b0c[_0x386f('0x27')]],'from':_0x3ab2f4['phone'],'binary':![],'clientMessageId':_0x386f('0x70'),'charset':_0x386f('0x71')},'json':!![]};rp(_0x537a46)[_0x386f('0x20')](function(_0x1e55df){if(!_0x1e55df[_0x386f('0x1c')]){var _0x497e5a={'messageId':_0x1e55df[_0x386f('0x5e')][0x0]['apiMessageId']};if(!_0x3ab2f4[_0x386f('0x3d')]){_0x497e5a[_0x386f('0x3e')]=!![];}return _0x3f0a04[_0x386f('0x19')](_0x497e5a);}else{return logger[_0x386f('0x1c')](_0x386f('0x2b'),_0x386f('0x2d'),_0x386f('0x6e'),util[_0x386f('0x2c')](_0x1e55df[_0x386f('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3e46b6){return logger[_0x386f('0x1c')](_0x386f('0x2b'),_0x386f('0x2d'),_0x386f('0x6e'),util['inspect'](_0x3e46b6,{'showHidden':![],'depth':null}));});}else{logger[_0x386f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x386f('0x2d'),_0x386f('0x6e'),_0x386f('0x72'));}break;case _0x386f('0x73'):if(_0x3ab2f4[_0x386f('0x45')]&&_0x3ab2f4['password']){var _0x14b108=util[_0x386f('0x47')](_0x386f('0x74'),_0x3ab2f4[_0x386f('0x45')],_0x3ab2f4[_0x386f('0x31')]);var _0x3cd042={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x3ab2f4[_0x386f('0x75')]+'/messages','body':{'to':[_0x102b0c['phone']],'text':_0x102b0c[_0x386f('0x26')],'from':_0x3ab2f4['phone'],'applicationId':_0x3ab2f4['applicationId']},'headers':{'Authorization':util[_0x386f('0x47')](_0x386f('0x48'),new Buffer(_0x14b108)['toString'](_0x386f('0x55')))},'json':!![]};rp(_0x3cd042)[_0x386f('0x20')](function(_0x94fd92){if(_0x94fd92['id']){var _0x474632={'messageId':_0x94fd92['id']};return _0x3f0a04['update'](_0x474632);}else{logger[_0x386f('0x1c')](_0x386f('0x2b'),_0x386f('0x2d'),'bandwidth',util[_0x386f('0x2c')](_0x94fd92,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3a4298){logger[_0x386f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x386f('0x2d'),'bandwidth',util[_0x386f('0x2c')](_0x3a4298,{'showHidden':![],'depth':null}));});}else{logger[_0x386f('0x1c')](_0x386f('0x2b'),_0x386f('0x2d'),'bandwidth',_0x386f('0x4f'));}break;case _0x386f('0x76'):if(_0x3ab2f4[_0x386f('0x62')]){var _0x1258e1={};var _0x13ff69={'method':_0x386f('0x38'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x386f('0x77')+_0x3ab2f4[_0x386f('0x62')],'Content-Type':_0x386f('0x5c')},'body':{'from':_0x3ab2f4[_0x386f('0x27')],'to':_0x102b0c[_0x386f('0x27')],'text':_0x102b0c['body']},'json':!![]};return rp(_0x13ff69)[_0x386f('0x20')](function(_0x196960){if(_0x196960[_0x386f('0x78')]==0xca){_0x1258e1[_0x386f('0x79')]=_0x196960;var _0x135e0e={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x3ab2f4[_0x386f('0x62')],'Content-Type':_0x386f('0x5c')},'body':{'refid':_0x1258e1[_0x386f('0x79')]['refid']},'json':!![]};return rp(_0x135e0e)['then'](function(_0x4133b6){_0x1258e1[_0x386f('0x7a')]=_0x4133b6;var _0xda9d53={'messageId':_0x1258e1[_0x386f('0x79')][_0x386f('0x7b')],'read':!![]};return _0x3f0a04[_0x386f('0x19')](_0xda9d53);});}else{return logger[_0x386f('0x1c')](_0x386f('0x2b'),_0x386f('0x2d'),_0x386f('0x76'),util['inspect'](_0x196960,{'showHidden':![],'depth':null}));}})[_0x386f('0x1b')](function(_0x1fb76f){return logger[_0x386f('0x1c')](_0x386f('0x2b'),_0x386f('0x2d'),_0x386f('0x76'),util[_0x386f('0x2c')](_0x1fb76f,{'showHidden':![],'depth':null}));});}else{return logger[_0x386f('0x1c')](_0x386f('0x2b'),_0x386f('0x2d'),_0x386f('0x76'),_0x386f('0x7c'));}break;}}})[_0x386f('0x7d')](function(){_0x41988b();});}else{_0x41988b();}}},'charset':_0x386f('0x7e'),'collate':_0x386f('0x7f')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 093624e..15c26c3 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 _0x2385=['rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','SmsMessage','create','body','options','raw','CreateSmsMessage','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2385,0xa3));var _0x5238=function(_0x407c55,_0x4ccd72){_0x407c55=_0x407c55-0x0;var _0x45a451=_0x2385[_0x407c55];return _0x45a451;};'use strict';var _=require('lodash');var util=require(_0x5238('0x0'));var moment=require(_0x5238('0x1'));var BPromise=require(_0x5238('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5238('0x3'));var db=require(_0x5238('0x4'))['db'];var utils=require(_0x5238('0x5'));var logger=require(_0x5238('0x6'))(_0x5238('0x7'));var config=require('../../config/environment');var jayson=require(_0x5238('0x8'));var client=jayson[_0x5238('0x9')][_0x5238('0xa')]({'port':0x232a});config[_0x5238('0xb')]=_[_0x5238('0xc')](config[_0x5238('0xb')],{'host':_0x5238('0xd'),'port':0x18eb});var socket=require(_0x5238('0xe'))(new Redis(config[_0x5238('0xb')]));require(_0x5238('0xf'))[_0x5238('0x10')](socket);function respondWithRpcPromise(_0x1e9343,_0x7759b0,_0x54cc22){return new BPromise(function(_0x3f62ef,_0x52b827){return client['request'](_0x1e9343,_0x54cc22)[_0x5238('0x11')](function(_0x426e5d){logger[_0x5238('0x12')](_0x5238('0x13'),_0x7759b0,'request\x20sent');logger[_0x5238('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7759b0,_0x5238('0x15'),JSON[_0x5238('0x16')](_0x426e5d));if(_0x426e5d[_0x5238('0x17')]){if(_0x426e5d['error'][_0x5238('0x18')]===0x1f4){logger[_0x5238('0x17')](_0x5238('0x13'),_0x7759b0,_0x426e5d['error'][_0x5238('0x19')]);return _0x52b827(_0x426e5d[_0x5238('0x17')][_0x5238('0x19')]);}logger[_0x5238('0x17')]('SmsMessage,\x20%s,\x20%s',_0x7759b0,_0x426e5d['error'][_0x5238('0x19')]);return _0x3f62ef(_0x426e5d[_0x5238('0x17')][_0x5238('0x19')]);}else{logger['info'](_0x5238('0x13'),_0x7759b0,'request\x20sent');_0x3f62ef(_0x426e5d[_0x5238('0x1a')]['message']);}})['catch'](function(_0x955ef0){logger['error']('SmsMessage,\x20%s,\x20%s',_0x7759b0,_0x955ef0);_0x52b827(_0x955ef0);});});}exports['CreateSmsMessage']=function(_0x5ac174){var _0x3e47d2=this;return new Promise(function(_0x2b6750,_0x3f734c){return db[_0x5238('0x1b')][_0x5238('0x1c')](_0x5ac174[_0x5238('0x1d')],{'raw':_0x5ac174[_0x5238('0x1e')]?_0x5ac174[_0x5238('0x1e')][_0x5238('0x1f')]===undefined?!![]:![]:!![]})[_0x5238('0x11')](function(_0x106f77){logger[_0x5238('0x12')](_0x5238('0x20'),_0x5ac174);logger['debug']('CreateSmsMessage',_0x5ac174,JSON[_0x5238('0x16')](_0x106f77));_0x2b6750(_0x106f77);})[_0x5238('0x21')](function(_0x5e1c7c){logger[_0x5238('0x17')](_0x5238('0x20'),_0x5e1c7c[_0x5238('0x19')],_0x5ac174);_0x3f734c(_0x3e47d2[_0x5238('0x17')](0x1f4,_0x5e1c7c[_0x5238('0x19')]));});});}; \ No newline at end of file +var _0x5685=['SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSmsMessage','SmsMessage','create','body','options','stringify','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xb1619,_0x257054){var _0x4eaf8e=function(_0xdbc5c4){while(--_0xdbc5c4){_0xb1619['push'](_0xb1619['shift']());}};_0x4eaf8e(++_0x257054);}(_0x5685,0x10b));var _0x5568=function(_0x2446dc,_0x4b4e9f){_0x2446dc=_0x2446dc-0x0;var _0xe2a997=_0x5685[_0x2446dc];return _0xe2a997;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5568('0x0'));var BPromise=require(_0x5568('0x1'));var rs=require(_0x5568('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5568('0x3'))['db'];var utils=require(_0x5568('0x4'));var logger=require(_0x5568('0x5'))(_0x5568('0x6'));var config=require(_0x5568('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5568('0x8')][_0x5568('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5568('0xa')],{'host':_0x5568('0xb'),'port':0x18eb});var socket=require(_0x5568('0xc'))(new Redis(config['redis']));require(_0x5568('0xd'))[_0x5568('0xe')](socket);function respondWithRpcPromise(_0x40843b,_0x50c169,_0xa2e8d8){return new BPromise(function(_0x53c0ad,_0x5ad3ce){return client[_0x5568('0xf')](_0x40843b,_0xa2e8d8)[_0x5568('0x10')](function(_0x2a49e7){logger[_0x5568('0x11')](_0x5568('0x12'),_0x50c169,_0x5568('0x13'));logger[_0x5568('0x14')](_0x5568('0x15'),_0x50c169,_0x5568('0x13'),JSON['stringify'](_0x2a49e7));if(_0x2a49e7[_0x5568('0x16')]){if(_0x2a49e7[_0x5568('0x16')][_0x5568('0x17')]===0x1f4){logger[_0x5568('0x16')](_0x5568('0x12'),_0x50c169,_0x2a49e7[_0x5568('0x16')][_0x5568('0x18')]);return _0x5ad3ce(_0x2a49e7['error'][_0x5568('0x18')]);}logger[_0x5568('0x16')](_0x5568('0x12'),_0x50c169,_0x2a49e7[_0x5568('0x16')][_0x5568('0x18')]);return _0x53c0ad(_0x2a49e7[_0x5568('0x16')][_0x5568('0x18')]);}else{logger[_0x5568('0x11')](_0x5568('0x12'),_0x50c169,_0x5568('0x13'));_0x53c0ad(_0x2a49e7[_0x5568('0x19')]['message']);}})['catch'](function(_0x1be9dc){logger[_0x5568('0x16')]('SmsMessage,\x20%s,\x20%s',_0x50c169,_0x1be9dc);_0x5ad3ce(_0x1be9dc);});});}exports[_0x5568('0x1a')]=function(_0x207017){var _0x190802=this;return new Promise(function(_0x1df4f6,_0x35019e){return db[_0x5568('0x1b')][_0x5568('0x1c')](_0x207017[_0x5568('0x1d')],{'raw':_0x207017[_0x5568('0x1e')]?_0x207017[_0x5568('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x5568('0x10')](function(_0x3ecb5a){logger['info'](_0x5568('0x1a'),_0x207017);logger[_0x5568('0x14')](_0x5568('0x1a'),_0x207017,JSON[_0x5568('0x1f')](_0x3ecb5a));_0x1df4f6(_0x3ecb5a);})['catch'](function(_0x4ff228){logger[_0x5568('0x16')](_0x5568('0x1a'),_0x4ff228['message'],_0x207017);_0x35019e(_0x190802[_0x5568('0x16')](0x1f4,_0x4ff228[_0x5568('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 96a1826..44d95e5 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 _0x53de=['smsMessage:','./smsMessage.events','save','remove','emit','removeListener'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0x53de,0x127));var _0xe53d=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0x53de[_0x38b2d9];return _0x23a3e1;};'use strict';var SmsMessageEvents=require(_0xe53d('0x0'));var events=[_0xe53d('0x1'),_0xe53d('0x2'),'update'];function createListener(_0x31a59b,_0x3a7023){return function(_0x23ab83){_0x3a7023[_0xe53d('0x3')](_0x31a59b,_0x23ab83);};}function removeListener(_0x35fc62,_0x165d7a){return function(){SmsMessageEvents[_0xe53d('0x4')](_0x35fc62,_0x165d7a);};}exports['register']=function(_0x46bfb3){for(var _0x33b173=0x0,_0x24e66f=events['length'];_0x33b173<_0x24e66f;_0x33b173++){var _0x481eb3=events[_0x33b173];var _0x73772=createListener(_0xe53d('0x5')+_0x481eb3,_0x46bfb3);SmsMessageEvents['on'](_0x481eb3,_0x73772);}}; \ No newline at end of file +var _0xd414=['smsMessage:','remove','update','emit','removeListener','length'];(function(_0x1af8c5,_0x5d31b0){var _0x16b9f4=function(_0xd0b9d0){while(--_0xd0b9d0){_0x1af8c5['push'](_0x1af8c5['shift']());}};_0x16b9f4(++_0x5d31b0);}(_0xd414,0xa3));var _0x4d41=function(_0x207798,_0x4bc10e){_0x207798=_0x207798-0x0;var _0x123be4=_0xd414[_0x207798];return _0x123be4;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0x4d41('0x0'),_0x4d41('0x1')];function createListener(_0x32692b,_0x31d7d3){return function(_0x5ce8d1){_0x31d7d3[_0x4d41('0x2')](_0x32692b,_0x5ce8d1);};}function removeListener(_0x5c7a1b,_0x2f01de){return function(){SmsMessageEvents[_0x4d41('0x3')](_0x5c7a1b,_0x2f01de);};}exports['register']=function(_0x8525c1){for(var _0x38cc8c=0x0,_0x261cd9=events[_0x4d41('0x4')];_0x38cc8c<_0x261cd9;_0x38cc8c++){var _0x501a66=events[_0x38cc8c];var _0x58ef4e=createListener(_0x4d41('0x5')+_0x501a66,_0x8525c1);SmsMessageEvents['on'](_0x501a66,_0x58ef4e);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 3fd004c..747cc62 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 _0x2a87=['../../components/auth/service','./smsQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','update','removeTeams','delete','removeAgents','exports','util','path','express','Router','fs-extra'];(function(_0x477491,_0x5ca700){var _0xac6aec=function(_0x180568){while(--_0x180568){_0x477491['push'](_0x477491['shift']());}};_0xac6aec(++_0x5ca700);}(_0x2a87,0x175));var _0x72a8=function(_0x404b9a,_0xca0480){_0x404b9a=_0x404b9a-0x0;var _0x30ba61=_0x2a87[_0x404b9a];return _0x30ba61;};'use strict';var multer=require('multer');var util=require(_0x72a8('0x0'));var path=require(_0x72a8('0x1'));var timeout=require('connect-timeout');var express=require(_0x72a8('0x2'));var router=express[_0x72a8('0x3')]();var fs_extra=require(_0x72a8('0x4'));var auth=require(_0x72a8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x72a8('0x6'));router[_0x72a8('0x7')]('/',auth[_0x72a8('0x8')](),controller[_0x72a8('0x9')]);router[_0x72a8('0x7')](_0x72a8('0xa'),auth[_0x72a8('0x8')](),controller['describe']);router['get'](_0x72a8('0xb'),auth[_0x72a8('0x8')](),controller['show']);router['get'](_0x72a8('0xc'),auth[_0x72a8('0x8')](),controller[_0x72a8('0xd')]);router[_0x72a8('0x7')](_0x72a8('0xe'),auth[_0x72a8('0x8')](),controller[_0x72a8('0xf')]);router['get'](_0x72a8('0x10'),auth[_0x72a8('0x8')](),controller[_0x72a8('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x72a8('0x12')]);router[_0x72a8('0x13')](_0x72a8('0xe'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x72a8('0x10'),auth['isAuthenticated'](),controller[_0x72a8('0x14')]);router[_0x72a8('0x15')](_0x72a8('0xb'),auth[_0x72a8('0x8')](),controller[_0x72a8('0x16')]);router['delete'](_0x72a8('0xb'),auth[_0x72a8('0x8')](),controller['destroy']);router['delete']('/:id/teams',auth[_0x72a8('0x8')](),controller[_0x72a8('0x17')]);router[_0x72a8('0x18')]('/:id/users',auth[_0x72a8('0x8')](),controller[_0x72a8('0x19')]);module[_0x72a8('0x1a')]=router; \ No newline at end of file +var _0xca25=['/:id/users','addAgents','put','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','post','addTeams'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xca25,0x13c));var _0x5ca2=function(_0x51a182,_0x5639a7){_0x51a182=_0x51a182-0x0;var _0x46aa3e=_0xca25[_0x51a182];return _0x46aa3e;};'use strict';var multer=require(_0x5ca2('0x0'));var util=require(_0x5ca2('0x1'));var path=require(_0x5ca2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5ca2('0x3'));var auth=require(_0x5ca2('0x4'));var interaction=require(_0x5ca2('0x5'));var config=require(_0x5ca2('0x6'));var controller=require('./smsQueue.controller');router[_0x5ca2('0x7')]('/',auth[_0x5ca2('0x8')](),controller[_0x5ca2('0x9')]);router[_0x5ca2('0x7')](_0x5ca2('0xa'),auth['isAuthenticated'](),controller[_0x5ca2('0xb')]);router[_0x5ca2('0x7')](_0x5ca2('0xc'),auth[_0x5ca2('0x8')](),controller[_0x5ca2('0xd')]);router[_0x5ca2('0x7')](_0x5ca2('0xe'),auth[_0x5ca2('0x8')](),controller['getMembers']);router[_0x5ca2('0x7')](_0x5ca2('0xf'),auth[_0x5ca2('0x8')](),controller[_0x5ca2('0x10')]);router['get']('/:id/users',auth[_0x5ca2('0x8')](),controller[_0x5ca2('0x11')]);router[_0x5ca2('0x12')]('/',auth[_0x5ca2('0x8')](),controller['create']);router['post'](_0x5ca2('0xf'),auth[_0x5ca2('0x8')](),controller[_0x5ca2('0x13')]);router[_0x5ca2('0x12')](_0x5ca2('0x14'),auth[_0x5ca2('0x8')](),controller[_0x5ca2('0x15')]);router[_0x5ca2('0x16')](_0x5ca2('0xc'),auth[_0x5ca2('0x8')](),controller['update']);router['delete']('/:id',auth[_0x5ca2('0x8')](),controller[_0x5ca2('0x17')]);router[_0x5ca2('0x18')](_0x5ca2('0xf'),auth[_0x5ca2('0x8')](),controller[_0x5ca2('0x19')]);router[_0x5ca2('0x18')](_0x5ca2('0x14'),auth[_0x5ca2('0x8')](),controller[_0x5ca2('0x1a')]);module[_0x5ca2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 4710c72..8eb8698 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 _0x819a=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','name','STRING'];(function(_0x11b8e0,_0x53cd41){var _0x24594e=function(_0x258764){while(--_0x258764){_0x11b8e0['push'](_0x11b8e0['shift']());}};_0x24594e(++_0x53cd41);}(_0x819a,0xad));var _0xa819=function(_0x6289ef,_0x1490c1){_0x6289ef=_0x6289ef-0x0;var _0x4f83a0=_0x819a[_0x6289ef];return _0x4f83a0;};'use strict';var Sequelize=require('sequelize');module[_0xa819('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa819('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa819('0x2')]},'timeout':{'type':Sequelize[_0xa819('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa819('0x4')](_0xa819('0x5'),_0xa819('0x6'),_0xa819('0x7'))}}; \ No newline at end of file +var _0x4e19=['sequelize','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x3aa96e,_0x387501){var _0x492a1f=function(_0x3dd318){while(--_0x3dd318){_0x3aa96e['push'](_0x3aa96e['shift']());}};_0x492a1f(++_0x387501);}(_0x4e19,0x170));var _0x94e1=function(_0x3be8e8,_0x246a8f){_0x3be8e8=_0x3be8e8-0x0;var _0x5f7c64=_0x4e19[_0x3be8e8];return _0x5f7c64;};'use strict';var Sequelize=require(_0x94e1('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x94e1('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x94e1('0x2')]},'timeout':{'type':Sequelize[_0x94e1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x94e1('0x4')](_0x94e1('0x5'),_0x94e1('0x6'),_0x94e1('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 4dbeaf8..1b64b24 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 _0x8254=['all','value','transaction','removeTeams','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','spread','userSmsQueue:save','getAgents','User','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','error','stack','name','index','SmsQueue','fieldName','type','key','map','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserSmsQueue','SmsQueueId','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','each','emit','select','tq.TeamId','join','user_has_teams','SmsQueueId\x20=\x20?','push','QueryTypes','SELECT','every'];(function(_0x57b236,_0x30614e){var _0x4feb29=function(_0x26d3e6){while(--_0x26d3e6){_0x57b236['push'](_0x57b236['shift']());}};_0x4feb29(++_0x30614e);}(_0x8254,0x95));var _0x4825=function(_0x3098a9,_0x583bbd){_0x3098a9=_0x3098a9-0x0;var _0x16775a=_0x8254[_0x3098a9];return _0x16775a;};'use strict';var emlformat=require(_0x4825('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4825('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4825('0x2'));var moment=require(_0x4825('0x3'));var BPromise=require(_0x4825('0x4'));var Mustache=require('mustache');var util=require(_0x4825('0x5'));var path=require(_0x4825('0x6'));var sox=require(_0x4825('0x7'));var csv=require(_0x4825('0x8'));var ejs=require(_0x4825('0x9'));var fs=require('fs');var fs_extra=require(_0x4825('0xa'));var _=require('lodash');var squel=require(_0x4825('0xb'));var crypto=require(_0x4825('0xc'));var jsforce=require(_0x4825('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4825('0x8'));var querystring=require(_0x4825('0xe'));var Papa=require(_0x4825('0xf'));var Redis=require(_0x4825('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4825('0x11'));var as=require(_0x4825('0x12'));var hardwareService=require(_0x4825('0x13'));var logger=require('../../config/logger')(_0x4825('0x14'));var utils=require(_0x4825('0x15'));var config=require(_0x4825('0x16'));var licenseUtil=require(_0x4825('0x17'));var db=require(_0x4825('0x18'))['db'];config['redis']=_[_0x4825('0x19')](config[_0x4825('0x1a')],{'host':_0x4825('0x1b'),'port':0x18eb});var socket=require(_0x4825('0x1c'))(new Redis(config[_0x4825('0x1a')]));require(_0x4825('0x1d'))[_0x4825('0x1e')](socket);function respondWithStatusCode(_0x1c903c,_0x7ac2e2){_0x7ac2e2=_0x7ac2e2||0xcc;return function(_0x483d0e){if(_0x483d0e){return _0x1c903c[_0x4825('0x1f')](_0x7ac2e2);}return _0x1c903c[_0x4825('0x20')](_0x7ac2e2)[_0x4825('0x21')]();};}function respondWithResult(_0x29628e,_0x5b63d0){_0x5b63d0=_0x5b63d0||0xc8;return function(_0x52101e){if(_0x52101e){return _0x29628e['status'](_0x5b63d0)[_0x4825('0x22')](_0x52101e);}};}function respondWithFilteredResult(_0x18e8d7,_0x160eb1){return function(_0xfe92ce){if(_0xfe92ce){var _0x23709e=typeof _0x160eb1[_0x4825('0x23')]===_0x4825('0x24')&&typeof _0x160eb1[_0x4825('0x25')]==='undefined';var _0x2c2ddc=_0xfe92ce[_0x4825('0x26')];var _0xdf1083=_0x23709e?0x0:_0x160eb1[_0x4825('0x23')];var _0x1acbf7=_0x23709e?_0xfe92ce[_0x4825('0x26')]:_0x160eb1[_0x4825('0x23')]+_0x160eb1[_0x4825('0x25')];var _0x147b7c;if(_0x1acbf7>=_0x2c2ddc){_0x1acbf7=_0x2c2ddc;_0x147b7c=0xc8;}else{_0x147b7c=0xce;}_0x18e8d7[_0x4825('0x20')](_0x147b7c);return _0x18e8d7[_0x4825('0x27')](_0x4825('0x28'),_0xdf1083+'-'+_0x1acbf7+'/'+_0x2c2ddc)['json'](_0xfe92ce);}return null;};}function patchUpdates(_0x53b6cd){return function(_0x45a011){try{jsonpatch[_0x4825('0x29')](_0x45a011,_0x53b6cd,!![]);}catch(_0x3c9813){return BPromise[_0x4825('0x2a')](_0x3c9813);}return _0x45a011[_0x4825('0x2b')]();};}function saveUpdates(_0x185d41,_0x2a6890){return function(_0xb9c7cc){if(_0xb9c7cc){return _0xb9c7cc['update'](_0x185d41)[_0x4825('0x2c')](function(_0x5027d6){return _0x5027d6;});}return null;};}function removeEntity(_0x5032f2,_0x5585c7){return function(_0x44e4ab){if(_0x44e4ab){return _0x44e4ab[_0x4825('0x2d')]()[_0x4825('0x2c')](function(){var _0x2bd2be=_0x44e4ab[_0x4825('0x2e')]({'plain':!![]});var _0x1779f5='SmsQueues';return db['UserProfileResource'][_0x4825('0x2d')]({'where':{'type':_0x1779f5,'resourceId':_0x2bd2be['id']}})['then'](function(){return _0x44e4ab;});})[_0x4825('0x2c')](function(){_0x5032f2[_0x4825('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3344d8,_0x460b18){return function(_0x553691){if(!_0x553691){_0x3344d8['sendStatus'](0x194);}return _0x553691;};}function handleError(_0xcf0b22,_0x5af837){_0x5af837=_0x5af837||0x1f4;return function(_0xfb37ed){logger[_0x4825('0x2f')](_0xfb37ed[_0x4825('0x30')]);if(_0xfb37ed[_0x4825('0x31')]){delete _0xfb37ed[_0x4825('0x31')];}_0xcf0b22[_0x4825('0x20')](_0x5af837)['send'](_0xfb37ed);};}exports[_0x4825('0x32')]=function(_0x4de89e,_0x3377ed){var _0x464180={},_0x22aa67={},_0x4c7cbc={'count':0x0,'rows':[]};var _0x501e00=_['map'](db[_0x4825('0x33')]['rawAttributes'],function(_0x5ee0cf){return{'name':_0x5ee0cf[_0x4825('0x34')],'type':_0x5ee0cf[_0x4825('0x35')][_0x4825('0x36')]};});_0x22aa67['model']=_[_0x4825('0x37')](_0x501e00,_0x4825('0x31'));_0x22aa67[_0x4825('0x38')]=_[_0x4825('0x39')](_0x4de89e[_0x4825('0x38')]);_0x22aa67[_0x4825('0x3a')]=_['intersection'](_0x22aa67['model'],_0x22aa67[_0x4825('0x38')]);_0x464180[_0x4825('0x3b')]=_['intersection'](_0x22aa67[_0x4825('0x3c')],qs['fields'](_0x4de89e[_0x4825('0x38')][_0x4825('0x3d')]));_0x464180[_0x4825('0x3b')]=_0x464180['attributes'][_0x4825('0x3e')]?_0x464180[_0x4825('0x3b')]:_0x22aa67[_0x4825('0x3c')];if(!_0x4de89e['query'][_0x4825('0x3f')](_0x4825('0x40'))){_0x464180['limit']=qs[_0x4825('0x25')](_0x4de89e[_0x4825('0x38')][_0x4825('0x25')]);_0x464180[_0x4825('0x23')]=qs[_0x4825('0x23')](_0x4de89e[_0x4825('0x38')][_0x4825('0x23')]);}_0x464180[_0x4825('0x41')]=qs[_0x4825('0x42')](_0x4de89e[_0x4825('0x38')][_0x4825('0x42')]);_0x464180[_0x4825('0x43')]=qs[_0x4825('0x3a')](_[_0x4825('0x44')](_0x4de89e[_0x4825('0x38')],_0x22aa67[_0x4825('0x3a')]),_0x501e00);if(_0x4de89e[_0x4825('0x38')][_0x4825('0x45')]){_0x464180[_0x4825('0x43')]=_[_0x4825('0x46')](_0x464180[_0x4825('0x43')],{'$or':_[_0x4825('0x37')](_0x501e00,function(_0x46a0c8){if(_0x46a0c8[_0x4825('0x35')]!==_0x4825('0x47')){var _0xbbd5f0={};_0xbbd5f0[_0x46a0c8[_0x4825('0x31')]]={'$like':'%'+_0x4de89e[_0x4825('0x38')][_0x4825('0x45')]+'%'};return _0xbbd5f0;}})});}_0x464180=_[_0x4825('0x46')]({},_0x464180,_0x4de89e[_0x4825('0x48')]);var _0x116362={'where':_0x464180[_0x4825('0x43')]};return db[_0x4825('0x33')]['count'](_0x116362)['then'](function(_0x37c53a){_0x4c7cbc[_0x4825('0x26')]=_0x37c53a;if(_0x4de89e[_0x4825('0x38')][_0x4825('0x49')]){_0x464180['include']=[{'all':!![]}];}return db['SmsQueue'][_0x4825('0x4a')](_0x464180);})[_0x4825('0x2c')](function(_0xb480f){_0x4c7cbc[_0x4825('0x4b')]=_0xb480f;return _0x4c7cbc;})[_0x4825('0x2c')](respondWithFilteredResult(_0x3377ed,_0x464180))[_0x4825('0x4c')](handleError(_0x3377ed,null));};exports[_0x4825('0x4d')]=function(_0x1603aa,_0x5074dd){var _0x9bcd6a={'raw':!![],'where':{'id':_0x1603aa[_0x4825('0x4e')]['id']}},_0x3e3b60={};_0x3e3b60[_0x4825('0x3c')]=_['keys'](db['SmsQueue'][_0x4825('0x4f')]);_0x3e3b60[_0x4825('0x38')]=_['keys'](_0x1603aa['query']);_0x3e3b60[_0x4825('0x3a')]=_[_0x4825('0x50')](_0x3e3b60[_0x4825('0x3c')],_0x3e3b60[_0x4825('0x38')]);_0x9bcd6a[_0x4825('0x3b')]=_['intersection'](_0x3e3b60[_0x4825('0x3c')],qs[_0x4825('0x3d')](_0x1603aa[_0x4825('0x38')][_0x4825('0x3d')]));_0x9bcd6a[_0x4825('0x3b')]=_0x9bcd6a[_0x4825('0x3b')][_0x4825('0x3e')]?_0x9bcd6a['attributes']:_0x3e3b60[_0x4825('0x3c')];if(_0x1603aa[_0x4825('0x38')][_0x4825('0x49')]){_0x9bcd6a['include']=[{'all':!![]}];}_0x9bcd6a=_['merge']({},_0x9bcd6a,_0x1603aa['options']);return db[_0x4825('0x33')][_0x4825('0x51')](_0x9bcd6a)[_0x4825('0x2c')](handleEntityNotFound(_0x5074dd,null))[_0x4825('0x2c')](respondWithResult(_0x5074dd,null))['catch'](handleError(_0x5074dd,null));};exports['create']=function(_0x84358a,_0x31cdde){return db[_0x4825('0x33')][_0x4825('0x52')](_0x84358a[_0x4825('0x53')],{})[_0x4825('0x2c')](function(_0x3c93eb){var _0x4fa7b3=_0x84358a[_0x4825('0x54')][_0x4825('0x2e')]({'plain':!![]});if(!_0x4fa7b3)throw new Error(_0x4825('0x55'));if(_0x4fa7b3['role']===_0x4825('0x54')){var _0x299ece=_0x3c93eb[_0x4825('0x2e')]({'plain':!![]});var _0x337d63='SmsQueues';return db[_0x4825('0x56')][_0x4825('0x51')]({'where':{'name':_0x337d63,'userProfileId':_0x4fa7b3[_0x4825('0x57')]},'raw':!![]})[_0x4825('0x2c')](function(_0x40c42c){if(_0x40c42c&&_0x40c42c['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x299ece['name'],'resourceId':_0x299ece['id'],'type':_0x40c42c[_0x4825('0x31')],'sectionId':_0x40c42c['id']},{})[_0x4825('0x2c')](function(){return _0x3c93eb;});}else{return _0x3c93eb;}})[_0x4825('0x4c')](function(_0x1dbe4a){logger[_0x4825('0x2f')](_0x4825('0x58'),_0x1dbe4a);throw _0x1dbe4a;});}return _0x3c93eb;})['then'](respondWithResult(_0x31cdde,0xc9))[_0x4825('0x4c')](handleError(_0x31cdde,null));};exports[_0x4825('0x59')]=function(_0x19d21c,_0x26123e){if(_0x19d21c[_0x4825('0x53')]['id']){delete _0x19d21c['body']['id'];}return db[_0x4825('0x33')][_0x4825('0x51')]({'where':{'id':_0x19d21c['params']['id']}})[_0x4825('0x2c')](handleEntityNotFound(_0x26123e,null))[_0x4825('0x2c')](saveUpdates(_0x19d21c[_0x4825('0x53')],null))[_0x4825('0x2c')](respondWithResult(_0x26123e,null))['catch'](handleError(_0x26123e,null));};exports[_0x4825('0x2d')]=function(_0x385a34,_0x32a202){return db[_0x4825('0x33')]['find']({'where':{'id':_0x385a34[_0x4825('0x4e')]['id']}})[_0x4825('0x2c')](handleEntityNotFound(_0x32a202,null))[_0x4825('0x2c')](removeEntity(_0x32a202,null))[_0x4825('0x4c')](handleError(_0x32a202,null));};exports['describe']=function(_0x44278b,_0x402178){return db['SmsQueue'][_0x4825('0x5a')]()[_0x4825('0x2c')](respondWithResult(_0x402178,null))[_0x4825('0x4c')](handleError(_0x402178,null));};exports['getMembers']=function(_0x5c108f,_0x2fb766,_0x165777){var _0x584bf0={'raw':!![],'where':{}},_0x431266={},_0x31aec7;return db[_0x4825('0x33')][_0x4825('0x5b')]({'where':{'id':_0x5c108f[_0x4825('0x4e')]['id']}})[_0x4825('0x2c')](handleEntityNotFound(_0x2fb766,null))[_0x4825('0x2c')](function(_0x427b9b){if(_0x427b9b){_0x31aec7=_0x427b9b[_0x4825('0x2e')]({'plain':!![]});_0x431266[_0x4825('0x3c')]=_['keys'](db[_0x4825('0x5c')]['rawAttributes']);_0x431266['query']=_[_0x4825('0x39')](_0x5c108f[_0x4825('0x38')]);_0x431266[_0x4825('0x3a')]=_[_0x4825('0x50')](_0x431266[_0x4825('0x3c')],_0x431266[_0x4825('0x38')]);_0x584bf0[_0x4825('0x3b')]=_[_0x4825('0x50')](_0x431266[_0x4825('0x3c')],qs[_0x4825('0x3d')](_0x5c108f[_0x4825('0x38')][_0x4825('0x3d')]));_0x584bf0['attributes']=_0x584bf0[_0x4825('0x3b')][_0x4825('0x3e')]?_0x584bf0[_0x4825('0x3b')]:_0x431266[_0x4825('0x3c')];if(!_0x5c108f[_0x4825('0x38')]['hasOwnProperty'](_0x4825('0x40'))){_0x584bf0['limit']=qs[_0x4825('0x25')](_0x5c108f[_0x4825('0x38')][_0x4825('0x25')]);_0x584bf0[_0x4825('0x23')]=qs[_0x4825('0x23')](_0x5c108f[_0x4825('0x38')][_0x4825('0x23')]);}_0x584bf0[_0x4825('0x41')]=qs[_0x4825('0x42')](_0x5c108f[_0x4825('0x38')]['sort']);_0x584bf0['where']=qs[_0x4825('0x3a')](_[_0x4825('0x44')](_0x5c108f[_0x4825('0x38')],_0x431266['filters']));_0x584bf0['where'][_0x4825('0x5d')]=_0x427b9b['id'];if(_0x5c108f[_0x4825('0x38')][_0x4825('0x45')]){_0x584bf0[_0x4825('0x43')]=_['merge'](_0x584bf0[_0x4825('0x43')],{'$or':_['map'](_0x584bf0[_0x4825('0x3b')],function(_0x51ec41){var _0x4a6b1f={};_0x4a6b1f[_0x51ec41]={'$like':'%'+_0x5c108f[_0x4825('0x38')][_0x4825('0x45')]+'%'};return _0x4a6b1f;})});}_0x584bf0=_[_0x4825('0x46')]({},_0x584bf0,_0x5c108f['options']);return db[_0x4825('0x5c')][_0x4825('0x4a')](_0x584bf0);}})['then'](function(_0x5855da){if(_0x5855da){return db['User'][_0x4825('0x5e')]({'where':{'id':_['map'](_0x5855da,_0x4825('0x5f')),'role':_0x4825('0x60')},'attributes':['id',_0x4825('0x31'),_0x4825('0x61'),_0x4825('0x62'),_0x4825('0x63')]});}})[_0x4825('0x2c')](function(_0x145440){if(_0x145440){return{'count':_0x145440[_0x4825('0x26')],'rows':_[_0x4825('0x37')](_0x145440['rows'],function(_0xf5b6c3){return{'membername':_0xf5b6c3['name'],'UserId':_0xf5b6c3['id'],'queue_name':_0x31aec7[_0x4825('0x31')],'SmsQueueId':_0x31aec7['id'],'interface':util[_0x4825('0x64')](_0x4825('0x65'),_0x4825('0x66'),_0xf5b6c3['name']),'penalty':0x0,'paused':_0xf5b6c3[_0x4825('0x61')],'createdAt':_0xf5b6c3[_0x4825('0x63')],'updatedAt':_0xf5b6c3[_0x4825('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4825('0x2c')](respondWithFilteredResult(_0x2fb766,_0x584bf0))[_0x4825('0x4c')](handleError(_0x2fb766,null));};exports['getTeams']=function(_0x12abd0,_0x4d85ed,_0x46e0ee){var _0x2c3849={};var _0x121c14={};var _0x53423d;var _0x5a16a8;return db[_0x4825('0x33')][_0x4825('0x5b')]({'where':{'id':_0x12abd0['params']['id']}})['then'](handleEntityNotFound(_0x4d85ed,null))['then'](function(_0x596a05){if(_0x596a05){_0x53423d=_0x596a05;_0x121c14[_0x4825('0x3c')]=_['keys'](db['Team'][_0x4825('0x4f')]);_0x121c14[_0x4825('0x38')]=_[_0x4825('0x39')](_0x12abd0[_0x4825('0x38')]);_0x121c14[_0x4825('0x3a')]=_['intersection'](_0x121c14[_0x4825('0x3c')],_0x121c14['query']);_0x2c3849[_0x4825('0x3b')]=_['intersection'](_0x121c14[_0x4825('0x3c')],qs[_0x4825('0x3d')](_0x12abd0[_0x4825('0x38')][_0x4825('0x3d')]));_0x2c3849[_0x4825('0x3b')]=_0x2c3849[_0x4825('0x3b')]['length']?_0x2c3849[_0x4825('0x3b')]:_0x121c14[_0x4825('0x3c')];_0x2c3849[_0x4825('0x41')]=qs['sort'](_0x12abd0[_0x4825('0x38')][_0x4825('0x42')]);_0x2c3849[_0x4825('0x43')]=qs[_0x4825('0x3a')](_[_0x4825('0x44')](_0x12abd0[_0x4825('0x38')],_0x121c14['filters']));if(_0x12abd0[_0x4825('0x38')][_0x4825('0x45')]){_0x2c3849['where']=_[_0x4825('0x46')](_0x2c3849[_0x4825('0x43')],{'$or':_[_0x4825('0x37')](_0x2c3849[_0x4825('0x3b')],function(_0x2025a0){var _0x2c48e4={};_0x2c48e4[_0x2025a0]={'$like':'%'+_0x12abd0['query'][_0x4825('0x45')]+'%'};return _0x2c48e4;})});}_0x2c3849=_['merge']({},_0x2c3849,_0x12abd0[_0x4825('0x48')]);return _0x53423d[_0x4825('0x67')](_0x2c3849);}})[_0x4825('0x2c')](function(_0x4f34ce){if(_0x4f34ce){_0x5a16a8=_0x4f34ce[_0x4825('0x3e')];if(!_0x12abd0[_0x4825('0x38')][_0x4825('0x3f')](_0x4825('0x40'))){_0x2c3849[_0x4825('0x25')]=qs[_0x4825('0x25')](_0x12abd0[_0x4825('0x38')][_0x4825('0x25')]);_0x2c3849['offset']=qs['offset'](_0x12abd0[_0x4825('0x38')][_0x4825('0x23')]);}return _0x53423d[_0x4825('0x67')](_0x2c3849);}})[_0x4825('0x2c')](function(_0x44a7a5){if(_0x44a7a5){return _0x44a7a5?{'count':_0x5a16a8,'rows':_0x44a7a5}:null;}})[_0x4825('0x2c')](respondWithResult(_0x4d85ed,null))['catch'](handleError(_0x4d85ed,null));};exports[_0x4825('0x68')]=function(_0x51e687,_0x4c803c,_0x207427){var _0x1128c0=_0x51e687[_0x4825('0x53')][_0x4825('0x69')];return db[_0x4825('0x6a')][_0x4825('0x4a')]({'where':{'id':_0x1128c0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4825('0x6b'),'attributes':['id',_0x4825('0x31'),'online',_0x4825('0x6c'),_0x4825('0x6d')],'raw':!![]}]})[_0x4825('0x2c')](function(_0xc604a9){if(_0xc604a9){var _0x2d98dd=_[_0x4825('0x6e')](_0xc604a9,function(_0x24c83b){var _0x221de7=_0x24c83b['get']({'plain':!![]});return _0x221de7['Agents'];});return db[_0x4825('0x33')][_0x4825('0x51')]({'where':{'id':_0x51e687[_0x4825('0x4e')]['id']}})['then'](function(_0x417168){return db[_0x4825('0x6f')]['transaction'](function(_0x5bd6b4){return _0x417168[_0x4825('0x68')](_0x1128c0,{'transaction':_0x5bd6b4})[_0x4825('0x2c')](function(){return BPromise[_0x4825('0x70')](_0x2d98dd,function(_0x1a1a12){return db[_0x4825('0x5c')]['findOrCreate']({'where':{'UserId':_0x1a1a12['id'],'SmsQueueId':_0x51e687[_0x4825('0x4e')]['id']},'transaction':_0x5bd6b4});});})[_0x4825('0x2c')](function(){_0x2d98dd['forEach'](function(_0x45288a){socket[_0x4825('0x71')]('userSmsQueue:save',{'UserId':_0x45288a['id'],'SmsQueueId':_0x417168['id']});});});});});}})[_0x4825('0x2c')](respondWithStatusCode(_0x4c803c,null))[_0x4825('0x4c')](handleError(_0x4c803c,null));};exports['removeTeams']=function(_0x1c8ce1,_0x51ca6e,_0x10e0b0){return db[_0x4825('0x6a')]['findAll']({'where':{'id':_0x1c8ce1[_0x4825('0x38')][_0x4825('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4825('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x4825('0x2c')](handleEntityNotFound(_0x51ca6e,null))['then'](function(_0x5d7288){var _0x3a90a2=_['map'](_0x5d7288,'id');var _0x234451=[];var _0x109e76=[];var _0x1005ce=squel[_0x4825('0x72')]();_0x1005ce['field'](_0x4825('0x73'))['from']('team_has_sms_queues','tq')[_0x4825('0x74')](_0x4825('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4825('0x43')](_0x4825('0x76'),_0x1c8ce1['params']['id']);for(var _0x11dbbb=0x0;_0x11dbbb<_0x5d7288[_0x4825('0x3e')];_0x11dbbb+=0x1){let _0x581845=_0x5d7288[_0x11dbbb];for(var _0x3bd283=0x0;_0x3bd283<_0x581845[_0x4825('0x6b')][_0x4825('0x3e')];_0x3bd283+=0x1){let _0x23764e=_0x581845[_0x4825('0x6b')][_0x3bd283];var _0x8b11d5=_0x1005ce['clone']();_0x8b11d5[_0x4825('0x43')]('ut.UserId\x20=\x20?',_0x23764e['id']);_0x109e76[_0x4825('0x77')](db[_0x4825('0x6f')][_0x4825('0x38')](_0x8b11d5['toString'](),{'type':db[_0x4825('0x6f')][_0x4825('0x78')][_0x4825('0x79')]})['then'](function(_0x64cf35){if(_0x64cf35[_0x4825('0x3e')]===0x1){return _0x23764e['id'];}else{var _0x428072=_[_0x4825('0x7a')](_[_0x4825('0x37')](_0x64cf35,'TeamId'),function(_0x554c71){return _['includes'](_0x3a90a2,_0x554c71);});if(_0x428072){return _0x23764e['id'];}}}));}}return BPromise[_0x4825('0x7b')](_0x109e76)[_0x4825('0x2c')](function(_0x2d4d6d){_0x234451=_(_0x234451)['union'](_0x2d4d6d)['compact']()[_0x4825('0x7c')]();return db['SmsQueue'][_0x4825('0x51')]({'where':{'id':_0x1c8ce1[_0x4825('0x4e')]['id']}})[_0x4825('0x2c')](function(_0x4e3088){return db['sequelize'][_0x4825('0x7d')](function(_0x246485){return _0x4e3088[_0x4825('0x7e')](_0x1c8ce1[_0x4825('0x38')][_0x4825('0x69')],{'transaction':_0x246485})[_0x4825('0x2c')](function(){if(!_[_0x4825('0x7f')](_0x234451)){return _0x4e3088[_0x4825('0x80')](_0x234451,{'transaction':_0x246485});}})[_0x4825('0x2c')](function(){_0x234451[_0x4825('0x81')](function(_0xf38181){socket[_0x4825('0x71')](_0x4825('0x82'),{'UserId':_0xf38181,'SmsQueueId':_0x4e3088['id']});});});});});});})[_0x4825('0x2c')](respondWithStatusCode(_0x51ca6e,null))[_0x4825('0x4c')](handleError(_0x51ca6e,null));};exports[_0x4825('0x83')]=function(_0x472eef,_0x2b6063,_0x19bbab){return db[_0x4825('0x33')][_0x4825('0x51')]({'where':{'id':_0x472eef['params']['id']}})[_0x4825('0x2c')](handleEntityNotFound(_0x2b6063,null))['then'](function(_0x9ef97d){if(_0x9ef97d){return _0x9ef97d[_0x4825('0x83')](_0x472eef[_0x4825('0x53')]['ids'],_['omit'](_0x472eef[_0x4825('0x53')],[_0x4825('0x69'),'id'])||{})[_0x4825('0x84')](function(_0x148199){for(var _0x2f2060=0x0;_0x2f2060<_0x472eef[_0x4825('0x53')][_0x4825('0x69')][_0x4825('0x3e')];_0x2f2060+=0x1){socket[_0x4825('0x71')](_0x4825('0x85'),{'UserId':Number(_0x472eef['body'][_0x4825('0x69')][_0x2f2060]),'SmsQueueId':Number(_0x472eef['params']['id'])});}return _0x148199;});}})[_0x4825('0x2c')](respondWithResult(_0x2b6063,null))[_0x4825('0x4c')](handleError(_0x2b6063,null));};exports[_0x4825('0x80')]=function(_0x21b850,_0x5b1c9c,_0x16026e){return db[_0x4825('0x33')]['find']({'where':{'id':_0x21b850[_0x4825('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5b1c9c,null))[_0x4825('0x2c')](function(_0x1385a6){if(_0x1385a6){return _0x1385a6['removeAgents'](_0x21b850[_0x4825('0x38')]['ids'])[_0x4825('0x2c')](function(){if(_['isArray'](_0x21b850[_0x4825('0x38')][_0x4825('0x69')])){for(var _0x1d957f=0x0;_0x1d957f<_0x21b850[_0x4825('0x38')][_0x4825('0x69')][_0x4825('0x3e')];_0x1d957f+=0x1){socket[_0x4825('0x71')](_0x4825('0x82'),{'UserId':Number(_0x21b850[_0x4825('0x38')][_0x4825('0x69')][_0x1d957f]),'SmsQueueId':Number(_0x21b850[_0x4825('0x4e')]['id'])});}}else{socket[_0x4825('0x71')]('userSmsQueue:remove',{'UserId':Number(_0x21b850[_0x4825('0x38')][_0x4825('0x69')]),'SmsQueueId':Number(_0x21b850[_0x4825('0x4e')]['id'])});}});}})[_0x4825('0x2c')](respondWithStatusCode(_0x5b1c9c,null))[_0x4825('0x4c')](handleError(_0x5b1c9c,null));};exports[_0x4825('0x86')]=function(_0x1ccb72,_0x53d9c7,_0x31d02e){var _0x435592={};var _0x459121={};var _0x230c21;var _0x2b7a85;return db['SmsQueue'][_0x4825('0x5b')]({'where':{'id':_0x1ccb72[_0x4825('0x4e')]['id']}})['then'](handleEntityNotFound(_0x53d9c7,null))[_0x4825('0x2c')](function(_0x3add1f){if(_0x3add1f){_0x230c21=_0x3add1f;_0x459121[_0x4825('0x3c')]=_[_0x4825('0x39')](db[_0x4825('0x87')][_0x4825('0x4f')]);_0x459121['query']=_[_0x4825('0x39')](_0x1ccb72[_0x4825('0x38')]);_0x459121[_0x4825('0x3a')]=_[_0x4825('0x50')](_0x459121[_0x4825('0x3c')],_0x459121[_0x4825('0x38')]);_0x435592['attributes']=_[_0x4825('0x50')](_0x459121[_0x4825('0x3c')],qs['fields'](_0x1ccb72['query'][_0x4825('0x3d')]));_0x435592[_0x4825('0x3b')]=_0x435592['attributes'][_0x4825('0x3e')]?_0x435592[_0x4825('0x3b')]:_0x459121[_0x4825('0x3c')];_0x435592['order']=qs[_0x4825('0x42')](_0x1ccb72[_0x4825('0x38')][_0x4825('0x42')]);_0x435592[_0x4825('0x43')]=qs[_0x4825('0x3a')](_[_0x4825('0x44')](_0x1ccb72[_0x4825('0x38')],_0x459121[_0x4825('0x3a')]));if(_0x1ccb72[_0x4825('0x38')][_0x4825('0x45')]){_0x435592[_0x4825('0x43')]=_[_0x4825('0x46')](_0x435592[_0x4825('0x43')],{'$or':_[_0x4825('0x37')](_0x435592[_0x4825('0x3b')],function(_0x21c11a){var _0x3a91c7={};_0x3a91c7[_0x21c11a]={'$like':'%'+_0x1ccb72[_0x4825('0x38')][_0x4825('0x45')]+'%'};return _0x3a91c7;})});}_0x435592=_[_0x4825('0x46')]({},_0x435592,_0x1ccb72[_0x4825('0x48')]);return _0x230c21[_0x4825('0x86')](_0x435592);}})[_0x4825('0x2c')](function(_0x3891e9){if(_0x3891e9){_0x2b7a85=_0x3891e9['length'];if(!_0x1ccb72[_0x4825('0x38')][_0x4825('0x3f')]('nolimit')){_0x435592[_0x4825('0x25')]=qs[_0x4825('0x25')](_0x1ccb72[_0x4825('0x38')][_0x4825('0x25')]);_0x435592[_0x4825('0x23')]=qs['offset'](_0x1ccb72[_0x4825('0x38')][_0x4825('0x23')]);}return _0x230c21[_0x4825('0x86')](_0x435592);}})[_0x4825('0x2c')](function(_0x806960){if(_0x806960){return _0x806960?{'count':_0x2b7a85,'rows':_0x806960}:null;}})[_0x4825('0x2c')](respondWithResult(_0x53d9c7,null))[_0x4825('0x4c')](handleError(_0x53d9c7,null));}; \ No newline at end of file +var _0xe29b=['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/license/util','../../mysqldb','redis','socket.io-emitter','./smsQueue.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','SmsQueues','UserProfileResource','end','error','name','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','SmsQueueId','UserSmsQueue','findAll','User','findAndCountAll','UserId','smsPause','updatedAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','ids','isEmpty','addAgents','omit','removeAgents','isArray','userSmsQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs'];(function(_0x262baa,_0x283058){var _0x4f2257=function(_0x2cd1c6){while(--_0x2cd1c6){_0x262baa['push'](_0x262baa['shift']());}};_0x4f2257(++_0x283058);}(_0xe29b,0x81));var _0xbe29=function(_0x2d2d3b,_0x192ab2){_0x2d2d3b=_0x2d2d3b-0x0;var _0xaf8e32=_0xe29b[_0x2d2d3b];return _0xaf8e32;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe29('0x0'));var zipdir=require(_0xbe29('0x1'));var jsonpatch=require(_0xbe29('0x2'));var rp=require(_0xbe29('0x3'));var moment=require(_0xbe29('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbe29('0x5'));var util=require(_0xbe29('0x6'));var path=require(_0xbe29('0x7'));var sox=require('sox');var csv=require(_0xbe29('0x8'));var ejs=require(_0xbe29('0x9'));var fs=require('fs');var fs_extra=require(_0xbe29('0xa'));var _=require(_0xbe29('0xb'));var squel=require(_0xbe29('0xc'));var crypto=require(_0xbe29('0xd'));var jsforce=require(_0xbe29('0xe'));var deskjs=require(_0xbe29('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbe29('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbe29('0x11'));var qs=require(_0xbe29('0x12'));var as=require(_0xbe29('0x13'));var hardwareService=require(_0xbe29('0x14'));var logger=require(_0xbe29('0x15'))(_0xbe29('0x16'));var utils=require(_0xbe29('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbe29('0x18'));var db=require(_0xbe29('0x19'))['db'];config[_0xbe29('0x1a')]=_['defaults'](config[_0xbe29('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xbe29('0x1b'))(new Redis(config['redis']));require(_0xbe29('0x1c'))['register'](socket);function respondWithStatusCode(_0x30da5a,_0x2e349a){_0x2e349a=_0x2e349a||0xcc;return function(_0x25383e){if(_0x25383e){return _0x30da5a[_0xbe29('0x1d')](_0x2e349a);}return _0x30da5a['status'](_0x2e349a)['end']();};}function respondWithResult(_0x24a94c,_0x539aaf){_0x539aaf=_0x539aaf||0xc8;return function(_0xb99198){if(_0xb99198){return _0x24a94c[_0xbe29('0x1e')](_0x539aaf)[_0xbe29('0x1f')](_0xb99198);}};}function respondWithFilteredResult(_0x51e2f2,_0x7745cb){return function(_0xb9fe66){if(_0xb9fe66){var _0x2e97d4=typeof _0x7745cb[_0xbe29('0x20')]===_0xbe29('0x21')&&typeof _0x7745cb[_0xbe29('0x22')]===_0xbe29('0x21');var _0x2b82da=_0xb9fe66[_0xbe29('0x23')];var _0x17487d=_0x2e97d4?0x0:_0x7745cb[_0xbe29('0x20')];var _0x5ef70e=_0x2e97d4?_0xb9fe66[_0xbe29('0x23')]:_0x7745cb[_0xbe29('0x20')]+_0x7745cb['limit'];var _0x304ea6;if(_0x5ef70e>=_0x2b82da){_0x5ef70e=_0x2b82da;_0x304ea6=0xc8;}else{_0x304ea6=0xce;}_0x51e2f2[_0xbe29('0x1e')](_0x304ea6);return _0x51e2f2['set'](_0xbe29('0x24'),_0x17487d+'-'+_0x5ef70e+'/'+_0x2b82da)[_0xbe29('0x1f')](_0xb9fe66);}return null;};}function patchUpdates(_0x2a0057){return function(_0x51e7ca){try{jsonpatch[_0xbe29('0x25')](_0x51e7ca,_0x2a0057,!![]);}catch(_0x318ca2){return BPromise['reject'](_0x318ca2);}return _0x51e7ca[_0xbe29('0x26')]();};}function saveUpdates(_0x755829,_0x52be45){return function(_0x4aee7a){if(_0x4aee7a){return _0x4aee7a[_0xbe29('0x27')](_0x755829)[_0xbe29('0x28')](function(_0x32dfa6){return _0x32dfa6;});}return null;};}function removeEntity(_0x5a2e0a,_0x8df73b){return function(_0x3fafb1){if(_0x3fafb1){return _0x3fafb1[_0xbe29('0x29')]()[_0xbe29('0x28')](function(){var _0x4cfa8d=_0x3fafb1[_0xbe29('0x2a')]({'plain':!![]});var _0x5562b4=_0xbe29('0x2b');return db[_0xbe29('0x2c')][_0xbe29('0x29')]({'where':{'type':_0x5562b4,'resourceId':_0x4cfa8d['id']}})[_0xbe29('0x28')](function(){return _0x3fafb1;});})[_0xbe29('0x28')](function(){_0x5a2e0a[_0xbe29('0x1e')](0xcc)[_0xbe29('0x2d')]();});}};}function handleEntityNotFound(_0x5db20a,_0x2075d7){return function(_0x5e9e8b){if(!_0x5e9e8b){_0x5db20a[_0xbe29('0x1d')](0x194);}return _0x5e9e8b;};}function handleError(_0x272756,_0x24cad6){_0x24cad6=_0x24cad6||0x1f4;return function(_0x1fc197){logger[_0xbe29('0x2e')](_0x1fc197['stack']);if(_0x1fc197[_0xbe29('0x2f')]){delete _0x1fc197[_0xbe29('0x2f')];}_0x272756['status'](_0x24cad6)['send'](_0x1fc197);};}exports['index']=function(_0xf48224,_0x10bdc3){var _0x229f20={},_0x5160af={},_0x4f5a0a={'count':0x0,'rows':[]};var _0x30f10a=_[_0xbe29('0x30')](db[_0xbe29('0x31')][_0xbe29('0x32')],function(_0x1a8156){return{'name':_0x1a8156[_0xbe29('0x33')],'type':_0x1a8156[_0xbe29('0x34')][_0xbe29('0x35')]};});_0x5160af[_0xbe29('0x36')]=_[_0xbe29('0x30')](_0x30f10a,_0xbe29('0x2f'));_0x5160af[_0xbe29('0x37')]=_[_0xbe29('0x38')](_0xf48224[_0xbe29('0x37')]);_0x5160af[_0xbe29('0x39')]=_[_0xbe29('0x3a')](_0x5160af[_0xbe29('0x36')],_0x5160af[_0xbe29('0x37')]);_0x229f20[_0xbe29('0x3b')]=_['intersection'](_0x5160af[_0xbe29('0x36')],qs['fields'](_0xf48224[_0xbe29('0x37')][_0xbe29('0x3c')]));_0x229f20['attributes']=_0x229f20['attributes'][_0xbe29('0x3d')]?_0x229f20['attributes']:_0x5160af[_0xbe29('0x36')];if(!_0xf48224[_0xbe29('0x37')][_0xbe29('0x3e')](_0xbe29('0x3f'))){_0x229f20[_0xbe29('0x22')]=qs[_0xbe29('0x22')](_0xf48224[_0xbe29('0x37')][_0xbe29('0x22')]);_0x229f20['offset']=qs[_0xbe29('0x20')](_0xf48224['query'][_0xbe29('0x20')]);}_0x229f20[_0xbe29('0x40')]=qs[_0xbe29('0x41')](_0xf48224[_0xbe29('0x37')][_0xbe29('0x41')]);_0x229f20['where']=qs[_0xbe29('0x39')](_[_0xbe29('0x42')](_0xf48224[_0xbe29('0x37')],_0x5160af[_0xbe29('0x39')]),_0x30f10a);if(_0xf48224[_0xbe29('0x37')][_0xbe29('0x43')]){_0x229f20['where']=_[_0xbe29('0x44')](_0x229f20['where'],{'$or':_[_0xbe29('0x30')](_0x30f10a,function(_0x4b61c1){if(_0x4b61c1[_0xbe29('0x34')]!==_0xbe29('0x45')){var _0x1b4830={};_0x1b4830[_0x4b61c1[_0xbe29('0x2f')]]={'$like':'%'+_0xf48224[_0xbe29('0x37')]['filter']+'%'};return _0x1b4830;}})});}_0x229f20=_[_0xbe29('0x44')]({},_0x229f20,_0xf48224[_0xbe29('0x46')]);var _0x156512={'where':_0x229f20[_0xbe29('0x47')]};return db[_0xbe29('0x31')][_0xbe29('0x23')](_0x156512)['then'](function(_0x4789d9){_0x4f5a0a[_0xbe29('0x23')]=_0x4789d9;if(_0xf48224['query'][_0xbe29('0x48')]){_0x229f20['include']=[{'all':!![]}];}return db[_0xbe29('0x31')]['findAll'](_0x229f20);})[_0xbe29('0x28')](function(_0x3484be){_0x4f5a0a[_0xbe29('0x49')]=_0x3484be;return _0x4f5a0a;})[_0xbe29('0x28')](respondWithFilteredResult(_0x10bdc3,_0x229f20))[_0xbe29('0x4a')](handleError(_0x10bdc3,null));};exports[_0xbe29('0x4b')]=function(_0x2a6980,_0x496d09){var _0x50ea1={'raw':!![],'where':{'id':_0x2a6980[_0xbe29('0x4c')]['id']}},_0x1698cd={};_0x1698cd[_0xbe29('0x36')]=_['keys'](db[_0xbe29('0x31')]['rawAttributes']);_0x1698cd[_0xbe29('0x37')]=_[_0xbe29('0x38')](_0x2a6980[_0xbe29('0x37')]);_0x1698cd[_0xbe29('0x39')]=_[_0xbe29('0x3a')](_0x1698cd[_0xbe29('0x36')],_0x1698cd[_0xbe29('0x37')]);_0x50ea1['attributes']=_[_0xbe29('0x3a')](_0x1698cd[_0xbe29('0x36')],qs['fields'](_0x2a6980[_0xbe29('0x37')][_0xbe29('0x3c')]));_0x50ea1[_0xbe29('0x3b')]=_0x50ea1['attributes'][_0xbe29('0x3d')]?_0x50ea1[_0xbe29('0x3b')]:_0x1698cd['model'];if(_0x2a6980[_0xbe29('0x37')][_0xbe29('0x48')]){_0x50ea1['include']=[{'all':!![]}];}_0x50ea1=_[_0xbe29('0x44')]({},_0x50ea1,_0x2a6980[_0xbe29('0x46')]);return db[_0xbe29('0x31')][_0xbe29('0x4d')](_0x50ea1)['then'](handleEntityNotFound(_0x496d09,null))[_0xbe29('0x28')](respondWithResult(_0x496d09,null))[_0xbe29('0x4a')](handleError(_0x496d09,null));};exports[_0xbe29('0x4e')]=function(_0x25dcb6,_0x5bf58c){return db[_0xbe29('0x31')][_0xbe29('0x4e')](_0x25dcb6[_0xbe29('0x4f')],{})[_0xbe29('0x28')](function(_0x5071b8){var _0x50c28c=_0x25dcb6[_0xbe29('0x50')]['get']({'plain':!![]});if(!_0x50c28c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50c28c[_0xbe29('0x51')]===_0xbe29('0x50')){var _0x2784e0=_0x5071b8[_0xbe29('0x2a')]({'plain':!![]});var _0x242b21=_0xbe29('0x2b');return db[_0xbe29('0x52')]['find']({'where':{'name':_0x242b21,'userProfileId':_0x50c28c['userProfileId']},'raw':!![]})[_0xbe29('0x28')](function(_0x52cd48){if(_0x52cd48&&_0x52cd48['autoAssociation']===0x0){return db[_0xbe29('0x2c')][_0xbe29('0x4e')]({'name':_0x2784e0[_0xbe29('0x2f')],'resourceId':_0x2784e0['id'],'type':_0x52cd48[_0xbe29('0x2f')],'sectionId':_0x52cd48['id']},{})[_0xbe29('0x28')](function(){return _0x5071b8;});}else{return _0x5071b8;}})[_0xbe29('0x4a')](function(_0x403f60){logger[_0xbe29('0x2e')](_0xbe29('0x53'),_0x403f60);throw _0x403f60;});}return _0x5071b8;})[_0xbe29('0x28')](respondWithResult(_0x5bf58c,0xc9))[_0xbe29('0x4a')](handleError(_0x5bf58c,null));};exports[_0xbe29('0x27')]=function(_0x53a958,_0x306988){if(_0x53a958[_0xbe29('0x4f')]['id']){delete _0x53a958[_0xbe29('0x4f')]['id'];}return db[_0xbe29('0x31')]['find']({'where':{'id':_0x53a958[_0xbe29('0x4c')]['id']}})[_0xbe29('0x28')](handleEntityNotFound(_0x306988,null))[_0xbe29('0x28')](saveUpdates(_0x53a958['body'],null))[_0xbe29('0x28')](respondWithResult(_0x306988,null))[_0xbe29('0x4a')](handleError(_0x306988,null));};exports[_0xbe29('0x29')]=function(_0x2e47f7,_0x48950d){return db[_0xbe29('0x31')][_0xbe29('0x4d')]({'where':{'id':_0x2e47f7['params']['id']}})[_0xbe29('0x28')](handleEntityNotFound(_0x48950d,null))['then'](removeEntity(_0x48950d,null))[_0xbe29('0x4a')](handleError(_0x48950d,null));};exports[_0xbe29('0x54')]=function(_0xb613ec,_0x5eb729){return db[_0xbe29('0x31')]['describe']()['then'](respondWithResult(_0x5eb729,null))[_0xbe29('0x4a')](handleError(_0x5eb729,null));};exports[_0xbe29('0x55')]=function(_0x4eed27,_0x3c6057,_0x198176){var _0x1c6ba4={'raw':!![],'where':{}},_0x7f971c={},_0x28ee8a;return db[_0xbe29('0x31')][_0xbe29('0x56')]({'where':{'id':_0x4eed27['params']['id']}})[_0xbe29('0x28')](handleEntityNotFound(_0x3c6057,null))[_0xbe29('0x28')](function(_0x151f41){if(_0x151f41){_0x28ee8a=_0x151f41[_0xbe29('0x2a')]({'plain':!![]});_0x7f971c[_0xbe29('0x36')]=_[_0xbe29('0x38')](db['UserSmsQueue'][_0xbe29('0x32')]);_0x7f971c[_0xbe29('0x37')]=_[_0xbe29('0x38')](_0x4eed27[_0xbe29('0x37')]);_0x7f971c[_0xbe29('0x39')]=_['intersection'](_0x7f971c[_0xbe29('0x36')],_0x7f971c[_0xbe29('0x37')]);_0x1c6ba4[_0xbe29('0x3b')]=_[_0xbe29('0x3a')](_0x7f971c[_0xbe29('0x36')],qs[_0xbe29('0x3c')](_0x4eed27['query'][_0xbe29('0x3c')]));_0x1c6ba4[_0xbe29('0x3b')]=_0x1c6ba4[_0xbe29('0x3b')]['length']?_0x1c6ba4['attributes']:_0x7f971c['model'];if(!_0x4eed27['query'][_0xbe29('0x3e')]('nolimit')){_0x1c6ba4[_0xbe29('0x22')]=qs[_0xbe29('0x22')](_0x4eed27[_0xbe29('0x37')][_0xbe29('0x22')]);_0x1c6ba4[_0xbe29('0x20')]=qs[_0xbe29('0x20')](_0x4eed27['query'][_0xbe29('0x20')]);}_0x1c6ba4[_0xbe29('0x40')]=qs['sort'](_0x4eed27[_0xbe29('0x37')][_0xbe29('0x41')]);_0x1c6ba4[_0xbe29('0x47')]=qs[_0xbe29('0x39')](_[_0xbe29('0x42')](_0x4eed27[_0xbe29('0x37')],_0x7f971c[_0xbe29('0x39')]));_0x1c6ba4['where'][_0xbe29('0x57')]=_0x151f41['id'];if(_0x4eed27[_0xbe29('0x37')]['filter']){_0x1c6ba4[_0xbe29('0x47')]=_[_0xbe29('0x44')](_0x1c6ba4[_0xbe29('0x47')],{'$or':_[_0xbe29('0x30')](_0x1c6ba4[_0xbe29('0x3b')],function(_0x38a6d2){var _0x24e393={};_0x24e393[_0x38a6d2]={'$like':'%'+_0x4eed27[_0xbe29('0x37')][_0xbe29('0x43')]+'%'};return _0x24e393;})});}_0x1c6ba4=_[_0xbe29('0x44')]({},_0x1c6ba4,_0x4eed27['options']);return db[_0xbe29('0x58')][_0xbe29('0x59')](_0x1c6ba4);}})['then'](function(_0x46cc44){if(_0x46cc44){return db[_0xbe29('0x5a')][_0xbe29('0x5b')]({'where':{'id':_[_0xbe29('0x30')](_0x46cc44,_0xbe29('0x5c')),'role':'agent'},'attributes':['id',_0xbe29('0x2f'),_0xbe29('0x5d'),_0xbe29('0x5e'),'createdAt']});}})['then'](function(_0x16308d){if(_0x16308d){return{'count':_0x16308d['count'],'rows':_['map'](_0x16308d[_0xbe29('0x49')],function(_0x4c26a8){return{'membername':_0x4c26a8[_0xbe29('0x2f')],'UserId':_0x4c26a8['id'],'queue_name':_0x28ee8a['name'],'SmsQueueId':_0x28ee8a['id'],'interface':util[_0xbe29('0x5f')](_0xbe29('0x60'),_0xbe29('0x61'),_0x4c26a8[_0xbe29('0x2f')]),'penalty':0x0,'paused':_0x4c26a8['smsPause'],'createdAt':_0x4c26a8['createdAt'],'updatedAt':_0x4c26a8[_0xbe29('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3c6057,_0x1c6ba4))[_0xbe29('0x4a')](handleError(_0x3c6057,null));};exports[_0xbe29('0x62')]=function(_0x682707,_0x202f76,_0x170ccd){var _0x595b05={};var _0x3076f4={};var _0x2fa205;var _0x4c07e0;return db[_0xbe29('0x31')][_0xbe29('0x56')]({'where':{'id':_0x682707[_0xbe29('0x4c')]['id']}})[_0xbe29('0x28')](handleEntityNotFound(_0x202f76,null))['then'](function(_0x5d4056){if(_0x5d4056){_0x2fa205=_0x5d4056;_0x3076f4['model']=_[_0xbe29('0x38')](db[_0xbe29('0x63')][_0xbe29('0x32')]);_0x3076f4[_0xbe29('0x37')]=_[_0xbe29('0x38')](_0x682707[_0xbe29('0x37')]);_0x3076f4['filters']=_[_0xbe29('0x3a')](_0x3076f4[_0xbe29('0x36')],_0x3076f4[_0xbe29('0x37')]);_0x595b05[_0xbe29('0x3b')]=_[_0xbe29('0x3a')](_0x3076f4[_0xbe29('0x36')],qs['fields'](_0x682707[_0xbe29('0x37')]['fields']));_0x595b05[_0xbe29('0x3b')]=_0x595b05[_0xbe29('0x3b')][_0xbe29('0x3d')]?_0x595b05['attributes']:_0x3076f4[_0xbe29('0x36')];_0x595b05[_0xbe29('0x40')]=qs[_0xbe29('0x41')](_0x682707[_0xbe29('0x37')]['sort']);_0x595b05['where']=qs[_0xbe29('0x39')](_['pick'](_0x682707[_0xbe29('0x37')],_0x3076f4['filters']));if(_0x682707[_0xbe29('0x37')][_0xbe29('0x43')]){_0x595b05['where']=_['merge'](_0x595b05['where'],{'$or':_[_0xbe29('0x30')](_0x595b05[_0xbe29('0x3b')],function(_0x45ac74){var _0x42b680={};_0x42b680[_0x45ac74]={'$like':'%'+_0x682707[_0xbe29('0x37')][_0xbe29('0x43')]+'%'};return _0x42b680;})});}_0x595b05=_[_0xbe29('0x44')]({},_0x595b05,_0x682707['options']);return _0x2fa205[_0xbe29('0x62')](_0x595b05);}})[_0xbe29('0x28')](function(_0x422eb6){if(_0x422eb6){_0x4c07e0=_0x422eb6[_0xbe29('0x3d')];if(!_0x682707[_0xbe29('0x37')]['hasOwnProperty']('nolimit')){_0x595b05[_0xbe29('0x22')]=qs[_0xbe29('0x22')](_0x682707[_0xbe29('0x37')]['limit']);_0x595b05[_0xbe29('0x20')]=qs[_0xbe29('0x20')](_0x682707[_0xbe29('0x37')][_0xbe29('0x20')]);}return _0x2fa205[_0xbe29('0x62')](_0x595b05);}})[_0xbe29('0x28')](function(_0x540f7b){if(_0x540f7b){return _0x540f7b?{'count':_0x4c07e0,'rows':_0x540f7b}:null;}})[_0xbe29('0x28')](respondWithResult(_0x202f76,null))[_0xbe29('0x4a')](handleError(_0x202f76,null));};exports[_0xbe29('0x64')]=function(_0x24ce7f,_0x4014f6,_0x554b30){var _0xb186b3=_0x24ce7f[_0xbe29('0x4f')]['ids'];return db[_0xbe29('0x63')][_0xbe29('0x59')]({'where':{'id':_0xb186b3},'attributes':['id'],'include':[{'model':db[_0xbe29('0x5a')],'as':_0xbe29('0x65'),'attributes':['id',_0xbe29('0x2f'),_0xbe29('0x66'),_0xbe29('0x67'),_0xbe29('0x68')],'raw':!![]}]})['then'](function(_0x281463){if(_0x281463){var _0x22bcc7=_[_0xbe29('0x69')](_0x281463,function(_0x29d844){var _0x299a46=_0x29d844['get']({'plain':!![]});return _0x299a46[_0xbe29('0x65')];});return db[_0xbe29('0x31')][_0xbe29('0x4d')]({'where':{'id':_0x24ce7f[_0xbe29('0x4c')]['id']}})[_0xbe29('0x28')](function(_0xe52907){return db[_0xbe29('0x6a')][_0xbe29('0x6b')](function(_0xf6a310){return _0xe52907[_0xbe29('0x64')](_0xb186b3,{'transaction':_0xf6a310})['then'](function(){return BPromise[_0xbe29('0x6c')](_0x22bcc7,function(_0x4d827d){return db[_0xbe29('0x58')][_0xbe29('0x6d')]({'where':{'UserId':_0x4d827d['id'],'SmsQueueId':_0x24ce7f['params']['id']},'transaction':_0xf6a310});});})[_0xbe29('0x28')](function(){_0x22bcc7[_0xbe29('0x6e')](function(_0x5e42bc){socket[_0xbe29('0x6f')](_0xbe29('0x70'),{'UserId':_0x5e42bc['id'],'SmsQueueId':_0xe52907['id']});});});});});}})[_0xbe29('0x28')](respondWithStatusCode(_0x4014f6,null))[_0xbe29('0x4a')](handleError(_0x4014f6,null));};exports[_0xbe29('0x71')]=function(_0x1790f4,_0x55a25f,_0x1feb9d){return db[_0xbe29('0x63')][_0xbe29('0x59')]({'where':{'id':_0x1790f4['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe29('0x28')](handleEntityNotFound(_0x55a25f,null))[_0xbe29('0x28')](function(_0x561743){var _0x315af4=_[_0xbe29('0x30')](_0x561743,'id');var _0x980b51=[];var _0x497c06=[];var _0x208503=squel[_0xbe29('0x72')]();_0x208503['field'](_0xbe29('0x73'))[_0xbe29('0x74')](_0xbe29('0x75'),'tq')[_0xbe29('0x76')]('user_has_teams','ut',_0xbe29('0x77'))[_0xbe29('0x47')](_0xbe29('0x78'),_0x1790f4['params']['id']);for(var _0x21fc63=0x0;_0x21fc63<_0x561743['length'];_0x21fc63+=0x1){let _0x4a1c6a=_0x561743[_0x21fc63];for(var _0xb5f827=0x0;_0xb5f827<_0x4a1c6a['Agents'][_0xbe29('0x3d')];_0xb5f827+=0x1){let _0x3d47bc=_0x4a1c6a[_0xbe29('0x65')][_0xb5f827];var _0x48acb7=_0x208503[_0xbe29('0x79')]();_0x48acb7[_0xbe29('0x47')](_0xbe29('0x7a'),_0x3d47bc['id']);_0x497c06['push'](db['sequelize'][_0xbe29('0x37')](_0x48acb7[_0xbe29('0x7b')](),{'type':db[_0xbe29('0x6a')][_0xbe29('0x7c')][_0xbe29('0x7d')]})[_0xbe29('0x28')](function(_0x3927f5){if(_0x3927f5[_0xbe29('0x3d')]===0x1){return _0x3d47bc['id'];}else{var _0x3ce8ab=_['every'](_[_0xbe29('0x30')](_0x3927f5,_0xbe29('0x7e')),function(_0x469018){return _['includes'](_0x315af4,_0x469018);});if(_0x3ce8ab){return _0x3d47bc['id'];}}}));}}return BPromise[_0xbe29('0x7f')](_0x497c06)[_0xbe29('0x28')](function(_0x3e077){_0x980b51=_(_0x980b51)[_0xbe29('0x80')](_0x3e077)[_0xbe29('0x81')]()[_0xbe29('0x82')]();return db['SmsQueue'][_0xbe29('0x4d')]({'where':{'id':_0x1790f4[_0xbe29('0x4c')]['id']}})[_0xbe29('0x28')](function(_0x31a019){return db['sequelize'][_0xbe29('0x6b')](function(_0x1b9fec){return _0x31a019['removeTeams'](_0x1790f4['query'][_0xbe29('0x83')],{'transaction':_0x1b9fec})[_0xbe29('0x28')](function(){if(!_[_0xbe29('0x84')](_0x980b51)){return _0x31a019['removeAgents'](_0x980b51,{'transaction':_0x1b9fec});}})[_0xbe29('0x28')](function(){_0x980b51[_0xbe29('0x6e')](function(_0x95232e){socket[_0xbe29('0x6f')]('userSmsQueue:remove',{'UserId':_0x95232e,'SmsQueueId':_0x31a019['id']});});});});});});})[_0xbe29('0x28')](respondWithStatusCode(_0x55a25f,null))[_0xbe29('0x4a')](handleError(_0x55a25f,null));};exports[_0xbe29('0x85')]=function(_0xde2511,_0x297cf0,_0x31b5f7){return db[_0xbe29('0x31')][_0xbe29('0x4d')]({'where':{'id':_0xde2511[_0xbe29('0x4c')]['id']}})[_0xbe29('0x28')](handleEntityNotFound(_0x297cf0,null))[_0xbe29('0x28')](function(_0x5a1d58){if(_0x5a1d58){return _0x5a1d58[_0xbe29('0x85')](_0xde2511[_0xbe29('0x4f')]['ids'],_[_0xbe29('0x86')](_0xde2511[_0xbe29('0x4f')],[_0xbe29('0x83'),'id'])||{})['spread'](function(_0xa88dc7){for(var _0x23f7c7=0x0;_0x23f7c7<_0xde2511[_0xbe29('0x4f')][_0xbe29('0x83')]['length'];_0x23f7c7+=0x1){socket[_0xbe29('0x6f')](_0xbe29('0x70'),{'UserId':Number(_0xde2511['body']['ids'][_0x23f7c7]),'SmsQueueId':Number(_0xde2511[_0xbe29('0x4c')]['id'])});}return _0xa88dc7;});}})['then'](respondWithResult(_0x297cf0,null))['catch'](handleError(_0x297cf0,null));};exports[_0xbe29('0x87')]=function(_0x5bd9c1,_0x26330d,_0x116ee0){return db[_0xbe29('0x31')]['find']({'where':{'id':_0x5bd9c1['params']['id']}})[_0xbe29('0x28')](handleEntityNotFound(_0x26330d,null))[_0xbe29('0x28')](function(_0x25b528){if(_0x25b528){return _0x25b528[_0xbe29('0x87')](_0x5bd9c1[_0xbe29('0x37')][_0xbe29('0x83')])['then'](function(){if(_[_0xbe29('0x88')](_0x5bd9c1[_0xbe29('0x37')][_0xbe29('0x83')])){for(var _0x178cd6=0x0;_0x178cd6<_0x5bd9c1[_0xbe29('0x37')][_0xbe29('0x83')][_0xbe29('0x3d')];_0x178cd6+=0x1){socket[_0xbe29('0x6f')](_0xbe29('0x89'),{'UserId':Number(_0x5bd9c1[_0xbe29('0x37')][_0xbe29('0x83')][_0x178cd6]),'SmsQueueId':Number(_0x5bd9c1[_0xbe29('0x4c')]['id'])});}}else{socket['emit'](_0xbe29('0x89'),{'UserId':Number(_0x5bd9c1['query'][_0xbe29('0x83')]),'SmsQueueId':Number(_0x5bd9c1[_0xbe29('0x4c')]['id'])});}});}})[_0xbe29('0x28')](respondWithStatusCode(_0x26330d,null))[_0xbe29('0x4a')](handleError(_0x26330d,null));};exports[_0xbe29('0x8a')]=function(_0x4a492c,_0x1c444b,_0x157f9c){var _0xf6138c={};var _0x5ec31a={};var _0x3d39ed;var _0x2f86c8;return db[_0xbe29('0x31')][_0xbe29('0x56')]({'where':{'id':_0x4a492c[_0xbe29('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1c444b,null))[_0xbe29('0x28')](function(_0x178f58){if(_0x178f58){_0x3d39ed=_0x178f58;_0x5ec31a[_0xbe29('0x36')]=_[_0xbe29('0x38')](db[_0xbe29('0x5a')]['rawAttributes']);_0x5ec31a[_0xbe29('0x37')]=_[_0xbe29('0x38')](_0x4a492c[_0xbe29('0x37')]);_0x5ec31a[_0xbe29('0x39')]=_[_0xbe29('0x3a')](_0x5ec31a['model'],_0x5ec31a['query']);_0xf6138c[_0xbe29('0x3b')]=_[_0xbe29('0x3a')](_0x5ec31a[_0xbe29('0x36')],qs[_0xbe29('0x3c')](_0x4a492c['query'][_0xbe29('0x3c')]));_0xf6138c['attributes']=_0xf6138c[_0xbe29('0x3b')]['length']?_0xf6138c[_0xbe29('0x3b')]:_0x5ec31a[_0xbe29('0x36')];_0xf6138c[_0xbe29('0x40')]=qs[_0xbe29('0x41')](_0x4a492c[_0xbe29('0x37')][_0xbe29('0x41')]);_0xf6138c[_0xbe29('0x47')]=qs['filters'](_['pick'](_0x4a492c[_0xbe29('0x37')],_0x5ec31a['filters']));if(_0x4a492c[_0xbe29('0x37')][_0xbe29('0x43')]){_0xf6138c[_0xbe29('0x47')]=_[_0xbe29('0x44')](_0xf6138c[_0xbe29('0x47')],{'$or':_[_0xbe29('0x30')](_0xf6138c[_0xbe29('0x3b')],function(_0x8f3f13){var _0x5890e3={};_0x5890e3[_0x8f3f13]={'$like':'%'+_0x4a492c[_0xbe29('0x37')][_0xbe29('0x43')]+'%'};return _0x5890e3;})});}_0xf6138c=_[_0xbe29('0x44')]({},_0xf6138c,_0x4a492c[_0xbe29('0x46')]);return _0x3d39ed['getAgents'](_0xf6138c);}})[_0xbe29('0x28')](function(_0x34f9b3){if(_0x34f9b3){_0x2f86c8=_0x34f9b3[_0xbe29('0x3d')];if(!_0x4a492c[_0xbe29('0x37')]['hasOwnProperty'](_0xbe29('0x3f'))){_0xf6138c[_0xbe29('0x22')]=qs[_0xbe29('0x22')](_0x4a492c[_0xbe29('0x37')][_0xbe29('0x22')]);_0xf6138c[_0xbe29('0x20')]=qs[_0xbe29('0x20')](_0x4a492c[_0xbe29('0x37')][_0xbe29('0x20')]);}return _0x3d39ed[_0xbe29('0x8a')](_0xf6138c);}})['then'](function(_0x2fe93d){if(_0x2fe93d){return _0x2fe93d?{'count':_0x2f86c8,'rows':_0x2fe93d}:null;}})[_0xbe29('0x28')](respondWithResult(_0x1c444b,null))[_0xbe29('0x4a')](handleError(_0x1c444b,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index f51edc8..a5d6ee5 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 _0x634d=['setMaxListeners','update','remove','emit','hook','events','../../mysqldb','SmsQueue'];(function(_0x1da7b,_0x3ce5ec){var _0x4bf8e3=function(_0x21bed2){while(--_0x21bed2){_0x1da7b['push'](_0x1da7b['shift']());}};_0x4bf8e3(++_0x3ce5ec);}(_0x634d,0x115));var _0xd634=function(_0x21fcb5,_0x4f2f36){_0x21fcb5=_0x21fcb5-0x0;var _0x4f3ab4=_0x634d[_0x21fcb5];return _0x4f3ab4;};'use strict';var EventEmitter=require(_0xd634('0x0'));var SmsQueue=require(_0xd634('0x1'))['db'][_0xd634('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd634('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd634('0x4'),'afterDestroy':_0xd634('0x5')};function emitEvent(_0x21de7e){return function(_0x24c69f,_0x16a251,_0x299999){SmsQueueEvents[_0xd634('0x6')](_0x21de7e+':'+_0x24c69f['id'],_0x24c69f);SmsQueueEvents[_0xd634('0x6')](_0x21de7e,_0x24c69f);_0x299999(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xd634('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xe920=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue','save'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe920,0x164));var _0x0e92=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xe920[_0x599f41];return _0x2e4d58;};'use strict';var EventEmitter=require(_0x0e92('0x0'));var SmsQueue=require(_0x0e92('0x1'))['db'][_0x0e92('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0e92('0x3'),'afterUpdate':_0x0e92('0x4'),'afterDestroy':_0x0e92('0x5')};function emitEvent(_0x38ff13){return function(_0x471775,_0x92e7d5,_0x33b6d5){SmsQueueEvents[_0x0e92('0x6')](_0x38ff13+':'+_0x471775['id'],_0x471775);SmsQueueEvents[_0x0e92('0x6')](_0x38ff13,_0x471775);_0x33b6d5(null);};}for(var e in events){if(events[_0x0e92('0x7')](e)){var event=events[e];SmsQueue[_0x0e92('0x8')](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 fdc54c7..7012cdc 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 _0x8b6c=['bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsQueue','sms_queues','util','api','moment'];(function(_0x16bcdf,_0x2f8a9b){var _0x5ce8ca=function(_0x38ed70){while(--_0x38ed70){_0x16bcdf['push'](_0x16bcdf['shift']());}};_0x5ce8ca(++_0x2f8a9b);}(_0x8b6c,0x8c));var _0xc8b6=function(_0x28fd2e,_0x598fe4){_0x28fd2e=_0x28fd2e-0x0;var _0x277bfa=_0x8b6c[_0x28fd2e];return _0x277bfa;};'use strict';var _=require('lodash');var util=require(_0xc8b6('0x0'));var logger=require('../../config/logger')(_0xc8b6('0x1'));var moment=require(_0xc8b6('0x2'));var BPromise=require(_0xc8b6('0x3'));var rp=require(_0xc8b6('0x4'));var fs=require('fs');var path=require(_0xc8b6('0x5'));var rimraf=require(_0xc8b6('0x6'));var config=require(_0xc8b6('0x7'));var attributes=require('./smsQueue.attributes');module[_0xc8b6('0x8')]=function(_0x1a6167,_0x2c90aa){return _0x1a6167['define'](_0xc8b6('0x9'),attributes,{'tableName':_0xc8b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa843=['define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./smsQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa843,0x123));var _0x3a84=function(_0x34e8f8,_0x229d8f){_0x34e8f8=_0x34e8f8-0x0;var _0x4a64fa=_0xa843[_0x34e8f8];return _0x4a64fa;};'use strict';var _=require(_0x3a84('0x0'));var util=require(_0x3a84('0x1'));var logger=require(_0x3a84('0x2'))(_0x3a84('0x3'));var moment=require(_0x3a84('0x4'));var BPromise=require(_0x3a84('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a84('0x6'));var rimraf=require(_0x3a84('0x7'));var config=require('../../config/environment');var attributes=require(_0x3a84('0x8'));module['exports']=function(_0x367999,_0xf079a6){return _0x367999[_0x3a84('0x9')](_0x3a84('0xa'),attributes,{'tableName':_0x3a84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 8e2c799..ad874f8 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 _0x3621=['debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowSmsQueue','find','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3eee57,_0x16c202){var _0x9b84d5=function(_0x57a505){while(--_0x57a505){_0x3eee57['push'](_0x3eee57['shift']());}};_0x9b84d5(++_0x16c202);}(_0x3621,0xe3));var _0x1362=function(_0x6564ff,_0x188f4b){_0x6564ff=_0x6564ff-0x0;var _0x13ea0d=_0x3621[_0x6564ff];return _0x13ea0d;};'use strict';var _=require(_0x1362('0x0'));var util=require(_0x1362('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1362('0x2'));var fs=require('fs');var Redis=require(_0x1362('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1362('0x4'))(_0x1362('0x5'));var config=require(_0x1362('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1362('0x7')][_0x1362('0x8')]({'port':0x232a});config[_0x1362('0x9')]=_[_0x1362('0xa')](config['redis'],{'host':_0x1362('0xb'),'port':0x18eb});var socket=require(_0x1362('0xc'))(new Redis(config[_0x1362('0x9')]));require(_0x1362('0xd'))[_0x1362('0xe')](socket);function respondWithRpcPromise(_0x3362cb,_0xd1e7f6,_0x42e744){return new BPromise(function(_0x2129da,_0x12f516){return client[_0x1362('0xf')](_0x3362cb,_0x42e744)[_0x1362('0x10')](function(_0x4595d3){logger['info'](_0x1362('0x11'),_0xd1e7f6,_0x1362('0x12'));logger[_0x1362('0x13')](_0x1362('0x14'),_0xd1e7f6,_0x1362('0x12'),JSON[_0x1362('0x15')](_0x4595d3));if(_0x4595d3[_0x1362('0x16')]){if(_0x4595d3[_0x1362('0x16')][_0x1362('0x17')]===0x1f4){logger['error'](_0x1362('0x11'),_0xd1e7f6,_0x4595d3[_0x1362('0x16')][_0x1362('0x18')]);return _0x12f516(_0x4595d3[_0x1362('0x16')][_0x1362('0x18')]);}logger[_0x1362('0x16')](_0x1362('0x11'),_0xd1e7f6,_0x4595d3['error'][_0x1362('0x18')]);return _0x2129da(_0x4595d3['error'][_0x1362('0x18')]);}else{logger[_0x1362('0x19')](_0x1362('0x11'),_0xd1e7f6,_0x1362('0x12'));_0x2129da(_0x4595d3[_0x1362('0x1a')][_0x1362('0x18')]);}})['catch'](function(_0x2c0d95){logger[_0x1362('0x16')](_0x1362('0x11'),_0xd1e7f6,_0x2c0d95);_0x12f516(_0x2c0d95);});});}exports[_0x1362('0x1b')]=function(_0x9aeb05){var _0x29e351=this;return new Promise(function(_0xa0c598,_0x246138){return db[_0x1362('0x1c')][_0x1362('0x1d')]({'raw':_0x9aeb05['options']?_0x9aeb05[_0x1362('0x1e')][_0x1362('0x1f')]===undefined?!![]:![]:!![],'where':_0x9aeb05[_0x1362('0x1e')]?_0x9aeb05['options'][_0x1362('0x20')]||null:null,'attributes':_0x9aeb05[_0x1362('0x1e')]?_0x9aeb05[_0x1362('0x1e')]['attributes']||null:null,'limit':_0x9aeb05['options']?_0x9aeb05[_0x1362('0x1e')][_0x1362('0x21')]||null:null,'include':_0x9aeb05[_0x1362('0x1e')]?_0x9aeb05[_0x1362('0x1e')][_0x1362('0x22')]?_[_0x1362('0x23')](_0x9aeb05[_0x1362('0x1e')][_0x1362('0x22')],function(_0x3d917d){return{'model':db[_0x3d917d[_0x1362('0x24')]],'as':_0x3d917d['as'],'attributes':_0x3d917d[_0x1362('0x25')],'include':_0x3d917d[_0x1362('0x22')]?_[_0x1362('0x23')](_0x3d917d[_0x1362('0x22')],function(_0x3a4992){return{'model':db[_0x3a4992[_0x1362('0x24')]],'as':_0x3a4992['as'],'attributes':_0x3a4992[_0x1362('0x25')],'include':_0x3a4992[_0x1362('0x22')]?_[_0x1362('0x23')](_0x3a4992[_0x1362('0x22')],function(_0x41df3d){return{'model':db[_0x41df3d[_0x1362('0x24')]],'as':_0x41df3d['as'],'attributes':_0x41df3d[_0x1362('0x25')]};}):[]};}):[]};}):[]:[]})[_0x1362('0x10')](function(_0x1fadb4){logger[_0x1362('0x19')]('GetSmsQueue',_0x9aeb05);logger[_0x1362('0x13')](_0x1362('0x1b'),_0x9aeb05,JSON[_0x1362('0x15')](_0x1fadb4));_0xa0c598(_0x1fadb4);})[_0x1362('0x26')](function(_0x1e6a93){logger[_0x1362('0x16')]('GetSmsQueue',_0x1e6a93[_0x1362('0x18')],_0x9aeb05);_0x246138(_0x29e351[_0x1362('0x16')](0x1f4,_0x1e6a93[_0x1362('0x18')]));});});};exports[_0x1362('0x27')]=function(_0x358e12){var _0x304439=this;return new Promise(function(_0x5c92e6,_0x266c6e){return db[_0x1362('0x1c')][_0x1362('0x28')]({'raw':_0x358e12[_0x1362('0x1e')]?_0x358e12[_0x1362('0x1e')][_0x1362('0x1f')]===undefined?!![]:![]:!![],'where':_0x358e12[_0x1362('0x1e')]?_0x358e12['options'][_0x1362('0x20')]||null:null,'attributes':_0x358e12[_0x1362('0x1e')]?_0x358e12[_0x1362('0x1e')][_0x1362('0x25')]||null:null,'include':_0x358e12['options']?_0x358e12[_0x1362('0x1e')][_0x1362('0x22')]?_[_0x1362('0x23')](_0x358e12[_0x1362('0x1e')][_0x1362('0x22')],function(_0x13398f){return{'model':db[_0x13398f['model']],'as':_0x13398f['as'],'attributes':_0x13398f['attributes'],'include':_0x13398f[_0x1362('0x22')]?_['map'](_0x13398f[_0x1362('0x22')],function(_0x4eead6){return{'model':db[_0x4eead6[_0x1362('0x24')]],'as':_0x4eead6['as'],'attributes':_0x4eead6[_0x1362('0x25')],'include':_0x4eead6['include']?_['map'](_0x4eead6['include'],function(_0x293f23){return{'model':db[_0x293f23[_0x1362('0x24')]],'as':_0x293f23['as'],'attributes':_0x293f23[_0x1362('0x25')]};}):[]};}):[]};}):[]:[]})[_0x1362('0x10')](function(_0x68a672){logger[_0x1362('0x19')](_0x1362('0x27'),_0x358e12);logger[_0x1362('0x13')](_0x1362('0x27'),_0x358e12,JSON[_0x1362('0x15')](_0x68a672));_0x5c92e6(_0x68a672);})['catch'](function(_0x3eddad){logger[_0x1362('0x16')](_0x1362('0x27'),_0x3eddad[_0x1362('0x18')],_0x358e12);_0x266c6e(_0x304439['error'](0x1f4,_0x3eddad['message']));});});}; \ No newline at end of file +var _0x4246=['defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetSmsQueue','SmsQueue','options','raw','attributes','limit','map','include','model','find','where','ShowSmsQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5b2894,_0x5bce7f){var _0x983032=function(_0x20b2fa){while(--_0x20b2fa){_0x5b2894['push'](_0x5b2894['shift']());}};_0x983032(++_0x5bce7f);}(_0x4246,0x142));var _0x6424=function(_0x218459,_0x289c03){_0x218459=_0x218459-0x0;var _0x3c1f3c=_0x4246[_0x218459];return _0x3c1f3c;};'use strict';var _=require('lodash');var util=require(_0x6424('0x0'));var moment=require(_0x6424('0x1'));var BPromise=require(_0x6424('0x2'));var rs=require(_0x6424('0x3'));var fs=require('fs');var Redis=require(_0x6424('0x4'));var db=require(_0x6424('0x5'))['db'];var utils=require(_0x6424('0x6'));var logger=require(_0x6424('0x7'))(_0x6424('0x8'));var config=require(_0x6424('0x9'));var jayson=require(_0x6424('0xa'));var client=jayson[_0x6424('0xb')][_0x6424('0xc')]({'port':0x232a});config[_0x6424('0xd')]=_[_0x6424('0xe')](config[_0x6424('0xd')],{'host':_0x6424('0xf'),'port':0x18eb});var socket=require(_0x6424('0x10'))(new Redis(config[_0x6424('0xd')]));require('./smsQueue.socket')[_0x6424('0x11')](socket);function respondWithRpcPromise(_0x32aad2,_0x5d4460,_0x12b42a){return new BPromise(function(_0xadfb30,_0x2179fa){return client[_0x6424('0x12')](_0x32aad2,_0x12b42a)[_0x6424('0x13')](function(_0x32285d){logger[_0x6424('0x14')](_0x6424('0x15'),_0x5d4460,'request\x20sent');logger[_0x6424('0x16')](_0x6424('0x17'),_0x5d4460,'request\x20sent',JSON[_0x6424('0x18')](_0x32285d));if(_0x32285d[_0x6424('0x19')]){if(_0x32285d[_0x6424('0x19')]['code']===0x1f4){logger[_0x6424('0x19')]('SmsQueue,\x20%s,\x20%s',_0x5d4460,_0x32285d[_0x6424('0x19')][_0x6424('0x1a')]);return _0x2179fa(_0x32285d['error'][_0x6424('0x1a')]);}logger[_0x6424('0x19')](_0x6424('0x15'),_0x5d4460,_0x32285d[_0x6424('0x19')][_0x6424('0x1a')]);return _0xadfb30(_0x32285d[_0x6424('0x19')][_0x6424('0x1a')]);}else{logger[_0x6424('0x14')](_0x6424('0x15'),_0x5d4460,_0x6424('0x1b'));_0xadfb30(_0x32285d[_0x6424('0x1c')][_0x6424('0x1a')]);}})[_0x6424('0x1d')](function(_0x33f5d0){logger[_0x6424('0x19')](_0x6424('0x15'),_0x5d4460,_0x33f5d0);_0x2179fa(_0x33f5d0);});});}exports[_0x6424('0x1e')]=function(_0x539bda){var _0x4a3db2=this;return new Promise(function(_0x23d36a,_0x20e04c){return db[_0x6424('0x1f')]['findAll']({'raw':_0x539bda['options']?_0x539bda[_0x6424('0x20')][_0x6424('0x21')]===undefined?!![]:![]:!![],'where':_0x539bda['options']?_0x539bda['options']['where']||null:null,'attributes':_0x539bda[_0x6424('0x20')]?_0x539bda[_0x6424('0x20')][_0x6424('0x22')]||null:null,'limit':_0x539bda[_0x6424('0x20')]?_0x539bda[_0x6424('0x20')][_0x6424('0x23')]||null:null,'include':_0x539bda['options']?_0x539bda[_0x6424('0x20')]['include']?_[_0x6424('0x24')](_0x539bda[_0x6424('0x20')][_0x6424('0x25')],function(_0x34f660){return{'model':db[_0x34f660[_0x6424('0x26')]],'as':_0x34f660['as'],'attributes':_0x34f660[_0x6424('0x22')],'include':_0x34f660[_0x6424('0x25')]?_[_0x6424('0x24')](_0x34f660[_0x6424('0x25')],function(_0x49ed48){return{'model':db[_0x49ed48[_0x6424('0x26')]],'as':_0x49ed48['as'],'attributes':_0x49ed48[_0x6424('0x22')],'include':_0x49ed48[_0x6424('0x25')]?_[_0x6424('0x24')](_0x49ed48[_0x6424('0x25')],function(_0x2e7b8d){return{'model':db[_0x2e7b8d[_0x6424('0x26')]],'as':_0x2e7b8d['as'],'attributes':_0x2e7b8d[_0x6424('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fc3a9){logger['info']('GetSmsQueue',_0x539bda);logger[_0x6424('0x16')](_0x6424('0x1e'),_0x539bda,JSON[_0x6424('0x18')](_0x2fc3a9));_0x23d36a(_0x2fc3a9);})['catch'](function(_0x46e7e4){logger[_0x6424('0x19')]('GetSmsQueue',_0x46e7e4['message'],_0x539bda);_0x20e04c(_0x4a3db2[_0x6424('0x19')](0x1f4,_0x46e7e4[_0x6424('0x1a')]));});});};exports['ShowSmsQueue']=function(_0x149dc7){var _0x59e926=this;return new Promise(function(_0x302a03,_0x3303e1){return db[_0x6424('0x1f')][_0x6424('0x27')]({'raw':_0x149dc7['options']?_0x149dc7[_0x6424('0x20')][_0x6424('0x21')]===undefined?!![]:![]:!![],'where':_0x149dc7[_0x6424('0x20')]?_0x149dc7['options'][_0x6424('0x28')]||null:null,'attributes':_0x149dc7[_0x6424('0x20')]?_0x149dc7[_0x6424('0x20')][_0x6424('0x22')]||null:null,'include':_0x149dc7[_0x6424('0x20')]?_0x149dc7['options'][_0x6424('0x25')]?_[_0x6424('0x24')](_0x149dc7[_0x6424('0x20')][_0x6424('0x25')],function(_0x5722c6){return{'model':db[_0x5722c6['model']],'as':_0x5722c6['as'],'attributes':_0x5722c6[_0x6424('0x22')],'include':_0x5722c6[_0x6424('0x25')]?_['map'](_0x5722c6['include'],function(_0x3d133f){return{'model':db[_0x3d133f['model']],'as':_0x3d133f['as'],'attributes':_0x3d133f[_0x6424('0x22')],'include':_0x3d133f[_0x6424('0x25')]?_[_0x6424('0x24')](_0x3d133f[_0x6424('0x25')],function(_0x1b03d6){return{'model':db[_0x1b03d6['model']],'as':_0x1b03d6['as'],'attributes':_0x1b03d6[_0x6424('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe6ad4){logger[_0x6424('0x14')](_0x6424('0x29'),_0x149dc7);logger[_0x6424('0x16')](_0x6424('0x29'),_0x149dc7,JSON[_0x6424('0x18')](_0xe6ad4));_0x302a03(_0xe6ad4);})['catch'](function(_0x420ecc){logger[_0x6424('0x19')](_0x6424('0x29'),_0x420ecc['message'],_0x149dc7);_0x3303e1(_0x59e926[_0x6424('0x19')](0x1f4,_0x420ecc[_0x6424('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 163498b..43e6031 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 _0xd651=['smsQueue:','update','register','length'];(function(_0x3b131b,_0xf49477){var _0x1d79d5=function(_0x2b3f26){while(--_0x2b3f26){_0x3b131b['push'](_0x3b131b['shift']());}};_0x1d79d5(++_0xf49477);}(_0xd651,0x1e1));var _0x1d65=function(_0x380d52,_0x5e39df){_0x380d52=_0x380d52-0x0;var _0x5b4acd=_0xd651[_0x380d52];return _0x5b4acd;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove',_0x1d65('0x0')];function createListener(_0x1f2c38,_0x1b23d9){return function(_0x3b104a){_0x1b23d9['emit'](_0x1f2c38,_0x3b104a);};}function removeListener(_0x280119,_0x3a8aac){return function(){SmsQueueEvents['removeListener'](_0x280119,_0x3a8aac);};}exports[_0x1d65('0x1')]=function(_0x19bd9b){for(var _0x3373d2=0x0,_0x417bf7=events[_0x1d65('0x2')];_0x3373d2<_0x417bf7;_0x3373d2++){var _0x5605ff=events[_0x3373d2];var _0x5a198e=createListener(_0x1d65('0x3')+_0x5605ff,_0x19bd9b);SmsQueueEvents['on'](_0x5605ff,_0x5a198e);}}; \ No newline at end of file +var _0x1422=['update','removeListener','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1422,0xb5));var _0x2142=function(_0x52a073,_0x225c33){_0x52a073=_0x52a073-0x0;var _0x14c817=_0x1422[_0x52a073];return _0x14c817;};'use strict';var SmsQueueEvents=require(_0x2142('0x0'));var events=[_0x2142('0x1'),_0x2142('0x2'),_0x2142('0x3')];function createListener(_0x45a3cf,_0x31d0dd){return function(_0x5c6980){_0x31d0dd['emit'](_0x45a3cf,_0x5c6980);};}function removeListener(_0x421614,_0x1bb3c1){return function(){SmsQueueEvents[_0x2142('0x4')](_0x421614,_0x1bb3c1);};}exports[_0x2142('0x5')]=function(_0x520fe4){for(var _0x107ae6=0x0,_0x355d18=events[_0x2142('0x6')];_0x107ae6<_0x355d18;_0x107ae6++){var _0x5e1e05=events[_0x107ae6];var _0x524642=createListener(_0x2142('0x7')+_0x5e1e05,_0x520fe4);SmsQueueEvents['on'](_0x5e1e05,_0x524642);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 2dded9a..33d6f82 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 _0xf1c6=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','destroy','path','connect-timeout','express','Router','fs-extra'];(function(_0x4bb691,_0x37679a){var _0x588b53=function(_0x2c802d){while(--_0x2c802d){_0x4bb691['push'](_0x4bb691['shift']());}};_0x588b53(++_0x37679a);}(_0xf1c6,0x145));var _0x6f1c=function(_0x16a2b4,_0x49dee9){_0x16a2b4=_0x16a2b4-0x0;var _0x41caa7=_0xf1c6[_0x16a2b4];return _0x41caa7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f1c('0x0'));var timeout=require(_0x6f1c('0x1'));var express=require(_0x6f1c('0x2'));var router=express[_0x6f1c('0x3')]();var fs_extra=require(_0x6f1c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f1c('0x5'));var controller=require('./smsQueueReport.controller');router[_0x6f1c('0x6')]('/',auth[_0x6f1c('0x7')](),controller[_0x6f1c('0x8')]);router['get'](_0x6f1c('0x9'),auth['isAuthenticated'](),controller[_0x6f1c('0xa')]);router[_0x6f1c('0x6')](_0x6f1c('0xb'),auth['isAuthenticated'](),controller[_0x6f1c('0xc')]);router['post']('/',auth[_0x6f1c('0x7')](),controller[_0x6f1c('0xd')]);router['put'](_0x6f1c('0xb'),auth[_0x6f1c('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6f1c('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd89a=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','/:id','show','post'];(function(_0x264a71,_0x56af78){var _0x45c2c6=function(_0x11f555){while(--_0x11f555){_0x264a71['push'](_0x264a71['shift']());}};_0x45c2c6(++_0x56af78);}(_0xd89a,0x6e));var _0xad89=function(_0x1b1a41,_0x37fdba){_0x1b1a41=_0x1b1a41-0x0;var _0x2ef3b7=_0xd89a[_0x1b1a41];return _0x2ef3b7;};'use strict';var multer=require(_0xad89('0x0'));var util=require(_0xad89('0x1'));var path=require(_0xad89('0x2'));var timeout=require(_0xad89('0x3'));var express=require(_0xad89('0x4'));var router=express[_0xad89('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xad89('0x6'));var interaction=require(_0xad89('0x7'));var config=require(_0xad89('0x8'));var controller=require(_0xad89('0x9'));router[_0xad89('0xa')]('/',auth[_0xad89('0xb')](),controller['index']);router[_0xad89('0xa')](_0xad89('0xc'),auth[_0xad89('0xb')](),controller['describe']);router[_0xad89('0xa')](_0xad89('0xd'),auth[_0xad89('0xb')](),controller[_0xad89('0xe')]);router[_0xad89('0xf')]('/',auth[_0xad89('0xb')](),controller[_0xad89('0x10')]);router[_0xad89('0x11')]('/:id',auth[_0xad89('0xb')](),controller[_0xad89('0x12')]);router[_0xad89('0x13')](_0xad89('0xd'),auth[_0xad89('0xb')](),controller['destroy']);module[_0xad89('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 70a810a..b711728 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 _0x12e9=['exports','STRING','DATE'];(function(_0x48c2a1,_0x4e3872){var _0x4e2162=function(_0x16a529){while(--_0x16a529){_0x48c2a1['push'](_0x48c2a1['shift']());}};_0x4e2162(++_0x4e3872);}(_0x12e9,0x66));var _0x912e=function(_0x46092e,_0x22cbd8){_0x46092e=_0x46092e-0x0;var _0x20753c=_0x12e9[_0x46092e];return _0x20753c;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x912e('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x912e('0x1')]},'joinAt':{'type':Sequelize[_0x912e('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x912e('0x2')]},'exitAt':{'type':Sequelize[_0x912e('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0be6=['moment','exports','DATE'];(function(_0x985f17,_0x259bfe){var _0x8488a5=function(_0x58a08f){while(--_0x58a08f){_0x985f17['push'](_0x985f17['shift']());}};_0x8488a5(++_0x259bfe);}(_0x0be6,0xff));var _0x60be=function(_0x131892,_0x19f8d3){_0x131892=_0x131892-0x0;var _0x4aea08=_0x0be6[_0x131892];return _0x4aea08;};'use strict';var moment=require(_0x60be('0x0'));var Sequelize=require('sequelize');module[_0x60be('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x60be('0x2')]},'leaveAt':{'type':Sequelize[_0x60be('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x60be('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b7ae1a5..7bdb818 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 _0x633e=['order','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','SmsQueueReport','include','findAll','rows','catch','show','params','keys','fields','includeAll','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','attributes','length','nolimit','offset'];(function(_0x28ca99,_0x4e900b){var _0x57b650=function(_0x85ca33){while(--_0x85ca33){_0x28ca99['push'](_0x28ca99['shift']());}};_0x57b650(++_0x4e900b);}(_0x633e,0x198));var _0xe633=function(_0x742dcf,_0x2caa26){_0x742dcf=_0x742dcf-0x0;var _0xf5acb9=_0x633e[_0x742dcf];return _0xf5acb9;};'use strict';var emlformat=require(_0xe633('0x0'));var rimraf=require(_0xe633('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe633('0x2'));var rp=require(_0xe633('0x3'));var moment=require('moment');var BPromise=require(_0xe633('0x4'));var Mustache=require(_0xe633('0x5'));var util=require(_0xe633('0x6'));var path=require('path');var sox=require(_0xe633('0x7'));var csv=require(_0xe633('0x8'));var ejs=require(_0xe633('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe633('0xa'));var squel=require(_0xe633('0xb'));var crypto=require(_0xe633('0xc'));var jsforce=require(_0xe633('0xd'));var deskjs=require(_0xe633('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe633('0xf'));var Papa=require(_0xe633('0x10'));var Redis=require(_0xe633('0x11'));var authService=require(_0xe633('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe633('0x13'));var hardwareService=require(_0xe633('0x14'));var logger=require(_0xe633('0x15'))(_0xe633('0x16'));var utils=require(_0xe633('0x17'));var config=require(_0xe633('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe633('0x19'))['db'];function respondWithStatusCode(_0x3a2266,_0x450c28){_0x450c28=_0x450c28||0xcc;return function(_0x2abce6){if(_0x2abce6){return _0x3a2266[_0xe633('0x1a')](_0x450c28);}return _0x3a2266[_0xe633('0x1b')](_0x450c28)['end']();};}function respondWithResult(_0x7f32a5,_0x10cd14){_0x10cd14=_0x10cd14||0xc8;return function(_0x55ef1b){if(_0x55ef1b){return _0x7f32a5[_0xe633('0x1b')](_0x10cd14)[_0xe633('0x1c')](_0x55ef1b);}};}function respondWithFilteredResult(_0x47c89c,_0x2a7794){return function(_0x3689d0){if(_0x3689d0){var _0x2f2d31=typeof _0x2a7794['offset']===_0xe633('0x1d')&&typeof _0x2a7794[_0xe633('0x1e')]==='undefined';var _0x43e207=_0x3689d0[_0xe633('0x1f')];var _0x27a72a=_0x2f2d31?0x0:_0x2a7794['offset'];var _0x9e54ac=_0x2f2d31?_0x3689d0[_0xe633('0x1f')]:_0x2a7794['offset']+_0x2a7794['limit'];var _0x30f646;if(_0x9e54ac>=_0x43e207){_0x9e54ac=_0x43e207;_0x30f646=0xc8;}else{_0x30f646=0xce;}_0x47c89c['status'](_0x30f646);return _0x47c89c['set'](_0xe633('0x20'),_0x27a72a+'-'+_0x9e54ac+'/'+_0x43e207)[_0xe633('0x1c')](_0x3689d0);}return null;};}function patchUpdates(_0xd4c8fb){return function(_0x2cc274){try{jsonpatch[_0xe633('0x21')](_0x2cc274,_0xd4c8fb,!![]);}catch(_0x4b1f9d){return BPromise[_0xe633('0x22')](_0x4b1f9d);}return _0x2cc274['save']();};}function saveUpdates(_0x32cacd,_0x1eb572){return function(_0x15dadf){if(_0x15dadf){return _0x15dadf['update'](_0x32cacd)[_0xe633('0x23')](function(_0x50f6bc){return _0x50f6bc;});}return null;};}function removeEntity(_0x145ad9,_0xda7531){return function(_0xc6734b){if(_0xc6734b){return _0xc6734b[_0xe633('0x24')]()[_0xe633('0x23')](function(){_0x145ad9['status'](0xcc)[_0xe633('0x25')]();});}};}function handleEntityNotFound(_0x2ad369,_0x551d8d){return function(_0x5b5d52){if(!_0x5b5d52){_0x2ad369[_0xe633('0x1a')](0x194);}return _0x5b5d52;};}function handleError(_0x4c10ee,_0x4324dc){_0x4324dc=_0x4324dc||0x1f4;return function(_0x115108){logger[_0xe633('0x26')](_0x115108[_0xe633('0x27')]);if(_0x115108[_0xe633('0x28')]){delete _0x115108[_0xe633('0x28')];}_0x4c10ee[_0xe633('0x1b')](_0x4324dc)[_0xe633('0x29')](_0x115108);};}exports[_0xe633('0x2a')]=function(_0x4c7542,_0x47cdf5){var _0x3bdb96={},_0x3bcf84={},_0x286419={'count':0x0,'rows':[]};var _0x1d9d5d=_[_0xe633('0x2b')](db['SmsQueueReport'][_0xe633('0x2c')],function(_0x5107ff){return{'name':_0x5107ff[_0xe633('0x2d')],'type':_0x5107ff['type'][_0xe633('0x2e')]};});_0x3bcf84[_0xe633('0x2f')]=_[_0xe633('0x2b')](_0x1d9d5d,_0xe633('0x28'));_0x3bcf84[_0xe633('0x30')]=_['keys'](_0x4c7542[_0xe633('0x30')]);_0x3bcf84['filters']=_[_0xe633('0x31')](_0x3bcf84[_0xe633('0x2f')],_0x3bcf84['query']);_0x3bdb96[_0xe633('0x32')]=_[_0xe633('0x31')](_0x3bcf84[_0xe633('0x2f')],qs['fields'](_0x4c7542[_0xe633('0x30')]['fields']));_0x3bdb96['attributes']=_0x3bdb96['attributes'][_0xe633('0x33')]?_0x3bdb96['attributes']:_0x3bcf84[_0xe633('0x2f')];if(!_0x4c7542['query']['hasOwnProperty'](_0xe633('0x34'))){_0x3bdb96[_0xe633('0x1e')]=qs[_0xe633('0x1e')](_0x4c7542['query'][_0xe633('0x1e')]);_0x3bdb96['offset']=qs['offset'](_0x4c7542['query'][_0xe633('0x35')]);}_0x3bdb96[_0xe633('0x36')]=qs[_0xe633('0x37')](_0x4c7542[_0xe633('0x30')][_0xe633('0x37')]);_0x3bdb96[_0xe633('0x38')]=qs['filters'](_[_0xe633('0x39')](_0x4c7542[_0xe633('0x30')],_0x3bcf84[_0xe633('0x3a')]),_0x1d9d5d);if(_0x4c7542[_0xe633('0x30')]['filter']){_0x3bdb96['where']=_[_0xe633('0x3b')](_0x3bdb96['where'],{'$or':_[_0xe633('0x2b')](_0x1d9d5d,function(_0x30b4d1){if(_0x30b4d1[_0xe633('0x3c')]!==_0xe633('0x3d')){var _0x4ebf9c={};_0x4ebf9c[_0x30b4d1['name']]={'$like':'%'+_0x4c7542[_0xe633('0x30')][_0xe633('0x3e')]+'%'};return _0x4ebf9c;}})});}_0x3bdb96=_[_0xe633('0x3b')]({},_0x3bdb96,_0x4c7542[_0xe633('0x3f')]);var _0x57d930={'where':_0x3bdb96['where']};return db[_0xe633('0x40')][_0xe633('0x1f')](_0x57d930)['then'](function(_0x660895){_0x286419[_0xe633('0x1f')]=_0x660895;if(_0x4c7542['query']['includeAll']){_0x3bdb96[_0xe633('0x41')]=[{'all':!![]}];}return db[_0xe633('0x40')][_0xe633('0x42')](_0x3bdb96);})[_0xe633('0x23')](function(_0x38c1b7){_0x286419[_0xe633('0x43')]=_0x38c1b7;return _0x286419;})[_0xe633('0x23')](respondWithFilteredResult(_0x47cdf5,_0x3bdb96))[_0xe633('0x44')](handleError(_0x47cdf5,null));};exports[_0xe633('0x45')]=function(_0x3c53b0,_0x51a3af){var _0x41e4f6={'raw':!![],'where':{'id':_0x3c53b0[_0xe633('0x46')]['id']}},_0x12ad49={};_0x12ad49['model']=_[_0xe633('0x47')](db[_0xe633('0x40')][_0xe633('0x2c')]);_0x12ad49[_0xe633('0x30')]=_[_0xe633('0x47')](_0x3c53b0[_0xe633('0x30')]);_0x12ad49['filters']=_[_0xe633('0x31')](_0x12ad49[_0xe633('0x2f')],_0x12ad49[_0xe633('0x30')]);_0x41e4f6[_0xe633('0x32')]=_[_0xe633('0x31')](_0x12ad49[_0xe633('0x2f')],qs['fields'](_0x3c53b0[_0xe633('0x30')][_0xe633('0x48')]));_0x41e4f6[_0xe633('0x32')]=_0x41e4f6[_0xe633('0x32')]['length']?_0x41e4f6['attributes']:_0x12ad49['model'];if(_0x3c53b0[_0xe633('0x30')][_0xe633('0x49')]){_0x41e4f6[_0xe633('0x41')]=[{'all':!![]}];}_0x41e4f6=_[_0xe633('0x3b')]({},_0x41e4f6,_0x3c53b0['options']);return db[_0xe633('0x40')]['find'](_0x41e4f6)[_0xe633('0x23')](handleEntityNotFound(_0x51a3af,null))['then'](respondWithResult(_0x51a3af,null))['catch'](handleError(_0x51a3af,null));};exports[_0xe633('0x4a')]=function(_0x3bd534,_0x41711f){return db[_0xe633('0x40')][_0xe633('0x4a')](_0x3bd534[_0xe633('0x4b')],{})[_0xe633('0x23')](respondWithResult(_0x41711f,0xc9))[_0xe633('0x44')](handleError(_0x41711f,null));};exports['update']=function(_0x3551b4,_0x4ebf7e){if(_0x3551b4[_0xe633('0x4b')]['id']){delete _0x3551b4['body']['id'];}return db[_0xe633('0x40')]['find']({'where':{'id':_0x3551b4[_0xe633('0x46')]['id']}})[_0xe633('0x23')](handleEntityNotFound(_0x4ebf7e,null))['then'](saveUpdates(_0x3551b4['body'],null))['then'](respondWithResult(_0x4ebf7e,null))[_0xe633('0x44')](handleError(_0x4ebf7e,null));};exports[_0xe633('0x24')]=function(_0x110d11,_0xc1d830){return db[_0xe633('0x40')]['find']({'where':{'id':_0x110d11['params']['id']}})[_0xe633('0x23')](handleEntityNotFound(_0xc1d830,null))['then'](removeEntity(_0xc1d830,null))[_0xe633('0x44')](handleError(_0xc1d830,null));};exports['describe']=function(_0x5149f7,_0x282a91){return db['SmsQueueReport'][_0xe633('0x4c')]()[_0xe633('0x23')](respondWithResult(_0x282a91,null))[_0xe633('0x44')](handleError(_0x282a91,null));}; \ No newline at end of file +var _0x49b4=['find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','include','create','body'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x49b4,0x197));var _0x449b=function(_0x1dc409,_0x16172b){_0x1dc409=_0x1dc409-0x0;var _0x567c33=_0x49b4[_0x1dc409];return _0x567c33;};'use strict';var emlformat=require(_0x449b('0x0'));var rimraf=require(_0x449b('0x1'));var zipdir=require(_0x449b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x449b('0x3'));var moment=require(_0x449b('0x4'));var BPromise=require(_0x449b('0x5'));var Mustache=require(_0x449b('0x6'));var util=require('util');var path=require(_0x449b('0x7'));var sox=require(_0x449b('0x8'));var csv=require('to-csv');var ejs=require(_0x449b('0x9'));var fs=require('fs');var fs_extra=require(_0x449b('0xa'));var _=require('lodash');var squel=require(_0x449b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x449b('0xc'));var toCsv=require(_0x449b('0xd'));var querystring=require(_0x449b('0xe'));var Papa=require(_0x449b('0xf'));var Redis=require(_0x449b('0x10'));var authService=require(_0x449b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x449b('0x12'));var hardwareService=require(_0x449b('0x13'));var logger=require(_0x449b('0x14'))(_0x449b('0x15'));var utils=require(_0x449b('0x16'));var config=require(_0x449b('0x17'));var licenseUtil=require(_0x449b('0x18'));var db=require(_0x449b('0x19'))['db'];function respondWithStatusCode(_0x23dbf7,_0x4953de){_0x4953de=_0x4953de||0xcc;return function(_0x4ccf36){if(_0x4ccf36){return _0x23dbf7[_0x449b('0x1a')](_0x4953de);}return _0x23dbf7[_0x449b('0x1b')](_0x4953de)[_0x449b('0x1c')]();};}function respondWithResult(_0x2fc661,_0x57a691){_0x57a691=_0x57a691||0xc8;return function(_0x4f5765){if(_0x4f5765){return _0x2fc661[_0x449b('0x1b')](_0x57a691)[_0x449b('0x1d')](_0x4f5765);}};}function respondWithFilteredResult(_0x2dbac4,_0x1bc345){return function(_0x50fca1){if(_0x50fca1){var _0x24b328=typeof _0x1bc345[_0x449b('0x1e')]===_0x449b('0x1f')&&typeof _0x1bc345[_0x449b('0x20')]===_0x449b('0x1f');var _0x2485e0=_0x50fca1['count'];var _0x3cad9f=_0x24b328?0x0:_0x1bc345[_0x449b('0x1e')];var _0x36ea95=_0x24b328?_0x50fca1[_0x449b('0x21')]:_0x1bc345[_0x449b('0x1e')]+_0x1bc345[_0x449b('0x20')];var _0x4c8231;if(_0x36ea95>=_0x2485e0){_0x36ea95=_0x2485e0;_0x4c8231=0xc8;}else{_0x4c8231=0xce;}_0x2dbac4[_0x449b('0x1b')](_0x4c8231);return _0x2dbac4[_0x449b('0x22')](_0x449b('0x23'),_0x3cad9f+'-'+_0x36ea95+'/'+_0x2485e0)[_0x449b('0x1d')](_0x50fca1);}return null;};}function patchUpdates(_0x2adb4f){return function(_0x26c56b){try{jsonpatch[_0x449b('0x24')](_0x26c56b,_0x2adb4f,!![]);}catch(_0x1fd4fd){return BPromise[_0x449b('0x25')](_0x1fd4fd);}return _0x26c56b[_0x449b('0x26')]();};}function saveUpdates(_0x4c43b9,_0x5dadf5){return function(_0x17c828){if(_0x17c828){return _0x17c828[_0x449b('0x27')](_0x4c43b9)[_0x449b('0x28')](function(_0x50b4f6){return _0x50b4f6;});}return null;};}function removeEntity(_0x38c5bd,_0x4e36e8){return function(_0xd6222f){if(_0xd6222f){return _0xd6222f[_0x449b('0x29')]()[_0x449b('0x28')](function(){_0x38c5bd[_0x449b('0x1b')](0xcc)[_0x449b('0x1c')]();});}};}function handleEntityNotFound(_0x390084,_0x13b307){return function(_0x48f215){if(!_0x48f215){_0x390084[_0x449b('0x1a')](0x194);}return _0x48f215;};}function handleError(_0x548fc6,_0x4eabb4){_0x4eabb4=_0x4eabb4||0x1f4;return function(_0x3235f7){logger[_0x449b('0x2a')](_0x3235f7[_0x449b('0x2b')]);if(_0x3235f7[_0x449b('0x2c')]){delete _0x3235f7[_0x449b('0x2c')];}_0x548fc6[_0x449b('0x1b')](_0x4eabb4)[_0x449b('0x2d')](_0x3235f7);};}exports[_0x449b('0x2e')]=function(_0x56d07f,_0x4a2628){var _0x2d7169={},_0x303c49={},_0x2967cc={'count':0x0,'rows':[]};var _0x72f323=_[_0x449b('0x2f')](db[_0x449b('0x30')][_0x449b('0x31')],function(_0x21f13f){return{'name':_0x21f13f[_0x449b('0x32')],'type':_0x21f13f['type'][_0x449b('0x33')]};});_0x303c49[_0x449b('0x34')]=_[_0x449b('0x2f')](_0x72f323,'name');_0x303c49[_0x449b('0x35')]=_[_0x449b('0x36')](_0x56d07f[_0x449b('0x35')]);_0x303c49['filters']=_[_0x449b('0x37')](_0x303c49[_0x449b('0x34')],_0x303c49[_0x449b('0x35')]);_0x2d7169[_0x449b('0x38')]=_[_0x449b('0x37')](_0x303c49['model'],qs[_0x449b('0x39')](_0x56d07f['query']['fields']));_0x2d7169[_0x449b('0x38')]=_0x2d7169[_0x449b('0x38')]['length']?_0x2d7169['attributes']:_0x303c49[_0x449b('0x34')];if(!_0x56d07f[_0x449b('0x35')][_0x449b('0x3a')]('nolimit')){_0x2d7169[_0x449b('0x20')]=qs[_0x449b('0x20')](_0x56d07f[_0x449b('0x35')]['limit']);_0x2d7169[_0x449b('0x1e')]=qs['offset'](_0x56d07f[_0x449b('0x35')]['offset']);}_0x2d7169[_0x449b('0x3b')]=qs[_0x449b('0x3c')](_0x56d07f['query'][_0x449b('0x3c')]);_0x2d7169[_0x449b('0x3d')]=qs[_0x449b('0x3e')](_[_0x449b('0x3f')](_0x56d07f[_0x449b('0x35')],_0x303c49[_0x449b('0x3e')]),_0x72f323);if(_0x56d07f['query']['filter']){_0x2d7169['where']=_[_0x449b('0x40')](_0x2d7169[_0x449b('0x3d')],{'$or':_[_0x449b('0x2f')](_0x72f323,function(_0x5b1565){if(_0x5b1565[_0x449b('0x41')]!==_0x449b('0x42')){var _0x7cb3f1={};_0x7cb3f1[_0x5b1565[_0x449b('0x2c')]]={'$like':'%'+_0x56d07f['query'][_0x449b('0x43')]+'%'};return _0x7cb3f1;}})});}_0x2d7169=_['merge']({},_0x2d7169,_0x56d07f[_0x449b('0x44')]);var _0x2c7360={'where':_0x2d7169[_0x449b('0x3d')]};return db[_0x449b('0x30')][_0x449b('0x21')](_0x2c7360)['then'](function(_0x3224ee){_0x2967cc['count']=_0x3224ee;if(_0x56d07f['query'][_0x449b('0x45')]){_0x2d7169['include']=[{'all':!![]}];}return db[_0x449b('0x30')][_0x449b('0x46')](_0x2d7169);})['then'](function(_0x15d6fb){_0x2967cc[_0x449b('0x47')]=_0x15d6fb;return _0x2967cc;})['then'](respondWithFilteredResult(_0x4a2628,_0x2d7169))[_0x449b('0x48')](handleError(_0x4a2628,null));};exports[_0x449b('0x49')]=function(_0x7bf650,_0x58a783){var _0xe9cf79={'raw':!![],'where':{'id':_0x7bf650[_0x449b('0x4a')]['id']}},_0x37f35d={};_0x37f35d[_0x449b('0x34')]=_[_0x449b('0x36')](db['SmsQueueReport'][_0x449b('0x31')]);_0x37f35d['query']=_['keys'](_0x7bf650[_0x449b('0x35')]);_0x37f35d[_0x449b('0x3e')]=_[_0x449b('0x37')](_0x37f35d['model'],_0x37f35d[_0x449b('0x35')]);_0xe9cf79[_0x449b('0x38')]=_['intersection'](_0x37f35d['model'],qs[_0x449b('0x39')](_0x7bf650['query']['fields']));_0xe9cf79[_0x449b('0x38')]=_0xe9cf79[_0x449b('0x38')][_0x449b('0x4b')]?_0xe9cf79[_0x449b('0x38')]:_0x37f35d[_0x449b('0x34')];if(_0x7bf650[_0x449b('0x35')][_0x449b('0x45')]){_0xe9cf79[_0x449b('0x4c')]=[{'all':!![]}];}_0xe9cf79=_[_0x449b('0x40')]({},_0xe9cf79,_0x7bf650[_0x449b('0x44')]);return db['SmsQueueReport']['find'](_0xe9cf79)[_0x449b('0x28')](handleEntityNotFound(_0x58a783,null))[_0x449b('0x28')](respondWithResult(_0x58a783,null))[_0x449b('0x48')](handleError(_0x58a783,null));};exports[_0x449b('0x4d')]=function(_0x3d20d7,_0x355a06){return db[_0x449b('0x30')]['create'](_0x3d20d7['body'],{})['then'](respondWithResult(_0x355a06,0xc9))[_0x449b('0x48')](handleError(_0x355a06,null));};exports[_0x449b('0x27')]=function(_0x510415,_0xd4b42a){if(_0x510415[_0x449b('0x4e')]['id']){delete _0x510415['body']['id'];}return db[_0x449b('0x30')]['find']({'where':{'id':_0x510415[_0x449b('0x4a')]['id']}})[_0x449b('0x28')](handleEntityNotFound(_0xd4b42a,null))[_0x449b('0x28')](saveUpdates(_0x510415['body'],null))[_0x449b('0x28')](respondWithResult(_0xd4b42a,null))[_0x449b('0x48')](handleError(_0xd4b42a,null));};exports['destroy']=function(_0x1d5254,_0x36e114){return db[_0x449b('0x30')][_0x449b('0x4f')]({'where':{'id':_0x1d5254[_0x449b('0x4a')]['id']}})[_0x449b('0x28')](handleEntityNotFound(_0x36e114,null))[_0x449b('0x28')](removeEntity(_0x36e114,null))[_0x449b('0x48')](handleError(_0x36e114,null));};exports['describe']=function(_0x4de4aa,_0x11342d){return db[_0x449b('0x30')][_0x449b('0x50')]()[_0x449b('0x28')](respondWithResult(_0x11342d,null))[_0x449b('0x48')](handleError(_0x11342d,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 4e10ae7..4158757 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 _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x5edd05,_0x8ac1d3){var _0x19b62e=function(_0x2a25d5){while(--_0x2a25d5){_0x5edd05['push'](_0x5edd05['shift']());}};_0x19b62e(++_0x8ac1d3);}(_0xe706,0xa3));var _0x6e70=function(_0x18a63a,_0x259cec){_0x18a63a=_0x18a63a-0x0;var _0x2cca04=_0xe706[_0x18a63a];return _0x2cca04;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 9a6f745..6b1e1ac 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 _0xa20d=['SmsQueueReport,\x20%s,\x20%s','result','catch','CreateSmsQueueReport','create','body','options','then','stringify','UpdateSmsQueueReport','SmsQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2a6d45,_0x3c9321){var _0x295253=function(_0x51d622){while(--_0x51d622){_0x2a6d45['push'](_0x2a6d45['shift']());}};_0x295253(++_0x3c9321);}(_0xa20d,0xc9));var _0xda20=function(_0x2d4ef0,_0x354a35){_0x2d4ef0=_0x2d4ef0-0x0;var _0x1baf56=_0xa20d[_0x2d4ef0];return _0x1baf56;};'use strict';var _=require(_0xda20('0x0'));var util=require(_0xda20('0x1'));var moment=require(_0xda20('0x2'));var BPromise=require(_0xda20('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda20('0x4'));var db=require(_0xda20('0x5'))['db'];var utils=require(_0xda20('0x6'));var logger=require(_0xda20('0x7'))(_0xda20('0x8'));var config=require(_0xda20('0x9'));var jayson=require(_0xda20('0xa'));var client=jayson[_0xda20('0xb')][_0xda20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xfbe235,_0x530b6e,_0x2098b8){return new BPromise(function(_0x524ae8,_0x8d8d1d){return client[_0xda20('0xd')](_0xfbe235,_0x2098b8)['then'](function(_0x2f8c86){logger[_0xda20('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x530b6e,_0xda20('0xf'));logger[_0xda20('0x10')](_0xda20('0x11'),_0x530b6e,_0xda20('0xf'),JSON['stringify'](_0x2f8c86));if(_0x2f8c86[_0xda20('0x12')]){if(_0x2f8c86[_0xda20('0x12')][_0xda20('0x13')]===0x1f4){logger[_0xda20('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x530b6e,_0x2f8c86[_0xda20('0x12')]['message']);return _0x8d8d1d(_0x2f8c86[_0xda20('0x12')][_0xda20('0x14')]);}logger[_0xda20('0x12')](_0xda20('0x15'),_0x530b6e,_0x2f8c86['error'][_0xda20('0x14')]);return _0x524ae8(_0x2f8c86[_0xda20('0x12')][_0xda20('0x14')]);}else{logger[_0xda20('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x530b6e,'request\x20sent');_0x524ae8(_0x2f8c86[_0xda20('0x16')][_0xda20('0x14')]);}})[_0xda20('0x17')](function(_0xf4ff31){logger[_0xda20('0x12')](_0xda20('0x15'),_0x530b6e,_0xf4ff31);_0x8d8d1d(_0xf4ff31);});});}exports[_0xda20('0x18')]=function(_0x19bedc){var _0x107b0d=this;return new Promise(function(_0x3103a7,_0x6eb452){return db['SmsQueueReport'][_0xda20('0x19')](_0x19bedc[_0xda20('0x1a')],{'raw':_0x19bedc[_0xda20('0x1b')]?_0x19bedc[_0xda20('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xda20('0x1c')](function(_0x24a7b6){logger[_0xda20('0xe')](_0xda20('0x18'),_0x19bedc);logger[_0xda20('0x10')]('CreateSmsQueueReport',_0x19bedc,JSON[_0xda20('0x1d')](_0x24a7b6));_0x3103a7(_0x24a7b6);})[_0xda20('0x17')](function(_0x494d65){logger[_0xda20('0x12')]('CreateSmsQueueReport',_0x494d65[_0xda20('0x14')],_0x19bedc);_0x6eb452(_0x107b0d[_0xda20('0x12')](0x1f4,_0x494d65['message']));});});};exports[_0xda20('0x1e')]=function(_0x71d76c){var _0x20018a=this;return new Promise(function(_0xea9e02,_0x9362ff){return db[_0xda20('0x1f')][_0xda20('0x20')](_0x71d76c[_0xda20('0x1a')],{'raw':_0x71d76c[_0xda20('0x1b')]?_0x71d76c[_0xda20('0x1b')][_0xda20('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x71d76c['options']?_0x71d76c[_0xda20('0x1b')][_0xda20('0x22')]||null:null,'attributes':_0x71d76c[_0xda20('0x1b')]?_0x71d76c[_0xda20('0x1b')][_0xda20('0x23')]||null:null,'limit':_0x71d76c[_0xda20('0x1b')]?_0x71d76c[_0xda20('0x1b')][_0xda20('0x24')]||null:null})[_0xda20('0x1c')](function(_0x8a23cc){logger[_0xda20('0xe')](_0xda20('0x1e'),_0x71d76c);logger['debug'](_0xda20('0x1e'),_0x71d76c,JSON[_0xda20('0x1d')](_0x8a23cc));_0xea9e02(_0x8a23cc);})['catch'](function(_0x5befa6){logger[_0xda20('0x12')]('UpdateSmsQueueReport',_0x5befa6[_0xda20('0x14')],_0x71d76c);_0x9362ff(_0x20018a[_0xda20('0x12')](0x1f4,_0x5befa6[_0xda20('0x14')]));});});}; \ No newline at end of file +var _0x9a8a=['SmsQueueReport','create','options','raw','body','where','attributes','limit','stringify','UpdateSmsQueueReport','lodash','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','SmsQueueReport,\x20%s,\x20%s','info','catch','CreateSmsQueueReport'];(function(_0x2b78e5,_0x3126f8){var _0xa8d52d=function(_0x51fd7f){while(--_0x51fd7f){_0x2b78e5['push'](_0x2b78e5['shift']());}};_0xa8d52d(++_0x3126f8);}(_0x9a8a,0xb8));var _0xa9a8=function(_0x304ed5,_0x4c526a){_0x304ed5=_0x304ed5-0x0;var _0x17c895=_0x9a8a[_0x304ed5];return _0x17c895;};'use strict';var _=require(_0xa9a8('0x0'));var util=require('util');var moment=require(_0xa9a8('0x1'));var BPromise=require('bluebird');var rs=require(_0xa9a8('0x2'));var fs=require('fs');var Redis=require(_0xa9a8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9a8('0x4'));var logger=require('../../config/logger')(_0xa9a8('0x5'));var config=require('../../config/environment');var jayson=require(_0xa9a8('0x6'));var client=jayson[_0xa9a8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9bffa8,_0x5c136e,_0x869a82){return new BPromise(function(_0x4122cb,_0x39b752){return client['request'](_0x9bffa8,_0x869a82)[_0xa9a8('0x8')](function(_0x33e659){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x5c136e,_0xa9a8('0x9'));logger[_0xa9a8('0xa')](_0xa9a8('0xb'),_0x5c136e,_0xa9a8('0x9'),JSON['stringify'](_0x33e659));if(_0x33e659[_0xa9a8('0xc')]){if(_0x33e659[_0xa9a8('0xc')][_0xa9a8('0xd')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x5c136e,_0x33e659[_0xa9a8('0xc')][_0xa9a8('0xe')]);return _0x39b752(_0x33e659['error'][_0xa9a8('0xe')]);}logger[_0xa9a8('0xc')](_0xa9a8('0xf'),_0x5c136e,_0x33e659['error'][_0xa9a8('0xe')]);return _0x4122cb(_0x33e659['error'][_0xa9a8('0xe')]);}else{logger[_0xa9a8('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x5c136e,_0xa9a8('0x9'));_0x4122cb(_0x33e659['result'][_0xa9a8('0xe')]);}})[_0xa9a8('0x11')](function(_0x54e8ee){logger['error'](_0xa9a8('0xf'),_0x5c136e,_0x54e8ee);_0x39b752(_0x54e8ee);});});}exports[_0xa9a8('0x12')]=function(_0x2f2c51){var _0xa8c58e=this;return new Promise(function(_0x1bc57b,_0x162098){return db[_0xa9a8('0x13')][_0xa9a8('0x14')](_0x2f2c51['body'],{'raw':_0x2f2c51[_0xa9a8('0x15')]?_0x2f2c51[_0xa9a8('0x15')][_0xa9a8('0x16')]===undefined?!![]:![]:!![]})[_0xa9a8('0x8')](function(_0x59b41e){logger[_0xa9a8('0x10')](_0xa9a8('0x12'),_0x2f2c51);logger[_0xa9a8('0xa')]('CreateSmsQueueReport',_0x2f2c51,JSON['stringify'](_0x59b41e));_0x1bc57b(_0x59b41e);})[_0xa9a8('0x11')](function(_0x3a17ae){logger[_0xa9a8('0xc')](_0xa9a8('0x12'),_0x3a17ae[_0xa9a8('0xe')],_0x2f2c51);_0x162098(_0xa8c58e[_0xa9a8('0xc')](0x1f4,_0x3a17ae[_0xa9a8('0xe')]));});});};exports['UpdateSmsQueueReport']=function(_0x2cacf6){var _0x4107fb=this;return new Promise(function(_0x124705,_0x1609b1){return db[_0xa9a8('0x13')]['update'](_0x2cacf6[_0xa9a8('0x17')],{'raw':_0x2cacf6[_0xa9a8('0x15')]?_0x2cacf6['options'][_0xa9a8('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cacf6[_0xa9a8('0x15')]?_0x2cacf6[_0xa9a8('0x15')][_0xa9a8('0x18')]||null:null,'attributes':_0x2cacf6['options']?_0x2cacf6['options'][_0xa9a8('0x19')]||null:null,'limit':_0x2cacf6['options']?_0x2cacf6[_0xa9a8('0x15')][_0xa9a8('0x1a')]||null:null})['then'](function(_0x5a0059){logger['info']('UpdateSmsQueueReport',_0x2cacf6);logger[_0xa9a8('0xa')]('UpdateSmsQueueReport',_0x2cacf6,JSON[_0xa9a8('0x1b')](_0x5a0059));_0x124705(_0x5a0059);})['catch'](function(_0x24a524){logger[_0xa9a8('0xc')](_0xa9a8('0x1c'),_0x24a524[_0xa9a8('0xe')],_0x2cacf6);_0x1609b1(_0x4107fb[_0xa9a8('0xc')](0x1f4,_0x24a524['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 260084f..b736549 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 _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x21dc1f,_0x3c8b7c){var _0x3d45d9=function(_0x1b8e53){while(--_0x1b8e53){_0x21dc1f['push'](_0x21dc1f['shift']());}};_0x3d45d9(++_0x3c8b7c);}(_0xabce,0x103));var _0xeabc=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xabce[_0x32d457];return _0x338386;};'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('./smsTransferReport.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',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 _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(_0x380abb,_0x3a50ec){var _0x14d6d3=function(_0x2bdf46){while(--_0x2bdf46){_0x380abb['push'](_0x380abb['shift']());}};_0x14d6d3(++_0x3a50ec);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x31282b,_0xa476db){_0x31282b=_0x31282b-0x0;var _0x19c632=_0xd0bb[_0x31282b];return _0x19c632;};'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('./smsTransferReport.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/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index ccbf38c..c58e7ee 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4b426f,_0x415ca5){_0x4b426f=_0x4b426f-0x0;var _0xf7f06e=_0xb43b[_0x4b426f];return _0xf7f06e;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x25184a,_0x410347){var _0x3e517a=function(_0x523608){while(--_0x523608){_0x25184a['push'](_0x25184a['shift']());}};_0x3e517a(++_0x410347);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0x4b84[_0x3da832];return _0xe602f2;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 93c376c..8d029b0 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 _0xf364=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','options','SmsTransferReport','includeAll','findAll','rows','show','length','include','find','catch','create','body','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x20fdc1,_0xde1296){var _0x25397c=function(_0x814b51){while(--_0x814b51){_0x20fdc1['push'](_0x20fdc1['shift']());}};_0x25397c(++_0xde1296);}(_0xf364,0x164));var _0x4f36=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xf364[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require(_0x4f36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4f36('0x1'));var jsonpatch=require(_0x4f36('0x2'));var rp=require('request-promise');var moment=require(_0x4f36('0x3'));var BPromise=require(_0x4f36('0x4'));var Mustache=require(_0x4f36('0x5'));var util=require(_0x4f36('0x6'));var path=require('path');var sox=require(_0x4f36('0x7'));var csv=require(_0x4f36('0x8'));var ejs=require(_0x4f36('0x9'));var fs=require('fs');var fs_extra=require(_0x4f36('0xa'));var _=require(_0x4f36('0xb'));var squel=require(_0x4f36('0xc'));var crypto=require(_0x4f36('0xd'));var jsforce=require(_0x4f36('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4f36('0x8'));var querystring=require(_0x4f36('0xf'));var Papa=require(_0x4f36('0x10'));var Redis=require(_0x4f36('0x11'));var authService=require(_0x4f36('0x12'));var qs=require(_0x4f36('0x13'));var as=require(_0x4f36('0x14'));var hardwareService=require(_0x4f36('0x15'));var logger=require(_0x4f36('0x16'))(_0x4f36('0x17'));var utils=require(_0x4f36('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4f36('0x19'));var db=require(_0x4f36('0x1a'))['db'];function respondWithStatusCode(_0x26f173,_0x226a41){_0x226a41=_0x226a41||0xcc;return function(_0x378721){if(_0x378721){return _0x26f173[_0x4f36('0x1b')](_0x226a41);}return _0x26f173[_0x4f36('0x1c')](_0x226a41)[_0x4f36('0x1d')]();};}function respondWithResult(_0x59fe47,_0x475d97){_0x475d97=_0x475d97||0xc8;return function(_0x12dbdb){if(_0x12dbdb){return _0x59fe47[_0x4f36('0x1c')](_0x475d97)[_0x4f36('0x1e')](_0x12dbdb);}};}function respondWithFilteredResult(_0xb9eac8,_0x4bf281){return function(_0x402228){if(_0x402228){var _0x14c384=typeof _0x4bf281[_0x4f36('0x1f')]===_0x4f36('0x20')&&typeof _0x4bf281[_0x4f36('0x21')]===_0x4f36('0x20');var _0x32cf15=_0x402228[_0x4f36('0x22')];var _0x1e47cb=_0x14c384?0x0:_0x4bf281[_0x4f36('0x1f')];var _0x141104=_0x14c384?_0x402228[_0x4f36('0x22')]:_0x4bf281[_0x4f36('0x1f')]+_0x4bf281[_0x4f36('0x21')];var _0x1a022f;if(_0x141104>=_0x32cf15){_0x141104=_0x32cf15;_0x1a022f=0xc8;}else{_0x1a022f=0xce;}_0xb9eac8[_0x4f36('0x1c')](_0x1a022f);return _0xb9eac8[_0x4f36('0x23')](_0x4f36('0x24'),_0x1e47cb+'-'+_0x141104+'/'+_0x32cf15)[_0x4f36('0x1e')](_0x402228);}return null;};}function patchUpdates(_0x111a8e){return function(_0x3c8202){try{jsonpatch['apply'](_0x3c8202,_0x111a8e,!![]);}catch(_0x84df8){return BPromise[_0x4f36('0x25')](_0x84df8);}return _0x3c8202[_0x4f36('0x26')]();};}function saveUpdates(_0x1333b0,_0x6600e5){return function(_0x5cc760){if(_0x5cc760){return _0x5cc760[_0x4f36('0x27')](_0x1333b0)[_0x4f36('0x28')](function(_0x473b4b){return _0x473b4b;});}return null;};}function removeEntity(_0x1af0dd,_0x4e38c8){return function(_0x4613df){if(_0x4613df){return _0x4613df[_0x4f36('0x29')]()[_0x4f36('0x28')](function(){_0x1af0dd[_0x4f36('0x1c')](0xcc)[_0x4f36('0x1d')]();});}};}function handleEntityNotFound(_0x5e7ce3,_0x3590d1){return function(_0x1702bb){if(!_0x1702bb){_0x5e7ce3[_0x4f36('0x1b')](0x194);}return _0x1702bb;};}function handleError(_0xc6f868,_0xcef2b3){_0xcef2b3=_0xcef2b3||0x1f4;return function(_0x4de90d){logger[_0x4f36('0x2a')](_0x4de90d[_0x4f36('0x2b')]);if(_0x4de90d['name']){delete _0x4de90d[_0x4f36('0x2c')];}_0xc6f868[_0x4f36('0x1c')](_0xcef2b3)['send'](_0x4de90d);};}exports['index']=function(_0x2bef1a,_0x1b6f4e){var _0x515662={},_0x9d0e80={},_0x328e55={'count':0x0,'rows':[]};var _0x560901=_[_0x4f36('0x2d')](db['SmsTransferReport'][_0x4f36('0x2e')],function(_0xf6672e){return{'name':_0xf6672e[_0x4f36('0x2f')],'type':_0xf6672e[_0x4f36('0x30')][_0x4f36('0x31')]};});_0x9d0e80[_0x4f36('0x32')]=_[_0x4f36('0x2d')](_0x560901,_0x4f36('0x2c'));_0x9d0e80['query']=_[_0x4f36('0x33')](_0x2bef1a[_0x4f36('0x34')]);_0x9d0e80[_0x4f36('0x35')]=_[_0x4f36('0x36')](_0x9d0e80['model'],_0x9d0e80['query']);_0x515662[_0x4f36('0x37')]=_[_0x4f36('0x36')](_0x9d0e80[_0x4f36('0x32')],qs[_0x4f36('0x38')](_0x2bef1a[_0x4f36('0x34')][_0x4f36('0x38')]));_0x515662[_0x4f36('0x37')]=_0x515662[_0x4f36('0x37')]['length']?_0x515662['attributes']:_0x9d0e80[_0x4f36('0x32')];if(!_0x2bef1a['query']['hasOwnProperty']('nolimit')){_0x515662[_0x4f36('0x21')]=qs[_0x4f36('0x21')](_0x2bef1a[_0x4f36('0x34')]['limit']);_0x515662[_0x4f36('0x1f')]=qs[_0x4f36('0x1f')](_0x2bef1a['query'][_0x4f36('0x1f')]);}_0x515662[_0x4f36('0x39')]=qs['sort'](_0x2bef1a[_0x4f36('0x34')][_0x4f36('0x3a')]);_0x515662[_0x4f36('0x3b')]=qs[_0x4f36('0x35')](_[_0x4f36('0x3c')](_0x2bef1a[_0x4f36('0x34')],_0x9d0e80['filters']),_0x560901);if(_0x2bef1a['query'][_0x4f36('0x3d')]){_0x515662[_0x4f36('0x3b')]=_[_0x4f36('0x3e')](_0x515662[_0x4f36('0x3b')],{'$or':_[_0x4f36('0x2d')](_0x560901,function(_0x58fda0){if(_0x58fda0['type']!=='VIRTUAL'){var _0x53bf26={};_0x53bf26[_0x58fda0[_0x4f36('0x2c')]]={'$like':'%'+_0x2bef1a[_0x4f36('0x34')][_0x4f36('0x3d')]+'%'};return _0x53bf26;}})});}_0x515662=_[_0x4f36('0x3e')]({},_0x515662,_0x2bef1a[_0x4f36('0x3f')]);var _0x38a480={'where':_0x515662['where']};return db[_0x4f36('0x40')][_0x4f36('0x22')](_0x38a480)[_0x4f36('0x28')](function(_0x434e40){_0x328e55[_0x4f36('0x22')]=_0x434e40;if(_0x2bef1a[_0x4f36('0x34')][_0x4f36('0x41')]){_0x515662['include']=[{'all':!![]}];}return db[_0x4f36('0x40')][_0x4f36('0x42')](_0x515662);})['then'](function(_0x2917f4){_0x328e55[_0x4f36('0x43')]=_0x2917f4;return _0x328e55;})[_0x4f36('0x28')](respondWithFilteredResult(_0x1b6f4e,_0x515662))['catch'](handleError(_0x1b6f4e,null));};exports[_0x4f36('0x44')]=function(_0x767e69,_0x9a7a78){var _0x3d8cdf={'raw':!![],'where':{'id':_0x767e69['params']['id']}},_0x2ddfb0={};_0x2ddfb0[_0x4f36('0x32')]=_[_0x4f36('0x33')](db['SmsTransferReport'][_0x4f36('0x2e')]);_0x2ddfb0[_0x4f36('0x34')]=_[_0x4f36('0x33')](_0x767e69[_0x4f36('0x34')]);_0x2ddfb0[_0x4f36('0x35')]=_[_0x4f36('0x36')](_0x2ddfb0['model'],_0x2ddfb0[_0x4f36('0x34')]);_0x3d8cdf[_0x4f36('0x37')]=_[_0x4f36('0x36')](_0x2ddfb0[_0x4f36('0x32')],qs[_0x4f36('0x38')](_0x767e69[_0x4f36('0x34')]['fields']));_0x3d8cdf[_0x4f36('0x37')]=_0x3d8cdf[_0x4f36('0x37')][_0x4f36('0x45')]?_0x3d8cdf[_0x4f36('0x37')]:_0x2ddfb0[_0x4f36('0x32')];if(_0x767e69['query'][_0x4f36('0x41')]){_0x3d8cdf[_0x4f36('0x46')]=[{'all':!![]}];}_0x3d8cdf=_['merge']({},_0x3d8cdf,_0x767e69[_0x4f36('0x3f')]);return db[_0x4f36('0x40')][_0x4f36('0x47')](_0x3d8cdf)[_0x4f36('0x28')](handleEntityNotFound(_0x9a7a78,null))[_0x4f36('0x28')](respondWithResult(_0x9a7a78,null))[_0x4f36('0x48')](handleError(_0x9a7a78,null));};exports[_0x4f36('0x49')]=function(_0x2ecb8a,_0x411ae8){return db[_0x4f36('0x40')][_0x4f36('0x49')](_0x2ecb8a[_0x4f36('0x4a')],{})[_0x4f36('0x28')](respondWithResult(_0x411ae8,0xc9))[_0x4f36('0x48')](handleError(_0x411ae8,null));};exports[_0x4f36('0x27')]=function(_0x47d6f3,_0x21e506){if(_0x47d6f3[_0x4f36('0x4a')]['id']){delete _0x47d6f3[_0x4f36('0x4a')]['id'];}return db[_0x4f36('0x40')]['find']({'where':{'id':_0x47d6f3[_0x4f36('0x4b')]['id']}})[_0x4f36('0x28')](handleEntityNotFound(_0x21e506,null))[_0x4f36('0x28')](saveUpdates(_0x47d6f3[_0x4f36('0x4a')],null))[_0x4f36('0x28')](respondWithResult(_0x21e506,null))[_0x4f36('0x48')](handleError(_0x21e506,null));};exports[_0x4f36('0x29')]=function(_0x4e97b8,_0x204bc2){return db[_0x4f36('0x40')][_0x4f36('0x47')]({'where':{'id':_0x4e97b8[_0x4f36('0x4b')]['id']}})[_0x4f36('0x28')](handleEntityNotFound(_0x204bc2,null))[_0x4f36('0x28')](removeEntity(_0x204bc2,null))[_0x4f36('0x48')](handleError(_0x204bc2,null));};exports[_0x4f36('0x4c')]=function(_0x13411d,_0x4c4f6b){return db['SmsTransferReport']['describe']()[_0x4f36('0x28')](respondWithResult(_0x4c4f6b,null))[_0x4f36('0x48')](handleError(_0x4c4f6b,null));}; \ No newline at end of file +var _0x364d=['pick','filter','merge','VIRTUAL','SmsTransferReport','includeAll','include','findAll','rows','catch','rawAttributes','create','body','find','params','describe','eml-format','fast-json-patch','moment','bluebird','to-csv','ejs','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','type','key','map','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x364d,0x1d0));var _0xd364=function(_0x125f14,_0x24b871){_0x125f14=_0x125f14-0x0;var _0x14a793=_0x364d[_0x125f14];return _0x14a793;};'use strict';var emlformat=require(_0xd364('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd364('0x1'));var rp=require('request-promise');var moment=require(_0xd364('0x2'));var BPromise=require(_0xd364('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd364('0x4'));var ejs=require(_0xd364('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd364('0x6'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd364('0x7'));var toCsv=require(_0xd364('0x4'));var querystring=require(_0xd364('0x8'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd364('0x9'));var qs=require(_0xd364('0xa'));var as=require(_0xd364('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd364('0xc'))(_0xd364('0xd'));var utils=require('../../config/utils');var config=require(_0xd364('0xe'));var licenseUtil=require('../../config/license/util');var db=require(_0xd364('0xf'))['db'];function respondWithStatusCode(_0x5c794e,_0x3ae586){_0x3ae586=_0x3ae586||0xcc;return function(_0x5f3c4f){if(_0x5f3c4f){return _0x5c794e[_0xd364('0x10')](_0x3ae586);}return _0x5c794e[_0xd364('0x11')](_0x3ae586)['end']();};}function respondWithResult(_0x2af5bf,_0x3ab67b){_0x3ab67b=_0x3ab67b||0xc8;return function(_0x15e7a8){if(_0x15e7a8){return _0x2af5bf[_0xd364('0x11')](_0x3ab67b)['json'](_0x15e7a8);}};}function respondWithFilteredResult(_0x186fd4,_0x248f69){return function(_0x22e21d){if(_0x22e21d){var _0x194bf9=typeof _0x248f69[_0xd364('0x12')]===_0xd364('0x13')&&typeof _0x248f69[_0xd364('0x14')]===_0xd364('0x13');var _0x39c22d=_0x22e21d[_0xd364('0x15')];var _0x3fba35=_0x194bf9?0x0:_0x248f69[_0xd364('0x12')];var _0x45d232=_0x194bf9?_0x22e21d[_0xd364('0x15')]:_0x248f69[_0xd364('0x12')]+_0x248f69['limit'];var _0x9ad088;if(_0x45d232>=_0x39c22d){_0x45d232=_0x39c22d;_0x9ad088=0xc8;}else{_0x9ad088=0xce;}_0x186fd4[_0xd364('0x11')](_0x9ad088);return _0x186fd4['set'](_0xd364('0x16'),_0x3fba35+'-'+_0x45d232+'/'+_0x39c22d)[_0xd364('0x17')](_0x22e21d);}return null;};}function patchUpdates(_0x3a6157){return function(_0x55e39c){try{jsonpatch[_0xd364('0x18')](_0x55e39c,_0x3a6157,!![]);}catch(_0xeaf6c6){return BPromise[_0xd364('0x19')](_0xeaf6c6);}return _0x55e39c[_0xd364('0x1a')]();};}function saveUpdates(_0x1468fd,_0x13d440){return function(_0x5bbea8){if(_0x5bbea8){return _0x5bbea8[_0xd364('0x1b')](_0x1468fd)[_0xd364('0x1c')](function(_0x2b1f5f){return _0x2b1f5f;});}return null;};}function removeEntity(_0x587317,_0x34b313){return function(_0x19dd18){if(_0x19dd18){return _0x19dd18[_0xd364('0x1d')]()[_0xd364('0x1c')](function(){_0x587317[_0xd364('0x11')](0xcc)[_0xd364('0x1e')]();});}};}function handleEntityNotFound(_0x56453f,_0x100ecc){return function(_0x40d8e1){if(!_0x40d8e1){_0x56453f[_0xd364('0x10')](0x194);}return _0x40d8e1;};}function handleError(_0x9d62b0,_0x105f13){_0x105f13=_0x105f13||0x1f4;return function(_0x2e34c0){logger['error'](_0x2e34c0['stack']);if(_0x2e34c0['name']){delete _0x2e34c0[_0xd364('0x1f')];}_0x9d62b0[_0xd364('0x11')](_0x105f13)[_0xd364('0x20')](_0x2e34c0);};}exports['index']=function(_0x4d31ba,_0x3cabc8){var _0x4914e3={},_0xc1e64e={},_0x568b37={'count':0x0,'rows':[]};var _0x2b4741=_['map'](db['SmsTransferReport']['rawAttributes'],function(_0x53bc2b){return{'name':_0x53bc2b['fieldName'],'type':_0x53bc2b[_0xd364('0x21')][_0xd364('0x22')]};});_0xc1e64e['model']=_[_0xd364('0x23')](_0x2b4741,'name');_0xc1e64e['query']=_[_0xd364('0x24')](_0x4d31ba['query']);_0xc1e64e[_0xd364('0x25')]=_[_0xd364('0x26')](_0xc1e64e[_0xd364('0x27')],_0xc1e64e[_0xd364('0x28')]);_0x4914e3[_0xd364('0x29')]=_['intersection'](_0xc1e64e['model'],qs[_0xd364('0x2a')](_0x4d31ba[_0xd364('0x28')]['fields']));_0x4914e3[_0xd364('0x29')]=_0x4914e3[_0xd364('0x29')][_0xd364('0x2b')]?_0x4914e3[_0xd364('0x29')]:_0xc1e64e['model'];if(!_0x4d31ba[_0xd364('0x28')][_0xd364('0x2c')](_0xd364('0x2d'))){_0x4914e3[_0xd364('0x14')]=qs[_0xd364('0x14')](_0x4d31ba[_0xd364('0x28')][_0xd364('0x14')]);_0x4914e3['offset']=qs[_0xd364('0x12')](_0x4d31ba['query'][_0xd364('0x12')]);}_0x4914e3['order']=qs[_0xd364('0x2e')](_0x4d31ba[_0xd364('0x28')][_0xd364('0x2e')]);_0x4914e3[_0xd364('0x2f')]=qs[_0xd364('0x25')](_[_0xd364('0x30')](_0x4d31ba[_0xd364('0x28')],_0xc1e64e[_0xd364('0x25')]),_0x2b4741);if(_0x4d31ba[_0xd364('0x28')][_0xd364('0x31')]){_0x4914e3['where']=_[_0xd364('0x32')](_0x4914e3[_0xd364('0x2f')],{'$or':_[_0xd364('0x23')](_0x2b4741,function(_0x319428){if(_0x319428[_0xd364('0x21')]!==_0xd364('0x33')){var _0x7e8474={};_0x7e8474[_0x319428[_0xd364('0x1f')]]={'$like':'%'+_0x4d31ba[_0xd364('0x28')][_0xd364('0x31')]+'%'};return _0x7e8474;}})});}_0x4914e3=_[_0xd364('0x32')]({},_0x4914e3,_0x4d31ba['options']);var _0x153e10={'where':_0x4914e3[_0xd364('0x2f')]};return db[_0xd364('0x34')][_0xd364('0x15')](_0x153e10)[_0xd364('0x1c')](function(_0x1df1eb){_0x568b37[_0xd364('0x15')]=_0x1df1eb;if(_0x4d31ba[_0xd364('0x28')][_0xd364('0x35')]){_0x4914e3[_0xd364('0x36')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xd364('0x37')](_0x4914e3);})['then'](function(_0x162861){_0x568b37[_0xd364('0x38')]=_0x162861;return _0x568b37;})[_0xd364('0x1c')](respondWithFilteredResult(_0x3cabc8,_0x4914e3))[_0xd364('0x39')](handleError(_0x3cabc8,null));};exports['show']=function(_0x24c7ac,_0x1e8b4c){var _0x24e5af={'raw':!![],'where':{'id':_0x24c7ac['params']['id']}},_0x462bb8={};_0x462bb8[_0xd364('0x27')]=_[_0xd364('0x24')](db[_0xd364('0x34')][_0xd364('0x3a')]);_0x462bb8[_0xd364('0x28')]=_[_0xd364('0x24')](_0x24c7ac[_0xd364('0x28')]);_0x462bb8['filters']=_[_0xd364('0x26')](_0x462bb8[_0xd364('0x27')],_0x462bb8[_0xd364('0x28')]);_0x24e5af[_0xd364('0x29')]=_[_0xd364('0x26')](_0x462bb8[_0xd364('0x27')],qs[_0xd364('0x2a')](_0x24c7ac[_0xd364('0x28')][_0xd364('0x2a')]));_0x24e5af[_0xd364('0x29')]=_0x24e5af[_0xd364('0x29')][_0xd364('0x2b')]?_0x24e5af['attributes']:_0x462bb8[_0xd364('0x27')];if(_0x24c7ac[_0xd364('0x28')][_0xd364('0x35')]){_0x24e5af[_0xd364('0x36')]=[{'all':!![]}];}_0x24e5af=_['merge']({},_0x24e5af,_0x24c7ac['options']);return db[_0xd364('0x34')]['find'](_0x24e5af)['then'](handleEntityNotFound(_0x1e8b4c,null))[_0xd364('0x1c')](respondWithResult(_0x1e8b4c,null))[_0xd364('0x39')](handleError(_0x1e8b4c,null));};exports[_0xd364('0x3b')]=function(_0x4941b7,_0x532be5){return db[_0xd364('0x34')][_0xd364('0x3b')](_0x4941b7[_0xd364('0x3c')],{})[_0xd364('0x1c')](respondWithResult(_0x532be5,0xc9))[_0xd364('0x39')](handleError(_0x532be5,null));};exports[_0xd364('0x1b')]=function(_0x46193d,_0x495b94){if(_0x46193d[_0xd364('0x3c')]['id']){delete _0x46193d['body']['id'];}return db[_0xd364('0x34')][_0xd364('0x3d')]({'where':{'id':_0x46193d[_0xd364('0x3e')]['id']}})[_0xd364('0x1c')](handleEntityNotFound(_0x495b94,null))[_0xd364('0x1c')](saveUpdates(_0x46193d[_0xd364('0x3c')],null))[_0xd364('0x1c')](respondWithResult(_0x495b94,null))['catch'](handleError(_0x495b94,null));};exports['destroy']=function(_0x54420f,_0xc0e6c3){return db[_0xd364('0x34')][_0xd364('0x3d')]({'where':{'id':_0x54420f['params']['id']}})[_0xd364('0x1c')](handleEntityNotFound(_0xc0e6c3,null))[_0xd364('0x1c')](removeEntity(_0xc0e6c3,null))[_0xd364('0x39')](handleError(_0xc0e6c3,null));};exports[_0xd364('0x3f')]=function(_0x1e1caf,_0x5a4163){return db[_0xd364('0x34')]['describe']()['then'](respondWithResult(_0x5a4163,null))['catch'](handleError(_0x5a4163,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index a44c09f..4c0be32 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 _0x22f6=['bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','moment'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x22f6,0x10e));var _0x622f=function(_0x34ab14,_0x228d49){_0x34ab14=_0x34ab14-0x0;var _0x52c36b=_0x22f6[_0x34ab14];return _0x52c36b;};'use strict';var _=require(_0x622f('0x0'));var util=require('util');var logger=require(_0x622f('0x1'))('api');var moment=require(_0x622f('0x2'));var BPromise=require(_0x622f('0x3'));var rp=require(_0x622f('0x4'));var fs=require('fs');var path=require(_0x622f('0x5'));var rimraf=require(_0x622f('0x6'));var config=require(_0x622f('0x7'));var attributes=require(_0x622f('0x8'));module[_0x622f('0x9')]=function(_0x659c64,_0x342d96){return _0x659c64['define'](_0x622f('0xa'),attributes,{'tableName':_0x622f('0xb'),'paranoid':![],'indexes':[{'name':_0x622f('0xc'),'fields':[_0x622f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce50=['report_sms_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','rimraf','exports','define'];(function(_0x1f5fa5,_0x4b7742){var _0x314136=function(_0x5e4815){while(--_0x5e4815){_0x1f5fa5['push'](_0x1f5fa5['shift']());}};_0x314136(++_0x4b7742);}(_0xce50,0x1d8));var _0x0ce5=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xce50[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0x0ce5('0x0'));var logger=require(_0x0ce5('0x1'))(_0x0ce5('0x2'));var moment=require(_0x0ce5('0x3'));var BPromise=require(_0x0ce5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0ce5('0x5'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0x0ce5('0x6')]=function(_0x42fadd,_0x69892c){return _0x42fadd[_0x0ce5('0x7')]('SmsTransferReport',attributes,{'tableName':_0x0ce5('0x8'),'paranoid':![],'indexes':[{'name':_0x0ce5('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 6d7b7d5..4540a98 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 _0xdc03=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','ioredis'];(function(_0x4f7112,_0x4cb6bf){var _0x51d64c=function(_0x12c987){while(--_0x12c987){_0x4f7112['push'](_0x4f7112['shift']());}};_0x51d64c(++_0x4cb6bf);}(_0xdc03,0x65));var _0x3dc0=function(_0x1f5ea7,_0x524548){_0x1f5ea7=_0x1f5ea7-0x0;var _0x1da89c=_0xdc03[_0x1f5ea7];return _0x1da89c;};'use strict';var _=require(_0x3dc0('0x0'));var util=require('util');var moment=require(_0x3dc0('0x1'));var BPromise=require(_0x3dc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dc0('0x3'));var db=require(_0x3dc0('0x4'))['db'];var utils=require(_0x3dc0('0x5'));var logger=require(_0x3dc0('0x6'))(_0x3dc0('0x7'));var config=require(_0x3dc0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3dc0('0x9')][_0x3dc0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb96fd0,_0x519e01,_0x1c1884){return new BPromise(function(_0x4c7e70,_0x51e98a){return client['request'](_0xb96fd0,_0x1c1884)[_0x3dc0('0xb')](function(_0x146fd0){logger[_0x3dc0('0xc')](_0x3dc0('0xd'),_0x519e01,_0x3dc0('0xe'));logger[_0x3dc0('0xf')](_0x3dc0('0x10'),_0x519e01,'request\x20sent',JSON['stringify'](_0x146fd0));if(_0x146fd0[_0x3dc0('0x11')]){if(_0x146fd0[_0x3dc0('0x11')][_0x3dc0('0x12')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x519e01,_0x146fd0[_0x3dc0('0x11')]['message']);return _0x51e98a(_0x146fd0[_0x3dc0('0x11')]['message']);}logger['error'](_0x3dc0('0xd'),_0x519e01,_0x146fd0[_0x3dc0('0x11')][_0x3dc0('0x13')]);return _0x4c7e70(_0x146fd0[_0x3dc0('0x11')][_0x3dc0('0x13')]);}else{logger[_0x3dc0('0xc')](_0x3dc0('0xd'),_0x519e01,_0x3dc0('0xe'));_0x4c7e70(_0x146fd0['result'][_0x3dc0('0x13')]);}})[_0x3dc0('0x14')](function(_0x5d8781){logger[_0x3dc0('0x11')](_0x3dc0('0xd'),_0x519e01,_0x5d8781);_0x51e98a(_0x5d8781);});});} \ No newline at end of file +var _0xcd59=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd59,0x14b));var _0x9cd5=function(_0x5e0926,_0x5f5ca7){_0x5e0926=_0x5e0926-0x0;var _0x2ffe9e=_0xcd59[_0x5e0926];return _0x2ffe9e;};'use strict';var _=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var moment=require(_0x9cd5('0x2'));var BPromise=require(_0x9cd5('0x3'));var rs=require(_0x9cd5('0x4'));var fs=require('fs');var Redis=require(_0x9cd5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9cd5('0x6'));var logger=require(_0x9cd5('0x7'))(_0x9cd5('0x8'));var config=require(_0x9cd5('0x9'));var jayson=require(_0x9cd5('0xa'));var client=jayson[_0x9cd5('0xb')][_0x9cd5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cd19a,_0x214256,_0x3f888f){return new BPromise(function(_0x545407,_0x10162d){return client[_0x9cd5('0xd')](_0x2cd19a,_0x3f888f)[_0x9cd5('0xe')](function(_0x23e524){logger[_0x9cd5('0xf')](_0x9cd5('0x10'),_0x214256,_0x9cd5('0x11'));logger[_0x9cd5('0x12')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x214256,_0x9cd5('0x11'),JSON[_0x9cd5('0x13')](_0x23e524));if(_0x23e524[_0x9cd5('0x14')]){if(_0x23e524[_0x9cd5('0x14')]['code']===0x1f4){logger['error'](_0x9cd5('0x10'),_0x214256,_0x23e524[_0x9cd5('0x14')][_0x9cd5('0x15')]);return _0x10162d(_0x23e524[_0x9cd5('0x14')][_0x9cd5('0x15')]);}logger[_0x9cd5('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x214256,_0x23e524[_0x9cd5('0x14')][_0x9cd5('0x15')]);return _0x545407(_0x23e524[_0x9cd5('0x14')]['message']);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x214256,_0x9cd5('0x11'));_0x545407(_0x23e524[_0x9cd5('0x16')]['message']);}})[_0x9cd5('0x17')](function(_0x11a7d2){logger[_0x9cd5('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x214256,_0x11a7d2);_0x10162d(_0x11a7d2);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index fbe9144..c9b6d10 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 _0x02df=['extname','now','post','single','create','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename'];(function(_0x5c7b7d,_0x4bbd89){var _0x2d5a9e=function(_0x5597a6){while(--_0x5597a6){_0x5c7b7d['push'](_0x5c7b7d['shift']());}};_0x2d5a9e(++_0x4bbd89);}(_0x02df,0x128));var _0xf02d=function(_0x53ed2e,_0x4f0bf5){_0x53ed2e=_0x53ed2e-0x0;var _0xca420e=_0x02df[_0x53ed2e];return _0xca420e;};'use strict';var multer=require(_0xf02d('0x0'));var util=require(_0xf02d('0x1'));var path=require(_0xf02d('0x2'));var timeout=require('connect-timeout');var express=require(_0xf02d('0x3'));var router=express[_0xf02d('0x4')]();var fs_extra=require(_0xf02d('0x5'));var auth=require(_0xf02d('0x6'));var interaction=require(_0xf02d('0x7'));var config=require(_0xf02d('0x8'));var controller=require(_0xf02d('0x9'));router['get']('/',auth[_0xf02d('0xa')](),controller[_0xf02d('0xb')]);router[_0xf02d('0xc')](_0xf02d('0xd'),auth[_0xf02d('0xa')](),controller[_0xf02d('0xe')]);router[_0xf02d('0xc')]('/:id/download',auth[_0xf02d('0xa')](),controller[_0xf02d('0xf')]);var upload=multer({'storage':multer[_0xf02d('0x10')]({'destination':function(_0x3d87ad,_0x157508,_0x32489d){_0x32489d(null,path[_0xf02d('0x11')](config[_0xf02d('0x12')],_0xf02d('0x13')));},'filename':function(_0x34dd09,_0x111c88,_0x3e7ede){_0x111c88[_0xf02d('0x14')]=_0x111c88['originalname'][_0xf02d('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e7ede(null,util['format'](_0xf02d('0x16'),path[_0xf02d('0x17')](_0x111c88[_0xf02d('0x14')],path[_0xf02d('0x18')](_0x111c88[_0xf02d('0x14')])),Date[_0xf02d('0x19')](),path['extname'](_0x111c88[_0xf02d('0x14')])));}})});router[_0xf02d('0x1a')]('/',upload[_0xf02d('0x1b')]('file'),controller[_0xf02d('0x1c')]);router[_0xf02d('0x1d')](_0xf02d('0xd'),auth[_0xf02d('0xa')](),controller['update']);router[_0xf02d('0x1e')]('/:id',auth[_0xf02d('0xa')](),controller[_0xf02d('0x1e')]);module[_0xf02d('0x1f')]=router; \ No newline at end of file +var _0xd70a=['server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','create','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','join','root'];(function(_0x1a2e94,_0x3f62fe){var _0x3e5425=function(_0x568e00){while(--_0x568e00){_0x1a2e94['push'](_0x1a2e94['shift']());}};_0x3e5425(++_0x3f62fe);}(_0xd70a,0x1d0));var _0xad70=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0xd70a[_0x421cf8];return _0x145c48;};'use strict';var multer=require('multer');var util=require(_0xad70('0x0'));var path=require(_0xad70('0x1'));var timeout=require(_0xad70('0x2'));var express=require('express');var router=express[_0xad70('0x3')]();var fs_extra=require(_0xad70('0x4'));var auth=require(_0xad70('0x5'));var interaction=require(_0xad70('0x6'));var config=require(_0xad70('0x7'));var controller=require(_0xad70('0x8'));router[_0xad70('0x9')]('/',auth[_0xad70('0xa')](),controller['index']);router[_0xad70('0x9')](_0xad70('0xb'),auth[_0xad70('0xa')](),controller[_0xad70('0xc')]);router[_0xad70('0x9')](_0xad70('0xd'),auth[_0xad70('0xa')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4eb982,_0x10c449,_0x4870c6){_0x4870c6(null,path[_0xad70('0xe')](config[_0xad70('0xf')],_0xad70('0x10')));},'filename':function(_0x21d8cf,_0x576770,_0x83735c){_0x576770['originalname']=_0x576770[_0xad70('0x11')][_0xad70('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x83735c(null,util[_0xad70('0x13')](_0xad70('0x14'),path[_0xad70('0x15')](_0x576770[_0xad70('0x11')],path[_0xad70('0x16')](_0x576770[_0xad70('0x11')])),Date[_0xad70('0x17')](),path[_0xad70('0x16')](_0x576770[_0xad70('0x11')])));}})});router[_0xad70('0x18')]('/',upload['single']('file'),controller[_0xad70('0x19')]);router[_0xad70('0x1a')](_0xad70('0xb'),auth[_0xad70('0xa')](),controller[_0xad70('0x1b')]);router['delete'](_0xad70('0xb'),auth['isAuthenticated'](),controller[_0xad70('0x1c')]);module[_0xad70('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 32048a5..d4f032b 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 _0x1575=['INTEGER','sequelize','STRING','FLOAT','BIGINT'];(function(_0x483f42,_0x4c8260){var _0xa9fa79=function(_0x312603){while(--_0x312603){_0x483f42['push'](_0x483f42['shift']());}};_0xa9fa79(++_0x4c8260);}(_0x1575,0x9c));var _0x5157=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0x1575[_0x5447aa];return _0xb21e53;};'use strict';var Sequelize=require(_0x5157('0x0'));module['exports']={'name':{'type':Sequelize[_0x5157('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x5157('0x1')]},'display_name':{'type':Sequelize[_0x5157('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x5157('0x1')]},'original_duration':{'type':Sequelize[_0x5157('0x2')]},'original_sampleCount':{'type':Sequelize[_0x5157('0x3')]},'original_channelCount':{'type':Sequelize[_0x5157('0x4')]},'original_bitRate':{'type':Sequelize[_0x5157('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x5157('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x5157('0x4')]}}; \ No newline at end of file +var _0x313c=['BIGINT','sequelize','STRING','name','FLOAT','INTEGER'];(function(_0x4162e0,_0x2b46c5){var _0x116fb6=function(_0x3c352f){while(--_0x3c352f){_0x4162e0['push'](_0x4162e0['shift']());}};_0x116fb6(++_0x2b46c5);}(_0x313c,0x1f3));var _0xc313=function(_0x257b5c,_0x2a4a17){_0x257b5c=_0x257b5c-0x0;var _0x1aa19d=_0x313c[_0x257b5c];return _0x1aa19d;};'use strict';var Sequelize=require(_0xc313('0x0'));module['exports']={'name':{'type':Sequelize[_0xc313('0x1')],'unique':_0xc313('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xc313('0x1')]},'display_name':{'type':Sequelize[_0xc313('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xc313('0x1')]},'original_format':{'type':Sequelize[_0xc313('0x1')]},'original_duration':{'type':Sequelize[_0xc313('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xc313('0x4')]},'converted_format':{'type':Sequelize[_0xc313('0x1')]},'converted_duration':{'type':Sequelize[_0xc313('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xc313('0x5')]},'converted_channelCount':{'type':Sequelize[_0xc313('0x4')]},'converted_bitRate':{'type':Sequelize[_0xc313('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index c187806..e4c93c8 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 _0x4d51=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','index','map','Sound','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','Sound\x20not\x20found','download','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','send','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_sampleRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','start','description','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0xb12603,_0x142505){var _0x2bdc24=function(_0x5dca90){while(--_0x5dca90){_0xb12603['push'](_0xb12603['shift']());}};_0x2bdc24(++_0x142505);}(_0x4d51,0x1f3));var _0x14d5=function(_0x44c7d4,_0x86120){_0x44c7d4=_0x44c7d4-0x0;var _0xee1b5d=_0x4d51[_0x44c7d4];return _0xee1b5d;};'use strict';var emlformat=require(_0x14d5('0x0'));var rimraf=require(_0x14d5('0x1'));var zipdir=require(_0x14d5('0x2'));var jsonpatch=require(_0x14d5('0x3'));var rp=require(_0x14d5('0x4'));var moment=require(_0x14d5('0x5'));var BPromise=require(_0x14d5('0x6'));var Mustache=require('mustache');var util=require(_0x14d5('0x7'));var path=require(_0x14d5('0x8'));var sox=require(_0x14d5('0x9'));var csv=require(_0x14d5('0xa'));var ejs=require(_0x14d5('0xb'));var fs=require('fs');var fs_extra=require(_0x14d5('0xc'));var _=require(_0x14d5('0xd'));var squel=require(_0x14d5('0xe'));var crypto=require(_0x14d5('0xf'));var jsforce=require(_0x14d5('0x10'));var deskjs=require(_0x14d5('0x11'));var toCsv=require(_0x14d5('0xa'));var querystring=require(_0x14d5('0x12'));var Papa=require(_0x14d5('0x13'));var Redis=require(_0x14d5('0x14'));var authService=require(_0x14d5('0x15'));var qs=require(_0x14d5('0x16'));var as=require(_0x14d5('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x14d5('0x18'));var config=require(_0x14d5('0x19'));var licenseUtil=require(_0x14d5('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ad015,_0x53b21a){_0x53b21a=_0x53b21a||0xcc;return function(_0xc99e74){if(_0xc99e74){return _0x4ad015[_0x14d5('0x1b')](_0x53b21a);}return _0x4ad015[_0x14d5('0x1c')](_0x53b21a)[_0x14d5('0x1d')]();};}function respondWithResult(_0x4df280,_0x629495){_0x629495=_0x629495||0xc8;return function(_0x24484c){if(_0x24484c){return _0x4df280[_0x14d5('0x1c')](_0x629495)['json'](_0x24484c);}};}function respondWithFilteredResult(_0x57e07d,_0x4dc582){return function(_0x239d36){if(_0x239d36){var _0x1ef8e6=typeof _0x4dc582[_0x14d5('0x1e')]==='undefined'&&typeof _0x4dc582[_0x14d5('0x1f')]===_0x14d5('0x20');var _0x4dd85c=_0x239d36[_0x14d5('0x21')];var _0x1fe7c0=_0x1ef8e6?0x0:_0x4dc582['offset'];var _0x470701=_0x1ef8e6?_0x239d36['count']:_0x4dc582[_0x14d5('0x1e')]+_0x4dc582[_0x14d5('0x1f')];var _0x222697;if(_0x470701>=_0x4dd85c){_0x470701=_0x4dd85c;_0x222697=0xc8;}else{_0x222697=0xce;}_0x57e07d[_0x14d5('0x1c')](_0x222697);return _0x57e07d[_0x14d5('0x22')](_0x14d5('0x23'),_0x1fe7c0+'-'+_0x470701+'/'+_0x4dd85c)[_0x14d5('0x24')](_0x239d36);}return null;};}function patchUpdates(_0x563a49){return function(_0x24cb48){try{jsonpatch[_0x14d5('0x25')](_0x24cb48,_0x563a49,!![]);}catch(_0x1a7bac){return BPromise[_0x14d5('0x26')](_0x1a7bac);}return _0x24cb48[_0x14d5('0x27')]();};}function saveUpdates(_0x9d78f4,_0x8a42e4){return function(_0x38699c){if(_0x38699c){return _0x38699c[_0x14d5('0x28')](_0x9d78f4)[_0x14d5('0x29')](function(_0x5d0f40){return _0x5d0f40;});}return null;};}function removeEntity(_0x8ac764,_0x3a4c94){return function(_0x5e52f5){if(_0x5e52f5){return _0x5e52f5[_0x14d5('0x2a')]()[_0x14d5('0x29')](function(){var _0x4f643f=_0x5e52f5[_0x14d5('0x2b')]({'plain':!![]});var _0x1402d9=_0x14d5('0x2c');return db[_0x14d5('0x2d')][_0x14d5('0x2a')]({'where':{'type':_0x1402d9,'resourceId':_0x4f643f['id']}})[_0x14d5('0x29')](function(){return _0x5e52f5;});})[_0x14d5('0x29')](function(){_0x8ac764[_0x14d5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a47a,_0x21264d){return function(_0x385fb7){if(!_0x385fb7){_0x19a47a['sendStatus'](0x194);}return _0x385fb7;};}function handleError(_0x17f3f1,_0x20f8a9){_0x20f8a9=_0x20f8a9||0x1f4;return function(_0x2a91da){logger[_0x14d5('0x2e')](_0x2a91da[_0x14d5('0x2f')]);if(_0x2a91da[_0x14d5('0x30')]){delete _0x2a91da['name'];}_0x17f3f1[_0x14d5('0x1c')](_0x20f8a9)['send'](_0x2a91da);};}exports[_0x14d5('0x31')]=function(_0x493976,_0x408343){var _0x539e58={},_0x5e3591={},_0xd7e8de={'count':0x0,'rows':[]};var _0x1ec440=_[_0x14d5('0x32')](db[_0x14d5('0x33')][_0x14d5('0x34')],function(_0x1e5f4e){return{'name':_0x1e5f4e[_0x14d5('0x35')],'type':_0x1e5f4e[_0x14d5('0x36')][_0x14d5('0x37')]};});_0x5e3591['model']=_['map'](_0x1ec440,_0x14d5('0x30'));_0x5e3591[_0x14d5('0x38')]=_[_0x14d5('0x39')](_0x493976['query']);_0x5e3591[_0x14d5('0x3a')]=_['intersection'](_0x5e3591[_0x14d5('0x3b')],_0x5e3591[_0x14d5('0x38')]);_0x539e58[_0x14d5('0x3c')]=_[_0x14d5('0x3d')](_0x5e3591[_0x14d5('0x3b')],qs[_0x14d5('0x3e')](_0x493976[_0x14d5('0x38')]['fields']));_0x539e58[_0x14d5('0x3c')]=_0x539e58[_0x14d5('0x3c')]['length']?_0x539e58[_0x14d5('0x3c')]:_0x5e3591[_0x14d5('0x3b')];if(!_0x493976[_0x14d5('0x38')]['hasOwnProperty']('nolimit')){_0x539e58[_0x14d5('0x1f')]=qs[_0x14d5('0x1f')](_0x493976['query']['limit']);_0x539e58[_0x14d5('0x1e')]=qs['offset'](_0x493976[_0x14d5('0x38')][_0x14d5('0x1e')]);}_0x539e58[_0x14d5('0x3f')]=qs[_0x14d5('0x40')](_0x493976[_0x14d5('0x38')]['sort']);_0x539e58['where']=qs[_0x14d5('0x3a')](_[_0x14d5('0x41')](_0x493976[_0x14d5('0x38')],_0x5e3591[_0x14d5('0x3a')]),_0x1ec440);if(_0x493976[_0x14d5('0x38')][_0x14d5('0x42')]){_0x539e58[_0x14d5('0x43')]=_[_0x14d5('0x44')](_0x539e58[_0x14d5('0x43')],{'$or':_[_0x14d5('0x32')](_0x1ec440,function(_0x53b4ce){if(_0x53b4ce[_0x14d5('0x36')]!==_0x14d5('0x45')){var _0x335fc4={};_0x335fc4[_0x53b4ce[_0x14d5('0x30')]]={'$like':'%'+_0x493976['query']['filter']+'%'};return _0x335fc4;}})});}_0x539e58=_[_0x14d5('0x44')]({},_0x539e58,_0x493976[_0x14d5('0x46')]);var _0x88fe5e={'where':_0x539e58[_0x14d5('0x43')]};return db[_0x14d5('0x33')][_0x14d5('0x21')](_0x88fe5e)[_0x14d5('0x29')](function(_0x3d4ccd){_0xd7e8de[_0x14d5('0x21')]=_0x3d4ccd;if(_0x493976[_0x14d5('0x38')][_0x14d5('0x47')]){_0x539e58[_0x14d5('0x48')]=[{'all':!![]}];}return db['Sound'][_0x14d5('0x49')](_0x539e58);})[_0x14d5('0x29')](function(_0x108da2){_0xd7e8de[_0x14d5('0x4a')]=_0x108da2;return _0xd7e8de;})[_0x14d5('0x29')](respondWithFilteredResult(_0x408343,_0x539e58))[_0x14d5('0x4b')](handleError(_0x408343,null));};exports[_0x14d5('0x4c')]=function(_0x555f3a,_0x44ce6f){var _0x8e7377={'raw':!![],'where':{'id':_0x555f3a[_0x14d5('0x4d')]['id']}},_0x447f18={};_0x447f18['model']=_[_0x14d5('0x39')](db[_0x14d5('0x33')]['rawAttributes']);_0x447f18[_0x14d5('0x38')]=_[_0x14d5('0x39')](_0x555f3a[_0x14d5('0x38')]);_0x447f18['filters']=_['intersection'](_0x447f18[_0x14d5('0x3b')],_0x447f18[_0x14d5('0x38')]);_0x8e7377[_0x14d5('0x3c')]=_[_0x14d5('0x3d')](_0x447f18[_0x14d5('0x3b')],qs[_0x14d5('0x3e')](_0x555f3a[_0x14d5('0x38')][_0x14d5('0x3e')]));_0x8e7377[_0x14d5('0x3c')]=_0x8e7377[_0x14d5('0x3c')]['length']?_0x8e7377[_0x14d5('0x3c')]:_0x447f18[_0x14d5('0x3b')];if(_0x555f3a[_0x14d5('0x38')][_0x14d5('0x47')]){_0x8e7377['include']=[{'all':!![]}];}_0x8e7377=_[_0x14d5('0x44')]({},_0x8e7377,_0x555f3a[_0x14d5('0x46')]);return db[_0x14d5('0x33')][_0x14d5('0x4e')](_0x8e7377)['then'](handleEntityNotFound(_0x44ce6f,null))[_0x14d5('0x29')](respondWithResult(_0x44ce6f,null))[_0x14d5('0x4b')](handleError(_0x44ce6f,null));};exports['download']=function(_0xfceee,_0x2c4ec4,_0x1720be){return db[_0x14d5('0x33')][_0x14d5('0x4e')]({'where':{'id':_0xfceee[_0x14d5('0x4d')]['id']},'attributes':[_0x14d5('0x30'),'save_name',_0x14d5('0x4f')],'raw':!![]})[_0x14d5('0x29')](handleEntityNotFound(_0x2c4ec4,null))[_0x14d5('0x29')](function(_0x3ddb09){if(_0x3ddb09){if(!fs[_0x14d5('0x50')](path[_0x14d5('0x51')](config[_0x14d5('0x52')],_0x14d5('0x53'),_0x3ddb09[_0x14d5('0x54')]+'.'+_0x3ddb09[_0x14d5('0x4f')]))){throw new db[(_0x14d5('0x55'))]['ValidationError'](_0x14d5('0x56'));}return _0x2c4ec4[_0x14d5('0x57')](path[_0x14d5('0x51')](config[_0x14d5('0x52')],_0x14d5('0x53'),util[_0x14d5('0x58')]('%s.%s',_0x3ddb09[_0x14d5('0x54')],_0x3ddb09[_0x14d5('0x4f')])),util[_0x14d5('0x58')](_0x14d5('0x59'),_0x3ddb09['name'],_0x3ddb09[_0x14d5('0x4f')]));}return null;})[_0x14d5('0x4b')](handleError(_0x2c4ec4,null));};exports['create']=function(_0x2cdebc,_0xbe0926,_0x961b94){var _0x19848c={'name':path[_0x14d5('0x5a')](_0x2cdebc[_0x14d5('0x5b')][_0x14d5('0x5c')],path[_0x14d5('0x5d')](_0x2cdebc['file'][_0x14d5('0x5c')])),'save_name':path[_0x14d5('0x5a')](_0x2cdebc[_0x14d5('0x5b')][_0x14d5('0x5e')],path[_0x14d5('0x5d')](_0x2cdebc['file'][_0x14d5('0x5e')])),'original_format':path[_0x14d5('0x5d')](_0x2cdebc[_0x14d5('0x5b')][_0x14d5('0x5c')])[_0x14d5('0x5f')](0x1),'converted_format':_0x14d5('0x60')};var _0x2eafab=path[_0x14d5('0x51')](config[_0x14d5('0x52')],_0x14d5('0x61'),_0x2cdebc[_0x14d5('0x5b')][_0x14d5('0x5e')]);var _0x15f0e3=path[_0x14d5('0x51')](config[_0x14d5('0x52')],'server/files/sounds/converted',util[_0x14d5('0x58')]('%s.%s',path[_0x14d5('0x5a')](_0x2cdebc[_0x14d5('0x5b')]['filename'],path[_0x14d5('0x5d')](_0x2cdebc[_0x14d5('0x5b')][_0x14d5('0x5e')])),_0x19848c[_0x14d5('0x4f')]));logger['info'](_0x14d5('0x62'),_0x2eafab);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x15f0e3);try{fs[_0x14d5('0x63')](_0x2eafab,parseInt(_0x14d5('0x64'),0x8));var _0x434bf3=sox[_0x14d5('0x65')](_0x2eafab,_0x15f0e3,{'sampleRate':0x1f40,'format':_0x14d5('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x434bf3['on']('error',function(_0x4e2700){fs['unlinkSync'](_0x2eafab);_0xbe0926[_0x14d5('0x1c')](0x1f4)[_0x14d5('0x66')](_0x4e2700);});_0x434bf3['on'](_0x14d5('0x67'),function(_0x29c14d){_0x19848c['original_duration']=isNaN(_0x29c14d[_0x14d5('0x68')])?null:_0x29c14d[_0x14d5('0x68')]*0x3e8;_0x19848c[_0x14d5('0x69')]=isNaN(_0x29c14d[_0x14d5('0x6a')])?null:_0x29c14d[_0x14d5('0x6a')];_0x19848c[_0x14d5('0x6b')]=isNaN(_0x29c14d[_0x14d5('0x6c')])?null:_0x29c14d[_0x14d5('0x6c')];_0x19848c[_0x14d5('0x6d')]=isNaN(_0x29c14d[_0x14d5('0x6e')])?null:_0x29c14d['bitRate'];_0x19848c[_0x14d5('0x6f')]=isNaN(_0x29c14d['sampleRate'])?null:_0x29c14d[_0x14d5('0x70')];});_0x434bf3['on'](_0x14d5('0x71'),function(_0x5131ce){_0x19848c['converted_duration']=isNaN(_0x5131ce[_0x14d5('0x68')])?null:_0x5131ce[_0x14d5('0x68')]*0x3e8;_0x19848c[_0x14d5('0x72')]=isNaN(_0x5131ce['sampleCount'])?null:_0x5131ce['sampleCount'];_0x19848c[_0x14d5('0x73')]=isNaN(_0x5131ce['channelCount'])?null:_0x5131ce[_0x14d5('0x6c')];_0x19848c['converted_bitRate']=isNaN(_0x5131ce[_0x14d5('0x6e')])?null:_0x5131ce['bitRate'];_0x19848c[_0x14d5('0x74')]=isNaN(_0x5131ce[_0x14d5('0x70')])?null:_0x5131ce[_0x14d5('0x70')];});_0x434bf3['on'](_0x14d5('0x1d'),function(){fs[_0x14d5('0x63')](_0x15f0e3,parseInt(_0x14d5('0x64'),0x8));return db[_0x14d5('0x33')][_0x14d5('0x75')](_0x19848c)['then'](function(_0x219980){var _0x325e96={'role':_0x2cdebc[_0x14d5('0x76')][_0x14d5('0x77')],'userProfileId':_0x2cdebc[_0x14d5('0x76')][_0x14d5('0x78')]};if(!_0x325e96)throw new Error(_0x14d5('0x79'));if(_0x325e96[_0x14d5('0x77')]===_0x14d5('0x7a')){var _0x5bcf19=_0x219980['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x14d5('0x2c'),'userProfileId':_0x325e96[_0x14d5('0x78')]},'raw':!![]})[_0x14d5('0x29')](function(_0x441ff6){if(_0x441ff6&&_0x441ff6[_0x14d5('0x7b')]===0x0){return db[_0x14d5('0x2d')][_0x14d5('0x75')]({'name':_0x5bcf19['name'],'resourceId':_0x5bcf19['id'],'type':_0x441ff6[_0x14d5('0x30')],'sectionId':_0x441ff6['id']},{})[_0x14d5('0x29')](function(){return _0x219980;});}else{return _0x219980;}})[_0x14d5('0x4b')](function(_0x29797d){logger[_0x14d5('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29797d);throw _0x29797d;});}return _0x219980;})['then'](respondWithResult(_0xbe0926,null))[_0x14d5('0x4b')](handleError(_0xbe0926,null));});_0x434bf3[_0x14d5('0x7c')]();}catch(_0x5cf713){_0xbe0926[_0x14d5('0x1c')](0x1f4)[_0x14d5('0x66')](_0x5cf713);}};exports[_0x14d5('0x28')]=function(_0x1cdd7c,_0x5b0dc3,_0x464720){return db[_0x14d5('0x33')][_0x14d5('0x4e')]({'where':{'id':_0x1cdd7c[_0x14d5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5b0dc3,null))[_0x14d5('0x29')](saveUpdates(_[_0x14d5('0x41')](_0x1cdd7c[_0x14d5('0x76')],['name',_0x14d5('0x7d')]),null))['then'](respondWithResult(_0x5b0dc3,null))['catch'](handleError(_0x5b0dc3,null));};exports[_0x14d5('0x7e')]=function(_0x4f700f,_0x20b5a0,_0x261074){return db[_0x14d5('0x33')][_0x14d5('0x4e')]({'where':{'id':_0x4f700f[_0x14d5('0x4d')]['id']}})[_0x14d5('0x29')](function(_0xa74f7e){if(_0xa74f7e){return _0xa74f7e[_0x14d5('0x2a')]();}})[_0x14d5('0x29')](function(_0x318acb){var _0x5a8460=path[_0x14d5('0x51')](config[_0x14d5('0x52')],_0x14d5('0x61'),util['format'](_0x14d5('0x59'),_0x318acb[_0x14d5('0x54')],_0x318acb[_0x14d5('0x7f')]));var _0x4b9c30=path[_0x14d5('0x51')](config[_0x14d5('0x52')],_0x14d5('0x53'),util[_0x14d5('0x58')](_0x14d5('0x59'),_0x318acb[_0x14d5('0x54')],_0x318acb[_0x14d5('0x4f')]));fs['unlinkSync'](_0x5a8460);fs[_0x14d5('0x80')](_0x4b9c30);return _0x318acb;})[_0x14d5('0x29')](function(_0x1c3dbb){if(_0x1c3dbb){return _0x20b5a0[_0x14d5('0x1c')](0xcc)[_0x14d5('0x1d')]();}})[_0x14d5('0x29')](handleEntityNotFound(_0x20b5a0,null))['catch'](handleError(_0x20b5a0,null));}; \ No newline at end of file +var _0xa62f=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','Content-Range','save','then','destroy','Sounds','sendStatus','error','stack','name','index','Sound','rawAttributes','type','key','map','query','keys','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','download','save_name','converted_format','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','basename','file','extname','filename','originalname','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','send','src','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','delete','original_format','eml-format','rimraf'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa62f,0x78));var _0xfa62=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa62f[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xfa62('0x0'));var rimraf=require(_0xfa62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa62('0x2'));var rp=require(_0xfa62('0x3'));var moment=require(_0xfa62('0x4'));var BPromise=require(_0xfa62('0x5'));var Mustache=require(_0xfa62('0x6'));var util=require(_0xfa62('0x7'));var path=require(_0xfa62('0x8'));var sox=require(_0xfa62('0x9'));var csv=require('to-csv');var ejs=require(_0xfa62('0xa'));var fs=require('fs');var fs_extra=require(_0xfa62('0xb'));var _=require(_0xfa62('0xc'));var squel=require(_0xfa62('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfa62('0xe'));var toCsv=require(_0xfa62('0xf'));var querystring=require(_0xfa62('0x10'));var Papa=require(_0xfa62('0x11'));var Redis=require(_0xfa62('0x12'));var authService=require(_0xfa62('0x13'));var qs=require(_0xfa62('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa62('0x15'));var logger=require(_0xfa62('0x16'))(_0xfa62('0x17'));var utils=require('../../config/utils');var config=require(_0xfa62('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfa62('0x19'))['db'];function respondWithStatusCode(_0x472f9e,_0xbcea2e){_0xbcea2e=_0xbcea2e||0xcc;return function(_0x2e2663){if(_0x2e2663){return _0x472f9e['sendStatus'](_0xbcea2e);}return _0x472f9e[_0xfa62('0x1a')](_0xbcea2e)[_0xfa62('0x1b')]();};}function respondWithResult(_0x495cc3,_0x9cd9f){_0x9cd9f=_0x9cd9f||0xc8;return function(_0x527848){if(_0x527848){return _0x495cc3['status'](_0x9cd9f)['json'](_0x527848);}};}function respondWithFilteredResult(_0x5dc18d,_0x5d0c4b){return function(_0x5a97cd){if(_0x5a97cd){var _0x4c60c5=typeof _0x5d0c4b[_0xfa62('0x1c')]===_0xfa62('0x1d')&&typeof _0x5d0c4b['limit']===_0xfa62('0x1d');var _0x2f021f=_0x5a97cd[_0xfa62('0x1e')];var _0xd960f7=_0x4c60c5?0x0:_0x5d0c4b['offset'];var _0x1f6a75=_0x4c60c5?_0x5a97cd[_0xfa62('0x1e')]:_0x5d0c4b[_0xfa62('0x1c')]+_0x5d0c4b[_0xfa62('0x1f')];var _0x56918c;if(_0x1f6a75>=_0x2f021f){_0x1f6a75=_0x2f021f;_0x56918c=0xc8;}else{_0x56918c=0xce;}_0x5dc18d[_0xfa62('0x1a')](_0x56918c);return _0x5dc18d['set'](_0xfa62('0x20'),_0xd960f7+'-'+_0x1f6a75+'/'+_0x2f021f)['json'](_0x5a97cd);}return null;};}function patchUpdates(_0x3a8e1f){return function(_0x30e219){try{jsonpatch['apply'](_0x30e219,_0x3a8e1f,!![]);}catch(_0x593add){return BPromise['reject'](_0x593add);}return _0x30e219[_0xfa62('0x21')]();};}function saveUpdates(_0x4d2ed6,_0x58c4d6){return function(_0x36f01d){if(_0x36f01d){return _0x36f01d['update'](_0x4d2ed6)[_0xfa62('0x22')](function(_0x2b86a2){return _0x2b86a2;});}return null;};}function removeEntity(_0x428d53,_0x2eac07){return function(_0x4d4e86){if(_0x4d4e86){return _0x4d4e86[_0xfa62('0x23')]()[_0xfa62('0x22')](function(){var _0x1574be=_0x4d4e86['get']({'plain':!![]});var _0x4cd85a=_0xfa62('0x24');return db['UserProfileResource'][_0xfa62('0x23')]({'where':{'type':_0x4cd85a,'resourceId':_0x1574be['id']}})[_0xfa62('0x22')](function(){return _0x4d4e86;});})[_0xfa62('0x22')](function(){_0x428d53[_0xfa62('0x1a')](0xcc)[_0xfa62('0x1b')]();});}};}function handleEntityNotFound(_0x353e0a,_0x309502){return function(_0x191bd7){if(!_0x191bd7){_0x353e0a[_0xfa62('0x25')](0x194);}return _0x191bd7;};}function handleError(_0x4aacc0,_0x3e25d4){_0x3e25d4=_0x3e25d4||0x1f4;return function(_0x34448c){logger[_0xfa62('0x26')](_0x34448c[_0xfa62('0x27')]);if(_0x34448c[_0xfa62('0x28')]){delete _0x34448c[_0xfa62('0x28')];}_0x4aacc0[_0xfa62('0x1a')](_0x3e25d4)['send'](_0x34448c);};}exports[_0xfa62('0x29')]=function(_0x277ac4,_0x1fbc9e){var _0x7ab5fb={},_0x18281b={},_0x25752d={'count':0x0,'rows':[]};var _0x186be4=_['map'](db[_0xfa62('0x2a')][_0xfa62('0x2b')],function(_0x3a9c6b){return{'name':_0x3a9c6b['fieldName'],'type':_0x3a9c6b[_0xfa62('0x2c')][_0xfa62('0x2d')]};});_0x18281b['model']=_[_0xfa62('0x2e')](_0x186be4,_0xfa62('0x28'));_0x18281b[_0xfa62('0x2f')]=_[_0xfa62('0x30')](_0x277ac4['query']);_0x18281b['filters']=_['intersection'](_0x18281b[_0xfa62('0x31')],_0x18281b[_0xfa62('0x2f')]);_0x7ab5fb['attributes']=_[_0xfa62('0x32')](_0x18281b[_0xfa62('0x31')],qs[_0xfa62('0x33')](_0x277ac4[_0xfa62('0x2f')][_0xfa62('0x33')]));_0x7ab5fb[_0xfa62('0x34')]=_0x7ab5fb[_0xfa62('0x34')][_0xfa62('0x35')]?_0x7ab5fb[_0xfa62('0x34')]:_0x18281b[_0xfa62('0x31')];if(!_0x277ac4[_0xfa62('0x2f')]['hasOwnProperty'](_0xfa62('0x36'))){_0x7ab5fb[_0xfa62('0x1f')]=qs[_0xfa62('0x1f')](_0x277ac4[_0xfa62('0x2f')]['limit']);_0x7ab5fb[_0xfa62('0x1c')]=qs[_0xfa62('0x1c')](_0x277ac4[_0xfa62('0x2f')][_0xfa62('0x1c')]);}_0x7ab5fb[_0xfa62('0x37')]=qs[_0xfa62('0x38')](_0x277ac4['query'][_0xfa62('0x38')]);_0x7ab5fb[_0xfa62('0x39')]=qs['filters'](_[_0xfa62('0x3a')](_0x277ac4[_0xfa62('0x2f')],_0x18281b[_0xfa62('0x3b')]),_0x186be4);if(_0x277ac4[_0xfa62('0x2f')][_0xfa62('0x3c')]){_0x7ab5fb[_0xfa62('0x39')]=_[_0xfa62('0x3d')](_0x7ab5fb['where'],{'$or':_['map'](_0x186be4,function(_0x4312e0){if(_0x4312e0[_0xfa62('0x2c')]!==_0xfa62('0x3e')){var _0x323b65={};_0x323b65[_0x4312e0[_0xfa62('0x28')]]={'$like':'%'+_0x277ac4[_0xfa62('0x2f')][_0xfa62('0x3c')]+'%'};return _0x323b65;}})});}_0x7ab5fb=_[_0xfa62('0x3d')]({},_0x7ab5fb,_0x277ac4[_0xfa62('0x3f')]);var _0x1e77ba={'where':_0x7ab5fb[_0xfa62('0x39')]};return db[_0xfa62('0x2a')][_0xfa62('0x1e')](_0x1e77ba)['then'](function(_0x2705c8){_0x25752d['count']=_0x2705c8;if(_0x277ac4[_0xfa62('0x2f')][_0xfa62('0x40')]){_0x7ab5fb['include']=[{'all':!![]}];}return db[_0xfa62('0x2a')][_0xfa62('0x41')](_0x7ab5fb);})[_0xfa62('0x22')](function(_0x5ecafb){_0x25752d['rows']=_0x5ecafb;return _0x25752d;})[_0xfa62('0x22')](respondWithFilteredResult(_0x1fbc9e,_0x7ab5fb))[_0xfa62('0x42')](handleError(_0x1fbc9e,null));};exports[_0xfa62('0x43')]=function(_0x10814d,_0x4d89c3){var _0x48cc44={'raw':!![],'where':{'id':_0x10814d[_0xfa62('0x44')]['id']}},_0x1e5e31={};_0x1e5e31[_0xfa62('0x31')]=_[_0xfa62('0x30')](db['Sound'][_0xfa62('0x2b')]);_0x1e5e31[_0xfa62('0x2f')]=_[_0xfa62('0x30')](_0x10814d[_0xfa62('0x2f')]);_0x1e5e31[_0xfa62('0x3b')]=_[_0xfa62('0x32')](_0x1e5e31[_0xfa62('0x31')],_0x1e5e31['query']);_0x48cc44[_0xfa62('0x34')]=_[_0xfa62('0x32')](_0x1e5e31[_0xfa62('0x31')],qs['fields'](_0x10814d[_0xfa62('0x2f')]['fields']));_0x48cc44[_0xfa62('0x34')]=_0x48cc44[_0xfa62('0x34')][_0xfa62('0x35')]?_0x48cc44[_0xfa62('0x34')]:_0x1e5e31['model'];if(_0x10814d['query']['includeAll']){_0x48cc44[_0xfa62('0x45')]=[{'all':!![]}];}_0x48cc44=_[_0xfa62('0x3d')]({},_0x48cc44,_0x10814d[_0xfa62('0x3f')]);return db[_0xfa62('0x2a')][_0xfa62('0x46')](_0x48cc44)[_0xfa62('0x22')](handleEntityNotFound(_0x4d89c3,null))[_0xfa62('0x22')](respondWithResult(_0x4d89c3,null))['catch'](handleError(_0x4d89c3,null));};exports[_0xfa62('0x47')]=function(_0x9432a8,_0x18efd0,_0x570269){return db['Sound']['find']({'where':{'id':_0x9432a8[_0xfa62('0x44')]['id']},'attributes':[_0xfa62('0x28'),_0xfa62('0x48'),_0xfa62('0x49')],'raw':!![]})[_0xfa62('0x22')](handleEntityNotFound(_0x18efd0,null))[_0xfa62('0x22')](function(_0x45c882){if(_0x45c882){if(!fs['existsSync'](path[_0xfa62('0x4a')](config['root'],_0xfa62('0x4b'),_0x45c882[_0xfa62('0x48')]+'.'+_0x45c882[_0xfa62('0x49')]))){throw new db[(_0xfa62('0x4c'))][(_0xfa62('0x4d'))](_0xfa62('0x4e'));}return _0x18efd0['download'](path[_0xfa62('0x4a')](config[_0xfa62('0x4f')],_0xfa62('0x4b'),util[_0xfa62('0x50')]('%s.%s',_0x45c882['save_name'],_0x45c882[_0xfa62('0x49')])),util[_0xfa62('0x50')](_0xfa62('0x51'),_0x45c882[_0xfa62('0x28')],_0x45c882[_0xfa62('0x49')]));}return null;})[_0xfa62('0x42')](handleError(_0x18efd0,null));};exports['create']=function(_0x208ca9,_0x5c26eb,_0x27e6d4){var _0x2d1132={'name':path[_0xfa62('0x52')](_0x208ca9[_0xfa62('0x53')]['originalname'],path[_0xfa62('0x54')](_0x208ca9['file']['originalname'])),'save_name':path[_0xfa62('0x52')](_0x208ca9['file'][_0xfa62('0x55')],path[_0xfa62('0x54')](_0x208ca9[_0xfa62('0x53')][_0xfa62('0x55')])),'original_format':path['extname'](_0x208ca9['file'][_0xfa62('0x56')])[_0xfa62('0x57')](0x1),'converted_format':'wav'};var _0x57629f=path[_0xfa62('0x4a')](config[_0xfa62('0x4f')],_0xfa62('0x58'),_0x208ca9['file']['filename']);var _0x5a9179=path['join'](config[_0xfa62('0x4f')],'server/files/sounds/converted',util['format'](_0xfa62('0x51'),path[_0xfa62('0x52')](_0x208ca9[_0xfa62('0x53')][_0xfa62('0x55')],path[_0xfa62('0x54')](_0x208ca9['file']['filename'])),_0x2d1132[_0xfa62('0x49')]));logger[_0xfa62('0x59')](_0xfa62('0x5a'),_0x57629f);logger[_0xfa62('0x59')]('Sound\x20upload\x20destination:\x20%s',_0x5a9179);try{fs[_0xfa62('0x5b')](_0x57629f,parseInt(_0xfa62('0x5c'),0x8));var _0x4bab5c=sox[_0xfa62('0x5d')](_0x57629f,_0x5a9179,{'sampleRate':0x1f40,'format':_0xfa62('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4bab5c['on']('error',function(_0x4a15f3){fs[_0xfa62('0x5f')](_0x57629f);_0x5c26eb[_0xfa62('0x1a')](0x1f4)[_0xfa62('0x60')](_0x4a15f3);});_0x4bab5c['on'](_0xfa62('0x61'),function(_0x49d86d){_0x2d1132['original_duration']=isNaN(_0x49d86d[_0xfa62('0x62')])?null:_0x49d86d['duration']*0x3e8;_0x2d1132[_0xfa62('0x63')]=isNaN(_0x49d86d[_0xfa62('0x64')])?null:_0x49d86d[_0xfa62('0x64')];_0x2d1132['original_channelCount']=isNaN(_0x49d86d[_0xfa62('0x65')])?null:_0x49d86d['channelCount'];_0x2d1132[_0xfa62('0x66')]=isNaN(_0x49d86d['bitRate'])?null:_0x49d86d[_0xfa62('0x67')];_0x2d1132[_0xfa62('0x68')]=isNaN(_0x49d86d[_0xfa62('0x69')])?null:_0x49d86d[_0xfa62('0x69')];});_0x4bab5c['on']('dest',function(_0x33c31e){_0x2d1132[_0xfa62('0x6a')]=isNaN(_0x33c31e['duration'])?null:_0x33c31e[_0xfa62('0x62')]*0x3e8;_0x2d1132[_0xfa62('0x6b')]=isNaN(_0x33c31e[_0xfa62('0x64')])?null:_0x33c31e[_0xfa62('0x64')];_0x2d1132[_0xfa62('0x6c')]=isNaN(_0x33c31e[_0xfa62('0x65')])?null:_0x33c31e[_0xfa62('0x65')];_0x2d1132[_0xfa62('0x6d')]=isNaN(_0x33c31e[_0xfa62('0x67')])?null:_0x33c31e[_0xfa62('0x67')];_0x2d1132[_0xfa62('0x6e')]=isNaN(_0x33c31e['sampleRate'])?null:_0x33c31e[_0xfa62('0x69')];});_0x4bab5c['on'](_0xfa62('0x1b'),function(){fs['chmodSync'](_0x5a9179,parseInt(_0xfa62('0x5c'),0x8));return db['Sound']['create'](_0x2d1132)['then'](function(_0x8cdd79){var _0x2988bd={'role':_0x208ca9[_0xfa62('0x6f')][_0xfa62('0x70')],'userProfileId':_0x208ca9['body'][_0xfa62('0x71')]};if(!_0x2988bd)throw new Error(_0xfa62('0x72'));if(_0x2988bd[_0xfa62('0x70')]==='user'){var _0x5eb2ad=_0x8cdd79['get']({'plain':!![]});return db[_0xfa62('0x73')][_0xfa62('0x46')]({'where':{'name':_0xfa62('0x24'),'userProfileId':_0x2988bd[_0xfa62('0x71')]},'raw':!![]})[_0xfa62('0x22')](function(_0x458b4c){if(_0x458b4c&&_0x458b4c['autoAssociation']===0x0){return db[_0xfa62('0x74')]['create']({'name':_0x5eb2ad['name'],'resourceId':_0x5eb2ad['id'],'type':_0x458b4c[_0xfa62('0x28')],'sectionId':_0x458b4c['id']},{})['then'](function(){return _0x8cdd79;});}else{return _0x8cdd79;}})[_0xfa62('0x42')](function(_0x2e33c8){logger['error'](_0xfa62('0x75'),_0x2e33c8);throw _0x2e33c8;});}return _0x8cdd79;})['then'](respondWithResult(_0x5c26eb,null))['catch'](handleError(_0x5c26eb,null));});_0x4bab5c[_0xfa62('0x76')]();}catch(_0x28395c){_0x5c26eb[_0xfa62('0x1a')](0x1f4)[_0xfa62('0x60')](_0x28395c);}};exports[_0xfa62('0x77')]=function(_0x112a53,_0x8d1e3,_0x3b4988){return db[_0xfa62('0x2a')][_0xfa62('0x46')]({'where':{'id':_0x112a53['params']['id']}})['then'](handleEntityNotFound(_0x8d1e3,null))[_0xfa62('0x22')](saveUpdates(_[_0xfa62('0x3a')](_0x112a53['body'],['name','description']),null))[_0xfa62('0x22')](respondWithResult(_0x8d1e3,null))[_0xfa62('0x42')](handleError(_0x8d1e3,null));};exports[_0xfa62('0x78')]=function(_0x431220,_0x3762ee,_0x4fca60){return db['Sound']['find']({'where':{'id':_0x431220[_0xfa62('0x44')]['id']}})['then'](function(_0x59a1bf){if(_0x59a1bf){return _0x59a1bf[_0xfa62('0x23')]();}})[_0xfa62('0x22')](function(_0x29b9ce){var _0x569c8f=path[_0xfa62('0x4a')](config[_0xfa62('0x4f')],_0xfa62('0x58'),util[_0xfa62('0x50')](_0xfa62('0x51'),_0x29b9ce[_0xfa62('0x48')],_0x29b9ce[_0xfa62('0x79')]));var _0x1078be=path[_0xfa62('0x4a')](config[_0xfa62('0x4f')],_0xfa62('0x4b'),util[_0xfa62('0x50')]('%s.%s',_0x29b9ce[_0xfa62('0x48')],_0x29b9ce[_0xfa62('0x49')]));fs[_0xfa62('0x5f')](_0x569c8f);fs['unlinkSync'](_0x1078be);return _0x29b9ce;})[_0xfa62('0x22')](function(_0x49254c){if(_0x49254c){return _0x3762ee[_0xfa62('0x1a')](0xcc)[_0xfa62('0x1b')]();}})[_0xfa62('0x22')](handleEntityNotFound(_0x3762ee,null))[_0xfa62('0x42')](handleError(_0x3762ee,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 80fa6a6..a50c871 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 _0xb314=['../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x59808b,_0x448eac){var _0x32e13a=function(_0x20c6b0){while(--_0x20c6b0){_0x59808b['push'](_0x59808b['shift']());}};_0x32e13a(++_0x448eac);}(_0xb314,0xba));var _0x4b31=function(_0xb0fc80,_0x122426){_0xb0fc80=_0xb0fc80-0x0;var _0x175973=_0xb314[_0xb0fc80];return _0x175973;};'use strict';var _=require(_0x4b31('0x0'));var util=require(_0x4b31('0x1'));var logger=require(_0x4b31('0x2'))('api');var moment=require(_0x4b31('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b31('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b31('0x5'));var config=require(_0x4b31('0x6'));var attributes=require(_0x4b31('0x7'));module[_0x4b31('0x8')]=function(_0x306ddb,_0x686bb){return _0x306ddb[_0x4b31('0x9')](_0x4b31('0xa'),attributes,{'tableName':_0x4b31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96cd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./sound.attributes','Sound','tools_sounds'];(function(_0x1bb32b,_0x274812){var _0x3259dc=function(_0x2684b7){while(--_0x2684b7){_0x1bb32b['push'](_0x1bb32b['shift']());}};_0x3259dc(++_0x274812);}(_0x96cd,0xb4));var _0xd96c=function(_0x42350e,_0x561b6e){_0x42350e=_0x42350e-0x0;var _0x55cec1=_0x96cd[_0x42350e];return _0x55cec1;};'use strict';var _=require(_0xd96c('0x0'));var util=require(_0xd96c('0x1'));var logger=require(_0xd96c('0x2'))(_0xd96c('0x3'));var moment=require(_0xd96c('0x4'));var BPromise=require(_0xd96c('0x5'));var rp=require(_0xd96c('0x6'));var fs=require('fs');var path=require(_0xd96c('0x7'));var rimraf=require(_0xd96c('0x8'));var config=require('../../config/environment');var attributes=require(_0xd96c('0x9'));module['exports']=function(_0x5df61d,_0x56d856){return _0x5df61d['define'](_0xd96c('0xa'),attributes,{'tableName':_0xd96c('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 1173a56..5b0b9db 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 _0x2b40=['error','code','message','catch','Sound','find','options','raw','where','attributes','include','map','model','ShowSound','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x2b40,0x10f));var _0x02b4=function(_0x31cde0,_0x1f2011){_0x31cde0=_0x31cde0-0x0;var _0x12335a=_0x2b40[_0x31cde0];return _0x12335a;};'use strict';var _=require(_0x02b4('0x0'));var util=require(_0x02b4('0x1'));var moment=require(_0x02b4('0x2'));var BPromise=require(_0x02b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02b4('0x4'));var db=require(_0x02b4('0x5'))['db'];var utils=require(_0x02b4('0x6'));var logger=require(_0x02b4('0x7'))('rpc');var config=require(_0x02b4('0x8'));var jayson=require(_0x02b4('0x9'));var client=jayson[_0x02b4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35b7a3,_0x59b655,_0x18b43f){return new BPromise(function(_0xd30658,_0x176b2b){return client['request'](_0x35b7a3,_0x18b43f)[_0x02b4('0xb')](function(_0x5d1bf1){logger[_0x02b4('0xc')](_0x02b4('0xd'),_0x59b655,'request\x20sent');logger[_0x02b4('0xe')](_0x02b4('0xf'),_0x59b655,_0x02b4('0x10'),JSON['stringify'](_0x5d1bf1));if(_0x5d1bf1[_0x02b4('0x11')]){if(_0x5d1bf1[_0x02b4('0x11')][_0x02b4('0x12')]===0x1f4){logger[_0x02b4('0x11')](_0x02b4('0xd'),_0x59b655,_0x5d1bf1[_0x02b4('0x11')][_0x02b4('0x13')]);return _0x176b2b(_0x5d1bf1['error']['message']);}logger[_0x02b4('0x11')]('Sound,\x20%s,\x20%s',_0x59b655,_0x5d1bf1[_0x02b4('0x11')][_0x02b4('0x13')]);return _0xd30658(_0x5d1bf1[_0x02b4('0x11')]['message']);}else{logger[_0x02b4('0xc')](_0x02b4('0xd'),_0x59b655,_0x02b4('0x10'));_0xd30658(_0x5d1bf1['result']['message']);}})[_0x02b4('0x14')](function(_0x406e9a){logger[_0x02b4('0x11')]('Sound,\x20%s,\x20%s',_0x59b655,_0x406e9a);_0x176b2b(_0x406e9a);});});}exports['ShowSound']=function(_0x59625e){var _0xdf2a95=this;return new Promise(function(_0x2a4540,_0x19a4d9){return db[_0x02b4('0x15')][_0x02b4('0x16')]({'raw':_0x59625e['options']?_0x59625e[_0x02b4('0x17')][_0x02b4('0x18')]===undefined?!![]:![]:!![],'where':_0x59625e[_0x02b4('0x17')]?_0x59625e[_0x02b4('0x17')][_0x02b4('0x19')]||null:null,'attributes':_0x59625e[_0x02b4('0x17')]?_0x59625e[_0x02b4('0x17')][_0x02b4('0x1a')]||null:null,'include':_0x59625e[_0x02b4('0x17')]?_0x59625e[_0x02b4('0x17')][_0x02b4('0x1b')]?_[_0x02b4('0x1c')](_0x59625e[_0x02b4('0x17')]['include'],function(_0xbf4e90){return{'model':db[_0xbf4e90['model']],'as':_0xbf4e90['as'],'attributes':_0xbf4e90[_0x02b4('0x1a')],'include':_0xbf4e90[_0x02b4('0x1b')]?_['map'](_0xbf4e90[_0x02b4('0x1b')],function(_0xd2aab){return{'model':db[_0xd2aab['model']],'as':_0xd2aab['as'],'attributes':_0xd2aab['attributes'],'include':_0xd2aab[_0x02b4('0x1b')]?_['map'](_0xd2aab[_0x02b4('0x1b')],function(_0x4347b4){return{'model':db[_0x4347b4[_0x02b4('0x1d')]],'as':_0x4347b4['as'],'attributes':_0x4347b4[_0x02b4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x67445){logger[_0x02b4('0xc')](_0x02b4('0x1e'),_0x59625e);logger[_0x02b4('0xe')]('ShowSound',_0x59625e,JSON[_0x02b4('0x1f')](_0x67445));_0x2a4540(_0x67445);})[_0x02b4('0x14')](function(_0x583bba){logger[_0x02b4('0x11')](_0x02b4('0x1e'),_0x583bba[_0x02b4('0x13')],_0x59625e);_0x19a4d9(_0xdf2a95['error'](0x1f4,_0x583bba[_0x02b4('0x13')]));});});}; \ No newline at end of file +var _0x2ffb=['Sound,\x20%s,\x20%s','message','info','catch','Sound','find','options','raw','where','attributes','map','include','model','ShowSound','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x40f9a0,_0x3458cc){var _0x3e3144=function(_0x1f8fce){while(--_0x1f8fce){_0x40f9a0['push'](_0x40f9a0['shift']());}};_0x3e3144(++_0x3458cc);}(_0x2ffb,0xb3));var _0xb2ff=function(_0x333755,_0x47aadf){_0x333755=_0x333755-0x0;var _0x1335ce=_0x2ffb[_0x333755];return _0x1335ce;};'use strict';var _=require(_0xb2ff('0x0'));var util=require(_0xb2ff('0x1'));var moment=require(_0xb2ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xb2ff('0x3'));var fs=require('fs');var Redis=require(_0xb2ff('0x4'));var db=require(_0xb2ff('0x5'))['db'];var utils=require(_0xb2ff('0x6'));var logger=require(_0xb2ff('0x7'))('rpc');var config=require(_0xb2ff('0x8'));var jayson=require(_0xb2ff('0x9'));var client=jayson[_0xb2ff('0xa')][_0xb2ff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fc28e,_0x726674,_0x963f06){return new BPromise(function(_0x232556,_0x428ac1){return client[_0xb2ff('0xc')](_0x1fc28e,_0x963f06)[_0xb2ff('0xd')](function(_0x2ee40b){logger['info']('Sound,\x20%s,\x20%s',_0x726674,'request\x20sent');logger[_0xb2ff('0xe')](_0xb2ff('0xf'),_0x726674,_0xb2ff('0x10'),JSON[_0xb2ff('0x11')](_0x2ee40b));if(_0x2ee40b[_0xb2ff('0x12')]){if(_0x2ee40b[_0xb2ff('0x12')]['code']===0x1f4){logger['error'](_0xb2ff('0x13'),_0x726674,_0x2ee40b[_0xb2ff('0x12')]['message']);return _0x428ac1(_0x2ee40b[_0xb2ff('0x12')][_0xb2ff('0x14')]);}logger[_0xb2ff('0x12')](_0xb2ff('0x13'),_0x726674,_0x2ee40b[_0xb2ff('0x12')][_0xb2ff('0x14')]);return _0x232556(_0x2ee40b[_0xb2ff('0x12')][_0xb2ff('0x14')]);}else{logger[_0xb2ff('0x15')](_0xb2ff('0x13'),_0x726674,_0xb2ff('0x10'));_0x232556(_0x2ee40b['result'][_0xb2ff('0x14')]);}})[_0xb2ff('0x16')](function(_0x53ae0c){logger[_0xb2ff('0x12')](_0xb2ff('0x13'),_0x726674,_0x53ae0c);_0x428ac1(_0x53ae0c);});});}exports['ShowSound']=function(_0x1bb00e){var _0x117f53=this;return new Promise(function(_0x2914b2,_0x5b1bb8){return db[_0xb2ff('0x17')][_0xb2ff('0x18')]({'raw':_0x1bb00e[_0xb2ff('0x19')]?_0x1bb00e[_0xb2ff('0x19')][_0xb2ff('0x1a')]===undefined?!![]:![]:!![],'where':_0x1bb00e[_0xb2ff('0x19')]?_0x1bb00e['options'][_0xb2ff('0x1b')]||null:null,'attributes':_0x1bb00e['options']?_0x1bb00e[_0xb2ff('0x19')][_0xb2ff('0x1c')]||null:null,'include':_0x1bb00e[_0xb2ff('0x19')]?_0x1bb00e[_0xb2ff('0x19')]['include']?_[_0xb2ff('0x1d')](_0x1bb00e['options'][_0xb2ff('0x1e')],function(_0x212528){return{'model':db[_0x212528[_0xb2ff('0x1f')]],'as':_0x212528['as'],'attributes':_0x212528['attributes'],'include':_0x212528[_0xb2ff('0x1e')]?_[_0xb2ff('0x1d')](_0x212528[_0xb2ff('0x1e')],function(_0x33a0ad){return{'model':db[_0x33a0ad[_0xb2ff('0x1f')]],'as':_0x33a0ad['as'],'attributes':_0x33a0ad['attributes'],'include':_0x33a0ad['include']?_[_0xb2ff('0x1d')](_0x33a0ad['include'],function(_0x3bca2e){return{'model':db[_0x3bca2e[_0xb2ff('0x1f')]],'as':_0x3bca2e['as'],'attributes':_0x3bca2e[_0xb2ff('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb2ff('0xd')](function(_0x409243){logger[_0xb2ff('0x15')]('ShowSound',_0x1bb00e);logger[_0xb2ff('0xe')](_0xb2ff('0x20'),_0x1bb00e,JSON[_0xb2ff('0x11')](_0x409243));_0x2914b2(_0x409243);})[_0xb2ff('0x16')](function(_0x17c48d){logger[_0xb2ff('0x12')](_0xb2ff('0x20'),_0x17c48d[_0xb2ff('0x14')],_0x1bb00e);_0x5b1bb8(_0x117f53[_0xb2ff('0x12')](0x1f4,_0x17c48d[_0xb2ff('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 37f9fe6..5b49c3a 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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x3457d2,_0x3deacb){var _0x391e7a=function(_0xf1bee8){while(--_0xf1bee8){_0x3457d2['push'](_0x3457d2['shift']());}};_0x391e7a(++_0x3deacb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x56989c,_0x6781f0){var _0x22ab27=function(_0x390034){while(--_0x390034){_0x56989c['push'](_0x56989c['shift']());}};_0x22ab27(++_0x6781f0);}(_0x2032,0xd9));var _0x2203=function(_0x513f54,_0x2a0aff){_0x513f54=_0x513f54-0x0;var _0x572190=_0x2032[_0x513f54];return _0x572190;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 1a589db..a873750 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 _0xc6cd=['ENUM','out','exports','STRING','TEXT','medium'];(function(_0x569d00,_0x4f0ad3){var _0x4269b7=function(_0x53a907){while(--_0x53a907){_0x569d00['push'](_0x569d00['shift']());}};_0x4269b7(++_0x4f0ad3);}(_0xc6cd,0x1ee));var _0xdc6c=function(_0x341a49,_0x3aeba4){_0x341a49=_0x341a49-0x0;var _0x31c721=_0xc6cd[_0x341a49];return _0x31c721;};'use strict';var Sequelize=require('sequelize');module[_0xdc6c('0x0')]={'uniqueid':{'type':Sequelize[_0xdc6c('0x1')]},'body':{'type':Sequelize[_0xdc6c('0x2')](_0xdc6c('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xdc6c('0x4')]('in','out'),'defaultValue':_0xdc6c('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xdc6c('0x1')]},'providerResponse':{'type':Sequelize[_0xdc6c('0x2')]}}; \ No newline at end of file +var _0x3f3f=['TEXT','medium','ENUM','out','sequelize','exports','STRING'];(function(_0x148c82,_0x177dc9){var _0x4a5f39=function(_0x95d7b9){while(--_0x95d7b9){_0x148c82['push'](_0x148c82['shift']());}};_0x4a5f39(++_0x177dc9);}(_0x3f3f,0x1af));var _0xf3f3=function(_0x14ec9d,_0x45d283){_0x14ec9d=_0x14ec9d-0x0;var _0x3636df=_0x3f3f[_0x14ec9d];return _0x3636df;};'use strict';var Sequelize=require(_0xf3f3('0x0'));module[_0xf3f3('0x1')]={'uniqueid':{'type':Sequelize[_0xf3f3('0x2')]},'body':{'type':Sequelize[_0xf3f3('0x3')](_0xf3f3('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xf3f3('0x5')]('in','out'),'defaultValue':_0xf3f3('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0xf3f3('0x2')]},'providerResponse':{'type':Sequelize[_0xf3f3('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 9ae7164..220134e 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 _0xc113=['fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','update','then','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','catch','show','params','length','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc113,0x1ab));var _0x3c11=function(_0x5c53e8,_0xd8fac5){_0x5c53e8=_0x5c53e8-0x0;var _0x12f5ad=_0xc113[_0x5c53e8];return _0x12f5ad;};'use strict';var emlformat=require(_0x3c11('0x0'));var rimraf=require(_0x3c11('0x1'));var zipdir=require(_0x3c11('0x2'));var jsonpatch=require(_0x3c11('0x3'));var rp=require(_0x3c11('0x4'));var moment=require(_0x3c11('0x5'));var BPromise=require(_0x3c11('0x6'));var Mustache=require(_0x3c11('0x7'));var util=require(_0x3c11('0x8'));var path=require('path');var sox=require(_0x3c11('0x9'));var csv=require(_0x3c11('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c11('0xb'));var _=require(_0x3c11('0xc'));var squel=require(_0x3c11('0xd'));var crypto=require('crypto');var jsforce=require(_0x3c11('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3c11('0xf'));var Redis=require(_0x3c11('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3c11('0x11'));var as=require(_0x3c11('0x12'));var hardwareService=require(_0x3c11('0x13'));var logger=require('../../config/logger')(_0x3c11('0x14'));var utils=require(_0x3c11('0x15'));var config=require(_0x3c11('0x16'));var licenseUtil=require(_0x3c11('0x17'));var db=require(_0x3c11('0x18'))['db'];function respondWithStatusCode(_0x58c7c8,_0x28daef){_0x28daef=_0x28daef||0xcc;return function(_0x2d997c){if(_0x2d997c){return _0x58c7c8['sendStatus'](_0x28daef);}return _0x58c7c8[_0x3c11('0x19')](_0x28daef)[_0x3c11('0x1a')]();};}function respondWithResult(_0x1c0b32,_0x822ef3){_0x822ef3=_0x822ef3||0xc8;return function(_0x30b11b){if(_0x30b11b){return _0x1c0b32['status'](_0x822ef3)[_0x3c11('0x1b')](_0x30b11b);}};}function respondWithFilteredResult(_0x2ba437,_0x2259f7){return function(_0x14c05d){if(_0x14c05d){var _0x1d05f2=typeof _0x2259f7['offset']==='undefined'&&typeof _0x2259f7['limit']===_0x3c11('0x1c');var _0x3a0626=_0x14c05d[_0x3c11('0x1d')];var _0x42db8d=_0x1d05f2?0x0:_0x2259f7[_0x3c11('0x1e')];var _0x35d32f=_0x1d05f2?_0x14c05d[_0x3c11('0x1d')]:_0x2259f7[_0x3c11('0x1e')]+_0x2259f7[_0x3c11('0x1f')];var _0x539ee1;if(_0x35d32f>=_0x3a0626){_0x35d32f=_0x3a0626;_0x539ee1=0xc8;}else{_0x539ee1=0xce;}_0x2ba437['status'](_0x539ee1);return _0x2ba437[_0x3c11('0x20')]('Content-Range',_0x42db8d+'-'+_0x35d32f+'/'+_0x3a0626)[_0x3c11('0x1b')](_0x14c05d);}return null;};}function patchUpdates(_0x5540b7){return function(_0x3ab7af){try{jsonpatch['apply'](_0x3ab7af,_0x5540b7,!![]);}catch(_0xe243c){return BPromise['reject'](_0xe243c);}return _0x3ab7af['save']();};}function saveUpdates(_0x160831,_0x49b827){return function(_0x189ba9){if(_0x189ba9){return _0x189ba9[_0x3c11('0x21')](_0x160831)[_0x3c11('0x22')](function(_0x2a7687){return _0x2a7687;});}return null;};}function removeEntity(_0x1a8fd4,_0x4e456a){return function(_0x36bb91){if(_0x36bb91){return _0x36bb91['destroy']()[_0x3c11('0x22')](function(){_0x1a8fd4[_0x3c11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29f3cd,_0x20ec9b){return function(_0x2ff8bc){if(!_0x2ff8bc){_0x29f3cd[_0x3c11('0x23')](0x194);}return _0x2ff8bc;};}function handleError(_0xd42228,_0x243659){_0x243659=_0x243659||0x1f4;return function(_0x1af1fb){logger[_0x3c11('0x24')](_0x1af1fb[_0x3c11('0x25')]);if(_0x1af1fb[_0x3c11('0x26')]){delete _0x1af1fb['name'];}_0xd42228[_0x3c11('0x19')](_0x243659)[_0x3c11('0x27')](_0x1af1fb);};}exports[_0x3c11('0x28')]=function(_0x9cc373,_0x50aec6){var _0x25b25d={},_0x21401c={},_0x5151b0={'count':0x0,'rows':[]};var _0x1078b8=_[_0x3c11('0x29')](db[_0x3c11('0x2a')][_0x3c11('0x2b')],function(_0x36a5b4){return{'name':_0x36a5b4[_0x3c11('0x2c')],'type':_0x36a5b4[_0x3c11('0x2d')][_0x3c11('0x2e')]};});_0x21401c['model']=_[_0x3c11('0x29')](_0x1078b8,_0x3c11('0x26'));_0x21401c[_0x3c11('0x2f')]=_[_0x3c11('0x30')](_0x9cc373[_0x3c11('0x2f')]);_0x21401c[_0x3c11('0x31')]=_[_0x3c11('0x32')](_0x21401c['model'],_0x21401c[_0x3c11('0x2f')]);_0x25b25d[_0x3c11('0x33')]=_[_0x3c11('0x32')](_0x21401c[_0x3c11('0x34')],qs[_0x3c11('0x35')](_0x9cc373[_0x3c11('0x2f')]['fields']));_0x25b25d[_0x3c11('0x33')]=_0x25b25d['attributes']['length']?_0x25b25d[_0x3c11('0x33')]:_0x21401c[_0x3c11('0x34')];if(!_0x9cc373['query'][_0x3c11('0x36')](_0x3c11('0x37'))){_0x25b25d[_0x3c11('0x1f')]=qs['limit'](_0x9cc373[_0x3c11('0x2f')][_0x3c11('0x1f')]);_0x25b25d[_0x3c11('0x1e')]=qs[_0x3c11('0x1e')](_0x9cc373['query'][_0x3c11('0x1e')]);}_0x25b25d[_0x3c11('0x38')]=qs['sort'](_0x9cc373[_0x3c11('0x2f')][_0x3c11('0x39')]);_0x25b25d[_0x3c11('0x3a')]=qs['filters'](_[_0x3c11('0x3b')](_0x9cc373['query'],_0x21401c[_0x3c11('0x31')]),_0x1078b8);if(_0x9cc373['query']['filter']){_0x25b25d[_0x3c11('0x3a')]=_['merge'](_0x25b25d[_0x3c11('0x3a')],{'$or':_['map'](_0x1078b8,function(_0x32766e){if(_0x32766e[_0x3c11('0x2d')]!=='VIRTUAL'){var _0x20bf47={};_0x20bf47[_0x32766e['name']]={'$like':'%'+_0x9cc373[_0x3c11('0x2f')][_0x3c11('0x3c')]+'%'};return _0x20bf47;}})});}_0x25b25d=_[_0x3c11('0x3d')]({},_0x25b25d,_0x9cc373['options']);var _0x3e1ec3={'where':_0x25b25d[_0x3c11('0x3a')]};return db[_0x3c11('0x2a')][_0x3c11('0x1d')](_0x3e1ec3)[_0x3c11('0x22')](function(_0x2ccc27){_0x5151b0[_0x3c11('0x1d')]=_0x2ccc27;if(_0x9cc373[_0x3c11('0x2f')]['includeAll']){_0x25b25d[_0x3c11('0x3e')]=[{'all':!![]}];}return db[_0x3c11('0x2a')][_0x3c11('0x3f')](_0x25b25d);})['then'](function(_0x4ed063){_0x5151b0['rows']=_0x4ed063;return _0x5151b0;})[_0x3c11('0x22')](respondWithFilteredResult(_0x50aec6,_0x25b25d))[_0x3c11('0x40')](handleError(_0x50aec6,null));};exports[_0x3c11('0x41')]=function(_0x5eef87,_0x533cb8){var _0x3eea03={'raw':!![],'where':{'id':_0x5eef87[_0x3c11('0x42')]['id']}},_0x39b0ed={};_0x39b0ed[_0x3c11('0x34')]=_[_0x3c11('0x30')](db[_0x3c11('0x2a')][_0x3c11('0x2b')]);_0x39b0ed[_0x3c11('0x2f')]=_[_0x3c11('0x30')](_0x5eef87['query']);_0x39b0ed[_0x3c11('0x31')]=_[_0x3c11('0x32')](_0x39b0ed[_0x3c11('0x34')],_0x39b0ed[_0x3c11('0x2f')]);_0x3eea03[_0x3c11('0x33')]=_[_0x3c11('0x32')](_0x39b0ed[_0x3c11('0x34')],qs[_0x3c11('0x35')](_0x5eef87[_0x3c11('0x2f')][_0x3c11('0x35')]));_0x3eea03['attributes']=_0x3eea03[_0x3c11('0x33')][_0x3c11('0x43')]?_0x3eea03[_0x3c11('0x33')]:_0x39b0ed['model'];if(_0x5eef87[_0x3c11('0x2f')][_0x3c11('0x44')]){_0x3eea03[_0x3c11('0x3e')]=[{'all':!![]}];}_0x3eea03=_[_0x3c11('0x3d')]({},_0x3eea03,_0x5eef87['options']);return db['SquareMessage'][_0x3c11('0x45')](_0x3eea03)[_0x3c11('0x22')](handleEntityNotFound(_0x533cb8,null))['then'](respondWithResult(_0x533cb8,null))[_0x3c11('0x40')](handleError(_0x533cb8,null));};exports[_0x3c11('0x46')]=function(_0x2e2398,_0x2b3224){return db['SquareMessage']['create'](_0x2e2398[_0x3c11('0x47')],{})[_0x3c11('0x22')](respondWithResult(_0x2b3224,0xc9))[_0x3c11('0x40')](handleError(_0x2b3224,null));};exports[_0x3c11('0x21')]=function(_0x4da7b4,_0x1846b2){if(_0x4da7b4[_0x3c11('0x47')]['id']){delete _0x4da7b4[_0x3c11('0x47')]['id'];}return db[_0x3c11('0x2a')][_0x3c11('0x45')]({'where':{'id':_0x4da7b4[_0x3c11('0x42')]['id']}})['then'](handleEntityNotFound(_0x1846b2,null))['then'](saveUpdates(_0x4da7b4['body'],null))['then'](respondWithResult(_0x1846b2,null))['catch'](handleError(_0x1846b2,null));};exports[_0x3c11('0x48')]=function(_0x559f54,_0x5a7efe){return db[_0x3c11('0x2a')][_0x3c11('0x45')]({'where':{'id':_0x559f54['params']['id']}})[_0x3c11('0x22')](handleEntityNotFound(_0x5a7efe,null))['then'](removeEntity(_0x5a7efe,null))[_0x3c11('0x40')](handleError(_0x5a7efe,null));}; \ No newline at end of file +var _0x97ce=['set','apply','reject','save','update','then','destroy','error','stack','name','map','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','SquareMessage','count','includeAll','include','findAll','rows','show','params','rawAttributes','options','create','body','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x5a0bd5,_0x39eca8){var _0x3a43ec=function(_0x5395b0){while(--_0x5395b0){_0x5a0bd5['push'](_0x5a0bd5['shift']());}};_0x3a43ec(++_0x39eca8);}(_0x97ce,0x151));var _0xe97c=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x97ce[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require(_0xe97c('0x0'));var rimraf=require(_0xe97c('0x1'));var zipdir=require(_0xe97c('0x2'));var jsonpatch=require(_0xe97c('0x3'));var rp=require('request-promise');var moment=require(_0xe97c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe97c('0x5'));var util=require('util');var path=require(_0xe97c('0x6'));var sox=require(_0xe97c('0x7'));var csv=require(_0xe97c('0x8'));var ejs=require(_0xe97c('0x9'));var fs=require('fs');var fs_extra=require(_0xe97c('0xa'));var _=require(_0xe97c('0xb'));var squel=require('squel');var crypto=require(_0xe97c('0xc'));var jsforce=require(_0xe97c('0xd'));var deskjs=require(_0xe97c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe97c('0xf'));var Papa=require('papaparse');var Redis=require(_0xe97c('0x10'));var authService=require(_0xe97c('0x11'));var qs=require(_0xe97c('0x12'));var as=require(_0xe97c('0x13'));var hardwareService=require(_0xe97c('0x14'));var logger=require(_0xe97c('0x15'))(_0xe97c('0x16'));var utils=require('../../config/utils');var config=require(_0xe97c('0x17'));var licenseUtil=require(_0xe97c('0x18'));var db=require(_0xe97c('0x19'))['db'];function respondWithStatusCode(_0x15ab00,_0x72d55a){_0x72d55a=_0x72d55a||0xcc;return function(_0x3df200){if(_0x3df200){return _0x15ab00[_0xe97c('0x1a')](_0x72d55a);}return _0x15ab00[_0xe97c('0x1b')](_0x72d55a)[_0xe97c('0x1c')]();};}function respondWithResult(_0x578ffc,_0x4e0b5e){_0x4e0b5e=_0x4e0b5e||0xc8;return function(_0x115559){if(_0x115559){return _0x578ffc['status'](_0x4e0b5e)[_0xe97c('0x1d')](_0x115559);}};}function respondWithFilteredResult(_0x4006a6,_0x5c2cbf){return function(_0x4bf5c7){if(_0x4bf5c7){var _0x220396=typeof _0x5c2cbf[_0xe97c('0x1e')]===_0xe97c('0x1f')&&typeof _0x5c2cbf[_0xe97c('0x20')]==='undefined';var _0x4e2044=_0x4bf5c7['count'];var _0x42d95c=_0x220396?0x0:_0x5c2cbf[_0xe97c('0x1e')];var _0x22054c=_0x220396?_0x4bf5c7['count']:_0x5c2cbf[_0xe97c('0x1e')]+_0x5c2cbf[_0xe97c('0x20')];var _0x6be792;if(_0x22054c>=_0x4e2044){_0x22054c=_0x4e2044;_0x6be792=0xc8;}else{_0x6be792=0xce;}_0x4006a6[_0xe97c('0x1b')](_0x6be792);return _0x4006a6[_0xe97c('0x21')]('Content-Range',_0x42d95c+'-'+_0x22054c+'/'+_0x4e2044)[_0xe97c('0x1d')](_0x4bf5c7);}return null;};}function patchUpdates(_0xdaf874){return function(_0x24a54d){try{jsonpatch[_0xe97c('0x22')](_0x24a54d,_0xdaf874,!![]);}catch(_0x32eb7a){return BPromise[_0xe97c('0x23')](_0x32eb7a);}return _0x24a54d[_0xe97c('0x24')]();};}function saveUpdates(_0x1061e1,_0xc1be51){return function(_0x2f2840){if(_0x2f2840){return _0x2f2840[_0xe97c('0x25')](_0x1061e1)[_0xe97c('0x26')](function(_0x4749a3){return _0x4749a3;});}return null;};}function removeEntity(_0x117d0b,_0x3b957c){return function(_0x3fb93e){if(_0x3fb93e){return _0x3fb93e[_0xe97c('0x27')]()[_0xe97c('0x26')](function(){_0x117d0b[_0xe97c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23ff1d,_0x6e14cc){return function(_0x244835){if(!_0x244835){_0x23ff1d[_0xe97c('0x1a')](0x194);}return _0x244835;};}function handleError(_0x61d473,_0x1bb9d8){_0x1bb9d8=_0x1bb9d8||0x1f4;return function(_0x42729e){logger[_0xe97c('0x28')](_0x42729e[_0xe97c('0x29')]);if(_0x42729e[_0xe97c('0x2a')]){delete _0x42729e[_0xe97c('0x2a')];}_0x61d473[_0xe97c('0x1b')](_0x1bb9d8)['send'](_0x42729e);};}exports['index']=function(_0x132678,_0x1a3f69){var _0x1273a2={},_0x27cfae={},_0x40caf3={'count':0x0,'rows':[]};var _0x6fff8d=_[_0xe97c('0x2b')](db['SquareMessage']['rawAttributes'],function(_0x35938e){return{'name':_0x35938e[_0xe97c('0x2c')],'type':_0x35938e[_0xe97c('0x2d')][_0xe97c('0x2e')]};});_0x27cfae['model']=_['map'](_0x6fff8d,_0xe97c('0x2a'));_0x27cfae[_0xe97c('0x2f')]=_[_0xe97c('0x30')](_0x132678['query']);_0x27cfae['filters']=_[_0xe97c('0x31')](_0x27cfae[_0xe97c('0x32')],_0x27cfae[_0xe97c('0x2f')]);_0x1273a2[_0xe97c('0x33')]=_[_0xe97c('0x31')](_0x27cfae[_0xe97c('0x32')],qs[_0xe97c('0x34')](_0x132678['query'][_0xe97c('0x34')]));_0x1273a2[_0xe97c('0x33')]=_0x1273a2['attributes'][_0xe97c('0x35')]?_0x1273a2[_0xe97c('0x33')]:_0x27cfae[_0xe97c('0x32')];if(!_0x132678[_0xe97c('0x2f')][_0xe97c('0x36')](_0xe97c('0x37'))){_0x1273a2[_0xe97c('0x20')]=qs[_0xe97c('0x20')](_0x132678['query']['limit']);_0x1273a2[_0xe97c('0x1e')]=qs[_0xe97c('0x1e')](_0x132678[_0xe97c('0x2f')][_0xe97c('0x1e')]);}_0x1273a2['order']=qs[_0xe97c('0x38')](_0x132678['query'][_0xe97c('0x38')]);_0x1273a2[_0xe97c('0x39')]=qs[_0xe97c('0x3a')](_['pick'](_0x132678[_0xe97c('0x2f')],_0x27cfae[_0xe97c('0x3a')]),_0x6fff8d);if(_0x132678[_0xe97c('0x2f')][_0xe97c('0x3b')]){_0x1273a2[_0xe97c('0x39')]=_['merge'](_0x1273a2[_0xe97c('0x39')],{'$or':_[_0xe97c('0x2b')](_0x6fff8d,function(_0x2e20dd){if(_0x2e20dd['type']!=='VIRTUAL'){var _0x371830={};_0x371830[_0x2e20dd['name']]={'$like':'%'+_0x132678[_0xe97c('0x2f')]['filter']+'%'};return _0x371830;}})});}_0x1273a2=_['merge']({},_0x1273a2,_0x132678['options']);var _0x112ae7={'where':_0x1273a2[_0xe97c('0x39')]};return db[_0xe97c('0x3c')][_0xe97c('0x3d')](_0x112ae7)[_0xe97c('0x26')](function(_0x4ff87e){_0x40caf3[_0xe97c('0x3d')]=_0x4ff87e;if(_0x132678['query'][_0xe97c('0x3e')]){_0x1273a2[_0xe97c('0x3f')]=[{'all':!![]}];}return db[_0xe97c('0x3c')][_0xe97c('0x40')](_0x1273a2);})[_0xe97c('0x26')](function(_0x381e41){_0x40caf3[_0xe97c('0x41')]=_0x381e41;return _0x40caf3;})[_0xe97c('0x26')](respondWithFilteredResult(_0x1a3f69,_0x1273a2))['catch'](handleError(_0x1a3f69,null));};exports[_0xe97c('0x42')]=function(_0x3dd372,_0x20ee1b){var _0x272972={'raw':!![],'where':{'id':_0x3dd372[_0xe97c('0x43')]['id']}},_0x400cde={};_0x400cde[_0xe97c('0x32')]=_[_0xe97c('0x30')](db[_0xe97c('0x3c')][_0xe97c('0x44')]);_0x400cde['query']=_[_0xe97c('0x30')](_0x3dd372[_0xe97c('0x2f')]);_0x400cde['filters']=_[_0xe97c('0x31')](_0x400cde[_0xe97c('0x32')],_0x400cde[_0xe97c('0x2f')]);_0x272972[_0xe97c('0x33')]=_['intersection'](_0x400cde[_0xe97c('0x32')],qs['fields'](_0x3dd372[_0xe97c('0x2f')][_0xe97c('0x34')]));_0x272972[_0xe97c('0x33')]=_0x272972[_0xe97c('0x33')][_0xe97c('0x35')]?_0x272972['attributes']:_0x400cde[_0xe97c('0x32')];if(_0x3dd372[_0xe97c('0x2f')][_0xe97c('0x3e')]){_0x272972[_0xe97c('0x3f')]=[{'all':!![]}];}_0x272972=_['merge']({},_0x272972,_0x3dd372[_0xe97c('0x45')]);return db[_0xe97c('0x3c')]['find'](_0x272972)[_0xe97c('0x26')](handleEntityNotFound(_0x20ee1b,null))[_0xe97c('0x26')](respondWithResult(_0x20ee1b,null))['catch'](handleError(_0x20ee1b,null));};exports['create']=function(_0x1fd875,_0x560fda){return db[_0xe97c('0x3c')][_0xe97c('0x46')](_0x1fd875[_0xe97c('0x47')],{})[_0xe97c('0x26')](respondWithResult(_0x560fda,0xc9))[_0xe97c('0x48')](handleError(_0x560fda,null));};exports[_0xe97c('0x25')]=function(_0x1fefe3,_0x4f7616){if(_0x1fefe3[_0xe97c('0x47')]['id']){delete _0x1fefe3[_0xe97c('0x47')]['id'];}return db[_0xe97c('0x3c')][_0xe97c('0x49')]({'where':{'id':_0x1fefe3['params']['id']}})['then'](handleEntityNotFound(_0x4f7616,null))[_0xe97c('0x26')](saveUpdates(_0x1fefe3[_0xe97c('0x47')],null))[_0xe97c('0x26')](respondWithResult(_0x4f7616,null))[_0xe97c('0x48')](handleError(_0x4f7616,null));};exports['destroy']=function(_0x536cc6,_0x5b1420){return db[_0xe97c('0x3c')][_0xe97c('0x49')]({'where':{'id':_0x536cc6[_0xe97c('0x43')]['id']}})[_0xe97c('0x26')](handleEntityNotFound(_0x5b1420,null))[_0xe97c('0x26')](removeEntity(_0x5b1420,null))[_0xe97c('0x48')](handleError(_0x5b1420,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index d970201..aa6dc9a 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 _0xca6f=['rimraf','./squareMessage.attributes','exports','SquareMessage','square_messages','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4fac4d,_0x2a4eca){var _0x48c9ec=function(_0x2890a4){while(--_0x2890a4){_0x4fac4d['push'](_0x4fac4d['shift']());}};_0x48c9ec(++_0x2a4eca);}(_0xca6f,0x102));var _0xfca6=function(_0x40b330,_0x42458b){_0x40b330=_0x40b330-0x0;var _0x27ae9a=_0xca6f[_0x40b330];return _0x27ae9a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfca6('0x0'))(_0xfca6('0x1'));var moment=require(_0xfca6('0x2'));var BPromise=require(_0xfca6('0x3'));var rp=require(_0xfca6('0x4'));var fs=require('fs');var path=require(_0xfca6('0x5'));var rimraf=require(_0xfca6('0x6'));var config=require('../../config/environment');var attributes=require(_0xfca6('0x7'));module[_0xfca6('0x8')]=function(_0x4bb453,_0x48aa8a){return _0x4bb453['define'](_0xfca6('0x9'),attributes,{'tableName':_0xfca6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5e1=['../../config/logger','moment','bluebird','request-promise','path','./squareMessage.attributes','exports','define','SquareMessage','util'];(function(_0x966d95,_0x18ac22){var _0x3c0578=function(_0x35556a){while(--_0x35556a){_0x966d95['push'](_0x966d95['shift']());}};_0x3c0578(++_0x18ac22);}(_0xf5e1,0x12b));var _0x1f5e=function(_0x5b2872,_0x1d2159){_0x5b2872=_0x5b2872-0x0;var _0x8831c9=_0xf5e1[_0x5b2872];return _0x8831c9;};'use strict';var _=require('lodash');var util=require(_0x1f5e('0x0'));var logger=require(_0x1f5e('0x1'))('api');var moment=require(_0x1f5e('0x2'));var BPromise=require(_0x1f5e('0x3'));var rp=require(_0x1f5e('0x4'));var fs=require('fs');var path=require(_0x1f5e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1f5e('0x6'));module[_0x1f5e('0x7')]=function(_0x255719,_0x3294f3){return _0x255719[_0x1f5e('0x8')](_0x1f5e('0x9'),attributes,{'tableName':'square_messages','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 2bf66a4..2e93928 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 _0x0dba=['request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSquareMessage','SquareMessage','create','body','options','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SquareMessage,\x20%s,\x20%s'];(function(_0x4ba051,_0x5b0be2){var _0x3d8aaa=function(_0x450d1c){while(--_0x450d1c){_0x4ba051['push'](_0x4ba051['shift']());}};_0x3d8aaa(++_0x5b0be2);}(_0x0dba,0x1e1));var _0xa0db=function(_0x34bcc9,_0x16a9b7){_0x34bcc9=_0x34bcc9-0x0;var _0x138e5a=_0x0dba[_0x34bcc9];return _0x138e5a;};'use strict';var _=require(_0xa0db('0x0'));var util=require(_0xa0db('0x1'));var moment=require('moment');var BPromise=require(_0xa0db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa0db('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0db('0x4'));var logger=require(_0xa0db('0x5'))(_0xa0db('0x6'));var config=require(_0xa0db('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa0db('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22da10,_0x50060a,_0x4acb8d){return new BPromise(function(_0x1ea72e,_0x12ef83){return client[_0xa0db('0x9')](_0x22da10,_0x4acb8d)[_0xa0db('0xa')](function(_0x33a719){logger[_0xa0db('0xb')](_0xa0db('0xc'),_0x50060a,_0xa0db('0xd'));logger[_0xa0db('0xe')](_0xa0db('0xf'),_0x50060a,'request\x20sent',JSON[_0xa0db('0x10')](_0x33a719));if(_0x33a719[_0xa0db('0x11')]){if(_0x33a719[_0xa0db('0x11')][_0xa0db('0x12')]===0x1f4){logger[_0xa0db('0x11')](_0xa0db('0xc'),_0x50060a,_0x33a719[_0xa0db('0x11')][_0xa0db('0x13')]);return _0x12ef83(_0x33a719[_0xa0db('0x11')]['message']);}logger[_0xa0db('0x11')](_0xa0db('0xc'),_0x50060a,_0x33a719[_0xa0db('0x11')][_0xa0db('0x13')]);return _0x1ea72e(_0x33a719['error'][_0xa0db('0x13')]);}else{logger[_0xa0db('0xb')](_0xa0db('0xc'),_0x50060a,_0xa0db('0xd'));_0x1ea72e(_0x33a719['result']['message']);}})['catch'](function(_0x5d5ba0){logger[_0xa0db('0x11')](_0xa0db('0xc'),_0x50060a,_0x5d5ba0);_0x12ef83(_0x5d5ba0);});});}exports[_0xa0db('0x14')]=function(_0x21effd){var _0x4df003=this;return new Promise(function(_0x2a67b0,_0x599ac5){return db[_0xa0db('0x15')][_0xa0db('0x16')](_0x21effd[_0xa0db('0x17')],{'raw':_0x21effd[_0xa0db('0x18')]?_0x21effd['options']['raw']===undefined?!![]:![]:!![]})[_0xa0db('0xa')](function(_0x37114b){logger['info'](_0xa0db('0x14'),_0x21effd);logger[_0xa0db('0xe')]('CreateSquareMessage',_0x21effd,JSON['stringify'](_0x37114b));_0x2a67b0(_0x37114b);})[_0xa0db('0x19')](function(_0x378c1b){logger[_0xa0db('0x11')](_0xa0db('0x14'),_0x378c1b[_0xa0db('0x13')],_0x21effd);_0x599ac5(_0x4df003['error'](0x1f4,_0x378c1b['message']));});});}; \ No newline at end of file +var _0x6b43=['../../config/environment','jayson/promise','client','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','info','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0xb82853,_0x408ed4){var _0x2620b9=function(_0x57c8cb){while(--_0x57c8cb){_0xb82853['push'](_0xb82853['shift']());}};_0x2620b9(++_0x408ed4);}(_0x6b43,0xb6));var _0x36b4=function(_0x1d91b7,_0x6115d7){_0x1d91b7=_0x1d91b7-0x0;var _0x2b9c36=_0x6b43[_0x1d91b7];return _0x2b9c36;};'use strict';var _=require(_0x36b4('0x0'));var util=require(_0x36b4('0x1'));var moment=require('moment');var BPromise=require(_0x36b4('0x2'));var rs=require(_0x36b4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36b4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x36b4('0x5'))(_0x36b4('0x6'));var config=require(_0x36b4('0x7'));var jayson=require(_0x36b4('0x8'));var client=jayson[_0x36b4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2289b8,_0x1aa18,_0x1ed939){return new BPromise(function(_0x2c93cc,_0x1349c8){return client[_0x36b4('0xa')](_0x2289b8,_0x1ed939)[_0x36b4('0xb')](function(_0x553ac2){logger['info'](_0x36b4('0xc'),_0x1aa18,_0x36b4('0xd'));logger[_0x36b4('0xe')](_0x36b4('0xf'),_0x1aa18,_0x36b4('0xd'),JSON['stringify'](_0x553ac2));if(_0x553ac2[_0x36b4('0x10')]){if(_0x553ac2[_0x36b4('0x10')][_0x36b4('0x11')]===0x1f4){logger[_0x36b4('0x10')](_0x36b4('0xc'),_0x1aa18,_0x553ac2[_0x36b4('0x10')]['message']);return _0x1349c8(_0x553ac2[_0x36b4('0x10')][_0x36b4('0x12')]);}logger[_0x36b4('0x10')]('SquareMessage,\x20%s,\x20%s',_0x1aa18,_0x553ac2[_0x36b4('0x10')]['message']);return _0x2c93cc(_0x553ac2[_0x36b4('0x10')][_0x36b4('0x12')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x1aa18,_0x36b4('0xd'));_0x2c93cc(_0x553ac2[_0x36b4('0x13')][_0x36b4('0x12')]);}})[_0x36b4('0x14')](function(_0x23ab7a){logger[_0x36b4('0x10')](_0x36b4('0xc'),_0x1aa18,_0x23ab7a);_0x1349c8(_0x23ab7a);});});}exports[_0x36b4('0x15')]=function(_0x51635e){var _0x37f761=this;return new Promise(function(_0x5a48c9,_0x40ebb5){return db[_0x36b4('0x16')][_0x36b4('0x17')](_0x51635e[_0x36b4('0x18')],{'raw':_0x51635e['options']?_0x51635e[_0x36b4('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x36b4('0xb')](function(_0x136fdd){logger[_0x36b4('0x1a')](_0x36b4('0x15'),_0x51635e);logger[_0x36b4('0xe')](_0x36b4('0x15'),_0x51635e,JSON['stringify'](_0x136fdd));_0x5a48c9(_0x136fdd);})[_0x36b4('0x14')](function(_0x409fdb){logger[_0x36b4('0x10')](_0x36b4('0x15'),_0x409fdb['message'],_0x51635e);_0x40ebb5(_0x37f761['error'](0x1f4,_0x409fdb[_0x36b4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index b5f0332..0351714 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 _0x8c43=['destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','isAuthenticated','get','/:id','test','create','update','delete'];(function(_0x581e01,_0x241cbd){var _0x558b54=function(_0x22a370){while(--_0x22a370){_0x581e01['push'](_0x581e01['shift']());}};_0x558b54(++_0x241cbd);}(_0x8c43,0xbc));var _0x38c4=function(_0x2d47d8,_0x36eb5f){_0x2d47d8=_0x2d47d8-0x0;var _0x3496ad=_0x8c43[_0x2d47d8];return _0x3496ad;};'use strict';var multer=require(_0x38c4('0x0'));var util=require(_0x38c4('0x1'));var path=require('path');var timeout=require(_0x38c4('0x2'));var express=require(_0x38c4('0x3'));var router=express[_0x38c4('0x4')]();var fs_extra=require(_0x38c4('0x5'));var auth=require(_0x38c4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x38c4('0x7'));var controller=require(_0x38c4('0x8'));router['get']('/',auth[_0x38c4('0x9')](),controller['index']);router[_0x38c4('0xa')](_0x38c4('0xb'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/test',auth[_0x38c4('0x9')](),timeout('15s'),controller[_0x38c4('0xc')]);router['post']('/',auth[_0x38c4('0x9')](),controller[_0x38c4('0xd')]);router['put']('/:id',auth[_0x38c4('0x9')](),controller[_0x38c4('0xe')]);router[_0x38c4('0xf')](_0x38c4('0xb'),auth['isAuthenticated'](),controller[_0x38c4('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe7be=['get','/:id','show','15s','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x4238f3,_0x2bff85){var _0x5e859c=function(_0x5980a6){while(--_0x5980a6){_0x4238f3['push'](_0x4238f3['shift']());}};_0x5e859c(++_0x2bff85);}(_0xe7be,0xf2));var _0xee7b=function(_0x1b78fc,_0x3d392e){_0x1b78fc=_0x1b78fc-0x0;var _0x5b2f71=_0xe7be[_0x1b78fc];return _0x5b2f71;};'use strict';var multer=require(_0xee7b('0x0'));var util=require(_0xee7b('0x1'));var path=require('path');var timeout=require(_0xee7b('0x2'));var express=require(_0xee7b('0x3'));var router=express['Router']();var fs_extra=require(_0xee7b('0x4'));var auth=require(_0xee7b('0x5'));var interaction=require(_0xee7b('0x6'));var config=require(_0xee7b('0x7'));var controller=require('./squareOdbc.controller');router['get']('/',auth[_0xee7b('0x8')](),controller[_0xee7b('0x9')]);router[_0xee7b('0xa')](_0xee7b('0xb'),auth['isAuthenticated'](),controller[_0xee7b('0xc')]);router['get']('/:id/test',auth[_0xee7b('0x8')](),timeout(_0xee7b('0xd')),controller['test']);router[_0xee7b('0xe')]('/',auth['isAuthenticated'](),controller[_0xee7b('0xf')]);router[_0xee7b('0x10')]('/:id',auth[_0xee7b('0x8')](),controller[_0xee7b('0x11')]);router[_0xee7b('0x12')](_0xee7b('0xb'),auth[_0xee7b('0x8')](),controller[_0xee7b('0x13')]);module[_0xee7b('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index f4e1705..b611a36 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 _0x8e72=['name','sequelize','exports','STRING'];(function(_0x4b636d,_0x32df2f){var _0x5d154d=function(_0x4589c2){while(--_0x4589c2){_0x4b636d['push'](_0x4b636d['shift']());}};_0x5d154d(++_0x32df2f);}(_0x8e72,0x1e1));var _0x28e7=function(_0x217802,_0x188e1f){_0x217802=_0x217802-0x0;var _0x4140ef=_0x8e72[_0x217802];return _0x4140ef;};'use strict';var Sequelize=require(_0x28e7('0x0'));module[_0x28e7('0x1')]={'name':{'type':Sequelize[_0x28e7('0x2')],'unique':_0x28e7('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x28e7('0x2')]},'description':{'type':Sequelize[_0x28e7('0x2')]}}; \ No newline at end of file +var _0x87e7=['STRING','name','sequelize'];(function(_0x38d470,_0x5493b3){var _0xd15321=function(_0x4faef1){while(--_0x4faef1){_0x38d470['push'](_0x38d470['shift']());}};_0xd15321(++_0x5493b3);}(_0x87e7,0xb6));var _0x787e=function(_0x1554e6,_0x28607d){_0x1554e6=_0x1554e6-0x0;var _0x4cafbf=_0x87e7[_0x1554e6];return _0x4cafbf;};'use strict';var Sequelize=require(_0x787e('0x0'));module['exports']={'name':{'type':Sequelize[_0x787e('0x1')],'unique':_0x787e('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x787e('0x1')]},'description':{'type':Sequelize[_0x787e('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0daa6ae..dc97eec 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 _0xfdf7=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','then','get','ODBC','UserProfileResource','stack','name','send','index','map','SquareOdbc','rawAttributes','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','test','openSync','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfdf7,0x1aa));var _0x7fdf=function(_0x21ccfc,_0x48834e){_0x21ccfc=_0x21ccfc-0x0;var _0x279454=_0xfdf7[_0x21ccfc];return _0x279454;};'use strict';var emlformat=require(_0x7fdf('0x0'));var rimraf=require(_0x7fdf('0x1'));var zipdir=require(_0x7fdf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fdf('0x3'));var moment=require(_0x7fdf('0x4'));var BPromise=require(_0x7fdf('0x5'));var Mustache=require(_0x7fdf('0x6'));var util=require(_0x7fdf('0x7'));var path=require('path');var sox=require(_0x7fdf('0x8'));var csv=require('to-csv');var ejs=require(_0x7fdf('0x9'));var fs=require('fs');var fs_extra=require(_0x7fdf('0xa'));var _=require(_0x7fdf('0xb'));var squel=require(_0x7fdf('0xc'));var crypto=require(_0x7fdf('0xd'));var jsforce=require(_0x7fdf('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7fdf('0xf'));var Papa=require(_0x7fdf('0x10'));var Redis=require(_0x7fdf('0x11'));var authService=require(_0x7fdf('0x12'));var qs=require(_0x7fdf('0x13'));var as=require(_0x7fdf('0x14'));var hardwareService=require(_0x7fdf('0x15'));var logger=require(_0x7fdf('0x16'))(_0x7fdf('0x17'));var utils=require(_0x7fdf('0x18'));var config=require(_0x7fdf('0x19'));var licenseUtil=require(_0x7fdf('0x1a'));var db=require(_0x7fdf('0x1b'))['db'];function respondWithStatusCode(_0x458c41,_0x53b8e8){_0x53b8e8=_0x53b8e8||0xcc;return function(_0x12f28a){if(_0x12f28a){return _0x458c41[_0x7fdf('0x1c')](_0x53b8e8);}return _0x458c41[_0x7fdf('0x1d')](_0x53b8e8)[_0x7fdf('0x1e')]();};}function respondWithResult(_0x2c8003,_0x42fa30){_0x42fa30=_0x42fa30||0xc8;return function(_0x34522a){if(_0x34522a){return _0x2c8003[_0x7fdf('0x1d')](_0x42fa30)[_0x7fdf('0x1f')](_0x34522a);}};}function respondWithFilteredResult(_0x5d8d22,_0x3c59ad){return function(_0x41ef84){if(_0x41ef84){var _0x283fd6=typeof _0x3c59ad[_0x7fdf('0x20')]===_0x7fdf('0x21')&&typeof _0x3c59ad['limit']===_0x7fdf('0x21');var _0x3f820f=_0x41ef84['count'];var _0x8a45cd=_0x283fd6?0x0:_0x3c59ad[_0x7fdf('0x20')];var _0x4b70a1=_0x283fd6?_0x41ef84[_0x7fdf('0x22')]:_0x3c59ad[_0x7fdf('0x20')]+_0x3c59ad['limit'];var _0x14624c;if(_0x4b70a1>=_0x3f820f){_0x4b70a1=_0x3f820f;_0x14624c=0xc8;}else{_0x14624c=0xce;}_0x5d8d22[_0x7fdf('0x1d')](_0x14624c);return _0x5d8d22[_0x7fdf('0x23')](_0x7fdf('0x24'),_0x8a45cd+'-'+_0x4b70a1+'/'+_0x3f820f)['json'](_0x41ef84);}return null;};}function patchUpdates(_0x5f0477){return function(_0x2f8ee6){try{jsonpatch[_0x7fdf('0x25')](_0x2f8ee6,_0x5f0477,!![]);}catch(_0x38353e){return BPromise[_0x7fdf('0x26')](_0x38353e);}return _0x2f8ee6['save']();};}function saveUpdates(_0x57e09e,_0x999fc6){return function(_0x4e518b){if(_0x4e518b){return _0x4e518b[_0x7fdf('0x27')](_0x57e09e)['then'](function(_0x35c0fb){return _0x35c0fb;});}return null;};}function removeEntity(_0x572721,_0x498934){return function(_0x4ce9f3){if(_0x4ce9f3){return _0x4ce9f3[_0x7fdf('0x28')]()[_0x7fdf('0x29')](function(){var _0x10c070=_0x4ce9f3[_0x7fdf('0x2a')]({'plain':!![]});var _0x231f4e=_0x7fdf('0x2b');return db[_0x7fdf('0x2c')][_0x7fdf('0x28')]({'where':{'type':_0x231f4e,'resourceId':_0x10c070['id']}})['then'](function(){return _0x4ce9f3;});})['then'](function(){_0x572721[_0x7fdf('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e380f,_0x3cd6ac){return function(_0x36a1d7){if(!_0x36a1d7){_0x4e380f['sendStatus'](0x194);}return _0x36a1d7;};}function handleError(_0x3a18f7,_0x5dd28f){_0x5dd28f=_0x5dd28f||0x1f4;return function(_0x4c5417){logger['error'](_0x4c5417[_0x7fdf('0x2d')]);if(_0x4c5417[_0x7fdf('0x2e')]){delete _0x4c5417[_0x7fdf('0x2e')];}_0x3a18f7[_0x7fdf('0x1d')](_0x5dd28f)[_0x7fdf('0x2f')](_0x4c5417);};}exports[_0x7fdf('0x30')]=function(_0x5d00e4,_0x5489f2){var _0x174fa9={},_0x46760f={},_0x12b463={'count':0x0,'rows':[]};var _0x1397ee=_[_0x7fdf('0x31')](db[_0x7fdf('0x32')][_0x7fdf('0x33')],function(_0x5927fd){return{'name':_0x5927fd['fieldName'],'type':_0x5927fd[_0x7fdf('0x34')][_0x7fdf('0x35')]};});_0x46760f['model']=_[_0x7fdf('0x31')](_0x1397ee,_0x7fdf('0x2e'));_0x46760f[_0x7fdf('0x36')]=_[_0x7fdf('0x37')](_0x5d00e4[_0x7fdf('0x36')]);_0x46760f['filters']=_[_0x7fdf('0x38')](_0x46760f['model'],_0x46760f['query']);_0x174fa9[_0x7fdf('0x39')]=_[_0x7fdf('0x38')](_0x46760f[_0x7fdf('0x3a')],qs[_0x7fdf('0x3b')](_0x5d00e4[_0x7fdf('0x36')][_0x7fdf('0x3b')]));_0x174fa9['attributes']=_0x174fa9['attributes'][_0x7fdf('0x3c')]?_0x174fa9[_0x7fdf('0x39')]:_0x46760f[_0x7fdf('0x3a')];if(!_0x5d00e4[_0x7fdf('0x36')][_0x7fdf('0x3d')](_0x7fdf('0x3e'))){_0x174fa9[_0x7fdf('0x3f')]=qs['limit'](_0x5d00e4[_0x7fdf('0x36')]['limit']);_0x174fa9[_0x7fdf('0x20')]=qs[_0x7fdf('0x20')](_0x5d00e4[_0x7fdf('0x36')][_0x7fdf('0x20')]);}_0x174fa9[_0x7fdf('0x40')]=qs[_0x7fdf('0x41')](_0x5d00e4[_0x7fdf('0x36')][_0x7fdf('0x41')]);_0x174fa9[_0x7fdf('0x42')]=qs[_0x7fdf('0x43')](_[_0x7fdf('0x44')](_0x5d00e4[_0x7fdf('0x36')],_0x46760f[_0x7fdf('0x43')]),_0x1397ee);if(_0x5d00e4[_0x7fdf('0x36')]['filter']){_0x174fa9['where']=_['merge'](_0x174fa9['where'],{'$or':_[_0x7fdf('0x31')](_0x1397ee,function(_0x55575d){if(_0x55575d['type']!==_0x7fdf('0x45')){var _0x48dfa0={};_0x48dfa0[_0x55575d[_0x7fdf('0x2e')]]={'$like':'%'+_0x5d00e4[_0x7fdf('0x36')][_0x7fdf('0x46')]+'%'};return _0x48dfa0;}})});}_0x174fa9=_[_0x7fdf('0x47')]({},_0x174fa9,_0x5d00e4[_0x7fdf('0x48')]);var _0x437c1a={'where':_0x174fa9[_0x7fdf('0x42')]};return db[_0x7fdf('0x32')]['count'](_0x437c1a)[_0x7fdf('0x29')](function(_0x41870a){_0x12b463[_0x7fdf('0x22')]=_0x41870a;if(_0x5d00e4['query'][_0x7fdf('0x49')]){_0x174fa9[_0x7fdf('0x4a')]=[{'all':!![]}];}return db['SquareOdbc'][_0x7fdf('0x4b')](_0x174fa9);})['then'](function(_0x295872){_0x12b463[_0x7fdf('0x4c')]=_0x295872;return _0x12b463;})[_0x7fdf('0x29')](respondWithFilteredResult(_0x5489f2,_0x174fa9))[_0x7fdf('0x4d')](handleError(_0x5489f2,null));};exports[_0x7fdf('0x4e')]=function(_0x8755f1,_0x2d3753){var _0x2bddab={'raw':!![],'where':{'id':_0x8755f1[_0x7fdf('0x4f')]['id']}},_0x35f572={};_0x35f572[_0x7fdf('0x3a')]=_['keys'](db['SquareOdbc'][_0x7fdf('0x33')]);_0x35f572[_0x7fdf('0x36')]=_[_0x7fdf('0x37')](_0x8755f1['query']);_0x35f572[_0x7fdf('0x43')]=_[_0x7fdf('0x38')](_0x35f572['model'],_0x35f572[_0x7fdf('0x36')]);_0x2bddab[_0x7fdf('0x39')]=_['intersection'](_0x35f572['model'],qs[_0x7fdf('0x3b')](_0x8755f1['query'][_0x7fdf('0x3b')]));_0x2bddab[_0x7fdf('0x39')]=_0x2bddab[_0x7fdf('0x39')][_0x7fdf('0x3c')]?_0x2bddab[_0x7fdf('0x39')]:_0x35f572[_0x7fdf('0x3a')];if(_0x8755f1[_0x7fdf('0x36')][_0x7fdf('0x49')]){_0x2bddab[_0x7fdf('0x4a')]=[{'all':!![]}];}_0x2bddab=_[_0x7fdf('0x47')]({},_0x2bddab,_0x8755f1[_0x7fdf('0x48')]);return db[_0x7fdf('0x32')][_0x7fdf('0x50')](_0x2bddab)['then'](handleEntityNotFound(_0x2d3753,null))[_0x7fdf('0x29')](respondWithResult(_0x2d3753,null))['catch'](handleError(_0x2d3753,null));};exports[_0x7fdf('0x51')]=function(_0x4e1999,_0x393c8a){return db[_0x7fdf('0x32')][_0x7fdf('0x51')](_0x4e1999[_0x7fdf('0x52')],{})[_0x7fdf('0x29')](function(_0xab13a7){var _0x279afa=_0x4e1999[_0x7fdf('0x53')]['get']({'plain':!![]});if(!_0x279afa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x279afa[_0x7fdf('0x54')]==='user'){var _0xc4717a=_0xab13a7[_0x7fdf('0x2a')]({'plain':!![]});var _0x186f32=_0x7fdf('0x2b');return db[_0x7fdf('0x55')]['find']({'where':{'name':_0x186f32,'userProfileId':_0x279afa['userProfileId']},'raw':!![]})[_0x7fdf('0x29')](function(_0x3e0ce4){if(_0x3e0ce4&&_0x3e0ce4[_0x7fdf('0x56')]===0x0){return db[_0x7fdf('0x2c')][_0x7fdf('0x51')]({'name':_0xc4717a['name'],'resourceId':_0xc4717a['id'],'type':_0x3e0ce4[_0x7fdf('0x2e')],'sectionId':_0x3e0ce4['id']},{})[_0x7fdf('0x29')](function(){return _0xab13a7;});}else{return _0xab13a7;}})['catch'](function(_0x34b755){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34b755);throw _0x34b755;});}return _0xab13a7;})['then'](respondWithResult(_0x393c8a,0xc9))['catch'](handleError(_0x393c8a,null));};exports[_0x7fdf('0x27')]=function(_0x584bad,_0x3b09dd){if(_0x584bad[_0x7fdf('0x52')]['id']){delete _0x584bad['body']['id'];}return db['SquareOdbc'][_0x7fdf('0x50')]({'where':{'id':_0x584bad[_0x7fdf('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3b09dd,null))['then'](saveUpdates(_0x584bad[_0x7fdf('0x52')],null))[_0x7fdf('0x29')](respondWithResult(_0x3b09dd,null))['catch'](handleError(_0x3b09dd,null));};exports['destroy']=function(_0x1f6a1e,_0x42c86a){return db['SquareOdbc'][_0x7fdf('0x50')]({'where':{'id':_0x1f6a1e['params']['id']}})['then'](handleEntityNotFound(_0x42c86a,null))['then'](removeEntity(_0x42c86a,null))[_0x7fdf('0x4d')](handleError(_0x42c86a,null));};exports[_0x7fdf('0x57')]=function(_0x1ec317,_0x444831,_0x18b7eb){var _0x2b3717;return db[_0x7fdf('0x32')][_0x7fdf('0x50')]({'where':{'id':_0x1ec317['params']['id']},'attributes':['id','dsn']})[_0x7fdf('0x29')](handleEntityNotFound(_0x444831,null))[_0x7fdf('0x29')](function(_0xf43eb8){if(_0xf43eb8){var _0x5c30bf=require('odbc')();_0x5c30bf[_0x7fdf('0x58')](_0xf43eb8['dsn']);_0x5c30bf[_0x7fdf('0x59')]();return _0xf43eb8;}})[_0x7fdf('0x29')](respondWithResult(_0x444831,null))[_0x7fdf('0x4d')](handleError(_0x444831,null));}; \ No newline at end of file +var _0x865f=['squel','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','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','destroy','get','ODBC','UserProfileResource','then','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','update','test','dsn','odbc','openSync','closeSync','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x1aab5d,_0x288dad){var _0x56b096=function(_0x379b68){while(--_0x379b68){_0x1aab5d['push'](_0x1aab5d['shift']());}};_0x56b096(++_0x288dad);}(_0x865f,0x1ee));var _0xf865=function(_0x3fe50a,_0x2ca658){_0x3fe50a=_0x3fe50a-0x0;var _0x546c31=_0x865f[_0x3fe50a];return _0x546c31;};'use strict';var emlformat=require(_0xf865('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf865('0x1'));var rp=require(_0xf865('0x2'));var moment=require(_0xf865('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf865('0x4'));var util=require(_0xf865('0x5'));var path=require('path');var sox=require(_0xf865('0x6'));var csv=require(_0xf865('0x7'));var ejs=require(_0xf865('0x8'));var fs=require('fs');var fs_extra=require(_0xf865('0x9'));var _=require('lodash');var squel=require(_0xf865('0xa'));var crypto=require(_0xf865('0xb'));var jsforce=require(_0xf865('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf865('0x7'));var querystring=require('querystring');var Papa=require(_0xf865('0xd'));var Redis=require(_0xf865('0xe'));var authService=require(_0xf865('0xf'));var qs=require(_0xf865('0x10'));var as=require(_0xf865('0x11'));var hardwareService=require(_0xf865('0x12'));var logger=require(_0xf865('0x13'))(_0xf865('0x14'));var utils=require(_0xf865('0x15'));var config=require(_0xf865('0x16'));var licenseUtil=require(_0xf865('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5183b6,_0x38d44e){_0x38d44e=_0x38d44e||0xcc;return function(_0x2b051e){if(_0x2b051e){return _0x5183b6[_0xf865('0x18')](_0x38d44e);}return _0x5183b6[_0xf865('0x19')](_0x38d44e)[_0xf865('0x1a')]();};}function respondWithResult(_0x202384,_0x5bfbe4){_0x5bfbe4=_0x5bfbe4||0xc8;return function(_0x456b56){if(_0x456b56){return _0x202384[_0xf865('0x19')](_0x5bfbe4)[_0xf865('0x1b')](_0x456b56);}};}function respondWithFilteredResult(_0x4969a8,_0x50323f){return function(_0x1d3381){if(_0x1d3381){var _0x2429e9=typeof _0x50323f['offset']===_0xf865('0x1c')&&typeof _0x50323f[_0xf865('0x1d')]===_0xf865('0x1c');var _0x111d71=_0x1d3381[_0xf865('0x1e')];var _0x10eddd=_0x2429e9?0x0:_0x50323f[_0xf865('0x1f')];var _0x219537=_0x2429e9?_0x1d3381[_0xf865('0x1e')]:_0x50323f['offset']+_0x50323f['limit'];var _0x29806d;if(_0x219537>=_0x111d71){_0x219537=_0x111d71;_0x29806d=0xc8;}else{_0x29806d=0xce;}_0x4969a8['status'](_0x29806d);return _0x4969a8['set']('Content-Range',_0x10eddd+'-'+_0x219537+'/'+_0x111d71)['json'](_0x1d3381);}return null;};}function patchUpdates(_0x4d20f6){return function(_0x4ff4e4){try{jsonpatch[_0xf865('0x20')](_0x4ff4e4,_0x4d20f6,!![]);}catch(_0x29f495){return BPromise[_0xf865('0x21')](_0x29f495);}return _0x4ff4e4[_0xf865('0x22')]();};}function saveUpdates(_0x58ef48,_0x45aa58){return function(_0x3df719){if(_0x3df719){return _0x3df719['update'](_0x58ef48)['then'](function(_0x4d74b5){return _0x4d74b5;});}return null;};}function removeEntity(_0x44a0e7,_0x4ddbdd){return function(_0x11f0bf){if(_0x11f0bf){return _0x11f0bf[_0xf865('0x23')]()['then'](function(){var _0x30eb43=_0x11f0bf[_0xf865('0x24')]({'plain':!![]});var _0x3b7525=_0xf865('0x25');return db[_0xf865('0x26')]['destroy']({'where':{'type':_0x3b7525,'resourceId':_0x30eb43['id']}})[_0xf865('0x27')](function(){return _0x11f0bf;});})['then'](function(){_0x44a0e7[_0xf865('0x19')](0xcc)[_0xf865('0x1a')]();});}};}function handleEntityNotFound(_0x430fe7,_0x3bffda){return function(_0x4f31e7){if(!_0x4f31e7){_0x430fe7[_0xf865('0x18')](0x194);}return _0x4f31e7;};}function handleError(_0x5a4ec8,_0x4765c4){_0x4765c4=_0x4765c4||0x1f4;return function(_0x2b17a9){logger['error'](_0x2b17a9[_0xf865('0x28')]);if(_0x2b17a9[_0xf865('0x29')]){delete _0x2b17a9[_0xf865('0x29')];}_0x5a4ec8['status'](_0x4765c4)[_0xf865('0x2a')](_0x2b17a9);};}exports[_0xf865('0x2b')]=function(_0x3b2dc8,_0x505171){var _0x11a40c={},_0x211a37={},_0x322f7c={'count':0x0,'rows':[]};var _0x39e2c1=_[_0xf865('0x2c')](db[_0xf865('0x2d')][_0xf865('0x2e')],function(_0x113642){return{'name':_0x113642[_0xf865('0x2f')],'type':_0x113642['type'][_0xf865('0x30')]};});_0x211a37['model']=_[_0xf865('0x2c')](_0x39e2c1,_0xf865('0x29'));_0x211a37[_0xf865('0x31')]=_[_0xf865('0x32')](_0x3b2dc8['query']);_0x211a37[_0xf865('0x33')]=_['intersection'](_0x211a37[_0xf865('0x34')],_0x211a37[_0xf865('0x31')]);_0x11a40c[_0xf865('0x35')]=_[_0xf865('0x36')](_0x211a37['model'],qs['fields'](_0x3b2dc8[_0xf865('0x31')][_0xf865('0x37')]));_0x11a40c['attributes']=_0x11a40c[_0xf865('0x35')][_0xf865('0x38')]?_0x11a40c['attributes']:_0x211a37['model'];if(!_0x3b2dc8['query']['hasOwnProperty']('nolimit')){_0x11a40c[_0xf865('0x1d')]=qs[_0xf865('0x1d')](_0x3b2dc8[_0xf865('0x31')]['limit']);_0x11a40c[_0xf865('0x1f')]=qs['offset'](_0x3b2dc8['query'][_0xf865('0x1f')]);}_0x11a40c[_0xf865('0x39')]=qs['sort'](_0x3b2dc8['query'][_0xf865('0x3a')]);_0x11a40c['where']=qs['filters'](_[_0xf865('0x3b')](_0x3b2dc8[_0xf865('0x31')],_0x211a37['filters']),_0x39e2c1);if(_0x3b2dc8[_0xf865('0x31')]['filter']){_0x11a40c[_0xf865('0x3c')]=_[_0xf865('0x3d')](_0x11a40c['where'],{'$or':_[_0xf865('0x2c')](_0x39e2c1,function(_0x3954b6){if(_0x3954b6[_0xf865('0x3e')]!==_0xf865('0x3f')){var _0x1ff846={};_0x1ff846[_0x3954b6[_0xf865('0x29')]]={'$like':'%'+_0x3b2dc8['query'][_0xf865('0x40')]+'%'};return _0x1ff846;}})});}_0x11a40c=_[_0xf865('0x3d')]({},_0x11a40c,_0x3b2dc8[_0xf865('0x41')]);var _0x4ef256={'where':_0x11a40c[_0xf865('0x3c')]};return db[_0xf865('0x2d')][_0xf865('0x1e')](_0x4ef256)[_0xf865('0x27')](function(_0x70d462){_0x322f7c[_0xf865('0x1e')]=_0x70d462;if(_0x3b2dc8[_0xf865('0x31')][_0xf865('0x42')]){_0x11a40c[_0xf865('0x43')]=[{'all':!![]}];}return db[_0xf865('0x2d')]['findAll'](_0x11a40c);})[_0xf865('0x27')](function(_0x4073f5){_0x322f7c[_0xf865('0x44')]=_0x4073f5;return _0x322f7c;})[_0xf865('0x27')](respondWithFilteredResult(_0x505171,_0x11a40c))[_0xf865('0x45')](handleError(_0x505171,null));};exports['show']=function(_0x4f1a5c,_0x55bdbc){var _0x3cfbd7={'raw':!![],'where':{'id':_0x4f1a5c[_0xf865('0x46')]['id']}},_0x577078={};_0x577078['model']=_[_0xf865('0x32')](db[_0xf865('0x2d')]['rawAttributes']);_0x577078[_0xf865('0x31')]=_[_0xf865('0x32')](_0x4f1a5c[_0xf865('0x31')]);_0x577078[_0xf865('0x33')]=_[_0xf865('0x36')](_0x577078[_0xf865('0x34')],_0x577078['query']);_0x3cfbd7[_0xf865('0x35')]=_[_0xf865('0x36')](_0x577078[_0xf865('0x34')],qs[_0xf865('0x37')](_0x4f1a5c[_0xf865('0x31')][_0xf865('0x37')]));_0x3cfbd7['attributes']=_0x3cfbd7[_0xf865('0x35')]['length']?_0x3cfbd7['attributes']:_0x577078[_0xf865('0x34')];if(_0x4f1a5c['query'][_0xf865('0x42')]){_0x3cfbd7[_0xf865('0x43')]=[{'all':!![]}];}_0x3cfbd7=_[_0xf865('0x3d')]({},_0x3cfbd7,_0x4f1a5c[_0xf865('0x41')]);return db[_0xf865('0x2d')][_0xf865('0x47')](_0x3cfbd7)[_0xf865('0x27')](handleEntityNotFound(_0x55bdbc,null))[_0xf865('0x27')](respondWithResult(_0x55bdbc,null))['catch'](handleError(_0x55bdbc,null));};exports['create']=function(_0x3c6a2e,_0x15c6f6){return db[_0xf865('0x2d')][_0xf865('0x48')](_0x3c6a2e[_0xf865('0x49')],{})[_0xf865('0x27')](function(_0x3ae8da){var _0x5f2d38=_0x3c6a2e[_0xf865('0x4a')]['get']({'plain':!![]});if(!_0x5f2d38)throw new Error(_0xf865('0x4b'));if(_0x5f2d38['role']===_0xf865('0x4a')){var _0x51dbbe=_0x3ae8da[_0xf865('0x24')]({'plain':!![]});var _0x413344='ODBC';return db[_0xf865('0x4c')]['find']({'where':{'name':_0x413344,'userProfileId':_0x5f2d38[_0xf865('0x4d')]},'raw':!![]})['then'](function(_0xe1d547){if(_0xe1d547&&_0xe1d547['autoAssociation']===0x0){return db['UserProfileResource'][_0xf865('0x48')]({'name':_0x51dbbe['name'],'resourceId':_0x51dbbe['id'],'type':_0xe1d547[_0xf865('0x29')],'sectionId':_0xe1d547['id']},{})[_0xf865('0x27')](function(){return _0x3ae8da;});}else{return _0x3ae8da;}})[_0xf865('0x45')](function(_0x3455c8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3455c8);throw _0x3455c8;});}return _0x3ae8da;})[_0xf865('0x27')](respondWithResult(_0x15c6f6,0xc9))['catch'](handleError(_0x15c6f6,null));};exports[_0xf865('0x4e')]=function(_0x443b81,_0x3fbb0e){if(_0x443b81[_0xf865('0x49')]['id']){delete _0x443b81[_0xf865('0x49')]['id'];}return db[_0xf865('0x2d')][_0xf865('0x47')]({'where':{'id':_0x443b81[_0xf865('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fbb0e,null))['then'](saveUpdates(_0x443b81[_0xf865('0x49')],null))[_0xf865('0x27')](respondWithResult(_0x3fbb0e,null))['catch'](handleError(_0x3fbb0e,null));};exports['destroy']=function(_0x551709,_0x50493a){return db[_0xf865('0x2d')][_0xf865('0x47')]({'where':{'id':_0x551709[_0xf865('0x46')]['id']}})[_0xf865('0x27')](handleEntityNotFound(_0x50493a,null))[_0xf865('0x27')](removeEntity(_0x50493a,null))[_0xf865('0x45')](handleError(_0x50493a,null));};exports[_0xf865('0x4f')]=function(_0x43a902,_0x4c06d1,_0x1a7680){var _0x5623ea;return db[_0xf865('0x2d')][_0xf865('0x47')]({'where':{'id':_0x43a902[_0xf865('0x46')]['id']},'attributes':['id',_0xf865('0x50')]})['then'](handleEntityNotFound(_0x4c06d1,null))[_0xf865('0x27')](function(_0x4ce6f0){if(_0x4ce6f0){var _0x3e6328=require(_0xf865('0x51'))();_0x3e6328[_0xf865('0x52')](_0x4ce6f0[_0xf865('0x50')]);_0x3e6328[_0xf865('0x53')]();return _0x4ce6f0;}})[_0xf865('0x27')](respondWithResult(_0x4c06d1,null))['catch'](handleError(_0x4c06d1,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index d48657f..b970dab 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 _0x43be=['SquareOdbc','lodash','util','api','request-promise','path','rimraf','exports','define'];(function(_0x31cc0e,_0x24ba4c){var _0x144862=function(_0x4d236e){while(--_0x4d236e){_0x31cc0e['push'](_0x31cc0e['shift']());}};_0x144862(++_0x24ba4c);}(_0x43be,0x18d));var _0xe43b=function(_0x555164,_0x13e97c){_0x555164=_0x555164-0x0;var _0x541861=_0x43be[_0x555164];return _0x541861;};'use strict';var _=require(_0xe43b('0x0'));var util=require(_0xe43b('0x1'));var logger=require('../../config/logger')(_0xe43b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe43b('0x3'));var fs=require('fs');var path=require(_0xe43b('0x4'));var rimraf=require(_0xe43b('0x5'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xe43b('0x6')]=function(_0xee83e3,_0x3f66a5){return _0xee83e3[_0xe43b('0x7')](_0xe43b('0x8'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40da=['exports','define','SquareOdbc','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x40da,0x6f));var _0xa40d=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x40da[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require(_0xa40d('0x0'));var logger=require(_0xa40d('0x1'))(_0xa40d('0x2'));var moment=require(_0xa40d('0x3'));var BPromise=require('bluebird');var rp=require(_0xa40d('0x4'));var fs=require('fs');var path=require(_0xa40d('0x5'));var rimraf=require(_0xa40d('0x6'));var config=require(_0xa40d('0x7'));var attributes=require(_0xa40d('0x8'));module[_0xa40d('0x9')]=function(_0x1bca82,_0x22d1a3){return _0x1bca82[_0xa40d('0xa')](_0xa40d('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index ad3bcb9..d78f2af 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 _0x9a2e=['where','attributes','include','map','model','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','ShowSquareOdbc','SquareOdbc','options','raw'];(function(_0x2896a4,_0x3b5983){var _0x97ce65=function(_0x16d309){while(--_0x16d309){_0x2896a4['push'](_0x2896a4['shift']());}};_0x97ce65(++_0x3b5983);}(_0x9a2e,0xed));var _0xe9a2=function(_0x476fa5,_0x151002){_0x476fa5=_0x476fa5-0x0;var _0x15f587=_0x9a2e[_0x476fa5];return _0x15f587;};'use strict';var _=require(_0xe9a2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe9a2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9a2('0x2'));var db=require(_0xe9a2('0x3'))['db'];var utils=require(_0xe9a2('0x4'));var logger=require('../../config/logger')(_0xe9a2('0x5'));var config=require(_0xe9a2('0x6'));var jayson=require(_0xe9a2('0x7'));var client=jayson[_0xe9a2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x132cd4,_0x477302,_0x1fd776){return new BPromise(function(_0x495576,_0x1dda2b){return client[_0xe9a2('0x9')](_0x132cd4,_0x1fd776)[_0xe9a2('0xa')](function(_0x3bb8d0){logger[_0xe9a2('0xb')](_0xe9a2('0xc'),_0x477302,'request\x20sent');logger[_0xe9a2('0xd')](_0xe9a2('0xe'),_0x477302,'request\x20sent',JSON[_0xe9a2('0xf')](_0x3bb8d0));if(_0x3bb8d0[_0xe9a2('0x10')]){if(_0x3bb8d0['error']['code']===0x1f4){logger['error'](_0xe9a2('0xc'),_0x477302,_0x3bb8d0['error'][_0xe9a2('0x11')]);return _0x1dda2b(_0x3bb8d0[_0xe9a2('0x10')][_0xe9a2('0x11')]);}logger[_0xe9a2('0x10')](_0xe9a2('0xc'),_0x477302,_0x3bb8d0['error']['message']);return _0x495576(_0x3bb8d0[_0xe9a2('0x10')][_0xe9a2('0x11')]);}else{logger[_0xe9a2('0xb')](_0xe9a2('0xc'),_0x477302,_0xe9a2('0x12'));_0x495576(_0x3bb8d0['result'][_0xe9a2('0x11')]);}})[_0xe9a2('0x13')](function(_0xaa4d20){logger[_0xe9a2('0x10')](_0xe9a2('0xc'),_0x477302,_0xaa4d20);_0x1dda2b(_0xaa4d20);});});}exports[_0xe9a2('0x14')]=function(_0x11061b){var _0x49a7ba=this;return new Promise(function(_0x1cf41e,_0x491622){return db[_0xe9a2('0x15')]['find']({'raw':_0x11061b[_0xe9a2('0x16')]?_0x11061b[_0xe9a2('0x16')][_0xe9a2('0x17')]===undefined?!![]:![]:!![],'where':_0x11061b[_0xe9a2('0x16')]?_0x11061b[_0xe9a2('0x16')][_0xe9a2('0x18')]||null:null,'attributes':_0x11061b[_0xe9a2('0x16')]?_0x11061b[_0xe9a2('0x16')][_0xe9a2('0x19')]||null:null,'include':_0x11061b[_0xe9a2('0x16')]?_0x11061b[_0xe9a2('0x16')][_0xe9a2('0x1a')]?_[_0xe9a2('0x1b')](_0x11061b['options']['include'],function(_0x2a9d53){return{'model':db[_0x2a9d53['model']],'as':_0x2a9d53['as'],'attributes':_0x2a9d53['attributes'],'include':_0x2a9d53['include']?_['map'](_0x2a9d53['include'],function(_0x2b0a40){return{'model':db[_0x2b0a40['model']],'as':_0x2b0a40['as'],'attributes':_0x2b0a40[_0xe9a2('0x19')],'include':_0x2b0a40['include']?_['map'](_0x2b0a40['include'],function(_0x24f003){return{'model':db[_0x24f003[_0xe9a2('0x1c')]],'as':_0x24f003['as'],'attributes':_0x24f003['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9a2('0xa')](function(_0x37dce8){logger[_0xe9a2('0xb')](_0xe9a2('0x14'),_0x11061b);logger[_0xe9a2('0xd')](_0xe9a2('0x14'),_0x11061b,JSON[_0xe9a2('0xf')](_0x37dce8));_0x1cf41e(_0x37dce8);})[_0xe9a2('0x13')](function(_0x3d24a3){logger[_0xe9a2('0x10')](_0xe9a2('0x14'),_0x3d24a3[_0xe9a2('0x11')],_0x11061b);_0x491622(_0x49a7ba['error'](0x1f4,_0x3d24a3['message']));});});}; \ No newline at end of file +var _0x44a5=['SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','attributes','map','include','model','then','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug'];(function(_0x4f1cb1,_0x795571){var _0x27e842=function(_0x348344){while(--_0x348344){_0x4f1cb1['push'](_0x4f1cb1['shift']());}};_0x27e842(++_0x795571);}(_0x44a5,0x17d));var _0x544a=function(_0x298e73,_0x4a537c){_0x298e73=_0x298e73-0x0;var _0x5391d8=_0x44a5[_0x298e73];return _0x5391d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x544a('0x0'));var BPromise=require(_0x544a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x544a('0x2'));var logger=require(_0x544a('0x3'))('rpc');var config=require(_0x544a('0x4'));var jayson=require(_0x544a('0x5'));var client=jayson['client'][_0x544a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x24afa3,_0x153031,_0x1cc092){return new BPromise(function(_0x44f4dd,_0x2b590f){return client[_0x544a('0x7')](_0x24afa3,_0x1cc092)['then'](function(_0x4a2b0d){logger[_0x544a('0x8')]('SquareOdbc,\x20%s,\x20%s',_0x153031,_0x544a('0x9'));logger[_0x544a('0xa')](_0x544a('0xb'),_0x153031,_0x544a('0x9'),JSON[_0x544a('0xc')](_0x4a2b0d));if(_0x4a2b0d[_0x544a('0xd')]){if(_0x4a2b0d[_0x544a('0xd')][_0x544a('0xe')]===0x1f4){logger[_0x544a('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x153031,_0x4a2b0d['error']['message']);return _0x2b590f(_0x4a2b0d['error']['message']);}logger[_0x544a('0xd')](_0x544a('0xf'),_0x153031,_0x4a2b0d[_0x544a('0xd')][_0x544a('0x10')]);return _0x44f4dd(_0x4a2b0d[_0x544a('0xd')]['message']);}else{logger[_0x544a('0x8')](_0x544a('0xf'),_0x153031,'request\x20sent');_0x44f4dd(_0x4a2b0d[_0x544a('0x11')][_0x544a('0x10')]);}})[_0x544a('0x12')](function(_0x281b37){logger[_0x544a('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x153031,_0x281b37);_0x2b590f(_0x281b37);});});}exports[_0x544a('0x13')]=function(_0x4ba4ed){var _0x4f803f=this;return new Promise(function(_0x21b0df,_0x4bf070){return db[_0x544a('0x14')]['find']({'raw':_0x4ba4ed[_0x544a('0x15')]?_0x4ba4ed[_0x544a('0x15')][_0x544a('0x16')]===undefined?!![]:![]:!![],'where':_0x4ba4ed['options']?_0x4ba4ed[_0x544a('0x15')]['where']||null:null,'attributes':_0x4ba4ed['options']?_0x4ba4ed[_0x544a('0x15')][_0x544a('0x17')]||null:null,'include':_0x4ba4ed['options']?_0x4ba4ed['options']['include']?_[_0x544a('0x18')](_0x4ba4ed[_0x544a('0x15')][_0x544a('0x19')],function(_0x27b659){return{'model':db[_0x27b659['model']],'as':_0x27b659['as'],'attributes':_0x27b659[_0x544a('0x17')],'include':_0x27b659[_0x544a('0x19')]?_[_0x544a('0x18')](_0x27b659[_0x544a('0x19')],function(_0x6bd7ee){return{'model':db[_0x6bd7ee['model']],'as':_0x6bd7ee['as'],'attributes':_0x6bd7ee[_0x544a('0x17')],'include':_0x6bd7ee['include']?_[_0x544a('0x18')](_0x6bd7ee[_0x544a('0x19')],function(_0x465766){return{'model':db[_0x465766[_0x544a('0x1a')]],'as':_0x465766['as'],'attributes':_0x465766['attributes']};}):[]};}):[]};}):[]:[]})[_0x544a('0x1b')](function(_0xfa1d64){logger[_0x544a('0x8')]('ShowSquareOdbc',_0x4ba4ed);logger['debug'](_0x544a('0x13'),_0x4ba4ed,JSON['stringify'](_0xfa1d64));_0x21b0df(_0xfa1d64);})[_0x544a('0x12')](function(_0x43f500){logger['error'](_0x544a('0x13'),_0x43f500[_0x544a('0x10')],_0x4ba4ed);_0x4bf070(_0x4f803f[_0x544a('0xd')](0x1f4,_0x43f500[_0x544a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index eaf9c00..37a5989 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 _0xf23c=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','/:id/users','getUsers','post','addUsers','update','/:id','destroy','delete','exports','multer'];(function(_0x4d0a9d,_0x2d1efd){var _0x4ceee7=function(_0xf60c6b){while(--_0xf60c6b){_0x4d0a9d['push'](_0x4d0a9d['shift']());}};_0x4ceee7(++_0x2d1efd);}(_0xf23c,0x77));var _0xcf23=function(_0x507965,_0x4944f4){_0x507965=_0x507965-0x0;var _0x3608fc=_0xf23c[_0x507965];return _0x3608fc;};'use strict';var multer=require(_0xcf23('0x0'));var util=require(_0xcf23('0x1'));var path=require(_0xcf23('0x2'));var timeout=require(_0xcf23('0x3'));var express=require(_0xcf23('0x4'));var router=express[_0xcf23('0x5')]();var fs_extra=require(_0xcf23('0x6'));var auth=require(_0xcf23('0x7'));var interaction=require(_0xcf23('0x8'));var config=require(_0xcf23('0x9'));var controller=require(_0xcf23('0xa'));router[_0xcf23('0xb')]('/',auth[_0xcf23('0xc')](),controller[_0xcf23('0xd')]);router['get']('/:id',auth[_0xcf23('0xc')](),controller[_0xcf23('0xe')]);router[_0xcf23('0xb')](_0xcf23('0xf'),auth[_0xcf23('0xc')](),controller[_0xcf23('0x10')]);router[_0xcf23('0x11')]('/',auth[_0xcf23('0xc')](),controller['create']);router[_0xcf23('0x11')](_0xcf23('0xf'),auth[_0xcf23('0xc')](),controller[_0xcf23('0x12')]);router['put']('/:id',auth[_0xcf23('0xc')](),controller[_0xcf23('0x13')]);router['delete'](_0xcf23('0x14'),auth[_0xcf23('0xc')](),controller[_0xcf23('0x15')]);router[_0xcf23('0x16')](_0xcf23('0xf'),auth[_0xcf23('0xc')](),controller['removeUsers']);module[_0xcf23('0x17')]=router; \ No newline at end of file +var _0x23f2=['multer','util','path','express','../../components/auth/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','getUsers','create','post','/:id/users','addUsers','put','update','destroy','removeUsers','exports'];(function(_0x3e3bed,_0x28cdc0){var _0x30595b=function(_0xa67c7d){while(--_0xa67c7d){_0x3e3bed['push'](_0x3e3bed['shift']());}};_0x30595b(++_0x28cdc0);}(_0x23f2,0x1a2));var _0x223f=function(_0x4cf2d4,_0x78174e){_0x4cf2d4=_0x4cf2d4-0x0;var _0x38ab31=_0x23f2[_0x4cf2d4];return _0x38ab31;};'use strict';var multer=require(_0x223f('0x0'));var util=require(_0x223f('0x1'));var path=require(_0x223f('0x2'));var timeout=require('connect-timeout');var express=require(_0x223f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x223f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x223f('0x5'));var controller=require(_0x223f('0x6'));router['get']('/',auth[_0x223f('0x7')](),controller[_0x223f('0x8')]);router[_0x223f('0x9')](_0x223f('0xa'),auth[_0x223f('0x7')](),controller[_0x223f('0xb')]);router[_0x223f('0x9')]('/:id/users',auth[_0x223f('0x7')](),controller[_0x223f('0xc')]);router['post']('/',auth[_0x223f('0x7')](),controller[_0x223f('0xd')]);router[_0x223f('0xe')](_0x223f('0xf'),auth[_0x223f('0x7')](),controller[_0x223f('0x10')]);router[_0x223f('0x11')](_0x223f('0xa'),auth['isAuthenticated'](),controller[_0x223f('0x12')]);router['delete'](_0x223f('0xa'),auth[_0x223f('0x7')](),controller[_0x223f('0x13')]);router['delete'](_0x223f('0xf'),auth['isAuthenticated'](),controller[_0x223f('0x14')]);module[_0x223f('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 57cb7ee..7eae806 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 _0x8fcf=['DATE','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x8fcf,0x1c9));var _0xf8fc=function(_0x5dd254,_0x1b4e51){_0x5dd254=_0x5dd254-0x0;var _0x4ce82e=_0x8fcf[_0x5dd254];return _0x4ce82e;};'use strict';var Sequelize=require('sequelize');module[_0xf8fc('0x0')]={'name':{'type':Sequelize[_0xf8fc('0x1')],'unique':_0xf8fc('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xf8fc('0x1')]},'notes':{'type':Sequelize[_0xf8fc('0x3')]},'preproduction':{'type':Sequelize[_0xf8fc('0x4')](_0xf8fc('0x5')),'get':function(){if(this[_0xf8fc('0x6')](_0xf8fc('0x7'))){return this[_0xf8fc('0x6')](_0xf8fc('0x7'))[_0xf8fc('0x8')](_0xf8fc('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0xf8fc('0x5')),'get':function(){if(this[_0xf8fc('0x6')](_0xf8fc('0xa'))){return this['getDataValue']('production')[_0xf8fc('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0xf8fc('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x215a=['exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','production','utf8','DATE','sequelize'];(function(_0x54a994,_0x364b49){var _0x22c80e=function(_0x55f48b){while(--_0x55f48b){_0x54a994['push'](_0x54a994['shift']());}};_0x22c80e(++_0x364b49);}(_0x215a,0xe9));var _0xa215=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x215a[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xa215('0x0'));module[_0xa215('0x1')]={'name':{'type':Sequelize[_0xa215('0x2')],'unique':_0xa215('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xa215('0x2')]},'notes':{'type':Sequelize[_0xa215('0x4')]},'preproduction':{'type':Sequelize[_0xa215('0x5')](_0xa215('0x6')),'get':function(){if(this[_0xa215('0x7')](_0xa215('0x8'))){return this[_0xa215('0x7')]('preproduction')[_0xa215('0x9')]('utf8');}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0xa215('0x7')](_0xa215('0xa'))){return this[_0xa215('0x7')](_0xa215('0xa'))[_0xa215('0x9')](_0xa215('0xb'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xa215('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index cd271bb..0060096 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 _0x1651=['offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','SquareProject','includeAll','findAll','rows','catch','show','params','include','options','find','create','role','user','SquareProjects','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','isArray','emit','userSquareProject:remove','getUsers','rawAttributes','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','register','sendStatus','status','end','undefined','limit','count'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0x1651,0x102));var _0x1165=function(_0x22ac9e,_0x26541d){_0x22ac9e=_0x22ac9e-0x0;var _0x4b4ab0=_0x1651[_0x22ac9e];return _0x4b4ab0;};'use strict';var emlformat=require(_0x1165('0x0'));var rimraf=require(_0x1165('0x1'));var zipdir=require(_0x1165('0x2'));var jsonpatch=require(_0x1165('0x3'));var rp=require(_0x1165('0x4'));var moment=require(_0x1165('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1165('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1165('0x7'));var ejs=require(_0x1165('0x8'));var fs=require('fs');var fs_extra=require(_0x1165('0x9'));var _=require('lodash');var squel=require(_0x1165('0xa'));var crypto=require('crypto');var jsforce=require(_0x1165('0xb'));var deskjs=require(_0x1165('0xc'));var toCsv=require(_0x1165('0x7'));var querystring=require(_0x1165('0xd'));var Papa=require(_0x1165('0xe'));var Redis=require(_0x1165('0xf'));var authService=require(_0x1165('0x10'));var qs=require(_0x1165('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1165('0x12'));var logger=require(_0x1165('0x13'))(_0x1165('0x14'));var utils=require(_0x1165('0x15'));var config=require(_0x1165('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1165('0x17')]=_[_0x1165('0x18')](config[_0x1165('0x17')],{'host':_0x1165('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1165('0x17')]));require('./squareProject.socket')[_0x1165('0x1a')](socket);function respondWithStatusCode(_0x37e331,_0x404a68){_0x404a68=_0x404a68||0xcc;return function(_0x4e1f64){if(_0x4e1f64){return _0x37e331[_0x1165('0x1b')](_0x404a68);}return _0x37e331[_0x1165('0x1c')](_0x404a68)[_0x1165('0x1d')]();};}function respondWithResult(_0x4c1425,_0x51cb5f){_0x51cb5f=_0x51cb5f||0xc8;return function(_0x57e44e){if(_0x57e44e){return _0x4c1425['status'](_0x51cb5f)['json'](_0x57e44e);}};}function respondWithFilteredResult(_0x27d6a7,_0x1bfef8){return function(_0x579763){if(_0x579763){var _0x558cf4=typeof _0x1bfef8['offset']===_0x1165('0x1e')&&typeof _0x1bfef8[_0x1165('0x1f')]===_0x1165('0x1e');var _0xf03791=_0x579763[_0x1165('0x20')];var _0x2a3a49=_0x558cf4?0x0:_0x1bfef8[_0x1165('0x21')];var _0x9a91eb=_0x558cf4?_0x579763[_0x1165('0x20')]:_0x1bfef8[_0x1165('0x21')]+_0x1bfef8['limit'];var _0x1b12d6;if(_0x9a91eb>=_0xf03791){_0x9a91eb=_0xf03791;_0x1b12d6=0xc8;}else{_0x1b12d6=0xce;}_0x27d6a7[_0x1165('0x1c')](_0x1b12d6);return _0x27d6a7[_0x1165('0x22')](_0x1165('0x23'),_0x2a3a49+'-'+_0x9a91eb+'/'+_0xf03791)[_0x1165('0x24')](_0x579763);}return null;};}function patchUpdates(_0x2c8748){return function(_0x28841c){try{jsonpatch[_0x1165('0x25')](_0x28841c,_0x2c8748,!![]);}catch(_0x4b07f1){return BPromise[_0x1165('0x26')](_0x4b07f1);}return _0x28841c[_0x1165('0x27')]();};}function saveUpdates(_0x6777db,_0x25c8fa){return function(_0x541a3b){if(_0x541a3b){return _0x541a3b[_0x1165('0x28')](_0x6777db)[_0x1165('0x29')](function(_0x33cd1f){return _0x33cd1f;});}return null;};}function removeEntity(_0x1388e9,_0x53534a){return function(_0x2772c0){if(_0x2772c0){return _0x2772c0[_0x1165('0x2a')]()[_0x1165('0x29')](function(){var _0x542f05=_0x2772c0[_0x1165('0x2b')]({'plain':!![]});var _0x1d2add='SquareProjects';return db[_0x1165('0x2c')][_0x1165('0x2a')]({'where':{'type':_0x1d2add,'resourceId':_0x542f05['id']}})[_0x1165('0x29')](function(){return _0x2772c0;});})[_0x1165('0x29')](function(){_0x1388e9[_0x1165('0x1c')](0xcc)[_0x1165('0x1d')]();});}};}function handleEntityNotFound(_0x20f443,_0x23d3a1){return function(_0x26d75a){if(!_0x26d75a){_0x20f443[_0x1165('0x1b')](0x194);}return _0x26d75a;};}function handleError(_0x184b99,_0x679a70){_0x679a70=_0x679a70||0x1f4;return function(_0x5e061d){logger[_0x1165('0x2d')](_0x5e061d[_0x1165('0x2e')]);if(_0x5e061d[_0x1165('0x2f')]){delete _0x5e061d[_0x1165('0x2f')];}_0x184b99[_0x1165('0x1c')](_0x679a70)[_0x1165('0x30')](_0x5e061d);};}exports[_0x1165('0x31')]=function(_0x3743ce,_0x5ac0f1){var _0xfe0e69={},_0x42bb4c={},_0x231001={'count':0x0,'rows':[]};var _0x172037=_['map'](db['SquareProject']['rawAttributes'],function(_0x208250){return{'name':_0x208250[_0x1165('0x32')],'type':_0x208250['type'][_0x1165('0x33')]};});_0x42bb4c[_0x1165('0x34')]=_[_0x1165('0x35')](_0x172037,'name');_0x42bb4c[_0x1165('0x36')]=_[_0x1165('0x37')](_0x3743ce[_0x1165('0x36')]);_0x42bb4c['filters']=_[_0x1165('0x38')](_0x42bb4c[_0x1165('0x34')],_0x42bb4c[_0x1165('0x36')]);_0xfe0e69[_0x1165('0x39')]=_[_0x1165('0x38')](_0x42bb4c['model'],qs[_0x1165('0x3a')](_0x3743ce['query'][_0x1165('0x3a')]));_0xfe0e69['attributes']=_0xfe0e69[_0x1165('0x39')][_0x1165('0x3b')]?_0xfe0e69[_0x1165('0x39')]:_0x42bb4c['model'];if(!_0x3743ce[_0x1165('0x36')][_0x1165('0x3c')]('nolimit')){_0xfe0e69[_0x1165('0x1f')]=qs[_0x1165('0x1f')](_0x3743ce[_0x1165('0x36')][_0x1165('0x1f')]);_0xfe0e69[_0x1165('0x21')]=qs['offset'](_0x3743ce['query'][_0x1165('0x21')]);}_0xfe0e69[_0x1165('0x3d')]=qs[_0x1165('0x3e')](_0x3743ce[_0x1165('0x36')][_0x1165('0x3e')]);_0xfe0e69[_0x1165('0x3f')]=qs['filters'](_[_0x1165('0x40')](_0x3743ce['query'],_0x42bb4c[_0x1165('0x41')]),_0x172037);if(_0x3743ce[_0x1165('0x36')][_0x1165('0x42')]){_0xfe0e69[_0x1165('0x3f')]=_[_0x1165('0x43')](_0xfe0e69[_0x1165('0x3f')],{'$or':_[_0x1165('0x35')](_0x172037,function(_0x3084cb){if(_0x3084cb[_0x1165('0x44')]!==_0x1165('0x45')){var _0x196c75={};_0x196c75[_0x3084cb[_0x1165('0x2f')]]={'$like':'%'+_0x3743ce[_0x1165('0x36')][_0x1165('0x42')]+'%'};return _0x196c75;}})});}_0xfe0e69=_[_0x1165('0x43')]({},_0xfe0e69,_0x3743ce['options']);var _0x3e6819={'where':_0xfe0e69[_0x1165('0x3f')]};return db[_0x1165('0x46')][_0x1165('0x20')](_0x3e6819)[_0x1165('0x29')](function(_0x437f3a){_0x231001[_0x1165('0x20')]=_0x437f3a;if(_0x3743ce['query'][_0x1165('0x47')]){_0xfe0e69['include']=[{'all':!![]}];}return db[_0x1165('0x46')][_0x1165('0x48')](_0xfe0e69);})[_0x1165('0x29')](function(_0x1aecda){_0x231001[_0x1165('0x49')]=_0x1aecda;return _0x231001;})['then'](respondWithFilteredResult(_0x5ac0f1,_0xfe0e69))[_0x1165('0x4a')](handleError(_0x5ac0f1,null));};exports[_0x1165('0x4b')]=function(_0x35f550,_0x2d6e21){var _0x556157={'raw':![],'where':{'id':_0x35f550[_0x1165('0x4c')]['id']}},_0x118f36={};_0x118f36[_0x1165('0x34')]=_[_0x1165('0x37')](db[_0x1165('0x46')]['rawAttributes']);_0x118f36[_0x1165('0x36')]=_['keys'](_0x35f550[_0x1165('0x36')]);_0x118f36[_0x1165('0x41')]=_[_0x1165('0x38')](_0x118f36[_0x1165('0x34')],_0x118f36['query']);_0x556157[_0x1165('0x39')]=_[_0x1165('0x38')](_0x118f36[_0x1165('0x34')],qs['fields'](_0x35f550[_0x1165('0x36')][_0x1165('0x3a')]));_0x556157[_0x1165('0x39')]=_0x556157[_0x1165('0x39')]['length']?_0x556157[_0x1165('0x39')]:_0x118f36[_0x1165('0x34')];if(_0x35f550[_0x1165('0x36')]['includeAll']){_0x556157[_0x1165('0x4d')]=[{'all':!![]}];}_0x556157=_[_0x1165('0x43')]({},_0x556157,_0x35f550[_0x1165('0x4e')]);return db[_0x1165('0x46')][_0x1165('0x4f')](_0x556157)['then'](handleEntityNotFound(_0x2d6e21,null))[_0x1165('0x29')](respondWithResult(_0x2d6e21,null))[_0x1165('0x4a')](handleError(_0x2d6e21,null));};exports[_0x1165('0x50')]=function(_0x4e6b97,_0x3402a8){return db[_0x1165('0x46')][_0x1165('0x50')](_0x4e6b97['body'],{})[_0x1165('0x29')](function(_0x415112){var _0x5d7e37=_0x4e6b97['user'][_0x1165('0x2b')]({'plain':!![]});if(!_0x5d7e37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d7e37[_0x1165('0x51')]===_0x1165('0x52')){var _0x2480b5=_0x415112[_0x1165('0x2b')]({'plain':!![]});var _0x306f3b=_0x1165('0x53');return db['UserProfileSection'][_0x1165('0x4f')]({'where':{'name':_0x306f3b,'userProfileId':_0x5d7e37[_0x1165('0x54')]},'raw':!![]})[_0x1165('0x29')](function(_0xcaa6ce){if(_0xcaa6ce&&_0xcaa6ce[_0x1165('0x55')]===0x0){return db['UserProfileResource'][_0x1165('0x50')]({'name':_0x2480b5[_0x1165('0x2f')],'resourceId':_0x2480b5['id'],'type':_0xcaa6ce[_0x1165('0x2f')],'sectionId':_0xcaa6ce['id']},{})['then'](function(){return _0x415112;});}else{return _0x415112;}})['catch'](function(_0x29a506){logger[_0x1165('0x2d')](_0x1165('0x56'),_0x29a506);throw _0x29a506;});}return _0x415112;})[_0x1165('0x29')](respondWithResult(_0x3402a8,0xc9))[_0x1165('0x4a')](handleError(_0x3402a8,null));};exports[_0x1165('0x28')]=function(_0x40127d,_0x4dbc6f){if(_0x40127d[_0x1165('0x57')]['id']){delete _0x40127d[_0x1165('0x57')]['id'];}return db[_0x1165('0x46')][_0x1165('0x4f')]({'where':{'id':_0x40127d[_0x1165('0x4c')]['id']}})[_0x1165('0x29')](handleEntityNotFound(_0x4dbc6f,null))[_0x1165('0x29')](saveUpdates(_0x40127d[_0x1165('0x57')],null))[_0x1165('0x29')](respondWithResult(_0x4dbc6f,null))[_0x1165('0x4a')](handleError(_0x4dbc6f,null));};exports[_0x1165('0x2a')]=function(_0x3e4aac,_0x1053cb){return db[_0x1165('0x46')][_0x1165('0x4f')]({'where':{'id':_0x3e4aac[_0x1165('0x4c')]['id']}})[_0x1165('0x29')](handleEntityNotFound(_0x1053cb,null))[_0x1165('0x29')](removeEntity(_0x1053cb,null))[_0x1165('0x4a')](handleError(_0x1053cb,null));};exports[_0x1165('0x58')]=function(_0x19cc79,_0x44dc9d,_0x38b461){return db[_0x1165('0x46')][_0x1165('0x4f')]({'where':{'id':_0x19cc79[_0x1165('0x4c')]['id']}})[_0x1165('0x29')](handleEntityNotFound(_0x44dc9d,null))[_0x1165('0x29')](function(_0x38884d){if(_0x38884d){return _0x38884d[_0x1165('0x58')](_0x19cc79[_0x1165('0x57')][_0x1165('0x59')],_[_0x1165('0x5a')](_0x19cc79['body'],[_0x1165('0x59'),'id'])||{});}})[_0x1165('0x29')](respondWithResult(_0x44dc9d,null))['catch'](handleError(_0x44dc9d,null));};exports['removeUsers']=function(_0x640263,_0x423615,_0x36105a){return db[_0x1165('0x46')][_0x1165('0x4f')]({'where':{'id':_0x640263['params']['id']}})[_0x1165('0x29')](handleEntityNotFound(_0x423615,null))[_0x1165('0x29')](function(_0x249a71){if(_0x249a71){return _0x249a71['removeUsers'](_0x640263[_0x1165('0x36')][_0x1165('0x59')])[_0x1165('0x29')](function(){if(_[_0x1165('0x5b')](_0x640263[_0x1165('0x36')][_0x1165('0x59')])){for(var _0x481235=0x0;_0x481235<_0x640263['query'][_0x1165('0x59')][_0x1165('0x3b')];_0x481235+=0x1){socket[_0x1165('0x5c')](_0x1165('0x5d'),{'UserId':Number(_0x640263['query']['ids'][_0x481235]),'SquareProjectId':Number(_0x640263[_0x1165('0x4c')]['id'])});}}else{socket[_0x1165('0x5c')](_0x1165('0x5d'),{'UserId':Number(_0x640263[_0x1165('0x36')][_0x1165('0x59')]),'SquareProjectId':Number(_0x640263[_0x1165('0x4c')]['id'])});}});}})[_0x1165('0x29')](respondWithStatusCode(_0x423615,null))['catch'](handleError(_0x423615,null));};exports[_0x1165('0x5e')]=function(_0x216d1d,_0x5bc22a,_0x27d6c8){var _0x320ee9={};var _0x5783f2={};var _0x20ad22;var _0x56e535;return db['SquareProject']['findOne']({'where':{'id':_0x216d1d['params']['id']}})[_0x1165('0x29')](handleEntityNotFound(_0x5bc22a,null))['then'](function(_0x476e96){if(_0x476e96){_0x20ad22=_0x476e96;_0x5783f2['model']=_[_0x1165('0x37')](db['User'][_0x1165('0x5f')]);_0x5783f2[_0x1165('0x36')]=_[_0x1165('0x37')](_0x216d1d[_0x1165('0x36')]);_0x5783f2[_0x1165('0x41')]=_[_0x1165('0x38')](_0x5783f2[_0x1165('0x34')],_0x5783f2[_0x1165('0x36')]);_0x320ee9['attributes']=_['intersection'](_0x5783f2[_0x1165('0x34')],qs[_0x1165('0x3a')](_0x216d1d[_0x1165('0x36')][_0x1165('0x3a')]));_0x320ee9[_0x1165('0x39')]=_0x320ee9['attributes'][_0x1165('0x3b')]?_0x320ee9['attributes']:_0x5783f2['model'];_0x320ee9['order']=qs['sort'](_0x216d1d['query'][_0x1165('0x3e')]);_0x320ee9[_0x1165('0x3f')]=qs[_0x1165('0x41')](_[_0x1165('0x40')](_0x216d1d[_0x1165('0x36')],_0x5783f2[_0x1165('0x41')]));if(_0x216d1d[_0x1165('0x36')][_0x1165('0x42')]){_0x320ee9['where']=_[_0x1165('0x43')](_0x320ee9['where'],{'$or':_[_0x1165('0x35')](_0x320ee9[_0x1165('0x39')],function(_0x3d7ead){var _0x26a0f5={};_0x26a0f5[_0x3d7ead]={'$like':'%'+_0x216d1d[_0x1165('0x36')]['filter']+'%'};return _0x26a0f5;})});}_0x320ee9=_[_0x1165('0x43')]({},_0x320ee9,_0x216d1d['options']);return _0x20ad22[_0x1165('0x5e')](_0x320ee9);}})[_0x1165('0x29')](function(_0x20fcae){if(_0x20fcae){_0x56e535=_0x20fcae['length'];if(!_0x216d1d['query']['hasOwnProperty'](_0x1165('0x60'))){_0x320ee9[_0x1165('0x1f')]=qs[_0x1165('0x1f')](_0x216d1d[_0x1165('0x36')][_0x1165('0x1f')]);_0x320ee9['offset']=qs[_0x1165('0x21')](_0x216d1d['query']['offset']);}return _0x20ad22[_0x1165('0x5e')](_0x320ee9);}})[_0x1165('0x29')](function(_0x5bd657){if(_0x5bd657){return _0x5bd657?{'count':_0x56e535,'rows':_0x5bd657}:null;}})[_0x1165('0x29')](respondWithResult(_0x5bc22a,null))['catch'](handleError(_0x5bc22a,null));}; \ No newline at end of file +var _0x4f52=['hasOwnProperty','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','end','error','name','send','index','map','SquareProject','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','filter','merge','options','includeAll','rows','catch','show','params','keys','length','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','emit','userSquareProject:remove','findOne','User','pick','getUsers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f52,0x1eb));var _0x24f5=function(_0x263940,_0x4da624){_0x263940=_0x263940-0x0;var _0x3a7893=_0x4f52[_0x263940];return _0x3a7893;};'use strict';var emlformat=require(_0x24f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x24f5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24f5('0x2'));var moment=require(_0x24f5('0x3'));var BPromise=require(_0x24f5('0x4'));var Mustache=require(_0x24f5('0x5'));var util=require(_0x24f5('0x6'));var path=require(_0x24f5('0x7'));var sox=require('sox');var csv=require(_0x24f5('0x8'));var ejs=require(_0x24f5('0x9'));var fs=require('fs');var fs_extra=require(_0x24f5('0xa'));var _=require(_0x24f5('0xb'));var squel=require(_0x24f5('0xc'));var crypto=require(_0x24f5('0xd'));var jsforce=require(_0x24f5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x24f5('0x8'));var querystring=require('querystring');var Papa=require(_0x24f5('0xf'));var Redis=require(_0x24f5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x24f5('0x11'));var as=require(_0x24f5('0x12'));var hardwareService=require(_0x24f5('0x13'));var logger=require(_0x24f5('0x14'))('api');var utils=require(_0x24f5('0x15'));var config=require(_0x24f5('0x16'));var licenseUtil=require(_0x24f5('0x17'));var db=require(_0x24f5('0x18'))['db'];config['redis']=_[_0x24f5('0x19')](config[_0x24f5('0x1a')],{'host':_0x24f5('0x1b'),'port':0x18eb});var socket=require(_0x24f5('0x1c'))(new Redis(config[_0x24f5('0x1a')]));require(_0x24f5('0x1d'))[_0x24f5('0x1e')](socket);function respondWithStatusCode(_0x148068,_0x45b5ba){_0x45b5ba=_0x45b5ba||0xcc;return function(_0x357bb5){if(_0x357bb5){return _0x148068[_0x24f5('0x1f')](_0x45b5ba);}return _0x148068['status'](_0x45b5ba)['end']();};}function respondWithResult(_0x513a62,_0x5c7e3b){_0x5c7e3b=_0x5c7e3b||0xc8;return function(_0x82e57b){if(_0x82e57b){return _0x513a62[_0x24f5('0x20')](_0x5c7e3b)[_0x24f5('0x21')](_0x82e57b);}};}function respondWithFilteredResult(_0x77fd25,_0x53ee9c){return function(_0x3f71dc){if(_0x3f71dc){var _0x5c7ba8=typeof _0x53ee9c[_0x24f5('0x22')]===_0x24f5('0x23')&&typeof _0x53ee9c[_0x24f5('0x24')]===_0x24f5('0x23');var _0x1e96bc=_0x3f71dc[_0x24f5('0x25')];var _0x222d59=_0x5c7ba8?0x0:_0x53ee9c['offset'];var _0x254266=_0x5c7ba8?_0x3f71dc[_0x24f5('0x25')]:_0x53ee9c[_0x24f5('0x22')]+_0x53ee9c[_0x24f5('0x24')];var _0x5b2a69;if(_0x254266>=_0x1e96bc){_0x254266=_0x1e96bc;_0x5b2a69=0xc8;}else{_0x5b2a69=0xce;}_0x77fd25['status'](_0x5b2a69);return _0x77fd25[_0x24f5('0x26')](_0x24f5('0x27'),_0x222d59+'-'+_0x254266+'/'+_0x1e96bc)[_0x24f5('0x21')](_0x3f71dc);}return null;};}function patchUpdates(_0x1a32a3){return function(_0x757201){try{jsonpatch[_0x24f5('0x28')](_0x757201,_0x1a32a3,!![]);}catch(_0x5175f9){return BPromise[_0x24f5('0x29')](_0x5175f9);}return _0x757201[_0x24f5('0x2a')]();};}function saveUpdates(_0x30cf2b,_0x2d6166){return function(_0x3f10f0){if(_0x3f10f0){return _0x3f10f0[_0x24f5('0x2b')](_0x30cf2b)[_0x24f5('0x2c')](function(_0x4c8aec){return _0x4c8aec;});}return null;};}function removeEntity(_0x2801c7,_0x13a8e3){return function(_0x5ea9f0){if(_0x5ea9f0){return _0x5ea9f0[_0x24f5('0x2d')]()[_0x24f5('0x2c')](function(){var _0x16a7e8=_0x5ea9f0[_0x24f5('0x2e')]({'plain':!![]});var _0x4c3339=_0x24f5('0x2f');return db[_0x24f5('0x30')][_0x24f5('0x2d')]({'where':{'type':_0x4c3339,'resourceId':_0x16a7e8['id']}})[_0x24f5('0x2c')](function(){return _0x5ea9f0;});})[_0x24f5('0x2c')](function(){_0x2801c7[_0x24f5('0x20')](0xcc)[_0x24f5('0x31')]();});}};}function handleEntityNotFound(_0x211940,_0x2c3e87){return function(_0x3cd5e2){if(!_0x3cd5e2){_0x211940[_0x24f5('0x1f')](0x194);}return _0x3cd5e2;};}function handleError(_0xc35541,_0x2cc3d5){_0x2cc3d5=_0x2cc3d5||0x1f4;return function(_0x116518){logger[_0x24f5('0x32')](_0x116518['stack']);if(_0x116518[_0x24f5('0x33')]){delete _0x116518[_0x24f5('0x33')];}_0xc35541['status'](_0x2cc3d5)[_0x24f5('0x34')](_0x116518);};}exports[_0x24f5('0x35')]=function(_0x486bb3,_0x2995ac){var _0x138528={},_0x4bd7d5={},_0x46bb31={'count':0x0,'rows':[]};var _0x3fed4b=_[_0x24f5('0x36')](db[_0x24f5('0x37')][_0x24f5('0x38')],function(_0x2b4c84){return{'name':_0x2b4c84['fieldName'],'type':_0x2b4c84[_0x24f5('0x39')][_0x24f5('0x3a')]};});_0x4bd7d5[_0x24f5('0x3b')]=_['map'](_0x3fed4b,'name');_0x4bd7d5[_0x24f5('0x3c')]=_['keys'](_0x486bb3['query']);_0x4bd7d5[_0x24f5('0x3d')]=_[_0x24f5('0x3e')](_0x4bd7d5[_0x24f5('0x3b')],_0x4bd7d5[_0x24f5('0x3c')]);_0x138528[_0x24f5('0x3f')]=_['intersection'](_0x4bd7d5[_0x24f5('0x3b')],qs[_0x24f5('0x40')](_0x486bb3['query']['fields']));_0x138528[_0x24f5('0x3f')]=_0x138528[_0x24f5('0x3f')]['length']?_0x138528[_0x24f5('0x3f')]:_0x4bd7d5['model'];if(!_0x486bb3[_0x24f5('0x3c')]['hasOwnProperty']('nolimit')){_0x138528[_0x24f5('0x24')]=qs['limit'](_0x486bb3['query'][_0x24f5('0x24')]);_0x138528['offset']=qs[_0x24f5('0x22')](_0x486bb3['query'][_0x24f5('0x22')]);}_0x138528[_0x24f5('0x41')]=qs[_0x24f5('0x42')](_0x486bb3[_0x24f5('0x3c')][_0x24f5('0x42')]);_0x138528[_0x24f5('0x43')]=qs[_0x24f5('0x3d')](_['pick'](_0x486bb3['query'],_0x4bd7d5[_0x24f5('0x3d')]),_0x3fed4b);if(_0x486bb3[_0x24f5('0x3c')][_0x24f5('0x44')]){_0x138528['where']=_[_0x24f5('0x45')](_0x138528[_0x24f5('0x43')],{'$or':_[_0x24f5('0x36')](_0x3fed4b,function(_0x2b91d8){if(_0x2b91d8[_0x24f5('0x39')]!=='VIRTUAL'){var _0x294acd={};_0x294acd[_0x2b91d8['name']]={'$like':'%'+_0x486bb3['query'][_0x24f5('0x44')]+'%'};return _0x294acd;}})});}_0x138528=_[_0x24f5('0x45')]({},_0x138528,_0x486bb3[_0x24f5('0x46')]);var _0x5f2ea3={'where':_0x138528[_0x24f5('0x43')]};return db[_0x24f5('0x37')]['count'](_0x5f2ea3)[_0x24f5('0x2c')](function(_0x54da78){_0x46bb31[_0x24f5('0x25')]=_0x54da78;if(_0x486bb3[_0x24f5('0x3c')][_0x24f5('0x47')]){_0x138528['include']=[{'all':!![]}];}return db[_0x24f5('0x37')]['findAll'](_0x138528);})[_0x24f5('0x2c')](function(_0x4a225c){_0x46bb31[_0x24f5('0x48')]=_0x4a225c;return _0x46bb31;})[_0x24f5('0x2c')](respondWithFilteredResult(_0x2995ac,_0x138528))[_0x24f5('0x49')](handleError(_0x2995ac,null));};exports[_0x24f5('0x4a')]=function(_0x540758,_0x369381){var _0x5532d7={'raw':![],'where':{'id':_0x540758[_0x24f5('0x4b')]['id']}},_0x5512ac={};_0x5512ac[_0x24f5('0x3b')]=_['keys'](db[_0x24f5('0x37')]['rawAttributes']);_0x5512ac[_0x24f5('0x3c')]=_[_0x24f5('0x4c')](_0x540758[_0x24f5('0x3c')]);_0x5512ac[_0x24f5('0x3d')]=_[_0x24f5('0x3e')](_0x5512ac['model'],_0x5512ac[_0x24f5('0x3c')]);_0x5532d7[_0x24f5('0x3f')]=_['intersection'](_0x5512ac['model'],qs[_0x24f5('0x40')](_0x540758[_0x24f5('0x3c')][_0x24f5('0x40')]));_0x5532d7['attributes']=_0x5532d7[_0x24f5('0x3f')][_0x24f5('0x4d')]?_0x5532d7[_0x24f5('0x3f')]:_0x5512ac['model'];if(_0x540758[_0x24f5('0x3c')][_0x24f5('0x47')]){_0x5532d7[_0x24f5('0x4e')]=[{'all':!![]}];}_0x5532d7=_['merge']({},_0x5532d7,_0x540758['options']);return db['SquareProject'][_0x24f5('0x4f')](_0x5532d7)[_0x24f5('0x2c')](handleEntityNotFound(_0x369381,null))[_0x24f5('0x2c')](respondWithResult(_0x369381,null))[_0x24f5('0x49')](handleError(_0x369381,null));};exports['create']=function(_0x2c73ec,_0x524741){return db[_0x24f5('0x37')][_0x24f5('0x50')](_0x2c73ec[_0x24f5('0x51')],{})['then'](function(_0x346d71){var _0x22623b=_0x2c73ec[_0x24f5('0x52')][_0x24f5('0x2e')]({'plain':!![]});if(!_0x22623b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22623b[_0x24f5('0x53')]===_0x24f5('0x52')){var _0x31d13f=_0x346d71[_0x24f5('0x2e')]({'plain':!![]});var _0x150410='SquareProjects';return db[_0x24f5('0x54')][_0x24f5('0x4f')]({'where':{'name':_0x150410,'userProfileId':_0x22623b[_0x24f5('0x55')]},'raw':!![]})[_0x24f5('0x2c')](function(_0x100eca){if(_0x100eca&&_0x100eca[_0x24f5('0x56')]===0x0){return db[_0x24f5('0x30')][_0x24f5('0x50')]({'name':_0x31d13f[_0x24f5('0x33')],'resourceId':_0x31d13f['id'],'type':_0x100eca['name'],'sectionId':_0x100eca['id']},{})[_0x24f5('0x2c')](function(){return _0x346d71;});}else{return _0x346d71;}})[_0x24f5('0x49')](function(_0x50806f){logger[_0x24f5('0x32')](_0x24f5('0x57'),_0x50806f);throw _0x50806f;});}return _0x346d71;})['then'](respondWithResult(_0x524741,0xc9))[_0x24f5('0x49')](handleError(_0x524741,null));};exports[_0x24f5('0x2b')]=function(_0x1cc927,_0x16f48c){if(_0x1cc927[_0x24f5('0x51')]['id']){delete _0x1cc927[_0x24f5('0x51')]['id'];}return db['SquareProject'][_0x24f5('0x4f')]({'where':{'id':_0x1cc927[_0x24f5('0x4b')]['id']}})[_0x24f5('0x2c')](handleEntityNotFound(_0x16f48c,null))['then'](saveUpdates(_0x1cc927[_0x24f5('0x51')],null))[_0x24f5('0x2c')](respondWithResult(_0x16f48c,null))[_0x24f5('0x49')](handleError(_0x16f48c,null));};exports['destroy']=function(_0x5e8c4c,_0x1cfe06){return db[_0x24f5('0x37')][_0x24f5('0x4f')]({'where':{'id':_0x5e8c4c['params']['id']}})[_0x24f5('0x2c')](handleEntityNotFound(_0x1cfe06,null))[_0x24f5('0x2c')](removeEntity(_0x1cfe06,null))[_0x24f5('0x49')](handleError(_0x1cfe06,null));};exports[_0x24f5('0x58')]=function(_0x4eb314,_0x18ef17,_0x34c7f3){return db[_0x24f5('0x37')][_0x24f5('0x4f')]({'where':{'id':_0x4eb314[_0x24f5('0x4b')]['id']}})[_0x24f5('0x2c')](handleEntityNotFound(_0x18ef17,null))[_0x24f5('0x2c')](function(_0x23b5b4){if(_0x23b5b4){return _0x23b5b4[_0x24f5('0x58')](_0x4eb314['body'][_0x24f5('0x59')],_['omit'](_0x4eb314[_0x24f5('0x51')],[_0x24f5('0x59'),'id'])||{});}})[_0x24f5('0x2c')](respondWithResult(_0x18ef17,null))['catch'](handleError(_0x18ef17,null));};exports[_0x24f5('0x5a')]=function(_0x417242,_0x290d8e,_0x27049b){return db['SquareProject']['find']({'where':{'id':_0x417242[_0x24f5('0x4b')]['id']}})[_0x24f5('0x2c')](handleEntityNotFound(_0x290d8e,null))[_0x24f5('0x2c')](function(_0x56d628){if(_0x56d628){return _0x56d628[_0x24f5('0x5a')](_0x417242['query'][_0x24f5('0x59')])[_0x24f5('0x2c')](function(){if(_['isArray'](_0x417242['query'][_0x24f5('0x59')])){for(var _0x4222de=0x0;_0x4222de<_0x417242[_0x24f5('0x3c')]['ids']['length'];_0x4222de+=0x1){socket[_0x24f5('0x5b')](_0x24f5('0x5c'),{'UserId':Number(_0x417242[_0x24f5('0x3c')][_0x24f5('0x59')][_0x4222de]),'SquareProjectId':Number(_0x417242[_0x24f5('0x4b')]['id'])});}}else{socket[_0x24f5('0x5b')]('userSquareProject:remove',{'UserId':Number(_0x417242['query'][_0x24f5('0x59')]),'SquareProjectId':Number(_0x417242[_0x24f5('0x4b')]['id'])});}});}})[_0x24f5('0x2c')](respondWithStatusCode(_0x290d8e,null))[_0x24f5('0x49')](handleError(_0x290d8e,null));};exports['getUsers']=function(_0x5ab2b0,_0x3ed58a,_0x1a2170){var _0x586288={};var _0x1339ef={};var _0x4fd76d;var _0x5d30ff;return db['SquareProject'][_0x24f5('0x5d')]({'where':{'id':_0x5ab2b0[_0x24f5('0x4b')]['id']}})[_0x24f5('0x2c')](handleEntityNotFound(_0x3ed58a,null))[_0x24f5('0x2c')](function(_0x3e8843){if(_0x3e8843){_0x4fd76d=_0x3e8843;_0x1339ef['model']=_[_0x24f5('0x4c')](db[_0x24f5('0x5e')]['rawAttributes']);_0x1339ef[_0x24f5('0x3c')]=_[_0x24f5('0x4c')](_0x5ab2b0[_0x24f5('0x3c')]);_0x1339ef[_0x24f5('0x3d')]=_['intersection'](_0x1339ef[_0x24f5('0x3b')],_0x1339ef[_0x24f5('0x3c')]);_0x586288[_0x24f5('0x3f')]=_[_0x24f5('0x3e')](_0x1339ef[_0x24f5('0x3b')],qs['fields'](_0x5ab2b0[_0x24f5('0x3c')][_0x24f5('0x40')]));_0x586288[_0x24f5('0x3f')]=_0x586288[_0x24f5('0x3f')]['length']?_0x586288['attributes']:_0x1339ef[_0x24f5('0x3b')];_0x586288[_0x24f5('0x41')]=qs['sort'](_0x5ab2b0[_0x24f5('0x3c')]['sort']);_0x586288['where']=qs[_0x24f5('0x3d')](_[_0x24f5('0x5f')](_0x5ab2b0[_0x24f5('0x3c')],_0x1339ef[_0x24f5('0x3d')]));if(_0x5ab2b0['query'][_0x24f5('0x44')]){_0x586288[_0x24f5('0x43')]=_[_0x24f5('0x45')](_0x586288[_0x24f5('0x43')],{'$or':_['map'](_0x586288[_0x24f5('0x3f')],function(_0x550ab0){var _0x3b6f61={};_0x3b6f61[_0x550ab0]={'$like':'%'+_0x5ab2b0[_0x24f5('0x3c')][_0x24f5('0x44')]+'%'};return _0x3b6f61;})});}_0x586288=_[_0x24f5('0x45')]({},_0x586288,_0x5ab2b0[_0x24f5('0x46')]);return _0x4fd76d[_0x24f5('0x60')](_0x586288);}})['then'](function(_0x42d6a5){if(_0x42d6a5){_0x5d30ff=_0x42d6a5[_0x24f5('0x4d')];if(!_0x5ab2b0[_0x24f5('0x3c')][_0x24f5('0x61')]('nolimit')){_0x586288[_0x24f5('0x24')]=qs[_0x24f5('0x24')](_0x5ab2b0[_0x24f5('0x3c')][_0x24f5('0x24')]);_0x586288[_0x24f5('0x22')]=qs[_0x24f5('0x22')](_0x5ab2b0[_0x24f5('0x3c')]['offset']);}return _0x4fd76d[_0x24f5('0x60')](_0x586288);}})['then'](function(_0x1b3cbd){if(_0x1b3cbd){return _0x1b3cbd?{'count':_0x5d30ff,'rows':_0x1b3cbd}:null;}})[_0x24f5('0x2c')](respondWithResult(_0x3ed58a,null))[_0x24f5('0x49')](handleError(_0x3ed58a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index ae626ce..e300ec9 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 _0x38e0=['SquareProject','setMaxListeners','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x38e0,0x180));var _0x038e=function(_0x1fb212,_0x1d84e7){_0x1fb212=_0x1fb212-0x0;var _0x262fa3=_0x38e0[_0x1fb212];return _0x262fa3;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x038e('0x0'))['db'][_0x038e('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x038e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3b8d3a){return function(_0x4d1730,_0x3c050c,_0x5c1570){SquareProjectEvents[_0x038e('0x3')](_0x3b8d3a+':'+_0x4d1730['id'],_0x4d1730);SquareProjectEvents[_0x038e('0x3')](_0x3b8d3a,_0x4d1730);_0x5c1570(null);};}for(var e in events){if(events[_0x038e('0x4')](e)){var event=events[e];SquareProject[_0x038e('0x5')](e,emitEvent(event));}}module[_0x038e('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0x0690=['emit','hook','../../mysqldb','SquareProject','setMaxListeners','update','remove'];(function(_0x30e085,_0x29c806){var _0x459d25=function(_0x23bbca){while(--_0x23bbca){_0x30e085['push'](_0x30e085['shift']());}};_0x459d25(++_0x29c806);}(_0x0690,0x1ec));var _0x0069=function(_0x49b4bf,_0x59c4fd){_0x49b4bf=_0x49b4bf-0x0;var _0x494d21=_0x0690[_0x49b4bf];return _0x494d21;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x0069('0x0'))['db'][_0x0069('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0069('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0069('0x3'),'afterDestroy':_0x0069('0x4')};function emitEvent(_0x16a018){return function(_0x40f850,_0x456398,_0x3be319){SquareProjectEvents[_0x0069('0x5')](_0x16a018+':'+_0x40f850['id'],_0x40f850);SquareProjectEvents['emit'](_0x16a018,_0x40f850);_0x3be319(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x0069('0x6')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 46ab9ac..1c16a01 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 _0x551f=['bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','changed','production','format','lodash','../../config/logger'];(function(_0x48d43f,_0x3a651c){var _0x5099bd=function(_0x4c40aa){while(--_0x4c40aa){_0x48d43f['push'](_0x48d43f['shift']());}};_0x5099bd(++_0x3a651c);}(_0x551f,0x11f));var _0xf551=function(_0x3845c1,_0x5090a2){_0x3845c1=_0x3845c1-0x0;var _0x4222f5=_0x551f[_0x3845c1];return _0x4222f5;};'use strict';var _=require(_0xf551('0x0'));var util=require('util');var logger=require(_0xf551('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf551('0x2'));var rp=require(_0xf551('0x3'));var fs=require('fs');var path=require(_0xf551('0x4'));var rimraf=require(_0xf551('0x5'));var config=require(_0xf551('0x6'));var attributes=require(_0xf551('0x7'));module[_0xf551('0x8')]=function(_0x77458f,_0x4e4386){return _0x77458f['define'](_0xf551('0x9'),attributes,{'tableName':_0xf551('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503a5f,_0x4e4f26,_0x2af2be){if(_0x503a5f['changed'](_0xf551('0xb'))){_0x503a5f[_0xf551('0xc')]=moment()['format'](_0xf551('0xd'));}if(_0x503a5f[_0xf551('0xe')](_0xf551('0xf'))){_0x503a5f['publishedAt']=moment()[_0xf551('0x10')](_0xf551('0xd'));}_0x2af2be(null,_0x503a5f);}}});}; \ No newline at end of file +var _0x0171=['request-promise','path','rimraf','../../config/environment','exports','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','../../config/logger','api','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0171,0x84));var _0x1017=function(_0x50a6dc,_0x4440bc){_0x50a6dc=_0x50a6dc-0x0;var _0x23d80f=_0x0171[_0x50a6dc];return _0x23d80f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1017('0x0'))(_0x1017('0x1'));var moment=require(_0x1017('0x2'));var BPromise=require(_0x1017('0x3'));var rp=require(_0x1017('0x4'));var fs=require('fs');var path=require(_0x1017('0x5'));var rimraf=require(_0x1017('0x6'));var config=require(_0x1017('0x7'));var attributes=require('./squareProject.attributes');module[_0x1017('0x8')]=function(_0x425a3e,_0x54bb98){return _0x425a3e['define']('SquareProject',attributes,{'tableName':_0x1017('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ff367,_0x29f857,_0x497c78){if(_0x1ff367[_0x1017('0xa')](_0x1017('0xb'))){_0x1ff367[_0x1017('0xc')]=moment()[_0x1017('0xd')](_0x1017('0xe'));}if(_0x1ff367['changed'](_0x1017('0xf'))){_0x1ff367[_0x1017('0x10')]=moment()[_0x1017('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x497c78(null,_0x1ff367);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 6c8a48d..c885c01 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 _0x74c8=['info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','catch','SquareProject','find','options','raw','where','include','map','model','attributes','then','ShowSquareProject','debug','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./squareProject.socket','register','request'];(function(_0x4ba2ea,_0x4e056b){var _0x17f915=function(_0x46785f){while(--_0x46785f){_0x4ba2ea['push'](_0x4ba2ea['shift']());}};_0x17f915(++_0x4e056b);}(_0x74c8,0xb5));var _0x874c=function(_0x2f08c1,_0x45a9bd){_0x2f08c1=_0x2f08c1-0x0;var _0x3bd057=_0x74c8[_0x2f08c1];return _0x3bd057;};'use strict';var _=require(_0x874c('0x0'));var util=require(_0x874c('0x1'));var moment=require(_0x874c('0x2'));var BPromise=require('bluebird');var rs=require(_0x874c('0x3'));var fs=require('fs');var Redis=require(_0x874c('0x4'));var db=require(_0x874c('0x5'))['db'];var utils=require(_0x874c('0x6'));var logger=require(_0x874c('0x7'))(_0x874c('0x8'));var config=require(_0x874c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x874c('0xa')][_0x874c('0xb')]({'port':0x232a});config['redis']=_[_0x874c('0xc')](config['redis'],{'host':_0x874c('0xd'),'port':0x18eb});var socket=require(_0x874c('0xe'))(new Redis(config[_0x874c('0xf')]));require(_0x874c('0x10'))[_0x874c('0x11')](socket);function respondWithRpcPromise(_0x5bfa65,_0x5291c5,_0x2ec094){return new BPromise(function(_0x5aa63b,_0x364157){return client[_0x874c('0x12')](_0x5bfa65,_0x2ec094)['then'](function(_0x5eaf1d){logger[_0x874c('0x13')](_0x874c('0x14'),_0x5291c5,_0x874c('0x15'));logger['debug'](_0x874c('0x16'),_0x5291c5,_0x874c('0x15'),JSON['stringify'](_0x5eaf1d));if(_0x5eaf1d[_0x874c('0x17')]){if(_0x5eaf1d[_0x874c('0x17')][_0x874c('0x18')]===0x1f4){logger[_0x874c('0x17')](_0x874c('0x14'),_0x5291c5,_0x5eaf1d['error']['message']);return _0x364157(_0x5eaf1d[_0x874c('0x17')][_0x874c('0x19')]);}logger[_0x874c('0x17')](_0x874c('0x14'),_0x5291c5,_0x5eaf1d[_0x874c('0x17')][_0x874c('0x19')]);return _0x5aa63b(_0x5eaf1d[_0x874c('0x17')][_0x874c('0x19')]);}else{logger[_0x874c('0x13')](_0x874c('0x14'),_0x5291c5,_0x874c('0x15'));_0x5aa63b(_0x5eaf1d['result']['message']);}})[_0x874c('0x1a')](function(_0x449e8c){logger['error'](_0x874c('0x14'),_0x5291c5,_0x449e8c);_0x364157(_0x449e8c);});});}exports['ShowSquareProject']=function(_0x4480bc){var _0x4b2c73=this;return new Promise(function(_0xdda4e0,_0x36a95b){return db[_0x874c('0x1b')][_0x874c('0x1c')]({'raw':_0x4480bc['options']?_0x4480bc[_0x874c('0x1d')][_0x874c('0x1e')]===undefined?!![]:![]:!![],'where':_0x4480bc['options']?_0x4480bc[_0x874c('0x1d')][_0x874c('0x1f')]||null:null,'attributes':_0x4480bc[_0x874c('0x1d')]?_0x4480bc[_0x874c('0x1d')]['attributes']||null:null,'include':_0x4480bc[_0x874c('0x1d')]?_0x4480bc[_0x874c('0x1d')][_0x874c('0x20')]?_[_0x874c('0x21')](_0x4480bc[_0x874c('0x1d')][_0x874c('0x20')],function(_0x3e7345){return{'model':db[_0x3e7345[_0x874c('0x22')]],'as':_0x3e7345['as'],'attributes':_0x3e7345[_0x874c('0x23')],'include':_0x3e7345[_0x874c('0x20')]?_[_0x874c('0x21')](_0x3e7345['include'],function(_0x32e636){return{'model':db[_0x32e636[_0x874c('0x22')]],'as':_0x32e636['as'],'attributes':_0x32e636[_0x874c('0x23')],'include':_0x32e636[_0x874c('0x20')]?_[_0x874c('0x21')](_0x32e636[_0x874c('0x20')],function(_0x140089){return{'model':db[_0x140089[_0x874c('0x22')]],'as':_0x140089['as'],'attributes':_0x140089[_0x874c('0x23')]};}):[]};}):[]};}):[]:[]})[_0x874c('0x24')](function(_0x26deb9){logger['info'](_0x874c('0x25'),_0x4480bc);logger[_0x874c('0x26')](_0x874c('0x25'),_0x4480bc,JSON[_0x874c('0x27')](_0x26deb9));_0xdda4e0(_0x26deb9);})['catch'](function(_0x528da5){logger[_0x874c('0x17')](_0x874c('0x25'),_0x528da5['message'],_0x4480bc);_0x36a95b(_0x4b2c73[_0x874c('0x17')](0x1f4,_0x528da5[_0x874c('0x19')]));});});}; \ No newline at end of file +var _0xc165=['include','model','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSquareProject','SquareProject','find','options','raw','attributes','map'];(function(_0x4926bf,_0x54e35d){var _0x4569e2=function(_0x1b3a5c){while(--_0x1b3a5c){_0x4926bf['push'](_0x4926bf['shift']());}};_0x4569e2(++_0x54e35d);}(_0xc165,0x18a));var _0x5c16=function(_0x534f7c,_0x3eb489){_0x534f7c=_0x534f7c-0x0;var _0x5c3e22=_0xc165[_0x534f7c];return _0x5c3e22;};'use strict';var _=require(_0x5c16('0x0'));var util=require(_0x5c16('0x1'));var moment=require(_0x5c16('0x2'));var BPromise=require(_0x5c16('0x3'));var rs=require(_0x5c16('0x4'));var fs=require('fs');var Redis=require(_0x5c16('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c16('0x6'));var logger=require(_0x5c16('0x7'))(_0x5c16('0x8'));var config=require(_0x5c16('0x9'));var jayson=require(_0x5c16('0xa'));var client=jayson[_0x5c16('0xb')]['http']({'port':0x232a});config['redis']=_[_0x5c16('0xc')](config[_0x5c16('0xd')],{'host':_0x5c16('0xe'),'port':0x18eb});var socket=require(_0x5c16('0xf'))(new Redis(config[_0x5c16('0xd')]));require(_0x5c16('0x10'))[_0x5c16('0x11')](socket);function respondWithRpcPromise(_0x431dcb,_0x33c19b,_0x42263b){return new BPromise(function(_0x420f90,_0x32348c){return client['request'](_0x431dcb,_0x42263b)[_0x5c16('0x12')](function(_0xd9156){logger[_0x5c16('0x13')](_0x5c16('0x14'),_0x33c19b,_0x5c16('0x15'));logger['debug'](_0x5c16('0x16'),_0x33c19b,'request\x20sent',JSON[_0x5c16('0x17')](_0xd9156));if(_0xd9156[_0x5c16('0x18')]){if(_0xd9156[_0x5c16('0x18')][_0x5c16('0x19')]===0x1f4){logger['error'](_0x5c16('0x14'),_0x33c19b,_0xd9156[_0x5c16('0x18')][_0x5c16('0x1a')]);return _0x32348c(_0xd9156['error'][_0x5c16('0x1a')]);}logger['error'](_0x5c16('0x14'),_0x33c19b,_0xd9156['error'][_0x5c16('0x1a')]);return _0x420f90(_0xd9156[_0x5c16('0x18')][_0x5c16('0x1a')]);}else{logger[_0x5c16('0x13')](_0x5c16('0x14'),_0x33c19b,_0x5c16('0x15'));_0x420f90(_0xd9156[_0x5c16('0x1b')][_0x5c16('0x1a')]);}})['catch'](function(_0x7580fe){logger['error'](_0x5c16('0x14'),_0x33c19b,_0x7580fe);_0x32348c(_0x7580fe);});});}exports[_0x5c16('0x1c')]=function(_0x4d58ef){var _0x56b201=this;return new Promise(function(_0x5f59f0,_0xf1e052){return db[_0x5c16('0x1d')][_0x5c16('0x1e')]({'raw':_0x4d58ef[_0x5c16('0x1f')]?_0x4d58ef['options'][_0x5c16('0x20')]===undefined?!![]:![]:!![],'where':_0x4d58ef['options']?_0x4d58ef[_0x5c16('0x1f')]['where']||null:null,'attributes':_0x4d58ef['options']?_0x4d58ef['options'][_0x5c16('0x21')]||null:null,'include':_0x4d58ef[_0x5c16('0x1f')]?_0x4d58ef[_0x5c16('0x1f')]['include']?_[_0x5c16('0x22')](_0x4d58ef[_0x5c16('0x1f')][_0x5c16('0x23')],function(_0x180617){return{'model':db[_0x180617[_0x5c16('0x24')]],'as':_0x180617['as'],'attributes':_0x180617['attributes'],'include':_0x180617[_0x5c16('0x23')]?_[_0x5c16('0x22')](_0x180617[_0x5c16('0x23')],function(_0x74b1b0){return{'model':db[_0x74b1b0[_0x5c16('0x24')]],'as':_0x74b1b0['as'],'attributes':_0x74b1b0[_0x5c16('0x21')],'include':_0x74b1b0[_0x5c16('0x23')]?_[_0x5c16('0x22')](_0x74b1b0['include'],function(_0x419202){return{'model':db[_0x419202['model']],'as':_0x419202['as'],'attributes':_0x419202[_0x5c16('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5c16('0x12')](function(_0x1acb78){logger[_0x5c16('0x13')](_0x5c16('0x1c'),_0x4d58ef);logger[_0x5c16('0x25')]('ShowSquareProject',_0x4d58ef,JSON[_0x5c16('0x17')](_0x1acb78));_0x5f59f0(_0x1acb78);})[_0x5c16('0x26')](function(_0x1679fc){logger[_0x5c16('0x18')](_0x5c16('0x1c'),_0x1679fc['message'],_0x4d58ef);_0xf1e052(_0x56b201[_0x5c16('0x18')](0x1f4,_0x1679fc['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 072645f..fab5eb5 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 _0xc4c8=['save','remove','emit','removeListener','squareProject:','./squareProject.events'];(function(_0x2bb288,_0x444d8e){var _0x59678e=function(_0x30892f){while(--_0x30892f){_0x2bb288['push'](_0x2bb288['shift']());}};_0x59678e(++_0x444d8e);}(_0xc4c8,0x11f));var _0x8c4c=function(_0xa67fa1,_0x2fc1c8){_0xa67fa1=_0xa67fa1-0x0;var _0x195d5a=_0xc4c8[_0xa67fa1];return _0x195d5a;};'use strict';var SquareProjectEvents=require(_0x8c4c('0x0'));var events=[_0x8c4c('0x1'),_0x8c4c('0x2'),'update'];function createListener(_0x5eed68,_0x2a7243){return function(_0x388407){_0x2a7243[_0x8c4c('0x3')](_0x5eed68,_0x388407);};}function removeListener(_0x1ad047,_0x3f17af){return function(){SquareProjectEvents[_0x8c4c('0x4')](_0x1ad047,_0x3f17af);};}exports['register']=function(_0x58b009){for(var _0x2e4e20=0x0,_0x4eebea=events['length'];_0x2e4e20<_0x4eebea;_0x2e4e20++){var _0x5d9c4e=events[_0x2e4e20];var _0x1141f5=createListener(_0x8c4c('0x5')+_0x5d9c4e,_0x58b009);SquareProjectEvents['on'](_0x5d9c4e,_0x1141f5);}}; \ No newline at end of file +var _0x6d02=['length','squareProject:','remove','update','removeListener','register'];(function(_0x214fcb,_0x4fa082){var _0x4b0cdc=function(_0x1cf6a7){while(--_0x1cf6a7){_0x214fcb['push'](_0x214fcb['shift']());}};_0x4b0cdc(++_0x4fa082);}(_0x6d02,0x1c4));var _0x26d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6d02[_0x501510];return _0x1e6ee5;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0x26d0('0x0'),_0x26d0('0x1')];function createListener(_0x60edc5,_0xbb6fe6){return function(_0x3bc160){_0xbb6fe6['emit'](_0x60edc5,_0x3bc160);};}function removeListener(_0x4d2985,_0x5b04e3){return function(){SquareProjectEvents[_0x26d0('0x2')](_0x4d2985,_0x5b04e3);};}exports[_0x26d0('0x3')]=function(_0x43af5b){for(var _0x1005b1=0x0,_0x4b657d=events[_0x26d0('0x4')];_0x1005b1<_0x4b657d;_0x1005b1++){var _0x5a5eb8=events[_0x1005b1];var _0x59ebbc=createListener(_0x26d0('0x5')+_0x5a5eb8,_0x43af5b);SquareProjectEvents['on'](_0x5a5eb8,_0x59ebbc);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e982f0f..91ac103 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 _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x29829f,_0x57c5eb){var _0x28ea1f=function(_0x6a727b){while(--_0x6a727b){_0x29829f['push'](_0x29829f['shift']());}};_0x28ea1f(++_0x57c5eb);}(_0x5fab,0x177));var _0xb5fa=function(_0x130209,_0x2cc129){_0x130209=_0x130209-0x0;var _0x155fb7=_0x5fab[_0x130209];return _0x155fb7;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x5e2c89,_0x5badd5){var _0x43af33=function(_0x6fa4f8){while(--_0x6fa4f8){_0x5e2c89['push'](_0x5e2c89['shift']());}};_0x43af33(++_0x5badd5);}(_0x814b,0x1a2));var _0xb814=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0x814b[_0x2136a6];return _0x55b948;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 1239cd8..de393d8 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 _0xb138=['getDataValue','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x40cb8e,_0x31dd01){var _0x205cc1=function(_0x5cecb7){while(--_0x5cecb7){_0x40cb8e['push'](_0x40cb8e['shift']());}};_0x205cc1(++_0x31dd01);}(_0xb138,0x1dd));var _0x8b13=function(_0x38c083,_0xb75c86){_0x38c083=_0x38c083-0x0;var _0x275d0d=_0xb138[_0x38c083];return _0x275d0d;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'uniqueid':{'type':Sequelize[_0x8b13('0x2')]},'callerid':{'type':Sequelize[_0x8b13('0x2')]},'calleridname':{'type':Sequelize[_0x8b13('0x2')]},'context':{'type':Sequelize[_0x8b13('0x2')]},'extension':{'type':Sequelize[_0x8b13('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8b13('0x2')]},'dnid':{'type':Sequelize[_0x8b13('0x2')]},'projectName':{'type':Sequelize[_0x8b13('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8b13('0x2')]},'savePath':{'type':Sequelize[_0x8b13('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x3fdf4d='';var _0x33d1a7=this[_0x8b13('0x3')]('savePath');if(_0x33d1a7){_0x3fdf4d=_0x33d1a7[_0x8b13('0x4')](_0x33d1a7[_0x8b13('0x5')]('.'));}return _0x3fdf4d;}}}; \ No newline at end of file +var _0x326f=['getDataValue','sequelize','STRING','VIRTUAL'];(function(_0x51fbcf,_0x440a3d){var _0x4f4e6d=function(_0x36db04){while(--_0x36db04){_0x51fbcf['push'](_0x51fbcf['shift']());}};_0x4f4e6d(++_0x440a3d);}(_0x326f,0xd1));var _0xf326=function(_0x4f24f2,_0x24a492){_0x4f24f2=_0x4f24f2-0x0;var _0x319dd1=_0x326f[_0x4f24f2];return _0x319dd1;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf326('0x1')]},'calleridname':{'type':Sequelize[_0xf326('0x1')]},'context':{'type':Sequelize[_0xf326('0x1')]},'extension':{'type':Sequelize[_0xf326('0x1')]},'priority':{'type':Sequelize[_0xf326('0x1')]},'accountcode':{'type':Sequelize[_0xf326('0x1')]},'dnid':{'type':Sequelize[_0xf326('0x1')]},'projectName':{'type':Sequelize[_0xf326('0x1')]},'saveName':{'type':Sequelize[_0xf326('0x1')]},'filename':{'type':Sequelize[_0xf326('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xf326('0x2')],'get':function(){var _0x3851eb='';var _0x165f95=this[_0xf326('0x3')]('savePath');if(_0x165f95){_0x3851eb=_0x165f95['substring'](_0x165f95['lastIndexOf']('.'));}return _0x3851eb;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a61c5d1..f7e7362 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 _0xb6eb=['filter','merge','VIRTUAL','SquareRecording','includeAll','include','findAll','rows','catch','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick'];(function(_0xdd0b05,_0x1cb0b7){var _0xcca74e=function(_0x35d4b6){while(--_0x35d4b6){_0xdd0b05['push'](_0xdd0b05['shift']());}};_0xcca74e(++_0x1cb0b7);}(_0xb6eb,0x194));var _0xbb6e=function(_0x25d0df,_0xa75ec6){_0x25d0df=_0x25d0df-0x0;var _0x261bc0=_0xb6eb[_0x25d0df];return _0x261bc0;};'use strict';var emlformat=require(_0xbb6e('0x0'));var rimraf=require(_0xbb6e('0x1'));var zipdir=require(_0xbb6e('0x2'));var jsonpatch=require(_0xbb6e('0x3'));var rp=require(_0xbb6e('0x4'));var moment=require('moment');var BPromise=require(_0xbb6e('0x5'));var Mustache=require(_0xbb6e('0x6'));var util=require(_0xbb6e('0x7'));var path=require(_0xbb6e('0x8'));var sox=require(_0xbb6e('0x9'));var csv=require('to-csv');var ejs=require(_0xbb6e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb6e('0xb'));var squel=require(_0xbb6e('0xc'));var crypto=require(_0xbb6e('0xd'));var jsforce=require(_0xbb6e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbb6e('0xf'));var Papa=require('papaparse');var Redis=require(_0xbb6e('0x10'));var authService=require(_0xbb6e('0x11'));var qs=require(_0xbb6e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xbb6e('0x13'));var config=require(_0xbb6e('0x14'));var licenseUtil=require(_0xbb6e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x107e3b,_0x507966){_0x507966=_0x507966||0xcc;return function(_0x4d11c4){if(_0x4d11c4){return _0x107e3b[_0xbb6e('0x16')](_0x507966);}return _0x107e3b[_0xbb6e('0x17')](_0x507966)[_0xbb6e('0x18')]();};}function respondWithResult(_0x23102c,_0x398512){_0x398512=_0x398512||0xc8;return function(_0x2b4c3e){if(_0x2b4c3e){return _0x23102c[_0xbb6e('0x17')](_0x398512)['json'](_0x2b4c3e);}};}function respondWithFilteredResult(_0x3d8ea9,_0x3f6083){return function(_0x2a0188){if(_0x2a0188){var _0x493b02=typeof _0x3f6083[_0xbb6e('0x19')]==='undefined'&&typeof _0x3f6083[_0xbb6e('0x1a')]===_0xbb6e('0x1b');var _0x6a64c4=_0x2a0188['count'];var _0x8cf626=_0x493b02?0x0:_0x3f6083[_0xbb6e('0x19')];var _0x7dafa6=_0x493b02?_0x2a0188[_0xbb6e('0x1c')]:_0x3f6083[_0xbb6e('0x19')]+_0x3f6083[_0xbb6e('0x1a')];var _0x354519;if(_0x7dafa6>=_0x6a64c4){_0x7dafa6=_0x6a64c4;_0x354519=0xc8;}else{_0x354519=0xce;}_0x3d8ea9['status'](_0x354519);return _0x3d8ea9['set'](_0xbb6e('0x1d'),_0x8cf626+'-'+_0x7dafa6+'/'+_0x6a64c4)[_0xbb6e('0x1e')](_0x2a0188);}return null;};}function patchUpdates(_0xf4212f){return function(_0x5ad5b0){try{jsonpatch[_0xbb6e('0x1f')](_0x5ad5b0,_0xf4212f,!![]);}catch(_0x3c011b){return BPromise[_0xbb6e('0x20')](_0x3c011b);}return _0x5ad5b0[_0xbb6e('0x21')]();};}function saveUpdates(_0x2b1053,_0x5298ab){return function(_0x47f3e1){if(_0x47f3e1){return _0x47f3e1[_0xbb6e('0x22')](_0x2b1053)[_0xbb6e('0x23')](function(_0x1a07e9){return _0x1a07e9;});}return null;};}function removeEntity(_0xd4a0f1,_0xcc35f9){return function(_0x20da8a){if(_0x20da8a){return _0x20da8a[_0xbb6e('0x24')]()[_0xbb6e('0x23')](function(){_0xd4a0f1[_0xbb6e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x245421,_0xa6b064){return function(_0x26add3){if(!_0x26add3){_0x245421[_0xbb6e('0x16')](0x194);}return _0x26add3;};}function handleError(_0x5b08fa,_0x54a735){_0x54a735=_0x54a735||0x1f4;return function(_0x203127){logger['error'](_0x203127[_0xbb6e('0x25')]);if(_0x203127['name']){delete _0x203127[_0xbb6e('0x26')];}_0x5b08fa[_0xbb6e('0x17')](_0x54a735)['send'](_0x203127);};}exports[_0xbb6e('0x27')]=function(_0x2802a,_0x38a280){var _0x3a536e={},_0x298645={},_0x58cf0c={'count':0x0,'rows':[]};var _0x11ffa5=_[_0xbb6e('0x28')](db['SquareRecording'][_0xbb6e('0x29')],function(_0x5aaf4d){return{'name':_0x5aaf4d['fieldName'],'type':_0x5aaf4d[_0xbb6e('0x2a')]['key']};});_0x298645[_0xbb6e('0x2b')]=_[_0xbb6e('0x28')](_0x11ffa5,_0xbb6e('0x26'));_0x298645[_0xbb6e('0x2c')]=_[_0xbb6e('0x2d')](_0x2802a['query']);_0x298645['filters']=_[_0xbb6e('0x2e')](_0x298645['model'],_0x298645[_0xbb6e('0x2c')]);_0x3a536e['attributes']=_[_0xbb6e('0x2e')](_0x298645['model'],qs['fields'](_0x2802a['query'][_0xbb6e('0x2f')]));_0x3a536e[_0xbb6e('0x30')]=_0x3a536e['attributes'][_0xbb6e('0x31')]?_0x3a536e['attributes']:_0x298645['model'];if(!_0x2802a['query'][_0xbb6e('0x32')](_0xbb6e('0x33'))){_0x3a536e['limit']=qs[_0xbb6e('0x1a')](_0x2802a[_0xbb6e('0x2c')][_0xbb6e('0x1a')]);_0x3a536e[_0xbb6e('0x19')]=qs[_0xbb6e('0x19')](_0x2802a[_0xbb6e('0x2c')][_0xbb6e('0x19')]);}_0x3a536e['order']=qs[_0xbb6e('0x34')](_0x2802a[_0xbb6e('0x2c')][_0xbb6e('0x34')]);_0x3a536e[_0xbb6e('0x35')]=qs[_0xbb6e('0x36')](_[_0xbb6e('0x37')](_0x2802a['query'],_0x298645[_0xbb6e('0x36')]),_0x11ffa5);if(_0x2802a[_0xbb6e('0x2c')][_0xbb6e('0x38')]){_0x3a536e['where']=_[_0xbb6e('0x39')](_0x3a536e[_0xbb6e('0x35')],{'$or':_[_0xbb6e('0x28')](_0x11ffa5,function(_0x4488b6){if(_0x4488b6['type']!==_0xbb6e('0x3a')){var _0x44aaca={};_0x44aaca[_0x4488b6[_0xbb6e('0x26')]]={'$like':'%'+_0x2802a['query'][_0xbb6e('0x38')]+'%'};return _0x44aaca;}})});}_0x3a536e=_['merge']({},_0x3a536e,_0x2802a['options']);var _0x7bc403={'where':_0x3a536e['where']};return db[_0xbb6e('0x3b')][_0xbb6e('0x1c')](_0x7bc403)[_0xbb6e('0x23')](function(_0x13fa33){_0x58cf0c[_0xbb6e('0x1c')]=_0x13fa33;if(_0x2802a['query'][_0xbb6e('0x3c')]){_0x3a536e[_0xbb6e('0x3d')]=[{'all':!![]}];}return db[_0xbb6e('0x3b')][_0xbb6e('0x3e')](_0x3a536e);})[_0xbb6e('0x23')](function(_0xbbabb1){_0x58cf0c[_0xbb6e('0x3f')]=_0xbbabb1;return _0x58cf0c;})[_0xbb6e('0x23')](respondWithFilteredResult(_0x38a280,_0x3a536e))[_0xbb6e('0x40')](handleError(_0x38a280,null));};exports['show']=function(_0x53cec4,_0x4f52e0){var _0x1f86cb={'raw':!![],'where':{'id':_0x53cec4['params']['id']}},_0x2666cf={};_0x2666cf[_0xbb6e('0x2b')]=_[_0xbb6e('0x2d')](db[_0xbb6e('0x3b')][_0xbb6e('0x29')]);_0x2666cf[_0xbb6e('0x2c')]=_['keys'](_0x53cec4['query']);_0x2666cf[_0xbb6e('0x36')]=_[_0xbb6e('0x2e')](_0x2666cf[_0xbb6e('0x2b')],_0x2666cf[_0xbb6e('0x2c')]);_0x1f86cb[_0xbb6e('0x30')]=_[_0xbb6e('0x2e')](_0x2666cf['model'],qs['fields'](_0x53cec4['query'][_0xbb6e('0x2f')]));_0x1f86cb[_0xbb6e('0x30')]=_0x1f86cb['attributes'][_0xbb6e('0x31')]?_0x1f86cb['attributes']:_0x2666cf[_0xbb6e('0x2b')];if(_0x53cec4[_0xbb6e('0x2c')][_0xbb6e('0x3c')]){_0x1f86cb[_0xbb6e('0x3d')]=[{'all':!![]}];}_0x1f86cb=_[_0xbb6e('0x39')]({},_0x1f86cb,_0x53cec4['options']);return db[_0xbb6e('0x3b')][_0xbb6e('0x41')](_0x1f86cb)[_0xbb6e('0x23')](handleEntityNotFound(_0x4f52e0,null))[_0xbb6e('0x23')](respondWithResult(_0x4f52e0,null))[_0xbb6e('0x40')](handleError(_0x4f52e0,null));};exports[_0xbb6e('0x42')]=function(_0x359969,_0x2fbe45){return db[_0xbb6e('0x3b')][_0xbb6e('0x42')](_0x359969[_0xbb6e('0x43')],{})[_0xbb6e('0x23')](respondWithResult(_0x2fbe45,0xc9))[_0xbb6e('0x40')](handleError(_0x2fbe45,null));};exports[_0xbb6e('0x22')]=function(_0xeee4ab,_0x4d1191){if(_0xeee4ab[_0xbb6e('0x43')]['id']){delete _0xeee4ab[_0xbb6e('0x43')]['id'];}return db['SquareRecording'][_0xbb6e('0x41')]({'where':{'id':_0xeee4ab[_0xbb6e('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d1191,null))[_0xbb6e('0x23')](saveUpdates(_0xeee4ab[_0xbb6e('0x43')],null))[_0xbb6e('0x23')](respondWithResult(_0x4d1191,null))['catch'](handleError(_0x4d1191,null));};exports[_0xbb6e('0x45')]=function(_0x56f953,_0x53765c,_0x32a0a2){var _0x17357d=require(_0xbb6e('0x46'));var _0x1bf2a=![];var _0x30263c={};if(_0x56f953['query'][_0xbb6e('0x2a')]&&_0x56f953[_0xbb6e('0x2c')][_0xbb6e('0x2a')]===_0xbb6e('0x47')){_0x30263c['uniqueid']=_0x56f953[_0xbb6e('0x44')]['id'];}else{_0x30263c['id']=_0x56f953[_0xbb6e('0x44')]['id'];}return db[_0xbb6e('0x3b')][_0xbb6e('0x41')]({'where':_0x30263c,'attributes':['id',_0xbb6e('0x48'),_0xbb6e('0x49')],'raw':!![]})[_0xbb6e('0x23')](handleEntityNotFound(_0x53765c,null))[_0xbb6e('0x23')](function(_0x5d61b0){if(_0x5d61b0){var _0x2f6ce1=_0x5d61b0[_0xbb6e('0x48')];var _0x4a151e=util[_0xbb6e('0x4a')]('%s.cypher',_0x2f6ce1);if(fs[_0xbb6e('0x4b')](_0x4a151e)){_0x1bf2a=!![];return _0x17357d[_0xbb6e('0x4c')](_0x4a151e,_0x2f6ce1,config['secrets']['recording'])['then'](function(){return _0x5d61b0;});}return _0x5d61b0;}})[_0xbb6e('0x23')](function(_0x58d7c1){if(_0x58d7c1){var _0x18a576=_0x58d7c1[_0xbb6e('0x48')];if(!fs[_0xbb6e('0x4b')](_0x18a576)){throw new db[(_0xbb6e('0x4d'))][(_0xbb6e('0x4e'))](_0xbb6e('0x4f'));}if(_0x58d7c1[_0xbb6e('0x49')]){return _0x53765c[_0xbb6e('0x45')](_0x18a576,_0x58d7c1[_0xbb6e('0x49')]+path[_0xbb6e('0x50')](_0x18a576),function(){if(_0x1bf2a){fs[_0xbb6e('0x51')](_0x18a576);}});}else{return _0x53765c[_0xbb6e('0x45')](_0x18a576,function(_0x17f393){if(_0x1bf2a){fs[_0xbb6e('0x51')](_0x18a576);}});}}})[_0xbb6e('0x40')](function(_0x5c4fb6){if(_0x5c4fb6[_0xbb6e('0x52')]===_0xbb6e('0x4f')){_0x53765c[_0xbb6e('0x17')](0x194)['send'](_0xbb6e('0x53'));}else{return handleError(_0x53765c,null);}});};exports[_0xbb6e('0x24')]=function(_0x11a600,_0xb94968){return db[_0xbb6e('0x3b')][_0xbb6e('0x41')]({'where':{'id':_0x11a600['params']['id']}})[_0xbb6e('0x23')](function(_0x4cdb54){if(_[_0xbb6e('0x54')](_0x4cdb54)){throw new ReferenceError(_0xbb6e('0x55'));}return _0x4cdb54;})[_0xbb6e('0x23')](function(_0x5dbe26){var _0x3e715f=_0x5dbe26[_0xbb6e('0x48')];logger['info'](_0xbb6e('0x56'),_0x3e715f);if(!_[_0xbb6e('0x54')](_0x5dbe26[_0xbb6e('0x48')])&&fs['existsSync'](_0x3e715f)){logger[_0xbb6e('0x57')]('File:\x20\x22'+_0x3e715f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3e715f);}_0x3e715f=_0x3e715f+_0xbb6e('0x58');if(!_[_0xbb6e('0x54')](_0x5dbe26[_0xbb6e('0x48')])&&fs[_0xbb6e('0x4b')](_0x3e715f)){logger['info'](_0xbb6e('0x59')+_0x3e715f+_0xbb6e('0x5a'));fs[_0xbb6e('0x5b')](_0x3e715f);}return _0x5dbe26;})['then'](function(_0x2eb5ee){if(!_0x2eb5ee)throw new InternalError();return _0x2eb5ee[_0xbb6e('0x24')]();})[_0xbb6e('0x23')](function(){_0xb94968[_0xbb6e('0x17')](0xcc)[_0xbb6e('0x18')]();})[_0xbb6e('0x40')](handleError(_0xb94968,null));}; \ No newline at end of file +var _0xe2b7=['ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','send','index','SquareRecording','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','name','options','includeAll','include','catch','show','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','secrets','recording','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe2b7,0x1d6));var _0x7e2b=function(_0x38d762,_0xb91c05){_0x38d762=_0x38d762-0x0;var _0x5d2783=_0xe2b7[_0x38d762];return _0x5d2783;};'use strict';var emlformat=require(_0x7e2b('0x0'));var rimraf=require(_0x7e2b('0x1'));var zipdir=require(_0x7e2b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e2b('0x3'));var moment=require(_0x7e2b('0x4'));var BPromise=require(_0x7e2b('0x5'));var Mustache=require(_0x7e2b('0x6'));var util=require(_0x7e2b('0x7'));var path=require(_0x7e2b('0x8'));var sox=require(_0x7e2b('0x9'));var csv=require('to-csv');var ejs=require(_0x7e2b('0xa'));var fs=require('fs');var fs_extra=require(_0x7e2b('0xb'));var _=require(_0x7e2b('0xc'));var squel=require(_0x7e2b('0xd'));var crypto=require(_0x7e2b('0xe'));var jsforce=require(_0x7e2b('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7e2b('0x10'));var Papa=require(_0x7e2b('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7e2b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e2b('0x13'));var logger=require(_0x7e2b('0x14'))(_0x7e2b('0x15'));var utils=require(_0x7e2b('0x16'));var config=require(_0x7e2b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x446069,_0x4afef6){_0x4afef6=_0x4afef6||0xcc;return function(_0xfbd974){if(_0xfbd974){return _0x446069[_0x7e2b('0x18')](_0x4afef6);}return _0x446069[_0x7e2b('0x19')](_0x4afef6)[_0x7e2b('0x1a')]();};}function respondWithResult(_0x311fce,_0x2df4fe){_0x2df4fe=_0x2df4fe||0xc8;return function(_0x37f619){if(_0x37f619){return _0x311fce['status'](_0x2df4fe)['json'](_0x37f619);}};}function respondWithFilteredResult(_0x422e80,_0x1d3438){return function(_0x2bd8ad){if(_0x2bd8ad){var _0xa0826f=typeof _0x1d3438[_0x7e2b('0x1b')]==='undefined'&&typeof _0x1d3438[_0x7e2b('0x1c')]==='undefined';var _0x3f0251=_0x2bd8ad[_0x7e2b('0x1d')];var _0x4f02a6=_0xa0826f?0x0:_0x1d3438[_0x7e2b('0x1b')];var _0xfb96b7=_0xa0826f?_0x2bd8ad[_0x7e2b('0x1d')]:_0x1d3438[_0x7e2b('0x1b')]+_0x1d3438['limit'];var _0x565360;if(_0xfb96b7>=_0x3f0251){_0xfb96b7=_0x3f0251;_0x565360=0xc8;}else{_0x565360=0xce;}_0x422e80['status'](_0x565360);return _0x422e80[_0x7e2b('0x1e')](_0x7e2b('0x1f'),_0x4f02a6+'-'+_0xfb96b7+'/'+_0x3f0251)[_0x7e2b('0x20')](_0x2bd8ad);}return null;};}function patchUpdates(_0x5463f5){return function(_0x316aac){try{jsonpatch[_0x7e2b('0x21')](_0x316aac,_0x5463f5,!![]);}catch(_0x4e5734){return BPromise[_0x7e2b('0x22')](_0x4e5734);}return _0x316aac['save']();};}function saveUpdates(_0x164555,_0x189b74){return function(_0x42fb9e){if(_0x42fb9e){return _0x42fb9e[_0x7e2b('0x23')](_0x164555)[_0x7e2b('0x24')](function(_0x17bbfe){return _0x17bbfe;});}return null;};}function removeEntity(_0x2159dc,_0x691804){return function(_0x5559e3){if(_0x5559e3){return _0x5559e3[_0x7e2b('0x25')]()[_0x7e2b('0x24')](function(){_0x2159dc[_0x7e2b('0x19')](0xcc)[_0x7e2b('0x1a')]();});}};}function handleEntityNotFound(_0x1c4733,_0x39c91e){return function(_0x137c00){if(!_0x137c00){_0x1c4733[_0x7e2b('0x18')](0x194);}return _0x137c00;};}function handleError(_0xdb5d08,_0x49277c){_0x49277c=_0x49277c||0x1f4;return function(_0xe64a16){logger['error'](_0xe64a16[_0x7e2b('0x26')]);if(_0xe64a16['name']){delete _0xe64a16['name'];}_0xdb5d08[_0x7e2b('0x19')](_0x49277c)[_0x7e2b('0x27')](_0xe64a16);};}exports[_0x7e2b('0x28')]=function(_0x3c8aa5,_0x49fae3){var _0x41c758={},_0x50cdfc={},_0x1da92f={'count':0x0,'rows':[]};var _0x47b61c=_['map'](db[_0x7e2b('0x29')][_0x7e2b('0x2a')],function(_0xc2cf89){return{'name':_0xc2cf89[_0x7e2b('0x2b')],'type':_0xc2cf89[_0x7e2b('0x2c')][_0x7e2b('0x2d')]};});_0x50cdfc['model']=_['map'](_0x47b61c,'name');_0x50cdfc['query']=_[_0x7e2b('0x2e')](_0x3c8aa5[_0x7e2b('0x2f')]);_0x50cdfc[_0x7e2b('0x30')]=_[_0x7e2b('0x31')](_0x50cdfc['model'],_0x50cdfc['query']);_0x41c758[_0x7e2b('0x32')]=_[_0x7e2b('0x31')](_0x50cdfc[_0x7e2b('0x33')],qs[_0x7e2b('0x34')](_0x3c8aa5[_0x7e2b('0x2f')][_0x7e2b('0x34')]));_0x41c758[_0x7e2b('0x32')]=_0x41c758['attributes'][_0x7e2b('0x35')]?_0x41c758[_0x7e2b('0x32')]:_0x50cdfc[_0x7e2b('0x33')];if(!_0x3c8aa5[_0x7e2b('0x2f')][_0x7e2b('0x36')](_0x7e2b('0x37'))){_0x41c758[_0x7e2b('0x1c')]=qs[_0x7e2b('0x1c')](_0x3c8aa5[_0x7e2b('0x2f')][_0x7e2b('0x1c')]);_0x41c758[_0x7e2b('0x1b')]=qs[_0x7e2b('0x1b')](_0x3c8aa5[_0x7e2b('0x2f')]['offset']);}_0x41c758[_0x7e2b('0x38')]=qs[_0x7e2b('0x39')](_0x3c8aa5['query'][_0x7e2b('0x39')]);_0x41c758[_0x7e2b('0x3a')]=qs[_0x7e2b('0x30')](_[_0x7e2b('0x3b')](_0x3c8aa5[_0x7e2b('0x2f')],_0x50cdfc['filters']),_0x47b61c);if(_0x3c8aa5['query'][_0x7e2b('0x3c')]){_0x41c758[_0x7e2b('0x3a')]=_[_0x7e2b('0x3d')](_0x41c758['where'],{'$or':_[_0x7e2b('0x3e')](_0x47b61c,function(_0x3e047a){if(_0x3e047a[_0x7e2b('0x2c')]!==_0x7e2b('0x3f')){var _0xf46272={};_0xf46272[_0x3e047a[_0x7e2b('0x40')]]={'$like':'%'+_0x3c8aa5[_0x7e2b('0x2f')][_0x7e2b('0x3c')]+'%'};return _0xf46272;}})});}_0x41c758=_[_0x7e2b('0x3d')]({},_0x41c758,_0x3c8aa5[_0x7e2b('0x41')]);var _0x44138e={'where':_0x41c758['where']};return db[_0x7e2b('0x29')]['count'](_0x44138e)['then'](function(_0x2d996c){_0x1da92f['count']=_0x2d996c;if(_0x3c8aa5[_0x7e2b('0x2f')][_0x7e2b('0x42')]){_0x41c758[_0x7e2b('0x43')]=[{'all':!![]}];}return db[_0x7e2b('0x29')]['findAll'](_0x41c758);})[_0x7e2b('0x24')](function(_0x33d1be){_0x1da92f['rows']=_0x33d1be;return _0x1da92f;})[_0x7e2b('0x24')](respondWithFilteredResult(_0x49fae3,_0x41c758))[_0x7e2b('0x44')](handleError(_0x49fae3,null));};exports[_0x7e2b('0x45')]=function(_0x536eed,_0x156af7){var _0x3733f0={'raw':!![],'where':{'id':_0x536eed[_0x7e2b('0x46')]['id']}},_0x2adddc={};_0x2adddc[_0x7e2b('0x33')]=_[_0x7e2b('0x2e')](db[_0x7e2b('0x29')]['rawAttributes']);_0x2adddc[_0x7e2b('0x2f')]=_[_0x7e2b('0x2e')](_0x536eed[_0x7e2b('0x2f')]);_0x2adddc[_0x7e2b('0x30')]=_[_0x7e2b('0x31')](_0x2adddc[_0x7e2b('0x33')],_0x2adddc[_0x7e2b('0x2f')]);_0x3733f0[_0x7e2b('0x32')]=_[_0x7e2b('0x31')](_0x2adddc[_0x7e2b('0x33')],qs[_0x7e2b('0x34')](_0x536eed['query'][_0x7e2b('0x34')]));_0x3733f0['attributes']=_0x3733f0[_0x7e2b('0x32')][_0x7e2b('0x35')]?_0x3733f0[_0x7e2b('0x32')]:_0x2adddc[_0x7e2b('0x33')];if(_0x536eed[_0x7e2b('0x2f')]['includeAll']){_0x3733f0[_0x7e2b('0x43')]=[{'all':!![]}];}_0x3733f0=_[_0x7e2b('0x3d')]({},_0x3733f0,_0x536eed[_0x7e2b('0x41')]);return db[_0x7e2b('0x29')][_0x7e2b('0x47')](_0x3733f0)[_0x7e2b('0x24')](handleEntityNotFound(_0x156af7,null))[_0x7e2b('0x24')](respondWithResult(_0x156af7,null))[_0x7e2b('0x44')](handleError(_0x156af7,null));};exports[_0x7e2b('0x48')]=function(_0x1561a8,_0x196386){return db[_0x7e2b('0x29')][_0x7e2b('0x48')](_0x1561a8[_0x7e2b('0x49')],{})['then'](respondWithResult(_0x196386,0xc9))[_0x7e2b('0x44')](handleError(_0x196386,null));};exports[_0x7e2b('0x23')]=function(_0x351e34,_0x10bf2f){if(_0x351e34[_0x7e2b('0x49')]['id']){delete _0x351e34[_0x7e2b('0x49')]['id'];}return db['SquareRecording'][_0x7e2b('0x47')]({'where':{'id':_0x351e34[_0x7e2b('0x46')]['id']}})[_0x7e2b('0x24')](handleEntityNotFound(_0x10bf2f,null))[_0x7e2b('0x24')](saveUpdates(_0x351e34['body'],null))[_0x7e2b('0x24')](respondWithResult(_0x10bf2f,null))['catch'](handleError(_0x10bf2f,null));};exports[_0x7e2b('0x4a')]=function(_0x39bd5a,_0x3e6bff,_0x53f30c){var _0x2f7cdc=require(_0x7e2b('0x4b'));var _0x5d4511=![];var _0x4a49e1={};if(_0x39bd5a[_0x7e2b('0x2f')][_0x7e2b('0x2c')]&&_0x39bd5a[_0x7e2b('0x2f')]['type']===_0x7e2b('0x4c')){_0x4a49e1[_0x7e2b('0x4c')]=_0x39bd5a[_0x7e2b('0x46')]['id'];}else{_0x4a49e1['id']=_0x39bd5a[_0x7e2b('0x46')]['id'];}return db['SquareRecording'][_0x7e2b('0x47')]({'where':_0x4a49e1,'attributes':['id',_0x7e2b('0x4d'),'filename'],'raw':!![]})[_0x7e2b('0x24')](handleEntityNotFound(_0x3e6bff,null))[_0x7e2b('0x24')](function(_0x138633){if(_0x138633){var _0x2b3e5a=_0x138633['savePath'];var _0x38427d=util[_0x7e2b('0x4e')](_0x7e2b('0x4f'),_0x2b3e5a);if(fs[_0x7e2b('0x50')](_0x38427d)){_0x5d4511=!![];return _0x2f7cdc['decryptFile'](_0x38427d,_0x2b3e5a,config[_0x7e2b('0x51')][_0x7e2b('0x52')])[_0x7e2b('0x24')](function(){return _0x138633;});}return _0x138633;}})[_0x7e2b('0x24')](function(_0x1dcb01){if(_0x1dcb01){var _0x1538d2=_0x1dcb01['savePath'];if(!fs[_0x7e2b('0x50')](_0x1538d2)){throw new db['Sequelize']['ValidationError'](_0x7e2b('0x53'));}if(_0x1dcb01[_0x7e2b('0x54')]){return _0x3e6bff[_0x7e2b('0x4a')](_0x1538d2,_0x1dcb01[_0x7e2b('0x54')]+path[_0x7e2b('0x55')](_0x1538d2),function(){if(_0x5d4511){fs[_0x7e2b('0x56')](_0x1538d2);}});}else{return _0x3e6bff[_0x7e2b('0x4a')](_0x1538d2,function(_0x179c34){if(_0x5d4511){fs['unlink'](_0x1538d2);}});}}})['catch'](function(_0x328107){if(_0x328107[_0x7e2b('0x57')]===_0x7e2b('0x53')){_0x3e6bff[_0x7e2b('0x19')](0x194)['send'](_0x7e2b('0x58'));}else{return handleError(_0x3e6bff,null);}});};exports['destroy']=function(_0x485d00,_0x1be13a){return db[_0x7e2b('0x29')][_0x7e2b('0x47')]({'where':{'id':_0x485d00[_0x7e2b('0x46')]['id']}})[_0x7e2b('0x24')](function(_0x671c6d){if(_[_0x7e2b('0x59')](_0x671c6d)){throw new ReferenceError(_0x7e2b('0x5a'));}return _0x671c6d;})[_0x7e2b('0x24')](function(_0x46d9c2){var _0x2b7241=_0x46d9c2['savePath'];logger[_0x7e2b('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0x2b7241);if(!_['isNil'](_0x46d9c2[_0x7e2b('0x4d')])&&fs[_0x7e2b('0x50')](_0x2b7241)){logger[_0x7e2b('0x5b')](_0x7e2b('0x5c')+_0x2b7241+_0x7e2b('0x5d'));fs[_0x7e2b('0x5e')](_0x2b7241);}_0x2b7241=_0x2b7241+_0x7e2b('0x5f');if(!_['isNil'](_0x46d9c2[_0x7e2b('0x4d')])&&fs['existsSync'](_0x2b7241)){logger[_0x7e2b('0x5b')](_0x7e2b('0x5c')+_0x2b7241+_0x7e2b('0x5d'));fs['unlinkSync'](_0x2b7241);}return _0x46d9c2;})[_0x7e2b('0x24')](function(_0x4ec491){if(!_0x4ec491)throw new InternalError();return _0x4ec491[_0x7e2b('0x25')]();})['then'](function(){_0x1be13a[_0x7e2b('0x19')](0xcc)[_0x7e2b('0x1a')]();})[_0x7e2b('0x44')](handleError(_0x1be13a,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1ef5362..4a03d17 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 _0xfb67=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger'];(function(_0x52b42b,_0x291ec9){var _0x2ba16b=function(_0x15aa80){while(--_0x15aa80){_0x52b42b['push'](_0x52b42b['shift']());}};_0x2ba16b(++_0x291ec9);}(_0xfb67,0xdd));var _0x7fb6=function(_0x44e9b2,_0x4b2c57){_0x44e9b2=_0x44e9b2-0x0;var _0x2340a3=_0xfb67[_0x44e9b2];return _0x2340a3;};'use strict';var _=require(_0x7fb6('0x0'));var util=require(_0x7fb6('0x1'));var logger=require(_0x7fb6('0x2'))(_0x7fb6('0x3'));var moment=require(_0x7fb6('0x4'));var BPromise=require(_0x7fb6('0x5'));var rp=require(_0x7fb6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7fb6('0x7'));var config=require(_0x7fb6('0x8'));var attributes=require(_0x7fb6('0x9'));module[_0x7fb6('0xa')]=function(_0x3e7393,_0x59b2e2){return _0x3e7393[_0x7fb6('0xb')](_0x7fb6('0xc'),attributes,{'tableName':_0x7fb6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x187d=['define','SquareRecording','square_recordings','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes'];(function(_0xe5a253,_0x5ca213){var _0x5e6e1f=function(_0x37c38c){while(--_0x37c38c){_0xe5a253['push'](_0xe5a253['shift']());}};_0x5e6e1f(++_0x5ca213);}(_0x187d,0x93));var _0xd187=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x187d[_0x28947d];return _0x12d2ee;};'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'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'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 c543a0e..88263b7 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 _0x2306=['client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1ee57f,_0x56286e){var _0x4a039a=function(_0x356d6d){while(--_0x356d6d){_0x1ee57f['push'](_0x1ee57f['shift']());}};_0x4a039a(++_0x56286e);}(_0x2306,0x6d));var _0x6230=function(_0x29df3c,_0x1d3cff){_0x29df3c=_0x29df3c-0x0;var _0x39f354=_0x2306[_0x29df3c];return _0x39f354;};'use strict';var _=require(_0x6230('0x0'));var util=require(_0x6230('0x1'));var moment=require(_0x6230('0x2'));var BPromise=require(_0x6230('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6230('0x4'));var db=require(_0x6230('0x5'))['db'];var utils=require(_0x6230('0x6'));var logger=require(_0x6230('0x7'))(_0x6230('0x8'));var config=require(_0x6230('0x9'));var jayson=require(_0x6230('0xa'));var client=jayson[_0x6230('0xb')][_0x6230('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5986fe,_0x43b90a,_0x502b75){return new BPromise(function(_0x4d19ef,_0x154834){return client[_0x6230('0xd')](_0x5986fe,_0x502b75)[_0x6230('0xe')](function(_0x2cc535){logger[_0x6230('0xf')](_0x6230('0x10'),_0x43b90a,_0x6230('0x11'));logger[_0x6230('0x12')](_0x6230('0x13'),_0x43b90a,_0x6230('0x11'),JSON[_0x6230('0x14')](_0x2cc535));if(_0x2cc535[_0x6230('0x15')]){if(_0x2cc535[_0x6230('0x15')][_0x6230('0x16')]===0x1f4){logger[_0x6230('0x15')](_0x6230('0x10'),_0x43b90a,_0x2cc535['error'][_0x6230('0x17')]);return _0x154834(_0x2cc535[_0x6230('0x15')][_0x6230('0x17')]);}logger[_0x6230('0x15')]('SquareRecording,\x20%s,\x20%s',_0x43b90a,_0x2cc535[_0x6230('0x15')][_0x6230('0x17')]);return _0x4d19ef(_0x2cc535[_0x6230('0x15')][_0x6230('0x17')]);}else{logger[_0x6230('0xf')](_0x6230('0x10'),_0x43b90a,_0x6230('0x11'));_0x4d19ef(_0x2cc535['result'][_0x6230('0x17')]);}})[_0x6230('0x18')](function(_0x5d1b27){logger[_0x6230('0x15')](_0x6230('0x10'),_0x43b90a,_0x5d1b27);_0x154834(_0x5d1b27);});});}exports[_0x6230('0x19')]=function(_0x3f0808){var _0x564f99=this;return new Promise(function(_0x4a4ba2,_0xc84727){return db[_0x6230('0x1a')]['create'](_0x3f0808[_0x6230('0x1b')],{'raw':_0x3f0808[_0x6230('0x1c')]?_0x3f0808[_0x6230('0x1c')][_0x6230('0x1d')]===undefined?!![]:![]:!![]})[_0x6230('0xe')](function(_0x1fc954){logger['info']('CreateSquareRecording',_0x3f0808);logger[_0x6230('0x12')](_0x6230('0x19'),_0x3f0808,JSON[_0x6230('0x14')](_0x1fc954));_0x4a4ba2(_0x1fc954);})[_0x6230('0x18')](function(_0x3e99a8){logger[_0x6230('0x15')](_0x6230('0x19'),_0x3e99a8[_0x6230('0x17')],_0x3f0808);_0xc84727(_0x564f99['error'](0x1f4,_0x3e99a8[_0x6230('0x17')]));});});}; \ No newline at end of file +var _0x977c=['jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','SquareRecording,\x20%s,\x20%s','message','result','CreateSquareRecording','create','body','options','raw','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x152bd2,_0x5254cd){var _0x4c0e7e=function(_0x3ba24f){while(--_0x3ba24f){_0x152bd2['push'](_0x152bd2['shift']());}};_0x4c0e7e(++_0x5254cd);}(_0x977c,0x180));var _0xc977=function(_0x2655ea,_0x5eb63){_0x2655ea=_0x2655ea-0x0;var _0x46c821=_0x977c[_0x2655ea];return _0x46c821;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc977('0x0'));var BPromise=require('bluebird');var rs=require(_0xc977('0x1'));var fs=require('fs');var Redis=require(_0xc977('0x2'));var db=require(_0xc977('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc977('0x4'))('rpc');var config=require(_0xc977('0x5'));var jayson=require(_0xc977('0x6'));var client=jayson[_0xc977('0x7')][_0xc977('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c616a,_0x83687c,_0x2fefd9){return new BPromise(function(_0x385df6,_0x3b7d8e){return client[_0xc977('0x9')](_0x1c616a,_0x2fefd9)[_0xc977('0xa')](function(_0x5bc386){logger[_0xc977('0xb')]('SquareRecording,\x20%s,\x20%s',_0x83687c,_0xc977('0xc'));logger[_0xc977('0xd')](_0xc977('0xe'),_0x83687c,_0xc977('0xc'),JSON[_0xc977('0xf')](_0x5bc386));if(_0x5bc386[_0xc977('0x10')]){if(_0x5bc386[_0xc977('0x10')]['code']===0x1f4){logger['error'](_0xc977('0x11'),_0x83687c,_0x5bc386[_0xc977('0x10')][_0xc977('0x12')]);return _0x3b7d8e(_0x5bc386[_0xc977('0x10')][_0xc977('0x12')]);}logger[_0xc977('0x10')](_0xc977('0x11'),_0x83687c,_0x5bc386[_0xc977('0x10')][_0xc977('0x12')]);return _0x385df6(_0x5bc386[_0xc977('0x10')]['message']);}else{logger[_0xc977('0xb')]('SquareRecording,\x20%s,\x20%s',_0x83687c,_0xc977('0xc'));_0x385df6(_0x5bc386[_0xc977('0x13')][_0xc977('0x12')]);}})['catch'](function(_0x5b9499){logger['error'](_0xc977('0x11'),_0x83687c,_0x5b9499);_0x3b7d8e(_0x5b9499);});});}exports[_0xc977('0x14')]=function(_0x1b7430){var _0x2e1c32=this;return new Promise(function(_0xf6b863,_0x5bd9a6){return db['SquareRecording'][_0xc977('0x15')](_0x1b7430[_0xc977('0x16')],{'raw':_0x1b7430[_0xc977('0x17')]?_0x1b7430['options'][_0xc977('0x18')]===undefined?!![]:![]:!![]})[_0xc977('0xa')](function(_0x5d4e7e){logger[_0xc977('0xb')](_0xc977('0x14'),_0x1b7430);logger[_0xc977('0xd')]('CreateSquareRecording',_0x1b7430,JSON[_0xc977('0xf')](_0x5d4e7e));_0xf6b863(_0x5d4e7e);})[_0xc977('0x19')](function(_0x3a02cd){logger[_0xc977('0x10')]('CreateSquareRecording',_0x3a02cd['message'],_0x1b7430);_0x5bd9a6(_0x2e1c32[_0xc977('0x10')](0x1f4,_0x3a02cd['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 162899b..9db1ef1 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x14f39b,_0x8a115c){var _0x353487=function(_0x59e778){while(--_0x59e778){_0x14f39b['push'](_0x14f39b['shift']());}};_0x353487(++_0x8a115c);}(_0xe706,0xa3));var _0x6e70=function(_0x337dd9,_0x54e3f3){_0x337dd9=_0x337dd9-0x0;var _0x20f4fc=_0xe706[_0x337dd9];return _0x20f4fc;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _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(_0x29857f,_0x207f83){var _0x388890=function(_0x226d14){while(--_0x226d14){_0x29857f['push'](_0x29857f['shift']());}};_0x388890(++_0x207f83);}(_0xe706,0xa3));var _0x6e70=function(_0x593f0e,_0x3555e7){_0x593f0e=_0x593f0e-0x0;var _0x116f30=_0xe706[_0x593f0e];return _0x116f30;};'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 ed63245..19a9454 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 _0xeeb6=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0xfd17a8,_0x164318){var _0x13dcc8=function(_0x20efc9){while(--_0x20efc9){_0xfd17a8['push'](_0xfd17a8['shift']());}};_0x13dcc8(++_0x164318);}(_0xeeb6,0x1eb));var _0x6eeb=function(_0x5bb941,_0x5d056d){_0x5bb941=_0x5bb941-0x0;var _0x2556eb=_0xeeb6[_0x5bb941];return _0x2556eb;};'use strict';var Sequelize=require(_0x6eeb('0x0'));module[_0x6eeb('0x1')]={'network':{'type':Sequelize[_0x6eeb('0x2')]},'network_script':{'type':Sequelize[_0x6eeb('0x2')]},'request':{'type':Sequelize[_0x6eeb('0x2')]},'channel':{'type':Sequelize[_0x6eeb('0x2')]},'language':{'type':Sequelize[_0x6eeb('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6eeb('0x2')]},'version':{'type':Sequelize[_0x6eeb('0x2')]},'callerid':{'type':Sequelize[_0x6eeb('0x2')]},'calleridname':{'type':Sequelize[_0x6eeb('0x2')]},'callingpres':{'type':Sequelize[_0x6eeb('0x2')]},'callingani2':{'type':Sequelize[_0x6eeb('0x2')]},'callington':{'type':Sequelize[_0x6eeb('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6eeb('0x2')]},'extension':{'type':Sequelize[_0x6eeb('0x2')]},'priority':{'type':Sequelize[_0x6eeb('0x2')]},'enhanced':{'type':Sequelize[_0x6eeb('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x6eeb('0x2')]},'project_name':{'type':Sequelize[_0x6eeb('0x2')]},'joinAt':{'type':Sequelize[_0x6eeb('0x3')]},'leaveAt':{'type':Sequelize[_0x6eeb('0x3')]},'bot':{'type':Sequelize[_0x6eeb('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xdd6e=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x105ccc,_0x3842c6){var _0x2e65f1=function(_0x5e74fb){while(--_0x5e74fb){_0x105ccc['push'](_0x105ccc['shift']());}};_0x2e65f1(++_0x3842c6);}(_0xdd6e,0x118));var _0xedd6=function(_0x5e4092,_0x5d112c){_0x5e4092=_0x5e4092-0x0;var _0x517b4e=_0xdd6e[_0x5e4092];return _0x517b4e;};'use strict';var Sequelize=require(_0xedd6('0x0'));module[_0xedd6('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xedd6('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xedd6('0x2')]},'language':{'type':Sequelize[_0xedd6('0x2')]},'type':{'type':Sequelize[_0xedd6('0x2')]},'uniqueid':{'type':Sequelize[_0xedd6('0x2')]},'version':{'type':Sequelize[_0xedd6('0x2')]},'callerid':{'type':Sequelize[_0xedd6('0x2')]},'calleridname':{'type':Sequelize[_0xedd6('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xedd6('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xedd6('0x2')]},'dnid':{'type':Sequelize[_0xedd6('0x2')]},'rdnis':{'type':Sequelize[_0xedd6('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xedd6('0x2')]},'priority':{'type':Sequelize[_0xedd6('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xedd6('0x2')]},'threadid':{'type':Sequelize[_0xedd6('0x2')]},'project_name':{'type':Sequelize[_0xedd6('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xedd6('0x3')]},'bot':{'type':Sequelize[_0xedd6('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 1d1c8a7..25b7300 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 _0x5246=['attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','include','find','body','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update','destroy','then','end','error','name','send','index','map','SquareReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields'];(function(_0x4de1a1,_0x29fc1e){var _0x3b7225=function(_0x3f7784){while(--_0x3f7784){_0x4de1a1['push'](_0x4de1a1['shift']());}};_0x3b7225(++_0x29fc1e);}(_0x5246,0xf9));var _0x6524=function(_0x2e9dec,_0x3f03bf){_0x2e9dec=_0x2e9dec-0x0;var _0x6a78b9=_0x5246[_0x2e9dec];return _0x6a78b9;};'use strict';var emlformat=require(_0x6524('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6524('0x1'));var jsonpatch=require(_0x6524('0x2'));var rp=require('request-promise');var moment=require(_0x6524('0x3'));var BPromise=require(_0x6524('0x4'));var Mustache=require(_0x6524('0x5'));var util=require(_0x6524('0x6'));var path=require(_0x6524('0x7'));var sox=require('sox');var csv=require(_0x6524('0x8'));var ejs=require(_0x6524('0x9'));var fs=require('fs');var fs_extra=require(_0x6524('0xa'));var _=require(_0x6524('0xb'));var squel=require(_0x6524('0xc'));var crypto=require(_0x6524('0xd'));var jsforce=require(_0x6524('0xe'));var deskjs=require(_0x6524('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6524('0x10'));var Papa=require(_0x6524('0x11'));var Redis=require(_0x6524('0x12'));var authService=require(_0x6524('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6524('0x14'));var logger=require(_0x6524('0x15'))(_0x6524('0x16'));var utils=require('../../config/utils');var config=require(_0x6524('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6524('0x18'))['db'];function respondWithStatusCode(_0x1b82ae,_0x3dc221){_0x3dc221=_0x3dc221||0xcc;return function(_0x2674b1){if(_0x2674b1){return _0x1b82ae[_0x6524('0x19')](_0x3dc221);}return _0x1b82ae['status'](_0x3dc221)['end']();};}function respondWithResult(_0x45c666,_0x2ec70a){_0x2ec70a=_0x2ec70a||0xc8;return function(_0x45ed52){if(_0x45ed52){return _0x45c666['status'](_0x2ec70a)[_0x6524('0x1a')](_0x45ed52);}};}function respondWithFilteredResult(_0x506050,_0x2329f5){return function(_0x38da40){if(_0x38da40){var _0x52228c=typeof _0x2329f5[_0x6524('0x1b')]===_0x6524('0x1c')&&typeof _0x2329f5['limit']==='undefined';var _0x1a7654=_0x38da40['count'];var _0x248fb6=_0x52228c?0x0:_0x2329f5[_0x6524('0x1b')];var _0x188d0b=_0x52228c?_0x38da40[_0x6524('0x1d')]:_0x2329f5[_0x6524('0x1b')]+_0x2329f5[_0x6524('0x1e')];var _0x2f0a2b;if(_0x188d0b>=_0x1a7654){_0x188d0b=_0x1a7654;_0x2f0a2b=0xc8;}else{_0x2f0a2b=0xce;}_0x506050[_0x6524('0x1f')](_0x2f0a2b);return _0x506050['set'](_0x6524('0x20'),_0x248fb6+'-'+_0x188d0b+'/'+_0x1a7654)[_0x6524('0x1a')](_0x38da40);}return null;};}function patchUpdates(_0x18e51b){return function(_0x3c79bd){try{jsonpatch[_0x6524('0x21')](_0x3c79bd,_0x18e51b,!![]);}catch(_0x10f2f3){return BPromise[_0x6524('0x22')](_0x10f2f3);}return _0x3c79bd[_0x6524('0x23')]();};}function saveUpdates(_0x3d761f,_0x4c3116){return function(_0x27c7d7){if(_0x27c7d7){return _0x27c7d7[_0x6524('0x24')](_0x3d761f)['then'](function(_0xa1bd29){return _0xa1bd29;});}return null;};}function removeEntity(_0x27866d,_0x211704){return function(_0x20d594){if(_0x20d594){return _0x20d594[_0x6524('0x25')]()[_0x6524('0x26')](function(){_0x27866d['status'](0xcc)[_0x6524('0x27')]();});}};}function handleEntityNotFound(_0x502e80,_0x1d5c48){return function(_0x44daf3){if(!_0x44daf3){_0x502e80[_0x6524('0x19')](0x194);}return _0x44daf3;};}function handleError(_0x3734e1,_0x5afda7){_0x5afda7=_0x5afda7||0x1f4;return function(_0x45ddb5){logger[_0x6524('0x28')](_0x45ddb5['stack']);if(_0x45ddb5[_0x6524('0x29')]){delete _0x45ddb5['name'];}_0x3734e1[_0x6524('0x1f')](_0x5afda7)[_0x6524('0x2a')](_0x45ddb5);};}exports[_0x6524('0x2b')]=function(_0x1b3459,_0x19cb94){var _0x4fc5fe={},_0x438cbf={},_0x2317a1={'count':0x0,'rows':[]};var _0x54fe9a=_[_0x6524('0x2c')](db[_0x6524('0x2d')][_0x6524('0x2e')],function(_0x8edd7e){return{'name':_0x8edd7e['fieldName'],'type':_0x8edd7e[_0x6524('0x2f')][_0x6524('0x30')]};});_0x438cbf[_0x6524('0x31')]=_[_0x6524('0x2c')](_0x54fe9a,_0x6524('0x29'));_0x438cbf[_0x6524('0x32')]=_[_0x6524('0x33')](_0x1b3459[_0x6524('0x32')]);_0x438cbf[_0x6524('0x34')]=_[_0x6524('0x35')](_0x438cbf[_0x6524('0x31')],_0x438cbf[_0x6524('0x32')]);_0x4fc5fe['attributes']=_[_0x6524('0x35')](_0x438cbf[_0x6524('0x31')],qs[_0x6524('0x36')](_0x1b3459[_0x6524('0x32')][_0x6524('0x36')]));_0x4fc5fe[_0x6524('0x37')]=_0x4fc5fe[_0x6524('0x37')]['length']?_0x4fc5fe['attributes']:_0x438cbf[_0x6524('0x31')];if(!_0x1b3459[_0x6524('0x32')][_0x6524('0x38')](_0x6524('0x39'))){_0x4fc5fe['limit']=qs[_0x6524('0x1e')](_0x1b3459[_0x6524('0x32')]['limit']);_0x4fc5fe[_0x6524('0x1b')]=qs[_0x6524('0x1b')](_0x1b3459[_0x6524('0x32')][_0x6524('0x1b')]);}_0x4fc5fe[_0x6524('0x3a')]=qs['sort'](_0x1b3459['query'][_0x6524('0x3b')]);_0x4fc5fe[_0x6524('0x3c')]=qs['filters'](_[_0x6524('0x3d')](_0x1b3459[_0x6524('0x32')],_0x438cbf[_0x6524('0x34')]),_0x54fe9a);if(_0x1b3459['query']['filter']){_0x4fc5fe[_0x6524('0x3c')]=_[_0x6524('0x3e')](_0x4fc5fe[_0x6524('0x3c')],{'$or':_[_0x6524('0x2c')](_0x54fe9a,function(_0x12259e){if(_0x12259e[_0x6524('0x2f')]!==_0x6524('0x3f')){var _0x51d231={};_0x51d231[_0x12259e[_0x6524('0x29')]]={'$like':'%'+_0x1b3459[_0x6524('0x32')][_0x6524('0x40')]+'%'};return _0x51d231;}})});}_0x4fc5fe=_[_0x6524('0x3e')]({},_0x4fc5fe,_0x1b3459[_0x6524('0x41')]);var _0x2f851b={'where':_0x4fc5fe[_0x6524('0x3c')]};return db[_0x6524('0x2d')]['count'](_0x2f851b)[_0x6524('0x26')](function(_0x3cef4c){_0x2317a1[_0x6524('0x1d')]=_0x3cef4c;if(_0x1b3459[_0x6524('0x32')][_0x6524('0x42')]){_0x4fc5fe['include']=[{'all':!![]}];}return db[_0x6524('0x2d')][_0x6524('0x43')](_0x4fc5fe);})[_0x6524('0x26')](function(_0x28b59c){_0x2317a1[_0x6524('0x44')]=_0x28b59c;return _0x2317a1;})[_0x6524('0x26')](respondWithFilteredResult(_0x19cb94,_0x4fc5fe))[_0x6524('0x45')](handleError(_0x19cb94,null));};exports[_0x6524('0x46')]=function(_0x2dc649,_0x516083){var _0x529086={'raw':!![],'where':{'id':_0x2dc649['params']['id']}},_0x424c99={};_0x424c99['model']=_[_0x6524('0x33')](db[_0x6524('0x2d')][_0x6524('0x2e')]);_0x424c99[_0x6524('0x32')]=_[_0x6524('0x33')](_0x2dc649[_0x6524('0x32')]);_0x424c99[_0x6524('0x34')]=_[_0x6524('0x35')](_0x424c99['model'],_0x424c99['query']);_0x529086[_0x6524('0x37')]=_[_0x6524('0x35')](_0x424c99[_0x6524('0x31')],qs[_0x6524('0x36')](_0x2dc649[_0x6524('0x32')]['fields']));_0x529086[_0x6524('0x37')]=_0x529086[_0x6524('0x37')]['length']?_0x529086[_0x6524('0x37')]:_0x424c99[_0x6524('0x31')];if(_0x2dc649[_0x6524('0x32')][_0x6524('0x42')]){_0x529086[_0x6524('0x47')]=[{'all':!![]}];}_0x529086=_[_0x6524('0x3e')]({},_0x529086,_0x2dc649[_0x6524('0x41')]);return db[_0x6524('0x2d')][_0x6524('0x48')](_0x529086)[_0x6524('0x26')](handleEntityNotFound(_0x516083,null))[_0x6524('0x26')](respondWithResult(_0x516083,null))['catch'](handleError(_0x516083,null));};exports['create']=function(_0x2879e4,_0x4e7eeb){return db['SquareReport']['create'](_0x2879e4[_0x6524('0x49')],{})[_0x6524('0x26')](respondWithResult(_0x4e7eeb,0xc9))['catch'](handleError(_0x4e7eeb,null));};exports[_0x6524('0x24')]=function(_0x35dc1f,_0x2aef34){if(_0x35dc1f[_0x6524('0x49')]['id']){delete _0x35dc1f[_0x6524('0x49')]['id'];}return db[_0x6524('0x2d')][_0x6524('0x48')]({'where':{'id':_0x35dc1f[_0x6524('0x4a')]['id']}})[_0x6524('0x26')](handleEntityNotFound(_0x2aef34,null))['then'](saveUpdates(_0x35dc1f['body'],null))[_0x6524('0x26')](respondWithResult(_0x2aef34,null))['catch'](handleError(_0x2aef34,null));};exports['destroy']=function(_0x46d8bb,_0x26d5b6){return db['SquareReport'][_0x6524('0x48')]({'where':{'id':_0x46d8bb[_0x6524('0x4a')]['id']}})[_0x6524('0x26')](handleEntityNotFound(_0x26d5b6,null))[_0x6524('0x26')](removeEntity(_0x26d5b6,null))['catch'](handleError(_0x26d5b6,null));};exports[_0x6524('0x4b')]=function(_0x5b57d9,_0x4678fa){return db[_0x6524('0x2d')][_0x6524('0x4b')]()[_0x6524('0x26')](respondWithResult(_0x4678fa,null))['catch'](handleError(_0x4678fa,null));}; \ No newline at end of file +var _0x7eb3=['destroy','error','stack','name','index','map','SquareReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','include','findAll','rows','params','keys','includeAll','options','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then'];(function(_0x1c443f,_0x51319d){var _0x4a4a71=function(_0x355b73){while(--_0x355b73){_0x1c443f['push'](_0x1c443f['shift']());}};_0x4a4a71(++_0x51319d);}(_0x7eb3,0x113));var _0x37eb=function(_0x59d269,_0x77b18e){_0x59d269=_0x59d269-0x0;var _0x20160f=_0x7eb3[_0x59d269];return _0x20160f;};'use strict';var emlformat=require(_0x37eb('0x0'));var rimraf=require(_0x37eb('0x1'));var zipdir=require(_0x37eb('0x2'));var jsonpatch=require(_0x37eb('0x3'));var rp=require(_0x37eb('0x4'));var moment=require(_0x37eb('0x5'));var BPromise=require(_0x37eb('0x6'));var Mustache=require(_0x37eb('0x7'));var util=require(_0x37eb('0x8'));var path=require(_0x37eb('0x9'));var sox=require(_0x37eb('0xa'));var csv=require(_0x37eb('0xb'));var ejs=require(_0x37eb('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x37eb('0xd'));var squel=require(_0x37eb('0xe'));var crypto=require(_0x37eb('0xf'));var jsforce=require(_0x37eb('0x10'));var deskjs=require(_0x37eb('0x11'));var toCsv=require(_0x37eb('0xb'));var querystring=require(_0x37eb('0x12'));var Papa=require(_0x37eb('0x13'));var Redis=require(_0x37eb('0x14'));var authService=require(_0x37eb('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x37eb('0x16'));var hardwareService=require(_0x37eb('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x37eb('0x18'));var config=require(_0x37eb('0x19'));var licenseUtil=require(_0x37eb('0x1a'));var db=require(_0x37eb('0x1b'))['db'];function respondWithStatusCode(_0x130ab6,_0x2c5c2a){_0x2c5c2a=_0x2c5c2a||0xcc;return function(_0x552c96){if(_0x552c96){return _0x130ab6[_0x37eb('0x1c')](_0x2c5c2a);}return _0x130ab6[_0x37eb('0x1d')](_0x2c5c2a)[_0x37eb('0x1e')]();};}function respondWithResult(_0x3abb5a,_0x2d5386){_0x2d5386=_0x2d5386||0xc8;return function(_0x8681b2){if(_0x8681b2){return _0x3abb5a['status'](_0x2d5386)[_0x37eb('0x1f')](_0x8681b2);}};}function respondWithFilteredResult(_0x505191,_0x56e43b){return function(_0x2d8b75){if(_0x2d8b75){var _0x40e1ab=typeof _0x56e43b[_0x37eb('0x20')]==='undefined'&&typeof _0x56e43b[_0x37eb('0x21')]===_0x37eb('0x22');var _0x22f62d=_0x2d8b75[_0x37eb('0x23')];var _0x3a2767=_0x40e1ab?0x0:_0x56e43b[_0x37eb('0x20')];var _0x1b5288=_0x40e1ab?_0x2d8b75[_0x37eb('0x23')]:_0x56e43b['offset']+_0x56e43b['limit'];var _0x89676e;if(_0x1b5288>=_0x22f62d){_0x1b5288=_0x22f62d;_0x89676e=0xc8;}else{_0x89676e=0xce;}_0x505191['status'](_0x89676e);return _0x505191['set'](_0x37eb('0x24'),_0x3a2767+'-'+_0x1b5288+'/'+_0x22f62d)[_0x37eb('0x1f')](_0x2d8b75);}return null;};}function patchUpdates(_0x2f4c90){return function(_0x35761f){try{jsonpatch[_0x37eb('0x25')](_0x35761f,_0x2f4c90,!![]);}catch(_0x2f334b){return BPromise[_0x37eb('0x26')](_0x2f334b);}return _0x35761f[_0x37eb('0x27')]();};}function saveUpdates(_0x2ff876,_0x5b9583){return function(_0x1fbce0){if(_0x1fbce0){return _0x1fbce0['update'](_0x2ff876)[_0x37eb('0x28')](function(_0x3b8aea){return _0x3b8aea;});}return null;};}function removeEntity(_0x5ea91c,_0x3c192a){return function(_0x3f3470){if(_0x3f3470){return _0x3f3470[_0x37eb('0x29')]()['then'](function(){_0x5ea91c['status'](0xcc)[_0x37eb('0x1e')]();});}};}function handleEntityNotFound(_0xf87498,_0x38333d){return function(_0x27f09a){if(!_0x27f09a){_0xf87498[_0x37eb('0x1c')](0x194);}return _0x27f09a;};}function handleError(_0x57d519,_0x53db16){_0x53db16=_0x53db16||0x1f4;return function(_0xb8798c){logger[_0x37eb('0x2a')](_0xb8798c[_0x37eb('0x2b')]);if(_0xb8798c['name']){delete _0xb8798c[_0x37eb('0x2c')];}_0x57d519[_0x37eb('0x1d')](_0x53db16)['send'](_0xb8798c);};}exports[_0x37eb('0x2d')]=function(_0x248035,_0x1f10ae){var _0x174eb1={},_0x6fa35b={},_0x4ce8a2={'count':0x0,'rows':[]};var _0x2f6135=_[_0x37eb('0x2e')](db[_0x37eb('0x2f')][_0x37eb('0x30')],function(_0x5f1539){return{'name':_0x5f1539['fieldName'],'type':_0x5f1539['type'][_0x37eb('0x31')]};});_0x6fa35b[_0x37eb('0x32')]=_[_0x37eb('0x2e')](_0x2f6135,'name');_0x6fa35b[_0x37eb('0x33')]=_['keys'](_0x248035[_0x37eb('0x33')]);_0x6fa35b[_0x37eb('0x34')]=_[_0x37eb('0x35')](_0x6fa35b[_0x37eb('0x32')],_0x6fa35b[_0x37eb('0x33')]);_0x174eb1[_0x37eb('0x36')]=_[_0x37eb('0x35')](_0x6fa35b[_0x37eb('0x32')],qs[_0x37eb('0x37')](_0x248035[_0x37eb('0x33')][_0x37eb('0x37')]));_0x174eb1['attributes']=_0x174eb1[_0x37eb('0x36')][_0x37eb('0x38')]?_0x174eb1[_0x37eb('0x36')]:_0x6fa35b['model'];if(!_0x248035['query']['hasOwnProperty'](_0x37eb('0x39'))){_0x174eb1[_0x37eb('0x21')]=qs[_0x37eb('0x21')](_0x248035[_0x37eb('0x33')]['limit']);_0x174eb1[_0x37eb('0x20')]=qs['offset'](_0x248035[_0x37eb('0x33')][_0x37eb('0x20')]);}_0x174eb1[_0x37eb('0x3a')]=qs[_0x37eb('0x3b')](_0x248035[_0x37eb('0x33')]['sort']);_0x174eb1['where']=qs[_0x37eb('0x34')](_[_0x37eb('0x3c')](_0x248035[_0x37eb('0x33')],_0x6fa35b[_0x37eb('0x34')]),_0x2f6135);if(_0x248035[_0x37eb('0x33')][_0x37eb('0x3d')]){_0x174eb1[_0x37eb('0x3e')]=_['merge'](_0x174eb1[_0x37eb('0x3e')],{'$or':_[_0x37eb('0x2e')](_0x2f6135,function(_0x2c7801){if(_0x2c7801[_0x37eb('0x3f')]!==_0x37eb('0x40')){var _0x57c928={};_0x57c928[_0x2c7801['name']]={'$like':'%'+_0x248035[_0x37eb('0x33')][_0x37eb('0x3d')]+'%'};return _0x57c928;}})});}_0x174eb1=_[_0x37eb('0x41')]({},_0x174eb1,_0x248035['options']);var _0x10e49d={'where':_0x174eb1['where']};return db['SquareReport']['count'](_0x10e49d)[_0x37eb('0x28')](function(_0x2c3892){_0x4ce8a2[_0x37eb('0x23')]=_0x2c3892;if(_0x248035['query']['includeAll']){_0x174eb1[_0x37eb('0x42')]=[{'all':!![]}];}return db[_0x37eb('0x2f')][_0x37eb('0x43')](_0x174eb1);})[_0x37eb('0x28')](function(_0x20d3a1){_0x4ce8a2[_0x37eb('0x44')]=_0x20d3a1;return _0x4ce8a2;})['then'](respondWithFilteredResult(_0x1f10ae,_0x174eb1))['catch'](handleError(_0x1f10ae,null));};exports['show']=function(_0x5c4110,_0x38455f){var _0x3d14cb={'raw':!![],'where':{'id':_0x5c4110[_0x37eb('0x45')]['id']}},_0x764da7={};_0x764da7[_0x37eb('0x32')]=_[_0x37eb('0x46')](db[_0x37eb('0x2f')][_0x37eb('0x30')]);_0x764da7[_0x37eb('0x33')]=_[_0x37eb('0x46')](_0x5c4110['query']);_0x764da7[_0x37eb('0x34')]=_[_0x37eb('0x35')](_0x764da7['model'],_0x764da7[_0x37eb('0x33')]);_0x3d14cb['attributes']=_[_0x37eb('0x35')](_0x764da7['model'],qs[_0x37eb('0x37')](_0x5c4110[_0x37eb('0x33')][_0x37eb('0x37')]));_0x3d14cb[_0x37eb('0x36')]=_0x3d14cb['attributes']['length']?_0x3d14cb[_0x37eb('0x36')]:_0x764da7['model'];if(_0x5c4110[_0x37eb('0x33')][_0x37eb('0x47')]){_0x3d14cb['include']=[{'all':!![]}];}_0x3d14cb=_[_0x37eb('0x41')]({},_0x3d14cb,_0x5c4110[_0x37eb('0x48')]);return db[_0x37eb('0x2f')][_0x37eb('0x49')](_0x3d14cb)[_0x37eb('0x28')](handleEntityNotFound(_0x38455f,null))['then'](respondWithResult(_0x38455f,null))[_0x37eb('0x4a')](handleError(_0x38455f,null));};exports[_0x37eb('0x4b')]=function(_0x29e7ae,_0x41d24d){return db['SquareReport'][_0x37eb('0x4b')](_0x29e7ae['body'],{})[_0x37eb('0x28')](respondWithResult(_0x41d24d,0xc9))[_0x37eb('0x4a')](handleError(_0x41d24d,null));};exports[_0x37eb('0x4c')]=function(_0xc6e1dc,_0x1e8234){if(_0xc6e1dc[_0x37eb('0x4d')]['id']){delete _0xc6e1dc[_0x37eb('0x4d')]['id'];}return db[_0x37eb('0x2f')][_0x37eb('0x49')]({'where':{'id':_0xc6e1dc[_0x37eb('0x45')]['id']}})[_0x37eb('0x28')](handleEntityNotFound(_0x1e8234,null))[_0x37eb('0x28')](saveUpdates(_0xc6e1dc[_0x37eb('0x4d')],null))['then'](respondWithResult(_0x1e8234,null))[_0x37eb('0x4a')](handleError(_0x1e8234,null));};exports[_0x37eb('0x29')]=function(_0x511b50,_0x27926c){return db[_0x37eb('0x2f')][_0x37eb('0x49')]({'where':{'id':_0x511b50['params']['id']}})[_0x37eb('0x28')](handleEntityNotFound(_0x27926c,null))[_0x37eb('0x28')](removeEntity(_0x27926c,null))['catch'](handleError(_0x27926c,null));};exports[_0x37eb('0x4e')]=function(_0x30c305,_0x2baae5){return db[_0x37eb('0x2f')][_0x37eb('0x4e')]()[_0x37eb('0x28')](respondWithResult(_0x2baae5,null))[_0x37eb('0x4a')](handleError(_0x2baae5,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index e8a1638..78d4a0d 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 _0xa00a=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','leaveAt'];(function(_0x1f1b10,_0x3136fd){var _0x3d0c2b=function(_0x59b85a){while(--_0x59b85a){_0x1f1b10['push'](_0x1f1b10['shift']());}};_0x3d0c2b(++_0x3136fd);}(_0xa00a,0x87));var _0xaa00=function(_0x3ab77d,_0x2930a2){_0x3ab77d=_0x3ab77d-0x0;var _0xf03753=_0xa00a[_0x3ab77d];return _0xf03753;};'use strict';var _=require(_0xaa00('0x0'));var util=require(_0xaa00('0x1'));var logger=require(_0xaa00('0x2'))('api');var moment=require(_0xaa00('0x3'));var BPromise=require(_0xaa00('0x4'));var rp=require(_0xaa00('0x5'));var fs=require('fs');var path=require(_0xaa00('0x6'));var rimraf=require(_0xaa00('0x7'));var config=require('../../config/environment');var attributes=require(_0xaa00('0x8'));module[_0xaa00('0x9')]=function(_0x5a7680,_0x7ff0da){return _0x5a7680[_0xaa00('0xa')](_0xaa00('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xaa00('0xc'),'fields':[_0xaa00('0xd'),'project_name']},{'name':_0xaa00('0xe'),'fields':[_0xaa00('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f8f=['../../config/environment','exports','define','SquareReport','uid_pname','leaveAt','lodash','api','bluebird','path'];(function(_0x1bf1c6,_0x16566c){var _0x44cfe0=function(_0x286904){while(--_0x286904){_0x1bf1c6['push'](_0x1bf1c6['shift']());}};_0x44cfe0(++_0x16566c);}(_0x4f8f,0x164));var _0xf4f8=function(_0x47e48c,_0x3cb432){_0x47e48c=_0x47e48c-0x0;var _0x5b33a3=_0x4f8f[_0x47e48c];return _0x5b33a3;};'use strict';var _=require(_0xf4f8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf4f8('0x1'));var moment=require('moment');var BPromise=require(_0xf4f8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4f8('0x3'));var rimraf=require('rimraf');var config=require(_0xf4f8('0x4'));var attributes=require('./squareReport.attributes');module[_0xf4f8('0x5')]=function(_0x5da2ec,_0xd1d228){return _0x5da2ec[_0xf4f8('0x6')](_0xf4f8('0x7'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xf4f8('0x8'),'fields':['uniqueid','project_name']},{'name':_0xf4f8('0x9'),'fields':[_0xf4f8('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 152cd0b..f47c4e4 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 _0x93d8=['SquareReport','body','options','UpdateSquareReport','where','limit','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareReport,\x20%s,\x20%s','result','CreateSquareReport'];(function(_0x4ee5e1,_0x26db5e){var _0x1bbdb0=function(_0x27b1c6){while(--_0x27b1c6){_0x4ee5e1['push'](_0x4ee5e1['shift']());}};_0x1bbdb0(++_0x26db5e);}(_0x93d8,0x64));var _0x893d=function(_0x16e04b,_0x1ca7f3){_0x16e04b=_0x16e04b-0x0;var _0x5387d8=_0x93d8[_0x16e04b];return _0x5387d8;};'use strict';var _=require(_0x893d('0x0'));var util=require(_0x893d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x893d('0x2'));var db=require(_0x893d('0x3'))['db'];var utils=require(_0x893d('0x4'));var logger=require(_0x893d('0x5'))(_0x893d('0x6'));var config=require(_0x893d('0x7'));var jayson=require(_0x893d('0x8'));var client=jayson[_0x893d('0x9')][_0x893d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25ab96,_0x314df7,_0x4c4830){return new BPromise(function(_0x2bb924,_0x731ab4){return client[_0x893d('0xb')](_0x25ab96,_0x4c4830)[_0x893d('0xc')](function(_0x2fe23e){logger[_0x893d('0xd')]('SquareReport,\x20%s,\x20%s',_0x314df7,_0x893d('0xe'));logger[_0x893d('0xf')](_0x893d('0x10'),_0x314df7,_0x893d('0xe'),JSON[_0x893d('0x11')](_0x2fe23e));if(_0x2fe23e[_0x893d('0x12')]){if(_0x2fe23e['error'][_0x893d('0x13')]===0x1f4){logger[_0x893d('0x12')]('SquareReport,\x20%s,\x20%s',_0x314df7,_0x2fe23e[_0x893d('0x12')][_0x893d('0x14')]);return _0x731ab4(_0x2fe23e['error'][_0x893d('0x14')]);}logger['error'](_0x893d('0x15'),_0x314df7,_0x2fe23e[_0x893d('0x12')]['message']);return _0x2bb924(_0x2fe23e['error'][_0x893d('0x14')]);}else{logger[_0x893d('0xd')](_0x893d('0x15'),_0x314df7,_0x893d('0xe'));_0x2bb924(_0x2fe23e[_0x893d('0x16')][_0x893d('0x14')]);}})['catch'](function(_0x5acd49){logger[_0x893d('0x12')]('SquareReport,\x20%s,\x20%s',_0x314df7,_0x5acd49);_0x731ab4(_0x5acd49);});});}exports[_0x893d('0x17')]=function(_0x1d9c85){var _0x415f0a=this;return new Promise(function(_0xaef1d0,_0x51584c){return db[_0x893d('0x18')]['create'](_0x1d9c85[_0x893d('0x19')],{'raw':_0x1d9c85[_0x893d('0x1a')]?_0x1d9c85[_0x893d('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x48dd38){logger[_0x893d('0xd')](_0x893d('0x17'),_0x1d9c85);logger[_0x893d('0xf')](_0x893d('0x17'),_0x1d9c85,JSON[_0x893d('0x11')](_0x48dd38));_0xaef1d0(_0x48dd38);})['catch'](function(_0x5b3c72){logger[_0x893d('0x12')](_0x893d('0x17'),_0x5b3c72[_0x893d('0x14')],_0x1d9c85);_0x51584c(_0x415f0a[_0x893d('0x12')](0x1f4,_0x5b3c72[_0x893d('0x14')]));});});};exports[_0x893d('0x1b')]=function(_0x5a77c5){var _0x44ebba=this;return new Promise(function(_0xb0605,_0x42880a){return db[_0x893d('0x18')]['update'](_0x5a77c5[_0x893d('0x19')],{'raw':_0x5a77c5['options']?_0x5a77c5[_0x893d('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a77c5[_0x893d('0x1a')]?_0x5a77c5['options'][_0x893d('0x1c')]||null:null,'attributes':_0x5a77c5[_0x893d('0x1a')]?_0x5a77c5[_0x893d('0x1a')]['attributes']||null:null,'limit':_0x5a77c5[_0x893d('0x1a')]?_0x5a77c5[_0x893d('0x1a')][_0x893d('0x1d')]||null:null})[_0x893d('0xc')](function(_0x4c7c20){logger[_0x893d('0xd')](_0x893d('0x1b'),_0x5a77c5);logger[_0x893d('0xf')](_0x893d('0x1b'),_0x5a77c5,JSON[_0x893d('0x11')](_0x4c7c20));_0xb0605(_0x4c7c20);})[_0x893d('0x1e')](function(_0x29a19c){logger['error'](_0x893d('0x1b'),_0x29a19c[_0x893d('0x14')],_0x5a77c5);_0x42880a(_0x44ebba[_0x893d('0x12')](0x1f4,_0x29a19c[_0x893d('0x14')]));});});}; \ No newline at end of file +var _0xbfeb=['stringify','error','code','message','result','CreateSquareReport','create','body','options','UpdateSquareReport','SquareReport','raw','where','attributes','limit','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0xb47567,_0x2102bc){var _0x23b480=function(_0x50a985){while(--_0x50a985){_0xb47567['push'](_0xb47567['shift']());}};_0x23b480(++_0x2102bc);}(_0xbfeb,0x6c));var _0xbbfe=function(_0x3cca69,_0x18f3ed){_0x3cca69=_0x3cca69-0x0;var _0x2bd8ec=_0xbfeb[_0x3cca69];return _0x2bd8ec;};'use strict';var _=require('lodash');var util=require(_0xbbfe('0x0'));var moment=require(_0xbbfe('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbfe('0x2'));var db=require(_0xbbfe('0x3'))['db'];var utils=require(_0xbbfe('0x4'));var logger=require('../../config/logger')(_0xbbfe('0x5'));var config=require(_0xbbfe('0x6'));var jayson=require(_0xbbfe('0x7'));var client=jayson[_0xbbfe('0x8')][_0xbbfe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d3e1a,_0x4fcc3c,_0x3ab016){return new BPromise(function(_0x531fb1,_0x780dec){return client['request'](_0x1d3e1a,_0x3ab016)[_0xbbfe('0xa')](function(_0x2aed0c){logger[_0xbbfe('0xb')](_0xbbfe('0xc'),_0x4fcc3c,_0xbbfe('0xd'));logger[_0xbbfe('0xe')](_0xbbfe('0xf'),_0x4fcc3c,_0xbbfe('0xd'),JSON[_0xbbfe('0x10')](_0x2aed0c));if(_0x2aed0c[_0xbbfe('0x11')]){if(_0x2aed0c[_0xbbfe('0x11')][_0xbbfe('0x12')]===0x1f4){logger[_0xbbfe('0x11')]('SquareReport,\x20%s,\x20%s',_0x4fcc3c,_0x2aed0c['error']['message']);return _0x780dec(_0x2aed0c['error'][_0xbbfe('0x13')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x4fcc3c,_0x2aed0c['error'][_0xbbfe('0x13')]);return _0x531fb1(_0x2aed0c[_0xbbfe('0x11')][_0xbbfe('0x13')]);}else{logger[_0xbbfe('0xb')](_0xbbfe('0xc'),_0x4fcc3c,_0xbbfe('0xd'));_0x531fb1(_0x2aed0c[_0xbbfe('0x14')][_0xbbfe('0x13')]);}})['catch'](function(_0x398a35){logger[_0xbbfe('0x11')](_0xbbfe('0xc'),_0x4fcc3c,_0x398a35);_0x780dec(_0x398a35);});});}exports[_0xbbfe('0x15')]=function(_0x293005){var _0x5dcb53=this;return new Promise(function(_0x20f67c,_0x479edf){return db['SquareReport'][_0xbbfe('0x16')](_0x293005[_0xbbfe('0x17')],{'raw':_0x293005[_0xbbfe('0x18')]?_0x293005[_0xbbfe('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xbbfe('0xa')](function(_0xd7bae4){logger[_0xbbfe('0xb')](_0xbbfe('0x15'),_0x293005);logger[_0xbbfe('0xe')]('CreateSquareReport',_0x293005,JSON[_0xbbfe('0x10')](_0xd7bae4));_0x20f67c(_0xd7bae4);})['catch'](function(_0x5c575d){logger[_0xbbfe('0x11')]('CreateSquareReport',_0x5c575d['message'],_0x293005);_0x479edf(_0x5dcb53[_0xbbfe('0x11')](0x1f4,_0x5c575d['message']));});});};exports[_0xbbfe('0x19')]=function(_0x11d47f){var _0x5191de=this;return new Promise(function(_0x4df6f7,_0x24ce3e){return db[_0xbbfe('0x1a')]['update'](_0x11d47f[_0xbbfe('0x17')],{'raw':_0x11d47f[_0xbbfe('0x18')]?_0x11d47f[_0xbbfe('0x18')][_0xbbfe('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11d47f[_0xbbfe('0x18')]?_0x11d47f['options'][_0xbbfe('0x1c')]||null:null,'attributes':_0x11d47f[_0xbbfe('0x18')]?_0x11d47f[_0xbbfe('0x18')][_0xbbfe('0x1d')]||null:null,'limit':_0x11d47f['options']?_0x11d47f['options'][_0xbbfe('0x1e')]||null:null})[_0xbbfe('0xa')](function(_0x4d8f25){logger[_0xbbfe('0xb')](_0xbbfe('0x19'),_0x11d47f);logger[_0xbbfe('0xe')](_0xbbfe('0x19'),_0x11d47f,JSON[_0xbbfe('0x10')](_0x4d8f25));_0x4df6f7(_0x4d8f25);})['catch'](function(_0x207657){logger[_0xbbfe('0x11')](_0xbbfe('0x19'),_0x207657[_0xbbfe('0x13')],_0x11d47f);_0x24ce3e(_0x5191de[_0xbbfe('0x11')](0x1f4,_0x207657[_0xbbfe('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 8d9e127..15c6ccc 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 _0x2cf7=['show','post','delete','destroy','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id'];(function(_0x199c88,_0x13dc4a){var _0x2cf34a=function(_0x7b421c){while(--_0x7b421c){_0x199c88['push'](_0x199c88['shift']());}};_0x2cf34a(++_0x13dc4a);}(_0x2cf7,0x18c));var _0x72cf=function(_0x5e3a45,_0x45f0c5){_0x5e3a45=_0x5e3a45-0x0;var _0x13419f=_0x2cf7[_0x5e3a45];return _0x13419f;};'use strict';var multer=require(_0x72cf('0x0'));var util=require('util');var path=require(_0x72cf('0x1'));var timeout=require(_0x72cf('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x72cf('0x3'));var interaction=require(_0x72cf('0x4'));var config=require(_0x72cf('0x5'));var controller=require('./squareReportDetail.controller');router[_0x72cf('0x6')]('/',auth[_0x72cf('0x7')](),controller['index']);router[_0x72cf('0x6')](_0x72cf('0x8'),auth[_0x72cf('0x7')](),controller['describe']);router[_0x72cf('0x6')](_0x72cf('0x9'),auth[_0x72cf('0x7')](),controller[_0x72cf('0xa')]);router[_0x72cf('0xb')]('/',auth[_0x72cf('0x7')](),controller['create']);router['put'](_0x72cf('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x72cf('0xc')](_0x72cf('0x9'),auth[_0x72cf('0x7')](),controller[_0x72cf('0xd')]);module['exports']=router; \ No newline at end of file +var _0x32b2=['../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x32b2,0x18a));var _0x232b=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x32b2[_0x3fba9f];return _0x192cf1;};'use strict';var multer=require(_0x232b('0x0'));var util=require(_0x232b('0x1'));var path=require(_0x232b('0x2'));var timeout=require(_0x232b('0x3'));var express=require(_0x232b('0x4'));var router=express[_0x232b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x232b('0x6'));var config=require(_0x232b('0x7'));var controller=require(_0x232b('0x8'));router[_0x232b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x232b('0x9')]('/describe',auth[_0x232b('0xa')](),controller[_0x232b('0xb')]);router['get'](_0x232b('0xc'),auth[_0x232b('0xa')](),controller[_0x232b('0xd')]);router[_0x232b('0xe')]('/',auth[_0x232b('0xa')](),controller[_0x232b('0xf')]);router[_0x232b('0x10')](_0x232b('0xc'),auth[_0x232b('0xa')](),controller[_0x232b('0x11')]);router[_0x232b('0x12')](_0x232b('0xc'),auth[_0x232b('0xa')](),controller[_0x232b('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 099d5c7..bba184a 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 _0x9c26=['exports','STRING','TEXT','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9c26,0xe7));var _0x69c2=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x9c26[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x69c2('0x0'));module[_0x69c2('0x1')]={'uniqueid':{'type':Sequelize[_0x69c2('0x2')]},'node':{'type':Sequelize[_0x69c2('0x2')]},'application':{'type':Sequelize[_0x69c2('0x2')]},'data':{'type':Sequelize[_0x69c2('0x3')]},'project_name':{'type':Sequelize[_0x69c2('0x2')]},'callerid':{'type':Sequelize[_0x69c2('0x2')]}}; \ No newline at end of file +var _0x18f8=['STRING','sequelize'];(function(_0x15a65d,_0x4e62ce){var _0x5b6e3d=function(_0x29ec8a){while(--_0x29ec8a){_0x15a65d['push'](_0x15a65d['shift']());}};_0x5b6e3d(++_0x4e62ce);}(_0x18f8,0x1bf));var _0x818f=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x18f8[_0x36c5b0];return _0xf19333;};'use strict';var Sequelize=require(_0x818f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x818f('0x1')]},'node':{'type':Sequelize[_0x818f('0x1')]},'application':{'type':Sequelize[_0x818f('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x818f('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 5c06b07..9db1fb7 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 _0x1de9=['sort','where','filters','merge','VIRTUAL','filter','options','SquareDetailsReport','includeAll','include','rawAttributes','find','catch','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','bluebird','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','set','reject','save','update','then','sendStatus','stack','name','send','index','map','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x7efbd,_0x158b95){var _0x2ad16b=function(_0x1aad0e){while(--_0x1aad0e){_0x7efbd['push'](_0x7efbd['shift']());}};_0x2ad16b(++_0x158b95);}(_0x1de9,0xe1));var _0x91de=function(_0x3d8287,_0x26d5dc){_0x3d8287=_0x3d8287-0x0;var _0x59a733=_0x1de9[_0x3d8287];return _0x59a733;};'use strict';var emlformat=require(_0x91de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91de('0x1'));var jsonpatch=require(_0x91de('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x91de('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x91de('0x4'));var ejs=require(_0x91de('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91de('0x6'));var squel=require(_0x91de('0x7'));var crypto=require(_0x91de('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x91de('0x9'));var toCsv=require(_0x91de('0x4'));var querystring=require('querystring');var Papa=require(_0x91de('0xa'));var Redis=require(_0x91de('0xb'));var authService=require(_0x91de('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x91de('0xd'));var hardwareService=require(_0x91de('0xe'));var logger=require(_0x91de('0xf'))(_0x91de('0x10'));var utils=require(_0x91de('0x11'));var config=require(_0x91de('0x12'));var licenseUtil=require(_0x91de('0x13'));var db=require(_0x91de('0x14'))['db'];function respondWithStatusCode(_0x2fc7fe,_0x3c0c03){_0x3c0c03=_0x3c0c03||0xcc;return function(_0x238a6e){if(_0x238a6e){return _0x2fc7fe['sendStatus'](_0x3c0c03);}return _0x2fc7fe[_0x91de('0x15')](_0x3c0c03)[_0x91de('0x16')]();};}function respondWithResult(_0x463b9c,_0x50b9ea){_0x50b9ea=_0x50b9ea||0xc8;return function(_0x1b5b8b){if(_0x1b5b8b){return _0x463b9c[_0x91de('0x15')](_0x50b9ea)['json'](_0x1b5b8b);}};}function respondWithFilteredResult(_0xc46c54,_0x448f66){return function(_0x4ee607){if(_0x4ee607){var _0x2ac42e=typeof _0x448f66['offset']===_0x91de('0x17')&&typeof _0x448f66['limit']===_0x91de('0x17');var _0x22a956=_0x4ee607[_0x91de('0x18')];var _0x3bbcf5=_0x2ac42e?0x0:_0x448f66[_0x91de('0x19')];var _0x5b3bc4=_0x2ac42e?_0x4ee607[_0x91de('0x18')]:_0x448f66['offset']+_0x448f66[_0x91de('0x1a')];var _0x568b45;if(_0x5b3bc4>=_0x22a956){_0x5b3bc4=_0x22a956;_0x568b45=0xc8;}else{_0x568b45=0xce;}_0xc46c54[_0x91de('0x15')](_0x568b45);return _0xc46c54[_0x91de('0x1b')]('Content-Range',_0x3bbcf5+'-'+_0x5b3bc4+'/'+_0x22a956)['json'](_0x4ee607);}return null;};}function patchUpdates(_0x1f9ad2){return function(_0x4dead2){try{jsonpatch['apply'](_0x4dead2,_0x1f9ad2,!![]);}catch(_0x17cae2){return BPromise[_0x91de('0x1c')](_0x17cae2);}return _0x4dead2[_0x91de('0x1d')]();};}function saveUpdates(_0x2d267e,_0x2a2c49){return function(_0x40371d){if(_0x40371d){return _0x40371d[_0x91de('0x1e')](_0x2d267e)[_0x91de('0x1f')](function(_0x3731cc){return _0x3731cc;});}return null;};}function removeEntity(_0x36601c,_0x115a7e){return function(_0x380e9e){if(_0x380e9e){return _0x380e9e['destroy']()['then'](function(){_0x36601c[_0x91de('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x383711,_0x592aac){return function(_0x545dc1){if(!_0x545dc1){_0x383711[_0x91de('0x20')](0x194);}return _0x545dc1;};}function handleError(_0x468ee7,_0x4c19e2){_0x4c19e2=_0x4c19e2||0x1f4;return function(_0x151c42){logger['error'](_0x151c42[_0x91de('0x21')]);if(_0x151c42[_0x91de('0x22')]){delete _0x151c42['name'];}_0x468ee7[_0x91de('0x15')](_0x4c19e2)[_0x91de('0x23')](_0x151c42);};}exports[_0x91de('0x24')]=function(_0x4bd63b,_0x228336){var _0x4d0871={},_0x7ca0c8={},_0x17b785={'count':0x0,'rows':[]};var _0x3e9e9f=_[_0x91de('0x25')](db['SquareDetailsReport']['rawAttributes'],function(_0x10ecb7){return{'name':_0x10ecb7[_0x91de('0x26')],'type':_0x10ecb7[_0x91de('0x27')][_0x91de('0x28')]};});_0x7ca0c8['model']=_[_0x91de('0x25')](_0x3e9e9f,'name');_0x7ca0c8[_0x91de('0x29')]=_[_0x91de('0x2a')](_0x4bd63b[_0x91de('0x29')]);_0x7ca0c8['filters']=_[_0x91de('0x2b')](_0x7ca0c8[_0x91de('0x2c')],_0x7ca0c8[_0x91de('0x29')]);_0x4d0871[_0x91de('0x2d')]=_[_0x91de('0x2b')](_0x7ca0c8[_0x91de('0x2c')],qs['fields'](_0x4bd63b[_0x91de('0x29')][_0x91de('0x2e')]));_0x4d0871[_0x91de('0x2d')]=_0x4d0871['attributes'][_0x91de('0x2f')]?_0x4d0871[_0x91de('0x2d')]:_0x7ca0c8[_0x91de('0x2c')];if(!_0x4bd63b[_0x91de('0x29')][_0x91de('0x30')](_0x91de('0x31'))){_0x4d0871[_0x91de('0x1a')]=qs[_0x91de('0x1a')](_0x4bd63b[_0x91de('0x29')][_0x91de('0x1a')]);_0x4d0871[_0x91de('0x19')]=qs[_0x91de('0x19')](_0x4bd63b['query'][_0x91de('0x19')]);}_0x4d0871[_0x91de('0x32')]=qs[_0x91de('0x33')](_0x4bd63b[_0x91de('0x29')]['sort']);_0x4d0871[_0x91de('0x34')]=qs[_0x91de('0x35')](_['pick'](_0x4bd63b[_0x91de('0x29')],_0x7ca0c8[_0x91de('0x35')]),_0x3e9e9f);if(_0x4bd63b[_0x91de('0x29')]['filter']){_0x4d0871[_0x91de('0x34')]=_[_0x91de('0x36')](_0x4d0871[_0x91de('0x34')],{'$or':_['map'](_0x3e9e9f,function(_0x26d4c6){if(_0x26d4c6[_0x91de('0x27')]!==_0x91de('0x37')){var _0x1ec5c5={};_0x1ec5c5[_0x26d4c6[_0x91de('0x22')]]={'$like':'%'+_0x4bd63b[_0x91de('0x29')][_0x91de('0x38')]+'%'};return _0x1ec5c5;}})});}_0x4d0871=_['merge']({},_0x4d0871,_0x4bd63b[_0x91de('0x39')]);var _0x341c08={'where':_0x4d0871['where']};return db[_0x91de('0x3a')][_0x91de('0x18')](_0x341c08)[_0x91de('0x1f')](function(_0xf165db){_0x17b785[_0x91de('0x18')]=_0xf165db;if(_0x4bd63b['query'][_0x91de('0x3b')]){_0x4d0871[_0x91de('0x3c')]=[{'all':!![]}];}return db[_0x91de('0x3a')]['findAll'](_0x4d0871);})['then'](function(_0x5c47ff){_0x17b785['rows']=_0x5c47ff;return _0x17b785;})['then'](respondWithFilteredResult(_0x228336,_0x4d0871))['catch'](handleError(_0x228336,null));};exports['show']=function(_0x2bca6e,_0x548a9f){var _0x29db3a={'raw':!![],'where':{'id':_0x2bca6e['params']['id']}},_0x50121e={};_0x50121e[_0x91de('0x2c')]=_[_0x91de('0x2a')](db[_0x91de('0x3a')][_0x91de('0x3d')]);_0x50121e[_0x91de('0x29')]=_[_0x91de('0x2a')](_0x2bca6e['query']);_0x50121e['filters']=_[_0x91de('0x2b')](_0x50121e[_0x91de('0x2c')],_0x50121e[_0x91de('0x29')]);_0x29db3a[_0x91de('0x2d')]=_[_0x91de('0x2b')](_0x50121e[_0x91de('0x2c')],qs[_0x91de('0x2e')](_0x2bca6e['query'][_0x91de('0x2e')]));_0x29db3a['attributes']=_0x29db3a['attributes'][_0x91de('0x2f')]?_0x29db3a[_0x91de('0x2d')]:_0x50121e[_0x91de('0x2c')];if(_0x2bca6e[_0x91de('0x29')][_0x91de('0x3b')]){_0x29db3a['include']=[{'all':!![]}];}_0x29db3a=_[_0x91de('0x36')]({},_0x29db3a,_0x2bca6e[_0x91de('0x39')]);return db[_0x91de('0x3a')][_0x91de('0x3e')](_0x29db3a)[_0x91de('0x1f')](handleEntityNotFound(_0x548a9f,null))[_0x91de('0x1f')](respondWithResult(_0x548a9f,null))[_0x91de('0x3f')](handleError(_0x548a9f,null));};exports[_0x91de('0x40')]=function(_0x5b2ab1,_0x4d78d3){return db[_0x91de('0x3a')][_0x91de('0x40')](_0x5b2ab1[_0x91de('0x41')],{})[_0x91de('0x1f')](respondWithResult(_0x4d78d3,0xc9))[_0x91de('0x3f')](handleError(_0x4d78d3,null));};exports[_0x91de('0x1e')]=function(_0x5c1162,_0xb257e){if(_0x5c1162[_0x91de('0x41')]['id']){delete _0x5c1162[_0x91de('0x41')]['id'];}return db[_0x91de('0x3a')]['find']({'where':{'id':_0x5c1162[_0x91de('0x42')]['id']}})[_0x91de('0x1f')](handleEntityNotFound(_0xb257e,null))[_0x91de('0x1f')](saveUpdates(_0x5c1162[_0x91de('0x41')],null))[_0x91de('0x1f')](respondWithResult(_0xb257e,null))[_0x91de('0x3f')](handleError(_0xb257e,null));};exports[_0x91de('0x43')]=function(_0x3540d4,_0x9c5a6c){return db['SquareDetailsReport'][_0x91de('0x3e')]({'where':{'id':_0x3540d4[_0x91de('0x42')]['id']}})[_0x91de('0x1f')](handleEntityNotFound(_0x9c5a6c,null))[_0x91de('0x1f')](removeEntity(_0x9c5a6c,null))[_0x91de('0x3f')](handleError(_0x9c5a6c,null));};exports[_0x91de('0x44')]=function(_0x1841ac,_0x3abd74){return db[_0x91de('0x3a')][_0x91de('0x44')]()[_0x91de('0x1f')](respondWithResult(_0x3abd74,null))[_0x91de('0x3f')](handleError(_0x3abd74,null));}; \ No newline at end of file +var _0x5de1=['includeAll','findAll','rows','catch','show','params','rawAttributes','keys','include','merge','options','find','create','update','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','end','sendStatus','stack','name','send','index','SquareDetailsReport','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x52ba19,_0x2a0ebc){var _0x1d8ce3=function(_0x4b1ce2){while(--_0x4b1ce2){_0x52ba19['push'](_0x52ba19['shift']());}};_0x1d8ce3(++_0x2a0ebc);}(_0x5de1,0x151));var _0x15de=function(_0x21b348,_0x478186){_0x21b348=_0x21b348-0x0;var _0x45e245=_0x5de1[_0x21b348];return _0x45e245;};'use strict';var emlformat=require(_0x15de('0x0'));var rimraf=require(_0x15de('0x1'));var zipdir=require(_0x15de('0x2'));var jsonpatch=require(_0x15de('0x3'));var rp=require(_0x15de('0x4'));var moment=require(_0x15de('0x5'));var BPromise=require(_0x15de('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x15de('0x7'));var ejs=require(_0x15de('0x8'));var fs=require('fs');var fs_extra=require(_0x15de('0x9'));var _=require(_0x15de('0xa'));var squel=require(_0x15de('0xb'));var crypto=require(_0x15de('0xc'));var jsforce=require(_0x15de('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x15de('0xe'));var Papa=require(_0x15de('0xf'));var Redis=require(_0x15de('0x10'));var authService=require(_0x15de('0x11'));var qs=require(_0x15de('0x12'));var as=require(_0x15de('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x15de('0x14'))(_0x15de('0x15'));var utils=require(_0x15de('0x16'));var config=require(_0x15de('0x17'));var licenseUtil=require(_0x15de('0x18'));var db=require(_0x15de('0x19'))['db'];function respondWithStatusCode(_0xa6dc79,_0x4ee0cc){_0x4ee0cc=_0x4ee0cc||0xcc;return function(_0x2d0c43){if(_0x2d0c43){return _0xa6dc79['sendStatus'](_0x4ee0cc);}return _0xa6dc79[_0x15de('0x1a')](_0x4ee0cc)['end']();};}function respondWithResult(_0x366976,_0x22ad02){_0x22ad02=_0x22ad02||0xc8;return function(_0x225643){if(_0x225643){return _0x366976['status'](_0x22ad02)[_0x15de('0x1b')](_0x225643);}};}function respondWithFilteredResult(_0x6c922d,_0xbbad6){return function(_0x5103b7){if(_0x5103b7){var _0x2890b5=typeof _0xbbad6['offset']===_0x15de('0x1c')&&typeof _0xbbad6[_0x15de('0x1d')]===_0x15de('0x1c');var _0x3c7be8=_0x5103b7[_0x15de('0x1e')];var _0x39c522=_0x2890b5?0x0:_0xbbad6[_0x15de('0x1f')];var _0x238347=_0x2890b5?_0x5103b7[_0x15de('0x1e')]:_0xbbad6['offset']+_0xbbad6['limit'];var _0x4fe020;if(_0x238347>=_0x3c7be8){_0x238347=_0x3c7be8;_0x4fe020=0xc8;}else{_0x4fe020=0xce;}_0x6c922d[_0x15de('0x1a')](_0x4fe020);return _0x6c922d[_0x15de('0x20')](_0x15de('0x21'),_0x39c522+'-'+_0x238347+'/'+_0x3c7be8)[_0x15de('0x1b')](_0x5103b7);}return null;};}function patchUpdates(_0x51e175){return function(_0x30bbc6){try{jsonpatch[_0x15de('0x22')](_0x30bbc6,_0x51e175,!![]);}catch(_0x2381ef){return BPromise[_0x15de('0x23')](_0x2381ef);}return _0x30bbc6[_0x15de('0x24')]();};}function saveUpdates(_0x3d4e8e,_0x5ba41f){return function(_0x445de1){if(_0x445de1){return _0x445de1['update'](_0x3d4e8e)[_0x15de('0x25')](function(_0x5b1648){return _0x5b1648;});}return null;};}function removeEntity(_0x34c975,_0x589023){return function(_0x5432ce){if(_0x5432ce){return _0x5432ce['destroy']()['then'](function(){_0x34c975[_0x15de('0x1a')](0xcc)[_0x15de('0x26')]();});}};}function handleEntityNotFound(_0x1ac0d3,_0x49554f){return function(_0x801b6b){if(!_0x801b6b){_0x1ac0d3[_0x15de('0x27')](0x194);}return _0x801b6b;};}function handleError(_0x22207c,_0x507f4a){_0x507f4a=_0x507f4a||0x1f4;return function(_0x4f384f){logger['error'](_0x4f384f[_0x15de('0x28')]);if(_0x4f384f[_0x15de('0x29')]){delete _0x4f384f[_0x15de('0x29')];}_0x22207c[_0x15de('0x1a')](_0x507f4a)[_0x15de('0x2a')](_0x4f384f);};}exports[_0x15de('0x2b')]=function(_0x279bdd,_0x1dd69b){var _0xaffeb8={},_0x5a6189={},_0x46ef82={'count':0x0,'rows':[]};var _0x436bd2=_['map'](db[_0x15de('0x2c')]['rawAttributes'],function(_0x23b20d){return{'name':_0x23b20d[_0x15de('0x2d')],'type':_0x23b20d[_0x15de('0x2e')][_0x15de('0x2f')]};});_0x5a6189[_0x15de('0x30')]=_[_0x15de('0x31')](_0x436bd2,_0x15de('0x29'));_0x5a6189[_0x15de('0x32')]=_['keys'](_0x279bdd[_0x15de('0x32')]);_0x5a6189[_0x15de('0x33')]=_[_0x15de('0x34')](_0x5a6189[_0x15de('0x30')],_0x5a6189['query']);_0xaffeb8[_0x15de('0x35')]=_['intersection'](_0x5a6189['model'],qs['fields'](_0x279bdd[_0x15de('0x32')][_0x15de('0x36')]));_0xaffeb8[_0x15de('0x35')]=_0xaffeb8[_0x15de('0x35')][_0x15de('0x37')]?_0xaffeb8[_0x15de('0x35')]:_0x5a6189[_0x15de('0x30')];if(!_0x279bdd['query'][_0x15de('0x38')](_0x15de('0x39'))){_0xaffeb8[_0x15de('0x1d')]=qs[_0x15de('0x1d')](_0x279bdd[_0x15de('0x32')]['limit']);_0xaffeb8[_0x15de('0x1f')]=qs[_0x15de('0x1f')](_0x279bdd[_0x15de('0x32')]['offset']);}_0xaffeb8[_0x15de('0x3a')]=qs[_0x15de('0x3b')](_0x279bdd['query'][_0x15de('0x3b')]);_0xaffeb8[_0x15de('0x3c')]=qs['filters'](_[_0x15de('0x3d')](_0x279bdd['query'],_0x5a6189[_0x15de('0x33')]),_0x436bd2);if(_0x279bdd['query'][_0x15de('0x3e')]){_0xaffeb8[_0x15de('0x3c')]=_['merge'](_0xaffeb8[_0x15de('0x3c')],{'$or':_[_0x15de('0x31')](_0x436bd2,function(_0x4a96fd){if(_0x4a96fd[_0x15de('0x2e')]!=='VIRTUAL'){var _0x4286cd={};_0x4286cd[_0x4a96fd[_0x15de('0x29')]]={'$like':'%'+_0x279bdd[_0x15de('0x32')]['filter']+'%'};return _0x4286cd;}})});}_0xaffeb8=_['merge']({},_0xaffeb8,_0x279bdd['options']);var _0x6eb547={'where':_0xaffeb8[_0x15de('0x3c')]};return db['SquareDetailsReport'][_0x15de('0x1e')](_0x6eb547)[_0x15de('0x25')](function(_0x22b6b6){_0x46ef82[_0x15de('0x1e')]=_0x22b6b6;if(_0x279bdd['query'][_0x15de('0x3f')]){_0xaffeb8['include']=[{'all':!![]}];}return db[_0x15de('0x2c')][_0x15de('0x40')](_0xaffeb8);})[_0x15de('0x25')](function(_0x7f5e01){_0x46ef82[_0x15de('0x41')]=_0x7f5e01;return _0x46ef82;})[_0x15de('0x25')](respondWithFilteredResult(_0x1dd69b,_0xaffeb8))[_0x15de('0x42')](handleError(_0x1dd69b,null));};exports[_0x15de('0x43')]=function(_0x43d19a,_0x144c6a){var _0xeb4903={'raw':!![],'where':{'id':_0x43d19a[_0x15de('0x44')]['id']}},_0x21806d={};_0x21806d['model']=_['keys'](db[_0x15de('0x2c')][_0x15de('0x45')]);_0x21806d['query']=_[_0x15de('0x46')](_0x43d19a[_0x15de('0x32')]);_0x21806d[_0x15de('0x33')]=_['intersection'](_0x21806d[_0x15de('0x30')],_0x21806d[_0x15de('0x32')]);_0xeb4903['attributes']=_[_0x15de('0x34')](_0x21806d['model'],qs['fields'](_0x43d19a[_0x15de('0x32')][_0x15de('0x36')]));_0xeb4903[_0x15de('0x35')]=_0xeb4903[_0x15de('0x35')]['length']?_0xeb4903[_0x15de('0x35')]:_0x21806d['model'];if(_0x43d19a['query'][_0x15de('0x3f')]){_0xeb4903[_0x15de('0x47')]=[{'all':!![]}];}_0xeb4903=_[_0x15de('0x48')]({},_0xeb4903,_0x43d19a[_0x15de('0x49')]);return db[_0x15de('0x2c')][_0x15de('0x4a')](_0xeb4903)['then'](handleEntityNotFound(_0x144c6a,null))[_0x15de('0x25')](respondWithResult(_0x144c6a,null))[_0x15de('0x42')](handleError(_0x144c6a,null));};exports[_0x15de('0x4b')]=function(_0x39320a,_0x5c5128){return db[_0x15de('0x2c')][_0x15de('0x4b')](_0x39320a['body'],{})[_0x15de('0x25')](respondWithResult(_0x5c5128,0xc9))[_0x15de('0x42')](handleError(_0x5c5128,null));};exports[_0x15de('0x4c')]=function(_0x412606,_0x1123d3){if(_0x412606[_0x15de('0x4d')]['id']){delete _0x412606[_0x15de('0x4d')]['id'];}return db[_0x15de('0x2c')][_0x15de('0x4a')]({'where':{'id':_0x412606[_0x15de('0x44')]['id']}})['then'](handleEntityNotFound(_0x1123d3,null))[_0x15de('0x25')](saveUpdates(_0x412606[_0x15de('0x4d')],null))[_0x15de('0x25')](respondWithResult(_0x1123d3,null))[_0x15de('0x42')](handleError(_0x1123d3,null));};exports[_0x15de('0x4e')]=function(_0x2fceaf,_0x9c75ee){return db[_0x15de('0x2c')][_0x15de('0x4a')]({'where':{'id':_0x2fceaf['params']['id']}})['then'](handleEntityNotFound(_0x9c75ee,null))[_0x15de('0x25')](removeEntity(_0x9c75ee,null))[_0x15de('0x42')](handleError(_0x9c75ee,null));};exports['describe']=function(_0x1c11cd,_0x244d4b){return db['SquareDetailsReport'][_0x15de('0x4f')]()[_0x15de('0x25')](respondWithResult(_0x244d4b,null))[_0x15de('0x42')](handleError(_0x244d4b,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 70a117a..712148e 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 _0x3527=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3527,0x171));var _0x7352=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0x3527[_0x4409e7];return _0x24c751;};'use strict';var _=require(_0x7352('0x0'));var util=require('util');var logger=require(_0x7352('0x1'))(_0x7352('0x2'));var moment=require('moment');var BPromise=require(_0x7352('0x3'));var rp=require(_0x7352('0x4'));var fs=require('fs');var path=require(_0x7352('0x5'));var rimraf=require(_0x7352('0x6'));var config=require(_0x7352('0x7'));var attributes=require(_0x7352('0x8'));module[_0x7352('0x9')]=function(_0x311bd6,_0x1b95c4){return _0x311bd6[_0x7352('0xa')](_0x7352('0xb'),attributes,{'tableName':_0x7352('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6c8=['exports','define','SquareDetailsReport','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3e8cae,_0x4cb96a){var _0x45c4d6=function(_0x4bf3a5){while(--_0x4bf3a5){_0x3e8cae['push'](_0x3e8cae['shift']());}};_0x45c4d6(++_0x4cb96a);}(_0xb6c8,0x14d));var _0x8b6c=function(_0x24d15c,_0x3018fc){_0x24d15c=_0x24d15c-0x0;var _0x20e557=_0xb6c8[_0x24d15c];return _0x20e557;};'use strict';var _=require(_0x8b6c('0x0'));var util=require(_0x8b6c('0x1'));var logger=require(_0x8b6c('0x2'))('api');var moment=require(_0x8b6c('0x3'));var BPromise=require('bluebird');var rp=require(_0x8b6c('0x4'));var fs=require('fs');var path=require(_0x8b6c('0x5'));var rimraf=require(_0x8b6c('0x6'));var config=require(_0x8b6c('0x7'));var attributes=require('./squareReportDetail.attributes');module[_0x8b6c('0x8')]=function(_0x20e1a8,_0x1b2cad){return _0x20e1a8[_0x8b6c('0x9')](_0x8b6c('0xa'),attributes,{'tableName':'report_square_details','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 bb18e7a..793232f 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 _0x84a0=['request','then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','SquareDetailsReport','create','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x84a0,0x66));var _0x084a=function(_0x282b44,_0x25c866){_0x282b44=_0x282b44-0x0;var _0x22b96e=_0x84a0[_0x282b44];return _0x22b96e;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var moment=require(_0x084a('0x2'));var BPromise=require(_0x084a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x084a('0x4'));var db=require(_0x084a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x084a('0x6'));var config=require(_0x084a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x084a('0x8')][_0x084a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e6810,_0x373d2,_0x2b30bc){return new BPromise(function(_0x58d419,_0x1051a9){return client[_0x084a('0xa')](_0x2e6810,_0x2b30bc)[_0x084a('0xb')](function(_0x2888e3){logger[_0x084a('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x373d2,'request\x20sent');logger[_0x084a('0xd')](_0x084a('0xe'),_0x373d2,_0x084a('0xf'),JSON[_0x084a('0x10')](_0x2888e3));if(_0x2888e3[_0x084a('0x11')]){if(_0x2888e3['error']['code']===0x1f4){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);return _0x1051a9(_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);}logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3['error'][_0x084a('0x13')]);return _0x58d419(_0x2888e3['error'][_0x084a('0x13')]);}else{logger[_0x084a('0xc')](_0x084a('0x12'),_0x373d2,_0x084a('0xf'));_0x58d419(_0x2888e3[_0x084a('0x14')]['message']);}})[_0x084a('0x15')](function(_0x4abd81){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x4abd81);_0x1051a9(_0x4abd81);});});}exports['CreateSquareDetailsReport']=function(_0xf2c333){var _0x32c729=this;return new Promise(function(_0x4134b9,_0x14bb19){return db[_0x084a('0x16')][_0x084a('0x17')](_0xf2c333[_0x084a('0x18')],{'raw':_0xf2c333[_0x084a('0x19')]?_0xf2c333[_0x084a('0x19')][_0x084a('0x1a')]===undefined?!![]:![]:!![]})[_0x084a('0xb')](function(_0x279e25){logger[_0x084a('0xc')](_0x084a('0x1b'),_0xf2c333);logger[_0x084a('0xd')]('CreateSquareDetailsReport',_0xf2c333,JSON[_0x084a('0x10')](_0x279e25));_0x4134b9(_0x279e25);})[_0x084a('0x15')](function(_0x41a90f){logger[_0x084a('0x11')](_0x084a('0x1b'),_0x41a90f['message'],_0xf2c333);_0x14bb19(_0x32c729[_0x084a('0x11')](0x1f4,_0x41a90f[_0x084a('0x13')]));});});}; \ No newline at end of file +var _0x056b=['catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','then','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1a6fd7,_0x11024f){var _0x139cbe=function(_0x38ecba){while(--_0x38ecba){_0x1a6fd7['push'](_0x1a6fd7['shift']());}};_0x139cbe(++_0x11024f);}(_0x056b,0xb6));var _0xb056=function(_0x14fe1a,_0x5bc7c8){_0x14fe1a=_0x14fe1a-0x0;var _0x540aa8=_0x056b[_0x14fe1a];return _0x540aa8;};'use strict';var _=require('lodash');var util=require(_0xb056('0x0'));var moment=require(_0xb056('0x1'));var BPromise=require(_0xb056('0x2'));var rs=require(_0xb056('0x3'));var fs=require('fs');var Redis=require(_0xb056('0x4'));var db=require(_0xb056('0x5'))['db'];var utils=require(_0xb056('0x6'));var logger=require(_0xb056('0x7'))(_0xb056('0x8'));var config=require(_0xb056('0x9'));var jayson=require(_0xb056('0xa'));var client=jayson['client'][_0xb056('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x314637,_0x3eae69,_0x3c9b89){return new BPromise(function(_0x80daf1,_0x6bf4c){return client['request'](_0x314637,_0x3c9b89)['then'](function(_0x37a86d){logger[_0xb056('0xc')](_0xb056('0xd'),_0x3eae69,_0xb056('0xe'));logger['debug'](_0xb056('0xf'),_0x3eae69,'request\x20sent',JSON[_0xb056('0x10')](_0x37a86d));if(_0x37a86d[_0xb056('0x11')]){if(_0x37a86d[_0xb056('0x11')][_0xb056('0x12')]===0x1f4){logger[_0xb056('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x3eae69,_0x37a86d['error'][_0xb056('0x13')]);return _0x6bf4c(_0x37a86d[_0xb056('0x11')]['message']);}logger[_0xb056('0x11')](_0xb056('0xd'),_0x3eae69,_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);return _0x80daf1(_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);}else{logger[_0xb056('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x3eae69,_0xb056('0xe'));_0x80daf1(_0x37a86d[_0xb056('0x14')][_0xb056('0x13')]);}})[_0xb056('0x15')](function(_0x5a4ef1){logger[_0xb056('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x3eae69,_0x5a4ef1);_0x6bf4c(_0x5a4ef1);});});}exports[_0xb056('0x16')]=function(_0x311eb9){var _0x48e140=this;return new Promise(function(_0x29c77e,_0x4c57e6){return db[_0xb056('0x17')][_0xb056('0x18')](_0x311eb9['body'],{'raw':_0x311eb9[_0xb056('0x19')]?_0x311eb9['options'][_0xb056('0x1a')]===undefined?!![]:![]:!![]})[_0xb056('0x1b')](function(_0x457b54){logger[_0xb056('0xc')]('CreateSquareDetailsReport',_0x311eb9);logger[_0xb056('0x1c')]('CreateSquareDetailsReport',_0x311eb9,JSON[_0xb056('0x10')](_0x457b54));_0x29c77e(_0x457b54);})['catch'](function(_0x324ce6){logger[_0xb056('0x11')](_0xb056('0x16'),_0x324ce6[_0xb056('0x13')],_0x311eb9);_0x4c57e6(_0x48e140[_0xb056('0x11')](0x1f4,_0x324ce6[_0xb056('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index f7cd394..309dff2 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 _0xc21f=['index','/process/:pid/kill','killProcess','exports','express','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0x541b2c,_0x34972e){var _0x42c517=function(_0x413982){while(--_0x413982){_0x541b2c['push'](_0x541b2c['shift']());}};_0x42c517(++_0x34972e);}(_0xc21f,0x94));var _0xfc21=function(_0x3a1b91,_0x57fc1d){_0x3a1b91=_0x3a1b91-0x0;var _0x4d03f2=_0xc21f[_0x3a1b91];return _0x4d03f2;};'use strict';var express=require(_0xfc21('0x0'));var router=express['Router']();var auth=require(_0xfc21('0x1'));var controller=require(_0xfc21('0x2'));router[_0xfc21('0x3')]('/',auth[_0xfc21('0x4')](),controller[_0xfc21('0x5')]);router['get'](_0xfc21('0x6'),auth[_0xfc21('0x4')](),controller[_0xfc21('0x7')]);module[_0xfc21('0x8')]=router; \ No newline at end of file +var _0xf706=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports','express'];(function(_0x412c14,_0x3ddf4d){var _0x4725d4=function(_0x44ae20){while(--_0x44ae20){_0x412c14['push'](_0x412c14['shift']());}};_0x4725d4(++_0x3ddf4d);}(_0xf706,0x1c1));var _0x6f70=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0xf706[_0x55821d];return _0x58ea8a;};'use strict';var express=require(_0x6f70('0x0'));var router=express[_0x6f70('0x1')]();var auth=require(_0x6f70('0x2'));var controller=require(_0x6f70('0x3'));router[_0x6f70('0x4')]('/',auth[_0x6f70('0x5')](),controller[_0x6f70('0x6')]);router[_0x6f70('0x4')](_0x6f70('0x7'),auth[_0x6f70('0x5')](),controller['killProcess']);module[_0x6f70('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index b24e8b1..40d0416 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 _0x6f93=['child_process','exec','../../config/logger','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','systeminformation'];(function(_0x4caad3,_0x11ed9e){var _0x379397=function(_0x2e5ef5){while(--_0x2e5ef5){_0x4caad3['push'](_0x4caad3['shift']());}};_0x379397(++_0x11ed9e);}(_0x6f93,0x1ca));var _0x36f9=function(_0x48e1d9,_0x4e9255){_0x48e1d9=_0x48e1d9-0x0;var _0x3f0e08=_0x6f93[_0x48e1d9];return _0x3f0e08;};'use strict';var info=require(_0x36f9('0x0'));var exec=require(_0x36f9('0x1'))[_0x36f9('0x2')];var logger=require(_0x36f9('0x3'))('api');var util=require(_0x36f9('0x4'));var BPromise=require('bluebird');var _=require(_0x36f9('0x5'));function handleError(_0x3adf88,_0x207fbf,_0x423f17){_0x207fbf=_0x207fbf||0x1f4;return function(_0x20586f){logger[_0x36f9('0x6')](_0x36f9('0x7'),_0x423f17,_0x207fbf,util[_0x36f9('0x8')](_0x20586f,{'showHidden':![],'depth':null}));delete _0x20586f[_0x36f9('0x9')];_0x3adf88[_0x36f9('0xa')](_0x207fbf)[_0x36f9('0xb')](_0x20586f);};}exports['index']=function(_0x56720c,_0x40cb5d){return info[_0x36f9('0xc')]()[_0x36f9('0xd')](function(_0x644bf3){return _0x40cb5d[_0x36f9('0xa')](0xc8)[_0x36f9('0xe')](_0x644bf3);})[_0x36f9('0xf')](function(_0x5a30aa){return _0x40cb5d[_0x36f9('0xa')](0x1f4)[_0x36f9('0xe')](_0x5a30aa);});};exports[_0x36f9('0x10')]=function(_0xb75666,_0x33d913){var _0x4c74bc=[_0x36f9('0x11')];return new BPromise(function(_0x1604e2,_0x1cec57){return exec(util[_0x36f9('0x12')](_0x36f9('0x13'),_0xb75666[_0x36f9('0x14')][_0x36f9('0x15')]),function(_0x326a64,_0x49f022,_0x4abdb3){if(_0x326a64){return _0x1cec57(_0x326a64);}return _0x1604e2(_0x49f022);});})[_0x36f9('0xd')](function(_0x301078){var _0xb8e46b=![];var _0x1aa255=_0x301078[_0x36f9('0x16')](/\n/);for(var _0x3e48c2=0x0,_0x534a45=_0x4c74bc['length'];_0x3e48c2<_0x534a45,_0xb8e46b===![];_0x3e48c2+=0x1){if(_0x301078[_0x36f9('0x17')](_0x4c74bc[_0x3e48c2])>=0x0){_0xb8e46b=!![];}}if(!_0xb8e46b){throw new Error(util[_0x36f9('0x12')](_0x36f9('0x18'),_0xb75666[_0x36f9('0x14')][_0x36f9('0x15')]));}process[_0x36f9('0x19')](_0xb75666[_0x36f9('0x14')]['pid'],_0x36f9('0x1a'));return _0x33d913[_0x36f9('0xa')](0xc8)['json']({'message':util[_0x36f9('0x12')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0xb75666[_0x36f9('0x14')][_0x36f9('0x15')])});})[_0x36f9('0xf')](handleError(_0x33d913,null,_0x36f9('0x10')));}; \ No newline at end of file +var _0x91a3=['split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','pid','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args'];(function(_0x3aa78a,_0x546fd7){var _0x3862c2=function(_0x58fea2){while(--_0x58fea2){_0x3aa78a['push'](_0x3aa78a['shift']());}};_0x3862c2(++_0x546fd7);}(_0x91a3,0x14c));var _0x391a=function(_0x492e1a,_0x2d6b1b){_0x492e1a=_0x492e1a-0x0;var _0x1a4b1b=_0x91a3[_0x492e1a];return _0x1a4b1b;};'use strict';var info=require(_0x391a('0x0'));var exec=require(_0x391a('0x1'))[_0x391a('0x2')];var logger=require(_0x391a('0x3'))('api');var util=require(_0x391a('0x4'));var BPromise=require(_0x391a('0x5'));var _=require(_0x391a('0x6'));function handleError(_0x3ed0d7,_0x571989,_0x3e1734){_0x571989=_0x571989||0x1f4;return function(_0x3b4630){logger['error'](_0x391a('0x7'),_0x3e1734,_0x571989,util[_0x391a('0x8')](_0x3b4630,{'showHidden':![],'depth':null}));delete _0x3b4630[_0x391a('0x9')];_0x3ed0d7[_0x391a('0xa')](_0x571989)[_0x391a('0xb')](_0x3b4630);};}exports[_0x391a('0xc')]=function(_0x21b609,_0x380dda){return info[_0x391a('0xd')]()['then'](function(_0x54a5e8){return _0x380dda[_0x391a('0xa')](0xc8)[_0x391a('0xe')](_0x54a5e8);})['catch'](function(_0x152aba){return _0x380dda[_0x391a('0xa')](0x1f4)[_0x391a('0xe')](_0x152aba);});};exports[_0x391a('0xf')]=function(_0xd1c9f8,_0x15add7){var _0x4bbf30=[_0x391a('0x10')];return new BPromise(function(_0xfc5947,_0x2de367){return exec(util[_0x391a('0x11')](_0x391a('0x12'),_0xd1c9f8['params']['pid']),function(_0x4db70e,_0x15c3e0,_0x169e79){if(_0x4db70e){return _0x2de367(_0x4db70e);}return _0xfc5947(_0x15c3e0);});})['then'](function(_0x1de154){var _0x37c290=![];var _0x6bc7f0=_0x1de154[_0x391a('0x13')](/\n/);for(var _0x299fd3=0x0,_0x5981a8=_0x4bbf30['length'];_0x299fd3<_0x5981a8,_0x37c290===![];_0x299fd3+=0x1){if(_0x1de154[_0x391a('0x14')](_0x4bbf30[_0x299fd3])>=0x0){_0x37c290=!![];}}if(!_0x37c290){throw new Error(util[_0x391a('0x11')](_0x391a('0x15'),_0xd1c9f8[_0x391a('0x16')][_0x391a('0x17')]));}process[_0x391a('0x18')](_0xd1c9f8[_0x391a('0x16')][_0x391a('0x17')],'SIGINT');return _0x15add7[_0x391a('0xa')](0xc8)[_0x391a('0xe')]({'message':util['format'](_0x391a('0x19'),_0xd1c9f8[_0x391a('0x16')][_0x391a('0x17')])});})[_0x391a('0x1a')](handleError(_0x15add7,null,_0x391a('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f5cbe31..fa4aed1 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 _0x1612=['util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','multer'];(function(_0x455168,_0x55f188){var _0xdec7f=function(_0x77600c){while(--_0x77600c){_0x455168['push'](_0x455168['shift']());}};_0xdec7f(++_0x55f188);}(_0x1612,0xcf));var _0x2161=function(_0x64163c,_0x3604b5){_0x64163c=_0x64163c-0x0;var _0x103c91=_0x1612[_0x64163c];return _0x103c91;};'use strict';var multer=require(_0x2161('0x0'));var util=require(_0x2161('0x1'));var path=require(_0x2161('0x2'));var timeout=require(_0x2161('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2161('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2161('0x5'));var config=require(_0x2161('0x6'));var controller=require('./tag.controller');router[_0x2161('0x7')]('/',auth[_0x2161('0x8')](),controller[_0x2161('0x9')]);router[_0x2161('0x7')](_0x2161('0xa'),auth[_0x2161('0x8')](),controller[_0x2161('0xb')]);router[_0x2161('0xc')]('/',auth[_0x2161('0x8')](),controller[_0x2161('0xd')]);router['put'](_0x2161('0xa'),auth[_0x2161('0x8')](),controller['update']);router[_0x2161('0xe')]('/:id',auth[_0x2161('0x8')](),controller[_0x2161('0xf')]);module['exports']=router; \ No newline at end of file +var _0xfe79=['../../components/interaction/service','./tag.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','util','path','express','fs-extra','../../components/auth/service'];(function(_0x430e72,_0x22b674){var _0x26cc2d=function(_0x2836ef){while(--_0x2836ef){_0x430e72['push'](_0x430e72['shift']());}};_0x26cc2d(++_0x22b674);}(_0xfe79,0x160));var _0x9fe7=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0xfe79[_0x5d1044];return _0x3cd90e;};'use strict';var multer=require('multer');var util=require(_0x9fe7('0x0'));var path=require(_0x9fe7('0x1'));var timeout=require('connect-timeout');var express=require(_0x9fe7('0x2'));var router=express['Router']();var fs_extra=require(_0x9fe7('0x3'));var auth=require(_0x9fe7('0x4'));var interaction=require(_0x9fe7('0x5'));var config=require('../../config/environment');var controller=require(_0x9fe7('0x6'));router[_0x9fe7('0x7')]('/',auth[_0x9fe7('0x8')](),controller['index']);router['get'](_0x9fe7('0x9'),auth[_0x9fe7('0x8')](),controller[_0x9fe7('0xa')]);router[_0x9fe7('0xb')]('/',auth[_0x9fe7('0x8')](),controller[_0x9fe7('0xc')]);router[_0x9fe7('0xd')](_0x9fe7('0x9'),auth[_0x9fe7('0x8')](),controller[_0x9fe7('0xe')]);router['delete'](_0x9fe7('0x9'),auth[_0x9fe7('0x8')](),controller[_0x9fe7('0xf')]);module[_0x9fe7('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index de02668..10c19e3 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 _0x4af8=['#0091EA','STRING'];(function(_0x57e048,_0x257729){var _0x1e89e8=function(_0x590ee4){while(--_0x590ee4){_0x57e048['push'](_0x57e048['shift']());}};_0x1e89e8(++_0x257729);}(_0x4af8,0x1ad));var _0x84af=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x4af8[_0x5416db];return _0x243e35;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x84af('0x0')],'defaultValue':_0x84af('0x1')},'description':{'type':Sequelize[_0x84af('0x0')]}}; \ No newline at end of file +var _0xea28=['exports','STRING','name','#0091EA','sequelize'];(function(_0x12322a,_0x194658){var _0x55bb93=function(_0x2f61e3){while(--_0x2f61e3){_0x12322a['push'](_0x12322a['shift']());}};_0x55bb93(++_0x194658);}(_0xea28,0x13a));var _0x8ea2=function(_0x449350,_0x360d0d){_0x449350=_0x449350-0x0;var _0xa6d9aa=_0xea28[_0x449350];return _0xa6d9aa;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'name':{'type':Sequelize[_0x8ea2('0x2')],'unique':_0x8ea2('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8ea2('0x2')],'defaultValue':_0x8ea2('0x4')},'description':{'type':Sequelize[_0x8ea2('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ff712c8..423c58f 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 _0x668b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','then','get','Tags','UserProfileResource','error','stack','name','send','index','Tag','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring'];(function(_0x18036e,_0x2e8a09){var _0x3d34ca=function(_0x49c0e1){while(--_0x49c0e1){_0x18036e['push'](_0x18036e['shift']());}};_0x3d34ca(++_0x2e8a09);}(_0x668b,0x140));var _0xb668=function(_0x575a38,_0x2e83d7){_0x575a38=_0x575a38-0x0;var _0x5a7bdd=_0x668b[_0x575a38];return _0x5a7bdd;};'use strict';var emlformat=require(_0xb668('0x0'));var rimraf=require(_0xb668('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb668('0x2'));var rp=require(_0xb668('0x3'));var moment=require('moment');var BPromise=require(_0xb668('0x4'));var Mustache=require('mustache');var util=require(_0xb668('0x5'));var path=require(_0xb668('0x6'));var sox=require(_0xb668('0x7'));var csv=require('to-csv');var ejs=require(_0xb668('0x8'));var fs=require('fs');var fs_extra=require(_0xb668('0x9'));var _=require(_0xb668('0xa'));var squel=require(_0xb668('0xb'));var crypto=require(_0xb668('0xc'));var jsforce=require(_0xb668('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb668('0xe'));var querystring=require(_0xb668('0xf'));var Papa=require(_0xb668('0x10'));var Redis=require(_0xb668('0x11'));var authService=require(_0xb668('0x12'));var qs=require(_0xb668('0x13'));var as=require(_0xb668('0x14'));var hardwareService=require(_0xb668('0x15'));var logger=require('../../config/logger')(_0xb668('0x16'));var utils=require(_0xb668('0x17'));var config=require(_0xb668('0x18'));var licenseUtil=require(_0xb668('0x19'));var db=require(_0xb668('0x1a'))['db'];function respondWithStatusCode(_0x167057,_0x1d111a){_0x1d111a=_0x1d111a||0xcc;return function(_0x10ed24){if(_0x10ed24){return _0x167057[_0xb668('0x1b')](_0x1d111a);}return _0x167057[_0xb668('0x1c')](_0x1d111a)[_0xb668('0x1d')]();};}function respondWithResult(_0x3b7556,_0x3aed25){_0x3aed25=_0x3aed25||0xc8;return function(_0xd0450f){if(_0xd0450f){return _0x3b7556[_0xb668('0x1c')](_0x3aed25)[_0xb668('0x1e')](_0xd0450f);}};}function respondWithFilteredResult(_0x1ca6e7,_0x222cad){return function(_0x4fa32a){if(_0x4fa32a){var _0x4a755b=typeof _0x222cad[_0xb668('0x1f')]===_0xb668('0x20')&&typeof _0x222cad['limit']===_0xb668('0x20');var _0x567ad7=_0x4fa32a[_0xb668('0x21')];var _0x89fe72=_0x4a755b?0x0:_0x222cad['offset'];var _0x38595d=_0x4a755b?_0x4fa32a[_0xb668('0x21')]:_0x222cad['offset']+_0x222cad[_0xb668('0x22')];var _0x5b31ab;if(_0x38595d>=_0x567ad7){_0x38595d=_0x567ad7;_0x5b31ab=0xc8;}else{_0x5b31ab=0xce;}_0x1ca6e7[_0xb668('0x1c')](_0x5b31ab);return _0x1ca6e7[_0xb668('0x23')](_0xb668('0x24'),_0x89fe72+'-'+_0x38595d+'/'+_0x567ad7)[_0xb668('0x1e')](_0x4fa32a);}return null;};}function patchUpdates(_0x5d33ae){return function(_0x2b7f96){try{jsonpatch[_0xb668('0x25')](_0x2b7f96,_0x5d33ae,!![]);}catch(_0x25e5be){return BPromise['reject'](_0x25e5be);}return _0x2b7f96['save']();};}function saveUpdates(_0x43a70b,_0x1e5620){return function(_0x517eee){if(_0x517eee){return _0x517eee[_0xb668('0x26')](_0x43a70b)['then'](function(_0x2f1394){return _0x2f1394;});}return null;};}function removeEntity(_0x4bd365,_0x3f4745){return function(_0x1e1c94){if(_0x1e1c94){return _0x1e1c94[_0xb668('0x27')]()[_0xb668('0x28')](function(){var _0x2a5b3d=_0x1e1c94[_0xb668('0x29')]({'plain':!![]});var _0x4d4bf8=_0xb668('0x2a');return db[_0xb668('0x2b')][_0xb668('0x27')]({'where':{'type':_0x4d4bf8,'resourceId':_0x2a5b3d['id']}})['then'](function(){return _0x1e1c94;});})['then'](function(){_0x4bd365[_0xb668('0x1c')](0xcc)[_0xb668('0x1d')]();});}};}function handleEntityNotFound(_0x30b965,_0x5a67e9){return function(_0x3a2543){if(!_0x3a2543){_0x30b965[_0xb668('0x1b')](0x194);}return _0x3a2543;};}function handleError(_0x1616e5,_0x4c78a0){_0x4c78a0=_0x4c78a0||0x1f4;return function(_0x5709e2){logger[_0xb668('0x2c')](_0x5709e2[_0xb668('0x2d')]);if(_0x5709e2['name']){delete _0x5709e2[_0xb668('0x2e')];}_0x1616e5[_0xb668('0x1c')](_0x4c78a0)[_0xb668('0x2f')](_0x5709e2);};}exports[_0xb668('0x30')]=function(_0x256a8,_0x5f36b5){var _0x138ee5={},_0x3bd27c={},_0x5dfa2c={'count':0x0,'rows':[]};var _0x28bcdd=_['map'](db[_0xb668('0x31')][_0xb668('0x32')],function(_0x467fea){return{'name':_0x467fea[_0xb668('0x33')],'type':_0x467fea[_0xb668('0x34')][_0xb668('0x35')]};});_0x3bd27c[_0xb668('0x36')]=_[_0xb668('0x37')](_0x28bcdd,_0xb668('0x2e'));_0x3bd27c['query']=_[_0xb668('0x38')](_0x256a8[_0xb668('0x39')]);_0x3bd27c[_0xb668('0x3a')]=_['intersection'](_0x3bd27c[_0xb668('0x36')],_0x3bd27c[_0xb668('0x39')]);_0x138ee5[_0xb668('0x3b')]=_[_0xb668('0x3c')](_0x3bd27c['model'],qs[_0xb668('0x3d')](_0x256a8[_0xb668('0x39')][_0xb668('0x3d')]));_0x138ee5[_0xb668('0x3b')]=_0x138ee5[_0xb668('0x3b')][_0xb668('0x3e')]?_0x138ee5[_0xb668('0x3b')]:_0x3bd27c['model'];if(!_0x256a8[_0xb668('0x39')][_0xb668('0x3f')]('nolimit')){_0x138ee5[_0xb668('0x22')]=qs['limit'](_0x256a8['query'][_0xb668('0x22')]);_0x138ee5[_0xb668('0x1f')]=qs['offset'](_0x256a8[_0xb668('0x39')]['offset']);}_0x138ee5[_0xb668('0x40')]=qs['sort'](_0x256a8['query'][_0xb668('0x41')]);_0x138ee5[_0xb668('0x42')]=qs['filters'](_['pick'](_0x256a8[_0xb668('0x39')],_0x3bd27c[_0xb668('0x3a')]),_0x28bcdd);if(_0x256a8[_0xb668('0x39')][_0xb668('0x43')]){_0x138ee5[_0xb668('0x42')]=_['merge'](_0x138ee5['where'],{'$or':_[_0xb668('0x37')](_0x28bcdd,function(_0x43e98c){if(_0x43e98c[_0xb668('0x34')]!==_0xb668('0x44')){var _0x41aeca={};_0x41aeca[_0x43e98c[_0xb668('0x2e')]]={'$like':'%'+_0x256a8['query']['filter']+'%'};return _0x41aeca;}})});}_0x138ee5=_[_0xb668('0x45')]({},_0x138ee5,_0x256a8[_0xb668('0x46')]);var _0x89956d={'where':_0x138ee5[_0xb668('0x42')]};return db[_0xb668('0x31')]['count'](_0x89956d)[_0xb668('0x28')](function(_0x429b14){_0x5dfa2c['count']=_0x429b14;if(_0x256a8[_0xb668('0x39')][_0xb668('0x47')]){_0x138ee5[_0xb668('0x48')]=[{'all':!![]}];}return db[_0xb668('0x31')]['findAll'](_0x138ee5);})['then'](function(_0x4b7192){_0x5dfa2c[_0xb668('0x49')]=_0x4b7192;return _0x5dfa2c;})['then'](respondWithFilteredResult(_0x5f36b5,_0x138ee5))['catch'](handleError(_0x5f36b5,null));};exports['show']=function(_0x50ffe0,_0x467ac9){var _0x4874a8={'raw':!![],'where':{'id':_0x50ffe0[_0xb668('0x4a')]['id']}},_0x14b269={};_0x14b269[_0xb668('0x36')]=_[_0xb668('0x38')](db[_0xb668('0x31')]['rawAttributes']);_0x14b269[_0xb668('0x39')]=_[_0xb668('0x38')](_0x50ffe0[_0xb668('0x39')]);_0x14b269[_0xb668('0x3a')]=_[_0xb668('0x3c')](_0x14b269[_0xb668('0x36')],_0x14b269[_0xb668('0x39')]);_0x4874a8[_0xb668('0x3b')]=_[_0xb668('0x3c')](_0x14b269[_0xb668('0x36')],qs[_0xb668('0x3d')](_0x50ffe0['query'][_0xb668('0x3d')]));_0x4874a8[_0xb668('0x3b')]=_0x4874a8[_0xb668('0x3b')]['length']?_0x4874a8['attributes']:_0x14b269[_0xb668('0x36')];if(_0x50ffe0['query'][_0xb668('0x47')]){_0x4874a8['include']=[{'all':!![]}];}_0x4874a8=_['merge']({},_0x4874a8,_0x50ffe0['options']);return db[_0xb668('0x31')][_0xb668('0x4b')](_0x4874a8)['then'](handleEntityNotFound(_0x467ac9,null))[_0xb668('0x28')](respondWithResult(_0x467ac9,null))[_0xb668('0x4c')](handleError(_0x467ac9,null));};exports[_0xb668('0x4d')]=function(_0x1b649f,_0x16d06f){return db[_0xb668('0x31')][_0xb668('0x4d')](_0x1b649f[_0xb668('0x4e')],{})[_0xb668('0x28')](function(_0x4065f7){var _0x4e0628=_0x1b649f[_0xb668('0x4f')][_0xb668('0x29')]({'plain':!![]});if(!_0x4e0628)throw new Error(_0xb668('0x50'));if(_0x4e0628[_0xb668('0x51')]===_0xb668('0x4f')){var _0x3da9ba=_0x4065f7[_0xb668('0x29')]({'plain':!![]});var _0x1bff79=_0xb668('0x2a');return db['UserProfileSection'][_0xb668('0x4b')]({'where':{'name':_0x1bff79,'userProfileId':_0x4e0628[_0xb668('0x52')]},'raw':!![]})[_0xb668('0x28')](function(_0x4c9eab){if(_0x4c9eab&&_0x4c9eab['autoAssociation']===0x0){return db[_0xb668('0x2b')][_0xb668('0x4d')]({'name':_0x3da9ba[_0xb668('0x2e')],'resourceId':_0x3da9ba['id'],'type':_0x4c9eab['name'],'sectionId':_0x4c9eab['id']},{})[_0xb668('0x28')](function(){return _0x4065f7;});}else{return _0x4065f7;}})['catch'](function(_0x51a5d3){logger[_0xb668('0x2c')](_0xb668('0x53'),_0x51a5d3);throw _0x51a5d3;});}return _0x4065f7;})[_0xb668('0x28')](respondWithResult(_0x16d06f,0xc9))[_0xb668('0x4c')](handleError(_0x16d06f,null));};exports[_0xb668('0x26')]=function(_0x42b306,_0x40f9a0){if(_0x42b306[_0xb668('0x4e')]['id']){delete _0x42b306[_0xb668('0x4e')]['id'];}return db[_0xb668('0x31')][_0xb668('0x4b')]({'where':{'id':_0x42b306[_0xb668('0x4a')]['id']}})[_0xb668('0x28')](handleEntityNotFound(_0x40f9a0,null))[_0xb668('0x28')](saveUpdates(_0x42b306[_0xb668('0x4e')],null))[_0xb668('0x28')](respondWithResult(_0x40f9a0,null))[_0xb668('0x4c')](handleError(_0x40f9a0,null));};exports[_0xb668('0x27')]=function(_0x414660,_0x3b4fd5){return db[_0xb668('0x31')][_0xb668('0x4b')]({'where':{'id':_0x414660[_0xb668('0x4a')]['id']}})[_0xb668('0x28')](handleEntityNotFound(_0x3b4fd5,null))[_0xb668('0x28')](removeEntity(_0x3b4fd5,null))[_0xb668('0x4c')](handleError(_0x3b4fd5,null));}; \ No newline at end of file +var _0x4fdb=['request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','catch','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x584bd4,_0x45a25c){var _0x3fe6c4=function(_0x470e06){while(--_0x470e06){_0x584bd4['push'](_0x584bd4['shift']());}};_0x3fe6c4(++_0x45a25c);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x470476,_0x65b2b1){_0x470476=_0x470476-0x0;var _0x287c11=_0x4fdb[_0x470476];return _0x287c11;};'use strict';var emlformat=require(_0xb4fd('0x0'));var rimraf=require(_0xb4fd('0x1'));var zipdir=require(_0xb4fd('0x2'));var jsonpatch=require(_0xb4fd('0x3'));var rp=require(_0xb4fd('0x4'));var moment=require(_0xb4fd('0x5'));var BPromise=require(_0xb4fd('0x6'));var Mustache=require(_0xb4fd('0x7'));var util=require(_0xb4fd('0x8'));var path=require('path');var sox=require(_0xb4fd('0x9'));var csv=require('to-csv');var ejs=require(_0xb4fd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb4fd('0xb'));var crypto=require(_0xb4fd('0xc'));var jsforce=require(_0xb4fd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb4fd('0xe'));var Papa=require(_0xb4fd('0xf'));var Redis=require(_0xb4fd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb4fd('0x11'));var as=require(_0xb4fd('0x12'));var hardwareService=require(_0xb4fd('0x13'));var logger=require(_0xb4fd('0x14'))(_0xb4fd('0x15'));var utils=require('../../config/utils');var config=require(_0xb4fd('0x16'));var licenseUtil=require(_0xb4fd('0x17'));var db=require(_0xb4fd('0x18'))['db'];function respondWithStatusCode(_0x120c2e,_0x5ba7e1){_0x5ba7e1=_0x5ba7e1||0xcc;return function(_0x38173d){if(_0x38173d){return _0x120c2e[_0xb4fd('0x19')](_0x5ba7e1);}return _0x120c2e[_0xb4fd('0x1a')](_0x5ba7e1)['end']();};}function respondWithResult(_0x399756,_0x1234d7){_0x1234d7=_0x1234d7||0xc8;return function(_0xc35d8d){if(_0xc35d8d){return _0x399756[_0xb4fd('0x1a')](_0x1234d7)[_0xb4fd('0x1b')](_0xc35d8d);}};}function respondWithFilteredResult(_0x37801f,_0x3a0872){return function(_0x47e288){if(_0x47e288){var _0x2076d5=typeof _0x3a0872[_0xb4fd('0x1c')]===_0xb4fd('0x1d')&&typeof _0x3a0872[_0xb4fd('0x1e')]===_0xb4fd('0x1d');var _0x137e51=_0x47e288[_0xb4fd('0x1f')];var _0x44f0f0=_0x2076d5?0x0:_0x3a0872[_0xb4fd('0x1c')];var _0x233044=_0x2076d5?_0x47e288[_0xb4fd('0x1f')]:_0x3a0872['offset']+_0x3a0872['limit'];var _0x504e80;if(_0x233044>=_0x137e51){_0x233044=_0x137e51;_0x504e80=0xc8;}else{_0x504e80=0xce;}_0x37801f['status'](_0x504e80);return _0x37801f[_0xb4fd('0x20')](_0xb4fd('0x21'),_0x44f0f0+'-'+_0x233044+'/'+_0x137e51)[_0xb4fd('0x1b')](_0x47e288);}return null;};}function patchUpdates(_0x1392c4){return function(_0x458133){try{jsonpatch[_0xb4fd('0x22')](_0x458133,_0x1392c4,!![]);}catch(_0xedff2f){return BPromise['reject'](_0xedff2f);}return _0x458133['save']();};}function saveUpdates(_0x216307,_0x25bb7d){return function(_0x157fc2){if(_0x157fc2){return _0x157fc2['update'](_0x216307)[_0xb4fd('0x23')](function(_0x49d42c){return _0x49d42c;});}return null;};}function removeEntity(_0x46cba4,_0x4f5032){return function(_0x2a9c8c){if(_0x2a9c8c){return _0x2a9c8c[_0xb4fd('0x24')]()[_0xb4fd('0x23')](function(){var _0x261eda=_0x2a9c8c[_0xb4fd('0x25')]({'plain':!![]});var _0x456f35=_0xb4fd('0x26');return db[_0xb4fd('0x27')]['destroy']({'where':{'type':_0x456f35,'resourceId':_0x261eda['id']}})['then'](function(){return _0x2a9c8c;});})['then'](function(){_0x46cba4[_0xb4fd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3617b2,_0x5e9d2b){return function(_0x5738c2){if(!_0x5738c2){_0x3617b2[_0xb4fd('0x19')](0x194);}return _0x5738c2;};}function handleError(_0x7c5313,_0xda5ea8){_0xda5ea8=_0xda5ea8||0x1f4;return function(_0x4a057d){logger[_0xb4fd('0x28')](_0x4a057d[_0xb4fd('0x29')]);if(_0x4a057d[_0xb4fd('0x2a')]){delete _0x4a057d[_0xb4fd('0x2a')];}_0x7c5313['status'](_0xda5ea8)[_0xb4fd('0x2b')](_0x4a057d);};}exports[_0xb4fd('0x2c')]=function(_0x4836a0,_0x3e5060){var _0x421c89={},_0xbe7d2c={},_0x597874={'count':0x0,'rows':[]};var _0xe73e10=_[_0xb4fd('0x2d')](db[_0xb4fd('0x2e')]['rawAttributes'],function(_0x55eed3){return{'name':_0x55eed3['fieldName'],'type':_0x55eed3['type'][_0xb4fd('0x2f')]};});_0xbe7d2c[_0xb4fd('0x30')]=_[_0xb4fd('0x2d')](_0xe73e10,_0xb4fd('0x2a'));_0xbe7d2c[_0xb4fd('0x31')]=_[_0xb4fd('0x32')](_0x4836a0[_0xb4fd('0x31')]);_0xbe7d2c[_0xb4fd('0x33')]=_[_0xb4fd('0x34')](_0xbe7d2c[_0xb4fd('0x30')],_0xbe7d2c[_0xb4fd('0x31')]);_0x421c89[_0xb4fd('0x35')]=_[_0xb4fd('0x34')](_0xbe7d2c[_0xb4fd('0x30')],qs[_0xb4fd('0x36')](_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x36')]));_0x421c89[_0xb4fd('0x35')]=_0x421c89['attributes']['length']?_0x421c89[_0xb4fd('0x35')]:_0xbe7d2c[_0xb4fd('0x30')];if(!_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x37')](_0xb4fd('0x38'))){_0x421c89['limit']=qs[_0xb4fd('0x1e')](_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x1e')]);_0x421c89[_0xb4fd('0x1c')]=qs[_0xb4fd('0x1c')](_0x4836a0['query'][_0xb4fd('0x1c')]);}_0x421c89['order']=qs[_0xb4fd('0x39')](_0x4836a0[_0xb4fd('0x31')]['sort']);_0x421c89['where']=qs[_0xb4fd('0x33')](_[_0xb4fd('0x3a')](_0x4836a0[_0xb4fd('0x31')],_0xbe7d2c[_0xb4fd('0x33')]),_0xe73e10);if(_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x3b')]){_0x421c89['where']=_[_0xb4fd('0x3c')](_0x421c89[_0xb4fd('0x3d')],{'$or':_['map'](_0xe73e10,function(_0x16d848){if(_0x16d848[_0xb4fd('0x3e')]!==_0xb4fd('0x3f')){var _0x39e607={};_0x39e607[_0x16d848['name']]={'$like':'%'+_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x3b')]+'%'};return _0x39e607;}})});}_0x421c89=_[_0xb4fd('0x3c')]({},_0x421c89,_0x4836a0[_0xb4fd('0x40')]);var _0xcbd37={'where':_0x421c89[_0xb4fd('0x3d')]};return db['Tag'][_0xb4fd('0x1f')](_0xcbd37)[_0xb4fd('0x23')](function(_0x5e11c0){_0x597874[_0xb4fd('0x1f')]=_0x5e11c0;if(_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x41')]){_0x421c89[_0xb4fd('0x42')]=[{'all':!![]}];}return db[_0xb4fd('0x2e')]['findAll'](_0x421c89);})[_0xb4fd('0x23')](function(_0x661f32){_0x597874[_0xb4fd('0x43')]=_0x661f32;return _0x597874;})['then'](respondWithFilteredResult(_0x3e5060,_0x421c89))[_0xb4fd('0x44')](handleError(_0x3e5060,null));};exports['show']=function(_0x3c1ffa,_0x3d5177){var _0x4d2c7c={'raw':!![],'where':{'id':_0x3c1ffa['params']['id']}},_0x563366={};_0x563366[_0xb4fd('0x30')]=_[_0xb4fd('0x32')](db[_0xb4fd('0x2e')]['rawAttributes']);_0x563366[_0xb4fd('0x31')]=_[_0xb4fd('0x32')](_0x3c1ffa[_0xb4fd('0x31')]);_0x563366[_0xb4fd('0x33')]=_[_0xb4fd('0x34')](_0x563366[_0xb4fd('0x30')],_0x563366[_0xb4fd('0x31')]);_0x4d2c7c['attributes']=_['intersection'](_0x563366[_0xb4fd('0x30')],qs[_0xb4fd('0x36')](_0x3c1ffa[_0xb4fd('0x31')][_0xb4fd('0x36')]));_0x4d2c7c['attributes']=_0x4d2c7c[_0xb4fd('0x35')]['length']?_0x4d2c7c['attributes']:_0x563366[_0xb4fd('0x30')];if(_0x3c1ffa[_0xb4fd('0x31')]['includeAll']){_0x4d2c7c[_0xb4fd('0x42')]=[{'all':!![]}];}_0x4d2c7c=_[_0xb4fd('0x3c')]({},_0x4d2c7c,_0x3c1ffa['options']);return db[_0xb4fd('0x2e')][_0xb4fd('0x45')](_0x4d2c7c)[_0xb4fd('0x23')](handleEntityNotFound(_0x3d5177,null))['then'](respondWithResult(_0x3d5177,null))['catch'](handleError(_0x3d5177,null));};exports[_0xb4fd('0x46')]=function(_0x1b5f2d,_0x17fbc7){return db[_0xb4fd('0x2e')]['create'](_0x1b5f2d[_0xb4fd('0x47')],{})[_0xb4fd('0x23')](function(_0x4f542b){var _0x126225=_0x1b5f2d[_0xb4fd('0x48')][_0xb4fd('0x25')]({'plain':!![]});if(!_0x126225)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x126225[_0xb4fd('0x49')]===_0xb4fd('0x48')){var _0x4ff60b=_0x4f542b[_0xb4fd('0x25')]({'plain':!![]});var _0x4de371='Tags';return db[_0xb4fd('0x4a')][_0xb4fd('0x45')]({'where':{'name':_0x4de371,'userProfileId':_0x126225[_0xb4fd('0x4b')]},'raw':!![]})[_0xb4fd('0x23')](function(_0x23c2a7){if(_0x23c2a7&&_0x23c2a7[_0xb4fd('0x4c')]===0x0){return db[_0xb4fd('0x27')][_0xb4fd('0x46')]({'name':_0x4ff60b[_0xb4fd('0x2a')],'resourceId':_0x4ff60b['id'],'type':_0x23c2a7[_0xb4fd('0x2a')],'sectionId':_0x23c2a7['id']},{})[_0xb4fd('0x23')](function(){return _0x4f542b;});}else{return _0x4f542b;}})[_0xb4fd('0x44')](function(_0x106196){logger[_0xb4fd('0x28')](_0xb4fd('0x4d'),_0x106196);throw _0x106196;});}return _0x4f542b;})['then'](respondWithResult(_0x17fbc7,0xc9))['catch'](handleError(_0x17fbc7,null));};exports[_0xb4fd('0x4e')]=function(_0x7c85e8,_0x39b994){if(_0x7c85e8[_0xb4fd('0x47')]['id']){delete _0x7c85e8[_0xb4fd('0x47')]['id'];}return db['Tag']['find']({'where':{'id':_0x7c85e8[_0xb4fd('0x4f')]['id']}})[_0xb4fd('0x23')](handleEntityNotFound(_0x39b994,null))['then'](saveUpdates(_0x7c85e8['body'],null))['then'](respondWithResult(_0x39b994,null))[_0xb4fd('0x44')](handleError(_0x39b994,null));};exports[_0xb4fd('0x24')]=function(_0x1d18a4,_0xfdc372){return db['Tag']['find']({'where':{'id':_0x1d18a4[_0xb4fd('0x4f')]['id']}})[_0xb4fd('0x23')](handleEntityNotFound(_0xfdc372,null))[_0xb4fd('0x23')](removeEntity(_0xfdc372,null))['catch'](handleError(_0xfdc372,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index d65ad9a..f1ceefd 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 _0x5e0e=['../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dbe46,_0x5ea976){var _0x222e45=function(_0x2989ab){while(--_0x2989ab){_0x3dbe46['push'](_0x3dbe46['shift']());}};_0x222e45(++_0x5ea976);}(_0x5e0e,0x19c));var _0xe5e0=function(_0x4828b1,_0x5c8cf3){_0x4828b1=_0x4828b1-0x0;var _0x1fec1b=_0x5e0e[_0x4828b1];return _0x1fec1b;};'use strict';var _=require('lodash');var util=require(_0xe5e0('0x0'));var logger=require(_0xe5e0('0x1'))(_0xe5e0('0x2'));var moment=require(_0xe5e0('0x3'));var BPromise=require(_0xe5e0('0x4'));var rp=require(_0xe5e0('0x5'));var fs=require('fs');var path=require(_0xe5e0('0x6'));var rimraf=require(_0xe5e0('0x7'));var config=require(_0xe5e0('0x8'));var attributes=require(_0xe5e0('0x9'));module[_0xe5e0('0xa')]=function(_0x245c2c,_0x1765a8){return _0x245c2c[_0xe5e0('0xb')](_0xe5e0('0xc'),attributes,{'tableName':_0xe5e0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35eb=['tools_tags','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x13f5ac,_0x303066){var _0x163d97=function(_0x1c2c3e){while(--_0x1c2c3e){_0x13f5ac['push'](_0x13f5ac['shift']());}};_0x163d97(++_0x303066);}(_0x35eb,0x15d));var _0xb35e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x35eb[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xb35e('0x0'));var util=require('util');var logger=require(_0xb35e('0x1'))('api');var moment=require(_0xb35e('0x2'));var BPromise=require(_0xb35e('0x3'));var rp=require(_0xb35e('0x4'));var fs=require('fs');var path=require(_0xb35e('0x5'));var rimraf=require(_0xb35e('0x6'));var config=require(_0xb35e('0x7'));var attributes=require(_0xb35e('0x8'));module[_0xb35e('0x9')]=function(_0x115749,_0x558a8d){return _0x115749[_0xb35e('0xa')]('Tag',attributes,{'tableName':_0xb35e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 31b3dfd..9c1e36d 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 _0xe14d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2d14a4,_0x4a2bcc){var _0x2c5a29=function(_0x36fcf8){while(--_0x36fcf8){_0x2d14a4['push'](_0x2d14a4['shift']());}};_0x2c5a29(++_0x4a2bcc);}(_0xe14d,0x1ee));var _0xde14=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xe14d[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('Tag,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file +var _0x7a59=['debug','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x7a59,0x16e));var _0x97a5=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x7a59[_0x43a37c];return _0x5d1d40;};'use strict';var _=require(_0x97a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x97a5('0x1'));var rs=require(_0x97a5('0x2'));var fs=require('fs');var Redis=require(_0x97a5('0x3'));var db=require(_0x97a5('0x4'))['db'];var utils=require(_0x97a5('0x5'));var logger=require('../../config/logger')(_0x97a5('0x6'));var config=require(_0x97a5('0x7'));var jayson=require(_0x97a5('0x8'));var client=jayson['client'][_0x97a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52d32f,_0x2663b9,_0x2c0efa){return new BPromise(function(_0x27e8a6,_0x156789){return client[_0x97a5('0xa')](_0x52d32f,_0x2c0efa)['then'](function(_0x4f34e8){logger[_0x97a5('0xb')](_0x97a5('0xc'),_0x2663b9,_0x97a5('0xd'));logger[_0x97a5('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x2663b9,'request\x20sent',JSON[_0x97a5('0xf')](_0x4f34e8));if(_0x4f34e8[_0x97a5('0x10')]){if(_0x4f34e8[_0x97a5('0x10')]['code']===0x1f4){logger[_0x97a5('0x10')](_0x97a5('0xc'),_0x2663b9,_0x4f34e8['error']['message']);return _0x156789(_0x4f34e8[_0x97a5('0x10')][_0x97a5('0x11')]);}logger['error']('Tag,\x20%s,\x20%s',_0x2663b9,_0x4f34e8['error']['message']);return _0x27e8a6(_0x4f34e8[_0x97a5('0x10')][_0x97a5('0x11')]);}else{logger[_0x97a5('0xb')]('Tag,\x20%s,\x20%s',_0x2663b9,_0x97a5('0xd'));_0x27e8a6(_0x4f34e8[_0x97a5('0x12')]['message']);}})[_0x97a5('0x13')](function(_0x5ee8ca){logger[_0x97a5('0x10')]('Tag,\x20%s,\x20%s',_0x2663b9,_0x5ee8ca);_0x156789(_0x5ee8ca);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 8f39dc2..9f9ac9d 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 e04710a..4b9cfbd 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 _0xe706=['STRING','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe706,0xa3));var _0x6e70=function(_0x1a8207,_0x576621){_0x1a8207=_0x1a8207-0x0;var _0x4bc774=_0xe706[_0x1a8207];return _0x4bc774;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xb7e7,0x121));var _0x7b7e=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xb7e7[_0x17928f];return _0x500b63;};'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 95d1282..22c1702 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 _0xfda4=['Fax','Whatsapp','through','QueueId','penalty','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','format','SIP/%s','TeamVoiceQueue','all','removeAgents','Chat','Openchannel','transaction','Queue:remove','getAgents','User','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','intersection','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','destroy','sequelize','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','isValidChannel','add','ids','Voice','Mail','Sms'];(function(_0x7c48ad,_0x23c276){var _0x9a8663=function(_0x5689fa){while(--_0x5689fa){_0x7c48ad['push'](_0x7c48ad['shift']());}};_0x9a8663(++_0x23c276);}(_0xfda4,0x13a));var _0x4fda=function(_0xf8053,_0x4b5401){_0xf8053=_0xf8053-0x0;var _0x2fe82f=_0xfda4[_0xf8053];return _0x2fe82f;};'use strict';var emlformat=require(_0x4fda('0x0'));var rimraf=require(_0x4fda('0x1'));var zipdir=require(_0x4fda('0x2'));var jsonpatch=require(_0x4fda('0x3'));var rp=require('request-promise');var moment=require(_0x4fda('0x4'));var BPromise=require(_0x4fda('0x5'));var Mustache=require('mustache');var util=require(_0x4fda('0x6'));var path=require(_0x4fda('0x7'));var sox=require(_0x4fda('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4fda('0x9'));var crypto=require(_0x4fda('0xa'));var jsforce=require(_0x4fda('0xb'));var deskjs=require(_0x4fda('0xc'));var toCsv=require(_0x4fda('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4fda('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4fda('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4fda('0x10'));var logger=require('../../config/logger')(_0x4fda('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4fda('0x12'));var db=require(_0x4fda('0x13'))['db'];config[_0x4fda('0x14')]=_[_0x4fda('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4fda('0x16'))(new Redis(config[_0x4fda('0x14')]));require(_0x4fda('0x17'))[_0x4fda('0x18')](socket);function respondWithStatusCode(_0x3368a2,_0x30fee4){_0x30fee4=_0x30fee4||0xcc;return function(_0xc5a6db){if(_0xc5a6db){return _0x3368a2[_0x4fda('0x19')](_0x30fee4);}return _0x3368a2[_0x4fda('0x1a')](_0x30fee4)[_0x4fda('0x1b')]();};}function respondWithResult(_0x179dcd,_0x4fef6a){_0x4fef6a=_0x4fef6a||0xc8;return function(_0x18b71c){if(_0x18b71c){return _0x179dcd[_0x4fda('0x1a')](_0x4fef6a)[_0x4fda('0x1c')](_0x18b71c);}};}function respondWithFilteredResult(_0x594a09,_0x51332f){return function(_0x48bfb7){if(_0x48bfb7){var _0x3ef228=typeof _0x51332f[_0x4fda('0x1d')]==='undefined'&&typeof _0x51332f[_0x4fda('0x1e')]===_0x4fda('0x1f');var _0x1a50f9=_0x48bfb7[_0x4fda('0x20')];var _0x3372b3=_0x3ef228?0x0:_0x51332f[_0x4fda('0x1d')];var _0x5750d3=_0x3ef228?_0x48bfb7['count']:_0x51332f[_0x4fda('0x1d')]+_0x51332f['limit'];var _0x35d415;if(_0x5750d3>=_0x1a50f9){_0x5750d3=_0x1a50f9;_0x35d415=0xc8;}else{_0x35d415=0xce;}_0x594a09[_0x4fda('0x1a')](_0x35d415);return _0x594a09[_0x4fda('0x21')](_0x4fda('0x22'),_0x3372b3+'-'+_0x5750d3+'/'+_0x1a50f9)[_0x4fda('0x1c')](_0x48bfb7);}return null;};}function patchUpdates(_0x396cb6){return function(_0x15f9f7){try{jsonpatch[_0x4fda('0x23')](_0x15f9f7,_0x396cb6,!![]);}catch(_0x46b523){return BPromise[_0x4fda('0x24')](_0x46b523);}return _0x15f9f7[_0x4fda('0x25')]();};}function saveUpdates(_0x1985f7,_0x5a8217){return function(_0x5b95a1){if(_0x5b95a1){return _0x5b95a1[_0x4fda('0x26')](_0x1985f7)[_0x4fda('0x27')](function(_0x4e69b6){return _0x4e69b6;});}return null;};}function handleEntityNotFound(_0x26184e,_0x41e4b9){return function(_0x5cede5){if(!_0x5cede5){_0x26184e[_0x4fda('0x19')](0x194);}return _0x5cede5;};}function handleError(_0x1704e9,_0x37649e){_0x37649e=_0x37649e||0x1f4;return function(_0x499910){logger['error'](_0x499910[_0x4fda('0x28')]);if(_0x499910[_0x4fda('0x29')]){delete _0x499910[_0x4fda('0x29')];}_0x1704e9[_0x4fda('0x1a')](_0x37649e)[_0x4fda('0x2a')](_0x499910);};}exports[_0x4fda('0x2b')]=function(_0x5dd496,_0x346b3a){var _0x484c23={},_0x23962d={},_0x13f12c={'count':0x0,'rows':[]};var _0x42e0dc=_[_0x4fda('0x2c')](db[_0x4fda('0x2d')][_0x4fda('0x2e')],function(_0x1122a8){return{'name':_0x1122a8[_0x4fda('0x2f')],'type':_0x1122a8[_0x4fda('0x30')][_0x4fda('0x31')]};});_0x23962d[_0x4fda('0x32')]=_[_0x4fda('0x2c')](_0x42e0dc,_0x4fda('0x29'));_0x23962d[_0x4fda('0x33')]=_[_0x4fda('0x34')](_0x5dd496['query']);_0x23962d[_0x4fda('0x35')]=_['intersection'](_0x23962d[_0x4fda('0x32')],_0x23962d[_0x4fda('0x33')]);_0x484c23[_0x4fda('0x36')]=_['intersection'](_0x23962d[_0x4fda('0x32')],qs['fields'](_0x5dd496['query'][_0x4fda('0x37')]));_0x484c23['attributes']=_0x484c23[_0x4fda('0x36')][_0x4fda('0x38')]?_0x484c23[_0x4fda('0x36')]:_0x23962d[_0x4fda('0x32')];if(!_0x5dd496[_0x4fda('0x33')][_0x4fda('0x39')]('nolimit')){_0x484c23['limit']=qs[_0x4fda('0x1e')](_0x5dd496[_0x4fda('0x33')]['limit']);_0x484c23['offset']=qs[_0x4fda('0x1d')](_0x5dd496['query'][_0x4fda('0x1d')]);}_0x484c23[_0x4fda('0x3a')]=qs[_0x4fda('0x3b')](_0x5dd496[_0x4fda('0x33')]['sort']);_0x484c23['where']=qs['filters'](_[_0x4fda('0x3c')](_0x5dd496[_0x4fda('0x33')],_0x23962d['filters']),_0x42e0dc);if(_0x5dd496[_0x4fda('0x33')][_0x4fda('0x3d')]){_0x484c23['where']=_[_0x4fda('0x3e')](_0x484c23[_0x4fda('0x3f')],{'$or':_[_0x4fda('0x2c')](_0x42e0dc,function(_0x5e5c6f){if(_0x5e5c6f['type']!==_0x4fda('0x40')){var _0x475cdd={};_0x475cdd[_0x5e5c6f[_0x4fda('0x29')]]={'$like':'%'+_0x5dd496[_0x4fda('0x33')][_0x4fda('0x3d')]+'%'};return _0x475cdd;}})});}_0x484c23=_[_0x4fda('0x3e')]({},_0x484c23,_0x5dd496[_0x4fda('0x41')]);var _0x28f34f={'where':_0x484c23[_0x4fda('0x3f')]};return db[_0x4fda('0x2d')][_0x4fda('0x20')](_0x28f34f)['then'](function(_0x1732d8){_0x13f12c[_0x4fda('0x20')]=_0x1732d8;if(_0x5dd496[_0x4fda('0x33')][_0x4fda('0x42')]){_0x484c23[_0x4fda('0x43')]=[{'all':!![]}];}return db[_0x4fda('0x2d')][_0x4fda('0x44')](_0x484c23);})['then'](function(_0x3ef1c2){_0x13f12c['rows']=_0x3ef1c2;return _0x13f12c;})[_0x4fda('0x27')](respondWithFilteredResult(_0x346b3a,_0x484c23))['catch'](handleError(_0x346b3a,null));};exports['show']=function(_0x2098b2,_0x462e68){var _0x2cbfd1={'raw':![],'where':{'id':_0x2098b2['params']['id']}},_0x39b980={};_0x39b980['model']=_[_0x4fda('0x34')](db[_0x4fda('0x2d')][_0x4fda('0x2e')]);_0x39b980[_0x4fda('0x33')]=_['keys'](_0x2098b2[_0x4fda('0x33')]);_0x39b980[_0x4fda('0x35')]=_[_0x4fda('0x45')](_0x39b980['model'],_0x39b980['query']);_0x2cbfd1[_0x4fda('0x36')]=_[_0x4fda('0x45')](_0x39b980['model'],qs[_0x4fda('0x37')](_0x2098b2[_0x4fda('0x33')][_0x4fda('0x37')]));_0x2cbfd1['attributes']=_0x2cbfd1[_0x4fda('0x36')][_0x4fda('0x38')]?_0x2cbfd1[_0x4fda('0x36')]:_0x39b980[_0x4fda('0x32')];if(_0x2098b2[_0x4fda('0x33')][_0x4fda('0x42')]){_0x2cbfd1[_0x4fda('0x43')]=[{'all':!![]}];}_0x2cbfd1=_[_0x4fda('0x3e')]({},_0x2cbfd1,_0x2098b2[_0x4fda('0x41')]);return db['Team']['find'](_0x2cbfd1)['then'](handleEntityNotFound(_0x462e68,null))[_0x4fda('0x27')](respondWithResult(_0x462e68,null))[_0x4fda('0x46')](handleError(_0x462e68,null));};exports[_0x4fda('0x47')]=function(_0x3739d4,_0x4363fd){return db[_0x4fda('0x2d')][_0x4fda('0x47')](_0x3739d4[_0x4fda('0x48')],{})['then'](function(_0xdef919){var _0x4e0732=_0x3739d4[_0x4fda('0x49')][_0x4fda('0x4a')]({'plain':!![]});if(!_0x4e0732)throw new Error(_0x4fda('0x4b'));if(_0x4e0732['role']===_0x4fda('0x49')){var _0x299d0a=_0xdef919[_0x4fda('0x4a')]({'plain':!![]});var _0x5eee3d=_0x4fda('0x4c');return db[_0x4fda('0x4d')]['find']({'where':{'name':_0x5eee3d,'userProfileId':_0x4e0732['userProfileId']},'raw':!![]})[_0x4fda('0x27')](function(_0x2e035e){if(_0x2e035e&&_0x2e035e['autoAssociation']===0x0){return db[_0x4fda('0x4e')][_0x4fda('0x47')]({'name':_0x299d0a['name'],'resourceId':_0x299d0a['id'],'type':_0x2e035e[_0x4fda('0x29')],'sectionId':_0x2e035e['id']},{})[_0x4fda('0x27')](function(){return _0xdef919;});}else{return _0xdef919;}})['catch'](function(_0x238d15){logger[_0x4fda('0x4f')](_0x4fda('0x50'),_0x238d15);throw _0x238d15;});}return _0xdef919;})[_0x4fda('0x27')](respondWithResult(_0x4363fd,0xc9))[_0x4fda('0x46')](handleError(_0x4363fd,null));};exports['update']=function(_0x205345,_0x33f91e){if(_0x205345[_0x4fda('0x48')]['id']){delete _0x205345[_0x4fda('0x48')]['id'];}return db['Team'][_0x4fda('0x51')]({'where':{'id':_0x205345[_0x4fda('0x52')]['id']}})['then'](handleEntityNotFound(_0x33f91e,null))[_0x4fda('0x27')](saveUpdates(_0x205345[_0x4fda('0x48')],null))[_0x4fda('0x27')](respondWithResult(_0x33f91e,null))[_0x4fda('0x46')](handleError(_0x33f91e,null));};exports[_0x4fda('0x53')]=function(_0x214b9c,_0x4975b0){var _0x50196f=_0x214b9c[_0x4fda('0x52')]['id'];var _0x4d6b7f=[];return db['sequelize']['transaction'](function(_0x434a83){var _0x2ca4ac='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x50196f;return db[_0x4fda('0x54')]['query'](_0x2ca4ac,{'type':db[_0x4fda('0x55')][_0x4fda('0x56')][_0x4fda('0x57')],'raw':!![],'transaction':_0x434a83})[_0x4fda('0x27')](function(_0x5348cd){_0x4d6b7f=_[_0x4fda('0x2c')](_0x5348cd,function(_0x3def49){return Number(_0x3def49[_0x4fda('0x58')]);});})['then'](function(){var _0x277c1c='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x50196f;return db[_0x4fda('0x54')]['query'](_0x277c1c,{'type':db[_0x4fda('0x55')][_0x4fda('0x56')]['SELECT'],'raw':!![],'transaction':_0x434a83});})[_0x4fda('0x27')](function(_0x4a2ba3){var _0x41ca96=_[_0x4fda('0x2c')](_0x4a2ba3,function(_0x251020){return Number(_0x251020[_0x4fda('0x59')]);});return db[_0x4fda('0x5a')][_0x4fda('0x53')]({'where':{'UserId':{'$in':_0x4d6b7f},'VoiceQueueId':{'$in':_0x41ca96}},'transaction':_0x434a83});})[_0x4fda('0x27')](function(){var _0x42ad8f=_0x4fda('0x5b')+_0x50196f;return db[_0x4fda('0x54')][_0x4fda('0x33')](_0x42ad8f,{'type':db[_0x4fda('0x55')][_0x4fda('0x56')][_0x4fda('0x57')],'raw':!![],'transaction':_0x434a83});})[_0x4fda('0x27')](function(_0x4b16d1){var _0x145e82=_[_0x4fda('0x2c')](_0x4b16d1,function(_0x2f37e8){return Number(_0x2f37e8[_0x4fda('0x5c')]);});return db['UserMailQueue'][_0x4fda('0x53')]({'where':{'UserId':{'$in':_0x4d6b7f},'MailQueueId':{'$in':_0x145e82}},'transaction':_0x434a83});})['then'](function(){var _0x4fbb9d=_0x4fda('0x5d')+_0x50196f;return db[_0x4fda('0x54')][_0x4fda('0x33')](_0x4fbb9d,{'type':db[_0x4fda('0x55')]['QueryTypes'][_0x4fda('0x57')],'raw':!![],'transaction':_0x434a83});})[_0x4fda('0x27')](function(_0x4fd29f){var _0x19736e=_[_0x4fda('0x2c')](_0x4fd29f,function(_0x44af99){return Number(_0x44af99['SmsQueueId']);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x4d6b7f},'SmsQueueId':{'$in':_0x19736e}},'transaction':_0x434a83});})[_0x4fda('0x27')](function(){var _0xd794cf=_0x4fda('0x5e')+_0x50196f;return db[_0x4fda('0x54')][_0x4fda('0x33')](_0xd794cf,{'type':db['Sequelize'][_0x4fda('0x56')][_0x4fda('0x57')],'raw':!![],'transaction':_0x434a83});})[_0x4fda('0x27')](function(_0x3d6df1){var _0x27d106=_[_0x4fda('0x2c')](_0x3d6df1,function(_0x36f409){return Number(_0x36f409[_0x4fda('0x5f')]);});return db[_0x4fda('0x60')][_0x4fda('0x53')]({'where':{'UserId':{'$in':_0x4d6b7f},'ChatQueueId':{'$in':_0x27d106}},'transaction':_0x434a83});})[_0x4fda('0x27')](function(){var _0x7e7b41='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x50196f;return db[_0x4fda('0x54')]['query'](_0x7e7b41,{'type':db[_0x4fda('0x55')][_0x4fda('0x56')][_0x4fda('0x57')],'raw':!![],'transaction':_0x434a83});})[_0x4fda('0x27')](function(_0x43b2ad){var _0x596591=_[_0x4fda('0x2c')](_0x43b2ad,function(_0x4cb288){return Number(_0x4cb288[_0x4fda('0x61')]);});return db[_0x4fda('0x62')][_0x4fda('0x53')]({'where':{'UserId':{'$in':_0x4d6b7f},'FaxQueueId':{'$in':_0x596591}},'transaction':_0x434a83});})['then'](function(){var _0x5dcbdd=_0x4fda('0x63')+_0x50196f;return db[_0x4fda('0x54')]['query'](_0x5dcbdd,{'type':db[_0x4fda('0x55')][_0x4fda('0x56')][_0x4fda('0x57')],'raw':!![],'transaction':_0x434a83});})['then'](function(_0x168cb6){var _0x547a84=_[_0x4fda('0x2c')](_0x168cb6,function(_0x13becf){return Number(_0x13becf[_0x4fda('0x64')]);});return db[_0x4fda('0x65')][_0x4fda('0x53')]({'where':{'UserId':{'$in':_0x4d6b7f},'OpenchannelQueueId':{'$in':_0x547a84}},'transaction':_0x434a83});})[_0x4fda('0x27')](function(){var _0x26f99e='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x50196f;return db[_0x4fda('0x54')][_0x4fda('0x33')](_0x26f99e,{'type':db['Sequelize'][_0x4fda('0x56')][_0x4fda('0x57')],'raw':!![],'transaction':_0x434a83});})[_0x4fda('0x27')](function(_0x428fc6){var _0x24e3e2=_[_0x4fda('0x2c')](_0x428fc6,function(_0x3e707f){return Number(_0x3e707f['WhatsappQueueId']);});return db[_0x4fda('0x66')][_0x4fda('0x53')]({'where':{'UserId':{'$in':_0x4d6b7f},'WhatsappQueueId':{'$in':_0x24e3e2}},'transaction':_0x434a83});})['then'](function(){return db[_0x4fda('0x67')]['find']({'where':{'TeamId':_0x50196f}});})[_0x4fda('0x27')](function(_0x44f76c){if(_0x44f76c===null){return;}return db[_0x4fda('0x68')][_0x4fda('0x53')]({'where':{'UserId':{'$in':_0x4d6b7f},'VoicePrefixId':_0x44f76c[_0x4fda('0x69')]},'transaction':_0x434a83});})['then'](function(){return db[_0x4fda('0x2d')][_0x4fda('0x53')]({'where':{'id':_0x50196f},'cascade':!![],'transaction':_0x434a83});})[_0x4fda('0x27')](function(_0x3fb8cc){if(_0x3fb8cc===0x0){_0x4975b0[_0x4fda('0x19')](0x194);}else{return db[_0x4fda('0x4e')]['destroy']({'where':{'type':_0x4fda('0x4c'),'resourceId':_0x50196f},'cascade':!![],'transaction':_0x434a83})[_0x4fda('0x27')](function(){_0x4975b0['status'](0xcc)[_0x4fda('0x1b')]();});}})[_0x4fda('0x46')](function(_0x56ba6f){_0x4975b0['status'](0x1f4)[_0x4fda('0x2a')](_0x56ba6f);});});};exports[_0x4fda('0x6a')]=function(_0x3d2c07,_0x1e4ee1,_0x916ba1){return db[_0x4fda('0x2d')][_0x4fda('0x6b')]({'where':{'id':_0x3d2c07['params']['id']}})['then'](handleEntityNotFound(_0x1e4ee1,null))[_0x4fda('0x27')](function(_0x5d471b){if(!_0x3d2c07[_0x4fda('0x33')]['channel']||!utils['isValidChannel'](_0x3d2c07['query'][_0x4fda('0x6c')])){throw new db[(_0x4fda('0x55'))][(_0x4fda('0x6d'))](_0x4fda('0x6e'));}var _0x48528b={};var _0x5cdbc3={};_0x5cdbc3[_0x4fda('0x32')]=_['keys'](db[_[_0x4fda('0x6f')](_0x3d2c07['query'][_0x4fda('0x6c')][_0x4fda('0x70')]())+_0x4fda('0x71')][_0x4fda('0x2e')]);_0x5cdbc3[_0x4fda('0x33')]=_[_0x4fda('0x34')](_0x3d2c07[_0x4fda('0x33')]);_0x5cdbc3['filters']=_['intersection'](_0x5cdbc3[_0x4fda('0x32')],_0x5cdbc3[_0x4fda('0x33')]);_0x48528b[_0x4fda('0x36')]=_[_0x4fda('0x45')](_0x5cdbc3[_0x4fda('0x32')],qs[_0x4fda('0x37')](_0x3d2c07[_0x4fda('0x33')][_0x4fda('0x37')]));_0x48528b[_0x4fda('0x36')]=_0x48528b['attributes'][_0x4fda('0x38')]?_0x48528b[_0x4fda('0x36')]:_0x5cdbc3[_0x4fda('0x32')];_0x48528b[_0x4fda('0x1e')]=qs[_0x4fda('0x1e')](_0x3d2c07[_0x4fda('0x33')][_0x4fda('0x1e')]);_0x48528b[_0x4fda('0x1d')]=qs[_0x4fda('0x1d')](_0x3d2c07['query']['offset']);_0x48528b['order']=qs[_0x4fda('0x3b')](_0x3d2c07[_0x4fda('0x33')][_0x4fda('0x3b')]);_0x48528b['where']=qs['filters'](_['pick'](_0x3d2c07['query'],_0x5cdbc3[_0x4fda('0x35')]));_0x48528b=_[_0x4fda('0x3e')]({},_0x48528b,_0x3d2c07[_0x4fda('0x41')]);return _0x5d471b['get'+_[_0x4fda('0x6f')](_0x3d2c07[_0x4fda('0x33')]['channel'][_0x4fda('0x70')]())+_0x4fda('0x72')](_0x48528b);})[_0x4fda('0x27')](respondWithResult(_0x1e4ee1,null))['catch'](handleError(_0x1e4ee1,null));};exports['addQueues']=function(_0x15ccb4,_0x5ab479,_0x4061b4){return db[_0x4fda('0x2d')][_0x4fda('0x6b')]({'where':{'id':_0x15ccb4['params']['id']}})[_0x4fda('0x27')](function(_0x3a3f1c){if(_0x3a3f1c){if(!_0x15ccb4[_0x4fda('0x48')][_0x4fda('0x6c')]||!utils[_0x4fda('0x73')](_0x15ccb4[_0x4fda('0x48')][_0x4fda('0x6c')])){throw new db[(_0x4fda('0x55'))][(_0x4fda('0x6d'))]('Unknown\x20channel');}return _0x3a3f1c[_0x4fda('0x74')+_['capitalize'](_0x15ccb4[_0x4fda('0x48')][_0x4fda('0x6c')][_0x4fda('0x70')]())+_0x4fda('0x72')](_0x15ccb4[_0x4fda('0x48')][_0x4fda('0x75')]);}return null;})['then'](handleEntityNotFound(_0x5ab479,null))[_0x4fda('0x27')](respondWithStatusCode(_0x5ab479,null))[_0x4fda('0x46')](handleError(_0x5ab479,null));};exports['removeQueues']=function(_0x46a5b8,_0x518615,_0x203b0b){return db[_0x4fda('0x2d')]['findOne']({'where':{'id':_0x46a5b8[_0x4fda('0x52')]['id']}})['then'](function(_0x122f4e){if(_0x122f4e){if(!_0x46a5b8[_0x4fda('0x33')][_0x4fda('0x6c')]||!utils[_0x4fda('0x73')](_0x46a5b8[_0x4fda('0x33')]['channel'])){throw new db[(_0x4fda('0x55'))][(_0x4fda('0x6d'))](_0x4fda('0x6e'));}return _0x122f4e['remove'+_['capitalize'](_0x46a5b8['query']['channel']['toLowerCase']())+'Queues'](_0x46a5b8[_0x4fda('0x33')][_0x4fda('0x75')]);}return null;})['then'](handleEntityNotFound(_0x518615,null))['then'](respondWithStatusCode(_0x518615,null))[_0x4fda('0x46')](handleError(_0x518615,null));};exports['addAgents']=function(_0x45ebfe,_0x559deb){var _0x1d31d4=_['isArray'](_0x45ebfe[_0x4fda('0x48')][_0x4fda('0x75')])?_0x45ebfe[_0x4fda('0x48')]['ids']:[_0x45ebfe[_0x4fda('0x48')]['ids']];var _0x331e67=_0x45ebfe[_0x4fda('0x52')]['id'];return db['Team']['find']({'where':{'id':_0x331e67}})['then'](handleEntityNotFound(_0x559deb,null))[_0x4fda('0x27')](function(_0x16c8b0){if(_0x16c8b0){var _0x5c2d8e=[_0x4fda('0x76'),'Chat',_0x4fda('0x77'),_0x4fda('0x78'),_0x4fda('0x79'),'Openchannel',_0x4fda('0x7a')];return db[_0x4fda('0x54')]['transaction'](function(_0x44927a){var _0x1af77f=_[_0x4fda('0x2c')](_0x5c2d8e,function(_0x3d1172){var _0x360c73={'attributes':['id',_0x4fda('0x29')]};if(_0x3d1172===_0x4fda('0x76')){_0x360c73[_0x4fda('0x7b')]={'attributes':['penalty']};}return _0x16c8b0[_0x4fda('0x4a')+_0x3d1172+_0x4fda('0x72')](_0x360c73)[_0x4fda('0x27')](function(_0x22cc2c){var _0x14d18f=_[_0x4fda('0x2c')](_0x22cc2c,function(_0x14b595){var _0x589b91=_['map'](_0x1d31d4,function(_0x536380){var _0x2c0d07={'where':{'UserId':_0x536380,[_0x3d1172+_0x4fda('0x7c')]:_0x14b595['id']},'transaction':_0x44927a};if(_0x3d1172===_0x4fda('0x76')){_0x2c0d07['defaults']={'penalty':_0x14b595['TeamVoiceQueue'][_0x4fda('0x7d')]};}return db['User'+_0x3d1172+_0x4fda('0x71')][_0x4fda('0x7e')](_0x2c0d07)[_0x4fda('0x27')](function(){socket[_0x4fda('0x7f')](_0x4fda('0x49')+_0x3d1172+_0x4fda('0x80'),{'UserId':_0x536380,[_0x3d1172+_0x4fda('0x7c')]:_0x14b595['id']});if(_0x3d1172!==_0x4fda('0x76')){return;}return db['User']['findAll']({'where':{'id':_0x1d31d4,'online':0x1},'attributes':['id',_0x4fda('0x29'),_0x4fda('0x81'),_0x4fda('0x82'),_0x4fda('0x83')],'raw':!![]})[_0x4fda('0x27')](function(_0x3b664d){var _0x31b7ed=_[_0x4fda('0x2c')](_0x3b664d,function(_0x56fb9c){return db[_0x4fda('0x84')]['upsert']({'membername':_0x56fb9c[_0x4fda('0x29')],'UserId':_0x56fb9c['id'],'queue_name':_0x14b595[_0x4fda('0x29')],'VoiceQueueId':_0x14b595['id'],'interface':_['isNil'](_0x56fb9c[_0x4fda('0x83')])?util[_0x4fda('0x85')](_0x4fda('0x86'),_0x56fb9c[_0x4fda('0x29')]):_0x56fb9c[_0x4fda('0x83')],'paused':_0x56fb9c['voicePause']||![],'penalty':_0x14b595[_0x4fda('0x87')][_0x4fda('0x7d')]},{'transaction':_0x44927a});});return Promise['all'](_0x31b7ed);});});});return Promise[_0x4fda('0x88')](_0x589b91);});return Promise['all'](_0x14d18f);})[_0x4fda('0x27')](function(){return db[_0x4fda('0x67')][_0x4fda('0x6b')]({'where':{'teamId':_0x331e67}})['then'](function(_0x54105d){if(_0x54105d){var _0x1eec27=_[_0x4fda('0x2c')](_0x1d31d4,function(_0x3c7132){db['UserVoicePrefix']['upsert']({'UserId':_0x3c7132,'VoicePrefixId':_0x54105d['VoicePrefixId']});});return Promise[_0x4fda('0x88')](_0x1eec27);}});});});return Promise[_0x4fda('0x88')](_0x1af77f)[_0x4fda('0x27')](function(){return _0x16c8b0['addAgents'](_0x1d31d4,{'transaction':_0x44927a})['spread'](function(_0x2cde06){return _0x2cde06;});});});}})[_0x4fda('0x27')](respondWithResult(_0x559deb,null))['catch'](handleError(_0x559deb,null));};exports[_0x4fda('0x89')]=function(_0x11a915,_0x5a9bae){var _0x3e9dde=_['isArray'](_0x11a915[_0x4fda('0x33')][_0x4fda('0x75')])?_0x11a915[_0x4fda('0x33')]['ids']:[_0x11a915['query'][_0x4fda('0x75')]];var _0x5dc271=_0x11a915[_0x4fda('0x52')]['id'];return db['Team'][_0x4fda('0x51')]({'where':{'id':_0x5dc271}})[_0x4fda('0x27')](handleEntityNotFound(_0x5a9bae,null))['then'](function(_0x36464f){if(_0x36464f){var _0x59ee44=['Voice',_0x4fda('0x8a'),_0x4fda('0x77'),_0x4fda('0x78'),_0x4fda('0x79'),_0x4fda('0x8b'),_0x4fda('0x7a')];return db['sequelize'][_0x4fda('0x8c')](function(_0x588da4){var _0xb2e1c1=_[_0x4fda('0x2c')](_0x59ee44,function(_0xc52088){var _0x31d2e3={'attributes':['id','name']};return _0x36464f[_0x4fda('0x4a')+_0xc52088+_0x4fda('0x72')](_0x31d2e3)[_0x4fda('0x27')](function(_0x1bda62){var _0x2a0335=_[_0x4fda('0x2c')](_0x1bda62,function(_0x50b706){return _0x50b706[_0x4fda('0x89')](_0x3e9dde,{'transaction':_0x588da4})[_0x4fda('0x27')](function(){var _0x36eacf=_[_0x4fda('0x2c')](_0x3e9dde,function(_0x11d291){socket['emit']('user'+_0xc52088+_0x4fda('0x8d'),{'UserId':Number(_0x11d291),[_0xc52088+'QueueId']:_0x50b706['id']});if(_0xc52088!==_0x4fda('0x76')){return;}return db[_0x4fda('0x84')][_0x4fda('0x53')]({'where':{'VoiceQueueId':_0x50b706['id'],'UserId':_0x11d291},'transaction':_0x588da4});});return Promise['all'](_0x36eacf);});});return Promise[_0x4fda('0x88')](_0x2a0335);});});return Promise[_0x4fda('0x88')](_0xb2e1c1)[_0x4fda('0x27')](function(){return _0x36464f['removeAgents'](_0x3e9dde,{'transaction':_0x588da4});})[_0x4fda('0x27')](function(){return db[_0x4fda('0x67')][_0x4fda('0x6b')]({'where':{'teamId':_0x5dc271}})[_0x4fda('0x27')](function(_0x52f89f){if(_0x52f89f){var _0x3f322c=_[_0x4fda('0x2c')](_0x3e9dde,function(_0x14d1fa){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x14d1fa,'VoicePrefixId':_0x52f89f[_0x4fda('0x69')]}});});return Promise['all'](_0x3f322c);}});});});}})[_0x4fda('0x27')](respondWithStatusCode(_0x5a9bae,null))[_0x4fda('0x46')](handleError(_0x5a9bae,null));};exports[_0x4fda('0x8e')]=function(_0x12cff3,_0x48a687,_0x5261ad){var _0x662914={};var _0x1c7b38={};var _0x5e8122;var _0x9facb5;return db[_0x4fda('0x2d')]['findOne']({'where':{'id':_0x12cff3[_0x4fda('0x52')]['id']}})[_0x4fda('0x27')](handleEntityNotFound(_0x48a687,null))[_0x4fda('0x27')](function(_0x5e1bd5){if(_0x5e1bd5){_0x5e8122=_0x5e1bd5;_0x1c7b38[_0x4fda('0x32')]=_[_0x4fda('0x34')](db[_0x4fda('0x8f')][_0x4fda('0x2e')]);_0x1c7b38[_0x4fda('0x33')]=_[_0x4fda('0x34')](_0x12cff3['query']);_0x1c7b38[_0x4fda('0x35')]=_['intersection'](_0x1c7b38[_0x4fda('0x32')],_0x1c7b38[_0x4fda('0x33')]);_0x662914[_0x4fda('0x36')]=_[_0x4fda('0x45')](_0x1c7b38['model'],qs[_0x4fda('0x37')](_0x12cff3[_0x4fda('0x33')][_0x4fda('0x37')]));_0x662914['attributes']=_0x662914['attributes']['length']?_0x662914[_0x4fda('0x36')]:_0x1c7b38[_0x4fda('0x32')];_0x662914['order']=qs[_0x4fda('0x3b')](_0x12cff3[_0x4fda('0x33')][_0x4fda('0x3b')]);_0x662914[_0x4fda('0x3f')]=qs[_0x4fda('0x35')](_[_0x4fda('0x3c')](_0x12cff3['query'],_0x1c7b38[_0x4fda('0x35')]));if(_0x12cff3[_0x4fda('0x33')][_0x4fda('0x3d')]){_0x662914[_0x4fda('0x3f')]=_[_0x4fda('0x3e')](_0x662914[_0x4fda('0x3f')],{'$or':_['map'](_0x662914['attributes'],function(_0x21fbc6){var _0x27e632={};_0x27e632[_0x21fbc6]={'$like':'%'+_0x12cff3[_0x4fda('0x33')][_0x4fda('0x3d')]+'%'};return _0x27e632;})});}_0x662914=_[_0x4fda('0x3e')]({},_0x662914,_0x12cff3[_0x4fda('0x41')]);return _0x5e8122[_0x4fda('0x8e')](_0x662914);}})['then'](function(_0x585147){if(_0x585147){_0x9facb5=_0x585147[_0x4fda('0x38')];if(!_0x12cff3[_0x4fda('0x33')][_0x4fda('0x39')](_0x4fda('0x90'))){_0x662914[_0x4fda('0x1e')]=qs[_0x4fda('0x1e')](_0x12cff3[_0x4fda('0x33')][_0x4fda('0x1e')]);_0x662914[_0x4fda('0x1d')]=qs[_0x4fda('0x1d')](_0x12cff3[_0x4fda('0x33')]['offset']);}return _0x5e8122['getAgents'](_0x662914);}})[_0x4fda('0x27')](function(_0x598df7){if(_0x598df7){return _0x598df7?{'count':_0x9facb5,'rows':_0x598df7}:null;}})[_0x4fda('0x27')](respondWithResult(_0x48a687,null))[_0x4fda('0x46')](handleError(_0x48a687,null));}; \ No newline at end of file +var _0x90c5=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./team.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','reject','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','includeAll','rows','params','include','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','sequelize','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','MailQueueId','SmsQueueId','ChatQueueId','UserChatQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','order','options','Queues','addQueues','removeQueues','remove','addAgents','ids','Voice','Mail','Sms','Fax','Whatsapp','transaction','through','QueueId','TeamVoiceQueue','findOrCreate','emit','Queue:save','User','findAll','online','voicePause','interface','isNil','format','SIP/%s','penalty','all','upsert','spread','removeAgents','isArray','Openchannel','Queue:remove','UserVoiceQueueRt','TeamVoicePrefix','getAgents','sort'];(function(_0x12b68c,_0x409626){var _0x59ddb0=function(_0x2fa63f){while(--_0x2fa63f){_0x12b68c['push'](_0x12b68c['shift']());}};_0x59ddb0(++_0x409626);}(_0x90c5,0x12e));var _0x590c=function(_0x44a8ad,_0x311e50){_0x44a8ad=_0x44a8ad-0x0;var _0x38f745=_0x90c5[_0x44a8ad];return _0x38f745;};'use strict';var emlformat=require(_0x590c('0x0'));var rimraf=require(_0x590c('0x1'));var zipdir=require(_0x590c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x590c('0x3'));var moment=require(_0x590c('0x4'));var BPromise=require(_0x590c('0x5'));var Mustache=require('mustache');var util=require(_0x590c('0x6'));var path=require(_0x590c('0x7'));var sox=require(_0x590c('0x8'));var csv=require(_0x590c('0x9'));var ejs=require(_0x590c('0xa'));var fs=require('fs');var fs_extra=require(_0x590c('0xb'));var _=require(_0x590c('0xc'));var squel=require(_0x590c('0xd'));var crypto=require(_0x590c('0xe'));var jsforce=require(_0x590c('0xf'));var deskjs=require(_0x590c('0x10'));var toCsv=require(_0x590c('0x9'));var querystring=require(_0x590c('0x11'));var Papa=require('papaparse');var Redis=require(_0x590c('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x590c('0x13'));var hardwareService=require(_0x590c('0x14'));var logger=require(_0x590c('0x15'))(_0x590c('0x16'));var utils=require(_0x590c('0x17'));var config=require(_0x590c('0x18'));var licenseUtil=require(_0x590c('0x19'));var db=require('../../mysqldb')['db'];config[_0x590c('0x1a')]=_[_0x590c('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x590c('0x1a')]));require(_0x590c('0x1c'))[_0x590c('0x1d')](socket);function respondWithStatusCode(_0x4611f9,_0x275d49){_0x275d49=_0x275d49||0xcc;return function(_0x36e92f){if(_0x36e92f){return _0x4611f9[_0x590c('0x1e')](_0x275d49);}return _0x4611f9[_0x590c('0x1f')](_0x275d49)[_0x590c('0x20')]();};}function respondWithResult(_0x4cb488,_0x1dedd9){_0x1dedd9=_0x1dedd9||0xc8;return function(_0x3eb9ed){if(_0x3eb9ed){return _0x4cb488['status'](_0x1dedd9)[_0x590c('0x21')](_0x3eb9ed);}};}function respondWithFilteredResult(_0x418618,_0x505555){return function(_0x2a9385){if(_0x2a9385){var _0x4c0422=typeof _0x505555['offset']===_0x590c('0x22')&&typeof _0x505555[_0x590c('0x23')]===_0x590c('0x22');var _0xed36f1=_0x2a9385['count'];var _0x24972a=_0x4c0422?0x0:_0x505555[_0x590c('0x24')];var _0x3dae77=_0x4c0422?_0x2a9385[_0x590c('0x25')]:_0x505555[_0x590c('0x24')]+_0x505555[_0x590c('0x23')];var _0x485366;if(_0x3dae77>=_0xed36f1){_0x3dae77=_0xed36f1;_0x485366=0xc8;}else{_0x485366=0xce;}_0x418618['status'](_0x485366);return _0x418618[_0x590c('0x26')]('Content-Range',_0x24972a+'-'+_0x3dae77+'/'+_0xed36f1)[_0x590c('0x21')](_0x2a9385);}return null;};}function patchUpdates(_0x16b4ec){return function(_0x495e6f){try{jsonpatch['apply'](_0x495e6f,_0x16b4ec,!![]);}catch(_0x27a0f2){return BPromise[_0x590c('0x27')](_0x27a0f2);}return _0x495e6f['save']();};}function saveUpdates(_0x51d2b6,_0x535ffc){return function(_0x57174f){if(_0x57174f){return _0x57174f['update'](_0x51d2b6)[_0x590c('0x28')](function(_0x5d80fa){return _0x5d80fa;});}return null;};}function handleEntityNotFound(_0xbbf61b,_0x4ec9c5){return function(_0x35f709){if(!_0x35f709){_0xbbf61b[_0x590c('0x1e')](0x194);}return _0x35f709;};}function handleError(_0xd8ee13,_0x5740d6){_0x5740d6=_0x5740d6||0x1f4;return function(_0x1c8476){logger[_0x590c('0x29')](_0x1c8476[_0x590c('0x2a')]);if(_0x1c8476[_0x590c('0x2b')]){delete _0x1c8476[_0x590c('0x2b')];}_0xd8ee13['status'](_0x5740d6)[_0x590c('0x2c')](_0x1c8476);};}exports[_0x590c('0x2d')]=function(_0x288ddd,_0x382d6e){var _0x255eb3={},_0x22ca2a={},_0x38a1c8={'count':0x0,'rows':[]};var _0x37b4c6=_[_0x590c('0x2e')](db[_0x590c('0x2f')][_0x590c('0x30')],function(_0x4c742b){return{'name':_0x4c742b[_0x590c('0x31')],'type':_0x4c742b[_0x590c('0x32')][_0x590c('0x33')]};});_0x22ca2a[_0x590c('0x34')]=_[_0x590c('0x2e')](_0x37b4c6,_0x590c('0x2b'));_0x22ca2a[_0x590c('0x35')]=_[_0x590c('0x36')](_0x288ddd[_0x590c('0x35')]);_0x22ca2a[_0x590c('0x37')]=_[_0x590c('0x38')](_0x22ca2a[_0x590c('0x34')],_0x22ca2a[_0x590c('0x35')]);_0x255eb3[_0x590c('0x39')]=_['intersection'](_0x22ca2a[_0x590c('0x34')],qs['fields'](_0x288ddd['query'][_0x590c('0x3a')]));_0x255eb3[_0x590c('0x39')]=_0x255eb3['attributes'][_0x590c('0x3b')]?_0x255eb3[_0x590c('0x39')]:_0x22ca2a[_0x590c('0x34')];if(!_0x288ddd['query'][_0x590c('0x3c')](_0x590c('0x3d'))){_0x255eb3['limit']=qs[_0x590c('0x23')](_0x288ddd['query'][_0x590c('0x23')]);_0x255eb3[_0x590c('0x24')]=qs['offset'](_0x288ddd[_0x590c('0x35')]['offset']);}_0x255eb3['order']=qs['sort'](_0x288ddd[_0x590c('0x35')]['sort']);_0x255eb3['where']=qs[_0x590c('0x37')](_[_0x590c('0x3e')](_0x288ddd[_0x590c('0x35')],_0x22ca2a[_0x590c('0x37')]),_0x37b4c6);if(_0x288ddd['query'][_0x590c('0x3f')]){_0x255eb3[_0x590c('0x40')]=_[_0x590c('0x41')](_0x255eb3[_0x590c('0x40')],{'$or':_[_0x590c('0x2e')](_0x37b4c6,function(_0x4c4dc7){if(_0x4c4dc7[_0x590c('0x32')]!==_0x590c('0x42')){var _0x465377={};_0x465377[_0x4c4dc7[_0x590c('0x2b')]]={'$like':'%'+_0x288ddd[_0x590c('0x35')][_0x590c('0x3f')]+'%'};return _0x465377;}})});}_0x255eb3=_[_0x590c('0x41')]({},_0x255eb3,_0x288ddd['options']);var _0x4181f8={'where':_0x255eb3[_0x590c('0x40')]};return db[_0x590c('0x2f')][_0x590c('0x25')](_0x4181f8)['then'](function(_0x288018){_0x38a1c8[_0x590c('0x25')]=_0x288018;if(_0x288ddd[_0x590c('0x35')][_0x590c('0x43')]){_0x255eb3['include']=[{'all':!![]}];}return db[_0x590c('0x2f')]['findAll'](_0x255eb3);})[_0x590c('0x28')](function(_0x1f61ad){_0x38a1c8[_0x590c('0x44')]=_0x1f61ad;return _0x38a1c8;})[_0x590c('0x28')](respondWithFilteredResult(_0x382d6e,_0x255eb3))['catch'](handleError(_0x382d6e,null));};exports['show']=function(_0x4decae,_0x3089ca){var _0x34f043={'raw':![],'where':{'id':_0x4decae[_0x590c('0x45')]['id']}},_0x5e779c={};_0x5e779c['model']=_[_0x590c('0x36')](db[_0x590c('0x2f')]['rawAttributes']);_0x5e779c[_0x590c('0x35')]=_[_0x590c('0x36')](_0x4decae['query']);_0x5e779c[_0x590c('0x37')]=_['intersection'](_0x5e779c[_0x590c('0x34')],_0x5e779c['query']);_0x34f043['attributes']=_[_0x590c('0x38')](_0x5e779c[_0x590c('0x34')],qs['fields'](_0x4decae[_0x590c('0x35')][_0x590c('0x3a')]));_0x34f043[_0x590c('0x39')]=_0x34f043[_0x590c('0x39')][_0x590c('0x3b')]?_0x34f043[_0x590c('0x39')]:_0x5e779c[_0x590c('0x34')];if(_0x4decae[_0x590c('0x35')][_0x590c('0x43')]){_0x34f043[_0x590c('0x46')]=[{'all':!![]}];}_0x34f043=_[_0x590c('0x41')]({},_0x34f043,_0x4decae['options']);return db[_0x590c('0x2f')]['find'](_0x34f043)[_0x590c('0x28')](handleEntityNotFound(_0x3089ca,null))[_0x590c('0x28')](respondWithResult(_0x3089ca,null))[_0x590c('0x47')](handleError(_0x3089ca,null));};exports[_0x590c('0x48')]=function(_0x5bf9cf,_0x5da393){return db[_0x590c('0x2f')]['create'](_0x5bf9cf[_0x590c('0x49')],{})[_0x590c('0x28')](function(_0x2ccbff){var _0x2e9dc0=_0x5bf9cf[_0x590c('0x4a')][_0x590c('0x4b')]({'plain':!![]});if(!_0x2e9dc0)throw new Error(_0x590c('0x4c'));if(_0x2e9dc0['role']==='user'){var _0x2c43e4=_0x2ccbff[_0x590c('0x4b')]({'plain':!![]});var _0x2f85f1=_0x590c('0x4d');return db['UserProfileSection'][_0x590c('0x4e')]({'where':{'name':_0x2f85f1,'userProfileId':_0x2e9dc0['userProfileId']},'raw':!![]})['then'](function(_0xade68f){if(_0xade68f&&_0xade68f[_0x590c('0x4f')]===0x0){return db[_0x590c('0x50')][_0x590c('0x48')]({'name':_0x2c43e4['name'],'resourceId':_0x2c43e4['id'],'type':_0xade68f[_0x590c('0x2b')],'sectionId':_0xade68f['id']},{})[_0x590c('0x28')](function(){return _0x2ccbff;});}else{return _0x2ccbff;}})[_0x590c('0x47')](function(_0x1eb956){logger[_0x590c('0x29')](_0x590c('0x51'),_0x1eb956);throw _0x1eb956;});}return _0x2ccbff;})[_0x590c('0x28')](respondWithResult(_0x5da393,0xc9))[_0x590c('0x47')](handleError(_0x5da393,null));};exports[_0x590c('0x52')]=function(_0x367919,_0xa8ef34){if(_0x367919[_0x590c('0x49')]['id']){delete _0x367919[_0x590c('0x49')]['id'];}return db['Team'][_0x590c('0x4e')]({'where':{'id':_0x367919[_0x590c('0x45')]['id']}})['then'](handleEntityNotFound(_0xa8ef34,null))[_0x590c('0x28')](saveUpdates(_0x367919[_0x590c('0x49')],null))[_0x590c('0x28')](respondWithResult(_0xa8ef34,null))[_0x590c('0x47')](handleError(_0xa8ef34,null));};exports[_0x590c('0x53')]=function(_0x579ddb,_0x20983c){var _0x46f893=_0x579ddb['params']['id'];var _0x21ce46=[];return db['sequelize']['transaction'](function(_0x74985c){var _0x3fccd1='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x46f893;return db['sequelize'][_0x590c('0x35')](_0x3fccd1,{'type':db['Sequelize'][_0x590c('0x54')][_0x590c('0x55')],'raw':!![],'transaction':_0x74985c})[_0x590c('0x28')](function(_0x36e19b){_0x21ce46=_['map'](_0x36e19b,function(_0x51da42){return Number(_0x51da42[_0x590c('0x56')]);});})['then'](function(){var _0x339d03=_0x590c('0x57')+_0x46f893;return db[_0x590c('0x58')][_0x590c('0x35')](_0x339d03,{'type':db['Sequelize'][_0x590c('0x54')][_0x590c('0x55')],'raw':!![],'transaction':_0x74985c});})[_0x590c('0x28')](function(_0x2ded19){var _0x6fb590=_[_0x590c('0x2e')](_0x2ded19,function(_0x1ceb96){return Number(_0x1ceb96[_0x590c('0x59')]);});return db[_0x590c('0x5a')][_0x590c('0x53')]({'where':{'UserId':{'$in':_0x21ce46},'VoiceQueueId':{'$in':_0x6fb590}},'transaction':_0x74985c});})[_0x590c('0x28')](function(){var _0x54097a=_0x590c('0x5b')+_0x46f893;return db[_0x590c('0x58')][_0x590c('0x35')](_0x54097a,{'type':db[_0x590c('0x5c')][_0x590c('0x54')][_0x590c('0x55')],'raw':!![],'transaction':_0x74985c});})['then'](function(_0x1c465b){var _0x33ad00=_[_0x590c('0x2e')](_0x1c465b,function(_0x431b7f){return Number(_0x431b7f[_0x590c('0x5d')]);});return db['UserMailQueue'][_0x590c('0x53')]({'where':{'UserId':{'$in':_0x21ce46},'MailQueueId':{'$in':_0x33ad00}},'transaction':_0x74985c});})[_0x590c('0x28')](function(){var _0x44cde2='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x46f893;return db[_0x590c('0x58')][_0x590c('0x35')](_0x44cde2,{'type':db[_0x590c('0x5c')][_0x590c('0x54')][_0x590c('0x55')],'raw':!![],'transaction':_0x74985c});})['then'](function(_0x20a666){var _0x4ec7cf=_[_0x590c('0x2e')](_0x20a666,function(_0x347b88){return Number(_0x347b88[_0x590c('0x5e')]);});return db['UserSmsQueue'][_0x590c('0x53')]({'where':{'UserId':{'$in':_0x21ce46},'SmsQueueId':{'$in':_0x4ec7cf}},'transaction':_0x74985c});})[_0x590c('0x28')](function(){var _0x5b6e90='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x46f893;return db['sequelize'][_0x590c('0x35')](_0x5b6e90,{'type':db[_0x590c('0x5c')][_0x590c('0x54')]['SELECT'],'raw':!![],'transaction':_0x74985c});})[_0x590c('0x28')](function(_0xcde636){var _0x2109c5=_[_0x590c('0x2e')](_0xcde636,function(_0x54c368){return Number(_0x54c368[_0x590c('0x5f')]);});return db[_0x590c('0x60')][_0x590c('0x53')]({'where':{'UserId':{'$in':_0x21ce46},'ChatQueueId':{'$in':_0x2109c5}},'transaction':_0x74985c});})[_0x590c('0x28')](function(){var _0x42b1f2='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x46f893;return db['sequelize'][_0x590c('0x35')](_0x42b1f2,{'type':db[_0x590c('0x5c')][_0x590c('0x54')][_0x590c('0x55')],'raw':!![],'transaction':_0x74985c});})[_0x590c('0x28')](function(_0x430e7e){var _0x297958=_[_0x590c('0x2e')](_0x430e7e,function(_0x2a5c3a){return Number(_0x2a5c3a['FaxQueueId']);});return db['UserFaxQueue'][_0x590c('0x53')]({'where':{'UserId':{'$in':_0x21ce46},'FaxQueueId':{'$in':_0x297958}},'transaction':_0x74985c});})[_0x590c('0x28')](function(){var _0x530e88=_0x590c('0x61')+_0x46f893;return db[_0x590c('0x58')][_0x590c('0x35')](_0x530e88,{'type':db['Sequelize'][_0x590c('0x54')][_0x590c('0x55')],'raw':!![],'transaction':_0x74985c});})[_0x590c('0x28')](function(_0x126948){var _0x2c082a=_[_0x590c('0x2e')](_0x126948,function(_0x15aac1){return Number(_0x15aac1[_0x590c('0x62')]);});return db[_0x590c('0x63')][_0x590c('0x53')]({'where':{'UserId':{'$in':_0x21ce46},'OpenchannelQueueId':{'$in':_0x2c082a}},'transaction':_0x74985c});})[_0x590c('0x28')](function(){var _0x164223='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x46f893;return db['sequelize'][_0x590c('0x35')](_0x164223,{'type':db['Sequelize'][_0x590c('0x54')][_0x590c('0x55')],'raw':!![],'transaction':_0x74985c});})['then'](function(_0x4bd392){var _0x11f304=_[_0x590c('0x2e')](_0x4bd392,function(_0x29c65e){return Number(_0x29c65e[_0x590c('0x64')]);});return db['UserWhatsappQueue'][_0x590c('0x53')]({'where':{'UserId':{'$in':_0x21ce46},'WhatsappQueueId':{'$in':_0x11f304}},'transaction':_0x74985c});})[_0x590c('0x28')](function(){return db['TeamVoicePrefix'][_0x590c('0x4e')]({'where':{'TeamId':_0x46f893}});})[_0x590c('0x28')](function(_0x4cef83){if(_0x4cef83===null){return;}return db[_0x590c('0x65')]['destroy']({'where':{'UserId':{'$in':_0x21ce46},'VoicePrefixId':_0x4cef83[_0x590c('0x66')]},'transaction':_0x74985c});})[_0x590c('0x28')](function(){return db[_0x590c('0x2f')]['destroy']({'where':{'id':_0x46f893},'cascade':!![],'transaction':_0x74985c});})[_0x590c('0x28')](function(_0xfcd9bb){if(_0xfcd9bb===0x0){_0x20983c['sendStatus'](0x194);}else{return db[_0x590c('0x50')]['destroy']({'where':{'type':_0x590c('0x4d'),'resourceId':_0x46f893},'cascade':!![],'transaction':_0x74985c})[_0x590c('0x28')](function(){_0x20983c[_0x590c('0x1f')](0xcc)[_0x590c('0x20')]();});}})['catch'](function(_0x24e69f){_0x20983c[_0x590c('0x1f')](0x1f4)[_0x590c('0x2c')](_0x24e69f);});});};exports[_0x590c('0x67')]=function(_0x1fc4d8,_0x3086d4,_0x33a103){return db['Team'][_0x590c('0x68')]({'where':{'id':_0x1fc4d8['params']['id']}})['then'](handleEntityNotFound(_0x3086d4,null))[_0x590c('0x28')](function(_0x24fa10){if(!_0x1fc4d8['query'][_0x590c('0x69')]||!utils[_0x590c('0x6a')](_0x1fc4d8[_0x590c('0x35')]['channel'])){throw new db[(_0x590c('0x5c'))][(_0x590c('0x6b'))](_0x590c('0x6c'));}var _0x3b2e6f={};var _0x3d2cbc={};_0x3d2cbc[_0x590c('0x34')]=_[_0x590c('0x36')](db[_[_0x590c('0x6d')](_0x1fc4d8[_0x590c('0x35')][_0x590c('0x69')][_0x590c('0x6e')]())+'Queue']['rawAttributes']);_0x3d2cbc[_0x590c('0x35')]=_['keys'](_0x1fc4d8[_0x590c('0x35')]);_0x3d2cbc[_0x590c('0x37')]=_['intersection'](_0x3d2cbc['model'],_0x3d2cbc[_0x590c('0x35')]);_0x3b2e6f['attributes']=_[_0x590c('0x38')](_0x3d2cbc[_0x590c('0x34')],qs[_0x590c('0x3a')](_0x1fc4d8[_0x590c('0x35')]['fields']));_0x3b2e6f['attributes']=_0x3b2e6f[_0x590c('0x39')][_0x590c('0x3b')]?_0x3b2e6f['attributes']:_0x3d2cbc[_0x590c('0x34')];_0x3b2e6f['limit']=qs[_0x590c('0x23')](_0x1fc4d8[_0x590c('0x35')][_0x590c('0x23')]);_0x3b2e6f[_0x590c('0x24')]=qs[_0x590c('0x24')](_0x1fc4d8[_0x590c('0x35')][_0x590c('0x24')]);_0x3b2e6f[_0x590c('0x6f')]=qs['sort'](_0x1fc4d8['query']['sort']);_0x3b2e6f['where']=qs[_0x590c('0x37')](_[_0x590c('0x3e')](_0x1fc4d8[_0x590c('0x35')],_0x3d2cbc[_0x590c('0x37')]));_0x3b2e6f=_['merge']({},_0x3b2e6f,_0x1fc4d8[_0x590c('0x70')]);return _0x24fa10[_0x590c('0x4b')+_['capitalize'](_0x1fc4d8[_0x590c('0x35')][_0x590c('0x69')][_0x590c('0x6e')]())+_0x590c('0x71')](_0x3b2e6f);})[_0x590c('0x28')](respondWithResult(_0x3086d4,null))[_0x590c('0x47')](handleError(_0x3086d4,null));};exports[_0x590c('0x72')]=function(_0x365770,_0x597191,_0x5e71c7){return db[_0x590c('0x2f')][_0x590c('0x68')]({'where':{'id':_0x365770[_0x590c('0x45')]['id']}})['then'](function(_0x25d907){if(_0x25d907){if(!_0x365770[_0x590c('0x49')][_0x590c('0x69')]||!utils[_0x590c('0x6a')](_0x365770[_0x590c('0x49')][_0x590c('0x69')])){throw new db[(_0x590c('0x5c'))]['ValidationError'](_0x590c('0x6c'));}return _0x25d907['add'+_[_0x590c('0x6d')](_0x365770[_0x590c('0x49')][_0x590c('0x69')][_0x590c('0x6e')]())+'Queues'](_0x365770[_0x590c('0x49')]['ids']);}return null;})[_0x590c('0x28')](handleEntityNotFound(_0x597191,null))['then'](respondWithStatusCode(_0x597191,null))[_0x590c('0x47')](handleError(_0x597191,null));};exports[_0x590c('0x73')]=function(_0x41ba9d,_0x8abced,_0x390c33){return db[_0x590c('0x2f')][_0x590c('0x68')]({'where':{'id':_0x41ba9d[_0x590c('0x45')]['id']}})[_0x590c('0x28')](function(_0x71c030){if(_0x71c030){if(!_0x41ba9d[_0x590c('0x35')][_0x590c('0x69')]||!utils['isValidChannel'](_0x41ba9d[_0x590c('0x35')][_0x590c('0x69')])){throw new db[(_0x590c('0x5c'))][(_0x590c('0x6b'))]('Unknown\x20channel');}return _0x71c030[_0x590c('0x74')+_[_0x590c('0x6d')](_0x41ba9d[_0x590c('0x35')][_0x590c('0x69')][_0x590c('0x6e')]())+_0x590c('0x71')](_0x41ba9d['query']['ids']);}return null;})[_0x590c('0x28')](handleEntityNotFound(_0x8abced,null))[_0x590c('0x28')](respondWithStatusCode(_0x8abced,null))[_0x590c('0x47')](handleError(_0x8abced,null));};exports[_0x590c('0x75')]=function(_0x209906,_0x307cd4){var _0x284db3=_['isArray'](_0x209906[_0x590c('0x49')][_0x590c('0x76')])?_0x209906['body'][_0x590c('0x76')]:[_0x209906['body'][_0x590c('0x76')]];var _0x2211e4=_0x209906[_0x590c('0x45')]['id'];return db[_0x590c('0x2f')]['find']({'where':{'id':_0x2211e4}})['then'](handleEntityNotFound(_0x307cd4,null))[_0x590c('0x28')](function(_0x18b4c0){if(_0x18b4c0){var _0x4a6d2a=[_0x590c('0x77'),'Chat',_0x590c('0x78'),_0x590c('0x79'),_0x590c('0x7a'),'Openchannel',_0x590c('0x7b')];return db[_0x590c('0x58')][_0x590c('0x7c')](function(_0x3f92d0){var _0x3850d0=_['map'](_0x4a6d2a,function(_0x2fd281){var _0x453ad1={'attributes':['id',_0x590c('0x2b')]};if(_0x2fd281===_0x590c('0x77')){_0x453ad1[_0x590c('0x7d')]={'attributes':['penalty']};}return _0x18b4c0['get'+_0x2fd281+'Queues'](_0x453ad1)[_0x590c('0x28')](function(_0x4be3cb){var _0x5b721a=_[_0x590c('0x2e')](_0x4be3cb,function(_0xcbc12f){var _0x1c10a0=_['map'](_0x284db3,function(_0x1d3caf){var _0x335a88={'where':{'UserId':_0x1d3caf,[_0x2fd281+_0x590c('0x7e')]:_0xcbc12f['id']},'transaction':_0x3f92d0};if(_0x2fd281===_0x590c('0x77')){_0x335a88['defaults']={'penalty':_0xcbc12f[_0x590c('0x7f')]['penalty']};}return db['User'+_0x2fd281+'Queue'][_0x590c('0x80')](_0x335a88)['then'](function(){socket[_0x590c('0x81')](_0x590c('0x4a')+_0x2fd281+_0x590c('0x82'),{'UserId':_0x1d3caf,[_0x2fd281+_0x590c('0x7e')]:_0xcbc12f['id']});if(_0x2fd281!==_0x590c('0x77')){return;}return db[_0x590c('0x83')][_0x590c('0x84')]({'where':{'id':_0x284db3,'online':0x1},'attributes':['id',_0x590c('0x2b'),_0x590c('0x85'),_0x590c('0x86'),_0x590c('0x87')],'raw':!![]})[_0x590c('0x28')](function(_0x154fc4){var _0x3b42cb=_['map'](_0x154fc4,function(_0x431df2){return db['UserVoiceQueueRt']['upsert']({'membername':_0x431df2[_0x590c('0x2b')],'UserId':_0x431df2['id'],'queue_name':_0xcbc12f[_0x590c('0x2b')],'VoiceQueueId':_0xcbc12f['id'],'interface':_[_0x590c('0x88')](_0x431df2[_0x590c('0x87')])?util[_0x590c('0x89')](_0x590c('0x8a'),_0x431df2['name']):_0x431df2[_0x590c('0x87')],'paused':_0x431df2[_0x590c('0x86')]||![],'penalty':_0xcbc12f[_0x590c('0x7f')][_0x590c('0x8b')]},{'transaction':_0x3f92d0});});return Promise[_0x590c('0x8c')](_0x3b42cb);});});});return Promise[_0x590c('0x8c')](_0x1c10a0);});return Promise[_0x590c('0x8c')](_0x5b721a);})['then'](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x2211e4}})['then'](function(_0x47692c){if(_0x47692c){var _0x50296b=_[_0x590c('0x2e')](_0x284db3,function(_0x55b293){db[_0x590c('0x65')][_0x590c('0x8d')]({'UserId':_0x55b293,'VoicePrefixId':_0x47692c['VoicePrefixId']});});return Promise[_0x590c('0x8c')](_0x50296b);}});});});return Promise[_0x590c('0x8c')](_0x3850d0)[_0x590c('0x28')](function(){return _0x18b4c0['addAgents'](_0x284db3,{'transaction':_0x3f92d0})[_0x590c('0x8e')](function(_0x29b13b){return _0x29b13b;});});});}})[_0x590c('0x28')](respondWithResult(_0x307cd4,null))['catch'](handleError(_0x307cd4,null));};exports[_0x590c('0x8f')]=function(_0x30e259,_0x40e498){var _0x2ca665=_[_0x590c('0x90')](_0x30e259[_0x590c('0x35')][_0x590c('0x76')])?_0x30e259[_0x590c('0x35')][_0x590c('0x76')]:[_0x30e259['query'][_0x590c('0x76')]];var _0x419358=_0x30e259[_0x590c('0x45')]['id'];return db[_0x590c('0x2f')][_0x590c('0x4e')]({'where':{'id':_0x419358}})[_0x590c('0x28')](handleEntityNotFound(_0x40e498,null))['then'](function(_0x2a0813){if(_0x2a0813){var _0x5e8b40=[_0x590c('0x77'),'Chat','Mail',_0x590c('0x79'),_0x590c('0x7a'),_0x590c('0x91'),_0x590c('0x7b')];return db['sequelize'][_0x590c('0x7c')](function(_0x50d696){var _0x28da38=_[_0x590c('0x2e')](_0x5e8b40,function(_0x47f8e2){var _0xdec951={'attributes':['id',_0x590c('0x2b')]};return _0x2a0813[_0x590c('0x4b')+_0x47f8e2+'Queues'](_0xdec951)[_0x590c('0x28')](function(_0x4547fb){var _0x45d08b=_['map'](_0x4547fb,function(_0x766f7d){return _0x766f7d[_0x590c('0x8f')](_0x2ca665,{'transaction':_0x50d696})[_0x590c('0x28')](function(){var _0x48fa77=_[_0x590c('0x2e')](_0x2ca665,function(_0x1b0282){socket['emit']('user'+_0x47f8e2+_0x590c('0x92'),{'UserId':Number(_0x1b0282),[_0x47f8e2+_0x590c('0x7e')]:_0x766f7d['id']});if(_0x47f8e2!==_0x590c('0x77')){return;}return db[_0x590c('0x93')][_0x590c('0x53')]({'where':{'VoiceQueueId':_0x766f7d['id'],'UserId':_0x1b0282},'transaction':_0x50d696});});return Promise[_0x590c('0x8c')](_0x48fa77);});});return Promise['all'](_0x45d08b);});});return Promise[_0x590c('0x8c')](_0x28da38)[_0x590c('0x28')](function(){return _0x2a0813[_0x590c('0x8f')](_0x2ca665,{'transaction':_0x50d696});})[_0x590c('0x28')](function(){return db[_0x590c('0x94')][_0x590c('0x68')]({'where':{'teamId':_0x419358}})[_0x590c('0x28')](function(_0x2888bd){if(_0x2888bd){var _0x59ded2=_[_0x590c('0x2e')](_0x2ca665,function(_0x4306d7){db[_0x590c('0x65')][_0x590c('0x53')]({'where':{'UserId':_0x4306d7,'VoicePrefixId':_0x2888bd[_0x590c('0x66')]}});});return Promise[_0x590c('0x8c')](_0x59ded2);}});});});}})[_0x590c('0x28')](respondWithStatusCode(_0x40e498,null))['catch'](handleError(_0x40e498,null));};exports[_0x590c('0x95')]=function(_0x4a44ce,_0x5a76bd,_0x5b6da4){var _0x32eeaf={};var _0x4145de={};var _0x3ccf05;var _0x11b9eb;return db[_0x590c('0x2f')][_0x590c('0x68')]({'where':{'id':_0x4a44ce['params']['id']}})[_0x590c('0x28')](handleEntityNotFound(_0x5a76bd,null))[_0x590c('0x28')](function(_0x3b2e68){if(_0x3b2e68){_0x3ccf05=_0x3b2e68;_0x4145de['model']=_[_0x590c('0x36')](db['User'][_0x590c('0x30')]);_0x4145de[_0x590c('0x35')]=_['keys'](_0x4a44ce['query']);_0x4145de[_0x590c('0x37')]=_[_0x590c('0x38')](_0x4145de[_0x590c('0x34')],_0x4145de['query']);_0x32eeaf[_0x590c('0x39')]=_[_0x590c('0x38')](_0x4145de[_0x590c('0x34')],qs['fields'](_0x4a44ce['query'][_0x590c('0x3a')]));_0x32eeaf[_0x590c('0x39')]=_0x32eeaf['attributes'][_0x590c('0x3b')]?_0x32eeaf[_0x590c('0x39')]:_0x4145de[_0x590c('0x34')];_0x32eeaf[_0x590c('0x6f')]=qs[_0x590c('0x96')](_0x4a44ce[_0x590c('0x35')][_0x590c('0x96')]);_0x32eeaf['where']=qs[_0x590c('0x37')](_['pick'](_0x4a44ce['query'],_0x4145de['filters']));if(_0x4a44ce[_0x590c('0x35')]['filter']){_0x32eeaf[_0x590c('0x40')]=_[_0x590c('0x41')](_0x32eeaf['where'],{'$or':_[_0x590c('0x2e')](_0x32eeaf['attributes'],function(_0xad0e4f){var _0x42cb5f={};_0x42cb5f[_0xad0e4f]={'$like':'%'+_0x4a44ce['query']['filter']+'%'};return _0x42cb5f;})});}_0x32eeaf=_[_0x590c('0x41')]({},_0x32eeaf,_0x4a44ce[_0x590c('0x70')]);return _0x3ccf05[_0x590c('0x95')](_0x32eeaf);}})[_0x590c('0x28')](function(_0x25d3ae){if(_0x25d3ae){_0x11b9eb=_0x25d3ae['length'];if(!_0x4a44ce['query'][_0x590c('0x3c')]('nolimit')){_0x32eeaf[_0x590c('0x23')]=qs['limit'](_0x4a44ce[_0x590c('0x35')][_0x590c('0x23')]);_0x32eeaf[_0x590c('0x24')]=qs[_0x590c('0x24')](_0x4a44ce[_0x590c('0x35')][_0x590c('0x24')]);}return _0x3ccf05[_0x590c('0x95')](_0x32eeaf);}})[_0x590c('0x28')](function(_0x288a59){if(_0x288a59){return _0x288a59?{'count':_0x11b9eb,'rows':_0x288a59}:null;}})['then'](respondWithResult(_0x5a76bd,null))['catch'](handleError(_0x5a76bd,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index be080b3..8c40d51 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 _0xcf74=['Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x592050,_0x3cbdf2){var _0x5bebe6=function(_0x3cb677){while(--_0x3cb677){_0x592050['push'](_0x592050['shift']());}};_0x5bebe6(++_0x3cbdf2);}(_0xcf74,0x11c));var _0x4cf7=function(_0x4e6cc9,_0x49ffc3){_0x4e6cc9=_0x4e6cc9-0x0;var _0x4b8af8=_0xcf74[_0x4e6cc9];return _0x4b8af8;};'use strict';var EventEmitter=require(_0x4cf7('0x0'));var Team=require(_0x4cf7('0x1'))['db'][_0x4cf7('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x4cf7('0x3')](0x0);var events={'afterCreate':_0x4cf7('0x4'),'afterUpdate':_0x4cf7('0x5'),'afterDestroy':_0x4cf7('0x6')};function emitEvent(_0x2695ef){return function(_0x4bc46e,_0x69f0ed,_0x46778c){TeamEvents[_0x4cf7('0x7')](_0x2695ef+':'+_0x4bc46e['id'],_0x4bc46e);TeamEvents[_0x4cf7('0x7')](_0x2695ef,_0x4bc46e);_0x46778c(null);};}for(var e in events){if(events[_0x4cf7('0x8')](e)){var event=events[e];Team[_0x4cf7('0x9')](e,emitEvent(event));}}module[_0x4cf7('0xa')]=TeamEvents; \ No newline at end of file +var _0xdc48=['../../mysqldb','Team','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x56a81e,_0x2eb2e3){var _0x1fbdf0=function(_0x53f11c){while(--_0x53f11c){_0x56a81e['push'](_0x56a81e['shift']());}};_0x1fbdf0(++_0x2eb2e3);}(_0xdc48,0xa9));var _0x8dc4=function(_0x4f6ea6,_0x5affdd){_0x4f6ea6=_0x4f6ea6-0x0;var _0x15619a=_0xdc48[_0x4f6ea6];return _0x15619a;};'use strict';var EventEmitter=require(_0x8dc4('0x0'));var Team=require(_0x8dc4('0x1'))['db'][_0x8dc4('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x8dc4('0x3')](0x0);var events={'afterCreate':_0x8dc4('0x4'),'afterUpdate':_0x8dc4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x30906d){return function(_0x271010,_0x26892c,_0x4417fd){TeamEvents[_0x8dc4('0x6')](_0x30906d+':'+_0x271010['id'],_0x271010);TeamEvents['emit'](_0x30906d,_0x271010);_0x4417fd(null);};}for(var e in events){if(events[_0x8dc4('0x7')](e)){var event=events[e];Team[_0x8dc4('0x8')](e,emitEvent(event));}}module[_0x8dc4('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2bd6038..60fc89f 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 _0x8577=['define','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5595dc,_0x303b35){var _0x3e57e8=function(_0x5794c4){while(--_0x5794c4){_0x5595dc['push'](_0x5595dc['shift']());}};_0x3e57e8(++_0x303b35);}(_0x8577,0x15f));var _0x7857=function(_0x22314a,_0x3274e6){_0x22314a=_0x22314a-0x0;var _0x4c758c=_0x8577[_0x22314a];return _0x4c758c;};'use strict';var _=require('lodash');var util=require(_0x7857('0x0'));var logger=require('../../config/logger')(_0x7857('0x1'));var moment=require(_0x7857('0x2'));var BPromise=require(_0x7857('0x3'));var rp=require(_0x7857('0x4'));var fs=require('fs');var path=require(_0x7857('0x5'));var rimraf=require(_0x7857('0x6'));var config=require(_0x7857('0x7'));var attributes=require('./team.attributes');module[_0x7857('0x8')]=function(_0x31ebc3,_0x21f833){return _0x31ebc3[_0x7857('0x9')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fc1=['moment','request-promise','path','rimraf','../../config/environment','./team.attributes','define','Team','teams','lodash','util','../../config/logger','api'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0x4fc1,0x71));var _0x14fc=function(_0x14deda,_0x1f883f){_0x14deda=_0x14deda-0x0;var _0x5cf0cb=_0x4fc1[_0x14deda];return _0x5cf0cb;};'use strict';var _=require(_0x14fc('0x0'));var util=require(_0x14fc('0x1'));var logger=require(_0x14fc('0x2'))(_0x14fc('0x3'));var moment=require(_0x14fc('0x4'));var BPromise=require('bluebird');var rp=require(_0x14fc('0x5'));var fs=require('fs');var path=require(_0x14fc('0x6'));var rimraf=require(_0x14fc('0x7'));var config=require(_0x14fc('0x8'));var attributes=require(_0x14fc('0x9'));module['exports']=function(_0x5d4ba4,_0x16b380){return _0x5d4ba4[_0x14fc('0xa')](_0x14fc('0xb'),attributes,{'tableName':_0x14fc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index ea97a16..9782808 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 _0xbb25=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error'];(function(_0x21c3b9,_0x92a455){var _0x26bfc9=function(_0x18e845){while(--_0x18e845){_0x21c3b9['push'](_0x21c3b9['shift']());}};_0x26bfc9(++_0x92a455);}(_0xbb25,0xc6));var _0x5bb2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbb25[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5bb2('0x0'));var util=require(_0x5bb2('0x1'));var moment=require(_0x5bb2('0x2'));var BPromise=require(_0x5bb2('0x3'));var rs=require(_0x5bb2('0x4'));var fs=require('fs');var Redis=require(_0x5bb2('0x5'));var db=require(_0x5bb2('0x6'))['db'];var utils=require(_0x5bb2('0x7'));var logger=require(_0x5bb2('0x8'))(_0x5bb2('0x9'));var config=require(_0x5bb2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5bb2('0xb')][_0x5bb2('0xc')]({'port':0x232a});config[_0x5bb2('0xd')]=_[_0x5bb2('0xe')](config[_0x5bb2('0xd')],{'host':_0x5bb2('0xf'),'port':0x18eb});var socket=require(_0x5bb2('0x10'))(new Redis(config[_0x5bb2('0xd')]));require(_0x5bb2('0x11'))[_0x5bb2('0x12')](socket);function respondWithRpcPromise(_0x445034,_0x7af8bf,_0x262128){return new BPromise(function(_0x52363d,_0x1afeaf){return client[_0x5bb2('0x13')](_0x445034,_0x262128)[_0x5bb2('0x14')](function(_0x260e63){logger[_0x5bb2('0x15')](_0x5bb2('0x16'),_0x7af8bf,_0x5bb2('0x17'));logger['debug'](_0x5bb2('0x18'),_0x7af8bf,_0x5bb2('0x17'),JSON['stringify'](_0x260e63));if(_0x260e63[_0x5bb2('0x19')]){if(_0x260e63[_0x5bb2('0x19')]['code']===0x1f4){logger['error'](_0x5bb2('0x16'),_0x7af8bf,_0x260e63[_0x5bb2('0x19')][_0x5bb2('0x1a')]);return _0x1afeaf(_0x260e63[_0x5bb2('0x19')][_0x5bb2('0x1a')]);}logger['error']('Team,\x20%s,\x20%s',_0x7af8bf,_0x260e63[_0x5bb2('0x19')][_0x5bb2('0x1a')]);return _0x52363d(_0x260e63[_0x5bb2('0x19')]['message']);}else{logger['info'](_0x5bb2('0x16'),_0x7af8bf,_0x5bb2('0x17'));_0x52363d(_0x260e63[_0x5bb2('0x1b')][_0x5bb2('0x1a')]);}})['catch'](function(_0x536477){logger[_0x5bb2('0x19')](_0x5bb2('0x16'),_0x7af8bf,_0x536477);_0x1afeaf(_0x536477);});});} \ No newline at end of file +var _0x6b81=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./team.socket','register','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x2cef0c,_0x53c0ad){var _0x55c612=function(_0x48e678){while(--_0x48e678){_0x2cef0c['push'](_0x2cef0c['shift']());}};_0x55c612(++_0x53c0ad);}(_0x6b81,0x16c));var _0x16b8=function(_0xc153db,_0x516c10){_0xc153db=_0xc153db-0x0;var _0x4dc97d=_0x6b81[_0xc153db];return _0x4dc97d;};'use strict';var _=require(_0x16b8('0x0'));var util=require(_0x16b8('0x1'));var moment=require(_0x16b8('0x2'));var BPromise=require(_0x16b8('0x3'));var rs=require(_0x16b8('0x4'));var fs=require('fs');var Redis=require(_0x16b8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x16b8('0x6'));var logger=require('../../config/logger')(_0x16b8('0x7'));var config=require(_0x16b8('0x8'));var jayson=require(_0x16b8('0x9'));var client=jayson[_0x16b8('0xa')]['http']({'port':0x232a});config[_0x16b8('0xb')]=_[_0x16b8('0xc')](config[_0x16b8('0xb')],{'host':_0x16b8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x16b8('0xb')]));require(_0x16b8('0xe'))[_0x16b8('0xf')](socket);function respondWithRpcPromise(_0xe3ad75,_0x3ded4b,_0x2a6e40){return new BPromise(function(_0x27b322,_0x112031){return client['request'](_0xe3ad75,_0x2a6e40)['then'](function(_0x4acfc5){logger['info'](_0x16b8('0x10'),_0x3ded4b,_0x16b8('0x11'));logger['debug'](_0x16b8('0x12'),_0x3ded4b,_0x16b8('0x11'),JSON[_0x16b8('0x13')](_0x4acfc5));if(_0x4acfc5[_0x16b8('0x14')]){if(_0x4acfc5[_0x16b8('0x14')][_0x16b8('0x15')]===0x1f4){logger[_0x16b8('0x14')](_0x16b8('0x10'),_0x3ded4b,_0x4acfc5[_0x16b8('0x14')]['message']);return _0x112031(_0x4acfc5['error'][_0x16b8('0x16')]);}logger[_0x16b8('0x14')](_0x16b8('0x10'),_0x3ded4b,_0x4acfc5[_0x16b8('0x14')][_0x16b8('0x16')]);return _0x27b322(_0x4acfc5[_0x16b8('0x14')][_0x16b8('0x16')]);}else{logger[_0x16b8('0x17')](_0x16b8('0x10'),_0x3ded4b,_0x16b8('0x11'));_0x27b322(_0x4acfc5[_0x16b8('0x18')][_0x16b8('0x16')]);}})[_0x16b8('0x19')](function(_0x44222a){logger['error']('Team,\x20%s,\x20%s',_0x3ded4b,_0x44222a);_0x112031(_0x44222a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 2951a1c..3deb858 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 _0xb9f4=['remove','update','emit','removeListener','length','./team.events'];(function(_0x26fe9f,_0x345c2a){var _0x25e4c6=function(_0x1d33b6){while(--_0x1d33b6){_0x26fe9f['push'](_0x26fe9f['shift']());}};_0x25e4c6(++_0x345c2a);}(_0xb9f4,0x101));var _0x4b9f=function(_0x14f138,_0x15a22e){_0x14f138=_0x14f138-0x0;var _0x19df83=_0xb9f4[_0x14f138];return _0x19df83;};'use strict';var TeamEvents=require(_0x4b9f('0x0'));var events=['save',_0x4b9f('0x1'),_0x4b9f('0x2')];function createListener(_0x4ea0f6,_0x474263){return function(_0x44eca0){_0x474263[_0x4b9f('0x3')](_0x4ea0f6,_0x44eca0);};}function removeListener(_0xb818c8,_0x17e7d8){return function(){TeamEvents[_0x4b9f('0x4')](_0xb818c8,_0x17e7d8);};}exports['register']=function(_0x58cdf4){for(var _0x3162fd=0x0,_0x10d15e=events[_0x4b9f('0x5')];_0x3162fd<_0x10d15e;_0x3162fd++){var _0x24f575=events[_0x3162fd];var _0x3f6936=createListener('team:'+_0x24f575,_0x58cdf4);TeamEvents['on'](_0x24f575,_0x3f6936);}}; \ No newline at end of file +var _0x9879=['update','emit','removeListener','register','length','save','remove'];(function(_0x38ff2f,_0x21bcf9){var _0x175932=function(_0x16c970){while(--_0x16c970){_0x38ff2f['push'](_0x38ff2f['shift']());}};_0x175932(++_0x21bcf9);}(_0x9879,0x98));var _0x9987=function(_0x35e05a,_0x25317e){_0x35e05a=_0x35e05a-0x0;var _0x5ef93c=_0x9879[_0x35e05a];return _0x5ef93c;};'use strict';var TeamEvents=require('./team.events');var events=[_0x9987('0x0'),_0x9987('0x1'),_0x9987('0x2')];function createListener(_0x1df4b1,_0x15471b){return function(_0x25f8c9){_0x15471b[_0x9987('0x3')](_0x1df4b1,_0x25f8c9);};}function removeListener(_0x2ab2a8,_0x37ebe8){return function(){TeamEvents[_0x9987('0x4')](_0x2ab2a8,_0x37ebe8);};}exports[_0x9987('0x5')]=function(_0x473510){for(var _0x15193d=0x0,_0xce52bb=events[_0x9987('0x6')];_0x15193d<_0xce52bb;_0x15193d++){var _0x555bb0=events[_0x15193d];var _0x1cf155=createListener('team:'+_0x555bb0,_0x473510);TeamEvents['on'](_0x555bb0,_0x1cf155);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 78e1caa..7e45d00 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 _0xd2ea=['sequelize','exports','INTEGER'];(function(_0x1bce9d,_0x59076){var _0x18aba5=function(_0x31ab02){while(--_0x31ab02){_0x1bce9d['push'](_0x1bce9d['shift']());}};_0x18aba5(++_0x59076);}(_0xd2ea,0x15f));var _0xad2e=function(_0x50c290,_0x396e17){_0x50c290=_0x50c290-0x0;var _0x351091=_0xd2ea[_0x50c290];return _0x351091;};'use strict';var Sequelize=require(_0xad2e('0x0'));module[_0xad2e('0x1')]={'TeamId':{'type':Sequelize[_0xad2e('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xad2e('0x2')]}}; \ No newline at end of file +var _0xc36a=['sequelize','exports','INTEGER'];(function(_0x2543a7,_0x58c8ae){var _0x54674b=function(_0x2c7e50){while(--_0x2c7e50){_0x2543a7['push'](_0x2543a7['shift']());}};_0x54674b(++_0x58c8ae);}(_0xc36a,0x180));var _0xac36=function(_0x48f81f,_0x48fb4a){_0x48f81f=_0x48f81f-0x0;var _0x2c98b5=_0xc36a[_0x48f81f];return _0x2c98b5;};'use strict';var Sequelize=require(_0xac36('0x0'));module[_0xac36('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xac36('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index d5348df..4393655 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 _0x9c02=['../../config/logger','path','../../config/environment','exports','define','TeamVoicePrefix','lodash','util'];(function(_0x55e648,_0x541baf){var _0x3e02a2=function(_0x5dc750){while(--_0x5dc750){_0x55e648['push'](_0x55e648['shift']());}};_0x3e02a2(++_0x541baf);}(_0x9c02,0x196));var _0x29c0=function(_0x36992b,_0x146b5a){_0x36992b=_0x36992b-0x0;var _0x489beb=_0x9c02[_0x36992b];return _0x489beb;};'use strict';var _=require(_0x29c0('0x0'));var util=require(_0x29c0('0x1'));var logger=require(_0x29c0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x29c0('0x3'));var rimraf=require('rimraf');var config=require(_0x29c0('0x4'));var attributes=require('./teamVoicePrefix.attributes');module[_0x29c0('0x5')]=function(_0x4bc5cf,_0x2fb607){return _0x4bc5cf[_0x29c0('0x6')](_0x29c0('0x7'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6d7=['util','api','moment','bluebird','request-promise','rimraf','exports','define','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x3f0d11,_0x568808){var _0xdc0af7=function(_0x14b04c){while(--_0x14b04c){_0x3f0d11['push'](_0x3f0d11['shift']());}};_0xdc0af7(++_0x568808);}(_0xe6d7,0x1ae));var _0x7e6d=function(_0x5c804e,_0x583316){_0x5c804e=_0x5c804e-0x0;var _0x317514=_0xe6d7[_0x5c804e];return _0x317514;};'use strict';var _=require('lodash');var util=require(_0x7e6d('0x0'));var logger=require('../../config/logger')(_0x7e6d('0x1'));var moment=require(_0x7e6d('0x2'));var BPromise=require(_0x7e6d('0x3'));var rp=require(_0x7e6d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e6d('0x5'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0x7e6d('0x6')]=function(_0x23c09e,_0x4faafe){return _0x23c09e[_0x7e6d('0x7')](_0x7e6d('0x8'),attributes,{'tableName':_0x7e6d('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 5a9c4ce..b43d218 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x54f1cf,_0x426340){var _0x25bb59=function(_0x489f06){while(--_0x489f06){_0x54f1cf['push'](_0x54f1cf['shift']());}};_0x25bb59(++_0x426340);}(_0xe706,0xa3));var _0x6e70=function(_0x27dfe7,_0x3acd6f){_0x27dfe7=_0x27dfe7-0x0;var _0x9d647c=_0xe706[_0x27dfe7];return _0x9d647c;};'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(_0x3a6ad5,_0x29a2e0){var _0x568a9c=function(_0x302e98){while(--_0x302e98){_0x3a6ad5['push'](_0x3a6ad5['shift']());}};_0x568a9c(++_0x29a2e0);}(_0xe706,0xa3));var _0x6e70=function(_0x4b5409,_0x472b71){_0x4b5409=_0x4b5409-0x0;var _0x90b623=_0xe706[_0x4b5409];return _0x90b623;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index f297dab..1c5665c 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 _0x9cbc=['sequelize','INTEGER'];(function(_0x257b95,_0x3f9e4d){var _0x12ca02=function(_0x13448b){while(--_0x13448b){_0x257b95['push'](_0x257b95['shift']());}};_0x12ca02(++_0x3f9e4d);}(_0x9cbc,0x1f2));var _0xc9cb=function(_0x295fe9,_0x345828){_0x295fe9=_0x295fe9-0x0;var _0x3b80df=_0x9cbc[_0x295fe9];return _0x3b80df;};'use strict';var Sequelize=require(_0xc9cb('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc9cb('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3838=['INTEGER','sequelize','exports'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x3838,0xca));var _0x8383=function(_0x4419f7,_0x2b8301){_0x4419f7=_0x4419f7-0x0;var _0x3cbe4b=_0x3838[_0x4419f7];return _0x3cbe4b;};'use strict';var Sequelize=require(_0x8383('0x0'));module[_0x8383('0x1')]={'penalty':{'type':Sequelize[_0x8383('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 5fa535e..14deb1b 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 _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','team_has_voice_queues','lodash'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xe14d,0x1ee));var _0xde14=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xe14d[_0x34021d];return _0x16597b;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('TeamVoiceQueue',attributes,{'tableName':_0xde14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40ca=['bluebird','request-promise','rimraf','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','api','moment'];(function(_0x5d57c7,_0x3547be){var _0x2ee0ee=function(_0x4da696){while(--_0x4da696){_0x5d57c7['push'](_0x5d57c7['shift']());}};_0x2ee0ee(++_0x3547be);}(_0x40ca,0x1a1));var _0xa40c=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x40ca[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xa40c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa40c('0x1'));var moment=require(_0xa40c('0x2'));var BPromise=require(_0xa40c('0x3'));var rp=require(_0xa40c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa40c('0x5'));var config=require('../../config/environment');var attributes=require(_0xa40c('0x6'));module['exports']=function(_0x46eff2,_0x4e1eb2){return _0x46eff2[_0xa40c('0x7')](_0xa40c('0x8'),attributes,{'tableName':_0xa40c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 18e5848..f395e16 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 _0x038d=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','then','info','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','moment','bluebird'];(function(_0x136031,_0x4c913f){var _0x943566=function(_0x2f07be){while(--_0x2f07be){_0x136031['push'](_0x136031['shift']());}};_0x943566(++_0x4c913f);}(_0x038d,0xae));var _0xd038=function(_0x5289de,_0x1aa90a){_0x5289de=_0x5289de-0x0;var _0x58ea47=_0x038d[_0x5289de];return _0x58ea47;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd038('0x0'));var BPromise=require(_0xd038('0x1'));var rs=require(_0xd038('0x2'));var fs=require('fs');var Redis=require(_0xd038('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd038('0x4'))(_0xd038('0x5'));var config=require(_0xd038('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x457b2f,_0x1f2511,_0x5d4b85){return new BPromise(function(_0x61a8fb,_0xd847cf){return client['request'](_0x457b2f,_0x5d4b85)[_0xd038('0x7')](function(_0x23703d){logger[_0xd038('0x8')](_0xd038('0x9'),_0x1f2511,'request\x20sent');logger['debug'](_0xd038('0xa'),_0x1f2511,_0xd038('0xb'),JSON['stringify'](_0x23703d));if(_0x23703d[_0xd038('0xc')]){if(_0x23703d[_0xd038('0xc')][_0xd038('0xd')]===0x1f4){logger['error'](_0xd038('0x9'),_0x1f2511,_0x23703d[_0xd038('0xc')][_0xd038('0xe')]);return _0xd847cf(_0x23703d['error'][_0xd038('0xe')]);}logger[_0xd038('0xc')](_0xd038('0x9'),_0x1f2511,_0x23703d['error']['message']);return _0x61a8fb(_0x23703d['error'][_0xd038('0xe')]);}else{logger[_0xd038('0x8')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1f2511,_0xd038('0xb'));_0x61a8fb(_0x23703d['result']['message']);}})[_0xd038('0xf')](function(_0x4ff355){logger[_0xd038('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1f2511,_0x4ff355);_0xd847cf(_0x4ff355);});});} \ No newline at end of file +var _0x0214=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0x0214,0x15f));var _0x4021=function(_0x17777a,_0x31b31d){_0x17777a=_0x17777a-0x0;var _0x2c89f6=_0x0214[_0x17777a];return _0x2c89f6;};'use strict';var _=require(_0x4021('0x0'));var util=require(_0x4021('0x1'));var moment=require(_0x4021('0x2'));var BPromise=require(_0x4021('0x3'));var rs=require(_0x4021('0x4'));var fs=require('fs');var Redis=require(_0x4021('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4021('0x6'));var logger=require(_0x4021('0x7'))(_0x4021('0x8'));var config=require(_0x4021('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4021('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52a4a4,_0x2613ba,_0x55fb93){return new BPromise(function(_0x2c451a,_0xee0d68){return client[_0x4021('0xb')](_0x52a4a4,_0x55fb93)[_0x4021('0xc')](function(_0x3d8e55){logger[_0x4021('0xd')](_0x4021('0xe'),_0x2613ba,_0x4021('0xf'));logger[_0x4021('0x10')](_0x4021('0x11'),_0x2613ba,_0x4021('0xf'),JSON['stringify'](_0x3d8e55));if(_0x3d8e55[_0x4021('0x12')]){if(_0x3d8e55['error'][_0x4021('0x13')]===0x1f4){logger[_0x4021('0x12')](_0x4021('0xe'),_0x2613ba,_0x3d8e55[_0x4021('0x12')][_0x4021('0x14')]);return _0xee0d68(_0x3d8e55['error'][_0x4021('0x14')]);}logger[_0x4021('0x12')](_0x4021('0xe'),_0x2613ba,_0x3d8e55[_0x4021('0x12')][_0x4021('0x14')]);return _0x2c451a(_0x3d8e55['error'][_0x4021('0x14')]);}else{logger[_0x4021('0xd')](_0x4021('0xe'),_0x2613ba,'request\x20sent');_0x2c451a(_0x3d8e55['result'][_0x4021('0x14')]);}})[_0x4021('0x15')](function(_0x3e15d0){logger[_0x4021('0x12')](_0x4021('0xe'),_0x2613ba,_0x3e15d0);_0xee0d68(_0x3e15d0);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 6483151..1401af4 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 _0x8ff9=['show','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','index','get','/:id'];(function(_0x45ce90,_0x114609){var _0x313c45=function(_0x55102a){while(--_0x55102a){_0x45ce90['push'](_0x45ce90['shift']());}};_0x313c45(++_0x114609);}(_0x8ff9,0x1a6));var _0x98ff=function(_0x419510,_0x21b23d){_0x419510=_0x419510-0x0;var _0x10630=_0x8ff9[_0x419510];return _0x10630;};'use strict';var multer=require(_0x98ff('0x0'));var util=require(_0x98ff('0x1'));var path=require(_0x98ff('0x2'));var timeout=require(_0x98ff('0x3'));var express=require(_0x98ff('0x4'));var router=express[_0x98ff('0x5')]();var fs_extra=require(_0x98ff('0x6'));var auth=require(_0x98ff('0x7'));var interaction=require(_0x98ff('0x8'));var config=require(_0x98ff('0x9'));var controller=require(_0x98ff('0xa'));router['get']('/',auth[_0x98ff('0xb')](),controller[_0x98ff('0xc')]);router[_0x98ff('0xd')](_0x98ff('0xe'),auth[_0x98ff('0xb')](),controller[_0x98ff('0xf')]);router['post']('/',auth[_0x98ff('0xb')](),controller['create']);router['put'](_0x98ff('0xe'),auth[_0x98ff('0xb')](),controller[_0x98ff('0x10')]);router[_0x98ff('0x11')](_0x98ff('0xe'),auth['isAuthenticated'](),controller[_0x98ff('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0424=['isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','./template.controller','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0424,0x159));var _0x4042=function(_0x75e866,_0x30b4de){_0x75e866=_0x75e866-0x0;var _0x5e4b64=_0x0424[_0x75e866];return _0x5e4b64;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4042('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4042('0x5'));router[_0x4042('0x6')]('/',auth[_0x4042('0x7')](),controller[_0x4042('0x8')]);router[_0x4042('0x6')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller['show']);router['post']('/',auth[_0x4042('0x7')](),controller[_0x4042('0xa')]);router[_0x4042('0xb')]('/:id',auth[_0x4042('0x7')](),controller[_0x4042('0xc')]);router[_0x4042('0xd')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller[_0x4042('0xe')]);module[_0x4042('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 150a5a3..d140300 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 _0xe0d3=['STRING','TEXT','exports'];(function(_0x3d09c1,_0x117940){var _0x31a109=function(_0x19a09a){while(--_0x19a09a){_0x3d09c1['push'](_0x3d09c1['shift']());}};_0x31a109(++_0x117940);}(_0xe0d3,0x134));var _0x3e0d=function(_0x4e9a32,_0x406c13){_0x4e9a32=_0x4e9a32-0x0;var _0x496134=_0xe0d3[_0x4e9a32];return _0x496134;};'use strict';var Sequelize=require('sequelize');module[_0x3e0d('0x0')]={'name':{'type':Sequelize[_0x3e0d('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x3e0d('0x2')]}}; \ No newline at end of file +var _0xf413=['TEXT','exports','STRING'];(function(_0x2cb01e,_0x5df840){var _0xf41c4c=function(_0x4ac5bf){while(--_0x4ac5bf){_0x2cb01e['push'](_0x2cb01e['shift']());}};_0xf41c4c(++_0x5df840);}(_0xf413,0x151));var _0x3f41=function(_0x1adad6,_0x3bc49f){_0x1adad6=_0x1adad6-0x0;var _0x5b316d=_0xf413[_0x1adad6];return _0x5b316d;};'use strict';var Sequelize=require('sequelize');module[_0x3f41('0x0')]={'name':{'type':Sequelize[_0x3f41('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x3f41('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 8ab17e0..978f9a0 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 _0x8331=['status','end','json','offset','undefined','limit','reject','save','update','then','destroy','get','error','stack','name','send','map','Template','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','VIRTUAL','filter','merge','options','count','includeAll','findAll','rows','show','rawAttributes','include','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x20c9a8,_0x8adf2f){var _0x56a8cf=function(_0xac2a65){while(--_0xac2a65){_0x20c9a8['push'](_0x20c9a8['shift']());}};_0x56a8cf(++_0x8adf2f);}(_0x8331,0xe4));var _0x1833=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0x8331[_0x59d0cc];return _0x2ae79f;};'use strict';var emlformat=require(_0x1833('0x0'));var rimraf=require(_0x1833('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1833('0x2'));var rp=require(_0x1833('0x3'));var moment=require(_0x1833('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1833('0x5'));var util=require(_0x1833('0x6'));var path=require(_0x1833('0x7'));var sox=require(_0x1833('0x8'));var csv=require('to-csv');var ejs=require(_0x1833('0x9'));var fs=require('fs');var fs_extra=require(_0x1833('0xa'));var _=require(_0x1833('0xb'));var squel=require(_0x1833('0xc'));var crypto=require(_0x1833('0xd'));var jsforce=require(_0x1833('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1833('0xf'));var querystring=require(_0x1833('0x10'));var Papa=require(_0x1833('0x11'));var Redis=require(_0x1833('0x12'));var authService=require(_0x1833('0x13'));var qs=require(_0x1833('0x14'));var as=require(_0x1833('0x15'));var hardwareService=require(_0x1833('0x16'));var logger=require(_0x1833('0x17'))(_0x1833('0x18'));var utils=require(_0x1833('0x19'));var config=require(_0x1833('0x1a'));var licenseUtil=require(_0x1833('0x1b'));var db=require(_0x1833('0x1c'))['db'];function respondWithStatusCode(_0x1637ad,_0x455e80){_0x455e80=_0x455e80||0xcc;return function(_0x2184e2){if(_0x2184e2){return _0x1637ad[_0x1833('0x1d')](_0x455e80);}return _0x1637ad[_0x1833('0x1e')](_0x455e80)[_0x1833('0x1f')]();};}function respondWithResult(_0xda5d52,_0x1caadd){_0x1caadd=_0x1caadd||0xc8;return function(_0x1c1d5d){if(_0x1c1d5d){return _0xda5d52[_0x1833('0x1e')](_0x1caadd)[_0x1833('0x20')](_0x1c1d5d);}};}function respondWithFilteredResult(_0x432bdb,_0x2481d5){return function(_0x2fd2b3){if(_0x2fd2b3){var _0x35a915=typeof _0x2481d5[_0x1833('0x21')]===_0x1833('0x22')&&typeof _0x2481d5[_0x1833('0x23')]===_0x1833('0x22');var _0x3bca04=_0x2fd2b3['count'];var _0x1d70f3=_0x35a915?0x0:_0x2481d5[_0x1833('0x21')];var _0x1f6188=_0x35a915?_0x2fd2b3['count']:_0x2481d5[_0x1833('0x21')]+_0x2481d5[_0x1833('0x23')];var _0xcd230a;if(_0x1f6188>=_0x3bca04){_0x1f6188=_0x3bca04;_0xcd230a=0xc8;}else{_0xcd230a=0xce;}_0x432bdb[_0x1833('0x1e')](_0xcd230a);return _0x432bdb['set']('Content-Range',_0x1d70f3+'-'+_0x1f6188+'/'+_0x3bca04)[_0x1833('0x20')](_0x2fd2b3);}return null;};}function patchUpdates(_0x2a6a7c){return function(_0x3c0ba7){try{jsonpatch['apply'](_0x3c0ba7,_0x2a6a7c,!![]);}catch(_0x499eb1){return BPromise[_0x1833('0x24')](_0x499eb1);}return _0x3c0ba7[_0x1833('0x25')]();};}function saveUpdates(_0x516e6d,_0x2c84eb){return function(_0x457ce4){if(_0x457ce4){return _0x457ce4[_0x1833('0x26')](_0x516e6d)[_0x1833('0x27')](function(_0xfec777){return _0xfec777;});}return null;};}function removeEntity(_0xe1628d,_0x1a9f9e){return function(_0x26f962){if(_0x26f962){return _0x26f962[_0x1833('0x28')]()['then'](function(){var _0xfad76=_0x26f962[_0x1833('0x29')]({'plain':!![]});var _0x210431='Templates';return db['UserProfileResource'][_0x1833('0x28')]({'where':{'type':_0x210431,'resourceId':_0xfad76['id']}})[_0x1833('0x27')](function(){return _0x26f962;});})['then'](function(){_0xe1628d[_0x1833('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34e6bd,_0x50fa8b){return function(_0x26c25f){if(!_0x26c25f){_0x34e6bd[_0x1833('0x1d')](0x194);}return _0x26c25f;};}function handleError(_0x3d9894,_0x3ce924){_0x3ce924=_0x3ce924||0x1f4;return function(_0x4fb356){logger[_0x1833('0x2a')](_0x4fb356[_0x1833('0x2b')]);if(_0x4fb356['name']){delete _0x4fb356[_0x1833('0x2c')];}_0x3d9894[_0x1833('0x1e')](_0x3ce924)[_0x1833('0x2d')](_0x4fb356);};}exports['index']=function(_0x5478c0,_0xb1c47f){var _0x5e8423={},_0x404913={},_0x2b9409={'count':0x0,'rows':[]};var _0x96aa65=_[_0x1833('0x2e')](db[_0x1833('0x2f')]['rawAttributes'],function(_0x1ca55f){return{'name':_0x1ca55f[_0x1833('0x30')],'type':_0x1ca55f[_0x1833('0x31')][_0x1833('0x32')]};});_0x404913[_0x1833('0x33')]=_['map'](_0x96aa65,_0x1833('0x2c'));_0x404913[_0x1833('0x34')]=_[_0x1833('0x35')](_0x5478c0[_0x1833('0x34')]);_0x404913[_0x1833('0x36')]=_['intersection'](_0x404913['model'],_0x404913[_0x1833('0x34')]);_0x5e8423[_0x1833('0x37')]=_[_0x1833('0x38')](_0x404913[_0x1833('0x33')],qs[_0x1833('0x39')](_0x5478c0[_0x1833('0x34')]['fields']));_0x5e8423[_0x1833('0x37')]=_0x5e8423[_0x1833('0x37')][_0x1833('0x3a')]?_0x5e8423[_0x1833('0x37')]:_0x404913[_0x1833('0x33')];if(!_0x5478c0['query']['hasOwnProperty'](_0x1833('0x3b'))){_0x5e8423[_0x1833('0x23')]=qs[_0x1833('0x23')](_0x5478c0[_0x1833('0x34')][_0x1833('0x23')]);_0x5e8423[_0x1833('0x21')]=qs[_0x1833('0x21')](_0x5478c0[_0x1833('0x34')]['offset']);}_0x5e8423[_0x1833('0x3c')]=qs[_0x1833('0x3d')](_0x5478c0[_0x1833('0x34')]['sort']);_0x5e8423['where']=qs[_0x1833('0x36')](_['pick'](_0x5478c0[_0x1833('0x34')],_0x404913[_0x1833('0x36')]),_0x96aa65);if(_0x5478c0[_0x1833('0x34')]['filter']){_0x5e8423['where']=_['merge'](_0x5e8423[_0x1833('0x3e')],{'$or':_[_0x1833('0x2e')](_0x96aa65,function(_0x817560){if(_0x817560[_0x1833('0x31')]!==_0x1833('0x3f')){var _0x6d1510={};_0x6d1510[_0x817560['name']]={'$like':'%'+_0x5478c0['query'][_0x1833('0x40')]+'%'};return _0x6d1510;}})});}_0x5e8423=_[_0x1833('0x41')]({},_0x5e8423,_0x5478c0[_0x1833('0x42')]);var _0x433c78={'where':_0x5e8423[_0x1833('0x3e')]};return db[_0x1833('0x2f')][_0x1833('0x43')](_0x433c78)[_0x1833('0x27')](function(_0x336cca){_0x2b9409[_0x1833('0x43')]=_0x336cca;if(_0x5478c0[_0x1833('0x34')][_0x1833('0x44')]){_0x5e8423['include']=[{'all':!![]}];}return db[_0x1833('0x2f')][_0x1833('0x45')](_0x5e8423);})[_0x1833('0x27')](function(_0x492ccf){_0x2b9409[_0x1833('0x46')]=_0x492ccf;return _0x2b9409;})[_0x1833('0x27')](respondWithFilteredResult(_0xb1c47f,_0x5e8423))['catch'](handleError(_0xb1c47f,null));};exports[_0x1833('0x47')]=function(_0x5cf067,_0xb6dd93){var _0x3e47b9={'raw':!![],'where':{'id':_0x5cf067['params']['id']}},_0x139fc6={};_0x139fc6['model']=_[_0x1833('0x35')](db[_0x1833('0x2f')][_0x1833('0x48')]);_0x139fc6[_0x1833('0x34')]=_[_0x1833('0x35')](_0x5cf067[_0x1833('0x34')]);_0x139fc6[_0x1833('0x36')]=_[_0x1833('0x38')](_0x139fc6[_0x1833('0x33')],_0x139fc6['query']);_0x3e47b9[_0x1833('0x37')]=_[_0x1833('0x38')](_0x139fc6[_0x1833('0x33')],qs[_0x1833('0x39')](_0x5cf067[_0x1833('0x34')][_0x1833('0x39')]));_0x3e47b9[_0x1833('0x37')]=_0x3e47b9['attributes'][_0x1833('0x3a')]?_0x3e47b9[_0x1833('0x37')]:_0x139fc6[_0x1833('0x33')];if(_0x5cf067[_0x1833('0x34')][_0x1833('0x44')]){_0x3e47b9[_0x1833('0x49')]=[{'all':!![]}];}_0x3e47b9=_['merge']({},_0x3e47b9,_0x5cf067['options']);return db[_0x1833('0x2f')]['find'](_0x3e47b9)[_0x1833('0x27')](handleEntityNotFound(_0xb6dd93,null))['then'](respondWithResult(_0xb6dd93,null))[_0x1833('0x4a')](handleError(_0xb6dd93,null));};exports[_0x1833('0x4b')]=function(_0x43bb5c,_0xde8dc1){return db[_0x1833('0x2f')][_0x1833('0x4b')](_0x43bb5c['body'],{})[_0x1833('0x27')](function(_0x2e2112){var _0xebd738=_0x43bb5c['user'][_0x1833('0x29')]({'plain':!![]});if(!_0xebd738)throw new Error(_0x1833('0x4c'));if(_0xebd738[_0x1833('0x4d')]===_0x1833('0x4e')){var _0x33207a=_0x2e2112[_0x1833('0x29')]({'plain':!![]});var _0x235640='Templates';return db[_0x1833('0x4f')][_0x1833('0x50')]({'where':{'name':_0x235640,'userProfileId':_0xebd738[_0x1833('0x51')]},'raw':!![]})[_0x1833('0x27')](function(_0x102ac0){if(_0x102ac0&&_0x102ac0['autoAssociation']===0x0){return db[_0x1833('0x52')][_0x1833('0x4b')]({'name':_0x33207a[_0x1833('0x2c')],'resourceId':_0x33207a['id'],'type':_0x102ac0[_0x1833('0x2c')],'sectionId':_0x102ac0['id']},{})[_0x1833('0x27')](function(){return _0x2e2112;});}else{return _0x2e2112;}})[_0x1833('0x4a')](function(_0x471e39){logger['error'](_0x1833('0x53'),_0x471e39);throw _0x471e39;});}return _0x2e2112;})[_0x1833('0x27')](respondWithResult(_0xde8dc1,0xc9))[_0x1833('0x4a')](handleError(_0xde8dc1,null));};exports[_0x1833('0x26')]=function(_0x16880f,_0x42b231){if(_0x16880f[_0x1833('0x54')]['id']){delete _0x16880f[_0x1833('0x54')]['id'];}return db[_0x1833('0x2f')][_0x1833('0x50')]({'where':{'id':_0x16880f[_0x1833('0x55')]['id']}})[_0x1833('0x27')](handleEntityNotFound(_0x42b231,null))[_0x1833('0x27')](saveUpdates(_0x16880f[_0x1833('0x54')],null))[_0x1833('0x27')](respondWithResult(_0x42b231,null))[_0x1833('0x4a')](handleError(_0x42b231,null));};exports[_0x1833('0x28')]=function(_0x5eb984,_0x4b1785){return db[_0x1833('0x2f')]['find']({'where':{'id':_0x5eb984[_0x1833('0x55')]['id']}})[_0x1833('0x27')](handleEntityNotFound(_0x4b1785,null))['then'](removeEntity(_0x4b1785,null))['catch'](handleError(_0x4b1785,null));}; \ No newline at end of file +var _0xa5e6=['undefined','count','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','error','stack','name','index','map','Template','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit'];(function(_0x4ad6a7,_0x122da5){var _0x498961=function(_0x335b47){while(--_0x335b47){_0x4ad6a7['push'](_0x4ad6a7['shift']());}};_0x498961(++_0x122da5);}(_0xa5e6,0x8a));var _0x6a5e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa5e6[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x6a5e('0x0'));var rimraf=require(_0x6a5e('0x1'));var zipdir=require(_0x6a5e('0x2'));var jsonpatch=require(_0x6a5e('0x3'));var rp=require(_0x6a5e('0x4'));var moment=require(_0x6a5e('0x5'));var BPromise=require(_0x6a5e('0x6'));var Mustache=require('mustache');var util=require(_0x6a5e('0x7'));var path=require(_0x6a5e('0x8'));var sox=require(_0x6a5e('0x9'));var csv=require('to-csv');var ejs=require(_0x6a5e('0xa'));var fs=require('fs');var fs_extra=require(_0x6a5e('0xb'));var _=require(_0x6a5e('0xc'));var squel=require(_0x6a5e('0xd'));var crypto=require('crypto');var jsforce=require(_0x6a5e('0xe'));var deskjs=require(_0x6a5e('0xf'));var toCsv=require(_0x6a5e('0x10'));var querystring=require(_0x6a5e('0x11'));var Papa=require(_0x6a5e('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6a5e('0x13'));var as=require(_0x6a5e('0x14'));var hardwareService=require(_0x6a5e('0x15'));var logger=require('../../config/logger')(_0x6a5e('0x16'));var utils=require(_0x6a5e('0x17'));var config=require(_0x6a5e('0x18'));var licenseUtil=require(_0x6a5e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48db70,_0xd80d93){_0xd80d93=_0xd80d93||0xcc;return function(_0x5476f4){if(_0x5476f4){return _0x48db70[_0x6a5e('0x1a')](_0xd80d93);}return _0x48db70[_0x6a5e('0x1b')](_0xd80d93)[_0x6a5e('0x1c')]();};}function respondWithResult(_0x52a362,_0x318509){_0x318509=_0x318509||0xc8;return function(_0x35b407){if(_0x35b407){return _0x52a362[_0x6a5e('0x1b')](_0x318509)[_0x6a5e('0x1d')](_0x35b407);}};}function respondWithFilteredResult(_0x423a17,_0x5a18c1){return function(_0x45d084){if(_0x45d084){var _0x125703=typeof _0x5a18c1[_0x6a5e('0x1e')]==='undefined'&&typeof _0x5a18c1[_0x6a5e('0x1f')]===_0x6a5e('0x20');var _0x1878bf=_0x45d084[_0x6a5e('0x21')];var _0x2f2ba4=_0x125703?0x0:_0x5a18c1[_0x6a5e('0x1e')];var _0x102f90=_0x125703?_0x45d084[_0x6a5e('0x21')]:_0x5a18c1[_0x6a5e('0x1e')]+_0x5a18c1[_0x6a5e('0x1f')];var _0xb3292b;if(_0x102f90>=_0x1878bf){_0x102f90=_0x1878bf;_0xb3292b=0xc8;}else{_0xb3292b=0xce;}_0x423a17[_0x6a5e('0x1b')](_0xb3292b);return _0x423a17['set']('Content-Range',_0x2f2ba4+'-'+_0x102f90+'/'+_0x1878bf)[_0x6a5e('0x1d')](_0x45d084);}return null;};}function patchUpdates(_0x36ec56){return function(_0xd96c1c){try{jsonpatch[_0x6a5e('0x22')](_0xd96c1c,_0x36ec56,!![]);}catch(_0x30ce54){return BPromise[_0x6a5e('0x23')](_0x30ce54);}return _0xd96c1c[_0x6a5e('0x24')]();};}function saveUpdates(_0x56dc86,_0x19e724){return function(_0x2137bc){if(_0x2137bc){return _0x2137bc[_0x6a5e('0x25')](_0x56dc86)[_0x6a5e('0x26')](function(_0x49cf83){return _0x49cf83;});}return null;};}function removeEntity(_0x66432,_0x40ba17){return function(_0x33a83a){if(_0x33a83a){return _0x33a83a['destroy']()[_0x6a5e('0x26')](function(){var _0x2edfe2=_0x33a83a[_0x6a5e('0x27')]({'plain':!![]});var _0x18fbfb=_0x6a5e('0x28');return db[_0x6a5e('0x29')][_0x6a5e('0x2a')]({'where':{'type':_0x18fbfb,'resourceId':_0x2edfe2['id']}})[_0x6a5e('0x26')](function(){return _0x33a83a;});})[_0x6a5e('0x26')](function(){_0x66432[_0x6a5e('0x1b')](0xcc)[_0x6a5e('0x1c')]();});}};}function handleEntityNotFound(_0x53b264,_0x170e59){return function(_0x1989ad){if(!_0x1989ad){_0x53b264[_0x6a5e('0x1a')](0x194);}return _0x1989ad;};}function handleError(_0x434000,_0x54f75a){_0x54f75a=_0x54f75a||0x1f4;return function(_0xeb9c04){logger[_0x6a5e('0x2b')](_0xeb9c04[_0x6a5e('0x2c')]);if(_0xeb9c04[_0x6a5e('0x2d')]){delete _0xeb9c04[_0x6a5e('0x2d')];}_0x434000[_0x6a5e('0x1b')](_0x54f75a)['send'](_0xeb9c04);};}exports[_0x6a5e('0x2e')]=function(_0x4e0a03,_0x328c93){var _0x4c678b={},_0x129841={},_0xe44ee6={'count':0x0,'rows':[]};var _0x487f9e=_[_0x6a5e('0x2f')](db[_0x6a5e('0x30')][_0x6a5e('0x31')],function(_0x2c2f6b){return{'name':_0x2c2f6b[_0x6a5e('0x32')],'type':_0x2c2f6b[_0x6a5e('0x33')][_0x6a5e('0x34')]};});_0x129841['model']=_['map'](_0x487f9e,'name');_0x129841[_0x6a5e('0x35')]=_[_0x6a5e('0x36')](_0x4e0a03[_0x6a5e('0x35')]);_0x129841[_0x6a5e('0x37')]=_[_0x6a5e('0x38')](_0x129841[_0x6a5e('0x39')],_0x129841[_0x6a5e('0x35')]);_0x4c678b[_0x6a5e('0x3a')]=_['intersection'](_0x129841[_0x6a5e('0x39')],qs[_0x6a5e('0x3b')](_0x4e0a03[_0x6a5e('0x35')][_0x6a5e('0x3b')]));_0x4c678b[_0x6a5e('0x3a')]=_0x4c678b[_0x6a5e('0x3a')][_0x6a5e('0x3c')]?_0x4c678b['attributes']:_0x129841[_0x6a5e('0x39')];if(!_0x4e0a03[_0x6a5e('0x35')][_0x6a5e('0x3d')]('nolimit')){_0x4c678b['limit']=qs['limit'](_0x4e0a03[_0x6a5e('0x35')][_0x6a5e('0x1f')]);_0x4c678b['offset']=qs[_0x6a5e('0x1e')](_0x4e0a03['query'][_0x6a5e('0x1e')]);}_0x4c678b['order']=qs['sort'](_0x4e0a03[_0x6a5e('0x35')]['sort']);_0x4c678b[_0x6a5e('0x3e')]=qs[_0x6a5e('0x37')](_[_0x6a5e('0x3f')](_0x4e0a03['query'],_0x129841['filters']),_0x487f9e);if(_0x4e0a03[_0x6a5e('0x35')][_0x6a5e('0x40')]){_0x4c678b[_0x6a5e('0x3e')]=_[_0x6a5e('0x41')](_0x4c678b['where'],{'$or':_['map'](_0x487f9e,function(_0x2d1978){if(_0x2d1978[_0x6a5e('0x33')]!==_0x6a5e('0x42')){var _0x32c15a={};_0x32c15a[_0x2d1978[_0x6a5e('0x2d')]]={'$like':'%'+_0x4e0a03[_0x6a5e('0x35')][_0x6a5e('0x40')]+'%'};return _0x32c15a;}})});}_0x4c678b=_[_0x6a5e('0x41')]({},_0x4c678b,_0x4e0a03[_0x6a5e('0x43')]);var _0x357558={'where':_0x4c678b[_0x6a5e('0x3e')]};return db[_0x6a5e('0x30')][_0x6a5e('0x21')](_0x357558)[_0x6a5e('0x26')](function(_0x4c8c72){_0xe44ee6[_0x6a5e('0x21')]=_0x4c8c72;if(_0x4e0a03[_0x6a5e('0x35')][_0x6a5e('0x44')]){_0x4c678b[_0x6a5e('0x45')]=[{'all':!![]}];}return db[_0x6a5e('0x30')][_0x6a5e('0x46')](_0x4c678b);})['then'](function(_0x2972ee){_0xe44ee6[_0x6a5e('0x47')]=_0x2972ee;return _0xe44ee6;})['then'](respondWithFilteredResult(_0x328c93,_0x4c678b))[_0x6a5e('0x48')](handleError(_0x328c93,null));};exports[_0x6a5e('0x49')]=function(_0x32c299,_0x297617){var _0x1c58b7={'raw':!![],'where':{'id':_0x32c299[_0x6a5e('0x4a')]['id']}},_0x4f04b0={};_0x4f04b0['model']=_[_0x6a5e('0x36')](db[_0x6a5e('0x30')][_0x6a5e('0x31')]);_0x4f04b0[_0x6a5e('0x35')]=_['keys'](_0x32c299[_0x6a5e('0x35')]);_0x4f04b0[_0x6a5e('0x37')]=_['intersection'](_0x4f04b0[_0x6a5e('0x39')],_0x4f04b0['query']);_0x1c58b7[_0x6a5e('0x3a')]=_[_0x6a5e('0x38')](_0x4f04b0[_0x6a5e('0x39')],qs['fields'](_0x32c299['query'][_0x6a5e('0x3b')]));_0x1c58b7['attributes']=_0x1c58b7[_0x6a5e('0x3a')][_0x6a5e('0x3c')]?_0x1c58b7[_0x6a5e('0x3a')]:_0x4f04b0[_0x6a5e('0x39')];if(_0x32c299['query'][_0x6a5e('0x44')]){_0x1c58b7['include']=[{'all':!![]}];}_0x1c58b7=_[_0x6a5e('0x41')]({},_0x1c58b7,_0x32c299[_0x6a5e('0x43')]);return db[_0x6a5e('0x30')][_0x6a5e('0x4b')](_0x1c58b7)[_0x6a5e('0x26')](handleEntityNotFound(_0x297617,null))[_0x6a5e('0x26')](respondWithResult(_0x297617,null))[_0x6a5e('0x48')](handleError(_0x297617,null));};exports[_0x6a5e('0x4c')]=function(_0x2f29cc,_0x436609){return db[_0x6a5e('0x30')][_0x6a5e('0x4c')](_0x2f29cc[_0x6a5e('0x4d')],{})[_0x6a5e('0x26')](function(_0x4b69dd){var _0x9037c5=_0x2f29cc[_0x6a5e('0x4e')][_0x6a5e('0x27')]({'plain':!![]});if(!_0x9037c5)throw new Error(_0x6a5e('0x4f'));if(_0x9037c5[_0x6a5e('0x50')]==='user'){var _0x15996b=_0x4b69dd[_0x6a5e('0x27')]({'plain':!![]});var _0x49fbca=_0x6a5e('0x28');return db[_0x6a5e('0x51')]['find']({'where':{'name':_0x49fbca,'userProfileId':_0x9037c5[_0x6a5e('0x52')]},'raw':!![]})[_0x6a5e('0x26')](function(_0x3e6d3d){if(_0x3e6d3d&&_0x3e6d3d[_0x6a5e('0x53')]===0x0){return db[_0x6a5e('0x29')]['create']({'name':_0x15996b[_0x6a5e('0x2d')],'resourceId':_0x15996b['id'],'type':_0x3e6d3d[_0x6a5e('0x2d')],'sectionId':_0x3e6d3d['id']},{})[_0x6a5e('0x26')](function(){return _0x4b69dd;});}else{return _0x4b69dd;}})[_0x6a5e('0x48')](function(_0x2a334b){logger[_0x6a5e('0x2b')](_0x6a5e('0x54'),_0x2a334b);throw _0x2a334b;});}return _0x4b69dd;})[_0x6a5e('0x26')](respondWithResult(_0x436609,0xc9))[_0x6a5e('0x48')](handleError(_0x436609,null));};exports[_0x6a5e('0x25')]=function(_0x3690b5,_0x29ce99){if(_0x3690b5[_0x6a5e('0x4d')]['id']){delete _0x3690b5['body']['id'];}return db[_0x6a5e('0x30')][_0x6a5e('0x4b')]({'where':{'id':_0x3690b5[_0x6a5e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x29ce99,null))[_0x6a5e('0x26')](saveUpdates(_0x3690b5[_0x6a5e('0x4d')],null))[_0x6a5e('0x26')](respondWithResult(_0x29ce99,null))[_0x6a5e('0x48')](handleError(_0x29ce99,null));};exports[_0x6a5e('0x2a')]=function(_0x442db1,_0x274154){return db['Template'][_0x6a5e('0x4b')]({'where':{'id':_0x442db1[_0x6a5e('0x4a')]['id']}})[_0x6a5e('0x26')](handleEntityNotFound(_0x274154,null))['then'](removeEntity(_0x274154,null))[_0x6a5e('0x48')](handleError(_0x274154,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index e9bda24..49632e7 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 _0x7512=['../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x2461e6,_0xeca875){var _0x1dd64d=function(_0x110287){while(--_0x110287){_0x2461e6['push'](_0x2461e6['shift']());}};_0x1dd64d(++_0xeca875);}(_0x7512,0x1da));var _0x2751=function(_0x2bcd1f,_0x4f1972){_0x2bcd1f=_0x2bcd1f-0x0;var _0x2381ca=_0x7512[_0x2bcd1f];return _0x2381ca;};'use strict';var _=require(_0x2751('0x0'));var util=require(_0x2751('0x1'));var logger=require('../../config/logger')(_0x2751('0x2'));var moment=require(_0x2751('0x3'));var BPromise=require(_0x2751('0x4'));var rp=require(_0x2751('0x5'));var fs=require('fs');var path=require(_0x2751('0x6'));var rimraf=require('rimraf');var config=require(_0x2751('0x7'));var attributes=require(_0x2751('0x8'));module[_0x2751('0x9')]=function(_0x588178,_0x1bbcd4){return _0x588178[_0x2751('0xa')](_0x2751('0xb'),attributes,{'tableName':_0x2751('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5fc=['Template','tools_templates','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./template.attributes','exports'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0xb5fc,0x1af));var _0xcb5f=function(_0x2373e4,_0x32433e){_0x2373e4=_0x2373e4-0x0;var _0x3d64ad=_0xb5fc[_0x2373e4];return _0x3d64ad;};'use strict';var _=require('lodash');var util=require(_0xcb5f('0x0'));var logger=require(_0xcb5f('0x1'))(_0xcb5f('0x2'));var moment=require('moment');var BPromise=require(_0xcb5f('0x3'));var rp=require(_0xcb5f('0x4'));var fs=require('fs');var path=require(_0xcb5f('0x5'));var rimraf=require('rimraf');var config=require(_0xcb5f('0x6'));var attributes=require(_0xcb5f('0x7'));module[_0xcb5f('0x8')]=function(_0x170cca,_0xb892cd){return _0x170cca['define'](_0xcb5f('0x9'),attributes,{'tableName':_0xcb5f('0xa'),'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 4460e36..5f4d3eb 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 _0x7e7b=['attributes','limit','include','map','model','then','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Template,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetTemplate','options','where'];(function(_0x4df21e,_0x2480c1){var _0x8f150=function(_0x39e52d){while(--_0x39e52d){_0x4df21e['push'](_0x4df21e['shift']());}};_0x8f150(++_0x2480c1);}(_0x7e7b,0x133));var _0xb7e7=function(_0x52fbf2,_0x88be6d){_0x52fbf2=_0x52fbf2-0x0;var _0x19fc3d=_0x7e7b[_0x52fbf2];return _0x19fc3d;};'use strict';var _=require(_0xb7e7('0x0'));var util=require(_0xb7e7('0x1'));var moment=require('moment');var BPromise=require(_0xb7e7('0x2'));var rs=require(_0xb7e7('0x3'));var fs=require('fs');var Redis=require(_0xb7e7('0x4'));var db=require(_0xb7e7('0x5'))['db'];var utils=require(_0xb7e7('0x6'));var logger=require(_0xb7e7('0x7'))(_0xb7e7('0x8'));var config=require(_0xb7e7('0x9'));var jayson=require(_0xb7e7('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c95f8,_0x18c554,_0x15aee9){return new BPromise(function(_0x5b23b0,_0x4eff24){return client[_0xb7e7('0xb')](_0x2c95f8,_0x15aee9)['then'](function(_0x5fe389){logger[_0xb7e7('0xc')](_0xb7e7('0xd'),_0x18c554,_0xb7e7('0xe'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x18c554,'request\x20sent',JSON[_0xb7e7('0xf')](_0x5fe389));if(_0x5fe389[_0xb7e7('0x10')]){if(_0x5fe389[_0xb7e7('0x10')]['code']===0x1f4){logger[_0xb7e7('0x10')](_0xb7e7('0xd'),_0x18c554,_0x5fe389[_0xb7e7('0x10')][_0xb7e7('0x11')]);return _0x4eff24(_0x5fe389[_0xb7e7('0x10')][_0xb7e7('0x11')]);}logger[_0xb7e7('0x10')]('Template,\x20%s,\x20%s',_0x18c554,_0x5fe389[_0xb7e7('0x10')]['message']);return _0x5b23b0(_0x5fe389[_0xb7e7('0x10')][_0xb7e7('0x11')]);}else{logger[_0xb7e7('0xc')](_0xb7e7('0xd'),_0x18c554,_0xb7e7('0xe'));_0x5b23b0(_0x5fe389[_0xb7e7('0x12')][_0xb7e7('0x11')]);}})[_0xb7e7('0x13')](function(_0x5a3739){logger['error'](_0xb7e7('0xd'),_0x18c554,_0x5a3739);_0x4eff24(_0x5a3739);});});}exports[_0xb7e7('0x14')]=function(_0x1f60bf){var _0x351c2f=this;return new Promise(function(_0x1301be,_0x577fc0){return db['Template']['findAll']({'raw':_0x1f60bf[_0xb7e7('0x15')]?_0x1f60bf[_0xb7e7('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1f60bf['options']?_0x1f60bf[_0xb7e7('0x15')][_0xb7e7('0x16')]||null:null,'attributes':_0x1f60bf[_0xb7e7('0x15')]?_0x1f60bf[_0xb7e7('0x15')][_0xb7e7('0x17')]||null:null,'limit':_0x1f60bf[_0xb7e7('0x15')]?_0x1f60bf[_0xb7e7('0x15')][_0xb7e7('0x18')]||null:null,'include':_0x1f60bf[_0xb7e7('0x15')]?_0x1f60bf['options']['include']?_['map'](_0x1f60bf[_0xb7e7('0x15')]['include'],function(_0x1f55c8){return{'model':db[_0x1f55c8['model']],'as':_0x1f55c8['as'],'attributes':_0x1f55c8['attributes'],'include':_0x1f55c8[_0xb7e7('0x19')]?_[_0xb7e7('0x1a')](_0x1f55c8[_0xb7e7('0x19')],function(_0x30777e){return{'model':db[_0x30777e['model']],'as':_0x30777e['as'],'attributes':_0x30777e[_0xb7e7('0x17')],'include':_0x30777e['include']?_[_0xb7e7('0x1a')](_0x30777e[_0xb7e7('0x19')],function(_0x2c5999){return{'model':db[_0x2c5999[_0xb7e7('0x1b')]],'as':_0x2c5999['as'],'attributes':_0x2c5999[_0xb7e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb7e7('0x1c')](function(_0x4173f1){logger['info'](_0xb7e7('0x14'),_0x1f60bf);logger[_0xb7e7('0x1d')](_0xb7e7('0x14'),_0x1f60bf,JSON[_0xb7e7('0xf')](_0x4173f1));_0x1301be(_0x4173f1);})[_0xb7e7('0x13')](function(_0x529c1b){logger['error'](_0xb7e7('0x14'),_0x529c1b['message'],_0x1f60bf);_0x577fc0(_0x351c2f[_0xb7e7('0x10')](0x1f4,_0x529c1b[_0xb7e7('0x11')]));});});}; \ No newline at end of file +var _0x7c93=['map','model','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','GetTemplate','findAll','options','raw','where','attributes','include'];(function(_0x15c2ff,_0x2c33a8){var _0x5ce37c=function(_0x24adff){while(--_0x24adff){_0x15c2ff['push'](_0x15c2ff['shift']());}};_0x5ce37c(++_0x2c33a8);}(_0x7c93,0x16e));var _0x37c9=function(_0x350f5d,_0x2cee08){_0x350f5d=_0x350f5d-0x0;var _0x3b6f12=_0x7c93[_0x350f5d];return _0x3b6f12;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x37c9('0x0'));var BPromise=require(_0x37c9('0x1'));var rs=require(_0x37c9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x37c9('0x3'))['db'];var utils=require(_0x37c9('0x4'));var logger=require(_0x37c9('0x5'))(_0x37c9('0x6'));var config=require(_0x37c9('0x7'));var jayson=require(_0x37c9('0x8'));var client=jayson[_0x37c9('0x9')][_0x37c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3aa9c8,_0x1c8507,_0x203e1f){return new BPromise(function(_0xfc5e74,_0x2f4c3e){return client[_0x37c9('0xb')](_0x3aa9c8,_0x203e1f)[_0x37c9('0xc')](function(_0x19f3d0){logger[_0x37c9('0xd')]('Template,\x20%s,\x20%s',_0x1c8507,_0x37c9('0xe'));logger[_0x37c9('0xf')](_0x37c9('0x10'),_0x1c8507,_0x37c9('0xe'),JSON[_0x37c9('0x11')](_0x19f3d0));if(_0x19f3d0[_0x37c9('0x12')]){if(_0x19f3d0[_0x37c9('0x12')][_0x37c9('0x13')]===0x1f4){logger[_0x37c9('0x12')](_0x37c9('0x14'),_0x1c8507,_0x19f3d0[_0x37c9('0x12')][_0x37c9('0x15')]);return _0x2f4c3e(_0x19f3d0['error'][_0x37c9('0x15')]);}logger[_0x37c9('0x12')](_0x37c9('0x14'),_0x1c8507,_0x19f3d0[_0x37c9('0x12')][_0x37c9('0x15')]);return _0xfc5e74(_0x19f3d0[_0x37c9('0x12')][_0x37c9('0x15')]);}else{logger[_0x37c9('0xd')](_0x37c9('0x14'),_0x1c8507,'request\x20sent');_0xfc5e74(_0x19f3d0[_0x37c9('0x16')][_0x37c9('0x15')]);}})['catch'](function(_0x44ad5a){logger[_0x37c9('0x12')](_0x37c9('0x14'),_0x1c8507,_0x44ad5a);_0x2f4c3e(_0x44ad5a);});});}exports[_0x37c9('0x17')]=function(_0x3b03c1){var _0x1b1b9c=this;return new Promise(function(_0x3938c2,_0x5d5fb1){return db['Template'][_0x37c9('0x18')]({'raw':_0x3b03c1[_0x37c9('0x19')]?_0x3b03c1[_0x37c9('0x19')][_0x37c9('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b03c1[_0x37c9('0x19')]?_0x3b03c1[_0x37c9('0x19')][_0x37c9('0x1b')]||null:null,'attributes':_0x3b03c1[_0x37c9('0x19')]?_0x3b03c1[_0x37c9('0x19')][_0x37c9('0x1c')]||null:null,'limit':_0x3b03c1[_0x37c9('0x19')]?_0x3b03c1[_0x37c9('0x19')]['limit']||null:null,'include':_0x3b03c1[_0x37c9('0x19')]?_0x3b03c1['options'][_0x37c9('0x1d')]?_[_0x37c9('0x1e')](_0x3b03c1[_0x37c9('0x19')][_0x37c9('0x1d')],function(_0x3c9931){return{'model':db[_0x3c9931[_0x37c9('0x1f')]],'as':_0x3c9931['as'],'attributes':_0x3c9931[_0x37c9('0x1c')],'include':_0x3c9931['include']?_[_0x37c9('0x1e')](_0x3c9931[_0x37c9('0x1d')],function(_0x463213){return{'model':db[_0x463213[_0x37c9('0x1f')]],'as':_0x463213['as'],'attributes':_0x463213[_0x37c9('0x1c')],'include':_0x463213[_0x37c9('0x1d')]?_['map'](_0x463213[_0x37c9('0x1d')],function(_0x53c7a9){return{'model':db[_0x53c7a9[_0x37c9('0x1f')]],'as':_0x53c7a9['as'],'attributes':_0x53c7a9['attributes']};}):[]};}):[]};}):[]:[]})[_0x37c9('0xc')](function(_0x56e1d9){logger[_0x37c9('0xd')]('GetTemplate',_0x3b03c1);logger['debug'](_0x37c9('0x17'),_0x3b03c1,JSON[_0x37c9('0x11')](_0x56e1d9));_0x3938c2(_0x56e1d9);})[_0x37c9('0x20')](function(_0x4f9ab7){logger[_0x37c9('0x12')]('GetTemplate',_0x4f9ab7[_0x37c9('0x15')],_0x3b03c1);_0x5d5fb1(_0x1b1b9c['error'](0x1f4,_0x4f9ab7[_0x37c9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 0202082..a2a86ff 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 _0x0307=['post','addAnyCondition','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','isAuthenticated','index','get','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions'];(function(_0x24f3d1,_0x425d0e){var _0x155ee9=function(_0xbc9404){while(--_0xbc9404){_0x24f3d1['push'](_0x24f3d1['shift']());}};_0x155ee9(++_0x425d0e);}(_0x0307,0xa7));var _0x7030=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x0307[_0x409353];return _0x4f4b59;};'use strict';var multer=require(_0x7030('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7030('0x1'));var express=require(_0x7030('0x2'));var router=express[_0x7030('0x3')]();var fs_extra=require(_0x7030('0x4'));var auth=require(_0x7030('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7030('0x6'));var controller=require(_0x7030('0x7'));router['get']('/',auth[_0x7030('0x8')](),controller[_0x7030('0x9')]);router[_0x7030('0xa')](_0x7030('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7030('0xc'),auth[_0x7030('0x8')](),controller[_0x7030('0xd')]);router['get'](_0x7030('0xe'),auth[_0x7030('0x8')](),controller['getAnyConditions']);router[_0x7030('0xa')](_0x7030('0xf'),auth[_0x7030('0x8')](),controller[_0x7030('0x10')]);router['post']('/',auth[_0x7030('0x8')](),controller['create']);router[_0x7030('0x11')]('/:id/all_conditions',auth[_0x7030('0x8')](),controller['addAllCondition']);router['post'](_0x7030('0xe'),auth['isAuthenticated'](),controller[_0x7030('0x12')]);router[_0x7030('0x11')](_0x7030('0xf'),auth[_0x7030('0x8')](),controller['addAction']);router[_0x7030('0x13')](_0x7030('0xb'),auth['isAuthenticated'](),controller[_0x7030('0x14')]);router['delete'](_0x7030('0xb'),auth[_0x7030('0x8')](),controller[_0x7030('0x15')]);module[_0x7030('0x16')]=router; \ No newline at end of file +var _0x93e9=['express','Router','fs-extra','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','post','create','addAllCondition','addAnyCondition','addAction','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x4d4da0,_0x2e7838){var _0x3a94dd=function(_0x36ae15){while(--_0x36ae15){_0x4d4da0['push'](_0x4d4da0['shift']());}};_0x3a94dd(++_0x2e7838);}(_0x93e9,0xcc));var _0x993e=function(_0x339213,_0x4294a9){_0x339213=_0x339213-0x0;var _0x3ecb63=_0x93e9[_0x339213];return _0x3ecb63;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['show']);router[_0x993e('0x9')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0x9')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller['getAnyConditions']);router[_0x993e('0x9')](_0x993e('0x10'),auth['isAuthenticated'](),controller['getActions']);router[_0x993e('0x11')]('/',auth['isAuthenticated'](),controller[_0x993e('0x12')]);router['post']('/:id/all_conditions',auth[_0x993e('0xa')](),controller[_0x993e('0x13')]);router[_0x993e('0x11')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller[_0x993e('0x14')]);router[_0x993e('0x11')](_0x993e('0x10'),auth[_0x993e('0xa')](),controller[_0x993e('0x15')]);router[_0x993e('0x16')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller[_0x993e('0x17')]);router[_0x993e('0x18')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['destroy']);module[_0x993e('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 6c5559b..1f86d5a 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 _0x55a1=['exports','sequelize'];(function(_0x4b72c5,_0x1fabc4){var _0x25bbf1=function(_0x1fc2d0){while(--_0x1fc2d0){_0x4b72c5['push'](_0x4b72c5['shift']());}};_0x25bbf1(++_0x1fabc4);}(_0x55a1,0xab));var _0x155a=function(_0xfdddbb,_0x443ec1){_0xfdddbb=_0xfdddbb-0x0;var _0x21bdfb=_0x55a1[_0xfdddbb];return _0x21bdfb;};'use strict';var Sequelize=require(_0x155a('0x0'));module[_0x155a('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x403d=['STRING','sequelize'];(function(_0x4131cb,_0x323da3){var _0x139ae7=function(_0x2dce4a){while(--_0x2dce4a){_0x4131cb['push'](_0x4131cb['shift']());}};_0x139ae7(++_0x323da3);}(_0x403d,0x1e3));var _0xd403=function(_0x5cb094,_0x8661b7){_0x5cb094=_0x5cb094-0x0;var _0x19c8e3=_0x403d[_0x5cb094];return _0x19c8e3;};'use strict';var Sequelize=require(_0xd403('0x0'));module['exports']={'name':{'type':Sequelize[_0xd403('0x1')]},'channel':{'type':Sequelize[_0xd403('0x1')]},'description':{'type':Sequelize[_0xd403('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 5893d87..0c83014 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 _0x300f=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','order','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','sendStatus','error','name','send','index','Trigger','rawAttributes','fieldName','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','map','VIRTUAL','options','includeAll','rows','params','intersection','include','find','catch','create','body','user'];(function(_0x31957e,_0x19df8a){var _0x5d671f=function(_0x1f507b){while(--_0x1f507b){_0x31957e['push'](_0x31957e['shift']());}};_0x5d671f(++_0x19df8a);}(_0x300f,0x1e8));var _0xf300=function(_0x1d7015,_0x59725b){_0x1d7015=_0x1d7015-0x0;var _0x27d152=_0x300f[_0x1d7015];return _0x27d152;};'use strict';var emlformat=require(_0xf300('0x0'));var rimraf=require(_0xf300('0x1'));var zipdir=require(_0xf300('0x2'));var jsonpatch=require(_0xf300('0x3'));var rp=require(_0xf300('0x4'));var moment=require(_0xf300('0x5'));var BPromise=require(_0xf300('0x6'));var Mustache=require(_0xf300('0x7'));var util=require(_0xf300('0x8'));var path=require(_0xf300('0x9'));var sox=require(_0xf300('0xa'));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(_0xf300('0xb'));var crypto=require(_0xf300('0xc'));var jsforce=require(_0xf300('0xd'));var deskjs=require(_0xf300('0xe'));var toCsv=require(_0xf300('0xf'));var querystring=require(_0xf300('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf300('0x11'));var qs=require(_0xf300('0x12'));var as=require(_0xf300('0x13'));var hardwareService=require(_0xf300('0x14'));var logger=require('../../config/logger')(_0xf300('0x15'));var utils=require('../../config/utils');var config=require(_0xf300('0x16'));var licenseUtil=require(_0xf300('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53baa9,_0x3076a8){_0x3076a8=_0x3076a8||0xcc;return function(_0x4889ea){if(_0x4889ea){return _0x53baa9['sendStatus'](_0x3076a8);}return _0x53baa9[_0xf300('0x18')](_0x3076a8)[_0xf300('0x19')]();};}function respondWithResult(_0x2300f1,_0x479df5){_0x479df5=_0x479df5||0xc8;return function(_0x32e5d0){if(_0x32e5d0){return _0x2300f1[_0xf300('0x18')](_0x479df5)['json'](_0x32e5d0);}};}function respondWithFilteredResult(_0x5ecbe9,_0x5b6ac7){return function(_0x315d0a){if(_0x315d0a){var _0x44f0e6=typeof _0x5b6ac7['offset']===_0xf300('0x1a')&&typeof _0x5b6ac7[_0xf300('0x1b')]===_0xf300('0x1a');var _0x4a9c69=_0x315d0a[_0xf300('0x1c')];var _0x292a76=_0x44f0e6?0x0:_0x5b6ac7[_0xf300('0x1d')];var _0x536875=_0x44f0e6?_0x315d0a[_0xf300('0x1c')]:_0x5b6ac7[_0xf300('0x1d')]+_0x5b6ac7[_0xf300('0x1b')];var _0x271dc1;if(_0x536875>=_0x4a9c69){_0x536875=_0x4a9c69;_0x271dc1=0xc8;}else{_0x271dc1=0xce;}_0x5ecbe9[_0xf300('0x18')](_0x271dc1);return _0x5ecbe9[_0xf300('0x1e')](_0xf300('0x1f'),_0x292a76+'-'+_0x536875+'/'+_0x4a9c69)['json'](_0x315d0a);}return null;};}function patchUpdates(_0x461750){return function(_0x30ff90){try{jsonpatch[_0xf300('0x20')](_0x30ff90,_0x461750,!![]);}catch(_0x585761){return BPromise[_0xf300('0x21')](_0x585761);}return _0x30ff90[_0xf300('0x22')]();};}function saveUpdates(_0x1818f3,_0x4f2a40){return function(_0x36cc48){if(_0x36cc48){return _0x36cc48[_0xf300('0x23')](_0x1818f3)[_0xf300('0x24')](function(_0x118586){return _0x118586;});}return null;};}function removeEntity(_0x5ef180,_0x22f4b2){return function(_0x1aad24){if(_0x1aad24){return _0x1aad24[_0xf300('0x25')]()['then'](function(){var _0xcadde6=_0x1aad24[_0xf300('0x26')]({'plain':!![]});var _0x5afae2=_0xf300('0x27');return db[_0xf300('0x28')][_0xf300('0x25')]({'where':{'type':_0x5afae2,'resourceId':_0xcadde6['id']}})[_0xf300('0x24')](function(){return _0x1aad24;});})[_0xf300('0x24')](function(){_0x5ef180[_0xf300('0x18')](0xcc)[_0xf300('0x19')]();});}};}function handleEntityNotFound(_0x4aea86,_0x4f7a7b){return function(_0x32b10d){if(!_0x32b10d){_0x4aea86[_0xf300('0x29')](0x194);}return _0x32b10d;};}function handleError(_0x52c9af,_0x3a1f2b){_0x3a1f2b=_0x3a1f2b||0x1f4;return function(_0x1498f6){logger[_0xf300('0x2a')](_0x1498f6['stack']);if(_0x1498f6[_0xf300('0x2b')]){delete _0x1498f6['name'];}_0x52c9af[_0xf300('0x18')](_0x3a1f2b)[_0xf300('0x2c')](_0x1498f6);};}exports[_0xf300('0x2d')]=function(_0x56ed62,_0x27b072){var _0x4739c3={},_0x5b9d8c={},_0x19f997={'count':0x0,'rows':[]};var _0x410909=_['map'](db[_0xf300('0x2e')][_0xf300('0x2f')],function(_0x9bd047){return{'name':_0x9bd047[_0xf300('0x30')],'type':_0x9bd047['type']['key']};});_0x5b9d8c[_0xf300('0x31')]=_['map'](_0x410909,_0xf300('0x2b'));_0x5b9d8c[_0xf300('0x32')]=_[_0xf300('0x33')](_0x56ed62[_0xf300('0x32')]);_0x5b9d8c['filters']=_['intersection'](_0x5b9d8c[_0xf300('0x31')],_0x5b9d8c['query']);_0x4739c3[_0xf300('0x34')]=_['intersection'](_0x5b9d8c[_0xf300('0x31')],qs[_0xf300('0x35')](_0x56ed62[_0xf300('0x32')]['fields']));_0x4739c3[_0xf300('0x34')]=_0x4739c3['attributes'][_0xf300('0x36')]?_0x4739c3[_0xf300('0x34')]:_0x5b9d8c[_0xf300('0x31')];if(!_0x56ed62[_0xf300('0x32')][_0xf300('0x37')](_0xf300('0x38'))){_0x4739c3[_0xf300('0x1b')]=qs['limit'](_0x56ed62[_0xf300('0x32')][_0xf300('0x1b')]);_0x4739c3['offset']=qs[_0xf300('0x1d')](_0x56ed62[_0xf300('0x32')][_0xf300('0x1d')]);}_0x4739c3['order']=qs[_0xf300('0x39')](_0x56ed62[_0xf300('0x32')][_0xf300('0x39')]);_0x4739c3['where']=qs[_0xf300('0x3a')](_[_0xf300('0x3b')](_0x56ed62[_0xf300('0x32')],_0x5b9d8c[_0xf300('0x3a')]),_0x410909);if(_0x56ed62[_0xf300('0x32')][_0xf300('0x3c')]){_0x4739c3['where']=_[_0xf300('0x3d')](_0x4739c3[_0xf300('0x3e')],{'$or':_[_0xf300('0x3f')](_0x410909,function(_0x5dfa7c){if(_0x5dfa7c['type']!==_0xf300('0x40')){var _0x2176d8={};_0x2176d8[_0x5dfa7c[_0xf300('0x2b')]]={'$like':'%'+_0x56ed62['query'][_0xf300('0x3c')]+'%'};return _0x2176d8;}})});}_0x4739c3=_[_0xf300('0x3d')]({},_0x4739c3,_0x56ed62[_0xf300('0x41')]);var _0x5b9554={'where':_0x4739c3['where']};return db['Trigger'][_0xf300('0x1c')](_0x5b9554)['then'](function(_0x55d251){_0x19f997[_0xf300('0x1c')]=_0x55d251;if(_0x56ed62[_0xf300('0x32')][_0xf300('0x42')]){_0x4739c3['include']=[{'all':!![]}];}return db[_0xf300('0x2e')]['findAll'](_0x4739c3);})[_0xf300('0x24')](function(_0x156be3){_0x19f997[_0xf300('0x43')]=_0x156be3;return _0x19f997;})['then'](respondWithFilteredResult(_0x27b072,_0x4739c3))['catch'](handleError(_0x27b072,null));};exports['show']=function(_0x565ed7,_0x51c666){var _0x2dbac2={'raw':![],'where':{'id':_0x565ed7[_0xf300('0x44')]['id']}},_0x1128c7={};_0x1128c7[_0xf300('0x31')]=_[_0xf300('0x33')](db['Trigger']['rawAttributes']);_0x1128c7[_0xf300('0x32')]=_[_0xf300('0x33')](_0x565ed7[_0xf300('0x32')]);_0x1128c7[_0xf300('0x3a')]=_[_0xf300('0x45')](_0x1128c7['model'],_0x1128c7['query']);_0x2dbac2[_0xf300('0x34')]=_['intersection'](_0x1128c7['model'],qs['fields'](_0x565ed7['query'][_0xf300('0x35')]));_0x2dbac2[_0xf300('0x34')]=_0x2dbac2[_0xf300('0x34')][_0xf300('0x36')]?_0x2dbac2[_0xf300('0x34')]:_0x1128c7['model'];if(_0x565ed7['query'][_0xf300('0x42')]){_0x2dbac2[_0xf300('0x46')]=[{'all':!![]}];}_0x2dbac2=_[_0xf300('0x3d')]({},_0x2dbac2,_0x565ed7[_0xf300('0x41')]);return db[_0xf300('0x2e')][_0xf300('0x47')](_0x2dbac2)[_0xf300('0x24')](handleEntityNotFound(_0x51c666,null))[_0xf300('0x24')](respondWithResult(_0x51c666,null))[_0xf300('0x48')](handleError(_0x51c666,null));};exports['create']=function(_0xdbfd80,_0x179726){return db[_0xf300('0x2e')][_0xf300('0x49')](_0xdbfd80[_0xf300('0x4a')],{})[_0xf300('0x24')](function(_0x361473){var _0x2a213e=_0xdbfd80[_0xf300('0x4b')]['get']({'plain':!![]});if(!_0x2a213e)throw new Error(_0xf300('0x4c'));if(_0x2a213e[_0xf300('0x4d')]===_0xf300('0x4b')){var _0x2c8ef8=_0x361473[_0xf300('0x26')]({'plain':!![]});var _0x43902f='Triggers';return db[_0xf300('0x4e')]['find']({'where':{'name':_0x43902f,'userProfileId':_0x2a213e[_0xf300('0x4f')]},'raw':!![]})[_0xf300('0x24')](function(_0x24561f){if(_0x24561f&&_0x24561f[_0xf300('0x50')]===0x0){return db[_0xf300('0x28')][_0xf300('0x49')]({'name':_0x2c8ef8[_0xf300('0x2b')],'resourceId':_0x2c8ef8['id'],'type':_0x24561f[_0xf300('0x2b')],'sectionId':_0x24561f['id']},{})[_0xf300('0x24')](function(){return _0x361473;});}else{return _0x361473;}})[_0xf300('0x48')](function(_0x262c23){logger[_0xf300('0x2a')](_0xf300('0x51'),_0x262c23);throw _0x262c23;});}return _0x361473;})[_0xf300('0x24')](respondWithResult(_0x179726,0xc9))[_0xf300('0x48')](handleError(_0x179726,null));};exports[_0xf300('0x23')]=function(_0x1b3ecc,_0x111905){if(_0x1b3ecc['body']['id']){delete _0x1b3ecc[_0xf300('0x4a')]['id'];}return db[_0xf300('0x2e')][_0xf300('0x47')]({'where':{'id':_0x1b3ecc[_0xf300('0x44')]['id']}})[_0xf300('0x24')](handleEntityNotFound(_0x111905,null))[_0xf300('0x24')](saveUpdates(_0x1b3ecc[_0xf300('0x4a')],null))[_0xf300('0x24')](respondWithResult(_0x111905,null))[_0xf300('0x48')](handleError(_0x111905,null));};exports[_0xf300('0x25')]=function(_0x449048,_0x4e7051){return db[_0xf300('0x2e')][_0xf300('0x47')]({'where':{'id':_0x449048[_0xf300('0x44')]['id']}})[_0xf300('0x24')](handleEntityNotFound(_0x4e7051,null))[_0xf300('0x24')](removeEntity(_0x4e7051,null))[_0xf300('0x48')](handleError(_0x4e7051,null));};exports[_0xf300('0x52')]=function(_0x440a8,_0x40a13d,_0x276018){if(_0x440a8[_0xf300('0x4a')]['id']){delete _0x440a8[_0xf300('0x4a')]['id'];}return db[_0xf300('0x2e')][_0xf300('0x47')]({'where':{'id':_0x440a8[_0xf300('0x44')]['id']}})[_0xf300('0x24')](handleEntityNotFound(_0x40a13d,null))['then'](function(_0x10df41){if(_0x10df41){_0x440a8[_0xf300('0x4a')]['TriggerAllId']=_0x10df41['id'];return db[_0xf300('0x53')][_0xf300('0x49')](_0x440a8[_0xf300('0x4a')]);}})[_0xf300('0x24')](respondWithResult(_0x40a13d,null))[_0xf300('0x48')](handleError(_0x40a13d,null));};exports[_0xf300('0x54')]=function(_0x4a01c0,_0x20713e,_0x23af81){if(_0x4a01c0['body']['id']){delete _0x4a01c0[_0xf300('0x4a')]['id'];}return db[_0xf300('0x2e')]['find']({'where':{'id':_0x4a01c0[_0xf300('0x44')]['id']}})[_0xf300('0x24')](handleEntityNotFound(_0x20713e,null))[_0xf300('0x24')](function(_0x2eb5b3){if(_0x2eb5b3){_0x4a01c0['body'][_0xf300('0x55')]=_0x2eb5b3['id'];return db['Condition'][_0xf300('0x49')](_0x4a01c0[_0xf300('0x4a')]);}})[_0xf300('0x24')](respondWithResult(_0x20713e,null))[_0xf300('0x48')](handleError(_0x20713e,null));};exports['getAllConditions']=function(_0x18a8d0,_0x366ccd,_0x3c5c3d){var _0x186fb0={};var _0x7a945f={};var _0x3cd62a;var _0x558fbd;return db[_0xf300('0x2e')][_0xf300('0x56')]({'where':{'id':_0x18a8d0['params']['id']}})['then'](handleEntityNotFound(_0x366ccd,null))['then'](function(_0x2b8ba5){if(_0x2b8ba5){_0x3cd62a=_0x2b8ba5;_0x7a945f['model']=_['keys'](db[_0xf300('0x53')][_0xf300('0x2f')]);_0x7a945f[_0xf300('0x32')]=_[_0xf300('0x33')](_0x18a8d0['query']);_0x7a945f['filters']=_[_0xf300('0x45')](_0x7a945f[_0xf300('0x31')],_0x7a945f[_0xf300('0x32')]);_0x186fb0[_0xf300('0x34')]=_[_0xf300('0x45')](_0x7a945f['model'],qs['fields'](_0x18a8d0[_0xf300('0x32')]['fields']));_0x186fb0['attributes']=_0x186fb0['attributes'][_0xf300('0x36')]?_0x186fb0[_0xf300('0x34')]:_0x7a945f['model'];_0x186fb0['order']=qs[_0xf300('0x39')](_0x18a8d0['query'][_0xf300('0x39')]);_0x186fb0[_0xf300('0x3e')]=qs[_0xf300('0x3a')](_[_0xf300('0x3b')](_0x18a8d0[_0xf300('0x32')],_0x7a945f[_0xf300('0x3a')]));if(_0x18a8d0['query'][_0xf300('0x3c')]){_0x186fb0['where']=_[_0xf300('0x3d')](_0x186fb0[_0xf300('0x3e')],{'$or':_[_0xf300('0x3f')](_0x186fb0[_0xf300('0x34')],function(_0x228fcd){var _0x697c9={};_0x697c9[_0x228fcd]={'$like':'%'+_0x18a8d0['query']['filter']+'%'};return _0x697c9;})});}_0x186fb0=_[_0xf300('0x3d')]({},_0x186fb0,_0x18a8d0['options']);return _0x3cd62a[_0xf300('0x57')](_0x186fb0);}})[_0xf300('0x24')](function(_0x5e2625){if(_0x5e2625){_0x558fbd=_0x5e2625['length'];if(!_0x18a8d0[_0xf300('0x32')][_0xf300('0x37')]('nolimit')){_0x186fb0['limit']=qs[_0xf300('0x1b')](_0x18a8d0[_0xf300('0x32')]['limit']);_0x186fb0[_0xf300('0x1d')]=qs[_0xf300('0x1d')](_0x18a8d0[_0xf300('0x32')][_0xf300('0x1d')]);}return _0x3cd62a[_0xf300('0x57')](_0x186fb0);}})[_0xf300('0x24')](function(_0x2a1cab){if(_0x2a1cab){return _0x2a1cab?{'count':_0x558fbd,'rows':_0x2a1cab}:null;}})[_0xf300('0x24')](respondWithResult(_0x366ccd,null))[_0xf300('0x48')](handleError(_0x366ccd,null));};exports[_0xf300('0x58')]=function(_0x1d2433,_0x1eb455,_0x4075b1){var _0x4b4ac3={};var _0x397af2={};var _0x1bd213;var _0x4f04c5;return db['Trigger'][_0xf300('0x56')]({'where':{'id':_0x1d2433['params']['id']}})[_0xf300('0x24')](handleEntityNotFound(_0x1eb455,null))[_0xf300('0x24')](function(_0xe43066){if(_0xe43066){_0x1bd213=_0xe43066;_0x397af2[_0xf300('0x31')]=_[_0xf300('0x33')](db[_0xf300('0x53')]['rawAttributes']);_0x397af2[_0xf300('0x32')]=_[_0xf300('0x33')](_0x1d2433['query']);_0x397af2[_0xf300('0x3a')]=_[_0xf300('0x45')](_0x397af2[_0xf300('0x31')],_0x397af2[_0xf300('0x32')]);_0x4b4ac3['attributes']=_[_0xf300('0x45')](_0x397af2[_0xf300('0x31')],qs[_0xf300('0x35')](_0x1d2433[_0xf300('0x32')]['fields']));_0x4b4ac3['attributes']=_0x4b4ac3['attributes']['length']?_0x4b4ac3[_0xf300('0x34')]:_0x397af2[_0xf300('0x31')];_0x4b4ac3[_0xf300('0x59')]=qs[_0xf300('0x39')](_0x1d2433[_0xf300('0x32')]['sort']);_0x4b4ac3[_0xf300('0x3e')]=qs[_0xf300('0x3a')](_[_0xf300('0x3b')](_0x1d2433[_0xf300('0x32')],_0x397af2[_0xf300('0x3a')]));if(_0x1d2433[_0xf300('0x32')][_0xf300('0x3c')]){_0x4b4ac3[_0xf300('0x3e')]=_[_0xf300('0x3d')](_0x4b4ac3[_0xf300('0x3e')],{'$or':_[_0xf300('0x3f')](_0x4b4ac3[_0xf300('0x34')],function(_0x4511f4){var _0x57d10f={};_0x57d10f[_0x4511f4]={'$like':'%'+_0x1d2433['query'][_0xf300('0x3c')]+'%'};return _0x57d10f;})});}_0x4b4ac3=_[_0xf300('0x3d')]({},_0x4b4ac3,_0x1d2433['options']);return _0x1bd213['getAnyConditions'](_0x4b4ac3);}})[_0xf300('0x24')](function(_0x191496){if(_0x191496){_0x4f04c5=_0x191496['length'];if(!_0x1d2433[_0xf300('0x32')]['hasOwnProperty']('nolimit')){_0x4b4ac3[_0xf300('0x1b')]=qs[_0xf300('0x1b')](_0x1d2433[_0xf300('0x32')][_0xf300('0x1b')]);_0x4b4ac3[_0xf300('0x1d')]=qs['offset'](_0x1d2433[_0xf300('0x32')][_0xf300('0x1d')]);}return _0x1bd213['getAnyConditions'](_0x4b4ac3);}})[_0xf300('0x24')](function(_0x108df3){if(_0x108df3){return _0x108df3?{'count':_0x4f04c5,'rows':_0x108df3}:null;}})['then'](respondWithResult(_0x1eb455,null))[_0xf300('0x48')](handleError(_0x1eb455,null));};exports[_0xf300('0x5a')]=function(_0x29a3c9,_0x538f83,_0x2ab10b){if(_0x29a3c9['body']['id']){delete _0x29a3c9[_0xf300('0x4a')]['id'];}return db[_0xf300('0x2e')][_0xf300('0x47')]({'where':{'id':_0x29a3c9[_0xf300('0x44')]['id']}})[_0xf300('0x24')](handleEntityNotFound(_0x538f83,null))[_0xf300('0x24')](function(_0x51e4c1){if(_0x51e4c1){_0x29a3c9[_0xf300('0x4a')][_0xf300('0x5b')]=_0x51e4c1['id'];return db[_0xf300('0x5c')]['create'](_0x29a3c9[_0xf300('0x4a')]);}})[_0xf300('0x24')](respondWithResult(_0x538f83,null))['catch'](handleError(_0x538f83,null));};exports[_0xf300('0x5d')]=function(_0x5f4278,_0x4f2c45,_0x4d4f73){var _0xe78959={};var _0x2e9bc0={};var _0x22f084;var _0x53464a;return db[_0xf300('0x2e')][_0xf300('0x56')]({'where':{'id':_0x5f4278['params']['id']}})[_0xf300('0x24')](handleEntityNotFound(_0x4f2c45,null))[_0xf300('0x24')](function(_0x20a282){if(_0x20a282){_0x22f084=_0x20a282;_0x2e9bc0[_0xf300('0x31')]=_[_0xf300('0x33')](db[_0xf300('0x5c')][_0xf300('0x2f')]);_0x2e9bc0[_0xf300('0x32')]=_[_0xf300('0x33')](_0x5f4278[_0xf300('0x32')]);_0x2e9bc0[_0xf300('0x3a')]=_[_0xf300('0x45')](_0x2e9bc0[_0xf300('0x31')],_0x2e9bc0[_0xf300('0x32')]);_0xe78959['attributes']=_['intersection'](_0x2e9bc0[_0xf300('0x31')],qs['fields'](_0x5f4278[_0xf300('0x32')][_0xf300('0x35')]));_0xe78959[_0xf300('0x34')]=_0xe78959[_0xf300('0x34')]['length']?_0xe78959[_0xf300('0x34')]:_0x2e9bc0[_0xf300('0x31')];_0xe78959['order']=qs[_0xf300('0x39')](_0x5f4278[_0xf300('0x32')][_0xf300('0x39')]);_0xe78959[_0xf300('0x3e')]=qs[_0xf300('0x3a')](_[_0xf300('0x3b')](_0x5f4278[_0xf300('0x32')],_0x2e9bc0[_0xf300('0x3a')]));if(_0x5f4278[_0xf300('0x32')][_0xf300('0x3c')]){_0xe78959[_0xf300('0x3e')]=_[_0xf300('0x3d')](_0xe78959[_0xf300('0x3e')],{'$or':_['map'](_0xe78959[_0xf300('0x34')],function(_0x452a3e){var _0x526a7c={};_0x526a7c[_0x452a3e]={'$like':'%'+_0x5f4278[_0xf300('0x32')]['filter']+'%'};return _0x526a7c;})});}_0xe78959=_[_0xf300('0x3d')]({},_0xe78959,_0x5f4278[_0xf300('0x41')]);return _0x22f084['getActions'](_0xe78959);}})['then'](function(_0x35ba27){if(_0x35ba27){_0x53464a=_0x35ba27['length'];if(!_0x5f4278['query']['hasOwnProperty']('nolimit')){_0xe78959[_0xf300('0x1b')]=qs[_0xf300('0x1b')](_0x5f4278[_0xf300('0x32')][_0xf300('0x1b')]);_0xe78959['offset']=qs[_0xf300('0x1d')](_0x5f4278['query'][_0xf300('0x1d')]);}return _0x22f084[_0xf300('0x5d')](_0xe78959);}})[_0xf300('0x24')](function(_0x283e41){if(_0x283e41){return _0x283e41?{'count':_0x53464a,'rows':_0x283e41}:null;}})['then'](respondWithResult(_0x4f2c45,null))[_0xf300('0x48')](handleError(_0x4f2c45,null));}; \ No newline at end of file +var _0x1865=['save','update','then','Triggers','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trigger','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','pick','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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'];(function(_0x4bb9a0,_0x1c5178){var _0xf9617c=function(_0x5ed489){while(--_0x5ed489){_0x4bb9a0['push'](_0x4bb9a0['shift']());}};_0xf9617c(++_0x1c5178);}(_0x1865,0xa4));var _0x5186=function(_0x3eb435,_0x3be1e3){_0x3eb435=_0x3eb435-0x0;var _0x42203d=_0x1865[_0x3eb435];return _0x42203d;};'use strict';var emlformat=require(_0x5186('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5186('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5186('0x2'));var moment=require(_0x5186('0x3'));var BPromise=require(_0x5186('0x4'));var Mustache=require(_0x5186('0x5'));var util=require(_0x5186('0x6'));var path=require('path');var sox=require(_0x5186('0x7'));var csv=require(_0x5186('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5186('0x9'));var _=require(_0x5186('0xa'));var squel=require(_0x5186('0xb'));var crypto=require(_0x5186('0xc'));var jsforce=require(_0x5186('0xd'));var deskjs=require(_0x5186('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5186('0xf'));var Papa=require(_0x5186('0x10'));var Redis=require(_0x5186('0x11'));var authService=require(_0x5186('0x12'));var qs=require(_0x5186('0x13'));var as=require(_0x5186('0x14'));var hardwareService=require(_0x5186('0x15'));var logger=require(_0x5186('0x16'))(_0x5186('0x17'));var utils=require(_0x5186('0x18'));var config=require(_0x5186('0x19'));var licenseUtil=require(_0x5186('0x1a'));var db=require(_0x5186('0x1b'))['db'];function respondWithStatusCode(_0xaca394,_0x5add05){_0x5add05=_0x5add05||0xcc;return function(_0x378eea){if(_0x378eea){return _0xaca394[_0x5186('0x1c')](_0x5add05);}return _0xaca394[_0x5186('0x1d')](_0x5add05)[_0x5186('0x1e')]();};}function respondWithResult(_0x48a0ed,_0x78558f){_0x78558f=_0x78558f||0xc8;return function(_0x3b2bca){if(_0x3b2bca){return _0x48a0ed['status'](_0x78558f)[_0x5186('0x1f')](_0x3b2bca);}};}function respondWithFilteredResult(_0xe69a0d,_0x1ad064){return function(_0x3a142f){if(_0x3a142f){var _0x232f97=typeof _0x1ad064[_0x5186('0x20')]===_0x5186('0x21')&&typeof _0x1ad064[_0x5186('0x22')]==='undefined';var _0x148bb0=_0x3a142f[_0x5186('0x23')];var _0x10f1bb=_0x232f97?0x0:_0x1ad064[_0x5186('0x20')];var _0x3f2ed9=_0x232f97?_0x3a142f[_0x5186('0x23')]:_0x1ad064['offset']+_0x1ad064[_0x5186('0x22')];var _0x3559dd;if(_0x3f2ed9>=_0x148bb0){_0x3f2ed9=_0x148bb0;_0x3559dd=0xc8;}else{_0x3559dd=0xce;}_0xe69a0d[_0x5186('0x1d')](_0x3559dd);return _0xe69a0d[_0x5186('0x24')](_0x5186('0x25'),_0x10f1bb+'-'+_0x3f2ed9+'/'+_0x148bb0)[_0x5186('0x1f')](_0x3a142f);}return null;};}function patchUpdates(_0x1b0ff4){return function(_0x14c094){try{jsonpatch[_0x5186('0x26')](_0x14c094,_0x1b0ff4,!![]);}catch(_0x305ed5){return BPromise[_0x5186('0x27')](_0x305ed5);}return _0x14c094[_0x5186('0x28')]();};}function saveUpdates(_0x5933c6,_0x2de690){return function(_0x4191db){if(_0x4191db){return _0x4191db[_0x5186('0x29')](_0x5933c6)[_0x5186('0x2a')](function(_0x545198){return _0x545198;});}return null;};}function removeEntity(_0x1932a6,_0x366e41){return function(_0x5284b9){if(_0x5284b9){return _0x5284b9['destroy']()[_0x5186('0x2a')](function(){var _0x5d02d8=_0x5284b9['get']({'plain':!![]});var _0x53cd73=_0x5186('0x2b');return db[_0x5186('0x2c')][_0x5186('0x2d')]({'where':{'type':_0x53cd73,'resourceId':_0x5d02d8['id']}})[_0x5186('0x2a')](function(){return _0x5284b9;});})[_0x5186('0x2a')](function(){_0x1932a6[_0x5186('0x1d')](0xcc)[_0x5186('0x1e')]();});}};}function handleEntityNotFound(_0x1685a0,_0x2d6fb7){return function(_0x5868db){if(!_0x5868db){_0x1685a0[_0x5186('0x1c')](0x194);}return _0x5868db;};}function handleError(_0x141947,_0x524cf1){_0x524cf1=_0x524cf1||0x1f4;return function(_0x261619){logger['error'](_0x261619[_0x5186('0x2e')]);if(_0x261619[_0x5186('0x2f')]){delete _0x261619['name'];}_0x141947[_0x5186('0x1d')](_0x524cf1)[_0x5186('0x30')](_0x261619);};}exports[_0x5186('0x31')]=function(_0xa4724c,_0x1a7544){var _0x13eaa9={},_0x502194={},_0x34a5b1={'count':0x0,'rows':[]};var _0x95a5eb=_[_0x5186('0x32')](db['Trigger'][_0x5186('0x33')],function(_0x38314e){return{'name':_0x38314e[_0x5186('0x34')],'type':_0x38314e[_0x5186('0x35')][_0x5186('0x36')]};});_0x502194[_0x5186('0x37')]=_[_0x5186('0x32')](_0x95a5eb,_0x5186('0x2f'));_0x502194[_0x5186('0x38')]=_[_0x5186('0x39')](_0xa4724c[_0x5186('0x38')]);_0x502194[_0x5186('0x3a')]=_[_0x5186('0x3b')](_0x502194[_0x5186('0x37')],_0x502194[_0x5186('0x38')]);_0x13eaa9[_0x5186('0x3c')]=_[_0x5186('0x3b')](_0x502194[_0x5186('0x37')],qs[_0x5186('0x3d')](_0xa4724c[_0x5186('0x38')][_0x5186('0x3d')]));_0x13eaa9['attributes']=_0x13eaa9['attributes']['length']?_0x13eaa9['attributes']:_0x502194[_0x5186('0x37')];if(!_0xa4724c[_0x5186('0x38')][_0x5186('0x3e')](_0x5186('0x3f'))){_0x13eaa9[_0x5186('0x22')]=qs[_0x5186('0x22')](_0xa4724c[_0x5186('0x38')][_0x5186('0x22')]);_0x13eaa9[_0x5186('0x20')]=qs[_0x5186('0x20')](_0xa4724c[_0x5186('0x38')][_0x5186('0x20')]);}_0x13eaa9[_0x5186('0x40')]=qs['sort'](_0xa4724c['query'][_0x5186('0x41')]);_0x13eaa9[_0x5186('0x42')]=qs[_0x5186('0x3a')](_['pick'](_0xa4724c[_0x5186('0x38')],_0x502194[_0x5186('0x3a')]),_0x95a5eb);if(_0xa4724c['query'][_0x5186('0x43')]){_0x13eaa9['where']=_[_0x5186('0x44')](_0x13eaa9[_0x5186('0x42')],{'$or':_[_0x5186('0x32')](_0x95a5eb,function(_0xb05145){if(_0xb05145['type']!==_0x5186('0x45')){var _0x5ebdf6={};_0x5ebdf6[_0xb05145['name']]={'$like':'%'+_0xa4724c[_0x5186('0x38')]['filter']+'%'};return _0x5ebdf6;}})});}_0x13eaa9=_['merge']({},_0x13eaa9,_0xa4724c[_0x5186('0x46')]);var _0x5df899={'where':_0x13eaa9[_0x5186('0x42')]};return db[_0x5186('0x47')][_0x5186('0x23')](_0x5df899)[_0x5186('0x2a')](function(_0x34039b){_0x34a5b1[_0x5186('0x23')]=_0x34039b;if(_0xa4724c['query'][_0x5186('0x48')]){_0x13eaa9[_0x5186('0x49')]=[{'all':!![]}];}return db[_0x5186('0x47')][_0x5186('0x4a')](_0x13eaa9);})[_0x5186('0x2a')](function(_0x8d6607){_0x34a5b1[_0x5186('0x4b')]=_0x8d6607;return _0x34a5b1;})[_0x5186('0x2a')](respondWithFilteredResult(_0x1a7544,_0x13eaa9))[_0x5186('0x4c')](handleError(_0x1a7544,null));};exports['show']=function(_0x197967,_0x1f331f){var _0x2e0c3a={'raw':![],'where':{'id':_0x197967[_0x5186('0x4d')]['id']}},_0x52d776={};_0x52d776[_0x5186('0x37')]=_['keys'](db[_0x5186('0x47')][_0x5186('0x33')]);_0x52d776[_0x5186('0x38')]=_[_0x5186('0x39')](_0x197967[_0x5186('0x38')]);_0x52d776[_0x5186('0x3a')]=_['intersection'](_0x52d776[_0x5186('0x37')],_0x52d776[_0x5186('0x38')]);_0x2e0c3a[_0x5186('0x3c')]=_['intersection'](_0x52d776[_0x5186('0x37')],qs['fields'](_0x197967['query'][_0x5186('0x3d')]));_0x2e0c3a[_0x5186('0x3c')]=_0x2e0c3a['attributes'][_0x5186('0x4e')]?_0x2e0c3a['attributes']:_0x52d776[_0x5186('0x37')];if(_0x197967[_0x5186('0x38')][_0x5186('0x48')]){_0x2e0c3a[_0x5186('0x49')]=[{'all':!![]}];}_0x2e0c3a=_[_0x5186('0x44')]({},_0x2e0c3a,_0x197967['options']);return db['Trigger'][_0x5186('0x4f')](_0x2e0c3a)[_0x5186('0x2a')](handleEntityNotFound(_0x1f331f,null))[_0x5186('0x2a')](respondWithResult(_0x1f331f,null))[_0x5186('0x4c')](handleError(_0x1f331f,null));};exports[_0x5186('0x50')]=function(_0x1fab78,_0x5d1d63){return db[_0x5186('0x47')][_0x5186('0x50')](_0x1fab78[_0x5186('0x51')],{})[_0x5186('0x2a')](function(_0xd252ea){var _0x4d9704=_0x1fab78[_0x5186('0x52')][_0x5186('0x53')]({'plain':!![]});if(!_0x4d9704)throw new Error(_0x5186('0x54'));if(_0x4d9704[_0x5186('0x55')]===_0x5186('0x52')){var _0x11f4d9=_0xd252ea[_0x5186('0x53')]({'plain':!![]});var _0xfd5694=_0x5186('0x2b');return db[_0x5186('0x56')][_0x5186('0x4f')]({'where':{'name':_0xfd5694,'userProfileId':_0x4d9704['userProfileId']},'raw':!![]})['then'](function(_0x4f9687){if(_0x4f9687&&_0x4f9687[_0x5186('0x57')]===0x0){return db[_0x5186('0x2c')][_0x5186('0x50')]({'name':_0x11f4d9[_0x5186('0x2f')],'resourceId':_0x11f4d9['id'],'type':_0x4f9687[_0x5186('0x2f')],'sectionId':_0x4f9687['id']},{})['then'](function(){return _0xd252ea;});}else{return _0xd252ea;}})[_0x5186('0x4c')](function(_0x562228){logger[_0x5186('0x58')](_0x5186('0x59'),_0x562228);throw _0x562228;});}return _0xd252ea;})[_0x5186('0x2a')](respondWithResult(_0x5d1d63,0xc9))['catch'](handleError(_0x5d1d63,null));};exports[_0x5186('0x29')]=function(_0xc4fabe,_0x55b0f0){if(_0xc4fabe[_0x5186('0x51')]['id']){delete _0xc4fabe[_0x5186('0x51')]['id'];}return db[_0x5186('0x47')][_0x5186('0x4f')]({'where':{'id':_0xc4fabe[_0x5186('0x4d')]['id']}})[_0x5186('0x2a')](handleEntityNotFound(_0x55b0f0,null))[_0x5186('0x2a')](saveUpdates(_0xc4fabe[_0x5186('0x51')],null))[_0x5186('0x2a')](respondWithResult(_0x55b0f0,null))[_0x5186('0x4c')](handleError(_0x55b0f0,null));};exports[_0x5186('0x2d')]=function(_0x12bdfa,_0x7c77eb){return db[_0x5186('0x47')]['find']({'where':{'id':_0x12bdfa[_0x5186('0x4d')]['id']}})[_0x5186('0x2a')](handleEntityNotFound(_0x7c77eb,null))[_0x5186('0x2a')](removeEntity(_0x7c77eb,null))[_0x5186('0x4c')](handleError(_0x7c77eb,null));};exports[_0x5186('0x5a')]=function(_0x17cbc7,_0x1d4595,_0x4149c8){if(_0x17cbc7[_0x5186('0x51')]['id']){delete _0x17cbc7[_0x5186('0x51')]['id'];}return db[_0x5186('0x47')]['find']({'where':{'id':_0x17cbc7[_0x5186('0x4d')]['id']}})[_0x5186('0x2a')](handleEntityNotFound(_0x1d4595,null))['then'](function(_0x16b6b2){if(_0x16b6b2){_0x17cbc7['body'][_0x5186('0x5b')]=_0x16b6b2['id'];return db[_0x5186('0x5c')][_0x5186('0x50')](_0x17cbc7[_0x5186('0x51')]);}})[_0x5186('0x2a')](respondWithResult(_0x1d4595,null))[_0x5186('0x4c')](handleError(_0x1d4595,null));};exports['addAnyCondition']=function(_0x543693,_0x329abc,_0x2a1a15){if(_0x543693[_0x5186('0x51')]['id']){delete _0x543693[_0x5186('0x51')]['id'];}return db[_0x5186('0x47')][_0x5186('0x4f')]({'where':{'id':_0x543693[_0x5186('0x4d')]['id']}})[_0x5186('0x2a')](handleEntityNotFound(_0x329abc,null))[_0x5186('0x2a')](function(_0x4dc742){if(_0x4dc742){_0x543693['body'][_0x5186('0x5d')]=_0x4dc742['id'];return db[_0x5186('0x5c')][_0x5186('0x50')](_0x543693['body']);}})[_0x5186('0x2a')](respondWithResult(_0x329abc,null))['catch'](handleError(_0x329abc,null));};exports[_0x5186('0x5e')]=function(_0x4a6a75,_0x3970ce,_0x1bf19b){var _0x5320e6={};var _0x569d4c={};var _0x5490a6;var _0x578aac;return db[_0x5186('0x47')][_0x5186('0x5f')]({'where':{'id':_0x4a6a75['params']['id']}})[_0x5186('0x2a')](handleEntityNotFound(_0x3970ce,null))[_0x5186('0x2a')](function(_0x2bc06c){if(_0x2bc06c){_0x5490a6=_0x2bc06c;_0x569d4c[_0x5186('0x37')]=_['keys'](db[_0x5186('0x5c')][_0x5186('0x33')]);_0x569d4c[_0x5186('0x38')]=_[_0x5186('0x39')](_0x4a6a75[_0x5186('0x38')]);_0x569d4c[_0x5186('0x3a')]=_[_0x5186('0x3b')](_0x569d4c['model'],_0x569d4c[_0x5186('0x38')]);_0x5320e6[_0x5186('0x3c')]=_[_0x5186('0x3b')](_0x569d4c[_0x5186('0x37')],qs[_0x5186('0x3d')](_0x4a6a75[_0x5186('0x38')][_0x5186('0x3d')]));_0x5320e6['attributes']=_0x5320e6[_0x5186('0x3c')]['length']?_0x5320e6[_0x5186('0x3c')]:_0x569d4c[_0x5186('0x37')];_0x5320e6['order']=qs[_0x5186('0x41')](_0x4a6a75[_0x5186('0x38')][_0x5186('0x41')]);_0x5320e6[_0x5186('0x42')]=qs[_0x5186('0x3a')](_[_0x5186('0x60')](_0x4a6a75[_0x5186('0x38')],_0x569d4c[_0x5186('0x3a')]));if(_0x4a6a75[_0x5186('0x38')][_0x5186('0x43')]){_0x5320e6['where']=_[_0x5186('0x44')](_0x5320e6['where'],{'$or':_['map'](_0x5320e6[_0x5186('0x3c')],function(_0x142a4d){var _0x5439ff={};_0x5439ff[_0x142a4d]={'$like':'%'+_0x4a6a75[_0x5186('0x38')][_0x5186('0x43')]+'%'};return _0x5439ff;})});}_0x5320e6=_[_0x5186('0x44')]({},_0x5320e6,_0x4a6a75['options']);return _0x5490a6[_0x5186('0x5e')](_0x5320e6);}})[_0x5186('0x2a')](function(_0xa09117){if(_0xa09117){_0x578aac=_0xa09117['length'];if(!_0x4a6a75[_0x5186('0x38')]['hasOwnProperty'](_0x5186('0x3f'))){_0x5320e6[_0x5186('0x22')]=qs[_0x5186('0x22')](_0x4a6a75[_0x5186('0x38')][_0x5186('0x22')]);_0x5320e6[_0x5186('0x20')]=qs[_0x5186('0x20')](_0x4a6a75[_0x5186('0x38')][_0x5186('0x20')]);}return _0x5490a6['getAllConditions'](_0x5320e6);}})[_0x5186('0x2a')](function(_0x111524){if(_0x111524){return _0x111524?{'count':_0x578aac,'rows':_0x111524}:null;}})[_0x5186('0x2a')](respondWithResult(_0x3970ce,null))[_0x5186('0x4c')](handleError(_0x3970ce,null));};exports['getAnyConditions']=function(_0x3571a4,_0x4e80e1,_0x57d5ce){var _0x358870={};var _0xcf77c1={};var _0x216342;var _0x20000c;return db['Trigger']['findOne']({'where':{'id':_0x3571a4[_0x5186('0x4d')]['id']}})[_0x5186('0x2a')](handleEntityNotFound(_0x4e80e1,null))[_0x5186('0x2a')](function(_0x40b62e){if(_0x40b62e){_0x216342=_0x40b62e;_0xcf77c1['model']=_[_0x5186('0x39')](db[_0x5186('0x5c')][_0x5186('0x33')]);_0xcf77c1[_0x5186('0x38')]=_[_0x5186('0x39')](_0x3571a4[_0x5186('0x38')]);_0xcf77c1[_0x5186('0x3a')]=_[_0x5186('0x3b')](_0xcf77c1[_0x5186('0x37')],_0xcf77c1[_0x5186('0x38')]);_0x358870[_0x5186('0x3c')]=_[_0x5186('0x3b')](_0xcf77c1[_0x5186('0x37')],qs[_0x5186('0x3d')](_0x3571a4[_0x5186('0x38')][_0x5186('0x3d')]));_0x358870[_0x5186('0x3c')]=_0x358870[_0x5186('0x3c')][_0x5186('0x4e')]?_0x358870[_0x5186('0x3c')]:_0xcf77c1[_0x5186('0x37')];_0x358870['order']=qs[_0x5186('0x41')](_0x3571a4[_0x5186('0x38')][_0x5186('0x41')]);_0x358870[_0x5186('0x42')]=qs['filters'](_[_0x5186('0x60')](_0x3571a4['query'],_0xcf77c1['filters']));if(_0x3571a4[_0x5186('0x38')][_0x5186('0x43')]){_0x358870['where']=_[_0x5186('0x44')](_0x358870[_0x5186('0x42')],{'$or':_[_0x5186('0x32')](_0x358870[_0x5186('0x3c')],function(_0x4b542e){var _0x57964c={};_0x57964c[_0x4b542e]={'$like':'%'+_0x3571a4[_0x5186('0x38')][_0x5186('0x43')]+'%'};return _0x57964c;})});}_0x358870=_[_0x5186('0x44')]({},_0x358870,_0x3571a4[_0x5186('0x46')]);return _0x216342[_0x5186('0x61')](_0x358870);}})[_0x5186('0x2a')](function(_0x21dee3){if(_0x21dee3){_0x20000c=_0x21dee3['length'];if(!_0x3571a4['query']['hasOwnProperty'](_0x5186('0x3f'))){_0x358870['limit']=qs[_0x5186('0x22')](_0x3571a4[_0x5186('0x38')][_0x5186('0x22')]);_0x358870['offset']=qs['offset'](_0x3571a4[_0x5186('0x38')][_0x5186('0x20')]);}return _0x216342[_0x5186('0x61')](_0x358870);}})[_0x5186('0x2a')](function(_0x8532cb){if(_0x8532cb){return _0x8532cb?{'count':_0x20000c,'rows':_0x8532cb}:null;}})[_0x5186('0x2a')](respondWithResult(_0x4e80e1,null))['catch'](handleError(_0x4e80e1,null));};exports[_0x5186('0x62')]=function(_0x674599,_0x253118,_0x5097fc){if(_0x674599['body']['id']){delete _0x674599[_0x5186('0x51')]['id'];}return db[_0x5186('0x47')][_0x5186('0x4f')]({'where':{'id':_0x674599[_0x5186('0x4d')]['id']}})['then'](handleEntityNotFound(_0x253118,null))['then'](function(_0x25c3f2){if(_0x25c3f2){_0x674599[_0x5186('0x51')][_0x5186('0x63')]=_0x25c3f2['id'];return db[_0x5186('0x64')][_0x5186('0x50')](_0x674599[_0x5186('0x51')]);}})[_0x5186('0x2a')](respondWithResult(_0x253118,null))['catch'](handleError(_0x253118,null));};exports[_0x5186('0x65')]=function(_0x38e8fb,_0xb3a08,_0x3607cc){var _0x55e72e={};var _0x4044ab={};var _0x3451d2;var _0x3017cb;return db[_0x5186('0x47')][_0x5186('0x5f')]({'where':{'id':_0x38e8fb[_0x5186('0x4d')]['id']}})[_0x5186('0x2a')](handleEntityNotFound(_0xb3a08,null))['then'](function(_0x4d35ee){if(_0x4d35ee){_0x3451d2=_0x4d35ee;_0x4044ab[_0x5186('0x37')]=_[_0x5186('0x39')](db[_0x5186('0x64')]['rawAttributes']);_0x4044ab[_0x5186('0x38')]=_[_0x5186('0x39')](_0x38e8fb['query']);_0x4044ab[_0x5186('0x3a')]=_[_0x5186('0x3b')](_0x4044ab[_0x5186('0x37')],_0x4044ab[_0x5186('0x38')]);_0x55e72e[_0x5186('0x3c')]=_[_0x5186('0x3b')](_0x4044ab[_0x5186('0x37')],qs['fields'](_0x38e8fb[_0x5186('0x38')][_0x5186('0x3d')]));_0x55e72e[_0x5186('0x3c')]=_0x55e72e['attributes'][_0x5186('0x4e')]?_0x55e72e[_0x5186('0x3c')]:_0x4044ab[_0x5186('0x37')];_0x55e72e[_0x5186('0x40')]=qs[_0x5186('0x41')](_0x38e8fb[_0x5186('0x38')][_0x5186('0x41')]);_0x55e72e[_0x5186('0x42')]=qs['filters'](_[_0x5186('0x60')](_0x38e8fb[_0x5186('0x38')],_0x4044ab[_0x5186('0x3a')]));if(_0x38e8fb['query'][_0x5186('0x43')]){_0x55e72e[_0x5186('0x42')]=_[_0x5186('0x44')](_0x55e72e[_0x5186('0x42')],{'$or':_[_0x5186('0x32')](_0x55e72e[_0x5186('0x3c')],function(_0xcd74f7){var _0x2d671e={};_0x2d671e[_0xcd74f7]={'$like':'%'+_0x38e8fb[_0x5186('0x38')]['filter']+'%'};return _0x2d671e;})});}_0x55e72e=_[_0x5186('0x44')]({},_0x55e72e,_0x38e8fb[_0x5186('0x46')]);return _0x3451d2[_0x5186('0x65')](_0x55e72e);}})['then'](function(_0x98fcec){if(_0x98fcec){_0x3017cb=_0x98fcec[_0x5186('0x4e')];if(!_0x38e8fb[_0x5186('0x38')][_0x5186('0x3e')](_0x5186('0x3f'))){_0x55e72e['limit']=qs[_0x5186('0x22')](_0x38e8fb[_0x5186('0x38')][_0x5186('0x22')]);_0x55e72e[_0x5186('0x20')]=qs[_0x5186('0x20')](_0x38e8fb[_0x5186('0x38')][_0x5186('0x20')]);}return _0x3451d2[_0x5186('0x65')](_0x55e72e);}})['then'](function(_0x35e8c0){if(_0x35e8c0){return _0x35e8c0?{'count':_0x3017cb,'rows':_0x35e8c0}:null;}})[_0x5186('0x2a')](respondWithResult(_0xb3a08,null))['catch'](handleError(_0xb3a08,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index a2ddb64..ac5d8f6 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 _0x6ec9=['exports','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x3810b8,_0x907636){var _0x1d30b4=function(_0xcd759d){while(--_0xcd759d){_0x3810b8['push'](_0x3810b8['shift']());}};_0x1d30b4(++_0x907636);}(_0x6ec9,0x174));var _0x96ec=function(_0x391ad4,_0x4900fe){_0x391ad4=_0x391ad4-0x0;var _0x456349=_0x6ec9[_0x391ad4];return _0x456349;};'use strict';var _=require(_0x96ec('0x0'));var util=require('util');var logger=require(_0x96ec('0x1'))('api');var moment=require(_0x96ec('0x2'));var BPromise=require('bluebird');var rp=require(_0x96ec('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96ec('0x4'));var config=require(_0x96ec('0x5'));var attributes=require('./trigger.attributes');module[_0x96ec('0x6')]=function(_0x41a215,_0x2fcbb7){return _0x41a215['define']('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef39=['../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xfc7156,_0x3d9546){var _0x4adc58=function(_0x544d08){while(--_0x544d08){_0xfc7156['push'](_0xfc7156['shift']());}};_0x4adc58(++_0x3d9546);}(_0xef39,0x92));var _0x9ef3=function(_0x355320,_0x24fbaf){_0x355320=_0x355320-0x0;var _0x36616b=_0xef39[_0x355320];return _0x36616b;};'use strict';var _=require('lodash');var util=require(_0x9ef3('0x0'));var logger=require(_0x9ef3('0x1'))(_0x9ef3('0x2'));var moment=require(_0x9ef3('0x3'));var BPromise=require(_0x9ef3('0x4'));var rp=require(_0x9ef3('0x5'));var fs=require('fs');var path=require(_0x9ef3('0x6'));var rimraf=require(_0x9ef3('0x7'));var config=require(_0x9ef3('0x8'));var attributes=require(_0x9ef3('0x9'));module[_0x9ef3('0xa')]=function(_0x42911f,_0x50b950){return _0x42911f[_0x9ef3('0xb')](_0x9ef3('0xc'),attributes,{'tableName':_0x9ef3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 93ff133..94cfc87 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 _0x01a5=['include','map','attributes','model','then','debug','ShowTrigger','find','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrigger','Trigger','findAll','options','raw','where','limit'];(function(_0x4e7e7c,_0x11b73e){var _0x588028=function(_0x1d230f){while(--_0x1d230f){_0x4e7e7c['push'](_0x4e7e7c['shift']());}};_0x588028(++_0x11b73e);}(_0x01a5,0x1ad));var _0x501a=function(_0x15bcb1,_0x5832fc){_0x15bcb1=_0x15bcb1-0x0;var _0x1c6f94=_0x01a5[_0x15bcb1];return _0x1c6f94;};'use strict';var _=require(_0x501a('0x0'));var util=require('util');var moment=require(_0x501a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x501a('0x2'));var db=require(_0x501a('0x3'))['db'];var utils=require(_0x501a('0x4'));var logger=require(_0x501a('0x5'))(_0x501a('0x6'));var config=require(_0x501a('0x7'));var jayson=require(_0x501a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12463e,_0x13e107,_0x52d612){return new BPromise(function(_0x1e64c7,_0x1ea6a1){return client[_0x501a('0x9')](_0x12463e,_0x52d612)['then'](function(_0x1461c7){logger[_0x501a('0xa')](_0x501a('0xb'),_0x13e107,_0x501a('0xc'));logger['debug'](_0x501a('0xd'),_0x13e107,_0x501a('0xc'),JSON[_0x501a('0xe')](_0x1461c7));if(_0x1461c7['error']){if(_0x1461c7[_0x501a('0xf')][_0x501a('0x10')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x13e107,_0x1461c7[_0x501a('0xf')][_0x501a('0x11')]);return _0x1ea6a1(_0x1461c7[_0x501a('0xf')]['message']);}logger[_0x501a('0xf')](_0x501a('0xb'),_0x13e107,_0x1461c7[_0x501a('0xf')][_0x501a('0x11')]);return _0x1e64c7(_0x1461c7[_0x501a('0xf')][_0x501a('0x11')]);}else{logger[_0x501a('0xa')]('Trigger,\x20%s,\x20%s',_0x13e107,_0x501a('0xc'));_0x1e64c7(_0x1461c7[_0x501a('0x12')][_0x501a('0x11')]);}})['catch'](function(_0x168233){logger[_0x501a('0xf')](_0x501a('0xb'),_0x13e107,_0x168233);_0x1ea6a1(_0x168233);});});}exports[_0x501a('0x13')]=function(_0x2ed247){var _0x1321fc=this;return new Promise(function(_0x11964e,_0x46bbd4){return db[_0x501a('0x14')][_0x501a('0x15')]({'raw':_0x2ed247[_0x501a('0x16')]?_0x2ed247[_0x501a('0x16')][_0x501a('0x17')]===undefined?!![]:![]:!![],'where':_0x2ed247[_0x501a('0x16')]?_0x2ed247[_0x501a('0x16')][_0x501a('0x18')]||null:null,'attributes':_0x2ed247['options']?_0x2ed247['options']['attributes']||null:null,'limit':_0x2ed247['options']?_0x2ed247[_0x501a('0x16')][_0x501a('0x19')]||null:null,'include':_0x2ed247['options']?_0x2ed247[_0x501a('0x16')][_0x501a('0x1a')]?_[_0x501a('0x1b')](_0x2ed247['options'][_0x501a('0x1a')],function(_0x25c4f2){return{'model':db[_0x25c4f2['model']],'as':_0x25c4f2['as'],'attributes':_0x25c4f2[_0x501a('0x1c')],'include':_0x25c4f2['include']?_[_0x501a('0x1b')](_0x25c4f2[_0x501a('0x1a')],function(_0x2fe804){return{'model':db[_0x2fe804[_0x501a('0x1d')]],'as':_0x2fe804['as'],'attributes':_0x2fe804[_0x501a('0x1c')],'include':_0x2fe804[_0x501a('0x1a')]?_[_0x501a('0x1b')](_0x2fe804['include'],function(_0x1f6600){return{'model':db[_0x1f6600[_0x501a('0x1d')]],'as':_0x1f6600['as'],'attributes':_0x1f6600['attributes']};}):[]};}):[]};}):[]:[]})[_0x501a('0x1e')](function(_0x505a3e){logger[_0x501a('0xa')](_0x501a('0x13'),_0x2ed247);logger[_0x501a('0x1f')](_0x501a('0x13'),_0x2ed247,JSON[_0x501a('0xe')](_0x505a3e));_0x11964e(_0x505a3e);})['catch'](function(_0x1aa439){logger[_0x501a('0xf')](_0x501a('0x13'),_0x1aa439['message'],_0x2ed247);_0x46bbd4(_0x1321fc[_0x501a('0xf')](0x1f4,_0x1aa439[_0x501a('0x11')]));});});};exports[_0x501a('0x20')]=function(_0x335196){var _0x4ee6eb=this;return new Promise(function(_0x594dd9,_0x3fc234){return db[_0x501a('0x14')][_0x501a('0x21')]({'raw':_0x335196[_0x501a('0x16')]?_0x335196[_0x501a('0x16')][_0x501a('0x17')]===undefined?!![]:![]:!![],'where':_0x335196[_0x501a('0x16')]?_0x335196[_0x501a('0x16')][_0x501a('0x18')]||null:null,'attributes':_0x335196[_0x501a('0x16')]?_0x335196[_0x501a('0x16')][_0x501a('0x1c')]||null:null,'include':_0x335196['options']?_0x335196[_0x501a('0x16')]['include']?_['map'](_0x335196['options'][_0x501a('0x1a')],function(_0x2becc9){return{'model':db[_0x2becc9[_0x501a('0x1d')]],'as':_0x2becc9['as'],'attributes':_0x2becc9['attributes'],'include':_0x2becc9[_0x501a('0x1a')]?_['map'](_0x2becc9['include'],function(_0x340368){return{'model':db[_0x340368[_0x501a('0x1d')]],'as':_0x340368['as'],'attributes':_0x340368[_0x501a('0x1c')],'include':_0x340368[_0x501a('0x1a')]?_[_0x501a('0x1b')](_0x340368['include'],function(_0x3e38e1){return{'model':db[_0x3e38e1[_0x501a('0x1d')]],'as':_0x3e38e1['as'],'attributes':_0x3e38e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x501a('0x1e')](function(_0x48ece8){logger[_0x501a('0xa')]('ShowTrigger',_0x335196);logger['debug'](_0x501a('0x20'),_0x335196,JSON['stringify'](_0x48ece8));_0x594dd9(_0x48ece8);})[_0x501a('0x22')](function(_0x3c70e3){logger[_0x501a('0xf')](_0x501a('0x20'),_0x3c70e3[_0x501a('0x11')],_0x335196);_0x3fc234(_0x4ee6eb[_0x501a('0xf')](0x1f4,_0x3c70e3[_0x501a('0x11')]));});});}; \ No newline at end of file +var _0xf5d0=['raw','where','attributes','include','model','map','catch','ShowTrigger','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetTrigger','Trigger','options'];(function(_0x2ed7d1,_0x363741){var _0x38ae3c=function(_0x4a1b42){while(--_0x4a1b42){_0x2ed7d1['push'](_0x2ed7d1['shift']());}};_0x38ae3c(++_0x363741);}(_0xf5d0,0x144));var _0x0f5d=function(_0x25ceea,_0x40fad8){_0x25ceea=_0x25ceea-0x0;var _0x25d27f=_0xf5d0[_0x25ceea];return _0x25d27f;};'use strict';var _=require('lodash');var util=require(_0x0f5d('0x0'));var moment=require(_0x0f5d('0x1'));var BPromise=require(_0x0f5d('0x2'));var rs=require(_0x0f5d('0x3'));var fs=require('fs');var Redis=require(_0x0f5d('0x4'));var db=require(_0x0f5d('0x5'))['db'];var utils=require(_0x0f5d('0x6'));var logger=require(_0x0f5d('0x7'))('rpc');var config=require(_0x0f5d('0x8'));var jayson=require(_0x0f5d('0x9'));var client=jayson[_0x0f5d('0xa')][_0x0f5d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x226fd3,_0x16bc86,_0x4520d1){return new BPromise(function(_0xa952bb,_0x2a4848){return client[_0x0f5d('0xc')](_0x226fd3,_0x4520d1)[_0x0f5d('0xd')](function(_0x22a2e2){logger[_0x0f5d('0xe')](_0x0f5d('0xf'),_0x16bc86,_0x0f5d('0x10'));logger[_0x0f5d('0x11')](_0x0f5d('0x12'),_0x16bc86,_0x0f5d('0x10'),JSON[_0x0f5d('0x13')](_0x22a2e2));if(_0x22a2e2[_0x0f5d('0x14')]){if(_0x22a2e2[_0x0f5d('0x14')][_0x0f5d('0x15')]===0x1f4){logger[_0x0f5d('0x14')](_0x0f5d('0xf'),_0x16bc86,_0x22a2e2['error']['message']);return _0x2a4848(_0x22a2e2['error'][_0x0f5d('0x16')]);}logger[_0x0f5d('0x14')](_0x0f5d('0xf'),_0x16bc86,_0x22a2e2['error'][_0x0f5d('0x16')]);return _0xa952bb(_0x22a2e2['error']['message']);}else{logger['info'](_0x0f5d('0xf'),_0x16bc86,_0x0f5d('0x10'));_0xa952bb(_0x22a2e2['result']['message']);}})['catch'](function(_0x4ada35){logger['error'](_0x0f5d('0xf'),_0x16bc86,_0x4ada35);_0x2a4848(_0x4ada35);});});}exports[_0x0f5d('0x17')]=function(_0x57006d){var _0x3789bf=this;return new Promise(function(_0x5672fb,_0x5f584d){return db[_0x0f5d('0x18')]['findAll']({'raw':_0x57006d[_0x0f5d('0x19')]?_0x57006d[_0x0f5d('0x19')][_0x0f5d('0x1a')]===undefined?!![]:![]:!![],'where':_0x57006d[_0x0f5d('0x19')]?_0x57006d['options'][_0x0f5d('0x1b')]||null:null,'attributes':_0x57006d[_0x0f5d('0x19')]?_0x57006d[_0x0f5d('0x19')][_0x0f5d('0x1c')]||null:null,'limit':_0x57006d[_0x0f5d('0x19')]?_0x57006d[_0x0f5d('0x19')]['limit']||null:null,'include':_0x57006d[_0x0f5d('0x19')]?_0x57006d[_0x0f5d('0x19')][_0x0f5d('0x1d')]?_['map'](_0x57006d[_0x0f5d('0x19')][_0x0f5d('0x1d')],function(_0x4ac811){return{'model':db[_0x4ac811[_0x0f5d('0x1e')]],'as':_0x4ac811['as'],'attributes':_0x4ac811[_0x0f5d('0x1c')],'include':_0x4ac811[_0x0f5d('0x1d')]?_[_0x0f5d('0x1f')](_0x4ac811['include'],function(_0x187269){return{'model':db[_0x187269[_0x0f5d('0x1e')]],'as':_0x187269['as'],'attributes':_0x187269[_0x0f5d('0x1c')],'include':_0x187269[_0x0f5d('0x1d')]?_['map'](_0x187269[_0x0f5d('0x1d')],function(_0x545efa){return{'model':db[_0x545efa['model']],'as':_0x545efa['as'],'attributes':_0x545efa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x597d57){logger['info'](_0x0f5d('0x17'),_0x57006d);logger[_0x0f5d('0x11')](_0x0f5d('0x17'),_0x57006d,JSON['stringify'](_0x597d57));_0x5672fb(_0x597d57);})[_0x0f5d('0x20')](function(_0x3484ff){logger[_0x0f5d('0x14')](_0x0f5d('0x17'),_0x3484ff[_0x0f5d('0x16')],_0x57006d);_0x5f584d(_0x3789bf[_0x0f5d('0x14')](0x1f4,_0x3484ff['message']));});});};exports[_0x0f5d('0x21')]=function(_0x3f37d9){var _0xfc8a7=this;return new Promise(function(_0x4818d3,_0x24a45d){return db[_0x0f5d('0x18')][_0x0f5d('0x22')]({'raw':_0x3f37d9[_0x0f5d('0x19')]?_0x3f37d9[_0x0f5d('0x19')][_0x0f5d('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f37d9[_0x0f5d('0x19')]?_0x3f37d9[_0x0f5d('0x19')][_0x0f5d('0x1b')]||null:null,'attributes':_0x3f37d9[_0x0f5d('0x19')]?_0x3f37d9[_0x0f5d('0x19')][_0x0f5d('0x1c')]||null:null,'include':_0x3f37d9['options']?_0x3f37d9[_0x0f5d('0x19')][_0x0f5d('0x1d')]?_[_0x0f5d('0x1f')](_0x3f37d9[_0x0f5d('0x19')]['include'],function(_0x52c379){return{'model':db[_0x52c379[_0x0f5d('0x1e')]],'as':_0x52c379['as'],'attributes':_0x52c379[_0x0f5d('0x1c')],'include':_0x52c379[_0x0f5d('0x1d')]?_[_0x0f5d('0x1f')](_0x52c379[_0x0f5d('0x1d')],function(_0x2f9988){return{'model':db[_0x2f9988['model']],'as':_0x2f9988['as'],'attributes':_0x2f9988['attributes'],'include':_0x2f9988[_0x0f5d('0x1d')]?_[_0x0f5d('0x1f')](_0x2f9988[_0x0f5d('0x1d')],function(_0x195a47){return{'model':db[_0x195a47[_0x0f5d('0x1e')]],'as':_0x195a47['as'],'attributes':_0x195a47[_0x0f5d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0f5d('0xd')](function(_0x4b909b){logger['info']('ShowTrigger',_0x3f37d9);logger[_0x0f5d('0x11')](_0x0f5d('0x21'),_0x3f37d9,JSON[_0x0f5d('0x13')](_0x4b909b));_0x4818d3(_0x4b909b);})[_0x0f5d('0x20')](function(_0x41d086){logger[_0x0f5d('0x14')]('ShowTrigger',_0x41d086[_0x0f5d('0x16')],_0x3f37d9);_0x24a45d(_0xfc8a7['error'](0x1f4,_0x41d086['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index c679a04..c9f9557 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 _0x1651=['../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','create','put','delete','exports','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x3c97c4,_0x580c6c){var _0x54184f=function(_0x3e0ed3){while(--_0x3e0ed3){_0x3c97c4['push'](_0x3c97c4['shift']());}};_0x54184f(++_0x580c6c);}(_0x1651,0xb0));var _0x1165=function(_0x2968b8,_0x6c391d){_0x2968b8=_0x2968b8-0x0;var _0x2c8c17=_0x1651[_0x2968b8];return _0x2c8c17;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1165('0x0'));var timeout=require(_0x1165('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1165('0x2'));var auth=require(_0x1165('0x3'));var interaction=require(_0x1165('0x4'));var config=require(_0x1165('0x5'));var controller=require(_0x1165('0x6'));router[_0x1165('0x7')]('/',auth[_0x1165('0x8')](),controller[_0x1165('0x9')]);router[_0x1165('0x7')](_0x1165('0xa'),auth[_0x1165('0x8')](),controller[_0x1165('0xb')]);router[_0x1165('0xc')](_0x1165('0xd'),auth[_0x1165('0x8')](),controller['clone']);router[_0x1165('0xc')]('/',auth[_0x1165('0x8')](),controller[_0x1165('0xe')]);router[_0x1165('0xf')](_0x1165('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x1165('0x10')]('/:id',auth[_0x1165('0x8')](),controller['destroy']);module[_0x1165('0x11')]=router; \ No newline at end of file +var _0x1acd=['/:id','show','post','/:id/clone','clone','create','put','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index'];(function(_0xac0d3,_0x3d1441){var _0x277107=function(_0x3fc977){while(--_0x3fc977){_0xac0d3['push'](_0xac0d3['shift']());}};_0x277107(++_0x3d1441);}(_0x1acd,0x1d5));var _0xd1ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1acd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd1ac('0x0'));var path=require(_0xd1ac('0x1'));var timeout=require(_0xd1ac('0x2'));var express=require('express');var router=express[_0xd1ac('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd1ac('0x4'));var interaction=require(_0xd1ac('0x5'));var config=require(_0xd1ac('0x6'));var controller=require(_0xd1ac('0x7'));router[_0xd1ac('0x8')]('/',auth[_0xd1ac('0x9')](),controller[_0xd1ac('0xa')]);router[_0xd1ac('0x8')](_0xd1ac('0xb'),auth[_0xd1ac('0x9')](),controller[_0xd1ac('0xc')]);router[_0xd1ac('0xd')](_0xd1ac('0xe'),auth['isAuthenticated'](),controller[_0xd1ac('0xf')]);router[_0xd1ac('0xd')]('/',auth[_0xd1ac('0x9')](),controller[_0xd1ac('0x10')]);router[_0xd1ac('0x11')](_0xd1ac('0xb'),auth[_0xd1ac('0x9')](),controller['update']);router['delete'](_0xd1ac('0xb'),auth[_0xd1ac('0x9')](),controller[_0xd1ac('0x12')]);module[_0xd1ac('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 15b4937..e0e26e2 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 _0x5508=['join','getDataValue','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','refuse','originate','INTEGER','uac','uas','pai','fingerprint','certificate','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport'];(function(_0x5534fe,_0x43c22e){var _0x3d1dc2=function(_0x9df12){while(--_0x9df12){_0x5534fe['push'](_0x5534fe['shift']());}};_0x3d1dc2(++_0x43c22e);}(_0x5508,0xea));var _0x8550=function(_0x11202f,_0x41fbe1){_0x11202f=_0x11202f-0x0;var _0x41edd3=_0x5508[_0x11202f];return _0x41edd3;};'use strict';var Sequelize=require(_0x8550('0x0'));module[_0x8550('0x1')]={'name':{'type':Sequelize[_0x8550('0x2')],'allowNull':![],'unique':_0x8550('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8550('0x4')](_0x8550('0x5'),_0x8550('0x6'),'peer'),'allowNull':![],'defaultValue':_0x8550('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8550('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0x8550('0x8'),'ALLOWED_PASSED_SCREEN',_0x8550('0x9'),_0x8550('0xa'),'PROHIB_NOT_SCREENED',_0x8550('0xb'),_0x8550('0xc'),_0x8550('0xd'))},'deny':{'type':Sequelize[_0x8550('0x2')]},'permit':{'type':Sequelize[_0x8550('0x2')]},'secret':{'type':Sequelize[_0x8550('0x2')]},'md5secret':{'type':Sequelize[_0x8550('0x2')]},'remotesecret':{'type':Sequelize[_0x8550('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x1cc0c4){this[_0x8550('0xe')](_0x8550('0xf'),_0x1cc0c4?_0x1cc0c4[_0x8550('0x10')](','):null);},'get':function(){return this[_0x8550('0x11')](_0x8550('0xf'))?this['getDataValue'](_0x8550('0xf'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x8550('0x4')](_0x8550('0x12'),_0x8550('0x13'),_0x8550('0x14'),_0x8550('0x15'),_0x8550('0x16')),'defaultValue':_0x8550('0x12')},'directmedia':{'type':Sequelize[_0x8550('0x4')](_0x8550('0x17'),'no',_0x8550('0x18'),'update',_0x8550('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8550('0x2')]},'directmediadeny':{'type':Sequelize[_0x8550('0x2')]},'nat':{'type':Sequelize[_0x8550('0x2')],'defaultValue':_0x8550('0x1a'),'set':function(_0x2639a5){this[_0x8550('0xe')]('nat',_0x2639a5?_0x2639a5[_0x8550('0x10')](','):null);},'get':function(){return this[_0x8550('0x11')]('nat')?this[_0x8550('0x11')]('nat')[_0x8550('0x1b')](','):null;},'comment':_0x8550('0x1c')},'callgroup':{'type':Sequelize[_0x8550('0x2')]},'namedcallgroup':{'type':Sequelize[_0x8550('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x8550('0x2')]},'language':{'type':Sequelize[_0x8550('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8550('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x8550('0x2')],'defaultValue':_0x8550('0x1d')},'allow':{'type':Sequelize[_0x8550('0x2')],'allowNull':![],'defaultValue':_0x8550('0x1e'),'set':function(_0x88c00b){this[_0x8550('0xe')](_0x8550('0x1f'),_0x88c00b?_0x88c00b[_0x8550('0x10')](';'):_0x8550('0x1e'));},'get':function(){return this[_0x8550('0x11')](_0x8550('0x1f'))?this[_0x8550('0x11')](_0x8550('0x1f'))[_0x8550('0x1b')](';'):null;},'comment':_0x8550('0x20')},'autoframing':{'type':Sequelize[_0x8550('0x4')](_0x8550('0x17'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x8550('0x21'),'set':function(_0x123df7){this[_0x8550('0xe')](_0x8550('0x22'),_0x123df7?_0x123df7['join'](','):null);},'get':function(){return this[_0x8550('0x11')](_0x8550('0x22'))?this['getDataValue'](_0x8550('0x22'))['split'](','):null;},'comment':_0x8550('0x23')},'trustrpid':{'type':Sequelize[_0x8550('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x8550('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x8550('0x24'))},'promiscredir':{'type':Sequelize[_0x8550('0x4')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x8550('0x17'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x8550('0x2')]},'callerid':{'type':Sequelize[_0x8550('0x2')],'defaultValue':_0x8550('0x25')},'amaflags':{'type':Sequelize[_0x8550('0x2')]},'callcounter':{'type':Sequelize[_0x8550('0x4')](_0x8550('0x17'),'no'),'defaultValue':_0x8550('0x17')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x8550('0x4')](_0x8550('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x8550('0x4')](_0x8550('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x8550('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x8550('0x4')](_0x8550('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x8550('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x8550('0x4')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x8550('0x17'),'no')},'mailbox':{'type':Sequelize[_0x8550('0x2')]},'session_timers':{'type':Sequelize[_0x8550('0x4')]('accept',_0x8550('0x26'),_0x8550('0x27'))},'session_expires':{'type':Sequelize[_0x8550('0x28')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x8550('0x4')](_0x8550('0x29'),_0x8550('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x8550('0x2')]},'regexten':{'type':Sequelize[_0x8550('0x2')]},'fromdomain':{'type':Sequelize[_0x8550('0x2')]},'fromuser':{'type':Sequelize[_0x8550('0x2')]},'port':{'type':Sequelize[_0x8550('0x28')](0x5)},'qualify':{'type':Sequelize[_0x8550('0x4')]('yes','no'),'defaultValue':_0x8550('0x17')},'keepalive':{'type':Sequelize[_0x8550('0x28')](0xb)},'defaultip':{'type':Sequelize[_0x8550('0x2')]},'defaultuser':{'type':Sequelize[_0x8550('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x8550('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x8550('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0x8550('0x4')](_0x8550('0x17'),'no',_0x8550('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8550('0x2')]},'callbackextension':{'type':Sequelize[_0x8550('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x8550('0x28')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x8550('0x2')]},'contactdeny':{'type':Sequelize[_0x8550('0x2')]},'contactacl':{'type':Sequelize[_0x8550('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x8550('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x8550('0x4')](_0x8550('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x8550('0x17'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x8550('0x17'),'no')},'icesupport':{'type':Sequelize[_0x8550('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x8550('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x8550('0x4')](_0x8550('0x17'),'no',_0x8550('0x2c'),_0x8550('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x8550('0x28')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x8550('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x8550('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0x8550('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8550('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x8550('0x28')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x8550('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x8550('0x4')](_0x8550('0x17'),'no')},'vmexten':{'type':Sequelize[_0x8550('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x8550('0x2')]},'parkinglot':{'type':Sequelize[_0x8550('0x2')]},'description':{'type':Sequelize[_0x8550('0x2')]},'host':{'type':Sequelize[_0x8550('0x2')],'defaultValue':_0x8550('0x2f')},'canreinvite':{'type':Sequelize[_0x8550('0x4')](_0x8550('0x17'),'no',_0x8550('0x18'),'update',_0x8550('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x8550('0x2')]},'otherFields':{'type':Sequelize[_0x8550('0x2')]},'active':{'type':Sequelize[_0x8550('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x8550('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x07a2=['\x22\x22\x20<>','accept','refuse','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','BOOLEAN','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','split','rfc2833','info','shortinfo','inband','auto','nonat','outgoing','force_rport,comedia','nat','getDataValue','all','ulaw;alaw;gsm','allow','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','yes','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x07a2,0x16a));var _0x207a=function(_0x43606b,_0x2f2292){_0x43606b=_0x43606b-0x0;var _0xbfd21a=_0x07a2[_0x43606b];return _0xbfd21a;};'use strict';var Sequelize=require('sequelize');module[_0x207a('0x0')]={'name':{'type':Sequelize[_0x207a('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x207a('0x2')](_0x207a('0x3'),_0x207a('0x4'),_0x207a('0x5')),'allowNull':![],'defaultValue':_0x207a('0x3')},'context':{'type':Sequelize[_0x207a('0x1')],'allowNull':![],'defaultValue':_0x207a('0x6')},'callingpres':{'type':Sequelize[_0x207a('0x2')](_0x207a('0x7'),_0x207a('0x8'),'ALLOWED_FAILED_SCREEN',_0x207a('0x9'),_0x207a('0xa'),_0x207a('0xb'),'PROHIB_FAILED_SCREEN',_0x207a('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x207a('0x1')]},'secret':{'type':Sequelize[_0x207a('0x1')]},'md5secret':{'type':Sequelize[_0x207a('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x207a('0x1')],'defaultValue':_0x207a('0xd'),'set':function(_0x6fcb81){this[_0x207a('0xe')](_0x207a('0xf'),_0x6fcb81?_0x6fcb81['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue'](_0x207a('0xf'))[_0x207a('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x207a('0x11'),_0x207a('0x12'),_0x207a('0x13'),_0x207a('0x14'),_0x207a('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x207a('0x2')]('yes','no',_0x207a('0x16'),'update',_0x207a('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x207a('0x1')]},'directmediadeny':{'type':Sequelize[_0x207a('0x1')]},'nat':{'type':Sequelize[_0x207a('0x1')],'defaultValue':_0x207a('0x18'),'set':function(_0x6db93d){this[_0x207a('0xe')](_0x207a('0x19'),_0x6db93d?_0x6db93d['join'](','):null);},'get':function(){return this[_0x207a('0x1a')]('nat')?this[_0x207a('0x1a')](_0x207a('0x19'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x207a('0x1')]},'namedcallgroup':{'type':Sequelize[_0x207a('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x207a('0x1')]},'language':{'type':Sequelize[_0x207a('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x207a('0x1')],'defaultValue':_0x207a('0x1b')},'allow':{'type':Sequelize[_0x207a('0x1')],'allowNull':![],'defaultValue':_0x207a('0x1c'),'set':function(_0x5ea6b1){this[_0x207a('0xe')](_0x207a('0x1d'),_0x5ea6b1?_0x5ea6b1[_0x207a('0x1e')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x207a('0x1a')](_0x207a('0x1d'))?this[_0x207a('0x1a')]('allow')[_0x207a('0x10')](';'):null;},'comment':_0x207a('0x1f')},'autoframing':{'type':Sequelize['ENUM'](_0x207a('0x20'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x207a('0x21'),'set':function(_0x210d56){this[_0x207a('0xe')](_0x207a('0x22'),_0x210d56?_0x210d56[_0x207a('0x1e')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x207a('0x1a')](_0x207a('0x22'))[_0x207a('0x10')](','):null;},'comment':_0x207a('0x23')},'trustrpid':{'type':Sequelize[_0x207a('0x2')](_0x207a('0x20'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x207a('0x2')](_0x207a('0x20'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x207a('0x24'))},'promiscredir':{'type':Sequelize[_0x207a('0x2')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x207a('0x20'),'no')},'accountcode':{'type':Sequelize[_0x207a('0x25')](0xb)},'setvar':{'type':Sequelize[_0x207a('0x1')]},'callerid':{'type':Sequelize[_0x207a('0x1')],'defaultValue':_0x207a('0x26')},'amaflags':{'type':Sequelize[_0x207a('0x1')]},'callcounter':{'type':Sequelize[_0x207a('0x2')]('yes','no'),'defaultValue':_0x207a('0x20')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x207a('0x2')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0x207a('0x2')](_0x207a('0x20'),'no')},'ignoresdpversion':{'type':Sequelize[_0x207a('0x2')](_0x207a('0x20'),'no')},'subscribecontext':{'type':Sequelize[_0x207a('0x1')]},'template':{'type':Sequelize[_0x207a('0x1')]},'videosupport':{'type':Sequelize[_0x207a('0x2')](_0x207a('0x20'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x207a('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x207a('0x20'),'no')},'mailbox':{'type':Sequelize[_0x207a('0x1')]},'session_timers':{'type':Sequelize[_0x207a('0x2')](_0x207a('0x27'),_0x207a('0x28'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x207a('0x2')](_0x207a('0x29'),_0x207a('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x207a('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x207a('0x1')]},'fromuser':{'type':Sequelize[_0x207a('0x1')]},'port':{'type':Sequelize[_0x207a('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x207a('0x20'),'no'),'defaultValue':_0x207a('0x20')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x207a('0x1')]},'defaultuser':{'type':Sequelize[_0x207a('0x1')]},'rtptimeout':{'type':Sequelize[_0x207a('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x207a('0x20'),'no',_0x207a('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x207a('0x1')]},'callbackextension':{'type':Sequelize[_0x207a('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x207a('0x25')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x207a('0x1')]},'contactdeny':{'type':Sequelize[_0x207a('0x1')]},'contactacl':{'type':Sequelize[_0x207a('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x207a('0x1')]},'use_q850_reason':{'type':Sequelize[_0x207a('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x207a('0x2')](_0x207a('0x20'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x207a('0x2')](_0x207a('0x20'),'no')},'force_avp':{'type':Sequelize[_0x207a('0x2')](_0x207a('0x20'),'no')},'icesupport':{'type':Sequelize[_0x207a('0x2')](_0x207a('0x20'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x207a('0x20'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x207a('0x2c'),_0x207a('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x207a('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x207a('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x207a('0x1')]},'dtlscafile':{'type':Sequelize[_0x207a('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x207a('0x2')]('active',_0x207a('0x2e'),_0x207a('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x207a('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0x207a('0x20'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x207a('0x1')]},'recordofffeature':{'type':Sequelize[_0x207a('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x207a('0x2')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x207a('0x2')](_0x207a('0x20'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x207a('0x1')]},'mohsuggest':{'type':Sequelize[_0x207a('0x1')]},'parkinglot':{'type':Sequelize[_0x207a('0x1')]},'description':{'type':Sequelize[_0x207a('0x1')]},'host':{'type':Sequelize[_0x207a('0x1')],'defaultValue':_0x207a('0x30')},'canreinvite':{'type':Sequelize[_0x207a('0x2')](_0x207a('0x20'),'no','nonat','update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x207a('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x207a('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x207a('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index d844a6d..5660f73 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb821=['model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Trunk','includeAll','findAll','intersection','length','include','find','params','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','root','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','Trunk,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','name','send','index','rawAttributes','fieldName','key'];(function(_0x20913c,_0x28e54e){var _0x4fcb7b=function(_0x166e77){while(--_0x166e77){_0x20913c['push'](_0x20913c['shift']());}};_0x4fcb7b(++_0x28e54e);}(_0xb821,0xa7));var _0x1b82=function(_0x252c76,_0x38221c){_0x252c76=_0x252c76-0x0;var _0x5c4a14=_0xb821[_0x252c76];return _0x5c4a14;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];var jayson=require(_0x1b82('0x18'));var client=jayson[_0x1b82('0x19')][_0x1b82('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x50aed7,_0x1a6285,_0x5767aa,_0x54915f){return new BPromise(function(_0x1e553a,_0x4bf75b){var _0x1cffd1=_0x54915f||client;return _0x1cffd1[_0x1b82('0x1b')](_0x50aed7,_0x5767aa)['then'](function(_0x46c2cf){logger['info']('Trunk,\x20%s,\x20%s',_0x1a6285,_0x1b82('0x1c'));logger['debug'](_0x1b82('0x1d'),_0x1a6285,_0x1b82('0x1c'),JSON[_0x1b82('0x1e')](_0x46c2cf));if(_0x46c2cf['error']){if(_0x46c2cf['error'][_0x1b82('0x1f')]===0x1f4){logger['error'](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x4bf75b(_0x46c2cf['error'][_0x1b82('0x22')]);}logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x1e553a(_0x46c2cf['error'][_0x1b82('0x22')]);}else{logger[_0x1b82('0x23')](_0x1b82('0x20'),_0x1a6285,_0x1b82('0x1c'));_0x1e553a(_0x46c2cf[_0x1b82('0x24')][_0x1b82('0x22')]);}})[_0x1b82('0x25')](function(_0x486e92){logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x486e92);_0x4bf75b(_0x486e92);});});}function respondWithStatusCode(_0x5b8d09,_0x561d78){_0x561d78=_0x561d78||0xcc;return function(_0x225b81){if(_0x225b81){return _0x5b8d09[_0x1b82('0x26')](_0x561d78);}return _0x5b8d09['status'](_0x561d78)[_0x1b82('0x27')]();};}function respondWithResult(_0x4db690,_0x5cd458){_0x5cd458=_0x5cd458||0xc8;return function(_0x5f556b){if(_0x5f556b){return _0x4db690[_0x1b82('0x28')](_0x5cd458)[_0x1b82('0x29')](_0x5f556b);}};}function respondWithFilteredResult(_0xfd00d1,_0x257b79){return function(_0x548a3b){if(_0x548a3b){var _0x222483=typeof _0x257b79[_0x1b82('0x2a')]===_0x1b82('0x2b')&&typeof _0x257b79[_0x1b82('0x2c')]===_0x1b82('0x2b');var _0x1b8b6f=_0x548a3b[_0x1b82('0x2d')];var _0x21ea34=_0x222483?0x0:_0x257b79[_0x1b82('0x2a')];var _0x1f9c6b=_0x222483?_0x548a3b[_0x1b82('0x2d')]:_0x257b79[_0x1b82('0x2a')]+_0x257b79[_0x1b82('0x2c')];var _0x5ea890;if(_0x1f9c6b>=_0x1b8b6f){_0x1f9c6b=_0x1b8b6f;_0x5ea890=0xc8;}else{_0x5ea890=0xce;}_0xfd00d1[_0x1b82('0x28')](_0x5ea890);return _0xfd00d1[_0x1b82('0x2e')](_0x1b82('0x2f'),_0x21ea34+'-'+_0x1f9c6b+'/'+_0x1b8b6f)[_0x1b82('0x29')](_0x548a3b);}return null;};}function patchUpdates(_0x18e4ff){return function(_0x115ce7){try{jsonpatch[_0x1b82('0x30')](_0x115ce7,_0x18e4ff,!![]);}catch(_0x46575f){return BPromise[_0x1b82('0x31')](_0x46575f);}return _0x115ce7[_0x1b82('0x32')]();};}function saveUpdates(_0x501ab0,_0x225c06){return function(_0x29a31e){if(_0x29a31e){return _0x29a31e[_0x1b82('0x33')](_0x501ab0)[_0x1b82('0x34')](function(_0x5b7b18){return _0x5b7b18;});}return null;};}function removeEntity(_0x474218,_0xbf65a){return function(_0x544bd5){if(_0x544bd5){return _0x544bd5[_0x1b82('0x35')]()[_0x1b82('0x34')](function(){var _0x365c3c=_0x544bd5['get']({'plain':!![]});var _0x5efb8e=_0x1b82('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x5efb8e,'resourceId':_0x365c3c['id']}})[_0x1b82('0x34')](function(){return _0x544bd5;});})[_0x1b82('0x34')](function(){_0x474218[_0x1b82('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a64e,_0x366db3){return function(_0xea774a){if(!_0xea774a){_0x42a64e[_0x1b82('0x26')](0x194);}return _0xea774a;};}function handleError(_0x4dd64a,_0x42c1c4){_0x42c1c4=_0x42c1c4||0x1f4;return function(_0x1cd7de){logger[_0x1b82('0x21')](_0x1cd7de['stack']);if(_0x1cd7de['name']){delete _0x1cd7de[_0x1b82('0x37')];}_0x4dd64a['status'](_0x42c1c4)[_0x1b82('0x38')](_0x1cd7de);};}exports[_0x1b82('0x39')]=function(_0x286b4b,_0x348880){var _0x1255db={},_0x3ab35c={},_0x39fe4a={'count':0x0,'rows':[]};var _0x1368df=_['map'](db['Trunk'][_0x1b82('0x3a')],function(_0x5f4baf){return{'name':_0x5f4baf[_0x1b82('0x3b')],'type':_0x5f4baf['type'][_0x1b82('0x3c')]};});_0x3ab35c[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x1368df,_0x1b82('0x37'));_0x3ab35c[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x286b4b['query']);_0x3ab35c[_0x1b82('0x41')]=_['intersection'](_0x3ab35c[_0x1b82('0x3d')],_0x3ab35c['query']);_0x1255db[_0x1b82('0x42')]=_['intersection'](_0x3ab35c['model'],qs[_0x1b82('0x43')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x1255db[_0x1b82('0x42')]=_0x1255db[_0x1b82('0x42')]['length']?_0x1255db[_0x1b82('0x42')]:_0x3ab35c['model'];if(!_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x44')](_0x1b82('0x45'))){_0x1255db[_0x1b82('0x2c')]=qs[_0x1b82('0x2c')](_0x286b4b['query'][_0x1b82('0x2c')]);_0x1255db['offset']=qs[_0x1b82('0x2a')](_0x286b4b[_0x1b82('0x3f')]['offset']);}_0x1255db[_0x1b82('0x46')]=qs[_0x1b82('0x47')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x47')]);_0x1255db[_0x1b82('0x48')]=qs[_0x1b82('0x41')](_[_0x1b82('0x49')](_0x286b4b['query'],_0x3ab35c[_0x1b82('0x41')]),_0x1368df);if(_0x286b4b['query'][_0x1b82('0x4a')]){_0x1255db[_0x1b82('0x48')]=_[_0x1b82('0x4b')](_0x1255db[_0x1b82('0x48')],{'$or':_[_0x1b82('0x3e')](_0x1368df,function(_0x1d24d6){if(_0x1d24d6[_0x1b82('0x4c')]!==_0x1b82('0x4d')){var _0x192ce3={};_0x192ce3[_0x1d24d6[_0x1b82('0x37')]]={'$like':'%'+_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x4a')]+'%'};return _0x192ce3;}})});}_0x1255db=_[_0x1b82('0x4b')]({},_0x1255db,_0x286b4b[_0x1b82('0x4e')]);var _0x4fb92f={'where':_0x1255db['where']};return db[_0x1b82('0x4f')]['count'](_0x4fb92f)[_0x1b82('0x34')](function(_0x3df0af){_0x39fe4a[_0x1b82('0x2d')]=_0x3df0af;if(_0x286b4b['query'][_0x1b82('0x50')]){_0x1255db['include']=[{'all':!![]}];}return db['Trunk'][_0x1b82('0x51')](_0x1255db);})[_0x1b82('0x34')](function(_0x242324){_0x39fe4a['rows']=_0x242324;return _0x39fe4a;})[_0x1b82('0x34')](respondWithFilteredResult(_0x348880,_0x1255db))[_0x1b82('0x25')](handleError(_0x348880,null));};exports['show']=function(_0x5ca898,_0x106282){var _0x2e676a={'raw':![],'where':{'id':_0x5ca898['params']['id']}},_0x2dc53e={};_0x2dc53e[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db[_0x1b82('0x4f')][_0x1b82('0x3a')]);_0x2dc53e[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x5ca898['query']);_0x2dc53e[_0x1b82('0x41')]=_['intersection'](_0x2dc53e[_0x1b82('0x3d')],_0x2dc53e[_0x1b82('0x3f')]);_0x2e676a['attributes']=_[_0x1b82('0x52')](_0x2dc53e['model'],qs[_0x1b82('0x43')](_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x2e676a[_0x1b82('0x42')]=_0x2e676a[_0x1b82('0x42')][_0x1b82('0x53')]?_0x2e676a['attributes']:_0x2dc53e['model'];if(_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x2e676a[_0x1b82('0x54')]=[{'all':!![]}];}_0x2e676a=_[_0x1b82('0x4b')]({},_0x2e676a,_0x5ca898[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x2e676a)[_0x1b82('0x34')](handleEntityNotFound(_0x106282,null))['then'](respondWithResult(_0x106282,null))['catch'](handleError(_0x106282,null));};exports['clone']=function(_0x2658b5,_0x2a95d2){var _0x207f1c={'where':{'id':_0x2658b5[_0x1b82('0x56')]['id']}},_0x27ad80={};_0x27ad80[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db['Trunk'][_0x1b82('0x3a')]);_0x207f1c[_0x1b82('0x42')]=_[_0x1b82('0x52')](_0x27ad80[_0x1b82('0x3d')],qs[_0x1b82('0x43')](_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x207f1c[_0x1b82('0x42')]=_0x207f1c['attributes'][_0x1b82('0x53')]?_0x207f1c[_0x1b82('0x42')]:_0x27ad80[_0x1b82('0x3d')];if(_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x207f1c['include']=[{'all':!![]}];}_0x207f1c=_['merge']({},_0x207f1c,_0x2658b5[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x207f1c)[_0x1b82('0x34')](handleEntityNotFound(_0x2a95d2,null))['then'](function(_0x170905){if(_0x170905){var _0x352603=_0x170905[_0x1b82('0x57')]({'plain':!![]});_0x352603=qs[_0x1b82('0x58')](_0x352603,['id',_0x1b82('0x59'),_0x1b82('0x5a')]);_0x2658b5[_0x1b82('0x5b')]=_[_0x1b82('0x58')](_0x2658b5[_0x1b82('0x5b')],['id',_0x1b82('0x59'),'updatedAt']);return db[_0x1b82('0x4f')][_0x1b82('0x5c')](_['merge'](_0x352603,_0x2658b5[_0x1b82('0x5b')]),{'include':_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]?[{'all':!![]}]:undefined})[_0x1b82('0x34')](function(_0x4b26c4){var _0x30f13a=_0x2658b5[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x30f13a)throw new Error(_0x1b82('0x5e'));if(_0x30f13a[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x4e8fa2=_0x4b26c4[_0x1b82('0x57')]({'plain':!![]});var _0x5267c3=_0x1b82('0x36');return db['UserProfileSection'][_0x1b82('0x55')]({'where':{'name':_0x5267c3,'userProfileId':_0x30f13a[_0x1b82('0x60')]},'raw':!![]})[_0x1b82('0x34')](function(_0x2db0fe){if(_0x2db0fe&&_0x2db0fe[_0x1b82('0x61')]===0x0){return db[_0x1b82('0x62')][_0x1b82('0x5c')]({'name':_0x4e8fa2['name'],'resourceId':_0x4e8fa2['id'],'type':_0x2db0fe[_0x1b82('0x37')],'sectionId':_0x2db0fe['id']},{})[_0x1b82('0x34')](function(){return _0x4b26c4;});}else{return _0x4b26c4;}})[_0x1b82('0x25')](function(_0x2de10c){logger[_0x1b82('0x21')](_0x1b82('0x63'),_0x2de10c);throw _0x2de10c;});}return _0x4b26c4;});}})[_0x1b82('0x34')](respondWithResult(_0x2a95d2,0xc9))[_0x1b82('0x25')](handleError(_0x2a95d2,null));};exports[_0x1b82('0x5c')]=function(_0x3f7690,_0x1873de,_0xe31cbc){var _0x1ef92c;return db['Trunk'][_0x1b82('0x5c')](_0x3f7690[_0x1b82('0x5b')],{'raw':!![]})[_0x1b82('0x34')](function(_0x4a229e){_0x1ef92c=_0x4a229e;return db[_0x1b82('0x4f')][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x3bf106){var _0x5cc386=fs[_0x1b82('0x64')](path['join'](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x3b4088=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x68')),'utf8');var _0x143689=ejs[_0x1b82('0x69')](_0x5cc386,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x143689);if(_0x1ef92c[_0x1b82('0x6c')]){var _0x29c42e=ejs[_0x1b82('0x69')](_0x3b4088,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x29c42e);}})[_0x1b82('0x34')](function(){return respondWithRpcPromise(_0x1b82('0x6e'),'create',{'module':_0x1b82('0x6f')});})['then'](function(){var _0x4c2e52=_0x3f7690[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x4c2e52)throw new Error(_0x1b82('0x5e'));if(_0x4c2e52[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x1dd3a1=_0x1ef92c[_0x1b82('0x57')]({'plain':!![]});return db[_0x1b82('0x70')][_0x1b82('0x55')]({'where':{'name':_0x1b82('0x36'),'userProfileId':_0x4c2e52['userProfileId']},'raw':!![]})[_0x1b82('0x34')](function(_0x4d496b){if(_0x4d496b&&_0x4d496b[_0x1b82('0x61')]===0x0){return db['UserProfileResource'][_0x1b82('0x5c')]({'name':_0x1dd3a1[_0x1b82('0x37')],'resourceId':_0x1dd3a1['id'],'type':_0x4d496b[_0x1b82('0x37')],'sectionId':_0x4d496b['id']},{})[_0x1b82('0x34')](function(){return _0x1ef92c;});}else{return _0x1ef92c;}})[_0x1b82('0x25')](function(_0x49a202){logger[_0x1b82('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a202);throw _0x49a202;});}return _0x1ef92c;})['then'](respondWithResult(_0x1873de,0xc9))[_0x1b82('0x25')](handleError(_0x1873de,null));};exports[_0x1b82('0x33')]=function(_0x1a4826,_0x4d986c,_0x2e9191){var _0x52f16e;return db[_0x1b82('0x4f')]['find']({'where':{'id':_0x1a4826[_0x1b82('0x56')]['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x4d986c,null))[_0x1b82('0x34')](saveUpdates(_0x1a4826[_0x1b82('0x5b')],null))['then'](function(_0x46cae4){if(_0x46cae4){_0x52f16e=_0x46cae4;return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});}})[_0x1b82('0x34')](function(_0x1095fb){if(_0x1095fb){var _0x185fce=fs[_0x1b82('0x64')](path['join'](config[_0x1b82('0x71')],'server/files/templates/trunk.ejs'),_0x1b82('0x66'));var _0x5ce247=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],'server/files/templates/registry.ejs'),_0x1b82('0x66'));var _0x31a56e=ejs[_0x1b82('0x69')](_0x185fce,{'trunks':_0x1095fb||[]});fs['writeFileSync'](_0x1b82('0x6b'),_0x31a56e);var _0x396272=ejs[_0x1b82('0x69')](_0x5ce247,{'trunks':_0x1095fb||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x396272);return respondWithRpcPromise('Reload',_0x1b82('0x33'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x2759ac){if(_0x2759ac){return _0x52f16e;}})['then'](respondWithResult(_0x4d986c,null))[_0x1b82('0x25')](handleError(_0x4d986c,null));};exports[_0x1b82('0x35')]=function(_0x5f349f,_0x3e17b0,_0x391207){var _0x553ac5;return db['Trunk']['find']({'where':{'id':_0x5f349f['params']['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x3e17b0,null))[_0x1b82('0x34')](removeEntity(_0x3e17b0,null))[_0x1b82('0x34')](function(){return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x7d95b6){var _0x372c3b=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x14510c=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],_0x1b82('0x68')),'utf8');var _0x58e180=ejs[_0x1b82('0x69')](_0x372c3b,{'trunks':_0x7d95b6});var _0x531d3f=ejs['render'](_0x14510c,{'trunks':_0x7d95b6});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x58e180);fs[_0x1b82('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x531d3f);return respondWithRpcPromise(_0x1b82('0x6e'),'destroy',{'module':_0x1b82('0x6f')});})[_0x1b82('0x25')](handleError(_0x3e17b0,null));}; \ No newline at end of file +var _0x9f62=['updatedAt','body','create','user','role','UserProfileSection','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','render','/etc/asterisk/sip_xcally_trunks.conf','Reload','server/files/templates/registry.ejs','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Trunk','findAll','rows','show','params','clone','find','omit','createdAt'];(function(_0x5d1dad,_0x2cbdd4){var _0x334f8d=function(_0x331bbb){while(--_0x331bbb){_0x5d1dad['push'](_0x5d1dad['shift']());}};_0x334f8d(++_0x2cbdd4);}(_0x9f62,0x154));var _0x29f6=function(_0x53b4c3,_0x54b88c){_0x53b4c3=_0x53b4c3-0x0;var _0x244ca6=_0x9f62[_0x53b4c3];return _0x244ca6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x29f6('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x55cf4,_0x189344,_0x11a1fd,_0x17de6e){return new BPromise(function(_0x156c96,_0x35d2e2){var _0x2418ee=_0x17de6e||client;return _0x2418ee[_0x29f6('0x14')](_0x55cf4,_0x11a1fd)[_0x29f6('0x15')](function(_0x28d314){logger[_0x29f6('0x16')](_0x29f6('0x17'),_0x189344,_0x29f6('0x18'));logger[_0x29f6('0x19')](_0x29f6('0x1a'),_0x189344,_0x29f6('0x18'),JSON['stringify'](_0x28d314));if(_0x28d314['error']){if(_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger[_0x29f6('0x1b')]('Trunk,\x20%s,\x20%s',_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x35d2e2(_0x28d314['error'][_0x29f6('0x1d')]);}logger[_0x29f6('0x1b')](_0x29f6('0x17'),_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x156c96(_0x28d314[_0x29f6('0x1b')]['message']);}else{logger[_0x29f6('0x16')]('Trunk,\x20%s,\x20%s',_0x189344,'request\x20sent');_0x156c96(_0x28d314[_0x29f6('0x1e')][_0x29f6('0x1d')]);}})[_0x29f6('0x1f')](function(_0xafb5dd){logger['error'](_0x29f6('0x17'),_0x189344,_0xafb5dd);_0x35d2e2(_0xafb5dd);});});}function respondWithStatusCode(_0x49f67d,_0xd4179c){_0xd4179c=_0xd4179c||0xcc;return function(_0xcce041){if(_0xcce041){return _0x49f67d[_0x29f6('0x20')](_0xd4179c);}return _0x49f67d[_0x29f6('0x21')](_0xd4179c)['end']();};}function respondWithResult(_0x4290a2,_0x4d494f){_0x4d494f=_0x4d494f||0xc8;return function(_0x47c385){if(_0x47c385){return _0x4290a2[_0x29f6('0x21')](_0x4d494f)[_0x29f6('0x22')](_0x47c385);}};}function respondWithFilteredResult(_0x2519ac,_0x342038){return function(_0x84ccb7){if(_0x84ccb7){var _0x4333bc=typeof _0x342038[_0x29f6('0x23')]==='undefined'&&typeof _0x342038[_0x29f6('0x24')]===_0x29f6('0x25');var _0x1ab8d8=_0x84ccb7[_0x29f6('0x26')];var _0xda0a63=_0x4333bc?0x0:_0x342038[_0x29f6('0x23')];var _0x3790f5=_0x4333bc?_0x84ccb7[_0x29f6('0x26')]:_0x342038[_0x29f6('0x23')]+_0x342038[_0x29f6('0x24')];var _0x2915bc;if(_0x3790f5>=_0x1ab8d8){_0x3790f5=_0x1ab8d8;_0x2915bc=0xc8;}else{_0x2915bc=0xce;}_0x2519ac[_0x29f6('0x21')](_0x2915bc);return _0x2519ac[_0x29f6('0x27')](_0x29f6('0x28'),_0xda0a63+'-'+_0x3790f5+'/'+_0x1ab8d8)[_0x29f6('0x22')](_0x84ccb7);}return null;};}function patchUpdates(_0x218931){return function(_0x3a7249){try{jsonpatch['apply'](_0x3a7249,_0x218931,!![]);}catch(_0x5582d3){return BPromise[_0x29f6('0x29')](_0x5582d3);}return _0x3a7249['save']();};}function saveUpdates(_0x341071,_0xc8d2c5){return function(_0x1e1bb6){if(_0x1e1bb6){return _0x1e1bb6[_0x29f6('0x2a')](_0x341071)['then'](function(_0x53e11f){return _0x53e11f;});}return null;};}function removeEntity(_0x1bde69,_0xa6377c){return function(_0x2edc2e){if(_0x2edc2e){return _0x2edc2e[_0x29f6('0x2b')]()[_0x29f6('0x15')](function(){var _0x20bc5e=_0x2edc2e[_0x29f6('0x2c')]({'plain':!![]});var _0x1c3f0f=_0x29f6('0x2d');return db[_0x29f6('0x2e')][_0x29f6('0x2b')]({'where':{'type':_0x1c3f0f,'resourceId':_0x20bc5e['id']}})[_0x29f6('0x15')](function(){return _0x2edc2e;});})[_0x29f6('0x15')](function(){_0x1bde69[_0x29f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e31dd,_0x206beb){return function(_0x44cf19){if(!_0x44cf19){_0x5e31dd[_0x29f6('0x20')](0x194);}return _0x44cf19;};}function handleError(_0x5416dc,_0x3e1e25){_0x3e1e25=_0x3e1e25||0x1f4;return function(_0x749b9d){logger[_0x29f6('0x1b')](_0x749b9d[_0x29f6('0x2f')]);if(_0x749b9d[_0x29f6('0x30')]){delete _0x749b9d['name'];}_0x5416dc[_0x29f6('0x21')](_0x3e1e25)[_0x29f6('0x31')](_0x749b9d);};}exports[_0x29f6('0x32')]=function(_0x1b51cc,_0x4f5fe1){var _0x30d747={},_0x2a09e8={},_0x14b392={'count':0x0,'rows':[]};var _0x105557=_['map'](db['Trunk'][_0x29f6('0x33')],function(_0x4bfc80){return{'name':_0x4bfc80[_0x29f6('0x34')],'type':_0x4bfc80['type'][_0x29f6('0x35')]};});_0x2a09e8['model']=_[_0x29f6('0x36')](_0x105557,_0x29f6('0x30'));_0x2a09e8['query']=_[_0x29f6('0x37')](_0x1b51cc['query']);_0x2a09e8[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x2a09e8['model'],_0x2a09e8[_0x29f6('0x3a')]);_0x30d747[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2a09e8[_0x29f6('0x3c')],qs['fields'](_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x3d')]));_0x30d747[_0x29f6('0x3b')]=_0x30d747[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x30d747['attributes']:_0x2a09e8[_0x29f6('0x3c')];if(!_0x1b51cc['query'][_0x29f6('0x3f')]('nolimit')){_0x30d747[_0x29f6('0x24')]=qs[_0x29f6('0x24')](_0x1b51cc['query'][_0x29f6('0x24')]);_0x30d747[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x1b51cc[_0x29f6('0x3a')]['offset']);}_0x30d747[_0x29f6('0x40')]=qs[_0x29f6('0x41')](_0x1b51cc[_0x29f6('0x3a')]['sort']);_0x30d747[_0x29f6('0x42')]=qs['filters'](_[_0x29f6('0x43')](_0x1b51cc['query'],_0x2a09e8['filters']),_0x105557);if(_0x1b51cc['query'][_0x29f6('0x44')]){_0x30d747[_0x29f6('0x42')]=_[_0x29f6('0x45')](_0x30d747[_0x29f6('0x42')],{'$or':_[_0x29f6('0x36')](_0x105557,function(_0x270842){if(_0x270842[_0x29f6('0x46')]!==_0x29f6('0x47')){var _0x352119={};_0x352119[_0x270842[_0x29f6('0x30')]]={'$like':'%'+_0x1b51cc['query']['filter']+'%'};return _0x352119;}})});}_0x30d747=_[_0x29f6('0x45')]({},_0x30d747,_0x1b51cc[_0x29f6('0x48')]);var _0x7a65c0={'where':_0x30d747[_0x29f6('0x42')]};return db['Trunk'][_0x29f6('0x26')](_0x7a65c0)[_0x29f6('0x15')](function(_0x532df5){_0x14b392[_0x29f6('0x26')]=_0x532df5;if(_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x30d747[_0x29f6('0x4a')]=[{'all':!![]}];}return db[_0x29f6('0x4b')][_0x29f6('0x4c')](_0x30d747);})[_0x29f6('0x15')](function(_0x1f03b6){_0x14b392[_0x29f6('0x4d')]=_0x1f03b6;return _0x14b392;})[_0x29f6('0x15')](respondWithFilteredResult(_0x4f5fe1,_0x30d747))[_0x29f6('0x1f')](handleError(_0x4f5fe1,null));};exports[_0x29f6('0x4e')]=function(_0x58ea69,_0x416c24){var _0x463551={'raw':![],'where':{'id':_0x58ea69[_0x29f6('0x4f')]['id']}},_0x335ec1={};_0x335ec1[_0x29f6('0x3c')]=_['keys'](db[_0x29f6('0x4b')]['rawAttributes']);_0x335ec1['query']=_[_0x29f6('0x37')](_0x58ea69[_0x29f6('0x3a')]);_0x335ec1[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x335ec1[_0x29f6('0x3c')],_0x335ec1['query']);_0x463551[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x335ec1['model'],qs[_0x29f6('0x3d')](_0x58ea69['query'][_0x29f6('0x3d')]));_0x463551[_0x29f6('0x3b')]=_0x463551[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x463551['attributes']:_0x335ec1[_0x29f6('0x3c')];if(_0x58ea69[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x463551[_0x29f6('0x4a')]=[{'all':!![]}];}_0x463551=_[_0x29f6('0x45')]({},_0x463551,_0x58ea69[_0x29f6('0x48')]);return db[_0x29f6('0x4b')]['find'](_0x463551)[_0x29f6('0x15')](handleEntityNotFound(_0x416c24,null))[_0x29f6('0x15')](respondWithResult(_0x416c24,null))[_0x29f6('0x1f')](handleError(_0x416c24,null));};exports[_0x29f6('0x50')]=function(_0x36e52c,_0x1ac20d){var _0x37c3c1={'where':{'id':_0x36e52c[_0x29f6('0x4f')]['id']}},_0x2f356d={};_0x2f356d[_0x29f6('0x3c')]=_['keys'](db['Trunk'][_0x29f6('0x33')]);_0x37c3c1[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2f356d['model'],qs[_0x29f6('0x3d')](_0x36e52c['query']['fields']));_0x37c3c1[_0x29f6('0x3b')]=_0x37c3c1[_0x29f6('0x3b')]['length']?_0x37c3c1['attributes']:_0x2f356d[_0x29f6('0x3c')];if(_0x36e52c[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x37c3c1['include']=[{'all':!![]}];}_0x37c3c1=_[_0x29f6('0x45')]({},_0x37c3c1,_0x36e52c[_0x29f6('0x48')]);return db[_0x29f6('0x4b')][_0x29f6('0x51')](_0x37c3c1)[_0x29f6('0x15')](handleEntityNotFound(_0x1ac20d,null))[_0x29f6('0x15')](function(_0x7700da){if(_0x7700da){var _0x33b1d7=_0x7700da[_0x29f6('0x2c')]({'plain':!![]});_0x33b1d7=qs[_0x29f6('0x52')](_0x33b1d7,['id',_0x29f6('0x53'),_0x29f6('0x54')]);_0x36e52c[_0x29f6('0x55')]=_['omit'](_0x36e52c['body'],['id',_0x29f6('0x53'),'updatedAt']);return db[_0x29f6('0x4b')][_0x29f6('0x56')](_[_0x29f6('0x45')](_0x33b1d7,_0x36e52c[_0x29f6('0x55')]),{'include':_0x36e52c[_0x29f6('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x29f6('0x15')](function(_0x38d684){var _0x2f694e=_0x36e52c[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x2f694e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f694e[_0x29f6('0x58')]==='user'){var _0x51b9dc=_0x38d684[_0x29f6('0x2c')]({'plain':!![]});var _0x336b8e='Trunks';return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':_0x336b8e,'userProfileId':_0x2f694e['userProfileId']},'raw':!![]})[_0x29f6('0x15')](function(_0x2ba44c){if(_0x2ba44c&&_0x2ba44c[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')][_0x29f6('0x56')]({'name':_0x51b9dc[_0x29f6('0x30')],'resourceId':_0x51b9dc['id'],'type':_0x2ba44c[_0x29f6('0x30')],'sectionId':_0x2ba44c['id']},{})['then'](function(){return _0x38d684;});}else{return _0x38d684;}})[_0x29f6('0x1f')](function(_0x50ddd6){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ddd6);throw _0x50ddd6;});}return _0x38d684;});}})['then'](respondWithResult(_0x1ac20d,0xc9))[_0x29f6('0x1f')](handleError(_0x1ac20d,null));};exports[_0x29f6('0x56')]=function(_0x195887,_0x536b0c,_0x6ae738){var _0x373cf6;return db[_0x29f6('0x4b')]['create'](_0x195887[_0x29f6('0x55')],{'raw':!![]})[_0x29f6('0x15')](function(_0x66a7bb){_0x373cf6=_0x66a7bb;return db[_0x29f6('0x4b')][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x6587f3){var _0x41c1b9=fs['readFileSync'](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x1636f1=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],'server/files/templates/registry.ejs'),_0x29f6('0x5e'));var _0x1ca187=ejs['render'](_0x41c1b9,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ca187);if(_0x373cf6[_0x29f6('0x61')]){var _0x5a383f=ejs['render'](_0x1636f1,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x5a383f);}})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x29f6('0x63')});})[_0x29f6('0x15')](function(){var _0x144c76=_0x195887[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x144c76)throw new Error(_0x29f6('0x64'));if(_0x144c76[_0x29f6('0x58')]==='user'){var _0x11ef85=_0x373cf6[_0x29f6('0x2c')]({'plain':!![]});return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':'Trunks','userProfileId':_0x144c76[_0x29f6('0x65')]},'raw':!![]})[_0x29f6('0x15')](function(_0x32a862){if(_0x32a862&&_0x32a862[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')]['create']({'name':_0x11ef85[_0x29f6('0x30')],'resourceId':_0x11ef85['id'],'type':_0x32a862[_0x29f6('0x30')],'sectionId':_0x32a862['id']},{})[_0x29f6('0x15')](function(){return _0x373cf6;});}else{return _0x373cf6;}})[_0x29f6('0x1f')](function(_0x4273a3){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4273a3);throw _0x4273a3;});}return _0x373cf6;})[_0x29f6('0x15')](respondWithResult(_0x536b0c,0xc9))['catch'](handleError(_0x536b0c,null));};exports['update']=function(_0x4f9907,_0x842ae3,_0x5bcf90){var _0x425da2;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x4f9907[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x842ae3,null))[_0x29f6('0x15')](saveUpdates(_0x4f9907[_0x29f6('0x55')],null))['then'](function(_0x3a23f3){if(_0x3a23f3){_0x425da2=_0x3a23f3;return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});}})[_0x29f6('0x15')](function(_0x32fa77){if(_0x32fa77){var _0x1d6e32=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0xe14459=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0xa31c7d=ejs[_0x29f6('0x66')](_0x1d6e32,{'trunks':_0x32fa77||[]});fs['writeFileSync'](_0x29f6('0x67'),_0xa31c7d);var _0x57b9fb=ejs[_0x29f6('0x66')](_0xe14459,{'trunks':_0x32fa77||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x57b9fb);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2a'),{'module':_0x29f6('0x63')});}return null;})[_0x29f6('0x15')](function(_0x4203f1){if(_0x4203f1){return _0x425da2;}})[_0x29f6('0x15')](respondWithResult(_0x842ae3,null))[_0x29f6('0x1f')](handleError(_0x842ae3,null));};exports['destroy']=function(_0x1d61ff,_0x4c0acc,_0x16bb3c){var _0x144d8c;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x1d61ff[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x4c0acc,null))[_0x29f6('0x15')](removeEntity(_0x4c0acc,null))[_0x29f6('0x15')](function(){return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x4e185f){var _0x4bb53f=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x906098=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x69')),_0x29f6('0x5e'));var _0x3f51fa=ejs['render'](_0x4bb53f,{'trunks':_0x4e185f});var _0x4b9631=ejs[_0x29f6('0x66')](_0x906098,{'trunks':_0x4e185f});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3f51fa);fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x4b9631);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2b'),{'module':_0x29f6('0x63')});})[_0x29f6('0x1f')](handleError(_0x4c0acc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index ebf3835..b5e0bfa 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 _0xd685=['moment','bluebird','request-promise','path','./trunk.attributes','define','Trunk','tools_trunks'];(function(_0x189d1a,_0x43bb37){var _0x3af66e=function(_0xd0ed08){while(--_0xd0ed08){_0x189d1a['push'](_0x189d1a['shift']());}};_0x3af66e(++_0x43bb37);}(_0xd685,0xf8));var _0x5d68=function(_0x3a3289,_0x11d76c){_0x3a3289=_0x3a3289-0x0;var _0x7419da=_0xd685[_0x3a3289];return _0x7419da;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5d68('0x0'));var BPromise=require(_0x5d68('0x1'));var rp=require(_0x5d68('0x2'));var fs=require('fs');var path=require(_0x5d68('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5d68('0x4'));module['exports']=function(_0x1b0966,_0x2c660d){return _0x1b0966[_0x5d68('0x5')](_0x5d68('0x6'),attributes,{'tableName':_0x5d68('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe002=['define','Trunk','tools_trunks','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./trunk.attributes'];(function(_0x5b0bd6,_0x49fe6d){var _0x13497e=function(_0x188621){while(--_0x188621){_0x5b0bd6['push'](_0x5b0bd6['shift']());}};_0x13497e(++_0x49fe6d);}(_0xe002,0xbe));var _0x2e00=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0xe002[_0x164af1];return _0x5d81a2;};'use strict';var _=require(_0x2e00('0x0'));var util=require('util');var logger=require(_0x2e00('0x1'))(_0x2e00('0x2'));var moment=require(_0x2e00('0x3'));var BPromise=require('bluebird');var rp=require(_0x2e00('0x4'));var fs=require('fs');var path=require(_0x2e00('0x5'));var rimraf=require('rimraf');var config=require(_0x2e00('0x6'));var attributes=require(_0x2e00('0x7'));module['exports']=function(_0x558e4e,_0x10394e){return _0x558e4e[_0x2e00('0x8')](_0x2e00('0x9'),attributes,{'tableName':_0x2e00('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 b09d423..d7c49ac 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 _0xa86e=['Trunk','findAll','options','where','attributes','limit','include','map','model','ShowTrunk','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTrunk'];(function(_0x2636a7,_0x254655){var _0x561f99=function(_0x20391c){while(--_0x20391c){_0x2636a7['push'](_0x2636a7['shift']());}};_0x561f99(++_0x254655);}(_0xa86e,0xf8));var _0xea86=function(_0x2255d8,_0x1b1547){_0x2255d8=_0x2255d8-0x0;var _0x37b142=_0xa86e[_0x2255d8];return _0x37b142;};'use strict';var _=require(_0xea86('0x0'));var util=require(_0xea86('0x1'));var moment=require(_0xea86('0x2'));var BPromise=require(_0xea86('0x3'));var rs=require(_0xea86('0x4'));var fs=require('fs');var Redis=require(_0xea86('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xea86('0x6'));var logger=require(_0xea86('0x7'))(_0xea86('0x8'));var config=require('../../config/environment');var jayson=require(_0xea86('0x9'));var client=jayson[_0xea86('0xa')][_0xea86('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48b674,_0x2ab783,_0x1c516e){return new BPromise(function(_0x10707b,_0x43df42){return client['request'](_0x48b674,_0x1c516e)[_0xea86('0xc')](function(_0xe8f6ea){logger[_0xea86('0xd')](_0xea86('0xe'),_0x2ab783,_0xea86('0xf'));logger[_0xea86('0x10')](_0xea86('0x11'),_0x2ab783,_0xea86('0xf'),JSON[_0xea86('0x12')](_0xe8f6ea));if(_0xe8f6ea[_0xea86('0x13')]){if(_0xe8f6ea[_0xea86('0x13')]['code']===0x1f4){logger['error'](_0xea86('0xe'),_0x2ab783,_0xe8f6ea[_0xea86('0x13')][_0xea86('0x14')]);return _0x43df42(_0xe8f6ea[_0xea86('0x13')][_0xea86('0x14')]);}logger['error'](_0xea86('0xe'),_0x2ab783,_0xe8f6ea[_0xea86('0x13')][_0xea86('0x14')]);return _0x10707b(_0xe8f6ea[_0xea86('0x13')]['message']);}else{logger[_0xea86('0xd')](_0xea86('0xe'),_0x2ab783,'request\x20sent');_0x10707b(_0xe8f6ea[_0xea86('0x15')][_0xea86('0x14')]);}})[_0xea86('0x16')](function(_0x3daf8b){logger[_0xea86('0x13')](_0xea86('0xe'),_0x2ab783,_0x3daf8b);_0x43df42(_0x3daf8b);});});}exports[_0xea86('0x17')]=function(_0x740cf1){var _0x1ebd76=this;return new Promise(function(_0x3ce3da,_0x3a89ee){return db[_0xea86('0x18')][_0xea86('0x19')]({'raw':_0x740cf1['options']?_0x740cf1[_0xea86('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x740cf1['options']?_0x740cf1['options'][_0xea86('0x1b')]||null:null,'attributes':_0x740cf1[_0xea86('0x1a')]?_0x740cf1[_0xea86('0x1a')][_0xea86('0x1c')]||null:null,'limit':_0x740cf1[_0xea86('0x1a')]?_0x740cf1[_0xea86('0x1a')][_0xea86('0x1d')]||null:null,'include':_0x740cf1[_0xea86('0x1a')]?_0x740cf1[_0xea86('0x1a')][_0xea86('0x1e')]?_[_0xea86('0x1f')](_0x740cf1['options'][_0xea86('0x1e')],function(_0x40f1f6){return{'model':db[_0x40f1f6[_0xea86('0x20')]],'as':_0x40f1f6['as'],'attributes':_0x40f1f6[_0xea86('0x1c')],'include':_0x40f1f6[_0xea86('0x1e')]?_[_0xea86('0x1f')](_0x40f1f6['include'],function(_0x2e83ec){return{'model':db[_0x2e83ec[_0xea86('0x20')]],'as':_0x2e83ec['as'],'attributes':_0x2e83ec[_0xea86('0x1c')],'include':_0x2e83ec[_0xea86('0x1e')]?_['map'](_0x2e83ec[_0xea86('0x1e')],function(_0x3300ea){return{'model':db[_0x3300ea[_0xea86('0x20')]],'as':_0x3300ea['as'],'attributes':_0x3300ea['attributes']};}):[]};}):[]};}):[]:[]})[_0xea86('0xc')](function(_0x52a737){logger['info'](_0xea86('0x17'),_0x740cf1);logger['debug'](_0xea86('0x17'),_0x740cf1,JSON[_0xea86('0x12')](_0x52a737));_0x3ce3da(_0x52a737);})['catch'](function(_0x2f412f){logger['error'](_0xea86('0x17'),_0x2f412f['message'],_0x740cf1);_0x3a89ee(_0x1ebd76[_0xea86('0x13')](0x1f4,_0x2f412f['message']));});});};exports[_0xea86('0x21')]=function(_0x379c74){var _0xb778fd=this;return new Promise(function(_0x36b235,_0x4357e5){return db[_0xea86('0x18')]['find']({'raw':_0x379c74[_0xea86('0x1a')]?_0x379c74[_0xea86('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x379c74['options']?_0x379c74['options'][_0xea86('0x1b')]||null:null,'attributes':_0x379c74[_0xea86('0x1a')]?_0x379c74['options'][_0xea86('0x1c')]||null:null,'include':_0x379c74[_0xea86('0x1a')]?_0x379c74[_0xea86('0x1a')][_0xea86('0x1e')]?_[_0xea86('0x1f')](_0x379c74[_0xea86('0x1a')][_0xea86('0x1e')],function(_0x544699){return{'model':db[_0x544699[_0xea86('0x20')]],'as':_0x544699['as'],'attributes':_0x544699['attributes'],'include':_0x544699[_0xea86('0x1e')]?_[_0xea86('0x1f')](_0x544699[_0xea86('0x1e')],function(_0x412882){return{'model':db[_0x412882[_0xea86('0x20')]],'as':_0x412882['as'],'attributes':_0x412882[_0xea86('0x1c')],'include':_0x412882['include']?_[_0xea86('0x1f')](_0x412882[_0xea86('0x1e')],function(_0x4a0838){return{'model':db[_0x4a0838[_0xea86('0x20')]],'as':_0x4a0838['as'],'attributes':_0x4a0838['attributes']};}):[]};}):[]};}):[]:[]})[_0xea86('0xc')](function(_0xf57d4b){logger[_0xea86('0xd')](_0xea86('0x21'),_0x379c74);logger[_0xea86('0x10')]('ShowTrunk',_0x379c74,JSON[_0xea86('0x12')](_0xf57d4b));_0x36b235(_0xf57d4b);})[_0xea86('0x16')](function(_0x1a428c){logger[_0xea86('0x13')](_0xea86('0x21'),_0x1a428c[_0xea86('0x14')],_0x379c74);_0x4357e5(_0xb778fd[_0xea86('0x13')](0x1f4,_0x1a428c[_0xea86('0x14')]));});});}; \ No newline at end of file +var _0xf4b4=['result','catch','GetTrunk','options','raw','where','attributes','limit','include','map','model','ShowTrunk','find','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xf4b4,0x1ba));var _0x4f4b=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xf4b4[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x4f4b('0x0'));var util=require(_0x4f4b('0x1'));var moment=require('moment');var BPromise=require(_0x4f4b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f4b('0x3'));var db=require(_0x4f4b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f4b('0x5'));var config=require(_0x4f4b('0x6'));var jayson=require(_0x4f4b('0x7'));var client=jayson[_0x4f4b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b53eb,_0x9fa2e6,_0x3c621d){return new BPromise(function(_0x38faca,_0xa6b520){return client[_0x4f4b('0x9')](_0x3b53eb,_0x3c621d)[_0x4f4b('0xa')](function(_0xaa1d5f){logger[_0x4f4b('0xb')](_0x4f4b('0xc'),_0x9fa2e6,'request\x20sent');logger[_0x4f4b('0xd')](_0x4f4b('0xe'),_0x9fa2e6,_0x4f4b('0xf'),JSON[_0x4f4b('0x10')](_0xaa1d5f));if(_0xaa1d5f[_0x4f4b('0x11')]){if(_0xaa1d5f[_0x4f4b('0x11')][_0x4f4b('0x12')]===0x1f4){logger['error'](_0x4f4b('0xc'),_0x9fa2e6,_0xaa1d5f['error']['message']);return _0xa6b520(_0xaa1d5f[_0x4f4b('0x11')][_0x4f4b('0x13')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x9fa2e6,_0xaa1d5f[_0x4f4b('0x11')]['message']);return _0x38faca(_0xaa1d5f[_0x4f4b('0x11')][_0x4f4b('0x13')]);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x9fa2e6,_0x4f4b('0xf'));_0x38faca(_0xaa1d5f[_0x4f4b('0x14')][_0x4f4b('0x13')]);}})[_0x4f4b('0x15')](function(_0x5df2a9){logger[_0x4f4b('0x11')](_0x4f4b('0xc'),_0x9fa2e6,_0x5df2a9);_0xa6b520(_0x5df2a9);});});}exports[_0x4f4b('0x16')]=function(_0x1ff6f1){var _0x540d50=this;return new Promise(function(_0x12138,_0x51f806){return db['Trunk']['findAll']({'raw':_0x1ff6f1[_0x4f4b('0x17')]?_0x1ff6f1[_0x4f4b('0x17')][_0x4f4b('0x18')]===undefined?!![]:![]:!![],'where':_0x1ff6f1[_0x4f4b('0x17')]?_0x1ff6f1[_0x4f4b('0x17')][_0x4f4b('0x19')]||null:null,'attributes':_0x1ff6f1['options']?_0x1ff6f1['options'][_0x4f4b('0x1a')]||null:null,'limit':_0x1ff6f1[_0x4f4b('0x17')]?_0x1ff6f1[_0x4f4b('0x17')][_0x4f4b('0x1b')]||null:null,'include':_0x1ff6f1[_0x4f4b('0x17')]?_0x1ff6f1[_0x4f4b('0x17')][_0x4f4b('0x1c')]?_[_0x4f4b('0x1d')](_0x1ff6f1[_0x4f4b('0x17')]['include'],function(_0x383d45){return{'model':db[_0x383d45[_0x4f4b('0x1e')]],'as':_0x383d45['as'],'attributes':_0x383d45[_0x4f4b('0x1a')],'include':_0x383d45[_0x4f4b('0x1c')]?_['map'](_0x383d45[_0x4f4b('0x1c')],function(_0x5288b0){return{'model':db[_0x5288b0[_0x4f4b('0x1e')]],'as':_0x5288b0['as'],'attributes':_0x5288b0['attributes'],'include':_0x5288b0[_0x4f4b('0x1c')]?_[_0x4f4b('0x1d')](_0x5288b0[_0x4f4b('0x1c')],function(_0xbb7f1a){return{'model':db[_0xbb7f1a['model']],'as':_0xbb7f1a['as'],'attributes':_0xbb7f1a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x196ffb){logger['info'](_0x4f4b('0x16'),_0x1ff6f1);logger[_0x4f4b('0xd')]('GetTrunk',_0x1ff6f1,JSON[_0x4f4b('0x10')](_0x196ffb));_0x12138(_0x196ffb);})['catch'](function(_0x24d158){logger[_0x4f4b('0x11')](_0x4f4b('0x16'),_0x24d158[_0x4f4b('0x13')],_0x1ff6f1);_0x51f806(_0x540d50[_0x4f4b('0x11')](0x1f4,_0x24d158[_0x4f4b('0x13')]));});});};exports[_0x4f4b('0x1f')]=function(_0x161b6f){var _0x3aa03b=this;return new Promise(function(_0x582f00,_0x4f2991){return db['Trunk'][_0x4f4b('0x20')]({'raw':_0x161b6f[_0x4f4b('0x17')]?_0x161b6f['options'][_0x4f4b('0x18')]===undefined?!![]:![]:!![],'where':_0x161b6f[_0x4f4b('0x17')]?_0x161b6f[_0x4f4b('0x17')]['where']||null:null,'attributes':_0x161b6f[_0x4f4b('0x17')]?_0x161b6f['options'][_0x4f4b('0x1a')]||null:null,'include':_0x161b6f['options']?_0x161b6f[_0x4f4b('0x17')][_0x4f4b('0x1c')]?_['map'](_0x161b6f[_0x4f4b('0x17')][_0x4f4b('0x1c')],function(_0xbe59bc){return{'model':db[_0xbe59bc[_0x4f4b('0x1e')]],'as':_0xbe59bc['as'],'attributes':_0xbe59bc[_0x4f4b('0x1a')],'include':_0xbe59bc['include']?_[_0x4f4b('0x1d')](_0xbe59bc['include'],function(_0x508ebf){return{'model':db[_0x508ebf['model']],'as':_0x508ebf['as'],'attributes':_0x508ebf['attributes'],'include':_0x508ebf[_0x4f4b('0x1c')]?_['map'](_0x508ebf[_0x4f4b('0x1c')],function(_0x4d5679){return{'model':db[_0x4d5679[_0x4f4b('0x1e')]],'as':_0x4d5679['as'],'attributes':_0x4d5679[_0x4f4b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e57af){logger[_0x4f4b('0xb')](_0x4f4b('0x1f'),_0x161b6f);logger[_0x4f4b('0xd')](_0x4f4b('0x1f'),_0x161b6f,JSON[_0x4f4b('0x10')](_0x3e57af));_0x582f00(_0x3e57af);})['catch'](function(_0x44cde6){logger[_0x4f4b('0x11')](_0x4f4b('0x1f'),_0x44cde6[_0x4f4b('0x13')],_0x161b6f);_0x4f2991(_0x3aa03b[_0x4f4b('0x11')](0x1f4,_0x44cde6[_0x4f4b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 5db1716..86c6654 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 _0x85a0=['exports','express','../../components/auth/service','./user-setting.controller','put','isAuthenticated'];(function(_0x11fa82,_0x3a0637){var _0x191cfb=function(_0x114bd8){while(--_0x114bd8){_0x11fa82['push'](_0x11fa82['shift']());}};_0x191cfb(++_0x3a0637);}(_0x85a0,0xfd));var _0x085a=function(_0x484a0f,_0x53811e){_0x484a0f=_0x484a0f-0x0;var _0x201cdc=_0x85a0[_0x484a0f];return _0x201cdc;};'use strict';var express=require(_0x085a('0x0'));var router=express['Router']();var auth=require(_0x085a('0x1'));var controller=require(_0x085a('0x2'));router[_0x085a('0x3')]('/:id',auth[_0x085a('0x4')](),controller['update']);module[_0x085a('0x5')]=router; \ No newline at end of file +var _0x0d04=['../../components/auth/service','put','/:id','isAuthenticated','update','exports','express','Router'];(function(_0x6263c5,_0x5d0d7a){var _0x10be20=function(_0x89082e){while(--_0x89082e){_0x6263c5['push'](_0x6263c5['shift']());}};_0x10be20(++_0x5d0d7a);}(_0x0d04,0x15e));var _0x40d0=function(_0x5b95af,_0x1b27a5){_0x5b95af=_0x5b95af-0x0;var _0x57da28=_0x0d04[_0x5b95af];return _0x57da28;};'use strict';var express=require(_0x40d0('0x0'));var router=express[_0x40d0('0x1')]();var auth=require(_0x40d0('0x2'));var controller=require('./user-setting.controller');router[_0x40d0('0x3')](_0x40d0('0x4'),auth[_0x40d0('0x5')](),controller[_0x40d0('0x6')]);module[_0x40d0('0x7')]=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 11356c6..59300c2 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 _0x3d43=['INTEGER','UserId','sequelize','error','warning','info','exports','TEXT','DATE'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x3d43,0x18e));var _0x33d4=function(_0x30abff,_0x5f2c5f){_0x30abff=_0x30abff-0x0;var _0x4c571e=_0x3d43[_0x30abff];return _0x4c571e;};'use strict';var Sequelize=require(_0x33d4('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x33d4('0x1'),_0x33d4('0x2'),_0x33d4('0x3'),'debug'];module[_0x33d4('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x33d4('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x33d4('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x33d4('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x33d4('0x7')],'unique':_0x33d4('0x8')}}; \ No newline at end of file +var _0xbde1=['BOOLEAN','TEXT','INTEGER','sequelize','error','warning','debug','exports','ENUM'];(function(_0x3ef45f,_0x4e8b0e){var _0x4e74fd=function(_0x1dc099){while(--_0x1dc099){_0x3ef45f['push'](_0x3ef45f['shift']());}};_0x4e74fd(++_0x4e8b0e);}(_0xbde1,0x17d));var _0x1bde=function(_0x473eb8,_0x1ada19){_0x473eb8=_0x473eb8-0x0;var _0x4e9e09=_0xbde1[_0x473eb8];return _0x4e9e09;};'use strict';var Sequelize=require(_0x1bde('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x1bde('0x1'),_0x1bde('0x2'),'info',_0x1bde('0x3')];module[_0x1bde('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x1bde('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x1bde('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x1bde('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x1bde('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x1bde('0x8')],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index c3c4895..1323834 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 _0x383d=['role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','then','catch','../../config/logger','api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','update','sendStatus','error','stack','name','send'];(function(_0x12d189,_0x380a14){var _0x10a453=function(_0x211fab){while(--_0x211fab){_0x12d189['push'](_0x12d189['shift']());}};_0x10a453(++_0x380a14);}(_0x383d,0x86));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0xd383('0x0'))(_0xd383('0x1'));var config=require(_0xd383('0x2'));var db=require('../../mysqldb')['db'];var socket=require(_0xd383('0x3'))(new Redis(config[_0xd383('0x4')]));require(_0xd383('0x5'))[_0xd383('0x6')](socket);config[_0xd383('0x4')]=_[_0xd383('0x7')](config['redis'],{'host':_0xd383('0x8'),'port':0x18eb});function respondWithResult(_0x30ba82,_0x9922e9){_0x9922e9=_0x9922e9||0xc8;return function(_0x470d8d){if(_0x470d8d){return _0x30ba82[_0xd383('0x9')](_0x9922e9)['json'](_0x470d8d);}};}function saveUpdates(_0x55478b){return function(_0x19c4aa){if(_0x19c4aa){return _0x19c4aa[_0xd383('0xa')](_0x55478b)['then'](function(_0x2abc3a){return _0x2abc3a;});}return null;};}function handleEntityNotFound(_0x64b0eb){return function(_0x12547b){if(!_0x12547b){_0x64b0eb[_0xd383('0xb')](0x194);}return _0x12547b;};}function handleError(_0x3f6155,_0x10830e){_0x10830e=_0x10830e||0x1f4;return function(_0x51096d){logger[_0xd383('0xc')](_0x51096d[_0xd383('0xd')]);if(_0x51096d[_0xd383('0xe')]){delete _0x51096d[_0xd383('0xe')];}_0x3f6155['status'](_0x10830e)[_0xd383('0xf')](_0x51096d);};}exports[_0xd383('0xa')]=function(_0x208d82,_0x3fe48f){if(_0x208d82['user'][_0xd383('0x10')]!=='admin')throw new Error(_0xd383('0x11'));if(isNaN(Number(_0x208d82[_0xd383('0x12')]['id'])))throw new Error(_0xd383('0x13'));return db[_0xd383('0x14')][_0xd383('0x15')]({'where':{'id':_0x208d82[_0xd383('0x12')]['id']}})['then'](handleEntityNotFound(_0x3fe48f,null))['then'](saveUpdates(_0x208d82[_0xd383('0x16')],null))[_0xd383('0x17')](respondWithResult(_0x3fe48f,null))[_0xd383('0x18')](handleError(_0x3fe48f,null));}; \ No newline at end of file +var _0x225c=['status','json','then','sendStatus','error','name','update','Invalid\x20user\x20setting\x20id','UserSetting','find','lodash','ioredis','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x225c,0x106));var _0xc225=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x225c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc225('0x0'));var Redis=require(_0xc225('0x1'));var logger=require('../../config/logger')('api');var config=require(_0xc225('0x2'));var db=require('../../mysqldb')['db'];var socket=require(_0xc225('0x3'))(new Redis(config[_0xc225('0x4')]));require(_0xc225('0x5'))[_0xc225('0x6')](socket);config[_0xc225('0x4')]=_[_0xc225('0x7')](config[_0xc225('0x4')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x143eab,_0x249b43){_0x249b43=_0x249b43||0xc8;return function(_0x409c9f){if(_0x409c9f){return _0x143eab[_0xc225('0x8')](_0x249b43)[_0xc225('0x9')](_0x409c9f);}};}function saveUpdates(_0x4dc4ed){return function(_0x166add){if(_0x166add){return _0x166add['update'](_0x4dc4ed)[_0xc225('0xa')](function(_0x10f26b){return _0x10f26b;});}return null;};}function handleEntityNotFound(_0x238dbf){return function(_0x52727e){if(!_0x52727e){_0x238dbf[_0xc225('0xb')](0x194);}return _0x52727e;};}function handleError(_0x1f2f4f,_0x3ca94e){_0x3ca94e=_0x3ca94e||0x1f4;return function(_0x331018){logger[_0xc225('0xc')](_0x331018['stack']);if(_0x331018[_0xc225('0xd')]){delete _0x331018[_0xc225('0xd')];}_0x1f2f4f['status'](_0x3ca94e)['send'](_0x331018);};}exports[_0xc225('0xe')]=function(_0x3dc064,_0x2c53af){if(_0x3dc064['user']['role']!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x3dc064['params']['id'])))throw new Error(_0xc225('0xf'));return db[_0xc225('0x10')][_0xc225('0x11')]({'where':{'id':_0x3dc064['params']['id']}})[_0xc225('0xa')](handleEntityNotFound(_0x2c53af,null))['then'](saveUpdates(_0x3dc064['body'],null))[_0xc225('0xa')](respondWithResult(_0x2c53af,null))['catch'](handleError(_0x2c53af,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 7ed7929..3603903 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 _0x50da=['emit','hasOwnProperty','exports','events','UserSetting','setMaxListeners','save','update','remove'];(function(_0x4a453a,_0x1afed8){var _0x3f016e=function(_0x4bd749){while(--_0x4bd749){_0x4a453a['push'](_0x4a453a['shift']());}};_0x3f016e(++_0x1afed8);}(_0x50da,0x1b3));var _0xa50d=function(_0x331f85,_0x1245e8){_0x331f85=_0x331f85-0x0;var _0xba4531=_0x50da[_0x331f85];return _0xba4531;};'use strict';var EventEmitter=require(_0xa50d('0x0'));var UserSetting=require('../../mysqldb')['db'][_0xa50d('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xa50d('0x2')](0x0);var events={'afterCreate':_0xa50d('0x3'),'afterUpdate':_0xa50d('0x4'),'afterDestroy':_0xa50d('0x5')};function emitEvent(_0x27b4bc){return function(_0xc17bbe,_0x49ecd9,_0x4950e9){UserSettingEvents[_0xa50d('0x6')](_0x27b4bc+':'+_0xc17bbe['id'],_0xc17bbe);UserSettingEvents['emit'](_0x27b4bc,_0xc17bbe);_0x4950e9(null);};}for(var e in events){if(events[_0xa50d('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0xa50d('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x6e5c=['hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2142da,_0x41e78b){var _0x2f0782=function(_0x22190f){while(--_0x22190f){_0x2142da['push'](_0x2142da['shift']());}};_0x2f0782(++_0x41e78b);}(_0x6e5c,0xde));var _0xc6e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e5c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc6e5('0x0'));var UserSetting=require(_0xc6e5('0x1'))['db'][_0xc6e5('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xc6e5('0x3')](0x0);var events={'afterCreate':_0xc6e5('0x4'),'afterUpdate':_0xc6e5('0x5'),'afterDestroy':_0xc6e5('0x6')};function emitEvent(_0x54d418){return function(_0x313d0c,_0x42d51a,_0x4bf60a){UserSettingEvents[_0xc6e5('0x7')](_0x54d418+':'+_0x313d0c['id'],_0x313d0c);UserSettingEvents['emit'](_0x54d418,_0x313d0c);_0x4bf60a(null);};}for(var e in events){if(events[_0xc6e5('0x8')](e)){var event=events[e];UserSetting[_0xc6e5('0x9')](e,emitEvent(event));}}module[_0xc6e5('0xa')]=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 767313d..0166a7d 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 _0x6075=['define','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x6075,0x142));var _0x5607=function(_0x20a88e,_0x537e17){_0x20a88e=_0x20a88e-0x0;var _0x5a6d72=_0x6075[_0x20a88e];return _0x5a6d72;};'use strict';var attributes=require(_0x5607('0x0'));module[_0x5607('0x1')]=function(_0x491939){return _0x491939[_0x5607('0x2')](_0x5607('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48cde9){if(!_0x48cde9[_0x5607('0x4')])_0x48cde9['clientSideLoggingEnabledSince']=null;else if(_0x48cde9['clientSideLoggingEnabledSince']===null)_0x48cde9[_0x5607('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x9c02=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x2b077a,_0x3da35b){var _0x56d6c0=function(_0x51148a){while(--_0x51148a){_0x2b077a['push'](_0x2b077a['shift']());}};_0x56d6c0(++_0x3da35b);}(_0x9c02,0x196));var _0x29c0=function(_0x241254,_0x2f6228){_0x241254=_0x241254-0x0;var _0x88eef3=_0x9c02[_0x241254];return _0x88eef3;};'use strict';var attributes=require(_0x29c0('0x0'));module[_0x29c0('0x1')]=function(_0x1d76c2){return _0x1d76c2['define']('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52dba5){if(!_0x52dba5[_0x29c0('0x2')])_0x52dba5['clientSideLoggingEnabledSince']=null;else if(_0x52dba5[_0x29c0('0x3')]===null)_0x52dba5['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 e58aa06..829304c 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 _0x1f6e=['user-setting:','save','update','emit','user-setting:update','UserId','register','length'];(function(_0xf598c3,_0x4a943f){var _0x265335=function(_0x303c11){while(--_0x303c11){_0xf598c3['push'](_0xf598c3['shift']());}};_0x265335(++_0x4a943f);}(_0x1f6e,0x171));var _0xe1f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1f6e[_0x3dd15e];return _0x231fd0;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xe1f6('0x0'),'remove',_0xe1f6('0x1')];function createListener(_0x53eb50,_0xf6c041){return function(_0x37c8a7){_0xf6c041[_0xe1f6('0x2')](_0x53eb50,_0x37c8a7);if(_0x53eb50===_0xe1f6('0x3')){_0xf6c041['emit']('user-setting:update:user-'+_0x37c8a7[_0xe1f6('0x4')],_0x37c8a7);}};}exports[_0xe1f6('0x5')]=function(_0x2eff0c){for(var _0x484263=0x0,_0x4413b5=events[_0xe1f6('0x6')];_0x484263<_0x4413b5;_0x484263++){var _0x5dc458=events[_0x484263];var _0x174620=createListener(_0xe1f6('0x7')+_0x5dc458,_0x2eff0c);UserSettingEvents['on'](_0x5dc458,_0x174620);}}; \ No newline at end of file +var _0x11ca=['length','./user-setting.events','remove','update','emit','user-setting:update:user-','UserId'];(function(_0xf7b166,_0xb13f05){var _0x1b9c58=function(_0x52f599){while(--_0x52f599){_0xf7b166['push'](_0xf7b166['shift']());}};_0x1b9c58(++_0xb13f05);}(_0x11ca,0x1b3));var _0xa11c=function(_0x27e9b0,_0x42a347){_0x27e9b0=_0x27e9b0-0x0;var _0x2ce614=_0x11ca[_0x27e9b0];return _0x2ce614;};'use strict';var UserSettingEvents=require(_0xa11c('0x0'));var events=['save',_0xa11c('0x1'),_0xa11c('0x2')];function createListener(_0x14abc7,_0x34a767){return function(_0x3a14b0){_0x34a767[_0xa11c('0x3')](_0x14abc7,_0x3a14b0);if(_0x14abc7==='user-setting:update'){_0x34a767[_0xa11c('0x3')](_0xa11c('0x4')+_0x3a14b0[_0xa11c('0x5')],_0x3a14b0);}};}exports['register']=function(_0x4a0e96){for(var _0x4d43fb=0x0,_0x1c4b13=events[_0xa11c('0x6')];_0x4d43fb<_0x1c4b13;_0x4d43fb++){var _0x3a1958=events[_0x4d43fb];var _0x51121e=createListener('user-setting:'+_0x3a1958,_0x4a0e96);UserSettingEvents['on'](_0x3a1958,_0x51121e);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 95ef8ef..a7e5bcb 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 _0x5beb=['/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getAgents','getVoicePrefixes','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','/:id/avatar','file','login','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','/:id/fax_accounts','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','/:id','/:id/password','changePassword','delete','removeTeams','destroy','removeMailInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions'];(function(_0x5af0f1,_0x4c90e6){var _0x249237=function(_0x11919e){while(--_0x11919e){_0x5af0f1['push'](_0x5af0f1['shift']());}};_0x249237(++_0x4c90e6);}(_0x5beb,0x1ae));var _0xb5be=function(_0x335439,_0x9569e1){_0x335439=_0x335439-0x0;var _0xcdedee=_0x5beb[_0x335439];return _0xcdedee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb5be('0x0'));var timeout=require('connect-timeout');var express=require(_0xb5be('0x1'));var router=express[_0xb5be('0x2')]();var fs_extra=require(_0xb5be('0x3'));var auth=require(_0xb5be('0x4'));var interaction=require(_0xb5be('0x5'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0xb5be('0x6')]('/',auth[_0xb5be('0x7')](),controller[_0xb5be('0x8')]);router[_0xb5be('0x6')](_0xb5be('0x9'),auth[_0xb5be('0x7')](),controller[_0xb5be('0xa')]);router[_0xb5be('0x6')](_0xb5be('0xb'),auth[_0xb5be('0x7')](),controller[_0xb5be('0xc')]);router[_0xb5be('0x6')](_0xb5be('0xd'),auth[_0xb5be('0x7')](),controller[_0xb5be('0xe')]);router[_0xb5be('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xb5be('0xf')]);router[_0xb5be('0x6')]('/:id/avatar',controller[_0xb5be('0x10')]);router[_0xb5be('0x6')]('/:id/open_tabs',auth[_0xb5be('0x7')](),controller['getOpenTabs']);router[_0xb5be('0x6')](_0xb5be('0x11'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x12')]);router[_0xb5be('0x6')](_0xb5be('0x13'),auth['isAuthenticated'](),controller[_0xb5be('0x14')]);router[_0xb5be('0x6')](_0xb5be('0x15'),auth['isAuthenticated'](),controller[_0xb5be('0x16')]);router['get'](_0xb5be('0x17'),auth['isAuthenticated'](),controller['getGroups']);router[_0xb5be('0x6')](_0xb5be('0x18'),auth['isAuthenticated'](),controller[_0xb5be('0x19')]);router['get'](_0xb5be('0x1a'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x1b')]);router['get'](_0xb5be('0x1c'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x1d')]);router['get'](_0xb5be('0x1e'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x1f')]);router['get'](_0xb5be('0x20'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x21')]);router['get'](_0xb5be('0x22'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x23')]);router[_0xb5be('0x6')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0xb5be('0x24')]);router[_0xb5be('0x6')](_0xb5be('0x25'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x26')]);router['get'](_0xb5be('0x27'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x28')]);router[_0xb5be('0x6')]('/:id/lists',auth[_0xb5be('0x7')](),controller['getLists']);router[_0xb5be('0x6')]('/:id/agents',auth[_0xb5be('0x7')](),controller[_0xb5be('0x29')]);router['get']('/:id/prefixes',auth[_0xb5be('0x7')](),controller[_0xb5be('0x2a')]);router[_0xb5be('0x6')]('/:id/fax_accounts',auth[_0xb5be('0x7')](),controller[_0xb5be('0x2b')]);router['get']('/:id/mail_accounts',auth[_0xb5be('0x7')](),controller[_0xb5be('0x2c')]);router[_0xb5be('0x6')](_0xb5be('0x2d'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x2e')]);router[_0xb5be('0x6')](_0xb5be('0x2f'),auth[_0xb5be('0x7')](),controller['getSmsAccounts']);router[_0xb5be('0x6')]('/:id/chat_websites',auth[_0xb5be('0x7')](),controller['getChatWebsites']);router[_0xb5be('0x6')]('/:id/whatsapp_accounts',auth[_0xb5be('0x7')](),controller[_0xb5be('0x30')]);router[_0xb5be('0x6')](_0xb5be('0x31'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x32')]);router[_0xb5be('0x6')](_0xb5be('0x33'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x34')]);router[_0xb5be('0x6')]('/:id/api_key',auth[_0xb5be('0x7')](),controller[_0xb5be('0x35')]);router[_0xb5be('0x36')](_0xb5be('0x11'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x37')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5be('0x38')]);router[_0xb5be('0x36')](_0xb5be('0x39'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x3a')]);router[_0xb5be('0x36')](_0xb5be('0x13'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x3b')]);var upload=multer({'storage':multer[_0xb5be('0x3c')]({'destination':function(_0x254dbe,_0xed4c06,_0x21226c){_0x21226c(null,path[_0xb5be('0x3d')](config[_0xb5be('0x3e')],_0xb5be('0x3f')));},'filename':function(_0xe82b7d,_0x1d0ebe,_0x50efba){_0x50efba(null,util['format'](_0xb5be('0x40'),Date[_0xb5be('0x41')](),_0x1d0ebe[_0xb5be('0x42')]));}})});router[_0xb5be('0x36')](_0xb5be('0x43'),upload['single'](_0xb5be('0x44')),controller['addAvatar']);router[_0xb5be('0x36')]('/:id/login',auth[_0xb5be('0x7')](),controller[_0xb5be('0x45')]);router[_0xb5be('0x36')]('/:id/logout',auth[_0xb5be('0x7')](),controller['logout']);router[_0xb5be('0x36')](_0xb5be('0x46'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x47')]);router[_0xb5be('0x36')](_0xb5be('0x48'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x49')]);router[_0xb5be('0x36')](_0xb5be('0x27'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x4a')]);router[_0xb5be('0x36')](_0xb5be('0x4b'),auth[_0xb5be('0x7')](),controller['addChatInteractions']);router['post'](_0xb5be('0x4c'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x4d')]);router['post'](_0xb5be('0x4e'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x4f')]);router[_0xb5be('0x36')](_0xb5be('0x50'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x51')]);router['post'](_0xb5be('0x52'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x53')]);router[_0xb5be('0x36')](_0xb5be('0x54'),auth[_0xb5be('0x7')](),controller['addWhatsappInteractions']);router[_0xb5be('0x36')](_0xb5be('0x55'),auth['isAuthenticated'](),controller[_0xb5be('0x56')]);router[_0xb5be('0x36')](_0xb5be('0x57'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x58')]);router['post']('/:id/openchannel_accounts',auth[_0xb5be('0x7')](),controller[_0xb5be('0x59')]);router[_0xb5be('0x36')]('/:id/sms_accounts',auth[_0xb5be('0x7')](),controller[_0xb5be('0x5a')]);router['post'](_0xb5be('0x5b'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x5c')]);router[_0xb5be('0x36')](_0xb5be('0x5d'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x5e')]);router[_0xb5be('0x36')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0xb5be('0x5f')]);router['post'](_0xb5be('0x60'),auth['isAuthenticated'](),controller[_0xb5be('0x61')]);router[_0xb5be('0x62')](_0xb5be('0x63'),auth[_0xb5be('0x7')](),controller['update']);router['put'](_0xb5be('0x64'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x65')]);router[_0xb5be('0x66')](_0xb5be('0x13'),auth['isAuthenticated'](),controller['removeQueues']);router['delete'](_0xb5be('0x27'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x67')]);router[_0xb5be('0x66')]('/:id',auth['isAuthenticated'](),controller[_0xb5be('0x68')]);router[_0xb5be('0x66')]('/:id/chat_interactions',auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0xb5be('0x66')](_0xb5be('0x4c'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x69')]);router[_0xb5be('0x66')](_0xb5be('0x4e'),auth[_0xb5be('0x7')](),controller['removeFaxInteractions']);router[_0xb5be('0x66')]('/:id/sms_interactions',auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0xb5be('0x66')](_0xb5be('0x52'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x6a')]);router['delete']('/:id/whatsapp_interactions',auth[_0xb5be('0x7')](),controller[_0xb5be('0x6b')]);router[_0xb5be('0x66')](_0xb5be('0x55'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x6c')]);router['delete'](_0xb5be('0x57'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x6d')]);router['delete']('/:id/openchannel_accounts',auth[_0xb5be('0x7')](),controller['removeOpenchannelAccounts']);router[_0xb5be('0x66')](_0xb5be('0x2f'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x6e')]);router[_0xb5be('0x66')](_0xb5be('0x5b'),auth['isAuthenticated'](),controller[_0xb5be('0x6f')]);router['delete'](_0xb5be('0x5d'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x70')]);router[_0xb5be('0x66')](_0xb5be('0x31'),auth[_0xb5be('0x7')](),controller[_0xb5be('0x71')]);router['delete'](_0xb5be('0x60'),auth[_0xb5be('0x7')](),controller['removeApiKey']);module[_0xb5be('0x72')]=router; \ No newline at end of file +var _0x9abc=['getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','addContacts','create','post','/create_many','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','/:id/fax_accounts','addFaxAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','update','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/whoami','whoami','getPresence','show','/:id/avatar','/:id/open_tabs','/:id/contacts'];(function(_0x8bf741,_0x43657c){var _0x22624e=function(_0x5bf2a1){while(--_0x5bf2a1){_0x8bf741['push'](_0x8bf741['shift']());}};_0x22624e(++_0x43657c);}(_0x9abc,0x1b7));var _0xc9ab=function(_0x18f92f,_0x23552a){_0x18f92f=_0x18f92f-0x0;var _0x4ec40c=_0x9abc[_0x18f92f];return _0x4ec40c;};'use strict';var multer=require('multer');var util=require(_0xc9ab('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc9ab('0x1'));var auth=require(_0xc9ab('0x2'));var interaction=require(_0xc9ab('0x3'));var config=require(_0xc9ab('0x4'));var controller=require(_0xc9ab('0x5'));router[_0xc9ab('0x6')]('/',auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x8')]);router['get']('/describe',auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x9')]);router[_0xc9ab('0x6')](_0xc9ab('0xa'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0xb')]);router[_0xc9ab('0x6')]('/presence',auth[_0xc9ab('0x7')](),controller[_0xc9ab('0xc')]);router['get']('/:id',auth[_0xc9ab('0x7')](),controller[_0xc9ab('0xd')]);router[_0xc9ab('0x6')](_0xc9ab('0xe'),controller['getAvatar']);router[_0xc9ab('0x6')](_0xc9ab('0xf'),auth[_0xc9ab('0x7')](),controller['getOpenTabs']);router['get'](_0xc9ab('0x10'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x11')]);router[_0xc9ab('0x6')](_0xc9ab('0x12'),auth[_0xc9ab('0x7')](),controller['getQueues']);router[_0xc9ab('0x6')](_0xc9ab('0x13'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x14')]);router[_0xc9ab('0x6')](_0xc9ab('0x15'),auth['isAuthenticated'](),controller['getGroups']);router[_0xc9ab('0x6')](_0xc9ab('0x16'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x17')]);router['get']('/:id/screen_recordings',auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0xc9ab('0x6')](_0xc9ab('0x18'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x19')]);router[_0xc9ab('0x6')](_0xc9ab('0x1a'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x1b')]);router['get']('/:id/mail/interactions',auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x1c')]);router[_0xc9ab('0x6')](_0xc9ab('0x1d'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x1e')]);router['get'](_0xc9ab('0x1f'),auth['isAuthenticated'](),controller[_0xc9ab('0x20')]);router[_0xc9ab('0x6')](_0xc9ab('0x21'),auth['isAuthenticated'](),controller[_0xc9ab('0x22')]);router[_0xc9ab('0x6')](_0xc9ab('0x23'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x24')]);router[_0xc9ab('0x6')](_0xc9ab('0x25'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x26')]);router['get']('/:id/agents',auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x27')]);router[_0xc9ab('0x6')](_0xc9ab('0x28'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x29')]);router[_0xc9ab('0x6')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xc9ab('0x2a')]);router['get'](_0xc9ab('0x2b'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0xc9ab('0x6')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xc9ab('0x2c')]);router[_0xc9ab('0x6')](_0xc9ab('0x2d'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x2e')]);router[_0xc9ab('0x6')](_0xc9ab('0x2f'),auth[_0xc9ab('0x7')](),controller['getChatWebsites']);router[_0xc9ab('0x6')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xc9ab('0x30')]);router['get'](_0xc9ab('0x31'),auth['isAuthenticated'](),controller[_0xc9ab('0x32')]);router[_0xc9ab('0x6')]('/:id/scheduled_calls',auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x33')]);router[_0xc9ab('0x6')](_0xc9ab('0x34'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x35')]);router['post'](_0xc9ab('0x10'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x36')]);router['post']('/',auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x37')]);router[_0xc9ab('0x38')](_0xc9ab('0x39'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x3a')]);router[_0xc9ab('0x38')](_0xc9ab('0x12'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x3b')]);var upload=multer({'storage':multer[_0xc9ab('0x3c')]({'destination':function(_0x3f00a5,_0x42c499,_0x488bca){_0x488bca(null,path[_0xc9ab('0x3d')](config[_0xc9ab('0x3e')],'server/files/images/'));},'filename':function(_0x118e92,_0x52576f,_0x3fd89a){_0x3fd89a(null,util[_0xc9ab('0x3f')](_0xc9ab('0x40'),Date[_0xc9ab('0x41')](),_0x52576f[_0xc9ab('0x42')]));}})});router['post'](_0xc9ab('0xe'),upload[_0xc9ab('0x43')](_0xc9ab('0x44')),controller[_0xc9ab('0x45')]);router[_0xc9ab('0x38')](_0xc9ab('0x46'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x47')]);router['post']('/:id/logout',auth['isAuthenticated'](),controller[_0xc9ab('0x48')]);router['post'](_0xc9ab('0x49'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x4a')]);router[_0xc9ab('0x38')](_0xc9ab('0x4b'),auth['isAuthenticated'](),controller['unpause']);router[_0xc9ab('0x38')](_0xc9ab('0x23'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x4c')]);router[_0xc9ab('0x38')](_0xc9ab('0x4d'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x4e')]);router[_0xc9ab('0x38')](_0xc9ab('0x4f'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x50')]);router[_0xc9ab('0x38')](_0xc9ab('0x51'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0xc9ab('0x38')](_0xc9ab('0x52'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x53')]);router[_0xc9ab('0x38')](_0xc9ab('0x54'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x55')]);router[_0xc9ab('0x38')](_0xc9ab('0x56'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0xc9ab('0x38')](_0xc9ab('0x57'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x58')]);router[_0xc9ab('0x38')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['addMailAccounts']);router['post'](_0xc9ab('0x59'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x5a')]);router[_0xc9ab('0x38')]('/:id/sms_accounts',auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x5b')]);router[_0xc9ab('0x38')](_0xc9ab('0x2f'),auth['isAuthenticated'](),controller[_0xc9ab('0x5c')]);router[_0xc9ab('0x38')]('/:id/whatsapp_accounts',auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x5d')]);router[_0xc9ab('0x38')](_0xc9ab('0x31'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x5e')]);router[_0xc9ab('0x38')](_0xc9ab('0x34'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x5f')]);router[_0xc9ab('0x60')](_0xc9ab('0x61'),auth['isAuthenticated'](),controller[_0xc9ab('0x62')]);router['put'](_0xc9ab('0x63'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x64')]);router[_0xc9ab('0x65')](_0xc9ab('0x12'),auth[_0xc9ab('0x7')](),controller['removeQueues']);router[_0xc9ab('0x65')](_0xc9ab('0x23'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x66')]);router[_0xc9ab('0x65')](_0xc9ab('0x61'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x67')]);router[_0xc9ab('0x65')](_0xc9ab('0x4d'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x68')]);router[_0xc9ab('0x65')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xc9ab('0x69')]);router['delete'](_0xc9ab('0x51'),auth[_0xc9ab('0x7')](),controller['removeFaxInteractions']);router[_0xc9ab('0x65')]('/:id/sms_interactions',auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x6a')]);router[_0xc9ab('0x65')](_0xc9ab('0x54'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x6b')]);router['delete'](_0xc9ab('0x56'),auth[_0xc9ab('0x7')](),controller['removeWhatsappInteractions']);router[_0xc9ab('0x65')]('/:id/fax_accounts',auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x6c')]);router[_0xc9ab('0x65')]('/:id/mail_accounts',auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x6d')]);router[_0xc9ab('0x65')]('/:id/openchannel_accounts',auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x6e')]);router[_0xc9ab('0x65')](_0xc9ab('0x2d'),auth[_0xc9ab('0x7')](),controller['removeSmsAccounts']);router[_0xc9ab('0x65')](_0xc9ab('0x2f'),auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x6f')]);router[_0xc9ab('0x65')]('/:id/whatsapp_accounts',auth[_0xc9ab('0x7')](),controller[_0xc9ab('0x70')]);router[_0xc9ab('0x65')](_0xc9ab('0x31'),auth[_0xc9ab('0x7')](),controller['removeSquareProjects']);router['delete'](_0xc9ab('0x34'),auth['isAuthenticated'](),controller[_0xc9ab('0x71')]);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 c12e8e6..14a6f12 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 _0xcbe2=['/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','callerid','format','internal','email','ENUM','agent','telephone','INTEGER','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','nonat','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','active','actpass','update','update,nonat','TEXT','showWebBar','get','isArray','wss','force_avp','icesupport','dtlsenable','dtlsprivatekey','rtcp_mux','encryption','avpf','dtlsverify','dtlssetup','dtlscertfile'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0xcbe2,0x16c));var _0x2cbe=function(_0x329bb8,_0x47d3cd){_0x329bb8=_0x329bb8-0x0;var _0x22f746=_0xcbe2[_0x329bb8];return _0x22f746;};'use strict';var Sequelize=require(_0x2cbe('0x0'));var moment=require(_0x2cbe('0x1'));var util=require(_0x2cbe('0x2'));var _=require(_0x2cbe('0x3'));module[_0x2cbe('0x4')]={'name':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1c4bc7){this['setDataValue']('name',_0x1c4bc7);this[_0x2cbe('0x6')](_0x2cbe('0x7'),_0x1c4bc7);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':![],'set':function(_0x3deaaf){this[_0x2cbe('0x6')](_0x2cbe('0x8'),_0x3deaaf);this['setDataValue'](_0x2cbe('0x9'),util[_0x2cbe('0xa')]('\x22%s\x22\x20<%s>',_0x3deaaf,this['getDataValue'](_0x2cbe('0xb'))));}},'alias':{'type':Sequelize[_0x2cbe('0x5')]},'email':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':![],'unique':_0x2cbe('0xc'),'validate':{'isEmail':!![]},'set':function(_0x49a8f0){if(_0x49a8f0){this[_0x2cbe('0x6')]('email',_0x49a8f0['toLowerCase']());}}},'role':{'type':Sequelize[_0x2cbe('0xd')]('admin','user',_0x2cbe('0xe'),_0x2cbe('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x2cbe('0x10')](0xb),'allowNull':![],'unique':'internal','set':function(_0x53544c){this[_0x2cbe('0x6')](_0x2cbe('0xb'),_0x53544c);this['setDataValue']('accountcode',_0x53544c);this[_0x2cbe('0x6')](_0x2cbe('0x9'),util[_0x2cbe('0xa')](_0x2cbe('0x11'),this[_0x2cbe('0x12')](_0x2cbe('0x8')),_0x53544c));}},'salt':{'type':Sequelize[_0x2cbe('0x5')]},'phone':{'type':Sequelize[_0x2cbe('0x5')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x2cbe('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x2cbe('0x5')]},'city':{'type':Sequelize[_0x2cbe('0x5')]},'country':{'type':Sequelize[_0x2cbe('0x5')]},'online':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2cbe('0x14')]},'voicePause':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x2cbe('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2cbe('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2cbe('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2cbe('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x2cbe('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2cbe('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2cbe('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x2cbe('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2cbe('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x16'),'user',_0x2cbe('0x17')),'allowNull':!![],'defaultValue':_0x2cbe('0x16')},'context':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![],'defaultValue':_0x2cbe('0x18')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x2cbe('0x19'),'ALLOWED_FAILED_SCREEN',_0x2cbe('0x1a'),_0x2cbe('0x1b'),_0x2cbe('0x1c'),_0x2cbe('0x1d'),_0x2cbe('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![],'defaultValue':_0x2cbe('0x1f'),'set':function(_0x34f520){this[_0x2cbe('0x6')](_0x2cbe('0x20'),_0x34f520?_0x34f520[_0x2cbe('0x21')](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue'](_0x2cbe('0x20'))[_0x2cbe('0x22')](','):null;},'comment':_0x2cbe('0x23')},'dtmfmode':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x24'),'info',_0x2cbe('0x25'),'inband',_0x2cbe('0x26')),'allowNull':!![],'defaultValue':_0x2cbe('0x24')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x2cbe('0x27'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x2cbe('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2cbe('0x29'),'set':function(_0x4c3f14){this[_0x2cbe('0x6')](_0x2cbe('0x2a'),_0x4c3f14?_0x4c3f14[_0x2cbe('0x21')](','):null);},'get':function(){return this[_0x2cbe('0x12')](_0x2cbe('0x2a'))?this[_0x2cbe('0x12')](_0x2cbe('0x2a'))[_0x2cbe('0x22')](','):null;},'comment':_0x2cbe('0x2b')},'callgroup':{'type':Sequelize[_0x2cbe('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x2cbe('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2cbe('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2cbe('0x5')]},'disallow':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':![],'defaultValue':_0x2cbe('0x2c')},'allow':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':![],'defaultValue':_0x2cbe('0x2d'),'set':function(_0x497c88){this['setDataValue'](_0x2cbe('0x2e'),_0x497c88?_0x497c88['join'](';'):_0x2cbe('0x2d'));},'get':function(){return this[_0x2cbe('0x12')](_0x2cbe('0x2e'))?this[_0x2cbe('0x12')](_0x2cbe('0x2e'))['split'](';'):null;},'comment':_0x2cbe('0x2f')},'autoframing':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![],'set':function(_0x5521e8){this['setDataValue'](_0x2cbe('0x30'),_0x5521e8?_0x5521e8[_0x2cbe('0x21')](','):null);},'get':function(){return this[_0x2cbe('0x12')](_0x2cbe('0x30'))?this[_0x2cbe('0x12')](_0x2cbe('0x30'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x2cbe('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2cbe('0xd')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2cbe('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![],'defaultValue':_0x2cbe('0x31')},'amaflags':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2cbe('0xd')]('yes','no'),'allowNull':!![],'defaultValue':_0x2cbe('0x28')},'busylevel':{'type':Sequelize[_0x2cbe('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2cbe('0xd')]('yes','no',_0x2cbe('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2cbe('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x2cbe('0x33'),_0x2cbe('0x34'),_0x2cbe('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2cbe('0xd')]('uac',_0x2cbe('0x36')),'allowNull':!![],'defaultValue':_0x2cbe('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![],'defaultValue':_0x2cbe('0x28')},'keepalive':{'type':Sequelize[_0x2cbe('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x2cbe('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2cbe('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2cbe('0x10')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2cbe('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2cbe('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2cbe('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2cbe('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2cbe('0xd')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x2cbe('0x37'),_0x2cbe('0x38')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x2cbe('0x39'),'passive',_0x2cbe('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2cbe('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2cbe('0xd')](_0x2cbe('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x2cbe('0x27'),_0x2cbe('0x3b'),_0x2cbe('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x2cbe('0x14')]},'passwordResetAt':{'type':Sequelize[_0x2cbe('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x2cbe('0x3d')]},'showWebBar':{'type':Sequelize[_0x2cbe('0x10')],'defaultValue':0x0,'set':function(_0x226abb){this[_0x2cbe('0x6')](_0x2cbe('0x3e'),_0x226abb);var _0x5124d8=this[_0x2cbe('0x3f')]({'plain':!![]});switch(_0x226abb){case 0x0:case 0x1:var _0x58a182=_0x5124d8[_0x2cbe('0x20')]?_[_0x2cbe('0x40')](_0x5124d8['transport'])?_0x5124d8[_0x2cbe('0x20')][_0x2cbe('0x21')]():_0x5124d8[_0x2cbe('0x20')]:_0x2cbe('0x1f');if(_0x58a182===_0x2cbe('0x41')){_0x58a182=_0x2cbe('0x1f');}this[_0x2cbe('0x6')](_0x2cbe('0x20'),_0x58a182);this['setDataValue']('encryption','no');this[_0x2cbe('0x6')]('avpf',null);this[_0x2cbe('0x6')](_0x2cbe('0x42'),null);this[_0x2cbe('0x6')](_0x2cbe('0x43'),null);this[_0x2cbe('0x6')](_0x2cbe('0x44'),null);this[_0x2cbe('0x6')]('dtlsverify',null);this[_0x2cbe('0x6')]('dtlssetup',null);this[_0x2cbe('0x6')]('dtlscertfile',null);this[_0x2cbe('0x6')](_0x2cbe('0x45'),null);this['setDataValue'](_0x2cbe('0x46'),'no');break;case 0x2:this[_0x2cbe('0x6')](_0x2cbe('0x20'),_0x2cbe('0x41'));this[_0x2cbe('0x6')](_0x2cbe('0x47'),_0x2cbe('0x28'));this[_0x2cbe('0x6')](_0x2cbe('0x48'),_0x2cbe('0x28'));this[_0x2cbe('0x6')](_0x2cbe('0x42'),_0x2cbe('0x28'));this['setDataValue'](_0x2cbe('0x43'),_0x2cbe('0x28'));this[_0x2cbe('0x6')]('dtlsenable','yes');this[_0x2cbe('0x6')](_0x2cbe('0x49'),'no');this[_0x2cbe('0x6')](_0x2cbe('0x4a'),_0x2cbe('0x3a'));this[_0x2cbe('0x6')](_0x2cbe('0x4b'),_0x5124d8[_0x2cbe('0x4b')]||'/etc/pki/tls/certs/motion.crt');this[_0x2cbe('0x6')](_0x2cbe('0x45'),_0x5124d8[_0x2cbe('0x45')]||_0x2cbe('0x4c'));this['setDataValue'](_0x2cbe('0x46'),_0x2cbe('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x2cbe('0x3d')],'set':function(_0x21edff){this[_0x2cbe('0x6')](_0x2cbe('0x4d'),_0x21edff?_0x21edff[_0x2cbe('0x21')](','):[]);},'get':function(){return this[_0x2cbe('0x12')](_0x2cbe('0x4d'))?_[_0x2cbe('0x4e')](this[_0x2cbe('0x12')]('permissions')[_0x2cbe('0x22')](','),function(_0x61ebd0){return parseInt(_0x61ebd0,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x2cbe('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x2cbe('0x5')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2cbe('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2cbe('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x2cbe('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2cbe('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2cbe('0x4f')],'get':function(){return this[_0x2cbe('0x12')](_0x2cbe('0x50'))?this[_0x2cbe('0x12')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0x2cbe('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2cbe('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![],'set':function(_0x37b829){if(typeof _0x37b829===_0x2cbe('0x51')){var _0x53996e=_0x37b829==='1'?!![]:_0x37b829==='0'?![]:_0x37b829===_0x2cbe('0x52')?!![]:_0x37b829===_0x2cbe('0x53')?![]:![];this[_0x2cbe('0x6')](_0x2cbe('0x54'),_0x53996e);}else{this[_0x2cbe('0x6')](_0x2cbe('0x54'),_0x37b829);}}},'blocked':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![],'set':function(_0x3fc82c){this[_0x2cbe('0x6')]('blocked',_0x3fc82c);if(_0x3fc82c===!![]){this[_0x2cbe('0x6')](_0x2cbe('0x55'),moment());this['setDataValue'](_0x2cbe('0x56'),0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x2cbe('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x2cbe('0x10')](0x5)[_0x2cbe('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x2cbe('0x13')],'defaultValue':![]}}; \ No newline at end of file +var _0x186e=['fingerprint','active','passive','actpass','update,nonat','get','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','STRING','INTEGER','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','rfc2833','shortinfo','inband','yes','nonat','update','nat','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas'];(function(_0x8d2dc1,_0x29819d){var _0x8d769c=function(_0x492b6a){while(--_0x492b6a){_0x8d2dc1['push'](_0x8d2dc1['shift']());}};_0x8d769c(++_0x29819d);}(_0x186e,0x118));var _0xe186=function(_0x344d60,_0x2f146b){_0x344d60=_0x344d60-0x0;var _0x231765=_0x186e[_0x344d60];return _0x231765;};'use strict';var Sequelize=require(_0xe186('0x0'));var moment=require(_0xe186('0x1'));var util=require(_0xe186('0x2'));var _=require(_0xe186('0x3'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x151db4){this[_0xe186('0x4')](_0xe186('0x5'),_0x151db4);this[_0xe186('0x4')](_0xe186('0x6'),_0x151db4);},'comment':_0xe186('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x1631dd){this[_0xe186('0x4')](_0xe186('0x8'),_0x1631dd);this[_0xe186('0x4')](_0xe186('0x9'),util[_0xe186('0xa')](_0xe186('0xb'),_0x1631dd,this[_0xe186('0xc')](_0xe186('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe186('0xe'),'validate':{'isEmail':!![]},'set':function(_0x3d421b){if(_0x3d421b){this[_0xe186('0x4')](_0xe186('0xe'),_0x3d421b[_0xe186('0xf')]());}}},'role':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x11'),_0xe186('0x12'),_0xe186('0x13'),_0xe186('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0xe186('0x15')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xe186('0x15')],'defaultValue':'local'},'internal':{'type':Sequelize[_0xe186('0x16')](0xb),'allowNull':![],'unique':'internal','set':function(_0x3846b2){this[_0xe186('0x4')](_0xe186('0xd'),_0x3846b2);this[_0xe186('0x4')]('accountcode',_0x3846b2);this[_0xe186('0x4')](_0xe186('0x9'),util[_0xe186('0xa')](_0xe186('0xb'),this[_0xe186('0xc')]('fullname'),_0x3846b2));}},'salt':{'type':Sequelize[_0xe186('0x15')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xe186('0x15')]},'address':{'type':Sequelize[_0xe186('0x15')]},'zipcode':{'type':Sequelize[_0xe186('0x15')]},'userpic':{'type':Sequelize[_0xe186('0x15')]},'city':{'type':Sequelize[_0xe186('0x15')]},'country':{'type':Sequelize[_0xe186('0x15')]},'online':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xe186('0x18')]},'voicePause':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xe186('0x19')},'lastPauseAt':{'type':Sequelize[_0xe186('0x18')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe186('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xe186('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xe186('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xe186('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xe186('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xe186('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe186('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x1a'),_0xe186('0x12'),_0xe186('0x1b')),'allowNull':!![],'defaultValue':_0xe186('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x1c'),'ALLOWED_PASSED_SCREEN',_0xe186('0x1d'),_0xe186('0x1e'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xe186('0x1f'),_0xe186('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'transport':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![],'defaultValue':_0xe186('0x21'),'set':function(_0x4ea6e9){this['setDataValue'](_0xe186('0x22'),_0x4ea6e9?_0x4ea6e9[_0xe186('0x23')](','):null);},'get':function(){return this[_0xe186('0xc')](_0xe186('0x22'))?this[_0xe186('0xc')](_0xe186('0x22'))[_0xe186('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x25'),'info',_0xe186('0x26'),_0xe186('0x27'),'auto'),'allowNull':!![],'defaultValue':_0xe186('0x25')},'directmedia':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x28'),'no',_0xe186('0x29'),_0xe186('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xe186('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'nat':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x3acb58){this[_0xe186('0x4')](_0xe186('0x2b'),_0x3acb58?_0x3acb58[_0xe186('0x23')](','):null);},'get':function(){return this[_0xe186('0xc')](_0xe186('0x2b'))?this[_0xe186('0xc')](_0xe186('0x2b'))[_0xe186('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xe186('0x15')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe186('0x15')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xe186('0x15')],'allowNull':![],'defaultValue':_0xe186('0x2c')},'allow':{'type':Sequelize[_0xe186('0x15')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x324190){this[_0xe186('0x4')](_0xe186('0x2d'),_0x324190?_0x324190[_0xe186('0x23')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xe186('0xc')](_0xe186('0x2d'))?this[_0xe186('0xc')]('allow')[_0xe186('0x24')](';'):null;},'comment':_0xe186('0x2e')},'autoframing':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![],'set':function(_0x396b1c){this['setDataValue'](_0xe186('0x2f'),_0x396b1c?_0x396b1c[_0xe186('0x23')](','):null);},'get':function(){return this[_0xe186('0xc')](_0xe186('0x2f'))?this[_0xe186('0xc')](_0xe186('0x2f'))[_0xe186('0x24')](','):null;},'comment':_0xe186('0x30')},'trustrpid':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xe186('0x28'),'no',_0xe186('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xe186('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xe186('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe186('0x32')},'amaflags':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xe186('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xe186('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xe186('0x10')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x28'),'no',_0xe186('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe186('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x34'),_0xe186('0x35'),_0xe186('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xe186('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xe186('0x10')]('uac',_0xe186('0x37')),'allowNull':!![],'defaultValue':_0xe186('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x28'),'no'),'allowNull':!![],'defaultValue':_0xe186('0x28')},'keepalive':{'type':Sequelize[_0xe186('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xe186('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xe186('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xe186('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xe186('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xe186('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xe186('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xe186('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xe186('0x38'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xe186('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xe186('0x39'),_0xe186('0x3a'),_0xe186('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xe186('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xe186('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xe186('0x15')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xe186('0x10')](_0xe186('0x28'),'no',_0xe186('0x29'),'update',_0xe186('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe186('0x15')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xe186('0x16')],'defaultValue':0x0,'set':function(_0x5f395c){this['setDataValue']('showWebBar',_0x5f395c);var _0x5e5072=this[_0xe186('0x3d')]({'plain':!![]});switch(_0x5f395c){case 0x0:case 0x1:var _0x3ae3ca=_0x5e5072[_0xe186('0x22')]?_['isArray'](_0x5e5072[_0xe186('0x22')])?_0x5e5072[_0xe186('0x22')]['join']():_0x5e5072[_0xe186('0x22')]:_0xe186('0x21');if(_0x3ae3ca==='wss'){_0x3ae3ca='udp';}this['setDataValue'](_0xe186('0x22'),_0x3ae3ca);this[_0xe186('0x4')](_0xe186('0x3e'),'no');this[_0xe186('0x4')](_0xe186('0x3f'),null);this[_0xe186('0x4')](_0xe186('0x40'),null);this[_0xe186('0x4')]('icesupport',null);this[_0xe186('0x4')](_0xe186('0x41'),null);this[_0xe186('0x4')](_0xe186('0x42'),null);this[_0xe186('0x4')]('dtlssetup',null);this[_0xe186('0x4')](_0xe186('0x43'),null);this[_0xe186('0x4')](_0xe186('0x44'),null);this[_0xe186('0x4')](_0xe186('0x45'),'no');break;case 0x2:this[_0xe186('0x4')]('transport','wss');this[_0xe186('0x4')](_0xe186('0x3e'),_0xe186('0x28'));this['setDataValue'](_0xe186('0x3f'),_0xe186('0x28'));this[_0xe186('0x4')]('force_avp',_0xe186('0x28'));this[_0xe186('0x4')](_0xe186('0x46'),_0xe186('0x28'));this[_0xe186('0x4')]('dtlsenable',_0xe186('0x28'));this[_0xe186('0x4')](_0xe186('0x42'),'no');this[_0xe186('0x4')](_0xe186('0x47'),'actpass');this[_0xe186('0x4')](_0xe186('0x43'),_0x5e5072[_0xe186('0x43')]||_0xe186('0x48'));this['setDataValue'](_0xe186('0x44'),_0x5e5072[_0xe186('0x44')]||_0xe186('0x49'));this['setDataValue']('rtcp_mux',_0xe186('0x28'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x18a03d){this[_0xe186('0x4')](_0xe186('0x4a'),_0x18a03d?_0x18a03d[_0xe186('0x23')](','):[]);},'get':function(){return this[_0xe186('0xc')](_0xe186('0x4a'))?_['map'](this[_0xe186('0xc')](_0xe186('0x4a'))[_0xe186('0x24')](','),function(_0x19bb2f){return parseInt(_0x19bb2f,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xe186('0x15')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xe186('0x15')]},'phoneBarBusyNumber':{'type':Sequelize[_0xe186('0x15')]},'phoneBarUnconditional':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xe186('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe186('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xe186('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xe186('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xe186('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xe186('0x15')]},'phoneBarEnableJaws':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xe186('0x4b')],'get':function(){return this[_0xe186('0xc')](_0xe186('0x4c'))?this[_0xe186('0xc')](_0xe186('0x4c')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xe186('0x15')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![],'set':function(_0x1423fd){if(typeof _0x1423fd==='string'){var _0x52e3e0=_0x1423fd==='1'?!![]:_0x1423fd==='0'?![]:_0x1423fd===_0xe186('0x4d')?!![]:_0x1423fd===_0xe186('0x4e')?![]:![];this[_0xe186('0x4')](_0xe186('0x4f'),_0x52e3e0);}else{this[_0xe186('0x4')](_0xe186('0x4f'),_0x1423fd);}}},'blocked':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![],'set':function(_0x158a2d){this[_0xe186('0x4')](_0xe186('0x50'),_0x158a2d);if(_0x158a2d===!![]){this[_0xe186('0x4')](_0xe186('0x51'),moment());this[_0xe186('0x4')](_0xe186('0x52'),0x0);}else{this[_0xe186('0x4')](_0xe186('0x51'),null);}}},'blockedAt':{'type':Sequelize[_0xe186('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xe186('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xe186('0x16')](0x5)[_0xe186('0x53')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xe186('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe186('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xe186('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 7408c67..1a9458d 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 _0xba29=['remove','isArray','Queue:remove','voice','addAvatar','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','server/files/images/','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','concat','getContacts','order','sort','pick','hasOwnProperty','CmList','Tag','Tags','color','tag','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','whatsapppause','pauseType','lastPauseAt','unpause','manual','%s%s','Pause','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','getMailQueues','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','TeamVoicePrefix','removeTeams','Mail','getFaxQueues','Fax','UserVoicePrefix','VoicePrefixId','getLists','getAgents','values','send','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','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','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$gt','$gte','$lt','$ne','$not','$between','$notBetween','$like','$notLike','$notILike','$contains','$any','lastName','CmContact','Contact','dialActive','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','json','removeApiKey','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','queues','isEmpty','teams','inbound','lower','col','toString','asc','uniqBy','orderBy','request','idle','unknown','unavailable','voiceStatus','busy','slice','charAt','toUpperCase','select','field','InteractionId','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','moment','bluebird','path','squel','jayson/promise','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','then','User,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','undefined','count','offset','limit','set','Content-Range','get','role','admin','user','Agents','agent','Telephones','telephone','filter','ignore','value','includes','name','UserProfileResource','destroy','end','stack','index','rawAttributes','map','fieldName','type','key','password','salt','getOptions','where','User','query','includeAll','include','userSetting','attributes','push','findAll','true','rows','length','dataValues','mail','whatsapp','all','show','params','model','differenceBy','keys','filters','intersection','fields','merge','options','find','chat','sms','openchannel','fax','update','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','permissions','103','104','105','106','107','108','109','100','111','114','115','create','Unauthorized','checkUserLimits','settingsEnabled','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','compact','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','VoiceQueue','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xba29,0xe6));var _0x9ba2=function(_0x18a587,_0x465328){_0x18a587=_0x18a587-0x0;var _0xa6a4d5=_0xba29[_0x18a587];return _0xa6a4d5;};'use strict';var moment=require(_0x9ba2('0x0'));var BPromise=require(_0x9ba2('0x1'));var util=require('util');var path=require(_0x9ba2('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9ba2('0x3'));var jayson=require(_0x9ba2('0x4'));var Redis=require(_0x9ba2('0x5'));var authService=require('../../components/auth/service');var qs=require(_0x9ba2('0x6'));var logger=require(_0x9ba2('0x7'))(_0x9ba2('0x8'));var utils=require(_0x9ba2('0x9'));var config=require(_0x9ba2('0xa'));var licenseUtil=require(_0x9ba2('0xb'));var db=require(_0x9ba2('0xc'))['db'];var socket=require(_0x9ba2('0xd'))(new Redis(config[_0x9ba2('0xe')]));require(_0x9ba2('0xf'))[_0x9ba2('0x10')](socket);config['redis']=_[_0x9ba2('0x11')](config[_0x9ba2('0xe')],{'host':_0x9ba2('0x12'),'port':0x18eb});var client=jayson[_0x9ba2('0x13')][_0x9ba2('0x14')]({'port':0x232a});var values;function respondWithRpcPromise(_0x4142d6,_0x462a94,_0x4fece4,_0x4420a8){return new BPromise(function(_0x343cc1,_0xbe8d33){var _0x11c27d=_0x4420a8||client;return _0x11c27d['request'](_0x4142d6,_0x4fece4)[_0x9ba2('0x15')](function(_0x20adc5){logger['info'](_0x9ba2('0x16'),_0x462a94,'request\x20sent');logger[_0x9ba2('0x17')]('User,\x20%s,\x20%s,\x20%s',_0x462a94,_0x9ba2('0x18'),JSON[_0x9ba2('0x19')](_0x20adc5));if(_0x20adc5[_0x9ba2('0x1a')]){if(_0x20adc5['error'][_0x9ba2('0x1b')]===0x1f4){logger[_0x9ba2('0x1a')](_0x9ba2('0x16'),_0x462a94,_0x20adc5[_0x9ba2('0x1a')][_0x9ba2('0x1c')]);return _0xbe8d33(_0x20adc5['error'][_0x9ba2('0x1c')]);}logger['error'](_0x9ba2('0x16'),_0x462a94,_0x20adc5[_0x9ba2('0x1a')]['message']);return _0x343cc1(_0x20adc5[_0x9ba2('0x1a')][_0x9ba2('0x1c')]);}else{logger['info'](_0x9ba2('0x16'),_0x462a94,_0x9ba2('0x18'));_0x343cc1(_0x20adc5[_0x9ba2('0x1d')][_0x9ba2('0x1c')]);}})[_0x9ba2('0x1e')](function(_0x4d6a89){logger[_0x9ba2('0x1a')](_0x9ba2('0x16'),_0x462a94,_0x4d6a89);_0xbe8d33(_0x4d6a89);});});}function respondWithStatusCode(_0x1c8d51,_0x569fc9){_0x569fc9=_0x569fc9||0xcc;return function(_0x58c105){if(_0x58c105){return _0x1c8d51[_0x9ba2('0x1f')](_0x569fc9);}return _0x1c8d51[_0x9ba2('0x20')](_0x569fc9)['end']();};}function respondWithResult(_0xf170d3,_0x135702){_0x135702=_0x135702||0xc8;return function(_0x544d05){if(_0x544d05){return _0xf170d3[_0x9ba2('0x20')](_0x135702)['json'](_0x544d05);}};}function respondWithFilteredResult(_0x907ec6,_0x429c1b){return function(_0x24da46){if(_0x24da46){var _0x3f9b9e=typeof _0x429c1b['offset']===_0x9ba2('0x21')&&typeof _0x429c1b['limit']===_0x9ba2('0x21');var _0x46d37f=_0x24da46[_0x9ba2('0x22')];var _0x40372b=_0x3f9b9e?0x0:_0x429c1b[_0x9ba2('0x23')];var _0x5a9bce=_0x3f9b9e?_0x24da46['count']:_0x429c1b['offset']+_0x429c1b[_0x9ba2('0x24')];var _0xba2237;if(_0x5a9bce>=_0x46d37f){_0x5a9bce=_0x46d37f;_0xba2237=0xc8;}else{_0xba2237=0xce;}_0x907ec6[_0x9ba2('0x20')](_0xba2237);return _0x907ec6[_0x9ba2('0x25')](_0x9ba2('0x26'),_0x40372b+'-'+_0x5a9bce+'/'+_0x46d37f)['json'](_0x24da46);}return null;};}function saveUpdates(_0x4b6cec){return function(_0x42cb77){if(_0x42cb77){return _0x42cb77['update'](_0x4b6cec)[_0x9ba2('0x15')](function(_0x3d44d5){return _0x3d44d5;});}return null;};}function removeEntity(_0x2cdb2a){return function(_0x50fc74){if(_0x50fc74){return _0x50fc74['destroy']()[_0x9ba2('0x15')](function(){var _0x1da197=_0x50fc74[_0x9ba2('0x27')]({'plain':!![]});if(_0x1da197[_0x9ba2('0x28')]===_0x9ba2('0x29'))return;var _0x19f15d=[{'name':'Users','value':_0x9ba2('0x2a'),'ignore':!![]},{'name':_0x9ba2('0x2b'),'value':_0x9ba2('0x2c'),'ignore':![]},{'name':_0x9ba2('0x2d'),'value':_0x9ba2('0x2e'),'ignore':![]}];var _0x550798=_(_0x19f15d)[_0x9ba2('0x2f')](_0x9ba2('0x30'))['map'](_0x9ba2('0x31'))[_0x9ba2('0x31')]();if(_[_0x9ba2('0x32')](_0x550798,_0x1da197[_0x9ba2('0x28')])){return;}var _0x1107e1=_['find'](_0x19f15d,[_0x9ba2('0x31'),_0x1da197['role']])[_0x9ba2('0x33')];return db[_0x9ba2('0x34')][_0x9ba2('0x35')]({'where':{'type':_0x1107e1,'resourceId':_0x1da197['id']}})[_0x9ba2('0x15')](function(){return _0x50fc74;});})['then'](function(){_0x2cdb2a['status'](0xcc)[_0x9ba2('0x36')]();});}};}function handleEntityNotFound(_0x36c25e){return function(_0x232c11){if(!_0x232c11){_0x36c25e[_0x9ba2('0x1f')](0x194);}return _0x232c11;};}function handleError(_0x9ad2b6,_0x1efdfb){_0x1efdfb=_0x1efdfb||0x1f4;return function(_0x492733){logger[_0x9ba2('0x1a')](_0x492733[_0x9ba2('0x37')]);if(_0x492733['name']){delete _0x492733[_0x9ba2('0x33')];}_0x9ad2b6[_0x9ba2('0x20')](_0x1efdfb)['send'](_0x492733);};}exports[_0x9ba2('0x38')]=function(_0xcccade,_0x4093b7){var _0x557e11={},_0x100e64={'count':0x0,'rows':[]};var _0xd3b60c=_(db['User'][_0x9ba2('0x39')])[_0x9ba2('0x3a')](function(_0x4bcfef){return{'name':_0x4bcfef[_0x9ba2('0x3b')],'type':_0x4bcfef[_0x9ba2('0x3c')][_0x9ba2('0x3d')]};})[_0x9ba2('0x2f')](function(_0x579f2e){return!_[_0x9ba2('0x32')]([_0x9ba2('0x3e'),_0x9ba2('0x3f')],_0x579f2e[_0x9ba2('0x33')]);})[_0x9ba2('0x31')]();_0x557e11=qs[_0x9ba2('0x40')](_0xd3b60c,_0xcccade);var _0x39b89={'where':_0x557e11[_0x9ba2('0x41')]};return db[_0x9ba2('0x42')][_0x9ba2('0x22')](_0x39b89)[_0x9ba2('0x15')](function(_0x4c0fbd){_0x100e64[_0x9ba2('0x22')]=_0x4c0fbd;if(_0xcccade[_0x9ba2('0x43')][_0x9ba2('0x44')]){_0x557e11[_0x9ba2('0x45')]=[{'all':!![]}];}if(_0xcccade[_0x9ba2('0x43')]['userSetting']==='true'){_0x557e11[_0x9ba2('0x45')]=[{'model':db['UserSetting'],'as':_0x9ba2('0x46')}];}if(!_[_0x9ba2('0x32')](_0x557e11[_0x9ba2('0x47')],'id')){_0x557e11['attributes'][_0x9ba2('0x48')]('id');}return db[_0x9ba2('0x42')][_0x9ba2('0x49')](_0x557e11);})['then'](function(_0x51988b){_0x100e64['rows']=_0x51988b;if(_0xcccade[_0x9ba2('0x43')]['openTabs']===_0x9ba2('0x4a')){var _0x30f60b=[];for(var _0x4beb71=0x0;_0x4beb71<_0x100e64[_0x9ba2('0x4b')][_0x9ba2('0x4c')];_0x4beb71++){_0x30f60b[_0x9ba2('0x48')](get_open_tabs('chat',_0x100e64[_0x9ba2('0x4b')][_0x4beb71][_0x9ba2('0x4d')]));_0x30f60b[_0x9ba2('0x48')](get_open_tabs('sms',_0x100e64[_0x9ba2('0x4b')][_0x4beb71][_0x9ba2('0x4d')]));_0x30f60b['push'](get_open_tabs('fax',_0x100e64[_0x9ba2('0x4b')][_0x4beb71][_0x9ba2('0x4d')]));_0x30f60b[_0x9ba2('0x48')](get_open_tabs(_0x9ba2('0x4e'),_0x100e64[_0x9ba2('0x4b')][_0x4beb71][_0x9ba2('0x4d')]));_0x30f60b[_0x9ba2('0x48')](get_open_tabs('openchannel',_0x100e64['rows'][_0x4beb71]['dataValues']));_0x30f60b['push'](get_open_tabs(_0x9ba2('0x4f'),_0x100e64[_0x9ba2('0x4b')][_0x4beb71]['dataValues']));}return BPromise[_0x9ba2('0x50')](_0x30f60b)[_0x9ba2('0x15')](function(){return _0x100e64;});}else{return _0x100e64;}})[_0x9ba2('0x15')](respondWithFilteredResult(_0x4093b7,_0x557e11))[_0x9ba2('0x1e')](handleError(_0x4093b7,null));};exports[_0x9ba2('0x51')]=function(_0x1d5648,_0x4214c0){var _0x287370={'raw':![],'where':{'id':_0x1d5648[_0x9ba2('0x52')]['id']}},_0x10aef7={};_0x10aef7[_0x9ba2('0x53')]=_[_0x9ba2('0x54')](_[_0x9ba2('0x55')](db['User'][_0x9ba2('0x39')]),['password',_0x9ba2('0x3f')]);_0x10aef7[_0x9ba2('0x43')]=_[_0x9ba2('0x55')](_0x1d5648[_0x9ba2('0x43')]);_0x10aef7[_0x9ba2('0x56')]=_[_0x9ba2('0x57')](_0x10aef7[_0x9ba2('0x53')],_0x10aef7[_0x9ba2('0x43')]);_0x287370['attributes']=_[_0x9ba2('0x57')](_0x10aef7['model'],qs[_0x9ba2('0x58')](_0x1d5648[_0x9ba2('0x43')]['fields']));_0x287370[_0x9ba2('0x47')]=_0x287370[_0x9ba2('0x47')]['length']?_0x287370[_0x9ba2('0x47')]:_0x10aef7[_0x9ba2('0x53')];if(_0x1d5648['query']['includeAll']){_0x287370[_0x9ba2('0x45')]=[{'all':!![]}];}if(_0x1d5648['query'][_0x9ba2('0x46')]==='true'){_0x287370[_0x9ba2('0x45')]=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x287370=_[_0x9ba2('0x59')]({},_0x287370,_0x1d5648[_0x9ba2('0x5a')]);if(!_['includes'](_0x287370[_0x9ba2('0x47')],'id')){_0x287370[_0x9ba2('0x47')]['push']('id');}return db[_0x9ba2('0x42')][_0x9ba2('0x5b')](_0x287370)[_0x9ba2('0x15')](handleEntityNotFound(_0x4214c0,null))[_0x9ba2('0x15')](function(_0x4d81ce){var _0x11b032=[];values=_0x4d81ce;if(_0x1d5648[_0x9ba2('0x43')]['openTabs']===_0x9ba2('0x4a')){_0x11b032[_0x9ba2('0x48')](get_open_tabs(_0x9ba2('0x5c'),_0x4d81ce[_0x9ba2('0x4d')]));_0x11b032['push'](get_open_tabs(_0x9ba2('0x5d'),_0x4d81ce['dataValues']));_0x11b032[_0x9ba2('0x48')](get_open_tabs(_0x9ba2('0x5e'),_0x4d81ce['dataValues']));_0x11b032[_0x9ba2('0x48')](get_open_tabs(_0x9ba2('0x4f'),_0x4d81ce[_0x9ba2('0x4d')]));_0x11b032[_0x9ba2('0x48')](get_open_tabs(_0x9ba2('0x5f'),_0x4d81ce[_0x9ba2('0x4d')]));_0x11b032[_0x9ba2('0x48')](get_open_tabs(_0x9ba2('0x4e'),_0x4d81ce[_0x9ba2('0x4d')]));return BPromise['all'](_0x11b032);}else{return values;}})[_0x9ba2('0x15')](function(){return values;})[_0x9ba2('0x15')](respondWithResult(_0x4214c0,null))[_0x9ba2('0x1e')](handleError(_0x4214c0,null));};exports[_0x9ba2('0x60')]=function(_0x4a2988,_0x3c0167){if(_0x4a2988[_0x9ba2('0x61')]['id']){delete _0x4a2988[_0x9ba2('0x61')]['id'];}delete _0x4a2988[_0x9ba2('0x61')][_0x9ba2('0x28')];return db[_0x9ba2('0x42')][_0x9ba2('0x5b')]({'where':{'id':_0x4a2988[_0x9ba2('0x52')]['id']}})[_0x9ba2('0x15')](handleEntityNotFound(_0x3c0167,null))[_0x9ba2('0x15')](saveUpdates(_0x4a2988['body'],null))[_0x9ba2('0x15')](respondWithResult(_0x3c0167,null))['catch'](handleError(_0x3c0167,null));};exports[_0x9ba2('0x62')]=function(_0x5b04c5,_0x48b20e){return db['User'][_0x9ba2('0x62')]()[_0x9ba2('0x15')](respondWithResult(_0x48b20e,null))['catch'](handleError(_0x48b20e,null));};exports[_0x9ba2('0x63')]=function(_0x479541,_0x806df){return db[_0x9ba2('0x42')][_0x9ba2('0x5b')]({'where':{'id':_0x479541['params']['id']}})[_0x9ba2('0x15')](handleEntityNotFound(_0x806df,null))[_0x9ba2('0x15')](function(_0x490d5a){if(_0x490d5a){return _0x490d5a['addContacts'](_0x479541[_0x9ba2('0x61')][_0x9ba2('0x64')],_[_0x9ba2('0x65')](_0x479541[_0x9ba2('0x61')],[_0x9ba2('0x64'),'id'])||{});}})[_0x9ba2('0x15')](respondWithResult(_0x806df,null))[_0x9ba2('0x1e')](handleError(_0x806df,null));};function validateUser(_0x550907){return new BPromise(function(_0x1b6210,_0x484511){if(_0x550907[_0x9ba2('0x66')])return _0x1b6210(_0x550907);return db[_0x9ba2('0x67')][_0x9ba2('0x68')](0x1)[_0x9ba2('0x15')](function(_0x1e59a){if(_0x1e59a[_0x9ba2('0x69')])authService[_0x9ba2('0x6a')](_0x550907['password']);db[_0x9ba2('0x42')][_0x9ba2('0x6b')](_0x9ba2('0x66'))['then'](function(_0x1637cd){if(_[_0x9ba2('0x6c')](_0x1637cd)){_0x550907['internal']=_0x1e59a[_0x9ba2('0x6d')]||0x1;return;}if(_[_0x9ba2('0x6c')](_0x1e59a['min_internal'])||_0x1e59a[_0x9ba2('0x6d')]===_0x1637cd){_0x550907[_0x9ba2('0x66')]=_0x1637cd+0x1;return;}if(_0x1e59a[_0x9ba2('0x6d')]>_0x1637cd){_0x550907[_0x9ba2('0x66')]=_0x1e59a[_0x9ba2('0x6d')];return;}return db[_0x9ba2('0x6e')][_0x9ba2('0x43')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x9ba2('0x6e')][_0x9ba2('0x6f')][_0x9ba2('0x70')]})[_0x9ba2('0x15')](function(_0x46ed9c){if(_0x46ed9c&&_0x46ed9c['length']){for(var _0x55e36d=0x0,_0x191d21=_0x46ed9c[_0x9ba2('0x4c')];_0x55e36d<_0x191d21&&_['isNil'](_0x550907[_0x9ba2('0x66')]);_0x55e36d++){if(_0x1e59a[_0x9ba2('0x6d')]<=_0x46ed9c[_0x55e36d]['from']){_0x550907['internal']=_0x46ed9c[_0x55e36d][_0x9ba2('0x71')];}else if(_0x1e59a[_0x9ba2('0x6d')]>_0x46ed9c[_0x55e36d][_0x9ba2('0x71')]&&_0x1e59a['min_internal']<=_0x46ed9c[_0x55e36d]['to']){_0x550907[_0x9ba2('0x66')]=_0x1e59a[_0x9ba2('0x6d')];}}}if(_['isNil'](_0x550907[_0x9ba2('0x66')])){_0x550907[_0x9ba2('0x66')]=_0x1637cd+0x1;}return _0x1b6210(_0x550907);});});})['catch'](function(_0x112c44){_0x484511(_0x112c44);});});}function updateUser(_0x192386){return new BPromise(function(_0x4dc175,_0x26d29f){try{if(_0x192386[_0x9ba2('0x72')]){_0x192386[_0x9ba2('0x73')]=_0x192386['internal'];_0x192386[_0x9ba2('0x74')]={'mailbox':_0x192386[_0x9ba2('0x66')],'password':_0x192386[_0x9ba2('0x3e')],'fullname':_0x192386[_0x9ba2('0x75')],'email':_0x192386['email']};}if(_0x192386[_0x9ba2('0x28')]===_0x9ba2('0x2c')){if(!_0x192386[_0x9ba2('0x76')])_0x192386['permissions']=['101','102',_0x9ba2('0x77'),'113','110',_0x9ba2('0x78'),_0x9ba2('0x79'),_0x9ba2('0x7a'),_0x9ba2('0x7b'),_0x9ba2('0x7c'),_0x9ba2('0x7d'),_0x9ba2('0x7e'),_0x9ba2('0x7f'),_0x9ba2('0x80'),_0x9ba2('0x81')];}_0x4dc175(_0x192386);}catch(_0x427ec6){_0x26d29f(_0x427ec6);}});}exports[_0x9ba2('0x82')]=function(_0x407b27,_0x2d5ccc){if(_0x407b27[_0x9ba2('0x2a')]['role']===_0x9ba2('0x2c'))throw new Error(_0x9ba2('0x83'));if(_0x407b27[_0x9ba2('0x61')][_0x9ba2('0x28')]===_0x9ba2('0x2a')&&_0x407b27['user'][_0x9ba2('0x28')]!==_0x9ba2('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x407b27[_0x9ba2('0x61')][_0x9ba2('0x28')]===_0x9ba2('0x29')&&_0x407b27[_0x9ba2('0x2a')][_0x9ba2('0x28')]!==_0x9ba2('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x9ba2('0x84')]([_0x407b27[_0x9ba2('0x61')]])['then'](function(){return validateUser(_0x407b27[_0x9ba2('0x61')]);})['then'](function(_0x101a6c){return updateUser(_0x101a6c)['then'](function(_0x529e3f){if(_0x529e3f[_0x9ba2('0x28')]==='admin'){_0x529e3f[_0x9ba2('0x85')]=_0x407b27[_0x9ba2('0x2a')]['settingsEnabled'];delete _0x529e3f['userProfileId'];}return _0x529e3f;});})['then'](function(_0xe2148c){return db[_0x9ba2('0x42')]['create'](_0xe2148c,{'include':[{'model':db[_0x9ba2('0x74')],'as':'VoiceMail'}]});})[_0x9ba2('0x15')](function(_0x393fc4){if(_0x407b27[_0x9ba2('0x61')][_0x9ba2('0x28')]==='user')return _0x393fc4;if(_0x407b27['user'][_0x9ba2('0x28')]!=='user')return _0x393fc4;return db[_0x9ba2('0x86')]['find']({'where':{'name':_0x393fc4[_0x9ba2('0x28')]===_0x9ba2('0x2c')?_0x9ba2('0x2b'):_0x9ba2('0x2d'),'userProfileId':_0x407b27[_0x9ba2('0x2a')][_0x9ba2('0x87')]},'raw':!![]})['then'](function(_0x29a601){if(!_0x29a601||_0x29a601[_0x9ba2('0x88')]!=0x0)return _0x393fc4;return db[_0x9ba2('0x34')][_0x9ba2('0x82')]({'name':_0x393fc4['name'],'resourceId':_0x393fc4['id'],'type':_0x29a601[_0x9ba2('0x33')],'sectionId':_0x29a601['id']},{})[_0x9ba2('0x15')](function(){return _0x393fc4;});})[_0x9ba2('0x1e')](function(_0xd6a7a6){logger[_0x9ba2('0x1a')](_0x9ba2('0x89'),_0xd6a7a6);throw _0xd6a7a6;});})[_0x9ba2('0x15')](respondWithResult(_0x2d5ccc,0xc9))[_0x9ba2('0x1e')](handleError(_0x2d5ccc,null));};exports[_0x9ba2('0x8a')]=function(_0x581391,_0x261f56){var _0x1816ab=_0x581391[_0x9ba2('0x61')];var _0x26d105=[];if(_0x581391[_0x9ba2('0x2a')][_0x9ba2('0x28')]===_0x9ba2('0x2c'))throw new Error(_0x9ba2('0x83'));if(_[_0x9ba2('0x8b')](_0x1816ab,['role',_0x9ba2('0x2a')])&&_0x581391[_0x9ba2('0x2a')]['role']!=='admin'){throw new Error(_0x9ba2('0x8c'));}if(_[_0x9ba2('0x8b')](_0x1816ab,[_0x9ba2('0x28'),_0x9ba2('0x29')])&&_0x581391[_0x9ba2('0x2a')][_0x9ba2('0x28')]!=='admin'){throw new Error(_0x9ba2('0x8d'));}return licenseUtil['checkUserLimits'](_0x1816ab)[_0x9ba2('0x15')](function(){return validateUser(_0x1816ab[0x0]);})[_0x9ba2('0x15')](function(){for(var _0x226f4c=0x1;_0x226f4c<_0x1816ab[_0x9ba2('0x4c')];_0x226f4c++){var _0x1fba67=_0x1816ab[_0x226f4c-0x1][_0x9ba2('0x66')];if(!_0x1816ab[_0x226f4c][_0x9ba2('0x66')])_0x1816ab[_0x226f4c]['internal']=_0x1fba67+0x1;_0x26d105['push'](validateUser(_0x1816ab[_0x226f4c]));}return BPromise[_0x9ba2('0x50')](_0x26d105);})[_0x9ba2('0x15')](function(){_0x26d105=[];for(var _0x1ec7ec=0x0;_0x1ec7ec<_0x1816ab[_0x9ba2('0x4c')];_0x1ec7ec++){_0x26d105['push'](updateUser(_0x1816ab[_0x1ec7ec]));}return BPromise['all'](_0x26d105);})[_0x9ba2('0x15')](function(){return BPromise[_0x9ba2('0x8e')](_0x1816ab,function(_0x20ce57){return db[_0x9ba2('0x42')][_0x9ba2('0x82')](_0x20ce57,{'include':[{'model':db[_0x9ba2('0x74')],'as':'VoiceMail'}]})[_0x9ba2('0x15')](function(_0x4cda01){_0x20ce57['id']=_0x4cda01['id'];return _0x20ce57;});});})['then'](function(_0xef41a0){if(_0x581391[_0x9ba2('0x61')]['role']===_0x9ba2('0x2a'))return _0xef41a0;if(_0x581391['user'][_0x9ba2('0x28')]!=='user')return _0xef41a0;var _0x3440a5=_['some'](_0xef41a0,function(_0x5407ed){return _0x5407ed['role']===_0x9ba2('0x2c')||_0x5407ed['role']===_0x9ba2('0x2e');});if(!_0x3440a5)return _0xef41a0;return db[_0x9ba2('0x86')][_0x9ba2('0x49')]({'where':{'name':{'$or':[_0x9ba2('0x2b'),'Telephones']},'userProfileId':_0x581391[_0x9ba2('0x2a')]['userProfileId']},'raw':!![]})[_0x9ba2('0x15')](function(_0xbb6d1d){if(_['isEmpty'](_0xbb6d1d)||!_[_0x9ba2('0x8b')](_0xbb6d1d,['autoAssociation',0x0]))return _0xef41a0;_0x26d105=[];var _0x4a504e=_(_0xbb6d1d)[_0x9ba2('0x3a')](function(_0x5a5429){if(_0x5a5429[_0x9ba2('0x88')]===0x1)return;return _0x5a5429[_0x9ba2('0x33')]==='Agents'?'agent':_0x9ba2('0x2e');})[_0x9ba2('0x8f')]()[_0x9ba2('0x31')]();for(var _0x224525=0x0;_0x224525<_0xef41a0[_0x9ba2('0x4c')];_0x224525++){if(!_['includes'](_0x4a504e,_0xef41a0[_0x224525][_0x9ba2('0x28')]))return;var _0x44e672=_0xef41a0[_0x224525][_0x9ba2('0x28')]==='agent'?_0x9ba2('0x2b'):_0x9ba2('0x2d');_0x26d105[_0x9ba2('0x48')](db[_0x9ba2('0x34')][_0x9ba2('0x82')]({'name':_0xef41a0[_0x224525][_0x9ba2('0x33')],'resourceId':_0xef41a0[_0x224525]['id'],'type':_0x44e672,'sectionId':_[_0x9ba2('0x5b')](_0xbb6d1d,[_0x9ba2('0x33'),_0x44e672])['id']},{}));}return BPromise[_0x9ba2('0x50')](_0x26d105);});})['then'](respondWithResult(_0x261f56,0xc9))[_0x9ba2('0x1e')](handleError(_0x261f56,null));};exports[_0x9ba2('0x90')]=function(_0x35d49f,_0x48f5a1){if(_0x35d49f[_0x9ba2('0x61')]['id']){delete _0x35d49f[_0x9ba2('0x61')]['id'];}return db['User'][_0x9ba2('0x5b')]({'where':{'id':_0x35d49f['params']['id']}})[_0x9ba2('0x15')](function(_0x4c06df){if(!_0x4c06df)return null;if(_0x4c06df['id']===_0x35d49f[_0x9ba2('0x2a')]['id']){if(!_0x35d49f[_0x9ba2('0x61')]['oldPassword']||!_0x35d49f[_0x9ba2('0x61')][_0x9ba2('0x91')]){throw new db[(_0x9ba2('0x92'))][(_0x9ba2('0x93'))](_0x9ba2('0x94'));}if(!_0x4c06df['authenticate'](_0x35d49f[_0x9ba2('0x61')][_0x9ba2('0x95')])){throw new db[(_0x9ba2('0x92'))][(_0x9ba2('0x93'))]('Wrong\x20credentials');}if(_0x35d49f[_0x9ba2('0x61')][_0x9ba2('0x95')]===_0x35d49f[_0x9ba2('0x61')][_0x9ba2('0x91')]){throw new db[(_0x9ba2('0x92'))]['ValidationError'](_0x9ba2('0x96'));}}else if(_0x35d49f[_0x9ba2('0x2a')][_0x9ba2('0x28')]===_0x9ba2('0x29')){if(!_0x35d49f[_0x9ba2('0x61')][_0x9ba2('0x91')]){throw new db[(_0x9ba2('0x92'))][(_0x9ba2('0x93'))](_0x9ba2('0x97'));}}else if(_0x35d49f[_0x9ba2('0x2a')][_0x9ba2('0x28')]===_0x9ba2('0x2a')){if(!_0x35d49f[_0x9ba2('0x61')]['newPassword']){throw new db[(_0x9ba2('0x92'))][(_0x9ba2('0x93'))](_0x9ba2('0x97'));}if(_0x4c06df[_0x9ba2('0x28')]!==_0x9ba2('0x2c')){throw new db[(_0x9ba2('0x92'))][(_0x9ba2('0x93'))](_0x9ba2('0x83'));}}else{throw new db[(_0x9ba2('0x92'))][(_0x9ba2('0x93'))](_0x9ba2('0x83'));}return _0x4c06df;})[_0x9ba2('0x15')](handleEntityNotFound(_0x48f5a1,null))[_0x9ba2('0x15')](function(_0xfaeefd){return db[_0x9ba2('0x67')][_0x9ba2('0x98')]({'attributes':['id',_0x9ba2('0x69'),_0x9ba2('0x99'),'passwordHistoryLimit']})[_0x9ba2('0x15')](function(_0x33e476){if(_0x33e476[_0x9ba2('0x69')])authService[_0x9ba2('0x6a')](_0x35d49f[_0x9ba2('0x61')][_0x9ba2('0x91')]);if(!_0x33e476['enforcePasswordHistory']||!_0xfaeefd[_0x9ba2('0x9a')])return _0xfaeefd;authService[_0x9ba2('0x9b')](_0x35d49f['body'][_0x9ba2('0x91')],_0xfaeefd['previousPasswords'],_0x33e476['passwordHistoryLimit']);return _0xfaeefd;})[_0x9ba2('0x15')](saveUpdates({'password':_0x35d49f[_0x9ba2('0x61')][_0x9ba2('0x91')],'passwordResetAt':_0x35d49f[_0x9ba2('0x2a')]['id']==_0x35d49f[_0x9ba2('0x52')]['id']?moment():null,'previousPasswords':authService[_0x9ba2('0x9c')](_0x35d49f[_0x9ba2('0x61')][_0x9ba2('0x91')],_0xfaeefd[_0x9ba2('0x9a')])},null));})[_0x9ba2('0x15')](respondWithResult(_0x48f5a1,null))[_0x9ba2('0x1e')](handleError(_0x48f5a1,null));};exports[_0x9ba2('0x9d')]=function(_0x53a870,_0x3a0123){var _0x410c2b=_0x53a870[_0x9ba2('0x61')][_0x9ba2('0x9e')];return db['User'][_0x9ba2('0x5b')]({'where':{'id':_0x53a870['params']['id']},'attributes':['id','name','role',_0x9ba2('0x9f'),_0x9ba2('0xa0'),_0x9ba2('0xa1'),_0x9ba2('0xa2')]})['then'](handleEntityNotFound(_0x3a0123,null))[_0x9ba2('0x15')](function(_0x19c843){if(_0x19c843){if(!utils[_0x9ba2('0xa3')](_0x410c2b)){throw new db[(_0x9ba2('0x92'))][(_0x9ba2('0x93'))](_0x9ba2('0xa4'));}return _0x19c843[_0x9ba2('0xa5')+_[_0x9ba2('0xa6')](_0x410c2b[_0x9ba2('0xa7')]())+_0x9ba2('0xa8')](_0x53a870[_0x9ba2('0x61')][_0x9ba2('0x64')],{'penalty':_0x53a870[_0x9ba2('0x61')][_0x9ba2('0xa9')]||0x0})[_0x9ba2('0xaa')](function(_0x4a2172){for(var _0x4c96e3=0x0;_0x4c96e3<_0x53a870['body']['ids'][_0x9ba2('0x4c')];_0x4c96e3+=0x1){var _0x5ee9f3={'UserId':Number(_0x53a870[_0x9ba2('0x52')]['id'])};_0x5ee9f3[_[_0x9ba2('0xa6')](_0x410c2b['toLowerCase']())+_0x9ba2('0xab')]=Number(_0x53a870[_0x9ba2('0x61')][_0x9ba2('0x64')][_0x4c96e3]);socket[_0x9ba2('0xac')](_0x9ba2('0x2a')+_['capitalize'](_0x410c2b['toLowerCase']())+_0x9ba2('0xad'),_0x5ee9f3);}return _0x4a2172;})[_0x9ba2('0x15')](function(){if(_0x410c2b==='voice'){return db[_0x9ba2('0xae')]['findAll']({'where':{'id':_0x53a870[_0x9ba2('0x61')]['ids']||[]},'raw':!![],'attributes':['id',_0x9ba2('0x33')]});}})[_0x9ba2('0x15')](function(_0x5191df){var _0x427cc9=_0x19c843[_0x9ba2('0x27')]({'plain':!![]});var _0x501634=[];if(_0x410c2b==='voice'&&_0x427cc9[_0x9ba2('0x28')]===_0x9ba2('0x2c')&&_0x427cc9[_0x9ba2('0x9f')]){for(var _0x3f1383=0x0;_0x3f1383<_0x5191df['length'];_0x3f1383+=0x1){_0x501634['push']({'membername':_0x427cc9[_0x9ba2('0x33')],'UserId':_0x427cc9['id'],'queue_name':_0x5191df[_0x3f1383][_0x9ba2('0x33')],'VoiceQueueId':_0x5191df[_0x3f1383]['id'],'interface':_[_0x9ba2('0x6c')](_0x427cc9[_0x9ba2('0xa2')])?util[_0x9ba2('0xaf')](_0x9ba2('0xb0'),_0x427cc9['name']):_0x427cc9[_0x9ba2('0xa2')],'paused':_0x427cc9[_0x9ba2('0xa1')]||![],'penalty':_0x53a870['body'][_0x9ba2('0xa9')]||0x0});}return BPromise[_0x9ba2('0x8e')](_0x501634,function(_0x4302ec){return db[_0x9ba2('0xb1')][_0x9ba2('0xb2')](_0x4302ec);});}return _0x19c843;});}})[_0x9ba2('0x15')](respondWithStatusCode(_0x3a0123,null))[_0x9ba2('0x1e')](handleError(_0x3a0123,null));};exports[_0x9ba2('0xb3')]=function(_0x500247,_0x213307){var _0x4ad11d,_0x51122f;return db[_0x9ba2('0x42')][_0x9ba2('0x5b')]({'where':{'id':_0x500247[_0x9ba2('0x52')]['id']},'attributes':['id',_0x9ba2('0x33'),_0x9ba2('0x28')]})[_0x9ba2('0x15')](handleEntityNotFound(_0x213307,null))[_0x9ba2('0x15')](function(_0x54ad05){if(_0x54ad05){_0x4ad11d=_0x54ad05;if(!_0x500247[_0x9ba2('0x43')][_0x9ba2('0x9e')]||!utils[_0x9ba2('0xa3')](_0x500247[_0x9ba2('0x43')][_0x9ba2('0x9e')])){throw new db[(_0x9ba2('0x92'))]['ValidationError'](_0x9ba2('0xa4'));}return _0x54ad05[_0x9ba2('0xb4')+_[_0x9ba2('0xa6')](_0x500247[_0x9ba2('0x43')]['channel']['toLowerCase']())+'Queues'](_0x500247[_0x9ba2('0x43')]['ids']);}})[_0x9ba2('0x15')](function(_0xc5b77e){if(_[_0x9ba2('0xb5')](_0x500247['query'][_0x9ba2('0x64')])){for(var _0x133dd6=0x0;_0x133dd6<_0x500247[_0x9ba2('0x43')][_0x9ba2('0x64')]['length'];_0x133dd6+=0x1){_0x51122f={'UserId':Number(_0x500247[_0x9ba2('0x52')]['id'])};_0x51122f[_['capitalize'](_0x500247['query'][_0x9ba2('0x9e')]['toLowerCase']())+_0x9ba2('0xab')]=Number(_0x500247[_0x9ba2('0x43')][_0x9ba2('0x64')][_0x133dd6]);socket[_0x9ba2('0xac')]('user'+_[_0x9ba2('0xa6')](_0x500247[_0x9ba2('0x43')][_0x9ba2('0x9e')][_0x9ba2('0xa7')]())+_0x9ba2('0xb6'),_0x51122f);}}else{_0x51122f={'UserId':Number(_0x500247[_0x9ba2('0x52')]['id'])};_0x51122f[_[_0x9ba2('0xa6')](_0x500247['query'][_0x9ba2('0x9e')][_0x9ba2('0xa7')]())+'QueueId']=Number(_0x500247['query'][_0x9ba2('0x64')]);socket[_0x9ba2('0xac')]('user'+_['capitalize'](_0x500247[_0x9ba2('0x43')][_0x9ba2('0x9e')][_0x9ba2('0xa7')]())+'Queue:remove',_0x51122f);}return _0xc5b77e;})[_0x9ba2('0x15')](function(){if(_0x500247[_0x9ba2('0x43')][_0x9ba2('0x9e')]===_0x9ba2('0xb7')){return db[_0x9ba2('0xb1')]['destroy']({'where':{'UserId':_0x500247[_0x9ba2('0x52')]['id'],'VoiceQueueId':_0x500247[_0x9ba2('0x43')]['ids']},'individualHooks':!![]})[_0x9ba2('0x15')](function(){return _0x4ad11d;});}return _0x4ad11d;})[_0x9ba2('0x15')](respondWithStatusCode(_0x213307,null))[_0x9ba2('0x1e')](handleError(_0x213307,null));};exports[_0x9ba2('0xb8')]=function(_0x2bbb79,_0x23099e){_0x2bbb79[_0x9ba2('0x61')]['userpic']=_0x2bbb79[_0x9ba2('0xb9')][_0x9ba2('0xba')];return db[_0x9ba2('0x42')][_0x9ba2('0x5b')]({'where':{'id':_0x2bbb79[_0x9ba2('0x52')]['id']}})[_0x9ba2('0x15')](handleEntityNotFound(_0x23099e,null))[_0x9ba2('0x15')](saveUpdates(_0x2bbb79[_0x9ba2('0x61')],null))[_0x9ba2('0x15')](respondWithResult(_0x23099e,null))[_0x9ba2('0x1e')](handleError(_0x23099e,null));};exports[_0x9ba2('0xbb')]=function(_0x131a5a,_0xc6e7ac){var _0x19f8dd=path[_0x9ba2('0xbc')](config[_0x9ba2('0xbd')],_0x9ba2('0xbe'));return db[_0x9ba2('0x42')]['find']({'where':{'id':_0x131a5a[_0x9ba2('0x52')]['id']},'attributes':['id',_0x9ba2('0xbf')],'raw':!![]})[_0x9ba2('0x15')](handleEntityNotFound(_0xc6e7ac,null))[_0x9ba2('0x15')](function(_0x311260){if(_0x311260){if(_[_0x9ba2('0x6c')](_0x311260[_0x9ba2('0xbf')])){return _0xc6e7ac[_0x9ba2('0xc0')](_0x19f8dd);}else{if(!fs[_0x9ba2('0xc1')](path['join'](config[_0x9ba2('0xbd')],_0x9ba2('0xc2'),_0x311260[_0x9ba2('0xbf')]))){return _0xc6e7ac[_0x9ba2('0xc0')](_0x19f8dd);}return _0xc6e7ac[_0x9ba2('0xc0')](path[_0x9ba2('0xbc')](config[_0x9ba2('0xbd')],_0x9ba2('0xc2'),_0x311260['userpic']));}}})[_0x9ba2('0x1e')](handleError(_0xc6e7ac,null));};exports['getOpenTabs']=function(_0x276691,_0x3106df){return db['User'][_0x9ba2('0x5b')]({'where':{'id':_0x276691['params']['id']},'attributes':['id']})[_0x9ba2('0x15')](handleEntityNotFound(_0x3106df,null))[_0x9ba2('0x15')](function(_0x44a72e){var _0x40a06a=[];values=_0x44a72e[_0x9ba2('0x4d')];_0x40a06a[_0x9ba2('0x48')](get_open_tabs(_0x9ba2('0x5c'),_0x44a72e[_0x9ba2('0x4d')]));_0x40a06a['push'](get_open_tabs(_0x9ba2('0x5d'),_0x44a72e[_0x9ba2('0x4d')]));_0x40a06a[_0x9ba2('0x48')](get_open_tabs(_0x9ba2('0x5e'),_0x44a72e['dataValues']));_0x40a06a[_0x9ba2('0x48')](get_open_tabs(_0x9ba2('0x4f'),_0x44a72e[_0x9ba2('0x4d')]));_0x40a06a[_0x9ba2('0x48')](get_open_tabs(_0x9ba2('0x5f'),_0x44a72e[_0x9ba2('0x4d')]));_0x40a06a['push'](get_open_tabs(_0x9ba2('0x4e'),_0x44a72e[_0x9ba2('0x4d')]));return BPromise[_0x9ba2('0x50')](_0x40a06a);})[_0x9ba2('0x15')](function(_0x4a8b6a){if(_0x4a8b6a){var _0x22910c=_[_0x9ba2('0x3a')](values[_0x9ba2('0xc3')],function(_0x2aa44b){return{'channel':_0x9ba2('0xc4'),'id':_0x2aa44b['id'],'createdAt':_0x2aa44b[_0x9ba2('0xc5')]};});var _0x4326e0=_['map'](values[_0x9ba2('0xc6')],function(_0x4a1966){return{'channel':_0x9ba2('0xc7'),'id':_0x4a1966['id'],'createdAt':_0x4a1966[_0x9ba2('0xc5')]};});var _0x51b726=_[_0x9ba2('0x3a')](values[_0x9ba2('0xc8')],function(_0x22c238){return{'channel':_0x9ba2('0xc9'),'id':_0x22c238['id'],'createdAt':_0x22c238['createdAt']};});var _0x1953fc=_[_0x9ba2('0x3a')](values[_0x9ba2('0xca')],function(_0x593c5f){return{'channel':_0x9ba2('0xcb'),'id':_0x593c5f['id'],'createdAt':_0x593c5f['createdAt']};});var _0x39f012=_[_0x9ba2('0x3a')](values[_0x9ba2('0xcc')],function(_0x934573){return{'channel':_0x9ba2('0xcd'),'id':_0x934573['id'],'createdAt':_0x934573[_0x9ba2('0xc5')]};});var _0x23be06=_[_0x9ba2('0x3a')](values[_0x9ba2('0xce')],function(_0x1518f4){return{'channel':'WHATSAPP','id':_0x1518f4['id'],'createdAt':_0x1518f4['createdAt']};});var _0x3c11c0=_[_0x9ba2('0xcf')](_0x22910c,_0x4326e0,_0x51b726,_0x1953fc,_0x39f012,_0x23be06);var _0x459c17={'count':_0x3c11c0[_0x9ba2('0x4c')],'rows':_0x3c11c0};return _0x459c17;}else return null;})[_0x9ba2('0x15')](respondWithResult(_0x3106df,null))[_0x9ba2('0x1e')](handleError(_0x3106df,null));};exports[_0x9ba2('0xd0')]=function(_0x3f5ea3,_0x6751f8){var _0x4bd111={};var _0x5845ba={};var _0x40cca5;var _0x974167;return db[_0x9ba2('0x42')][_0x9ba2('0x98')]({'where':{'id':_0x3f5ea3[_0x9ba2('0x52')]['id']}})[_0x9ba2('0x15')](handleEntityNotFound(_0x6751f8,null))[_0x9ba2('0x15')](function(_0x392f86){if(_0x392f86){_0x40cca5=_0x392f86;_0x5845ba[_0x9ba2('0x53')]=_[_0x9ba2('0x55')](db['CmContact'][_0x9ba2('0x39')]);_0x5845ba['query']=_[_0x9ba2('0x55')](_0x3f5ea3['query']);_0x5845ba['filters']=_[_0x9ba2('0x57')](_0x5845ba['model'],_0x5845ba[_0x9ba2('0x43')]);_0x4bd111[_0x9ba2('0x47')]=_[_0x9ba2('0x57')](_0x5845ba['model'],qs['fields'](_0x3f5ea3[_0x9ba2('0x43')][_0x9ba2('0x58')]));_0x4bd111[_0x9ba2('0x47')]=_0x4bd111[_0x9ba2('0x47')][_0x9ba2('0x4c')]?_0x4bd111['attributes']:_0x5845ba[_0x9ba2('0x53')];_0x4bd111[_0x9ba2('0xd1')]=qs[_0x9ba2('0xd2')](_0x3f5ea3['query'][_0x9ba2('0xd2')]);_0x4bd111[_0x9ba2('0x41')]=qs['filters'](_[_0x9ba2('0xd3')](_0x3f5ea3[_0x9ba2('0x43')],_0x5845ba[_0x9ba2('0x56')]));if(_0x3f5ea3['query'][_0x9ba2('0x2f')]){_0x4bd111[_0x9ba2('0x41')]=_['merge'](_0x4bd111[_0x9ba2('0x41')],{'$or':_[_0x9ba2('0x3a')](_0x4bd111[_0x9ba2('0x47')],function(_0xa85158){var _0x4b8fae={};_0x4b8fae[_0xa85158]={'$like':'%'+_0x3f5ea3[_0x9ba2('0x43')][_0x9ba2('0x2f')]+'%'};return _0x4b8fae;})});}_0x4bd111=_[_0x9ba2('0x59')]({},_0x4bd111,_0x3f5ea3[_0x9ba2('0x5a')]);return _0x40cca5[_0x9ba2('0xd0')](_0x4bd111);}})['then'](function(_0xdb660a){if(_0xdb660a){_0x974167=_0xdb660a[_0x9ba2('0x4c')];if(_0x3f5ea3['query'][_0x9ba2('0xd4')]('includeAll')){_0x4bd111[_0x9ba2('0x45')]=[{'model':db[_0x9ba2('0xd5')],'as':'List','required':![]},{'model':db[_0x9ba2('0xd6')],'as':_0x9ba2('0xd7'),'attributes':['id',_0x9ba2('0x33'),_0x9ba2('0xd8')],'where':_0x3f5ea3[_0x9ba2('0x43')]['tag']?{'id':_0x3f5ea3[_0x9ba2('0x43')]['tag']}:undefined,'required':_0x3f5ea3[_0x9ba2('0x43')][_0x9ba2('0xd9')]?!![]:![]}];}if(!_0x3f5ea3[_0x9ba2('0x43')]['hasOwnProperty'](_0x9ba2('0xda'))){_0x4bd111['limit']=qs[_0x9ba2('0x24')](_0x3f5ea3[_0x9ba2('0x43')]['limit']);_0x4bd111[_0x9ba2('0x23')]=qs['offset'](_0x3f5ea3['query'][_0x9ba2('0x23')]);}return _0x40cca5[_0x9ba2('0xd0')](_0x4bd111);}})[_0x9ba2('0x15')](function(_0x5b0f40){if(_0x5b0f40){return _0x5b0f40?{'count':_0x974167,'rows':_0x5b0f40}:null;}})[_0x9ba2('0x15')](respondWithResult(_0x6751f8,null))[_0x9ba2('0x1e')](handleError(_0x6751f8,null));};exports[_0x9ba2('0xdb')]=function(_0x4cb268,_0x435ab4){var _0x123897;var _0x15befd={};var _0x2ba0fd;return db[_0x9ba2('0x42')][_0x9ba2('0x98')]({'where':{'id':_0x4cb268['params']['id']},'attributes':['id',_0x9ba2('0x33'),'role']})[_0x9ba2('0x15')](handleEntityNotFound(_0x435ab4,null))[_0x9ba2('0x15')](function(_0x54671c){if(!utils[_0x9ba2('0xa3')](_0x4cb268[_0x9ba2('0x43')]['channel'])){throw new db['Sequelize'][(_0x9ba2('0x93'))](_0x9ba2('0xa4'));}_0x123897=_0x54671c;var _0x5cd552={};_0x5cd552[_0x9ba2('0x53')]=_[_0x9ba2('0x55')](db[_[_0x9ba2('0xa6')](_0x4cb268[_0x9ba2('0x43')][_0x9ba2('0x9e')])+_0x9ba2('0xdc')]['rawAttributes']);_0x5cd552['query']=_['keys'](_0x4cb268[_0x9ba2('0x43')]);_0x5cd552[_0x9ba2('0x56')]=_[_0x9ba2('0x57')](_0x5cd552[_0x9ba2('0x53')],_0x5cd552[_0x9ba2('0x43')]);_0x15befd[_0x9ba2('0x47')]=_[_0x9ba2('0x57')](_0x5cd552['model'],qs[_0x9ba2('0x58')](_0x4cb268[_0x9ba2('0x43')]['fields']));_0x15befd[_0x9ba2('0x47')]=_0x15befd[_0x9ba2('0x47')]['length']?_0x15befd['attributes']:_0x5cd552[_0x9ba2('0x53')];_0x15befd[_0x9ba2('0xd1')]=qs[_0x9ba2('0xd2')](_0x4cb268[_0x9ba2('0x43')][_0x9ba2('0xd2')]);_0x15befd[_0x9ba2('0x41')]=qs[_0x9ba2('0x56')](_['pick'](_0x4cb268['query'],_0x5cd552[_0x9ba2('0x56')]));if(_0x4cb268['query'][_0x9ba2('0x2f')]){_0x15befd[_0x9ba2('0x41')]=_[_0x9ba2('0x59')](_0x15befd[_0x9ba2('0x41')],{'$or':_[_0x9ba2('0x3a')](_0x15befd[_0x9ba2('0x47')],function(_0x229040){var _0x4ac88b={};_0x4ac88b[_0x229040]={'$like':'%'+_0x4cb268[_0x9ba2('0x43')][_0x9ba2('0x2f')]+'%'};return _0x4ac88b;})});}_0x15befd=_[_0x9ba2('0x59')]({},_0x15befd,_0x4cb268[_0x9ba2('0x5a')]);switch(_0x123897[_0x9ba2('0x28')]){case'admin':return db[_[_0x9ba2('0xa6')](_0x4cb268[_0x9ba2('0x43')][_0x9ba2('0x9e')])+'Queue'][_0x9ba2('0x49')](_0x15befd);case'user':case _0x9ba2('0x2c'):return _0x123897[_0x9ba2('0x27')+_[_0x9ba2('0xa6')](_0x4cb268[_0x9ba2('0x43')][_0x9ba2('0x9e')])+_0x9ba2('0xa8')](_0x15befd);default:throw new db['Sequelize'][(_0x9ba2('0x93'))](_0x9ba2('0xdd'));}})[_0x9ba2('0x15')](function(_0x24c9eb){_0x2ba0fd=_0x24c9eb[_0x9ba2('0x4c')];if(!_0x4cb268[_0x9ba2('0x43')][_0x9ba2('0xd4')](_0x9ba2('0xda'))){_0x15befd[_0x9ba2('0x24')]=qs[_0x9ba2('0x24')](_0x4cb268[_0x9ba2('0x43')][_0x9ba2('0x24')]);_0x15befd['offset']=qs[_0x9ba2('0x23')](_0x4cb268[_0x9ba2('0x43')]['offset']);}switch(_0x123897[_0x9ba2('0x28')]){case _0x9ba2('0x29'):return db[_['capitalize'](_0x4cb268[_0x9ba2('0x43')][_0x9ba2('0x9e')])+_0x9ba2('0xdc')][_0x9ba2('0x49')](_0x15befd);case _0x9ba2('0x2a'):case _0x9ba2('0x2c'):return _0x123897['get'+_[_0x9ba2('0xa6')](_0x4cb268['query'][_0x9ba2('0x9e')])+_0x9ba2('0xa8')](_0x15befd);}})[_0x9ba2('0x15')](function(_0xbdc9cd){return{'count':_0x2ba0fd,'rows':_0xbdc9cd};})['then'](respondWithResult(_0x435ab4,null))[_0x9ba2('0x1e')](handleError(_0x435ab4,null));};exports[_0x9ba2('0xde')]=function(_0x4a1dcc,_0x340922){var _0x5e6247={};var _0x4f7083={};var _0x67b147;var _0x54a6d9;return db['User']['findOne']({'where':{'id':_0x4a1dcc[_0x9ba2('0x52')]['id']}})[_0x9ba2('0x15')](handleEntityNotFound(_0x340922,null))['then'](function(_0x271171){if(_0x271171){_0x67b147=_0x271171;_0x4f7083['model']=_['keys'](db['UserVoiceQueueRt'][_0x9ba2('0x39')]);_0x4f7083['query']=_[_0x9ba2('0x55')](_0x4a1dcc[_0x9ba2('0x43')]);_0x4f7083[_0x9ba2('0x56')]=_[_0x9ba2('0x57')](_0x4f7083['model'],_0x4f7083[_0x9ba2('0x43')]);_0x5e6247[_0x9ba2('0x47')]=_['intersection'](_0x4f7083[_0x9ba2('0x53')],qs[_0x9ba2('0x58')](_0x4a1dcc[_0x9ba2('0x43')][_0x9ba2('0x58')]));_0x5e6247['attributes']=_0x5e6247[_0x9ba2('0x47')][_0x9ba2('0x4c')]?_0x5e6247['attributes']:_0x4f7083[_0x9ba2('0x53')];_0x5e6247['order']=qs[_0x9ba2('0xd2')](_0x4a1dcc[_0x9ba2('0x43')]['sort']);_0x5e6247[_0x9ba2('0x41')]=qs[_0x9ba2('0x56')](_[_0x9ba2('0xd3')](_0x4a1dcc[_0x9ba2('0x43')],_0x4f7083[_0x9ba2('0x56')]));if(_0x4a1dcc[_0x9ba2('0x43')][_0x9ba2('0x2f')]){_0x5e6247[_0x9ba2('0x41')]=_[_0x9ba2('0x59')](_0x5e6247[_0x9ba2('0x41')],{'$or':_[_0x9ba2('0x3a')](_0x5e6247[_0x9ba2('0x47')],function(_0x836001){var _0x3c4b37={};_0x3c4b37[_0x836001]={'$like':'%'+_0x4a1dcc['query'][_0x9ba2('0x2f')]+'%'};return _0x3c4b37;})});}_0x5e6247=_[_0x9ba2('0x59')]({},_0x5e6247,_0x4a1dcc[_0x9ba2('0x5a')]);return _0x67b147[_0x9ba2('0xde')](_0x5e6247);}})[_0x9ba2('0x15')](function(_0x14aed6){if(_0x14aed6){_0x54a6d9=_0x14aed6[_0x9ba2('0x4c')];if(!_0x4a1dcc[_0x9ba2('0x43')]['hasOwnProperty']('nolimit')){_0x5e6247[_0x9ba2('0x24')]=qs[_0x9ba2('0x24')](_0x4a1dcc[_0x9ba2('0x43')][_0x9ba2('0x24')]);_0x5e6247[_0x9ba2('0x23')]=qs[_0x9ba2('0x23')](_0x4a1dcc[_0x9ba2('0x43')]['offset']);}return _0x67b147['getVoiceQueuesRt'](_0x5e6247);}})[_0x9ba2('0x15')](function(_0x6bd818){if(_0x6bd818){return _0x6bd818?{'count':_0x54a6d9,'rows':_0x6bd818}:null;}})[_0x9ba2('0x15')](respondWithResult(_0x340922,null))[_0x9ba2('0x1e')](handleError(_0x340922,null));};exports[_0x9ba2('0xdf')]=function(_0x5e75e5,_0xb35888){var _0x5e3bac={};var _0x5bdc01={};var _0x434200;var _0x1eb918;return db[_0x9ba2('0x42')]['findOne']({'where':{'id':_0x5e75e5['params']['id']}})['then'](handleEntityNotFound(_0xb35888,null))[_0x9ba2('0x15')](function(_0x144979){if(_0x144979){_0x434200=_0x144979;_0x5bdc01['model']=_[_0x9ba2('0x55')](db[_0x9ba2('0xe0')][_0x9ba2('0x39')]);_0x5bdc01[_0x9ba2('0x43')]=_[_0x9ba2('0x55')](_0x5e75e5['query']);_0x5bdc01[_0x9ba2('0x56')]=_[_0x9ba2('0x57')](_0x5bdc01[_0x9ba2('0x53')],_0x5bdc01[_0x9ba2('0x43')]);_0x5e3bac[_0x9ba2('0x47')]=_['intersection'](_0x5bdc01['model'],qs[_0x9ba2('0x58')](_0x5e75e5[_0x9ba2('0x43')][_0x9ba2('0x58')]));_0x5e3bac[_0x9ba2('0x47')]=_0x5e3bac[_0x9ba2('0x47')][_0x9ba2('0x4c')]?_0x5e3bac[_0x9ba2('0x47')]:_0x5bdc01[_0x9ba2('0x53')];_0x5e3bac['order']=qs['sort'](_0x5e75e5[_0x9ba2('0x43')][_0x9ba2('0xd2')]);_0x5e3bac[_0x9ba2('0x41')]=qs[_0x9ba2('0x56')](_[_0x9ba2('0xd3')](_0x5e75e5[_0x9ba2('0x43')],_0x5bdc01[_0x9ba2('0x56')]));if(_0x5e75e5['query'][_0x9ba2('0x2f')]){_0x5e3bac['where']=_[_0x9ba2('0x59')](_0x5e3bac['where'],{'$or':_['map'](_0x5e3bac[_0x9ba2('0x47')],function(_0x2db2f0){var _0x58aacf={};_0x58aacf[_0x2db2f0]={'$like':'%'+_0x5e75e5['query'][_0x9ba2('0x2f')]+'%'};return _0x58aacf;})});}_0x5e3bac=_[_0x9ba2('0x59')]({},_0x5e3bac,_0x5e75e5['options']);return _0x434200[_0x9ba2('0xdf')](_0x5e3bac);}})[_0x9ba2('0x15')](function(_0x281bea){if(_0x281bea){_0x1eb918=_0x281bea[_0x9ba2('0x4c')];if(!_0x5e75e5[_0x9ba2('0x43')]['hasOwnProperty'](_0x9ba2('0xda'))){_0x5e3bac[_0x9ba2('0x24')]=qs['limit'](_0x5e75e5[_0x9ba2('0x43')][_0x9ba2('0x24')]);_0x5e3bac[_0x9ba2('0x23')]=qs[_0x9ba2('0x23')](_0x5e75e5[_0x9ba2('0x43')][_0x9ba2('0x23')]);}return _0x434200[_0x9ba2('0xdf')](_0x5e3bac);}})[_0x9ba2('0x15')](function(_0x4028db){if(_0x4028db){return _0x4028db?{'count':_0x1eb918,'rows':_0x4028db}:null;}})[_0x9ba2('0x15')](respondWithResult(_0xb35888,null))[_0x9ba2('0x1e')](handleError(_0xb35888,null));};exports[_0x9ba2('0xe1')]=function(_0x9cea9a,_0xbee304){var _0x1a9b6b={'raw':!![],'where':{}};var _0x163d5f={};var _0x43f52d={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x9cea9a[_0x9ba2('0x52')]['id']}})[_0x9ba2('0x15')](handleEntityNotFound(_0xbee304,null))[_0x9ba2('0x15')](function(_0x2424f4){if(_0x2424f4){_0x163d5f[_0x9ba2('0x53')]=_[_0x9ba2('0x55')](db[_0x9ba2('0xe2')][_0x9ba2('0x39')]);_0x163d5f[_0x9ba2('0x43')]=_[_0x9ba2('0x55')](_0x9cea9a[_0x9ba2('0x43')]);_0x163d5f[_0x9ba2('0x56')]=_[_0x9ba2('0x57')](_0x163d5f[_0x9ba2('0x53')],_0x163d5f['query']);_0x1a9b6b[_0x9ba2('0x47')]=_[_0x9ba2('0x57')](_0x163d5f[_0x9ba2('0x53')],qs['fields'](_0x9cea9a[_0x9ba2('0x43')]['fields']));_0x1a9b6b[_0x9ba2('0x47')]=_0x1a9b6b['attributes'][_0x9ba2('0x4c')]?_0x1a9b6b[_0x9ba2('0x47')]:_0x163d5f[_0x9ba2('0x53')];if(!_0x9cea9a[_0x9ba2('0x43')][_0x9ba2('0xd4')](_0x9ba2('0xda'))){_0x1a9b6b[_0x9ba2('0x24')]=qs['limit'](_0x9cea9a[_0x9ba2('0x43')]['limit']);_0x1a9b6b[_0x9ba2('0x23')]=qs[_0x9ba2('0x23')](_0x9cea9a[_0x9ba2('0x43')][_0x9ba2('0x23')]);}_0x1a9b6b['order']=qs[_0x9ba2('0xd2')](_0x9cea9a[_0x9ba2('0x43')]['sort']);_0x1a9b6b['where']=qs['filters'](_[_0x9ba2('0xd3')](_0x9cea9a[_0x9ba2('0x43')],_0x163d5f[_0x9ba2('0x56')]));_0x1a9b6b[_0x9ba2('0x41')]['UserId']=_0x2424f4['id'];if(_0x9cea9a['query'][_0x9ba2('0x2f')]){_0x1a9b6b[_0x9ba2('0x41')]=_[_0x9ba2('0x59')](_0x1a9b6b[_0x9ba2('0x41')],{'$or':_[_0x9ba2('0x3a')](_0x1a9b6b[_0x9ba2('0x47')],function(_0x24f285){var _0x2e0269={};_0x2e0269[_0x24f285]={'$like':'%'+_0x9cea9a['query'][_0x9ba2('0x2f')]+'%'};return _0x2e0269;})});}_0x1a9b6b=_[_0x9ba2('0x59')]({},_0x1a9b6b,_0x9cea9a[_0x9ba2('0x5a')]);return db[_0x9ba2('0xe2')][_0x9ba2('0x22')]({'where':_0x1a9b6b[_0x9ba2('0x41')]})[_0x9ba2('0x15')](function(_0x227dc6){_0x43f52d[_0x9ba2('0x22')]=_0x227dc6;if(_0x9cea9a['query'][_0x9ba2('0x44')]){_0x1a9b6b[_0x9ba2('0x45')]=[{'all':!![]}];}return db[_0x9ba2('0xe2')][_0x9ba2('0x49')](_0x1a9b6b);})['then'](function(_0x4ce4d0){_0x43f52d[_0x9ba2('0x4b')]=_0x4ce4d0;return _0x43f52d;});}})[_0x9ba2('0x15')](respondWithFilteredResult(_0xbee304,_0x1a9b6b))[_0x9ba2('0x1e')](handleError(_0xbee304,null));};exports[_0x9ba2('0xe3')]=function(_0x11bbda,_0x33a403){var _0x553d2e={'raw':!![],'where':{}};var _0x3662d8={};var _0x551e2d={'count':0x0,'rows':[]};return db['User'][_0x9ba2('0x98')]({'where':{'id':_0x11bbda['params']['id']}})[_0x9ba2('0x15')](handleEntityNotFound(_0x33a403,null))['then'](function(_0x5b1869){if(_0x5b1869){_0x3662d8[_0x9ba2('0x53')]=_[_0x9ba2('0x55')](db['ScreenRecording'][_0x9ba2('0x39')]);_0x3662d8['query']=_['keys'](_0x11bbda['query']);_0x3662d8[_0x9ba2('0x56')]=_[_0x9ba2('0x57')](_0x3662d8[_0x9ba2('0x53')],_0x3662d8[_0x9ba2('0x43')]);_0x553d2e[_0x9ba2('0x47')]=_[_0x9ba2('0x57')](_0x3662d8[_0x9ba2('0x53')],qs['fields'](_0x11bbda[_0x9ba2('0x43')][_0x9ba2('0x58')]));_0x553d2e['attributes']=_0x553d2e[_0x9ba2('0x47')]['length']?_0x553d2e[_0x9ba2('0x47')]:_0x3662d8[_0x9ba2('0x53')];if(!_0x11bbda['query'][_0x9ba2('0xd4')](_0x9ba2('0xda'))){_0x553d2e[_0x9ba2('0x24')]=qs[_0x9ba2('0x24')](_0x11bbda['query'][_0x9ba2('0x24')]);_0x553d2e['offset']=qs[_0x9ba2('0x23')](_0x11bbda[_0x9ba2('0x43')]['offset']);}_0x553d2e['order']=qs[_0x9ba2('0xd2')](_0x11bbda[_0x9ba2('0x43')]['sort']);_0x553d2e['where']=qs[_0x9ba2('0x56')](_[_0x9ba2('0xd3')](_0x11bbda['query'],_0x3662d8['filters']));_0x553d2e[_0x9ba2('0x41')]['UserId']=_0x5b1869['id'];if(_0x11bbda['query'][_0x9ba2('0x2f')]){_0x553d2e[_0x9ba2('0x41')]=_[_0x9ba2('0x59')](_0x553d2e[_0x9ba2('0x41')],{'$or':_[_0x9ba2('0x3a')](_0x553d2e['attributes'],function(_0x5bb377){var _0x107511={};_0x107511[_0x5bb377]={'$like':'%'+_0x11bbda[_0x9ba2('0x43')]['filter']+'%'};return _0x107511;})});}_0x553d2e=_['merge']({},_0x553d2e,_0x11bbda[_0x9ba2('0x5a')]);return db['ScreenRecording'][_0x9ba2('0x22')]({'where':_0x553d2e['where']})[_0x9ba2('0x15')](function(_0x3c2a7c){_0x551e2d[_0x9ba2('0x22')]=_0x3c2a7c;if(_0x11bbda['query'][_0x9ba2('0x44')]){_0x553d2e[_0x9ba2('0x45')]=[{'all':!![]}];}return db[_0x9ba2('0xe4')]['findAll'](_0x553d2e);})[_0x9ba2('0x15')](function(_0x47258a){_0x551e2d[_0x9ba2('0x4b')]=_0x47258a;return _0x551e2d;});}})['then'](respondWithFilteredResult(_0x33a403,_0x553d2e))['catch'](handleError(_0x33a403,null));};exports[_0x9ba2('0xe5')]=function(_0x15febc,_0x170214){var _0x5c933b={};var _0x270967={};var _0x1908f8;var _0x3debc7;return db[_0x9ba2('0x42')][_0x9ba2('0x98')]({'where':{'id':_0x15febc[_0x9ba2('0x52')]['id']}})[_0x9ba2('0x15')](handleEntityNotFound(_0x170214,null))[_0x9ba2('0x15')](function(_0x5f3ad2){if(_0x5f3ad2){_0x1908f8=_0x5f3ad2;_0x270967['model']=_[_0x9ba2('0x55')](db[_0x9ba2('0xe6')][_0x9ba2('0x39')]);_0x270967[_0x9ba2('0x43')]=_[_0x9ba2('0x55')](_0x15febc[_0x9ba2('0x43')]);_0x270967[_0x9ba2('0x56')]=_[_0x9ba2('0x57')](_0x270967[_0x9ba2('0x53')],_0x270967[_0x9ba2('0x43')]);_0x5c933b[_0x9ba2('0x47')]=_[_0x9ba2('0x57')](_0x270967[_0x9ba2('0x53')],qs[_0x9ba2('0x58')](_0x15febc[_0x9ba2('0x43')][_0x9ba2('0x58')]));_0x5c933b['attributes']=_0x5c933b['attributes']['length']?_0x5c933b[_0x9ba2('0x47')]:_0x270967[_0x9ba2('0x53')];_0x5c933b[_0x9ba2('0xd1')]=qs[_0x9ba2('0xd2')](_0x15febc['query'][_0x9ba2('0xd2')]);_0x5c933b[_0x9ba2('0x41')]=qs[_0x9ba2('0x56')](_['pick'](_0x15febc[_0x9ba2('0x43')],_0x270967['filters']));if(_0x15febc[_0x9ba2('0x43')][_0x9ba2('0x2f')]){_0x5c933b[_0x9ba2('0x41')]=_['merge'](_0x5c933b['where'],{'$or':_[_0x9ba2('0x3a')](_0x5c933b[_0x9ba2('0x47')],function(_0x31c062){var _0x49d599={};_0x49d599[_0x31c062]={'$like':'%'+_0x15febc[_0x9ba2('0x43')][_0x9ba2('0x2f')]+'%'};return _0x49d599;})});}_0x5c933b=_['merge']({},_0x5c933b,_0x15febc['options']);return _0x1908f8[_0x9ba2('0xe5')](_0x5c933b);}})[_0x9ba2('0x15')](function(_0x282318){if(_0x282318){_0x3debc7=_0x282318[_0x9ba2('0x4c')];if(!_0x15febc['query'][_0x9ba2('0xd4')](_0x9ba2('0xda'))){_0x5c933b['limit']=qs[_0x9ba2('0x24')](_0x15febc[_0x9ba2('0x43')]['limit']);_0x5c933b['offset']=qs[_0x9ba2('0x23')](_0x15febc[_0x9ba2('0x43')][_0x9ba2('0x23')]);}return _0x1908f8['getChatInteractions'](_0x5c933b);}})[_0x9ba2('0x15')](function(_0x3d41ac){if(_0x3d41ac){return _0x3d41ac?{'count':_0x3debc7,'rows':_0x3d41ac}:null;}})[_0x9ba2('0x15')](respondWithResult(_0x170214,null))[_0x9ba2('0x1e')](handleError(_0x170214,null));};exports[_0x9ba2('0xe7')]=function(_0x276eef,_0x40da8a){var _0x55f982={};var _0x29d11d={};var _0x357657;var _0x21a4cf;return db['User'][_0x9ba2('0x98')]({'where':{'id':_0x276eef['params']['id']}})[_0x9ba2('0x15')](handleEntityNotFound(_0x40da8a,null))[_0x9ba2('0x15')](function(_0x47b1b6){if(_0x47b1b6){_0x357657=_0x47b1b6;_0x29d11d['model']=_['keys'](db[_0x9ba2('0xe8')][_0x9ba2('0x39')]);_0x29d11d['query']=_['keys'](_0x276eef['query']);_0x29d11d['filters']=_[_0x9ba2('0x57')](_0x29d11d[_0x9ba2('0x53')],_0x29d11d[_0x9ba2('0x43')]);_0x55f982['attributes']=_[_0x9ba2('0x57')](_0x29d11d[_0x9ba2('0x53')],qs[_0x9ba2('0x58')](_0x276eef[_0x9ba2('0x43')][_0x9ba2('0x58')]));_0x55f982[_0x9ba2('0x47')]=_0x55f982[_0x9ba2('0x47')]['length']?_0x55f982[_0x9ba2('0x47')]:_0x29d11d[_0x9ba2('0x53')];_0x55f982[_0x9ba2('0xd1')]=qs[_0x9ba2('0xd2')](_0x276eef[_0x9ba2('0x43')]['sort']);_0x55f982['where']=qs[_0x9ba2('0x56')](_[_0x9ba2('0xd3')](_0x276eef[_0x9ba2('0x43')],_0x29d11d[_0x9ba2('0x56')]));if(_0x276eef[_0x9ba2('0x43')][_0x9ba2('0x2f')]){_0x55f982[_0x9ba2('0x41')]=_[_0x9ba2('0x59')](_0x55f982[_0x9ba2('0x41')],{'$or':_[_0x9ba2('0x3a')](_0x55f982[_0x9ba2('0x47')],function(_0x29e8ff){var _0x13a288={};_0x13a288[_0x29e8ff]={'$like':'%'+_0x276eef[_0x9ba2('0x43')][_0x9ba2('0x2f')]+'%'};return _0x13a288;})});}_0x55f982=_[_0x9ba2('0x59')]({},_0x55f982,_0x276eef[_0x9ba2('0x5a')]);return _0x357657['getOpenchannelInteractions'](_0x55f982);}})[_0x9ba2('0x15')](function(_0x45fb85){if(_0x45fb85){_0x21a4cf=_0x45fb85[_0x9ba2('0x4c')];if(!_0x276eef[_0x9ba2('0x43')][_0x9ba2('0xd4')](_0x9ba2('0xda'))){_0x55f982['limit']=qs[_0x9ba2('0x24')](_0x276eef[_0x9ba2('0x43')]['limit']);_0x55f982['offset']=qs[_0x9ba2('0x23')](_0x276eef[_0x9ba2('0x43')][_0x9ba2('0x23')]);}return _0x357657[_0x9ba2('0xe7')](_0x55f982);}})[_0x9ba2('0x15')](function(_0x20b7c8){if(_0x20b7c8){return _0x20b7c8?{'count':_0x21a4cf,'rows':_0x20b7c8}:null;}})[_0x9ba2('0x15')](respondWithResult(_0x40da8a,null))['catch'](handleError(_0x40da8a,null));};exports[_0x9ba2('0xe9')]=function(_0x5f76b,_0x55b08d){var _0x1d2ff8={'raw':!![],'where':{}};var _0x31e0c1={};var _0x83c1db={'count':0x0,'rows':[]};return db[_0x9ba2('0x42')][_0x9ba2('0x98')]({'where':{'id':_0x5f76b[_0x9ba2('0x52')]['id']}})['then'](handleEntityNotFound(_0x55b08d,null))['then'](function(_0x54ba54){if(_0x54ba54){_0x31e0c1[_0x9ba2('0x53')]=_['keys'](db['MailInteraction']['rawAttributes']);_0x31e0c1[_0x9ba2('0x43')]=_['keys'](_0x5f76b[_0x9ba2('0x43')]);_0x31e0c1['filters']=_['intersection'](_0x31e0c1[_0x9ba2('0x53')],_0x31e0c1[_0x9ba2('0x43')]);_0x1d2ff8[_0x9ba2('0x47')]=_[_0x9ba2('0x57')](_0x31e0c1['model'],qs['fields'](_0x5f76b['query'][_0x9ba2('0x58')]));_0x1d2ff8[_0x9ba2('0x47')]=_0x1d2ff8[_0x9ba2('0x47')][_0x9ba2('0x4c')]?_0x1d2ff8['attributes']:_0x31e0c1[_0x9ba2('0x53')];if(!_0x5f76b['query'][_0x9ba2('0xd4')](_0x9ba2('0xda'))){_0x1d2ff8[_0x9ba2('0x24')]=qs[_0x9ba2('0x24')](_0x5f76b[_0x9ba2('0x43')][_0x9ba2('0x24')]);_0x1d2ff8[_0x9ba2('0x23')]=qs[_0x9ba2('0x23')](_0x5f76b[_0x9ba2('0x43')][_0x9ba2('0x23')]);}_0x1d2ff8['order']=qs['sort'](_0x5f76b[_0x9ba2('0x43')][_0x9ba2('0xd2')]);_0x1d2ff8[_0x9ba2('0x41')]=qs['filters'](_['pick'](_0x5f76b[_0x9ba2('0x43')],_0x31e0c1[_0x9ba2('0x56')]));_0x1d2ff8['where']['UserId']=_0x54ba54['id'];if(_0x5f76b[_0x9ba2('0x43')][_0x9ba2('0x2f')]){_0x1d2ff8[_0x9ba2('0x41')]=_[_0x9ba2('0x59')](_0x1d2ff8[_0x9ba2('0x41')],{'$or':_[_0x9ba2('0x3a')](_0x1d2ff8[_0x9ba2('0x47')],function(_0x34c01b){var _0x2e77df={};_0x2e77df[_0x34c01b]={'$like':'%'+_0x5f76b[_0x9ba2('0x43')][_0x9ba2('0x2f')]+'%'};return _0x2e77df;})});}_0x1d2ff8=_[_0x9ba2('0x59')]({},_0x1d2ff8,_0x5f76b[_0x9ba2('0x5a')]);return db[_0x9ba2('0xea')][_0x9ba2('0x22')]({'where':_0x1d2ff8['where']})['then'](function(_0x361ba0){_0x83c1db[_0x9ba2('0x22')]=_0x361ba0;if(_0x5f76b[_0x9ba2('0x43')]['includeAll']){_0x1d2ff8['include']=[{'all':!![]}];}return db[_0x9ba2('0xea')][_0x9ba2('0x49')](_0x1d2ff8);})[_0x9ba2('0x15')](function(_0x427aaf){_0x83c1db[_0x9ba2('0x4b')]=_0x427aaf;return _0x83c1db;});}})[_0x9ba2('0x15')](respondWithFilteredResult(_0x55b08d,_0x1d2ff8))[_0x9ba2('0x1e')](handleError(_0x55b08d,null));};exports['getSmsInteractions']=function(_0xad89f0,_0x301914){var _0x40935c={};var _0x1bcfb4={};var _0x54ca6f;var _0x104b31;return db['User'][_0x9ba2('0x98')]({'where':{'id':_0xad89f0[_0x9ba2('0x52')]['id']}})['then'](handleEntityNotFound(_0x301914,null))['then'](function(_0x2d5931){if(_0x2d5931){_0x54ca6f=_0x2d5931;_0x1bcfb4['model']=_[_0x9ba2('0x55')](db[_0x9ba2('0xeb')][_0x9ba2('0x39')]);_0x1bcfb4['query']=_[_0x9ba2('0x55')](_0xad89f0[_0x9ba2('0x43')]);_0x1bcfb4[_0x9ba2('0x56')]=_[_0x9ba2('0x57')](_0x1bcfb4[_0x9ba2('0x53')],_0x1bcfb4[_0x9ba2('0x43')]);_0x40935c[_0x9ba2('0x47')]=_[_0x9ba2('0x57')](_0x1bcfb4[_0x9ba2('0x53')],qs['fields'](_0xad89f0[_0x9ba2('0x43')]['fields']));_0x40935c[_0x9ba2('0x47')]=_0x40935c['attributes'][_0x9ba2('0x4c')]?_0x40935c['attributes']:_0x1bcfb4['model'];_0x40935c[_0x9ba2('0xd1')]=qs[_0x9ba2('0xd2')](_0xad89f0[_0x9ba2('0x43')]['sort']);_0x40935c[_0x9ba2('0x41')]=qs[_0x9ba2('0x56')](_[_0x9ba2('0xd3')](_0xad89f0[_0x9ba2('0x43')],_0x1bcfb4[_0x9ba2('0x56')]));if(_0xad89f0[_0x9ba2('0x43')]['filter']){_0x40935c[_0x9ba2('0x41')]=_[_0x9ba2('0x59')](_0x40935c[_0x9ba2('0x41')],{'$or':_[_0x9ba2('0x3a')](_0x40935c['attributes'],function(_0x1187c8){var _0x1edb3e={};_0x1edb3e[_0x1187c8]={'$like':'%'+_0xad89f0[_0x9ba2('0x43')]['filter']+'%'};return _0x1edb3e;})});}_0x40935c=_[_0x9ba2('0x59')]({},_0x40935c,_0xad89f0[_0x9ba2('0x5a')]);return _0x54ca6f[_0x9ba2('0xec')](_0x40935c);}})[_0x9ba2('0x15')](function(_0x3ed159){if(_0x3ed159){_0x104b31=_0x3ed159[_0x9ba2('0x4c')];if(!_0xad89f0['query'][_0x9ba2('0xd4')](_0x9ba2('0xda'))){_0x40935c[_0x9ba2('0x24')]=qs[_0x9ba2('0x24')](_0xad89f0[_0x9ba2('0x43')][_0x9ba2('0x24')]);_0x40935c[_0x9ba2('0x23')]=qs[_0x9ba2('0x23')](_0xad89f0[_0x9ba2('0x43')][_0x9ba2('0x23')]);}return _0x54ca6f[_0x9ba2('0xec')](_0x40935c);}})[_0x9ba2('0x15')](function(_0x5b1ce2){if(_0x5b1ce2){return _0x5b1ce2?{'count':_0x104b31,'rows':_0x5b1ce2}:null;}})[_0x9ba2('0x15')](respondWithResult(_0x301914,null))[_0x9ba2('0x1e')](handleError(_0x301914,null));};exports[_0x9ba2('0xed')]=function(_0x415b0b,_0x271bc7){var _0x2bf936={};var _0xfa23c4={};var _0x5ccff7;var _0x3c365f;return db[_0x9ba2('0x42')][_0x9ba2('0x98')]({'where':{'id':_0x415b0b[_0x9ba2('0x52')]['id']}})[_0x9ba2('0x15')](handleEntityNotFound(_0x271bc7,null))['then'](function(_0x2e9d77){if(_0x2e9d77){_0x5ccff7=_0x2e9d77;_0xfa23c4[_0x9ba2('0x53')]=_['keys'](db['FaxInteraction'][_0x9ba2('0x39')]);_0xfa23c4[_0x9ba2('0x43')]=_[_0x9ba2('0x55')](_0x415b0b[_0x9ba2('0x43')]);_0xfa23c4['filters']=_[_0x9ba2('0x57')](_0xfa23c4['model'],_0xfa23c4['query']);_0x2bf936[_0x9ba2('0x47')]=_[_0x9ba2('0x57')](_0xfa23c4[_0x9ba2('0x53')],qs[_0x9ba2('0x58')](_0x415b0b['query'][_0x9ba2('0x58')]));_0x2bf936[_0x9ba2('0x47')]=_0x2bf936[_0x9ba2('0x47')]['length']?_0x2bf936[_0x9ba2('0x47')]:_0xfa23c4[_0x9ba2('0x53')];_0x2bf936[_0x9ba2('0xd1')]=qs['sort'](_0x415b0b[_0x9ba2('0x43')]['sort']);_0x2bf936['where']=qs[_0x9ba2('0x56')](_[_0x9ba2('0xd3')](_0x415b0b[_0x9ba2('0x43')],_0xfa23c4['filters']));if(_0x415b0b[_0x9ba2('0x43')][_0x9ba2('0x2f')]){_0x2bf936[_0x9ba2('0x41')]=_[_0x9ba2('0x59')](_0x2bf936['where'],{'$or':_[_0x9ba2('0x3a')](_0x2bf936[_0x9ba2('0x47')],function(_0x79cabf){var _0x47824d={};_0x47824d[_0x79cabf]={'$like':'%'+_0x415b0b[_0x9ba2('0x43')]['filter']+'%'};return _0x47824d;})});}_0x2bf936=_[_0x9ba2('0x59')]({},_0x2bf936,_0x415b0b[_0x9ba2('0x5a')]);return _0x5ccff7['getFaxInteractions'](_0x2bf936);}})[_0x9ba2('0x15')](function(_0x3c4b8e){if(_0x3c4b8e){_0x3c365f=_0x3c4b8e[_0x9ba2('0x4c')];if(!_0x415b0b[_0x9ba2('0x43')][_0x9ba2('0xd4')]('nolimit')){_0x2bf936[_0x9ba2('0x24')]=qs[_0x9ba2('0x24')](_0x415b0b[_0x9ba2('0x43')][_0x9ba2('0x24')]);_0x2bf936['offset']=qs['offset'](_0x415b0b['query'][_0x9ba2('0x23')]);}return _0x5ccff7[_0x9ba2('0xed')](_0x2bf936);}})[_0x9ba2('0x15')](function(_0x2932eb){if(_0x2932eb){return _0x2932eb?{'count':_0x3c365f,'rows':_0x2932eb}:null;}})[_0x9ba2('0x15')](respondWithResult(_0x271bc7,null))[_0x9ba2('0x1e')](handleError(_0x271bc7,null));};exports[_0x9ba2('0xee')]=function(_0x44f235,_0x5b0124){var _0x4cdc38={};var _0x30186c={};var _0x2a47b3;var _0x4a528a;return db['User']['findOne']({'where':{'id':_0x44f235['params']['id']}})['then'](handleEntityNotFound(_0x5b0124,null))[_0x9ba2('0x15')](function(_0x47ef1e){if(_0x47ef1e){_0x2a47b3=_0x47ef1e;_0x30186c[_0x9ba2('0x53')]=_[_0x9ba2('0x55')](db['WhatsappInteraction'][_0x9ba2('0x39')]);_0x30186c[_0x9ba2('0x43')]=_[_0x9ba2('0x55')](_0x44f235[_0x9ba2('0x43')]);_0x30186c[_0x9ba2('0x56')]=_[_0x9ba2('0x57')](_0x30186c[_0x9ba2('0x53')],_0x30186c['query']);_0x4cdc38[_0x9ba2('0x47')]=_['intersection'](_0x30186c[_0x9ba2('0x53')],qs[_0x9ba2('0x58')](_0x44f235['query']['fields']));_0x4cdc38[_0x9ba2('0x47')]=_0x4cdc38[_0x9ba2('0x47')][_0x9ba2('0x4c')]?_0x4cdc38[_0x9ba2('0x47')]:_0x30186c[_0x9ba2('0x53')];_0x4cdc38['order']=qs[_0x9ba2('0xd2')](_0x44f235[_0x9ba2('0x43')]['sort']);_0x4cdc38[_0x9ba2('0x41')]=qs[_0x9ba2('0x56')](_[_0x9ba2('0xd3')](_0x44f235[_0x9ba2('0x43')],_0x30186c[_0x9ba2('0x56')]));if(_0x44f235['query'][_0x9ba2('0x2f')]){_0x4cdc38[_0x9ba2('0x41')]=_[_0x9ba2('0x59')](_0x4cdc38['where'],{'$or':_[_0x9ba2('0x3a')](_0x4cdc38[_0x9ba2('0x47')],function(_0x5245e4){var _0x5b9913={};_0x5b9913[_0x5245e4]={'$like':'%'+_0x44f235[_0x9ba2('0x43')][_0x9ba2('0x2f')]+'%'};return _0x5b9913;})});}_0x4cdc38=_[_0x9ba2('0x59')]({},_0x4cdc38,_0x44f235['options']);return _0x2a47b3[_0x9ba2('0xee')](_0x4cdc38);}})['then'](function(_0x2df1dd){if(_0x2df1dd){_0x4a528a=_0x2df1dd[_0x9ba2('0x4c')];if(!_0x44f235[_0x9ba2('0x43')][_0x9ba2('0xd4')](_0x9ba2('0xda'))){_0x4cdc38[_0x9ba2('0x24')]=qs[_0x9ba2('0x24')](_0x44f235[_0x9ba2('0x43')][_0x9ba2('0x24')]);_0x4cdc38[_0x9ba2('0x23')]=qs[_0x9ba2('0x23')](_0x44f235[_0x9ba2('0x43')][_0x9ba2('0x23')]);}return _0x2a47b3[_0x9ba2('0xee')](_0x4cdc38);}})[_0x9ba2('0x15')](function(_0x431c91){if(_0x431c91){return _0x431c91?{'count':_0x4a528a,'rows':_0x431c91}:null;}})[_0x9ba2('0x15')](respondWithResult(_0x5b0124,null))[_0x9ba2('0x1e')](handleError(_0x5b0124,null));};exports['login']=function(_0x9b2552,_0x53f016,_0x587f5f){var _0x1ceaed;var _0x4b2eb0;var _0x3658a5;var _0x122e57=!_[_0x9ba2('0x6c')](_0x9b2552[_0x9ba2('0x52')]['id'])?_0x9b2552['params']['id']:!_[_0x9ba2('0x6c')](_0x9b2552[_0x9ba2('0x2a')]['id'])?_0x9b2552[_0x9ba2('0x2a')]['id']:null;return db['User']['find']({'where':{'id':_0x122e57,'role':{'$or':['admin',_0x9ba2('0x2a'),_0x9ba2('0x2c')]}},'attributes':['id',_0x9ba2('0x33'),_0x9ba2('0xef'),_0x9ba2('0xf0'),_0x9ba2('0x28'),_0x9ba2('0x66'),_0x9ba2('0xa0')]})[_0x9ba2('0x15')](function(_0x52af71){if(_0x52af71){if(_0x52af71['role']==='agent'){_0x1ceaed=_0x52af71;if(_0x9b2552[_0x9ba2('0x61')]['interface']){_0x3658a5=util[_0x9ba2('0xaf')](_0x9ba2('0xf1'),_0x1ceaed[_0x9b2552[_0x9ba2('0x61')][_0x9ba2('0xa2')]]);}else if(_0x9b2552[_0x9ba2('0x61')][_0x9ba2('0xf2')]){_0x3658a5=util[_0x9ba2('0xaf')](_0x9ba2('0xb0'),_0x9b2552[_0x9ba2('0x61')]['intrf']);}else{_0x3658a5=util[_0x9ba2('0xaf')](_0x9ba2('0xb0'),_0x1ceaed[_0x9ba2('0x33')]);}socket['to'](util[_0x9ba2('0xaf')](_0x9ba2('0xf3'),_0x1ceaed['name']))[_0x9ba2('0xac')](_0x9ba2('0xf4'),{'user':{'id':_0x1ceaed['id'],'name':_0x1ceaed[_0x9ba2('0x33')]},'ip':_0x9b2552[_0x9ba2('0xf5')][_0x9ba2('0xf6')]||_0x9b2552['connection'][_0x9ba2('0xf7')]||_0x9b2552['socket'][_0x9ba2('0xf7')]||_0x9b2552[_0x9ba2('0xf8')]['socket']['remoteAddress']});return db[_0x9ba2('0xb1')][_0x9ba2('0x35')]({'where':{'membername':_0x1ceaed['name']},'individualHooks':!![]});}}else{throw new db[(_0x9ba2('0x92'))]['ValidationError'](_0x9ba2('0xf9'));}})['then'](function(){if(_0x1ceaed){return _0x1ceaed[_0x9ba2('0xfa')]({'raw':!![]});}})['then'](function(_0x2f04da){if(_0x1ceaed){var _0x4309b1=[];if(_0x2f04da){_0x4b2eb0=_0x2f04da;if(_0x4b2eb0[_0x9ba2('0x4c')]){for(var _0x4d1c24=0x0;_0x4d1c24<_0x4b2eb0[_0x9ba2('0x4c')];_0x4d1c24++){_0x4309b1[_0x9ba2('0x48')]({'membername':_0x1ceaed[_0x9ba2('0x33')],'UserId':_0x1ceaed['id'],'queue_name':_0x4b2eb0[_0x4d1c24][_0x9ba2('0x33')],'VoiceQueueId':_0x4b2eb0[_0x4d1c24]['id'],'interface':_0x3658a5,'paused':_0x1ceaed[_0x9ba2('0xa0')]||![],'penalty':_0x4b2eb0[_0x4d1c24][_0x9ba2('0xfb')]||0x0});}return BPromise[_0x9ba2('0x8e')](_0x4309b1,function(_0x52606c){return db[_0x9ba2('0xb1')][_0x9ba2('0xb2')](_0x52606c);});}}}})[_0x9ba2('0x15')](function(){if(_0x1ceaed){return db[_0x9ba2('0xfc')][_0x9ba2('0x49')]({'where':{'membername':_0x1ceaed[_0x9ba2('0x33')],'exitAt':null}});}})[_0x9ba2('0x15')](function(_0x17527c){if(_0x1ceaed){var _0x3a238b=[];_0x17527c[_0x9ba2('0xfd')](function(_0x1727fe){_0x3a238b[_0x9ba2('0x48')](_0x1727fe['update']({'exitAt':moment()[_0x9ba2('0xaf')](_0x9ba2('0xfe'))}));});return BPromise[_0x9ba2('0x50')](_0x3a238b);}})[_0x9ba2('0x15')](function(){if(_0x1ceaed){var _0x2d280b=[];var _0x42f0fd=[];var _0x4c3057=utils[_0x9ba2('0xff')]();var _0x23197a={'membername':_0x1ceaed[_0x9ba2('0x33')],'interface':_0x3658a5,'enterAt':moment()[_0x9ba2('0xaf')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1ceaed['role'],'internal':_0x1ceaed[_0x9ba2('0x66')]};_0x4c3057[_0x9ba2('0xfd')](function(_0x166236){_0x2d280b['push'](_['merge']({'channel':_0x166236,'type':_0x9ba2('0x100'),'data1':_0x9b2552['body'][_0x9ba2('0x101')],'data2':_0x3658a5},_0x23197a));if(_0x1ceaed['loginInPause']){_0x42f0fd[_0x9ba2('0x48')](_[_0x9ba2('0x59')]({'channel':_0x166236,'type':_0x9ba2('0x102'),'data1':_0x9ba2('0x103')},_0x23197a));}});return db[_0x9ba2('0xfc')][_0x9ba2('0x8a')](_0x2d280b[_0x9ba2('0xcf')](_0x42f0fd),{'individualHooks':!![]});}})['then'](function(){if(_0x1ceaed){return _0x1ceaed[_0x9ba2('0x60')]({'online':!![],'lastLoginAt':moment()[_0x9ba2('0xaf')](_0x9ba2('0xfe')),'voicePause':_0x1ceaed[_0x9ba2('0xa0')]||![],'mailPause':_0x1ceaed[_0x9ba2('0xa0')]||![],'chatPause':_0x1ceaed['loginInPause']||![],'faxPause':_0x1ceaed[_0x9ba2('0xa0')]||![],'smsPause':_0x1ceaed['loginInPause']||![],'openchannelPause':_0x1ceaed[_0x9ba2('0xa0')]||![],'whatsappPause':_0x1ceaed[_0x9ba2('0xa0')]||![],'pauseType':_0x1ceaed['loginInPause']?_0x9ba2('0x103'):null,'interface':_0x3658a5,'lastPauseAt':moment()['format'](_0x9ba2('0xfe'))});}})[_0x9ba2('0x15')](function(_0x5801cf){if(_0x9b2552['isMiddleware']){return _0x587f5f();}else{return BPromise[_0x9ba2('0x104')](_0x5801cf)[_0x9ba2('0x15')](respondWithResult(_0x53f016,null));}})[_0x9ba2('0x1e')](handleError(_0x53f016,null));};exports[_0x9ba2('0x105')]=function(_0x179a63,_0xb1eae3){var _0x2c36fb;return db[_0x9ba2('0x42')][_0x9ba2('0x5b')]({'where':{'id':_0x179a63[_0x9ba2('0x52')]['id'],'role':_0x9ba2('0x2c')},'attributes':['id','name','role']})[_0x9ba2('0x15')](handleEntityNotFound(_0xb1eae3,null))['then'](function(_0x464ebc){if(_0x464ebc){_0x2c36fb=_0x464ebc;return db['UserVoiceQueueRt'][_0x9ba2('0x35')]({'where':{'membername':_0x2c36fb[_0x9ba2('0x33')]},'individualHooks':!![]});}})[_0x9ba2('0x15')](function(){return db[_0x9ba2('0xfc')]['findAll']({'where':{'membername':_0x2c36fb[_0x9ba2('0x33')],'exitAt':null}});})[_0x9ba2('0x15')](function(_0x15bc0d){var _0x3bac11=[];_0x15bc0d[_0x9ba2('0xfd')](function(_0x165f09){_0x3bac11[_0x9ba2('0x48')](_0x165f09[_0x9ba2('0x60')]({'exitAt':moment()[_0x9ba2('0xaf')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x3bac11);})[_0x9ba2('0x15')](function(){return _0x2c36fb[_0x9ba2('0x60')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x9ba2('0x15')](respondWithResult(_0xb1eae3,null))[_0x9ba2('0x1e')](handleError(_0xb1eae3,null));};exports[_0x9ba2('0x106')]=function(_0x279e0d,_0xd28ba8){var _0x228393;return db[_0x9ba2('0xb1')][_0x9ba2('0x60')]({'paused':0x1},{'where':{'UserId':_0x279e0d[_0x9ba2('0x52')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x9ba2('0x42')][_0x9ba2('0x5b')]({'where':{'id':_0x279e0d[_0x9ba2('0x52')]['id'],'role':_0x9ba2('0x2c')},'attributes':['id',_0x9ba2('0x33'),_0x9ba2('0x28'),_0x9ba2('0x66'),'interface']});})['then'](handleEntityNotFound(_0xd28ba8,null))['then'](function(_0x7534c6){if(_0x7534c6){_0x228393=_0x7534c6;return respondWithRpcPromise(_0x9ba2('0x107'),'pause',{'id':_0x228393['id'],'name':_0x228393[_0x9ba2('0x33')],'pause':!![]});}})['then'](function(){if(_0x228393){return db[_0x9ba2('0xfc')]['findAll']({'where':{'membername':_0x228393[_0x9ba2('0x33')],'type':_0x9ba2('0x102'),'exitAt':null}});}})[_0x9ba2('0x15')](function(_0x15d6cd){if(_0x15d6cd['length']){var _0x417b78=moment()[_0x9ba2('0xaf')](_0x9ba2('0xfe'));for(var _0x4be2ef=0x0,_0x2f2150=_0x15d6cd[_0x9ba2('0x4c')];_0x4be2ef<_0x2f2150;_0x4be2ef++){_0x15d6cd[_0x4be2ef][_0x9ba2('0x108')]({'exitAt':_0x417b78});}}})[_0x9ba2('0x15')](function(){var _0x45062d=[];var _0x3a1691=utils['getChannels']();_0x3a1691['forEach'](function(_0x2c99ea){_0x45062d['push']({'channel':_0x2c99ea,'membername':_0x228393[_0x9ba2('0x33')],'interface':_['isNil'](_0x228393[_0x9ba2('0xa2')])?util[_0x9ba2('0xaf')]('SIP/%s',_0x228393[_0x9ba2('0x33')]):_0x228393[_0x9ba2('0xa2')],'type':_0x9ba2('0x102'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x279e0d[_0x9ba2('0x61')][_0x9ba2('0x3c')]||_0x9ba2('0x109'),'role':_0x228393[_0x9ba2('0x28')],'internal':_0x228393[_0x9ba2('0x66')]});});return db['MemberReport'][_0x9ba2('0x8a')](_0x45062d,{'individualHooks':!![]});})[_0x9ba2('0x15')](function(){return _0x228393[_0x9ba2('0x60')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x279e0d[_0x9ba2('0x61')][_0x9ba2('0x3c')]||_0x9ba2('0x109'),'lastPauseAt':moment()[_0x9ba2('0xaf')](_0x9ba2('0xfe'))});})[_0x9ba2('0x15')](respondWithResult(_0xd28ba8,null))[_0x9ba2('0x1e')](handleError(_0xd28ba8,null));};exports['unpause']=function(_0x360965,_0x8bb0e5){var _0x5270e6;return db[_0x9ba2('0x42')]['find']({'where':{'id':_0x360965[_0x9ba2('0x52')]['id']},'attributes':['id',_0x9ba2('0x33'),'role',_0x9ba2('0xa1'),_0x9ba2('0x10a'),_0x9ba2('0x10b'),_0x9ba2('0x10c'),'openchannelPause','smsPause',_0x9ba2('0x10d'),_0x9ba2('0x10e'),_0x9ba2('0x10f')]})[_0x9ba2('0x15')](handleEntityNotFound(_0x8bb0e5,null))[_0x9ba2('0x15')](function(_0x51156f){if(_0x51156f){_0x5270e6=_0x51156f;if(_0x360965[_0x9ba2('0x61')][_0x9ba2('0x9e')]&&!utils[_0x9ba2('0xa3')](_0x360965[_0x9ba2('0x61')][_0x9ba2('0x9e')])){throw new db[(_0x9ba2('0x92'))][(_0x9ba2('0x93'))](_0x9ba2('0xa4'));}switch(_0x360965[_0x9ba2('0x61')][_0x9ba2('0x9e')]){case'voice':return respondWithRpcPromise(_0x9ba2('0x107'),_0x9ba2('0x110'),{'id':_0x5270e6['id'],'name':_0x5270e6[_0x9ba2('0x33')],'pause':![]})[_0x9ba2('0x15')](function(){return db['UserVoiceQueueRt'][_0x9ba2('0x60')]({'paused':0x0},{'where':{'UserId':_0x5270e6['id']},'individualHooks':!![]});})['then'](function(){return db[_0x9ba2('0xfc')][_0x9ba2('0x5b')]({'where':{'channel':_0x360965['body'][_0x9ba2('0x9e')],'membername':_0x5270e6[_0x9ba2('0x33')],'type':'PAUSE','exitAt':null}});})[_0x9ba2('0x15')](function(_0x5845c3){if(_0x5845c3){return _0x5845c3[_0x9ba2('0x60')]({'exitAt':moment()[_0x9ba2('0xaf')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x9ba2('0x15')](function(){return _0x5270e6['update']({'voicePause':![]});});case _0x9ba2('0x4e'):case _0x9ba2('0x5c'):case _0x9ba2('0x5f'):case _0x9ba2('0x5d'):case _0x9ba2('0x4f'):case _0x9ba2('0x5e'):return db[_0x9ba2('0xfc')][_0x9ba2('0x5b')]({'where':{'channel':_0x360965[_0x9ba2('0x61')]['channel'],'membername':_0x5270e6[_0x9ba2('0x33')],'type':_0x9ba2('0x102'),'exitAt':null}})[_0x9ba2('0x15')](function(_0x51b2c2){if(_0x51b2c2){return _0x51b2c2[_0x9ba2('0x60')]({'exitAt':moment()[_0x9ba2('0xaf')](_0x9ba2('0xfe')),'data2':_0x9ba2('0x111')},{'individualHooks':!![]});}return null;})[_0x9ba2('0x15')](function(){var _0x9431b7={};_[_0x9ba2('0x25')](_0x9431b7,util[_0x9ba2('0xaf')](_0x9ba2('0x112'),_0x360965[_0x9ba2('0x61')][_0x9ba2('0x9e')],_0x9ba2('0x113')),![]);return _0x5270e6[_0x9ba2('0x60')](_0x9431b7);});default:return respondWithRpcPromise(_0x9ba2('0x107'),_0x9ba2('0x110'),{'id':_0x5270e6['id'],'name':_0x5270e6[_0x9ba2('0x33')],'pause':![]})[_0x9ba2('0x15')](function(){return db[_0x9ba2('0xb1')]['update']({'paused':0x0},{'where':{'UserId':_0x5270e6['id']}});})['then'](function(){return db[_0x9ba2('0xfc')][_0x9ba2('0x49')]({'where':{'membername':_0x5270e6['name'],'type':'PAUSE','exitAt':null}});})[_0x9ba2('0x15')](function(_0xc7c4fb){var _0x39a8ee=[];_0xc7c4fb[_0x9ba2('0xfd')](function(_0x578c2a){_0x39a8ee[_0x9ba2('0x48')](_0x578c2a[_0x9ba2('0x60')]({'exitAt':moment()[_0x9ba2('0xaf')](_0x9ba2('0xfe')),'data2':_0x9ba2('0x111')}));});return BPromise[_0x9ba2('0x50')](_0x39a8ee);})[_0x9ba2('0x15')](function(){return _0x5270e6[_0x9ba2('0x60')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x9ba2('0x15')](respondWithResult(_0x8bb0e5,null))['catch'](handleError(_0x8bb0e5,null));};exports[_0x9ba2('0x114')]=function(_0x503907,_0x290c44){var _0x3ebf0e={};var _0x30e6a3={};var _0x5f3eda;var _0x29c355;return db[_0x9ba2('0x42')][_0x9ba2('0x98')]({'where':{'id':_0x503907[_0x9ba2('0x52')]['id']}})[_0x9ba2('0x15')](handleEntityNotFound(_0x290c44,null))['then'](function(_0x10af5a){if(_0x10af5a){_0x5f3eda=_0x10af5a;_0x30e6a3[_0x9ba2('0x53')]=_['keys'](db[_0x9ba2('0x115')][_0x9ba2('0x39')]);_0x30e6a3['query']=_[_0x9ba2('0x55')](_0x503907[_0x9ba2('0x43')]);_0x30e6a3[_0x9ba2('0x56')]=_[_0x9ba2('0x57')](_0x30e6a3[_0x9ba2('0x53')],_0x30e6a3[_0x9ba2('0x43')]);_0x3ebf0e[_0x9ba2('0x47')]=_[_0x9ba2('0x57')](_0x30e6a3['model'],qs['fields'](_0x503907[_0x9ba2('0x43')][_0x9ba2('0x58')]));_0x3ebf0e['attributes']=_0x3ebf0e[_0x9ba2('0x47')][_0x9ba2('0x4c')]?_0x3ebf0e['attributes']:_0x30e6a3[_0x9ba2('0x53')];_0x3ebf0e[_0x9ba2('0xd1')]=qs[_0x9ba2('0xd2')](_0x503907[_0x9ba2('0x43')][_0x9ba2('0xd2')]);_0x3ebf0e['where']=qs[_0x9ba2('0x56')](_['pick'](_0x503907[_0x9ba2('0x43')],_0x30e6a3[_0x9ba2('0x56')]));if(_0x503907['query']['filter']){_0x3ebf0e['where']=_[_0x9ba2('0x59')](_0x3ebf0e['where'],{'$or':_[_0x9ba2('0x3a')](_0x3ebf0e[_0x9ba2('0x47')],function(_0x5481af){var _0x261b13={};_0x261b13[_0x5481af]={'$like':'%'+_0x503907[_0x9ba2('0x43')][_0x9ba2('0x2f')]+'%'};return _0x261b13;})});}_0x3ebf0e=_[_0x9ba2('0x59')]({},_0x3ebf0e,_0x503907[_0x9ba2('0x5a')]);return _0x5f3eda[_0x9ba2('0x114')](_0x3ebf0e);}})[_0x9ba2('0x15')](function(_0x3d64e1){if(_0x3d64e1){_0x29c355=_0x3d64e1[_0x9ba2('0x4c')];if(!_0x503907[_0x9ba2('0x43')][_0x9ba2('0xd4')](_0x9ba2('0xda'))){_0x3ebf0e[_0x9ba2('0x24')]=qs[_0x9ba2('0x24')](_0x503907['query'][_0x9ba2('0x24')]);_0x3ebf0e[_0x9ba2('0x23')]=qs[_0x9ba2('0x23')](_0x503907[_0x9ba2('0x43')][_0x9ba2('0x23')]);}return _0x5f3eda['getTeams'](_0x3ebf0e);}})[_0x9ba2('0x15')](function(_0x2e571d){if(_0x2e571d){return _0x2e571d?{'count':_0x29c355,'rows':_0x2e571d}:null;}})['then'](respondWithResult(_0x290c44,null))['catch'](handleError(_0x290c44,null));};exports[_0x9ba2('0x116')]=function(_0x822648,_0x2ca5c7){return db[_0x9ba2('0x42')][_0x9ba2('0x5b')]({'where':{'id':_0x822648['params']['id']}})['then'](handleEntityNotFound(_0x2ca5c7,null))[_0x9ba2('0x15')](function(_0x48cb37){if(_0x48cb37){var _0x3ad374=_0x48cb37[_0x9ba2('0x27')]({'plain':!![]});return _0x48cb37['addTeams'](_0x822648[_0x9ba2('0x61')][_0x9ba2('0x64')],_[_0x9ba2('0x65')](_0x822648['body'],[_0x9ba2('0x64'),'id'])||{})[_0x9ba2('0x15')](function(){for(var _0x39083a=0x0;_0x39083a<_0x822648[_0x9ba2('0x61')][_0x9ba2('0x64')][_0x9ba2('0x4c')];_0x39083a++){var _0x30157b=[];var _0x37b590={};db[_0x9ba2('0x115')][_0x9ba2('0x98')]({'where':{'id':_0x822648['body']['ids'][_0x39083a]}})['then'](function(_0x4d918a){_0x37b590=_0x4d918a[_0x9ba2('0x4d')];_0x30157b[_0x9ba2('0x48')](_0x4d918a[_0x9ba2('0xfa')]()[_0x9ba2('0x15')](function(_0x2bf93d){for(var _0x1ca641=0x0;_0x1ca641<_0x2bf93d[_0x9ba2('0x4c')];_0x1ca641++){_0x2bf93d[_0x1ca641][_0x9ba2('0x117')](_0x9ba2('0x9e'),_0x9ba2('0x118'));}return _0x2bf93d;}));_0x30157b[_0x9ba2('0x48')](_0x4d918a[_0x9ba2('0x119')]()[_0x9ba2('0x15')](function(_0x5458d6){for(var _0x3fc42c=0x0;_0x3fc42c<_0x5458d6[_0x9ba2('0x4c')];_0x3fc42c++){_0x5458d6[_0x3fc42c][_0x9ba2('0x117')](_0x9ba2('0x9e'),'Chat');}return _0x5458d6;}));_0x30157b['push'](_0x4d918a[_0x9ba2('0x11a')]()[_0x9ba2('0x15')](function(_0x500938){for(var _0x20a41f=0x0;_0x20a41f<_0x500938['length'];_0x20a41f++){_0x500938[_0x20a41f][_0x9ba2('0x117')](_0x9ba2('0x9e'),'Mail');}return _0x500938;}));_0x30157b['push'](_0x4d918a[_0x9ba2('0x11b')]()[_0x9ba2('0x15')](function(_0x97e237){for(var _0x212096=0x0;_0x212096<_0x97e237[_0x9ba2('0x4c')];_0x212096++){_0x97e237[_0x212096]['setDataValue']('channel',_0x9ba2('0x11c'));}return _0x97e237;}));_0x30157b['push'](_0x4d918a[_0x9ba2('0x11d')]()['then'](function(_0x5ccdfa){for(var _0x1cbbf6=0x0;_0x1cbbf6<_0x5ccdfa[_0x9ba2('0x4c')];_0x1cbbf6++){_0x5ccdfa[_0x1cbbf6][_0x9ba2('0x117')]('channel',_0x9ba2('0x11e'));}return _0x5ccdfa;}));_0x30157b['push'](_0x4d918a['getFaxQueues']()['then'](function(_0x33bfdd){for(var _0x2a6f1d=0x0;_0x2a6f1d<_0x33bfdd[_0x9ba2('0x4c')];_0x2a6f1d++){_0x33bfdd[_0x2a6f1d][_0x9ba2('0x117')](_0x9ba2('0x9e'),'Fax');}return _0x33bfdd;}));_0x30157b[_0x9ba2('0x48')](_0x4d918a[_0x9ba2('0x11f')]()[_0x9ba2('0x15')](function(_0x5d19e5){for(var _0x28210b=0x0;_0x28210b<_0x5d19e5[_0x9ba2('0x4c')];_0x28210b++){_0x5d19e5[_0x28210b][_0x9ba2('0x117')](_0x9ba2('0x9e'),_0x9ba2('0x120'));}return _0x5d19e5;}));return BPromise[_0x9ba2('0x50')](_0x30157b);})[_0x9ba2('0x15')](function(_0x53652d){var _0x30fcf2=_[_0x9ba2('0x121')](_0x53652d);_0x30157b=[];return db[_0x9ba2('0x6e')][_0x9ba2('0x122')](function(_0x44bb45){for(var _0x1099db=0x0;_0x1099db<_0x30fcf2[_0x9ba2('0x4c')];_0x1099db++){_0x30157b['push'](_0x30fcf2[_0x1099db][_0x9ba2('0x123')](_0x3ad374['id']),{'transaction':_0x44bb45});}return BPromise[_0x9ba2('0x50')](_0x30157b)[_0x9ba2('0x15')](function(){if(_0x3ad374[_0x9ba2('0x9f')]){return BPromise['each'](_['filter'](_0x30fcf2,function(_0x2c5386){return _0x2c5386[_0x9ba2('0x124')](_0x9ba2('0x9e'))===_0x9ba2('0x118');}),function(_0x4e9523){return db[_0x9ba2('0xb1')][_0x9ba2('0xb2')]({'membername':_0x3ad374[_0x9ba2('0x33')],'UserId':_0x3ad374['id'],'queue_name':_0x4e9523[_0x9ba2('0x33')],'VoiceQueueId':_0x4e9523['id'],'interface':_[_0x9ba2('0x6c')](_0x3ad374[_0x9ba2('0xa2')])?util[_0x9ba2('0xaf')](_0x9ba2('0xb0'),_0x3ad374[_0x9ba2('0x33')]):_0x3ad374['interface'],'paused':_0x3ad374['voicePause']||![],'penalty':_0x3ad374[_0x9ba2('0xa9')]},{'transaction':_0x44bb45});});}else{return;}})[_0x9ba2('0x15')](function(){for(var _0x1b4eef=0x0;_0x1b4eef<_0x30fcf2[_0x9ba2('0x4c')];_0x1b4eef++){var _0x533db7=_0x30fcf2[_0x1b4eef][_0x9ba2('0x124')](_0x9ba2('0x9e'));var _0x5fcf0=_0x533db7+_0x9ba2('0xab');socket[_0x9ba2('0xac')]('user'+_0x533db7+_0x9ba2('0xad'),{'UserId':_0x3ad374['id'],['queueField']:_0x30fcf2[_0x1b4eef]['id']});}});});})[_0x9ba2('0x15')](function(){db[_0x9ba2('0x125')]['findOne']({'where':{'teamId':_0x37b590['id']}})[_0x9ba2('0x15')](function(_0x386da9){if(_0x386da9){db['UserVoicePrefix'][_0x9ba2('0x82')]({'UserId':_0x822648[_0x9ba2('0x52')]['id'],'VoicePrefixId':_0x386da9['VoicePrefixId']});}});});}});}})[_0x9ba2('0x15')](respondWithStatusCode(_0x2ca5c7,null))[_0x9ba2('0x1e')](handleError(_0x2ca5c7,null));};exports['removeTeams']=function(_0x44eec8,_0x590daa){return db[_0x9ba2('0x42')][_0x9ba2('0x98')]({'where':{'id':_0x44eec8[_0x9ba2('0x52')]['id']}})[_0x9ba2('0x15')](handleEntityNotFound(_0x590daa,null))[_0x9ba2('0x15')](function(_0x5d592d){if(_0x5d592d){var _0x23e095=_0x5d592d[_0x9ba2('0x27')]({'plain':!![]});var _0x4ed6fa=_0x44eec8[_0x9ba2('0x43')][_0x9ba2('0x64')];return _0x5d592d[_0x9ba2('0x126')](_0x4ed6fa)['then'](function(){for(var _0x59e6c4=0x0;_0x59e6c4<_0x4ed6fa[_0x9ba2('0x4c')];_0x59e6c4++){var _0x3d8670=[];var _0x28343f={};db[_0x9ba2('0x115')][_0x9ba2('0x98')]({'where':{'id':_0x4ed6fa[_0x59e6c4]}})[_0x9ba2('0x15')](function(_0x5f3daf){_0x28343f=_0x5f3daf[_0x9ba2('0x4d')];_0x3d8670[_0x9ba2('0x48')](_0x5f3daf[_0x9ba2('0xfa')]()[_0x9ba2('0x15')](function(_0x277b12){for(var _0x1ed587=0x0;_0x1ed587<_0x277b12['length'];_0x1ed587++){_0x277b12[_0x1ed587][_0x9ba2('0x117')](_0x9ba2('0x9e'),_0x9ba2('0x118'));}return _0x277b12;}));_0x3d8670[_0x9ba2('0x48')](_0x5f3daf['getChatQueues']()[_0x9ba2('0x15')](function(_0x46fce6){for(var _0x3e302b=0x0;_0x3e302b<_0x46fce6[_0x9ba2('0x4c')];_0x3e302b++){_0x46fce6[_0x3e302b][_0x9ba2('0x117')](_0x9ba2('0x9e'),'Chat');}return _0x46fce6;}));_0x3d8670[_0x9ba2('0x48')](_0x5f3daf[_0x9ba2('0x11a')]()[_0x9ba2('0x15')](function(_0x29898a){for(var _0x3fe563=0x0;_0x3fe563<_0x29898a[_0x9ba2('0x4c')];_0x3fe563++){_0x29898a[_0x3fe563][_0x9ba2('0x117')](_0x9ba2('0x9e'),_0x9ba2('0x127'));}return _0x29898a;}));_0x3d8670['push'](_0x5f3daf[_0x9ba2('0x11b')]()[_0x9ba2('0x15')](function(_0x453838){for(var _0x2a5b25=0x0;_0x2a5b25<_0x453838[_0x9ba2('0x4c')];_0x2a5b25++){_0x453838[_0x2a5b25][_0x9ba2('0x117')](_0x9ba2('0x9e'),_0x9ba2('0x11c'));}return _0x453838;}));_0x3d8670[_0x9ba2('0x48')](_0x5f3daf[_0x9ba2('0x11d')]()[_0x9ba2('0x15')](function(_0x4add46){for(var _0x1bbd9d=0x0;_0x1bbd9d<_0x4add46[_0x9ba2('0x4c')];_0x1bbd9d++){_0x4add46[_0x1bbd9d]['setDataValue'](_0x9ba2('0x9e'),_0x9ba2('0x11e'));}return _0x4add46;}));_0x3d8670['push'](_0x5f3daf[_0x9ba2('0x128')]()[_0x9ba2('0x15')](function(_0x493a8d){for(var _0x3fcc44=0x0;_0x3fcc44<_0x493a8d['length'];_0x3fcc44++){_0x493a8d[_0x3fcc44]['setDataValue'](_0x9ba2('0x9e'),_0x9ba2('0x129'));}return _0x493a8d;}));_0x3d8670[_0x9ba2('0x48')](_0x5f3daf[_0x9ba2('0x11f')]()[_0x9ba2('0x15')](function(_0x240278){for(var _0x3ecbbc=0x0;_0x3ecbbc<_0x240278[_0x9ba2('0x4c')];_0x3ecbbc++){_0x240278[_0x3ecbbc][_0x9ba2('0x117')](_0x9ba2('0x9e'),_0x9ba2('0x120'));}return _0x240278;}));return BPromise[_0x9ba2('0x50')](_0x3d8670);})[_0x9ba2('0x15')](function(_0x43ad77){var _0x2f26da=_['flatten'](_0x43ad77);_0x3d8670=[];return db[_0x9ba2('0x6e')][_0x9ba2('0x122')](function(_0x4b4b73){for(var _0x3a811f=0x0;_0x3a811f<_0x2f26da[_0x9ba2('0x4c')];_0x3a811f++){_0x3d8670['push'](_0x2f26da[_0x3a811f]['removeAgent'](_0x23e095['id']),{'transaction':_0x4b4b73});}return BPromise[_0x9ba2('0x50')](_0x3d8670)[_0x9ba2('0x15')](function(){if(_0x23e095[_0x9ba2('0x9f')]){return BPromise[_0x9ba2('0x8e')](_[_0x9ba2('0x2f')](_0x2f26da,function(_0x5539d9){return _0x5539d9[_0x9ba2('0x124')]('channel')===_0x9ba2('0x118');}),function(_0x18cfd6){return db[_0x9ba2('0xb1')][_0x9ba2('0x35')]({'where':{'VoiceQueueId':_0x18cfd6['id'],'UserId':_0x23e095['id']},'transaction':_0x4b4b73});});}else{return;}})['then'](function(){db[_0x9ba2('0x125')][_0x9ba2('0x98')]({'where':{'teamId':_0x28343f['id']}})[_0x9ba2('0x15')](function(_0x27bd92){if(_0x27bd92){return db[_0x9ba2('0x12a')][_0x9ba2('0x35')]({'where':{'UserId':_0x23e095['id'],'VoicePrefixId':_0x27bd92['dataValues'][_0x9ba2('0x12b')]}});}});})[_0x9ba2('0x15')](function(){for(var _0x5d55bb=0x0;_0x5d55bb<_0x2f26da['length'];_0x5d55bb++){var _0xb8f613=_0x2f26da[_0x5d55bb][_0x9ba2('0x124')](_0x9ba2('0x9e'));var _0x3a6cac=_0xb8f613+_0x9ba2('0xab');socket[_0x9ba2('0xac')](_0x9ba2('0x2a')+_0xb8f613+_0x9ba2('0xb6'),{'UserId':_0x23e095['id'],['queueField']:_0x2f26da[_0x5d55bb]['id']});}});});});}});}})[_0x9ba2('0x15')](respondWithStatusCode(_0x590daa,null))[_0x9ba2('0x1e')](handleError(_0x590daa,null));};exports[_0x9ba2('0x12c')]=function(_0x218651,_0x5787f7){var _0x57b8eb={};var _0xa240fa={};var _0x22908b;var _0x254713;return db[_0x9ba2('0x42')][_0x9ba2('0x98')]({'where':{'id':_0x218651[_0x9ba2('0x52')]['id']}})[_0x9ba2('0x15')](handleEntityNotFound(_0x5787f7,null))[_0x9ba2('0x15')](function(_0x2eb055){if(_0x2eb055){_0x22908b=_0x2eb055;_0xa240fa[_0x9ba2('0x53')]=_[_0x9ba2('0x55')](db[_0x9ba2('0xd5')]['rawAttributes']);_0xa240fa[_0x9ba2('0x43')]=_['keys'](_0x218651[_0x9ba2('0x43')]);_0xa240fa[_0x9ba2('0x56')]=_[_0x9ba2('0x57')](_0xa240fa[_0x9ba2('0x53')],_0xa240fa[_0x9ba2('0x43')]);_0x57b8eb[_0x9ba2('0x47')]=_['intersection'](_0xa240fa[_0x9ba2('0x53')],qs[_0x9ba2('0x58')](_0x218651['query'][_0x9ba2('0x58')]));_0x57b8eb[_0x9ba2('0x47')]=_0x57b8eb[_0x9ba2('0x47')]['length']?_0x57b8eb[_0x9ba2('0x47')]:_0xa240fa[_0x9ba2('0x53')];_0x57b8eb[_0x9ba2('0xd1')]=qs[_0x9ba2('0xd2')](_0x218651[_0x9ba2('0x43')][_0x9ba2('0xd2')]);_0x57b8eb[_0x9ba2('0x41')]=qs[_0x9ba2('0x56')](_['pick'](_0x218651['query'],_0xa240fa['filters']));if(_0x218651[_0x9ba2('0x43')][_0x9ba2('0x2f')]){_0x57b8eb[_0x9ba2('0x41')]=_[_0x9ba2('0x59')](_0x57b8eb[_0x9ba2('0x41')],{'$or':_[_0x9ba2('0x3a')](_0x57b8eb['attributes'],function(_0x1817b8){var _0x5313c7={};_0x5313c7[_0x1817b8]={'$like':'%'+_0x218651[_0x9ba2('0x43')]['filter']+'%'};return _0x5313c7;})});}_0x57b8eb=_['merge']({},_0x57b8eb,_0x218651[_0x9ba2('0x5a')]);return _0x22908b[_0x9ba2('0x12c')](_0x57b8eb);}})['then'](function(_0x27e527){if(_0x27e527){_0x254713=_0x27e527[_0x9ba2('0x4c')];if(!_0x218651[_0x9ba2('0x43')][_0x9ba2('0xd4')](_0x9ba2('0xda'))){_0x57b8eb[_0x9ba2('0x24')]=qs['limit'](_0x218651[_0x9ba2('0x43')][_0x9ba2('0x24')]);_0x57b8eb[_0x9ba2('0x23')]=qs[_0x9ba2('0x23')](_0x218651[_0x9ba2('0x43')][_0x9ba2('0x23')]);}return _0x22908b['getLists'](_0x57b8eb);}})[_0x9ba2('0x15')](function(_0x580d91){if(_0x580d91){return _0x580d91?{'count':_0x254713,'rows':_0x580d91}:null;}})[_0x9ba2('0x15')](respondWithResult(_0x5787f7,null))[_0x9ba2('0x1e')](handleError(_0x5787f7,null));};exports[_0x9ba2('0x12d')]=function(_0x7407b3,_0x10cae7){var _0x1dde31={};var _0x17b697={};var _0x46303a;return db[_0x9ba2('0x42')][_0x9ba2('0x98')]({'where':{'id':_0x7407b3['params']['id']}})[_0x9ba2('0x15')](handleEntityNotFound(_0x10cae7,null))['then'](function(_0x2f6942){if(_0x2f6942){_0x46303a=_0x2f6942;_0x17b697[_0x9ba2('0x53')]=_[_0x9ba2('0x55')](db[_0x9ba2('0x42')][_0x9ba2('0x39')]);_0x17b697[_0x9ba2('0x43')]=_[_0x9ba2('0x55')](_0x7407b3[_0x9ba2('0x43')]);_0x17b697['filters']=_[_0x9ba2('0x57')](_0x17b697['model'],_0x17b697[_0x9ba2('0x43')]);_0x1dde31[_0x9ba2('0x47')]=_[_0x9ba2('0x57')](_0x17b697[_0x9ba2('0x53')],qs[_0x9ba2('0x58')](_0x7407b3[_0x9ba2('0x43')]['fields']));_0x1dde31[_0x9ba2('0x47')]=_0x1dde31[_0x9ba2('0x47')][_0x9ba2('0x4c')]?_0x1dde31[_0x9ba2('0x47')]:_0x17b697['model'];_0x1dde31[_0x9ba2('0xd1')]=qs[_0x9ba2('0xd2')](_0x7407b3['query']['sort']);_0x1dde31[_0x9ba2('0x41')]=qs[_0x9ba2('0x56')](_[_0x9ba2('0xd3')](_0x7407b3[_0x9ba2('0x43')],_0x17b697[_0x9ba2('0x56')]));if(_0x7407b3[_0x9ba2('0x43')][_0x9ba2('0x2f')]){_0x1dde31['where']=_[_0x9ba2('0x59')](_0x1dde31[_0x9ba2('0x41')],{'$or':_[_0x9ba2('0x3a')](_0x1dde31[_0x9ba2('0x47')],function(_0x3cf0f9){var _0x3c1bea={};_0x3c1bea[_0x3cf0f9]={'$like':'%'+_0x7407b3['query'][_0x9ba2('0x2f')]+'%'};return _0x3c1bea;})});}_0x1dde31[_0x9ba2('0x53')]=db['User'];_0x1dde31['as']='Agents';_0x1dde31=_[_0x9ba2('0x59')]({},_0x1dde31,_0x7407b3[_0x9ba2('0x5a')]);return _0x46303a[_0x9ba2('0xfa')]({'include':[_0x1dde31]});}})[_0x9ba2('0x15')](function(_0x1888da){if(_0x1888da){var _0x362753={},_0x313dd5=[];for(var _0x33fdbd=0x0;_0x33fdbd<_0x1888da['length'];_0x33fdbd+=0x1){for(var _0x237b50=0x0,_0x18f39f;_0x237b50<_0x1888da[_0x33fdbd][_0x9ba2('0x2b')][_0x9ba2('0x4c')];_0x237b50+=0x1){_0x18f39f=_0x1888da[_0x33fdbd][_0x9ba2('0x2b')][_0x237b50]['get']({'plain':!![]});_0x362753[_0x18f39f['id']]=_0x18f39f;}}_0x362753=_[_0x9ba2('0x12e')](_0x362753);for(var _0x4fa303=qs['offset'](_0x7407b3[_0x9ba2('0x43')][_0x9ba2('0x23')]);_0x4fa303<_0x362753['length']&&_0x313dd5[_0x9ba2('0x4c')]=_0x35590f){_0xbb9e69=_0x35590f;_0x2be5a5=0xc8;}else{_0x2be5a5=0xce;}_0x55ef2e[_0x0418('0x1d')](_0x2be5a5);return _0x55ef2e['set'](_0x0418('0x22'),_0x4640f5+'-'+_0xbb9e69+'/'+_0x35590f)[_0x0418('0x23')](_0x47b657);}return null;};}function saveUpdates(_0x378013){return function(_0x19dede){if(_0x19dede){return _0x19dede[_0x0418('0x24')](_0x378013)['then'](function(_0x2f1f3c){return _0x2f1f3c;});}return null;};}function removeEntity(_0x358973){return function(_0x5dcc27){if(_0x5dcc27){return _0x5dcc27[_0x0418('0x25')]()[_0x0418('0x11')](function(){var _0x5a5bb9=_0x5dcc27[_0x0418('0x26')]({'plain':!![]});if(_0x5a5bb9[_0x0418('0x27')]===_0x0418('0x28'))return;var _0x387411=[{'name':'Users','value':_0x0418('0x29'),'ignore':!![]},{'name':'Agents','value':_0x0418('0x2a'),'ignore':![]},{'name':_0x0418('0x2b'),'value':_0x0418('0x2c'),'ignore':![]}];var _0x5d0a0d=_(_0x387411)[_0x0418('0x2d')]('ignore')['map'](_0x0418('0x2e'))['value']();if(_[_0x0418('0x2f')](_0x5d0a0d,_0x5a5bb9['role'])){return;}var _0x3c5d50=_['find'](_0x387411,[_0x0418('0x2e'),_0x5a5bb9[_0x0418('0x27')]])[_0x0418('0x30')];return db[_0x0418('0x31')]['destroy']({'where':{'type':_0x3c5d50,'resourceId':_0x5a5bb9['id']}})[_0x0418('0x11')](function(){return _0x5dcc27;});})[_0x0418('0x11')](function(){_0x358973[_0x0418('0x1d')](0xcc)[_0x0418('0x32')]();});}};}function handleEntityNotFound(_0x10f61f){return function(_0x41ad9d){if(!_0x41ad9d){_0x10f61f[_0x0418('0x1c')](0x194);}return _0x41ad9d;};}function handleError(_0x9de991,_0x34bb94){_0x34bb94=_0x34bb94||0x1f4;return function(_0x121a7d){logger[_0x0418('0x17')](_0x121a7d[_0x0418('0x33')]);if(_0x121a7d[_0x0418('0x30')]){delete _0x121a7d[_0x0418('0x30')];}_0x9de991[_0x0418('0x1d')](_0x34bb94)['send'](_0x121a7d);};}exports[_0x0418('0x34')]=function(_0x524fab,_0x571e37){var _0x4fe0d9={},_0x4d0fcd={'count':0x0,'rows':[]};var _0x1d3c22=_(db[_0x0418('0x35')][_0x0418('0x36')])['map'](function(_0x4c29ed){return{'name':_0x4c29ed[_0x0418('0x37')],'type':_0x4c29ed[_0x0418('0x38')][_0x0418('0x39')]};})[_0x0418('0x2d')](function(_0x5496f2){return!_[_0x0418('0x2f')](['password','salt'],_0x5496f2[_0x0418('0x30')]);})[_0x0418('0x2e')]();_0x4fe0d9=qs[_0x0418('0x3a')](_0x1d3c22,_0x524fab);var _0xa91962={'where':_0x4fe0d9[_0x0418('0x3b')]};return db['User'][_0x0418('0x20')](_0xa91962)[_0x0418('0x11')](function(_0x88c2fd){_0x4d0fcd[_0x0418('0x20')]=_0x88c2fd;if(_0x524fab[_0x0418('0x3c')][_0x0418('0x3d')]){_0x4fe0d9[_0x0418('0x3e')]=[{'all':!![]}];}if(_0x524fab[_0x0418('0x3c')]['userSetting']===_0x0418('0x3f')){_0x4fe0d9[_0x0418('0x3e')]=[{'model':db['UserSetting'],'as':_0x0418('0x40')}];}if(!_[_0x0418('0x2f')](_0x4fe0d9[_0x0418('0x41')],'id')){_0x4fe0d9['attributes']['push']('id');}return db[_0x0418('0x35')][_0x0418('0x42')](_0x4fe0d9);})[_0x0418('0x11')](function(_0x2bab50){_0x4d0fcd['rows']=_0x2bab50;if(_0x524fab[_0x0418('0x3c')][_0x0418('0x43')]===_0x0418('0x3f')){var _0x27d4de=[];for(var _0x1792df=0x0;_0x1792df<_0x4d0fcd[_0x0418('0x44')][_0x0418('0x45')];_0x1792df++){_0x27d4de[_0x0418('0x46')](get_open_tabs(_0x0418('0x47'),_0x4d0fcd['rows'][_0x1792df]['dataValues']));_0x27d4de[_0x0418('0x46')](get_open_tabs(_0x0418('0x48'),_0x4d0fcd[_0x0418('0x44')][_0x1792df]['dataValues']));_0x27d4de[_0x0418('0x46')](get_open_tabs('fax',_0x4d0fcd[_0x0418('0x44')][_0x1792df][_0x0418('0x49')]));_0x27d4de[_0x0418('0x46')](get_open_tabs(_0x0418('0x4a'),_0x4d0fcd[_0x0418('0x44')][_0x1792df][_0x0418('0x49')]));_0x27d4de[_0x0418('0x46')](get_open_tabs('openchannel',_0x4d0fcd[_0x0418('0x44')][_0x1792df]['dataValues']));_0x27d4de[_0x0418('0x46')](get_open_tabs(_0x0418('0x4b'),_0x4d0fcd[_0x0418('0x44')][_0x1792df][_0x0418('0x49')]));}return BPromise[_0x0418('0x4c')](_0x27d4de)[_0x0418('0x11')](function(){return _0x4d0fcd;});}else{return _0x4d0fcd;}})[_0x0418('0x11')](respondWithFilteredResult(_0x571e37,_0x4fe0d9))[_0x0418('0x1b')](handleError(_0x571e37,null));};exports['show']=function(_0x34f234,_0x51941f){var _0x5339c4={'raw':![],'where':{'id':_0x34f234[_0x0418('0x4d')]['id']}},_0x18a97f={};_0x18a97f[_0x0418('0x4e')]=_[_0x0418('0x4f')](_[_0x0418('0x50')](db[_0x0418('0x35')]['rawAttributes']),[_0x0418('0x51'),_0x0418('0x52')]);_0x18a97f['query']=_[_0x0418('0x50')](_0x34f234[_0x0418('0x3c')]);_0x18a97f[_0x0418('0x53')]=_[_0x0418('0x54')](_0x18a97f[_0x0418('0x4e')],_0x18a97f['query']);_0x5339c4[_0x0418('0x41')]=_['intersection'](_0x18a97f['model'],qs[_0x0418('0x55')](_0x34f234['query'][_0x0418('0x55')]));_0x5339c4[_0x0418('0x41')]=_0x5339c4[_0x0418('0x41')][_0x0418('0x45')]?_0x5339c4[_0x0418('0x41')]:_0x18a97f[_0x0418('0x4e')];if(_0x34f234[_0x0418('0x3c')]['includeAll']){_0x5339c4[_0x0418('0x3e')]=[{'all':!![]}];}if(_0x34f234['query']['userSetting']===_0x0418('0x3f')){_0x5339c4['include']=[{'model':db[_0x0418('0x56')],'as':_0x0418('0x40')}];}_0x5339c4=_['merge']({},_0x5339c4,_0x34f234[_0x0418('0x57')]);if(!_['includes'](_0x5339c4[_0x0418('0x41')],'id')){_0x5339c4['attributes'][_0x0418('0x46')]('id');}return db['User']['find'](_0x5339c4)[_0x0418('0x11')](handleEntityNotFound(_0x51941f,null))[_0x0418('0x11')](function(_0x589527){var _0xe019fe=[];values=_0x589527;if(_0x34f234['query'][_0x0418('0x43')]===_0x0418('0x3f')){_0xe019fe[_0x0418('0x46')](get_open_tabs(_0x0418('0x47'),_0x589527[_0x0418('0x49')]));_0xe019fe['push'](get_open_tabs('sms',_0x589527[_0x0418('0x49')]));_0xe019fe['push'](get_open_tabs('openchannel',_0x589527['dataValues']));_0xe019fe['push'](get_open_tabs(_0x0418('0x4b'),_0x589527[_0x0418('0x49')]));_0xe019fe[_0x0418('0x46')](get_open_tabs(_0x0418('0x58'),_0x589527['dataValues']));_0xe019fe[_0x0418('0x46')](get_open_tabs(_0x0418('0x4a'),_0x589527[_0x0418('0x49')]));return BPromise[_0x0418('0x4c')](_0xe019fe);}else{return values;}})['then'](function(){return values;})[_0x0418('0x11')](respondWithResult(_0x51941f,null))[_0x0418('0x1b')](handleError(_0x51941f,null));};exports[_0x0418('0x24')]=function(_0x1fa578,_0x472371){if(_0x1fa578[_0x0418('0x59')]['id']){delete _0x1fa578[_0x0418('0x59')]['id'];}delete _0x1fa578['body'][_0x0418('0x27')];return db[_0x0418('0x35')][_0x0418('0x5a')]({'where':{'id':_0x1fa578['params']['id']}})[_0x0418('0x11')](handleEntityNotFound(_0x472371,null))[_0x0418('0x11')](saveUpdates(_0x1fa578[_0x0418('0x59')],null))[_0x0418('0x11')](respondWithResult(_0x472371,null))[_0x0418('0x1b')](handleError(_0x472371,null));};exports[_0x0418('0x5b')]=function(_0x4ffabc,_0x2765f8){return db['User'][_0x0418('0x5b')]()['then'](respondWithResult(_0x2765f8,null))[_0x0418('0x1b')](handleError(_0x2765f8,null));};exports[_0x0418('0x5c')]=function(_0xd5d870,_0x5baeb3){return db[_0x0418('0x35')][_0x0418('0x5a')]({'where':{'id':_0xd5d870['params']['id']}})[_0x0418('0x11')](handleEntityNotFound(_0x5baeb3,null))[_0x0418('0x11')](function(_0x5d9046){if(_0x5d9046){return _0x5d9046['addContacts'](_0xd5d870[_0x0418('0x59')]['ids'],_[_0x0418('0x5d')](_0xd5d870[_0x0418('0x59')],[_0x0418('0x5e'),'id'])||{});}})[_0x0418('0x11')](respondWithResult(_0x5baeb3,null))[_0x0418('0x1b')](handleError(_0x5baeb3,null));};function validateUser(_0x3ee23a){return new BPromise(function(_0x5f4472,_0x577ca6){if(_0x3ee23a[_0x0418('0x5f')])return _0x5f4472(_0x3ee23a);return db[_0x0418('0x60')][_0x0418('0x61')](0x1)[_0x0418('0x11')](function(_0xbd65e2){if(_0xbd65e2['securePassword'])authService[_0x0418('0x62')](_0x3ee23a[_0x0418('0x51')]);db[_0x0418('0x35')][_0x0418('0x63')](_0x0418('0x5f'))[_0x0418('0x11')](function(_0x4bdd8e){if(_[_0x0418('0x64')](_0x4bdd8e)){_0x3ee23a[_0x0418('0x5f')]=_0xbd65e2[_0x0418('0x65')]||0x1;return;}if(_['isNil'](_0xbd65e2[_0x0418('0x65')])||_0xbd65e2[_0x0418('0x65')]===_0x4bdd8e){_0x3ee23a[_0x0418('0x5f')]=_0x4bdd8e+0x1;return;}if(_0xbd65e2[_0x0418('0x65')]>_0x4bdd8e){_0x3ee23a[_0x0418('0x5f')]=_0xbd65e2[_0x0418('0x65')];return;}return db[_0x0418('0x66')][_0x0418('0x3c')](_0x0418('0x67'),{'type':db[_0x0418('0x66')][_0x0418('0x68')][_0x0418('0x69')]})['then'](function(_0xc56091){if(_0xc56091&&_0xc56091['length']){for(var _0x572262=0x0,_0xe9d141=_0xc56091['length'];_0x572262<_0xe9d141&&_[_0x0418('0x64')](_0x3ee23a[_0x0418('0x5f')]);_0x572262++){if(_0xbd65e2['min_internal']<=_0xc56091[_0x572262][_0x0418('0x6a')]){_0x3ee23a[_0x0418('0x5f')]=_0xc56091[_0x572262][_0x0418('0x6a')];}else if(_0xbd65e2[_0x0418('0x65')]>_0xc56091[_0x572262][_0x0418('0x6a')]&&_0xbd65e2['min_internal']<=_0xc56091[_0x572262]['to']){_0x3ee23a[_0x0418('0x5f')]=_0xbd65e2[_0x0418('0x65')];}}}if(_[_0x0418('0x64')](_0x3ee23a[_0x0418('0x5f')])){_0x3ee23a[_0x0418('0x5f')]=_0x4bdd8e+0x1;}return _0x5f4472(_0x3ee23a);});});})['catch'](function(_0x268e9d){_0x577ca6(_0x268e9d);});});}function updateUser(_0x5d538c){return new BPromise(function(_0x3aad35,_0x3b6410){try{if(_0x5d538c[_0x0418('0x6b')]){_0x5d538c['mailbox']=_0x5d538c[_0x0418('0x5f')];_0x5d538c[_0x0418('0x6c')]={'mailbox':_0x5d538c[_0x0418('0x5f')],'password':_0x5d538c[_0x0418('0x51')],'fullname':_0x5d538c['fullname'],'email':_0x5d538c[_0x0418('0x6d')]};}if(_0x5d538c[_0x0418('0x27')]===_0x0418('0x2a')){if(!_0x5d538c['permissions'])_0x5d538c[_0x0418('0x6e')]=[_0x0418('0x6f'),_0x0418('0x70'),_0x0418('0x71'),_0x0418('0x72'),'110',_0x0418('0x73'),'105','106','107',_0x0418('0x74'),_0x0418('0x75'),'100',_0x0418('0x76'),_0x0418('0x77'),_0x0418('0x78')];}_0x3aad35(_0x5d538c);}catch(_0xb05cc8){_0x3b6410(_0xb05cc8);}});}exports[_0x0418('0x79')]=function(_0x54460b,_0x13d542){if(_0x54460b[_0x0418('0x29')]['role']===_0x0418('0x2a'))throw new Error(_0x0418('0x7a'));if(_0x54460b[_0x0418('0x59')][_0x0418('0x27')]==='user'&&_0x54460b[_0x0418('0x29')][_0x0418('0x27')]!==_0x0418('0x28')){throw new Error(_0x0418('0x7b'));}if(_0x54460b[_0x0418('0x59')][_0x0418('0x27')]===_0x0418('0x28')&&_0x54460b['user'][_0x0418('0x27')]!==_0x0418('0x28')){throw new Error(_0x0418('0x7c'));}return licenseUtil['checkUserLimits']([_0x54460b[_0x0418('0x59')]])[_0x0418('0x11')](function(){return validateUser(_0x54460b['body']);})['then'](function(_0x303d01){return updateUser(_0x303d01)[_0x0418('0x11')](function(_0x3ab211){if(_0x3ab211['role']==='admin'){_0x3ab211[_0x0418('0x7d')]=_0x54460b[_0x0418('0x29')][_0x0418('0x7d')];delete _0x3ab211['userProfileId'];}return _0x3ab211;});})[_0x0418('0x11')](function(_0xc8680b){return db[_0x0418('0x35')]['create'](_0xc8680b,{'include':[{'model':db['VoiceMail'],'as':_0x0418('0x6c')}]});})[_0x0418('0x11')](function(_0x5aa631){if(_0x54460b[_0x0418('0x59')]['role']==='user')return _0x5aa631;if(_0x54460b[_0x0418('0x29')][_0x0418('0x27')]!==_0x0418('0x29'))return _0x5aa631;return db[_0x0418('0x7e')][_0x0418('0x5a')]({'where':{'name':_0x5aa631[_0x0418('0x27')]===_0x0418('0x2a')?_0x0418('0x7f'):_0x0418('0x2b'),'userProfileId':_0x54460b[_0x0418('0x29')]['userProfileId']},'raw':!![]})[_0x0418('0x11')](function(_0x11f1a1){if(!_0x11f1a1||_0x11f1a1[_0x0418('0x80')]!=0x0)return _0x5aa631;return db[_0x0418('0x31')][_0x0418('0x79')]({'name':_0x5aa631['name'],'resourceId':_0x5aa631['id'],'type':_0x11f1a1['name'],'sectionId':_0x11f1a1['id']},{})[_0x0418('0x11')](function(){return _0x5aa631;});})[_0x0418('0x1b')](function(_0xcb056a){logger[_0x0418('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcb056a);throw _0xcb056a;});})[_0x0418('0x11')](respondWithResult(_0x13d542,0xc9))[_0x0418('0x1b')](handleError(_0x13d542,null));};exports[_0x0418('0x81')]=function(_0x505ab0,_0x429a92){var _0x266115=_0x505ab0[_0x0418('0x59')];var _0x50d593=[];if(_0x505ab0['user'][_0x0418('0x27')]==='agent')throw new Error('Unauthorized');if(_[_0x0418('0x82')](_0x266115,['role',_0x0418('0x29')])&&_0x505ab0[_0x0418('0x29')][_0x0418('0x27')]!==_0x0418('0x28')){throw new Error(_0x0418('0x7b'));}if(_[_0x0418('0x82')](_0x266115,[_0x0418('0x27'),_0x0418('0x28')])&&_0x505ab0[_0x0418('0x29')][_0x0418('0x27')]!==_0x0418('0x28')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x0418('0x83')](_0x266115)[_0x0418('0x11')](function(){return validateUser(_0x266115[0x0]);})[_0x0418('0x11')](function(){for(var _0x1f13e3=0x1;_0x1f13e3<_0x266115[_0x0418('0x45')];_0x1f13e3++){var _0x226689=_0x266115[_0x1f13e3-0x1][_0x0418('0x5f')];if(!_0x266115[_0x1f13e3][_0x0418('0x5f')])_0x266115[_0x1f13e3][_0x0418('0x5f')]=_0x226689+0x1;_0x50d593[_0x0418('0x46')](validateUser(_0x266115[_0x1f13e3]));}return BPromise[_0x0418('0x4c')](_0x50d593);})[_0x0418('0x11')](function(){_0x50d593=[];for(var _0x25fbec=0x0;_0x25fbec<_0x266115[_0x0418('0x45')];_0x25fbec++){_0x50d593[_0x0418('0x46')](updateUser(_0x266115[_0x25fbec]));}return BPromise[_0x0418('0x4c')](_0x50d593);})[_0x0418('0x11')](function(){return BPromise[_0x0418('0x84')](_0x266115,function(_0x3b076b){return db[_0x0418('0x35')][_0x0418('0x79')](_0x3b076b,{'include':[{'model':db['VoiceMail'],'as':_0x0418('0x6c')}]})[_0x0418('0x11')](function(_0x1af16a){_0x3b076b['id']=_0x1af16a['id'];return _0x3b076b;});});})[_0x0418('0x11')](function(_0x4de68d){if(_0x505ab0['body']['role']==='user')return _0x4de68d;if(_0x505ab0['user']['role']!==_0x0418('0x29'))return _0x4de68d;var _0x4ea6f5=_['some'](_0x4de68d,function(_0x9cd4d4){return _0x9cd4d4[_0x0418('0x27')]==='agent'||_0x9cd4d4[_0x0418('0x27')]===_0x0418('0x2c');});if(!_0x4ea6f5)return _0x4de68d;return db[_0x0418('0x7e')][_0x0418('0x42')]({'where':{'name':{'$or':[_0x0418('0x7f'),_0x0418('0x2b')]},'userProfileId':_0x505ab0['user'][_0x0418('0x85')]},'raw':!![]})['then'](function(_0x1af432){if(_[_0x0418('0x86')](_0x1af432)||!_[_0x0418('0x82')](_0x1af432,[_0x0418('0x80'),0x0]))return _0x4de68d;_0x50d593=[];var _0x21d413=_(_0x1af432)[_0x0418('0x87')](function(_0x1f67bb){if(_0x1f67bb[_0x0418('0x80')]===0x1)return;return _0x1f67bb[_0x0418('0x30')]===_0x0418('0x7f')?_0x0418('0x2a'):_0x0418('0x2c');})[_0x0418('0x88')]()['value']();for(var _0x56b7da=0x0;_0x56b7da<_0x4de68d[_0x0418('0x45')];_0x56b7da++){if(!_[_0x0418('0x2f')](_0x21d413,_0x4de68d[_0x56b7da][_0x0418('0x27')]))return;var _0x1c3b60=_0x4de68d[_0x56b7da][_0x0418('0x27')]===_0x0418('0x2a')?_0x0418('0x7f'):_0x0418('0x2b');_0x50d593[_0x0418('0x46')](db[_0x0418('0x31')][_0x0418('0x79')]({'name':_0x4de68d[_0x56b7da]['name'],'resourceId':_0x4de68d[_0x56b7da]['id'],'type':_0x1c3b60,'sectionId':_[_0x0418('0x5a')](_0x1af432,[_0x0418('0x30'),_0x1c3b60])['id']},{}));}return BPromise['all'](_0x50d593);});})[_0x0418('0x11')](respondWithResult(_0x429a92,0xc9))[_0x0418('0x1b')](handleError(_0x429a92,null));};exports[_0x0418('0x89')]=function(_0x29223c,_0x7677d7){if(_0x29223c[_0x0418('0x59')]['id']){delete _0x29223c['body']['id'];}return db[_0x0418('0x35')][_0x0418('0x5a')]({'where':{'id':_0x29223c[_0x0418('0x4d')]['id']}})[_0x0418('0x11')](function(_0x3c5d80){if(!_0x3c5d80)return null;if(_0x3c5d80['id']===_0x29223c[_0x0418('0x29')]['id']){if(!_0x29223c[_0x0418('0x59')][_0x0418('0x8a')]||!_0x29223c[_0x0418('0x59')]['newPassword']){throw new db[(_0x0418('0x8b'))]['ValidationError'](_0x0418('0x8c'));}if(!_0x3c5d80[_0x0418('0x8d')](_0x29223c[_0x0418('0x59')]['oldPassword'])){throw new db['Sequelize'][(_0x0418('0x8e'))](_0x0418('0x8f'));}if(_0x29223c[_0x0418('0x59')][_0x0418('0x8a')]===_0x29223c[_0x0418('0x59')][_0x0418('0x90')]){throw new db[(_0x0418('0x8b'))][(_0x0418('0x8e'))](_0x0418('0x91'));}}else if(_0x29223c[_0x0418('0x29')][_0x0418('0x27')]==='admin'){if(!_0x29223c[_0x0418('0x59')][_0x0418('0x90')]){throw new db[(_0x0418('0x8b'))]['ValidationError'](_0x0418('0x92'));}}else if(_0x29223c[_0x0418('0x29')][_0x0418('0x27')]===_0x0418('0x29')){if(!_0x29223c['body']['newPassword']){throw new db[(_0x0418('0x8b'))][(_0x0418('0x8e'))](_0x0418('0x92'));}if(_0x3c5d80['role']!=='agent'){throw new db[(_0x0418('0x8b'))]['ValidationError'](_0x0418('0x7a'));}}else{throw new db[(_0x0418('0x8b'))][(_0x0418('0x8e'))](_0x0418('0x7a'));}return _0x3c5d80;})[_0x0418('0x11')](handleEntityNotFound(_0x7677d7,null))[_0x0418('0x11')](function(_0xb61601){return db[_0x0418('0x60')][_0x0418('0x93')]({'attributes':['id',_0x0418('0x94'),'enforcePasswordHistory',_0x0418('0x95')]})[_0x0418('0x11')](function(_0x53f450){if(_0x53f450[_0x0418('0x94')])authService[_0x0418('0x62')](_0x29223c[_0x0418('0x59')][_0x0418('0x90')]);if(!_0x53f450[_0x0418('0x96')]||!_0xb61601['previousPasswords'])return _0xb61601;authService[_0x0418('0x97')](_0x29223c[_0x0418('0x59')][_0x0418('0x90')],_0xb61601[_0x0418('0x98')],_0x53f450[_0x0418('0x95')]);return _0xb61601;})[_0x0418('0x11')](saveUpdates({'password':_0x29223c[_0x0418('0x59')][_0x0418('0x90')],'passwordResetAt':_0x29223c[_0x0418('0x29')]['id']==_0x29223c[_0x0418('0x4d')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x29223c[_0x0418('0x59')][_0x0418('0x90')],_0xb61601[_0x0418('0x98')])},null));})['then'](respondWithResult(_0x7677d7,null))['catch'](handleError(_0x7677d7,null));};exports[_0x0418('0x99')]=function(_0x33b0d0,_0x1c3a5e){var _0xc549f1=_0x33b0d0[_0x0418('0x59')]['channel'];return db['User'][_0x0418('0x5a')]({'where':{'id':_0x33b0d0[_0x0418('0x4d')]['id']},'attributes':['id',_0x0418('0x30'),_0x0418('0x27'),'online',_0x0418('0x9a'),'voicePause',_0x0418('0x9b')]})[_0x0418('0x11')](handleEntityNotFound(_0x1c3a5e,null))['then'](function(_0x580efd){if(_0x580efd){if(!utils[_0x0418('0x9c')](_0xc549f1)){throw new db[(_0x0418('0x8b'))][(_0x0418('0x8e'))](_0x0418('0x9d'));}return _0x580efd['add'+_[_0x0418('0x9e')](_0xc549f1[_0x0418('0x9f')]())+_0x0418('0xa0')](_0x33b0d0['body'][_0x0418('0x5e')],{'penalty':_0x33b0d0[_0x0418('0x59')][_0x0418('0xa1')]||0x0})['spread'](function(_0x39a022){for(var _0x52a75c=0x0;_0x52a75c<_0x33b0d0[_0x0418('0x59')][_0x0418('0x5e')][_0x0418('0x45')];_0x52a75c+=0x1){var _0x149b58={'UserId':Number(_0x33b0d0['params']['id'])};_0x149b58[_[_0x0418('0x9e')](_0xc549f1[_0x0418('0x9f')]())+_0x0418('0xa2')]=Number(_0x33b0d0['body'][_0x0418('0x5e')][_0x52a75c]);socket[_0x0418('0xa3')](_0x0418('0x29')+_[_0x0418('0x9e')](_0xc549f1[_0x0418('0x9f')]())+'Queue:save',_0x149b58);}return _0x39a022;})[_0x0418('0x11')](function(){if(_0xc549f1===_0x0418('0xa4')){return db['VoiceQueue'][_0x0418('0x42')]({'where':{'id':_0x33b0d0[_0x0418('0x59')][_0x0418('0x5e')]||[]},'raw':!![],'attributes':['id',_0x0418('0x30')]});}})[_0x0418('0x11')](function(_0x1567b3){var _0x148493=_0x580efd['get']({'plain':!![]});var _0x48a87d=[];if(_0xc549f1===_0x0418('0xa4')&&_0x148493[_0x0418('0x27')]==='agent'&&_0x148493[_0x0418('0xa5')]){for(var _0x54c572=0x0;_0x54c572<_0x1567b3[_0x0418('0x45')];_0x54c572+=0x1){_0x48a87d['push']({'membername':_0x148493['name'],'UserId':_0x148493['id'],'queue_name':_0x1567b3[_0x54c572][_0x0418('0x30')],'VoiceQueueId':_0x1567b3[_0x54c572]['id'],'interface':_[_0x0418('0x64')](_0x148493[_0x0418('0x9b')])?util['format']('SIP/%s',_0x148493[_0x0418('0x30')]):_0x148493[_0x0418('0x9b')],'paused':_0x148493[_0x0418('0xa6')]||![],'penalty':_0x33b0d0[_0x0418('0x59')][_0x0418('0xa1')]||0x0});}return BPromise['each'](_0x48a87d,function(_0x2600df){return db[_0x0418('0xa7')][_0x0418('0xa8')](_0x2600df);});}return _0x580efd;});}})[_0x0418('0x11')](respondWithStatusCode(_0x1c3a5e,null))[_0x0418('0x1b')](handleError(_0x1c3a5e,null));};exports['removeQueues']=function(_0xb0c55e,_0x23a7a6){var _0x14ec81,_0x2a88e3;return db[_0x0418('0x35')][_0x0418('0x5a')]({'where':{'id':_0xb0c55e[_0x0418('0x4d')]['id']},'attributes':['id','name',_0x0418('0x27')]})[_0x0418('0x11')](handleEntityNotFound(_0x23a7a6,null))['then'](function(_0x15aa5c){if(_0x15aa5c){_0x14ec81=_0x15aa5c;if(!_0xb0c55e[_0x0418('0x3c')][_0x0418('0xa9')]||!utils[_0x0418('0x9c')](_0xb0c55e[_0x0418('0x3c')]['channel'])){throw new db['Sequelize']['ValidationError'](_0x0418('0x9d'));}return _0x15aa5c[_0x0418('0xaa')+_[_0x0418('0x9e')](_0xb0c55e[_0x0418('0x3c')][_0x0418('0xa9')][_0x0418('0x9f')]())+_0x0418('0xa0')](_0xb0c55e[_0x0418('0x3c')]['ids']);}})[_0x0418('0x11')](function(_0x2c486d){if(_[_0x0418('0xab')](_0xb0c55e[_0x0418('0x3c')][_0x0418('0x5e')])){for(var _0x581a7d=0x0;_0x581a7d<_0xb0c55e['query'][_0x0418('0x5e')][_0x0418('0x45')];_0x581a7d+=0x1){_0x2a88e3={'UserId':Number(_0xb0c55e[_0x0418('0x4d')]['id'])};_0x2a88e3[_[_0x0418('0x9e')](_0xb0c55e[_0x0418('0x3c')][_0x0418('0xa9')][_0x0418('0x9f')]())+_0x0418('0xa2')]=Number(_0xb0c55e[_0x0418('0x3c')][_0x0418('0x5e')][_0x581a7d]);socket[_0x0418('0xa3')](_0x0418('0x29')+_[_0x0418('0x9e')](_0xb0c55e[_0x0418('0x3c')]['channel']['toLowerCase']())+'Queue:remove',_0x2a88e3);}}else{_0x2a88e3={'UserId':Number(_0xb0c55e['params']['id'])};_0x2a88e3[_[_0x0418('0x9e')](_0xb0c55e[_0x0418('0x3c')][_0x0418('0xa9')][_0x0418('0x9f')]())+_0x0418('0xa2')]=Number(_0xb0c55e[_0x0418('0x3c')][_0x0418('0x5e')]);socket[_0x0418('0xa3')]('user'+_[_0x0418('0x9e')](_0xb0c55e['query'][_0x0418('0xa9')][_0x0418('0x9f')]())+_0x0418('0xac'),_0x2a88e3);}return _0x2c486d;})['then'](function(){if(_0xb0c55e['query']['channel']===_0x0418('0xa4')){return db[_0x0418('0xa7')][_0x0418('0x25')]({'where':{'UserId':_0xb0c55e[_0x0418('0x4d')]['id'],'VoiceQueueId':_0xb0c55e[_0x0418('0x3c')]['ids']},'individualHooks':!![]})[_0x0418('0x11')](function(){return _0x14ec81;});}return _0x14ec81;})[_0x0418('0x11')](respondWithStatusCode(_0x23a7a6,null))['catch'](handleError(_0x23a7a6,null));};exports[_0x0418('0xad')]=function(_0x1e20f8,_0x38723b){_0x1e20f8[_0x0418('0x59')][_0x0418('0xae')]=_0x1e20f8[_0x0418('0xaf')][_0x0418('0xb0')];return db[_0x0418('0x35')][_0x0418('0x5a')]({'where':{'id':_0x1e20f8[_0x0418('0x4d')]['id']}})['then'](handleEntityNotFound(_0x38723b,null))[_0x0418('0x11')](saveUpdates(_0x1e20f8[_0x0418('0x59')],null))[_0x0418('0x11')](respondWithResult(_0x38723b,null))[_0x0418('0x1b')](handleError(_0x38723b,null));};exports['getAvatar']=function(_0x28c0e1,_0x284d12){var _0x54b35f=path['join'](config['root'],_0x0418('0xb1'));return db[_0x0418('0x35')][_0x0418('0x5a')]({'where':{'id':_0x28c0e1[_0x0418('0x4d')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x0418('0x11')](handleEntityNotFound(_0x284d12,null))['then'](function(_0x398634){if(_0x398634){if(_[_0x0418('0x64')](_0x398634[_0x0418('0xae')])){return _0x284d12[_0x0418('0xb2')](_0x54b35f);}else{if(!fs[_0x0418('0xb3')](path[_0x0418('0xb4')](config[_0x0418('0xb5')],_0x0418('0xb6'),_0x398634['userpic']))){return _0x284d12['download'](_0x54b35f);}return _0x284d12['download'](path[_0x0418('0xb4')](config[_0x0418('0xb5')],'server/files/images/',_0x398634[_0x0418('0xae')]));}}})[_0x0418('0x1b')](handleError(_0x284d12,null));};exports[_0x0418('0xb7')]=function(_0x43b01f,_0x1662e8){return db[_0x0418('0x35')][_0x0418('0x5a')]({'where':{'id':_0x43b01f['params']['id']},'attributes':['id']})[_0x0418('0x11')](handleEntityNotFound(_0x1662e8,null))['then'](function(_0x225b2d){var _0x3d5efe=[];values=_0x225b2d[_0x0418('0x49')];_0x3d5efe[_0x0418('0x46')](get_open_tabs('chat',_0x225b2d[_0x0418('0x49')]));_0x3d5efe[_0x0418('0x46')](get_open_tabs(_0x0418('0x48'),_0x225b2d['dataValues']));_0x3d5efe[_0x0418('0x46')](get_open_tabs(_0x0418('0xb8'),_0x225b2d[_0x0418('0x49')]));_0x3d5efe[_0x0418('0x46')](get_open_tabs('whatsapp',_0x225b2d[_0x0418('0x49')]));_0x3d5efe[_0x0418('0x46')](get_open_tabs(_0x0418('0x58'),_0x225b2d[_0x0418('0x49')]));_0x3d5efe[_0x0418('0x46')](get_open_tabs('mail',_0x225b2d[_0x0418('0x49')]));return BPromise[_0x0418('0x4c')](_0x3d5efe);})['then'](function(_0x48cf31){if(_0x48cf31){var _0x349583=_[_0x0418('0x87')](values[_0x0418('0xb9')],function(_0x2d48db){return{'channel':'CHAT','id':_0x2d48db['id'],'createdAt':_0x2d48db[_0x0418('0xba')]};});var _0x1e076c=_[_0x0418('0x87')](values[_0x0418('0xbb')],function(_0x1b04d3){return{'channel':'FAX','id':_0x1b04d3['id'],'createdAt':_0x1b04d3[_0x0418('0xba')]};});var _0x5bd886=_[_0x0418('0x87')](values[_0x0418('0xbc')],function(_0x1686e4){return{'channel':_0x0418('0xbd'),'id':_0x1686e4['id'],'createdAt':_0x1686e4['createdAt']};});var _0xe742b=_[_0x0418('0x87')](values[_0x0418('0xbe')],function(_0x59f916){return{'channel':'MAIL','id':_0x59f916['id'],'createdAt':_0x59f916[_0x0418('0xba')]};});var _0x22efdb=_[_0x0418('0x87')](values[_0x0418('0xbf')],function(_0xd77aed){return{'channel':_0x0418('0xc0'),'id':_0xd77aed['id'],'createdAt':_0xd77aed[_0x0418('0xba')]};});var _0x15e55b=_['map'](values[_0x0418('0xc1')],function(_0x3121f3){return{'channel':_0x0418('0xc2'),'id':_0x3121f3['id'],'createdAt':_0x3121f3['createdAt']};});var _0x55da8c=_['concat'](_0x349583,_0x1e076c,_0x5bd886,_0xe742b,_0x22efdb,_0x15e55b);var _0x45b691={'count':_0x55da8c[_0x0418('0x45')],'rows':_0x55da8c};return _0x45b691;}else return null;})[_0x0418('0x11')](respondWithResult(_0x1662e8,null))['catch'](handleError(_0x1662e8,null));};exports[_0x0418('0xc3')]=function(_0x23180b,_0x526383){var _0x16e6a8={};var _0x534044={};var _0x2e91eb;var _0x4f65a6;return db['User']['findOne']({'where':{'id':_0x23180b['params']['id']}})['then'](handleEntityNotFound(_0x526383,null))[_0x0418('0x11')](function(_0x2d19a5){if(_0x2d19a5){_0x2e91eb=_0x2d19a5;_0x534044['model']=_['keys'](db['CmContact'][_0x0418('0x36')]);_0x534044['query']=_[_0x0418('0x50')](_0x23180b[_0x0418('0x3c')]);_0x534044['filters']=_['intersection'](_0x534044[_0x0418('0x4e')],_0x534044[_0x0418('0x3c')]);_0x16e6a8[_0x0418('0x41')]=_['intersection'](_0x534044[_0x0418('0x4e')],qs[_0x0418('0x55')](_0x23180b['query']['fields']));_0x16e6a8[_0x0418('0x41')]=_0x16e6a8[_0x0418('0x41')]['length']?_0x16e6a8[_0x0418('0x41')]:_0x534044[_0x0418('0x4e')];_0x16e6a8[_0x0418('0xc4')]=qs['sort'](_0x23180b[_0x0418('0x3c')]['sort']);_0x16e6a8[_0x0418('0x3b')]=qs[_0x0418('0x53')](_[_0x0418('0xc5')](_0x23180b[_0x0418('0x3c')],_0x534044[_0x0418('0x53')]));if(_0x23180b[_0x0418('0x3c')][_0x0418('0x2d')]){_0x16e6a8['where']=_[_0x0418('0xc6')](_0x16e6a8[_0x0418('0x3b')],{'$or':_[_0x0418('0x87')](_0x16e6a8[_0x0418('0x41')],function(_0x1964ce){var _0x34f4b8={};_0x34f4b8[_0x1964ce]={'$like':'%'+_0x23180b[_0x0418('0x3c')][_0x0418('0x2d')]+'%'};return _0x34f4b8;})});}_0x16e6a8=_[_0x0418('0xc6')]({},_0x16e6a8,_0x23180b[_0x0418('0x57')]);return _0x2e91eb['getContacts'](_0x16e6a8);}})[_0x0418('0x11')](function(_0x4a9bf2){if(_0x4a9bf2){_0x4f65a6=_0x4a9bf2[_0x0418('0x45')];if(_0x23180b['query']['hasOwnProperty'](_0x0418('0x3d'))){_0x16e6a8[_0x0418('0x3e')]=[{'model':db[_0x0418('0xc7')],'as':_0x0418('0xc8'),'required':![]},{'model':db[_0x0418('0xc9')],'as':'Tags','attributes':['id','name',_0x0418('0xca')],'where':_0x23180b['query'][_0x0418('0xcb')]?{'id':_0x23180b[_0x0418('0x3c')][_0x0418('0xcb')]}:undefined,'required':_0x23180b[_0x0418('0x3c')][_0x0418('0xcb')]?!![]:![]}];}if(!_0x23180b['query'][_0x0418('0xcc')](_0x0418('0xcd'))){_0x16e6a8[_0x0418('0x1e')]=qs[_0x0418('0x1e')](_0x23180b[_0x0418('0x3c')]['limit']);_0x16e6a8[_0x0418('0x21')]=qs[_0x0418('0x21')](_0x23180b[_0x0418('0x3c')]['offset']);}return _0x2e91eb[_0x0418('0xc3')](_0x16e6a8);}})[_0x0418('0x11')](function(_0x5db12f){if(_0x5db12f){return _0x5db12f?{'count':_0x4f65a6,'rows':_0x5db12f}:null;}})['then'](respondWithResult(_0x526383,null))[_0x0418('0x1b')](handleError(_0x526383,null));};exports[_0x0418('0xce')]=function(_0x4f7170,_0xf744bc){var _0x545251;var _0x31b420={};var _0x4ae6bc;return db['User'][_0x0418('0x93')]({'where':{'id':_0x4f7170[_0x0418('0x4d')]['id']},'attributes':['id',_0x0418('0x30'),'role']})[_0x0418('0x11')](handleEntityNotFound(_0xf744bc,null))[_0x0418('0x11')](function(_0x5d88dc){if(!utils[_0x0418('0x9c')](_0x4f7170[_0x0418('0x3c')]['channel'])){throw new db[(_0x0418('0x8b'))][(_0x0418('0x8e'))](_0x0418('0x9d'));}_0x545251=_0x5d88dc;var _0x270ef6={};_0x270ef6[_0x0418('0x4e')]=_[_0x0418('0x50')](db[_[_0x0418('0x9e')](_0x4f7170[_0x0418('0x3c')][_0x0418('0xa9')])+'Queue'][_0x0418('0x36')]);_0x270ef6['query']=_[_0x0418('0x50')](_0x4f7170[_0x0418('0x3c')]);_0x270ef6['filters']=_['intersection'](_0x270ef6[_0x0418('0x4e')],_0x270ef6[_0x0418('0x3c')]);_0x31b420[_0x0418('0x41')]=_[_0x0418('0x54')](_0x270ef6[_0x0418('0x4e')],qs['fields'](_0x4f7170['query']['fields']));_0x31b420[_0x0418('0x41')]=_0x31b420['attributes'][_0x0418('0x45')]?_0x31b420['attributes']:_0x270ef6['model'];_0x31b420['order']=qs[_0x0418('0xcf')](_0x4f7170[_0x0418('0x3c')][_0x0418('0xcf')]);_0x31b420[_0x0418('0x3b')]=qs[_0x0418('0x53')](_[_0x0418('0xc5')](_0x4f7170['query'],_0x270ef6[_0x0418('0x53')]));if(_0x4f7170['query'][_0x0418('0x2d')]){_0x31b420[_0x0418('0x3b')]=_[_0x0418('0xc6')](_0x31b420['where'],{'$or':_[_0x0418('0x87')](_0x31b420['attributes'],function(_0x5dd634){var _0x4b5497={};_0x4b5497[_0x5dd634]={'$like':'%'+_0x4f7170['query'][_0x0418('0x2d')]+'%'};return _0x4b5497;})});}_0x31b420=_['merge']({},_0x31b420,_0x4f7170[_0x0418('0x57')]);switch(_0x545251[_0x0418('0x27')]){case _0x0418('0x28'):return db[_[_0x0418('0x9e')](_0x4f7170[_0x0418('0x3c')][_0x0418('0xa9')])+'Queue'][_0x0418('0x42')](_0x31b420);case _0x0418('0x29'):case _0x0418('0x2a'):return _0x545251[_0x0418('0x26')+_[_0x0418('0x9e')](_0x4f7170['query'][_0x0418('0xa9')])+_0x0418('0xa0')](_0x31b420);default:throw new db[(_0x0418('0x8b'))][(_0x0418('0x8e'))](_0x0418('0xd0'));}})[_0x0418('0x11')](function(_0x3a5265){_0x4ae6bc=_0x3a5265[_0x0418('0x45')];if(!_0x4f7170[_0x0418('0x3c')][_0x0418('0xcc')]('nolimit')){_0x31b420['limit']=qs[_0x0418('0x1e')](_0x4f7170[_0x0418('0x3c')][_0x0418('0x1e')]);_0x31b420[_0x0418('0x21')]=qs['offset'](_0x4f7170['query'][_0x0418('0x21')]);}switch(_0x545251[_0x0418('0x27')]){case _0x0418('0x28'):return db[_[_0x0418('0x9e')](_0x4f7170[_0x0418('0x3c')][_0x0418('0xa9')])+_0x0418('0xd1')][_0x0418('0x42')](_0x31b420);case _0x0418('0x29'):case'agent':return _0x545251[_0x0418('0x26')+_[_0x0418('0x9e')](_0x4f7170[_0x0418('0x3c')][_0x0418('0xa9')])+'Queues'](_0x31b420);}})[_0x0418('0x11')](function(_0x27b1d7){return{'count':_0x4ae6bc,'rows':_0x27b1d7};})[_0x0418('0x11')](respondWithResult(_0xf744bc,null))[_0x0418('0x1b')](handleError(_0xf744bc,null));};exports[_0x0418('0xd2')]=function(_0x4552aa,_0x59ab8c){var _0x4bc54b={};var _0x42ed2c={};var _0x3a21c0;var _0x1cf25e;return db[_0x0418('0x35')][_0x0418('0x93')]({'where':{'id':_0x4552aa[_0x0418('0x4d')]['id']}})[_0x0418('0x11')](handleEntityNotFound(_0x59ab8c,null))[_0x0418('0x11')](function(_0x2cf188){if(_0x2cf188){_0x3a21c0=_0x2cf188;_0x42ed2c['model']=_[_0x0418('0x50')](db['UserVoiceQueueRt'][_0x0418('0x36')]);_0x42ed2c[_0x0418('0x3c')]=_[_0x0418('0x50')](_0x4552aa[_0x0418('0x3c')]);_0x42ed2c[_0x0418('0x53')]=_[_0x0418('0x54')](_0x42ed2c['model'],_0x42ed2c[_0x0418('0x3c')]);_0x4bc54b[_0x0418('0x41')]=_[_0x0418('0x54')](_0x42ed2c[_0x0418('0x4e')],qs[_0x0418('0x55')](_0x4552aa[_0x0418('0x3c')][_0x0418('0x55')]));_0x4bc54b[_0x0418('0x41')]=_0x4bc54b[_0x0418('0x41')][_0x0418('0x45')]?_0x4bc54b[_0x0418('0x41')]:_0x42ed2c['model'];_0x4bc54b[_0x0418('0xc4')]=qs['sort'](_0x4552aa[_0x0418('0x3c')]['sort']);_0x4bc54b[_0x0418('0x3b')]=qs[_0x0418('0x53')](_[_0x0418('0xc5')](_0x4552aa[_0x0418('0x3c')],_0x42ed2c[_0x0418('0x53')]));if(_0x4552aa[_0x0418('0x3c')][_0x0418('0x2d')]){_0x4bc54b[_0x0418('0x3b')]=_[_0x0418('0xc6')](_0x4bc54b['where'],{'$or':_[_0x0418('0x87')](_0x4bc54b[_0x0418('0x41')],function(_0x5c4a59){var _0x41d71f={};_0x41d71f[_0x5c4a59]={'$like':'%'+_0x4552aa['query'][_0x0418('0x2d')]+'%'};return _0x41d71f;})});}_0x4bc54b=_['merge']({},_0x4bc54b,_0x4552aa['options']);return _0x3a21c0[_0x0418('0xd2')](_0x4bc54b);}})[_0x0418('0x11')](function(_0x32a066){if(_0x32a066){_0x1cf25e=_0x32a066[_0x0418('0x45')];if(!_0x4552aa['query'][_0x0418('0xcc')](_0x0418('0xcd'))){_0x4bc54b[_0x0418('0x1e')]=qs[_0x0418('0x1e')](_0x4552aa[_0x0418('0x3c')][_0x0418('0x1e')]);_0x4bc54b[_0x0418('0x21')]=qs[_0x0418('0x21')](_0x4552aa[_0x0418('0x3c')][_0x0418('0x21')]);}return _0x3a21c0['getVoiceQueuesRt'](_0x4bc54b);}})[_0x0418('0x11')](function(_0x24de17){if(_0x24de17){return _0x24de17?{'count':_0x1cf25e,'rows':_0x24de17}:null;}})[_0x0418('0x11')](respondWithResult(_0x59ab8c,null))[_0x0418('0x1b')](handleError(_0x59ab8c,null));};exports[_0x0418('0xd3')]=function(_0x1941af,_0x45e09a){var _0x4369c1={};var _0x33d16a={};var _0x3fd39d;var _0x38d2b0;return db[_0x0418('0x35')][_0x0418('0x93')]({'where':{'id':_0x1941af[_0x0418('0x4d')]['id']}})['then'](handleEntityNotFound(_0x45e09a,null))[_0x0418('0x11')](function(_0x2f9da6){if(_0x2f9da6){_0x3fd39d=_0x2f9da6;_0x33d16a['model']=_['keys'](db[_0x0418('0xd4')][_0x0418('0x36')]);_0x33d16a[_0x0418('0x3c')]=_[_0x0418('0x50')](_0x1941af[_0x0418('0x3c')]);_0x33d16a[_0x0418('0x53')]=_[_0x0418('0x54')](_0x33d16a[_0x0418('0x4e')],_0x33d16a[_0x0418('0x3c')]);_0x4369c1[_0x0418('0x41')]=_['intersection'](_0x33d16a['model'],qs[_0x0418('0x55')](_0x1941af[_0x0418('0x3c')][_0x0418('0x55')]));_0x4369c1[_0x0418('0x41')]=_0x4369c1[_0x0418('0x41')][_0x0418('0x45')]?_0x4369c1['attributes']:_0x33d16a[_0x0418('0x4e')];_0x4369c1[_0x0418('0xc4')]=qs[_0x0418('0xcf')](_0x1941af[_0x0418('0x3c')][_0x0418('0xcf')]);_0x4369c1['where']=qs[_0x0418('0x53')](_[_0x0418('0xc5')](_0x1941af[_0x0418('0x3c')],_0x33d16a['filters']));if(_0x1941af[_0x0418('0x3c')][_0x0418('0x2d')]){_0x4369c1[_0x0418('0x3b')]=_[_0x0418('0xc6')](_0x4369c1[_0x0418('0x3b')],{'$or':_[_0x0418('0x87')](_0x4369c1[_0x0418('0x41')],function(_0x4764ca){var _0x3cac7d={};_0x3cac7d[_0x4764ca]={'$like':'%'+_0x1941af[_0x0418('0x3c')][_0x0418('0x2d')]+'%'};return _0x3cac7d;})});}_0x4369c1=_[_0x0418('0xc6')]({},_0x4369c1,_0x1941af[_0x0418('0x57')]);return _0x3fd39d[_0x0418('0xd3')](_0x4369c1);}})[_0x0418('0x11')](function(_0x1b9cfb){if(_0x1b9cfb){_0x38d2b0=_0x1b9cfb[_0x0418('0x45')];if(!_0x1941af['query'][_0x0418('0xcc')](_0x0418('0xcd'))){_0x4369c1[_0x0418('0x1e')]=qs[_0x0418('0x1e')](_0x1941af[_0x0418('0x3c')][_0x0418('0x1e')]);_0x4369c1[_0x0418('0x21')]=qs['offset'](_0x1941af['query'][_0x0418('0x21')]);}return _0x3fd39d[_0x0418('0xd3')](_0x4369c1);}})[_0x0418('0x11')](function(_0x4fd9d0){if(_0x4fd9d0){return _0x4fd9d0?{'count':_0x38d2b0,'rows':_0x4fd9d0}:null;}})[_0x0418('0x11')](respondWithResult(_0x45e09a,null))[_0x0418('0x1b')](handleError(_0x45e09a,null));};exports[_0x0418('0xd5')]=function(_0x3fa394,_0x15e0b9){var _0x343cfe={'raw':!![],'where':{}};var _0x1bf35f={};var _0x3985d3={'count':0x0,'rows':[]};return db[_0x0418('0x35')][_0x0418('0x93')]({'where':{'id':_0x3fa394[_0x0418('0x4d')]['id']}})[_0x0418('0x11')](handleEntityNotFound(_0x15e0b9,null))[_0x0418('0x11')](function(_0x123ca3){if(_0x123ca3){_0x1bf35f[_0x0418('0x4e')]=_[_0x0418('0x50')](db[_0x0418('0xd6')][_0x0418('0x36')]);_0x1bf35f[_0x0418('0x3c')]=_[_0x0418('0x50')](_0x3fa394[_0x0418('0x3c')]);_0x1bf35f[_0x0418('0x53')]=_[_0x0418('0x54')](_0x1bf35f[_0x0418('0x4e')],_0x1bf35f[_0x0418('0x3c')]);_0x343cfe[_0x0418('0x41')]=_[_0x0418('0x54')](_0x1bf35f[_0x0418('0x4e')],qs[_0x0418('0x55')](_0x3fa394[_0x0418('0x3c')][_0x0418('0x55')]));_0x343cfe[_0x0418('0x41')]=_0x343cfe[_0x0418('0x41')][_0x0418('0x45')]?_0x343cfe[_0x0418('0x41')]:_0x1bf35f[_0x0418('0x4e')];if(!_0x3fa394['query'][_0x0418('0xcc')](_0x0418('0xcd'))){_0x343cfe[_0x0418('0x1e')]=qs[_0x0418('0x1e')](_0x3fa394['query'][_0x0418('0x1e')]);_0x343cfe[_0x0418('0x21')]=qs[_0x0418('0x21')](_0x3fa394[_0x0418('0x3c')][_0x0418('0x21')]);}_0x343cfe[_0x0418('0xc4')]=qs[_0x0418('0xcf')](_0x3fa394[_0x0418('0x3c')][_0x0418('0xcf')]);_0x343cfe[_0x0418('0x3b')]=qs[_0x0418('0x53')](_['pick'](_0x3fa394['query'],_0x1bf35f[_0x0418('0x53')]));_0x343cfe[_0x0418('0x3b')][_0x0418('0xd7')]=_0x123ca3['id'];if(_0x3fa394[_0x0418('0x3c')][_0x0418('0x2d')]){_0x343cfe[_0x0418('0x3b')]=_[_0x0418('0xc6')](_0x343cfe[_0x0418('0x3b')],{'$or':_['map'](_0x343cfe[_0x0418('0x41')],function(_0x1a517d){var _0x5b1ba5={};_0x5b1ba5[_0x1a517d]={'$like':'%'+_0x3fa394[_0x0418('0x3c')]['filter']+'%'};return _0x5b1ba5;})});}_0x343cfe=_[_0x0418('0xc6')]({},_0x343cfe,_0x3fa394[_0x0418('0x57')]);return db[_0x0418('0xd6')][_0x0418('0x20')]({'where':_0x343cfe[_0x0418('0x3b')]})['then'](function(_0x5b657b){_0x3985d3['count']=_0x5b657b;if(_0x3fa394[_0x0418('0x3c')][_0x0418('0x3d')]){_0x343cfe[_0x0418('0x3e')]=[{'all':!![]}];}return db['VoiceRecording'][_0x0418('0x42')](_0x343cfe);})[_0x0418('0x11')](function(_0x4a7173){_0x3985d3['rows']=_0x4a7173;return _0x3985d3;});}})[_0x0418('0x11')](respondWithFilteredResult(_0x15e0b9,_0x343cfe))['catch'](handleError(_0x15e0b9,null));};exports[_0x0418('0xd8')]=function(_0x3b4cc6,_0x570706){var _0xb52490={'raw':!![],'where':{}};var _0x5d897b={};var _0x373f34={'count':0x0,'rows':[]};return db[_0x0418('0x35')][_0x0418('0x93')]({'where':{'id':_0x3b4cc6[_0x0418('0x4d')]['id']}})[_0x0418('0x11')](handleEntityNotFound(_0x570706,null))[_0x0418('0x11')](function(_0x38a2f2){if(_0x38a2f2){_0x5d897b[_0x0418('0x4e')]=_[_0x0418('0x50')](db[_0x0418('0xd9')][_0x0418('0x36')]);_0x5d897b[_0x0418('0x3c')]=_['keys'](_0x3b4cc6[_0x0418('0x3c')]);_0x5d897b['filters']=_[_0x0418('0x54')](_0x5d897b[_0x0418('0x4e')],_0x5d897b[_0x0418('0x3c')]);_0xb52490[_0x0418('0x41')]=_[_0x0418('0x54')](_0x5d897b[_0x0418('0x4e')],qs[_0x0418('0x55')](_0x3b4cc6[_0x0418('0x3c')][_0x0418('0x55')]));_0xb52490[_0x0418('0x41')]=_0xb52490[_0x0418('0x41')][_0x0418('0x45')]?_0xb52490[_0x0418('0x41')]:_0x5d897b[_0x0418('0x4e')];if(!_0x3b4cc6[_0x0418('0x3c')]['hasOwnProperty']('nolimit')){_0xb52490[_0x0418('0x1e')]=qs[_0x0418('0x1e')](_0x3b4cc6[_0x0418('0x3c')][_0x0418('0x1e')]);_0xb52490[_0x0418('0x21')]=qs[_0x0418('0x21')](_0x3b4cc6[_0x0418('0x3c')][_0x0418('0x21')]);}_0xb52490['order']=qs['sort'](_0x3b4cc6['query']['sort']);_0xb52490[_0x0418('0x3b')]=qs[_0x0418('0x53')](_[_0x0418('0xc5')](_0x3b4cc6[_0x0418('0x3c')],_0x5d897b[_0x0418('0x53')]));_0xb52490[_0x0418('0x3b')][_0x0418('0xd7')]=_0x38a2f2['id'];if(_0x3b4cc6['query']['filter']){_0xb52490[_0x0418('0x3b')]=_[_0x0418('0xc6')](_0xb52490[_0x0418('0x3b')],{'$or':_['map'](_0xb52490[_0x0418('0x41')],function(_0x355465){var _0x4f6413={};_0x4f6413[_0x355465]={'$like':'%'+_0x3b4cc6[_0x0418('0x3c')][_0x0418('0x2d')]+'%'};return _0x4f6413;})});}_0xb52490=_[_0x0418('0xc6')]({},_0xb52490,_0x3b4cc6[_0x0418('0x57')]);return db['ScreenRecording']['count']({'where':_0xb52490[_0x0418('0x3b')]})[_0x0418('0x11')](function(_0x3786a8){_0x373f34[_0x0418('0x20')]=_0x3786a8;if(_0x3b4cc6[_0x0418('0x3c')][_0x0418('0x3d')]){_0xb52490[_0x0418('0x3e')]=[{'all':!![]}];}return db[_0x0418('0xd9')][_0x0418('0x42')](_0xb52490);})[_0x0418('0x11')](function(_0x1e7cbf){_0x373f34[_0x0418('0x44')]=_0x1e7cbf;return _0x373f34;});}})[_0x0418('0x11')](respondWithFilteredResult(_0x570706,_0xb52490))['catch'](handleError(_0x570706,null));};exports[_0x0418('0xda')]=function(_0x21c4f5,_0x230b66){var _0x229661={};var _0x5b8519={};var _0x1693d2;var _0x2cc2b7;return db[_0x0418('0x35')][_0x0418('0x93')]({'where':{'id':_0x21c4f5['params']['id']}})[_0x0418('0x11')](handleEntityNotFound(_0x230b66,null))['then'](function(_0x1d09bd){if(_0x1d09bd){_0x1693d2=_0x1d09bd;_0x5b8519[_0x0418('0x4e')]=_[_0x0418('0x50')](db['ChatInteraction'][_0x0418('0x36')]);_0x5b8519['query']=_[_0x0418('0x50')](_0x21c4f5[_0x0418('0x3c')]);_0x5b8519[_0x0418('0x53')]=_[_0x0418('0x54')](_0x5b8519[_0x0418('0x4e')],_0x5b8519[_0x0418('0x3c')]);_0x229661[_0x0418('0x41')]=_[_0x0418('0x54')](_0x5b8519['model'],qs[_0x0418('0x55')](_0x21c4f5[_0x0418('0x3c')][_0x0418('0x55')]));_0x229661['attributes']=_0x229661[_0x0418('0x41')][_0x0418('0x45')]?_0x229661['attributes']:_0x5b8519[_0x0418('0x4e')];_0x229661[_0x0418('0xc4')]=qs[_0x0418('0xcf')](_0x21c4f5[_0x0418('0x3c')][_0x0418('0xcf')]);_0x229661[_0x0418('0x3b')]=qs[_0x0418('0x53')](_[_0x0418('0xc5')](_0x21c4f5[_0x0418('0x3c')],_0x5b8519[_0x0418('0x53')]));if(_0x21c4f5['query'][_0x0418('0x2d')]){_0x229661[_0x0418('0x3b')]=_[_0x0418('0xc6')](_0x229661[_0x0418('0x3b')],{'$or':_['map'](_0x229661[_0x0418('0x41')],function(_0x1f7d27){var _0x19faf9={};_0x19faf9[_0x1f7d27]={'$like':'%'+_0x21c4f5[_0x0418('0x3c')][_0x0418('0x2d')]+'%'};return _0x19faf9;})});}_0x229661=_[_0x0418('0xc6')]({},_0x229661,_0x21c4f5[_0x0418('0x57')]);return _0x1693d2['getChatInteractions'](_0x229661);}})['then'](function(_0x3bba81){if(_0x3bba81){_0x2cc2b7=_0x3bba81[_0x0418('0x45')];if(!_0x21c4f5['query'][_0x0418('0xcc')](_0x0418('0xcd'))){_0x229661['limit']=qs['limit'](_0x21c4f5[_0x0418('0x3c')][_0x0418('0x1e')]);_0x229661[_0x0418('0x21')]=qs[_0x0418('0x21')](_0x21c4f5[_0x0418('0x3c')]['offset']);}return _0x1693d2['getChatInteractions'](_0x229661);}})[_0x0418('0x11')](function(_0xaede0){if(_0xaede0){return _0xaede0?{'count':_0x2cc2b7,'rows':_0xaede0}:null;}})['then'](respondWithResult(_0x230b66,null))[_0x0418('0x1b')](handleError(_0x230b66,null));};exports[_0x0418('0xdb')]=function(_0x29be82,_0x192dac){var _0x36dbd5={};var _0x3a114f={};var _0x1255ab;var _0x4c2add;return db[_0x0418('0x35')][_0x0418('0x93')]({'where':{'id':_0x29be82[_0x0418('0x4d')]['id']}})[_0x0418('0x11')](handleEntityNotFound(_0x192dac,null))['then'](function(_0x2c10cc){if(_0x2c10cc){_0x1255ab=_0x2c10cc;_0x3a114f[_0x0418('0x4e')]=_[_0x0418('0x50')](db[_0x0418('0xdc')][_0x0418('0x36')]);_0x3a114f[_0x0418('0x3c')]=_['keys'](_0x29be82[_0x0418('0x3c')]);_0x3a114f[_0x0418('0x53')]=_['intersection'](_0x3a114f['model'],_0x3a114f[_0x0418('0x3c')]);_0x36dbd5[_0x0418('0x41')]=_['intersection'](_0x3a114f[_0x0418('0x4e')],qs[_0x0418('0x55')](_0x29be82['query'][_0x0418('0x55')]));_0x36dbd5[_0x0418('0x41')]=_0x36dbd5[_0x0418('0x41')][_0x0418('0x45')]?_0x36dbd5[_0x0418('0x41')]:_0x3a114f[_0x0418('0x4e')];_0x36dbd5[_0x0418('0xc4')]=qs['sort'](_0x29be82['query'][_0x0418('0xcf')]);_0x36dbd5[_0x0418('0x3b')]=qs[_0x0418('0x53')](_[_0x0418('0xc5')](_0x29be82[_0x0418('0x3c')],_0x3a114f[_0x0418('0x53')]));if(_0x29be82['query'][_0x0418('0x2d')]){_0x36dbd5['where']=_[_0x0418('0xc6')](_0x36dbd5['where'],{'$or':_[_0x0418('0x87')](_0x36dbd5[_0x0418('0x41')],function(_0x56bdb0){var _0x277f99={};_0x277f99[_0x56bdb0]={'$like':'%'+_0x29be82[_0x0418('0x3c')][_0x0418('0x2d')]+'%'};return _0x277f99;})});}_0x36dbd5=_['merge']({},_0x36dbd5,_0x29be82[_0x0418('0x57')]);return _0x1255ab[_0x0418('0xdb')](_0x36dbd5);}})[_0x0418('0x11')](function(_0x290ac5){if(_0x290ac5){_0x4c2add=_0x290ac5[_0x0418('0x45')];if(!_0x29be82[_0x0418('0x3c')][_0x0418('0xcc')](_0x0418('0xcd'))){_0x36dbd5[_0x0418('0x1e')]=qs[_0x0418('0x1e')](_0x29be82['query'][_0x0418('0x1e')]);_0x36dbd5[_0x0418('0x21')]=qs[_0x0418('0x21')](_0x29be82['query'][_0x0418('0x21')]);}return _0x1255ab[_0x0418('0xdb')](_0x36dbd5);}})[_0x0418('0x11')](function(_0x23aa54){if(_0x23aa54){return _0x23aa54?{'count':_0x4c2add,'rows':_0x23aa54}:null;}})[_0x0418('0x11')](respondWithResult(_0x192dac,null))[_0x0418('0x1b')](handleError(_0x192dac,null));};exports[_0x0418('0xdd')]=function(_0x5a8689,_0x245700){var _0x4dbd62={'raw':!![],'where':{}};var _0x55be3e={};var _0x1cbca3={'count':0x0,'rows':[]};return db[_0x0418('0x35')][_0x0418('0x93')]({'where':{'id':_0x5a8689[_0x0418('0x4d')]['id']}})[_0x0418('0x11')](handleEntityNotFound(_0x245700,null))[_0x0418('0x11')](function(_0x32bd66){if(_0x32bd66){_0x55be3e[_0x0418('0x4e')]=_[_0x0418('0x50')](db[_0x0418('0xde')][_0x0418('0x36')]);_0x55be3e['query']=_[_0x0418('0x50')](_0x5a8689[_0x0418('0x3c')]);_0x55be3e[_0x0418('0x53')]=_['intersection'](_0x55be3e[_0x0418('0x4e')],_0x55be3e[_0x0418('0x3c')]);_0x4dbd62[_0x0418('0x41')]=_[_0x0418('0x54')](_0x55be3e[_0x0418('0x4e')],qs[_0x0418('0x55')](_0x5a8689[_0x0418('0x3c')][_0x0418('0x55')]));_0x4dbd62[_0x0418('0x41')]=_0x4dbd62[_0x0418('0x41')][_0x0418('0x45')]?_0x4dbd62[_0x0418('0x41')]:_0x55be3e[_0x0418('0x4e')];if(!_0x5a8689['query']['hasOwnProperty'](_0x0418('0xcd'))){_0x4dbd62[_0x0418('0x1e')]=qs[_0x0418('0x1e')](_0x5a8689[_0x0418('0x3c')][_0x0418('0x1e')]);_0x4dbd62[_0x0418('0x21')]=qs[_0x0418('0x21')](_0x5a8689['query'][_0x0418('0x21')]);}_0x4dbd62['order']=qs[_0x0418('0xcf')](_0x5a8689[_0x0418('0x3c')][_0x0418('0xcf')]);_0x4dbd62['where']=qs[_0x0418('0x53')](_[_0x0418('0xc5')](_0x5a8689[_0x0418('0x3c')],_0x55be3e['filters']));_0x4dbd62[_0x0418('0x3b')][_0x0418('0xd7')]=_0x32bd66['id'];if(_0x5a8689[_0x0418('0x3c')]['filter']){_0x4dbd62[_0x0418('0x3b')]=_['merge'](_0x4dbd62['where'],{'$or':_[_0x0418('0x87')](_0x4dbd62[_0x0418('0x41')],function(_0xae8318){var _0x1adfe1={};_0x1adfe1[_0xae8318]={'$like':'%'+_0x5a8689['query']['filter']+'%'};return _0x1adfe1;})});}_0x4dbd62=_[_0x0418('0xc6')]({},_0x4dbd62,_0x5a8689[_0x0418('0x57')]);return db[_0x0418('0xde')][_0x0418('0x20')]({'where':_0x4dbd62['where']})['then'](function(_0xc314e7){_0x1cbca3[_0x0418('0x20')]=_0xc314e7;if(_0x5a8689[_0x0418('0x3c')][_0x0418('0x3d')]){_0x4dbd62[_0x0418('0x3e')]=[{'all':!![]}];}return db[_0x0418('0xde')][_0x0418('0x42')](_0x4dbd62);})[_0x0418('0x11')](function(_0x2a7262){_0x1cbca3[_0x0418('0x44')]=_0x2a7262;return _0x1cbca3;});}})[_0x0418('0x11')](respondWithFilteredResult(_0x245700,_0x4dbd62))['catch'](handleError(_0x245700,null));};exports[_0x0418('0xdf')]=function(_0x539a57,_0x23405e){var _0x3c4f8a={};var _0x1968f6={};var _0x2de612;var _0x16b88a;return db[_0x0418('0x35')]['findOne']({'where':{'id':_0x539a57[_0x0418('0x4d')]['id']}})[_0x0418('0x11')](handleEntityNotFound(_0x23405e,null))['then'](function(_0x4cb269){if(_0x4cb269){_0x2de612=_0x4cb269;_0x1968f6[_0x0418('0x4e')]=_['keys'](db[_0x0418('0xe0')][_0x0418('0x36')]);_0x1968f6[_0x0418('0x3c')]=_['keys'](_0x539a57['query']);_0x1968f6[_0x0418('0x53')]=_['intersection'](_0x1968f6[_0x0418('0x4e')],_0x1968f6[_0x0418('0x3c')]);_0x3c4f8a[_0x0418('0x41')]=_[_0x0418('0x54')](_0x1968f6['model'],qs[_0x0418('0x55')](_0x539a57[_0x0418('0x3c')]['fields']));_0x3c4f8a[_0x0418('0x41')]=_0x3c4f8a[_0x0418('0x41')]['length']?_0x3c4f8a[_0x0418('0x41')]:_0x1968f6[_0x0418('0x4e')];_0x3c4f8a[_0x0418('0xc4')]=qs[_0x0418('0xcf')](_0x539a57[_0x0418('0x3c')][_0x0418('0xcf')]);_0x3c4f8a[_0x0418('0x3b')]=qs[_0x0418('0x53')](_[_0x0418('0xc5')](_0x539a57[_0x0418('0x3c')],_0x1968f6[_0x0418('0x53')]));if(_0x539a57[_0x0418('0x3c')][_0x0418('0x2d')]){_0x3c4f8a[_0x0418('0x3b')]=_['merge'](_0x3c4f8a[_0x0418('0x3b')],{'$or':_[_0x0418('0x87')](_0x3c4f8a[_0x0418('0x41')],function(_0xa3013c){var _0x1a8323={};_0x1a8323[_0xa3013c]={'$like':'%'+_0x539a57[_0x0418('0x3c')]['filter']+'%'};return _0x1a8323;})});}_0x3c4f8a=_[_0x0418('0xc6')]({},_0x3c4f8a,_0x539a57[_0x0418('0x57')]);return _0x2de612[_0x0418('0xdf')](_0x3c4f8a);}})['then'](function(_0x509fac){if(_0x509fac){_0x16b88a=_0x509fac[_0x0418('0x45')];if(!_0x539a57['query']['hasOwnProperty'](_0x0418('0xcd'))){_0x3c4f8a[_0x0418('0x1e')]=qs['limit'](_0x539a57[_0x0418('0x3c')][_0x0418('0x1e')]);_0x3c4f8a[_0x0418('0x21')]=qs['offset'](_0x539a57[_0x0418('0x3c')][_0x0418('0x21')]);}return _0x2de612[_0x0418('0xdf')](_0x3c4f8a);}})[_0x0418('0x11')](function(_0x31ea3c){if(_0x31ea3c){return _0x31ea3c?{'count':_0x16b88a,'rows':_0x31ea3c}:null;}})[_0x0418('0x11')](respondWithResult(_0x23405e,null))['catch'](handleError(_0x23405e,null));};exports[_0x0418('0xe1')]=function(_0x56e250,_0x18568c){var _0xd6880c={};var _0x320962={};var _0x1dc193;var _0x16a2b0;return db[_0x0418('0x35')][_0x0418('0x93')]({'where':{'id':_0x56e250[_0x0418('0x4d')]['id']}})[_0x0418('0x11')](handleEntityNotFound(_0x18568c,null))[_0x0418('0x11')](function(_0x2ea4cc){if(_0x2ea4cc){_0x1dc193=_0x2ea4cc;_0x320962[_0x0418('0x4e')]=_[_0x0418('0x50')](db['FaxInteraction'][_0x0418('0x36')]);_0x320962[_0x0418('0x3c')]=_['keys'](_0x56e250[_0x0418('0x3c')]);_0x320962[_0x0418('0x53')]=_[_0x0418('0x54')](_0x320962['model'],_0x320962[_0x0418('0x3c')]);_0xd6880c[_0x0418('0x41')]=_[_0x0418('0x54')](_0x320962[_0x0418('0x4e')],qs[_0x0418('0x55')](_0x56e250[_0x0418('0x3c')][_0x0418('0x55')]));_0xd6880c['attributes']=_0xd6880c[_0x0418('0x41')][_0x0418('0x45')]?_0xd6880c[_0x0418('0x41')]:_0x320962[_0x0418('0x4e')];_0xd6880c['order']=qs[_0x0418('0xcf')](_0x56e250[_0x0418('0x3c')][_0x0418('0xcf')]);_0xd6880c[_0x0418('0x3b')]=qs['filters'](_[_0x0418('0xc5')](_0x56e250[_0x0418('0x3c')],_0x320962[_0x0418('0x53')]));if(_0x56e250[_0x0418('0x3c')][_0x0418('0x2d')]){_0xd6880c[_0x0418('0x3b')]=_['merge'](_0xd6880c[_0x0418('0x3b')],{'$or':_[_0x0418('0x87')](_0xd6880c['attributes'],function(_0x497c2d){var _0x3c489f={};_0x3c489f[_0x497c2d]={'$like':'%'+_0x56e250[_0x0418('0x3c')][_0x0418('0x2d')]+'%'};return _0x3c489f;})});}_0xd6880c=_['merge']({},_0xd6880c,_0x56e250['options']);return _0x1dc193[_0x0418('0xe1')](_0xd6880c);}})['then'](function(_0x4b36ef){if(_0x4b36ef){_0x16a2b0=_0x4b36ef[_0x0418('0x45')];if(!_0x56e250[_0x0418('0x3c')][_0x0418('0xcc')]('nolimit')){_0xd6880c[_0x0418('0x1e')]=qs['limit'](_0x56e250[_0x0418('0x3c')][_0x0418('0x1e')]);_0xd6880c[_0x0418('0x21')]=qs[_0x0418('0x21')](_0x56e250['query'][_0x0418('0x21')]);}return _0x1dc193[_0x0418('0xe1')](_0xd6880c);}})[_0x0418('0x11')](function(_0x3f8631){if(_0x3f8631){return _0x3f8631?{'count':_0x16a2b0,'rows':_0x3f8631}:null;}})[_0x0418('0x11')](respondWithResult(_0x18568c,null))[_0x0418('0x1b')](handleError(_0x18568c,null));};exports[_0x0418('0xe2')]=function(_0x518bbc,_0x4a2b31){var _0x5c2fa5={};var _0xe134f6={};var _0x3715ee;var _0x5120e3;return db[_0x0418('0x35')][_0x0418('0x93')]({'where':{'id':_0x518bbc['params']['id']}})[_0x0418('0x11')](handleEntityNotFound(_0x4a2b31,null))[_0x0418('0x11')](function(_0x111758){if(_0x111758){_0x3715ee=_0x111758;_0xe134f6['model']=_[_0x0418('0x50')](db[_0x0418('0xe3')]['rawAttributes']);_0xe134f6[_0x0418('0x3c')]=_['keys'](_0x518bbc[_0x0418('0x3c')]);_0xe134f6[_0x0418('0x53')]=_['intersection'](_0xe134f6[_0x0418('0x4e')],_0xe134f6[_0x0418('0x3c')]);_0x5c2fa5[_0x0418('0x41')]=_['intersection'](_0xe134f6[_0x0418('0x4e')],qs[_0x0418('0x55')](_0x518bbc['query'][_0x0418('0x55')]));_0x5c2fa5[_0x0418('0x41')]=_0x5c2fa5[_0x0418('0x41')][_0x0418('0x45')]?_0x5c2fa5['attributes']:_0xe134f6[_0x0418('0x4e')];_0x5c2fa5['order']=qs[_0x0418('0xcf')](_0x518bbc['query'][_0x0418('0xcf')]);_0x5c2fa5['where']=qs[_0x0418('0x53')](_[_0x0418('0xc5')](_0x518bbc[_0x0418('0x3c')],_0xe134f6[_0x0418('0x53')]));if(_0x518bbc['query'][_0x0418('0x2d')]){_0x5c2fa5[_0x0418('0x3b')]=_[_0x0418('0xc6')](_0x5c2fa5[_0x0418('0x3b')],{'$or':_[_0x0418('0x87')](_0x5c2fa5[_0x0418('0x41')],function(_0x5a57c7){var _0x55c62c={};_0x55c62c[_0x5a57c7]={'$like':'%'+_0x518bbc[_0x0418('0x3c')]['filter']+'%'};return _0x55c62c;})});}_0x5c2fa5=_['merge']({},_0x5c2fa5,_0x518bbc[_0x0418('0x57')]);return _0x3715ee['getWhatsappInteractions'](_0x5c2fa5);}})[_0x0418('0x11')](function(_0x14da22){if(_0x14da22){_0x5120e3=_0x14da22[_0x0418('0x45')];if(!_0x518bbc[_0x0418('0x3c')]['hasOwnProperty']('nolimit')){_0x5c2fa5[_0x0418('0x1e')]=qs[_0x0418('0x1e')](_0x518bbc[_0x0418('0x3c')]['limit']);_0x5c2fa5['offset']=qs[_0x0418('0x21')](_0x518bbc[_0x0418('0x3c')]['offset']);}return _0x3715ee[_0x0418('0xe2')](_0x5c2fa5);}})[_0x0418('0x11')](function(_0x33275c){if(_0x33275c){return _0x33275c?{'count':_0x5120e3,'rows':_0x33275c}:null;}})[_0x0418('0x11')](respondWithResult(_0x4a2b31,null))['catch'](handleError(_0x4a2b31,null));};exports[_0x0418('0xe4')]=function(_0xb17924,_0x99c4b1,_0x523b36){var _0x49e714;var _0x1f6af7;var _0x1b0838;var _0x2e6dca=!_[_0x0418('0x64')](_0xb17924[_0x0418('0x4d')]['id'])?_0xb17924[_0x0418('0x4d')]['id']:!_[_0x0418('0x64')](_0xb17924[_0x0418('0x29')]['id'])?_0xb17924[_0x0418('0x29')]['id']:null;return db[_0x0418('0x35')][_0x0418('0x5a')]({'where':{'id':_0x2e6dca,'role':{'$or':['admin',_0x0418('0x29'),_0x0418('0x2a')]}},'attributes':['id',_0x0418('0x30'),_0x0418('0xe5'),'mobile',_0x0418('0x27'),_0x0418('0x5f'),_0x0418('0x9a')]})[_0x0418('0x11')](function(_0x47c8d7){if(_0x47c8d7){if(_0x47c8d7['role']==='agent'){_0x49e714=_0x47c8d7;if(_0xb17924[_0x0418('0x59')][_0x0418('0x9b')]){_0x1b0838=util[_0x0418('0xe6')]('LOCAL/%s@from-sip/n',_0x49e714[_0xb17924['body']['interface']]);}else if(_0xb17924['body'][_0x0418('0xe7')]){_0x1b0838=util['format'](_0x0418('0xe8'),_0xb17924[_0x0418('0x59')][_0x0418('0xe7')]);}else{_0x1b0838=util[_0x0418('0xe6')](_0x0418('0xe8'),_0x49e714[_0x0418('0x30')]);}socket['to'](util[_0x0418('0xe6')](_0x0418('0xe9'),_0x49e714[_0x0418('0x30')]))['emit']('user:forcelogout',{'user':{'id':_0x49e714['id'],'name':_0x49e714[_0x0418('0x30')]},'ip':_0xb17924['headers']['x-forwarded-for']||_0xb17924[_0x0418('0xea')]['remoteAddress']||_0xb17924[_0x0418('0xeb')][_0x0418('0xec')]||_0xb17924[_0x0418('0xea')]['socket'][_0x0418('0xec')]});return db[_0x0418('0xa7')][_0x0418('0x25')]({'where':{'membername':_0x49e714[_0x0418('0x30')]},'individualHooks':!![]});}}else{throw new db[(_0x0418('0x8b'))][(_0x0418('0x8e'))](_0x0418('0xed'));}})[_0x0418('0x11')](function(){if(_0x49e714){return _0x49e714['getVoiceQueues']({'raw':!![]});}})[_0x0418('0x11')](function(_0x3633b9){if(_0x49e714){var _0x219c41=[];if(_0x3633b9){_0x1f6af7=_0x3633b9;if(_0x1f6af7[_0x0418('0x45')]){for(var _0x13c1cc=0x0;_0x13c1cc<_0x1f6af7[_0x0418('0x45')];_0x13c1cc++){_0x219c41[_0x0418('0x46')]({'membername':_0x49e714[_0x0418('0x30')],'UserId':_0x49e714['id'],'queue_name':_0x1f6af7[_0x13c1cc][_0x0418('0x30')],'VoiceQueueId':_0x1f6af7[_0x13c1cc]['id'],'interface':_0x1b0838,'paused':_0x49e714[_0x0418('0x9a')]||![],'penalty':_0x1f6af7[_0x13c1cc][_0x0418('0xee')]||0x0});}return BPromise[_0x0418('0x84')](_0x219c41,function(_0x3657e8){return db[_0x0418('0xa7')][_0x0418('0xa8')](_0x3657e8);});}}}})[_0x0418('0x11')](function(){if(_0x49e714){return db[_0x0418('0xef')]['findAll']({'where':{'membername':_0x49e714[_0x0418('0x30')],'exitAt':null}});}})[_0x0418('0x11')](function(_0x755711){if(_0x49e714){var _0x26033e=[];_0x755711[_0x0418('0xf0')](function(_0x403488){_0x26033e[_0x0418('0x46')](_0x403488[_0x0418('0x24')]({'exitAt':moment()['format'](_0x0418('0xf1'))}));});return BPromise[_0x0418('0x4c')](_0x26033e);}})['then'](function(){if(_0x49e714){var _0x49065b=[];var _0xc64b7d=[];var _0x24e0fc=utils[_0x0418('0xf2')]();var _0x3eca1d={'membername':_0x49e714['name'],'interface':_0x1b0838,'enterAt':moment()[_0x0418('0xe6')](_0x0418('0xf1')),'role':_0x49e714[_0x0418('0x27')],'internal':_0x49e714['internal']};_0x24e0fc['forEach'](function(_0x248e1d){_0x49065b[_0x0418('0x46')](_['merge']({'channel':_0x248e1d,'type':_0x0418('0xf3'),'data1':_0xb17924[_0x0418('0x59')]['device'],'data2':_0x1b0838},_0x3eca1d));if(_0x49e714[_0x0418('0x9a')]){_0xc64b7d['push'](_[_0x0418('0xc6')]({'channel':_0x248e1d,'type':_0x0418('0xf4'),'data1':_0x0418('0xf5')},_0x3eca1d));}});return db[_0x0418('0xef')][_0x0418('0x81')](_0x49065b['concat'](_0xc64b7d),{'individualHooks':!![]});}})[_0x0418('0x11')](function(){if(_0x49e714){return _0x49e714[_0x0418('0x24')]({'online':!![],'lastLoginAt':moment()['format'](_0x0418('0xf1')),'voicePause':_0x49e714[_0x0418('0x9a')]||![],'mailPause':_0x49e714['loginInPause']||![],'chatPause':_0x49e714[_0x0418('0x9a')]||![],'faxPause':_0x49e714[_0x0418('0x9a')]||![],'smsPause':_0x49e714['loginInPause']||![],'openchannelPause':_0x49e714['loginInPause']||![],'whatsappPause':_0x49e714[_0x0418('0x9a')]||![],'pauseType':_0x49e714[_0x0418('0x9a')]?_0x0418('0xf5'):null,'interface':_0x1b0838,'lastPauseAt':moment()[_0x0418('0xe6')](_0x0418('0xf1'))});}})[_0x0418('0x11')](function(_0x5d1d39){if(_0xb17924[_0x0418('0xf6')]){return _0x523b36();}else{return BPromise[_0x0418('0xf7')](_0x5d1d39)[_0x0418('0x11')](respondWithResult(_0x99c4b1,null));}})['catch'](handleError(_0x99c4b1,null));};exports[_0x0418('0xf8')]=function(_0x34e995,_0x41ad72){var _0x456a92;return db['User'][_0x0418('0x5a')]({'where':{'id':_0x34e995[_0x0418('0x4d')]['id'],'role':_0x0418('0x2a')},'attributes':['id',_0x0418('0x30'),_0x0418('0x27')]})['then'](handleEntityNotFound(_0x41ad72,null))[_0x0418('0x11')](function(_0x1b10fa){if(_0x1b10fa){_0x456a92=_0x1b10fa;return db[_0x0418('0xa7')][_0x0418('0x25')]({'where':{'membername':_0x456a92[_0x0418('0x30')]},'individualHooks':!![]});}})['then'](function(){return db[_0x0418('0xef')][_0x0418('0x42')]({'where':{'membername':_0x456a92[_0x0418('0x30')],'exitAt':null}});})[_0x0418('0x11')](function(_0x2b461a){var _0x152bbd=[];_0x2b461a[_0x0418('0xf0')](function(_0x2ef749){_0x152bbd[_0x0418('0x46')](_0x2ef749['update']({'exitAt':moment()[_0x0418('0xe6')](_0x0418('0xf1'))}));});return BPromise[_0x0418('0x4c')](_0x152bbd);})[_0x0418('0x11')](function(){return _0x456a92[_0x0418('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0418('0x11')](respondWithResult(_0x41ad72,null))['catch'](handleError(_0x41ad72,null));};exports[_0x0418('0xf9')]=function(_0x56c956,_0x5933bd){var _0x5b6727;return db[_0x0418('0xa7')][_0x0418('0x24')]({'paused':0x1},{'where':{'UserId':_0x56c956[_0x0418('0x4d')]['id']},'individualHooks':!![]})[_0x0418('0x11')](function(){return db['User'][_0x0418('0x5a')]({'where':{'id':_0x56c956[_0x0418('0x4d')]['id'],'role':_0x0418('0x2a')},'attributes':['id',_0x0418('0x30'),_0x0418('0x27'),_0x0418('0x5f'),_0x0418('0x9b')]});})[_0x0418('0x11')](handleEntityNotFound(_0x5933bd,null))[_0x0418('0x11')](function(_0x5bddd5){if(_0x5bddd5){_0x5b6727=_0x5bddd5;return respondWithRpcPromise(_0x0418('0xfa'),_0x0418('0xf9'),{'id':_0x5b6727['id'],'name':_0x5b6727[_0x0418('0x30')],'pause':!![]});}})[_0x0418('0x11')](function(){if(_0x5b6727){return db[_0x0418('0xef')][_0x0418('0x42')]({'where':{'membername':_0x5b6727[_0x0418('0x30')],'type':_0x0418('0xf4'),'exitAt':null}});}})[_0x0418('0x11')](function(_0x32d8dc){if(_0x32d8dc[_0x0418('0x45')]){var _0x302588=moment()[_0x0418('0xe6')](_0x0418('0xf1'));for(var _0x1e4eaf=0x0,_0x347082=_0x32d8dc[_0x0418('0x45')];_0x1e4eaf<_0x347082;_0x1e4eaf++){_0x32d8dc[_0x1e4eaf]['updateAttributes']({'exitAt':_0x302588});}}})['then'](function(){var _0x488b2b=[];var _0x557038=utils['getChannels']();_0x557038['forEach'](function(_0x6bc0c0){_0x488b2b[_0x0418('0x46')]({'channel':_0x6bc0c0,'membername':_0x5b6727[_0x0418('0x30')],'interface':_[_0x0418('0x64')](_0x5b6727[_0x0418('0x9b')])?util[_0x0418('0xe6')](_0x0418('0xe8'),_0x5b6727[_0x0418('0x30')]):_0x5b6727[_0x0418('0x9b')],'type':_0x0418('0xf4'),'enterAt':moment()[_0x0418('0xe6')](_0x0418('0xf1')),'data1':_0x56c956[_0x0418('0x59')][_0x0418('0x38')]||_0x0418('0xfb'),'role':_0x5b6727[_0x0418('0x27')],'internal':_0x5b6727[_0x0418('0x5f')]});});return db['MemberReport'][_0x0418('0x81')](_0x488b2b,{'individualHooks':!![]});})['then'](function(){return _0x5b6727[_0x0418('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x56c956[_0x0418('0x59')][_0x0418('0x38')]||_0x0418('0xfb'),'lastPauseAt':moment()[_0x0418('0xe6')](_0x0418('0xf1'))});})[_0x0418('0x11')](respondWithResult(_0x5933bd,null))[_0x0418('0x1b')](handleError(_0x5933bd,null));};exports[_0x0418('0xfc')]=function(_0x197cfe,_0x3f24f4){var _0x59f28a;return db[_0x0418('0x35')]['find']({'where':{'id':_0x197cfe[_0x0418('0x4d')]['id']},'attributes':['id',_0x0418('0x30'),_0x0418('0x27'),_0x0418('0xa6'),_0x0418('0xfd'),'chatPause',_0x0418('0xfe'),_0x0418('0xff'),'smsPause','whatsapppause',_0x0418('0x100'),_0x0418('0x101')]})[_0x0418('0x11')](handleEntityNotFound(_0x3f24f4,null))[_0x0418('0x11')](function(_0x10e97a){if(_0x10e97a){_0x59f28a=_0x10e97a;if(_0x197cfe[_0x0418('0x59')][_0x0418('0xa9')]&&!utils[_0x0418('0x9c')](_0x197cfe[_0x0418('0x59')][_0x0418('0xa9')])){throw new db[(_0x0418('0x8b'))][(_0x0418('0x8e'))](_0x0418('0x9d'));}switch(_0x197cfe['body'][_0x0418('0xa9')]){case'voice':return respondWithRpcPromise(_0x0418('0xfa'),'unpause',{'id':_0x59f28a['id'],'name':_0x59f28a['name'],'pause':![]})[_0x0418('0x11')](function(){return db[_0x0418('0xa7')]['update']({'paused':0x0},{'where':{'UserId':_0x59f28a['id']},'individualHooks':!![]});})[_0x0418('0x11')](function(){return db['MemberReport']['find']({'where':{'channel':_0x197cfe[_0x0418('0x59')][_0x0418('0xa9')],'membername':_0x59f28a[_0x0418('0x30')],'type':_0x0418('0xf4'),'exitAt':null}});})['then'](function(_0x574352){if(_0x574352){return _0x574352['update']({'exitAt':moment()[_0x0418('0xe6')](_0x0418('0xf1')),'data2':_0x0418('0x102')},{'individualHooks':!![]});}return null;})[_0x0418('0x11')](function(){return _0x59f28a[_0x0418('0x24')]({'voicePause':![]});});case _0x0418('0x4a'):case _0x0418('0x47'):case _0x0418('0x58'):case _0x0418('0x48'):case'whatsapp':case _0x0418('0xb8'):return db[_0x0418('0xef')][_0x0418('0x5a')]({'where':{'channel':_0x197cfe['body'][_0x0418('0xa9')],'membername':_0x59f28a[_0x0418('0x30')],'type':'PAUSE','exitAt':null}})[_0x0418('0x11')](function(_0x35b8ec){if(_0x35b8ec){return _0x35b8ec['update']({'exitAt':moment()[_0x0418('0xe6')](_0x0418('0xf1')),'data2':_0x0418('0x102')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x4b212d={};_[_0x0418('0x103')](_0x4b212d,util[_0x0418('0xe6')](_0x0418('0x104'),_0x197cfe[_0x0418('0x59')][_0x0418('0xa9')],'Pause'),![]);return _0x59f28a['update'](_0x4b212d);});default:return respondWithRpcPromise('QueuePause',_0x0418('0xfc'),{'id':_0x59f28a['id'],'name':_0x59f28a[_0x0418('0x30')],'pause':![]})[_0x0418('0x11')](function(){return db[_0x0418('0xa7')][_0x0418('0x24')]({'paused':0x0},{'where':{'UserId':_0x59f28a['id']}});})[_0x0418('0x11')](function(){return db[_0x0418('0xef')]['findAll']({'where':{'membername':_0x59f28a['name'],'type':_0x0418('0xf4'),'exitAt':null}});})[_0x0418('0x11')](function(_0x15d638){var _0x4c5cd7=[];_0x15d638[_0x0418('0xf0')](function(_0x2ee048){_0x4c5cd7[_0x0418('0x46')](_0x2ee048[_0x0418('0x24')]({'exitAt':moment()['format'](_0x0418('0xf1')),'data2':'manual'}));});return BPromise[_0x0418('0x4c')](_0x4c5cd7);})['then'](function(){return _0x59f28a[_0x0418('0x24')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x0418('0x11')](respondWithResult(_0x3f24f4,null))['catch'](handleError(_0x3f24f4,null));};exports[_0x0418('0x105')]=function(_0x3b2c66,_0x57a075){var _0x50f661={};var _0x46d37c={};var _0x4a71da;var _0x5429ff;return db[_0x0418('0x35')][_0x0418('0x93')]({'where':{'id':_0x3b2c66[_0x0418('0x4d')]['id']}})['then'](handleEntityNotFound(_0x57a075,null))['then'](function(_0x392fa0){if(_0x392fa0){_0x4a71da=_0x392fa0;_0x46d37c['model']=_[_0x0418('0x50')](db[_0x0418('0x106')][_0x0418('0x36')]);_0x46d37c[_0x0418('0x3c')]=_['keys'](_0x3b2c66[_0x0418('0x3c')]);_0x46d37c[_0x0418('0x53')]=_['intersection'](_0x46d37c[_0x0418('0x4e')],_0x46d37c[_0x0418('0x3c')]);_0x50f661['attributes']=_[_0x0418('0x54')](_0x46d37c['model'],qs['fields'](_0x3b2c66['query'][_0x0418('0x55')]));_0x50f661[_0x0418('0x41')]=_0x50f661[_0x0418('0x41')][_0x0418('0x45')]?_0x50f661[_0x0418('0x41')]:_0x46d37c['model'];_0x50f661[_0x0418('0xc4')]=qs[_0x0418('0xcf')](_0x3b2c66['query'][_0x0418('0xcf')]);_0x50f661[_0x0418('0x3b')]=qs[_0x0418('0x53')](_[_0x0418('0xc5')](_0x3b2c66[_0x0418('0x3c')],_0x46d37c[_0x0418('0x53')]));if(_0x3b2c66[_0x0418('0x3c')][_0x0418('0x2d')]){_0x50f661['where']=_[_0x0418('0xc6')](_0x50f661[_0x0418('0x3b')],{'$or':_[_0x0418('0x87')](_0x50f661[_0x0418('0x41')],function(_0x1649ce){var _0x3f0617={};_0x3f0617[_0x1649ce]={'$like':'%'+_0x3b2c66['query'][_0x0418('0x2d')]+'%'};return _0x3f0617;})});}_0x50f661=_[_0x0418('0xc6')]({},_0x50f661,_0x3b2c66[_0x0418('0x57')]);return _0x4a71da['getTeams'](_0x50f661);}})[_0x0418('0x11')](function(_0x49a4df){if(_0x49a4df){_0x5429ff=_0x49a4df['length'];if(!_0x3b2c66['query']['hasOwnProperty']('nolimit')){_0x50f661[_0x0418('0x1e')]=qs[_0x0418('0x1e')](_0x3b2c66[_0x0418('0x3c')][_0x0418('0x1e')]);_0x50f661['offset']=qs[_0x0418('0x21')](_0x3b2c66[_0x0418('0x3c')][_0x0418('0x21')]);}return _0x4a71da['getTeams'](_0x50f661);}})[_0x0418('0x11')](function(_0x1c9261){if(_0x1c9261){return _0x1c9261?{'count':_0x5429ff,'rows':_0x1c9261}:null;}})[_0x0418('0x11')](respondWithResult(_0x57a075,null))[_0x0418('0x1b')](handleError(_0x57a075,null));};exports[_0x0418('0x107')]=function(_0x38c6b6,_0x3513b8){return db[_0x0418('0x35')][_0x0418('0x5a')]({'where':{'id':_0x38c6b6[_0x0418('0x4d')]['id']}})[_0x0418('0x11')](handleEntityNotFound(_0x3513b8,null))[_0x0418('0x11')](function(_0x415d52){if(_0x415d52){var _0x5d0286=_0x415d52['get']({'plain':!![]});return _0x415d52[_0x0418('0x107')](_0x38c6b6[_0x0418('0x59')][_0x0418('0x5e')],_[_0x0418('0x5d')](_0x38c6b6[_0x0418('0x59')],[_0x0418('0x5e'),'id'])||{})[_0x0418('0x11')](function(){for(var _0x10bdf3=0x0;_0x10bdf3<_0x38c6b6['body']['ids'][_0x0418('0x45')];_0x10bdf3++){var _0x13f2b6=[];var _0x4898a8={};db[_0x0418('0x106')]['findOne']({'where':{'id':_0x38c6b6[_0x0418('0x59')]['ids'][_0x10bdf3]}})[_0x0418('0x11')](function(_0x59e365){_0x4898a8=_0x59e365[_0x0418('0x49')];_0x13f2b6[_0x0418('0x46')](_0x59e365['getVoiceQueues']()['then'](function(_0x3584c8){for(var _0x11e6f4=0x0;_0x11e6f4<_0x3584c8['length'];_0x11e6f4++){_0x3584c8[_0x11e6f4]['setDataValue'](_0x0418('0xa9'),_0x0418('0x108'));}return _0x3584c8;}));_0x13f2b6[_0x0418('0x46')](_0x59e365[_0x0418('0x109')]()[_0x0418('0x11')](function(_0x571ac5){for(var _0xe2187f=0x0;_0xe2187f<_0x571ac5[_0x0418('0x45')];_0xe2187f++){_0x571ac5[_0xe2187f][_0x0418('0x10a')](_0x0418('0xa9'),'Chat');}return _0x571ac5;}));_0x13f2b6[_0x0418('0x46')](_0x59e365['getMailQueues']()[_0x0418('0x11')](function(_0x4e2758){for(var _0x489f1f=0x0;_0x489f1f<_0x4e2758[_0x0418('0x45')];_0x489f1f++){_0x4e2758[_0x489f1f][_0x0418('0x10a')](_0x0418('0xa9'),_0x0418('0x10b'));}return _0x4e2758;}));_0x13f2b6['push'](_0x59e365[_0x0418('0x10c')]()[_0x0418('0x11')](function(_0x51543f){for(var _0x3c59bc=0x0;_0x3c59bc<_0x51543f[_0x0418('0x45')];_0x3c59bc++){_0x51543f[_0x3c59bc][_0x0418('0x10a')](_0x0418('0xa9'),_0x0418('0x10d'));}return _0x51543f;}));_0x13f2b6[_0x0418('0x46')](_0x59e365[_0x0418('0x10e')]()[_0x0418('0x11')](function(_0x316fd2){for(var _0x49ff46=0x0;_0x49ff46<_0x316fd2['length'];_0x49ff46++){_0x316fd2[_0x49ff46][_0x0418('0x10a')](_0x0418('0xa9'),_0x0418('0x10f'));}return _0x316fd2;}));_0x13f2b6[_0x0418('0x46')](_0x59e365[_0x0418('0x110')]()[_0x0418('0x11')](function(_0x4f4b40){for(var _0x419b00=0x0;_0x419b00<_0x4f4b40[_0x0418('0x45')];_0x419b00++){_0x4f4b40[_0x419b00]['setDataValue'](_0x0418('0xa9'),'Fax');}return _0x4f4b40;}));_0x13f2b6['push'](_0x59e365[_0x0418('0x111')]()[_0x0418('0x11')](function(_0x5bf448){for(var _0x1d1dda=0x0;_0x1d1dda<_0x5bf448[_0x0418('0x45')];_0x1d1dda++){_0x5bf448[_0x1d1dda]['setDataValue'](_0x0418('0xa9'),_0x0418('0x112'));}return _0x5bf448;}));return BPromise[_0x0418('0x4c')](_0x13f2b6);})[_0x0418('0x11')](function(_0x531c29){var _0x179ea8=_[_0x0418('0x113')](_0x531c29);_0x13f2b6=[];return db[_0x0418('0x66')][_0x0418('0x114')](function(_0x15a62b){for(var _0x1d27f3=0x0;_0x1d27f3<_0x179ea8[_0x0418('0x45')];_0x1d27f3++){_0x13f2b6[_0x0418('0x46')](_0x179ea8[_0x1d27f3][_0x0418('0x115')](_0x5d0286['id']),{'transaction':_0x15a62b});}return BPromise[_0x0418('0x4c')](_0x13f2b6)['then'](function(){if(_0x5d0286[_0x0418('0xa5')]){return BPromise['each'](_[_0x0418('0x2d')](_0x179ea8,function(_0x8913){return _0x8913[_0x0418('0x116')](_0x0418('0xa9'))===_0x0418('0x108');}),function(_0x4d9a67){return db[_0x0418('0xa7')]['upsert']({'membername':_0x5d0286[_0x0418('0x30')],'UserId':_0x5d0286['id'],'queue_name':_0x4d9a67['name'],'VoiceQueueId':_0x4d9a67['id'],'interface':_[_0x0418('0x64')](_0x5d0286['interface'])?util[_0x0418('0xe6')](_0x0418('0xe8'),_0x5d0286[_0x0418('0x30')]):_0x5d0286[_0x0418('0x9b')],'paused':_0x5d0286['voicePause']||![],'penalty':_0x5d0286[_0x0418('0xa1')]},{'transaction':_0x15a62b});});}else{return;}})['then'](function(){for(var _0x282503=0x0;_0x282503<_0x179ea8[_0x0418('0x45')];_0x282503++){var _0x22ad0e=_0x179ea8[_0x282503][_0x0418('0x116')](_0x0418('0xa9'));var _0x2cda80=_0x22ad0e+_0x0418('0xa2');socket[_0x0418('0xa3')](_0x0418('0x29')+_0x22ad0e+'Queue:save',{'UserId':_0x5d0286['id'],['queueField']:_0x179ea8[_0x282503]['id']});}});});})['then'](function(){db[_0x0418('0x117')][_0x0418('0x93')]({'where':{'teamId':_0x4898a8['id']}})[_0x0418('0x11')](function(_0x462334){if(_0x462334){db[_0x0418('0x118')][_0x0418('0x79')]({'UserId':_0x38c6b6[_0x0418('0x4d')]['id'],'VoicePrefixId':_0x462334[_0x0418('0x119')]});}});});}});}})[_0x0418('0x11')](respondWithStatusCode(_0x3513b8,null))['catch'](handleError(_0x3513b8,null));};exports['removeTeams']=function(_0xbc282a,_0x2b35c6){return db['User'][_0x0418('0x93')]({'where':{'id':_0xbc282a['params']['id']}})[_0x0418('0x11')](handleEntityNotFound(_0x2b35c6,null))[_0x0418('0x11')](function(_0x334e23){if(_0x334e23){var _0x2b6b30=_0x334e23[_0x0418('0x26')]({'plain':!![]});var _0x255bd6=_0xbc282a[_0x0418('0x3c')]['ids'];return _0x334e23[_0x0418('0x11a')](_0x255bd6)['then'](function(){for(var _0x4b338d=0x0;_0x4b338d<_0x255bd6[_0x0418('0x45')];_0x4b338d++){var _0x443fcc=[];var _0x27eb72={};db[_0x0418('0x106')][_0x0418('0x93')]({'where':{'id':_0x255bd6[_0x4b338d]}})[_0x0418('0x11')](function(_0x5bc89a){_0x27eb72=_0x5bc89a['dataValues'];_0x443fcc[_0x0418('0x46')](_0x5bc89a[_0x0418('0x11b')]()[_0x0418('0x11')](function(_0x3db50d){for(var _0x3de227=0x0;_0x3de227<_0x3db50d[_0x0418('0x45')];_0x3de227++){_0x3db50d[_0x3de227]['setDataValue'](_0x0418('0xa9'),_0x0418('0x108'));}return _0x3db50d;}));_0x443fcc['push'](_0x5bc89a[_0x0418('0x109')]()[_0x0418('0x11')](function(_0x27bbe6){for(var _0x48ed2a=0x0;_0x48ed2a<_0x27bbe6[_0x0418('0x45')];_0x48ed2a++){_0x27bbe6[_0x48ed2a][_0x0418('0x10a')](_0x0418('0xa9'),_0x0418('0x11c'));}return _0x27bbe6;}));_0x443fcc['push'](_0x5bc89a[_0x0418('0x11d')]()['then'](function(_0x4fb459){for(var _0x22741f=0x0;_0x22741f<_0x4fb459[_0x0418('0x45')];_0x22741f++){_0x4fb459[_0x22741f][_0x0418('0x10a')](_0x0418('0xa9'),_0x0418('0x10b'));}return _0x4fb459;}));_0x443fcc[_0x0418('0x46')](_0x5bc89a[_0x0418('0x10c')]()[_0x0418('0x11')](function(_0x3477a0){for(var _0x1b10d8=0x0;_0x1b10d8<_0x3477a0[_0x0418('0x45')];_0x1b10d8++){_0x3477a0[_0x1b10d8][_0x0418('0x10a')](_0x0418('0xa9'),_0x0418('0x10d'));}return _0x3477a0;}));_0x443fcc['push'](_0x5bc89a[_0x0418('0x10e')]()[_0x0418('0x11')](function(_0x18638f){for(var _0xeba18c=0x0;_0xeba18c<_0x18638f[_0x0418('0x45')];_0xeba18c++){_0x18638f[_0xeba18c][_0x0418('0x10a')](_0x0418('0xa9'),_0x0418('0x10f'));}return _0x18638f;}));_0x443fcc[_0x0418('0x46')](_0x5bc89a['getFaxQueues']()[_0x0418('0x11')](function(_0x28eadd){for(var _0x786223=0x0;_0x786223<_0x28eadd['length'];_0x786223++){_0x28eadd[_0x786223][_0x0418('0x10a')]('channel','Fax');}return _0x28eadd;}));_0x443fcc[_0x0418('0x46')](_0x5bc89a[_0x0418('0x111')]()['then'](function(_0x3cdfdb){for(var _0x48d42a=0x0;_0x48d42a<_0x3cdfdb[_0x0418('0x45')];_0x48d42a++){_0x3cdfdb[_0x48d42a][_0x0418('0x10a')](_0x0418('0xa9'),_0x0418('0x112'));}return _0x3cdfdb;}));return BPromise[_0x0418('0x4c')](_0x443fcc);})[_0x0418('0x11')](function(_0x344b89){var _0x2cda51=_[_0x0418('0x113')](_0x344b89);_0x443fcc=[];return db[_0x0418('0x66')]['transaction'](function(_0x577717){for(var _0x14d7d6=0x0;_0x14d7d6<_0x2cda51[_0x0418('0x45')];_0x14d7d6++){_0x443fcc[_0x0418('0x46')](_0x2cda51[_0x14d7d6][_0x0418('0x11e')](_0x2b6b30['id']),{'transaction':_0x577717});}return BPromise[_0x0418('0x4c')](_0x443fcc)[_0x0418('0x11')](function(){if(_0x2b6b30[_0x0418('0xa5')]){return BPromise[_0x0418('0x84')](_[_0x0418('0x2d')](_0x2cda51,function(_0x1c7850){return _0x1c7850[_0x0418('0x116')](_0x0418('0xa9'))===_0x0418('0x108');}),function(_0x3c570b){return db['UserVoiceQueueRt'][_0x0418('0x25')]({'where':{'VoiceQueueId':_0x3c570b['id'],'UserId':_0x2b6b30['id']},'transaction':_0x577717});});}else{return;}})[_0x0418('0x11')](function(){db[_0x0418('0x117')][_0x0418('0x93')]({'where':{'teamId':_0x27eb72['id']}})[_0x0418('0x11')](function(_0x1324cc){if(_0x1324cc){return db[_0x0418('0x118')][_0x0418('0x25')]({'where':{'UserId':_0x2b6b30['id'],'VoicePrefixId':_0x1324cc[_0x0418('0x49')]['VoicePrefixId']}});}});})[_0x0418('0x11')](function(){for(var _0x3c68f2=0x0;_0x3c68f2<_0x2cda51[_0x0418('0x45')];_0x3c68f2++){var _0x333176=_0x2cda51[_0x3c68f2]['getDataValue'](_0x0418('0xa9'));var _0x14c866=_0x333176+'QueueId';socket[_0x0418('0xa3')]('user'+_0x333176+_0x0418('0xac'),{'UserId':_0x2b6b30['id'],['queueField']:_0x2cda51[_0x3c68f2]['id']});}});});});}});}})[_0x0418('0x11')](respondWithStatusCode(_0x2b35c6,null))[_0x0418('0x1b')](handleError(_0x2b35c6,null));};exports[_0x0418('0x11f')]=function(_0x4474c1,_0x1a3478){var _0x21e82d={};var _0x1cccfb={};var _0x400c97;var _0x44f796;return db[_0x0418('0x35')]['findOne']({'where':{'id':_0x4474c1[_0x0418('0x4d')]['id']}})[_0x0418('0x11')](handleEntityNotFound(_0x1a3478,null))[_0x0418('0x11')](function(_0x533798){if(_0x533798){_0x400c97=_0x533798;_0x1cccfb[_0x0418('0x4e')]=_[_0x0418('0x50')](db[_0x0418('0xc7')][_0x0418('0x36')]);_0x1cccfb[_0x0418('0x3c')]=_[_0x0418('0x50')](_0x4474c1[_0x0418('0x3c')]);_0x1cccfb['filters']=_[_0x0418('0x54')](_0x1cccfb[_0x0418('0x4e')],_0x1cccfb[_0x0418('0x3c')]);_0x21e82d['attributes']=_['intersection'](_0x1cccfb[_0x0418('0x4e')],qs['fields'](_0x4474c1[_0x0418('0x3c')][_0x0418('0x55')]));_0x21e82d[_0x0418('0x41')]=_0x21e82d[_0x0418('0x41')][_0x0418('0x45')]?_0x21e82d[_0x0418('0x41')]:_0x1cccfb[_0x0418('0x4e')];_0x21e82d[_0x0418('0xc4')]=qs[_0x0418('0xcf')](_0x4474c1['query'][_0x0418('0xcf')]);_0x21e82d[_0x0418('0x3b')]=qs[_0x0418('0x53')](_['pick'](_0x4474c1[_0x0418('0x3c')],_0x1cccfb[_0x0418('0x53')]));if(_0x4474c1['query']['filter']){_0x21e82d['where']=_[_0x0418('0xc6')](_0x21e82d['where'],{'$or':_[_0x0418('0x87')](_0x21e82d['attributes'],function(_0x296049){var _0x2265fb={};_0x2265fb[_0x296049]={'$like':'%'+_0x4474c1[_0x0418('0x3c')][_0x0418('0x2d')]+'%'};return _0x2265fb;})});}_0x21e82d=_[_0x0418('0xc6')]({},_0x21e82d,_0x4474c1[_0x0418('0x57')]);return _0x400c97[_0x0418('0x11f')](_0x21e82d);}})[_0x0418('0x11')](function(_0x100da2){if(_0x100da2){_0x44f796=_0x100da2[_0x0418('0x45')];if(!_0x4474c1[_0x0418('0x3c')][_0x0418('0xcc')](_0x0418('0xcd'))){_0x21e82d[_0x0418('0x1e')]=qs[_0x0418('0x1e')](_0x4474c1[_0x0418('0x3c')][_0x0418('0x1e')]);_0x21e82d[_0x0418('0x21')]=qs['offset'](_0x4474c1['query'][_0x0418('0x21')]);}return _0x400c97[_0x0418('0x11f')](_0x21e82d);}})[_0x0418('0x11')](function(_0x2c6c88){if(_0x2c6c88){return _0x2c6c88?{'count':_0x44f796,'rows':_0x2c6c88}:null;}})[_0x0418('0x11')](respondWithResult(_0x1a3478,null))[_0x0418('0x1b')](handleError(_0x1a3478,null));};exports[_0x0418('0x120')]=function(_0x449537,_0x445761){var _0x57101a={};var _0x4e71e4={};var _0x16473e;return db['User'][_0x0418('0x93')]({'where':{'id':_0x449537['params']['id']}})[_0x0418('0x11')](handleEntityNotFound(_0x445761,null))[_0x0418('0x11')](function(_0x2a26e6){if(_0x2a26e6){_0x16473e=_0x2a26e6;_0x4e71e4[_0x0418('0x4e')]=_[_0x0418('0x50')](db[_0x0418('0x35')][_0x0418('0x36')]);_0x4e71e4[_0x0418('0x3c')]=_[_0x0418('0x50')](_0x449537[_0x0418('0x3c')]);_0x4e71e4[_0x0418('0x53')]=_[_0x0418('0x54')](_0x4e71e4[_0x0418('0x4e')],_0x4e71e4['query']);_0x57101a[_0x0418('0x41')]=_[_0x0418('0x54')](_0x4e71e4[_0x0418('0x4e')],qs[_0x0418('0x55')](_0x449537['query'][_0x0418('0x55')]));_0x57101a[_0x0418('0x41')]=_0x57101a[_0x0418('0x41')][_0x0418('0x45')]?_0x57101a[_0x0418('0x41')]:_0x4e71e4['model'];_0x57101a['order']=qs[_0x0418('0xcf')](_0x449537[_0x0418('0x3c')][_0x0418('0xcf')]);_0x57101a[_0x0418('0x3b')]=qs['filters'](_[_0x0418('0xc5')](_0x449537[_0x0418('0x3c')],_0x4e71e4[_0x0418('0x53')]));if(_0x449537['query'][_0x0418('0x2d')]){_0x57101a[_0x0418('0x3b')]=_[_0x0418('0xc6')](_0x57101a['where'],{'$or':_[_0x0418('0x87')](_0x57101a[_0x0418('0x41')],function(_0x37d700){var _0x39086e={};_0x39086e[_0x37d700]={'$like':'%'+_0x449537[_0x0418('0x3c')][_0x0418('0x2d')]+'%'};return _0x39086e;})});}_0x57101a[_0x0418('0x4e')]=db[_0x0418('0x35')];_0x57101a['as']='Agents';_0x57101a=_[_0x0418('0xc6')]({},_0x57101a,_0x449537[_0x0418('0x57')]);return _0x16473e[_0x0418('0x11b')]({'include':[_0x57101a]});}})['then'](function(_0x5bcd68){if(_0x5bcd68){var _0x5e5e05={},_0x19a101=[];for(var _0x1dc14b=0x0;_0x1dc14b<_0x5bcd68[_0x0418('0x45')];_0x1dc14b+=0x1){for(var _0x20d988=0x0,_0x52bf2e;_0x20d988<_0x5bcd68[_0x1dc14b][_0x0418('0x7f')][_0x0418('0x45')];_0x20d988+=0x1){_0x52bf2e=_0x5bcd68[_0x1dc14b][_0x0418('0x7f')][_0x20d988][_0x0418('0x26')]({'plain':!![]});_0x5e5e05[_0x52bf2e['id']]=_0x52bf2e;}}_0x5e5e05=_['values'](_0x5e5e05);for(var _0x5592cc=qs[_0x0418('0x21')](_0x449537[_0x0418('0x3c')][_0x0418('0x21')]);_0x5592cc<_0x5e5e05['length']&&_0x19a101['length']=_0x5da235[_0x6215('0x50')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x26854c){return db[_0x6215('0x2c')][_0x6215('0x48')]({'where':{'membername':_0x26854c[_0x6215('0x28')]},'individualHooks':!![]});}})[_0x6215('0xf')](function(){if(_0x26854c){return _0x26854c[_0x6215('0x51')]({'raw':!![]});}})['then'](function(_0x458807){if(_0x26854c){if(_0x458807){var _0x9431f1=[];_0x378b69=_0x458807;if(_0x378b69[_0x6215('0x2f')]){for(var _0x2718c1=0x0;_0x2718c1<_0x378b69[_0x6215('0x2f')];_0x2718c1++){_0x9431f1[_0x6215('0x33')](db[_0x6215('0x2c')][_0x6215('0x52')]({'membername':_0x26854c[_0x6215('0x28')],'UserId':_0x26854c['id'],'queue_name':_0x378b69[_0x2718c1][_0x6215('0x28')],'VoiceQueueId':_0x378b69[_0x2718c1]['id'],'interface':_0x32e930,'paused':_0x26854c[_0x6215('0x4a')]||![],'penalty':_0x378b69[_0x2718c1][_0x6215('0x53')]||0x0}));}return BPromise[_0x6215('0x54')](_0x9431f1);}}}})[_0x6215('0xf')](function(){if(_0x26854c){return db[_0x6215('0x2d')]['findAll']({'where':{'membername':_0x26854c[_0x6215('0x28')],'exitAt':null}});}})[_0x6215('0xf')](function(_0x27702b){if(_0x26854c){if(_0x27702b&&_0x27702b[_0x6215('0x2f')]){var _0x119c9a=[];_0x27702b['forEach'](function(_0x3af1c3){_0x119c9a[_0x6215('0x33')](_0x3af1c3[_0x6215('0x3b')]({'exitAt':moment()[_0x6215('0x35')](_0x6215('0x30'))}));});return BPromise[_0x6215('0x54')](_0x119c9a);}}})[_0x6215('0xf')](function(_0x8f6ae9){if(_0x26854c){var _0x3d7b12=[];var _0x4370d8=[];var _0x27708f=utils[_0x6215('0x55')]();var _0x51652d={'membername':_0x26854c[_0x6215('0x28')],'interface':_0x32e930,'enterAt':moment()[_0x6215('0x35')](_0x6215('0x30')),'role':_0x26854c['role'],'internal':_0x26854c[_0x6215('0x2a')]};_0x27708f[_0x6215('0x32')](function(_0xb8f716){_0x3d7b12[_0x6215('0x33')](_[_0x6215('0x56')]({'channel':_0xb8f716,'type':_0x6215('0x57'),'data1':_0x6215('0x58'),'data2':_0x32e930},_0x51652d));if(_0x26854c[_0x6215('0x4a')]){_0x4370d8[_0x6215('0x33')](_[_0x6215('0x56')]({'channel':_0xb8f716,'type':_0x6215('0x2e'),'data1':_0x6215('0x59')},_0x51652d));}});return db[_0x6215('0x2d')][_0x6215('0x3a')](_0x3d7b12['concat'](_0x4370d8),{'individualHooks':!![]});}})[_0x6215('0xf')](function(){if(_0x26854c){return _0x26854c[_0x6215('0x3b')]({'online':!![],'lastLoginAt':moment()[_0x6215('0x35')](_0x6215('0x30')),'voicePause':_0x26854c[_0x6215('0x4a')]||![],'mailPause':_0x26854c[_0x6215('0x4a')]||![],'chatPause':_0x26854c[_0x6215('0x4a')]||![],'faxPause':_0x26854c['loginInPause']||![],'smsPause':_0x26854c[_0x6215('0x4a')]||![],'openchannelPause':_0x26854c['loginInPause']||![],'pauseType':_0x26854c['loginInPause']?_0x6215('0x59'):null,'lastPauseAt':moment()['format'](_0x6215('0x30')),'interface':_0x32e930});}})[_0x6215('0xf')](function(_0x480dd2){_0x4b0870(_0x480dd2);})[_0x6215('0x19')](function(_0x20d585){_0x5df314(_0x366ca6['error'](0x1f4,_0x20d585[_0x6215('0x17')]));});});}; \ No newline at end of file +var _0x7e88=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetUser','User','findAll','options','raw','where','attributes','limit','include','map','model','ShowUser','find','catch','PauseUser','role','internal','interface','UserVoiceQueueRt','update','MemberReport','name','length','format','updateAttributes','getChannels','push','isNil','PAUSE','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','YYYY-MM-DD\x20HH:mm:ss','findOne','channel','isValidChannel','Unknown\x20channel','system','chat','sms','openchannel','whatsapp','set','%s%s','Pause','all','LogoutUser','destroy','mobile','loginInPause','count','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','forEach','merge','LOGIN','callysquare','LOGININPAUSE','concat','util','moment'];(function(_0x53c05e,_0x1f65ba){var _0x12532a=function(_0x319084){while(--_0x319084){_0x53c05e['push'](_0x53c05e['shift']());}};_0x12532a(++_0x1f65ba);}(_0x7e88,0xb4));var _0x87e8=function(_0x32fe64,_0x3b51d4){_0x32fe64=_0x32fe64-0x0;var _0x334547=_0x7e88[_0x32fe64];return _0x334547;};'use strict';var _=require('lodash');var util=require(_0x87e8('0x0'));var moment=require(_0x87e8('0x1'));var BPromise=require(_0x87e8('0x2'));var rs=require(_0x87e8('0x3'));var fs=require('fs');var Redis=require(_0x87e8('0x4'));var db=require(_0x87e8('0x5'))['db'];var utils=require(_0x87e8('0x6'));var logger=require(_0x87e8('0x7'))(_0x87e8('0x8'));var config=require('../../config/environment');var jayson=require(_0x87e8('0x9'));var client=jayson[_0x87e8('0xa')][_0x87e8('0xb')]({'port':0x232a});config[_0x87e8('0xc')]=_[_0x87e8('0xd')](config[_0x87e8('0xc')],{'host':_0x87e8('0xe'),'port':0x18eb});var socket=require(_0x87e8('0xf'))(new Redis(config[_0x87e8('0xc')]));require(_0x87e8('0x10'))[_0x87e8('0x11')](socket);function respondWithRpcPromise(_0x35185f,_0x10f1d5,_0x54de51){return new BPromise(function(_0x3b47cc,_0x5ef5f8){return client['request'](_0x35185f,_0x54de51)[_0x87e8('0x12')](function(_0x3e8ff0){logger[_0x87e8('0x13')](_0x87e8('0x14'),_0x10f1d5,'request\x20sent');logger[_0x87e8('0x15')](_0x87e8('0x16'),_0x10f1d5,_0x87e8('0x17'),JSON[_0x87e8('0x18')](_0x3e8ff0));if(_0x3e8ff0[_0x87e8('0x19')]){if(_0x3e8ff0['error'][_0x87e8('0x1a')]===0x1f4){logger[_0x87e8('0x19')](_0x87e8('0x14'),_0x10f1d5,_0x3e8ff0['error'][_0x87e8('0x1b')]);return _0x5ef5f8(_0x3e8ff0['error'][_0x87e8('0x1b')]);}logger[_0x87e8('0x19')](_0x87e8('0x14'),_0x10f1d5,_0x3e8ff0[_0x87e8('0x19')][_0x87e8('0x1b')]);return _0x3b47cc(_0x3e8ff0[_0x87e8('0x19')][_0x87e8('0x1b')]);}else{logger[_0x87e8('0x13')](_0x87e8('0x14'),_0x10f1d5,'request\x20sent');_0x3b47cc(_0x3e8ff0[_0x87e8('0x1c')][_0x87e8('0x1b')]);}})['catch'](function(_0x5e5730){logger[_0x87e8('0x19')](_0x87e8('0x14'),_0x10f1d5,_0x5e5730);_0x5ef5f8(_0x5e5730);});});}exports[_0x87e8('0x1d')]=function(_0x1c8ed0){var _0x5a1833=this;return new Promise(function(_0x235b90,_0x4b0cf3){return db[_0x87e8('0x1e')][_0x87e8('0x1f')]({'raw':_0x1c8ed0['options']?_0x1c8ed0[_0x87e8('0x20')][_0x87e8('0x21')]===undefined?!![]:![]:!![],'where':_0x1c8ed0[_0x87e8('0x20')]?_0x1c8ed0['options'][_0x87e8('0x22')]||null:null,'attributes':_0x1c8ed0[_0x87e8('0x20')]?_0x1c8ed0[_0x87e8('0x20')][_0x87e8('0x23')]||null:null,'limit':_0x1c8ed0['options']?_0x1c8ed0['options'][_0x87e8('0x24')]||null:null,'include':_0x1c8ed0[_0x87e8('0x20')]?_0x1c8ed0[_0x87e8('0x20')][_0x87e8('0x25')]?_[_0x87e8('0x26')](_0x1c8ed0[_0x87e8('0x20')][_0x87e8('0x25')],function(_0x13fc83){return{'model':db[_0x13fc83[_0x87e8('0x27')]],'as':_0x13fc83['as'],'attributes':_0x13fc83[_0x87e8('0x23')],'include':_0x13fc83['include']?_[_0x87e8('0x26')](_0x13fc83['include'],function(_0x1e9091){return{'model':db[_0x1e9091[_0x87e8('0x27')]],'as':_0x1e9091['as'],'attributes':_0x1e9091[_0x87e8('0x23')],'include':_0x1e9091[_0x87e8('0x25')]?_[_0x87e8('0x26')](_0x1e9091['include'],function(_0x1429f9){return{'model':db[_0x1429f9[_0x87e8('0x27')]],'as':_0x1429f9['as'],'attributes':_0x1429f9[_0x87e8('0x23')]};}):[]};}):[]};}):[]:[]})[_0x87e8('0x12')](function(_0xd467b9){logger[_0x87e8('0x13')](_0x87e8('0x1d'),_0x1c8ed0);logger['debug']('GetUser',_0x1c8ed0,JSON['stringify'](_0xd467b9));_0x235b90(_0xd467b9);})['catch'](function(_0x4ec766){logger[_0x87e8('0x19')](_0x87e8('0x1d'),_0x4ec766[_0x87e8('0x1b')],_0x1c8ed0);_0x4b0cf3(_0x5a1833['error'](0x1f4,_0x4ec766[_0x87e8('0x1b')]));});});};exports[_0x87e8('0x28')]=function(_0x5b3bd3){var _0x32f9ac=this;return new Promise(function(_0x26e5ff,_0x23d2b2){return db[_0x87e8('0x1e')][_0x87e8('0x29')]({'raw':_0x5b3bd3['options']?_0x5b3bd3[_0x87e8('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x5b3bd3[_0x87e8('0x20')]?_0x5b3bd3[_0x87e8('0x20')]['where']||null:null,'attributes':_0x5b3bd3[_0x87e8('0x20')]?_0x5b3bd3['options'][_0x87e8('0x23')]||null:null,'include':_0x5b3bd3[_0x87e8('0x20')]?_0x5b3bd3[_0x87e8('0x20')][_0x87e8('0x25')]?_[_0x87e8('0x26')](_0x5b3bd3[_0x87e8('0x20')][_0x87e8('0x25')],function(_0x3643ff){return{'model':db[_0x3643ff['model']],'as':_0x3643ff['as'],'attributes':_0x3643ff['attributes'],'include':_0x3643ff[_0x87e8('0x25')]?_[_0x87e8('0x26')](_0x3643ff[_0x87e8('0x25')],function(_0xc5acb7){return{'model':db[_0xc5acb7[_0x87e8('0x27')]],'as':_0xc5acb7['as'],'attributes':_0xc5acb7[_0x87e8('0x23')],'include':_0xc5acb7['include']?_[_0x87e8('0x26')](_0xc5acb7[_0x87e8('0x25')],function(_0x2c68c5){return{'model':db[_0x2c68c5[_0x87e8('0x27')]],'as':_0x2c68c5['as'],'attributes':_0x2c68c5[_0x87e8('0x23')]};}):[]};}):[]};}):[]:[]})[_0x87e8('0x12')](function(_0x52a7a8){logger['info'](_0x87e8('0x28'),_0x5b3bd3);logger[_0x87e8('0x15')](_0x87e8('0x28'),_0x5b3bd3,JSON[_0x87e8('0x18')](_0x52a7a8));_0x26e5ff(_0x52a7a8);})[_0x87e8('0x2a')](function(_0x39fe23){logger[_0x87e8('0x19')](_0x87e8('0x28'),_0x39fe23[_0x87e8('0x1b')],_0x5b3bd3);_0x23d2b2(_0x32f9ac[_0x87e8('0x19')](0x1f4,_0x39fe23[_0x87e8('0x1b')]));});});};exports[_0x87e8('0x2b')]=function(_0x53855f){var _0x4ed7ed=this;return new Promise(function(_0x420608,_0x296b8e){var _0x1d1290;return db['User']['find']({'where':_0x53855f[_0x87e8('0x20')]['where']||{},'attributes':['id','name',_0x87e8('0x2c'),_0x87e8('0x2d'),_0x87e8('0x2e')]})[_0x87e8('0x12')](function(_0x343fd7){if(_0x343fd7){_0x1d1290=_0x343fd7;return db[_0x87e8('0x2f')][_0x87e8('0x30')]({'paused':0x1},{'where':{'UserId':_0x1d1290['id']},'individualHooks':!![]});}})[_0x87e8('0x12')](function(){if(_0x1d1290){return db[_0x87e8('0x31')][_0x87e8('0x1f')]({'where':{'membername':_0x1d1290[_0x87e8('0x32')],'type':'PAUSE','exitAt':null}});}})[_0x87e8('0x12')](function(_0x3deddf){if(_0x1d1290){if(_0x3deddf&&_0x3deddf[_0x87e8('0x33')]){var _0x255d29=moment()[_0x87e8('0x34')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0xdd669c=0x0,_0x83c64f=_0x3deddf['length'];_0xdd669c<_0x83c64f;_0xdd669c++){_0x3deddf[_0xdd669c][_0x87e8('0x35')]({'exitAt':_0x255d29});}}}})[_0x87e8('0x12')](function(){if(_0x1d1290){var _0x4b6410=[];var _0x40da07=utils[_0x87e8('0x36')]();_0x40da07['forEach'](function(_0x950904){_0x4b6410[_0x87e8('0x37')]({'channel':_0x950904,'membername':_0x1d1290[_0x87e8('0x32')],'interface':_[_0x87e8('0x38')](_0x1d1290[_0x87e8('0x2e')])?util['format']('SIP/%s',_0x1d1290['name']):_0x1d1290['interface'],'type':_0x87e8('0x39'),'enterAt':moment()[_0x87e8('0x34')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x53855f[_0x87e8('0x3a')][_0x87e8('0x3b')]||_0x87e8('0x3c'),'role':_0x1d1290[_0x87e8('0x2c')],'internal':_0x1d1290[_0x87e8('0x2d')],'uniqueid':_0x53855f[_0x87e8('0x3a')][_0x87e8('0x3d')]||null});});return db[_0x87e8('0x31')][_0x87e8('0x3e')](_0x4b6410,{'individualHooks':!![]});}})['then'](function(){if(_0x1d1290){return _0x1d1290[_0x87e8('0x30')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x53855f['body']['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x87e8('0x34')](_0x87e8('0x3f'))});}})[_0x87e8('0x12')](function(_0x2be8ca){_0x420608(_0x2be8ca);})[_0x87e8('0x2a')](function(_0x1a36a3){_0x296b8e(_0x4ed7ed['error'](0x1f4,_0x1a36a3[_0x87e8('0x1b')]));});});};exports['UnpauseUser']=function(_0x47244e){var _0x67cebd=this;return new Promise(function(_0x5cedfe,_0x72c997){var _0x513551;return db[_0x87e8('0x1e')][_0x87e8('0x40')]({'where':_0x47244e[_0x87e8('0x20')][_0x87e8('0x22')]||{},'attributes':['id','name']})[_0x87e8('0x12')](function(_0x7a9521){if(_0x7a9521){_0x513551=_0x7a9521;if(_0x47244e[_0x87e8('0x3a')][_0x87e8('0x41')]&&!utils[_0x87e8('0x42')](_0x47244e[_0x87e8('0x3a')][_0x87e8('0x41')])){throw new Error(_0x87e8('0x43'));}switch(_0x47244e[_0x87e8('0x3a')][_0x87e8('0x41')]){case'voice':return db[_0x87e8('0x2f')][_0x87e8('0x30')]({'paused':0x0},{'where':{'UserId':_0x513551['id']}})['then'](function(){return db['MemberReport']['find']({'where':{'channel':_0x47244e[_0x87e8('0x3a')][_0x87e8('0x41')],'membername':_0x513551[_0x87e8('0x32')],'type':_0x87e8('0x39'),'exitAt':null}});})['then'](function(_0xf959a8){if(_0xf959a8){return _0xf959a8[_0x87e8('0x30')]({'exitAt':moment()[_0x87e8('0x34')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x87e8('0x44')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x513551[_0x87e8('0x30')]({'voicePause':![]});});case'mail':case _0x87e8('0x45'):case'fax':case _0x87e8('0x46'):case _0x87e8('0x47'):case _0x87e8('0x48'):return db[_0x87e8('0x31')]['find']({'where':{'channel':_0x47244e[_0x87e8('0x3a')][_0x87e8('0x41')],'membername':_0x513551[_0x87e8('0x32')],'type':_0x87e8('0x39'),'exitAt':null}})[_0x87e8('0x12')](function(_0x542023){return _0x542023[_0x87e8('0x30')]({'exitAt':moment()[_0x87e8('0x34')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x87e8('0x44')},{'individualHooks':!![]});})[_0x87e8('0x12')](function(){var _0x3378b1={};_[_0x87e8('0x49')](_0x3378b1,util['format'](_0x87e8('0x4a'),_0x47244e[_0x87e8('0x3a')]['channel'],_0x87e8('0x4b')),![]);return _0x513551['update'](_0x3378b1);});default:return db[_0x87e8('0x2f')][_0x87e8('0x30')]({'paused':0x0},{'where':{'UserId':_0x513551['id']}})['then'](function(){return db[_0x87e8('0x31')]['findAll']({'where':{'membername':_0x513551['name'],'type':_0x87e8('0x39'),'exitAt':null}});})[_0x87e8('0x12')](function(_0x1756da){var _0xc9544b=[];_0x1756da['forEach'](function(_0x19e799){_0xc9544b[_0x87e8('0x37')](_0x19e799[_0x87e8('0x30')]({'exitAt':moment()[_0x87e8('0x34')](_0x87e8('0x3f')),'data2':'system'}));});return BPromise[_0x87e8('0x4c')](_0xc9544b);})[_0x87e8('0x12')](function(){return _0x513551['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x5117c9){_0x5cedfe(_0x5117c9);})['catch'](function(_0x71e036){_0x72c997(_0x67cebd[_0x87e8('0x19')](0x1f4,_0x71e036[_0x87e8('0x1b')]));});});};exports[_0x87e8('0x4d')]=function(_0x438885){var _0x5c5d34=this;return new Promise(function(_0xd3810,_0x85b20a){var _0x4f4c12;return db[_0x87e8('0x1e')][_0x87e8('0x40')]({'where':_0x438885[_0x87e8('0x20')]['where']||{},'attributes':['id',_0x87e8('0x32')]})['then'](function(_0x188056){if(_0x188056){_0x4f4c12=_0x188056;return db[_0x87e8('0x2f')][_0x87e8('0x4e')]({'where':{'membername':_0x4f4c12[_0x87e8('0x32')]},'individualHooks':!![]});}})[_0x87e8('0x12')](function(){if(_0x4f4c12){return db[_0x87e8('0x31')][_0x87e8('0x1f')]({'where':{'membername':_0x4f4c12[_0x87e8('0x32')],'exitAt':null}});}})[_0x87e8('0x12')](function(_0xfbe063){if(_0x4f4c12){if(_0xfbe063&&_0xfbe063[_0x87e8('0x33')]){var _0x59f076=[];_0xfbe063['forEach'](function(_0x25f7c9){_0x59f076[_0x87e8('0x37')](_0x25f7c9['update']({'exitAt':moment()[_0x87e8('0x34')](_0x87e8('0x3f'))}));});return BPromise['all'](_0x59f076);}}})[_0x87e8('0x12')](function(){if(_0x4f4c12){return _0x4f4c12[_0x87e8('0x30')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x87e8('0x12')](function(_0x46131c){_0xd3810(_0x46131c);})[_0x87e8('0x2a')](function(_0x28e06c){_0x85b20a(_0x5c5d34[_0x87e8('0x19')](0x1f4,_0x28e06c[_0x87e8('0x1b')]));});});};exports['LoginUser']=function(_0x5be2a7){var _0x22e663=this;return new Promise(function(_0x3b1055,_0x547807){var _0xdf836a;var _0x18059d;var _0x556310;var _0x3ccc7f;return db[_0x87e8('0x1e')][_0x87e8('0x40')]({'where':_0x5be2a7[_0x87e8('0x20')][_0x87e8('0x22')]||{},'attributes':['id','name',_0x87e8('0x2c'),_0x87e8('0x4f'),'phone','internal',_0x87e8('0x50'),_0x87e8('0x2e')]})[_0x87e8('0x12')](function(_0x1b781f){if(_0x1b781f){_0xdf836a=_0x1b781f;_0x3ccc7f=_0x5be2a7['body'][_0x87e8('0x2e')]?_0x5be2a7['body']['interface']:util[_0x87e8('0x34')]('SIP/%s',_0xdf836a[_0x87e8('0x32')]);return db['User'][_0x87e8('0x51')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0xdf836a['id']}}});}})[_0x87e8('0x12')](function(_0x36a229){if(_0x36a229){_0x556310=_0x36a229;return require('../../config/license/util')[_0x87e8('0x52')]();}})['then'](function(_0x5525ce){if(_0x5525ce&&_0x5525ce[_0x87e8('0x53')]&&_0x556310>=_0x5525ce['agents']){throw new Error(_0x87e8('0x54'));}})[_0x87e8('0x12')](function(){if(_0xdf836a){return db[_0x87e8('0x2f')]['destroy']({'where':{'membername':_0xdf836a[_0x87e8('0x32')]},'individualHooks':!![]});}})[_0x87e8('0x12')](function(){if(_0xdf836a){return _0xdf836a['getVoiceQueues']({'raw':!![]});}})[_0x87e8('0x12')](function(_0x475266){if(_0xdf836a){if(_0x475266){var _0x40629e=[];_0x18059d=_0x475266;if(_0x18059d[_0x87e8('0x33')]){for(var _0x53aa11=0x0;_0x53aa11<_0x18059d[_0x87e8('0x33')];_0x53aa11++){_0x40629e['push'](db[_0x87e8('0x2f')]['upsert']({'membername':_0xdf836a[_0x87e8('0x32')],'UserId':_0xdf836a['id'],'queue_name':_0x18059d[_0x53aa11][_0x87e8('0x32')],'VoiceQueueId':_0x18059d[_0x53aa11]['id'],'interface':_0x3ccc7f,'paused':_0xdf836a['loginInPause']||![],'penalty':_0x18059d[_0x53aa11]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x87e8('0x4c')](_0x40629e);}}}})[_0x87e8('0x12')](function(){if(_0xdf836a){return db[_0x87e8('0x31')][_0x87e8('0x1f')]({'where':{'membername':_0xdf836a[_0x87e8('0x32')],'exitAt':null}});}})[_0x87e8('0x12')](function(_0x21b4b8){if(_0xdf836a){if(_0x21b4b8&&_0x21b4b8[_0x87e8('0x33')]){var _0x22a29c=[];_0x21b4b8[_0x87e8('0x55')](function(_0x5aa8ec){_0x22a29c[_0x87e8('0x37')](_0x5aa8ec['update']({'exitAt':moment()[_0x87e8('0x34')](_0x87e8('0x3f'))}));});return BPromise[_0x87e8('0x4c')](_0x22a29c);}}})[_0x87e8('0x12')](function(_0x291ed2){if(_0xdf836a){var _0x2a8a85=[];var _0xc24421=[];var _0x5300e2=utils[_0x87e8('0x36')]();var _0x525dfb={'membername':_0xdf836a[_0x87e8('0x32')],'interface':_0x3ccc7f,'enterAt':moment()[_0x87e8('0x34')](_0x87e8('0x3f')),'role':_0xdf836a['role'],'internal':_0xdf836a[_0x87e8('0x2d')]};_0x5300e2['forEach'](function(_0x26d7f1){_0x2a8a85[_0x87e8('0x37')](_[_0x87e8('0x56')]({'channel':_0x26d7f1,'type':_0x87e8('0x57'),'data1':_0x87e8('0x58'),'data2':_0x3ccc7f},_0x525dfb));if(_0xdf836a['loginInPause']){_0xc24421[_0x87e8('0x37')](_[_0x87e8('0x56')]({'channel':_0x26d7f1,'type':'PAUSE','data1':_0x87e8('0x59')},_0x525dfb));}});return db[_0x87e8('0x31')][_0x87e8('0x3e')](_0x2a8a85[_0x87e8('0x5a')](_0xc24421),{'individualHooks':!![]});}})['then'](function(){if(_0xdf836a){return _0xdf836a['update']({'online':!![],'lastLoginAt':moment()[_0x87e8('0x34')](_0x87e8('0x3f')),'voicePause':_0xdf836a['loginInPause']||![],'mailPause':_0xdf836a[_0x87e8('0x50')]||![],'chatPause':_0xdf836a[_0x87e8('0x50')]||![],'faxPause':_0xdf836a[_0x87e8('0x50')]||![],'smsPause':_0xdf836a[_0x87e8('0x50')]||![],'openchannelPause':_0xdf836a[_0x87e8('0x50')]||![],'pauseType':_0xdf836a[_0x87e8('0x50')]?_0x87e8('0x59'):null,'lastPauseAt':moment()['format'](_0x87e8('0x3f')),'interface':_0x3ccc7f});}})[_0x87e8('0x12')](function(_0x316af6){_0x3b1055(_0x316af6);})['catch'](function(_0x2c8c23){_0x547807(_0x22e663['error'](0x1f4,_0x2c8c23['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index a9c445f..a1db7de 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 _0xb0f5=['length','user:','save','update','emit'];(function(_0x97c6ea,_0x4cffce){var _0x2d7f50=function(_0x54010e){while(--_0x54010e){_0x97c6ea['push'](_0x97c6ea['shift']());}};_0x2d7f50(++_0x4cffce);}(_0xb0f5,0x18d));var _0x5b0f=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xb0f5[_0x45bf86];return _0x1f02b7;};'use strict';var UserEvents=require('./user.events');var events=[_0x5b0f('0x0'),'remove',_0x5b0f('0x1')];function createListener(_0x6122b0,_0x4e953c){return function(_0x52930f){_0x4e953c[_0x5b0f('0x2')](_0x6122b0,_0x52930f);};}function removeListener(_0x39aae6,_0x2f4118){return function(){UserEvents['removeListener'](_0x39aae6,_0x2f4118);};}exports['register']=function(_0x2d8bd2){for(var _0x1fcce7=0x0,_0x2d9f5c=events[_0x5b0f('0x3')];_0x1fcce7<_0x2d9f5c;_0x1fcce7++){var _0x542f04=events[_0x1fcce7];var _0x14f92d=createListener(_0x5b0f('0x4')+_0x542f04,_0x2d8bd2);UserEvents['on'](_0x542f04,_0x14f92d);}}; \ No newline at end of file +var _0xded7=['register','length','user:','save','remove','update','removeListener'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xded7,0x184));var _0x7ded=function(_0x53d45f,_0x1e93d3){_0x53d45f=_0x53d45f-0x0;var _0x3d95aa=_0xded7[_0x53d45f];return _0x3d95aa;};'use strict';var UserEvents=require('./user.events');var events=[_0x7ded('0x0'),_0x7ded('0x1'),_0x7ded('0x2')];function createListener(_0x4c4525,_0x33607a){return function(_0x35d6ae){_0x33607a['emit'](_0x4c4525,_0x35d6ae);};}function removeListener(_0x5d0209,_0x3920dd){return function(){UserEvents[_0x7ded('0x3')](_0x5d0209,_0x3920dd);};}exports[_0x7ded('0x4')]=function(_0x38b90c){for(var _0x27e6e9=0x0,_0x25fd2d=events[_0x7ded('0x5')];_0x27e6e9<_0x25fd2d;_0x27e6e9++){var _0x560a6a=events[_0x27e6e9];var _0xf4b81c=createListener(_0x7ded('0x6')+_0x560a6a,_0x38b90c);UserEvents['on'](_0x560a6a,_0xf4b81c);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 6a25508..fe88aa4 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4e7fd0,_0x29cccd){var _0x1de972=function(_0x430190){while(--_0x430190){_0x4e7fd0['push'](_0x4e7fd0['shift']());}};_0x1de972(++_0x29cccd);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3a3e30,_0x5996b5){var _0x19f849=function(_0xc6e736){while(--_0xc6e736){_0x3a3e30['push'](_0x3a3e30['shift']());}};_0x19f849(++_0x5996b5);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index fb9d85d..1a424f4 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 _0x0694=['exports','sequelize'];(function(_0x207e97,_0x613238){var _0x5ba92c=function(_0x3b14f4){while(--_0x3b14f4){_0x207e97['push'](_0x207e97['shift']());}};_0x5ba92c(++_0x613238);}(_0x0694,0x183));var _0x4069=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x0694[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x4069('0x0'));module[_0x4069('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7fa2=['INTEGER','sequelize'];(function(_0x2a052e,_0x46e508){var _0x3a0e12=function(_0x1d1183){while(--_0x1d1183){_0x2a052e['push'](_0x2a052e['shift']());}};_0x3a0e12(++_0x46e508);}(_0x7fa2,0x101));var _0x27fa=function(_0x22bff1,_0x1d964a){_0x22bff1=_0x22bff1-0x0;var _0x279396=_0x7fa2[_0x22bff1];return _0x279396;};'use strict';var Sequelize=require(_0x27fa('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x27fa('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 943c4e9..84879cf 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 _0xa9a6=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','util','api','moment'];(function(_0x1744cc,_0x17da8d){var _0x276e64=function(_0x4cc40c){while(--_0x4cc40c){_0x1744cc['push'](_0x1744cc['shift']());}};_0x276e64(++_0x17da8d);}(_0xa9a6,0x8d));var _0x6a9a=function(_0x1b2c3b,_0x181617){_0x1b2c3b=_0x1b2c3b-0x0;var _0xc26ba1=_0xa9a6[_0x1b2c3b];return _0xc26ba1;};'use strict';var _=require('lodash');var util=require(_0x6a9a('0x0'));var logger=require('../../config/logger')(_0x6a9a('0x1'));var moment=require(_0x6a9a('0x2'));var BPromise=require(_0x6a9a('0x3'));var rp=require(_0x6a9a('0x4'));var fs=require('fs');var path=require(_0x6a9a('0x5'));var rimraf=require(_0x6a9a('0x6'));var config=require(_0x6a9a('0x7'));var attributes=require(_0x6a9a('0x8'));module[_0x6a9a('0x9')]=function(_0x929ec3,_0x103fb3){return _0x929ec3['define'](_0x6a9a('0xa'),attributes,{'tableName':_0x6a9a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8917=['define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x4e029c,_0x704224){var _0x1dbb3a=function(_0x57c5af){while(--_0x57c5af){_0x4e029c['push'](_0x4e029c['shift']());}};_0x1dbb3a(++_0x704224);}(_0x8917,0x65));var _0x7891=function(_0xbcb2ae,_0x56dba2){_0xbcb2ae=_0xbcb2ae-0x0;var _0x53b0a5=_0x8917[_0xbcb2ae];return _0x53b0a5;};'use strict';var _=require(_0x7891('0x0'));var util=require(_0x7891('0x1'));var logger=require(_0x7891('0x2'))(_0x7891('0x3'));var moment=require(_0x7891('0x4'));var BPromise=require(_0x7891('0x5'));var rp=require(_0x7891('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7891('0x7'));var config=require(_0x7891('0x8'));var attributes=require(_0x7891('0x9'));module[_0x7891('0xa')]=function(_0x4499b6,_0x3498b1){return _0x4499b6[_0x7891('0xb')](_0x7891('0xc'),attributes,{'tableName':_0x7891('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 72b7e09..5c70d9f 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 _0x3d32=['request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x11b4a3,_0x3ea641){var _0x4999bc=function(_0xa2552d){while(--_0xa2552d){_0x11b4a3['push'](_0x11b4a3['shift']());}};_0x4999bc(++_0x3ea641);}(_0x3d32,0x85));var _0x23d3=function(_0x34409d,_0x41e552){_0x34409d=_0x34409d-0x0;var _0x23b814=_0x3d32[_0x34409d];return _0x23b814;};'use strict';var _=require('lodash');var util=require(_0x23d3('0x0'));var moment=require('moment');var BPromise=require(_0x23d3('0x1'));var rs=require(_0x23d3('0x2'));var fs=require('fs');var Redis=require(_0x23d3('0x3'));var db=require(_0x23d3('0x4'))['db'];var utils=require(_0x23d3('0x5'));var logger=require(_0x23d3('0x6'))('rpc');var config=require(_0x23d3('0x7'));var jayson=require(_0x23d3('0x8'));var client=jayson[_0x23d3('0x9')][_0x23d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa8a06f,_0x2bc66b,_0x1b72c4){return new BPromise(function(_0x5ab331,_0x113910){return client[_0x23d3('0xb')](_0xa8a06f,_0x1b72c4)[_0x23d3('0xc')](function(_0x27ecc2){logger[_0x23d3('0xd')](_0x23d3('0xe'),_0x2bc66b,_0x23d3('0xf'));logger[_0x23d3('0x10')](_0x23d3('0x11'),_0x2bc66b,_0x23d3('0xf'),JSON[_0x23d3('0x12')](_0x27ecc2));if(_0x27ecc2[_0x23d3('0x13')]){if(_0x27ecc2[_0x23d3('0x13')][_0x23d3('0x14')]===0x1f4){logger[_0x23d3('0x13')](_0x23d3('0xe'),_0x2bc66b,_0x27ecc2[_0x23d3('0x13')][_0x23d3('0x15')]);return _0x113910(_0x27ecc2[_0x23d3('0x13')][_0x23d3('0x15')]);}logger['error'](_0x23d3('0xe'),_0x2bc66b,_0x27ecc2[_0x23d3('0x13')]['message']);return _0x5ab331(_0x27ecc2[_0x23d3('0x13')]['message']);}else{logger[_0x23d3('0xd')](_0x23d3('0xe'),_0x2bc66b,_0x23d3('0xf'));_0x5ab331(_0x27ecc2[_0x23d3('0x16')][_0x23d3('0x15')]);}})[_0x23d3('0x17')](function(_0x15176d){logger['error'](_0x23d3('0xe'),_0x2bc66b,_0x15176d);_0x113910(_0x15176d);});});} \ No newline at end of file +var _0x8b8c=['bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment'];(function(_0x4dcb38,_0x317b57){var _0x4e4abc=function(_0x11a67b){while(--_0x11a67b){_0x4dcb38['push'](_0x4dcb38['shift']());}};_0x4e4abc(++_0x317b57);}(_0x8b8c,0x99));var _0xc8b8=function(_0x560ec6,_0x3b2a03){_0x560ec6=_0x560ec6-0x0;var _0x4649e8=_0x8b8c[_0x560ec6];return _0x4649e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc8b8('0x0'));var BPromise=require(_0xc8b8('0x1'));var rs=require(_0xc8b8('0x2'));var fs=require('fs');var Redis=require(_0xc8b8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc8b8('0x4'))(_0xc8b8('0x5'));var config=require('../../config/environment');var jayson=require(_0xc8b8('0x6'));var client=jayson[_0xc8b8('0x7')][_0xc8b8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38a498,_0x3229e6,_0x32aad4){return new BPromise(function(_0x536cc9,_0x18dcd5){return client[_0xc8b8('0x9')](_0x38a498,_0x32aad4)[_0xc8b8('0xa')](function(_0x389607){logger['info'](_0xc8b8('0xb'),_0x3229e6,_0xc8b8('0xc'));logger[_0xc8b8('0xd')](_0xc8b8('0xe'),_0x3229e6,_0xc8b8('0xc'),JSON[_0xc8b8('0xf')](_0x389607));if(_0x389607[_0xc8b8('0x10')]){if(_0x389607[_0xc8b8('0x10')][_0xc8b8('0x11')]===0x1f4){logger[_0xc8b8('0x10')](_0xc8b8('0xb'),_0x3229e6,_0x389607[_0xc8b8('0x10')]['message']);return _0x18dcd5(_0x389607['error']['message']);}logger['error'](_0xc8b8('0xb'),_0x3229e6,_0x389607['error'][_0xc8b8('0x12')]);return _0x536cc9(_0x389607[_0xc8b8('0x10')][_0xc8b8('0x12')]);}else{logger[_0xc8b8('0x13')](_0xc8b8('0xb'),_0x3229e6,_0xc8b8('0xc'));_0x536cc9(_0x389607[_0xc8b8('0x14')][_0xc8b8('0x12')]);}})[_0xc8b8('0x15')](function(_0x3bee7b){logger[_0xc8b8('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x3229e6,_0x3bee7b);_0x18dcd5(_0x3bee7b);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index bfefa38..80f86d1 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4ac60a,_0x503a99){var _0x4b22e8=function(_0x145c47){while(--_0x145c47){_0x4ac60a['push'](_0x4ac60a['shift']());}};_0x4b22e8(++_0x503a99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x52ea08,_0x15d935){var _0x28d546=function(_0x4a3aa7){while(--_0x4a3aa7){_0x52ea08['push'](_0x52ea08['shift']());}};_0x28d546(++_0x15d935);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 0b0ad19..36ffc8e 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 _0x60d4=['INTEGER','sequelize'];(function(_0x324341,_0x4f23c9){var _0x451a37=function(_0x5653ac){while(--_0x5653ac){_0x324341['push'](_0x324341['shift']());}};_0x451a37(++_0x4f23c9);}(_0x60d4,0x127));var _0x460d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x60d4[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x460d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x460d('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x460d('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3651=['exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3651,0x126));var _0x1365=function(_0x412cff,_0x457a19){_0x412cff=_0x412cff-0x0;var _0x2a74de=_0x3651[_0x412cff];return _0x2a74de;};'use strict';var Sequelize=require('sequelize');module[_0x1365('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x1365('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 0c7ef75..a92a0f2 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 _0xf2ab=['api','moment','bluebird','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util'];(function(_0xc7a86b,_0x1fecea){var _0x15a15f=function(_0x3082e8){while(--_0x3082e8){_0xc7a86b['push'](_0xc7a86b['shift']());}};_0x15a15f(++_0x1fecea);}(_0xf2ab,0x1c1));var _0xbf2a=function(_0x26b0a2,_0x5f01e7){_0x26b0a2=_0x26b0a2-0x0;var _0x33e55c=_0xf2ab[_0x26b0a2];return _0x33e55c;};'use strict';var _=require('lodash');var util=require(_0xbf2a('0x0'));var logger=require('../../config/logger')(_0xbf2a('0x1'));var moment=require(_0xbf2a('0x2'));var BPromise=require(_0xbf2a('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(_0xbf2a('0x4'));module[_0xbf2a('0x5')]=function(_0x264d89,_0x4096){return _0x264d89[_0xbf2a('0x6')](_0xbf2a('0x7'),attributes,{'tableName':_0xbf2a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35b3=['bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35b3,0x81));var _0x335b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x35b3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x335b('0x0'));var util=require(_0x335b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x335b('0x2'));var BPromise=require(_0x335b('0x3'));var rp=require(_0x335b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x335b('0x5'));var config=require(_0x335b('0x6'));var attributes=require(_0x335b('0x7'));module['exports']=function(_0x33ffc6,_0x451b72){return _0x33ffc6[_0x335b('0x8')](_0x335b('0x9'),attributes,{'tableName':_0x335b('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 99fde87..2218e88 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 _0xef18=['then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0xef18,0x184));var _0x8ef1=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0xef18[_0x1344d6];return _0xf45b24;};'use strict';var _=require(_0x8ef1('0x0'));var util=require(_0x8ef1('0x1'));var moment=require(_0x8ef1('0x2'));var BPromise=require(_0x8ef1('0x3'));var rs=require(_0x8ef1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ef1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ef1('0x6'))(_0x8ef1('0x7'));var config=require(_0x8ef1('0x8'));var jayson=require(_0x8ef1('0x9'));var client=jayson[_0x8ef1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cd174,_0x4b80d0,_0x39528f){return new BPromise(function(_0x3babd1,_0xb25ded){return client[_0x8ef1('0xb')](_0x1cd174,_0x39528f)[_0x8ef1('0xc')](function(_0x5444a7){logger[_0x8ef1('0xd')](_0x8ef1('0xe'),_0x4b80d0,_0x8ef1('0xf'));logger[_0x8ef1('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x4b80d0,_0x8ef1('0xf'),JSON['stringify'](_0x5444a7));if(_0x5444a7['error']){if(_0x5444a7[_0x8ef1('0x11')][_0x8ef1('0x12')]===0x1f4){logger[_0x8ef1('0x11')](_0x8ef1('0xe'),_0x4b80d0,_0x5444a7['error']['message']);return _0xb25ded(_0x5444a7[_0x8ef1('0x11')][_0x8ef1('0x13')]);}logger[_0x8ef1('0x11')](_0x8ef1('0xe'),_0x4b80d0,_0x5444a7[_0x8ef1('0x11')][_0x8ef1('0x13')]);return _0x3babd1(_0x5444a7[_0x8ef1('0x11')][_0x8ef1('0x13')]);}else{logger[_0x8ef1('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x4b80d0,_0x8ef1('0xf'));_0x3babd1(_0x5444a7['result']['message']);}})['catch'](function(_0x1b4207){logger[_0x8ef1('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x4b80d0,_0x1b4207);_0xb25ded(_0x1b4207);});});} \ No newline at end of file +var _0xdbbd=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','request','then','info','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserFaxQueue,\x20%s,\x20%s','message','result','catch','util'];(function(_0x1c081d,_0x10b432){var _0x2deb0e=function(_0x43fcbd){while(--_0x43fcbd){_0x1c081d['push'](_0x1c081d['shift']());}};_0x2deb0e(++_0x10b432);}(_0xdbbd,0x109));var _0xddbb=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xdbbd[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require('lodash');var util=require(_0xddbb('0x0'));var moment=require(_0xddbb('0x1'));var BPromise=require(_0xddbb('0x2'));var rs=require(_0xddbb('0x3'));var fs=require('fs');var Redis=require(_0xddbb('0x4'));var db=require(_0xddbb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xddbb('0x6'));var config=require(_0xddbb('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34d350,_0x47eef0,_0x206817){return new BPromise(function(_0x4165c3,_0x4fa586){return client[_0xddbb('0x8')](_0x34d350,_0x206817)[_0xddbb('0x9')](function(_0xc9ffd6){logger[_0xddbb('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x47eef0,'request\x20sent');logger['debug'](_0xddbb('0xb'),_0x47eef0,_0xddbb('0xc'),JSON[_0xddbb('0xd')](_0xc9ffd6));if(_0xc9ffd6[_0xddbb('0xe')]){if(_0xc9ffd6[_0xddbb('0xe')]['code']===0x1f4){logger[_0xddbb('0xe')](_0xddbb('0xf'),_0x47eef0,_0xc9ffd6['error'][_0xddbb('0x10')]);return _0x4fa586(_0xc9ffd6[_0xddbb('0xe')][_0xddbb('0x10')]);}logger[_0xddbb('0xe')](_0xddbb('0xf'),_0x47eef0,_0xc9ffd6['error']['message']);return _0x4165c3(_0xc9ffd6['error'][_0xddbb('0x10')]);}else{logger[_0xddbb('0xa')](_0xddbb('0xf'),_0x47eef0,_0xddbb('0xc'));_0x4165c3(_0xc9ffd6[_0xddbb('0x11')][_0xddbb('0x10')]);}})[_0xddbb('0x12')](function(_0x27597e){logger['error'](_0xddbb('0xf'),_0x47eef0,_0x27597e);_0x4fa586(_0x27597e);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 236264d..39fb3e0 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x10befa,_0x23b03a){var _0x3b4089=function(_0x11e9ec){while(--_0x11e9ec){_0x10befa['push'](_0x10befa['shift']());}};_0x3b4089(++_0x23b03a);}(_0xe706,0xa3));var _0x6e70=function(_0x2c7341,_0x293a18){_0x2c7341=_0x2c7341-0x0;var _0x23f3fc=_0xe706[_0x2c7341];return _0x23f3fc;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xe04ceb,_0x2ed4f7){var _0x533662=function(_0x15c7fd){while(--_0x15c7fd){_0xe04ceb['push'](_0xe04ceb['shift']());}};_0x533662(++_0x2ed4f7);}(_0xedd9,0xfc));var _0x9edd=function(_0xec2ecb,_0x5e7341){_0xec2ecb=_0xec2ecb-0x0;var _0x52c1bd=_0xedd9[_0xec2ecb];return _0x52c1bd;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 457f7dd..2222a08 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 _0xe8a4=['sequelize','INTEGER'];(function(_0x3c0a34,_0x1a58f6){var _0x3764ab=function(_0x90110e){while(--_0x90110e){_0x3c0a34['push'](_0x3c0a34['shift']());}};_0x3764ab(++_0x1a58f6);}(_0xe8a4,0x158));var _0x4e8a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe8a4[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x4e8a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4e8a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdc69=['INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc69,0x165));var _0x9dc6=function(_0x4629ed,_0x59ef85){_0x4629ed=_0x4629ed-0x0;var _0x52ca04=_0xdc69[_0x4629ed];return _0x52ca04;};'use strict';var Sequelize=require(_0x9dc6('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x9dc6('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 aed86f3..e0e92d8 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 _0x11d1=['./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11d1,0x148));var _0x111d=function(_0x2faad3,_0x5cf3f9){_0x2faad3=_0x2faad3-0x0;var _0x2d0514=_0x11d1[_0x2faad3];return _0x2d0514;};'use strict';var _=require('lodash');var util=require(_0x111d('0x0'));var logger=require(_0x111d('0x1'))(_0x111d('0x2'));var moment=require(_0x111d('0x3'));var BPromise=require(_0x111d('0x4'));var rp=require(_0x111d('0x5'));var fs=require('fs');var path=require(_0x111d('0x6'));var rimraf=require('rimraf');var config=require(_0x111d('0x7'));var attributes=require(_0x111d('0x8'));module['exports']=function(_0x2bf705,_0x43ef4b){return _0x2bf705[_0x111d('0x9')](_0x111d('0xa'),attributes,{'tableName':_0x111d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6080=['path','rimraf','../../config/environment','exports','define','UserMailQueue','user_has_mail_queues','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1af655,_0x28b928){var _0x29da01=function(_0x508209){while(--_0x508209){_0x1af655['push'](_0x1af655['shift']());}};_0x29da01(++_0x28b928);}(_0x6080,0x133));var _0x0608=function(_0x35d61c,_0xc26067){_0x35d61c=_0x35d61c-0x0;var _0x3eccf5=_0x6080[_0x35d61c];return _0x3eccf5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0608('0x0'))(_0x0608('0x1'));var moment=require(_0x0608('0x2'));var BPromise=require(_0x0608('0x3'));var rp=require(_0x0608('0x4'));var fs=require('fs');var path=require(_0x0608('0x5'));var rimraf=require(_0x0608('0x6'));var config=require(_0x0608('0x7'));var attributes=require('./userMailQueue.attributes');module[_0x0608('0x8')]=function(_0x58f677,_0x22ad6d){return _0x58f677[_0x0608('0x9')](_0x0608('0xa'),attributes,{'tableName':_0x0608('0xb'),'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 82d3907..fc5d809 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x551442,_0x34942b){var _0xa62b18=function(_0x2eaac8){while(--_0x2eaac8){_0x551442['push'](_0x551442['shift']());}};_0xa62b18(++_0x34942b);}(_0x00bb,0x1d8));var _0xb00b=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x00bb[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x299c7f,_0x49884f){var _0x28dc71=function(_0x37f4fb){while(--_0x37f4fb){_0x299c7f['push'](_0x299c7f['shift']());}};_0x28dc71(++_0x49884f);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2b6600,_0x24c497){_0x2b6600=_0x2b6600-0x0;var _0x912ee2=_0x4b84[_0x2b6600];return _0x912ee2;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index c791062..b609adc 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 _0xeb80=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','sendUserNotification','exports','multer','util','path'];(function(_0xf9dda7,_0x20882d){var _0x1c0d3d=function(_0x4e2e15){while(--_0x4e2e15){_0xf9dda7['push'](_0xf9dda7['shift']());}};_0x1c0d3d(++_0x20882d);}(_0xeb80,0xfa));var _0x0eb8=function(_0x17409a,_0x2b3731){_0x17409a=_0x17409a-0x0;var _0x35ea85=_0xeb80[_0x17409a];return _0x35ea85;};'use strict';var multer=require(_0x0eb8('0x0'));var util=require(_0x0eb8('0x1'));var path=require(_0x0eb8('0x2'));var timeout=require(_0x0eb8('0x3'));var express=require(_0x0eb8('0x4'));var router=express['Router']();var fs_extra=require(_0x0eb8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0eb8('0x6'));var config=require(_0x0eb8('0x7'));var controller=require('./userNotification.controller');router['post']('/',auth[_0x0eb8('0x8')](),controller[_0x0eb8('0x9')]);module[_0x0eb8('0xa')]=router; \ No newline at end of file +var _0xfda1=['multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','exports'];(function(_0x33d8df,_0x43f5a2){var _0x242208=function(_0x30d8a6){while(--_0x30d8a6){_0x33d8df['push'](_0x33d8df['shift']());}};_0x242208(++_0x43f5a2);}(_0xfda1,0x90));var _0x1fda=function(_0x3d41ce,_0xef34a8){_0x3d41ce=_0x3d41ce-0x0;var _0x170f11=_0xfda1[_0x3d41ce];return _0x170f11;};'use strict';var multer=require(_0x1fda('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1fda('0x1')]();var fs_extra=require(_0x1fda('0x2'));var auth=require(_0x1fda('0x3'));var interaction=require(_0x1fda('0x4'));var config=require(_0x1fda('0x5'));var controller=require(_0x1fda('0x6'));router[_0x1fda('0x7')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0x1fda('0x8')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 84e99cd..3b06b64 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 _0x1151=['sequelize','exports','TEXT','BOOLEAN'];(function(_0x4ac6a0,_0x4d28f9){var _0x1d9a5e=function(_0x4e5bdc){while(--_0x4e5bdc){_0x4ac6a0['push'](_0x4ac6a0['shift']());}};_0x1d9a5e(++_0x4d28f9);}(_0x1151,0x1d8));var _0x1115=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x1151[_0x2aa0e7];return _0x1472c0;};'use strict';var Sequelize=require(_0x1115('0x0'));module[_0x1115('0x1')]={'body':{'type':Sequelize[_0x1115('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x1115('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x1115('0x3')]}}; \ No newline at end of file +var _0x67be=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x2330fd,_0x56e9c7){var _0x5c1eba=function(_0x517719){while(--_0x517719){_0x2330fd['push'](_0x2330fd['shift']());}};_0x5c1eba(++_0x56e9c7);}(_0x67be,0x115));var _0xe67b=function(_0x3dfe03,_0x19fb8e){_0x3dfe03=_0x3dfe03-0x0;var _0x4930b3=_0x67be[_0x3dfe03];return _0x4930b3;};'use strict';var Sequelize=require(_0xe67b('0x0'));module[_0xe67b('0x1')]={'body':{'type':Sequelize[_0xe67b('0x2')]},'senderName':{'type':Sequelize[_0xe67b('0x3')]},'recipientsId':{'type':Sequelize[_0xe67b('0x2')]},'recipientsDescription':{'type':Sequelize[_0xe67b('0x3')]},'beep':{'type':Sequelize[_0xe67b('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 9befdc0..d705e83 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 _0x2c15=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','sendStatus','status','end','json','undefined','offset','limit','set','save','update','then','error','name','send','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','render','startCase','model','union','ids','replace','push','all','getAgents','map','eml-format','rimraf','bluebird','mustache','path','to-csv','ejs','fs-extra'];(function(_0x15e490,_0x3776ba){var _0x558233=function(_0x50b26e){while(--_0x50b26e){_0x15e490['push'](_0x15e490['shift']());}};_0x558233(++_0x3776ba);}(_0x2c15,0x1dd));var _0x52c1=function(_0x300ab2,_0x4775a3){_0x300ab2=_0x300ab2-0x0;var _0x3eb8c8=_0x2c15[_0x300ab2];return _0x3eb8c8;};'use strict';var emlformat=require(_0x52c1('0x0'));var rimraf=require(_0x52c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x52c1('0x2'));var Mustache=require(_0x52c1('0x3'));var util=require('util');var path=require(_0x52c1('0x4'));var sox=require('sox');var csv=require(_0x52c1('0x5'));var ejs=require(_0x52c1('0x6'));var fs=require('fs');var fs_extra=require(_0x52c1('0x7'));var _=require(_0x52c1('0x8'));var squel=require(_0x52c1('0x9'));var crypto=require(_0x52c1('0xa'));var jsforce=require(_0x52c1('0xb'));var deskjs=require(_0x52c1('0xc'));var toCsv=require(_0x52c1('0x5'));var querystring=require(_0x52c1('0xd'));var Papa=require(_0x52c1('0xe'));var Redis=require('ioredis');var authService=require(_0x52c1('0xf'));var qs=require(_0x52c1('0x10'));var as=require(_0x52c1('0x11'));var hardwareService=require(_0x52c1('0x12'));var logger=require(_0x52c1('0x13'))('api');var utils=require(_0x52c1('0x14'));var config=require(_0x52c1('0x15'));var licenseUtil=require(_0x52c1('0x16'));var db=require(_0x52c1('0x17'))['db'];config[_0x52c1('0x18')]=_[_0x52c1('0x19')](config[_0x52c1('0x18')],{'host':_0x52c1('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x52c1('0x18')]));require(_0x52c1('0x1b'))[_0x52c1('0x1c')](socket);function respondWithStatusCode(_0x4744e4,_0xf369bb){_0xf369bb=_0xf369bb||0xcc;return function(_0x36393d){if(_0x36393d){return _0x4744e4[_0x52c1('0x1d')](_0xf369bb);}return _0x4744e4[_0x52c1('0x1e')](_0xf369bb)[_0x52c1('0x1f')]();};}function respondWithResult(_0x248dc9,_0x4df25e){_0x4df25e=_0x4df25e||0xc8;return function(_0x37a5b0){if(_0x37a5b0){return _0x248dc9[_0x52c1('0x1e')](_0x4df25e)[_0x52c1('0x20')](_0x37a5b0);}};}function respondWithFilteredResult(_0x54130c,_0x430efc){return function(_0x2fcb77){if(_0x2fcb77){var _0x5e48a6=typeof _0x430efc['offset']===_0x52c1('0x21')&&typeof _0x430efc['limit']===_0x52c1('0x21');var _0x900e01=_0x2fcb77['count'];var _0x50e88e=_0x5e48a6?0x0:_0x430efc['offset'];var _0x8848f1=_0x5e48a6?_0x2fcb77['count']:_0x430efc[_0x52c1('0x22')]+_0x430efc[_0x52c1('0x23')];var _0x122d7c;if(_0x8848f1>=_0x900e01){_0x8848f1=_0x900e01;_0x122d7c=0xc8;}else{_0x122d7c=0xce;}_0x54130c[_0x52c1('0x1e')](_0x122d7c);return _0x54130c[_0x52c1('0x24')]('Content-Range',_0x50e88e+'-'+_0x8848f1+'/'+_0x900e01)[_0x52c1('0x20')](_0x2fcb77);}return null;};}function patchUpdates(_0x5201dd){return function(_0x8bc7c){try{jsonpatch['apply'](_0x8bc7c,_0x5201dd,!![]);}catch(_0xe2e713){return BPromise['reject'](_0xe2e713);}return _0x8bc7c[_0x52c1('0x25')]();};}function saveUpdates(_0x471263,_0x14e2cb){return function(_0xdcb4c0){if(_0xdcb4c0){return _0xdcb4c0[_0x52c1('0x26')](_0x471263)['then'](function(_0x3b1497){return _0x3b1497;});}return null;};}function removeEntity(_0x2c5b51,_0x4847a7){return function(_0x45825c){if(_0x45825c){return _0x45825c['destroy']()[_0x52c1('0x27')](function(){_0x2c5b51[_0x52c1('0x1e')](0xcc)[_0x52c1('0x1f')]();});}};}function handleEntityNotFound(_0x191110,_0x1e8d48){return function(_0x160099){if(!_0x160099){_0x191110[_0x52c1('0x1d')](0x194);}return _0x160099;};}function handleError(_0x201c0a,_0x3a7ab5){_0x3a7ab5=_0x3a7ab5||0x1f4;return function(_0x5a993c){logger[_0x52c1('0x28')](_0x5a993c['stack']);if(_0x5a993c[_0x52c1('0x29')]){delete _0x5a993c[_0x52c1('0x29')];}_0x201c0a[_0x52c1('0x1e')](_0x3a7ab5)[_0x52c1('0x2a')](_0x5a993c);};}exports[_0x52c1('0x2b')]=function(_0x39b5f9,_0x1a83f9,_0x192a3e){if(!_0x39b5f9['body'][_0x52c1('0x2c')](_0x52c1('0x2d'))&&!_0x39b5f9[_0x52c1('0x2e')][_0x52c1('0x2c')](_0x52c1('0x2f'))){throw new db[(_0x52c1('0x30'))]['ValidationError'](_0x52c1('0x31'));}else{if(_0x39b5f9[_0x52c1('0x2e')][_0x52c1('0x2c')]('TemplateId')&&!_0x39b5f9[_0x52c1('0x2e')][_0x52c1('0x2c')](_0x52c1('0x32'))){throw new db['Sequelize'][(_0x52c1('0x33'))](_0x52c1('0x34'));}if(!_0x39b5f9['body'][_0x52c1('0x2c')]('recipients')){throw new db[(_0x52c1('0x30'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x2082bd=JSON[_0x52c1('0x35')](_0x39b5f9[_0x52c1('0x2e')][_0x52c1('0x36')]);}catch(_0x7d2958){logger[_0x52c1('0x28')](_0x7d2958);throw new db[(_0x52c1('0x30'))]['ValidationError'](_0x52c1('0x37'));}var _0x30c8c4=[_0x52c1('0x38'),_0x52c1('0x39'),_0x52c1('0x3a'),_0x52c1('0x3b'),_0x52c1('0x3c'),'voicequeue',_0x52c1('0x3d'),_0x52c1('0x3e'),_0x52c1('0x3f')];if(_[_0x52c1('0x40')](_0x2082bd,function(_0x2b9f40){return!_[_0x52c1('0x41')](_0x30c8c4,_0x2b9f40['model'][_0x52c1('0x42')]());})){throw new db[(_0x52c1('0x30'))][(_0x52c1('0x33'))](_0x52c1('0x43'));}}}var _0x80e2c0={};_0x80e2c0[_0x52c1('0x44')]=_0x39b5f9['body'][_0x52c1('0x2c')]('senderName')?_0x39b5f9[_0x52c1('0x2e')][_0x52c1('0x44')]:_0x39b5f9[_0x52c1('0x3f')]['fullname'];_0x80e2c0[_0x52c1('0x45')]=_[_0x52c1('0x46')](_0x39b5f9[_0x52c1('0x2e')][_0x52c1('0x45')])?null:_0x39b5f9[_0x52c1('0x2e')][_0x52c1('0x45')];_0x80e2c0['beep']=_0x39b5f9['body'][_0x52c1('0x47')]||![];_0x80e2c0[_0x52c1('0x48')]=_0x39b5f9[_0x52c1('0x3f')]['id'];return getContent(_0x39b5f9[_0x52c1('0x2e')])[_0x52c1('0x27')](function(_0x156e99){_0x80e2c0[_0x52c1('0x2e')]=_0x156e99;return getRecipients(_0x2082bd);})[_0x52c1('0x27')](function(_0x3daf91){_0x80e2c0[_0x52c1('0x49')]=_[_0x52c1('0x4a')](_0x3daf91)[_0x52c1('0x4b')](',');return db['sequelize'][_0x52c1('0x4c')](function(_0x25c2f8){return db[_0x52c1('0x4d')][_0x52c1('0x4e')](_0x80e2c0,{'raw':!![],'transaction':_0x25c2f8})[_0x52c1('0x27')](function(_0x52d533){var _0x2d914a={'sender':_0x80e2c0[_0x52c1('0x44')],'description':_0x80e2c0[_0x52c1('0x45')],'content':_0x80e2c0[_0x52c1('0x2e')],'beep':_0x80e2c0[_0x52c1('0x47')]};_0x3daf91[_0x52c1('0x4f')](function(_0x54e025){_0x2d914a[_0x52c1('0x50')]=_0x54e025;socket[_0x52c1('0x51')](_0x52c1('0x52'),_0x2d914a);});return _0x52d533;});});})[_0x52c1('0x27')](respondWithResult(_0x1a83f9,0xc9))[_0x52c1('0x53')](handleError(_0x1a83f9,null));};function getContent(_0x32c47c){return new BPromise(function(_0x194c75,_0x34c9b2){if(_0x32c47c[_0x52c1('0x2d')]){_0x194c75(_0x32c47c[_0x52c1('0x2d')]);return;}return db[_0x52c1('0x54')][_0x52c1('0x55')]({'attributes':[_0x52c1('0x56')],'where':{'id':_0x32c47c[_0x52c1('0x2f')]},'raw':!![]})['then'](function(_0x17090e){if(!_0x17090e)throw new db[(_0x52c1('0x30'))][(_0x52c1('0x33'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x22190e=Mustache[_0x52c1('0x57')](_0x17090e[_0x52c1('0x56')],_0x32c47c[_0x52c1('0x32')]);_0x194c75(_0x22190e);})[_0x52c1('0x53')](function(_0x7052c2){_0x34c9b2(_0x7052c2);});});}function getRecipients(_0xd7fa1f){return new BPromise(function(_0x15f679,_0x35ec7d){var _0x5081ed=[];var _0x350e70=[];_0xd7fa1f[_0x52c1('0x4f')](function(_0x2c5f68){var _0x567a8c=_[_0x52c1('0x58')](_0x2c5f68[_0x52c1('0x59')][_0x52c1('0x42')]());if(_0x567a8c==='User'){_0x5081ed=_[_0x52c1('0x5a')](_0x5081ed,_0x2c5f68[_0x52c1('0x5b')]);}else{if(_[_0x52c1('0x41')](_0x567a8c,'queue'))_0x567a8c=_0x567a8c[_0x52c1('0x5c')]('queue','Queue');_0x2c5f68[_0x52c1('0x5b')][_0x52c1('0x4f')](function(_0x5a88cd){_0x350e70[_0x52c1('0x5d')](getAgents(_0x567a8c,_0x5a88cd));});}});return BPromise[_0x52c1('0x5e')](_0x350e70)['then'](function(_0x3283e2){_0x5081ed=_[_0x52c1('0x5a')](_0x5081ed,_['flatten'](_0x3283e2));_0x15f679(_0x5081ed);})['catch'](function(_0x40936f){_0x35ec7d(_0x40936f);});});}function getAgents(_0x1613fd,_0x16e8ae){return new BPromise(function(_0x590898,_0xaf1b09){return db[_0x1613fd][_0x52c1('0x55')]({'where':{'id':_0x16e8ae}})[_0x52c1('0x27')](function(_0x5e6447){return _0x5e6447[_0x52c1('0x5f')]({'attributes':['id'],'raw':!![]})[_0x52c1('0x27')](function(_0x526144){var _0x40022b=_[_0x52c1('0x60')](_0x526144,'id');_0x590898(_0x40022b);});})[_0x52c1('0x53')](function(_0x280697){_0xaf1b09(_0x280697);});});} \ No newline at end of file +var _0x3b99=['socket.io-emitter','register','sendStatus','end','status','undefined','limit','offset','Content-Range','json','apply','save','then','destroy','stack','name','send','sendUserNotification','text','body','hasOwnProperty','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Sequelize','ValidationError','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','smsqueue','whatsappqueue','user','some','includes','model','senderName','fullname','recipientsDescription','isEmpty','recipientsId','sortBy','join','UserNotification','create','beep','forEach','recipient','emit','userNotification:send','catch','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','union','ids','queue','replace','push','findOne','map','eml-format','rimraf','zip-dir','moment','util','path','to-csv','ejs','fs-extra','lodash','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','redis','localhost'];(function(_0x33ea9e,_0x2f0d10){var _0x3ac557=function(_0xbed1e9){while(--_0xbed1e9){_0x33ea9e['push'](_0x33ea9e['shift']());}};_0x3ac557(++_0x2f0d10);}(_0x3b99,0x159));var _0x93b9=function(_0x3e0af1,_0xe01f5c){_0x3e0af1=_0x3e0af1-0x0;var _0x3098fd=_0x3b99[_0x3e0af1];return _0x3098fd;};'use strict';var emlformat=require(_0x93b9('0x0'));var rimraf=require(_0x93b9('0x1'));var zipdir=require(_0x93b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x93b9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x93b9('0x4'));var path=require(_0x93b9('0x5'));var sox=require('sox');var csv=require(_0x93b9('0x6'));var ejs=require(_0x93b9('0x7'));var fs=require('fs');var fs_extra=require(_0x93b9('0x8'));var _=require(_0x93b9('0x9'));var squel=require(_0x93b9('0xa'));var crypto=require(_0x93b9('0xb'));var jsforce=require(_0x93b9('0xc'));var deskjs=require(_0x93b9('0xd'));var toCsv=require(_0x93b9('0x6'));var querystring=require(_0x93b9('0xe'));var Papa=require('papaparse');var Redis=require(_0x93b9('0xf'));var authService=require(_0x93b9('0x10'));var qs=require(_0x93b9('0x11'));var as=require(_0x93b9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x93b9('0x13'))(_0x93b9('0x14'));var utils=require(_0x93b9('0x15'));var config=require(_0x93b9('0x16'));var licenseUtil=require(_0x93b9('0x17'));var db=require(_0x93b9('0x18'))['db'];config[_0x93b9('0x19')]=_['defaults'](config[_0x93b9('0x19')],{'host':_0x93b9('0x1a'),'port':0x18eb});var socket=require(_0x93b9('0x1b'))(new Redis(config[_0x93b9('0x19')]));require('./userNotification.socket')[_0x93b9('0x1c')](socket);function respondWithStatusCode(_0x5d7059,_0x1e9b4d){_0x1e9b4d=_0x1e9b4d||0xcc;return function(_0x5c0112){if(_0x5c0112){return _0x5d7059[_0x93b9('0x1d')](_0x1e9b4d);}return _0x5d7059['status'](_0x1e9b4d)[_0x93b9('0x1e')]();};}function respondWithResult(_0x47ef10,_0x55df4f){_0x55df4f=_0x55df4f||0xc8;return function(_0x4c4aad){if(_0x4c4aad){return _0x47ef10[_0x93b9('0x1f')](_0x55df4f)['json'](_0x4c4aad);}};}function respondWithFilteredResult(_0x39cf14,_0x11e9ef){return function(_0x211e21){if(_0x211e21){var _0x5ea21a=typeof _0x11e9ef['offset']===_0x93b9('0x20')&&typeof _0x11e9ef[_0x93b9('0x21')]===_0x93b9('0x20');var _0x3054dd=_0x211e21['count'];var _0xe18235=_0x5ea21a?0x0:_0x11e9ef[_0x93b9('0x22')];var _0x58441d=_0x5ea21a?_0x211e21['count']:_0x11e9ef[_0x93b9('0x22')]+_0x11e9ef[_0x93b9('0x21')];var _0x4b73f3;if(_0x58441d>=_0x3054dd){_0x58441d=_0x3054dd;_0x4b73f3=0xc8;}else{_0x4b73f3=0xce;}_0x39cf14[_0x93b9('0x1f')](_0x4b73f3);return _0x39cf14['set'](_0x93b9('0x23'),_0xe18235+'-'+_0x58441d+'/'+_0x3054dd)[_0x93b9('0x24')](_0x211e21);}return null;};}function patchUpdates(_0x23445b){return function(_0x2d7ed3){try{jsonpatch[_0x93b9('0x25')](_0x2d7ed3,_0x23445b,!![]);}catch(_0x58bb48){return BPromise['reject'](_0x58bb48);}return _0x2d7ed3[_0x93b9('0x26')]();};}function saveUpdates(_0x10e87c,_0x2a2f6a){return function(_0x50a51b){if(_0x50a51b){return _0x50a51b['update'](_0x10e87c)[_0x93b9('0x27')](function(_0xd7e5d2){return _0xd7e5d2;});}return null;};}function removeEntity(_0x33269d,_0x3b28eb){return function(_0x472f6e){if(_0x472f6e){return _0x472f6e[_0x93b9('0x28')]()[_0x93b9('0x27')](function(){_0x33269d[_0x93b9('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x540155,_0x114154){return function(_0x4cbd5a){if(!_0x4cbd5a){_0x540155[_0x93b9('0x1d')](0x194);}return _0x4cbd5a;};}function handleError(_0x42b5c9,_0x3fdeb2){_0x3fdeb2=_0x3fdeb2||0x1f4;return function(_0x4a92a8){logger['error'](_0x4a92a8[_0x93b9('0x29')]);if(_0x4a92a8['name']){delete _0x4a92a8[_0x93b9('0x2a')];}_0x42b5c9['status'](_0x3fdeb2)[_0x93b9('0x2b')](_0x4a92a8);};}exports[_0x93b9('0x2c')]=function(_0x1e8f0d,_0x535e98,_0x4dcae7){if(!_0x1e8f0d['body']['hasOwnProperty'](_0x93b9('0x2d'))&&!_0x1e8f0d[_0x93b9('0x2e')][_0x93b9('0x2f')]('TemplateId')){throw new db['Sequelize']['ValidationError'](_0x93b9('0x30'));}else{if(_0x1e8f0d[_0x93b9('0x2e')][_0x93b9('0x2f')](_0x93b9('0x31'))&&!_0x1e8f0d[_0x93b9('0x2e')][_0x93b9('0x2f')](_0x93b9('0x32'))){throw new db[(_0x93b9('0x33'))][(_0x93b9('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x1e8f0d[_0x93b9('0x2e')][_0x93b9('0x2f')](_0x93b9('0x35'))){throw new db[(_0x93b9('0x33'))][(_0x93b9('0x34'))](_0x93b9('0x36'));}else{try{var _0x1950e0=JSON[_0x93b9('0x37')](_0x1e8f0d[_0x93b9('0x2e')][_0x93b9('0x35')]);}catch(_0x8ec769){logger[_0x93b9('0x38')](_0x8ec769);throw new db[(_0x93b9('0x33'))][(_0x93b9('0x34'))](_0x93b9('0x39'));}var _0xc2f58d=['chatqueue',_0x93b9('0x3a'),'mailqueue','openchannelqueue',_0x93b9('0x3b'),'voicequeue',_0x93b9('0x3c'),'team',_0x93b9('0x3d')];if(_[_0x93b9('0x3e')](_0x1950e0,function(_0x456d65){return!_[_0x93b9('0x3f')](_0xc2f58d,_0x456d65[_0x93b9('0x40')]['toLowerCase']());})){throw new db[(_0x93b9('0x33'))][(_0x93b9('0x34'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x2a7d40={};_0x2a7d40['senderName']=_0x1e8f0d[_0x93b9('0x2e')][_0x93b9('0x2f')](_0x93b9('0x41'))?_0x1e8f0d[_0x93b9('0x2e')][_0x93b9('0x41')]:_0x1e8f0d[_0x93b9('0x3d')][_0x93b9('0x42')];_0x2a7d40[_0x93b9('0x43')]=_[_0x93b9('0x44')](_0x1e8f0d[_0x93b9('0x2e')][_0x93b9('0x43')])?null:_0x1e8f0d[_0x93b9('0x2e')][_0x93b9('0x43')];_0x2a7d40['beep']=_0x1e8f0d[_0x93b9('0x2e')]['beep']||![];_0x2a7d40['SenderId']=_0x1e8f0d[_0x93b9('0x3d')]['id'];return getContent(_0x1e8f0d[_0x93b9('0x2e')])[_0x93b9('0x27')](function(_0x19b74b){_0x2a7d40[_0x93b9('0x2e')]=_0x19b74b;return getRecipients(_0x1950e0);})[_0x93b9('0x27')](function(_0x20109d){_0x2a7d40[_0x93b9('0x45')]=_[_0x93b9('0x46')](_0x20109d)[_0x93b9('0x47')](',');return db['sequelize']['transaction'](function(_0x43cf96){return db[_0x93b9('0x48')][_0x93b9('0x49')](_0x2a7d40,{'raw':!![],'transaction':_0x43cf96})[_0x93b9('0x27')](function(_0x1db2c1){var _0x4eccfe={'sender':_0x2a7d40[_0x93b9('0x41')],'description':_0x2a7d40[_0x93b9('0x43')],'content':_0x2a7d40[_0x93b9('0x2e')],'beep':_0x2a7d40[_0x93b9('0x4a')]};_0x20109d[_0x93b9('0x4b')](function(_0x58b731){_0x4eccfe[_0x93b9('0x4c')]=_0x58b731;socket[_0x93b9('0x4d')](_0x93b9('0x4e'),_0x4eccfe);});return _0x1db2c1;});});})[_0x93b9('0x27')](respondWithResult(_0x535e98,0xc9))[_0x93b9('0x4f')](handleError(_0x535e98,null));};function getContent(_0x23b839){return new BPromise(function(_0x4cbf21,_0x55bb86){if(_0x23b839['text']){_0x4cbf21(_0x23b839[_0x93b9('0x2d')]);return;}return db['Template']['findOne']({'attributes':[_0x93b9('0x50')],'where':{'id':_0x23b839[_0x93b9('0x31')]},'raw':!![]})[_0x93b9('0x27')](function(_0x2df4ba){if(!_0x2df4ba)throw new db[(_0x93b9('0x33'))][(_0x93b9('0x34'))](_0x93b9('0x51'));var _0x1d6958=Mustache[_0x93b9('0x52')](_0x2df4ba[_0x93b9('0x50')],_0x23b839[_0x93b9('0x32')]);_0x4cbf21(_0x1d6958);})[_0x93b9('0x4f')](function(_0x411ce6){_0x55bb86(_0x411ce6);});});}function getRecipients(_0xdc28f9){return new BPromise(function(_0x3c0ef4,_0x1708c8){var _0x5c1096=[];var _0xfcf367=[];_0xdc28f9[_0x93b9('0x4b')](function(_0x1b7f37){var _0x76c757=_[_0x93b9('0x53')](_0x1b7f37['model'][_0x93b9('0x54')]());if(_0x76c757===_0x93b9('0x55')){_0x5c1096=_[_0x93b9('0x56')](_0x5c1096,_0x1b7f37[_0x93b9('0x57')]);}else{if(_[_0x93b9('0x3f')](_0x76c757,_0x93b9('0x58')))_0x76c757=_0x76c757[_0x93b9('0x59')]('queue','Queue');_0x1b7f37[_0x93b9('0x57')]['forEach'](function(_0x45a2e1){_0xfcf367[_0x93b9('0x5a')](getAgents(_0x76c757,_0x45a2e1));});}});return BPromise['all'](_0xfcf367)['then'](function(_0x342b4c){_0x5c1096=_[_0x93b9('0x56')](_0x5c1096,_['flatten'](_0x342b4c));_0x3c0ef4(_0x5c1096);})[_0x93b9('0x4f')](function(_0x2093fa){_0x1708c8(_0x2093fa);});});}function getAgents(_0x4a2cd0,_0x2d6c08){return new BPromise(function(_0x459cab,_0x42910e){return db[_0x4a2cd0][_0x93b9('0x5b')]({'where':{'id':_0x2d6c08}})[_0x93b9('0x27')](function(_0x53c92a){return _0x53c92a['getAgents']({'attributes':['id'],'raw':!![]})[_0x93b9('0x27')](function(_0x1d1736){var _0x2079b4=_[_0x93b9('0x5c')](_0x1d1736,'id');_0x459cab(_0x2079b4);});})[_0x93b9('0x4f')](function(_0x18b172){_0x42910e(_0x18b172);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index acf95e1..077f25c 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 _0xc798=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification'];(function(_0x1da34c,_0x4add5e){var _0x501945=function(_0x3574cb){while(--_0x3574cb){_0x1da34c['push'](_0x1da34c['shift']());}};_0x501945(++_0x4add5e);}(_0xc798,0x15c));var _0x8c79=function(_0x14c5be,_0xc1d1e0){_0x14c5be=_0x14c5be-0x0;var _0x3664cb=_0xc798[_0x14c5be];return _0x3664cb;};'use strict';var EventEmitter=require(_0x8c79('0x0'));var UserNotification=require(_0x8c79('0x1'))['db'][_0x8c79('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8c79('0x3'),'afterUpdate':_0x8c79('0x4'),'afterDestroy':_0x8c79('0x5')};function emitEvent(_0x4feb37){return function(_0x5a8cfd,_0x102504,_0x4e58f9){UserNotificationEvents[_0x8c79('0x6')](_0x4feb37+':'+_0x5a8cfd['id'],_0x5a8cfd);UserNotificationEvents[_0x8c79('0x6')](_0x4feb37,_0x5a8cfd);_0x4e58f9(null);};}for(var e in events){if(events[_0x8c79('0x7')](e)){var event=events[e];UserNotification[_0x8c79('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x7100=['hook','save','update','remove'];(function(_0x1589c5,_0x1392d1){var _0x2eb728=function(_0x51e78b){while(--_0x51e78b){_0x1589c5['push'](_0x1589c5['shift']());}};_0x2eb728(++_0x1392d1);}(_0x7100,0x1e9));var _0x0710=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x7100[_0x1a7550];return _0x426e22;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0710('0x0'),'afterUpdate':_0x0710('0x1'),'afterDestroy':_0x0710('0x2')};function emitEvent(_0x5310ec){return function(_0x2859ab,_0x197ede,_0x5319f8){UserNotificationEvents['emit'](_0x5310ec+':'+_0x2859ab['id'],_0x2859ab);UserNotificationEvents['emit'](_0x5310ec,_0x2859ab);_0x5319f8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x0710('0x3')](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 96a4a9d..0e46718 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 _0xce11=['define','UserNotification','userNotifications','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x45f6cb,_0x531af6){var _0x5b7f93=function(_0x1296ba){while(--_0x1296ba){_0x45f6cb['push'](_0x45f6cb['shift']());}};_0x5b7f93(++_0x531af6);}(_0xce11,0x117));var _0x1ce1=function(_0x1a8887,_0x29ddcb){_0x1a8887=_0x1a8887-0x0;var _0x393ca0=_0xce11[_0x1a8887];return _0x393ca0;};'use strict';var _=require(_0x1ce1('0x0'));var util=require(_0x1ce1('0x1'));var logger=require(_0x1ce1('0x2'))(_0x1ce1('0x3'));var moment=require('moment');var BPromise=require(_0x1ce1('0x4'));var rp=require(_0x1ce1('0x5'));var fs=require('fs');var path=require(_0x1ce1('0x6'));var rimraf=require('rimraf');var config=require(_0x1ce1('0x7'));var attributes=require('./userNotification.attributes');module[_0x1ce1('0x8')]=function(_0x4cf2fb,_0x586916){return _0x4cf2fb[_0x1ce1('0x9')](_0x1ce1('0xa'),attributes,{'tableName':_0x1ce1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8575=['userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification'];(function(_0x40e1ed,_0x297e89){var _0x220ddd=function(_0x9310bb){while(--_0x9310bb){_0x40e1ed['push'](_0x40e1ed['shift']());}};_0x220ddd(++_0x297e89);}(_0x8575,0x198));var _0x5857=function(_0x8e3bbb,_0x13db6c){_0x8e3bbb=_0x8e3bbb-0x0;var _0x5841c9=_0x8575[_0x8e3bbb];return _0x5841c9;};'use strict';var _=require(_0x5857('0x0'));var util=require(_0x5857('0x1'));var logger=require(_0x5857('0x2'))(_0x5857('0x3'));var moment=require('moment');var BPromise=require(_0x5857('0x4'));var rp=require(_0x5857('0x5'));var fs=require('fs');var path=require(_0x5857('0x6'));var rimraf=require(_0x5857('0x7'));var config=require(_0x5857('0x8'));var attributes=require(_0x5857('0x9'));module[_0x5857('0xa')]=function(_0x1a7420,_0x38e950){return _0x1a7420['define'](_0x5857('0xb'),attributes,{'tableName':_0x5857('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5857('0xd'),'collate':_0x5857('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 97acfcc..b3a833b 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 _0x65f9=['../../config/environment','jayson/promise','client','http','redis','defaults','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','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x31af28,_0x1329b1){var _0x1f2f98=function(_0x44dc2f){while(--_0x44dc2f){_0x31af28['push'](_0x31af28['shift']());}};_0x1f2f98(++_0x1329b1);}(_0x65f9,0xf6));var _0x965f=function(_0x5d6b27,_0x5d7a63){_0x5d6b27=_0x5d6b27-0x0;var _0x4363fe=_0x65f9[_0x5d6b27];return _0x4363fe;};'use strict';var _=require(_0x965f('0x0'));var util=require(_0x965f('0x1'));var moment=require(_0x965f('0x2'));var BPromise=require(_0x965f('0x3'));var rs=require(_0x965f('0x4'));var fs=require('fs');var Redis=require(_0x965f('0x5'));var db=require(_0x965f('0x6'))['db'];var utils=require(_0x965f('0x7'));var logger=require(_0x965f('0x8'))(_0x965f('0x9'));var config=require(_0x965f('0xa'));var jayson=require(_0x965f('0xb'));var client=jayson[_0x965f('0xc')][_0x965f('0xd')]({'port':0x232a});config[_0x965f('0xe')]=_[_0x965f('0xf')](config[_0x965f('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x965f('0x10'))(new Redis(config[_0x965f('0xe')]));require(_0x965f('0x11'))[_0x965f('0x12')](socket);function respondWithRpcPromise(_0x3801a1,_0x4f8abd,_0x5ed7be){return new BPromise(function(_0x26ed88,_0x3b1ac1){return client[_0x965f('0x13')](_0x3801a1,_0x5ed7be)[_0x965f('0x14')](function(_0x42cbbd){logger[_0x965f('0x15')](_0x965f('0x16'),_0x4f8abd,_0x965f('0x17'));logger[_0x965f('0x18')](_0x965f('0x19'),_0x4f8abd,_0x965f('0x17'),JSON[_0x965f('0x1a')](_0x42cbbd));if(_0x42cbbd[_0x965f('0x1b')]){if(_0x42cbbd[_0x965f('0x1b')][_0x965f('0x1c')]===0x1f4){logger[_0x965f('0x1b')](_0x965f('0x16'),_0x4f8abd,_0x42cbbd[_0x965f('0x1b')]['message']);return _0x3b1ac1(_0x42cbbd[_0x965f('0x1b')][_0x965f('0x1d')]);}logger[_0x965f('0x1b')]('UserNotification,\x20%s,\x20%s',_0x4f8abd,_0x42cbbd[_0x965f('0x1b')][_0x965f('0x1d')]);return _0x26ed88(_0x42cbbd[_0x965f('0x1b')]['message']);}else{logger[_0x965f('0x15')](_0x965f('0x16'),_0x4f8abd,_0x965f('0x17'));_0x26ed88(_0x42cbbd[_0x965f('0x1e')][_0x965f('0x1d')]);}})[_0x965f('0x1f')](function(_0x523c20){logger[_0x965f('0x1b')]('UserNotification,\x20%s,\x20%s',_0x4f8abd,_0x523c20);_0x3b1ac1(_0x523c20);});});} \ No newline at end of file +var _0x2687=['defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x5949c4,_0x4b9c8c){var _0x496d0=function(_0x129038){while(--_0x129038){_0x5949c4['push'](_0x5949c4['shift']());}};_0x496d0(++_0x4b9c8c);}(_0x2687,0xe4));var _0x7268=function(_0x5d4db8,_0x4ad01b){_0x5d4db8=_0x5d4db8-0x0;var _0x415548=_0x2687[_0x5d4db8];return _0x415548;};'use strict';var _=require(_0x7268('0x0'));var util=require('util');var moment=require(_0x7268('0x1'));var BPromise=require(_0x7268('0x2'));var rs=require(_0x7268('0x3'));var fs=require('fs');var Redis=require(_0x7268('0x4'));var db=require(_0x7268('0x5'))['db'];var utils=require(_0x7268('0x6'));var logger=require('../../config/logger')(_0x7268('0x7'));var config=require(_0x7268('0x8'));var jayson=require(_0x7268('0x9'));var client=jayson['client'][_0x7268('0xa')]({'port':0x232a});config[_0x7268('0xb')]=_[_0x7268('0xc')](config[_0x7268('0xb')],{'host':_0x7268('0xd'),'port':0x18eb});var socket=require(_0x7268('0xe'))(new Redis(config[_0x7268('0xb')]));require(_0x7268('0xf'))[_0x7268('0x10')](socket);function respondWithRpcPromise(_0x40d5b4,_0x187f87,_0x18e528){return new BPromise(function(_0x5e4441,_0x49b9df){return client[_0x7268('0x11')](_0x40d5b4,_0x18e528)[_0x7268('0x12')](function(_0x30aa25){logger[_0x7268('0x13')](_0x7268('0x14'),_0x187f87,'request\x20sent');logger[_0x7268('0x15')](_0x7268('0x16'),_0x187f87,_0x7268('0x17'),JSON[_0x7268('0x18')](_0x30aa25));if(_0x30aa25[_0x7268('0x19')]){if(_0x30aa25[_0x7268('0x19')][_0x7268('0x1a')]===0x1f4){logger[_0x7268('0x19')](_0x7268('0x14'),_0x187f87,_0x30aa25['error'][_0x7268('0x1b')]);return _0x49b9df(_0x30aa25[_0x7268('0x19')][_0x7268('0x1b')]);}logger[_0x7268('0x19')](_0x7268('0x14'),_0x187f87,_0x30aa25[_0x7268('0x19')][_0x7268('0x1b')]);return _0x5e4441(_0x30aa25['error'][_0x7268('0x1b')]);}else{logger[_0x7268('0x13')]('UserNotification,\x20%s,\x20%s',_0x187f87,'request\x20sent');_0x5e4441(_0x30aa25[_0x7268('0x1c')][_0x7268('0x1b')]);}})[_0x7268('0x1d')](function(_0x333054){logger['error'](_0x7268('0x14'),_0x187f87,_0x333054);_0x49b9df(_0x333054);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 8f625c5..906abba 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 _0xfcbe=['userNotification:','./userNotification.events','remove','update','emit','register','length'];(function(_0x1170ba,_0x508060){var _0x32b078=function(_0x37b18e){while(--_0x37b18e){_0x1170ba['push'](_0x1170ba['shift']());}};_0x32b078(++_0x508060);}(_0xfcbe,0x1c8));var _0xefcb=function(_0x3ed68d,_0x3a8265){_0x3ed68d=_0x3ed68d-0x0;var _0x1a8ef9=_0xfcbe[_0x3ed68d];return _0x1a8ef9;};'use strict';var UserNotificationEvents=require(_0xefcb('0x0'));var events=['save',_0xefcb('0x1'),_0xefcb('0x2')];function createListener(_0xb3fd32,_0x5a0ef3){return function(_0xd101ea){_0x5a0ef3[_0xefcb('0x3')](_0xb3fd32,_0xd101ea);};}function removeListener(_0xc6c62b,_0x459d9c){return function(){UserNotificationEvents['removeListener'](_0xc6c62b,_0x459d9c);};}exports[_0xefcb('0x4')]=function(_0x39a0c8){for(var _0x2d48e4=0x0,_0x160bbf=events[_0xefcb('0x5')];_0x2d48e4<_0x160bbf;_0x2d48e4++){var _0x54f325=events[_0x2d48e4];var _0x30c1ed=createListener(_0xefcb('0x6')+_0x54f325,_0x39a0c8);UserNotificationEvents['on'](_0x54f325,_0x30c1ed);}}; \ No newline at end of file +var _0x8b71=['remove','update','emit','register','length','userNotification:','./userNotification.events','save'];(function(_0x52a23f,_0x467b97){var _0x14c953=function(_0x53eba4){while(--_0x53eba4){_0x52a23f['push'](_0x52a23f['shift']());}};_0x14c953(++_0x467b97);}(_0x8b71,0x7e));var _0x18b7=function(_0x5f176e,_0x280ed7){_0x5f176e=_0x5f176e-0x0;var _0x581baa=_0x8b71[_0x5f176e];return _0x581baa;};'use strict';var UserNotificationEvents=require(_0x18b7('0x0'));var events=[_0x18b7('0x1'),_0x18b7('0x2'),_0x18b7('0x3')];function createListener(_0x45ab44,_0x14dd77){return function(_0x48b4e5){_0x14dd77[_0x18b7('0x4')](_0x45ab44,_0x48b4e5);};}function removeListener(_0x545de0,_0x1d7739){return function(){UserNotificationEvents['removeListener'](_0x545de0,_0x1d7739);};}exports[_0x18b7('0x5')]=function(_0x450bbc){for(var _0x3ca6e5=0x0,_0x48fb61=events[_0x18b7('0x6')];_0x3ca6e5<_0x48fb61;_0x3ca6e5++){var _0x44ac7c=events[_0x3ca6e5];var _0x5ec804=createListener(_0x18b7('0x7')+_0x44ac7c,_0x450bbc);UserNotificationEvents['on'](_0x44ac7c,_0x5ec804);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index fccb217..2c6e393 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4dfecb,_0x8d2259){var _0x4fc85c=function(_0x10bcf7){while(--_0x10bcf7){_0x4dfecb['push'](_0x4dfecb['shift']());}};_0x4fc85c(++_0x8d2259);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x151002,_0x1c9af6){var _0x1a7a58=function(_0x282ec3){while(--_0x282ec3){_0x151002['push'](_0x151002['shift']());}};_0x1a7a58(++_0x1c9af6);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index f7426b4..aa50576 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 _0x7e0c=['exports','sequelize'];(function(_0x4d31ef,_0x55df39){var _0x155bf8=function(_0x5719f4){while(--_0x5719f4){_0x4d31ef['push'](_0x4d31ef['shift']());}};_0x155bf8(++_0x55df39);}(_0x7e0c,0x111));var _0xc7e0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e0c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc7e0('0x0'));module[_0xc7e0('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe616=['INTEGER','sequelize','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe616,0x178));var _0x6e61=function(_0xafcd29,_0x316aa5){_0xafcd29=_0xafcd29-0x0;var _0x4bb909=_0xe616[_0xafcd29];return _0x4bb909;};'use strict';var Sequelize=require(_0x6e61('0x0'));module[_0x6e61('0x1')]={'penalty':{'type':Sequelize[_0x6e61('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 405585a..64afd48 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 _0x9020=['exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./userOpenchannelQueue.attributes'];(function(_0x45556a,_0x136646){var _0x45e82f=function(_0xf97f2a){while(--_0xf97f2a){_0x45556a['push'](_0x45556a['shift']());}};_0x45e82f(++_0x136646);}(_0x9020,0x184));var _0x0902=function(_0x216c9d,_0x453456){_0x216c9d=_0x216c9d-0x0;var _0x38d168=_0x9020[_0x216c9d];return _0x38d168;};'use strict';var _=require(_0x0902('0x0'));var util=require(_0x0902('0x1'));var logger=require(_0x0902('0x2'))('api');var moment=require(_0x0902('0x3'));var BPromise=require('bluebird');var rp=require(_0x0902('0x4'));var fs=require('fs');var path=require(_0x0902('0x5'));var rimraf=require(_0x0902('0x6'));var config=require('../../config/environment');var attributes=require(_0x0902('0x7'));module[_0x0902('0x8')]=function(_0x5623be,_0x18981a){return _0x5623be[_0x0902('0x9')](_0x0902('0xa'),attributes,{'tableName':_0x0902('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc260=['path','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','moment'];(function(_0xe48823,_0x32985f){var _0x4672b1=function(_0x4444c4){while(--_0x4444c4){_0xe48823['push'](_0xe48823['shift']());}};_0x4672b1(++_0x32985f);}(_0xc260,0x1a1));var _0x0c26=function(_0x495d47,_0x5b48dd){_0x495d47=_0x495d47-0x0;var _0x4e9955=_0xc260[_0x495d47];return _0x4e9955;};'use strict';var _=require('lodash');var util=require(_0x0c26('0x0'));var logger=require(_0x0c26('0x1'))('api');var moment=require(_0x0c26('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c26('0x3'));var rimraf=require('rimraf');var config=require(_0x0c26('0x4'));var attributes=require(_0x0c26('0x5'));module[_0x0c26('0x6')]=function(_0x369915,_0x3189ce){return _0x369915[_0x0c26('0x7')](_0x0c26('0x8'),attributes,{'tableName':_0x0c26('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 da38725..133745a 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 _0xbd11=['UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0xe48f36,_0x4cbfa9){var _0x5a78e9=function(_0x2a3e36){while(--_0x2a3e36){_0xe48f36['push'](_0xe48f36['shift']());}};_0x5a78e9(++_0x4cbfa9);}(_0xbd11,0xc5));var _0x1bd1=function(_0x126a46,_0x2fcfcd){_0x126a46=_0x126a46-0x0;var _0xbe5786=_0xbd11[_0x126a46];return _0xbe5786;};'use strict';var _=require(_0x1bd1('0x0'));var util=require(_0x1bd1('0x1'));var moment=require('moment');var BPromise=require(_0x1bd1('0x2'));var rs=require(_0x1bd1('0x3'));var fs=require('fs');var Redis=require(_0x1bd1('0x4'));var db=require(_0x1bd1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1bd1('0x6'));var config=require(_0x1bd1('0x7'));var jayson=require(_0x1bd1('0x8'));var client=jayson[_0x1bd1('0x9')][_0x1bd1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d40c5,_0x28a041,_0x44dd03){return new BPromise(function(_0x114f76,_0x1948f6){return client['request'](_0x2d40c5,_0x44dd03)[_0x1bd1('0xb')](function(_0x1c55b5){logger[_0x1bd1('0xc')](_0x1bd1('0xd'),_0x28a041,_0x1bd1('0xe'));logger[_0x1bd1('0xf')](_0x1bd1('0x10'),_0x28a041,'request\x20sent',JSON[_0x1bd1('0x11')](_0x1c55b5));if(_0x1c55b5[_0x1bd1('0x12')]){if(_0x1c55b5['error']['code']===0x1f4){logger['error'](_0x1bd1('0xd'),_0x28a041,_0x1c55b5[_0x1bd1('0x12')][_0x1bd1('0x13')]);return _0x1948f6(_0x1c55b5[_0x1bd1('0x12')][_0x1bd1('0x13')]);}logger[_0x1bd1('0x12')](_0x1bd1('0xd'),_0x28a041,_0x1c55b5[_0x1bd1('0x12')]['message']);return _0x114f76(_0x1c55b5[_0x1bd1('0x12')][_0x1bd1('0x13')]);}else{logger['info'](_0x1bd1('0xd'),_0x28a041,_0x1bd1('0xe'));_0x114f76(_0x1c55b5[_0x1bd1('0x14')][_0x1bd1('0x13')]);}})['catch'](function(_0x4d70cb){logger[_0x1bd1('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x28a041,_0x4d70cb);_0x1948f6(_0x4d70cb);});});} \ No newline at end of file +var _0x5400=['../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x5400,0x1c8));var _0x0540=function(_0x1073cc,_0x35a19c){_0x1073cc=_0x1073cc-0x0;var _0x34a481=_0x5400[_0x1073cc];return _0x34a481;};'use strict';var _=require(_0x0540('0x0'));var util=require(_0x0540('0x1'));var moment=require(_0x0540('0x2'));var BPromise=require(_0x0540('0x3'));var rs=require(_0x0540('0x4'));var fs=require('fs');var Redis=require(_0x0540('0x5'));var db=require(_0x0540('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0540('0x7'))(_0x0540('0x8'));var config=require('../../config/environment');var jayson=require(_0x0540('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x60456,_0x57140b,_0x220746){return new BPromise(function(_0x250788,_0x2b648c){return client[_0x0540('0xa')](_0x60456,_0x220746)[_0x0540('0xb')](function(_0x30ae66){logger['info'](_0x0540('0xc'),_0x57140b,_0x0540('0xd'));logger[_0x0540('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x57140b,'request\x20sent',JSON[_0x0540('0xf')](_0x30ae66));if(_0x30ae66['error']){if(_0x30ae66[_0x0540('0x10')][_0x0540('0x11')]===0x1f4){logger[_0x0540('0x10')](_0x0540('0xc'),_0x57140b,_0x30ae66[_0x0540('0x10')][_0x0540('0x12')]);return _0x2b648c(_0x30ae66[_0x0540('0x10')][_0x0540('0x12')]);}logger['error'](_0x0540('0xc'),_0x57140b,_0x30ae66[_0x0540('0x10')][_0x0540('0x12')]);return _0x250788(_0x30ae66['error'][_0x0540('0x12')]);}else{logger['info'](_0x0540('0xc'),_0x57140b,_0x0540('0xd'));_0x250788(_0x30ae66[_0x0540('0x13')]['message']);}})[_0x0540('0x14')](function(_0x743afa){logger[_0x0540('0x10')](_0x0540('0xc'),_0x57140b,_0x743afa);_0x2b648c(_0x743afa);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 551adfa..21c6696 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 _0x6986=['express','fs-extra','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeResources','exports','multer','connect-timeout'];(function(_0x641275,_0x4130fa){var _0x3bc46b=function(_0x4fa7e9){while(--_0x4fa7e9){_0x641275['push'](_0x641275['shift']());}};_0x3bc46b(++_0x4130fa);}(_0x6986,0x1a2));var _0x6698=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0x6986[_0x1deb72];return _0x18bbdf;};'use strict';var multer=require(_0x6698('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6698('0x1'));var express=require(_0x6698('0x2'));var router=express['Router']();var fs_extra=require(_0x6698('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6698('0x4'));var config=require('../../config/environment');var controller=require(_0x6698('0x5'));router[_0x6698('0x6')]('/',auth[_0x6698('0x7')](),controller[_0x6698('0x8')]);router['get']('/describe',auth[_0x6698('0x7')](),controller[_0x6698('0x9')]);router[_0x6698('0x6')](_0x6698('0xa'),auth['isAuthenticated'](),controller[_0x6698('0xb')]);router[_0x6698('0x6')](_0x6698('0xc'),auth[_0x6698('0x7')](),controller[_0x6698('0xd')]);router[_0x6698('0x6')](_0x6698('0xe'),auth[_0x6698('0x7')](),controller[_0x6698('0xf')]);router['post']('/',auth[_0x6698('0x7')](),controller[_0x6698('0x10')]);router[_0x6698('0x11')](_0x6698('0x12'),auth['isAuthenticated'](),controller[_0x6698('0x13')]);router[_0x6698('0x11')](_0x6698('0xc'),auth[_0x6698('0x7')](),controller[_0x6698('0x14')]);router[_0x6698('0x11')](_0x6698('0xe'),auth['isAuthenticated'](),controller[_0x6698('0x15')]);router[_0x6698('0x16')](_0x6698('0xa'),auth['isAuthenticated'](),controller[_0x6698('0x17')]);router[_0x6698('0x18')](_0x6698('0xa'),auth[_0x6698('0x7')](),controller[_0x6698('0x19')]);router[_0x6698('0x18')]('/:id/sections',auth['isAuthenticated'](),controller['removeSections']);router[_0x6698('0x18')](_0x6698('0xe'),auth[_0x6698('0x7')](),controller[_0x6698('0x1a')]);module[_0x6698('0x1b')]=router; \ No newline at end of file +var _0x7636=['path','connect-timeout','fs-extra','../../components/interaction/service','./userProfile.controller','isAuthenticated','/describe','get','show','getSections','/:id/resources','getResources','post','/:id/clone','/:id/sections','addSections','addResources','put','/:id','update','delete','destroy','exports'];(function(_0x4f0ac7,_0x1e8032){var _0x2c1448=function(_0x5d79f7){while(--_0x5d79f7){_0x4f0ac7['push'](_0x4f0ac7['shift']());}};_0x2c1448(++_0x1e8032);}(_0x7636,0xfd));var _0x6763=function(_0x545e86,_0x46a2ed){_0x545e86=_0x545e86-0x0;var _0xa98055=_0x7636[_0x545e86];return _0xa98055;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6763('0x0'));var timeout=require(_0x6763('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6763('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x6763('0x3'));var config=require('../../config/environment');var controller=require(_0x6763('0x4'));router['get']('/',auth[_0x6763('0x5')](),controller['index']);router['get'](_0x6763('0x6'),auth[_0x6763('0x5')](),controller['describe']);router[_0x6763('0x7')]('/:id',auth[_0x6763('0x5')](),controller[_0x6763('0x8')]);router['get']('/:id/sections',auth[_0x6763('0x5')](),controller[_0x6763('0x9')]);router[_0x6763('0x7')](_0x6763('0xa'),auth[_0x6763('0x5')](),controller[_0x6763('0xb')]);router[_0x6763('0xc')]('/',auth[_0x6763('0x5')](),controller['create']);router[_0x6763('0xc')](_0x6763('0xd'),auth[_0x6763('0x5')](),controller['clone']);router[_0x6763('0xc')](_0x6763('0xe'),auth[_0x6763('0x5')](),controller[_0x6763('0xf')]);router[_0x6763('0xc')](_0x6763('0xa'),auth[_0x6763('0x5')](),controller[_0x6763('0x10')]);router[_0x6763('0x11')](_0x6763('0x12'),auth[_0x6763('0x5')](),controller[_0x6763('0x13')]);router[_0x6763('0x14')](_0x6763('0x12'),auth['isAuthenticated'](),controller[_0x6763('0x15')]);router['delete'](_0x6763('0xe'),auth['isAuthenticated'](),controller['removeSections']);router[_0x6763('0x14')](_0x6763('0xa'),auth[_0x6763('0x5')](),controller['removeResources']);module[_0x6763('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index bec2586..2d6cc18 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 _0x23bc=['STRING','getDataValue','split','BOOLEAN','sequelize','exports','name'];(function(_0x327f14,_0x3d738b){var _0x66983a=function(_0x1a1995){while(--_0x1a1995){_0x327f14['push'](_0x327f14['shift']());}};_0x66983a(++_0x3d738b);}(_0x23bc,0xc8));var _0xc23b=function(_0xc4e141,_0x1738f7){_0xc4e141=_0xc4e141-0x0;var _0x18a7ce=_0x23bc[_0xc4e141];return _0x18a7ce;};'use strict';var Sequelize=require(_0xc23b('0x0'));module[_0xc23b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc23b('0x2')},'crudPermissions':{'type':Sequelize[_0xc23b('0x3')],'set':function(_0x569a47){this['setDataValue']('crudPermissions',_0x569a47?_0x569a47['join'](''):[]);},'get':function(){return this[_0xc23b('0x4')]('crudPermissions')?this[_0xc23b('0x4')]('crudPermissions')[_0xc23b('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc23b('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xc23b('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xc23b('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xc23b('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xc23b('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xc23b('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc23b('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc23b('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7f25=['setDataValue','crudPermissions','join','getDataValue','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7f25,0xe6));var _0x57f2=function(_0x18b191,_0x4e0684){_0x18b191=_0x18b191-0x0;var _0x43e146=_0x7f25[_0x18b191];return _0x43e146;};'use strict';var Sequelize=require(_0x57f2('0x0'));module[_0x57f2('0x1')]={'name':{'type':Sequelize[_0x57f2('0x2')],'allowNull':![],'unique':_0x57f2('0x3')},'crudPermissions':{'type':Sequelize[_0x57f2('0x2')],'set':function(_0x53d723){this[_0x57f2('0x4')](_0x57f2('0x5'),_0x53d723?_0x53d723[_0x57f2('0x6')](''):[]);},'get':function(){return this[_0x57f2('0x7')](_0x57f2('0x5'))?this[_0x57f2('0x7')](_0x57f2('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x57f2('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x57f2('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x57f2('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x57f2('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x57f2('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x57f2('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x57f2('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x57f2('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 9e0213e..3e2e8d0 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 _0xeb3b=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','end','error','name','map','UserProfile','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','length','create','body','clone','find','omit','createdAt','updatedAt','crudPermissions','sequelize','get','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','userProfileId','Resources','destroy','describe','addSections','transaction','sectionId','push','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','Plugin','resourceId','bulkCreate','removeResources','section','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x53b398,_0x39bfd8){var _0x32c9ed=function(_0x5f5c4f){while(--_0x5f5c4f){_0x53b398['push'](_0x53b398['shift']());}};_0x32c9ed(++_0x39bfd8);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x356d1b,_0x2a9fb7){_0x356d1b=_0x356d1b-0x0;var _0x4c2ca4=_0xeb3b[_0x356d1b];return _0x4c2ca4;};'use strict';var emlformat=require(_0xbeb3('0x0'));var rimraf=require(_0xbeb3('0x1'));var zipdir=require(_0xbeb3('0x2'));var jsonpatch=require(_0xbeb3('0x3'));var rp=require(_0xbeb3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbeb3('0x5'));var util=require('util');var path=require(_0xbeb3('0x6'));var sox=require('sox');var csv=require(_0xbeb3('0x7'));var ejs=require(_0xbeb3('0x8'));var fs=require('fs');var fs_extra=require(_0xbeb3('0x9'));var _=require(_0xbeb3('0xa'));var squel=require(_0xbeb3('0xb'));var crypto=require(_0xbeb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbeb3('0xd'));var toCsv=require(_0xbeb3('0x7'));var querystring=require(_0xbeb3('0xe'));var Papa=require(_0xbeb3('0xf'));var Redis=require(_0xbeb3('0x10'));var authService=require(_0xbeb3('0x11'));var qs=require(_0xbeb3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbeb3('0x13'));var logger=require(_0xbeb3('0x14'))('api');var utils=require(_0xbeb3('0x15'));var config=require(_0xbeb3('0x16'));var licenseUtil=require(_0xbeb3('0x17'));var db=require(_0xbeb3('0x18'))['db'];config[_0xbeb3('0x19')]=_[_0xbeb3('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbeb3('0x1b'))(new Redis(config[_0xbeb3('0x19')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0xed9879,_0x40f586){_0x40f586=_0x40f586||0xcc;return function(_0x395d2b){if(_0x395d2b){return _0xed9879[_0xbeb3('0x1c')](_0x40f586);}return _0xed9879[_0xbeb3('0x1d')](_0x40f586)['end']();};}function respondWithResult(_0x1aeaee,_0x5970a1){_0x5970a1=_0x5970a1||0xc8;return function(_0x80ef55){if(_0x80ef55){return _0x1aeaee['status'](_0x5970a1)['json'](_0x80ef55);}};}function respondWithFilteredResult(_0x4f8481,_0x9bc0a4){return function(_0x44a4bb){if(_0x44a4bb){var _0x32275b=typeof _0x9bc0a4[_0xbeb3('0x1e')]==='undefined'&&typeof _0x9bc0a4[_0xbeb3('0x1f')]===_0xbeb3('0x20');var _0xe2cc47=_0x44a4bb['count'];var _0x4af96f=_0x32275b?0x0:_0x9bc0a4[_0xbeb3('0x1e')];var _0x57e8b6=_0x32275b?_0x44a4bb[_0xbeb3('0x21')]:_0x9bc0a4['offset']+_0x9bc0a4['limit'];var _0xfa2736;if(_0x57e8b6>=_0xe2cc47){_0x57e8b6=_0xe2cc47;_0xfa2736=0xc8;}else{_0xfa2736=0xce;}_0x4f8481[_0xbeb3('0x1d')](_0xfa2736);return _0x4f8481[_0xbeb3('0x22')]('Content-Range',_0x4af96f+'-'+_0x57e8b6+'/'+_0xe2cc47)[_0xbeb3('0x23')](_0x44a4bb);}return null;};}function patchUpdates(_0x18ea0f){return function(_0x5e047e){try{jsonpatch[_0xbeb3('0x24')](_0x5e047e,_0x18ea0f,!![]);}catch(_0x366bdb){return BPromise['reject'](_0x366bdb);}return _0x5e047e[_0xbeb3('0x25')]();};}function saveUpdates(_0x278fe4,_0x16b079){return function(_0x42c6c3){if(_0x42c6c3){return _0x42c6c3[_0xbeb3('0x26')](_0x278fe4)[_0xbeb3('0x27')](function(_0x84921a){return _0x84921a;});}return null;};}function removeEntity(_0x340581,_0x46fe17){return function(_0x59f27c){if(_0x59f27c){return _0x59f27c['destroy']()[_0xbeb3('0x27')](function(){_0x340581['status'](0xcc)[_0xbeb3('0x28')]();});}};}function handleEntityNotFound(_0xda808c,_0x138adf){return function(_0x400f65){if(!_0x400f65){_0xda808c['sendStatus'](0x194);}return _0x400f65;};}function handleError(_0x2fe7ec,_0x5bc3e1){_0x5bc3e1=_0x5bc3e1||0x1f4;return function(_0x26cd8f){logger[_0xbeb3('0x29')](_0x26cd8f['stack']);if(_0x26cd8f['name']){delete _0x26cd8f[_0xbeb3('0x2a')];}_0x2fe7ec['status'](_0x5bc3e1)['send'](_0x26cd8f);};}exports['index']=function(_0x5bfef7,_0xf5dbaf){var _0x4e9a04={},_0x3767cc={},_0x3dff2d={'count':0x0,'rows':[]};var _0x1b4c2e=_[_0xbeb3('0x2b')](db[_0xbeb3('0x2c')][_0xbeb3('0x2d')],function(_0x411cd3){return{'name':_0x411cd3[_0xbeb3('0x2e')],'type':_0x411cd3[_0xbeb3('0x2f')][_0xbeb3('0x30')]};});_0x3767cc['model']=_[_0xbeb3('0x2b')](_0x1b4c2e,_0xbeb3('0x2a'));_0x3767cc['query']=_[_0xbeb3('0x31')](_0x5bfef7[_0xbeb3('0x32')]);_0x3767cc[_0xbeb3('0x33')]=_[_0xbeb3('0x34')](_0x3767cc['model'],_0x3767cc[_0xbeb3('0x32')]);_0x4e9a04[_0xbeb3('0x35')]=_[_0xbeb3('0x34')](_0x3767cc[_0xbeb3('0x36')],qs[_0xbeb3('0x37')](_0x5bfef7[_0xbeb3('0x32')][_0xbeb3('0x37')]));_0x4e9a04[_0xbeb3('0x35')]=_0x4e9a04[_0xbeb3('0x35')]['length']?_0x4e9a04[_0xbeb3('0x35')]:_0x3767cc['model'];if(!_0x5bfef7[_0xbeb3('0x32')][_0xbeb3('0x38')](_0xbeb3('0x39'))){_0x4e9a04[_0xbeb3('0x1f')]=qs[_0xbeb3('0x1f')](_0x5bfef7[_0xbeb3('0x32')][_0xbeb3('0x1f')]);_0x4e9a04[_0xbeb3('0x1e')]=qs['offset'](_0x5bfef7[_0xbeb3('0x32')]['offset']);}_0x4e9a04['order']=qs['sort'](_0x5bfef7[_0xbeb3('0x32')][_0xbeb3('0x3a')]);_0x4e9a04[_0xbeb3('0x3b')]=qs[_0xbeb3('0x33')](_[_0xbeb3('0x3c')](_0x5bfef7[_0xbeb3('0x32')],_0x3767cc['filters']),_0x1b4c2e);if(_0x5bfef7[_0xbeb3('0x32')][_0xbeb3('0x3d')]){_0x4e9a04[_0xbeb3('0x3b')]=_['merge'](_0x4e9a04['where'],{'$or':_['map'](_0x1b4c2e,function(_0x46f570){if(_0x46f570[_0xbeb3('0x2f')]!==_0xbeb3('0x3e')){var _0x5d5225={};_0x5d5225[_0x46f570[_0xbeb3('0x2a')]]={'$like':'%'+_0x5bfef7['query'][_0xbeb3('0x3d')]+'%'};return _0x5d5225;}})});}_0x4e9a04=_[_0xbeb3('0x3f')]({},_0x4e9a04,_0x5bfef7[_0xbeb3('0x40')]);var _0x44632a={'where':_0x4e9a04['where']};return db['UserProfile'][_0xbeb3('0x21')](_0x44632a)[_0xbeb3('0x27')](function(_0x3d4262){_0x3dff2d[_0xbeb3('0x21')]=_0x3d4262;if(_0x5bfef7[_0xbeb3('0x32')][_0xbeb3('0x41')]){_0x4e9a04[_0xbeb3('0x42')]=[{'all':!![]}];}return db[_0xbeb3('0x2c')]['findAll'](_0x4e9a04);})[_0xbeb3('0x27')](function(_0x39f2d2){_0x3dff2d[_0xbeb3('0x43')]=_0x39f2d2;return _0x3dff2d;})[_0xbeb3('0x27')](respondWithFilteredResult(_0xf5dbaf,_0x4e9a04))[_0xbeb3('0x44')](handleError(_0xf5dbaf,null));};exports[_0xbeb3('0x45')]=function(_0x1ef1cd,_0x5234bc){var _0x284616={'raw':![],'where':{'id':_0x1ef1cd[_0xbeb3('0x46')]['id']}},_0xd0403f={};_0xd0403f[_0xbeb3('0x36')]=_[_0xbeb3('0x31')](db[_0xbeb3('0x2c')][_0xbeb3('0x2d')]);_0xd0403f[_0xbeb3('0x32')]=_[_0xbeb3('0x31')](_0x1ef1cd[_0xbeb3('0x32')]);_0xd0403f[_0xbeb3('0x33')]=_[_0xbeb3('0x34')](_0xd0403f[_0xbeb3('0x36')],_0xd0403f['query']);_0x284616[_0xbeb3('0x35')]=_[_0xbeb3('0x34')](_0xd0403f[_0xbeb3('0x36')],qs['fields'](_0x1ef1cd['query'][_0xbeb3('0x37')]));_0x284616[_0xbeb3('0x35')]=_0x284616[_0xbeb3('0x35')][_0xbeb3('0x47')]?_0x284616['attributes']:_0xd0403f[_0xbeb3('0x36')];if(_0x1ef1cd['query']['includeAll']){_0x284616[_0xbeb3('0x42')]=[{'all':!![]}];}_0x284616=_[_0xbeb3('0x3f')]({},_0x284616,_0x1ef1cd[_0xbeb3('0x40')]);return db[_0xbeb3('0x2c')]['find'](_0x284616)[_0xbeb3('0x27')](handleEntityNotFound(_0x5234bc,null))[_0xbeb3('0x27')](respondWithResult(_0x5234bc,null))[_0xbeb3('0x44')](handleError(_0x5234bc,null));};exports['create']=function(_0x3f93ab,_0x58c49f){return db['UserProfile'][_0xbeb3('0x48')](_0x3f93ab[_0xbeb3('0x49')],{})[_0xbeb3('0x27')](respondWithResult(_0x58c49f,0xc9))['catch'](handleError(_0x58c49f,null));};exports[_0xbeb3('0x4a')]=function(_0x312b28,_0x367942){var _0x4e17c0={'where':{'id':_0x312b28['params']['id']}},_0x2cda0d={};_0x2cda0d[_0xbeb3('0x36')]=_['keys'](db[_0xbeb3('0x2c')][_0xbeb3('0x2d')]);_0x4e17c0[_0xbeb3('0x35')]=_[_0xbeb3('0x34')](_0x2cda0d[_0xbeb3('0x36')],qs[_0xbeb3('0x37')](_0x312b28[_0xbeb3('0x32')][_0xbeb3('0x37')]));_0x4e17c0['attributes']=_0x4e17c0[_0xbeb3('0x35')][_0xbeb3('0x47')]?_0x4e17c0[_0xbeb3('0x35')]:_0x2cda0d[_0xbeb3('0x36')];if(_0x312b28['query'][_0xbeb3('0x41')]){_0x4e17c0[_0xbeb3('0x42')]=[{'all':!![]}];}_0x4e17c0=_[_0xbeb3('0x3f')]({},_0x4e17c0,_0x312b28[_0xbeb3('0x40')]);return db['UserProfile'][_0xbeb3('0x4b')](_0x4e17c0)['then'](handleEntityNotFound(_0x367942,null))[_0xbeb3('0x27')](function(_0x434300){if(_0x434300){var _0x371845=_0x434300['get']({'plain':!![]});_0x371845=qs[_0xbeb3('0x4c')](_0x371845,['id',_0xbeb3('0x4d'),_0xbeb3('0x4e'),_0xbeb3('0x4f')]);_0x312b28[_0xbeb3('0x49')]=_[_0xbeb3('0x4c')](_0x312b28[_0xbeb3('0x49')],['id',_0xbeb3('0x4d'),_0xbeb3('0x4e')]);return db[_0xbeb3('0x50')]['transaction'](function(_0x1fcc40){return db[_0xbeb3('0x2c')][_0xbeb3('0x48')](_[_0xbeb3('0x3f')](_0x371845,_0x312b28[_0xbeb3('0x49')]),{'include':_0x312b28['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x1fcc40})[_0xbeb3('0x27')](function(_0x3ddf1e){var _0x515af2=_0x3ddf1e[_0xbeb3('0x51')]({'plain':!![]});return db[_0xbeb3('0x52')][_0xbeb3('0x53')]({'where':{'userProfileId':_0x312b28[_0xbeb3('0x46')]['id']},'raw':!![]})[_0xbeb3('0x27')](function(_0x33019c){if(_0x33019c){return BPromise[_0xbeb3('0x54')](_0x33019c,function(_0x5d813b){return new BPromise(function(_0x31bda5,_0x40b0c0){if(_0x5d813b[_0xbeb3('0x55')]===null||_0x5d813b['autoAssociation']===0x1)_0x31bda5(null);return db[_0xbeb3('0x56')][_0xbeb3('0x53')]({'where':{'sectionId':_0x5d813b['id']},'raw':!![]})['then'](function(_0xf73e97){var _0x455924=_[_0xbeb3('0x2b')](_0xf73e97,function(_0x255f9a){return qs['omit'](_0x255f9a,['id','createdAt',_0xbeb3('0x4e'),'sectionId']);});_0x31bda5(_0x455924);})[_0xbeb3('0x44')](function(_0x59f2e3){_0x40b0c0(_0x59f2e3);});})[_0xbeb3('0x27')](function(_0x381b28){var _0x2ce380=qs[_0xbeb3('0x4c')](_0x5d813b,['id',_0xbeb3('0x4d'),_0xbeb3('0x4e')]);_0x2ce380[_0xbeb3('0x57')]=_0x515af2['id'];if(_0x381b28)_0x2ce380[_0xbeb3('0x58')]=_0x381b28;return _0x2ce380;})[_0xbeb3('0x27')](function(_0x17718a){return db[_0xbeb3('0x52')][_0xbeb3('0x48')](_0x17718a,{'include':[{'model':db[_0xbeb3('0x56')],'as':_0xbeb3('0x58')}],'raw':!![],'transaction':_0x1fcc40});});})[_0xbeb3('0x27')](function(){return _0x515af2;});}});});});}})[_0xbeb3('0x27')](respondWithResult(_0x367942,0xc9))[_0xbeb3('0x44')](handleError(_0x367942,null));};exports[_0xbeb3('0x26')]=function(_0x4794f7,_0x15c890){if(_0x4794f7[_0xbeb3('0x49')]['id']){delete _0x4794f7[_0xbeb3('0x49')]['id'];}return db[_0xbeb3('0x2c')][_0xbeb3('0x4b')]({'where':{'id':_0x4794f7['params']['id']}})[_0xbeb3('0x27')](handleEntityNotFound(_0x15c890,null))['then'](saveUpdates(_0x4794f7[_0xbeb3('0x49')],null))[_0xbeb3('0x27')](respondWithResult(_0x15c890,null))[_0xbeb3('0x44')](handleError(_0x15c890,null));};exports[_0xbeb3('0x59')]=function(_0x377717,_0x394524){return db[_0xbeb3('0x2c')][_0xbeb3('0x4b')]({'where':{'id':_0x377717[_0xbeb3('0x46')]['id']}})[_0xbeb3('0x27')](handleEntityNotFound(_0x394524,null))[_0xbeb3('0x27')](removeEntity(_0x394524,null))[_0xbeb3('0x44')](handleError(_0x394524,null));};exports[_0xbeb3('0x5a')]=function(_0xac5f0,_0x671309){return db[_0xbeb3('0x2c')][_0xbeb3('0x5a')]()[_0xbeb3('0x27')](respondWithResult(_0x671309,null))[_0xbeb3('0x44')](handleError(_0x671309,null));};exports[_0xbeb3('0x5b')]=function(_0x44191f,_0x1dc478){var _0x285179=_0x44191f[_0xbeb3('0x49')];return db[_0xbeb3('0x2c')][_0xbeb3('0x4b')]({'where':{'id':_0x44191f[_0xbeb3('0x46')]['id']}})[_0xbeb3('0x27')](handleEntityNotFound(_0x1dc478,null))[_0xbeb3('0x27')](function(_0x378f38){if(_0x378f38){return db[_0xbeb3('0x50')][_0xbeb3('0x5c')](function(_0x223722){return db[_0xbeb3('0x52')][_0xbeb3('0x59')]({'where':{'userProfileId':_0x44191f[_0xbeb3('0x46')]['id'],'sectionId':_['map'](_0x285179,function(_0x32fa71){return _0x32fa71[_0xbeb3('0x5d')];})},'transaction':_0x223722})['then'](function(){var _0x769a06=_[_0xbeb3('0x2b')](_0x285179,function(_0x3a8eb3){_0x3a8eb3['userProfileId']=_0x44191f['params']['id'];return _0x3a8eb3;});var _0x2c2784=[];return BPromise[_0xbeb3('0x54')](_0x769a06,function(_0x30c796){return db[_0xbeb3('0x52')][_0xbeb3('0x48')](_0x30c796,{'include':[{'model':db['UserProfileResource'],'as':_0xbeb3('0x58')}],'raw':!![],'transaction':_0x223722})[_0xbeb3('0x27')](function(_0x217794){_0x2c2784[_0xbeb3('0x5e')](_0x217794[_0xbeb3('0x51')]({'plain':!![]}));});})['then'](function(){return _0x2c2784;});});});}})[_0xbeb3('0x27')](function(_0x5238c3){return _0x5238c3;})['then'](respondWithResult(_0x1dc478,null))[_0xbeb3('0x44')](handleError(_0x1dc478,null));};exports['removeSections']=function(_0x41d0e8,_0x262563){var _0x20f5d0;return db[_0xbeb3('0x2c')][_0xbeb3('0x4b')]({'where':{'id':_0x41d0e8[_0xbeb3('0x46')]['id']},'attributes':['id',_0xbeb3('0x2a')]})['then'](handleEntityNotFound(_0x262563,null))[_0xbeb3('0x27')](function(_0xde4a75){if(_0xde4a75){_0x20f5d0=_0xde4a75;return db[_0xbeb3('0x52')]['destroy']({'where':{'userProfileId':_0x41d0e8['params']['id'],'sectionId':_0x41d0e8[_0xbeb3('0x32')]['ids']}});}})['then'](function(){return _0x20f5d0;})['then'](respondWithStatusCode(_0x262563,null))[_0xbeb3('0x44')](handleError(_0x262563,null));};exports[_0xbeb3('0x5f')]=function(_0x9df1c1,_0x283482){var _0x5682be=[];var _0x52dc94=[];return db[_0xbeb3('0x52')][_0xbeb3('0x53')]({'where':{'userProfileId':_0x9df1c1[_0xbeb3('0x46')]['id']},'raw':!![]})['then'](function(_0x57d23c){_0x5682be=_[_0xbeb3('0x3d')](_0x57d23c,function(_0x3f45dc){return _0x3f45dc[_0xbeb3('0x60')]===0x1||_[_0xbeb3('0x61')]([0x3eb,0x709],_0x3f45dc[_0xbeb3('0x5d')]);});if(!_[_0xbeb3('0x62')](_0x5682be)){return _[_0xbeb3('0x2b')](_0x5682be,function(_0x5db0c1){return _0x5db0c1['sectionId'];});}else{return;}})[_0xbeb3('0x27')](function(_0x3013d4){if(_0x3013d4)_0x52dc94=_0x3013d4;if(_['includes'](_0x52dc94,0x64)){var _0x513d6e=_[_0xbeb3('0x4b')](_0x5682be,{'sectionId':0x64});return hasDefaultDashboard(_0x513d6e)['then'](function(_0x32cffa){return _[_0xbeb3('0x2b')](_0x5682be,function(_0x20c2f2){if(_0x20c2f2[_0xbeb3('0x5d')]===0x64){_0x20c2f2[_0xbeb3('0x63')]=_0x32cffa;}return _0x20c2f2;});});}else{return;}})[_0xbeb3('0x27')](function(_0x372b36){if(_0x372b36)_0x5682be=_0x372b36;if(_[_0xbeb3('0x61')](_0x52dc94,0x3eb)){var _0x239b00=_[_0xbeb3('0x4b')](_0x5682be,{'sectionId':0x3eb});return getCustomDashboards(_0x239b00)[_0xbeb3('0x27')](function(_0x1f7afa){return _[_0xbeb3('0x2b')](_0x5682be,function(_0x153d12){if(_0x239b00[_0xbeb3('0x60')]){if(_0x153d12[_0xbeb3('0x5d')]===0x3eb){_0x153d12[_0xbeb3('0x63')]=_0x1f7afa;}}else{if(_0x153d12[_0xbeb3('0x5d')]===0x64){_0x153d12['subsections']=_0x1f7afa;}}return _0x153d12;});});}else{return;}})['then'](function(_0x167922){if(_0x167922)_0x5682be=_0x167922;if(_[_0xbeb3('0x61')](_0x52dc94,0x709)){var _0x53b510=_[_0xbeb3('0x4b')](_0x5682be,{'sectionId':0x709});return getPlugins(_0x53b510)['then'](function(_0x7de5eb){if(_0x53b510[_0xbeb3('0x60')]){return _['map'](_0x5682be,function(_0x458c16){if(_0x458c16[_0xbeb3('0x5d')]===0x709){_0x458c16[_0xbeb3('0x63')]=_0x7de5eb;}return _0x458c16;});}else{var _0x3c174e={'sectionId':0x76c,'enabled':0x1,'subsections':_0x7de5eb};var _0x370b38=_[_0xbeb3('0x2b')](_0x5682be);_0x370b38[_0xbeb3('0x5e')](_0x3c174e);return _0x370b38;}});}else{return;}})[_0xbeb3('0x27')](function(_0x113461){if(_0x113461)_0x5682be=_0x113461;return _[_0xbeb3('0x3d')](_0x5682be,[_0xbeb3('0x60'),0x1]);})[_0xbeb3('0x27')](respondWithResult(_0x283482,null))['catch'](handleError(_0x283482,null));};function hasDefaultDashboard(_0x3b48de){var _0x18e82d=[0x65];return new BPromise(function(_0x42b384,_0x446461){try{if(_0x3b48de[_0xbeb3('0x55')]){_0x42b384(_0x18e82d);}else{return db['UserProfileResource'][_0xbeb3('0x64')]({'where':{'sectionId':_0x3b48de['id']},'raw':!![]})[_0xbeb3('0x27')](function(_0x4a396a){_0x4a396a?_0x42b384(_0x18e82d):_0x42b384();});}}catch(_0xa3b0){_0x446461(_0xa3b0);}});}function getCustomDashboards(_0x571c14){var _0x5e68df=[];return new BPromise(function(_0x2dac53,_0x361ec1){try{if(_0x571c14[_0xbeb3('0x55')]){return db['Dashboard'][_0xbeb3('0x53')]({'raw':!![]})[_0xbeb3('0x27')](function(_0x2dcee5){_0x2dcee5['forEach'](function(_0x2fd0f8){_0x5e68df[_0xbeb3('0x5e')](_0x2fd0f8['id']+0x1869f);});_0x2dac53(_0x5e68df);});}else{return db[_0xbeb3('0x56')]['findAll']({'where':{'sectionId':_0x571c14['id']},'raw':!![]})[_0xbeb3('0x27')](function(_0x39011f){_0x39011f[_0xbeb3('0x65')](function(_0x6246f4){_0x5e68df[_0xbeb3('0x5e')](_0x6246f4['resourceId']+0x1869f);});_0x2dac53(_0x5e68df);});}}catch(_0xdb820a){_0x361ec1(_0xdb820a);}});}function getPlugins(_0x4c5bf4){var _0x12b144=[];return new BPromise(function(_0x39a2c7,_0x239dd5){try{if(_0x4c5bf4['autoAssociation']){return db[_0xbeb3('0x66')][_0xbeb3('0x53')]({'raw':!![]})[_0xbeb3('0x27')](function(_0xa4c484){_0xa4c484[_0xbeb3('0x65')](function(_0x1db3a3){_0x12b144['push'](_0x1db3a3['id']+0x15b38);});_0x39a2c7(_0x12b144);});}else{return db['UserProfileResource'][_0xbeb3('0x53')]({'where':{'sectionId':_0x4c5bf4['id']},'raw':!![]})[_0xbeb3('0x27')](function(_0x358d52){_0x358d52['forEach'](function(_0x8fce8a){_0x12b144['push'](_0x8fce8a[_0xbeb3('0x67')]+0x15b38);});_0x39a2c7(_0x12b144);});}}catch(_0x332543){_0x239dd5(_0x332543);}});}exports['addResources']=function(_0x5c13e0,_0x2a9a98){return db['UserProfile'][_0xbeb3('0x4b')]({'where':{'id':_0x5c13e0[_0xbeb3('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a9a98,null))[_0xbeb3('0x27')](function(_0x5618be){if(_0x5618be){return db[_0xbeb3('0x50')]['transaction'](function(_0xb64312){return db[_0xbeb3('0x52')][_0xbeb3('0x53')]({'where':{'userProfileId':_0x5c13e0[_0xbeb3('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0xbeb3('0x27')](function(_0x6bb3ba){if(_0x6bb3ba){return db[_0xbeb3('0x52')][_0xbeb3('0x59')]({'where':{'userProfileId':_0x5c13e0['params']['id'],'id':_['map'](_0x6bb3ba,function(_0x2a16ac){return _0x2a16ac['id'];})},'transaction':_0xb64312});}})[_0xbeb3('0x27')](function(_0x3de3b7){var _0x545106=_[_0xbeb3('0x2b')](_0x5c13e0[_0xbeb3('0x49')],function(_0x3e5dd5){_0x3e5dd5[_0xbeb3('0x57')]=_0x5c13e0[_0xbeb3('0x46')]['id'];return _0x3e5dd5;});return db['UserProfileSection'][_0xbeb3('0x68')](_0x545106,{'raw':!![],'transaction':_0xb64312});})[_0xbeb3('0x27')](function(_0x2b6ddf){var _0x5d3d04=_[_0xbeb3('0x3d')](_[_0xbeb3('0x2b')](_0x2b6ddf,function(_0x2b567c){return _0x2b567c[_0xbeb3('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x5d3d04){return db[_0xbeb3('0x52')][_0xbeb3('0x53')]({'where':{'userProfileId':_0x5c13e0[_0xbeb3('0x46')]['id'],'sectionId':_['map'](_0x5d3d04,function(_0x23efa1){return _0x23efa1[_0xbeb3('0x5d')];})},'attributes':['id',_0xbeb3('0x5d')],'raw':!![]})[_0xbeb3('0x27')](function(_0x3e9822){var _0x3e53af=_['map'](_0x5c13e0[_0xbeb3('0x49')],function(_0x1ecf10){_0x1ecf10[_0xbeb3('0x57')]=_0x5c13e0['params']['id'];return _0x1ecf10;});return db['UserProfileResource']['bulkCreate'](_0x3e53af,{'raw':!![],'transaction':_0xb64312});});}})[_0xbeb3('0x44')](handleError(_0x2a9a98,null));});}})['then'](function(_0x5c1fc6){var _0x1cce32=_['map'](_0x5c1fc6,function(_0x4f13ec){return _0x4f13ec[_0xbeb3('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0x2a9a98,null))[_0xbeb3('0x44')](handleError(_0x2a9a98,null));};exports[_0xbeb3('0x69')]=function(_0x3e70d7,_0x568d79,_0x43fd1a){return db['UserProfile'][_0xbeb3('0x4b')]({'where':{'id':_0x3e70d7[_0xbeb3('0x46')]['id']}})[_0xbeb3('0x27')](handleEntityNotFound(_0x568d79,null))[_0xbeb3('0x27')](function(_0x3c7d4a){if(_0x3c7d4a){return _0x3c7d4a[_0xbeb3('0x69')](_0x3e70d7[_0xbeb3('0x32')]['ids']);}})[_0xbeb3('0x27')](respondWithStatusCode(_0x568d79,null))['catch'](handleError(_0x568d79,null));};exports['getResources']=function(_0x564ec8,_0x573ea1){var _0x79b9af={};if(!_0x564ec8[_0xbeb3('0x32')][_0xbeb3('0x6a')])throw new Error('Missing\x20section\x20parameter');if(!_0x564ec8[_0xbeb3('0x32')][_0xbeb3('0x38')](_0xbeb3('0x39'))){_0x79b9af[_0xbeb3('0x1f')]=qs[_0xbeb3('0x1f')](_0x564ec8[_0xbeb3('0x32')][_0xbeb3('0x1f')]);_0x79b9af[_0xbeb3('0x1e')]=qs[_0xbeb3('0x1e')](_0x564ec8['query'][_0xbeb3('0x1e')]);}return db['UserProfile'][_0xbeb3('0x4b')]({'where':{'id':_0x564ec8[_0xbeb3('0x46')]['id']}})[_0xbeb3('0x27')](function(_0x25f2b4){if(!_0x25f2b4)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x564ec8[_0xbeb3('0x46')]['id']);return db['UserProfile'][_0xbeb3('0x6b')](_0x564ec8);})[_0xbeb3('0x27')](respondWithFilteredResult(_0x573ea1,_0x79b9af))[_0xbeb3('0x44')](handleError(_0x573ea1,null));}; \ No newline at end of file +var _0x508a=['fs-extra','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','stack','name','index','UserProfile','fieldName','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','clone','get','omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','update','describe','push','removeSections','ids','getSections','enabled','isEmpty','subsections','includes','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa508('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa508('0x1'));var jsonpatch=require(_0xa508('0x2'));var rp=require(_0xa508('0x3'));var moment=require(_0xa508('0x4'));var BPromise=require(_0xa508('0x5'));var Mustache=require('mustache');var util=require(_0xa508('0x6'));var path=require(_0xa508('0x7'));var sox=require(_0xa508('0x8'));var csv=require('to-csv');var ejs=require(_0xa508('0x9'));var fs=require('fs');var fs_extra=require(_0xa508('0xa'));var _=require(_0xa508('0xb'));var squel=require('squel');var crypto=require(_0xa508('0xc'));var jsforce=require(_0xa508('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa508('0xe'));var querystring=require(_0xa508('0xf'));var Papa=require('papaparse');var Redis=require(_0xa508('0x10'));var authService=require(_0xa508('0x11'));var qs=require(_0xa508('0x12'));var as=require(_0xa508('0x13'));var hardwareService=require(_0xa508('0x14'));var logger=require('../../config/logger')(_0xa508('0x15'));var utils=require(_0xa508('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa508('0x17'));var db=require(_0xa508('0x18'))['db'];config[_0xa508('0x19')]=_['defaults'](config[_0xa508('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xa508('0x1a'))(new Redis(config[_0xa508('0x19')]));require(_0xa508('0x1b'))[_0xa508('0x1c')](socket);function respondWithStatusCode(_0x5cd0ce,_0xf68d){_0xf68d=_0xf68d||0xcc;return function(_0x45a0bc){if(_0x45a0bc){return _0x5cd0ce[_0xa508('0x1d')](_0xf68d);}return _0x5cd0ce[_0xa508('0x1e')](_0xf68d)['end']();};}function respondWithResult(_0x15b852,_0x1de0fb){_0x1de0fb=_0x1de0fb||0xc8;return function(_0x23fbe6){if(_0x23fbe6){return _0x15b852[_0xa508('0x1e')](_0x1de0fb)['json'](_0x23fbe6);}};}function respondWithFilteredResult(_0x1a366f,_0x27d102){return function(_0x5e29a8){if(_0x5e29a8){var _0x5d345d=typeof _0x27d102[_0xa508('0x1f')]===_0xa508('0x20')&&typeof _0x27d102[_0xa508('0x21')]===_0xa508('0x20');var _0x421874=_0x5e29a8[_0xa508('0x22')];var _0x3dde4e=_0x5d345d?0x0:_0x27d102[_0xa508('0x1f')];var _0x4b7bdc=_0x5d345d?_0x5e29a8[_0xa508('0x22')]:_0x27d102[_0xa508('0x1f')]+_0x27d102[_0xa508('0x21')];var _0x45b284;if(_0x4b7bdc>=_0x421874){_0x4b7bdc=_0x421874;_0x45b284=0xc8;}else{_0x45b284=0xce;}_0x1a366f[_0xa508('0x1e')](_0x45b284);return _0x1a366f['set'](_0xa508('0x23'),_0x3dde4e+'-'+_0x4b7bdc+'/'+_0x421874)['json'](_0x5e29a8);}return null;};}function patchUpdates(_0xf4f3f7){return function(_0x4138f6){try{jsonpatch['apply'](_0x4138f6,_0xf4f3f7,!![]);}catch(_0x3859c9){return BPromise[_0xa508('0x24')](_0x3859c9);}return _0x4138f6[_0xa508('0x25')]();};}function saveUpdates(_0x306b3c,_0x4e869f){return function(_0x4e3244){if(_0x4e3244){return _0x4e3244['update'](_0x306b3c)[_0xa508('0x26')](function(_0x2cda06){return _0x2cda06;});}return null;};}function removeEntity(_0x46af7f,_0x1cfadf){return function(_0x276d0d){if(_0x276d0d){return _0x276d0d[_0xa508('0x27')]()[_0xa508('0x26')](function(){_0x46af7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x98b1c8,_0x1bca04){return function(_0x47d93b){if(!_0x47d93b){_0x98b1c8[_0xa508('0x1d')](0x194);}return _0x47d93b;};}function handleError(_0x523150,_0x1626a1){_0x1626a1=_0x1626a1||0x1f4;return function(_0x44616a){logger['error'](_0x44616a[_0xa508('0x28')]);if(_0x44616a[_0xa508('0x29')]){delete _0x44616a[_0xa508('0x29')];}_0x523150[_0xa508('0x1e')](_0x1626a1)['send'](_0x44616a);};}exports[_0xa508('0x2a')]=function(_0x405baa,_0x3eb26c){var _0x5d971d={},_0x2affae={},_0x391ba7={'count':0x0,'rows':[]};var _0x4a7161=_['map'](db[_0xa508('0x2b')]['rawAttributes'],function(_0x4d6a46){return{'name':_0x4d6a46[_0xa508('0x2c')],'type':_0x4d6a46['type']['key']};});_0x2affae[_0xa508('0x2d')]=_[_0xa508('0x2e')](_0x4a7161,'name');_0x2affae[_0xa508('0x2f')]=_[_0xa508('0x30')](_0x405baa[_0xa508('0x2f')]);_0x2affae['filters']=_['intersection'](_0x2affae[_0xa508('0x2d')],_0x2affae[_0xa508('0x2f')]);_0x5d971d[_0xa508('0x31')]=_[_0xa508('0x32')](_0x2affae[_0xa508('0x2d')],qs[_0xa508('0x33')](_0x405baa[_0xa508('0x2f')][_0xa508('0x33')]));_0x5d971d[_0xa508('0x31')]=_0x5d971d[_0xa508('0x31')][_0xa508('0x34')]?_0x5d971d['attributes']:_0x2affae[_0xa508('0x2d')];if(!_0x405baa[_0xa508('0x2f')][_0xa508('0x35')](_0xa508('0x36'))){_0x5d971d['limit']=qs[_0xa508('0x21')](_0x405baa[_0xa508('0x2f')][_0xa508('0x21')]);_0x5d971d['offset']=qs[_0xa508('0x1f')](_0x405baa[_0xa508('0x2f')][_0xa508('0x1f')]);}_0x5d971d['order']=qs['sort'](_0x405baa[_0xa508('0x2f')][_0xa508('0x37')]);_0x5d971d[_0xa508('0x38')]=qs[_0xa508('0x39')](_['pick'](_0x405baa[_0xa508('0x2f')],_0x2affae[_0xa508('0x39')]),_0x4a7161);if(_0x405baa[_0xa508('0x2f')][_0xa508('0x3a')]){_0x5d971d[_0xa508('0x38')]=_[_0xa508('0x3b')](_0x5d971d[_0xa508('0x38')],{'$or':_[_0xa508('0x2e')](_0x4a7161,function(_0x38acd6){if(_0x38acd6[_0xa508('0x3c')]!==_0xa508('0x3d')){var _0xd4d205={};_0xd4d205[_0x38acd6['name']]={'$like':'%'+_0x405baa[_0xa508('0x2f')][_0xa508('0x3a')]+'%'};return _0xd4d205;}})});}_0x5d971d=_[_0xa508('0x3b')]({},_0x5d971d,_0x405baa[_0xa508('0x3e')]);var _0x48065e={'where':_0x5d971d[_0xa508('0x38')]};return db[_0xa508('0x2b')][_0xa508('0x22')](_0x48065e)[_0xa508('0x26')](function(_0x1aa7d8){_0x391ba7[_0xa508('0x22')]=_0x1aa7d8;if(_0x405baa[_0xa508('0x2f')][_0xa508('0x3f')]){_0x5d971d[_0xa508('0x40')]=[{'all':!![]}];}return db[_0xa508('0x2b')][_0xa508('0x41')](_0x5d971d);})[_0xa508('0x26')](function(_0x7687ed){_0x391ba7['rows']=_0x7687ed;return _0x391ba7;})[_0xa508('0x26')](respondWithFilteredResult(_0x3eb26c,_0x5d971d))['catch'](handleError(_0x3eb26c,null));};exports[_0xa508('0x42')]=function(_0x66f5d5,_0x1fe380){var _0x38596e={'raw':![],'where':{'id':_0x66f5d5[_0xa508('0x43')]['id']}},_0xea31d0={};_0xea31d0[_0xa508('0x2d')]=_[_0xa508('0x30')](db['UserProfile'][_0xa508('0x44')]);_0xea31d0[_0xa508('0x2f')]=_[_0xa508('0x30')](_0x66f5d5[_0xa508('0x2f')]);_0xea31d0[_0xa508('0x39')]=_[_0xa508('0x32')](_0xea31d0[_0xa508('0x2d')],_0xea31d0[_0xa508('0x2f')]);_0x38596e[_0xa508('0x31')]=_[_0xa508('0x32')](_0xea31d0[_0xa508('0x2d')],qs[_0xa508('0x33')](_0x66f5d5[_0xa508('0x2f')][_0xa508('0x33')]));_0x38596e[_0xa508('0x31')]=_0x38596e[_0xa508('0x31')][_0xa508('0x34')]?_0x38596e[_0xa508('0x31')]:_0xea31d0[_0xa508('0x2d')];if(_0x66f5d5[_0xa508('0x2f')][_0xa508('0x3f')]){_0x38596e[_0xa508('0x40')]=[{'all':!![]}];}_0x38596e=_[_0xa508('0x3b')]({},_0x38596e,_0x66f5d5[_0xa508('0x3e')]);return db[_0xa508('0x2b')][_0xa508('0x45')](_0x38596e)['then'](handleEntityNotFound(_0x1fe380,null))[_0xa508('0x26')](respondWithResult(_0x1fe380,null))[_0xa508('0x46')](handleError(_0x1fe380,null));};exports[_0xa508('0x47')]=function(_0x11b73c,_0x390c1f){return db['UserProfile'][_0xa508('0x47')](_0x11b73c[_0xa508('0x48')],{})[_0xa508('0x26')](respondWithResult(_0x390c1f,0xc9))[_0xa508('0x46')](handleError(_0x390c1f,null));};exports[_0xa508('0x49')]=function(_0x1d943e,_0x3d99ee){var _0x5ae142={'where':{'id':_0x1d943e[_0xa508('0x43')]['id']}},_0x46bd08={};_0x46bd08[_0xa508('0x2d')]=_['keys'](db[_0xa508('0x2b')][_0xa508('0x44')]);_0x5ae142[_0xa508('0x31')]=_[_0xa508('0x32')](_0x46bd08[_0xa508('0x2d')],qs[_0xa508('0x33')](_0x1d943e[_0xa508('0x2f')][_0xa508('0x33')]));_0x5ae142[_0xa508('0x31')]=_0x5ae142['attributes'][_0xa508('0x34')]?_0x5ae142[_0xa508('0x31')]:_0x46bd08[_0xa508('0x2d')];if(_0x1d943e[_0xa508('0x2f')]['includeAll']){_0x5ae142[_0xa508('0x40')]=[{'all':!![]}];}_0x5ae142=_[_0xa508('0x3b')]({},_0x5ae142,_0x1d943e[_0xa508('0x3e')]);return db['UserProfile'][_0xa508('0x45')](_0x5ae142)[_0xa508('0x26')](handleEntityNotFound(_0x3d99ee,null))[_0xa508('0x26')](function(_0x44d8ce){if(_0x44d8ce){var _0x378773=_0x44d8ce[_0xa508('0x4a')]({'plain':!![]});_0x378773=qs[_0xa508('0x4b')](_0x378773,['id',_0xa508('0x4c'),'updatedAt',_0xa508('0x4d')]);_0x1d943e[_0xa508('0x48')]=_['omit'](_0x1d943e['body'],['id','createdAt',_0xa508('0x4e')]);return db[_0xa508('0x4f')][_0xa508('0x50')](function(_0x565130){return db[_0xa508('0x2b')][_0xa508('0x47')](_[_0xa508('0x3b')](_0x378773,_0x1d943e[_0xa508('0x48')]),{'include':_0x1d943e['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x565130})[_0xa508('0x26')](function(_0x492474){var _0x1ac43d=_0x492474[_0xa508('0x4a')]({'plain':!![]});return db['UserProfileSection'][_0xa508('0x41')]({'where':{'userProfileId':_0x1d943e['params']['id']},'raw':!![]})[_0xa508('0x26')](function(_0x5e9ce9){if(_0x5e9ce9){return BPromise[_0xa508('0x51')](_0x5e9ce9,function(_0x502379){return new BPromise(function(_0x5e6c7a,_0x3a5db2){if(_0x502379['autoAssociation']===null||_0x502379[_0xa508('0x52')]===0x1)_0x5e6c7a(null);return db[_0xa508('0x53')]['findAll']({'where':{'sectionId':_0x502379['id']},'raw':!![]})[_0xa508('0x26')](function(_0x130937){var _0x23bc53=_[_0xa508('0x2e')](_0x130937,function(_0x345f85){return qs[_0xa508('0x4b')](_0x345f85,['id',_0xa508('0x4c'),_0xa508('0x4e'),_0xa508('0x54')]);});_0x5e6c7a(_0x23bc53);})[_0xa508('0x46')](function(_0x177b2e){_0x3a5db2(_0x177b2e);});})[_0xa508('0x26')](function(_0x27d88b){var _0x1d1935=qs[_0xa508('0x4b')](_0x502379,['id',_0xa508('0x4c'),_0xa508('0x4e')]);_0x1d1935[_0xa508('0x55')]=_0x1ac43d['id'];if(_0x27d88b)_0x1d1935[_0xa508('0x56')]=_0x27d88b;return _0x1d1935;})[_0xa508('0x26')](function(_0x8d2094){return db[_0xa508('0x57')][_0xa508('0x47')](_0x8d2094,{'include':[{'model':db[_0xa508('0x53')],'as':'Resources'}],'raw':!![],'transaction':_0x565130});});})[_0xa508('0x26')](function(){return _0x1ac43d;});}});});});}})[_0xa508('0x26')](respondWithResult(_0x3d99ee,0xc9))[_0xa508('0x46')](handleError(_0x3d99ee,null));};exports[_0xa508('0x58')]=function(_0x1b4977,_0x39d4d3){if(_0x1b4977[_0xa508('0x48')]['id']){delete _0x1b4977[_0xa508('0x48')]['id'];}return db['UserProfile'][_0xa508('0x45')]({'where':{'id':_0x1b4977[_0xa508('0x43')]['id']}})[_0xa508('0x26')](handleEntityNotFound(_0x39d4d3,null))[_0xa508('0x26')](saveUpdates(_0x1b4977[_0xa508('0x48')],null))[_0xa508('0x26')](respondWithResult(_0x39d4d3,null))[_0xa508('0x46')](handleError(_0x39d4d3,null));};exports[_0xa508('0x27')]=function(_0x4be39d,_0x29d12f){return db[_0xa508('0x2b')][_0xa508('0x45')]({'where':{'id':_0x4be39d[_0xa508('0x43')]['id']}})['then'](handleEntityNotFound(_0x29d12f,null))[_0xa508('0x26')](removeEntity(_0x29d12f,null))[_0xa508('0x46')](handleError(_0x29d12f,null));};exports['describe']=function(_0x178b4b,_0x50fb05){return db[_0xa508('0x2b')][_0xa508('0x59')]()['then'](respondWithResult(_0x50fb05,null))[_0xa508('0x46')](handleError(_0x50fb05,null));};exports['addSections']=function(_0x6a74cc,_0x2c67dc){var _0x19da1c=_0x6a74cc[_0xa508('0x48')];return db[_0xa508('0x2b')][_0xa508('0x45')]({'where':{'id':_0x6a74cc[_0xa508('0x43')]['id']}})[_0xa508('0x26')](handleEntityNotFound(_0x2c67dc,null))[_0xa508('0x26')](function(_0x5c9548){if(_0x5c9548){return db[_0xa508('0x4f')]['transaction'](function(_0x5662ba){return db[_0xa508('0x57')][_0xa508('0x27')]({'where':{'userProfileId':_0x6a74cc[_0xa508('0x43')]['id'],'sectionId':_[_0xa508('0x2e')](_0x19da1c,function(_0x4ea10f){return _0x4ea10f[_0xa508('0x54')];})},'transaction':_0x5662ba})[_0xa508('0x26')](function(){var _0x5cdbc8=_[_0xa508('0x2e')](_0x19da1c,function(_0x589383){_0x589383[_0xa508('0x55')]=_0x6a74cc[_0xa508('0x43')]['id'];return _0x589383;});var _0x95ae66=[];return BPromise[_0xa508('0x51')](_0x5cdbc8,function(_0x384ab7){return db['UserProfileSection'][_0xa508('0x47')](_0x384ab7,{'include':[{'model':db[_0xa508('0x53')],'as':'Resources'}],'raw':!![],'transaction':_0x5662ba})[_0xa508('0x26')](function(_0x270cb8){_0x95ae66[_0xa508('0x5a')](_0x270cb8[_0xa508('0x4a')]({'plain':!![]}));});})['then'](function(){return _0x95ae66;});});});}})[_0xa508('0x26')](function(_0x5c89e6){return _0x5c89e6;})[_0xa508('0x26')](respondWithResult(_0x2c67dc,null))[_0xa508('0x46')](handleError(_0x2c67dc,null));};exports[_0xa508('0x5b')]=function(_0x436eb1,_0x2df27f){var _0x1d3c43;return db[_0xa508('0x2b')][_0xa508('0x45')]({'where':{'id':_0x436eb1['params']['id']},'attributes':['id',_0xa508('0x29')]})[_0xa508('0x26')](handleEntityNotFound(_0x2df27f,null))['then'](function(_0x56dd3e){if(_0x56dd3e){_0x1d3c43=_0x56dd3e;return db[_0xa508('0x57')]['destroy']({'where':{'userProfileId':_0x436eb1[_0xa508('0x43')]['id'],'sectionId':_0x436eb1[_0xa508('0x2f')][_0xa508('0x5c')]}});}})['then'](function(){return _0x1d3c43;})[_0xa508('0x26')](respondWithStatusCode(_0x2df27f,null))[_0xa508('0x46')](handleError(_0x2df27f,null));};exports[_0xa508('0x5d')]=function(_0x2d01b7,_0x12bb96){var _0x418131=[];var _0x16de8c=[];return db[_0xa508('0x57')][_0xa508('0x41')]({'where':{'userProfileId':_0x2d01b7[_0xa508('0x43')]['id']},'raw':!![]})[_0xa508('0x26')](function(_0x1539e1){_0x418131=_['filter'](_0x1539e1,function(_0x3240f4){return _0x3240f4[_0xa508('0x5e')]===0x1||_['includes']([0x3eb,0x709],_0x3240f4[_0xa508('0x54')]);});if(!_[_0xa508('0x5f')](_0x418131)){return _[_0xa508('0x2e')](_0x418131,function(_0xd5ffbe){return _0xd5ffbe[_0xa508('0x54')];});}else{return;}})['then'](function(_0x43bd5a){if(_0x43bd5a)_0x16de8c=_0x43bd5a;if(_['includes'](_0x16de8c,0x64)){var _0x467505=_[_0xa508('0x45')](_0x418131,{'sectionId':0x64});return hasDefaultDashboard(_0x467505)[_0xa508('0x26')](function(_0x3e6a56){return _['map'](_0x418131,function(_0x2e9f33){if(_0x2e9f33[_0xa508('0x54')]===0x64){_0x2e9f33[_0xa508('0x60')]=_0x3e6a56;}return _0x2e9f33;});});}else{return;}})[_0xa508('0x26')](function(_0x4b8740){if(_0x4b8740)_0x418131=_0x4b8740;if(_[_0xa508('0x61')](_0x16de8c,0x3eb)){var _0x4258f4=_[_0xa508('0x45')](_0x418131,{'sectionId':0x3eb});return getCustomDashboards(_0x4258f4)[_0xa508('0x26')](function(_0x47f382){return _[_0xa508('0x2e')](_0x418131,function(_0x5a6adc){if(_0x4258f4[_0xa508('0x5e')]){if(_0x5a6adc[_0xa508('0x54')]===0x3eb){_0x5a6adc[_0xa508('0x60')]=_0x47f382;}}else{if(_0x5a6adc[_0xa508('0x54')]===0x64){_0x5a6adc[_0xa508('0x60')]=_0x47f382;}}return _0x5a6adc;});});}else{return;}})[_0xa508('0x26')](function(_0x24d45d){if(_0x24d45d)_0x418131=_0x24d45d;if(_['includes'](_0x16de8c,0x709)){var _0x20e03a=_[_0xa508('0x45')](_0x418131,{'sectionId':0x709});return getPlugins(_0x20e03a)[_0xa508('0x26')](function(_0x477844){if(_0x20e03a[_0xa508('0x5e')]){return _['map'](_0x418131,function(_0x25beb2){if(_0x25beb2['sectionId']===0x709){_0x25beb2[_0xa508('0x60')]=_0x477844;}return _0x25beb2;});}else{var _0x2bea1d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x477844};var _0x2e4c5f=_[_0xa508('0x2e')](_0x418131);_0x2e4c5f[_0xa508('0x5a')](_0x2bea1d);return _0x2e4c5f;}});}else{return;}})[_0xa508('0x26')](function(_0x31ce33){if(_0x31ce33)_0x418131=_0x31ce33;return _[_0xa508('0x3a')](_0x418131,[_0xa508('0x5e'),0x1]);})[_0xa508('0x26')](respondWithResult(_0x12bb96,null))[_0xa508('0x46')](handleError(_0x12bb96,null));};function hasDefaultDashboard(_0x3b4f48){var _0x5056b2=[0x65];return new BPromise(function(_0x5a448e,_0x2f6a5f){try{if(_0x3b4f48[_0xa508('0x52')]){_0x5a448e(_0x5056b2);}else{return db[_0xa508('0x53')][_0xa508('0x62')]({'where':{'sectionId':_0x3b4f48['id']},'raw':!![]})[_0xa508('0x26')](function(_0xde2efa){_0xde2efa?_0x5a448e(_0x5056b2):_0x5a448e();});}}catch(_0x352105){_0x2f6a5f(_0x352105);}});}function getCustomDashboards(_0x530f34){var _0x44d56e=[];return new BPromise(function(_0x59b2e5,_0x1badb1){try{if(_0x530f34[_0xa508('0x52')]){return db[_0xa508('0x63')]['findAll']({'raw':!![]})[_0xa508('0x26')](function(_0x229e56){_0x229e56[_0xa508('0x64')](function(_0x5a3f44){_0x44d56e[_0xa508('0x5a')](_0x5a3f44['id']+0x1869f);});_0x59b2e5(_0x44d56e);});}else{return db[_0xa508('0x53')][_0xa508('0x41')]({'where':{'sectionId':_0x530f34['id']},'raw':!![]})[_0xa508('0x26')](function(_0x2b86f5){_0x2b86f5['forEach'](function(_0x4db84b){_0x44d56e[_0xa508('0x5a')](_0x4db84b[_0xa508('0x65')]+0x1869f);});_0x59b2e5(_0x44d56e);});}}catch(_0x193d65){_0x1badb1(_0x193d65);}});}function getPlugins(_0x5550ec){var _0x230568=[];return new BPromise(function(_0x335992,_0x40642a){try{if(_0x5550ec[_0xa508('0x52')]){return db[_0xa508('0x66')][_0xa508('0x41')]({'raw':!![]})[_0xa508('0x26')](function(_0x2a674f){_0x2a674f[_0xa508('0x64')](function(_0x305ee0){_0x230568[_0xa508('0x5a')](_0x305ee0['id']+0x15b38);});_0x335992(_0x230568);});}else{return db[_0xa508('0x53')][_0xa508('0x41')]({'where':{'sectionId':_0x5550ec['id']},'raw':!![]})[_0xa508('0x26')](function(_0xe3f114){_0xe3f114[_0xa508('0x64')](function(_0x12f395){_0x230568[_0xa508('0x5a')](_0x12f395[_0xa508('0x65')]+0x15b38);});_0x335992(_0x230568);});}}catch(_0x2c5275){_0x40642a(_0x2c5275);}});}exports[_0xa508('0x67')]=function(_0x25d3ea,_0x4d237c){return db[_0xa508('0x2b')][_0xa508('0x45')]({'where':{'id':_0x25d3ea['params']['id']}})['then'](handleEntityNotFound(_0x4d237c,null))['then'](function(_0x51caf5){if(_0x51caf5){return db['sequelize'][_0xa508('0x50')](function(_0x1e55a4){return db[_0xa508('0x57')]['findAll']({'where':{'userProfileId':_0x25d3ea[_0xa508('0x43')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x1d2fe9){if(_0x1d2fe9){return db[_0xa508('0x57')][_0xa508('0x27')]({'where':{'userProfileId':_0x25d3ea[_0xa508('0x43')]['id'],'id':_['map'](_0x1d2fe9,function(_0x1aab5f){return _0x1aab5f['id'];})},'transaction':_0x1e55a4});}})[_0xa508('0x26')](function(_0x46c441){var _0x83130=_[_0xa508('0x2e')](_0x25d3ea[_0xa508('0x48')],function(_0xa0d7e5){_0xa0d7e5[_0xa508('0x55')]=_0x25d3ea[_0xa508('0x43')]['id'];return _0xa0d7e5;});return db[_0xa508('0x57')][_0xa508('0x68')](_0x83130,{'raw':!![],'transaction':_0x1e55a4});})[_0xa508('0x26')](function(_0x5be6da){var _0xca67cb=_[_0xa508('0x3a')](_[_0xa508('0x2e')](_0x5be6da,function(_0x11ff05){return _0x11ff05['get']({'plain':!![]});}),{'includeAll':![]});if(_0xca67cb){return db[_0xa508('0x57')][_0xa508('0x41')]({'where':{'userProfileId':_0x25d3ea[_0xa508('0x43')]['id'],'sectionId':_[_0xa508('0x2e')](_0xca67cb,function(_0x45bf97){return _0x45bf97[_0xa508('0x54')];})},'attributes':['id',_0xa508('0x54')],'raw':!![]})[_0xa508('0x26')](function(_0x694ba4){var _0x18a62f=_[_0xa508('0x2e')](_0x25d3ea['body'],function(_0x2b8d29){_0x2b8d29[_0xa508('0x55')]=_0x25d3ea[_0xa508('0x43')]['id'];return _0x2b8d29;});return db[_0xa508('0x53')][_0xa508('0x68')](_0x18a62f,{'raw':!![],'transaction':_0x1e55a4});});}})[_0xa508('0x46')](handleError(_0x4d237c,null));});}})[_0xa508('0x26')](function(_0x21dd8a){var _0x127645=_[_0xa508('0x2e')](_0x21dd8a,function(_0x43f78a){return _0x43f78a['get']({'plain':!![]});});})[_0xa508('0x26')](respondWithResult(_0x4d237c,null))[_0xa508('0x46')](handleError(_0x4d237c,null));};exports[_0xa508('0x69')]=function(_0x23f4a7,_0x9548f5,_0x1a4026){return db[_0xa508('0x2b')]['find']({'where':{'id':_0x23f4a7[_0xa508('0x43')]['id']}})[_0xa508('0x26')](handleEntityNotFound(_0x9548f5,null))[_0xa508('0x26')](function(_0x5685d9){if(_0x5685d9){return _0x5685d9[_0xa508('0x69')](_0x23f4a7[_0xa508('0x2f')]['ids']);}})[_0xa508('0x26')](respondWithStatusCode(_0x9548f5,null))[_0xa508('0x46')](handleError(_0x9548f5,null));};exports[_0xa508('0x6a')]=function(_0x551851,_0x470720){var _0xa310f4={};if(!_0x551851['query']['section'])throw new Error(_0xa508('0x6b'));if(!_0x551851[_0xa508('0x2f')]['hasOwnProperty']('nolimit')){_0xa310f4['limit']=qs['limit'](_0x551851['query'][_0xa508('0x21')]);_0xa310f4[_0xa508('0x1f')]=qs[_0xa508('0x1f')](_0x551851[_0xa508('0x2f')]['offset']);}return db[_0xa508('0x2b')][_0xa508('0x45')]({'where':{'id':_0x551851[_0xa508('0x43')]['id']}})[_0xa508('0x26')](function(_0x19d6ca){if(!_0x19d6ca)throw new Error(_0xa508('0x6c')+_0x551851['params']['id']);return db['UserProfile'][_0xa508('0x6a')](_0x551851);})[_0xa508('0x26')](respondWithFilteredResult(_0x470720,_0xa310f4))[_0xa508('0x46')](handleError(_0x470720,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index bf19574..e2bf459 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 _0x4325=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x5432('0x0'));var UserProfile=require(_0x5432('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x5432('0x2')](0x0);var events={'afterCreate':_0x5432('0x3'),'afterUpdate':_0x5432('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4fc4e9){return function(_0x20f704,_0x36ce53,_0xad26e9){UserProfileEvents['emit'](_0x4fc4e9+':'+_0x20f704['id'],_0x20f704);UserProfileEvents[_0x5432('0x5')](_0x4fc4e9,_0x20f704);_0xad26e9(null);};}for(var e in events){if(events[_0x5432('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x5432('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x7e4b=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x15a28e,_0xff9f7f){var _0x3fbf39=function(_0x36b50a){while(--_0x36b50a){_0x15a28e['push'](_0x15a28e['shift']());}};_0x3fbf39(++_0xff9f7f);}(_0x7e4b,0x84));var _0xb7e4=function(_0x51a192,_0x56cce7){_0x51a192=_0x51a192-0x0;var _0x12a9fc=_0x7e4b[_0x51a192];return _0x12a9fc;};'use strict';var EventEmitter=require(_0xb7e4('0x0'));var UserProfile=require(_0xb7e4('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb7e4('0x2')](0x0);var events={'afterCreate':_0xb7e4('0x3'),'afterUpdate':'update','afterDestroy':_0xb7e4('0x4')};function emitEvent(_0x1d32fd){return function(_0x2fca1d,_0x32f781,_0xb51013){UserProfileEvents[_0xb7e4('0x5')](_0x1d32fd+':'+_0x2fca1d['id'],_0x2fca1d);UserProfileEvents[_0xb7e4('0x5')](_0x1d32fd,_0x2fca1d);_0xb51013(null);};}for(var e in events){if(events[_0xb7e4('0x6')](e)){var event=events[e];UserProfile[_0xb7e4('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 5f1a070..85f49d0 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 _0xbc8e=['reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','model','length','rawAttributes','keys','filters','attributes','fields','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','includeAll','forEach','reportType','default','DefaultReports','CustomReports','count','rows','include','Tags','color','tag','ThroughTags','openTabs','true','dataValues','sms','mail','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','associatedResources','map','catch','then','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','User','agent','role','telephone','VoiceQueue','type','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','users','agents','admin','user','Agents','Telephones','ZendeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','Pause','Schedule','sounds','Sound','tags','Tag','Template','triggers','trunks','variables','Variable','plugins','Plugin','extractedreports'];(function(_0x3bfb4e,_0x3b2862){var _0x74bd8e=function(_0xddc39c){while(--_0xddc39c){_0x3bfb4e['push'](_0x3bfb4e['shift']());}};_0x74bd8e(++_0x3b2862);}(_0xbc8e,0x1bf));var _0xebc8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbc8e[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xebc8('0x0'));var attributes=require(_0xebc8('0x1'));var qs=require(_0xebc8('0x2'));var squel=require(_0xebc8('0x3'));module[_0xebc8('0x4')]=function(_0x54efc2){var _0x397e2c=_0x54efc2[_0xebc8('0x5')];function _0x42b6dc(_0x54a7c0,_0x172a41){return new Promise(function(_0x525627,_0x9c3017){if(!_0x172a41)return _0x525627(null);var _0x171194=_0x172a41[_0xebc8('0x6')]?{[_0x172a41[_0xebc8('0x6')][_0xebc8('0x7')]]:_0x172a41['filter'][_0xebc8('0x8')]}:undefined;return _0x397e2c[_0x54a7c0][_0xebc8('0x9')]({'where':_0x171194,'raw':!![]})['then'](function(_0x586e51){_0x172a41[_0xebc8('0xa')]=_[_0xebc8('0xb')](_0x586e51,'id');_0x525627(_0x172a41);})[_0xebc8('0xc')](function(_0x22f1f0){_0x9c3017(_0x22f1f0);});});}function _0x517425(_0x364564,_0x2c6ba1){return new Promise(function(_0x232d6b,_0xb3c1b9){var _0x216dd=_0x364564[_0xebc8('0x6')]?{[_0x364564[_0xebc8('0x6')][_0xebc8('0x7')]]:_0x364564['filter']['value']}:undefined;return _0x397e2c[_0x364564['model']][_0xebc8('0x9')]({'where':_0x216dd,'raw':!![]})[_0xebc8('0xd')](function(_0x11a4c7){_0x2c6ba1[_0xebc8('0xa')]=_['map'](_0x11a4c7,function(_0x3b40a3){return _0x3b40a3['name'];});_0x232d6b(_0x2c6ba1);})['catch'](function(_0x5b476c){_0xb3c1b9(_0x5b476c);});});}function _0x3dcd98(_0xbd0663,_0xcbb01f,_0x3771cb){if(!_0xcbb01f)return Promise[_0xebc8('0xe')](null);return new Promise(function(_0x16cbb1,_0x53213b){return _0x397e2c[_0xebc8('0xf')]['findAll']({'where':{'sectionId':_0xcbb01f['id']},'raw':!![]})['then'](function(_0x346bb0){if(_0xbd0663[_0xebc8('0x7')]&&_0xbd0663[_0xebc8('0x7')]!=='id'){_0xcbb01f['associatedResources']=_[_0xebc8('0xb')](_0x346bb0,function(_0x4e6759){return _0x4e6759[_0xbd0663['field']];});}else{if(_0x3771cb===_0xebc8('0x10')){_0xcbb01f[_0xebc8('0xa')]=_[_0xebc8('0xb')](_0x346bb0,function(_0x10f91d){return{'id':_0x10f91d[_0xebc8('0x11')],'type':_0x10f91d['type']};});}else{_0xcbb01f[_0xebc8('0xa')]=_[_0xebc8('0xb')](_0x346bb0,function(_0x3124e6){return _0x3124e6['resourceId'];});}}_0x16cbb1(_0xcbb01f);})[_0xebc8('0xc')](function(_0x77db6a){_0x53213b(_0x77db6a);});});}function _0x30928c(_0x2fe537,_0x18d9e5){var _0x213ace={'parentSections':[]};switch(_0x2fe537[_0xebc8('0x12')]()){case _0xebc8('0x13'):_0x213ace[_0xebc8('0x14')]='SquareProject';break;case _0xebc8('0x15'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x16');break;case'squarerecordings':_0x213ace[_0xebc8('0x14')]=_0xebc8('0x17');_0x213ace[_0xebc8('0x18')]=[{'name':_0xebc8('0x19'),'field':_0xebc8('0x1a'),'foreignKey':_0xebc8('0x1b')}];break;case _0xebc8('0x1c'):_0x213ace['childModel']=_0xebc8('0x1d');break;case _0xebc8('0x1e'):_0x213ace[_0xebc8('0x14')]='CmContact';_0x213ace[_0xebc8('0x18')]=[{'name':_0xebc8('0x1f'),'field':'id','foreignKey':_0xebc8('0x20')}];break;case _0xebc8('0x21'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x22');break;case _0xebc8('0x23'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x24');break;case _0xebc8('0x25'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x26');break;case _0xebc8('0x27'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x28');break;case _0xebc8('0x29'):_0x213ace['childModel']=_0xebc8('0x2a');break;case _0xebc8('0x2b'):_0x213ace['childModel']=_0xebc8('0x2c');break;case'faxaccounts':_0x213ace[_0xebc8('0x14')]=_0xebc8('0x2d');break;case _0xebc8('0x2e'):case _0xebc8('0x2f'):case _0xebc8('0x30'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x31');break;case _0xebc8('0x32'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x33');break;case _0xebc8('0x34'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x35');break;case'voicerecordings':_0x213ace['childModel']=_0xebc8('0x36');_0x213ace[_0xebc8('0x18')]=[{'name':'Agents','field':'name','foreignKey':'membername','model':_0xebc8('0x37'),'filter':{'field':'role','value':[_0xebc8('0x38')]}},{'name':'Telephones','field':_0xebc8('0x1a'),'foreignKey':'membername','model':_0xebc8('0x37'),'filter':{'field':_0xebc8('0x39'),'value':[_0xebc8('0x3a')]}},{'name':'VoiceQueues','field':_0xebc8('0x1a'),'foreignKey':'queue','model':_0xebc8('0x3b'),'filter':{'field':_0xebc8('0x3c'),'value':['inbound']}},{'name':_0xebc8('0x3d'),'field':_0xebc8('0x1a'),'foreignKey':_0xebc8('0x3e'),'model':_0xebc8('0x3b'),'filter':{'field':'type','value':[_0xebc8('0x3f')]}}];break;case _0xebc8('0x40'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x41');break;case _0xebc8('0x42'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x43');break;case _0xebc8('0x44'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x45');break;case _0xebc8('0x46'):_0x213ace[_0xebc8('0x14')]='Campaign';break;case'mailqueues':_0x213ace[_0xebc8('0x14')]=_0xebc8('0x47');break;case _0xebc8('0x48'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x49');break;case _0xebc8('0x4a'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x4b');break;case _0xebc8('0x4c'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x4d');break;case _0xebc8('0x4e'):_0x213ace[_0xebc8('0x14')]='OpenchannelAccount';break;case _0xebc8('0x4f'):_0x213ace['childModel']=_0xebc8('0x50');break;case _0xebc8('0x51'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x52');break;case _0xebc8('0x53'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x54');break;case _0xebc8('0x55'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x56');break;case'teams':_0x213ace[_0xebc8('0x14')]=_0xebc8('0x57');break;case _0xebc8('0x58'):case _0xebc8('0x59'):_0x213ace['childModel']=_0xebc8('0x3b');if(_0x18d9e5){_0x213ace['parentSections']=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0xebc8('0x5a'):case _0xebc8('0x5b'):case'telephones':_0x213ace[_0xebc8('0x14')]=_0xebc8('0x37');if(_0x18d9e5){_0x213ace[_0xebc8('0x18')]=[{'name':'Users','filter':{'field':'role','value':[_0xebc8('0x5c'),_0xebc8('0x5d')]},'ignore':!![]},{'name':_0xebc8('0x5e')},{'name':_0xebc8('0x5f')}];}break;case'zendeskaccounts':_0x213ace[_0xebc8('0x14')]=_0xebc8('0x60');break;case'salesforceaccounts':_0x213ace[_0xebc8('0x14')]='SalesforceAccount';break;case'freshdeskaccounts':_0x213ace['childModel']='FreshdeskAccount';break;case _0xebc8('0x61'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x62');break;case'deskaccounts':_0x213ace['childModel']=_0xebc8('0x63');break;case _0xebc8('0x64'):_0x213ace[_0xebc8('0x14')]='ZohoAccount';break;case _0xebc8('0x65'):_0x213ace['childModel']=_0xebc8('0x37');break;case _0xebc8('0x66'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x67');break;case _0xebc8('0x68'):_0x213ace['childModel']=_0xebc8('0x69');break;case _0xebc8('0x6a'):_0x213ace[_0xebc8('0x14')]='Dashboard';break;case _0xebc8('0x6b'):_0x213ace['childModel']=_0xebc8('0x6c');break;case'pauses':_0x213ace['childModel']=_0xebc8('0x6d');break;case'scheduler':_0x213ace[_0xebc8('0x14')]=_0xebc8('0x6e');break;case _0xebc8('0x6f'):_0x213ace['childModel']=_0xebc8('0x70');break;case _0xebc8('0x71'):_0x213ace['childModel']=_0xebc8('0x72');break;case'templates':_0x213ace[_0xebc8('0x14')]=_0xebc8('0x73');break;case _0xebc8('0x74'):_0x213ace[_0xebc8('0x14')]='Trigger';break;case _0xebc8('0x75'):_0x213ace[_0xebc8('0x14')]='Trunk';break;case _0xebc8('0x76'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x77');break;case _0xebc8('0x78'):_0x213ace[_0xebc8('0x14')]=_0xebc8('0x79');break;case _0xebc8('0x7a'):_0x213ace['childModel']=_0xebc8('0x10');_0x213ace[_0xebc8('0x18')]=[{'name':'Reports','field':'id','foreignKey':_0xebc8('0x7b')}];break;case'metrics':_0x213ace[_0xebc8('0x14')]=_0xebc8('0x7c');break;}return _0x213ace;}function _0x90b571(_0x42ce95,_0x15e199){var _0x101c04=_0x42ce95[_0xebc8('0x7d')](0x0)[_0xebc8('0x7e')]()+_0x42ce95[_0xebc8('0x7f')](0x1);var _0x102a76={'type':_0x397e2c[_0xebc8('0x80')][_0xebc8('0x81')][_0xebc8('0x82')],'raw':!![]};return new Promise(function(_0xa3e665,_0x415135){var _0x252ebf=squel[_0xebc8('0x83')]()['field']('ui.'+_0x101c04+_0xebc8('0x84'),'id')[_0xebc8('0x7')](_0xebc8('0x85'))[_0xebc8('0x86')](_0xebc8('0x87')+_0x42ce95+'_interactions','ui')[_0xebc8('0x88')](_0xebc8('0x89'),_0x15e199['id']);return _0x397e2c['sequelize'][_0xebc8('0x8a')](_0x252ebf[_0xebc8('0x8b')](),_0x102a76)[_0xebc8('0xd')](function(_0x5865ed){_0x15e199[_0x101c04+_0xebc8('0x8c')]=_0x5865ed;_0xa3e665(_0x5865ed);})[_0xebc8('0xc')](function(_0x27197e){_0x415135(_0x27197e);});});}return _0x54efc2[_0xebc8('0x8d')](_0xebc8('0x8e'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2ed951){var _0x3c9f2e={'raw':_0x2ed951[_0xebc8('0x8a')][_0xebc8('0x8f')],'where':{}};var _0x53c802={};var _0x29a09b={'count':0x0,'rows':[]};var _0x551eb7=_0x2ed951[_0xebc8('0x8a')]['section'];var _0x39f073=_0x2ed951[_0xebc8('0x8a')][_0xebc8('0x90')]||![];var _0x3d3d95=_0x30928c(_0x551eb7,_0x39f073);if(!_0x3d3d95[_0xebc8('0x14')])throw new Error(_0xebc8('0x91')+_0x551eb7+'\x27');var _0x175b18=[{'name':_0x551eb7}];if(!_[_0xebc8('0x92')](_0x3d3d95[_0xebc8('0x18')]))_0x175b18=_0x3d3d95[_0xebc8('0x18')];var _0x4f73b7=[];for(var _0x4f0f05=0x0;_0x4f0f05<_0x175b18['length'];_0x4f0f05++){_0x4f73b7[_0xebc8('0x93')](_0x397e2c[_0xebc8('0x94')][_0xebc8('0x95')]({'where':{'userProfileId':_0x2ed951[_0xebc8('0x96')]['id'],'name':_0x175b18[_0x4f0f05][_0xebc8('0x1a')]},'raw':!![]}));}return Promise[_0xebc8('0x97')](_0x4f73b7)[_0xebc8('0xd')](function(_0x218dd2){var _0x54e6ba=_[_0xebc8('0x6')](_0x218dd2,function(_0x1971c2){return _0x1971c2?_0x1971c2:undefined;});var _0x5e3137=_[_0xebc8('0x6')](_0x175b18,[_0xebc8('0x98'),!![]]);var _0x20edd1=_[_0xebc8('0x92')](_0x54e6ba)&&_[_0xebc8('0x92')](_0x5e3137)?null:_[_0xebc8('0x99')](_0x5e3137,_0x54e6ba);if(!_0x20edd1)return null;var _0x5caab3=[];for(var _0x4f7b0b=0x0;_0x4f7b0b<_0x20edd1['length'];_0x4f7b0b++){var _0x14bff5=_[_0xebc8('0x95')](_0x175b18,function(_0x19222b){return _0x20edd1[_0x4f7b0b]?_0x19222b['name']===_0x20edd1[_0x4f7b0b]['name']:null;});if(_0x14bff5){if(_0x20edd1[_0x4f7b0b][_0xebc8('0x98')]){_0x5caab3[_0xebc8('0x93')](_0x42b6dc(_0x3d3d95[_0xebc8('0x14')],_0x20edd1[_0x4f7b0b]));}else{if(!_0x20edd1[_0x4f7b0b][_0xebc8('0x9a')]){_0x5caab3[_0xebc8('0x93')](_0x3dcd98(_0x14bff5,_0x20edd1[_0x4f7b0b],_0x3d3d95[_0xebc8('0x14')]));}else{if(_0x14bff5[_0xebc8('0x9b')]){_0x5caab3[_0xebc8('0x93')](_0x517425(_0x14bff5,_0x20edd1[_0x4f7b0b]));}}}}}return Promise['all'](_0x5caab3);})[_0xebc8('0xd')](function(_0x48af64){var _0x1bb785=_0x48af64;var _0x28af82=null;if(_0x1bb785){_0x28af82=_0x1bb785[_0xebc8('0x9c')]===0x1?_0x1bb785[0x0]:null;}if(!_0x28af82&&!_0x1bb785)return _0x29a09b;var _0x1e32fe=_0x397e2c[_0x3d3d95['childModel']][_0xebc8('0x9d')];_0x53c802['model']=_['keys'](_0x1e32fe);_0x53c802[_0xebc8('0x8a')]=_[_0xebc8('0x9e')](_0x2ed951[_0xebc8('0x8a')]);_0x53c802[_0xebc8('0x9f')]=_['intersection'](_0x53c802[_0xebc8('0x9b')],_0x53c802['query']);_0x3c9f2e[_0xebc8('0xa0')]=_['intersection'](_0x53c802['model'],qs[_0xebc8('0xa1')](_0x2ed951[_0xebc8('0x8a')][_0xebc8('0xa1')]));_0x3c9f2e[_0xebc8('0xa0')]=_0x3c9f2e[_0xebc8('0xa0')][_0xebc8('0x9c')]?_0x3c9f2e[_0xebc8('0xa0')]:_0x53c802[_0xebc8('0x9b')];if(!_0x2ed951[_0xebc8('0x8a')]['hasOwnProperty'](_0xebc8('0xa2'))){_0x3c9f2e[_0xebc8('0xa3')]=qs['limit'](_0x2ed951[_0xebc8('0x8a')][_0xebc8('0xa3')]);_0x3c9f2e['offset']=qs[_0xebc8('0xa4')](_0x2ed951[_0xebc8('0x8a')][_0xebc8('0xa4')]);}_0x3c9f2e[_0xebc8('0xa5')]=qs[_0xebc8('0xa6')](_0x2ed951[_0xebc8('0x8a')][_0xebc8('0xa6')]);_0x3c9f2e['where']=qs['filters'](_[_0xebc8('0xa7')](_0x2ed951['query'],_0x53c802[_0xebc8('0x9f')]));if(_0x2ed951[_0xebc8('0x8a')]['filter']){_0x3c9f2e['where']=_[_0xebc8('0xa8')](_0x3c9f2e[_0xebc8('0x88')],{'$or':_[_0xebc8('0xb')](_0x1e32fe,function(_0x15159e){if(_0x15159e[_0xebc8('0x3c')][_0xebc8('0xa9')]!==_0xebc8('0xaa')){var _0x49c5a8={};_0x49c5a8[_0x15159e['field']]={'$like':'%'+_0x2ed951['query'][_0xebc8('0x6')]+'%'};return _0x49c5a8;}})});}var _0x39d375=[];var _0x3575dc=null;var _0x388358={};if(_0x28af82){_0x3575dc=_['find'](_0x175b18,[_0xebc8('0x1a'),_0x28af82[_0xebc8('0x1a')]]);if(_0x3575dc[_0xebc8('0x7')]){_0x388358={};if(_0x3d3d95[_0xebc8('0x14')]===_0xebc8('0x10')){_0x388358[_0x3575dc[_0xebc8('0xab')]]=_[_0xebc8('0xb')](_0x28af82['associatedResources'],'id');}else{_0x388358[_0x3575dc['foreignKey']]=_0x28af82[_0xebc8('0xa')];}_0x39d375[_0xebc8('0x93')](_0x388358);}else{_0x3c9f2e['where']['id']=_0x28af82['associatedResources'];}}else{for(var _0x3ec44c=0x0;_0x3ec44c<_0x1bb785[_0xebc8('0x9c')];_0x3ec44c++){_0x3575dc=_['find'](_0x175b18,[_0xebc8('0x1a'),_0x1bb785[_0x3ec44c][_0xebc8('0x1a')]]);if(_0x3575dc[_0xebc8('0x7')]){_0x388358={};_0x388358[_0x3575dc[_0xebc8('0xab')]]=_0x1bb785[_0x3ec44c][_0xebc8('0xa')];_0x39d375[_0xebc8('0x93')](_0x388358);}else{if(!_0x3c9f2e[_0xebc8('0x88')]['id'])_0x3c9f2e[_0xebc8('0x88')]['id']=[];_0x1bb785[_0x3ec44c]['associatedResources']['forEach'](function(_0x1dbc32){_0x3c9f2e[_0xebc8('0x88')]['id'][_0xebc8('0x93')](_0x1dbc32);});}}}if(!_[_0xebc8('0x92')](_0x39d375)){_0x3c9f2e['where']=_['merge'](_0x3c9f2e[_0xebc8('0x88')],{'$and':{'$or':_0x39d375}});}_0x3c9f2e=_['merge']({},_0x3c9f2e,_0x2ed951['options']);if(_0x28af82&&!_0x28af82[_0xebc8('0x9a')]&&_0x3d3d95[_0xebc8('0x14')]===_0xebc8('0x10')){if(_0x2ed951[_0xebc8('0x8a')][_0xebc8('0xac')]){_0x3c9f2e['include']=[{'all':!![]}];}return _0x397e2c[_0x3d3d95['childModel']][_0xebc8('0x9')](_0x3c9f2e)['then'](function(_0x4ebd9e){var _0x4a4acf=[];_0x4ebd9e[_0xebc8('0xad')](function(_0x197d31){var _0x398cdf;switch(_0x197d31[_0xebc8('0xae')]){case _0xebc8('0xaf'):_0x398cdf=_[_0xebc8('0x95')](_0x28af82[_0xebc8('0xa')],function(_0x391e48){return _0x391e48['id']===_0x197d31[_0xebc8('0x7b')]&&_0x391e48[_0xebc8('0x3c')]===_0xebc8('0xb0');});break;case'custom':_0x398cdf=_[_0xebc8('0x95')](_0x28af82[_0xebc8('0xa')],function(_0x35f261){return _0x35f261['id']===_0x197d31['reportId']&&_0x35f261[_0xebc8('0x3c')]===_0xebc8('0xb1');});break;}if(_0x398cdf)_0x4a4acf[_0xebc8('0x93')](_0x197d31);});_0x29a09b[_0xebc8('0xb2')]=_0x4a4acf[_0xebc8('0x9c')];_0x29a09b[_0xebc8('0xb3')]=_0x4a4acf;return _0x29a09b;});}else{return _0x397e2c[_0x3d3d95[_0xebc8('0x14')]][_0xebc8('0xb2')]({'where':_0x3c9f2e[_0xebc8('0x88')]})['then'](function(_0x6c9de2){_0x29a09b[_0xebc8('0xb2')]=_0x6c9de2;if(_0x2ed951[_0xebc8('0x8a')][_0xebc8('0xac')]){if(_0x3d3d95[_0xebc8('0x14')]==='CmContact'){_0x3c9f2e[_0xebc8('0xb4')]=[{'model':_0x397e2c[_0xebc8('0x72')],'as':_0xebc8('0xb5'),'attributes':['id',_0xebc8('0x1a'),_0xebc8('0xb6')],'required':_0x2ed951[_0xebc8('0x8a')][_0xebc8('0xb7')]?!![]:![]},{'model':_0x397e2c[_0xebc8('0x72')],'as':_0xebc8('0xb8'),'attributes':['id',_0xebc8('0x1a'),_0xebc8('0xb6')],'through':_0x2ed951['query']['tag']?{'attributes':[],'where':{'TagId':_0x2ed951['query']['tag']||undefined}}:{},'required':_0x2ed951[_0xebc8('0x8a')][_0xebc8('0xb7')]?!![]:![]}];}else{_0x3c9f2e[_0xebc8('0xb4')]=[{'all':!![]}];}}return _0x397e2c[_0x3d3d95[_0xebc8('0x14')]]['findAll'](_0x3c9f2e);})[_0xebc8('0xd')](function(_0x1ad067){_0x29a09b[_0xebc8('0xb3')]=_0x1ad067;if(_0x551eb7==='Agents'&&_0x2ed951[_0xebc8('0x8a')][_0xebc8('0xb9')]===_0xebc8('0xba')){var _0x34cea1=[];for(var _0x167801=0x0;_0x167801<_0x29a09b[_0xebc8('0xb3')][_0xebc8('0x9c')];_0x167801++){_0x34cea1[_0xebc8('0x93')](_0x90b571('chat',_0x29a09b[_0xebc8('0xb3')][_0x167801][_0xebc8('0xbb')]));_0x34cea1[_0xebc8('0x93')](_0x90b571(_0xebc8('0xbc'),_0x29a09b[_0xebc8('0xb3')][_0x167801][_0xebc8('0xbb')]));_0x34cea1['push'](_0x90b571('fax',_0x29a09b[_0xebc8('0xb3')][_0x167801]['dataValues']));_0x34cea1['push'](_0x90b571(_0xebc8('0xbd'),_0x29a09b['rows'][_0x167801][_0xebc8('0xbb')]));_0x34cea1[_0xebc8('0x93')](_0x90b571('openchannel',_0x29a09b[_0xebc8('0xb3')][_0x167801]['dataValues']));_0x34cea1[_0xebc8('0x93')](_0x90b571('whatsapp',_0x29a09b[_0xebc8('0xb3')][_0x167801][_0xebc8('0xbb')]));}return Promise[_0xebc8('0x97')](_0x34cea1)[_0xebc8('0xd')](function(){return _0x29a09b;});}return _0x29a09b;});}});}}});}; \ No newline at end of file +var _0x2314=['plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','define','UserProfile','user_profiles','raw','section','mergeResources','isEmpty','length','UserProfileSection','find','params','ignore','autoAssociation','push','all','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','foreignKey','forEach','options','includeAll','include','reportType','DefaultReports','custom','CustomReports','count','rows','Tag','Tags','tag','ThroughTags','color','openTabs','true','chat','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','value','associatedResources','map','catch','model','then','name','resolve','UserProfileResource','findAll','field','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','JscriptyProject','contacts','CmContact','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','agent','Telephones','User','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','Team','queuecampaigns','users','agents','telephones','Users','admin','zendeskaccounts','ZendeskAccount','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','sounds','templates','Template','triggers','Trigger','trunks','Trunk','Variable'];(function(_0x1da341,_0x486bdb){var _0x4eb3da=function(_0x42eeab){while(--_0x42eeab){_0x1da341['push'](_0x1da341['shift']());}};_0x4eb3da(++_0x486bdb);}(_0x2314,0x1d2));var _0x4231=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x2314[_0x4bb145];return _0x4db596;};'use strict';var _=require(_0x4231('0x0'));var attributes=require(_0x4231('0x1'));var qs=require(_0x4231('0x2'));var squel=require(_0x4231('0x3'));module[_0x4231('0x4')]=function(_0x5cc5e4){var _0x2877af=_0x5cc5e4[_0x4231('0x5')];function _0x36d4c8(_0xeba63,_0x327504){return new Promise(function(_0x5d088f,_0x10f94c){if(!_0x327504)return _0x5d088f(null);var _0x528378=_0x327504[_0x4231('0x6')]?{[_0x327504[_0x4231('0x6')]['field']]:_0x327504[_0x4231('0x6')][_0x4231('0x7')]}:undefined;return _0x2877af[_0xeba63]['findAll']({'where':_0x528378,'raw':!![]})['then'](function(_0x8b16ec){_0x327504[_0x4231('0x8')]=_[_0x4231('0x9')](_0x8b16ec,'id');_0x5d088f(_0x327504);})[_0x4231('0xa')](function(_0x52f2e9){_0x10f94c(_0x52f2e9);});});}function _0x3d5038(_0x1c876f,_0x31c2e7){return new Promise(function(_0x52ec31,_0x3fb296){var _0x30ad59=_0x1c876f[_0x4231('0x6')]?{[_0x1c876f[_0x4231('0x6')]['field']]:_0x1c876f[_0x4231('0x6')][_0x4231('0x7')]}:undefined;return _0x2877af[_0x1c876f[_0x4231('0xb')]]['findAll']({'where':_0x30ad59,'raw':!![]})[_0x4231('0xc')](function(_0x59ad1e){_0x31c2e7['associatedResources']=_['map'](_0x59ad1e,function(_0x563a3b){return _0x563a3b[_0x4231('0xd')];});_0x52ec31(_0x31c2e7);})[_0x4231('0xa')](function(_0x5727b6){_0x3fb296(_0x5727b6);});});}function _0x661fdc(_0x5265d3,_0x5460fa,_0x4466f8){if(!_0x5460fa)return Promise[_0x4231('0xe')](null);return new Promise(function(_0x3fbadc,_0x107dcd){return _0x2877af[_0x4231('0xf')][_0x4231('0x10')]({'where':{'sectionId':_0x5460fa['id']},'raw':!![]})[_0x4231('0xc')](function(_0x4a846d){if(_0x5265d3['field']&&_0x5265d3['field']!=='id'){_0x5460fa[_0x4231('0x8')]=_[_0x4231('0x9')](_0x4a846d,function(_0xa6171d){return _0xa6171d[_0x5265d3[_0x4231('0x11')]];});}else{if(_0x4466f8===_0x4231('0x12')){_0x5460fa[_0x4231('0x8')]=_['map'](_0x4a846d,function(_0x188463){return{'id':_0x188463[_0x4231('0x13')],'type':_0x188463[_0x4231('0x14')]};});}else{_0x5460fa[_0x4231('0x8')]=_[_0x4231('0x9')](_0x4a846d,function(_0x1f52f9){return _0x1f52f9[_0x4231('0x13')];});}}_0x3fbadc(_0x5460fa);})[_0x4231('0xa')](function(_0x589d77){_0x107dcd(_0x589d77);});});}function _0xb249f7(_0x4e2800,_0x4c0999){var _0x4b86e6={'parentSections':[]};switch(_0x4e2800[_0x4231('0x15')]()){case _0x4231('0x16'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x18');break;case _0x4231('0x19'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x1a');break;case'squarerecordings':_0x4b86e6[_0x4231('0x17')]=_0x4231('0x1b');_0x4b86e6[_0x4231('0x1c')]=[{'name':'SquareProjects','field':_0x4231('0xd'),'foreignKey':'projectName'}];break;case'projects':_0x4b86e6[_0x4231('0x17')]=_0x4231('0x1d');break;case _0x4231('0x1e'):_0x4b86e6['childModel']=_0x4231('0x1f');_0x4b86e6[_0x4231('0x1c')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case'lists':_0x4b86e6[_0x4231('0x17')]='CmList';break;case'companies':_0x4b86e6['childModel']=_0x4231('0x20');break;case _0x4231('0x21'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x22');break;case _0x4231('0x23'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x24');break;case _0x4231('0x25'):_0x4b86e6['childModel']=_0x4231('0x26');break;case'faxqueues':_0x4b86e6[_0x4231('0x17')]=_0x4231('0x27');break;case'faxaccounts':_0x4b86e6[_0x4231('0x17')]='FaxAccount';break;case _0x4231('0x28'):case'internalroutes':case _0x4231('0x29'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x2a');break;case _0x4231('0x2b'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x2c');break;case'voicemails':_0x4b86e6[_0x4231('0x17')]=_0x4231('0x2d');break;case _0x4231('0x2e'):_0x4b86e6['childModel']=_0x4231('0x2f');_0x4b86e6[_0x4231('0x1c')]=[{'name':_0x4231('0x30'),'field':_0x4231('0xd'),'foreignKey':_0x4231('0x31'),'model':'User','filter':{'field':'role','value':[_0x4231('0x32')]}},{'name':_0x4231('0x33'),'field':_0x4231('0xd'),'foreignKey':_0x4231('0x31'),'model':_0x4231('0x34'),'filter':{'field':_0x4231('0x35'),'value':[_0x4231('0x36')]}},{'name':_0x4231('0x37'),'field':_0x4231('0xd'),'foreignKey':_0x4231('0x38'),'model':_0x4231('0x39'),'filter':{'field':'type','value':[_0x4231('0x3a')]}},{'name':_0x4231('0x3b'),'field':_0x4231('0xd'),'foreignKey':_0x4231('0x38'),'model':'VoiceQueue','filter':{'field':_0x4231('0x14'),'value':[_0x4231('0x3c')]}}];break;case'musiconholds':_0x4b86e6['childModel']=_0x4231('0x3d');break;case _0x4231('0x3e'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x3f');break;case _0x4231('0x40'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x41');break;case'ivrcampaigns':_0x4b86e6[_0x4231('0x17')]=_0x4231('0x42');break;case _0x4231('0x43'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x44');break;case _0x4231('0x45'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x46');break;case _0x4231('0x47'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x48');break;case _0x4231('0x49'):_0x4b86e6[_0x4231('0x17')]='OpenchannelQueue';break;case _0x4231('0x4a'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x4b');break;case _0x4231('0x4c'):_0x4b86e6['childModel']=_0x4231('0x4d');break;case _0x4231('0x4e'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x4f');break;case _0x4231('0x50'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x51');break;case _0x4231('0x52'):_0x4b86e6[_0x4231('0x17')]='WhatsappAccount';break;case'teams':_0x4b86e6[_0x4231('0x17')]=_0x4231('0x53');break;case'voicequeues':case _0x4231('0x54'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x39');if(_0x4c0999){_0x4b86e6[_0x4231('0x1c')]=[{'name':_0x4231('0x37')},{'name':'QueueCampaigns'}];}break;case _0x4231('0x55'):case _0x4231('0x56'):case _0x4231('0x57'):_0x4b86e6[_0x4231('0x17')]='User';if(_0x4c0999){_0x4b86e6[_0x4231('0x1c')]=[{'name':_0x4231('0x58'),'filter':{'field':'role','value':[_0x4231('0x59'),'user']},'ignore':!![]},{'name':_0x4231('0x30')},{'name':_0x4231('0x33')}];}break;case _0x4231('0x5a'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x5b');break;case'salesforceaccounts':_0x4b86e6[_0x4231('0x17')]=_0x4231('0x5c');break;case'freshdeskaccounts':_0x4b86e6['childModel']=_0x4231('0x5d');break;case _0x4231('0x5e'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x5f');break;case _0x4231('0x60'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x61');break;case _0x4231('0x62'):_0x4b86e6['childModel']=_0x4231('0x63');break;case _0x4231('0x64'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x34');break;case _0x4231('0x65'):_0x4b86e6['childModel']=_0x4231('0x66');break;case'dispositions':_0x4b86e6['childModel']=_0x4231('0x67');break;case _0x4231('0x68'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x69');break;case _0x4231('0x6a'):_0x4b86e6['childModel']=_0x4231('0x6b');break;case'pauses':_0x4b86e6[_0x4231('0x17')]=_0x4231('0x6c');break;case _0x4231('0x6d'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x6e');break;case _0x4231('0x6f'):_0x4b86e6[_0x4231('0x17')]='Sound';break;case'tags':_0x4b86e6[_0x4231('0x17')]='Tag';break;case _0x4231('0x70'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x71');break;case _0x4231('0x72'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x73');break;case _0x4231('0x74'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x75');break;case'variables':_0x4b86e6['childModel']=_0x4231('0x76');break;case _0x4231('0x77'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x78');break;case _0x4231('0x79'):_0x4b86e6['childModel']='AnalyticExtractedReport';_0x4b86e6[_0x4231('0x1c')]=[{'name':_0x4231('0x7a'),'field':'id','foreignKey':_0x4231('0x7b')}];break;case _0x4231('0x7c'):_0x4b86e6[_0x4231('0x17')]=_0x4231('0x7d');break;}return _0x4b86e6;}function _0x2a695b(_0x464493,_0x17d81f){var _0x207b98=_0x464493[_0x4231('0x7e')](0x0)[_0x4231('0x7f')]()+_0x464493[_0x4231('0x80')](0x1);var _0x3d81b6={'type':_0x2877af[_0x4231('0x81')][_0x4231('0x82')][_0x4231('0x83')],'raw':!![]};return new Promise(function(_0x32ef81,_0x2de228){var _0x15eeca=squel[_0x4231('0x84')]()[_0x4231('0x11')](_0x4231('0x85')+_0x207b98+'InteractionId','id')[_0x4231('0x11')](_0x4231('0x86'))[_0x4231('0x87')](_0x4231('0x88')+_0x464493+'_interactions','ui')[_0x4231('0x89')](_0x4231('0x8a'),_0x17d81f['id']);return _0x2877af[_0x4231('0x8b')][_0x4231('0x8c')](_0x15eeca[_0x4231('0x8d')](),_0x3d81b6)[_0x4231('0xc')](function(_0x32367){_0x17d81f[_0x207b98+'OpenTabs']=_0x32367;_0x32ef81(_0x32367);})['catch'](function(_0x31417b){_0x2de228(_0x31417b);});});}return _0x5cc5e4[_0x4231('0x8e')](_0x4231('0x8f'),attributes,{'tableName':_0x4231('0x90'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x37b180){var _0x1c859a={'raw':_0x37b180[_0x4231('0x8c')][_0x4231('0x91')],'where':{}};var _0x1de372={};var _0x30c01a={'count':0x0,'rows':[]};var _0x3e1694=_0x37b180[_0x4231('0x8c')][_0x4231('0x92')];var _0x23c322=_0x37b180[_0x4231('0x8c')][_0x4231('0x93')]||![];var _0xabf17d=_0xb249f7(_0x3e1694,_0x23c322);if(!_0xabf17d[_0x4231('0x17')])throw new Error('Invalid\x20section\x20\x27'+_0x3e1694+'\x27');var _0x421668=[{'name':_0x3e1694}];if(!_[_0x4231('0x94')](_0xabf17d[_0x4231('0x1c')]))_0x421668=_0xabf17d['parentSections'];var _0x1064ce=[];for(var _0x33e0ff=0x0;_0x33e0ff<_0x421668[_0x4231('0x95')];_0x33e0ff++){_0x1064ce['push'](_0x2877af[_0x4231('0x96')][_0x4231('0x97')]({'where':{'userProfileId':_0x37b180[_0x4231('0x98')]['id'],'name':_0x421668[_0x33e0ff][_0x4231('0xd')]},'raw':!![]}));}return Promise['all'](_0x1064ce)[_0x4231('0xc')](function(_0x5c4f0c){var _0x5e3abc=_[_0x4231('0x6')](_0x5c4f0c,function(_0x4d2d22){return _0x4d2d22?_0x4d2d22:undefined;});var _0x3636ac=_[_0x4231('0x6')](_0x421668,[_0x4231('0x99'),!![]]);var _0x5f57e2=_['isEmpty'](_0x5e3abc)&&_[_0x4231('0x94')](_0x3636ac)?null:_['union'](_0x3636ac,_0x5e3abc);if(!_0x5f57e2)return null;var _0x44ce7e=[];for(var _0x11f807=0x0;_0x11f807<_0x5f57e2[_0x4231('0x95')];_0x11f807++){var _0x1605f0=_[_0x4231('0x97')](_0x421668,function(_0x9509d7){return _0x5f57e2[_0x11f807]?_0x9509d7[_0x4231('0xd')]===_0x5f57e2[_0x11f807][_0x4231('0xd')]:null;});if(_0x1605f0){if(_0x5f57e2[_0x11f807]['ignore']){_0x44ce7e['push'](_0x36d4c8(_0xabf17d[_0x4231('0x17')],_0x5f57e2[_0x11f807]));}else{if(!_0x5f57e2[_0x11f807][_0x4231('0x9a')]){_0x44ce7e[_0x4231('0x9b')](_0x661fdc(_0x1605f0,_0x5f57e2[_0x11f807],_0xabf17d[_0x4231('0x17')]));}else{if(_0x1605f0[_0x4231('0xb')]){_0x44ce7e[_0x4231('0x9b')](_0x3d5038(_0x1605f0,_0x5f57e2[_0x11f807]));}}}}}return Promise[_0x4231('0x9c')](_0x44ce7e);})['then'](function(_0x30e3fc){var _0x2417dd=_0x30e3fc;var _0x15190e=null;if(_0x2417dd){_0x15190e=_0x2417dd[_0x4231('0x95')]===0x1?_0x2417dd[0x0]:null;}if(!_0x15190e&&!_0x2417dd)return _0x30c01a;var _0x3d1692=_0x2877af[_0xabf17d[_0x4231('0x17')]]['rawAttributes'];_0x1de372['model']=_[_0x4231('0x9d')](_0x3d1692);_0x1de372[_0x4231('0x8c')]=_[_0x4231('0x9d')](_0x37b180[_0x4231('0x8c')]);_0x1de372[_0x4231('0x9e')]=_[_0x4231('0x9f')](_0x1de372[_0x4231('0xb')],_0x1de372['query']);_0x1c859a[_0x4231('0xa0')]=_[_0x4231('0x9f')](_0x1de372[_0x4231('0xb')],qs[_0x4231('0xa1')](_0x37b180[_0x4231('0x8c')][_0x4231('0xa1')]));_0x1c859a[_0x4231('0xa0')]=_0x1c859a[_0x4231('0xa0')][_0x4231('0x95')]?_0x1c859a[_0x4231('0xa0')]:_0x1de372['model'];if(!_0x37b180[_0x4231('0x8c')][_0x4231('0xa2')](_0x4231('0xa3'))){_0x1c859a[_0x4231('0xa4')]=qs[_0x4231('0xa4')](_0x37b180[_0x4231('0x8c')][_0x4231('0xa4')]);_0x1c859a[_0x4231('0xa5')]=qs[_0x4231('0xa5')](_0x37b180[_0x4231('0x8c')][_0x4231('0xa5')]);}_0x1c859a[_0x4231('0xa6')]=qs[_0x4231('0xa7')](_0x37b180[_0x4231('0x8c')]['sort']);_0x1c859a[_0x4231('0x89')]=qs['filters'](_[_0x4231('0xa8')](_0x37b180[_0x4231('0x8c')],_0x1de372['filters']));if(_0x37b180['query'][_0x4231('0x6')]){_0x1c859a[_0x4231('0x89')]=_[_0x4231('0xa9')](_0x1c859a[_0x4231('0x89')],{'$or':_[_0x4231('0x9')](_0x3d1692,function(_0x17a729){if(_0x17a729[_0x4231('0x14')][_0x4231('0xaa')]!=='VIRTUAL'){var _0x35fc6e={};_0x35fc6e[_0x17a729[_0x4231('0x11')]]={'$like':'%'+_0x37b180['query']['filter']+'%'};return _0x35fc6e;}})});}var _0xa476c7=[];var _0x5ef1d7=null;var _0x2b369f={};if(_0x15190e){_0x5ef1d7=_[_0x4231('0x97')](_0x421668,[_0x4231('0xd'),_0x15190e[_0x4231('0xd')]]);if(_0x5ef1d7[_0x4231('0x11')]){_0x2b369f={};if(_0xabf17d[_0x4231('0x17')]===_0x4231('0x12')){_0x2b369f[_0x5ef1d7[_0x4231('0xab')]]=_[_0x4231('0x9')](_0x15190e[_0x4231('0x8')],'id');}else{_0x2b369f[_0x5ef1d7['foreignKey']]=_0x15190e['associatedResources'];}_0xa476c7[_0x4231('0x9b')](_0x2b369f);}else{_0x1c859a['where']['id']=_0x15190e['associatedResources'];}}else{for(var _0xd88a42=0x0;_0xd88a42<_0x2417dd[_0x4231('0x95')];_0xd88a42++){_0x5ef1d7=_[_0x4231('0x97')](_0x421668,['name',_0x2417dd[_0xd88a42][_0x4231('0xd')]]);if(_0x5ef1d7[_0x4231('0x11')]){_0x2b369f={};_0x2b369f[_0x5ef1d7[_0x4231('0xab')]]=_0x2417dd[_0xd88a42][_0x4231('0x8')];_0xa476c7[_0x4231('0x9b')](_0x2b369f);}else{if(!_0x1c859a[_0x4231('0x89')]['id'])_0x1c859a['where']['id']=[];_0x2417dd[_0xd88a42][_0x4231('0x8')][_0x4231('0xac')](function(_0x8ced57){_0x1c859a[_0x4231('0x89')]['id']['push'](_0x8ced57);});}}}if(!_['isEmpty'](_0xa476c7)){_0x1c859a[_0x4231('0x89')]=_[_0x4231('0xa9')](_0x1c859a[_0x4231('0x89')],{'$and':{'$or':_0xa476c7}});}_0x1c859a=_[_0x4231('0xa9')]({},_0x1c859a,_0x37b180[_0x4231('0xad')]);if(_0x15190e&&!_0x15190e[_0x4231('0x9a')]&&_0xabf17d[_0x4231('0x17')]===_0x4231('0x12')){if(_0x37b180['query'][_0x4231('0xae')]){_0x1c859a[_0x4231('0xaf')]=[{'all':!![]}];}return _0x2877af[_0xabf17d['childModel']][_0x4231('0x10')](_0x1c859a)[_0x4231('0xc')](function(_0xb5f655){var _0x5a0657=[];_0xb5f655[_0x4231('0xac')](function(_0x56df04){var _0x9a3d44;switch(_0x56df04[_0x4231('0xb0')]){case'default':_0x9a3d44=_['find'](_0x15190e[_0x4231('0x8')],function(_0x43dc89){return _0x43dc89['id']===_0x56df04['reportId']&&_0x43dc89[_0x4231('0x14')]===_0x4231('0xb1');});break;case _0x4231('0xb2'):_0x9a3d44=_[_0x4231('0x97')](_0x15190e[_0x4231('0x8')],function(_0x5e560d){return _0x5e560d['id']===_0x56df04[_0x4231('0x7b')]&&_0x5e560d[_0x4231('0x14')]===_0x4231('0xb3');});break;}if(_0x9a3d44)_0x5a0657['push'](_0x56df04);});_0x30c01a[_0x4231('0xb4')]=_0x5a0657[_0x4231('0x95')];_0x30c01a[_0x4231('0xb5')]=_0x5a0657;return _0x30c01a;});}else{return _0x2877af[_0xabf17d[_0x4231('0x17')]][_0x4231('0xb4')]({'where':_0x1c859a[_0x4231('0x89')]})[_0x4231('0xc')](function(_0x4c5c5f){_0x30c01a[_0x4231('0xb4')]=_0x4c5c5f;if(_0x37b180[_0x4231('0x8c')][_0x4231('0xae')]){if(_0xabf17d[_0x4231('0x17')]==='CmContact'){_0x1c859a[_0x4231('0xaf')]=[{'model':_0x2877af[_0x4231('0xb6')],'as':_0x4231('0xb7'),'attributes':['id',_0x4231('0xd'),'color'],'required':_0x37b180[_0x4231('0x8c')][_0x4231('0xb8')]?!![]:![]},{'model':_0x2877af[_0x4231('0xb6')],'as':_0x4231('0xb9'),'attributes':['id',_0x4231('0xd'),_0x4231('0xba')],'through':_0x37b180[_0x4231('0x8c')][_0x4231('0xb8')]?{'attributes':[],'where':{'TagId':_0x37b180['query'][_0x4231('0xb8')]||undefined}}:{},'required':_0x37b180[_0x4231('0x8c')][_0x4231('0xb8')]?!![]:![]}];}else{_0x1c859a[_0x4231('0xaf')]=[{'all':!![]}];}}return _0x2877af[_0xabf17d[_0x4231('0x17')]][_0x4231('0x10')](_0x1c859a);})[_0x4231('0xc')](function(_0x440ed1){_0x30c01a['rows']=_0x440ed1;if(_0x3e1694===_0x4231('0x30')&&_0x37b180[_0x4231('0x8c')][_0x4231('0xbb')]===_0x4231('0xbc')){var _0x9c306=[];for(var _0x4c74cd=0x0;_0x4c74cd<_0x30c01a[_0x4231('0xb5')][_0x4231('0x95')];_0x4c74cd++){_0x9c306[_0x4231('0x9b')](_0x2a695b(_0x4231('0xbd'),_0x30c01a[_0x4231('0xb5')][_0x4c74cd][_0x4231('0xbe')]));_0x9c306['push'](_0x2a695b(_0x4231('0xbf'),_0x30c01a[_0x4231('0xb5')][_0x4c74cd]['dataValues']));_0x9c306[_0x4231('0x9b')](_0x2a695b(_0x4231('0xc0'),_0x30c01a[_0x4231('0xb5')][_0x4c74cd][_0x4231('0xbe')]));_0x9c306[_0x4231('0x9b')](_0x2a695b(_0x4231('0xc1'),_0x30c01a[_0x4231('0xb5')][_0x4c74cd][_0x4231('0xbe')]));_0x9c306[_0x4231('0x9b')](_0x2a695b('openchannel',_0x30c01a[_0x4231('0xb5')][_0x4c74cd][_0x4231('0xbe')]));_0x9c306[_0x4231('0x9b')](_0x2a695b(_0x4231('0xc2'),_0x30c01a['rows'][_0x4c74cd][_0x4231('0xbe')]));}return Promise[_0x4231('0x9c')](_0x9c306)[_0x4231('0xc')](function(){return _0x30c01a;});}return _0x30c01a;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 40e8742..55aed34 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 _0x5f2f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x1b7171,_0x4cd5ce){var _0x565f48=function(_0x5b2458){while(--_0x5b2458){_0x1b7171['push'](_0x1b7171['shift']());}};_0x565f48(++_0x4cd5ce);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4f9985,_0x4d1488){_0x4f9985=_0x4f9985-0x0;var _0x28ad29=_0x5f2f[_0x4f9985];return _0x28ad29;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./userProfile.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});} \ No newline at end of file +var _0xd634=['stringify','error','UserProfile,\x20%s,\x20%s','message','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','request','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s'];(function(_0x29fe92,_0x55ef70){var _0x507d45=function(_0x9b9b3a){while(--_0x9b9b3a){_0x29fe92['push'](_0x29fe92['shift']());}};_0x507d45(++_0x55ef70);}(_0xd634,0xf4));var _0x4d63=function(_0x25d2fb,_0x18a774){_0x25d2fb=_0x25d2fb-0x0;var _0x1ded53=_0xd634[_0x25d2fb];return _0x1ded53;};'use strict';var _=require('lodash');var util=require(_0x4d63('0x0'));var moment=require(_0x4d63('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d63('0x2'));var db=require(_0x4d63('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4d63('0x4'));var config=require(_0x4d63('0x5'));var jayson=require(_0x4d63('0x6'));var client=jayson[_0x4d63('0x7')][_0x4d63('0x8')]({'port':0x232a});config[_0x4d63('0x9')]=_[_0x4d63('0xa')](config[_0x4d63('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x305d5b,_0x46a91a,_0x20aac2){return new BPromise(function(_0x58e78d,_0x21024c){return client[_0x4d63('0xb')](_0x305d5b,_0x20aac2)['then'](function(_0x5f5707){logger[_0x4d63('0xc')]('UserProfile,\x20%s,\x20%s',_0x46a91a,_0x4d63('0xd'));logger[_0x4d63('0xe')](_0x4d63('0xf'),_0x46a91a,_0x4d63('0xd'),JSON[_0x4d63('0x10')](_0x5f5707));if(_0x5f5707[_0x4d63('0x11')]){if(_0x5f5707['error']['code']===0x1f4){logger['error'](_0x4d63('0x12'),_0x46a91a,_0x5f5707[_0x4d63('0x11')][_0x4d63('0x13')]);return _0x21024c(_0x5f5707[_0x4d63('0x11')]['message']);}logger[_0x4d63('0x11')](_0x4d63('0x12'),_0x46a91a,_0x5f5707[_0x4d63('0x11')][_0x4d63('0x13')]);return _0x58e78d(_0x5f5707[_0x4d63('0x11')][_0x4d63('0x13')]);}else{logger[_0x4d63('0xc')](_0x4d63('0x12'),_0x46a91a,'request\x20sent');_0x58e78d(_0x5f5707['result'][_0x4d63('0x13')]);}})['catch'](function(_0x19d26f){logger[_0x4d63('0x11')](_0x4d63('0x12'),_0x46a91a,_0x19d26f);_0x21024c(_0x19d26f);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 8bb3e40..2473e97 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 _0xea04=['removeListener','register','length','save','remove','update','emit'];(function(_0x791d4e,_0x36eeb5){var _0x53078b=function(_0x5bbb35){while(--_0x5bbb35){_0x791d4e['push'](_0x791d4e['shift']());}};_0x53078b(++_0x36eeb5);}(_0xea04,0x11b));var _0x4ea0=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0xea04[_0x469ac7];return _0x22f3b0;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x4ea0('0x0'),_0x4ea0('0x1'),_0x4ea0('0x2')];function createListener(_0x2495b,_0x3418a6){return function(_0x5dffeb){_0x3418a6[_0x4ea0('0x3')](_0x2495b,_0x5dffeb);};}function removeListener(_0x392501,_0x12cd18){return function(){UserProfileEvents[_0x4ea0('0x4')](_0x392501,_0x12cd18);};}exports[_0x4ea0('0x5')]=function(_0x497c1a){for(var _0x4054b3=0x0,_0x3c2f59=events[_0x4ea0('0x6')];_0x4054b3<_0x3c2f59;_0x4054b3++){var _0x4d5666=events[_0x4054b3];var _0x55d55d=createListener('userProfile:'+_0x4d5666,_0x497c1a);UserProfileEvents['on'](_0x4d5666,_0x55d55d);}}; \ No newline at end of file +var _0x7d3c=['emit','register','length','userProfile:','update'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x7d3c,0x117));var _0xc7d3=function(_0x374202,_0x4d6227){_0x374202=_0x374202-0x0;var _0xbc3162=_0x7d3c[_0x374202];return _0xbc3162;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save','remove',_0xc7d3('0x0')];function createListener(_0x8b9aa9,_0x45a7a7){return function(_0x54ebb0){_0x45a7a7[_0xc7d3('0x1')](_0x8b9aa9,_0x54ebb0);};}function removeListener(_0x197fec,_0x46d7b1){return function(){UserProfileEvents['removeListener'](_0x197fec,_0x46d7b1);};}exports[_0xc7d3('0x2')]=function(_0x3cbe14){for(var _0x3d5314=0x0,_0x4bf341=events[_0xc7d3('0x3')];_0x3d5314<_0x4bf341;_0x3d5314++){var _0x3db851=events[_0x3d5314];var _0x5e8b89=createListener(_0xc7d3('0x4')+_0x3db851,_0x3cbe14);UserProfileEvents['on'](_0x3db851,_0x5e8b89);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index d3f082d..c465a15 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 _0x1ae2=['../../components/interaction/service','./userProfileResource.controller','isAuthenticated','index','get','describe','/:id','show','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0x1ae2,0x1ce));var _0x21ae=function(_0x1d4560,_0x27f2f1){_0x1d4560=_0x1d4560-0x0;var _0x35aeff=_0x1ae2[_0x1d4560];return _0x35aeff;};'use strict';var multer=require(_0x21ae('0x0'));var util=require(_0x21ae('0x1'));var path=require(_0x21ae('0x2'));var timeout=require('connect-timeout');var express=require(_0x21ae('0x3'));var router=express['Router']();var fs_extra=require(_0x21ae('0x4'));var auth=require(_0x21ae('0x5'));var interaction=require(_0x21ae('0x6'));var config=require('../../config/environment');var controller=require(_0x21ae('0x7'));router['get']('/',auth[_0x21ae('0x8')](),controller[_0x21ae('0x9')]);router[_0x21ae('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x21ae('0xb')]);router[_0x21ae('0xa')](_0x21ae('0xc'),auth[_0x21ae('0x8')](),controller[_0x21ae('0xd')]);router['post']('/',auth[_0x21ae('0x8')](),controller['create']);router[_0x21ae('0xe')]('/:id',auth[_0x21ae('0x8')](),controller[_0x21ae('0xf')]);router[_0x21ae('0x10')](_0x21ae('0xc'),auth[_0x21ae('0x8')](),controller[_0x21ae('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfbae=['update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put'];(function(_0x47937f,_0xa58155){var _0x4670bb=function(_0x53c782){while(--_0x53c782){_0x47937f['push'](_0x47937f['shift']());}};_0x4670bb(++_0xa58155);}(_0xfbae,0x17e));var _0xefba=function(_0x578bb0,_0x25a871){_0x578bb0=_0x578bb0-0x0;var _0x142891=_0xfbae[_0x578bb0];return _0x142891;};'use strict';var multer=require(_0xefba('0x0'));var util=require(_0xefba('0x1'));var path=require(_0xefba('0x2'));var timeout=require(_0xefba('0x3'));var express=require('express');var router=express[_0xefba('0x4')]();var fs_extra=require(_0xefba('0x5'));var auth=require(_0xefba('0x6'));var interaction=require(_0xefba('0x7'));var config=require(_0xefba('0x8'));var controller=require(_0xefba('0x9'));router[_0xefba('0xa')]('/',auth['isAuthenticated'](),controller[_0xefba('0xb')]);router[_0xefba('0xa')](_0xefba('0xc'),auth[_0xefba('0xd')](),controller[_0xefba('0xe')]);router[_0xefba('0xa')](_0xefba('0xf'),auth[_0xefba('0xd')](),controller[_0xefba('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xefba('0x11')](_0xefba('0xf'),auth[_0xefba('0xd')](),controller[_0xefba('0x12')]);router[_0xefba('0x13')](_0xefba('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 9a11f00..d331692 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 _0x9f73=['INTEGER','STRING'];(function(_0x91d8db,_0x33b659){var _0x419170=function(_0x114992){while(--_0x114992){_0x91d8db['push'](_0x91d8db['shift']());}};_0x419170(++_0x33b659);}(_0x9f73,0x185));var _0x39f7=function(_0x76b787,_0x1fdd97){_0x76b787=_0x76b787-0x0;var _0x651edc=_0x9f73[_0x76b787];return _0x651edc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x39f7('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x39f7('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x39f7('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xd023=['exports','STRING','sequelize'];(function(_0x518de0,_0x292c33){var _0x1c6675=function(_0x1e51c9){while(--_0x1e51c9){_0x518de0['push'](_0x518de0['shift']());}};_0x1c6675(++_0x292c33);}(_0xd023,0xaa));var _0x3d02=function(_0xe71cf6,_0x120a90){_0xe71cf6=_0xe71cf6-0x0;var _0x1ffd42=_0xd023[_0xe71cf6];return _0x1ffd42;};'use strict';var Sequelize=require(_0x3d02('0x0'));module[_0x3d02('0x1')]={'name':{'type':Sequelize[_0x3d02('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x3d02('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 37c406d..70b6f83 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 _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','UserProfileResource','includeAll','rows','catch','show'];(function(_0x2c6760,_0x487080){var _0x704576=function(_0x30f235){while(--_0x30f235){_0x2c6760['push'](_0x2c6760['shift']());}};_0x704576(++_0x487080);}(_0x0295,0x1f0));var _0x5029=function(_0x5dee44,_0x115b60){_0x5dee44=_0x5dee44-0x0;var _0x46f720=_0x0295[_0x5dee44];return _0x46f720;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['UserProfileResource'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['UserProfileResource'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));};exports['describe']=function(_0x544fb3,_0x1510bb){return db[_0x5029('0x3b')]['describe']()[_0x5029('0x20')](respondWithResult(_0x1510bb,null))['catch'](handleError(_0x1510bb,null));}; \ No newline at end of file +var _0x2ef3=['name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','UserProfileResource','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack'];(function(_0x284c34,_0x41a81f){var _0x4542c2=function(_0x4d56c9){while(--_0x4d56c9){_0x284c34['push'](_0x284c34['shift']());}};_0x4542c2(++_0x41a81f);}(_0x2ef3,0xba));var _0x32ef=function(_0x2c0ff6,_0x1bec51){_0x2c0ff6=_0x2c0ff6-0x0;var _0x223551=_0x2ef3[_0x2c0ff6];return _0x223551;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['UserProfileResource'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['UserProfileResource'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['UserProfileResource']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));};exports['describe']=function(_0x179c2f,_0x259c32){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]()[_0x32ef('0x3e')](respondWithResult(_0x259c32,null))[_0x32ef('0x42')](handleError(_0x259c32,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index fedfd5f..9b1629c 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 _0x8912=['compositeIndex','resourceId','sectionId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8912,0x120));var _0x2891=function(_0x189051,_0x5962f2){_0x189051=_0x189051-0x0;var _0x26968b=_0x8912[_0x189051];return _0x26968b;};'use strict';var _=require(_0x2891('0x0'));var util=require('util');var logger=require(_0x2891('0x1'))(_0x2891('0x2'));var moment=require('moment');var BPromise=require(_0x2891('0x3'));var rp=require(_0x2891('0x4'));var fs=require('fs');var path=require(_0x2891('0x5'));var rimraf=require(_0x2891('0x6'));var config=require(_0x2891('0x7'));var attributes=require(_0x2891('0x8'));module[_0x2891('0x9')]=function(_0x5b417f,_0x4c3329){return _0x5b417f[_0x2891('0xa')]('UserProfileResource',attributes,{'tableName':_0x2891('0xb'),'paranoid':![],'indexes':[{'name':_0x2891('0xc'),'fields':[_0x2891('0xd'),_0x2891('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x710f=['lodash','moment','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x710f,0x114));var _0xf710=function(_0x530607,_0x123e6e){_0x530607=_0x530607-0x0;var _0x27f5ff=_0x710f[_0x530607];return _0x27f5ff;};'use strict';var _=require(_0xf710('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf710('0x1'));var BPromise=require('bluebird');var rp=require(_0xf710('0x2'));var fs=require('fs');var path=require(_0xf710('0x3'));var rimraf=require(_0xf710('0x4'));var config=require(_0xf710('0x5'));var attributes=require(_0xf710('0x6'));module[_0xf710('0x7')]=function(_0x4207e9,_0x147d46){return _0x4207e9[_0xf710('0x8')]('UserProfileResource',attributes,{'tableName':_0xf710('0x9'),'paranoid':![],'indexes':[{'name':_0xf710('0xa'),'fields':[_0xf710('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 4a1ff9c..b8e2ab1 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 _0x8104=['request\x20sent','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x21e01d,_0x1c47c6){var _0x30710b=function(_0x596754){while(--_0x596754){_0x21e01d['push'](_0x21e01d['shift']());}};_0x30710b(++_0x1c47c6);}(_0x8104,0xae));var _0x4810=function(_0x508f5c,_0x258025){_0x508f5c=_0x508f5c-0x0;var _0x10da02=_0x8104[_0x508f5c];return _0x10da02;};'use strict';var _=require('lodash');var util=require(_0x4810('0x0'));var moment=require('moment');var BPromise=require(_0x4810('0x1'));var rs=require(_0x4810('0x2'));var fs=require('fs');var Redis=require(_0x4810('0x3'));var db=require(_0x4810('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4810('0x5'))(_0x4810('0x6'));var config=require('../../config/environment');var jayson=require(_0x4810('0x7'));var client=jayson[_0x4810('0x8')][_0x4810('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a8ba6,_0x254bb4,_0x21ff8d){return new BPromise(function(_0x276d40,_0x4c6185){return client[_0x4810('0xa')](_0x3a8ba6,_0x21ff8d)[_0x4810('0xb')](function(_0x1aa40b){logger[_0x4810('0xc')](_0x4810('0xd'),_0x254bb4,'request\x20sent');logger['debug'](_0x4810('0xe'),_0x254bb4,_0x4810('0xf'),JSON[_0x4810('0x10')](_0x1aa40b));if(_0x1aa40b[_0x4810('0x11')]){if(_0x1aa40b[_0x4810('0x11')][_0x4810('0x12')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x254bb4,_0x1aa40b[_0x4810('0x11')][_0x4810('0x13')]);return _0x4c6185(_0x1aa40b[_0x4810('0x11')][_0x4810('0x13')]);}logger[_0x4810('0x11')](_0x4810('0xd'),_0x254bb4,_0x1aa40b[_0x4810('0x11')][_0x4810('0x13')]);return _0x276d40(_0x1aa40b[_0x4810('0x11')][_0x4810('0x13')]);}else{logger[_0x4810('0xc')](_0x4810('0xd'),_0x254bb4,_0x4810('0xf'));_0x276d40(_0x1aa40b['result'][_0x4810('0x13')]);}})[_0x4810('0x14')](function(_0x3ac80e){logger[_0x4810('0x11')](_0x4810('0xd'),_0x254bb4,_0x3ac80e);_0x4c6185(_0x3ac80e);});});} \ No newline at end of file +var _0x45b2=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','ioredis','../../mysqldb'];(function(_0x415d8d,_0x3d4070){var _0x22fa3c=function(_0x384b00){while(--_0x384b00){_0x415d8d['push'](_0x415d8d['shift']());}};_0x22fa3c(++_0x3d4070);}(_0x45b2,0x94));var _0x245b=function(_0x33ed3f,_0x2f395e){_0x33ed3f=_0x33ed3f-0x0;var _0x529839=_0x45b2[_0x33ed3f];return _0x529839;};'use strict';var _=require(_0x245b('0x0'));var util=require('util');var moment=require(_0x245b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x245b('0x2'));var db=require(_0x245b('0x3'))['db'];var utils=require(_0x245b('0x4'));var logger=require(_0x245b('0x5'))(_0x245b('0x6'));var config=require(_0x245b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x245b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x542677,_0x1ea4fb,_0x30340d){return new BPromise(function(_0x314103,_0x449e99){return client[_0x245b('0x9')](_0x542677,_0x30340d)[_0x245b('0xa')](function(_0x5b0fde){logger[_0x245b('0xb')](_0x245b('0xc'),_0x1ea4fb,_0x245b('0xd'));logger[_0x245b('0xe')](_0x245b('0xf'),_0x1ea4fb,_0x245b('0xd'),JSON['stringify'](_0x5b0fde));if(_0x5b0fde[_0x245b('0x10')]){if(_0x5b0fde[_0x245b('0x10')]['code']===0x1f4){logger[_0x245b('0x10')](_0x245b('0xc'),_0x1ea4fb,_0x5b0fde['error'][_0x245b('0x11')]);return _0x449e99(_0x5b0fde['error'][_0x245b('0x11')]);}logger[_0x245b('0x10')](_0x245b('0xc'),_0x1ea4fb,_0x5b0fde['error'][_0x245b('0x11')]);return _0x314103(_0x5b0fde['error'][_0x245b('0x11')]);}else{logger[_0x245b('0xb')](_0x245b('0xc'),_0x1ea4fb,_0x245b('0xd'));_0x314103(_0x5b0fde[_0x245b('0x12')][_0x245b('0x11')]);}})['catch'](function(_0x2d0831){logger[_0x245b('0x10')](_0x245b('0xc'),_0x1ea4fb,_0x2d0831);_0x449e99(_0x2d0831);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index bcfd92e..b0859d3 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 _0x3897=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer'];(function(_0x1251e0,_0x24c677){var _0x301d39=function(_0x439182){while(--_0x439182){_0x1251e0['push'](_0x1251e0['shift']());}};_0x301d39(++_0x24c677);}(_0x3897,0x179));var _0x7389=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x3897[_0x4b12ae];return _0x16957b;};'use strict';var multer=require(_0x7389('0x0'));var util=require(_0x7389('0x1'));var path=require(_0x7389('0x2'));var timeout=require(_0x7389('0x3'));var express=require(_0x7389('0x4'));var router=express[_0x7389('0x5')]();var fs_extra=require(_0x7389('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7389('0x7'));var config=require('../../config/environment');var controller=require(_0x7389('0x8'));router[_0x7389('0x9')]('/',auth[_0x7389('0xa')](),controller[_0x7389('0xb')]);router[_0x7389('0x9')](_0x7389('0xc'),auth[_0x7389('0xa')](),controller[_0x7389('0xd')]);router[_0x7389('0x9')](_0x7389('0xe'),auth[_0x7389('0xa')](),controller[_0x7389('0xf')]);router['post']('/',auth[_0x7389('0xa')](),controller[_0x7389('0x10')]);router[_0x7389('0x11')](_0x7389('0xe'),auth['isAuthenticated'](),controller[_0x7389('0x12')]);router[_0x7389('0x13')](_0x7389('0xe'),auth[_0x7389('0xa')](),controller['destroy']);module[_0x7389('0x14')]=router; \ No newline at end of file +var _0xa845=['exports','multer','util','path','express','Router','fs-extra','../../config/environment','./userProfileSection.controller','isAuthenticated','index','/describe','describe','get','show','post','create','/:id','update','destroy'];(function(_0x2aa250,_0x400316){var _0x4ab9e7=function(_0x596b09){while(--_0x596b09){_0x2aa250['push'](_0x2aa250['shift']());}};_0x4ab9e7(++_0x400316);}(_0xa845,0x1b9));var _0x5a84=function(_0x33f74b,_0x5e8e40){_0x33f74b=_0x33f74b-0x0;var _0x5e468c=_0xa845[_0x33f74b];return _0x5e468c;};'use strict';var multer=require(_0x5a84('0x0'));var util=require(_0x5a84('0x1'));var path=require(_0x5a84('0x2'));var timeout=require('connect-timeout');var express=require(_0x5a84('0x3'));var router=express[_0x5a84('0x4')]();var fs_extra=require(_0x5a84('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5a84('0x6'));var controller=require(_0x5a84('0x7'));router['get']('/',auth[_0x5a84('0x8')](),controller[_0x5a84('0x9')]);router['get'](_0x5a84('0xa'),auth[_0x5a84('0x8')](),controller[_0x5a84('0xb')]);router[_0x5a84('0xc')]('/:id',auth[_0x5a84('0x8')](),controller[_0x5a84('0xd')]);router[_0x5a84('0xe')]('/',auth[_0x5a84('0x8')](),controller[_0x5a84('0xf')]);router['put'](_0x5a84('0x10'),auth[_0x5a84('0x8')](),controller[_0x5a84('0x11')]);router['delete']('/:id',auth[_0x5a84('0x8')](),controller[_0x5a84('0x12')]);module[_0x5a84('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index b1b943e..fad72ae 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 _0xdb94=['INTEGER','BOOLEAN','crudPermissions','sequelize','exports','STRING'];(function(_0x54097a,_0x513d1d){var _0x483190=function(_0x246460){while(--_0x246460){_0x54097a['push'](_0x54097a['shift']());}};_0x483190(++_0x513d1d);}(_0xdb94,0xab));var _0x4db9=function(_0x3bf118,_0x3df63d){_0x3bf118=_0x3bf118-0x0;var _0x30630e=_0xdb94[_0x3bf118];return _0x30630e;};'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 +var _0xd4f4=['setDataValue','crudPermissions','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x4238b0,_0x6e37e7){_0x4238b0=_0x4238b0-0x0;var _0x43d339=_0xd4f4[_0x4238b0];return _0x43d339;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'name':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4d4f('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4d4f('0x2')],'set':function(_0x25087a){this[_0x4d4f('0x5')](_0x4d4f('0x6'),_0x25087a?_0x25087a['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x4d4f('0x7')](_0x4d4f('0x6'))[_0x4d4f('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 03d9273..eea65e8 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 _0x7466=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfileSection','fieldName','type','model','query','filters','intersection','fields'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x7466,0x109));var _0x6746=function(_0x36a18e,_0x147ec1){_0x36a18e=_0x36a18e-0x0;var _0x301c9b=_0x7466[_0x36a18e];return _0x301c9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6746('0x0'));var zipdir=require(_0x6746('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6746('0x2'));var moment=require('moment');var BPromise=require(_0x6746('0x3'));var Mustache=require(_0x6746('0x4'));var util=require(_0x6746('0x5'));var path=require(_0x6746('0x6'));var sox=require(_0x6746('0x7'));var csv=require('to-csv');var ejs=require(_0x6746('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6746('0x9'));var squel=require('squel');var crypto=require(_0x6746('0xa'));var jsforce=require(_0x6746('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6746('0xc'));var querystring=require(_0x6746('0xd'));var Papa=require(_0x6746('0xe'));var Redis=require(_0x6746('0xf'));var authService=require(_0x6746('0x10'));var qs=require(_0x6746('0x11'));var as=require(_0x6746('0x12'));var hardwareService=require(_0x6746('0x13'));var logger=require(_0x6746('0x14'))(_0x6746('0x15'));var utils=require(_0x6746('0x16'));var config=require(_0x6746('0x17'));var licenseUtil=require(_0x6746('0x18'));var db=require(_0x6746('0x19'))['db'];function respondWithStatusCode(_0x2eb7cf,_0x4dee8f){_0x4dee8f=_0x4dee8f||0xcc;return function(_0x442041){if(_0x442041){return _0x2eb7cf[_0x6746('0x1a')](_0x4dee8f);}return _0x2eb7cf[_0x6746('0x1b')](_0x4dee8f)[_0x6746('0x1c')]();};}function respondWithResult(_0x229b57,_0x5585a4){_0x5585a4=_0x5585a4||0xc8;return function(_0x6bf045){if(_0x6bf045){return _0x229b57[_0x6746('0x1b')](_0x5585a4)[_0x6746('0x1d')](_0x6bf045);}};}function respondWithFilteredResult(_0x25e45b,_0x201d1c){return function(_0x13db4b){if(_0x13db4b){var _0x472bdd=typeof _0x201d1c['offset']===_0x6746('0x1e')&&typeof _0x201d1c[_0x6746('0x1f')]===_0x6746('0x1e');var _0x21ad56=_0x13db4b[_0x6746('0x20')];var _0x2e4c92=_0x472bdd?0x0:_0x201d1c[_0x6746('0x21')];var _0xbd530d=_0x472bdd?_0x13db4b[_0x6746('0x20')]:_0x201d1c[_0x6746('0x21')]+_0x201d1c[_0x6746('0x1f')];var _0x1353c1;if(_0xbd530d>=_0x21ad56){_0xbd530d=_0x21ad56;_0x1353c1=0xc8;}else{_0x1353c1=0xce;}_0x25e45b[_0x6746('0x1b')](_0x1353c1);return _0x25e45b[_0x6746('0x22')](_0x6746('0x23'),_0x2e4c92+'-'+_0xbd530d+'/'+_0x21ad56)[_0x6746('0x1d')](_0x13db4b);}return null;};}function patchUpdates(_0x42d6c8){return function(_0x457dff){try{jsonpatch[_0x6746('0x24')](_0x457dff,_0x42d6c8,!![]);}catch(_0x3cae8f){return BPromise[_0x6746('0x25')](_0x3cae8f);}return _0x457dff[_0x6746('0x26')]();};}function saveUpdates(_0x3cb5fa,_0xc6d73a){return function(_0x354edf){if(_0x354edf){return _0x354edf[_0x6746('0x27')](_0x3cb5fa)[_0x6746('0x28')](function(_0x199069){return _0x199069;});}return null;};}function removeEntity(_0x4dc8a0,_0x34001b){return function(_0x195488){if(_0x195488){return _0x195488[_0x6746('0x29')]()[_0x6746('0x28')](function(){_0x4dc8a0[_0x6746('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25abb6,_0x41b663){return function(_0x2e700d){if(!_0x2e700d){_0x25abb6[_0x6746('0x1a')](0x194);}return _0x2e700d;};}function handleError(_0x4f72dc,_0x2e18b6){_0x2e18b6=_0x2e18b6||0x1f4;return function(_0x174dca){logger[_0x6746('0x2a')](_0x174dca[_0x6746('0x2b')]);if(_0x174dca[_0x6746('0x2c')]){delete _0x174dca['name'];}_0x4f72dc[_0x6746('0x1b')](_0x2e18b6)[_0x6746('0x2d')](_0x174dca);};}exports['index']=function(_0x10a018,_0x46c427){var _0x458a25={},_0x35cddc={},_0x5b60b2={'count':0x0,'rows':[]};var _0x41d14a=_[_0x6746('0x2e')](db[_0x6746('0x2f')]['rawAttributes'],function(_0x5cb34a){return{'name':_0x5cb34a[_0x6746('0x30')],'type':_0x5cb34a[_0x6746('0x31')]['key']};});_0x35cddc[_0x6746('0x32')]=_[_0x6746('0x2e')](_0x41d14a,_0x6746('0x2c'));_0x35cddc['query']=_['keys'](_0x10a018[_0x6746('0x33')]);_0x35cddc[_0x6746('0x34')]=_['intersection'](_0x35cddc[_0x6746('0x32')],_0x35cddc[_0x6746('0x33')]);_0x458a25['attributes']=_[_0x6746('0x35')](_0x35cddc[_0x6746('0x32')],qs[_0x6746('0x36')](_0x10a018[_0x6746('0x33')][_0x6746('0x36')]));_0x458a25['attributes']=_0x458a25[_0x6746('0x37')][_0x6746('0x38')]?_0x458a25[_0x6746('0x37')]:_0x35cddc[_0x6746('0x32')];if(!_0x10a018[_0x6746('0x33')][_0x6746('0x39')](_0x6746('0x3a'))){_0x458a25[_0x6746('0x1f')]=qs['limit'](_0x10a018['query'][_0x6746('0x1f')]);_0x458a25['offset']=qs['offset'](_0x10a018[_0x6746('0x33')]['offset']);}_0x458a25[_0x6746('0x3b')]=qs[_0x6746('0x3c')](_0x10a018[_0x6746('0x33')][_0x6746('0x3c')]);_0x458a25[_0x6746('0x3d')]=qs[_0x6746('0x34')](_[_0x6746('0x3e')](_0x10a018[_0x6746('0x33')],_0x35cddc[_0x6746('0x34')]),_0x41d14a);if(_0x10a018['query'][_0x6746('0x3f')]){_0x458a25['where']=_[_0x6746('0x40')](_0x458a25[_0x6746('0x3d')],{'$or':_[_0x6746('0x2e')](_0x41d14a,function(_0x31f8c9){if(_0x31f8c9[_0x6746('0x31')]!==_0x6746('0x41')){var _0x20327d={};_0x20327d[_0x31f8c9[_0x6746('0x2c')]]={'$like':'%'+_0x10a018[_0x6746('0x33')][_0x6746('0x3f')]+'%'};return _0x20327d;}})});}_0x458a25=_[_0x6746('0x40')]({},_0x458a25,_0x10a018['options']);var _0x1c45fd={'where':_0x458a25[_0x6746('0x3d')]};return db[_0x6746('0x2f')][_0x6746('0x20')](_0x1c45fd)[_0x6746('0x28')](function(_0xdda976){_0x5b60b2[_0x6746('0x20')]=_0xdda976;if(_0x10a018[_0x6746('0x33')][_0x6746('0x42')]){_0x458a25[_0x6746('0x43')]=[{'all':!![]}];}return db[_0x6746('0x2f')][_0x6746('0x44')](_0x458a25);})['then'](function(_0x460f13){_0x5b60b2[_0x6746('0x45')]=_0x460f13;return _0x5b60b2;})[_0x6746('0x28')](respondWithFilteredResult(_0x46c427,_0x458a25))[_0x6746('0x46')](handleError(_0x46c427,null));};exports[_0x6746('0x47')]=function(_0xfa8aff,_0x24a24c){var _0x3c0897={'raw':![],'where':{'id':_0xfa8aff[_0x6746('0x48')]['id']}},_0x573ebb={};_0x573ebb[_0x6746('0x32')]=_[_0x6746('0x49')](db['UserProfileSection'][_0x6746('0x4a')]);_0x573ebb[_0x6746('0x33')]=_['keys'](_0xfa8aff[_0x6746('0x33')]);_0x573ebb[_0x6746('0x34')]=_[_0x6746('0x35')](_0x573ebb['model'],_0x573ebb[_0x6746('0x33')]);_0x3c0897['attributes']=_[_0x6746('0x35')](_0x573ebb['model'],qs[_0x6746('0x36')](_0xfa8aff[_0x6746('0x33')][_0x6746('0x36')]));_0x3c0897[_0x6746('0x37')]=_0x3c0897['attributes'][_0x6746('0x38')]?_0x3c0897[_0x6746('0x37')]:_0x573ebb['model'];if(_0xfa8aff[_0x6746('0x33')][_0x6746('0x42')]){_0x3c0897[_0x6746('0x43')]=[{'all':!![]}];}_0x3c0897=_[_0x6746('0x40')]({},_0x3c0897,_0xfa8aff[_0x6746('0x4b')]);return db['UserProfileSection'][_0x6746('0x4c')](_0x3c0897)[_0x6746('0x28')](handleEntityNotFound(_0x24a24c,null))[_0x6746('0x28')](respondWithResult(_0x24a24c,null))[_0x6746('0x46')](handleError(_0x24a24c,null));};exports[_0x6746('0x4d')]=function(_0x508be2,_0x390c70){return db[_0x6746('0x2f')]['create'](_0x508be2[_0x6746('0x4e')],{})[_0x6746('0x28')](respondWithResult(_0x390c70,0xc9))[_0x6746('0x46')](handleError(_0x390c70,null));};exports[_0x6746('0x27')]=function(_0x466df2,_0x452e36){if(_0x466df2['body']['id']){delete _0x466df2[_0x6746('0x4e')]['id'];}return db[_0x6746('0x2f')][_0x6746('0x4c')]({'where':{'id':_0x466df2['params']['id']}})[_0x6746('0x28')](handleEntityNotFound(_0x452e36,null))[_0x6746('0x28')](saveUpdates(_0x466df2[_0x6746('0x4e')],null))['then'](respondWithResult(_0x452e36,null))['catch'](handleError(_0x452e36,null));};exports['destroy']=function(_0x1268b7,_0x38ceb3){return db[_0x6746('0x2f')]['find']({'where':{'id':_0x1268b7[_0x6746('0x48')]['id']}})['then'](handleEntityNotFound(_0x38ceb3,null))[_0x6746('0x28')](removeEntity(_0x38ceb3,null))['catch'](handleError(_0x38ceb3,null));};exports[_0x6746('0x4f')]=function(_0x58f06b,_0x33966c){return db[_0x6746('0x2f')][_0x6746('0x4f')]()['then'](respondWithResult(_0x33966c,null))[_0x6746('0x46')](handleError(_0x33966c,null));}; \ No newline at end of file +var _0x3614=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','name','UserProfileSection','rawAttributes','fieldName','type','key','map','query','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','findAll','rows','catch','keys','merge','find','create','body','params'];(function(_0x390747,_0x4a9422){var _0x1cfe82=function(_0x52d39a){while(--_0x52d39a){_0x390747['push'](_0x390747['shift']());}};_0x1cfe82(++_0x4a9422);}(_0x3614,0xd6));var _0x4361=function(_0x23cd86,_0x2c2823){_0x23cd86=_0x23cd86-0x0;var _0x92c822=_0x3614[_0x23cd86];return _0x92c822;};'use strict';var emlformat=require(_0x4361('0x0'));var rimraf=require(_0x4361('0x1'));var zipdir=require(_0x4361('0x2'));var jsonpatch=require(_0x4361('0x3'));var rp=require(_0x4361('0x4'));var moment=require(_0x4361('0x5'));var BPromise=require(_0x4361('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4361('0x7'));var sox=require('sox');var csv=require(_0x4361('0x8'));var ejs=require(_0x4361('0x9'));var fs=require('fs');var fs_extra=require(_0x4361('0xa'));var _=require('lodash');var squel=require(_0x4361('0xb'));var crypto=require(_0x4361('0xc'));var jsforce=require(_0x4361('0xd'));var deskjs=require(_0x4361('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4361('0xf'));var Papa=require(_0x4361('0x10'));var Redis=require(_0x4361('0x11'));var authService=require(_0x4361('0x12'));var qs=require(_0x4361('0x13'));var as=require(_0x4361('0x14'));var hardwareService=require(_0x4361('0x15'));var logger=require('../../config/logger')(_0x4361('0x16'));var utils=require('../../config/utils');var config=require(_0x4361('0x17'));var licenseUtil=require(_0x4361('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44f7e9,_0x129e8b){_0x129e8b=_0x129e8b||0xcc;return function(_0x20ea24){if(_0x20ea24){return _0x44f7e9[_0x4361('0x19')](_0x129e8b);}return _0x44f7e9[_0x4361('0x1a')](_0x129e8b)['end']();};}function respondWithResult(_0x38320b,_0x25bb51){_0x25bb51=_0x25bb51||0xc8;return function(_0x1b8666){if(_0x1b8666){return _0x38320b[_0x4361('0x1a')](_0x25bb51)[_0x4361('0x1b')](_0x1b8666);}};}function respondWithFilteredResult(_0x5b9c17,_0x52c1cb){return function(_0x55ec11){if(_0x55ec11){var _0x484b38=typeof _0x52c1cb[_0x4361('0x1c')]===_0x4361('0x1d')&&typeof _0x52c1cb[_0x4361('0x1e')]===_0x4361('0x1d');var _0x387fe0=_0x55ec11['count'];var _0x1b8462=_0x484b38?0x0:_0x52c1cb[_0x4361('0x1c')];var _0x30de4e=_0x484b38?_0x55ec11[_0x4361('0x1f')]:_0x52c1cb[_0x4361('0x1c')]+_0x52c1cb[_0x4361('0x1e')];var _0x39b1d1;if(_0x30de4e>=_0x387fe0){_0x30de4e=_0x387fe0;_0x39b1d1=0xc8;}else{_0x39b1d1=0xce;}_0x5b9c17['status'](_0x39b1d1);return _0x5b9c17[_0x4361('0x20')]('Content-Range',_0x1b8462+'-'+_0x30de4e+'/'+_0x387fe0)['json'](_0x55ec11);}return null;};}function patchUpdates(_0x412e41){return function(_0x29ec7b){try{jsonpatch[_0x4361('0x21')](_0x29ec7b,_0x412e41,!![]);}catch(_0xce69b){return BPromise[_0x4361('0x22')](_0xce69b);}return _0x29ec7b['save']();};}function saveUpdates(_0x55a92c,_0x4f0acc){return function(_0x119be8){if(_0x119be8){return _0x119be8[_0x4361('0x23')](_0x55a92c)[_0x4361('0x24')](function(_0x2b3e63){return _0x2b3e63;});}return null;};}function removeEntity(_0x3d6c21,_0xd5c7c3){return function(_0x28b04a){if(_0x28b04a){return _0x28b04a[_0x4361('0x25')]()['then'](function(){_0x3d6c21['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x125874,_0x293f98){return function(_0x16db53){if(!_0x16db53){_0x125874[_0x4361('0x19')](0x194);}return _0x16db53;};}function handleError(_0x5040fb,_0x388134){_0x388134=_0x388134||0x1f4;return function(_0x2a6b4e){logger[_0x4361('0x26')](_0x2a6b4e['stack']);if(_0x2a6b4e[_0x4361('0x27')]){delete _0x2a6b4e[_0x4361('0x27')];}_0x5040fb[_0x4361('0x1a')](_0x388134)['send'](_0x2a6b4e);};}exports['index']=function(_0xb19d8e,_0x25d150){var _0x318225={},_0x5b6e7a={},_0x214cf5={'count':0x0,'rows':[]};var _0x5422d3=_['map'](db[_0x4361('0x28')][_0x4361('0x29')],function(_0x27b4ea){return{'name':_0x27b4ea[_0x4361('0x2a')],'type':_0x27b4ea[_0x4361('0x2b')][_0x4361('0x2c')]};});_0x5b6e7a['model']=_[_0x4361('0x2d')](_0x5422d3,_0x4361('0x27'));_0x5b6e7a[_0x4361('0x2e')]=_['keys'](_0xb19d8e[_0x4361('0x2e')]);_0x5b6e7a['filters']=_[_0x4361('0x2f')](_0x5b6e7a['model'],_0x5b6e7a['query']);_0x318225[_0x4361('0x30')]=_['intersection'](_0x5b6e7a[_0x4361('0x31')],qs[_0x4361('0x32')](_0xb19d8e[_0x4361('0x2e')][_0x4361('0x32')]));_0x318225[_0x4361('0x30')]=_0x318225[_0x4361('0x30')][_0x4361('0x33')]?_0x318225['attributes']:_0x5b6e7a[_0x4361('0x31')];if(!_0xb19d8e[_0x4361('0x2e')][_0x4361('0x34')]('nolimit')){_0x318225['limit']=qs[_0x4361('0x1e')](_0xb19d8e[_0x4361('0x2e')][_0x4361('0x1e')]);_0x318225['offset']=qs[_0x4361('0x1c')](_0xb19d8e[_0x4361('0x2e')][_0x4361('0x1c')]);}_0x318225[_0x4361('0x35')]=qs['sort'](_0xb19d8e['query'][_0x4361('0x36')]);_0x318225[_0x4361('0x37')]=qs['filters'](_[_0x4361('0x38')](_0xb19d8e[_0x4361('0x2e')],_0x5b6e7a[_0x4361('0x39')]),_0x5422d3);if(_0xb19d8e['query'][_0x4361('0x3a')]){_0x318225[_0x4361('0x37')]=_['merge'](_0x318225[_0x4361('0x37')],{'$or':_[_0x4361('0x2d')](_0x5422d3,function(_0xdba1aa){if(_0xdba1aa[_0x4361('0x2b')]!==_0x4361('0x3b')){var _0x525e34={};_0x525e34[_0xdba1aa['name']]={'$like':'%'+_0xb19d8e['query']['filter']+'%'};return _0x525e34;}})});}_0x318225=_['merge']({},_0x318225,_0xb19d8e['options']);var _0x12bd91={'where':_0x318225[_0x4361('0x37')]};return db[_0x4361('0x28')]['count'](_0x12bd91)[_0x4361('0x24')](function(_0x3c44e4){_0x214cf5[_0x4361('0x1f')]=_0x3c44e4;if(_0xb19d8e['query'][_0x4361('0x3c')]){_0x318225['include']=[{'all':!![]}];}return db[_0x4361('0x28')][_0x4361('0x3d')](_0x318225);})[_0x4361('0x24')](function(_0x305473){_0x214cf5[_0x4361('0x3e')]=_0x305473;return _0x214cf5;})['then'](respondWithFilteredResult(_0x25d150,_0x318225))[_0x4361('0x3f')](handleError(_0x25d150,null));};exports['show']=function(_0x492537,_0x428976){var _0x5860c4={'raw':![],'where':{'id':_0x492537['params']['id']}},_0x296455={};_0x296455[_0x4361('0x31')]=_[_0x4361('0x40')](db[_0x4361('0x28')][_0x4361('0x29')]);_0x296455[_0x4361('0x2e')]=_[_0x4361('0x40')](_0x492537[_0x4361('0x2e')]);_0x296455['filters']=_[_0x4361('0x2f')](_0x296455['model'],_0x296455[_0x4361('0x2e')]);_0x5860c4[_0x4361('0x30')]=_[_0x4361('0x2f')](_0x296455['model'],qs[_0x4361('0x32')](_0x492537[_0x4361('0x2e')][_0x4361('0x32')]));_0x5860c4[_0x4361('0x30')]=_0x5860c4[_0x4361('0x30')]['length']?_0x5860c4[_0x4361('0x30')]:_0x296455[_0x4361('0x31')];if(_0x492537['query'][_0x4361('0x3c')]){_0x5860c4['include']=[{'all':!![]}];}_0x5860c4=_[_0x4361('0x41')]({},_0x5860c4,_0x492537['options']);return db[_0x4361('0x28')][_0x4361('0x42')](_0x5860c4)['then'](handleEntityNotFound(_0x428976,null))['then'](respondWithResult(_0x428976,null))['catch'](handleError(_0x428976,null));};exports[_0x4361('0x43')]=function(_0x50f72d,_0x4e085f){return db['UserProfileSection'][_0x4361('0x43')](_0x50f72d['body'],{})['then'](respondWithResult(_0x4e085f,0xc9))['catch'](handleError(_0x4e085f,null));};exports[_0x4361('0x23')]=function(_0x4e8b4b,_0x2fef70){if(_0x4e8b4b[_0x4361('0x44')]['id']){delete _0x4e8b4b[_0x4361('0x44')]['id'];}return db[_0x4361('0x28')][_0x4361('0x42')]({'where':{'id':_0x4e8b4b[_0x4361('0x45')]['id']}})['then'](handleEntityNotFound(_0x2fef70,null))[_0x4361('0x24')](saveUpdates(_0x4e8b4b[_0x4361('0x44')],null))['then'](respondWithResult(_0x2fef70,null))['catch'](handleError(_0x2fef70,null));};exports[_0x4361('0x25')]=function(_0x259db4,_0x4c3636){return db[_0x4361('0x28')][_0x4361('0x42')]({'where':{'id':_0x259db4[_0x4361('0x45')]['id']}})['then'](handleEntityNotFound(_0x4c3636,null))[_0x4361('0x24')](removeEntity(_0x4c3636,null))[_0x4361('0x3f')](handleError(_0x4c3636,null));};exports[_0x4361('0x46')]=function(_0x477b70,_0x8b36fa){return db['UserProfileSection'][_0x4361('0x46')]()[_0x4361('0x24')](respondWithResult(_0x8b36fa,null))[_0x4361('0x3f')](handleError(_0x8b36fa,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 1a427ec..308f3de 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 _0x9318=['user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','moment','request-promise','rimraf','./userProfileSection.attributes','define'];(function(_0x11bfd0,_0x3a3e2c){var _0x193310=function(_0x4c1ba6){while(--_0x4c1ba6){_0x11bfd0['push'](_0x11bfd0['shift']());}};_0x193310(++_0x3a3e2c);}(_0x9318,0x72));var _0x8931=function(_0x23b56d,_0x769483){_0x23b56d=_0x23b56d-0x0;var _0x3e2c6f=_0x9318[_0x23b56d];return _0x3e2c6f;};'use strict';var _=require(_0x8931('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8931('0x1'));var BPromise=require('bluebird');var rp=require(_0x8931('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8931('0x3'));var config=require('../../config/environment');var attributes=require(_0x8931('0x4'));module['exports']=function(_0x4e699d,_0x53d461){return _0x4e699d[_0x8931('0x5')]('UserProfileSection',attributes,{'tableName':_0x8931('0x6'),'paranoid':![],'indexes':[{'name':_0x8931('0x7'),'fields':[_0x8931('0x8'),_0x8931('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e99=['../../config/logger','moment','bluebird','path','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','compositeIndex','lodash'];(function(_0x48e05a,_0x12cd6e){var _0x4f5277=function(_0x543531){while(--_0x543531){_0x48e05a['push'](_0x48e05a['shift']());}};_0x4f5277(++_0x12cd6e);}(_0x2e99,0x1ee));var _0x92e9=function(_0x11dfe5,_0x6c3293){_0x11dfe5=_0x11dfe5-0x0;var _0x534746=_0x2e99[_0x11dfe5];return _0x534746;};'use strict';var _=require(_0x92e9('0x0'));var util=require('util');var logger=require(_0x92e9('0x1'))('api');var moment=require(_0x92e9('0x2'));var BPromise=require(_0x92e9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92e9('0x4'));var rimraf=require(_0x92e9('0x5'));var config=require('../../config/environment');var attributes=require(_0x92e9('0x6'));module[_0x92e9('0x7')]=function(_0x1f7ad2,_0x4fbf56){return _0x1f7ad2[_0x92e9('0x8')](_0x92e9('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x92e9('0xa'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 4390bdf..ec0b491 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 _0xbb41=['request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','code','error','UserProfileSection,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x411b98,_0x2c2331){var _0x374cd8=function(_0x162ee1){while(--_0x162ee1){_0x411b98['push'](_0x411b98['shift']());}};_0x374cd8(++_0x2c2331);}(_0xbb41,0xf9));var _0x1bb4=function(_0x394f03,_0x2016d1){_0x394f03=_0x394f03-0x0;var _0x4db2a0=_0xbb41[_0x394f03];return _0x4db2a0;};'use strict';var _=require(_0x1bb4('0x0'));var util=require(_0x1bb4('0x1'));var moment=require(_0x1bb4('0x2'));var BPromise=require(_0x1bb4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bb4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1bb4('0x5'));var logger=require(_0x1bb4('0x6'))(_0x1bb4('0x7'));var config=require(_0x1bb4('0x8'));var jayson=require(_0x1bb4('0x9'));var client=jayson[_0x1bb4('0xa')][_0x1bb4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab235,_0x5852ad,_0x2709c3){return new BPromise(function(_0x35a03c,_0x1350ae){return client[_0x1bb4('0xc')](_0x5ab235,_0x2709c3)[_0x1bb4('0xd')](function(_0x3f0468){logger[_0x1bb4('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x5852ad,_0x1bb4('0xf'));logger['debug'](_0x1bb4('0x10'),_0x5852ad,_0x1bb4('0xf'),JSON[_0x1bb4('0x11')](_0x3f0468));if(_0x3f0468['error']){if(_0x3f0468['error'][_0x1bb4('0x12')]===0x1f4){logger[_0x1bb4('0x13')](_0x1bb4('0x14'),_0x5852ad,_0x3f0468[_0x1bb4('0x13')][_0x1bb4('0x15')]);return _0x1350ae(_0x3f0468[_0x1bb4('0x13')][_0x1bb4('0x15')]);}logger[_0x1bb4('0x13')](_0x1bb4('0x14'),_0x5852ad,_0x3f0468[_0x1bb4('0x13')][_0x1bb4('0x15')]);return _0x35a03c(_0x3f0468[_0x1bb4('0x13')]['message']);}else{logger[_0x1bb4('0xe')](_0x1bb4('0x14'),_0x5852ad,_0x1bb4('0xf'));_0x35a03c(_0x3f0468['result']['message']);}})['catch'](function(_0x25265e){logger[_0x1bb4('0x13')](_0x1bb4('0x14'),_0x5852ad,_0x25265e);_0x1350ae(_0x25265e);});});} \ No newline at end of file +var _0xa5e4=['then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x164355,_0x5cec00){var _0x9e2b52=function(_0xd469db){while(--_0xd469db){_0x164355['push'](_0x164355['shift']());}};_0x9e2b52(++_0x5cec00);}(_0xa5e4,0x163));var _0x4a5e=function(_0x47da5a,_0x1eb47c){_0x47da5a=_0x47da5a-0x0;var _0x4ed183=_0xa5e4[_0x47da5a];return _0x4ed183;};'use strict';var _=require(_0x4a5e('0x0'));var util=require(_0x4a5e('0x1'));var moment=require(_0x4a5e('0x2'));var BPromise=require(_0x4a5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a5e('0x4'));var db=require(_0x4a5e('0x5'))['db'];var utils=require(_0x4a5e('0x6'));var logger=require(_0x4a5e('0x7'))(_0x4a5e('0x8'));var config=require(_0x4a5e('0x9'));var jayson=require(_0x4a5e('0xa'));var client=jayson[_0x4a5e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36bde4,_0x25f959,_0x2fe63f){return new BPromise(function(_0x18b0ae,_0x59a70a){return client[_0x4a5e('0xc')](_0x36bde4,_0x2fe63f)[_0x4a5e('0xd')](function(_0x3fbb28){logger['info'](_0x4a5e('0xe'),_0x25f959,_0x4a5e('0xf'));logger[_0x4a5e('0x10')](_0x4a5e('0x11'),_0x25f959,_0x4a5e('0xf'),JSON[_0x4a5e('0x12')](_0x3fbb28));if(_0x3fbb28[_0x4a5e('0x13')]){if(_0x3fbb28[_0x4a5e('0x13')][_0x4a5e('0x14')]===0x1f4){logger[_0x4a5e('0x13')](_0x4a5e('0xe'),_0x25f959,_0x3fbb28['error']['message']);return _0x59a70a(_0x3fbb28[_0x4a5e('0x13')][_0x4a5e('0x15')]);}logger[_0x4a5e('0x13')](_0x4a5e('0xe'),_0x25f959,_0x3fbb28[_0x4a5e('0x13')]['message']);return _0x18b0ae(_0x3fbb28[_0x4a5e('0x13')][_0x4a5e('0x15')]);}else{logger['info'](_0x4a5e('0xe'),_0x25f959,'request\x20sent');_0x18b0ae(_0x3fbb28[_0x4a5e('0x16')][_0x4a5e('0x15')]);}})['catch'](function(_0x509d9e){logger[_0x4a5e('0x13')](_0x4a5e('0xe'),_0x25f959,_0x509d9e);_0x59a70a(_0x509d9e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index a2bbf73..fac5b18 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x547359,_0x46573a){var _0x2da331=function(_0x261a0c){while(--_0x261a0c){_0x547359['push'](_0x547359['shift']());}};_0x2da331(++_0x46573a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x409251,_0x40f525){var _0x216f47=function(_0x517895){while(--_0x517895){_0x409251['push'](_0x409251['shift']());}};_0x216f47(++_0x40f525);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index eee7047..ae34b92 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 _0xac92=['exports','sequelize'];(function(_0x3323a7,_0x1bb7ab){var _0x2cf012=function(_0x88a043){while(--_0x88a043){_0x3323a7['push'](_0x3323a7['shift']());}};_0x2cf012(++_0x1bb7ab);}(_0xac92,0xdd));var _0x2ac9=function(_0x1f4c99,_0x3290c1){_0x1f4c99=_0x1f4c99-0x0;var _0x50e9fa=_0xac92[_0x1f4c99];return _0x50e9fa;};'use strict';var Sequelize=require(_0x2ac9('0x0'));module[_0x2ac9('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6b42=['exports','INTEGER','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6b42,0x173));var _0x26b4=function(_0x22bd97,_0x3bab59){_0x22bd97=_0x22bd97-0x0;var _0x1fb185=_0x6b42[_0x22bd97];return _0x1fb185;};'use strict';var Sequelize=require(_0x26b4('0x0'));module[_0x26b4('0x1')]={'penalty':{'type':Sequelize[_0x26b4('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 ef8aea2..6d53494 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 _0xba18=['moment','bluebird','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x5f0e89,_0x546dea){var _0x3007e=function(_0xaf3ba6){while(--_0xaf3ba6){_0x5f0e89['push'](_0x5f0e89['shift']());}};_0x3007e(++_0x546dea);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var util=require(_0x8ba1('0x1'));var logger=require(_0x8ba1('0x2'))(_0x8ba1('0x3'));var moment=require(_0x8ba1('0x4'));var BPromise=require(_0x8ba1('0x5'));var rp=require(_0x8ba1('0x6'));var fs=require('fs');var path=require(_0x8ba1('0x7'));var rimraf=require('rimraf');var config=require(_0x8ba1('0x8'));var attributes=require(_0x8ba1('0x9'));module[_0x8ba1('0xa')]=function(_0x2a9dab,_0x3b107c){return _0x2a9dab[_0x8ba1('0xb')]('UserSmsQueue',attributes,{'tableName':_0x8ba1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bd9=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0x9bd9[_0x58ae8a];return _0x2f0b6b;};'use strict';var _=require(_0x99bd('0x0'));var util=require(_0x99bd('0x1'));var logger=require(_0x99bd('0x2'))(_0x99bd('0x3'));var moment=require(_0x99bd('0x4'));var BPromise=require(_0x99bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99bd('0x6'));var rimraf=require('rimraf');var config=require(_0x99bd('0x7'));var attributes=require(_0x99bd('0x8'));module['exports']=function(_0xa1cd99,_0x45b939){return _0xa1cd99[_0x99bd('0x9')](_0x99bd('0xa'),attributes,{'tableName':_0x99bd('0xb'),'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 9fa8a81..883e040 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 _0xa0fa=['jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x2eeac9,_0x237c90){var _0x167774=function(_0x22f28b){while(--_0x22f28b){_0x2eeac9['push'](_0x2eeac9['shift']());}};_0x167774(++_0x237c90);}(_0xa0fa,0x15f));var _0xaa0f=function(_0x3b1821,_0x2a19ba){_0x3b1821=_0x3b1821-0x0;var _0x5e9451=_0xa0fa[_0x3b1821];return _0x5e9451;};'use strict';var _=require(_0xaa0f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa0f('0x1'));var rs=require(_0xaa0f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa0f('0x3'))['db'];var utils=require(_0xaa0f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xaa0f('0x5'));var jayson=require(_0xaa0f('0x6'));var client=jayson[_0xaa0f('0x7')][_0xaa0f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x508458,_0x212cbb,_0x8394d4){return new BPromise(function(_0xa78e84,_0x1006de){return client[_0xaa0f('0x9')](_0x508458,_0x8394d4)[_0xaa0f('0xa')](function(_0x2b5e4d){logger[_0xaa0f('0xb')](_0xaa0f('0xc'),_0x212cbb,_0xaa0f('0xd'));logger[_0xaa0f('0xe')](_0xaa0f('0xf'),_0x212cbb,_0xaa0f('0xd'),JSON[_0xaa0f('0x10')](_0x2b5e4d));if(_0x2b5e4d[_0xaa0f('0x11')]){if(_0x2b5e4d[_0xaa0f('0x11')]['code']===0x1f4){logger[_0xaa0f('0x11')](_0xaa0f('0xc'),_0x212cbb,_0x2b5e4d[_0xaa0f('0x11')][_0xaa0f('0x12')]);return _0x1006de(_0x2b5e4d[_0xaa0f('0x11')][_0xaa0f('0x12')]);}logger[_0xaa0f('0x11')](_0xaa0f('0xc'),_0x212cbb,_0x2b5e4d[_0xaa0f('0x11')][_0xaa0f('0x12')]);return _0xa78e84(_0x2b5e4d[_0xaa0f('0x11')][_0xaa0f('0x12')]);}else{logger['info'](_0xaa0f('0xc'),_0x212cbb,_0xaa0f('0xd'));_0xa78e84(_0x2b5e4d[_0xaa0f('0x13')][_0xaa0f('0x12')]);}})[_0xaa0f('0x14')](function(_0x5c1674){logger[_0xaa0f('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x212cbb,_0x5c1674);_0x1006de(_0x5c1674);});});} \ No newline at end of file +var _0x4a3f=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2ee306,_0x222039){var _0x141c3f=function(_0x450946){while(--_0x450946){_0x2ee306['push'](_0x2ee306['shift']());}};_0x141c3f(++_0x222039);}(_0x4a3f,0xbe));var _0xf4a3=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x4a3f[_0x3e7804];return _0x56efda;};'use strict';var _=require(_0xf4a3('0x0'));var util=require(_0xf4a3('0x1'));var moment=require(_0xf4a3('0x2'));var BPromise=require(_0xf4a3('0x3'));var rs=require(_0xf4a3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4a3('0x5'))['db'];var utils=require(_0xf4a3('0x6'));var logger=require(_0xf4a3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf4a3('0x8'));var client=jayson['client'][_0xf4a3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32c850,_0x527d9c,_0x3ad3ea){return new BPromise(function(_0x4d3d4a,_0x370e4e){return client[_0xf4a3('0xa')](_0x32c850,_0x3ad3ea)[_0xf4a3('0xb')](function(_0xc1ab97){logger[_0xf4a3('0xc')](_0xf4a3('0xd'),_0x527d9c,_0xf4a3('0xe'));logger[_0xf4a3('0xf')](_0xf4a3('0x10'),_0x527d9c,_0xf4a3('0xe'),JSON[_0xf4a3('0x11')](_0xc1ab97));if(_0xc1ab97[_0xf4a3('0x12')]){if(_0xc1ab97[_0xf4a3('0x12')][_0xf4a3('0x13')]===0x1f4){logger['error'](_0xf4a3('0xd'),_0x527d9c,_0xc1ab97[_0xf4a3('0x12')][_0xf4a3('0x14')]);return _0x370e4e(_0xc1ab97[_0xf4a3('0x12')]['message']);}logger[_0xf4a3('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x527d9c,_0xc1ab97[_0xf4a3('0x12')]['message']);return _0x4d3d4a(_0xc1ab97[_0xf4a3('0x12')][_0xf4a3('0x14')]);}else{logger[_0xf4a3('0xc')](_0xf4a3('0xd'),_0x527d9c,_0xf4a3('0xe'));_0x4d3d4a(_0xc1ab97[_0xf4a3('0x15')][_0xf4a3('0x14')]);}})[_0xf4a3('0x16')](function(_0x5c4243){logger['error'](_0xf4a3('0xd'),_0x527d9c,_0x5c4243);_0x370e4e(_0x5c4243);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 26b93a1..10fd617 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 _0xbf4e=['exports','sequelize'];(function(_0x46afbc,_0x1703f9){var _0x4ba683=function(_0x157d40){while(--_0x157d40){_0x46afbc['push'](_0x46afbc['shift']());}};_0x4ba683(++_0x1703f9);}(_0xbf4e,0x131));var _0xebf4=function(_0x1e2cc9,_0x79d31b){_0x1e2cc9=_0x1e2cc9-0x0;var _0xce86f8=_0xbf4e[_0x1e2cc9];return _0xce86f8;};'use strict';var Sequelize=require(_0xebf4('0x0'));module[_0xebf4('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb838=['sequelize','exports','INTEGER'];(function(_0x1ffb42,_0x37ed4a){var _0x115b28=function(_0x1b4995){while(--_0x1b4995){_0x1ffb42['push'](_0x1ffb42['shift']());}};_0x115b28(++_0x37ed4a);}(_0xb838,0x1a4));var _0x8b83=function(_0x9913c3,_0x4239e2){_0x9913c3=_0x9913c3-0x0;var _0x585654=_0xb838[_0x9913c3];return _0x585654;};'use strict';var Sequelize=require(_0x8b83('0x0'));module[_0x8b83('0x1')]={'UserId':{'type':Sequelize[_0x8b83('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x8b83('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index e5aa355..94bbd6e 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(_0x51e0a8,_0x5fde09){var _0x1783bb=function(_0x137ce4){while(--_0x137ce4){_0x51e0a8['push'](_0x51e0a8['shift']());}};_0x1783bb(++_0x5fde09);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x48eb37,_0x157583){var _0x30e855=function(_0x5ebecc){while(--_0x5ebecc){_0x48eb37['push'](_0x48eb37['shift']());}};_0x30e855(++_0x157583);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 f04373c..b6b748a 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1b9e8f,_0x3cda92){var _0x3e8621=function(_0x27e6ef){while(--_0x27e6ef){_0x1b9e8f['push'](_0x1b9e8f['shift']());}};_0x3e8621(++_0x3cda92);}(_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(_0x1510c5,_0xde9022){var _0x433a86=function(_0x114896){while(--_0x114896){_0x1510c5['push'](_0x1510c5['shift']());}};_0x433a86(++_0xde9022);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 1f3f50f..d740d3d 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 _0x7735=['INTEGER','sequelize','exports'];(function(_0xe5f0ee,_0x1674b8){var _0x41c382=function(_0xecad5d){while(--_0xecad5d){_0xe5f0ee['push'](_0xe5f0ee['shift']());}};_0x41c382(++_0x1674b8);}(_0x7735,0x70));var _0x5773=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7735[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x5773('0x0'));module[_0x5773('0x1')]={'penalty':{'type':Sequelize[_0x5773('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x60bf=['exports'];(function(_0x56d0d9,_0x57e46e){var _0x35f96d=function(_0x5a87e2){while(--_0x5a87e2){_0x56d0d9['push'](_0x56d0d9['shift']());}};_0x35f96d(++_0x57e46e);}(_0x60bf,0x91));var _0xf60b=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x60bf[_0x468b0f];return _0x3e74d9;};'use strict';var Sequelize=require('sequelize');module[_0xf60b('0x0')]={'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 5e93793..159c6c7 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 _0x6693=['moment','bluebird','path','rimraf','../../config/environment','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x6693,0x104));var _0x3669=function(_0x57b3d3,_0x57db08){_0x57b3d3=_0x57b3d3-0x0;var _0x3af4aa=_0x6693[_0x57b3d3];return _0x3af4aa;};'use strict';var _=require(_0x3669('0x0'));var util=require(_0x3669('0x1'));var logger=require(_0x3669('0x2'))(_0x3669('0x3'));var moment=require(_0x3669('0x4'));var BPromise=require(_0x3669('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3669('0x6'));var rimraf=require(_0x3669('0x7'));var config=require(_0x3669('0x8'));var attributes=require('./userVoiceQueue.attributes');module[_0x3669('0x9')]=function(_0x5829da,_0x4ace07){return _0x5829da['define'](_0x3669('0xa'),attributes,{'tableName':_0x3669('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7065=['moment','request-promise','path','rimraf','../../config/environment','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','api'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7065,0x1cb));var _0x5706=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7065[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5706('0x0'));var util=require(_0x5706('0x1'));var logger=require('../../config/logger')(_0x5706('0x2'));var moment=require(_0x5706('0x3'));var BPromise=require('bluebird');var rp=require(_0x5706('0x4'));var fs=require('fs');var path=require(_0x5706('0x5'));var rimraf=require(_0x5706('0x6'));var config=require(_0x5706('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0x5706('0x8')]=function(_0x2d8a1c,_0x14e7ec){return _0x2d8a1c['define'](_0x5706('0x9'),attributes,{'tableName':_0x5706('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index a092f5f..25d5b1c 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 _0x91f5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x47f533,_0x497666){var _0x2fc95a=function(_0x282b80){while(--_0x282b80){_0x47f533['push'](_0x47f533['shift']());}};_0x2fc95a(++_0x497666);}(_0x91f5,0x14d));var _0x591f=function(_0xef9ec2,_0x4c163f){_0xef9ec2=_0xef9ec2-0x0;var _0x15686c=_0x91f5[_0xef9ec2];return _0x15686c;};'use strict';var _=require(_0x591f('0x0'));var util=require(_0x591f('0x1'));var moment=require(_0x591f('0x2'));var BPromise=require('bluebird');var rs=require(_0x591f('0x3'));var fs=require('fs');var Redis=require(_0x591f('0x4'));var db=require(_0x591f('0x5'))['db'];var utils=require(_0x591f('0x6'));var logger=require(_0x591f('0x7'))(_0x591f('0x8'));var config=require(_0x591f('0x9'));var jayson=require(_0x591f('0xa'));var client=jayson[_0x591f('0xb')][_0x591f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2253cc,_0x584d54,_0x38237e){return new BPromise(function(_0x164b01,_0x36ba27){return client[_0x591f('0xd')](_0x2253cc,_0x38237e)[_0x591f('0xe')](function(_0x41ab7f){logger[_0x591f('0xf')](_0x591f('0x10'),_0x584d54,_0x591f('0x11'));logger['debug'](_0x591f('0x12'),_0x584d54,_0x591f('0x11'),JSON['stringify'](_0x41ab7f));if(_0x41ab7f[_0x591f('0x13')]){if(_0x41ab7f[_0x591f('0x13')][_0x591f('0x14')]===0x1f4){logger[_0x591f('0x13')](_0x591f('0x10'),_0x584d54,_0x41ab7f['error'][_0x591f('0x15')]);return _0x36ba27(_0x41ab7f[_0x591f('0x13')]['message']);}logger[_0x591f('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x584d54,_0x41ab7f['error'][_0x591f('0x15')]);return _0x164b01(_0x41ab7f[_0x591f('0x13')]['message']);}else{logger[_0x591f('0xf')](_0x591f('0x10'),_0x584d54,_0x591f('0x11'));_0x164b01(_0x41ab7f[_0x591f('0x16')][_0x591f('0x15')]);}})[_0x591f('0x17')](function(_0x316cb0){logger[_0x591f('0x13')](_0x591f('0x10'),_0x584d54,_0x316cb0);_0x36ba27(_0x316cb0);});});} \ No newline at end of file +var _0x1b54=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch'];(function(_0x284daf,_0x2a0d8f){var _0x15f190=function(_0x516787){while(--_0x516787){_0x284daf['push'](_0x284daf['shift']());}};_0x15f190(++_0x2a0d8f);}(_0x1b54,0x1b8));var _0x41b5=function(_0x3645cc,_0x25ba47){_0x3645cc=_0x3645cc-0x0;var _0x351979=_0x1b54[_0x3645cc];return _0x351979;};'use strict';var _=require(_0x41b5('0x0'));var util=require(_0x41b5('0x1'));var moment=require(_0x41b5('0x2'));var BPromise=require(_0x41b5('0x3'));var rs=require(_0x41b5('0x4'));var fs=require('fs');var Redis=require(_0x41b5('0x5'));var db=require(_0x41b5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x41b5('0x7'))(_0x41b5('0x8'));var config=require(_0x41b5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x41b5('0xa')][_0x41b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41a778,_0x4326d6,_0x1acc42){return new BPromise(function(_0x404064,_0x2d75ff){return client['request'](_0x41a778,_0x1acc42)[_0x41b5('0xc')](function(_0x45fbd3){logger['info'](_0x41b5('0xd'),_0x4326d6,_0x41b5('0xe'));logger[_0x41b5('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4326d6,'request\x20sent',JSON[_0x41b5('0x10')](_0x45fbd3));if(_0x45fbd3['error']){if(_0x45fbd3[_0x41b5('0x11')][_0x41b5('0x12')]===0x1f4){logger[_0x41b5('0x11')](_0x41b5('0xd'),_0x4326d6,_0x45fbd3[_0x41b5('0x11')]['message']);return _0x2d75ff(_0x45fbd3[_0x41b5('0x11')][_0x41b5('0x13')]);}logger[_0x41b5('0x11')](_0x41b5('0xd'),_0x4326d6,_0x45fbd3[_0x41b5('0x11')][_0x41b5('0x13')]);return _0x404064(_0x45fbd3[_0x41b5('0x11')][_0x41b5('0x13')]);}else{logger[_0x41b5('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x4326d6,_0x41b5('0xe'));_0x404064(_0x45fbd3['result'][_0x41b5('0x13')]);}})[_0x41b5('0x15')](function(_0x481936){logger[_0x41b5('0x11')](_0x41b5('0xd'),_0x4326d6,_0x481936);_0x2d75ff(_0x481936);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 5ecf7be..8e9cbb1 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x157d8c,_0x6e85b){var _0x1b1e5e=function(_0x4daf53){while(--_0x4daf53){_0x157d8c['push'](_0x157d8c['shift']());}};_0x1b1e5e(++_0x6e85b);}(_0xe706,0xa3));var _0x6e70=function(_0x544362,_0xc31c04){_0x544362=_0x544362-0x0;var _0x5c12f9=_0xe706[_0x544362];return _0x5c12f9;};'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(_0x5c9a47,_0x533bc1){var _0x44f929=function(_0xbdaf0b){while(--_0xbdaf0b){_0x5c9a47['push'](_0x5c9a47['shift']());}};_0x44f929(++_0x533bc1);}(_0xe706,0xa3));var _0x6e70=function(_0x2d8fdb,_0x30e70c){_0x2d8fdb=_0x2d8fdb-0x0;var _0x3bc1c2=_0xe706[_0x2d8fdb];return _0x3bc1c2;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index feaf00b..df7917f 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 _0x244e=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x4009db,_0x40376e){var _0x57e02a=function(_0x5e39a1){while(--_0x5e39a1){_0x4009db['push'](_0x4009db['shift']());}};_0x57e02a(++_0x40376e);}(_0x244e,0x1e9));var _0xe244=function(_0x4c5b19,_0x4d16ac){_0x4c5b19=_0x4c5b19-0x0;var _0x245588=_0x244e[_0x4c5b19];return _0x245588;};'use strict';var Sequelize=require(_0xe244('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe244('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xe244('0x2')},'membername':{'type':Sequelize[_0xe244('0x3')],'allowNull':![],'comment':_0xe244('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe244('0x4'),'comment':_0xe244('0x2')},'VoiceQueueId':{'type':Sequelize[_0xe244('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xe244('0x3')],'allowNull':![],'unique':_0xe244('0x4'),'comment':_0xe244('0x2')},'penalty':{'type':Sequelize[_0xe244('0x1')](0xb),'defaultValue':0x0,'comment':_0xe244('0x2')},'paused':{'type':Sequelize[_0xe244('0x1')](0xb),'defaultValue':0x0,'comment':_0xe244('0x2')}}; \ No newline at end of file +var _0x06f8=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x4ec0fd,_0x3b9dc5){var _0x2791e8=function(_0x45ef19){while(--_0x45ef19){_0x4ec0fd['push'](_0x4ec0fd['shift']());}};_0x2791e8(++_0x3b9dc5);}(_0x06f8,0x167));var _0x806f=function(_0x1465dc,_0x4d684d){_0x1465dc=_0x1465dc-0x0;var _0x226206=_0x06f8[_0x1465dc];return _0x226206;};'use strict';var Sequelize=require(_0x806f('0x0'));module[_0x806f('0x1')]={'uniqueid':{'type':Sequelize[_0x806f('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x806f('0x3')},'membername':{'type':Sequelize[_0x806f('0x4')],'allowNull':![],'comment':_0x806f('0x3')},'UserId':{'type':Sequelize[_0x806f('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x806f('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x806f('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x806f('0x3')},'penalty':{'type':Sequelize[_0x806f('0x2')](0xb),'defaultValue':0x0,'comment':_0x806f('0x3')},'paused':{'type':Sequelize[_0x806f('0x2')](0xb),'defaultValue':0x0,'comment':_0x806f('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 3005883..d3fd7a1 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 _0x1444=['emit','hook','exports','events','UserVoiceQueueRt','setMaxListeners','save','update','remove'];(function(_0x43ad55,_0x50512c){var _0x2cd604=function(_0x516b5a){while(--_0x516b5a){_0x43ad55['push'](_0x43ad55['shift']());}};_0x2cd604(++_0x50512c);}(_0x1444,0x1d7));var _0x4144=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x1444[_0x1589dd];return _0x1bddd1;};'use strict';var EventEmitter=require(_0x4144('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x4144('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x4144('0x2')](0x0);var events={'afterCreate':_0x4144('0x3'),'afterUpdate':_0x4144('0x4'),'afterDestroy':_0x4144('0x5')};function emitEvent(_0x6849f5){return function(_0x18afdf,_0x473973,_0x46b61a){UserVoiceQueueRtEvents[_0x4144('0x6')](_0x6849f5+':'+_0x18afdf['id'],_0x18afdf);UserVoiceQueueRtEvents[_0x4144('0x6')](_0x6849f5,_0x18afdf);_0x46b61a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x4144('0x7')](e,emitEvent(event));}}module[_0x4144('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xa9f8=['hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa9f8,0xd1));var _0x8a9f=function(_0x7f4eb9,_0x36faa9){_0x7f4eb9=_0x7f4eb9-0x0;var _0xcbb8bd=_0xa9f8[_0x7f4eb9];return _0xcbb8bd;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x8a9f('0x0'))['db'][_0x8a9f('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x8a9f('0x2')](0x0);var events={'afterCreate':_0x8a9f('0x3'),'afterUpdate':_0x8a9f('0x4'),'afterDestroy':_0x8a9f('0x5')};function emitEvent(_0x3767a8){return function(_0x2fd238,_0x47bd27,_0x2d1c2b){UserVoiceQueueRtEvents[_0x8a9f('0x6')](_0x3767a8+':'+_0x2fd238['id'],_0x2fd238);UserVoiceQueueRtEvents['emit'](_0x3767a8,_0x2fd238);_0x2d1c2b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x8a9f('0x7')](e,emitEvent(event));}}module[_0x8a9f('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 790b344..e27553e 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 _0xd0ff=['UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define'];(function(_0x34b819,_0x2db518){var _0x463ab2=function(_0x2a8a29){while(--_0x2a8a29){_0x34b819['push'](_0x34b819['shift']());}};_0x463ab2(++_0x2db518);}(_0xd0ff,0x16a));var _0xfd0f=function(_0x429a21,_0x43b4e0){_0x429a21=_0x429a21-0x0;var _0x3a8c04=_0xd0ff[_0x429a21];return _0x3a8c04;};'use strict';var _=require(_0xfd0f('0x0'));var util=require(_0xfd0f('0x1'));var logger=require('../../config/logger')(_0xfd0f('0x2'));var moment=require(_0xfd0f('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd0f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd0f('0x5'));var config=require(_0xfd0f('0x6'));var attributes=require(_0xfd0f('0x7'));module[_0xfd0f('0x8')]=function(_0xbef11b,_0x25b247){return _0xbef11b[_0xfd0f('0x9')](_0xfd0f('0xa'),attributes,{'tableName':_0xfd0f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d1f=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt'];(function(_0x2800f0,_0x296142){var _0x4be041=function(_0x5aa1aa){while(--_0x5aa1aa){_0x2800f0['push'](_0x2800f0['shift']());}};_0x4be041(++_0x296142);}(_0x7d1f,0xdc));var _0xf7d1=function(_0x264de2,_0x571dd2){_0x264de2=_0x264de2-0x0;var _0x1a2c1d=_0x7d1f[_0x264de2];return _0x1a2c1d;};'use strict';var _=require('lodash');var util=require(_0xf7d1('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf7d1('0x1'));var BPromise=require(_0xf7d1('0x2'));var rp=require(_0xf7d1('0x3'));var fs=require('fs');var path=require(_0xf7d1('0x4'));var rimraf=require(_0xf7d1('0x5'));var config=require(_0xf7d1('0x6'));var attributes=require(_0xf7d1('0x7'));module[_0xf7d1('0x8')]=function(_0x440388,_0x48eca4){return _0x440388[_0xf7d1('0x9')]('UserVoiceQueueRt',attributes,{'tableName':_0xf7d1('0xa'),'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 7d24d70..1bc9e75 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 _0x3e6f=['socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults'];(function(_0xfb7421,_0x2b088d){var _0x267801=function(_0x2da39c){while(--_0x2da39c){_0xfb7421['push'](_0xfb7421['shift']());}};_0x267801(++_0x2b088d);}(_0x3e6f,0x104));var _0xf3e6=function(_0x33091e,_0x5f0229){_0x33091e=_0x33091e-0x0;var _0x59c1b1=_0x3e6f[_0x33091e];return _0x59c1b1;};'use strict';var _=require(_0xf3e6('0x0'));var util=require(_0xf3e6('0x1'));var moment=require(_0xf3e6('0x2'));var BPromise=require(_0xf3e6('0x3'));var rs=require(_0xf3e6('0x4'));var fs=require('fs');var Redis=require(_0xf3e6('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf3e6('0x6'))(_0xf3e6('0x7'));var config=require(_0xf3e6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf3e6('0x9')][_0xf3e6('0xa')]({'port':0x232a});config[_0xf3e6('0xb')]=_[_0xf3e6('0xc')](config[_0xf3e6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf3e6('0xd'))(new Redis(config[_0xf3e6('0xb')]));require(_0xf3e6('0xe'))[_0xf3e6('0xf')](socket);function respondWithRpcPromise(_0x49c585,_0x20df1f,_0x178f7d){return new BPromise(function(_0xb7da13,_0x3e52b7){return client[_0xf3e6('0x10')](_0x49c585,_0x178f7d)['then'](function(_0x2bfde1){logger[_0xf3e6('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x20df1f,_0xf3e6('0x12'));logger['debug'](_0xf3e6('0x13'),_0x20df1f,'request\x20sent',JSON[_0xf3e6('0x14')](_0x2bfde1));if(_0x2bfde1[_0xf3e6('0x15')]){if(_0x2bfde1[_0xf3e6('0x15')]['code']===0x1f4){logger['error'](_0xf3e6('0x16'),_0x20df1f,_0x2bfde1[_0xf3e6('0x15')][_0xf3e6('0x17')]);return _0x3e52b7(_0x2bfde1[_0xf3e6('0x15')][_0xf3e6('0x17')]);}logger['error'](_0xf3e6('0x16'),_0x20df1f,_0x2bfde1[_0xf3e6('0x15')][_0xf3e6('0x17')]);return _0xb7da13(_0x2bfde1[_0xf3e6('0x15')]['message']);}else{logger[_0xf3e6('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x20df1f,_0xf3e6('0x12'));_0xb7da13(_0x2bfde1[_0xf3e6('0x18')][_0xf3e6('0x17')]);}})[_0xf3e6('0x19')](function(_0x345192){logger[_0xf3e6('0x15')](_0xf3e6('0x16'),_0x20df1f,_0x345192);_0x3e52b7(_0x345192);});});}exports[_0xf3e6('0x1a')]=function(_0x4582db){var _0x445444=this;return new Promise(function(_0x55646f,_0x246290){return db[_0xf3e6('0x1b')][_0xf3e6('0x1c')]({'raw':_0x4582db[_0xf3e6('0x1d')]?_0x4582db[_0xf3e6('0x1d')][_0xf3e6('0x1e')]===undefined?!![]:![]:!![],'where':_0x4582db[_0xf3e6('0x1d')]?_0x4582db[_0xf3e6('0x1d')][_0xf3e6('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0xf3e6('0x20'),db[_0xf3e6('0x21')]['fn']('IF',db[_0xf3e6('0x21')][_0xf3e6('0x22')](_0xf3e6('0x23')))),_0xf3e6('0x24')]]})[_0xf3e6('0x25')](function(_0x3b81e5){logger[_0xf3e6('0x11')]('GetVoiceQueueRtPauses',_0x4582db);logger[_0xf3e6('0x26')](_0xf3e6('0x1a'),_0x4582db,JSON[_0xf3e6('0x14')](_0x3b81e5));_0x55646f(_0x3b81e5);})[_0xf3e6('0x19')](function(_0x11f621){logger[_0xf3e6('0x15')](_0xf3e6('0x1a'),_0x11f621[_0xf3e6('0x17')],_0x4582db);_0x246290(_0x445444[_0xf3e6('0x15')](0x1f4,_0x11f621[_0xf3e6('0x17')]));});});}; \ No newline at end of file +var _0x56f3=['catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','defaults','redis','localhost','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','result'];(function(_0x119160,_0x3a4780){var _0x114aa4=function(_0x59c4ed){while(--_0x59c4ed){_0x119160['push'](_0x119160['shift']());}};_0x114aa4(++_0x3a4780);}(_0x56f3,0x113));var _0x356f=function(_0x50d265,_0x1b311b){_0x50d265=_0x50d265-0x0;var _0x2a6bee=_0x56f3[_0x50d265];return _0x2a6bee;};'use strict';var _=require(_0x356f('0x0'));var util=require(_0x356f('0x1'));var moment=require(_0x356f('0x2'));var BPromise=require(_0x356f('0x3'));var rs=require(_0x356f('0x4'));var fs=require('fs');var Redis=require(_0x356f('0x5'));var db=require(_0x356f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x356f('0x7'));var config=require('../../config/environment');var jayson=require(_0x356f('0x8'));var client=jayson[_0x356f('0x9')][_0x356f('0xa')]({'port':0x232a});config['redis']=_[_0x356f('0xb')](config[_0x356f('0xc')],{'host':_0x356f('0xd'),'port':0x18eb});var socket=require(_0x356f('0xe'))(new Redis(config[_0x356f('0xc')]));require(_0x356f('0xf'))[_0x356f('0x10')](socket);function respondWithRpcPromise(_0x45ce5b,_0x4db48d,_0x48af95){return new BPromise(function(_0x191c4d,_0x508814){return client[_0x356f('0x11')](_0x45ce5b,_0x48af95)[_0x356f('0x12')](function(_0x126cad){logger['info'](_0x356f('0x13'),_0x4db48d,_0x356f('0x14'));logger[_0x356f('0x15')](_0x356f('0x16'),_0x4db48d,'request\x20sent',JSON[_0x356f('0x17')](_0x126cad));if(_0x126cad[_0x356f('0x18')]){if(_0x126cad['error'][_0x356f('0x19')]===0x1f4){logger[_0x356f('0x18')](_0x356f('0x13'),_0x4db48d,_0x126cad[_0x356f('0x18')][_0x356f('0x1a')]);return _0x508814(_0x126cad[_0x356f('0x18')][_0x356f('0x1a')]);}logger[_0x356f('0x18')](_0x356f('0x13'),_0x4db48d,_0x126cad['error'][_0x356f('0x1a')]);return _0x191c4d(_0x126cad[_0x356f('0x18')][_0x356f('0x1a')]);}else{logger[_0x356f('0x1b')](_0x356f('0x13'),_0x4db48d,_0x356f('0x14'));_0x191c4d(_0x126cad[_0x356f('0x1c')][_0x356f('0x1a')]);}})[_0x356f('0x1d')](function(_0x29f16e){logger[_0x356f('0x18')](_0x356f('0x13'),_0x4db48d,_0x29f16e);_0x508814(_0x29f16e);});});}exports[_0x356f('0x1e')]=function(_0x8aa75a){var _0x355d27=this;return new Promise(function(_0x3f9ef9,_0x36aa0e){return db[_0x356f('0x1f')]['findAll']({'raw':_0x8aa75a[_0x356f('0x20')]?_0x8aa75a[_0x356f('0x20')][_0x356f('0x21')]===undefined?!![]:![]:!![],'where':_0x8aa75a[_0x356f('0x20')]?_0x8aa75a[_0x356f('0x20')][_0x356f('0x22')]||null:null,'attributes':[[db[_0x356f('0x23')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x356f('0x23')][_0x356f('0x24')](_0x356f('0x25')))),'outboundQueuePauses']]})['then'](function(_0x9739b5){logger[_0x356f('0x1b')]('GetVoiceQueueRtPauses',_0x8aa75a);logger[_0x356f('0x15')](_0x356f('0x1e'),_0x8aa75a,JSON[_0x356f('0x17')](_0x9739b5));_0x3f9ef9(_0x9739b5);})[_0x356f('0x1d')](function(_0x1adeb2){logger[_0x356f('0x18')]('GetVoiceQueueRtPauses',_0x1adeb2['message'],_0x8aa75a);_0x36aa0e(_0x355d27[_0x356f('0x18')](0x1f4,_0x1adeb2[_0x356f('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 2d75396..d269e62 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 _0x5fc3=['./userVoiceQueueRt.events','save','update','emit','removeListener','register','userVoiceQueueRt:'];(function(_0x1a4559,_0x3fe791){var _0x38338a=function(_0x36a1c8){while(--_0x36a1c8){_0x1a4559['push'](_0x1a4559['shift']());}};_0x38338a(++_0x3fe791);}(_0x5fc3,0xa8));var _0x35fc=function(_0x383dbb,_0x17d41b){_0x383dbb=_0x383dbb-0x0;var _0x6e8bde=_0x5fc3[_0x383dbb];return _0x6e8bde;};'use strict';var UserVoiceQueueRtEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){UserVoiceQueueRtEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);UserVoiceQueueRtEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file +var _0x47a1=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','update','removeListener'];(function(_0x1dbfcc,_0xb52cb6){var _0x48cfd4=function(_0x3eb123){while(--_0x3eb123){_0x1dbfcc['push'](_0x1dbfcc['shift']());}};_0x48cfd4(++_0xb52cb6);}(_0x47a1,0xbd));var _0x147a=function(_0x195cd8,_0x4898fc){_0x195cd8=_0x195cd8-0x0;var _0x372e4b=_0x47a1[_0x195cd8];return _0x372e4b;};'use strict';var UserVoiceQueueRtEvents=require(_0x147a('0x0'));var events=['save','remove',_0x147a('0x1')];function createListener(_0x575af9,_0x17575a){return function(_0x525a85){_0x17575a['emit'](_0x575af9,_0x525a85);};}function removeListener(_0xd80e93,_0x66a8e2){return function(){UserVoiceQueueRtEvents[_0x147a('0x2')](_0xd80e93,_0x66a8e2);};}exports[_0x147a('0x3')]=function(_0x31373d){for(var _0x57e7a2=0x0,_0x2a0a85=events[_0x147a('0x4')];_0x57e7a2<_0x2a0a85;_0x57e7a2++){var _0x130a3b=events[_0x57e7a2];var _0x28a263=createListener(_0x147a('0x5')+_0x130a3b,_0x31373d);UserVoiceQueueRtEvents['on'](_0x130a3b,_0x28a263);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 63cafe6..ddd1fce 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x59416d,_0x1ab2ed){var _0x41b088=function(_0x3477bf){while(--_0x3477bf){_0x59416d['push'](_0x59416d['shift']());}};_0x41b088(++_0x1ab2ed);}(_0xe706,0xa3));var _0x6e70=function(_0x52b24f,_0xca062d){_0x52b24f=_0x52b24f-0x0;var _0x46ea6b=_0xe706[_0x52b24f];return _0x46ea6b;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5283a3,_0x280d92){var _0x58d52d=function(_0x5844f2){while(--_0x5844f2){_0x5283a3['push'](_0x5283a3['shift']());}};_0x58d52d(++_0x280d92);}(_0x70e0,0x17b));var _0x070e=function(_0x53c438,_0x382338){_0x53c438=_0x53c438-0x0;var _0x51302c=_0x70e0[_0x53c438];return _0x51302c;};'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 86b6d02..7169eb0 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 _0x1369=['sequelize','exports','INTEGER'];(function(_0x22d667,_0x4ab6f6){var _0xc8eba0=function(_0x217df2){while(--_0x217df2){_0x22d667['push'](_0x22d667['shift']());}};_0xc8eba0(++_0x4ab6f6);}(_0x1369,0xd5));var _0x9136=function(_0x435e9f,_0x10200f){_0x435e9f=_0x435e9f-0x0;var _0x5258eb=_0x1369[_0x435e9f];return _0x5258eb;};'use strict';var Sequelize=require(_0x9136('0x0'));module[_0x9136('0x1')]={'penalty':{'type':Sequelize[_0x9136('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2d0d=['exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x2d0d,0x1a4));var _0xd2d0=function(_0x52fd3d,_0x3af718){_0x52fd3d=_0x52fd3d-0x0;var _0x49b06d=_0x2d0d[_0x52fd3d];return _0x49b06d;};'use strict';var Sequelize=require('sequelize');module[_0xd2d0('0x0')]={'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 1d96f11..c725f90 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 _0x53fa=['../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x4fb812,_0x2996a7){var _0x373277=function(_0x55fc98){while(--_0x55fc98){_0x4fb812['push'](_0x4fb812['shift']());}};_0x373277(++_0x2996a7);}(_0x53fa,0x14f));var _0xa53f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53fa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa53f('0x0'));var util=require('util');var logger=require(_0xa53f('0x1'))(_0xa53f('0x2'));var moment=require(_0xa53f('0x3'));var BPromise=require('bluebird');var rp=require(_0xa53f('0x4'));var fs=require('fs');var path=require(_0xa53f('0x5'));var rimraf=require('rimraf');var config=require(_0xa53f('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0xa53f('0x7')]=function(_0x592993,_0x524829){return _0x592993[_0xa53f('0x8')](_0xa53f('0x9'),attributes,{'tableName':_0xa53f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x879c=['request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util','../../config/logger','bluebird'];(function(_0x72bb16,_0x5be43b){var _0x4232df=function(_0x5af1a5){while(--_0x5af1a5){_0x72bb16['push'](_0x72bb16['shift']());}};_0x4232df(++_0x5be43b);}(_0x879c,0x1bf));var _0xc879=function(_0x24f019,_0x1145b0){_0x24f019=_0x24f019-0x0;var _0x135dcd=_0x879c[_0x24f019];return _0x135dcd;};'use strict';var _=require(_0xc879('0x0'));var util=require(_0xc879('0x1'));var logger=require(_0xc879('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc879('0x3'));var rp=require(_0xc879('0x4'));var fs=require('fs');var path=require(_0xc879('0x5'));var rimraf=require(_0xc879('0x6'));var config=require('../../config/environment');var attributes=require(_0xc879('0x7'));module[_0xc879('0x8')]=function(_0x40397e,_0x5a8d58){return _0x40397e[_0xc879('0x9')]('UserWhatsappQueue',attributes,{'tableName':_0xc879('0xa'),'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 9a5d24e..88359de 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 _0x3b68=['request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x3971c7,_0x43a45c){var _0x4230d9=function(_0x4f6dcd){while(--_0x4f6dcd){_0x3971c7['push'](_0x3971c7['shift']());}};_0x4230d9(++_0x43a45c);}(_0x3b68,0xd8));var _0x83b6=function(_0x374017,_0xfc7dbe){_0x374017=_0x374017-0x0;var _0x31c4b4=_0x3b68[_0x374017];return _0x31c4b4;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x83b6('0x0'));var fs=require('fs');var Redis=require(_0x83b6('0x1'));var db=require(_0x83b6('0x2'))['db'];var utils=require(_0x83b6('0x3'));var logger=require(_0x83b6('0x4'))(_0x83b6('0x5'));var config=require('../../config/environment');var jayson=require(_0x83b6('0x6'));var client=jayson[_0x83b6('0x7')][_0x83b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x314af0,_0x388ab2,_0xc56d40){return new BPromise(function(_0x324ecc,_0x419c1e){return client['request'](_0x314af0,_0xc56d40)[_0x83b6('0x9')](function(_0x3d9c7c){logger[_0x83b6('0xa')](_0x83b6('0xb'),_0x388ab2,_0x83b6('0xc'));logger['debug'](_0x83b6('0xd'),_0x388ab2,_0x83b6('0xc'),JSON[_0x83b6('0xe')](_0x3d9c7c));if(_0x3d9c7c[_0x83b6('0xf')]){if(_0x3d9c7c[_0x83b6('0xf')][_0x83b6('0x10')]===0x1f4){logger[_0x83b6('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x388ab2,_0x3d9c7c[_0x83b6('0xf')]['message']);return _0x419c1e(_0x3d9c7c[_0x83b6('0xf')][_0x83b6('0x11')]);}logger[_0x83b6('0xf')](_0x83b6('0xb'),_0x388ab2,_0x3d9c7c[_0x83b6('0xf')][_0x83b6('0x11')]);return _0x324ecc(_0x3d9c7c['error'][_0x83b6('0x11')]);}else{logger[_0x83b6('0xa')](_0x83b6('0xb'),_0x388ab2,'request\x20sent');_0x324ecc(_0x3d9c7c['result']['message']);}})[_0x83b6('0x12')](function(_0x6f8fef){logger[_0x83b6('0xf')](_0x83b6('0xb'),_0x388ab2,_0x6f8fef);_0x419c1e(_0x6f8fef);});});} \ No newline at end of file +var _0xc513=['UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','error','code'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xc513,0x15a));var _0x3c51=function(_0x2c3253,_0x36d87c){_0x2c3253=_0x2c3253-0x0;var _0x4400f9=_0xc513[_0x2c3253];return _0x4400f9;};'use strict';var _=require('lodash');var util=require(_0x3c51('0x0'));var moment=require(_0x3c51('0x1'));var BPromise=require('bluebird');var rs=require(_0x3c51('0x2'));var fs=require('fs');var Redis=require(_0x3c51('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c51('0x4'));var logger=require(_0x3c51('0x5'))(_0x3c51('0x6'));var config=require(_0x3c51('0x7'));var jayson=require(_0x3c51('0x8'));var client=jayson['client'][_0x3c51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x298dc6,_0x587eb3,_0x10b1ff){return new BPromise(function(_0x16493f,_0x23c57d){return client[_0x3c51('0xa')](_0x298dc6,_0x10b1ff)['then'](function(_0x74d7e3){logger[_0x3c51('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x587eb3,_0x3c51('0xc'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x587eb3,_0x3c51('0xc'),JSON['stringify'](_0x74d7e3));if(_0x74d7e3['error']){if(_0x74d7e3[_0x3c51('0xd')][_0x3c51('0xe')]===0x1f4){logger[_0x3c51('0xd')](_0x3c51('0xf'),_0x587eb3,_0x74d7e3[_0x3c51('0xd')][_0x3c51('0x10')]);return _0x23c57d(_0x74d7e3[_0x3c51('0xd')][_0x3c51('0x10')]);}logger['error'](_0x3c51('0xf'),_0x587eb3,_0x74d7e3[_0x3c51('0xd')][_0x3c51('0x10')]);return _0x16493f(_0x74d7e3[_0x3c51('0xd')][_0x3c51('0x10')]);}else{logger['info'](_0x3c51('0xf'),_0x587eb3,'request\x20sent');_0x16493f(_0x74d7e3[_0x3c51('0x11')]['message']);}})[_0x3c51('0x12')](function(_0x7bf157){logger['error'](_0x3c51('0xf'),_0x587eb3,_0x7bf157);_0x23c57d(_0x7bf157);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index c5f54b4..0548b9c 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 _0x3c6d=['./variable.controller','isAuthenticated','index','get','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3c6d,0x199));var _0xd3c6=function(_0x4f2281,_0x28fbc9){_0x4f2281=_0x4f2281-0x0;var _0xd972ba=_0x3c6d[_0x4f2281];return _0xd972ba;};'use strict';var multer=require(_0xd3c6('0x0'));var util=require(_0xd3c6('0x1'));var path=require(_0xd3c6('0x2'));var timeout=require(_0xd3c6('0x3'));var express=require('express');var router=express[_0xd3c6('0x4')]();var fs_extra=require(_0xd3c6('0x5'));var auth=require(_0xd3c6('0x6'));var interaction=require(_0xd3c6('0x7'));var config=require(_0xd3c6('0x8'));var controller=require(_0xd3c6('0x9'));router['get']('/',auth[_0xd3c6('0xa')](),controller[_0xd3c6('0xb')]);router[_0xd3c6('0xc')](_0xd3c6('0xd'),auth[_0xd3c6('0xa')](),controller[_0xd3c6('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd3c6('0xf')]);router[_0xd3c6('0x10')](_0xd3c6('0xd'),auth['isAuthenticated'](),controller[_0xd3c6('0x11')]);router['delete'](_0xd3c6('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xd3c6('0x12')]=router; \ No newline at end of file +var _0x4d9e=['multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5e8fb9,_0x23963d){var _0x210f5d=function(_0x570829){while(--_0x570829){_0x5e8fb9['push'](_0x5e8fb9['shift']());}};_0x210f5d(++_0x23963d);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x41546f,_0x8927a0){_0x41546f=_0x41546f-0x0;var _0x3ebe01=_0x4d9e[_0x41546f];return _0x3ebe01;};'use strict';var multer=require(_0xe4d9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe4d9('0x1'));var express=require('express');var router=express[_0xe4d9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe4d9('0x3'));var interaction=require(_0xe4d9('0x4'));var config=require('../../config/environment');var controller=require(_0xe4d9('0x5'));router[_0xe4d9('0x6')]('/',auth[_0xe4d9('0x7')](),controller[_0xe4d9('0x8')]);router[_0xe4d9('0x6')](_0xe4d9('0x9'),auth['isAuthenticated'](),controller[_0xe4d9('0xa')]);router[_0xe4d9('0xb')]('/',auth[_0xe4d9('0x7')](),controller[_0xe4d9('0xc')]);router[_0xe4d9('0xd')](_0xe4d9('0x9'),auth['isAuthenticated'](),controller[_0xe4d9('0xe')]);router[_0xe4d9('0xf')](_0xe4d9('0x9'),auth[_0xe4d9('0x7')](),controller[_0xe4d9('0x10')]);module[_0xe4d9('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index ef880b0..77bcebc 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 _0xaa4a=['exports','STRING','name','sequelize'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xaa4a,0x9b));var _0xaaa4=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xaa4a[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0xaaa4('0x0'));module[_0xaaa4('0x1')]={'name':{'type':Sequelize[_0xaaa4('0x2')],'unique':_0xaaa4('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaaa4('0x2')]}}; \ No newline at end of file +var _0xebe1=['STRING','name','sequelize','exports'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0xebe1,0xf2));var _0x1ebe=function(_0x3d7516,_0x3109fa){_0x3d7516=_0x3d7516-0x0;var _0xb30d=_0xebe1[_0x3d7516];return _0xb30d;};'use strict';var Sequelize=require(_0x1ebe('0x0'));module[_0x1ebe('0x1')]={'name':{'type':Sequelize[_0x1ebe('0x2')],'unique':_0x1ebe('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 4c7f858..574835e 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 _0x18ba=['Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','intersection','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','Variables','UserProfileResource','error','stack','name','send','index','map'];(function(_0x24459f,_0x1c65c5){var _0x456b4b=function(_0x31f7f9){while(--_0x31f7f9){_0x24459f['push'](_0x24459f['shift']());}};_0x456b4b(++_0x1c65c5);}(_0x18ba,0xc3));var _0xa18b=function(_0x371fc5,_0x49821f){_0x371fc5=_0x371fc5-0x0;var _0x2bc4e1=_0x18ba[_0x371fc5];return _0x2bc4e1;};'use strict';var emlformat=require(_0xa18b('0x0'));var rimraf=require(_0xa18b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa18b('0x2'));var rp=require(_0xa18b('0x3'));var moment=require(_0xa18b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa18b('0x5'));var util=require(_0xa18b('0x6'));var path=require(_0xa18b('0x7'));var sox=require(_0xa18b('0x8'));var csv=require(_0xa18b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa18b('0xa'));var _=require('lodash');var squel=require(_0xa18b('0xb'));var crypto=require('crypto');var jsforce=require(_0xa18b('0xc'));var deskjs=require(_0xa18b('0xd'));var toCsv=require(_0xa18b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa18b('0xe'));var authService=require(_0xa18b('0xf'));var qs=require(_0xa18b('0x10'));var as=require(_0xa18b('0x11'));var hardwareService=require(_0xa18b('0x12'));var logger=require('../../config/logger')(_0xa18b('0x13'));var utils=require('../../config/utils');var config=require(_0xa18b('0x14'));var licenseUtil=require(_0xa18b('0x15'));var db=require(_0xa18b('0x16'))['db'];function respondWithStatusCode(_0x61d3d2,_0x4e0f9d){_0x4e0f9d=_0x4e0f9d||0xcc;return function(_0x2a522f){if(_0x2a522f){return _0x61d3d2[_0xa18b('0x17')](_0x4e0f9d);}return _0x61d3d2[_0xa18b('0x18')](_0x4e0f9d)[_0xa18b('0x19')]();};}function respondWithResult(_0x413565,_0x3a06e0){_0x3a06e0=_0x3a06e0||0xc8;return function(_0x277fee){if(_0x277fee){return _0x413565[_0xa18b('0x18')](_0x3a06e0)[_0xa18b('0x1a')](_0x277fee);}};}function respondWithFilteredResult(_0x14cd1f,_0xfc4018){return function(_0x249e6f){if(_0x249e6f){var _0x80e130=typeof _0xfc4018[_0xa18b('0x1b')]==='undefined'&&typeof _0xfc4018[_0xa18b('0x1c')]===_0xa18b('0x1d');var _0x5dd11c=_0x249e6f[_0xa18b('0x1e')];var _0x54a597=_0x80e130?0x0:_0xfc4018[_0xa18b('0x1b')];var _0x568d78=_0x80e130?_0x249e6f['count']:_0xfc4018[_0xa18b('0x1b')]+_0xfc4018[_0xa18b('0x1c')];var _0x1cbd59;if(_0x568d78>=_0x5dd11c){_0x568d78=_0x5dd11c;_0x1cbd59=0xc8;}else{_0x1cbd59=0xce;}_0x14cd1f[_0xa18b('0x18')](_0x1cbd59);return _0x14cd1f['set'](_0xa18b('0x1f'),_0x54a597+'-'+_0x568d78+'/'+_0x5dd11c)[_0xa18b('0x1a')](_0x249e6f);}return null;};}function patchUpdates(_0x1e4d82){return function(_0x5da0e5){try{jsonpatch[_0xa18b('0x20')](_0x5da0e5,_0x1e4d82,!![]);}catch(_0x54148e){return BPromise['reject'](_0x54148e);}return _0x5da0e5[_0xa18b('0x21')]();};}function saveUpdates(_0x412b0e,_0x466b30){return function(_0x11b4e2){if(_0x11b4e2){return _0x11b4e2[_0xa18b('0x22')](_0x412b0e)[_0xa18b('0x23')](function(_0x5d5d40){return _0x5d5d40;});}return null;};}function removeEntity(_0x5ab5f8,_0x4cd64e){return function(_0x5eb821){if(_0x5eb821){return _0x5eb821[_0xa18b('0x24')]()['then'](function(){var _0x138358=_0x5eb821['get']({'plain':!![]});var _0x13f554=_0xa18b('0x25');return db[_0xa18b('0x26')][_0xa18b('0x24')]({'where':{'type':_0x13f554,'resourceId':_0x138358['id']}})[_0xa18b('0x23')](function(){return _0x5eb821;});})[_0xa18b('0x23')](function(){_0x5ab5f8[_0xa18b('0x18')](0xcc)[_0xa18b('0x19')]();});}};}function handleEntityNotFound(_0x218714,_0x356a26){return function(_0x2497cd){if(!_0x2497cd){_0x218714[_0xa18b('0x17')](0x194);}return _0x2497cd;};}function handleError(_0x38b243,_0x820505){_0x820505=_0x820505||0x1f4;return function(_0x5c17d4){logger[_0xa18b('0x27')](_0x5c17d4[_0xa18b('0x28')]);if(_0x5c17d4[_0xa18b('0x29')]){delete _0x5c17d4[_0xa18b('0x29')];}_0x38b243[_0xa18b('0x18')](_0x820505)[_0xa18b('0x2a')](_0x5c17d4);};}exports[_0xa18b('0x2b')]=function(_0x15424d,_0x5b6bf8){var _0x588463={},_0x11a76b={},_0x5a2553={'count':0x0,'rows':[]};var _0x327609=_[_0xa18b('0x2c')](db[_0xa18b('0x2d')][_0xa18b('0x2e')],function(_0x31aca6){return{'name':_0x31aca6[_0xa18b('0x2f')],'type':_0x31aca6[_0xa18b('0x30')][_0xa18b('0x31')]};});_0x11a76b[_0xa18b('0x32')]=_['map'](_0x327609,_0xa18b('0x29'));_0x11a76b[_0xa18b('0x33')]=_[_0xa18b('0x34')](_0x15424d['query']);_0x11a76b[_0xa18b('0x35')]=_['intersection'](_0x11a76b[_0xa18b('0x32')],_0x11a76b['query']);_0x588463['attributes']=_['intersection'](_0x11a76b[_0xa18b('0x32')],qs['fields'](_0x15424d[_0xa18b('0x33')][_0xa18b('0x36')]));_0x588463[_0xa18b('0x37')]=_0x588463['attributes'][_0xa18b('0x38')]?_0x588463['attributes']:_0x11a76b[_0xa18b('0x32')];if(!_0x15424d[_0xa18b('0x33')][_0xa18b('0x39')](_0xa18b('0x3a'))){_0x588463[_0xa18b('0x1c')]=qs[_0xa18b('0x1c')](_0x15424d[_0xa18b('0x33')][_0xa18b('0x1c')]);_0x588463[_0xa18b('0x1b')]=qs[_0xa18b('0x1b')](_0x15424d[_0xa18b('0x33')][_0xa18b('0x1b')]);}_0x588463[_0xa18b('0x3b')]=qs[_0xa18b('0x3c')](_0x15424d[_0xa18b('0x33')][_0xa18b('0x3c')]);_0x588463[_0xa18b('0x3d')]=qs['filters'](_[_0xa18b('0x3e')](_0x15424d[_0xa18b('0x33')],_0x11a76b[_0xa18b('0x35')]),_0x327609);if(_0x15424d[_0xa18b('0x33')][_0xa18b('0x3f')]){_0x588463[_0xa18b('0x3d')]=_['merge'](_0x588463[_0xa18b('0x3d')],{'$or':_[_0xa18b('0x2c')](_0x327609,function(_0x5a94a1){if(_0x5a94a1['type']!=='VIRTUAL'){var _0x5e45e3={};_0x5e45e3[_0x5a94a1[_0xa18b('0x29')]]={'$like':'%'+_0x15424d[_0xa18b('0x33')][_0xa18b('0x3f')]+'%'};return _0x5e45e3;}})});}_0x588463=_[_0xa18b('0x40')]({},_0x588463,_0x15424d[_0xa18b('0x41')]);var _0x4e06f7={'where':_0x588463['where']};return db[_0xa18b('0x2d')][_0xa18b('0x1e')](_0x4e06f7)[_0xa18b('0x23')](function(_0x341fd0){_0x5a2553[_0xa18b('0x1e')]=_0x341fd0;if(_0x15424d[_0xa18b('0x33')]['includeAll']){_0x588463[_0xa18b('0x42')]=[{'all':!![]}];}return db[_0xa18b('0x2d')]['findAll'](_0x588463);})[_0xa18b('0x23')](function(_0x58480e){_0x5a2553[_0xa18b('0x43')]=_0x58480e;return _0x5a2553;})[_0xa18b('0x23')](respondWithFilteredResult(_0x5b6bf8,_0x588463))[_0xa18b('0x44')](handleError(_0x5b6bf8,null));};exports[_0xa18b('0x45')]=function(_0x22cb1f,_0xb59b18){var _0x153e58={'raw':!![],'where':{'id':_0x22cb1f[_0xa18b('0x46')]['id']}},_0x21f371={};_0x21f371[_0xa18b('0x32')]=_[_0xa18b('0x34')](db[_0xa18b('0x2d')]['rawAttributes']);_0x21f371['query']=_[_0xa18b('0x34')](_0x22cb1f[_0xa18b('0x33')]);_0x21f371['filters']=_[_0xa18b('0x47')](_0x21f371[_0xa18b('0x32')],_0x21f371[_0xa18b('0x33')]);_0x153e58[_0xa18b('0x37')]=_['intersection'](_0x21f371[_0xa18b('0x32')],qs[_0xa18b('0x36')](_0x22cb1f[_0xa18b('0x33')][_0xa18b('0x36')]));_0x153e58['attributes']=_0x153e58[_0xa18b('0x37')][_0xa18b('0x38')]?_0x153e58[_0xa18b('0x37')]:_0x21f371['model'];if(_0x22cb1f[_0xa18b('0x33')]['includeAll']){_0x153e58[_0xa18b('0x42')]=[{'all':!![]}];}_0x153e58=_[_0xa18b('0x40')]({},_0x153e58,_0x22cb1f[_0xa18b('0x41')]);return db[_0xa18b('0x2d')][_0xa18b('0x48')](_0x153e58)['then'](handleEntityNotFound(_0xb59b18,null))['then'](respondWithResult(_0xb59b18,null))['catch'](handleError(_0xb59b18,null));};exports[_0xa18b('0x49')]=function(_0x458cbf,_0x4c323a){return db['Variable'][_0xa18b('0x49')](_0x458cbf[_0xa18b('0x4a')],{})[_0xa18b('0x23')](function(_0x379817){var _0x481614=_0x458cbf[_0xa18b('0x4b')]['get']({'plain':!![]});if(!_0x481614)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x481614['role']==='user'){var _0x1d52ad=_0x379817['get']({'plain':!![]});var _0x356652=_0xa18b('0x25');return db[_0xa18b('0x4c')]['find']({'where':{'name':_0x356652,'userProfileId':_0x481614[_0xa18b('0x4d')]},'raw':!![]})[_0xa18b('0x23')](function(_0x2d8687){if(_0x2d8687&&_0x2d8687[_0xa18b('0x4e')]===0x0){return db[_0xa18b('0x26')][_0xa18b('0x49')]({'name':_0x1d52ad['name'],'resourceId':_0x1d52ad['id'],'type':_0x2d8687[_0xa18b('0x29')],'sectionId':_0x2d8687['id']},{})[_0xa18b('0x23')](function(){return _0x379817;});}else{return _0x379817;}})['catch'](function(_0x53c62c){logger['error'](_0xa18b('0x4f'),_0x53c62c);throw _0x53c62c;});}return _0x379817;})['then'](respondWithResult(_0x4c323a,0xc9))[_0xa18b('0x44')](handleError(_0x4c323a,null));};exports[_0xa18b('0x22')]=function(_0x347c72,_0x7ac280){if(_0x347c72['body']['id']){delete _0x347c72['body']['id'];}return db['Variable'][_0xa18b('0x48')]({'where':{'id':_0x347c72['params']['id']}})[_0xa18b('0x23')](handleEntityNotFound(_0x7ac280,null))[_0xa18b('0x23')](saveUpdates(_0x347c72[_0xa18b('0x4a')],null))[_0xa18b('0x23')](respondWithResult(_0x7ac280,null))[_0xa18b('0x44')](handleError(_0x7ac280,null));};exports[_0xa18b('0x24')]=function(_0x3af817,_0x5bc3e3){return db[_0xa18b('0x2d')][_0xa18b('0x48')]({'where':{'id':_0x3af817[_0xa18b('0x46')]['id']}})[_0xa18b('0x23')](handleEntityNotFound(_0x5bc3e3,null))['then'](removeEntity(_0x5bc3e3,null))[_0xa18b('0x44')](handleError(_0x5bc3e3,null));}; \ No newline at end of file +var _0xd7b4=['sort','filter','where','merge','VIRTUAL','options','Variable','include','rows','catch','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','Variables','UserProfileResource','error','name','send','index','type','key','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x4829f6,_0x1f3a22){var _0x5dbb63=function(_0x27f97c){while(--_0x27f97c){_0x4829f6['push'](_0x4829f6['shift']());}};_0x5dbb63(++_0x1f3a22);}(_0xd7b4,0x115));var _0x4d7b=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0xd7b4[_0x3e32a8];return _0x2997b0;};'use strict';var emlformat=require(_0x4d7b('0x0'));var rimraf=require(_0x4d7b('0x1'));var zipdir=require(_0x4d7b('0x2'));var jsonpatch=require(_0x4d7b('0x3'));var rp=require(_0x4d7b('0x4'));var moment=require(_0x4d7b('0x5'));var BPromise=require(_0x4d7b('0x6'));var Mustache=require(_0x4d7b('0x7'));var util=require(_0x4d7b('0x8'));var path=require(_0x4d7b('0x9'));var sox=require(_0x4d7b('0xa'));var csv=require(_0x4d7b('0xb'));var ejs=require(_0x4d7b('0xc'));var fs=require('fs');var fs_extra=require(_0x4d7b('0xd'));var _=require(_0x4d7b('0xe'));var squel=require(_0x4d7b('0xf'));var crypto=require('crypto');var jsforce=require(_0x4d7b('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x4d7b('0xb'));var querystring=require(_0x4d7b('0x11'));var Papa=require(_0x4d7b('0x12'));var Redis=require(_0x4d7b('0x13'));var authService=require(_0x4d7b('0x14'));var qs=require(_0x4d7b('0x15'));var as=require(_0x4d7b('0x16'));var hardwareService=require(_0x4d7b('0x17'));var logger=require(_0x4d7b('0x18'))(_0x4d7b('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4d7b('0x1a'));var db=require(_0x4d7b('0x1b'))['db'];function respondWithStatusCode(_0x516b15,_0x3c162b){_0x3c162b=_0x3c162b||0xcc;return function(_0xfcefff){if(_0xfcefff){return _0x516b15[_0x4d7b('0x1c')](_0x3c162b);}return _0x516b15[_0x4d7b('0x1d')](_0x3c162b)[_0x4d7b('0x1e')]();};}function respondWithResult(_0xe44602,_0x286919){_0x286919=_0x286919||0xc8;return function(_0x45cfc7){if(_0x45cfc7){return _0xe44602[_0x4d7b('0x1d')](_0x286919)[_0x4d7b('0x1f')](_0x45cfc7);}};}function respondWithFilteredResult(_0x1f42df,_0x430d2a){return function(_0x20e293){if(_0x20e293){var _0x391b33=typeof _0x430d2a[_0x4d7b('0x20')]===_0x4d7b('0x21')&&typeof _0x430d2a[_0x4d7b('0x22')]===_0x4d7b('0x21');var _0x4cc1ed=_0x20e293[_0x4d7b('0x23')];var _0x2cf1d5=_0x391b33?0x0:_0x430d2a['offset'];var _0x496603=_0x391b33?_0x20e293[_0x4d7b('0x23')]:_0x430d2a[_0x4d7b('0x20')]+_0x430d2a[_0x4d7b('0x22')];var _0x2170c6;if(_0x496603>=_0x4cc1ed){_0x496603=_0x4cc1ed;_0x2170c6=0xc8;}else{_0x2170c6=0xce;}_0x1f42df[_0x4d7b('0x1d')](_0x2170c6);return _0x1f42df[_0x4d7b('0x24')](_0x4d7b('0x25'),_0x2cf1d5+'-'+_0x496603+'/'+_0x4cc1ed)['json'](_0x20e293);}return null;};}function patchUpdates(_0x380232){return function(_0x10102d){try{jsonpatch[_0x4d7b('0x26')](_0x10102d,_0x380232,!![]);}catch(_0x16abe7){return BPromise['reject'](_0x16abe7);}return _0x10102d[_0x4d7b('0x27')]();};}function saveUpdates(_0x141b3a,_0x522ca9){return function(_0x1ea594){if(_0x1ea594){return _0x1ea594['update'](_0x141b3a)[_0x4d7b('0x28')](function(_0x4c84e7){return _0x4c84e7;});}return null;};}function removeEntity(_0x507d2a,_0x4e36d8){return function(_0x384df7){if(_0x384df7){return _0x384df7[_0x4d7b('0x29')]()[_0x4d7b('0x28')](function(){var _0x15568d=_0x384df7[_0x4d7b('0x2a')]({'plain':!![]});var _0x426920=_0x4d7b('0x2b');return db[_0x4d7b('0x2c')][_0x4d7b('0x29')]({'where':{'type':_0x426920,'resourceId':_0x15568d['id']}})[_0x4d7b('0x28')](function(){return _0x384df7;});})['then'](function(){_0x507d2a[_0x4d7b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3577a3,_0x5c0b07){return function(_0x1e8141){if(!_0x1e8141){_0x3577a3[_0x4d7b('0x1c')](0x194);}return _0x1e8141;};}function handleError(_0x294745,_0x2699ff){_0x2699ff=_0x2699ff||0x1f4;return function(_0x1f8885){logger[_0x4d7b('0x2d')](_0x1f8885['stack']);if(_0x1f8885[_0x4d7b('0x2e')]){delete _0x1f8885[_0x4d7b('0x2e')];}_0x294745[_0x4d7b('0x1d')](_0x2699ff)[_0x4d7b('0x2f')](_0x1f8885);};}exports[_0x4d7b('0x30')]=function(_0x25f785,_0xbc8a67){var _0x53c6dc={},_0x40912a={},_0x433631={'count':0x0,'rows':[]};var _0x4ed275=_['map'](db['Variable']['rawAttributes'],function(_0x481f3c){return{'name':_0x481f3c['fieldName'],'type':_0x481f3c[_0x4d7b('0x31')][_0x4d7b('0x32')]};});_0x40912a[_0x4d7b('0x33')]=_[_0x4d7b('0x34')](_0x4ed275,_0x4d7b('0x2e'));_0x40912a['query']=_[_0x4d7b('0x35')](_0x25f785['query']);_0x40912a[_0x4d7b('0x36')]=_['intersection'](_0x40912a[_0x4d7b('0x33')],_0x40912a[_0x4d7b('0x37')]);_0x53c6dc[_0x4d7b('0x38')]=_[_0x4d7b('0x39')](_0x40912a[_0x4d7b('0x33')],qs[_0x4d7b('0x3a')](_0x25f785['query'][_0x4d7b('0x3a')]));_0x53c6dc[_0x4d7b('0x38')]=_0x53c6dc[_0x4d7b('0x38')][_0x4d7b('0x3b')]?_0x53c6dc[_0x4d7b('0x38')]:_0x40912a[_0x4d7b('0x33')];if(!_0x25f785[_0x4d7b('0x37')][_0x4d7b('0x3c')](_0x4d7b('0x3d'))){_0x53c6dc['limit']=qs[_0x4d7b('0x22')](_0x25f785[_0x4d7b('0x37')][_0x4d7b('0x22')]);_0x53c6dc['offset']=qs[_0x4d7b('0x20')](_0x25f785[_0x4d7b('0x37')][_0x4d7b('0x20')]);}_0x53c6dc[_0x4d7b('0x3e')]=qs[_0x4d7b('0x3f')](_0x25f785[_0x4d7b('0x37')][_0x4d7b('0x3f')]);_0x53c6dc['where']=qs['filters'](_['pick'](_0x25f785[_0x4d7b('0x37')],_0x40912a['filters']),_0x4ed275);if(_0x25f785[_0x4d7b('0x37')][_0x4d7b('0x40')]){_0x53c6dc[_0x4d7b('0x41')]=_[_0x4d7b('0x42')](_0x53c6dc['where'],{'$or':_['map'](_0x4ed275,function(_0x3e15d5){if(_0x3e15d5[_0x4d7b('0x31')]!==_0x4d7b('0x43')){var _0x593608={};_0x593608[_0x3e15d5[_0x4d7b('0x2e')]]={'$like':'%'+_0x25f785['query'][_0x4d7b('0x40')]+'%'};return _0x593608;}})});}_0x53c6dc=_[_0x4d7b('0x42')]({},_0x53c6dc,_0x25f785[_0x4d7b('0x44')]);var _0x105173={'where':_0x53c6dc[_0x4d7b('0x41')]};return db[_0x4d7b('0x45')][_0x4d7b('0x23')](_0x105173)['then'](function(_0x4c7103){_0x433631[_0x4d7b('0x23')]=_0x4c7103;if(_0x25f785[_0x4d7b('0x37')]['includeAll']){_0x53c6dc[_0x4d7b('0x46')]=[{'all':!![]}];}return db[_0x4d7b('0x45')]['findAll'](_0x53c6dc);})[_0x4d7b('0x28')](function(_0x49dd5d){_0x433631[_0x4d7b('0x47')]=_0x49dd5d;return _0x433631;})['then'](respondWithFilteredResult(_0xbc8a67,_0x53c6dc))[_0x4d7b('0x48')](handleError(_0xbc8a67,null));};exports['show']=function(_0x24cd94,_0x368f37){var _0x2afa0a={'raw':!![],'where':{'id':_0x24cd94['params']['id']}},_0x55f72a={};_0x55f72a[_0x4d7b('0x33')]=_[_0x4d7b('0x35')](db['Variable'][_0x4d7b('0x49')]);_0x55f72a['query']=_[_0x4d7b('0x35')](_0x24cd94[_0x4d7b('0x37')]);_0x55f72a[_0x4d7b('0x36')]=_['intersection'](_0x55f72a['model'],_0x55f72a[_0x4d7b('0x37')]);_0x2afa0a['attributes']=_[_0x4d7b('0x39')](_0x55f72a['model'],qs['fields'](_0x24cd94[_0x4d7b('0x37')][_0x4d7b('0x3a')]));_0x2afa0a[_0x4d7b('0x38')]=_0x2afa0a[_0x4d7b('0x38')][_0x4d7b('0x3b')]?_0x2afa0a['attributes']:_0x55f72a[_0x4d7b('0x33')];if(_0x24cd94['query'][_0x4d7b('0x4a')]){_0x2afa0a[_0x4d7b('0x46')]=[{'all':!![]}];}_0x2afa0a=_[_0x4d7b('0x42')]({},_0x2afa0a,_0x24cd94[_0x4d7b('0x44')]);return db['Variable'][_0x4d7b('0x4b')](_0x2afa0a)['then'](handleEntityNotFound(_0x368f37,null))['then'](respondWithResult(_0x368f37,null))[_0x4d7b('0x48')](handleError(_0x368f37,null));};exports[_0x4d7b('0x4c')]=function(_0x13e4c8,_0x182e27){return db[_0x4d7b('0x45')][_0x4d7b('0x4c')](_0x13e4c8[_0x4d7b('0x4d')],{})[_0x4d7b('0x28')](function(_0x20c819){var _0x127c95=_0x13e4c8[_0x4d7b('0x4e')][_0x4d7b('0x2a')]({'plain':!![]});if(!_0x127c95)throw new Error(_0x4d7b('0x4f'));if(_0x127c95[_0x4d7b('0x50')]===_0x4d7b('0x4e')){var _0x2c2ef5=_0x20c819[_0x4d7b('0x2a')]({'plain':!![]});var _0x3a0107=_0x4d7b('0x2b');return db[_0x4d7b('0x51')][_0x4d7b('0x4b')]({'where':{'name':_0x3a0107,'userProfileId':_0x127c95['userProfileId']},'raw':!![]})['then'](function(_0x4cdf6e){if(_0x4cdf6e&&_0x4cdf6e['autoAssociation']===0x0){return db[_0x4d7b('0x2c')][_0x4d7b('0x4c')]({'name':_0x2c2ef5[_0x4d7b('0x2e')],'resourceId':_0x2c2ef5['id'],'type':_0x4cdf6e[_0x4d7b('0x2e')],'sectionId':_0x4cdf6e['id']},{})[_0x4d7b('0x28')](function(){return _0x20c819;});}else{return _0x20c819;}})['catch'](function(_0x5c1d47){logger[_0x4d7b('0x2d')](_0x4d7b('0x52'),_0x5c1d47);throw _0x5c1d47;});}return _0x20c819;})[_0x4d7b('0x28')](respondWithResult(_0x182e27,0xc9))[_0x4d7b('0x48')](handleError(_0x182e27,null));};exports[_0x4d7b('0x53')]=function(_0x595a56,_0x165936){if(_0x595a56[_0x4d7b('0x4d')]['id']){delete _0x595a56['body']['id'];}return db[_0x4d7b('0x45')]['find']({'where':{'id':_0x595a56['params']['id']}})[_0x4d7b('0x28')](handleEntityNotFound(_0x165936,null))[_0x4d7b('0x28')](saveUpdates(_0x595a56[_0x4d7b('0x4d')],null))[_0x4d7b('0x28')](respondWithResult(_0x165936,null))['catch'](handleError(_0x165936,null));};exports[_0x4d7b('0x29')]=function(_0x19530f,_0x12c79b){return db[_0x4d7b('0x45')]['find']({'where':{'id':_0x19530f[_0x4d7b('0x54')]['id']}})[_0x4d7b('0x28')](handleEntityNotFound(_0x12c79b,null))[_0x4d7b('0x28')](removeEntity(_0x12c79b,null))[_0x4d7b('0x48')](handleError(_0x12c79b,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 93bb3d2..bbc0131 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 _0x2722=['rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x31db0b,_0x55cfb9){var _0x3de73b=function(_0x21b7c7){while(--_0x21b7c7){_0x31db0b['push'](_0x31db0b['shift']());}};_0x3de73b(++_0x55cfb9);}(_0x2722,0x160));var _0x2272=function(_0xe39f63,_0x49f4d1){_0xe39f63=_0xe39f63-0x0;var _0x3d2bed=_0x2722[_0xe39f63];return _0x3d2bed;};'use strict';var _=require(_0x2272('0x0'));var util=require(_0x2272('0x1'));var logger=require(_0x2272('0x2'))(_0x2272('0x3'));var moment=require(_0x2272('0x4'));var BPromise=require(_0x2272('0x5'));var rp=require(_0x2272('0x6'));var fs=require('fs');var path=require(_0x2272('0x7'));var rimraf=require(_0x2272('0x8'));var config=require(_0x2272('0x9'));var attributes=require(_0x2272('0xa'));module[_0x2272('0xb')]=function(_0x7ffed9,_0x1a0206){return _0x7ffed9[_0x2272('0xc')](_0x2272('0xd'),attributes,{'tableName':_0x2272('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33f7=['Variable','tools_variables','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./variable.attributes','define'];(function(_0xe0b81f,_0x1fb734){var _0x290e5e=function(_0x19b8d3){while(--_0x19b8d3){_0xe0b81f['push'](_0xe0b81f['shift']());}};_0x290e5e(++_0x1fb734);}(_0x33f7,0xa7));var _0x733f=function(_0x4f6464,_0x19ce0b){_0x4f6464=_0x4f6464-0x0;var _0x2970c0=_0x33f7[_0x4f6464];return _0x2970c0;};'use strict';var _=require(_0x733f('0x0'));var util=require(_0x733f('0x1'));var logger=require(_0x733f('0x2'))(_0x733f('0x3'));var moment=require('moment');var BPromise=require(_0x733f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x733f('0x5'));var rimraf=require('rimraf');var config=require(_0x733f('0x6'));var attributes=require(_0x733f('0x7'));module['exports']=function(_0x54438c,_0x4f9fca){return _0x54438c[_0x733f('0x8')](_0x733f('0x9'),attributes,{'tableName':_0x733f('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 7a10cf3..32f0241 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xa41a,0x6b));var _0xaa41=function(_0x53c661,_0x107db2){_0x53c661=_0x53c661-0x0;var _0x229b69=_0xa41a[_0x53c661];return _0x229b69;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file +var _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4b3c7e,_0x58aef9){var _0x3015af=function(_0x12e3f7){while(--_0x12e3f7){_0x4b3c7e['push'](_0x4b3c7e['shift']());}};_0x3015af(++_0x58aef9);}(_0x8ef6,0xf2));var _0x68ef=function(_0x270976,_0x13ca5c){_0x270976=_0x270976-0x0;var _0x5429d4=_0x8ef6[_0x270976];return _0x5429d4;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 0544f13..660e3be 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 _0x704d=['/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','migrations','exports','Router','get','index'];(function(_0x503b4c,_0x3268f8){var _0x13c265=function(_0x2e9a67){while(--_0x2e9a67){_0x503b4c['push'](_0x503b4c['shift']());}};_0x13c265(++_0x3268f8);}(_0x704d,0xb1));var _0xd704=function(_0x5ed2a9,_0x577b41){_0x5ed2a9=_0x5ed2a9-0x0;var _0x12b478=_0x704d[_0x5ed2a9];return _0x12b478;};'use strict';var express=require('express');var router=express[_0xd704('0x0')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0xd704('0x1')]('/',controller[_0xd704('0x2')]);router[_0xd704('0x1')](_0xd704('0x3'),auth[_0xd704('0x4')](),auth[_0xd704('0x5')](),controller[_0xd704('0x6')]);router[_0xd704('0x1')](_0xd704('0x7'),auth[_0xd704('0x4')](),auth['canUpdate'](),controller[_0xd704('0x8')]);router[_0xd704('0x1')](_0xd704('0x9'),auth['isAuthenticated'](),auth[_0xd704('0x5')](),controller['pull']);router[_0xd704('0x1')]('/restart',auth['isAuthenticated'](),controller['restart']);router[_0xd704('0x1')]('/migrations',controller[_0xd704('0xa')]);module[_0xd704('0xb')]=router; \ No newline at end of file +var _0x9f23=['./version.controller','index','get','/fetch','canUpdate','isAuthenticated','reset','/pull','restart','migrations','express','Router'];(function(_0x2bf343,_0x59a2f9){var _0x2ad54d=function(_0x856ef){while(--_0x856ef){_0x2bf343['push'](_0x2bf343['shift']());}};_0x2ad54d(++_0x59a2f9);}(_0x9f23,0x172));var _0x39f2=function(_0x236c67,_0x3d1687){_0x236c67=_0x236c67-0x0;var _0x17cbde=_0x9f23[_0x236c67];return _0x17cbde;};'use strict';var express=require(_0x39f2('0x0'));var router=express[_0x39f2('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x39f2('0x2'));router['get']('/',controller[_0x39f2('0x3')]);router[_0x39f2('0x4')](_0x39f2('0x5'),auth['isAuthenticated'](),auth[_0x39f2('0x6')](),controller['fetch']);router[_0x39f2('0x4')]('/reset',auth[_0x39f2('0x7')](),auth['canUpdate'](),controller[_0x39f2('0x8')]);router[_0x39f2('0x4')](_0x39f2('0x9'),auth[_0x39f2('0x7')](),auth['canUpdate'](),controller['pull']);router[_0x39f2('0x4')]('/restart',auth[_0x39f2('0x7')](),controller[_0x39f2('0xa')]);router[_0x39f2('0x4')]('/migrations',controller[_0x39f2('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index c414deb..8e150d5 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 _0x7e54=['json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','migrations','server','length','.js','exports','push','sequelize','Migration','getQueryInterface','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','child_process','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','version','query','latest','fetch','tags','2.0.0','status'];(function(_0x4d23c1,_0x3bab87){var _0x5890b1=function(_0x48b371){while(--_0x48b371){_0x4d23c1['push'](_0x4d23c1['shift']());}};_0x5890b1(++_0x3bab87);}(_0x7e54,0x1f4));var _0x47e5=function(_0x96d9a6,_0x12a2c3){_0x96d9a6=_0x96d9a6-0x0;var _0x446109=_0x7e54[_0x96d9a6];return _0x446109;};'use strict';var Umzug=require(_0x47e5('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x47e5('0x1'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x47e5('0x2'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x47e5('0x3'));var pm2=require(_0x47e5('0x4'));var logger=require(_0x47e5('0x5'))(_0x47e5('0x6'));var git=require(_0x47e5('0x7'))(config[_0x47e5('0x8')]);exports[_0x47e5('0x9')]=function(_0x4ebf44,_0x172549){var _0x308c27={'current':module['exports'][_0x47e5('0xa')],'phonebar':0x2};if(_0x4ebf44[_0x47e5('0xb')]&&_0x4ebf44[_0x47e5('0xb')][_0x47e5('0xc')]){return git[_0x47e5('0xd')]()[_0x47e5('0xe')](function(_0x4b5a60,_0x4a3d28){_0x308c27[_0x47e5('0xc')]=(_0x4b5a60?module['exports']['version']:_0x4a3d28[_0x47e5('0xc')])||_0x47e5('0xf');return _0x172549[_0x47e5('0x10')](0xc8)[_0x47e5('0x11')](_0x308c27);});}else{return _0x172549[_0x47e5('0x10')](0xc8)[_0x47e5('0x11')](_0x308c27);}};exports['fetch']=function(_0xa38e18,_0x528146){return git[_0x47e5('0xd')](['origin',_0x47e5('0x12')],function(_0x101522){if(_0x101522){logger[_0x47e5('0x13')](_0x101522);return _0x528146[_0x47e5('0x10')](0x1f4)[_0x47e5('0x11')](_0x101522);}logger[_0x47e5('0x14')](_0x47e5('0x15'));return _0x528146[_0x47e5('0x10')](0xc8)['json']({'output':_0x47e5('0x16')});});};exports[_0x47e5('0x17')]=function(_0x218c64,_0x2e92cd){return git[_0x47e5('0x17')]([_0x47e5('0x18'),_0x47e5('0x19')],function(_0x18dce6){if(_0x18dce6){logger['error'](_0x18dce6);return _0x2e92cd[_0x47e5('0x10')](0x1f4)[_0x47e5('0x11')](_0x18dce6);}logger[_0x47e5('0x14')](_0x47e5('0x1a'));return _0x2e92cd[_0x47e5('0x10')](0xc8)[_0x47e5('0x11')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x3b1fc2,_0x1768f6){exec(_0x47e5('0x1b'),function(_0x4f16bf,_0x45c7b2,_0xb9173c){logger[_0x47e5('0x14')](_0x45c7b2);logger[_0x47e5('0x14')](_0xb9173c);if(_0x4f16bf){logger['error'](_0x4f16bf);return _0x1768f6['status'](0x1f4)[_0x47e5('0x11')](_0x4f16bf);}return _0x1768f6[_0x47e5('0x10')](0xc8)[_0x47e5('0x11')]({'output':_0x45c7b2});});};exports[_0x47e5('0x1c')]=function(_0x2664b8,_0x58659b){return pm2['restart'](_0x47e5('0x1d'))[_0x47e5('0x1e')](function(_0x2b3195){logger[_0x47e5('0x14')](_0x47e5('0x1f'),_0x2b3195);return _0x58659b[_0x47e5('0x10')](0xc8)[_0x47e5('0x11')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x4dfcf4){logger[_0x47e5('0x13')](_0x4dfcf4);return _0x58659b[_0x47e5('0x10')](0x1f4)[_0x47e5('0x11')](_0x4dfcf4);});};exports[_0x47e5('0x20')]=function(_0x462320,_0x449f2e){var _0x3ec042=fs['readdirSync'](path['join'](config[_0x47e5('0x8')],_0x47e5('0x21'),_0x47e5('0x20')));var _0x2c92b7=[];for(var _0x5d6dc5=0x0;_0x5d6dc5<_0x3ec042[_0x47e5('0x22')];_0x5d6dc5++){var _0x17ce4d=_0x3ec042[_0x5d6dc5]['replace'](_0x47e5('0x23'),'');if(compareVersions(module[_0x47e5('0x24')]['version'],_0x17ce4d)===-0x1){_0x2c92b7[_0x47e5('0x25')](_0x17ce4d);}}if(_0x2c92b7['length']){var _0xdc800d=_0x2c92b7['sort'](compareVersions);var _0x18973e=new Umzug({'storage':_0x47e5('0x26'),'storageOptions':{'model':db['Migration'],'modelName':_0x47e5('0x27'),'columnName':'version'},'migrations':{'params':[db[_0x47e5('0x26')][_0x47e5('0x28')](),db['sequelize']['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[_0x47e5('0x29')](config[_0x47e5('0x8')],_0x47e5('0x21'),_0x47e5('0x20')),'pattern':/\.js$/}});_0x18973e['up']({'migrations':_[_0x47e5('0x2a')](_0xdc800d,function(_0x5f0ff9){return _0x5f0ff9+_0x47e5('0x23');})})[_0x47e5('0x1e')](function(){return _0x449f2e[_0x47e5('0x10')](0xc8)[_0x47e5('0x11')]({'output':_0x47e5('0x2b')+module[_0x47e5('0x24')][_0x47e5('0xa')]+_0x47e5('0x2c')+_['last'](_0xdc800d),'migrations':_['join'](_0xdc800d)});})['catch'](function(_0x4cdb20){if(_0x4cdb20 instanceof db['sequelize'][_0x47e5('0x2d')]){return _0x449f2e[_0x47e5('0x10')](0xc8)[_0x47e5('0x11')]({'output':_0x47e5('0x2e')});}else{return _0x449f2e['status'](0x1f4)[_0x47e5('0x11')](_0x4cdb20);}});}else{return _0x449f2e[_0x47e5('0x10')](0xc8)[_0x47e5('0x11')]({'output':_0x47e5('0x2e')});}}; \ No newline at end of file +var _0xac43=['git\x20reset\x20--hard\x20FETCH_HEAD','pull','info','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','join','migrations','length','replace','.js','sort','sequelize','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','catch','UniqueConstraintError','Database\x20already\x20up-to-date','path','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','json','status','origin','error','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD'];(function(_0x22f695,_0x2802c5){var _0x40bbbf=function(_0x11e4b8){while(--_0x11e4b8){_0x22f695['push'](_0x22f695['shift']());}};_0x40bbbf(++_0x2802c5);}(_0xac43,0x1a8));var _0x3ac4=function(_0x39effb,_0x1767e2){_0x39effb=_0x39effb-0x0;var _0x54b32e=_0xac43[_0x39effb];return _0x54b32e;};'use strict';var Umzug=require('umzug');var path=require(_0x3ac4('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x3ac4('0x1'));var compareVersions=require(_0x3ac4('0x2'));var exec=require(_0x3ac4('0x3'))[_0x3ac4('0x4')];var db=require(_0x3ac4('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x3ac4('0x6'));var logger=require(_0x3ac4('0x7'))(_0x3ac4('0x8'));var git=require(_0x3ac4('0x9'))(config[_0x3ac4('0xa')]);exports[_0x3ac4('0xb')]=function(_0x320acb,_0x36be1f){var _0x530568={'current':module[_0x3ac4('0xc')][_0x3ac4('0x1')],'phonebar':0x2};if(_0x320acb['query']&&_0x320acb[_0x3ac4('0xd')][_0x3ac4('0xe')]){return git[_0x3ac4('0xf')]()[_0x3ac4('0x10')](function(_0x2102d6,_0x41c9aa){_0x530568['latest']=(_0x2102d6?module[_0x3ac4('0xc')][_0x3ac4('0x1')]:_0x41c9aa['latest'])||_0x3ac4('0x11');return _0x36be1f['status'](0xc8)[_0x3ac4('0x12')](_0x530568);});}else{return _0x36be1f[_0x3ac4('0x13')](0xc8)[_0x3ac4('0x12')](_0x530568);}};exports[_0x3ac4('0xf')]=function(_0x5e8e6a,_0x2ec29c){return git[_0x3ac4('0xf')]([_0x3ac4('0x14'),'master'],function(_0xfc7f5f){if(_0xfc7f5f){logger[_0x3ac4('0x15')](_0xfc7f5f);return _0x2ec29c[_0x3ac4('0x13')](0x1f4)['json'](_0xfc7f5f);}logger['info']('git\x20fetch');return _0x2ec29c[_0x3ac4('0x13')](0xc8)[_0x3ac4('0x12')]({'output':_0x3ac4('0x16')});});};exports[_0x3ac4('0x17')]=function(_0x28653e,_0x3652fb){return git[_0x3ac4('0x17')]([_0x3ac4('0x18'),_0x3ac4('0x19')],function(_0x59eee9){if(_0x59eee9){logger['error'](_0x59eee9);return _0x3652fb[_0x3ac4('0x13')](0x1f4)[_0x3ac4('0x12')](_0x59eee9);}logger['info'](_0x3ac4('0x1a'));return _0x3652fb['status'](0xc8)[_0x3ac4('0x12')]({'output':'git\x20reset\x20--hard'});});};exports[_0x3ac4('0x1b')]=function(_0x204b0d,_0x462b0b){exec('npm\x20install\x20--production',function(_0x58f5bf,_0x113f0f,_0x48038b){logger[_0x3ac4('0x1c')](_0x113f0f);logger[_0x3ac4('0x1c')](_0x48038b);if(_0x58f5bf){logger[_0x3ac4('0x15')](_0x58f5bf);return _0x462b0b['status'](0x1f4)[_0x3ac4('0x12')](_0x58f5bf);}return _0x462b0b[_0x3ac4('0x13')](0xc8)[_0x3ac4('0x12')]({'output':_0x113f0f});});};exports[_0x3ac4('0x1d')]=function(_0x55b443,_0x432c7e){return pm2[_0x3ac4('0x1d')](_0x3ac4('0x1e'))[_0x3ac4('0x1f')](function(_0x2bddde){logger[_0x3ac4('0x1c')](_0x3ac4('0x20'),_0x2bddde);return _0x432c7e[_0x3ac4('0x13')](0xc8)['json']({'output':_0x3ac4('0x21')});})['catch'](function(_0x4bafa2){logger[_0x3ac4('0x15')](_0x4bafa2);return _0x432c7e['status'](0x1f4)[_0x3ac4('0x12')](_0x4bafa2);});};exports['migrations']=function(_0x22397d,_0x29af39){var _0x350b5a=fs[_0x3ac4('0x22')](path[_0x3ac4('0x23')](config['root'],'server',_0x3ac4('0x24')));var _0x59b6da=[];for(var _0x151f16=0x0;_0x151f16<_0x350b5a[_0x3ac4('0x25')];_0x151f16++){var _0x1b8460=_0x350b5a[_0x151f16][_0x3ac4('0x26')](_0x3ac4('0x27'),'');if(compareVersions(module[_0x3ac4('0xc')][_0x3ac4('0x1')],_0x1b8460)===-0x1){_0x59b6da['push'](_0x1b8460);}}if(_0x59b6da[_0x3ac4('0x25')]){var _0x23fb2e=_0x59b6da[_0x3ac4('0x28')](compareVersions);var _0x172aa8=new Umzug({'storage':_0x3ac4('0x29'),'storageOptions':{'model':db['Migration'],'modelName':_0x3ac4('0x2a'),'columnName':_0x3ac4('0x1')},'migrations':{'params':[db[_0x3ac4('0x29')]['getQueryInterface'](),db['sequelize']['constructor'],function(){throw new Error(_0x3ac4('0x2b'));}],'path':path[_0x3ac4('0x23')](config[_0x3ac4('0xa')],'server',_0x3ac4('0x24')),'pattern':/\.js$/}});_0x172aa8['up']({'migrations':_[_0x3ac4('0x2c')](_0x23fb2e,function(_0x21a76a){return _0x21a76a+_0x3ac4('0x27');})})[_0x3ac4('0x1f')](function(){return _0x29af39[_0x3ac4('0x13')](0xc8)['json']({'output':_0x3ac4('0x2d')+module['exports'][_0x3ac4('0x1')]+_0x3ac4('0x2e')+_['last'](_0x23fb2e),'migrations':_[_0x3ac4('0x23')](_0x23fb2e)});})[_0x3ac4('0x2f')](function(_0x526e6f){if(_0x526e6f instanceof db[_0x3ac4('0x29')][_0x3ac4('0x30')]){return _0x29af39[_0x3ac4('0x13')](0xc8)[_0x3ac4('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x29af39[_0x3ac4('0x13')](0x1f4)[_0x3ac4('0x12')](_0x526e6f);}});}else{return _0x29af39[_0x3ac4('0x13')](0xc8)[_0x3ac4('0x12')]({'output':_0x3ac4('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 5487bf7..ade8fa1 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 _0xf7e4=['put','/:id','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','isAuthenticated','describe','show','post','create'];(function(_0x12727a,_0x3b9a4a){var _0x483308=function(_0x43653b){while(--_0x43653b){_0x12727a['push'](_0x12727a['shift']());}};_0x483308(++_0x3b9a4a);}(_0xf7e4,0x1e3));var _0x4f7e=function(_0x114c8f,_0x1f4264){_0x114c8f=_0x114c8f-0x0;var _0x550634=_0xf7e4[_0x114c8f];return _0x550634;};'use strict';var multer=require(_0x4f7e('0x0'));var util=require(_0x4f7e('0x1'));var path=require('path');var timeout=require(_0x4f7e('0x2'));var express=require(_0x4f7e('0x3'));var router=express[_0x4f7e('0x4')]();var fs_extra=require(_0x4f7e('0x5'));var auth=require(_0x4f7e('0x6'));var interaction=require(_0x4f7e('0x7'));var config=require(_0x4f7e('0x8'));var controller=require(_0x4f7e('0x9'));router[_0x4f7e('0xa')]('/',auth['isAuthenticated'](),controller[_0x4f7e('0xb')]);router[_0x4f7e('0xa')]('/describe',auth[_0x4f7e('0xc')](),controller[_0x4f7e('0xd')]);router['get']('/:id',auth[_0x4f7e('0xc')](),controller[_0x4f7e('0xe')]);router[_0x4f7e('0xf')]('/',auth[_0x4f7e('0xc')](),controller[_0x4f7e('0x10')]);router[_0x4f7e('0x11')](_0x4f7e('0x12'),auth[_0x4f7e('0xc')](),controller['update']);router[_0x4f7e('0x13')](_0x4f7e('0x12'),auth[_0x4f7e('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x550e=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','index','get','/describe','isAuthenticated','show','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x25f039,_0x392fb){var _0x13937a=function(_0x7673b1){while(--_0x7673b1){_0x25f039['push'](_0x25f039['shift']());}};_0x13937a(++_0x392fb);}(_0x550e,0x162));var _0xe550=function(_0x2194f4,_0x2ade81){_0x2194f4=_0x2194f4-0x0;var _0x2d4be2=_0x550e[_0x2194f4];return _0x2d4be2;};'use strict';var multer=require(_0xe550('0x0'));var util=require(_0xe550('0x1'));var path=require(_0xe550('0x2'));var timeout=require(_0xe550('0x3'));var express=require(_0xe550('0x4'));var router=express[_0xe550('0x5')]();var fs_extra=require(_0xe550('0x6'));var auth=require(_0xe550('0x7'));var interaction=require(_0xe550('0x8'));var config=require('../../config/environment');var controller=require(_0xe550('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe550('0xa')]);router[_0xe550('0xb')](_0xe550('0xc'),auth[_0xe550('0xd')](),controller['describe']);router[_0xe550('0xb')]('/:id',auth[_0xe550('0xd')](),controller[_0xe550('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe550('0xf')]);router['put'](_0xe550('0x10'),auth['isAuthenticated'](),controller[_0xe550('0x11')]);router['delete'](_0xe550('0x10'),auth[_0xe550('0xd')](),controller[_0xe550('0x12')]);module[_0xe550('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index cc2f664..4b7bf1d 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 _0x5ed9=['DATE','INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x189446,_0xddeb1e){var _0x1d425c=function(_0x528261){while(--_0x528261){_0x189446['push'](_0x189446['shift']());}};_0x1d425c(++_0xddeb1e);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5ed9[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0x95ed('0x0'));module[_0x95ed('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x95ed('0x2')]},'calleridnum':{'type':Sequelize[_0x95ed('0x2')]},'calleridname':{'type':Sequelize[_0x95ed('0x2')]},'queue':{'type':Sequelize[_0x95ed('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x95ed('0x2')]},'agentcalledAt':{'type':Sequelize[_0x95ed('0x3')]},'agentconnectAt':{'type':Sequelize[_0x95ed('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x95ed('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x95ed('0x4')]},'agentcomplete':{'type':Sequelize[_0x95ed('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x95ed('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x95ed('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x95ed('0x4')]},'agentacw':{'type':Sequelize[_0x95ed('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x95ed('0x2')]},'lastevent':{'type':Sequelize[_0x95ed('0x2')]},'channel':{'type':Sequelize[_0x95ed('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x95ed('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x95ed('0x2')]},'language':{'type':Sequelize[_0x95ed('0x2')]},'accountcode':{'type':Sequelize[_0x95ed('0x2')]},'context':{'type':Sequelize[_0x95ed('0x2')]},'exten':{'type':Sequelize[_0x95ed('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x95ed('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x95ed('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x95ed('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x95ed('0x2')]},'destlanguage':{'type':Sequelize[_0x95ed('0x2')]},'destaccountcode':{'type':Sequelize[_0x95ed('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x95ed('0x2')]},'destpriority':{'type':Sequelize[_0x95ed('0x2')]},'destuniqueid':{'type':Sequelize[_0x95ed('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x95ed('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x95ed('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x95ed('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x95ed('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x00ea=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports'];(function(_0x4bd06e,_0x593701){var _0x85ebb=function(_0x26a7f2){while(--_0x26a7f2){_0x4bd06e['push'](_0x4bd06e['shift']());}};_0x85ebb(++_0x593701);}(_0x00ea,0x19d));var _0xa00e=function(_0x482b06,_0x5a7a79){_0x482b06=_0x482b06-0x0;var _0x245c2e=_0x00ea[_0x482b06];return _0x245c2e;};'use strict';var Sequelize=require('sequelize');module[_0xa00e('0x0')]={'type':{'type':Sequelize[_0xa00e('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa00e('0x1')]},'calleridname':{'type':Sequelize[_0xa00e('0x1')]},'queue':{'type':Sequelize[_0xa00e('0x1')]},'interface':{'type':Sequelize[_0xa00e('0x1')]},'membername':{'type':Sequelize[_0xa00e('0x1')]},'agentcalledAt':{'type':Sequelize[_0xa00e('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xa00e('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xa00e('0x2')]},'agentdumpAt':{'type':Sequelize[_0xa00e('0x2')]},'holdtime':{'type':Sequelize[_0xa00e('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa00e('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa00e('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xa00e('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa00e('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xa00e('0x1')]},'channel':{'type':Sequelize[_0xa00e('0x1')]},'channelstate':{'type':Sequelize[_0xa00e('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa00e('0x1')]},'connectedlinename':{'type':Sequelize[_0xa00e('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa00e('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa00e('0x1')]},'priority':{'type':Sequelize[_0xa00e('0x1')]},'destchannel':{'type':Sequelize[_0xa00e('0x1')]},'destchannelstate':{'type':Sequelize[_0xa00e('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xa00e('0x1')]},'destcalleridname':{'type':Sequelize[_0xa00e('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa00e('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xa00e('0x1')]},'destcontext':{'type':Sequelize[_0xa00e('0x1')]},'destexten':{'type':Sequelize[_0xa00e('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa00e('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xa00e('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa00e('0x1')],'comment':_0xa00e('0x5')},'transferexten':{'type':Sequelize[_0xa00e('0x1')]},'transferuniqueid':{'type':Sequelize[_0xa00e('0x1')]},'agententerreason':{'type':Sequelize[_0xa00e('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 cf5ef25..dbce921 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(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 2197e09..c7569e2 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.model.js +++ b/server/api/voiceAgentReport/voiceAgentReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa990=['exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceAgentReport.attributes'];(function(_0x99accd,_0x428508){var _0x1067f2=function(_0x8d6010){while(--_0x8d6010){_0x99accd['push'](_0x99accd['shift']());}};_0x1067f2(++_0x428508);}(_0xa990,0xc9));var _0x0a99=function(_0x47b2f5,_0x40499c){_0x47b2f5=_0x47b2f5-0x0;var _0x26fb45=_0xa990[_0x47b2f5];return _0x26fb45;};'use strict';var _=require(_0x0a99('0x0'));var util=require(_0x0a99('0x1'));var logger=require(_0x0a99('0x2'))(_0x0a99('0x3'));var moment=require(_0x0a99('0x4'));var BPromise=require(_0x0a99('0x5'));var rp=require(_0x0a99('0x6'));var fs=require('fs');var path=require(_0x0a99('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0a99('0x8'));module[_0x0a99('0x9')]=function(_0xfdb594,_0x320560){return _0xfdb594[_0x0a99('0xa')](_0x0a99('0xb'),attributes,{'tableName':_0x0a99('0xc'),'paranoid':![],'indexes':[{'fields':[_0x0a99('0xd'),_0x0a99('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9649=['util','../../config/logger','api','bluebird','request-promise','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash'];(function(_0x14947d,_0x3251bb){var _0x43a267=function(_0x505a48){while(--_0x505a48){_0x14947d['push'](_0x14947d['shift']());}};_0x43a267(++_0x3251bb);}(_0x9649,0x19f));var _0x9964=function(_0x55a4f4,_0x7c1826){_0x55a4f4=_0x55a4f4-0x0;var _0x51e819=_0x9649[_0x55a4f4];return _0x51e819;};'use strict';var _=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var logger=require(_0x9964('0x2'))(_0x9964('0x3'));var moment=require('moment');var BPromise=require(_0x9964('0x4'));var rp=require(_0x9964('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9964('0x6'));var config=require('../../config/environment');var attributes=require(_0x9964('0x7'));module[_0x9964('0x8')]=function(_0x12dd14,_0x74bec9){return _0x12dd14[_0x9964('0x9')](_0x9964('0xa'),attributes,{'tableName':_0x9964('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x9964('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 2ed6321..c97790d 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 _0x4b51=['body','raw','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','VoiceAgentReport','create','options','CreateVoiceAgentReport','catch','UpdateVoiceAgentReport'];(function(_0x3dac2c,_0x2ad312){var _0x23f73a=function(_0x4fbb2a){while(--_0x4fbb2a){_0x3dac2c['push'](_0x3dac2c['shift']());}};_0x23f73a(++_0x2ad312);}(_0x4b51,0x11b));var _0x14b5=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0x4b51[_0x5e4563];return _0x8d1bf5;};'use strict';var _=require(_0x14b5('0x0'));var util=require(_0x14b5('0x1'));var moment=require(_0x14b5('0x2'));var BPromise=require(_0x14b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14b5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x14b5('0x5'));var logger=require(_0x14b5('0x6'))('rpc');var config=require(_0x14b5('0x7'));var jayson=require(_0x14b5('0x8'));var client=jayson['client'][_0x14b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f26bb,_0x2ef893,_0x2b3e21){return new BPromise(function(_0x2b09c6,_0x565e07){return client[_0x14b5('0xa')](_0x3f26bb,_0x2b3e21)[_0x14b5('0xb')](function(_0x48b270){logger[_0x14b5('0xc')](_0x14b5('0xd'),_0x2ef893,_0x14b5('0xe'));logger[_0x14b5('0xf')](_0x14b5('0x10'),_0x2ef893,'request\x20sent',JSON[_0x14b5('0x11')](_0x48b270));if(_0x48b270['error']){if(_0x48b270[_0x14b5('0x12')]['code']===0x1f4){logger['error'](_0x14b5('0xd'),_0x2ef893,_0x48b270[_0x14b5('0x12')][_0x14b5('0x13')]);return _0x565e07(_0x48b270[_0x14b5('0x12')][_0x14b5('0x13')]);}logger[_0x14b5('0x12')](_0x14b5('0xd'),_0x2ef893,_0x48b270['error'][_0x14b5('0x13')]);return _0x2b09c6(_0x48b270[_0x14b5('0x12')][_0x14b5('0x13')]);}else{logger[_0x14b5('0xc')](_0x14b5('0xd'),_0x2ef893,_0x14b5('0xe'));_0x2b09c6(_0x48b270[_0x14b5('0x14')][_0x14b5('0x13')]);}})['catch'](function(_0x533d1b){logger['error'](_0x14b5('0xd'),_0x2ef893,_0x533d1b);_0x565e07(_0x533d1b);});});}exports['CreateVoiceAgentReport']=function(_0x5bc851){var _0x20a1de=this;return new Promise(function(_0x333c1e,_0x2613b8){return db[_0x14b5('0x15')][_0x14b5('0x16')](_0x5bc851['body'],{'raw':_0x5bc851[_0x14b5('0x17')]?_0x5bc851[_0x14b5('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x14b5('0xb')](function(_0x55c2de){logger['info'](_0x14b5('0x18'),_0x5bc851);logger[_0x14b5('0xf')]('CreateVoiceAgentReport',_0x5bc851,JSON[_0x14b5('0x11')](_0x55c2de));_0x333c1e(_0x55c2de);})[_0x14b5('0x19')](function(_0x331056){logger[_0x14b5('0x12')](_0x14b5('0x18'),_0x331056[_0x14b5('0x13')],_0x5bc851);_0x2613b8(_0x20a1de[_0x14b5('0x12')](0x1f4,_0x331056[_0x14b5('0x13')]));});});};exports[_0x14b5('0x1a')]=function(_0x41dd6c){var _0xd5c5d6=this;return new Promise(function(_0x4c821c,_0x3485a6){return db['VoiceAgentReport']['update'](_0x41dd6c[_0x14b5('0x1b')],{'raw':_0x41dd6c[_0x14b5('0x17')]?_0x41dd6c[_0x14b5('0x17')][_0x14b5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41dd6c['options']?_0x41dd6c[_0x14b5('0x17')]['where']||null:null,'attributes':_0x41dd6c['options']?_0x41dd6c[_0x14b5('0x17')][_0x14b5('0x1d')]||null:null,'limit':_0x41dd6c['options']?_0x41dd6c[_0x14b5('0x17')][_0x14b5('0x1e')]||null:null})[_0x14b5('0xb')](function(_0x3a4140){logger[_0x14b5('0xc')](_0x14b5('0x1a'),_0x41dd6c);logger[_0x14b5('0xf')](_0x14b5('0x1a'),_0x41dd6c,JSON['stringify'](_0x3a4140));_0x4c821c(_0x3a4140);})[_0x14b5('0x19')](function(_0x4f4043){logger[_0x14b5('0x12')](_0x14b5('0x1a'),_0x4f4043['message'],_0x41dd6c);_0x3485a6(_0xd5c5d6[_0x14b5('0x12')](0x1f4,_0x4f4043[_0x14b5('0x13')]));});});}; \ No newline at end of file +var _0x89b6=['http','request','then','info','request\x20sent','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x3e6647,_0x2c0d09){var _0x46bddd=function(_0xad96c0){while(--_0xad96c0){_0x3e6647['push'](_0x3e6647['shift']());}};_0x46bddd(++_0x2c0d09);}(_0x89b6,0xf7));var _0x689b=function(_0x4535c7,_0x2c89c7){_0x4535c7=_0x4535c7-0x0;var _0x37ca9c=_0x89b6[_0x4535c7];return _0x37ca9c;};'use strict';var _=require(_0x689b('0x0'));var util=require(_0x689b('0x1'));var moment=require(_0x689b('0x2'));var BPromise=require('bluebird');var rs=require(_0x689b('0x3'));var fs=require('fs');var Redis=require(_0x689b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x689b('0x5'));var logger=require(_0x689b('0x6'))('rpc');var config=require(_0x689b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x689b('0x8')][_0x689b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49f0c3,_0x50a33f,_0x1fda90){return new BPromise(function(_0xfdae5,_0xc01215){return client[_0x689b('0xa')](_0x49f0c3,_0x1fda90)[_0x689b('0xb')](function(_0x4cb407){logger[_0x689b('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x50a33f,_0x689b('0xd'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x50a33f,_0x689b('0xd'),JSON[_0x689b('0xe')](_0x4cb407));if(_0x4cb407[_0x689b('0xf')]){if(_0x4cb407[_0x689b('0xf')][_0x689b('0x10')]===0x1f4){logger[_0x689b('0xf')](_0x689b('0x11'),_0x50a33f,_0x4cb407[_0x689b('0xf')]['message']);return _0xc01215(_0x4cb407['error']['message']);}logger['error'](_0x689b('0x11'),_0x50a33f,_0x4cb407['error'][_0x689b('0x12')]);return _0xfdae5(_0x4cb407[_0x689b('0xf')][_0x689b('0x12')]);}else{logger[_0x689b('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x50a33f,'request\x20sent');_0xfdae5(_0x4cb407[_0x689b('0x13')]['message']);}})[_0x689b('0x14')](function(_0x47f69c){logger[_0x689b('0xf')](_0x689b('0x11'),_0x50a33f,_0x47f69c);_0xc01215(_0x47f69c);});});}exports['CreateVoiceAgentReport']=function(_0x24e1f6){var _0x542eaf=this;return new Promise(function(_0x5c7efa,_0x48e78e){return db['VoiceAgentReport'][_0x689b('0x15')](_0x24e1f6[_0x689b('0x16')],{'raw':_0x24e1f6[_0x689b('0x17')]?_0x24e1f6['options'][_0x689b('0x18')]===undefined?!![]:![]:!![]})[_0x689b('0xb')](function(_0x46de51){logger[_0x689b('0xc')](_0x689b('0x19'),_0x24e1f6);logger['debug'](_0x689b('0x19'),_0x24e1f6,JSON[_0x689b('0xe')](_0x46de51));_0x5c7efa(_0x46de51);})['catch'](function(_0xa2db6b){logger[_0x689b('0xf')](_0x689b('0x19'),_0xa2db6b[_0x689b('0x12')],_0x24e1f6);_0x48e78e(_0x542eaf[_0x689b('0xf')](0x1f4,_0xa2db6b[_0x689b('0x12')]));});});};exports[_0x689b('0x1a')]=function(_0xf0ffda){var _0x1ab9ae=this;return new Promise(function(_0x2e2051,_0x4c6651){return db[_0x689b('0x1b')][_0x689b('0x1c')](_0xf0ffda['body'],{'raw':_0xf0ffda[_0x689b('0x17')]?_0xf0ffda[_0x689b('0x17')][_0x689b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf0ffda['options']?_0xf0ffda[_0x689b('0x17')][_0x689b('0x1d')]||null:null,'attributes':_0xf0ffda[_0x689b('0x17')]?_0xf0ffda[_0x689b('0x17')][_0x689b('0x1e')]||null:null,'limit':_0xf0ffda[_0x689b('0x17')]?_0xf0ffda[_0x689b('0x17')][_0x689b('0x1f')]||null:null})['then'](function(_0x24c325){logger[_0x689b('0xc')](_0x689b('0x1a'),_0xf0ffda);logger['debug'](_0x689b('0x1a'),_0xf0ffda,JSON[_0x689b('0xe')](_0x24c325));_0x2e2051(_0x24c325);})[_0x689b('0x14')](function(_0x50f348){logger[_0x689b('0xf')](_0x689b('0x1a'),_0x50f348[_0x689b('0x12')],_0xf0ffda);_0x4c6651(_0x1ab9ae[_0x689b('0xf')](0x1f4,_0x50f348[_0x689b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 911284c..0a2bebb 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 _0x6334=['../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x22df37,_0x4c5d93){var _0x370f60=function(_0x3116c9){while(--_0x3116c9){_0x22df37['push'](_0x22df37['shift']());}};_0x370f60(++_0x4c5d93);}(_0x6334,0x119));var _0x4633=function(_0x40f5b7,_0xb3243e){_0x40f5b7=_0x40f5b7-0x0;var _0x3c884a=_0x6334[_0x40f5b7];return _0x3c884a;};'use strict';var multer=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var path=require(_0x4633('0x2'));var timeout=require(_0x4633('0x3'));var express=require(_0x4633('0x4'));var router=express[_0x4633('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4633('0x6'));var interaction=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var controller=require(_0x4633('0x9'));router[_0x4633('0xa')]('/',auth[_0x4633('0xb')](),controller[_0x4633('0xc')]);router['get'](_0x4633('0xd'),auth['isAuthenticated'](),controller[_0x4633('0xe')]);router[_0x4633('0xa')]('/:id',auth[_0x4633('0xb')](),controller[_0x4633('0xf')]);router[_0x4633('0x10')]('/',auth['isAuthenticated'](),controller[_0x4633('0x11')]);router[_0x4633('0x12')]('/:id',auth[_0x4633('0xb')](),controller[_0x4633('0x13')]);router[_0x4633('0x14')](_0x4633('0x15'),auth['isAuthenticated'](),controller[_0x4633('0x16')]);module[_0x4633('0x17')]=router; \ No newline at end of file +var _0xf006=['post','create','put','update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x23b1d5,_0x3043fa){var _0x3f5702=function(_0xc9b7eb){while(--_0xc9b7eb){_0x23b1d5['push'](_0x23b1d5['shift']());}};_0x3f5702(++_0x3043fa);}(_0xf006,0x146));var _0x6f00=function(_0x2e8c1e,_0x5d6a87){_0x2e8c1e=_0x2e8c1e-0x0;var _0x565c72=_0xf006[_0x2e8c1e];return _0x565c72;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f00('0x0'));var timeout=require(_0x6f00('0x1'));var express=require('express');var router=express[_0x6f00('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6f00('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6f00('0x4'));router[_0x6f00('0x5')]('/',auth[_0x6f00('0x6')](),controller['index']);router[_0x6f00('0x5')]('/describe',auth[_0x6f00('0x6')](),controller[_0x6f00('0x7')]);router[_0x6f00('0x5')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0x9')]);router[_0x6f00('0xa')]('/',auth[_0x6f00('0x6')](),controller[_0x6f00('0xb')]);router[_0x6f00('0xc')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xd')]);router['delete'](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xe')]);module[_0x6f00('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 375e564..5fdf9ba 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 _0xd958=['outbound','inbound-fax','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports','inbound'];(function(_0x79a01e,_0xdf0f4f){var _0x4a3ef8=function(_0x217858){while(--_0x217858){_0x79a01e['push'](_0x79a01e['shift']());}};_0x4a3ef8(++_0xdf0f4f);}(_0xd958,0xb8));var _0x8d95=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xd958[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require(_0x8d95('0x0'));module[_0x8d95('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x8d95('0x2'),'internal',_0x8d95('0x3'),_0x8d95('0x4'),_0x8d95('0x5'),_0x8d95('0x6'))},'tag':{'type':Sequelize[_0x8d95('0x7')]},'accountcode':{'type':Sequelize[_0x8d95('0x7')]},'source':{'type':Sequelize[_0x8d95('0x7')]},'destination':{'type':Sequelize[_0x8d95('0x7')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8d95('0x7')]},'channel':{'type':Sequelize[_0x8d95('0x7')]},'destinationchannel':{'type':Sequelize[_0x8d95('0x7')]},'lastapplication':{'type':Sequelize[_0x8d95('0x7')]},'lastdata':{'type':Sequelize[_0x8d95('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x8d95('0x9')]},'answertime':{'type':Sequelize[_0x8d95('0x9')]},'endtime':{'type':Sequelize[_0x8d95('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x8d95('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8d95('0x7')]},'amaflags':{'type':Sequelize[_0x8d95('0x7')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x8d95('0x7')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x8d95('0x7')]},'note':{'type':Sequelize[_0x8d95('0x7')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x8d95('0xa')]},'sipcallid':{'type':Sequelize[_0x8d95('0x7')]}}; \ No newline at end of file +var _0xee3a=['sequelize','exports','STRING','inbound','internal','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xee3a,0x13f));var _0xaee3=function(_0x355c40,_0x6ee5f7){_0x355c40=_0x355c40-0x0;var _0x15c2d9=_0xee3a[_0x355c40];return _0x15c2d9;};'use strict';var Sequelize=require(_0xaee3('0x0'));module[_0xaee3('0x1')]={'uniqueid':{'type':Sequelize[_0xaee3('0x2')]},'type':{'type':Sequelize['ENUM'](_0xaee3('0x3'),_0xaee3('0x4'),'outbound',_0xaee3('0x5'),_0xaee3('0x6'),_0xaee3('0x7'))},'tag':{'type':Sequelize[_0xaee3('0x2')]},'accountcode':{'type':Sequelize[_0xaee3('0x2')]},'source':{'type':Sequelize[_0xaee3('0x2')]},'destination':{'type':Sequelize[_0xaee3('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xaee3('0x2')]},'channel':{'type':Sequelize[_0xaee3('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xaee3('0x8')]},'starttime':{'type':Sequelize[_0xaee3('0x9')]},'systemanswertime':{'type':Sequelize[_0xaee3('0x9')]},'answertime':{'type':Sequelize[_0xaee3('0x9')]},'endtime':{'type':Sequelize[_0xaee3('0x9')]},'duration':{'type':Sequelize[_0xaee3('0xa')]},'billableseconds':{'type':Sequelize[_0xaee3('0xa')]},'mohtime':{'type':Sequelize[_0xaee3('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xaee3('0x2')]},'userDisposition':{'type':Sequelize[_0xaee3('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xaee3('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xaee3('0x2')]},'note':{'type':Sequelize[_0xaee3('0x2')]},'prefix':{'type':Sequelize[_0xaee3('0x2')]},'routeid':{'type':Sequelize[_0xaee3('0xa')]},'sipcallid':{'type':Sequelize[_0xaee3('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index c27bcc4..d3d0a9a 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 _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x3ade9c,_0x1a79c5){_0x3ade9c=_0x3ade9c-0x0;var _0x15ffb1=_0x2032[_0x3ade9c];return _0x15ffb1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x1fe512,_0x3c716a){var _0x4f8c1f=function(_0x913ccc){while(--_0x913ccc){_0x1fe512['push'](_0x1fe512['shift']());}};_0x4f8c1f(++_0x3c716a);}(_0xdb28,0x106));var _0x8db2=function(_0xb10299,_0x22e1d3){_0xb10299=_0xb10299-0x0;var _0x1411d8=_0xdb28[_0xb10299];return _0x1411d8;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 164a644..0b55795 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 _0x7a97=['bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x4fcaaf,_0x2e9b4b){var _0x6bcb2c=function(_0x3ee945){while(--_0x3ee945){_0x4fcaaf['push'](_0x4fcaaf['shift']());}};_0x6bcb2c(++_0x2e9b4b);}(_0x7a97,0x1b4));var _0x77a9=function(_0x23247e,_0x3ecc66){_0x23247e=_0x23247e-0x0;var _0x2d82d3=_0x7a97[_0x23247e];return _0x2d82d3;};'use strict';var _=require(_0x77a9('0x0'));var util=require('util');var logger=require(_0x77a9('0x1'))(_0x77a9('0x2'));var moment=require(_0x77a9('0x3'));var BPromise=require(_0x77a9('0x4'));var rp=require(_0x77a9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77a9('0x6'));var config=require(_0x77a9('0x7'));var attributes=require(_0x77a9('0x8'));module[_0x77a9('0x9')]=function(_0x2a0eba,_0x1a0451){return _0x2a0eba['define']('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x77a9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e44=['moment','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','lodash','util','../../config/logger','api'];(function(_0x5dd829,_0x5d2ec8){var _0x5c981f=function(_0x37c58c){while(--_0x37c58c){_0x5dd829['push'](_0x5dd829['shift']());}};_0x5c981f(++_0x5d2ec8);}(_0x1e44,0x1a9));var _0x41e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e44[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41e4('0x0'));var util=require(_0x41e4('0x1'));var logger=require(_0x41e4('0x2'))(_0x41e4('0x3'));var moment=require(_0x41e4('0x4'));var BPromise=require(_0x41e4('0x5'));var rp=require(_0x41e4('0x6'));var fs=require('fs');var path=require(_0x41e4('0x7'));var rimraf=require('rimraf');var config=require(_0x41e4('0x8'));var attributes=require(_0x41e4('0x9'));module[_0x41e4('0xa')]=function(_0x4f0c86,_0xf44512){return _0x4f0c86[_0x41e4('0xb')](_0x41e4('0xc'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 772e615..f3dd91a 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 _0x2e16=['include','model','attributes','map','CreateVoiceCallReport','VoiceCallReport','body','raw','then','UpdateVoiceCallReport','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetVoiceCallReport','findAll','options','where'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x2e16,0x80));var _0x62e1=function(_0x277c26,_0x409be9){_0x277c26=_0x277c26-0x0;var _0x2a2e36=_0x2e16[_0x277c26];return _0x2a2e36;};'use strict';var _=require(_0x62e1('0x0'));var util=require(_0x62e1('0x1'));var moment=require(_0x62e1('0x2'));var BPromise=require(_0x62e1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62e1('0x4'));var db=require(_0x62e1('0x5'))['db'];var utils=require(_0x62e1('0x6'));var logger=require(_0x62e1('0x7'))(_0x62e1('0x8'));var config=require(_0x62e1('0x9'));var jayson=require(_0x62e1('0xa'));var client=jayson[_0x62e1('0xb')][_0x62e1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc690f5,_0x28dd64,_0x1f80a4){return new BPromise(function(_0x5e17f7,_0x5153dd){return client[_0x62e1('0xd')](_0xc690f5,_0x1f80a4)['then'](function(_0x1e01bf){logger['info'](_0x62e1('0xe'),_0x28dd64,_0x62e1('0xf'));logger[_0x62e1('0x10')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x28dd64,_0x62e1('0xf'),JSON[_0x62e1('0x11')](_0x1e01bf));if(_0x1e01bf['error']){if(_0x1e01bf[_0x62e1('0x12')][_0x62e1('0x13')]===0x1f4){logger[_0x62e1('0x12')](_0x62e1('0xe'),_0x28dd64,_0x1e01bf[_0x62e1('0x12')][_0x62e1('0x14')]);return _0x5153dd(_0x1e01bf[_0x62e1('0x12')]['message']);}logger['error'](_0x62e1('0xe'),_0x28dd64,_0x1e01bf['error'][_0x62e1('0x14')]);return _0x5e17f7(_0x1e01bf[_0x62e1('0x12')]['message']);}else{logger[_0x62e1('0x15')](_0x62e1('0xe'),_0x28dd64,_0x62e1('0xf'));_0x5e17f7(_0x1e01bf[_0x62e1('0x16')][_0x62e1('0x14')]);}})[_0x62e1('0x17')](function(_0x5bac3f){logger[_0x62e1('0x12')](_0x62e1('0xe'),_0x28dd64,_0x5bac3f);_0x5153dd(_0x5bac3f);});});}exports[_0x62e1('0x18')]=function(_0x5f1979){var _0x470ba7=this;return new Promise(function(_0xf5fda8,_0x4e8ef0){return db['VoiceCallReport'][_0x62e1('0x19')]({'raw':_0x5f1979['options']?_0x5f1979[_0x62e1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5f1979['options']?_0x5f1979[_0x62e1('0x1a')][_0x62e1('0x1b')]||null:null,'attributes':_0x5f1979[_0x62e1('0x1a')]?_0x5f1979['options']['attributes']||null:null,'limit':_0x5f1979[_0x62e1('0x1a')]?_0x5f1979[_0x62e1('0x1a')]['limit']||null:null,'include':_0x5f1979[_0x62e1('0x1a')]?_0x5f1979[_0x62e1('0x1a')][_0x62e1('0x1c')]?_['map'](_0x5f1979['options'][_0x62e1('0x1c')],function(_0x4b0361){return{'model':db[_0x4b0361[_0x62e1('0x1d')]],'as':_0x4b0361['as'],'attributes':_0x4b0361[_0x62e1('0x1e')],'include':_0x4b0361[_0x62e1('0x1c')]?_[_0x62e1('0x1f')](_0x4b0361[_0x62e1('0x1c')],function(_0x2ee45b){return{'model':db[_0x2ee45b[_0x62e1('0x1d')]],'as':_0x2ee45b['as'],'attributes':_0x2ee45b[_0x62e1('0x1e')],'include':_0x2ee45b[_0x62e1('0x1c')]?_[_0x62e1('0x1f')](_0x2ee45b[_0x62e1('0x1c')],function(_0x175826){return{'model':db[_0x175826['model']],'as':_0x175826['as'],'attributes':_0x175826[_0x62e1('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ef87b){logger[_0x62e1('0x15')](_0x62e1('0x18'),_0x5f1979);logger[_0x62e1('0x10')]('GetVoiceCallReport',_0x5f1979,JSON[_0x62e1('0x11')](_0x4ef87b));_0xf5fda8(_0x4ef87b);})[_0x62e1('0x17')](function(_0x525c75){logger[_0x62e1('0x12')](_0x62e1('0x18'),_0x525c75[_0x62e1('0x14')],_0x5f1979);_0x4e8ef0(_0x470ba7[_0x62e1('0x12')](0x1f4,_0x525c75[_0x62e1('0x14')]));});});};exports[_0x62e1('0x20')]=function(_0xc823){var _0x4417fb=this;return new Promise(function(_0x216b14,_0x224149){return db[_0x62e1('0x21')]['create'](_0xc823[_0x62e1('0x22')],{'raw':_0xc823[_0x62e1('0x1a')]?_0xc823[_0x62e1('0x1a')][_0x62e1('0x23')]===undefined?!![]:![]:!![]})[_0x62e1('0x24')](function(_0x398a66){logger[_0x62e1('0x15')](_0x62e1('0x20'),_0xc823);logger['debug'](_0x62e1('0x20'),_0xc823,JSON[_0x62e1('0x11')](_0x398a66));_0x216b14(_0x398a66);})['catch'](function(_0x587e1c){logger[_0x62e1('0x12')](_0x62e1('0x20'),_0x587e1c[_0x62e1('0x14')],_0xc823);_0x224149(_0x4417fb[_0x62e1('0x12')](0x1f4,_0x587e1c[_0x62e1('0x14')]));});});};exports[_0x62e1('0x25')]=function(_0xa6f9b1){var _0x5c63f2=this;return new Promise(function(_0x561139,_0x449970){return db[_0x62e1('0x21')]['update'](_0xa6f9b1[_0x62e1('0x22')],{'raw':_0xa6f9b1[_0x62e1('0x1a')]?_0xa6f9b1[_0x62e1('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa6f9b1[_0x62e1('0x1a')]?_0xa6f9b1[_0x62e1('0x1a')]['where']||null:null,'attributes':_0xa6f9b1[_0x62e1('0x1a')]?_0xa6f9b1[_0x62e1('0x1a')][_0x62e1('0x1e')]||null:null,'limit':_0xa6f9b1[_0x62e1('0x1a')]?_0xa6f9b1['options'][_0x62e1('0x26')]||null:null})[_0x62e1('0x24')](function(_0x3ea7bd){logger[_0x62e1('0x15')](_0x62e1('0x25'),_0xa6f9b1);logger['debug']('UpdateVoiceCallReport',_0xa6f9b1,JSON['stringify'](_0x3ea7bd));_0x561139(_0x3ea7bd);})[_0x62e1('0x17')](function(_0x3f0bdf){logger[_0x62e1('0x12')](_0x62e1('0x25'),_0x3f0bdf[_0x62e1('0x14')],_0xa6f9b1);_0x449970(_0x5c63f2['error'](0x1f4,_0x3f0bdf['message']));});});}; \ No newline at end of file +var _0x4a6e=['create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','catch','VoiceCallReport','findAll','raw','options','where','limit','include','map','model','attributes','GetVoiceCallReport','CreateVoiceCallReport'];(function(_0x2cdca5,_0x15ef76){var _0x1103b4=function(_0x1482a2){while(--_0x1482a2){_0x2cdca5['push'](_0x2cdca5['shift']());}};_0x1103b4(++_0x15ef76);}(_0x4a6e,0x115));var _0xe4a6=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x4a6e[_0x56fe98];return _0x212f4f;};'use strict';var _=require(_0xe4a6('0x0'));var util=require(_0xe4a6('0x1'));var moment=require(_0xe4a6('0x2'));var BPromise=require(_0xe4a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4a6('0x4'));var db=require(_0xe4a6('0x5'))['db'];var utils=require(_0xe4a6('0x6'));var logger=require(_0xe4a6('0x7'))(_0xe4a6('0x8'));var config=require(_0xe4a6('0x9'));var jayson=require(_0xe4a6('0xa'));var client=jayson[_0xe4a6('0xb')][_0xe4a6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2aebb8,_0x380e32,_0x3cc1c9){return new BPromise(function(_0x25e2be,_0x34579e){return client[_0xe4a6('0xd')](_0x2aebb8,_0x3cc1c9)['then'](function(_0xeea331){logger[_0xe4a6('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x380e32,'request\x20sent');logger[_0xe4a6('0xf')](_0xe4a6('0x10'),_0x380e32,_0xe4a6('0x11'),JSON[_0xe4a6('0x12')](_0xeea331));if(_0xeea331['error']){if(_0xeea331['error']['code']===0x1f4){logger[_0xe4a6('0x13')](_0xe4a6('0x14'),_0x380e32,_0xeea331[_0xe4a6('0x13')][_0xe4a6('0x15')]);return _0x34579e(_0xeea331[_0xe4a6('0x13')][_0xe4a6('0x15')]);}logger[_0xe4a6('0x13')](_0xe4a6('0x14'),_0x380e32,_0xeea331['error'][_0xe4a6('0x15')]);return _0x25e2be(_0xeea331[_0xe4a6('0x13')][_0xe4a6('0x15')]);}else{logger[_0xe4a6('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x380e32,_0xe4a6('0x11'));_0x25e2be(_0xeea331['result'][_0xe4a6('0x15')]);}})[_0xe4a6('0x16')](function(_0x6878c3){logger['error'](_0xe4a6('0x14'),_0x380e32,_0x6878c3);_0x34579e(_0x6878c3);});});}exports['GetVoiceCallReport']=function(_0x507eac){var _0x590d1d=this;return new Promise(function(_0x367225,_0x2716d8){return db[_0xe4a6('0x17')][_0xe4a6('0x18')]({'raw':_0x507eac['options']?_0x507eac['options'][_0xe4a6('0x19')]===undefined?!![]:![]:!![],'where':_0x507eac['options']?_0x507eac[_0xe4a6('0x1a')][_0xe4a6('0x1b')]||null:null,'attributes':_0x507eac[_0xe4a6('0x1a')]?_0x507eac['options']['attributes']||null:null,'limit':_0x507eac[_0xe4a6('0x1a')]?_0x507eac[_0xe4a6('0x1a')][_0xe4a6('0x1c')]||null:null,'include':_0x507eac['options']?_0x507eac[_0xe4a6('0x1a')][_0xe4a6('0x1d')]?_[_0xe4a6('0x1e')](_0x507eac['options'][_0xe4a6('0x1d')],function(_0x1f7abc){return{'model':db[_0x1f7abc[_0xe4a6('0x1f')]],'as':_0x1f7abc['as'],'attributes':_0x1f7abc[_0xe4a6('0x20')],'include':_0x1f7abc[_0xe4a6('0x1d')]?_[_0xe4a6('0x1e')](_0x1f7abc[_0xe4a6('0x1d')],function(_0x97a4a4){return{'model':db[_0x97a4a4['model']],'as':_0x97a4a4['as'],'attributes':_0x97a4a4[_0xe4a6('0x20')],'include':_0x97a4a4[_0xe4a6('0x1d')]?_[_0xe4a6('0x1e')](_0x97a4a4['include'],function(_0x443907){return{'model':db[_0x443907[_0xe4a6('0x1f')]],'as':_0x443907['as'],'attributes':_0x443907[_0xe4a6('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x210f74){logger[_0xe4a6('0xe')](_0xe4a6('0x21'),_0x507eac);logger[_0xe4a6('0xf')](_0xe4a6('0x21'),_0x507eac,JSON['stringify'](_0x210f74));_0x367225(_0x210f74);})[_0xe4a6('0x16')](function(_0x455bfa){logger[_0xe4a6('0x13')](_0xe4a6('0x21'),_0x455bfa[_0xe4a6('0x15')],_0x507eac);_0x2716d8(_0x590d1d[_0xe4a6('0x13')](0x1f4,_0x455bfa[_0xe4a6('0x15')]));});});};exports[_0xe4a6('0x22')]=function(_0x3bfb16){var _0x48657a=this;return new Promise(function(_0x579723,_0x2f7b02){return db[_0xe4a6('0x17')][_0xe4a6('0x23')](_0x3bfb16[_0xe4a6('0x24')],{'raw':_0x3bfb16['options']?_0x3bfb16[_0xe4a6('0x1a')][_0xe4a6('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3b02ac){logger[_0xe4a6('0xe')]('CreateVoiceCallReport',_0x3bfb16);logger[_0xe4a6('0xf')](_0xe4a6('0x22'),_0x3bfb16,JSON[_0xe4a6('0x12')](_0x3b02ac));_0x579723(_0x3b02ac);})[_0xe4a6('0x16')](function(_0x3b92f4){logger[_0xe4a6('0x13')](_0xe4a6('0x22'),_0x3b92f4['message'],_0x3bfb16);_0x2f7b02(_0x48657a[_0xe4a6('0x13')](0x1f4,_0x3b92f4[_0xe4a6('0x15')]));});});};exports[_0xe4a6('0x25')]=function(_0x4de33b){var _0x991ec5=this;return new Promise(function(_0x2eac31,_0x56ef38){return db[_0xe4a6('0x17')][_0xe4a6('0x26')](_0x4de33b[_0xe4a6('0x24')],{'raw':_0x4de33b['options']?_0x4de33b[_0xe4a6('0x1a')][_0xe4a6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4de33b[_0xe4a6('0x1a')]?_0x4de33b[_0xe4a6('0x1a')]['where']||null:null,'attributes':_0x4de33b[_0xe4a6('0x1a')]?_0x4de33b[_0xe4a6('0x1a')][_0xe4a6('0x20')]||null:null,'limit':_0x4de33b['options']?_0x4de33b[_0xe4a6('0x1a')][_0xe4a6('0x1c')]||null:null})['then'](function(_0x3ee4a5){logger[_0xe4a6('0xe')](_0xe4a6('0x25'),_0x4de33b);logger[_0xe4a6('0xf')](_0xe4a6('0x25'),_0x4de33b,JSON[_0xe4a6('0x12')](_0x3ee4a5));_0x2eac31(_0x3ee4a5);})['catch'](function(_0x5968dc){logger[_0xe4a6('0x13')](_0xe4a6('0x25'),_0x5968dc[_0xe4a6('0x15')],_0x4de33b);_0x56ef38(_0x991ec5[_0xe4a6('0x13')](0x1f4,_0x5968dc[_0xe4a6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 41bfb2c..8fe94bb 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 _0xa38d=['connect-timeout','fs-extra','../../config/environment','isAuthenticated','index','get','/:id','show','update','destroy','exports','multer','path'];(function(_0x49a96e,_0xd3e8b8){var _0x27fc64=function(_0x153402){while(--_0x153402){_0x49a96e['push'](_0x49a96e['shift']());}};_0x27fc64(++_0xd3e8b8);}(_0xa38d,0xf5));var _0xda38=function(_0x5db8e5,_0x35e3d5){_0x5db8e5=_0x5db8e5-0x0;var _0x4f800d=_0xa38d[_0x5db8e5];return _0x4f800d;};'use strict';var multer=require(_0xda38('0x0'));var util=require('util');var path=require(_0xda38('0x1'));var timeout=require(_0xda38('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xda38('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xda38('0x4'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0xda38('0x5')](),controller[_0xda38('0x6')]);router[_0xda38('0x7')](_0xda38('0x8'),auth[_0xda38('0x5')](),controller[_0xda38('0x9')]);router['post']('/',auth[_0xda38('0x5')](),controller['create']);router['put'](_0xda38('0x8'),auth[_0xda38('0x5')](),controller[_0xda38('0xa')]);router['delete'](_0xda38('0x8'),auth['isAuthenticated'](),controller[_0xda38('0xb')]);module[_0xda38('0xc')]=router; \ No newline at end of file +var _0xc2a0=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id','show','post','create'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc2a0,0x16c));var _0x0c2a=function(_0x49f582,_0x1f597d){_0x49f582=_0x49f582-0x0;var _0x5400b9=_0xc2a0[_0x49f582];return _0x5400b9;};'use strict';var multer=require(_0x0c2a('0x0'));var util=require(_0x0c2a('0x1'));var path=require(_0x0c2a('0x2'));var timeout=require(_0x0c2a('0x3'));var express=require(_0x0c2a('0x4'));var router=express[_0x0c2a('0x5')]();var fs_extra=require(_0x0c2a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0c2a('0x7'));var controller=require('./voiceChanSpy.controller');router[_0x0c2a('0x8')]('/',auth[_0x0c2a('0x9')](),controller['index']);router['get'](_0x0c2a('0xa'),auth[_0x0c2a('0x9')](),controller[_0x0c2a('0xb')]);router[_0x0c2a('0xc')]('/',auth[_0x0c2a('0x9')](),controller[_0x0c2a('0xd')]);router[_0x0c2a('0xe')](_0x0c2a('0xa'),auth[_0x0c2a('0x9')](),controller[_0x0c2a('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0c2a('0x10')]);module[_0x0c2a('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index c18b472..e92e7b7 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 _0x23d1=['getDataValue','split','sequelize','exports','STRING','name','setDataValue','options','join'];(function(_0x117e44,_0x5e5ce8){var _0x2fcd2b=function(_0x281c31){while(--_0x281c31){_0x117e44['push'](_0x117e44['shift']());}};_0x2fcd2b(++_0x5e5ce8);}(_0x23d1,0xe3));var _0x123d=function(_0x24f8af,_0x6e7b9a){_0x24f8af=_0x24f8af-0x0;var _0x4b6547=_0x23d1[_0x24f8af];return _0x4b6547;};'use strict';var Sequelize=require(_0x123d('0x0'));module[_0x123d('0x1')]={'name':{'type':Sequelize[_0x123d('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x123d('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x123d('0x2')],'set':function(_0xdeb09e){this[_0x123d('0x4')](_0x123d('0x5'),_0xdeb09e?_0xdeb09e[_0x123d('0x6')](''):[]);},'get':function(){return this[_0x123d('0x7')]('options')?this[_0x123d('0x7')](_0x123d('0x5'))[_0x123d('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x123d('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x123d('0x2')]}}; \ No newline at end of file +var _0xdbaa=['split','BOOLEAN','sequelize','exports','STRING','options','join','getDataValue'];(function(_0x5812ba,_0x3c596b){var _0x1583e6=function(_0x2931a6){while(--_0x2931a6){_0x5812ba['push'](_0x5812ba['shift']());}};_0x1583e6(++_0x3c596b);}(_0xdbaa,0xb2));var _0xadba=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xdbaa[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0xadba('0x0'));module[_0xadba('0x1')]={'name':{'type':Sequelize[_0xadba('0x2')]},'prefix':{'type':Sequelize[_0xadba('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xadba('0x2')],'set':function(_0x3e59ef){this['setDataValue'](_0xadba('0x3'),_0x3e59ef?_0x3e59ef[_0xadba('0x4')](''):[]);},'get':function(){return this[_0xadba('0x5')](_0xadba('0x3'))?this['getDataValue'](_0xadba('0x3'))[_0xadba('0x6')](''):[];}},'auth':{'type':Sequelize[_0xadba('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xadba('0x2')]},'record':{'type':Sequelize[_0xadba('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xadba('0x2')]},'description':{'type':Sequelize[_0xadba('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 179a1eb..b3d3744 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 _0xd547=['fs-extra','lodash','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','get','ChanSpies','UserProfileResource','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceChanSpy','includeAll','include','rows','catch','show','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs'];(function(_0x3321e2,_0xadeddb){var _0x691b2=function(_0x3eae44){while(--_0x3eae44){_0x3321e2['push'](_0x3321e2['shift']());}};_0x691b2(++_0xadeddb);}(_0xd547,0x1c1));var _0x7d54=function(_0x54ce4a,_0x502cba){_0x54ce4a=_0x54ce4a-0x0;var _0x279dce=_0xd547[_0x54ce4a];return _0x279dce;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7d54('0x0'));var jsonpatch=require(_0x7d54('0x1'));var rp=require(_0x7d54('0x2'));var moment=require(_0x7d54('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7d54('0x4'));var path=require('path');var sox=require(_0x7d54('0x5'));var csv=require('to-csv');var ejs=require(_0x7d54('0x6'));var fs=require('fs');var fs_extra=require(_0x7d54('0x7'));var _=require(_0x7d54('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d54('0x9'));var toCsv=require(_0x7d54('0xa'));var querystring=require('querystring');var Papa=require(_0x7d54('0xb'));var Redis=require('ioredis');var authService=require(_0x7d54('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x7d54('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d54('0xe'))(_0x7d54('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7d54('0x10'))['db'];function respondWithStatusCode(_0x3e8072,_0x428430){_0x428430=_0x428430||0xcc;return function(_0x4be6c5){if(_0x4be6c5){return _0x3e8072[_0x7d54('0x11')](_0x428430);}return _0x3e8072['status'](_0x428430)[_0x7d54('0x12')]();};}function respondWithResult(_0x5e46ee,_0x11c94a){_0x11c94a=_0x11c94a||0xc8;return function(_0x43718a){if(_0x43718a){return _0x5e46ee['status'](_0x11c94a)[_0x7d54('0x13')](_0x43718a);}};}function respondWithFilteredResult(_0x208b3c,_0x25b69c){return function(_0x5a6bec){if(_0x5a6bec){var _0x2b1b0f=typeof _0x25b69c[_0x7d54('0x14')]===_0x7d54('0x15')&&typeof _0x25b69c[_0x7d54('0x16')]===_0x7d54('0x15');var _0x22f27c=_0x5a6bec['count'];var _0x81971b=_0x2b1b0f?0x0:_0x25b69c[_0x7d54('0x14')];var _0x57e789=_0x2b1b0f?_0x5a6bec[_0x7d54('0x17')]:_0x25b69c['offset']+_0x25b69c['limit'];var _0x46a719;if(_0x57e789>=_0x22f27c){_0x57e789=_0x22f27c;_0x46a719=0xc8;}else{_0x46a719=0xce;}_0x208b3c[_0x7d54('0x18')](_0x46a719);return _0x208b3c[_0x7d54('0x19')](_0x7d54('0x1a'),_0x81971b+'-'+_0x57e789+'/'+_0x22f27c)['json'](_0x5a6bec);}return null;};}function patchUpdates(_0x23ea55){return function(_0x2b0770){try{jsonpatch['apply'](_0x2b0770,_0x23ea55,!![]);}catch(_0x22718f){return BPromise[_0x7d54('0x1b')](_0x22718f);}return _0x2b0770[_0x7d54('0x1c')]();};}function saveUpdates(_0x6cc88b,_0x715a4e){return function(_0x4fe2cb){if(_0x4fe2cb){return _0x4fe2cb[_0x7d54('0x1d')](_0x6cc88b)['then'](function(_0x589f93){return _0x589f93;});}return null;};}function removeEntity(_0x5e0c4b,_0x2967b0){return function(_0x299f6e){if(_0x299f6e){return _0x299f6e['destroy']()[_0x7d54('0x1e')](function(){var _0x3990e7=_0x299f6e[_0x7d54('0x1f')]({'plain':!![]});var _0x19520a=_0x7d54('0x20');return db[_0x7d54('0x21')][_0x7d54('0x22')]({'where':{'type':_0x19520a,'resourceId':_0x3990e7['id']}})[_0x7d54('0x1e')](function(){return _0x299f6e;});})['then'](function(){_0x5e0c4b[_0x7d54('0x18')](0xcc)[_0x7d54('0x12')]();});}};}function handleEntityNotFound(_0x5117a4,_0x53a64c){return function(_0x5c96de){if(!_0x5c96de){_0x5117a4['sendStatus'](0x194);}return _0x5c96de;};}function handleError(_0x24f2cc,_0xa4c745){_0xa4c745=_0xa4c745||0x1f4;return function(_0x57e2ce){logger[_0x7d54('0x23')](_0x57e2ce[_0x7d54('0x24')]);if(_0x57e2ce['name']){delete _0x57e2ce[_0x7d54('0x25')];}_0x24f2cc[_0x7d54('0x18')](_0xa4c745)[_0x7d54('0x26')](_0x57e2ce);};}exports[_0x7d54('0x27')]=function(_0x3e8bd0,_0x2f1052){var _0x191eaa={},_0x30737a={},_0x50d88e={'count':0x0,'rows':[]};var _0x2894d6=_['map'](db['VoiceChanSpy'][_0x7d54('0x28')],function(_0x2d31ff){return{'name':_0x2d31ff['fieldName'],'type':_0x2d31ff[_0x7d54('0x29')][_0x7d54('0x2a')]};});_0x30737a[_0x7d54('0x2b')]=_[_0x7d54('0x2c')](_0x2894d6,_0x7d54('0x25'));_0x30737a[_0x7d54('0x2d')]=_[_0x7d54('0x2e')](_0x3e8bd0['query']);_0x30737a[_0x7d54('0x2f')]=_[_0x7d54('0x30')](_0x30737a['model'],_0x30737a[_0x7d54('0x2d')]);_0x191eaa[_0x7d54('0x31')]=_[_0x7d54('0x30')](_0x30737a['model'],qs[_0x7d54('0x32')](_0x3e8bd0[_0x7d54('0x2d')][_0x7d54('0x32')]));_0x191eaa[_0x7d54('0x31')]=_0x191eaa[_0x7d54('0x31')]['length']?_0x191eaa[_0x7d54('0x31')]:_0x30737a[_0x7d54('0x2b')];if(!_0x3e8bd0['query'][_0x7d54('0x33')](_0x7d54('0x34'))){_0x191eaa[_0x7d54('0x16')]=qs[_0x7d54('0x16')](_0x3e8bd0[_0x7d54('0x2d')][_0x7d54('0x16')]);_0x191eaa[_0x7d54('0x14')]=qs[_0x7d54('0x14')](_0x3e8bd0[_0x7d54('0x2d')][_0x7d54('0x14')]);}_0x191eaa[_0x7d54('0x35')]=qs[_0x7d54('0x36')](_0x3e8bd0['query']['sort']);_0x191eaa[_0x7d54('0x37')]=qs[_0x7d54('0x2f')](_[_0x7d54('0x38')](_0x3e8bd0[_0x7d54('0x2d')],_0x30737a['filters']),_0x2894d6);if(_0x3e8bd0['query'][_0x7d54('0x39')]){_0x191eaa['where']=_[_0x7d54('0x3a')](_0x191eaa[_0x7d54('0x37')],{'$or':_['map'](_0x2894d6,function(_0x5c4b93){if(_0x5c4b93[_0x7d54('0x29')]!==_0x7d54('0x3b')){var _0x57203d={};_0x57203d[_0x5c4b93[_0x7d54('0x25')]]={'$like':'%'+_0x3e8bd0[_0x7d54('0x2d')]['filter']+'%'};return _0x57203d;}})});}_0x191eaa=_['merge']({},_0x191eaa,_0x3e8bd0[_0x7d54('0x3c')]);var _0x3ddff4={'where':_0x191eaa[_0x7d54('0x37')]};return db[_0x7d54('0x3d')][_0x7d54('0x17')](_0x3ddff4)[_0x7d54('0x1e')](function(_0x17f951){_0x50d88e[_0x7d54('0x17')]=_0x17f951;if(_0x3e8bd0[_0x7d54('0x2d')][_0x7d54('0x3e')]){_0x191eaa[_0x7d54('0x3f')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x191eaa);})[_0x7d54('0x1e')](function(_0xd8cefd){_0x50d88e[_0x7d54('0x40')]=_0xd8cefd;return _0x50d88e;})[_0x7d54('0x1e')](respondWithFilteredResult(_0x2f1052,_0x191eaa))[_0x7d54('0x41')](handleError(_0x2f1052,null));};exports[_0x7d54('0x42')]=function(_0x45ecf5,_0x4dc2e2){var _0x367ecd={'raw':![],'where':{'id':_0x45ecf5['params']['id']}},_0x588360={};_0x588360[_0x7d54('0x2b')]=_[_0x7d54('0x2e')](db[_0x7d54('0x3d')][_0x7d54('0x28')]);_0x588360[_0x7d54('0x2d')]=_['keys'](_0x45ecf5[_0x7d54('0x2d')]);_0x588360[_0x7d54('0x2f')]=_['intersection'](_0x588360[_0x7d54('0x2b')],_0x588360[_0x7d54('0x2d')]);_0x367ecd[_0x7d54('0x31')]=_[_0x7d54('0x30')](_0x588360[_0x7d54('0x2b')],qs[_0x7d54('0x32')](_0x45ecf5['query'][_0x7d54('0x32')]));_0x367ecd[_0x7d54('0x31')]=_0x367ecd[_0x7d54('0x31')][_0x7d54('0x43')]?_0x367ecd[_0x7d54('0x31')]:_0x588360[_0x7d54('0x2b')];if(_0x45ecf5[_0x7d54('0x2d')]['includeAll']){_0x367ecd[_0x7d54('0x3f')]=[{'all':!![]}];}_0x367ecd=_[_0x7d54('0x3a')]({},_0x367ecd,_0x45ecf5[_0x7d54('0x3c')]);return db[_0x7d54('0x3d')][_0x7d54('0x44')](_0x367ecd)['then'](handleEntityNotFound(_0x4dc2e2,null))[_0x7d54('0x1e')](respondWithResult(_0x4dc2e2,null))['catch'](handleError(_0x4dc2e2,null));};exports[_0x7d54('0x45')]=function(_0x560b42,_0x5b6449){return db[_0x7d54('0x3d')]['create'](_0x560b42['body'],{})[_0x7d54('0x1e')](function(_0x193993){var _0x4f73c4=_0x560b42[_0x7d54('0x46')][_0x7d54('0x1f')]({'plain':!![]});if(!_0x4f73c4)throw new Error(_0x7d54('0x47'));if(_0x4f73c4['role']===_0x7d54('0x46')){var _0x57bb14=_0x193993[_0x7d54('0x1f')]({'plain':!![]});var _0x1692e9=_0x7d54('0x20');return db[_0x7d54('0x48')]['find']({'where':{'name':_0x1692e9,'userProfileId':_0x4f73c4['userProfileId']},'raw':!![]})[_0x7d54('0x1e')](function(_0xb470bb){if(_0xb470bb&&_0xb470bb[_0x7d54('0x49')]===0x0){return db[_0x7d54('0x21')][_0x7d54('0x45')]({'name':_0x57bb14['name'],'resourceId':_0x57bb14['id'],'type':_0xb470bb[_0x7d54('0x25')],'sectionId':_0xb470bb['id']},{})[_0x7d54('0x1e')](function(){return _0x193993;});}else{return _0x193993;}})['catch'](function(_0x2e3e08){logger[_0x7d54('0x23')](_0x7d54('0x4a'),_0x2e3e08);throw _0x2e3e08;});}return _0x193993;})[_0x7d54('0x1e')](respondWithResult(_0x5b6449,0xc9))[_0x7d54('0x41')](handleError(_0x5b6449,null));};exports[_0x7d54('0x1d')]=function(_0x436a40,_0x36b43c){if(_0x436a40['body']['id']){delete _0x436a40[_0x7d54('0x4b')]['id'];}return db[_0x7d54('0x3d')][_0x7d54('0x44')]({'where':{'id':_0x436a40['params']['id']}})[_0x7d54('0x1e')](handleEntityNotFound(_0x36b43c,null))[_0x7d54('0x1e')](saveUpdates(_0x436a40[_0x7d54('0x4b')],null))[_0x7d54('0x1e')](respondWithResult(_0x36b43c,null))['catch'](handleError(_0x36b43c,null));};exports[_0x7d54('0x22')]=function(_0x238210,_0xe9db27){return db['VoiceChanSpy']['find']({'where':{'id':_0x238210['params']['id']}})['then'](handleEntityNotFound(_0xe9db27,null))[_0x7d54('0x1e')](removeEntity(_0xe9db27,null))[_0x7d54('0x41')](handleError(_0xe9db27,null));}; \ No newline at end of file +var _0x1789=['crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','ChanSpies','UserProfileResource','error','stack','name','index','VoiceChanSpy','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','pick','filter','where','type','VIRTUAL','merge','options','findAll','catch','show','includeAll','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1789,0x92));var _0x9178=function(_0x1ee293,_0x465cda){_0x1ee293=_0x1ee293-0x0;var _0x161342=_0x1789[_0x1ee293];return _0x161342;};'use strict';var emlformat=require(_0x9178('0x0'));var rimraf=require(_0x9178('0x1'));var zipdir=require(_0x9178('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9178('0x3'));var moment=require(_0x9178('0x4'));var BPromise=require(_0x9178('0x5'));var Mustache=require(_0x9178('0x6'));var util=require(_0x9178('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9178('0x8'));var ejs=require(_0x9178('0x9'));var fs=require('fs');var fs_extra=require(_0x9178('0xa'));var _=require(_0x9178('0xb'));var squel=require('squel');var crypto=require(_0x9178('0xc'));var jsforce=require(_0x9178('0xd'));var deskjs=require(_0x9178('0xe'));var toCsv=require(_0x9178('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9178('0xf'));var qs=require(_0x9178('0x10'));var as=require(_0x9178('0x11'));var hardwareService=require(_0x9178('0x12'));var logger=require('../../config/logger')(_0x9178('0x13'));var utils=require(_0x9178('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1400a4,_0x321d98){_0x321d98=_0x321d98||0xcc;return function(_0x593e69){if(_0x593e69){return _0x1400a4[_0x9178('0x15')](_0x321d98);}return _0x1400a4[_0x9178('0x16')](_0x321d98)[_0x9178('0x17')]();};}function respondWithResult(_0x496489,_0x2daff3){_0x2daff3=_0x2daff3||0xc8;return function(_0x17f1be){if(_0x17f1be){return _0x496489['status'](_0x2daff3)[_0x9178('0x18')](_0x17f1be);}};}function respondWithFilteredResult(_0x4d931e,_0x4281aa){return function(_0x703536){if(_0x703536){var _0x26eeb9=typeof _0x4281aa[_0x9178('0x19')]===_0x9178('0x1a')&&typeof _0x4281aa[_0x9178('0x1b')]===_0x9178('0x1a');var _0x22b462=_0x703536[_0x9178('0x1c')];var _0x3f3dd4=_0x26eeb9?0x0:_0x4281aa[_0x9178('0x19')];var _0x4393f3=_0x26eeb9?_0x703536[_0x9178('0x1c')]:_0x4281aa[_0x9178('0x19')]+_0x4281aa['limit'];var _0xae00cc;if(_0x4393f3>=_0x22b462){_0x4393f3=_0x22b462;_0xae00cc=0xc8;}else{_0xae00cc=0xce;}_0x4d931e[_0x9178('0x16')](_0xae00cc);return _0x4d931e['set'](_0x9178('0x1d'),_0x3f3dd4+'-'+_0x4393f3+'/'+_0x22b462)['json'](_0x703536);}return null;};}function patchUpdates(_0x94c136){return function(_0x1de1a2){try{jsonpatch[_0x9178('0x1e')](_0x1de1a2,_0x94c136,!![]);}catch(_0x273953){return BPromise[_0x9178('0x1f')](_0x273953);}return _0x1de1a2[_0x9178('0x20')]();};}function saveUpdates(_0x327b4b,_0x4c13cf){return function(_0x48e47b){if(_0x48e47b){return _0x48e47b[_0x9178('0x21')](_0x327b4b)['then'](function(_0x497c06){return _0x497c06;});}return null;};}function removeEntity(_0x2c40c1,_0x19aafe){return function(_0x15471a){if(_0x15471a){return _0x15471a[_0x9178('0x22')]()[_0x9178('0x23')](function(){var _0x2e2723=_0x15471a[_0x9178('0x24')]({'plain':!![]});var _0x23c04a=_0x9178('0x25');return db[_0x9178('0x26')][_0x9178('0x22')]({'where':{'type':_0x23c04a,'resourceId':_0x2e2723['id']}})[_0x9178('0x23')](function(){return _0x15471a;});})[_0x9178('0x23')](function(){_0x2c40c1[_0x9178('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1af84b,_0x1b6bd7){return function(_0x5c39ed){if(!_0x5c39ed){_0x1af84b[_0x9178('0x15')](0x194);}return _0x5c39ed;};}function handleError(_0x14fa42,_0x39d309){_0x39d309=_0x39d309||0x1f4;return function(_0x2b977b){logger[_0x9178('0x27')](_0x2b977b[_0x9178('0x28')]);if(_0x2b977b['name']){delete _0x2b977b[_0x9178('0x29')];}_0x14fa42[_0x9178('0x16')](_0x39d309)['send'](_0x2b977b);};}exports[_0x9178('0x2a')]=function(_0x2f045c,_0x262068){var _0x3b4ad8={},_0x403f4d={},_0x30b8fc={'count':0x0,'rows':[]};var _0x40261d=_['map'](db[_0x9178('0x2b')]['rawAttributes'],function(_0x227bf6){return{'name':_0x227bf6[_0x9178('0x2c')],'type':_0x227bf6['type'][_0x9178('0x2d')]};});_0x403f4d[_0x9178('0x2e')]=_[_0x9178('0x2f')](_0x40261d,_0x9178('0x29'));_0x403f4d['query']=_[_0x9178('0x30')](_0x2f045c[_0x9178('0x31')]);_0x403f4d[_0x9178('0x32')]=_[_0x9178('0x33')](_0x403f4d[_0x9178('0x2e')],_0x403f4d[_0x9178('0x31')]);_0x3b4ad8[_0x9178('0x34')]=_[_0x9178('0x33')](_0x403f4d['model'],qs[_0x9178('0x35')](_0x2f045c[_0x9178('0x31')]['fields']));_0x3b4ad8[_0x9178('0x34')]=_0x3b4ad8['attributes'][_0x9178('0x36')]?_0x3b4ad8['attributes']:_0x403f4d['model'];if(!_0x2f045c[_0x9178('0x31')][_0x9178('0x37')]('nolimit')){_0x3b4ad8[_0x9178('0x1b')]=qs[_0x9178('0x1b')](_0x2f045c['query']['limit']);_0x3b4ad8[_0x9178('0x19')]=qs[_0x9178('0x19')](_0x2f045c[_0x9178('0x31')][_0x9178('0x19')]);}_0x3b4ad8['order']=qs['sort'](_0x2f045c[_0x9178('0x31')]['sort']);_0x3b4ad8['where']=qs[_0x9178('0x32')](_[_0x9178('0x38')](_0x2f045c[_0x9178('0x31')],_0x403f4d['filters']),_0x40261d);if(_0x2f045c[_0x9178('0x31')][_0x9178('0x39')]){_0x3b4ad8[_0x9178('0x3a')]=_['merge'](_0x3b4ad8[_0x9178('0x3a')],{'$or':_[_0x9178('0x2f')](_0x40261d,function(_0x1d41bf){if(_0x1d41bf[_0x9178('0x3b')]!==_0x9178('0x3c')){var _0x464d33={};_0x464d33[_0x1d41bf[_0x9178('0x29')]]={'$like':'%'+_0x2f045c['query'][_0x9178('0x39')]+'%'};return _0x464d33;}})});}_0x3b4ad8=_[_0x9178('0x3d')]({},_0x3b4ad8,_0x2f045c[_0x9178('0x3e')]);var _0x1d0d7f={'where':_0x3b4ad8['where']};return db[_0x9178('0x2b')][_0x9178('0x1c')](_0x1d0d7f)[_0x9178('0x23')](function(_0x34d812){_0x30b8fc['count']=_0x34d812;if(_0x2f045c[_0x9178('0x31')]['includeAll']){_0x3b4ad8['include']=[{'all':!![]}];}return db[_0x9178('0x2b')][_0x9178('0x3f')](_0x3b4ad8);})[_0x9178('0x23')](function(_0x69ad3c){_0x30b8fc['rows']=_0x69ad3c;return _0x30b8fc;})[_0x9178('0x23')](respondWithFilteredResult(_0x262068,_0x3b4ad8))[_0x9178('0x40')](handleError(_0x262068,null));};exports[_0x9178('0x41')]=function(_0x56170d,_0x2e1724){var _0xaa90fe={'raw':![],'where':{'id':_0x56170d['params']['id']}},_0x3b90f2={};_0x3b90f2[_0x9178('0x2e')]=_[_0x9178('0x30')](db[_0x9178('0x2b')]['rawAttributes']);_0x3b90f2[_0x9178('0x31')]=_[_0x9178('0x30')](_0x56170d['query']);_0x3b90f2[_0x9178('0x32')]=_[_0x9178('0x33')](_0x3b90f2['model'],_0x3b90f2[_0x9178('0x31')]);_0xaa90fe[_0x9178('0x34')]=_[_0x9178('0x33')](_0x3b90f2['model'],qs['fields'](_0x56170d[_0x9178('0x31')]['fields']));_0xaa90fe[_0x9178('0x34')]=_0xaa90fe[_0x9178('0x34')][_0x9178('0x36')]?_0xaa90fe[_0x9178('0x34')]:_0x3b90f2[_0x9178('0x2e')];if(_0x56170d['query'][_0x9178('0x42')]){_0xaa90fe[_0x9178('0x43')]=[{'all':!![]}];}_0xaa90fe=_['merge']({},_0xaa90fe,_0x56170d[_0x9178('0x3e')]);return db[_0x9178('0x2b')]['find'](_0xaa90fe)[_0x9178('0x23')](handleEntityNotFound(_0x2e1724,null))['then'](respondWithResult(_0x2e1724,null))[_0x9178('0x40')](handleError(_0x2e1724,null));};exports[_0x9178('0x44')]=function(_0x322f19,_0x101ee0){return db[_0x9178('0x2b')][_0x9178('0x44')](_0x322f19['body'],{})[_0x9178('0x23')](function(_0x3f5278){var _0x1bc719=_0x322f19[_0x9178('0x45')][_0x9178('0x24')]({'plain':!![]});if(!_0x1bc719)throw new Error(_0x9178('0x46'));if(_0x1bc719[_0x9178('0x47')]===_0x9178('0x45')){var _0x44808d=_0x3f5278[_0x9178('0x24')]({'plain':!![]});var _0x5a0a91=_0x9178('0x25');return db[_0x9178('0x48')][_0x9178('0x49')]({'where':{'name':_0x5a0a91,'userProfileId':_0x1bc719[_0x9178('0x4a')]},'raw':!![]})[_0x9178('0x23')](function(_0x3f84c9){if(_0x3f84c9&&_0x3f84c9[_0x9178('0x4b')]===0x0){return db['UserProfileResource'][_0x9178('0x44')]({'name':_0x44808d[_0x9178('0x29')],'resourceId':_0x44808d['id'],'type':_0x3f84c9[_0x9178('0x29')],'sectionId':_0x3f84c9['id']},{})[_0x9178('0x23')](function(){return _0x3f5278;});}else{return _0x3f5278;}})['catch'](function(_0x304614){logger[_0x9178('0x27')](_0x9178('0x4c'),_0x304614);throw _0x304614;});}return _0x3f5278;})['then'](respondWithResult(_0x101ee0,0xc9))[_0x9178('0x40')](handleError(_0x101ee0,null));};exports[_0x9178('0x21')]=function(_0x37b63f,_0x133ef8){if(_0x37b63f[_0x9178('0x4d')]['id']){delete _0x37b63f[_0x9178('0x4d')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x37b63f[_0x9178('0x4e')]['id']}})[_0x9178('0x23')](handleEntityNotFound(_0x133ef8,null))[_0x9178('0x23')](saveUpdates(_0x37b63f[_0x9178('0x4d')],null))[_0x9178('0x23')](respondWithResult(_0x133ef8,null))[_0x9178('0x40')](handleError(_0x133ef8,null));};exports[_0x9178('0x22')]=function(_0x3fe618,_0x1c8bf7){return db[_0x9178('0x2b')][_0x9178('0x49')]({'where':{'id':_0x3fe618[_0x9178('0x4e')]['id']}})[_0x9178('0x23')](handleEntityNotFound(_0x1c8bf7,null))['then'](removeEntity(_0x1c8bf7,null))[_0x9178('0x40')](handleError(_0x1c8bf7,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 99ba99c..3cfcab5 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 _0x42d0=['CDR(type)=%s','chanspy','push','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal','User','then','catch','exports','models','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','context','format','%s%s','prefix','system','merge'];(function(_0x485c9f,_0x399a20){var _0x2ba76e=function(_0x3598d4){while(--_0x3598d4){_0x485c9f['push'](_0x485c9f['shift']());}};_0x2ba76e(++_0x399a20);}(_0x42d0,0x9c));var _0x042d=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0x42d0[_0x258fb0];return _0x4d1afe;};'use strict';var _=require(_0x042d('0x0'));var util=require(_0x042d('0x1'));var BPromise=require(_0x042d('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x7fcc8b,_0x1c2f69,_0x5c2c68){var _0x2d4556=0x1;var _0x4e4ae6=[];var _0x1205bf={'context':_0x1c2f69[_0x042d('0x3')]||'from-sip','exten':util[_0x042d('0x4')](_0x042d('0x5'),_0x7fcc8b[_0x042d('0x6')],_0x5c2c68),'type':_0x042d('0x7'),'isApp':![],'ChanSpyId':_0x7fcc8b['id'],'UserId':_0x1c2f69['id']};_0x4e4ae6['push'](_[_0x042d('0x8')]({'app':'Set','appdata':util[_0x042d('0x4')](_0x042d('0x9'),_0x042d('0xa')),'priority':_0x2d4556++},_0x1205bf));if(_0x7fcc8b['record']){_0x4e4ae6[_0x042d('0xb')](_[_0x042d('0x8')]({'app':_0x042d('0xc'),'appdata':util[_0x042d('0x4')](_0x042d('0xd'),_0x7fcc8b['recordingFormat']),'priority':_0x2d4556++},_0x1205bf));}if(_0x7fcc8b[_0x042d('0xe')]){_0x4e4ae6[_0x042d('0xb')](_[_0x042d('0x8')]({'app':_0x042d('0xf'),'appdata':_0x7fcc8b[_0x042d('0x10')],'priority':_0x2d4556++},_0x1205bf));}_0x4e4ae6[_0x042d('0xb')](_[_0x042d('0x8')]({'app':_0x042d('0x11'),'appdata':util[_0x042d('0x4')](_0x042d('0x12'),_0x1c2f69[_0x042d('0x13')],_0x7fcc8b[_0x042d('0x14')]?_0x7fcc8b[_0x042d('0x14')]['join'](''):''),'priority':_0x2d4556++},_0x1205bf));if(_0x7fcc8b['record']){_0x4e4ae6[_0x042d('0xb')](_[_0x042d('0x8')]({'app':_0x042d('0x15'),'priority':_0x2d4556++},_0x1205bf));}return _0x4e4ae6;};var getChanSpyApplications=function(_0x29c278,_0x147250){var _0x81257f=[];for(var _0x1a92e0=0x0,_0x16a342=0x1;_0x1a92e0<_0x147250[_0x042d('0x16')];_0x1a92e0++,_0x16a342=0x1){_0x81257f=_0x81257f[_0x042d('0x17')](getUserApplications(_0x29c278,_0x147250[_0x1a92e0],_0x147250[_0x1a92e0][_0x042d('0x18')]));if(_0x147250[_0x1a92e0][_0x042d('0x18')]!=_0x147250[_0x1a92e0][_0x042d('0x13')]){_0x81257f=_0x81257f[_0x042d('0x17')](getUserApplications(_0x29c278,_0x147250[_0x1a92e0],_0x147250[_0x1a92e0][_0x042d('0x13')]));}}return _0x81257f;};var getChanSpyPromise=function(_0x58c2cf,_0x2a4f5c){return new BPromise(function(_0x12373f,_0x1f423a){return _0x58c2cf[_0x042d('0x19')]['findAll']({'attributes':['id',_0x042d('0x13'),_0x042d('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x042d('0x1a')](function(_0x4acf33){if(_0x4acf33){return _0x12373f(getChanSpyApplications(_0x2a4f5c,_0x4acf33));}return _0x12373f([]);})[_0x042d('0x1b')](function(_0x208271){_0x1f423a(_0x208271);});});};module[_0x042d('0x1c')]=function(_0x428109,_0xce2eb1){var _0x250333=_0x428109[_0x042d('0x1d')];return _0x428109['define']('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2d0126,_0x2fb35e,_0x57c5a5){return getChanSpyPromise(_0x250333,_0x2d0126)[_0x042d('0x1a')](function(_0x3b3af2){if(_0x3b3af2&&_0x3b3af2[_0x042d('0x16')]){return _0x250333[_0x042d('0x1e')][_0x042d('0x1f')](_0x3b3af2);}})[_0x042d('0x1a')](function(){_0x57c5a5();})['catch'](function(_0x54ac31){_0x57c5a5(_0x54ac31);});},'afterUpdate':function(_0x56705a,_0x332782,_0x5870b7){return _0x250333[_0x042d('0x1e')][_0x042d('0x20')]({'where':{'ChanSpyId':_0x56705a['id']}})[_0x042d('0x1a')](function(){return getChanSpyPromise(_0x250333,_0x56705a);})[_0x042d('0x1a')](function(_0x236d34){if(_0x236d34&&_0x236d34[_0x042d('0x16')]){return _0x250333[_0x042d('0x1e')][_0x042d('0x1f')](_0x236d34);}})['then'](function(){_0x5870b7();})[_0x042d('0x1b')](function(_0x1ecd63){_0x5870b7(_0x1ecd63);});},'afterDestroy':function(_0x2cd14c,_0x588e53,_0x56a947){return _0x250333[_0x042d('0x1e')][_0x042d('0x20')]({'where':{'ChanSpyId':_0x2cd14c['id']}})['then'](function(){_0x56a947();})[_0x042d('0x1b')](function(_0x48db6a){_0x56a947(_0x48db6a);});}}});}; \ No newline at end of file +var _0x8cb5=['${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','SIP/%s,%s','name','options','join','concat','internal','User','findAll','agent','then','catch','exports','models','define','voice_chanspy','length','VoiceExtension','bulkCreate','lodash','./voiceChanSpy.attributes','context','format','system','push','merge','Set','CDR(type)=%s','record','MixMonitor'];(function(_0x31abee,_0x11ff0c){var _0x3c1761=function(_0x2b5062){while(--_0x2b5062){_0x31abee['push'](_0x31abee['shift']());}};_0x3c1761(++_0x11ff0c);}(_0x8cb5,0x1a2));var _0x58cb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8cb5[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x58cb('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x58cb('0x1'));var getUserApplications=function(_0x405693,_0x2848d3,_0x33bd1d){var _0x258945=0x1;var _0x481426=[];var _0x129855={'context':_0x2848d3[_0x58cb('0x2')]||'from-sip','exten':util[_0x58cb('0x3')]('%s%s',_0x405693['prefix'],_0x33bd1d),'type':_0x58cb('0x4'),'isApp':![],'ChanSpyId':_0x405693['id'],'UserId':_0x2848d3['id']};_0x481426[_0x58cb('0x5')](_[_0x58cb('0x6')]({'app':_0x58cb('0x7'),'appdata':util[_0x58cb('0x3')](_0x58cb('0x8'),'chanspy'),'priority':_0x258945++},_0x129855));if(_0x405693[_0x58cb('0x9')]){_0x481426[_0x58cb('0x5')](_[_0x58cb('0x6')]({'app':_0x58cb('0xa'),'appdata':util[_0x58cb('0x3')](_0x58cb('0xb'),_0x405693[_0x58cb('0xc')]),'priority':_0x258945++},_0x129855));}if(_0x405693[_0x58cb('0xd')]){_0x481426[_0x58cb('0x5')](_[_0x58cb('0x6')]({'app':_0x58cb('0xe'),'appdata':_0x405693['password'],'priority':_0x258945++},_0x129855));}_0x481426['push'](_[_0x58cb('0x6')]({'app':'ChanSpy','appdata':util[_0x58cb('0x3')](_0x58cb('0xf'),_0x2848d3[_0x58cb('0x10')],_0x405693[_0x58cb('0x11')]?_0x405693[_0x58cb('0x11')][_0x58cb('0x12')](''):''),'priority':_0x258945++},_0x129855));if(_0x405693['record']){_0x481426[_0x58cb('0x5')](_[_0x58cb('0x6')]({'app':'StopMixMonitor','priority':_0x258945++},_0x129855));}return _0x481426;};var getChanSpyApplications=function(_0x517afc,_0x11192f){var _0x51285d=[];for(var _0x2c666c=0x0,_0x543ccc=0x1;_0x2c666c<_0x11192f['length'];_0x2c666c++,_0x543ccc=0x1){_0x51285d=_0x51285d[_0x58cb('0x13')](getUserApplications(_0x517afc,_0x11192f[_0x2c666c],_0x11192f[_0x2c666c][_0x58cb('0x14')]));if(_0x11192f[_0x2c666c][_0x58cb('0x14')]!=_0x11192f[_0x2c666c]['name']){_0x51285d=_0x51285d['concat'](getUserApplications(_0x517afc,_0x11192f[_0x2c666c],_0x11192f[_0x2c666c][_0x58cb('0x10')]));}}return _0x51285d;};var getChanSpyPromise=function(_0xd959ff,_0x43fa89){return new BPromise(function(_0x5d55db,_0x162f16){return _0xd959ff[_0x58cb('0x15')][_0x58cb('0x16')]({'attributes':['id',_0x58cb('0x10'),'internal'],'where':{'role':_0x58cb('0x17'),'chanspy':!![]},'raw':!![]})[_0x58cb('0x18')](function(_0x4282ff){if(_0x4282ff){return _0x5d55db(getChanSpyApplications(_0x43fa89,_0x4282ff));}return _0x5d55db([]);})[_0x58cb('0x19')](function(_0x402c9c){_0x162f16(_0x402c9c);});});};module[_0x58cb('0x1a')]=function(_0x1f03fe,_0x559423){var _0x9171c5=_0x1f03fe[_0x58cb('0x1b')];return _0x1f03fe[_0x58cb('0x1c')]('VoiceChanSpy',attributes,{'tableName':_0x58cb('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x44b5cf,_0x33234f,_0x42a8f5){return getChanSpyPromise(_0x9171c5,_0x44b5cf)['then'](function(_0x36e5b1){if(_0x36e5b1&&_0x36e5b1[_0x58cb('0x1e')]){return _0x9171c5[_0x58cb('0x1f')][_0x58cb('0x20')](_0x36e5b1);}})['then'](function(){_0x42a8f5();})['catch'](function(_0x26ee70){_0x42a8f5(_0x26ee70);});},'afterUpdate':function(_0x8ccd2e,_0x147948,_0x872c52){return _0x9171c5[_0x58cb('0x1f')]['destroy']({'where':{'ChanSpyId':_0x8ccd2e['id']}})[_0x58cb('0x18')](function(){return getChanSpyPromise(_0x9171c5,_0x8ccd2e);})[_0x58cb('0x18')](function(_0x4d615a){if(_0x4d615a&&_0x4d615a[_0x58cb('0x1e')]){return _0x9171c5[_0x58cb('0x1f')]['bulkCreate'](_0x4d615a);}})[_0x58cb('0x18')](function(){_0x872c52();})[_0x58cb('0x19')](function(_0x599007){_0x872c52(_0x599007);});},'afterDestroy':function(_0x23bc1e,_0x5430a8,_0x46f8c8){return _0x9171c5[_0x58cb('0x1f')]['destroy']({'where':{'ChanSpyId':_0x23bc1e['id']}})[_0x58cb('0x18')](function(){_0x46f8c8();})['catch'](function(_0x58e8e2){_0x46f8c8(_0x58e8e2);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 2dbcac7..7a45055 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 _0xd64b=['message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xe14015,_0xdaad33){var _0x566bfd=function(_0x20ccfc){while(--_0x20ccfc){_0xe14015['push'](_0xe14015['shift']());}};_0x566bfd(++_0xdaad33);}(_0xd64b,0xc1));var _0xbd64=function(_0x420111,_0x13d8e8){_0x420111=_0x420111-0x0;var _0x1b8f14=_0xd64b[_0x420111];return _0x1b8f14;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var moment=require(_0xbd64('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd64('0x2'));var fs=require('fs');var Redis=require(_0xbd64('0x3'));var db=require(_0xbd64('0x4'))['db'];var utils=require(_0xbd64('0x5'));var logger=require(_0xbd64('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbd64('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x32995f,_0x3e700e,_0x38204e){return new BPromise(function(_0x3f1f17,_0x2b8543){return client[_0xbd64('0x8')](_0x32995f,_0x38204e)['then'](function(_0x5ae70c){logger[_0xbd64('0x9')](_0xbd64('0xa'),_0x3e700e,_0xbd64('0xb'));logger['debug'](_0xbd64('0xc'),_0x3e700e,_0xbd64('0xb'),JSON[_0xbd64('0xd')](_0x5ae70c));if(_0x5ae70c[_0xbd64('0xe')]){if(_0x5ae70c['error'][_0xbd64('0xf')]===0x1f4){logger['error'](_0xbd64('0xa'),_0x3e700e,_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);return _0x2b8543(_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);}logger[_0xbd64('0xe')](_0xbd64('0xa'),_0x3e700e,_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);return _0x3f1f17(_0x5ae70c['error'][_0xbd64('0x10')]);}else{logger[_0xbd64('0x9')](_0xbd64('0xa'),_0x3e700e,_0xbd64('0xb'));_0x3f1f17(_0x5ae70c[_0xbd64('0x11')]['message']);}})[_0xbd64('0x12')](function(_0x5332e0){logger[_0xbd64('0xe')](_0xbd64('0xa'),_0x3e700e,_0x5332e0);_0x2b8543(_0x5332e0);});});} \ No newline at end of file +var _0x0fd9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0x0fd9,0xa3));var _0x90fd=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0x0fd9[_0x695b76];return _0x1dc21f;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var config=require(_0x90fd('0x7'));var jayson=require(_0x90fd('0x8'));var client=jayson[_0x90fd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ff2d4,_0x128c17,_0x50c778){return new BPromise(function(_0x5a604a,_0x2acef7){return client[_0x90fd('0xa')](_0x4ff2d4,_0x50c778)['then'](function(_0x234ba9){logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));logger[_0x90fd('0xe')](_0x90fd('0xf'),_0x128c17,_0x90fd('0xd'),JSON[_0x90fd('0x10')](_0x234ba9));if(_0x234ba9[_0x90fd('0x11')]){if(_0x234ba9['error'][_0x90fd('0x12')]===0x1f4){logger[_0x90fd('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x2acef7(_0x234ba9[_0x90fd('0x11')]['message']);}logger[_0x90fd('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x5a604a(_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);}else{logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));_0x5a604a(_0x234ba9['result']['message']);}})[_0x90fd('0x14')](function(_0x43d804){logger['error'](_0x90fd('0xc'),_0x128c17,_0x43d804);_0x2acef7(_0x43d804);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 26bae1d..0571468 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 _0xe051=['index','/:id','create','put','update','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated'];(function(_0x1a8f3f,_0x5b5ae4){var _0x4ef636=function(_0x512d25){while(--_0x512d25){_0x1a8f3f['push'](_0x1a8f3f['shift']());}};_0x4ef636(++_0x5b5ae4);}(_0xe051,0x17d));var _0x1e05=function(_0x3c403f,_0xba44a9){_0x3c403f=_0x3c403f-0x0;var _0x1c4515=_0xe051[_0x3c403f];return _0x1c4515;};'use strict';var multer=require('multer');var util=require(_0x1e05('0x0'));var path=require(_0x1e05('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e05('0x2')]();var fs_extra=require(_0x1e05('0x3'));var auth=require(_0x1e05('0x4'));var interaction=require(_0x1e05('0x5'));var config=require(_0x1e05('0x6'));var controller=require(_0x1e05('0x7'));router[_0x1e05('0x8')]('/',auth[_0x1e05('0x9')](),controller[_0x1e05('0xa')]);router['get'](_0x1e05('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x1e05('0x9')](),controller[_0x1e05('0xc')]);router[_0x1e05('0xd')]('/:id',auth[_0x1e05('0x9')](),controller[_0x1e05('0xe')]);router[_0x1e05('0xf')](_0x1e05('0xb'),auth[_0x1e05('0x9')](),controller['destroy']);module[_0x1e05('0x10')]=router; \ No newline at end of file +var _0x4438=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x3419b1,_0x36bc1c){var _0x32a570=function(_0x336455){while(--_0x336455){_0x3419b1['push'](_0x3419b1['shift']());}};_0x32a570(++_0x36bc1c);}(_0x4438,0x1e5));var _0x8443=function(_0x4a6189,_0x584295){_0x4a6189=_0x4a6189-0x0;var _0x57704e=_0x4438[_0x4a6189];return _0x57704e;};'use strict';var multer=require(_0x8443('0x0'));var util=require('util');var path=require(_0x8443('0x1'));var timeout=require(_0x8443('0x2'));var express=require(_0x8443('0x3'));var router=express[_0x8443('0x4')]();var fs_extra=require(_0x8443('0x5'));var auth=require(_0x8443('0x6'));var interaction=require(_0x8443('0x7'));var config=require(_0x8443('0x8'));var controller=require('./voiceContext.controller');router['get']('/',auth[_0x8443('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8443('0xa')]);router[_0x8443('0xb')]('/',auth['isAuthenticated'](),controller[_0x8443('0xc')]);router[_0x8443('0xd')](_0x8443('0xe'),auth[_0x8443('0x9')](),controller['update']);router[_0x8443('0xf')]('/:id',auth[_0x8443('0x9')](),controller[_0x8443('0x10')]);module[_0x8443('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 64c01c7..2da549d 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 _0x9c59=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x450b02,_0x3b1c63){var _0x4997f7=function(_0x286a1c){while(--_0x286a1c){_0x450b02['push'](_0x450b02['shift']());}};_0x4997f7(++_0x3b1c63);}(_0x9c59,0xbb));var _0x99c5=function(_0x3ebeef,_0x40a153){_0x3ebeef=_0x3ebeef-0x0;var _0x3fe803=_0x9c59[_0x3ebeef];return _0x3fe803;};'use strict';var Sequelize=require(_0x99c5('0x0'));module[_0x99c5('0x1')]={'name':{'type':Sequelize[_0x99c5('0x2')],'unique':_0x99c5('0x3')},'description':{'type':Sequelize[_0x99c5('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x99c5('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x94be=['STRING','name','BOOLEAN','exports'];(function(_0x19e0f1,_0x3cf9d3){var _0x5c041a=function(_0x2bd3c2){while(--_0x2bd3c2){_0x19e0f1['push'](_0x19e0f1['shift']());}};_0x5c041a(++_0x3cf9d3);}(_0x94be,0xe7));var _0xe94b=function(_0x17a877,_0x4bac0a){_0x17a877=_0x17a877-0x0;var _0x3414ae=_0x94be[_0x17a877];return _0x3414ae;};'use strict';var Sequelize=require('sequelize');module[_0xe94b('0x0')]={'name':{'type':Sequelize[_0xe94b('0x1')],'unique':_0xe94b('0x2')},'description':{'type':Sequelize[_0xe94b('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe94b('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 d0a615f..367b140 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 _0x6418=['eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','update','get','Contexts','UserProfileResource','destroy','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','body','readFileSync','join','root','utf8','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/context.ejs','render'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x6418,0x126));var _0x8641=function(_0x55b817,_0x487f1a){_0x55b817=_0x55b817-0x0;var _0x4b826e=_0x6418[_0x55b817];return _0x4b826e;};'use strict';var emlformat=require(_0x8641('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8641('0x1'));var moment=require(_0x8641('0x2'));var BPromise=require(_0x8641('0x3'));var Mustache=require(_0x8641('0x4'));var util=require('util');var path=require(_0x8641('0x5'));var sox=require(_0x8641('0x6'));var csv=require(_0x8641('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8641('0x8'));var crypto=require(_0x8641('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8641('0xa'));var toCsv=require(_0x8641('0x7'));var querystring=require(_0x8641('0xb'));var Papa=require('papaparse');var Redis=require(_0x8641('0xc'));var authService=require(_0x8641('0xd'));var qs=require(_0x8641('0xe'));var as=require(_0x8641('0xf'));var hardwareService=require(_0x8641('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x8641('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x8641('0x12'));var client=jayson[_0x8641('0x13')][_0x8641('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x1201de,_0x4e6716,_0x509557,_0x4ca846){return new BPromise(function(_0x59d43c,_0x58073f){var _0x24a612=_0x4ca846||client;return _0x24a612[_0x8641('0x15')](_0x1201de,_0x509557)[_0x8641('0x16')](function(_0x2ba631){logger['info'](_0x8641('0x17'),_0x4e6716,_0x8641('0x18'));logger[_0x8641('0x19')](_0x8641('0x1a'),_0x4e6716,_0x8641('0x18'),JSON[_0x8641('0x1b')](_0x2ba631));if(_0x2ba631[_0x8641('0x1c')]){if(_0x2ba631[_0x8641('0x1c')][_0x8641('0x1d')]===0x1f4){logger[_0x8641('0x1c')](_0x8641('0x17'),_0x4e6716,_0x2ba631[_0x8641('0x1c')][_0x8641('0x1e')]);return _0x58073f(_0x2ba631['error']['message']);}logger[_0x8641('0x1c')](_0x8641('0x17'),_0x4e6716,_0x2ba631[_0x8641('0x1c')]['message']);return _0x59d43c(_0x2ba631[_0x8641('0x1c')][_0x8641('0x1e')]);}else{logger[_0x8641('0x1f')](_0x8641('0x17'),_0x4e6716,_0x8641('0x18'));_0x59d43c(_0x2ba631['result'][_0x8641('0x1e')]);}})[_0x8641('0x20')](function(_0x238dbc){logger[_0x8641('0x1c')](_0x8641('0x17'),_0x4e6716,_0x238dbc);_0x58073f(_0x238dbc);});});}function respondWithStatusCode(_0x2940c8,_0x1c44f6){_0x1c44f6=_0x1c44f6||0xcc;return function(_0x57d583){if(_0x57d583){return _0x2940c8[_0x8641('0x21')](_0x1c44f6);}return _0x2940c8[_0x8641('0x22')](_0x1c44f6)[_0x8641('0x23')]();};}function respondWithResult(_0x5280d0,_0x3314c1){_0x3314c1=_0x3314c1||0xc8;return function(_0x13f8ae){if(_0x13f8ae){return _0x5280d0['status'](_0x3314c1)[_0x8641('0x24')](_0x13f8ae);}};}function respondWithFilteredResult(_0x3ca3a5,_0x4ba7fa){return function(_0x170e8e){if(_0x170e8e){var _0x4ad9df=typeof _0x4ba7fa[_0x8641('0x25')]===_0x8641('0x26')&&typeof _0x4ba7fa['limit']==='undefined';var _0x1d1c33=_0x170e8e[_0x8641('0x27')];var _0x443534=_0x4ad9df?0x0:_0x4ba7fa['offset'];var _0x15fbab=_0x4ad9df?_0x170e8e[_0x8641('0x27')]:_0x4ba7fa[_0x8641('0x25')]+_0x4ba7fa[_0x8641('0x28')];var _0x38be06;if(_0x15fbab>=_0x1d1c33){_0x15fbab=_0x1d1c33;_0x38be06=0xc8;}else{_0x38be06=0xce;}_0x3ca3a5[_0x8641('0x22')](_0x38be06);return _0x3ca3a5[_0x8641('0x29')]('Content-Range',_0x443534+'-'+_0x15fbab+'/'+_0x1d1c33)[_0x8641('0x24')](_0x170e8e);}return null;};}function patchUpdates(_0x33e103){return function(_0x3f9911){try{jsonpatch['apply'](_0x3f9911,_0x33e103,!![]);}catch(_0xa1ff69){return BPromise['reject'](_0xa1ff69);}return _0x3f9911['save']();};}function saveUpdates(_0x2c4eba,_0x5a64a0){return function(_0x11ac59){if(_0x11ac59){return _0x11ac59[_0x8641('0x2a')](_0x2c4eba)['then'](function(_0x163839){return _0x163839;});}return null;};}function removeEntity(_0x27f3ff,_0x48c060){return function(_0x2c06e9){if(_0x2c06e9){return _0x2c06e9['destroy']()['then'](function(){var _0x5921b9=_0x2c06e9[_0x8641('0x2b')]({'plain':!![]});var _0x35ff5c=_0x8641('0x2c');return db[_0x8641('0x2d')][_0x8641('0x2e')]({'where':{'type':_0x35ff5c,'resourceId':_0x5921b9['id']}})[_0x8641('0x16')](function(){return _0x2c06e9;});})[_0x8641('0x16')](function(){_0x27f3ff['status'](0xcc)[_0x8641('0x23')]();});}};}function handleEntityNotFound(_0x2f3b46,_0x4a9444){return function(_0x5a51d4){if(!_0x5a51d4){_0x2f3b46[_0x8641('0x21')](0x194);}return _0x5a51d4;};}function handleError(_0x2a25cd,_0x325979){_0x325979=_0x325979||0x1f4;return function(_0xa4ad79){logger[_0x8641('0x1c')](_0xa4ad79[_0x8641('0x2f')]);if(_0xa4ad79[_0x8641('0x30')]){delete _0xa4ad79[_0x8641('0x30')];}_0x2a25cd[_0x8641('0x22')](_0x325979)[_0x8641('0x31')](_0xa4ad79);};}exports[_0x8641('0x32')]=function(_0x1ebb8e,_0x5a9ea7){var _0x5404f3={},_0x120ad3={},_0x307928={'count':0x0,'rows':[]};var _0x40793d=_[_0x8641('0x33')](db[_0x8641('0x34')][_0x8641('0x35')],function(_0x5ea7ce){return{'name':_0x5ea7ce[_0x8641('0x36')],'type':_0x5ea7ce[_0x8641('0x37')][_0x8641('0x38')]};});_0x120ad3[_0x8641('0x39')]=_[_0x8641('0x33')](_0x40793d,'name');_0x120ad3['query']=_[_0x8641('0x3a')](_0x1ebb8e[_0x8641('0x3b')]);_0x120ad3[_0x8641('0x3c')]=_[_0x8641('0x3d')](_0x120ad3[_0x8641('0x39')],_0x120ad3[_0x8641('0x3b')]);_0x5404f3[_0x8641('0x3e')]=_[_0x8641('0x3d')](_0x120ad3[_0x8641('0x39')],qs[_0x8641('0x3f')](_0x1ebb8e[_0x8641('0x3b')][_0x8641('0x3f')]));_0x5404f3[_0x8641('0x3e')]=_0x5404f3[_0x8641('0x3e')][_0x8641('0x40')]?_0x5404f3['attributes']:_0x120ad3[_0x8641('0x39')];if(!_0x1ebb8e[_0x8641('0x3b')][_0x8641('0x41')]('nolimit')){_0x5404f3[_0x8641('0x28')]=qs[_0x8641('0x28')](_0x1ebb8e[_0x8641('0x3b')][_0x8641('0x28')]);_0x5404f3[_0x8641('0x25')]=qs['offset'](_0x1ebb8e[_0x8641('0x3b')]['offset']);}_0x5404f3[_0x8641('0x42')]=qs[_0x8641('0x43')](_0x1ebb8e[_0x8641('0x3b')][_0x8641('0x43')]);_0x5404f3[_0x8641('0x44')]=qs[_0x8641('0x3c')](_['pick'](_0x1ebb8e['query'],_0x120ad3[_0x8641('0x3c')]),_0x40793d);if(_0x1ebb8e[_0x8641('0x3b')][_0x8641('0x45')]){_0x5404f3['where']=_[_0x8641('0x46')](_0x5404f3[_0x8641('0x44')],{'$or':_[_0x8641('0x33')](_0x40793d,function(_0x24ebbf){if(_0x24ebbf[_0x8641('0x37')]!==_0x8641('0x47')){var _0x2b4139={};_0x2b4139[_0x24ebbf[_0x8641('0x30')]]={'$like':'%'+_0x1ebb8e[_0x8641('0x3b')][_0x8641('0x45')]+'%'};return _0x2b4139;}})});}_0x5404f3=_[_0x8641('0x46')]({},_0x5404f3,_0x1ebb8e[_0x8641('0x48')]);var _0x777d02={'where':_0x5404f3[_0x8641('0x44')]};return db[_0x8641('0x34')][_0x8641('0x27')](_0x777d02)[_0x8641('0x16')](function(_0x57ca32){_0x307928[_0x8641('0x27')]=_0x57ca32;if(_0x1ebb8e[_0x8641('0x3b')][_0x8641('0x49')]){_0x5404f3['include']=[{'all':!![]}];}return db[_0x8641('0x34')][_0x8641('0x4a')](_0x5404f3);})['then'](function(_0x122a34){_0x307928[_0x8641('0x4b')]=_0x122a34;return _0x307928;})[_0x8641('0x16')](respondWithFilteredResult(_0x5a9ea7,_0x5404f3))[_0x8641('0x20')](handleError(_0x5a9ea7,null));};exports[_0x8641('0x4c')]=function(_0x48847a,_0x318578){var _0xfa28b7={'raw':![],'where':{'id':_0x48847a[_0x8641('0x4d')]['id']}},_0x521d51={};_0x521d51[_0x8641('0x39')]=_[_0x8641('0x3a')](db[_0x8641('0x34')][_0x8641('0x35')]);_0x521d51[_0x8641('0x3b')]=_['keys'](_0x48847a[_0x8641('0x3b')]);_0x521d51[_0x8641('0x3c')]=_['intersection'](_0x521d51[_0x8641('0x39')],_0x521d51[_0x8641('0x3b')]);_0xfa28b7[_0x8641('0x3e')]=_[_0x8641('0x3d')](_0x521d51[_0x8641('0x39')],qs[_0x8641('0x3f')](_0x48847a[_0x8641('0x3b')][_0x8641('0x3f')]));_0xfa28b7[_0x8641('0x3e')]=_0xfa28b7[_0x8641('0x3e')][_0x8641('0x40')]?_0xfa28b7[_0x8641('0x3e')]:_0x521d51[_0x8641('0x39')];if(_0x48847a['query'][_0x8641('0x49')]){_0xfa28b7[_0x8641('0x4e')]=[{'all':!![]}];}_0xfa28b7=_[_0x8641('0x46')]({},_0xfa28b7,_0x48847a[_0x8641('0x48')]);return db['VoiceContext'][_0x8641('0x4f')](_0xfa28b7)[_0x8641('0x16')](handleEntityNotFound(_0x318578,null))[_0x8641('0x16')](respondWithResult(_0x318578,null))[_0x8641('0x20')](handleError(_0x318578,null));};exports['create']=function(_0x2b40da,_0x363932,_0x2f776d){var _0x4426df;return db[_0x8641('0x34')]['create'](_0x2b40da[_0x8641('0x50')],{'raw':!![]})[_0x8641('0x16')](function(_0xb90df1){_0x4426df=_0xb90df1;return db[_0x8641('0x34')][_0x8641('0x4a')]({'raw':!![]});})[_0x8641('0x16')](function(_0x1b9fe4){var _0x220cea=fs[_0x8641('0x51')](path[_0x8641('0x52')](config[_0x8641('0x53')],'server/files/templates/context.ejs'),_0x8641('0x54'));var _0x48f53c=ejs['render'](_0x220cea,{'contexts':_0x1b9fe4||[]});fs['writeFileSync'](_0x8641('0x55'),_0x48f53c);})[_0x8641('0x16')](function(){return respondWithRpcPromise(_0x8641('0x56'),'create',{'module':_0x8641('0x57')});})[_0x8641('0x16')](function(){var _0x4c91bf=_0x2b40da[_0x8641('0x58')]['get']({'plain':!![]});if(!_0x4c91bf)throw new Error(_0x8641('0x59'));if(_0x4c91bf[_0x8641('0x5a')]===_0x8641('0x58')){var _0x48b5a8=_0x4426df[_0x8641('0x2b')]({'plain':!![]});return db[_0x8641('0x5b')][_0x8641('0x4f')]({'where':{'name':'Contexts','userProfileId':_0x4c91bf[_0x8641('0x5c')]},'raw':!![]})[_0x8641('0x16')](function(_0x259aa5){if(_0x259aa5&&_0x259aa5[_0x8641('0x5d')]===0x0){return db[_0x8641('0x2d')][_0x8641('0x5e')]({'name':_0x48b5a8['name'],'resourceId':_0x48b5a8['id'],'type':_0x259aa5[_0x8641('0x30')],'sectionId':_0x259aa5['id']},{})[_0x8641('0x16')](function(){return _0x4426df;});}else{return _0x4426df;}})['catch'](function(_0x5b1ad7){logger[_0x8641('0x1c')](_0x8641('0x5f'),_0x5b1ad7);throw _0x5b1ad7;});}return _0x4426df;})['then'](respondWithResult(_0x363932,0xc9))[_0x8641('0x20')](handleError(_0x363932,null));};exports['update']=function(_0x50adaf,_0x2d5956,_0x5226f9){var _0x57297b;return db['VoiceContext'][_0x8641('0x4f')]({'where':{'id':_0x50adaf['params']['id']}})[_0x8641('0x16')](handleEntityNotFound(_0x2d5956,null))[_0x8641('0x16')](saveUpdates(_0x50adaf[_0x8641('0x50')],null))[_0x8641('0x16')](function(_0x17c273){if(_0x17c273){_0x57297b=_0x17c273;return db[_0x8641('0x34')][_0x8641('0x4a')]({'raw':!![]});}})[_0x8641('0x16')](function(_0x2c61c4){var _0x419a4a=fs[_0x8641('0x51')](path[_0x8641('0x52')](config['root'],_0x8641('0x60')),_0x8641('0x54'));var _0x15ac15=ejs['render'](_0x419a4a,{'contexts':_0x2c61c4||[]});fs['writeFileSync'](_0x8641('0x55'),_0x15ac15);})[_0x8641('0x16')](function(){return respondWithRpcPromise(_0x8641('0x56'),_0x8641('0x2a'),{'module':_0x8641('0x57')});})[_0x8641('0x16')](function(){return _0x57297b;})[_0x8641('0x16')](respondWithResult(_0x2d5956,null))[_0x8641('0x20')](handleError(_0x2d5956,null));};exports[_0x8641('0x2e')]=function(_0x3161a1,_0x2f1662,_0x3e885c){var _0x15bb6d;return db[_0x8641('0x34')]['find']({'where':{'id':_0x3161a1[_0x8641('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2f1662,null))['then'](removeEntity(_0x2f1662,null))[_0x8641('0x16')](function(){return db['VoiceContext'][_0x8641('0x4a')]({'raw':!![]});})[_0x8641('0x16')](function(_0x3fb271){var _0x552063=fs[_0x8641('0x51')](path[_0x8641('0x52')](config['root'],_0x8641('0x60')),_0x8641('0x54'));var _0x957f52=ejs[_0x8641('0x61')](_0x552063,{'contexts':_0x3fb271});fs['writeFileSync'](_0x8641('0x55'),_0x957f52);return respondWithRpcPromise(_0x8641('0x56'),_0x8641('0x2e'),{'module':'chan_sip.so'});})[_0x8641('0x20')](handleError(_0x2f1662,null));}; \ No newline at end of file +var _0x6e99=['filter','where','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','show','params','create','body','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','find','utf8','chan_sip.so','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','count','offset','set','Content-Range','json','reject','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','pick'];(function(_0x4512a5,_0x44809a){var _0x58a68f=function(_0x3fa6da){while(--_0x3fa6da){_0x4512a5['push'](_0x4512a5['shift']());}};_0x58a68f(++_0x44809a);}(_0x6e99,0x1d3));var _0x96e9=function(_0x3e6ef6,_0x41c865){_0x3e6ef6=_0x3e6ef6-0x0;var _0x4fb82b=_0x6e99[_0x3e6ef6];return _0x4fb82b;};'use strict';var emlformat=require(_0x96e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96e9('0x1'));var jsonpatch=require(_0x96e9('0x2'));var rp=require(_0x96e9('0x3'));var moment=require(_0x96e9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x96e9('0x5'));var util=require(_0x96e9('0x6'));var path=require(_0x96e9('0x7'));var sox=require(_0x96e9('0x8'));var csv=require('to-csv');var ejs=require(_0x96e9('0x9'));var fs=require('fs');var fs_extra=require(_0x96e9('0xa'));var _=require(_0x96e9('0xb'));var squel=require('squel');var crypto=require(_0x96e9('0xc'));var jsforce=require(_0x96e9('0xd'));var deskjs=require(_0x96e9('0xe'));var toCsv=require(_0x96e9('0xf'));var querystring=require(_0x96e9('0x10'));var Papa=require(_0x96e9('0x11'));var Redis=require(_0x96e9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x96e9('0x13'));var as=require(_0x96e9('0x14'));var hardwareService=require(_0x96e9('0x15'));var logger=require(_0x96e9('0x16'))('api');var utils=require(_0x96e9('0x17'));var config=require(_0x96e9('0x18'));var licenseUtil=require(_0x96e9('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x96e9('0x1a'));var client=jayson[_0x96e9('0x1b')][_0x96e9('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x587247,_0x1ec0fb,_0xcbfd6a,_0x3e800b){return new BPromise(function(_0x44604a,_0x5b9814){var _0x5b8ccc=_0x3e800b||client;return _0x5b8ccc[_0x96e9('0x1d')](_0x587247,_0xcbfd6a)[_0x96e9('0x1e')](function(_0x41dcd5){logger[_0x96e9('0x1f')](_0x96e9('0x20'),_0x1ec0fb,'request\x20sent');logger[_0x96e9('0x21')](_0x96e9('0x22'),_0x1ec0fb,_0x96e9('0x23'),JSON[_0x96e9('0x24')](_0x41dcd5));if(_0x41dcd5[_0x96e9('0x25')]){if(_0x41dcd5[_0x96e9('0x25')][_0x96e9('0x26')]===0x1f4){logger[_0x96e9('0x25')](_0x96e9('0x20'),_0x1ec0fb,_0x41dcd5[_0x96e9('0x25')][_0x96e9('0x27')]);return _0x5b9814(_0x41dcd5['error']['message']);}logger[_0x96e9('0x25')]('VoiceContext,\x20%s,\x20%s',_0x1ec0fb,_0x41dcd5[_0x96e9('0x25')]['message']);return _0x44604a(_0x41dcd5['error']['message']);}else{logger[_0x96e9('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x1ec0fb,_0x96e9('0x23'));_0x44604a(_0x41dcd5[_0x96e9('0x28')][_0x96e9('0x27')]);}})[_0x96e9('0x29')](function(_0x1c385a){logger[_0x96e9('0x25')](_0x96e9('0x20'),_0x1ec0fb,_0x1c385a);_0x5b9814(_0x1c385a);});});}function respondWithStatusCode(_0x576c1a,_0x389dc1){_0x389dc1=_0x389dc1||0xcc;return function(_0x21edeb){if(_0x21edeb){return _0x576c1a[_0x96e9('0x2a')](_0x389dc1);}return _0x576c1a[_0x96e9('0x2b')](_0x389dc1)[_0x96e9('0x2c')]();};}function respondWithResult(_0x56094f,_0x483842){_0x483842=_0x483842||0xc8;return function(_0x1b27ae){if(_0x1b27ae){return _0x56094f[_0x96e9('0x2b')](_0x483842)['json'](_0x1b27ae);}};}function respondWithFilteredResult(_0x49bc38,_0x34a5d2){return function(_0x1fc49b){if(_0x1fc49b){var _0x441b9a=typeof _0x34a5d2['offset']===_0x96e9('0x2d')&&typeof _0x34a5d2['limit']===_0x96e9('0x2d');var _0x552ed9=_0x1fc49b[_0x96e9('0x2e')];var _0x51a8db=_0x441b9a?0x0:_0x34a5d2[_0x96e9('0x2f')];var _0x333a99=_0x441b9a?_0x1fc49b['count']:_0x34a5d2['offset']+_0x34a5d2['limit'];var _0x87b2e3;if(_0x333a99>=_0x552ed9){_0x333a99=_0x552ed9;_0x87b2e3=0xc8;}else{_0x87b2e3=0xce;}_0x49bc38[_0x96e9('0x2b')](_0x87b2e3);return _0x49bc38[_0x96e9('0x30')](_0x96e9('0x31'),_0x51a8db+'-'+_0x333a99+'/'+_0x552ed9)[_0x96e9('0x32')](_0x1fc49b);}return null;};}function patchUpdates(_0x97b41f){return function(_0x5b552f){try{jsonpatch['apply'](_0x5b552f,_0x97b41f,!![]);}catch(_0x550792){return BPromise[_0x96e9('0x33')](_0x550792);}return _0x5b552f['save']();};}function saveUpdates(_0x509695,_0x271315){return function(_0x879f1d){if(_0x879f1d){return _0x879f1d['update'](_0x509695)['then'](function(_0x354aa7){return _0x354aa7;});}return null;};}function removeEntity(_0xfd2ca8,_0x264b73){return function(_0xb8c50b){if(_0xb8c50b){return _0xb8c50b[_0x96e9('0x34')]()[_0x96e9('0x1e')](function(){var _0x4df268=_0xb8c50b[_0x96e9('0x35')]({'plain':!![]});var _0x43e8f=_0x96e9('0x36');return db[_0x96e9('0x37')][_0x96e9('0x34')]({'where':{'type':_0x43e8f,'resourceId':_0x4df268['id']}})['then'](function(){return _0xb8c50b;});})['then'](function(){_0xfd2ca8[_0x96e9('0x2b')](0xcc)[_0x96e9('0x2c')]();});}};}function handleEntityNotFound(_0x4c7377,_0xaef33b){return function(_0x306750){if(!_0x306750){_0x4c7377['sendStatus'](0x194);}return _0x306750;};}function handleError(_0x53dad2,_0x423519){_0x423519=_0x423519||0x1f4;return function(_0x32d6a4){logger[_0x96e9('0x25')](_0x32d6a4[_0x96e9('0x38')]);if(_0x32d6a4['name']){delete _0x32d6a4[_0x96e9('0x39')];}_0x53dad2[_0x96e9('0x2b')](_0x423519)[_0x96e9('0x3a')](_0x32d6a4);};}exports[_0x96e9('0x3b')]=function(_0x2f2001,_0x3477dd){var _0xbebd4c={},_0x464403={},_0x5f3b59={'count':0x0,'rows':[]};var _0x581866=_[_0x96e9('0x3c')](db['VoiceContext'][_0x96e9('0x3d')],function(_0x3ca616){return{'name':_0x3ca616[_0x96e9('0x3e')],'type':_0x3ca616[_0x96e9('0x3f')][_0x96e9('0x40')]};});_0x464403[_0x96e9('0x41')]=_['map'](_0x581866,'name');_0x464403['query']=_[_0x96e9('0x42')](_0x2f2001[_0x96e9('0x43')]);_0x464403[_0x96e9('0x44')]=_[_0x96e9('0x45')](_0x464403[_0x96e9('0x41')],_0x464403[_0x96e9('0x43')]);_0xbebd4c['attributes']=_[_0x96e9('0x45')](_0x464403[_0x96e9('0x41')],qs[_0x96e9('0x46')](_0x2f2001[_0x96e9('0x43')][_0x96e9('0x46')]));_0xbebd4c[_0x96e9('0x47')]=_0xbebd4c['attributes'][_0x96e9('0x48')]?_0xbebd4c[_0x96e9('0x47')]:_0x464403[_0x96e9('0x41')];if(!_0x2f2001[_0x96e9('0x43')]['hasOwnProperty'](_0x96e9('0x49'))){_0xbebd4c[_0x96e9('0x4a')]=qs[_0x96e9('0x4a')](_0x2f2001[_0x96e9('0x43')][_0x96e9('0x4a')]);_0xbebd4c[_0x96e9('0x2f')]=qs[_0x96e9('0x2f')](_0x2f2001[_0x96e9('0x43')][_0x96e9('0x2f')]);}_0xbebd4c[_0x96e9('0x4b')]=qs['sort'](_0x2f2001['query'][_0x96e9('0x4c')]);_0xbebd4c['where']=qs['filters'](_[_0x96e9('0x4d')](_0x2f2001[_0x96e9('0x43')],_0x464403[_0x96e9('0x44')]),_0x581866);if(_0x2f2001[_0x96e9('0x43')][_0x96e9('0x4e')]){_0xbebd4c[_0x96e9('0x4f')]=_[_0x96e9('0x50')](_0xbebd4c[_0x96e9('0x4f')],{'$or':_[_0x96e9('0x3c')](_0x581866,function(_0x487e08){if(_0x487e08[_0x96e9('0x3f')]!==_0x96e9('0x51')){var _0x2287ab={};_0x2287ab[_0x487e08[_0x96e9('0x39')]]={'$like':'%'+_0x2f2001[_0x96e9('0x43')][_0x96e9('0x4e')]+'%'};return _0x2287ab;}})});}_0xbebd4c=_['merge']({},_0xbebd4c,_0x2f2001[_0x96e9('0x52')]);var _0x3c8bcd={'where':_0xbebd4c[_0x96e9('0x4f')]};return db[_0x96e9('0x53')][_0x96e9('0x2e')](_0x3c8bcd)['then'](function(_0x7a00b2){_0x5f3b59[_0x96e9('0x2e')]=_0x7a00b2;if(_0x2f2001[_0x96e9('0x43')][_0x96e9('0x54')]){_0xbebd4c[_0x96e9('0x55')]=[{'all':!![]}];}return db['VoiceContext'][_0x96e9('0x56')](_0xbebd4c);})['then'](function(_0xa2b305){_0x5f3b59[_0x96e9('0x57')]=_0xa2b305;return _0x5f3b59;})[_0x96e9('0x1e')](respondWithFilteredResult(_0x3477dd,_0xbebd4c))[_0x96e9('0x29')](handleError(_0x3477dd,null));};exports[_0x96e9('0x58')]=function(_0x89cf33,_0x1ab6e4){var _0x392c0a={'raw':![],'where':{'id':_0x89cf33[_0x96e9('0x59')]['id']}},_0x5f2c88={};_0x5f2c88[_0x96e9('0x41')]=_['keys'](db[_0x96e9('0x53')][_0x96e9('0x3d')]);_0x5f2c88['query']=_[_0x96e9('0x42')](_0x89cf33[_0x96e9('0x43')]);_0x5f2c88['filters']=_[_0x96e9('0x45')](_0x5f2c88[_0x96e9('0x41')],_0x5f2c88[_0x96e9('0x43')]);_0x392c0a[_0x96e9('0x47')]=_[_0x96e9('0x45')](_0x5f2c88['model'],qs[_0x96e9('0x46')](_0x89cf33['query'][_0x96e9('0x46')]));_0x392c0a['attributes']=_0x392c0a['attributes'][_0x96e9('0x48')]?_0x392c0a[_0x96e9('0x47')]:_0x5f2c88['model'];if(_0x89cf33[_0x96e9('0x43')][_0x96e9('0x54')]){_0x392c0a[_0x96e9('0x55')]=[{'all':!![]}];}_0x392c0a=_[_0x96e9('0x50')]({},_0x392c0a,_0x89cf33[_0x96e9('0x52')]);return db[_0x96e9('0x53')]['find'](_0x392c0a)['then'](handleEntityNotFound(_0x1ab6e4,null))[_0x96e9('0x1e')](respondWithResult(_0x1ab6e4,null))[_0x96e9('0x29')](handleError(_0x1ab6e4,null));};exports[_0x96e9('0x5a')]=function(_0x134dc1,_0x2bf313,_0x5b49b4){var _0x1e7dd3;return db[_0x96e9('0x53')][_0x96e9('0x5a')](_0x134dc1[_0x96e9('0x5b')],{'raw':!![]})[_0x96e9('0x1e')](function(_0x3b47a0){_0x1e7dd3=_0x3b47a0;return db[_0x96e9('0x53')]['findAll']({'raw':!![]});})[_0x96e9('0x1e')](function(_0x291324){var _0x8a31bf=fs[_0x96e9('0x5c')](path[_0x96e9('0x5d')](config[_0x96e9('0x5e')],_0x96e9('0x5f')),'utf8');var _0x403331=ejs[_0x96e9('0x60')](_0x8a31bf,{'contexts':_0x291324||[]});fs[_0x96e9('0x61')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x403331);})['then'](function(){return respondWithRpcPromise(_0x96e9('0x62'),_0x96e9('0x5a'),{'module':'chan_sip.so'});})[_0x96e9('0x1e')](function(){var _0x5b5e00=_0x134dc1[_0x96e9('0x63')]['get']({'plain':!![]});if(!_0x5b5e00)throw new Error(_0x96e9('0x64'));if(_0x5b5e00[_0x96e9('0x65')]===_0x96e9('0x63')){var _0x36645b=_0x1e7dd3['get']({'plain':!![]});return db[_0x96e9('0x66')]['find']({'where':{'name':_0x96e9('0x36'),'userProfileId':_0x5b5e00[_0x96e9('0x67')]},'raw':!![]})[_0x96e9('0x1e')](function(_0x50b8b5){if(_0x50b8b5&&_0x50b8b5['autoAssociation']===0x0){return db[_0x96e9('0x37')][_0x96e9('0x5a')]({'name':_0x36645b[_0x96e9('0x39')],'resourceId':_0x36645b['id'],'type':_0x50b8b5['name'],'sectionId':_0x50b8b5['id']},{})['then'](function(){return _0x1e7dd3;});}else{return _0x1e7dd3;}})['catch'](function(_0x554b68){logger[_0x96e9('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x554b68);throw _0x554b68;});}return _0x1e7dd3;})[_0x96e9('0x1e')](respondWithResult(_0x2bf313,0xc9))[_0x96e9('0x29')](handleError(_0x2bf313,null));};exports[_0x96e9('0x68')]=function(_0x2ce292,_0x7adac6,_0x11853f){var _0x39de7e;return db['VoiceContext'][_0x96e9('0x69')]({'where':{'id':_0x2ce292[_0x96e9('0x59')]['id']}})['then'](handleEntityNotFound(_0x7adac6,null))[_0x96e9('0x1e')](saveUpdates(_0x2ce292['body'],null))[_0x96e9('0x1e')](function(_0x5d6228){if(_0x5d6228){_0x39de7e=_0x5d6228;return db[_0x96e9('0x53')]['findAll']({'raw':!![]});}})['then'](function(_0x406644){var _0x56a513=fs[_0x96e9('0x5c')](path[_0x96e9('0x5d')](config['root'],_0x96e9('0x5f')),_0x96e9('0x6a'));var _0x58774c=ejs['render'](_0x56a513,{'contexts':_0x406644||[]});fs[_0x96e9('0x61')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x58774c);})[_0x96e9('0x1e')](function(){return respondWithRpcPromise(_0x96e9('0x62'),_0x96e9('0x68'),{'module':_0x96e9('0x6b')});})[_0x96e9('0x1e')](function(){return _0x39de7e;})[_0x96e9('0x1e')](respondWithResult(_0x7adac6,null))[_0x96e9('0x29')](handleError(_0x7adac6,null));};exports[_0x96e9('0x34')]=function(_0x5916cc,_0x269b9d,_0x3bd14d){var _0x5a5d0a;return db[_0x96e9('0x53')][_0x96e9('0x69')]({'where':{'id':_0x5916cc[_0x96e9('0x59')]['id']}})[_0x96e9('0x1e')](handleEntityNotFound(_0x269b9d,null))[_0x96e9('0x1e')](removeEntity(_0x269b9d,null))[_0x96e9('0x1e')](function(){return db['VoiceContext'][_0x96e9('0x56')]({'raw':!![]});})[_0x96e9('0x1e')](function(_0x558383){var _0x508864=fs[_0x96e9('0x5c')](path['join'](config[_0x96e9('0x5e')],_0x96e9('0x5f')),_0x96e9('0x6a'));var _0x1d51c0=ejs[_0x96e9('0x60')](_0x508864,{'contexts':_0x558383});fs['writeFileSync'](_0x96e9('0x6c'),_0x1d51c0);return respondWithRpcPromise(_0x96e9('0x62'),'destroy',{'module':'chan_sip.so'});})[_0x96e9('0x29')](handleError(_0x269b9d,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 39138ba..f4c3f55 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 _0xf4b6=['rimraf','../../config/environment','exports','define','VoiceContext','lodash','../../config/logger','api','request-promise','path'];(function(_0x25e95a,_0x2efe4a){var _0x2b35e8=function(_0x1cd36a){while(--_0x1cd36a){_0x25e95a['push'](_0x25e95a['shift']());}};_0x2b35e8(++_0x2efe4a);}(_0xf4b6,0x1a9));var _0x6f4b=function(_0x162190,_0x5294ba){_0x162190=_0x162190-0x0;var _0x4408da=_0xf4b6[_0x162190];return _0x4408da;};'use strict';var _=require(_0x6f4b('0x0'));var util=require('util');var logger=require(_0x6f4b('0x1'))(_0x6f4b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6f4b('0x3'));var fs=require('fs');var path=require(_0x6f4b('0x4'));var rimraf=require(_0x6f4b('0x5'));var config=require(_0x6f4b('0x6'));var attributes=require('./voiceContext.attributes');module[_0x6f4b('0x7')]=function(_0xb42118,_0x3f6ca7){return _0xb42118[_0x6f4b('0x8')](_0x6f4b('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1ba=['lodash','../../config/logger','request-promise','rimraf','./voiceContext.attributes','exports','define'];(function(_0x31b350,_0x5be290){var _0x1870dc=function(_0xbae48d){while(--_0xbae48d){_0x31b350['push'](_0x31b350['shift']());}};_0x1870dc(++_0x5be290);}(_0xa1ba,0x1b9));var _0xaa1b=function(_0x2e7de1,_0x4d27c3){_0x2e7de1=_0x2e7de1-0x0;var _0x2b850f=_0xa1ba[_0x2e7de1];return _0x2b850f;};'use strict';var _=require(_0xaa1b('0x0'));var util=require('util');var logger=require(_0xaa1b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaa1b('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa1b('0x3'));var config=require('../../config/environment');var attributes=require(_0xaa1b('0x4'));module[_0xaa1b('0x5')]=function(_0x56ae95,_0x1f49e3){return _0x56ae95[_0xaa1b('0x6')]('VoiceContext',attributes,{'tableName':'voice_contexts','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 179a669..3980031 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 _0x6cb4=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','VoiceContext,\x20%s,\x20%s'];(function(_0x34d286,_0x205649){var _0x5a1a19=function(_0x20611a){while(--_0x20611a){_0x34d286['push'](_0x34d286['shift']());}};_0x5a1a19(++_0x205649);}(_0x6cb4,0xff));var _0x46cb=function(_0x50c50d,_0x554131){_0x50c50d=_0x50c50d-0x0;var _0x474e1b=_0x6cb4[_0x50c50d];return _0x474e1b;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('VoiceContext,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('VoiceContext,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});} \ No newline at end of file +var _0x4849=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x479978,_0x46ab1e){var _0x567a9f=function(_0x45a59e){while(--_0x45a59e){_0x479978['push'](_0x479978['shift']());}};_0x567a9f(++_0x46ab1e);}(_0x4849,0xf8));var _0x9484=function(_0x2f5462,_0x12eba2){_0x2f5462=_0x2f5462-0x0;var _0x329ff4=_0x4849[_0x2f5462];return _0x329ff4;};'use strict';var _=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var moment=require(_0x9484('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9484('0x3'));var db=require(_0x9484('0x4'))['db'];var utils=require(_0x9484('0x5'));var logger=require(_0x9484('0x6'))(_0x9484('0x7'));var config=require(_0x9484('0x8'));var jayson=require(_0x9484('0x9'));var client=jayson[_0x9484('0xa')][_0x9484('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x536b43,_0x4a8a70,_0x11f2a1){return new BPromise(function(_0x583079,_0x3929b9){return client[_0x9484('0xc')](_0x536b43,_0x11f2a1)[_0x9484('0xd')](function(_0xe8b216){logger[_0x9484('0xe')](_0x9484('0xf'),_0x4a8a70,_0x9484('0x10'));logger[_0x9484('0x11')](_0x9484('0x12'),_0x4a8a70,_0x9484('0x10'),JSON[_0x9484('0x13')](_0xe8b216));if(_0xe8b216[_0x9484('0x14')]){if(_0xe8b216[_0x9484('0x14')][_0x9484('0x15')]===0x1f4){logger[_0x9484('0x14')]('VoiceContext,\x20%s,\x20%s',_0x4a8a70,_0xe8b216[_0x9484('0x14')]['message']);return _0x3929b9(_0xe8b216[_0x9484('0x14')][_0x9484('0x16')]);}logger[_0x9484('0x14')](_0x9484('0xf'),_0x4a8a70,_0xe8b216[_0x9484('0x14')][_0x9484('0x16')]);return _0x583079(_0xe8b216['error'][_0x9484('0x16')]);}else{logger[_0x9484('0xe')]('VoiceContext,\x20%s,\x20%s',_0x4a8a70,'request\x20sent');_0x583079(_0xe8b216[_0x9484('0x17')]['message']);}})[_0x9484('0x18')](function(_0x4e974f){logger[_0x9484('0x14')](_0x9484('0xf'),_0x4a8a70,_0x4e974f);_0x3929b9(_0x4e974f);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 898494f..b410c43 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 _0x8e7b=['get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index'];(function(_0x27ccb7,_0x28cbf8){var _0x446cc1=function(_0x54dd88){while(--_0x54dd88){_0x27ccb7['push'](_0x27ccb7['shift']());}};_0x446cc1(++_0x28cbf8);}(_0x8e7b,0xb2));var _0xb8e7=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x8e7b[_0x36ed48];return _0x51c63a;};'use strict';var multer=require(_0xb8e7('0x0'));var util=require(_0xb8e7('0x1'));var path=require(_0xb8e7('0x2'));var timeout=require(_0xb8e7('0x3'));var express=require(_0xb8e7('0x4'));var router=express['Router']();var fs_extra=require(_0xb8e7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb8e7('0x6'));var config=require(_0xb8e7('0x7'));var controller=require(_0xb8e7('0x8'));router['get']('/',auth[_0xb8e7('0x9')](),controller[_0xb8e7('0xa')]);router[_0xb8e7('0xb')](_0xb8e7('0xc'),auth['isAuthenticated'](),controller[_0xb8e7('0xd')]);router[_0xb8e7('0xb')](_0xb8e7('0xe'),auth[_0xb8e7('0x9')](),controller[_0xb8e7('0xf')]);router['post']('/',auth[_0xb8e7('0x9')](),controller[_0xb8e7('0x10')]);router[_0xb8e7('0x11')](_0xb8e7('0xe'),auth[_0xb8e7('0x9')](),controller[_0xb8e7('0x12')]);router[_0xb8e7('0x13')]('/:id',auth[_0xb8e7('0x9')](),controller[_0xb8e7('0x14')]);module['exports']=router; \ No newline at end of file +var _0x833b=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','destroy','util'];(function(_0x28783a,_0x104f67){var _0x33c930=function(_0xd38d97){while(--_0xd38d97){_0x28783a['push'](_0x28783a['shift']());}};_0x33c930(++_0x104f67);}(_0x833b,0x131));var _0xb833=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x833b[_0x7e2eb0];return _0xd92de4;};'use strict';var multer=require('multer');var util=require(_0xb833('0x0'));var path=require('path');var timeout=require(_0xb833('0x1'));var express=require('express');var router=express[_0xb833('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb833('0x3'));var interaction=require(_0xb833('0x4'));var config=require(_0xb833('0x5'));var controller=require(_0xb833('0x6'));router[_0xb833('0x7')]('/',auth[_0xb833('0x8')](),controller[_0xb833('0x9')]);router['get'](_0xb833('0xa'),auth[_0xb833('0x8')](),controller[_0xb833('0xb')]);router[_0xb833('0x7')](_0xb833('0xc'),auth[_0xb833('0x8')](),controller[_0xb833('0xd')]);router['post']('/',auth[_0xb833('0x8')](),controller['create']);router[_0xb833('0xe')](_0xb833('0xc'),auth[_0xb833('0x8')](),controller[_0xb833('0xf')]);router['delete']('/:id',auth[_0xb833('0x8')](),controller[_0xb833('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 7db5849..88a6314 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 _0xbec5=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x9ea40b,_0x1b4bbb){var _0x33cd83=function(_0x5ceab7){while(--_0x5ceab7){_0x9ea40b['push'](_0x9ea40b['shift']());}};_0x33cd83(++_0x1b4bbb);}(_0xbec5,0xe5));var _0x5bec=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0xbec5[_0x470f63];return _0x4f09e2;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5bec('0x2')]},'channelstate':{'type':Sequelize[_0x5bec('0x3')]},'channelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'calleridnum':{'type':Sequelize[_0x5bec('0x2')]},'calleridname':{'type':Sequelize[_0x5bec('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5bec('0x2')]},'language':{'type':Sequelize[_0x5bec('0x2')]},'accountcode':{'type':Sequelize[_0x5bec('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5bec('0x2')]},'priority':{'type':Sequelize[_0x5bec('0x3')]},'uniqueid':{'type':Sequelize[_0x5bec('0x2')]},'linkedid':{'type':Sequelize[_0x5bec('0x2')]},'destchannel':{'type':Sequelize[_0x5bec('0x2')]},'destchannelstate':{'type':Sequelize[_0x5bec('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x5bec('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5bec('0x2')]},'destaccountcode':{'type':Sequelize[_0x5bec('0x2')]},'destcontext':{'type':Sequelize[_0x5bec('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5bec('0x3')]},'destuniqueid':{'type':Sequelize[_0x5bec('0x2')]},'destlinkedid':{'type':Sequelize[_0x5bec('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x5bec('0x2')]},'starttime':{'type':Sequelize[_0x5bec('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5bec('0x4')]},'lastevent':{'type':Sequelize[_0x5bec('0x2')],'comment':_0x5bec('0x5')},'routeId':{'type':Sequelize[_0x5bec('0x3')]},'duration':{'type':Sequelize[_0x5bec('0x3')]},'holdtime':{'type':Sequelize[_0x5bec('0x3')]},'billableseconds':{'type':Sequelize[_0x5bec('0x3')]}}; \ No newline at end of file +var _0x3e74=['DATE','sequelize','STRING','INTEGER'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x3e74,0x175));var _0x43e7=function(_0x52ed6b,_0x27bb95){_0x52ed6b=_0x52ed6b-0x0;var _0x49936d=_0x3e74[_0x52ed6b];return _0x49936d;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x43e7('0x1')]},'channel':{'type':Sequelize[_0x43e7('0x1')]},'channelstate':{'type':Sequelize[_0x43e7('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x43e7('0x1')]},'language':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize[_0x43e7('0x1')]},'exten':{'type':Sequelize[_0x43e7('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'linkedid':{'type':Sequelize[_0x43e7('0x1')]},'destchannel':{'type':Sequelize[_0x43e7('0x1')]},'destchannelstate':{'type':Sequelize[_0x43e7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x43e7('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x43e7('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x43e7('0x1')]},'destaccountcode':{'type':Sequelize[_0x43e7('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x43e7('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x43e7('0x1')]},'destlinkedid':{'type':Sequelize[_0x43e7('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x43e7('0x1')]},'starttime':{'type':Sequelize[_0x43e7('0x3')]},'answertime':{'type':Sequelize[_0x43e7('0x3')]},'endtime':{'type':Sequelize[_0x43e7('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x43e7('0x2')]},'duration':{'type':Sequelize[_0x43e7('0x2')]},'holdtime':{'type':Sequelize[_0x43e7('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index ae190ea..2fa41e5 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 _0x590f=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','VoiceDialReport','includeAll','include','findAll','then','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x1ca890,_0x21d0d3){var _0x3f8e01=function(_0x4ff2e2){while(--_0x4ff2e2){_0x1ca890['push'](_0x1ca890['shift']());}};_0x3f8e01(++_0x21d0d3);}(_0x590f,0x82));var _0xf590=function(_0x2702b3,_0x5b4b4a){_0x2702b3=_0x2702b3-0x0;var _0x194cff=_0x590f[_0x2702b3];return _0x194cff;};'use strict';var emlformat=require(_0xf590('0x0'));var rimraf=require(_0xf590('0x1'));var zipdir=require(_0xf590('0x2'));var jsonpatch=require(_0xf590('0x3'));var rp=require('request-promise');var moment=require(_0xf590('0x4'));var BPromise=require(_0xf590('0x5'));var Mustache=require(_0xf590('0x6'));var util=require(_0xf590('0x7'));var path=require(_0xf590('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf590('0x9'));var _=require(_0xf590('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf590('0xb'));var deskjs=require(_0xf590('0xc'));var toCsv=require(_0xf590('0xd'));var querystring=require(_0xf590('0xe'));var Papa=require(_0xf590('0xf'));var Redis=require(_0xf590('0x10'));var authService=require(_0xf590('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf590('0x12'));var hardwareService=require(_0xf590('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xf590('0x14'));var config=require(_0xf590('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf590('0x16'))['db'];function respondWithStatusCode(_0x2968e4,_0x58b45e){_0x58b45e=_0x58b45e||0xcc;return function(_0x44014b){if(_0x44014b){return _0x2968e4[_0xf590('0x17')](_0x58b45e);}return _0x2968e4[_0xf590('0x18')](_0x58b45e)[_0xf590('0x19')]();};}function respondWithResult(_0x36c782,_0x3d9e2e){_0x3d9e2e=_0x3d9e2e||0xc8;return function(_0x254251){if(_0x254251){return _0x36c782[_0xf590('0x18')](_0x3d9e2e)[_0xf590('0x1a')](_0x254251);}};}function respondWithFilteredResult(_0x25a2ce,_0x265564){return function(_0x4ab13b){if(_0x4ab13b){var _0x5c3b83=typeof _0x265564[_0xf590('0x1b')]===_0xf590('0x1c')&&typeof _0x265564[_0xf590('0x1d')]===_0xf590('0x1c');var _0x7c26ec=_0x4ab13b['count'];var _0x2fa283=_0x5c3b83?0x0:_0x265564['offset'];var _0x380888=_0x5c3b83?_0x4ab13b[_0xf590('0x1e')]:_0x265564['offset']+_0x265564['limit'];var _0x3f4f59;if(_0x380888>=_0x7c26ec){_0x380888=_0x7c26ec;_0x3f4f59=0xc8;}else{_0x3f4f59=0xce;}_0x25a2ce['status'](_0x3f4f59);return _0x25a2ce['set'](_0xf590('0x1f'),_0x2fa283+'-'+_0x380888+'/'+_0x7c26ec)[_0xf590('0x1a')](_0x4ab13b);}return null;};}function patchUpdates(_0x1283ec){return function(_0x219661){try{jsonpatch['apply'](_0x219661,_0x1283ec,!![]);}catch(_0x3f90ec){return BPromise[_0xf590('0x20')](_0x3f90ec);}return _0x219661[_0xf590('0x21')]();};}function saveUpdates(_0x2b3932,_0x28fb13){return function(_0x1bf7b8){if(_0x1bf7b8){return _0x1bf7b8[_0xf590('0x22')](_0x2b3932)['then'](function(_0x510938){return _0x510938;});}return null;};}function removeEntity(_0xe6d49a,_0x1629f7){return function(_0x4aa86b){if(_0x4aa86b){return _0x4aa86b['destroy']()['then'](function(){_0xe6d49a[_0xf590('0x18')](0xcc)[_0xf590('0x19')]();});}};}function handleEntityNotFound(_0xbd898b,_0x418a9f){return function(_0x6d7517){if(!_0x6d7517){_0xbd898b[_0xf590('0x17')](0x194);}return _0x6d7517;};}function handleError(_0x1e9a2c,_0x47f26d){_0x47f26d=_0x47f26d||0x1f4;return function(_0x57e97e){logger[_0xf590('0x23')](_0x57e97e[_0xf590('0x24')]);if(_0x57e97e[_0xf590('0x25')]){delete _0x57e97e[_0xf590('0x25')];}_0x1e9a2c[_0xf590('0x18')](_0x47f26d)[_0xf590('0x26')](_0x57e97e);};}exports[_0xf590('0x27')]=function(_0x3a93b2,_0x2c5b5e){var _0x5129b2={},_0x2f31da={},_0x6b1503={'count':0x0,'rows':[]};var _0x297db7=_['map'](db['VoiceDialReport'][_0xf590('0x28')],function(_0x5311e){return{'name':_0x5311e[_0xf590('0x29')],'type':_0x5311e[_0xf590('0x2a')][_0xf590('0x2b')]};});_0x2f31da[_0xf590('0x2c')]=_[_0xf590('0x2d')](_0x297db7,_0xf590('0x25'));_0x2f31da['query']=_[_0xf590('0x2e')](_0x3a93b2[_0xf590('0x2f')]);_0x2f31da[_0xf590('0x30')]=_[_0xf590('0x31')](_0x2f31da[_0xf590('0x2c')],_0x2f31da[_0xf590('0x2f')]);_0x5129b2[_0xf590('0x32')]=_[_0xf590('0x31')](_0x2f31da[_0xf590('0x2c')],qs[_0xf590('0x33')](_0x3a93b2[_0xf590('0x2f')]['fields']));_0x5129b2[_0xf590('0x32')]=_0x5129b2[_0xf590('0x32')][_0xf590('0x34')]?_0x5129b2[_0xf590('0x32')]:_0x2f31da[_0xf590('0x2c')];if(!_0x3a93b2['query'][_0xf590('0x35')](_0xf590('0x36'))){_0x5129b2['limit']=qs['limit'](_0x3a93b2[_0xf590('0x2f')][_0xf590('0x1d')]);_0x5129b2[_0xf590('0x1b')]=qs[_0xf590('0x1b')](_0x3a93b2[_0xf590('0x2f')]['offset']);}_0x5129b2[_0xf590('0x37')]=qs[_0xf590('0x38')](_0x3a93b2[_0xf590('0x2f')][_0xf590('0x38')]);_0x5129b2['where']=qs['filters'](_[_0xf590('0x39')](_0x3a93b2['query'],_0x2f31da[_0xf590('0x30')]),_0x297db7);if(_0x3a93b2['query']['filter']){_0x5129b2[_0xf590('0x3a')]=_[_0xf590('0x3b')](_0x5129b2['where'],{'$or':_[_0xf590('0x2d')](_0x297db7,function(_0x35416){if(_0x35416[_0xf590('0x2a')]!=='VIRTUAL'){var _0x3c2dd1={};_0x3c2dd1[_0x35416['name']]={'$like':'%'+_0x3a93b2[_0xf590('0x2f')][_0xf590('0x3c')]+'%'};return _0x3c2dd1;}})});}_0x5129b2=_[_0xf590('0x3b')]({},_0x5129b2,_0x3a93b2[_0xf590('0x3d')]);var _0x1cae2a={'where':_0x5129b2[_0xf590('0x3a')]};return db[_0xf590('0x3e')][_0xf590('0x1e')](_0x1cae2a)['then'](function(_0x5e72b8){_0x6b1503[_0xf590('0x1e')]=_0x5e72b8;if(_0x3a93b2[_0xf590('0x2f')][_0xf590('0x3f')]){_0x5129b2[_0xf590('0x40')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xf590('0x41')](_0x5129b2);})[_0xf590('0x42')](function(_0x356f5d){_0x6b1503[_0xf590('0x43')]=_0x356f5d;return _0x6b1503;})[_0xf590('0x42')](respondWithFilteredResult(_0x2c5b5e,_0x5129b2))[_0xf590('0x44')](handleError(_0x2c5b5e,null));};exports[_0xf590('0x45')]=function(_0x3236ab,_0x41a62e){var _0x42a6be={'raw':!![],'where':{'id':_0x3236ab[_0xf590('0x46')]['id']}},_0x54afc5={};_0x54afc5[_0xf590('0x2c')]=_['keys'](db[_0xf590('0x3e')][_0xf590('0x28')]);_0x54afc5[_0xf590('0x2f')]=_[_0xf590('0x2e')](_0x3236ab[_0xf590('0x2f')]);_0x54afc5[_0xf590('0x30')]=_[_0xf590('0x31')](_0x54afc5[_0xf590('0x2c')],_0x54afc5[_0xf590('0x2f')]);_0x42a6be[_0xf590('0x32')]=_[_0xf590('0x31')](_0x54afc5['model'],qs['fields'](_0x3236ab['query'][_0xf590('0x33')]));_0x42a6be[_0xf590('0x32')]=_0x42a6be[_0xf590('0x32')]['length']?_0x42a6be[_0xf590('0x32')]:_0x54afc5[_0xf590('0x2c')];if(_0x3236ab[_0xf590('0x2f')][_0xf590('0x3f')]){_0x42a6be[_0xf590('0x40')]=[{'all':!![]}];}_0x42a6be=_[_0xf590('0x3b')]({},_0x42a6be,_0x3236ab[_0xf590('0x3d')]);return db[_0xf590('0x3e')][_0xf590('0x47')](_0x42a6be)['then'](handleEntityNotFound(_0x41a62e,null))['then'](respondWithResult(_0x41a62e,null))[_0xf590('0x44')](handleError(_0x41a62e,null));};exports[_0xf590('0x48')]=function(_0x395630,_0x349997){return db['VoiceDialReport'][_0xf590('0x48')](_0x395630[_0xf590('0x49')],{})[_0xf590('0x42')](respondWithResult(_0x349997,0xc9))[_0xf590('0x44')](handleError(_0x349997,null));};exports[_0xf590('0x22')]=function(_0xc1ef9f,_0x55e92a){if(_0xc1ef9f[_0xf590('0x49')]['id']){delete _0xc1ef9f[_0xf590('0x49')]['id'];}return db[_0xf590('0x3e')][_0xf590('0x47')]({'where':{'id':_0xc1ef9f['params']['id']}})['then'](handleEntityNotFound(_0x55e92a,null))[_0xf590('0x42')](saveUpdates(_0xc1ef9f[_0xf590('0x49')],null))[_0xf590('0x42')](respondWithResult(_0x55e92a,null))['catch'](handleError(_0x55e92a,null));};exports[_0xf590('0x4a')]=function(_0x5603a7,_0x5e0cf9){return db[_0xf590('0x3e')][_0xf590('0x47')]({'where':{'id':_0x5603a7[_0xf590('0x46')]['id']}})[_0xf590('0x42')](handleEntityNotFound(_0x5e0cf9,null))['then'](removeEntity(_0x5e0cf9,null))[_0xf590('0x44')](handleError(_0x5e0cf9,null));};exports[_0xf590('0x4b')]=function(_0x56345c,_0x4c8a38){return db[_0xf590('0x3e')][_0xf590('0x4b')]()[_0xf590('0x42')](respondWithResult(_0x4c8a38,null))[_0xf590('0x44')](handleError(_0x4c8a38,null));}; \ No newline at end of file +var _0x9953=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9953,0x8a));var _0x3995=function(_0x6171c0,_0x127af3){_0x6171c0=_0x6171c0-0x0;var _0x227390=_0x9953[_0x6171c0];return _0x227390;};'use strict';var emlformat=require(_0x3995('0x0'));var rimraf=require(_0x3995('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3995('0x2'));var rp=require('request-promise');var moment=require(_0x3995('0x3'));var BPromise=require(_0x3995('0x4'));var Mustache=require(_0x3995('0x5'));var util=require(_0x3995('0x6'));var path=require(_0x3995('0x7'));var sox=require(_0x3995('0x8'));var csv=require(_0x3995('0x9'));var ejs=require(_0x3995('0xa'));var fs=require('fs');var fs_extra=require(_0x3995('0xb'));var _=require('lodash');var squel=require(_0x3995('0xc'));var crypto=require(_0x3995('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3995('0xe'));var toCsv=require(_0x3995('0x9'));var querystring=require(_0x3995('0xf'));var Papa=require(_0x3995('0x10'));var Redis=require(_0x3995('0x11'));var authService=require(_0x3995('0x12'));var qs=require(_0x3995('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3995('0x14'));var logger=require(_0x3995('0x15'))(_0x3995('0x16'));var utils=require(_0x3995('0x17'));var config=require(_0x3995('0x18'));var licenseUtil=require(_0x3995('0x19'));var db=require(_0x3995('0x1a'))['db'];function respondWithStatusCode(_0x57418c,_0x1a3e7a){_0x1a3e7a=_0x1a3e7a||0xcc;return function(_0x149c2d){if(_0x149c2d){return _0x57418c[_0x3995('0x1b')](_0x1a3e7a);}return _0x57418c['status'](_0x1a3e7a)[_0x3995('0x1c')]();};}function respondWithResult(_0x3fae2b,_0x43da7e){_0x43da7e=_0x43da7e||0xc8;return function(_0x32a506){if(_0x32a506){return _0x3fae2b[_0x3995('0x1d')](_0x43da7e)[_0x3995('0x1e')](_0x32a506);}};}function respondWithFilteredResult(_0x2e82db,_0x513924){return function(_0x9b9294){if(_0x9b9294){var _0x1cce28=typeof _0x513924[_0x3995('0x1f')]===_0x3995('0x20')&&typeof _0x513924[_0x3995('0x21')]===_0x3995('0x20');var _0x31ecfc=_0x9b9294['count'];var _0x375ddf=_0x1cce28?0x0:_0x513924[_0x3995('0x1f')];var _0x4e361a=_0x1cce28?_0x9b9294[_0x3995('0x22')]:_0x513924[_0x3995('0x1f')]+_0x513924['limit'];var _0x769120;if(_0x4e361a>=_0x31ecfc){_0x4e361a=_0x31ecfc;_0x769120=0xc8;}else{_0x769120=0xce;}_0x2e82db['status'](_0x769120);return _0x2e82db[_0x3995('0x23')](_0x3995('0x24'),_0x375ddf+'-'+_0x4e361a+'/'+_0x31ecfc)[_0x3995('0x1e')](_0x9b9294);}return null;};}function patchUpdates(_0x98bc8c){return function(_0x5eb250){try{jsonpatch[_0x3995('0x25')](_0x5eb250,_0x98bc8c,!![]);}catch(_0x1bf333){return BPromise[_0x3995('0x26')](_0x1bf333);}return _0x5eb250[_0x3995('0x27')]();};}function saveUpdates(_0x1a6437,_0x4434df){return function(_0x271b1e){if(_0x271b1e){return _0x271b1e[_0x3995('0x28')](_0x1a6437)[_0x3995('0x29')](function(_0x46e413){return _0x46e413;});}return null;};}function removeEntity(_0x3549f4,_0x3a5e74){return function(_0x13547e){if(_0x13547e){return _0x13547e[_0x3995('0x2a')]()[_0x3995('0x29')](function(){_0x3549f4[_0x3995('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51efa3,_0x2c6343){return function(_0x46c0c1){if(!_0x46c0c1){_0x51efa3['sendStatus'](0x194);}return _0x46c0c1;};}function handleError(_0x4484fa,_0x32296b){_0x32296b=_0x32296b||0x1f4;return function(_0x235db0){logger[_0x3995('0x2b')](_0x235db0[_0x3995('0x2c')]);if(_0x235db0[_0x3995('0x2d')]){delete _0x235db0[_0x3995('0x2d')];}_0x4484fa['status'](_0x32296b)[_0x3995('0x2e')](_0x235db0);};}exports[_0x3995('0x2f')]=function(_0x286053,_0x1ccb55){var _0x1ea200={},_0x12a294={},_0x28bacc={'count':0x0,'rows':[]};var _0x481614=_[_0x3995('0x30')](db[_0x3995('0x31')][_0x3995('0x32')],function(_0x55086f){return{'name':_0x55086f[_0x3995('0x33')],'type':_0x55086f[_0x3995('0x34')][_0x3995('0x35')]};});_0x12a294[_0x3995('0x36')]=_[_0x3995('0x30')](_0x481614,_0x3995('0x2d'));_0x12a294[_0x3995('0x37')]=_[_0x3995('0x38')](_0x286053[_0x3995('0x37')]);_0x12a294[_0x3995('0x39')]=_[_0x3995('0x3a')](_0x12a294['model'],_0x12a294[_0x3995('0x37')]);_0x1ea200[_0x3995('0x3b')]=_[_0x3995('0x3a')](_0x12a294[_0x3995('0x36')],qs[_0x3995('0x3c')](_0x286053['query'][_0x3995('0x3c')]));_0x1ea200['attributes']=_0x1ea200[_0x3995('0x3b')][_0x3995('0x3d')]?_0x1ea200['attributes']:_0x12a294[_0x3995('0x36')];if(!_0x286053[_0x3995('0x37')][_0x3995('0x3e')]('nolimit')){_0x1ea200['limit']=qs[_0x3995('0x21')](_0x286053[_0x3995('0x37')][_0x3995('0x21')]);_0x1ea200[_0x3995('0x1f')]=qs['offset'](_0x286053['query']['offset']);}_0x1ea200[_0x3995('0x3f')]=qs[_0x3995('0x40')](_0x286053[_0x3995('0x37')][_0x3995('0x40')]);_0x1ea200[_0x3995('0x41')]=qs[_0x3995('0x39')](_[_0x3995('0x42')](_0x286053[_0x3995('0x37')],_0x12a294['filters']),_0x481614);if(_0x286053[_0x3995('0x37')][_0x3995('0x43')]){_0x1ea200[_0x3995('0x41')]=_[_0x3995('0x44')](_0x1ea200[_0x3995('0x41')],{'$or':_[_0x3995('0x30')](_0x481614,function(_0x3dd118){if(_0x3dd118[_0x3995('0x34')]!==_0x3995('0x45')){var _0x45245f={};_0x45245f[_0x3dd118[_0x3995('0x2d')]]={'$like':'%'+_0x286053[_0x3995('0x37')]['filter']+'%'};return _0x45245f;}})});}_0x1ea200=_['merge']({},_0x1ea200,_0x286053[_0x3995('0x46')]);var _0xdcc6a2={'where':_0x1ea200[_0x3995('0x41')]};return db[_0x3995('0x31')]['count'](_0xdcc6a2)['then'](function(_0x4c344d){_0x28bacc[_0x3995('0x22')]=_0x4c344d;if(_0x286053[_0x3995('0x37')][_0x3995('0x47')]){_0x1ea200['include']=[{'all':!![]}];}return db[_0x3995('0x31')]['findAll'](_0x1ea200);})[_0x3995('0x29')](function(_0x32d0a7){_0x28bacc[_0x3995('0x48')]=_0x32d0a7;return _0x28bacc;})[_0x3995('0x29')](respondWithFilteredResult(_0x1ccb55,_0x1ea200))['catch'](handleError(_0x1ccb55,null));};exports[_0x3995('0x49')]=function(_0x194e77,_0x4a3877){var _0x25bbe1={'raw':!![],'where':{'id':_0x194e77[_0x3995('0x4a')]['id']}},_0x4155c3={};_0x4155c3['model']=_[_0x3995('0x38')](db[_0x3995('0x31')][_0x3995('0x32')]);_0x4155c3[_0x3995('0x37')]=_['keys'](_0x194e77[_0x3995('0x37')]);_0x4155c3[_0x3995('0x39')]=_[_0x3995('0x3a')](_0x4155c3[_0x3995('0x36')],_0x4155c3[_0x3995('0x37')]);_0x25bbe1['attributes']=_['intersection'](_0x4155c3[_0x3995('0x36')],qs[_0x3995('0x3c')](_0x194e77['query'][_0x3995('0x3c')]));_0x25bbe1[_0x3995('0x3b')]=_0x25bbe1[_0x3995('0x3b')][_0x3995('0x3d')]?_0x25bbe1[_0x3995('0x3b')]:_0x4155c3[_0x3995('0x36')];if(_0x194e77[_0x3995('0x37')][_0x3995('0x47')]){_0x25bbe1[_0x3995('0x4b')]=[{'all':!![]}];}_0x25bbe1=_[_0x3995('0x44')]({},_0x25bbe1,_0x194e77[_0x3995('0x46')]);return db['VoiceDialReport'][_0x3995('0x4c')](_0x25bbe1)[_0x3995('0x29')](handleEntityNotFound(_0x4a3877,null))[_0x3995('0x29')](respondWithResult(_0x4a3877,null))[_0x3995('0x4d')](handleError(_0x4a3877,null));};exports[_0x3995('0x4e')]=function(_0x537fe8,_0x1a390d){return db[_0x3995('0x31')][_0x3995('0x4e')](_0x537fe8['body'],{})[_0x3995('0x29')](respondWithResult(_0x1a390d,0xc9))[_0x3995('0x4d')](handleError(_0x1a390d,null));};exports[_0x3995('0x28')]=function(_0x150721,_0x4cd5c4){if(_0x150721[_0x3995('0x4f')]['id']){delete _0x150721[_0x3995('0x4f')]['id'];}return db[_0x3995('0x31')][_0x3995('0x4c')]({'where':{'id':_0x150721[_0x3995('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4cd5c4,null))['then'](saveUpdates(_0x150721[_0x3995('0x4f')],null))[_0x3995('0x29')](respondWithResult(_0x4cd5c4,null))[_0x3995('0x4d')](handleError(_0x4cd5c4,null));};exports[_0x3995('0x2a')]=function(_0x356606,_0x3e93f3){return db[_0x3995('0x31')]['find']({'where':{'id':_0x356606[_0x3995('0x4a')]['id']}})[_0x3995('0x29')](handleEntityNotFound(_0x3e93f3,null))[_0x3995('0x29')](removeEntity(_0x3e93f3,null))['catch'](handleError(_0x3e93f3,null));};exports[_0x3995('0x50')]=function(_0x282967,_0x3681ca){return db[_0x3995('0x31')]['describe']()[_0x3995('0x29')](respondWithResult(_0x3681ca,null))[_0x3995('0x4d')](handleError(_0x3681ca,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 618ba24..041cae0 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 _0xad66=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','exports','VoiceDialReport','uniqueid'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xad66,0x8c));var _0x6ad6=function(_0xaf73cc,_0x43252b){_0xaf73cc=_0xaf73cc-0x0;var _0x2cd3b4=_0xad66[_0xaf73cc];return _0x2cd3b4;};'use strict';var _=require(_0x6ad6('0x0'));var util=require(_0x6ad6('0x1'));var logger=require(_0x6ad6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ad6('0x3'));var rp=require(_0x6ad6('0x4'));var fs=require('fs');var path=require(_0x6ad6('0x5'));var rimraf=require(_0x6ad6('0x6'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0x6ad6('0x7')]=function(_0x2aaf7a,_0x46c21b){return _0x2aaf7a['define'](_0x6ad6('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x6ad6('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ae4=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceDialReport','uniqueid','util','../../config/logger'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x3ae4,0x166));var _0x43ae=function(_0x5d99e3,_0x117a42){_0x5d99e3=_0x5d99e3-0x0;var _0x277b07=_0x3ae4[_0x5d99e3];return _0x277b07;};'use strict';var _=require('lodash');var util=require(_0x43ae('0x0'));var logger=require(_0x43ae('0x1'))(_0x43ae('0x2'));var moment=require('moment');var BPromise=require(_0x43ae('0x3'));var rp=require(_0x43ae('0x4'));var fs=require('fs');var path=require(_0x43ae('0x5'));var rimraf=require(_0x43ae('0x6'));var config=require(_0x43ae('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0x43ae('0x8')]=function(_0x5d30ed,_0x477cf5){return _0x5d30ed[_0x43ae('0x9')](_0x43ae('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x43ae('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 253032e..ccad6d1 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 _0x36f2=['../../config/environment','jayson/promise','client','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','create','options','raw','then','CreateVoiceDialReport','debug','catch','UpdateVoiceDialReport','VoiceDialReport','update','body','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x14a94f,_0x455f28){var _0x1e223b=function(_0x42fe09){while(--_0x42fe09){_0x14a94f['push'](_0x14a94f['shift']());}};_0x1e223b(++_0x455f28);}(_0x36f2,0x1c5));var _0x236f=function(_0x5597e8,_0x1e6704){_0x5597e8=_0x5597e8-0x0;var _0x35b04e=_0x36f2[_0x5597e8];return _0x35b04e;};'use strict';var _=require(_0x236f('0x0'));var util=require(_0x236f('0x1'));var moment=require(_0x236f('0x2'));var BPromise=require(_0x236f('0x3'));var rs=require(_0x236f('0x4'));var fs=require('fs');var Redis=require(_0x236f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x236f('0x6'));var logger=require(_0x236f('0x7'))(_0x236f('0x8'));var config=require(_0x236f('0x9'));var jayson=require(_0x236f('0xa'));var client=jayson[_0x236f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31ab05,_0x1b4417,_0x65de83){return new BPromise(function(_0x5c5d39,_0x43d197){return client['request'](_0x31ab05,_0x65de83)['then'](function(_0x500ffc){logger['info'](_0x236f('0xc'),_0x1b4417,_0x236f('0xd'));logger['debug'](_0x236f('0xe'),_0x1b4417,_0x236f('0xd'),JSON[_0x236f('0xf')](_0x500ffc));if(_0x500ffc[_0x236f('0x10')]){if(_0x500ffc['error']['code']===0x1f4){logger[_0x236f('0x10')](_0x236f('0xc'),_0x1b4417,_0x500ffc[_0x236f('0x10')][_0x236f('0x11')]);return _0x43d197(_0x500ffc[_0x236f('0x10')]['message']);}logger['error'](_0x236f('0xc'),_0x1b4417,_0x500ffc[_0x236f('0x10')][_0x236f('0x11')]);return _0x5c5d39(_0x500ffc['error'][_0x236f('0x11')]);}else{logger[_0x236f('0x12')](_0x236f('0xc'),_0x1b4417,_0x236f('0xd'));_0x5c5d39(_0x500ffc[_0x236f('0x13')][_0x236f('0x11')]);}})['catch'](function(_0x2012c9){logger[_0x236f('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x1b4417,_0x2012c9);_0x43d197(_0x2012c9);});});}exports['CreateVoiceDialReport']=function(_0x1fbd3d){var _0x1b312c=this;return new Promise(function(_0x5d901c,_0x13c2ea){return db['VoiceDialReport'][_0x236f('0x14')](_0x1fbd3d['body'],{'raw':_0x1fbd3d['options']?_0x1fbd3d[_0x236f('0x15')][_0x236f('0x16')]===undefined?!![]:![]:!![]})[_0x236f('0x17')](function(_0x133000){logger[_0x236f('0x12')](_0x236f('0x18'),_0x1fbd3d);logger[_0x236f('0x19')](_0x236f('0x18'),_0x1fbd3d,JSON[_0x236f('0xf')](_0x133000));_0x5d901c(_0x133000);})[_0x236f('0x1a')](function(_0x59758b){logger[_0x236f('0x10')](_0x236f('0x18'),_0x59758b[_0x236f('0x11')],_0x1fbd3d);_0x13c2ea(_0x1b312c[_0x236f('0x10')](0x1f4,_0x59758b[_0x236f('0x11')]));});});};exports[_0x236f('0x1b')]=function(_0x318443){var _0x38e214=this;return new Promise(function(_0x1ef887,_0x49291d){return db[_0x236f('0x1c')][_0x236f('0x1d')](_0x318443[_0x236f('0x1e')],{'raw':_0x318443[_0x236f('0x15')]?_0x318443[_0x236f('0x15')][_0x236f('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x318443[_0x236f('0x15')]?_0x318443[_0x236f('0x15')]['where']||null:null,'attributes':_0x318443[_0x236f('0x15')]?_0x318443[_0x236f('0x15')][_0x236f('0x1f')]||null:null,'limit':_0x318443[_0x236f('0x15')]?_0x318443[_0x236f('0x15')][_0x236f('0x20')]||null:null})[_0x236f('0x17')](function(_0xef22bd){logger[_0x236f('0x12')](_0x236f('0x1b'),_0x318443);logger[_0x236f('0x19')](_0x236f('0x1b'),_0x318443,JSON[_0x236f('0xf')](_0xef22bd));_0x1ef887(_0xef22bd);})[_0x236f('0x1a')](function(_0x10b73e){logger[_0x236f('0x10')](_0x236f('0x1b'),_0x10b73e[_0x236f('0x11')],_0x318443);_0x49291d(_0x38e214[_0x236f('0x10')](0x1f4,_0x10b73e[_0x236f('0x11')]));});});}; \ No newline at end of file +var _0xd3e9=['http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','debug','UpdateVoiceDialReport','update','body','attributes','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','client'];(function(_0x3e20e,_0x231b17){var _0x375132=function(_0x369a1d){while(--_0x369a1d){_0x3e20e['push'](_0x3e20e['shift']());}};_0x375132(++_0x231b17);}(_0xd3e9,0xac));var _0x9d3e=function(_0xda3309,_0x23f090){_0xda3309=_0xda3309-0x0;var _0x598670=_0xd3e9[_0xda3309];return _0x598670;};'use strict';var _=require(_0x9d3e('0x0'));var util=require(_0x9d3e('0x1'));var moment=require(_0x9d3e('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d3e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9d3e('0x4'))(_0x9d3e('0x5'));var config=require(_0x9d3e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9d3e('0x7')][_0x9d3e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d52d3,_0x3990f8,_0x3b03cb){return new BPromise(function(_0x177fb6,_0x6ced01){return client[_0x9d3e('0x9')](_0x3d52d3,_0x3b03cb)[_0x9d3e('0xa')](function(_0x22e6f2){logger[_0x9d3e('0xb')](_0x9d3e('0xc'),_0x3990f8,_0x9d3e('0xd'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x3990f8,'request\x20sent',JSON[_0x9d3e('0xe')](_0x22e6f2));if(_0x22e6f2['error']){if(_0x22e6f2[_0x9d3e('0xf')][_0x9d3e('0x10')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x3990f8,_0x22e6f2['error'][_0x9d3e('0x11')]);return _0x6ced01(_0x22e6f2[_0x9d3e('0xf')][_0x9d3e('0x11')]);}logger['error'](_0x9d3e('0xc'),_0x3990f8,_0x22e6f2['error'][_0x9d3e('0x11')]);return _0x177fb6(_0x22e6f2['error'][_0x9d3e('0x11')]);}else{logger[_0x9d3e('0xb')](_0x9d3e('0xc'),_0x3990f8,'request\x20sent');_0x177fb6(_0x22e6f2[_0x9d3e('0x12')][_0x9d3e('0x11')]);}})[_0x9d3e('0x13')](function(_0x54b53c){logger[_0x9d3e('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x3990f8,_0x54b53c);_0x6ced01(_0x54b53c);});});}exports[_0x9d3e('0x14')]=function(_0x28535e){var _0x22c501=this;return new Promise(function(_0x4988ba,_0x9c07ac){return db[_0x9d3e('0x15')][_0x9d3e('0x16')](_0x28535e['body'],{'raw':_0x28535e['options']?_0x28535e[_0x9d3e('0x17')][_0x9d3e('0x18')]===undefined?!![]:![]:!![]})[_0x9d3e('0xa')](function(_0x22a031){logger[_0x9d3e('0xb')](_0x9d3e('0x14'),_0x28535e);logger[_0x9d3e('0x19')](_0x9d3e('0x14'),_0x28535e,JSON[_0x9d3e('0xe')](_0x22a031));_0x4988ba(_0x22a031);})[_0x9d3e('0x13')](function(_0x2ec6d8){logger['error'](_0x9d3e('0x14'),_0x2ec6d8['message'],_0x28535e);_0x9c07ac(_0x22c501[_0x9d3e('0xf')](0x1f4,_0x2ec6d8[_0x9d3e('0x11')]));});});};exports[_0x9d3e('0x1a')]=function(_0x31e953){var _0x548691=this;return new Promise(function(_0x4a04db,_0x562003){return db[_0x9d3e('0x15')][_0x9d3e('0x1b')](_0x31e953[_0x9d3e('0x1c')],{'raw':_0x31e953[_0x9d3e('0x17')]?_0x31e953[_0x9d3e('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31e953['options']?_0x31e953['options']['where']||null:null,'attributes':_0x31e953[_0x9d3e('0x17')]?_0x31e953[_0x9d3e('0x17')][_0x9d3e('0x1d')]||null:null,'limit':_0x31e953['options']?_0x31e953[_0x9d3e('0x17')]['limit']||null:null})[_0x9d3e('0xa')](function(_0x270547){logger['info'](_0x9d3e('0x1a'),_0x31e953);logger[_0x9d3e('0x19')](_0x9d3e('0x1a'),_0x31e953,JSON['stringify'](_0x270547));_0x4a04db(_0x270547);})[_0x9d3e('0x13')](function(_0x2e1d55){logger[_0x9d3e('0xf')](_0x9d3e('0x1a'),_0x2e1d55[_0x9d3e('0x11')],_0x31e953);_0x562003(_0x548691[_0x9d3e('0xf')](0x1f4,_0x2e1d55[_0x9d3e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 3a615e8..7d7be78 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 _0x8687=['addApplications','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','/:id/applications'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8687,0xed));var _0x7868=function(_0x306e60,_0x50d56d){_0x306e60=_0x306e60-0x0;var _0x1d5106=_0x8687[_0x306e60];return _0x1d5106;};'use strict';var multer=require('multer');var util=require(_0x7868('0x0'));var path=require(_0x7868('0x1'));var timeout=require(_0x7868('0x2'));var express=require(_0x7868('0x3'));var router=express[_0x7868('0x4')]();var fs_extra=require(_0x7868('0x5'));var auth=require(_0x7868('0x6'));var interaction=require(_0x7868('0x7'));var config=require(_0x7868('0x8'));var controller=require('./voiceExtension.controller');router[_0x7868('0x9')]('/',auth[_0x7868('0xa')](),controller[_0x7868('0xb')]);router[_0x7868('0x9')]('/:id',auth[_0x7868('0xa')](),controller['show']);router[_0x7868('0xc')]('/',auth[_0x7868('0xa')](),controller[_0x7868('0xd')]);router[_0x7868('0xc')](_0x7868('0xe'),auth[_0x7868('0xa')](),controller[_0x7868('0xf')]);router[_0x7868('0x10')](_0x7868('0x11'),auth[_0x7868('0xa')](),controller[_0x7868('0x12')]);router['delete'](_0x7868('0x11'),auth['isAuthenticated'](),controller[_0x7868('0x13')]);module[_0x7868('0x14')]=router; \ No newline at end of file +var _0xe2a4=['show','post','isAuthenticated','create','/:id/applications','addApplications','put','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','/:id'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0xe2a4,0x139));var _0x4e2a=function(_0x470f24,_0x2436a9){_0x470f24=_0x470f24-0x0;var _0x2c6fc8=_0xe2a4[_0x470f24];return _0x2c6fc8;};'use strict';var multer=require('multer');var util=require(_0x4e2a('0x0'));var path=require(_0x4e2a('0x1'));var timeout=require(_0x4e2a('0x2'));var express=require(_0x4e2a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4e2a('0x4'));var interaction=require(_0x4e2a('0x5'));var config=require(_0x4e2a('0x6'));var controller=require(_0x4e2a('0x7'));router[_0x4e2a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4e2a('0x8')](_0x4e2a('0x9'),auth['isAuthenticated'](),controller[_0x4e2a('0xa')]);router[_0x4e2a('0xb')]('/',auth[_0x4e2a('0xc')](),controller[_0x4e2a('0xd')]);router[_0x4e2a('0xb')](_0x4e2a('0xe'),auth[_0x4e2a('0xc')](),controller[_0x4e2a('0xf')]);router[_0x4e2a('0x10')]('/:id',auth[_0x4e2a('0xc')](),controller['update']);router[_0x4e2a('0x11')](_0x4e2a('0x9'),auth[_0x4e2a('0xc')](),controller['destroy']);module[_0x4e2a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 0c10da6..3e1ca28 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 _0x07a7=['NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','STRING','compositeIndex'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x07a7,0x12f));var _0x707a=function(_0x120bb1,_0x495dbf){_0x120bb1=_0x120bb1-0x0;var _0x32f596=_0x07a7[_0x120bb1];return _0x32f596;};'use strict';var Sequelize=require(_0x707a('0x0'));module['exports']={'context':{'type':Sequelize[_0x707a('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x707a('0x1')],'allowNull':![],'unique':_0x707a('0x2')},'priority':{'type':Sequelize[_0x707a('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x707a('0x2')},'tag':{'type':Sequelize[_0x707a('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x707a('0x3')},'appdata':{'type':Sequelize[_0x707a('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x707a('0x4')](_0x707a('0x5'),_0x707a('0x6'),_0x707a('0x7'),_0x707a('0x8'),_0x707a('0x9'),'system',_0x707a('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x707a('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x707a('0xb')},'IntervalId':{'type':Sequelize[_0x707a('0xc')]},'isApp':{'type':Sequelize[_0x707a('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x707a('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x707a('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x707a('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x707a('0xc')]},'recordingFormat':{'type':Sequelize[_0x707a('0x1')],'defaultValue':_0x707a('0xe')},'answer':{'type':Sequelize[_0x707a('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x707a('0xf')],'get':function(_0x4531f4){return this[_0x707a('0x10')]('exten');}},'alias':{'type':Sequelize[_0x707a('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xac9b=['getDataValue','exten','STRING','compositeIndex','NoOp','ENUM','outbound','internal','outbound-fax','system','any','INTEGER','BOOLEAN','VIRTUAL'];(function(_0xdcda3,_0x4252fb){var _0x2bec82=function(_0x589fe2){while(--_0x589fe2){_0xdcda3['push'](_0xdcda3['shift']());}};_0x2bec82(++_0x4252fb);}(_0xac9b,0x64));var _0xbac9=function(_0x37ded3,_0x371ebb){_0x37ded3=_0x37ded3-0x0;var _0x51e49e=_0xac9b[_0x37ded3];return _0x51e49e;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0xbac9('0x0')],'allowNull':![],'unique':_0xbac9('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xbac9('0x0')],'allowNull':![],'unique':_0xbac9('0x1')},'priority':{'type':Sequelize[_0xbac9('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xbac9('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xbac9('0x0')],'allowNull':![],'defaultValue':_0xbac9('0x2')},'appdata':{'type':Sequelize[_0xbac9('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xbac9('0x3')]('inbound',_0xbac9('0x4'),_0xbac9('0x5'),'inbound-fax',_0xbac9('0x6'),_0xbac9('0x7'),_0xbac9('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0xbac9('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xbac9('0x9')]},'isApp':{'type':Sequelize[_0xbac9('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xbac9('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0xbac9('0x0')],'allowNull':!![]},'record':{'type':Sequelize[_0xbac9('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xbac9('0x0')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xbac9('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0xbac9('0xb')],'get':function(_0x467c9c){return this[_0xbac9('0xc')](_0xbac9('0xd'));}},'alias':{'type':Sequelize[_0xbac9('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 44d36ad..c8cc74b 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 _0x5652=['inbound','OutboundRoutes','outbound','internal','filter','ignore','map','value','includes','type','name','UserProfileResource','then','stack','send','index','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','options','VoiceExtension','includeAll','include','findAll','rows','params','rawAttributes','merge','find','catch','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','InboundRoutes'];(function(_0x572710,_0x19a5fb){var _0x5cacb9=function(_0x429098){while(--_0x429098){_0x572710['push'](_0x572710['shift']());}};_0x5cacb9(++_0x19a5fb);}(_0x5652,0x15f));var _0x2565=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x5652[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x2565('0x0'));var Redis=require(_0x2565('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x2565('0x2'))(_0x2565('0x3'));var config=require(_0x2565('0x4'));var db=require(_0x2565('0x5'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2565('0x6'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x2565('0x7')](socket);function respondWithStatusCode(_0x5b294d,_0x5c1ce1){_0x5c1ce1=_0x5c1ce1||0xcc;return function(_0x37bc95){if(_0x37bc95){return _0x5b294d[_0x2565('0x8')](_0x5c1ce1);}return _0x5b294d[_0x2565('0x9')](_0x5c1ce1)[_0x2565('0xa')]();};}function respondWithResult(_0x3e4149,_0xe29cad){_0xe29cad=_0xe29cad||0xc8;return function(_0x30bc55){if(_0x30bc55){return _0x3e4149[_0x2565('0x9')](_0xe29cad)[_0x2565('0xb')](_0x30bc55);}};}function respondWithFilteredResult(_0x35ca14,_0xf50371){return function(_0x513f83){if(_0x513f83){var _0x5428a0=typeof _0xf50371[_0x2565('0xc')]===_0x2565('0xd')&&typeof _0xf50371[_0x2565('0xe')]===_0x2565('0xd');var _0x8eb173=_0x513f83['count'];var _0xd9e593=_0x5428a0?0x0:_0xf50371['offset'];var _0x5b3446=_0x5428a0?_0x513f83[_0x2565('0xf')]:_0xf50371[_0x2565('0xc')]+_0xf50371[_0x2565('0xe')];var _0x2b2cef;if(_0x5b3446>=_0x8eb173){_0x5b3446=_0x8eb173;_0x2b2cef=0xc8;}else{_0x2b2cef=0xce;}_0x35ca14[_0x2565('0x9')](_0x2b2cef);return _0x35ca14[_0x2565('0x10')](_0x2565('0x11'),_0xd9e593+'-'+_0x5b3446+'/'+_0x8eb173)[_0x2565('0xb')](_0x513f83);}return null;};}function removeEntity(_0x2ec815){return function(_0x260937){if(_0x260937){return _0x260937[_0x2565('0x12')]()['then'](function(){var _0x1a73e2=_0x260937[_0x2565('0x13')]({'plain':!![]});var _0x6305a2=[{'name':_0x2565('0x14'),'value':_0x2565('0x15'),'ignore':![]},{'name':_0x2565('0x16'),'value':_0x2565('0x17'),'ignore':![]},{'name':'InternalRoutes','value':_0x2565('0x18'),'ignore':![]}];var _0x5b3f69=_(_0x6305a2)[_0x2565('0x19')](_0x2565('0x1a'))[_0x2565('0x1b')](_0x2565('0x1c'))[_0x2565('0x1c')]();if(_[_0x2565('0x1d')](_0x5b3f69,_0x1a73e2[_0x2565('0x1e')])){return;}var _0x34f785=_['find'](_0x6305a2,[_0x2565('0x1c'),_0x1a73e2[_0x2565('0x1e')]])[_0x2565('0x1f')];return db[_0x2565('0x20')][_0x2565('0x12')]({'where':{'type':_0x34f785,'resourceId':_0x1a73e2['id']}})[_0x2565('0x21')](function(){return _0x260937;});})[_0x2565('0x21')](function(){_0x2ec815[_0x2565('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d61e4){return function(_0x2d92d1){if(!_0x2d92d1){_0x3d61e4[_0x2565('0x8')](0x194);}return _0x2d92d1;};}function handleError(_0x5da917,_0x4ebaaf){_0x4ebaaf=_0x4ebaaf||0x1f4;return function(_0x66238c){logger['error'](_0x66238c[_0x2565('0x22')]);if(_0x66238c['name']){delete _0x66238c['name'];}_0x5da917['status'](_0x4ebaaf)[_0x2565('0x23')](_0x66238c);};}exports[_0x2565('0x24')]=function(_0x45eb17,_0x16c434){var _0x128937={},_0x3cb4bb={},_0x263715={'count':0x0,'rows':[]};var _0x77fbc1=_['map'](db['VoiceExtension']['rawAttributes'],function(_0x5eba43){return{'name':_0x5eba43[_0x2565('0x25')],'type':_0x5eba43['type'][_0x2565('0x26')]};});_0x3cb4bb[_0x2565('0x27')]=_[_0x2565('0x1b')](_0x77fbc1,'name');_0x3cb4bb[_0x2565('0x28')]=_[_0x2565('0x29')](_0x45eb17[_0x2565('0x28')]);_0x3cb4bb[_0x2565('0x2a')]=_[_0x2565('0x2b')](_0x3cb4bb[_0x2565('0x27')],_0x3cb4bb[_0x2565('0x28')]);_0x128937['attributes']=_[_0x2565('0x2b')](_0x3cb4bb['model'],qs[_0x2565('0x2c')](_0x45eb17['query'][_0x2565('0x2c')]));_0x128937[_0x2565('0x2d')]=_0x128937[_0x2565('0x2d')][_0x2565('0x2e')]?_0x128937[_0x2565('0x2d')]:_0x3cb4bb[_0x2565('0x27')];if(!_0x45eb17[_0x2565('0x28')]['hasOwnProperty'](_0x2565('0x2f'))){_0x128937[_0x2565('0xe')]=qs[_0x2565('0xe')](_0x45eb17[_0x2565('0x28')]['limit']);_0x128937[_0x2565('0xc')]=qs[_0x2565('0xc')](_0x45eb17[_0x2565('0x28')][_0x2565('0xc')]);}_0x128937[_0x2565('0x30')]=qs[_0x2565('0x31')](_0x45eb17[_0x2565('0x28')][_0x2565('0x31')]);_0x128937[_0x2565('0x32')]=qs[_0x2565('0x2a')](_[_0x2565('0x33')](_0x45eb17[_0x2565('0x28')],_0x3cb4bb[_0x2565('0x2a')]),_0x77fbc1);if(_0x45eb17[_0x2565('0x28')]['filter']){_0x128937[_0x2565('0x32')]=_['merge'](_0x128937[_0x2565('0x32')],{'$or':_[_0x2565('0x1b')](_0x77fbc1,function(_0x10e8df){if(_0x10e8df[_0x2565('0x1e')]!=='VIRTUAL'){var _0x2c89d7={};_0x2c89d7[_0x10e8df[_0x2565('0x1f')]]={'$like':'%'+_0x45eb17['query'][_0x2565('0x19')]+'%'};return _0x2c89d7;}})});}_0x128937=_['merge']({},_0x128937,_0x45eb17[_0x2565('0x34')]);var _0x4bb140={'where':_0x128937['where']};return db[_0x2565('0x35')][_0x2565('0xf')](_0x4bb140)[_0x2565('0x21')](function(_0x1867b1){_0x263715[_0x2565('0xf')]=_0x1867b1;if(_0x45eb17[_0x2565('0x28')][_0x2565('0x36')]){_0x128937[_0x2565('0x37')]=[{'all':!![]}];}return db['VoiceExtension'][_0x2565('0x38')](_0x128937);})[_0x2565('0x21')](function(_0x5437ce){_0x263715[_0x2565('0x39')]=_0x5437ce;return _0x263715;})[_0x2565('0x21')](respondWithFilteredResult(_0x16c434,_0x128937))['catch'](handleError(_0x16c434,null));};exports['show']=function(_0x47ab8c,_0x34cb8c){var _0x23ca95={'raw':![],'where':{'id':_0x47ab8c[_0x2565('0x3a')]['id']}},_0x57952c={};_0x57952c[_0x2565('0x27')]=_['keys'](db[_0x2565('0x35')][_0x2565('0x3b')]);_0x57952c[_0x2565('0x28')]=_[_0x2565('0x29')](_0x47ab8c['query']);_0x57952c[_0x2565('0x2a')]=_[_0x2565('0x2b')](_0x57952c['model'],_0x57952c[_0x2565('0x28')]);_0x23ca95[_0x2565('0x2d')]=_[_0x2565('0x2b')](_0x57952c[_0x2565('0x27')],qs[_0x2565('0x2c')](_0x47ab8c[_0x2565('0x28')][_0x2565('0x2c')]));_0x23ca95[_0x2565('0x2d')]=_0x23ca95[_0x2565('0x2d')][_0x2565('0x2e')]?_0x23ca95[_0x2565('0x2d')]:_0x57952c[_0x2565('0x27')];if(_0x47ab8c[_0x2565('0x28')][_0x2565('0x36')]){_0x23ca95[_0x2565('0x37')]=[{'all':!![]}];}_0x23ca95=_[_0x2565('0x3c')]({},_0x23ca95,_0x47ab8c['options']);return db['VoiceExtension'][_0x2565('0x3d')](_0x23ca95)[_0x2565('0x21')](handleEntityNotFound(_0x34cb8c,null))[_0x2565('0x21')](respondWithResult(_0x34cb8c,null))[_0x2565('0x3e')](handleError(_0x34cb8c,null));};exports[_0x2565('0x12')]=function(_0x3ceefd,_0x2ce1d5){return db['VoiceExtension'][_0x2565('0x3d')]({'where':{'id':_0x3ceefd[_0x2565('0x3a')]['id']}})[_0x2565('0x21')](handleEntityNotFound(_0x2ce1d5,null))[_0x2565('0x21')](removeEntity(_0x2ce1d5,null))[_0x2565('0x3e')](handleError(_0x2ce1d5,null));};exports[_0x2565('0x3f')]=function(_0x29979b,_0x3e9701){if(_0x29979b[_0x2565('0x40')][_0x2565('0x1e')]===_0x2565('0x17')&&!_[_0x2565('0x41')](_0x29979b['body'][_0x2565('0x42')],'_')){_0x29979b[_0x2565('0x40')]['exten']='_'[_0x2565('0x43')](_0x29979b[_0x2565('0x40')][_0x2565('0x42')]);}return db[_0x2565('0x35')][_0x2565('0x3f')](_0x29979b[_0x2565('0x40')],{'raw':![]})[_0x2565('0x21')](function(_0x520eb4){var _0x292ec9=_0x29979b['user'][_0x2565('0x13')]({'plain':!![]});if(!_0x292ec9)throw new Error(_0x2565('0x44'));if(_0x292ec9['role']===_0x2565('0x45')){var _0x45f365=_0x520eb4[_0x2565('0x13')]({'plain':!![]});var _0x206987=[{'name':_0x2565('0x14'),'value':_0x2565('0x15')},{'name':_0x2565('0x16'),'value':_0x2565('0x17')},{'name':'InternalRoutes','value':'internal'}];var _0x1732ab=_['find'](_0x206987,['value',_0x45f365[_0x2565('0x1e')]])['name'];return db[_0x2565('0x46')]['find']({'where':{'name':_0x1732ab,'userProfileId':_0x292ec9[_0x2565('0x47')]},'raw':!![]})[_0x2565('0x21')](function(_0x17f3a5){if(_0x17f3a5&&_0x17f3a5[_0x2565('0x48')]===0x0){return db[_0x2565('0x20')][_0x2565('0x3f')]({'name':_0x45f365['name'],'resourceId':_0x45f365['id'],'type':_0x17f3a5[_0x2565('0x1f')],'sectionId':_0x17f3a5['id']},{})[_0x2565('0x21')](function(){return _0x520eb4;});}else{return _0x520eb4;}})[_0x2565('0x3e')](function(_0x2c316f){logger[_0x2565('0x49')](_0x2565('0x4a'),_0x2c316f);throw _0x2c316f;});}return _0x520eb4;})['then'](respondWithResult(_0x3e9701,0xc9))[_0x2565('0x3e')](handleError(_0x3e9701,null));};exports[_0x2565('0x4b')]=function(_0x36a98e,_0x11b1ee){if(_0x36a98e[_0x2565('0x40')]['id']){delete _0x36a98e[_0x2565('0x40')]['id'];}return db[_0x2565('0x35')][_0x2565('0x3d')]({'where':{'id':_0x36a98e[_0x2565('0x3a')]['id']}})[_0x2565('0x21')](handleEntityNotFound(_0x11b1ee,null))[_0x2565('0x21')](function(_0x3863da){if(_0x3863da){return db[_0x2565('0x35')][_0x2565('0x4b')](_[_0x2565('0x33')](_0x36a98e[_0x2565('0x40')],['exten',_0x2565('0x4c'),_0x2565('0x4d'),_0x2565('0x4e'),_0x2565('0x4f'),_0x2565('0x50'),'alias']),{'where':{'context':_0x3863da[_0x2565('0x4c')],'exten':_0x3863da[_0x2565('0x42')]},'individualHooks':!![]})['then'](function(_0x45c8ee){return _0x45c8ee;});}return null;})[_0x2565('0x21')](respondWithStatusCode(_0x11b1ee,null))[_0x2565('0x3e')](handleError(_0x11b1ee,null));};exports[_0x2565('0x51')]=function(_0x24599d,_0x2679ef){var _0x2c6da7=_0x24599d[_0x2565('0x3a')]['id'];var _0x102c62=_0x24599d[_0x2565('0x40')];var _0x3789f0=0xc8;var _0x21a487=null;return db['sequelize'][_0x2565('0x52')]({'isolationLevel':db[_0x2565('0x53')][_0x2565('0x54')][_0x2565('0x55')][_0x2565('0x56')]},function(_0x45ad56){return db[_0x2565('0x35')][_0x2565('0x57')]({'where':{'id':_0x2c6da7},'transaction':_0x45ad56})[_0x2565('0x21')](function(_0x3e95dd){if(_0x3e95dd){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x2c6da7},'transaction':_0x45ad56})[_0x2565('0x21')](function(){var _0x2bd0cc=_[_0x2565('0x1b')](_0x102c62,function(_0x3a7efc){_0x3a7efc['VoiceExtensionId']=_0x2c6da7;_0x3a7efc[_0x2565('0x58')]=!![];return _0x3a7efc;});return _0x3e95dd['createRouting'](_0x2bd0cc);})[_0x2565('0x21')](function(_0x4213e3){return db[_0x2565('0x35')][_0x2565('0x59')](_0x4213e3,{'transaction':_0x45ad56});});}else{_0x3789f0=0x194;_0x21a487=[];}});})['then'](function(){if(_0x3789f0!==0x194){return db['VoiceExtension'][_0x2565('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2c6da7},'order':_0x2565('0x5b')})['then'](function(_0x31e486){_0x21a487=_0x31e486;});}})[_0x2565('0x3e')](function(_0x1bca91){_0x3789f0=0x1f4;logger[_0x2565('0x49')](_0x1bca91[_0x2565('0x22')]);if(_0x1bca91[_0x2565('0x1f')]){delete _0x1bca91[_0x2565('0x1f')];}_0x21a487=_0x1bca91;})[_0x2565('0x5c')](function(){if(_0x21a487===null){_0x2679ef[_0x2565('0x8')](_0x3789f0);}else{if(_0x3789f0===0x1f4){_0x2679ef['status'](_0x3789f0)[_0x2565('0x23')](_0x21a487);}else{_0x2679ef[_0x2565('0x9')](_0x3789f0)[_0x2565('0xb')](_0x21a487);}}});}; \ No newline at end of file +var _0x9443=['InboundRoutes','OutboundRoutes','InternalRoutes','filter','ignore','value','type','UserProfileResource','error','name','send','index','map','VoiceExtension','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','order','sort','where','filters','pick','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','params','create','outbound','body','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','internal','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','recordingFormat','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','stack','finally','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','destroy','then','get'];(function(_0x5bfbcc,_0x11fdaf){var _0x2bccc5=function(_0x4d09b5){while(--_0x4d09b5){_0x5bfbcc['push'](_0x5bfbcc['shift']());}};_0x2bccc5(++_0x11fdaf);}(_0x9443,0x9e));var _0x3944=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x9443[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require('lodash');var Redis=require(_0x3944('0x0'));var qs=require(_0x3944('0x1'));var logger=require(_0x3944('0x2'))(_0x3944('0x3'));var config=require('../../config/environment');var db=require(_0x3944('0x4'))['db'];config[_0x3944('0x5')]=_[_0x3944('0x6')](config[_0x3944('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x3944('0x7'))(new Redis(config[_0x3944('0x5')]));require(_0x3944('0x8'))[_0x3944('0x9')](socket);function respondWithStatusCode(_0x223196,_0x373d47){_0x373d47=_0x373d47||0xcc;return function(_0x227f1c){if(_0x227f1c){return _0x223196[_0x3944('0xa')](_0x373d47);}return _0x223196['status'](_0x373d47)[_0x3944('0xb')]();};}function respondWithResult(_0xe8eca8,_0x335497){_0x335497=_0x335497||0xc8;return function(_0x43ae86){if(_0x43ae86){return _0xe8eca8[_0x3944('0xc')](_0x335497)[_0x3944('0xd')](_0x43ae86);}};}function respondWithFilteredResult(_0x5b11d7,_0x402342){return function(_0xf57349){if(_0xf57349){var _0x114a7d=typeof _0x402342[_0x3944('0xe')]===_0x3944('0xf')&&typeof _0x402342[_0x3944('0x10')]===_0x3944('0xf');var _0x7a3b6f=_0xf57349['count'];var _0x282a38=_0x114a7d?0x0:_0x402342[_0x3944('0xe')];var _0x3eb740=_0x114a7d?_0xf57349[_0x3944('0x11')]:_0x402342[_0x3944('0xe')]+_0x402342[_0x3944('0x10')];var _0xd43efb;if(_0x3eb740>=_0x7a3b6f){_0x3eb740=_0x7a3b6f;_0xd43efb=0xc8;}else{_0xd43efb=0xce;}_0x5b11d7[_0x3944('0xc')](_0xd43efb);return _0x5b11d7['set'](_0x3944('0x12'),_0x282a38+'-'+_0x3eb740+'/'+_0x7a3b6f)['json'](_0xf57349);}return null;};}function removeEntity(_0x51706d){return function(_0x1614bb){if(_0x1614bb){return _0x1614bb[_0x3944('0x13')]()[_0x3944('0x14')](function(){var _0x9592d9=_0x1614bb[_0x3944('0x15')]({'plain':!![]});var _0x54b7d6=[{'name':_0x3944('0x16'),'value':'inbound','ignore':![]},{'name':_0x3944('0x17'),'value':'outbound','ignore':![]},{'name':_0x3944('0x18'),'value':'internal','ignore':![]}];var _0x3d1dc0=_(_0x54b7d6)[_0x3944('0x19')](_0x3944('0x1a'))['map'](_0x3944('0x1b'))[_0x3944('0x1b')]();if(_['includes'](_0x3d1dc0,_0x9592d9[_0x3944('0x1c')])){return;}var _0x5d56d7=_['find'](_0x54b7d6,[_0x3944('0x1b'),_0x9592d9[_0x3944('0x1c')]])['name'];return db[_0x3944('0x1d')]['destroy']({'where':{'type':_0x5d56d7,'resourceId':_0x9592d9['id']}})['then'](function(){return _0x1614bb;});})[_0x3944('0x14')](function(){_0x51706d['status'](0xcc)[_0x3944('0xb')]();});}};}function handleEntityNotFound(_0x3a06ce){return function(_0x3c72f7){if(!_0x3c72f7){_0x3a06ce[_0x3944('0xa')](0x194);}return _0x3c72f7;};}function handleError(_0x4bcb59,_0x4bb4a9){_0x4bb4a9=_0x4bb4a9||0x1f4;return function(_0x3de429){logger[_0x3944('0x1e')](_0x3de429['stack']);if(_0x3de429[_0x3944('0x1f')]){delete _0x3de429[_0x3944('0x1f')];}_0x4bcb59['status'](_0x4bb4a9)[_0x3944('0x20')](_0x3de429);};}exports[_0x3944('0x21')]=function(_0x3fc2ac,_0x1e6b44){var _0xfd9671={},_0x2c47b7={},_0x53b460={'count':0x0,'rows':[]};var _0x577036=_[_0x3944('0x22')](db[_0x3944('0x23')][_0x3944('0x24')],function(_0x36ff5c){return{'name':_0x36ff5c[_0x3944('0x25')],'type':_0x36ff5c['type']['key']};});_0x2c47b7[_0x3944('0x26')]=_[_0x3944('0x22')](_0x577036,'name');_0x2c47b7['query']=_['keys'](_0x3fc2ac[_0x3944('0x27')]);_0x2c47b7['filters']=_[_0x3944('0x28')](_0x2c47b7[_0x3944('0x26')],_0x2c47b7[_0x3944('0x27')]);_0xfd9671[_0x3944('0x29')]=_[_0x3944('0x28')](_0x2c47b7[_0x3944('0x26')],qs[_0x3944('0x2a')](_0x3fc2ac['query']['fields']));_0xfd9671['attributes']=_0xfd9671[_0x3944('0x29')][_0x3944('0x2b')]?_0xfd9671[_0x3944('0x29')]:_0x2c47b7[_0x3944('0x26')];if(!_0x3fc2ac[_0x3944('0x27')]['hasOwnProperty']('nolimit')){_0xfd9671['limit']=qs['limit'](_0x3fc2ac[_0x3944('0x27')]['limit']);_0xfd9671[_0x3944('0xe')]=qs[_0x3944('0xe')](_0x3fc2ac[_0x3944('0x27')][_0x3944('0xe')]);}_0xfd9671[_0x3944('0x2c')]=qs[_0x3944('0x2d')](_0x3fc2ac[_0x3944('0x27')][_0x3944('0x2d')]);_0xfd9671[_0x3944('0x2e')]=qs[_0x3944('0x2f')](_[_0x3944('0x30')](_0x3fc2ac[_0x3944('0x27')],_0x2c47b7[_0x3944('0x2f')]),_0x577036);if(_0x3fc2ac[_0x3944('0x27')][_0x3944('0x19')]){_0xfd9671[_0x3944('0x2e')]=_[_0x3944('0x31')](_0xfd9671['where'],{'$or':_['map'](_0x577036,function(_0x1bf872){if(_0x1bf872[_0x3944('0x1c')]!=='VIRTUAL'){var _0x30727e={};_0x30727e[_0x1bf872[_0x3944('0x1f')]]={'$like':'%'+_0x3fc2ac[_0x3944('0x27')]['filter']+'%'};return _0x30727e;}})});}_0xfd9671=_[_0x3944('0x31')]({},_0xfd9671,_0x3fc2ac[_0x3944('0x32')]);var _0x323d48={'where':_0xfd9671[_0x3944('0x2e')]};return db['VoiceExtension'][_0x3944('0x11')](_0x323d48)[_0x3944('0x14')](function(_0xe9f66f){_0x53b460['count']=_0xe9f66f;if(_0x3fc2ac[_0x3944('0x27')][_0x3944('0x33')]){_0xfd9671[_0x3944('0x34')]=[{'all':!![]}];}return db[_0x3944('0x23')][_0x3944('0x35')](_0xfd9671);})[_0x3944('0x14')](function(_0xf33cd5){_0x53b460[_0x3944('0x36')]=_0xf33cd5;return _0x53b460;})[_0x3944('0x14')](respondWithFilteredResult(_0x1e6b44,_0xfd9671))[_0x3944('0x37')](handleError(_0x1e6b44,null));};exports[_0x3944('0x38')]=function(_0x90d5fd,_0x13f74a){var _0x43943b={'raw':![],'where':{'id':_0x90d5fd['params']['id']}},_0x229de3={};_0x229de3[_0x3944('0x26')]=_[_0x3944('0x39')](db[_0x3944('0x23')][_0x3944('0x24')]);_0x229de3['query']=_[_0x3944('0x39')](_0x90d5fd[_0x3944('0x27')]);_0x229de3[_0x3944('0x2f')]=_[_0x3944('0x28')](_0x229de3['model'],_0x229de3[_0x3944('0x27')]);_0x43943b[_0x3944('0x29')]=_['intersection'](_0x229de3['model'],qs[_0x3944('0x2a')](_0x90d5fd['query'][_0x3944('0x2a')]));_0x43943b[_0x3944('0x29')]=_0x43943b[_0x3944('0x29')]['length']?_0x43943b['attributes']:_0x229de3[_0x3944('0x26')];if(_0x90d5fd[_0x3944('0x27')]['includeAll']){_0x43943b['include']=[{'all':!![]}];}_0x43943b=_[_0x3944('0x31')]({},_0x43943b,_0x90d5fd[_0x3944('0x32')]);return db[_0x3944('0x23')]['find'](_0x43943b)[_0x3944('0x14')](handleEntityNotFound(_0x13f74a,null))['then'](respondWithResult(_0x13f74a,null))[_0x3944('0x37')](handleError(_0x13f74a,null));};exports[_0x3944('0x13')]=function(_0x216e7f,_0x3a44bf){return db[_0x3944('0x23')][_0x3944('0x3a')]({'where':{'id':_0x216e7f[_0x3944('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3a44bf,null))[_0x3944('0x14')](removeEntity(_0x3a44bf,null))[_0x3944('0x37')](handleError(_0x3a44bf,null));};exports[_0x3944('0x3c')]=function(_0x37c62f,_0x31331e){if(_0x37c62f['body'][_0x3944('0x1c')]===_0x3944('0x3d')&&!_['startsWith'](_0x37c62f[_0x3944('0x3e')]['exten'],'_')){_0x37c62f['body'][_0x3944('0x3f')]='_'[_0x3944('0x40')](_0x37c62f[_0x3944('0x3e')][_0x3944('0x3f')]);}return db[_0x3944('0x23')][_0x3944('0x3c')](_0x37c62f['body'],{'raw':![]})[_0x3944('0x14')](function(_0x485c5b){var _0xa110a7=_0x37c62f['user']['get']({'plain':!![]});if(!_0xa110a7)throw new Error(_0x3944('0x41'));if(_0xa110a7['role']==='user'){var _0x38c6d8=_0x485c5b['get']({'plain':!![]});var _0x51806f=[{'name':_0x3944('0x16'),'value':_0x3944('0x42')},{'name':_0x3944('0x17'),'value':_0x3944('0x3d')},{'name':_0x3944('0x18'),'value':_0x3944('0x43')}];var _0x4aeeb9=_['find'](_0x51806f,['value',_0x38c6d8['type']])['name'];return db[_0x3944('0x44')][_0x3944('0x3a')]({'where':{'name':_0x4aeeb9,'userProfileId':_0xa110a7[_0x3944('0x45')]},'raw':!![]})['then'](function(_0x222e0e){if(_0x222e0e&&_0x222e0e['autoAssociation']===0x0){return db[_0x3944('0x1d')][_0x3944('0x3c')]({'name':_0x38c6d8[_0x3944('0x1f')],'resourceId':_0x38c6d8['id'],'type':_0x222e0e[_0x3944('0x1f')],'sectionId':_0x222e0e['id']},{})[_0x3944('0x14')](function(){return _0x485c5b;});}else{return _0x485c5b;}})[_0x3944('0x37')](function(_0x5cfeb7){logger['error'](_0x3944('0x46'),_0x5cfeb7);throw _0x5cfeb7;});}return _0x485c5b;})[_0x3944('0x14')](respondWithResult(_0x31331e,0xc9))[_0x3944('0x37')](handleError(_0x31331e,null));};exports[_0x3944('0x47')]=function(_0x9e85af,_0x24b894){if(_0x9e85af['body']['id']){delete _0x9e85af[_0x3944('0x3e')]['id'];}return db[_0x3944('0x23')][_0x3944('0x3a')]({'where':{'id':_0x9e85af['params']['id']}})['then'](handleEntityNotFound(_0x24b894,null))[_0x3944('0x14')](function(_0x4efe65){if(_0x4efe65){return db[_0x3944('0x23')][_0x3944('0x47')](_[_0x3944('0x30')](_0x9e85af['body'],[_0x3944('0x3f'),'context','description',_0x3944('0x48'),'cutdigits',_0x3944('0x49'),_0x3944('0x4a')]),{'where':{'context':_0x4efe65[_0x3944('0x4b')],'exten':_0x4efe65['exten']},'individualHooks':!![]})[_0x3944('0x14')](function(_0x67f108){return _0x67f108;});}return null;})[_0x3944('0x14')](respondWithStatusCode(_0x24b894,null))[_0x3944('0x37')](handleError(_0x24b894,null));};exports[_0x3944('0x4c')]=function(_0xf9ac79,_0x17b14c){var _0x3f80a8=_0xf9ac79['params']['id'];var _0x45ff6c=_0xf9ac79['body'];var _0x4fede8=0xc8;var _0x129bb8=null;return db[_0x3944('0x4d')][_0x3944('0x4e')]({'isolationLevel':db[_0x3944('0x4d')][_0x3944('0x4f')][_0x3944('0x50')][_0x3944('0x51')]},function(_0x1d3acd){return db['VoiceExtension'][_0x3944('0x52')]({'where':{'id':_0x3f80a8},'transaction':_0x1d3acd})[_0x3944('0x14')](function(_0x5ffaf1){if(_0x5ffaf1){return db[_0x3944('0x23')][_0x3944('0x13')]({'where':{'VoiceExtensionId':_0x3f80a8},'transaction':_0x1d3acd})[_0x3944('0x14')](function(){var _0x5244eb=_['map'](_0x45ff6c,function(_0x88ca8d){_0x88ca8d[_0x3944('0x53')]=_0x3f80a8;_0x88ca8d[_0x3944('0x54')]=!![];return _0x88ca8d;});return _0x5ffaf1[_0x3944('0x55')](_0x5244eb);})['then'](function(_0x3e263c){return db[_0x3944('0x23')][_0x3944('0x56')](_0x3e263c,{'transaction':_0x1d3acd});});}else{_0x4fede8=0x194;_0x129bb8=[];}});})['then'](function(){if(_0x4fede8!==0x194){return db[_0x3944('0x23')][_0x3944('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3f80a8},'order':'cast(priority\x20as\x20unsigned)'})[_0x3944('0x14')](function(_0x22b1f4){_0x129bb8=_0x22b1f4;});}})[_0x3944('0x37')](function(_0x95bed){_0x4fede8=0x1f4;logger[_0x3944('0x1e')](_0x95bed[_0x3944('0x58')]);if(_0x95bed[_0x3944('0x1f')]){delete _0x95bed[_0x3944('0x1f')];}_0x129bb8=_0x95bed;})[_0x3944('0x59')](function(){if(_0x129bb8===null){_0x17b14c['sendStatus'](_0x4fede8);}else{if(_0x4fede8===0x1f4){_0x17b14c['status'](_0x4fede8)[_0x3944('0x20')](_0x129bb8);}else{_0x17b14c[_0x3944('0xc')](_0x4fede8)[_0x3944('0xd')](_0x129bb8);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 11abf52..f2c0266 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 _0x6bfc=['../../mysqldb','VoiceExtension','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x93ce50,_0x115c03){var _0x388c16=function(_0x44ae8a){while(--_0x44ae8a){_0x93ce50['push'](_0x93ce50['shift']());}};_0x388c16(++_0x115c03);}(_0x6bfc,0x194));var _0xc6bf=function(_0x36926a,_0x37ab96){_0x36926a=_0x36926a-0x0;var _0xda5af2=_0x6bfc[_0x36926a];return _0xda5af2;};'use strict';var EventEmitter=require(_0xc6bf('0x0'));var VoiceExtension=require(_0xc6bf('0x1'))['db'][_0xc6bf('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc6bf('0x3'),'afterUpdate':_0xc6bf('0x4'),'afterDestroy':_0xc6bf('0x5')};function emitEvent(_0x2b5dc8){return function(_0x5d3a03,_0x79b1a4,_0xecb220){VoiceExtensionEvents[_0xc6bf('0x6')](_0x2b5dc8+':'+_0x5d3a03['id'],_0x5d3a03);VoiceExtensionEvents[_0xc6bf('0x6')](_0x2b5dc8,_0x5d3a03);_0xecb220(null);};}for(var e in events){if(events[_0xc6bf('0x7')](e)){var event=events[e];VoiceExtension[_0xc6bf('0x8')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x110c=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','update'];(function(_0x1e58a8,_0x58717f){var _0x4a4c93=function(_0x4b8c19){while(--_0x4b8c19){_0x1e58a8['push'](_0x1e58a8['shift']());}};_0x4a4c93(++_0x58717f);}(_0x110c,0x1bc));var _0xc110=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x110c[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0xc110('0x0'));var VoiceExtension=require(_0xc110('0x1'))['db'][_0xc110('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc110('0x3'),'afterDestroy':_0xc110('0x4')};function emitEvent(_0x5c6867){return function(_0x469328,_0x13c301,_0x3654ed){VoiceExtensionEvents[_0xc110('0x5')](_0x5c6867+':'+_0x469328['id'],_0x469328);VoiceExtensionEvents[_0xc110('0x5')](_0x5c6867,_0x469328);_0x3654ed(null);};}for(var e in events){if(events[_0xc110('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xc110('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 11f72e4..ad44c82 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 _0x7c09=['toLowerCase','tag','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','outboundDial','appdata','priority','concat','last','catch','define','./voiceExtension.attributes','exports','models','type','context','exten','alias','Set','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','length','name','param','phone','prefix','join','indexOf','U(xcally-mixmonitor-context)','replace','findAll','then','interval','*,*,*,*','intervals','IntervalId','map','filter'];(function(_0xb725be,_0x45bd01){var _0x2f2424=function(_0x2566ca){while(--_0x2566ca){_0xb725be['push'](_0xb725be['shift']());}};_0x2f2424(++_0x45bd01);}(_0x7c09,0x102));var _0x97c0=function(_0x5e23fe,_0x3e51b8){_0x5e23fe=_0x5e23fe-0x0;var _0x31ddd1=_0x7c09[_0x5e23fe];return _0x31ddd1;};'use strict';var _=require('lodash');var attributes=require(_0x97c0('0x0'));module[_0x97c0('0x1')]=function(_0x53ad71){var _0xfbf689=_0x53ad71[_0x97c0('0x2')];function _0x2d04b9(_0x214897){var _0x12eb6d=0x2;var _0x99bf54=[{'type':_0x214897[_0x97c0('0x3')],'app':'Set','appdata':'CDR(type)='+_0x214897['type'],'context':_0x214897[_0x97c0('0x4')],'exten':_0x214897[_0x97c0('0x5')],'priority':_0x12eb6d++,'VoiceExtensionId':_0x214897['id']},{'type':_0x214897[_0x97c0('0x3')],'app':_0x214897[_0x97c0('0x6')]?_0x97c0('0x7'):'NoOp','appdata':_0x214897[_0x97c0('0x6')]?'CDR(routeAlias)='+_0x214897[_0x97c0('0x6')]:_0x97c0('0x8'),'context':_0x214897['context'],'exten':_0x214897['exten'],'priority':_0x12eb6d++,'VoiceExtensionId':_0x214897['id']}];if(_0x214897[_0x97c0('0x3')]===_0x97c0('0x9')){_0x99bf54[_0x97c0('0xa')]({'type':_0x97c0('0x9'),'app':_0x97c0('0x7'),'appdata':_0x97c0('0xb')+_0x214897['id'],'context':_0x214897[_0x97c0('0x4')],'exten':_0x214897[_0x97c0('0x5')],'priority':_0x12eb6d++,'VoiceExtensionId':_0x214897['id']});}_0x99bf54[_0x97c0('0xa')]({'type':_0x214897[_0x97c0('0x3')],'app':_0x97c0('0x7'),'appdata':_0x97c0('0xc'),'context':_0x214897[_0x97c0('0x4')],'exten':_0x214897['exten'],'priority':_0x12eb6d++,'VoiceExtensionId':_0x214897['id']},{'type':_0x214897[_0x97c0('0x3')],'app':_0x97c0('0x7'),'appdata':_0x97c0('0xd'),'context':_0x214897['context'],'exten':_0x214897[_0x97c0('0x5')],'priority':_0x12eb6d++,'VoiceExtensionId':_0x214897['id']},{'type':_0x214897[_0x97c0('0x3')],'app':_0x97c0('0x7'),'appdata':_0x97c0('0xe'),'context':_0x214897[_0x97c0('0x4')],'exten':_0x214897[_0x97c0('0x5')],'priority':_0x12eb6d++,'VoiceExtensionId':_0x214897['id']});return _0x99bf54;}function _0x49c0d9(_0x16fea6){var _0x3ae7c4=0x2;var _0x51180e=[{'type':_0x97c0('0xf'),'app':_0x97c0('0x7'),'appdata':_0x97c0('0x10'),'context':_0x16fea6[_0x97c0('0x4')],'exten':_0x16fea6[_0x97c0('0x5')],'priority':_0x3ae7c4++,'VoiceExtensionId':_0x16fea6['id']},{'type':_0x97c0('0xf'),'app':_0x16fea6[_0x97c0('0x6')]?_0x97c0('0x7'):_0x97c0('0x11'),'appdata':_0x16fea6[_0x97c0('0x6')]?'CDR(routeAlias)='+_0x16fea6['alias']:_0x97c0('0x8'),'context':_0x16fea6[_0x97c0('0x4')],'exten':_0x16fea6[_0x97c0('0x5')],'priority':_0x3ae7c4++,'VoiceExtensionId':_0x16fea6['id']},{'type':'outbound','app':_0x97c0('0x7'),'appdata':_0x97c0('0x12')+(_0x16fea6[_0x97c0('0x13')]?_0x97c0('0x14')+_0x16fea6[_0x97c0('0x13')]+'}':_0x97c0('0x15')),'context':_0x16fea6[_0x97c0('0x4')],'exten':_0x16fea6['exten'],'priority':_0x3ae7c4++,'VoiceExtensionId':_0x16fea6['id']},{'type':_0x97c0('0xf'),'app':_0x97c0('0x7'),'appdata':_0x97c0('0xb')+_0x16fea6['id'],'context':_0x16fea6[_0x97c0('0x4')],'exten':_0x16fea6['exten'],'priority':_0x3ae7c4++,'VoiceExtensionId':_0x16fea6['id']},{'type':_0x97c0('0xf'),'app':_0x97c0('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3ae7c4+0x2)+_0x97c0('0x17')+(_0x3ae7c4+0x1)+')','context':_0x16fea6[_0x97c0('0x4')],'exten':_0x16fea6[_0x97c0('0x5')],'priority':_0x3ae7c4++,'VoiceExtensionId':_0x16fea6['id']},{'type':'outbound','app':'Set','appdata':_0x16fea6['cutdigits']?_0x97c0('0x18')+_0x16fea6[_0x97c0('0x13')]+'}':_0x97c0('0x19'),'context':_0x16fea6[_0x97c0('0x4')],'exten':_0x16fea6[_0x97c0('0x5')],'priority':_0x3ae7c4++,'VoiceExtensionId':_0x16fea6['id']},{'type':_0x97c0('0xf'),'app':'Set','appdata':_0x97c0('0xc'),'context':_0x16fea6[_0x97c0('0x4')],'exten':_0x16fea6[_0x97c0('0x5')],'priority':_0x3ae7c4++,'VoiceExtensionId':_0x16fea6['id']},{'type':'outbound','app':_0x97c0('0x7'),'appdata':_0x97c0('0xd'),'context':_0x16fea6[_0x97c0('0x4')],'exten':_0x16fea6[_0x97c0('0x5')],'priority':_0x3ae7c4++,'VoiceExtensionId':_0x16fea6['id']},{'type':_0x97c0('0xf'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x16fea6[_0x97c0('0x4')],'exten':_0x16fea6[_0x97c0('0x5')],'priority':_0x3ae7c4++,'VoiceExtensionId':_0x16fea6['id']},{'type':_0x97c0('0xf'),'app':'Set','appdata':_0x97c0('0x1a')+_0x16fea6['id'],'context':_0x16fea6[_0x97c0('0x4')],'exten':_0x16fea6['exten'],'priority':_0x3ae7c4++,'VoiceExtensionId':_0x16fea6['id']}];if(_0x16fea6[_0x97c0('0x1b')](_0x97c0('0x1c'))&&_0x16fea6[_0x97c0('0x1c')]!==_0x97c0('0x1d')){_0x51180e[_0x97c0('0xa')]({'type':_0x97c0('0xf'),'app':_0x97c0('0x7'),'appdata':_0x97c0('0x1e'),'context':_0x16fea6[_0x97c0('0x4')],'exten':_0x16fea6[_0x97c0('0x5')],'priority':_0x3ae7c4++,'VoiceExtensionId':_0x16fea6['id']},{'type':_0x97c0('0xf'),'app':_0x97c0('0x7'),'appdata':_0x97c0('0x1f')+_0x16fea6[_0x97c0('0x1c')]||_0x97c0('0x20'),'context':_0x16fea6['context'],'exten':_0x16fea6[_0x97c0('0x5')],'priority':_0x3ae7c4++,'VoiceExtensionId':_0x16fea6['id']});}return _0x51180e;}function _0x1548b6(_0x2b7f9a,_0x30db7a){var _0x325eb9=[{'name':_0x97c0('0x21'),'param':0x0},{'name':_0x97c0('0x22'),'param':0x1},{'name':_0x97c0('0x23'),'param':0x2},{'name':'url','param':0x3}];var _0xd72d47={};var _0x4bf42a=_0x30db7a[_0x97c0('0x24')](',');var _0x20291=[];for(var _0xc4c795=0x0;_0xc4c795<_0x325eb9[_0x97c0('0x25')];_0xc4c795++){switch(_0x325eb9[_0xc4c795][_0x97c0('0x26')]){case _0x97c0('0x21'):_0xd72d47[_0x97c0('0x21')]=_0x4bf42a[_0x325eb9[_0xc4c795][_0x97c0('0x27')]][_0x97c0('0x24')]('/')[0x1];_0xd72d47[_0x97c0('0x28')]=_0x4bf42a[_0x325eb9[_0xc4c795][_0x97c0('0x27')]]['split']('/')[0x2];_0xd72d47[_0x97c0('0x29')]=_0xd72d47[_0x97c0('0x28')]?_0xd72d47['phone'][_0x97c0('0x24')]('$')[0x0]:undefined;_0xd72d47[_0x97c0('0x28')]=_0x2b7f9a[_0x97c0('0x13')]?(_0xd72d47[_0x97c0('0x29')]||'')+'${EXTEN:'+_0x2b7f9a[_0x97c0('0x13')]+'}':(_0xd72d47['prefix']||'')+_0x97c0('0x15');_0x20291[_0x325eb9[_0xc4c795][_0x97c0('0x27')]]=['SIP',_0xd72d47[_0x97c0('0x21')],_0xd72d47[_0x97c0('0x28')]][_0x97c0('0x2a')]('/');break;case _0x97c0('0x23'):_0xd72d47[_0x97c0('0x23')]=_0x4bf42a[_0x325eb9[_0xc4c795][_0x97c0('0x27')]];if(_0x2b7f9a[_0x97c0('0x1c')]!==_0x97c0('0x1d')){if(_0xd72d47[_0x97c0('0x23')][_0x97c0('0x2b')](_0x97c0('0x2c'))<0x0){_0xd72d47[_0x97c0('0x23')]+=_0x97c0('0x2c');}}else{_0xd72d47['options']=_0xd72d47[_0x97c0('0x23')][_0x97c0('0x2d')](_0x97c0('0x2c'),'');}_0x20291[_0x325eb9[_0xc4c795][_0x97c0('0x27')]]=_0xd72d47[_0x97c0('0x23')];break;default:_0x20291[_0x325eb9[_0xc4c795][_0x97c0('0x27')]]=_0x4bf42a[_0x325eb9[_0xc4c795][_0x97c0('0x27')]];}}return _0x20291['join'](',');}function _0x51a0f5(_0x10ee7b,_0x3785a8,_0x2d625b){return new Promise(function(_0x16ff4e,_0x13549f){var _0x5556e8=[];if(_['isEmpty'](_0x3785a8))return _0x16ff4e(_0x5556e8);_0xfbf689['Interval'][_0x97c0('0x2e')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0x97c0('0x2f')](function(_0x2d3604){for(var _0x6959dc=0x0,_0x15e427=0x0;_0x6959dc<_0x3785a8[_0x97c0('0x25')];_0x6959dc++,_0x15e427=0x0){var _0x483656=_0x3785a8[_0x6959dc];var _0xc2059f=[];var _0x16f0fb=[];delete _0x483656['id'];if(_0x483656[_0x97c0('0x30')]!==_0x97c0('0x31')){_0x483656[_0x97c0('0x32')]=[_0x483656[_0x97c0('0x30')]];}else{_0x483656[_0x97c0('0x32')]=_0x483656[_0x97c0('0x33')]?_[_0x97c0('0x34')](_[_0x97c0('0x35')](_0x2d3604,{'IntervalId':_0x483656['IntervalId']}),_0x97c0('0x30')):[];}_0x483656[_0x97c0('0x4')]=_0x10ee7b[_0x97c0('0x4')];_0x483656[_0x97c0('0x5')]=_0x10ee7b['exten'];if(_0x483656['type'])_0x483656[_0x97c0('0x3')]=_0x483656[_0x97c0('0x3')][_0x97c0('0x36')]();if(_0x10ee7b['type']===_0x97c0('0xf')){if(_0x483656[_0x97c0('0x1b')](_0x97c0('0x37'))&&_0x483656[_0x97c0('0x37')]&&_0x483656[_0x97c0('0x37')]!=='--'){_0xc2059f['push']({'type':_0x483656[_0x97c0('0x3')][_0x97c0('0x36')](),'app':_0x97c0('0x7'),'appdata':'CDR(tag)='+_0x483656['tag'],'context':_0x10ee7b[_0x97c0('0x4')],'exten':_0x10ee7b['exten'],'priority':_0x483656['intervals'][_0x97c0('0x25')]+_0x2d625b+_0x15e427++,'VoiceExtensionId':_0x10ee7b['id']});}_0xc2059f[_0x97c0('0xa')]({'type':_0x483656[_0x97c0('0x3')]['toLowerCase'](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x483656[_0x97c0('0x38')]?_0x97c0('0x39')+_0x483656[_0x97c0('0x38')]+')':_0x97c0('0x3a')),'context':_0x10ee7b[_0x97c0('0x4')],'exten':_0x10ee7b[_0x97c0('0x5')],'priority':_0x483656[_0x97c0('0x32')]['length']+_0x2d625b+_0x15e427++,'VoiceExtensionId':_0x10ee7b['id']});}else{if(_0x483656[_0x97c0('0x1b')](_0x97c0('0x3b'))){if([_0x97c0('0x3c'),_0x97c0('0x3d')][_0x97c0('0x3e')](_0x483656[_0x97c0('0x3f')]['toLowerCase']())&&_0x483656[_0x97c0('0x40')]!==_0x97c0('0x41')){if(_0x483656['answer']){_0xc2059f[_0x97c0('0xa')]({'type':_0x483656[_0x97c0('0x3')][_0x97c0('0x36')](),'app':_0x97c0('0x16'),'appdata':_0x97c0('0x42'),'context':_0x10ee7b[_0x97c0('0x4')],'exten':_0x10ee7b[_0x97c0('0x5')],'priority':_0x483656['intervals'][_0x97c0('0x25')]+_0x2d625b+_0x15e427++,'VoiceExtensionId':_0x10ee7b['id']});_0xc2059f[_0x97c0('0xa')]({'type':_0x483656[_0x97c0('0x3')][_0x97c0('0x36')](),'app':_0x97c0('0x7'),'appdata':_0x97c0('0x43'),'context':_0x10ee7b[_0x97c0('0x4')],'exten':_0x10ee7b[_0x97c0('0x5')],'priority':_0x483656[_0x97c0('0x32')][_0x97c0('0x25')]+_0x2d625b+_0x15e427++,'VoiceExtensionId':_0x10ee7b['id']});}else{_0xc2059f[_0x97c0('0xa')]({'type':_0x483656[_0x97c0('0x3')][_0x97c0('0x36')](),'app':'ExecIf','appdata':_0x97c0('0x44'),'context':_0x10ee7b[_0x97c0('0x4')],'exten':_0x10ee7b[_0x97c0('0x5')],'priority':_0x483656[_0x97c0('0x32')][_0x97c0('0x25')]+_0x2d625b+_0x15e427++,'VoiceExtensionId':_0x10ee7b['id']});_0xc2059f[_0x97c0('0xa')]({'type':_0x483656['type'][_0x97c0('0x36')](),'app':_0x97c0('0x7'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x10ee7b[_0x97c0('0x4')],'exten':_0x10ee7b[_0x97c0('0x5')],'priority':_0x483656[_0x97c0('0x32')]['length']+_0x2d625b+_0x15e427++,'VoiceExtensionId':_0x10ee7b['id']});}}}}for(var _0x829ca8=0x0;_0x829ca8<_0x483656['intervals'][_0x97c0('0x25')];_0x829ca8++){var _0x36fede=_0x2d625b+_0x483656[_0x97c0('0x32')][_0x97c0('0x25')];var _0x3c5150=_0x829ca8===_0x483656[_0x97c0('0x32')][_0x97c0('0x25')]-0x1?_0x2d625b+_0xc2059f[_0x97c0('0x25')]+_0x16f0fb[_0x97c0('0x25')]+0x2:_0x2d625b+_0x829ca8+0x1;_0xc2059f[_0x97c0('0x45')](_0x829ca8,0x0,{'type':_0x10ee7b[_0x97c0('0x3')],'app':'GotoIfTime','appdata':_0x483656[_0x97c0('0x32')][_0x829ca8]+'?'+_0x10ee7b[_0x97c0('0x4')]+_0x97c0('0x46')+_0x36fede+':'+_0x10ee7b[_0x97c0('0x4')]+',${EXTEN},'+_0x3c5150,'exten':_0x10ee7b[_0x97c0('0x5')],'context':_0x10ee7b[_0x97c0('0x4')],'priority':_0x2d625b+_0x829ca8,'VoiceExtensionId':_0x10ee7b['id']});}if(_0x483656[_0x97c0('0x40')]===_0x97c0('0x47'))_0x483656['appdata']=_0x1548b6(_0x10ee7b,_0x483656[_0x97c0('0x48')]);_0x483656[_0x97c0('0x49')]=_0xc2059f[_0x97c0('0x25')]?_['last'](_0xc2059f)[_0x97c0('0x49')]+0x1:_0x2d625b;_0x5556e8=_[_0x97c0('0x4a')](_0x5556e8,_0xc2059f,[_0x483656],_0x16f0fb);_0x2d625b=_[_0x97c0('0x4b')](_0x5556e8)[_0x97c0('0x49')]+0x1;}return _0x16ff4e(_0x5556e8);})[_0x97c0('0x4c')](function(_0x1838c9){_0x13549f(_0x1838c9);});});}return _0x53ad71[_0x97c0('0x4d')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xeb4eb3){var _0x396b68=this['get']({'plain':!![]});var _0x366a01=_0x396b68['type']==='outbound'?_0x49c0d9(_0x396b68):_0x2d04b9(_0x396b68);return _0x51a0f5(_0x396b68,_0xeb4eb3,_[_0x97c0('0x4b')](_0x366a01)['priority']+0x1)[_0x97c0('0x2f')](function(_0x41b122){var _0x56be23=_['concat'](_0x366a01,_0x41b122);_0x56be23['push']({'type':_0x396b68[_0x97c0('0x3')],'app':'Hangup','exten':_0x396b68[_0x97c0('0x5')],'context':_0x396b68[_0x97c0('0x4')],'priority':_[_0x97c0('0x4b')](_0x56be23)[_0x97c0('0x49')]+0x1,'VoiceExtensionId':_0x396b68['id']});return _0x56be23;});}}});}; \ No newline at end of file +var _0xa8c4=['wav','trunk','timeout','options','url','length','name','param','split','phone','prefix','SIP','indexOf','U(xcally-mixmonitor-context)','join','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','playback','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT='];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa8c4,0x12d));var _0x4a8c=function(_0x257b04,_0x50b510){_0x257b04=_0x257b04-0x0;var _0x3b088d=_0xa8c4[_0x257b04];return _0x3b088d;};'use strict';var _=require('lodash');var attributes=require(_0x4a8c('0x0'));module[_0x4a8c('0x1')]=function(_0x5cb13b){var _0xcd762c=_0x5cb13b[_0x4a8c('0x2')];function _0x4ddf3b(_0x2bbcab){var _0x402ceb=0x2;var _0x3eb6cf=[{'type':_0x2bbcab[_0x4a8c('0x3')],'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x5')+_0x2bbcab[_0x4a8c('0x3')],'context':_0x2bbcab[_0x4a8c('0x6')],'exten':_0x2bbcab[_0x4a8c('0x7')],'priority':_0x402ceb++,'VoiceExtensionId':_0x2bbcab['id']},{'type':_0x2bbcab[_0x4a8c('0x3')],'app':_0x2bbcab['alias']?_0x4a8c('0x4'):_0x4a8c('0x8'),'appdata':_0x2bbcab[_0x4a8c('0x9')]?_0x4a8c('0xa')+_0x2bbcab[_0x4a8c('0x9')]:_0x4a8c('0xb'),'context':_0x2bbcab[_0x4a8c('0x6')],'exten':_0x2bbcab[_0x4a8c('0x7')],'priority':_0x402ceb++,'VoiceExtensionId':_0x2bbcab['id']}];if(_0x2bbcab['type']===_0x4a8c('0xc')){_0x3eb6cf['push']({'type':'inbound','app':_0x4a8c('0x4'),'appdata':_0x4a8c('0xd')+_0x2bbcab['id'],'context':_0x2bbcab[_0x4a8c('0x6')],'exten':_0x2bbcab[_0x4a8c('0x7')],'priority':_0x402ceb++,'VoiceExtensionId':_0x2bbcab['id']});}_0x3eb6cf[_0x4a8c('0xe')]({'type':_0x2bbcab[_0x4a8c('0x3')],'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0xf'),'context':_0x2bbcab[_0x4a8c('0x6')],'exten':_0x2bbcab['exten'],'priority':_0x402ceb++,'VoiceExtensionId':_0x2bbcab['id']},{'type':_0x2bbcab[_0x4a8c('0x3')],'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x10'),'context':_0x2bbcab[_0x4a8c('0x6')],'exten':_0x2bbcab[_0x4a8c('0x7')],'priority':_0x402ceb++,'VoiceExtensionId':_0x2bbcab['id']},{'type':_0x2bbcab[_0x4a8c('0x3')],'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x11'),'context':_0x2bbcab['context'],'exten':_0x2bbcab[_0x4a8c('0x7')],'priority':_0x402ceb++,'VoiceExtensionId':_0x2bbcab['id']});return _0x3eb6cf;}function _0x3cf5aa(_0x48c327){var _0x473847=0x2;var _0x13de46=[{'type':_0x4a8c('0x12'),'app':_0x4a8c('0x4'),'appdata':'CDR(type)=outbound','context':_0x48c327['context'],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':_0x4a8c('0x12'),'app':_0x48c327[_0x4a8c('0x9')]?_0x4a8c('0x4'):_0x4a8c('0x8'),'appdata':_0x48c327['alias']?_0x4a8c('0xa')+_0x48c327[_0x4a8c('0x9')]:_0x4a8c('0xb'),'context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327['exten'],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':_0x4a8c('0x12'),'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x13')+(_0x48c327[_0x4a8c('0x14')]?_0x4a8c('0x15')+_0x48c327[_0x4a8c('0x14')]+'}':'${EXTEN}'),'context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':'outbound','app':_0x4a8c('0x4'),'appdata':_0x4a8c('0xd')+_0x48c327['id'],'context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':'outbound','app':_0x4a8c('0x16'),'appdata':_0x4a8c('0x17')+(_0x473847+0x2)+_0x4a8c('0x18')+(_0x473847+0x1)+')','context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':_0x4a8c('0x12'),'app':_0x4a8c('0x4'),'appdata':_0x48c327['cutdigits']?_0x4a8c('0x19')+_0x48c327[_0x4a8c('0x14')]+'}':'CDR(prefix)=noprefix','context':_0x48c327['context'],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':'outbound','app':_0x4a8c('0x4'),'appdata':_0x4a8c('0xf'),'context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327['exten'],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':_0x4a8c('0x12'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':'outbound','app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x11'),'context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':_0x4a8c('0x12'),'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x1a')+_0x48c327['id'],'context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']}];if(_0x48c327[_0x4a8c('0x1b')](_0x4a8c('0x1c'))&&_0x48c327['recordingFormat']!==_0x4a8c('0x1d')){_0x13de46['push']({'type':_0x4a8c('0x12'),'app':_0x4a8c('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x48c327['context'],'exten':_0x48c327['exten'],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']},{'type':_0x4a8c('0x12'),'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x1e')+_0x48c327['recordingFormat']||_0x4a8c('0x1f'),'context':_0x48c327[_0x4a8c('0x6')],'exten':_0x48c327[_0x4a8c('0x7')],'priority':_0x473847++,'VoiceExtensionId':_0x48c327['id']});}return _0x13de46;}function _0x1a3ce3(_0xde5ddd,_0x30e8e){var _0x2e9c38=[{'name':_0x4a8c('0x20'),'param':0x0},{'name':_0x4a8c('0x21'),'param':0x1},{'name':_0x4a8c('0x22'),'param':0x2},{'name':_0x4a8c('0x23'),'param':0x3}];var _0x337e2f={};var _0x297cb0=_0x30e8e['split'](',');var _0x5e1dc2=[];for(var _0x4782af=0x0;_0x4782af<_0x2e9c38[_0x4a8c('0x24')];_0x4782af++){switch(_0x2e9c38[_0x4782af][_0x4a8c('0x25')]){case _0x4a8c('0x20'):_0x337e2f[_0x4a8c('0x20')]=_0x297cb0[_0x2e9c38[_0x4782af][_0x4a8c('0x26')]][_0x4a8c('0x27')]('/')[0x1];_0x337e2f[_0x4a8c('0x28')]=_0x297cb0[_0x2e9c38[_0x4782af]['param']][_0x4a8c('0x27')]('/')[0x2];_0x337e2f['prefix']=_0x337e2f['phone']?_0x337e2f['phone']['split']('$')[0x0]:undefined;_0x337e2f[_0x4a8c('0x28')]=_0xde5ddd['cutdigits']?(_0x337e2f[_0x4a8c('0x29')]||'')+_0x4a8c('0x15')+_0xde5ddd[_0x4a8c('0x14')]+'}':(_0x337e2f[_0x4a8c('0x29')]||'')+'${EXTEN}';_0x5e1dc2[_0x2e9c38[_0x4782af]['param']]=[_0x4a8c('0x2a'),_0x337e2f[_0x4a8c('0x20')],_0x337e2f[_0x4a8c('0x28')]]['join']('/');break;case'options':_0x337e2f[_0x4a8c('0x22')]=_0x297cb0[_0x2e9c38[_0x4782af]['param']];if(_0xde5ddd[_0x4a8c('0x1c')]!==_0x4a8c('0x1d')){if(_0x337e2f[_0x4a8c('0x22')][_0x4a8c('0x2b')](_0x4a8c('0x2c'))<0x0){_0x337e2f[_0x4a8c('0x22')]+=_0x4a8c('0x2c');}}else{_0x337e2f[_0x4a8c('0x22')]=_0x337e2f[_0x4a8c('0x22')]['replace'](_0x4a8c('0x2c'),'');}_0x5e1dc2[_0x2e9c38[_0x4782af]['param']]=_0x337e2f[_0x4a8c('0x22')];break;default:_0x5e1dc2[_0x2e9c38[_0x4782af][_0x4a8c('0x26')]]=_0x297cb0[_0x2e9c38[_0x4782af][_0x4a8c('0x26')]];}}return _0x5e1dc2[_0x4a8c('0x2d')](',');}function _0x17333a(_0x2f0c30,_0x5812f4,_0x53289a){return new Promise(function(_0x3ec08b,_0xc9af98){var _0x1c4afe=[];if(_[_0x4a8c('0x2e')](_0x5812f4))return _0x3ec08b(_0x1c4afe);_0xcd762c[_0x4a8c('0x2f')][_0x4a8c('0x30')]({'attributes':['id',_0x4a8c('0x31'),_0x4a8c('0x32')],'raw':!![]})[_0x4a8c('0x33')](function(_0x1ba212){for(var _0x19ca7a=0x0,_0xd4c801=0x0;_0x19ca7a<_0x5812f4['length'];_0x19ca7a++,_0xd4c801=0x0){var _0x250b13=_0x5812f4[_0x19ca7a];var _0x993279=[];var _0x305072=[];delete _0x250b13['id'];if(_0x250b13[_0x4a8c('0x31')]!==_0x4a8c('0x34')){_0x250b13['intervals']=[_0x250b13[_0x4a8c('0x31')]];}else{_0x250b13[_0x4a8c('0x35')]=_0x250b13[_0x4a8c('0x32')]?_[_0x4a8c('0x36')](_[_0x4a8c('0x37')](_0x1ba212,{'IntervalId':_0x250b13[_0x4a8c('0x32')]}),_0x4a8c('0x31')):[];}_0x250b13[_0x4a8c('0x6')]=_0x2f0c30['context'];_0x250b13[_0x4a8c('0x7')]=_0x2f0c30[_0x4a8c('0x7')];if(_0x250b13[_0x4a8c('0x3')])_0x250b13[_0x4a8c('0x3')]=_0x250b13['type'][_0x4a8c('0x38')]();if(_0x2f0c30[_0x4a8c('0x3')]==='outbound'){if(_0x250b13[_0x4a8c('0x1b')](_0x4a8c('0x39'))&&_0x250b13[_0x4a8c('0x39')]&&_0x250b13[_0x4a8c('0x39')]!=='--'){_0x993279[_0x4a8c('0xe')]({'type':_0x250b13['type'][_0x4a8c('0x38')](),'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x3a')+_0x250b13[_0x4a8c('0x39')],'context':_0x2f0c30[_0x4a8c('0x6')],'exten':_0x2f0c30['exten'],'priority':_0x250b13[_0x4a8c('0x35')][_0x4a8c('0x24')]+_0x53289a+_0xd4c801++,'VoiceExtensionId':_0x2f0c30['id']});}_0x993279['push']({'type':_0x250b13[_0x4a8c('0x3')]['toLowerCase'](),'app':_0x4a8c('0x16'),'appdata':_0x4a8c('0x3b')+(_0x250b13[_0x4a8c('0x3c')]?_0x4a8c('0x3d')+_0x250b13['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x2f0c30[_0x4a8c('0x6')],'exten':_0x2f0c30['exten'],'priority':_0x250b13[_0x4a8c('0x35')][_0x4a8c('0x24')]+_0x53289a+_0xd4c801++,'VoiceExtensionId':_0x2f0c30['id']});}else{if(_0x250b13['hasOwnProperty'](_0x4a8c('0x3e'))){if(['queue',_0x4a8c('0x3f')][_0x4a8c('0x40')](_0x250b13[_0x4a8c('0x41')]['toLowerCase']())&&_0x250b13[_0x4a8c('0x42')]!==_0x4a8c('0x43')){if(_0x250b13[_0x4a8c('0x3e')]){_0x993279[_0x4a8c('0xe')]({'type':_0x250b13[_0x4a8c('0x3')][_0x4a8c('0x38')](),'app':_0x4a8c('0x16'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2f0c30[_0x4a8c('0x6')],'exten':_0x2f0c30[_0x4a8c('0x7')],'priority':_0x250b13[_0x4a8c('0x35')]['length']+_0x53289a+_0xd4c801++,'VoiceExtensionId':_0x2f0c30['id']});_0x993279['push']({'type':_0x250b13['type'][_0x4a8c('0x38')](),'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x44'),'context':_0x2f0c30['context'],'exten':_0x2f0c30[_0x4a8c('0x7')],'priority':_0x250b13[_0x4a8c('0x35')][_0x4a8c('0x24')]+_0x53289a+_0xd4c801++,'VoiceExtensionId':_0x2f0c30['id']});}else{_0x993279[_0x4a8c('0xe')]({'type':_0x250b13[_0x4a8c('0x3')][_0x4a8c('0x38')](),'app':'ExecIf','appdata':_0x4a8c('0x45'),'context':_0x2f0c30[_0x4a8c('0x6')],'exten':_0x2f0c30[_0x4a8c('0x7')],'priority':_0x250b13[_0x4a8c('0x35')][_0x4a8c('0x24')]+_0x53289a+_0xd4c801++,'VoiceExtensionId':_0x2f0c30['id']});_0x993279[_0x4a8c('0xe')]({'type':_0x250b13[_0x4a8c('0x3')][_0x4a8c('0x38')](),'app':_0x4a8c('0x4'),'appdata':_0x4a8c('0x46'),'context':_0x2f0c30[_0x4a8c('0x6')],'exten':_0x2f0c30['exten'],'priority':_0x250b13['intervals']['length']+_0x53289a+_0xd4c801++,'VoiceExtensionId':_0x2f0c30['id']});}}}}for(var _0x4b97a2=0x0;_0x4b97a2<_0x250b13[_0x4a8c('0x35')][_0x4a8c('0x24')];_0x4b97a2++){var _0xe5f774=_0x53289a+_0x250b13[_0x4a8c('0x35')][_0x4a8c('0x24')];var _0x158eda=_0x4b97a2===_0x250b13[_0x4a8c('0x35')][_0x4a8c('0x24')]-0x1?_0x53289a+_0x993279[_0x4a8c('0x24')]+_0x305072['length']+0x2:_0x53289a+_0x4b97a2+0x1;_0x993279[_0x4a8c('0x47')](_0x4b97a2,0x0,{'type':_0x2f0c30[_0x4a8c('0x3')],'app':'GotoIfTime','appdata':_0x250b13[_0x4a8c('0x35')][_0x4b97a2]+'?'+_0x2f0c30[_0x4a8c('0x6')]+_0x4a8c('0x48')+_0xe5f774+':'+_0x2f0c30['context']+_0x4a8c('0x48')+_0x158eda,'exten':_0x2f0c30[_0x4a8c('0x7')],'context':_0x2f0c30['context'],'priority':_0x53289a+_0x4b97a2,'VoiceExtensionId':_0x2f0c30['id']});}if(_0x250b13[_0x4a8c('0x42')]==='outboundDial')_0x250b13['appdata']=_0x1a3ce3(_0x2f0c30,_0x250b13[_0x4a8c('0x49')]);_0x250b13[_0x4a8c('0x4a')]=_0x993279[_0x4a8c('0x24')]?_[_0x4a8c('0x4b')](_0x993279)[_0x4a8c('0x4a')]+0x1:_0x53289a;_0x1c4afe=_[_0x4a8c('0x4c')](_0x1c4afe,_0x993279,[_0x250b13],_0x305072);_0x53289a=_[_0x4a8c('0x4b')](_0x1c4afe)[_0x4a8c('0x4a')]+0x1;}return _0x3ec08b(_0x1c4afe);})[_0x4a8c('0x4d')](function(_0x28407d){_0xc9af98(_0x28407d);});});}return _0x5cb13b[_0x4a8c('0x4e')](_0x4a8c('0x4f'),attributes,{'tableName':_0x4a8c('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x16c724){var _0x1107cd=this[_0x4a8c('0x51')]({'plain':!![]});var _0x34147f=_0x1107cd[_0x4a8c('0x3')]===_0x4a8c('0x12')?_0x3cf5aa(_0x1107cd):_0x4ddf3b(_0x1107cd);return _0x17333a(_0x1107cd,_0x16c724,_[_0x4a8c('0x4b')](_0x34147f)[_0x4a8c('0x4a')]+0x1)[_0x4a8c('0x33')](function(_0xf954e4){var _0x9ce21d=_[_0x4a8c('0x4c')](_0x34147f,_0xf954e4);_0x9ce21d[_0x4a8c('0xe')]({'type':_0x1107cd[_0x4a8c('0x3')],'app':_0x4a8c('0x52'),'exten':_0x1107cd['exten'],'context':_0x1107cd[_0x4a8c('0x6')],'priority':_['last'](_0x9ce21d)[_0x4a8c('0x4a')]+0x1,'VoiceExtensionId':_0x1107cd['id']});return _0x9ce21d;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index d12e199..92f56db 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 _0xe08b=['include','map','model','GetVoiceExtension','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','limit'];(function(_0x2ba092,_0x4dbdcb){var _0x5396d9=function(_0x4d295f){while(--_0x4d295f){_0x2ba092['push'](_0x2ba092['shift']());}};_0x5396d9(++_0x4dbdcb);}(_0xe08b,0x10e));var _0xbe08=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0xe08b[_0x18fb16];return _0x147b0d;};'use strict';var _=require(_0xbe08('0x0'));var util=require('util');var moment=require(_0xbe08('0x1'));var BPromise=require(_0xbe08('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe08('0x3'));var db=require(_0xbe08('0x4'))['db'];var utils=require(_0xbe08('0x5'));var logger=require(_0xbe08('0x6'))(_0xbe08('0x7'));var config=require(_0xbe08('0x8'));var jayson=require(_0xbe08('0x9'));var client=jayson[_0xbe08('0xa')][_0xbe08('0xb')]({'port':0x232a});config[_0xbe08('0xc')]=_[_0xbe08('0xd')](config[_0xbe08('0xc')],{'host':_0xbe08('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe08('0xc')]));require(_0xbe08('0xf'))['register'](socket);function respondWithRpcPromise(_0xb4e69a,_0xed8e0c,_0x47ca8d){return new BPromise(function(_0xc5824c,_0x202fec){return client['request'](_0xb4e69a,_0x47ca8d)[_0xbe08('0x10')](function(_0x133725){logger[_0xbe08('0x11')](_0xbe08('0x12'),_0xed8e0c,'request\x20sent');logger[_0xbe08('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0xed8e0c,_0xbe08('0x14'),JSON[_0xbe08('0x15')](_0x133725));if(_0x133725[_0xbe08('0x16')]){if(_0x133725[_0xbe08('0x16')][_0xbe08('0x17')]===0x1f4){logger[_0xbe08('0x16')](_0xbe08('0x12'),_0xed8e0c,_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);return _0x202fec(_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);}logger[_0xbe08('0x16')](_0xbe08('0x12'),_0xed8e0c,_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);return _0xc5824c(_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);}else{logger[_0xbe08('0x11')]('VoiceExtension,\x20%s,\x20%s',_0xed8e0c,_0xbe08('0x14'));_0xc5824c(_0x133725[_0xbe08('0x19')][_0xbe08('0x18')]);}})[_0xbe08('0x1a')](function(_0x1c9379){logger[_0xbe08('0x16')](_0xbe08('0x12'),_0xed8e0c,_0x1c9379);_0x202fec(_0x1c9379);});});}exports['GetVoiceExtension']=function(_0x16e8b4){var _0x27dc52=this;return new Promise(function(_0x5ca59b,_0x5ab5f5){return db[_0xbe08('0x1b')][_0xbe08('0x1c')]({'raw':_0x16e8b4[_0xbe08('0x1d')]?_0x16e8b4['options'][_0xbe08('0x1e')]===undefined?!![]:![]:!![],'where':_0x16e8b4[_0xbe08('0x1d')]?_0x16e8b4[_0xbe08('0x1d')][_0xbe08('0x1f')]||null:null,'attributes':_0x16e8b4[_0xbe08('0x1d')]?_0x16e8b4[_0xbe08('0x1d')][_0xbe08('0x20')]||null:null,'limit':_0x16e8b4[_0xbe08('0x1d')]?_0x16e8b4[_0xbe08('0x1d')][_0xbe08('0x21')]||null:null,'include':_0x16e8b4[_0xbe08('0x1d')]?_0x16e8b4[_0xbe08('0x1d')][_0xbe08('0x22')]?_[_0xbe08('0x23')](_0x16e8b4[_0xbe08('0x1d')][_0xbe08('0x22')],function(_0x368122){return{'model':db[_0x368122[_0xbe08('0x24')]],'as':_0x368122['as'],'attributes':_0x368122[_0xbe08('0x20')],'include':_0x368122[_0xbe08('0x22')]?_['map'](_0x368122[_0xbe08('0x22')],function(_0x23100b){return{'model':db[_0x23100b[_0xbe08('0x24')]],'as':_0x23100b['as'],'attributes':_0x23100b[_0xbe08('0x20')],'include':_0x23100b[_0xbe08('0x22')]?_[_0xbe08('0x23')](_0x23100b['include'],function(_0x415da3){return{'model':db[_0x415da3[_0xbe08('0x24')]],'as':_0x415da3['as'],'attributes':_0x415da3[_0xbe08('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbe08('0x10')](function(_0x1135c3){logger['info'](_0xbe08('0x25'),_0x16e8b4);logger[_0xbe08('0x13')](_0xbe08('0x25'),_0x16e8b4,JSON['stringify'](_0x1135c3));_0x5ca59b(_0x1135c3);})[_0xbe08('0x1a')](function(_0x31b820){logger['error'](_0xbe08('0x25'),_0x31b820[_0xbe08('0x18')],_0x16e8b4);_0x5ab5f5(_0x27dc52['error'](0x1f4,_0x31b820[_0xbe08('0x18')]));});});}; \ No newline at end of file +var _0x9c5a=['info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','raw','options','where','limit','include','map','model','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then'];(function(_0xecc64c,_0x36f249){var _0xcdffbb=function(_0x54121b){while(--_0x54121b){_0xecc64c['push'](_0xecc64c['shift']());}};_0xcdffbb(++_0x36f249);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x39a62d,_0x4eec5f){_0x39a62d=_0x39a62d-0x0;var _0x10826e=_0x9c5a[_0x39a62d];return _0x10826e;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});config[_0xa9c5('0xa')]=_['defaults'](config['redis'],{'host':_0xa9c5('0xb'),'port':0x18eb});var socket=require(_0xa9c5('0xc'))(new Redis(config['redis']));require(_0xa9c5('0xd'))[_0xa9c5('0xe')](socket);function respondWithRpcPromise(_0x51c14c,_0x2e4f45,_0x40a79d){return new BPromise(function(_0x4a19c0,_0x4c55e9){return client[_0xa9c5('0xf')](_0x51c14c,_0x40a79d)[_0xa9c5('0x10')](function(_0x45f8d8){logger[_0xa9c5('0x11')](_0xa9c5('0x12'),_0x2e4f45,_0xa9c5('0x13'));logger[_0xa9c5('0x14')](_0xa9c5('0x15'),_0x2e4f45,_0xa9c5('0x13'),JSON[_0xa9c5('0x16')](_0x45f8d8));if(_0x45f8d8['error']){if(_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x18')]===0x1f4){logger[_0xa9c5('0x17')](_0xa9c5('0x12'),_0x2e4f45,_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x19')]);return _0x4c55e9(_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x19')]);}logger[_0xa9c5('0x17')](_0xa9c5('0x12'),_0x2e4f45,_0x45f8d8['error'][_0xa9c5('0x19')]);return _0x4a19c0(_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x19')]);}else{logger['info'](_0xa9c5('0x12'),_0x2e4f45,_0xa9c5('0x13'));_0x4a19c0(_0x45f8d8[_0xa9c5('0x1a')][_0xa9c5('0x19')]);}})[_0xa9c5('0x1b')](function(_0x349f27){logger[_0xa9c5('0x17')](_0xa9c5('0x12'),_0x2e4f45,_0x349f27);_0x4c55e9(_0x349f27);});});}exports[_0xa9c5('0x1c')]=function(_0x36c486){var _0x113c8f=this;return new Promise(function(_0x2d95f8,_0x54f8b9){return db[_0xa9c5('0x1d')][_0xa9c5('0x1e')]({'raw':_0x36c486['options']?_0x36c486['options'][_0xa9c5('0x1f')]===undefined?!![]:![]:!![],'where':_0x36c486[_0xa9c5('0x20')]?_0x36c486[_0xa9c5('0x20')][_0xa9c5('0x21')]||null:null,'attributes':_0x36c486[_0xa9c5('0x20')]?_0x36c486[_0xa9c5('0x20')]['attributes']||null:null,'limit':_0x36c486['options']?_0x36c486[_0xa9c5('0x20')][_0xa9c5('0x22')]||null:null,'include':_0x36c486['options']?_0x36c486[_0xa9c5('0x20')][_0xa9c5('0x23')]?_[_0xa9c5('0x24')](_0x36c486[_0xa9c5('0x20')][_0xa9c5('0x23')],function(_0x40f08b){return{'model':db[_0x40f08b[_0xa9c5('0x25')]],'as':_0x40f08b['as'],'attributes':_0x40f08b['attributes'],'include':_0x40f08b['include']?_[_0xa9c5('0x24')](_0x40f08b['include'],function(_0x1762ac){return{'model':db[_0x1762ac[_0xa9c5('0x25')]],'as':_0x1762ac['as'],'attributes':_0x1762ac['attributes'],'include':_0x1762ac[_0xa9c5('0x23')]?_[_0xa9c5('0x24')](_0x1762ac['include'],function(_0x413edf){return{'model':db[_0x413edf[_0xa9c5('0x25')]],'as':_0x413edf['as'],'attributes':_0x413edf[_0xa9c5('0x26')]};}):[]};}):[]};}):[]:[]})[_0xa9c5('0x10')](function(_0x325c65){logger['info'](_0xa9c5('0x1c'),_0x36c486);logger['debug'](_0xa9c5('0x1c'),_0x36c486,JSON[_0xa9c5('0x16')](_0x325c65));_0x2d95f8(_0x325c65);})[_0xa9c5('0x1b')](function(_0x541475){logger[_0xa9c5('0x17')](_0xa9c5('0x1c'),_0x541475['message'],_0x36c486);_0x54f8b9(_0x113c8f[_0xa9c5('0x17')](0x1f4,_0x541475[_0xa9c5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 551a781..c576aa4 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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x2478a7,_0x5c3223){var _0xcaac7b=function(_0x42c209){while(--_0x42c209){_0x2478a7['push'](_0x2478a7['shift']());}};_0xcaac7b(++_0x5c3223);}(_0xe14b,0x93));var _0xbe14=function(_0x47beda,_0xf71fef){_0x47beda=_0x47beda-0x0;var _0x3a744f=_0xe14b[_0x47beda];return _0x3a744f;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x3cc60f,_0xe1d4cd){var _0x4c1b58=function(_0x49ac4e){while(--_0x49ac4e){_0x3cc60f['push'](_0x3cc60f['shift']());}};_0x4c1b58(++_0xe1d4cd);}(_0x1261,0x144));var _0x1126=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x1261[_0x3740fe];return _0x55492b;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index c974a80..8c058be 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 _0x1883=['index','/:id','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated'];(function(_0x253476,_0x16b31a){var _0x134271=function(_0x20623c){while(--_0x20623c){_0x253476['push'](_0x253476['shift']());}};_0x134271(++_0x16b31a);}(_0x1883,0xab));var _0x3188=function(_0x3c0ada,_0x533995){_0x3c0ada=_0x3c0ada-0x0;var _0x55fc93=_0x1883[_0x3c0ada];return _0x55fc93;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['show']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['post']('/',auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')](_0x3188('0xe'),auth['isAuthenticated'](),controller[_0x3188('0x13')]);router[_0x3188('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3188('0x15')]);module[_0x3188('0x16')]=router; \ No newline at end of file +var _0x687b=['../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x26ca6e,_0x2899b0){var _0x4d212e=function(_0x256bfd){while(--_0x256bfd){_0x26ca6e['push'](_0x26ca6e['shift']());}};_0x4d212e(++_0x2899b0);}(_0x687b,0x14a));var _0xb687=function(_0xbce261,_0x5bf87e){_0xbce261=_0xbce261-0x0;var _0x23848f=_0x687b[_0xbce261];return _0x23848f;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb687('0x4'));var auth=require(_0xb687('0x5'));var interaction=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var controller=require(_0xb687('0x8'));router[_0xb687('0x9')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0x9')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0x9')]('/:id/messages',auth[_0xb687('0xa')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);router[_0xb687('0x11')](_0xb687('0xc'),auth[_0xb687('0xa')](),controller[_0xb687('0x12')]);router['delete'](_0xb687('0xc'),auth[_0xb687('0xa')](),controller[_0xb687('0x13')]);module[_0xb687('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 3748e4d..5989abd 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 _0xa973=['contest_mailbox','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','exports','STRING'];(function(_0x285104,_0x336f8d){var _0x235233=function(_0x52dd74){while(--_0x52dd74){_0x285104['push'](_0x285104['shift']());}};_0x235233(++_0x336f8d);}(_0xa973,0xfe));var _0x3a97=function(_0x52de9b,_0x19df61){_0x52de9b=_0x52de9b-0x0;var _0x1ad0c7=_0xa973[_0x52de9b];return _0x1ad0c7;};'use strict';var Sequelize=require('sequelize');module[_0x3a97('0x0')]={'customer_id':{'type':Sequelize[_0x3a97('0x1')]},'context':{'type':Sequelize[_0x3a97('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x3a97('0x1')],'defaultValue':'','allowNull':![],'unique':_0x3a97('0x2')},'password':{'type':Sequelize[_0x3a97('0x1')]},'fullname':{'type':Sequelize[_0x3a97('0x1')]},'email':{'type':Sequelize[_0x3a97('0x1')],'validate':{'isEmail':!![]},'set':function(_0x58aa0e){this['setDataValue'](_0x3a97('0x3'),typeof _0x58aa0e===_0x3a97('0x4')&&_0x58aa0e['trim']()?_0x58aa0e[_0x3a97('0x5')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x3a97('0x1')],'defaultValue':_0x3a97('0x6')},'attach':{'type':Sequelize[_0x3a97('0x7')](_0x3a97('0x8'),'no'),'defaultValue':_0x3a97('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3a97('0x7')](_0x3a97('0x8'),'no'),'defaultValue':_0x3a97('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3a97('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x3a97('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3a97('0x7')](_0x3a97('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3a97('0x7')](_0x3a97('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3a97('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3a97('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3a97('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3a97('0x7')](_0x3a97('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x3a97('0x8'),'no'),'defaultValue':_0x3a97('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3a97('0x7')](_0x3a97('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3a97('0x7')](_0x3a97('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3a97('0x7')](_0x3a97('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x3a97('0xa')},'emailsubject':{'type':Sequelize[_0x3a97('0x1')]},'emailbody':{'type':Sequelize[_0x3a97('0x1')]},'maxsecs':{'type':Sequelize[_0x3a97('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3a97('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3a97('0xc')],'get':function(){return this[_0x3a97('0xd')](_0x3a97('0xe'))+'\x20-\x20'+this[_0x3a97('0xd')](_0x3a97('0xf'));}}}; \ No newline at end of file +var _0x1549=['TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','sequelize','exports','STRING','contest_mailbox','email','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x1549,0x1a9));var _0x9154=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0x1549[_0x1c8cc6];return _0x522936;};'use strict';var Sequelize=require(_0x9154('0x0'));module[_0x9154('0x1')]={'customer_id':{'type':Sequelize[_0x9154('0x2')]},'context':{'type':Sequelize[_0x9154('0x2')],'defaultValue':'from-voicemail','unique':_0x9154('0x3')},'mailbox':{'type':Sequelize[_0x9154('0x2')],'defaultValue':'','allowNull':![],'unique':_0x9154('0x3')},'password':{'type':Sequelize[_0x9154('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x3fc942){this['setDataValue'](_0x9154('0x4'),typeof _0x3fc942==='string'&&_0x3fc942[_0x9154('0x5')]()?_0x3fc942[_0x9154('0x5')]():null);}},'pager':{'type':Sequelize[_0x9154('0x2')]},'tz':{'type':Sequelize[_0x9154('0x2')],'defaultValue':_0x9154('0x6')},'attach':{'type':Sequelize[_0x9154('0x7')]('yes','no'),'defaultValue':_0x9154('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x9154('0x7')](_0x9154('0x8'),'no'),'defaultValue':_0x9154('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x9154('0x2')]},'callback':{'type':Sequelize[_0x9154('0x2')]},'review':{'type':Sequelize[_0x9154('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x9154('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9154('0x7')](_0x9154('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x9154('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9154('0x7')](_0x9154('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9154('0x7')](_0x9154('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x9154('0x8'),'no'),'defaultValue':_0x9154('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x9154('0x7')](_0x9154('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9154('0x7')](_0x9154('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9154('0x7')]('yes','no'),'defaultValue':_0x9154('0x8'),'allowNull':![]},'stamp':{'type':_0x9154('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x9154('0x2')]},'maxsecs':{'type':Sequelize[_0x9154('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9154('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9154('0xc')],'get':function(){return this[_0x9154('0xd')](_0x9154('0xe'))+'\x20-\x20'+this['getDataValue']('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index dcce416..529616a 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 _0x7072=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','length','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Voicemails','UserProfileResource','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields'];(function(_0x26e46e,_0x53c776){var _0x4591fd=function(_0x183b76){while(--_0x183b76){_0x26e46e['push'](_0x26e46e['shift']());}};_0x4591fd(++_0x53c776);}(_0x7072,0x138));var _0x2707=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x7072[_0x13ce0c];return _0x4388fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2707('0x0'));var zipdir=require(_0x2707('0x1'));var jsonpatch=require(_0x2707('0x2'));var rp=require(_0x2707('0x3'));var moment=require(_0x2707('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2707('0x5'));var path=require('path');var sox=require(_0x2707('0x6'));var csv=require(_0x2707('0x7'));var ejs=require(_0x2707('0x8'));var fs=require('fs');var fs_extra=require(_0x2707('0x9'));var _=require(_0x2707('0xa'));var squel=require(_0x2707('0xb'));var crypto=require(_0x2707('0xc'));var jsforce=require(_0x2707('0xd'));var deskjs=require(_0x2707('0xe'));var toCsv=require(_0x2707('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2707('0xf'));var authService=require(_0x2707('0x10'));var qs=require(_0x2707('0x11'));var as=require(_0x2707('0x12'));var hardwareService=require(_0x2707('0x13'));var logger=require(_0x2707('0x14'))(_0x2707('0x15'));var utils=require(_0x2707('0x16'));var config=require(_0x2707('0x17'));var licenseUtil=require(_0x2707('0x18'));var db=require(_0x2707('0x19'))['db'];function respondWithStatusCode(_0x32d4bd,_0x40d370){_0x40d370=_0x40d370||0xcc;return function(_0x5bf16e){if(_0x5bf16e){return _0x32d4bd[_0x2707('0x1a')](_0x40d370);}return _0x32d4bd['status'](_0x40d370)[_0x2707('0x1b')]();};}function respondWithResult(_0x307367,_0xfe975c){_0xfe975c=_0xfe975c||0xc8;return function(_0x3a67f2){if(_0x3a67f2){return _0x307367[_0x2707('0x1c')](_0xfe975c)['json'](_0x3a67f2);}};}function respondWithFilteredResult(_0x345774,_0x1a687a){return function(_0x2f6381){if(_0x2f6381){var _0x5d523f=typeof _0x1a687a[_0x2707('0x1d')]===_0x2707('0x1e')&&typeof _0x1a687a[_0x2707('0x1f')]===_0x2707('0x1e');var _0x7ed037=_0x2f6381[_0x2707('0x20')];var _0x4a8b7f=_0x5d523f?0x0:_0x1a687a[_0x2707('0x1d')];var _0x449a61=_0x5d523f?_0x2f6381[_0x2707('0x20')]:_0x1a687a['offset']+_0x1a687a['limit'];var _0x58a4ee;if(_0x449a61>=_0x7ed037){_0x449a61=_0x7ed037;_0x58a4ee=0xc8;}else{_0x58a4ee=0xce;}_0x345774[_0x2707('0x1c')](_0x58a4ee);return _0x345774[_0x2707('0x21')](_0x2707('0x22'),_0x4a8b7f+'-'+_0x449a61+'/'+_0x7ed037)[_0x2707('0x23')](_0x2f6381);}return null;};}function patchUpdates(_0x1a0e1a){return function(_0x3c2935){try{jsonpatch[_0x2707('0x24')](_0x3c2935,_0x1a0e1a,!![]);}catch(_0x65b6e5){return BPromise[_0x2707('0x25')](_0x65b6e5);}return _0x3c2935[_0x2707('0x26')]();};}function saveUpdates(_0x37c475,_0x119df4){return function(_0x454fde){if(_0x454fde){return _0x454fde[_0x2707('0x27')](_0x37c475)['then'](function(_0x1acf22){return _0x1acf22;});}return null;};}function removeEntity(_0x3b030a,_0x46259e){return function(_0x369e3a){if(_0x369e3a){return _0x369e3a[_0x2707('0x28')]()[_0x2707('0x29')](function(){var _0x4831ed=_0x369e3a[_0x2707('0x2a')]({'plain':!![]});var _0x3f6976=_0x2707('0x2b');return db[_0x2707('0x2c')][_0x2707('0x28')]({'where':{'type':_0x3f6976,'resourceId':_0x4831ed['id']}})['then'](function(){return _0x369e3a;});})[_0x2707('0x29')](function(){_0x3b030a['status'](0xcc)[_0x2707('0x1b')]();});}};}function handleEntityNotFound(_0x34dc4e,_0x2aa3fe){return function(_0x57da26){if(!_0x57da26){_0x34dc4e[_0x2707('0x1a')](0x194);}return _0x57da26;};}function handleError(_0x14daf8,_0x2c7047){_0x2c7047=_0x2c7047||0x1f4;return function(_0x529be8){logger[_0x2707('0x2d')](_0x529be8[_0x2707('0x2e')]);if(_0x529be8['name']){delete _0x529be8[_0x2707('0x2f')];}_0x14daf8['status'](_0x2c7047)['send'](_0x529be8);};}exports[_0x2707('0x30')]=function(_0x4e0c93,_0x2a0d24){var _0x3f153d={},_0x417a97={},_0x36b2e9={'count':0x0,'rows':[]};var _0x48832b=_[_0x2707('0x31')](db[_0x2707('0x32')][_0x2707('0x33')],function(_0x154799){return{'name':_0x154799[_0x2707('0x34')],'type':_0x154799[_0x2707('0x35')][_0x2707('0x36')]};});_0x417a97[_0x2707('0x37')]=_[_0x2707('0x31')](_0x48832b,'name');_0x417a97[_0x2707('0x38')]=_[_0x2707('0x39')](_0x4e0c93['query']);_0x417a97['filters']=_['intersection'](_0x417a97['model'],_0x417a97['query']);_0x3f153d[_0x2707('0x3a')]=_['intersection'](_0x417a97['model'],qs[_0x2707('0x3b')](_0x4e0c93[_0x2707('0x38')]['fields']));_0x3f153d[_0x2707('0x3a')]=_0x3f153d[_0x2707('0x3a')]['length']?_0x3f153d['attributes']:_0x417a97[_0x2707('0x37')];if(!_0x4e0c93[_0x2707('0x38')]['hasOwnProperty']('nolimit')){_0x3f153d[_0x2707('0x1f')]=qs[_0x2707('0x1f')](_0x4e0c93['query'][_0x2707('0x1f')]);_0x3f153d[_0x2707('0x1d')]=qs[_0x2707('0x1d')](_0x4e0c93[_0x2707('0x38')][_0x2707('0x1d')]);}_0x3f153d[_0x2707('0x3c')]=qs['sort'](_0x4e0c93[_0x2707('0x38')][_0x2707('0x3d')]);_0x3f153d[_0x2707('0x3e')]=qs[_0x2707('0x3f')](_[_0x2707('0x40')](_0x4e0c93[_0x2707('0x38')],_0x417a97[_0x2707('0x3f')]),_0x48832b);if(_0x4e0c93['query'][_0x2707('0x41')]){_0x3f153d[_0x2707('0x3e')]=_[_0x2707('0x42')](_0x3f153d[_0x2707('0x3e')],{'$or':_[_0x2707('0x31')](_0x48832b,function(_0xc7119d){if(_0xc7119d[_0x2707('0x35')]!==_0x2707('0x43')){var _0x2f06f8={};_0x2f06f8[_0xc7119d[_0x2707('0x2f')]]={'$like':'%'+_0x4e0c93[_0x2707('0x38')][_0x2707('0x41')]+'%'};return _0x2f06f8;}})});}_0x3f153d=_[_0x2707('0x42')]({},_0x3f153d,_0x4e0c93[_0x2707('0x44')]);var _0x36c8ab={'where':_0x3f153d[_0x2707('0x3e')]};return db['VoiceMail'][_0x2707('0x20')](_0x36c8ab)[_0x2707('0x29')](function(_0x5053ba){_0x36b2e9[_0x2707('0x20')]=_0x5053ba;if(_0x4e0c93['query'][_0x2707('0x45')]){_0x3f153d[_0x2707('0x46')]=[{'all':!![]}];}return db[_0x2707('0x32')][_0x2707('0x47')](_0x3f153d);})[_0x2707('0x29')](function(_0xdeec24){_0x36b2e9[_0x2707('0x48')]=_0xdeec24;return _0x36b2e9;})['then'](respondWithFilteredResult(_0x2a0d24,_0x3f153d))[_0x2707('0x49')](handleError(_0x2a0d24,null));};exports[_0x2707('0x4a')]=function(_0x4c8dbf,_0x3d25ea){var _0x6defc2={'raw':!![],'where':{'id':_0x4c8dbf['params']['id']}},_0x3b38d7={};_0x3b38d7['model']=_[_0x2707('0x39')](db[_0x2707('0x32')]['rawAttributes']);_0x3b38d7[_0x2707('0x38')]=_['keys'](_0x4c8dbf[_0x2707('0x38')]);_0x3b38d7[_0x2707('0x3f')]=_[_0x2707('0x4b')](_0x3b38d7[_0x2707('0x37')],_0x3b38d7['query']);_0x6defc2[_0x2707('0x3a')]=_[_0x2707('0x4b')](_0x3b38d7[_0x2707('0x37')],qs[_0x2707('0x3b')](_0x4c8dbf[_0x2707('0x38')][_0x2707('0x3b')]));_0x6defc2[_0x2707('0x3a')]=_0x6defc2['attributes'][_0x2707('0x4c')]?_0x6defc2[_0x2707('0x3a')]:_0x3b38d7[_0x2707('0x37')];if(_0x4c8dbf[_0x2707('0x38')][_0x2707('0x45')]){_0x6defc2['include']=[{'all':!![]}];}_0x6defc2=_[_0x2707('0x42')]({},_0x6defc2,_0x4c8dbf['options']);return db[_0x2707('0x32')][_0x2707('0x4d')](_0x6defc2)['then'](handleEntityNotFound(_0x3d25ea,null))[_0x2707('0x29')](respondWithResult(_0x3d25ea,null))[_0x2707('0x49')](handleError(_0x3d25ea,null));};exports[_0x2707('0x4e')]=function(_0x4ae196,_0x1a8034){return db['VoiceMail'][_0x2707('0x4e')](_0x4ae196[_0x2707('0x4f')],{})['then'](function(_0x2b1746){var _0xffe740=_0x4ae196[_0x2707('0x50')]['get']({'plain':!![]});if(!_0xffe740)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xffe740[_0x2707('0x51')]===_0x2707('0x50')){var _0x292b44=_0x2b1746[_0x2707('0x2a')]({'plain':!![]});var _0x463bf='Voicemails';return db['UserProfileSection']['find']({'where':{'name':_0x463bf,'userProfileId':_0xffe740[_0x2707('0x52')]},'raw':!![]})[_0x2707('0x29')](function(_0x2e11fc){if(_0x2e11fc&&_0x2e11fc[_0x2707('0x53')]===0x0){return db[_0x2707('0x2c')]['create']({'name':_0x292b44[_0x2707('0x2f')],'resourceId':_0x292b44['id'],'type':_0x2e11fc[_0x2707('0x2f')],'sectionId':_0x2e11fc['id']},{})['then'](function(){return _0x2b1746;});}else{return _0x2b1746;}})['catch'](function(_0x3b41b2){logger[_0x2707('0x2d')](_0x2707('0x54'),_0x3b41b2);throw _0x3b41b2;});}return _0x2b1746;})['then'](respondWithResult(_0x1a8034,0xc9))[_0x2707('0x49')](handleError(_0x1a8034,null));};exports[_0x2707('0x27')]=function(_0x2a2a71,_0x29a453){if(_0x2a2a71['body']['id']){delete _0x2a2a71[_0x2707('0x4f')]['id'];}return db[_0x2707('0x32')][_0x2707('0x4d')]({'where':{'id':_0x2a2a71[_0x2707('0x55')]['id']}})[_0x2707('0x29')](handleEntityNotFound(_0x29a453,null))[_0x2707('0x29')](saveUpdates(_0x2a2a71[_0x2707('0x4f')],null))[_0x2707('0x29')](respondWithResult(_0x29a453,null))[_0x2707('0x49')](handleError(_0x29a453,null));};exports[_0x2707('0x28')]=function(_0x4f2b54,_0x38acdd){return db['VoiceMail']['find']({'where':{'id':_0x4f2b54[_0x2707('0x55')]['id']}})['then'](handleEntityNotFound(_0x38acdd,null))['then'](removeEntity(_0x38acdd,null))[_0x2707('0x49')](handleError(_0x38acdd,null));};exports[_0x2707('0x56')]=function(_0x185bd3,_0x154e26,_0x3f82de){return db[_0x2707('0x32')][_0x2707('0x57')]({'where':{'id':_0x185bd3[_0x2707('0x55')]['id']}})[_0x2707('0x29')](handleEntityNotFound(_0x154e26,null))[_0x2707('0x29')](function(_0x40c333){var _0x5852bd;var _0x4c4568={},_0x4a3a35={};_0x4a3a35[_0x2707('0x37')]=_[_0x2707('0x39')](db[_0x2707('0x58')]['rawAttributes']);_0x4a3a35['query']=_[_0x2707('0x39')](_0x185bd3[_0x2707('0x38')]);_0x4a3a35[_0x2707('0x3f')]=_[_0x2707('0x4b')](_0x4a3a35[_0x2707('0x37')],_0x4a3a35['query']);_0x4c4568['attributes']=_[_0x2707('0x4b')](_0x4a3a35[_0x2707('0x37')],qs[_0x2707('0x3b')](_0x185bd3[_0x2707('0x38')][_0x2707('0x3b')]));_0x4c4568[_0x2707('0x3a')]=_0x4c4568[_0x2707('0x3a')][_0x2707('0x4c')]?_0x4c4568[_0x2707('0x3a')]:_0x4a3a35['model'];if(!_0x185bd3[_0x2707('0x38')][_0x2707('0x59')](_0x2707('0x5a'))){_0x4c4568[_0x2707('0x1f')]=qs[_0x2707('0x1f')](_0x185bd3[_0x2707('0x38')]['limit']);_0x4c4568['offset']=qs[_0x2707('0x1d')](_0x185bd3[_0x2707('0x38')]['offset']);}_0x4c4568['order']=qs['sort'](_0x185bd3['query'][_0x2707('0x3d')]);_0x4c4568[_0x2707('0x3e')]=qs['filters'](_[_0x2707('0x40')](_0x185bd3[_0x2707('0x38')],_0x4a3a35[_0x2707('0x3f')]));if(_0x185bd3['query']['filter']){_0x4c4568[_0x2707('0x3e')]=_[_0x2707('0x42')](_0x4c4568[_0x2707('0x3e')],{'$or':_[_0x2707('0x31')](_0x4c4568[_0x2707('0x3a')],function(_0xdb1de0){var _0x3973a0={};_0x3973a0[_0xdb1de0]={'$like':'%'+_0x185bd3['query'][_0x2707('0x41')]+'%'};return _0x3973a0;})});}_0x4c4568[_0x2707('0x3e')]=_[_0x2707('0x42')](_0x4c4568[_0x2707('0x3e')],{'mailboxuser':_0x40c333[_0x2707('0x5b')]});_0x4c4568=_[_0x2707('0x42')]({},_0x4c4568,_0x185bd3['options']);return db[_0x2707('0x58')][_0x2707('0x5c')](_0x4c4568)[_0x2707('0x29')](respondWithFilteredResult(_0x154e26,_0x4c4568));})[_0x2707('0x49')](handleError(_0x154e26,null));}; \ No newline at end of file +var _0x63a5=['index','map','VoiceMail','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','getMessages','VoiceMailMessage','sort','pick','mailbox','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send'];(function(_0xd0026,_0x318fd7){var _0x5eb1f1=function(_0x1292e4){while(--_0x1292e4){_0xd0026['push'](_0xd0026['shift']());}};_0x5eb1f1(++_0x318fd7);}(_0x63a5,0x18e));var _0x563a=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x63a5[_0x4b73a2];return _0x383c66;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61d5b2,_0x214f42){_0x214f42=_0x214f42||0xcc;return function(_0x10de2e){if(_0x10de2e){return _0x61d5b2[_0x563a('0x19')](_0x214f42);}return _0x61d5b2[_0x563a('0x1a')](_0x214f42)[_0x563a('0x1b')]();};}function respondWithResult(_0x50396b,_0x2cf052){_0x2cf052=_0x2cf052||0xc8;return function(_0x3045ac){if(_0x3045ac){return _0x50396b[_0x563a('0x1a')](_0x2cf052)[_0x563a('0x1c')](_0x3045ac);}};}function respondWithFilteredResult(_0x5a2980,_0x504cb7){return function(_0x414535){if(_0x414535){var _0x2ad667=typeof _0x504cb7['offset']===_0x563a('0x1d')&&typeof _0x504cb7[_0x563a('0x1e')]===_0x563a('0x1d');var _0x9c2f77=_0x414535['count'];var _0x598693=_0x2ad667?0x0:_0x504cb7[_0x563a('0x1f')];var _0x422aaf=_0x2ad667?_0x414535[_0x563a('0x20')]:_0x504cb7['offset']+_0x504cb7['limit'];var _0x52b99a;if(_0x422aaf>=_0x9c2f77){_0x422aaf=_0x9c2f77;_0x52b99a=0xc8;}else{_0x52b99a=0xce;}_0x5a2980['status'](_0x52b99a);return _0x5a2980[_0x563a('0x21')](_0x563a('0x22'),_0x598693+'-'+_0x422aaf+'/'+_0x9c2f77)[_0x563a('0x1c')](_0x414535);}return null;};}function patchUpdates(_0x43b7a8){return function(_0x562fce){try{jsonpatch['apply'](_0x562fce,_0x43b7a8,!![]);}catch(_0x3930f0){return BPromise[_0x563a('0x23')](_0x3930f0);}return _0x562fce[_0x563a('0x24')]();};}function saveUpdates(_0x2beccb,_0x1bf502){return function(_0x2dc7e2){if(_0x2dc7e2){return _0x2dc7e2[_0x563a('0x25')](_0x2beccb)[_0x563a('0x26')](function(_0x506491){return _0x506491;});}return null;};}function removeEntity(_0xd59ba8,_0x5422f6){return function(_0x44e2c1){if(_0x44e2c1){return _0x44e2c1[_0x563a('0x27')]()[_0x563a('0x26')](function(){var _0x1250e6=_0x44e2c1[_0x563a('0x28')]({'plain':!![]});var _0x1682ee=_0x563a('0x29');return db[_0x563a('0x2a')]['destroy']({'where':{'type':_0x1682ee,'resourceId':_0x1250e6['id']}})[_0x563a('0x26')](function(){return _0x44e2c1;});})[_0x563a('0x26')](function(){_0xd59ba8[_0x563a('0x1a')](0xcc)[_0x563a('0x1b')]();});}};}function handleEntityNotFound(_0xce8165,_0x1898f9){return function(_0x1afdff){if(!_0x1afdff){_0xce8165[_0x563a('0x19')](0x194);}return _0x1afdff;};}function handleError(_0x249db8,_0x8f3429){_0x8f3429=_0x8f3429||0x1f4;return function(_0x1a69d5){logger[_0x563a('0x2b')](_0x1a69d5[_0x563a('0x2c')]);if(_0x1a69d5[_0x563a('0x2d')]){delete _0x1a69d5['name'];}_0x249db8[_0x563a('0x1a')](_0x8f3429)[_0x563a('0x2e')](_0x1a69d5);};}exports[_0x563a('0x2f')]=function(_0x4aaa3d,_0x1e8d43){var _0x2e5c4b={},_0x3a59cb={},_0x28a8f6={'count':0x0,'rows':[]};var _0x166f89=_[_0x563a('0x30')](db[_0x563a('0x31')]['rawAttributes'],function(_0x2418ae){return{'name':_0x2418ae[_0x563a('0x32')],'type':_0x2418ae[_0x563a('0x33')][_0x563a('0x34')]};});_0x3a59cb[_0x563a('0x35')]=_['map'](_0x166f89,'name');_0x3a59cb['query']=_['keys'](_0x4aaa3d[_0x563a('0x36')]);_0x3a59cb[_0x563a('0x37')]=_[_0x563a('0x38')](_0x3a59cb[_0x563a('0x35')],_0x3a59cb[_0x563a('0x36')]);_0x2e5c4b[_0x563a('0x39')]=_['intersection'](_0x3a59cb['model'],qs[_0x563a('0x3a')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3a')]));_0x2e5c4b[_0x563a('0x39')]=_0x2e5c4b[_0x563a('0x39')][_0x563a('0x3b')]?_0x2e5c4b[_0x563a('0x39')]:_0x3a59cb[_0x563a('0x35')];if(!_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3c')](_0x563a('0x3d'))){_0x2e5c4b[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1e')]);_0x2e5c4b[_0x563a('0x1f')]=qs['offset'](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1f')]);}_0x2e5c4b[_0x563a('0x3e')]=qs['sort'](_0x4aaa3d[_0x563a('0x36')]['sort']);_0x2e5c4b[_0x563a('0x3f')]=qs[_0x563a('0x37')](_['pick'](_0x4aaa3d['query'],_0x3a59cb[_0x563a('0x37')]),_0x166f89);if(_0x4aaa3d['query'][_0x563a('0x40')]){_0x2e5c4b[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x2e5c4b[_0x563a('0x3f')],{'$or':_['map'](_0x166f89,function(_0x47d37a){if(_0x47d37a[_0x563a('0x33')]!=='VIRTUAL'){var _0x46d471={};_0x46d471[_0x47d37a[_0x563a('0x2d')]]={'$like':'%'+_0x4aaa3d[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x46d471;}})});}_0x2e5c4b=_[_0x563a('0x41')]({},_0x2e5c4b,_0x4aaa3d[_0x563a('0x42')]);var _0x4bf555={'where':_0x2e5c4b[_0x563a('0x3f')]};return db['VoiceMail'][_0x563a('0x20')](_0x4bf555)['then'](function(_0x20c142){_0x28a8f6[_0x563a('0x20')]=_0x20c142;if(_0x4aaa3d[_0x563a('0x36')][_0x563a('0x43')]){_0x2e5c4b['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x2e5c4b);})[_0x563a('0x26')](function(_0x1255da){_0x28a8f6[_0x563a('0x44')]=_0x1255da;return _0x28a8f6;})[_0x563a('0x26')](respondWithFilteredResult(_0x1e8d43,_0x2e5c4b))[_0x563a('0x45')](handleError(_0x1e8d43,null));};exports[_0x563a('0x46')]=function(_0x29a1c0,_0x2ca0f4){var _0x19c2cc={'raw':!![],'where':{'id':_0x29a1c0[_0x563a('0x47')]['id']}},_0x433353={};_0x433353[_0x563a('0x35')]=_[_0x563a('0x48')](db[_0x563a('0x31')][_0x563a('0x49')]);_0x433353[_0x563a('0x36')]=_[_0x563a('0x48')](_0x29a1c0[_0x563a('0x36')]);_0x433353[_0x563a('0x37')]=_['intersection'](_0x433353['model'],_0x433353[_0x563a('0x36')]);_0x19c2cc[_0x563a('0x39')]=_[_0x563a('0x38')](_0x433353[_0x563a('0x35')],qs[_0x563a('0x3a')](_0x29a1c0[_0x563a('0x36')][_0x563a('0x3a')]));_0x19c2cc[_0x563a('0x39')]=_0x19c2cc['attributes']['length']?_0x19c2cc[_0x563a('0x39')]:_0x433353[_0x563a('0x35')];if(_0x29a1c0[_0x563a('0x36')][_0x563a('0x43')]){_0x19c2cc[_0x563a('0x4a')]=[{'all':!![]}];}_0x19c2cc=_[_0x563a('0x41')]({},_0x19c2cc,_0x29a1c0[_0x563a('0x42')]);return db[_0x563a('0x31')]['find'](_0x19c2cc)[_0x563a('0x26')](handleEntityNotFound(_0x2ca0f4,null))[_0x563a('0x26')](respondWithResult(_0x2ca0f4,null))['catch'](handleError(_0x2ca0f4,null));};exports[_0x563a('0x4b')]=function(_0x5a063a,_0x3ea787){return db[_0x563a('0x31')][_0x563a('0x4b')](_0x5a063a['body'],{})[_0x563a('0x26')](function(_0x23efcf){var _0xb1dbc8=_0x5a063a[_0x563a('0x4c')][_0x563a('0x28')]({'plain':!![]});if(!_0xb1dbc8)throw new Error(_0x563a('0x4d'));if(_0xb1dbc8[_0x563a('0x4e')]===_0x563a('0x4c')){var _0x277d54=_0x23efcf[_0x563a('0x28')]({'plain':!![]});var _0x3c98d5=_0x563a('0x29');return db[_0x563a('0x4f')]['find']({'where':{'name':_0x3c98d5,'userProfileId':_0xb1dbc8['userProfileId']},'raw':!![]})[_0x563a('0x26')](function(_0xaae9fd){if(_0xaae9fd&&_0xaae9fd[_0x563a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x277d54[_0x563a('0x2d')],'resourceId':_0x277d54['id'],'type':_0xaae9fd[_0x563a('0x2d')],'sectionId':_0xaae9fd['id']},{})['then'](function(){return _0x23efcf;});}else{return _0x23efcf;}})['catch'](function(_0x51e142){logger[_0x563a('0x2b')](_0x563a('0x51'),_0x51e142);throw _0x51e142;});}return _0x23efcf;})[_0x563a('0x26')](respondWithResult(_0x3ea787,0xc9))[_0x563a('0x45')](handleError(_0x3ea787,null));};exports[_0x563a('0x25')]=function(_0x2805eb,_0x4dd257){if(_0x2805eb['body']['id']){delete _0x2805eb[_0x563a('0x52')]['id'];}return db['VoiceMail'][_0x563a('0x53')]({'where':{'id':_0x2805eb[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x4dd257,null))[_0x563a('0x26')](saveUpdates(_0x2805eb[_0x563a('0x52')],null))[_0x563a('0x26')](respondWithResult(_0x4dd257,null))[_0x563a('0x45')](handleError(_0x4dd257,null));};exports['destroy']=function(_0x22cc91,_0x227372){return db['VoiceMail'][_0x563a('0x53')]({'where':{'id':_0x22cc91[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x227372,null))[_0x563a('0x26')](removeEntity(_0x227372,null))[_0x563a('0x45')](handleError(_0x227372,null));};exports[_0x563a('0x54')]=function(_0x16aa03,_0x3919a3,_0x1e275c){return db[_0x563a('0x31')]['findOne']({'where':{'id':_0x16aa03[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x3919a3,null))['then'](function(_0x503896){var _0x402bdd;var _0x709bfd={},_0x579d61={};_0x579d61[_0x563a('0x35')]=_['keys'](db[_0x563a('0x55')][_0x563a('0x49')]);_0x579d61[_0x563a('0x36')]=_[_0x563a('0x48')](_0x16aa03[_0x563a('0x36')]);_0x579d61['filters']=_['intersection'](_0x579d61['model'],_0x579d61['query']);_0x709bfd[_0x563a('0x39')]=_['intersection'](_0x579d61[_0x563a('0x35')],qs['fields'](_0x16aa03[_0x563a('0x36')][_0x563a('0x3a')]));_0x709bfd[_0x563a('0x39')]=_0x709bfd[_0x563a('0x39')][_0x563a('0x3b')]?_0x709bfd['attributes']:_0x579d61[_0x563a('0x35')];if(!_0x16aa03['query']['hasOwnProperty'](_0x563a('0x3d'))){_0x709bfd[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x16aa03[_0x563a('0x36')][_0x563a('0x1e')]);_0x709bfd['offset']=qs[_0x563a('0x1f')](_0x16aa03[_0x563a('0x36')][_0x563a('0x1f')]);}_0x709bfd[_0x563a('0x3e')]=qs[_0x563a('0x56')](_0x16aa03['query'][_0x563a('0x56')]);_0x709bfd['where']=qs[_0x563a('0x37')](_[_0x563a('0x57')](_0x16aa03['query'],_0x579d61[_0x563a('0x37')]));if(_0x16aa03[_0x563a('0x36')][_0x563a('0x40')]){_0x709bfd[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x709bfd[_0x563a('0x3f')],{'$or':_[_0x563a('0x30')](_0x709bfd[_0x563a('0x39')],function(_0x4cfa73){var _0x103c59={};_0x103c59[_0x4cfa73]={'$like':'%'+_0x16aa03[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x103c59;})});}_0x709bfd[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x709bfd[_0x563a('0x3f')],{'mailboxuser':_0x503896[_0x563a('0x58')]});_0x709bfd=_['merge']({},_0x709bfd,_0x16aa03[_0x563a('0x42')]);return db['VoiceMailMessage']['findAndCountAll'](_0x709bfd)['then'](respondWithFilteredResult(_0x3919a3,_0x709bfd));})[_0x563a('0x45')](handleError(_0x3919a3,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 3b45ffa..7504585 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 _0xf7e3=['voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0xf53031,_0x2e6406){var _0x4aacb4=function(_0x1de908){while(--_0x1de908){_0xf53031['push'](_0xf53031['shift']());}};_0x4aacb4(++_0x2e6406);}(_0xf7e3,0x11c));var _0x3f7e=function(_0x5d9de5,_0x15a982){_0x5d9de5=_0x5d9de5-0x0;var _0x2574a9=_0xf7e3[_0x5d9de5];return _0x2574a9;};'use strict';var _=require(_0x3f7e('0x0'));var util=require(_0x3f7e('0x1'));var logger=require(_0x3f7e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3f7e('0x3'));var rp=require(_0x3f7e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f7e('0x5'));var config=require(_0x3f7e('0x6'));var attributes=require(_0x3f7e('0x7'));module[_0x3f7e('0x8')]=function(_0x28493c,_0x5b9f1f){return _0x28493c[_0x3f7e('0x9')]('VoiceMail',attributes,{'tableName':_0x3f7e('0xa'),'paranoid':![],'indexes':[{'name':_0x3f7e('0xb'),'fields':[_0x3f7e('0xc'),_0x3f7e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6466=['rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','api','moment','bluebird','path'];(function(_0x3eb349,_0x593918){var _0x40c52b=function(_0x301a3f){while(--_0x301a3f){_0x3eb349['push'](_0x3eb349['shift']());}};_0x40c52b(++_0x593918);}(_0x6466,0x19e));var _0x6646=function(_0x485003,_0x18ad58){_0x485003=_0x485003-0x0;var _0x43651a=_0x6466[_0x485003];return _0x43651a;};'use strict';var _=require(_0x6646('0x0'));var util=require(_0x6646('0x1'));var logger=require('../../config/logger')(_0x6646('0x2'));var moment=require(_0x6646('0x3'));var BPromise=require(_0x6646('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6646('0x5'));var rimraf=require(_0x6646('0x6'));var config=require(_0x6646('0x7'));var attributes=require('./voiceMail.attributes');module[_0x6646('0x8')]=function(_0x3fea00,_0x477c06){return _0x3fea00[_0x6646('0x9')](_0x6646('0xa'),attributes,{'tableName':_0x6646('0xb'),'paranoid':![],'indexes':[{'name':_0x6646('0xc'),'fields':[_0x6646('0xd'),_0x6646('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index f99fbff..8c1deff 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 _0xc8e1=['request\x20sent','stringify','error','message','result','catch','VoiceMail,\x20%s,\x20%s','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info'];(function(_0xf017fe,_0x2ea39e){var _0x340adc=function(_0xe80cd9){while(--_0xe80cd9){_0xf017fe['push'](_0xf017fe['shift']());}};_0x340adc(++_0x2ea39e);}(_0xc8e1,0x16f));var _0x1c8e=function(_0x1b0efe,_0x28405f){_0x1b0efe=_0x1b0efe-0x0;var _0x2fbe0b=_0xc8e1[_0x1b0efe];return _0x2fbe0b;};'use strict';var _=require('lodash');var util=require(_0x1c8e('0x0'));var moment=require(_0x1c8e('0x1'));var BPromise=require(_0x1c8e('0x2'));var rs=require(_0x1c8e('0x3'));var fs=require('fs');var Redis=require(_0x1c8e('0x4'));var db=require(_0x1c8e('0x5'))['db'];var utils=require(_0x1c8e('0x6'));var logger=require(_0x1c8e('0x7'))(_0x1c8e('0x8'));var config=require(_0x1c8e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1c8e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4878df,_0x4cd4d2,_0x380327){return new BPromise(function(_0x1bac9b,_0xff4785){return client['request'](_0x4878df,_0x380327)[_0x1c8e('0xb')](function(_0x3f8e1a){logger[_0x1c8e('0xc')]('VoiceMail,\x20%s,\x20%s',_0x4cd4d2,_0x1c8e('0xd'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4cd4d2,'request\x20sent',JSON[_0x1c8e('0xe')](_0x3f8e1a));if(_0x3f8e1a[_0x1c8e('0xf')]){if(_0x3f8e1a[_0x1c8e('0xf')]['code']===0x1f4){logger[_0x1c8e('0xf')]('VoiceMail,\x20%s,\x20%s',_0x4cd4d2,_0x3f8e1a[_0x1c8e('0xf')][_0x1c8e('0x10')]);return _0xff4785(_0x3f8e1a[_0x1c8e('0xf')]['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x4cd4d2,_0x3f8e1a['error'][_0x1c8e('0x10')]);return _0x1bac9b(_0x3f8e1a[_0x1c8e('0xf')][_0x1c8e('0x10')]);}else{logger[_0x1c8e('0xc')]('VoiceMail,\x20%s,\x20%s',_0x4cd4d2,_0x1c8e('0xd'));_0x1bac9b(_0x3f8e1a[_0x1c8e('0x11')]['message']);}})[_0x1c8e('0x12')](function(_0x148dca){logger[_0x1c8e('0xf')](_0x1c8e('0x13'),_0x4cd4d2,_0x148dca);_0xff4785(_0x148dca);});});} \ No newline at end of file +var _0x6249=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6249,0x93));var _0x9624=function(_0x38597b,_0xeabb5a){_0x38597b=_0x38597b-0x0;var _0xd0b07=_0x6249[_0x38597b];return _0xd0b07;};'use strict';var _=require('lodash');var util=require(_0x9624('0x0'));var moment=require(_0x9624('0x1'));var BPromise=require(_0x9624('0x2'));var rs=require(_0x9624('0x3'));var fs=require('fs');var Redis=require(_0x9624('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9624('0x5'));var logger=require(_0x9624('0x6'))('rpc');var config=require(_0x9624('0x7'));var jayson=require(_0x9624('0x8'));var client=jayson[_0x9624('0x9')][_0x9624('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e83e4,_0x283763,_0x552f99){return new BPromise(function(_0x417040,_0x3a2525){return client[_0x9624('0xb')](_0x3e83e4,_0x552f99)[_0x9624('0xc')](function(_0x17c95a){logger[_0x9624('0xd')](_0x9624('0xe'),_0x283763,_0x9624('0xf'));logger[_0x9624('0x10')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x283763,_0x9624('0xf'),JSON[_0x9624('0x11')](_0x17c95a));if(_0x17c95a[_0x9624('0x12')]){if(_0x17c95a[_0x9624('0x12')][_0x9624('0x13')]===0x1f4){logger[_0x9624('0x12')]('VoiceMail,\x20%s,\x20%s',_0x283763,_0x17c95a[_0x9624('0x12')][_0x9624('0x14')]);return _0x3a2525(_0x17c95a[_0x9624('0x12')][_0x9624('0x14')]);}logger[_0x9624('0x12')](_0x9624('0xe'),_0x283763,_0x17c95a[_0x9624('0x12')][_0x9624('0x14')]);return _0x417040(_0x17c95a[_0x9624('0x12')][_0x9624('0x14')]);}else{logger['info'](_0x9624('0xe'),_0x283763,_0x9624('0xf'));_0x417040(_0x17c95a[_0x9624('0x15')][_0x9624('0x14')]);}})['catch'](function(_0x33451f){logger[_0x9624('0x12')]('VoiceMail,\x20%s,\x20%s',_0x283763,_0x33451f);_0x3a2525(_0x33451f);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 5734ce2..e12bf58 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 _0x5f4f=['exports','util','path','express','Router','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0xc269d1,_0x93785d){var _0x2ec2a0=function(_0x9df00f){while(--_0x9df00f){_0xc269d1['push'](_0xc269d1['shift']());}};_0x2ec2a0(++_0x93785d);}(_0x5f4f,0x86));var _0xf5f4=function(_0x3bceea,_0x58af75){_0x3bceea=_0x3bceea-0x0;var _0x30a8d3=_0x5f4f[_0x3bceea];return _0x30a8d3;};'use strict';var multer=require('multer');var util=require(_0xf5f4('0x0'));var path=require(_0xf5f4('0x1'));var timeout=require('connect-timeout');var express=require(_0xf5f4('0x2'));var router=express[_0xf5f4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf5f4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf5f4('0x5'));var controller=require(_0xf5f4('0x6'));router['get']('/',auth[_0xf5f4('0x7')](),controller[_0xf5f4('0x8')]);router[_0xf5f4('0x9')](_0xf5f4('0xa'),auth[_0xf5f4('0x7')](),controller[_0xf5f4('0xb')]);router[_0xf5f4('0x9')]('/:id/download',auth[_0xf5f4('0x7')](),controller['download']);router[_0xf5f4('0xc')]('/',auth['isAuthenticated'](),controller[_0xf5f4('0xd')]);router[_0xf5f4('0xe')]('/:id',auth[_0xf5f4('0x7')](),controller[_0xf5f4('0xf')]);router[_0xf5f4('0x10')](_0xf5f4('0xa'),auth['isAuthenticated'](),controller[_0xf5f4('0x11')]);module[_0xf5f4('0x12')]=router; \ No newline at end of file +var _0x8467=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','create','put','update'];(function(_0x1d3674,_0x19127b){var _0x2ef32c=function(_0x4d3678){while(--_0x4d3678){_0x1d3674['push'](_0x1d3674['shift']());}};_0x2ef32c(++_0x19127b);}(_0x8467,0x1e2));var _0x7846=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x8467[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7846('0x0'));var timeout=require(_0x7846('0x1'));var express=require(_0x7846('0x2'));var router=express[_0x7846('0x3')]();var fs_extra=require(_0x7846('0x4'));var auth=require(_0x7846('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7846('0x6'));var controller=require(_0x7846('0x7'));router[_0x7846('0x8')]('/',auth[_0x7846('0x9')](),controller[_0x7846('0xa')]);router[_0x7846('0x8')](_0x7846('0xb'),auth['isAuthenticated'](),controller[_0x7846('0xc')]);router[_0x7846('0x8')](_0x7846('0xd'),auth[_0x7846('0x9')](),controller['download']);router[_0x7846('0xe')]('/',auth[_0x7846('0x9')](),controller[_0x7846('0xf')]);router[_0x7846('0x10')](_0x7846('0xb'),auth['isAuthenticated'](),controller[_0x7846('0x11')]);router[_0x7846('0x12')](_0x7846('0xb'),auth[_0x7846('0x9')](),controller[_0x7846('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 053f690..d7f0755 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 _0x3edb=['TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','getDataValue','STRING','long'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3edb,0x1ab));var _0xb3ed=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x3edb[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require('sequelize');module[_0xb3ed('0x0')]={'name':{'type':Sequelize[_0xb3ed('0x1')],'get':function(_0x4ab0e6){return this[_0xb3ed('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xb3ed('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb3ed('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xb3ed('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xb3ed('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xb3ed('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb3ed('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb3ed('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xb3ed('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0xb3ed('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xb3ed('0x5'),'defaultValue':Sequelize[_0xb3ed('0x6')](_0xb3ed('0x7'))}}; \ No newline at end of file +var _0xe971=['STRING','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','INTEGER'];(function(_0x4706a6,_0x5a1c63){var _0x1bb705=function(_0x484ebb){while(--_0x484ebb){_0x4706a6['push'](_0x4706a6['shift']());}};_0x1bb705(++_0x5a1c63);}(_0xe971,0xec));var _0x1e97=function(_0x4f84c4,_0x337ae4){_0x4f84c4=_0x4f84c4-0x0;var _0x6c19f5=_0xe971[_0x4f84c4];return _0x6c19f5;};'use strict';var Sequelize=require(_0x1e97('0x0'));module[_0x1e97('0x1')]={'name':{'type':Sequelize[_0x1e97('0x2')],'get':function(_0x3cb204){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x1e97('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x1e97('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x1e97('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1e97('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x1e97('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x1e97('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x1e97('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x1e97('0x6'),'defaultValue':Sequelize['literal'](_0x1e97('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 385d5e9..e835fc1 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 _0xbc73=['params','options','find','catch','create','body','download','recording','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','set','send','rimraf','zip-dir','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','update','destroy','then','stack','name','index','map','VoiceMailMessage','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show'];(function(_0x49ef5c,_0x130864){var _0x106147=function(_0x1541d6){while(--_0x1541d6){_0x49ef5c['push'](_0x49ef5c['shift']());}};_0x106147(++_0x130864);}(_0xbc73,0xa6));var _0x3bc7=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0xbc73[_0x4c9380];return _0x49a523;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bc7('0x0'));var zipdir=require(_0x3bc7('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(_0x3bc7('0x2'));var path=require(_0x3bc7('0x3'));var sox=require(_0x3bc7('0x4'));var csv=require('to-csv');var ejs=require(_0x3bc7('0x5'));var fs=require('fs');var fs_extra=require(_0x3bc7('0x6'));var _=require(_0x3bc7('0x7'));var squel=require('squel');var crypto=require(_0x3bc7('0x8'));var jsforce=require(_0x3bc7('0x9'));var deskjs=require(_0x3bc7('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3bc7('0xb'));var Redis=require(_0x3bc7('0xc'));var authService=require(_0x3bc7('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3bc7('0xe'));var logger=require(_0x3bc7('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x3bc7('0x10'));var licenseUtil=require(_0x3bc7('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x154cd2,_0xe302b8){_0xe302b8=_0xe302b8||0xcc;return function(_0x2cb059){if(_0x2cb059){return _0x154cd2[_0x3bc7('0x12')](_0xe302b8);}return _0x154cd2[_0x3bc7('0x13')](_0xe302b8)[_0x3bc7('0x14')]();};}function respondWithResult(_0x265d5a,_0x9418aa){_0x9418aa=_0x9418aa||0xc8;return function(_0x2f1bdf){if(_0x2f1bdf){return _0x265d5a['status'](_0x9418aa)['json'](_0x2f1bdf);}};}function respondWithFilteredResult(_0xf74c39,_0x3ba107){return function(_0xcf2c09){if(_0xcf2c09){var _0x336d9a=typeof _0x3ba107[_0x3bc7('0x15')]===_0x3bc7('0x16')&&typeof _0x3ba107['limit']===_0x3bc7('0x16');var _0x287eac=_0xcf2c09[_0x3bc7('0x17')];var _0x308bda=_0x336d9a?0x0:_0x3ba107[_0x3bc7('0x15')];var _0x1c25a6=_0x336d9a?_0xcf2c09[_0x3bc7('0x17')]:_0x3ba107[_0x3bc7('0x15')]+_0x3ba107['limit'];var _0x2fdd22;if(_0x1c25a6>=_0x287eac){_0x1c25a6=_0x287eac;_0x2fdd22=0xc8;}else{_0x2fdd22=0xce;}_0xf74c39[_0x3bc7('0x13')](_0x2fdd22);return _0xf74c39['set'](_0x3bc7('0x18'),_0x308bda+'-'+_0x1c25a6+'/'+_0x287eac)[_0x3bc7('0x19')](_0xcf2c09);}return null;};}function patchUpdates(_0x39bf14){return function(_0x305a81){try{jsonpatch[_0x3bc7('0x1a')](_0x305a81,_0x39bf14,!![]);}catch(_0x139b53){return BPromise[_0x3bc7('0x1b')](_0x139b53);}return _0x305a81['save']();};}function saveUpdates(_0x3e410f,_0x2538d0){return function(_0x4d9bdf){if(_0x4d9bdf){return _0x4d9bdf[_0x3bc7('0x1c')](_0x3e410f)['then'](function(_0x40c3c3){return _0x40c3c3;});}return null;};}function removeEntity(_0x5a94e3,_0x2a1910){return function(_0x3319e6){if(_0x3319e6){return _0x3319e6[_0x3bc7('0x1d')]()[_0x3bc7('0x1e')](function(){_0x5a94e3['status'](0xcc)[_0x3bc7('0x14')]();});}};}function handleEntityNotFound(_0xd26e45,_0x52cbd4){return function(_0x5905ea){if(!_0x5905ea){_0xd26e45[_0x3bc7('0x12')](0x194);}return _0x5905ea;};}function handleError(_0x1cab5b,_0x368ca8){_0x368ca8=_0x368ca8||0x1f4;return function(_0x38e3f5){logger['error'](_0x38e3f5[_0x3bc7('0x1f')]);if(_0x38e3f5[_0x3bc7('0x20')]){delete _0x38e3f5['name'];}_0x1cab5b[_0x3bc7('0x13')](_0x368ca8)['send'](_0x38e3f5);};}exports[_0x3bc7('0x21')]=function(_0x98081e,_0xec8614){var _0x1982f4={},_0xf2b1b8={},_0x2cc2a1={'count':0x0,'rows':[]};var _0x5d7c61=_[_0x3bc7('0x22')](db[_0x3bc7('0x23')][_0x3bc7('0x24')],function(_0x26af0e){return{'name':_0x26af0e['fieldName'],'type':_0x26af0e['type']['key']};});_0xf2b1b8['model']=_['differenceBy'](_[_0x3bc7('0x22')](_0x5d7c61,_0x3bc7('0x20')),['name']);_0xf2b1b8['query']=_[_0x3bc7('0x25')](_0x98081e[_0x3bc7('0x26')]);_0xf2b1b8[_0x3bc7('0x27')]=_[_0x3bc7('0x28')](_0xf2b1b8['model'],_0xf2b1b8[_0x3bc7('0x26')]);_0x1982f4['attributes']=_[_0x3bc7('0x28')](_0xf2b1b8[_0x3bc7('0x29')],qs[_0x3bc7('0x2a')](_0x98081e[_0x3bc7('0x26')][_0x3bc7('0x2a')]));_0x1982f4[_0x3bc7('0x2b')]=_0x1982f4[_0x3bc7('0x2b')][_0x3bc7('0x2c')]?_0x1982f4[_0x3bc7('0x2b')]:_0xf2b1b8[_0x3bc7('0x29')];if(!_0x98081e[_0x3bc7('0x26')][_0x3bc7('0x2d')](_0x3bc7('0x2e'))){_0x1982f4[_0x3bc7('0x2f')]=qs[_0x3bc7('0x2f')](_0x98081e['query'][_0x3bc7('0x2f')]);_0x1982f4[_0x3bc7('0x15')]=qs[_0x3bc7('0x15')](_0x98081e[_0x3bc7('0x26')][_0x3bc7('0x15')]);}_0x1982f4['order']=qs['sort'](_0x98081e[_0x3bc7('0x26')][_0x3bc7('0x30')]);_0x1982f4[_0x3bc7('0x31')]=qs[_0x3bc7('0x27')](_[_0x3bc7('0x32')](_0x98081e[_0x3bc7('0x26')],_0xf2b1b8[_0x3bc7('0x27')]),_0x5d7c61);if(_0x98081e['query'][_0x3bc7('0x33')]){_0x1982f4[_0x3bc7('0x31')]=_['merge'](_0x1982f4[_0x3bc7('0x31')],{'$or':_[_0x3bc7('0x22')](_0x5d7c61,function(_0x3b49cc){if(_0x3b49cc['type']!==_0x3bc7('0x34')){var _0x91c2b2={};_0x91c2b2[_0x3b49cc[_0x3bc7('0x20')]]={'$like':'%'+_0x98081e[_0x3bc7('0x26')]['filter']+'%'};return _0x91c2b2;}})});}_0x1982f4=_[_0x3bc7('0x35')]({},_0x1982f4,_0x98081e['options']);var _0x306e53={'where':_0x1982f4[_0x3bc7('0x31')]};return db[_0x3bc7('0x23')][_0x3bc7('0x17')](_0x306e53)['then'](function(_0x837063){_0x2cc2a1[_0x3bc7('0x17')]=_0x837063;if(_0x98081e['query'][_0x3bc7('0x36')]){_0x1982f4[_0x3bc7('0x37')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x3bc7('0x38')](_0x1982f4);})[_0x3bc7('0x1e')](function(_0x14bbe5){_0x2cc2a1[_0x3bc7('0x39')]=_0x14bbe5;return _0x2cc2a1;})[_0x3bc7('0x1e')](respondWithFilteredResult(_0xec8614,_0x1982f4))['catch'](handleError(_0xec8614,null));};exports[_0x3bc7('0x3a')]=function(_0x5bef52,_0x88c2bb){var _0x3e7e94={'raw':!![],'where':{'id':_0x5bef52[_0x3bc7('0x3b')]['id']}},_0x4fea1e={};_0x4fea1e[_0x3bc7('0x29')]=_['keys'](db[_0x3bc7('0x23')][_0x3bc7('0x24')]);_0x4fea1e[_0x3bc7('0x26')]=_[_0x3bc7('0x25')](_0x5bef52[_0x3bc7('0x26')]);_0x4fea1e['filters']=_[_0x3bc7('0x28')](_0x4fea1e[_0x3bc7('0x29')],_0x4fea1e[_0x3bc7('0x26')]);_0x3e7e94[_0x3bc7('0x2b')]=_[_0x3bc7('0x28')](_0x4fea1e[_0x3bc7('0x29')],qs[_0x3bc7('0x2a')](_0x5bef52[_0x3bc7('0x26')][_0x3bc7('0x2a')]));_0x3e7e94[_0x3bc7('0x2b')]=_0x3e7e94[_0x3bc7('0x2b')]['length']?_0x3e7e94['attributes']:_0x4fea1e['model'];if(_0x5bef52['query'][_0x3bc7('0x36')]){_0x3e7e94['include']=[{'all':!![]}];}_0x3e7e94=_['merge']({},_0x3e7e94,_0x5bef52[_0x3bc7('0x3c')]);return db['VoiceMailMessage'][_0x3bc7('0x3d')](_0x3e7e94)[_0x3bc7('0x1e')](handleEntityNotFound(_0x88c2bb,null))[_0x3bc7('0x1e')](respondWithResult(_0x88c2bb,null))[_0x3bc7('0x3e')](handleError(_0x88c2bb,null));};exports[_0x3bc7('0x3f')]=function(_0x3f1391,_0x463e15){return db[_0x3bc7('0x23')][_0x3bc7('0x3f')](_0x3f1391[_0x3bc7('0x40')],{})['then'](respondWithResult(_0x463e15,0xc9))[_0x3bc7('0x3e')](handleError(_0x463e15,null));};exports[_0x3bc7('0x1c')]=function(_0x98e039,_0x33ba87){if(_0x98e039['body']['id']){delete _0x98e039['body']['id'];}return db[_0x3bc7('0x23')][_0x3bc7('0x3d')]({'where':{'id':_0x98e039[_0x3bc7('0x3b')]['id']}})[_0x3bc7('0x1e')](handleEntityNotFound(_0x33ba87,null))['then'](saveUpdates(_0x98e039['body'],null))[_0x3bc7('0x1e')](respondWithResult(_0x33ba87,null))[_0x3bc7('0x3e')](handleError(_0x33ba87,null));};exports[_0x3bc7('0x1d')]=function(_0x59d75d,_0x17d4c7){return db[_0x3bc7('0x23')][_0x3bc7('0x3d')]({'where':{'id':_0x59d75d[_0x3bc7('0x3b')]['id']}})[_0x3bc7('0x1e')](handleEntityNotFound(_0x17d4c7,null))[_0x3bc7('0x1e')](removeEntity(_0x17d4c7,null))[_0x3bc7('0x3e')](handleError(_0x17d4c7,null));};exports[_0x3bc7('0x41')]=function(_0x57cf5e,_0x9097bd,_0x529351){return db[_0x3bc7('0x23')][_0x3bc7('0x3d')]({'where':{'id':_0x57cf5e['params']['id']},'attributes':['id',_0x3bc7('0x42'),'msg_id']})[_0x3bc7('0x1e')](handleEntityNotFound(_0x9097bd,null))[_0x3bc7('0x1e')](function(_0x269ace){if(_0x269ace){if(!_0x269ace['recording']){throw new db['Sequelize']['ValidationError'](_0x3bc7('0x43'));}var _0x15b8f3={'Content-Type':_0x3bc7('0x44'),'Content-Disposition':_0x3bc7('0x45')};if(_0x269ace[_0x3bc7('0x46')]){_0x15b8f3[_0x3bc7('0x47')]=_0x3bc7('0x48')+_0x269ace[_0x3bc7('0x46')]+'.wav\x22';}_0x9097bd[_0x3bc7('0x49')](_0x15b8f3);return _0x9097bd[_0x3bc7('0x4a')](new Buffer(_0x269ace['recording']));}})[_0x3bc7('0x3e')](handleError(_0x9097bd,null));}; \ No newline at end of file +var _0x45a1=['apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','find','create','body','catch','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','count','offset','set','Content-Range'];(function(_0x3dac31,_0x1beed4){var _0x576819=function(_0x831112){while(--_0x831112){_0x3dac31['push'](_0x3dac31['shift']());}};_0x576819(++_0x1beed4);}(_0x45a1,0x1ed));var _0x145a=function(_0x4ec4db,_0xd8b533){_0x4ec4db=_0x4ec4db-0x0;var _0xc8cb07=_0x45a1[_0x4ec4db];return _0xc8cb07;};'use strict';var emlformat=require(_0x145a('0x0'));var rimraf=require(_0x145a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x145a('0x2'));var rp=require(_0x145a('0x3'));var moment=require(_0x145a('0x4'));var BPromise=require(_0x145a('0x5'));var Mustache=require(_0x145a('0x6'));var util=require(_0x145a('0x7'));var path=require(_0x145a('0x8'));var sox=require(_0x145a('0x9'));var csv=require('to-csv');var ejs=require(_0x145a('0xa'));var fs=require('fs');var fs_extra=require(_0x145a('0xb'));var _=require(_0x145a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x145a('0xd'));var deskjs=require(_0x145a('0xe'));var toCsv=require(_0x145a('0xf'));var querystring=require(_0x145a('0x10'));var Papa=require(_0x145a('0x11'));var Redis=require(_0x145a('0x12'));var authService=require(_0x145a('0x13'));var qs=require(_0x145a('0x14'));var as=require(_0x145a('0x15'));var hardwareService=require(_0x145a('0x16'));var logger=require(_0x145a('0x17'))('api');var utils=require(_0x145a('0x18'));var config=require(_0x145a('0x19'));var licenseUtil=require(_0x145a('0x1a'));var db=require(_0x145a('0x1b'))['db'];function respondWithStatusCode(_0x5d8c6f,_0x597e0a){_0x597e0a=_0x597e0a||0xcc;return function(_0x233824){if(_0x233824){return _0x5d8c6f['sendStatus'](_0x597e0a);}return _0x5d8c6f['status'](_0x597e0a)['end']();};}function respondWithResult(_0x4e365d,_0x986d13){_0x986d13=_0x986d13||0xc8;return function(_0x3d16b4){if(_0x3d16b4){return _0x4e365d[_0x145a('0x1c')](_0x986d13)[_0x145a('0x1d')](_0x3d16b4);}};}function respondWithFilteredResult(_0x5b837f,_0x4deee4){return function(_0x17e7cf){if(_0x17e7cf){var _0x43dd0f=typeof _0x4deee4['offset']==='undefined'&&typeof _0x4deee4[_0x145a('0x1e')]==='undefined';var _0x7a89d3=_0x17e7cf[_0x145a('0x1f')];var _0xbcd223=_0x43dd0f?0x0:_0x4deee4[_0x145a('0x20')];var _0x20591e=_0x43dd0f?_0x17e7cf[_0x145a('0x1f')]:_0x4deee4[_0x145a('0x20')]+_0x4deee4[_0x145a('0x1e')];var _0x3701f6;if(_0x20591e>=_0x7a89d3){_0x20591e=_0x7a89d3;_0x3701f6=0xc8;}else{_0x3701f6=0xce;}_0x5b837f['status'](_0x3701f6);return _0x5b837f[_0x145a('0x21')](_0x145a('0x22'),_0xbcd223+'-'+_0x20591e+'/'+_0x7a89d3)['json'](_0x17e7cf);}return null;};}function patchUpdates(_0x27464c){return function(_0x13c2b2){try{jsonpatch[_0x145a('0x23')](_0x13c2b2,_0x27464c,!![]);}catch(_0x5bc25e){return BPromise[_0x145a('0x24')](_0x5bc25e);}return _0x13c2b2[_0x145a('0x25')]();};}function saveUpdates(_0x4b299,_0x31c275){return function(_0x985c22){if(_0x985c22){return _0x985c22[_0x145a('0x26')](_0x4b299)[_0x145a('0x27')](function(_0x5bbbf4){return _0x5bbbf4;});}return null;};}function removeEntity(_0x1d3e30,_0x4ba45b){return function(_0x94f98){if(_0x94f98){return _0x94f98[_0x145a('0x28')]()['then'](function(){_0x1d3e30[_0x145a('0x1c')](0xcc)[_0x145a('0x29')]();});}};}function handleEntityNotFound(_0x1f1666,_0x50bf05){return function(_0x562b7e){if(!_0x562b7e){_0x1f1666[_0x145a('0x2a')](0x194);}return _0x562b7e;};}function handleError(_0x389d12,_0x296a4c){_0x296a4c=_0x296a4c||0x1f4;return function(_0x2190d4){logger[_0x145a('0x2b')](_0x2190d4[_0x145a('0x2c')]);if(_0x2190d4[_0x145a('0x2d')]){delete _0x2190d4['name'];}_0x389d12['status'](_0x296a4c)['send'](_0x2190d4);};}exports[_0x145a('0x2e')]=function(_0x4fb2f7,_0x1d9c21){var _0x4a4108={},_0x51742d={},_0x231547={'count':0x0,'rows':[]};var _0x560343=_[_0x145a('0x2f')](db[_0x145a('0x30')][_0x145a('0x31')],function(_0x2e4c3f){return{'name':_0x2e4c3f[_0x145a('0x32')],'type':_0x2e4c3f[_0x145a('0x33')]['key']};});_0x51742d[_0x145a('0x34')]=_[_0x145a('0x35')](_[_0x145a('0x2f')](_0x560343,_0x145a('0x2d')),[_0x145a('0x2d')]);_0x51742d['query']=_[_0x145a('0x36')](_0x4fb2f7[_0x145a('0x37')]);_0x51742d[_0x145a('0x38')]=_['intersection'](_0x51742d[_0x145a('0x34')],_0x51742d[_0x145a('0x37')]);_0x4a4108['attributes']=_['intersection'](_0x51742d[_0x145a('0x34')],qs['fields'](_0x4fb2f7['query'][_0x145a('0x39')]));_0x4a4108['attributes']=_0x4a4108[_0x145a('0x3a')][_0x145a('0x3b')]?_0x4a4108[_0x145a('0x3a')]:_0x51742d[_0x145a('0x34')];if(!_0x4fb2f7[_0x145a('0x37')][_0x145a('0x3c')](_0x145a('0x3d'))){_0x4a4108[_0x145a('0x1e')]=qs['limit'](_0x4fb2f7[_0x145a('0x37')]['limit']);_0x4a4108[_0x145a('0x20')]=qs[_0x145a('0x20')](_0x4fb2f7[_0x145a('0x37')][_0x145a('0x20')]);}_0x4a4108[_0x145a('0x3e')]=qs[_0x145a('0x3f')](_0x4fb2f7[_0x145a('0x37')][_0x145a('0x3f')]);_0x4a4108[_0x145a('0x40')]=qs[_0x145a('0x38')](_[_0x145a('0x41')](_0x4fb2f7['query'],_0x51742d[_0x145a('0x38')]),_0x560343);if(_0x4fb2f7[_0x145a('0x37')]['filter']){_0x4a4108[_0x145a('0x40')]=_[_0x145a('0x42')](_0x4a4108[_0x145a('0x40')],{'$or':_[_0x145a('0x2f')](_0x560343,function(_0x5c3536){if(_0x5c3536[_0x145a('0x33')]!==_0x145a('0x43')){var _0x106855={};_0x106855[_0x5c3536[_0x145a('0x2d')]]={'$like':'%'+_0x4fb2f7[_0x145a('0x37')]['filter']+'%'};return _0x106855;}})});}_0x4a4108=_[_0x145a('0x42')]({},_0x4a4108,_0x4fb2f7[_0x145a('0x44')]);var _0x213220={'where':_0x4a4108[_0x145a('0x40')]};return db[_0x145a('0x30')][_0x145a('0x1f')](_0x213220)[_0x145a('0x27')](function(_0x2c8b12){_0x231547[_0x145a('0x1f')]=_0x2c8b12;if(_0x4fb2f7[_0x145a('0x37')][_0x145a('0x45')]){_0x4a4108[_0x145a('0x46')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x145a('0x47')](_0x4a4108);})[_0x145a('0x27')](function(_0x41a611){_0x231547[_0x145a('0x48')]=_0x41a611;return _0x231547;})[_0x145a('0x27')](respondWithFilteredResult(_0x1d9c21,_0x4a4108))['catch'](handleError(_0x1d9c21,null));};exports[_0x145a('0x49')]=function(_0x5e2164,_0x4cb90f){var _0x5a5d7b={'raw':!![],'where':{'id':_0x5e2164[_0x145a('0x4a')]['id']}},_0x4a7fa4={};_0x4a7fa4[_0x145a('0x34')]=_['keys'](db[_0x145a('0x30')]['rawAttributes']);_0x4a7fa4[_0x145a('0x37')]=_[_0x145a('0x36')](_0x5e2164['query']);_0x4a7fa4[_0x145a('0x38')]=_[_0x145a('0x4b')](_0x4a7fa4[_0x145a('0x34')],_0x4a7fa4['query']);_0x5a5d7b['attributes']=_[_0x145a('0x4b')](_0x4a7fa4[_0x145a('0x34')],qs[_0x145a('0x39')](_0x5e2164[_0x145a('0x37')][_0x145a('0x39')]));_0x5a5d7b['attributes']=_0x5a5d7b['attributes'][_0x145a('0x3b')]?_0x5a5d7b['attributes']:_0x4a7fa4[_0x145a('0x34')];if(_0x5e2164[_0x145a('0x37')]['includeAll']){_0x5a5d7b[_0x145a('0x46')]=[{'all':!![]}];}_0x5a5d7b=_[_0x145a('0x42')]({},_0x5a5d7b,_0x5e2164[_0x145a('0x44')]);return db[_0x145a('0x30')][_0x145a('0x4c')](_0x5a5d7b)[_0x145a('0x27')](handleEntityNotFound(_0x4cb90f,null))[_0x145a('0x27')](respondWithResult(_0x4cb90f,null))['catch'](handleError(_0x4cb90f,null));};exports[_0x145a('0x4d')]=function(_0x2fd274,_0xe9f7ed){return db[_0x145a('0x30')]['create'](_0x2fd274[_0x145a('0x4e')],{})[_0x145a('0x27')](respondWithResult(_0xe9f7ed,0xc9))[_0x145a('0x4f')](handleError(_0xe9f7ed,null));};exports[_0x145a('0x26')]=function(_0x5b3175,_0x2e4610){if(_0x5b3175['body']['id']){delete _0x5b3175['body']['id'];}return db['VoiceMailMessage'][_0x145a('0x4c')]({'where':{'id':_0x5b3175[_0x145a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2e4610,null))[_0x145a('0x27')](saveUpdates(_0x5b3175[_0x145a('0x4e')],null))['then'](respondWithResult(_0x2e4610,null))[_0x145a('0x4f')](handleError(_0x2e4610,null));};exports[_0x145a('0x28')]=function(_0x54b1ca,_0x4a3044){return db[_0x145a('0x30')][_0x145a('0x4c')]({'where':{'id':_0x54b1ca[_0x145a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a3044,null))[_0x145a('0x27')](removeEntity(_0x4a3044,null))['catch'](handleError(_0x4a3044,null));};exports[_0x145a('0x50')]=function(_0x364523,_0x3d44eb,_0x11e72f){return db['VoiceMailMessage'][_0x145a('0x4c')]({'where':{'id':_0x364523[_0x145a('0x4a')]['id']},'attributes':['id',_0x145a('0x51'),_0x145a('0x52')]})[_0x145a('0x27')](handleEntityNotFound(_0x3d44eb,null))[_0x145a('0x27')](function(_0x4b57a9){if(_0x4b57a9){if(!_0x4b57a9[_0x145a('0x51')]){throw new db[(_0x145a('0x53'))][(_0x145a('0x54'))]('VoiceMailMessage\x20not\x20found');}var _0x2f013d={'Content-Type':_0x145a('0x55'),'Content-Disposition':_0x145a('0x56')};if(_0x4b57a9[_0x145a('0x52')]){_0x2f013d['Content-Disposition']='attachment;\x20filename=\x22'+_0x4b57a9['msg_id']+_0x145a('0x57');}_0x3d44eb[_0x145a('0x21')](_0x2f013d);return _0x3d44eb['send'](new Buffer(_0x4b57a9['recording']));}})[_0x145a('0x4f')](handleError(_0x3d44eb,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index b7723e1..4dd3587 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 _0xf0ba=['../../config/environment','exports','VoiceMailMessage','voice_voicemail_messages','dir','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf0ba,0x89));var _0xaf0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0ba[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaf0b('0x0'))(_0xaf0b('0x1'));var moment=require(_0xaf0b('0x2'));var BPromise=require(_0xaf0b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf0b('0x4'));var rimraf=require(_0xaf0b('0x5'));var config=require(_0xaf0b('0x6'));var attributes=require('./voiceMailMessage.attributes');module[_0xaf0b('0x7')]=function(_0x47d8a7,_0x15be75){return _0x47d8a7['define'](_0xaf0b('0x8'),attributes,{'tableName':_0xaf0b('0x9'),'paranoid':![],'indexes':[{'name':_0xaf0b('0xa'),'fields':[_0xaf0b('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0xec05=['../../config/environment','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x280bb5,_0x4a1aff){var _0x2b760c=function(_0x53b65a){while(--_0x53b65a){_0x280bb5['push'](_0x280bb5['shift']());}};_0x2b760c(++_0x4a1aff);}(_0xec05,0x119));var _0x5ec0=function(_0x6dd1f3,_0x4a99a5){_0x6dd1f3=_0x6dd1f3-0x0;var _0x3e8725=_0xec05[_0x6dd1f3];return _0x3e8725;};'use strict';var _=require(_0x5ec0('0x0'));var util=require('util');var logger=require(_0x5ec0('0x1'))(_0x5ec0('0x2'));var moment=require(_0x5ec0('0x3'));var BPromise=require('bluebird');var rp=require(_0x5ec0('0x4'));var fs=require('fs');var path=require(_0x5ec0('0x5'));var rimraf=require(_0x5ec0('0x6'));var config=require(_0x5ec0('0x7'));var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0xec6880,_0x3deb98){return _0xec6880[_0x5ec0('0x8')](_0x5ec0('0x9'),attributes,{'tableName':_0x5ec0('0xa'),'paranoid':![],'indexes':[{'name':_0x5ec0('0xb'),'fields':[_0x5ec0('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index ac78442..f14862d 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 _0x53b8=['error','code','message','result','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53b8,0x9c));var _0x853b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x53b8[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x853b('0x0'));var util=require(_0x853b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x853b('0x2'));var db=require(_0x853b('0x3'))['db'];var utils=require(_0x853b('0x4'));var logger=require('../../config/logger')(_0x853b('0x5'));var config=require(_0x853b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x853b('0x7')][_0x853b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7ecfbd,_0x435846,_0x446e14){return new BPromise(function(_0x37037c,_0x3b71e6){return client[_0x853b('0x9')](_0x7ecfbd,_0x446e14)['then'](function(_0x17a3d4){logger[_0x853b('0xa')](_0x853b('0xb'),_0x435846,_0x853b('0xc'));logger[_0x853b('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x435846,_0x853b('0xc'),JSON[_0x853b('0xe')](_0x17a3d4));if(_0x17a3d4[_0x853b('0xf')]){if(_0x17a3d4['error'][_0x853b('0x10')]===0x1f4){logger[_0x853b('0xf')](_0x853b('0xb'),_0x435846,_0x17a3d4['error'][_0x853b('0x11')]);return _0x3b71e6(_0x17a3d4[_0x853b('0xf')][_0x853b('0x11')]);}logger[_0x853b('0xf')](_0x853b('0xb'),_0x435846,_0x17a3d4[_0x853b('0xf')][_0x853b('0x11')]);return _0x37037c(_0x17a3d4[_0x853b('0xf')][_0x853b('0x11')]);}else{logger[_0x853b('0xa')]('VoiceMailMessage,\x20%s,\x20%s',_0x435846,'request\x20sent');_0x37037c(_0x17a3d4[_0x853b('0x12')][_0x853b('0x11')]);}})['catch'](function(_0x27f809){logger[_0x853b('0xf')](_0x853b('0xb'),_0x435846,_0x27f809);_0x3b71e6(_0x27f809);});});} \ No newline at end of file +var _0x6686=['../../mysqldb','rpc','http','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4fb924,_0x4a67f0){var _0x8b0b05=function(_0x9a3cb1){while(--_0x9a3cb1){_0x4fb924['push'](_0x4fb924['shift']());}};_0x8b0b05(++_0x4a67f0);}(_0x6686,0x13d));var _0x6668=function(_0x1645c4,_0x45d7ed){_0x1645c4=_0x1645c4-0x0;var _0x7e10c6=_0x6686[_0x1645c4];return _0x7e10c6;};'use strict';var _=require(_0x6668('0x0'));var util=require(_0x6668('0x1'));var moment=require(_0x6668('0x2'));var BPromise=require(_0x6668('0x3'));var rs=require(_0x6668('0x4'));var fs=require('fs');var Redis=require(_0x6668('0x5'));var db=require(_0x6668('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6668('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6668('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1dd8e5,_0xd703f4,_0x4f1969){return new BPromise(function(_0x5325e9,_0x55d2d1){return client['request'](_0x1dd8e5,_0x4f1969)[_0x6668('0x9')](function(_0x3bd492){logger['info'](_0x6668('0xa'),_0xd703f4,_0x6668('0xb'));logger[_0x6668('0xc')](_0x6668('0xd'),_0xd703f4,_0x6668('0xb'),JSON['stringify'](_0x3bd492));if(_0x3bd492['error']){if(_0x3bd492[_0x6668('0xe')][_0x6668('0xf')]===0x1f4){logger['error'](_0x6668('0xa'),_0xd703f4,_0x3bd492[_0x6668('0xe')]['message']);return _0x55d2d1(_0x3bd492[_0x6668('0xe')]['message']);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0xd703f4,_0x3bd492[_0x6668('0xe')][_0x6668('0x10')]);return _0x5325e9(_0x3bd492[_0x6668('0xe')][_0x6668('0x10')]);}else{logger[_0x6668('0x11')](_0x6668('0xa'),_0xd703f4,_0x6668('0xb'));_0x5325e9(_0x3bd492['result']['message']);}})[_0x6668('0x12')](function(_0x447753){logger[_0x6668('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0xd703f4,_0x447753);_0x55d2d1(_0x447753);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index a583a9e..13161e3 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 _0xd453=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','show','/:id/sounds','isAuthenticated','post','create','addSound','destroy','delete','/:id/sounds/:id2','exports','util','path'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0xd453,0x11c));var _0x3d45=function(_0x148d54,_0x2f4229){_0x148d54=_0x148d54-0x0;var _0x13732b=_0xd453[_0x148d54];return _0x13732b;};'use strict';var multer=require('multer');var util=require(_0x3d45('0x0'));var path=require(_0x3d45('0x1'));var timeout=require(_0x3d45('0x2'));var express=require(_0x3d45('0x3'));var router=express[_0x3d45('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3d45('0x5'));var interaction=require(_0x3d45('0x6'));var config=require(_0x3d45('0x7'));var controller=require(_0x3d45('0x8'));router[_0x3d45('0x9')]('/',auth['isAuthenticated'](),controller[_0x3d45('0xa')]);router[_0x3d45('0x9')](_0x3d45('0xb'),auth['isAuthenticated'](),controller[_0x3d45('0xc')]);router['get'](_0x3d45('0xd'),auth[_0x3d45('0xe')](),controller['getSounds']);router[_0x3d45('0xf')]('/',auth[_0x3d45('0xe')](),controller[_0x3d45('0x10')]);router[_0x3d45('0xf')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x3d45('0x11')]);router['put'](_0x3d45('0xb'),auth[_0x3d45('0xe')](),controller['update']);router['delete'](_0x3d45('0xb'),auth['isAuthenticated'](),controller[_0x3d45('0x12')]);router[_0x3d45('0x13')](_0x3d45('0x14'),auth[_0x3d45('0xe')](),controller['removeSound']);module[_0x3d45('0x15')]=router; \ No newline at end of file +var _0x757e=['delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','create','addSound','put'];(function(_0x35fb56,_0x5dadff){var _0x2fd52c=function(_0x97bd3f){while(--_0x97bd3f){_0x35fb56['push'](_0x35fb56['shift']());}};_0x2fd52c(++_0x5dadff);}(_0x757e,0x194));var _0xe757=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x757e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe757('0x0'));var util=require('util');var path=require(_0xe757('0x1'));var timeout=require(_0xe757('0x2'));var express=require(_0xe757('0x3'));var router=express[_0xe757('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe757('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe757('0x6'));router[_0xe757('0x7')]('/',auth[_0xe757('0x8')](),controller[_0xe757('0x9')]);router['get'](_0xe757('0xa'),auth[_0xe757('0x8')](),controller[_0xe757('0xb')]);router[_0xe757('0x7')](_0xe757('0xc'),auth['isAuthenticated'](),controller['getSounds']);router['post']('/',auth[_0xe757('0x8')](),controller[_0xe757('0xd')]);router['post'](_0xe757('0xc'),auth[_0xe757('0x8')](),controller[_0xe757('0xe')]);router[_0xe757('0xf')](_0xe757('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe757('0x10')](_0xe757('0xa'),auth[_0xe757('0x8')](),controller[_0xe757('0x11')]);router['delete'](_0xe757('0x12'),auth[_0xe757('0x8')](),controller[_0xe757('0x13')]);module[_0xe757('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 2acceab..c0f01a6 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 _0x7db0=['mp3nb','quietmp3nb','quietmp3','mp3','STRING','TIMESTAMP','name','ENUM','custom','files'];(function(_0xa7c83f,_0x3c2b72){var _0x58652e=function(_0x5e8ec2){while(--_0x5e8ec2){_0xa7c83f['push'](_0xa7c83f['shift']());}};_0x58652e(++_0x3c2b72);}(_0x7db0,0x16e));var _0x07db=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x7db0[_0x4914e2];return _0x2dcd07;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x07db('0x0')},'mode':{'type':Sequelize[_0x07db('0x1')](_0x07db('0x2'),_0x07db('0x3'),_0x07db('0x4'),_0x07db('0x5'),_0x07db('0x6'),_0x07db('0x7')),'allowNull':!![],'defaultValue':_0x07db('0x3')},'directory':{'type':Sequelize[_0x07db('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x07db('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x07db('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x07db('0x8')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x07db('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xba25=['sequelize','exports','STRING','name','custom','files','quietmp3','mp3','alpha','BOOLEAN'];(function(_0x579055,_0x3ff8e7){var _0x4e1980=function(_0x45150e){while(--_0x45150e){_0x579055['push'](_0x579055['shift']());}};_0x4e1980(++_0x3ff8e7);}(_0xba25,0xf0));var _0x5ba2=function(_0x19181d,_0x19819b){_0x19181d=_0x19181d-0x0;var _0x97e34=_0xba25[_0x19181d];return _0x97e34;};'use strict';var Sequelize=require(_0x5ba2('0x0'));module[_0x5ba2('0x1')]={'name':{'type':Sequelize[_0x5ba2('0x2')],'allowNull':![],'unique':_0x5ba2('0x3')},'mode':{'type':Sequelize['ENUM'](_0x5ba2('0x4'),_0x5ba2('0x5'),'mp3nb','quietmp3nb',_0x5ba2('0x6'),_0x5ba2('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x5ba2('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x5ba2('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x5ba2('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5ba2('0x2')],'allowNull':!![],'defaultValue':_0x5ba2('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x5ba2('0x9')],'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 b7a9e30..86e50f2 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 _0x977c=['transaction','mode','files','root','server/files/moh','mkdirSync','directory','0777','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','getSounds','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','get','MusicOnHolds','UserProfileResource','destroy','then','end','error','stack','name','send','index','rawAttributes','type','key','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','params','keys','model','length','find','body','create','sequelize'];(function(_0x319a19,_0x562d19){var _0x3bac8b=function(_0x180624){while(--_0x180624){_0x319a19['push'](_0x319a19['shift']());}};_0x3bac8b(++_0x562d19);}(_0x977c,0x17f));var _0xc977=function(_0x41e81e,_0x4fde0b){_0x41e81e=_0x41e81e-0x0;var _0xc850c2=_0x977c[_0x41e81e];return _0xc850c2;};'use strict';var emlformat=require(_0xc977('0x0'));var rimraf=require(_0xc977('0x1'));var zipdir=require(_0xc977('0x2'));var jsonpatch=require(_0xc977('0x3'));var rp=require(_0xc977('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc977('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc977('0x6'));var csv=require(_0xc977('0x7'));var ejs=require(_0xc977('0x8'));var fs=require('fs');var fs_extra=require(_0xc977('0x9'));var _=require(_0xc977('0xa'));var squel=require(_0xc977('0xb'));var crypto=require(_0xc977('0xc'));var jsforce=require(_0xc977('0xd'));var deskjs=require(_0xc977('0xe'));var toCsv=require(_0xc977('0x7'));var querystring=require(_0xc977('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc977('0x10'));var as=require(_0xc977('0x11'));var hardwareService=require(_0xc977('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc977('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc977('0x14'))['db'];function respondWithStatusCode(_0x3ec216,_0x421fc){_0x421fc=_0x421fc||0xcc;return function(_0x4b23f1){if(_0x4b23f1){return _0x3ec216[_0xc977('0x15')](_0x421fc);}return _0x3ec216[_0xc977('0x16')](_0x421fc)['end']();};}function respondWithResult(_0x31e6c6,_0x2606c3){_0x2606c3=_0x2606c3||0xc8;return function(_0x227c8b){if(_0x227c8b){return _0x31e6c6[_0xc977('0x16')](_0x2606c3)[_0xc977('0x17')](_0x227c8b);}};}function respondWithFilteredResult(_0x493d3d,_0x1ef130){return function(_0x22f837){if(_0x22f837){var _0x319c8b=typeof _0x1ef130[_0xc977('0x18')]===_0xc977('0x19')&&typeof _0x1ef130[_0xc977('0x1a')]===_0xc977('0x19');var _0x2378ba=_0x22f837[_0xc977('0x1b')];var _0x14abc2=_0x319c8b?0x0:_0x1ef130[_0xc977('0x18')];var _0x5c06aa=_0x319c8b?_0x22f837[_0xc977('0x1b')]:_0x1ef130['offset']+_0x1ef130[_0xc977('0x1a')];var _0x39d184;if(_0x5c06aa>=_0x2378ba){_0x5c06aa=_0x2378ba;_0x39d184=0xc8;}else{_0x39d184=0xce;}_0x493d3d['status'](_0x39d184);return _0x493d3d['set'](_0xc977('0x1c'),_0x14abc2+'-'+_0x5c06aa+'/'+_0x2378ba)[_0xc977('0x17')](_0x22f837);}return null;};}function patchUpdates(_0x114436){return function(_0x8ed248){try{jsonpatch[_0xc977('0x1d')](_0x8ed248,_0x114436,!![]);}catch(_0x2934b4){return BPromise[_0xc977('0x1e')](_0x2934b4);}return _0x8ed248[_0xc977('0x1f')]();};}function saveUpdates(_0x15e6c4,_0x384dbe){return function(_0x13f1f2){if(_0x13f1f2){return _0x13f1f2[_0xc977('0x20')](_0x15e6c4)['then'](function(_0xca8f08){return _0xca8f08;});}return null;};}function removeEntity(_0x5ee233,_0x4de4c8){return function(_0x1d57bb){if(_0x1d57bb){return _0x1d57bb['destroy']()['then'](function(){var _0x30d3aa=_0x1d57bb[_0xc977('0x21')]({'plain':!![]});var _0x2d0717=_0xc977('0x22');return db[_0xc977('0x23')][_0xc977('0x24')]({'where':{'type':_0x2d0717,'resourceId':_0x30d3aa['id']}})[_0xc977('0x25')](function(){return _0x1d57bb;});})['then'](function(){_0x5ee233[_0xc977('0x16')](0xcc)[_0xc977('0x26')]();});}};}function handleEntityNotFound(_0x1915a8,_0x8e076){return function(_0x18449a){if(!_0x18449a){_0x1915a8[_0xc977('0x15')](0x194);}return _0x18449a;};}function handleError(_0x6b7584,_0x4d02a1){_0x4d02a1=_0x4d02a1||0x1f4;return function(_0x352cc8){logger[_0xc977('0x27')](_0x352cc8[_0xc977('0x28')]);if(_0x352cc8['name']){delete _0x352cc8[_0xc977('0x29')];}_0x6b7584[_0xc977('0x16')](_0x4d02a1)[_0xc977('0x2a')](_0x352cc8);};}exports[_0xc977('0x2b')]=function(_0x23d126,_0x40fc97){var _0x1880f2={},_0x4cfff4={},_0x4df98b={'count':0x0,'rows':[]};var _0x565b7f=_['map'](db['VoiceMusicOnHold'][_0xc977('0x2c')],function(_0x581169){return{'name':_0x581169['fieldName'],'type':_0x581169[_0xc977('0x2d')][_0xc977('0x2e')]};});_0x4cfff4['model']=_[_0xc977('0x2f')](_0x565b7f,_0xc977('0x29'));_0x4cfff4[_0xc977('0x30')]=_['keys'](_0x23d126[_0xc977('0x30')]);_0x4cfff4[_0xc977('0x31')]=_['intersection'](_0x4cfff4['model'],_0x4cfff4[_0xc977('0x30')]);_0x1880f2['attributes']=_[_0xc977('0x32')](_0x4cfff4['model'],qs[_0xc977('0x33')](_0x23d126['query'][_0xc977('0x33')]));_0x1880f2[_0xc977('0x34')]=_0x1880f2[_0xc977('0x34')]['length']?_0x1880f2[_0xc977('0x34')]:_0x4cfff4['model'];if(!_0x23d126[_0xc977('0x30')][_0xc977('0x35')](_0xc977('0x36'))){_0x1880f2[_0xc977('0x1a')]=qs['limit'](_0x23d126[_0xc977('0x30')]['limit']);_0x1880f2[_0xc977('0x18')]=qs['offset'](_0x23d126[_0xc977('0x30')]['offset']);}_0x1880f2[_0xc977('0x37')]=qs[_0xc977('0x38')](_0x23d126[_0xc977('0x30')][_0xc977('0x38')]);delete _0x23d126[_0xc977('0x30')]['sort'];_0x1880f2[_0xc977('0x39')]=qs['filters'](_[_0xc977('0x3a')](_0x23d126['query'],_0x4cfff4[_0xc977('0x31')]),_0x565b7f);if(_0x23d126[_0xc977('0x30')][_0xc977('0x3b')]){_0x1880f2['where']=_[_0xc977('0x3c')](_0x1880f2[_0xc977('0x39')],{'$or':_[_0xc977('0x2f')](_0x565b7f,function(_0x35e879){if(_0x35e879[_0xc977('0x2d')]!==_0xc977('0x3d')){var _0xf3e68={};_0xf3e68[_0x35e879['name']]={'$like':'%'+_0x23d126[_0xc977('0x30')][_0xc977('0x3b')]+'%'};return _0xf3e68;}})});}_0x1880f2=_[_0xc977('0x3c')]({},_0x1880f2,_0x23d126['options']);var _0x10a58f={'where':_0x1880f2['where']};return db[_0xc977('0x3e')][_0xc977('0x1b')](_0x10a58f)['then'](function(_0x3f08ce){_0x4df98b['count']=_0x3f08ce;if(_0x23d126[_0xc977('0x30')][_0xc977('0x3f')]){_0x1880f2[_0xc977('0x40')]=[{'all':!![]}];}return db[_0xc977('0x3e')][_0xc977('0x41')](_0x1880f2);})['then'](function(_0x4986b4){_0x4df98b[_0xc977('0x42')]=_0x4986b4;return _0x4df98b;})['then'](respondWithFilteredResult(_0x40fc97,_0x1880f2))[_0xc977('0x43')](handleError(_0x40fc97,null));};exports[_0xc977('0x44')]=function(_0x1d87e0,_0x43e602){var _0x2ce7f4={'raw':![],'where':{'id':_0x1d87e0[_0xc977('0x45')]['id']}},_0x1c7644={};_0x1c7644['model']=_[_0xc977('0x46')](db['VoiceMusicOnHold'][_0xc977('0x2c')]);_0x1c7644[_0xc977('0x30')]=_[_0xc977('0x46')](_0x1d87e0['query']);_0x1c7644[_0xc977('0x31')]=_[_0xc977('0x32')](_0x1c7644[_0xc977('0x47')],_0x1c7644[_0xc977('0x30')]);_0x2ce7f4['attributes']=_['intersection'](_0x1c7644[_0xc977('0x47')],qs[_0xc977('0x33')](_0x1d87e0['query']['fields']));_0x2ce7f4[_0xc977('0x34')]=_0x2ce7f4[_0xc977('0x34')][_0xc977('0x48')]?_0x2ce7f4[_0xc977('0x34')]:_0x1c7644[_0xc977('0x47')];if(_0x1d87e0[_0xc977('0x30')][_0xc977('0x3f')]){_0x2ce7f4[_0xc977('0x40')]=[{'all':!![]}];}_0x2ce7f4=_[_0xc977('0x3c')]({},_0x2ce7f4,_0x1d87e0['options']);return db[_0xc977('0x3e')][_0xc977('0x49')](_0x2ce7f4)[_0xc977('0x25')](handleEntityNotFound(_0x43e602,null))[_0xc977('0x25')](respondWithResult(_0x43e602,null))[_0xc977('0x43')](handleError(_0x43e602,null));};exports[_0xc977('0x20')]=function(_0xacd309,_0x164ee1){if(_0xacd309['body']['id']){delete _0xacd309['body']['id'];}return db[_0xc977('0x3e')]['find']({'where':{'id':_0xacd309[_0xc977('0x45')]['id']}})[_0xc977('0x25')](handleEntityNotFound(_0x164ee1,null))['then'](saveUpdates(_0xacd309[_0xc977('0x4a')],null))[_0xc977('0x25')](respondWithResult(_0x164ee1,null))[_0xc977('0x43')](handleError(_0x164ee1,null));};exports[_0xc977('0x4b')]=function(_0x24183d,_0x47ea7d,_0x2b8304){return db[_0xc977('0x4c')][_0xc977('0x4d')](function(_0x4dd92b){if(_0x24183d[_0xc977('0x4a')][_0xc977('0x4e')]===_0xc977('0x4f')){_0x24183d[_0xc977('0x4a')]['directory']=path['join'](config[_0xc977('0x50')],_0xc977('0x51'),_0x24183d[_0xc977('0x4a')]['name']);}return db[_0xc977('0x3e')][_0xc977('0x4b')](_0x24183d['body'],{'transaction':_0x4dd92b})[_0xc977('0x25')](function(_0x272055){if(_0x24183d[_0xc977('0x4a')]['mode']===_0xc977('0x4f')){fs[_0xc977('0x52')](_0x272055[_0xc977('0x53')],parseInt(_0xc977('0x54'),0x8));}var _0x466ad8=_0x24183d['user'][_0xc977('0x21')]({'plain':!![]});if(!_0x466ad8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x466ad8[_0xc977('0x55')]===_0xc977('0x56')){var _0x574ac9=_0x272055[_0xc977('0x21')]({'plain':!![]});return db[_0xc977('0x57')][_0xc977('0x49')]({'where':{'name':_0xc977('0x22'),'userProfileId':_0x466ad8[_0xc977('0x58')]},'raw':!![]})[_0xc977('0x25')](function(_0x120052){if(_0x120052&&_0x120052[_0xc977('0x59')]===0x0){return db[_0xc977('0x23')]['create']({'name':_0x574ac9[_0xc977('0x29')],'resourceId':_0x574ac9['id'],'type':_0x120052['name'],'sectionId':_0x120052['id']},{})[_0xc977('0x25')](function(){return _0x272055;});}else{return _0x272055;}})[_0xc977('0x43')](function(_0x2ae4c9){logger[_0xc977('0x27')](_0xc977('0x5a'),_0x2ae4c9);});}return _0x272055;});})[_0xc977('0x25')](respondWithResult(_0x47ea7d,0xc9))[_0xc977('0x43')](handleError(_0x47ea7d,null));};exports[_0xc977('0x24')]=function(_0xe06bcc,_0x4713ff,_0x5079fb){var _0xc8e1e0;return db[_0xc977('0x3e')][_0xc977('0x49')]({'where':{'id':_0xe06bcc[_0xc977('0x45')]['id']}})[_0xc977('0x25')](function(_0x2062e8){if(_0x2062e8){return db[_0xc977('0x4c')][_0xc977('0x4d')](function(_0x32b4fd){return _0x2062e8['destroy']({'transaction':_0x32b4fd,'raw':!![]})[_0xc977('0x25')](function(_0x466566){if(_0x466566['directory']){fs[_0xc977('0x5b')](_0x466566['directory'])[_0xc977('0x5c')](function(_0x3ba5cf){fs[_0xc977('0x5d')](path[_0xc977('0x5e')](_0x466566[_0xc977('0x53')],_0x3ba5cf));});fs[_0xc977('0x5f')](_0x466566[_0xc977('0x53')]);}return _0x466566;});})[_0xc977('0x43')](function(_0x171bbd){throw new db[(_0xc977('0x60'))][(_0xc977('0x61'))](_0x171bbd[_0xc977('0x62')]);});}})[_0xc977('0x25')](handleEntityNotFound(_0x4713ff,null))['then'](removeEntity(_0x4713ff,null))[_0xc977('0x43')](handleError(_0x4713ff,null));};exports[_0xc977('0x63')]=function(_0x15a8c9,_0x49ff12,_0xe12a0f){return db[_0xc977('0x4c')][_0xc977('0x4d')](function(_0x51ea47){var _0x4cf409;return db[_0xc977('0x3e')]['find']({'where':{'id':_0x15a8c9[_0xc977('0x45')]['id']}})['then'](function(_0x3f6f23){if(_0x3f6f23){_0x4cf409=_0x3f6f23;return _0x3f6f23['addSound'](_0x15a8c9[_0xc977('0x4a')]['id'],{'transaction':_0x51ea47});}})['then'](function(_0x320056){if(_0x320056){return db[_0xc977('0x64')][_0xc977('0x65')]({'where':{'id':_0x15a8c9[_0xc977('0x4a')]['id']},'attributes':['id','name',_0xc977('0x66'),_0xc977('0x67'),_0xc977('0x68')],'raw':!![]});}})[_0xc977('0x25')](function(_0x5b6580){if(_0x5b6580){var _0x3a269c=path['join'](config['root'],_0xc977('0x69'),util[_0xc977('0x6a')](_0xc977('0x6b'),path[_0xc977('0x6c')](_0x5b6580[_0xc977('0x66')],path[_0xc977('0x6d')](_0x5b6580[_0xc977('0x66')])),_0x5b6580[_0xc977('0x67')]));var _0x5f5dc8=path[_0xc977('0x5e')](config[_0xc977('0x50')],'server/files/moh',_0x4cf409[_0xc977('0x29')],util[_0xc977('0x6a')]('%s.%s',_0x5b6580['name'],_0x5b6580[_0xc977('0x67')]));fs[_0xc977('0x6e')](_0x3a269c,_0x5f5dc8);return _0x5b6580;}})['catch'](function(_0x55532d){throw new db['Sequelize']['ValidationError'](_0x55532d['message']);});})[_0xc977('0x25')](handleEntityNotFound(_0x49ff12,null))[_0xc977('0x25')](respondWithResult(_0x49ff12,0xc9))['catch'](handleError(_0x49ff12,null));};exports['removeSound']=function(_0x3e95d5,_0x5748e2,_0x41cec7){return db[_0xc977('0x4c')][_0xc977('0x4d')](function(_0x9726b4){var _0x172daf;return db[_0xc977('0x3e')][_0xc977('0x65')]({'where':{'id':_0x3e95d5[_0xc977('0x45')]['id']}})[_0xc977('0x25')](handleEntityNotFound(_0x5748e2,null))['then'](function(_0xe1df64){if(_0xe1df64){_0x172daf=_0xe1df64;return _0xe1df64[_0xc977('0x6f')](_0x3e95d5[_0xc977('0x45')][_0xc977('0x70')]);}})[_0xc977('0x25')](function(_0x48260d){if(_0x48260d){return db[_0xc977('0x64')][_0xc977('0x65')]({'where':{'id':_0x3e95d5[_0xc977('0x45')][_0xc977('0x70')]},'attributes':['id','name',_0xc977('0x66'),_0xc977('0x67'),'createdAt'],'raw':!![]});}})[_0xc977('0x25')](function(_0x1e64cb){if(_0x1e64cb){fs[_0xc977('0x5d')](path['join'](_0x172daf['directory'],util[_0xc977('0x6a')](_0xc977('0x6b'),_0x1e64cb[_0xc977('0x29')],_0x1e64cb[_0xc977('0x67')])));return _0x1e64cb;}})['catch'](function(_0x557be0){throw new db[(_0xc977('0x60'))][(_0xc977('0x61'))](_0x557be0['message']);});})['then'](handleEntityNotFound(_0x5748e2,null))[_0xc977('0x25')](respondWithStatusCode(_0x5748e2,0xcc))['catch'](handleError(_0x5748e2,null));};exports[_0xc977('0x71')]=function(_0x4f13bb,_0xbca600,_0x24a5b3){var _0x4c7a23={};var _0x5e7a97={};var _0xf4690;var _0x33d4b4;return db[_0xc977('0x3e')][_0xc977('0x65')]({'where':{'id':_0x4f13bb[_0xc977('0x45')]['id']}})[_0xc977('0x25')](handleEntityNotFound(_0xbca600,null))['then'](function(_0x5dc025){if(_0x5dc025){_0xf4690=_0x5dc025;_0x5e7a97[_0xc977('0x47')]=_[_0xc977('0x46')](db[_0xc977('0x64')]['rawAttributes']);_0x5e7a97[_0xc977('0x30')]=_[_0xc977('0x46')](_0x4f13bb[_0xc977('0x30')]);_0x5e7a97[_0xc977('0x31')]=_[_0xc977('0x32')](_0x5e7a97[_0xc977('0x47')],_0x5e7a97[_0xc977('0x30')]);_0x4c7a23[_0xc977('0x34')]=_[_0xc977('0x32')](_0x5e7a97[_0xc977('0x47')],qs['fields'](_0x4f13bb[_0xc977('0x30')][_0xc977('0x33')]));_0x4c7a23[_0xc977('0x34')]=_0x4c7a23['attributes'][_0xc977('0x48')]?_0x4c7a23[_0xc977('0x34')]:_0x5e7a97[_0xc977('0x47')];_0x4c7a23[_0xc977('0x37')]=qs['sort'](_0x4f13bb[_0xc977('0x30')][_0xc977('0x38')]);_0x4c7a23['where']=qs['filters'](_['pick'](_0x4f13bb['query'],_0x5e7a97['filters']));if(_0x4f13bb[_0xc977('0x30')][_0xc977('0x3b')]){_0x4c7a23['where']=_[_0xc977('0x3c')](_0x4c7a23['where'],{'$or':_[_0xc977('0x2f')](_0x4c7a23[_0xc977('0x34')],function(_0x4630ce){var _0x23c288={};_0x23c288[_0x4630ce]={'$like':'%'+_0x4f13bb['query'][_0xc977('0x3b')]+'%'};return _0x23c288;})});}_0x4c7a23=_[_0xc977('0x3c')]({},_0x4c7a23,_0x4f13bb[_0xc977('0x72')]);return _0xf4690['getSounds'](_0x4c7a23);}})[_0xc977('0x25')](function(_0xb93291){if(_0xb93291){_0x33d4b4=_0xb93291['length'];if(!_0x4f13bb[_0xc977('0x30')]['hasOwnProperty'](_0xc977('0x36'))){_0x4c7a23[_0xc977('0x1a')]=qs[_0xc977('0x1a')](_0x4f13bb['query'][_0xc977('0x1a')]);_0x4c7a23[_0xc977('0x18')]=qs[_0xc977('0x18')](_0x4f13bb['query'][_0xc977('0x18')]);}return _0xf4690['getSounds'](_0x4c7a23);}})[_0xc977('0x25')](function(_0x42e447){if(_0x42e447){return _0x42e447?{'count':_0x33d4b4,'rows':_0x42e447}:null;}})[_0xc977('0x25')](respondWithResult(_0xbca600,null))[_0xc977('0x43')](handleError(_0xbca600,null));}; \ No newline at end of file +var _0xe7e1=['find','body','create','sequelize','transaction','files','join','server/files/moh','mode','mkdirSync','directory','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','destroy','forEach','Sequelize','ValidationError','message','addSound','Sound','findOne','createdAt','root','server/files/sounds/converted','%s.%s','basename','extname','converted_format','format','symlinkSync','removeSound','id2','save_name','unlinkSync','getSounds','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','save','update','then','UserProfileResource','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params'];(function(_0x44bfb4,_0x2010d8){var _0x4e38c1=function(_0x559cd2){while(--_0x559cd2){_0x44bfb4['push'](_0x44bfb4['shift']());}};_0x4e38c1(++_0x2010d8);}(_0xe7e1,0x9e));var _0x1e7e=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xe7e1[_0x45b034];return _0x509cb0;};'use strict';var emlformat=require(_0x1e7e('0x0'));var rimraf=require(_0x1e7e('0x1'));var zipdir=require(_0x1e7e('0x2'));var jsonpatch=require(_0x1e7e('0x3'));var rp=require(_0x1e7e('0x4'));var moment=require(_0x1e7e('0x5'));var BPromise=require(_0x1e7e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1e7e('0x7'));var csv=require(_0x1e7e('0x8'));var ejs=require(_0x1e7e('0x9'));var fs=require('fs');var fs_extra=require(_0x1e7e('0xa'));var _=require(_0x1e7e('0xb'));var squel=require('squel');var crypto=require(_0x1e7e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1e7e('0xd'));var toCsv=require(_0x1e7e('0x8'));var querystring=require(_0x1e7e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1e7e('0xf'));var as=require(_0x1e7e('0x10'));var hardwareService=require(_0x1e7e('0x11'));var logger=require(_0x1e7e('0x12'))(_0x1e7e('0x13'));var utils=require(_0x1e7e('0x14'));var config=require(_0x1e7e('0x15'));var licenseUtil=require(_0x1e7e('0x16'));var db=require(_0x1e7e('0x17'))['db'];function respondWithStatusCode(_0x21417d,_0x3e03dd){_0x3e03dd=_0x3e03dd||0xcc;return function(_0x3695f3){if(_0x3695f3){return _0x21417d[_0x1e7e('0x18')](_0x3e03dd);}return _0x21417d['status'](_0x3e03dd)[_0x1e7e('0x19')]();};}function respondWithResult(_0x325c6c,_0x5bc8e9){_0x5bc8e9=_0x5bc8e9||0xc8;return function(_0xb41f18){if(_0xb41f18){return _0x325c6c[_0x1e7e('0x1a')](_0x5bc8e9)['json'](_0xb41f18);}};}function respondWithFilteredResult(_0x45a255,_0x21d68c){return function(_0x324bb4){if(_0x324bb4){var _0x579e6e=typeof _0x21d68c[_0x1e7e('0x1b')]===_0x1e7e('0x1c')&&typeof _0x21d68c[_0x1e7e('0x1d')]==='undefined';var _0x1582ef=_0x324bb4[_0x1e7e('0x1e')];var _0x72de48=_0x579e6e?0x0:_0x21d68c[_0x1e7e('0x1b')];var _0x3f427e=_0x579e6e?_0x324bb4['count']:_0x21d68c[_0x1e7e('0x1b')]+_0x21d68c[_0x1e7e('0x1d')];var _0x872683;if(_0x3f427e>=_0x1582ef){_0x3f427e=_0x1582ef;_0x872683=0xc8;}else{_0x872683=0xce;}_0x45a255[_0x1e7e('0x1a')](_0x872683);return _0x45a255[_0x1e7e('0x1f')](_0x1e7e('0x20'),_0x72de48+'-'+_0x3f427e+'/'+_0x1582ef)['json'](_0x324bb4);}return null;};}function patchUpdates(_0x41574a){return function(_0x42b298){try{jsonpatch['apply'](_0x42b298,_0x41574a,!![]);}catch(_0x5ead73){return BPromise['reject'](_0x5ead73);}return _0x42b298[_0x1e7e('0x21')]();};}function saveUpdates(_0x313fb7,_0x4c5e8a){return function(_0xea2b49){if(_0xea2b49){return _0xea2b49[_0x1e7e('0x22')](_0x313fb7)[_0x1e7e('0x23')](function(_0x988d96){return _0x988d96;});}return null;};}function removeEntity(_0x5e9189,_0x1126da){return function(_0x2c1bd8){if(_0x2c1bd8){return _0x2c1bd8['destroy']()['then'](function(){var _0x24b74a=_0x2c1bd8['get']({'plain':!![]});var _0x179f29='MusicOnHolds';return db[_0x1e7e('0x24')]['destroy']({'where':{'type':_0x179f29,'resourceId':_0x24b74a['id']}})[_0x1e7e('0x23')](function(){return _0x2c1bd8;});})[_0x1e7e('0x23')](function(){_0x5e9189[_0x1e7e('0x1a')](0xcc)[_0x1e7e('0x19')]();});}};}function handleEntityNotFound(_0x3f96b3,_0x5e23fb){return function(_0x5abb70){if(!_0x5abb70){_0x3f96b3[_0x1e7e('0x18')](0x194);}return _0x5abb70;};}function handleError(_0x59a9f4,_0x2b372e){_0x2b372e=_0x2b372e||0x1f4;return function(_0xe58813){logger['error'](_0xe58813['stack']);if(_0xe58813['name']){delete _0xe58813[_0x1e7e('0x25')];}_0x59a9f4[_0x1e7e('0x1a')](_0x2b372e)[_0x1e7e('0x26')](_0xe58813);};}exports[_0x1e7e('0x27')]=function(_0x510f56,_0x4b2f2b){var _0x29ea82={},_0x1d2ff1={},_0x23f58d={'count':0x0,'rows':[]};var _0x36e690=_[_0x1e7e('0x28')](db[_0x1e7e('0x29')][_0x1e7e('0x2a')],function(_0x19cec8){return{'name':_0x19cec8[_0x1e7e('0x2b')],'type':_0x19cec8[_0x1e7e('0x2c')][_0x1e7e('0x2d')]};});_0x1d2ff1[_0x1e7e('0x2e')]=_[_0x1e7e('0x28')](_0x36e690,_0x1e7e('0x25'));_0x1d2ff1[_0x1e7e('0x2f')]=_[_0x1e7e('0x30')](_0x510f56['query']);_0x1d2ff1[_0x1e7e('0x31')]=_[_0x1e7e('0x32')](_0x1d2ff1[_0x1e7e('0x2e')],_0x1d2ff1[_0x1e7e('0x2f')]);_0x29ea82['attributes']=_[_0x1e7e('0x32')](_0x1d2ff1[_0x1e7e('0x2e')],qs[_0x1e7e('0x33')](_0x510f56[_0x1e7e('0x2f')][_0x1e7e('0x33')]));_0x29ea82[_0x1e7e('0x34')]=_0x29ea82['attributes'][_0x1e7e('0x35')]?_0x29ea82[_0x1e7e('0x34')]:_0x1d2ff1[_0x1e7e('0x2e')];if(!_0x510f56[_0x1e7e('0x2f')][_0x1e7e('0x36')](_0x1e7e('0x37'))){_0x29ea82[_0x1e7e('0x1d')]=qs[_0x1e7e('0x1d')](_0x510f56[_0x1e7e('0x2f')][_0x1e7e('0x1d')]);_0x29ea82[_0x1e7e('0x1b')]=qs[_0x1e7e('0x1b')](_0x510f56[_0x1e7e('0x2f')][_0x1e7e('0x1b')]);}_0x29ea82[_0x1e7e('0x38')]=qs[_0x1e7e('0x39')](_0x510f56[_0x1e7e('0x2f')][_0x1e7e('0x39')]);delete _0x510f56[_0x1e7e('0x2f')][_0x1e7e('0x39')];_0x29ea82[_0x1e7e('0x3a')]=qs[_0x1e7e('0x31')](_['pick'](_0x510f56[_0x1e7e('0x2f')],_0x1d2ff1[_0x1e7e('0x31')]),_0x36e690);if(_0x510f56['query'][_0x1e7e('0x3b')]){_0x29ea82[_0x1e7e('0x3a')]=_[_0x1e7e('0x3c')](_0x29ea82['where'],{'$or':_[_0x1e7e('0x28')](_0x36e690,function(_0x1c83af){if(_0x1c83af['type']!==_0x1e7e('0x3d')){var _0x584d03={};_0x584d03[_0x1c83af['name']]={'$like':'%'+_0x510f56[_0x1e7e('0x2f')]['filter']+'%'};return _0x584d03;}})});}_0x29ea82=_[_0x1e7e('0x3c')]({},_0x29ea82,_0x510f56[_0x1e7e('0x3e')]);var _0x22f3e6={'where':_0x29ea82['where']};return db[_0x1e7e('0x29')][_0x1e7e('0x1e')](_0x22f3e6)[_0x1e7e('0x23')](function(_0x2ad671){_0x23f58d[_0x1e7e('0x1e')]=_0x2ad671;if(_0x510f56[_0x1e7e('0x2f')][_0x1e7e('0x3f')]){_0x29ea82[_0x1e7e('0x40')]=[{'all':!![]}];}return db[_0x1e7e('0x29')]['findAll'](_0x29ea82);})[_0x1e7e('0x23')](function(_0x3b5906){_0x23f58d['rows']=_0x3b5906;return _0x23f58d;})[_0x1e7e('0x23')](respondWithFilteredResult(_0x4b2f2b,_0x29ea82))[_0x1e7e('0x41')](handleError(_0x4b2f2b,null));};exports[_0x1e7e('0x42')]=function(_0x32b23d,_0x525193){var _0x25c84c={'raw':![],'where':{'id':_0x32b23d[_0x1e7e('0x43')]['id']}},_0x4f0cc8={};_0x4f0cc8[_0x1e7e('0x2e')]=_[_0x1e7e('0x30')](db[_0x1e7e('0x29')]['rawAttributes']);_0x4f0cc8[_0x1e7e('0x2f')]=_['keys'](_0x32b23d[_0x1e7e('0x2f')]);_0x4f0cc8[_0x1e7e('0x31')]=_[_0x1e7e('0x32')](_0x4f0cc8[_0x1e7e('0x2e')],_0x4f0cc8[_0x1e7e('0x2f')]);_0x25c84c[_0x1e7e('0x34')]=_['intersection'](_0x4f0cc8[_0x1e7e('0x2e')],qs[_0x1e7e('0x33')](_0x32b23d['query'][_0x1e7e('0x33')]));_0x25c84c[_0x1e7e('0x34')]=_0x25c84c[_0x1e7e('0x34')]['length']?_0x25c84c['attributes']:_0x4f0cc8[_0x1e7e('0x2e')];if(_0x32b23d[_0x1e7e('0x2f')]['includeAll']){_0x25c84c[_0x1e7e('0x40')]=[{'all':!![]}];}_0x25c84c=_[_0x1e7e('0x3c')]({},_0x25c84c,_0x32b23d[_0x1e7e('0x3e')]);return db['VoiceMusicOnHold'][_0x1e7e('0x44')](_0x25c84c)[_0x1e7e('0x23')](handleEntityNotFound(_0x525193,null))['then'](respondWithResult(_0x525193,null))[_0x1e7e('0x41')](handleError(_0x525193,null));};exports[_0x1e7e('0x22')]=function(_0x5cb3b9,_0x35f8a4){if(_0x5cb3b9['body']['id']){delete _0x5cb3b9['body']['id'];}return db[_0x1e7e('0x29')]['find']({'where':{'id':_0x5cb3b9[_0x1e7e('0x43')]['id']}})[_0x1e7e('0x23')](handleEntityNotFound(_0x35f8a4,null))[_0x1e7e('0x23')](saveUpdates(_0x5cb3b9[_0x1e7e('0x45')],null))[_0x1e7e('0x23')](respondWithResult(_0x35f8a4,null))[_0x1e7e('0x41')](handleError(_0x35f8a4,null));};exports[_0x1e7e('0x46')]=function(_0x336801,_0x4578e0,_0x475b7c){return db[_0x1e7e('0x47')][_0x1e7e('0x48')](function(_0x2fb0cb){if(_0x336801['body']['mode']===_0x1e7e('0x49')){_0x336801[_0x1e7e('0x45')]['directory']=path[_0x1e7e('0x4a')](config['root'],_0x1e7e('0x4b'),_0x336801[_0x1e7e('0x45')][_0x1e7e('0x25')]);}return db[_0x1e7e('0x29')][_0x1e7e('0x46')](_0x336801[_0x1e7e('0x45')],{'transaction':_0x2fb0cb})[_0x1e7e('0x23')](function(_0xbf14b3){if(_0x336801[_0x1e7e('0x45')][_0x1e7e('0x4c')]===_0x1e7e('0x49')){fs[_0x1e7e('0x4d')](_0xbf14b3[_0x1e7e('0x4e')],parseInt(_0x1e7e('0x4f'),0x8));}var _0x1cc2d5=_0x336801[_0x1e7e('0x50')][_0x1e7e('0x51')]({'plain':!![]});if(!_0x1cc2d5)throw new Error(_0x1e7e('0x52'));if(_0x1cc2d5[_0x1e7e('0x53')]===_0x1e7e('0x50')){var _0x2838e3=_0xbf14b3[_0x1e7e('0x51')]({'plain':!![]});return db[_0x1e7e('0x54')]['find']({'where':{'name':_0x1e7e('0x55'),'userProfileId':_0x1cc2d5[_0x1e7e('0x56')]},'raw':!![]})[_0x1e7e('0x23')](function(_0x454b69){if(_0x454b69&&_0x454b69[_0x1e7e('0x57')]===0x0){return db[_0x1e7e('0x24')]['create']({'name':_0x2838e3['name'],'resourceId':_0x2838e3['id'],'type':_0x454b69['name'],'sectionId':_0x454b69['id']},{})[_0x1e7e('0x23')](function(){return _0xbf14b3;});}else{return _0xbf14b3;}})['catch'](function(_0x434e32){logger[_0x1e7e('0x58')](_0x1e7e('0x59'),_0x434e32);});}return _0xbf14b3;});})[_0x1e7e('0x23')](respondWithResult(_0x4578e0,0xc9))[_0x1e7e('0x41')](handleError(_0x4578e0,null));};exports['destroy']=function(_0x4fbfe9,_0x3902cd,_0x2325f8){var _0x499223;return db[_0x1e7e('0x29')][_0x1e7e('0x44')]({'where':{'id':_0x4fbfe9[_0x1e7e('0x43')]['id']}})[_0x1e7e('0x23')](function(_0x80667a){if(_0x80667a){return db[_0x1e7e('0x47')][_0x1e7e('0x48')](function(_0x3a39bc){return _0x80667a[_0x1e7e('0x5a')]({'transaction':_0x3a39bc,'raw':!![]})[_0x1e7e('0x23')](function(_0x4cfb40){if(_0x4cfb40[_0x1e7e('0x4e')]){fs['readdirSync'](_0x4cfb40[_0x1e7e('0x4e')])[_0x1e7e('0x5b')](function(_0x5c0674){fs['unlinkSync'](path['join'](_0x4cfb40[_0x1e7e('0x4e')],_0x5c0674));});fs['rmdirSync'](_0x4cfb40['directory']);}return _0x4cfb40;});})[_0x1e7e('0x41')](function(_0x4b4d01){throw new db[(_0x1e7e('0x5c'))][(_0x1e7e('0x5d'))](_0x4b4d01[_0x1e7e('0x5e')]);});}})[_0x1e7e('0x23')](handleEntityNotFound(_0x3902cd,null))[_0x1e7e('0x23')](removeEntity(_0x3902cd,null))[_0x1e7e('0x41')](handleError(_0x3902cd,null));};exports[_0x1e7e('0x5f')]=function(_0x3f86dd,_0x43afad,_0x548e07){return db['sequelize'][_0x1e7e('0x48')](function(_0x1cb09f){var _0xdb64f3;return db['VoiceMusicOnHold'][_0x1e7e('0x44')]({'where':{'id':_0x3f86dd[_0x1e7e('0x43')]['id']}})[_0x1e7e('0x23')](function(_0x1fb135){if(_0x1fb135){_0xdb64f3=_0x1fb135;return _0x1fb135[_0x1e7e('0x5f')](_0x3f86dd[_0x1e7e('0x45')]['id'],{'transaction':_0x1cb09f});}})[_0x1e7e('0x23')](function(_0x2bd893){if(_0x2bd893){return db[_0x1e7e('0x60')][_0x1e7e('0x61')]({'where':{'id':_0x3f86dd[_0x1e7e('0x45')]['id']},'attributes':['id','name','save_name','converted_format',_0x1e7e('0x62')],'raw':!![]});}})[_0x1e7e('0x23')](function(_0x5e4cf9){if(_0x5e4cf9){var _0x4b9c05=path[_0x1e7e('0x4a')](config[_0x1e7e('0x63')],_0x1e7e('0x64'),util['format'](_0x1e7e('0x65'),path[_0x1e7e('0x66')](_0x5e4cf9['save_name'],path[_0x1e7e('0x67')](_0x5e4cf9['save_name'])),_0x5e4cf9[_0x1e7e('0x68')]));var _0x3e78f0=path[_0x1e7e('0x4a')](config[_0x1e7e('0x63')],_0x1e7e('0x4b'),_0xdb64f3[_0x1e7e('0x25')],util[_0x1e7e('0x69')]('%s.%s',_0x5e4cf9[_0x1e7e('0x25')],_0x5e4cf9[_0x1e7e('0x68')]));fs[_0x1e7e('0x6a')](_0x4b9c05,_0x3e78f0);return _0x5e4cf9;}})['catch'](function(_0x2d0402){throw new db[(_0x1e7e('0x5c'))][(_0x1e7e('0x5d'))](_0x2d0402[_0x1e7e('0x5e')]);});})['then'](handleEntityNotFound(_0x43afad,null))['then'](respondWithResult(_0x43afad,0xc9))[_0x1e7e('0x41')](handleError(_0x43afad,null));};exports[_0x1e7e('0x6b')]=function(_0x1c5f6f,_0x13cb2b,_0x4ef699){return db[_0x1e7e('0x47')][_0x1e7e('0x48')](function(_0xe4ef3d){var _0x469748;return db[_0x1e7e('0x29')][_0x1e7e('0x61')]({'where':{'id':_0x1c5f6f[_0x1e7e('0x43')]['id']}})['then'](handleEntityNotFound(_0x13cb2b,null))['then'](function(_0x535b98){if(_0x535b98){_0x469748=_0x535b98;return _0x535b98[_0x1e7e('0x6b')](_0x1c5f6f[_0x1e7e('0x43')][_0x1e7e('0x6c')]);}})['then'](function(_0x3300b2){if(_0x3300b2){return db[_0x1e7e('0x60')][_0x1e7e('0x61')]({'where':{'id':_0x1c5f6f[_0x1e7e('0x43')][_0x1e7e('0x6c')]},'attributes':['id',_0x1e7e('0x25'),_0x1e7e('0x6d'),'converted_format',_0x1e7e('0x62')],'raw':!![]});}})[_0x1e7e('0x23')](function(_0x4b6c41){if(_0x4b6c41){fs[_0x1e7e('0x6e')](path[_0x1e7e('0x4a')](_0x469748[_0x1e7e('0x4e')],util[_0x1e7e('0x69')](_0x1e7e('0x65'),_0x4b6c41[_0x1e7e('0x25')],_0x4b6c41[_0x1e7e('0x68')])));return _0x4b6c41;}})['catch'](function(_0x58c724){throw new db[(_0x1e7e('0x5c'))][(_0x1e7e('0x5d'))](_0x58c724[_0x1e7e('0x5e')]);});})[_0x1e7e('0x23')](handleEntityNotFound(_0x13cb2b,null))[_0x1e7e('0x23')](respondWithStatusCode(_0x13cb2b,0xcc))[_0x1e7e('0x41')](handleError(_0x13cb2b,null));};exports[_0x1e7e('0x6f')]=function(_0x2ef2cc,_0x38b39b,_0x180f8b){var _0x45017e={};var _0x22188a={};var _0x119918;var _0x395a75;return db[_0x1e7e('0x29')]['findOne']({'where':{'id':_0x2ef2cc['params']['id']}})[_0x1e7e('0x23')](handleEntityNotFound(_0x38b39b,null))[_0x1e7e('0x23')](function(_0x4ff8b1){if(_0x4ff8b1){_0x119918=_0x4ff8b1;_0x22188a['model']=_[_0x1e7e('0x30')](db[_0x1e7e('0x60')][_0x1e7e('0x2a')]);_0x22188a['query']=_[_0x1e7e('0x30')](_0x2ef2cc[_0x1e7e('0x2f')]);_0x22188a['filters']=_[_0x1e7e('0x32')](_0x22188a[_0x1e7e('0x2e')],_0x22188a[_0x1e7e('0x2f')]);_0x45017e[_0x1e7e('0x34')]=_[_0x1e7e('0x32')](_0x22188a[_0x1e7e('0x2e')],qs[_0x1e7e('0x33')](_0x2ef2cc[_0x1e7e('0x2f')][_0x1e7e('0x33')]));_0x45017e[_0x1e7e('0x34')]=_0x45017e[_0x1e7e('0x34')][_0x1e7e('0x35')]?_0x45017e['attributes']:_0x22188a[_0x1e7e('0x2e')];_0x45017e[_0x1e7e('0x38')]=qs[_0x1e7e('0x39')](_0x2ef2cc[_0x1e7e('0x2f')][_0x1e7e('0x39')]);_0x45017e[_0x1e7e('0x3a')]=qs['filters'](_[_0x1e7e('0x70')](_0x2ef2cc[_0x1e7e('0x2f')],_0x22188a[_0x1e7e('0x31')]));if(_0x2ef2cc['query'][_0x1e7e('0x3b')]){_0x45017e[_0x1e7e('0x3a')]=_[_0x1e7e('0x3c')](_0x45017e['where'],{'$or':_[_0x1e7e('0x28')](_0x45017e[_0x1e7e('0x34')],function(_0x1e23d6){var _0x52dc4e={};_0x52dc4e[_0x1e23d6]={'$like':'%'+_0x2ef2cc[_0x1e7e('0x2f')][_0x1e7e('0x3b')]+'%'};return _0x52dc4e;})});}_0x45017e=_[_0x1e7e('0x3c')]({},_0x45017e,_0x2ef2cc['options']);return _0x119918[_0x1e7e('0x6f')](_0x45017e);}})[_0x1e7e('0x23')](function(_0x30a643){if(_0x30a643){_0x395a75=_0x30a643[_0x1e7e('0x35')];if(!_0x2ef2cc[_0x1e7e('0x2f')]['hasOwnProperty'](_0x1e7e('0x37'))){_0x45017e[_0x1e7e('0x1d')]=qs[_0x1e7e('0x1d')](_0x2ef2cc[_0x1e7e('0x2f')][_0x1e7e('0x1d')]);_0x45017e[_0x1e7e('0x1b')]=qs[_0x1e7e('0x1b')](_0x2ef2cc[_0x1e7e('0x2f')][_0x1e7e('0x1b')]);}return _0x119918[_0x1e7e('0x6f')](_0x45017e);}})[_0x1e7e('0x23')](function(_0x4fe30d){if(_0x4fe30d){return _0x4fe30d?{'count':_0x395a75,'rows':_0x4fe30d}:null;}})[_0x1e7e('0x23')](respondWithResult(_0x38b39b,null))['catch'](handleError(_0x38b39b,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 9fc7726..b9ca255 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 _0x8903=['api','moment','bluebird','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x8903,0x172));var _0x3890=function(_0x9d2d2,_0x1c1c2c){_0x9d2d2=_0x9d2d2-0x0;var _0x488242=_0x8903[_0x9d2d2];return _0x488242;};'use strict';var _=require(_0x3890('0x0'));var util=require(_0x3890('0x1'));var logger=require('../../config/logger')(_0x3890('0x2'));var moment=require(_0x3890('0x3'));var BPromise=require(_0x3890('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3890('0x5'));var config=require(_0x3890('0x6'));var attributes=require(_0x3890('0x7'));module[_0x3890('0x8')]=function(_0x4df29d,_0x1f8bcc){return _0x4df29d[_0x3890('0x9')](_0x3890('0xa'),attributes,{'tableName':_0x3890('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81fb=['request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','api','moment'];(function(_0x47184f,_0x599caf){var _0x5c94c7=function(_0x1415c2){while(--_0x1415c2){_0x47184f['push'](_0x47184f['shift']());}};_0x5c94c7(++_0x599caf);}(_0x81fb,0x166));var _0xb81f=function(_0x546313,_0x320910){_0x546313=_0x546313-0x0;var _0x283e31=_0x81fb[_0x546313];return _0x283e31;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb81f('0x0'));var moment=require(_0xb81f('0x1'));var BPromise=require('bluebird');var rp=require(_0xb81f('0x2'));var fs=require('fs');var path=require(_0xb81f('0x3'));var rimraf=require(_0xb81f('0x4'));var config=require('../../config/environment');var attributes=require(_0xb81f('0x5'));module[_0xb81f('0x6')]=function(_0x21d004,_0x425437){return _0x21d004[_0xb81f('0x7')](_0xb81f('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 25f61e8..d0d279e 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 _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3fd0c8,_0x619d0f){var _0x1cc138=function(_0x5e32f0){while(--_0x5e32f0){_0x3fd0c8['push'](_0x3fd0c8['shift']());}};_0x1cc138(++_0x619d0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x5257fa,_0xc76f87){var _0x444e8d=function(_0x16e540){while(--_0x16e540){_0x5257fa['push'](_0x5257fa['shift']());}};_0x444e8d(++_0xc76f87);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0xcb91[_0x35fabd];return _0x61a8ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index b21f30a..deefcf7 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 _0xaa96=['put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams'];(function(_0x5165a2,_0x2fc38d){var _0x5edefb=function(_0x275942){while(--_0x275942){_0x5165a2['push'](_0x5165a2['shift']());}};_0x5edefb(++_0x2fc38d);}(_0xaa96,0x145));var _0x6aa9=function(_0x485ec0,_0x4c1c93){_0x485ec0=_0x485ec0-0x0;var _0x12cb19=_0xaa96[_0x485ec0];return _0x12cb19;};'use strict';var multer=require('multer');var util=require(_0x6aa9('0x0'));var path=require(_0x6aa9('0x1'));var timeout=require(_0x6aa9('0x2'));var express=require(_0x6aa9('0x3'));var router=express[_0x6aa9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6aa9('0x5'));var interaction=require(_0x6aa9('0x6'));var config=require(_0x6aa9('0x7'));var controller=require(_0x6aa9('0x8'));router[_0x6aa9('0x9')]('/',auth[_0x6aa9('0xa')](),controller[_0x6aa9('0xb')]);router[_0x6aa9('0x9')](_0x6aa9('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6aa9('0x9')](_0x6aa9('0xd'),auth['isAuthenticated'](),controller[_0x6aa9('0xe')]);router[_0x6aa9('0x9')](_0x6aa9('0xf'),auth[_0x6aa9('0xa')](),controller[_0x6aa9('0x10')]);router[_0x6aa9('0x9')](_0x6aa9('0x11'),auth[_0x6aa9('0xa')](),controller[_0x6aa9('0x12')]);router[_0x6aa9('0x13')]('/',auth[_0x6aa9('0xa')](),controller[_0x6aa9('0x14')]);router[_0x6aa9('0x13')](_0x6aa9('0xf'),auth[_0x6aa9('0xa')](),controller[_0x6aa9('0x15')]);router[_0x6aa9('0x13')]('/:id/teams',auth[_0x6aa9('0xa')](),controller[_0x6aa9('0x16')]);router[_0x6aa9('0x17')]('/:id',auth[_0x6aa9('0xa')](),controller[_0x6aa9('0x18')]);router[_0x6aa9('0x19')]('/:id',auth[_0x6aa9('0xa')](),controller[_0x6aa9('0x1a')]);router[_0x6aa9('0x19')]('/:id/users',auth[_0x6aa9('0xa')](),controller[_0x6aa9('0x1b')]);router[_0x6aa9('0x19')](_0x6aa9('0x11'),auth[_0x6aa9('0xa')](),controller['removeTeams']);module[_0x6aa9('0x1c')]=router; \ No newline at end of file +var _0x1979=['update','destroy','delete','removeAgents','removeTeams','exports','multer','path','express','Router','fs-extra','../../config/environment','./voicePrefix.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/users','getAgents','/:id/teams','post','create','addAgents'];(function(_0x344f34,_0xa3259c){var _0x226dbb=function(_0x21bfcf){while(--_0x21bfcf){_0x344f34['push'](_0x344f34['shift']());}};_0x226dbb(++_0xa3259c);}(_0x1979,0xa2));var _0x9197=function(_0x2ef8c1,_0x2f72f4){_0x2ef8c1=_0x2ef8c1-0x0;var _0x288305=_0x1979[_0x2ef8c1];return _0x288305;};'use strict';var multer=require(_0x9197('0x0'));var util=require('util');var path=require(_0x9197('0x1'));var timeout=require('connect-timeout');var express=require(_0x9197('0x2'));var router=express[_0x9197('0x3')]();var fs_extra=require(_0x9197('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9197('0x5'));var controller=require(_0x9197('0x6'));router[_0x9197('0x7')]('/',auth['isAuthenticated'](),controller[_0x9197('0x8')]);router[_0x9197('0x7')](_0x9197('0x9'),auth[_0x9197('0xa')](),controller[_0x9197('0xb')]);router[_0x9197('0x7')](_0x9197('0xc'),auth[_0x9197('0xa')](),controller[_0x9197('0xd')]);router['get'](_0x9197('0xe'),auth['isAuthenticated'](),controller[_0x9197('0xf')]);router[_0x9197('0x7')](_0x9197('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x9197('0x11')]('/',auth['isAuthenticated'](),controller[_0x9197('0x12')]);router[_0x9197('0x11')](_0x9197('0xe'),auth[_0x9197('0xa')](),controller[_0x9197('0x13')]);router[_0x9197('0x11')]('/:id/teams',auth[_0x9197('0xa')](),controller['addTeams']);router['put'](_0x9197('0xc'),auth[_0x9197('0xa')](),controller[_0x9197('0x14')]);router['delete'](_0x9197('0xc'),auth['isAuthenticated'](),controller[_0x9197('0x15')]);router[_0x9197('0x16')](_0x9197('0xe'),auth['isAuthenticated'](),controller[_0x9197('0x17')]);router['delete'](_0x9197('0x10'),auth['isAuthenticated'](),controller[_0x9197('0x18')]);module[_0x9197('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 1d8c1de..3407b7a 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 _0x6ac6=['getDataValue','STRING','INTEGER','sequelize','exports','name','VIRTUAL'];(function(_0x5bd926,_0x5c8523){var _0x2dace8=function(_0xb7400){while(--_0xb7400){_0x5bd926['push'](_0x5bd926['shift']());}};_0x2dace8(++_0x5c8523);}(_0x6ac6,0x106));var _0x66ac=function(_0x1ac8af,_0x22fc84){_0x1ac8af=_0x1ac8af-0x0;var _0x10d365=_0x6ac6[_0x1ac8af];return _0x10d365;};'use strict';var Sequelize=require(_0x66ac('0x0'));module[_0x66ac('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x66ac('0x2')},'prefix':{'type':Sequelize[_0x66ac('0x3')],'get':function(_0x2880d4){return'system-'+this[_0x66ac('0x4')](_0x66ac('0x2'))+'-';}},'description':{'type':Sequelize[_0x66ac('0x5')]},'callerIdAll':{'type':Sequelize[_0x66ac('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x66ac('0x6')]}}; \ No newline at end of file +var _0xf480=['exports','STRING','name','VIRTUAL','INTEGER'];(function(_0x53a9d1,_0x43b853){var _0x5f4a8d=function(_0x1d96fb){while(--_0x1d96fb){_0x53a9d1['push'](_0x53a9d1['shift']());}};_0x5f4a8d(++_0x43b853);}(_0xf480,0xe6));var _0x0f48=function(_0x51526a,_0x34a95e){_0x51526a=_0x51526a-0x0;var _0x1c5c45=_0xf480[_0x51526a];return _0x1c5c45;};'use strict';var Sequelize=require('sequelize');module[_0x0f48('0x0')]={'name':{'type':Sequelize[_0x0f48('0x1')],'allowNull':![],'unique':_0x0f48('0x2')},'prefix':{'type':Sequelize[_0x0f48('0x3')],'get':function(_0x11ceb5){return'system-'+this['getDataValue'](_0x0f48('0x2'))+'-';}},'description':{'type':Sequelize[_0x0f48('0x1')]},'callerIdAll':{'type':Sequelize[_0x0f48('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x0f48('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index ea9faf6..6fec540 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 _0xb78e=['userVoicePrefix:remove','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','get','VoicePrefixes','destroy','sendStatus','name','index','map','VoicePrefix','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','include','findAll','catch','params','keys','rawAttributes','length','includeAll','find','create','sequelize','transaction','body','VoiceExtension','user','userProfileId','autoAssociation','error','exten','app','system','description','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','omit','ids','spread','emit','removeAgents','getAgents','User','pick','merge','getTeams','findOne','Team','addTeams','Agents','online','interface','flatMap','each','upsert','UserVoicePrefix','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty'];(function(_0xc889e1,_0x438415){var _0x17ab9e=function(_0x1ae369){while(--_0x1ae369){_0xc889e1['push'](_0xc889e1['shift']());}};_0x17ab9e(++_0x438415);}(_0xb78e,0x1c9));var _0xeb78=function(_0x20f5be,_0x4a42cc){_0x20f5be=_0x20f5be-0x0;var _0x549df3=_0xb78e[_0x20f5be];return _0x549df3;};'use strict';var emlformat=require(_0xeb78('0x0'));var rimraf=require(_0xeb78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb78('0x2'));var rp=require(_0xeb78('0x3'));var moment=require(_0xeb78('0x4'));var BPromise=require(_0xeb78('0x5'));var Mustache=require(_0xeb78('0x6'));var util=require(_0xeb78('0x7'));var path=require(_0xeb78('0x8'));var sox=require(_0xeb78('0x9'));var csv=require('to-csv');var ejs=require(_0xeb78('0xa'));var fs=require('fs');var fs_extra=require(_0xeb78('0xb'));var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var licenseUtil=require(_0xeb78('0x1b'));var db=require(_0xeb78('0x1c'))['db'];config[_0xeb78('0x1d')]=_[_0xeb78('0x1e')](config[_0xeb78('0x1d')],{'host':_0xeb78('0x1f'),'port':0x18eb});var socket=require(_0xeb78('0x20'))(new Redis(config[_0xeb78('0x1d')]));require(_0xeb78('0x21'))['register'](socket);function respondWithStatusCode(_0x315914,_0x3e4d24){_0x3e4d24=_0x3e4d24||0xcc;return function(_0x4e8b8c){if(_0x4e8b8c){return _0x315914['sendStatus'](_0x3e4d24);}return _0x315914['status'](_0x3e4d24)[_0xeb78('0x22')]();};}function respondWithResult(_0x50ebae,_0xa28d5e){_0xa28d5e=_0xa28d5e||0xc8;return function(_0x247cb1){if(_0x247cb1){return _0x50ebae['status'](_0xa28d5e)[_0xeb78('0x23')](_0x247cb1);}};}function respondWithFilteredResult(_0x53c811,_0x21c521){return function(_0x92e410){if(_0x92e410){var _0x576802=typeof _0x21c521[_0xeb78('0x24')]===_0xeb78('0x25')&&typeof _0x21c521[_0xeb78('0x26')]==='undefined';var _0x24d845=_0x92e410[_0xeb78('0x27')];var _0x4ab933=_0x576802?0x0:_0x21c521['offset'];var _0x455e30=_0x576802?_0x92e410[_0xeb78('0x27')]:_0x21c521[_0xeb78('0x24')]+_0x21c521[_0xeb78('0x26')];var _0x432b18;if(_0x455e30>=_0x24d845){_0x455e30=_0x24d845;_0x432b18=0xc8;}else{_0x432b18=0xce;}_0x53c811[_0xeb78('0x28')](_0x432b18);return _0x53c811[_0xeb78('0x29')](_0xeb78('0x2a'),_0x4ab933+'-'+_0x455e30+'/'+_0x24d845)[_0xeb78('0x23')](_0x92e410);}return null;};}function patchUpdates(_0x52b8c1){return function(_0x5d3cf8){try{jsonpatch['apply'](_0x5d3cf8,_0x52b8c1,!![]);}catch(_0x5c9e0d){return BPromise[_0xeb78('0x2b')](_0x5c9e0d);}return _0x5d3cf8['save']();};}function saveUpdates(_0x2159c1,_0x1fbf2f){return function(_0x566336){if(_0x566336){return _0x566336[_0xeb78('0x2c')](_0x2159c1)['then'](function(_0x9a00b){return _0x9a00b;});}return null;};}function removeEntity(_0x5fc575,_0x315f98){return function(_0x12b3b2){if(_0x12b3b2){return _0x12b3b2['destroy']()[_0xeb78('0x2d')](function(){var _0x515158=_0x12b3b2[_0xeb78('0x2e')]({'plain':!![]});var _0x23295a=_0xeb78('0x2f');return db['UserProfileResource'][_0xeb78('0x30')]({'where':{'type':_0x23295a,'resourceId':_0x515158['id']}})[_0xeb78('0x2d')](function(){return _0x12b3b2;});})[_0xeb78('0x2d')](function(){_0x5fc575[_0xeb78('0x28')](0xcc)[_0xeb78('0x22')]();});}};}function handleEntityNotFound(_0x3516b8,_0x1131a9){return function(_0x22c25f){if(!_0x22c25f){_0x3516b8[_0xeb78('0x31')](0x194);}return _0x22c25f;};}function handleError(_0x19ad00,_0x1f3a14){_0x1f3a14=_0x1f3a14||0x1f4;return function(_0x505468){logger['error'](_0x505468['stack']);if(_0x505468[_0xeb78('0x32')]){delete _0x505468[_0xeb78('0x32')];}_0x19ad00[_0xeb78('0x28')](_0x1f3a14)['send'](_0x505468);};}exports[_0xeb78('0x33')]=function(_0x1ecdfb,_0x3de59f){var _0x83b35d={},_0x4e720c={},_0x1a0ce6={'count':0x0,'rows':[]};var _0x1ec0bc=_[_0xeb78('0x34')](db[_0xeb78('0x35')]['rawAttributes'],function(_0x3ff33f){return{'name':_0x3ff33f['fieldName'],'type':_0x3ff33f[_0xeb78('0x36')][_0xeb78('0x37')]};});_0x4e720c[_0xeb78('0x38')]=_[_0xeb78('0x34')](_0x1ec0bc,_0xeb78('0x32'));_0x4e720c[_0xeb78('0x39')]=_['keys'](_0x1ecdfb['query']);_0x4e720c[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x4e720c[_0xeb78('0x38')],_0x4e720c[_0xeb78('0x39')]);_0x83b35d[_0xeb78('0x3c')]=_['intersection'](_0x4e720c[_0xeb78('0x38')],qs[_0xeb78('0x3d')](_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x83b35d[_0xeb78('0x3c')]=_0x83b35d[_0xeb78('0x3c')]['length']?_0x83b35d['attributes']:_0x4e720c['model'];if(!_0x1ecdfb['query'][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x83b35d[_0xeb78('0x26')]=qs['limit'](_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x26')]);_0x83b35d['offset']=qs['offset'](_0x1ecdfb['query'][_0xeb78('0x24')]);}_0x83b35d[_0xeb78('0x40')]=qs[_0xeb78('0x41')](_0x1ecdfb['query'][_0xeb78('0x41')]);_0x83b35d[_0xeb78('0x42')]=qs[_0xeb78('0x3a')](_['pick'](_0x1ecdfb[_0xeb78('0x39')],_0x4e720c[_0xeb78('0x3a')]),_0x1ec0bc);if(_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x43')]){_0x83b35d['where']=_['merge'](_0x83b35d[_0xeb78('0x42')],{'$or':_[_0xeb78('0x34')](_0x1ec0bc,function(_0x2e416b){if(_0x2e416b[_0xeb78('0x36')]!==_0xeb78('0x44')){var _0x2fbdb4={};_0x2fbdb4[_0x2e416b[_0xeb78('0x32')]]={'$like':'%'+_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x43')]+'%'};return _0x2fbdb4;}})});}_0x83b35d=_['merge']({},_0x83b35d,_0x1ecdfb[_0xeb78('0x45')]);var _0xa02a32={'where':_0x83b35d[_0xeb78('0x42')]};return db['VoicePrefix'][_0xeb78('0x27')](_0xa02a32)['then'](function(_0x21f81b){_0x1a0ce6[_0xeb78('0x27')]=_0x21f81b;if(_0x1ecdfb[_0xeb78('0x39')]['includeAll']){_0x83b35d[_0xeb78('0x46')]=[{'all':!![]}];}return db[_0xeb78('0x35')][_0xeb78('0x47')](_0x83b35d);})[_0xeb78('0x2d')](function(_0x2dc9f7){_0x1a0ce6['rows']=_0x2dc9f7;return _0x1a0ce6;})[_0xeb78('0x2d')](respondWithFilteredResult(_0x3de59f,_0x83b35d))[_0xeb78('0x48')](handleError(_0x3de59f,null));};exports['show']=function(_0xece1cb,_0x31a146){var _0x1f2610={'raw':![],'where':{'id':_0xece1cb[_0xeb78('0x49')]['id']}},_0x51dfbc={};_0x51dfbc[_0xeb78('0x38')]=_[_0xeb78('0x4a')](db[_0xeb78('0x35')][_0xeb78('0x4b')]);_0x51dfbc[_0xeb78('0x39')]=_['keys'](_0xece1cb['query']);_0x51dfbc[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x51dfbc['model'],_0x51dfbc[_0xeb78('0x39')]);_0x1f2610[_0xeb78('0x3c')]=_[_0xeb78('0x3b')](_0x51dfbc[_0xeb78('0x38')],qs[_0xeb78('0x3d')](_0xece1cb[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x1f2610[_0xeb78('0x3c')]=_0x1f2610[_0xeb78('0x3c')][_0xeb78('0x4c')]?_0x1f2610[_0xeb78('0x3c')]:_0x51dfbc[_0xeb78('0x38')];if(_0xece1cb[_0xeb78('0x39')][_0xeb78('0x4d')]){_0x1f2610[_0xeb78('0x46')]=[{'all':!![]}];}_0x1f2610=_['merge']({},_0x1f2610,_0xece1cb[_0xeb78('0x45')]);return db[_0xeb78('0x35')][_0xeb78('0x4e')](_0x1f2610)[_0xeb78('0x2d')](handleEntityNotFound(_0x31a146,null))['then'](respondWithResult(_0x31a146,null))[_0xeb78('0x48')](handleError(_0x31a146,null));};exports[_0xeb78('0x30')]=function(_0xcaccc5,_0x3d30a4){return db[_0xeb78('0x35')]['find']({'where':{'id':_0xcaccc5['params']['id']}})['then'](handleEntityNotFound(_0x3d30a4,null))[_0xeb78('0x2d')](removeEntity(_0x3d30a4,null))[_0xeb78('0x48')](handleError(_0x3d30a4,null));};exports['describe']=function(_0x10efdb,_0x43164f){return db[_0xeb78('0x35')]['describe']()['then'](respondWithResult(_0x43164f,null))[_0xeb78('0x48')](handleError(_0x43164f,null));};exports[_0xeb78('0x4f')]=function(_0x1f5b67,_0x4e3f1a){var _0x3c7214;return db[_0xeb78('0x50')][_0xeb78('0x51')](function(_0x4a3c91){return db['VoicePrefix']['create'](_0x1f5b67[_0xeb78('0x52')],{'transaction':_0x4a3c91})[_0xeb78('0x2d')](function(_0x55c643){_0x3c7214=_0x55c643[_0xeb78('0x2e')]({'plain':!![]});return db[_0xeb78('0x53')][_0xeb78('0x4e')]({'where':{'id':_0x3c7214['VoiceExtensionId']},'raw':!![]})[_0xeb78('0x2d')](function(_0x572aaf){return createVoicePrefixExtensions(_0x3c7214,_0x572aaf,_0x4a3c91);});});})[_0xeb78('0x2d')](function(){var _0x151083=_0x1f5b67[_0xeb78('0x54')]['get']({'plain':!![]});if(!_0x151083)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x151083['role']==='user'){var _0x3238e9=_0x3c7214;return db['UserProfileSection'][_0xeb78('0x4e')]({'where':{'name':_0xeb78('0x2f'),'userProfileId':_0x151083[_0xeb78('0x55')]},'raw':!![]})[_0xeb78('0x2d')](function(_0x2a1f7f){if(_0x2a1f7f&&_0x2a1f7f[_0xeb78('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x3238e9[_0xeb78('0x32')],'resourceId':_0x3238e9['id'],'type':_0x2a1f7f[_0xeb78('0x32')],'sectionId':_0x2a1f7f['id']},{})[_0xeb78('0x2d')](function(){return _0x3c7214;});}else{return _0x3c7214;}})[_0xeb78('0x48')](function(_0x480093){logger[_0xeb78('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x480093);throw _0x480093;});}return _0x3c7214;})[_0xeb78('0x2d')](respondWithResult(_0x4e3f1a,null))[_0xeb78('0x48')](handleError(_0x4e3f1a,null));};function Extension(_0x1d4761,_0x5b4998,_0x363cec,_0x37649c){this['context']='from-sip';this[_0xeb78('0x58')]=_0x1d4761;this[_0xeb78('0x59')]=_0x363cec;this['type']=_0xeb78('0x5a');this[_0xeb78('0x5b')]='Voice\x20Prefix\x20Extension';this['priority']=_0x5b4998;this[_0xeb78('0x5c')]=_0x37649c;}function createVoicePrefixExtensions(_0x5baf31,_0x539ad7,_0x2029ea){return new BPromise(function(_0x486899,_0x27b425){var _0x42c249=new Extension(formatPrefixName(_0x5baf31[_0xeb78('0x5d')]),0x1,'NoOp',_0xeb78('0x5e'));_0x42c249[_0xeb78('0x5f')]=_0x5baf31['id'];return db[_0xeb78('0x53')]['create'](_0x42c249,{'transaction':_0x2029ea})[_0xeb78('0x2d')](function(_0x4ec4ec){var _0xd61214=_0x4ec4ec[_0xeb78('0x2e')]({'plain':!![]});var _0x45aeaf=_[_0xeb78('0x34')](addVoicePrefixExtensions(_0x5baf31,_0x539ad7),function(_0x50d38d){_0x50d38d[_0xeb78('0x60')]=_0xd61214['id'];_0x50d38d['VoicePrefixId']=_0x5baf31['id'];return _0x50d38d;});return db[_0xeb78('0x53')][_0xeb78('0x61')](_0x45aeaf,{'transaction':_0x2029ea})[_0xeb78('0x2d')](function(_0x442fa7){if(!_0x442fa7){return _0x27b425(_0xeb78('0x62'));}else{return _0x486899(_0x442fa7);}})['catch'](function(_0x2ffe3b){return _0x27b425(_0x2ffe3b);});});;});};function addVoicePrefixExtensions(_0x2bf5a8,_0xf7eebe){var _0x22aa3a=[];var _0x3eb9c5=formatPrefixName(_0x2bf5a8[_0xeb78('0x5d')]);_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x2,_0xeb78('0x64'),_0xeb78('0x65')+_0x2bf5a8[_0xeb78('0x32')]));if(_0x2bf5a8[_0xeb78('0x66')]){_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x3,_0xeb78('0x64'),_0xeb78('0x67')+_0x2bf5a8[_0xeb78('0x66')]));}else{_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x3,'NoOp',_0xeb78('0x68')));}_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x4,_0xeb78('0x69'),_0xf7eebe['context']+','+_0xeb78('0x6a')+(0x8+_0x2bf5a8[_0xeb78('0x32')][_0xeb78('0x4c')])+'}'+','+0x1));return _0x22aa3a;}function formatPrefixName(_0x2208c2){var _0xe88f54='_';for(var _0x2d6f67=0x0;_0x2d6f67<_0x2208c2[_0xeb78('0x4c')];_0x2d6f67++){if(_0x2208c2[_0xeb78('0x6b')](_0x2d6f67)=='-'){_0xe88f54+=_0x2208c2[_0xeb78('0x6b')](_0x2d6f67);}else{_0xe88f54+='['+_0x2208c2['charAt'](_0x2d6f67)+']';}}_0xe88f54+='.';return _0xe88f54;}exports['update']=function(_0x2bf610,_0x129e0e,_0x44a2c8){var _0x30c186=_0x2bf610[_0xeb78('0x52')];_0x30c186[_0xeb78('0x5d')]=_0xeb78('0x6c')+_0x30c186[_0xeb78('0x32')]+'-';return db[_0xeb78('0x50')][_0xeb78('0x51')](function(_0x5c27de){return db[_0xeb78('0x35')][_0xeb78('0x2c')](_0x30c186,{'where':{'id':_0x30c186['id']},'transaction':_0x5c27de})[_0xeb78('0x2d')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x30c186['id']},'transaction':_0x5c27de})['then'](function(){return db['VoiceExtension'][_0xeb78('0x4e')]({'where':{'id':_0x30c186[_0xeb78('0x60')]},'raw':!![]})[_0xeb78('0x2d')](function(_0xf89f26){return createVoicePrefixExtensions(_0x30c186,_0xf89f26,_0x5c27de);});});});})[_0xeb78('0x2d')](function(){return db[_0xeb78('0x35')][_0xeb78('0x6d')](_0x30c186['id']);})[_0xeb78('0x2d')](respondWithResult(_0x129e0e,null))[_0xeb78('0x48')](handleError(_0x129e0e,null));};exports[_0xeb78('0x6e')]=function(_0x259525,_0x53cf73,_0x42cfd1){return db['VoicePrefix'][_0xeb78('0x4e')]({'where':{'id':_0x259525['params']['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x53cf73,null))[_0xeb78('0x2d')](function(_0x2a9d4d){if(_0x2a9d4d){return _0x2a9d4d[_0xeb78('0x6e')](_0x259525[_0xeb78('0x52')]['ids'],_[_0xeb78('0x6f')](_0x259525[_0xeb78('0x52')],[_0xeb78('0x70'),'id'])||{})[_0xeb78('0x71')](function(_0x3896a1){for(var _0x2da098=0x0;_0x2da098<_0x259525[_0xeb78('0x52')][_0xeb78('0x70')][_0xeb78('0x4c')];_0x2da098+=0x1){socket[_0xeb78('0x72')]('userVoicePrefix:save',{'UserId':Number(_0x259525[_0xeb78('0x52')][_0xeb78('0x70')][_0x2da098]),'VoicePrefixId':Number(_0x259525[_0xeb78('0x49')]['id'])});}return _0x3896a1;});}})[_0xeb78('0x2d')](respondWithResult(_0x53cf73,null))[_0xeb78('0x48')](handleError(_0x53cf73,null));};exports[_0xeb78('0x73')]=function(_0x37217c,_0x5dbfef,_0x37a587){return db['VoicePrefix'][_0xeb78('0x4e')]({'where':{'id':_0x37217c[_0xeb78('0x49')]['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x5dbfef,null))['then'](function(_0x1732e5){if(_0x1732e5){return _0x1732e5[_0xeb78('0x73')](_0x37217c['query'][_0xeb78('0x70')])[_0xeb78('0x2d')](function(){if(_['isArray'](_0x37217c[_0xeb78('0x39')][_0xeb78('0x70')])){for(var _0x1f000b=0x0;_0x1f000b<_0x37217c['query'][_0xeb78('0x70')][_0xeb78('0x4c')];_0x1f000b+=0x1){socket[_0xeb78('0x72')]('userVoicePrefix:remove',{'UserId':Number(_0x37217c[_0xeb78('0x39')][_0xeb78('0x70')][_0x1f000b]),'VoicePrefixId':Number(_0x37217c['params']['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x37217c['query'][_0xeb78('0x70')]),'VoicePrefixId':Number(_0x37217c[_0xeb78('0x49')]['id'])});}});}})[_0xeb78('0x2d')](respondWithStatusCode(_0x5dbfef,null))[_0xeb78('0x48')](handleError(_0x5dbfef,null));};exports[_0xeb78('0x74')]=function(_0x468483,_0x7fc774,_0x34a1f3){var _0x3232a8={};var _0xd3ed51={};var _0x3386f3;var _0x21e3ac;return db[_0xeb78('0x35')]['findOne']({'where':{'id':_0x468483['params']['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x7fc774,null))[_0xeb78('0x2d')](function(_0x39f1cc){if(_0x39f1cc){_0x3386f3=_0x39f1cc;_0xd3ed51[_0xeb78('0x38')]=_[_0xeb78('0x4a')](db[_0xeb78('0x75')]['rawAttributes']);_0xd3ed51[_0xeb78('0x39')]=_[_0xeb78('0x4a')](_0x468483['query']);_0xd3ed51[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0xd3ed51[_0xeb78('0x38')],_0xd3ed51[_0xeb78('0x39')]);_0x3232a8[_0xeb78('0x3c')]=_[_0xeb78('0x3b')](_0xd3ed51[_0xeb78('0x38')],qs['fields'](_0x468483[_0xeb78('0x39')]['fields']));_0x3232a8[_0xeb78('0x3c')]=_0x3232a8[_0xeb78('0x3c')][_0xeb78('0x4c')]?_0x3232a8[_0xeb78('0x3c')]:_0xd3ed51['model'];_0x3232a8[_0xeb78('0x40')]=qs['sort'](_0x468483['query'][_0xeb78('0x41')]);_0x3232a8[_0xeb78('0x42')]=qs[_0xeb78('0x3a')](_[_0xeb78('0x76')](_0x468483[_0xeb78('0x39')],_0xd3ed51[_0xeb78('0x3a')]));if(_0x468483[_0xeb78('0x39')][_0xeb78('0x43')]){_0x3232a8[_0xeb78('0x42')]=_['merge'](_0x3232a8['where'],{'$or':_[_0xeb78('0x34')](_0x3232a8[_0xeb78('0x3c')],function(_0x2ea1fe){var _0x49936c={};_0x49936c[_0x2ea1fe]={'$like':'%'+_0x468483[_0xeb78('0x39')][_0xeb78('0x43')]+'%'};return _0x49936c;})});}_0x3232a8=_[_0xeb78('0x77')]({},_0x3232a8,_0x468483[_0xeb78('0x45')]);return _0x3386f3['getAgents'](_0x3232a8);}})['then'](function(_0x493f82){if(_0x493f82){_0x21e3ac=_0x493f82['length'];if(!_0x468483[_0xeb78('0x39')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x3232a8[_0xeb78('0x26')]=qs[_0xeb78('0x26')](_0x468483[_0xeb78('0x39')]['limit']);_0x3232a8[_0xeb78('0x24')]=qs[_0xeb78('0x24')](_0x468483[_0xeb78('0x39')][_0xeb78('0x24')]);}return _0x3386f3[_0xeb78('0x74')](_0x3232a8);}})[_0xeb78('0x2d')](function(_0x51a349){if(_0x51a349){return _0x51a349?{'count':_0x21e3ac,'rows':_0x51a349}:null;}})[_0xeb78('0x2d')](respondWithResult(_0x7fc774,null))['catch'](handleError(_0x7fc774,null));};exports[_0xeb78('0x78')]=function(_0x506734,_0x30eb7c,_0x43637d){var _0x1ad737={};var _0x25cb1c={};var _0x335008;var _0x5d6506;return db[_0xeb78('0x35')][_0xeb78('0x79')]({'where':{'id':_0x506734['params']['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x30eb7c,null))['then'](function(_0x2e9eb9){if(_0x2e9eb9){_0x335008=_0x2e9eb9;_0x25cb1c['model']=_[_0xeb78('0x4a')](db[_0xeb78('0x7a')][_0xeb78('0x4b')]);_0x25cb1c[_0xeb78('0x39')]=_[_0xeb78('0x4a')](_0x506734[_0xeb78('0x39')]);_0x25cb1c[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x25cb1c['model'],_0x25cb1c[_0xeb78('0x39')]);_0x1ad737[_0xeb78('0x3c')]=_['intersection'](_0x25cb1c[_0xeb78('0x38')],qs[_0xeb78('0x3d')](_0x506734[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x1ad737[_0xeb78('0x3c')]=_0x1ad737['attributes'][_0xeb78('0x4c')]?_0x1ad737[_0xeb78('0x3c')]:_0x25cb1c['model'];_0x1ad737[_0xeb78('0x40')]=qs[_0xeb78('0x41')](_0x506734['query'][_0xeb78('0x41')]);_0x1ad737[_0xeb78('0x42')]=qs['filters'](_[_0xeb78('0x76')](_0x506734['query'],_0x25cb1c['filters']));if(_0x506734[_0xeb78('0x39')][_0xeb78('0x43')]){_0x1ad737[_0xeb78('0x42')]=_[_0xeb78('0x77')](_0x1ad737[_0xeb78('0x42')],{'$or':_[_0xeb78('0x34')](_0x1ad737[_0xeb78('0x3c')],function(_0x2da372){var _0x1a929b={};_0x1a929b[_0x2da372]={'$like':'%'+_0x506734[_0xeb78('0x39')]['filter']+'%'};return _0x1a929b;})});}_0x1ad737=_['merge']({},_0x1ad737,_0x506734[_0xeb78('0x45')]);return _0x335008[_0xeb78('0x78')](_0x1ad737);}})[_0xeb78('0x2d')](function(_0x3f99a1){if(_0x3f99a1){_0x5d6506=_0x3f99a1[_0xeb78('0x4c')];if(!_0x506734[_0xeb78('0x39')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x1ad737[_0xeb78('0x26')]=qs[_0xeb78('0x26')](_0x506734[_0xeb78('0x39')][_0xeb78('0x26')]);_0x1ad737['offset']=qs['offset'](_0x506734[_0xeb78('0x39')]['offset']);}return _0x335008[_0xeb78('0x78')](_0x1ad737);}})['then'](function(_0x577f5f){if(_0x577f5f){return _0x577f5f?{'count':_0x5d6506,'rows':_0x577f5f}:null;}})[_0xeb78('0x2d')](respondWithResult(_0x30eb7c,null))[_0xeb78('0x48')](handleError(_0x30eb7c,null));};exports[_0xeb78('0x7b')]=function(_0x371c1d,_0x29a90d,_0xb69f0e){var _0x370f7a=_0x371c1d[_0xeb78('0x52')]['ids'];var _0x12773a;return db[_0xeb78('0x7a')]['findAll']({'where':{'id':_0x370f7a},'attributes':['id'],'include':[{'model':db[_0xeb78('0x75')],'as':_0xeb78('0x7c'),'attributes':['id',_0xeb78('0x32'),_0xeb78('0x7d'),'voicePause',_0xeb78('0x7e')],'raw':!![]}]})['then'](function(_0x64848b){if(_0x64848b){_0x12773a=_0x64848b;var _0x15b7d3=_[_0xeb78('0x7f')](_0x64848b,function(_0x523dc9){var _0x2401c8=_0x523dc9[_0xeb78('0x2e')]({'plain':!![]});return _0x2401c8[_0xeb78('0x7c')];});return db[_0xeb78('0x35')][_0xeb78('0x4e')]({'where':{'id':_0x371c1d[_0xeb78('0x49')]['id']}})[_0xeb78('0x2d')](function(_0x12b7d7){return db[_0xeb78('0x50')][_0xeb78('0x51')](function(_0x3e7088){return _0x12b7d7[_0xeb78('0x7b')](_0x370f7a,{'transaction':_0x3e7088})[_0xeb78('0x2d')](function(){return BPromise[_0xeb78('0x80')](_0x12773a,function(_0x5b1d20){return db['TeamVoicePrefix'][_0xeb78('0x81')]({'TeamId':_0x5b1d20['id'],'VoicePrefixId':_0x371c1d[_0xeb78('0x49')]['id']},{'transaction':_0x3e7088});});})[_0xeb78('0x2d')](function(){return BPromise[_0xeb78('0x80')](_0x15b7d3,function(_0x4c2c7e){return db[_0xeb78('0x82')]['findOrCreate']({'where':{'UserId':_0x4c2c7e['id'],'VoicePrefixId':_0x371c1d['params']['id']},'transaction':_0x3e7088});});})['then'](function(){_0x15b7d3[_0xeb78('0x83')](function(_0x1f5d36){socket['emit']('userVoicePrefix:save',{'UserId':_0x1f5d36['id'],'VoicePrefixId':_0x12b7d7['id']});});});});});}})['then'](respondWithStatusCode(_0x29a90d,null))[_0xeb78('0x48')](handleError(_0x29a90d,null));};exports[_0xeb78('0x84')]=function(_0x5fb310,_0x5553cf,_0x3d4163){return db[_0xeb78('0x7a')][_0xeb78('0x47')]({'where':{'id':_0x5fb310[_0xeb78('0x39')][_0xeb78('0x70')]},'attributes':['id'],'include':[{'model':db[_0xeb78('0x75')],'as':_0xeb78('0x7c'),'attributes':['id'],'raw':!![]}]})[_0xeb78('0x2d')](handleEntityNotFound(_0x5553cf,null))[_0xeb78('0x2d')](function(_0x502af6){var _0x32f23a=_[_0xeb78('0x34')](_0x502af6,'id');var _0x5a1c25=[];var _0x3e2374=[];var _0x3a80b7=squel[_0xeb78('0x85')]();_0x3a80b7[_0xeb78('0x86')](_0xeb78('0x87'))[_0xeb78('0x88')](_0xeb78('0x89'),'tq')[_0xeb78('0x8a')]('user_has_teams','ut',_0xeb78('0x8b'))[_0xeb78('0x42')](_0xeb78('0x8c'),_0x5fb310['params']['id']);for(var _0x55515a=0x0;_0x55515a<_0x502af6[_0xeb78('0x4c')];_0x55515a+=0x1){let _0x207202=_0x502af6[_0x55515a];for(var _0x5edbef=0x0;_0x5edbef<_0x207202[_0xeb78('0x7c')][_0xeb78('0x4c')];_0x5edbef+=0x1){let _0x55041b=_0x207202[_0xeb78('0x7c')][_0x5edbef];var _0x13d95b=_0x3a80b7['clone']();_0x13d95b[_0xeb78('0x42')](_0xeb78('0x8d'),_0x55041b['id']);_0x3e2374['push'](db[_0xeb78('0x50')][_0xeb78('0x39')](_0x13d95b[_0xeb78('0x8e')](),{'type':db[_0xeb78('0x50')][_0xeb78('0x8f')][_0xeb78('0x90')]})[_0xeb78('0x2d')](function(_0x5df43e){if(_0x5df43e[_0xeb78('0x4c')]===0x1){return _0x55041b['id'];}else{var _0x399b9c=_[_0xeb78('0x91')](_[_0xeb78('0x34')](_0x5df43e,_0xeb78('0x92')),function(_0x4beb24){return _['includes'](_0x32f23a,_0x4beb24);});if(_0x399b9c){return _0x55041b['id'];}}}));}}return BPromise[_0xeb78('0x93')](_0x3e2374)[_0xeb78('0x2d')](function(_0x497b99){_0x5a1c25=_(_0x5a1c25)['union'](_0x497b99)[_0xeb78('0x94')]()[_0xeb78('0x95')]();return db[_0xeb78('0x35')][_0xeb78('0x4e')]({'where':{'id':_0x5fb310[_0xeb78('0x49')]['id']}})['then'](function(_0x326468){return db['sequelize']['transaction'](function(_0x1170d3){return _0x326468['removeTeams'](_0x5fb310[_0xeb78('0x39')]['ids'],{'transaction':_0x1170d3})['then'](function(){if(!_[_0xeb78('0x96')](_0x5a1c25)){return _0x326468[_0xeb78('0x73')](_0x5a1c25,{'transaction':_0x1170d3});}})['then'](function(){_0x5a1c25[_0xeb78('0x83')](function(_0x10f23e){socket['emit'](_0xeb78('0x97'),{'UserId':_0x10f23e,'VoicePrefixId':_0x326468['id']});});});});});});})[_0xeb78('0x2d')](respondWithStatusCode(_0x5553cf,null))[_0xeb78('0x48')](handleError(_0x5553cf,null));}; \ No newline at end of file +var _0x5eb8=['from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','sort','where','pick','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','find','describe','transaction','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','NoOp','VoicePrefixId','bulkCreate','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','charAt','system-','sequelize','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','order','hasOwnProperty','nolimit','getTeams','addTeams','Team','User','online','voicePause','interface','flatMap','Agents','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','removeTeams','field','tq.TeamId'];(function(_0x4fe706,_0x1e1599){var _0x225949=function(_0x1f2407){while(--_0x1f2407){_0x4fe706['push'](_0x4fe706['shift']());}};_0x225949(++_0x1e1599);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0x5eb8[_0x4d35f3];return _0x382fea;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];config[_0x85eb('0x19')]=_[_0x85eb('0x1a')](config[_0x85eb('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0x19')]));require('./voicePrefix.socket')[_0x85eb('0x1b')](socket);function respondWithStatusCode(_0x23a82a,_0x600a7f){_0x600a7f=_0x600a7f||0xcc;return function(_0x1604ba){if(_0x1604ba){return _0x23a82a[_0x85eb('0x1c')](_0x600a7f);}return _0x23a82a['status'](_0x600a7f)[_0x85eb('0x1d')]();};}function respondWithResult(_0x59237b,_0x17140b){_0x17140b=_0x17140b||0xc8;return function(_0x10c2c9){if(_0x10c2c9){return _0x59237b[_0x85eb('0x1e')](_0x17140b)[_0x85eb('0x1f')](_0x10c2c9);}};}function respondWithFilteredResult(_0x5dbeda,_0x5c5cbb){return function(_0x50d2a8){if(_0x50d2a8){var _0xe198ca=typeof _0x5c5cbb[_0x85eb('0x20')]===_0x85eb('0x21')&&typeof _0x5c5cbb[_0x85eb('0x22')]===_0x85eb('0x21');var _0x34f875=_0x50d2a8['count'];var _0x24cf28=_0xe198ca?0x0:_0x5c5cbb[_0x85eb('0x20')];var _0xd9f06d=_0xe198ca?_0x50d2a8['count']:_0x5c5cbb['offset']+_0x5c5cbb['limit'];var _0x55b9e4;if(_0xd9f06d>=_0x34f875){_0xd9f06d=_0x34f875;_0x55b9e4=0xc8;}else{_0x55b9e4=0xce;}_0x5dbeda[_0x85eb('0x1e')](_0x55b9e4);return _0x5dbeda[_0x85eb('0x23')](_0x85eb('0x24'),_0x24cf28+'-'+_0xd9f06d+'/'+_0x34f875)[_0x85eb('0x1f')](_0x50d2a8);}return null;};}function patchUpdates(_0x465c74){return function(_0x3fc6da){try{jsonpatch['apply'](_0x3fc6da,_0x465c74,!![]);}catch(_0x5491d5){return BPromise['reject'](_0x5491d5);}return _0x3fc6da[_0x85eb('0x25')]();};}function saveUpdates(_0x1426c8,_0x3f7a4d){return function(_0x28b87d){if(_0x28b87d){return _0x28b87d[_0x85eb('0x26')](_0x1426c8)[_0x85eb('0x27')](function(_0x5dfc96){return _0x5dfc96;});}return null;};}function removeEntity(_0x39d3fe,_0x3453cd){return function(_0x4709ad){if(_0x4709ad){return _0x4709ad[_0x85eb('0x28')]()[_0x85eb('0x27')](function(){var _0x57a03c=_0x4709ad[_0x85eb('0x29')]({'plain':!![]});var _0x792d3a=_0x85eb('0x2a');return db[_0x85eb('0x2b')][_0x85eb('0x28')]({'where':{'type':_0x792d3a,'resourceId':_0x57a03c['id']}})[_0x85eb('0x27')](function(){return _0x4709ad;});})['then'](function(){_0x39d3fe['status'](0xcc)[_0x85eb('0x1d')]();});}};}function handleEntityNotFound(_0x585f2a,_0xa9b14f){return function(_0x5255eb){if(!_0x5255eb){_0x585f2a[_0x85eb('0x1c')](0x194);}return _0x5255eb;};}function handleError(_0x3570f7,_0x1ba904){_0x1ba904=_0x1ba904||0x1f4;return function(_0x1d9278){logger[_0x85eb('0x2c')](_0x1d9278[_0x85eb('0x2d')]);if(_0x1d9278[_0x85eb('0x2e')]){delete _0x1d9278['name'];}_0x3570f7[_0x85eb('0x1e')](_0x1ba904)[_0x85eb('0x2f')](_0x1d9278);};}exports['index']=function(_0x197898,_0x5af2de){var _0x5439aa={},_0x3c5ecc={},_0x3a533c={'count':0x0,'rows':[]};var _0x3e6f34=_[_0x85eb('0x30')](db[_0x85eb('0x31')][_0x85eb('0x32')],function(_0x39b574){return{'name':_0x39b574[_0x85eb('0x33')],'type':_0x39b574[_0x85eb('0x34')][_0x85eb('0x35')]};});_0x3c5ecc['model']=_[_0x85eb('0x30')](_0x3e6f34,_0x85eb('0x2e'));_0x3c5ecc['query']=_['keys'](_0x197898[_0x85eb('0x36')]);_0x3c5ecc[_0x85eb('0x37')]=_[_0x85eb('0x38')](_0x3c5ecc[_0x85eb('0x39')],_0x3c5ecc[_0x85eb('0x36')]);_0x5439aa[_0x85eb('0x3a')]=_[_0x85eb('0x38')](_0x3c5ecc[_0x85eb('0x39')],qs[_0x85eb('0x3b')](_0x197898[_0x85eb('0x36')][_0x85eb('0x3b')]));_0x5439aa[_0x85eb('0x3a')]=_0x5439aa[_0x85eb('0x3a')][_0x85eb('0x3c')]?_0x5439aa['attributes']:_0x3c5ecc[_0x85eb('0x39')];if(!_0x197898[_0x85eb('0x36')]['hasOwnProperty']('nolimit')){_0x5439aa[_0x85eb('0x22')]=qs[_0x85eb('0x22')](_0x197898['query'][_0x85eb('0x22')]);_0x5439aa['offset']=qs[_0x85eb('0x20')](_0x197898['query'][_0x85eb('0x20')]);}_0x5439aa['order']=qs[_0x85eb('0x3d')](_0x197898['query'][_0x85eb('0x3d')]);_0x5439aa[_0x85eb('0x3e')]=qs['filters'](_[_0x85eb('0x3f')](_0x197898['query'],_0x3c5ecc[_0x85eb('0x37')]),_0x3e6f34);if(_0x197898[_0x85eb('0x36')]['filter']){_0x5439aa[_0x85eb('0x3e')]=_['merge'](_0x5439aa['where'],{'$or':_[_0x85eb('0x30')](_0x3e6f34,function(_0x4edb2d){if(_0x4edb2d[_0x85eb('0x34')]!==_0x85eb('0x40')){var _0x5da012={};_0x5da012[_0x4edb2d['name']]={'$like':'%'+_0x197898[_0x85eb('0x36')][_0x85eb('0x41')]+'%'};return _0x5da012;}})});}_0x5439aa=_['merge']({},_0x5439aa,_0x197898['options']);var _0x2864e2={'where':_0x5439aa[_0x85eb('0x3e')]};return db[_0x85eb('0x31')][_0x85eb('0x42')](_0x2864e2)[_0x85eb('0x27')](function(_0x5b7411){_0x3a533c[_0x85eb('0x42')]=_0x5b7411;if(_0x197898[_0x85eb('0x36')][_0x85eb('0x43')]){_0x5439aa[_0x85eb('0x44')]=[{'all':!![]}];}return db[_0x85eb('0x31')][_0x85eb('0x45')](_0x5439aa);})[_0x85eb('0x27')](function(_0x3e11a8){_0x3a533c[_0x85eb('0x46')]=_0x3e11a8;return _0x3a533c;})['then'](respondWithFilteredResult(_0x5af2de,_0x5439aa))[_0x85eb('0x47')](handleError(_0x5af2de,null));};exports[_0x85eb('0x48')]=function(_0x5d90cc,_0x1b77b3){var _0x201aed={'raw':![],'where':{'id':_0x5d90cc[_0x85eb('0x49')]['id']}},_0x2dae5b={};_0x2dae5b[_0x85eb('0x39')]=_[_0x85eb('0x4a')](db['VoicePrefix'][_0x85eb('0x32')]);_0x2dae5b[_0x85eb('0x36')]=_[_0x85eb('0x4a')](_0x5d90cc[_0x85eb('0x36')]);_0x2dae5b[_0x85eb('0x37')]=_[_0x85eb('0x38')](_0x2dae5b[_0x85eb('0x39')],_0x2dae5b[_0x85eb('0x36')]);_0x201aed['attributes']=_[_0x85eb('0x38')](_0x2dae5b[_0x85eb('0x39')],qs[_0x85eb('0x3b')](_0x5d90cc[_0x85eb('0x36')][_0x85eb('0x3b')]));_0x201aed[_0x85eb('0x3a')]=_0x201aed[_0x85eb('0x3a')][_0x85eb('0x3c')]?_0x201aed[_0x85eb('0x3a')]:_0x2dae5b[_0x85eb('0x39')];if(_0x5d90cc[_0x85eb('0x36')][_0x85eb('0x43')]){_0x201aed['include']=[{'all':!![]}];}_0x201aed=_[_0x85eb('0x4b')]({},_0x201aed,_0x5d90cc[_0x85eb('0x4c')]);return db[_0x85eb('0x31')]['find'](_0x201aed)[_0x85eb('0x27')](handleEntityNotFound(_0x1b77b3,null))[_0x85eb('0x27')](respondWithResult(_0x1b77b3,null))[_0x85eb('0x47')](handleError(_0x1b77b3,null));};exports[_0x85eb('0x28')]=function(_0xd3ff2b,_0x4a7506){return db[_0x85eb('0x31')][_0x85eb('0x4d')]({'where':{'id':_0xd3ff2b[_0x85eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a7506,null))[_0x85eb('0x27')](removeEntity(_0x4a7506,null))[_0x85eb('0x47')](handleError(_0x4a7506,null));};exports[_0x85eb('0x4e')]=function(_0x4c06ef,_0x56f510){return db[_0x85eb('0x31')]['describe']()['then'](respondWithResult(_0x56f510,null))[_0x85eb('0x47')](handleError(_0x56f510,null));};exports['create']=function(_0x39316d,_0xfb0ac){var _0x4e3d96;return db['sequelize'][_0x85eb('0x4f')](function(_0x249511){return db[_0x85eb('0x31')][_0x85eb('0x50')](_0x39316d[_0x85eb('0x51')],{'transaction':_0x249511})['then'](function(_0x1bb9f8){_0x4e3d96=_0x1bb9f8[_0x85eb('0x29')]({'plain':!![]});return db[_0x85eb('0x52')][_0x85eb('0x4d')]({'where':{'id':_0x4e3d96[_0x85eb('0x53')]},'raw':!![]})['then'](function(_0x140919){return createVoicePrefixExtensions(_0x4e3d96,_0x140919,_0x249511);});});})['then'](function(){var _0xd2e792=_0x39316d[_0x85eb('0x54')]['get']({'plain':!![]});if(!_0xd2e792)throw new Error(_0x85eb('0x55'));if(_0xd2e792[_0x85eb('0x56')]===_0x85eb('0x54')){var _0x26e04a=_0x4e3d96;return db[_0x85eb('0x57')][_0x85eb('0x4d')]({'where':{'name':'VoicePrefixes','userProfileId':_0xd2e792[_0x85eb('0x58')]},'raw':!![]})['then'](function(_0x311857){if(_0x311857&&_0x311857[_0x85eb('0x59')]===0x0){return db['UserProfileResource'][_0x85eb('0x50')]({'name':_0x26e04a[_0x85eb('0x2e')],'resourceId':_0x26e04a['id'],'type':_0x311857['name'],'sectionId':_0x311857['id']},{})[_0x85eb('0x27')](function(){return _0x4e3d96;});}else{return _0x4e3d96;}})['catch'](function(_0x452e7e){logger[_0x85eb('0x2c')](_0x85eb('0x5a'),_0x452e7e);throw _0x452e7e;});}return _0x4e3d96;})[_0x85eb('0x27')](respondWithResult(_0xfb0ac,null))[_0x85eb('0x47')](handleError(_0xfb0ac,null));};function Extension(_0x15d4a7,_0x5a729e,_0x2227ea,_0x76a9c6){this[_0x85eb('0x5b')]=_0x85eb('0x5c');this[_0x85eb('0x5d')]=_0x15d4a7;this[_0x85eb('0x5e')]=_0x2227ea;this[_0x85eb('0x34')]=_0x85eb('0x5f');this[_0x85eb('0x60')]=_0x85eb('0x61');this[_0x85eb('0x62')]=_0x5a729e;this['appdata']=_0x76a9c6;}function createVoicePrefixExtensions(_0x271842,_0x21b873,_0x46e5d3){return new BPromise(function(_0xdaf2fe,_0x4470b3){var _0x213b64=new Extension(formatPrefixName(_0x271842['prefix']),0x1,_0x85eb('0x63'),'Voice\x20Prefix');_0x213b64[_0x85eb('0x64')]=_0x271842['id'];return db[_0x85eb('0x52')][_0x85eb('0x50')](_0x213b64,{'transaction':_0x46e5d3})[_0x85eb('0x27')](function(_0x8f8a72){var _0x4f09dc=_0x8f8a72[_0x85eb('0x29')]({'plain':!![]});var _0x143d65=_[_0x85eb('0x30')](addVoicePrefixExtensions(_0x271842,_0x21b873),function(_0x2c40f8){_0x2c40f8[_0x85eb('0x53')]=_0x4f09dc['id'];_0x2c40f8[_0x85eb('0x64')]=_0x271842['id'];return _0x2c40f8;});return db[_0x85eb('0x52')][_0x85eb('0x65')](_0x143d65,{'transaction':_0x46e5d3})['then'](function(_0x3b896a){if(!_0x3b896a){return _0x4470b3('Extensions\x20creation\x20failed');}else{return _0xdaf2fe(_0x3b896a);}})[_0x85eb('0x47')](function(_0x3ff0f9){return _0x4470b3(_0x3ff0f9);});});;});};function addVoicePrefixExtensions(_0x2ac293,_0x41960f){var _0x259ee3=[];var _0x547ccb=formatPrefixName(_0x2ac293[_0x85eb('0x66')]);_0x259ee3[_0x85eb('0x67')](new Extension(_0x547ccb,0x2,_0x85eb('0x68'),_0x85eb('0x69')+_0x2ac293[_0x85eb('0x2e')]));if(_0x2ac293[_0x85eb('0x6a')]){_0x259ee3['push'](new Extension(_0x547ccb,0x3,'Set',_0x85eb('0x6b')+_0x2ac293['callerIdAll']));}else{_0x259ee3[_0x85eb('0x67')](new Extension(_0x547ccb,0x3,_0x85eb('0x63'),_0x85eb('0x6c')));}_0x259ee3[_0x85eb('0x67')](new Extension(_0x547ccb,0x4,_0x85eb('0x6d'),_0x41960f[_0x85eb('0x5b')]+','+'${EXTEN:'+(0x8+_0x2ac293[_0x85eb('0x2e')][_0x85eb('0x3c')])+'}'+','+0x1));return _0x259ee3;}function formatPrefixName(_0x3f30e4){var _0x2e65d5='_';for(var _0x52bbdf=0x0;_0x52bbdf<_0x3f30e4[_0x85eb('0x3c')];_0x52bbdf++){if(_0x3f30e4[_0x85eb('0x6e')](_0x52bbdf)=='-'){_0x2e65d5+=_0x3f30e4[_0x85eb('0x6e')](_0x52bbdf);}else{_0x2e65d5+='['+_0x3f30e4[_0x85eb('0x6e')](_0x52bbdf)+']';}}_0x2e65d5+='.';return _0x2e65d5;}exports['update']=function(_0x459317,_0x2e6734,_0x13a040){var _0x5fcd48=_0x459317[_0x85eb('0x51')];_0x5fcd48[_0x85eb('0x66')]=_0x85eb('0x6f')+_0x5fcd48[_0x85eb('0x2e')]+'-';return db[_0x85eb('0x70')][_0x85eb('0x4f')](function(_0x170a60){return db[_0x85eb('0x31')][_0x85eb('0x26')](_0x5fcd48,{'where':{'id':_0x5fcd48['id']},'transaction':_0x170a60})[_0x85eb('0x27')](function(){return db[_0x85eb('0x52')][_0x85eb('0x28')]({'where':{'VoicePrefixId':_0x5fcd48['id']},'transaction':_0x170a60})[_0x85eb('0x27')](function(){return db[_0x85eb('0x52')][_0x85eb('0x4d')]({'where':{'id':_0x5fcd48['VoiceExtensionId']},'raw':!![]})[_0x85eb('0x27')](function(_0x4dd31e){return createVoicePrefixExtensions(_0x5fcd48,_0x4dd31e,_0x170a60);});});});})[_0x85eb('0x27')](function(){return db[_0x85eb('0x31')][_0x85eb('0x71')](_0x5fcd48['id']);})[_0x85eb('0x27')](respondWithResult(_0x2e6734,null))[_0x85eb('0x47')](handleError(_0x2e6734,null));};exports[_0x85eb('0x72')]=function(_0x9f4f,_0x3076df,_0x2ca9f9){return db['VoicePrefix'][_0x85eb('0x4d')]({'where':{'id':_0x9f4f[_0x85eb('0x49')]['id']}})[_0x85eb('0x27')](handleEntityNotFound(_0x3076df,null))[_0x85eb('0x27')](function(_0x440968){if(_0x440968){return _0x440968['addAgents'](_0x9f4f[_0x85eb('0x51')]['ids'],_[_0x85eb('0x73')](_0x9f4f[_0x85eb('0x51')],[_0x85eb('0x74'),'id'])||{})['spread'](function(_0x2daa64){for(var _0x2e358d=0x0;_0x2e358d<_0x9f4f[_0x85eb('0x51')]['ids']['length'];_0x2e358d+=0x1){socket[_0x85eb('0x75')](_0x85eb('0x76'),{'UserId':Number(_0x9f4f[_0x85eb('0x51')][_0x85eb('0x74')][_0x2e358d]),'VoicePrefixId':Number(_0x9f4f['params']['id'])});}return _0x2daa64;});}})[_0x85eb('0x27')](respondWithResult(_0x3076df,null))['catch'](handleError(_0x3076df,null));};exports[_0x85eb('0x77')]=function(_0xed99f7,_0x528d2e,_0x2fad3b){return db[_0x85eb('0x31')][_0x85eb('0x4d')]({'where':{'id':_0xed99f7['params']['id']}})[_0x85eb('0x27')](handleEntityNotFound(_0x528d2e,null))['then'](function(_0x18049b){if(_0x18049b){return _0x18049b[_0x85eb('0x77')](_0xed99f7[_0x85eb('0x36')][_0x85eb('0x74')])[_0x85eb('0x27')](function(){if(_[_0x85eb('0x78')](_0xed99f7[_0x85eb('0x36')][_0x85eb('0x74')])){for(var _0x3a471d=0x0;_0x3a471d<_0xed99f7['query'][_0x85eb('0x74')][_0x85eb('0x3c')];_0x3a471d+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0xed99f7[_0x85eb('0x36')]['ids'][_0x3a471d]),'VoicePrefixId':Number(_0xed99f7[_0x85eb('0x49')]['id'])});}}else{socket['emit'](_0x85eb('0x79'),{'UserId':Number(_0xed99f7['query'][_0x85eb('0x74')]),'VoicePrefixId':Number(_0xed99f7[_0x85eb('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x528d2e,null))[_0x85eb('0x47')](handleError(_0x528d2e,null));};exports[_0x85eb('0x7a')]=function(_0x555236,_0x888c46,_0x3b327d){var _0xf076af={};var _0x16b378={};var _0x5dd40c;var _0x1d82a4;return db['VoicePrefix'][_0x85eb('0x7b')]({'where':{'id':_0x555236[_0x85eb('0x49')]['id']}})[_0x85eb('0x27')](handleEntityNotFound(_0x888c46,null))['then'](function(_0x60e9b9){if(_0x60e9b9){_0x5dd40c=_0x60e9b9;_0x16b378[_0x85eb('0x39')]=_[_0x85eb('0x4a')](db['User'][_0x85eb('0x32')]);_0x16b378['query']=_[_0x85eb('0x4a')](_0x555236[_0x85eb('0x36')]);_0x16b378[_0x85eb('0x37')]=_['intersection'](_0x16b378['model'],_0x16b378['query']);_0xf076af[_0x85eb('0x3a')]=_[_0x85eb('0x38')](_0x16b378[_0x85eb('0x39')],qs['fields'](_0x555236[_0x85eb('0x36')][_0x85eb('0x3b')]));_0xf076af[_0x85eb('0x3a')]=_0xf076af[_0x85eb('0x3a')][_0x85eb('0x3c')]?_0xf076af['attributes']:_0x16b378['model'];_0xf076af[_0x85eb('0x7c')]=qs[_0x85eb('0x3d')](_0x555236['query'][_0x85eb('0x3d')]);_0xf076af[_0x85eb('0x3e')]=qs[_0x85eb('0x37')](_[_0x85eb('0x3f')](_0x555236[_0x85eb('0x36')],_0x16b378[_0x85eb('0x37')]));if(_0x555236[_0x85eb('0x36')][_0x85eb('0x41')]){_0xf076af[_0x85eb('0x3e')]=_[_0x85eb('0x4b')](_0xf076af[_0x85eb('0x3e')],{'$or':_[_0x85eb('0x30')](_0xf076af[_0x85eb('0x3a')],function(_0x171428){var _0x326b12={};_0x326b12[_0x171428]={'$like':'%'+_0x555236['query'][_0x85eb('0x41')]+'%'};return _0x326b12;})});}_0xf076af=_[_0x85eb('0x4b')]({},_0xf076af,_0x555236[_0x85eb('0x4c')]);return _0x5dd40c[_0x85eb('0x7a')](_0xf076af);}})[_0x85eb('0x27')](function(_0x23191c){if(_0x23191c){_0x1d82a4=_0x23191c[_0x85eb('0x3c')];if(!_0x555236[_0x85eb('0x36')][_0x85eb('0x7d')](_0x85eb('0x7e'))){_0xf076af['limit']=qs[_0x85eb('0x22')](_0x555236[_0x85eb('0x36')][_0x85eb('0x22')]);_0xf076af[_0x85eb('0x20')]=qs['offset'](_0x555236[_0x85eb('0x36')][_0x85eb('0x20')]);}return _0x5dd40c[_0x85eb('0x7a')](_0xf076af);}})[_0x85eb('0x27')](function(_0x362ba9){if(_0x362ba9){return _0x362ba9?{'count':_0x1d82a4,'rows':_0x362ba9}:null;}})[_0x85eb('0x27')](respondWithResult(_0x888c46,null))['catch'](handleError(_0x888c46,null));};exports[_0x85eb('0x7f')]=function(_0x36dbb1,_0x12c3be,_0x59fc6a){var _0x15802f={};var _0x278558={};var _0x2d0bfb;var _0x3b3b07;return db[_0x85eb('0x31')][_0x85eb('0x7b')]({'where':{'id':_0x36dbb1[_0x85eb('0x49')]['id']}})[_0x85eb('0x27')](handleEntityNotFound(_0x12c3be,null))['then'](function(_0x44af01){if(_0x44af01){_0x2d0bfb=_0x44af01;_0x278558[_0x85eb('0x39')]=_['keys'](db['Team'][_0x85eb('0x32')]);_0x278558['query']=_[_0x85eb('0x4a')](_0x36dbb1[_0x85eb('0x36')]);_0x278558[_0x85eb('0x37')]=_[_0x85eb('0x38')](_0x278558['model'],_0x278558['query']);_0x15802f[_0x85eb('0x3a')]=_['intersection'](_0x278558[_0x85eb('0x39')],qs[_0x85eb('0x3b')](_0x36dbb1[_0x85eb('0x36')][_0x85eb('0x3b')]));_0x15802f['attributes']=_0x15802f['attributes'][_0x85eb('0x3c')]?_0x15802f[_0x85eb('0x3a')]:_0x278558[_0x85eb('0x39')];_0x15802f['order']=qs['sort'](_0x36dbb1[_0x85eb('0x36')][_0x85eb('0x3d')]);_0x15802f[_0x85eb('0x3e')]=qs[_0x85eb('0x37')](_[_0x85eb('0x3f')](_0x36dbb1[_0x85eb('0x36')],_0x278558[_0x85eb('0x37')]));if(_0x36dbb1[_0x85eb('0x36')][_0x85eb('0x41')]){_0x15802f[_0x85eb('0x3e')]=_[_0x85eb('0x4b')](_0x15802f['where'],{'$or':_[_0x85eb('0x30')](_0x15802f[_0x85eb('0x3a')],function(_0x483f5f){var _0x1fe3b6={};_0x1fe3b6[_0x483f5f]={'$like':'%'+_0x36dbb1[_0x85eb('0x36')][_0x85eb('0x41')]+'%'};return _0x1fe3b6;})});}_0x15802f=_[_0x85eb('0x4b')]({},_0x15802f,_0x36dbb1[_0x85eb('0x4c')]);return _0x2d0bfb[_0x85eb('0x7f')](_0x15802f);}})['then'](function(_0x4ba2d3){if(_0x4ba2d3){_0x3b3b07=_0x4ba2d3[_0x85eb('0x3c')];if(!_0x36dbb1['query'][_0x85eb('0x7d')]('nolimit')){_0x15802f[_0x85eb('0x22')]=qs[_0x85eb('0x22')](_0x36dbb1['query']['limit']);_0x15802f[_0x85eb('0x20')]=qs[_0x85eb('0x20')](_0x36dbb1['query'][_0x85eb('0x20')]);}return _0x2d0bfb[_0x85eb('0x7f')](_0x15802f);}})[_0x85eb('0x27')](function(_0x48ed21){if(_0x48ed21){return _0x48ed21?{'count':_0x3b3b07,'rows':_0x48ed21}:null;}})['then'](respondWithResult(_0x12c3be,null))[_0x85eb('0x47')](handleError(_0x12c3be,null));};exports[_0x85eb('0x80')]=function(_0x189733,_0x422d33,_0x1d695c){var _0x4c865d=_0x189733[_0x85eb('0x51')][_0x85eb('0x74')];var _0x3b84b7;return db[_0x85eb('0x81')]['findAll']({'where':{'id':_0x4c865d},'attributes':['id'],'include':[{'model':db[_0x85eb('0x82')],'as':'Agents','attributes':['id',_0x85eb('0x2e'),_0x85eb('0x83'),_0x85eb('0x84'),_0x85eb('0x85')],'raw':!![]}]})[_0x85eb('0x27')](function(_0x52e2b9){if(_0x52e2b9){_0x3b84b7=_0x52e2b9;var _0x34c380=_[_0x85eb('0x86')](_0x52e2b9,function(_0x3bf9b4){var _0x4d3be5=_0x3bf9b4[_0x85eb('0x29')]({'plain':!![]});return _0x4d3be5[_0x85eb('0x87')];});return db[_0x85eb('0x31')][_0x85eb('0x4d')]({'where':{'id':_0x189733[_0x85eb('0x49')]['id']}})[_0x85eb('0x27')](function(_0x209800){return db[_0x85eb('0x70')][_0x85eb('0x4f')](function(_0x344711){return _0x209800[_0x85eb('0x80')](_0x4c865d,{'transaction':_0x344711})[_0x85eb('0x27')](function(){return BPromise[_0x85eb('0x88')](_0x3b84b7,function(_0xfe9f80){return db[_0x85eb('0x89')][_0x85eb('0x8a')]({'TeamId':_0xfe9f80['id'],'VoicePrefixId':_0x189733['params']['id']},{'transaction':_0x344711});});})[_0x85eb('0x27')](function(){return BPromise[_0x85eb('0x88')](_0x34c380,function(_0x1c13a9){return db[_0x85eb('0x8b')][_0x85eb('0x8c')]({'where':{'UserId':_0x1c13a9['id'],'VoicePrefixId':_0x189733[_0x85eb('0x49')]['id']},'transaction':_0x344711});});})[_0x85eb('0x27')](function(){_0x34c380['forEach'](function(_0x419f52){socket[_0x85eb('0x75')]('userVoicePrefix:save',{'UserId':_0x419f52['id'],'VoicePrefixId':_0x209800['id']});});});});});}})[_0x85eb('0x27')](respondWithStatusCode(_0x422d33,null))['catch'](handleError(_0x422d33,null));};exports[_0x85eb('0x8d')]=function(_0x29a5bd,_0x933d13,_0x41dcd3){return db[_0x85eb('0x81')][_0x85eb('0x45')]({'where':{'id':_0x29a5bd[_0x85eb('0x36')][_0x85eb('0x74')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x85eb('0x27')](handleEntityNotFound(_0x933d13,null))[_0x85eb('0x27')](function(_0x29df56){var _0x1b9d2f=_['map'](_0x29df56,'id');var _0x44de5f=[];var _0x2e2af5=[];var _0x3d2e7d=squel['select']();_0x3d2e7d[_0x85eb('0x8e')](_0x85eb('0x8f'))[_0x85eb('0x90')]('team_has_voice_prefixes','tq')[_0x85eb('0x91')](_0x85eb('0x92'),'ut',_0x85eb('0x93'))['where'](_0x85eb('0x94'),_0x29a5bd[_0x85eb('0x49')]['id']);for(var _0x404fef=0x0;_0x404fef<_0x29df56[_0x85eb('0x3c')];_0x404fef+=0x1){let _0x537ce5=_0x29df56[_0x404fef];for(var _0x1a2426=0x0;_0x1a2426<_0x537ce5[_0x85eb('0x87')][_0x85eb('0x3c')];_0x1a2426+=0x1){let _0x142a76=_0x537ce5['Agents'][_0x1a2426];var _0x3b4c70=_0x3d2e7d[_0x85eb('0x95')]();_0x3b4c70[_0x85eb('0x3e')](_0x85eb('0x96'),_0x142a76['id']);_0x2e2af5[_0x85eb('0x67')](db[_0x85eb('0x70')]['query'](_0x3b4c70['toString'](),{'type':db[_0x85eb('0x70')][_0x85eb('0x97')][_0x85eb('0x98')]})[_0x85eb('0x27')](function(_0x34e916){if(_0x34e916[_0x85eb('0x3c')]===0x1){return _0x142a76['id'];}else{var _0x37973e=_['every'](_[_0x85eb('0x30')](_0x34e916,_0x85eb('0x99')),function(_0x5af162){return _[_0x85eb('0x9a')](_0x1b9d2f,_0x5af162);});if(_0x37973e){return _0x142a76['id'];}}}));}}return BPromise[_0x85eb('0x9b')](_0x2e2af5)[_0x85eb('0x27')](function(_0x24726f){_0x44de5f=_(_0x44de5f)[_0x85eb('0x9c')](_0x24726f)[_0x85eb('0x9d')]()[_0x85eb('0x9e')]();return db[_0x85eb('0x31')][_0x85eb('0x4d')]({'where':{'id':_0x29a5bd['params']['id']}})['then'](function(_0x5ac026){return db[_0x85eb('0x70')][_0x85eb('0x4f')](function(_0x27fd58){return _0x5ac026[_0x85eb('0x8d')](_0x29a5bd[_0x85eb('0x36')][_0x85eb('0x74')],{'transaction':_0x27fd58})[_0x85eb('0x27')](function(){if(!_[_0x85eb('0x9f')](_0x44de5f)){return _0x5ac026[_0x85eb('0x77')](_0x44de5f,{'transaction':_0x27fd58});}})[_0x85eb('0x27')](function(){_0x44de5f['forEach'](function(_0xc37e2){socket[_0x85eb('0x75')](_0x85eb('0x79'),{'UserId':_0xc37e2,'VoicePrefixId':_0x5ac026['id']});});});});});});})[_0x85eb('0x27')](respondWithStatusCode(_0x933d13,null))[_0x85eb('0x47')](handleError(_0x933d13,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 81faaa5..75c09c5 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 _0x13ab=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x3383b3,_0x190fa6){var _0x257ef7=function(_0x878654){while(--_0x878654){_0x3383b3['push'](_0x3383b3['shift']());}};_0x257ef7(++_0x190fa6);}(_0x13ab,0x189));var _0xb13a=function(_0x1c42d9,_0x4e0030){_0x1c42d9=_0x1c42d9-0x0;var _0x4c652b=_0x13ab[_0x1c42d9];return _0x4c652b;};'use strict';var EventEmitter=require(_0xb13a('0x0'));var VoicePrefix=require(_0xb13a('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xb13a('0x2')](0x0);var events={'afterCreate':_0xb13a('0x3'),'afterUpdate':_0xb13a('0x4'),'afterDestroy':_0xb13a('0x5')};function emitEvent(_0x29945f){return function(_0x395efb,_0x490d12,_0x457c6e){VoicePrefixEvents[_0xb13a('0x6')](_0x29945f+':'+_0x395efb['id'],_0x395efb);VoicePrefixEvents[_0xb13a('0x6')](_0x29945f,_0x395efb);_0x457c6e(null);};}for(var e in events){if(events[_0xb13a('0x7')](e)){var event=events[e];VoicePrefix[_0xb13a('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x2d2c=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2fc284,_0x5d271c){var _0x221234=function(_0x39fb00){while(--_0x39fb00){_0x2fc284['push'](_0x2fc284['shift']());}};_0x221234(++_0x5d271c);}(_0x2d2c,0xc5));var _0xc2d2=function(_0x2bf1d6,_0x410efd){_0x2bf1d6=_0x2bf1d6-0x0;var _0x1be08a=_0x2d2c[_0x2bf1d6];return _0x1be08a;};'use strict';var EventEmitter=require(_0xc2d2('0x0'));var VoicePrefix=require(_0xc2d2('0x1'))['db'][_0xc2d2('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc2d2('0x3')](0x0);var events={'afterCreate':_0xc2d2('0x4'),'afterUpdate':_0xc2d2('0x5'),'afterDestroy':_0xc2d2('0x6')};function emitEvent(_0x4304fb){return function(_0xa677af,_0x323021,_0x14f667){VoicePrefixEvents[_0xc2d2('0x7')](_0x4304fb+':'+_0xa677af['id'],_0xa677af);VoicePrefixEvents[_0xc2d2('0x7')](_0x4304fb,_0xa677af);_0x14f667(null);};}for(var e in events){if(events[_0xc2d2('0x8')](e)){var event=events[e];VoicePrefix[_0xc2d2('0x9')](e,emitEvent(event));}}module[_0xc2d2('0xa')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 4f64978..ea3b641 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 _0xcef6=['rimraf','../../config/environment','exports','define','VoicePrefix','voice_prefixes','lodash','moment','bluebird','request-promise'];(function(_0x501b36,_0x5d956c){var _0x5beead=function(_0x43b32d){while(--_0x43b32d){_0x501b36['push'](_0x501b36['shift']());}};_0x5beead(++_0x5d956c);}(_0xcef6,0x88));var _0x6cef=function(_0x3441e9,_0x269c8a){_0x3441e9=_0x3441e9-0x0;var _0x7f9ada=_0xcef6[_0x3441e9];return _0x7f9ada;};'use strict';var _=require(_0x6cef('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6cef('0x1'));var BPromise=require(_0x6cef('0x2'));var rp=require(_0x6cef('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6cef('0x4'));var config=require(_0x6cef('0x5'));var attributes=require('./voicePrefix.attributes');module[_0x6cef('0x6')]=function(_0x558573,_0x2c83d4){return _0x558573[_0x6cef('0x7')](_0x6cef('0x8'),attributes,{'tableName':_0x6cef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a89=['util','../../config/logger','moment','bluebird','path','rimraf','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x203970,_0x6696f4){var _0x5f2ab8=function(_0x3c56a5){while(--_0x3c56a5){_0x203970['push'](_0x203970['shift']());}};_0x5f2ab8(++_0x6696f4);}(_0x4a89,0x8f));var _0x94a8=function(_0x50b6d2,_0x3dbf85){_0x50b6d2=_0x50b6d2-0x0;var _0x534d3a=_0x4a89[_0x50b6d2];return _0x534d3a;};'use strict';var _=require('lodash');var util=require(_0x94a8('0x0'));var logger=require(_0x94a8('0x1'))('api');var moment=require(_0x94a8('0x2'));var BPromise=require(_0x94a8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94a8('0x4'));var rimraf=require(_0x94a8('0x5'));var config=require('../../config/environment');var attributes=require(_0x94a8('0x6'));module[_0x94a8('0x7')]=function(_0x42a55a,_0x4ec053){return _0x42a55a[_0x94a8('0x8')](_0x94a8('0x9'),attributes,{'tableName':_0x94a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 4a7fed4..5d0be8c 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 _0xb89c=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','VoicePrefix,\x20%s,\x20%s'];(function(_0x54e1c0,_0x14086a){var _0x4d7c12=function(_0x2955bc){while(--_0x2955bc){_0x54e1c0['push'](_0x54e1c0['shift']());}};_0x4d7c12(++_0x14086a);}(_0xb89c,0x198));var _0xcb89=function(_0x481b68,_0x3ead7d){_0x481b68=_0x481b68-0x0;var _0xac2703=_0xb89c[_0x481b68];return _0xac2703;};'use strict';var _=require(_0xcb89('0x0'));var util=require(_0xcb89('0x1'));var moment=require(_0xcb89('0x2'));var BPromise=require(_0xcb89('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb89('0x4'));var db=require(_0xcb89('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb89('0x6'))(_0xcb89('0x7'));var config=require(_0xcb89('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcb89('0x9')]({'port':0x232a});config[_0xcb89('0xa')]=_[_0xcb89('0xb')](config['redis'],{'host':_0xcb89('0xc'),'port':0x18eb});var socket=require(_0xcb89('0xd'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xcb89('0xe')](socket);function respondWithRpcPromise(_0x53c5a7,_0x41e33c,_0x13d505){return new BPromise(function(_0xbff62,_0x24c1b6){return client[_0xcb89('0xf')](_0x53c5a7,_0x13d505)[_0xcb89('0x10')](function(_0x4be56e){logger[_0xcb89('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x41e33c,_0xcb89('0x12'));logger[_0xcb89('0x13')](_0xcb89('0x14'),_0x41e33c,_0xcb89('0x12'),JSON[_0xcb89('0x15')](_0x4be56e));if(_0x4be56e[_0xcb89('0x16')]){if(_0x4be56e[_0xcb89('0x16')]['code']===0x1f4){logger[_0xcb89('0x16')](_0xcb89('0x17'),_0x41e33c,_0x4be56e['error'][_0xcb89('0x18')]);return _0x24c1b6(_0x4be56e[_0xcb89('0x16')][_0xcb89('0x18')]);}logger['error'](_0xcb89('0x17'),_0x41e33c,_0x4be56e['error']['message']);return _0xbff62(_0x4be56e[_0xcb89('0x16')][_0xcb89('0x18')]);}else{logger[_0xcb89('0x11')](_0xcb89('0x17'),_0x41e33c,_0xcb89('0x12'));_0xbff62(_0x4be56e[_0xcb89('0x19')][_0xcb89('0x18')]);}})[_0xcb89('0x1a')](function(_0x5d17a7){logger[_0xcb89('0x16')](_0xcb89('0x17'),_0x41e33c,_0x5d17a7);_0x24c1b6(_0x5d17a7);});});} \ No newline at end of file +var _0xdab3=['then','info','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoicePrefix,\x20%s,\x20%s','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request'];(function(_0x2b55d4,_0x1ed1b2){var _0x304574=function(_0x3bdaa5){while(--_0x3bdaa5){_0x2b55d4['push'](_0x2b55d4['shift']());}};_0x304574(++_0x1ed1b2);}(_0xdab3,0xeb));var _0x3dab=function(_0x46851b,_0x76385c){_0x46851b=_0x46851b-0x0;var _0x2458ed=_0xdab3[_0x46851b];return _0x2458ed;};'use strict';var _=require(_0x3dab('0x0'));var util=require(_0x3dab('0x1'));var moment=require('moment');var BPromise=require(_0x3dab('0x2'));var rs=require(_0x3dab('0x3'));var fs=require('fs');var Redis=require(_0x3dab('0x4'));var db=require(_0x3dab('0x5'))['db'];var utils=require(_0x3dab('0x6'));var logger=require(_0x3dab('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3dab('0x8'));var client=jayson[_0x3dab('0x9')][_0x3dab('0xa')]({'port':0x232a});config[_0x3dab('0xb')]=_[_0x3dab('0xc')](config[_0x3dab('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3dab('0xd'))(new Redis(config[_0x3dab('0xb')]));require(_0x3dab('0xe'))[_0x3dab('0xf')](socket);function respondWithRpcPromise(_0xcec578,_0xf7ea3d,_0x1f6b1b){return new BPromise(function(_0x4943ae,_0x45f023){return client[_0x3dab('0x10')](_0xcec578,_0x1f6b1b)[_0x3dab('0x11')](function(_0x454e3a){logger[_0x3dab('0x12')]('VoicePrefix,\x20%s,\x20%s',_0xf7ea3d,'request\x20sent');logger[_0x3dab('0x13')](_0x3dab('0x14'),_0xf7ea3d,_0x3dab('0x15'),JSON[_0x3dab('0x16')](_0x454e3a));if(_0x454e3a[_0x3dab('0x17')]){if(_0x454e3a[_0x3dab('0x17')][_0x3dab('0x18')]===0x1f4){logger[_0x3dab('0x17')]('VoicePrefix,\x20%s,\x20%s',_0xf7ea3d,_0x454e3a[_0x3dab('0x17')][_0x3dab('0x19')]);return _0x45f023(_0x454e3a[_0x3dab('0x17')][_0x3dab('0x19')]);}logger[_0x3dab('0x17')]('VoicePrefix,\x20%s,\x20%s',_0xf7ea3d,_0x454e3a['error'][_0x3dab('0x19')]);return _0x4943ae(_0x454e3a[_0x3dab('0x17')][_0x3dab('0x19')]);}else{logger[_0x3dab('0x12')](_0x3dab('0x1a'),_0xf7ea3d,'request\x20sent');_0x4943ae(_0x454e3a[_0x3dab('0x1b')][_0x3dab('0x19')]);}})['catch'](function(_0x38337d){logger[_0x3dab('0x17')](_0x3dab('0x1a'),_0xf7ea3d,_0x38337d);_0x45f023(_0x38337d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7992870..3196dc8 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 _0x5106=['removeListener','register','./voicePrefix.events','remove'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5106,0x116));var _0x6510=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5106[_0x2c91e9];return _0x13f0ff;};'use strict';var VoicePrefixEvents=require(_0x6510('0x0'));var events=['save',_0x6510('0x1'),'update'];function createListener(_0x183717,_0x4b0419){return function(_0x579fe8){_0x4b0419['emit'](_0x183717,_0x579fe8);};}function removeListener(_0x25620c,_0x4465c2){return function(){VoicePrefixEvents[_0x6510('0x2')](_0x25620c,_0x4465c2);};}exports[_0x6510('0x3')]=function(_0x28cb6e){for(var _0x2f5cb3=0x0,_0x485cfa=events['length'];_0x2f5cb3<_0x485cfa;_0x2f5cb3++){var _0x57164e=events[_0x2f5cb3];var _0x226e1a=createListener('voicePrefix:'+_0x57164e,_0x28cb6e);VoicePrefixEvents['on'](_0x57164e,_0x226e1a);}}; \ No newline at end of file +var _0x851a=['update','emit','register','length','voicePrefix:','./voicePrefix.events','remove'];(function(_0x395543,_0x28e02f){var _0x9b819d=function(_0x1606d3){while(--_0x1606d3){_0x395543['push'](_0x395543['shift']());}};_0x9b819d(++_0x28e02f);}(_0x851a,0x19b));var _0xa851=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x851a[_0x4c12ec];return _0x3ae42c;};'use strict';var VoicePrefixEvents=require(_0xa851('0x0'));var events=['save',_0xa851('0x1'),_0xa851('0x2')];function createListener(_0x38707a,_0x52489c){return function(_0xd7442b){_0x52489c[_0xa851('0x3')](_0x38707a,_0xd7442b);};}function removeListener(_0x1b30dc,_0x3f317d){return function(){VoicePrefixEvents['removeListener'](_0x1b30dc,_0x3f317d);};}exports[_0xa851('0x4')]=function(_0x57a7c4){for(var _0x1cba67=0x0,_0x2fc0e0=events[_0xa851('0x5')];_0x1cba67<_0x2fc0e0;_0x1cba67++){var _0x551e16=events[_0x1cba67];var _0x3e1e9d=createListener(_0xa851('0x6')+_0x551e16,_0x57a7c4);VoicePrefixEvents['on'](_0x551e16,_0x3e1e9d);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 95e9db1..e0b74bc 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(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ae1c8,_0x4f1c21){_0x3ae1c8=_0x3ae1c8-0x0;var _0x5a2621=_0xb10b[_0x3ae1c8];return _0x5a2621;};'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(_0x5459b0,_0x4d2ef8){var _0x675a35=function(_0x538e11){while(--_0x538e11){_0x5459b0['push'](_0x5459b0['shift']());}};_0x675a35(++_0x4d2ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 961d0f2..727d000 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 _0x334e=['roundrobin','progressive','predictive','power','INTEGER','yes','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','rrmemory','linear','wrandom','setDataValue','strategy','getDataValue','type','booked'];(function(_0x25e44c,_0x5a811c){var _0x257abe=function(_0x4d3471){while(--_0x4d3471){_0x25e44c['push'](_0x25e44c['shift']());}};_0x257abe(++_0x5a811c);}(_0x334e,0x128));var _0xe334=function(_0x1c14f2,_0x5858e0){_0x1c14f2=_0x1c14f2-0x0;var _0x2c6edd=_0x334e[_0x1c14f2];return _0x2c6edd;};'use strict';var Sequelize=require(_0xe334('0x0'));module[_0xe334('0x1')]={'name':{'type':Sequelize[_0xe334('0x2')],'allowNull':![],'unique':_0xe334('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe334('0x4')](_0xe334('0x5'),_0xe334('0x6')),'allowNull':![],'defaultValue':_0xe334('0x5')},'musiconhold':{'type':Sequelize[_0xe334('0x2')],'defaultValue':_0xe334('0x7')},'announce':{'type':Sequelize[_0xe334('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xe334('0x4')]('rr','ringall','leastrecent','fewestcalls','random',_0xe334('0x8'),_0xe334('0x9'),_0xe334('0xa'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x436e8d){this[_0xe334('0xb')](_0xe334('0xc'),_0x436e8d?_0x436e8d:'rrmemory');},'get':function(){var _0x325069=this[_0xe334('0xd')](_0xe334('0xe'));var _0xe49dfb=this['getDataValue']('dialMethod');var _0x3a24b5=this[_0xe334('0xd')](_0xe334('0xc'));if(_0x325069===_0xe334('0x5')){return _0x3a24b5;}if(_0xe49dfb===_0xe334('0xf')&&_0x3a24b5===_0xe334('0x8')||_0xe49dfb===_0xe334('0xf')&&_0x3a24b5===_0xe334('0x10')){return _0x3a24b5;}if(_0xe49dfb===_0xe334('0x11')||_0xe49dfb===_0xe334('0x12')||_0xe49dfb===_0xe334('0x13')){return _0x3a24b5;}return null;}},'servicelevel':{'type':Sequelize[_0xe334('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xe334('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xe334('0x14')](0xb)},'timeout':{'type':Sequelize[_0xe334('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xe334('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xe334('0x2')]},'weight':{'type':Sequelize[_0xe334('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xe334('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xe334('0x4')](_0xe334('0x15'),'no'),'defaultValue':_0xe334('0x15')},'autopause':{'type':Sequelize['ENUM'](_0xe334('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xe334('0x14')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xe334('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xe334('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xe334('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xe334('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xe334('0x4')](_0xe334('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xe334('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xe334('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xe334('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xe334('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xe334('0x4')](_0xe334('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xe334('0x4')](_0xe334('0x15'),'no'),'defaultValue':_0xe334('0x15')},'announce_holdtime':{'type':Sequelize[_0xe334('0x4')](_0xe334('0x15'),'no',_0xe334('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xe334('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xe334('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xe334('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xe334('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xe334('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xe334('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xe334('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xe334('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xe334('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xe334('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xe334('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xe334('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xe334('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xe334('0x2')]},'queue_less_than':{'type':Sequelize[_0xe334('0x2')]},'periodic_announce':{'type':Sequelize[_0xe334('0x17')],'set':function(_0x248bc8){this[_0xe334('0xb')](_0xe334('0x18'),_0x248bc8?_0x248bc8[_0xe334('0x19')](','):[]);},'get':function(){return this[_0xe334('0xd')](_0xe334('0x18'))?this[_0xe334('0xd')](_0xe334('0x18'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xe334('0x2')],'defaultValue':_0xe334('0x15'),'set':function(_0x2c16ed){this[_0xe334('0xb')](_0xe334('0x1a'),_0x2c16ed?_0x2c16ed[_0xe334('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0xe334('0x1a'))?this[_0xe334('0xd')](_0xe334('0x1a'))[_0xe334('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x247e00){this['setDataValue'](_0xe334('0x1c'),_0x247e00?_0x247e00[_0xe334('0x19')](','):undefined);},'get':function(){return this[_0xe334('0xd')](_0xe334('0x1c'))?this[_0xe334('0xd')](_0xe334('0x1c'))[_0xe334('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xe334('0x4')](_0xe334('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xe334('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xe334('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xe334('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xe334('0x1d')],'defaultValue':0x0,'set':function(_0xc65149){this[_0xe334('0xb')](_0xe334('0x1e'),_0xc65149);if(_0xc65149){if(this[_0xe334('0xd')](_0xe334('0x1f'))<0x2){this['setDataValue'](_0xe334('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xe334('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe334('0x20')},'dialMethod':{'type':Sequelize[_0xe334('0x4')](_0xe334('0x21'),_0xe334('0x11'),_0xe334('0x13'),_0xe334('0x12'),_0xe334('0xf')),'defaultValue':_0xe334('0x11'),'comment':_0xe334('0x22')},'dialLimitChannel':{'type':Sequelize[_0xe334('0x14')](0x4)[_0xe334('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xe334('0x14')](0x4)[_0xe334('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe334('0x24')},'dialPowerLevel':{'type':Sequelize[_0xe334('0x25')](0x2)[_0xe334('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xe334('0x26')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xe334('0x27'),_0xe334('0x28')),'defaultValue':_0xe334('0x28'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xe334('0x25')](0x2)[_0xe334('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xe334('0x14')](0x3)[_0xe334('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xe334('0x29')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe334('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xe334('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe334('0x2a')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xe334('0x2b'),'comment':_0xe334('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0xe334('0x14')](0x3)[_0xe334('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe334('0x2d')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xe334('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe334('0x14')](0x3)[_0xe334('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe334('0x14')](0x5)[_0xe334('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xe334('0x14')](0x3)[_0xe334('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe334('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe334('0x14')](0x5)[_0xe334('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe334('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe334('0x14')](0x3)[_0xe334('0x23')],'defaultValue':0x3,'comment':_0xe334('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe334('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe334('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe334('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe334('0x33')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe334('0x2')],'defaultValue':_0xe334('0x34')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never','onlyIfOpen'),'defaultValue':_0xe334('0x35')},'dialAMDActive':{'type':Sequelize[_0xe334('0x1d')],'defaultValue':0x0,'comment':_0xe334('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0xe334('0x14')](0x9)[_0xe334('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe334('0x37')},'dialAMDGreeting':{'type':Sequelize[_0xe334('0x14')](0x9)[_0xe334('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe334('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe334('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe334('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe334('0x14')](0x9)[_0xe334('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe334('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0xe334('0x14')](0x9)[_0xe334('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe334('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe334('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe334('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xe334('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe334('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe334('0x14')](0x9)[_0xe334('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xe334('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xe334('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0xe334('0x1d')],'defaultValue':0x0,'comment':_0xe334('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe334('0x4')](_0xe334('0x3f'),_0xe334('0x40')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xe334('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe334('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe334('0x41')},'dialCutDigit':{'type':Sequelize[_0xe334('0x14')](0x3)[_0xe334('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe334('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe334('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe334('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe334('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0xe334('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xe334('0x14')](0x5)[_0xe334('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe334('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe334('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe334('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe334('0x14')](0x5)[_0xe334('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe334('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0xe334('0x14')](0x3)[_0xe334('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe334('0x47')},'dialMachineRetryFrequency':{'type':Sequelize[_0xe334('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe334('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe334('0x14')](0x3)[_0xe334('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe334('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe334('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe334('0x14')],'allowNull':!![],'comment':_0xe334('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0xe334('0x1d')],'defaultValue':![],'comment':_0xe334('0x4b'),'set':function(_0x59c42f){if(!_0x59c42f)this['setDataValue'](_0xe334('0x4c'),null);this[_0xe334('0xb')](_0xe334('0x4d'),_0x59c42f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xe334('0x14')](0x3)[_0xe334('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xe334('0x14')](0x3)[_0xe334('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xe334('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0x96f3=['periodic_announce','split','joinempty','acw','BOOLEAN','Active/Disactive\x20Campaign','preview','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','name','ENUM','inbound','outbound','STRING','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','ringall','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','once','TEXT','join'];(function(_0x20be6d,_0x44e593){var _0x18076e=function(_0xa1c24c){while(--_0xa1c24c){_0x20be6d['push'](_0x20be6d['shift']());}};_0x18076e(++_0x44e593);}(_0x96f3,0x1b8));var _0x396f=function(_0x5cb9e3,_0x24d652){_0x5cb9e3=_0x5cb9e3-0x0;var _0x20e58c=_0x96f3[_0x5cb9e3];return _0x20e58c;};'use strict';var Sequelize=require(_0x396f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x396f('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x396f('0x2')](_0x396f('0x3'),_0x396f('0x4')),'allowNull':![],'defaultValue':_0x396f('0x3')},'musiconhold':{'type':Sequelize[_0x396f('0x5')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x396f('0x5')],'defaultValue':''},'strategy':{'type':Sequelize[_0x396f('0x2')]('rr','ringall',_0x396f('0x6'),_0x396f('0x7'),_0x396f('0x8'),_0x396f('0x9'),_0x396f('0xa'),_0x396f('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0x396f('0xc'),'set':function(_0x1516a8){this[_0x396f('0xd')](_0x396f('0xe'),_0x1516a8?_0x1516a8:'rrmemory');},'get':function(){var _0xc1c6d3=this[_0x396f('0xf')](_0x396f('0x10'));var _0x1ca5af=this['getDataValue'](_0x396f('0x11'));var _0x140353=this[_0x396f('0xf')]('strategy');if(_0xc1c6d3===_0x396f('0x3')){return _0x140353;}if(_0x1ca5af===_0x396f('0x12')&&_0x140353===_0x396f('0x9')||_0x1ca5af===_0x396f('0x12')&&_0x140353===_0x396f('0x13')){return _0x140353;}if(_0x1ca5af===_0x396f('0x14')||_0x1ca5af===_0x396f('0x15')||_0x1ca5af===_0x396f('0x16')){return _0x140353;}return null;}},'servicelevel':{'type':Sequelize[_0x396f('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x396f('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x396f('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x396f('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x396f('0x5')]},'weight':{'type':Sequelize[_0x396f('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x396f('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x396f('0x2')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x396f('0x2')](_0x396f('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x396f('0x17')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x396f('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x396f('0x2')](_0x396f('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x396f('0x2')](_0x396f('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x396f('0x2')](_0x396f('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x396f('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x396f('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x396f('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x396f('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x396f('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x396f('0x2')](_0x396f('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x396f('0x2')](_0x396f('0x18'),'no'),'defaultValue':_0x396f('0x18')},'announce_holdtime':{'type':Sequelize[_0x396f('0x2')](_0x396f('0x18'),'no',_0x396f('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x396f('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x396f('0x2')](_0x396f('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x396f('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x396f('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x396f('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x396f('0x5')]},'queue_youarenext':{'type':Sequelize[_0x396f('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x396f('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x396f('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x396f('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x396f('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x396f('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x396f('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x396f('0x5')]},'queue_less_than':{'type':Sequelize[_0x396f('0x5')]},'periodic_announce':{'type':Sequelize[_0x396f('0x1a')],'set':function(_0x13fec0){this[_0x396f('0xd')]('periodic_announce',_0x13fec0?_0x13fec0[_0x396f('0x1b')](','):[]);},'get':function(){return this[_0x396f('0xf')]('periodic_announce')?this['getDataValue'](_0x396f('0x1c'))[_0x396f('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x396f('0x5')],'defaultValue':_0x396f('0x18'),'set':function(_0x415aeb){this[_0x396f('0xd')]('joinempty',_0x415aeb?_0x415aeb[_0x396f('0x1b')](','):undefined);},'get':function(){return this[_0x396f('0xf')](_0x396f('0x1e'))?this[_0x396f('0xf')](_0x396f('0x1e'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x396f('0x5')],'defaultValue':'no','set':function(_0x398a3d){this[_0x396f('0xd')]('leavewhenempty',_0x398a3d?_0x398a3d[_0x396f('0x1b')](','):undefined);},'get':function(){return this[_0x396f('0xf')]('leavewhenempty')?this['getDataValue']('leavewhenempty')[_0x396f('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x396f('0x2')](_0x396f('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x396f('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x396f('0x2')](_0x396f('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x24e713){this[_0x396f('0xd')](_0x396f('0x1f'),_0x24e713);if(_0x24e713){if(this[_0x396f('0xf')]('wrapuptime')<0x2){this[_0x396f('0xd')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x396f('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x396f('0x20')],'defaultValue':0x0,'comment':_0x396f('0x21')},'dialMethod':{'type':Sequelize[_0x396f('0x2')](_0x396f('0x22'),'progressive','power','predictive',_0x396f('0x12')),'defaultValue':_0x396f('0x14'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x396f('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x396f('0x24')},'dialLimitQueue':{'type':Sequelize[_0x396f('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x396f('0x25')](0x2)[_0x396f('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x396f('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x396f('0x2')](_0x396f('0x27'),_0x396f('0x28')),'defaultValue':_0x396f('0x28'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x396f('0x25')](0x2)[_0x396f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x396f('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x396f('0x17')](0x3)[_0x396f('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x396f('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x396f('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x396f('0x17')](0x3)[_0x396f('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x396f('0x2b')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x396f('0x2c'),'comment':_0x396f('0x2d')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x396f('0x2e')},'dialQueueProject':{'type':Sequelize[_0x396f('0x5')],'comment':_0x396f('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x396f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x396f('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x396f('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x396f('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x396f('0x17')](0x3)[_0x396f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x396f('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x396f('0x17')](0x5)[_0x396f('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x396f('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x396f('0x17')](0x3)[_0x396f('0x23')],'defaultValue':0x3,'comment':_0x396f('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x396f('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x396f('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0x396f('0x17')](0x3)[_0x396f('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x396f('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x396f('0x5')],'defaultValue':_0x396f('0x36')},'dialPrefix':{'type':Sequelize[_0x396f('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x396f('0x2')](_0x396f('0x37'),_0x396f('0x38'),'onlyIfOpen'),'defaultValue':_0x396f('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x396f('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x396f('0x17')](0x9)[_0x396f('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x396f('0x17')](0x9)[_0x396f('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x396f('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x396f('0x17')](0x9)[_0x396f('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x396f('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x396f('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x396f('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x396f('0x17')](0x9)[_0x396f('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x396f('0x17')](0x9)[_0x396f('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x396f('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x396f('0x17')](0x9)[_0x396f('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x396f('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x396f('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x396f('0x17')](0x9)[_0x396f('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x396f('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x396f('0x17')](0x5)[_0x396f('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x396f('0x40')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x396f('0x41'),_0x396f('0x42')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x396f('0x5')],'comment':_0x396f('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x396f('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x396f('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x396f('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x396f('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x396f('0x17')](0x3)[_0x396f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x396f('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x396f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x396f('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0x396f('0x17')](0x5)[_0x396f('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x396f('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x396f('0x17')](0x3)[_0x396f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x396f('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x396f('0x17')](0x5)[_0x396f('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x396f('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x396f('0x17')](0x3)[_0x396f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x396f('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0x396f('0x17')](0x5)[_0x396f('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x396f('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x396f('0x17')](0x3)[_0x396f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x396f('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x396f('0x17')](0x5)[_0x396f('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x396f('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0x396f('0x20')],'defaultValue':![],'comment':_0x396f('0x4c'),'set':function(_0x5f436c){if(!_0x5f436c)this[_0x396f('0xd')]('mandatoryDispositionPauseId',null);this[_0x396f('0xd')](_0x396f('0x4d'),_0x5f436c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x396f('0x17')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x396f('0x17')](0x3)[_0x396f('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x396f('0x20')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x396f('0x20')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 7b294d2..50fba02 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 _0x92b0=['userVoiceQueue:save','ids','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','all','compact','transaction','isEmpty','removeAgents','addAgents','spread','SIP/%s','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','fromQuery','phone','scheduledAt','ListId','ContactId','CmListId','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','into','removeLists','getBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','get','VoiceQueues','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','pick','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','VoiceQueue','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','QueueCampaigns','UserProfileSection','clone','createdAt','updatedAt','omit','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','CmHopper','hasOwnProperty','sort','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','User','Agents','online','voicePause','penalty','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','interface','format','forEach','emit'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x92b0,0xf5));var _0x092b=function(_0x5f0d05,_0xea3dd2){_0x5f0d05=_0x5f0d05-0x0;var _0x4ea51a=_0x92b0[_0x5f0d05];return _0x4ea51a;};'use strict';var emlformat=require(_0x092b('0x0'));var rimraf=require(_0x092b('0x1'));var zipdir=require(_0x092b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x092b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x092b('0x4'));var util=require('util');var path=require(_0x092b('0x5'));var sox=require(_0x092b('0x6'));var csv=require(_0x092b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x092b('0x8'));var squel=require(_0x092b('0x9'));var crypto=require(_0x092b('0xa'));var jsforce=require(_0x092b('0xb'));var deskjs=require(_0x092b('0xc'));var toCsv=require(_0x092b('0x7'));var querystring=require(_0x092b('0xd'));var Papa=require(_0x092b('0xe'));var Redis=require(_0x092b('0xf'));var authService=require(_0x092b('0x10'));var qs=require(_0x092b('0x11'));var as=require(_0x092b('0x12'));var hardwareService=require(_0x092b('0x13'));var logger=require(_0x092b('0x14'))('api');var utils=require(_0x092b('0x15'));var config=require(_0x092b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x092b('0x17'))['db'];config[_0x092b('0x18')]=_[_0x092b('0x19')](config[_0x092b('0x18')],{'host':_0x092b('0x1a'),'port':0x18eb});var socket=require(_0x092b('0x1b'))(new Redis(config[_0x092b('0x18')]));require(_0x092b('0x1c'))[_0x092b('0x1d')](socket);function respondWithStatusCode(_0x4f86dc,_0x239bef){_0x239bef=_0x239bef||0xcc;return function(_0x232e71){if(_0x232e71){return _0x4f86dc[_0x092b('0x1e')](_0x239bef);}return _0x4f86dc[_0x092b('0x1f')](_0x239bef)[_0x092b('0x20')]();};}function respondWithResult(_0x300e85,_0x20fe2d){_0x20fe2d=_0x20fe2d||0xc8;return function(_0x3a36a0){if(_0x3a36a0){return _0x300e85[_0x092b('0x1f')](_0x20fe2d)[_0x092b('0x21')](_0x3a36a0);}};}function respondWithFilteredResult(_0x2024e6,_0x1ac575){return function(_0x12e91c){if(_0x12e91c){var _0x548b89=typeof _0x1ac575[_0x092b('0x22')]===_0x092b('0x23')&&typeof _0x1ac575[_0x092b('0x24')]===_0x092b('0x23');var _0xabcb10=_0x12e91c[_0x092b('0x25')];var _0x18f16c=_0x548b89?0x0:_0x1ac575[_0x092b('0x22')];var _0x807a3e=_0x548b89?_0x12e91c[_0x092b('0x25')]:_0x1ac575['offset']+_0x1ac575[_0x092b('0x24')];var _0x97e519;if(_0x807a3e>=_0xabcb10){_0x807a3e=_0xabcb10;_0x97e519=0xc8;}else{_0x97e519=0xce;}_0x2024e6[_0x092b('0x1f')](_0x97e519);return _0x2024e6[_0x092b('0x26')](_0x092b('0x27'),_0x18f16c+'-'+_0x807a3e+'/'+_0xabcb10)[_0x092b('0x21')](_0x12e91c);}return null;};}function patchUpdates(_0x441e30){return function(_0x33bccd){try{jsonpatch[_0x092b('0x28')](_0x33bccd,_0x441e30,!![]);}catch(_0x2ad8e7){return BPromise['reject'](_0x2ad8e7);}return _0x33bccd[_0x092b('0x29')]();};}function saveUpdates(_0x18f603,_0x1776d5){return function(_0x2226e0){if(_0x2226e0){return _0x2226e0['update'](_0x18f603)['then'](function(_0x3c09df){return _0x3c09df;});}return null;};}function removeEntity(_0x3ba76f,_0x1161b1){return function(_0x2b20e4){if(_0x2b20e4){return _0x2b20e4[_0x092b('0x2a')]()[_0x092b('0x2b')](function(){var _0x26f46f=_0x2b20e4[_0x092b('0x2c')]({'plain':!![]});var _0x3d4688=[{'name':_0x092b('0x2d'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0x092b('0x2e'),'ignore':![]}];var _0x4f943f=_(_0x3d4688)[_0x092b('0x2f')](_0x092b('0x30'))[_0x092b('0x31')](_0x092b('0x32'))[_0x092b('0x32')]();if(_[_0x092b('0x33')](_0x4f943f,_0x26f46f[_0x092b('0x34')])){return;}var _0x25e52b=_[_0x092b('0x35')](_0x3d4688,[_0x092b('0x32'),_0x26f46f[_0x092b('0x34')]])[_0x092b('0x36')];return db[_0x092b('0x37')]['destroy']({'where':{'type':_0x25e52b,'resourceId':_0x26f46f['id']}})['then'](function(){return _0x2b20e4;});})[_0x092b('0x2b')](function(){_0x3ba76f[_0x092b('0x1f')](0xcc)[_0x092b('0x20')]();});}};}function handleEntityNotFound(_0xfe5b4d,_0x4a8130){return function(_0x197632){if(!_0x197632){_0xfe5b4d[_0x092b('0x1e')](0x194);}return _0x197632;};}function handleError(_0x4ad3,_0x547465){_0x547465=_0x547465||0x1f4;return function(_0x432ad9){logger[_0x092b('0x38')](_0x432ad9[_0x092b('0x39')]);if(_0x432ad9[_0x092b('0x36')]){delete _0x432ad9[_0x092b('0x36')];}_0x4ad3[_0x092b('0x1f')](_0x547465)[_0x092b('0x3a')](_0x432ad9);};}exports[_0x092b('0x3b')]=function(_0x5e41f0,_0x37776e){var _0x46efd4={},_0x392067={},_0x4cda60={'count':0x0,'rows':[]};var _0x309abc=_[_0x092b('0x31')](db['VoiceQueue'][_0x092b('0x3c')],function(_0x505211){return{'name':_0x505211[_0x092b('0x3d')],'type':_0x505211[_0x092b('0x34')][_0x092b('0x3e')]};});_0x392067[_0x092b('0x3f')]=_[_0x092b('0x31')](_0x309abc,_0x092b('0x36'));_0x392067[_0x092b('0x40')]=_[_0x092b('0x41')](_0x5e41f0[_0x092b('0x40')]);_0x392067[_0x092b('0x42')]=_[_0x092b('0x43')](_0x392067[_0x092b('0x3f')],_0x392067[_0x092b('0x40')]);_0x46efd4[_0x092b('0x44')]=_[_0x092b('0x43')](_0x392067[_0x092b('0x3f')],qs['fields'](_0x5e41f0[_0x092b('0x40')][_0x092b('0x45')]));_0x46efd4[_0x092b('0x44')]=_0x46efd4[_0x092b('0x44')][_0x092b('0x46')]?_0x46efd4[_0x092b('0x44')]:_0x392067[_0x092b('0x3f')];if(!_0x5e41f0[_0x092b('0x40')]['hasOwnProperty'](_0x092b('0x47'))){_0x46efd4[_0x092b('0x24')]=qs[_0x092b('0x24')](_0x5e41f0[_0x092b('0x40')][_0x092b('0x24')]);_0x46efd4[_0x092b('0x22')]=qs[_0x092b('0x22')](_0x5e41f0[_0x092b('0x40')][_0x092b('0x22')]);}_0x46efd4[_0x092b('0x48')]=qs['sort'](_0x5e41f0[_0x092b('0x40')]['sort']);_0x46efd4['where']=qs[_0x092b('0x42')](_[_0x092b('0x49')](_0x5e41f0[_0x092b('0x40')],_0x392067[_0x092b('0x42')]),_0x309abc);if(_0x5e41f0['query'][_0x092b('0x2f')]){_0x46efd4[_0x092b('0x4a')]=_[_0x092b('0x4b')](_0x46efd4[_0x092b('0x4a')],{'$or':_[_0x092b('0x31')](_0x309abc,function(_0x331342){if(_0x331342[_0x092b('0x34')]!==_0x092b('0x4c')){var _0x5a8001={};_0x5a8001[_0x331342[_0x092b('0x36')]]={'$like':'%'+_0x5e41f0[_0x092b('0x40')][_0x092b('0x2f')]+'%'};return _0x5a8001;}})});}_0x46efd4=_[_0x092b('0x4b')]({},_0x46efd4,_0x5e41f0['options']);var _0x564393={'where':_0x46efd4[_0x092b('0x4a')]};return db['VoiceQueue'][_0x092b('0x25')](_0x564393)['then'](function(_0x386ade){_0x4cda60[_0x092b('0x25')]=_0x386ade;if(_0x5e41f0[_0x092b('0x40')][_0x092b('0x4d')]){_0x46efd4[_0x092b('0x4e')]=[{'all':!![]}];}return db['VoiceQueue'][_0x092b('0x4f')](_0x46efd4);})['then'](function(_0x1f4365){_0x4cda60[_0x092b('0x50')]=_0x1f4365;return _0x4cda60;})[_0x092b('0x2b')](respondWithFilteredResult(_0x37776e,_0x46efd4))[_0x092b('0x51')](handleError(_0x37776e,null));};exports[_0x092b('0x52')]=function(_0x11bdbc,_0x4e24d8){var _0x28182a={'raw':![],'where':{'id':_0x11bdbc[_0x092b('0x53')]['id']}},_0x49e370={};_0x49e370[_0x092b('0x3f')]=_[_0x092b('0x41')](db[_0x092b('0x54')][_0x092b('0x3c')]);_0x49e370[_0x092b('0x40')]=_['keys'](_0x11bdbc[_0x092b('0x40')]);_0x49e370[_0x092b('0x42')]=_['intersection'](_0x49e370[_0x092b('0x3f')],_0x49e370[_0x092b('0x40')]);_0x28182a['attributes']=_['intersection'](_0x49e370['model'],qs['fields'](_0x11bdbc['query'][_0x092b('0x45')]));_0x28182a[_0x092b('0x44')]=_0x28182a[_0x092b('0x44')][_0x092b('0x46')]?_0x28182a[_0x092b('0x44')]:_0x49e370['model'];if(_0x11bdbc[_0x092b('0x40')][_0x092b('0x4d')]){_0x28182a[_0x092b('0x4e')]=[{'all':!![]}];}_0x28182a=_['merge']({},_0x28182a,_0x11bdbc[_0x092b('0x55')]);return db[_0x092b('0x54')][_0x092b('0x35')](_0x28182a)[_0x092b('0x2b')](handleEntityNotFound(_0x4e24d8,null))['then'](respondWithResult(_0x4e24d8,null))[_0x092b('0x51')](handleError(_0x4e24d8,null));};exports['create']=function(_0xb62677,_0x42b535){return db[_0x092b('0x54')][_0x092b('0x56')](_0xb62677[_0x092b('0x57')],{})[_0x092b('0x2b')](function(_0x33b97e){var _0x1ccab1=_0xb62677[_0x092b('0x58')][_0x092b('0x2c')]({'plain':!![]});if(!_0x1ccab1)throw new Error(_0x092b('0x59'));if(_0x1ccab1[_0x092b('0x5a')]===_0x092b('0x58')){var _0x22bb19=_0x33b97e[_0x092b('0x2c')]({'plain':!![]});var _0x4f85cb=[{'name':_0x092b('0x2d'),'value':_0x092b('0x5b')},{'name':_0x092b('0x5c'),'value':'outbound'}];var _0x51822a=_['find'](_0x4f85cb,[_0x092b('0x32'),_0x22bb19['type']])[_0x092b('0x36')];return db[_0x092b('0x5d')]['find']({'where':{'name':_0x51822a,'userProfileId':_0x1ccab1['userProfileId']},'raw':!![]})[_0x092b('0x2b')](function(_0x32fe3e){if(_0x32fe3e&&_0x32fe3e['autoAssociation']===0x0){return db['UserProfileResource'][_0x092b('0x56')]({'name':_0x22bb19['name'],'resourceId':_0x22bb19['id'],'type':_0x32fe3e[_0x092b('0x36')],'sectionId':_0x32fe3e['id']},{})[_0x092b('0x2b')](function(){return _0x33b97e;});}else{return _0x33b97e;}})[_0x092b('0x51')](function(_0x4d496d){logger[_0x092b('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d496d);throw _0x4d496d;});}return _0x33b97e;})[_0x092b('0x2b')](respondWithResult(_0x42b535,0xc9))[_0x092b('0x51')](handleError(_0x42b535,null));};exports[_0x092b('0x5e')]=function(_0x2e372b,_0x1a4bba){var _0x56e04b={'where':{'id':_0x2e372b['params']['id']}},_0xe6a93e={};_0xe6a93e[_0x092b('0x3f')]=_['keys'](db[_0x092b('0x54')][_0x092b('0x3c')]);_0x56e04b['attributes']=_[_0x092b('0x43')](_0xe6a93e[_0x092b('0x3f')],qs[_0x092b('0x45')](_0x2e372b['query'][_0x092b('0x45')]));_0x56e04b[_0x092b('0x44')]=_0x56e04b['attributes'][_0x092b('0x46')]?_0x56e04b['attributes']:_0xe6a93e[_0x092b('0x3f')];if(_0x2e372b[_0x092b('0x40')][_0x092b('0x4d')]){_0x56e04b[_0x092b('0x4e')]=[{'all':!![]}];}_0x56e04b=_['merge']({},_0x56e04b,_0x2e372b[_0x092b('0x55')]);return db[_0x092b('0x54')]['find'](_0x56e04b)[_0x092b('0x2b')](handleEntityNotFound(_0x1a4bba,null))[_0x092b('0x2b')](function(_0x573e53){if(_0x573e53){var _0x1e87e1=_0x573e53[_0x092b('0x2c')]({'plain':!![]});_0x1e87e1=qs['omit'](_0x1e87e1,['id',_0x092b('0x5f'),_0x092b('0x60')]);_0x2e372b[_0x092b('0x57')]=_[_0x092b('0x61')](_0x2e372b[_0x092b('0x57')],['id',_0x092b('0x5f'),_0x092b('0x60')]);return db[_0x092b('0x54')][_0x092b('0x56')](_[_0x092b('0x4b')](_0x1e87e1,_0x2e372b[_0x092b('0x57')]),{'include':_0x2e372b[_0x092b('0x40')][_0x092b('0x4d')]?[{'all':!![]}]:undefined})[_0x092b('0x2b')](function(_0x28026a){var _0x5d0446=_0x2e372b[_0x092b('0x58')][_0x092b('0x2c')]({'plain':!![]});if(!_0x5d0446)throw new Error(_0x092b('0x59'));if(_0x5d0446[_0x092b('0x5a')]===_0x092b('0x58')){var _0x2e1656=_0x28026a[_0x092b('0x2c')]({'plain':!![]});var _0x572fb1=[{'name':_0x092b('0x2d'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x092b('0x2e')}];var _0x1d959e=_['find'](_0x572fb1,[_0x092b('0x32'),_0x2e1656[_0x092b('0x34')]])[_0x092b('0x36')];return db[_0x092b('0x5d')][_0x092b('0x35')]({'where':{'name':_0x1d959e,'userProfileId':_0x5d0446[_0x092b('0x62')]},'raw':!![]})['then'](function(_0x43cbdf){if(_0x43cbdf&&_0x43cbdf[_0x092b('0x63')]===0x0){return db[_0x092b('0x37')][_0x092b('0x56')]({'name':_0x2e1656[_0x092b('0x36')],'resourceId':_0x2e1656['id'],'type':_0x43cbdf[_0x092b('0x36')],'sectionId':_0x43cbdf['id']},{})[_0x092b('0x2b')](function(){return _0x28026a;});}else{return _0x28026a;}})[_0x092b('0x51')](function(_0xf0bd75){logger['error'](_0x092b('0x64'),_0xf0bd75);throw _0xf0bd75;});}return _0x28026a;});}})['then'](respondWithResult(_0x1a4bba,0xc9))[_0x092b('0x51')](handleError(_0x1a4bba,null));};exports[_0x092b('0x65')]=function(_0x1e5ba6,_0x340d17){if(_0x1e5ba6[_0x092b('0x57')]['id']){delete _0x1e5ba6[_0x092b('0x57')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x1e5ba6[_0x092b('0x53')]['id']}})[_0x092b('0x2b')](handleEntityNotFound(_0x340d17,null))[_0x092b('0x2b')](saveUpdates(_0x1e5ba6['body'],null))['then'](respondWithResult(_0x340d17,null))['catch'](handleError(_0x340d17,null));};exports['destroy']=function(_0x4c184f,_0x315b4a){return db[_0x092b('0x54')]['find']({'where':{'id':_0x4c184f[_0x092b('0x53')]['id']}})['then'](handleEntityNotFound(_0x315b4a,null))[_0x092b('0x2b')](removeEntity(_0x315b4a,null))[_0x092b('0x51')](handleError(_0x315b4a,null));};exports['getHoppers']=function(_0x520dde,_0x26124b,_0x34dc95){var _0x38834e={'raw':![],'where':{}};var _0xed1cf2={};var _0x294166={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x092b('0x66')]({'where':{'id':_0x520dde[_0x092b('0x53')]['id']}})[_0x092b('0x2b')](handleEntityNotFound(_0x26124b,null))['then'](function(_0x535278){if(_0x535278){_0xed1cf2['model']=_['keys'](db[_0x092b('0x67')][_0x092b('0x3c')]);_0xed1cf2[_0x092b('0x40')]=_[_0x092b('0x41')](_0x520dde[_0x092b('0x40')]);_0xed1cf2[_0x092b('0x42')]=_['intersection'](_0xed1cf2[_0x092b('0x3f')],_0xed1cf2[_0x092b('0x40')]);_0x38834e['attributes']=_[_0x092b('0x43')](_0xed1cf2[_0x092b('0x3f')],qs[_0x092b('0x45')](_0x520dde[_0x092b('0x40')][_0x092b('0x45')]));_0x38834e[_0x092b('0x44')]=_0x38834e[_0x092b('0x44')]['length']?_0x38834e[_0x092b('0x44')]:_0xed1cf2[_0x092b('0x3f')];if(!_0x520dde['query'][_0x092b('0x68')](_0x092b('0x47'))){_0x38834e[_0x092b('0x24')]=qs[_0x092b('0x24')](_0x520dde[_0x092b('0x40')]['limit']);_0x38834e[_0x092b('0x22')]=qs[_0x092b('0x22')](_0x520dde[_0x092b('0x40')][_0x092b('0x22')]);}_0x38834e[_0x092b('0x48')]=qs['sort'](_0x520dde[_0x092b('0x40')][_0x092b('0x69')]);_0x38834e['where']=qs[_0x092b('0x42')](_[_0x092b('0x49')](_0x520dde['query'],_0xed1cf2[_0x092b('0x42')]));_0x38834e[_0x092b('0x4a')][_0x092b('0x6a')]=_0x535278['id'];if(_0x520dde[_0x092b('0x40')][_0x092b('0x2f')]){_0x38834e[_0x092b('0x4a')]=_[_0x092b('0x4b')](_0x38834e[_0x092b('0x4a')],{'$or':_[_0x092b('0x31')](_0x38834e[_0x092b('0x44')],function(_0x503db1){var _0x2b76a2={};_0x2b76a2[_0x503db1]={'$like':'%'+_0x520dde[_0x092b('0x40')][_0x092b('0x2f')]+'%'};return _0x2b76a2;})});}_0x38834e=_[_0x092b('0x4b')]({},_0x38834e,_0x520dde[_0x092b('0x55')]);return db[_0x092b('0x67')][_0x092b('0x25')]({'where':_0x38834e[_0x092b('0x4a')]})[_0x092b('0x2b')](function(_0x37f5e3){_0x294166[_0x092b('0x25')]=_0x37f5e3;if(_0x520dde[_0x092b('0x40')][_0x092b('0x4d')]){_0x38834e[_0x092b('0x4e')]=[{'all':!![]}];}return db[_0x092b('0x67')][_0x092b('0x4f')](_0x38834e);})[_0x092b('0x2b')](function(_0xb125ab){_0x294166[_0x092b('0x50')]=_0xb125ab;return _0x294166;});}})[_0x092b('0x2b')](respondWithFilteredResult(_0x26124b,_0x38834e))['catch'](handleError(_0x26124b,null));};exports['getHopperHistories']=function(_0x48492f,_0x440aa5,_0x19db3d){var _0xcec95a={'raw':!![],'where':{}};var _0x2647ea={};var _0x343751={'count':0x0,'rows':[]};return db[_0x092b('0x54')][_0x092b('0x66')]({'where':{'id':_0x48492f[_0x092b('0x53')]['id']}})[_0x092b('0x2b')](handleEntityNotFound(_0x440aa5,null))[_0x092b('0x2b')](function(_0x3621b0){if(_0x3621b0){_0x2647ea[_0x092b('0x3f')]=_['keys'](db[_0x092b('0x6b')][_0x092b('0x3c')]);_0x2647ea['query']=_[_0x092b('0x41')](_0x48492f[_0x092b('0x40')]);_0x2647ea['filters']=_['intersection'](_0x2647ea['model'],_0x2647ea[_0x092b('0x40')]);_0xcec95a[_0x092b('0x44')]=_['intersection'](_0x2647ea['model'],qs[_0x092b('0x45')](_0x48492f[_0x092b('0x40')][_0x092b('0x45')]));_0xcec95a[_0x092b('0x44')]=_0xcec95a[_0x092b('0x44')][_0x092b('0x46')]?_0xcec95a[_0x092b('0x44')]:_0x2647ea['model'];if(!_0x48492f[_0x092b('0x40')][_0x092b('0x68')](_0x092b('0x47'))){_0xcec95a['limit']=qs[_0x092b('0x24')](_0x48492f[_0x092b('0x40')][_0x092b('0x24')]);_0xcec95a[_0x092b('0x22')]=qs['offset'](_0x48492f['query'][_0x092b('0x22')]);}_0xcec95a['order']=qs['sort'](_0x48492f[_0x092b('0x40')][_0x092b('0x69')]);_0xcec95a[_0x092b('0x4a')]=qs[_0x092b('0x42')](_[_0x092b('0x49')](_0x48492f['query'],_0x2647ea[_0x092b('0x42')]));_0xcec95a[_0x092b('0x4a')][_0x092b('0x6a')]=_0x3621b0['id'];if(_0x48492f['query'][_0x092b('0x2f')]){_0xcec95a[_0x092b('0x4a')]=_[_0x092b('0x4b')](_0xcec95a['where'],{'$or':_['map'](_0xcec95a[_0x092b('0x44')],function(_0x44c67f){var _0x5a4134={};_0x5a4134[_0x44c67f]={'$like':'%'+_0x48492f[_0x092b('0x40')]['filter']+'%'};return _0x5a4134;})});}_0xcec95a=_[_0x092b('0x4b')]({},_0xcec95a,_0x48492f[_0x092b('0x55')]);return db['CmHopperHistory']['count']({'where':_0xcec95a[_0x092b('0x4a')]})[_0x092b('0x2b')](function(_0x1d0a93){_0x343751[_0x092b('0x25')]=_0x1d0a93;if(_0x48492f[_0x092b('0x40')][_0x092b('0x4d')]){_0xcec95a[_0x092b('0x4e')]=[{'all':!![]}];}return db[_0x092b('0x6b')][_0x092b('0x4f')](_0xcec95a);})[_0x092b('0x2b')](function(_0x4beafe){_0x343751[_0x092b('0x50')]=_0x4beafe;return _0x343751;});}})[_0x092b('0x2b')](respondWithFilteredResult(_0x440aa5,_0xcec95a))[_0x092b('0x51')](handleError(_0x440aa5,null));};exports[_0x092b('0x6c')]=function(_0x2f5ca6,_0x31c8f3,_0x314d76){var _0x10a6ff={'raw':!![],'where':{}};var _0x5173b8={};var _0x246d6d={'count':0x0,'rows':[]};return db[_0x092b('0x54')][_0x092b('0x66')]({'where':{'id':_0x2f5ca6[_0x092b('0x53')]['id']}})[_0x092b('0x2b')](handleEntityNotFound(_0x31c8f3,null))['then'](function(_0x360e43){if(_0x360e43){_0x5173b8[_0x092b('0x3f')]=_[_0x092b('0x41')](db['CmHopperFinal'][_0x092b('0x3c')]);_0x5173b8[_0x092b('0x40')]=_[_0x092b('0x41')](_0x2f5ca6['query']);_0x5173b8[_0x092b('0x42')]=_[_0x092b('0x43')](_0x5173b8[_0x092b('0x3f')],_0x5173b8[_0x092b('0x40')]);_0x10a6ff[_0x092b('0x44')]=_[_0x092b('0x43')](_0x5173b8[_0x092b('0x3f')],qs[_0x092b('0x45')](_0x2f5ca6[_0x092b('0x40')][_0x092b('0x45')]));_0x10a6ff[_0x092b('0x44')]=_0x10a6ff[_0x092b('0x44')][_0x092b('0x46')]?_0x10a6ff[_0x092b('0x44')]:_0x5173b8[_0x092b('0x3f')];if(!_0x2f5ca6[_0x092b('0x40')]['hasOwnProperty']('nolimit')){_0x10a6ff[_0x092b('0x24')]=qs['limit'](_0x2f5ca6[_0x092b('0x40')]['limit']);_0x10a6ff[_0x092b('0x22')]=qs[_0x092b('0x22')](_0x2f5ca6['query'][_0x092b('0x22')]);}_0x10a6ff[_0x092b('0x48')]=qs['sort'](_0x2f5ca6['query']['sort']);_0x10a6ff[_0x092b('0x4a')]=qs['filters'](_[_0x092b('0x49')](_0x2f5ca6['query'],_0x5173b8[_0x092b('0x42')]));_0x10a6ff['where']['VoiceQueueId']=_0x360e43['id'];if(_0x2f5ca6['query']['filter']){_0x10a6ff[_0x092b('0x4a')]=_['merge'](_0x10a6ff['where'],{'$or':_[_0x092b('0x31')](_0x10a6ff[_0x092b('0x44')],function(_0x1ded03){var _0x23f2a1={};_0x23f2a1[_0x1ded03]={'$like':'%'+_0x2f5ca6[_0x092b('0x40')]['filter']+'%'};return _0x23f2a1;})});}_0x10a6ff=_[_0x092b('0x4b')]({},_0x10a6ff,_0x2f5ca6[_0x092b('0x55')]);return db['CmHopperFinal'][_0x092b('0x25')]({'where':_0x10a6ff['where']})[_0x092b('0x2b')](function(_0x460d9a){_0x246d6d[_0x092b('0x25')]=_0x460d9a;if(_0x2f5ca6[_0x092b('0x40')][_0x092b('0x4d')]){_0x10a6ff[_0x092b('0x4e')]=[{'all':!![]}];}return db[_0x092b('0x6d')][_0x092b('0x4f')](_0x10a6ff);})[_0x092b('0x2b')](function(_0x3a51df){_0x246d6d[_0x092b('0x50')]=_0x3a51df;return _0x246d6d;});}})[_0x092b('0x2b')](respondWithFilteredResult(_0x31c8f3,_0x10a6ff))[_0x092b('0x51')](handleError(_0x31c8f3,null));};exports[_0x092b('0x6e')]=function(_0x71a1c5,_0x3a9642,_0xda2d64){var _0x3282af={'raw':!![],'where':{}};var _0x46c797={};var _0x35aa5d={'count':0x0,'rows':[]};return db[_0x092b('0x54')]['findOne']({'where':{'id':_0x71a1c5[_0x092b('0x53')]['id']}})['then'](handleEntityNotFound(_0x3a9642,null))[_0x092b('0x2b')](function(_0x3021a9){if(_0x3021a9){_0x46c797[_0x092b('0x3f')]=_[_0x092b('0x41')](db[_0x092b('0x6f')][_0x092b('0x3c')]);_0x46c797[_0x092b('0x40')]=_[_0x092b('0x41')](_0x71a1c5['query']);_0x46c797[_0x092b('0x42')]=_['intersection'](_0x46c797[_0x092b('0x3f')],_0x46c797[_0x092b('0x40')]);_0x3282af[_0x092b('0x44')]=_['intersection'](_0x46c797[_0x092b('0x3f')],qs[_0x092b('0x45')](_0x71a1c5[_0x092b('0x40')][_0x092b('0x45')]));_0x3282af[_0x092b('0x44')]=_0x3282af['attributes'][_0x092b('0x46')]?_0x3282af[_0x092b('0x44')]:_0x46c797[_0x092b('0x3f')];if(!_0x71a1c5[_0x092b('0x40')][_0x092b('0x68')]('nolimit')){_0x3282af[_0x092b('0x24')]=qs[_0x092b('0x24')](_0x71a1c5['query'][_0x092b('0x24')]);_0x3282af[_0x092b('0x22')]=qs[_0x092b('0x22')](_0x71a1c5[_0x092b('0x40')][_0x092b('0x22')]);}_0x3282af['order']=qs['sort'](_0x71a1c5[_0x092b('0x40')][_0x092b('0x69')]);_0x3282af[_0x092b('0x4a')]=qs['filters'](_[_0x092b('0x49')](_0x71a1c5[_0x092b('0x40')],_0x46c797[_0x092b('0x42')]));_0x3282af[_0x092b('0x4a')]['VoiceQueueId']=_0x3021a9['id'];if(_0x71a1c5[_0x092b('0x40')][_0x092b('0x2f')]){_0x3282af[_0x092b('0x4a')]=_[_0x092b('0x4b')](_0x3282af[_0x092b('0x4a')],{'$or':_['map'](_0x3282af[_0x092b('0x44')],function(_0x57835b){var _0x24eaef={};_0x24eaef[_0x57835b]={'$like':'%'+_0x71a1c5[_0x092b('0x40')][_0x092b('0x2f')]+'%'};return _0x24eaef;})});}_0x3282af=_[_0x092b('0x4b')]({},_0x3282af,_0x71a1c5[_0x092b('0x55')]);return db[_0x092b('0x6f')][_0x092b('0x25')]({'where':_0x3282af[_0x092b('0x4a')]})[_0x092b('0x2b')](function(_0x49e71d){_0x35aa5d['count']=_0x49e71d;if(_0x71a1c5['query'][_0x092b('0x4d')]){_0x3282af[_0x092b('0x4e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x092b('0x4f')](_0x3282af);})[_0x092b('0x2b')](function(_0x35e066){_0x35aa5d[_0x092b('0x50')]=_0x35e066;return _0x35aa5d;});}})[_0x092b('0x2b')](respondWithFilteredResult(_0x3a9642,_0x3282af))['catch'](handleError(_0x3a9642,null));};exports[_0x092b('0x70')]=function(_0x4670f4,_0x210897,_0x318c96){var _0x21fb2c={};var _0x2f1162={};var _0x2e2261;var _0x4c069d;return db[_0x092b('0x54')][_0x092b('0x66')]({'where':{'id':_0x4670f4['params']['id']}})['then'](handleEntityNotFound(_0x210897,null))[_0x092b('0x2b')](function(_0x57afe3){if(_0x57afe3){_0x2e2261=_0x57afe3;_0x2f1162[_0x092b('0x3f')]=_[_0x092b('0x41')](db[_0x092b('0x71')][_0x092b('0x3c')]);_0x2f1162[_0x092b('0x40')]=_[_0x092b('0x41')](_0x4670f4['query']);_0x2f1162[_0x092b('0x42')]=_[_0x092b('0x43')](_0x2f1162[_0x092b('0x3f')],_0x2f1162[_0x092b('0x40')]);_0x21fb2c['attributes']=_['intersection'](_0x2f1162[_0x092b('0x3f')],qs[_0x092b('0x45')](_0x4670f4[_0x092b('0x40')][_0x092b('0x45')]));_0x21fb2c['attributes']=_0x21fb2c[_0x092b('0x44')][_0x092b('0x46')]?_0x21fb2c['attributes']:_0x2f1162['model'];_0x21fb2c['order']=qs[_0x092b('0x69')](_0x4670f4[_0x092b('0x40')][_0x092b('0x69')]);_0x21fb2c[_0x092b('0x4a')]=qs[_0x092b('0x42')](_[_0x092b('0x49')](_0x4670f4[_0x092b('0x40')],_0x2f1162[_0x092b('0x42')]));if(_0x4670f4['query'][_0x092b('0x2f')]){_0x21fb2c[_0x092b('0x4a')]=_[_0x092b('0x4b')](_0x21fb2c[_0x092b('0x4a')],{'$or':_[_0x092b('0x31')](_0x21fb2c[_0x092b('0x44')],function(_0x39705e){var _0x320bd9={};_0x320bd9[_0x39705e]={'$like':'%'+_0x4670f4[_0x092b('0x40')][_0x092b('0x2f')]+'%'};return _0x320bd9;})});}_0x21fb2c=_[_0x092b('0x4b')]({},_0x21fb2c,_0x4670f4[_0x092b('0x55')]);return _0x2e2261['getTeams'](_0x21fb2c);}})['then'](function(_0xb6c7dd){if(_0xb6c7dd){_0x4c069d=_0xb6c7dd[_0x092b('0x46')];if(!_0x4670f4[_0x092b('0x40')][_0x092b('0x68')](_0x092b('0x47'))){_0x21fb2c['limit']=qs[_0x092b('0x24')](_0x4670f4[_0x092b('0x40')][_0x092b('0x24')]);_0x21fb2c[_0x092b('0x22')]=qs['offset'](_0x4670f4[_0x092b('0x40')][_0x092b('0x22')]);}return _0x2e2261[_0x092b('0x70')](_0x21fb2c);}})[_0x092b('0x2b')](function(_0x20fa20){if(_0x20fa20){return _0x20fa20?{'count':_0x4c069d,'rows':_0x20fa20}:null;}})['then'](respondWithResult(_0x210897,null))['catch'](handleError(_0x210897,null));};exports['addTeams']=function(_0x44c005,_0x4c236a,_0xee3295){var _0x1188f7=_0x44c005[_0x092b('0x57')][_0x092b('0x72')];var _0x5cfe46=_[_0x092b('0x31')](_0x1188f7,'id');return db[_0x092b('0x71')]['findAll']({'where':{'id':_0x5cfe46},'attributes':['id'],'include':[{'model':db[_0x092b('0x73')],'as':_0x092b('0x74'),'attributes':['id',_0x092b('0x36'),_0x092b('0x75'),_0x092b('0x76'),'interface'],'raw':!![]}]})[_0x092b('0x2b')](function(_0x315eec){if(_0x315eec){var _0x24e6b2=_['flatMap'](_0x315eec,function(_0x4ef16e){var _0xdacec5=_0x4ef16e['get']({'plain':!![]});_0xdacec5['Agents']['forEach'](function(_0x41af5f){_0x41af5f[_0x092b('0x77')]=_[_0x092b('0x35')](_0x1188f7,{'id':_0xdacec5['id']})[_0x092b('0x77')];});return _0xdacec5[_0x092b('0x74')];});return db[_0x092b('0x54')]['find']({'where':{'id':_0x44c005[_0x092b('0x53')]['id']}})[_0x092b('0x2b')](function(_0x5df6c9){return db['sequelize']['transaction'](function(_0x4ce8f6){return _0x5df6c9['addTeams'](_0x5cfe46,{'transaction':_0x4ce8f6})['then'](function(){return BPromise[_0x092b('0x78')](_0x1188f7,function(_0x4b53f7){return db[_0x092b('0x79')][_0x092b('0x7a')]({'TeamId':_0x4b53f7['id'],'VoiceQueueId':_0x44c005[_0x092b('0x53')]['id'],'penalty':_0x4b53f7[_0x092b('0x77')]},{'transaction':_0x4ce8f6});});})[_0x092b('0x2b')](function(){return BPromise[_0x092b('0x78')](_0x24e6b2,function(_0x51c9a4){return db[_0x092b('0x7b')][_0x092b('0x7c')]({'where':{'UserId':_0x51c9a4['id'],'VoiceQueueId':_0x44c005[_0x092b('0x53')]['id']},'defaults':{'penalty':_0x51c9a4[_0x092b('0x77')]},'transaction':_0x4ce8f6});});})[_0x092b('0x2b')](function(){return BPromise[_0x092b('0x78')](_[_0x092b('0x2f')](_0x24e6b2,{'online':!![]}),function(_0x1ec194){return db[_0x092b('0x7d')][_0x092b('0x7a')]({'membername':_0x1ec194[_0x092b('0x36')],'UserId':_0x1ec194['id'],'queue_name':_0x5df6c9[_0x092b('0x36')],'VoiceQueueId':_0x5df6c9['id'],'interface':_[_0x092b('0x7e')](_0x1ec194[_0x092b('0x7f')])?util[_0x092b('0x80')]('SIP/%s',_0x1ec194[_0x092b('0x36')]):_0x1ec194[_0x092b('0x7f')],'paused':_0x1ec194[_0x092b('0x76')]||![],'penalty':_0x1ec194[_0x092b('0x77')]},{'transaction':_0x4ce8f6});});})['then'](function(){_0x24e6b2[_0x092b('0x81')](function(_0x27192a){socket[_0x092b('0x82')](_0x092b('0x83'),{'UserId':_0x27192a['id'],'VoiceQueueId':_0x5df6c9['id']});});});});});}})[_0x092b('0x2b')](respondWithStatusCode(_0x4c236a,null))[_0x092b('0x51')](handleError(_0x4c236a,null));};exports['removeTeams']=function(_0x2330b4,_0x36df88,_0x21fba8){return db[_0x092b('0x71')][_0x092b('0x4f')]({'where':{'id':_0x2330b4[_0x092b('0x40')][_0x092b('0x84')]},'attributes':['id'],'include':[{'model':db[_0x092b('0x73')],'as':_0x092b('0x74'),'attributes':['id'],'raw':!![]}]})[_0x092b('0x2b')](handleEntityNotFound(_0x36df88,null))[_0x092b('0x2b')](function(_0x14432a){var _0x1a3663=_['map'](_0x14432a,'id');var _0xa9a000=[];var _0x3d2f7c=[];var _0x42069e=squel[_0x092b('0x85')]();_0x42069e[_0x092b('0x86')](_0x092b('0x87'))['from'](_0x092b('0x88'),'tq')[_0x092b('0x89')](_0x092b('0x8a'),'ut',_0x092b('0x8b'))[_0x092b('0x4a')](_0x092b('0x8c'),_0x2330b4[_0x092b('0x53')]['id']);for(var _0x40e102=0x0;_0x40e102<_0x14432a[_0x092b('0x46')];_0x40e102+=0x1){let _0x5ee777=_0x14432a[_0x40e102];for(var _0x59f16a=0x0;_0x59f16a<_0x5ee777[_0x092b('0x74')]['length'];_0x59f16a+=0x1){let _0x33e0a3=_0x5ee777['Agents'][_0x59f16a];var _0x5e9937=_0x42069e[_0x092b('0x5e')]();_0x5e9937[_0x092b('0x4a')]('ut.UserId\x20=\x20?',_0x33e0a3['id']);_0x3d2f7c[_0x092b('0x8d')](db[_0x092b('0x8e')][_0x092b('0x40')](_0x5e9937[_0x092b('0x8f')](),{'type':db[_0x092b('0x8e')]['QueryTypes'][_0x092b('0x90')]})[_0x092b('0x2b')](function(_0x46b431){if(_0x46b431[_0x092b('0x46')]===0x1){return _0x33e0a3['id'];}else{var _0x22b638=_[_0x092b('0x91')](_[_0x092b('0x31')](_0x46b431,_0x092b('0x92')),function(_0x5b9183){return _[_0x092b('0x33')](_0x1a3663,_0x5b9183);});if(_0x22b638){return _0x33e0a3['id'];}}}));}}return BPromise[_0x092b('0x93')](_0x3d2f7c)['then'](function(_0x570e06){_0xa9a000=_(_0xa9a000)['union'](_0x570e06)[_0x092b('0x94')]()[_0x092b('0x32')]();return db[_0x092b('0x54')][_0x092b('0x35')]({'where':{'id':_0x2330b4[_0x092b('0x53')]['id']}})['then'](function(_0x474279){return db[_0x092b('0x8e')][_0x092b('0x95')](function(_0xdce03c){return _0x474279['removeTeams'](_0x2330b4[_0x092b('0x40')][_0x092b('0x84')],{'transaction':_0xdce03c})[_0x092b('0x2b')](function(){if(!_[_0x092b('0x96')](_0xa9a000)){return _0x474279[_0x092b('0x97')](_0xa9a000,{'transaction':_0xdce03c})[_0x092b('0x2b')](function(){return db[_0x092b('0x7d')]['destroy']({'where':{'VoiceQueueId':_0x2330b4[_0x092b('0x53')]['id'],'UserId':_0xa9a000},'transaction':_0xdce03c});});}})['then'](function(){_0xa9a000[_0x092b('0x81')](function(_0x3f1bea){socket['emit']('userVoiceQueue:remove',{'UserId':_0x3f1bea,'VoiceQueueId':_0x474279['id']});});});});});});})[_0x092b('0x2b')](respondWithStatusCode(_0x36df88,null))[_0x092b('0x51')](handleError(_0x36df88,null));};exports['addAgents']=function(_0x468148,_0x471f48,_0x4c7c42){var _0x2ec44c,_0x2e69ac;return db[_0x092b('0x54')][_0x092b('0x35')]({'where':{'id':_0x468148[_0x092b('0x53')]['id']}})[_0x092b('0x2b')](handleEntityNotFound(_0x471f48,null))[_0x092b('0x2b')](function(_0x1c0787){if(_0x1c0787){_0x2e69ac=_0x1c0787;return _0x1c0787[_0x092b('0x98')](_0x468148[_0x092b('0x57')][_0x092b('0x84')],_[_0x092b('0x61')](_0x468148['body'],[_0x092b('0x84'),'id'])||{})[_0x092b('0x99')](function(_0x31ba1a){for(var _0xd454e8=0x0;_0xd454e8<_0x468148[_0x092b('0x57')][_0x092b('0x84')][_0x092b('0x46')];_0xd454e8+=0x1){socket[_0x092b('0x82')]('userVoiceQueue:save',{'UserId':Number(_0x468148[_0x092b('0x57')][_0x092b('0x84')][_0xd454e8]),'VoiceQueueId':Number(_0x468148[_0x092b('0x53')]['id'])});}return _0x31ba1a;});}})[_0x092b('0x2b')](function(_0x1b8eff){_0x2ec44c=_0x1b8eff||[];if(_0x2e69ac){return db['User'][_0x092b('0x4f')]({'where':{'id':_0x468148['body'][_0x092b('0x84')]},'attributes':['id','name',_0x092b('0x75'),_0x092b('0x76'),'interface'],'raw':!![]});}})['then'](function(_0x18e599){if(!_[_0x092b('0x96')](_0x18e599)){var _0x1f9c6d=[];for(var _0x5da9a5=0x0;_0x5da9a5<_0x18e599[_0x092b('0x46')];_0x5da9a5++){if(_0x18e599[_0x5da9a5]['online']){_0x1f9c6d[_0x092b('0x8d')](db['UserVoiceQueueRt'][_0x092b('0x7a')]({'membername':_0x18e599[_0x5da9a5][_0x092b('0x36')],'UserId':_0x18e599[_0x5da9a5]['id'],'queue_name':_0x2e69ac[_0x092b('0x36')],'VoiceQueueId':_0x2e69ac['id'],'interface':_[_0x092b('0x7e')](_0x18e599[_0x5da9a5]['interface'])?util['format'](_0x092b('0x9a'),_0x18e599[_0x5da9a5]['name']):_0x18e599[_0x5da9a5][_0x092b('0x7f')],'paused':_0x18e599[_0x5da9a5]['voicePause']||![],'penalty':_0x468148[_0x092b('0x57')][_0x092b('0x77')]||0x0}));}}return BPromise[_0x092b('0x93')](_0x1f9c6d);}})['then'](function(){return _0x2ec44c;})[_0x092b('0x2b')](respondWithResult(_0x471f48,null))['catch'](handleError(_0x471f48,null));};exports[_0x092b('0x97')]=function(_0x1dcca8,_0x55aba5,_0x4ddb57){return db[_0x092b('0x54')][_0x092b('0x35')]({'where':{'id':_0x1dcca8[_0x092b('0x53')]['id']}})[_0x092b('0x2b')](handleEntityNotFound(_0x55aba5,null))[_0x092b('0x2b')](function(_0x4ecf20){if(_0x4ecf20){return _0x4ecf20[_0x092b('0x97')](_0x1dcca8[_0x092b('0x40')]['ids'])[_0x092b('0x2b')](function(){if(_[_0x092b('0x9b')](_0x1dcca8[_0x092b('0x40')][_0x092b('0x84')])){for(var _0x156d0f=0x0;_0x156d0f<_0x1dcca8[_0x092b('0x40')][_0x092b('0x84')][_0x092b('0x46')];_0x156d0f+=0x1){socket['emit'](_0x092b('0x9c'),{'UserId':Number(_0x1dcca8[_0x092b('0x40')][_0x092b('0x84')][_0x156d0f]),'VoiceQueueId':Number(_0x1dcca8[_0x092b('0x53')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x1dcca8['query'][_0x092b('0x84')]),'VoiceQueueId':Number(_0x1dcca8[_0x092b('0x53')]['id'])});}});}})[_0x092b('0x2b')](function(_0x305ecf){return db[_0x092b('0x7d')][_0x092b('0x2a')]({'where':{'VoiceQueueId':_0x1dcca8[_0x092b('0x53')]['id'],'UserId':_0x1dcca8[_0x092b('0x40')][_0x092b('0x84')]}})[_0x092b('0x2b')](function(){return _0x305ecf;});})[_0x092b('0x2b')](respondWithStatusCode(_0x55aba5,null))['catch'](handleError(_0x55aba5,null));};exports[_0x092b('0x9d')]=function(_0x1de7ea,_0x59ae2d,_0x1ce518){var _0x2c0087={};var _0x535422={};var _0x1e5d86;var _0x4fc633;return db[_0x092b('0x54')][_0x092b('0x66')]({'where':{'id':_0x1de7ea[_0x092b('0x53')]['id']}})[_0x092b('0x2b')](handleEntityNotFound(_0x59ae2d,null))[_0x092b('0x2b')](function(_0x5c2f23){if(_0x5c2f23){_0x1e5d86=_0x5c2f23;_0x535422[_0x092b('0x3f')]=_[_0x092b('0x41')](db[_0x092b('0x73')][_0x092b('0x3c')]);_0x535422[_0x092b('0x40')]=_[_0x092b('0x41')](_0x1de7ea[_0x092b('0x40')]);_0x535422[_0x092b('0x42')]=_['intersection'](_0x535422[_0x092b('0x3f')],_0x535422[_0x092b('0x40')]);_0x2c0087[_0x092b('0x44')]=_['intersection'](_0x535422[_0x092b('0x3f')],qs[_0x092b('0x45')](_0x1de7ea['query'][_0x092b('0x45')]));_0x2c0087[_0x092b('0x44')]=_0x2c0087['attributes']['length']?_0x2c0087[_0x092b('0x44')]:_0x535422['model'];_0x2c0087['order']=qs[_0x092b('0x69')](_0x1de7ea[_0x092b('0x40')][_0x092b('0x69')]);_0x2c0087[_0x092b('0x4a')]=qs[_0x092b('0x42')](_[_0x092b('0x49')](_0x1de7ea[_0x092b('0x40')],_0x535422[_0x092b('0x42')]));if(_0x1de7ea['query'][_0x092b('0x2f')]){_0x2c0087[_0x092b('0x4a')]=_[_0x092b('0x4b')](_0x2c0087[_0x092b('0x4a')],{'$or':_[_0x092b('0x31')](_0x2c0087[_0x092b('0x44')],function(_0x7a3503){var _0x43b79d={};_0x43b79d[_0x7a3503]={'$like':'%'+_0x1de7ea[_0x092b('0x40')][_0x092b('0x2f')]+'%'};return _0x43b79d;})});}_0x2c0087=_[_0x092b('0x4b')]({},_0x2c0087,_0x1de7ea[_0x092b('0x55')]);return _0x1e5d86[_0x092b('0x9d')](_0x2c0087);}})[_0x092b('0x2b')](function(_0x3942ae){if(_0x3942ae){_0x4fc633=_0x3942ae[_0x092b('0x46')];if(!_0x1de7ea[_0x092b('0x40')][_0x092b('0x68')](_0x092b('0x47'))){_0x2c0087[_0x092b('0x24')]=qs['limit'](_0x1de7ea[_0x092b('0x40')]['limit']);_0x2c0087[_0x092b('0x22')]=qs[_0x092b('0x22')](_0x1de7ea['query'][_0x092b('0x22')]);}return _0x1e5d86['getAgents'](_0x2c0087);}})['then'](function(_0x1830e9){if(_0x1830e9){return _0x1830e9?{'count':_0x4fc633,'rows':_0x1830e9}:null;}})['then'](respondWithResult(_0x59ae2d,null))[_0x092b('0x51')](handleError(_0x59ae2d,null));};exports[_0x092b('0x9e')]=function(_0x22302a,_0x5d8556,_0x5f0d6){var _0x74d374={};var _0x3805ac={};var _0x333004;var _0x1e2c97;return db[_0x092b('0x54')]['findOne']({'where':{'id':_0x22302a[_0x092b('0x53')]['id']}})[_0x092b('0x2b')](handleEntityNotFound(_0x5d8556,null))[_0x092b('0x2b')](function(_0x294a6b){if(_0x294a6b){_0x333004=_0x294a6b;_0x3805ac[_0x092b('0x3f')]=_[_0x092b('0x41')](db['UserVoiceQueueRt'][_0x092b('0x3c')]);_0x3805ac[_0x092b('0x40')]=_[_0x092b('0x41')](_0x22302a[_0x092b('0x40')]);_0x3805ac['filters']=_[_0x092b('0x43')](_0x3805ac['model'],_0x3805ac['query']);_0x74d374[_0x092b('0x44')]=_[_0x092b('0x43')](_0x3805ac['model'],qs[_0x092b('0x45')](_0x22302a[_0x092b('0x40')][_0x092b('0x45')]));_0x74d374[_0x092b('0x44')]=_0x74d374[_0x092b('0x44')]['length']?_0x74d374[_0x092b('0x44')]:_0x3805ac[_0x092b('0x3f')];_0x74d374['order']=qs['sort'](_0x22302a[_0x092b('0x40')]['sort']);_0x74d374[_0x092b('0x4a')]=qs[_0x092b('0x42')](_[_0x092b('0x49')](_0x22302a[_0x092b('0x40')],_0x3805ac['filters']));if(_0x22302a[_0x092b('0x40')][_0x092b('0x2f')]){_0x74d374[_0x092b('0x4a')]=_['merge'](_0x74d374[_0x092b('0x4a')],{'$or':_[_0x092b('0x31')](_0x74d374[_0x092b('0x44')],function(_0x232177){var _0x29e050={};_0x29e050[_0x232177]={'$like':'%'+_0x22302a[_0x092b('0x40')][_0x092b('0x2f')]+'%'};return _0x29e050;})});}_0x74d374=_[_0x092b('0x4b')]({},_0x74d374,_0x22302a[_0x092b('0x55')]);return _0x333004['getMembers'](_0x74d374);}})[_0x092b('0x2b')](function(_0x545b2a){if(_0x545b2a){_0x1e2c97=_0x545b2a[_0x092b('0x46')];if(!_0x22302a[_0x092b('0x40')][_0x092b('0x68')](_0x092b('0x47'))){_0x74d374[_0x092b('0x24')]=qs['limit'](_0x22302a['query'][_0x092b('0x24')]);_0x74d374[_0x092b('0x22')]=qs['offset'](_0x22302a['query']['offset']);}return _0x333004[_0x092b('0x9e')](_0x74d374);}})['then'](function(_0x289d54){return _0x289d54?{'count':_0x1e2c97,'rows':_0x289d54}:null;})[_0x092b('0x2b')](respondWithResult(_0x5d8556,null))[_0x092b('0x51')](handleError(_0x5d8556,null));};exports[_0x092b('0x9f')]=function(_0x2fa593,_0x42c342,_0x2c1244){var _0x17a04b={};var _0x57ec01={};var _0x337d2f;var _0x529ffb;return db['VoiceQueue'][_0x092b('0x66')]({'where':{'id':_0x2fa593[_0x092b('0x53')]['id']}})[_0x092b('0x2b')](handleEntityNotFound(_0x42c342,null))['then'](function(_0x94b1e3){if(_0x94b1e3){_0x337d2f=_0x94b1e3;_0x57ec01[_0x092b('0x3f')]=_[_0x092b('0x41')](db[_0x092b('0xa0')][_0x092b('0x3c')]);_0x57ec01[_0x092b('0x40')]=_[_0x092b('0x41')](_0x2fa593['query']);_0x57ec01[_0x092b('0x42')]=_[_0x092b('0x43')](_0x57ec01['model'],_0x57ec01[_0x092b('0x40')]);_0x17a04b['attributes']=_['intersection'](_0x57ec01[_0x092b('0x3f')],qs['fields'](_0x2fa593[_0x092b('0x40')][_0x092b('0x45')]));_0x17a04b[_0x092b('0x44')]=_0x17a04b['attributes'][_0x092b('0x46')]?_0x17a04b[_0x092b('0x44')]:_0x57ec01['model'];_0x17a04b[_0x092b('0x48')]=qs[_0x092b('0x69')](_0x2fa593[_0x092b('0x40')]['sort']);_0x17a04b['where']=qs[_0x092b('0x42')](_[_0x092b('0x49')](_0x2fa593['query'],_0x57ec01[_0x092b('0x42')]));if(_0x2fa593[_0x092b('0x40')][_0x092b('0x2f')]){_0x17a04b[_0x092b('0x4a')]=_[_0x092b('0x4b')](_0x17a04b['where'],{'$or':_[_0x092b('0x31')](_0x17a04b[_0x092b('0x44')],function(_0x243797){var _0x39f1ef={};_0x39f1ef[_0x243797]={'$like':'%'+_0x2fa593[_0x092b('0x40')]['filter']+'%'};return _0x39f1ef;})});}_0x17a04b=_[_0x092b('0x4b')]({},_0x17a04b,_0x2fa593['options']);return _0x337d2f['getLists'](_0x17a04b);}})[_0x092b('0x2b')](function(_0x16b7bd){if(_0x16b7bd){_0x529ffb=_0x16b7bd[_0x092b('0x46')];if(!_0x2fa593[_0x092b('0x40')][_0x092b('0x68')](_0x092b('0x47'))){_0x17a04b[_0x092b('0x24')]=qs[_0x092b('0x24')](_0x2fa593[_0x092b('0x40')][_0x092b('0x24')]);_0x17a04b[_0x092b('0x22')]=qs[_0x092b('0x22')](_0x2fa593[_0x092b('0x40')][_0x092b('0x22')]);}return _0x337d2f[_0x092b('0x9f')](_0x17a04b);}})[_0x092b('0x2b')](function(_0x54779e){if(_0x54779e){return _0x54779e?{'count':_0x529ffb,'rows':_0x54779e}:null;}})[_0x092b('0x2b')](respondWithResult(_0x42c342,null))[_0x092b('0x51')](handleError(_0x42c342,null));};exports[_0x092b('0xa1')]=function(_0x4f3580,_0xa50d0e,_0x350a04){var _0x4d6877,_0x134cf8;return db['VoiceQueue']['find']({'where':{'id':_0x4f3580[_0x092b('0x53')]['id']}})[_0x092b('0x2b')](handleEntityNotFound(_0xa50d0e,null))['then'](function(_0x370037){if(_0x370037){_0x134cf8=_0x370037;return _0x370037[_0x092b('0xa1')](_0x4f3580[_0x092b('0x57')][_0x092b('0x84')],_[_0x092b('0x61')](_0x4f3580[_0x092b('0x57')],[_0x092b('0x84'),'id'])||{});}return null;})[_0x092b('0x99')](function(_0x456b5e){var _0x1ac290;_0x4d6877=_0x456b5e||[];var _0x4dac40=[];if(_0x456b5e){for(var _0x147d94=0x0;_0x147d94<_0x456b5e[_0x092b('0x46')];_0x147d94+=0x1){var _0x459ec1=_0x456b5e[_0x147d94][_0x092b('0x2c')]({'plain':!![]});_0x134cf8[_0x092b('0xa2')]=_0x4f3580[_0x092b('0x57')][_0x092b('0xa2')]?_0x4f3580[_0x092b('0x57')][_0x092b('0xa2')]:_0x134cf8['dialCheckDuplicateType'];switch(_0x134cf8['dialCheckDuplicateType']){case _0x092b('0xa3'):_0x1ac290=squel['insert']()['into']('cm_hopper')[_0x092b('0xa4')]([_0x092b('0xa5'),_0x092b('0xa6'),'ContactId',_0x092b('0xa7'),_0x092b('0x6a'),'createdAt',_0x092b('0x60')],squel[_0x092b('0x85')]()['field'](_0x092b('0xa5'),_0x092b('0xa5'))[_0x092b('0x86')]('NOW()','scheduledAt')[_0x092b('0x86')]('id',_0x092b('0xa8'))[_0x092b('0x86')](_0x459ec1[_0x092b('0xa9')][_0x092b('0x8f')](),_0x092b('0xa7'))['field'](_0x4f3580[_0x092b('0x53')]['id'][_0x092b('0x8f')](),_0x092b('0x6a'))[_0x092b('0x86')]('NOW()',_0x092b('0x5f'))[_0x092b('0x86')](_0x092b('0xaa'),_0x092b('0x60'))[_0x092b('0xab')](_0x092b('0xac'))['where'](_0x092b('0xad'))[_0x092b('0x4a')](_0x092b('0xae'),_0x459ec1['CmListId'][_0x092b('0x8f')]())[_0x092b('0x4a')](_0x092b('0xaf'))['where'](_0x092b('0xb0'),squel[_0x092b('0x85')]()[_0x092b('0x86')](_0x092b('0xb1'))['from'](_0x092b('0xb2'))[_0x092b('0x4a')]('VoiceQueueId\x20=\x20?',_0x4f3580[_0x092b('0x53')]['id'][_0x092b('0x8f')]()))['where'](_0x092b('0xb0'),squel['select']()['field'](_0x092b('0xb3'))[_0x092b('0xab')](_0x092b('0xb4'))['where']('VoiceQueueId\x20=\x20?',_0x4f3580['params']['id'][_0x092b('0x8f')]())))[_0x092b('0x8f')]();break;case _0x092b('0xb5'):_0x1ac290=squel[_0x092b('0xb6')]()[_0x092b('0xb7')]('cm_hopper')[_0x092b('0xa4')](['phone','scheduledAt','ContactId',_0x092b('0xa7'),_0x092b('0x6a'),_0x092b('0x5f'),_0x092b('0x60')],squel[_0x092b('0x85')]()['field']('phone',_0x092b('0xa5'))[_0x092b('0x86')](_0x092b('0xaa'),_0x092b('0xa6'))[_0x092b('0x86')]('id',_0x092b('0xa8'))[_0x092b('0x86')](_0x459ec1[_0x092b('0xa9')][_0x092b('0x8f')](),'ListId')[_0x092b('0x86')](_0x4f3580[_0x092b('0x53')]['id'][_0x092b('0x8f')](),_0x092b('0x6a'))[_0x092b('0x86')](_0x092b('0xaa'),'createdAt')['field'](_0x092b('0xaa'),_0x092b('0x60'))[_0x092b('0xab')](_0x092b('0xac'))[_0x092b('0x4a')](_0x092b('0xad'))[_0x092b('0x4a')](_0x092b('0xae'),_0x459ec1[_0x092b('0xa9')][_0x092b('0x8f')]())[_0x092b('0x4a')](_0x092b('0xaf'))[_0x092b('0x4a')](_0x092b('0xb0'),squel[_0x092b('0x85')]()[_0x092b('0x86')](_0x092b('0xb3'))[_0x092b('0xab')](_0x092b('0xb4'))[_0x092b('0x4a')]('VoiceQueueId\x20=\x20?',_0x4f3580[_0x092b('0x53')]['id'][_0x092b('0x8f')]())))['toString']();break;default:_0x1ac290=squel['insert']()[_0x092b('0xb7')](_0x092b('0xb4'))['fromQuery']([_0x092b('0xa5'),_0x092b('0xa6'),_0x092b('0xa8'),_0x092b('0xa7'),_0x092b('0x6a'),_0x092b('0x5f'),_0x092b('0x60')],squel[_0x092b('0x85')]()[_0x092b('0x86')](_0x092b('0xa5'),_0x092b('0xa5'))[_0x092b('0x86')](_0x092b('0xaa'),_0x092b('0xa6'))[_0x092b('0x86')]('id','ContactId')[_0x092b('0x86')](_0x459ec1[_0x092b('0xa9')]['toString'](),_0x092b('0xa7'))[_0x092b('0x86')](_0x4f3580[_0x092b('0x53')]['id'][_0x092b('0x8f')](),_0x092b('0x6a'))['field'](_0x092b('0xaa'),_0x092b('0x5f'))[_0x092b('0x86')](_0x092b('0xaa'),_0x092b('0x60'))[_0x092b('0xab')](_0x092b('0xac'))['where'](_0x092b('0xad'))[_0x092b('0x4a')](_0x092b('0xae'),_0x459ec1['CmListId'][_0x092b('0x8f')]())[_0x092b('0x4a')](_0x092b('0xaf')))[_0x092b('0x8f')]();}_0x4dac40[_0x092b('0x8d')](db[_0x092b('0x8e')]['query'](_0x1ac290));}return BPromise[_0x092b('0x93')](_0x4dac40);}})['then'](function(){return _0x4d6877;})[_0x092b('0x2b')](respondWithResult(_0xa50d0e,null))[_0x092b('0x51')](handleError(_0xa50d0e,null));};exports['removeLists']=function(_0xe2da4d,_0x1f314f,_0x54124e){return db[_0x092b('0x54')][_0x092b('0x35')]({'where':{'id':_0xe2da4d['params']['id']}})['then'](handleEntityNotFound(_0x1f314f,null))['then'](function(_0x39e66f){if(_0x39e66f){return _0x39e66f[_0x092b('0xb8')](_0xe2da4d[_0x092b('0x40')][_0x092b('0x84')]);}})[_0x092b('0x2b')](function(_0x1d7b66){if(_0x1d7b66){return db[_0x092b('0x67')][_0x092b('0x2a')]({'where':{'ListId':_0xe2da4d[_0x092b('0x40')]['ids'],'VoiceQueueId':_0xe2da4d[_0x092b('0x53')]['id']}})[_0x092b('0x2b')](function(){return _0x1d7b66;});}})[_0x092b('0x2b')](respondWithStatusCode(_0x1f314f,null))[_0x092b('0x51')](handleError(_0x1f314f,null));};exports[_0x092b('0xb9')]=function(_0x5b65db,_0x4cf456,_0x14cab9){var _0xd8c086={};var _0x4410f8={};var _0x30886e;var _0x2a82d7;return db[_0x092b('0x54')][_0x092b('0x66')]({'where':{'id':_0x5b65db[_0x092b('0x53')]['id']}})['then'](handleEntityNotFound(_0x4cf456,null))['then'](function(_0x284fa7){if(_0x284fa7){_0x30886e=_0x284fa7;_0x4410f8[_0x092b('0x3f')]=_[_0x092b('0x41')](db[_0x092b('0xa0')]['rawAttributes']);_0x4410f8[_0x092b('0x40')]=_[_0x092b('0x41')](_0x5b65db['query']);_0x4410f8[_0x092b('0x42')]=_[_0x092b('0x43')](_0x4410f8[_0x092b('0x3f')],_0x4410f8[_0x092b('0x40')]);_0xd8c086['attributes']=_[_0x092b('0x43')](_0x4410f8['model'],qs[_0x092b('0x45')](_0x5b65db[_0x092b('0x40')]['fields']));_0xd8c086[_0x092b('0x44')]=_0xd8c086[_0x092b('0x44')][_0x092b('0x46')]?_0xd8c086['attributes']:_0x4410f8[_0x092b('0x3f')];_0xd8c086[_0x092b('0x48')]=qs[_0x092b('0x69')](_0x5b65db[_0x092b('0x40')]['sort']);_0xd8c086[_0x092b('0x4a')]=qs[_0x092b('0x42')](_[_0x092b('0x49')](_0x5b65db['query'],_0x4410f8['filters']));if(_0x5b65db['query'][_0x092b('0x2f')]){_0xd8c086[_0x092b('0x4a')]=_['merge'](_0xd8c086[_0x092b('0x4a')],{'$or':_[_0x092b('0x31')](_0xd8c086[_0x092b('0x44')],function(_0x3b44ff){var _0x434f01={};_0x434f01[_0x3b44ff]={'$like':'%'+_0x5b65db[_0x092b('0x40')][_0x092b('0x2f')]+'%'};return _0x434f01;})});}_0xd8c086=_[_0x092b('0x4b')]({},_0xd8c086,_0x5b65db['options']);return _0x30886e[_0x092b('0xb9')](_0xd8c086);}})[_0x092b('0x2b')](function(_0x303f21){if(_0x303f21){_0x2a82d7=_0x303f21[_0x092b('0x46')];if(!_0x5b65db['query']['hasOwnProperty'](_0x092b('0x47'))){_0xd8c086[_0x092b('0x24')]=qs['limit'](_0x5b65db[_0x092b('0x40')]['limit']);_0xd8c086['offset']=qs['offset'](_0x5b65db[_0x092b('0x40')][_0x092b('0x22')]);}return _0x30886e['getBlackLists'](_0xd8c086);}})['then'](function(_0x26a8d8){if(_0x26a8d8){return _0x26a8d8?{'count':_0x2a82d7,'rows':_0x26a8d8}:null;}})['then'](respondWithResult(_0x4cf456,null))['catch'](handleError(_0x4cf456,null));};exports['addBlackLists']=function(_0x40c4a2,_0x1317b2,_0x5b1ddb){var _0x197e4d,_0x3c9db7;return db[_0x092b('0x54')][_0x092b('0x35')]({'where':{'id':_0x40c4a2[_0x092b('0x53')]['id']}})[_0x092b('0x2b')](handleEntityNotFound(_0x1317b2,null))[_0x092b('0x2b')](function(_0x25eec3){if(_0x25eec3){_0x3c9db7=_0x25eec3;return _0x25eec3['addBlackLists'](_0x40c4a2[_0x092b('0x57')][_0x092b('0x84')],_[_0x092b('0x61')](_0x40c4a2['body'],[_0x092b('0x84'),'id'])||{});}return null;})[_0x092b('0x99')](function(_0x2293d7){var _0x1e0c9d;_0x197e4d=_0x2293d7||[];var _0x4466fb=[];if(_0x2293d7){for(var _0x1ccd6a=0x0;_0x1ccd6a<_0x2293d7['length'];_0x1ccd6a+=0x1){var _0x3fef6c=_0x2293d7[_0x1ccd6a][_0x092b('0x2c')]({'plain':!![]});_0x1e0c9d=squel[_0x092b('0xb6')]()[_0x092b('0xb7')](_0x092b('0xba'))[_0x092b('0xa4')]([_0x092b('0xa5'),_0x092b('0xa8'),_0x092b('0xa7'),_0x092b('0x6a'),_0x092b('0x5f'),_0x092b('0x60')],squel[_0x092b('0x85')]()[_0x092b('0x86')](_0x092b('0xa5'),_0x092b('0xa5'))[_0x092b('0x86')]('id',_0x092b('0xa8'))[_0x092b('0x86')](_0x3fef6c['CmListId'][_0x092b('0x8f')](),_0x092b('0xa7'))['field'](_0x40c4a2[_0x092b('0x53')]['id'][_0x092b('0x8f')](),_0x092b('0x6a'))[_0x092b('0x86')](_0x092b('0xaa'),_0x092b('0x5f'))[_0x092b('0x86')]('NOW()',_0x092b('0x60'))[_0x092b('0xab')](_0x092b('0xac'))[_0x092b('0x4a')](_0x092b('0xad'))[_0x092b('0x4a')](_0x092b('0xae'),_0x3fef6c[_0x092b('0xa9')]['toString']())[_0x092b('0x4a')](_0x092b('0xaf')))[_0x092b('0x8f')]();_0x4466fb['push'](db[_0x092b('0x8e')][_0x092b('0x40')](_0x1e0c9d));}return BPromise['all'](_0x4466fb);}})[_0x092b('0x2b')](function(){return _0x197e4d;})[_0x092b('0x2b')](respondWithResult(_0x1317b2,null))[_0x092b('0x51')](handleError(_0x1317b2,null));};exports[_0x092b('0xbb')]=function(_0x47e342,_0x34c5f9,_0x4c2371){return db['VoiceQueue']['find']({'where':{'id':_0x47e342[_0x092b('0x53')]['id']}})[_0x092b('0x2b')](handleEntityNotFound(_0x34c5f9,null))['then'](function(_0x416aee){if(_0x416aee){return _0x416aee[_0x092b('0xbb')](_0x47e342[_0x092b('0x40')]['ids']);}})['then'](function(_0x53534f){if(_0x53534f){return db[_0x092b('0x6f')][_0x092b('0x2a')]({'where':{'ListId':_0x47e342[_0x092b('0x40')][_0x092b('0x84')],'VoiceQueueId':_0x47e342['params']['id']}})[_0x092b('0x2b')](function(){return _0x53534f;});}})[_0x092b('0x2b')](respondWithStatusCode(_0x34c5f9,null))[_0x092b('0x51')](handleError(_0x34c5f9,null));}; \ No newline at end of file +var _0x44d1=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','name','UserProfileResource','error','stack','VoiceQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','VIRTUAL','merge','includeAll','include','findAll','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','options','omit','updatedAt','createdAt','VoiceQueues','userProfileId','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','hasOwnProperty','pick','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','ids','removeAgents','UserVoiceQueueRt','emit','userVoiceQueue:remove','addAgents','spread','isEmpty','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','CmListId','ListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists'];(function(_0x42a238,_0x2e80c6){var _0x3aa1dd=function(_0x505c74){while(--_0x505c74){_0x42a238['push'](_0x42a238['shift']());}};_0x3aa1dd(++_0x2e80c6);}(_0x44d1,0xb9));var _0x144d=function(_0x3bbba1,_0x3ca3fc){_0x3bbba1=_0x3bbba1-0x0;var _0x22d909=_0x44d1[_0x3bbba1];return _0x22d909;};'use strict';var emlformat=require(_0x144d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x144d('0x1'));var jsonpatch=require(_0x144d('0x2'));var rp=require(_0x144d('0x3'));var moment=require(_0x144d('0x4'));var BPromise=require(_0x144d('0x5'));var Mustache=require(_0x144d('0x6'));var util=require(_0x144d('0x7'));var path=require(_0x144d('0x8'));var sox=require(_0x144d('0x9'));var csv=require(_0x144d('0xa'));var ejs=require(_0x144d('0xb'));var fs=require('fs');var fs_extra=require(_0x144d('0xc'));var _=require(_0x144d('0xd'));var squel=require(_0x144d('0xe'));var crypto=require(_0x144d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x144d('0x10'));var toCsv=require(_0x144d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x144d('0x11'));var qs=require(_0x144d('0x12'));var as=require(_0x144d('0x13'));var hardwareService=require(_0x144d('0x14'));var logger=require('../../config/logger')(_0x144d('0x15'));var utils=require('../../config/utils');var config=require(_0x144d('0x16'));var licenseUtil=require(_0x144d('0x17'));var db=require(_0x144d('0x18'))['db'];config[_0x144d('0x19')]=_[_0x144d('0x1a')](config[_0x144d('0x19')],{'host':_0x144d('0x1b'),'port':0x18eb});var socket=require(_0x144d('0x1c'))(new Redis(config[_0x144d('0x19')]));require('./voiceQueue.socket')[_0x144d('0x1d')](socket);function respondWithStatusCode(_0x483500,_0x1c0809){_0x1c0809=_0x1c0809||0xcc;return function(_0x341951){if(_0x341951){return _0x483500[_0x144d('0x1e')](_0x1c0809);}return _0x483500[_0x144d('0x1f')](_0x1c0809)[_0x144d('0x20')]();};}function respondWithResult(_0x572fb5,_0x52f3c3){_0x52f3c3=_0x52f3c3||0xc8;return function(_0x2a35ef){if(_0x2a35ef){return _0x572fb5[_0x144d('0x1f')](_0x52f3c3)['json'](_0x2a35ef);}};}function respondWithFilteredResult(_0x244afe,_0x4d24b2){return function(_0x3494bb){if(_0x3494bb){var _0x18a085=typeof _0x4d24b2['offset']===_0x144d('0x21')&&typeof _0x4d24b2['limit']===_0x144d('0x21');var _0x40d66a=_0x3494bb[_0x144d('0x22')];var _0x1b1205=_0x18a085?0x0:_0x4d24b2[_0x144d('0x23')];var _0x283d6e=_0x18a085?_0x3494bb[_0x144d('0x22')]:_0x4d24b2['offset']+_0x4d24b2[_0x144d('0x24')];var _0x5d3146;if(_0x283d6e>=_0x40d66a){_0x283d6e=_0x40d66a;_0x5d3146=0xc8;}else{_0x5d3146=0xce;}_0x244afe['status'](_0x5d3146);return _0x244afe[_0x144d('0x25')](_0x144d('0x26'),_0x1b1205+'-'+_0x283d6e+'/'+_0x40d66a)['json'](_0x3494bb);}return null;};}function patchUpdates(_0x42d1b2){return function(_0x36844e){try{jsonpatch[_0x144d('0x27')](_0x36844e,_0x42d1b2,!![]);}catch(_0x122ae0){return BPromise[_0x144d('0x28')](_0x122ae0);}return _0x36844e['save']();};}function saveUpdates(_0x90f7fd,_0x420d81){return function(_0x32305b){if(_0x32305b){return _0x32305b[_0x144d('0x29')](_0x90f7fd)[_0x144d('0x2a')](function(_0x53b3d8){return _0x53b3d8;});}return null;};}function removeEntity(_0x389983,_0x1e0713){return function(_0x5f4b13){if(_0x5f4b13){return _0x5f4b13[_0x144d('0x2b')]()[_0x144d('0x2a')](function(){var _0x3128c5=_0x5f4b13[_0x144d('0x2c')]({'plain':!![]});var _0x5723fd=[{'name':'VoiceQueues','value':_0x144d('0x2d'),'ignore':![]},{'name':_0x144d('0x2e'),'value':_0x144d('0x2f'),'ignore':![]}];var _0x3d0c7d=_(_0x5723fd)[_0x144d('0x30')](_0x144d('0x31'))[_0x144d('0x32')](_0x144d('0x33'))[_0x144d('0x33')]();if(_['includes'](_0x3d0c7d,_0x3128c5[_0x144d('0x34')])){return;}var _0x318047=_[_0x144d('0x35')](_0x5723fd,[_0x144d('0x33'),_0x3128c5[_0x144d('0x34')]])[_0x144d('0x36')];return db[_0x144d('0x37')][_0x144d('0x2b')]({'where':{'type':_0x318047,'resourceId':_0x3128c5['id']}})[_0x144d('0x2a')](function(){return _0x5f4b13;});})[_0x144d('0x2a')](function(){_0x389983['status'](0xcc)[_0x144d('0x20')]();});}};}function handleEntityNotFound(_0x445b0a,_0x2f40fc){return function(_0x1c2b2c){if(!_0x1c2b2c){_0x445b0a[_0x144d('0x1e')](0x194);}return _0x1c2b2c;};}function handleError(_0x1f2253,_0x892f50){_0x892f50=_0x892f50||0x1f4;return function(_0x5965cf){logger[_0x144d('0x38')](_0x5965cf[_0x144d('0x39')]);if(_0x5965cf['name']){delete _0x5965cf[_0x144d('0x36')];}_0x1f2253[_0x144d('0x1f')](_0x892f50)['send'](_0x5965cf);};}exports['index']=function(_0x52f9d2,_0x1da102){var _0x1c671a={},_0x189f0b={},_0xda9199={'count':0x0,'rows':[]};var _0x39de2a=_[_0x144d('0x32')](db[_0x144d('0x3a')][_0x144d('0x3b')],function(_0x4e7284){return{'name':_0x4e7284['fieldName'],'type':_0x4e7284[_0x144d('0x34')][_0x144d('0x3c')]};});_0x189f0b[_0x144d('0x3d')]=_[_0x144d('0x32')](_0x39de2a,'name');_0x189f0b[_0x144d('0x3e')]=_[_0x144d('0x3f')](_0x52f9d2['query']);_0x189f0b[_0x144d('0x40')]=_[_0x144d('0x41')](_0x189f0b[_0x144d('0x3d')],_0x189f0b[_0x144d('0x3e')]);_0x1c671a[_0x144d('0x42')]=_[_0x144d('0x41')](_0x189f0b['model'],qs[_0x144d('0x43')](_0x52f9d2[_0x144d('0x3e')][_0x144d('0x43')]));_0x1c671a[_0x144d('0x42')]=_0x1c671a[_0x144d('0x42')]['length']?_0x1c671a[_0x144d('0x42')]:_0x189f0b[_0x144d('0x3d')];if(!_0x52f9d2[_0x144d('0x3e')]['hasOwnProperty'](_0x144d('0x44'))){_0x1c671a[_0x144d('0x24')]=qs[_0x144d('0x24')](_0x52f9d2[_0x144d('0x3e')][_0x144d('0x24')]);_0x1c671a[_0x144d('0x23')]=qs[_0x144d('0x23')](_0x52f9d2['query']['offset']);}_0x1c671a[_0x144d('0x45')]=qs[_0x144d('0x46')](_0x52f9d2[_0x144d('0x3e')][_0x144d('0x46')]);_0x1c671a[_0x144d('0x47')]=qs['filters'](_['pick'](_0x52f9d2[_0x144d('0x3e')],_0x189f0b[_0x144d('0x40')]),_0x39de2a);if(_0x52f9d2['query']['filter']){_0x1c671a[_0x144d('0x47')]=_['merge'](_0x1c671a['where'],{'$or':_[_0x144d('0x32')](_0x39de2a,function(_0x18878c){if(_0x18878c[_0x144d('0x34')]!==_0x144d('0x48')){var _0x531d96={};_0x531d96[_0x18878c['name']]={'$like':'%'+_0x52f9d2[_0x144d('0x3e')]['filter']+'%'};return _0x531d96;}})});}_0x1c671a=_[_0x144d('0x49')]({},_0x1c671a,_0x52f9d2['options']);var _0x4d2164={'where':_0x1c671a[_0x144d('0x47')]};return db[_0x144d('0x3a')][_0x144d('0x22')](_0x4d2164)[_0x144d('0x2a')](function(_0xcef3bd){_0xda9199[_0x144d('0x22')]=_0xcef3bd;if(_0x52f9d2['query'][_0x144d('0x4a')]){_0x1c671a[_0x144d('0x4b')]=[{'all':!![]}];}return db[_0x144d('0x3a')][_0x144d('0x4c')](_0x1c671a);})[_0x144d('0x2a')](function(_0x135a86){_0xda9199['rows']=_0x135a86;return _0xda9199;})[_0x144d('0x2a')](respondWithFilteredResult(_0x1da102,_0x1c671a))[_0x144d('0x4d')](handleError(_0x1da102,null));};exports['show']=function(_0x28fb69,_0x3e06e0){var _0x7a98a8={'raw':![],'where':{'id':_0x28fb69[_0x144d('0x4e')]['id']}},_0x31f0ef={};_0x31f0ef['model']=_[_0x144d('0x3f')](db[_0x144d('0x3a')][_0x144d('0x3b')]);_0x31f0ef['query']=_[_0x144d('0x3f')](_0x28fb69[_0x144d('0x3e')]);_0x31f0ef[_0x144d('0x40')]=_[_0x144d('0x41')](_0x31f0ef[_0x144d('0x3d')],_0x31f0ef[_0x144d('0x3e')]);_0x7a98a8[_0x144d('0x42')]=_[_0x144d('0x41')](_0x31f0ef['model'],qs['fields'](_0x28fb69['query'][_0x144d('0x43')]));_0x7a98a8[_0x144d('0x42')]=_0x7a98a8[_0x144d('0x42')]['length']?_0x7a98a8[_0x144d('0x42')]:_0x31f0ef[_0x144d('0x3d')];if(_0x28fb69[_0x144d('0x3e')][_0x144d('0x4a')]){_0x7a98a8[_0x144d('0x4b')]=[{'all':!![]}];}_0x7a98a8=_[_0x144d('0x49')]({},_0x7a98a8,_0x28fb69['options']);return db[_0x144d('0x3a')][_0x144d('0x35')](_0x7a98a8)[_0x144d('0x2a')](handleEntityNotFound(_0x3e06e0,null))[_0x144d('0x2a')](respondWithResult(_0x3e06e0,null))[_0x144d('0x4d')](handleError(_0x3e06e0,null));};exports[_0x144d('0x4f')]=function(_0x322cbb,_0x22b4e5){return db['VoiceQueue']['create'](_0x322cbb[_0x144d('0x50')],{})['then'](function(_0x5bb372){var _0x2556de=_0x322cbb[_0x144d('0x51')][_0x144d('0x2c')]({'plain':!![]});if(!_0x2556de)throw new Error(_0x144d('0x52'));if(_0x2556de['role']===_0x144d('0x51')){var _0xf10279=_0x5bb372[_0x144d('0x2c')]({'plain':!![]});var _0x43a800=[{'name':'VoiceQueues','value':_0x144d('0x2d')},{'name':_0x144d('0x2e'),'value':_0x144d('0x2f')}];var _0x459f32=_[_0x144d('0x35')](_0x43a800,[_0x144d('0x33'),_0xf10279[_0x144d('0x34')]])[_0x144d('0x36')];return db[_0x144d('0x53')][_0x144d('0x35')]({'where':{'name':_0x459f32,'userProfileId':_0x2556de['userProfileId']},'raw':!![]})[_0x144d('0x2a')](function(_0x26eab9){if(_0x26eab9&&_0x26eab9[_0x144d('0x54')]===0x0){return db[_0x144d('0x37')][_0x144d('0x4f')]({'name':_0xf10279['name'],'resourceId':_0xf10279['id'],'type':_0x26eab9[_0x144d('0x36')],'sectionId':_0x26eab9['id']},{})[_0x144d('0x2a')](function(){return _0x5bb372;});}else{return _0x5bb372;}})[_0x144d('0x4d')](function(_0x48cc10){logger[_0x144d('0x38')](_0x144d('0x55'),_0x48cc10);throw _0x48cc10;});}return _0x5bb372;})[_0x144d('0x2a')](respondWithResult(_0x22b4e5,0xc9))['catch'](handleError(_0x22b4e5,null));};exports[_0x144d('0x56')]=function(_0x4e00b5,_0x29359e){var _0x124921={'where':{'id':_0x4e00b5[_0x144d('0x4e')]['id']}},_0x5724ca={};_0x5724ca[_0x144d('0x3d')]=_['keys'](db[_0x144d('0x3a')][_0x144d('0x3b')]);_0x124921['attributes']=_['intersection'](_0x5724ca[_0x144d('0x3d')],qs[_0x144d('0x43')](_0x4e00b5['query'][_0x144d('0x43')]));_0x124921[_0x144d('0x42')]=_0x124921[_0x144d('0x42')][_0x144d('0x57')]?_0x124921[_0x144d('0x42')]:_0x5724ca[_0x144d('0x3d')];if(_0x4e00b5[_0x144d('0x3e')][_0x144d('0x4a')]){_0x124921[_0x144d('0x4b')]=[{'all':!![]}];}_0x124921=_[_0x144d('0x49')]({},_0x124921,_0x4e00b5[_0x144d('0x58')]);return db[_0x144d('0x3a')]['find'](_0x124921)[_0x144d('0x2a')](handleEntityNotFound(_0x29359e,null))[_0x144d('0x2a')](function(_0x314e8c){if(_0x314e8c){var _0xb137e9=_0x314e8c[_0x144d('0x2c')]({'plain':!![]});_0xb137e9=qs[_0x144d('0x59')](_0xb137e9,['id','createdAt',_0x144d('0x5a')]);_0x4e00b5[_0x144d('0x50')]=_[_0x144d('0x59')](_0x4e00b5['body'],['id',_0x144d('0x5b'),_0x144d('0x5a')]);return db[_0x144d('0x3a')][_0x144d('0x4f')](_[_0x144d('0x49')](_0xb137e9,_0x4e00b5[_0x144d('0x50')]),{'include':_0x4e00b5['query'][_0x144d('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x2d5b85){var _0x310453=_0x4e00b5['user'][_0x144d('0x2c')]({'plain':!![]});if(!_0x310453)throw new Error(_0x144d('0x52'));if(_0x310453['role']===_0x144d('0x51')){var _0x929233=_0x2d5b85[_0x144d('0x2c')]({'plain':!![]});var _0x4b5f1b=[{'name':_0x144d('0x5c'),'value':'inbound'},{'name':_0x144d('0x2e'),'value':_0x144d('0x2f')}];var _0x13d4e9=_[_0x144d('0x35')](_0x4b5f1b,[_0x144d('0x33'),_0x929233[_0x144d('0x34')]])[_0x144d('0x36')];return db[_0x144d('0x53')][_0x144d('0x35')]({'where':{'name':_0x13d4e9,'userProfileId':_0x310453[_0x144d('0x5d')]},'raw':!![]})[_0x144d('0x2a')](function(_0x3a9307){if(_0x3a9307&&_0x3a9307[_0x144d('0x54')]===0x0){return db[_0x144d('0x37')]['create']({'name':_0x929233[_0x144d('0x36')],'resourceId':_0x929233['id'],'type':_0x3a9307['name'],'sectionId':_0x3a9307['id']},{})[_0x144d('0x2a')](function(){return _0x2d5b85;});}else{return _0x2d5b85;}})[_0x144d('0x4d')](function(_0x34684a){logger[_0x144d('0x38')](_0x144d('0x55'),_0x34684a);throw _0x34684a;});}return _0x2d5b85;});}})['then'](respondWithResult(_0x29359e,0xc9))[_0x144d('0x4d')](handleError(_0x29359e,null));};exports['update']=function(_0x30c439,_0x1f203a){if(_0x30c439['body']['id']){delete _0x30c439[_0x144d('0x50')]['id'];}return db[_0x144d('0x3a')]['find']({'where':{'id':_0x30c439[_0x144d('0x4e')]['id']}})[_0x144d('0x2a')](handleEntityNotFound(_0x1f203a,null))[_0x144d('0x2a')](saveUpdates(_0x30c439['body'],null))[_0x144d('0x2a')](respondWithResult(_0x1f203a,null))[_0x144d('0x4d')](handleError(_0x1f203a,null));};exports[_0x144d('0x2b')]=function(_0x10ed4e,_0x5750bd){return db[_0x144d('0x3a')][_0x144d('0x35')]({'where':{'id':_0x10ed4e[_0x144d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5750bd,null))['then'](removeEntity(_0x5750bd,null))['catch'](handleError(_0x5750bd,null));};exports[_0x144d('0x5e')]=function(_0x58c676,_0x37811e,_0x3731a0){var _0x53982c={'raw':![],'where':{}};var _0x31858c={};var _0x24623a={'count':0x0,'rows':[]};return db[_0x144d('0x3a')][_0x144d('0x5f')]({'where':{'id':_0x58c676['params']['id']}})['then'](handleEntityNotFound(_0x37811e,null))['then'](function(_0x459a95){if(_0x459a95){_0x31858c[_0x144d('0x3d')]=_[_0x144d('0x3f')](db[_0x144d('0x60')][_0x144d('0x3b')]);_0x31858c['query']=_['keys'](_0x58c676[_0x144d('0x3e')]);_0x31858c[_0x144d('0x40')]=_[_0x144d('0x41')](_0x31858c[_0x144d('0x3d')],_0x31858c[_0x144d('0x3e')]);_0x53982c['attributes']=_[_0x144d('0x41')](_0x31858c[_0x144d('0x3d')],qs[_0x144d('0x43')](_0x58c676[_0x144d('0x3e')][_0x144d('0x43')]));_0x53982c['attributes']=_0x53982c[_0x144d('0x42')][_0x144d('0x57')]?_0x53982c[_0x144d('0x42')]:_0x31858c[_0x144d('0x3d')];if(!_0x58c676[_0x144d('0x3e')]['hasOwnProperty'](_0x144d('0x44'))){_0x53982c['limit']=qs[_0x144d('0x24')](_0x58c676[_0x144d('0x3e')][_0x144d('0x24')]);_0x53982c[_0x144d('0x23')]=qs[_0x144d('0x23')](_0x58c676[_0x144d('0x3e')][_0x144d('0x23')]);}_0x53982c[_0x144d('0x45')]=qs[_0x144d('0x46')](_0x58c676[_0x144d('0x3e')][_0x144d('0x46')]);_0x53982c[_0x144d('0x47')]=qs[_0x144d('0x40')](_['pick'](_0x58c676['query'],_0x31858c['filters']));_0x53982c['where'][_0x144d('0x61')]=_0x459a95['id'];if(_0x58c676['query'][_0x144d('0x30')]){_0x53982c[_0x144d('0x47')]=_[_0x144d('0x49')](_0x53982c[_0x144d('0x47')],{'$or':_[_0x144d('0x32')](_0x53982c[_0x144d('0x42')],function(_0x2a9d65){var _0x20d4d6={};_0x20d4d6[_0x2a9d65]={'$like':'%'+_0x58c676[_0x144d('0x3e')][_0x144d('0x30')]+'%'};return _0x20d4d6;})});}_0x53982c=_[_0x144d('0x49')]({},_0x53982c,_0x58c676['options']);return db[_0x144d('0x60')]['count']({'where':_0x53982c[_0x144d('0x47')]})[_0x144d('0x2a')](function(_0x4961a6){_0x24623a[_0x144d('0x22')]=_0x4961a6;if(_0x58c676['query']['includeAll']){_0x53982c[_0x144d('0x4b')]=[{'all':!![]}];}return db[_0x144d('0x60')]['findAll'](_0x53982c);})[_0x144d('0x2a')](function(_0x303598){_0x24623a['rows']=_0x303598;return _0x24623a;});}})[_0x144d('0x2a')](respondWithFilteredResult(_0x37811e,_0x53982c))['catch'](handleError(_0x37811e,null));};exports[_0x144d('0x62')]=function(_0x3dfde2,_0x534e09,_0x3ff3fa){var _0xdcbbfb={'raw':!![],'where':{}};var _0x32d155={};var _0x4477ff={'count':0x0,'rows':[]};return db[_0x144d('0x3a')][_0x144d('0x5f')]({'where':{'id':_0x3dfde2[_0x144d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x534e09,null))[_0x144d('0x2a')](function(_0x54036a){if(_0x54036a){_0x32d155[_0x144d('0x3d')]=_[_0x144d('0x3f')](db['CmHopperHistory']['rawAttributes']);_0x32d155[_0x144d('0x3e')]=_[_0x144d('0x3f')](_0x3dfde2['query']);_0x32d155[_0x144d('0x40')]=_[_0x144d('0x41')](_0x32d155['model'],_0x32d155['query']);_0xdcbbfb['attributes']=_[_0x144d('0x41')](_0x32d155[_0x144d('0x3d')],qs['fields'](_0x3dfde2['query'][_0x144d('0x43')]));_0xdcbbfb[_0x144d('0x42')]=_0xdcbbfb[_0x144d('0x42')][_0x144d('0x57')]?_0xdcbbfb[_0x144d('0x42')]:_0x32d155[_0x144d('0x3d')];if(!_0x3dfde2['query'][_0x144d('0x63')](_0x144d('0x44'))){_0xdcbbfb[_0x144d('0x24')]=qs[_0x144d('0x24')](_0x3dfde2[_0x144d('0x3e')][_0x144d('0x24')]);_0xdcbbfb[_0x144d('0x23')]=qs[_0x144d('0x23')](_0x3dfde2['query'][_0x144d('0x23')]);}_0xdcbbfb['order']=qs[_0x144d('0x46')](_0x3dfde2['query'][_0x144d('0x46')]);_0xdcbbfb[_0x144d('0x47')]=qs[_0x144d('0x40')](_[_0x144d('0x64')](_0x3dfde2[_0x144d('0x3e')],_0x32d155[_0x144d('0x40')]));_0xdcbbfb[_0x144d('0x47')][_0x144d('0x61')]=_0x54036a['id'];if(_0x3dfde2[_0x144d('0x3e')][_0x144d('0x30')]){_0xdcbbfb[_0x144d('0x47')]=_[_0x144d('0x49')](_0xdcbbfb[_0x144d('0x47')],{'$or':_['map'](_0xdcbbfb[_0x144d('0x42')],function(_0x2a42b8){var _0x401339={};_0x401339[_0x2a42b8]={'$like':'%'+_0x3dfde2[_0x144d('0x3e')]['filter']+'%'};return _0x401339;})});}_0xdcbbfb=_[_0x144d('0x49')]({},_0xdcbbfb,_0x3dfde2[_0x144d('0x58')]);return db[_0x144d('0x65')][_0x144d('0x22')]({'where':_0xdcbbfb[_0x144d('0x47')]})[_0x144d('0x2a')](function(_0x3fdbaf){_0x4477ff[_0x144d('0x22')]=_0x3fdbaf;if(_0x3dfde2[_0x144d('0x3e')]['includeAll']){_0xdcbbfb[_0x144d('0x4b')]=[{'all':!![]}];}return db[_0x144d('0x65')]['findAll'](_0xdcbbfb);})[_0x144d('0x2a')](function(_0x3224f1){_0x4477ff[_0x144d('0x66')]=_0x3224f1;return _0x4477ff;});}})[_0x144d('0x2a')](respondWithFilteredResult(_0x534e09,_0xdcbbfb))[_0x144d('0x4d')](handleError(_0x534e09,null));};exports[_0x144d('0x67')]=function(_0x3d7e9e,_0x1e36f3,_0x4794fa){var _0x509205={'raw':!![],'where':{}};var _0x259309={};var _0x1cd41d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x144d('0x5f')]({'where':{'id':_0x3d7e9e[_0x144d('0x4e')]['id']}})[_0x144d('0x2a')](handleEntityNotFound(_0x1e36f3,null))['then'](function(_0x2e031b){if(_0x2e031b){_0x259309[_0x144d('0x3d')]=_['keys'](db[_0x144d('0x68')][_0x144d('0x3b')]);_0x259309[_0x144d('0x3e')]=_[_0x144d('0x3f')](_0x3d7e9e[_0x144d('0x3e')]);_0x259309['filters']=_[_0x144d('0x41')](_0x259309[_0x144d('0x3d')],_0x259309[_0x144d('0x3e')]);_0x509205[_0x144d('0x42')]=_[_0x144d('0x41')](_0x259309['model'],qs[_0x144d('0x43')](_0x3d7e9e[_0x144d('0x3e')][_0x144d('0x43')]));_0x509205['attributes']=_0x509205[_0x144d('0x42')][_0x144d('0x57')]?_0x509205['attributes']:_0x259309[_0x144d('0x3d')];if(!_0x3d7e9e[_0x144d('0x3e')][_0x144d('0x63')](_0x144d('0x44'))){_0x509205['limit']=qs[_0x144d('0x24')](_0x3d7e9e[_0x144d('0x3e')]['limit']);_0x509205[_0x144d('0x23')]=qs['offset'](_0x3d7e9e['query']['offset']);}_0x509205[_0x144d('0x45')]=qs[_0x144d('0x46')](_0x3d7e9e[_0x144d('0x3e')][_0x144d('0x46')]);_0x509205['where']=qs[_0x144d('0x40')](_['pick'](_0x3d7e9e[_0x144d('0x3e')],_0x259309[_0x144d('0x40')]));_0x509205[_0x144d('0x47')]['VoiceQueueId']=_0x2e031b['id'];if(_0x3d7e9e['query'][_0x144d('0x30')]){_0x509205['where']=_[_0x144d('0x49')](_0x509205[_0x144d('0x47')],{'$or':_['map'](_0x509205['attributes'],function(_0x383626){var _0x5ea898={};_0x5ea898[_0x383626]={'$like':'%'+_0x3d7e9e['query'][_0x144d('0x30')]+'%'};return _0x5ea898;})});}_0x509205=_[_0x144d('0x49')]({},_0x509205,_0x3d7e9e[_0x144d('0x58')]);return db[_0x144d('0x68')][_0x144d('0x22')]({'where':_0x509205[_0x144d('0x47')]})[_0x144d('0x2a')](function(_0x38f990){_0x1cd41d[_0x144d('0x22')]=_0x38f990;if(_0x3d7e9e[_0x144d('0x3e')][_0x144d('0x4a')]){_0x509205[_0x144d('0x4b')]=[{'all':!![]}];}return db[_0x144d('0x68')]['findAll'](_0x509205);})[_0x144d('0x2a')](function(_0x5c12e6){_0x1cd41d[_0x144d('0x66')]=_0x5c12e6;return _0x1cd41d;});}})['then'](respondWithFilteredResult(_0x1e36f3,_0x509205))['catch'](handleError(_0x1e36f3,null));};exports[_0x144d('0x69')]=function(_0x1da714,_0x47da8e,_0x17b234){var _0x2a0c24={'raw':!![],'where':{}};var _0x2f5616={};var _0x4b0595={'count':0x0,'rows':[]};return db[_0x144d('0x3a')][_0x144d('0x5f')]({'where':{'id':_0x1da714[_0x144d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x47da8e,null))[_0x144d('0x2a')](function(_0xe2a431){if(_0xe2a431){_0x2f5616[_0x144d('0x3d')]=_[_0x144d('0x3f')](db['CmHopperBlack'][_0x144d('0x3b')]);_0x2f5616[_0x144d('0x3e')]=_[_0x144d('0x3f')](_0x1da714['query']);_0x2f5616[_0x144d('0x40')]=_[_0x144d('0x41')](_0x2f5616[_0x144d('0x3d')],_0x2f5616[_0x144d('0x3e')]);_0x2a0c24[_0x144d('0x42')]=_['intersection'](_0x2f5616[_0x144d('0x3d')],qs[_0x144d('0x43')](_0x1da714[_0x144d('0x3e')][_0x144d('0x43')]));_0x2a0c24[_0x144d('0x42')]=_0x2a0c24[_0x144d('0x42')][_0x144d('0x57')]?_0x2a0c24[_0x144d('0x42')]:_0x2f5616['model'];if(!_0x1da714[_0x144d('0x3e')]['hasOwnProperty'](_0x144d('0x44'))){_0x2a0c24['limit']=qs[_0x144d('0x24')](_0x1da714[_0x144d('0x3e')][_0x144d('0x24')]);_0x2a0c24[_0x144d('0x23')]=qs[_0x144d('0x23')](_0x1da714[_0x144d('0x3e')][_0x144d('0x23')]);}_0x2a0c24[_0x144d('0x45')]=qs['sort'](_0x1da714[_0x144d('0x3e')][_0x144d('0x46')]);_0x2a0c24['where']=qs['filters'](_[_0x144d('0x64')](_0x1da714[_0x144d('0x3e')],_0x2f5616[_0x144d('0x40')]));_0x2a0c24[_0x144d('0x47')][_0x144d('0x61')]=_0xe2a431['id'];if(_0x1da714[_0x144d('0x3e')][_0x144d('0x30')]){_0x2a0c24[_0x144d('0x47')]=_[_0x144d('0x49')](_0x2a0c24[_0x144d('0x47')],{'$or':_[_0x144d('0x32')](_0x2a0c24[_0x144d('0x42')],function(_0x3a382d){var _0x33f983={};_0x33f983[_0x3a382d]={'$like':'%'+_0x1da714[_0x144d('0x3e')][_0x144d('0x30')]+'%'};return _0x33f983;})});}_0x2a0c24=_[_0x144d('0x49')]({},_0x2a0c24,_0x1da714[_0x144d('0x58')]);return db[_0x144d('0x6a')]['count']({'where':_0x2a0c24['where']})[_0x144d('0x2a')](function(_0x38cc92){_0x4b0595['count']=_0x38cc92;if(_0x1da714[_0x144d('0x3e')][_0x144d('0x4a')]){_0x2a0c24[_0x144d('0x4b')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x144d('0x4c')](_0x2a0c24);})[_0x144d('0x2a')](function(_0x34adef){_0x4b0595['rows']=_0x34adef;return _0x4b0595;});}})[_0x144d('0x2a')](respondWithFilteredResult(_0x47da8e,_0x2a0c24))[_0x144d('0x4d')](handleError(_0x47da8e,null));};exports[_0x144d('0x6b')]=function(_0x1347f5,_0x1d6669,_0x188946){var _0x268971={};var _0x329956={};var _0x350ca2;var _0x6405f;return db['VoiceQueue'][_0x144d('0x5f')]({'where':{'id':_0x1347f5['params']['id']}})[_0x144d('0x2a')](handleEntityNotFound(_0x1d6669,null))['then'](function(_0x35f63c){if(_0x35f63c){_0x350ca2=_0x35f63c;_0x329956['model']=_[_0x144d('0x3f')](db[_0x144d('0x6c')]['rawAttributes']);_0x329956['query']=_[_0x144d('0x3f')](_0x1347f5[_0x144d('0x3e')]);_0x329956[_0x144d('0x40')]=_[_0x144d('0x41')](_0x329956['model'],_0x329956['query']);_0x268971[_0x144d('0x42')]=_['intersection'](_0x329956[_0x144d('0x3d')],qs[_0x144d('0x43')](_0x1347f5[_0x144d('0x3e')][_0x144d('0x43')]));_0x268971[_0x144d('0x42')]=_0x268971[_0x144d('0x42')][_0x144d('0x57')]?_0x268971[_0x144d('0x42')]:_0x329956[_0x144d('0x3d')];_0x268971[_0x144d('0x45')]=qs[_0x144d('0x46')](_0x1347f5[_0x144d('0x3e')][_0x144d('0x46')]);_0x268971[_0x144d('0x47')]=qs[_0x144d('0x40')](_['pick'](_0x1347f5[_0x144d('0x3e')],_0x329956[_0x144d('0x40')]));if(_0x1347f5[_0x144d('0x3e')][_0x144d('0x30')]){_0x268971[_0x144d('0x47')]=_[_0x144d('0x49')](_0x268971[_0x144d('0x47')],{'$or':_[_0x144d('0x32')](_0x268971[_0x144d('0x42')],function(_0x4efb9d){var _0x5506d2={};_0x5506d2[_0x4efb9d]={'$like':'%'+_0x1347f5[_0x144d('0x3e')][_0x144d('0x30')]+'%'};return _0x5506d2;})});}_0x268971=_[_0x144d('0x49')]({},_0x268971,_0x1347f5['options']);return _0x350ca2[_0x144d('0x6b')](_0x268971);}})['then'](function(_0x3532e2){if(_0x3532e2){_0x6405f=_0x3532e2[_0x144d('0x57')];if(!_0x1347f5[_0x144d('0x3e')][_0x144d('0x63')](_0x144d('0x44'))){_0x268971[_0x144d('0x24')]=qs[_0x144d('0x24')](_0x1347f5[_0x144d('0x3e')][_0x144d('0x24')]);_0x268971['offset']=qs[_0x144d('0x23')](_0x1347f5[_0x144d('0x3e')][_0x144d('0x23')]);}return _0x350ca2[_0x144d('0x6b')](_0x268971);}})[_0x144d('0x2a')](function(_0x576c8e){if(_0x576c8e){return _0x576c8e?{'count':_0x6405f,'rows':_0x576c8e}:null;}})[_0x144d('0x2a')](respondWithResult(_0x1d6669,null))[_0x144d('0x4d')](handleError(_0x1d6669,null));};exports[_0x144d('0x6d')]=function(_0x547643,_0x28d874,_0x324369){var _0x11d0cf=_0x547643['body'][_0x144d('0x6e')];var _0x5f5a2e=_[_0x144d('0x32')](_0x11d0cf,'id');return db[_0x144d('0x6c')]['findAll']({'where':{'id':_0x5f5a2e},'attributes':['id'],'include':[{'model':db[_0x144d('0x6f')],'as':_0x144d('0x70'),'attributes':['id','name',_0x144d('0x71'),_0x144d('0x72'),_0x144d('0x73')],'raw':!![]}]})[_0x144d('0x2a')](function(_0x122676){if(_0x122676){var _0x947bae=_[_0x144d('0x74')](_0x122676,function(_0x574e51){var _0x1ec29c=_0x574e51[_0x144d('0x2c')]({'plain':!![]});_0x1ec29c[_0x144d('0x70')][_0x144d('0x75')](function(_0x3a67a9){_0x3a67a9[_0x144d('0x76')]=_[_0x144d('0x35')](_0x11d0cf,{'id':_0x1ec29c['id']})[_0x144d('0x76')];});return _0x1ec29c[_0x144d('0x70')];});return db[_0x144d('0x3a')][_0x144d('0x35')]({'where':{'id':_0x547643[_0x144d('0x4e')]['id']}})[_0x144d('0x2a')](function(_0x2531ad){return db[_0x144d('0x77')][_0x144d('0x78')](function(_0x3d5027){return _0x2531ad[_0x144d('0x6d')](_0x5f5a2e,{'transaction':_0x3d5027})[_0x144d('0x2a')](function(){return BPromise['each'](_0x11d0cf,function(_0x1e806d){return db[_0x144d('0x79')][_0x144d('0x7a')]({'TeamId':_0x1e806d['id'],'VoiceQueueId':_0x547643[_0x144d('0x4e')]['id'],'penalty':_0x1e806d['penalty']},{'transaction':_0x3d5027});});})[_0x144d('0x2a')](function(){return BPromise['each'](_0x947bae,function(_0x147297){return db[_0x144d('0x7b')][_0x144d('0x7c')]({'where':{'UserId':_0x147297['id'],'VoiceQueueId':_0x547643['params']['id']},'defaults':{'penalty':_0x147297[_0x144d('0x76')]},'transaction':_0x3d5027});});})[_0x144d('0x2a')](function(){return BPromise['each'](_[_0x144d('0x30')](_0x947bae,{'online':!![]}),function(_0x3c66c3){return db['UserVoiceQueueRt'][_0x144d('0x7a')]({'membername':_0x3c66c3[_0x144d('0x36')],'UserId':_0x3c66c3['id'],'queue_name':_0x2531ad[_0x144d('0x36')],'VoiceQueueId':_0x2531ad['id'],'interface':_[_0x144d('0x7d')](_0x3c66c3['interface'])?util[_0x144d('0x7e')](_0x144d('0x7f'),_0x3c66c3[_0x144d('0x36')]):_0x3c66c3[_0x144d('0x73')],'paused':_0x3c66c3[_0x144d('0x72')]||![],'penalty':_0x3c66c3[_0x144d('0x76')]},{'transaction':_0x3d5027});});})[_0x144d('0x2a')](function(){_0x947bae[_0x144d('0x75')](function(_0x3e75bc){socket['emit'](_0x144d('0x80'),{'UserId':_0x3e75bc['id'],'VoiceQueueId':_0x2531ad['id']});});});});});}})[_0x144d('0x2a')](respondWithStatusCode(_0x28d874,null))['catch'](handleError(_0x28d874,null));};exports[_0x144d('0x81')]=function(_0x5c5955,_0x57dc27,_0x111742){return db['Team'][_0x144d('0x4c')]({'where':{'id':_0x5c5955[_0x144d('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db[_0x144d('0x6f')],'as':_0x144d('0x70'),'attributes':['id'],'raw':!![]}]})[_0x144d('0x2a')](handleEntityNotFound(_0x57dc27,null))[_0x144d('0x2a')](function(_0x7db3a4){var _0x5dc1d0=_[_0x144d('0x32')](_0x7db3a4,'id');var _0x1a37f2=[];var _0x2af24e=[];var _0x38b5ff=squel[_0x144d('0x82')]();_0x38b5ff[_0x144d('0x83')](_0x144d('0x84'))['from'](_0x144d('0x85'),'tq')['join'](_0x144d('0x86'),'ut',_0x144d('0x87'))[_0x144d('0x47')](_0x144d('0x88'),_0x5c5955['params']['id']);for(var _0x42d4c5=0x0;_0x42d4c5<_0x7db3a4[_0x144d('0x57')];_0x42d4c5+=0x1){let _0x1ce165=_0x7db3a4[_0x42d4c5];for(var _0x24e5bf=0x0;_0x24e5bf<_0x1ce165[_0x144d('0x70')][_0x144d('0x57')];_0x24e5bf+=0x1){let _0x16d0ca=_0x1ce165[_0x144d('0x70')][_0x24e5bf];var _0x948c03=_0x38b5ff[_0x144d('0x56')]();_0x948c03[_0x144d('0x47')](_0x144d('0x89'),_0x16d0ca['id']);_0x2af24e[_0x144d('0x8a')](db['sequelize']['query'](_0x948c03[_0x144d('0x8b')](),{'type':db[_0x144d('0x77')][_0x144d('0x8c')][_0x144d('0x8d')]})['then'](function(_0x283042){if(_0x283042[_0x144d('0x57')]===0x1){return _0x16d0ca['id'];}else{var _0x550302=_[_0x144d('0x8e')](_[_0x144d('0x32')](_0x283042,'TeamId'),function(_0x40f2c0){return _['includes'](_0x5dc1d0,_0x40f2c0);});if(_0x550302){return _0x16d0ca['id'];}}}));}}return BPromise[_0x144d('0x8f')](_0x2af24e)[_0x144d('0x2a')](function(_0x42bdff){_0x1a37f2=_(_0x1a37f2)[_0x144d('0x90')](_0x42bdff)['compact']()['value']();return db[_0x144d('0x3a')][_0x144d('0x35')]({'where':{'id':_0x5c5955[_0x144d('0x4e')]['id']}})['then'](function(_0x9e7e57){return db[_0x144d('0x77')][_0x144d('0x78')](function(_0x1773be){return _0x9e7e57[_0x144d('0x81')](_0x5c5955[_0x144d('0x3e')][_0x144d('0x91')],{'transaction':_0x1773be})['then'](function(){if(!_['isEmpty'](_0x1a37f2)){return _0x9e7e57[_0x144d('0x92')](_0x1a37f2,{'transaction':_0x1773be})[_0x144d('0x2a')](function(){return db[_0x144d('0x93')]['destroy']({'where':{'VoiceQueueId':_0x5c5955['params']['id'],'UserId':_0x1a37f2},'transaction':_0x1773be});});}})[_0x144d('0x2a')](function(){_0x1a37f2[_0x144d('0x75')](function(_0x2d36b4){socket[_0x144d('0x94')](_0x144d('0x95'),{'UserId':_0x2d36b4,'VoiceQueueId':_0x9e7e57['id']});});});});});});})[_0x144d('0x2a')](respondWithStatusCode(_0x57dc27,null))[_0x144d('0x4d')](handleError(_0x57dc27,null));};exports[_0x144d('0x96')]=function(_0x549391,_0x445855,_0x2c3aa5){var _0x56f421,_0x2c3d9c;return db['VoiceQueue'][_0x144d('0x35')]({'where':{'id':_0x549391[_0x144d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x445855,null))[_0x144d('0x2a')](function(_0x253d60){if(_0x253d60){_0x2c3d9c=_0x253d60;return _0x253d60[_0x144d('0x96')](_0x549391[_0x144d('0x50')]['ids'],_[_0x144d('0x59')](_0x549391[_0x144d('0x50')],[_0x144d('0x91'),'id'])||{})[_0x144d('0x97')](function(_0x4f2f1e){for(var _0x1d0243=0x0;_0x1d0243<_0x549391[_0x144d('0x50')][_0x144d('0x91')]['length'];_0x1d0243+=0x1){socket[_0x144d('0x94')](_0x144d('0x80'),{'UserId':Number(_0x549391[_0x144d('0x50')][_0x144d('0x91')][_0x1d0243]),'VoiceQueueId':Number(_0x549391[_0x144d('0x4e')]['id'])});}return _0x4f2f1e;});}})[_0x144d('0x2a')](function(_0x579b2c){_0x56f421=_0x579b2c||[];if(_0x2c3d9c){return db['User']['findAll']({'where':{'id':_0x549391[_0x144d('0x50')][_0x144d('0x91')]},'attributes':['id',_0x144d('0x36'),'online',_0x144d('0x72'),_0x144d('0x73')],'raw':!![]});}})['then'](function(_0x262846){if(!_[_0x144d('0x98')](_0x262846)){var _0x2f87e6=[];for(var _0x4497e0=0x0;_0x4497e0<_0x262846['length'];_0x4497e0++){if(_0x262846[_0x4497e0][_0x144d('0x71')]){_0x2f87e6[_0x144d('0x8a')](db[_0x144d('0x93')][_0x144d('0x7a')]({'membername':_0x262846[_0x4497e0][_0x144d('0x36')],'UserId':_0x262846[_0x4497e0]['id'],'queue_name':_0x2c3d9c['name'],'VoiceQueueId':_0x2c3d9c['id'],'interface':_[_0x144d('0x7d')](_0x262846[_0x4497e0][_0x144d('0x73')])?util[_0x144d('0x7e')](_0x144d('0x7f'),_0x262846[_0x4497e0][_0x144d('0x36')]):_0x262846[_0x4497e0][_0x144d('0x73')],'paused':_0x262846[_0x4497e0][_0x144d('0x72')]||![],'penalty':_0x549391[_0x144d('0x50')][_0x144d('0x76')]||0x0}));}}return BPromise['all'](_0x2f87e6);}})[_0x144d('0x2a')](function(){return _0x56f421;})['then'](respondWithResult(_0x445855,null))[_0x144d('0x4d')](handleError(_0x445855,null));};exports[_0x144d('0x92')]=function(_0x9338d2,_0x4559d9,_0x59df83){return db[_0x144d('0x3a')][_0x144d('0x35')]({'where':{'id':_0x9338d2[_0x144d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4559d9,null))[_0x144d('0x2a')](function(_0x3cae63){if(_0x3cae63){return _0x3cae63['removeAgents'](_0x9338d2['query'][_0x144d('0x91')])[_0x144d('0x2a')](function(){if(_['isArray'](_0x9338d2[_0x144d('0x3e')][_0x144d('0x91')])){for(var _0x29dcf6=0x0;_0x29dcf6<_0x9338d2['query']['ids'][_0x144d('0x57')];_0x29dcf6+=0x1){socket['emit'](_0x144d('0x95'),{'UserId':Number(_0x9338d2[_0x144d('0x3e')][_0x144d('0x91')][_0x29dcf6]),'VoiceQueueId':Number(_0x9338d2['params']['id'])});}}else{socket[_0x144d('0x94')]('userVoiceQueue:remove',{'UserId':Number(_0x9338d2[_0x144d('0x3e')][_0x144d('0x91')]),'VoiceQueueId':Number(_0x9338d2[_0x144d('0x4e')]['id'])});}});}})[_0x144d('0x2a')](function(_0x43f002){return db[_0x144d('0x93')][_0x144d('0x2b')]({'where':{'VoiceQueueId':_0x9338d2[_0x144d('0x4e')]['id'],'UserId':_0x9338d2[_0x144d('0x3e')]['ids']}})[_0x144d('0x2a')](function(){return _0x43f002;});})[_0x144d('0x2a')](respondWithStatusCode(_0x4559d9,null))[_0x144d('0x4d')](handleError(_0x4559d9,null));};exports[_0x144d('0x99')]=function(_0x4377d2,_0x105a51,_0x57da49){var _0x5deb6a={};var _0x2982a={};var _0x4a4273;var _0x57147a;return db['VoiceQueue'][_0x144d('0x5f')]({'where':{'id':_0x4377d2[_0x144d('0x4e')]['id']}})[_0x144d('0x2a')](handleEntityNotFound(_0x105a51,null))[_0x144d('0x2a')](function(_0x55923f){if(_0x55923f){_0x4a4273=_0x55923f;_0x2982a[_0x144d('0x3d')]=_['keys'](db[_0x144d('0x6f')][_0x144d('0x3b')]);_0x2982a['query']=_[_0x144d('0x3f')](_0x4377d2['query']);_0x2982a['filters']=_[_0x144d('0x41')](_0x2982a[_0x144d('0x3d')],_0x2982a[_0x144d('0x3e')]);_0x5deb6a[_0x144d('0x42')]=_['intersection'](_0x2982a[_0x144d('0x3d')],qs[_0x144d('0x43')](_0x4377d2[_0x144d('0x3e')][_0x144d('0x43')]));_0x5deb6a[_0x144d('0x42')]=_0x5deb6a[_0x144d('0x42')][_0x144d('0x57')]?_0x5deb6a['attributes']:_0x2982a['model'];_0x5deb6a[_0x144d('0x45')]=qs[_0x144d('0x46')](_0x4377d2[_0x144d('0x3e')][_0x144d('0x46')]);_0x5deb6a[_0x144d('0x47')]=qs[_0x144d('0x40')](_['pick'](_0x4377d2[_0x144d('0x3e')],_0x2982a[_0x144d('0x40')]));if(_0x4377d2[_0x144d('0x3e')][_0x144d('0x30')]){_0x5deb6a[_0x144d('0x47')]=_[_0x144d('0x49')](_0x5deb6a[_0x144d('0x47')],{'$or':_['map'](_0x5deb6a[_0x144d('0x42')],function(_0x186bb4){var _0x4238dd={};_0x4238dd[_0x186bb4]={'$like':'%'+_0x4377d2[_0x144d('0x3e')][_0x144d('0x30')]+'%'};return _0x4238dd;})});}_0x5deb6a=_[_0x144d('0x49')]({},_0x5deb6a,_0x4377d2[_0x144d('0x58')]);return _0x4a4273['getAgents'](_0x5deb6a);}})[_0x144d('0x2a')](function(_0x5c7ed2){if(_0x5c7ed2){_0x57147a=_0x5c7ed2[_0x144d('0x57')];if(!_0x4377d2[_0x144d('0x3e')][_0x144d('0x63')](_0x144d('0x44'))){_0x5deb6a[_0x144d('0x24')]=qs['limit'](_0x4377d2[_0x144d('0x3e')][_0x144d('0x24')]);_0x5deb6a[_0x144d('0x23')]=qs[_0x144d('0x23')](_0x4377d2[_0x144d('0x3e')][_0x144d('0x23')]);}return _0x4a4273[_0x144d('0x99')](_0x5deb6a);}})[_0x144d('0x2a')](function(_0x1bb043){if(_0x1bb043){return _0x1bb043?{'count':_0x57147a,'rows':_0x1bb043}:null;}})[_0x144d('0x2a')](respondWithResult(_0x105a51,null))[_0x144d('0x4d')](handleError(_0x105a51,null));};exports[_0x144d('0x9a')]=function(_0x438abd,_0x4b2ce8,_0x23e8cb){var _0x3754f5={};var _0x265d3b={};var _0x1e673b;var _0x20554d;return db[_0x144d('0x3a')][_0x144d('0x5f')]({'where':{'id':_0x438abd['params']['id']}})[_0x144d('0x2a')](handleEntityNotFound(_0x4b2ce8,null))['then'](function(_0x25bf5b){if(_0x25bf5b){_0x1e673b=_0x25bf5b;_0x265d3b['model']=_[_0x144d('0x3f')](db[_0x144d('0x93')]['rawAttributes']);_0x265d3b[_0x144d('0x3e')]=_[_0x144d('0x3f')](_0x438abd['query']);_0x265d3b[_0x144d('0x40')]=_[_0x144d('0x41')](_0x265d3b[_0x144d('0x3d')],_0x265d3b[_0x144d('0x3e')]);_0x3754f5['attributes']=_['intersection'](_0x265d3b[_0x144d('0x3d')],qs[_0x144d('0x43')](_0x438abd[_0x144d('0x3e')][_0x144d('0x43')]));_0x3754f5[_0x144d('0x42')]=_0x3754f5[_0x144d('0x42')][_0x144d('0x57')]?_0x3754f5[_0x144d('0x42')]:_0x265d3b[_0x144d('0x3d')];_0x3754f5[_0x144d('0x45')]=qs[_0x144d('0x46')](_0x438abd[_0x144d('0x3e')]['sort']);_0x3754f5['where']=qs['filters'](_['pick'](_0x438abd[_0x144d('0x3e')],_0x265d3b[_0x144d('0x40')]));if(_0x438abd[_0x144d('0x3e')][_0x144d('0x30')]){_0x3754f5[_0x144d('0x47')]=_['merge'](_0x3754f5[_0x144d('0x47')],{'$or':_['map'](_0x3754f5[_0x144d('0x42')],function(_0xdc9ec1){var _0x193870={};_0x193870[_0xdc9ec1]={'$like':'%'+_0x438abd[_0x144d('0x3e')]['filter']+'%'};return _0x193870;})});}_0x3754f5=_[_0x144d('0x49')]({},_0x3754f5,_0x438abd['options']);return _0x1e673b[_0x144d('0x9a')](_0x3754f5);}})[_0x144d('0x2a')](function(_0x5719c6){if(_0x5719c6){_0x20554d=_0x5719c6[_0x144d('0x57')];if(!_0x438abd['query'][_0x144d('0x63')]('nolimit')){_0x3754f5[_0x144d('0x24')]=qs[_0x144d('0x24')](_0x438abd[_0x144d('0x3e')][_0x144d('0x24')]);_0x3754f5[_0x144d('0x23')]=qs[_0x144d('0x23')](_0x438abd[_0x144d('0x3e')][_0x144d('0x23')]);}return _0x1e673b[_0x144d('0x9a')](_0x3754f5);}})[_0x144d('0x2a')](function(_0x14022f){return _0x14022f?{'count':_0x20554d,'rows':_0x14022f}:null;})[_0x144d('0x2a')](respondWithResult(_0x4b2ce8,null))['catch'](handleError(_0x4b2ce8,null));};exports[_0x144d('0x9b')]=function(_0x27fa64,_0x47f443,_0x1dc39b){var _0x5d8777={};var _0x25d0c5={};var _0x5eb54a;var _0x319a84;return db[_0x144d('0x3a')]['findOne']({'where':{'id':_0x27fa64['params']['id']}})[_0x144d('0x2a')](handleEntityNotFound(_0x47f443,null))['then'](function(_0x502766){if(_0x502766){_0x5eb54a=_0x502766;_0x25d0c5['model']=_[_0x144d('0x3f')](db[_0x144d('0x9c')][_0x144d('0x3b')]);_0x25d0c5['query']=_[_0x144d('0x3f')](_0x27fa64[_0x144d('0x3e')]);_0x25d0c5['filters']=_[_0x144d('0x41')](_0x25d0c5[_0x144d('0x3d')],_0x25d0c5[_0x144d('0x3e')]);_0x5d8777[_0x144d('0x42')]=_['intersection'](_0x25d0c5[_0x144d('0x3d')],qs[_0x144d('0x43')](_0x27fa64[_0x144d('0x3e')][_0x144d('0x43')]));_0x5d8777[_0x144d('0x42')]=_0x5d8777[_0x144d('0x42')][_0x144d('0x57')]?_0x5d8777[_0x144d('0x42')]:_0x25d0c5[_0x144d('0x3d')];_0x5d8777['order']=qs['sort'](_0x27fa64[_0x144d('0x3e')][_0x144d('0x46')]);_0x5d8777[_0x144d('0x47')]=qs[_0x144d('0x40')](_[_0x144d('0x64')](_0x27fa64['query'],_0x25d0c5[_0x144d('0x40')]));if(_0x27fa64['query'][_0x144d('0x30')]){_0x5d8777[_0x144d('0x47')]=_[_0x144d('0x49')](_0x5d8777[_0x144d('0x47')],{'$or':_[_0x144d('0x32')](_0x5d8777[_0x144d('0x42')],function(_0x41080f){var _0x25d967={};_0x25d967[_0x41080f]={'$like':'%'+_0x27fa64[_0x144d('0x3e')][_0x144d('0x30')]+'%'};return _0x25d967;})});}_0x5d8777=_['merge']({},_0x5d8777,_0x27fa64[_0x144d('0x58')]);return _0x5eb54a[_0x144d('0x9b')](_0x5d8777);}})[_0x144d('0x2a')](function(_0x189470){if(_0x189470){_0x319a84=_0x189470[_0x144d('0x57')];if(!_0x27fa64[_0x144d('0x3e')][_0x144d('0x63')](_0x144d('0x44'))){_0x5d8777[_0x144d('0x24')]=qs['limit'](_0x27fa64[_0x144d('0x3e')]['limit']);_0x5d8777[_0x144d('0x23')]=qs[_0x144d('0x23')](_0x27fa64[_0x144d('0x3e')][_0x144d('0x23')]);}return _0x5eb54a[_0x144d('0x9b')](_0x5d8777);}})[_0x144d('0x2a')](function(_0x3a562e){if(_0x3a562e){return _0x3a562e?{'count':_0x319a84,'rows':_0x3a562e}:null;}})[_0x144d('0x2a')](respondWithResult(_0x47f443,null))['catch'](handleError(_0x47f443,null));};exports[_0x144d('0x9d')]=function(_0x43c18f,_0x9ba2f1,_0x5dce06){var _0xbf710a,_0x2ca27c;return db[_0x144d('0x3a')][_0x144d('0x35')]({'where':{'id':_0x43c18f[_0x144d('0x4e')]['id']}})[_0x144d('0x2a')](handleEntityNotFound(_0x9ba2f1,null))['then'](function(_0x1cf4cd){if(_0x1cf4cd){_0x2ca27c=_0x1cf4cd;return _0x1cf4cd[_0x144d('0x9d')](_0x43c18f[_0x144d('0x50')]['ids'],_[_0x144d('0x59')](_0x43c18f[_0x144d('0x50')],[_0x144d('0x91'),'id'])||{});}return null;})[_0x144d('0x97')](function(_0xe8149){var _0x3c9956;_0xbf710a=_0xe8149||[];var _0x7f1af=[];if(_0xe8149){for(var _0x4a4b3b=0x0;_0x4a4b3b<_0xe8149[_0x144d('0x57')];_0x4a4b3b+=0x1){var _0x2f2860=_0xe8149[_0x4a4b3b][_0x144d('0x2c')]({'plain':!![]});_0x2ca27c[_0x144d('0x9e')]=_0x43c18f[_0x144d('0x50')][_0x144d('0x9e')]?_0x43c18f[_0x144d('0x50')]['dialCheckDuplicateType']:_0x2ca27c[_0x144d('0x9e')];switch(_0x2ca27c[_0x144d('0x9e')]){case _0x144d('0x9f'):_0x3c9956=squel[_0x144d('0xa0')]()[_0x144d('0xa1')](_0x144d('0xa2'))[_0x144d('0xa3')]([_0x144d('0xa4'),_0x144d('0xa5'),_0x144d('0xa6'),'ListId','VoiceQueueId',_0x144d('0x5b'),_0x144d('0x5a')],squel['select']()[_0x144d('0x83')]('phone',_0x144d('0xa4'))['field']('NOW()',_0x144d('0xa5'))['field']('id',_0x144d('0xa6'))[_0x144d('0x83')](_0x2f2860[_0x144d('0xa7')][_0x144d('0x8b')](),_0x144d('0xa8'))[_0x144d('0x83')](_0x43c18f[_0x144d('0x4e')]['id'][_0x144d('0x8b')](),_0x144d('0x61'))['field'](_0x144d('0xa9'),'createdAt')['field'](_0x144d('0xa9'),'updatedAt')['from'](_0x144d('0xaa'))['where'](_0x144d('0xab'))['where'](_0x144d('0xac'),_0x2f2860[_0x144d('0xa7')][_0x144d('0x8b')]())[_0x144d('0x47')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x144d('0xad'),squel['select']()['field'](_0x144d('0xae'))[_0x144d('0xaf')](_0x144d('0xb0'))[_0x144d('0x47')](_0x144d('0x88'),_0x43c18f[_0x144d('0x4e')]['id'][_0x144d('0x8b')]()))[_0x144d('0x47')](_0x144d('0xad'),squel[_0x144d('0x82')]()[_0x144d('0x83')](_0x144d('0xb1'))[_0x144d('0xaf')](_0x144d('0xa2'))[_0x144d('0x47')](_0x144d('0x88'),_0x43c18f[_0x144d('0x4e')]['id'][_0x144d('0x8b')]())))['toString']();break;case _0x144d('0xb2'):_0x3c9956=squel[_0x144d('0xa0')]()[_0x144d('0xa1')]('cm_hopper')[_0x144d('0xa3')]([_0x144d('0xa4'),_0x144d('0xa5'),_0x144d('0xa6'),'ListId',_0x144d('0x61'),'createdAt','updatedAt'],squel['select']()[_0x144d('0x83')](_0x144d('0xa4'),_0x144d('0xa4'))['field']('NOW()','scheduledAt')[_0x144d('0x83')]('id',_0x144d('0xa6'))[_0x144d('0x83')](_0x2f2860[_0x144d('0xa7')]['toString'](),_0x144d('0xa8'))[_0x144d('0x83')](_0x43c18f[_0x144d('0x4e')]['id'][_0x144d('0x8b')](),_0x144d('0x61'))[_0x144d('0x83')]('NOW()',_0x144d('0x5b'))[_0x144d('0x83')]('NOW()',_0x144d('0x5a'))[_0x144d('0xaf')](_0x144d('0xaa'))[_0x144d('0x47')]('deletedAt\x20IS\x20NULL')[_0x144d('0x47')](_0x144d('0xac'),_0x2f2860[_0x144d('0xa7')][_0x144d('0x8b')]())[_0x144d('0x47')](_0x144d('0xb3'))[_0x144d('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0x144d('0x82')]()[_0x144d('0x83')](_0x144d('0xb1'))[_0x144d('0xaf')](_0x144d('0xa2'))[_0x144d('0x47')](_0x144d('0x88'),_0x43c18f[_0x144d('0x4e')]['id'][_0x144d('0x8b')]())))[_0x144d('0x8b')]();break;default:_0x3c9956=squel[_0x144d('0xa0')]()['into'](_0x144d('0xa2'))[_0x144d('0xa3')](['phone','scheduledAt','ContactId','ListId',_0x144d('0x61'),_0x144d('0x5b'),_0x144d('0x5a')],squel['select']()[_0x144d('0x83')]('phone',_0x144d('0xa4'))[_0x144d('0x83')]('NOW()',_0x144d('0xa5'))['field']('id',_0x144d('0xa6'))[_0x144d('0x83')](_0x2f2860[_0x144d('0xa7')]['toString'](),_0x144d('0xa8'))[_0x144d('0x83')](_0x43c18f['params']['id'][_0x144d('0x8b')](),_0x144d('0x61'))[_0x144d('0x83')](_0x144d('0xa9'),_0x144d('0x5b'))[_0x144d('0x83')](_0x144d('0xa9'),'updatedAt')['from'](_0x144d('0xaa'))[_0x144d('0x47')](_0x144d('0xab'))[_0x144d('0x47')]('ListId\x20=\x20?',_0x2f2860[_0x144d('0xa7')][_0x144d('0x8b')]())['where'](_0x144d('0xb3')))[_0x144d('0x8b')]();}_0x7f1af[_0x144d('0x8a')](db[_0x144d('0x77')][_0x144d('0x3e')](_0x3c9956));}return BPromise[_0x144d('0x8f')](_0x7f1af);}})[_0x144d('0x2a')](function(){return _0xbf710a;})[_0x144d('0x2a')](respondWithResult(_0x9ba2f1,null))[_0x144d('0x4d')](handleError(_0x9ba2f1,null));};exports['removeLists']=function(_0x41a13c,_0x334ba4,_0x4e3abb){return db[_0x144d('0x3a')][_0x144d('0x35')]({'where':{'id':_0x41a13c[_0x144d('0x4e')]['id']}})[_0x144d('0x2a')](handleEntityNotFound(_0x334ba4,null))[_0x144d('0x2a')](function(_0x266635){if(_0x266635){return _0x266635[_0x144d('0xb4')](_0x41a13c[_0x144d('0x3e')][_0x144d('0x91')]);}})[_0x144d('0x2a')](function(_0x3167db){if(_0x3167db){return db['CmHopper']['destroy']({'where':{'ListId':_0x41a13c[_0x144d('0x3e')][_0x144d('0x91')],'VoiceQueueId':_0x41a13c[_0x144d('0x4e')]['id']}})[_0x144d('0x2a')](function(){return _0x3167db;});}})['then'](respondWithStatusCode(_0x334ba4,null))[_0x144d('0x4d')](handleError(_0x334ba4,null));};exports[_0x144d('0xb5')]=function(_0xae1dcb,_0x117c18,_0x2a4f20){var _0x152a02={};var _0x5a637e={};var _0x287a40;var _0x515c98;return db[_0x144d('0x3a')]['findOne']({'where':{'id':_0xae1dcb[_0x144d('0x4e')]['id']}})[_0x144d('0x2a')](handleEntityNotFound(_0x117c18,null))[_0x144d('0x2a')](function(_0x3145f3){if(_0x3145f3){_0x287a40=_0x3145f3;_0x5a637e[_0x144d('0x3d')]=_['keys'](db[_0x144d('0x9c')][_0x144d('0x3b')]);_0x5a637e[_0x144d('0x3e')]=_[_0x144d('0x3f')](_0xae1dcb[_0x144d('0x3e')]);_0x5a637e['filters']=_[_0x144d('0x41')](_0x5a637e['model'],_0x5a637e[_0x144d('0x3e')]);_0x152a02['attributes']=_[_0x144d('0x41')](_0x5a637e['model'],qs[_0x144d('0x43')](_0xae1dcb[_0x144d('0x3e')][_0x144d('0x43')]));_0x152a02[_0x144d('0x42')]=_0x152a02[_0x144d('0x42')][_0x144d('0x57')]?_0x152a02[_0x144d('0x42')]:_0x5a637e[_0x144d('0x3d')];_0x152a02[_0x144d('0x45')]=qs['sort'](_0xae1dcb[_0x144d('0x3e')]['sort']);_0x152a02[_0x144d('0x47')]=qs[_0x144d('0x40')](_['pick'](_0xae1dcb[_0x144d('0x3e')],_0x5a637e['filters']));if(_0xae1dcb[_0x144d('0x3e')]['filter']){_0x152a02[_0x144d('0x47')]=_['merge'](_0x152a02[_0x144d('0x47')],{'$or':_[_0x144d('0x32')](_0x152a02['attributes'],function(_0x1ee53e){var _0x33142c={};_0x33142c[_0x1ee53e]={'$like':'%'+_0xae1dcb[_0x144d('0x3e')][_0x144d('0x30')]+'%'};return _0x33142c;})});}_0x152a02=_[_0x144d('0x49')]({},_0x152a02,_0xae1dcb[_0x144d('0x58')]);return _0x287a40[_0x144d('0xb5')](_0x152a02);}})[_0x144d('0x2a')](function(_0x253a64){if(_0x253a64){_0x515c98=_0x253a64[_0x144d('0x57')];if(!_0xae1dcb['query'][_0x144d('0x63')](_0x144d('0x44'))){_0x152a02[_0x144d('0x24')]=qs['limit'](_0xae1dcb[_0x144d('0x3e')]['limit']);_0x152a02[_0x144d('0x23')]=qs[_0x144d('0x23')](_0xae1dcb[_0x144d('0x3e')]['offset']);}return _0x287a40[_0x144d('0xb5')](_0x152a02);}})[_0x144d('0x2a')](function(_0x6005c5){if(_0x6005c5){return _0x6005c5?{'count':_0x515c98,'rows':_0x6005c5}:null;}})[_0x144d('0x2a')](respondWithResult(_0x117c18,null))[_0x144d('0x4d')](handleError(_0x117c18,null));};exports[_0x144d('0xb6')]=function(_0x41f642,_0x373a4a,_0x363a06){var _0x3bbf92,_0x4cf081;return db['VoiceQueue']['find']({'where':{'id':_0x41f642[_0x144d('0x4e')]['id']}})[_0x144d('0x2a')](handleEntityNotFound(_0x373a4a,null))[_0x144d('0x2a')](function(_0x4d084c){if(_0x4d084c){_0x4cf081=_0x4d084c;return _0x4d084c[_0x144d('0xb6')](_0x41f642[_0x144d('0x50')][_0x144d('0x91')],_[_0x144d('0x59')](_0x41f642[_0x144d('0x50')],[_0x144d('0x91'),'id'])||{});}return null;})[_0x144d('0x97')](function(_0x3bebd1){var _0x3b6087;_0x3bbf92=_0x3bebd1||[];var _0x2e4572=[];if(_0x3bebd1){for(var _0x1b4ce9=0x0;_0x1b4ce9<_0x3bebd1['length'];_0x1b4ce9+=0x1){var _0x3bcd9f=_0x3bebd1[_0x1b4ce9]['get']({'plain':!![]});_0x3b6087=squel[_0x144d('0xa0')]()[_0x144d('0xa1')](_0x144d('0xb7'))[_0x144d('0xa3')]([_0x144d('0xa4'),'ContactId',_0x144d('0xa8'),_0x144d('0x61'),_0x144d('0x5b'),_0x144d('0x5a')],squel[_0x144d('0x82')]()[_0x144d('0x83')](_0x144d('0xa4'),_0x144d('0xa4'))['field']('id','ContactId')[_0x144d('0x83')](_0x3bcd9f[_0x144d('0xa7')][_0x144d('0x8b')](),'ListId')['field'](_0x41f642[_0x144d('0x4e')]['id']['toString'](),_0x144d('0x61'))['field'](_0x144d('0xa9'),_0x144d('0x5b'))['field'](_0x144d('0xa9'),_0x144d('0x5a'))['from'](_0x144d('0xaa'))[_0x144d('0x47')]('deletedAt\x20IS\x20NULL')[_0x144d('0x47')](_0x144d('0xac'),_0x3bcd9f['CmListId'][_0x144d('0x8b')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x144d('0x8b')]();_0x2e4572[_0x144d('0x8a')](db['sequelize'][_0x144d('0x3e')](_0x3b6087));}return BPromise[_0x144d('0x8f')](_0x2e4572);}})[_0x144d('0x2a')](function(){return _0x3bbf92;})[_0x144d('0x2a')](respondWithResult(_0x373a4a,null))[_0x144d('0x4d')](handleError(_0x373a4a,null));};exports[_0x144d('0xb8')]=function(_0x4a58bc,_0x1e0eeb,_0x22daca){return db[_0x144d('0x3a')]['find']({'where':{'id':_0x4a58bc['params']['id']}})[_0x144d('0x2a')](handleEntityNotFound(_0x1e0eeb,null))[_0x144d('0x2a')](function(_0x4da1f7){if(_0x4da1f7){return _0x4da1f7['removeBlackLists'](_0x4a58bc[_0x144d('0x3e')]['ids']);}})[_0x144d('0x2a')](function(_0x9f1352){if(_0x9f1352){return db[_0x144d('0x6a')]['destroy']({'where':{'ListId':_0x4a58bc[_0x144d('0x3e')]['ids'],'VoiceQueueId':_0x4a58bc[_0x144d('0x4e')]['id']}})[_0x144d('0x2a')](function(){return _0x9f1352;});}})[_0x144d('0x2a')](respondWithStatusCode(_0x1e0eeb,null))[_0x144d('0x4d')](handleError(_0x1e0eeb,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1447751..27c542b 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 _0xc354=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xc354,0x1ac));var _0x4c35=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc354[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x4c35('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4c35('0x1')](0x0);var events={'afterCreate':_0x4c35('0x2'),'afterUpdate':_0x4c35('0x3'),'afterDestroy':_0x4c35('0x4')};function emitEvent(_0xf1213b){return function(_0xab70f2,_0xdc9886,_0x10d368){VoiceQueueEvents[_0x4c35('0x5')](_0xf1213b+':'+_0xab70f2['id'],_0xab70f2);VoiceQueueEvents[_0x4c35('0x5')](_0xf1213b,_0xab70f2);_0x10d368(null);};}for(var e in events){if(events[_0x4c35('0x6')](e)){var event=events[e];VoiceQueue[_0x4c35('0x7')](e,emitEvent(event));}}module[_0x4c35('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xd54b=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners','save'];(function(_0x1a8285,_0x350d60){var _0x25a7f3=function(_0x36084c){while(--_0x36084c){_0x1a8285['push'](_0x1a8285['shift']());}};_0x25a7f3(++_0x350d60);}(_0xd54b,0x83));var _0xbd54=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd54b[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xbd54('0x0'))['db'][_0xbd54('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xbd54('0x2')](0x0);var events={'afterCreate':_0xbd54('0x3'),'afterUpdate':'update','afterDestroy':_0xbd54('0x4')};function emitEvent(_0x31b5a6){return function(_0x42b541,_0x346f24,_0x21b560){VoiceQueueEvents[_0xbd54('0x5')](_0x31b5a6+':'+_0x42b541['id'],_0x42b541);VoiceQueueEvents[_0xbd54('0x5')](_0x31b5a6,_0x42b541);_0x21b560(null);};}for(var e in events){if(events[_0xbd54('0x6')](e)){var event=events[e];VoiceQueue[_0xbd54('0x7')](e,emitEvent(event));}}module[_0xbd54('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 79ff393..d8df184 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x263163,_0x5d3de3){var _0x30b32b=function(_0x35a5f0){while(--_0x35a5f0){_0x263163['push'](_0x263163['shift']());}};_0x30b32b(++_0x5d3de3);}(_0x34e8,0x12c));var _0x834e=function(_0x40e005,_0x3dede3){_0x40e005=_0x40e005-0x0;var _0xb99aa0=_0x34e8[_0x40e005];return _0xb99aa0;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x51c31f,_0x39809c){var _0x30908d=function(_0x409389){while(--_0x409389){_0x51c31f['push'](_0x51c31f['shift']());}};_0x30908d(++_0x39809c);}(_0xedd9,0xfc));var _0x9edd=function(_0x464097,_0x4df563){_0x464097=_0x464097-0x0;var _0x5ab454=_0xedd9[_0x464097];return _0x5ab454;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 7b516c7..042e1cf 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 _0xd360=['then','GetVoiceQueue','ShowVoiceQueue','find','model','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueue','options','raw','where','attributes','limit','include','map'];(function(_0x23cb72,_0x458456){var _0x2a82bb=function(_0x548c7f){while(--_0x548c7f){_0x23cb72['push'](_0x23cb72['shift']());}};_0x2a82bb(++_0x458456);}(_0xd360,0x16e));var _0x0d36=function(_0x13f6f9,_0xaa7233){_0x13f6f9=_0x13f6f9-0x0;var _0x55d208=_0xd360[_0x13f6f9];return _0x55d208;};'use strict';var _=require(_0x0d36('0x0'));var util=require(_0x0d36('0x1'));var moment=require(_0x0d36('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d36('0x3'));var fs=require('fs');var Redis=require(_0x0d36('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d36('0x5'));var logger=require(_0x0d36('0x6'))('rpc');var config=require(_0x0d36('0x7'));var jayson=require(_0x0d36('0x8'));var client=jayson[_0x0d36('0x9')][_0x0d36('0xa')]({'port':0x232a});config[_0x0d36('0xb')]=_[_0x0d36('0xc')](config[_0x0d36('0xb')],{'host':_0x0d36('0xd'),'port':0x18eb});var socket=require(_0x0d36('0xe'))(new Redis(config[_0x0d36('0xb')]));require(_0x0d36('0xf'))['register'](socket);function respondWithRpcPromise(_0x2958e5,_0x3e0aee,_0x45d06f){return new BPromise(function(_0x8068a9,_0x11b866){return client['request'](_0x2958e5,_0x45d06f)['then'](function(_0x319a6f){logger[_0x0d36('0x10')](_0x0d36('0x11'),_0x3e0aee,_0x0d36('0x12'));logger['debug'](_0x0d36('0x13'),_0x3e0aee,_0x0d36('0x12'),JSON[_0x0d36('0x14')](_0x319a6f));if(_0x319a6f[_0x0d36('0x15')]){if(_0x319a6f['error'][_0x0d36('0x16')]===0x1f4){logger['error'](_0x0d36('0x11'),_0x3e0aee,_0x319a6f[_0x0d36('0x15')][_0x0d36('0x17')]);return _0x11b866(_0x319a6f['error'][_0x0d36('0x17')]);}logger[_0x0d36('0x15')](_0x0d36('0x11'),_0x3e0aee,_0x319a6f[_0x0d36('0x15')][_0x0d36('0x17')]);return _0x8068a9(_0x319a6f[_0x0d36('0x15')][_0x0d36('0x17')]);}else{logger[_0x0d36('0x10')](_0x0d36('0x11'),_0x3e0aee,_0x0d36('0x12'));_0x8068a9(_0x319a6f[_0x0d36('0x18')][_0x0d36('0x17')]);}})[_0x0d36('0x19')](function(_0x100ff){logger[_0x0d36('0x15')](_0x0d36('0x11'),_0x3e0aee,_0x100ff);_0x11b866(_0x100ff);});});}exports['GetVoiceQueue']=function(_0x26c4dc){var _0x270055=this;return new Promise(function(_0x3ad879,_0x575511){return db[_0x0d36('0x1a')]['findAll']({'raw':_0x26c4dc[_0x0d36('0x1b')]?_0x26c4dc[_0x0d36('0x1b')][_0x0d36('0x1c')]===undefined?!![]:![]:!![],'where':_0x26c4dc['options']?_0x26c4dc[_0x0d36('0x1b')][_0x0d36('0x1d')]||null:null,'attributes':_0x26c4dc[_0x0d36('0x1b')]?_0x26c4dc[_0x0d36('0x1b')][_0x0d36('0x1e')]||null:null,'limit':_0x26c4dc[_0x0d36('0x1b')]?_0x26c4dc[_0x0d36('0x1b')][_0x0d36('0x1f')]||null:null,'include':_0x26c4dc['options']?_0x26c4dc[_0x0d36('0x1b')][_0x0d36('0x20')]?_['map'](_0x26c4dc[_0x0d36('0x1b')][_0x0d36('0x20')],function(_0x4699ab){return{'model':db[_0x4699ab['model']],'as':_0x4699ab['as'],'attributes':_0x4699ab[_0x0d36('0x1e')],'include':_0x4699ab[_0x0d36('0x20')]?_[_0x0d36('0x21')](_0x4699ab[_0x0d36('0x20')],function(_0x2ea4d0){return{'model':db[_0x2ea4d0['model']],'as':_0x2ea4d0['as'],'attributes':_0x2ea4d0[_0x0d36('0x1e')],'include':_0x2ea4d0['include']?_[_0x0d36('0x21')](_0x2ea4d0['include'],function(_0x4c3f64){return{'model':db[_0x4c3f64['model']],'as':_0x4c3f64['as'],'attributes':_0x4c3f64[_0x0d36('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d36('0x22')](function(_0x4ad8a7){logger['info'](_0x0d36('0x23'),_0x26c4dc);logger['debug'](_0x0d36('0x23'),_0x26c4dc,JSON[_0x0d36('0x14')](_0x4ad8a7));_0x3ad879(_0x4ad8a7);})[_0x0d36('0x19')](function(_0xc809c4){logger[_0x0d36('0x15')](_0x0d36('0x23'),_0xc809c4[_0x0d36('0x17')],_0x26c4dc);_0x575511(_0x270055[_0x0d36('0x15')](0x1f4,_0xc809c4['message']));});});};exports[_0x0d36('0x24')]=function(_0x5c9319){var _0x2e5bb9=this;return new Promise(function(_0x5151cb,_0x6bcacd){return db[_0x0d36('0x1a')][_0x0d36('0x25')]({'raw':_0x5c9319[_0x0d36('0x1b')]?_0x5c9319[_0x0d36('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5c9319[_0x0d36('0x1b')]?_0x5c9319['options'][_0x0d36('0x1d')]||null:null,'attributes':_0x5c9319[_0x0d36('0x1b')]?_0x5c9319[_0x0d36('0x1b')]['attributes']||null:null,'include':_0x5c9319[_0x0d36('0x1b')]?_0x5c9319[_0x0d36('0x1b')]['include']?_[_0x0d36('0x21')](_0x5c9319['options'][_0x0d36('0x20')],function(_0x2b0aca){return{'model':db[_0x2b0aca[_0x0d36('0x26')]],'as':_0x2b0aca['as'],'attributes':_0x2b0aca[_0x0d36('0x1e')],'include':_0x2b0aca['include']?_[_0x0d36('0x21')](_0x2b0aca[_0x0d36('0x20')],function(_0x5f3e9a){return{'model':db[_0x5f3e9a[_0x0d36('0x26')]],'as':_0x5f3e9a['as'],'attributes':_0x5f3e9a['attributes'],'include':_0x5f3e9a['include']?_['map'](_0x5f3e9a[_0x0d36('0x20')],function(_0x15a3c1){return{'model':db[_0x15a3c1[_0x0d36('0x26')]],'as':_0x15a3c1['as'],'attributes':_0x15a3c1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x39eb90){logger['info'](_0x0d36('0x24'),_0x5c9319);logger[_0x0d36('0x27')]('ShowVoiceQueue',_0x5c9319,JSON[_0x0d36('0x14')](_0x39eb90));_0x5151cb(_0x39eb90);})[_0x0d36('0x19')](function(_0x2e647d){logger['error'](_0x0d36('0x24'),_0x2e647d[_0x0d36('0x17')],_0x5c9319);_0x6bcacd(_0x2e5bb9[_0x0d36('0x15')](0x1f4,_0x2e647d[_0x0d36('0x17')]));});});}; \ No newline at end of file +var _0x31b4=['model','ShowVoiceQueue','find','then','catch','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x31b4,0xe9));var _0x431b=function(_0x342f55,_0xf93a5d){_0x342f55=_0x342f55-0x0;var _0xba1ac3=_0x31b4[_0x342f55];return _0xba1ac3;};'use strict';var _=require('lodash');var util=require(_0x431b('0x0'));var moment=require(_0x431b('0x1'));var BPromise=require('bluebird');var rs=require(_0x431b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x431b('0x3'));var logger=require('../../config/logger')(_0x431b('0x4'));var config=require(_0x431b('0x5'));var jayson=require(_0x431b('0x6'));var client=jayson['client'][_0x431b('0x7')]({'port':0x232a});config[_0x431b('0x8')]=_[_0x431b('0x9')](config['redis'],{'host':_0x431b('0xa'),'port':0x18eb});var socket=require(_0x431b('0xb'))(new Redis(config[_0x431b('0x8')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x154ba6,_0x4b8448,_0x27be80){return new BPromise(function(_0x555cfe,_0xa07ebe){return client[_0x431b('0xc')](_0x154ba6,_0x27be80)['then'](function(_0x2cf803){logger['info'](_0x431b('0xd'),_0x4b8448,_0x431b('0xe'));logger[_0x431b('0xf')](_0x431b('0x10'),_0x4b8448,_0x431b('0xe'),JSON[_0x431b('0x11')](_0x2cf803));if(_0x2cf803[_0x431b('0x12')]){if(_0x2cf803[_0x431b('0x12')][_0x431b('0x13')]===0x1f4){logger[_0x431b('0x12')](_0x431b('0xd'),_0x4b8448,_0x2cf803[_0x431b('0x12')]['message']);return _0xa07ebe(_0x2cf803[_0x431b('0x12')]['message']);}logger[_0x431b('0x12')](_0x431b('0xd'),_0x4b8448,_0x2cf803['error']['message']);return _0x555cfe(_0x2cf803[_0x431b('0x12')][_0x431b('0x14')]);}else{logger[_0x431b('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x4b8448,'request\x20sent');_0x555cfe(_0x2cf803[_0x431b('0x16')][_0x431b('0x14')]);}})['catch'](function(_0x485bdb){logger['error'](_0x431b('0xd'),_0x4b8448,_0x485bdb);_0xa07ebe(_0x485bdb);});});}exports[_0x431b('0x17')]=function(_0x5b21a7){var _0x37ba1f=this;return new Promise(function(_0x3d4a7b,_0x44b952){return db[_0x431b('0x18')][_0x431b('0x19')]({'raw':_0x5b21a7['options']?_0x5b21a7[_0x431b('0x1a')][_0x431b('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b21a7['options']?_0x5b21a7[_0x431b('0x1a')][_0x431b('0x1c')]||null:null,'attributes':_0x5b21a7[_0x431b('0x1a')]?_0x5b21a7['options'][_0x431b('0x1d')]||null:null,'limit':_0x5b21a7[_0x431b('0x1a')]?_0x5b21a7[_0x431b('0x1a')][_0x431b('0x1e')]||null:null,'include':_0x5b21a7[_0x431b('0x1a')]?_0x5b21a7[_0x431b('0x1a')][_0x431b('0x1f')]?_[_0x431b('0x20')](_0x5b21a7[_0x431b('0x1a')][_0x431b('0x1f')],function(_0x4b7f50){return{'model':db[_0x4b7f50[_0x431b('0x21')]],'as':_0x4b7f50['as'],'attributes':_0x4b7f50['attributes'],'include':_0x4b7f50['include']?_['map'](_0x4b7f50[_0x431b('0x1f')],function(_0x46aa0d){return{'model':db[_0x46aa0d[_0x431b('0x21')]],'as':_0x46aa0d['as'],'attributes':_0x46aa0d['attributes'],'include':_0x46aa0d['include']?_[_0x431b('0x20')](_0x46aa0d[_0x431b('0x1f')],function(_0x1fdb5a){return{'model':db[_0x1fdb5a[_0x431b('0x21')]],'as':_0x1fdb5a['as'],'attributes':_0x1fdb5a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f93c7){logger[_0x431b('0x15')](_0x431b('0x17'),_0x5b21a7);logger[_0x431b('0xf')](_0x431b('0x17'),_0x5b21a7,JSON['stringify'](_0x4f93c7));_0x3d4a7b(_0x4f93c7);})['catch'](function(_0x1b4089){logger[_0x431b('0x12')]('GetVoiceQueue',_0x1b4089[_0x431b('0x14')],_0x5b21a7);_0x44b952(_0x37ba1f[_0x431b('0x12')](0x1f4,_0x1b4089[_0x431b('0x14')]));});});};exports[_0x431b('0x22')]=function(_0x382beb){var _0x5ad291=this;return new Promise(function(_0x5a2365,_0x5bcf33){return db['VoiceQueue'][_0x431b('0x23')]({'raw':_0x382beb['options']?_0x382beb['options'][_0x431b('0x1b')]===undefined?!![]:![]:!![],'where':_0x382beb[_0x431b('0x1a')]?_0x382beb[_0x431b('0x1a')][_0x431b('0x1c')]||null:null,'attributes':_0x382beb[_0x431b('0x1a')]?_0x382beb[_0x431b('0x1a')][_0x431b('0x1d')]||null:null,'include':_0x382beb[_0x431b('0x1a')]?_0x382beb[_0x431b('0x1a')][_0x431b('0x1f')]?_[_0x431b('0x20')](_0x382beb['options'][_0x431b('0x1f')],function(_0x313ffa){return{'model':db[_0x313ffa[_0x431b('0x21')]],'as':_0x313ffa['as'],'attributes':_0x313ffa[_0x431b('0x1d')],'include':_0x313ffa[_0x431b('0x1f')]?_['map'](_0x313ffa['include'],function(_0x212f5d){return{'model':db[_0x212f5d[_0x431b('0x21')]],'as':_0x212f5d['as'],'attributes':_0x212f5d[_0x431b('0x1d')],'include':_0x212f5d[_0x431b('0x1f')]?_[_0x431b('0x20')](_0x212f5d[_0x431b('0x1f')],function(_0x4c6901){return{'model':db[_0x4c6901[_0x431b('0x21')]],'as':_0x4c6901['as'],'attributes':_0x4c6901[_0x431b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x431b('0x24')](function(_0xb20d8d){logger[_0x431b('0x15')](_0x431b('0x22'),_0x382beb);logger[_0x431b('0xf')](_0x431b('0x22'),_0x382beb,JSON[_0x431b('0x11')](_0xb20d8d));_0x5a2365(_0xb20d8d);})[_0x431b('0x25')](function(_0x37d771){logger[_0x431b('0x12')](_0x431b('0x22'),_0x37d771[_0x431b('0x14')],_0x382beb);_0x5bcf33(_0x5ad291[_0x431b('0x12')](0x1f4,_0x37d771[_0x431b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 102a9a2..c1b5a0b 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 _0xe410=['voiceQueue:','./voiceQueue.events','removeListener','length'];(function(_0x27070a,_0x2d342b){var _0xd2b816=function(_0x58f1c9){while(--_0x58f1c9){_0x27070a['push'](_0x27070a['shift']());}};_0xd2b816(++_0x2d342b);}(_0xe410,0x111));var _0x0e41=function(_0x531cb8,_0x8ef36f){_0x531cb8=_0x531cb8-0x0;var _0x5cf297=_0xe410[_0x531cb8];return _0x5cf297;};'use strict';var VoiceQueueEvents=require(_0x0e41('0x0'));var events=['save','remove','update'];function createListener(_0x4810de,_0x3aa672){return function(_0x3b5e48){_0x3aa672['emit'](_0x4810de,_0x3b5e48);};}function removeListener(_0x28a91d,_0x4acdea){return function(){VoiceQueueEvents[_0x0e41('0x1')](_0x28a91d,_0x4acdea);};}exports['register']=function(_0xe683db){for(var _0x6794ef=0x0,_0x162f51=events[_0x0e41('0x2')];_0x6794ef<_0x162f51;_0x6794ef++){var _0x5a5d8b=events[_0x6794ef];var _0x2429cd=createListener(_0x0e41('0x3')+_0x5a5d8b,_0xe683db);VoiceQueueEvents['on'](_0x5a5d8b,_0x2429cd);}}; \ No newline at end of file +var _0xa503=['register','length','./voiceQueue.events','save','update','emit'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xa503,0x1a0));var _0x3a50=function(_0x5a9b95,_0x1f22e7){_0x5a9b95=_0x5a9b95-0x0;var _0x529b98=_0xa503[_0x5a9b95];return _0x529b98;};'use strict';var VoiceQueueEvents=require(_0x3a50('0x0'));var events=[_0x3a50('0x1'),'remove',_0x3a50('0x2')];function createListener(_0xb52710,_0x1d67f7){return function(_0x37a51c){_0x1d67f7[_0x3a50('0x3')](_0xb52710,_0x37a51c);};}function removeListener(_0x14cfa9,_0x13f046){return function(){VoiceQueueEvents['removeListener'](_0x14cfa9,_0x13f046);};}exports[_0x3a50('0x4')]=function(_0x4f40d8){for(var _0x5e573e=0x0,_0x4eeee1=events[_0x3a50('0x5')];_0x5e573e<_0x4eeee1;_0x5e573e++){var _0x189ca2=events[_0x5e573e];var _0x31edcc=createListener('voiceQueue:'+_0x189ca2,_0x4f40d8);VoiceQueueEvents['on'](_0x189ca2,_0x31edcc);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 0a08aea..ec016bb 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 _0xf608=['update','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','post','create','put'];(function(_0x244b7d,_0x3c8aef){var _0x512ad6=function(_0x31a465){while(--_0x31a465){_0x244b7d['push'](_0x244b7d['shift']());}};_0x512ad6(++_0x3c8aef);}(_0xf608,0x1a4));var _0x8f60=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0xf608[_0x5ca5bc];return _0x26ca86;};'use strict';var multer=require('multer');var util=require(_0x8f60('0x0'));var path=require(_0x8f60('0x1'));var timeout=require(_0x8f60('0x2'));var express=require(_0x8f60('0x3'));var router=express[_0x8f60('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8f60('0x5'));var config=require(_0x8f60('0x6'));var controller=require(_0x8f60('0x7'));router[_0x8f60('0x8')]('/',auth[_0x8f60('0x9')](),controller['index']);router['get']('/describe',auth[_0x8f60('0x9')](),controller[_0x8f60('0xa')]);router[_0x8f60('0x8')](_0x8f60('0xb'),auth[_0x8f60('0x9')](),controller[_0x8f60('0xc')]);router[_0x8f60('0x8')](_0x8f60('0xd'),auth[_0x8f60('0x9')](),controller['show']);router[_0x8f60('0xe')]('/',auth['isAuthenticated'](),controller[_0x8f60('0xf')]);router[_0x8f60('0x10')](_0x8f60('0xd'),auth[_0x8f60('0x9')](),controller[_0x8f60('0x11')]);router[_0x8f60('0x12')](_0x8f60('0xd'),auth[_0x8f60('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3b12=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','getVoiceQueuesReport','/:id','update','delete','multer','connect-timeout'];(function(_0x5463c2,_0x22c4cc){var _0x5a7da7=function(_0x4c16b5){while(--_0x4c16b5){_0x5463c2['push'](_0x5463c2['shift']());}};_0x5a7da7(++_0x22c4cc);}(_0x3b12,0x18e));var _0x23b1=function(_0x40b251,_0x46a241){_0x40b251=_0x40b251-0x0;var _0x4b59b3=_0x3b12[_0x40b251];return _0x4b59b3;};'use strict';var multer=require(_0x23b1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x23b1('0x1'));var express=require(_0x23b1('0x2'));var router=express[_0x23b1('0x3')]();var fs_extra=require(_0x23b1('0x4'));var auth=require(_0x23b1('0x5'));var interaction=require(_0x23b1('0x6'));var config=require(_0x23b1('0x7'));var controller=require(_0x23b1('0x8'));router[_0x23b1('0x9')]('/',auth[_0x23b1('0xa')](),controller['index']);router['get'](_0x23b1('0xb'),auth[_0x23b1('0xa')](),controller['describe']);router['get']('/index',auth[_0x23b1('0xa')](),controller[_0x23b1('0xc')]);router[_0x23b1('0x9')](_0x23b1('0xd'),auth[_0x23b1('0xa')](),controller['show']);router['post']('/',auth[_0x23b1('0xa')](),controller['create']);router['put'](_0x23b1('0xd'),auth[_0x23b1('0xa')](),controller[_0x23b1('0xe')]);router[_0x23b1('0xf')]('/:id',auth[_0x23b1('0xa')](),controller['destroy']);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 c943545..4b8fe63 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 _0xb3c7=['queuecallerjoinAt','format','diff','seconds','setDataValue','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue'];(function(_0x2f26dc,_0x276223){var _0x4402da=function(_0x249d0d){while(--_0x249d0d){_0x2f26dc['push'](_0x2f26dc['shift']());}};_0x4402da(++_0x276223);}(_0xb3c7,0x1d0));var _0x7b3c=function(_0x80068b,_0x3b5c07){_0x80068b=_0x80068b-0x0;var _0x244170=_0xb3c7[_0x80068b];return _0x244170;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x7b3c('0x0')]={'type':{'type':Sequelize[_0x7b3c('0x1')]},'uniqueid':{'type':Sequelize[_0x7b3c('0x1')]},'calleridnum':{'type':Sequelize[_0x7b3c('0x1')]},'calleridname':{'type':Sequelize[_0x7b3c('0x1')]},'queue':{'type':Sequelize[_0x7b3c('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x7b3c('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x7b3c('0x2')],'set':function(_0x2c8da3){var _0x48de3a=moment(_0x2c8da3);var _0x2ff712=moment(this[_0x7b3c('0x3')](_0x7b3c('0x4')))[_0x7b3c('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x254d44=_0x48de3a[_0x7b3c('0x6')](_0x2ff712,_0x7b3c('0x7'));this[_0x7b3c('0x8')]('queuecallerleaveAt',_0x2c8da3);this['setDataValue']('holdtime',_0x254d44||null);}},'position':{'type':Sequelize[_0x7b3c('0x9')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x7b3c('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b3c('0x2')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b3c('0x2')]},'queuecallerexit':{'type':Sequelize[_0x7b3c('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b3c('0x2')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x7b3c('0x1')]},'connectedlinename':{'type':Sequelize[_0x7b3c('0x1')]},'accountcode':{'type':Sequelize[_0x7b3c('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x7b3c('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b3c('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x7b3c('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7b3c('0x1')],'comment':_0x7b3c('0xb')},'transferexten':{'type':Sequelize[_0x7b3c('0x1')]},'transferuniqueid':{'type':Sequelize[_0x7b3c('0x1')]},'disposition':{'type':Sequelize[_0x7b3c('0x1')]},'secondDisposition':{'type':Sequelize[_0x7b3c('0x1')]},'thirdDisposition':{'type':Sequelize[_0x7b3c('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x7b3c('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5c53=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x56e43c,_0x367aed){var _0x1d5454=function(_0x119784){while(--_0x119784){_0x56e43c['push'](_0x56e43c['shift']());}};_0x1d5454(++_0x367aed);}(_0x5c53,0x1a5));var _0x35c5=function(_0x4db78a,_0x1957a7){_0x4db78a=_0x4db78a-0x0;var _0x3afef0=_0x5c53[_0x4db78a];return _0x3afef0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x35c5('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x35c5('0x1')]},'calleridnum':{'type':Sequelize[_0x35c5('0x1')]},'calleridname':{'type':Sequelize[_0x35c5('0x1')]},'queue':{'type':Sequelize[_0x35c5('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x35c5('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x35c5('0x2')],'set':function(_0x4e0ec1){var _0x2ec525=moment(_0x4e0ec1);var _0x2744b4=moment(this[_0x35c5('0x3')](_0x35c5('0x4')))[_0x35c5('0x5')](_0x35c5('0x6'));var _0xccf1de=_0x2ec525[_0x35c5('0x7')](_0x2744b4,_0x35c5('0x8'));this['setDataValue'](_0x35c5('0x9'),_0x4e0ec1);this[_0x35c5('0xa')]('holdtime',_0xccf1de||null);}},'position':{'type':Sequelize[_0x35c5('0xb')]},'count':{'type':Sequelize[_0x35c5('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x35c5('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x35c5('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x35c5('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x35c5('0x2')]},'queuecallerexit':{'type':Sequelize[_0x35c5('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x35c5('0x2')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x35c5('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x35c5('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x35c5('0x1')]},'accountcode':{'type':Sequelize[_0x35c5('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x35c5('0x1')]},'priority':{'type':Sequelize[_0x35c5('0x1')]},'holdtime':{'type':Sequelize[_0x35c5('0xb')]},'mohtime':{'type':Sequelize[_0x35c5('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x35c5('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x35c5('0xe')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x35c5('0x1')]},'disposition':{'type':Sequelize[_0x35c5('0x1')]},'secondDisposition':{'type':Sequelize[_0x35c5('0x1')]},'thirdDisposition':{'type':Sequelize[_0x35c5('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x35c5('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index e438496..49be3d8 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 _0xf643=['jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','index','map','VoiceQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','describe','pick','findAll','rows','getVoiceQueuesReport','eml-format','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto'];(function(_0x5da5a8,_0x1344ec){var _0x454904=function(_0x6c893){while(--_0x6c893){_0x5da5a8['push'](_0x5da5a8['shift']());}};_0x454904(++_0x1344ec);}(_0xf643,0x16d));var _0x3f64=function(_0xf13ca6,_0x5735ea){_0xf13ca6=_0xf13ca6-0x0;var _0x4a4387=_0xf643[_0xf13ca6];return _0x4a4387;};'use strict';var emlformat=require(_0x3f64('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3f64('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x3f64('0x2'));var util=require(_0x3f64('0x3'));var path=require(_0x3f64('0x4'));var sox=require(_0x3f64('0x5'));var csv=require(_0x3f64('0x6'));var ejs=require(_0x3f64('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f64('0x8'));var squel=require('squel');var crypto=require(_0x3f64('0x9'));var jsforce=require(_0x3f64('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3f64('0x6'));var querystring=require(_0x3f64('0xb'));var Papa=require(_0x3f64('0xc'));var Redis=require(_0x3f64('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3f64('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f64('0xf'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3f64('0x10')]=_[_0x3f64('0x11')](config[_0x3f64('0x10')],{'host':_0x3f64('0x12'),'port':0x18eb});var socket=require(_0x3f64('0x13'))(new Redis(config[_0x3f64('0x10')]));require(_0x3f64('0x14'))[_0x3f64('0x15')](socket);function respondWithStatusCode(_0x59ce65,_0xea1d78){_0xea1d78=_0xea1d78||0xcc;return function(_0x42d1c1){if(_0x42d1c1){return _0x59ce65[_0x3f64('0x16')](_0xea1d78);}return _0x59ce65[_0x3f64('0x17')](_0xea1d78)['end']();};}function respondWithResult(_0x41f07f,_0x3e010e){_0x3e010e=_0x3e010e||0xc8;return function(_0x237808){if(_0x237808){return _0x41f07f[_0x3f64('0x17')](_0x3e010e)['json'](_0x237808);}};}function respondWithFilteredResult(_0x3497dc,_0x434011){return function(_0x488a4f){if(_0x488a4f){var _0x488422=typeof _0x434011[_0x3f64('0x18')]==='undefined'&&typeof _0x434011[_0x3f64('0x19')]===_0x3f64('0x1a');var _0x55d02b=_0x488a4f[_0x3f64('0x1b')];var _0x4b1ce0=_0x488422?0x0:_0x434011[_0x3f64('0x18')];var _0x3d6e4e=_0x488422?_0x488a4f[_0x3f64('0x1b')]:_0x434011[_0x3f64('0x18')]+_0x434011[_0x3f64('0x19')];var _0x483d32;if(_0x3d6e4e>=_0x55d02b){_0x3d6e4e=_0x55d02b;_0x483d32=0xc8;}else{_0x483d32=0xce;}_0x3497dc[_0x3f64('0x17')](_0x483d32);return _0x3497dc['set'](_0x3f64('0x1c'),_0x4b1ce0+'-'+_0x3d6e4e+'/'+_0x55d02b)[_0x3f64('0x1d')](_0x488a4f);}return null;};}function patchUpdates(_0x1d27e1){return function(_0x427e6c){try{jsonpatch['apply'](_0x427e6c,_0x1d27e1,!![]);}catch(_0x48a89e){return BPromise[_0x3f64('0x1e')](_0x48a89e);}return _0x427e6c[_0x3f64('0x1f')]();};}function saveUpdates(_0x21088b,_0x4e99bd){return function(_0xf77f74){if(_0xf77f74){return _0xf77f74[_0x3f64('0x20')](_0x21088b)[_0x3f64('0x21')](function(_0x3fa45b){return _0x3fa45b;});}return null;};}function removeEntity(_0x2423dd,_0x19453d){return function(_0x24fe0e){if(_0x24fe0e){return _0x24fe0e[_0x3f64('0x22')]()[_0x3f64('0x21')](function(){_0x2423dd[_0x3f64('0x17')](0xcc)[_0x3f64('0x23')]();});}};}function handleEntityNotFound(_0x4e4d7a,_0xa8ddec){return function(_0x52140b){if(!_0x52140b){_0x4e4d7a[_0x3f64('0x16')](0x194);}return _0x52140b;};}function handleError(_0xe528e1,_0x5820fa){_0x5820fa=_0x5820fa||0x1f4;return function(_0x243de3){logger[_0x3f64('0x24')](_0x243de3[_0x3f64('0x25')]);if(_0x243de3['name']){delete _0x243de3[_0x3f64('0x26')];}_0xe528e1[_0x3f64('0x17')](_0x5820fa)['send'](_0x243de3);};}exports[_0x3f64('0x27')]=function(_0x572bf1,_0x1cbe24){var _0x1bf29b={},_0x5e61fa={},_0x4d8873={'count':0x0,'rows':[]};var _0x403fd4=_[_0x3f64('0x28')](db[_0x3f64('0x29')][_0x3f64('0x2a')],function(_0xac054b){return{'name':_0xac054b[_0x3f64('0x2b')],'type':_0xac054b[_0x3f64('0x2c')]['key']};});_0x5e61fa[_0x3f64('0x2d')]=_[_0x3f64('0x28')](_0x403fd4,_0x3f64('0x26'));_0x5e61fa[_0x3f64('0x2e')]=_[_0x3f64('0x2f')](_0x572bf1['query']);_0x5e61fa[_0x3f64('0x30')]=_[_0x3f64('0x31')](_0x5e61fa[_0x3f64('0x2d')],_0x5e61fa[_0x3f64('0x2e')]);_0x1bf29b['attributes']=_[_0x3f64('0x31')](_0x5e61fa[_0x3f64('0x2d')],qs[_0x3f64('0x32')](_0x572bf1[_0x3f64('0x2e')][_0x3f64('0x32')]));_0x1bf29b['attributes']=_0x1bf29b[_0x3f64('0x33')][_0x3f64('0x34')]?_0x1bf29b[_0x3f64('0x33')]:_0x5e61fa[_0x3f64('0x2d')];if(!_0x572bf1[_0x3f64('0x2e')][_0x3f64('0x35')](_0x3f64('0x36'))){_0x1bf29b['limit']=qs[_0x3f64('0x19')](_0x572bf1[_0x3f64('0x2e')][_0x3f64('0x19')]);_0x1bf29b[_0x3f64('0x18')]=qs['offset'](_0x572bf1[_0x3f64('0x2e')]['offset']);}_0x1bf29b[_0x3f64('0x37')]=qs[_0x3f64('0x38')](_0x572bf1[_0x3f64('0x2e')][_0x3f64('0x38')]);_0x1bf29b['where']=qs[_0x3f64('0x30')](_['pick'](_0x572bf1[_0x3f64('0x2e')],_0x5e61fa[_0x3f64('0x30')]),_0x403fd4);if(_0x572bf1[_0x3f64('0x2e')][_0x3f64('0x39')]){_0x1bf29b[_0x3f64('0x3a')]=_[_0x3f64('0x3b')](_0x1bf29b[_0x3f64('0x3a')],{'$or':_[_0x3f64('0x28')](_0x403fd4,function(_0x55dfc0){if(_0x55dfc0[_0x3f64('0x2c')]!==_0x3f64('0x3c')){var _0x9d2a3d={};_0x9d2a3d[_0x55dfc0[_0x3f64('0x26')]]={'$like':'%'+_0x572bf1[_0x3f64('0x2e')]['filter']+'%'};return _0x9d2a3d;}})});}_0x1bf29b=_[_0x3f64('0x3b')]({},_0x1bf29b,_0x572bf1[_0x3f64('0x3d')]);var _0x12b92b={'where':_0x1bf29b[_0x3f64('0x3a')]};return db[_0x3f64('0x29')][_0x3f64('0x1b')](_0x12b92b)['then'](function(_0x165e17){_0x4d8873['count']=_0x165e17;if(_0x572bf1[_0x3f64('0x2e')]['includeAll']){_0x1bf29b[_0x3f64('0x3e')]=[{'all':!![]}];}return db[_0x3f64('0x29')]['findAll'](_0x1bf29b);})['then'](function(_0x5dabab){_0x4d8873['rows']=_0x5dabab;return _0x4d8873;})[_0x3f64('0x21')](respondWithFilteredResult(_0x1cbe24,_0x1bf29b))[_0x3f64('0x3f')](handleError(_0x1cbe24,null));};exports[_0x3f64('0x40')]=function(_0x22606d,_0x5946cd){var _0x3d3dbf={'raw':![],'where':{'id':_0x22606d[_0x3f64('0x41')]['id']}},_0x55db81={};_0x55db81[_0x3f64('0x2d')]=_[_0x3f64('0x2f')](db[_0x3f64('0x29')]['rawAttributes']);_0x55db81['query']=_['keys'](_0x22606d['query']);_0x55db81[_0x3f64('0x30')]=_[_0x3f64('0x31')](_0x55db81[_0x3f64('0x2d')],_0x55db81[_0x3f64('0x2e')]);_0x3d3dbf[_0x3f64('0x33')]=_[_0x3f64('0x31')](_0x55db81['model'],qs[_0x3f64('0x32')](_0x22606d['query']['fields']));_0x3d3dbf[_0x3f64('0x33')]=_0x3d3dbf[_0x3f64('0x33')][_0x3f64('0x34')]?_0x3d3dbf['attributes']:_0x55db81[_0x3f64('0x2d')];if(_0x22606d[_0x3f64('0x2e')][_0x3f64('0x42')]){_0x3d3dbf[_0x3f64('0x3e')]=[{'all':!![]}];}_0x3d3dbf=_[_0x3f64('0x3b')]({},_0x3d3dbf,_0x22606d[_0x3f64('0x3d')]);return db[_0x3f64('0x29')][_0x3f64('0x43')](_0x3d3dbf)[_0x3f64('0x21')](handleEntityNotFound(_0x5946cd,null))[_0x3f64('0x21')](respondWithResult(_0x5946cd,null))[_0x3f64('0x3f')](handleError(_0x5946cd,null));};exports[_0x3f64('0x44')]=function(_0x228771,_0x47cfc2){return db['VoiceQueueReport']['create'](_0x228771[_0x3f64('0x45')],{})['then'](respondWithResult(_0x47cfc2,0xc9))[_0x3f64('0x3f')](handleError(_0x47cfc2,null));};exports[_0x3f64('0x20')]=function(_0x89935a,_0x4fd09a){if(_0x89935a[_0x3f64('0x45')]['id']){delete _0x89935a['body']['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x89935a[_0x3f64('0x41')]['id']}})['then'](handleEntityNotFound(_0x4fd09a,null))[_0x3f64('0x21')](saveUpdates(_0x89935a[_0x3f64('0x45')],null))[_0x3f64('0x21')](respondWithResult(_0x4fd09a,null))[_0x3f64('0x3f')](handleError(_0x4fd09a,null));};exports['destroy']=function(_0x25b487,_0x266cab){return db[_0x3f64('0x29')]['find']({'where':{'id':_0x25b487[_0x3f64('0x41')]['id']}})['then'](handleEntityNotFound(_0x266cab,null))[_0x3f64('0x21')](removeEntity(_0x266cab,null))[_0x3f64('0x3f')](handleError(_0x266cab,null));};exports['describe']=function(_0x2cdd4a,_0x1049cc){return db['VoiceQueueReport'][_0x3f64('0x46')]()[_0x3f64('0x21')](respondWithResult(_0x1049cc,null))[_0x3f64('0x3f')](handleError(_0x1049cc,null));};exports['getVoiceQueuesReport']=function(_0x59f946,_0x2fcf24){var _0x20bfd4={},_0x16b11f={},_0x591a66={'count':0x0,'rows':[]};_0x16b11f['model']=_['keys'](db[_0x3f64('0x29')]['rawAttributes']);_0x16b11f[_0x3f64('0x2e')]=_[_0x3f64('0x2f')](_0x59f946[_0x3f64('0x2e')]);_0x16b11f['filters']=_['intersection'](_0x16b11f['model'],_0x16b11f['query']);_0x20bfd4[_0x3f64('0x33')]=_[_0x3f64('0x31')](_0x16b11f[_0x3f64('0x2d')],qs['fields'](_0x59f946['query']['fields']));_0x20bfd4[_0x3f64('0x33')]=_0x20bfd4[_0x3f64('0x33')][_0x3f64('0x34')]?_0x20bfd4['attributes']:_0x16b11f[_0x3f64('0x2d')];if(!_0x59f946[_0x3f64('0x2e')][_0x3f64('0x35')](_0x3f64('0x36'))){_0x20bfd4[_0x3f64('0x19')]=qs[_0x3f64('0x19')](_0x59f946[_0x3f64('0x2e')][_0x3f64('0x19')]);_0x20bfd4['offset']=qs[_0x3f64('0x18')](_0x59f946[_0x3f64('0x2e')][_0x3f64('0x18')]);}_0x20bfd4[_0x3f64('0x37')]=qs[_0x3f64('0x38')](_0x59f946[_0x3f64('0x2e')]['sort']);_0x20bfd4[_0x3f64('0x3a')]=qs[_0x3f64('0x30')](_[_0x3f64('0x47')](_0x59f946[_0x3f64('0x2e')],_0x16b11f[_0x3f64('0x30')]));if(_0x59f946[_0x3f64('0x2e')][_0x3f64('0x39')]){_0x20bfd4[_0x3f64('0x3a')]=_['merge'](_0x20bfd4['where'],{'$or':_[_0x3f64('0x28')](_0x20bfd4['attributes'],function(_0x2f8674){var _0x18cb54={};_0x18cb54[_0x2f8674]={'$like':'%'+_0x59f946['query'][_0x3f64('0x39')]+'%'};return _0x18cb54;})});}_0x20bfd4=_[_0x3f64('0x3b')]({},_0x20bfd4,_0x59f946[_0x3f64('0x3d')]);var _0x548c48={'where':_0x20bfd4[_0x3f64('0x3a')]};return db['VoiceQueueReport'][_0x3f64('0x1b')](_0x548c48)[_0x3f64('0x21')](function(_0x28a837){_0x591a66[_0x3f64('0x1b')]=_0x28a837;if(_0x59f946[_0x3f64('0x2e')][_0x3f64('0x42')]){_0x20bfd4[_0x3f64('0x3e')]=[{'all':!![]}];}return db[_0x3f64('0x29')][_0x3f64('0x48')](_0x20bfd4);})[_0x3f64('0x21')](function(_0x4dd119){_0x591a66[_0x3f64('0x49')]=_0x4dd119;return _0x591a66;})[_0x3f64('0x21')](respondWithFilteredResult(_0x2fcf24,_0x20bfd4,_0x3f64('0x4a')))[_0x3f64('0x3f')](handleError(_0x2fcf24,null,_0x3f64('0x4a')));}; \ No newline at end of file +var _0xb7b7=['defaults','localhost','socket.io-emitter','register','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','VoiceQueueReport','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','find','describe','getVoiceQueuesReport','keys','hasOwnProperty','order','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7b7,0x90));var _0x7b7b=function(_0x7f73a6,_0x2ed93b){_0x7f73a6=_0x7f73a6-0x0;var _0x1fde25=_0xb7b7[_0x7f73a6];return _0x1fde25;};'use strict';var emlformat=require(_0x7b7b('0x0'));var rimraf=require(_0x7b7b('0x1'));var zipdir=require(_0x7b7b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b7b('0x3'));var moment=require(_0x7b7b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7b7b('0x5'));var util=require(_0x7b7b('0x6'));var path=require(_0x7b7b('0x7'));var sox=require(_0x7b7b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b7b('0x9'));var _=require(_0x7b7b('0xa'));var squel=require(_0x7b7b('0xb'));var crypto=require(_0x7b7b('0xc'));var jsforce=require(_0x7b7b('0xd'));var deskjs=require(_0x7b7b('0xe'));var toCsv=require(_0x7b7b('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7b7b('0x10'));var authService=require(_0x7b7b('0x11'));var qs=require(_0x7b7b('0x12'));var as=require(_0x7b7b('0x13'));var hardwareService=require(_0x7b7b('0x14'));var logger=require('../../config/logger')(_0x7b7b('0x15'));var utils=require(_0x7b7b('0x16'));var config=require(_0x7b7b('0x17'));var licenseUtil=require(_0x7b7b('0x18'));var db=require('../../mysqldb')['db'];config[_0x7b7b('0x19')]=_[_0x7b7b('0x1a')](config[_0x7b7b('0x19')],{'host':_0x7b7b('0x1b'),'port':0x18eb});var socket=require(_0x7b7b('0x1c'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x7b7b('0x1d')](socket);function respondWithStatusCode(_0x4884d7,_0x3043fe){_0x3043fe=_0x3043fe||0xcc;return function(_0x59bc04){if(_0x59bc04){return _0x4884d7['sendStatus'](_0x3043fe);}return _0x4884d7['status'](_0x3043fe)[_0x7b7b('0x1e')]();};}function respondWithResult(_0x159daa,_0x29e14f){_0x29e14f=_0x29e14f||0xc8;return function(_0x3576b6){if(_0x3576b6){return _0x159daa[_0x7b7b('0x1f')](_0x29e14f)[_0x7b7b('0x20')](_0x3576b6);}};}function respondWithFilteredResult(_0xef57bf,_0x2b8aca){return function(_0x4fbbb5){if(_0x4fbbb5){var _0x5ba7d8=typeof _0x2b8aca['offset']===_0x7b7b('0x21')&&typeof _0x2b8aca[_0x7b7b('0x22')]===_0x7b7b('0x21');var _0x513593=_0x4fbbb5[_0x7b7b('0x23')];var _0x5aad7e=_0x5ba7d8?0x0:_0x2b8aca[_0x7b7b('0x24')];var _0x5beae0=_0x5ba7d8?_0x4fbbb5['count']:_0x2b8aca[_0x7b7b('0x24')]+_0x2b8aca[_0x7b7b('0x22')];var _0x19ca79;if(_0x5beae0>=_0x513593){_0x5beae0=_0x513593;_0x19ca79=0xc8;}else{_0x19ca79=0xce;}_0xef57bf['status'](_0x19ca79);return _0xef57bf[_0x7b7b('0x25')](_0x7b7b('0x26'),_0x5aad7e+'-'+_0x5beae0+'/'+_0x513593)[_0x7b7b('0x20')](_0x4fbbb5);}return null;};}function patchUpdates(_0x197103){return function(_0x1b7cae){try{jsonpatch[_0x7b7b('0x27')](_0x1b7cae,_0x197103,!![]);}catch(_0x39d454){return BPromise[_0x7b7b('0x28')](_0x39d454);}return _0x1b7cae[_0x7b7b('0x29')]();};}function saveUpdates(_0x1d75c8,_0x2bef64){return function(_0x30ed72){if(_0x30ed72){return _0x30ed72[_0x7b7b('0x2a')](_0x1d75c8)[_0x7b7b('0x2b')](function(_0x4e3310){return _0x4e3310;});}return null;};}function removeEntity(_0x2680b9,_0x37a787){return function(_0xa5693b){if(_0xa5693b){return _0xa5693b[_0x7b7b('0x2c')]()[_0x7b7b('0x2b')](function(){_0x2680b9[_0x7b7b('0x1f')](0xcc)[_0x7b7b('0x1e')]();});}};}function handleEntityNotFound(_0x121601,_0x3e24e3){return function(_0x4df415){if(!_0x4df415){_0x121601[_0x7b7b('0x2d')](0x194);}return _0x4df415;};}function handleError(_0xf88159,_0x2ad4ea){_0x2ad4ea=_0x2ad4ea||0x1f4;return function(_0xf68a74){logger['error'](_0xf68a74[_0x7b7b('0x2e')]);if(_0xf68a74[_0x7b7b('0x2f')]){delete _0xf68a74[_0x7b7b('0x2f')];}_0xf88159[_0x7b7b('0x1f')](_0x2ad4ea)[_0x7b7b('0x30')](_0xf68a74);};}exports['index']=function(_0x1bef0c,_0xb5f6ed){var _0x25b87c={},_0x21b9f9={},_0x85392a={'count':0x0,'rows':[]};var _0x51520b=_[_0x7b7b('0x31')](db[_0x7b7b('0x32')]['rawAttributes'],function(_0x311685){return{'name':_0x311685[_0x7b7b('0x33')],'type':_0x311685[_0x7b7b('0x34')][_0x7b7b('0x35')]};});_0x21b9f9[_0x7b7b('0x36')]=_[_0x7b7b('0x31')](_0x51520b,'name');_0x21b9f9[_0x7b7b('0x37')]=_['keys'](_0x1bef0c[_0x7b7b('0x37')]);_0x21b9f9['filters']=_[_0x7b7b('0x38')](_0x21b9f9[_0x7b7b('0x36')],_0x21b9f9[_0x7b7b('0x37')]);_0x25b87c[_0x7b7b('0x39')]=_['intersection'](_0x21b9f9['model'],qs[_0x7b7b('0x3a')](_0x1bef0c['query'][_0x7b7b('0x3a')]));_0x25b87c[_0x7b7b('0x39')]=_0x25b87c[_0x7b7b('0x39')][_0x7b7b('0x3b')]?_0x25b87c['attributes']:_0x21b9f9['model'];if(!_0x1bef0c[_0x7b7b('0x37')]['hasOwnProperty'](_0x7b7b('0x3c'))){_0x25b87c[_0x7b7b('0x22')]=qs[_0x7b7b('0x22')](_0x1bef0c[_0x7b7b('0x37')][_0x7b7b('0x22')]);_0x25b87c['offset']=qs[_0x7b7b('0x24')](_0x1bef0c[_0x7b7b('0x37')][_0x7b7b('0x24')]);}_0x25b87c['order']=qs[_0x7b7b('0x3d')](_0x1bef0c[_0x7b7b('0x37')][_0x7b7b('0x3d')]);_0x25b87c[_0x7b7b('0x3e')]=qs[_0x7b7b('0x3f')](_[_0x7b7b('0x40')](_0x1bef0c[_0x7b7b('0x37')],_0x21b9f9[_0x7b7b('0x3f')]),_0x51520b);if(_0x1bef0c[_0x7b7b('0x37')][_0x7b7b('0x41')]){_0x25b87c[_0x7b7b('0x3e')]=_[_0x7b7b('0x42')](_0x25b87c[_0x7b7b('0x3e')],{'$or':_['map'](_0x51520b,function(_0x2bcaaa){if(_0x2bcaaa['type']!==_0x7b7b('0x43')){var _0x2ef6f0={};_0x2ef6f0[_0x2bcaaa[_0x7b7b('0x2f')]]={'$like':'%'+_0x1bef0c[_0x7b7b('0x37')][_0x7b7b('0x41')]+'%'};return _0x2ef6f0;}})});}_0x25b87c=_[_0x7b7b('0x42')]({},_0x25b87c,_0x1bef0c[_0x7b7b('0x44')]);var _0x2d9ac8={'where':_0x25b87c[_0x7b7b('0x3e')]};return db[_0x7b7b('0x32')][_0x7b7b('0x23')](_0x2d9ac8)['then'](function(_0x31213d){_0x85392a[_0x7b7b('0x23')]=_0x31213d;if(_0x1bef0c['query'][_0x7b7b('0x45')]){_0x25b87c[_0x7b7b('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x7b7b('0x47')](_0x25b87c);})[_0x7b7b('0x2b')](function(_0x3e7ffe){_0x85392a[_0x7b7b('0x48')]=_0x3e7ffe;return _0x85392a;})[_0x7b7b('0x2b')](respondWithFilteredResult(_0xb5f6ed,_0x25b87c))['catch'](handleError(_0xb5f6ed,null));};exports[_0x7b7b('0x49')]=function(_0x51896d,_0x8d7b96){var _0x224db6={'raw':![],'where':{'id':_0x51896d[_0x7b7b('0x4a')]['id']}},_0x5ebd4b={};_0x5ebd4b[_0x7b7b('0x36')]=_['keys'](db['VoiceQueueReport'][_0x7b7b('0x4b')]);_0x5ebd4b['query']=_['keys'](_0x51896d[_0x7b7b('0x37')]);_0x5ebd4b[_0x7b7b('0x3f')]=_['intersection'](_0x5ebd4b[_0x7b7b('0x36')],_0x5ebd4b['query']);_0x224db6[_0x7b7b('0x39')]=_[_0x7b7b('0x38')](_0x5ebd4b['model'],qs[_0x7b7b('0x3a')](_0x51896d['query'][_0x7b7b('0x3a')]));_0x224db6['attributes']=_0x224db6[_0x7b7b('0x39')][_0x7b7b('0x3b')]?_0x224db6[_0x7b7b('0x39')]:_0x5ebd4b[_0x7b7b('0x36')];if(_0x51896d[_0x7b7b('0x37')][_0x7b7b('0x45')]){_0x224db6[_0x7b7b('0x46')]=[{'all':!![]}];}_0x224db6=_[_0x7b7b('0x42')]({},_0x224db6,_0x51896d[_0x7b7b('0x44')]);return db[_0x7b7b('0x32')]['find'](_0x224db6)[_0x7b7b('0x2b')](handleEntityNotFound(_0x8d7b96,null))[_0x7b7b('0x2b')](respondWithResult(_0x8d7b96,null))[_0x7b7b('0x4c')](handleError(_0x8d7b96,null));};exports[_0x7b7b('0x4d')]=function(_0x1cb80b,_0x408789){return db[_0x7b7b('0x32')][_0x7b7b('0x4d')](_0x1cb80b[_0x7b7b('0x4e')],{})['then'](respondWithResult(_0x408789,0xc9))[_0x7b7b('0x4c')](handleError(_0x408789,null));};exports['update']=function(_0x707aaf,_0x2aa095){if(_0x707aaf['body']['id']){delete _0x707aaf['body']['id'];}return db[_0x7b7b('0x32')][_0x7b7b('0x4f')]({'where':{'id':_0x707aaf[_0x7b7b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2aa095,null))[_0x7b7b('0x2b')](saveUpdates(_0x707aaf['body'],null))[_0x7b7b('0x2b')](respondWithResult(_0x2aa095,null))[_0x7b7b('0x4c')](handleError(_0x2aa095,null));};exports[_0x7b7b('0x2c')]=function(_0x2e141f,_0x554935){return db[_0x7b7b('0x32')][_0x7b7b('0x4f')]({'where':{'id':_0x2e141f[_0x7b7b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x554935,null))[_0x7b7b('0x2b')](removeEntity(_0x554935,null))[_0x7b7b('0x4c')](handleError(_0x554935,null));};exports[_0x7b7b('0x50')]=function(_0x5272b6,_0x4ef2e7){return db[_0x7b7b('0x32')][_0x7b7b('0x50')]()['then'](respondWithResult(_0x4ef2e7,null))['catch'](handleError(_0x4ef2e7,null));};exports[_0x7b7b('0x51')]=function(_0x180e1b,_0x2e386d){var _0x485982={},_0x1cdb5a={},_0x57311a={'count':0x0,'rows':[]};_0x1cdb5a[_0x7b7b('0x36')]=_['keys'](db[_0x7b7b('0x32')][_0x7b7b('0x4b')]);_0x1cdb5a[_0x7b7b('0x37')]=_[_0x7b7b('0x52')](_0x180e1b[_0x7b7b('0x37')]);_0x1cdb5a[_0x7b7b('0x3f')]=_[_0x7b7b('0x38')](_0x1cdb5a[_0x7b7b('0x36')],_0x1cdb5a['query']);_0x485982['attributes']=_[_0x7b7b('0x38')](_0x1cdb5a[_0x7b7b('0x36')],qs[_0x7b7b('0x3a')](_0x180e1b[_0x7b7b('0x37')]['fields']));_0x485982[_0x7b7b('0x39')]=_0x485982[_0x7b7b('0x39')]['length']?_0x485982[_0x7b7b('0x39')]:_0x1cdb5a[_0x7b7b('0x36')];if(!_0x180e1b[_0x7b7b('0x37')][_0x7b7b('0x53')](_0x7b7b('0x3c'))){_0x485982[_0x7b7b('0x22')]=qs[_0x7b7b('0x22')](_0x180e1b[_0x7b7b('0x37')][_0x7b7b('0x22')]);_0x485982[_0x7b7b('0x24')]=qs[_0x7b7b('0x24')](_0x180e1b[_0x7b7b('0x37')][_0x7b7b('0x24')]);}_0x485982[_0x7b7b('0x54')]=qs[_0x7b7b('0x3d')](_0x180e1b[_0x7b7b('0x37')][_0x7b7b('0x3d')]);_0x485982[_0x7b7b('0x3e')]=qs[_0x7b7b('0x3f')](_[_0x7b7b('0x40')](_0x180e1b[_0x7b7b('0x37')],_0x1cdb5a[_0x7b7b('0x3f')]));if(_0x180e1b[_0x7b7b('0x37')][_0x7b7b('0x41')]){_0x485982['where']=_[_0x7b7b('0x42')](_0x485982[_0x7b7b('0x3e')],{'$or':_[_0x7b7b('0x31')](_0x485982['attributes'],function(_0x3ac2c0){var _0x3c991a={};_0x3c991a[_0x3ac2c0]={'$like':'%'+_0x180e1b['query'][_0x7b7b('0x41')]+'%'};return _0x3c991a;})});}_0x485982=_[_0x7b7b('0x42')]({},_0x485982,_0x180e1b[_0x7b7b('0x44')]);var _0x17be46={'where':_0x485982[_0x7b7b('0x3e')]};return db[_0x7b7b('0x32')][_0x7b7b('0x23')](_0x17be46)['then'](function(_0x134965){_0x57311a['count']=_0x134965;if(_0x180e1b[_0x7b7b('0x37')][_0x7b7b('0x45')]){_0x485982[_0x7b7b('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x485982);})[_0x7b7b('0x2b')](function(_0x384bf5){_0x57311a[_0x7b7b('0x48')]=_0x384bf5;return _0x57311a;})[_0x7b7b('0x2b')](respondWithFilteredResult(_0x2e386d,_0x485982,_0x7b7b('0x51')))['catch'](handleError(_0x2e386d,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 42c5d43..b19a159 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 _0xe4cf=['hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xe4cf,0xad));var _0xfe4c=function(_0x264040,_0x4f456a){_0x264040=_0x264040-0x0;var _0xc0f19d=_0xe4cf[_0x264040];return _0xc0f19d;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xfe4c('0x0'))['db'][_0xfe4c('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xfe4c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfe4c('0x3'),'afterDestroy':_0xfe4c('0x4')};function emitEvent(_0x18adba){return function(_0xca8628,_0x40e351,_0x1ba093){VoiceQueueReportEvents[_0xfe4c('0x5')](_0x18adba+':'+_0xca8628['id'],_0xca8628);VoiceQueueReportEvents[_0xfe4c('0x5')](_0x18adba,_0xca8628);_0x1ba093(null);};}for(var e in events){if(events[_0xfe4c('0x6')](e)){var event=events[e];VoiceQueueReport[_0xfe4c('0x7')](e,emitEvent(event));}}module[_0xfe4c('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xda2c=['hook','exports','events','../../mysqldb','VoiceQueueReport','save','update','remove','emit','hasOwnProperty'];(function(_0x422a93,_0x540628){var _0x8a46f9=function(_0x2e0918){while(--_0x2e0918){_0x422a93['push'](_0x422a93['shift']());}};_0x8a46f9(++_0x540628);}(_0xda2c,0x156));var _0xcda2=function(_0xd49573,_0x189033){_0xd49573=_0xd49573-0x0;var _0x53d48e=_0xda2c[_0xd49573];return _0x53d48e;};'use strict';var EventEmitter=require(_0xcda2('0x0'));var VoiceQueueReport=require(_0xcda2('0x1'))['db'][_0xcda2('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcda2('0x3'),'afterUpdate':_0xcda2('0x4'),'afterDestroy':_0xcda2('0x5')};function emitEvent(_0x122add){return function(_0x5e954b,_0xdf609e,_0x2bc408){VoiceQueueReportEvents[_0xcda2('0x6')](_0x122add+':'+_0x5e954b['id'],_0x5e954b);VoiceQueueReportEvents[_0xcda2('0x6')](_0x122add,_0x5e954b);_0x2bc408(null);};}for(var e in events){if(events[_0xcda2('0x7')](e)){var event=events[e];VoiceQueueReport[_0xcda2('0x8')](e,emitEvent(event));}}module[_0xcda2('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 19936ec..81e2dbf 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 _0xadfd=['api','request-promise','path','rimraf','../../config/environment','define','VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x5711ff,_0xbea17d){var _0x553492=function(_0x1236df){while(--_0x1236df){_0x5711ff['push'](_0x5711ff['shift']());}};_0x553492(++_0xbea17d);}(_0xadfd,0x1c5));var _0xdadf=function(_0x2b21b1,_0x47e5a8){_0x2b21b1=_0x2b21b1-0x0;var _0x2c39ab=_0xadfd[_0x2b21b1];return _0x2c39ab;};'use strict';var _=require(_0xdadf('0x0'));var util=require(_0xdadf('0x1'));var logger=require(_0xdadf('0x2'))(_0xdadf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdadf('0x4'));var fs=require('fs');var path=require(_0xdadf('0x5'));var rimraf=require(_0xdadf('0x6'));var config=require(_0xdadf('0x7'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x364cfd,_0x5e9ecf){return _0x364cfd[_0xdadf('0x8')](_0xdadf('0x9'),attributes,{'tableName':_0xdadf('0xa'),'paranoid':![],'indexes':[{'fields':[_0xdadf('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ee9=['exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','moment','path','./voiceQueueReport.attributes'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0x4ee9,0x1c8));var _0x94ee=function(_0x3a596c,_0x1cf3e3){_0x3a596c=_0x3a596c-0x0;var _0x18dc7a=_0x4ee9[_0x3a596c];return _0x18dc7a;};'use strict';var _=require(_0x94ee('0x0'));var util=require(_0x94ee('0x1'));var logger=require(_0x94ee('0x2'))('api');var moment=require(_0x94ee('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x94ee('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x94ee('0x5'));module[_0x94ee('0x6')]=function(_0x15bc2e,_0x38d7db){return _0x15bc2e['define'](_0x94ee('0x7'),attributes,{'tableName':_0x94ee('0x8'),'paranoid':![],'indexes':[{'fields':[_0x94ee('0x9')]},{'fields':[_0x94ee('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index f2c3387..aa6d333 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 _0x58ef=['UpdateVoiceQueueReport','update','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','raw','options','where','attributes','limit','map','include','model','then','stringify','CreateVoiceQueueReport','create','body'];(function(_0x1b3d6e,_0x1c2f20){var _0x62b1eb=function(_0xfd9359){while(--_0xfd9359){_0x1b3d6e['push'](_0x1b3d6e['shift']());}};_0x62b1eb(++_0x1c2f20);}(_0x58ef,0x116));var _0xf58e=function(_0x2f2765,_0x4f291c){_0x2f2765=_0x2f2765-0x0;var _0x3730ce=_0x58ef[_0x2f2765];return _0x3730ce;};'use strict';var _=require(_0xf58e('0x0'));var util=require(_0xf58e('0x1'));var moment=require('moment');var BPromise=require(_0xf58e('0x2'));var rs=require(_0xf58e('0x3'));var fs=require('fs');var Redis=require(_0xf58e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf58e('0x5'));var logger=require(_0xf58e('0x6'))(_0xf58e('0x7'));var config=require(_0xf58e('0x8'));var jayson=require(_0xf58e('0x9'));var client=jayson[_0xf58e('0xa')]['http']({'port':0x232a});config[_0xf58e('0xb')]=_[_0xf58e('0xc')](config[_0xf58e('0xb')],{'host':_0xf58e('0xd'),'port':0x18eb});var socket=require(_0xf58e('0xe'))(new Redis(config[_0xf58e('0xb')]));require(_0xf58e('0xf'))[_0xf58e('0x10')](socket);function respondWithRpcPromise(_0x1d20e6,_0x555cc6,_0x3e970c){return new BPromise(function(_0x35a979,_0x4f74e8){return client[_0xf58e('0x11')](_0x1d20e6,_0x3e970c)['then'](function(_0x363cc4){logger[_0xf58e('0x12')](_0xf58e('0x13'),_0x555cc6,_0xf58e('0x14'));logger[_0xf58e('0x15')](_0xf58e('0x16'),_0x555cc6,_0xf58e('0x14'),JSON['stringify'](_0x363cc4));if(_0x363cc4[_0xf58e('0x17')]){if(_0x363cc4['error'][_0xf58e('0x18')]===0x1f4){logger[_0xf58e('0x17')](_0xf58e('0x13'),_0x555cc6,_0x363cc4[_0xf58e('0x17')][_0xf58e('0x19')]);return _0x4f74e8(_0x363cc4[_0xf58e('0x17')][_0xf58e('0x19')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x555cc6,_0x363cc4[_0xf58e('0x17')][_0xf58e('0x19')]);return _0x35a979(_0x363cc4['error']['message']);}else{logger[_0xf58e('0x12')](_0xf58e('0x13'),_0x555cc6,_0xf58e('0x14'));_0x35a979(_0x363cc4[_0xf58e('0x1a')][_0xf58e('0x19')]);}})[_0xf58e('0x1b')](function(_0x61ce8d){logger[_0xf58e('0x17')](_0xf58e('0x13'),_0x555cc6,_0x61ce8d);_0x4f74e8(_0x61ce8d);});});}exports[_0xf58e('0x1c')]=function(_0x2d7567){var _0x3bbf31=this;return new Promise(function(_0x5741ab,_0x8254ac){return db[_0xf58e('0x1d')][_0xf58e('0x1e')]({'raw':_0x2d7567['options']?_0x2d7567['options'][_0xf58e('0x1f')]===undefined?!![]:![]:!![],'where':_0x2d7567[_0xf58e('0x20')]?_0x2d7567[_0xf58e('0x20')][_0xf58e('0x21')]||null:null,'attributes':_0x2d7567[_0xf58e('0x20')]?_0x2d7567[_0xf58e('0x20')][_0xf58e('0x22')]||null:null,'limit':_0x2d7567['options']?_0x2d7567[_0xf58e('0x20')][_0xf58e('0x23')]||null:null,'include':_0x2d7567[_0xf58e('0x20')]?_0x2d7567[_0xf58e('0x20')]['include']?_[_0xf58e('0x24')](_0x2d7567[_0xf58e('0x20')][_0xf58e('0x25')],function(_0x29bef0){return{'model':db[_0x29bef0[_0xf58e('0x26')]],'as':_0x29bef0['as'],'attributes':_0x29bef0[_0xf58e('0x22')],'include':_0x29bef0[_0xf58e('0x25')]?_[_0xf58e('0x24')](_0x29bef0[_0xf58e('0x25')],function(_0xdea0c){return{'model':db[_0xdea0c[_0xf58e('0x26')]],'as':_0xdea0c['as'],'attributes':_0xdea0c['attributes'],'include':_0xdea0c[_0xf58e('0x25')]?_[_0xf58e('0x24')](_0xdea0c[_0xf58e('0x25')],function(_0x1c3eb3){return{'model':db[_0x1c3eb3[_0xf58e('0x26')]],'as':_0x1c3eb3['as'],'attributes':_0x1c3eb3[_0xf58e('0x22')]};}):[]};}):[]};}):[]:[]})[_0xf58e('0x27')](function(_0x1474d7){logger[_0xf58e('0x12')](_0xf58e('0x1c'),_0x2d7567);logger[_0xf58e('0x15')](_0xf58e('0x1c'),_0x2d7567,JSON[_0xf58e('0x28')](_0x1474d7));_0x5741ab(_0x1474d7);})[_0xf58e('0x1b')](function(_0x14b5f2){logger[_0xf58e('0x17')](_0xf58e('0x1c'),_0x14b5f2[_0xf58e('0x19')],_0x2d7567);_0x8254ac(_0x3bbf31[_0xf58e('0x17')](0x1f4,_0x14b5f2[_0xf58e('0x19')]));});});};exports[_0xf58e('0x29')]=function(_0x24a7df){var _0xf59b37=this;return new Promise(function(_0x186810,_0x1c7ca0){return db[_0xf58e('0x1d')][_0xf58e('0x2a')](_0x24a7df[_0xf58e('0x2b')],{'raw':_0x24a7df['options']?_0x24a7df['options'][_0xf58e('0x1f')]===undefined?!![]:![]:!![]})[_0xf58e('0x27')](function(_0x2b10fc){logger['info'](_0xf58e('0x29'),_0x24a7df);logger[_0xf58e('0x15')](_0xf58e('0x29'),_0x24a7df,JSON['stringify'](_0x2b10fc));_0x186810(_0x2b10fc);})['catch'](function(_0x10640c){logger[_0xf58e('0x17')](_0xf58e('0x29'),_0x10640c[_0xf58e('0x19')],_0x24a7df);_0x1c7ca0(_0xf59b37[_0xf58e('0x17')](0x1f4,_0x10640c['message']));});});};exports[_0xf58e('0x2c')]=function(_0x5945f9){var _0x1969aa=this;return new Promise(function(_0x3ba0b4,_0x271489){return db[_0xf58e('0x1d')][_0xf58e('0x2d')](_0x5945f9[_0xf58e('0x2b')],{'raw':_0x5945f9['options']?_0x5945f9['options'][_0xf58e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5945f9['options']?_0x5945f9[_0xf58e('0x20')][_0xf58e('0x21')]||null:null,'attributes':_0x5945f9[_0xf58e('0x20')]?_0x5945f9[_0xf58e('0x20')][_0xf58e('0x22')]||null:null,'limit':_0x5945f9[_0xf58e('0x20')]?_0x5945f9[_0xf58e('0x20')]['limit']||null:null})[_0xf58e('0x27')](function(_0x18993f){logger[_0xf58e('0x12')]('UpdateVoiceQueueReport',_0x5945f9);logger[_0xf58e('0x15')]('UpdateVoiceQueueReport',_0x5945f9,JSON['stringify'](_0x18993f));_0x3ba0b4(_0x18993f);})[_0xf58e('0x1b')](function(_0x845999){logger[_0xf58e('0x17')](_0xf58e('0x2c'),_0x845999['message'],_0x5945f9);_0x271489(_0x1969aa[_0xf58e('0x17')](0x1f4,_0x845999[_0xf58e('0x19')]));});});}; \ No newline at end of file +var _0xc71b=['raw','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','limit','model','attributes','include','map','then','stringify','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0xc71b,0x95));var _0xbc71=function(_0x569693,_0x4c5370){_0x569693=_0x569693-0x0;var _0x4678d5=_0xc71b[_0x569693];return _0x4678d5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbc71('0x0'));var rs=require(_0xbc71('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc71('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc71('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbc71('0x4'));var client=jayson[_0xbc71('0x5')][_0xbc71('0x6')]({'port':0x232a});config[_0xbc71('0x7')]=_['defaults'](config[_0xbc71('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xbc71('0x8'))(new Redis(config[_0xbc71('0x7')]));require(_0xbc71('0x9'))[_0xbc71('0xa')](socket);function respondWithRpcPromise(_0x4dbf53,_0x1247ee,_0x6b7407){return new BPromise(function(_0x171730,_0x526f81){return client['request'](_0x4dbf53,_0x6b7407)['then'](function(_0xac5c89){logger['info'](_0xbc71('0xb'),_0x1247ee,_0xbc71('0xc'));logger[_0xbc71('0xd')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x1247ee,_0xbc71('0xc'),JSON['stringify'](_0xac5c89));if(_0xac5c89[_0xbc71('0xe')]){if(_0xac5c89[_0xbc71('0xe')]['code']===0x1f4){logger['error'](_0xbc71('0xb'),_0x1247ee,_0xac5c89['error']['message']);return _0x526f81(_0xac5c89[_0xbc71('0xe')][_0xbc71('0xf')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x1247ee,_0xac5c89[_0xbc71('0xe')][_0xbc71('0xf')]);return _0x171730(_0xac5c89[_0xbc71('0xe')]['message']);}else{logger[_0xbc71('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x1247ee,_0xbc71('0xc'));_0x171730(_0xac5c89[_0xbc71('0x11')][_0xbc71('0xf')]);}})[_0xbc71('0x12')](function(_0x5dc335){logger[_0xbc71('0xe')](_0xbc71('0xb'),_0x1247ee,_0x5dc335);_0x526f81(_0x5dc335);});});}exports[_0xbc71('0x13')]=function(_0x516112){var _0x137b05=this;return new Promise(function(_0x2d8443,_0x42a70b){return db[_0xbc71('0x14')][_0xbc71('0x15')]({'raw':_0x516112['options']?_0x516112[_0xbc71('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x516112[_0xbc71('0x16')]?_0x516112['options'][_0xbc71('0x17')]||null:null,'attributes':_0x516112[_0xbc71('0x16')]?_0x516112[_0xbc71('0x16')]['attributes']||null:null,'limit':_0x516112[_0xbc71('0x16')]?_0x516112['options'][_0xbc71('0x18')]||null:null,'include':_0x516112['options']?_0x516112[_0xbc71('0x16')]['include']?_['map'](_0x516112['options']['include'],function(_0x5e8bb1){return{'model':db[_0x5e8bb1[_0xbc71('0x19')]],'as':_0x5e8bb1['as'],'attributes':_0x5e8bb1[_0xbc71('0x1a')],'include':_0x5e8bb1[_0xbc71('0x1b')]?_[_0xbc71('0x1c')](_0x5e8bb1[_0xbc71('0x1b')],function(_0x238fb9){return{'model':db[_0x238fb9['model']],'as':_0x238fb9['as'],'attributes':_0x238fb9[_0xbc71('0x1a')],'include':_0x238fb9[_0xbc71('0x1b')]?_[_0xbc71('0x1c')](_0x238fb9[_0xbc71('0x1b')],function(_0x5afa4e){return{'model':db[_0x5afa4e[_0xbc71('0x19')]],'as':_0x5afa4e['as'],'attributes':_0x5afa4e[_0xbc71('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbc71('0x1d')](function(_0xd8c74e){logger['info'](_0xbc71('0x13'),_0x516112);logger['debug'](_0xbc71('0x13'),_0x516112,JSON[_0xbc71('0x1e')](_0xd8c74e));_0x2d8443(_0xd8c74e);})['catch'](function(_0x2baae6){logger[_0xbc71('0xe')](_0xbc71('0x13'),_0x2baae6[_0xbc71('0xf')],_0x516112);_0x42a70b(_0x137b05[_0xbc71('0xe')](0x1f4,_0x2baae6[_0xbc71('0xf')]));});});};exports[_0xbc71('0x1f')]=function(_0x4a450d){var _0x505ef6=this;return new Promise(function(_0xaaef61,_0x4dd690){return db[_0xbc71('0x14')][_0xbc71('0x20')](_0x4a450d[_0xbc71('0x21')],{'raw':_0x4a450d[_0xbc71('0x16')]?_0x4a450d[_0xbc71('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xbc71('0x1d')](function(_0x45ef89){logger[_0xbc71('0x10')](_0xbc71('0x1f'),_0x4a450d);logger[_0xbc71('0xd')](_0xbc71('0x1f'),_0x4a450d,JSON[_0xbc71('0x1e')](_0x45ef89));_0xaaef61(_0x45ef89);})[_0xbc71('0x12')](function(_0x4588c7){logger[_0xbc71('0xe')](_0xbc71('0x1f'),_0x4588c7[_0xbc71('0xf')],_0x4a450d);_0x4dd690(_0x505ef6[_0xbc71('0xe')](0x1f4,_0x4588c7[_0xbc71('0xf')]));});});};exports[_0xbc71('0x22')]=function(_0x2f4c6a){var _0x4137ae=this;return new Promise(function(_0x2521c9,_0x441505){return db[_0xbc71('0x14')][_0xbc71('0x23')](_0x2f4c6a[_0xbc71('0x21')],{'raw':_0x2f4c6a[_0xbc71('0x16')]?_0x2f4c6a[_0xbc71('0x16')][_0xbc71('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f4c6a['options']?_0x2f4c6a[_0xbc71('0x16')][_0xbc71('0x17')]||null:null,'attributes':_0x2f4c6a[_0xbc71('0x16')]?_0x2f4c6a[_0xbc71('0x16')][_0xbc71('0x1a')]||null:null,'limit':_0x2f4c6a[_0xbc71('0x16')]?_0x2f4c6a[_0xbc71('0x16')][_0xbc71('0x18')]||null:null})[_0xbc71('0x1d')](function(_0x15063b){logger['info'](_0xbc71('0x22'),_0x2f4c6a);logger[_0xbc71('0xd')]('UpdateVoiceQueueReport',_0x2f4c6a,JSON[_0xbc71('0x1e')](_0x15063b));_0x2521c9(_0x15063b);})[_0xbc71('0x12')](function(_0x2cc1fd){logger[_0xbc71('0xe')](_0xbc71('0x22'),_0x2cc1fd[_0xbc71('0xf')],_0x2f4c6a);_0x441505(_0x4137ae[_0xbc71('0xe')](0x1f4,_0x2cc1fd['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 4ddc2f9..068a298 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 _0x8403=['remove','update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0xf0b0c0,_0x3f112d){var _0x15904b=function(_0x16b9da){while(--_0x16b9da){_0xf0b0c0['push'](_0xf0b0c0['shift']());}};_0x15904b(++_0x3f112d);}(_0x8403,0x1a5));var _0x3840=function(_0x206ba0,_0x352950){_0x206ba0=_0x206ba0-0x0;var _0x12f08e=_0x8403[_0x206ba0];return _0x12f08e;};'use strict';var VoiceQueueReportEvents=require(_0x3840('0x0'));var events=[_0x3840('0x1'),_0x3840('0x2'),_0x3840('0x3')];function createListener(_0x28b106,_0x43a9f0){return function(_0x502e0d){_0x43a9f0[_0x3840('0x4')](_0x28b106,_0x502e0d);};}function removeListener(_0x12aa6f,_0x579d29){return function(){VoiceQueueReportEvents[_0x3840('0x5')](_0x12aa6f,_0x579d29);};}exports[_0x3840('0x6')]=function(_0x1cd658){for(var _0x233be3=0x0,_0x1fcfd8=events[_0x3840('0x7')];_0x233be3<_0x1fcfd8;_0x233be3++){var _0x59923c=events[_0x233be3];var _0x5aa2c4=createListener(_0x3840('0x8')+_0x59923c,_0x1cd658);VoiceQueueReportEvents['on'](_0x59923c,_0x5aa2c4);}}; \ No newline at end of file +var _0x0a9f=['save','remove','emit','length','voiceQueueReport:'];(function(_0x3eb45b,_0xed03e3){var _0x20965f=function(_0x276bbf){while(--_0x276bbf){_0x3eb45b['push'](_0x3eb45b['shift']());}};_0x20965f(++_0xed03e3);}(_0x0a9f,0x64));var _0xf0a9=function(_0x9c0817,_0x50058d){_0x9c0817=_0x9c0817-0x0;var _0x396086=_0x0a9f[_0x9c0817];return _0x396086;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xf0a9('0x0'),_0xf0a9('0x1'),'update'];function createListener(_0x5ed2ce,_0x1f8e8e){return function(_0x48e2ea){_0x1f8e8e[_0xf0a9('0x2')](_0x5ed2ce,_0x48e2ea);};}function removeListener(_0x5db4cc,_0x5f203f){return function(){VoiceQueueReportEvents['removeListener'](_0x5db4cc,_0x5f203f);};}exports['register']=function(_0x5343c2){for(var _0x2502a2=0x0,_0x4e9fa6=events[_0xf0a9('0x3')];_0x2502a2<_0x4e9fa6;_0x2502a2++){var _0x4d14e0=events[_0x2502a2];var _0x798586=createListener(_0xf0a9('0x4')+_0x4d14e0,_0x5343c2);VoiceQueueReportEvents['on'](_0x4d14e0,_0x798586);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index c43b439..1e38acb 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 _0xf8de=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','index','isAuthenticated','show','post','put','/:id','update','delete','destroy','exports'];(function(_0x80f51a,_0x32e95e){var _0x327148=function(_0x16f788){while(--_0x16f788){_0x80f51a['push'](_0x80f51a['shift']());}};_0x327148(++_0x32e95e);}(_0xf8de,0x1d4));var _0xef8d=function(_0x2f3315,_0x2b8f83){_0x2f3315=_0x2f3315-0x0;var _0x54a1fd=_0xf8de[_0x2f3315];return _0x54a1fd;};'use strict';var multer=require('multer');var util=require(_0xef8d('0x0'));var path=require(_0xef8d('0x1'));var timeout=require('connect-timeout');var express=require(_0xef8d('0x2'));var router=express['Router']();var fs_extra=require(_0xef8d('0x3'));var auth=require(_0xef8d('0x4'));var interaction=require(_0xef8d('0x5'));var config=require('../../config/environment');var controller=require(_0xef8d('0x6'));router[_0xef8d('0x7')]('/',auth['isAuthenticated'](),controller[_0xef8d('0x8')]);router['get']('/:id',auth[_0xef8d('0x9')](),controller[_0xef8d('0xa')]);router[_0xef8d('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xef8d('0xc')](_0xef8d('0xd'),auth[_0xef8d('0x9')](),controller[_0xef8d('0xe')]);router[_0xef8d('0xf')](_0xef8d('0xd'),auth[_0xef8d('0x9')](),controller[_0xef8d('0x10')]);module[_0xef8d('0x11')]=router; \ No newline at end of file +var _0xc521=['../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x594455,_0x5b7eb){var _0xda005c=function(_0x16f5b9){while(--_0x16f5b9){_0x594455['push'](_0x594455['shift']());}};_0xda005c(++_0x5b7eb);}(_0xc521,0x67));var _0x1c52=function(_0x5c3ea4,_0x3939a9){_0x5c3ea4=_0x5c3ea4-0x0;var _0x217b91=_0xc521[_0x5c3ea4];return _0x217b91;};'use strict';var multer=require(_0x1c52('0x0'));var util=require('util');var path=require(_0x1c52('0x1'));var timeout=require(_0x1c52('0x2'));var express=require('express');var router=express[_0x1c52('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1c52('0x4'));var interaction=require(_0x1c52('0x5'));var config=require(_0x1c52('0x6'));var controller=require(_0x1c52('0x7'));router[_0x1c52('0x8')]('/',auth[_0x1c52('0x9')](),controller[_0x1c52('0xa')]);router[_0x1c52('0x8')](_0x1c52('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1c52('0xc')]('/',auth[_0x1c52('0x9')](),controller['create']);router[_0x1c52('0xd')](_0x1c52('0xb'),auth[_0x1c52('0x9')](),controller[_0x1c52('0xe')]);router[_0x1c52('0xf')](_0x1c52('0xb'),auth[_0x1c52('0x9')](),controller[_0x1c52('0x10')]);module[_0x1c52('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index fca9b61..1e00842 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 _0x4fda=['exports','STRING','DATE','format','sequelize'];(function(_0x4bd09c,_0x1ced67){var _0x18bce5=function(_0x1bde0f){while(--_0x1bde0f){_0x4bd09c['push'](_0x4bd09c['shift']());}};_0x18bce5(++_0x1ced67);}(_0x4fda,0x9a));var _0xa4fd=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0x4fda[_0x59d0cc];return _0x2ae79f;};'use strict';var Sequelize=require(_0xa4fd('0x0'));var moment=require('moment');module[_0xa4fd('0x1')]={'time':{'type':Sequelize[_0xa4fd('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa4fd('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa4fd('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa4fd('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa4fd('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa4fd('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa4fd('0x3')],'allowNull':![],'defaultValue':moment()[_0xa4fd('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x2b29=['moment','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x2b29,0x163));var _0x92b2=function(_0x551869,_0x5e25d4){_0x551869=_0x551869-0x0;var _0x3c7268=_0x2b29[_0x551869];return _0x3c7268;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x92b2('0x0'));module[_0x92b2('0x1')]={'time':{'type':Sequelize[_0x92b2('0x2')]},'callid':{'type':Sequelize[_0x92b2('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x92b2('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x92b2('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x92b2('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x92b2('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x92b2('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x92b2('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x92b2('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x92b2('0x3')](_0x92b2('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 125e8ed..87f9f7c 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 _0xcd66=['jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','VoiceQueuesLog','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x14670f,_0x214057){var _0x524f4d=function(_0x17877d){while(--_0x17877d){_0x14670f['push'](_0x14670f['shift']());}};_0x524f4d(++_0x214057);}(_0xcd66,0x8e));var _0x6cd6=function(_0x39f641,_0x1d0d2a){_0x39f641=_0x39f641-0x0;var _0x292eb8=_0xcd66[_0x39f641];return _0x292eb8;};'use strict';var emlformat=require(_0x6cd6('0x0'));var rimraf=require(_0x6cd6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6cd6('0x2'));var rp=require(_0x6cd6('0x3'));var moment=require('moment');var BPromise=require(_0x6cd6('0x4'));var Mustache=require(_0x6cd6('0x5'));var util=require(_0x6cd6('0x6'));var path=require(_0x6cd6('0x7'));var sox=require(_0x6cd6('0x8'));var csv=require(_0x6cd6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6cd6('0xa'));var _=require(_0x6cd6('0xb'));var squel=require(_0x6cd6('0xc'));var crypto=require(_0x6cd6('0xd'));var jsforce=require(_0x6cd6('0xe'));var deskjs=require(_0x6cd6('0xf'));var toCsv=require(_0x6cd6('0x9'));var querystring=require('querystring');var Papa=require(_0x6cd6('0x10'));var Redis=require('ioredis');var authService=require(_0x6cd6('0x11'));var qs=require(_0x6cd6('0x12'));var as=require(_0x6cd6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6cd6('0x14'))(_0x6cd6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6cd6('0x16'));var db=require(_0x6cd6('0x17'))['db'];function respondWithStatusCode(_0x406f3e,_0x2f59e1){_0x2f59e1=_0x2f59e1||0xcc;return function(_0x20a6b5){if(_0x20a6b5){return _0x406f3e[_0x6cd6('0x18')](_0x2f59e1);}return _0x406f3e[_0x6cd6('0x19')](_0x2f59e1)[_0x6cd6('0x1a')]();};}function respondWithResult(_0x5629e5,_0x3d71be){_0x3d71be=_0x3d71be||0xc8;return function(_0x38af63){if(_0x38af63){return _0x5629e5[_0x6cd6('0x19')](_0x3d71be)[_0x6cd6('0x1b')](_0x38af63);}};}function respondWithFilteredResult(_0x167fc5,_0x4177c2){return function(_0x1b2db){if(_0x1b2db){var _0x9a80f9=typeof _0x4177c2[_0x6cd6('0x1c')]===_0x6cd6('0x1d')&&typeof _0x4177c2[_0x6cd6('0x1e')]===_0x6cd6('0x1d');var _0x40392c=_0x1b2db[_0x6cd6('0x1f')];var _0x28d7e3=_0x9a80f9?0x0:_0x4177c2[_0x6cd6('0x1c')];var _0x56ed5c=_0x9a80f9?_0x1b2db['count']:_0x4177c2['offset']+_0x4177c2[_0x6cd6('0x1e')];var _0x2f3e17;if(_0x56ed5c>=_0x40392c){_0x56ed5c=_0x40392c;_0x2f3e17=0xc8;}else{_0x2f3e17=0xce;}_0x167fc5[_0x6cd6('0x19')](_0x2f3e17);return _0x167fc5['set'](_0x6cd6('0x20'),_0x28d7e3+'-'+_0x56ed5c+'/'+_0x40392c)['json'](_0x1b2db);}return null;};}function patchUpdates(_0x499739){return function(_0x51fe69){try{jsonpatch[_0x6cd6('0x21')](_0x51fe69,_0x499739,!![]);}catch(_0x53e9d4){return BPromise[_0x6cd6('0x22')](_0x53e9d4);}return _0x51fe69[_0x6cd6('0x23')]();};}function saveUpdates(_0x320422,_0x834339){return function(_0xb057a3){if(_0xb057a3){return _0xb057a3['update'](_0x320422)[_0x6cd6('0x24')](function(_0x674a2d){return _0x674a2d;});}return null;};}function removeEntity(_0x185161,_0x4c8887){return function(_0x5eefd4){if(_0x5eefd4){return _0x5eefd4[_0x6cd6('0x25')]()[_0x6cd6('0x24')](function(){_0x185161[_0x6cd6('0x19')](0xcc)[_0x6cd6('0x1a')]();});}};}function handleEntityNotFound(_0x89a6b8,_0x746e6f){return function(_0x4def97){if(!_0x4def97){_0x89a6b8['sendStatus'](0x194);}return _0x4def97;};}function handleError(_0x310926,_0x41609b){_0x41609b=_0x41609b||0x1f4;return function(_0x5a3f32){logger[_0x6cd6('0x26')](_0x5a3f32[_0x6cd6('0x27')]);if(_0x5a3f32[_0x6cd6('0x28')]){delete _0x5a3f32[_0x6cd6('0x28')];}_0x310926[_0x6cd6('0x19')](_0x41609b)[_0x6cd6('0x29')](_0x5a3f32);};}exports[_0x6cd6('0x2a')]=function(_0x1ca72d,_0x438f32){var _0x3f406a={},_0x2acbde={},_0x4b23e5={'count':0x0,'rows':[]};var _0x3cbb38=_[_0x6cd6('0x2b')](db['VoiceQueuesLog'][_0x6cd6('0x2c')],function(_0x2f1168){return{'name':_0x2f1168[_0x6cd6('0x2d')],'type':_0x2f1168['type'][_0x6cd6('0x2e')]};});_0x2acbde[_0x6cd6('0x2f')]=_[_0x6cd6('0x2b')](_0x3cbb38,'name');_0x2acbde[_0x6cd6('0x30')]=_[_0x6cd6('0x31')](_0x1ca72d[_0x6cd6('0x30')]);_0x2acbde['filters']=_[_0x6cd6('0x32')](_0x2acbde[_0x6cd6('0x2f')],_0x2acbde[_0x6cd6('0x30')]);_0x3f406a[_0x6cd6('0x33')]=_[_0x6cd6('0x32')](_0x2acbde['model'],qs[_0x6cd6('0x34')](_0x1ca72d[_0x6cd6('0x30')][_0x6cd6('0x34')]));_0x3f406a[_0x6cd6('0x33')]=_0x3f406a[_0x6cd6('0x33')][_0x6cd6('0x35')]?_0x3f406a[_0x6cd6('0x33')]:_0x2acbde[_0x6cd6('0x2f')];if(!_0x1ca72d[_0x6cd6('0x30')][_0x6cd6('0x36')](_0x6cd6('0x37'))){_0x3f406a[_0x6cd6('0x1e')]=qs[_0x6cd6('0x1e')](_0x1ca72d[_0x6cd6('0x30')]['limit']);_0x3f406a['offset']=qs[_0x6cd6('0x1c')](_0x1ca72d[_0x6cd6('0x30')][_0x6cd6('0x1c')]);}_0x3f406a[_0x6cd6('0x38')]=qs['sort'](_0x1ca72d[_0x6cd6('0x30')][_0x6cd6('0x39')]);_0x3f406a['where']=qs[_0x6cd6('0x3a')](_[_0x6cd6('0x3b')](_0x1ca72d[_0x6cd6('0x30')],_0x2acbde[_0x6cd6('0x3a')]),_0x3cbb38);if(_0x1ca72d['query'][_0x6cd6('0x3c')]){_0x3f406a[_0x6cd6('0x3d')]=_[_0x6cd6('0x3e')](_0x3f406a[_0x6cd6('0x3d')],{'$or':_[_0x6cd6('0x2b')](_0x3cbb38,function(_0x52983e){if(_0x52983e[_0x6cd6('0x3f')]!==_0x6cd6('0x40')){var _0x589f29={};_0x589f29[_0x52983e[_0x6cd6('0x28')]]={'$like':'%'+_0x1ca72d[_0x6cd6('0x30')]['filter']+'%'};return _0x589f29;}})});}_0x3f406a=_[_0x6cd6('0x3e')]({},_0x3f406a,_0x1ca72d[_0x6cd6('0x41')]);var _0x1f17b3={'where':_0x3f406a[_0x6cd6('0x3d')]};return db[_0x6cd6('0x42')][_0x6cd6('0x1f')](_0x1f17b3)[_0x6cd6('0x24')](function(_0x497a2c){_0x4b23e5[_0x6cd6('0x1f')]=_0x497a2c;if(_0x1ca72d[_0x6cd6('0x30')][_0x6cd6('0x43')]){_0x3f406a[_0x6cd6('0x44')]=[{'all':!![]}];}return db[_0x6cd6('0x42')][_0x6cd6('0x45')](_0x3f406a);})[_0x6cd6('0x24')](function(_0x1dd885){_0x4b23e5[_0x6cd6('0x46')]=_0x1dd885;return _0x4b23e5;})[_0x6cd6('0x24')](respondWithFilteredResult(_0x438f32,_0x3f406a))[_0x6cd6('0x47')](handleError(_0x438f32,null));};exports[_0x6cd6('0x48')]=function(_0x2c50f6,_0x4a39e1){var _0x56a10b={'raw':!![],'where':{'id':_0x2c50f6[_0x6cd6('0x49')]['id']}},_0x538882={};_0x538882[_0x6cd6('0x2f')]=_['keys'](db[_0x6cd6('0x42')][_0x6cd6('0x2c')]);_0x538882['query']=_['keys'](_0x2c50f6[_0x6cd6('0x30')]);_0x538882[_0x6cd6('0x3a')]=_['intersection'](_0x538882[_0x6cd6('0x2f')],_0x538882[_0x6cd6('0x30')]);_0x56a10b['attributes']=_[_0x6cd6('0x32')](_0x538882[_0x6cd6('0x2f')],qs[_0x6cd6('0x34')](_0x2c50f6[_0x6cd6('0x30')][_0x6cd6('0x34')]));_0x56a10b[_0x6cd6('0x33')]=_0x56a10b[_0x6cd6('0x33')][_0x6cd6('0x35')]?_0x56a10b[_0x6cd6('0x33')]:_0x538882[_0x6cd6('0x2f')];if(_0x2c50f6[_0x6cd6('0x30')]['includeAll']){_0x56a10b['include']=[{'all':!![]}];}_0x56a10b=_['merge']({},_0x56a10b,_0x2c50f6['options']);return db[_0x6cd6('0x42')][_0x6cd6('0x4a')](_0x56a10b)[_0x6cd6('0x24')](handleEntityNotFound(_0x4a39e1,null))['then'](respondWithResult(_0x4a39e1,null))[_0x6cd6('0x47')](handleError(_0x4a39e1,null));};exports[_0x6cd6('0x4b')]=function(_0x122d24,_0x5d56f7){return db[_0x6cd6('0x42')][_0x6cd6('0x4b')](_0x122d24[_0x6cd6('0x4c')],{})['then'](respondWithResult(_0x5d56f7,0xc9))[_0x6cd6('0x47')](handleError(_0x5d56f7,null));};exports[_0x6cd6('0x4d')]=function(_0x4b3ed8,_0x460a32){if(_0x4b3ed8[_0x6cd6('0x4c')]['id']){delete _0x4b3ed8[_0x6cd6('0x4c')]['id'];}return db[_0x6cd6('0x42')][_0x6cd6('0x4a')]({'where':{'id':_0x4b3ed8['params']['id']}})[_0x6cd6('0x24')](handleEntityNotFound(_0x460a32,null))[_0x6cd6('0x24')](saveUpdates(_0x4b3ed8['body'],null))[_0x6cd6('0x24')](respondWithResult(_0x460a32,null))[_0x6cd6('0x47')](handleError(_0x460a32,null));};exports[_0x6cd6('0x25')]=function(_0x1c89bb,_0x3a3abd){return db[_0x6cd6('0x42')][_0x6cd6('0x4a')]({'where':{'id':_0x1c89bb['params']['id']}})[_0x6cd6('0x24')](handleEntityNotFound(_0x3a3abd,null))[_0x6cd6('0x24')](removeEntity(_0x3a3abd,null))['catch'](handleError(_0x3a3abd,null));}; \ No newline at end of file +var _0x2ec9=['jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','merge','VIRTUAL','filter','options','where','include','VoiceQueuesLog','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x474ece,_0x7195c0){var _0x1d4817=function(_0x2df20f){while(--_0x2df20f){_0x474ece['push'](_0x474ece['shift']());}};_0x1d4817(++_0x7195c0);}(_0x2ec9,0x111));var _0x92ec=function(_0x2947f9,_0x3de637){_0x2947f9=_0x2947f9-0x0;var _0x3736b4=_0x2ec9[_0x2947f9];return _0x3736b4;};'use strict';var emlformat=require(_0x92ec('0x0'));var rimraf=require(_0x92ec('0x1'));var zipdir=require(_0x92ec('0x2'));var jsonpatch=require(_0x92ec('0x3'));var rp=require(_0x92ec('0x4'));var moment=require(_0x92ec('0x5'));var BPromise=require(_0x92ec('0x6'));var Mustache=require(_0x92ec('0x7'));var util=require(_0x92ec('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x92ec('0x9'));var ejs=require(_0x92ec('0xa'));var fs=require('fs');var fs_extra=require(_0x92ec('0xb'));var _=require(_0x92ec('0xc'));var squel=require(_0x92ec('0xd'));var crypto=require(_0x92ec('0xe'));var jsforce=require(_0x92ec('0xf'));var deskjs=require(_0x92ec('0x10'));var toCsv=require(_0x92ec('0x9'));var querystring=require('querystring');var Papa=require(_0x92ec('0x11'));var Redis=require(_0x92ec('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x92ec('0x13'));var as=require(_0x92ec('0x14'));var hardwareService=require(_0x92ec('0x15'));var logger=require('../../config/logger')(_0x92ec('0x16'));var utils=require(_0x92ec('0x17'));var config=require(_0x92ec('0x18'));var licenseUtil=require(_0x92ec('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5eb120,_0x4f4e5b){_0x4f4e5b=_0x4f4e5b||0xcc;return function(_0x2d9811){if(_0x2d9811){return _0x5eb120[_0x92ec('0x1a')](_0x4f4e5b);}return _0x5eb120[_0x92ec('0x1b')](_0x4f4e5b)[_0x92ec('0x1c')]();};}function respondWithResult(_0x40f8ef,_0x52e349){_0x52e349=_0x52e349||0xc8;return function(_0xe581a2){if(_0xe581a2){return _0x40f8ef[_0x92ec('0x1b')](_0x52e349)[_0x92ec('0x1d')](_0xe581a2);}};}function respondWithFilteredResult(_0x21b6c8,_0x135103){return function(_0x10775a){if(_0x10775a){var _0x3e45b0=typeof _0x135103[_0x92ec('0x1e')]==='undefined'&&typeof _0x135103[_0x92ec('0x1f')]===_0x92ec('0x20');var _0x1a946c=_0x10775a[_0x92ec('0x21')];var _0x3d58bb=_0x3e45b0?0x0:_0x135103[_0x92ec('0x1e')];var _0x1e10d1=_0x3e45b0?_0x10775a['count']:_0x135103[_0x92ec('0x1e')]+_0x135103['limit'];var _0x54261f;if(_0x1e10d1>=_0x1a946c){_0x1e10d1=_0x1a946c;_0x54261f=0xc8;}else{_0x54261f=0xce;}_0x21b6c8[_0x92ec('0x1b')](_0x54261f);return _0x21b6c8[_0x92ec('0x22')](_0x92ec('0x23'),_0x3d58bb+'-'+_0x1e10d1+'/'+_0x1a946c)[_0x92ec('0x1d')](_0x10775a);}return null;};}function patchUpdates(_0xeffcb5){return function(_0x446e04){try{jsonpatch[_0x92ec('0x24')](_0x446e04,_0xeffcb5,!![]);}catch(_0x4d389a){return BPromise[_0x92ec('0x25')](_0x4d389a);}return _0x446e04['save']();};}function saveUpdates(_0x43deca,_0x378b43){return function(_0x53a629){if(_0x53a629){return _0x53a629[_0x92ec('0x26')](_0x43deca)[_0x92ec('0x27')](function(_0x141589){return _0x141589;});}return null;};}function removeEntity(_0x279149,_0x3f2c24){return function(_0x4aaae5){if(_0x4aaae5){return _0x4aaae5[_0x92ec('0x28')]()[_0x92ec('0x27')](function(){_0x279149[_0x92ec('0x1b')](0xcc)[_0x92ec('0x1c')]();});}};}function handleEntityNotFound(_0x23eecf,_0x5b66b4){return function(_0x58e037){if(!_0x58e037){_0x23eecf[_0x92ec('0x1a')](0x194);}return _0x58e037;};}function handleError(_0x2f016b,_0x3cc5b6){_0x3cc5b6=_0x3cc5b6||0x1f4;return function(_0x35ca65){logger[_0x92ec('0x29')](_0x35ca65['stack']);if(_0x35ca65[_0x92ec('0x2a')]){delete _0x35ca65[_0x92ec('0x2a')];}_0x2f016b['status'](_0x3cc5b6)['send'](_0x35ca65);};}exports['index']=function(_0x54e4e0,_0x11057f){var _0x24b02c={},_0x6d9f3f={},_0x5f05c0={'count':0x0,'rows':[]};var _0x2999d6=_['map'](db['VoiceQueuesLog'][_0x92ec('0x2b')],function(_0x13adb9){return{'name':_0x13adb9['fieldName'],'type':_0x13adb9[_0x92ec('0x2c')][_0x92ec('0x2d')]};});_0x6d9f3f[_0x92ec('0x2e')]=_['map'](_0x2999d6,'name');_0x6d9f3f[_0x92ec('0x2f')]=_[_0x92ec('0x30')](_0x54e4e0['query']);_0x6d9f3f[_0x92ec('0x31')]=_[_0x92ec('0x32')](_0x6d9f3f[_0x92ec('0x2e')],_0x6d9f3f['query']);_0x24b02c['attributes']=_[_0x92ec('0x32')](_0x6d9f3f[_0x92ec('0x2e')],qs[_0x92ec('0x33')](_0x54e4e0[_0x92ec('0x2f')]['fields']));_0x24b02c['attributes']=_0x24b02c['attributes'][_0x92ec('0x34')]?_0x24b02c[_0x92ec('0x35')]:_0x6d9f3f[_0x92ec('0x2e')];if(!_0x54e4e0[_0x92ec('0x2f')]['hasOwnProperty'](_0x92ec('0x36'))){_0x24b02c['limit']=qs[_0x92ec('0x1f')](_0x54e4e0['query'][_0x92ec('0x1f')]);_0x24b02c[_0x92ec('0x1e')]=qs[_0x92ec('0x1e')](_0x54e4e0[_0x92ec('0x2f')]['offset']);}_0x24b02c[_0x92ec('0x37')]=qs[_0x92ec('0x38')](_0x54e4e0[_0x92ec('0x2f')]['sort']);_0x24b02c['where']=qs['filters'](_['pick'](_0x54e4e0['query'],_0x6d9f3f[_0x92ec('0x31')]),_0x2999d6);if(_0x54e4e0['query']['filter']){_0x24b02c['where']=_[_0x92ec('0x39')](_0x24b02c['where'],{'$or':_['map'](_0x2999d6,function(_0x3ddcd2){if(_0x3ddcd2[_0x92ec('0x2c')]!==_0x92ec('0x3a')){var _0x12126f={};_0x12126f[_0x3ddcd2[_0x92ec('0x2a')]]={'$like':'%'+_0x54e4e0['query'][_0x92ec('0x3b')]+'%'};return _0x12126f;}})});}_0x24b02c=_['merge']({},_0x24b02c,_0x54e4e0[_0x92ec('0x3c')]);var _0xb2767={'where':_0x24b02c[_0x92ec('0x3d')]};return db['VoiceQueuesLog']['count'](_0xb2767)[_0x92ec('0x27')](function(_0x40d8f2){_0x5f05c0['count']=_0x40d8f2;if(_0x54e4e0[_0x92ec('0x2f')]['includeAll']){_0x24b02c[_0x92ec('0x3e')]=[{'all':!![]}];}return db[_0x92ec('0x3f')]['findAll'](_0x24b02c);})[_0x92ec('0x27')](function(_0x39c287){_0x5f05c0[_0x92ec('0x40')]=_0x39c287;return _0x5f05c0;})[_0x92ec('0x27')](respondWithFilteredResult(_0x11057f,_0x24b02c))[_0x92ec('0x41')](handleError(_0x11057f,null));};exports[_0x92ec('0x42')]=function(_0x45e9e4,_0x42a67f){var _0x32bf8a={'raw':!![],'where':{'id':_0x45e9e4[_0x92ec('0x43')]['id']}},_0x592a86={};_0x592a86[_0x92ec('0x2e')]=_[_0x92ec('0x30')](db[_0x92ec('0x3f')][_0x92ec('0x2b')]);_0x592a86[_0x92ec('0x2f')]=_[_0x92ec('0x30')](_0x45e9e4[_0x92ec('0x2f')]);_0x592a86[_0x92ec('0x31')]=_[_0x92ec('0x32')](_0x592a86['model'],_0x592a86[_0x92ec('0x2f')]);_0x32bf8a[_0x92ec('0x35')]=_[_0x92ec('0x32')](_0x592a86[_0x92ec('0x2e')],qs[_0x92ec('0x33')](_0x45e9e4[_0x92ec('0x2f')][_0x92ec('0x33')]));_0x32bf8a[_0x92ec('0x35')]=_0x32bf8a[_0x92ec('0x35')][_0x92ec('0x34')]?_0x32bf8a[_0x92ec('0x35')]:_0x592a86[_0x92ec('0x2e')];if(_0x45e9e4[_0x92ec('0x2f')][_0x92ec('0x44')]){_0x32bf8a[_0x92ec('0x3e')]=[{'all':!![]}];}_0x32bf8a=_['merge']({},_0x32bf8a,_0x45e9e4[_0x92ec('0x3c')]);return db[_0x92ec('0x3f')][_0x92ec('0x45')](_0x32bf8a)[_0x92ec('0x27')](handleEntityNotFound(_0x42a67f,null))[_0x92ec('0x27')](respondWithResult(_0x42a67f,null))['catch'](handleError(_0x42a67f,null));};exports[_0x92ec('0x46')]=function(_0x4f7b8e,_0x4548d0){return db[_0x92ec('0x3f')][_0x92ec('0x46')](_0x4f7b8e[_0x92ec('0x47')],{})['then'](respondWithResult(_0x4548d0,0xc9))[_0x92ec('0x41')](handleError(_0x4548d0,null));};exports[_0x92ec('0x26')]=function(_0x543439,_0x24c029){if(_0x543439[_0x92ec('0x47')]['id']){delete _0x543439[_0x92ec('0x47')]['id'];}return db[_0x92ec('0x3f')][_0x92ec('0x45')]({'where':{'id':_0x543439[_0x92ec('0x43')]['id']}})[_0x92ec('0x27')](handleEntityNotFound(_0x24c029,null))[_0x92ec('0x27')](saveUpdates(_0x543439[_0x92ec('0x47')],null))['then'](respondWithResult(_0x24c029,null))['catch'](handleError(_0x24c029,null));};exports[_0x92ec('0x28')]=function(_0x7c6952,_0x26e511){return db[_0x92ec('0x3f')]['find']({'where':{'id':_0x7c6952['params']['id']}})['then'](handleEntityNotFound(_0x26e511,null))[_0x92ec('0x27')](removeEntity(_0x26e511,null))[_0x92ec('0x41')](handleError(_0x26e511,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index a031f76..ff219ad 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 _0x8248=['define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x190b51,_0x5b3786){var _0x91beb9=function(_0x35400e){while(--_0x35400e){_0x190b51['push'](_0x190b51['shift']());}};_0x91beb9(++_0x5b3786);}(_0x8248,0x67));var _0x8824=function(_0x4c6779,_0x4539e3){_0x4c6779=_0x4c6779-0x0;var _0x151217=_0x8248[_0x4c6779];return _0x151217;};'use strict';var _=require(_0x8824('0x0'));var util=require(_0x8824('0x1'));var logger=require('../../config/logger')(_0x8824('0x2'));var moment=require('moment');var BPromise=require(_0x8824('0x3'));var rp=require(_0x8824('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8824('0x5'));var config=require(_0x8824('0x6'));var attributes=require(_0x8824('0x7'));module[_0x8824('0x8')]=function(_0x1ff98a,_0xec76ee){return _0x1ff98a[_0x8824('0x9')](_0x8824('0xa'),attributes,{'tableName':_0x8824('0xb'),'paranoid':![],'indexes':[{'name':_0x8824('0xc'),'fields':['event',_0x8824('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xba00=['event','dtm','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm'];(function(_0x1ad3d1,_0x1c76af){var _0x22fec6=function(_0x9ba658){while(--_0x9ba658){_0x1ad3d1['push'](_0x1ad3d1['shift']());}};_0x22fec6(++_0x1c76af);}(_0xba00,0x6b));var _0x0ba0=function(_0x5d93ba,_0x247780){_0x5d93ba=_0x5d93ba-0x0;var _0x5c982a=_0xba00[_0x5d93ba];return _0x5c982a;};'use strict';var _=require(_0x0ba0('0x0'));var util=require('util');var logger=require(_0x0ba0('0x1'))('api');var moment=require(_0x0ba0('0x2'));var BPromise=require(_0x0ba0('0x3'));var rp=require(_0x0ba0('0x4'));var fs=require('fs');var path=require(_0x0ba0('0x5'));var rimraf=require(_0x0ba0('0x6'));var config=require(_0x0ba0('0x7'));var attributes=require(_0x0ba0('0x8'));module['exports']=function(_0x1fe55d,_0x4c8b1f){return _0x1fe55d[_0x0ba0('0x9')](_0x0ba0('0xa'),attributes,{'tableName':_0x0ba0('0xb'),'paranoid':![],'indexes':[{'name':_0x0ba0('0xc'),'fields':[_0x0ba0('0xd'),_0x0ba0('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index a0f112c..c896b32 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 _0x134c=['debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent'];(function(_0x16af28,_0x3a4dc0){var _0x23b34e=function(_0x31325c){while(--_0x31325c){_0x16af28['push'](_0x16af28['shift']());}};_0x23b34e(++_0x3a4dc0);}(_0x134c,0x1ca));var _0xc134=function(_0x2df1f2,_0x58d388){_0x2df1f2=_0x2df1f2-0x0;var _0x38652b=_0x134c[_0x2df1f2];return _0x38652b;};'use strict';var _=require(_0xc134('0x0'));var util=require(_0xc134('0x1'));var moment=require(_0xc134('0x2'));var BPromise=require(_0xc134('0x3'));var rs=require(_0xc134('0x4'));var fs=require('fs');var Redis=require(_0xc134('0x5'));var db=require(_0xc134('0x6'))['db'];var utils=require(_0xc134('0x7'));var logger=require(_0xc134('0x8'))(_0xc134('0x9'));var config=require(_0xc134('0xa'));var jayson=require(_0xc134('0xb'));var client=jayson[_0xc134('0xc')][_0xc134('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4133db,_0x5827d7,_0x1a0c6a){return new BPromise(function(_0x18c53f,_0x1a11f4){return client[_0xc134('0xe')](_0x4133db,_0x1a0c6a)['then'](function(_0x4da611){logger['info'](_0xc134('0xf'),_0x5827d7,_0xc134('0x10'));logger[_0xc134('0x11')](_0xc134('0x12'),_0x5827d7,'request\x20sent',JSON[_0xc134('0x13')](_0x4da611));if(_0x4da611[_0xc134('0x14')]){if(_0x4da611[_0xc134('0x14')][_0xc134('0x15')]===0x1f4){logger['error'](_0xc134('0xf'),_0x5827d7,_0x4da611[_0xc134('0x14')]['message']);return _0x1a11f4(_0x4da611[_0xc134('0x14')][_0xc134('0x16')]);}logger['error'](_0xc134('0xf'),_0x5827d7,_0x4da611[_0xc134('0x14')]['message']);return _0x18c53f(_0x4da611['error'][_0xc134('0x16')]);}else{logger['info'](_0xc134('0xf'),_0x5827d7,_0xc134('0x10'));_0x18c53f(_0x4da611[_0xc134('0x17')]['message']);}})[_0xc134('0x18')](function(_0x22fd6d){logger[_0xc134('0x14')](_0xc134('0xf'),_0x5827d7,_0x22fd6d);_0x1a11f4(_0x22fd6d);});});} \ No newline at end of file +var _0x4862=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x52bc4c,_0x2c57f3){var _0x5bfdcd=function(_0x5e139a){while(--_0x5e139a){_0x52bc4c['push'](_0x52bc4c['shift']());}};_0x5bfdcd(++_0x2c57f3);}(_0x4862,0x129));var _0x2486=function(_0x10fc1d,_0x1966e4){_0x10fc1d=_0x10fc1d-0x0;var _0x19cc91=_0x4862[_0x10fc1d];return _0x19cc91;};'use strict';var _=require(_0x2486('0x0'));var util=require('util');var moment=require(_0x2486('0x1'));var BPromise=require(_0x2486('0x2'));var rs=require(_0x2486('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2486('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2486('0x5'))(_0x2486('0x6'));var config=require(_0x2486('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2486('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc39ab1,_0xea89f6,_0x1eadb2){return new BPromise(function(_0x460bdf,_0x5191ed){return client['request'](_0xc39ab1,_0x1eadb2)[_0x2486('0x9')](function(_0xd60ed3){logger[_0x2486('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0xea89f6,_0x2486('0xb'));logger[_0x2486('0xc')](_0x2486('0xd'),_0xea89f6,'request\x20sent',JSON[_0x2486('0xe')](_0xd60ed3));if(_0xd60ed3[_0x2486('0xf')]){if(_0xd60ed3['error'][_0x2486('0x10')]===0x1f4){logger['error'](_0x2486('0x11'),_0xea89f6,_0xd60ed3['error'][_0x2486('0x12')]);return _0x5191ed(_0xd60ed3['error'][_0x2486('0x12')]);}logger['error'](_0x2486('0x11'),_0xea89f6,_0xd60ed3[_0x2486('0xf')][_0x2486('0x12')]);return _0x460bdf(_0xd60ed3[_0x2486('0xf')][_0x2486('0x12')]);}else{logger[_0x2486('0xa')](_0x2486('0x11'),_0xea89f6,_0x2486('0xb'));_0x460bdf(_0xd60ed3[_0x2486('0x13')][_0x2486('0x12')]);}})[_0x2486('0x14')](function(_0x1aa62e){logger[_0x2486('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0xea89f6,_0x1aa62e);_0x5191ed(_0x1aa62e);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 626a8ac..d68096a 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 _0x1630=['downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','/:id/download','isAuthenticated','download','/:id/downloads'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x1630,0xb2));var _0x0163=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x1630[_0x5a776b];return _0xbbef59;};'use strict';var multer=require(_0x0163('0x0'));var util=require(_0x0163('0x1'));var path=require(_0x0163('0x2'));var timeout=require(_0x0163('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0163('0x4'));var auth=require(_0x0163('0x5'));var interaction=require(_0x0163('0x6'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x0163('0x7')]('/',auth['isAuthenticated'](),controller[_0x0163('0x8')]);router[_0x0163('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0163('0x7')](_0x0163('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x0163('0x7')](_0x0163('0xa'),auth[_0x0163('0xb')](),controller[_0x0163('0xc')]);router[_0x0163('0x7')](_0x0163('0xd'),controller[_0x0163('0xe')]);router[_0x0163('0x7')](_0x0163('0xf'),auth[_0x0163('0xb')](),controller[_0x0163('0x10')]);router[_0x0163('0x11')]('/',auth['isAuthenticated'](),controller[_0x0163('0x12')]);router[_0x0163('0x11')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0163('0x13')]);router[_0x0163('0x14')](_0x0163('0x9'),auth[_0x0163('0xb')](),controller[_0x0163('0x15')]);router[_0x0163('0x16')](_0x0163('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x0163('0x17')]=router; \ No newline at end of file +var _0x074b=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','/:id','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put'];(function(_0x3c16e6,_0x1ff747){var _0x70d53=function(_0x258bb5){while(--_0x258bb5){_0x3c16e6['push'](_0x3c16e6['shift']());}};_0x70d53(++_0x1ff747);}(_0x074b,0x16f));var _0xb074=function(_0x180ba7,_0xc32731){_0x180ba7=_0x180ba7-0x0;var _0x1cdb86=_0x074b[_0x180ba7];return _0x1cdb86;};'use strict';var multer=require(_0xb074('0x0'));var util=require(_0xb074('0x1'));var path=require(_0xb074('0x2'));var timeout=require(_0xb074('0x3'));var express=require(_0xb074('0x4'));var router=express[_0xb074('0x5')]();var fs_extra=require(_0xb074('0x6'));var auth=require(_0xb074('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb074('0x8'));var controller=require(_0xb074('0x9'));router[_0xb074('0xa')]('/',auth[_0xb074('0xb')](),controller['index']);router[_0xb074('0xa')](_0xb074('0xc'),auth[_0xb074('0xb')](),controller['describe']);router[_0xb074('0xa')](_0xb074('0xd'),auth[_0xb074('0xb')](),controller[_0xb074('0xe')]);router[_0xb074('0xa')](_0xb074('0xf'),auth['isAuthenticated'](),controller['download']);router[_0xb074('0xa')](_0xb074('0x10'),controller[_0xb074('0x11')]);router['get'](_0xb074('0x12'),auth[_0xb074('0xb')](),controller[_0xb074('0x13')]);router[_0xb074('0x14')]('/',auth[_0xb074('0xb')](),controller['create']);router['post']('/:id/transcribe',auth['isAuthenticated'](),controller[_0xb074('0x15')]);router[_0xb074('0x16')](_0xb074('0xd'),auth['isAuthenticated'](),controller[_0xb074('0x17')]);router[_0xb074('0x18')](_0xb074('0xd'),auth[_0xb074('0xb')](),controller[_0xb074('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 2aacfb1..e60a04b 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(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 1442610..f78679e 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 _0xb543=['Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','VoiceRecording','fieldName','key','model','format','query','intersection','attributes','fields','length','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','download','type','uniqueid','value','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','downloads','../../components/encryptor','sequelize','MD5','$and','push','%s.cypher','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','secrets','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','downloadTranscribe','fileText','.txt'];(function(_0x1ee8e0,_0x46b653){var _0x33df5b=function(_0x271faf){while(--_0x271faf){_0x1ee8e0['push'](_0x1ee8e0['shift']());}};_0x33df5b(++_0x46b653);}(_0xb543,0x9d));var _0x3b54=function(_0x2ba357,_0x38b735){_0x2ba357=_0x2ba357-0x0;var _0x3f74bc=_0xb543[_0x2ba357];return _0x3f74bc;};'use strict';var emlformat=require(_0x3b54('0x0'));var rimraf=require(_0x3b54('0x1'));var zipdir=require(_0x3b54('0x2'));var jsonpatch=require(_0x3b54('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3b54('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3b54('0x5'));var sox=require('sox');var csv=require(_0x3b54('0x6'));var ejs=require(_0x3b54('0x7'));var fs=require('fs');var fs_extra=require(_0x3b54('0x8'));var _=require(_0x3b54('0x9'));var squel=require(_0x3b54('0xa'));var crypto=require(_0x3b54('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3b54('0xc'));var toCsv=require(_0x3b54('0x6'));var querystring=require(_0x3b54('0xd'));var Papa=require(_0x3b54('0xe'));var AWS=require(_0x3b54('0xf'));var uuidv4=require('uuid/v4');var Redis=require(_0x3b54('0x10'));var authService=require(_0x3b54('0x11'));var qs=require(_0x3b54('0x12'));var as=require(_0x3b54('0x13'));var hardwareService=require(_0x3b54('0x14'));var logger=require(_0x3b54('0x15'))(_0x3b54('0x16'));var utils=require(_0x3b54('0x17'));var config=require(_0x3b54('0x18'));var licenseUtil=require(_0x3b54('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e512e,_0xe30af1){_0xe30af1=_0xe30af1||0xcc;return function(_0x62bf47){if(_0x62bf47){return _0x2e512e['sendStatus'](_0xe30af1);}return _0x2e512e[_0x3b54('0x1a')](_0xe30af1)[_0x3b54('0x1b')]();};}function respondWithResult(_0x3d2d5e,_0x1f8a68){_0x1f8a68=_0x1f8a68||0xc8;return function(_0x328024){if(_0x328024){return _0x3d2d5e['status'](_0x1f8a68)[_0x3b54('0x1c')](_0x328024);}};}function respondWithFilteredResult(_0x11f681,_0x14ee26){return function(_0x29df3e){if(_0x29df3e){var _0x52f437=typeof _0x14ee26[_0x3b54('0x1d')]===_0x3b54('0x1e')&&typeof _0x14ee26[_0x3b54('0x1f')]===_0x3b54('0x1e');var _0x5968b8=_0x29df3e[_0x3b54('0x20')];var _0x5ae6ed=_0x52f437?0x0:_0x14ee26[_0x3b54('0x1d')];var _0x545a49=_0x52f437?_0x29df3e[_0x3b54('0x20')]:_0x14ee26[_0x3b54('0x1d')]+_0x14ee26['limit'];var _0xa0bb7;if(_0x545a49>=_0x5968b8){_0x545a49=_0x5968b8;_0xa0bb7=0xc8;}else{_0xa0bb7=0xce;}_0x11f681[_0x3b54('0x1a')](_0xa0bb7);return _0x11f681[_0x3b54('0x21')](_0x3b54('0x22'),_0x5ae6ed+'-'+_0x545a49+'/'+_0x5968b8)[_0x3b54('0x1c')](_0x29df3e);}return null;};}function patchUpdates(_0x366498){return function(_0x266ae7){try{jsonpatch[_0x3b54('0x23')](_0x266ae7,_0x366498,!![]);}catch(_0x519928){return BPromise[_0x3b54('0x24')](_0x519928);}return _0x266ae7[_0x3b54('0x25')]();};}function saveUpdates(_0x114b45,_0x47ba2a){return function(_0x1dc84f){if(_0x1dc84f){return _0x1dc84f[_0x3b54('0x26')](_0x114b45)[_0x3b54('0x27')](function(_0x1d9b85){return _0x1d9b85;});}return null;};}function removeEntity(_0x483ff7,_0x4cb698){return function(_0x280712){if(_0x280712){return _0x280712['destroy']()[_0x3b54('0x27')](function(){_0x483ff7[_0x3b54('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf8e2be,_0xbe6934){return function(_0xb44a69){if(!_0xb44a69){_0xf8e2be[_0x3b54('0x28')](0x194);}return _0xb44a69;};}function handleError(_0x1941a5,_0x482ec1){_0x482ec1=_0x482ec1||0x1f4;return function(_0x48adc5){logger[_0x3b54('0x29')](_0x48adc5[_0x3b54('0x2a')]);if(_0x48adc5[_0x3b54('0x2b')]){delete _0x48adc5[_0x3b54('0x2b')];}_0x1941a5[_0x3b54('0x1a')](_0x482ec1)['send'](_0x48adc5);};}exports[_0x3b54('0x2c')]=function(_0x28dd6e,_0x267b68){var _0x57f73e={},_0x2bf386={},_0xeacaad={'count':0x0,'rows':[]};var _0x428057=_[_0x3b54('0x2d')](db[_0x3b54('0x2e')]['rawAttributes'],function(_0x5e0f1a){return{'name':_0x5e0f1a[_0x3b54('0x2f')],'type':_0x5e0f1a['type'][_0x3b54('0x30')]};});_0x2bf386[_0x3b54('0x31')]=_['differenceBy'](_[_0x3b54('0x2d')](_0x428057,_0x3b54('0x2b')),[_0x3b54('0x32')]);_0x2bf386[_0x3b54('0x33')]=_['keys'](_0x28dd6e[_0x3b54('0x33')]);_0x2bf386['filters']=_[_0x3b54('0x34')](_0x2bf386[_0x3b54('0x31')],_0x2bf386[_0x3b54('0x33')]);_0x57f73e[_0x3b54('0x35')]=_['intersection'](_0x2bf386['model'],qs['fields'](_0x28dd6e[_0x3b54('0x33')][_0x3b54('0x36')]));_0x57f73e[_0x3b54('0x35')]=_0x57f73e['attributes'][_0x3b54('0x37')]?_0x57f73e[_0x3b54('0x35')]:_0x2bf386['model'];if(!_0x28dd6e['query']['hasOwnProperty'](_0x3b54('0x38'))){_0x57f73e[_0x3b54('0x1f')]=qs['limit'](_0x28dd6e[_0x3b54('0x33')][_0x3b54('0x1f')]);_0x57f73e[_0x3b54('0x1d')]=qs['offset'](_0x28dd6e[_0x3b54('0x33')][_0x3b54('0x1d')]);}_0x57f73e[_0x3b54('0x39')]=qs[_0x3b54('0x3a')](_0x28dd6e[_0x3b54('0x33')][_0x3b54('0x3a')]);_0x57f73e['where']=qs['filters'](_[_0x3b54('0x3b')](_0x28dd6e[_0x3b54('0x33')],_0x2bf386[_0x3b54('0x3c')]),_0x428057);if(_0x28dd6e[_0x3b54('0x33')]['filter']){_0x57f73e[_0x3b54('0x3d')]=_[_0x3b54('0x3e')](_0x57f73e[_0x3b54('0x3d')],{'$or':_[_0x3b54('0x2d')](_0x428057,function(_0x106724){if(_0x106724['type']!==_0x3b54('0x3f')){var _0x195181={};_0x195181[_0x106724['name']]={'$like':'%'+_0x28dd6e[_0x3b54('0x33')][_0x3b54('0x40')]+'%'};return _0x195181;}})});}_0x57f73e=_[_0x3b54('0x3e')]({},_0x57f73e,_0x28dd6e[_0x3b54('0x41')]);var _0x293593={'where':_0x57f73e[_0x3b54('0x3d')]};return db[_0x3b54('0x2e')][_0x3b54('0x20')](_0x293593)[_0x3b54('0x27')](function(_0x1d95a1){_0xeacaad[_0x3b54('0x20')]=_0x1d95a1;if(_0x28dd6e['query'][_0x3b54('0x42')]){_0x57f73e[_0x3b54('0x43')]=[{'all':!![]}];}return db[_0x3b54('0x2e')][_0x3b54('0x44')](_0x57f73e);})[_0x3b54('0x27')](function(_0x3844f9){_0xeacaad[_0x3b54('0x45')]=_0x3844f9;return _0xeacaad;})[_0x3b54('0x27')](respondWithFilteredResult(_0x267b68,_0x57f73e))[_0x3b54('0x46')](handleError(_0x267b68,null));};exports[_0x3b54('0x47')]=function(_0x68d12d,_0x583dcb){var _0x3d75ab={'raw':![],'where':{'id':_0x68d12d[_0x3b54('0x48')]['id']}},_0x255478={};_0x255478[_0x3b54('0x31')]=_[_0x3b54('0x49')](db[_0x3b54('0x2e')]['rawAttributes']);_0x255478[_0x3b54('0x33')]=_[_0x3b54('0x49')](_0x68d12d['query']);_0x255478[_0x3b54('0x3c')]=_[_0x3b54('0x34')](_0x255478[_0x3b54('0x31')],_0x255478[_0x3b54('0x33')]);_0x3d75ab[_0x3b54('0x35')]=_[_0x3b54('0x34')](_0x255478[_0x3b54('0x31')],qs[_0x3b54('0x36')](_0x68d12d[_0x3b54('0x33')][_0x3b54('0x36')]));_0x3d75ab[_0x3b54('0x35')]=_0x3d75ab[_0x3b54('0x35')]['length']?_0x3d75ab['attributes']:_0x255478[_0x3b54('0x31')];if(_0x68d12d[_0x3b54('0x33')]['includeAll']){_0x3d75ab['include']=[{'all':!![]}];}_0x3d75ab=_[_0x3b54('0x3e')]({},_0x3d75ab,_0x68d12d[_0x3b54('0x41')]);return db[_0x3b54('0x2e')][_0x3b54('0x4a')](_0x3d75ab)[_0x3b54('0x27')](handleEntityNotFound(_0x583dcb,null))['then'](respondWithResult(_0x583dcb,null))[_0x3b54('0x46')](handleError(_0x583dcb,null));};exports[_0x3b54('0x4b')]=function(_0x89a518,_0x5a8d21){return db[_0x3b54('0x2e')][_0x3b54('0x4b')](_0x89a518[_0x3b54('0x4c')],{})[_0x3b54('0x27')](respondWithResult(_0x5a8d21,0xc9))[_0x3b54('0x46')](handleError(_0x5a8d21,null));};exports[_0x3b54('0x26')]=function(_0x319c6f,_0x577eaa){if(_0x319c6f[_0x3b54('0x4c')]['id']){delete _0x319c6f['body']['id'];}return db[_0x3b54('0x2e')][_0x3b54('0x4a')]({'where':{'id':_0x319c6f['params']['id']}})['then'](handleEntityNotFound(_0x577eaa,null))[_0x3b54('0x27')](saveUpdates(_0x319c6f[_0x3b54('0x4c')],null))['then'](respondWithResult(_0x577eaa,null))[_0x3b54('0x46')](handleError(_0x577eaa,null));};exports[_0x3b54('0x4d')]=function(_0x2cdebf,_0x348f0e){return db['VoiceRecording'][_0x3b54('0x4d')]()['then'](respondWithResult(_0x348f0e,null))[_0x3b54('0x46')](handleError(_0x348f0e,null));};exports[_0x3b54('0x4e')]=function(_0x103865,_0x408006,_0x165444){var _0xd5910e=require('../../components/encryptor');var _0x316375=![];var _0x181a10={};if(_0x103865[_0x3b54('0x33')]['type']&&_0x103865[_0x3b54('0x33')][_0x3b54('0x4f')]===_0x3b54('0x50')){_0x181a10[_0x3b54('0x50')]=_0x103865[_0x3b54('0x48')]['id'];}else{_0x181a10['id']=_0x103865[_0x3b54('0x48')]['id'];}return db[_0x3b54('0x2e')][_0x3b54('0x4a')]({'where':_0x181a10,'attributes':['id','value'],'raw':!![]})[_0x3b54('0x27')](handleEntityNotFound(_0x408006,null))[_0x3b54('0x27')](function(_0x95f968){if(_0x95f968){var _0x2b5b1a=_0x95f968[_0x3b54('0x51')];var _0x180022=util['format']('%s.cypher',_0x2b5b1a);if(fs[_0x3b54('0x52')](_0x180022)){_0x316375=!![];return _0xd5910e[_0x3b54('0x53')](_0x180022,_0x2b5b1a,config['secrets'][_0x3b54('0x54')])[_0x3b54('0x27')](function(){return _0x95f968;});}return _0x95f968;}})['then'](function(_0x4fdcc2){if(_0x4fdcc2){var _0x1bb0e2=_0x4fdcc2[_0x3b54('0x51')];if(!fs[_0x3b54('0x52')](_0x1bb0e2)){throw new db[(_0x3b54('0x55'))][(_0x3b54('0x56'))](_0x3b54('0x57'));}if(_0x4fdcc2['filename']){return _0x408006[_0x3b54('0x4e')](_0x1bb0e2,_0x4fdcc2[_0x3b54('0x58')]+path[_0x3b54('0x59')](_0x1bb0e2),function(){if(_0x316375){fs[_0x3b54('0x5a')](_0x1bb0e2);}});}else{return _0x408006[_0x3b54('0x4e')](_0x1bb0e2,function(_0x53d74a){if(_0x316375){fs[_0x3b54('0x5a')](_0x1bb0e2);}});}}})['catch'](function(_0x2fbda7){if(_0x2fbda7[_0x3b54('0x5b')]===_0x3b54('0x57')){_0x408006[_0x3b54('0x1a')](0x194)[_0x3b54('0x5c')]('Not\x20found');}else{return handleError(_0x408006,null);}});};exports[_0x3b54('0x5d')]=function(_0x5d2350,_0x175514,_0x58c547){var _0xa3e6db=require(_0x3b54('0x5e'));var _0x571d3d=![];var _0x52261b={'$and':[db[_0x3b54('0x5f')][_0x3b54('0x3d')](db[_0x3b54('0x5f')]['fn'](_0x3b54('0x60'),db[_0x3b54('0x5f')]['col']('uniqueid')),_0x5d2350[_0x3b54('0x33')]['token'])]};if(_0x5d2350[_0x3b54('0x33')]['type']&&_0x5d2350[_0x3b54('0x33')][_0x3b54('0x4f')]===_0x3b54('0x50')){_0x52261b[_0x3b54('0x61')][_0x3b54('0x62')]({'uniqueid':_0x5d2350[_0x3b54('0x48')]['id']});}else{_0x52261b[_0x3b54('0x61')][_0x3b54('0x62')]({'id':_0x5d2350[_0x3b54('0x48')]['id']});}return db[_0x3b54('0x2e')][_0x3b54('0x4a')]({'where':_0x52261b,'attributes':['id',_0x3b54('0x51')],'raw':!![]})[_0x3b54('0x27')](handleEntityNotFound(_0x175514,null))[_0x3b54('0x27')](function(_0x37bbac){if(_0x37bbac){var _0x4e6f42=util['format'](_0x3b54('0x63'),_0x37bbac[_0x3b54('0x51')]);if(fs['existsSync'](_0x4e6f42)){_0x571d3d=!![];return _0xa3e6db['decryptFile'](_0x4e6f42,_0x37bbac[_0x3b54('0x51')],config['secrets'][_0x3b54('0x54')])[_0x3b54('0x27')](function(){return _0x37bbac;});}return _0x37bbac;}})[_0x3b54('0x27')](function(_0x5a0e2b){if(_0x5a0e2b){if(!fs[_0x3b54('0x52')](_0x5a0e2b[_0x3b54('0x51')])){throw new db[(_0x3b54('0x55'))][(_0x3b54('0x56'))](_0x3b54('0x57'));}if(_0x5a0e2b[_0x3b54('0x58')]){return _0x175514[_0x3b54('0x4e')](_0x5a0e2b['value'],_0x5a0e2b['filename']+path[_0x3b54('0x59')](_0x5a0e2b['value']),function(){if(_0x571d3d){fs[_0x3b54('0x5a')](_0x5a0e2b[_0x3b54('0x51')]);}});}else{return _0x175514[_0x3b54('0x4e')](_0x5a0e2b['value'],function(_0x47fda8){if(_0x571d3d){fs[_0x3b54('0x5a')](_0x5a0e2b[_0x3b54('0x51')]);}});}}})[_0x3b54('0x46')](handleError(_0x175514,null));};exports[_0x3b54('0x64')]=function(_0x12191d,_0x39b733){return db[_0x3b54('0x2e')][_0x3b54('0x4a')]({'where':{'id':_0x12191d[_0x3b54('0x48')]['id']}})[_0x3b54('0x27')](function(_0x351fe4){if(_['isNil'](_0x351fe4)){throw new ReferenceError(_0x3b54('0x65'));}return _0x351fe4;})[_0x3b54('0x27')](function(_0x47e20e){var _0x15ae8c=_0x47e20e[_0x3b54('0x51')];logger[_0x3b54('0x66')](_0x3b54('0x67'),_0x15ae8c);if(!_[_0x3b54('0x68')](_0x47e20e[_0x3b54('0x51')])&&fs[_0x3b54('0x52')](_0x15ae8c)){logger['info'](_0x3b54('0x69')+_0x15ae8c+_0x3b54('0x6a'));fs['unlinkSync'](_0x15ae8c);}_0x15ae8c=_0x15ae8c+_0x3b54('0x6b');if(!_[_0x3b54('0x68')](_0x47e20e[_0x3b54('0x51')])&&fs[_0x3b54('0x52')](_0x15ae8c)){logger['info'](_0x3b54('0x69')+_0x15ae8c+_0x3b54('0x6a'));fs[_0x3b54('0x6c')](_0x15ae8c);}return _0x47e20e;})['then'](function(_0x27dcc8){if(!_0x27dcc8)throw new InternalError();return _0x27dcc8[_0x3b54('0x64')]();})[_0x3b54('0x27')](function(){_0x39b733['status'](0xcc)['end']();})[_0x3b54('0x46')](handleError(_0x39b733,null));};function getBucketslist(_0x3b818e,_0x54489a,_0x24624a){return new Promise(function(_0x791408,_0x35511a){var _0x90813b=new AWS['S3']({'accessKeyId':_0x54489a,'secretAccessKey':_0x3b818e,'region':_0x24624a});_0x90813b[_0x3b54('0x6d')]({},function(_0x576a28,_0x1ab956){if(_0x576a28){return _0x35511a(_0x576a28);}else{return _0x791408(_0x1ab956);}});});}function createBucket(_0x2caf50,_0x3af477,_0x51833d,_0xde7384){return new Promise(function(_0x2adeb5,_0x137046){var _0x1bb4ff=new AWS['S3']({'accessKeyId':_0x3af477,'secretAccessKey':_0x2caf50,'region':_0x51833d});_0x1bb4ff[_0x3b54('0x6e')]({'Bucket':_0xde7384},function(_0x5932c4,_0x3b1427){if(_0x5932c4){return _0x137046(_0x5932c4);}else{return _0x2adeb5(_0x3b1427);}});});}function uploadFile(_0x3f3b72,_0x5e333c,_0x29ad37,_0x3e4bb9,_0x1496bb,_0xc9beca){return new Promise(function(_0x147dce,_0x23c939){var _0xb7e256=new AWS['S3']({'accessKeyId':_0x5e333c,'secretAccessKey':_0x3f3b72,'region':_0x29ad37});_0xb7e256[_0x3b54('0x6f')]({'Bucket':_0x3e4bb9,'Key':_0x1496bb,'Body':_0xc9beca},function(_0x3b0a8f,_0xa5aa1f){if(_0x3b0a8f){return _0x23c939(_0x3b0a8f);}else{return _0x147dce(_0xa5aa1f);}});});}function startTranscribe(_0x435e8c,_0x220c1b,_0xbc7768,_0x5245e3,_0x5af102,_0x19867d){return new Promise(function(_0x278d4c,_0x359285){var _0x5e0a8c=new AWS['TranscribeService']({'accessKeyId':_0x220c1b,'secretAccessKey':_0x435e8c,'region':_0xbc7768});_0x5e0a8c[_0x3b54('0x70')]({'TranscriptionJobName':_0x5245e3,'LanguageCode':_0x5af102,'Media':{'MediaFileUri':_0x19867d}},function(_0x2a069a,_0x30d8e7){if(_0x2a069a){return _0x359285(_0x2a069a);}else{return _0x278d4c(_0x30d8e7);}});});}function transcribe(_0x47e4f4,_0x51724b,_0x271e7d,_0x3525f1,_0x5d211b,_0x3c7340,_0x3f2324){return new Promise(function(_0x280987,_0x2d997d){var _0x285b07={};logger[_0x3b54('0x66')](util[_0x3b54('0x32')](_0x3b54('0x71'),_0x47e4f4,_0x5d211b));return uploadFile(_0x51724b,_0x271e7d,_0x3525f1,_0x5d211b,path['basename'](_0x3c7340),fs[_0x3b54('0x72')](_0x3c7340))['then'](function(_0x32d2a1){logger['info'](util[_0x3b54('0x32')](_0x3b54('0x73'),_0x47e4f4,_0x5d211b,_0x32d2a1[_0x3b54('0x74')]));_0x285b07[_0x3b54('0x75')]=_0x32d2a1[_0x3b54('0x76')];_0x285b07[_0x3b54('0x77')]=_0x32d2a1[_0x3b54('0x74')];logger['info'](util[_0x3b54('0x32')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x47e4f4));return startTranscribe(_0x51724b,_0x271e7d,_0x3525f1,uuidv4(),_0x3f2324,_0x32d2a1[_0x3b54('0x74')]);})[_0x3b54('0x27')](function(_0x952acf){logger[_0x3b54('0x66')](util[_0x3b54('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x47e4f4,_0x952acf[_0x3b54('0x78')][_0x3b54('0x79')]));_0x285b07[_0x3b54('0x7a')]=_0x952acf[_0x3b54('0x78')][_0x3b54('0x79')];_0x285b07[_0x3b54('0x7b')]=_0x952acf[_0x3b54('0x78')][_0x3b54('0x7c')];return _0x280987(_0x285b07);})[_0x3b54('0x46')](function(_0x106f6d){return _0x2d997d(_0x106f6d);});});}exports[_0x3b54('0x7d')]=function(_0x5a26bb,_0xac220d,_0x4ff2df){var _0x4e9c9d;var _0x53a8ab;var _0x5a920f;var _0x4cf056=require(_0x3b54('0x5e'));return db[_0x3b54('0x2e')][_0x3b54('0x7e')]({'where':{'id':_0x5a26bb[_0x3b54('0x48')]['id']}})[_0x3b54('0x27')](function(_0x431260){if(_0x431260){var _0x4379ad=util[_0x3b54('0x32')](_0x3b54('0x63'),_0x431260[_0x3b54('0x51')]);if(fs[_0x3b54('0x52')](_0x4379ad)){cypher=!![];return _0x4cf056[_0x3b54('0x53')](_0x4379ad,_0x431260['value'],config[_0x3b54('0x7f')][_0x3b54('0x54')])[_0x3b54('0x27')](function(){return _0x431260;});}return _0x431260;}})[_0x3b54('0x27')](function(_0x37aa0b){if(!_0x37aa0b){throw new db[(_0x3b54('0x55'))][(_0x3b54('0x56'))](_0x3b54('0x80'));}_0x53a8ab=_0x37aa0b;return db[_0x3b54('0x81')][_0x3b54('0x7e')]({'where':{'id':0x1}});})[_0x3b54('0x27')](handleEntityNotFound(_0xac220d,null))[_0x3b54('0x27')](function(_0x55c49d){if(_0x55c49d){_0x4e9c9d=_0x55c49d;if(!_0x4e9c9d[_0x3b54('0x82')]||!_0x4e9c9d[_0x3b54('0x83')]||!_0x4e9c9d[_0x3b54('0x84')]||!_0x4e9c9d[_0x3b54('0x85')]||!_0x4e9c9d[_0x3b54('0x75')]){throw new db['Sequelize'][(_0x3b54('0x56'))](_0x3b54('0x86'));}if(_0x5a26bb[_0x3b54('0x4c')][_0x3b54('0x87')]&&(!_0x4e9c9d[_0x3b54('0x88')]||!_0x4e9c9d[_0x3b54('0x89')]||!_0x4e9c9d[_0x3b54('0x8a')]||!_0x4e9c9d[_0x3b54('0x85')]||!_0x4e9c9d[_0x3b54('0x75')])){throw new db[(_0x3b54('0x55'))][(_0x3b54('0x56'))](_0x3b54('0x8b'));}return db['CloudProvider'][_0x3b54('0x7e')]({'where':{'id':_0x4e9c9d[_0x3b54('0x83')]}});}})[_0x3b54('0x27')](function(_0x16dc48){if(!_0x16dc48){throw new db[(_0x3b54('0x55'))][(_0x3b54('0x56'))](_0x3b54('0x8c'));}if(!_0x16dc48[_0x3b54('0x8d')]||!_0x16dc48['data2']){throw new db[(_0x3b54('0x55'))][(_0x3b54('0x56'))](_0x3b54('0x8e'));}_0x5a920f=_0x16dc48;return getBucketslist(_0x5a920f[_0x3b54('0x8d')],_0x5a920f[_0x3b54('0x8f')],_0x4e9c9d['transcribeRegion']);})['then'](function(_0x305fa5){if(_0x305fa5&&_0x305fa5['Buckets']){var _0x2f643f=_[_0x3b54('0x4a')](_0x305fa5[_0x3b54('0x90')],function(_0x1fbfbe){return _0x1fbfbe[_0x3b54('0x91')]===_0x4e9c9d[_0x3b54('0x75')];});if(!_0x2f643f){logger[_0x3b54('0x66')](util[_0x3b54('0x32')](_0x3b54('0x92'),_0x5a26bb['params']['id'],_0x4e9c9d[_0x3b54('0x75')]));return createBucket(_0x5a920f[_0x3b54('0x8d')],_0x5a920f[_0x3b54('0x8f')],_0x4e9c9d[_0x3b54('0x84')],_0x4e9c9d[_0x3b54('0x75')]);}logger[_0x3b54('0x66')](util[_0x3b54('0x32')](_0x3b54('0x93'),_0x5a26bb[_0x3b54('0x48')]['id'],_0x4e9c9d[_0x3b54('0x75')]));return;}})[_0x3b54('0x27')](function(_0x42a5ee){if(_0x53a8ab[_0x3b54('0x7b')]===_0x3b54('0x94')){return transcribe(_0x5a26bb['params']['id'],_0x5a920f[_0x3b54('0x8d')],_0x5a920f[_0x3b54('0x8f')],_0x4e9c9d[_0x3b54('0x84')],_0x4e9c9d[_0x3b54('0x75')],_0x53a8ab[_0x3b54('0x51')],_0x4e9c9d[_0x3b54('0x85')]);}else{logger[_0x3b54('0x66')](util['format'](_0x3b54('0x95'),_0x5a26bb[_0x3b54('0x48')]['id']));return{'transcribeStatus':_0x3b54('0x96')};}})[_0x3b54('0x27')](function(_0x1e7e7e){if(_0x1e7e7e){_0x1e7e7e[_0x3b54('0x97')]=_0x5a26bb[_0x3b54('0x4c')][_0x3b54('0x87')];return _0x53a8ab['updateAttributes'](_0x1e7e7e);}})[_0x3b54('0x27')](respondWithResult(_0xac220d,null))[_0x3b54('0x46')](handleError(_0xac220d,null));};function writeFile(_0x34ee51,_0x25ebbb){return new Promise(function(_0x31da17,_0xa1ad83){fs['writeFile'](_0x25ebbb,_0x34ee51,function(_0x1f9a3b,_0x35a0d9){if(_0x1f9a3b){return _0xa1ad83(_0x1f9a3b);}else{return _0x31da17(_0x35a0d9);}});});}exports[_0x3b54('0x98')]=function(_0x429095,_0x1a4d93,_0x3dd6ad){return db[_0x3b54('0x2e')][_0x3b54('0x7e')]({'where':{'id':_0x429095[_0x3b54('0x48')]['id']}})[_0x3b54('0x27')](handleEntityNotFound(_0x1a4d93))[_0x3b54('0x27')](function(_0x23b442){if(_0x23b442&&_0x23b442[_0x3b54('0x99')]){var _0x257cd9=_0x23b442['fileText'];var _0x590ab6=config['root']+'/server/files/transcribes/transcribe_'+_0x23b442['id']+_0x3b54('0x9a');if(fs[_0x3b54('0x52')](_0x590ab6)){return _0x590ab6;}return writeFile(_0x257cd9,_0x590ab6)[_0x3b54('0x27')](function(){return _0x590ab6;});}else{throw new db[(_0x3b54('0x55'))][(_0x3b54('0x56'))](_0x3b54('0x9b'));}})[_0x3b54('0x27')](function(_0x4cb340){return _0x1a4d93[_0x3b54('0x4e')](_0x4cb340);})[_0x3b54('0x46')](handleError(_0x1a4d93));}; \ No newline at end of file +var _0xe23a=['format','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','merge','type','VIRTUAL','options','where','includeAll','include','findAll','catch','show','keys','find','update','body','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','secrets','unlink','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','listBuckets','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','sentimentAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','fileText','root','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','status','error','name','send','index','VoiceRecording','rawAttributes','model','differenceBy','map'];(function(_0x2e70de,_0x3d16bb){var _0x4a307c=function(_0x387606){while(--_0x387606){_0x2e70de['push'](_0x2e70de['shift']());}};_0x4a307c(++_0x3d16bb);}(_0xe23a,0xf8));var _0xae23=function(_0x216428,_0x5d20ea){_0x216428=_0x216428-0x0;var _0x313dd4=_0xe23a[_0x216428];return _0x313dd4;};'use strict';var emlformat=require(_0xae23('0x0'));var rimraf=require(_0xae23('0x1'));var zipdir=require(_0xae23('0x2'));var jsonpatch=require(_0xae23('0x3'));var rp=require(_0xae23('0x4'));var moment=require(_0xae23('0x5'));var BPromise=require(_0xae23('0x6'));var Mustache=require('mustache');var util=require(_0xae23('0x7'));var path=require(_0xae23('0x8'));var sox=require(_0xae23('0x9'));var csv=require('to-csv');var ejs=require(_0xae23('0xa'));var fs=require('fs');var fs_extra=require(_0xae23('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xae23('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xae23('0xd'));var toCsv=require(_0xae23('0xe'));var querystring=require('querystring');var Papa=require(_0xae23('0xf'));var AWS=require(_0xae23('0x10'));var uuidv4=require(_0xae23('0x11'));var Redis=require(_0xae23('0x12'));var authService=require(_0xae23('0x13'));var qs=require(_0xae23('0x14'));var as=require(_0xae23('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xae23('0x16'));var config=require(_0xae23('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xae23('0x18'))['db'];function respondWithStatusCode(_0x29a635,_0x2701eb){_0x2701eb=_0x2701eb||0xcc;return function(_0x22af2a){if(_0x22af2a){return _0x29a635[_0xae23('0x19')](_0x2701eb);}return _0x29a635['status'](_0x2701eb)[_0xae23('0x1a')]();};}function respondWithResult(_0x5b58c8,_0x4195ec){_0x4195ec=_0x4195ec||0xc8;return function(_0xd3934a){if(_0xd3934a){return _0x5b58c8['status'](_0x4195ec)[_0xae23('0x1b')](_0xd3934a);}};}function respondWithFilteredResult(_0x28f0bf,_0x66977a){return function(_0x29bfaf){if(_0x29bfaf){var _0xd8445c=typeof _0x66977a[_0xae23('0x1c')]===_0xae23('0x1d')&&typeof _0x66977a[_0xae23('0x1e')]==='undefined';var _0x54e466=_0x29bfaf[_0xae23('0x1f')];var _0x49ddcb=_0xd8445c?0x0:_0x66977a[_0xae23('0x1c')];var _0x550a23=_0xd8445c?_0x29bfaf[_0xae23('0x1f')]:_0x66977a['offset']+_0x66977a[_0xae23('0x1e')];var _0x16564c;if(_0x550a23>=_0x54e466){_0x550a23=_0x54e466;_0x16564c=0xc8;}else{_0x16564c=0xce;}_0x28f0bf['status'](_0x16564c);return _0x28f0bf['set'](_0xae23('0x20'),_0x49ddcb+'-'+_0x550a23+'/'+_0x54e466)[_0xae23('0x1b')](_0x29bfaf);}return null;};}function patchUpdates(_0x30e179){return function(_0xa870a5){try{jsonpatch[_0xae23('0x21')](_0xa870a5,_0x30e179,!![]);}catch(_0x325f08){return BPromise[_0xae23('0x22')](_0x325f08);}return _0xa870a5[_0xae23('0x23')]();};}function saveUpdates(_0xc4bffc,_0x2feedf){return function(_0x199b52){if(_0x199b52){return _0x199b52['update'](_0xc4bffc)[_0xae23('0x24')](function(_0x251bfe){return _0x251bfe;});}return null;};}function removeEntity(_0x44061c,_0x5b2a2c){return function(_0x31744d){if(_0x31744d){return _0x31744d[_0xae23('0x25')]()['then'](function(){_0x44061c[_0xae23('0x26')](0xcc)[_0xae23('0x1a')]();});}};}function handleEntityNotFound(_0x3b9035,_0x5c4004){return function(_0x86ac6a){if(!_0x86ac6a){_0x3b9035[_0xae23('0x19')](0x194);}return _0x86ac6a;};}function handleError(_0x432e30,_0x398bc7){_0x398bc7=_0x398bc7||0x1f4;return function(_0x21d8ce){logger[_0xae23('0x27')](_0x21d8ce['stack']);if(_0x21d8ce[_0xae23('0x28')]){delete _0x21d8ce[_0xae23('0x28')];}_0x432e30[_0xae23('0x26')](_0x398bc7)[_0xae23('0x29')](_0x21d8ce);};}exports[_0xae23('0x2a')]=function(_0x1c9b33,_0x48d6d4){var _0x5dba62={},_0x3e0436={},_0x1e6f3f={'count':0x0,'rows':[]};var _0x1e01b2=_['map'](db[_0xae23('0x2b')][_0xae23('0x2c')],function(_0x4a58d4){return{'name':_0x4a58d4['fieldName'],'type':_0x4a58d4['type']['key']};});_0x3e0436[_0xae23('0x2d')]=_[_0xae23('0x2e')](_[_0xae23('0x2f')](_0x1e01b2,_0xae23('0x28')),[_0xae23('0x30')]);_0x3e0436[_0xae23('0x31')]=_['keys'](_0x1c9b33[_0xae23('0x31')]);_0x3e0436[_0xae23('0x32')]=_[_0xae23('0x33')](_0x3e0436[_0xae23('0x2d')],_0x3e0436[_0xae23('0x31')]);_0x5dba62[_0xae23('0x34')]=_[_0xae23('0x33')](_0x3e0436['model'],qs['fields'](_0x1c9b33[_0xae23('0x31')][_0xae23('0x35')]));_0x5dba62[_0xae23('0x34')]=_0x5dba62[_0xae23('0x34')][_0xae23('0x36')]?_0x5dba62[_0xae23('0x34')]:_0x3e0436['model'];if(!_0x1c9b33['query']['hasOwnProperty'](_0xae23('0x37'))){_0x5dba62[_0xae23('0x1e')]=qs[_0xae23('0x1e')](_0x1c9b33[_0xae23('0x31')][_0xae23('0x1e')]);_0x5dba62['offset']=qs['offset'](_0x1c9b33[_0xae23('0x31')][_0xae23('0x1c')]);}_0x5dba62[_0xae23('0x38')]=qs[_0xae23('0x39')](_0x1c9b33[_0xae23('0x31')][_0xae23('0x39')]);_0x5dba62['where']=qs[_0xae23('0x32')](_['pick'](_0x1c9b33[_0xae23('0x31')],_0x3e0436[_0xae23('0x32')]),_0x1e01b2);if(_0x1c9b33['query'][_0xae23('0x3a')]){_0x5dba62['where']=_[_0xae23('0x3b')](_0x5dba62['where'],{'$or':_['map'](_0x1e01b2,function(_0x323e5b){if(_0x323e5b[_0xae23('0x3c')]!==_0xae23('0x3d')){var _0x1d0090={};_0x1d0090[_0x323e5b['name']]={'$like':'%'+_0x1c9b33[_0xae23('0x31')][_0xae23('0x3a')]+'%'};return _0x1d0090;}})});}_0x5dba62=_[_0xae23('0x3b')]({},_0x5dba62,_0x1c9b33[_0xae23('0x3e')]);var _0x558e53={'where':_0x5dba62[_0xae23('0x3f')]};return db['VoiceRecording']['count'](_0x558e53)[_0xae23('0x24')](function(_0x345b00){_0x1e6f3f[_0xae23('0x1f')]=_0x345b00;if(_0x1c9b33[_0xae23('0x31')][_0xae23('0x40')]){_0x5dba62[_0xae23('0x41')]=[{'all':!![]}];}return db[_0xae23('0x2b')][_0xae23('0x42')](_0x5dba62);})[_0xae23('0x24')](function(_0x4eaa99){_0x1e6f3f['rows']=_0x4eaa99;return _0x1e6f3f;})[_0xae23('0x24')](respondWithFilteredResult(_0x48d6d4,_0x5dba62))[_0xae23('0x43')](handleError(_0x48d6d4,null));};exports[_0xae23('0x44')]=function(_0x4dabd3,_0x240ba2){var _0x3c3ad1={'raw':![],'where':{'id':_0x4dabd3['params']['id']}},_0x1088b2={};_0x1088b2['model']=_[_0xae23('0x45')](db[_0xae23('0x2b')][_0xae23('0x2c')]);_0x1088b2[_0xae23('0x31')]=_[_0xae23('0x45')](_0x4dabd3[_0xae23('0x31')]);_0x1088b2[_0xae23('0x32')]=_['intersection'](_0x1088b2[_0xae23('0x2d')],_0x1088b2[_0xae23('0x31')]);_0x3c3ad1[_0xae23('0x34')]=_[_0xae23('0x33')](_0x1088b2[_0xae23('0x2d')],qs[_0xae23('0x35')](_0x4dabd3[_0xae23('0x31')][_0xae23('0x35')]));_0x3c3ad1[_0xae23('0x34')]=_0x3c3ad1[_0xae23('0x34')][_0xae23('0x36')]?_0x3c3ad1[_0xae23('0x34')]:_0x1088b2[_0xae23('0x2d')];if(_0x4dabd3[_0xae23('0x31')][_0xae23('0x40')]){_0x3c3ad1[_0xae23('0x41')]=[{'all':!![]}];}_0x3c3ad1=_[_0xae23('0x3b')]({},_0x3c3ad1,_0x4dabd3[_0xae23('0x3e')]);return db[_0xae23('0x2b')][_0xae23('0x46')](_0x3c3ad1)[_0xae23('0x24')](handleEntityNotFound(_0x240ba2,null))[_0xae23('0x24')](respondWithResult(_0x240ba2,null))[_0xae23('0x43')](handleError(_0x240ba2,null));};exports['create']=function(_0x2b56c6,_0x137b1){return db[_0xae23('0x2b')]['create'](_0x2b56c6['body'],{})[_0xae23('0x24')](respondWithResult(_0x137b1,0xc9))[_0xae23('0x43')](handleError(_0x137b1,null));};exports[_0xae23('0x47')]=function(_0x5ce694,_0x2e67d3){if(_0x5ce694[_0xae23('0x48')]['id']){delete _0x5ce694[_0xae23('0x48')]['id'];}return db[_0xae23('0x2b')][_0xae23('0x46')]({'where':{'id':_0x5ce694[_0xae23('0x49')]['id']}})[_0xae23('0x24')](handleEntityNotFound(_0x2e67d3,null))['then'](saveUpdates(_0x5ce694[_0xae23('0x48')],null))[_0xae23('0x24')](respondWithResult(_0x2e67d3,null))[_0xae23('0x43')](handleError(_0x2e67d3,null));};exports[_0xae23('0x4a')]=function(_0x3e35c2,_0x30b909){return db['VoiceRecording'][_0xae23('0x4a')]()[_0xae23('0x24')](respondWithResult(_0x30b909,null))[_0xae23('0x43')](handleError(_0x30b909,null));};exports[_0xae23('0x4b')]=function(_0x506964,_0x2ee1bb,_0x4deb5e){var _0x593794=require(_0xae23('0x4c'));var _0x203ed4=![];var _0x4a0330={};if(_0x506964[_0xae23('0x31')]['type']&&_0x506964[_0xae23('0x31')][_0xae23('0x3c')]===_0xae23('0x4d')){_0x4a0330['uniqueid']=_0x506964[_0xae23('0x49')]['id'];}else{_0x4a0330['id']=_0x506964[_0xae23('0x49')]['id'];}return db['VoiceRecording'][_0xae23('0x46')]({'where':_0x4a0330,'attributes':['id',_0xae23('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x2ee1bb,null))[_0xae23('0x24')](function(_0x84ed9f){if(_0x84ed9f){var _0x1b2dbb=_0x84ed9f[_0xae23('0x4e')];var _0x1e21c6=util[_0xae23('0x30')](_0xae23('0x4f'),_0x1b2dbb);if(fs[_0xae23('0x50')](_0x1e21c6)){_0x203ed4=!![];return _0x593794[_0xae23('0x51')](_0x1e21c6,_0x1b2dbb,config['secrets'][_0xae23('0x52')])[_0xae23('0x24')](function(){return _0x84ed9f;});}return _0x84ed9f;}})[_0xae23('0x24')](function(_0x4ccc6b){if(_0x4ccc6b){var _0xa95db6=_0x4ccc6b[_0xae23('0x4e')];if(!fs[_0xae23('0x50')](_0xa95db6)){throw new db[(_0xae23('0x53'))][(_0xae23('0x54'))](_0xae23('0x55'));}if(_0x4ccc6b[_0xae23('0x56')]){return _0x2ee1bb[_0xae23('0x4b')](_0xa95db6,_0x4ccc6b['filename']+path[_0xae23('0x57')](_0xa95db6),function(){if(_0x203ed4){fs['unlink'](_0xa95db6);}});}else{return _0x2ee1bb[_0xae23('0x4b')](_0xa95db6,function(_0x415bf4){if(_0x203ed4){fs['unlink'](_0xa95db6);}});}}})[_0xae23('0x43')](function(_0x1b8642){if(_0x1b8642[_0xae23('0x58')]==='VoiceRecording\x20not\x20found'){_0x2ee1bb[_0xae23('0x26')](0x194)[_0xae23('0x29')](_0xae23('0x59'));}else{return handleError(_0x2ee1bb,null);}});};exports[_0xae23('0x5a')]=function(_0x59ed32,_0x39fdfb,_0x40fa04){var _0x1a9593=require('../../components/encryptor');var _0x4fe672=![];var _0x22ce90={'$and':[db['sequelize'][_0xae23('0x3f')](db[_0xae23('0x5b')]['fn'](_0xae23('0x5c'),db[_0xae23('0x5b')][_0xae23('0x5d')](_0xae23('0x4d'))),_0x59ed32[_0xae23('0x31')][_0xae23('0x5e')])]};if(_0x59ed32[_0xae23('0x31')][_0xae23('0x3c')]&&_0x59ed32['query'][_0xae23('0x3c')]===_0xae23('0x4d')){_0x22ce90[_0xae23('0x5f')][_0xae23('0x60')]({'uniqueid':_0x59ed32[_0xae23('0x49')]['id']});}else{_0x22ce90['$and']['push']({'id':_0x59ed32[_0xae23('0x49')]['id']});}return db[_0xae23('0x2b')][_0xae23('0x46')]({'where':_0x22ce90,'attributes':['id',_0xae23('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x39fdfb,null))[_0xae23('0x24')](function(_0x616598){if(_0x616598){var _0x296597=util[_0xae23('0x30')](_0xae23('0x4f'),_0x616598[_0xae23('0x4e')]);if(fs['existsSync'](_0x296597)){_0x4fe672=!![];return _0x1a9593[_0xae23('0x51')](_0x296597,_0x616598[_0xae23('0x4e')],config[_0xae23('0x61')]['recording'])['then'](function(){return _0x616598;});}return _0x616598;}})[_0xae23('0x24')](function(_0x5149e9){if(_0x5149e9){if(!fs[_0xae23('0x50')](_0x5149e9[_0xae23('0x4e')])){throw new db['Sequelize']['ValidationError'](_0xae23('0x55'));}if(_0x5149e9[_0xae23('0x56')]){return _0x39fdfb[_0xae23('0x4b')](_0x5149e9[_0xae23('0x4e')],_0x5149e9['filename']+path[_0xae23('0x57')](_0x5149e9[_0xae23('0x4e')]),function(){if(_0x4fe672){fs[_0xae23('0x62')](_0x5149e9[_0xae23('0x4e')]);}});}else{return _0x39fdfb[_0xae23('0x4b')](_0x5149e9['value'],function(_0x481324){if(_0x4fe672){fs[_0xae23('0x62')](_0x5149e9[_0xae23('0x4e')]);}});}}})['catch'](handleError(_0x39fdfb,null));};exports['destroy']=function(_0x101297,_0x3cfac6){return db['VoiceRecording'][_0xae23('0x46')]({'where':{'id':_0x101297[_0xae23('0x49')]['id']}})[_0xae23('0x24')](function(_0x5c2c6a){if(_['isNil'](_0x5c2c6a)){throw new ReferenceError(_0xae23('0x63'));}return _0x5c2c6a;})[_0xae23('0x24')](function(_0x1a68f6){var _0x161165=_0x1a68f6['value'];logger[_0xae23('0x64')](_0xae23('0x65'),_0x161165);if(!_['isNil'](_0x1a68f6['value'])&&fs[_0xae23('0x50')](_0x161165)){logger[_0xae23('0x64')](_0xae23('0x66')+_0x161165+_0xae23('0x67'));fs[_0xae23('0x68')](_0x161165);}_0x161165=_0x161165+_0xae23('0x69');if(!_[_0xae23('0x6a')](_0x1a68f6[_0xae23('0x4e')])&&fs[_0xae23('0x50')](_0x161165)){logger['info'](_0xae23('0x66')+_0x161165+_0xae23('0x67'));fs[_0xae23('0x68')](_0x161165);}return _0x1a68f6;})[_0xae23('0x24')](function(_0x2264a0){if(!_0x2264a0)throw new InternalError();return _0x2264a0[_0xae23('0x25')]();})['then'](function(){_0x3cfac6[_0xae23('0x26')](0xcc)[_0xae23('0x1a')]();})[_0xae23('0x43')](handleError(_0x3cfac6,null));};function getBucketslist(_0x51903f,_0x238d2b,_0x27ea75){return new Promise(function(_0x2afda7,_0x56c3ec){var _0x3547b6=new AWS['S3']({'accessKeyId':_0x238d2b,'secretAccessKey':_0x51903f,'region':_0x27ea75});_0x3547b6[_0xae23('0x6b')]({},function(_0x19e438,_0x23466f){if(_0x19e438){return _0x56c3ec(_0x19e438);}else{return _0x2afda7(_0x23466f);}});});}function createBucket(_0x2481e1,_0x2b348a,_0x5b778f,_0x1cab3f){return new Promise(function(_0x3045cf,_0x1c7fcd){var _0x556b36=new AWS['S3']({'accessKeyId':_0x2b348a,'secretAccessKey':_0x2481e1,'region':_0x5b778f});_0x556b36['createBucket']({'Bucket':_0x1cab3f},function(_0x2ba557,_0x52fd1f){if(_0x2ba557){return _0x1c7fcd(_0x2ba557);}else{return _0x3045cf(_0x52fd1f);}});});}function uploadFile(_0x3683f6,_0x368f2b,_0x4c09e2,_0x479d4a,_0x318318,_0x2c373e){return new Promise(function(_0x3ac403,_0x269f29){var _0x498830=new AWS['S3']({'accessKeyId':_0x368f2b,'secretAccessKey':_0x3683f6,'region':_0x4c09e2});_0x498830[_0xae23('0x6c')]({'Bucket':_0x479d4a,'Key':_0x318318,'Body':_0x2c373e},function(_0x3666c9,_0x36517e){if(_0x3666c9){return _0x269f29(_0x3666c9);}else{return _0x3ac403(_0x36517e);}});});}function startTranscribe(_0x3b1f81,_0x371ddb,_0x359423,_0x41a4e8,_0x50d6c3,_0x43291d){return new Promise(function(_0x4150a3,_0x25d635){var _0x3d1112=new AWS['TranscribeService']({'accessKeyId':_0x371ddb,'secretAccessKey':_0x3b1f81,'region':_0x359423});_0x3d1112['startTranscriptionJob']({'TranscriptionJobName':_0x41a4e8,'LanguageCode':_0x50d6c3,'Media':{'MediaFileUri':_0x43291d}},function(_0x42c653,_0x17c728){if(_0x42c653){return _0x25d635(_0x42c653);}else{return _0x4150a3(_0x17c728);}});});}function transcribe(_0x5e24bc,_0x229c15,_0x56896b,_0x91a703,_0x561e26,_0x18e7be,_0x22a9b2){return new Promise(function(_0x3b6d98,_0x3e626f){var _0x3ead64={};logger[_0xae23('0x64')](util[_0xae23('0x30')](_0xae23('0x6d'),_0x5e24bc,_0x561e26));return uploadFile(_0x229c15,_0x56896b,_0x91a703,_0x561e26,path[_0xae23('0x6e')](_0x18e7be),fs[_0xae23('0x6f')](_0x18e7be))[_0xae23('0x24')](function(_0x150569){logger['info'](util[_0xae23('0x30')](_0xae23('0x70'),_0x5e24bc,_0x561e26,_0x150569[_0xae23('0x71')]));_0x3ead64[_0xae23('0x72')]=_0x150569[_0xae23('0x73')];_0x3ead64['location']=_0x150569[_0xae23('0x71')];logger[_0xae23('0x64')](util[_0xae23('0x30')](_0xae23('0x74'),_0x5e24bc));return startTranscribe(_0x229c15,_0x56896b,_0x91a703,uuidv4(),_0x22a9b2,_0x150569[_0xae23('0x71')]);})[_0xae23('0x24')](function(_0x56c346){logger[_0xae23('0x64')](util[_0xae23('0x30')](_0xae23('0x75'),_0x5e24bc,_0x56c346[_0xae23('0x76')][_0xae23('0x77')]));_0x3ead64[_0xae23('0x78')]=_0x56c346[_0xae23('0x76')][_0xae23('0x77')];_0x3ead64[_0xae23('0x79')]=_0x56c346['TranscriptionJob'][_0xae23('0x7a')];return _0x3b6d98(_0x3ead64);})[_0xae23('0x43')](function(_0x4ab2f0){return _0x3e626f(_0x4ab2f0);});});}exports[_0xae23('0x7b')]=function(_0xfeb5a3,_0x1888b9,_0x59a4c3){var _0x20ba38;var _0x5cc305;var _0x261783;var _0xa49c9d=require('../../components/encryptor');return db[_0xae23('0x2b')][_0xae23('0x7c')]({'where':{'id':_0xfeb5a3[_0xae23('0x49')]['id']}})['then'](function(_0x49b0a6){if(_0x49b0a6){var _0x11c050=util[_0xae23('0x30')](_0xae23('0x4f'),_0x49b0a6[_0xae23('0x4e')]);if(fs[_0xae23('0x50')](_0x11c050)){cypher=!![];return _0xa49c9d['decryptFile'](_0x11c050,_0x49b0a6[_0xae23('0x4e')],config['secrets']['recording'])['then'](function(){return _0x49b0a6;});}return _0x49b0a6;}})[_0xae23('0x24')](function(_0x26e4e9){if(!_0x26e4e9){throw new db[(_0xae23('0x53'))]['ValidationError'](_0xae23('0x7d'));}_0x5cc305=_0x26e4e9;return db[_0xae23('0x7e')][_0xae23('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x1888b9,null))['then'](function(_0x50d905){if(_0x50d905){_0x20ba38=_0x50d905;if(!_0x20ba38[_0xae23('0x7f')]||!_0x20ba38[_0xae23('0x80')]||!_0x20ba38[_0xae23('0x81')]||!_0x20ba38[_0xae23('0x82')]||!_0x20ba38['bucket']){throw new db[(_0xae23('0x53'))][(_0xae23('0x54'))]('Transcribe\x20not\x20configured');}if(_0xfeb5a3[_0xae23('0x48')]['runSentiment']&&(!_0x20ba38['sentiment']||!_0x20ba38[_0xae23('0x83')]||!_0x20ba38['sentimentRegion']||!_0x20ba38['language']||!_0x20ba38['bucket'])){throw new db[(_0xae23('0x53'))][(_0xae23('0x54'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0xae23('0x7c')]({'where':{'id':_0x20ba38['transcribeAccountId']}});}})[_0xae23('0x24')](function(_0x52d6e6){if(!_0x52d6e6){throw new db[(_0xae23('0x53'))][(_0xae23('0x54'))](_0xae23('0x84'));}if(!_0x52d6e6[_0xae23('0x85')]||!_0x52d6e6[_0xae23('0x86')]){throw new db[(_0xae23('0x53'))][(_0xae23('0x54'))](_0xae23('0x87'));}_0x261783=_0x52d6e6;return getBucketslist(_0x261783[_0xae23('0x85')],_0x261783[_0xae23('0x86')],_0x20ba38[_0xae23('0x81')]);})['then'](function(_0x8b681b){if(_0x8b681b&&_0x8b681b[_0xae23('0x88')]){var _0x4cfd19=_['find'](_0x8b681b[_0xae23('0x88')],function(_0x3e1963){return _0x3e1963[_0xae23('0x89')]===_0x20ba38[_0xae23('0x72')];});if(!_0x4cfd19){logger[_0xae23('0x64')](util['format'](_0xae23('0x8a'),_0xfeb5a3[_0xae23('0x49')]['id'],_0x20ba38['bucket']));return createBucket(_0x261783[_0xae23('0x85')],_0x261783[_0xae23('0x86')],_0x20ba38['transcribeRegion'],_0x20ba38[_0xae23('0x72')]);}logger[_0xae23('0x64')](util[_0xae23('0x30')](_0xae23('0x8b'),_0xfeb5a3[_0xae23('0x49')]['id'],_0x20ba38[_0xae23('0x72')]));return;}})[_0xae23('0x24')](function(_0xb925da){if(_0x5cc305['transcribeStatus']===_0xae23('0x8c')){return transcribe(_0xfeb5a3[_0xae23('0x49')]['id'],_0x261783[_0xae23('0x85')],_0x261783[_0xae23('0x86')],_0x20ba38[_0xae23('0x81')],_0x20ba38[_0xae23('0x72')],_0x5cc305[_0xae23('0x4e')],_0x20ba38[_0xae23('0x82')]);}else{logger[_0xae23('0x64')](util[_0xae23('0x30')](_0xae23('0x8d'),_0xfeb5a3['params']['id']));return{'transcribeStatus':_0xae23('0x8e')};}})[_0xae23('0x24')](function(_0x3cad5c){if(_0x3cad5c){_0x3cad5c[_0xae23('0x8f')]=_0xfeb5a3['body']['runSentiment'];return _0x5cc305['updateAttributes'](_0x3cad5c);}})[_0xae23('0x24')](respondWithResult(_0x1888b9,null))[_0xae23('0x43')](handleError(_0x1888b9,null));};function writeFile(_0x1b2533,_0x26352e){return new Promise(function(_0x27d206,_0x34d20a){fs[_0xae23('0x90')](_0x26352e,_0x1b2533,function(_0x2e7519,_0x36c5be){if(_0x2e7519){return _0x34d20a(_0x2e7519);}else{return _0x27d206(_0x36c5be);}});});}exports['downloadTranscribe']=function(_0x44aee1,_0x4e6f49,_0x190b87){return db[_0xae23('0x2b')][_0xae23('0x7c')]({'where':{'id':_0x44aee1[_0xae23('0x49')]['id']}})['then'](handleEntityNotFound(_0x4e6f49))[_0xae23('0x24')](function(_0x328a3d){if(_0x328a3d&&_0x328a3d[_0xae23('0x91')]){var _0x3b6afc=_0x328a3d[_0xae23('0x91')];var _0x86a114=config[_0xae23('0x92')]+'/server/files/transcribes/transcribe_'+_0x328a3d['id']+'.txt';if(fs['existsSync'](_0x86a114)){return _0x86a114;}return writeFile(_0x3b6afc,_0x86a114)[_0xae23('0x24')](function(){return _0x86a114;});}else{throw new db[(_0xae23('0x53'))]['ValidationError'](_0xae23('0x93'));}})[_0xae23('0x24')](function(_0x29ab7e){return _0x4e6f49['download'](_0x29ab7e);})[_0xae23('0x43')](handleError(_0x4e6f49));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 736b2bd..5665534 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 _0x5612=['../../config/environment','exports','define','voice_recordings','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1db9c9,_0x358fb5){var _0x2e02ef=function(_0x4e3b6d){while(--_0x4e3b6d){_0x1db9c9['push'](_0x1db9c9['shift']());}};_0x2e02ef(++_0x358fb5);}(_0x5612,0x149));var _0x2561=function(_0x22f945,_0x403922){_0x22f945=_0x22f945-0x0;var _0x43e7d4=_0x5612[_0x22f945];return _0x43e7d4;};'use strict';var _=require(_0x2561('0x0'));var util=require('util');var logger=require(_0x2561('0x1'))(_0x2561('0x2'));var moment=require(_0x2561('0x3'));var BPromise=require('bluebird');var rp=require(_0x2561('0x4'));var fs=require('fs');var path=require(_0x2561('0x5'));var rimraf=require(_0x2561('0x6'));var config=require(_0x2561('0x7'));var attributes=require('./voiceRecording.attributes');module[_0x2561('0x8')]=function(_0x13b938,_0x3854b3){return _0x13b938[_0x2561('0x9')]('VoiceRecording',attributes,{'tableName':_0x2561('0xa'),'paranoid':![],'indexes':[{'name':_0x2561('0xb'),'fields':[_0x2561('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x51f9=['rimraf','../../config/environment','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','lodash','util','api','moment','bluebird','path'];(function(_0x353509,_0x33002e){var _0x4f1914=function(_0x4e660b){while(--_0x4e660b){_0x353509['push'](_0x353509['shift']());}};_0x4f1914(++_0x33002e);}(_0x51f9,0x132));var _0x951f=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0x51f9[_0x28e74e];return _0xb45ac1;};'use strict';var _=require(_0x951f('0x0'));var util=require(_0x951f('0x1'));var logger=require('../../config/logger')(_0x951f('0x2'));var moment=require(_0x951f('0x3'));var BPromise=require(_0x951f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x951f('0x5'));var rimraf=require(_0x951f('0x6'));var config=require(_0x951f('0x7'));var attributes=require(_0x951f('0x8'));module[_0x951f('0x9')]=function(_0xd80e8a,_0x2ca4e0){return _0xd80e8a['define'](_0x951f('0xa'),attributes,{'tableName':_0x951f('0xb'),'paranoid':![],'indexes':[{'name':_0x951f('0xc'),'fields':[_0x951f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 76bf59c..c19c709 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 _0x7bd0=['callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','VoiceRecording','update','body','options','raw','attributes','UpdateVoiceRecording','CreateVoiceRecording','Setting','findOne'];(function(_0x4da356,_0x5235e1){var _0x321b07=function(_0x2bc6f4){while(--_0x2bc6f4){_0x4da356['push'](_0x4da356['shift']());}};_0x321b07(++_0x5235e1);}(_0x7bd0,0x111));var _0x07bd=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x7bd0[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('VoiceRecording,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});}exports['UpdateVoiceRecording']=function(_0x3f9f0b){var _0xc4cf4c=this;return new Promise(function(_0x4948f4,_0x3e8ec4){return db[_0x07bd('0x19')][_0x07bd('0x1a')](_0x3f9f0b[_0x07bd('0x1b')],{'raw':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')][_0x07bd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')]['where']||null:null,'attributes':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')][_0x07bd('0x1e')]||null:null,'limit':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')]['limit']||null:null})['then'](function(_0xbb7117){logger['info'](_0x07bd('0x1f'),_0x3f9f0b);logger['debug']('UpdateVoiceRecording',_0x3f9f0b,JSON[_0x07bd('0x13')](_0xbb7117));_0x4948f4(_0xbb7117);})[_0x07bd('0x18')](function(_0xf3b23c){logger[_0x07bd('0x14')](_0x07bd('0x1f'),_0xf3b23c[_0x07bd('0x16')],_0x3f9f0b);_0x3e8ec4(_0xc4cf4c['error'](0x1f4,_0xf3b23c[_0x07bd('0x16')]));});});};exports[_0x07bd('0x20')]=function(_0x3db9d0){var _0x2a7202=this;return new Promise(function(_0x12ce26,_0x1c1fda){var _0x571dab=require('../../components/encryptor');var _0x5184dc;return db[_0x07bd('0x21')][_0x07bd('0x22')]({'attributes':['id',_0x07bd('0x23')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x1a3aa9){_0x5184dc=_0x1a3aa9;return db[_0x07bd('0x19')][_0x07bd('0x24')](_0x3db9d0[_0x07bd('0x1b')]);})[_0x07bd('0xe')](function(_0x13bf6b){if(_0x5184dc['callRecordingEncryption']&&fs[_0x07bd('0x25')](_0x13bf6b[_0x07bd('0x26')])){var _0x4182b9=util[_0x07bd('0x27')](_0x07bd('0x28'),_0x13bf6b[_0x07bd('0x26')]);return _0x571dab[_0x07bd('0x29')](_0x13bf6b[_0x07bd('0x26')],_0x4182b9,config['secrets']['recording'])[_0x07bd('0xe')](function(){fs[_0x07bd('0x2a')](_0x13bf6b[_0x07bd('0x26')]);logger['info'](_0x07bd('0x2b'));return _0x13bf6b;});}return _0x13bf6b;})[_0x07bd('0xe')](function(_0x208aca){logger['info']('CreateVoiceRecording',_0x3db9d0);logger[_0x07bd('0x11')](_0x07bd('0x20'),_0x3db9d0,JSON[_0x07bd('0x13')](_0x208aca));_0x12ce26(_0x208aca);})[_0x07bd('0x18')](function(_0x5f29c5){logger[_0x07bd('0x14')](_0x07bd('0x20'),_0x5f29c5[_0x07bd('0x16')],_0x3db9d0);_0x1c1fda(_0x2a7202['error'](0x1f4,_0x5f29c5[_0x07bd('0x16')]));});});}; \ No newline at end of file +var _0x955f=['randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','update','body','options','raw','where','attributes','limit','debug','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird'];(function(_0x2b8a0f,_0x115e53){var _0x120d49=function(_0x25aaeb){while(--_0x25aaeb){_0x2b8a0f['push'](_0x2b8a0f['shift']());}};_0x120d49(++_0x115e53);}(_0x955f,0x1eb));var _0xf955=function(_0x33b455,_0x3395b5){_0x33b455=_0x33b455-0x0;var _0x359e3d=_0x955f[_0x33b455];return _0x359e3d;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});}exports['UpdateVoiceRecording']=function(_0x5ac6cb){var _0x1e20d1=this;return new Promise(function(_0xe6de5c,_0x3c49c0){return db['VoiceRecording'][_0xf955('0x15')](_0x5ac6cb[_0xf955('0x16')],{'raw':_0x5ac6cb[_0xf955('0x17')]?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ac6cb['options']?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x19')]||null:null,'attributes':_0x5ac6cb[_0xf955('0x17')]?_0x5ac6cb['options'][_0xf955('0x1a')]||null:null,'limit':_0x5ac6cb['options']?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x1b')]||null:null})[_0xf955('0xb')](function(_0xa4ebb4){logger[_0xf955('0xc')]('UpdateVoiceRecording',_0x5ac6cb);logger[_0xf955('0x1c')](_0xf955('0x1d'),_0x5ac6cb,JSON[_0xf955('0x10')](_0xa4ebb4));_0xe6de5c(_0xa4ebb4);})[_0xf955('0x14')](function(_0x17dec2){logger[_0xf955('0x11')](_0xf955('0x1d'),_0x17dec2['message'],_0x5ac6cb);_0x3c49c0(_0x1e20d1[_0xf955('0x11')](0x1f4,_0x17dec2[_0xf955('0x12')]));});});};exports[_0xf955('0x1e')]=function(_0x406632){var _0x2dcd55=this;return new Promise(function(_0x13a86d,_0x3796f7){var _0x51f3ab=require(_0xf955('0x1f'));var _0x145098;return db[_0xf955('0x20')][_0xf955('0x21')]({'attributes':['id',_0xf955('0x22')],'where':{'id':0x1},'raw':!![]})[_0xf955('0xb')](function(_0x4d4af0){_0x145098=_0x4d4af0;return db[_0xf955('0x23')][_0xf955('0x24')](_0x406632['body']);})[_0xf955('0xb')](function(_0x2c8df1){if(_0x145098[_0xf955('0x22')]&&fs[_0xf955('0x25')](_0x2c8df1['value'])){var _0x3a951c=util['format'](_0xf955('0x26'),_0x2c8df1[_0xf955('0x27')]);return _0x51f3ab[_0xf955('0x28')](_0x2c8df1[_0xf955('0x27')],_0x3a951c,config[_0xf955('0x29')][_0xf955('0x2a')])[_0xf955('0xb')](function(){fs[_0xf955('0x2b')](_0x2c8df1['value']);logger[_0xf955('0xc')](_0xf955('0x2c'));return _0x2c8df1;});}return _0x2c8df1;})[_0xf955('0xb')](function(_0x2046c8){logger['info'](_0xf955('0x1e'),_0x406632);logger[_0xf955('0x1c')](_0xf955('0x1e'),_0x406632,JSON[_0xf955('0x10')](_0x2046c8));_0x13a86d(_0x2046c8);})[_0xf955('0x14')](function(_0x4eb2c3){logger['error']('CreateVoiceRecording',_0x4eb2c3[_0xf955('0x12')],_0x406632);_0x3796f7(_0x2dcd55[_0xf955('0x11')](0x1f4,_0x4eb2c3[_0xf955('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index be11d8d..7de43cb 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 _0xb624=['describe','/:id','show','create','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x2e9b90,_0x1e61e7){var _0x326972=function(_0x250354){while(--_0x250354){_0x2e9b90['push'](_0x2e9b90['shift']());}};_0x326972(++_0x1e61e7);}(_0xb624,0x1e3));var _0x4b62=function(_0x46d613,_0xf6aa29){_0x46d613=_0x46d613-0x0;var _0x3494e1=_0xb624[_0x46d613];return _0x3494e1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4b62('0x0'));var timeout=require(_0x4b62('0x1'));var express=require('express');var router=express[_0x4b62('0x2')]();var fs_extra=require(_0x4b62('0x3'));var auth=require(_0x4b62('0x4'));var interaction=require(_0x4b62('0x5'));var config=require(_0x4b62('0x6'));var controller=require('./voiceTransferReport.controller');router[_0x4b62('0x7')]('/',auth[_0x4b62('0x8')](),controller[_0x4b62('0x9')]);router[_0x4b62('0x7')](_0x4b62('0xa'),auth[_0x4b62('0x8')](),controller[_0x4b62('0xb')]);router[_0x4b62('0x7')](_0x4b62('0xc'),auth['isAuthenticated'](),controller[_0x4b62('0xd')]);router['post']('/',auth[_0x4b62('0x8')](),controller[_0x4b62('0xe')]);router['put'](_0x4b62('0xc'),auth[_0x4b62('0x8')](),controller[_0x4b62('0xf')]);router[_0x4b62('0x10')](_0x4b62('0xc'),auth['isAuthenticated'](),controller[_0x4b62('0x11')]);module[_0x4b62('0x12')]=router; \ No newline at end of file +var _0x7fcc=['../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x3bfa61,_0x55e0ca){var _0xc7e3c=function(_0x7a4020){while(--_0x7a4020){_0x3bfa61['push'](_0x3bfa61['shift']());}};_0xc7e3c(++_0x55e0ca);}(_0x7fcc,0x163));var _0xc7fc=function(_0x1398b7,_0x9d2d6c){_0x1398b7=_0x1398b7-0x0;var _0x4a8ec3=_0x7fcc[_0x1398b7];return _0x4a8ec3;};'use strict';var multer=require(_0xc7fc('0x0'));var util=require(_0xc7fc('0x1'));var path=require(_0xc7fc('0x2'));var timeout=require('connect-timeout');var express=require(_0xc7fc('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc7fc('0x4'));var interaction=require(_0xc7fc('0x5'));var config=require(_0xc7fc('0x6'));var controller=require(_0xc7fc('0x7'));router['get']('/',auth[_0xc7fc('0x8')](),controller[_0xc7fc('0x9')]);router[_0xc7fc('0xa')]('/describe',auth[_0xc7fc('0x8')](),controller[_0xc7fc('0xb')]);router[_0xc7fc('0xa')](_0xc7fc('0xc'),auth['isAuthenticated'](),controller[_0xc7fc('0xd')]);router[_0xc7fc('0xe')]('/',auth[_0xc7fc('0x8')](),controller[_0xc7fc('0xf')]);router[_0xc7fc('0x10')](_0xc7fc('0xc'),auth[_0xc7fc('0x8')](),controller['update']);router[_0xc7fc('0x11')](_0xc7fc('0xc'),auth[_0xc7fc('0x8')](),controller[_0xc7fc('0x12')]);module[_0xc7fc('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 017a133..e4925ee 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 _0x086d=['ENUM','Yes','sequelize','moment','exports','blind','attended','STRING'];(function(_0x2ce32b,_0x311247){var _0x50c216=function(_0x54d162){while(--_0x54d162){_0x2ce32b['push'](_0x2ce32b['shift']());}};_0x50c216(++_0x311247);}(_0x086d,0x8a));var _0xd086=function(_0x43d3ba,_0x33da89){_0x43d3ba=_0x43d3ba-0x0;var _0x350175=_0x086d[_0x43d3ba];return _0x350175;};'use strict';var Sequelize=require(_0xd086('0x0'));var moment=require(_0xd086('0x1'));module[_0xd086('0x2')]={'type':{'type':Sequelize['ENUM'](_0xd086('0x3'),_0xd086('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xd086('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xd086('0x5')]},'transferercalleridname':{'type':Sequelize[_0xd086('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xd086('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xd086('0x5')]},'transferercontext':{'type':Sequelize[_0xd086('0x5')]},'transfererexten':{'type':Sequelize[_0xd086('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xd086('0x5')]},'transfereechannel':{'type':Sequelize[_0xd086('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xd086('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xd086('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xd086('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xd086('0x5')]},'transfereecontext':{'type':Sequelize[_0xd086('0x5')]},'transfereeexten':{'type':Sequelize[_0xd086('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xd086('0x5')]},'isexternal':{'type':Sequelize[_0xd086('0x6')](_0xd086('0x7'),'No')},'context':{'type':Sequelize[_0xd086('0x5')]},'extension':{'type':Sequelize[_0xd086('0x5')]}}; \ No newline at end of file +var _0x6147=['exports','ENUM','attended','STRING','sequelize'];(function(_0x2b34d5,_0x88c404){var _0x5439fc=function(_0x3697ee){while(--_0x3697ee){_0x2b34d5['push'](_0x2b34d5['shift']());}};_0x5439fc(++_0x88c404);}(_0x6147,0x11c));var _0x7614=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x6147[_0x44946b];return _0x249bc4;};'use strict';var Sequelize=require(_0x7614('0x0'));var moment=require('moment');module[_0x7614('0x1')]={'type':{'type':Sequelize[_0x7614('0x2')]('blind',_0x7614('0x3'))},'result':{'type':Sequelize[_0x7614('0x4')]},'transfererchannel':{'type':Sequelize[_0x7614('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x7614('0x4')]},'transferercalleridname':{'type':Sequelize[_0x7614('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7614('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x7614('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x7614('0x4')]},'transferercontext':{'type':Sequelize[_0x7614('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x7614('0x4')]},'transfereechannel':{'type':Sequelize[_0x7614('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x7614('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x7614('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x7614('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x7614('0x4')]},'transfereecontext':{'type':Sequelize[_0x7614('0x4')]},'transfereeexten':{'type':Sequelize[_0x7614('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x7614('0x4')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0x7614('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index d80fa83..555b45e 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 _0x6602=['save','update','then','destroy','end','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject'];(function(_0x329c79,_0x35c249){var _0x491a86=function(_0x7cef96){while(--_0x7cef96){_0x329c79['push'](_0x329c79['shift']());}};_0x491a86(++_0x35c249);}(_0x6602,0xc0));var _0x2660=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6602[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x2660('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2660('0x1'));var jsonpatch=require(_0x2660('0x2'));var rp=require(_0x2660('0x3'));var moment=require(_0x2660('0x4'));var BPromise=require(_0x2660('0x5'));var Mustache=require(_0x2660('0x6'));var util=require('util');var path=require(_0x2660('0x7'));var sox=require('sox');var csv=require(_0x2660('0x8'));var ejs=require(_0x2660('0x9'));var fs=require('fs');var fs_extra=require(_0x2660('0xa'));var _=require('lodash');var squel=require(_0x2660('0xb'));var crypto=require(_0x2660('0xc'));var jsforce=require(_0x2660('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2660('0x8'));var querystring=require(_0x2660('0xe'));var Papa=require(_0x2660('0xf'));var Redis=require(_0x2660('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2660('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2660('0x12'))(_0x2660('0x13'));var utils=require('../../config/utils');var config=require(_0x2660('0x14'));var licenseUtil=require(_0x2660('0x15'));var db=require(_0x2660('0x16'))['db'];function respondWithStatusCode(_0x5c7c4f,_0x4d023c){_0x4d023c=_0x4d023c||0xcc;return function(_0x51cc2c){if(_0x51cc2c){return _0x5c7c4f[_0x2660('0x17')](_0x4d023c);}return _0x5c7c4f['status'](_0x4d023c)['end']();};}function respondWithResult(_0x503006,_0x35dedb){_0x35dedb=_0x35dedb||0xc8;return function(_0x1596de){if(_0x1596de){return _0x503006[_0x2660('0x18')](_0x35dedb)['json'](_0x1596de);}};}function respondWithFilteredResult(_0x43591d,_0x5afba5){return function(_0x1506fb){if(_0x1506fb){var _0x42fa3b=typeof _0x5afba5[_0x2660('0x19')]===_0x2660('0x1a')&&typeof _0x5afba5['limit']===_0x2660('0x1a');var _0x1a2042=_0x1506fb[_0x2660('0x1b')];var _0x477092=_0x42fa3b?0x0:_0x5afba5['offset'];var _0x1e78cf=_0x42fa3b?_0x1506fb[_0x2660('0x1b')]:_0x5afba5[_0x2660('0x19')]+_0x5afba5[_0x2660('0x1c')];var _0x5afd68;if(_0x1e78cf>=_0x1a2042){_0x1e78cf=_0x1a2042;_0x5afd68=0xc8;}else{_0x5afd68=0xce;}_0x43591d[_0x2660('0x18')](_0x5afd68);return _0x43591d[_0x2660('0x1d')]('Content-Range',_0x477092+'-'+_0x1e78cf+'/'+_0x1a2042)[_0x2660('0x1e')](_0x1506fb);}return null;};}function patchUpdates(_0x23ec05){return function(_0x3bba2e){try{jsonpatch[_0x2660('0x1f')](_0x3bba2e,_0x23ec05,!![]);}catch(_0xcd6a7a){return BPromise[_0x2660('0x20')](_0xcd6a7a);}return _0x3bba2e[_0x2660('0x21')]();};}function saveUpdates(_0x1a71f3,_0x15e30a){return function(_0x11bb7a){if(_0x11bb7a){return _0x11bb7a[_0x2660('0x22')](_0x1a71f3)[_0x2660('0x23')](function(_0x5a345d){return _0x5a345d;});}return null;};}function removeEntity(_0x44252a,_0xe5f892){return function(_0x4b838a){if(_0x4b838a){return _0x4b838a[_0x2660('0x24')]()['then'](function(){_0x44252a['status'](0xcc)[_0x2660('0x25')]();});}};}function handleEntityNotFound(_0x4ae291,_0x3baa9e){return function(_0x1f2f7c){if(!_0x1f2f7c){_0x4ae291['sendStatus'](0x194);}return _0x1f2f7c;};}function handleError(_0x924cb1,_0x31cce9){_0x31cce9=_0x31cce9||0x1f4;return function(_0x482668){logger[_0x2660('0x26')](_0x482668[_0x2660('0x27')]);if(_0x482668[_0x2660('0x28')]){delete _0x482668[_0x2660('0x28')];}_0x924cb1[_0x2660('0x18')](_0x31cce9)['send'](_0x482668);};}exports[_0x2660('0x29')]=function(_0x42a211,_0x569d53){var _0x407759={},_0x513282={},_0x25b824={'count':0x0,'rows':[]};var _0x47647c=_[_0x2660('0x2a')](db[_0x2660('0x2b')][_0x2660('0x2c')],function(_0x2893d7){return{'name':_0x2893d7[_0x2660('0x2d')],'type':_0x2893d7[_0x2660('0x2e')][_0x2660('0x2f')]};});_0x513282[_0x2660('0x30')]=_[_0x2660('0x2a')](_0x47647c,_0x2660('0x28'));_0x513282[_0x2660('0x31')]=_[_0x2660('0x32')](_0x42a211['query']);_0x513282[_0x2660('0x33')]=_[_0x2660('0x34')](_0x513282['model'],_0x513282['query']);_0x407759[_0x2660('0x35')]=_['intersection'](_0x513282[_0x2660('0x30')],qs['fields'](_0x42a211['query'][_0x2660('0x36')]));_0x407759[_0x2660('0x35')]=_0x407759[_0x2660('0x35')]['length']?_0x407759[_0x2660('0x35')]:_0x513282[_0x2660('0x30')];if(!_0x42a211[_0x2660('0x31')][_0x2660('0x37')]('nolimit')){_0x407759[_0x2660('0x1c')]=qs[_0x2660('0x1c')](_0x42a211[_0x2660('0x31')][_0x2660('0x1c')]);_0x407759[_0x2660('0x19')]=qs['offset'](_0x42a211['query'][_0x2660('0x19')]);}_0x407759[_0x2660('0x38')]=qs[_0x2660('0x39')](_0x42a211[_0x2660('0x31')][_0x2660('0x39')]);_0x407759[_0x2660('0x3a')]=qs[_0x2660('0x33')](_[_0x2660('0x3b')](_0x42a211[_0x2660('0x31')],_0x513282[_0x2660('0x33')]),_0x47647c);if(_0x42a211['query'][_0x2660('0x3c')]){_0x407759[_0x2660('0x3a')]=_['merge'](_0x407759['where'],{'$or':_[_0x2660('0x2a')](_0x47647c,function(_0x2734a2){if(_0x2734a2['type']!=='VIRTUAL'){var _0x5a56d7={};_0x5a56d7[_0x2734a2[_0x2660('0x28')]]={'$like':'%'+_0x42a211[_0x2660('0x31')][_0x2660('0x3c')]+'%'};return _0x5a56d7;}})});}_0x407759=_[_0x2660('0x3d')]({},_0x407759,_0x42a211[_0x2660('0x3e')]);var _0x19ff78={'where':_0x407759['where']};return db[_0x2660('0x2b')][_0x2660('0x1b')](_0x19ff78)['then'](function(_0x19f96d){_0x25b824[_0x2660('0x1b')]=_0x19f96d;if(_0x42a211[_0x2660('0x31')][_0x2660('0x3f')]){_0x407759[_0x2660('0x40')]=[{'all':!![]}];}return db[_0x2660('0x2b')][_0x2660('0x41')](_0x407759);})[_0x2660('0x23')](function(_0x431e97){_0x25b824[_0x2660('0x42')]=_0x431e97;return _0x25b824;})[_0x2660('0x23')](respondWithFilteredResult(_0x569d53,_0x407759))[_0x2660('0x43')](handleError(_0x569d53,null));};exports[_0x2660('0x44')]=function(_0x34e742,_0x47a286){var _0x12e7d6={'raw':!![],'where':{'id':_0x34e742[_0x2660('0x45')]['id']}},_0x3010f9={};_0x3010f9['model']=_[_0x2660('0x32')](db[_0x2660('0x2b')][_0x2660('0x2c')]);_0x3010f9['query']=_[_0x2660('0x32')](_0x34e742[_0x2660('0x31')]);_0x3010f9[_0x2660('0x33')]=_[_0x2660('0x34')](_0x3010f9['model'],_0x3010f9[_0x2660('0x31')]);_0x12e7d6[_0x2660('0x35')]=_['intersection'](_0x3010f9['model'],qs[_0x2660('0x36')](_0x34e742['query'][_0x2660('0x36')]));_0x12e7d6[_0x2660('0x35')]=_0x12e7d6[_0x2660('0x35')][_0x2660('0x46')]?_0x12e7d6['attributes']:_0x3010f9[_0x2660('0x30')];if(_0x34e742[_0x2660('0x31')]['includeAll']){_0x12e7d6[_0x2660('0x40')]=[{'all':!![]}];}_0x12e7d6=_['merge']({},_0x12e7d6,_0x34e742[_0x2660('0x3e')]);return db[_0x2660('0x2b')][_0x2660('0x47')](_0x12e7d6)[_0x2660('0x23')](handleEntityNotFound(_0x47a286,null))[_0x2660('0x23')](respondWithResult(_0x47a286,null))[_0x2660('0x43')](handleError(_0x47a286,null));};exports['create']=function(_0x303803,_0x2098dd){return db[_0x2660('0x2b')][_0x2660('0x48')](_0x303803['body'],{})[_0x2660('0x23')](respondWithResult(_0x2098dd,0xc9))['catch'](handleError(_0x2098dd,null));};exports[_0x2660('0x22')]=function(_0x5c480b,_0xa98aae){if(_0x5c480b['body']['id']){delete _0x5c480b[_0x2660('0x49')]['id'];}return db['VoiceTransferReport'][_0x2660('0x47')]({'where':{'id':_0x5c480b['params']['id']}})['then'](handleEntityNotFound(_0xa98aae,null))[_0x2660('0x23')](saveUpdates(_0x5c480b[_0x2660('0x49')],null))[_0x2660('0x23')](respondWithResult(_0xa98aae,null))[_0x2660('0x43')](handleError(_0xa98aae,null));};exports['destroy']=function(_0x1d557c,_0x125269){return db['VoiceTransferReport'][_0x2660('0x47')]({'where':{'id':_0x1d557c['params']['id']}})[_0x2660('0x23')](handleEntityNotFound(_0x125269,null))[_0x2660('0x23')](removeEntity(_0x125269,null))['catch'](handleError(_0x125269,null));};exports[_0x2660('0x4a')]=function(_0x449789,_0x41c724){return db[_0x2660('0x2b')][_0x2660('0x4a')]()['then'](respondWithResult(_0x41c724,null))[_0x2660('0x43')](handleError(_0x41c724,null));}; \ No newline at end of file +var _0xfd63=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service'];(function(_0x3e2e99,_0x2effe4){var _0x2ccb41=function(_0x3c697f){while(--_0x3c697f){_0x3e2e99['push'](_0x3e2e99['shift']());}};_0x2ccb41(++_0x2effe4);}(_0xfd63,0xcd));var _0x3fd6=function(_0x1a0e2c,_0xc8a89){_0x1a0e2c=_0x1a0e2c-0x0;var _0x587830=_0xfd63[_0x1a0e2c];return _0x587830;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3fd6('0x0'));var zipdir=require(_0x3fd6('0x1'));var jsonpatch=require(_0x3fd6('0x2'));var rp=require(_0x3fd6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3fd6('0x4'));var sox=require(_0x3fd6('0x5'));var csv=require(_0x3fd6('0x6'));var ejs=require(_0x3fd6('0x7'));var fs=require('fs');var fs_extra=require(_0x3fd6('0x8'));var _=require(_0x3fd6('0x9'));var squel=require(_0x3fd6('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3fd6('0xb'));var toCsv=require(_0x3fd6('0x6'));var querystring=require(_0x3fd6('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3fd6('0xd'));var qs=require(_0x3fd6('0xe'));var as=require(_0x3fd6('0xf'));var hardwareService=require(_0x3fd6('0x10'));var logger=require(_0x3fd6('0x11'))(_0x3fd6('0x12'));var utils=require(_0x3fd6('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3fd6('0x14'));var db=require(_0x3fd6('0x15'))['db'];function respondWithStatusCode(_0x1e6b7d,_0x8e72f){_0x8e72f=_0x8e72f||0xcc;return function(_0x3f375b){if(_0x3f375b){return _0x1e6b7d['sendStatus'](_0x8e72f);}return _0x1e6b7d[_0x3fd6('0x16')](_0x8e72f)[_0x3fd6('0x17')]();};}function respondWithResult(_0x574a92,_0xba1d){_0xba1d=_0xba1d||0xc8;return function(_0x4eae78){if(_0x4eae78){return _0x574a92['status'](_0xba1d)[_0x3fd6('0x18')](_0x4eae78);}};}function respondWithFilteredResult(_0x19357d,_0x13cb85){return function(_0x56252b){if(_0x56252b){var _0x292406=typeof _0x13cb85['offset']===_0x3fd6('0x19')&&typeof _0x13cb85['limit']===_0x3fd6('0x19');var _0x4ab5d7=_0x56252b[_0x3fd6('0x1a')];var _0x352a5e=_0x292406?0x0:_0x13cb85[_0x3fd6('0x1b')];var _0x49879f=_0x292406?_0x56252b[_0x3fd6('0x1a')]:_0x13cb85['offset']+_0x13cb85[_0x3fd6('0x1c')];var _0x52e662;if(_0x49879f>=_0x4ab5d7){_0x49879f=_0x4ab5d7;_0x52e662=0xc8;}else{_0x52e662=0xce;}_0x19357d[_0x3fd6('0x16')](_0x52e662);return _0x19357d['set'](_0x3fd6('0x1d'),_0x352a5e+'-'+_0x49879f+'/'+_0x4ab5d7)['json'](_0x56252b);}return null;};}function patchUpdates(_0x42181e){return function(_0x4076bf){try{jsonpatch[_0x3fd6('0x1e')](_0x4076bf,_0x42181e,!![]);}catch(_0x160a8c){return BPromise[_0x3fd6('0x1f')](_0x160a8c);}return _0x4076bf[_0x3fd6('0x20')]();};}function saveUpdates(_0x30c12e,_0x287580){return function(_0x3b4eaa){if(_0x3b4eaa){return _0x3b4eaa[_0x3fd6('0x21')](_0x30c12e)[_0x3fd6('0x22')](function(_0x1a113b){return _0x1a113b;});}return null;};}function removeEntity(_0x2aa946,_0x5e41b0){return function(_0x4a3adc){if(_0x4a3adc){return _0x4a3adc[_0x3fd6('0x23')]()[_0x3fd6('0x22')](function(){_0x2aa946[_0x3fd6('0x16')](0xcc)[_0x3fd6('0x17')]();});}};}function handleEntityNotFound(_0x453493,_0x12d14a){return function(_0x158b4e){if(!_0x158b4e){_0x453493[_0x3fd6('0x24')](0x194);}return _0x158b4e;};}function handleError(_0x44463b,_0x4bbb61){_0x4bbb61=_0x4bbb61||0x1f4;return function(_0xc0295f){logger['error'](_0xc0295f[_0x3fd6('0x25')]);if(_0xc0295f[_0x3fd6('0x26')]){delete _0xc0295f[_0x3fd6('0x26')];}_0x44463b[_0x3fd6('0x16')](_0x4bbb61)[_0x3fd6('0x27')](_0xc0295f);};}exports[_0x3fd6('0x28')]=function(_0x3f25b3,_0xc0785c){var _0x35e9d7={},_0x127463={},_0x19cfc9={'count':0x0,'rows':[]};var _0x1e696b=_['map'](db[_0x3fd6('0x29')][_0x3fd6('0x2a')],function(_0x3886f1){return{'name':_0x3886f1[_0x3fd6('0x2b')],'type':_0x3886f1[_0x3fd6('0x2c')][_0x3fd6('0x2d')]};});_0x127463[_0x3fd6('0x2e')]=_[_0x3fd6('0x2f')](_0x1e696b,_0x3fd6('0x26'));_0x127463['query']=_[_0x3fd6('0x30')](_0x3f25b3[_0x3fd6('0x31')]);_0x127463['filters']=_[_0x3fd6('0x32')](_0x127463[_0x3fd6('0x2e')],_0x127463['query']);_0x35e9d7[_0x3fd6('0x33')]=_['intersection'](_0x127463[_0x3fd6('0x2e')],qs[_0x3fd6('0x34')](_0x3f25b3[_0x3fd6('0x31')][_0x3fd6('0x34')]));_0x35e9d7[_0x3fd6('0x33')]=_0x35e9d7['attributes'][_0x3fd6('0x35')]?_0x35e9d7['attributes']:_0x127463[_0x3fd6('0x2e')];if(!_0x3f25b3[_0x3fd6('0x31')]['hasOwnProperty']('nolimit')){_0x35e9d7[_0x3fd6('0x1c')]=qs[_0x3fd6('0x1c')](_0x3f25b3[_0x3fd6('0x31')][_0x3fd6('0x1c')]);_0x35e9d7['offset']=qs[_0x3fd6('0x1b')](_0x3f25b3[_0x3fd6('0x31')][_0x3fd6('0x1b')]);}_0x35e9d7['order']=qs[_0x3fd6('0x36')](_0x3f25b3[_0x3fd6('0x31')][_0x3fd6('0x36')]);_0x35e9d7[_0x3fd6('0x37')]=qs[_0x3fd6('0x38')](_[_0x3fd6('0x39')](_0x3f25b3[_0x3fd6('0x31')],_0x127463[_0x3fd6('0x38')]),_0x1e696b);if(_0x3f25b3['query'][_0x3fd6('0x3a')]){_0x35e9d7[_0x3fd6('0x37')]=_[_0x3fd6('0x3b')](_0x35e9d7[_0x3fd6('0x37')],{'$or':_[_0x3fd6('0x2f')](_0x1e696b,function(_0x4b4982){if(_0x4b4982[_0x3fd6('0x2c')]!==_0x3fd6('0x3c')){var _0x17b100={};_0x17b100[_0x4b4982[_0x3fd6('0x26')]]={'$like':'%'+_0x3f25b3['query'][_0x3fd6('0x3a')]+'%'};return _0x17b100;}})});}_0x35e9d7=_['merge']({},_0x35e9d7,_0x3f25b3[_0x3fd6('0x3d')]);var _0x1087a0={'where':_0x35e9d7[_0x3fd6('0x37')]};return db[_0x3fd6('0x29')][_0x3fd6('0x1a')](_0x1087a0)[_0x3fd6('0x22')](function(_0x1fb595){_0x19cfc9['count']=_0x1fb595;if(_0x3f25b3['query'][_0x3fd6('0x3e')]){_0x35e9d7['include']=[{'all':!![]}];}return db[_0x3fd6('0x29')][_0x3fd6('0x3f')](_0x35e9d7);})[_0x3fd6('0x22')](function(_0xc7dff7){_0x19cfc9[_0x3fd6('0x40')]=_0xc7dff7;return _0x19cfc9;})[_0x3fd6('0x22')](respondWithFilteredResult(_0xc0785c,_0x35e9d7))[_0x3fd6('0x41')](handleError(_0xc0785c,null));};exports[_0x3fd6('0x42')]=function(_0x4237e5,_0x1ae27f){var _0x618bce={'raw':!![],'where':{'id':_0x4237e5[_0x3fd6('0x43')]['id']}},_0x330ab6={};_0x330ab6[_0x3fd6('0x2e')]=_['keys'](db['VoiceTransferReport'][_0x3fd6('0x2a')]);_0x330ab6[_0x3fd6('0x31')]=_[_0x3fd6('0x30')](_0x4237e5[_0x3fd6('0x31')]);_0x330ab6[_0x3fd6('0x38')]=_[_0x3fd6('0x32')](_0x330ab6['model'],_0x330ab6['query']);_0x618bce[_0x3fd6('0x33')]=_[_0x3fd6('0x32')](_0x330ab6['model'],qs[_0x3fd6('0x34')](_0x4237e5[_0x3fd6('0x31')]['fields']));_0x618bce[_0x3fd6('0x33')]=_0x618bce[_0x3fd6('0x33')][_0x3fd6('0x35')]?_0x618bce[_0x3fd6('0x33')]:_0x330ab6[_0x3fd6('0x2e')];if(_0x4237e5[_0x3fd6('0x31')][_0x3fd6('0x3e')]){_0x618bce[_0x3fd6('0x44')]=[{'all':!![]}];}_0x618bce=_['merge']({},_0x618bce,_0x4237e5['options']);return db[_0x3fd6('0x29')][_0x3fd6('0x45')](_0x618bce)[_0x3fd6('0x22')](handleEntityNotFound(_0x1ae27f,null))[_0x3fd6('0x22')](respondWithResult(_0x1ae27f,null))[_0x3fd6('0x41')](handleError(_0x1ae27f,null));};exports[_0x3fd6('0x46')]=function(_0x416155,_0x1e15ce){return db[_0x3fd6('0x29')][_0x3fd6('0x46')](_0x416155['body'],{})['then'](respondWithResult(_0x1e15ce,0xc9))['catch'](handleError(_0x1e15ce,null));};exports['update']=function(_0x2c359a,_0x3648d2){if(_0x2c359a[_0x3fd6('0x47')]['id']){delete _0x2c359a[_0x3fd6('0x47')]['id'];}return db[_0x3fd6('0x29')][_0x3fd6('0x45')]({'where':{'id':_0x2c359a[_0x3fd6('0x43')]['id']}})[_0x3fd6('0x22')](handleEntityNotFound(_0x3648d2,null))[_0x3fd6('0x22')](saveUpdates(_0x2c359a['body'],null))[_0x3fd6('0x22')](respondWithResult(_0x3648d2,null))[_0x3fd6('0x41')](handleError(_0x3648d2,null));};exports[_0x3fd6('0x23')]=function(_0x486024,_0xda0815){return db[_0x3fd6('0x29')][_0x3fd6('0x45')]({'where':{'id':_0x486024[_0x3fd6('0x43')]['id']}})[_0x3fd6('0x22')](handleEntityNotFound(_0xda0815,null))[_0x3fd6('0x22')](removeEntity(_0xda0815,null))[_0x3fd6('0x41')](handleError(_0xda0815,null));};exports[_0x3fd6('0x48')]=function(_0x545e26,_0x55c969){return db['VoiceTransferReport'][_0x3fd6('0x48')]()['then'](respondWithResult(_0x55c969,null))[_0x3fd6('0x41')](handleError(_0x55c969,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index c3d40d6..3438bea 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 _0x2bee=['rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2bee,0xca));var _0xe2be=function(_0x491082,_0x28f78b){_0x491082=_0x491082-0x0;var _0x5797d9=_0x2bee[_0x491082];return _0x5797d9;};'use strict';var _=require(_0xe2be('0x0'));var util=require(_0xe2be('0x1'));var logger=require(_0xe2be('0x2'))(_0xe2be('0x3'));var moment=require(_0xe2be('0x4'));var BPromise=require(_0xe2be('0x5'));var rp=require(_0xe2be('0x6'));var fs=require('fs');var path=require(_0xe2be('0x7'));var rimraf=require(_0xe2be('0x8'));var config=require('../../config/environment');var attributes=require(_0xe2be('0x9'));module[_0xe2be('0xa')]=function(_0x6d210f,_0x16d145){return _0x6d210f[_0xe2be('0xb')](_0xe2be('0xc'),attributes,{'tableName':_0xe2be('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb627=['report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0xbddae7,_0x2273d5){var _0x59b6cc=function(_0xbd0f3b){while(--_0xbd0f3b){_0xbddae7['push'](_0xbddae7['shift']());}};_0x59b6cc(++_0x2273d5);}(_0xb627,0x9d));var _0x7b62=function(_0x46ec7e,_0x12e831){_0x46ec7e=_0x46ec7e-0x0;var _0x375f94=_0xb627[_0x46ec7e];return _0x375f94;};'use strict';var _=require(_0x7b62('0x0'));var util=require(_0x7b62('0x1'));var logger=require(_0x7b62('0x2'))(_0x7b62('0x3'));var moment=require(_0x7b62('0x4'));var BPromise=require(_0x7b62('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b62('0x6'));var rimraf=require('rimraf');var config=require(_0x7b62('0x7'));var attributes=require(_0x7b62('0x8'));module[_0x7b62('0x9')]=function(_0x1ea42c,_0x33c7f4){return _0x1ea42c[_0x7b62('0xa')]('VoiceTransferReport',attributes,{'tableName':_0x7b62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 3a82425..18a4eb6 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 _0x771d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','lodash','util','moment'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x771d,0xb1));var _0xd771=function(_0x5f1e57,_0x59d101){_0x5f1e57=_0x5f1e57-0x0;var _0x39af23=_0x771d[_0x5f1e57];return _0x39af23;};'use strict';var _=require(_0xd771('0x0'));var util=require(_0xd771('0x1'));var moment=require(_0xd771('0x2'));var BPromise=require(_0xd771('0x3'));var rs=require(_0xd771('0x4'));var fs=require('fs');var Redis=require(_0xd771('0x5'));var db=require(_0xd771('0x6'))['db'];var utils=require(_0xd771('0x7'));var logger=require('../../config/logger')(_0xd771('0x8'));var config=require(_0xd771('0x9'));var jayson=require(_0xd771('0xa'));var client=jayson[_0xd771('0xb')][_0xd771('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22ff85,_0x1d1dae,_0x463946){return new BPromise(function(_0x4baa4f,_0xe48bcc){return client[_0xd771('0xd')](_0x22ff85,_0x463946)[_0xd771('0xe')](function(_0x44a195){logger[_0xd771('0xf')](_0xd771('0x10'),_0x1d1dae,'request\x20sent');logger['debug'](_0xd771('0x11'),_0x1d1dae,_0xd771('0x12'),JSON[_0xd771('0x13')](_0x44a195));if(_0x44a195['error']){if(_0x44a195['error'][_0xd771('0x14')]===0x1f4){logger['error'](_0xd771('0x10'),_0x1d1dae,_0x44a195[_0xd771('0x15')][_0xd771('0x16')]);return _0xe48bcc(_0x44a195[_0xd771('0x15')][_0xd771('0x16')]);}logger[_0xd771('0x15')](_0xd771('0x10'),_0x1d1dae,_0x44a195['error'][_0xd771('0x16')]);return _0x4baa4f(_0x44a195[_0xd771('0x15')][_0xd771('0x16')]);}else{logger[_0xd771('0xf')](_0xd771('0x10'),_0x1d1dae,_0xd771('0x12'));_0x4baa4f(_0x44a195[_0xd771('0x17')][_0xd771('0x16')]);}})[_0xd771('0x18')](function(_0x35b872){logger['error'](_0xd771('0x10'),_0x1d1dae,_0x35b872);_0xe48bcc(_0x35b872);});});}exports[_0xd771('0x19')]=function(_0x492caf){var _0x2e6ccc=this;return new Promise(function(_0x358ced,_0x528f37){return db[_0xd771('0x1a')][_0xd771('0x1b')](_0x492caf['body'],{'raw':_0x492caf[_0xd771('0x1c')]?_0x492caf['options'][_0xd771('0x1d')]===undefined?!![]:![]:!![]})[_0xd771('0xe')](function(_0x5f4c0c){logger[_0xd771('0xf')](_0xd771('0x19'),_0x492caf);logger['debug'](_0xd771('0x19'),_0x492caf,JSON[_0xd771('0x13')](_0x5f4c0c));_0x358ced(_0x5f4c0c);})[_0xd771('0x18')](function(_0x251662){logger[_0xd771('0x15')](_0xd771('0x19'),_0x251662[_0xd771('0x16')],_0x492caf);_0x528f37(_0x2e6ccc['error'](0x1f4,_0x251662[_0xd771('0x16')]));});});}; \ No newline at end of file +var _0x2c4d=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateVoiceTransferReport','body','options','raw','then','debug','lodash','util'];(function(_0xbb1440,_0x3078e3){var _0x18607a=function(_0xd15a7e){while(--_0xd15a7e){_0xbb1440['push'](_0xbb1440['shift']());}};_0x18607a(++_0x3078e3);}(_0x2c4d,0xf1));var _0xd2c4=function(_0x4c3904,_0x56db61){_0x4c3904=_0x4c3904-0x0;var _0x44fd48=_0x2c4d[_0x4c3904];return _0x44fd48;};'use strict';var _=require(_0xd2c4('0x0'));var util=require(_0xd2c4('0x1'));var moment=require(_0xd2c4('0x2'));var BPromise=require(_0xd2c4('0x3'));var rs=require(_0xd2c4('0x4'));var fs=require('fs');var Redis=require(_0xd2c4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd2c4('0x6'));var logger=require('../../config/logger')(_0xd2c4('0x7'));var config=require(_0xd2c4('0x8'));var jayson=require(_0xd2c4('0x9'));var client=jayson[_0xd2c4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ac55b,_0x3fabfa,_0x2d8f7f){return new BPromise(function(_0x11ea5d,_0x22a740){return client['request'](_0x3ac55b,_0x2d8f7f)['then'](function(_0x46fe86){logger[_0xd2c4('0xb')](_0xd2c4('0xc'),_0x3fabfa,_0xd2c4('0xd'));logger['debug'](_0xd2c4('0xe'),_0x3fabfa,_0xd2c4('0xd'),JSON[_0xd2c4('0xf')](_0x46fe86));if(_0x46fe86['error']){if(_0x46fe86['error'][_0xd2c4('0x10')]===0x1f4){logger[_0xd2c4('0x11')](_0xd2c4('0xc'),_0x3fabfa,_0x46fe86[_0xd2c4('0x11')][_0xd2c4('0x12')]);return _0x22a740(_0x46fe86['error'][_0xd2c4('0x12')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x3fabfa,_0x46fe86['error'][_0xd2c4('0x12')]);return _0x11ea5d(_0x46fe86[_0xd2c4('0x11')]['message']);}else{logger['info'](_0xd2c4('0xc'),_0x3fabfa,_0xd2c4('0xd'));_0x11ea5d(_0x46fe86[_0xd2c4('0x13')][_0xd2c4('0x12')]);}})[_0xd2c4('0x14')](function(_0xd6e3ee){logger[_0xd2c4('0x11')](_0xd2c4('0xc'),_0x3fabfa,_0xd6e3ee);_0x22a740(_0xd6e3ee);});});}exports[_0xd2c4('0x15')]=function(_0x2f7f6a){var _0x1dd2e2=this;return new Promise(function(_0xf1d8f9,_0x34d297){return db['VoiceTransferReport']['create'](_0x2f7f6a[_0xd2c4('0x16')],{'raw':_0x2f7f6a['options']?_0x2f7f6a[_0xd2c4('0x17')][_0xd2c4('0x18')]===undefined?!![]:![]:!![]})[_0xd2c4('0x19')](function(_0x67099a){logger[_0xd2c4('0xb')](_0xd2c4('0x15'),_0x2f7f6a);logger[_0xd2c4('0x1a')](_0xd2c4('0x15'),_0x2f7f6a,JSON[_0xd2c4('0xf')](_0x67099a));_0xf1d8f9(_0x67099a);})[_0xd2c4('0x14')](function(_0x3199ed){logger[_0xd2c4('0x11')](_0xd2c4('0x15'),_0x3199ed['message'],_0x2f7f6a);_0x34d297(_0x1dd2e2[_0xd2c4('0x11')](0x1f4,_0x3199ed[_0xd2c4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 5b88b6d..61fdfe7 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 _0xa9e0=['/transfer','transfer','exports','express','Router','../../components/auth/service','/originate','isWebrtcLicence','originate','post','/hangup','isAuthenticated','hangup','/answer','answer','hold','/unhold','calls'];(function(_0x49e0a0,_0x4e8cb8){var _0x156fac=function(_0x4e3034){while(--_0x4e3034){_0x49e0a0['push'](_0x49e0a0['shift']());}};_0x156fac(++_0x4e8cb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./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 +var _0xb4e6=['unhold','calls','/transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/hold','hold','/unhold'];(function(_0x4f020a,_0x2e5389){var _0x1103ca=function(_0x4be5ec){while(--_0x4be5ec){_0x4f020a['push'](_0x4f020a['shift']());}};_0x1103ca(++_0x2e5389);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x4179e2,_0xf2dbb){_0x4179e2=_0x4179e2-0x0;var _0x24cb50=_0xb4e6[_0x4179e2];return _0x24cb50;};'use strict';var express=require(_0x6b4e('0x0'));var router=express['Router']();var auth=require(_0x6b4e('0x1'));var controller=require(_0x6b4e('0x2'));router[_0x6b4e('0x3')](_0x6b4e('0x4'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0x7')]);router['post'](_0x6b4e('0x8'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['hangup']);router[_0x6b4e('0x3')]('/answer',auth['isAuthenticated'](),auth[_0x6b4e('0x6')](),controller['answer']);router['post'](_0x6b4e('0x9'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xa')]);router[_0x6b4e('0x3')](_0x6b4e('0xb'),auth[_0x6b4e('0x5')](),auth['isWebrtcLicence'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x3')]('/calls',auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xd')]);router[_0x6b4e('0x3')](_0x6b4e('0xe'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['transfer']);module[_0x6b4e('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 3b2ef1a..04a9438 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 _0x6b19=['originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','rows','UserId','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','jayson/promise','client','http','../../config/logger','webbarapi','redis','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','name','status','send','request','then','code','message','catch','User','all','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','validate','body','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6b19,0xe8));var _0x96b1=function(_0x353874,_0x379daa){_0x353874=_0x353874-0x0;var _0x3b27f8=_0x6b19[_0x353874];return _0x3b27f8;};'use strict';var path=require(_0x96b1('0x0'));var fs=require('fs');var _=require(_0x96b1('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x96b1('0x2'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x96b1('0x3'));var amiClient=jayson[_0x96b1('0x4')][_0x96b1('0x5')]({'port':0x232a});var logger=require(_0x96b1('0x6'))(_0x96b1('0x7'));var Redis=require('ioredis');config[_0x96b1('0x8')]=_['defaults'](config[_0x96b1('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x96b1('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x96b1('0xa'),'required':[!![],_0x96b1('0xb')]},'callerId':{'type':_0x96b1('0xa')},'callbackUrl':{'type':_0x96b1('0xa')}});var hangupValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],_0x96b1('0xc')]},'sessionId':{'type':_0x96b1('0xa'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x96b1('0xa'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x96b1('0xa'),'required':[!![],_0x96b1('0xd')]},'transferNumber':{'type':_0x96b1('0xa'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],_0x96b1('0xc')]},'sessionId':{'type':_0x96b1('0xa'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],_0x96b1('0xc')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],_0x96b1('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],_0x96b1('0xc')]}});function emit(_0x2cd1f5,_0x43b7f5,_0x24fa0f){logger[_0x96b1('0xe')](_0x2cd1f5,_0x43b7f5,JSON[_0x96b1('0xf')](_0x24fa0f));io['to'](_0x2cd1f5)[_0x96b1('0x10')](_0x43b7f5,_0x24fa0f);}function handleError(_0x450099){return function(_0x38478c){console[_0x96b1('0x11')](_0x96b1('0x12'),_0x38478c,_0x38478c instanceof RangeError);logger[_0x96b1('0x13')](_0x38478c['stack']);if(_0x38478c instanceof RangeError){if(_0x38478c[_0x96b1('0x14')]){delete _0x38478c['name'];}_0x450099[_0x96b1('0x15')](0x194)[_0x96b1('0x16')](_0x38478c);}else{if(_0x38478c[_0x96b1('0x14')]){delete _0x38478c['name'];}_0x450099[_0x96b1('0x15')](0x1f4)[_0x96b1('0x16')](_0x38478c);}};}function checkError(){return function(_0x48786f){if(!_0x48786f){throw new RangeError('NotFound');}return _0x48786f;};}function respondWithRpcPromise(_0x2b7d4d,_0x3595b7){return new BPromise(function(_0x35db4a,_0x18594b){var _0x555185=amiClient;return _0x555185[_0x96b1('0x17')](_0x2b7d4d,_0x3595b7)[_0x96b1('0x18')](function(_0xde249b){if(_0xde249b['error']){if(_0xde249b[_0x96b1('0x13')][_0x96b1('0x19')]===0x1f4){return _0x18594b(_0xde249b[_0x96b1('0x13')][_0x96b1('0x1a')]);}return _0x35db4a(_0xde249b['error'][_0x96b1('0x1a')]);}else{_0x35db4a(_0xde249b['result']);}})[_0x96b1('0x1b')](function(_0x4ad19f){_0x18594b(_0x4ad19f);});});}function getAgent(_0x6509d2){return db[_0x96b1('0x1c')]['findOne']({'where':{'id':_0x6509d2,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x3f24bc,_0x2e4420){return new BPromise(function(_0x18e56a,_0x444b0b){var _0x2a9229=respondWithRpcPromise('VoiceChannels');var _0x21a63f=getAgent(_0x3f24bc);Promise[_0x96b1('0x1d')]([_0x2a9229,_0x21a63f])[_0x96b1('0x18')](function(_0x209ce8){var _0x51e2c1=_0x209ce8[0x0];var _0x30dd00=_0x209ce8[0x1];var _0x33f96b=_['filter'](_0x51e2c1['rows'],function(_0x3666f8){return _0x3666f8['UserId']==_0x30dd00['id']&&_0x3666f8[_0x96b1('0x1e')]==_0x2e4420;});if(_0x33f96b[_0x96b1('0x1f')]==0x1){_0x18e56a(_0x30dd00);}else{_0x444b0b(new RangeError('sessionId\x20'+_0x2e4420+_0x96b1('0x20')));}});});}exports[_0x96b1('0x21')]=function(_0x5cb283,_0x36e049){logger[_0x96b1('0xe')](_0x96b1('0x22'),_0x5cb283['body']);var _0x2ac0bf=originateValidation[_0x96b1('0x23')](_0x5cb283[_0x96b1('0x24')]);if(_0x2ac0bf[_0x96b1('0x1f')]>0x0){return _0x36e049[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x2ac0bf);}var _0x55c5ec=_0x5cb283[_0x96b1('0x24')][_0x96b1('0x26')];var _0x50edd9=_0x5cb283['body'][_0x96b1('0x27')];var _0x1b1497=_0x5cb283[_0x96b1('0x24')]['callerId'];var _0x4ba6eb=_0x5cb283[_0x96b1('0x24')][_0x96b1('0x28')];return getAgent(_0x55c5ec)[_0x96b1('0x18')](function(_0x1721a4){logger['info'](_0x96b1('0x29'),_0x1721a4['name']);emit(util[_0x96b1('0x2a')](_0x96b1('0x2b'),_0x1721a4[_0x96b1('0x14')]),'webbar:originate',{'callNumber':_0x50edd9,'callerId':_0x1b1497,'callbackUrl':_0x4ba6eb});return _0x36e049[_0x96b1('0x15')](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x2c')});})[_0x96b1('0x1b')](handleError(_0x36e049));};exports[_0x96b1('0x2d')]=function(_0x370d03,_0x560fb6){logger[_0x96b1('0xe')](_0x96b1('0x2e'),_0x370d03['body']);var _0x320d31=hangupValidation['validate'](_0x370d03[_0x96b1('0x24')]);if(_0x320d31[_0x96b1('0x1f')]>0x0){return _0x560fb6[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x320d31);}var _0x30be03=_0x370d03[_0x96b1('0x24')][_0x96b1('0x26')];var _0x220d08=_0x370d03[_0x96b1('0x24')]['sessionId'];return getAgent(_0x30be03)[_0x96b1('0x18')](function(_0x4d3c9f){logger[_0x96b1('0xe')](_0x96b1('0x29'),_0x4d3c9f[_0x96b1('0x14')]);emit(util[_0x96b1('0x2a')](_0x96b1('0x2b'),_0x4d3c9f[_0x96b1('0x14')]),_0x96b1('0x2f'),{'sessionId':_0x220d08});return _0x560fb6[_0x96b1('0x15')](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x30')});})[_0x96b1('0x1b')](handleError(_0x560fb6));};exports[_0x96b1('0x31')]=function(_0x13529e,_0x49a73e){logger['info'](_0x96b1('0x32'),_0x13529e[_0x96b1('0x24')]);var _0x5282dd=answerValidation[_0x96b1('0x23')](_0x13529e[_0x96b1('0x24')]);if(_0x5282dd['length']>0x0){return _0x49a73e['status'](0x190)['json'](_0x5282dd);}var _0x3f8220=_0x13529e[_0x96b1('0x24')][_0x96b1('0x26')];var _0x458fd9=_0x13529e[_0x96b1('0x24')][_0x96b1('0x1e')];return getAgent(_0x3f8220)[_0x96b1('0x18')](function(_0x12fbb0){logger[_0x96b1('0xe')](_0x96b1('0x29'),_0x12fbb0['name']);emit(util[_0x96b1('0x2a')]('user:%s',_0x12fbb0[_0x96b1('0x14')]),'webbar:answer',{'sessionId':_0x458fd9});return _0x49a73e[_0x96b1('0x15')](0xc8)['json']({'error':![],'message':_0x96b1('0x33')});})[_0x96b1('0x1b')](handleError(_0x49a73e));};exports[_0x96b1('0x34')]=function(_0x266eaa,_0x1d2eb2){logger['info'](_0x96b1('0x35'),_0x266eaa[_0x96b1('0x24')]);var _0x1fdfe8=holdValidation['validate'](_0x266eaa[_0x96b1('0x24')]);if(_0x1fdfe8[_0x96b1('0x1f')]>0x0){return _0x1d2eb2[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x1fdfe8);}var _0x4919b2=_0x266eaa[_0x96b1('0x24')][_0x96b1('0x26')];var _0x4e6f7a=_0x266eaa[_0x96b1('0x24')][_0x96b1('0x1e')];return getAgent(_0x4919b2)[_0x96b1('0x18')](function(_0xc7b84b){logger[_0x96b1('0xe')](_0x96b1('0x29'),_0xc7b84b['name']);emit(util[_0x96b1('0x2a')]('user:%s',_0xc7b84b[_0x96b1('0x14')]),_0x96b1('0x36'),{'sessionId':_0x4e6f7a});return _0x1d2eb2['status'](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x37')});})['catch'](handleError(_0x1d2eb2));};exports[_0x96b1('0x38')]=function(_0xa66f17,_0x2087ba){logger[_0x96b1('0xe')](_0x96b1('0x39'),_0xa66f17[_0x96b1('0x24')]);var _0x8cd80b=unholdValidation[_0x96b1('0x23')](_0xa66f17[_0x96b1('0x24')]);if(_0x8cd80b[_0x96b1('0x1f')]>0x0){return _0x2087ba['status'](0x190)[_0x96b1('0x25')](_0x8cd80b);}var _0x220551=_0xa66f17[_0x96b1('0x24')][_0x96b1('0x26')];var _0x471177=_0xa66f17[_0x96b1('0x24')][_0x96b1('0x1e')];return getAgent(_0x220551)[_0x96b1('0x18')](function(_0x4d055a){logger['info'](_0x96b1('0x29'),_0x4d055a[_0x96b1('0x14')]);emit(util['format'](_0x96b1('0x2b'),_0x4d055a[_0x96b1('0x14')]),_0x96b1('0x3a'),{'sessionId':_0x471177});return _0x2087ba['status'](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x3b')});})['catch'](handleError(_0x2087ba));};exports['calls']=function(_0x31c32d,_0x19cc23){logger[_0x96b1('0xe')](_0x96b1('0x3c'),_0x19cc23[_0x96b1('0x24')]);var _0x3dc040=callsValidation[_0x96b1('0x23')](_0x31c32d[_0x96b1('0x24')]);if(_0x3dc040[_0x96b1('0x1f')]>0x0){return _0x19cc23[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x3dc040);}var _0x16ce91=_0x31c32d['body'][_0x96b1('0x26')];var _0x1a5134=respondWithRpcPromise(_0x96b1('0x3d'));var _0x22da91=getAgent(_0x16ce91);return Promise[_0x96b1('0x1d')]([_0x1a5134,_0x22da91])[_0x96b1('0x18')](function(_0x227cc2){var _0x51b672=_0x227cc2[0x0];var _0x10d5b7=_0x227cc2[0x1];var _0x50f400=_['filter'](_0x51b672[_0x96b1('0x3e')],function(_0x2964e5){return _0x2964e5[_0x96b1('0x3f')]==_0x10d5b7['id'];});return _0x19cc23[_0x96b1('0x15')](0xc8)[_0x96b1('0x25')]({'count':_0x50f400[_0x96b1('0x1f')],'rows':_0x50f400});})[_0x96b1('0x1b')](handleError(_0x19cc23));};exports['conference']=function(_0x26a496,_0x54f45a){logger[_0x96b1('0xe')]('conference\x20fired:',_0x26a496[_0x96b1('0x24')]);var _0x405366=conferenceValidation['validate'](_0x26a496[_0x96b1('0x24')]);if(_0x405366[_0x96b1('0x1f')]>0x0){return _0x54f45a[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x405366);}var _0x4c8edf=_0x26a496['body'][_0x96b1('0x26')];return getAgent(_0x4c8edf)[_0x96b1('0x18')](function(_0x474bad){logger[_0x96b1('0xe')]('entityFound:',_0x474bad[_0x96b1('0x14')]);emit(util[_0x96b1('0x2a')](_0x96b1('0x2b'),_0x474bad[_0x96b1('0x14')]),_0x96b1('0x40'));return _0x54f45a[_0x96b1('0x15')](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x41')});})[_0x96b1('0x1b')](handleError(_0x54f45a));};exports['transfer']=function(_0x4f62c1,_0x15f591){logger[_0x96b1('0xe')]('transfer\x20fired:',_0x4f62c1['body']);var _0x11bb4d=transferValidation[_0x96b1('0x23')](_0x4f62c1[_0x96b1('0x24')]);if(_0x11bb4d[_0x96b1('0x1f')]>0x0){return _0x15f591[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x11bb4d);}var _0x37b48d=_0x4f62c1['body']['userId'];var _0x316cfa=_0x4f62c1[_0x96b1('0x24')]['sessionId'];var _0x5edcee=_0x4f62c1[_0x96b1('0x24')][_0x96b1('0x42')];return getAgent(_0x37b48d)['then'](function(_0x1190d6){logger[_0x96b1('0xe')](_0x96b1('0x29'),_0x1190d6[_0x96b1('0x14')]);emit(util[_0x96b1('0x2a')](_0x96b1('0x2b'),_0x1190d6['name']),_0x96b1('0x43'),{'sessionId':_0x316cfa,'transferNumber':_0x5edcee});return _0x15f591[_0x96b1('0x15')](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x44')});})['catch'](handleError(_0x15f591));}; \ No newline at end of file +var _0xbec5=['redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','transferNumber\x20is\x20required','info','stringify','emit','handleError:','error','name','status','send','NotFound','request','then','message','result','catch','agent','VoiceChannels','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','callNumber','callbackUrl','entityFound:','user:%s','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','userId','sessionId','webbar:hangup','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','format','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','defaults'];(function(_0x56ca62,_0x402dcb){var _0x37d8c1=function(_0x3eccaa){while(--_0x3eccaa){_0x56ca62['push'](_0x56ca62['shift']());}};_0x37d8c1(++_0x402dcb);}(_0xbec5,0xe5));var _0x5bec=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0xbec5[_0x21cb7f];return _0x5a079a;};'use strict';var path=require(_0x5bec('0x0'));var fs=require('fs');var _=require(_0x5bec('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x5bec('0x2'));var util=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var jayson=require(_0x5bec('0x5'));var amiClient=jayson[_0x5bec('0x6')]['http']({'port':0x232a});var logger=require(_0x5bec('0x7'))(_0x5bec('0x8'));var Redis=require(_0x5bec('0x9'));config['redis']=_[_0x5bec('0xa')](config[_0x5bec('0xb')],{'host':_0x5bec('0xc'),'port':0x18eb});var io=require(_0x5bec('0xd'))(new Redis(config[_0x5bec('0xb')]));var Schema=require(_0x5bec('0xe'));var originateValidation=new Schema({'userId':{'type':_0x5bec('0xf'),'required':[!![],_0x5bec('0x10')]},'callNumber':{'type':'string','required':[!![],_0x5bec('0x11')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x5bec('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0x5bec('0xf'),'required':[!![],_0x5bec('0x10')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x5bec('0xf'),'required':[!![],_0x5bec('0x10')]},'sessionId':{'type':_0x5bec('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5bec('0x10')]},'sessionId':{'type':_0x5bec('0x12'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x5bec('0x12'),'required':[!![],_0x5bec('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x5bec('0xf'),'required':[!![],_0x5bec('0x10')]},'sessionId':{'type':_0x5bec('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5bec('0xf'),'required':[!![],_0x5bec('0x10')]},'sessionId':{'type':_0x5bec('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5bec('0xf'),'required':[!![],_0x5bec('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5bec('0xf'),'required':[!![],_0x5bec('0x10')]}});function emit(_0x11fb8e,_0x506639,_0x4ab821){logger[_0x5bec('0x14')](_0x11fb8e,_0x506639,JSON[_0x5bec('0x15')](_0x4ab821));io['to'](_0x11fb8e)[_0x5bec('0x16')](_0x506639,_0x4ab821);}function handleError(_0x1771e7){return function(_0x5cd7ae){console['log'](_0x5bec('0x17'),_0x5cd7ae,_0x5cd7ae instanceof RangeError);logger[_0x5bec('0x18')](_0x5cd7ae['stack']);if(_0x5cd7ae instanceof RangeError){if(_0x5cd7ae[_0x5bec('0x19')]){delete _0x5cd7ae[_0x5bec('0x19')];}_0x1771e7[_0x5bec('0x1a')](0x194)[_0x5bec('0x1b')](_0x5cd7ae);}else{if(_0x5cd7ae['name']){delete _0x5cd7ae[_0x5bec('0x19')];}_0x1771e7['status'](0x1f4)[_0x5bec('0x1b')](_0x5cd7ae);}};}function checkError(){return function(_0x208d99){if(!_0x208d99){throw new RangeError(_0x5bec('0x1c'));}return _0x208d99;};}function respondWithRpcPromise(_0x43a62d,_0xfed23){return new BPromise(function(_0x5e154e,_0x232584){var _0x4cfcb8=amiClient;return _0x4cfcb8[_0x5bec('0x1d')](_0x43a62d,_0xfed23)[_0x5bec('0x1e')](function(_0x5b2636){if(_0x5b2636[_0x5bec('0x18')]){if(_0x5b2636[_0x5bec('0x18')]['code']===0x1f4){return _0x232584(_0x5b2636[_0x5bec('0x18')][_0x5bec('0x1f')]);}return _0x5e154e(_0x5b2636[_0x5bec('0x18')][_0x5bec('0x1f')]);}else{_0x5e154e(_0x5b2636[_0x5bec('0x20')]);}})[_0x5bec('0x21')](function(_0x2dc014){_0x232584(_0x2dc014);});});}function getAgent(_0x4de66a){return db['User']['findOne']({'where':{'id':_0x4de66a,'role':_0x5bec('0x22')}})[_0x5bec('0x1e')](checkError());}function getAgentCheckSession(_0x338c25,_0x4939a5){return new BPromise(function(_0x2b3b2c,_0x472e54){var _0x57331b=respondWithRpcPromise(_0x5bec('0x23'));var _0x63ac8=getAgent(_0x338c25);Promise['all']([_0x57331b,_0x63ac8])['then'](function(_0x3575e7){var _0x2a82d5=_0x3575e7[0x0];var _0x3039f0=_0x3575e7[0x1];var _0x2c7a7b=_[_0x5bec('0x24')](_0x2a82d5[_0x5bec('0x25')],function(_0x5d6621){return _0x5d6621[_0x5bec('0x26')]==_0x3039f0['id']&&_0x5d6621['sessionId']==_0x4939a5;});if(_0x2c7a7b[_0x5bec('0x27')]==0x1){_0x2b3b2c(_0x3039f0);}else{_0x472e54(new RangeError(_0x5bec('0x28')+_0x4939a5+_0x5bec('0x29')));}});});}exports[_0x5bec('0x2a')]=function(_0x5128c0,_0x2b42c8){logger[_0x5bec('0x14')](_0x5bec('0x2b'),_0x5128c0['body']);var _0xf6ae6b=originateValidation['validate'](_0x5128c0[_0x5bec('0x2c')]);if(_0xf6ae6b[_0x5bec('0x27')]>0x0){return _0x2b42c8[_0x5bec('0x1a')](0x190)['json'](_0xf6ae6b);}var _0xdc831e=_0x5128c0[_0x5bec('0x2c')]['userId'];var _0x34b441=_0x5128c0[_0x5bec('0x2c')][_0x5bec('0x2d')];var _0x170e28=_0x5128c0[_0x5bec('0x2c')]['callerId'];var _0x7ebd9c=_0x5128c0['body'][_0x5bec('0x2e')];return getAgent(_0xdc831e)[_0x5bec('0x1e')](function(_0x182b86){logger[_0x5bec('0x14')](_0x5bec('0x2f'),_0x182b86[_0x5bec('0x19')]);emit(util['format'](_0x5bec('0x30'),_0x182b86[_0x5bec('0x19')]),_0x5bec('0x31'),{'callNumber':_0x34b441,'callerId':_0x170e28,'callbackUrl':_0x7ebd9c});return _0x2b42c8['status'](0xc8)[_0x5bec('0x32')]({'error':![],'message':_0x5bec('0x33')});})['catch'](handleError(_0x2b42c8));};exports[_0x5bec('0x34')]=function(_0x58c34e,_0x400e22){logger[_0x5bec('0x14')](_0x5bec('0x35'),_0x58c34e['body']);var _0xd7b727=hangupValidation[_0x5bec('0xe')](_0x58c34e[_0x5bec('0x2c')]);if(_0xd7b727[_0x5bec('0x27')]>0x0){return _0x400e22[_0x5bec('0x1a')](0x190)[_0x5bec('0x32')](_0xd7b727);}var _0x3b7e50=_0x58c34e['body'][_0x5bec('0x36')];var _0x224c2e=_0x58c34e[_0x5bec('0x2c')][_0x5bec('0x37')];return getAgent(_0x3b7e50)['then'](function(_0x27863b){logger[_0x5bec('0x14')](_0x5bec('0x2f'),_0x27863b['name']);emit(util['format'](_0x5bec('0x30'),_0x27863b[_0x5bec('0x19')]),_0x5bec('0x38'),{'sessionId':_0x224c2e});return _0x400e22[_0x5bec('0x1a')](0xc8)[_0x5bec('0x32')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x400e22));};exports[_0x5bec('0x39')]=function(_0x5cb97e,_0x39597c){logger[_0x5bec('0x14')](_0x5bec('0x3a'),_0x5cb97e['body']);var _0x1e59a3=answerValidation[_0x5bec('0xe')](_0x5cb97e['body']);if(_0x1e59a3[_0x5bec('0x27')]>0x0){return _0x39597c[_0x5bec('0x1a')](0x190)[_0x5bec('0x32')](_0x1e59a3);}var _0x2b51f7=_0x5cb97e[_0x5bec('0x2c')][_0x5bec('0x36')];var _0x3a795c=_0x5cb97e['body']['sessionId'];return getAgent(_0x2b51f7)[_0x5bec('0x1e')](function(_0x4bfa57){logger['info'](_0x5bec('0x2f'),_0x4bfa57['name']);emit(util['format']('user:%s',_0x4bfa57[_0x5bec('0x19')]),_0x5bec('0x3b'),{'sessionId':_0x3a795c});return _0x39597c[_0x5bec('0x1a')](0xc8)[_0x5bec('0x32')]({'error':![],'message':'answer\x20executed!'});})[_0x5bec('0x21')](handleError(_0x39597c));};exports[_0x5bec('0x3c')]=function(_0xa4d32,_0x3a88d2){logger['info'](_0x5bec('0x3d'),_0xa4d32[_0x5bec('0x2c')]);var _0x2bbb1a=holdValidation['validate'](_0xa4d32[_0x5bec('0x2c')]);if(_0x2bbb1a['length']>0x0){return _0x3a88d2[_0x5bec('0x1a')](0x190)[_0x5bec('0x32')](_0x2bbb1a);}var _0x133d5c=_0xa4d32[_0x5bec('0x2c')]['userId'];var _0x32869f=_0xa4d32[_0x5bec('0x2c')][_0x5bec('0x37')];return getAgent(_0x133d5c)[_0x5bec('0x1e')](function(_0x35b250){logger[_0x5bec('0x14')](_0x5bec('0x2f'),_0x35b250['name']);emit(util[_0x5bec('0x3e')](_0x5bec('0x30'),_0x35b250['name']),_0x5bec('0x3f'),{'sessionId':_0x32869f});return _0x3a88d2[_0x5bec('0x1a')](0xc8)[_0x5bec('0x32')]({'error':![],'message':_0x5bec('0x40')});})[_0x5bec('0x21')](handleError(_0x3a88d2));};exports[_0x5bec('0x41')]=function(_0x3545a5,_0x4f08d9){logger[_0x5bec('0x14')]('unhold\x20fired:',_0x3545a5[_0x5bec('0x2c')]);var _0x208c7b=unholdValidation[_0x5bec('0xe')](_0x3545a5[_0x5bec('0x2c')]);if(_0x208c7b[_0x5bec('0x27')]>0x0){return _0x4f08d9[_0x5bec('0x1a')](0x190)[_0x5bec('0x32')](_0x208c7b);}var _0x3bc0c9=_0x3545a5[_0x5bec('0x2c')][_0x5bec('0x36')];var _0x580c75=_0x3545a5[_0x5bec('0x2c')]['sessionId'];return getAgent(_0x3bc0c9)['then'](function(_0x45eb95){logger['info']('entityFound:',_0x45eb95[_0x5bec('0x19')]);emit(util[_0x5bec('0x3e')](_0x5bec('0x30'),_0x45eb95['name']),_0x5bec('0x42'),{'sessionId':_0x580c75});return _0x4f08d9[_0x5bec('0x1a')](0xc8)[_0x5bec('0x32')]({'error':![],'message':_0x5bec('0x43')});})['catch'](handleError(_0x4f08d9));};exports[_0x5bec('0x44')]=function(_0x209da3,_0x9cae50){logger[_0x5bec('0x14')](_0x5bec('0x45'),_0x9cae50[_0x5bec('0x2c')]);var _0x33b924=callsValidation['validate'](_0x209da3['body']);if(_0x33b924[_0x5bec('0x27')]>0x0){return _0x9cae50['status'](0x190)[_0x5bec('0x32')](_0x33b924);}var _0x7ad053=_0x209da3['body'][_0x5bec('0x36')];var _0x5ddf8b=respondWithRpcPromise(_0x5bec('0x23'));var _0x3ed7ba=getAgent(_0x7ad053);return Promise[_0x5bec('0x46')]([_0x5ddf8b,_0x3ed7ba])[_0x5bec('0x1e')](function(_0x2fb334){var _0x340b42=_0x2fb334[0x0];var _0x2e4293=_0x2fb334[0x1];var _0x2c2e44=_[_0x5bec('0x24')](_0x340b42[_0x5bec('0x25')],function(_0x4ca9c3){return _0x4ca9c3[_0x5bec('0x26')]==_0x2e4293['id'];});return _0x9cae50[_0x5bec('0x1a')](0xc8)[_0x5bec('0x32')]({'count':_0x2c2e44['length'],'rows':_0x2c2e44});})[_0x5bec('0x21')](handleError(_0x9cae50));};exports[_0x5bec('0x47')]=function(_0x432a26,_0x56a539){logger[_0x5bec('0x14')](_0x5bec('0x48'),_0x432a26[_0x5bec('0x2c')]);var _0x340cd9=conferenceValidation[_0x5bec('0xe')](_0x432a26['body']);if(_0x340cd9[_0x5bec('0x27')]>0x0){return _0x56a539[_0x5bec('0x1a')](0x190)[_0x5bec('0x32')](_0x340cd9);}var _0x2abc02=_0x432a26['body'][_0x5bec('0x36')];return getAgent(_0x2abc02)['then'](function(_0x2b701f){logger[_0x5bec('0x14')](_0x5bec('0x2f'),_0x2b701f[_0x5bec('0x19')]);emit(util['format'](_0x5bec('0x30'),_0x2b701f[_0x5bec('0x19')]),_0x5bec('0x49'));return _0x56a539[_0x5bec('0x1a')](0xc8)[_0x5bec('0x32')]({'error':![],'message':_0x5bec('0x4a')});})[_0x5bec('0x21')](handleError(_0x56a539));};exports[_0x5bec('0x4b')]=function(_0x407828,_0x245932){logger[_0x5bec('0x14')](_0x5bec('0x4c'),_0x407828[_0x5bec('0x2c')]);var _0x5d3092=transferValidation[_0x5bec('0xe')](_0x407828['body']);if(_0x5d3092[_0x5bec('0x27')]>0x0){return _0x245932[_0x5bec('0x1a')](0x190)['json'](_0x5d3092);}var _0xa7a394=_0x407828['body'][_0x5bec('0x36')];var _0x1061d3=_0x407828['body']['sessionId'];var _0xd54be0=_0x407828[_0x5bec('0x2c')][_0x5bec('0x4d')];return getAgent(_0xa7a394)[_0x5bec('0x1e')](function(_0x2c7a94){logger['info'](_0x5bec('0x2f'),_0x2c7a94[_0x5bec('0x19')]);emit(util['format'](_0x5bec('0x30'),_0x2c7a94[_0x5bec('0x19')]),_0x5bec('0x4e'),{'sessionId':_0x1061d3,'transferNumber':_0xd54be0});return _0x245932[_0x5bec('0x1a')](0xc8)['json']({'error':![],'message':_0x5bec('0x4f')});})['catch'](handleError(_0x245932));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index ac32a64..01f1cb8 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 _0x4975=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addAnswer','/:id/users','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','removeDispositions','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated'];(function(_0xe2ba,_0x1fb646){var _0x21aec0=function(_0x204b2a){while(--_0x204b2a){_0xe2ba['push'](_0xe2ba['shift']());}};_0x21aec0(++_0x1fb646);}(_0x4975,0x86));var _0x5497=function(_0x39b471,_0x18912a){_0x39b471=_0x39b471-0x0;var _0x18d1bd=_0x4975[_0x39b471];return _0x18d1bd;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0xa')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0xa')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller['getAnswers']);router['get']('/:id/users',auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router[_0x5497('0xa')](_0x5497('0x15'),auth[_0x5497('0xd')](),controller[_0x5497('0x16')]);router[_0x5497('0x17')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x18')]);router[_0x5497('0x17')]('/:id/dispositions',auth[_0x5497('0xd')](),controller['addDisposition']);router[_0x5497('0x17')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller[_0x5497('0x19')]);router[_0x5497('0x17')](_0x5497('0x1a'),auth[_0x5497('0xd')](),controller['addAgents']);router['post'](_0x5497('0x15'),auth[_0x5497('0xd')](),controller[_0x5497('0x1b')]);router['post'](_0x5497('0x1c'),controller[_0x5497('0x1d')]);router[_0x5497('0x17')](_0x5497('0x1e'),auth[_0x5497('0xd')](),controller[_0x5497('0x1f')]);router[_0x5497('0x20')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x21')]);router[_0x5497('0x22')]('/:id',auth[_0x5497('0xd')](),controller['destroy']);router[_0x5497('0x22')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x23')]);router[_0x5497('0x22')](_0x5497('0x13'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x5497('0x22')](_0x5497('0x1a'),auth[_0x5497('0xd')](),controller[_0x5497('0x24')]);module['exports']=router; \ No newline at end of file +var _0x2a07=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x3b05ed,_0x45af7f){var _0x18b8d7=function(_0x1d4cb6){while(--_0x1d4cb6){_0x3b05ed['push'](_0x3b05ed['shift']());}};_0x18b8d7(++_0x45af7f);}(_0x2a07,0x74));var _0x72a0=function(_0x29ecbc,_0x2929d9){_0x29ecbc=_0x29ecbc-0x0;var _0x5709b0=_0x2a07[_0x29ecbc];return _0x5709b0;};'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['get'](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller['getDispositions']);router[_0x72a0('0xa')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x13')]);router[_0x72a0('0xa')]('/:id/users',auth[_0x72a0('0xb')](),controller[_0x72a0('0x14')]);router[_0x72a0('0xa')](_0x72a0('0x15'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x16')]);router[_0x72a0('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x72a0('0x17')](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x18')]);router[_0x72a0('0x17')](_0x72a0('0x12'),auth['isAuthenticated'](),controller[_0x72a0('0x19')]);router[_0x72a0('0x17')](_0x72a0('0x1a'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1b')]);router['post'](_0x72a0('0x15'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1c')]);router['post'](_0x72a0('0x1d'),controller[_0x72a0('0x1e')]);router[_0x72a0('0x17')](_0x72a0('0x1f'),auth['isAuthenticated'](),controller[_0x72a0('0x20')]);router['put'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x21')]);router['delete'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x22')]);router[_0x72a0('0x23')]('/:id/dispositions',auth[_0x72a0('0xb')](),controller[_0x72a0('0x24')]);router[_0x72a0('0x23')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x25')]);router['delete']('/:id/users',auth[_0x72a0('0xb')](),controller[_0x72a0('0x26')]);module[_0x72a0('0x27')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 21aed59..dd9418d 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 _0x11b7=['setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','ENUM','twilio','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0xe0b81f,_0x1fb734){var _0x290e5e=function(_0x19b8d3){while(--_0x19b8d3){_0xe0b81f['push'](_0xe0b81f['shift']());}};_0x290e5e(++_0x1fb734);}(_0x11b7,0xc2));var _0x711b=function(_0x34d047,_0x53ef93){_0x34d047=_0x34d047-0x0;var _0x16c548=_0x11b7[_0x34d047];return _0x16c548;};'use strict';var Sequelize=require(_0x711b('0x0'));var rs=require(_0x711b('0x1'));module[_0x711b('0x2')]={'name':{'type':Sequelize[_0x711b('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x711b('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x711b('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x711b('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x711b('0x3')]},'type':{'type':Sequelize[_0x711b('0x4')](_0x711b('0x5'),'sinch')},'accountSid':{'type':Sequelize[_0x711b('0x3')]},'baseUrl':{'type':Sequelize[_0x711b('0x3')]},'authToken':{'type':Sequelize[_0x711b('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x711b('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x711b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x711b('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x711b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x711b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x711b('0x7')],'comment':_0x711b('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x711b('0x6')],'defaultValue':![],'comment':_0x711b('0x9'),'set':function(_0x3c04ac){if(!_0x3c04ac){this[_0x711b('0xa')]('mandatoryDispositionPauseId',null);}this[_0x711b('0xa')](_0x711b('0xb'),_0x3c04ac);}},'description':{'type':Sequelize[_0x711b('0x3')]}}; \ No newline at end of file +var _0xf2ce=['mandatoryDisposition','randomstring','exports','STRING','name','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2ce,0x119));var _0xef2c=function(_0x902c43,_0x47c2e5){_0x902c43=_0x902c43-0x0;var _0x2833d0=_0xf2ce[_0x902c43];return _0x2833d0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xef2c('0x0'));module[_0xef2c('0x1')]={'name':{'type':Sequelize[_0xef2c('0x2')],'unique':_0xef2c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xef2c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xef2c('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xef2c('0x2')]},'type':{'type':Sequelize['ENUM']('twilio',_0xef2c('0x4'))},'accountSid':{'type':Sequelize[_0xef2c('0x2')]},'baseUrl':{'type':Sequelize[_0xef2c('0x2')]},'authToken':{'type':Sequelize[_0xef2c('0x2')]},'notificationTemplate':{'type':Sequelize[_0xef2c('0x5')],'defaultValue':function(){return _0xef2c('0x6');}},'notificationSound':{'type':Sequelize[_0xef2c('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xef2c('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xef2c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xef2c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xef2c('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xef2c('0x8')],'comment':_0xef2c('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xef2c('0x7')],'defaultValue':![],'comment':_0xef2c('0xa'),'set':function(_0x5844c9){if(!_0x5844c9){this[_0xef2c('0xb')](_0xef2c('0xc'),null);}this['setDataValue'](_0xef2c('0xd'),_0x5844c9);}},'description':{'type':Sequelize[_0xef2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 00e3d22..b2f6e33 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 _0x01d2=['getApplications','notify','whatsapp','account','sinch','read','statuses','message_id','applications','orderBy','Applications','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','notifications','Sequelize','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','WhatsappInteraction','interaction','created','autoclose','push','close','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','\x0a','List','out','WhatsappMessage','Messages','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','keys','find','create','user','role','UserProfileSection','autoAssociation','update','body','params','describe','addDisposition','findOne','Disposition','order','removeDispositions','ids','addAnswer','WhatsappAccountId','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','finally'];(function(_0x4f9ed3,_0x1e79c7){var _0x452361=function(_0x24f500){while(--_0x24f500){_0x4f9ed3['push'](_0x4f9ed3['shift']());}};_0x452361(++_0x1e79c7);}(_0x01d2,0x1c4));var _0x201d=function(_0x1d20fc,_0x292185){_0x1d20fc=_0x1d20fc-0x0;var _0x2fdf94=_0x01d2[_0x1d20fc];return _0x2fdf94;};'use strict';var emlformat=require(_0x201d('0x0'));var rimraf=require(_0x201d('0x1'));var zipdir=require(_0x201d('0x2'));var jsonpatch=require(_0x201d('0x3'));var rp=require('request-promise');var moment=require(_0x201d('0x4'));var BPromise=require(_0x201d('0x5'));var Mustache=require(_0x201d('0x6'));var util=require(_0x201d('0x7'));var path=require(_0x201d('0x8'));var sox=require(_0x201d('0x9'));var csv=require(_0x201d('0xa'));var ejs=require(_0x201d('0xb'));var fs=require('fs');var fs_extra=require(_0x201d('0xc'));var _=require(_0x201d('0xd'));var squel=require(_0x201d('0xe'));var crypto=require(_0x201d('0xf'));var jsforce=require(_0x201d('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x201d('0x11'));var Redis=require(_0x201d('0x12'));var authService=require(_0x201d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x201d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x201d('0x15'));var config=require(_0x201d('0x16'));var licenseUtil=require(_0x201d('0x17'));var db=require(_0x201d('0x18'))['db'];config[_0x201d('0x19')]=_[_0x201d('0x1a')](config[_0x201d('0x19')],{'host':_0x201d('0x1b'),'port':0x18eb});var socket=require(_0x201d('0x1c'))(new Redis(config['redis']));require(_0x201d('0x1d'))[_0x201d('0x1e')](socket);var jayson=require(_0x201d('0x1f'));var client=jayson['client'][_0x201d('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x416d4b,_0x1d57b7,_0x1146db,_0x568c1e){return new BPromise(function(_0x52bb1d,_0x3b0554){var _0x1da7a8=_0x568c1e||client;return _0x1da7a8[_0x201d('0x21')](_0x416d4b,_0x1146db)[_0x201d('0x22')](function(_0x4ffd43){logger[_0x201d('0x23')](_0x201d('0x24'),_0x1d57b7,'request\x20sent');logger['debug'](_0x201d('0x25'),_0x1d57b7,_0x201d('0x26'),JSON[_0x201d('0x27')](_0x4ffd43));if(_0x4ffd43[_0x201d('0x28')]){if(_0x4ffd43[_0x201d('0x28')]['code']===0x1f4){logger[_0x201d('0x28')](_0x201d('0x24'),_0x1d57b7,_0x4ffd43[_0x201d('0x28')][_0x201d('0x29')]);return _0x3b0554(_0x4ffd43[_0x201d('0x28')][_0x201d('0x29')]);}logger[_0x201d('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x1d57b7,_0x4ffd43['error'][_0x201d('0x29')]);return _0x52bb1d(_0x4ffd43[_0x201d('0x28')][_0x201d('0x29')]);}else{logger[_0x201d('0x23')](_0x201d('0x24'),_0x1d57b7,_0x201d('0x26'));_0x52bb1d(_0x4ffd43['result'][_0x201d('0x29')]);}})[_0x201d('0x2a')](function(_0xe44e64){logger[_0x201d('0x28')](_0x201d('0x24'),_0x1d57b7,_0xe44e64);_0x3b0554(_0xe44e64);});});}function respondWithStatusCode(_0x3ccd32,_0x429db1){_0x429db1=_0x429db1||0xcc;return function(_0x5a8deb){if(_0x5a8deb){return _0x3ccd32[_0x201d('0x2b')](_0x429db1);}return _0x3ccd32[_0x201d('0x2c')](_0x429db1)[_0x201d('0x2d')]();};}function respondWithResult(_0x175889,_0x3773eb){_0x3773eb=_0x3773eb||0xc8;return function(_0x7d417a){if(_0x7d417a){return _0x175889[_0x201d('0x2c')](_0x3773eb)[_0x201d('0x2e')](_0x7d417a);}};}function respondWithFilteredResult(_0x44ac4a,_0x471d24){return function(_0x4d27a3){if(_0x4d27a3){var _0x48aabc=typeof _0x471d24[_0x201d('0x2f')]===_0x201d('0x30')&&typeof _0x471d24[_0x201d('0x31')]==='undefined';var _0x296457=_0x4d27a3['count'];var _0x614215=_0x48aabc?0x0:_0x471d24[_0x201d('0x2f')];var _0x491130=_0x48aabc?_0x4d27a3[_0x201d('0x32')]:_0x471d24[_0x201d('0x2f')]+_0x471d24['limit'];var _0x4175b2;if(_0x491130>=_0x296457){_0x491130=_0x296457;_0x4175b2=0xc8;}else{_0x4175b2=0xce;}_0x44ac4a[_0x201d('0x2c')](_0x4175b2);return _0x44ac4a[_0x201d('0x33')](_0x201d('0x34'),_0x614215+'-'+_0x491130+'/'+_0x296457)[_0x201d('0x2e')](_0x4d27a3);}return null;};}function patchUpdates(_0x6f537a){return function(_0x3d0382){try{jsonpatch[_0x201d('0x35')](_0x3d0382,_0x6f537a,!![]);}catch(_0x32266f){return BPromise[_0x201d('0x36')](_0x32266f);}return _0x3d0382['save']();};}function saveUpdates(_0xa42757,_0x22f221){return function(_0x4d2210){if(_0x4d2210){return _0x4d2210['update'](_0xa42757)[_0x201d('0x22')](function(_0x16e66a){return _0x16e66a;});}return null;};}function removeEntity(_0x83f439,_0x283cf5){return function(_0x522a7f){if(_0x522a7f){return _0x522a7f[_0x201d('0x37')]()[_0x201d('0x22')](function(){var _0x5bd15a=_0x522a7f[_0x201d('0x38')]({'plain':!![]});var _0x3e7494=_0x201d('0x39');return db[_0x201d('0x3a')]['destroy']({'where':{'type':_0x3e7494,'resourceId':_0x5bd15a['id']}})[_0x201d('0x22')](function(){return _0x522a7f;});})['then'](function(){_0x83f439[_0x201d('0x2c')](0xcc)[_0x201d('0x2d')]();});}};}function handleEntityNotFound(_0x1abcfe,_0x196d0e){return function(_0x4ba099){if(!_0x4ba099){_0x1abcfe[_0x201d('0x2b')](0x194);}return _0x4ba099;};}function handleError(_0x3da639,_0x53f2c7){_0x53f2c7=_0x53f2c7||0x1f4;return function(_0x36dfb4){logger[_0x201d('0x28')](_0x36dfb4[_0x201d('0x3b')]);if(_0x36dfb4[_0x201d('0x3c')]){delete _0x36dfb4[_0x201d('0x3c')];}_0x3da639[_0x201d('0x2c')](_0x53f2c7)[_0x201d('0x3d')](_0x36dfb4);};}exports[_0x201d('0x3e')]=function(_0x4d1c46,_0x58c54a){var _0x1ecf58={'include':[{'model':db[_0x201d('0x3f')],'as':_0x201d('0x40')}]},_0x3c2d04={},_0x5d33e5={'count':0x0,'rows':[]};var _0x3c02ae=_[_0x201d('0x41')](db[_0x201d('0x42')][_0x201d('0x43')],function(_0x3883f2){return{'name':_0x3883f2['fieldName'],'type':_0x3883f2[_0x201d('0x44')][_0x201d('0x45')]};});_0x3c2d04[_0x201d('0x46')]=_[_0x201d('0x41')](_0x3c02ae,'name');_0x3c2d04[_0x201d('0x47')]=_['keys'](_0x4d1c46[_0x201d('0x47')]);_0x3c2d04['filters']=_[_0x201d('0x48')](_0x3c2d04['model'],_0x3c2d04[_0x201d('0x47')]);_0x1ecf58[_0x201d('0x49')]=_['intersection'](_0x3c2d04[_0x201d('0x46')],qs['fields'](_0x4d1c46[_0x201d('0x47')][_0x201d('0x4a')]));_0x1ecf58[_0x201d('0x49')]=_0x1ecf58[_0x201d('0x49')][_0x201d('0x4b')]?_0x1ecf58['attributes']:_0x3c2d04['model'];if(!_0x4d1c46[_0x201d('0x47')][_0x201d('0x4c')](_0x201d('0x4d'))){_0x1ecf58['limit']=qs[_0x201d('0x31')](_0x4d1c46[_0x201d('0x47')][_0x201d('0x31')]);_0x1ecf58[_0x201d('0x2f')]=qs[_0x201d('0x2f')](_0x4d1c46['query'][_0x201d('0x2f')]);}_0x1ecf58['order']=qs[_0x201d('0x4e')](_0x4d1c46[_0x201d('0x47')][_0x201d('0x4e')]);_0x1ecf58['where']=qs[_0x201d('0x4f')](_[_0x201d('0x50')](_0x4d1c46['query'],_0x3c2d04[_0x201d('0x4f')]),_0x3c02ae);if(_0x4d1c46[_0x201d('0x47')][_0x201d('0x51')]){_0x1ecf58[_0x201d('0x52')]=_['merge'](_0x1ecf58[_0x201d('0x52')],{'$or':_[_0x201d('0x41')](_0x3c02ae,function(_0x347bea){if(_0x347bea['type']!==_0x201d('0x53')){var _0xca4b1e={};_0xca4b1e[_0x347bea['name']]={'$like':'%'+_0x4d1c46[_0x201d('0x47')][_0x201d('0x51')]+'%'};return _0xca4b1e;}})});}_0x1ecf58=_[_0x201d('0x54')]({},_0x1ecf58,_0x4d1c46[_0x201d('0x55')]);var _0x190b94={'where':_0x1ecf58[_0x201d('0x52')]};return db[_0x201d('0x42')]['count'](_0x190b94)[_0x201d('0x22')](function(_0x1740a7){_0x5d33e5[_0x201d('0x32')]=_0x1740a7;if(_0x4d1c46['query'][_0x201d('0x56')]){_0x1ecf58[_0x201d('0x57')]=[{'all':!![]}];}return db[_0x201d('0x42')][_0x201d('0x58')](_0x1ecf58);})[_0x201d('0x22')](function(_0x4370dd){_0x5d33e5[_0x201d('0x59')]=_0x4370dd;return _0x5d33e5;})[_0x201d('0x22')](respondWithFilteredResult(_0x58c54a,_0x1ecf58))[_0x201d('0x2a')](handleError(_0x58c54a,null));};exports['show']=function(_0x51bbe5,_0x52798d){var _0x299006={'raw':![],'where':{'id':_0x51bbe5['params']['id']},'include':[{'model':db[_0x201d('0x3f')],'as':_0x201d('0x40')}]},_0x494b7c={};_0x494b7c[_0x201d('0x46')]=_[_0x201d('0x5a')](db['WhatsappAccount'][_0x201d('0x43')]);_0x494b7c[_0x201d('0x47')]=_['keys'](_0x51bbe5[_0x201d('0x47')]);_0x494b7c[_0x201d('0x4f')]=_[_0x201d('0x48')](_0x494b7c[_0x201d('0x46')],_0x494b7c[_0x201d('0x47')]);_0x299006[_0x201d('0x49')]=_['intersection'](_0x494b7c['model'],qs[_0x201d('0x4a')](_0x51bbe5[_0x201d('0x47')][_0x201d('0x4a')]));_0x299006[_0x201d('0x49')]=_0x299006['attributes'][_0x201d('0x4b')]?_0x299006[_0x201d('0x49')]:_0x494b7c[_0x201d('0x46')];if(_0x51bbe5['query'][_0x201d('0x56')]){_0x299006[_0x201d('0x57')]=[{'all':!![]}];}_0x299006=_['merge']({},_0x299006,_0x51bbe5[_0x201d('0x55')]);return db[_0x201d('0x42')][_0x201d('0x5b')](_0x299006)[_0x201d('0x22')](handleEntityNotFound(_0x52798d,null))[_0x201d('0x22')](respondWithResult(_0x52798d,null))[_0x201d('0x2a')](handleError(_0x52798d,null));};exports[_0x201d('0x5c')]=function(_0x393e20,_0x47ebf6){return db[_0x201d('0x42')]['create'](_0x393e20['body'],{})[_0x201d('0x22')](function(_0x4c831d){var _0x9eab13=_0x393e20[_0x201d('0x5d')][_0x201d('0x38')]({'plain':!![]});if(!_0x9eab13)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9eab13[_0x201d('0x5e')]===_0x201d('0x5d')){var _0x2ee60d=_0x4c831d[_0x201d('0x38')]({'plain':!![]});var _0x196852=_0x201d('0x39');return db[_0x201d('0x5f')][_0x201d('0x5b')]({'where':{'name':_0x196852,'userProfileId':_0x9eab13['userProfileId']},'raw':!![]})['then'](function(_0xb1b164){if(_0xb1b164&&_0xb1b164[_0x201d('0x60')]===0x0){return db[_0x201d('0x3a')][_0x201d('0x5c')]({'name':_0x2ee60d['name'],'resourceId':_0x2ee60d['id'],'type':_0xb1b164[_0x201d('0x3c')],'sectionId':_0xb1b164['id']},{})[_0x201d('0x22')](function(){return _0x4c831d;});}else{return _0x4c831d;}})['catch'](function(_0x2abf38){logger[_0x201d('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2abf38);throw _0x2abf38;});}return _0x4c831d;})[_0x201d('0x22')](respondWithResult(_0x47ebf6,0xc9))['catch'](handleError(_0x47ebf6,null));};exports[_0x201d('0x61')]=function(_0x2882ed,_0x70726c){if(_0x2882ed[_0x201d('0x62')]['id']){delete _0x2882ed[_0x201d('0x62')]['id'];}return db[_0x201d('0x42')][_0x201d('0x5b')]({'where':{'id':_0x2882ed[_0x201d('0x63')]['id']},'include':[{'model':db['Pause'],'as':_0x201d('0x40')}]})[_0x201d('0x22')](handleEntityNotFound(_0x70726c,null))[_0x201d('0x22')](saveUpdates(_0x2882ed[_0x201d('0x62')],null))[_0x201d('0x22')](respondWithResult(_0x70726c,null))[_0x201d('0x2a')](handleError(_0x70726c,null));};exports[_0x201d('0x37')]=function(_0x5a776b,_0x27b9c9){return db['WhatsappAccount'][_0x201d('0x5b')]({'where':{'id':_0x5a776b['params']['id']}})['then'](handleEntityNotFound(_0x27b9c9,null))[_0x201d('0x22')](removeEntity(_0x27b9c9,null))[_0x201d('0x2a')](handleError(_0x27b9c9,null));};exports[_0x201d('0x64')]=function(_0x2e2794,_0x1f0c0a){return db[_0x201d('0x42')][_0x201d('0x64')]()[_0x201d('0x22')](respondWithResult(_0x1f0c0a,null))[_0x201d('0x2a')](handleError(_0x1f0c0a,null));};exports[_0x201d('0x65')]=function(_0x2cf3cf,_0x4efa26,_0x2041bb){if(_0x2cf3cf[_0x201d('0x62')]['id']){delete _0x2cf3cf[_0x201d('0x62')]['id'];}return db['WhatsappAccount'][_0x201d('0x5b')]({'where':{'id':_0x2cf3cf['params']['id']}})[_0x201d('0x22')](handleEntityNotFound(_0x4efa26,null))[_0x201d('0x22')](function(_0x4f8903){if(_0x4f8903){_0x2cf3cf[_0x201d('0x62')]['WhatsappAccountId']=_0x4f8903['id'];return db['Disposition']['create'](_0x2cf3cf[_0x201d('0x62')]);}})[_0x201d('0x22')](respondWithResult(_0x4efa26,null))['catch'](handleError(_0x4efa26,null));};exports['getDispositions']=function(_0x1b17df,_0x36789a,_0xe6053){var _0x31d909={'raw':![],'where':{}};var _0x54f09c={};var _0x3b62bc={'count':0x0,'rows':[]};return db[_0x201d('0x42')][_0x201d('0x66')]({'where':{'id':_0x1b17df[_0x201d('0x63')]['id']}})[_0x201d('0x22')](handleEntityNotFound(_0x36789a,null))['then'](function(_0x3ff30e){if(_0x3ff30e){_0x54f09c['model']=_[_0x201d('0x5a')](db[_0x201d('0x67')][_0x201d('0x43')]);_0x54f09c[_0x201d('0x47')]=_[_0x201d('0x5a')](_0x1b17df[_0x201d('0x47')]);_0x54f09c['filters']=_[_0x201d('0x48')](_0x54f09c[_0x201d('0x46')],_0x54f09c[_0x201d('0x47')]);_0x31d909[_0x201d('0x49')]=_[_0x201d('0x48')](_0x54f09c[_0x201d('0x46')],qs[_0x201d('0x4a')](_0x1b17df['query'][_0x201d('0x4a')]));_0x31d909[_0x201d('0x49')]=_0x31d909[_0x201d('0x49')][_0x201d('0x4b')]?_0x31d909[_0x201d('0x49')]:_0x54f09c[_0x201d('0x46')];if(!_0x1b17df[_0x201d('0x47')][_0x201d('0x4c')](_0x201d('0x4d'))){_0x31d909[_0x201d('0x31')]=qs['limit'](_0x1b17df['query'][_0x201d('0x31')]);_0x31d909[_0x201d('0x2f')]=qs[_0x201d('0x2f')](_0x1b17df[_0x201d('0x47')][_0x201d('0x2f')]);}_0x31d909[_0x201d('0x68')]=qs[_0x201d('0x4e')](_0x1b17df[_0x201d('0x47')][_0x201d('0x4e')]);_0x31d909[_0x201d('0x52')]=qs[_0x201d('0x4f')](_['pick'](_0x1b17df[_0x201d('0x47')],_0x54f09c['filters']));_0x31d909[_0x201d('0x52')]['WhatsappAccountId']=_0x3ff30e['id'];if(_0x1b17df[_0x201d('0x47')][_0x201d('0x51')]){_0x31d909[_0x201d('0x52')]=_[_0x201d('0x54')](_0x31d909[_0x201d('0x52')],{'$or':_[_0x201d('0x41')](_0x31d909['attributes'],function(_0x3fd510){var _0x471d94={};_0x471d94[_0x3fd510]={'$like':'%'+_0x1b17df[_0x201d('0x47')][_0x201d('0x51')]+'%'};return _0x471d94;})});}_0x31d909=_[_0x201d('0x54')]({},_0x31d909,_0x1b17df[_0x201d('0x55')]);return db[_0x201d('0x67')]['count']({'where':_0x31d909['where']})[_0x201d('0x22')](function(_0x5a7f3e){_0x3b62bc[_0x201d('0x32')]=_0x5a7f3e;if(_0x1b17df[_0x201d('0x47')][_0x201d('0x56')]){_0x31d909[_0x201d('0x57')]=[{'all':!![]}];}return db[_0x201d('0x67')][_0x201d('0x58')](_0x31d909);})[_0x201d('0x22')](function(_0x777b70){_0x3b62bc[_0x201d('0x59')]=_0x777b70;return _0x3b62bc;});}})[_0x201d('0x22')](respondWithFilteredResult(_0x36789a,_0x31d909))['catch'](handleError(_0x36789a,null));};exports[_0x201d('0x69')]=function(_0x2afa72,_0x1da8c3,_0x4b87be){return db[_0x201d('0x42')][_0x201d('0x5b')]({'where':{'id':_0x2afa72[_0x201d('0x63')]['id']}})[_0x201d('0x22')](handleEntityNotFound(_0x1da8c3,null))[_0x201d('0x22')](function(_0x4f253c){if(_0x4f253c){return _0x4f253c[_0x201d('0x69')](_0x2afa72['query'][_0x201d('0x6a')]);}})[_0x201d('0x22')](respondWithStatusCode(_0x1da8c3,null))[_0x201d('0x2a')](handleError(_0x1da8c3,null));};exports[_0x201d('0x6b')]=function(_0x4af3e3,_0x1bac35,_0x5e7205){if(_0x4af3e3[_0x201d('0x62')]['id']){delete _0x4af3e3[_0x201d('0x62')]['id'];}return db[_0x201d('0x42')]['find']({'where':{'id':_0x4af3e3[_0x201d('0x63')]['id']}})['then'](handleEntityNotFound(_0x1bac35,null))[_0x201d('0x22')](function(_0x324912){if(_0x324912){_0x4af3e3[_0x201d('0x62')][_0x201d('0x6c')]=_0x324912['id'];return db['CannedAnswer']['create'](_0x4af3e3[_0x201d('0x62')]);}})[_0x201d('0x22')](respondWithResult(_0x1bac35,null))['catch'](handleError(_0x1bac35,null));};exports[_0x201d('0x6d')]=function(_0xa2db71,_0x4fc630,_0x3c1f07){var _0x32ec2c={'raw':![],'where':{}};var _0x3ff136={};var _0x4a7e8e={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0xa2db71['params']['id']}})[_0x201d('0x22')](handleEntityNotFound(_0x4fc630,null))[_0x201d('0x22')](function(_0x15ca7a){if(_0x15ca7a){_0x3ff136[_0x201d('0x46')]=_['keys'](db[_0x201d('0x6e')][_0x201d('0x43')]);_0x3ff136['query']=_[_0x201d('0x5a')](_0xa2db71['query']);_0x3ff136[_0x201d('0x4f')]=_[_0x201d('0x48')](_0x3ff136['model'],_0x3ff136['query']);_0x32ec2c[_0x201d('0x49')]=_[_0x201d('0x48')](_0x3ff136[_0x201d('0x46')],qs[_0x201d('0x4a')](_0xa2db71[_0x201d('0x47')][_0x201d('0x4a')]));_0x32ec2c[_0x201d('0x49')]=_0x32ec2c['attributes'][_0x201d('0x4b')]?_0x32ec2c[_0x201d('0x49')]:_0x3ff136['model'];if(!_0xa2db71[_0x201d('0x47')][_0x201d('0x4c')](_0x201d('0x4d'))){_0x32ec2c[_0x201d('0x31')]=qs[_0x201d('0x31')](_0xa2db71[_0x201d('0x47')]['limit']);_0x32ec2c[_0x201d('0x2f')]=qs[_0x201d('0x2f')](_0xa2db71[_0x201d('0x47')][_0x201d('0x2f')]);}_0x32ec2c[_0x201d('0x68')]=qs[_0x201d('0x4e')](_0xa2db71[_0x201d('0x47')][_0x201d('0x4e')]);_0x32ec2c[_0x201d('0x52')]=qs['filters'](_[_0x201d('0x50')](_0xa2db71[_0x201d('0x47')],_0x3ff136[_0x201d('0x4f')]));_0x32ec2c[_0x201d('0x52')][_0x201d('0x6c')]=_0x15ca7a['id'];if(_0xa2db71[_0x201d('0x47')][_0x201d('0x51')]){_0x32ec2c['where']=_['merge'](_0x32ec2c['where'],{'$or':_[_0x201d('0x41')](_0x32ec2c[_0x201d('0x49')],function(_0x54c392){var _0xf999dd={};_0xf999dd[_0x54c392]={'$like':'%'+_0xa2db71[_0x201d('0x47')][_0x201d('0x51')]+'%'};return _0xf999dd;})});}_0x32ec2c=_[_0x201d('0x54')]({},_0x32ec2c,_0xa2db71[_0x201d('0x55')]);return db[_0x201d('0x6e')][_0x201d('0x32')]({'where':_0x32ec2c[_0x201d('0x52')]})[_0x201d('0x22')](function(_0x33e26d){_0x4a7e8e[_0x201d('0x32')]=_0x33e26d;if(_0xa2db71[_0x201d('0x47')][_0x201d('0x56')]){_0x32ec2c[_0x201d('0x57')]=[{'all':!![]}];}return db[_0x201d('0x6e')]['findAll'](_0x32ec2c);})[_0x201d('0x22')](function(_0x10f2c9){_0x4a7e8e[_0x201d('0x59')]=_0x10f2c9;return _0x4a7e8e;});}})['then'](respondWithFilteredResult(_0x4fc630,_0x32ec2c))['catch'](handleError(_0x4fc630,null));};exports['removeAnswers']=function(_0x35e2dc,_0x5edf14,_0x56fabd){return db[_0x201d('0x42')][_0x201d('0x5b')]({'where':{'id':_0x35e2dc[_0x201d('0x63')]['id']}})[_0x201d('0x22')](handleEntityNotFound(_0x5edf14,null))[_0x201d('0x22')](function(_0x2698ca){if(_0x2698ca){return _0x2698ca[_0x201d('0x6f')](_0x35e2dc[_0x201d('0x47')][_0x201d('0x6a')]);}})[_0x201d('0x22')](respondWithStatusCode(_0x5edf14,null))[_0x201d('0x2a')](handleError(_0x5edf14,null));};exports[_0x201d('0x70')]=function(_0x26d611,_0x50e045,_0x827445){return db[_0x201d('0x42')]['find']({'where':{'id':_0x26d611['params']['id']}})[_0x201d('0x22')](handleEntityNotFound(_0x50e045,null))[_0x201d('0x22')](function(_0x3ab866){if(_0x3ab866){return _0x3ab866[_0x201d('0x70')](_0x26d611[_0x201d('0x62')][_0x201d('0x6a')],_[_0x201d('0x71')](_0x26d611[_0x201d('0x62')],[_0x201d('0x6a'),'id'])||{})[_0x201d('0x72')](function(_0x526a0c){for(var _0x3cc5d5=0x0;_0x3cc5d5<_0x26d611[_0x201d('0x62')][_0x201d('0x6a')]['length'];_0x3cc5d5+=0x1){socket[_0x201d('0x73')]('userWhatsappAccount:save',{'UserId':Number(_0x26d611[_0x201d('0x62')][_0x201d('0x6a')][_0x3cc5d5]),'WhatsappAccountId':Number(_0x26d611[_0x201d('0x63')]['id'])});}return _0x526a0c;});}})['then'](respondWithResult(_0x50e045,null))[_0x201d('0x2a')](handleError(_0x50e045,null));};exports['removeAgents']=function(_0x38031f,_0x2c6fac,_0x152838){return db['WhatsappAccount'][_0x201d('0x5b')]({'where':{'id':_0x38031f[_0x201d('0x63')]['id']}})[_0x201d('0x22')](handleEntityNotFound(_0x2c6fac,null))[_0x201d('0x22')](function(_0x2d482f){if(_0x2d482f){return _0x2d482f[_0x201d('0x74')](_0x38031f[_0x201d('0x47')][_0x201d('0x6a')])[_0x201d('0x22')](function(){if(_[_0x201d('0x75')](_0x38031f[_0x201d('0x47')][_0x201d('0x6a')])){for(var _0x9d1f6d=0x0;_0x9d1f6d<_0x38031f[_0x201d('0x47')][_0x201d('0x6a')][_0x201d('0x4b')];_0x9d1f6d+=0x1){socket[_0x201d('0x73')]('userWhatsappAccount:remove',{'UserId':Number(_0x38031f[_0x201d('0x47')][_0x201d('0x6a')][_0x9d1f6d]),'WhatsappAccountId':Number(_0x38031f['params']['id'])});}}else{socket['emit'](_0x201d('0x76'),{'UserId':Number(_0x38031f[_0x201d('0x47')][_0x201d('0x6a')]),'WhatsappAccountId':Number(_0x38031f[_0x201d('0x63')]['id'])});}});}})[_0x201d('0x22')](respondWithStatusCode(_0x2c6fac,null))[_0x201d('0x2a')](handleError(_0x2c6fac,null));};exports[_0x201d('0x77')]=function(_0x5e4e46,_0x2285a6,_0x93db8b){var _0xfc55de={};var _0x382546={};var _0x3d0613;var _0x4080b3;return db[_0x201d('0x42')][_0x201d('0x66')]({'where':{'id':_0x5e4e46['params']['id']}})['then'](handleEntityNotFound(_0x2285a6,null))[_0x201d('0x22')](function(_0x1bbe5c){if(_0x1bbe5c){_0x3d0613=_0x1bbe5c;_0x382546[_0x201d('0x46')]=_[_0x201d('0x5a')](db[_0x201d('0x78')][_0x201d('0x43')]);_0x382546[_0x201d('0x47')]=_[_0x201d('0x5a')](_0x5e4e46[_0x201d('0x47')]);_0x382546['filters']=_['intersection'](_0x382546[_0x201d('0x46')],_0x382546[_0x201d('0x47')]);_0xfc55de[_0x201d('0x49')]=_[_0x201d('0x48')](_0x382546[_0x201d('0x46')],qs['fields'](_0x5e4e46[_0x201d('0x47')][_0x201d('0x4a')]));_0xfc55de[_0x201d('0x49')]=_0xfc55de['attributes'][_0x201d('0x4b')]?_0xfc55de[_0x201d('0x49')]:_0x382546[_0x201d('0x46')];_0xfc55de['order']=qs[_0x201d('0x4e')](_0x5e4e46['query'][_0x201d('0x4e')]);_0xfc55de[_0x201d('0x52')]=qs[_0x201d('0x4f')](_[_0x201d('0x50')](_0x5e4e46[_0x201d('0x47')],_0x382546[_0x201d('0x4f')]));if(_0x5e4e46[_0x201d('0x47')][_0x201d('0x51')]){_0xfc55de[_0x201d('0x52')]=_['merge'](_0xfc55de['where'],{'$or':_['map'](_0xfc55de[_0x201d('0x49')],function(_0x2cfb81){var _0x1ca6a6={};_0x1ca6a6[_0x2cfb81]={'$like':'%'+_0x5e4e46[_0x201d('0x47')][_0x201d('0x51')]+'%'};return _0x1ca6a6;})});}_0xfc55de=_[_0x201d('0x54')]({},_0xfc55de,_0x5e4e46[_0x201d('0x55')]);return _0x3d0613[_0x201d('0x77')](_0xfc55de);}})[_0x201d('0x22')](function(_0x23c2ff){if(_0x23c2ff){_0x4080b3=_0x23c2ff[_0x201d('0x4b')];if(!_0x5e4e46[_0x201d('0x47')][_0x201d('0x4c')]('nolimit')){_0xfc55de[_0x201d('0x31')]=qs[_0x201d('0x31')](_0x5e4e46[_0x201d('0x47')]['limit']);_0xfc55de[_0x201d('0x2f')]=qs[_0x201d('0x2f')](_0x5e4e46[_0x201d('0x47')][_0x201d('0x2f')]);}return _0x3d0613[_0x201d('0x77')](_0xfc55de);}})[_0x201d('0x22')](function(_0x118f4f){if(_0x118f4f){return _0x118f4f?{'count':_0x4080b3,'rows':_0x118f4f}:null;}})['then'](respondWithResult(_0x2285a6,null))[_0x201d('0x2a')](handleError(_0x2285a6,null));};exports[_0x201d('0x79')]=function(_0x35564a,_0x3e5dc0){var _0x4aa15c=_0x35564a[_0x201d('0x63')]['id'];var _0x3d92c2=_0x35564a['body'];var _0x2583dd=0xc8;var _0x14dba9=null;return db[_0x201d('0x7a')][_0x201d('0x7b')]({'isolationLevel':db[_0x201d('0x7a')][_0x201d('0x7c')][_0x201d('0x7d')]['READ_COMMITTED']},function(_0x2eb913){return db[_0x201d('0x42')][_0x201d('0x66')]({'where':{'id':_0x4aa15c},'transaction':_0x2eb913})[_0x201d('0x22')](function(_0x5b6016){if(_0x5b6016){return db['WhatsappApplication'][_0x201d('0x37')]({'where':{'WhatsappAccountId':_0x4aa15c},'transaction':_0x2eb913})[_0x201d('0x22')](function(){var _0x2a6475=_[_0x201d('0x41')](_0x3d92c2,function(_0x4acad5){_0x4acad5[_0x201d('0x6c')]=_0x4aa15c;return _0x4acad5;});return db[_0x201d('0x7e')][_0x201d('0x7f')](_0x2a6475,{'transaction':_0x2eb913});});}else{_0x2583dd=0x194;_0x14dba9=[];}});})[_0x201d('0x22')](function(){if(_0x2583dd!==0x194){return db['WhatsappApplication'][_0x201d('0x80')]({'where':{'WhatsappAccountId':_0x4aa15c},'order':'priority'})[_0x201d('0x22')](function(_0x21bfb7){_0x14dba9=_0x21bfb7;});}})[_0x201d('0x2a')](function(_0x5009f3){_0x2583dd=0x1f4;logger[_0x201d('0x28')](_0x5009f3['stack']);if(_0x5009f3[_0x201d('0x3c')]){delete _0x5009f3[_0x201d('0x3c')];}_0x14dba9=_0x5009f3;})[_0x201d('0x81')](function(){if(_0x14dba9===null){_0x3e5dc0[_0x201d('0x2b')](_0x2583dd);}else{if(_0x2583dd===0x1f4){_0x3e5dc0[_0x201d('0x2c')](_0x2583dd)['send'](_0x14dba9);}else{_0x3e5dc0[_0x201d('0x2c')](_0x2583dd)[_0x201d('0x2e')](_0x14dba9);}}});};exports[_0x201d('0x82')]=function(_0x2f91af,_0x4ea3ac,_0x5416a4){var _0x549318={};var _0x13c01f={};var _0x19a6d5;var _0x5a9a4d;return db[_0x201d('0x42')][_0x201d('0x66')]({'where':{'id':_0x2f91af[_0x201d('0x63')]['id']}})[_0x201d('0x22')](handleEntityNotFound(_0x4ea3ac,null))[_0x201d('0x22')](function(_0x8d674d){if(_0x8d674d){_0x19a6d5=_0x8d674d;_0x13c01f[_0x201d('0x46')]=_[_0x201d('0x5a')](db[_0x201d('0x7e')][_0x201d('0x43')]);_0x13c01f['query']=_['keys'](_0x2f91af[_0x201d('0x47')]);_0x13c01f['filters']=_[_0x201d('0x48')](_0x13c01f['model'],_0x13c01f[_0x201d('0x47')]);_0x549318['attributes']=_[_0x201d('0x48')](_0x13c01f[_0x201d('0x46')],qs[_0x201d('0x4a')](_0x2f91af[_0x201d('0x47')][_0x201d('0x4a')]));_0x549318[_0x201d('0x49')]=_0x549318[_0x201d('0x49')][_0x201d('0x4b')]?_0x549318[_0x201d('0x49')]:_0x13c01f[_0x201d('0x46')];_0x549318['order']=qs[_0x201d('0x4e')](_0x2f91af[_0x201d('0x47')][_0x201d('0x4e')]);_0x549318[_0x201d('0x52')]=qs[_0x201d('0x4f')](_[_0x201d('0x50')](_0x2f91af['query'],_0x13c01f['filters']));if(_0x2f91af[_0x201d('0x47')][_0x201d('0x51')]){_0x549318[_0x201d('0x52')]=_['merge'](_0x549318['where'],{'$or':_['map'](_0x549318['attributes'],function(_0x511262){var _0xd6faa0={};_0xd6faa0[_0x511262]={'$like':'%'+_0x2f91af['query']['filter']+'%'};return _0xd6faa0;})});}_0x549318=_[_0x201d('0x54')]({},_0x549318,_0x2f91af[_0x201d('0x55')]);return _0x19a6d5[_0x201d('0x82')](_0x549318);}})[_0x201d('0x22')](function(_0x277635){if(_0x277635){_0x5a9a4d=_0x277635[_0x201d('0x4b')];if(!_0x2f91af[_0x201d('0x47')][_0x201d('0x4c')]('nolimit')){_0x549318[_0x201d('0x31')]=qs[_0x201d('0x31')](_0x2f91af[_0x201d('0x47')][_0x201d('0x31')]);_0x549318['offset']=qs[_0x201d('0x2f')](_0x2f91af[_0x201d('0x47')][_0x201d('0x2f')]);}return _0x19a6d5[_0x201d('0x82')](_0x549318);}})[_0x201d('0x22')](function(_0xdae170){if(_0xdae170){return _0xdae170?{'count':_0x5a9a4d,'rows':_0xdae170}:null;}})[_0x201d('0x22')](respondWithResult(_0x4ea3ac,null))[_0x201d('0x2a')](handleError(_0x4ea3ac,null));};exports[_0x201d('0x83')]=function(_0x9d6abf,_0x51df26,_0x2d8e25){var _0x461095={'channel':_0x201d('0x84')};var _0x100382=[];var _0x5da1d2=[];var _0x490283={};return db[_0x201d('0x42')][_0x201d('0x5b')]({'where':{'id':_0x9d6abf[_0x201d('0x63')]['id']},'include':[{'model':db[_0x201d('0x7e')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x51df26,null))[_0x201d('0x22')](function(_0x1682fa){_0x461095[_0x201d('0x85')]=_0x1682fa;if(_0x461095['account']&&_0x461095[_0x201d('0x85')][_0x201d('0x44')]===_0x201d('0x86')&&_0x9d6abf[_0x201d('0x62')]['statuses']){if(_0x9d6abf['body']['statuses'][_0x201d('0x4b')]===0x0)return;if(_0x9d6abf[_0x201d('0x62')]['statuses'][0x0]['state']!==_0x201d('0x87'))return;return db['WhatsappMessage']['update']({'read':!![],'readAt':_0x9d6abf[_0x201d('0x62')][_0x201d('0x88')][0x0]['timestamp']},{'where':{'messageId':_0x9d6abf['body']['statuses'][0x0][_0x201d('0x89')]},'individualHooks':!![]})[_0x201d('0x22')](function(_0x255472){return _0x51df26[_0x201d('0x2c')](0xc8)['json'](_0x255472);});}_0x461095[_0x201d('0x8a')]=_[_0x201d('0x8b')](_0x1682fa[_0x201d('0x8c')],[_0x201d('0x8d')],[_0x201d('0x8e')]);if(_0x461095['account'][_0x201d('0x8c')]){delete _0x461095[_0x201d('0x85')][_0x201d('0x8c')];}return db[_0x201d('0x8f')][_0x201d('0x64')]()[_0x201d('0x22')](function(_0x15ca5a){if(!_0x15ca5a){throw new db['Sequelize'][(_0x201d('0x90'))](_0x201d('0x91'));}_0x100382=_[_0x201d('0x92')](_[_0x201d('0x5a')](_0x15ca5a),[_0x201d('0x93'),_0x201d('0x94')]);_0x5da1d2=_[_0x201d('0x92')](_['keys'](_0x15ca5a),['createdAt',_0x201d('0x94'),_0x201d('0x95'),_0x201d('0x96')]);_0x461095[_0x201d('0x62')]={'mapKey':_0x201d('0x97')};if(_0x461095[_0x201d('0x85')]&&_0x461095[_0x201d('0x85')][_0x201d('0x44')]===_0x201d('0x98')){_0x461095[_0x201d('0x62')][_0x201d('0x99')]=_0x9d6abf[_0x201d('0x62')]['From'][_0x201d('0x9a')](_0x201d('0x9b'),'');_0x461095['body'][_0x201d('0x62')]=_0x9d6abf[_0x201d('0x62')][_0x201d('0x9c')];_0x461095['body'][_0x201d('0x9d')]=_0x9d6abf[_0x201d('0x62')]['MessageSid'];}if(_0x461095['account']&&_0x461095['account'][_0x201d('0x44')]===_0x201d('0x86')){_0x461095['body'][_0x201d('0x99')]=_0x9d6abf[_0x201d('0x62')][_0x201d('0x9e')][0x0][_0x201d('0x99')];_0x461095[_0x201d('0x62')][_0x201d('0x62')]=_0x9d6abf[_0x201d('0x62')]['notifications'][0x0][_0x201d('0x29')]['body'];_0x461095[_0x201d('0x62')]['messageId']=_0x9d6abf[_0x201d('0x62')]['notifications'][0x0]['message_id'];}if(_0x461095[_0x201d('0x62')]['id']){delete _0x461095['body']['id'];}if(_['isNil'](_0x461095[_0x201d('0x62')][_0x201d('0x99')])){throw new db[(_0x201d('0x9f'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x201d('0xa0')](_0x461095[_0x201d('0x62')][_0x201d('0x62')])||_0x461095[_0x201d('0x62')][_0x201d('0x62')]===''){throw new db[(_0x201d('0x9f'))]['ValidationError'](_0x201d('0xa1'));}if(_['isNil'](_0x461095[_0x201d('0x62')]['mapKey'])){throw new db[(_0x201d('0x9f'))][(_0x201d('0x90'))](_0x201d('0xa2')+_0x5da1d2);}if(!_[_0x201d('0xa3')](_0x5da1d2,_0x461095[_0x201d('0x62')][_0x201d('0xa4')])){throw new db[(_0x201d('0x9f'))][(_0x201d('0x90'))](_0x201d('0xa5')+_0x5da1d2);}_0x490283[_0x461095['body'][_0x201d('0xa4')]]=_0x461095[_0x201d('0x62')]['from'];return db[_0x201d('0xa6')][_0x201d('0x5b')]({'where':{'id':_0x461095[_0x201d('0x85')][_0x201d('0x96')]},'include':[{'model':db[_0x201d('0x8f')],'as':_0x201d('0xa7'),'where':_0x490283,'limit':0x1,'order':[[_0x201d('0x94'),_0x201d('0xa8')]]}]});})[_0x201d('0x22')](handleEntityNotFound(_0x51df26,null))[_0x201d('0x22')](function(_0x489677){if(_0x489677){_0x461095[_0x201d('0xa9')]=_[_0x201d('0x71')](_0x489677,[_0x201d('0xa7')]);if(_0x489677[_0x201d('0xa7')][_0x201d('0x4b')]){return _0x489677[_0x201d('0xa7')][0x0];}var _0x15b863=_[_0x201d('0x1a')](_0x461095['body'],{'firstName':_0x461095[_0x201d('0x62')][_0x201d('0x99')],'ListId':_0x489677['id']});_0x15b863[_0x461095[_0x201d('0x62')][_0x201d('0xa4')]]=_0x461095[_0x201d('0x62')][_0x201d('0x99')];return db['CmContact'][_0x201d('0x5c')](_0x15b863,{'fields':_0x100382,'raw':!![]});}})[_0x201d('0x22')](handleEntityNotFound(_0x51df26,null))['then'](function(_0x1ab8e7){if(_0x1ab8e7){_0x461095['contact']=_0x1ab8e7;var _0x39358c={'ContactId':_0x1ab8e7['id'],'phone':_0x461095[_0x201d('0x62')][_0x201d('0x99')],'WhatsappAccountId':_0x9d6abf[_0x201d('0x63')]['id']};var _0x5dd042={'ContactId':_0x1ab8e7['id'],'WhatsappAccountId':_0x9d6abf[_0x201d('0x63')]['id'],'closed':![]};return db[_0x201d('0xaa')][_0x201d('0x5b')]({'where':_0x5dd042})[_0x201d('0x22')](function(_0x4d6b9c){if(_0x4d6b9c){return[_0x4d6b9c,![]];}return db[_0x201d('0xaa')][_0x201d('0x5c')](_0x39358c)[_0x201d('0x22')](function(_0x317e95){return[_0x317e95,!![]];});});}})[_0x201d('0x72')](function(_0x339c4b,_0x195e54){_0x461095[_0x201d('0xab')]=_0x339c4b[_0x201d('0x38')]({'plain':!![]});_0x461095['interaction'][_0x201d('0xac')]=![];if(_0x195e54){if(_0x461095[_0x201d('0x85')][_0x201d('0xad')]){_0x461095[_0x201d('0x8a')][_0x201d('0xae')]({'id':0x0,'priority':_0x461095[_0x201d('0x8a')][_0x201d('0x4b')]+0x1,'app':_0x201d('0xaf'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x461095['interaction'][_0x201d('0xac')]=!![];}return db['WhatsappMessage'][_0x201d('0x5c')]({'phone':_0x461095['body'][_0x201d('0x99')],'messageId':_0x461095[_0x201d('0x62')][_0x201d('0x9d')],'body':_0x461095[_0x201d('0x62')]['body'],'WhatsappAccountId':_0x9d6abf[_0x201d('0x63')]['id'],'WhatsappInteractionId':_0x339c4b['id'],'direction':'in','ContactId':_0x339c4b[_0x201d('0xb0')],'AttachmentId':_0x461095[_0x201d('0x62')][_0x201d('0xb1')]});})[_0x201d('0x22')](function(_0xe43461){_0x461095[_0x201d('0x29')]=_0xe43461;if(_0x461095['interaction']['UserId']){return db['User'][_0x201d('0x5b')]({'attributes':['id','name'],'where':{'id':_0x461095['interaction'][_0x201d('0xb2')]}})[_0x201d('0x22')](function(_0x38f06b){if(_0x38f06b){_0x461095[_0x201d('0x8a')]['unshift']({'id':0x0,'priority':0x0,'app':_0x201d('0xb3'),'appdata':_0x38f06b[_0x201d('0x3c')]+','+(_0x461095[_0x201d('0x85')][_0x201d('0xb4')]||0xa),'interval':_0x201d('0xb5')});}return respondWithRpcPromise(_0x201d('0xb6'),_0x201d('0xb7'),_0x461095);});}return respondWithRpcPromise('Start',_0x201d('0xb7'),_0x461095);})[_0x201d('0x22')](function(_0x2a559b){if(_0x2a559b){var _0x5eaa67=0xc8;var _0x12dba2=_0x201d('0xb8');logger[_0x201d('0x23')](_0x201d('0x25'),_0x12dba2,_0x5eaa67,'entity\x20found');logger[_0x201d('0xb9')](_0x201d('0xba'),_0x12dba2,_0x5eaa67,_0x201d('0xbb'),JSON[_0x201d('0x27')](_0x2a559b));if(_0x461095['account'][_0x201d('0x44')]===_0x201d('0x98')){return _0x51df26['status'](_0x5eaa67)['set']('Content-Type',_0x201d('0xbc'))['send'](_0x201d('0xbd'));}else{return _0x51df26[_0x201d('0x2c')](_0x5eaa67)['json'](_0x2a559b);}}});})[_0x201d('0x2a')](handleError(_0x51df26,null));};exports['send']=function(_0x4cdd06,_0x5ab98a,_0x31a9d6){var _0x25276c,_0x48449a,_0x2a9f7d;if(_['isNil'](_0x4cdd06[_0x201d('0x62')]['body'])||_0x4cdd06[_0x201d('0x62')]['body']===''){throw new db[(_0x201d('0x9f'))]['ValidationError'](_0x201d('0xa1'));}if(_['isNil'](_0x4cdd06['body']['to'])){throw new db[(_0x201d('0x9f'))][(_0x201d('0x90'))]('to\x20is\x20mandatory');}_0x25276c=_0x4cdd06[_0x201d('0x62')]['to'];return db[_0x201d('0x42')][_0x201d('0x5b')]({'where':{'id':_0x4cdd06[_0x201d('0x63')]['id']},'include':[{'model':db[_0x201d('0xa6')],'as':_0x201d('0xbe'),'include':[{'model':db[_0x201d('0x8f')],'as':_0x201d('0xa7'),'where':{'mobile':_0x25276c},'limit':0x1,'order':[[_0x201d('0x94'),_0x201d('0xa8')]]}]}]})[_0x201d('0x22')](handleEntityNotFound(_0x5ab98a,null))[_0x201d('0x22')](function(_0x27dc8c){if(_0x27dc8c&&_0x27dc8c[_0x201d('0xbe')]){_0x48449a=_0x27dc8c['get']({'plain':!![]});if(_0x48449a[_0x201d('0xbe')]&&_0x48449a[_0x201d('0xbe')][_0x201d('0xa7')][_0x201d('0x4b')]){return _0x48449a[_0x201d('0xbe')]['Contacts'][0x0];}return db[_0x201d('0x8f')][_0x201d('0x5c')](_[_0x201d('0x1a')](_0x4cdd06[_0x201d('0x62')],{'firstName':_0x25276c,'mobile':_0x25276c,'phone':_0x25276c,'ListId':_0x48449a[_0x201d('0x96')]}));}})['then'](handleEntityNotFound(_0x5ab98a,null))[_0x201d('0x22')](function(_0x4a9427){if(_0x4a9427){_0x2a9f7d=_0x4a9427;return db[_0x201d('0xaa')][_0x201d('0x5b')]({'where':{'ContactId':_0x2a9f7d['id'],'closed':![],'WhatsappAccountId':_0x48449a['id']}})[_0x201d('0x22')](function(_0x4fe685){if(_0x4fe685){return[_0x4fe685,![]];}return db[_0x201d('0xaa')][_0x201d('0x5c')]({'UserId':_0x4cdd06['user']['id'],'ContactId':_0x2a9f7d['id'],'WhatsappAccountId':_0x48449a['id'],'phone':_0x25276c,'firstMsgDirection':_0x201d('0xbf'),'Messages':[_[_0x201d('0x54')](_0x4cdd06['body'],{'read':![],'body':_0x4cdd06[_0x201d('0x62')]['body'],'phone':_0x25276c,'WhatsappAccountId':_0x48449a['id'],'UserId':_0x4cdd06['user']['id'],'ContactId':_0x2a9f7d['id']})]},{'include':[{'model':db[_0x201d('0xc0')],'as':_0x201d('0xc1')}]})[_0x201d('0x22')](function(_0x362876){return[_0x362876,!![]];});});}})[_0x201d('0x72')](function(_0x2b03b9,_0x2fc663){if(_0x2fc663){return _0x2b03b9;}return db[_0x201d('0xc0')][_0x201d('0x5c')](_[_0x201d('0x54')](_0x4cdd06[_0x201d('0x62')],{'read':![],'body':_0x4cdd06[_0x201d('0x62')][_0x201d('0x62')],'phone':_0x25276c,'WhatsappAccountId':_0x48449a['id'],'WhatsappInteractionId':_0x2b03b9['id'],'UserId':_0x4cdd06[_0x201d('0x5d')]['id'],'ContactId':_0x2a9f7d['id']}))[_0x201d('0x22')](function(_0xa9621e){_0x2b03b9['dataValues'][_0x201d('0xc1')]=[];_0x2b03b9['dataValues'][_0x201d('0xc1')][_0x201d('0xae')](_0xa9621e['dataValues']);return _0x2b03b9;});})[_0x201d('0x22')](respondWithResult(_0x5ab98a,null))[_0x201d('0x2a')](handleError(_0x5ab98a,null));}; \ No newline at end of file +var _0xc7ea=['client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','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','describe','WhatsappAccountId','getDispositions','findOne','Disposition','hasOwnProperty','map','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','timestamp','message_id','applications','asc','CmContact','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','ListId','mobile','twilio','From','Body','MessageSid','from','notifications','messageId','isNil','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','defaults','Messages','dataValues','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise'];(function(_0x438bd9,_0x5af5a0){var _0x270b2a=function(_0x1d804f){while(--_0x1d804f){_0x438bd9['push'](_0x438bd9['shift']());}};_0x270b2a(++_0x5af5a0);}(_0xc7ea,0xa8));var _0xac7e=function(_0x1b50b4,_0x430c58){_0x1b50b4=_0x1b50b4-0x0;var _0x72a232=_0xc7ea[_0x1b50b4];return _0x72a232;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac7e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac7e('0x1'));var rp=require(_0xac7e('0x2'));var moment=require(_0xac7e('0x3'));var BPromise=require(_0xac7e('0x4'));var Mustache=require('mustache');var util=require(_0xac7e('0x5'));var path=require('path');var sox=require(_0xac7e('0x6'));var csv=require('to-csv');var ejs=require(_0xac7e('0x7'));var fs=require('fs');var fs_extra=require(_0xac7e('0x8'));var _=require(_0xac7e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xac7e('0xa'));var deskjs=require(_0xac7e('0xb'));var toCsv=require(_0xac7e('0xc'));var querystring=require(_0xac7e('0xd'));var Papa=require(_0xac7e('0xe'));var Redis=require('ioredis');var authService=require(_0xac7e('0xf'));var qs=require(_0xac7e('0x10'));var as=require(_0xac7e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac7e('0x12'))(_0xac7e('0x13'));var utils=require(_0xac7e('0x14'));var config=require(_0xac7e('0x15'));var licenseUtil=require(_0xac7e('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xac7e('0x17')],{'host':_0xac7e('0x18'),'port':0x18eb});var socket=require(_0xac7e('0x19'))(new Redis(config[_0xac7e('0x17')]));require(_0xac7e('0x1a'))[_0xac7e('0x1b')](socket);var jayson=require(_0xac7e('0x1c'));var client=jayson[_0xac7e('0x1d')][_0xac7e('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x387120,_0x4bef36,_0x2a81f8,_0x3878eb){return new BPromise(function(_0x1d70f4,_0x1e69b5){var _0x335f06=_0x3878eb||client;return _0x335f06[_0xac7e('0x1f')](_0x387120,_0x2a81f8)[_0xac7e('0x20')](function(_0x25f939){logger[_0xac7e('0x21')](_0xac7e('0x22'),_0x4bef36,_0xac7e('0x23'));logger[_0xac7e('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4bef36,_0xac7e('0x23'),JSON['stringify'](_0x25f939));if(_0x25f939[_0xac7e('0x25')]){if(_0x25f939[_0xac7e('0x25')][_0xac7e('0x26')]===0x1f4){logger[_0xac7e('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x4bef36,_0x25f939[_0xac7e('0x25')][_0xac7e('0x27')]);return _0x1e69b5(_0x25f939[_0xac7e('0x25')]['message']);}logger[_0xac7e('0x25')](_0xac7e('0x22'),_0x4bef36,_0x25f939[_0xac7e('0x25')][_0xac7e('0x27')]);return _0x1d70f4(_0x25f939[_0xac7e('0x25')][_0xac7e('0x27')]);}else{logger[_0xac7e('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x4bef36,_0xac7e('0x23'));_0x1d70f4(_0x25f939['result'][_0xac7e('0x27')]);}})['catch'](function(_0x12b837){logger[_0xac7e('0x25')](_0xac7e('0x22'),_0x4bef36,_0x12b837);_0x1e69b5(_0x12b837);});});}function respondWithStatusCode(_0x18c031,_0x7cd813){_0x7cd813=_0x7cd813||0xcc;return function(_0x429a2d){if(_0x429a2d){return _0x18c031[_0xac7e('0x28')](_0x7cd813);}return _0x18c031[_0xac7e('0x29')](_0x7cd813)[_0xac7e('0x2a')]();};}function respondWithResult(_0x1782db,_0x580f92){_0x580f92=_0x580f92||0xc8;return function(_0x44f41e){if(_0x44f41e){return _0x1782db[_0xac7e('0x29')](_0x580f92)['json'](_0x44f41e);}};}function respondWithFilteredResult(_0x573949,_0x10645a){return function(_0x2a2e1c){if(_0x2a2e1c){var _0x4fdb06=typeof _0x10645a[_0xac7e('0x2b')]===_0xac7e('0x2c')&&typeof _0x10645a[_0xac7e('0x2d')]===_0xac7e('0x2c');var _0x5f203d=_0x2a2e1c[_0xac7e('0x2e')];var _0x3981ed=_0x4fdb06?0x0:_0x10645a['offset'];var _0x1177b7=_0x4fdb06?_0x2a2e1c[_0xac7e('0x2e')]:_0x10645a['offset']+_0x10645a[_0xac7e('0x2d')];var _0x218c14;if(_0x1177b7>=_0x5f203d){_0x1177b7=_0x5f203d;_0x218c14=0xc8;}else{_0x218c14=0xce;}_0x573949[_0xac7e('0x29')](_0x218c14);return _0x573949[_0xac7e('0x2f')](_0xac7e('0x30'),_0x3981ed+'-'+_0x1177b7+'/'+_0x5f203d)[_0xac7e('0x31')](_0x2a2e1c);}return null;};}function patchUpdates(_0xddb252){return function(_0x410740){try{jsonpatch[_0xac7e('0x32')](_0x410740,_0xddb252,!![]);}catch(_0x4dc89f){return BPromise[_0xac7e('0x33')](_0x4dc89f);}return _0x410740[_0xac7e('0x34')]();};}function saveUpdates(_0x5f2d01,_0xdd850d){return function(_0x4766c8){if(_0x4766c8){return _0x4766c8[_0xac7e('0x35')](_0x5f2d01)[_0xac7e('0x20')](function(_0x4c6e9d){return _0x4c6e9d;});}return null;};}function removeEntity(_0x4a8a7d,_0x17b57a){return function(_0x2e2b67){if(_0x2e2b67){return _0x2e2b67[_0xac7e('0x36')]()[_0xac7e('0x20')](function(){var _0x16fd0d=_0x2e2b67[_0xac7e('0x37')]({'plain':!![]});var _0x27dece=_0xac7e('0x38');return db[_0xac7e('0x39')]['destroy']({'where':{'type':_0x27dece,'resourceId':_0x16fd0d['id']}})['then'](function(){return _0x2e2b67;});})[_0xac7e('0x20')](function(){_0x4a8a7d[_0xac7e('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b3f8a,_0x19e16b){return function(_0x4bb7d1){if(!_0x4bb7d1){_0x5b3f8a[_0xac7e('0x28')](0x194);}return _0x4bb7d1;};}function handleError(_0x31a991,_0x4a2a37){_0x4a2a37=_0x4a2a37||0x1f4;return function(_0x2937d5){logger[_0xac7e('0x25')](_0x2937d5[_0xac7e('0x3a')]);if(_0x2937d5['name']){delete _0x2937d5[_0xac7e('0x3b')];}_0x31a991[_0xac7e('0x29')](_0x4a2a37)['send'](_0x2937d5);};}exports['index']=function(_0x25330c,_0xe6820){var _0x526951={'include':[{'model':db[_0xac7e('0x3c')],'as':_0xac7e('0x3d')}]},_0x328c29={},_0x1f492f={'count':0x0,'rows':[]};var _0x3be042=_['map'](db[_0xac7e('0x3e')][_0xac7e('0x3f')],function(_0xf17878){return{'name':_0xf17878['fieldName'],'type':_0xf17878[_0xac7e('0x40')][_0xac7e('0x41')]};});_0x328c29[_0xac7e('0x42')]=_['map'](_0x3be042,_0xac7e('0x3b'));_0x328c29['query']=_['keys'](_0x25330c[_0xac7e('0x43')]);_0x328c29[_0xac7e('0x44')]=_[_0xac7e('0x45')](_0x328c29[_0xac7e('0x42')],_0x328c29['query']);_0x526951[_0xac7e('0x46')]=_['intersection'](_0x328c29[_0xac7e('0x42')],qs['fields'](_0x25330c[_0xac7e('0x43')][_0xac7e('0x47')]));_0x526951[_0xac7e('0x46')]=_0x526951[_0xac7e('0x46')][_0xac7e('0x48')]?_0x526951['attributes']:_0x328c29[_0xac7e('0x42')];if(!_0x25330c['query']['hasOwnProperty'](_0xac7e('0x49'))){_0x526951[_0xac7e('0x2d')]=qs[_0xac7e('0x2d')](_0x25330c[_0xac7e('0x43')][_0xac7e('0x2d')]);_0x526951[_0xac7e('0x2b')]=qs[_0xac7e('0x2b')](_0x25330c[_0xac7e('0x43')][_0xac7e('0x2b')]);}_0x526951[_0xac7e('0x4a')]=qs[_0xac7e('0x4b')](_0x25330c['query']['sort']);_0x526951[_0xac7e('0x4c')]=qs['filters'](_[_0xac7e('0x4d')](_0x25330c[_0xac7e('0x43')],_0x328c29[_0xac7e('0x44')]),_0x3be042);if(_0x25330c[_0xac7e('0x43')][_0xac7e('0x4e')]){_0x526951[_0xac7e('0x4c')]=_[_0xac7e('0x4f')](_0x526951[_0xac7e('0x4c')],{'$or':_['map'](_0x3be042,function(_0x3ffe12){if(_0x3ffe12[_0xac7e('0x40')]!==_0xac7e('0x50')){var _0x378395={};_0x378395[_0x3ffe12['name']]={'$like':'%'+_0x25330c[_0xac7e('0x43')][_0xac7e('0x4e')]+'%'};return _0x378395;}})});}_0x526951=_[_0xac7e('0x4f')]({},_0x526951,_0x25330c[_0xac7e('0x51')]);var _0x2005d4={'where':_0x526951[_0xac7e('0x4c')]};return db[_0xac7e('0x3e')][_0xac7e('0x2e')](_0x2005d4)[_0xac7e('0x20')](function(_0x32b9fb){_0x1f492f['count']=_0x32b9fb;if(_0x25330c['query']['includeAll']){_0x526951[_0xac7e('0x52')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xac7e('0x53')](_0x526951);})['then'](function(_0x5a8d7d){_0x1f492f[_0xac7e('0x54')]=_0x5a8d7d;return _0x1f492f;})[_0xac7e('0x20')](respondWithFilteredResult(_0xe6820,_0x526951))[_0xac7e('0x55')](handleError(_0xe6820,null));};exports[_0xac7e('0x56')]=function(_0x42f235,_0x56f1cf){var _0x3eb8eb={'raw':![],'where':{'id':_0x42f235[_0xac7e('0x57')]['id']},'include':[{'model':db[_0xac7e('0x3c')],'as':'mandatoryDispositionPause'}]},_0x5a5bbf={};_0x5a5bbf['model']=_[_0xac7e('0x58')](db[_0xac7e('0x3e')][_0xac7e('0x3f')]);_0x5a5bbf['query']=_[_0xac7e('0x58')](_0x42f235[_0xac7e('0x43')]);_0x5a5bbf[_0xac7e('0x44')]=_[_0xac7e('0x45')](_0x5a5bbf[_0xac7e('0x42')],_0x5a5bbf[_0xac7e('0x43')]);_0x3eb8eb[_0xac7e('0x46')]=_[_0xac7e('0x45')](_0x5a5bbf[_0xac7e('0x42')],qs['fields'](_0x42f235[_0xac7e('0x43')][_0xac7e('0x47')]));_0x3eb8eb[_0xac7e('0x46')]=_0x3eb8eb[_0xac7e('0x46')][_0xac7e('0x48')]?_0x3eb8eb[_0xac7e('0x46')]:_0x5a5bbf[_0xac7e('0x42')];if(_0x42f235['query'][_0xac7e('0x59')]){_0x3eb8eb[_0xac7e('0x52')]=[{'all':!![]}];}_0x3eb8eb=_[_0xac7e('0x4f')]({},_0x3eb8eb,_0x42f235['options']);return db[_0xac7e('0x3e')]['find'](_0x3eb8eb)[_0xac7e('0x20')](handleEntityNotFound(_0x56f1cf,null))[_0xac7e('0x20')](respondWithResult(_0x56f1cf,null))['catch'](handleError(_0x56f1cf,null));};exports[_0xac7e('0x5a')]=function(_0x4f5945,_0x567e1b){return db['WhatsappAccount'][_0xac7e('0x5a')](_0x4f5945[_0xac7e('0x5b')],{})['then'](function(_0x385db3){var _0x14e419=_0x4f5945[_0xac7e('0x5c')][_0xac7e('0x37')]({'plain':!![]});if(!_0x14e419)throw new Error(_0xac7e('0x5d'));if(_0x14e419[_0xac7e('0x5e')]==='user'){var _0x14a269=_0x385db3[_0xac7e('0x37')]({'plain':!![]});var _0x30d91d=_0xac7e('0x38');return db[_0xac7e('0x5f')]['find']({'where':{'name':_0x30d91d,'userProfileId':_0x14e419[_0xac7e('0x60')]},'raw':!![]})[_0xac7e('0x20')](function(_0x481a9c){if(_0x481a9c&&_0x481a9c[_0xac7e('0x61')]===0x0){return db[_0xac7e('0x39')][_0xac7e('0x5a')]({'name':_0x14a269['name'],'resourceId':_0x14a269['id'],'type':_0x481a9c[_0xac7e('0x3b')],'sectionId':_0x481a9c['id']},{})[_0xac7e('0x20')](function(){return _0x385db3;});}else{return _0x385db3;}})['catch'](function(_0x541293){logger[_0xac7e('0x25')](_0xac7e('0x62'),_0x541293);throw _0x541293;});}return _0x385db3;})['then'](respondWithResult(_0x567e1b,0xc9))[_0xac7e('0x55')](handleError(_0x567e1b,null));};exports[_0xac7e('0x35')]=function(_0xa537fa,_0x57ff1b){if(_0xa537fa[_0xac7e('0x5b')]['id']){delete _0xa537fa['body']['id'];}return db['WhatsappAccount'][_0xac7e('0x63')]({'where':{'id':_0xa537fa[_0xac7e('0x57')]['id']},'include':[{'model':db[_0xac7e('0x3c')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x57ff1b,null))[_0xac7e('0x20')](saveUpdates(_0xa537fa[_0xac7e('0x5b')],null))['then'](respondWithResult(_0x57ff1b,null))[_0xac7e('0x55')](handleError(_0x57ff1b,null));};exports[_0xac7e('0x36')]=function(_0x2cdb98,_0x5ca2ff){return db[_0xac7e('0x3e')][_0xac7e('0x63')]({'where':{'id':_0x2cdb98[_0xac7e('0x57')]['id']}})[_0xac7e('0x20')](handleEntityNotFound(_0x5ca2ff,null))[_0xac7e('0x20')](removeEntity(_0x5ca2ff,null))['catch'](handleError(_0x5ca2ff,null));};exports[_0xac7e('0x64')]=function(_0x1067c5,_0x246b22){return db[_0xac7e('0x3e')][_0xac7e('0x64')]()['then'](respondWithResult(_0x246b22,null))[_0xac7e('0x55')](handleError(_0x246b22,null));};exports['addDisposition']=function(_0x1b5545,_0x147ce9,_0x16f7cb){if(_0x1b5545['body']['id']){delete _0x1b5545[_0xac7e('0x5b')]['id'];}return db[_0xac7e('0x3e')]['find']({'where':{'id':_0x1b5545[_0xac7e('0x57')]['id']}})[_0xac7e('0x20')](handleEntityNotFound(_0x147ce9,null))[_0xac7e('0x20')](function(_0xf332d8){if(_0xf332d8){_0x1b5545[_0xac7e('0x5b')][_0xac7e('0x65')]=_0xf332d8['id'];return db['Disposition'][_0xac7e('0x5a')](_0x1b5545[_0xac7e('0x5b')]);}})['then'](respondWithResult(_0x147ce9,null))['catch'](handleError(_0x147ce9,null));};exports[_0xac7e('0x66')]=function(_0x27231c,_0x1d7c74,_0x4d8064){var _0x31742a={'raw':![],'where':{}};var _0xe6fa04={};var _0x5838ad={'count':0x0,'rows':[]};return db[_0xac7e('0x3e')][_0xac7e('0x67')]({'where':{'id':_0x27231c[_0xac7e('0x57')]['id']}})[_0xac7e('0x20')](handleEntityNotFound(_0x1d7c74,null))[_0xac7e('0x20')](function(_0x293d4f){if(_0x293d4f){_0xe6fa04['model']=_['keys'](db[_0xac7e('0x68')][_0xac7e('0x3f')]);_0xe6fa04[_0xac7e('0x43')]=_['keys'](_0x27231c[_0xac7e('0x43')]);_0xe6fa04[_0xac7e('0x44')]=_[_0xac7e('0x45')](_0xe6fa04['model'],_0xe6fa04[_0xac7e('0x43')]);_0x31742a[_0xac7e('0x46')]=_[_0xac7e('0x45')](_0xe6fa04[_0xac7e('0x42')],qs['fields'](_0x27231c[_0xac7e('0x43')][_0xac7e('0x47')]));_0x31742a['attributes']=_0x31742a[_0xac7e('0x46')][_0xac7e('0x48')]?_0x31742a[_0xac7e('0x46')]:_0xe6fa04[_0xac7e('0x42')];if(!_0x27231c[_0xac7e('0x43')][_0xac7e('0x69')](_0xac7e('0x49'))){_0x31742a[_0xac7e('0x2d')]=qs[_0xac7e('0x2d')](_0x27231c['query']['limit']);_0x31742a[_0xac7e('0x2b')]=qs[_0xac7e('0x2b')](_0x27231c['query'][_0xac7e('0x2b')]);}_0x31742a[_0xac7e('0x4a')]=qs['sort'](_0x27231c[_0xac7e('0x43')]['sort']);_0x31742a[_0xac7e('0x4c')]=qs['filters'](_[_0xac7e('0x4d')](_0x27231c['query'],_0xe6fa04[_0xac7e('0x44')]));_0x31742a[_0xac7e('0x4c')][_0xac7e('0x65')]=_0x293d4f['id'];if(_0x27231c[_0xac7e('0x43')]['filter']){_0x31742a[_0xac7e('0x4c')]=_[_0xac7e('0x4f')](_0x31742a[_0xac7e('0x4c')],{'$or':_[_0xac7e('0x6a')](_0x31742a[_0xac7e('0x46')],function(_0x27dd9d){var _0x1a21f2={};_0x1a21f2[_0x27dd9d]={'$like':'%'+_0x27231c['query'][_0xac7e('0x4e')]+'%'};return _0x1a21f2;})});}_0x31742a=_[_0xac7e('0x4f')]({},_0x31742a,_0x27231c['options']);return db[_0xac7e('0x68')][_0xac7e('0x2e')]({'where':_0x31742a['where']})[_0xac7e('0x20')](function(_0xb26be0){_0x5838ad[_0xac7e('0x2e')]=_0xb26be0;if(_0x27231c['query']['includeAll']){_0x31742a[_0xac7e('0x52')]=[{'all':!![]}];}return db[_0xac7e('0x68')][_0xac7e('0x53')](_0x31742a);})[_0xac7e('0x20')](function(_0x5f053d){_0x5838ad['rows']=_0x5f053d;return _0x5838ad;});}})[_0xac7e('0x20')](respondWithFilteredResult(_0x1d7c74,_0x31742a))[_0xac7e('0x55')](handleError(_0x1d7c74,null));};exports[_0xac7e('0x6b')]=function(_0x37bacd,_0x303384,_0x26979e){return db[_0xac7e('0x3e')][_0xac7e('0x63')]({'where':{'id':_0x37bacd['params']['id']}})[_0xac7e('0x20')](handleEntityNotFound(_0x303384,null))['then'](function(_0x5000c5){if(_0x5000c5){return _0x5000c5[_0xac7e('0x6b')](_0x37bacd[_0xac7e('0x43')][_0xac7e('0x6c')]);}})[_0xac7e('0x20')](respondWithStatusCode(_0x303384,null))[_0xac7e('0x55')](handleError(_0x303384,null));};exports[_0xac7e('0x6d')]=function(_0x359804,_0x539493,_0x20ce8a){if(_0x359804[_0xac7e('0x5b')]['id']){delete _0x359804[_0xac7e('0x5b')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x359804[_0xac7e('0x57')]['id']}})['then'](handleEntityNotFound(_0x539493,null))[_0xac7e('0x20')](function(_0x2f6bf2){if(_0x2f6bf2){_0x359804[_0xac7e('0x5b')][_0xac7e('0x65')]=_0x2f6bf2['id'];return db[_0xac7e('0x6e')]['create'](_0x359804[_0xac7e('0x5b')]);}})['then'](respondWithResult(_0x539493,null))[_0xac7e('0x55')](handleError(_0x539493,null));};exports[_0xac7e('0x6f')]=function(_0x4c5e62,_0x34ba56,_0x4e2881){var _0x48d5d2={'raw':![],'where':{}};var _0x4d450b={};var _0xb9633f={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xac7e('0x67')]({'where':{'id':_0x4c5e62['params']['id']}})[_0xac7e('0x20')](handleEntityNotFound(_0x34ba56,null))['then'](function(_0xe260a5){if(_0xe260a5){_0x4d450b[_0xac7e('0x42')]=_[_0xac7e('0x58')](db[_0xac7e('0x6e')][_0xac7e('0x3f')]);_0x4d450b[_0xac7e('0x43')]=_[_0xac7e('0x58')](_0x4c5e62[_0xac7e('0x43')]);_0x4d450b[_0xac7e('0x44')]=_[_0xac7e('0x45')](_0x4d450b['model'],_0x4d450b[_0xac7e('0x43')]);_0x48d5d2['attributes']=_[_0xac7e('0x45')](_0x4d450b['model'],qs[_0xac7e('0x47')](_0x4c5e62[_0xac7e('0x43')][_0xac7e('0x47')]));_0x48d5d2[_0xac7e('0x46')]=_0x48d5d2[_0xac7e('0x46')]['length']?_0x48d5d2[_0xac7e('0x46')]:_0x4d450b[_0xac7e('0x42')];if(!_0x4c5e62[_0xac7e('0x43')][_0xac7e('0x69')](_0xac7e('0x49'))){_0x48d5d2['limit']=qs[_0xac7e('0x2d')](_0x4c5e62[_0xac7e('0x43')][_0xac7e('0x2d')]);_0x48d5d2[_0xac7e('0x2b')]=qs[_0xac7e('0x2b')](_0x4c5e62[_0xac7e('0x43')][_0xac7e('0x2b')]);}_0x48d5d2['order']=qs[_0xac7e('0x4b')](_0x4c5e62['query'][_0xac7e('0x4b')]);_0x48d5d2[_0xac7e('0x4c')]=qs['filters'](_[_0xac7e('0x4d')](_0x4c5e62[_0xac7e('0x43')],_0x4d450b[_0xac7e('0x44')]));_0x48d5d2[_0xac7e('0x4c')]['WhatsappAccountId']=_0xe260a5['id'];if(_0x4c5e62[_0xac7e('0x43')][_0xac7e('0x4e')]){_0x48d5d2[_0xac7e('0x4c')]=_[_0xac7e('0x4f')](_0x48d5d2['where'],{'$or':_['map'](_0x48d5d2[_0xac7e('0x46')],function(_0x4acb21){var _0x5b5943={};_0x5b5943[_0x4acb21]={'$like':'%'+_0x4c5e62[_0xac7e('0x43')][_0xac7e('0x4e')]+'%'};return _0x5b5943;})});}_0x48d5d2=_[_0xac7e('0x4f')]({},_0x48d5d2,_0x4c5e62[_0xac7e('0x51')]);return db[_0xac7e('0x6e')][_0xac7e('0x2e')]({'where':_0x48d5d2[_0xac7e('0x4c')]})[_0xac7e('0x20')](function(_0x1f13bf){_0xb9633f[_0xac7e('0x2e')]=_0x1f13bf;if(_0x4c5e62[_0xac7e('0x43')]['includeAll']){_0x48d5d2[_0xac7e('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0xac7e('0x53')](_0x48d5d2);})[_0xac7e('0x20')](function(_0x40cf62){_0xb9633f[_0xac7e('0x54')]=_0x40cf62;return _0xb9633f;});}})[_0xac7e('0x20')](respondWithFilteredResult(_0x34ba56,_0x48d5d2))[_0xac7e('0x55')](handleError(_0x34ba56,null));};exports[_0xac7e('0x70')]=function(_0x889043,_0x159062,_0x5a60d9){return db[_0xac7e('0x3e')][_0xac7e('0x63')]({'where':{'id':_0x889043[_0xac7e('0x57')]['id']}})['then'](handleEntityNotFound(_0x159062,null))[_0xac7e('0x20')](function(_0x19e6ee){if(_0x19e6ee){return _0x19e6ee[_0xac7e('0x70')](_0x889043['query'][_0xac7e('0x6c')]);}})['then'](respondWithStatusCode(_0x159062,null))[_0xac7e('0x55')](handleError(_0x159062,null));};exports[_0xac7e('0x71')]=function(_0x492976,_0x40f646,_0x315cf0){return db[_0xac7e('0x3e')][_0xac7e('0x63')]({'where':{'id':_0x492976[_0xac7e('0x57')]['id']}})['then'](handleEntityNotFound(_0x40f646,null))['then'](function(_0x14da53){if(_0x14da53){return _0x14da53['addAgents'](_0x492976['body'][_0xac7e('0x6c')],_[_0xac7e('0x72')](_0x492976[_0xac7e('0x5b')],[_0xac7e('0x6c'),'id'])||{})[_0xac7e('0x73')](function(_0x933099){for(var _0x279021=0x0;_0x279021<_0x492976[_0xac7e('0x5b')][_0xac7e('0x6c')]['length'];_0x279021+=0x1){socket['emit'](_0xac7e('0x74'),{'UserId':Number(_0x492976[_0xac7e('0x5b')][_0xac7e('0x6c')][_0x279021]),'WhatsappAccountId':Number(_0x492976[_0xac7e('0x57')]['id'])});}return _0x933099;});}})[_0xac7e('0x20')](respondWithResult(_0x40f646,null))['catch'](handleError(_0x40f646,null));};exports[_0xac7e('0x75')]=function(_0xad280d,_0x48ecf6,_0x3132cf){return db[_0xac7e('0x3e')]['find']({'where':{'id':_0xad280d[_0xac7e('0x57')]['id']}})['then'](handleEntityNotFound(_0x48ecf6,null))[_0xac7e('0x20')](function(_0x33a68c){if(_0x33a68c){return _0x33a68c[_0xac7e('0x75')](_0xad280d[_0xac7e('0x43')][_0xac7e('0x6c')])[_0xac7e('0x20')](function(){if(_[_0xac7e('0x76')](_0xad280d['query'][_0xac7e('0x6c')])){for(var _0x137d73=0x0;_0x137d73<_0xad280d[_0xac7e('0x43')][_0xac7e('0x6c')][_0xac7e('0x48')];_0x137d73+=0x1){socket[_0xac7e('0x77')]('userWhatsappAccount:remove',{'UserId':Number(_0xad280d[_0xac7e('0x43')][_0xac7e('0x6c')][_0x137d73]),'WhatsappAccountId':Number(_0xad280d[_0xac7e('0x57')]['id'])});}}else{socket[_0xac7e('0x77')](_0xac7e('0x78'),{'UserId':Number(_0xad280d[_0xac7e('0x43')]['ids']),'WhatsappAccountId':Number(_0xad280d[_0xac7e('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x48ecf6,null))[_0xac7e('0x55')](handleError(_0x48ecf6,null));};exports[_0xac7e('0x79')]=function(_0x384b54,_0x4419ce,_0x4f3aaa){var _0x24fd1a={};var _0x2f017e={};var _0x1f6b7e;var _0x3e561a;return db[_0xac7e('0x3e')][_0xac7e('0x67')]({'where':{'id':_0x384b54[_0xac7e('0x57')]['id']}})[_0xac7e('0x20')](handleEntityNotFound(_0x4419ce,null))['then'](function(_0x3ae0c5){if(_0x3ae0c5){_0x1f6b7e=_0x3ae0c5;_0x2f017e[_0xac7e('0x42')]=_[_0xac7e('0x58')](db[_0xac7e('0x7a')][_0xac7e('0x3f')]);_0x2f017e[_0xac7e('0x43')]=_[_0xac7e('0x58')](_0x384b54[_0xac7e('0x43')]);_0x2f017e[_0xac7e('0x44')]=_[_0xac7e('0x45')](_0x2f017e[_0xac7e('0x42')],_0x2f017e['query']);_0x24fd1a['attributes']=_[_0xac7e('0x45')](_0x2f017e['model'],qs[_0xac7e('0x47')](_0x384b54[_0xac7e('0x43')]['fields']));_0x24fd1a['attributes']=_0x24fd1a[_0xac7e('0x46')][_0xac7e('0x48')]?_0x24fd1a[_0xac7e('0x46')]:_0x2f017e[_0xac7e('0x42')];_0x24fd1a[_0xac7e('0x4a')]=qs[_0xac7e('0x4b')](_0x384b54[_0xac7e('0x43')][_0xac7e('0x4b')]);_0x24fd1a[_0xac7e('0x4c')]=qs['filters'](_[_0xac7e('0x4d')](_0x384b54[_0xac7e('0x43')],_0x2f017e[_0xac7e('0x44')]));if(_0x384b54['query']['filter']){_0x24fd1a[_0xac7e('0x4c')]=_[_0xac7e('0x4f')](_0x24fd1a[_0xac7e('0x4c')],{'$or':_['map'](_0x24fd1a['attributes'],function(_0x2f3c5f){var _0x2583ea={};_0x2583ea[_0x2f3c5f]={'$like':'%'+_0x384b54[_0xac7e('0x43')][_0xac7e('0x4e')]+'%'};return _0x2583ea;})});}_0x24fd1a=_[_0xac7e('0x4f')]({},_0x24fd1a,_0x384b54[_0xac7e('0x51')]);return _0x1f6b7e[_0xac7e('0x79')](_0x24fd1a);}})[_0xac7e('0x20')](function(_0x5df311){if(_0x5df311){_0x3e561a=_0x5df311[_0xac7e('0x48')];if(!_0x384b54[_0xac7e('0x43')][_0xac7e('0x69')](_0xac7e('0x49'))){_0x24fd1a[_0xac7e('0x2d')]=qs[_0xac7e('0x2d')](_0x384b54[_0xac7e('0x43')]['limit']);_0x24fd1a[_0xac7e('0x2b')]=qs['offset'](_0x384b54[_0xac7e('0x43')][_0xac7e('0x2b')]);}return _0x1f6b7e[_0xac7e('0x79')](_0x24fd1a);}})[_0xac7e('0x20')](function(_0x4b3119){if(_0x4b3119){return _0x4b3119?{'count':_0x3e561a,'rows':_0x4b3119}:null;}})[_0xac7e('0x20')](respondWithResult(_0x4419ce,null))['catch'](handleError(_0x4419ce,null));};exports[_0xac7e('0x7b')]=function(_0x27af9f,_0x2c6b30){var _0x3bc06c=_0x27af9f[_0xac7e('0x57')]['id'];var _0xc0aa5b=_0x27af9f[_0xac7e('0x5b')];var _0x156ff3=0xc8;var _0x11fb5e=null;return db[_0xac7e('0x7c')][_0xac7e('0x7d')]({'isolationLevel':db[_0xac7e('0x7c')][_0xac7e('0x7e')]['ISOLATION_LEVELS'][_0xac7e('0x7f')]},function(_0x3b2087){return db['WhatsappAccount'][_0xac7e('0x67')]({'where':{'id':_0x3bc06c},'transaction':_0x3b2087})[_0xac7e('0x20')](function(_0x28984c){if(_0x28984c){return db['WhatsappApplication'][_0xac7e('0x36')]({'where':{'WhatsappAccountId':_0x3bc06c},'transaction':_0x3b2087})['then'](function(){var _0x3e2dc1=_[_0xac7e('0x6a')](_0xc0aa5b,function(_0x19b611){_0x19b611[_0xac7e('0x65')]=_0x3bc06c;return _0x19b611;});return db[_0xac7e('0x80')]['bulkCreate'](_0x3e2dc1,{'transaction':_0x3b2087});});}else{_0x156ff3=0x194;_0x11fb5e=[];}});})[_0xac7e('0x20')](function(){if(_0x156ff3!==0x194){return db[_0xac7e('0x80')][_0xac7e('0x81')]({'where':{'WhatsappAccountId':_0x3bc06c},'order':_0xac7e('0x82')})[_0xac7e('0x20')](function(_0x54ffa8){_0x11fb5e=_0x54ffa8;});}})[_0xac7e('0x55')](function(_0x3b0a8a){_0x156ff3=0x1f4;logger[_0xac7e('0x25')](_0x3b0a8a[_0xac7e('0x3a')]);if(_0x3b0a8a[_0xac7e('0x3b')]){delete _0x3b0a8a['name'];}_0x11fb5e=_0x3b0a8a;})[_0xac7e('0x83')](function(){if(_0x11fb5e===null){_0x2c6b30[_0xac7e('0x28')](_0x156ff3);}else{if(_0x156ff3===0x1f4){_0x2c6b30[_0xac7e('0x29')](_0x156ff3)[_0xac7e('0x84')](_0x11fb5e);}else{_0x2c6b30[_0xac7e('0x29')](_0x156ff3)[_0xac7e('0x31')](_0x11fb5e);}}});};exports[_0xac7e('0x85')]=function(_0x4d4f4e,_0x3c4aa2,_0xd668bc){var _0x93f26f={};var _0x1244b2={};var _0x41370b;var _0x2a0c0f;return db[_0xac7e('0x3e')][_0xac7e('0x67')]({'where':{'id':_0x4d4f4e['params']['id']}})[_0xac7e('0x20')](handleEntityNotFound(_0x3c4aa2,null))[_0xac7e('0x20')](function(_0x34ef8f){if(_0x34ef8f){_0x41370b=_0x34ef8f;_0x1244b2[_0xac7e('0x42')]=_['keys'](db[_0xac7e('0x80')][_0xac7e('0x3f')]);_0x1244b2[_0xac7e('0x43')]=_[_0xac7e('0x58')](_0x4d4f4e[_0xac7e('0x43')]);_0x1244b2[_0xac7e('0x44')]=_[_0xac7e('0x45')](_0x1244b2[_0xac7e('0x42')],_0x1244b2[_0xac7e('0x43')]);_0x93f26f[_0xac7e('0x46')]=_[_0xac7e('0x45')](_0x1244b2[_0xac7e('0x42')],qs[_0xac7e('0x47')](_0x4d4f4e['query'][_0xac7e('0x47')]));_0x93f26f[_0xac7e('0x46')]=_0x93f26f[_0xac7e('0x46')]['length']?_0x93f26f['attributes']:_0x1244b2[_0xac7e('0x42')];_0x93f26f['order']=qs[_0xac7e('0x4b')](_0x4d4f4e[_0xac7e('0x43')]['sort']);_0x93f26f['where']=qs[_0xac7e('0x44')](_[_0xac7e('0x4d')](_0x4d4f4e[_0xac7e('0x43')],_0x1244b2[_0xac7e('0x44')]));if(_0x4d4f4e[_0xac7e('0x43')][_0xac7e('0x4e')]){_0x93f26f['where']=_[_0xac7e('0x4f')](_0x93f26f['where'],{'$or':_[_0xac7e('0x6a')](_0x93f26f[_0xac7e('0x46')],function(_0x234aa2){var _0x498c99={};_0x498c99[_0x234aa2]={'$like':'%'+_0x4d4f4e[_0xac7e('0x43')]['filter']+'%'};return _0x498c99;})});}_0x93f26f=_[_0xac7e('0x4f')]({},_0x93f26f,_0x4d4f4e[_0xac7e('0x51')]);return _0x41370b['getApplications'](_0x93f26f);}})[_0xac7e('0x20')](function(_0x20f490){if(_0x20f490){_0x2a0c0f=_0x20f490[_0xac7e('0x48')];if(!_0x4d4f4e[_0xac7e('0x43')][_0xac7e('0x69')](_0xac7e('0x49'))){_0x93f26f['limit']=qs[_0xac7e('0x2d')](_0x4d4f4e[_0xac7e('0x43')][_0xac7e('0x2d')]);_0x93f26f[_0xac7e('0x2b')]=qs[_0xac7e('0x2b')](_0x4d4f4e[_0xac7e('0x43')][_0xac7e('0x2b')]);}return _0x41370b['getApplications'](_0x93f26f);}})[_0xac7e('0x20')](function(_0x106f4f){if(_0x106f4f){return _0x106f4f?{'count':_0x2a0c0f,'rows':_0x106f4f}:null;}})['then'](respondWithResult(_0x3c4aa2,null))[_0xac7e('0x55')](handleError(_0x3c4aa2,null));};exports[_0xac7e('0x86')]=function(_0x98be2e,_0x25dfe4,_0x3ff9b0){var _0x8d81af={'channel':_0xac7e('0x87')};var _0x350e16=[];var _0x26e4ea=[];var _0x407c4b={};return db[_0xac7e('0x3e')][_0xac7e('0x63')]({'where':{'id':_0x98be2e['params']['id']},'include':[{'model':db[_0xac7e('0x80')],'as':_0xac7e('0x88')}]})['then'](handleEntityNotFound(_0x25dfe4,null))[_0xac7e('0x20')](function(_0x47b2cd){_0x8d81af[_0xac7e('0x89')]=_0x47b2cd;if(_0x8d81af[_0xac7e('0x89')]&&_0x8d81af[_0xac7e('0x89')][_0xac7e('0x40')]===_0xac7e('0x8a')&&_0x98be2e[_0xac7e('0x5b')][_0xac7e('0x8b')]){if(_0x98be2e['body']['statuses'][_0xac7e('0x48')]===0x0)return;if(_0x98be2e[_0xac7e('0x5b')][_0xac7e('0x8b')][0x0][_0xac7e('0x8c')]!==_0xac7e('0x8d'))return;return db['WhatsappMessage'][_0xac7e('0x35')]({'read':!![],'readAt':_0x98be2e[_0xac7e('0x5b')]['statuses'][0x0][_0xac7e('0x8e')]},{'where':{'messageId':_0x98be2e[_0xac7e('0x5b')][_0xac7e('0x8b')][0x0][_0xac7e('0x8f')]},'individualHooks':!![]})[_0xac7e('0x20')](function(_0x4b8956){return _0x25dfe4[_0xac7e('0x29')](0xc8)[_0xac7e('0x31')](_0x4b8956);});}_0x8d81af[_0xac7e('0x90')]=_['orderBy'](_0x47b2cd[_0xac7e('0x88')],[_0xac7e('0x82')],[_0xac7e('0x91')]);if(_0x8d81af[_0xac7e('0x89')][_0xac7e('0x88')]){delete _0x8d81af[_0xac7e('0x89')][_0xac7e('0x88')];}return db[_0xac7e('0x92')][_0xac7e('0x64')]()[_0xac7e('0x20')](function(_0x3d8c95){if(!_0x3d8c95){throw new db['Sequelize'][(_0xac7e('0x93'))](_0xac7e('0x94'));}_0x350e16=_['difference'](_['keys'](_0x3d8c95),['createdAt',_0xac7e('0x95')]);_0x26e4ea=_[_0xac7e('0x96')](_[_0xac7e('0x58')](_0x3d8c95),[_0xac7e('0x97'),_0xac7e('0x95'),'CompanyId',_0xac7e('0x98')]);_0x8d81af[_0xac7e('0x5b')]={'mapKey':_0xac7e('0x99')};if(_0x8d81af['account']&&_0x8d81af['account'][_0xac7e('0x40')]===_0xac7e('0x9a')){_0x8d81af[_0xac7e('0x5b')]['from']=_0x98be2e[_0xac7e('0x5b')][_0xac7e('0x9b')]['replace']('whatsapp:','');_0x8d81af[_0xac7e('0x5b')][_0xac7e('0x5b')]=_0x98be2e[_0xac7e('0x5b')][_0xac7e('0x9c')];_0x8d81af[_0xac7e('0x5b')]['messageId']=_0x98be2e[_0xac7e('0x5b')][_0xac7e('0x9d')];}if(_0x8d81af[_0xac7e('0x89')]&&_0x8d81af[_0xac7e('0x89')]['type']===_0xac7e('0x8a')){_0x8d81af[_0xac7e('0x5b')][_0xac7e('0x9e')]=_0x98be2e['body'][_0xac7e('0x9f')][0x0]['from'];_0x8d81af[_0xac7e('0x5b')][_0xac7e('0x5b')]=_0x98be2e[_0xac7e('0x5b')]['notifications'][0x0]['message'][_0xac7e('0x5b')];_0x8d81af[_0xac7e('0x5b')][_0xac7e('0xa0')]=_0x98be2e[_0xac7e('0x5b')][_0xac7e('0x9f')][0x0]['message_id'];}if(_0x8d81af['body']['id']){delete _0x8d81af[_0xac7e('0x5b')]['id'];}if(_[_0xac7e('0xa1')](_0x8d81af[_0xac7e('0x5b')]['from'])){throw new db[(_0xac7e('0xa2'))][(_0xac7e('0x93'))](_0xac7e('0xa3'));}if(_[_0xac7e('0xa1')](_0x8d81af[_0xac7e('0x5b')][_0xac7e('0x5b')])||_0x8d81af[_0xac7e('0x5b')][_0xac7e('0x5b')]===''){throw new db[(_0xac7e('0xa2'))][(_0xac7e('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xac7e('0xa1')](_0x8d81af[_0xac7e('0x5b')]['mapKey'])){throw new db[(_0xac7e('0xa2'))][(_0xac7e('0x93'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x26e4ea);}if(!_['includes'](_0x26e4ea,_0x8d81af[_0xac7e('0x5b')][_0xac7e('0xa4')])){throw new db[(_0xac7e('0xa2'))]['ValidationError'](_0xac7e('0xa5')+_0x26e4ea);}_0x407c4b[_0x8d81af[_0xac7e('0x5b')][_0xac7e('0xa4')]]=_0x8d81af[_0xac7e('0x5b')][_0xac7e('0x9e')];return db[_0xac7e('0xa6')][_0xac7e('0x63')]({'where':{'id':_0x8d81af[_0xac7e('0x89')][_0xac7e('0x98')]},'include':[{'model':db[_0xac7e('0x92')],'as':'Contacts','where':_0x407c4b,'limit':0x1,'order':[[_0xac7e('0x95'),_0xac7e('0xa7')]]}]});})[_0xac7e('0x20')](handleEntityNotFound(_0x25dfe4,null))['then'](function(_0x1e8a07){if(_0x1e8a07){_0x8d81af[_0xac7e('0xa8')]=_[_0xac7e('0x72')](_0x1e8a07,['Contacts']);if(_0x1e8a07[_0xac7e('0xa9')][_0xac7e('0x48')]){return _0x1e8a07[_0xac7e('0xa9')][0x0];}var _0xb93047=_['defaults'](_0x8d81af['body'],{'firstName':_0x8d81af['body'][_0xac7e('0x9e')],'ListId':_0x1e8a07['id']});_0xb93047[_0x8d81af[_0xac7e('0x5b')][_0xac7e('0xa4')]]=_0x8d81af['body'][_0xac7e('0x9e')];return db[_0xac7e('0x92')]['create'](_0xb93047,{'fields':_0x350e16,'raw':!![]});}})[_0xac7e('0x20')](handleEntityNotFound(_0x25dfe4,null))[_0xac7e('0x20')](function(_0x5cbd44){if(_0x5cbd44){_0x8d81af[_0xac7e('0xaa')]=_0x5cbd44;var _0x2ab592={'ContactId':_0x5cbd44['id'],'phone':_0x8d81af[_0xac7e('0x5b')][_0xac7e('0x9e')],'WhatsappAccountId':_0x98be2e[_0xac7e('0x57')]['id']};var _0x282bc5={'ContactId':_0x5cbd44['id'],'WhatsappAccountId':_0x98be2e[_0xac7e('0x57')]['id'],'closed':![]};return db[_0xac7e('0xab')]['find']({'where':_0x282bc5})[_0xac7e('0x20')](function(_0x4a0209){if(_0x4a0209){return[_0x4a0209,![]];}return db['WhatsappInteraction']['create'](_0x2ab592)[_0xac7e('0x20')](function(_0x593e46){return[_0x593e46,!![]];});});}})[_0xac7e('0x73')](function(_0x485999,_0x5523dc){_0x8d81af[_0xac7e('0xac')]=_0x485999[_0xac7e('0x37')]({'plain':!![]});_0x8d81af['interaction']['created']=![];if(_0x5523dc){if(_0x8d81af[_0xac7e('0x89')][_0xac7e('0xad')]){_0x8d81af[_0xac7e('0x90')][_0xac7e('0xae')]({'id':0x0,'priority':_0x8d81af['applications'][_0xac7e('0x48')]+0x1,'app':_0xac7e('0xaf'),'appdata':_0xac7e('0xb0'),'interval':_0xac7e('0xb1')});}_0x8d81af[_0xac7e('0xac')]['created']=!![];}return db[_0xac7e('0xb2')]['create']({'phone':_0x8d81af[_0xac7e('0x5b')][_0xac7e('0x9e')],'messageId':_0x8d81af[_0xac7e('0x5b')]['messageId'],'body':_0x8d81af[_0xac7e('0x5b')][_0xac7e('0x5b')],'WhatsappAccountId':_0x98be2e[_0xac7e('0x57')]['id'],'WhatsappInteractionId':_0x485999['id'],'direction':'in','ContactId':_0x485999['ContactId'],'AttachmentId':_0x8d81af[_0xac7e('0x5b')]['AttachmentId']});})[_0xac7e('0x20')](function(_0x3e39c3){_0x8d81af[_0xac7e('0x27')]=_0x3e39c3;if(_0x8d81af[_0xac7e('0xac')][_0xac7e('0xb3')]){return db[_0xac7e('0x7a')][_0xac7e('0x63')]({'attributes':['id',_0xac7e('0x3b')],'where':{'id':_0x8d81af[_0xac7e('0xac')]['UserId']}})[_0xac7e('0x20')](function(_0x4c487f){if(_0x4c487f){_0x8d81af[_0xac7e('0x90')][_0xac7e('0xb4')]({'id':0x0,'priority':0x0,'app':_0xac7e('0xb5'),'appdata':_0x4c487f[_0xac7e('0x3b')]+','+(_0x8d81af[_0xac7e('0x89')][_0xac7e('0xb6')]||0xa),'interval':_0xac7e('0xb1')});}return respondWithRpcPromise(_0xac7e('0xb7'),_0xac7e('0xb8'),_0x8d81af);});}return respondWithRpcPromise(_0xac7e('0xb7'),_0xac7e('0xb8'),_0x8d81af);})[_0xac7e('0x20')](function(_0x26789a){if(_0x26789a){var _0x540e16=0xc8;var _0x6d50ad=_0xac7e('0xb9');logger[_0xac7e('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x6d50ad,_0x540e16,_0xac7e('0xba'));logger['debug'](_0xac7e('0xbb'),_0x6d50ad,_0x540e16,_0xac7e('0xba'),JSON[_0xac7e('0xbc')](_0x26789a));if(_0x8d81af[_0xac7e('0x89')][_0xac7e('0x40')]===_0xac7e('0x9a')){return _0x25dfe4[_0xac7e('0x29')](_0x540e16)[_0xac7e('0x2f')](_0xac7e('0xbd'),_0xac7e('0xbe'))[_0xac7e('0x84')]('\x0a');}else{return _0x25dfe4[_0xac7e('0x29')](_0x540e16)[_0xac7e('0x31')](_0x26789a);}}});})[_0xac7e('0x55')](handleError(_0x25dfe4,null));};exports[_0xac7e('0x84')]=function(_0x1ba86c,_0x14a9af,_0x254d5c){var _0x1c385a,_0x23b7c4,_0x186f2b;if(_[_0xac7e('0xa1')](_0x1ba86c[_0xac7e('0x5b')][_0xac7e('0x5b')])||_0x1ba86c[_0xac7e('0x5b')][_0xac7e('0x5b')]===''){throw new db[(_0xac7e('0xa2'))][(_0xac7e('0x93'))](_0xac7e('0xbf'));}if(_[_0xac7e('0xa1')](_0x1ba86c[_0xac7e('0x5b')]['to'])){throw new db[(_0xac7e('0xa2'))]['ValidationError'](_0xac7e('0xc0'));}_0x1c385a=_0x1ba86c['body']['to'];return db[_0xac7e('0x3e')]['find']({'where':{'id':_0x1ba86c['params']['id']},'include':[{'model':db[_0xac7e('0xa6')],'as':'List','include':[{'model':db['CmContact'],'as':_0xac7e('0xa9'),'where':{'mobile':_0x1c385a},'limit':0x1,'order':[[_0xac7e('0x95'),_0xac7e('0xa7')]]}]}]})[_0xac7e('0x20')](handleEntityNotFound(_0x14a9af,null))[_0xac7e('0x20')](function(_0x33efbc){if(_0x33efbc&&_0x33efbc[_0xac7e('0xc1')]){_0x23b7c4=_0x33efbc[_0xac7e('0x37')]({'plain':!![]});if(_0x23b7c4[_0xac7e('0xc1')]&&_0x23b7c4[_0xac7e('0xc1')][_0xac7e('0xa9')][_0xac7e('0x48')]){return _0x23b7c4[_0xac7e('0xc1')][_0xac7e('0xa9')][0x0];}return db[_0xac7e('0x92')][_0xac7e('0x5a')](_[_0xac7e('0xc2')](_0x1ba86c['body'],{'firstName':_0x1c385a,'mobile':_0x1c385a,'phone':_0x1c385a,'ListId':_0x23b7c4[_0xac7e('0x98')]}));}})['then'](handleEntityNotFound(_0x14a9af,null))[_0xac7e('0x20')](function(_0xd7a17d){if(_0xd7a17d){_0x186f2b=_0xd7a17d;return db['WhatsappInteraction'][_0xac7e('0x63')]({'where':{'ContactId':_0x186f2b['id'],'closed':![],'WhatsappAccountId':_0x23b7c4['id']}})[_0xac7e('0x20')](function(_0x565bca){if(_0x565bca){return[_0x565bca,![]];}return db[_0xac7e('0xab')][_0xac7e('0x5a')]({'UserId':_0x1ba86c[_0xac7e('0x5c')]['id'],'ContactId':_0x186f2b['id'],'WhatsappAccountId':_0x23b7c4['id'],'phone':_0x1c385a,'firstMsgDirection':'out','Messages':[_[_0xac7e('0x4f')](_0x1ba86c[_0xac7e('0x5b')],{'read':![],'body':_0x1ba86c[_0xac7e('0x5b')][_0xac7e('0x5b')],'phone':_0x1c385a,'WhatsappAccountId':_0x23b7c4['id'],'UserId':_0x1ba86c[_0xac7e('0x5c')]['id'],'ContactId':_0x186f2b['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xac7e('0xc3')}]})[_0xac7e('0x20')](function(_0x3850b9){return[_0x3850b9,!![]];});});}})[_0xac7e('0x73')](function(_0xd9dc0,_0xbfafa1){if(_0xbfafa1){return _0xd9dc0;}return db[_0xac7e('0xb2')][_0xac7e('0x5a')](_[_0xac7e('0x4f')](_0x1ba86c[_0xac7e('0x5b')],{'read':![],'body':_0x1ba86c['body'][_0xac7e('0x5b')],'phone':_0x1c385a,'WhatsappAccountId':_0x23b7c4['id'],'WhatsappInteractionId':_0xd9dc0['id'],'UserId':_0x1ba86c[_0xac7e('0x5c')]['id'],'ContactId':_0x186f2b['id']}))['then'](function(_0x969c35){_0xd9dc0[_0xac7e('0xc4')]['Messages']=[];_0xd9dc0['dataValues']['Messages'][_0xac7e('0xae')](_0x969c35['dataValues']);return _0xd9dc0;});})[_0xac7e('0x20')](respondWithResult(_0x14a9af,null))[_0xac7e('0x55')](handleError(_0x14a9af,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 1c4c5a2..ccf1992 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 _0x6694=['hasOwnProperty','hook','../../mysqldb','setMaxListeners','update','emit'];(function(_0x55f298,_0x1ed1bb){var _0x26c867=function(_0x2a5861){while(--_0x2a5861){_0x55f298['push'](_0x55f298['shift']());}};_0x26c867(++_0x1ed1bb);}(_0x6694,0x1f4));var _0x4669=function(_0x2a16c7,_0x3ad31f){_0x2a16c7=_0x2a16c7-0x0;var _0x3880f3=_0x6694[_0x2a16c7];return _0x3880f3;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x4669('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x4669('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4669('0x2'),'afterDestroy':'remove'};function emitEvent(_0xe1f80a){return function(_0x4449c3,_0x24cfd8,_0x3a621f){WhatsappAccountEvents[_0x4669('0x3')](_0xe1f80a+':'+_0x4449c3['id'],_0x4449c3);WhatsappAccountEvents['emit'](_0xe1f80a,_0x4449c3);_0x3a621f(null);};}for(var e in events){if(events[_0x4669('0x4')](e)){var event=events[e];WhatsappAccount[_0x4669('0x5')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xd3f5=['setMaxListeners','save','emit','hasOwnProperty','exports','WhatsappAccount'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xd3f5,0x1cd));var _0x5d3f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3f5[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x5d3f('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5d3f('0x1')](0x0);var events={'afterCreate':_0x5d3f('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x30fe2f){return function(_0x1da5b0,_0xb0d32e,_0xb924c6){WhatsappAccountEvents['emit'](_0x30fe2f+':'+_0x1da5b0['id'],_0x1da5b0);WhatsappAccountEvents[_0x5d3f('0x3')](_0x30fe2f,_0x1da5b0);_0xb924c6(null);};}for(var e in events){if(events[_0x5d3f('0x4')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x5d3f('0x5')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index af9ef8e..8e6c74a 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 _0xc305=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0xffae49,_0x499f2e){var _0xd6a2f1=function(_0xc36368){while(--_0xc36368){_0xffae49['push'](_0xffae49['shift']());}};_0xd6a2f1(++_0x499f2e);}(_0xc305,0xce));var _0x5c30=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xc305[_0x9c2427];return _0x51984f;};'use strict';var _=require(_0x5c30('0x0'));var util=require(_0x5c30('0x1'));var logger=require('../../config/logger')(_0x5c30('0x2'));var moment=require(_0x5c30('0x3'));var BPromise=require(_0x5c30('0x4'));var rp=require(_0x5c30('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c30('0x6'));var config=require(_0x5c30('0x7'));var attributes=require(_0x5c30('0x8'));module[_0x5c30('0x9')]=function(_0x2e2470,_0x241a90){return _0x2e2470[_0x5c30('0xa')](_0x5c30('0xb'),attributes,{'tableName':_0x5c30('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1159=['path','rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x255ddd,_0x29a8c9){var _0x148345=function(_0x38e12e){while(--_0x38e12e){_0x255ddd['push'](_0x255ddd['shift']());}};_0x148345(++_0x29a8c9);}(_0x1159,0x89));var _0x9115=function(_0x18ece9,_0x170d64){_0x18ece9=_0x18ece9-0x0;var _0x268008=_0x1159[_0x18ece9];return _0x268008;};'use strict';var _=require(_0x9115('0x0'));var util=require(_0x9115('0x1'));var logger=require(_0x9115('0x2'))(_0x9115('0x3'));var moment=require('moment');var BPromise=require(_0x9115('0x4'));var rp=require(_0x9115('0x5'));var fs=require('fs');var path=require(_0x9115('0x6'));var rimraf=require(_0x9115('0x7'));var config=require(_0x9115('0x8'));var attributes=require(_0x9115('0x9'));module['exports']=function(_0x43fab2,_0x1d9a3f){return _0x43fab2[_0x9115('0xa')](_0x9115('0xb'),attributes,{'tableName':_0x9115('0xc'),'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 13c2b64..9678edf 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 _0x980c=['catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model','then','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x225493,_0x2231ad){var _0xe56b9a=function(_0x5a6b91){while(--_0x5a6b91){_0x225493['push'](_0x225493['shift']());}};_0xe56b9a(++_0x2231ad);}(_0x980c,0x161));var _0xc980=function(_0x24d6c7,_0x591cfe){_0x24d6c7=_0x24d6c7-0x0;var _0x2652e2=_0x980c[_0x24d6c7];return _0x2652e2;};'use strict';var _=require(_0xc980('0x0'));var util=require(_0xc980('0x1'));var moment=require(_0xc980('0x2'));var BPromise=require('bluebird');var rs=require(_0xc980('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc980('0x4'))['db'];var utils=require(_0xc980('0x5'));var logger=require(_0xc980('0x6'))(_0xc980('0x7'));var config=require(_0xc980('0x8'));var jayson=require(_0xc980('0x9'));var client=jayson['client'][_0xc980('0xa')]({'port':0x232a});config[_0xc980('0xb')]=_[_0xc980('0xc')](config[_0xc980('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc980('0xd'))(new Redis(config[_0xc980('0xb')]));require(_0xc980('0xe'))[_0xc980('0xf')](socket);function respondWithRpcPromise(_0x361219,_0x36693e,_0x2a6935){return new BPromise(function(_0x513cb2,_0x4d12f4){return client[_0xc980('0x10')](_0x361219,_0x2a6935)['then'](function(_0x3db8fe){logger['info'](_0xc980('0x11'),_0x36693e,'request\x20sent');logger[_0xc980('0x12')](_0xc980('0x13'),_0x36693e,_0xc980('0x14'),JSON[_0xc980('0x15')](_0x3db8fe));if(_0x3db8fe[_0xc980('0x16')]){if(_0x3db8fe[_0xc980('0x16')][_0xc980('0x17')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x36693e,_0x3db8fe[_0xc980('0x16')]['message']);return _0x4d12f4(_0x3db8fe['error'][_0xc980('0x18')]);}logger[_0xc980('0x16')](_0xc980('0x11'),_0x36693e,_0x3db8fe[_0xc980('0x16')][_0xc980('0x18')]);return _0x513cb2(_0x3db8fe[_0xc980('0x16')][_0xc980('0x18')]);}else{logger[_0xc980('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x36693e,'request\x20sent');_0x513cb2(_0x3db8fe[_0xc980('0x1a')][_0xc980('0x18')]);}})[_0xc980('0x1b')](function(_0x3a6c69){logger['error'](_0xc980('0x11'),_0x36693e,_0x3a6c69);_0x4d12f4(_0x3a6c69);});});}exports[_0xc980('0x1c')]=function(_0x316542){var _0x5d6898=this;return new Promise(function(_0x21ef50,_0x166b17){return db[_0xc980('0x1d')]['find']({'raw':_0x316542[_0xc980('0x1e')]?_0x316542[_0xc980('0x1e')][_0xc980('0x1f')]===undefined?!![]:![]:!![],'where':_0x316542['options']?_0x316542[_0xc980('0x1e')][_0xc980('0x20')]||null:null,'attributes':_0x316542[_0xc980('0x1e')]?_0x316542[_0xc980('0x1e')][_0xc980('0x21')]||null:null,'include':_0x316542[_0xc980('0x1e')]?_0x316542[_0xc980('0x1e')][_0xc980('0x22')]?_[_0xc980('0x23')](_0x316542[_0xc980('0x1e')][_0xc980('0x22')],function(_0x36da9f){return{'model':db[_0x36da9f[_0xc980('0x24')]],'as':_0x36da9f['as'],'attributes':_0x36da9f[_0xc980('0x21')],'include':_0x36da9f[_0xc980('0x22')]?_['map'](_0x36da9f['include'],function(_0x221693){return{'model':db[_0x221693['model']],'as':_0x221693['as'],'attributes':_0x221693[_0xc980('0x21')],'include':_0x221693['include']?_[_0xc980('0x23')](_0x221693[_0xc980('0x22')],function(_0x5711c3){return{'model':db[_0x5711c3['model']],'as':_0x5711c3['as'],'attributes':_0x5711c3[_0xc980('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc980('0x25')](function(_0xa12643){logger['info'](_0xc980('0x1c'),_0x316542);logger[_0xc980('0x12')]('ShowWhatsappAccount',_0x316542,JSON['stringify'](_0xa12643));_0x21ef50(_0xa12643);})[_0xc980('0x1b')](function(_0x2c2deb){logger[_0xc980('0x16')]('ShowWhatsappAccount',_0x2c2deb[_0xc980('0x18')],_0x316542);_0x166b17(_0x5d6898['error'](0x1f4,_0x2c2deb[_0xc980('0x18')]));});});}; \ No newline at end of file +var _0xd817=['lodash','util','randomstring','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','model','map','info'];(function(_0x3bd827,_0x89145f){var _0x3274fd=function(_0x1a31ef){while(--_0x1a31ef){_0x3bd827['push'](_0x3bd827['shift']());}};_0x3274fd(++_0x89145f);}(_0xd817,0x1ba));var _0x7d81=function(_0x53f608,_0x256def){_0x53f608=_0x53f608-0x0;var _0x495b7d=_0xd817[_0x53f608];return _0x495b7d;};'use strict';var _=require(_0x7d81('0x0'));var util=require(_0x7d81('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7d81('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7d81('0x3'))('rpc');var config=require(_0x7d81('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x7d81('0x5')][_0x7d81('0x6')]({'port':0x232a});config[_0x7d81('0x7')]=_[_0x7d81('0x8')](config[_0x7d81('0x7')],{'host':_0x7d81('0x9'),'port':0x18eb});var socket=require(_0x7d81('0xa'))(new Redis(config[_0x7d81('0x7')]));require(_0x7d81('0xb'))[_0x7d81('0xc')](socket);function respondWithRpcPromise(_0x1f7144,_0x3654d2,_0x59873a){return new BPromise(function(_0x45f9eb,_0x21a9bb){return client[_0x7d81('0xd')](_0x1f7144,_0x59873a)[_0x7d81('0xe')](function(_0x5e3012){logger['info'](_0x7d81('0xf'),_0x3654d2,'request\x20sent');logger[_0x7d81('0x10')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3654d2,_0x7d81('0x11'),JSON[_0x7d81('0x12')](_0x5e3012));if(_0x5e3012[_0x7d81('0x13')]){if(_0x5e3012[_0x7d81('0x13')][_0x7d81('0x14')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3654d2,_0x5e3012['error'][_0x7d81('0x15')]);return _0x21a9bb(_0x5e3012[_0x7d81('0x13')][_0x7d81('0x15')]);}logger['error'](_0x7d81('0xf'),_0x3654d2,_0x5e3012[_0x7d81('0x13')][_0x7d81('0x15')]);return _0x45f9eb(_0x5e3012[_0x7d81('0x13')]['message']);}else{logger['info'](_0x7d81('0xf'),_0x3654d2,_0x7d81('0x11'));_0x45f9eb(_0x5e3012[_0x7d81('0x16')][_0x7d81('0x15')]);}})[_0x7d81('0x17')](function(_0x293114){logger[_0x7d81('0x13')](_0x7d81('0xf'),_0x3654d2,_0x293114);_0x21a9bb(_0x293114);});});}exports[_0x7d81('0x18')]=function(_0x6c1300){var _0x3eed0c=this;return new Promise(function(_0x5789f9,_0x1b1661){return db[_0x7d81('0x19')][_0x7d81('0x1a')]({'raw':_0x6c1300[_0x7d81('0x1b')]?_0x6c1300[_0x7d81('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x6c1300[_0x7d81('0x1b')]?_0x6c1300['options'][_0x7d81('0x1c')]||null:null,'attributes':_0x6c1300[_0x7d81('0x1b')]?_0x6c1300[_0x7d81('0x1b')][_0x7d81('0x1d')]||null:null,'include':_0x6c1300[_0x7d81('0x1b')]?_0x6c1300[_0x7d81('0x1b')][_0x7d81('0x1e')]?_['map'](_0x6c1300[_0x7d81('0x1b')][_0x7d81('0x1e')],function(_0x342862){return{'model':db[_0x342862[_0x7d81('0x1f')]],'as':_0x342862['as'],'attributes':_0x342862[_0x7d81('0x1d')],'include':_0x342862[_0x7d81('0x1e')]?_[_0x7d81('0x20')](_0x342862[_0x7d81('0x1e')],function(_0x3904ae){return{'model':db[_0x3904ae[_0x7d81('0x1f')]],'as':_0x3904ae['as'],'attributes':_0x3904ae[_0x7d81('0x1d')],'include':_0x3904ae['include']?_[_0x7d81('0x20')](_0x3904ae[_0x7d81('0x1e')],function(_0x2c5d66){return{'model':db[_0x2c5d66['model']],'as':_0x2c5d66['as'],'attributes':_0x2c5d66['attributes']};}):[]};}):[]};}):[]:[]})[_0x7d81('0xe')](function(_0x366ba3){logger[_0x7d81('0x21')]('ShowWhatsappAccount',_0x6c1300);logger[_0x7d81('0x10')]('ShowWhatsappAccount',_0x6c1300,JSON['stringify'](_0x366ba3));_0x5789f9(_0x366ba3);})[_0x7d81('0x17')](function(_0x400e50){logger[_0x7d81('0x13')](_0x7d81('0x18'),_0x400e50[_0x7d81('0x15')],_0x6c1300);_0x1b1661(_0x3eed0c['error'](0x1f4,_0x400e50[_0x7d81('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index ec63015..c056da2 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 _0x253f=['length','whatsappAccount:','./whatsappAccount.events','save','remove','emit','removeListener'];(function(_0x25be73,_0x4d7c8e){var _0x3778fa=function(_0x1750e1){while(--_0x1750e1){_0x25be73['push'](_0x25be73['shift']());}};_0x3778fa(++_0x4d7c8e);}(_0x253f,0x79));var _0xf253=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x253f[_0x36eaaa];return _0x461349;};'use strict';var WhatsappAccountEvents=require(_0xf253('0x0'));var events=[_0xf253('0x1'),_0xf253('0x2'),'update'];function createListener(_0x16a062,_0x2a2009){return function(_0x55d3e5){_0x2a2009[_0xf253('0x3')](_0x16a062,_0x55d3e5);};}function removeListener(_0x5dc2e2,_0x5e9e20){return function(){WhatsappAccountEvents[_0xf253('0x4')](_0x5dc2e2,_0x5e9e20);};}exports['register']=function(_0x53e7ec){for(var _0x5324f5=0x0,_0x29a9e4=events[_0xf253('0x5')];_0x5324f5<_0x29a9e4;_0x5324f5++){var _0x25821e=events[_0x5324f5];var _0x3f464a=createListener(_0xf253('0x6')+_0x25821e,_0x53e7ec);WhatsappAccountEvents['on'](_0x25821e,_0x3f464a);}}; \ No newline at end of file +var _0x7bac=['update','emit','register','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x1ec47f,_0x2c326e){var _0x2d0650=function(_0xa173f1){while(--_0xa173f1){_0x1ec47f['push'](_0x1ec47f['shift']());}};_0x2d0650(++_0x2c326e);}(_0x7bac,0xf3));var _0xc7ba=function(_0x408de5,_0x24fa7b){_0x408de5=_0x408de5-0x0;var _0x2015a1=_0x7bac[_0x408de5];return _0x2015a1;};'use strict';var WhatsappAccountEvents=require(_0xc7ba('0x0'));var events=[_0xc7ba('0x1'),'remove',_0xc7ba('0x2')];function createListener(_0x479eb1,_0x4fdffd){return function(_0x23f49e){_0x4fdffd[_0xc7ba('0x3')](_0x479eb1,_0x23f49e);};}function removeListener(_0x4524b0,_0x349c70){return function(){WhatsappAccountEvents['removeListener'](_0x4524b0,_0x349c70);};}exports[_0xc7ba('0x4')]=function(_0xddde8c){for(var _0x3595ee=0x0,_0x4c87f3=events[_0xc7ba('0x5')];_0x3595ee<_0x4c87f3;_0x3595ee++){var _0x1d659b=events[_0x3595ee];var _0x43afbe=createListener(_0xc7ba('0x6')+_0x1d659b,_0xddde8c);WhatsappAccountEvents['on'](_0x1d659b,_0x43afbe);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 49db86e..274696b 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 _0x4b94=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x4b94,0x10d));var _0x44b9=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x4b94[_0x4ab3fb];return _0x34fe1e;};'use strict';var multer=require(_0x44b9('0x0'));var util=require(_0x44b9('0x1'));var path=require('path');var timeout=require(_0x44b9('0x2'));var express=require(_0x44b9('0x3'));var router=express['Router']();var fs_extra=require(_0x44b9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x44b9('0x5'));var config=require(_0x44b9('0x6'));var controller=require(_0x44b9('0x7'));router['get']('/',auth[_0x44b9('0x8')](),controller[_0x44b9('0x9')]);router['get'](_0x44b9('0xa'),auth[_0x44b9('0x8')](),controller[_0x44b9('0xb')]);router[_0x44b9('0xc')]('/',auth[_0x44b9('0x8')](),controller['create']);router[_0x44b9('0xd')]('/:id',auth[_0x44b9('0x8')](),controller[_0x44b9('0xe')]);router[_0x44b9('0xf')](_0x44b9('0xa'),auth['isAuthenticated'](),controller[_0x44b9('0x10')]);module[_0x44b9('0x11')]=router; \ No newline at end of file +var _0x26e1=['../../config/environment','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','multer','util','path','express','Router'];(function(_0x5e0420,_0x1eb239){var _0x849654=function(_0x10dda6){while(--_0x10dda6){_0x5e0420['push'](_0x5e0420['shift']());}};_0x849654(++_0x1eb239);}(_0x26e1,0x1db));var _0x126e=function(_0x2dc2de,_0x3c0d4d){_0x2dc2de=_0x2dc2de-0x0;var _0x241826=_0x26e1[_0x2dc2de];return _0x241826;};'use strict';var multer=require(_0x126e('0x0'));var util=require(_0x126e('0x1'));var path=require(_0x126e('0x2'));var timeout=require('connect-timeout');var express=require(_0x126e('0x3'));var router=express[_0x126e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x126e('0x5'));var controller=require('./whatsappApplication.controller');router[_0x126e('0x6')]('/',auth[_0x126e('0x7')](),controller[_0x126e('0x8')]);router['get'](_0x126e('0x9'),auth[_0x126e('0x7')](),controller['show']);router[_0x126e('0xa')]('/',auth[_0x126e('0x7')](),controller[_0x126e('0xb')]);router['put']('/:id',auth[_0x126e('0x7')](),controller[_0x126e('0xc')]);router[_0x126e('0xd')](_0x126e('0x9'),auth[_0x126e('0x7')](),controller[_0x126e('0xe')]);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 ec03f38..33332be 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 _0x2991=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1fa841,_0x37a70c){var _0x384b67=function(_0x248c40){while(--_0x248c40){_0x1fa841['push'](_0x1fa841['shift']());}};_0x384b67(++_0x37a70c);}(_0x2991,0x186));var _0x1299=function(_0x3e6d6e,_0x396d72){_0x3e6d6e=_0x3e6d6e-0x0;var _0x526f75=_0x2991[_0x3e6d6e];return _0x526f75;};'use strict';var Sequelize=require(_0x1299('0x0'));module[_0x1299('0x1')]={'priority':{'type':Sequelize[_0x1299('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1299('0x3')],'allowNull':![],'defaultValue':_0x1299('0x4')},'appdata':{'type':Sequelize[_0x1299('0x5')]()},'description':{'type':Sequelize[_0x1299('0x3')]},'interval':{'type':Sequelize[_0x1299('0x3')],'defaultValue':_0x1299('0x6')}}; \ No newline at end of file +var _0xc2c3=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0xc5e03a,_0x3150cc){var _0x4aa5c5=function(_0x471e32){while(--_0x471e32){_0xc5e03a['push'](_0xc5e03a['shift']());}};_0x4aa5c5(++_0x3150cc);}(_0xc2c3,0x16b));var _0x3c2c=function(_0xb16c1d,_0x3e2da2){_0xb16c1d=_0xb16c1d-0x0;var _0xe0e068=_0xc2c3[_0xb16c1d];return _0xe0e068;};'use strict';var Sequelize=require(_0x3c2c('0x0'));module['exports']={'priority':{'type':Sequelize[_0x3c2c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3c2c('0x2')],'allowNull':![],'defaultValue':_0x3c2c('0x3')},'appdata':{'type':Sequelize[_0x3c2c('0x4')]()},'description':{'type':Sequelize[_0x3c2c('0x2')]},'interval':{'type':Sequelize[_0x3c2c('0x2')],'defaultValue':_0x3c2c('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 1a6e341..e72cd80 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 _0x1e82=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x53445d,_0x3491ba){var _0x8d335b=function(_0x2bf2b7){while(--_0x2bf2b7){_0x53445d['push'](_0x53445d['shift']());}};_0x8d335b(++_0x3491ba);}(_0x1e82,0x8b));var _0x21e8=function(_0xe7475e,_0x44e740){_0xe7475e=_0xe7475e-0x0;var _0x290371=_0x1e82[_0xe7475e];return _0x290371;};'use strict';var emlformat=require(_0x21e8('0x0'));var rimraf=require(_0x21e8('0x1'));var zipdir=require(_0x21e8('0x2'));var jsonpatch=require(_0x21e8('0x3'));var rp=require(_0x21e8('0x4'));var moment=require(_0x21e8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x21e8('0x6'));var util=require(_0x21e8('0x7'));var path=require('path');var sox=require(_0x21e8('0x8'));var csv=require('to-csv');var ejs=require(_0x21e8('0x9'));var fs=require('fs');var fs_extra=require(_0x21e8('0xa'));var _=require(_0x21e8('0xb'));var squel=require(_0x21e8('0xc'));var crypto=require('crypto');var jsforce=require(_0x21e8('0xd'));var deskjs=require(_0x21e8('0xe'));var toCsv=require(_0x21e8('0xf'));var querystring=require('querystring');var Papa=require(_0x21e8('0x10'));var Redis=require(_0x21e8('0x11'));var authService=require(_0x21e8('0x12'));var qs=require(_0x21e8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x21e8('0x14'))('api');var utils=require(_0x21e8('0x15'));var config=require(_0x21e8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x21e8('0x17'))['db'];function respondWithStatusCode(_0x4f0134,_0x22d02e){_0x22d02e=_0x22d02e||0xcc;return function(_0x2afc7a){if(_0x2afc7a){return _0x4f0134[_0x21e8('0x18')](_0x22d02e);}return _0x4f0134['status'](_0x22d02e)[_0x21e8('0x19')]();};}function respondWithResult(_0x4adde2,_0x271ee6){_0x271ee6=_0x271ee6||0xc8;return function(_0x3c6bf2){if(_0x3c6bf2){return _0x4adde2[_0x21e8('0x1a')](_0x271ee6)['json'](_0x3c6bf2);}};}function respondWithFilteredResult(_0x4ee658,_0xdd4891){return function(_0x363856){if(_0x363856){var _0x2b6ad6=typeof _0xdd4891[_0x21e8('0x1b')]===_0x21e8('0x1c')&&typeof _0xdd4891[_0x21e8('0x1d')]===_0x21e8('0x1c');var _0x2f66f1=_0x363856[_0x21e8('0x1e')];var _0x552c6f=_0x2b6ad6?0x0:_0xdd4891[_0x21e8('0x1b')];var _0x4f76b8=_0x2b6ad6?_0x363856['count']:_0xdd4891[_0x21e8('0x1b')]+_0xdd4891[_0x21e8('0x1d')];var _0x227925;if(_0x4f76b8>=_0x2f66f1){_0x4f76b8=_0x2f66f1;_0x227925=0xc8;}else{_0x227925=0xce;}_0x4ee658[_0x21e8('0x1a')](_0x227925);return _0x4ee658['set'](_0x21e8('0x1f'),_0x552c6f+'-'+_0x4f76b8+'/'+_0x2f66f1)[_0x21e8('0x20')](_0x363856);}return null;};}function patchUpdates(_0x25b678){return function(_0x2e5d89){try{jsonpatch[_0x21e8('0x21')](_0x2e5d89,_0x25b678,!![]);}catch(_0x12a935){return BPromise[_0x21e8('0x22')](_0x12a935);}return _0x2e5d89[_0x21e8('0x23')]();};}function saveUpdates(_0x4bcb4c,_0xc9673c){return function(_0x34937f){if(_0x34937f){return _0x34937f['update'](_0x4bcb4c)[_0x21e8('0x24')](function(_0x402f0f){return _0x402f0f;});}return null;};}function removeEntity(_0x34fcfa,_0x168f1){return function(_0x2a4a59){if(_0x2a4a59){return _0x2a4a59[_0x21e8('0x25')]()[_0x21e8('0x24')](function(){_0x34fcfa[_0x21e8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x155d04,_0x5964ab){return function(_0x232351){if(!_0x232351){_0x155d04[_0x21e8('0x18')](0x194);}return _0x232351;};}function handleError(_0x29bc23,_0x559509){_0x559509=_0x559509||0x1f4;return function(_0x1bdd15){logger['error'](_0x1bdd15[_0x21e8('0x26')]);if(_0x1bdd15[_0x21e8('0x27')]){delete _0x1bdd15[_0x21e8('0x27')];}_0x29bc23['status'](_0x559509)[_0x21e8('0x28')](_0x1bdd15);};}exports[_0x21e8('0x29')]=function(_0x364cd8,_0x5e79c5){var _0x3348b0={},_0x3a5ff1={},_0x10131a={'count':0x0,'rows':[]};var _0x62da08=_[_0x21e8('0x2a')](db[_0x21e8('0x2b')][_0x21e8('0x2c')],function(_0x3339b6){return{'name':_0x3339b6[_0x21e8('0x2d')],'type':_0x3339b6[_0x21e8('0x2e')][_0x21e8('0x2f')]};});_0x3a5ff1[_0x21e8('0x30')]=_['map'](_0x62da08,_0x21e8('0x27'));_0x3a5ff1[_0x21e8('0x31')]=_['keys'](_0x364cd8['query']);_0x3a5ff1['filters']=_[_0x21e8('0x32')](_0x3a5ff1['model'],_0x3a5ff1[_0x21e8('0x31')]);_0x3348b0[_0x21e8('0x33')]=_[_0x21e8('0x32')](_0x3a5ff1[_0x21e8('0x30')],qs['fields'](_0x364cd8['query'][_0x21e8('0x34')]));_0x3348b0['attributes']=_0x3348b0[_0x21e8('0x33')][_0x21e8('0x35')]?_0x3348b0[_0x21e8('0x33')]:_0x3a5ff1[_0x21e8('0x30')];if(!_0x364cd8['query'][_0x21e8('0x36')](_0x21e8('0x37'))){_0x3348b0[_0x21e8('0x1d')]=qs[_0x21e8('0x1d')](_0x364cd8[_0x21e8('0x31')]['limit']);_0x3348b0[_0x21e8('0x1b')]=qs[_0x21e8('0x1b')](_0x364cd8[_0x21e8('0x31')][_0x21e8('0x1b')]);}_0x3348b0[_0x21e8('0x38')]=qs[_0x21e8('0x39')](_0x364cd8[_0x21e8('0x31')][_0x21e8('0x39')]);_0x3348b0[_0x21e8('0x3a')]=qs[_0x21e8('0x3b')](_[_0x21e8('0x3c')](_0x364cd8[_0x21e8('0x31')],_0x3a5ff1[_0x21e8('0x3b')]),_0x62da08);if(_0x364cd8[_0x21e8('0x31')][_0x21e8('0x3d')]){_0x3348b0['where']=_[_0x21e8('0x3e')](_0x3348b0[_0x21e8('0x3a')],{'$or':_[_0x21e8('0x2a')](_0x62da08,function(_0x465ed2){if(_0x465ed2[_0x21e8('0x2e')]!==_0x21e8('0x3f')){var _0x3d86c2={};_0x3d86c2[_0x465ed2[_0x21e8('0x27')]]={'$like':'%'+_0x364cd8[_0x21e8('0x31')][_0x21e8('0x3d')]+'%'};return _0x3d86c2;}})});}_0x3348b0=_['merge']({},_0x3348b0,_0x364cd8[_0x21e8('0x40')]);var _0x4f893c={'where':_0x3348b0[_0x21e8('0x3a')]};return db[_0x21e8('0x2b')]['count'](_0x4f893c)[_0x21e8('0x24')](function(_0x2f7dc5){_0x10131a[_0x21e8('0x1e')]=_0x2f7dc5;if(_0x364cd8[_0x21e8('0x31')][_0x21e8('0x41')]){_0x3348b0['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x21e8('0x42')](_0x3348b0);})[_0x21e8('0x24')](function(_0x22b2a7){_0x10131a[_0x21e8('0x43')]=_0x22b2a7;return _0x10131a;})[_0x21e8('0x24')](respondWithFilteredResult(_0x5e79c5,_0x3348b0))[_0x21e8('0x44')](handleError(_0x5e79c5,null));};exports[_0x21e8('0x45')]=function(_0x4d47a3,_0x14d437){var _0x5af28d={'raw':!![],'where':{'id':_0x4d47a3[_0x21e8('0x46')]['id']}},_0x44094d={};_0x44094d[_0x21e8('0x30')]=_[_0x21e8('0x47')](db[_0x21e8('0x2b')][_0x21e8('0x2c')]);_0x44094d[_0x21e8('0x31')]=_[_0x21e8('0x47')](_0x4d47a3[_0x21e8('0x31')]);_0x44094d[_0x21e8('0x3b')]=_['intersection'](_0x44094d[_0x21e8('0x30')],_0x44094d[_0x21e8('0x31')]);_0x5af28d[_0x21e8('0x33')]=_['intersection'](_0x44094d[_0x21e8('0x30')],qs[_0x21e8('0x34')](_0x4d47a3[_0x21e8('0x31')]['fields']));_0x5af28d['attributes']=_0x5af28d[_0x21e8('0x33')]['length']?_0x5af28d['attributes']:_0x44094d['model'];if(_0x4d47a3[_0x21e8('0x31')][_0x21e8('0x41')]){_0x5af28d[_0x21e8('0x48')]=[{'all':!![]}];}_0x5af28d=_[_0x21e8('0x3e')]({},_0x5af28d,_0x4d47a3[_0x21e8('0x40')]);return db[_0x21e8('0x2b')][_0x21e8('0x49')](_0x5af28d)[_0x21e8('0x24')](handleEntityNotFound(_0x14d437,null))[_0x21e8('0x24')](respondWithResult(_0x14d437,null))['catch'](handleError(_0x14d437,null));};exports[_0x21e8('0x4a')]=function(_0x2f2669,_0x298446){return db[_0x21e8('0x2b')]['create'](_0x2f2669[_0x21e8('0x4b')],{})['then'](respondWithResult(_0x298446,0xc9))[_0x21e8('0x44')](handleError(_0x298446,null));};exports[_0x21e8('0x4c')]=function(_0x47aebf,_0xd1ab19){if(_0x47aebf[_0x21e8('0x4b')]['id']){delete _0x47aebf[_0x21e8('0x4b')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x47aebf[_0x21e8('0x46')]['id']}})[_0x21e8('0x24')](handleEntityNotFound(_0xd1ab19,null))[_0x21e8('0x24')](saveUpdates(_0x47aebf[_0x21e8('0x4b')],null))['then'](respondWithResult(_0xd1ab19,null))['catch'](handleError(_0xd1ab19,null));};exports['destroy']=function(_0x43a882,_0x3f41a5){return db['WhatsappApplication'][_0x21e8('0x49')]({'where':{'id':_0x43a882[_0x21e8('0x46')]['id']}})[_0x21e8('0x24')](handleEntityNotFound(_0x3f41a5,null))[_0x21e8('0x24')](removeEntity(_0x3f41a5,null))[_0x21e8('0x44')](handleError(_0x3f41a5,null));}; \ No newline at end of file +var _0x57ca=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','WhatsappApplication','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','rimraf','zip-dir','request-promise','moment'];(function(_0x540207,_0x1a0d59){var _0x476aa9=function(_0x4657ed){while(--_0x4657ed){_0x540207['push'](_0x540207['shift']());}};_0x476aa9(++_0x1a0d59);}(_0x57ca,0x108));var _0xa57c=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x57ca[_0x57486e];return _0x5f110b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':!![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['WhatsappApplication']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['WhatsappApplication'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 22f069f..afedcde 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 _0x0ba7=['define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x57fc09,_0x3ad1e2){var _0x1f52e2=function(_0x5ca5b){while(--_0x5ca5b){_0x57fc09['push'](_0x57fc09['shift']());}};_0x1f52e2(++_0x3ad1e2);}(_0x0ba7,0x16d));var _0x70ba=function(_0xbada4c,_0x473b25){_0xbada4c=_0xbada4c-0x0;var _0x46e3ef=_0x0ba7[_0xbada4c];return _0x46e3ef;};'use strict';var _=require(_0x70ba('0x0'));var util=require('util');var logger=require(_0x70ba('0x1'))(_0x70ba('0x2'));var moment=require(_0x70ba('0x3'));var BPromise=require(_0x70ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70ba('0x5'));var rimraf=require(_0x70ba('0x6'));var config=require(_0x70ba('0x7'));var attributes=require(_0x70ba('0x8'));module[_0x70ba('0x9')]=function(_0x3f9877,_0x17a00c){return _0x3f9877[_0x70ba('0xa')](_0x70ba('0xb'),attributes,{'tableName':_0x70ba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x70ba('0xd'),'collate':_0x70ba('0xe')});}; \ No newline at end of file +var _0xe107=['../../config/logger','api','moment','request-promise','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash'];(function(_0x17b2fa,_0x14ef94){var _0x3347a6=function(_0x493f55){while(--_0x493f55){_0x17b2fa['push'](_0x17b2fa['shift']());}};_0x3347a6(++_0x14ef94);}(_0xe107,0xb3));var _0x7e10=function(_0xfb6be9,_0x2baac4){_0xfb6be9=_0xfb6be9-0x0;var _0xbc1787=_0xe107[_0xfb6be9];return _0xbc1787;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var logger=require(_0x7e10('0x1'))(_0x7e10('0x2'));var moment=require(_0x7e10('0x3'));var BPromise=require('bluebird');var rp=require(_0x7e10('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e10('0x5'));var attributes=require(_0x7e10('0x6'));module[_0x7e10('0x7')]=function(_0x5be19f,_0x5f1edf){return _0x5be19f[_0x7e10('0x8')](_0x7e10('0x9'),attributes,{'tableName':_0x7e10('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7e10('0xb'),'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 e3e91c5..f0eca92 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s'];(function(_0x350098,_0x46f913){var _0x542c13=function(_0x2440d3){while(--_0x2440d3){_0x350098['push'](_0x350098['shift']());}};_0x542c13(++_0x46f913);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x00bb[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0xe14d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xd9cbcc,_0x26612d){var _0xb92797=function(_0xaeeef4){while(--_0xaeeef4){_0xd9cbcc['push'](_0xd9cbcc['shift']());}};_0xb92797(++_0x26612d);}(_0xe14d,0x1ee));var _0xde14=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xe14d[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 64d58cc..54f1393 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 _0xaf1b=['tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags'];(function(_0x4a15ca,_0x2fef6f){var _0x456a49=function(_0x5110cb){while(--_0x5110cb){_0x4a15ca['push'](_0x4a15ca['shift']());}};_0x456a49(++_0x2fef6f);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x5a8d9f,_0x15403b){_0x5a8d9f=_0x5a8d9f-0x0;var _0x2d4f62=_0xaf1b[_0x5a8d9f];return _0x2d4f62;};'use strict';var multer=require(_0xbaf1('0x0'));var util=require(_0xbaf1('0x1'));var path=require(_0xbaf1('0x2'));var timeout=require(_0xbaf1('0x3'));var express=require(_0xbaf1('0x4'));var router=express[_0xbaf1('0x5')]();var fs_extra=require(_0xbaf1('0x6'));var auth=require(_0xbaf1('0x7'));var interaction=require(_0xbaf1('0x8'));var config=require(_0xbaf1('0x9'));var controller=require(_0xbaf1('0xa'));router[_0xbaf1('0xb')]('/',auth[_0xbaf1('0xc')](),controller[_0xbaf1('0xd')]);router['get'](_0xbaf1('0xe'),auth['isAuthenticated'](),controller[_0xbaf1('0xf')]);router['get'](_0xbaf1('0x10'),auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x11')]);router['get'](_0xbaf1('0x12'),auth[_0xbaf1('0xc')](),controller['getMessages']);router[_0xbaf1('0xb')]('/:id/download',auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x13')]);router[_0xbaf1('0x14')]('/',auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x15')]);router[_0xbaf1('0x14')]('/:id/messages',auth['isAuthenticated'](),controller[_0xbaf1('0x16')]);router[_0xbaf1('0x14')](_0xbaf1('0x17'),auth[_0xbaf1('0xc')](),interaction[_0xbaf1('0x18')](_0xbaf1('0x19'),_0xbaf1('0x1a')),controller['addTags']);router[_0xbaf1('0x1b')](_0xbaf1('0x10'),auth[_0xbaf1('0xc')](),interaction[_0xbaf1('0x18')](_0xbaf1('0x19'),_0xbaf1('0x1c')),controller[_0xbaf1('0x1d')]);router[_0xbaf1('0x1e')]('/:id',auth[_0xbaf1('0xc')](),interaction['tracked'](_0xbaf1('0x19'),_0xbaf1('0x1f')),controller[_0xbaf1('0x20')]);router[_0xbaf1('0x1e')]('/:id/tags',auth[_0xbaf1('0xc')](),controller['removeTags']);module[_0xbaf1('0x21')]=router; \ No newline at end of file +var _0xb091=['./whatsappInteraction.controller','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x29bb20,_0x32add0){var _0x471f09=function(_0x5e19da){while(--_0x5e19da){_0x29bb20['push'](_0x29bb20['shift']());}};_0x471f09(++_0x32add0);}(_0xb091,0x16e));var _0x1b09=function(_0x18c93c,_0x2ad926){_0x18c93c=_0x18c93c-0x0;var _0x17baa1=_0xb091[_0x18c93c];return _0x17baa1;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var fs_extra=require(_0x1b09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b09('0x5'));var controller=require(_0x1b09('0x6'));router['get']('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x8')]);router[_0x1b09('0x9')]('/describe',auth[_0x1b09('0x7')](),controller[_0x1b09('0xa')]);router[_0x1b09('0x9')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xc')]);router[_0x1b09('0x9')](_0x1b09('0xd'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xe')]);router[_0x1b09('0x9')]('/:id/download',auth[_0x1b09('0x7')](),controller[_0x1b09('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1b09('0x10')]);router[_0x1b09('0x11')](_0x1b09('0xd'),auth[_0x1b09('0x7')](),controller[_0x1b09('0x12')]);router[_0x1b09('0x11')](_0x1b09('0x13'),auth['isAuthenticated'](),interaction[_0x1b09('0x14')]('whatsapp',_0x1b09('0x15')),controller[_0x1b09('0x16')]);router[_0x1b09('0x17')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),interaction[_0x1b09('0x14')](_0x1b09('0x18'),_0x1b09('0x19')),controller[_0x1b09('0x1a')]);router[_0x1b09('0x1b')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),interaction[_0x1b09('0x14')]('whatsapp',_0x1b09('0x1c')),controller[_0x1b09('0x1d')]);router['delete']('/:id/tags',auth[_0x1b09('0x7')](),controller['removeTags']);module[_0x1b09('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 08b086b..719cc3c 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 _0x2171=['out','moment','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x42bb6d,_0x412255){var _0x1db89b=function(_0x5da43a){while(--_0x5da43a){_0x42bb6d['push'](_0x42bb6d['shift']());}};_0x1db89b(++_0x412255);}(_0x2171,0x143));var _0x1217=function(_0x3dbeae,_0x48de1c){_0x3dbeae=_0x3dbeae-0x0;var _0x545eff=_0x2171[_0x3dbeae];return _0x545eff;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1217('0x0'));module[_0x1217('0x1')]={'closed':{'type':Sequelize[_0x1217('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1217('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1217('0x3')]},'phone':{'type':Sequelize[_0x1217('0x3')]},'read1stAt':{'type':Sequelize[_0x1217('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1217('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1217('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1217('0x5')]('in',_0x1217('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3a5e=['DATE','STRING','ENUM','sequelize','moment','exports','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3a5e,0x14c));var _0xe3a5=function(_0x8c2a18,_0x359b70){_0x8c2a18=_0x8c2a18-0x0;var _0x475b86=_0x3a5e[_0x8c2a18];return _0x475b86;};'use strict';var Sequelize=require(_0xe3a5('0x0'));var moment=require(_0xe3a5('0x1'));module[_0xe3a5('0x2')]={'closed':{'type':Sequelize[_0xe3a5('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe3a5('0x4')]},'disposition':{'type':Sequelize[_0xe3a5('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe3a5('0x5')]},'note':{'type':Sequelize[_0xe3a5('0x5')]},'phone':{'type':Sequelize[_0xe3a5('0x5')]},'read1stAt':{'type':Sequelize[_0xe3a5('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe3a5('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe3a5('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe3a5('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 7dacb00..5f66b75 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 _0x3af5=['existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','basename','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','Users','fullname','TagIds','split','forEach','catch','waiting','answered','unmanaged','total','closed','UserId','talking','index','map','WhatsappInteraction','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','body','buildExpression','compact','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','t.id\x20IN\x20?','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','params','include','merge','options','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','setTags','findAll','emit','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','push','CmContact','firstName','attachments','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp'];(function(_0x179575,_0x575c0a){var _0x5d8cb1=function(_0x47ea2e){while(--_0x47ea2e){_0x179575['push'](_0x179575['shift']());}};_0x5d8cb1(++_0x575c0a);}(_0x3af5,0x1d3));var _0x53af=function(_0x4a0f62,_0x19f781){_0x4a0f62=_0x4a0f62-0x0;var _0x3ffcc1=_0x3af5[_0x4a0f62];return _0x3ffcc1;};'use strict';var emlformat=require(_0x53af('0x0'));var rimraf=require(_0x53af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53af('0x2'));var rp=require(_0x53af('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x53af('0x4'));var util=require('util');var path=require('path');var sox=require(_0x53af('0x5'));var csv=require(_0x53af('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53af('0x7'));var _=require('lodash');var squel=require(_0x53af('0x8'));var crypto=require(_0x53af('0x9'));var jsforce=require(_0x53af('0xa'));var deskjs=require(_0x53af('0xb'));var toCsv=require(_0x53af('0x6'));var querystring=require(_0x53af('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x53af('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x53af('0xe'));var pdf=require(_0x53af('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x53af('0x10'))(_0x53af('0x11'));var utils=require('../../config/utils');var config=require(_0x53af('0x12'));var licenseUtil=require(_0x53af('0x13'));var db=require(_0x53af('0x14'))['db'];config['redis']=_[_0x53af('0x15')](config['redis'],{'host':_0x53af('0x16'),'port':0x18eb});var socket=require(_0x53af('0x17'))(new Redis(config[_0x53af('0x18')]));require(_0x53af('0x19'))[_0x53af('0x1a')](socket);function respondWithStatusCode(_0x352655,_0x2a5a4c){_0x2a5a4c=_0x2a5a4c||0xcc;return function(_0x1c8479){if(_0x1c8479){return _0x352655[_0x53af('0x1b')](_0x2a5a4c);}return _0x352655[_0x53af('0x1c')](_0x2a5a4c)['end']();};}function respondWithResult(_0x10d18f,_0x2db860){_0x2db860=_0x2db860||0xc8;return function(_0x29bb86){if(_0x29bb86){return _0x10d18f[_0x53af('0x1c')](_0x2db860)[_0x53af('0x1d')](_0x29bb86);}};}function respondWithFilteredResult(_0x19c65f,_0x3fb005){return function(_0x4a455f){if(_0x4a455f){var _0x207f25=typeof _0x3fb005[_0x53af('0x1e')]===_0x53af('0x1f')&&typeof _0x3fb005[_0x53af('0x20')]==='undefined';var _0x55427a=_0x4a455f[_0x53af('0x21')];var _0x3f5503=_0x207f25?0x0:_0x3fb005[_0x53af('0x1e')];var _0x5a31d6=_0x207f25?_0x4a455f[_0x53af('0x21')]:_0x3fb005[_0x53af('0x1e')]+_0x3fb005[_0x53af('0x20')];var _0x3cd780;if(_0x5a31d6>=_0x55427a){_0x5a31d6=_0x55427a;_0x3cd780=0xc8;}else{_0x3cd780=0xce;}_0x19c65f[_0x53af('0x1c')](_0x3cd780);return _0x19c65f[_0x53af('0x22')](_0x53af('0x23'),_0x3f5503+'-'+_0x5a31d6+'/'+_0x55427a)[_0x53af('0x1d')](_0x4a455f);}return null;};}function patchUpdates(_0x5c2763){return function(_0x441c9e){try{jsonpatch[_0x53af('0x24')](_0x441c9e,_0x5c2763,!![]);}catch(_0x4fea36){return BPromise[_0x53af('0x25')](_0x4fea36);}return _0x441c9e[_0x53af('0x26')]();};}function saveUpdates(_0x250edb,_0x57e09e){return function(_0x428751){if(_0x428751){return _0x428751[_0x53af('0x27')](_0x250edb)[_0x53af('0x28')](function(_0x2b232c){return _0x2b232c;});}return null;};}function removeEntity(_0x480665,_0x27dbd9){return function(_0x17d47d){if(_0x17d47d){return _0x17d47d[_0x53af('0x29')]()[_0x53af('0x28')](function(){_0x480665[_0x53af('0x1c')](0xcc)[_0x53af('0x2a')]();});}};}function handleEntityNotFound(_0x474d5f,_0x20449f){return function(_0x5af078){if(!_0x5af078){_0x474d5f[_0x53af('0x1b')](0x194);}return _0x5af078;};}function handleError(_0x1ec47c,_0xc9b0df){_0xc9b0df=_0xc9b0df||0x1f4;return function(_0x2c27ba){logger[_0x53af('0x2b')](_0x2c27ba[_0x53af('0x2c')]);if(_0x2c27ba[_0x53af('0x2d')]){delete _0x2c27ba['name'];}_0x1ec47c['status'](_0xc9b0df)[_0x53af('0x2e')](_0x2c27ba);};}function getInteractionUsers(_0x490f70,_0x308819){return new BPromise(function(_0x2a9daa,_0x38563d){try{if(_0x308819[_0x490f70['id']]){_0x490f70[_0x53af('0x2f')]=_['map'](_0x308819[_0x490f70['id']],function(_0x15694f){return{'id':_0x15694f['id'],'fullname':_0x15694f[_0x53af('0x30')]};});}}catch(_0x4b90a6){_0x38563d(_0x4b90a6);}_0x2a9daa(_0x490f70);});}function getInteractionTags(_0x4a9185,_0xc0dae3){return new BPromise(function(_0x1fa69c,_0x1a688c){try{if(_0x4a9185[_0x53af('0x31')]){_0x4a9185['Tags']=[];_0x4a9185['TagIds'][_0x53af('0x32')](',')[_0x53af('0x33')](function(_0x16e79a){_0x4a9185['Tags']['push'](_0xc0dae3[_0x16e79a]);});}delete _0x4a9185[_0x53af('0x31')];}catch(_0x3b72ff){_0x1a688c(_0x3b72ff);}_0x1fa69c(_0x4a9185);});}function updateWhatsappInteraction(_0x271ae2,_0x32c735,_0x44e1c4){return new BPromise(function(_0x98e868,_0x34fcb4){return getInteractionUsers(_0x271ae2,_0x44e1c4)['then'](function(_0x115f77){return getInteractionTags(_0x115f77,_0x32c735);})[_0x53af('0x28')](function(_0x51784e){return getStateInteraction(_0x51784e);})[_0x53af('0x28')](function(_0x224644){_0x98e868(_0x224644);})[_0x53af('0x34')](function(_0x2c426c){_0x34fcb4(_0x2c426c);});});}function getStateInteraction(_0x22f9b7){return new BPromise(function(_0x576bfc){_0x22f9b7[_0x53af('0x35')]=0x0;_0x22f9b7['talking']=0x0;_0x22f9b7[_0x53af('0x36')]=0x0;_0x22f9b7[_0x53af('0x37')]=0x0;_0x22f9b7[_0x53af('0x38')]=0x0;if(!_0x22f9b7[_0x53af('0x39')]&&!_0x22f9b7[_0x53af('0x3a')]){_0x22f9b7['waiting']+=0x1;}if(!_0x22f9b7['closed']&&_0x22f9b7['UserId']){_0x22f9b7[_0x53af('0x3b')]+=0x1;if(_0x22f9b7['waiting']){_0x22f9b7['waiting']-=0x1;}}if(_0x22f9b7['closed']&&_0x22f9b7[_0x53af('0x3a')]){_0x22f9b7[_0x53af('0x36')]+=0x1;if(_0x22f9b7[_0x53af('0x3b')]){_0x22f9b7[_0x53af('0x3b')]-=0x1;}}if(_0x22f9b7[_0x53af('0x39')]&&!_0x22f9b7[_0x53af('0x3a')]){_0x22f9b7[_0x53af('0x37')]+=0x1;if(_0x22f9b7[_0x53af('0x35')]){_0x22f9b7[_0x53af('0x35')]-=0x1;}}_0x22f9b7['total']+=0x1;_0x576bfc(_0x22f9b7);});}exports[_0x53af('0x3c')]=function(_0x3ff036,_0x13aa5e){var _0x168807={},_0x409c75={},_0x352e87={'count':0x0,'rows':[]};var _0x4b83a8=_[_0x53af('0x3d')](db[_0x53af('0x3e')][_0x53af('0x3f')],function(_0x411563){return{'name':_0x411563['fieldName'],'type':_0x411563[_0x53af('0x40')][_0x53af('0x41')]};});_0x409c75[_0x53af('0x42')]=_[_0x53af('0x3d')](_0x4b83a8,_0x53af('0x2d'));_0x409c75['query']=_[_0x53af('0x43')](_0x3ff036[_0x53af('0x44')]);_0x409c75[_0x53af('0x45')]=_[_0x53af('0x46')](_0x409c75[_0x53af('0x42')],_0x409c75[_0x53af('0x44')]);_0x168807[_0x53af('0x47')]=_['intersection'](_0x409c75[_0x53af('0x42')],qs[_0x53af('0x48')](_0x3ff036[_0x53af('0x44')]['fields']));_0x168807[_0x53af('0x47')]=_0x168807['attributes'][_0x53af('0x49')]?_0x168807[_0x53af('0x47')]:_0x409c75[_0x53af('0x42')];if(!_0x3ff036[_0x53af('0x44')][_0x53af('0x4a')](_0x53af('0x4b'))){_0x168807[_0x53af('0x20')]=qs['limit'](_0x3ff036[_0x53af('0x44')][_0x53af('0x20')]);_0x168807[_0x53af('0x1e')]=qs[_0x53af('0x1e')](_0x3ff036[_0x53af('0x44')][_0x53af('0x1e')]);}_0x168807[_0x53af('0x4c')]=qs[_0x53af('0x4d')](_0x3ff036[_0x53af('0x44')]['sort']);_0x168807['where']=qs[_0x53af('0x45')](_[_0x53af('0x4e')](_0x3ff036['query'],_0x409c75['filters']),_0x4b83a8);var _0x651bfe=[];var _0x27c961=squel[_0x53af('0x4f')]()[_0x53af('0x50')]('id')[_0x53af('0x50')](_0x53af('0x2d'))['field'](_0x53af('0x51'))[_0x53af('0x52')](_0x53af('0x53'));var _0x43deab=squel[_0x53af('0x4f')]()[_0x53af('0x50')](_0x53af('0x54'))[_0x53af('0x50')]('u.fullname')['field'](_0x53af('0x55'))['from'](_0x53af('0x56'),'ui')[_0x53af('0x57')](_0x53af('0x58'),'u',_0x53af('0x59'));var _0x34f63f=squel[_0x53af('0x4f')]()[_0x53af('0x52')]('whatsapp_interactions','i')['left_join']('cm_contacts','c',_0x53af('0x5a'))[_0x53af('0x57')](_0x53af('0x58'),'o',_0x53af('0x5b'))['left_join']('whatsapp_accounts','a',_0x53af('0x5c'))[_0x53af('0x57')](_0x53af('0x5d'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join']('whatsapp_interaction_has_tags','it',_0x53af('0x5e'))[_0x53af('0x57')](_0x53af('0x53'),'t',_0x53af('0x5f'));var _0x2738e9=squel['expr']();var _0xb456b=[];var _0xef89da=squel[_0x53af('0x60')]();var _0x3e05fe;if(_0x3ff036[_0x53af('0x44')][_0x53af('0x61')]){_0x3e05fe=as['parseSearch'](_0x3ff036[_0x53af('0x44')]['search']);var _0x374b5c=_0x3e05fe['sqlOperator'];for(var _0x8b68c7=0x0;_0x8b68c7<_0x3e05fe[_0x53af('0x62')]['length'];_0x8b68c7++){var _0x5735df=_0x3e05fe['conditions'][_0x8b68c7];var _0x57c2f6='i';var _0x5b4c1c=_[_0x53af('0x63')](_0x4b83a8,['name',_0x5735df['field']]);if(!_0x5b4c1c){switch(_0x5735df[_0x53af('0x50')]){case _0x53af('0x64'):if(_0x5735df[_0x53af('0x65')]==0x1){_0x34f63f['having']('`'+_0x5735df[_0x53af('0x50')]+_0x53af('0x66'));}else{_0x34f63f[_0x53af('0x67')]('`'+_0x5735df[_0x53af('0x50')]+'`\x20>\x200');}break;case _0x53af('0x68'):if(_0x5735df[_0x53af('0x69')]===_0x53af('0x6a')){if(_0x5735df[_0x53af('0x65')][_0x53af('0x32')]('\x20')[_0x53af('0x49')]>0x1){_0x2738e9[_0x374b5c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5735df['value']),null);}else{var _0x175a0e='%'+_0x5735df['value']+'%';_0x2738e9[_0x374b5c](_0x53af('0x6b'),_0x175a0e,_0x175a0e,_0x175a0e);}}else{_0x5b4c1c=_[_0x53af('0x63')](_0x4b83a8,[_0x53af('0x2d'),_0x53af('0x6c')]);_0x5735df[_0x53af('0x50')]=_0x53af('0x6c');_0x5bbd96=as['buildExpression'](_0x57c2f6,_0x5b4c1c[_0x53af('0x40')],_0x5735df);_0x2738e9[_0x374b5c](_0x5bbd96[_0x53af('0x6d')],_0x5bbd96[_0x53af('0x65')][_0x53af('0x6e')],_0x5bbd96[_0x53af('0x65')][_0x53af('0x2a')]);}break;case _0x53af('0x6f'):var _0x44e93c=_0x5735df[_0x53af('0x65')][_0x53af('0x32')](',')[_0x53af('0x3d')](function(_0x23ce09){return Number(_0x23ce09);});_0x44e93c['forEach'](function(_0x36b4f9){_0xef89da['or'](_0x53af('0x70'),'%,'+_0x36b4f9+',%');});_0xb456b=_[_0x53af('0x71')](_0xb456b,_0x44e93c);break;case _0x53af('0x72'):if(_0x5735df[_0x53af('0x69')]===_0x53af('0x6a')){_0x2738e9[_0x374b5c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5735df[_0x53af('0x65')]+'%',null);}else{_0x5b4c1c=_[_0x53af('0x63')](_0x4b83a8,[_0x53af('0x2d'),_0x53af('0x3a')]);_0x5735df[_0x53af('0x50')]='UserId';_0x5bbd96=as['buildExpression'](_0x57c2f6,_0x5b4c1c[_0x53af('0x40')],_0x5735df);_0x2738e9[_0x374b5c](_0x5bbd96[_0x53af('0x6d')],_0x5bbd96[_0x53af('0x65')][_0x53af('0x6e')],_0x5bbd96[_0x53af('0x65')]['end']);}break;case _0x53af('0x73'):_0x5bbd96=as[_0x53af('0x74')]('me',null,_0x5735df);_0x2738e9[_0x374b5c](_0x5bbd96[_0x53af('0x6d')],_0x5bbd96[_0x53af('0x65')]['start'],_0x5bbd96[_0x53af('0x65')][_0x53af('0x2a')]);break;}}else{var _0x5bbd96=as[_0x53af('0x74')](_0x57c2f6,_0x5b4c1c['type'],_0x5735df);_0x2738e9[_0x374b5c](_0x5bbd96[_0x53af('0x6d')],_0x5bbd96['value'][_0x53af('0x6e')],_0x5bbd96[_0x53af('0x65')][_0x53af('0x2a')]);}}}else{var _0x2d86ce=_(_0x3ff036['query'])[_0x53af('0x43')]()[_0x53af('0x3d')](function(_0x368cff){return _['some'](_0x4b83a8,[_0x53af('0x2d'),_0x368cff])?_0x368cff:undefined;})[_0x53af('0x75')]()[_0x53af('0x65')]();if(!_['isEmpty'](_0x2d86ce)){_0x2d86ce[_0x53af('0x33')](function(_0x50c666){if(_0x50c666==='WhatsappAccountId'){_0x34f63f[_0x53af('0x76')](_0x53af('0x77'),[][_0x53af('0x78')](_0x3ff036[_0x53af('0x44')][_0x50c666]));}else if(_0x50c666===_0x53af('0x79')){var _0x3613bb=JSON[_0x53af('0x7a')](_0x3ff036[_0x53af('0x44')][_0x50c666])[_0x53af('0x7b')];var _0x3eef0c=JSON[_0x53af('0x7a')](_0x3ff036[_0x53af('0x44')][_0x50c666])['$lte'];_0x34f63f['where'](_0x53af('0x7c'),_0x3613bb,_0x3eef0c);}else{if(_0x3ff036['query'][_0x50c666]===_0x53af('0x7d')){_0x34f63f['where']('i.'+_0x50c666+_0x53af('0x7e'));}else{_0x34f63f[_0x53af('0x76')]('i.'+_0x50c666+_0x53af('0x7f'),_0x3ff036[_0x53af('0x44')][_0x50c666]);}}});}if(_0x3ff036[_0x53af('0x44')][_0x53af('0x80')]){if(_0x3ff036[_0x53af('0x44')][_0x53af('0x80')]==0x1){_0x34f63f[_0x53af('0x67')](_0x53af('0x81'));}else{_0x34f63f[_0x53af('0x67')]('`unreadMessages`\x20>\x200');}}if(_0x3ff036[_0x53af('0x44')][_0x53af('0x82')]){_0xb456b=_[_0x53af('0x83')](_0x3ff036[_0x53af('0x44')][_0x53af('0x82')])?_0x3ff036[_0x53af('0x44')][_0x53af('0x82')]:new Array(_0x3ff036[_0x53af('0x44')][_0x53af('0x82')]);_0xb456b[_0x53af('0x33')](function(_0xcfe0d4){_0xef89da['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xcfe0d4+',%');});}if(_0x3ff036[_0x53af('0x44')][_0x53af('0x84')]){var _0x8fbaaf=_0x3ff036[_0x53af('0x44')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x8fbaaf)){_0x2738e9['or']('i.id\x20LIKE\x20?',_0x8fbaaf+'%')['or']('i.phone\x20LIKE\x20?',_0x8fbaaf+'%');}else{_0x2738e9['or'](_0x53af('0x85'),qs['getFullTextValue'](_0x8fbaaf))['or'](_0x53af('0x86'),_0x8fbaaf+'%');}}}_0x34f63f[_0x53af('0x76')](_0x2738e9);_0x34f63f['group'](_0x53af('0x87'));var _0x40bba1={'type':db['Sequelize']['QueryTypes'][_0x53af('0x88')],'raw':!![]};var _0x2f544b=_0x34f63f['clone']();_0x2f544b[_0x53af('0x50')]('i.id');_0x2f544b[_0x53af('0x50')](_0x53af('0x89'),_0x53af('0x64'));if(_0x168807[_0x53af('0x4c')]){_0x168807[_0x53af('0x4c')][_0x53af('0x33')](function(_0x4eae4d){var _0xa31e86=_0x4eae4d[0x0]===_0x53af('0x8a')?_0x4eae4d[0x0]:'i.'+_0x4eae4d[0x0];_0x34f63f[_0x53af('0x4c')](_0xa31e86,_0x4eae4d[0x1]==='DESC'?![]:!![]);});}if(!_[_0x53af('0x8b')](_0xb456b)){_0x34f63f[_0x53af('0x67')](_0xef89da);_0x2f544b['where'](_0x53af('0x8c'),_0xb456b);}BPromise['resolve']()[_0x53af('0x28')](function(){if(!_0x3e05fe){if(_0x3ff036[_0x53af('0x44')][_0x53af('0x8d')])return;_0x2f544b[_0x53af('0x76')](_0x53af('0x8e'));_0x34f63f[_0x53af('0x76')](_0x53af('0x8e'));return;}if(_0x3ff036[_0x53af('0x8f')][_0x53af('0x90')]!==_0x53af('0x91'))return;return _0x3ff036[_0x53af('0x8f')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x53af('0x28')](function(_0xb99314){if(_[_0x53af('0x8b')](_0xb99314)){_0x2f544b['where'](_0x53af('0x92'));_0x34f63f[_0x53af('0x76')](_0x53af('0x92'));}else{_0x2f544b['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x53af('0x3d')](_0xb99314,'id'));_0x34f63f[_0x53af('0x76')](_0x53af('0x77'),_['map'](_0xb99314,'id'));}});})[_0x53af('0x28')](function(){if(_0x3ff036[_0x53af('0x8f')][_0x53af('0x90')]===_0x53af('0x91')&&!_0x3e05fe&&!_0x3ff036[_0x53af('0x44')]['WhatsappAccountId'])return[];return db[_0x53af('0x93')]['query'](_0x2f544b[_0x53af('0x94')](),_0x40bba1);})[_0x53af('0x28')](function(_0x51808a){_0x352e87['count']=_0x51808a['length'];if(_0x352e87[_0x53af('0x21')]===0x0)return[];return db[_0x53af('0x93')][_0x53af('0x44')](_0x27c961[_0x53af('0x94')](),_0x40bba1)[_0x53af('0x28')](function(_0x521162){_0x651bfe=_[_0x53af('0x95')](_0x521162,'id');_0x40bba1=_['merge'](_0x40bba1,{'model':db[_0x53af('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ff036[_0x53af('0x44')][_0x53af('0x48')]){_0x168807[_0x53af('0x47')][_0x53af('0x33')](function(_0x2a1e52){_0x34f63f[_0x53af('0x50')]('i.'+_0x2a1e52);});}else{_0x34f63f[_0x53af('0x50')](_0x53af('0x89'),'unreadMessages');_0x34f63f[_0x53af('0x50')](_0x53af('0x96'),_0x53af('0x97'));_0x34f63f['field'](_0x53af('0x98'),_0x53af('0x99'));_0x34f63f[_0x53af('0x50')]('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',_0x53af('0x8a'));_0x34f63f[_0x53af('0x50')](_0x53af('0x9a'));_0x34f63f[_0x53af('0x50')](_0x53af('0x9b'),_0x53af('0x9c'));_0x34f63f[_0x53af('0x50')]('c.lastName','Contact.lastName');_0x34f63f[_0x53af('0x50')](_0x53af('0x9d'),'Contact.email');_0x34f63f['field'](_0x53af('0x9e'),_0x53af('0x9f'));_0x34f63f[_0x53af('0x50')](_0x53af('0xa0'),_0x53af('0xa1'));_0x34f63f['field']('c.fax','Contact.fax');_0x34f63f['field'](_0x53af('0xa2'),_0x53af('0xa3'));_0x34f63f[_0x53af('0x50')](_0x53af('0xa4'),_0x53af('0xa5'));_0x34f63f[_0x53af('0x50')](_0x53af('0xa6'),_0x53af('0x31'));}if(_0x168807[_0x53af('0x20')])_0x34f63f['limit'](_0x168807[_0x53af('0x20')]);if(_0x168807[_0x53af('0x1e')])_0x34f63f[_0x53af('0x1e')](_0x168807[_0x53af('0x1e')]);return db['sequelize'][_0x53af('0x44')](_0x34f63f[_0x53af('0x94')](),_0x40bba1);})[_0x53af('0x28')](function(_0x21eba0){if(_0x21eba0[_0x53af('0x49')]>0x0)_0x43deab[_0x53af('0x76')](_0x53af('0xa7'),_['map'](_0x21eba0,'id'));return db[_0x53af('0x93')][_0x53af('0x44')](_0x43deab[_0x53af('0x94')](),_0x40bba1)['then'](function(_0x5a1aaa){var _0x23ae6b=_['groupBy'](_0x5a1aaa,_0x53af('0xa8'));var _0x2d213f=[];_0x21eba0['forEach'](function(_0x1437cf){_0x2d213f['push'](updateWhatsappInteraction(_0x1437cf,_0x651bfe,_0x23ae6b));});return BPromise['all'](_0x2d213f);});});})['then'](function(_0x53bc49){_0x352e87[_0x53af('0xa9')]=_0x53bc49;return _0x352e87;})[_0x53af('0x28')](respondWithFilteredResult(_0x13aa5e,_0x168807))['catch'](handleError(_0x13aa5e,null));};exports['show']=function(_0x40d138,_0x205885){var _0x1fd844={'raw':![],'where':{'id':_0x40d138[_0x53af('0xaa')]['id']}},_0x2b671a={};_0x2b671a[_0x53af('0x42')]=_[_0x53af('0x43')](db[_0x53af('0x3e')][_0x53af('0x3f')]);_0x2b671a[_0x53af('0x44')]=_[_0x53af('0x43')](_0x40d138[_0x53af('0x44')]);_0x2b671a['filters']=_[_0x53af('0x46')](_0x2b671a['model'],_0x2b671a[_0x53af('0x44')]);_0x1fd844['attributes']=_[_0x53af('0x46')](_0x2b671a[_0x53af('0x42')],qs[_0x53af('0x48')](_0x40d138[_0x53af('0x44')][_0x53af('0x48')]));_0x1fd844[_0x53af('0x47')]=_0x1fd844[_0x53af('0x47')][_0x53af('0x49')]?_0x1fd844[_0x53af('0x47')]:_0x2b671a['model'];if(_0x40d138[_0x53af('0x44')]['includeAll']){_0x1fd844[_0x53af('0xab')]=[{'all':!![]}];}_0x1fd844=_[_0x53af('0xac')]({},_0x1fd844,_0x40d138[_0x53af('0xad')]);return db[_0x53af('0x3e')][_0x53af('0x63')](_0x1fd844)[_0x53af('0x28')](handleEntityNotFound(_0x205885,null))['then'](respondWithResult(_0x205885,null))[_0x53af('0x34')](handleError(_0x205885,null));};exports['create']=function(_0x448f08,_0x2ca06d){return db['WhatsappInteraction']['create'](_0x448f08[_0x53af('0x73')],{})[_0x53af('0x28')](respondWithResult(_0x2ca06d,0xc9))[_0x53af('0x34')](handleError(_0x2ca06d,null));};exports['update']=function(_0x2386e3,_0x509d8b){if(_0x2386e3[_0x53af('0x73')]['id']){delete _0x2386e3[_0x53af('0x73')]['id'];}return db[_0x53af('0x3e')][_0x53af('0x63')]({'where':{'id':_0x2386e3[_0x53af('0xaa')]['id']}})[_0x53af('0x28')](handleEntityNotFound(_0x509d8b,null))[_0x53af('0x28')](saveUpdates(_0x2386e3[_0x53af('0x73')],null))[_0x53af('0x28')](respondWithResult(_0x509d8b,null))[_0x53af('0x34')](handleError(_0x509d8b,null));};exports[_0x53af('0x29')]=function(_0x24efc4,_0x4bf6ef){return db['WhatsappInteraction'][_0x53af('0x63')]({'where':{'id':_0x24efc4[_0x53af('0xaa')]['id']}})[_0x53af('0x28')](handleEntityNotFound(_0x4bf6ef,null))[_0x53af('0x28')](removeEntity(_0x4bf6ef,null))[_0x53af('0x34')](handleError(_0x4bf6ef,null));};exports[_0x53af('0xae')]=function(_0x427438,_0x22b273){return db[_0x53af('0x3e')][_0x53af('0xae')]()[_0x53af('0x28')](respondWithResult(_0x22b273,null))['catch'](handleError(_0x22b273,null));};exports[_0x53af('0xaf')]=function(_0x432621,_0x129164,_0x4188c9){return db[_0x53af('0xb0')][_0x53af('0x63')]({'where':{'id':_0x432621[_0x53af('0xaa')]['id']}})[_0x53af('0x28')](handleEntityNotFound(_0x129164,null))['then'](function(_0x3cdc6d){if(_0x3cdc6d){return _0x3cdc6d[_0x53af('0xaf')](_0x432621[_0x53af('0x73')][_0x53af('0xb1')],_[_0x53af('0xb2')](_0x432621[_0x53af('0x73')],[_0x53af('0xb1'),'id'])||{});}})[_0x53af('0x28')](respondWithResult(_0x129164,null))[_0x53af('0x34')](handleError(_0x129164,null));};exports[_0x53af('0xb3')]=function(_0x128820,_0x36e31d,_0x506212){var _0x354acc={'raw':![],'where':{}};var _0x410776={};var _0x26a8c5={'count':0x0,'rows':[]};return db[_0x53af('0x3e')][_0x53af('0xb4')]({'where':{'id':_0x128820[_0x53af('0xaa')]['id']}})[_0x53af('0x28')](handleEntityNotFound(_0x36e31d,null))[_0x53af('0x28')](function(_0xe44785){if(_0xe44785){_0x410776[_0x53af('0x42')]=_[_0x53af('0x43')](db['WhatsappMessage'][_0x53af('0x3f')]);_0x410776[_0x53af('0x44')]=_['keys'](_0x128820[_0x53af('0x44')]);_0x410776['filters']=_['intersection'](_0x410776['model'],_0x410776[_0x53af('0x44')]);_0x354acc[_0x53af('0x47')]=_[_0x53af('0x46')](_0x410776[_0x53af('0x42')],qs[_0x53af('0x48')](_0x128820['query'][_0x53af('0x48')]));_0x354acc[_0x53af('0x47')]=_0x354acc[_0x53af('0x47')][_0x53af('0x49')]?_0x354acc[_0x53af('0x47')]:_0x410776[_0x53af('0x42')];if(!_0x128820[_0x53af('0x44')][_0x53af('0x4a')]('nolimit')){_0x354acc[_0x53af('0x20')]=qs[_0x53af('0x20')](_0x128820[_0x53af('0x44')][_0x53af('0x20')]);_0x354acc[_0x53af('0x1e')]=qs[_0x53af('0x1e')](_0x128820[_0x53af('0x44')][_0x53af('0x1e')]);}_0x354acc[_0x53af('0x4c')]=qs[_0x53af('0x4d')](_0x128820[_0x53af('0x44')][_0x53af('0x4d')]);_0x354acc[_0x53af('0x76')]=qs[_0x53af('0x45')](_['pick'](_0x128820[_0x53af('0x44')],_0x410776[_0x53af('0x45')]));_0x354acc[_0x53af('0x76')]['WhatsappInteractionId']=_0xe44785['id'];if(_0x128820[_0x53af('0x44')]['filter']){_0x354acc[_0x53af('0x76')]=_[_0x53af('0xac')](_0x354acc[_0x53af('0x76')],{'$or':_[_0x53af('0x3d')](_0x354acc[_0x53af('0x47')],function(_0x446807){var _0x167928={};_0x167928[_0x446807]={'$like':'%'+_0x128820[_0x53af('0x44')][_0x53af('0x84')]+'%'};return _0x167928;})});}if(_0x128820[_0x53af('0x44')]['$gte']){var _0x22ad59=_0x128820[_0x53af('0x44')][_0x53af('0x7b')][_0x53af('0x32')](',');var _0x8d5c5={};_0x8d5c5[_0x22ad59[0x0]]={'$gte':moment(_0x22ad59[0x1])[_0x53af('0xb5')](_0x53af('0xb6'))};_0x354acc[_0x53af('0x76')]=_['merge'](_0x354acc[_0x53af('0x76')],_0x8d5c5);}_0x354acc=_['merge']({},_0x354acc,_0x128820[_0x53af('0xad')]);return db['WhatsappMessage'][_0x53af('0x21')]({'where':_0x354acc[_0x53af('0x76')]})['then'](function(_0x44127d){_0x26a8c5[_0x53af('0x21')]=_0x44127d;if(_0x128820['query'][_0x53af('0xb7')]){_0x354acc[_0x53af('0xab')]=[{'all':!![]}];}return db[_0x53af('0xb0')]['findAll'](_0x354acc);})[_0x53af('0x28')](function(_0x2c01ce){_0x26a8c5['rows']=_0x2c01ce;return _0x26a8c5;});}})['then'](respondWithFilteredResult(_0x36e31d,_0x354acc))[_0x53af('0x34')](handleError(_0x36e31d,null));};exports[_0x53af('0xb8')]=function(_0x13352b,_0x3637b5,_0x3c8761){return db[_0x53af('0x3e')][_0x53af('0x63')]({'where':{'id':_0x13352b[_0x53af('0xaa')]['id']}})[_0x53af('0x28')](handleEntityNotFound(_0x3637b5,null))[_0x53af('0x28')](function(_0xc31400){if(_0xc31400){return _0xc31400[_0x53af('0xb9')](_0x13352b[_0x53af('0x73')][_0x53af('0xb1')],_[_0x53af('0xb2')](_0x13352b[_0x53af('0x73')],[_0x53af('0xb1'),'id'])||{})['spread'](function(){return db[_0x53af('0x6f')][_0x53af('0xba')]({'attributes':['id',_0x53af('0x2d'),_0x53af('0x51')],'where':{'id':_0x13352b['body'][_0x53af('0xb1')]}});})[_0x53af('0x28')](function(_0x3e8a26){socket[_0x53af('0xbb')]('whatsappInteractionTags:save',{'id':Number(_0x13352b[_0x53af('0xaa')]['id']),'tags':_0x3e8a26||[]});return{'id':Number(_0x13352b[_0x53af('0xaa')]['id']),'tags':_0x3e8a26||[]};});}})[_0x53af('0x28')](respondWithResult(_0x3637b5,null))[_0x53af('0x34')](handleError(_0x3637b5,null));};exports[_0x53af('0xbc')]=function(_0x293637,_0x3df2f3,_0x4d1613){return db[_0x53af('0x3e')][_0x53af('0x63')]({'where':{'id':_0x293637[_0x53af('0xaa')]['id']}})['then'](handleEntityNotFound(_0x3df2f3,null))[_0x53af('0x28')](function(_0x2591ff){if(_0x2591ff){return _0x2591ff[_0x53af('0xbc')](_0x293637['query'][_0x53af('0xb1')]);}})[_0x53af('0x28')](respondWithStatusCode(_0x3df2f3,null))[_0x53af('0x34')](handleError(_0x3df2f3,null));};exports[_0x53af('0xbd')]=function(_0x109757,_0x1d6c5b){var _0x1cb6ac=moment()[_0x53af('0xbe')]()[_0x53af('0x94')]();var _0x2df792=path[_0x53af('0xbf')](config[_0x53af('0xc0')],_0x53af('0xc1'),_0x53af('0xc2'),_0x53af('0xc3'));var _0x5abe8b=path[_0x53af('0xbf')](config[_0x53af('0xc0')],_0x53af('0xc1'),_0x53af('0xc2'),'attachments');var _0x565305=path[_0x53af('0xbf')](_0x2df792,_0x1cb6ac);var _0x3fe039=util['format'](_0x53af('0xc4'),_0x109757[_0x53af('0xaa')]['id'],_0x1cb6ac);var _0x1cb102=path['join'](_0x2df792,_0x3fe039);var _0x36ab8f=[];_0x36ab8f[_0x53af('0xc5')]({'model':db[_0x53af('0x72')],'as':_0x53af('0x72'),'attributes':['id','fullname'],'raw':!![]});_0x36ab8f[_0x53af('0xc5')]({'model':db[_0x53af('0xc6')],'as':'Contact','attributes':['id',_0x53af('0xc7'),'lastName'],'raw':!![]});if(_0x109757[_0x53af('0x44')][_0x53af('0xc8')]){_0x36ab8f['push']({'model':db[_0x53af('0xc9')],'as':_0x53af('0xc9'),'raw':!![]});}var _0x10aa5b=[{'model':db['WhatsappMessage'],'as':_0x53af('0xca'),'attributes':['id',_0x53af('0x73'),_0x53af('0x79'),_0x53af('0xcb'),_0x53af('0xcc'),_0x53af('0x80')],'include':_0x36ab8f}];_0x10aa5b[_0x53af('0xc5')]({'model':db[_0x53af('0xcd')],'as':_0x53af('0xce'),'attributes':['id',_0x53af('0x2d')]});_0x10aa5b[_0x53af('0xc5')]({'model':db[_0x53af('0x72')],'as':_0x53af('0xcf'),'attributes':['id',_0x53af('0x30')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x109757[_0x53af('0xaa')]['id']},'include':_0x10aa5b})[_0x53af('0x28')](handleEntityNotFound(_0x1d6c5b,null))['then'](function(_0xd7a96d){if(_0xd7a96d){var _0x36c366=_0xd7a96d[_0x53af('0xd0')]({'plain':!![]});fs[_0x53af('0xd1')](_0x565305);var _0x4de6ad={'channel':_0x53af('0xd2'),'account':_0x36c366['Account'][_0x53af('0x2d')],'agent':_0x36c366[_0x53af('0xcf')]?_0x36c366['Owner'][_0x53af('0x30')]:'N.A.','createdAt':moment(_0x36c366[_0x53af('0x79')])[_0x53af('0xb5')](_0x53af('0xb6'))[_0x53af('0x94')](),'closedAt':_0x36c366[_0x53af('0x39')]?moment(_0x36c366['closedAt'])[_0x53af('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')[_0x53af('0x94')]():'','disposition':_0x36c366['disposition'],'messages':_(_0x36c366[_0x53af('0xca')])[_0x53af('0x84')]({'secret':![]})[_0x53af('0x3d')](function(_0x1c2d6b){if(_0x1c2d6b[_0x53af('0xc9')]){var _0x4a0b82=path[_0x53af('0xbf')](_0x5abe8b,_0x1c2d6b[_0x53af('0xc9')]['basename']);if(fs[_0x53af('0xd3')](_0x4a0b82)){fs[_0x53af('0xd4')](_0x4a0b82)[_0x53af('0xd5')](fs[_0x53af('0xd6')](path[_0x53af('0xbf')](_0x565305,_0x1c2d6b[_0x53af('0xc9')]['basename'])));}}return{'date':moment(_0x1c2d6b[_0x53af('0x79')])[_0x53af('0xb5')](_0x53af('0xb6'))['toString'](),'sender':_0x1c2d6b[_0x53af('0xcb')]===_0x53af('0xd7')?_0x1c2d6b[_0x53af('0x72')]?_0x1c2d6b[_0x53af('0x72')][_0x53af('0x30')]:_0x53af('0xd8'):_0x1c2d6b[_0x53af('0x68')][_0x53af('0xc7')]+(_0x1c2d6b[_0x53af('0x68')][_0x53af('0xd9')]?'\x20'+_0x1c2d6b[_0x53af('0x68')]['lastName']:''),'body':_0x1c2d6b[_0x53af('0xc9')]?_0x1c2d6b[_0x53af('0xc9')][_0x53af('0xda')]:_0x1c2d6b[_0x53af('0x73')],'direction':_0x1c2d6b[_0x53af('0xcb')]===_0x53af('0xd7')?'A':'C','secret':_0x1c2d6b[_0x53af('0xcc')],'read':_0x1c2d6b[_0x53af('0x80')],'attachment':_0x1c2d6b[_0x53af('0xc9')]};})['value']()};return ejs['renderFile'](path[_0x53af('0xbf')](config[_0x53af('0xc0')],'server',_0x53af('0xdb'),_0x53af('0xdc')),{'interaction':_0x4de6ad})[_0x53af('0x28')](function(_0x51caa3){var _0x471fda=path[_0x53af('0xbf')](_0x565305,_0x53af('0xdd')+_0x36c366['id']+'-'+_0x1cb6ac+_0x53af('0xde'));var _0x54111e={'path':_0x471fda,'channel':_0x53af('0xd2'),'interactionId':_0x36c366['id']};return pdf['createPdfFromHTML'](_0x51caa3,_0x54111e);})[_0x53af('0x28')](function(){return new BPromise(function(_0x262422,_0x2b96a3){zipdir(_0x565305,{'saveTo':_0x1cb102},function(_0x52224e,_0x37b9a4){if(_0x52224e)return _0x2b96a3(_0x52224e);return _0x262422(_0x37b9a4);});})[_0x53af('0x28')](function(){return new BPromise(function(_0x1f5401,_0x410802){rimraf(_0x565305,function(_0x2840de){if(_0x2840de)_0x410802(_0x2840de);return _0x1f5401();});});})['then'](function(){return _0x1d6c5b[_0x53af('0xbd')](_0x1cb102,_0x3fe039,function(_0x24575a){if(_0x24575a){console[_0x53af('0xdf')](_0x53af('0xe0'),_0x24575a);}else{fs[_0x53af('0xe1')](_0x1cb102);}});});});}else{return _0x1d6c5b[_0x53af('0x1b')](0xc8);}})[_0x53af('0x34')](handleError(_0x1d6c5b,null));}; \ No newline at end of file +var _0x20de=['Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','rows','show','includeAll','include','catch','create','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','$gte','options','findAll','addTags','setTags','spread','removeTags','server','files','tmp','join','root','attachments','format','transcript-%d-%s.zip','push','CmContact','lastName','Attachment','Messages','WhatsappAccount','mkdirSync','Whatsapp','Owner','YYYY-MM-DD\x20HH:mm:ss','basename','createReadStream','pipe','createWriteStream','direction','out','firstName','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','sendStatus','send','Users','map','fullname','TagIds','split','Tags','waiting','unmanaged','total','UserId','closed','talking','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','select','field','color','from','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.phone\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.email'];(function(_0x23a751,_0xe44b00){var _0x872bfa=function(_0x5020f8){while(--_0x5020f8){_0x23a751['push'](_0x23a751['shift']());}};_0x872bfa(++_0xe44b00);}(_0x20de,0x134));var _0xe20d=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x20de[_0x476bf4];return _0x788ffe;};'use strict';var emlformat=require(_0xe20d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe20d('0x1'));var jsonpatch=require(_0xe20d('0x2'));var rp=require(_0xe20d('0x3'));var moment=require(_0xe20d('0x4'));var BPromise=require(_0xe20d('0x5'));var Mustache=require(_0xe20d('0x6'));var util=require(_0xe20d('0x7'));var path=require(_0xe20d('0x8'));var sox=require(_0xe20d('0x9'));var csv=require(_0xe20d('0xa'));var ejs=require(_0xe20d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe20d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe20d('0xd'));var toCsv=require(_0xe20d('0xa'));var querystring=require(_0xe20d('0xe'));var Papa=require('papaparse');var Redis=require(_0xe20d('0xf'));var authService=require(_0xe20d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe20d('0x11'));var pdf=require(_0xe20d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe20d('0x13'))(_0xe20d('0x14'));var utils=require(_0xe20d('0x15'));var config=require(_0xe20d('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe20d('0x17')]=_[_0xe20d('0x18')](config[_0xe20d('0x17')],{'host':_0xe20d('0x19'),'port':0x18eb});var socket=require(_0xe20d('0x1a'))(new Redis(config[_0xe20d('0x17')]));require(_0xe20d('0x1b'))[_0xe20d('0x1c')](socket);function respondWithStatusCode(_0x211734,_0x56eeea){_0x56eeea=_0x56eeea||0xcc;return function(_0x2367f7){if(_0x2367f7){return _0x211734['sendStatus'](_0x56eeea);}return _0x211734[_0xe20d('0x1d')](_0x56eeea)[_0xe20d('0x1e')]();};}function respondWithResult(_0x29b500,_0x53f8c3){_0x53f8c3=_0x53f8c3||0xc8;return function(_0x1d6179){if(_0x1d6179){return _0x29b500['status'](_0x53f8c3)[_0xe20d('0x1f')](_0x1d6179);}};}function respondWithFilteredResult(_0x1f2058,_0x285916){return function(_0x4e8dd6){if(_0x4e8dd6){var _0x4353cb=typeof _0x285916[_0xe20d('0x20')]===_0xe20d('0x21')&&typeof _0x285916[_0xe20d('0x22')]==='undefined';var _0x10db76=_0x4e8dd6[_0xe20d('0x23')];var _0x25a17d=_0x4353cb?0x0:_0x285916[_0xe20d('0x20')];var _0x48577c=_0x4353cb?_0x4e8dd6[_0xe20d('0x23')]:_0x285916['offset']+_0x285916['limit'];var _0x1fae60;if(_0x48577c>=_0x10db76){_0x48577c=_0x10db76;_0x1fae60=0xc8;}else{_0x1fae60=0xce;}_0x1f2058[_0xe20d('0x1d')](_0x1fae60);return _0x1f2058['set']('Content-Range',_0x25a17d+'-'+_0x48577c+'/'+_0x10db76)[_0xe20d('0x1f')](_0x4e8dd6);}return null;};}function patchUpdates(_0x25734b){return function(_0x5ce547){try{jsonpatch[_0xe20d('0x24')](_0x5ce547,_0x25734b,!![]);}catch(_0x3fc8b0){return BPromise[_0xe20d('0x25')](_0x3fc8b0);}return _0x5ce547[_0xe20d('0x26')]();};}function saveUpdates(_0x382c1d,_0x5de788){return function(_0x1d88fd){if(_0x1d88fd){return _0x1d88fd[_0xe20d('0x27')](_0x382c1d)[_0xe20d('0x28')](function(_0x4504ee){return _0x4504ee;});}return null;};}function removeEntity(_0x21a53a,_0x51f395){return function(_0x5f1626){if(_0x5f1626){return _0x5f1626[_0xe20d('0x29')]()['then'](function(){_0x21a53a[_0xe20d('0x1d')](0xcc)[_0xe20d('0x1e')]();});}};}function handleEntityNotFound(_0x7391e1,_0x46fc0e){return function(_0x42b1b1){if(!_0x42b1b1){_0x7391e1[_0xe20d('0x2a')](0x194);}return _0x42b1b1;};}function handleError(_0x2c2136,_0x59d416){_0x59d416=_0x59d416||0x1f4;return function(_0x8b7386){logger['error'](_0x8b7386['stack']);if(_0x8b7386['name']){delete _0x8b7386['name'];}_0x2c2136['status'](_0x59d416)[_0xe20d('0x2b')](_0x8b7386);};}function getInteractionUsers(_0x1387dd,_0x41e140){return new BPromise(function(_0x4f2d27,_0x4f4369){try{if(_0x41e140[_0x1387dd['id']]){_0x1387dd[_0xe20d('0x2c')]=_[_0xe20d('0x2d')](_0x41e140[_0x1387dd['id']],function(_0xb91aa){return{'id':_0xb91aa['id'],'fullname':_0xb91aa[_0xe20d('0x2e')]};});}}catch(_0x3d80ff){_0x4f4369(_0x3d80ff);}_0x4f2d27(_0x1387dd);});}function getInteractionTags(_0x388957,_0x36b04b){return new BPromise(function(_0x3a1dcb,_0x494df3){try{if(_0x388957[_0xe20d('0x2f')]){_0x388957['Tags']=[];_0x388957['TagIds'][_0xe20d('0x30')](',')['forEach'](function(_0x1da98b){_0x388957[_0xe20d('0x31')]['push'](_0x36b04b[_0x1da98b]);});}delete _0x388957['TagIds'];}catch(_0x4787ad){_0x494df3(_0x4787ad);}_0x3a1dcb(_0x388957);});}function updateWhatsappInteraction(_0x2b1867,_0x163704,_0x378b8a){return new BPromise(function(_0x972553,_0x3448d4){return getInteractionUsers(_0x2b1867,_0x378b8a)[_0xe20d('0x28')](function(_0x4b5a10){return getInteractionTags(_0x4b5a10,_0x163704);})[_0xe20d('0x28')](function(_0x85e074){return getStateInteraction(_0x85e074);})[_0xe20d('0x28')](function(_0x32e22f){_0x972553(_0x32e22f);})['catch'](function(_0x1da5bf){_0x3448d4(_0x1da5bf);});});}function getStateInteraction(_0x19b190){return new BPromise(function(_0x30bfc7){_0x19b190[_0xe20d('0x32')]=0x0;_0x19b190['talking']=0x0;_0x19b190['answered']=0x0;_0x19b190[_0xe20d('0x33')]=0x0;_0x19b190[_0xe20d('0x34')]=0x0;if(!_0x19b190['closed']&&!_0x19b190[_0xe20d('0x35')]){_0x19b190[_0xe20d('0x32')]+=0x1;}if(!_0x19b190[_0xe20d('0x36')]&&_0x19b190[_0xe20d('0x35')]){_0x19b190[_0xe20d('0x37')]+=0x1;if(_0x19b190[_0xe20d('0x32')]){_0x19b190[_0xe20d('0x32')]-=0x1;}}if(_0x19b190[_0xe20d('0x36')]&&_0x19b190['UserId']){_0x19b190['answered']+=0x1;if(_0x19b190['talking']){_0x19b190[_0xe20d('0x37')]-=0x1;}}if(_0x19b190[_0xe20d('0x36')]&&!_0x19b190['UserId']){_0x19b190[_0xe20d('0x33')]+=0x1;if(_0x19b190[_0xe20d('0x32')]){_0x19b190['waiting']-=0x1;}}_0x19b190['total']+=0x1;_0x30bfc7(_0x19b190);});}exports[_0xe20d('0x38')]=function(_0x51415f,_0x2ffa5b){var _0x590f07={},_0x1d5e89={},_0x3b3a80={'count':0x0,'rows':[]};var _0x4d0716=_[_0xe20d('0x2d')](db[_0xe20d('0x39')][_0xe20d('0x3a')],function(_0x595f95){return{'name':_0x595f95[_0xe20d('0x3b')],'type':_0x595f95[_0xe20d('0x3c')][_0xe20d('0x3d')]};});_0x1d5e89[_0xe20d('0x3e')]=_[_0xe20d('0x2d')](_0x4d0716,_0xe20d('0x3f'));_0x1d5e89[_0xe20d('0x40')]=_[_0xe20d('0x41')](_0x51415f[_0xe20d('0x40')]);_0x1d5e89['filters']=_[_0xe20d('0x42')](_0x1d5e89['model'],_0x1d5e89[_0xe20d('0x40')]);_0x590f07[_0xe20d('0x43')]=_[_0xe20d('0x42')](_0x1d5e89[_0xe20d('0x3e')],qs[_0xe20d('0x44')](_0x51415f['query'][_0xe20d('0x44')]));_0x590f07[_0xe20d('0x43')]=_0x590f07[_0xe20d('0x43')][_0xe20d('0x45')]?_0x590f07[_0xe20d('0x43')]:_0x1d5e89[_0xe20d('0x3e')];if(!_0x51415f['query'][_0xe20d('0x46')](_0xe20d('0x47'))){_0x590f07[_0xe20d('0x22')]=qs[_0xe20d('0x22')](_0x51415f[_0xe20d('0x40')]['limit']);_0x590f07[_0xe20d('0x20')]=qs[_0xe20d('0x20')](_0x51415f[_0xe20d('0x40')]['offset']);}_0x590f07['order']=qs[_0xe20d('0x48')](_0x51415f[_0xe20d('0x40')][_0xe20d('0x48')]);_0x590f07[_0xe20d('0x49')]=qs[_0xe20d('0x4a')](_[_0xe20d('0x4b')](_0x51415f[_0xe20d('0x40')],_0x1d5e89[_0xe20d('0x4a')]),_0x4d0716);var _0x1f37c1=[];var _0x5dc2e1=squel[_0xe20d('0x4c')]()[_0xe20d('0x4d')]('id')[_0xe20d('0x4d')](_0xe20d('0x3f'))[_0xe20d('0x4d')](_0xe20d('0x4e'))[_0xe20d('0x4f')]('tools_tags');var _0x255efe=squel[_0xe20d('0x4c')]()[_0xe20d('0x4d')]('u.id')[_0xe20d('0x4d')](_0xe20d('0x50'))['field'](_0xe20d('0x51'))[_0xe20d('0x4f')](_0xe20d('0x52'),'ui')[_0xe20d('0x53')](_0xe20d('0x54'),'u',_0xe20d('0x55'));var _0x453cf1=squel[_0xe20d('0x4c')]()[_0xe20d('0x4f')](_0xe20d('0x56'),'i')['left_join'](_0xe20d('0x57'),'c',_0xe20d('0x58'))[_0xe20d('0x53')]('users','o',_0xe20d('0x59'))[_0xe20d('0x53')](_0xe20d('0x5a'),'a',_0xe20d('0x5b'))[_0xe20d('0x53')](_0xe20d('0x5c'),'me',_0xe20d('0x5d'))[_0xe20d('0x53')](_0xe20d('0x5e'),'it',_0xe20d('0x5f'))['left_join']('tools_tags','t',_0xe20d('0x60'));var _0x312b83=squel[_0xe20d('0x61')]();var _0x3967cd=[];var _0x31c347=squel['expr']();var _0x1b50ea;if(_0x51415f['query'][_0xe20d('0x62')]){_0x1b50ea=as[_0xe20d('0x63')](_0x51415f[_0xe20d('0x40')][_0xe20d('0x62')]);var _0xbce4ba=_0x1b50ea['sqlOperator'];for(var _0x353366=0x0;_0x353366<_0x1b50ea['conditions'][_0xe20d('0x45')];_0x353366++){var _0x27c6f1=_0x1b50ea['conditions'][_0x353366];var _0x232a30='i';var _0x16d55c=_[_0xe20d('0x64')](_0x4d0716,[_0xe20d('0x3f'),_0x27c6f1[_0xe20d('0x4d')]]);if(!_0x16d55c){switch(_0x27c6f1[_0xe20d('0x4d')]){case _0xe20d('0x65'):if(_0x27c6f1[_0xe20d('0x66')]==0x1){_0x453cf1[_0xe20d('0x67')]('`'+_0x27c6f1[_0xe20d('0x4d')]+_0xe20d('0x68'));}else{_0x453cf1[_0xe20d('0x67')]('`'+_0x27c6f1[_0xe20d('0x4d')]+_0xe20d('0x69'));}break;case _0xe20d('0x6a'):if(_0x27c6f1[_0xe20d('0x6b')]===_0xe20d('0x6c')){if(_0x27c6f1['value'][_0xe20d('0x30')]('\x20')['length']>0x1){_0x312b83[_0xbce4ba](_0xe20d('0x6d'),qs[_0xe20d('0x6e')](_0x27c6f1[_0xe20d('0x66')]),null);}else{var _0x34bf87='%'+_0x27c6f1[_0xe20d('0x66')]+'%';_0x312b83[_0xbce4ba](_0xe20d('0x6f'),_0x34bf87,_0x34bf87,_0x34bf87);}}else{_0x16d55c=_['find'](_0x4d0716,[_0xe20d('0x3f'),_0xe20d('0x70')]);_0x27c6f1[_0xe20d('0x4d')]='ContactId';_0x2c5d64=as[_0xe20d('0x71')](_0x232a30,_0x16d55c[_0xe20d('0x3c')],_0x27c6f1);_0x312b83[_0xbce4ba](_0x2c5d64['text'],_0x2c5d64[_0xe20d('0x66')][_0xe20d('0x72')],_0x2c5d64['value']['end']);}break;case _0xe20d('0x73'):var _0x1fbedd=_0x27c6f1[_0xe20d('0x66')]['split'](',')[_0xe20d('0x2d')](function(_0x374d3f){return Number(_0x374d3f);});_0x1fbedd[_0xe20d('0x74')](function(_0x3cb67b){_0x31c347['or'](_0xe20d('0x75'),'%,'+_0x3cb67b+',%');});_0x3967cd=_[_0xe20d('0x76')](_0x3967cd,_0x1fbedd);break;case _0xe20d('0x77'):if(_0x27c6f1[_0xe20d('0x6b')]===_0xe20d('0x6c')){_0x312b83[_0xbce4ba](_0xe20d('0x78'),'%'+_0x27c6f1[_0xe20d('0x66')]+'%',null);}else{_0x16d55c=_[_0xe20d('0x64')](_0x4d0716,[_0xe20d('0x3f'),'UserId']);_0x27c6f1[_0xe20d('0x4d')]=_0xe20d('0x35');_0x2c5d64=as[_0xe20d('0x71')](_0x232a30,_0x16d55c[_0xe20d('0x3c')],_0x27c6f1);_0x312b83[_0xbce4ba](_0x2c5d64[_0xe20d('0x79')],_0x2c5d64[_0xe20d('0x66')][_0xe20d('0x72')],_0x2c5d64['value']['end']);}break;case _0xe20d('0x7a'):_0x2c5d64=as[_0xe20d('0x71')]('me',null,_0x27c6f1);_0x312b83[_0xbce4ba](_0x2c5d64[_0xe20d('0x79')],_0x2c5d64[_0xe20d('0x66')][_0xe20d('0x72')],_0x2c5d64[_0xe20d('0x66')][_0xe20d('0x1e')]);break;}}else{var _0x2c5d64=as[_0xe20d('0x71')](_0x232a30,_0x16d55c['type'],_0x27c6f1);_0x312b83[_0xbce4ba](_0x2c5d64[_0xe20d('0x79')],_0x2c5d64[_0xe20d('0x66')][_0xe20d('0x72')],_0x2c5d64[_0xe20d('0x66')][_0xe20d('0x1e')]);}}}else{var _0x2734e8=_(_0x51415f[_0xe20d('0x40')])['keys']()[_0xe20d('0x2d')](function(_0x1ec44b){return _[_0xe20d('0x7b')](_0x4d0716,[_0xe20d('0x3f'),_0x1ec44b])?_0x1ec44b:undefined;})[_0xe20d('0x7c')]()[_0xe20d('0x66')]();if(!_[_0xe20d('0x7d')](_0x2734e8)){_0x2734e8[_0xe20d('0x74')](function(_0x12b5d0){if(_0x12b5d0==='WhatsappAccountId'){_0x453cf1['where'](_0xe20d('0x7e'),[][_0xe20d('0x7f')](_0x51415f[_0xe20d('0x40')][_0x12b5d0]));}else if(_0x12b5d0===_0xe20d('0x80')){var _0x5a7626=JSON[_0xe20d('0x81')](_0x51415f[_0xe20d('0x40')][_0x12b5d0])['$gte'];var _0x46af20=JSON[_0xe20d('0x81')](_0x51415f[_0xe20d('0x40')][_0x12b5d0])[_0xe20d('0x82')];_0x453cf1['where'](_0xe20d('0x83'),_0x5a7626,_0x46af20);}else{if(_0x51415f['query'][_0x12b5d0]===_0xe20d('0x84')){_0x453cf1[_0xe20d('0x49')]('i.'+_0x12b5d0+_0xe20d('0x85'));}else{_0x453cf1['where']('i.'+_0x12b5d0+_0xe20d('0x86'),_0x51415f[_0xe20d('0x40')][_0x12b5d0]);}}});}if(_0x51415f['query'][_0xe20d('0x87')]){if(_0x51415f[_0xe20d('0x40')][_0xe20d('0x87')]==0x1){_0x453cf1[_0xe20d('0x67')](_0xe20d('0x88'));}else{_0x453cf1['having'](_0xe20d('0x89'));}}if(_0x51415f[_0xe20d('0x40')][_0xe20d('0x8a')]){_0x3967cd=_[_0xe20d('0x8b')](_0x51415f[_0xe20d('0x40')][_0xe20d('0x8a')])?_0x51415f[_0xe20d('0x40')][_0xe20d('0x8a')]:new Array(_0x51415f[_0xe20d('0x40')]['tag']);_0x3967cd[_0xe20d('0x74')](function(_0xf9cd72){_0x31c347['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xf9cd72+',%');});}if(_0x51415f[_0xe20d('0x40')][_0xe20d('0x8c')]){var _0x42cf37=_0x51415f[_0xe20d('0x40')][_0xe20d('0x8c')][_0xe20d('0x8d')]('\x5c','\x5c\x5c')[_0xe20d('0x8d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x42cf37)){_0x312b83['or']('i.id\x20LIKE\x20?',_0x42cf37+'%')['or'](_0xe20d('0x8e'),_0x42cf37+'%');}else{_0x312b83['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe20d('0x6e')](_0x42cf37))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x42cf37+'%');}}}_0x453cf1[_0xe20d('0x49')](_0x312b83);_0x453cf1[_0xe20d('0x8f')]('i.id');var _0x3b892f={'type':db[_0xe20d('0x90')][_0xe20d('0x91')][_0xe20d('0x92')],'raw':!![]};var _0x35c770=_0x453cf1[_0xe20d('0x93')]();_0x35c770[_0xe20d('0x4d')](_0xe20d('0x94'));_0x35c770[_0xe20d('0x4d')](_0xe20d('0x95'),_0xe20d('0x65'));if(_0x590f07[_0xe20d('0x96')]){_0x590f07['order']['forEach'](function(_0xd9437){var _0x17c6e2=_0xd9437[0x0]===_0xe20d('0x97')?_0xd9437[0x0]:'i.'+_0xd9437[0x0];_0x453cf1[_0xe20d('0x96')](_0x17c6e2,_0xd9437[0x1]===_0xe20d('0x98')?![]:!![]);});}if(!_[_0xe20d('0x7d')](_0x3967cd)){_0x453cf1[_0xe20d('0x67')](_0x31c347);_0x35c770[_0xe20d('0x49')](_0xe20d('0x99'),_0x3967cd);}BPromise[_0xe20d('0x9a')]()[_0xe20d('0x28')](function(){if(!_0x1b50ea){if(_0x51415f[_0xe20d('0x40')]['WhatsappAccountId'])return;_0x35c770[_0xe20d('0x49')](_0xe20d('0x9b'));_0x453cf1['where'](_0xe20d('0x9b'));return;}if(_0x51415f[_0xe20d('0x9c')]['role']!==_0xe20d('0x9d'))return;return _0x51415f[_0xe20d('0x9c')][_0xe20d('0x9e')]({'attributes':['id'],'raw':!![]})[_0xe20d('0x28')](function(_0x1d553a){if(_['isEmpty'](_0x1d553a)){_0x35c770[_0xe20d('0x49')](_0xe20d('0x9f'));_0x453cf1[_0xe20d('0x49')](_0xe20d('0x9f'));}else{_0x35c770[_0xe20d('0x49')]('i.WhatsappAccountId\x20IN\x20?',_[_0xe20d('0x2d')](_0x1d553a,'id'));_0x453cf1['where'](_0xe20d('0x7e'),_[_0xe20d('0x2d')](_0x1d553a,'id'));}});})['then'](function(){if(_0x51415f['user'][_0xe20d('0xa0')]===_0xe20d('0x9d')&&!_0x1b50ea&&!_0x51415f[_0xe20d('0x40')]['WhatsappAccountId'])return[];return db[_0xe20d('0xa1')]['query'](_0x35c770['toString'](),_0x3b892f);})[_0xe20d('0x28')](function(_0x1a5f5c){_0x3b3a80[_0xe20d('0x23')]=_0x1a5f5c[_0xe20d('0x45')];if(_0x3b3a80['count']===0x0)return[];return db[_0xe20d('0xa1')]['query'](_0x5dc2e1[_0xe20d('0xa2')](),_0x3b892f)[_0xe20d('0x28')](function(_0x11d033){_0x1f37c1=_[_0xe20d('0xa3')](_0x11d033,'id');_0x3b892f=_[_0xe20d('0xa4')](_0x3b892f,{'model':db[_0xe20d('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x51415f[_0xe20d('0x40')]['fields']){_0x590f07[_0xe20d('0x43')][_0xe20d('0x74')](function(_0x426659){_0x453cf1[_0xe20d('0x4d')]('i.'+_0x426659);});}else{_0x453cf1['field'](_0xe20d('0x95'),_0xe20d('0x65'));_0x453cf1['field'](_0xe20d('0xa5'),'Account.key');_0x453cf1['field'](_0xe20d('0xa6'),_0xe20d('0xa7'));_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xa8'),_0xe20d('0x97'));_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xa9'));_0x453cf1[_0xe20d('0x4d')]('c.firstName',_0xe20d('0xaa'));_0x453cf1[_0xe20d('0x4d')]('c.lastName','Contact.lastName');_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xab'),_0xe20d('0xac'));_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xad'),'Contact.phone');_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xae'),'Contact.mobile');_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xaf'),_0xe20d('0xb0'));_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xb1'),'Owner.fullname');_0x453cf1[_0xe20d('0x4d')]('o.internal',_0xe20d('0xb2'));_0x453cf1[_0xe20d('0x4d')](_0xe20d('0xb3'),_0xe20d('0x2f'));}if(_0x590f07[_0xe20d('0x22')])_0x453cf1[_0xe20d('0x22')](_0x590f07[_0xe20d('0x22')]);if(_0x590f07[_0xe20d('0x20')])_0x453cf1[_0xe20d('0x20')](_0x590f07[_0xe20d('0x20')]);return db['sequelize'][_0xe20d('0x40')](_0x453cf1['toString'](),_0x3b892f);})[_0xe20d('0x28')](function(_0x1c38e3){if(_0x1c38e3[_0xe20d('0x45')]>0x0)_0x255efe[_0xe20d('0x49')](_0xe20d('0xb4'),_[_0xe20d('0x2d')](_0x1c38e3,'id'));return db[_0xe20d('0xa1')][_0xe20d('0x40')](_0x255efe[_0xe20d('0xa2')](),_0x3b892f)[_0xe20d('0x28')](function(_0x2376ce){var _0x455763=_[_0xe20d('0xb5')](_0x2376ce,_0xe20d('0xb6'));var _0x2ca3cb=[];_0x1c38e3[_0xe20d('0x74')](function(_0xdec72f){_0x2ca3cb['push'](updateWhatsappInteraction(_0xdec72f,_0x1f37c1,_0x455763));});return BPromise['all'](_0x2ca3cb);});});})[_0xe20d('0x28')](function(_0x300860){_0x3b3a80[_0xe20d('0xb7')]=_0x300860;return _0x3b3a80;})[_0xe20d('0x28')](respondWithFilteredResult(_0x2ffa5b,_0x590f07))['catch'](handleError(_0x2ffa5b,null));};exports[_0xe20d('0xb8')]=function(_0x3a7bc2,_0x9a3822){var _0x227ffb={'raw':![],'where':{'id':_0x3a7bc2['params']['id']}},_0x5bc3c4={};_0x5bc3c4['model']=_['keys'](db[_0xe20d('0x39')][_0xe20d('0x3a')]);_0x5bc3c4[_0xe20d('0x40')]=_[_0xe20d('0x41')](_0x3a7bc2[_0xe20d('0x40')]);_0x5bc3c4[_0xe20d('0x4a')]=_[_0xe20d('0x42')](_0x5bc3c4[_0xe20d('0x3e')],_0x5bc3c4['query']);_0x227ffb['attributes']=_[_0xe20d('0x42')](_0x5bc3c4['model'],qs['fields'](_0x3a7bc2[_0xe20d('0x40')][_0xe20d('0x44')]));_0x227ffb['attributes']=_0x227ffb['attributes'][_0xe20d('0x45')]?_0x227ffb[_0xe20d('0x43')]:_0x5bc3c4[_0xe20d('0x3e')];if(_0x3a7bc2['query'][_0xe20d('0xb9')]){_0x227ffb[_0xe20d('0xba')]=[{'all':!![]}];}_0x227ffb=_['merge']({},_0x227ffb,_0x3a7bc2['options']);return db[_0xe20d('0x39')][_0xe20d('0x64')](_0x227ffb)[_0xe20d('0x28')](handleEntityNotFound(_0x9a3822,null))[_0xe20d('0x28')](respondWithResult(_0x9a3822,null))[_0xe20d('0xbb')](handleError(_0x9a3822,null));};exports['create']=function(_0x591195,_0x1dcb8b){return db['WhatsappInteraction'][_0xe20d('0xbc')](_0x591195[_0xe20d('0x7a')],{})[_0xe20d('0x28')](respondWithResult(_0x1dcb8b,0xc9))[_0xe20d('0xbb')](handleError(_0x1dcb8b,null));};exports[_0xe20d('0x27')]=function(_0x48e30d,_0x2cbe0d){if(_0x48e30d[_0xe20d('0x7a')]['id']){delete _0x48e30d[_0xe20d('0x7a')]['id'];}return db['WhatsappInteraction'][_0xe20d('0x64')]({'where':{'id':_0x48e30d['params']['id']}})[_0xe20d('0x28')](handleEntityNotFound(_0x2cbe0d,null))[_0xe20d('0x28')](saveUpdates(_0x48e30d[_0xe20d('0x7a')],null))[_0xe20d('0x28')](respondWithResult(_0x2cbe0d,null))['catch'](handleError(_0x2cbe0d,null));};exports[_0xe20d('0x29')]=function(_0x135300,_0x2cc486){return db['WhatsappInteraction'][_0xe20d('0x64')]({'where':{'id':_0x135300[_0xe20d('0xbd')]['id']}})[_0xe20d('0x28')](handleEntityNotFound(_0x2cc486,null))[_0xe20d('0x28')](removeEntity(_0x2cc486,null))[_0xe20d('0xbb')](handleError(_0x2cc486,null));};exports[_0xe20d('0xbe')]=function(_0x1d6510,_0x10ddd1){return db[_0xe20d('0x39')][_0xe20d('0xbe')]()['then'](respondWithResult(_0x10ddd1,null))[_0xe20d('0xbb')](handleError(_0x10ddd1,null));};exports[_0xe20d('0xbf')]=function(_0x117cd6,_0x9d85e1,_0xfb6f04){return db[_0xe20d('0xc0')]['find']({'where':{'id':_0x117cd6[_0xe20d('0xbd')]['id']}})[_0xe20d('0x28')](handleEntityNotFound(_0x9d85e1,null))['then'](function(_0x357795){if(_0x357795){return _0x357795['addMessage'](_0x117cd6[_0xe20d('0x7a')][_0xe20d('0xc1')],_[_0xe20d('0xc2')](_0x117cd6[_0xe20d('0x7a')],[_0xe20d('0xc1'),'id'])||{});}})[_0xe20d('0x28')](respondWithResult(_0x9d85e1,null))[_0xe20d('0xbb')](handleError(_0x9d85e1,null));};exports[_0xe20d('0xc3')]=function(_0x5c06df,_0xc9efa6,_0x3889a7){var _0x2341d2={'raw':![],'where':{}};var _0x4f910e={};var _0x1f3fac={'count':0x0,'rows':[]};return db[_0xe20d('0x39')][_0xe20d('0xc4')]({'where':{'id':_0x5c06df[_0xe20d('0xbd')]['id']}})[_0xe20d('0x28')](handleEntityNotFound(_0xc9efa6,null))['then'](function(_0x3e7322){if(_0x3e7322){_0x4f910e[_0xe20d('0x3e')]=_[_0xe20d('0x41')](db[_0xe20d('0xc0')][_0xe20d('0x3a')]);_0x4f910e[_0xe20d('0x40')]=_[_0xe20d('0x41')](_0x5c06df[_0xe20d('0x40')]);_0x4f910e[_0xe20d('0x4a')]=_[_0xe20d('0x42')](_0x4f910e[_0xe20d('0x3e')],_0x4f910e['query']);_0x2341d2[_0xe20d('0x43')]=_[_0xe20d('0x42')](_0x4f910e[_0xe20d('0x3e')],qs[_0xe20d('0x44')](_0x5c06df[_0xe20d('0x40')][_0xe20d('0x44')]));_0x2341d2['attributes']=_0x2341d2[_0xe20d('0x43')]['length']?_0x2341d2[_0xe20d('0x43')]:_0x4f910e[_0xe20d('0x3e')];if(!_0x5c06df[_0xe20d('0x40')]['hasOwnProperty'](_0xe20d('0x47'))){_0x2341d2[_0xe20d('0x22')]=qs[_0xe20d('0x22')](_0x5c06df[_0xe20d('0x40')]['limit']);_0x2341d2[_0xe20d('0x20')]=qs[_0xe20d('0x20')](_0x5c06df[_0xe20d('0x40')][_0xe20d('0x20')]);}_0x2341d2[_0xe20d('0x96')]=qs[_0xe20d('0x48')](_0x5c06df['query'][_0xe20d('0x48')]);_0x2341d2[_0xe20d('0x49')]=qs['filters'](_['pick'](_0x5c06df[_0xe20d('0x40')],_0x4f910e[_0xe20d('0x4a')]));_0x2341d2[_0xe20d('0x49')][_0xe20d('0xb6')]=_0x3e7322['id'];if(_0x5c06df[_0xe20d('0x40')][_0xe20d('0x8c')]){_0x2341d2[_0xe20d('0x49')]=_[_0xe20d('0xa4')](_0x2341d2[_0xe20d('0x49')],{'$or':_[_0xe20d('0x2d')](_0x2341d2['attributes'],function(_0x50dad7){var _0x11bca3={};_0x11bca3[_0x50dad7]={'$like':'%'+_0x5c06df[_0xe20d('0x40')]['filter']+'%'};return _0x11bca3;})});}if(_0x5c06df['query'][_0xe20d('0xc5')]){var _0x395538=_0x5c06df[_0xe20d('0x40')][_0xe20d('0xc5')]['split'](',');var _0x1dc7c1={};_0x1dc7c1[_0x395538[0x0]]={'$gte':moment(_0x395538[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2341d2[_0xe20d('0x49')]=_['merge'](_0x2341d2['where'],_0x1dc7c1);}_0x2341d2=_['merge']({},_0x2341d2,_0x5c06df[_0xe20d('0xc6')]);return db['WhatsappMessage'][_0xe20d('0x23')]({'where':_0x2341d2[_0xe20d('0x49')]})['then'](function(_0x290183){_0x1f3fac[_0xe20d('0x23')]=_0x290183;if(_0x5c06df[_0xe20d('0x40')][_0xe20d('0xb9')]){_0x2341d2[_0xe20d('0xba')]=[{'all':!![]}];}return db[_0xe20d('0xc0')][_0xe20d('0xc7')](_0x2341d2);})[_0xe20d('0x28')](function(_0x53c6f8){_0x1f3fac['rows']=_0x53c6f8;return _0x1f3fac;});}})['then'](respondWithFilteredResult(_0xc9efa6,_0x2341d2))['catch'](handleError(_0xc9efa6,null));};exports[_0xe20d('0xc8')]=function(_0x2b9948,_0x3b04aa,_0xc18e39){return db[_0xe20d('0x39')][_0xe20d('0x64')]({'where':{'id':_0x2b9948[_0xe20d('0xbd')]['id']}})[_0xe20d('0x28')](handleEntityNotFound(_0x3b04aa,null))['then'](function(_0x1a5536){if(_0x1a5536){return _0x1a5536[_0xe20d('0xc9')](_0x2b9948[_0xe20d('0x7a')][_0xe20d('0xc1')],_[_0xe20d('0xc2')](_0x2b9948[_0xe20d('0x7a')],[_0xe20d('0xc1'),'id'])||{})[_0xe20d('0xca')](function(){return db[_0xe20d('0x73')][_0xe20d('0xc7')]({'attributes':['id','name',_0xe20d('0x4e')],'where':{'id':_0x2b9948['body'][_0xe20d('0xc1')]}});})[_0xe20d('0x28')](function(_0x5c916f){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x2b9948[_0xe20d('0xbd')]['id']),'tags':_0x5c916f||[]});return{'id':Number(_0x2b9948[_0xe20d('0xbd')]['id']),'tags':_0x5c916f||[]};});}})[_0xe20d('0x28')](respondWithResult(_0x3b04aa,null))[_0xe20d('0xbb')](handleError(_0x3b04aa,null));};exports[_0xe20d('0xcb')]=function(_0x3b60da,_0x5b4176,_0x18dab1){return db['WhatsappInteraction']['find']({'where':{'id':_0x3b60da['params']['id']}})['then'](handleEntityNotFound(_0x5b4176,null))['then'](function(_0x3bc4da){if(_0x3bc4da){return _0x3bc4da[_0xe20d('0xcb')](_0x3b60da[_0xe20d('0x40')][_0xe20d('0xc1')]);}})[_0xe20d('0x28')](respondWithStatusCode(_0x5b4176,null))[_0xe20d('0xbb')](handleError(_0x5b4176,null));};exports['download']=function(_0xde5ed,_0x2cce9c){var _0x64ea4a=moment()['unix']()['toString']();var _0x1709ec=path['join'](config['root'],_0xe20d('0xcc'),_0xe20d('0xcd'),_0xe20d('0xce'));var _0x1dc641=path[_0xe20d('0xcf')](config[_0xe20d('0xd0')],'server','files',_0xe20d('0xd1'));var _0x408751=path['join'](_0x1709ec,_0x64ea4a);var _0x1f119e=util[_0xe20d('0xd2')](_0xe20d('0xd3'),_0xde5ed[_0xe20d('0xbd')]['id'],_0x64ea4a);var _0x2321f8=path[_0xe20d('0xcf')](_0x1709ec,_0x1f119e);var _0x29fd62=[];_0x29fd62[_0xe20d('0xd4')]({'model':db[_0xe20d('0x77')],'as':_0xe20d('0x77'),'attributes':['id','fullname'],'raw':!![]});_0x29fd62['push']({'model':db[_0xe20d('0xd5')],'as':'Contact','attributes':['id','firstName',_0xe20d('0xd6')],'raw':!![]});if(_0xde5ed['query']['attachments']){_0x29fd62[_0xe20d('0xd4')]({'model':db[_0xe20d('0xd7')],'as':_0xe20d('0xd7'),'raw':!![]});}var _0x4cabac=[{'model':db[_0xe20d('0xc0')],'as':_0xe20d('0xd8'),'attributes':['id',_0xe20d('0x7a'),'createdAt','direction','secret',_0xe20d('0x87')],'include':_0x29fd62}];_0x4cabac[_0xe20d('0xd4')]({'model':db[_0xe20d('0xd9')],'as':'Account','attributes':['id',_0xe20d('0x3f')]});_0x4cabac[_0xe20d('0xd4')]({'model':db[_0xe20d('0x77')],'as':'Owner','attributes':['id',_0xe20d('0x2e')]});return db[_0xe20d('0x39')][_0xe20d('0x64')]({'where':{'id':_0xde5ed[_0xe20d('0xbd')]['id']},'include':_0x4cabac})[_0xe20d('0x28')](handleEntityNotFound(_0x2cce9c,null))[_0xe20d('0x28')](function(_0x181c3e){if(_0x181c3e){var _0x295dee=_0x181c3e['get']({'plain':!![]});fs[_0xe20d('0xda')](_0x408751);var _0x2c6ca4={'channel':_0xe20d('0xdb'),'account':_0x295dee['Account'][_0xe20d('0x3f')],'agent':_0x295dee[_0xe20d('0xdc')]?_0x295dee[_0xe20d('0xdc')]['fullname']:'N.A.','createdAt':moment(_0x295dee[_0xe20d('0x80')])[_0xe20d('0xd2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe20d('0xa2')](),'closedAt':_0x295dee[_0xe20d('0x36')]?moment(_0x295dee['closedAt'])[_0xe20d('0xd2')](_0xe20d('0xdd'))[_0xe20d('0xa2')]():'','disposition':_0x295dee['disposition'],'messages':_(_0x295dee['Messages'])[_0xe20d('0x8c')]({'secret':![]})[_0xe20d('0x2d')](function(_0x2a7123){if(_0x2a7123[_0xe20d('0xd7')]){var _0xcdc37a=path[_0xe20d('0xcf')](_0x1dc641,_0x2a7123[_0xe20d('0xd7')][_0xe20d('0xde')]);if(fs['existsSync'](_0xcdc37a)){fs[_0xe20d('0xdf')](_0xcdc37a)[_0xe20d('0xe0')](fs[_0xe20d('0xe1')](path['join'](_0x408751,_0x2a7123[_0xe20d('0xd7')][_0xe20d('0xde')])));}}return{'date':moment(_0x2a7123[_0xe20d('0x80')])[_0xe20d('0xd2')](_0xe20d('0xdd'))[_0xe20d('0xa2')](),'sender':_0x2a7123[_0xe20d('0xe2')]===_0xe20d('0xe3')?_0x2a7123[_0xe20d('0x77')]?_0x2a7123[_0xe20d('0x77')][_0xe20d('0x2e')]:'System':_0x2a7123[_0xe20d('0x6a')][_0xe20d('0xe4')]+(_0x2a7123[_0xe20d('0x6a')][_0xe20d('0xd6')]?'\x20'+_0x2a7123[_0xe20d('0x6a')]['lastName']:''),'body':_0x2a7123[_0xe20d('0xd7')]?_0x2a7123[_0xe20d('0xd7')][_0xe20d('0xde')]:_0x2a7123[_0xe20d('0x7a')],'direction':_0x2a7123[_0xe20d('0xe2')]==='out'?'A':'C','secret':_0x2a7123[_0xe20d('0xe5')],'read':_0x2a7123[_0xe20d('0x87')],'attachment':_0x2a7123[_0xe20d('0xd7')]};})[_0xe20d('0x66')]()};return ejs[_0xe20d('0xe6')](path[_0xe20d('0xcf')](config['root'],_0xe20d('0xcc'),_0xe20d('0xe7'),_0xe20d('0xe8')),{'interaction':_0x2c6ca4})[_0xe20d('0x28')](function(_0x12c60e){var _0x113189=path['join'](_0x408751,_0xe20d('0xe9')+_0x295dee['id']+'-'+_0x64ea4a+_0xe20d('0xea'));var _0x554220={'path':_0x113189,'channel':_0xe20d('0xdb'),'interactionId':_0x295dee['id']};return pdf[_0xe20d('0xeb')](_0x12c60e,_0x554220);})[_0xe20d('0x28')](function(){return new BPromise(function(_0x654bd4,_0x30cf0b){zipdir(_0x408751,{'saveTo':_0x2321f8},function(_0x12ab5e,_0x5bf950){if(_0x12ab5e)return _0x30cf0b(_0x12ab5e);return _0x654bd4(_0x5bf950);});})['then'](function(){return new BPromise(function(_0x17e96f,_0x1a99a7){rimraf(_0x408751,function(_0x2a45fa){if(_0x2a45fa)_0x1a99a7(_0x2a45fa);return _0x17e96f();});});})[_0xe20d('0x28')](function(){return _0x2cce9c[_0xe20d('0xec')](_0x2321f8,_0x1f119e,function(_0x5eb941){if(_0x5eb941){console[_0xe20d('0xed')](_0xe20d('0xee'),_0x5eb941);}else{fs[_0xe20d('0xef')](_0x2321f8);}});});});}else{return _0x2cce9c['sendStatus'](0xc8);}})[_0xe20d('0xbb')](handleError(_0x2cce9c,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index e57450a..14735b0 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 _0x2917=['../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x38f737,_0x54f685){var _0x7afda3=function(_0x1ac1d7){while(--_0x1ac1d7){_0x38f737['push'](_0x38f737['shift']());}};_0x7afda3(++_0x54f685);}(_0x2917,0x142));var _0x7291=function(_0x5465e6,_0x2a8809){_0x5465e6=_0x5465e6-0x0;var _0x10044e=_0x2917[_0x5465e6];return _0x10044e;};'use strict';var EventEmitter=require(_0x7291('0x0'));var WhatsappInteraction=require(_0x7291('0x1'))['db'][_0x7291('0x2')];var WhatsappMessage=require(_0x7291('0x1'))['db'][_0x7291('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x7291('0x4')](0x0);var events={'afterCreate':_0x7291('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22afb9){return function(_0x1d0429,_0x1b5e13,_0x6aac19){_0x1d0429[_0x7291('0x6')]({'attributes':['id'],'raw':!![]})[_0x7291('0x7')](function(_0x4609af){_0x1d0429[_0x7291('0x8')](_0x7291('0x9'),_0x4609af[_0x7291('0xa')](function(_0x3c7f38){return{'id':_0x3c7f38['id']};}));return WhatsappMessage[_0x7291('0xb')]({'where':{'WhatsappInteractionId':_0x1d0429['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7291('0x7')](function(_0x15298e){_0x1d0429[_0x7291('0x8')]('unreadMessages',_0x15298e[_0x7291('0xc')]);WhatsappInteractionEvents[_0x7291('0xd')](_0x22afb9+':'+_0x1d0429['id'],_0x1d0429);WhatsappInteractionEvents[_0x7291('0xd')](_0x22afb9,_0x1d0429);_0x6aac19(null);})[_0x7291('0xe')](_0x6aac19(null));};}for(var e in events){if(events[_0x7291('0xf')](e)){var event=events[e];WhatsappInteraction[_0x7291('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xe205=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','findAll','unreadMessages','length'];(function(_0x2d6b21,_0x49a9db){var _0x1b3e49=function(_0x56d8e8){while(--_0x56d8e8){_0x2d6b21['push'](_0x2d6b21['shift']());}};_0x1b3e49(++_0x49a9db);}(_0xe205,0xa7));var _0x5e20=function(_0x341cad,_0x4fcca4){_0x341cad=_0x341cad-0x0;var _0x401840=_0xe205[_0x341cad];return _0x401840;};'use strict';var EventEmitter=require(_0x5e20('0x0'));var WhatsappInteraction=require(_0x5e20('0x1'))['db'][_0x5e20('0x2')];var WhatsappMessage=require(_0x5e20('0x1'))['db'][_0x5e20('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5e20('0x4')](0x0);var events={'afterCreate':_0x5e20('0x5'),'afterUpdate':_0x5e20('0x6'),'afterDestroy':_0x5e20('0x7')};function emitEvent(_0x4ac934){return function(_0x1a6198,_0x1b26a2,_0x44dbb3){_0x1a6198[_0x5e20('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4cc88d){_0x1a6198[_0x5e20('0x9')]('Users',_0x4cc88d['map'](function(_0x30b757){return{'id':_0x30b757['id']};}));return WhatsappMessage[_0x5e20('0xa')]({'where':{'WhatsappInteractionId':_0x1a6198['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x91dca7){_0x1a6198[_0x5e20('0x9')](_0x5e20('0xb'),_0x91dca7[_0x5e20('0xc')]);WhatsappInteractionEvents['emit'](_0x4ac934+':'+_0x1a6198['id'],_0x1a6198);WhatsappInteractionEvents[_0x5e20('0xd')](_0x4ac934,_0x1a6198);_0x44dbb3(null);})[_0x5e20('0xe')](_0x44dbb3(null));};}for(var e in events){if(events[_0x5e20('0xf')](e)){var event=events[e];WhatsappInteraction[_0x5e20('0x10')](e,emitEvent(event));}}module[_0x5e20('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index ef8ff6c..223b11b 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 _0x2b07=['whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction'];(function(_0x18f146,_0x3738ed){var _0x1e413c=function(_0xf5551e){while(--_0xf5551e){_0x18f146['push'](_0x18f146['shift']());}};_0x1e413c(++_0x3738ed);}(_0x2b07,0x7c));var _0x72b0=function(_0x8bb4c1,_0x2d6e53){_0x8bb4c1=_0x8bb4c1-0x0;var _0x67a6e1=_0x2b07[_0x8bb4c1];return _0x67a6e1;};'use strict';var _=require(_0x72b0('0x0'));var util=require(_0x72b0('0x1'));var logger=require('../../config/logger')(_0x72b0('0x2'));var moment=require('moment');var BPromise=require(_0x72b0('0x3'));var rp=require(_0x72b0('0x4'));var fs=require('fs');var path=require(_0x72b0('0x5'));var rimraf=require(_0x72b0('0x6'));var config=require(_0x72b0('0x7'));var attributes=require(_0x72b0('0x8'));module[_0x72b0('0x9')]=function(_0x3dec8b,_0x2aafce){return _0x3dec8b[_0x72b0('0xa')](_0x72b0('0xb'),attributes,{'tableName':_0x72b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27ba53,_0x3e9012,_0x454bec){if(_0x27ba53['changed'](_0x72b0('0xd'))){_0x27ba53[_0x72b0('0xe')]=moment()[_0x72b0('0xf')](_0x72b0('0x10'));}_0x454bec(null,_0x27ba53);}}});}; \ No newline at end of file +var _0x78ce=['exports','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x536bc2,_0x35c4bf){var _0x551b56=function(_0x4637a6){while(--_0x4637a6){_0x536bc2['push'](_0x536bc2['shift']());}};_0x551b56(++_0x35c4bf);}(_0x78ce,0x158));var _0xe78c=function(_0x1bb07c,_0x43cd16){_0x1bb07c=_0x1bb07c-0x0;var _0x30bb8a=_0x78ce[_0x1bb07c];return _0x30bb8a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe78c('0x0'));var moment=require(_0xe78c('0x1'));var BPromise=require(_0xe78c('0x2'));var rp=require(_0xe78c('0x3'));var fs=require('fs');var path=require(_0xe78c('0x4'));var rimraf=require(_0xe78c('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0xe78c('0x6')]=function(_0x1e76fb,_0x288d17){return _0x1e76fb[_0xe78c('0x7')](_0xe78c('0x8'),attributes,{'tableName':_0xe78c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ac46b,_0x1ba1a2,_0x5188d4){if(_0x2ac46b[_0xe78c('0xa')]('closed')){_0x2ac46b[_0xe78c('0xb')]=moment()[_0xe78c('0xc')](_0xe78c('0xd'));}_0x5188d4(null,_0x2ac46b);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index bc76466..98e2b8f 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 _0xf2a7=['UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','debug','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0xf2a7,0xde));var _0x7f2a=function(_0x43c9da,_0x5695b1){_0x43c9da=_0x43c9da-0x0;var _0x1b883f=_0xf2a7[_0x43c9da];return _0x1b883f;};'use strict';var _=require('lodash');var util=require(_0x7f2a('0x0'));var moment=require(_0x7f2a('0x1'));var BPromise=require(_0x7f2a('0x2'));var rs=require(_0x7f2a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f2a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7f2a('0x5'));var config=require(_0x7f2a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7f2a('0x7')][_0x7f2a('0x8')]({'port':0x232a});config['redis']=_[_0x7f2a('0x9')](config['redis'],{'host':_0x7f2a('0xa'),'port':0x18eb});var socket=require(_0x7f2a('0xb'))(new Redis(config['redis']));require(_0x7f2a('0xc'))[_0x7f2a('0xd')](socket);function respondWithRpcPromise(_0x38fa56,_0x182e3a,_0x50691c){return new BPromise(function(_0x4e766e,_0x24b244){return client['request'](_0x38fa56,_0x50691c)[_0x7f2a('0xe')](function(_0x542ecd){logger[_0x7f2a('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x182e3a,'request\x20sent');logger['debug'](_0x7f2a('0x10'),_0x182e3a,_0x7f2a('0x11'),JSON['stringify'](_0x542ecd));if(_0x542ecd['error']){if(_0x542ecd[_0x7f2a('0x12')][_0x7f2a('0x13')]===0x1f4){logger['error'](_0x7f2a('0x14'),_0x182e3a,_0x542ecd[_0x7f2a('0x12')][_0x7f2a('0x15')]);return _0x24b244(_0x542ecd[_0x7f2a('0x12')][_0x7f2a('0x15')]);}logger[_0x7f2a('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x182e3a,_0x542ecd[_0x7f2a('0x12')]['message']);return _0x4e766e(_0x542ecd['error'][_0x7f2a('0x15')]);}else{logger[_0x7f2a('0xf')](_0x7f2a('0x14'),_0x182e3a,_0x7f2a('0x11'));_0x4e766e(_0x542ecd[_0x7f2a('0x16')]['message']);}})[_0x7f2a('0x17')](function(_0x2cd5b7){logger[_0x7f2a('0x12')](_0x7f2a('0x14'),_0x182e3a,_0x2cd5b7);_0x24b244(_0x2cd5b7);});});}exports[_0x7f2a('0x18')]=function(_0x59a1fd){var _0x45b18f=this;return new Promise(function(_0x6a4f40,_0x34a983){return db[_0x7f2a('0x19')][_0x7f2a('0x1a')](_0x59a1fd[_0x7f2a('0x1b')],{'raw':_0x59a1fd[_0x7f2a('0x1c')]?_0x59a1fd[_0x7f2a('0x1c')][_0x7f2a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59a1fd[_0x7f2a('0x1c')]?_0x59a1fd['options'][_0x7f2a('0x1e')]||null:null,'attributes':_0x59a1fd[_0x7f2a('0x1c')]?_0x59a1fd[_0x7f2a('0x1c')][_0x7f2a('0x1f')]||null:null,'limit':_0x59a1fd[_0x7f2a('0x1c')]?_0x59a1fd['options'][_0x7f2a('0x20')]||null:null})[_0x7f2a('0xe')](function(_0x3b90b4){logger['info'](_0x7f2a('0x18'),_0x59a1fd);logger['debug'](_0x7f2a('0x18'),_0x59a1fd,JSON['stringify'](_0x3b90b4));_0x6a4f40(_0x3b90b4);})[_0x7f2a('0x17')](function(_0xecd7d5){logger['error'](_0x7f2a('0x18'),_0xecd7d5['message'],_0x59a1fd);_0x34a983(_0x45b18f['error'](0x1f4,_0xecd7d5[_0x7f2a('0x15')]));});});};exports[_0x7f2a('0x21')]=function(_0x2be836){return new Promise(function(_0x77e3e,_0x2a5d35){return db[_0x7f2a('0x19')][_0x7f2a('0x22')]({'where':_0x2be836[_0x7f2a('0x1c')]?_0x2be836[_0x7f2a('0x1c')][_0x7f2a('0x1e')]||null:null})[_0x7f2a('0xe')](function(_0x3f4bd3){if(_0x3f4bd3){return _0x3f4bd3[_0x7f2a('0x23')](_0x2be836['body'][_0x7f2a('0x24')],_[_0x7f2a('0x25')](_0x2be836[_0x7f2a('0x1b')],[_0x7f2a('0x24'),'id'])||{});}})[_0x7f2a('0x26')](function(_0x17fadc){logger['info'](_0x7f2a('0x27'),_0x2be836);logger[_0x7f2a('0x28')](_0x7f2a('0x27'),_0x2be836,JSON['stringify'](_0x17fadc));_0x77e3e(_0x17fadc);})['catch'](function(_0x547aa0){logger[_0x7f2a('0x12')](_0x7f2a('0x27'),_0x547aa0[_0x7f2a('0x15')],_0x2be836);_0x2a5d35(_this['error'](0x1f4,_0x547aa0[_0x7f2a('0x15')]));});});}; \ No newline at end of file +var _0x3441=['lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','info','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','catch','WhatsappInteraction','update','body','options','raw','where','attributes','then','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','ids','omit','AddTags','debug'];(function(_0x35ebcd,_0x46354b){var _0x304ea6=function(_0x3d13cb){while(--_0x3d13cb){_0x35ebcd['push'](_0x35ebcd['shift']());}};_0x304ea6(++_0x46354b);}(_0x3441,0x140));var _0x1344=function(_0x17777a,_0x31b31d){_0x17777a=_0x17777a-0x0;var _0x2c89f6=_0x3441[_0x17777a];return _0x2c89f6;};'use strict';var _=require(_0x1344('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1344('0x1'));var rs=require(_0x1344('0x2'));var fs=require('fs');var Redis=require(_0x1344('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1344('0x4'));var logger=require(_0x1344('0x5'))('rpc');var config=require(_0x1344('0x6'));var jayson=require(_0x1344('0x7'));var client=jayson[_0x1344('0x8')][_0x1344('0x9')]({'port':0x232a});config['redis']=_[_0x1344('0xa')](config[_0x1344('0xb')],{'host':_0x1344('0xc'),'port':0x18eb});var socket=require(_0x1344('0xd'))(new Redis(config[_0x1344('0xb')]));require(_0x1344('0xe'))[_0x1344('0xf')](socket);function respondWithRpcPromise(_0xc89415,_0x473cec,_0x5c60ff){return new BPromise(function(_0x2ff267,_0xe29822){return client['request'](_0xc89415,_0x5c60ff)['then'](function(_0x3f6b73){logger[_0x1344('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x473cec,'request\x20sent');logger['debug'](_0x1344('0x11'),_0x473cec,_0x1344('0x12'),JSON[_0x1344('0x13')](_0x3f6b73));if(_0x3f6b73[_0x1344('0x14')]){if(_0x3f6b73[_0x1344('0x14')][_0x1344('0x15')]===0x1f4){logger[_0x1344('0x14')](_0x1344('0x16'),_0x473cec,_0x3f6b73['error'][_0x1344('0x17')]);return _0xe29822(_0x3f6b73['error'][_0x1344('0x17')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x473cec,_0x3f6b73[_0x1344('0x14')][_0x1344('0x17')]);return _0x2ff267(_0x3f6b73['error'][_0x1344('0x17')]);}else{logger[_0x1344('0x10')](_0x1344('0x16'),_0x473cec,_0x1344('0x12'));_0x2ff267(_0x3f6b73['result'][_0x1344('0x17')]);}})[_0x1344('0x18')](function(_0x57cba9){logger['error'](_0x1344('0x16'),_0x473cec,_0x57cba9);_0xe29822(_0x57cba9);});});}exports['UpdateWhatsappInteraction']=function(_0x5a5f6b){var _0x94e0c2=this;return new Promise(function(_0x393ff9,_0x48cac9){return db[_0x1344('0x19')][_0x1344('0x1a')](_0x5a5f6b[_0x1344('0x1b')],{'raw':_0x5a5f6b[_0x1344('0x1c')]?_0x5a5f6b[_0x1344('0x1c')][_0x1344('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a5f6b['options']?_0x5a5f6b['options'][_0x1344('0x1e')]||null:null,'attributes':_0x5a5f6b[_0x1344('0x1c')]?_0x5a5f6b[_0x1344('0x1c')][_0x1344('0x1f')]||null:null,'limit':_0x5a5f6b['options']?_0x5a5f6b[_0x1344('0x1c')]['limit']||null:null})[_0x1344('0x20')](function(_0x450ec6){logger['info'](_0x1344('0x21'),_0x5a5f6b);logger['debug']('UpdateWhatsappInteraction',_0x5a5f6b,JSON[_0x1344('0x13')](_0x450ec6));_0x393ff9(_0x450ec6);})['catch'](function(_0x51f467){logger['error'](_0x1344('0x21'),_0x51f467[_0x1344('0x17')],_0x5a5f6b);_0x48cac9(_0x94e0c2['error'](0x1f4,_0x51f467[_0x1344('0x17')]));});});};exports[_0x1344('0x22')]=function(_0x303eba){return new Promise(function(_0x125493,_0x143c2b){return db['WhatsappInteraction'][_0x1344('0x23')]({'where':_0x303eba[_0x1344('0x1c')]?_0x303eba['options'][_0x1344('0x1e')]||null:null})[_0x1344('0x20')](function(_0x25ac69){if(_0x25ac69){return _0x25ac69['addTags'](_0x303eba[_0x1344('0x1b')][_0x1344('0x24')],_[_0x1344('0x25')](_0x303eba[_0x1344('0x1b')],['ids','id'])||{});}})['spread'](function(_0x1b594b){logger[_0x1344('0x10')](_0x1344('0x26'),_0x303eba);logger[_0x1344('0x27')](_0x1344('0x26'),_0x303eba,JSON[_0x1344('0x13')](_0x1b594b));_0x125493(_0x1b594b);})[_0x1344('0x18')](function(_0x5eb145){logger[_0x1344('0x14')](_0x1344('0x26'),_0x5eb145[_0x1344('0x17')],_0x303eba);_0x143c2b(_this[_0x1344('0x14')](0x1f4,_0x5eb145[_0x1344('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 8f16ece..65e5b82 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 _0x0e39=['update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0e39,0x180));var _0x90e3=function(_0x28b4cd,_0x573ff1){_0x28b4cd=_0x28b4cd-0x0;var _0x4229cc=_0x0e39[_0x28b4cd];return _0x4229cc;};'use strict';var WhatsappInteractionEvents=require(_0x90e3('0x0'));var events=[_0x90e3('0x1'),_0x90e3('0x2'),_0x90e3('0x3')];function createListener(_0x30c3c7,_0x3abe0e){return function(_0x2a398a){_0x3abe0e[_0x90e3('0x4')](_0x30c3c7,_0x2a398a);};}function removeListener(_0x5b504f,_0x5972ac){return function(){WhatsappInteractionEvents[_0x90e3('0x5')](_0x5b504f,_0x5972ac);};}exports[_0x90e3('0x6')]=function(_0x36e8a1){for(var _0x326f45=0x0,_0x328b7c=events[_0x90e3('0x7')];_0x326f45<_0x328b7c;_0x326f45++){var _0x17e689=events[_0x326f45];var _0x330d4c=createListener(_0x90e3('0x8')+_0x17e689,_0x36e8a1);WhatsappInteractionEvents['on'](_0x17e689,_0x330d4c);}}; \ No newline at end of file +var _0x764c=['removeListener','whatsappInteraction:','save','remove','update','emit'];(function(_0x4e3d98,_0x17bcec){var _0x55af31=function(_0x2c1dec){while(--_0x2c1dec){_0x4e3d98['push'](_0x4e3d98['shift']());}};_0x55af31(++_0x17bcec);}(_0x764c,0x14c));var _0xc764=function(_0x7059ec,_0x601a20){_0x7059ec=_0x7059ec-0x0;var _0x40978f=_0x764c[_0x7059ec];return _0x40978f;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xc764('0x0'),_0xc764('0x1'),_0xc764('0x2')];function createListener(_0x47db20,_0x2bc0e2){return function(_0x298baf){_0x2bc0e2[_0xc764('0x3')](_0x47db20,_0x298baf);};}function removeListener(_0x27f141,_0x4fff34){return function(){WhatsappInteractionEvents[_0xc764('0x4')](_0x27f141,_0x4fff34);};}exports['register']=function(_0x4acd04){for(var _0x32cc3=0x0,_0x395d2a=events['length'];_0x32cc3<_0x395d2a;_0x32cc3++){var _0x3961dc=events[_0x32cc3];var _0x1c6929=createListener(_0xc764('0x5')+_0x3961dc,_0x4acd04);WhatsappInteractionEvents['on'](_0x3961dc,_0x1c6929);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 073af10..624c886 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 _0x39ac=['isAuthenticated','/describe','/:id','show','post','whatsapp','whatsappmessage:create','/:id/status','status','update','accept','put','reject','delete','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x39ac,0x195));var _0xc39a=function(_0x35bdab,_0x28a695){_0x35bdab=_0x35bdab-0x0;var _0xbe96b0=_0x39ac[_0x35bdab];return _0xbe96b0;};'use strict';var multer=require('multer');var util=require(_0xc39a('0x0'));var path=require(_0xc39a('0x1'));var timeout=require(_0xc39a('0x2'));var express=require(_0xc39a('0x3'));var router=express['Router']();var fs_extra=require(_0xc39a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc39a('0x5'));var config=require(_0xc39a('0x6'));var controller=require(_0xc39a('0x7'));router[_0xc39a('0x8')]('/',auth[_0xc39a('0x9')](),controller['index']);router[_0xc39a('0x8')](_0xc39a('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xc39a('0x8')](_0xc39a('0xb'),auth['isAuthenticated'](),controller[_0xc39a('0xc')]);router[_0xc39a('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xc39a('0xe'),_0xc39a('0xf')),controller['create']);router['post'](_0xc39a('0x10'),controller[_0xc39a('0x11')]);router['put'](_0xc39a('0xb'),auth['isAuthenticated'](),controller[_0xc39a('0x12')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0xc39a('0x13')]);router[_0xc39a('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0xc39a('0x15')]);router[_0xc39a('0x16')](_0xc39a('0xb'),auth[_0xc39a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x12fc=['tracked','whatsapp','create','/:id/status','status','put','/:id','/:id/accept','/:id/reject','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','show','post'];(function(_0x4b9ef3,_0x5990ef){var _0x1b89ee=function(_0x209211){while(--_0x209211){_0x4b9ef3['push'](_0x4b9ef3['shift']());}};_0x1b89ee(++_0x5990ef);}(_0x12fc,0xcb));var _0xc12f=function(_0x35d8ae,_0x1cfd5f){_0x35d8ae=_0x35d8ae-0x0;var _0x160f0b=_0x12fc[_0x35d8ae];return _0x160f0b;};'use strict';var multer=require(_0xc12f('0x0'));var util=require(_0xc12f('0x1'));var path=require('path');var timeout=require(_0xc12f('0x2'));var express=require(_0xc12f('0x3'));var router=express['Router']();var fs_extra=require(_0xc12f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc12f('0x5'));var controller=require(_0xc12f('0x6'));router[_0xc12f('0x7')]('/',auth[_0xc12f('0x8')](),controller['index']);router['get'](_0xc12f('0x9'),auth[_0xc12f('0x8')](),controller[_0xc12f('0xa')]);router[_0xc12f('0x7')]('/:id',auth[_0xc12f('0x8')](),controller[_0xc12f('0xb')]);router[_0xc12f('0xc')]('/',auth['isAuthenticated'](),interaction[_0xc12f('0xd')](_0xc12f('0xe'),'whatsappmessage:create'),controller[_0xc12f('0xf')]);router['post'](_0xc12f('0x10'),controller[_0xc12f('0x11')]);router[_0xc12f('0x12')](_0xc12f('0x13'),auth[_0xc12f('0x8')](),controller['update']);router[_0xc12f('0x12')](_0xc12f('0x14'),auth['isAuthenticated'](),controller['accept']);router[_0xc12f('0x12')](_0xc12f('0x15'),auth[_0xc12f('0x8')](),controller['reject']);router[_0xc12f('0x16')]('/:id',auth[_0xc12f('0x8')](),controller[_0xc12f('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 3f3f82c..1f68a15 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 _0x85c6=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT','medium'];(function(_0x2b85ac,_0x4d9411){var _0x37e1b7=function(_0x289077){while(--_0x289077){_0x2b85ac['push'](_0x2b85ac['shift']());}};_0x37e1b7(++_0x4d9411);}(_0x85c6,0x7d));var _0x685c=function(_0x446bdf,_0x45279f){_0x446bdf=_0x446bdf-0x0;var _0x201a7d=_0x85c6[_0x446bdf];return _0x201a7d;};'use strict';var Sequelize=require(_0x685c('0x0'));module['exports']={'body':{'type':Sequelize[_0x685c('0x1')](_0x685c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x685c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x685c('0x4')]('in',_0x685c('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x685c('0x6')](0xbe)},'phone':{'type':Sequelize[_0x685c('0x6')]},'readAt':{'type':Sequelize[_0x685c('0x7')]},'secret':{'type':Sequelize[_0x685c('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x685c('0x1')]}}; \ No newline at end of file +var _0x12e8=['medium','BOOLEAN','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x151e0e,_0x126c83){var _0x1fd348=function(_0x117865){while(--_0x117865){_0x151e0e['push'](_0x151e0e['shift']());}};_0x1fd348(++_0x126c83);}(_0x12e8,0x195));var _0x812e=function(_0x5b866f,_0x16d3ee){_0x5b866f=_0x5b866f-0x0;var _0x1568f3=_0x12e8[_0x5b866f];return _0x1568f3;};'use strict';var Sequelize=require(_0x812e('0x0'));module[_0x812e('0x1')]={'body':{'type':Sequelize[_0x812e('0x2')](_0x812e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x812e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x812e('0x5')),'defaultValue':_0x812e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x812e('0x6')](0xbe)},'phone':{'type':Sequelize[_0x812e('0x6')]},'readAt':{'type':Sequelize[_0x812e('0x7')]},'secret':{'type':Sequelize[_0x812e('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x812e('0x6')]},'providerResponse':{'type':Sequelize[_0x812e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 9098a94..2d76689 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 _0x80ac=['filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','create','body','find','describe','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','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/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','end','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','sendStatus','stack','name','index','map','WhatsappMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x4a0d2d,_0x596e5b){var _0x4b6dbc=function(_0x50e078){while(--_0x50e078){_0x4a0d2d['push'](_0x4a0d2d['shift']());}};_0x4b6dbc(++_0x596e5b);}(_0x80ac,0x1f3));var _0xc80a=function(_0x355d82,_0x52ae7a){_0x355d82=_0x355d82-0x0;var _0x307fef=_0x80ac[_0x355d82];return _0x307fef;};'use strict';var emlformat=require(_0xc80a('0x0'));var rimraf=require(_0xc80a('0x1'));var zipdir=require(_0xc80a('0x2'));var jsonpatch=require(_0xc80a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc80a('0x4'));var util=require(_0xc80a('0x5'));var path=require(_0xc80a('0x6'));var sox=require(_0xc80a('0x7'));var csv=require(_0xc80a('0x8'));var ejs=require(_0xc80a('0x9'));var fs=require('fs');var fs_extra=require(_0xc80a('0xa'));var _=require(_0xc80a('0xb'));var squel=require(_0xc80a('0xc'));var crypto=require(_0xc80a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc80a('0xe'));var toCsv=require(_0xc80a('0x8'));var querystring=require(_0xc80a('0xf'));var Papa=require(_0xc80a('0x10'));var Redis=require(_0xc80a('0x11'));var authService=require(_0xc80a('0x12'));var qs=require(_0xc80a('0x13'));var as=require(_0xc80a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc80a('0x15'))('api');var utils=require(_0xc80a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc80a('0x17'));var db=require(_0xc80a('0x18'))['db'];config[_0xc80a('0x19')]=_[_0xc80a('0x1a')](config[_0xc80a('0x19')],{'host':_0xc80a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc80a('0x1c'))[_0xc80a('0x1d')](socket);var jayson=require(_0xc80a('0x1e'));var client=jayson[_0xc80a('0x1f')][_0xc80a('0x20')]({'port':0x232c});var client9002=jayson[_0xc80a('0x1f')][_0xc80a('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x54ff82,_0x9c1b,_0x5f0182,_0x42a911){return new BPromise(function(_0x229ada,_0x897b40){var _0x22d7cd=_0x42a911||client;return _0x22d7cd[_0xc80a('0x21')](_0x54ff82,_0x5f0182)[_0xc80a('0x22')](function(_0x2aab90){logger[_0xc80a('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x9c1b,'request\x20sent');logger[_0xc80a('0x24')](_0xc80a('0x25'),_0x9c1b,_0xc80a('0x26'),JSON[_0xc80a('0x27')](_0x2aab90));if(_0x2aab90[_0xc80a('0x28')]){if(_0x2aab90[_0xc80a('0x28')][_0xc80a('0x29')]===0x1f4){logger[_0xc80a('0x28')](_0xc80a('0x2a'),_0x9c1b,_0x2aab90[_0xc80a('0x28')][_0xc80a('0x2b')]);return _0x897b40(_0x2aab90[_0xc80a('0x28')][_0xc80a('0x2b')]);}logger[_0xc80a('0x28')](_0xc80a('0x2a'),_0x9c1b,_0x2aab90[_0xc80a('0x28')][_0xc80a('0x2b')]);return _0x229ada(_0x2aab90['error'][_0xc80a('0x2b')]);}else{logger[_0xc80a('0x23')](_0xc80a('0x2a'),_0x9c1b,'request\x20sent');_0x229ada(_0x2aab90[_0xc80a('0x2c')][_0xc80a('0x2b')]);}})[_0xc80a('0x2d')](function(_0x447712){logger[_0xc80a('0x28')](_0xc80a('0x2a'),_0x9c1b,_0x447712);_0x897b40(_0x447712);});});}function respondWithStatusCode(_0x5a118c,_0x4b5b24){_0x4b5b24=_0x4b5b24||0xcc;return function(_0x3d0571){if(_0x3d0571){return _0x5a118c['sendStatus'](_0x4b5b24);}return _0x5a118c['status'](_0x4b5b24)[_0xc80a('0x2e')]();};}function respondWithResult(_0x259ee8,_0x554e64){_0x554e64=_0x554e64||0xc8;return function(_0x2b2483){if(_0x2b2483){return _0x259ee8[_0xc80a('0x2f')](_0x554e64)[_0xc80a('0x30')](_0x2b2483);}};}function respondWithFilteredResult(_0xf95530,_0xf40e3d){return function(_0x1ad52b){if(_0x1ad52b){var _0x22c580=typeof _0xf40e3d[_0xc80a('0x31')]===_0xc80a('0x32')&&typeof _0xf40e3d[_0xc80a('0x33')]==='undefined';var _0x182a9d=_0x1ad52b[_0xc80a('0x34')];var _0x4f638a=_0x22c580?0x0:_0xf40e3d[_0xc80a('0x31')];var _0x51e559=_0x22c580?_0x1ad52b[_0xc80a('0x34')]:_0xf40e3d[_0xc80a('0x31')]+_0xf40e3d[_0xc80a('0x33')];var _0x38ebb8;if(_0x51e559>=_0x182a9d){_0x51e559=_0x182a9d;_0x38ebb8=0xc8;}else{_0x38ebb8=0xce;}_0xf95530['status'](_0x38ebb8);return _0xf95530[_0xc80a('0x35')]('Content-Range',_0x4f638a+'-'+_0x51e559+'/'+_0x182a9d)[_0xc80a('0x30')](_0x1ad52b);}return null;};}function patchUpdates(_0x4c3acb){return function(_0x1578b0){try{jsonpatch[_0xc80a('0x36')](_0x1578b0,_0x4c3acb,!![]);}catch(_0x57c7ab){return BPromise['reject'](_0x57c7ab);}return _0x1578b0[_0xc80a('0x37')]();};}function saveUpdates(_0x126898,_0xee7a7f){return function(_0x12319e){if(_0x12319e){return _0x12319e[_0xc80a('0x38')](_0x126898)[_0xc80a('0x22')](function(_0x54b390){return _0x54b390;});}return null;};}function removeEntity(_0x1987cd,_0x4fd7c9){return function(_0x570b44){if(_0x570b44){return _0x570b44[_0xc80a('0x39')]()[_0xc80a('0x22')](function(){_0x1987cd[_0xc80a('0x2f')](0xcc)[_0xc80a('0x2e')]();});}};}function handleEntityNotFound(_0x39ed54,_0x3bae77){return function(_0x26930a){if(!_0x26930a){_0x39ed54[_0xc80a('0x3a')](0x194);}return _0x26930a;};}function handleError(_0x39a15a,_0x26b21e){_0x26b21e=_0x26b21e||0x1f4;return function(_0xe9fc0){logger[_0xc80a('0x28')](_0xe9fc0[_0xc80a('0x3b')]);if(_0xe9fc0[_0xc80a('0x3c')]){delete _0xe9fc0['name'];}_0x39a15a['status'](_0x26b21e)['send'](_0xe9fc0);};}exports[_0xc80a('0x3d')]=function(_0x1535d8,_0x41db2a){var _0x57cb3a={},_0xb878e1={},_0x3b7027={'count':0x0,'rows':[]};var _0x1b4028=_[_0xc80a('0x3e')](db[_0xc80a('0x3f')]['rawAttributes'],function(_0x51862c){return{'name':_0x51862c[_0xc80a('0x40')],'type':_0x51862c[_0xc80a('0x41')][_0xc80a('0x42')]};});_0xb878e1[_0xc80a('0x43')]=_[_0xc80a('0x3e')](_0x1b4028,_0xc80a('0x3c'));_0xb878e1[_0xc80a('0x44')]=_[_0xc80a('0x45')](_0x1535d8[_0xc80a('0x44')]);_0xb878e1['filters']=_[_0xc80a('0x46')](_0xb878e1[_0xc80a('0x43')],_0xb878e1[_0xc80a('0x44')]);_0x57cb3a[_0xc80a('0x47')]=_[_0xc80a('0x46')](_0xb878e1[_0xc80a('0x43')],qs[_0xc80a('0x48')](_0x1535d8['query'][_0xc80a('0x48')]));_0x57cb3a[_0xc80a('0x47')]=_0x57cb3a['attributes'][_0xc80a('0x49')]?_0x57cb3a[_0xc80a('0x47')]:_0xb878e1[_0xc80a('0x43')];if(!_0x1535d8[_0xc80a('0x44')][_0xc80a('0x4a')](_0xc80a('0x4b'))){_0x57cb3a[_0xc80a('0x33')]=qs[_0xc80a('0x33')](_0x1535d8[_0xc80a('0x44')]['limit']);_0x57cb3a[_0xc80a('0x31')]=qs[_0xc80a('0x31')](_0x1535d8[_0xc80a('0x44')]['offset']);}_0x57cb3a[_0xc80a('0x4c')]=qs[_0xc80a('0x4d')](_0x1535d8['query'][_0xc80a('0x4d')]);_0x57cb3a[_0xc80a('0x4e')]=qs[_0xc80a('0x4f')](_[_0xc80a('0x50')](_0x1535d8[_0xc80a('0x44')],_0xb878e1[_0xc80a('0x4f')]),_0x1b4028);if(_0x1535d8[_0xc80a('0x44')][_0xc80a('0x51')]){_0x57cb3a[_0xc80a('0x4e')]=_[_0xc80a('0x52')](_0x57cb3a[_0xc80a('0x4e')],{'$or':_[_0xc80a('0x3e')](_0x1b4028,function(_0x2b0f31){if(_0x2b0f31[_0xc80a('0x41')]!==_0xc80a('0x53')){var _0x211d05={};_0x211d05[_0x2b0f31[_0xc80a('0x3c')]]={'$like':'%'+_0x1535d8[_0xc80a('0x44')][_0xc80a('0x51')]+'%'};return _0x211d05;}})});}_0x57cb3a=_[_0xc80a('0x52')]({},_0x57cb3a,_0x1535d8[_0xc80a('0x54')]);var _0x2e436d={'where':_0x57cb3a['where']};return db[_0xc80a('0x3f')][_0xc80a('0x34')](_0x2e436d)[_0xc80a('0x22')](function(_0x55da21){_0x3b7027['count']=_0x55da21;if(_0x1535d8[_0xc80a('0x44')][_0xc80a('0x55')]){_0x57cb3a[_0xc80a('0x56')]=[{'all':!![]}];}return db[_0xc80a('0x3f')]['findAll'](_0x57cb3a);})['then'](function(_0xc86aea){_0x3b7027[_0xc80a('0x57')]=_0xc86aea;return _0x3b7027;})[_0xc80a('0x22')](respondWithFilteredResult(_0x41db2a,_0x57cb3a))[_0xc80a('0x2d')](handleError(_0x41db2a,null));};exports[_0xc80a('0x58')]=function(_0x3e963e,_0x1d7175){var _0x1275f0={'raw':!![],'where':{'id':_0x3e963e[_0xc80a('0x59')]['id']}},_0x5c2ad1={};_0x5c2ad1[_0xc80a('0x43')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x5c2ad1[_0xc80a('0x44')]=_[_0xc80a('0x45')](_0x3e963e[_0xc80a('0x44')]);_0x5c2ad1[_0xc80a('0x4f')]=_[_0xc80a('0x46')](_0x5c2ad1[_0xc80a('0x43')],_0x5c2ad1[_0xc80a('0x44')]);_0x1275f0[_0xc80a('0x47')]=_['intersection'](_0x5c2ad1['model'],qs[_0xc80a('0x48')](_0x3e963e['query'][_0xc80a('0x48')]));_0x1275f0['attributes']=_0x1275f0[_0xc80a('0x47')]['length']?_0x1275f0['attributes']:_0x5c2ad1[_0xc80a('0x43')];if(_0x3e963e[_0xc80a('0x44')][_0xc80a('0x55')]){_0x1275f0[_0xc80a('0x56')]=[{'all':!![]}];}_0x1275f0=_['merge']({},_0x1275f0,_0x3e963e[_0xc80a('0x54')]);return db[_0xc80a('0x3f')]['find'](_0x1275f0)[_0xc80a('0x22')](handleEntityNotFound(_0x1d7175,null))['then'](respondWithResult(_0x1d7175,null))[_0xc80a('0x2d')](handleError(_0x1d7175,null));};exports[_0xc80a('0x5a')]=function(_0x3b6353,_0x1ecefe){return db[_0xc80a('0x3f')][_0xc80a('0x5a')](_0x3b6353[_0xc80a('0x5b')],{})[_0xc80a('0x22')](respondWithResult(_0x1ecefe,0xc9))[_0xc80a('0x2d')](handleError(_0x1ecefe,null));};exports[_0xc80a('0x38')]=function(_0x43f8dd,_0x33850a){if(_0x43f8dd['body']['id']){delete _0x43f8dd['body']['id'];}return db[_0xc80a('0x3f')][_0xc80a('0x5c')]({'where':{'id':_0x43f8dd[_0xc80a('0x59')]['id']}})['then'](handleEntityNotFound(_0x33850a,null))[_0xc80a('0x22')](saveUpdates(_0x43f8dd['body'],null))[_0xc80a('0x22')](respondWithResult(_0x33850a,null))[_0xc80a('0x2d')](handleError(_0x33850a,null));};exports[_0xc80a('0x39')]=function(_0x1311a5,_0x2c3ae6){return db[_0xc80a('0x3f')]['find']({'where':{'id':_0x1311a5[_0xc80a('0x59')]['id']}})[_0xc80a('0x22')](handleEntityNotFound(_0x2c3ae6,null))[_0xc80a('0x22')](removeEntity(_0x2c3ae6,null))[_0xc80a('0x2d')](handleError(_0x2c3ae6,null));};exports[_0xc80a('0x5d')]=function(_0x43429a,_0x38ab5a){return db['WhatsappMessage'][_0xc80a('0x5d')]()['then'](respondWithResult(_0x38ab5a,null))['catch'](handleError(_0x38ab5a,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xc80a('0x5e')]=function(_0x1e1148,_0x4bc1c2,_0x2fd7c3){var _0x511a77={'agent':{},'channel':_0xc80a('0x5f')};if(_0x1e1148['body']['id']){delete _0x1e1148[_0xc80a('0x5b')]['id'];}_0x1e1148[_0xc80a('0x5b')][_0xc80a('0x60')]=!![];_0x1e1148[_0xc80a('0x5b')][_0xc80a('0x61')]=moment()[_0xc80a('0x62')](_0xc80a('0x63'));_0x1e1148[_0xc80a('0x5b')][_0xc80a('0x64')]=_0x1e1148[_0xc80a('0x5b')]['UserId']||_0x1e1148['user']['id'];_0x511a77[_0xc80a('0x65')]['id']=_0x1e1148[_0xc80a('0x5b')][_0xc80a('0x64')];return db['WhatsappMessage']['find']({'where':{'id':_0x1e1148[_0xc80a('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4bc1c2,null))[_0xc80a('0x22')](saveUpdates(_0x1e1148[_0xc80a('0x5b')],null))['then'](function(_0x31701b){if(_0x31701b){_0x511a77[_0xc80a('0x2b')]=_0x31701b[_0xc80a('0x66')]({'plain':!![]});return db[_0xc80a('0x67')][_0xc80a('0x5c')]({'where':{'id':_0x31701b[_0xc80a('0x68')]}});}return null;})[_0xc80a('0x22')](handleEntityNotFound(_0x4bc1c2,null))[_0xc80a('0x22')](function(_0x5deff6){if(_0x5deff6){return _0x5deff6[_0xc80a('0x38')]({'UserId':_0x1e1148['body'][_0xc80a('0x64')],'read1stAt':_[_0xc80a('0x69')](_0x5deff6[_0xc80a('0x6a')])?moment()[_0xc80a('0x62')](_0xc80a('0x63')):undefined});}return null;})[_0xc80a('0x22')](function(_0x2daac3){if(_0x2daac3){_0x511a77[_0xc80a('0x6b')]=_0x2daac3[_0xc80a('0x66')]({'plain':!![]});interaction_log[_0xc80a('0x23')](_0xc80a('0x6c'),_0x1e1148['user']['id'],_0x1e1148[_0xc80a('0x6d')][_0xc80a('0x3c')],_0x1e1148[_0xc80a('0x6d')][_0xc80a('0x6e')],_0x511a77[_0xc80a('0x6b')]['id'],_0x1e1148[_0xc80a('0x5b')]?JSON[_0xc80a('0x27')](_0x1e1148[_0xc80a('0x5b')]):'null');return respondWithRpcPromise(_0xc80a('0x6f'),'acceptMessage',_0x511a77);}return null;})[_0xc80a('0x22')](function(_0x57b8e8){var _0x599d3c=_0xc80a('0x70')+_0x57b8e8[_0xc80a('0x2b')][_0xc80a('0x71')];return db['sequelize']['query'](_0x599d3c,{'type':db[_0xc80a('0x72')][_0xc80a('0x73')][_0xc80a('0x74')],'raw':!![]})[_0xc80a('0x22')](function(_0x45f4df){return _0x45f4df;});})[_0xc80a('0x22')](function(_0x286482){if(_0x286482){_0x511a77[_0xc80a('0x2b')][_0xc80a('0x75')]=_0x286482[0x0];if(!_0x1e1148[_0xc80a('0x5b')][_0xc80a('0x64')])return;return db[_0xc80a('0x76')]['find']({'where':{'id':_0x1e1148[_0xc80a('0x5b')]['UserId'],'role':'agent'},'attributes':['id','name',_0xc80a('0x77'),_0xc80a('0x78'),_0xc80a('0x79')],'raw':!![]});}return null;})[_0xc80a('0x22')](function(_0x115ddf){if(!_0x115ddf)return null;_0x511a77[_0xc80a('0x2b')][_0xc80a('0x65')]=_0x115ddf;return _0x511a77;})['then'](function(_0x1defc2){if(_0x1defc2){if(_0x1e1148[_0xc80a('0x5b')][_0xc80a('0x7a')]){_0x511a77[_0xc80a('0x2b')][_0xc80a('0x7b')]=util[_0xc80a('0x62')](_0xc80a('0x7c'),_0x1e1148[_0xc80a('0x6d')][_0xc80a('0x3c')]);_0x511a77['message'][_0xc80a('0x7d')]=_0x511a77['channel'];_0x511a77[_0xc80a('0x2b')][_0xc80a('0x7e')]=_0x511a77[_0xc80a('0x7d')];_0x511a77[_0xc80a('0x2b')][_0xc80a('0x7f')]='accept';return respondWithRpcPromise(_0xc80a('0x80'),'EventManager',{'event':_0xc80a('0x81'),'message':_0x511a77[_0xc80a('0x2b')]},client9002)[_0xc80a('0x22')](function(){return _0x511a77;});}return _0x511a77;}return null;})[_0xc80a('0x22')](respondWithResult(_0x4bc1c2,null))[_0xc80a('0x2d')](handleError(_0x4bc1c2,null));};var interaction_log=require(_0xc80a('0x15'))(_0xc80a('0x82'));exports['reject']=function(_0xc0507d,_0x5db210,_0x402f9d){var _0x18b16d={'agent':{},'channel':_0xc80a('0x5f')};if(_0xc0507d['body']['id']){delete _0xc0507d[_0xc80a('0x5b')]['id'];}_0xc0507d[_0xc80a('0x5b')][_0xc80a('0x64')]=_0xc0507d[_0xc80a('0x5b')][_0xc80a('0x64')]||_0xc0507d[_0xc80a('0x6d')]['id'];_0x18b16d['agent']['id']=_0xc0507d['body']['UserId'];return db['WhatsappMessage']['find']({'where':{'id':_0xc0507d[_0xc80a('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5db210,null))[_0xc80a('0x22')](function(_0x341eb5){if(_0x341eb5){_0x18b16d['message']=_0x341eb5['get']({'plain':!![]});return db[_0xc80a('0x67')][_0xc80a('0x5c')]({'where':{'id':_0x341eb5[_0xc80a('0x68')]}});}return null;})[_0xc80a('0x22')](handleEntityNotFound(_0x5db210,null))['then'](function(_0xed61bd){if(_0xed61bd){_0x18b16d[_0xc80a('0x6b')]=_0xed61bd['get']({'plain':!![]});interaction_log['info'](_0xc80a('0x83'),_0xc0507d[_0xc80a('0x6d')]['id'],_0xc0507d[_0xc80a('0x6d')]['name'],_0xc0507d[_0xc80a('0x6d')][_0xc80a('0x6e')],_0x18b16d['interaction']['id'],_0xc0507d[_0xc80a('0x5b')]?JSON[_0xc80a('0x27')](_0xc0507d['body']):_0xc80a('0x84'));return respondWithRpcPromise(_0xc80a('0x85'),_0xc80a('0x86'),_0x18b16d);}return null;})['then'](function(_0x3109d3){var _0xb294e8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3109d3['message'][_0xc80a('0x71')];return db['sequelize'][_0xc80a('0x44')](_0xb294e8,{'type':db[_0xc80a('0x72')][_0xc80a('0x73')]['SELECT'],'raw':!![]})['then'](function(_0x2c736e){return _0x2c736e;});})[_0xc80a('0x22')](function(_0x518688){if(_0x518688){_0x18b16d[_0xc80a('0x2b')]['contact']=_0x518688[0x0];if(!_0xc0507d['body']['UserId'])return;return db['User'][_0xc80a('0x5c')]({'where':{'id':_0xc0507d['body']['UserId'],'role':_0xc80a('0x65')},'attributes':['id',_0xc80a('0x3c'),_0xc80a('0x77'),_0xc80a('0x78'),_0xc80a('0x79')],'raw':!![]});}return null;})[_0xc80a('0x22')](function(_0x2f4496){if(!_0x2f4496)return null;_0x18b16d['message']['agent']=_0x2f4496;return _0x18b16d;})['then'](function(_0x21da32){if(_0x21da32){_0x21da32[_0xc80a('0x2b')][_0xc80a('0x7b')]=util[_0xc80a('0x62')](_0xc80a('0x7c'),_0xc0507d[_0xc80a('0x6d')]['name']);_0x21da32[_0xc80a('0x2b')][_0xc80a('0x7d')]=_0x18b16d['channel'];_0x21da32['message'][_0xc80a('0x7e')]=_0x18b16d['channel'];_0x21da32[_0xc80a('0x2b')][_0xc80a('0x7f')]='reject';respondWithRpcPromise('EventManager',_0xc80a('0x80'),{'event':'rejectmessage','message':_0x21da32['message']},client9002);return _0x18b16d;}return null;})['then'](respondWithResult(_0x5db210,null))[_0xc80a('0x2d')](handleError(_0x5db210,null));};exports[_0xc80a('0x2f')]=function(_0xf61297,_0x4f8079,_0x3922ee){if(_0xf61297[_0xc80a('0x5b')]['id']){delete _0xf61297[_0xc80a('0x5b')]['id'];}var _0x29928a;return db[_0xc80a('0x3f')][_0xc80a('0x5c')]({'where':{'id':_0xf61297[_0xc80a('0x59')]['id']}})[_0xc80a('0x22')](handleEntityNotFound(_0x4f8079,null))[_0xc80a('0x22')](function(_0x27ddd7){if(_0x27ddd7){_0x29928a=_0x27ddd7;return db[_0xc80a('0x87')][_0xc80a('0x5c')]({'where':{'id':_0x27ddd7[_0xc80a('0x88')]}});}})['then'](handleEntityNotFound(_0x4f8079,null))['then'](function(_0x9eb4ea){if(_0x9eb4ea){logger[_0xc80a('0x24')](_0xc80a('0x89'),_0xc80a('0x2f'),_0xc80a('0x8a'),_0x9eb4ea[_0xc80a('0x41')],util[_0xc80a('0x8b')](_0xf61297['body'],{'showHidden':![],'depth':null}));switch(_0x9eb4ea[_0xc80a('0x41')]){case _0xc80a('0x8c'):if(_0xf61297[_0xc80a('0x5b')][_0xc80a('0x8d')]&&_0xf61297['body'][_0xc80a('0x8d')]===_0x29928a[_0xc80a('0x8e')]&&_0xf61297[_0xc80a('0x5b')][_0xc80a('0x8f')]&&_0xf61297[_0xc80a('0x5b')]['MessageStatus']===_0xc80a('0x60')){return _0x29928a[_0xc80a('0x38')]({'read':!![]});}else{logger[_0xc80a('0x28')](_0xc80a('0x90'),_0xc80a('0x2f'),_0xc80a('0x8c'),util[_0xc80a('0x8b')](_0xf61297[_0xc80a('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x29928a;}})[_0xc80a('0x22')](respondWithResult(_0x4f8079,null))[_0xc80a('0x2d')](handleError(_0x4f8079,null));}; \ No newline at end of file +var _0xee9f=['query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','intersection','find','create','body','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','get','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','ContactId','sequelize','User','fullname','email','agent','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','motionChannel','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','stack','name','send','map','WhatsappMessage','key'];(function(_0x393497,_0x33484e){var _0x501af4=function(_0x44f7b5){while(--_0x44f7b5){_0x393497['push'](_0x393497['shift']());}};_0x501af4(++_0x33484e);}(_0xee9f,0x1ea));var _0xfee9=function(_0x5997cb,_0x5a8a79){_0x5997cb=_0x5997cb-0x0;var _0x4d20cd=_0xee9f[_0x5997cb];return _0x4d20cd;};'use strict';var emlformat=require(_0xfee9('0x0'));var rimraf=require(_0xfee9('0x1'));var zipdir=require(_0xfee9('0x2'));var jsonpatch=require(_0xfee9('0x3'));var rp=require(_0xfee9('0x4'));var moment=require(_0xfee9('0x5'));var BPromise=require(_0xfee9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfee9('0x7'));var sox=require(_0xfee9('0x8'));var csv=require(_0xfee9('0x9'));var ejs=require(_0xfee9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfee9('0xb'));var squel=require('squel');var crypto=require(_0xfee9('0xc'));var jsforce=require(_0xfee9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfee9('0x9'));var querystring=require('querystring');var Papa=require(_0xfee9('0xe'));var Redis=require(_0xfee9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfee9('0x10'));var as=require(_0xfee9('0x11'));var hardwareService=require(_0xfee9('0x12'));var logger=require(_0xfee9('0x13'))('api');var utils=require(_0xfee9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfee9('0x15'));var db=require(_0xfee9('0x16'))['db'];config['redis']=_[_0xfee9('0x17')](config[_0xfee9('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xfee9('0x19'))(new Redis(config[_0xfee9('0x18')]));require(_0xfee9('0x1a'))[_0xfee9('0x1b')](socket);var jayson=require(_0xfee9('0x1c'));var client=jayson['client'][_0xfee9('0x1d')]({'port':0x232c});var client9002=jayson[_0xfee9('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5262a1,_0x5739b2,_0xfda5f8,_0x4b00cb){return new BPromise(function(_0x7f2b78,_0x527212){var _0x1a3ddd=_0x4b00cb||client;return _0x1a3ddd[_0xfee9('0x1f')](_0x5262a1,_0xfda5f8)[_0xfee9('0x20')](function(_0x596c86){logger[_0xfee9('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x5739b2,_0xfee9('0x22'));logger['debug'](_0xfee9('0x23'),_0x5739b2,_0xfee9('0x22'),JSON[_0xfee9('0x24')](_0x596c86));if(_0x596c86[_0xfee9('0x25')]){if(_0x596c86['error'][_0xfee9('0x26')]===0x1f4){logger[_0xfee9('0x25')](_0xfee9('0x27'),_0x5739b2,_0x596c86['error'][_0xfee9('0x28')]);return _0x527212(_0x596c86['error']['message']);}logger[_0xfee9('0x25')](_0xfee9('0x27'),_0x5739b2,_0x596c86[_0xfee9('0x25')][_0xfee9('0x28')]);return _0x7f2b78(_0x596c86[_0xfee9('0x25')][_0xfee9('0x28')]);}else{logger[_0xfee9('0x21')](_0xfee9('0x27'),_0x5739b2,_0xfee9('0x22'));_0x7f2b78(_0x596c86[_0xfee9('0x29')][_0xfee9('0x28')]);}})[_0xfee9('0x2a')](function(_0x46846a){logger[_0xfee9('0x25')](_0xfee9('0x27'),_0x5739b2,_0x46846a);_0x527212(_0x46846a);});});}function respondWithStatusCode(_0x36c1af,_0x10e1a9){_0x10e1a9=_0x10e1a9||0xcc;return function(_0x1bbad2){if(_0x1bbad2){return _0x36c1af[_0xfee9('0x2b')](_0x10e1a9);}return _0x36c1af[_0xfee9('0x2c')](_0x10e1a9)[_0xfee9('0x2d')]();};}function respondWithResult(_0x5aadbd,_0xb4ecb7){_0xb4ecb7=_0xb4ecb7||0xc8;return function(_0xcc73dd){if(_0xcc73dd){return _0x5aadbd[_0xfee9('0x2c')](_0xb4ecb7)[_0xfee9('0x2e')](_0xcc73dd);}};}function respondWithFilteredResult(_0x365eaa,_0x1a354a){return function(_0x383059){if(_0x383059){var _0x5ab609=typeof _0x1a354a['offset']===_0xfee9('0x2f')&&typeof _0x1a354a[_0xfee9('0x30')]==='undefined';var _0x323a29=_0x383059[_0xfee9('0x31')];var _0x10f1e6=_0x5ab609?0x0:_0x1a354a[_0xfee9('0x32')];var _0x55a87e=_0x5ab609?_0x383059[_0xfee9('0x31')]:_0x1a354a[_0xfee9('0x32')]+_0x1a354a[_0xfee9('0x30')];var _0x39a665;if(_0x55a87e>=_0x323a29){_0x55a87e=_0x323a29;_0x39a665=0xc8;}else{_0x39a665=0xce;}_0x365eaa[_0xfee9('0x2c')](_0x39a665);return _0x365eaa[_0xfee9('0x33')]('Content-Range',_0x10f1e6+'-'+_0x55a87e+'/'+_0x323a29)[_0xfee9('0x2e')](_0x383059);}return null;};}function patchUpdates(_0x48a4b8){return function(_0x4081f7){try{jsonpatch[_0xfee9('0x34')](_0x4081f7,_0x48a4b8,!![]);}catch(_0x57120f){return BPromise[_0xfee9('0x35')](_0x57120f);}return _0x4081f7[_0xfee9('0x36')]();};}function saveUpdates(_0x1cb35c,_0x320b02){return function(_0x3e0ddd){if(_0x3e0ddd){return _0x3e0ddd[_0xfee9('0x37')](_0x1cb35c)[_0xfee9('0x20')](function(_0x1ccc94){return _0x1ccc94;});}return null;};}function removeEntity(_0x3d7191,_0x34b403){return function(_0x4d8f68){if(_0x4d8f68){return _0x4d8f68['destroy']()[_0xfee9('0x20')](function(){_0x3d7191['status'](0xcc)[_0xfee9('0x2d')]();});}};}function handleEntityNotFound(_0x16cf48,_0x15a35a){return function(_0x1faa88){if(!_0x1faa88){_0x16cf48[_0xfee9('0x2b')](0x194);}return _0x1faa88;};}function handleError(_0x21b7f7,_0x225b61){_0x225b61=_0x225b61||0x1f4;return function(_0x50244d){logger[_0xfee9('0x25')](_0x50244d[_0xfee9('0x38')]);if(_0x50244d[_0xfee9('0x39')]){delete _0x50244d[_0xfee9('0x39')];}_0x21b7f7[_0xfee9('0x2c')](_0x225b61)[_0xfee9('0x3a')](_0x50244d);};}exports['index']=function(_0x495d55,_0x36faae){var _0xe9766={},_0x303278={},_0x42af16={'count':0x0,'rows':[]};var _0x148e76=_[_0xfee9('0x3b')](db[_0xfee9('0x3c')]['rawAttributes'],function(_0x1aa788){return{'name':_0x1aa788['fieldName'],'type':_0x1aa788['type'][_0xfee9('0x3d')]};});_0x303278['model']=_[_0xfee9('0x3b')](_0x148e76,_0xfee9('0x39'));_0x303278[_0xfee9('0x3e')]=_[_0xfee9('0x3f')](_0x495d55[_0xfee9('0x3e')]);_0x303278[_0xfee9('0x40')]=_['intersection'](_0x303278[_0xfee9('0x41')],_0x303278['query']);_0xe9766['attributes']=_['intersection'](_0x303278[_0xfee9('0x41')],qs[_0xfee9('0x42')](_0x495d55[_0xfee9('0x3e')]['fields']));_0xe9766[_0xfee9('0x43')]=_0xe9766[_0xfee9('0x43')][_0xfee9('0x44')]?_0xe9766[_0xfee9('0x43')]:_0x303278[_0xfee9('0x41')];if(!_0x495d55[_0xfee9('0x3e')][_0xfee9('0x45')](_0xfee9('0x46'))){_0xe9766[_0xfee9('0x30')]=qs[_0xfee9('0x30')](_0x495d55[_0xfee9('0x3e')]['limit']);_0xe9766[_0xfee9('0x32')]=qs[_0xfee9('0x32')](_0x495d55[_0xfee9('0x3e')][_0xfee9('0x32')]);}_0xe9766[_0xfee9('0x47')]=qs[_0xfee9('0x48')](_0x495d55['query']['sort']);_0xe9766[_0xfee9('0x49')]=qs[_0xfee9('0x40')](_[_0xfee9('0x4a')](_0x495d55[_0xfee9('0x3e')],_0x303278[_0xfee9('0x40')]),_0x148e76);if(_0x495d55[_0xfee9('0x3e')]['filter']){_0xe9766[_0xfee9('0x49')]=_[_0xfee9('0x4b')](_0xe9766[_0xfee9('0x49')],{'$or':_[_0xfee9('0x3b')](_0x148e76,function(_0x1fe9d2){if(_0x1fe9d2[_0xfee9('0x4c')]!==_0xfee9('0x4d')){var _0x3ff7f2={};_0x3ff7f2[_0x1fe9d2['name']]={'$like':'%'+_0x495d55['query'][_0xfee9('0x4e')]+'%'};return _0x3ff7f2;}})});}_0xe9766=_[_0xfee9('0x4b')]({},_0xe9766,_0x495d55[_0xfee9('0x4f')]);var _0x24737a={'where':_0xe9766[_0xfee9('0x49')]};return db[_0xfee9('0x3c')][_0xfee9('0x31')](_0x24737a)[_0xfee9('0x20')](function(_0x586bbf){_0x42af16['count']=_0x586bbf;if(_0x495d55[_0xfee9('0x3e')][_0xfee9('0x50')]){_0xe9766[_0xfee9('0x51')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xfee9('0x52')](_0xe9766);})['then'](function(_0x103cc0){_0x42af16['rows']=_0x103cc0;return _0x42af16;})[_0xfee9('0x20')](respondWithFilteredResult(_0x36faae,_0xe9766))[_0xfee9('0x2a')](handleError(_0x36faae,null));};exports[_0xfee9('0x53')]=function(_0x2d12c7,_0x4b2501){var _0x465a2d={'raw':!![],'where':{'id':_0x2d12c7[_0xfee9('0x54')]['id']}},_0x3fa624={};_0x3fa624['model']=_[_0xfee9('0x3f')](db['WhatsappMessage'][_0xfee9('0x55')]);_0x3fa624[_0xfee9('0x3e')]=_[_0xfee9('0x3f')](_0x2d12c7[_0xfee9('0x3e')]);_0x3fa624[_0xfee9('0x40')]=_['intersection'](_0x3fa624[_0xfee9('0x41')],_0x3fa624[_0xfee9('0x3e')]);_0x465a2d['attributes']=_[_0xfee9('0x56')](_0x3fa624[_0xfee9('0x41')],qs[_0xfee9('0x42')](_0x2d12c7[_0xfee9('0x3e')][_0xfee9('0x42')]));_0x465a2d[_0xfee9('0x43')]=_0x465a2d[_0xfee9('0x43')][_0xfee9('0x44')]?_0x465a2d[_0xfee9('0x43')]:_0x3fa624['model'];if(_0x2d12c7['query'][_0xfee9('0x50')]){_0x465a2d[_0xfee9('0x51')]=[{'all':!![]}];}_0x465a2d=_['merge']({},_0x465a2d,_0x2d12c7['options']);return db[_0xfee9('0x3c')][_0xfee9('0x57')](_0x465a2d)[_0xfee9('0x20')](handleEntityNotFound(_0x4b2501,null))[_0xfee9('0x20')](respondWithResult(_0x4b2501,null))['catch'](handleError(_0x4b2501,null));};exports[_0xfee9('0x58')]=function(_0x3bb9b5,_0x249ef8){return db[_0xfee9('0x3c')][_0xfee9('0x58')](_0x3bb9b5[_0xfee9('0x59')],{})['then'](respondWithResult(_0x249ef8,0xc9))['catch'](handleError(_0x249ef8,null));};exports['update']=function(_0x550b9c,_0xa9123e){if(_0x550b9c[_0xfee9('0x59')]['id']){delete _0x550b9c[_0xfee9('0x59')]['id'];}return db[_0xfee9('0x3c')][_0xfee9('0x57')]({'where':{'id':_0x550b9c[_0xfee9('0x54')]['id']}})[_0xfee9('0x20')](handleEntityNotFound(_0xa9123e,null))['then'](saveUpdates(_0x550b9c[_0xfee9('0x59')],null))[_0xfee9('0x20')](respondWithResult(_0xa9123e,null))[_0xfee9('0x2a')](handleError(_0xa9123e,null));};exports[_0xfee9('0x5a')]=function(_0xeccb0c,_0x3f9430){return db[_0xfee9('0x3c')][_0xfee9('0x57')]({'where':{'id':_0xeccb0c[_0xfee9('0x54')]['id']}})[_0xfee9('0x20')](handleEntityNotFound(_0x3f9430,null))[_0xfee9('0x20')](removeEntity(_0x3f9430,null))['catch'](handleError(_0x3f9430,null));};exports[_0xfee9('0x5b')]=function(_0x417673,_0xb7609f){return db[_0xfee9('0x3c')]['describe']()[_0xfee9('0x20')](respondWithResult(_0xb7609f,null))[_0xfee9('0x2a')](handleError(_0xb7609f,null));};var interaction_log=require(_0xfee9('0x13'))(_0xfee9('0x5c'));exports[_0xfee9('0x5d')]=function(_0xdee70e,_0x1cd611,_0xcb70c3){var _0x6f08b2={'agent':{},'channel':_0xfee9('0x5e')};if(_0xdee70e[_0xfee9('0x59')]['id']){delete _0xdee70e[_0xfee9('0x59')]['id'];}_0xdee70e[_0xfee9('0x59')][_0xfee9('0x5f')]=!![];_0xdee70e[_0xfee9('0x59')][_0xfee9('0x60')]=moment()[_0xfee9('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0xdee70e[_0xfee9('0x59')]['UserId']=_0xdee70e[_0xfee9('0x59')][_0xfee9('0x62')]||_0xdee70e['user']['id'];_0x6f08b2['agent']['id']=_0xdee70e[_0xfee9('0x59')][_0xfee9('0x62')];return db['WhatsappMessage'][_0xfee9('0x57')]({'where':{'id':_0xdee70e[_0xfee9('0x54')]['id'],'UserId':null}})[_0xfee9('0x20')](handleEntityNotFound(_0x1cd611,null))[_0xfee9('0x20')](saveUpdates(_0xdee70e[_0xfee9('0x59')],null))[_0xfee9('0x20')](function(_0xa47fd8){if(_0xa47fd8){_0x6f08b2[_0xfee9('0x28')]=_0xa47fd8[_0xfee9('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0xfee9('0x57')]({'where':{'id':_0xa47fd8['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1cd611,null))[_0xfee9('0x20')](function(_0x2dd04a){if(_0x2dd04a){return _0x2dd04a[_0xfee9('0x37')]({'UserId':_0xdee70e['body'][_0xfee9('0x62')],'read1stAt':_[_0xfee9('0x64')](_0x2dd04a[_0xfee9('0x65')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xfee9('0x20')](function(_0x35579a){if(_0x35579a){_0x6f08b2[_0xfee9('0x66')]=_0x35579a['get']({'plain':!![]});interaction_log['info'](_0xfee9('0x67'),_0xdee70e['user']['id'],_0xdee70e[_0xfee9('0x68')]['name'],_0xdee70e['user']['role'],_0x6f08b2[_0xfee9('0x66')]['id'],_0xdee70e[_0xfee9('0x59')]?JSON['stringify'](_0xdee70e[_0xfee9('0x59')]):_0xfee9('0x69'));return respondWithRpcPromise(_0xfee9('0x6a'),_0xfee9('0x6b'),_0x6f08b2);}return null;})[_0xfee9('0x20')](function(_0x34292f){var _0x171c5e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x34292f[_0xfee9('0x28')][_0xfee9('0x6c')];return db[_0xfee9('0x6d')][_0xfee9('0x3e')](_0x171c5e,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xfee9('0x20')](function(_0x40fe6e){return _0x40fe6e;});})[_0xfee9('0x20')](function(_0x315194){if(_0x315194){_0x6f08b2['message']['contact']=_0x315194[0x0];if(!_0xdee70e[_0xfee9('0x59')][_0xfee9('0x62')])return;return db[_0xfee9('0x6e')][_0xfee9('0x57')]({'where':{'id':_0xdee70e['body']['UserId'],'role':'agent'},'attributes':['id','name',_0xfee9('0x6f'),_0xfee9('0x70'),'internal'],'raw':!![]});}return null;})[_0xfee9('0x20')](function(_0x533266){if(!_0x533266)return null;_0x6f08b2[_0xfee9('0x28')][_0xfee9('0x71')]=_0x533266;return _0x6f08b2;})[_0xfee9('0x20')](function(_0x3095f0){if(_0x3095f0){if(_0xdee70e[_0xfee9('0x59')][_0xfee9('0x72')]){_0x6f08b2[_0xfee9('0x28')][_0xfee9('0x73')]=util[_0xfee9('0x61')](_0xfee9('0x74'),_0xdee70e[_0xfee9('0x68')][_0xfee9('0x39')]);_0x6f08b2[_0xfee9('0x28')]['channel']=_0x6f08b2[_0xfee9('0x75')];_0x6f08b2[_0xfee9('0x28')]['motionChannel']=_0x6f08b2[_0xfee9('0x75')];_0x6f08b2[_0xfee9('0x28')][_0xfee9('0x76')]='accept';return respondWithRpcPromise(_0xfee9('0x77'),_0xfee9('0x77'),{'event':_0xfee9('0x78'),'message':_0x6f08b2[_0xfee9('0x28')]},client9002)[_0xfee9('0x20')](function(){return _0x6f08b2;});}return _0x6f08b2;}return null;})[_0xfee9('0x20')](respondWithResult(_0x1cd611,null))[_0xfee9('0x2a')](handleError(_0x1cd611,null));};var interaction_log=require(_0xfee9('0x13'))(_0xfee9('0x5c'));exports[_0xfee9('0x35')]=function(_0xafbf,_0x5b44f2,_0x41571d){var _0x4487d2={'agent':{},'channel':_0xfee9('0x5e')};if(_0xafbf[_0xfee9('0x59')]['id']){delete _0xafbf[_0xfee9('0x59')]['id'];}_0xafbf[_0xfee9('0x59')][_0xfee9('0x62')]=_0xafbf[_0xfee9('0x59')][_0xfee9('0x62')]||_0xafbf['user']['id'];_0x4487d2[_0xfee9('0x71')]['id']=_0xafbf[_0xfee9('0x59')]['UserId'];return db['WhatsappMessage'][_0xfee9('0x57')]({'where':{'id':_0xafbf[_0xfee9('0x54')]['id'],'UserId':null}})[_0xfee9('0x20')](handleEntityNotFound(_0x5b44f2,null))[_0xfee9('0x20')](function(_0x1cc465){if(_0x1cc465){_0x4487d2[_0xfee9('0x28')]=_0x1cc465['get']({'plain':!![]});return db['WhatsappInteraction'][_0xfee9('0x57')]({'where':{'id':_0x1cc465['WhatsappInteractionId']}});}return null;})[_0xfee9('0x20')](handleEntityNotFound(_0x5b44f2,null))[_0xfee9('0x20')](function(_0x229a49){if(_0x229a49){_0x4487d2[_0xfee9('0x66')]=_0x229a49[_0xfee9('0x63')]({'plain':!![]});interaction_log[_0xfee9('0x21')](_0xfee9('0x79'),_0xafbf['user']['id'],_0xafbf['user'][_0xfee9('0x39')],_0xafbf[_0xfee9('0x68')]['role'],_0x4487d2[_0xfee9('0x66')]['id'],_0xafbf[_0xfee9('0x59')]?JSON[_0xfee9('0x24')](_0xafbf[_0xfee9('0x59')]):_0xfee9('0x69'));return respondWithRpcPromise(_0xfee9('0x7a'),'rejectMessage',_0x4487d2);}return null;})['then'](function(_0x361cdb){var _0x41567c=_0xfee9('0x7b')+_0x361cdb['message'][_0xfee9('0x6c')];return db[_0xfee9('0x6d')]['query'](_0x41567c,{'type':db[_0xfee9('0x7c')][_0xfee9('0x7d')][_0xfee9('0x7e')],'raw':!![]})['then'](function(_0x46cbcb){return _0x46cbcb;});})[_0xfee9('0x20')](function(_0x3b3142){if(_0x3b3142){_0x4487d2[_0xfee9('0x28')][_0xfee9('0x7f')]=_0x3b3142[0x0];if(!_0xafbf[_0xfee9('0x59')]['UserId'])return;return db[_0xfee9('0x6e')][_0xfee9('0x57')]({'where':{'id':_0xafbf['body'][_0xfee9('0x62')],'role':'agent'},'attributes':['id',_0xfee9('0x39'),_0xfee9('0x6f'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x4e514e){if(!_0x4e514e)return null;_0x4487d2[_0xfee9('0x28')][_0xfee9('0x71')]=_0x4e514e;return _0x4487d2;})[_0xfee9('0x20')](function(_0x1c29d2){if(_0x1c29d2){_0x1c29d2['message'][_0xfee9('0x73')]=util[_0xfee9('0x61')]('SIP/%s',_0xafbf[_0xfee9('0x68')][_0xfee9('0x39')]);_0x1c29d2['message']['channel']=_0x4487d2[_0xfee9('0x75')];_0x1c29d2[_0xfee9('0x28')][_0xfee9('0x80')]=_0x4487d2[_0xfee9('0x75')];_0x1c29d2[_0xfee9('0x28')]['event']='reject';respondWithRpcPromise('EventManager',_0xfee9('0x77'),{'event':_0xfee9('0x81'),'message':_0x1c29d2['message']},client9002);return _0x4487d2;}return null;})[_0xfee9('0x20')](respondWithResult(_0x5b44f2,null))[_0xfee9('0x2a')](handleError(_0x5b44f2,null));};exports[_0xfee9('0x2c')]=function(_0x40942f,_0xe4f03d,_0xe9afc4){if(_0x40942f['body']['id']){delete _0x40942f[_0xfee9('0x59')]['id'];}var _0x4cb3c4;return db[_0xfee9('0x3c')][_0xfee9('0x57')]({'where':{'id':_0x40942f[_0xfee9('0x54')]['id']}})[_0xfee9('0x20')](handleEntityNotFound(_0xe4f03d,null))[_0xfee9('0x20')](function(_0x40e656){if(_0x40e656){_0x4cb3c4=_0x40e656;return db[_0xfee9('0x82')]['find']({'where':{'id':_0x40e656[_0xfee9('0x83')]}});}})[_0xfee9('0x20')](handleEntityNotFound(_0xe4f03d,null))[_0xfee9('0x20')](function(_0x158d96){if(_0x158d96){logger['debug'](_0xfee9('0x84'),'status',_0xfee9('0x85'),_0x158d96[_0xfee9('0x4c')],util['inspect'](_0x40942f[_0xfee9('0x59')],{'showHidden':![],'depth':null}));switch(_0x158d96['type']){case _0xfee9('0x86'):if(_0x40942f[_0xfee9('0x59')][_0xfee9('0x87')]&&_0x40942f['body'][_0xfee9('0x87')]===_0x4cb3c4['messageId']&&_0x40942f[_0xfee9('0x59')][_0xfee9('0x88')]&&_0x40942f['body'][_0xfee9('0x88')]===_0xfee9('0x5f')){return _0x4cb3c4[_0xfee9('0x37')]({'read':!![]});}else{logger[_0xfee9('0x25')](_0xfee9('0x89'),_0xfee9('0x2c'),_0xfee9('0x86'),util['inspect'](_0x40942f[_0xfee9('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x4cb3c4;}})[_0xfee9('0x20')](respondWithResult(_0xe4f03d,null))[_0xfee9('0x2a')](handleError(_0xe4f03d,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 99ab33a..5145111 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 _0x6599=['hasOwnProperty','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','emit'];(function(_0x9c2c88,_0x313e41){var _0xad0ee9=function(_0x13da89){while(--_0x13da89){_0x9c2c88['push'](_0x9c2c88['shift']());}};_0xad0ee9(++_0x313e41);}(_0x6599,0xb0));var _0x9659=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x6599[_0x2db12b];return _0x20990b;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x9659('0x0'))['db'][_0x9659('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x9659('0x2')](0x0);var events={'afterCreate':_0x9659('0x3'),'afterUpdate':_0x9659('0x4'),'afterDestroy':'remove'};function emitEvent(_0xb8bddb){return function(_0x5e2a8e,_0x2f5d38,_0x4fd132){WhatsappMessageEvents[_0x9659('0x5')](_0xb8bddb+':'+_0x5e2a8e['id'],_0x5e2a8e);WhatsappMessageEvents[_0x9659('0x5')](_0xb8bddb,_0x5e2a8e);_0x4fd132(null);};}for(var e in events){if(events[_0x9659('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xe9e8=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x4391ae,_0x28a681){_0x4391ae=_0x4391ae-0x0;var _0x27d85f=_0xe9e8[_0x4391ae];return _0x27d85f;};'use strict';var EventEmitter=require(_0x8e9e('0x0'));var WhatsappMessage=require(_0x8e9e('0x1'))['db'][_0x8e9e('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x8e9e('0x3')](0x0);var events={'afterCreate':_0x8e9e('0x4'),'afterUpdate':_0x8e9e('0x5'),'afterDestroy':_0x8e9e('0x6')};function emitEvent(_0x48233f){return function(_0x103d8b,_0x2a1d41,_0x1c09c6){WhatsappMessageEvents['emit'](_0x48233f+':'+_0x103d8b['id'],_0x103d8b);WhatsappMessageEvents[_0x8e9e('0x7')](_0x48233f,_0x103d8b);_0x1c09c6(null);};}for(var e in events){if(events[_0x8e9e('0x8')](e)){var event=events[e];WhatsappMessage[_0x8e9e('0x9')](e,emitEvent(event));}}module[_0x8e9e('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index ce440ce..b971f33 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 _0xf99e=['findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','/messages/','text','body','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction'];(function(_0x3a4867,_0x30516a){var _0x18d6af=function(_0x5a8b0d){while(--_0x5a8b0d){_0x3a4867['push'](_0x3a4867['shift']());}};_0x18d6af(++_0x30516a);}(_0xf99e,0xa4));var _0xef99=function(_0x12019a,_0x407485){_0x12019a=_0x12019a-0x0;var _0x49520a=_0xf99e[_0x12019a];return _0x49520a;};'use strict';var _=require(_0xef99('0x0'));var util=require(_0xef99('0x1'));var logger=require(_0xef99('0x2'))('api');var moment=require(_0xef99('0x3'));var BPromise=require(_0xef99('0x4'));var rp=require(_0xef99('0x5'));var fetch=require(_0xef99('0x6'));var fs=require('fs');var path=require(_0xef99('0x7'));var rimraf=require(_0xef99('0x8'));var config=require(_0xef99('0x9'));var attributes=require(_0xef99('0xa'));module[_0xef99('0xb')]=function(_0x35ec40,_0x39d9c0){return _0x35ec40['define'](_0xef99('0xc'),attributes,{'tableName':_0xef99('0xd'),'paranoid':![],'indexes':[{'name':_0xef99('0xe'),'fields':[_0xef99('0xe')]},{'name':_0xef99('0xf'),'fields':['body'],'type':_0xef99('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x250b7c,_0x36982e,_0x26aebd){var _0x555509=_0x35ec40['models'];var _0x53ae22=_0x250b7c[_0xef99('0x11')]({'plain':!![]});if(_0x53ae22[_0xef99('0x12')][_0xef99('0x13')]()==='in'||_0x53ae22[_0xef99('0x12')][_0xef99('0x13')]()===_0xef99('0x14')&&!_0x53ae22[_0xef99('0x15')]&&!_[_0xef99('0x16')](_0x53ae22[_0xef99('0x17')])){_0x555509[_0xef99('0x18')][_0xef99('0x19')]({'where':{'id':_0x53ae22[_0xef99('0x1a')]}})[_0xef99('0x1b')](function(_0x6cc37b){if(_0x6cc37b){_0x6cc37b[_0xef99('0x1c')]({'lastMsgAt':_0x53ae22[_0xef99('0x1d')],'lastMsgDirection':_0x53ae22[_0xef99('0x12')][_0xef99('0x13')]()});}})[_0xef99('0x1e')](function(_0x3f2d55){console[_0xef99('0x1f')](_0x3f2d55);});}if(_0x53ae22[_0xef99('0x12')]===_0xef99('0x14')&&!_0x53ae22[_0xef99('0x15')]){var _0x5fade0;_0x555509[_0xef99('0x20')][_0xef99('0x21')]({'where':{'id':_0x53ae22[_0xef99('0x22')]},'raw':!![]})[_0xef99('0x1b')](function(_0x290676){_0x5fade0=_0x290676;if(_0x5fade0&&_0x5fade0[_0xef99('0x23')]){switch(_0x5fade0[_0xef99('0x23')]){case'twilio':var _0x36f10c=require(_0xef99('0x24'));if(_0x5fade0[_0xef99('0x25')]&&_0x5fade0[_0xef99('0x26')]&&_0x5fade0['phone']){var _0x457e99=new _0x36f10c(_0x5fade0[_0xef99('0x25')],_0x5fade0[_0xef99('0x26')]);_0x457e99['messages'][_0xef99('0x27')]({'body':_0x53ae22['body'],'to':_0xef99('0x28')+_0x53ae22['phone'],'from':'whatsapp:'+_0x5fade0[_0xef99('0x29')],'statusCallback':_0x5fade0[_0xef99('0x2a')]+_0xef99('0x2b')+_0x53ae22['id']+_0xef99('0x2c')+_0x5fade0[_0xef99('0x2d')]})['then'](function(_0x36f16a){if(_0x36f16a[_0xef99('0x2e')]){return _0x250b7c[_0xef99('0x1c')]({'messageId':_0x36f16a[_0xef99('0x2e')]});}})[_0xef99('0x1e')](function(_0x2d8fc1){logger[_0xef99('0x1f')](_0xef99('0x2f'),'afterCreate',_0xef99('0x24'),util[_0xef99('0x30')](_0x2d8fc1,{'showHidden':![],'depth':null}));});}else{logger[_0xef99('0x1f')](_0xef99('0x2f'),_0xef99('0x31'),_0xef99('0x24'),_0xef99('0x32'));}break;case _0xef99('0x33'):var _0x352119=_0x5fade0[_0xef99('0x25')];var _0x2e7e80=_0x5fade0[_0xef99('0x26')];var _0xd89e94=_0x5fade0['baseUrl']+_0xef99('0x34')+_0x352119+_0xef99('0x35');var _0x2e26ef={'to':[_0x53ae22[_0xef99('0x29')]],'message':{'type':_0xef99('0x36'),'text':_0x53ae22[_0xef99('0x37')]}};var _0xa216e9={'method':'POST','uri':_0xd89e94,'headers':{'Authorization':_0xef99('0x38')+_0x2e7e80,'Content-Type':_0xef99('0x39')},'body':_0x2e26ef,'json':!![]};rp(_0xa216e9)['then'](function(_0x5644d7){if(_0x5644d7[_0xef99('0x3a')][0x0]['message_id']){return _0x250b7c['update']({'messageId':_0x5644d7[_0xef99('0x3a')][0x0][_0xef99('0x3b')]});}})[_0xef99('0x1e')](function(_0x5d2357){logger['err'](_0xef99('0x3c'),_0x5d2357);});break;}}})[_0xef99('0x3d')](function(){_0x26aebd();});}else{_0x26aebd();}}},'charset':_0xef99('0x3e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb7ec=['/status?token=','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','WhatsappInteraction','update','error','WhatsappAccount','find','then','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/'];(function(_0x5a1026,_0x8ad41c){var _0x1964a2=function(_0x3cf2d9){while(--_0x3cf2d9){_0x5a1026['push'](_0x5a1026['shift']());}};_0x1964a2(++_0x8ad41c);}(_0xb7ec,0x137));var _0xcb7e=function(_0x55d494,_0x18003e){_0x55d494=_0x55d494-0x0;var _0x194732=_0xb7ec[_0x55d494];return _0x194732;};'use strict';var _=require('lodash');var util=require(_0xcb7e('0x0'));var logger=require(_0xcb7e('0x1'))(_0xcb7e('0x2'));var moment=require(_0xcb7e('0x3'));var BPromise=require(_0xcb7e('0x4'));var rp=require('request-promise');var fetch=require(_0xcb7e('0x5'));var fs=require('fs');var path=require(_0xcb7e('0x6'));var rimraf=require(_0xcb7e('0x7'));var config=require(_0xcb7e('0x8'));var attributes=require(_0xcb7e('0x9'));module[_0xcb7e('0xa')]=function(_0xe97ce9,_0x54184e){return _0xe97ce9[_0xcb7e('0xb')]('WhatsappMessage',attributes,{'tableName':_0xcb7e('0xc'),'paranoid':![],'indexes':[{'name':_0xcb7e('0xd'),'fields':[_0xcb7e('0xd')]},{'name':'fti_whatsapp_messages','fields':[_0xcb7e('0xe')],'type':_0xcb7e('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26cd34,_0x4a709f,_0x5c7dbe){var _0x562fd9=_0xe97ce9[_0xcb7e('0x10')];var _0xbf6b6f=_0x26cd34[_0xcb7e('0x11')]({'plain':!![]});if(_0xbf6b6f[_0xcb7e('0x12')][_0xcb7e('0x13')]()==='in'||_0xbf6b6f['direction']['toLowerCase']()==='out'&&!_0xbf6b6f[_0xcb7e('0x14')]&&!_['isNil'](_0xbf6b6f[_0xcb7e('0x15')])){_0x562fd9[_0xcb7e('0x16')]['findOne']({'where':{'id':_0xbf6b6f['WhatsappInteractionId']}})['then'](function(_0x360198){if(_0x360198){_0x360198[_0xcb7e('0x17')]({'lastMsgAt':_0xbf6b6f['createdAt'],'lastMsgDirection':_0xbf6b6f[_0xcb7e('0x12')][_0xcb7e('0x13')]()});}})['catch'](function(_0x1c3cfe){console[_0xcb7e('0x18')](_0x1c3cfe);});}if(_0xbf6b6f['direction']==='out'&&!_0xbf6b6f[_0xcb7e('0x14')]){var _0x36ff9e;_0x562fd9[_0xcb7e('0x19')][_0xcb7e('0x1a')]({'where':{'id':_0xbf6b6f['WhatsappAccountId']},'raw':!![]})[_0xcb7e('0x1b')](function(_0xf265d1){_0x36ff9e=_0xf265d1;if(_0x36ff9e&&_0x36ff9e[_0xcb7e('0x1c')]){switch(_0x36ff9e[_0xcb7e('0x1c')]){case'twilio':var _0x2c3e73=require(_0xcb7e('0x1d'));if(_0x36ff9e[_0xcb7e('0x1e')]&&_0x36ff9e[_0xcb7e('0x1f')]&&_0x36ff9e[_0xcb7e('0x20')]){var _0x35e35f=new _0x2c3e73(_0x36ff9e['accountSid'],_0x36ff9e[_0xcb7e('0x1f')]);_0x35e35f[_0xcb7e('0x21')]['create']({'body':_0xbf6b6f[_0xcb7e('0xe')],'to':_0xcb7e('0x22')+_0xbf6b6f[_0xcb7e('0x20')],'from':_0xcb7e('0x22')+_0x36ff9e['phone'],'statusCallback':_0x36ff9e[_0xcb7e('0x23')]+_0xcb7e('0x24')+_0xbf6b6f['id']+_0xcb7e('0x25')+_0x36ff9e['token']})['then'](function(_0x556e2b){if(_0x556e2b[_0xcb7e('0x26')]){return _0x26cd34['update']({'messageId':_0x556e2b['sid']});}})[_0xcb7e('0x27')](function(_0x23073f){logger[_0xcb7e('0x18')](_0xcb7e('0x28'),_0xcb7e('0x29'),_0xcb7e('0x1d'),util[_0xcb7e('0x2a')](_0x23073f,{'showHidden':![],'depth':null}));});}else{logger[_0xcb7e('0x18')](_0xcb7e('0x28'),_0xcb7e('0x29'),_0xcb7e('0x1d'),_0xcb7e('0x2b'));}break;case _0xcb7e('0x2c'):var _0x593864=_0x36ff9e['accountSid'];var _0xc0102e=_0x36ff9e[_0xcb7e('0x1f')];var _0x34d51c=_0x36ff9e[_0xcb7e('0x2d')]+_0xcb7e('0x2e')+_0x593864+_0xcb7e('0x2f');var _0x211aac={'to':[_0xbf6b6f[_0xcb7e('0x20')]],'message':{'type':_0xcb7e('0x30'),'text':_0xbf6b6f[_0xcb7e('0xe')]}};var _0x3404c0={'method':_0xcb7e('0x31'),'uri':_0x34d51c,'headers':{'Authorization':_0xcb7e('0x32')+_0xc0102e,'Content-Type':_0xcb7e('0x33')},'body':_0x211aac,'json':!![]};rp(_0x3404c0)[_0xcb7e('0x1b')](function(_0x52a7b9){if(_0x52a7b9[_0xcb7e('0x34')][0x0][_0xcb7e('0x35')]){return _0x26cd34[_0xcb7e('0x17')]({'messageId':_0x52a7b9[_0xcb7e('0x34')][0x0]['message_id']});}})[_0xcb7e('0x27')](function(_0x3cb8eb){logger[_0xcb7e('0x36')](_0xcb7e('0x37'),_0x3cb8eb);});break;}}})['finally'](function(){_0x5c7dbe();});}else{_0x5c7dbe();}}},'charset':_0xcb7e('0x38'),'collate':_0xcb7e('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index db6fd85..5978366 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 _0xd469=['redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x22656e,_0x1163dc){var _0x3e4255=function(_0x200a38){while(--_0x200a38){_0x22656e['push'](_0x22656e['shift']());}};_0x3e4255(++_0x1163dc);}(_0xd469,0xc2));var _0x9d46=function(_0x22c8f0,_0x41e645){_0x22c8f0=_0x22c8f0-0x0;var _0xe8b3de=_0xd469[_0x22c8f0];return _0xe8b3de;};'use strict';var _=require(_0x9d46('0x0'));var util=require('util');var moment=require(_0x9d46('0x1'));var BPromise=require(_0x9d46('0x2'));var rs=require(_0x9d46('0x3'));var fs=require('fs');var Redis=require(_0x9d46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9d46('0x5'));var logger=require('../../config/logger')(_0x9d46('0x6'));var config=require('../../config/environment');var jayson=require(_0x9d46('0x7'));var client=jayson[_0x9d46('0x8')][_0x9d46('0x9')]({'port':0x232a});config[_0x9d46('0xa')]=_[_0x9d46('0xb')](config[_0x9d46('0xa')],{'host':_0x9d46('0xc'),'port':0x18eb});var socket=require(_0x9d46('0xd'))(new Redis(config[_0x9d46('0xa')]));require(_0x9d46('0xe'))[_0x9d46('0xf')](socket);function respondWithRpcPromise(_0x37b009,_0x41baaf,_0x5eded5){return new BPromise(function(_0x461461,_0x322eaf){return client[_0x9d46('0x10')](_0x37b009,_0x5eded5)[_0x9d46('0x11')](function(_0x4a71c0){logger[_0x9d46('0x12')](_0x9d46('0x13'),_0x41baaf,_0x9d46('0x14'));logger['debug'](_0x9d46('0x15'),_0x41baaf,_0x9d46('0x14'),JSON[_0x9d46('0x16')](_0x4a71c0));if(_0x4a71c0[_0x9d46('0x17')]){if(_0x4a71c0['error'][_0x9d46('0x18')]===0x1f4){logger[_0x9d46('0x17')](_0x9d46('0x13'),_0x41baaf,_0x4a71c0[_0x9d46('0x17')][_0x9d46('0x19')]);return _0x322eaf(_0x4a71c0[_0x9d46('0x17')][_0x9d46('0x19')]);}logger[_0x9d46('0x17')](_0x9d46('0x13'),_0x41baaf,_0x4a71c0[_0x9d46('0x17')][_0x9d46('0x19')]);return _0x461461(_0x4a71c0['error'][_0x9d46('0x19')]);}else{logger[_0x9d46('0x12')](_0x9d46('0x13'),_0x41baaf,_0x9d46('0x14'));_0x461461(_0x4a71c0[_0x9d46('0x1a')][_0x9d46('0x19')]);}})['catch'](function(_0xaee0b5){logger[_0x9d46('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x41baaf,_0xaee0b5);_0x322eaf(_0xaee0b5);});});}exports[_0x9d46('0x1b')]=function(_0x353927){var _0x364154=this;return new Promise(function(_0x5abf8f,_0x49f34d){return db[_0x9d46('0x1c')][_0x9d46('0x1d')](_0x353927[_0x9d46('0x1e')],{'raw':_0x353927[_0x9d46('0x1f')]?_0x353927[_0x9d46('0x1f')][_0x9d46('0x20')]===undefined?!![]:![]:!![]})[_0x9d46('0x11')](function(_0x53573d){logger[_0x9d46('0x12')](_0x9d46('0x1b'),_0x353927);logger[_0x9d46('0x21')](_0x9d46('0x1b'),_0x353927,JSON[_0x9d46('0x16')](_0x53573d));_0x5abf8f(_0x53573d);})['catch'](function(_0x284f3d){logger[_0x9d46('0x17')](_0x9d46('0x1b'),_0x284f3d[_0x9d46('0x19')],_0x353927);_0x49f34d(_0x364154['error'](0x1f4,_0x284f3d[_0x9d46('0x19')]));});});}; \ No newline at end of file +var _0xeaa1=['register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','create','body','options','raw','CreateWhatsappMessage','stringify','lodash','util','moment','ioredis','../../mysqldb','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket'];(function(_0x289842,_0x2d9db4){var _0x16155a=function(_0x1d0510){while(--_0x1d0510){_0x289842['push'](_0x289842['shift']());}};_0x16155a(++_0x2d9db4);}(_0xeaa1,0x8e));var _0x1eaa=function(_0x596fcb,_0x53e1bd){_0x596fcb=_0x596fcb-0x0;var _0x435bce=_0xeaa1[_0x596fcb];return _0x435bce;};'use strict';var _=require(_0x1eaa('0x0'));var util=require(_0x1eaa('0x1'));var moment=require(_0x1eaa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1eaa('0x3'));var db=require(_0x1eaa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1eaa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1eaa('0x6')][_0x1eaa('0x7')]({'port':0x232a});config[_0x1eaa('0x8')]=_[_0x1eaa('0x9')](config['redis'],{'host':_0x1eaa('0xa'),'port':0x18eb});var socket=require(_0x1eaa('0xb'))(new Redis(config['redis']));require(_0x1eaa('0xc'))[_0x1eaa('0xd')](socket);function respondWithRpcPromise(_0x4b0588,_0xda81a3,_0x55e510){return new BPromise(function(_0x152475,_0x4625cb){return client[_0x1eaa('0xe')](_0x4b0588,_0x55e510)[_0x1eaa('0xf')](function(_0x4f1de3){logger[_0x1eaa('0x10')](_0x1eaa('0x11'),_0xda81a3,'request\x20sent');logger[_0x1eaa('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xda81a3,_0x1eaa('0x13'),JSON['stringify'](_0x4f1de3));if(_0x4f1de3[_0x1eaa('0x14')]){if(_0x4f1de3[_0x1eaa('0x14')][_0x1eaa('0x15')]===0x1f4){logger[_0x1eaa('0x14')](_0x1eaa('0x11'),_0xda81a3,_0x4f1de3[_0x1eaa('0x14')][_0x1eaa('0x16')]);return _0x4625cb(_0x4f1de3[_0x1eaa('0x14')][_0x1eaa('0x16')]);}logger[_0x1eaa('0x14')](_0x1eaa('0x11'),_0xda81a3,_0x4f1de3[_0x1eaa('0x14')][_0x1eaa('0x16')]);return _0x152475(_0x4f1de3[_0x1eaa('0x14')]['message']);}else{logger[_0x1eaa('0x10')](_0x1eaa('0x11'),_0xda81a3,_0x1eaa('0x13'));_0x152475(_0x4f1de3[_0x1eaa('0x17')][_0x1eaa('0x16')]);}})[_0x1eaa('0x18')](function(_0x408c1e){logger[_0x1eaa('0x14')](_0x1eaa('0x11'),_0xda81a3,_0x408c1e);_0x4625cb(_0x408c1e);});});}exports['CreateWhatsappMessage']=function(_0x42310f){var _0xb21d1=this;return new Promise(function(_0x12b4fe,_0x3c33ad){return db['WhatsappMessage'][_0x1eaa('0x19')](_0x42310f[_0x1eaa('0x1a')],{'raw':_0x42310f[_0x1eaa('0x1b')]?_0x42310f[_0x1eaa('0x1b')][_0x1eaa('0x1c')]===undefined?!![]:![]:!![]})[_0x1eaa('0xf')](function(_0x18931f){logger['info'](_0x1eaa('0x1d'),_0x42310f);logger[_0x1eaa('0x12')](_0x1eaa('0x1d'),_0x42310f,JSON[_0x1eaa('0x1e')](_0x18931f));_0x12b4fe(_0x18931f);})['catch'](function(_0x3c66b9){logger['error']('CreateWhatsappMessage',_0x3c66b9[_0x1eaa('0x16')],_0x42310f);_0x3c33ad(_0xb21d1[_0x1eaa('0x14')](0x1f4,_0x3c66b9[_0x1eaa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 00eebbc..9b87fe4 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 _0xc312=['emit','register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xc312,0x124));var _0x2c31=function(_0x6ccabc,_0x4aa3be){_0x6ccabc=_0x6ccabc-0x0;var _0x546e7d=_0xc312[_0x6ccabc];return _0x546e7d;};'use strict';var WhatsappMessageEvents=require(_0x2c31('0x0'));var events=[_0x2c31('0x1'),_0x2c31('0x2'),_0x2c31('0x3')];function createListener(_0x347e72,_0x49a3af){return function(_0x42493d){_0x49a3af[_0x2c31('0x4')](_0x347e72,_0x42493d);};}function removeListener(_0x3694d0,_0x4367d8){return function(){WhatsappMessageEvents['removeListener'](_0x3694d0,_0x4367d8);};}exports[_0x2c31('0x5')]=function(_0x3dd247){for(var _0x2ed55d=0x0,_0x1441d6=events[_0x2c31('0x6')];_0x2ed55d<_0x1441d6;_0x2ed55d++){var _0x6eef20=events[_0x2ed55d];var _0x162573=createListener(_0x2c31('0x7')+_0x6eef20,_0x3dd247);WhatsappMessageEvents['on'](_0x6eef20,_0x162573);}}; \ No newline at end of file +var _0x36b8=['remove','update','removeListener','register','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x1ebc0f,_0x12171a){var _0x5d9cbd=function(_0x1d3bb4){while(--_0x1d3bb4){_0x1ebc0f['push'](_0x1ebc0f['shift']());}};_0x5d9cbd(++_0x12171a);}(_0x36b8,0x139));var _0x836b=function(_0x431d41,_0x512561){_0x431d41=_0x431d41-0x0;var _0x225a08=_0x36b8[_0x431d41];return _0x225a08;};'use strict';var WhatsappMessageEvents=require(_0x836b('0x0'));var events=[_0x836b('0x1'),_0x836b('0x2'),_0x836b('0x3')];function createListener(_0x4b9370,_0x52fc00){return function(_0x4b0e07){_0x52fc00['emit'](_0x4b9370,_0x4b0e07);};}function removeListener(_0x111d91,_0x451d3f){return function(){WhatsappMessageEvents[_0x836b('0x4')](_0x111d91,_0x451d3f);};}exports[_0x836b('0x5')]=function(_0x301b0d){for(var _0x27fa29=0x0,_0x39f7ee=events['length'];_0x27fa29<_0x39f7ee;_0x27fa29++){var _0x5a2828=events[_0x27fa29];var _0x40f401=createListener(_0x836b('0x6')+_0x5a2828,_0x301b0d);WhatsappMessageEvents['on'](_0x5a2828,_0x40f401);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index a69edcd..89368f5 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 _0x6666=['/:id/members','/:id/teams','post','addTeams','/:id/users','addAgents','put','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x3c5376,_0x521f1a){var _0x89b91f=function(_0x148ae1){while(--_0x148ae1){_0x3c5376['push'](_0x3c5376['shift']());}};_0x89b91f(++_0x521f1a);}(_0x6666,0x136));var _0x6666=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x6666[_0x382a62];return _0x490a25;};'use strict';var multer=require(_0x6666('0x0'));var util=require(_0x6666('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6666('0x2'));var router=express[_0x6666('0x3')]();var fs_extra=require(_0x6666('0x4'));var auth=require(_0x6666('0x5'));var interaction=require(_0x6666('0x6'));var config=require(_0x6666('0x7'));var controller=require(_0x6666('0x8'));router[_0x6666('0x9')]('/',auth[_0x6666('0xa')](),controller['index']);router['get'](_0x6666('0xb'),auth[_0x6666('0xa')](),controller[_0x6666('0xc')]);router['get'](_0x6666('0xd'),auth[_0x6666('0xa')](),controller['show']);router[_0x6666('0x9')](_0x6666('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0x6666('0x9')](_0x6666('0xf'),auth[_0x6666('0xa')](),controller['getTeams']);router['get']('/:id/users',auth[_0x6666('0xa')](),controller['getAgents']);router[_0x6666('0x10')]('/',auth[_0x6666('0xa')](),controller['create']);router['post'](_0x6666('0xf'),auth['isAuthenticated'](),controller[_0x6666('0x11')]);router[_0x6666('0x10')](_0x6666('0x12'),auth[_0x6666('0xa')](),controller[_0x6666('0x13')]);router[_0x6666('0x14')]('/:id',auth[_0x6666('0xa')](),controller[_0x6666('0x15')]);router['delete'](_0x6666('0xd'),auth[_0x6666('0xa')](),controller[_0x6666('0x16')]);router['delete']('/:id/teams',auth[_0x6666('0xa')](),controller[_0x6666('0x17')]);router[_0x6666('0x18')](_0x6666('0x12'),auth['isAuthenticated'](),controller[_0x6666('0x19')]);module[_0x6666('0x1a')]=router; \ No newline at end of file +var _0x111b=['isAuthenticated','/:id','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappQueue.controller','index'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x111b,0x1ee));var _0xb111=function(_0x497391,_0x471b68){_0x497391=_0x497391-0x0;var _0x1f88dc=_0x111b[_0x497391];return _0x1f88dc;};'use strict';var multer=require(_0xb111('0x0'));var util=require(_0xb111('0x1'));var path=require(_0xb111('0x2'));var timeout=require(_0xb111('0x3'));var express=require(_0xb111('0x4'));var router=express[_0xb111('0x5')]();var fs_extra=require(_0xb111('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb111('0x7'));var config=require('../../config/environment');var controller=require(_0xb111('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb111('0x9')]);router['get']('/describe',auth[_0xb111('0xa')](),controller['describe']);router['get'](_0xb111('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xb111('0xc')](_0xb111('0xd'),auth['isAuthenticated'](),controller[_0xb111('0xe')]);router['get'](_0xb111('0xf'),auth['isAuthenticated'](),controller[_0xb111('0x10')]);router[_0xb111('0xc')](_0xb111('0x11'),auth['isAuthenticated'](),controller[_0xb111('0x12')]);router['post']('/',auth[_0xb111('0xa')](),controller[_0xb111('0x13')]);router['post'](_0xb111('0xf'),auth[_0xb111('0xa')](),controller[_0xb111('0x14')]);router[_0xb111('0x15')](_0xb111('0x11'),auth[_0xb111('0xa')](),controller[_0xb111('0x16')]);router[_0xb111('0x17')]('/:id',auth[_0xb111('0xa')](),controller[_0xb111('0x18')]);router[_0xb111('0x19')](_0xb111('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xb111('0x19')](_0xb111('0xf'),auth[_0xb111('0xa')](),controller[_0xb111('0x1a')]);router['delete'](_0xb111('0x11'),auth[_0xb111('0xa')](),controller[_0xb111('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 2668847..b6f488b 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 _0x1fdc=['rrmemory','beepall','roundrobin','STRING','sequelize','exports','name','INTEGER','ENUM'];(function(_0x3909fb,_0x441482){var _0x202835=function(_0x4aaacb){while(--_0x4aaacb){_0x3909fb['push'](_0x3909fb['shift']());}};_0x202835(++_0x441482);}(_0x1fdc,0x8b));var _0xc1fd=function(_0x1034ee,_0x12998c){_0x1034ee=_0x1034ee-0x0;var _0x2922af=_0x1fdc[_0x1034ee];return _0x2922af;};'use strict';var Sequelize=require(_0xc1fd('0x0'));module[_0xc1fd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc1fd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc1fd('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc1fd('0x4')](_0xc1fd('0x5'),_0xc1fd('0x6'),_0xc1fd('0x7'))},'description':{'type':Sequelize[_0xc1fd('0x8')]}}; \ No newline at end of file +var _0x4627=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4627,0x115));var _0x7462=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x4627[_0x163040];return _0x364667;};'use strict';var Sequelize=require(_0x7462('0x0'));module[_0x7462('0x1')]={'name':{'type':Sequelize[_0x7462('0x2')],'unique':_0x7462('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7462('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7462('0x5')](_0x7462('0x6'),_0x7462('0x7'),_0x7462('0x8'))},'description':{'type':Sequelize[_0x7462('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index be1c1b1..4b98528 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 _0xe2fa=['../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','UserProfileResource','error','stack','name','send','WhatsappQueue','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','order','nolimit','addTeams','ids','Agents','voicePause','interface','get','transaction','each','findOrCreate','forEach','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x11a57b,_0x3f0bf3){var _0x19ddf0=function(_0x3d69e1){while(--_0x3d69e1){_0x11a57b['push'](_0x11a57b['shift']());}};_0x19ddf0(++_0x3f0bf3);}(_0xe2fa,0x18b));var _0xae2f=function(_0x11ebda,_0xfc9a32){_0x11ebda=_0x11ebda-0x0;var _0x5921a8=_0xe2fa[_0x11ebda];return _0x5921a8;};'use strict';var emlformat=require(_0xae2f('0x0'));var rimraf=require(_0xae2f('0x1'));var zipdir=require(_0xae2f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae2f('0x3'));var moment=require(_0xae2f('0x4'));var BPromise=require(_0xae2f('0x5'));var Mustache=require('mustache');var util=require(_0xae2f('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xae2f('0x7'));var fs=require('fs');var fs_extra=require(_0xae2f('0x8'));var _=require(_0xae2f('0x9'));var squel=require('squel');var crypto=require(_0xae2f('0xa'));var jsforce=require(_0xae2f('0xb'));var deskjs=require(_0xae2f('0xc'));var toCsv=require(_0xae2f('0xd'));var querystring=require(_0xae2f('0xe'));var Papa=require(_0xae2f('0xf'));var Redis=require(_0xae2f('0x10'));var authService=require(_0xae2f('0x11'));var qs=require(_0xae2f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae2f('0x13'));var logger=require(_0xae2f('0x14'))(_0xae2f('0x15'));var utils=require('../../config/utils');var config=require(_0xae2f('0x16'));var licenseUtil=require(_0xae2f('0x17'));var db=require(_0xae2f('0x18'))['db'];config['redis']=_[_0xae2f('0x19')](config[_0xae2f('0x1a')],{'host':_0xae2f('0x1b'),'port':0x18eb});var socket=require(_0xae2f('0x1c'))(new Redis(config[_0xae2f('0x1a')]));require(_0xae2f('0x1d'))['register'](socket);function respondWithStatusCode(_0x4ff47d,_0x34e53c){_0x34e53c=_0x34e53c||0xcc;return function(_0x2d49f0){if(_0x2d49f0){return _0x4ff47d[_0xae2f('0x1e')](_0x34e53c);}return _0x4ff47d[_0xae2f('0x1f')](_0x34e53c)[_0xae2f('0x20')]();};}function respondWithResult(_0x4b7729,_0x35d254){_0x35d254=_0x35d254||0xc8;return function(_0x5eecea){if(_0x5eecea){return _0x4b7729[_0xae2f('0x1f')](_0x35d254)['json'](_0x5eecea);}};}function respondWithFilteredResult(_0x391a8b,_0x5494f1){return function(_0x18f703){if(_0x18f703){var _0x484ad3=typeof _0x5494f1[_0xae2f('0x21')]===_0xae2f('0x22')&&typeof _0x5494f1['limit']===_0xae2f('0x22');var _0x2237b0=_0x18f703[_0xae2f('0x23')];var _0x236ea3=_0x484ad3?0x0:_0x5494f1[_0xae2f('0x21')];var _0x798c3e=_0x484ad3?_0x18f703[_0xae2f('0x23')]:_0x5494f1['offset']+_0x5494f1[_0xae2f('0x24')];var _0x20c3b3;if(_0x798c3e>=_0x2237b0){_0x798c3e=_0x2237b0;_0x20c3b3=0xc8;}else{_0x20c3b3=0xce;}_0x391a8b[_0xae2f('0x1f')](_0x20c3b3);return _0x391a8b[_0xae2f('0x25')](_0xae2f('0x26'),_0x236ea3+'-'+_0x798c3e+'/'+_0x2237b0)['json'](_0x18f703);}return null;};}function patchUpdates(_0x22bfac){return function(_0x53ad71){try{jsonpatch['apply'](_0x53ad71,_0x22bfac,!![]);}catch(_0x55275d){return BPromise[_0xae2f('0x27')](_0x55275d);}return _0x53ad71[_0xae2f('0x28')]();};}function saveUpdates(_0x46196c,_0x4efd9b){return function(_0x1d7b45){if(_0x1d7b45){return _0x1d7b45[_0xae2f('0x29')](_0x46196c)['then'](function(_0x29687a){return _0x29687a;});}return null;};}function removeEntity(_0xd888b2,_0x42a6e9){return function(_0x25ea35){if(_0x25ea35){return _0x25ea35[_0xae2f('0x2a')]()[_0xae2f('0x2b')](function(){var _0x1e2185=_0x25ea35['get']({'plain':!![]});var _0x5c3195='WhatsappQueues';return db[_0xae2f('0x2c')][_0xae2f('0x2a')]({'where':{'type':_0x5c3195,'resourceId':_0x1e2185['id']}})[_0xae2f('0x2b')](function(){return _0x25ea35;});})['then'](function(){_0xd888b2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cfd8e,_0x524f47){return function(_0x34ff36){if(!_0x34ff36){_0x5cfd8e['sendStatus'](0x194);}return _0x34ff36;};}function handleError(_0x58261e,_0x3e68f6){_0x3e68f6=_0x3e68f6||0x1f4;return function(_0x53b62f){logger[_0xae2f('0x2d')](_0x53b62f[_0xae2f('0x2e')]);if(_0x53b62f[_0xae2f('0x2f')]){delete _0x53b62f['name'];}_0x58261e['status'](_0x3e68f6)[_0xae2f('0x30')](_0x53b62f);};}exports['index']=function(_0xcfd8c4,_0x14333c){var _0x47570b={},_0x5cbbcc={},_0x237fe0={'count':0x0,'rows':[]};var _0x18db4d=_['map'](db[_0xae2f('0x31')][_0xae2f('0x32')],function(_0x35ffc6){return{'name':_0x35ffc6[_0xae2f('0x33')],'type':_0x35ffc6[_0xae2f('0x34')][_0xae2f('0x35')]};});_0x5cbbcc[_0xae2f('0x36')]=_[_0xae2f('0x37')](_0x18db4d,_0xae2f('0x2f'));_0x5cbbcc[_0xae2f('0x38')]=_['keys'](_0xcfd8c4[_0xae2f('0x38')]);_0x5cbbcc['filters']=_[_0xae2f('0x39')](_0x5cbbcc[_0xae2f('0x36')],_0x5cbbcc['query']);_0x47570b[_0xae2f('0x3a')]=_[_0xae2f('0x39')](_0x5cbbcc[_0xae2f('0x36')],qs[_0xae2f('0x3b')](_0xcfd8c4['query']['fields']));_0x47570b[_0xae2f('0x3a')]=_0x47570b[_0xae2f('0x3a')][_0xae2f('0x3c')]?_0x47570b[_0xae2f('0x3a')]:_0x5cbbcc[_0xae2f('0x36')];if(!_0xcfd8c4[_0xae2f('0x38')][_0xae2f('0x3d')]('nolimit')){_0x47570b['limit']=qs[_0xae2f('0x24')](_0xcfd8c4[_0xae2f('0x38')][_0xae2f('0x24')]);_0x47570b[_0xae2f('0x21')]=qs[_0xae2f('0x21')](_0xcfd8c4[_0xae2f('0x38')]['offset']);}_0x47570b['order']=qs[_0xae2f('0x3e')](_0xcfd8c4[_0xae2f('0x38')][_0xae2f('0x3e')]);_0x47570b[_0xae2f('0x3f')]=qs[_0xae2f('0x40')](_[_0xae2f('0x41')](_0xcfd8c4['query'],_0x5cbbcc['filters']),_0x18db4d);if(_0xcfd8c4[_0xae2f('0x38')]['filter']){_0x47570b[_0xae2f('0x3f')]=_[_0xae2f('0x42')](_0x47570b['where'],{'$or':_[_0xae2f('0x37')](_0x18db4d,function(_0x4e4679){if(_0x4e4679['type']!==_0xae2f('0x43')){var _0x2d3ced={};_0x2d3ced[_0x4e4679[_0xae2f('0x2f')]]={'$like':'%'+_0xcfd8c4[_0xae2f('0x38')][_0xae2f('0x44')]+'%'};return _0x2d3ced;}})});}_0x47570b=_[_0xae2f('0x42')]({},_0x47570b,_0xcfd8c4[_0xae2f('0x45')]);var _0x1cb774={'where':_0x47570b['where']};return db['WhatsappQueue'][_0xae2f('0x23')](_0x1cb774)[_0xae2f('0x2b')](function(_0x2c9688){_0x237fe0[_0xae2f('0x23')]=_0x2c9688;if(_0xcfd8c4['query'][_0xae2f('0x46')]){_0x47570b[_0xae2f('0x47')]=[{'all':!![]}];}return db[_0xae2f('0x31')][_0xae2f('0x48')](_0x47570b);})[_0xae2f('0x2b')](function(_0x3a24b2){_0x237fe0[_0xae2f('0x49')]=_0x3a24b2;return _0x237fe0;})[_0xae2f('0x2b')](respondWithFilteredResult(_0x14333c,_0x47570b))['catch'](handleError(_0x14333c,null));};exports['show']=function(_0x84c1b0,_0x426153){var _0x41504f={'raw':!![],'where':{'id':_0x84c1b0[_0xae2f('0x4a')]['id']}},_0x112371={};_0x112371['model']=_[_0xae2f('0x4b')](db[_0xae2f('0x31')]['rawAttributes']);_0x112371[_0xae2f('0x38')]=_[_0xae2f('0x4b')](_0x84c1b0['query']);_0x112371[_0xae2f('0x40')]=_[_0xae2f('0x39')](_0x112371[_0xae2f('0x36')],_0x112371[_0xae2f('0x38')]);_0x41504f['attributes']=_[_0xae2f('0x39')](_0x112371[_0xae2f('0x36')],qs[_0xae2f('0x3b')](_0x84c1b0[_0xae2f('0x38')]['fields']));_0x41504f[_0xae2f('0x3a')]=_0x41504f[_0xae2f('0x3a')]['length']?_0x41504f['attributes']:_0x112371['model'];if(_0x84c1b0[_0xae2f('0x38')][_0xae2f('0x46')]){_0x41504f[_0xae2f('0x47')]=[{'all':!![]}];}_0x41504f=_['merge']({},_0x41504f,_0x84c1b0[_0xae2f('0x45')]);return db[_0xae2f('0x31')]['find'](_0x41504f)[_0xae2f('0x2b')](handleEntityNotFound(_0x426153,null))[_0xae2f('0x2b')](respondWithResult(_0x426153,null))['catch'](handleError(_0x426153,null));};exports[_0xae2f('0x4c')]=function(_0x4c855b,_0x68ba3){return db[_0xae2f('0x31')][_0xae2f('0x4c')](_0x4c855b[_0xae2f('0x4d')],{})['then'](function(_0x436f45){var _0x417522=_0x4c855b[_0xae2f('0x4e')]['get']({'plain':!![]});if(!_0x417522)throw new Error(_0xae2f('0x4f'));if(_0x417522[_0xae2f('0x50')]==='user'){var _0x2ee64e=_0x436f45['get']({'plain':!![]});var _0x2ed8ae=_0xae2f('0x51');return db[_0xae2f('0x52')][_0xae2f('0x53')]({'where':{'name':_0x2ed8ae,'userProfileId':_0x417522[_0xae2f('0x54')]},'raw':!![]})['then'](function(_0x28b925){if(_0x28b925&&_0x28b925['autoAssociation']===0x0){return db['UserProfileResource'][_0xae2f('0x4c')]({'name':_0x2ee64e[_0xae2f('0x2f')],'resourceId':_0x2ee64e['id'],'type':_0x28b925[_0xae2f('0x2f')],'sectionId':_0x28b925['id']},{})[_0xae2f('0x2b')](function(){return _0x436f45;});}else{return _0x436f45;}})[_0xae2f('0x55')](function(_0x133695){logger[_0xae2f('0x2d')](_0xae2f('0x56'),_0x133695);throw _0x133695;});}return _0x436f45;})[_0xae2f('0x2b')](respondWithResult(_0x68ba3,0xc9))['catch'](handleError(_0x68ba3,null));};exports[_0xae2f('0x29')]=function(_0x172c59,_0x311c75){if(_0x172c59[_0xae2f('0x4d')]['id']){delete _0x172c59[_0xae2f('0x4d')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x172c59[_0xae2f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x311c75,null))[_0xae2f('0x2b')](saveUpdates(_0x172c59[_0xae2f('0x4d')],null))[_0xae2f('0x2b')](respondWithResult(_0x311c75,null))[_0xae2f('0x55')](handleError(_0x311c75,null));};exports[_0xae2f('0x2a')]=function(_0x419834,_0x21a6a4){return db['WhatsappQueue'][_0xae2f('0x53')]({'where':{'id':_0x419834['params']['id']}})[_0xae2f('0x2b')](handleEntityNotFound(_0x21a6a4,null))[_0xae2f('0x2b')](removeEntity(_0x21a6a4,null))[_0xae2f('0x55')](handleError(_0x21a6a4,null));};exports[_0xae2f('0x57')]=function(_0x1145b1,_0x21f520){return db[_0xae2f('0x31')][_0xae2f('0x57')]()[_0xae2f('0x2b')](respondWithResult(_0x21f520,null))[_0xae2f('0x55')](handleError(_0x21f520,null));};exports[_0xae2f('0x58')]=function(_0x16ae88,_0x4a2610,_0x5163f7){var _0x2f9dd4={'raw':!![],'where':{}},_0x22ab08={},_0x2f58f1;return db[_0xae2f('0x31')][_0xae2f('0x59')]({'where':{'id':_0x16ae88[_0xae2f('0x4a')]['id']}})[_0xae2f('0x2b')](handleEntityNotFound(_0x4a2610,null))[_0xae2f('0x2b')](function(_0x373434){if(_0x373434){_0x2f58f1=_0x373434['get']({'plain':!![]});_0x22ab08[_0xae2f('0x36')]=_[_0xae2f('0x4b')](db[_0xae2f('0x5a')]['rawAttributes']);_0x22ab08[_0xae2f('0x38')]=_[_0xae2f('0x4b')](_0x16ae88[_0xae2f('0x38')]);_0x22ab08[_0xae2f('0x40')]=_[_0xae2f('0x39')](_0x22ab08[_0xae2f('0x36')],_0x22ab08[_0xae2f('0x38')]);_0x2f9dd4[_0xae2f('0x3a')]=_[_0xae2f('0x39')](_0x22ab08['model'],qs[_0xae2f('0x3b')](_0x16ae88[_0xae2f('0x38')]['fields']));_0x2f9dd4['attributes']=_0x2f9dd4[_0xae2f('0x3a')][_0xae2f('0x3c')]?_0x2f9dd4[_0xae2f('0x3a')]:_0x22ab08[_0xae2f('0x36')];if(!_0x16ae88[_0xae2f('0x38')][_0xae2f('0x3d')]('nolimit')){_0x2f9dd4[_0xae2f('0x24')]=qs[_0xae2f('0x24')](_0x16ae88[_0xae2f('0x38')][_0xae2f('0x24')]);_0x2f9dd4[_0xae2f('0x21')]=qs[_0xae2f('0x21')](_0x16ae88['query'][_0xae2f('0x21')]);}_0x2f9dd4['order']=qs[_0xae2f('0x3e')](_0x16ae88[_0xae2f('0x38')]['sort']);_0x2f9dd4['where']=qs[_0xae2f('0x40')](_[_0xae2f('0x41')](_0x16ae88['query'],_0x22ab08[_0xae2f('0x40')]));_0x2f9dd4[_0xae2f('0x3f')][_0xae2f('0x5b')]=_0x373434['id'];if(_0x16ae88[_0xae2f('0x38')][_0xae2f('0x44')]){_0x2f9dd4[_0xae2f('0x3f')]=_['merge'](_0x2f9dd4[_0xae2f('0x3f')],{'$or':_['map'](_0x2f9dd4['attributes'],function(_0x175394){var _0x3df5ce={};_0x3df5ce[_0x175394]={'$like':'%'+_0x16ae88[_0xae2f('0x38')][_0xae2f('0x44')]+'%'};return _0x3df5ce;})});}_0x2f9dd4=_[_0xae2f('0x42')]({},_0x2f9dd4,_0x16ae88['options']);return db[_0xae2f('0x5a')]['findAll'](_0x2f9dd4);}})[_0xae2f('0x2b')](function(_0x3367b6){if(_0x3367b6){return db[_0xae2f('0x5c')][_0xae2f('0x5d')]({'where':{'id':_[_0xae2f('0x37')](_0x3367b6,'UserId'),'role':_0xae2f('0x5e')},'attributes':['id',_0xae2f('0x2f'),_0xae2f('0x5f'),_0xae2f('0x60'),_0xae2f('0x61')]});}})['then'](function(_0x2c38c0){if(_0x2c38c0){return{'count':_0x2c38c0[_0xae2f('0x23')],'rows':_['map'](_0x2c38c0[_0xae2f('0x49')],function(_0x290107){return{'membername':_0x290107[_0xae2f('0x2f')],'UserId':_0x290107['id'],'queue_name':_0x2f58f1[_0xae2f('0x2f')],'WhatsappQueueId':_0x2f58f1['id'],'interface':util[_0xae2f('0x62')](_0xae2f('0x63'),'SIP',_0x290107[_0xae2f('0x2f')]),'penalty':0x0,'paused':_0x290107[_0xae2f('0x5f')],'createdAt':_0x290107[_0xae2f('0x61')],'updatedAt':_0x290107[_0xae2f('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xae2f('0x2b')](respondWithFilteredResult(_0x4a2610,_0x2f9dd4))[_0xae2f('0x55')](handleError(_0x4a2610,null));};exports[_0xae2f('0x64')]=function(_0xa18ef,_0x2293f9,_0x43b379){var _0x2c0be7={};var _0xe42bf7={};var _0x3080cb;var _0x14ee02;return db[_0xae2f('0x31')]['findOne']({'where':{'id':_0xa18ef['params']['id']}})[_0xae2f('0x2b')](handleEntityNotFound(_0x2293f9,null))[_0xae2f('0x2b')](function(_0x99882c){if(_0x99882c){_0x3080cb=_0x99882c;_0xe42bf7['model']=_[_0xae2f('0x4b')](db[_0xae2f('0x65')][_0xae2f('0x32')]);_0xe42bf7['query']=_[_0xae2f('0x4b')](_0xa18ef['query']);_0xe42bf7[_0xae2f('0x40')]=_[_0xae2f('0x39')](_0xe42bf7['model'],_0xe42bf7[_0xae2f('0x38')]);_0x2c0be7[_0xae2f('0x3a')]=_[_0xae2f('0x39')](_0xe42bf7[_0xae2f('0x36')],qs['fields'](_0xa18ef[_0xae2f('0x38')][_0xae2f('0x3b')]));_0x2c0be7[_0xae2f('0x3a')]=_0x2c0be7[_0xae2f('0x3a')][_0xae2f('0x3c')]?_0x2c0be7[_0xae2f('0x3a')]:_0xe42bf7[_0xae2f('0x36')];_0x2c0be7[_0xae2f('0x66')]=qs[_0xae2f('0x3e')](_0xa18ef[_0xae2f('0x38')][_0xae2f('0x3e')]);_0x2c0be7[_0xae2f('0x3f')]=qs[_0xae2f('0x40')](_[_0xae2f('0x41')](_0xa18ef[_0xae2f('0x38')],_0xe42bf7[_0xae2f('0x40')]));if(_0xa18ef['query'][_0xae2f('0x44')]){_0x2c0be7['where']=_['merge'](_0x2c0be7[_0xae2f('0x3f')],{'$or':_[_0xae2f('0x37')](_0x2c0be7['attributes'],function(_0x1dd436){var _0x25183e={};_0x25183e[_0x1dd436]={'$like':'%'+_0xa18ef[_0xae2f('0x38')][_0xae2f('0x44')]+'%'};return _0x25183e;})});}_0x2c0be7=_[_0xae2f('0x42')]({},_0x2c0be7,_0xa18ef[_0xae2f('0x45')]);return _0x3080cb[_0xae2f('0x64')](_0x2c0be7);}})['then'](function(_0x2dafaa){if(_0x2dafaa){_0x14ee02=_0x2dafaa[_0xae2f('0x3c')];if(!_0xa18ef[_0xae2f('0x38')]['hasOwnProperty'](_0xae2f('0x67'))){_0x2c0be7[_0xae2f('0x24')]=qs[_0xae2f('0x24')](_0xa18ef['query'][_0xae2f('0x24')]);_0x2c0be7[_0xae2f('0x21')]=qs[_0xae2f('0x21')](_0xa18ef['query'][_0xae2f('0x21')]);}return _0x3080cb[_0xae2f('0x64')](_0x2c0be7);}})[_0xae2f('0x2b')](function(_0x28e887){if(_0x28e887){return _0x28e887?{'count':_0x14ee02,'rows':_0x28e887}:null;}})[_0xae2f('0x2b')](respondWithResult(_0x2293f9,null))[_0xae2f('0x55')](handleError(_0x2293f9,null));};exports[_0xae2f('0x68')]=function(_0x4756ef,_0x4a2955,_0x1ef823){var _0x5f5d14=_0x4756ef[_0xae2f('0x4d')][_0xae2f('0x69')];return db[_0xae2f('0x65')][_0xae2f('0x48')]({'where':{'id':_0x5f5d14},'attributes':['id'],'include':[{'model':db[_0xae2f('0x5c')],'as':_0xae2f('0x6a'),'attributes':['id',_0xae2f('0x2f'),'online',_0xae2f('0x6b'),_0xae2f('0x6c')],'raw':!![]}]})[_0xae2f('0x2b')](function(_0x529b72){if(_0x529b72){var _0x518260=_['flatMap'](_0x529b72,function(_0x339d30){var _0x5b07b4=_0x339d30[_0xae2f('0x6d')]({'plain':!![]});return _0x5b07b4[_0xae2f('0x6a')];});return db[_0xae2f('0x31')][_0xae2f('0x53')]({'where':{'id':_0x4756ef['params']['id']}})[_0xae2f('0x2b')](function(_0x2d481c){return db['sequelize'][_0xae2f('0x6e')](function(_0x595f7f){return _0x2d481c[_0xae2f('0x68')](_0x5f5d14,{'transaction':_0x595f7f})['then'](function(){return BPromise[_0xae2f('0x6f')](_0x518260,function(_0x11cce5){return db['UserWhatsappQueue'][_0xae2f('0x70')]({'where':{'UserId':_0x11cce5['id'],'WhatsappQueueId':_0x4756ef[_0xae2f('0x4a')]['id']},'transaction':_0x595f7f});});})['then'](function(){_0x518260[_0xae2f('0x71')](function(_0x3b9133){socket['emit']('userWhatsappQueue:save',{'UserId':_0x3b9133['id'],'WhatsappQueueId':_0x2d481c['id']});});});});});}})[_0xae2f('0x2b')](respondWithStatusCode(_0x4a2955,null))[_0xae2f('0x55')](handleError(_0x4a2955,null));};exports['removeTeams']=function(_0x1c820a,_0x4cb0d6,_0x287eb8){return db['Team'][_0xae2f('0x48')]({'where':{'id':_0x1c820a[_0xae2f('0x38')][_0xae2f('0x69')]},'attributes':['id'],'include':[{'model':db[_0xae2f('0x5c')],'as':_0xae2f('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xae2f('0x2b')](handleEntityNotFound(_0x4cb0d6,null))[_0xae2f('0x2b')](function(_0x54a253){var _0x21d889=_[_0xae2f('0x37')](_0x54a253,'id');var _0x3584ea=[];var _0xdaeb2f=[];var _0x314454=squel[_0xae2f('0x72')]();_0x314454[_0xae2f('0x73')](_0xae2f('0x74'))['from']('team_has_whatsapp_queues','tq')[_0xae2f('0x75')]('user_has_teams','ut',_0xae2f('0x76'))[_0xae2f('0x3f')](_0xae2f('0x77'),_0x1c820a[_0xae2f('0x4a')]['id']);for(var _0x468e3f=0x0;_0x468e3f<_0x54a253[_0xae2f('0x3c')];_0x468e3f+=0x1){let _0x24d485=_0x54a253[_0x468e3f];for(var _0x439807=0x0;_0x439807<_0x24d485[_0xae2f('0x6a')][_0xae2f('0x3c')];_0x439807+=0x1){let _0x377c2a=_0x24d485[_0xae2f('0x6a')][_0x439807];var _0x295ab7=_0x314454[_0xae2f('0x78')]();_0x295ab7[_0xae2f('0x3f')](_0xae2f('0x79'),_0x377c2a['id']);_0xdaeb2f['push'](db[_0xae2f('0x7a')][_0xae2f('0x38')](_0x295ab7['toString'](),{'type':db['sequelize']['QueryTypes'][_0xae2f('0x7b')]})['then'](function(_0x52b62c){if(_0x52b62c[_0xae2f('0x3c')]===0x1){return _0x377c2a['id'];}else{var _0x22db22=_[_0xae2f('0x7c')](_[_0xae2f('0x37')](_0x52b62c,_0xae2f('0x7d')),function(_0x53fc9c){return _['includes'](_0x21d889,_0x53fc9c);});if(_0x22db22){return _0x377c2a['id'];}}}));}}return BPromise[_0xae2f('0x7e')](_0xdaeb2f)[_0xae2f('0x2b')](function(_0x32654b){_0x3584ea=_(_0x3584ea)[_0xae2f('0x7f')](_0x32654b)[_0xae2f('0x80')]()['value']();return db[_0xae2f('0x31')]['find']({'where':{'id':_0x1c820a['params']['id']}})['then'](function(_0x1b1882){return db[_0xae2f('0x7a')][_0xae2f('0x6e')](function(_0x4571e1){return _0x1b1882[_0xae2f('0x81')](_0x1c820a[_0xae2f('0x38')][_0xae2f('0x69')],{'transaction':_0x4571e1})['then'](function(){if(!_[_0xae2f('0x82')](_0x3584ea)){return _0x1b1882[_0xae2f('0x83')](_0x3584ea,{'transaction':_0x4571e1});}})['then'](function(){_0x3584ea[_0xae2f('0x71')](function(_0x4df7db){socket[_0xae2f('0x84')]('userWhatsappQueue:remove',{'UserId':_0x4df7db,'WhatsappQueueId':_0x1b1882['id']});});});});});});})['then'](respondWithStatusCode(_0x4cb0d6,null))[_0xae2f('0x55')](handleError(_0x4cb0d6,null));};exports[_0xae2f('0x85')]=function(_0x40f362,_0x467614,_0x41acf1){return db[_0xae2f('0x31')][_0xae2f('0x53')]({'where':{'id':_0x40f362[_0xae2f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x467614,null))['then'](function(_0x429431){if(_0x429431){return _0x429431['addAgents'](_0x40f362[_0xae2f('0x4d')][_0xae2f('0x69')],_[_0xae2f('0x86')](_0x40f362[_0xae2f('0x4d')],['ids','id'])||{})[_0xae2f('0x87')](function(_0x4343b7){for(var _0x43353b=0x0;_0x43353b<_0x40f362[_0xae2f('0x4d')][_0xae2f('0x69')][_0xae2f('0x3c')];_0x43353b+=0x1){socket[_0xae2f('0x84')]('userWhatsappQueue:save',{'UserId':Number(_0x40f362[_0xae2f('0x4d')][_0xae2f('0x69')][_0x43353b]),'WhatsappQueueId':Number(_0x40f362[_0xae2f('0x4a')]['id'])});}return _0x4343b7;});}})['then'](respondWithResult(_0x467614,null))[_0xae2f('0x55')](handleError(_0x467614,null));};exports[_0xae2f('0x83')]=function(_0x196050,_0x39388c,_0x3ffa2d){return db[_0xae2f('0x31')][_0xae2f('0x53')]({'where':{'id':_0x196050[_0xae2f('0x4a')]['id']}})[_0xae2f('0x2b')](handleEntityNotFound(_0x39388c,null))[_0xae2f('0x2b')](function(_0x58b998){if(_0x58b998){return _0x58b998[_0xae2f('0x83')](_0x196050[_0xae2f('0x38')][_0xae2f('0x69')])[_0xae2f('0x2b')](function(){if(_[_0xae2f('0x88')](_0x196050[_0xae2f('0x38')][_0xae2f('0x69')])){for(var _0x1f14dc=0x0;_0x1f14dc<_0x196050[_0xae2f('0x38')][_0xae2f('0x69')][_0xae2f('0x3c')];_0x1f14dc+=0x1){socket[_0xae2f('0x84')](_0xae2f('0x89'),{'UserId':Number(_0x196050[_0xae2f('0x38')][_0xae2f('0x69')][_0x1f14dc]),'WhatsappQueueId':Number(_0x196050[_0xae2f('0x4a')]['id'])});}}else{socket[_0xae2f('0x84')](_0xae2f('0x89'),{'UserId':Number(_0x196050[_0xae2f('0x38')][_0xae2f('0x69')]),'WhatsappQueueId':Number(_0x196050[_0xae2f('0x4a')]['id'])});}});}})[_0xae2f('0x2b')](respondWithStatusCode(_0x39388c,null))[_0xae2f('0x55')](handleError(_0x39388c,null));};exports[_0xae2f('0x8a')]=function(_0x1c3502,_0x2b16f3,_0x4d3037){var _0xca0251={};var _0x39fb1e={};var _0x209c77;var _0x154505;return db[_0xae2f('0x31')][_0xae2f('0x59')]({'where':{'id':_0x1c3502[_0xae2f('0x4a')]['id']}})[_0xae2f('0x2b')](handleEntityNotFound(_0x2b16f3,null))[_0xae2f('0x2b')](function(_0xa2079c){if(_0xa2079c){_0x209c77=_0xa2079c;_0x39fb1e['model']=_[_0xae2f('0x4b')](db[_0xae2f('0x5c')][_0xae2f('0x32')]);_0x39fb1e[_0xae2f('0x38')]=_[_0xae2f('0x4b')](_0x1c3502[_0xae2f('0x38')]);_0x39fb1e[_0xae2f('0x40')]=_['intersection'](_0x39fb1e[_0xae2f('0x36')],_0x39fb1e[_0xae2f('0x38')]);_0xca0251[_0xae2f('0x3a')]=_[_0xae2f('0x39')](_0x39fb1e[_0xae2f('0x36')],qs[_0xae2f('0x3b')](_0x1c3502[_0xae2f('0x38')][_0xae2f('0x3b')]));_0xca0251[_0xae2f('0x3a')]=_0xca0251[_0xae2f('0x3a')][_0xae2f('0x3c')]?_0xca0251[_0xae2f('0x3a')]:_0x39fb1e[_0xae2f('0x36')];_0xca0251['order']=qs[_0xae2f('0x3e')](_0x1c3502[_0xae2f('0x38')][_0xae2f('0x3e')]);_0xca0251[_0xae2f('0x3f')]=qs[_0xae2f('0x40')](_[_0xae2f('0x41')](_0x1c3502[_0xae2f('0x38')],_0x39fb1e[_0xae2f('0x40')]));if(_0x1c3502[_0xae2f('0x38')][_0xae2f('0x44')]){_0xca0251['where']=_[_0xae2f('0x42')](_0xca0251['where'],{'$or':_[_0xae2f('0x37')](_0xca0251[_0xae2f('0x3a')],function(_0x2c1cf7){var _0x82f056={};_0x82f056[_0x2c1cf7]={'$like':'%'+_0x1c3502[_0xae2f('0x38')]['filter']+'%'};return _0x82f056;})});}_0xca0251=_['merge']({},_0xca0251,_0x1c3502[_0xae2f('0x45')]);return _0x209c77['getAgents'](_0xca0251);}})['then'](function(_0x5a1b72){if(_0x5a1b72){_0x154505=_0x5a1b72[_0xae2f('0x3c')];if(!_0x1c3502[_0xae2f('0x38')][_0xae2f('0x3d')](_0xae2f('0x67'))){_0xca0251[_0xae2f('0x24')]=qs['limit'](_0x1c3502['query'][_0xae2f('0x24')]);_0xca0251[_0xae2f('0x21')]=qs[_0xae2f('0x21')](_0x1c3502['query'][_0xae2f('0x21')]);}return _0x209c77[_0xae2f('0x8a')](_0xca0251);}})[_0xae2f('0x2b')](function(_0x63b69){if(_0x63b69){return _0x63b69?{'count':_0x154505,'rows':_0x63b69}:null;}})[_0xae2f('0x2b')](respondWithResult(_0x2b16f3,null))[_0xae2f('0x55')](handleError(_0x2b16f3,null));}; \ No newline at end of file +var _0xae5f=['ids','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userWhatsappQueue:remove','addAgents','spread','userWhatsappQueue:save','findOne','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','WhatsappQueues','UserProfileResource','error','stack','name','index','map','WhatsappQueue','rawAttributes','type','key','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','options','where','include','findAll','rows','params','keys','includeAll','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','createdAt','format','SIP','Team','addTeams','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit'];(function(_0x852bef,_0x2b376c){var _0xa36174=function(_0x4c8098){while(--_0x4c8098){_0x852bef['push'](_0x852bef['shift']());}};_0xa36174(++_0x2b376c);}(_0xae5f,0x12b));var _0xfae5=function(_0x568a52,_0x107ee0){_0x568a52=_0x568a52-0x0;var _0x5e3513=_0xae5f[_0x568a52];return _0x5e3513;};'use strict';var emlformat=require(_0xfae5('0x0'));var rimraf=require(_0xfae5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfae5('0x2'));var rp=require(_0xfae5('0x3'));var moment=require(_0xfae5('0x4'));var BPromise=require(_0xfae5('0x5'));var Mustache=require(_0xfae5('0x6'));var util=require(_0xfae5('0x7'));var path=require(_0xfae5('0x8'));var sox=require(_0xfae5('0x9'));var csv=require(_0xfae5('0xa'));var ejs=require(_0xfae5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfae5('0xc'));var deskjs=require(_0xfae5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfae5('0xe'));var Papa=require('papaparse');var Redis=require(_0xfae5('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfae5('0x10'));var logger=require(_0xfae5('0x11'))(_0xfae5('0x12'));var utils=require('../../config/utils');var config=require(_0xfae5('0x13'));var licenseUtil=require(_0xfae5('0x14'));var db=require('../../mysqldb')['db'];config[_0xfae5('0x15')]=_[_0xfae5('0x16')](config[_0xfae5('0x15')],{'host':_0xfae5('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfae5('0x15')]));require('./whatsappQueue.socket')[_0xfae5('0x18')](socket);function respondWithStatusCode(_0x13870c,_0xd3d203){_0xd3d203=_0xd3d203||0xcc;return function(_0x13bb26){if(_0x13bb26){return _0x13870c[_0xfae5('0x19')](_0xd3d203);}return _0x13870c[_0xfae5('0x1a')](_0xd3d203)[_0xfae5('0x1b')]();};}function respondWithResult(_0x5839c8,_0xfc00ab){_0xfc00ab=_0xfc00ab||0xc8;return function(_0x3bf4ab){if(_0x3bf4ab){return _0x5839c8[_0xfae5('0x1a')](_0xfc00ab)['json'](_0x3bf4ab);}};}function respondWithFilteredResult(_0x58b2e7,_0xe9c429){return function(_0x4d17ed){if(_0x4d17ed){var _0x15bde7=typeof _0xe9c429[_0xfae5('0x1c')]===_0xfae5('0x1d')&&typeof _0xe9c429[_0xfae5('0x1e')]===_0xfae5('0x1d');var _0x4948bd=_0x4d17ed[_0xfae5('0x1f')];var _0x31e0de=_0x15bde7?0x0:_0xe9c429[_0xfae5('0x1c')];var _0x336a55=_0x15bde7?_0x4d17ed[_0xfae5('0x1f')]:_0xe9c429['offset']+_0xe9c429[_0xfae5('0x1e')];var _0x4c7366;if(_0x336a55>=_0x4948bd){_0x336a55=_0x4948bd;_0x4c7366=0xc8;}else{_0x4c7366=0xce;}_0x58b2e7[_0xfae5('0x1a')](_0x4c7366);return _0x58b2e7['set'](_0xfae5('0x20'),_0x31e0de+'-'+_0x336a55+'/'+_0x4948bd)[_0xfae5('0x21')](_0x4d17ed);}return null;};}function patchUpdates(_0xa3f156){return function(_0x22924a){try{jsonpatch[_0xfae5('0x22')](_0x22924a,_0xa3f156,!![]);}catch(_0x5cb91f){return BPromise[_0xfae5('0x23')](_0x5cb91f);}return _0x22924a[_0xfae5('0x24')]();};}function saveUpdates(_0x5ef909,_0x21db4e){return function(_0x580ea3){if(_0x580ea3){return _0x580ea3[_0xfae5('0x25')](_0x5ef909)[_0xfae5('0x26')](function(_0x28ab58){return _0x28ab58;});}return null;};}function removeEntity(_0x555047,_0x4cac7a){return function(_0x4166df){if(_0x4166df){return _0x4166df[_0xfae5('0x27')]()[_0xfae5('0x26')](function(){var _0x59b3fa=_0x4166df['get']({'plain':!![]});var _0x27aaa1=_0xfae5('0x28');return db[_0xfae5('0x29')][_0xfae5('0x27')]({'where':{'type':_0x27aaa1,'resourceId':_0x59b3fa['id']}})[_0xfae5('0x26')](function(){return _0x4166df;});})['then'](function(){_0x555047[_0xfae5('0x1a')](0xcc)[_0xfae5('0x1b')]();});}};}function handleEntityNotFound(_0x6b436f,_0x57ce44){return function(_0x50f4af){if(!_0x50f4af){_0x6b436f['sendStatus'](0x194);}return _0x50f4af;};}function handleError(_0x63d819,_0x5dc223){_0x5dc223=_0x5dc223||0x1f4;return function(_0x541841){logger[_0xfae5('0x2a')](_0x541841[_0xfae5('0x2b')]);if(_0x541841[_0xfae5('0x2c')]){delete _0x541841[_0xfae5('0x2c')];}_0x63d819['status'](_0x5dc223)['send'](_0x541841);};}exports[_0xfae5('0x2d')]=function(_0x5cbf25,_0x4bf0bb){var _0x35c04b={},_0x3b075f={},_0x5cacb4={'count':0x0,'rows':[]};var _0x10eda9=_[_0xfae5('0x2e')](db[_0xfae5('0x2f')][_0xfae5('0x30')],function(_0x1e224){return{'name':_0x1e224['fieldName'],'type':_0x1e224[_0xfae5('0x31')][_0xfae5('0x32')]};});_0x3b075f[_0xfae5('0x33')]=_[_0xfae5('0x2e')](_0x10eda9,_0xfae5('0x2c'));_0x3b075f['query']=_['keys'](_0x5cbf25['query']);_0x3b075f['filters']=_[_0xfae5('0x34')](_0x3b075f['model'],_0x3b075f[_0xfae5('0x35')]);_0x35c04b[_0xfae5('0x36')]=_[_0xfae5('0x34')](_0x3b075f[_0xfae5('0x33')],qs[_0xfae5('0x37')](_0x5cbf25[_0xfae5('0x35')]['fields']));_0x35c04b[_0xfae5('0x36')]=_0x35c04b[_0xfae5('0x36')][_0xfae5('0x38')]?_0x35c04b[_0xfae5('0x36')]:_0x3b075f[_0xfae5('0x33')];if(!_0x5cbf25[_0xfae5('0x35')][_0xfae5('0x39')](_0xfae5('0x3a'))){_0x35c04b[_0xfae5('0x1e')]=qs['limit'](_0x5cbf25[_0xfae5('0x35')]['limit']);_0x35c04b[_0xfae5('0x1c')]=qs[_0xfae5('0x1c')](_0x5cbf25[_0xfae5('0x35')][_0xfae5('0x1c')]);}_0x35c04b[_0xfae5('0x3b')]=qs[_0xfae5('0x3c')](_0x5cbf25['query'][_0xfae5('0x3c')]);_0x35c04b['where']=qs[_0xfae5('0x3d')](_[_0xfae5('0x3e')](_0x5cbf25[_0xfae5('0x35')],_0x3b075f[_0xfae5('0x3d')]),_0x10eda9);if(_0x5cbf25[_0xfae5('0x35')][_0xfae5('0x3f')]){_0x35c04b['where']=_[_0xfae5('0x40')](_0x35c04b['where'],{'$or':_['map'](_0x10eda9,function(_0x42087f){if(_0x42087f[_0xfae5('0x31')]!=='VIRTUAL'){var _0x22b552={};_0x22b552[_0x42087f['name']]={'$like':'%'+_0x5cbf25['query']['filter']+'%'};return _0x22b552;}})});}_0x35c04b=_[_0xfae5('0x40')]({},_0x35c04b,_0x5cbf25[_0xfae5('0x41')]);var _0xfd1570={'where':_0x35c04b[_0xfae5('0x42')]};return db[_0xfae5('0x2f')][_0xfae5('0x1f')](_0xfd1570)[_0xfae5('0x26')](function(_0x19135c){_0x5cacb4['count']=_0x19135c;if(_0x5cbf25['query']['includeAll']){_0x35c04b[_0xfae5('0x43')]=[{'all':!![]}];}return db[_0xfae5('0x2f')][_0xfae5('0x44')](_0x35c04b);})[_0xfae5('0x26')](function(_0x574fb6){_0x5cacb4[_0xfae5('0x45')]=_0x574fb6;return _0x5cacb4;})['then'](respondWithFilteredResult(_0x4bf0bb,_0x35c04b))['catch'](handleError(_0x4bf0bb,null));};exports['show']=function(_0x411f0f,_0xc4ac4a){var _0x28d726={'raw':!![],'where':{'id':_0x411f0f[_0xfae5('0x46')]['id']}},_0x387496={};_0x387496['model']=_[_0xfae5('0x47')](db['WhatsappQueue'][_0xfae5('0x30')]);_0x387496[_0xfae5('0x35')]=_[_0xfae5('0x47')](_0x411f0f[_0xfae5('0x35')]);_0x387496[_0xfae5('0x3d')]=_['intersection'](_0x387496[_0xfae5('0x33')],_0x387496[_0xfae5('0x35')]);_0x28d726[_0xfae5('0x36')]=_['intersection'](_0x387496[_0xfae5('0x33')],qs[_0xfae5('0x37')](_0x411f0f[_0xfae5('0x35')][_0xfae5('0x37')]));_0x28d726[_0xfae5('0x36')]=_0x28d726[_0xfae5('0x36')][_0xfae5('0x38')]?_0x28d726['attributes']:_0x387496[_0xfae5('0x33')];if(_0x411f0f[_0xfae5('0x35')][_0xfae5('0x48')]){_0x28d726[_0xfae5('0x43')]=[{'all':!![]}];}_0x28d726=_[_0xfae5('0x40')]({},_0x28d726,_0x411f0f['options']);return db[_0xfae5('0x2f')][_0xfae5('0x49')](_0x28d726)[_0xfae5('0x26')](handleEntityNotFound(_0xc4ac4a,null))[_0xfae5('0x26')](respondWithResult(_0xc4ac4a,null))[_0xfae5('0x4a')](handleError(_0xc4ac4a,null));};exports['create']=function(_0x9fbaa4,_0x4a57c8){return db[_0xfae5('0x2f')][_0xfae5('0x4b')](_0x9fbaa4['body'],{})[_0xfae5('0x26')](function(_0x750e0f){var _0x4caf1b=_0x9fbaa4[_0xfae5('0x4c')][_0xfae5('0x4d')]({'plain':!![]});if(!_0x4caf1b)throw new Error(_0xfae5('0x4e'));if(_0x4caf1b[_0xfae5('0x4f')]==='user'){var _0x331d1f=_0x750e0f[_0xfae5('0x4d')]({'plain':!![]});var _0x34062b=_0xfae5('0x28');return db[_0xfae5('0x50')]['find']({'where':{'name':_0x34062b,'userProfileId':_0x4caf1b['userProfileId']},'raw':!![]})['then'](function(_0x3224c9){if(_0x3224c9&&_0x3224c9[_0xfae5('0x51')]===0x0){return db['UserProfileResource'][_0xfae5('0x4b')]({'name':_0x331d1f[_0xfae5('0x2c')],'resourceId':_0x331d1f['id'],'type':_0x3224c9[_0xfae5('0x2c')],'sectionId':_0x3224c9['id']},{})['then'](function(){return _0x750e0f;});}else{return _0x750e0f;}})['catch'](function(_0x32fc22){logger[_0xfae5('0x2a')](_0xfae5('0x52'),_0x32fc22);throw _0x32fc22;});}return _0x750e0f;})['then'](respondWithResult(_0x4a57c8,0xc9))[_0xfae5('0x4a')](handleError(_0x4a57c8,null));};exports[_0xfae5('0x25')]=function(_0x28667d,_0x41baea){if(_0x28667d[_0xfae5('0x53')]['id']){delete _0x28667d[_0xfae5('0x53')]['id'];}return db[_0xfae5('0x2f')][_0xfae5('0x49')]({'where':{'id':_0x28667d[_0xfae5('0x46')]['id']}})[_0xfae5('0x26')](handleEntityNotFound(_0x41baea,null))[_0xfae5('0x26')](saveUpdates(_0x28667d[_0xfae5('0x53')],null))['then'](respondWithResult(_0x41baea,null))[_0xfae5('0x4a')](handleError(_0x41baea,null));};exports[_0xfae5('0x27')]=function(_0x1db55e,_0x1b156b){return db[_0xfae5('0x2f')][_0xfae5('0x49')]({'where':{'id':_0x1db55e['params']['id']}})[_0xfae5('0x26')](handleEntityNotFound(_0x1b156b,null))['then'](removeEntity(_0x1b156b,null))[_0xfae5('0x4a')](handleError(_0x1b156b,null));};exports[_0xfae5('0x54')]=function(_0x277557,_0x3570a7){return db[_0xfae5('0x2f')][_0xfae5('0x54')]()[_0xfae5('0x26')](respondWithResult(_0x3570a7,null))[_0xfae5('0x4a')](handleError(_0x3570a7,null));};exports[_0xfae5('0x55')]=function(_0x14f1ac,_0x351429,_0x5df97c){var _0x50afaf={'raw':!![],'where':{}},_0x5159bb={},_0x276776;return db[_0xfae5('0x2f')]['findOne']({'where':{'id':_0x14f1ac[_0xfae5('0x46')]['id']}})[_0xfae5('0x26')](handleEntityNotFound(_0x351429,null))['then'](function(_0xbc981e){if(_0xbc981e){_0x276776=_0xbc981e['get']({'plain':!![]});_0x5159bb[_0xfae5('0x33')]=_['keys'](db[_0xfae5('0x56')]['rawAttributes']);_0x5159bb[_0xfae5('0x35')]=_[_0xfae5('0x47')](_0x14f1ac['query']);_0x5159bb[_0xfae5('0x3d')]=_[_0xfae5('0x34')](_0x5159bb[_0xfae5('0x33')],_0x5159bb[_0xfae5('0x35')]);_0x50afaf['attributes']=_[_0xfae5('0x34')](_0x5159bb[_0xfae5('0x33')],qs[_0xfae5('0x37')](_0x14f1ac[_0xfae5('0x35')][_0xfae5('0x37')]));_0x50afaf['attributes']=_0x50afaf['attributes'][_0xfae5('0x38')]?_0x50afaf['attributes']:_0x5159bb[_0xfae5('0x33')];if(!_0x14f1ac[_0xfae5('0x35')]['hasOwnProperty'](_0xfae5('0x3a'))){_0x50afaf[_0xfae5('0x1e')]=qs[_0xfae5('0x1e')](_0x14f1ac[_0xfae5('0x35')][_0xfae5('0x1e')]);_0x50afaf[_0xfae5('0x1c')]=qs['offset'](_0x14f1ac[_0xfae5('0x35')][_0xfae5('0x1c')]);}_0x50afaf[_0xfae5('0x3b')]=qs['sort'](_0x14f1ac['query'][_0xfae5('0x3c')]);_0x50afaf[_0xfae5('0x42')]=qs[_0xfae5('0x3d')](_['pick'](_0x14f1ac[_0xfae5('0x35')],_0x5159bb[_0xfae5('0x3d')]));_0x50afaf[_0xfae5('0x42')][_0xfae5('0x57')]=_0xbc981e['id'];if(_0x14f1ac[_0xfae5('0x35')]['filter']){_0x50afaf[_0xfae5('0x42')]=_[_0xfae5('0x40')](_0x50afaf[_0xfae5('0x42')],{'$or':_[_0xfae5('0x2e')](_0x50afaf[_0xfae5('0x36')],function(_0x2265c0){var _0x385a73={};_0x385a73[_0x2265c0]={'$like':'%'+_0x14f1ac[_0xfae5('0x35')][_0xfae5('0x3f')]+'%'};return _0x385a73;})});}_0x50afaf=_['merge']({},_0x50afaf,_0x14f1ac[_0xfae5('0x41')]);return db[_0xfae5('0x56')][_0xfae5('0x44')](_0x50afaf);}})['then'](function(_0x3d7d47){if(_0x3d7d47){return db['User'][_0xfae5('0x58')]({'where':{'id':_[_0xfae5('0x2e')](_0x3d7d47,_0xfae5('0x59')),'role':_0xfae5('0x5a')},'attributes':['id',_0xfae5('0x2c'),_0xfae5('0x5b'),'updatedAt',_0xfae5('0x5c')]});}})[_0xfae5('0x26')](function(_0xc86a4e){if(_0xc86a4e){return{'count':_0xc86a4e[_0xfae5('0x1f')],'rows':_[_0xfae5('0x2e')](_0xc86a4e[_0xfae5('0x45')],function(_0x59de77){return{'membername':_0x59de77[_0xfae5('0x2c')],'UserId':_0x59de77['id'],'queue_name':_0x276776[_0xfae5('0x2c')],'WhatsappQueueId':_0x276776['id'],'interface':util[_0xfae5('0x5d')]('%s/%s',_0xfae5('0x5e'),_0x59de77[_0xfae5('0x2c')]),'penalty':0x0,'paused':_0x59de77[_0xfae5('0x5b')],'createdAt':_0x59de77[_0xfae5('0x5c')],'updatedAt':_0x59de77['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfae5('0x26')](respondWithFilteredResult(_0x351429,_0x50afaf))[_0xfae5('0x4a')](handleError(_0x351429,null));};exports['getTeams']=function(_0x263dae,_0x2712f2,_0x4b493d){var _0x1f7b7={};var _0x529380={};var _0x22c3ce;var _0x28f8b0;return db[_0xfae5('0x2f')]['findOne']({'where':{'id':_0x263dae[_0xfae5('0x46')]['id']}})[_0xfae5('0x26')](handleEntityNotFound(_0x2712f2,null))[_0xfae5('0x26')](function(_0x5529c8){if(_0x5529c8){_0x22c3ce=_0x5529c8;_0x529380[_0xfae5('0x33')]=_[_0xfae5('0x47')](db[_0xfae5('0x5f')][_0xfae5('0x30')]);_0x529380['query']=_[_0xfae5('0x47')](_0x263dae['query']);_0x529380[_0xfae5('0x3d')]=_[_0xfae5('0x34')](_0x529380[_0xfae5('0x33')],_0x529380[_0xfae5('0x35')]);_0x1f7b7[_0xfae5('0x36')]=_['intersection'](_0x529380[_0xfae5('0x33')],qs['fields'](_0x263dae['query'][_0xfae5('0x37')]));_0x1f7b7[_0xfae5('0x36')]=_0x1f7b7[_0xfae5('0x36')][_0xfae5('0x38')]?_0x1f7b7[_0xfae5('0x36')]:_0x529380[_0xfae5('0x33')];_0x1f7b7['order']=qs[_0xfae5('0x3c')](_0x263dae[_0xfae5('0x35')][_0xfae5('0x3c')]);_0x1f7b7[_0xfae5('0x42')]=qs[_0xfae5('0x3d')](_[_0xfae5('0x3e')](_0x263dae['query'],_0x529380[_0xfae5('0x3d')]));if(_0x263dae['query'][_0xfae5('0x3f')]){_0x1f7b7[_0xfae5('0x42')]=_[_0xfae5('0x40')](_0x1f7b7['where'],{'$or':_[_0xfae5('0x2e')](_0x1f7b7[_0xfae5('0x36')],function(_0x417d36){var _0x224417={};_0x224417[_0x417d36]={'$like':'%'+_0x263dae[_0xfae5('0x35')][_0xfae5('0x3f')]+'%'};return _0x224417;})});}_0x1f7b7=_[_0xfae5('0x40')]({},_0x1f7b7,_0x263dae[_0xfae5('0x41')]);return _0x22c3ce['getTeams'](_0x1f7b7);}})[_0xfae5('0x26')](function(_0x49368f){if(_0x49368f){_0x28f8b0=_0x49368f[_0xfae5('0x38')];if(!_0x263dae[_0xfae5('0x35')][_0xfae5('0x39')](_0xfae5('0x3a'))){_0x1f7b7[_0xfae5('0x1e')]=qs[_0xfae5('0x1e')](_0x263dae['query'][_0xfae5('0x1e')]);_0x1f7b7['offset']=qs[_0xfae5('0x1c')](_0x263dae[_0xfae5('0x35')][_0xfae5('0x1c')]);}return _0x22c3ce['getTeams'](_0x1f7b7);}})[_0xfae5('0x26')](function(_0x33fc02){if(_0x33fc02){return _0x33fc02?{'count':_0x28f8b0,'rows':_0x33fc02}:null;}})[_0xfae5('0x26')](respondWithResult(_0x2712f2,null))[_0xfae5('0x4a')](handleError(_0x2712f2,null));};exports[_0xfae5('0x60')]=function(_0x111e54,_0x2019e3,_0x36a7a5){var _0xf38bf0=_0x111e54[_0xfae5('0x53')]['ids'];return db[_0xfae5('0x5f')]['findAll']({'where':{'id':_0xf38bf0},'attributes':['id'],'include':[{'model':db[_0xfae5('0x61')],'as':_0xfae5('0x62'),'attributes':['id',_0xfae5('0x2c'),_0xfae5('0x63'),_0xfae5('0x64'),_0xfae5('0x65')],'raw':!![]}]})[_0xfae5('0x26')](function(_0x2f8b1c){if(_0x2f8b1c){var _0x4844a0=_[_0xfae5('0x66')](_0x2f8b1c,function(_0x2718a3){var _0x41740f=_0x2718a3[_0xfae5('0x4d')]({'plain':!![]});return _0x41740f[_0xfae5('0x62')];});return db[_0xfae5('0x2f')][_0xfae5('0x49')]({'where':{'id':_0x111e54[_0xfae5('0x46')]['id']}})[_0xfae5('0x26')](function(_0x3df954){return db[_0xfae5('0x67')][_0xfae5('0x68')](function(_0x4eeecb){return _0x3df954[_0xfae5('0x60')](_0xf38bf0,{'transaction':_0x4eeecb})[_0xfae5('0x26')](function(){return BPromise[_0xfae5('0x69')](_0x4844a0,function(_0x4161ff){return db[_0xfae5('0x56')][_0xfae5('0x6a')]({'where':{'UserId':_0x4161ff['id'],'WhatsappQueueId':_0x111e54[_0xfae5('0x46')]['id']},'transaction':_0x4eeecb});});})[_0xfae5('0x26')](function(){_0x4844a0[_0xfae5('0x6b')](function(_0x318939){socket[_0xfae5('0x6c')]('userWhatsappQueue:save',{'UserId':_0x318939['id'],'WhatsappQueueId':_0x3df954['id']});});});});});}})[_0xfae5('0x26')](respondWithStatusCode(_0x2019e3,null))['catch'](handleError(_0x2019e3,null));};exports['removeTeams']=function(_0xadab1,_0x1b5ed0,_0x1e0bf1){return db[_0xfae5('0x5f')][_0xfae5('0x44')]({'where':{'id':_0xadab1[_0xfae5('0x35')][_0xfae5('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xfae5('0x61')],'as':_0xfae5('0x62'),'attributes':['id'],'raw':!![]}]})[_0xfae5('0x26')](handleEntityNotFound(_0x1b5ed0,null))[_0xfae5('0x26')](function(_0x10b053){var _0x3db451=_['map'](_0x10b053,'id');var _0x335508=[];var _0x3abcb2=[];var _0x52a9a0=squel[_0xfae5('0x6e')]();_0x52a9a0[_0xfae5('0x6f')](_0xfae5('0x70'))['from'](_0xfae5('0x71'),'tq')[_0xfae5('0x72')](_0xfae5('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfae5('0x42')](_0xfae5('0x74'),_0xadab1['params']['id']);for(var _0x5123b4=0x0;_0x5123b4<_0x10b053[_0xfae5('0x38')];_0x5123b4+=0x1){let _0x443154=_0x10b053[_0x5123b4];for(var _0x42fe49=0x0;_0x42fe49<_0x443154[_0xfae5('0x62')]['length'];_0x42fe49+=0x1){let _0x4d5c4f=_0x443154[_0xfae5('0x62')][_0x42fe49];var _0xc65788=_0x52a9a0[_0xfae5('0x75')]();_0xc65788['where']('ut.UserId\x20=\x20?',_0x4d5c4f['id']);_0x3abcb2[_0xfae5('0x76')](db[_0xfae5('0x67')][_0xfae5('0x35')](_0xc65788[_0xfae5('0x77')](),{'type':db['sequelize'][_0xfae5('0x78')][_0xfae5('0x79')]})['then'](function(_0x11af2c){if(_0x11af2c[_0xfae5('0x38')]===0x1){return _0x4d5c4f['id'];}else{var _0x16a6d6=_[_0xfae5('0x7a')](_[_0xfae5('0x2e')](_0x11af2c,_0xfae5('0x7b')),function(_0x631c9){return _[_0xfae5('0x7c')](_0x3db451,_0x631c9);});if(_0x16a6d6){return _0x4d5c4f['id'];}}}));}}return BPromise[_0xfae5('0x7d')](_0x3abcb2)[_0xfae5('0x26')](function(_0x21b026){_0x335508=_(_0x335508)[_0xfae5('0x7e')](_0x21b026)[_0xfae5('0x7f')]()[_0xfae5('0x80')]();return db[_0xfae5('0x2f')][_0xfae5('0x49')]({'where':{'id':_0xadab1[_0xfae5('0x46')]['id']}})[_0xfae5('0x26')](function(_0x41c8a7){return db[_0xfae5('0x67')][_0xfae5('0x68')](function(_0x35ce0a){return _0x41c8a7['removeTeams'](_0xadab1[_0xfae5('0x35')][_0xfae5('0x6d')],{'transaction':_0x35ce0a})[_0xfae5('0x26')](function(){if(!_[_0xfae5('0x81')](_0x335508)){return _0x41c8a7['removeAgents'](_0x335508,{'transaction':_0x35ce0a});}})['then'](function(){_0x335508[_0xfae5('0x6b')](function(_0x284a13){socket[_0xfae5('0x6c')](_0xfae5('0x82'),{'UserId':_0x284a13,'WhatsappQueueId':_0x41c8a7['id']});});});});});});})[_0xfae5('0x26')](respondWithStatusCode(_0x1b5ed0,null))['catch'](handleError(_0x1b5ed0,null));};exports[_0xfae5('0x83')]=function(_0x30f56f,_0x239594,_0x28d580){return db[_0xfae5('0x2f')][_0xfae5('0x49')]({'where':{'id':_0x30f56f[_0xfae5('0x46')]['id']}})[_0xfae5('0x26')](handleEntityNotFound(_0x239594,null))[_0xfae5('0x26')](function(_0x2f1b07){if(_0x2f1b07){return _0x2f1b07[_0xfae5('0x83')](_0x30f56f[_0xfae5('0x53')][_0xfae5('0x6d')],_['omit'](_0x30f56f[_0xfae5('0x53')],[_0xfae5('0x6d'),'id'])||{})[_0xfae5('0x84')](function(_0x214126){for(var _0x1276b8=0x0;_0x1276b8<_0x30f56f[_0xfae5('0x53')][_0xfae5('0x6d')][_0xfae5('0x38')];_0x1276b8+=0x1){socket[_0xfae5('0x6c')](_0xfae5('0x85'),{'UserId':Number(_0x30f56f['body'][_0xfae5('0x6d')][_0x1276b8]),'WhatsappQueueId':Number(_0x30f56f[_0xfae5('0x46')]['id'])});}return _0x214126;});}})[_0xfae5('0x26')](respondWithResult(_0x239594,null))['catch'](handleError(_0x239594,null));};exports['removeAgents']=function(_0x2d20df,_0x486216,_0x2d38e7){return db[_0xfae5('0x2f')][_0xfae5('0x49')]({'where':{'id':_0x2d20df[_0xfae5('0x46')]['id']}})['then'](handleEntityNotFound(_0x486216,null))[_0xfae5('0x26')](function(_0x16c608){if(_0x16c608){return _0x16c608['removeAgents'](_0x2d20df[_0xfae5('0x35')][_0xfae5('0x6d')])[_0xfae5('0x26')](function(){if(_['isArray'](_0x2d20df[_0xfae5('0x35')][_0xfae5('0x6d')])){for(var _0x56169f=0x0;_0x56169f<_0x2d20df[_0xfae5('0x35')]['ids'][_0xfae5('0x38')];_0x56169f+=0x1){socket['emit'](_0xfae5('0x82'),{'UserId':Number(_0x2d20df[_0xfae5('0x35')][_0xfae5('0x6d')][_0x56169f]),'WhatsappQueueId':Number(_0x2d20df[_0xfae5('0x46')]['id'])});}}else{socket[_0xfae5('0x6c')](_0xfae5('0x82'),{'UserId':Number(_0x2d20df[_0xfae5('0x35')][_0xfae5('0x6d')]),'WhatsappQueueId':Number(_0x2d20df['params']['id'])});}});}})['then'](respondWithStatusCode(_0x486216,null))[_0xfae5('0x4a')](handleError(_0x486216,null));};exports['getAgents']=function(_0x1435d1,_0x41dde7,_0x38d744){var _0x3ef8fd={};var _0x1703fc={};var _0x5883ef;var _0x26baa2;return db[_0xfae5('0x2f')][_0xfae5('0x86')]({'where':{'id':_0x1435d1[_0xfae5('0x46')]['id']}})['then'](handleEntityNotFound(_0x41dde7,null))[_0xfae5('0x26')](function(_0x424d87){if(_0x424d87){_0x5883ef=_0x424d87;_0x1703fc['model']=_[_0xfae5('0x47')](db[_0xfae5('0x61')]['rawAttributes']);_0x1703fc[_0xfae5('0x35')]=_['keys'](_0x1435d1[_0xfae5('0x35')]);_0x1703fc[_0xfae5('0x3d')]=_[_0xfae5('0x34')](_0x1703fc[_0xfae5('0x33')],_0x1703fc[_0xfae5('0x35')]);_0x3ef8fd[_0xfae5('0x36')]=_[_0xfae5('0x34')](_0x1703fc[_0xfae5('0x33')],qs[_0xfae5('0x37')](_0x1435d1[_0xfae5('0x35')]['fields']));_0x3ef8fd[_0xfae5('0x36')]=_0x3ef8fd[_0xfae5('0x36')][_0xfae5('0x38')]?_0x3ef8fd[_0xfae5('0x36')]:_0x1703fc[_0xfae5('0x33')];_0x3ef8fd[_0xfae5('0x3b')]=qs[_0xfae5('0x3c')](_0x1435d1[_0xfae5('0x35')]['sort']);_0x3ef8fd[_0xfae5('0x42')]=qs[_0xfae5('0x3d')](_['pick'](_0x1435d1[_0xfae5('0x35')],_0x1703fc['filters']));if(_0x1435d1[_0xfae5('0x35')]['filter']){_0x3ef8fd['where']=_['merge'](_0x3ef8fd[_0xfae5('0x42')],{'$or':_['map'](_0x3ef8fd[_0xfae5('0x36')],function(_0x2f4825){var _0x8ae0a7={};_0x8ae0a7[_0x2f4825]={'$like':'%'+_0x1435d1[_0xfae5('0x35')][_0xfae5('0x3f')]+'%'};return _0x8ae0a7;})});}_0x3ef8fd=_[_0xfae5('0x40')]({},_0x3ef8fd,_0x1435d1[_0xfae5('0x41')]);return _0x5883ef[_0xfae5('0x87')](_0x3ef8fd);}})[_0xfae5('0x26')](function(_0x39e025){if(_0x39e025){_0x26baa2=_0x39e025[_0xfae5('0x38')];if(!_0x1435d1[_0xfae5('0x35')][_0xfae5('0x39')]('nolimit')){_0x3ef8fd[_0xfae5('0x1e')]=qs[_0xfae5('0x1e')](_0x1435d1[_0xfae5('0x35')]['limit']);_0x3ef8fd[_0xfae5('0x1c')]=qs['offset'](_0x1435d1[_0xfae5('0x35')][_0xfae5('0x1c')]);}return _0x5883ef[_0xfae5('0x87')](_0x3ef8fd);}})['then'](function(_0x6bed41){if(_0x6bed41){return _0x6bed41?{'count':_0x26baa2,'rows':_0x6bed41}:null;}})[_0xfae5('0x26')](respondWithResult(_0x41dde7,null))[_0xfae5('0x4a')](handleError(_0x41dde7,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 23dc1f0..cbd0df8 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 _0x52b7=['update','remove','emit','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save'];(function(_0x16444a,_0x799ede){var _0x26c452=function(_0x116688){while(--_0x116688){_0x16444a['push'](_0x16444a['shift']());}};_0x26c452(++_0x799ede);}(_0x52b7,0x1ef));var _0x752b=function(_0x59dc5e,_0x389949){_0x59dc5e=_0x59dc5e-0x0;var _0x7b1e0d=_0x52b7[_0x59dc5e];return _0x7b1e0d;};'use strict';var EventEmitter=require(_0x752b('0x0'));var WhatsappQueue=require(_0x752b('0x1'))['db'][_0x752b('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x752b('0x3')](0x0);var events={'afterCreate':_0x752b('0x4'),'afterUpdate':_0x752b('0x5'),'afterDestroy':_0x752b('0x6')};function emitEvent(_0x4dac23){return function(_0x67e0fe,_0x15b069,_0x3431fe){WhatsappQueueEvents[_0x752b('0x7')](_0x4dac23+':'+_0x67e0fe['id'],_0x67e0fe);WhatsappQueueEvents[_0x752b('0x7')](_0x4dac23,_0x67e0fe);_0x3431fe(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x752b('0x8')](e,emitEvent(event));}}module[_0x752b('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x2c05=['exports','setMaxListeners','update','remove','emit'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x2c05,0x92));var _0x52c0=function(_0x3bf281,_0x506103){_0x3bf281=_0x3bf281-0x0;var _0x5697c9=_0x2c05[_0x3bf281];return _0x5697c9;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x52c0('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x52c0('0x1'),'afterDestroy':_0x52c0('0x2')};function emitEvent(_0x5afa21){return function(_0x4624c3,_0x23d4e2,_0x190ddf){WhatsappQueueEvents[_0x52c0('0x3')](_0x5afa21+':'+_0x4624c3['id'],_0x4624c3);WhatsappQueueEvents[_0x52c0('0x3')](_0x5afa21,_0x4624c3);_0x190ddf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x52c0('0x4')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 6035a2e..8ea39de 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 _0x877b=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappQueue'];(function(_0x48b9ad,_0x292030){var _0x3a5eb3=function(_0x10e3a8){while(--_0x10e3a8){_0x48b9ad['push'](_0x48b9ad['shift']());}};_0x3a5eb3(++_0x292030);}(_0x877b,0x1e0));var _0xb877=function(_0x559d65,_0x4fa478){_0x559d65=_0x559d65-0x0;var _0x2ba4cd=_0x877b[_0x559d65];return _0x2ba4cd;};'use strict';var _=require(_0xb877('0x0'));var util=require(_0xb877('0x1'));var logger=require(_0xb877('0x2'))('api');var moment=require(_0xb877('0x3'));var BPromise=require(_0xb877('0x4'));var rp=require(_0xb877('0x5'));var fs=require('fs');var path=require(_0xb877('0x6'));var rimraf=require(_0xb877('0x7'));var config=require(_0xb877('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0xb877('0x9')]=function(_0x4e3e8e,_0x49906d){return _0x4e3e8e[_0xb877('0xa')](_0xb877('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd455=['whatsapp_queues','lodash','api','moment','path','rimraf','./whatsappQueue.attributes','define','WhatsappQueue'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd455,0xeb));var _0x5d45=function(_0x4f73f9,_0x66c021){_0x4f73f9=_0x4f73f9-0x0;var _0x59f8aa=_0xd455[_0x4f73f9];return _0x59f8aa;};'use strict';var _=require(_0x5d45('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5d45('0x1'));var moment=require(_0x5d45('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d45('0x3'));var rimraf=require(_0x5d45('0x4'));var config=require('../../config/environment');var attributes=require(_0x5d45('0x5'));module['exports']=function(_0x15fdab,_0x197df0){return _0x15fdab[_0x5d45('0x6')](_0x5d45('0x7'),attributes,{'tableName':_0x5d45('0x8'),'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 b61cd38..befd923 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 _0x2da5=['include','model','map','attributes','GetWhatsappQueue','catch','ShowWhatsappQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','WhatsappQueue','findAll','options','where','limit'];(function(_0x770ba6,_0x3bba7b){var _0x54871f=function(_0x567de6){while(--_0x567de6){_0x770ba6['push'](_0x770ba6['shift']());}};_0x54871f(++_0x3bba7b);}(_0x2da5,0x1f4));var _0x52da=function(_0x46b48d,_0x106032){_0x46b48d=_0x46b48d-0x0;var _0xc7cd5=_0x2da5[_0x46b48d];return _0xc7cd5;};'use strict';var _=require(_0x52da('0x0'));var util=require(_0x52da('0x1'));var moment=require('moment');var BPromise=require(_0x52da('0x2'));var rs=require(_0x52da('0x3'));var fs=require('fs');var Redis=require(_0x52da('0x4'));var db=require(_0x52da('0x5'))['db'];var utils=require(_0x52da('0x6'));var logger=require(_0x52da('0x7'))(_0x52da('0x8'));var config=require('../../config/environment');var jayson=require(_0x52da('0x9'));var client=jayson[_0x52da('0xa')]['http']({'port':0x232a});config[_0x52da('0xb')]=_['defaults'](config[_0x52da('0xb')],{'host':_0x52da('0xc'),'port':0x18eb});var socket=require(_0x52da('0xd'))(new Redis(config[_0x52da('0xb')]));require(_0x52da('0xe'))[_0x52da('0xf')](socket);function respondWithRpcPromise(_0xf02696,_0x19fe40,_0x3056a2){return new BPromise(function(_0x542afc,_0xd10a90){return client[_0x52da('0x10')](_0xf02696,_0x3056a2)[_0x52da('0x11')](function(_0x541c8e){logger['info'](_0x52da('0x12'),_0x19fe40,_0x52da('0x13'));logger[_0x52da('0x14')](_0x52da('0x15'),_0x19fe40,'request\x20sent',JSON[_0x52da('0x16')](_0x541c8e));if(_0x541c8e[_0x52da('0x17')]){if(_0x541c8e[_0x52da('0x17')][_0x52da('0x18')]===0x1f4){logger[_0x52da('0x17')](_0x52da('0x12'),_0x19fe40,_0x541c8e[_0x52da('0x17')]['message']);return _0xd10a90(_0x541c8e[_0x52da('0x17')][_0x52da('0x19')]);}logger[_0x52da('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x19fe40,_0x541c8e['error'][_0x52da('0x19')]);return _0x542afc(_0x541c8e[_0x52da('0x17')]['message']);}else{logger[_0x52da('0x1a')](_0x52da('0x12'),_0x19fe40,_0x52da('0x13'));_0x542afc(_0x541c8e[_0x52da('0x1b')]['message']);}})['catch'](function(_0x19196c){logger[_0x52da('0x17')](_0x52da('0x12'),_0x19fe40,_0x19196c);_0xd10a90(_0x19196c);});});}exports['GetWhatsappQueue']=function(_0x56a04c){var _0x10221a=this;return new Promise(function(_0x3e28e8,_0x2fe01f){return db[_0x52da('0x1c')][_0x52da('0x1d')]({'raw':_0x56a04c[_0x52da('0x1e')]?_0x56a04c[_0x52da('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x56a04c['options']?_0x56a04c[_0x52da('0x1e')][_0x52da('0x1f')]||null:null,'attributes':_0x56a04c[_0x52da('0x1e')]?_0x56a04c[_0x52da('0x1e')]['attributes']||null:null,'limit':_0x56a04c[_0x52da('0x1e')]?_0x56a04c['options'][_0x52da('0x20')]||null:null,'include':_0x56a04c[_0x52da('0x1e')]?_0x56a04c[_0x52da('0x1e')][_0x52da('0x21')]?_['map'](_0x56a04c['options'][_0x52da('0x21')],function(_0x1190d1){return{'model':db[_0x1190d1[_0x52da('0x22')]],'as':_0x1190d1['as'],'attributes':_0x1190d1['attributes'],'include':_0x1190d1[_0x52da('0x21')]?_[_0x52da('0x23')](_0x1190d1['include'],function(_0x57405f){return{'model':db[_0x57405f[_0x52da('0x22')]],'as':_0x57405f['as'],'attributes':_0x57405f['attributes'],'include':_0x57405f[_0x52da('0x21')]?_[_0x52da('0x23')](_0x57405f['include'],function(_0x4ec7f9){return{'model':db[_0x4ec7f9[_0x52da('0x22')]],'as':_0x4ec7f9['as'],'attributes':_0x4ec7f9[_0x52da('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f056){logger[_0x52da('0x1a')](_0x52da('0x25'),_0x56a04c);logger[_0x52da('0x14')](_0x52da('0x25'),_0x56a04c,JSON[_0x52da('0x16')](_0x4f056));_0x3e28e8(_0x4f056);})[_0x52da('0x26')](function(_0x4451e2){logger[_0x52da('0x17')](_0x52da('0x25'),_0x4451e2[_0x52da('0x19')],_0x56a04c);_0x2fe01f(_0x10221a[_0x52da('0x17')](0x1f4,_0x4451e2[_0x52da('0x19')]));});});};exports[_0x52da('0x27')]=function(_0x2444e9){var _0x47c046=this;return new Promise(function(_0x41ae17,_0x46ff95){return db['WhatsappQueue'][_0x52da('0x28')]({'raw':_0x2444e9[_0x52da('0x1e')]?_0x2444e9[_0x52da('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2444e9[_0x52da('0x1e')]?_0x2444e9[_0x52da('0x1e')][_0x52da('0x1f')]||null:null,'attributes':_0x2444e9['options']?_0x2444e9[_0x52da('0x1e')]['attributes']||null:null,'include':_0x2444e9[_0x52da('0x1e')]?_0x2444e9[_0x52da('0x1e')][_0x52da('0x21')]?_[_0x52da('0x23')](_0x2444e9[_0x52da('0x1e')][_0x52da('0x21')],function(_0x4b9fe5){return{'model':db[_0x4b9fe5[_0x52da('0x22')]],'as':_0x4b9fe5['as'],'attributes':_0x4b9fe5['attributes'],'include':_0x4b9fe5[_0x52da('0x21')]?_[_0x52da('0x23')](_0x4b9fe5[_0x52da('0x21')],function(_0x38e191){return{'model':db[_0x38e191['model']],'as':_0x38e191['as'],'attributes':_0x38e191[_0x52da('0x24')],'include':_0x38e191['include']?_[_0x52da('0x23')](_0x38e191['include'],function(_0x5de080){return{'model':db[_0x5de080['model']],'as':_0x5de080['as'],'attributes':_0x5de080[_0x52da('0x24')]};}):[]};}):[]};}):[]:[]})[_0x52da('0x11')](function(_0x32e8b2){logger['info'](_0x52da('0x27'),_0x2444e9);logger[_0x52da('0x14')](_0x52da('0x27'),_0x2444e9,JSON['stringify'](_0x32e8b2));_0x41ae17(_0x32e8b2);})[_0x52da('0x26')](function(_0x174bdb){logger[_0x52da('0x17')](_0x52da('0x27'),_0x174bdb[_0x52da('0x19')],_0x2444e9);_0x46ff95(_0x47c046['error'](0x1f4,_0x174bdb[_0x52da('0x19')]));});});}; \ No newline at end of file +var _0xcb8d=['where','ShowWhatsappQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','find'];(function(_0x1e0144,_0x1528e3){var _0x172a14=function(_0x3ab22e){while(--_0x3ab22e){_0x1e0144['push'](_0x1e0144['shift']());}};_0x172a14(++_0x1528e3);}(_0xcb8d,0x14a));var _0xdcb8=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0xcb8d[_0x3c22e0];return _0x215811;};'use strict';var _=require(_0xdcb8('0x0'));var util=require(_0xdcb8('0x1'));var moment=require(_0xdcb8('0x2'));var BPromise=require('bluebird');var rs=require(_0xdcb8('0x3'));var fs=require('fs');var Redis=require(_0xdcb8('0x4'));var db=require(_0xdcb8('0x5'))['db'];var utils=require(_0xdcb8('0x6'));var logger=require('../../config/logger')(_0xdcb8('0x7'));var config=require(_0xdcb8('0x8'));var jayson=require(_0xdcb8('0x9'));var client=jayson['client'][_0xdcb8('0xa')]({'port':0x232a});config[_0xdcb8('0xb')]=_['defaults'](config[_0xdcb8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xdcb8('0xc'))(new Redis(config['redis']));require(_0xdcb8('0xd'))[_0xdcb8('0xe')](socket);function respondWithRpcPromise(_0x5e1b7f,_0xc2c052,_0x4b7275){return new BPromise(function(_0xb1a414,_0x25876d){return client[_0xdcb8('0xf')](_0x5e1b7f,_0x4b7275)[_0xdcb8('0x10')](function(_0x5558ab){logger[_0xdcb8('0x11')](_0xdcb8('0x12'),_0xc2c052,_0xdcb8('0x13'));logger[_0xdcb8('0x14')](_0xdcb8('0x15'),_0xc2c052,_0xdcb8('0x13'),JSON[_0xdcb8('0x16')](_0x5558ab));if(_0x5558ab['error']){if(_0x5558ab['error'][_0xdcb8('0x17')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0xc2c052,_0x5558ab['error'][_0xdcb8('0x18')]);return _0x25876d(_0x5558ab[_0xdcb8('0x19')]['message']);}logger[_0xdcb8('0x19')](_0xdcb8('0x12'),_0xc2c052,_0x5558ab[_0xdcb8('0x19')]['message']);return _0xb1a414(_0x5558ab[_0xdcb8('0x19')]['message']);}else{logger[_0xdcb8('0x11')](_0xdcb8('0x12'),_0xc2c052,_0xdcb8('0x13'));_0xb1a414(_0x5558ab[_0xdcb8('0x1a')][_0xdcb8('0x18')]);}})[_0xdcb8('0x1b')](function(_0x40d7e5){logger[_0xdcb8('0x19')](_0xdcb8('0x12'),_0xc2c052,_0x40d7e5);_0x25876d(_0x40d7e5);});});}exports[_0xdcb8('0x1c')]=function(_0x5b69a1){var _0x5f5251=this;return new Promise(function(_0x46f2b1,_0x2f4d5f){return db[_0xdcb8('0x1d')][_0xdcb8('0x1e')]({'raw':_0x5b69a1[_0xdcb8('0x1f')]?_0x5b69a1['options'][_0xdcb8('0x20')]===undefined?!![]:![]:!![],'where':_0x5b69a1[_0xdcb8('0x1f')]?_0x5b69a1[_0xdcb8('0x1f')]['where']||null:null,'attributes':_0x5b69a1[_0xdcb8('0x1f')]?_0x5b69a1[_0xdcb8('0x1f')][_0xdcb8('0x21')]||null:null,'limit':_0x5b69a1['options']?_0x5b69a1[_0xdcb8('0x1f')][_0xdcb8('0x22')]||null:null,'include':_0x5b69a1[_0xdcb8('0x1f')]?_0x5b69a1[_0xdcb8('0x1f')][_0xdcb8('0x23')]?_[_0xdcb8('0x24')](_0x5b69a1[_0xdcb8('0x1f')][_0xdcb8('0x23')],function(_0x3c568f){return{'model':db[_0x3c568f[_0xdcb8('0x25')]],'as':_0x3c568f['as'],'attributes':_0x3c568f[_0xdcb8('0x21')],'include':_0x3c568f[_0xdcb8('0x23')]?_['map'](_0x3c568f['include'],function(_0x44d7cf){return{'model':db[_0x44d7cf[_0xdcb8('0x25')]],'as':_0x44d7cf['as'],'attributes':_0x44d7cf[_0xdcb8('0x21')],'include':_0x44d7cf[_0xdcb8('0x23')]?_[_0xdcb8('0x24')](_0x44d7cf[_0xdcb8('0x23')],function(_0x390035){return{'model':db[_0x390035[_0xdcb8('0x25')]],'as':_0x390035['as'],'attributes':_0x390035[_0xdcb8('0x21')]};}):[]};}):[]};}):[]:[]})[_0xdcb8('0x10')](function(_0x4d4de1){logger[_0xdcb8('0x11')](_0xdcb8('0x1c'),_0x5b69a1);logger[_0xdcb8('0x14')](_0xdcb8('0x1c'),_0x5b69a1,JSON[_0xdcb8('0x16')](_0x4d4de1));_0x46f2b1(_0x4d4de1);})[_0xdcb8('0x1b')](function(_0x5ace1a){logger[_0xdcb8('0x19')](_0xdcb8('0x1c'),_0x5ace1a['message'],_0x5b69a1);_0x2f4d5f(_0x5f5251['error'](0x1f4,_0x5ace1a[_0xdcb8('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x3c3318){var _0x335928=this;return new Promise(function(_0x333f8f,_0x1326c3){return db[_0xdcb8('0x1d')][_0xdcb8('0x26')]({'raw':_0x3c3318[_0xdcb8('0x1f')]?_0x3c3318[_0xdcb8('0x1f')][_0xdcb8('0x20')]===undefined?!![]:![]:!![],'where':_0x3c3318[_0xdcb8('0x1f')]?_0x3c3318[_0xdcb8('0x1f')][_0xdcb8('0x27')]||null:null,'attributes':_0x3c3318[_0xdcb8('0x1f')]?_0x3c3318[_0xdcb8('0x1f')]['attributes']||null:null,'include':_0x3c3318['options']?_0x3c3318[_0xdcb8('0x1f')][_0xdcb8('0x23')]?_['map'](_0x3c3318[_0xdcb8('0x1f')][_0xdcb8('0x23')],function(_0x4b2e90){return{'model':db[_0x4b2e90['model']],'as':_0x4b2e90['as'],'attributes':_0x4b2e90[_0xdcb8('0x21')],'include':_0x4b2e90[_0xdcb8('0x23')]?_[_0xdcb8('0x24')](_0x4b2e90[_0xdcb8('0x23')],function(_0x6cf8fe){return{'model':db[_0x6cf8fe['model']],'as':_0x6cf8fe['as'],'attributes':_0x6cf8fe['attributes'],'include':_0x6cf8fe['include']?_[_0xdcb8('0x24')](_0x6cf8fe[_0xdcb8('0x23')],function(_0xcbc362){return{'model':db[_0xcbc362[_0xdcb8('0x25')]],'as':_0xcbc362['as'],'attributes':_0xcbc362['attributes']};}):[]};}):[]};}):[]:[]})[_0xdcb8('0x10')](function(_0x425034){logger['info'](_0xdcb8('0x28'),_0x3c3318);logger[_0xdcb8('0x14')](_0xdcb8('0x28'),_0x3c3318,JSON[_0xdcb8('0x16')](_0x425034));_0x333f8f(_0x425034);})[_0xdcb8('0x1b')](function(_0x304103){logger[_0xdcb8('0x19')]('ShowWhatsappQueue',_0x304103['message'],_0x3c3318);_0x1326c3(_0x335928['error'](0x1f4,_0x304103[_0xdcb8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 08ce8ac..256b96e 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 _0xbb9e=['remove','update','emit','removeListener','register','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x110adc,_0x1d1bc9){var _0x38a6c2=function(_0x9bafde){while(--_0x9bafde){_0x110adc['push'](_0x110adc['shift']());}};_0x38a6c2(++_0x1d1bc9);}(_0xbb9e,0x14e));var _0xebb9=function(_0x64b82c,_0x4f5e25){_0x64b82c=_0x64b82c-0x0;var _0x55c064=_0xbb9e[_0x64b82c];return _0x55c064;};'use strict';var WhatsappQueueEvents=require(_0xebb9('0x0'));var events=[_0xebb9('0x1'),_0xebb9('0x2'),_0xebb9('0x3')];function createListener(_0x25ca6b,_0x5c90df){return function(_0x326404){_0x5c90df[_0xebb9('0x4')](_0x25ca6b,_0x326404);};}function removeListener(_0x1c01b7,_0x306034){return function(){WhatsappQueueEvents[_0xebb9('0x5')](_0x1c01b7,_0x306034);};}exports[_0xebb9('0x6')]=function(_0x5570f5){for(var _0x43ad90=0x0,_0x581635=events['length'];_0x43ad90<_0x581635;_0x43ad90++){var _0x430f48=events[_0x43ad90];var _0x1608b7=createListener(_0xebb9('0x7')+_0x430f48,_0x5570f5);WhatsappQueueEvents['on'](_0x430f48,_0x1608b7);}}; \ No newline at end of file +var _0x95cd=['emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x38a6f0,_0x524eb7){var _0x58fca6=function(_0x166427){while(--_0x166427){_0x38a6f0['push'](_0x38a6f0['shift']());}};_0x58fca6(++_0x524eb7);}(_0x95cd,0x1e2));var _0xd95c=function(_0x9bac45,_0x2a7252){_0x9bac45=_0x9bac45-0x0;var _0x5936bf=_0x95cd[_0x9bac45];return _0x5936bf;};'use strict';var WhatsappQueueEvents=require(_0xd95c('0x0'));var events=[_0xd95c('0x1'),_0xd95c('0x2'),_0xd95c('0x3')];function createListener(_0x2a2eb3,_0x1fcc5e){return function(_0x3cf420){_0x1fcc5e[_0xd95c('0x4')](_0x2a2eb3,_0x3cf420);};}function removeListener(_0x5dbdb9,_0x2d6b94){return function(){WhatsappQueueEvents[_0xd95c('0x5')](_0x5dbdb9,_0x2d6b94);};}exports[_0xd95c('0x6')]=function(_0x8c6b84){for(var _0x15edcd=0x0,_0x5171e7=events[_0xd95c('0x7')];_0x15edcd<_0x5171e7;_0x15edcd++){var _0xc2d5ad=events[_0x15edcd];var _0xae3cff=createListener(_0xd95c('0x8')+_0xc2d5ad,_0x8c6b84);WhatsappQueueEvents['on'](_0xc2d5ad,_0xae3cff);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 05f94bf..0358412 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 _0xe2a5=['/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./whatsappQueueReport.controller','get','isAuthenticated','index','describe','show','post','create','put'];(function(_0x1bdcb8,_0x3d29e4){var _0x56e7d3=function(_0x6b1e05){while(--_0x6b1e05){_0x1bdcb8['push'](_0x1bdcb8['shift']());}};_0x56e7d3(++_0x3d29e4);}(_0xe2a5,0x1a9));var _0x5e2a=function(_0x36f581,_0x5d0d2e){_0x36f581=_0x36f581-0x0;var _0x3c59aa=_0xe2a5[_0x36f581];return _0x3c59aa;};'use strict';var multer=require('multer');var util=require(_0x5e2a('0x0'));var path=require(_0x5e2a('0x1'));var timeout=require(_0x5e2a('0x2'));var express=require(_0x5e2a('0x3'));var router=express['Router']();var fs_extra=require(_0x5e2a('0x4'));var auth=require(_0x5e2a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5e2a('0x6'));router[_0x5e2a('0x7')]('/',auth[_0x5e2a('0x8')](),controller[_0x5e2a('0x9')]);router['get']('/describe',auth[_0x5e2a('0x8')](),controller[_0x5e2a('0xa')]);router[_0x5e2a('0x7')]('/:id',auth[_0x5e2a('0x8')](),controller[_0x5e2a('0xb')]);router[_0x5e2a('0xc')]('/',auth[_0x5e2a('0x8')](),controller[_0x5e2a('0xd')]);router[_0x5e2a('0xe')](_0x5e2a('0xf'),auth[_0x5e2a('0x8')](),controller[_0x5e2a('0x10')]);router[_0x5e2a('0x11')](_0x5e2a('0xf'),auth[_0x5e2a('0x8')](),controller[_0x5e2a('0x12')]);module[_0x5e2a('0x13')]=router; \ No newline at end of file +var _0x6864=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x56876b,_0x147486){var _0x42d937=function(_0x556047){while(--_0x556047){_0x56876b['push'](_0x56876b['shift']());}};_0x42d937(++_0x147486);}(_0x6864,0x80));var _0x4686=function(_0x2f503a,_0x45b520){_0x2f503a=_0x2f503a-0x0;var _0x650fdd=_0x6864[_0x2f503a];return _0x650fdd;};'use strict';var multer=require(_0x4686('0x0'));var util=require(_0x4686('0x1'));var path=require(_0x4686('0x2'));var timeout=require(_0x4686('0x3'));var express=require('express');var router=express[_0x4686('0x4')]();var fs_extra=require(_0x4686('0x5'));var auth=require(_0x4686('0x6'));var interaction=require(_0x4686('0x7'));var config=require(_0x4686('0x8'));var controller=require(_0x4686('0x9'));router[_0x4686('0xa')]('/',auth[_0x4686('0xb')](),controller[_0x4686('0xc')]);router['get'](_0x4686('0xd'),auth['isAuthenticated'](),controller[_0x4686('0xe')]);router[_0x4686('0xa')](_0x4686('0xf'),auth['isAuthenticated'](),controller[_0x4686('0x10')]);router[_0x4686('0x11')]('/',auth[_0x4686('0xb')](),controller[_0x4686('0x12')]);router['put'](_0x4686('0xf'),auth[_0x4686('0xb')](),controller['update']);router[_0x4686('0x13')]('/:id',auth[_0x4686('0xb')](),controller[_0x4686('0x14')]);module[_0x4686('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 4efcd82..7412c18 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 _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x54697f,_0x4a58b5){var _0x373d17=function(_0x2fb678){while(--_0x2fb678){_0x54697f['push'](_0x54697f['shift']());}};_0x373d17(++_0x4a58b5);}(_0x7a54,0x106));var _0x47a5=function(_0x5ad061,_0x57658b){_0x5ad061=_0x5ad061-0x0;var _0x50fdf6=_0x7a54[_0x5ad061];return _0x50fdf6;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x373f6c,_0x2731b1){var _0x5c64a7=function(_0x81b3e){while(--_0x81b3e){_0x373f6c['push'](_0x373f6c['shift']());}};_0x5c64a7(++_0x2731b1);}(_0x7a54,0x106));var _0x47a5=function(_0x2a36ba,_0x434232){_0x2a36ba=_0x2a36ba-0x0;var _0x129eb7=_0x7a54[_0x2a36ba];return _0x129eb7;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 1f2f7df..4e93ac4 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 _0xe1e3=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','offset','limit','count','status','set','Content-Range','apply','reject','destroy','then','end','name','index','map','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','WhatsappQueueReport','includeAll','include','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','util'];(function(_0x2a1e2d,_0x195473){var _0x32b8cc=function(_0x57582d){while(--_0x57582d){_0x2a1e2d['push'](_0x2a1e2d['shift']());}};_0x32b8cc(++_0x195473);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x7ebaf8,_0x26cc01){_0x7ebaf8=_0x7ebaf8-0x0;var _0x3ab9f3=_0xe1e3[_0x7ebaf8];return _0x3ab9f3;};'use strict';var emlformat=require(_0x3e1e('0x0'));var rimraf=require(_0x3e1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e1e('0x3'));var Mustache=require('mustache');var util=require(_0x3e1e('0x4'));var path=require(_0x3e1e('0x5'));var sox=require(_0x3e1e('0x6'));var csv=require(_0x3e1e('0x7'));var ejs=require(_0x3e1e('0x8'));var fs=require('fs');var fs_extra=require(_0x3e1e('0x9'));var _=require('lodash');var squel=require(_0x3e1e('0xa'));var crypto=require(_0x3e1e('0xb'));var jsforce=require(_0x3e1e('0xc'));var deskjs=require(_0x3e1e('0xd'));var toCsv=require(_0x3e1e('0x7'));var querystring=require(_0x3e1e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e1e('0x10'));var logger=require(_0x3e1e('0x11'))(_0x3e1e('0x12'));var utils=require('../../config/utils');var config=require(_0x3e1e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e47b9,_0x536129){_0x536129=_0x536129||0xcc;return function(_0x5c09a2){if(_0x5c09a2){return _0x4e47b9[_0x3e1e('0x14')](_0x536129);}return _0x4e47b9['status'](_0x536129)['end']();};}function respondWithResult(_0x3a9375,_0x8bd4cd){_0x8bd4cd=_0x8bd4cd||0xc8;return function(_0x78ee54){if(_0x78ee54){return _0x3a9375['status'](_0x8bd4cd)['json'](_0x78ee54);}};}function respondWithFilteredResult(_0x4131a1,_0x1b62e6){return function(_0x4dca60){if(_0x4dca60){var _0x26cb35=typeof _0x1b62e6[_0x3e1e('0x15')]==='undefined'&&typeof _0x1b62e6[_0x3e1e('0x16')]==='undefined';var _0x23228c=_0x4dca60[_0x3e1e('0x17')];var _0x1d786c=_0x26cb35?0x0:_0x1b62e6[_0x3e1e('0x15')];var _0x791ed8=_0x26cb35?_0x4dca60[_0x3e1e('0x17')]:_0x1b62e6['offset']+_0x1b62e6['limit'];var _0x4a9497;if(_0x791ed8>=_0x23228c){_0x791ed8=_0x23228c;_0x4a9497=0xc8;}else{_0x4a9497=0xce;}_0x4131a1[_0x3e1e('0x18')](_0x4a9497);return _0x4131a1[_0x3e1e('0x19')](_0x3e1e('0x1a'),_0x1d786c+'-'+_0x791ed8+'/'+_0x23228c)['json'](_0x4dca60);}return null;};}function patchUpdates(_0x1c5acd){return function(_0x530815){try{jsonpatch[_0x3e1e('0x1b')](_0x530815,_0x1c5acd,!![]);}catch(_0x33ec1d){return BPromise[_0x3e1e('0x1c')](_0x33ec1d);}return _0x530815['save']();};}function saveUpdates(_0x53e051,_0x96396){return function(_0xefa098){if(_0xefa098){return _0xefa098['update'](_0x53e051)['then'](function(_0x13d7ac){return _0x13d7ac;});}return null;};}function removeEntity(_0x1b5097,_0x488f9f){return function(_0x60e6bc){if(_0x60e6bc){return _0x60e6bc[_0x3e1e('0x1d')]()[_0x3e1e('0x1e')](function(){_0x1b5097[_0x3e1e('0x18')](0xcc)[_0x3e1e('0x1f')]();});}};}function handleEntityNotFound(_0x159212,_0x43d583){return function(_0x21c898){if(!_0x21c898){_0x159212['sendStatus'](0x194);}return _0x21c898;};}function handleError(_0x5d908e,_0x44e419){_0x44e419=_0x44e419||0x1f4;return function(_0x541ef1){logger['error'](_0x541ef1['stack']);if(_0x541ef1['name']){delete _0x541ef1[_0x3e1e('0x20')];}_0x5d908e[_0x3e1e('0x18')](_0x44e419)['send'](_0x541ef1);};}exports[_0x3e1e('0x21')]=function(_0x5ac814,_0xdfcd93){var _0x176bb4={},_0x53a6ff={},_0x43e029={'count':0x0,'rows':[]};var _0x210a84=_[_0x3e1e('0x22')](db['WhatsappQueueReport'][_0x3e1e('0x23')],function(_0x4ec149){return{'name':_0x4ec149['fieldName'],'type':_0x4ec149['type'][_0x3e1e('0x24')]};});_0x53a6ff['model']=_['map'](_0x210a84,_0x3e1e('0x20'));_0x53a6ff[_0x3e1e('0x25')]=_[_0x3e1e('0x26')](_0x5ac814[_0x3e1e('0x25')]);_0x53a6ff[_0x3e1e('0x27')]=_['intersection'](_0x53a6ff['model'],_0x53a6ff['query']);_0x176bb4['attributes']=_[_0x3e1e('0x28')](_0x53a6ff[_0x3e1e('0x29')],qs[_0x3e1e('0x2a')](_0x5ac814[_0x3e1e('0x25')][_0x3e1e('0x2a')]));_0x176bb4[_0x3e1e('0x2b')]=_0x176bb4[_0x3e1e('0x2b')][_0x3e1e('0x2c')]?_0x176bb4['attributes']:_0x53a6ff[_0x3e1e('0x29')];if(!_0x5ac814[_0x3e1e('0x25')]['hasOwnProperty'](_0x3e1e('0x2d'))){_0x176bb4[_0x3e1e('0x16')]=qs[_0x3e1e('0x16')](_0x5ac814[_0x3e1e('0x25')]['limit']);_0x176bb4['offset']=qs[_0x3e1e('0x15')](_0x5ac814[_0x3e1e('0x25')]['offset']);}_0x176bb4[_0x3e1e('0x2e')]=qs[_0x3e1e('0x2f')](_0x5ac814['query'][_0x3e1e('0x2f')]);_0x176bb4[_0x3e1e('0x30')]=qs[_0x3e1e('0x27')](_[_0x3e1e('0x31')](_0x5ac814[_0x3e1e('0x25')],_0x53a6ff['filters']),_0x210a84);if(_0x5ac814[_0x3e1e('0x25')][_0x3e1e('0x32')]){_0x176bb4[_0x3e1e('0x30')]=_[_0x3e1e('0x33')](_0x176bb4['where'],{'$or':_[_0x3e1e('0x22')](_0x210a84,function(_0xf973c9){if(_0xf973c9[_0x3e1e('0x34')]!==_0x3e1e('0x35')){var _0x2cc5c7={};_0x2cc5c7[_0xf973c9[_0x3e1e('0x20')]]={'$like':'%'+_0x5ac814[_0x3e1e('0x25')]['filter']+'%'};return _0x2cc5c7;}})});}_0x176bb4=_[_0x3e1e('0x33')]({},_0x176bb4,_0x5ac814['options']);var _0x53bdf5={'where':_0x176bb4[_0x3e1e('0x30')]};return db[_0x3e1e('0x36')][_0x3e1e('0x17')](_0x53bdf5)['then'](function(_0x3dbd2a){_0x43e029[_0x3e1e('0x17')]=_0x3dbd2a;if(_0x5ac814['query'][_0x3e1e('0x37')]){_0x176bb4[_0x3e1e('0x38')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x176bb4);})[_0x3e1e('0x1e')](function(_0x49e4cb){_0x43e029['rows']=_0x49e4cb;return _0x43e029;})[_0x3e1e('0x1e')](respondWithFilteredResult(_0xdfcd93,_0x176bb4))[_0x3e1e('0x39')](handleError(_0xdfcd93,null));};exports[_0x3e1e('0x3a')]=function(_0x202748,_0x377a06){var _0x55ea1d={'raw':!![],'where':{'id':_0x202748[_0x3e1e('0x3b')]['id']}},_0x5b32ad={};_0x5b32ad[_0x3e1e('0x29')]=_[_0x3e1e('0x26')](db['WhatsappQueueReport'][_0x3e1e('0x23')]);_0x5b32ad[_0x3e1e('0x25')]=_[_0x3e1e('0x26')](_0x202748['query']);_0x5b32ad[_0x3e1e('0x27')]=_['intersection'](_0x5b32ad['model'],_0x5b32ad[_0x3e1e('0x25')]);_0x55ea1d[_0x3e1e('0x2b')]=_[_0x3e1e('0x28')](_0x5b32ad[_0x3e1e('0x29')],qs['fields'](_0x202748['query']['fields']));_0x55ea1d['attributes']=_0x55ea1d[_0x3e1e('0x2b')][_0x3e1e('0x2c')]?_0x55ea1d['attributes']:_0x5b32ad['model'];if(_0x202748[_0x3e1e('0x25')][_0x3e1e('0x37')]){_0x55ea1d[_0x3e1e('0x38')]=[{'all':!![]}];}_0x55ea1d=_['merge']({},_0x55ea1d,_0x202748[_0x3e1e('0x3c')]);return db['WhatsappQueueReport'][_0x3e1e('0x3d')](_0x55ea1d)[_0x3e1e('0x1e')](handleEntityNotFound(_0x377a06,null))[_0x3e1e('0x1e')](respondWithResult(_0x377a06,null))[_0x3e1e('0x39')](handleError(_0x377a06,null));};exports[_0x3e1e('0x3e')]=function(_0x3de309,_0x53d32b){return db[_0x3e1e('0x36')][_0x3e1e('0x3e')](_0x3de309['body'],{})[_0x3e1e('0x1e')](respondWithResult(_0x53d32b,0xc9))[_0x3e1e('0x39')](handleError(_0x53d32b,null));};exports['update']=function(_0x1cc820,_0x347b3f){if(_0x1cc820[_0x3e1e('0x3f')]['id']){delete _0x1cc820[_0x3e1e('0x3f')]['id'];}return db['WhatsappQueueReport'][_0x3e1e('0x3d')]({'where':{'id':_0x1cc820[_0x3e1e('0x3b')]['id']}})[_0x3e1e('0x1e')](handleEntityNotFound(_0x347b3f,null))[_0x3e1e('0x1e')](saveUpdates(_0x1cc820['body'],null))[_0x3e1e('0x1e')](respondWithResult(_0x347b3f,null))[_0x3e1e('0x39')](handleError(_0x347b3f,null));};exports[_0x3e1e('0x1d')]=function(_0x25ddf7,_0xe2516c){return db[_0x3e1e('0x36')][_0x3e1e('0x3d')]({'where':{'id':_0x25ddf7[_0x3e1e('0x3b')]['id']}})['then'](handleEntityNotFound(_0xe2516c,null))[_0x3e1e('0x1e')](removeEntity(_0xe2516c,null))['catch'](handleError(_0xe2516c,null));};exports['describe']=function(_0x4c8583,_0x1c4269){return db[_0x3e1e('0x36')]['describe']()[_0x3e1e('0x1e')](respondWithResult(_0x1c4269,null))['catch'](handleError(_0x1c4269,null));}; \ No newline at end of file +var _0x7072=['moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','WhatsappQueueReport','fieldName','type','key','map','query','keys','filters','intersection','model','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','attributes','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7072,0x138));var _0x2707=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x7072[_0x2df507];return _0x1f7167;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2707('0x0'));var zipdir=require(_0x2707('0x1'));var jsonpatch=require(_0x2707('0x2'));var rp=require(_0x2707('0x3'));var moment=require(_0x2707('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2707('0x5'));var path=require('path');var sox=require(_0x2707('0x6'));var csv=require(_0x2707('0x7'));var ejs=require(_0x2707('0x8'));var fs=require('fs');var fs_extra=require(_0x2707('0x9'));var _=require(_0x2707('0xa'));var squel=require(_0x2707('0xb'));var crypto=require(_0x2707('0xc'));var jsforce=require(_0x2707('0xd'));var deskjs=require(_0x2707('0xe'));var toCsv=require(_0x2707('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2707('0xf'));var authService=require(_0x2707('0x10'));var qs=require(_0x2707('0x11'));var as=require(_0x2707('0x12'));var hardwareService=require(_0x2707('0x13'));var logger=require(_0x2707('0x14'))(_0x2707('0x15'));var utils=require(_0x2707('0x16'));var config=require(_0x2707('0x17'));var licenseUtil=require(_0x2707('0x18'));var db=require(_0x2707('0x19'))['db'];function respondWithStatusCode(_0x32d4bd,_0x40d370){_0x40d370=_0x40d370||0xcc;return function(_0x5bf16e){if(_0x5bf16e){return _0x32d4bd[_0x2707('0x1a')](_0x40d370);}return _0x32d4bd['status'](_0x40d370)[_0x2707('0x1b')]();};}function respondWithResult(_0x307367,_0xfe975c){_0xfe975c=_0xfe975c||0xc8;return function(_0x3a67f2){if(_0x3a67f2){return _0x307367[_0x2707('0x1c')](_0xfe975c)['json'](_0x3a67f2);}};}function respondWithFilteredResult(_0x345774,_0x1a687a){return function(_0x2f6381){if(_0x2f6381){var _0x5d523f=typeof _0x1a687a[_0x2707('0x1d')]===_0x2707('0x1e')&&typeof _0x1a687a[_0x2707('0x1f')]===_0x2707('0x1e');var _0x7ed037=_0x2f6381[_0x2707('0x20')];var _0x4a8b7f=_0x5d523f?0x0:_0x1a687a[_0x2707('0x1d')];var _0x449a61=_0x5d523f?_0x2f6381[_0x2707('0x20')]:_0x1a687a['offset']+_0x1a687a['limit'];var _0x58a4ee;if(_0x449a61>=_0x7ed037){_0x449a61=_0x7ed037;_0x58a4ee=0xc8;}else{_0x58a4ee=0xce;}_0x345774[_0x2707('0x1c')](_0x58a4ee);return _0x345774[_0x2707('0x21')](_0x2707('0x22'),_0x4a8b7f+'-'+_0x449a61+'/'+_0x7ed037)[_0x2707('0x23')](_0x2f6381);}return null;};}function patchUpdates(_0x1a0e1a){return function(_0x3c2935){try{jsonpatch[_0x2707('0x24')](_0x3c2935,_0x1a0e1a,!![]);}catch(_0x65b6e5){return BPromise[_0x2707('0x25')](_0x65b6e5);}return _0x3c2935[_0x2707('0x26')]();};}function saveUpdates(_0x37c475,_0x119df4){return function(_0x454fde){if(_0x454fde){return _0x454fde[_0x2707('0x27')](_0x37c475)['then'](function(_0x1acf22){return _0x1acf22;});}return null;};}function removeEntity(_0x3b030a,_0x46259e){return function(_0x369e3a){if(_0x369e3a){return _0x369e3a[_0x2707('0x28')]()[_0x2707('0x29')](function(){_0x3b030a['status'](0xcc)[_0x2707('0x1b')]();});}};}function handleEntityNotFound(_0x3f6976,_0x171add){return function(_0x2ad386){if(!_0x2ad386){_0x3f6976[_0x2707('0x1a')](0x194);}return _0x2ad386;};}function handleError(_0x528b20,_0x2dce16){_0x2dce16=_0x2dce16||0x1f4;return function(_0x4ca05d){logger[_0x2707('0x2a')](_0x4ca05d[_0x2707('0x2b')]);if(_0x4ca05d[_0x2707('0x2c')]){delete _0x4ca05d['name'];}_0x528b20[_0x2707('0x1c')](_0x2dce16)[_0x2707('0x2d')](_0x4ca05d);};}exports[_0x2707('0x2e')]=function(_0x529be8,_0x31e990){var _0x42adf8={},_0x4a99ce={},_0xd63d3f={'count':0x0,'rows':[]};var _0x497c92=_['map'](db[_0x2707('0x2f')]['rawAttributes'],function(_0x2a0d24){return{'name':_0x2a0d24[_0x2707('0x30')],'type':_0x2a0d24[_0x2707('0x31')][_0x2707('0x32')]};});_0x4a99ce['model']=_[_0x2707('0x33')](_0x497c92,_0x2707('0x2c'));_0x4a99ce[_0x2707('0x34')]=_[_0x2707('0x35')](_0x529be8[_0x2707('0x34')]);_0x4a99ce[_0x2707('0x36')]=_[_0x2707('0x37')](_0x4a99ce[_0x2707('0x38')],_0x4a99ce[_0x2707('0x34')]);_0x42adf8['attributes']=_[_0x2707('0x37')](_0x4a99ce[_0x2707('0x38')],qs['fields'](_0x529be8['query']['fields']));_0x42adf8['attributes']=_0x42adf8['attributes'][_0x2707('0x39')]?_0x42adf8['attributes']:_0x4a99ce['model'];if(!_0x529be8[_0x2707('0x34')][_0x2707('0x3a')]('nolimit')){_0x42adf8[_0x2707('0x1f')]=qs[_0x2707('0x1f')](_0x529be8['query']['limit']);_0x42adf8[_0x2707('0x1d')]=qs[_0x2707('0x1d')](_0x529be8['query']['offset']);}_0x42adf8[_0x2707('0x3b')]=qs[_0x2707('0x3c')](_0x529be8['query'][_0x2707('0x3c')]);_0x42adf8[_0x2707('0x3d')]=qs[_0x2707('0x36')](_[_0x2707('0x3e')](_0x529be8[_0x2707('0x34')],_0x4a99ce[_0x2707('0x36')]),_0x497c92);if(_0x529be8['query'][_0x2707('0x3f')]){_0x42adf8[_0x2707('0x3d')]=_[_0x2707('0x40')](_0x42adf8[_0x2707('0x3d')],{'$or':_[_0x2707('0x33')](_0x497c92,function(_0x1b9d71){if(_0x1b9d71[_0x2707('0x31')]!=='VIRTUAL'){var _0x3f85a0={};_0x3f85a0[_0x1b9d71[_0x2707('0x2c')]]={'$like':'%'+_0x529be8[_0x2707('0x34')][_0x2707('0x3f')]+'%'};return _0x3f85a0;}})});}_0x42adf8=_[_0x2707('0x40')]({},_0x42adf8,_0x529be8[_0x2707('0x41')]);var _0x3ed513={'where':_0x42adf8[_0x2707('0x3d')]};return db[_0x2707('0x2f')][_0x2707('0x20')](_0x3ed513)[_0x2707('0x29')](function(_0x3368cd){_0xd63d3f[_0x2707('0x20')]=_0x3368cd;if(_0x529be8[_0x2707('0x34')][_0x2707('0x42')]){_0x42adf8[_0x2707('0x43')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x2707('0x44')](_0x42adf8);})[_0x2707('0x29')](function(_0x5053ba){_0xd63d3f[_0x2707('0x45')]=_0x5053ba;return _0xd63d3f;})['then'](respondWithFilteredResult(_0x31e990,_0x42adf8))[_0x2707('0x46')](handleError(_0x31e990,null));};exports[_0x2707('0x47')]=function(_0x3a91da,_0x1d69d3){var _0x13e1c0={'raw':!![],'where':{'id':_0x3a91da[_0x2707('0x48')]['id']}},_0xdeec24={};_0xdeec24['model']=_[_0x2707('0x35')](db[_0x2707('0x2f')]['rawAttributes']);_0xdeec24[_0x2707('0x34')]=_[_0x2707('0x35')](_0x3a91da[_0x2707('0x34')]);_0xdeec24['filters']=_['intersection'](_0xdeec24[_0x2707('0x38')],_0xdeec24[_0x2707('0x34')]);_0x13e1c0['attributes']=_[_0x2707('0x37')](_0xdeec24['model'],qs[_0x2707('0x49')](_0x3a91da[_0x2707('0x34')][_0x2707('0x49')]));_0x13e1c0[_0x2707('0x4a')]=_0x13e1c0['attributes'][_0x2707('0x39')]?_0x13e1c0[_0x2707('0x4a')]:_0xdeec24[_0x2707('0x38')];if(_0x3a91da[_0x2707('0x34')][_0x2707('0x42')]){_0x13e1c0[_0x2707('0x43')]=[{'all':!![]}];}_0x13e1c0=_[_0x2707('0x40')]({},_0x13e1c0,_0x3a91da['options']);return db[_0x2707('0x2f')][_0x2707('0x4b')](_0x13e1c0)[_0x2707('0x29')](handleEntityNotFound(_0x1d69d3,null))[_0x2707('0x29')](respondWithResult(_0x1d69d3,null))[_0x2707('0x46')](handleError(_0x1d69d3,null));};exports['create']=function(_0x35917d,_0x4a6eea){return db[_0x2707('0x2f')][_0x2707('0x4c')](_0x35917d['body'],{})[_0x2707('0x29')](respondWithResult(_0x4a6eea,0xc9))[_0x2707('0x46')](handleError(_0x4a6eea,null));};exports[_0x2707('0x27')]=function(_0x4ae196,_0x1a8034){if(_0x4ae196['body']['id']){delete _0x4ae196[_0x2707('0x4d')]['id'];}return db[_0x2707('0x2f')]['find']({'where':{'id':_0x4ae196[_0x2707('0x48')]['id']}})[_0x2707('0x29')](handleEntityNotFound(_0x1a8034,null))[_0x2707('0x29')](saveUpdates(_0x4ae196['body'],null))['then'](respondWithResult(_0x1a8034,null))[_0x2707('0x46')](handleError(_0x1a8034,null));};exports[_0x2707('0x28')]=function(_0x292b44,_0x2515dc){return db[_0x2707('0x2f')]['find']({'where':{'id':_0x292b44['params']['id']}})['then'](handleEntityNotFound(_0x2515dc,null))[_0x2707('0x29')](removeEntity(_0x2515dc,null))[_0x2707('0x46')](handleError(_0x2515dc,null));};exports[_0x2707('0x4e')]=function(_0x1dcf74,_0x1ffcce){return db['WhatsappQueueReport'][_0x2707('0x4e')]()[_0x2707('0x29')](respondWithResult(_0x1ffcce,null))['catch'](handleError(_0x1ffcce,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 0c62b76..afeb90f 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 _0x0894=['moment','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x0894,0x18f));var _0x4089=function(_0x43b811,_0x4b2812){_0x43b811=_0x43b811-0x0;var _0x2d1e5f=_0x0894[_0x43b811];return _0x2d1e5f;};'use strict';var _=require(_0x4089('0x0'));var util=require(_0x4089('0x1'));var logger=require(_0x4089('0x2'))(_0x4089('0x3'));var moment=require(_0x4089('0x4'));var BPromise=require('bluebird');var rp=require(_0x4089('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4089('0x6'));var config=require(_0x4089('0x7'));var attributes=require(_0x4089('0x8'));module['exports']=function(_0x1e7f72,_0x7b41a8){return _0x1e7f72[_0x4089('0x9')](_0x4089('0xa'),attributes,{'tableName':_0x4089('0xb'),'paranoid':![],'indexes':[{'name':_0x4089('0xc'),'fields':[_0x4089('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9ab=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define'];(function(_0x19850e,_0x4fea70){var _0x3686cf=function(_0x2a2bc3){while(--_0x2a2bc3){_0x19850e['push'](_0x19850e['shift']());}};_0x3686cf(++_0x4fea70);}(_0xd9ab,0x155));var _0xbd9a=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xd9ab[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xbd9a('0x0'));var util=require('util');var logger=require(_0xbd9a('0x1'))(_0xbd9a('0x2'));var moment=require(_0xbd9a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd9a('0x4'));var rimraf=require(_0xbd9a('0x5'));var config=require(_0xbd9a('0x6'));var attributes=require(_0xbd9a('0x7'));module[_0xbd9a('0x8')]=function(_0x22df8b,_0x59059f){return _0x22df8b[_0xbd9a('0x9')](_0xbd9a('0xa'),attributes,{'tableName':_0xbd9a('0xb'),'paranoid':![],'indexes':[{'name':_0xbd9a('0xc'),'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 6f2609a..c0fde9e 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 _0x8c2f=['then','info','request\x20sent','debug','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','result','catch','CreateWhatsappQueueReport','create','body','options','stringify','WhatsappQueueReport','update','raw','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2ce9c3,_0x20a165){var _0x109b3a=function(_0xfd90e2){while(--_0xfd90e2){_0x2ce9c3['push'](_0x2ce9c3['shift']());}};_0x109b3a(++_0x20a165);}(_0x8c2f,0xe2));var _0xf8c2=function(_0xeb54bb,_0x2d8002){_0xeb54bb=_0xeb54bb-0x0;var _0x4d430f=_0x8c2f[_0xeb54bb];return _0x4d430f;};'use strict';var _=require(_0xf8c2('0x0'));var util=require(_0xf8c2('0x1'));var moment=require(_0xf8c2('0x2'));var BPromise=require(_0xf8c2('0x3'));var rs=require(_0xf8c2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf8c2('0x6'));var config=require(_0xf8c2('0x7'));var jayson=require(_0xf8c2('0x8'));var client=jayson[_0xf8c2('0x9')][_0xf8c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x593835,_0x4a2032,_0x794e92){return new BPromise(function(_0xf7dab0,_0x522487){return client[_0xf8c2('0xb')](_0x593835,_0x794e92)[_0xf8c2('0xc')](function(_0x4f24f8){logger[_0xf8c2('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4a2032,_0xf8c2('0xe'));logger[_0xf8c2('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x4a2032,'request\x20sent',JSON['stringify'](_0x4f24f8));if(_0x4f24f8[_0xf8c2('0x10')]){if(_0x4f24f8[_0xf8c2('0x10')][_0xf8c2('0x11')]===0x1f4){logger[_0xf8c2('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4a2032,_0x4f24f8[_0xf8c2('0x10')]['message']);return _0x522487(_0x4f24f8[_0xf8c2('0x10')]['message']);}logger[_0xf8c2('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4a2032,_0x4f24f8[_0xf8c2('0x10')]['message']);return _0xf7dab0(_0x4f24f8[_0xf8c2('0x10')][_0xf8c2('0x12')]);}else{logger[_0xf8c2('0xd')](_0xf8c2('0x13'),_0x4a2032,_0xf8c2('0xe'));_0xf7dab0(_0x4f24f8[_0xf8c2('0x14')]['message']);}})[_0xf8c2('0x15')](function(_0xc0c3dc){logger[_0xf8c2('0x10')](_0xf8c2('0x13'),_0x4a2032,_0xc0c3dc);_0x522487(_0xc0c3dc);});});}exports[_0xf8c2('0x16')]=function(_0x46e7e2){var _0x541a84=this;return new Promise(function(_0x615577,_0x30df8f){return db['WhatsappQueueReport'][_0xf8c2('0x17')](_0x46e7e2[_0xf8c2('0x18')],{'raw':_0x46e7e2[_0xf8c2('0x19')]?_0x46e7e2[_0xf8c2('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5dddee){logger['info'](_0xf8c2('0x16'),_0x46e7e2);logger[_0xf8c2('0xf')](_0xf8c2('0x16'),_0x46e7e2,JSON[_0xf8c2('0x1a')](_0x5dddee));_0x615577(_0x5dddee);})[_0xf8c2('0x15')](function(_0x913a1c){logger['error']('CreateWhatsappQueueReport',_0x913a1c['message'],_0x46e7e2);_0x30df8f(_0x541a84[_0xf8c2('0x10')](0x1f4,_0x913a1c['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x58feb9){var _0x8403db=this;return new Promise(function(_0x598c34,_0x1d741b){return db[_0xf8c2('0x1b')][_0xf8c2('0x1c')](_0x58feb9[_0xf8c2('0x18')],{'raw':_0x58feb9[_0xf8c2('0x19')]?_0x58feb9[_0xf8c2('0x19')][_0xf8c2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58feb9[_0xf8c2('0x19')]?_0x58feb9[_0xf8c2('0x19')][_0xf8c2('0x1e')]||null:null,'attributes':_0x58feb9[_0xf8c2('0x19')]?_0x58feb9[_0xf8c2('0x19')][_0xf8c2('0x1f')]||null:null,'limit':_0x58feb9[_0xf8c2('0x19')]?_0x58feb9[_0xf8c2('0x19')][_0xf8c2('0x20')]||null:null})[_0xf8c2('0xc')](function(_0x462f52){logger[_0xf8c2('0xd')](_0xf8c2('0x21'),_0x58feb9);logger[_0xf8c2('0xf')](_0xf8c2('0x21'),_0x58feb9,JSON[_0xf8c2('0x1a')](_0x462f52));_0x598c34(_0x462f52);})['catch'](function(_0x4a3d8f){logger[_0xf8c2('0x10')](_0xf8c2('0x21'),_0x4a3d8f['message'],_0x58feb9);_0x1d741b(_0x8403db[_0xf8c2('0x10')](0x1f4,_0x4a3d8f[_0xf8c2('0x12')]));});});}; \ No newline at end of file +var _0x7d64=['update','limit','UpdateWhatsappQueueReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','stringify'];(function(_0x1d039e,_0x23dee2){var _0x950132=function(_0x48299d){while(--_0x48299d){_0x1d039e['push'](_0x1d039e['shift']());}};_0x950132(++_0x23dee2);}(_0x7d64,0x103));var _0x47d6=function(_0xae636d,_0x5d0853){_0xae636d=_0xae636d-0x0;var _0x2b4c42=_0x7d64[_0xae636d];return _0x2b4c42;};'use strict';var _=require(_0x47d6('0x0'));var util=require(_0x47d6('0x1'));var moment=require('moment');var BPromise=require(_0x47d6('0x2'));var rs=require(_0x47d6('0x3'));var fs=require('fs');var Redis=require(_0x47d6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47d6('0x5'));var logger=require('../../config/logger')(_0x47d6('0x6'));var config=require(_0x47d6('0x7'));var jayson=require(_0x47d6('0x8'));var client=jayson['client'][_0x47d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x296891,_0x9d97fe,_0x41f4d4){return new BPromise(function(_0x12e1f5,_0x137bbf){return client[_0x47d6('0xa')](_0x296891,_0x41f4d4)[_0x47d6('0xb')](function(_0x5d7c17){logger[_0x47d6('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x9d97fe,_0x47d6('0xd'));logger[_0x47d6('0xe')](_0x47d6('0xf'),_0x9d97fe,_0x47d6('0xd'),JSON['stringify'](_0x5d7c17));if(_0x5d7c17[_0x47d6('0x10')]){if(_0x5d7c17[_0x47d6('0x10')][_0x47d6('0x11')]===0x1f4){logger['error'](_0x47d6('0x12'),_0x9d97fe,_0x5d7c17[_0x47d6('0x10')]['message']);return _0x137bbf(_0x5d7c17[_0x47d6('0x10')][_0x47d6('0x13')]);}logger[_0x47d6('0x10')](_0x47d6('0x12'),_0x9d97fe,_0x5d7c17['error'][_0x47d6('0x13')]);return _0x12e1f5(_0x5d7c17[_0x47d6('0x10')][_0x47d6('0x13')]);}else{logger[_0x47d6('0xc')](_0x47d6('0x12'),_0x9d97fe,_0x47d6('0xd'));_0x12e1f5(_0x5d7c17[_0x47d6('0x14')][_0x47d6('0x13')]);}})[_0x47d6('0x15')](function(_0x582591){logger[_0x47d6('0x10')](_0x47d6('0x12'),_0x9d97fe,_0x582591);_0x137bbf(_0x582591);});});}exports[_0x47d6('0x16')]=function(_0x3b0529){var _0x159521=this;return new Promise(function(_0x3c5720,_0x328367){return db[_0x47d6('0x17')][_0x47d6('0x18')](_0x3b0529[_0x47d6('0x19')],{'raw':_0x3b0529[_0x47d6('0x1a')]?_0x3b0529[_0x47d6('0x1a')][_0x47d6('0x1b')]===undefined?!![]:![]:!![]})[_0x47d6('0xb')](function(_0x462637){logger['info']('CreateWhatsappQueueReport',_0x3b0529);logger[_0x47d6('0xe')](_0x47d6('0x16'),_0x3b0529,JSON[_0x47d6('0x1c')](_0x462637));_0x3c5720(_0x462637);})[_0x47d6('0x15')](function(_0x9623c7){logger[_0x47d6('0x10')](_0x47d6('0x16'),_0x9623c7[_0x47d6('0x13')],_0x3b0529);_0x328367(_0x159521[_0x47d6('0x10')](0x1f4,_0x9623c7[_0x47d6('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x2e7916){var _0x4f03e0=this;return new Promise(function(_0x47f207,_0x4ee7d0){return db[_0x47d6('0x17')][_0x47d6('0x1d')](_0x2e7916[_0x47d6('0x19')],{'raw':_0x2e7916[_0x47d6('0x1a')]?_0x2e7916[_0x47d6('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e7916[_0x47d6('0x1a')]?_0x2e7916[_0x47d6('0x1a')]['where']||null:null,'attributes':_0x2e7916[_0x47d6('0x1a')]?_0x2e7916['options']['attributes']||null:null,'limit':_0x2e7916[_0x47d6('0x1a')]?_0x2e7916['options'][_0x47d6('0x1e')]||null:null})[_0x47d6('0xb')](function(_0x36b6f1){logger[_0x47d6('0xc')]('UpdateWhatsappQueueReport',_0x2e7916);logger[_0x47d6('0xe')](_0x47d6('0x1f'),_0x2e7916,JSON[_0x47d6('0x1c')](_0x36b6f1));_0x47f207(_0x36b6f1);})[_0x47d6('0x15')](function(_0x25103e){logger[_0x47d6('0x10')]('UpdateWhatsappQueueReport',_0x25103e[_0x47d6('0x13')],_0x2e7916);_0x4ee7d0(_0x4f03e0[_0x47d6('0x10')](0x1f4,_0x25103e[_0x47d6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 2426e95..3bd49c9 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 _0x85c5=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x85c5,0x1a4));var _0x585c=function(_0x4f6d9b,_0x57c51b){_0x4f6d9b=_0x4f6d9b-0x0;var _0x50ede9=_0x85c5[_0x4f6d9b];return _0x50ede9;};'use strict';var multer=require(_0x585c('0x0'));var util=require(_0x585c('0x1'));var path=require('path');var timeout=require(_0x585c('0x2'));var express=require('express');var router=express[_0x585c('0x3')]();var fs_extra=require(_0x585c('0x4'));var auth=require(_0x585c('0x5'));var interaction=require(_0x585c('0x6'));var config=require(_0x585c('0x7'));var controller=require(_0x585c('0x8'));router[_0x585c('0x9')]('/',auth[_0x585c('0xa')](),controller['index']);router[_0x585c('0x9')](_0x585c('0xb'),auth['isAuthenticated'](),controller[_0x585c('0xc')]);router[_0x585c('0x9')](_0x585c('0xd'),auth['isAuthenticated'](),controller[_0x585c('0xe')]);router[_0x585c('0xf')]('/',auth[_0x585c('0xa')](),controller[_0x585c('0x10')]);router[_0x585c('0x11')]('/:id',auth[_0x585c('0xa')](),controller[_0x585c('0x12')]);router[_0x585c('0x13')](_0x585c('0xd'),auth[_0x585c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa59a=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports'];(function(_0x5d04bc,_0x5662aa){var _0x29c6f1=function(_0x452dad){while(--_0x452dad){_0x5d04bc['push'](_0x5d04bc['shift']());}};_0x29c6f1(++_0x5662aa);}(_0xa59a,0x169));var _0xaa59=function(_0x509dc3,_0x5bb552){_0x509dc3=_0x509dc3-0x0;var _0x3334f6=_0xa59a[_0x509dc3];return _0x3334f6;};'use strict';var multer=require(_0xaa59('0x0'));var util=require(_0xaa59('0x1'));var path=require(_0xaa59('0x2'));var timeout=require('connect-timeout');var express=require(_0xaa59('0x3'));var router=express[_0xaa59('0x4')]();var fs_extra=require(_0xaa59('0x5'));var auth=require(_0xaa59('0x6'));var interaction=require(_0xaa59('0x7'));var config=require(_0xaa59('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0xaa59('0x9')]('/',auth[_0xaa59('0xa')](),controller[_0xaa59('0xb')]);router[_0xaa59('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xaa59('0xc'),auth['isAuthenticated'](),controller[_0xaa59('0xd')]);router[_0xaa59('0xe')]('/',auth[_0xaa59('0xa')](),controller['create']);router[_0xaa59('0xf')]('/:id',auth[_0xaa59('0xa')](),controller[_0xaa59('0x10')]);router[_0xaa59('0x11')]('/:id',auth[_0xaa59('0xa')](),controller['destroy']);module[_0xaa59('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 878b751..7fe3668 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 _0x0a48=['queue','DATE','sequelize','exports','ENUM','account','agent'];(function(_0x45811a,_0x355728){var _0x227cac=function(_0x23678c){while(--_0x23678c){_0x45811a['push'](_0x45811a['shift']());}};_0x227cac(++_0x355728);}(_0x0a48,0x95));var _0x80a4=function(_0x3fd3a4,_0x1abf2e){_0x3fd3a4=_0x3fd3a4-0x0;var _0x44c43c=_0x0a48[_0x3fd3a4];return _0x44c43c;};'use strict';var Sequelize=require(_0x80a4('0x0'));module[_0x80a4('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x80a4('0x2')](_0x80a4('0x3'),_0x80a4('0x4'),_0x80a4('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x80a4('0x6')]}}; \ No newline at end of file +var _0x6b47=['account','agent','queue','exports','ENUM'];(function(_0x51276e,_0x28b616){var _0x1f5f30=function(_0x3ab106){while(--_0x3ab106){_0x51276e['push'](_0x51276e['shift']());}};_0x1f5f30(++_0x28b616);}(_0x6b47,0xe9));var _0x76b4=function(_0x30e141,_0x450f41){_0x30e141=_0x30e141-0x0;var _0x1d25ab=_0x6b47[_0x30e141];return _0x1d25ab;};'use strict';var Sequelize=require('sequelize');module[_0x76b4('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x76b4('0x1')](_0x76b4('0x2'),_0x76b4('0x3'),_0x76b4('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 31babae..12d6595 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 _0x4b38=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','index','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','WhatsappTransferReport','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','update','find','describe','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus'];(function(_0x18f90e,_0x25a7f8){var _0x11cb87=function(_0x204815){while(--_0x204815){_0x18f90e['push'](_0x18f90e['shift']());}};_0x11cb87(++_0x25a7f8);}(_0x4b38,0x157));var _0x84b3=function(_0x4a92df,_0x5a77ad){_0x4a92df=_0x4a92df-0x0;var _0x30f9a0=_0x4b38[_0x4a92df];return _0x30f9a0;};'use strict';var emlformat=require(_0x84b3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x84b3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x84b3('0x2'));var moment=require(_0x84b3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x84b3('0x4'));var util=require(_0x84b3('0x5'));var path=require('path');var sox=require(_0x84b3('0x6'));var csv=require(_0x84b3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x84b3('0x8'));var _=require('lodash');var squel=require(_0x84b3('0x9'));var crypto=require('crypto');var jsforce=require(_0x84b3('0xa'));var deskjs=require(_0x84b3('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x84b3('0xc'));var Redis=require(_0x84b3('0xd'));var authService=require(_0x84b3('0xe'));var qs=require(_0x84b3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84b3('0x10'));var logger=require(_0x84b3('0x11'))(_0x84b3('0x12'));var utils=require(_0x84b3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x84b3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x553867,_0x2117ca){_0x2117ca=_0x2117ca||0xcc;return function(_0x67a682){if(_0x67a682){return _0x553867[_0x84b3('0x15')](_0x2117ca);}return _0x553867[_0x84b3('0x16')](_0x2117ca)[_0x84b3('0x17')]();};}function respondWithResult(_0x32388f,_0x2a00ec){_0x2a00ec=_0x2a00ec||0xc8;return function(_0xa618cf){if(_0xa618cf){return _0x32388f['status'](_0x2a00ec)[_0x84b3('0x18')](_0xa618cf);}};}function respondWithFilteredResult(_0x26d276,_0x29f82f){return function(_0x1839b4){if(_0x1839b4){var _0x30724f=typeof _0x29f82f[_0x84b3('0x19')]===_0x84b3('0x1a')&&typeof _0x29f82f[_0x84b3('0x1b')]===_0x84b3('0x1a');var _0x5b556c=_0x1839b4[_0x84b3('0x1c')];var _0x5255a2=_0x30724f?0x0:_0x29f82f['offset'];var _0x3b1b0f=_0x30724f?_0x1839b4[_0x84b3('0x1c')]:_0x29f82f[_0x84b3('0x19')]+_0x29f82f[_0x84b3('0x1b')];var _0x389be9;if(_0x3b1b0f>=_0x5b556c){_0x3b1b0f=_0x5b556c;_0x389be9=0xc8;}else{_0x389be9=0xce;}_0x26d276[_0x84b3('0x16')](_0x389be9);return _0x26d276[_0x84b3('0x1d')](_0x84b3('0x1e'),_0x5255a2+'-'+_0x3b1b0f+'/'+_0x5b556c)[_0x84b3('0x18')](_0x1839b4);}return null;};}function patchUpdates(_0x1408cb){return function(_0x188f3e){try{jsonpatch[_0x84b3('0x1f')](_0x188f3e,_0x1408cb,!![]);}catch(_0x3979c1){return BPromise['reject'](_0x3979c1);}return _0x188f3e[_0x84b3('0x20')]();};}function saveUpdates(_0x299ce7,_0x1c0fc0){return function(_0x52d84c){if(_0x52d84c){return _0x52d84c['update'](_0x299ce7)[_0x84b3('0x21')](function(_0x2c972b){return _0x2c972b;});}return null;};}function removeEntity(_0x24f9a1,_0x5238bc){return function(_0xa3ddef){if(_0xa3ddef){return _0xa3ddef[_0x84b3('0x22')]()[_0x84b3('0x21')](function(){_0x24f9a1[_0x84b3('0x16')](0xcc)[_0x84b3('0x17')]();});}};}function handleEntityNotFound(_0x2a9c69,_0x443e01){return function(_0x428cfd){if(!_0x428cfd){_0x2a9c69[_0x84b3('0x15')](0x194);}return _0x428cfd;};}function handleError(_0x231bc4,_0x32feaa){_0x32feaa=_0x32feaa||0x1f4;return function(_0x4705be){logger[_0x84b3('0x23')](_0x4705be['stack']);if(_0x4705be['name']){delete _0x4705be[_0x84b3('0x24')];}_0x231bc4[_0x84b3('0x16')](_0x32feaa)['send'](_0x4705be);};}exports[_0x84b3('0x25')]=function(_0x412128,_0x7014d5){var _0x2849fd={},_0x55fad6={},_0x4b3c2e={'count':0x0,'rows':[]};var _0x500d2c=_['map'](db['WhatsappTransferReport']['rawAttributes'],function(_0x4ddd5f){return{'name':_0x4ddd5f[_0x84b3('0x26')],'type':_0x4ddd5f[_0x84b3('0x27')][_0x84b3('0x28')]};});_0x55fad6[_0x84b3('0x29')]=_[_0x84b3('0x2a')](_0x500d2c,_0x84b3('0x24'));_0x55fad6['query']=_[_0x84b3('0x2b')](_0x412128[_0x84b3('0x2c')]);_0x55fad6[_0x84b3('0x2d')]=_[_0x84b3('0x2e')](_0x55fad6['model'],_0x55fad6[_0x84b3('0x2c')]);_0x2849fd[_0x84b3('0x2f')]=_[_0x84b3('0x2e')](_0x55fad6[_0x84b3('0x29')],qs[_0x84b3('0x30')](_0x412128[_0x84b3('0x2c')][_0x84b3('0x30')]));_0x2849fd[_0x84b3('0x2f')]=_0x2849fd[_0x84b3('0x2f')][_0x84b3('0x31')]?_0x2849fd[_0x84b3('0x2f')]:_0x55fad6[_0x84b3('0x29')];if(!_0x412128[_0x84b3('0x2c')][_0x84b3('0x32')](_0x84b3('0x33'))){_0x2849fd[_0x84b3('0x1b')]=qs[_0x84b3('0x1b')](_0x412128['query'][_0x84b3('0x1b')]);_0x2849fd[_0x84b3('0x19')]=qs[_0x84b3('0x19')](_0x412128[_0x84b3('0x2c')]['offset']);}_0x2849fd[_0x84b3('0x34')]=qs[_0x84b3('0x35')](_0x412128[_0x84b3('0x2c')][_0x84b3('0x35')]);_0x2849fd[_0x84b3('0x36')]=qs[_0x84b3('0x2d')](_[_0x84b3('0x37')](_0x412128[_0x84b3('0x2c')],_0x55fad6[_0x84b3('0x2d')]),_0x500d2c);if(_0x412128[_0x84b3('0x2c')]['filter']){_0x2849fd[_0x84b3('0x36')]=_['merge'](_0x2849fd[_0x84b3('0x36')],{'$or':_[_0x84b3('0x2a')](_0x500d2c,function(_0x2e5770){if(_0x2e5770[_0x84b3('0x27')]!==_0x84b3('0x38')){var _0x2f591b={};_0x2f591b[_0x2e5770[_0x84b3('0x24')]]={'$like':'%'+_0x412128[_0x84b3('0x2c')][_0x84b3('0x39')]+'%'};return _0x2f591b;}})});}_0x2849fd=_[_0x84b3('0x3a')]({},_0x2849fd,_0x412128[_0x84b3('0x3b')]);var _0x1a6a9c={'where':_0x2849fd[_0x84b3('0x36')]};return db[_0x84b3('0x3c')][_0x84b3('0x1c')](_0x1a6a9c)[_0x84b3('0x21')](function(_0x3c6a05){_0x4b3c2e[_0x84b3('0x1c')]=_0x3c6a05;if(_0x412128[_0x84b3('0x2c')][_0x84b3('0x3d')]){_0x2849fd[_0x84b3('0x3e')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x84b3('0x3f')](_0x2849fd);})[_0x84b3('0x21')](function(_0x449825){_0x4b3c2e['rows']=_0x449825;return _0x4b3c2e;})['then'](respondWithFilteredResult(_0x7014d5,_0x2849fd))[_0x84b3('0x40')](handleError(_0x7014d5,null));};exports[_0x84b3('0x41')]=function(_0x22d400,_0x18d92c){var _0x16b2de={'raw':!![],'where':{'id':_0x22d400[_0x84b3('0x42')]['id']}},_0x31c090={};_0x31c090[_0x84b3('0x29')]=_[_0x84b3('0x2b')](db[_0x84b3('0x3c')][_0x84b3('0x43')]);_0x31c090[_0x84b3('0x2c')]=_[_0x84b3('0x2b')](_0x22d400[_0x84b3('0x2c')]);_0x31c090['filters']=_[_0x84b3('0x2e')](_0x31c090['model'],_0x31c090[_0x84b3('0x2c')]);_0x16b2de['attributes']=_[_0x84b3('0x2e')](_0x31c090[_0x84b3('0x29')],qs[_0x84b3('0x30')](_0x22d400[_0x84b3('0x2c')][_0x84b3('0x30')]));_0x16b2de[_0x84b3('0x2f')]=_0x16b2de[_0x84b3('0x2f')]['length']?_0x16b2de['attributes']:_0x31c090[_0x84b3('0x29')];if(_0x22d400['query']['includeAll']){_0x16b2de[_0x84b3('0x3e')]=[{'all':!![]}];}_0x16b2de=_[_0x84b3('0x3a')]({},_0x16b2de,_0x22d400[_0x84b3('0x3b')]);return db[_0x84b3('0x3c')]['find'](_0x16b2de)[_0x84b3('0x21')](handleEntityNotFound(_0x18d92c,null))[_0x84b3('0x21')](respondWithResult(_0x18d92c,null))[_0x84b3('0x40')](handleError(_0x18d92c,null));};exports['create']=function(_0x5602c3,_0x2517c7){return db[_0x84b3('0x3c')][_0x84b3('0x44')](_0x5602c3[_0x84b3('0x45')],{})[_0x84b3('0x21')](respondWithResult(_0x2517c7,0xc9))['catch'](handleError(_0x2517c7,null));};exports[_0x84b3('0x46')]=function(_0x4d85a6,_0x412034){if(_0x4d85a6[_0x84b3('0x45')]['id']){delete _0x4d85a6[_0x84b3('0x45')]['id'];}return db[_0x84b3('0x3c')][_0x84b3('0x47')]({'where':{'id':_0x4d85a6[_0x84b3('0x42')]['id']}})[_0x84b3('0x21')](handleEntityNotFound(_0x412034,null))[_0x84b3('0x21')](saveUpdates(_0x4d85a6[_0x84b3('0x45')],null))[_0x84b3('0x21')](respondWithResult(_0x412034,null))[_0x84b3('0x40')](handleError(_0x412034,null));};exports[_0x84b3('0x22')]=function(_0x2b31d7,_0x51facb){return db[_0x84b3('0x3c')][_0x84b3('0x47')]({'where':{'id':_0x2b31d7[_0x84b3('0x42')]['id']}})['then'](handleEntityNotFound(_0x51facb,null))['then'](removeEntity(_0x51facb,null))['catch'](handleError(_0x51facb,null));};exports[_0x84b3('0x48')]=function(_0x8f5600,_0x211955){return db[_0x84b3('0x3c')][_0x84b3('0x48')]()[_0x84b3('0x21')](respondWithResult(_0x211955,null))[_0x84b3('0x40')](handleError(_0x211955,null));}; \ No newline at end of file +var _0x2966=['map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','WhatsappTransferReport','rawAttributes','key','model'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2966,0x187));var _0x6296=function(_0x3288d6,_0x5a994d){_0x3288d6=_0x3288d6-0x0;var _0x5aa6bb=_0x2966[_0x3288d6];return _0x5aa6bb;};'use strict';var emlformat=require(_0x6296('0x0'));var rimraf=require(_0x6296('0x1'));var zipdir=require(_0x6296('0x2'));var jsonpatch=require(_0x6296('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6296('0x4'));var Mustache=require(_0x6296('0x5'));var util=require(_0x6296('0x6'));var path=require(_0x6296('0x7'));var sox=require(_0x6296('0x8'));var csv=require(_0x6296('0x9'));var ejs=require(_0x6296('0xa'));var fs=require('fs');var fs_extra=require(_0x6296('0xb'));var _=require('lodash');var squel=require(_0x6296('0xc'));var crypto=require('crypto');var jsforce=require(_0x6296('0xd'));var deskjs=require(_0x6296('0xe'));var toCsv=require(_0x6296('0x9'));var querystring=require(_0x6296('0xf'));var Papa=require(_0x6296('0x10'));var Redis=require('ioredis');var authService=require(_0x6296('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6296('0x12'));var hardwareService=require(_0x6296('0x13'));var logger=require(_0x6296('0x14'))(_0x6296('0x15'));var utils=require('../../config/utils');var config=require(_0x6296('0x16'));var licenseUtil=require(_0x6296('0x17'));var db=require(_0x6296('0x18'))['db'];function respondWithStatusCode(_0x52e4bd,_0x302bfb){_0x302bfb=_0x302bfb||0xcc;return function(_0x39d066){if(_0x39d066){return _0x52e4bd['sendStatus'](_0x302bfb);}return _0x52e4bd[_0x6296('0x19')](_0x302bfb)[_0x6296('0x1a')]();};}function respondWithResult(_0xf4502f,_0xb37493){_0xb37493=_0xb37493||0xc8;return function(_0x1a3b37){if(_0x1a3b37){return _0xf4502f[_0x6296('0x19')](_0xb37493)[_0x6296('0x1b')](_0x1a3b37);}};}function respondWithFilteredResult(_0x5af34a,_0x48d0e9){return function(_0x566663){if(_0x566663){var _0x3c5b6d=typeof _0x48d0e9[_0x6296('0x1c')]==='undefined'&&typeof _0x48d0e9[_0x6296('0x1d')]==='undefined';var _0xc76fe5=_0x566663['count'];var _0x1be18a=_0x3c5b6d?0x0:_0x48d0e9[_0x6296('0x1c')];var _0x2a26c6=_0x3c5b6d?_0x566663[_0x6296('0x1e')]:_0x48d0e9['offset']+_0x48d0e9['limit'];var _0x4acaf4;if(_0x2a26c6>=_0xc76fe5){_0x2a26c6=_0xc76fe5;_0x4acaf4=0xc8;}else{_0x4acaf4=0xce;}_0x5af34a[_0x6296('0x19')](_0x4acaf4);return _0x5af34a[_0x6296('0x1f')](_0x6296('0x20'),_0x1be18a+'-'+_0x2a26c6+'/'+_0xc76fe5)[_0x6296('0x1b')](_0x566663);}return null;};}function patchUpdates(_0x59fcf2){return function(_0x4c6602){try{jsonpatch['apply'](_0x4c6602,_0x59fcf2,!![]);}catch(_0x569be7){return BPromise[_0x6296('0x21')](_0x569be7);}return _0x4c6602[_0x6296('0x22')]();};}function saveUpdates(_0x1d538d,_0x1f928c){return function(_0x14bdc1){if(_0x14bdc1){return _0x14bdc1[_0x6296('0x23')](_0x1d538d)[_0x6296('0x24')](function(_0x89924){return _0x89924;});}return null;};}function removeEntity(_0x31bbe4,_0x5ef8cf){return function(_0x413cb3){if(_0x413cb3){return _0x413cb3[_0x6296('0x25')]()[_0x6296('0x24')](function(){_0x31bbe4['status'](0xcc)[_0x6296('0x1a')]();});}};}function handleEntityNotFound(_0x1a925f,_0x122936){return function(_0x3a5c0b){if(!_0x3a5c0b){_0x1a925f[_0x6296('0x26')](0x194);}return _0x3a5c0b;};}function handleError(_0x281e0f,_0x2bc489){_0x2bc489=_0x2bc489||0x1f4;return function(_0x2e15bb){logger[_0x6296('0x27')](_0x2e15bb[_0x6296('0x28')]);if(_0x2e15bb[_0x6296('0x29')]){delete _0x2e15bb[_0x6296('0x29')];}_0x281e0f['status'](_0x2bc489)[_0x6296('0x2a')](_0x2e15bb);};}exports['index']=function(_0x6f4847,_0x3761da){var _0xfa5c4c={},_0x2d02c7={},_0xce40b2={'count':0x0,'rows':[]};var _0x35c23e=_['map'](db[_0x6296('0x2b')][_0x6296('0x2c')],function(_0x2448a0){return{'name':_0x2448a0['fieldName'],'type':_0x2448a0['type'][_0x6296('0x2d')]};});_0x2d02c7[_0x6296('0x2e')]=_[_0x6296('0x2f')](_0x35c23e,_0x6296('0x29'));_0x2d02c7[_0x6296('0x30')]=_[_0x6296('0x31')](_0x6f4847[_0x6296('0x30')]);_0x2d02c7[_0x6296('0x32')]=_[_0x6296('0x33')](_0x2d02c7[_0x6296('0x2e')],_0x2d02c7[_0x6296('0x30')]);_0xfa5c4c['attributes']=_[_0x6296('0x33')](_0x2d02c7['model'],qs['fields'](_0x6f4847[_0x6296('0x30')][_0x6296('0x34')]));_0xfa5c4c[_0x6296('0x35')]=_0xfa5c4c[_0x6296('0x35')][_0x6296('0x36')]?_0xfa5c4c[_0x6296('0x35')]:_0x2d02c7[_0x6296('0x2e')];if(!_0x6f4847['query'][_0x6296('0x37')]('nolimit')){_0xfa5c4c[_0x6296('0x1d')]=qs['limit'](_0x6f4847['query'][_0x6296('0x1d')]);_0xfa5c4c[_0x6296('0x1c')]=qs[_0x6296('0x1c')](_0x6f4847['query']['offset']);}_0xfa5c4c[_0x6296('0x38')]=qs[_0x6296('0x39')](_0x6f4847[_0x6296('0x30')][_0x6296('0x39')]);_0xfa5c4c[_0x6296('0x3a')]=qs[_0x6296('0x32')](_['pick'](_0x6f4847[_0x6296('0x30')],_0x2d02c7['filters']),_0x35c23e);if(_0x6f4847[_0x6296('0x30')][_0x6296('0x3b')]){_0xfa5c4c['where']=_[_0x6296('0x3c')](_0xfa5c4c['where'],{'$or':_[_0x6296('0x2f')](_0x35c23e,function(_0x3fdbad){if(_0x3fdbad[_0x6296('0x3d')]!==_0x6296('0x3e')){var _0x3393db={};_0x3393db[_0x3fdbad[_0x6296('0x29')]]={'$like':'%'+_0x6f4847[_0x6296('0x30')][_0x6296('0x3b')]+'%'};return _0x3393db;}})});}_0xfa5c4c=_[_0x6296('0x3c')]({},_0xfa5c4c,_0x6f4847[_0x6296('0x3f')]);var _0x14861d={'where':_0xfa5c4c[_0x6296('0x3a')]};return db[_0x6296('0x2b')]['count'](_0x14861d)[_0x6296('0x24')](function(_0x13a61e){_0xce40b2['count']=_0x13a61e;if(_0x6f4847['query'][_0x6296('0x40')]){_0xfa5c4c[_0x6296('0x41')]=[{'all':!![]}];}return db[_0x6296('0x2b')][_0x6296('0x42')](_0xfa5c4c);})[_0x6296('0x24')](function(_0x21dfb2){_0xce40b2['rows']=_0x21dfb2;return _0xce40b2;})[_0x6296('0x24')](respondWithFilteredResult(_0x3761da,_0xfa5c4c))[_0x6296('0x43')](handleError(_0x3761da,null));};exports['show']=function(_0x203cc0,_0x384c6e){var _0x2d4708={'raw':!![],'where':{'id':_0x203cc0[_0x6296('0x44')]['id']}},_0x1ea5ab={};_0x1ea5ab[_0x6296('0x2e')]=_[_0x6296('0x31')](db[_0x6296('0x2b')][_0x6296('0x2c')]);_0x1ea5ab[_0x6296('0x30')]=_[_0x6296('0x31')](_0x203cc0[_0x6296('0x30')]);_0x1ea5ab['filters']=_[_0x6296('0x33')](_0x1ea5ab['model'],_0x1ea5ab[_0x6296('0x30')]);_0x2d4708[_0x6296('0x35')]=_['intersection'](_0x1ea5ab[_0x6296('0x2e')],qs[_0x6296('0x34')](_0x203cc0['query'][_0x6296('0x34')]));_0x2d4708[_0x6296('0x35')]=_0x2d4708[_0x6296('0x35')][_0x6296('0x36')]?_0x2d4708[_0x6296('0x35')]:_0x1ea5ab[_0x6296('0x2e')];if(_0x203cc0[_0x6296('0x30')][_0x6296('0x40')]){_0x2d4708[_0x6296('0x41')]=[{'all':!![]}];}_0x2d4708=_[_0x6296('0x3c')]({},_0x2d4708,_0x203cc0[_0x6296('0x3f')]);return db[_0x6296('0x2b')][_0x6296('0x45')](_0x2d4708)['then'](handleEntityNotFound(_0x384c6e,null))['then'](respondWithResult(_0x384c6e,null))[_0x6296('0x43')](handleError(_0x384c6e,null));};exports[_0x6296('0x46')]=function(_0x356661,_0x5ac085){return db['WhatsappTransferReport'][_0x6296('0x46')](_0x356661[_0x6296('0x47')],{})[_0x6296('0x24')](respondWithResult(_0x5ac085,0xc9))[_0x6296('0x43')](handleError(_0x5ac085,null));};exports['update']=function(_0xc38f73,_0x4750b5){if(_0xc38f73['body']['id']){delete _0xc38f73[_0x6296('0x47')]['id'];}return db['WhatsappTransferReport'][_0x6296('0x45')]({'where':{'id':_0xc38f73['params']['id']}})[_0x6296('0x24')](handleEntityNotFound(_0x4750b5,null))[_0x6296('0x24')](saveUpdates(_0xc38f73[_0x6296('0x47')],null))[_0x6296('0x24')](respondWithResult(_0x4750b5,null))[_0x6296('0x43')](handleError(_0x4750b5,null));};exports['destroy']=function(_0x546237,_0x45cedc){return db['WhatsappTransferReport']['find']({'where':{'id':_0x546237[_0x6296('0x44')]['id']}})[_0x6296('0x24')](handleEntityNotFound(_0x45cedc,null))[_0x6296('0x24')](removeEntity(_0x45cedc,null))[_0x6296('0x43')](handleError(_0x45cedc,null));};exports['describe']=function(_0x55ff8f,_0x129581){return db['WhatsappTransferReport'][_0x6296('0x48')]()[_0x6296('0x24')](respondWithResult(_0x129581,null))[_0x6296('0x43')](handleError(_0x129581,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index fd3d76b..9412464 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 _0x8f3b=['report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','WhatsappTransferReport'];(function(_0x42b3fc,_0x4fbebd){var _0x14272a=function(_0x1ff9e4){while(--_0x1ff9e4){_0x42b3fc['push'](_0x42b3fc['shift']());}};_0x14272a(++_0x4fbebd);}(_0x8f3b,0x64));var _0xb8f3=function(_0xdf139b,_0x34eba7){_0xdf139b=_0xdf139b-0x0;var _0x25607a=_0x8f3b[_0xdf139b];return _0x25607a;};'use strict';var _=require(_0xb8f3('0x0'));var util=require(_0xb8f3('0x1'));var logger=require(_0xb8f3('0x2'))(_0xb8f3('0x3'));var moment=require(_0xb8f3('0x4'));var BPromise=require(_0xb8f3('0x5'));var rp=require(_0xb8f3('0x6'));var fs=require('fs');var path=require(_0xb8f3('0x7'));var rimraf=require(_0xb8f3('0x8'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0xb8f3('0x9')]=function(_0x50c792,_0x2d0214){return _0x50c792[_0xb8f3('0xa')](_0xb8f3('0xb'),attributes,{'tableName':_0xb8f3('0xc'),'paranoid':![],'indexes':[{'name':_0xb8f3('0xd'),'fields':[_0xb8f3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x858d=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports'];(function(_0x17fd45,_0x1210b7){var _0x333e8e=function(_0x1b51dc){while(--_0x1b51dc){_0x17fd45['push'](_0x17fd45['shift']());}};_0x333e8e(++_0x1210b7);}(_0x858d,0xe4));var _0xd858=function(_0x5bf197,_0x2151d8){_0x5bf197=_0x5bf197-0x0;var _0x4d5048=_0x858d[_0x5bf197];return _0x4d5048;};'use strict';var _=require('lodash');var util=require(_0xd858('0x0'));var logger=require(_0xd858('0x1'))(_0xd858('0x2'));var moment=require(_0xd858('0x3'));var BPromise=require(_0xd858('0x4'));var rp=require(_0xd858('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd858('0x6'));var config=require(_0xd858('0x7'));var attributes=require(_0xd858('0x8'));module[_0xd858('0x9')]=function(_0x20cb80,_0x3c2b3e){return _0x20cb80[_0xd858('0xa')](_0xd858('0xb'),attributes,{'tableName':_0xd858('0xc'),'paranoid':![],'indexes':[{'name':_0xd858('0xd'),'fields':[_0xd858('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 7aabda4..9d5a9d0 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 _0x147b=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','WhatsappTransferReport,\x20%s,\x20%s','result'];(function(_0x1b7b68,_0x7ff297){var _0x1af4db=function(_0x27a58a){while(--_0x27a58a){_0x1b7b68['push'](_0x1b7b68['shift']());}};_0x1af4db(++_0x7ff297);}(_0x147b,0xa0));var _0xb147=function(_0x1a7a25,_0x11ddde){_0x1a7a25=_0x1a7a25-0x0;var _0x5c4e4b=_0x147b[_0x1a7a25];return _0x5c4e4b;};'use strict';var _=require(_0xb147('0x0'));var util=require(_0xb147('0x1'));var moment=require(_0xb147('0x2'));var BPromise=require(_0xb147('0x3'));var rs=require(_0xb147('0x4'));var fs=require('fs');var Redis=require(_0xb147('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb147('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb147('0x7'));var jayson=require(_0xb147('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7db3f0,_0x192be0,_0x3b4fe0){return new BPromise(function(_0x23693c,_0x32dade){return client[_0xb147('0x9')](_0x7db3f0,_0x3b4fe0)[_0xb147('0xa')](function(_0x55cd1b){logger[_0xb147('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x192be0,_0xb147('0xc'));logger[_0xb147('0xd')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x192be0,_0xb147('0xc'),JSON[_0xb147('0xe')](_0x55cd1b));if(_0x55cd1b[_0xb147('0xf')]){if(_0x55cd1b['error'][_0xb147('0x10')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x192be0,_0x55cd1b[_0xb147('0xf')]['message']);return _0x32dade(_0x55cd1b[_0xb147('0xf')][_0xb147('0x11')]);}logger[_0xb147('0xf')](_0xb147('0x12'),_0x192be0,_0x55cd1b['error'][_0xb147('0x11')]);return _0x23693c(_0x55cd1b[_0xb147('0xf')]['message']);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x192be0,'request\x20sent');_0x23693c(_0x55cd1b[_0xb147('0x13')][_0xb147('0x11')]);}})['catch'](function(_0x1ab4a4){logger['error'](_0xb147('0x12'),_0x192be0,_0x1ab4a4);_0x32dade(_0x1ab4a4);});});} \ No newline at end of file +var _0x36e2=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash'];(function(_0xbfb65,_0x7b4172){var _0x595091=function(_0x20f31){while(--_0x20f31){_0xbfb65['push'](_0xbfb65['shift']());}};_0x595091(++_0x7b4172);}(_0x36e2,0x1f3));var _0x236e=function(_0x2cc395,_0xf64370){_0x2cc395=_0x2cc395-0x0;var _0x213b9c=_0x36e2[_0x2cc395];return _0x213b9c;};'use strict';var _=require(_0x236e('0x0'));var util=require('util');var moment=require(_0x236e('0x1'));var BPromise=require(_0x236e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x236e('0x3'))['db'];var utils=require(_0x236e('0x4'));var logger=require(_0x236e('0x5'))(_0x236e('0x6'));var config=require(_0x236e('0x7'));var jayson=require(_0x236e('0x8'));var client=jayson[_0x236e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30a386,_0x58d1df,_0x489f0d){return new BPromise(function(_0x44857f,_0xa6a959){return client['request'](_0x30a386,_0x489f0d)[_0x236e('0xa')](function(_0x196073){logger[_0x236e('0xb')](_0x236e('0xc'),_0x58d1df,_0x236e('0xd'));logger[_0x236e('0xe')](_0x236e('0xf'),_0x58d1df,_0x236e('0xd'),JSON['stringify'](_0x196073));if(_0x196073[_0x236e('0x10')]){if(_0x196073[_0x236e('0x10')][_0x236e('0x11')]===0x1f4){logger[_0x236e('0x10')](_0x236e('0xc'),_0x58d1df,_0x196073[_0x236e('0x10')][_0x236e('0x12')]);return _0xa6a959(_0x196073['error'][_0x236e('0x12')]);}logger['error'](_0x236e('0xc'),_0x58d1df,_0x196073[_0x236e('0x10')]['message']);return _0x44857f(_0x196073[_0x236e('0x10')][_0x236e('0x12')]);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x58d1df,_0x236e('0xd'));_0x44857f(_0x196073['result'][_0x236e('0x12')]);}})[_0x236e('0x13')](function(_0x47babb){logger[_0x236e('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x58d1df,_0x47babb);_0xa6a959(_0x47babb);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index a488f0c..f3ce922 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29b1=['join','Offline\x20apps:','status','online','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sync','then','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name'];(function(_0xe905e8,_0x3b940b){var _0x37a014=function(_0x484d57){while(--_0x484d57){_0xe905e8['push'](_0xe905e8['shift']());}};_0x37a014(++_0x3b940b);}(_0x29b1,0x13b));var _0x129b=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x29b1[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var db=require('./mysqldb')['db'];var seedDb=require(_0x129b('0x0'));var checkLicense=require(_0x129b('0x1'));var rpc=require(_0x129b('0x2'));var config=require(_0x129b('0x3'));var logger=require(_0x129b('0x4'))(_0x129b('0x5'));var pm2=require(_0x129b('0x6'));var pm2Config=require(_0x129b('0x7'));var schedule=require(_0x129b('0x8'));var chat=require(_0x129b('0x9'));var whatsapp=require(_0x129b('0xa'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x129b('0xb'));function main(){return db['sequelize'][_0x129b('0xc')]()[_0x129b('0xd')](function(){if(config['seedDB']){return seedDb['default']();}})[_0x129b('0xd')](function(){return checkLicense['default']();})[_0x129b('0xd')](function(){return rpc[_0x129b('0xe')]();})[_0x129b('0xd')](function(_0x228944){logger[_0x129b('0xf')](_0x228944);return chat[_0x129b('0x10')]();})['then'](function(){return whatsapp[_0x129b('0x10')]();})[_0x129b('0xd')](function(){return schedule['start']();})[_0x129b('0xd')](function(){return transcribe[_0x129b('0x10')]();})['then'](function(){return provider[_0x129b('0x10')]();})[_0x129b('0xd')](function(_0x3f73b4){logger[_0x129b('0xf')](_0x3f73b4);return pm2[_0x129b('0x10')](pm2Config);})['then'](function(_0x94390d){var _0x161886=_0x94390d[_0x129b('0x11')](function(_0x4edd0e){return typeof _0x4edd0e[_0x129b('0x12')]===_0x129b('0x13')&&_0x4edd0e['exitCode']>=0x0;});if(_0x161886[_0x129b('0x14')]>0x0){throw new Error(_0x161886['length']+_0x129b('0x15')+_[_0x129b('0x16')](_0x161886,function(_0x1ba4c7){return'\x22'+_0x1ba4c7[_0x129b('0x17')][_0x129b('0x18')]+'\x22';}));}logger[_0x129b('0xf')]('Online\x20apps:',_[_0x129b('0x16')](_[_0x129b('0x11')](_0x94390d,{'status':'online'}),_0x129b('0x18'))[_0x129b('0x19')]());logger[_0x129b('0xf')](_0x129b('0x1a'),_[_0x129b('0x16')](_[_0x129b('0x11')](_0x94390d,function(_0x54c15b){return _0x54c15b[_0x129b('0x1b')]!==_0x129b('0x1c');}),'name')[_0x129b('0x19')]()||'None');console[_0x129b('0x1d')]('App\x20Ready!');})[_0x129b('0x1e')](function(_0x5d2b8e){console[_0x129b('0x1d')](_0x129b('0x1f'),_0x5d2b8e);logger[_0x129b('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x5d2b8e);process[_0x129b('0x21')](0x1);});}main(); \ No newline at end of file +var _0x4abf=['app','./config/pm2','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','Online\x20apps:','map','join','Offline\x20apps:','status','online','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/license'];(function(_0x577303,_0x1a0618){var _0x1493c6=function(_0x5727a8){while(--_0x5727a8){_0x577303['push'](_0x577303['shift']());}};_0x1493c6(++_0x1a0618);}(_0x4abf,0xac));var _0xf4ab=function(_0x342967,_0x176fd7){_0x342967=_0x342967-0x0;var _0x393b7e=_0x4abf[_0x342967];return _0x393b7e;};'use strict';var _=require(_0xf4ab('0x0'));var db=require(_0xf4ab('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xf4ab('0x2'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require('./config/logger')(_0xf4ab('0x3'));var pm2=require(_0xf4ab('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0xf4ab('0x5'));var whatsapp=require(_0xf4ab('0x6'));var transcribe=require(_0xf4ab('0x7'));var provider=require(_0xf4ab('0x8'));function main(){return db['sequelize'][_0xf4ab('0x9')]()[_0xf4ab('0xa')](function(){if(config['seedDB']){return seedDb[_0xf4ab('0xb')]();}})['then'](function(){return checkLicense[_0xf4ab('0xb')]();})[_0xf4ab('0xa')](function(){return rpc[_0xf4ab('0xc')]();})[_0xf4ab('0xa')](function(_0x3aef30){logger[_0xf4ab('0xd')](_0x3aef30);return chat[_0xf4ab('0xe')]();})[_0xf4ab('0xa')](function(){return whatsapp[_0xf4ab('0xe')]();})[_0xf4ab('0xa')](function(){return schedule[_0xf4ab('0xe')]();})[_0xf4ab('0xa')](function(){return transcribe[_0xf4ab('0xe')]();})['then'](function(){return provider['start']();})[_0xf4ab('0xa')](function(_0x54eabf){logger[_0xf4ab('0xd')](_0x54eabf);return pm2[_0xf4ab('0xe')](pm2Config);})[_0xf4ab('0xa')](function(_0x23c03d){var _0x1f2d12=_0x23c03d[_0xf4ab('0xf')](function(_0x47abb8){return typeof _0x47abb8[_0xf4ab('0x10')]===_0xf4ab('0x11')&&_0x47abb8[_0xf4ab('0x10')]>=0x0;});if(_0x1f2d12['length']>0x0){throw new Error(_0x1f2d12[_0xf4ab('0x12')]+_0xf4ab('0x13')+_['map'](_0x1f2d12,function(_0x196ea7){return'\x22'+_0x196ea7[_0xf4ab('0x14')][_0xf4ab('0x15')]+'\x22';}));}logger[_0xf4ab('0xd')](_0xf4ab('0x16'),_[_0xf4ab('0x17')](_[_0xf4ab('0xf')](_0x23c03d,{'status':'online'}),'name')[_0xf4ab('0x18')]());logger['info'](_0xf4ab('0x19'),_[_0xf4ab('0x17')](_[_0xf4ab('0xf')](_0x23c03d,function(_0x4b8632){return _0x4b8632[_0xf4ab('0x1a')]!==_0xf4ab('0x1b');}),_0xf4ab('0x15'))[_0xf4ab('0x18')]()||_0xf4ab('0x1c'));console['log'](_0xf4ab('0x1d'));})[_0xf4ab('0x1e')](function(_0x209711){console[_0xf4ab('0x1f')](_0xf4ab('0x20'),_0x209711);logger[_0xf4ab('0x21')](_0xf4ab('0x22'),_0x209711);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index cc6fbbe..0b2c683 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 _0xa583=['Invalid\x20API\x20access\x20key','blocked','add','Unknown\x20authorization\x20format','find','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyNonce','isNil','apiKeyIat','query','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','unshift','promisify','secret','secrets','payload','options','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','session','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','use','authorization','startsWith','headers','Basic','User','authenticate','Bearer','json','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','disabled'];(function(_0x591d04,_0x157a6f){var _0x322ceb=function(_0x204acd){while(--_0x204acd){_0x591d04['push'](_0x591d04['shift']());}};_0x322ceb(++_0x157a6f);}(_0xa583,0x127));var _0x3a58=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa583[_0x4b369d];return _0x571a98;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x3a58('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x3a58('0x1'));var encryptor=require(_0x3a58('0x2'));var _=require(_0x3a58('0x3'));var jwt=require(_0x3a58('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x3a58('0x5'));var basicAuth=require(_0x3a58('0x6'));var crypto=require(_0x3a58('0x7'));var BPromise=require(_0x3a58('0x8'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets'][_0x3a58('0x9')]});var userAttributes=['id','role',_0x3a58('0xa'),_0x3a58('0xb'),_0x3a58('0xc'),_0x3a58('0xd'),_0x3a58('0xe'),_0x3a58('0xf'),'md5secret','voicePause',_0x3a58('0x10'),_0x3a58('0x11'),_0x3a58('0x12'),_0x3a58('0x13'),_0x3a58('0x14'),_0x3a58('0x15'),_0x3a58('0x16'),_0x3a58('0x17'),_0x3a58('0x18'),_0x3a58('0x19'),_0x3a58('0x1a'),_0x3a58('0x1b'),_0x3a58('0x1c'),'phoneBarAutoAnswer',_0x3a58('0x1d'),_0x3a58('0x1e'),_0x3a58('0x1f'),_0x3a58('0x20'),'phoneBarEnableSettings',_0x3a58('0x21'),'phoneBarPrefixRequired',_0x3a58('0x22'),_0x3a58('0x23'),'hotdesk',_0x3a58('0x24'),'userProfileId',_0x3a58('0x25'),_0x3a58('0x26'),_0x3a58('0x27'),_0x3a58('0x28'),_0x3a58('0x29'),'downloadAttachments',_0x3a58('0x2a'),'selectRecallMeCampaign'];exports[_0x3a58('0x2b')]=function(){return this[_0x3a58('0x2c')](!![])['use'](function(_0x36850b,_0x4e3727,_0x533499){if(_0x36850b[_0x3a58('0x2d')]){_0x533499();}else{return db[_0x3a58('0x2e')][_0x3a58('0x2f')]({'where':{'id':_0x36850b[_0x3a58('0x30')]['id']},'attributes':['id',_0x3a58('0x31'),_0x3a58('0x32')],'raw':!![]})[_0x3a58('0x33')](function(_0x2b94bb){if(_0x2b94bb&&_0x2b94bb['closed']){return _0x4e3727[_0x3a58('0x34')](_0x2b94bb[_0x3a58('0x32')]==='unmanaged'?0x195:0x193)['json']({'message':_0x2b94bb[_0x3a58('0x32')]===_0x3a58('0x35')?'Unmanaged.':_0x3a58('0x36')});}else{_0x533499();}})[_0x3a58('0x37')](function(_0x59b060){_0x533499(_0x59b060);});}});};exports['isAuthenticated']=function isAuthenticated(_0x5593ff){return compose()[_0x3a58('0x38')](function(_0x3e1dd1,_0x4073b4,_0x325a29){var _0x3f24e8;if(_0x3e1dd1['headers'][_0x3a58('0x39')]){if(_[_0x3a58('0x3a')](_0x3e1dd1[_0x3a58('0x3b')][_0x3a58('0x39')],_0x3a58('0x3c'))){var _0x3ec6e4=basicAuth(_0x3e1dd1);db[_0x3a58('0x3d')]['find']({'where':{'name':_0x3ec6e4[_0x3a58('0xb')]}})['then'](function(_0x55b49f){if(!_0x55b49f||!_0x55b49f[_0x3a58('0x3e')](_0x3ec6e4['pass'])){return _0x4073b4[_0x3a58('0x34')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x3e1dd1[_0x3a58('0x2d')]={'id':_0x55b49f['id']};_0x325a29();})[_0x3a58('0x37')](function(_0x3e18c){_0x325a29(_0x3e18c);});}else if(_['startsWith'](_0x3e1dd1[_0x3a58('0x3b')][_0x3a58('0x39')],_0x3a58('0x3f'))){validateJwt(_0x3e1dd1,_0x4073b4,_0x325a29);}else{if(_0x5593ff){_0x325a29();}else{return _0x4073b4['status'](0x193)[_0x3a58('0x40')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x3e1dd1['query'][_0x3a58('0x41')]){try{var _0x4efdeb={'audience':hardwareConf[_0x3a58('0x42')](),'issuer':hardwareConf[_0x3a58('0x42')]()};verifyJwt(_0x3e1dd1['query'][_0x3a58('0x41')],_0x4efdeb)[_0x3a58('0x33')](function(_0x36e153){return db[_0x3a58('0x3d')]['find']({'where':{'id':_0x36e153[_0x3a58('0x43')]}})['then'](function(_0x5d9b9d){_0x3f24e8=_0x5d9b9d;return db[_0x3a58('0x44')][_0x3a58('0x2f')]({'where':{'id':0x1},'attributes':[_0x3a58('0x45'),_0x3a58('0x46')],'raw':!![]});})[_0x3a58('0x33')](function(_0x2f0d32){if(!_0x3f24e8||!_[_0x3a58('0x47')](_0x3f24e8['apiKeyNonce'],_0x36e153[_0x3a58('0x48')])){return _0x4073b4[_0x3a58('0x34')](0x191)[_0x3a58('0x40')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3f24e8[_0x3a58('0x49')]){return _0x4073b4[_0x3a58('0x34')](0x191)[_0x3a58('0x40')]({'message':_0x3a58('0x4a')});}if(_0x3f24e8[_0x3a58('0x4b')]){if(_0x2f0d32['blockDuration']>0x0){if(moment(_0x3f24e8['blockedAt'])[_0x3a58('0x4c')](_0x2f0d32[_0x3a58('0x46')],'minutes')>moment()){return _0x4073b4[_0x3a58('0x34')](0x191)[_0x3a58('0x40')]({'message':_0x3a58('0x4a')});}}else{return _0x4073b4[_0x3a58('0x34')](0x191)[_0x3a58('0x40')]({'message':_0x3a58('0x4a')});}}_0x3e1dd1[_0x3a58('0x2d')]={'id':_0x3f24e8['id']};_0x325a29();});})[_0x3a58('0x37')](function(){return _0x4073b4[_0x3a58('0x34')](0x191)[_0x3a58('0x40')]({'message':_0x3a58('0x4a')});});}catch(_0x229349){_0x325a29(_0x229349);}}else if(_0x5593ff){_0x325a29();}else{return _0x4073b4[_0x3a58('0x34')](0x193)[_0x3a58('0x40')]({'message':_0x3a58('0x4d')});}})[_0x3a58('0x38')](function(_0x48b3b9,_0x225520,_0x5b834f){if(_0x48b3b9[_0x3a58('0x2d')]){db[_0x3a58('0x3d')][_0x3a58('0x4e')]({'where':{'id':_0x48b3b9[_0x3a58('0x2d')]['id']},'attributes':userAttributes})['then'](function(_0x2cab7a){if(!_0x2cab7a){return _0x225520[_0x3a58('0x34')](0x194)[_0x3a58('0x40')]({'message':_0x3a58('0x4f')});}_0x48b3b9[_0x3a58('0x2d')]=_0x2cab7a;_0x5b834f();})[_0x3a58('0x37')](function(_0x386a6d){_0x5b834f(_0x386a6d);});}else if(_0x5593ff){_0x5b834f();}else{return _0x225520[_0x3a58('0x34')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x3a58('0x50')]=function canUpdate(){return compose()[_0x3a58('0x38')](function(_0x2dc44a,_0xbd8e77,_0x17bc1e){return licenseUtil[_0x3a58('0x51')]()[_0x3a58('0x33')](function(_0x64e169){if(_0x64e169[_0x3a58('0x52')]){_0x17bc1e();}else{return _0xbd8e77[_0x3a58('0x34')](0x193)['json']({'message':_0x3a58('0x53')});}})[_0x3a58('0x37')](function(_0x512699){_0x17bc1e(_0x512699);});});};exports[_0x3a58('0x54')]=function isWebrtcLicence(){return compose()[_0x3a58('0x38')](function(_0x35eaed,_0x23f533,_0x19929b){return licenseUtil[_0x3a58('0x51')]()['then'](function(_0x4669c0){if(_0x4669c0[_0x3a58('0x55')]){_0x19929b();}else{return _0x23f533[_0x3a58('0x34')](0x193)[_0x3a58('0x40')]({'message':_0x3a58('0x53')});}})[_0x3a58('0x37')](function(_0x769b45){_0x19929b(_0x769b45);});});};exports[_0x3a58('0x56')]=function(_0x3543f6,_0x1e95a8,_0x413d67){_0x3543f6[_0x3a58('0x56')]=!![];return _0x413d67();};exports[_0x3a58('0x57')]=function signToken(_0x1c385f){return signJwt(_0x1c385f);};exports[_0x3a58('0x58')]=function(_0x5371b0,_0x30c61d){if(!_0x5371b0['user']){return _0x30c61d[_0x3a58('0x34')](0x194)[_0x3a58('0x40')]({'message':_0x3a58('0x59')});}var _0x3e46cb={'payload':{'id':_0x5371b0[_0x3a58('0x2d')]['id'],'role':_0x5371b0[_0x3a58('0x2d')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3e46cb)['then'](function(_0x5a8f92){_0x30c61d[_0x3a58('0x5a')](_0x3a58('0x5b'),_0x5a8f92);_0x30c61d[_0x3a58('0x5c')](_0x3a58('0x5d'));})[_0x3a58('0x37')](function(_0xc3bac7){return _0x30c61d[_0x3a58('0x34')](0x1f4)[_0x3a58('0x5e')](_0xc3bac7);});};exports[_0x3a58('0x5f')]=function(_0xe87d92){if(_['isNil'](_0xe87d92[_0x3a58('0x60')])||_[_0x3a58('0x61')](_0xe87d92[_0x3a58('0x62')])){return null;}else{return createJwt(_0xe87d92);}};exports['generateApiKey']=function(_0x48eb33){_0x48eb33[_0x3a58('0x60')]=generateNonce();_0x48eb33[_0x3a58('0x62')]=generateIssuedAt();return createJwt(_0x48eb33);};exports['regenerateApiKey']=function(_0x51f8ef,_0xc39649){var _0x4e1448=_0x51f8ef[_0x3a58('0x63')][_0x3a58('0x41')];if(_0x4e1448){var _0x5a0718={'nonce':_0xc39649['apiKeyNonce'],'iat':_0xc39649['apiKeyIat'],'audience':hardwareConf[_0x3a58('0x42')](),'issuer':hardwareConf[_0x3a58('0x42')]()};return verifyJwt(_0x4e1448,_0x5a0718)['then'](function(){return generateApiKey(_0xc39649);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x3a58('0x64')]=function(_0x1680d1){var _0x25e775=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x25e775['test'](_0x1680d1))throw new db[(_0x3a58('0x65'))][(_0x3a58('0x66'))](_0x3a58('0x67'));return;};exports['validatePasswordHistory']=function(_0x175f1e,_0x5e949a,_0x490a7c){var _0x5ba5c6=encryptor[_0x3a58('0x68')](_0x5e949a)['split'](',');for(var _0x46f848=0x0;_0x46f848<_0x490a7c;_0x46f848++){if(!_0x5ba5c6[_0x46f848])break;if(_0x175f1e[_0x3a58('0x69')]()===_0x5ba5c6[_0x46f848][_0x3a58('0x69')]()){var _0x2609d9=util[_0x3a58('0x6a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x490a7c);if(_0x490a7c===0x1){_0x2609d9=_0x3a58('0x6b');}throw new db[(_0x3a58('0x65'))][(_0x3a58('0x66'))](_0x2609d9);}}return;};exports[_0x3a58('0x6c')]=function(_0x1faeb8,_0x45bb53){var _0x184c48=_0x45bb53?encryptor[_0x3a58('0x68')](_0x45bb53)[_0x3a58('0x6d')](','):[];if(_0x184c48[_0x3a58('0x6e')]===0x5){_0x184c48['splice'](-0x1,0x1);}_0x184c48[_0x3a58('0x6f')](_0x1faeb8);return encryptor['encryptString'](_0x184c48['join'](','));};function signJwt(_0x4b1181){var _0xb54280=BPromise[_0x3a58('0x70')](jwt['sign'],{'context':jwt});var _0x157661=_0x4b1181[_0x3a58('0x71')]||config[_0x3a58('0x72')][_0x3a58('0x9')];return new BPromise(function(_0x8d908a,_0x89ab36){_0xb54280(_0x4b1181[_0x3a58('0x73')],_0x157661,_0x4b1181[_0x3a58('0x74')])[_0x3a58('0x33')](function(_0x2da0c9){_0x8d908a(_0x2da0c9);})[_0x3a58('0x37')](function(_0x5bca66){_0x89ab36(_0x5bca66);});});}function verifyJwt(_0x48321d,_0x6d121d,_0x2d4bdc){var _0x49cf11=BPromise[_0x3a58('0x70')](jwt['verify'],{'context':jwt});var _0x5c275b=_0x2d4bdc||config[_0x3a58('0x72')]['session'];return new BPromise(function(_0x3d2dec,_0x391564){_0x49cf11(_0x48321d,_0x5c275b,_0x6d121d)[_0x3a58('0x33')](function(_0x39955f){_0x3d2dec(_0x39955f);})['catch'](function(_0x233642){_0x391564(_0x233642);});});}function generateNonce(){return crypto[_0x3a58('0x75')](0x10)[_0x3a58('0x76')](_0x3a58('0x77'));}function generateIssuedAt(){return Math[_0x3a58('0x78')](Date[_0x3a58('0x79')]()/0x3e8)[_0x3a58('0x76')]();}function createJwt(_0x5a6fc9){var _0x384c88={'payload':{'iat':_0x5a6fc9[_0x3a58('0x62')],'nonce':_0x5a6fc9['apiKeyNonce']},'options':{'algorithm':_0x3a58('0x7a'),'subject':_0x5a6fc9['id'][_0x3a58('0x76')](),'issuer':hardwareConf[_0x3a58('0x42')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x384c88)[_0x3a58('0x33')](function(_0x582147){return{'iat':_0x5a6fc9[_0x3a58('0x62')],'nonce':_0x5a6fc9[_0x3a58('0x60')],'token':_0x582147};});} \ No newline at end of file +var _0x2bf2=['updatePasswordsHistory','split','length','join','sign','payload','verify','randomBytes','toString','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','name','email','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','ignorePauseForPreviewCalls','isChatInteractionAuthorized','use','user','findOne','params','disposition','then','closed','status','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','User','find','authenticate','pass','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockedAt','add','Invalid\x20API\x20access\x20key','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','retrieveApiKey','isNil','generateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','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.'];(function(_0x59e067,_0x377449){var _0x3a2d0d=function(_0xa955a2){while(--_0xa955a2){_0x59e067['push'](_0x59e067['shift']());}};_0x3a2d0d(++_0x377449);}(_0x2bf2,0x16f));var _0x22bf=function(_0x20daf9,_0x4283cb){_0x20daf9=_0x20daf9-0x0;var _0x296c39=_0x2bf2[_0x20daf9];return _0x296c39;};'use strict';var db=require(_0x22bf('0x0'))['db'];var config=require(_0x22bf('0x1'));var hardwareConf=require(_0x22bf('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x22bf('0x3'));var _=require(_0x22bf('0x4'));var jwt=require(_0x22bf('0x5'));var expressJwt=require(_0x22bf('0x6'));var compose=require(_0x22bf('0x7'));var basicAuth=require(_0x22bf('0x8'));var crypto=require(_0x22bf('0x9'));var BPromise=require(_0x22bf('0xa'));var util=require(_0x22bf('0xb'));var moment=require(_0x22bf('0xc'));var validateJwt=expressJwt({'secret':config[_0x22bf('0xd')][_0x22bf('0xe')]});var userAttributes=['id',_0x22bf('0xf'),'fullname',_0x22bf('0x10'),'internal',_0x22bf('0x11'),'userpic','permissions','md5secret',_0x22bf('0x12'),_0x22bf('0x13'),_0x22bf('0x14'),'faxPause',_0x22bf('0x15'),_0x22bf('0x16'),_0x22bf('0x17'),'showWebBar',_0x22bf('0x18'),_0x22bf('0x19'),_0x22bf('0x1a'),_0x22bf('0x1b'),_0x22bf('0x1c'),'alias',_0x22bf('0x1d'),_0x22bf('0x1e'),_0x22bf('0x1f'),_0x22bf('0x20'),_0x22bf('0x21'),_0x22bf('0x22'),_0x22bf('0x23'),_0x22bf('0x24'),_0x22bf('0x25'),_0x22bf('0x26'),_0x22bf('0x27'),_0x22bf('0x28'),'userProfileId',_0x22bf('0x29'),_0x22bf('0x2a'),_0x22bf('0x2b'),_0x22bf('0x2c'),'downloadOmnichannelInteractions','downloadAttachments',_0x22bf('0x2d'),'selectRecallMeCampaign'];exports[_0x22bf('0x2e')]=function(){return this['isAuthenticated'](!![])[_0x22bf('0x2f')](function(_0x38c2ab,_0x38bbb3,_0xd11e51){if(_0x38c2ab[_0x22bf('0x30')]){_0xd11e51();}else{return db['ChatInteraction'][_0x22bf('0x31')]({'where':{'id':_0x38c2ab[_0x22bf('0x32')]['id']},'attributes':['id','closed',_0x22bf('0x33')],'raw':!![]})[_0x22bf('0x34')](function(_0x510bd9){if(_0x510bd9&&_0x510bd9[_0x22bf('0x35')]){return _0x38bbb3[_0x22bf('0x36')](_0x510bd9[_0x22bf('0x33')]==='unmanaged'?0x195:0x193)[_0x22bf('0x37')]({'message':_0x510bd9[_0x22bf('0x33')]==='unmanaged'?_0x22bf('0x38'):_0x22bf('0x39')});}else{_0xd11e51();}})['catch'](function(_0x14bae8){_0xd11e51(_0x14bae8);});}});};exports['isAuthenticated']=function isAuthenticated(_0x3783f6){return compose()[_0x22bf('0x2f')](function(_0x398da1,_0x2abf96,_0x54804a){var _0x2e73d3;if(_0x398da1[_0x22bf('0x3a')][_0x22bf('0x3b')]){if(_[_0x22bf('0x3c')](_0x398da1[_0x22bf('0x3a')][_0x22bf('0x3b')],'Basic')){var _0x265fc0=basicAuth(_0x398da1);db[_0x22bf('0x3d')][_0x22bf('0x3e')]({'where':{'name':_0x265fc0[_0x22bf('0x10')]}})[_0x22bf('0x34')](function(_0x2289a9){if(!_0x2289a9||!_0x2289a9[_0x22bf('0x3f')](_0x265fc0[_0x22bf('0x40')])){return _0x2abf96['status'](0x191)[_0x22bf('0x37')]({'message':_0x22bf('0x41')});}_0x398da1[_0x22bf('0x30')]={'id':_0x2289a9['id']};_0x54804a();})[_0x22bf('0x42')](function(_0xeac5ad){_0x54804a(_0xeac5ad);});}else if(_['startsWith'](_0x398da1[_0x22bf('0x3a')][_0x22bf('0x3b')],_0x22bf('0x43'))){validateJwt(_0x398da1,_0x2abf96,_0x54804a);}else{if(_0x3783f6){_0x54804a();}else{return _0x2abf96['status'](0x193)[_0x22bf('0x37')]({'message':_0x22bf('0x44')});}}}else if(_0x398da1[_0x22bf('0x45')][_0x22bf('0x46')]){try{var _0x4a89d6={'audience':hardwareConf[_0x22bf('0x47')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x398da1[_0x22bf('0x45')][_0x22bf('0x46')],_0x4a89d6)[_0x22bf('0x34')](function(_0x35cc73){return db[_0x22bf('0x3d')]['find']({'where':{'id':_0x35cc73[_0x22bf('0x48')]}})['then'](function(_0x3d939f){_0x2e73d3=_0x3d939f;return db[_0x22bf('0x49')][_0x22bf('0x31')]({'where':{'id':0x1},'attributes':[_0x22bf('0x4a'),_0x22bf('0x4b')],'raw':!![]});})['then'](function(_0x3fcf7c){if(!_0x2e73d3||!_['isEqual'](_0x2e73d3[_0x22bf('0x4c')],_0x35cc73[_0x22bf('0x4d')])){return _0x2abf96[_0x22bf('0x36')](0x191)[_0x22bf('0x37')]({'message':_0x22bf('0x4e')});}if(_0x2e73d3[_0x22bf('0x4f')]){return _0x2abf96[_0x22bf('0x36')](0x191)[_0x22bf('0x37')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x2e73d3['blocked']){if(_0x3fcf7c[_0x22bf('0x4b')]>0x0){if(moment(_0x2e73d3[_0x22bf('0x50')])[_0x22bf('0x51')](_0x3fcf7c[_0x22bf('0x4b')],'minutes')>moment()){return _0x2abf96[_0x22bf('0x36')](0x191)[_0x22bf('0x37')]({'message':_0x22bf('0x52')});}}else{return _0x2abf96[_0x22bf('0x36')](0x191)['json']({'message':_0x22bf('0x52')});}}_0x398da1[_0x22bf('0x30')]={'id':_0x2e73d3['id']};_0x54804a();});})[_0x22bf('0x42')](function(){return _0x2abf96[_0x22bf('0x36')](0x191)[_0x22bf('0x37')]({'message':_0x22bf('0x52')});});}catch(_0x2d9fd1){_0x54804a(_0x2d9fd1);}}else if(_0x3783f6){_0x54804a();}else{return _0x2abf96[_0x22bf('0x36')](0x193)[_0x22bf('0x37')]({'message':_0x22bf('0x44')});}})[_0x22bf('0x2f')](function(_0x2bbdf8,_0x1f9797,_0x5c9919){if(_0x2bbdf8[_0x22bf('0x30')]){db[_0x22bf('0x3d')][_0x22bf('0x3e')]({'where':{'id':_0x2bbdf8['user']['id']},'attributes':userAttributes})[_0x22bf('0x34')](function(_0x38064c){if(!_0x38064c){return _0x1f9797['status'](0x194)['json']({'message':'User\x20not\x20found.'});}_0x2bbdf8[_0x22bf('0x30')]=_0x38064c;_0x5c9919();})[_0x22bf('0x42')](function(_0x73924a){_0x5c9919(_0x73924a);});}else if(_0x3783f6){_0x5c9919();}else{return _0x1f9797['status'](0x194)['json']({'message':_0x22bf('0x53')});}});};exports[_0x22bf('0x54')]=function canUpdate(){return compose()[_0x22bf('0x2f')](function(_0x374804,_0x205df5,_0x5194e1){return licenseUtil[_0x22bf('0x55')]()['then'](function(_0x1e4f60){if(_0x1e4f60[_0x22bf('0x56')]){_0x5194e1();}else{return _0x205df5[_0x22bf('0x36')](0x193)[_0x22bf('0x37')]({'message':_0x22bf('0x57')});}})[_0x22bf('0x42')](function(_0x31a835){_0x5194e1(_0x31a835);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x459f2a,_0x11d3e6,_0x30e522){return licenseUtil[_0x22bf('0x55')]()[_0x22bf('0x34')](function(_0x1b8065){if(_0x1b8065['webrtc']){_0x30e522();}else{return _0x11d3e6[_0x22bf('0x36')](0x193)[_0x22bf('0x37')]({'message':_0x22bf('0x57')});}})[_0x22bf('0x42')](function(_0x2c9af9){_0x30e522(_0x2c9af9);});});};exports[_0x22bf('0x58')]=function(_0x135acd,_0x1c4831,_0x47c701){_0x135acd[_0x22bf('0x58')]=!![];return _0x47c701();};exports['signToken']=function signToken(_0x32d9ab){return signJwt(_0x32d9ab);};exports[_0x22bf('0x59')]=function(_0x12b131,_0x1a2ddb){if(!_0x12b131[_0x22bf('0x30')]){return _0x1a2ddb[_0x22bf('0x36')](0x194)[_0x22bf('0x37')]({'message':_0x22bf('0x5a')});}var _0x3f486e={'payload':{'id':_0x12b131['user']['id'],'role':_0x12b131[_0x22bf('0x30')][_0x22bf('0xf')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3f486e)[_0x22bf('0x34')](function(_0x5c9894){_0x1a2ddb[_0x22bf('0x5b')](_0x22bf('0x5c'),_0x5c9894);_0x1a2ddb[_0x22bf('0x5d')]('/dashboards/general');})[_0x22bf('0x42')](function(_0x2d44aa){return _0x1a2ddb[_0x22bf('0x36')](0x1f4)['send'](_0x2d44aa);});};exports[_0x22bf('0x5e')]=function(_0x23f879){if(_[_0x22bf('0x5f')](_0x23f879[_0x22bf('0x4c')])||_[_0x22bf('0x5f')](_0x23f879['apiKeyIat'])){return null;}else{return createJwt(_0x23f879);}};exports[_0x22bf('0x60')]=function(_0x487a82){_0x487a82[_0x22bf('0x4c')]=generateNonce();_0x487a82[_0x22bf('0x61')]=generateIssuedAt();return createJwt(_0x487a82);};exports['regenerateApiKey']=function(_0x368a82,_0x5e6c4e){var _0x3251de=_0x368a82['query'][_0x22bf('0x46')];if(_0x3251de){var _0x1f4629={'nonce':_0x5e6c4e[_0x22bf('0x4c')],'iat':_0x5e6c4e[_0x22bf('0x61')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x22bf('0x47')]()};return verifyJwt(_0x3251de,_0x1f4629)[_0x22bf('0x34')](function(){return generateApiKey(_0x5e6c4e);});}else{throw{'message':_0x22bf('0x62')};}};exports[_0x22bf('0x63')]=function(_0x45debd){var _0xe60e18=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xe60e18[_0x22bf('0x64')](_0x45debd))throw new db[(_0x22bf('0x65'))][(_0x22bf('0x66'))](_0x22bf('0x67'));return;};exports['validatePasswordHistory']=function(_0x2ec317,_0x5d8eb0,_0x358d9d){var _0x2652e7=encryptor[_0x22bf('0x68')](_0x5d8eb0)['split'](',');for(var _0x5edd2e=0x0;_0x5edd2e<_0x358d9d;_0x5edd2e++){if(!_0x2652e7[_0x5edd2e])break;if(_0x2ec317['toLowerCase']()===_0x2652e7[_0x5edd2e][_0x22bf('0x69')]()){var _0x28b17d=util[_0x22bf('0x6a')](_0x22bf('0x6b'),_0x358d9d);if(_0x358d9d===0x1){_0x28b17d=_0x22bf('0x6c');}throw new db[(_0x22bf('0x65'))]['ValidationError'](_0x28b17d);}}return;};exports[_0x22bf('0x6d')]=function(_0x2370f9,_0x38e042){var _0x4ab91f=_0x38e042?encryptor[_0x22bf('0x68')](_0x38e042)[_0x22bf('0x6e')](','):[];if(_0x4ab91f[_0x22bf('0x6f')]===0x5){_0x4ab91f['splice'](-0x1,0x1);}_0x4ab91f['unshift'](_0x2370f9);return encryptor['encryptString'](_0x4ab91f[_0x22bf('0x70')](','));};function signJwt(_0x135ebe){var _0x18bf5a=BPromise['promisify'](jwt[_0x22bf('0x71')],{'context':jwt});var _0x55a365=_0x135ebe['secret']||config[_0x22bf('0xd')][_0x22bf('0xe')];return new BPromise(function(_0x22ebc5,_0x55c797){_0x18bf5a(_0x135ebe[_0x22bf('0x72')],_0x55a365,_0x135ebe['options'])['then'](function(_0x107e6d){_0x22ebc5(_0x107e6d);})[_0x22bf('0x42')](function(_0x4cd40c){_0x55c797(_0x4cd40c);});});}function verifyJwt(_0x3f5df4,_0x26eb4f,_0x11cccb){var _0x32b367=BPromise['promisify'](jwt[_0x22bf('0x73')],{'context':jwt});var _0x2b3130=_0x11cccb||config['secrets'][_0x22bf('0xe')];return new BPromise(function(_0x5e5019,_0x12ef1d){_0x32b367(_0x3f5df4,_0x2b3130,_0x26eb4f)[_0x22bf('0x34')](function(_0xbc0b1e){_0x5e5019(_0xbc0b1e);})['catch'](function(_0x1b5fd9){_0x12ef1d(_0x1b5fd9);});});}function generateNonce(){return crypto[_0x22bf('0x74')](0x10)[_0x22bf('0x75')]('hex');}function generateIssuedAt(){return Math[_0x22bf('0x76')](Date['now']()/0x3e8)[_0x22bf('0x75')]();}function createJwt(_0x148319){var _0xcbba42={'payload':{'iat':_0x148319[_0x22bf('0x61')],'nonce':_0x148319['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x148319['id'][_0x22bf('0x75')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x22bf('0x47')]()}};return signJwt(_0xcbba42)[_0x22bf('0x34')](function(_0x3025c6){return{'iat':_0x148319[_0x22bf('0x61')],'nonce':_0x148319[_0x22bf('0x4c')],'token':_0x3025c6};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 9a1029c..cfdd75f 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 _0x5c1f=['filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','binary','write','final','close','createReadStream','createDecipher','end','encryptString','secret','base64','decryptString','utf8','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','session','aes-256-ctr','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:'];(function(_0x6d628c,_0x29ad55){var _0x47181e=function(_0xcebb18){while(--_0xcebb18){_0x6d628c['push'](_0x6d628c['shift']());}};_0x47181e(++_0x29ad55);}(_0x5c1f,0x154));var _0xf5c1=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x5c1f[_0x1cd47d];return _0x29d52f;};'use strict';var crypto=require(_0xf5c1('0x0'));var fs=require('fs');var BPromise=require(_0xf5c1('0x1'));var _=require(_0xf5c1('0x2'));var config=require(_0xf5c1('0x3'));var logger=require(_0xf5c1('0x4'))(_0xf5c1('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xf5c1('0x6')],'algorithm':_0xf5c1('0x7')};const fileOptions={'algorithm':_0xf5c1('0x8')};if(config[_0xf5c1('0x9')]&&config[_0xf5c1('0x9')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xf5c1('0x9')]['algorithm']);if(isSupported){fileOptions[_0xf5c1('0xa')]=config[_0xf5c1('0x9')][_0xf5c1('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0xf5c1('0x9')]['algorithm'],_0xf5c1('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x137ec3){return AES_SUPPORTED_RX['test'](_0x137ec3);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xf5c1('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x231c0f){return getSupportedCiphers()[_0xf5c1('0xd')](_0x231c0f)>-0x1;}function combineOptions(_0x2d97c4){var _0x3e9793={};for(var _0x1986b2 in fileOptions){if(fileOptions[_0xf5c1('0xe')](_0x1986b2)){_0x3e9793[_0x1986b2]=fileOptions[_0x1986b2];}}if(_0x2d97c4){for(var _0x402ae0 in _0x2d97c4){if(_0x2d97c4[_0xf5c1('0xe')](_0x402ae0)){_0x3e9793[_0x402ae0]=_0x2d97c4[_0x402ae0];}}}return _0x3e9793;}exports[_0xf5c1('0xf')]=function(_0x35164b,_0x93d43e,_0x41c8d8,_0x5dc218){return new BPromise(function(_0x36b434,_0xe796f2){_0x5dc218=combineOptions(_0x5dc218);var _0x21661b=new Buffer(_0x41c8d8);var _0x3dba7d=fs['createReadStream'](_0x35164b);var _0x2a21ab=fs[_0xf5c1('0x10')](_0x93d43e);var _0x11e8d5=crypto[_0xf5c1('0x11')](_0x5dc218[_0xf5c1('0xa')],_0x21661b);_0x3dba7d['on'](_0xf5c1('0x12'),function(_0x3c5772){var _0x18aa5b=new Buffer(_0x11e8d5[_0xf5c1('0x13')](_0x3c5772),_0xf5c1('0x14'));_0x2a21ab[_0xf5c1('0x15')](_0x18aa5b);});_0x3dba7d['on']('end',function(){try{var _0x5708d2=new Buffer(_0x11e8d5[_0xf5c1('0x16')](_0xf5c1('0x14')),_0xf5c1('0x14'));_0x2a21ab[_0xf5c1('0x15')](_0x5708d2);_0x2a21ab['end']();_0x2a21ab['on'](_0xf5c1('0x17'),function(){return _0x36b434(_0x93d43e);});}catch(_0x512335){fs['unlink'](_0x93d43e);return _0xe796f2(_0x512335);}});});};exports['decryptFile']=function(_0x32f15a,_0x105124,_0x28db94,_0x5ccf74){return new BPromise(function(_0x42f95f,_0x16b9c1){_0x5ccf74=combineOptions(_0x5ccf74);var _0x1f8913=new Buffer(_0x28db94);var _0x2a2092=fs[_0xf5c1('0x18')](_0x32f15a);var _0x281fe4=fs[_0xf5c1('0x10')](_0x105124);var _0x23801a=crypto[_0xf5c1('0x19')](_0x5ccf74['algorithm'],_0x1f8913);_0x2a2092['on'](_0xf5c1('0x12'),function(_0x2b80f2){var _0x32a644=new Buffer(_0x23801a[_0xf5c1('0x13')](_0x2b80f2),_0xf5c1('0x14'));_0x281fe4[_0xf5c1('0x15')](_0x32a644);});_0x2a2092['on'](_0xf5c1('0x1a'),function(){try{var _0xfb17d6=new Buffer(_0x23801a['final']('binary'),'binary');_0x281fe4[_0xf5c1('0x15')](_0xfb17d6);_0x281fe4[_0xf5c1('0x1a')]();_0x281fe4['on'](_0xf5c1('0x17'),function(){return _0x42f95f(_0x105124);});}catch(_0x18930d){fs['unlink'](_0x105124);return _0x16b9c1(_0x18930d);}});});};exports[_0xf5c1('0x1b')]=function(_0x3897f6,_0x4a13ce,_0x59043a){var _0x5cbd33=_0x59043a||stringOptions[_0xf5c1('0xa')];var _0x4e2360=_0x4a13ce||stringOptions[_0xf5c1('0x1c')];var _0x443cc3=crypto[_0xf5c1('0x11')](_0x5cbd33,_0x4e2360);var _0x306333=_0x443cc3['update'](_0x3897f6,'utf8',_0xf5c1('0x1d'));_0x306333+=_0x443cc3[_0xf5c1('0x16')](_0xf5c1('0x1d'));return _0x306333;};exports[_0xf5c1('0x1e')]=function(_0x4a9d6c,_0x2872d6,_0x1c541d){var _0x2f6ce4=_0x1c541d||stringOptions[_0xf5c1('0xa')];var _0x11d8c1=_0x2872d6||stringOptions[_0xf5c1('0x1c')];var _0x19ca15=crypto['createDecipher'](_0x2f6ce4,_0x11d8c1);var _0x176bff=_0x19ca15[_0xf5c1('0x13')](_0x4a9d6c,_0xf5c1('0x1d'),_0xf5c1('0x1f'));_0x176bff+=_0x19ca15[_0xf5c1('0x16')](_0xf5c1('0x1f'));return _0x176bff;}; \ No newline at end of file +var _0xf2f4=['createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','../../config/environment','../../config/logger','session','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','data','update','binary','write','end','final','close','decryptFile'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf2f4,0x186));var _0x4f2f=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xf2f4[_0x119d5a];return _0x15bff4;};'use strict';var crypto=require(_0x4f2f('0x0'));var fs=require('fs');var BPromise=require(_0x4f2f('0x1'));var _=require('lodash');var config=require(_0x4f2f('0x2'));var logger=require(_0x4f2f('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x4f2f('0x4')],'algorithm':_0x4f2f('0x5')};const fileOptions={'algorithm':_0x4f2f('0x6')};if(config[_0x4f2f('0x7')]&&config[_0x4f2f('0x7')][_0x4f2f('0x8')]){var isSupported=isAlgorithmSupported(config[_0x4f2f('0x7')]['algorithm']);if(isSupported){fileOptions[_0x4f2f('0x8')]=config['encrypt'][_0x4f2f('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x4f2f('0x9')](config[_0x4f2f('0x7')][_0x4f2f('0x8')],_0x4f2f('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x2d18f3){return AES_SUPPORTED_RX[_0x4f2f('0xb')](_0x2d18f3);}function getSupportedCiphers(){return crypto[_0x4f2f('0xc')]()[_0x4f2f('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x4fbec6){return getSupportedCiphers()[_0x4f2f('0xe')](_0x4fbec6)>-0x1;}function combineOptions(_0x58f0d3){var _0x133396={};for(var _0x350954 in fileOptions){if(fileOptions['hasOwnProperty'](_0x350954)){_0x133396[_0x350954]=fileOptions[_0x350954];}}if(_0x58f0d3){for(var _0x21f623 in _0x58f0d3){if(_0x58f0d3[_0x4f2f('0xf')](_0x21f623)){_0x133396[_0x21f623]=_0x58f0d3[_0x21f623];}}}return _0x133396;}exports['encryptFile']=function(_0x108f2d,_0x47d040,_0x28082d,_0x418b5b){return new BPromise(function(_0x30ac88,_0x481181){_0x418b5b=combineOptions(_0x418b5b);var _0x121b0c=new Buffer(_0x28082d);var _0x2830bd=fs[_0x4f2f('0x10')](_0x108f2d);var _0x282b6f=fs[_0x4f2f('0x11')](_0x47d040);var _0x4953fe=crypto['createCipher'](_0x418b5b['algorithm'],_0x121b0c);_0x2830bd['on'](_0x4f2f('0x12'),function(_0x2a1ae7){var _0x828270=new Buffer(_0x4953fe[_0x4f2f('0x13')](_0x2a1ae7),_0x4f2f('0x14'));_0x282b6f[_0x4f2f('0x15')](_0x828270);});_0x2830bd['on'](_0x4f2f('0x16'),function(){try{var _0x28c779=new Buffer(_0x4953fe[_0x4f2f('0x17')](_0x4f2f('0x14')),_0x4f2f('0x14'));_0x282b6f[_0x4f2f('0x15')](_0x28c779);_0x282b6f[_0x4f2f('0x16')]();_0x282b6f['on'](_0x4f2f('0x18'),function(){return _0x30ac88(_0x47d040);});}catch(_0x5ed047){fs['unlink'](_0x47d040);return _0x481181(_0x5ed047);}});});};exports[_0x4f2f('0x19')]=function(_0x53ae46,_0xd9a22c,_0x4b2dd8,_0x5d04c0){return new BPromise(function(_0x162449,_0x5ea470){_0x5d04c0=combineOptions(_0x5d04c0);var _0x229338=new Buffer(_0x4b2dd8);var _0x4f7c2d=fs[_0x4f2f('0x10')](_0x53ae46);var _0xade034=fs[_0x4f2f('0x11')](_0xd9a22c);var _0x49ba0=crypto[_0x4f2f('0x1a')](_0x5d04c0[_0x4f2f('0x8')],_0x229338);_0x4f7c2d['on'](_0x4f2f('0x12'),function(_0x4fe4b4){var _0x2c826=new Buffer(_0x49ba0['update'](_0x4fe4b4),_0x4f2f('0x14'));_0xade034[_0x4f2f('0x15')](_0x2c826);});_0x4f7c2d['on'](_0x4f2f('0x16'),function(){try{var _0x5e3c9e=new Buffer(_0x49ba0['final']('binary'),_0x4f2f('0x14'));_0xade034[_0x4f2f('0x15')](_0x5e3c9e);_0xade034[_0x4f2f('0x16')]();_0xade034['on']('close',function(){return _0x162449(_0xd9a22c);});}catch(_0x48a51e){fs['unlink'](_0xd9a22c);return _0x5ea470(_0x48a51e);}});});};exports[_0x4f2f('0x1b')]=function(_0x2e64a5,_0x148e3f,_0x28555e){var _0xb2ec1b=_0x28555e||stringOptions[_0x4f2f('0x8')];var _0x33e996=_0x148e3f||stringOptions[_0x4f2f('0x1c')];var _0x40e0fc=crypto['createCipher'](_0xb2ec1b,_0x33e996);var _0x360626=_0x40e0fc[_0x4f2f('0x13')](_0x2e64a5,_0x4f2f('0x1d'),_0x4f2f('0x1e'));_0x360626+=_0x40e0fc['final'](_0x4f2f('0x1e'));return _0x360626;};exports[_0x4f2f('0x1f')]=function(_0x3ce2c8,_0x3c149e,_0x33c65c){var _0x38b755=_0x33c65c||stringOptions[_0x4f2f('0x8')];var _0x2f41db=_0x3c149e||stringOptions['secret'];var _0x95add2=crypto[_0x4f2f('0x1a')](_0x38b755,_0x2f41db);var _0x5e2ef8=_0x95add2[_0x4f2f('0x13')](_0x3ce2c8,'base64',_0x4f2f('0x1d'));_0x5e2ef8+=_0x95add2[_0x4f2f('0x17')](_0x4f2f('0x1d'));return _0x5e2ef8;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 4250ef3..27fb8be 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 _0xedb3=['range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','split','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','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','Failed','finally','exit','util','path','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','num','Empty','length'];(function(_0x5222fa,_0x4eb9bc){var _0x45ffe1=function(_0x569468){while(--_0x569468){_0x5222fa['push'](_0x5222fa['shift']());}};_0x45ffe1(++_0x4eb9bc);}(_0xedb3,0x1a9));var _0x3edb=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xedb3[_0x486f4a];return _0x135d99;};'use strict';var util=require(_0x3edb('0x0'));var path=require(_0x3edb('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x3edb('0x2'));var zipdir=require(_0x3edb('0x3'));var rimraf=require('rimraf');var db=require(_0x3edb('0x4'))['db'];var dbH=require('../../mysqldb')[_0x3edb('0x5')];var logger=require(_0x3edb('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x3edb('0x7')][0x2]);var QUERY=process[_0x3edb('0x7')][0x3];var PATH=process[_0x3edb('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4cdf5e,_0x1e563a){var _0x4eb88b={'status':_0x4cdf5e};var _0x4e8726={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1e563a){_0x4eb88b[_0x3edb('0x8')]=_0x1e563a;}return db[_0x3edb('0x9')][_0x3edb('0xa')](_0x4eb88b,_0x4e8726);}function main(){var _0x385847=0x1388;var _0x31632b;logger[_0x3edb('0xb')](util[_0x3edb('0xc')](_0x3edb('0xd'),EXTRACTED_REPORT_ID,_0x3edb('0xe')));return db['Setting'][_0x3edb('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x3edb('0x10')]})['then'](function(_0x341f48){if(_0x341f48){_0x31632b=_0x341f48;_0x385847=_0x31632b[_0x3edb('0x10')]||0x1388;}})[_0x3edb('0x11')](function(){return dbH[_0x3edb('0x12')][_0x3edb('0x13')](util[_0x3edb('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x3edb('0x14')][_0x3edb('0x15')]});})[_0x3edb('0x11')](function(_0x24c361){if(!_0x24c361[0x0][_0x3edb('0x16')]){return analyticExtractedReport(_0x3edb('0x17'));}var _0x32be02=[];var _0x962c52=0x0;if(_0x31632b['split']){if(_0x24c361&&_0x24c361[_0x3edb('0x18')]){var _0x715403=_[_0x3edb('0x19')](_0x24c361[0x0]['num']/_0x385847);var _0x56c4f2=Number[_0x3edb('0x1a')](_0x24c361[0x0][_0x3edb('0x16')]/_0x385847)?_0x24c361[0x0][_0x3edb('0x16')]%_0x385847:0x0;_0x715403[_0x3edb('0x1b')](function(_0x3e9843){if(_0x3e9843>0x0){_0x962c52+=_0x385847;}_0x32be02[_0x3edb('0x1c')](dbH['sequelize']['query'](util['format'](_0x3edb('0x1d'),QUERY,_0x385847,_0x962c52),{'type':dbH[_0x3edb('0x12')][_0x3edb('0x14')]['SELECT']}));});if(_0x56c4f2>0x0){_0x962c52+=_0x385847;_0x32be02[_0x3edb('0x1c')](dbH[_0x3edb('0x12')][_0x3edb('0x13')](util[_0x3edb('0xc')](_0x3edb('0x1d'),QUERY,_0x56c4f2,_0x962c52),{'type':dbH[_0x3edb('0x12')][_0x3edb('0x14')]['SELECT']}));}}}else{_0x32be02[_0x3edb('0x1c')](dbH['sequelize'][_0x3edb('0x13')](QUERY,{'type':dbH['sequelize'][_0x3edb('0x14')][_0x3edb('0x15')]}));}var _0x419e35=path[_0x3edb('0x1e')](PATH);var _0x515741=path[_0x3edb('0x1f')](PATH,_0x3edb('0x20'));var _0x30cb13=_0x31632b[_0x3edb('0x21')]&&_0x32be02[_0x3edb('0x18')]>0x1;var _0x353fb5=[];if(!fs[_0x3edb('0x22')](path[_0x3edb('0x23')](_0x419e35,_0x515741))&&_0x30cb13){fs[_0x3edb('0x24')](path[_0x3edb('0x23')](_0x419e35,_0x515741));}return BPromise['each'](_0x32be02,function(_0x420085){_0x353fb5[_0x3edb('0x1c')](_0x420085);})[_0x3edb('0x11')](function(){for(var _0x23ca4a=0x0;_0x23ca4a<_0x353fb5[_0x3edb('0x18')];_0x23ca4a+=0x1){var _0x40fb18;var _0x389a91=_0x353fb5[_0x23ca4a];if(_0x30cb13){_0x40fb18=path[_0x3edb('0x23')](_0x419e35,_0x515741,util['format'](_0x3edb('0x25'),_0x515741,_0x23ca4a,_0x3edb('0x26')));}else{_0x40fb18=path['join'](_0x419e35,util[_0x3edb('0xc')](_0x3edb('0x27'),_0x515741,'csv'));}fs[_0x3edb('0x28')](_0x40fb18,csv(_0x389a91));}})[_0x3edb('0x11')](function(){if(_0x30cb13){return new Promise(function(_0x15ec8f){zipdir(path['join'](_0x419e35,_0x515741),{'saveTo':path[_0x3edb('0x23')](_0x419e35,util[_0x3edb('0xc')](_0x3edb('0x27'),_0x515741,_0x3edb('0x29')))},function(_0x2d4492,_0xe09154){rimraf(path[_0x3edb('0x23')](_0x419e35,_0x515741),function(){});_0x15ec8f(_0x3edb('0x2a'));});});}})[_0x3edb('0x11')](function(){logger['info'](util[_0x3edb('0xc')](_0x3edb('0x2b'),EXTRACTED_REPORT_ID,_0x3edb('0xe')));return analyticExtractedReport(_0x3edb('0x2c'),_0x30cb13?util[_0x3edb('0xc')](_0x3edb('0x27'),_0x515741,_0x30cb13?_0x3edb('0x29'):_0x3edb('0x26')):null);});})[_0x3edb('0x2d')](function(_0x57eec4){logger['info'](util['format'](_0x3edb('0x2e'),EXTRACTED_REPORT_ID,_0x3edb('0xe')),util['inspect'](_0x57eec4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3edb('0x2f'));})[_0x3edb('0x30')](function(){process[_0x3edb('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xca6d=['then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','csv','writeFileSync','%s.%s','zip\x20finished','zip','catch','inspect','Failed','finally','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','analytics','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0xca6d,0xda));var _0xdca6=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xca6d[_0x45f951];return _0x24756c;};'use strict';var util=require(_0xdca6('0x0'));var path=require(_0xdca6('0x1'));var _=require(_0xdca6('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xdca6('0x3'));var zipdir=require(_0xdca6('0x4'));var rimraf=require('rimraf');var db=require(_0xdca6('0x5'))['db'];var dbH=require('../../mysqldb')[_0xdca6('0x6')];var logger=require('../../config/logger')(_0xdca6('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xdca6('0x8')][0x2]);var QUERY=process[_0xdca6('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x18938a,_0x144b46){var _0x29112c={'status':_0x18938a};var _0x4d57aa={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x144b46){_0x29112c[_0xdca6('0x9')]=_0x144b46;}return db['AnalyticExtractedReport']['update'](_0x29112c,_0x4d57aa);}function main(){var _0x5c4d10=0x1388;var _0x1a76e6;logger[_0xdca6('0xa')](util[_0xdca6('0xb')](_0xdca6('0xc'),EXTRACTED_REPORT_ID,_0xdca6('0xd')));return db[_0xdca6('0xe')][_0xdca6('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdca6('0x10'),'splitSizeCsv']})[_0xdca6('0x11')](function(_0x360834){if(_0x360834){_0x1a76e6=_0x360834;_0x5c4d10=_0x1a76e6['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0xdca6('0x12')][_0xdca6('0x13')](util[_0xdca6('0xb')](_0xdca6('0x14'),QUERY),{'type':dbH[_0xdca6('0x12')][_0xdca6('0x15')][_0xdca6('0x16')]});})['then'](function(_0x312506){if(!_0x312506[0x0][_0xdca6('0x17')]){return analyticExtractedReport(_0xdca6('0x18'));}var _0x128d61=[];var _0x23ab1a=0x0;if(_0x1a76e6['split']){if(_0x312506&&_0x312506[_0xdca6('0x19')]){var _0x1868c1=_[_0xdca6('0x1a')](_0x312506[0x0][_0xdca6('0x17')]/_0x5c4d10);var _0x4013ba=Number[_0xdca6('0x1b')](_0x312506[0x0][_0xdca6('0x17')]/_0x5c4d10)?_0x312506[0x0]['num']%_0x5c4d10:0x0;_0x1868c1[_0xdca6('0x1c')](function(_0x204e40){if(_0x204e40>0x0){_0x23ab1a+=_0x5c4d10;}_0x128d61[_0xdca6('0x1d')](dbH['sequelize'][_0xdca6('0x13')](util[_0xdca6('0xb')](_0xdca6('0x1e'),QUERY,_0x5c4d10,_0x23ab1a),{'type':dbH[_0xdca6('0x12')][_0xdca6('0x15')]['SELECT']}));});if(_0x4013ba>0x0){_0x23ab1a+=_0x5c4d10;_0x128d61[_0xdca6('0x1d')](dbH[_0xdca6('0x12')][_0xdca6('0x13')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4013ba,_0x23ab1a),{'type':dbH['sequelize'][_0xdca6('0x15')][_0xdca6('0x16')]}));}}}else{_0x128d61['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xdca6('0x12')]['QueryTypes']['SELECT']}));}var _0xc0a15f=path[_0xdca6('0x1f')](PATH);var _0x30fbfd=path[_0xdca6('0x20')](PATH,_0xdca6('0x21'));var _0x599aff=_0x1a76e6[_0xdca6('0x10')]&&_0x128d61[_0xdca6('0x19')]>0x1;var _0x3a6759=[];if(!fs[_0xdca6('0x22')](path[_0xdca6('0x23')](_0xc0a15f,_0x30fbfd))&&_0x599aff){fs[_0xdca6('0x24')](path[_0xdca6('0x23')](_0xc0a15f,_0x30fbfd));}return BPromise[_0xdca6('0x25')](_0x128d61,function(_0x258937){_0x3a6759[_0xdca6('0x1d')](_0x258937);})[_0xdca6('0x11')](function(){for(var _0x586c68=0x0;_0x586c68<_0x3a6759[_0xdca6('0x19')];_0x586c68+=0x1){var _0x130344;var _0x161613=_0x3a6759[_0x586c68];if(_0x599aff){_0x130344=path[_0xdca6('0x23')](_0xc0a15f,_0x30fbfd,util['format']('%s%d.%s',_0x30fbfd,_0x586c68,_0xdca6('0x26')));}else{_0x130344=path['join'](_0xc0a15f,util[_0xdca6('0xb')]('%s.%s',_0x30fbfd,_0xdca6('0x26')));}fs[_0xdca6('0x27')](_0x130344,csv(_0x161613));}})[_0xdca6('0x11')](function(){if(_0x599aff){return new Promise(function(_0x10c5af){zipdir(path['join'](_0xc0a15f,_0x30fbfd),{'saveTo':path['join'](_0xc0a15f,util[_0xdca6('0xb')](_0xdca6('0x28'),_0x30fbfd,'zip'))},function(_0x230a53,_0x461ca8){rimraf(path[_0xdca6('0x23')](_0xc0a15f,_0x30fbfd),function(){});_0x10c5af(_0xdca6('0x29'));});});}})[_0xdca6('0x11')](function(){logger[_0xdca6('0xa')](util[_0xdca6('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xdca6('0xd')));return analyticExtractedReport('Completed',_0x599aff?util[_0xdca6('0xb')]('%s.%s',_0x30fbfd,_0x599aff?_0xdca6('0x2a'):_0xdca6('0x26')):null);});})[_0xdca6('0x2b')](function(_0x3ef9c3){logger[_0xdca6('0xa')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xdca6('0xd')),util[_0xdca6('0x2c')](_0x3ef9c3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdca6('0x2d'));})[_0xdca6('0x2e')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 9a7ccee..ae9b605 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 _0x3bb0=['split','range','isInteger','sequelize','query','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','lodash','path','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','pick','toString','value','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','before','margin','landscape','\x20/\x20','Arial','right','num','Empty','Setting','find','splitSizePdf','then'];(function(_0x1ab30e,_0xf5cb91){var _0x4f0a10=function(_0x4eb755){while(--_0x4eb755){_0x1ab30e['push'](_0x1ab30e['shift']());}};_0x4f0a10(++_0xf5cb91);}(_0x3bb0,0x84));var _0x03bb=function(_0x548f36,_0x4be93d){_0x548f36=_0x548f36-0x0;var _0x265647=_0x3bb0[_0x548f36];return _0x265647;};'use strict';var _=require(_0x03bb('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x03bb('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x03bb('0x2'));var PdfPrinter=require(_0x03bb('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x03bb('0x4'));var JSDOM=require(_0x03bb('0x5'))[_0x03bb('0x6')];var window=new JSDOM('')[_0x03bb('0x7')];var BPromise=require(_0x03bb('0x8'));var db=require(_0x03bb('0x9'))['db'];var dbH=require(_0x03bb('0x9'))['dbH'];var logger=require(_0x03bb('0xa'))(_0x03bb('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x03bb('0xc')][0x5];var FORMAT=_0x03bb('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x546600,_0x3fe23e){var _0x2d8ff3={'status':_0x546600};var _0x375ceb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3fe23e){_0x2d8ff3[_0x03bb('0xe')]=_0x3fe23e;}return db[_0x03bb('0xf')]['update'](_0x2d8ff3,_0x375ceb);}function getHeaders(_0xb49bdc){return _[_0x03bb('0x10')](_0xb49bdc,function(_0x2f3a81){return{'text':_0x2f3a81,'style':'tableHeader'};});}function getRows(_0x2256a9,_0x22c159){return _[_0x03bb('0x10')](_0x22c159,function(_0x2ba9a9){return _(_0x2ba9a9)[_0x03bb('0x11')](_0x2256a9)[_0x03bb('0x10')](function(_0x2edc76){return _0x2edc76?_[_0x03bb('0x12')](_0x2edc76):'';})[_0x03bb('0x13')]();});}function createTable(_0x4dc2b2,_0x366797){var _0x4fcae1={'widths':_['fill'](Array(_0x4dc2b2[_0x03bb('0x14')]),0x91),'heights':function(_0x49ab08){return _0x49ab08===0x0?_0x03bb('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x6e5008=getHeaders(_0x4dc2b2);_0x4fcae1[_0x03bb('0x16')][_0x03bb('0x17')](_0x6e5008);var _0x1d03e6=getRows(_0x4dc2b2,_0x366797);_0x4fcae1['body']=_0x4fcae1[_0x03bb('0x16')][_0x03bb('0x18')](_0x1d03e6);return _0x4fcae1;}function createTables(_0x259215){var _0x34cff5=[];var _0x1c5e7d=_[_0x03bb('0x19')](Object[_0x03bb('0x1a')](_0x259215[0x0]),0x5);_0x1c5e7d[_0x03bb('0x1b')](function(_0x9ec87){_0x34cff5['push'](createTable(_0x9ec87,_0x259215));});return _0x34cff5;}function getPDFDocDefinition(_0x7c4827){var _0x2b48a9=util[_0x03bb('0x1c')](_0x03bb('0x1d'),NAME,EXTRACTED_REPORT[_0x03bb('0x1e')],moment(EXTRACTED_REPORT[_0x03bb('0x1f')])[_0x03bb('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x03bb('0x20')])['format'](FORMAT));var _0x12c879=[];for(var _0x423fa9=0x0;_0x423fa9<_0x7c4827[_0x03bb('0x14')];_0x423fa9++){var _0x5d74f4=[];if(_0x423fa9===0x0){_0x5d74f4[_0x03bb('0x17')]({'text':_0x2b48a9,'style':_0x03bb('0x21')});}var _0x854eb9={'table':_0x7c4827[_0x423fa9]};if(_0x423fa9>0x0){_0x854eb9['pageBreak']=_0x03bb('0x22');_0x854eb9[_0x03bb('0x23')]=[0x0,0x46,0x0,0x0];}_0x5d74f4[_0x03bb('0x17')](_0x854eb9);_0x12c879[_0x03bb('0x17')](_0x5d74f4);}return{'pageSize':'A4','pageOrientation':_0x03bb('0x24'),'content':_0x12c879,'footer':function(_0x2f339a,_0x54ff61){return{'text':_0x2f339a[_0x03bb('0x12')]()+_0x03bb('0x25')+_0x54ff61,'style':'footer'};},'defaultStyle':{'font':_0x03bb('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x03bb('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x30ee72){var _0x36f3d6=0x1388;var _0x453f4e;if(!_0x30ee72[0x0][_0x03bb('0x28')]){return analyticExtractedReport(_0x03bb('0x29'));}return db[_0x03bb('0x2a')][_0x03bb('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x03bb('0x2c')]})[_0x03bb('0x2d')](function(_0x3f3d74){if(_0x3f3d74){_0x453f4e=_0x3f3d74;_0x36f3d6=_0x453f4e[_0x03bb('0x2c')]||0x3e8;}})[_0x03bb('0x2d')](function(){var _0x3ba8f7=[];var _0x529046=0x0;if(_0x453f4e[_0x03bb('0x2e')]){if(_0x30ee72&&_0x30ee72[_0x03bb('0x14')]){var _0x300390=_[_0x03bb('0x2f')](_0x30ee72[0x0][_0x03bb('0x28')]/_0x36f3d6);var _0x1868b9=Number[_0x03bb('0x30')](_0x30ee72[0x0][_0x03bb('0x28')]/_0x36f3d6)?_0x30ee72[0x0][_0x03bb('0x28')]%_0x36f3d6:0x0;_0x300390[_0x03bb('0x1b')](function(_0x46266d){if(_0x46266d>0x0){_0x529046+=_0x36f3d6;}_0x3ba8f7['push'](dbH[_0x03bb('0x31')][_0x03bb('0x32')](util[_0x03bb('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x36f3d6,_0x529046),{'type':dbH['sequelize'][_0x03bb('0x33')][_0x03bb('0x34')]}));});if(_0x1868b9>0x0){_0x529046+=_0x36f3d6;_0x3ba8f7[_0x03bb('0x17')](dbH[_0x03bb('0x31')][_0x03bb('0x32')](util[_0x03bb('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1868b9,_0x529046),{'type':dbH[_0x03bb('0x31')]['QueryTypes'][_0x03bb('0x34')]}));}}}else{_0x3ba8f7[_0x03bb('0x17')](dbH['sequelize'][_0x03bb('0x32')](QUERY,{'type':dbH['sequelize'][_0x03bb('0x33')]['SELECT']}));}var _0x21b81a=path[_0x03bb('0x35')](PATH);var _0x42362c=path[_0x03bb('0x36')](PATH,_0x03bb('0x37'));var _0x5d60c6=_0x453f4e[_0x03bb('0x2e')]&&_0x3ba8f7[_0x03bb('0x14')]>0x1;var _0x22fad1=[];if(!fs[_0x03bb('0x38')](path[_0x03bb('0x39')](_0x21b81a,_0x42362c))&&_0x5d60c6){fs['mkdirSync'](path[_0x03bb('0x39')](_0x21b81a,_0x42362c));}return BPromise['each'](_0x3ba8f7,function(_0x46578a){_0x22fad1[_0x03bb('0x17')](_0x46578a);})[_0x03bb('0x2d')](function(){var _0xb01199=[];for(var _0x18415c=0x0;_0x18415c<_0x22fad1[_0x03bb('0x14')];_0x18415c+=0x1){var _0x676194=_0x22fad1[_0x18415c];var _0x2da869=createTables(_[_0x03bb('0x3a')](_0x676194));var _0xaf529;var _0x2e12cd=getPDFDocDefinition(_0x2da869);var _0x49a74a=getPDFPrinter();var _0x3985c3=_0x49a74a[_0x03bb('0x3b')](_0x2e12cd);if(_0x5d60c6){_0xaf529=path['join'](_0x21b81a,_0x42362c,util[_0x03bb('0x1c')](_0x03bb('0x3c'),_0x42362c,_0x18415c,_0x03bb('0x3d')));}else{_0xaf529=path[_0x03bb('0x39')](_0x21b81a,util[_0x03bb('0x1c')](_0x03bb('0x3e'),_0x42362c,_0x03bb('0x3d')));}_0xb01199['push'](writePDFDocument(_0x3985c3,_0xaf529));}return Promise[_0x03bb('0x3f')](_0xb01199);})[_0x03bb('0x2d')](function(){if(_0x5d60c6){return new Promise(function(_0x48f30c){zipdir(path[_0x03bb('0x39')](_0x21b81a,_0x42362c),{'saveTo':path[_0x03bb('0x39')](_0x21b81a,util[_0x03bb('0x1c')](_0x03bb('0x3e'),_0x42362c,_0x03bb('0x40')))},function(){rimraf(path['join'](_0x21b81a,_0x42362c),function(){});_0x48f30c(_0x03bb('0x41'));});});}})['then'](function(){if(!_0x5d60c6)return;rimraf(path[_0x03bb('0x39')](_0x21b81a,_0x42362c),function(){});})['then'](function(){logger[_0x03bb('0x42')](util[_0x03bb('0x1c')](_0x03bb('0x43'),EXTRACTED_REPORT_ID,_0x03bb('0x44')));return analyticExtractedReport(_0x03bb('0x45'),_0x5d60c6?util[_0x03bb('0x1c')](_0x03bb('0x3e'),_0x42362c,_0x5d60c6?_0x03bb('0x40'):_0x03bb('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x03bb('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x03bb('0x44')));return db['AnalyticExtractedReport'][_0x03bb('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1bf1e2){EXTRACTED_REPORT=_0x1bf1e2;return dbH['sequelize'][_0x03bb('0x32')](util[_0x03bb('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x03bb('0x33')][_0x03bb('0x34')]});})['then'](extractReport)['catch'](function(_0x138711){logger[_0x03bb('0x42')](util['format'](_0x03bb('0x47'),EXTRACTED_REPORT_ID,_0x03bb('0x44')),util[_0x03bb('0x48')](_0x138711,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x03bb('0x49')](function(){process[_0x03bb('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4d976d=new PdfPrinter({'Arial':{'normal':__dirname+_0x03bb('0x4b'),'bold':__dirname+_0x03bb('0x4c'),'italics':__dirname+_0x03bb('0x4d'),'bolditalics':__dirname+_0x03bb('0x4e')}});return _0x4d976d;}function getPDFDocDefinitionFromHTML(_0x358e1d,_0x36ee4f){var _0x10f08d=util[_0x03bb('0x1c')](_0x03bb('0x4f'),_0x36ee4f['channel'],_0x36ee4f[_0x03bb('0x50')]);var _0x3969fe=moment()['format'](_0x03bb('0x51'))['toString']();var _0x223403=htmlToPdfmake(_0x358e1d,{'window':window,'tableAutoSize':!![]});return{'content':[_0x223403],'defaultStyle':{'font':_0x03bb('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x03bb('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x03bb('0x52')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x03bb('0x21')}];},'footer':function(_0x59ed16,_0xbddec6){return[{'text':util['format'](_0x03bb('0x53'),_0x10f08d,_0x59ed16,_0xbddec6,_0x3969fe),'style':'footer'}];}};}function writePDFDocument(_0x1f6382,_0x4c1a05){return new Promise(function(_0x118e13,_0x37de1f){var _0x243cd0=_0x1f6382[_0x03bb('0x54')](fs['createWriteStream'](_0x4c1a05));_0x243cd0['on'](_0x03bb('0x55'),function(){_0x118e13(_0x03bb('0x55'));});_0x243cd0['on'](_0x03bb('0x56'),function(_0x3a544c){_0x37de1f(_0x3a544c);});_0x1f6382[_0x03bb('0x57')]();});}exports[_0x03bb('0x58')]=function(_0xc1e86,_0x571b75){var _0x207f24=getPDFPrinter();var _0x1b9d7c=getPDFDocDefinitionFromHTML(_0xc1e86,_0x571b75);var _0x5b4ebc=_0x207f24[_0x03bb('0x3b')](_0x1b9d7c);return writePDFDocument(_0x5b4ebc,_0x571b75[_0x03bb('0x1')])['catch'](function(_0x965407){throw _0x965407;});}; \ No newline at end of file +var _0x0269=['keys','push','format','name','endDate','header','pageBreak','margin','landscape','Arial','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','.pdf','existsSync','join','mkdirSync','each','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','channel','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','createWriteStream','error','end','catch','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','pick','toString','value','length','auto','body','chunk'];(function(_0x1be77d,_0x72c9d3){var _0x2061b6=function(_0x1a0b1c){while(--_0x1a0b1c){_0x1be77d['push'](_0x1be77d['shift']());}};_0x2061b6(++_0x72c9d3);}(_0x0269,0x8f));var _0x9026=function(_0x1046c0,_0x1c0828){_0x1046c0=_0x1046c0-0x0;var _0x4944f6=_0x0269[_0x1046c0];return _0x4944f6;};'use strict';var _=require(_0x9026('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x9026('0x1'));var moment=require(_0x9026('0x2'));var htmlToPdfmake=require(_0x9026('0x3'));var PdfPrinter=require(_0x9026('0x4'));var zipdir=require(_0x9026('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x9026('0x6'))[_0x9026('0x7')];var window=new JSDOM('')[_0x9026('0x8')];var BPromise=require(_0x9026('0x9'));var db=require('../../mysqldb')['db'];var dbH=require(_0x9026('0xa'))['dbH'];var logger=require(_0x9026('0xb'))(_0x9026('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x9026('0xd')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x9026('0xd')][0x4];var NAME=process[_0x9026('0xd')][0x5];var FORMAT=_0x9026('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x331717,_0x2b9d0e){var _0x462fd6={'status':_0x331717};var _0x153c85={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2b9d0e){_0x462fd6[_0x9026('0xf')]=_0x2b9d0e;}return db[_0x9026('0x10')]['update'](_0x462fd6,_0x153c85);}function getHeaders(_0x485694){return _['map'](_0x485694,function(_0x4abe29){return{'text':_0x4abe29,'style':'tableHeader'};});}function getRows(_0x5dd6f0,_0x4302d1){return _[_0x9026('0x11')](_0x4302d1,function(_0x1230ac){return _(_0x1230ac)[_0x9026('0x12')](_0x5dd6f0)[_0x9026('0x11')](function(_0x35d5f7){return _0x35d5f7?_[_0x9026('0x13')](_0x35d5f7):'';})[_0x9026('0x14')]();});}function createTable(_0x586cbd,_0x3eb359){var _0x31f6bb={'widths':_['fill'](Array(_0x586cbd[_0x9026('0x15')]),0x91),'heights':function(_0x2398d2){return _0x2398d2===0x0?_0x9026('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3b5ebe=getHeaders(_0x586cbd);_0x31f6bb['body']['push'](_0x3b5ebe);var _0x27d1cd=getRows(_0x586cbd,_0x3eb359);_0x31f6bb[_0x9026('0x17')]=_0x31f6bb[_0x9026('0x17')]['concat'](_0x27d1cd);return _0x31f6bb;}function createTables(_0x32a5b5){var _0x5b1ba4=[];var _0x50da43=_[_0x9026('0x18')](Object[_0x9026('0x19')](_0x32a5b5[0x0]),0x5);_0x50da43['forEach'](function(_0x2044ee){_0x5b1ba4[_0x9026('0x1a')](createTable(_0x2044ee,_0x32a5b5));});return _0x5b1ba4;}function getPDFDocDefinition(_0x2516fc){var _0x4567ed=util[_0x9026('0x1b')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x9026('0x1c')],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x9026('0x1d')])[_0x9026('0x1b')](FORMAT));var _0x2896a5=[];for(var _0x110fa6=0x0;_0x110fa6<_0x2516fc['length'];_0x110fa6++){var _0x43ad39=[];if(_0x110fa6===0x0){_0x43ad39[_0x9026('0x1a')]({'text':_0x4567ed,'style':_0x9026('0x1e')});}var _0x9b1de={'table':_0x2516fc[_0x110fa6]};if(_0x110fa6>0x0){_0x9b1de[_0x9026('0x1f')]='before';_0x9b1de[_0x9026('0x20')]=[0x0,0x46,0x0,0x0];}_0x43ad39[_0x9026('0x1a')](_0x9b1de);_0x2896a5['push'](_0x43ad39);}return{'pageSize':'A4','pageOrientation':_0x9026('0x21'),'content':_0x2896a5,'footer':function(_0x2e892e,_0x26f988){return{'text':_0x2e892e[_0x9026('0x13')]()+'\x20/\x20'+_0x26f988,'style':'footer'};},'defaultStyle':{'font':_0x9026('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x9026('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x267233){var _0x53b48b=0x1388;var _0x1a582b;if(!_0x267233[0x0][_0x9026('0x24')]){return analyticExtractedReport(_0x9026('0x25'));}return db[_0x9026('0x26')][_0x9026('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9026('0x28'),_0x9026('0x29')]})[_0x9026('0x2a')](function(_0x12d3fe){if(_0x12d3fe){_0x1a582b=_0x12d3fe;_0x53b48b=_0x1a582b[_0x9026('0x29')]||0x3e8;}})['then'](function(){var _0x1f5d0e=[];var _0x4be0fb=0x0;if(_0x1a582b[_0x9026('0x28')]){if(_0x267233&&_0x267233[_0x9026('0x15')]){var _0x434342=_[_0x9026('0x2b')](_0x267233[0x0]['num']/_0x53b48b);var _0x2ac99f=Number[_0x9026('0x2c')](_0x267233[0x0][_0x9026('0x24')]/_0x53b48b)?_0x267233[0x0]['num']%_0x53b48b:0x0;_0x434342[_0x9026('0x2d')](function(_0x79cb18){if(_0x79cb18>0x0){_0x4be0fb+=_0x53b48b;}_0x1f5d0e[_0x9026('0x1a')](dbH['sequelize'][_0x9026('0x2e')](util[_0x9026('0x1b')](_0x9026('0x2f'),QUERY,_0x53b48b,_0x4be0fb),{'type':dbH[_0x9026('0x30')][_0x9026('0x31')][_0x9026('0x32')]}));});if(_0x2ac99f>0x0){_0x4be0fb+=_0x53b48b;_0x1f5d0e['push'](dbH[_0x9026('0x30')]['query'](util[_0x9026('0x1b')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2ac99f,_0x4be0fb),{'type':dbH[_0x9026('0x30')]['QueryTypes'][_0x9026('0x32')]}));}}}else{_0x1f5d0e[_0x9026('0x1a')](dbH['sequelize'][_0x9026('0x2e')](QUERY,{'type':dbH['sequelize'][_0x9026('0x31')]['SELECT']}));}var _0x2d2c8e=path['dirname'](PATH);var _0x39f38e=path['basename'](PATH,_0x9026('0x33'));var _0x354f10=_0x1a582b[_0x9026('0x28')]&&_0x1f5d0e[_0x9026('0x15')]>0x1;var _0x4182c0=[];if(!fs[_0x9026('0x34')](path[_0x9026('0x35')](_0x2d2c8e,_0x39f38e))&&_0x354f10){fs[_0x9026('0x36')](path[_0x9026('0x35')](_0x2d2c8e,_0x39f38e));}return BPromise[_0x9026('0x37')](_0x1f5d0e,function(_0x277907){_0x4182c0[_0x9026('0x1a')](_0x277907);})[_0x9026('0x2a')](function(){var _0x782dcf=[];for(var _0x246140=0x0;_0x246140<_0x4182c0['length'];_0x246140+=0x1){var _0x751b72=_0x4182c0[_0x246140];var _0x34d1a8=createTables(_['flatten'](_0x751b72));var _0x1b18ce;var _0x4b9237=getPDFDocDefinition(_0x34d1a8);var _0xf6dffe=getPDFPrinter();var _0x536776=_0xf6dffe[_0x9026('0x38')](_0x4b9237);if(_0x354f10){_0x1b18ce=path['join'](_0x2d2c8e,_0x39f38e,util[_0x9026('0x1b')](_0x9026('0x39'),_0x39f38e,_0x246140,_0x9026('0x3a')));}else{_0x1b18ce=path[_0x9026('0x35')](_0x2d2c8e,util['format'](_0x9026('0x3b'),_0x39f38e,_0x9026('0x3a')));}_0x782dcf[_0x9026('0x1a')](writePDFDocument(_0x536776,_0x1b18ce));}return Promise[_0x9026('0x3c')](_0x782dcf);})['then'](function(){if(_0x354f10){return new Promise(function(_0x34ef67){zipdir(path[_0x9026('0x35')](_0x2d2c8e,_0x39f38e),{'saveTo':path[_0x9026('0x35')](_0x2d2c8e,util[_0x9026('0x1b')]('%s.%s',_0x39f38e,'zip'))},function(){rimraf(path[_0x9026('0x35')](_0x2d2c8e,_0x39f38e),function(){});_0x34ef67(_0x9026('0x3d'));});});}})[_0x9026('0x2a')](function(){if(!_0x354f10)return;rimraf(path[_0x9026('0x35')](_0x2d2c8e,_0x39f38e),function(){});})[_0x9026('0x2a')](function(){logger[_0x9026('0x3e')](util[_0x9026('0x1b')](_0x9026('0x3f'),EXTRACTED_REPORT_ID,_0x9026('0x40')));return analyticExtractedReport(_0x9026('0x41'),_0x354f10?util[_0x9026('0x1b')](_0x9026('0x3b'),_0x39f38e,_0x354f10?_0x9026('0x42'):_0x9026('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x9026('0x3e')](util[_0x9026('0x1b')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9026('0x40')));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x3700b4){EXTRACTED_REPORT=_0x3700b4;return dbH[_0x9026('0x30')][_0x9026('0x2e')](util[_0x9026('0x1b')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x9026('0x31')][_0x9026('0x32')]});})['then'](extractReport)['catch'](function(_0xb0b545){logger['info'](util[_0x9026('0x1b')](_0x9026('0x43'),EXTRACTED_REPORT_ID,_0x9026('0x40')),util[_0x9026('0x44')](_0xb0b545,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9026('0x45'));})[_0x9026('0x46')](function(){process[_0x9026('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x25b8af=new PdfPrinter({'Arial':{'normal':__dirname+_0x9026('0x48'),'bold':__dirname+_0x9026('0x49'),'italics':__dirname+_0x9026('0x4a'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x25b8af;}function getPDFDocDefinitionFromHTML(_0x26f5ab,_0x24d0bb){var _0x1301ff=util['format']('%s\x20#%d',_0x24d0bb[_0x9026('0x4b')],_0x24d0bb['interactionId']);var _0x563e63=moment()['format'](_0x9026('0x4c'))[_0x9026('0x13')]();var _0x316186=htmlToPdfmake(_0x26f5ab,{'window':window,'tableAutoSize':!![]});return{'content':[_0x316186],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x9026('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x9026('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x9026('0x4d')}},'header':function(){return[{'text':_0x9026('0x4e'),'style':_0x9026('0x1e')}];},'footer':function(_0x5e386d,_0x270b1f){return[{'text':util[_0x9026('0x1b')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x1301ff,_0x5e386d,_0x270b1f,_0x563e63),'style':'footer'}];}};}function writePDFDocument(_0x3e565f,_0x1b467a){return new Promise(function(_0x3bb882,_0x571838){var _0x45344c=_0x3e565f[_0x9026('0x4f')](fs[_0x9026('0x50')](_0x1b467a));_0x45344c['on']('finish',function(){_0x3bb882('finish');});_0x45344c['on'](_0x9026('0x51'),function(_0x2d43a6){_0x571838(_0x2d43a6);});_0x3e565f[_0x9026('0x52')]();});}exports['createPdfFromHTML']=function(_0x28e37f,_0x247863){var _0x1e2b90=getPDFPrinter();var _0x31f765=getPDFDocDefinitionFromHTML(_0x28e37f,_0x247863);var _0x347382=_0x1e2b90[_0x9026('0x38')](_0x31f765);return writePDFDocument(_0x347382,_0x247863['path'])[_0x9026('0x53')](function(_0x46108f){throw _0x46108f;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index f93c2c0..b32b80d 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 _0xeeeb=['join','mkdirSync','xlsx','writeFileSync','binary','zip\x20finished','%s.%s','catch','Failed','exit','util','path','lodash','zip-dir','rimraf','../../mysqldb','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','then','splitSizeXlsx','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','existsSync'];(function(_0x3eb450,_0x592b0a){var _0x2c4cfd=function(_0x34f5dc){while(--_0x34f5dc){_0x3eb450['push'](_0x3eb450['shift']());}};_0x2c4cfd(++_0x592b0a);}(_0xeeeb,0x16a));var _0xbeee=function(_0x152879,_0x146e5f){_0x152879=_0x152879-0x0;var _0x2839ef=_0xeeeb[_0x152879];return _0x2839ef;};'use strict';var util=require(_0xbeee('0x0'));var path=require(_0xbeee('0x1'));var _=require(_0xbeee('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0xbeee('0x3'));var rimraf=require(_0xbeee('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xbeee('0x5'))['dbH'];var logger=require('../../config/logger')(_0xbeee('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xbeee('0x7')][0x2]);var QUERY=process[_0xbeee('0x7')][0x3];var PATH=process[_0xbeee('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x47a8d8,_0x343c8c){var _0x139458={'status':_0x47a8d8};var _0x9b3f99={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x343c8c){_0x139458['savename']=_0x343c8c;}return db[_0xbeee('0x8')][_0xbeee('0x9')](_0x139458,_0x9b3f99);}function main(){var _0x513e41=0x1388;var _0xe89f83;logger[_0xbeee('0xa')](util[_0xbeee('0xb')](_0xbeee('0xc'),EXTRACTED_REPORT_ID,_0xbeee('0xd')));return db[_0xbeee('0xe')][_0xbeee('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0xbeee('0x10')](function(_0x2ffc94){if(_0x2ffc94){_0xe89f83=_0x2ffc94;_0x513e41=_0xe89f83[_0xbeee('0x11')]||0x1388;}})[_0xbeee('0x10')](function(){return dbH['sequelize'][_0xbeee('0x12')](util[_0xbeee('0xb')](_0xbeee('0x13'),QUERY),{'type':dbH[_0xbeee('0x14')][_0xbeee('0x15')][_0xbeee('0x16')]});})[_0xbeee('0x10')](function(_0x703176){if(!_0x703176[0x0][_0xbeee('0x17')]){return analyticExtractedReport(_0xbeee('0x18'));}var _0xb4f042=[];var _0x46d303=0x0;if(_0xe89f83[_0xbeee('0x19')]){if(_0x703176&&_0x703176[_0xbeee('0x1a')]){var _0x142c2c=_[_0xbeee('0x1b')](_0x703176[0x0][_0xbeee('0x17')]/_0x513e41);var _0x4eab6d=Number[_0xbeee('0x1c')](_0x703176[0x0][_0xbeee('0x17')]/_0x513e41)?_0x703176[0x0]['num']%_0x513e41:0x0;_0x142c2c[_0xbeee('0x1d')](function(_0x32efdc){if(_0x32efdc>0x0){_0x46d303+=_0x513e41;}_0xb4f042[_0xbeee('0x1e')](dbH[_0xbeee('0x14')]['query'](util['format'](_0xbeee('0x1f'),QUERY,_0x513e41,_0x46d303),{'type':dbH['sequelize'][_0xbeee('0x15')][_0xbeee('0x16')]}));});if(_0x4eab6d>0x0){_0x46d303+=_0x513e41;_0xb4f042[_0xbeee('0x1e')](dbH[_0xbeee('0x14')][_0xbeee('0x12')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4eab6d,_0x46d303),{'type':dbH[_0xbeee('0x14')][_0xbeee('0x15')][_0xbeee('0x16')]}));}}}else{_0xb4f042[_0xbeee('0x1e')](dbH[_0xbeee('0x14')]['query'](QUERY,{'type':dbH[_0xbeee('0x14')][_0xbeee('0x15')][_0xbeee('0x16')]}));}var _0x31be83=path[_0xbeee('0x20')](PATH);var _0x47a1b0=path['basename'](PATH,'.xlsx');var _0x1777d2=_0xe89f83[_0xbeee('0x19')]&&_0xb4f042[_0xbeee('0x1a')]>0x1;var _0x47ddf1=[];if(!fs[_0xbeee('0x21')](path[_0xbeee('0x22')](_0x31be83,_0x47a1b0))&&_0x1777d2){fs[_0xbeee('0x23')](path['join'](_0x31be83,_0x47a1b0));}return BPromise['each'](_0xb4f042,function(_0x44d25b){_0x47ddf1['push'](_0x44d25b);})['then'](function(){for(var _0x34465b=0x0;_0x34465b<_0x47ddf1[_0xbeee('0x1a')];_0x34465b+=0x1){var _0x3890fc;var _0x10d981=_0x47ddf1[_0x34465b];if(_0x1777d2){_0x3890fc=path[_0xbeee('0x22')](_0x31be83,_0x47a1b0,util['format']('%s%d.%s',_0x47a1b0,_0x34465b,_0xbeee('0x24')));}else{_0x3890fc=path[_0xbeee('0x22')](_0x31be83,util[_0xbeee('0xb')]('%s.%s',_0x47a1b0,_0xbeee('0x24')));}fs[_0xbeee('0x25')](_0x3890fc,json2xls(_0x10d981),_0xbeee('0x26'));}})['then'](function(){if(_0x1777d2){return new Promise(function(_0x5aa2ce){zipdir(path[_0xbeee('0x22')](_0x31be83,_0x47a1b0),{'saveTo':path[_0xbeee('0x22')](_0x31be83,util[_0xbeee('0xb')]('%s.%s',_0x47a1b0,'zip'))},function(_0x1265cf,_0x36a1d6){rimraf(path[_0xbeee('0x22')](_0x31be83,_0x47a1b0),function(){});_0x5aa2ce(_0xbeee('0x27'));});});}})['then'](function(){logger['info'](util[_0xbeee('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xbeee('0xd')));return analyticExtractedReport('Completed',_0x1777d2?util[_0xbeee('0xb')](_0xbeee('0x28'),_0x47a1b0,_0x1777d2?'zip':'xlsx'):null);});})[_0xbeee('0x29')](function(_0x35d618){logger[_0xbeee('0xa')](util[_0xbeee('0xb')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbeee('0xd')),util['inspect'](_0x35d618,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbeee('0x2a'));})['finally'](function(){process[_0xbeee('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0c99=['zip\x20finished','Completed','zip','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','existsSync','join','%s%d.%s','xlsx','%s.%s','binary'];(function(_0x2cfbcd,_0x4fcc62){var _0x4afcca=function(_0x1d92b9){while(--_0x1d92b9){_0x2cfbcd['push'](_0x2cfbcd['shift']());}};_0x4afcca(++_0x4fcc62);}(_0x0c99,0x1af));var _0x90c9=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x0c99[_0x469a3c];return _0x968f4;};'use strict';var util=require(_0x90c9('0x0'));var path=require(_0x90c9('0x1'));var _=require(_0x90c9('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x90c9('0x3'));var zipdir=require(_0x90c9('0x4'));var rimraf=require(_0x90c9('0x5'));var db=require(_0x90c9('0x6'))['db'];var dbH=require('../../mysqldb')[_0x90c9('0x7')];var logger=require(_0x90c9('0x8'))(_0x90c9('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x90c9('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3446a4,_0xcb6555){var _0x150cd8={'status':_0x3446a4};var _0x47c9cf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xcb6555){_0x150cd8['savename']=_0xcb6555;}return db['AnalyticExtractedReport'][_0x90c9('0xb')](_0x150cd8,_0x47c9cf);}function main(){var _0x3772d6=0x1388;var _0x1a91cc;logger['info'](util[_0x90c9('0xc')](_0x90c9('0xd'),EXTRACTED_REPORT_ID,_0x90c9('0xe')));return db[_0x90c9('0xf')][_0x90c9('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x90c9('0x11'),'splitSizeXlsx']})[_0x90c9('0x12')](function(_0x2061b4){if(_0x2061b4){_0x1a91cc=_0x2061b4;_0x3772d6=_0x1a91cc['splitSizeXlsx']||0x1388;}})[_0x90c9('0x12')](function(){return dbH[_0x90c9('0x13')][_0x90c9('0x14')](util[_0x90c9('0xc')](_0x90c9('0x15'),QUERY),{'type':dbH[_0x90c9('0x13')]['QueryTypes'][_0x90c9('0x16')]});})[_0x90c9('0x12')](function(_0x5bd66e){if(!_0x5bd66e[0x0][_0x90c9('0x17')]){return analyticExtractedReport(_0x90c9('0x18'));}var _0x274c4f=[];var _0x2003bd=0x0;if(_0x1a91cc['split']){if(_0x5bd66e&&_0x5bd66e[_0x90c9('0x19')]){var _0x1d0b2c=_[_0x90c9('0x1a')](_0x5bd66e[0x0][_0x90c9('0x17')]/_0x3772d6);var _0x18fad6=Number[_0x90c9('0x1b')](_0x5bd66e[0x0][_0x90c9('0x17')]/_0x3772d6)?_0x5bd66e[0x0]['num']%_0x3772d6:0x0;_0x1d0b2c['forEach'](function(_0x1e629e){if(_0x1e629e>0x0){_0x2003bd+=_0x3772d6;}_0x274c4f[_0x90c9('0x1c')](dbH[_0x90c9('0x13')][_0x90c9('0x14')](util['format'](_0x90c9('0x1d'),QUERY,_0x3772d6,_0x2003bd),{'type':dbH[_0x90c9('0x13')][_0x90c9('0x1e')]['SELECT']}));});if(_0x18fad6>0x0){_0x2003bd+=_0x3772d6;_0x274c4f[_0x90c9('0x1c')](dbH[_0x90c9('0x13')][_0x90c9('0x14')](util[_0x90c9('0xc')](_0x90c9('0x1d'),QUERY,_0x18fad6,_0x2003bd),{'type':dbH[_0x90c9('0x13')][_0x90c9('0x1e')][_0x90c9('0x16')]}));}}}else{_0x274c4f[_0x90c9('0x1c')](dbH[_0x90c9('0x13')][_0x90c9('0x14')](QUERY,{'type':dbH[_0x90c9('0x13')]['QueryTypes'][_0x90c9('0x16')]}));}var _0x147a0a=path[_0x90c9('0x1f')](PATH);var _0x3eddc9=path[_0x90c9('0x20')](PATH,'.xlsx');var _0x5c6566=_0x1a91cc[_0x90c9('0x11')]&&_0x274c4f[_0x90c9('0x19')]>0x1;var _0x539a32=[];if(!fs[_0x90c9('0x21')](path['join'](_0x147a0a,_0x3eddc9))&&_0x5c6566){fs['mkdirSync'](path[_0x90c9('0x22')](_0x147a0a,_0x3eddc9));}return BPromise['each'](_0x274c4f,function(_0x2332af){_0x539a32['push'](_0x2332af);})['then'](function(){for(var _0x190e25=0x0;_0x190e25<_0x539a32[_0x90c9('0x19')];_0x190e25+=0x1){var _0x36518c;var _0x2b0da3=_0x539a32[_0x190e25];if(_0x5c6566){_0x36518c=path[_0x90c9('0x22')](_0x147a0a,_0x3eddc9,util[_0x90c9('0xc')](_0x90c9('0x23'),_0x3eddc9,_0x190e25,_0x90c9('0x24')));}else{_0x36518c=path['join'](_0x147a0a,util[_0x90c9('0xc')](_0x90c9('0x25'),_0x3eddc9,_0x90c9('0x24')));}fs['writeFileSync'](_0x36518c,json2xls(_0x2b0da3),_0x90c9('0x26'));}})[_0x90c9('0x12')](function(){if(_0x5c6566){return new Promise(function(_0x5008f7){zipdir(path[_0x90c9('0x22')](_0x147a0a,_0x3eddc9),{'saveTo':path[_0x90c9('0x22')](_0x147a0a,util[_0x90c9('0xc')](_0x90c9('0x25'),_0x3eddc9,'zip'))},function(_0x1e4ad5,_0x2330ae){rimraf(path[_0x90c9('0x22')](_0x147a0a,_0x3eddc9),function(){});_0x5008f7(_0x90c9('0x27'));});});}})[_0x90c9('0x12')](function(){logger['info'](util[_0x90c9('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x90c9('0xe')));return analyticExtractedReport(_0x90c9('0x28'),_0x5c6566?util['format'](_0x90c9('0x25'),_0x3eddc9,_0x5c6566?_0x90c9('0x29'):_0x90c9('0x24')):null);});})['catch'](function(_0x5489d1){logger[_0x90c9('0x2a')](util[_0x90c9('0xc')](_0x90c9('0x2b'),EXTRACTED_REPORT_ID,_0x90c9('0xe')),util['inspect'](_0x5489d1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x90c9('0x2c'));})[_0x90c9('0x2d')](function(){process[_0x90c9('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 9fb1da5..860aacd 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 _0xa6bb=['push','type','format','CDR(type)=%s','context','VoiceExtensionId','Set','CDR(routeid)=','priority','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','wav','XCALLY-MOTION-PROGRESS=0','length','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','transaction','VoiceExtension','bulkCreate','error','lodash','util','models','Interval','findAll','then','intervals','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','extensions','extension','find'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa6bb,0x168));var _0xba6b=function(_0x14dddc,_0x28095b){_0x14dddc=_0x14dddc-0x0;var _0x233142=_0xa6bb[_0x14dddc];return _0x233142;};'use strict';var _=require(_0xba6b('0x0'));var util=require(_0xba6b('0x1'));function rewrite(_0x314516,_0xe909e3){var _0x152ed6=this;return _0x314516[_0xba6b('0x2')][_0xba6b('0x3')][_0xba6b('0x4')]({'raw':!![]})[_0xba6b('0x5')](function(_0x483c2b){_0x152ed6[_0xba6b('0x6')]=_0x483c2b;return _0x314516[_0xba6b('0x2')]['VoiceExtension'][_0xba6b('0x4')]({'where':{'IntervalId':_0xe909e3[_0xba6b('0x7')]},'raw':!![]});})['then'](function(_0x5693e3){return _0x314516[_0xba6b('0x2')]['VoiceExtension'][_0xba6b('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0xba6b('0x8')](_0x5693e3,_0xba6b('0x9')))}},'order':[{'raw':_0xba6b('0xa')}],'raw':!![]});})[_0xba6b('0x5')](function(_0x21d473){var _0x44f90e=_[_0xba6b('0xb')](_0x21d473,{'priority':'1'});var _0x3aeedc=_[_0xba6b('0xb')](_0x21d473,{'isApp':0x1});var _0x1601cb=_[_0xba6b('0xc')](_0x3aeedc,_0xba6b('0x9'));var _0x4bb5dd=['queue',_0xba6b('0xd')];var _0x575805=[];var _0x3c4774=[];for(var _0x4d39bd in _0x1601cb){if(_0x1601cb[_0xba6b('0xe')](_0x4d39bd)){_0x152ed6['priority']=0x2;_0x152ed6[_0xba6b('0xf')]=[];_0x152ed6[_0xba6b('0x10')]=_[_0xba6b('0x11')](_0x44f90e,{'exten':_0x1601cb[_0x4d39bd][0x0]['exten']});_0x152ed6[_0xba6b('0xf')][_0xba6b('0x12')]({'type':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x13')],'app':'Set','appdata':util[_0xba6b('0x14')](_0xba6b('0x15'),_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x13')]),'context':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x16')],'exten':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x9')],'priority':_0x152ed6['priority']++,'VoiceExtensionId':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x17')]});if(_0x1601cb[_0x4d39bd][0x0]['type']==='inbound'){_0x152ed6[_0xba6b('0xf')][_0xba6b('0x12')]({'type':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x13')],'app':_0xba6b('0x18'),'appdata':_0xba6b('0x19')+_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x17')],'context':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x16')],'exten':_0x1601cb[_0x4d39bd][0x0]['exten'],'priority':_0x152ed6[_0xba6b('0x1a')]++,'VoiceExtensionId':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x17')]});}else if(_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x13')]===_0xba6b('0x1b')){if(_0x152ed6[_0xba6b('0x10')]){_0x152ed6[_0xba6b('0xf')][_0xba6b('0x12')]({'type':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x13')],'app':_0xba6b('0x18'),'appdata':_0xba6b('0x1c')+(_0x152ed6[_0xba6b('0x10')][_0xba6b('0x1d')]?_0xba6b('0x1e')+_0x152ed6[_0xba6b('0x10')][_0xba6b('0x1d')]+'}':_0xba6b('0x1f')),'context':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x16')],'exten':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x9')],'priority':_0x152ed6[_0xba6b('0x1a')]++,'VoiceExtensionId':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x17')]});}_0x152ed6[_0xba6b('0xf')]['push']({'type':_0x1601cb[_0x4d39bd][0x0]['type'],'app':_0xba6b('0x18'),'appdata':_0xba6b('0x19')+_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x17')],'context':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x16')],'exten':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x9')],'priority':_0x152ed6[_0xba6b('0x1a')]++,'VoiceExtensionId':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x17')]});var _0x496998=_0x152ed6[_0xba6b('0x1a')]++;_0x152ed6[_0xba6b('0xf')]['push']({'type':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x13')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x496998+0x2)+_0xba6b('0x20')+(_0x496998+0x1)+')','context':_0x1601cb[_0x4d39bd][0x0]['context'],'exten':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x9')],'priority':_0x496998,'VoiceExtensionId':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x17')]});if(_0x152ed6[_0xba6b('0x10')]){_0x152ed6[_0xba6b('0xf')][_0xba6b('0x12')]({'type':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x13')],'app':'Set','appdata':_0x152ed6[_0xba6b('0x10')][_0xba6b('0x1d')]?_0xba6b('0x21')+_0x152ed6['extension']['cutdigits']+'}':_0xba6b('0x22'),'context':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x16')],'exten':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x9')],'priority':_0x152ed6[_0xba6b('0x1a')]++,'VoiceExtensionId':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x17')]});}_0x152ed6[_0xba6b('0xf')][_0xba6b('0x12')]({'type':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x13')],'app':_0xba6b('0x18'),'appdata':_0xba6b('0x23')+_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x17')],'context':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x16')],'exten':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x9')],'priority':_0x152ed6[_0xba6b('0x1a')]++,'VoiceExtensionId':_0x1601cb[_0x4d39bd][0x0]['VoiceExtensionId']});if(_0x152ed6[_0xba6b('0x10')]&&_0x152ed6[_0xba6b('0x10')]['hasOwnProperty'](_0xba6b('0x24'))&&_0x152ed6[_0xba6b('0x10')][_0xba6b('0x24')]!=='none'){_0x152ed6['extensions']['push']({'type':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x13')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1601cb[_0x4d39bd][0x0]['context'],'exten':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x9')],'priority':_0x152ed6[_0xba6b('0x1a')]++,'VoiceExtensionId':_0x1601cb[_0x4d39bd][0x0]['VoiceExtensionId']});_0x152ed6[_0xba6b('0xf')]['push']({'type':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x13')],'app':_0xba6b('0x18'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x152ed6[_0xba6b('0x10')][_0xba6b('0x24')]||_0xba6b('0x25'),'context':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x16')],'exten':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x9')],'priority':_0x152ed6['priority']++,'VoiceExtensionId':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x17')]});}}_0x152ed6[_0xba6b('0xf')][_0xba6b('0x12')]({'type':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x13')],'app':_0xba6b('0x18'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x16')],'exten':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x9')],'priority':_0x152ed6[_0xba6b('0x1a')]++,'VoiceExtensionId':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x17')]});_0x152ed6['extensions'][_0xba6b('0x12')]({'type':_0x1601cb[_0x4d39bd][0x0]['type'],'app':_0xba6b('0x18'),'appdata':_0xba6b('0x26'),'context':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x16')],'exten':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x9')],'priority':_0x152ed6[_0xba6b('0x1a')]++,'VoiceExtensionId':_0x1601cb[_0x4d39bd][0x0]['VoiceExtensionId']});_0x152ed6[_0xba6b('0xf')][_0xba6b('0x12')]({'type':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x13')],'app':_0xba6b('0x18'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1601cb[_0x4d39bd][0x0]['context'],'exten':_0x1601cb[_0x4d39bd][0x0]['exten'],'priority':_0x152ed6[_0xba6b('0x1a')]++,'VoiceExtensionId':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x17')]});for(var _0x570611=0x0,_0x5342a5=0x0;_0x570611<_0x1601cb[_0x4d39bd][_0xba6b('0x27')];_0x570611+=0x1,_0x5342a5=0x0){var _0x104ce7=_0x1601cb[_0x4d39bd][_0x570611];if(_0x104ce7['type']){_0x104ce7['type']=_0x104ce7[_0xba6b('0x13')]['toLowerCase']();}var _0xeb3a1e=[];var _0x4227ec=[];delete _0x104ce7['id'];delete _0x104ce7[_0xba6b('0x28')];delete _0x104ce7[_0xba6b('0x29')];var _0x43e3c6=_0x104ce7[_0xba6b('0x2a')]!==_0xba6b('0x2b')?[_0x104ce7[_0xba6b('0x2a')]]:_0x104ce7[_0xba6b('0x7')]?_[_0xba6b('0x8')](_[_0xba6b('0xb')](_0x152ed6['intervals'],{'IntervalId':_0x104ce7[_0xba6b('0x7')]}),'interval'):[];if(_0x104ce7[_0xba6b('0xe')](_0xba6b('0x2c'))){if(_0x104ce7[_0xba6b('0x2c')]&&_0x104ce7[_0xba6b('0x2c')]!=='--'){_0xeb3a1e[_0xba6b('0x12')]({'type':_0x104ce7[_0xba6b('0x13')],'app':'Set','appdata':_0xba6b('0x2d')+_0x104ce7[_0xba6b('0x2c')],'context':_0x104ce7['context'],'exten':_0x104ce7[_0xba6b('0x9')],'priority':_0x43e3c6[_0xba6b('0x27')]+_0x152ed6[_0xba6b('0x1a')]+_0x5342a5++,'VoiceExtensionId':_0x104ce7[_0xba6b('0x17')]});}}if(_0x104ce7[_0xba6b('0x13')]===_0xba6b('0x1b')&&_0x104ce7[_0xba6b('0xe')](_0xba6b('0x2e'))){if(_0x104ce7[_0xba6b('0x2e')]){_0xeb3a1e[_0xba6b('0x12')]({'type':_0x104ce7[_0xba6b('0x13')],'app':'ExecIf','appdata':_0xba6b('0x2f')+_0x104ce7['callerID']+')','context':_0x104ce7[_0xba6b('0x16')],'exten':_0x104ce7[_0xba6b('0x9')],'priority':_0x43e3c6[_0xba6b('0x27')]+_0x152ed6[_0xba6b('0x1a')]+_0x5342a5++,'VoiceExtensionId':_0x104ce7[_0xba6b('0x17')]});}else{_0xeb3a1e[_0xba6b('0x12')]({'type':_0x104ce7[_0xba6b('0x13')],'app':_0xba6b('0x30'),'appdata':_0xba6b('0x31'),'context':_0x104ce7[_0xba6b('0x16')],'exten':_0x104ce7[_0xba6b('0x9')],'priority':_0x43e3c6[_0xba6b('0x27')]+_0x152ed6[_0xba6b('0x1a')]+_0x5342a5++,'VoiceExtensionId':_0x104ce7[_0xba6b('0x17')]});}}if(_0x104ce7[_0xba6b('0xe')](_0xba6b('0x32'))){if(_0x4bb5dd[_0xba6b('0x33')](_0x104ce7['app']['toLowerCase']())>=0x0&&_0x104ce7[_0xba6b('0x34')]!==_0xba6b('0x35')){if(_0x104ce7['answer']){_0xeb3a1e[_0xba6b('0x12')]({'type':_0x104ce7[_0xba6b('0x13')],'app':_0xba6b('0x30'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x104ce7[_0xba6b('0x16')],'exten':_0x104ce7[_0xba6b('0x9')],'priority':_0x43e3c6[_0xba6b('0x27')]+_0x152ed6[_0xba6b('0x1a')]+_0x5342a5++,'VoiceExtensionId':_0x104ce7[_0xba6b('0x17')]});_0xeb3a1e['push']({'type':_0x104ce7[_0xba6b('0x13')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x104ce7[_0xba6b('0x16')],'exten':_0x104ce7[_0xba6b('0x9')],'priority':_0x43e3c6[_0xba6b('0x27')]+_0x152ed6[_0xba6b('0x1a')]+_0x5342a5++,'VoiceExtensionId':_0x104ce7[_0xba6b('0x17')]});}else{_0xeb3a1e[_0xba6b('0x12')]({'type':_0x104ce7[_0xba6b('0x13')],'app':'ExecIf','appdata':_0xba6b('0x36'),'context':_0x104ce7['context'],'exten':_0x104ce7[_0xba6b('0x9')],'priority':_0x43e3c6[_0xba6b('0x27')]+_0x152ed6['priority']+_0x5342a5++,'VoiceExtensionId':_0x104ce7[_0xba6b('0x17')]});_0xeb3a1e[_0xba6b('0x12')]({'type':_0x104ce7[_0xba6b('0x13')],'app':_0xba6b('0x18'),'appdata':_0xba6b('0x37'),'context':_0x104ce7['context'],'exten':_0x104ce7[_0xba6b('0x9')],'priority':_0x43e3c6[_0xba6b('0x27')]+_0x152ed6[_0xba6b('0x1a')]+_0x5342a5++,'VoiceExtensionId':_0x104ce7['VoiceExtensionId']});}}}for(var _0x3f4d45=0x0;_0x3f4d45<_0x43e3c6[_0xba6b('0x27')];_0x3f4d45+=0x1){var _0x5cab80=_0x152ed6['priority']+_0x43e3c6[_0xba6b('0x27')];var _0x51cf57=_0x3f4d45===_0x43e3c6[_0xba6b('0x27')]-0x1?_0x152ed6[_0xba6b('0x1a')]+_0xeb3a1e[_0xba6b('0x27')]+_0x4227ec[_0xba6b('0x27')]+0x2:_0x152ed6[_0xba6b('0x1a')]+_0x3f4d45+0x1;_0xeb3a1e['splice'](_0x3f4d45,0x0,{'type':_0x104ce7[_0xba6b('0x13')],'app':'GotoIfTime','appdata':_0x43e3c6[_0x3f4d45]+'?'+_0x104ce7[_0xba6b('0x16')]+',${EXTEN},'+_0x5cab80+':'+_0x104ce7[_0xba6b('0x16')]+_0xba6b('0x38')+_0x51cf57,'exten':_0x104ce7[_0xba6b('0x9')],'context':_0x104ce7[_0xba6b('0x16')],'priority':_0x152ed6[_0xba6b('0x1a')]+_0x3f4d45,'VoiceExtensionId':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x17')]});}_0x104ce7[_0xba6b('0x1a')]=_0xeb3a1e['length']?_[_0xba6b('0x39')](_0xeb3a1e)[_0xba6b('0x1a')]+0x1:_0x152ed6[_0xba6b('0x1a')];_0x152ed6[_0xba6b('0x1a')]=(_0x4227ec['length']?_[_0xba6b('0x39')](_0x4227ec)['priority']:_0x104ce7[_0xba6b('0x1a')])+0x1;_0x152ed6['extensions']=_[_0xba6b('0x3a')](_0x152ed6[_0xba6b('0xf')],_0xeb3a1e,[_0x104ce7],_0x4227ec);}_0x152ed6[_0xba6b('0xf')][_0xba6b('0x12')]({'type':_0x1601cb[_0x4d39bd][0x0]['type'],'app':'Hangup','exten':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x9')],'context':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x16')],'priority':_0x152ed6[_0xba6b('0x1a')],'VoiceExtensionId':_0x1601cb[_0x4d39bd][0x0][_0xba6b('0x17')]});_0x575805[_0xba6b('0x12')](_0x1601cb[_0x4d39bd][0x0]['VoiceExtensionId']);_0x3c4774=_['concat'](_0x3c4774,_0x152ed6[_0xba6b('0xf')]);}}return _0x314516[_0xba6b('0x3b')](function(_0x59594a){return _0x314516[_0xba6b('0x2')][_0xba6b('0x3c')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x575805}},'transaction':_0x59594a})[_0xba6b('0x5')](function(_0x197457){return _0x314516[_0xba6b('0x2')][_0xba6b('0x3c')][_0xba6b('0x3d')](_['sortBy'](_0x3c4774,'priority'),{'transaction':_0x59594a});});});})['catch'](function(_0x36936d){console[_0xba6b('0x3e')](_0x36936d);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x047b=['push','CDR(routeid)=','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','then','intervals','VoiceExtension','IntervalId','findAll','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','hasOwnProperty','priority','extensions','extension','find','Set','CDR(type)=%s','type','context','VoiceExtensionId','inbound'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0x047b,0xc1));var _0xb047=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x047b[_0x243217];return _0x478029;};'use strict';var _=require(_0xb047('0x0'));var util=require(_0xb047('0x1'));function rewrite(_0x372ea6,_0x4d2624){var _0x518aec=this;return _0x372ea6[_0xb047('0x2')][_0xb047('0x3')]['findAll']({'raw':!![]})[_0xb047('0x4')](function(_0x4b182e){_0x518aec[_0xb047('0x5')]=_0x4b182e;return _0x372ea6[_0xb047('0x2')][_0xb047('0x6')]['findAll']({'where':{'IntervalId':_0x4d2624[_0xb047('0x7')]},'raw':!![]});})[_0xb047('0x4')](function(_0x5855b7){return _0x372ea6['models'][_0xb047('0x6')][_0xb047('0x8')]({'where':{'exten':{'$in':_[_0xb047('0x9')](_[_0xb047('0xa')](_0x5855b7,_0xb047('0xb')))}},'order':[{'raw':_0xb047('0xc')}],'raw':!![]});})[_0xb047('0x4')](function(_0x4e4d6b){var _0x4c8827=_['filter'](_0x4e4d6b,{'priority':'1'});var _0x311545=_[_0xb047('0xd')](_0x4e4d6b,{'isApp':0x1});var _0x354f36=_['groupBy'](_0x311545,'exten');var _0xb69897=[_0xb047('0xe'),'playback'];var _0x1b312d=[];var _0xf14712=[];for(var _0x11a232 in _0x354f36){if(_0x354f36[_0xb047('0xf')](_0x11a232)){_0x518aec[_0xb047('0x10')]=0x2;_0x518aec[_0xb047('0x11')]=[];_0x518aec[_0xb047('0x12')]=_[_0xb047('0x13')](_0x4c8827,{'exten':_0x354f36[_0x11a232][0x0][_0xb047('0xb')]});_0x518aec[_0xb047('0x11')]['push']({'type':_0x354f36[_0x11a232][0x0]['type'],'app':_0xb047('0x14'),'appdata':util['format'](_0xb047('0x15'),_0x354f36[_0x11a232][0x0][_0xb047('0x16')]),'context':_0x354f36[_0x11a232][0x0][_0xb047('0x17')],'exten':_0x354f36[_0x11a232][0x0][_0xb047('0xb')],'priority':_0x518aec[_0xb047('0x10')]++,'VoiceExtensionId':_0x354f36[_0x11a232][0x0][_0xb047('0x18')]});if(_0x354f36[_0x11a232][0x0][_0xb047('0x16')]===_0xb047('0x19')){_0x518aec[_0xb047('0x11')][_0xb047('0x1a')]({'type':_0x354f36[_0x11a232][0x0][_0xb047('0x16')],'app':'Set','appdata':_0xb047('0x1b')+_0x354f36[_0x11a232][0x0][_0xb047('0x18')],'context':_0x354f36[_0x11a232][0x0][_0xb047('0x17')],'exten':_0x354f36[_0x11a232][0x0][_0xb047('0xb')],'priority':_0x518aec[_0xb047('0x10')]++,'VoiceExtensionId':_0x354f36[_0x11a232][0x0][_0xb047('0x18')]});}else if(_0x354f36[_0x11a232][0x0]['type']==='outbound'){if(_0x518aec[_0xb047('0x12')]){_0x518aec['extensions'][_0xb047('0x1a')]({'type':_0x354f36[_0x11a232][0x0]['type'],'app':'Set','appdata':_0xb047('0x1c')+(_0x518aec[_0xb047('0x12')][_0xb047('0x1d')]?_0xb047('0x1e')+_0x518aec[_0xb047('0x12')][_0xb047('0x1d')]+'}':'${EXTEN}'),'context':_0x354f36[_0x11a232][0x0][_0xb047('0x17')],'exten':_0x354f36[_0x11a232][0x0][_0xb047('0xb')],'priority':_0x518aec[_0xb047('0x10')]++,'VoiceExtensionId':_0x354f36[_0x11a232][0x0][_0xb047('0x18')]});}_0x518aec[_0xb047('0x11')][_0xb047('0x1a')]({'type':_0x354f36[_0x11a232][0x0][_0xb047('0x16')],'app':_0xb047('0x14'),'appdata':_0xb047('0x1b')+_0x354f36[_0x11a232][0x0]['VoiceExtensionId'],'context':_0x354f36[_0x11a232][0x0]['context'],'exten':_0x354f36[_0x11a232][0x0][_0xb047('0xb')],'priority':_0x518aec[_0xb047('0x10')]++,'VoiceExtensionId':_0x354f36[_0x11a232][0x0][_0xb047('0x18')]});var _0x4c908b=_0x518aec[_0xb047('0x10')]++;_0x518aec[_0xb047('0x11')][_0xb047('0x1a')]({'type':_0x354f36[_0x11a232][0x0][_0xb047('0x16')],'app':_0xb047('0x1f'),'appdata':_0xb047('0x20')+(_0x4c908b+0x2)+'):Goto('+(_0x4c908b+0x1)+')','context':_0x354f36[_0x11a232][0x0][_0xb047('0x17')],'exten':_0x354f36[_0x11a232][0x0]['exten'],'priority':_0x4c908b,'VoiceExtensionId':_0x354f36[_0x11a232][0x0][_0xb047('0x18')]});if(_0x518aec[_0xb047('0x12')]){_0x518aec[_0xb047('0x11')]['push']({'type':_0x354f36[_0x11a232][0x0][_0xb047('0x16')],'app':_0xb047('0x14'),'appdata':_0x518aec['extension'][_0xb047('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x518aec[_0xb047('0x12')][_0xb047('0x1d')]+'}':'CDR(prefix)=noprefix','context':_0x354f36[_0x11a232][0x0][_0xb047('0x17')],'exten':_0x354f36[_0x11a232][0x0][_0xb047('0xb')],'priority':_0x518aec[_0xb047('0x10')]++,'VoiceExtensionId':_0x354f36[_0x11a232][0x0][_0xb047('0x18')]});}_0x518aec[_0xb047('0x11')][_0xb047('0x1a')]({'type':_0x354f36[_0x11a232][0x0]['type'],'app':_0xb047('0x14'),'appdata':_0xb047('0x21')+_0x354f36[_0x11a232][0x0][_0xb047('0x18')],'context':_0x354f36[_0x11a232][0x0][_0xb047('0x17')],'exten':_0x354f36[_0x11a232][0x0][_0xb047('0xb')],'priority':_0x518aec[_0xb047('0x10')]++,'VoiceExtensionId':_0x354f36[_0x11a232][0x0]['VoiceExtensionId']});if(_0x518aec[_0xb047('0x12')]&&_0x518aec[_0xb047('0x12')][_0xb047('0xf')](_0xb047('0x22'))&&_0x518aec['extension'][_0xb047('0x22')]!==_0xb047('0x23')){_0x518aec[_0xb047('0x11')][_0xb047('0x1a')]({'type':_0x354f36[_0x11a232][0x0][_0xb047('0x16')],'app':_0xb047('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x354f36[_0x11a232][0x0][_0xb047('0x17')],'exten':_0x354f36[_0x11a232][0x0][_0xb047('0xb')],'priority':_0x518aec[_0xb047('0x10')]++,'VoiceExtensionId':_0x354f36[_0x11a232][0x0][_0xb047('0x18')]});_0x518aec['extensions'][_0xb047('0x1a')]({'type':_0x354f36[_0x11a232][0x0][_0xb047('0x16')],'app':_0xb047('0x14'),'appdata':_0xb047('0x24')+_0x518aec[_0xb047('0x12')][_0xb047('0x22')]||_0xb047('0x25'),'context':_0x354f36[_0x11a232][0x0][_0xb047('0x17')],'exten':_0x354f36[_0x11a232][0x0]['exten'],'priority':_0x518aec[_0xb047('0x10')]++,'VoiceExtensionId':_0x354f36[_0x11a232][0x0][_0xb047('0x18')]});}}_0x518aec['extensions'][_0xb047('0x1a')]({'type':_0x354f36[_0x11a232][0x0][_0xb047('0x16')],'app':_0xb047('0x14'),'appdata':_0xb047('0x26'),'context':_0x354f36[_0x11a232][0x0][_0xb047('0x17')],'exten':_0x354f36[_0x11a232][0x0][_0xb047('0xb')],'priority':_0x518aec['priority']++,'VoiceExtensionId':_0x354f36[_0x11a232][0x0][_0xb047('0x18')]});_0x518aec[_0xb047('0x11')][_0xb047('0x1a')]({'type':_0x354f36[_0x11a232][0x0]['type'],'app':'Set','appdata':_0xb047('0x27'),'context':_0x354f36[_0x11a232][0x0][_0xb047('0x17')],'exten':_0x354f36[_0x11a232][0x0][_0xb047('0xb')],'priority':_0x518aec[_0xb047('0x10')]++,'VoiceExtensionId':_0x354f36[_0x11a232][0x0][_0xb047('0x18')]});_0x518aec['extensions'][_0xb047('0x1a')]({'type':_0x354f36[_0x11a232][0x0][_0xb047('0x16')],'app':'Set','appdata':_0xb047('0x28'),'context':_0x354f36[_0x11a232][0x0][_0xb047('0x17')],'exten':_0x354f36[_0x11a232][0x0][_0xb047('0xb')],'priority':_0x518aec[_0xb047('0x10')]++,'VoiceExtensionId':_0x354f36[_0x11a232][0x0][_0xb047('0x18')]});for(var _0x3502be=0x0,_0x54fc7c=0x0;_0x3502be<_0x354f36[_0x11a232][_0xb047('0x29')];_0x3502be+=0x1,_0x54fc7c=0x0){var _0x6c9fbf=_0x354f36[_0x11a232][_0x3502be];if(_0x6c9fbf[_0xb047('0x16')]){_0x6c9fbf[_0xb047('0x16')]=_0x6c9fbf[_0xb047('0x16')][_0xb047('0x2a')]();}var _0x4fc8c2=[];var _0xb141ec=[];delete _0x6c9fbf['id'];delete _0x6c9fbf[_0xb047('0x2b')];delete _0x6c9fbf[_0xb047('0x2c')];var _0x5d2c78=_0x6c9fbf[_0xb047('0x2d')]!==_0xb047('0x2e')?[_0x6c9fbf[_0xb047('0x2d')]]:_0x6c9fbf[_0xb047('0x7')]?_[_0xb047('0xa')](_[_0xb047('0xd')](_0x518aec[_0xb047('0x5')],{'IntervalId':_0x6c9fbf[_0xb047('0x7')]}),'interval'):[];if(_0x6c9fbf[_0xb047('0xf')](_0xb047('0x2f'))){if(_0x6c9fbf['tag']&&_0x6c9fbf['tag']!=='--'){_0x4fc8c2[_0xb047('0x1a')]({'type':_0x6c9fbf[_0xb047('0x16')],'app':_0xb047('0x14'),'appdata':_0xb047('0x30')+_0x6c9fbf[_0xb047('0x2f')],'context':_0x6c9fbf[_0xb047('0x17')],'exten':_0x6c9fbf[_0xb047('0xb')],'priority':_0x5d2c78[_0xb047('0x29')]+_0x518aec[_0xb047('0x10')]+_0x54fc7c++,'VoiceExtensionId':_0x6c9fbf[_0xb047('0x18')]});}}if(_0x6c9fbf[_0xb047('0x16')]===_0xb047('0x31')&&_0x6c9fbf[_0xb047('0xf')](_0xb047('0x32'))){if(_0x6c9fbf[_0xb047('0x32')]){_0x4fc8c2['push']({'type':_0x6c9fbf['type'],'app':_0xb047('0x1f'),'appdata':_0xb047('0x33')+_0x6c9fbf[_0xb047('0x32')]+')','context':_0x6c9fbf[_0xb047('0x17')],'exten':_0x6c9fbf['exten'],'priority':_0x5d2c78[_0xb047('0x29')]+_0x518aec['priority']+_0x54fc7c++,'VoiceExtensionId':_0x6c9fbf[_0xb047('0x18')]});}else{_0x4fc8c2[_0xb047('0x1a')]({'type':_0x6c9fbf[_0xb047('0x16')],'app':_0xb047('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x6c9fbf[_0xb047('0x17')],'exten':_0x6c9fbf['exten'],'priority':_0x5d2c78['length']+_0x518aec['priority']+_0x54fc7c++,'VoiceExtensionId':_0x6c9fbf['VoiceExtensionId']});}}if(_0x6c9fbf['hasOwnProperty'](_0xb047('0x34'))){if(_0xb69897[_0xb047('0x35')](_0x6c9fbf['app'][_0xb047('0x2a')]())>=0x0&&_0x6c9fbf[_0xb047('0x36')]!==_0xb047('0x37')){if(_0x6c9fbf['answer']){_0x4fc8c2[_0xb047('0x1a')]({'type':_0x6c9fbf[_0xb047('0x16')],'app':'ExecIf','appdata':_0xb047('0x38'),'context':_0x6c9fbf[_0xb047('0x17')],'exten':_0x6c9fbf[_0xb047('0xb')],'priority':_0x5d2c78[_0xb047('0x29')]+_0x518aec[_0xb047('0x10')]+_0x54fc7c++,'VoiceExtensionId':_0x6c9fbf['VoiceExtensionId']});_0x4fc8c2[_0xb047('0x1a')]({'type':_0x6c9fbf[_0xb047('0x16')],'app':'Set','appdata':_0xb047('0x39'),'context':_0x6c9fbf[_0xb047('0x17')],'exten':_0x6c9fbf['exten'],'priority':_0x5d2c78['length']+_0x518aec[_0xb047('0x10')]+_0x54fc7c++,'VoiceExtensionId':_0x6c9fbf[_0xb047('0x18')]});}else{_0x4fc8c2['push']({'type':_0x6c9fbf[_0xb047('0x16')],'app':'ExecIf','appdata':_0xb047('0x3a'),'context':_0x6c9fbf[_0xb047('0x17')],'exten':_0x6c9fbf[_0xb047('0xb')],'priority':_0x5d2c78['length']+_0x518aec[_0xb047('0x10')]+_0x54fc7c++,'VoiceExtensionId':_0x6c9fbf[_0xb047('0x18')]});_0x4fc8c2[_0xb047('0x1a')]({'type':_0x6c9fbf[_0xb047('0x16')],'app':_0xb047('0x14'),'appdata':_0xb047('0x3b'),'context':_0x6c9fbf['context'],'exten':_0x6c9fbf[_0xb047('0xb')],'priority':_0x5d2c78['length']+_0x518aec[_0xb047('0x10')]+_0x54fc7c++,'VoiceExtensionId':_0x6c9fbf[_0xb047('0x18')]});}}}for(var _0x28a30c=0x0;_0x28a30c<_0x5d2c78[_0xb047('0x29')];_0x28a30c+=0x1){var _0x865bac=_0x518aec[_0xb047('0x10')]+_0x5d2c78['length'];var _0x3dc8f3=_0x28a30c===_0x5d2c78[_0xb047('0x29')]-0x1?_0x518aec[_0xb047('0x10')]+_0x4fc8c2[_0xb047('0x29')]+_0xb141ec[_0xb047('0x29')]+0x2:_0x518aec['priority']+_0x28a30c+0x1;_0x4fc8c2[_0xb047('0x3c')](_0x28a30c,0x0,{'type':_0x6c9fbf['type'],'app':_0xb047('0x3d'),'appdata':_0x5d2c78[_0x28a30c]+'?'+_0x6c9fbf[_0xb047('0x17')]+_0xb047('0x3e')+_0x865bac+':'+_0x6c9fbf[_0xb047('0x17')]+',${EXTEN},'+_0x3dc8f3,'exten':_0x6c9fbf[_0xb047('0xb')],'context':_0x6c9fbf['context'],'priority':_0x518aec[_0xb047('0x10')]+_0x28a30c,'VoiceExtensionId':_0x354f36[_0x11a232][0x0][_0xb047('0x18')]});}_0x6c9fbf[_0xb047('0x10')]=_0x4fc8c2[_0xb047('0x29')]?_[_0xb047('0x3f')](_0x4fc8c2)[_0xb047('0x10')]+0x1:_0x518aec[_0xb047('0x10')];_0x518aec['priority']=(_0xb141ec[_0xb047('0x29')]?_['last'](_0xb141ec)[_0xb047('0x10')]:_0x6c9fbf['priority'])+0x1;_0x518aec[_0xb047('0x11')]=_[_0xb047('0x40')](_0x518aec[_0xb047('0x11')],_0x4fc8c2,[_0x6c9fbf],_0xb141ec);}_0x518aec[_0xb047('0x11')][_0xb047('0x1a')]({'type':_0x354f36[_0x11a232][0x0][_0xb047('0x16')],'app':_0xb047('0x41'),'exten':_0x354f36[_0x11a232][0x0][_0xb047('0xb')],'context':_0x354f36[_0x11a232][0x0][_0xb047('0x17')],'priority':_0x518aec[_0xb047('0x10')],'VoiceExtensionId':_0x354f36[_0x11a232][0x0][_0xb047('0x18')]});_0x1b312d[_0xb047('0x1a')](_0x354f36[_0x11a232][0x0]['VoiceExtensionId']);_0xf14712=_[_0xb047('0x40')](_0xf14712,_0x518aec[_0xb047('0x11')]);}}return _0x372ea6[_0xb047('0x42')](function(_0x489aca){return _0x372ea6[_0xb047('0x2')]['VoiceExtension'][_0xb047('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x1b312d}},'transaction':_0x489aca})[_0xb047('0x4')](function(_0x3b8209){return _0x372ea6[_0xb047('0x2')][_0xb047('0x6')][_0xb047('0x44')](_[_0xb047('0x45')](_0xf14712,'priority'),{'transaction':_0x489aca});});});})[_0xb047('0x46')](function(_0x1e4721){console[_0xb047('0x47')](_0x1e4721);});}exports[_0xb047('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 3e9a3a7..870591b 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 _0xb685=['phone\x20IS\x20NOT\x20NULL','calleridnum','\x20=\x20?','cm_hopper','id\x20IN\x20?','VoiceQueue','findAll','dialCheckDuplicateType','CmList','get','always','sequelize','query','onlyIfOpen','VoiceQueueId','all','Lists','CampaignId','Campaign','generalCheckHopper','finally','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','localhost','socket.io-emitter','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','error','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','toString','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','from','str'];(function(_0x49c7ef,_0x4a0623){var _0x4a864d=function(_0x1c30ff){while(--_0x1c30ff){_0x49c7ef['push'](_0x49c7ef['shift']());}};_0x4a864d(++_0x4a0623);}(_0xb685,0x8c));var _0x5b68=function(_0x17dd43,_0x4ab9a4){_0x17dd43=_0x17dd43-0x0;var _0x5c035d=_0xb685[_0x17dd43];return _0x5c035d;};'use strict';var BPromise=require(_0x5b68('0x0'));var util=require('util');var _=require(_0x5b68('0x1'));var fs=require('fs');var squel=require(_0x5b68('0x2'));var Papa=require(_0x5b68('0x3'));var Redis=require(_0x5b68('0x4'));var db=require(_0x5b68('0x5'))['db'];var config=require(_0x5b68('0x6'));var logger=require(_0x5b68('0x7'))(_0x5b68('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x5b68('0x9'),'port':0x18eb});var socket=require(_0x5b68('0xa'))(new Redis(config[_0x5b68('0xb')]));require(_0x5b68('0xc'))[_0x5b68('0xd')](socket);try{if(!process['argv'][0x2]||process[_0x5b68('0xe')][0x2]===_0x5b68('0xf')||process[_0x5b68('0xe')][0x2]==='null'){throw new Error(_0x5b68('0x10'));}var FILEPATH=process[_0x5b68('0xe')][0x2];if(!process[_0x5b68('0xe')][0x3]||process[_0x5b68('0xe')][0x3]===_0x5b68('0xf')||process[_0x5b68('0xe')][0x3]===_0x5b68('0x11')||!process[_0x5b68('0xe')][0x4]||process[_0x5b68('0xe')][0x4]===_0x5b68('0xf')||process[_0x5b68('0xe')][0x4]===_0x5b68('0x11')){throw new Error(_0x5b68('0x12'));}var FIELDS=_[_0x5b68('0x13')](process['argv'][0x3][_0x5b68('0x14')](','),process[_0x5b68('0xe')][0x4][_0x5b68('0x14')](','));if(!process['argv'][0x5]||process['argv'][0x5]==='undefined'||process['argv'][0x5]===_0x5b68('0x11')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x5b68('0xe')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x5b68('0xf')&&process[_0x5b68('0xe')][0x6]!==_0x5b68('0x11')?process['argv'][0x6]:null;var DUPLICATES=process[_0x5b68('0xe')][0x7]&&process['argv'][0x7]!==_0x5b68('0xf')&&process[_0x5b68('0xe')][0x7]!=='null'?process[_0x5b68('0xe')][0x7]:null;if(!process['argv'][0x8]||process[_0x5b68('0xe')][0x8]==='undefined'||process[_0x5b68('0xe')][0x8]===_0x5b68('0x11')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x5b68('0xe')][0x8];}catch(_0x10ced2){logger['error'](_0x10ced2);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(_0x2eed57,_0x598ce0,_0x58b245,_0x1c720b){var _0x2d3f09={'message':_0x598ce0};_0x2d3f09[_0x2eed57]=!![];if(_0x58b245){_0x2d3f09['contact']=_0x58b245;}if(_0x1c720b){_0x2d3f09[_0x5b68('0x15')]=_0x1c720b;}return _0x2d3f09;}function isEmail(_0x413558){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))*$/[_0x5b68('0x16')](_0x413558);}function checkRow(_0x65b61f,_0x4ed123,_0x36aa3c){return new BPromise(function(_0x29c2df,_0x502227){if(_[_0x5b68('0x17')](_0x65b61f)){return _0x502227(handleCheckRowError('error',_0x5b68('0x18'),null,_0x36aa3c));}if(_0x65b61f['errors']&&_0x65b61f[_0x5b68('0x19')][_0x5b68('0x1a')]){var _0x38ba37=_[_0x5b68('0x1b')](_0x65b61f[_0x5b68('0x19')],_0x5b68('0x1c'))[_0x5b68('0x1d')](';');return _0x502227(handleCheckRowError('error',_0x38ba37,null,_0x36aa3c));}var _0x1a6b00={};for(var _0x4a36b0 in FIELDS){if(FIELDS[_0x5b68('0x1e')](_0x4a36b0)&&FIELDS[_0x4a36b0]){_0x1a6b00[_0x4a36b0]=_0x65b61f[_0x5b68('0x1f')][0x0][FIELDS[_0x4a36b0]]||_0x65b61f[_0x5b68('0x1f')][0x0]['\ufeff'+FIELDS[_0x4a36b0]];}}if(!_0x1a6b00[_0x5b68('0x20')]){return _0x502227(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x36aa3c));}if(!_0x1a6b00['phone']){return _0x502227(handleCheckRowError(_0x5b68('0x21'),_0x5b68('0x22'),null,_0x36aa3c));}if(_0x1a6b00[_0x5b68('0x23')]){var _0x556a07=moment(_0x1a6b00[_0x5b68('0x23')],'YYYY-MM-DD');if(!_0x556a07[_0x5b68('0x24')]()){return _0x502227(handleCheckRowError(_0x5b68('0x21'),_0x5b68('0x25'),null,_0x36aa3c));}}if(_0x1a6b00[_0x5b68('0x26')]){if(!isEmail(_0x1a6b00[_0x5b68('0x26')])){return _0x502227(handleCheckRowError('error',_0x5b68('0x27'),null,_0x36aa3c));}}_0x1a6b00[_0x5b68('0x28')]=LISTID;_0x1a6b00[_0x5b68('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x5b68('0x1a')]&&_0x4ed123){var _0xc5e1e5={};for(var _0x566224=0x0,_0x470524=DUPLICATES['length'];_0x566224<_0x470524;_0x566224+=0x1){_0xc5e1e5[DUPLICATES[_0x566224]]=_0x1a6b00[DUPLICATES[_0x566224]];}var _0x472be1=_[_0x5b68('0x2a')](_0x4ed123,_0xc5e1e5);if(_0x472be1){return _0x502227(handleCheckRowError(_0x5b68('0x2b'),_0x5b68('0x2c'),_0x472be1,_0x36aa3c));}}return db[_0x5b68('0x2d')][_0x5b68('0x2e')](_0x1a6b00,{'raw':!![],'hooks':![],'fields':_[_0x5b68('0x2f')](_0x1a6b00)})[_0x5b68('0x30')](function(_0x7b6b86){if(DUPLICATES&&DUPLICATES['length']&&_0x4ed123){_0x4ed123[_0x5b68('0x31')](_[_0x5b68('0x32')](_0x1a6b00,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x7b6b86['id'];return _0x29c2df();})[_0x5b68('0x33')](function(_0x330311){return _0x502227(handleCheckRowError(_0x5b68('0x21'),_0x5b68('0x34')+(_0x330311['message']||JSON[_0x5b68('0x35')](_0x330311)),null,_0x36aa3c));});});}function checkHopper(){function _0x38dd99(){return function(_0x5c6486){logger[_0x5b68('0x21')](_0x5b68('0x36'),_0x5b68('0x37'),util[_0x5b68('0x38')](_0x5c6486,{'showHidden':![],'depth':null}));};}var _0x2cd9f8=function(_0x1a71de,_0x416c1b){var _0x7ca774=squel[_0x5b68('0x39')]()[_0x5b68('0x3a')]('cm_hopper')[_0x5b68('0x3b')]([_0x5b68('0x3c'),_0x5b68('0x3d'),_0x5b68('0x3e'),'ListId',_0x416c1b,_0x5b68('0x3f'),_0x5b68('0x40')],squel[_0x5b68('0x41')]()['field'](_0x5b68('0x3c'),_0x5b68('0x3c'))[_0x5b68('0x42')]('NOW()','scheduledAt')[_0x5b68('0x42')]('id','ContactId')[_0x5b68('0x42')](LISTID[_0x5b68('0x43')](),'ListId')[_0x5b68('0x42')](_0x1a71de['id'][_0x5b68('0x43')](),_0x416c1b)[_0x5b68('0x42')](_0x5b68('0x44'),_0x5b68('0x3f'))[_0x5b68('0x42')]('NOW()',_0x5b68('0x40'))['from'](_0x5b68('0x45'))['where'](_0x5b68('0x46'))[_0x5b68('0x47')](_0x5b68('0x48'),LISTID[_0x5b68('0x43')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x5b68('0x47')](_0x5b68('0x49'),squel['select']()['field'](_0x5b68('0x3c'))[_0x5b68('0x4a')]('cm_hopper')[_0x5b68('0x47')](_0x416c1b+'\x20=\x20?',_0x1a71de['id']['toString']())))['toString']();return _0x7ca774;};var _0x29a05e=function(_0x560bf2,_0x424968){var _0x18bff8=squel[_0x5b68('0x39')]()[_0x5b68('0x3a')]('cm_hopper')[_0x5b68('0x3b')]([_0x5b68('0x3c'),'scheduledAt',_0x5b68('0x3e'),'ListId',_0x424968,'createdAt',_0x5b68('0x40')],squel[_0x5b68('0x41')]()[_0x5b68('0x42')]('phone',_0x5b68('0x3c'))[_0x5b68('0x42')]('NOW()','scheduledAt')[_0x5b68('0x42')]('id',_0x5b68('0x3e'))[_0x5b68('0x42')](LISTID['toString'](),_0x5b68('0x28'))['field'](_0x560bf2['id'][_0x5b68('0x43')](),_0x424968)[_0x5b68('0x42')](_0x5b68('0x44'),'createdAt')[_0x5b68('0x42')](_0x5b68('0x44'),_0x5b68('0x40'))[_0x5b68('0x4a')]('cm_contacts')[_0x5b68('0x47')]('deletedAt\x20IS\x20NULL')[_0x5b68('0x47')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x5b68('0x4b')](hopperContacts))[_0x5b68('0x47')](_0x5b68('0x4c'))['where'](_0x5b68('0x49'),squel[_0x5b68('0x41')]()['field'](_0x5b68('0x4d'))['from']('cm_hopper_final')['where'](_0x424968+_0x5b68('0x4e'),_0x560bf2['id']['toString']()))['where'](_0x5b68('0x49'),squel[_0x5b68('0x41')]()['field'](_0x5b68('0x3c'))[_0x5b68('0x4a')](_0x5b68('0x4f'))['where'](_0x424968+'\x20=\x20?',_0x560bf2['id']['toString']())))[_0x5b68('0x43')]();return _0x18bff8;};function _0xdfa394(_0xb59a38,_0x600e93){var _0x3b9f8a=squel[_0x5b68('0x39')]()[_0x5b68('0x3a')](_0x5b68('0x4f'))[_0x5b68('0x3b')]([_0x5b68('0x3c'),_0x5b68('0x3d'),_0x5b68('0x3e'),_0x5b68('0x28'),_0x600e93,_0x5b68('0x3f'),_0x5b68('0x40')],squel['select']()[_0x5b68('0x42')](_0x5b68('0x3c'),_0x5b68('0x3c'))['field'](_0x5b68('0x44'),_0x5b68('0x3d'))[_0x5b68('0x42')]('id',_0x5b68('0x3e'))['field'](LISTID['toString'](),_0x5b68('0x28'))['field'](_0xb59a38['id']['toString'](),_0x600e93)[_0x5b68('0x42')]('NOW()',_0x5b68('0x3f'))[_0x5b68('0x42')](_0x5b68('0x44'),_0x5b68('0x40'))[_0x5b68('0x4a')](_0x5b68('0x45'))[_0x5b68('0x47')](_0x5b68('0x46'))['where'](_0x5b68('0x48'),LISTID[_0x5b68('0x43')]())[_0x5b68('0x47')](_0x5b68('0x50'),squel[_0x5b68('0x4b')](hopperContacts))[_0x5b68('0x47')](_0x5b68('0x4c')))[_0x5b68('0x43')]();return _0x3b9f8a;}function _0x37920b(_0x21c034,_0x1ab9e5){var _0x5d6ee6=squel[_0x5b68('0x39')]()[_0x5b68('0x3a')]('cm_hopper_black')[_0x5b68('0x3b')]([_0x5b68('0x3c'),_0x5b68('0x3e'),_0x5b68('0x28'),_0x1ab9e5,_0x5b68('0x3f'),_0x5b68('0x40')],squel['select']()['field'](_0x5b68('0x3c'),_0x5b68('0x3c'))[_0x5b68('0x42')]('id',_0x5b68('0x3e'))[_0x5b68('0x42')](LISTID['toString'](),_0x5b68('0x28'))[_0x5b68('0x42')](_0x21c034['id'][_0x5b68('0x43')](),_0x1ab9e5)[_0x5b68('0x42')]('NOW()',_0x5b68('0x3f'))[_0x5b68('0x42')](_0x5b68('0x44'),'updatedAt')['from'](_0x5b68('0x45'))[_0x5b68('0x47')](_0x5b68('0x46'))['where'](_0x5b68('0x48'),LISTID[_0x5b68('0x43')]())['where'](_0x5b68('0x50'),squel[_0x5b68('0x4b')](hopperContacts))[_0x5b68('0x47')](_0x5b68('0x4c')))['toString']();return _0x5d6ee6;}return db[_0x5b68('0x51')][_0x5b68('0x52')]({'where':{'type':'outbound'},'attributes':['id',_0x5b68('0x53')],'include':[{'model':db[_0x5b68('0x54')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x2be763){var _0x49b4c2=[];if(_0x2be763){var _0x4750fd;for(var _0x59ed4e=0x0,_0x5d33dd;_0x59ed4e<_0x2be763[_0x5b68('0x1a')];_0x59ed4e+=0x1){_0x5d33dd=_0x2be763[_0x59ed4e][_0x5b68('0x55')]({'plain':!![]});switch(_0x5d33dd[_0x5b68('0x53')]){case _0x5b68('0x56'):_0x49b4c2[_0x5b68('0x31')](db[_0x5b68('0x57')][_0x5b68('0x58')](_0x29a05e(_0x5d33dd,'VoiceQueueId'))[_0x5b68('0x30')](function(){})[_0x5b68('0x33')](_0x38dd99()));break;case _0x5b68('0x59'):_0x49b4c2[_0x5b68('0x31')](db[_0x5b68('0x57')][_0x5b68('0x58')](_0x2cd9f8(_0x5d33dd,'VoiceQueueId'))[_0x5b68('0x30')](function(){})[_0x5b68('0x33')](_0x38dd99()));break;default:_0x49b4c2[_0x5b68('0x31')](db[_0x5b68('0x57')][_0x5b68('0x58')](_0xdfa394(_0x5d33dd,_0x5b68('0x5a')))[_0x5b68('0x30')](function(){})[_0x5b68('0x33')](_0x38dd99()));}}}return _0x49b4c2;})[_0x5b68('0x5b')]()[_0x5b68('0x30')](function(){return db[_0x5b68('0x51')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x5b68('0x54')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x5b68('0x30')](function(_0xcf89a0){var _0x9ec46b=[];if(_0xcf89a0){var _0x27449b;for(var _0x49a9fa=0x0,_0x18458a;_0x49a9fa<_0xcf89a0[_0x5b68('0x1a')];_0x49a9fa+=0x1){_0x18458a=_0xcf89a0[_0x49a9fa]['get']({'plain':!![]});_0x9ec46b['push'](db['sequelize'][_0x5b68('0x58')](_0x37920b(_0x18458a,_0x5b68('0x5a')))[_0x5b68('0x30')](function(){})[_0x5b68('0x33')](_0x38dd99()));}}return _0x9ec46b;})['all']();})[_0x5b68('0x30')](function(){return db['Campaign'][_0x5b68('0x52')]({'attributes':['id',_0x5b68('0x53')],'include':[{'model':db[_0x5b68('0x54')],'as':_0x5b68('0x5c'),'where':{'id':LISTID}}]})[_0x5b68('0x30')](function(_0x106449){var _0xab6249=[];if(_0x106449){for(var _0x176364=0x0,_0x3e1943;_0x176364<_0x106449['length'];_0x176364+=0x1){_0x3e1943=_0x106449[_0x176364]['get']({'plain':!![]});switch(_0x3e1943['dialCheckDuplicateType']){case _0x5b68('0x56'):_0xab6249['push'](db[_0x5b68('0x57')]['query'](_0x29a05e(_0x3e1943,_0x5b68('0x5d')))['then'](function(){})[_0x5b68('0x33')](_0x38dd99()));break;case _0x5b68('0x59'):_0xab6249['push'](db[_0x5b68('0x57')][_0x5b68('0x58')](_0x2cd9f8(_0x3e1943,'CampaignId'))[_0x5b68('0x30')](function(){})[_0x5b68('0x33')](_0x38dd99()));break;default:_0xab6249[_0x5b68('0x31')](db[_0x5b68('0x57')][_0x5b68('0x58')](_0xdfa394(_0x3e1943,_0x5b68('0x5d')))['then'](function(){})['catch'](_0x38dd99()));}}}return _0xab6249;})[_0x5b68('0x5b')]();})[_0x5b68('0x30')](function(){return db[_0x5b68('0x5e')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x5b68('0x54')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x5b68('0x30')](function(_0x429429){var _0x7459c9=[];if(_0x429429){for(var _0x225abe=0x0,_0x287f3b;_0x225abe<_0x429429[_0x5b68('0x1a')];_0x225abe+=0x1){_0x287f3b=_0x429429[_0x225abe][_0x5b68('0x55')]({'plain':!![]});_0x7459c9[_0x5b68('0x31')](db[_0x5b68('0x57')]['query'](_0x37920b(_0x287f3b,_0x5b68('0x5d')))[_0x5b68('0x30')](function(){})[_0x5b68('0x33')](_0x38dd99()));}}return _0x7459c9;})['all']();})['catch'](function(_0x1b57d0){logger[_0x5b68('0x21')]('cmContact,\x20%s,\x20%s',_0x5b68('0x5f'),_0x1b57d0[_0x5b68('0x1c')]);});}var processPromises=function(_0x1a77f1){return BPromise[_0x5b68('0x5b')](promises)[_0x5b68('0x30')](function(_0x5561c9){})[_0x5b68('0x33')](function(_0x1c9359){logger[_0x5b68('0x21')]('Error\x20processing\x20rows\x20block:',JSON[_0x5b68('0x35')](_0x1c9359));})[_0x5b68('0x60')](function(){socket[_0x5b68('0x61')](_0x5b68('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1a77f1){return _0x1a77f1['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0x5b68('0x30')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x5b68('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x5b68('0x63')](FILEPATH);}catch(_0x45f18b){logger[_0x5b68('0x21')](_0x5b68('0x64'),JSON[_0x5b68('0x35')](_0x45f18b));}finally{process[_0x5b68('0x65')](0x0);}});};process['on']('SIGINT',function(){logger[_0x5b68('0x66')](_0x5b68('0x67'));endCsv();});function main(){return BPromise[_0x5b68('0x68')]()[_0x5b68('0x30')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x5b68('0x14')](',');return db[_0x5b68('0x2d')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x136c47){var _0x317493=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x317493,{'header':!![],'skipEmptyLines':!![],'step':function(_0x28ad84,_0x1680b4){total+=0x1;var _0x469684=total;promises[_0x5b68('0x31')](checkRow(_0x28ad84,_0x136c47,_0x469684)[_0x5b68('0x30')](function(){success+=0x1;})[_0x5b68('0x33')](function(_0x17a917){if(_0x17a917[_0x5b68('0x21')]){errors+=0x1;delete _0x17a917['error'];}else if(_0x17a917[_0x5b68('0x2b')]){duplicates+=0x1;delete _0x17a917[_0x5b68('0x2b')];}rows[_0x5b68('0x31')](_0x17a917);}));if(total%0xc8===0x0){_0x1680b4[_0x5b68('0x69')]();return processPromises(_0x1680b4);}},'complete':function(){return processPromises()[_0x5b68('0x30')](function(){logger[_0x5b68('0x66')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x11c874,_0x112b68){logger[_0x5b68('0x66')](_0x5b68('0x6a'),JSON[_0x5b68('0x35')](_0x11c874));endCsv();}});})[_0x5b68('0x33')](function(_0x1bce3e){logger['error'](_0x5b68('0x6b'),JSON[_0x5b68('0x35')](_0x1bce3e));});}main(); \ No newline at end of file +var _0x20dc=['lodash','papaparse','ioredis','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','create','keys','then','push','pick','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','updatedAt','select','field','ContactId','NOW()','createdAt','from','cm_contacts','where','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','insert','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','cm_hopper_final','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','sequelize','query','VoiceQueueId','catch','onlyIfOpen','all','BlackLists','always','CampaignId','Campaign','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resume','resolve','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird'];(function(_0x26fbfd,_0x47f2c1){var _0x508968=function(_0x44f9dd){while(--_0x44f9dd){_0x26fbfd['push'](_0x26fbfd['shift']());}};_0x508968(++_0x47f2c1);}(_0x20dc,0x1b7));var _0xc20d=function(_0x4eac02,_0x5d2591){_0x4eac02=_0x4eac02-0x0;var _0xd8df4=_0x20dc[_0x4eac02];return _0xd8df4;};'use strict';var BPromise=require(_0xc20d('0x0'));var util=require('util');var _=require(_0xc20d('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xc20d('0x2'));var Redis=require(_0xc20d('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0xc20d('0x4'));var logger=require(_0xc20d('0x5'))(_0xc20d('0x6'));config['redis']=_[_0xc20d('0x7')](config[_0xc20d('0x8')],{'host':_0xc20d('0x9'),'port':0x18eb});var socket=require(_0xc20d('0xa'))(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0xc20d('0xb')](socket);try{if(!process[_0xc20d('0xc')][0x2]||process[_0xc20d('0xc')][0x2]===_0xc20d('0xd')||process[_0xc20d('0xc')][0x2]===_0xc20d('0xe')){throw new Error(_0xc20d('0xf'));}var FILEPATH=process[_0xc20d('0xc')][0x2];if(!process[_0xc20d('0xc')][0x3]||process['argv'][0x3]===_0xc20d('0xd')||process[_0xc20d('0xc')][0x3]==='null'||!process[_0xc20d('0xc')][0x4]||process[_0xc20d('0xc')][0x4]===_0xc20d('0xd')||process['argv'][0x4]===_0xc20d('0xe')){throw new Error(_0xc20d('0x10'));}var FIELDS=_[_0xc20d('0x11')](process[_0xc20d('0xc')][0x3][_0xc20d('0x12')](','),process[_0xc20d('0xc')][0x4][_0xc20d('0x12')](','));if(!process[_0xc20d('0xc')][0x5]||process['argv'][0x5]===_0xc20d('0xd')||process[_0xc20d('0xc')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xc20d('0xc')][0x6]&&process[_0xc20d('0xc')][0x6]!==_0xc20d('0xd')&&process[_0xc20d('0xc')][0x6]!==_0xc20d('0xe')?process['argv'][0x6]:null;var DUPLICATES=process[_0xc20d('0xc')][0x7]&&process[_0xc20d('0xc')][0x7]!==_0xc20d('0xd')&&process[_0xc20d('0xc')][0x7]!=='null'?process[_0xc20d('0xc')][0x7]:null;if(!process[_0xc20d('0xc')][0x8]||process['argv'][0x8]===_0xc20d('0xd')||process[_0xc20d('0xc')][0x8]===_0xc20d('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xc20d('0xc')][0x8];}catch(_0x56aa3c){logger[_0xc20d('0x13')](_0x56aa3c);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(_0x312c69,_0x570151,_0x226f60,_0x3773fb){var _0x441d07={'message':_0x570151};_0x441d07[_0x312c69]=!![];if(_0x226f60){_0x441d07[_0xc20d('0x14')]=_0x226f60;}if(_0x3773fb){_0x441d07[_0xc20d('0x15')]=_0x3773fb;}return _0x441d07;}function isEmail(_0x3fb630){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'](_0x3fb630);}function checkRow(_0x541a7b,_0x299554,_0x4921f5){return new BPromise(function(_0x455fc2,_0x2c2905){if(_['isNil'](_0x541a7b)){return _0x2c2905(handleCheckRowError(_0xc20d('0x13'),_0xc20d('0x16'),null,_0x4921f5));}if(_0x541a7b[_0xc20d('0x17')]&&_0x541a7b[_0xc20d('0x17')][_0xc20d('0x18')]){var _0x443cfd=_[_0xc20d('0x19')](_0x541a7b['errors'],_0xc20d('0x1a'))[_0xc20d('0x1b')](';');return _0x2c2905(handleCheckRowError('error',_0x443cfd,null,_0x4921f5));}var _0x17e5c9={};for(var _0x4d7180 in FIELDS){if(FIELDS[_0xc20d('0x1c')](_0x4d7180)&&FIELDS[_0x4d7180]){_0x17e5c9[_0x4d7180]=_0x541a7b['data'][0x0][FIELDS[_0x4d7180]]||_0x541a7b[_0xc20d('0x1d')][0x0]['\ufeff'+FIELDS[_0x4d7180]];}}if(!_0x17e5c9[_0xc20d('0x1e')]){return _0x2c2905(handleCheckRowError(_0xc20d('0x13'),_0xc20d('0x1f'),null,_0x4921f5));}if(!_0x17e5c9[_0xc20d('0x20')]){return _0x2c2905(handleCheckRowError('error',_0xc20d('0x21'),null,_0x4921f5));}if(_0x17e5c9['birthDate']){var _0x5ef65f=moment(_0x17e5c9[_0xc20d('0x22')],_0xc20d('0x23'));if(!_0x5ef65f[_0xc20d('0x24')]()){return _0x2c2905(handleCheckRowError(_0xc20d('0x13'),_0xc20d('0x25'),null,_0x4921f5));}}if(_0x17e5c9[_0xc20d('0x26')]){if(!isEmail(_0x17e5c9[_0xc20d('0x26')])){return _0x2c2905(handleCheckRowError(_0xc20d('0x13'),_0xc20d('0x27'),null,_0x4921f5));}}_0x17e5c9[_0xc20d('0x28')]=LISTID;_0x17e5c9[_0xc20d('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x299554){var _0x4fbe5a={};for(var _0x5c9bc7=0x0,_0x147a8c=DUPLICATES[_0xc20d('0x18')];_0x5c9bc7<_0x147a8c;_0x5c9bc7+=0x1){_0x4fbe5a[DUPLICATES[_0x5c9bc7]]=_0x17e5c9[DUPLICATES[_0x5c9bc7]];}var _0x12578f=_[_0xc20d('0x2a')](_0x299554,_0x4fbe5a);if(_0x12578f){return _0x2c2905(handleCheckRowError(_0xc20d('0x2b'),'Duplicate\x20Contact',_0x12578f,_0x4921f5));}}return db['CmContact'][_0xc20d('0x2c')](_0x17e5c9,{'raw':!![],'hooks':![],'fields':_[_0xc20d('0x2d')](_0x17e5c9)})[_0xc20d('0x2e')](function(_0x198a6d){if(DUPLICATES&&DUPLICATES[_0xc20d('0x18')]&&_0x299554){_0x299554[_0xc20d('0x2f')](_[_0xc20d('0x30')](_0x17e5c9,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x198a6d['id'];return _0x455fc2();})['catch'](function(_0x105485){return _0x2c2905(handleCheckRowError(_0xc20d('0x13'),'Error\x20while\x20creating\x20contact:\x20'+(_0x105485[_0xc20d('0x1a')]||JSON[_0xc20d('0x31')](_0x105485)),null,_0x4921f5));});});}function checkHopper(){function _0x2b9c5d(){return function(_0x38436d){logger[_0xc20d('0x13')](_0xc20d('0x32'),_0xc20d('0x33'),util[_0xc20d('0x34')](_0x38436d,{'showHidden':![],'depth':null}));};}var _0x5bb12f=function(_0x451627,_0x229c7f){var _0x529a34=squel['insert']()[_0xc20d('0x35')](_0xc20d('0x36'))[_0xc20d('0x37')]([_0xc20d('0x20'),_0xc20d('0x38'),'ContactId','ListId',_0x229c7f,'createdAt',_0xc20d('0x39')],squel[_0xc20d('0x3a')]()[_0xc20d('0x3b')](_0xc20d('0x20'),_0xc20d('0x20'))[_0xc20d('0x3b')]('NOW()',_0xc20d('0x38'))[_0xc20d('0x3b')]('id',_0xc20d('0x3c'))[_0xc20d('0x3b')](LISTID['toString'](),_0xc20d('0x28'))[_0xc20d('0x3b')](_0x451627['id']['toString'](),_0x229c7f)['field'](_0xc20d('0x3d'),_0xc20d('0x3e'))[_0xc20d('0x3b')]('NOW()',_0xc20d('0x39'))[_0xc20d('0x3f')](_0xc20d('0x40'))['where']('deletedAt\x20IS\x20NULL')[_0xc20d('0x41')](_0xc20d('0x42'),LISTID[_0xc20d('0x43')]())[_0xc20d('0x41')](_0xc20d('0x44'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xc20d('0x3a')]()['field'](_0xc20d('0x20'))[_0xc20d('0x3f')](_0xc20d('0x36'))['where'](_0x229c7f+_0xc20d('0x45'),_0x451627['id'][_0xc20d('0x43')]())))[_0xc20d('0x43')]();return _0x529a34;};var _0x5074a5=function(_0x4a05e5,_0x34279d){var _0x18821c=squel[_0xc20d('0x46')]()[_0xc20d('0x35')](_0xc20d('0x36'))[_0xc20d('0x37')](['phone',_0xc20d('0x38'),_0xc20d('0x3c'),_0xc20d('0x28'),_0x34279d,_0xc20d('0x3e'),_0xc20d('0x39')],squel[_0xc20d('0x3a')]()[_0xc20d('0x3b')](_0xc20d('0x20'),_0xc20d('0x20'))['field'](_0xc20d('0x3d'),_0xc20d('0x38'))[_0xc20d('0x3b')]('id',_0xc20d('0x3c'))['field'](LISTID[_0xc20d('0x43')](),_0xc20d('0x28'))[_0xc20d('0x3b')](_0x4a05e5['id']['toString'](),_0x34279d)[_0xc20d('0x3b')](_0xc20d('0x3d'),_0xc20d('0x3e'))[_0xc20d('0x3b')]('NOW()',_0xc20d('0x39'))[_0xc20d('0x3f')](_0xc20d('0x40'))[_0xc20d('0x41')](_0xc20d('0x47'))[_0xc20d('0x41')](_0xc20d('0x42'),LISTID[_0xc20d('0x43')]())[_0xc20d('0x41')](_0xc20d('0x48'),squel[_0xc20d('0x49')](hopperContacts))[_0xc20d('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0xc20d('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc20d('0x3a')]()[_0xc20d('0x3b')]('calleridnum')[_0xc20d('0x3f')](_0xc20d('0x4a'))[_0xc20d('0x41')](_0x34279d+'\x20=\x20?',_0x4a05e5['id']['toString']()))[_0xc20d('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xc20d('0x3b')]('phone')[_0xc20d('0x3f')](_0xc20d('0x36'))['where'](_0x34279d+_0xc20d('0x45'),_0x4a05e5['id'][_0xc20d('0x43')]())))[_0xc20d('0x43')]();return _0x18821c;};function _0x24de8e(_0x3d3186,_0x5006a7){var _0x35e610=squel[_0xc20d('0x46')]()['into']('cm_hopper')['fromQuery']([_0xc20d('0x20'),'scheduledAt',_0xc20d('0x3c'),_0xc20d('0x28'),_0x5006a7,_0xc20d('0x3e'),_0xc20d('0x39')],squel[_0xc20d('0x3a')]()['field'](_0xc20d('0x20'),_0xc20d('0x20'))[_0xc20d('0x3b')](_0xc20d('0x3d'),'scheduledAt')[_0xc20d('0x3b')]('id',_0xc20d('0x3c'))[_0xc20d('0x3b')](LISTID['toString'](),'ListId')[_0xc20d('0x3b')](_0x3d3186['id']['toString'](),_0x5006a7)[_0xc20d('0x3b')](_0xc20d('0x3d'),_0xc20d('0x3e'))[_0xc20d('0x3b')](_0xc20d('0x3d'),_0xc20d('0x39'))[_0xc20d('0x3f')](_0xc20d('0x40'))[_0xc20d('0x41')](_0xc20d('0x47'))[_0xc20d('0x41')](_0xc20d('0x42'),LISTID[_0xc20d('0x43')]())[_0xc20d('0x41')]('id\x20IN\x20?',squel[_0xc20d('0x49')](hopperContacts))[_0xc20d('0x41')](_0xc20d('0x44')))[_0xc20d('0x43')]();return _0x35e610;}function _0xfeb589(_0x4b4eb8,_0x48d1e3){var _0x428f88=squel['insert']()[_0xc20d('0x35')]('cm_hopper_black')[_0xc20d('0x37')](['phone',_0xc20d('0x3c'),_0xc20d('0x28'),_0x48d1e3,_0xc20d('0x3e'),_0xc20d('0x39')],squel['select']()['field'](_0xc20d('0x20'),_0xc20d('0x20'))[_0xc20d('0x3b')]('id',_0xc20d('0x3c'))[_0xc20d('0x3b')](LISTID[_0xc20d('0x43')](),_0xc20d('0x28'))[_0xc20d('0x3b')](_0x4b4eb8['id'][_0xc20d('0x43')](),_0x48d1e3)[_0xc20d('0x3b')](_0xc20d('0x3d'),_0xc20d('0x3e'))['field']('NOW()',_0xc20d('0x39'))[_0xc20d('0x3f')](_0xc20d('0x40'))[_0xc20d('0x41')](_0xc20d('0x47'))['where']('ListId\x20=\x20?',LISTID[_0xc20d('0x43')]())[_0xc20d('0x41')](_0xc20d('0x48'),squel[_0xc20d('0x49')](hopperContacts))['where'](_0xc20d('0x44')))[_0xc20d('0x43')]();return _0x428f88;}return db[_0xc20d('0x4b')][_0xc20d('0x4c')]({'where':{'type':_0xc20d('0x4d')},'attributes':['id',_0xc20d('0x4e')],'include':[{'model':db[_0xc20d('0x4f')],'as':_0xc20d('0x50'),'where':{'id':LISTID}}]})[_0xc20d('0x2e')](function(_0x2db133){var _0x123faa=[];if(_0x2db133){var _0x9c4fe7;for(var _0x427037=0x0,_0x9648cd;_0x427037<_0x2db133[_0xc20d('0x18')];_0x427037+=0x1){_0x9648cd=_0x2db133[_0x427037][_0xc20d('0x51')]({'plain':!![]});switch(_0x9648cd[_0xc20d('0x4e')]){case'always':_0x123faa[_0xc20d('0x2f')](db[_0xc20d('0x52')][_0xc20d('0x53')](_0x5074a5(_0x9648cd,_0xc20d('0x54')))['then'](function(){})[_0xc20d('0x55')](_0x2b9c5d()));break;case _0xc20d('0x56'):_0x123faa[_0xc20d('0x2f')](db[_0xc20d('0x52')]['query'](_0x5bb12f(_0x9648cd,_0xc20d('0x54')))[_0xc20d('0x2e')](function(){})[_0xc20d('0x55')](_0x2b9c5d()));break;default:_0x123faa[_0xc20d('0x2f')](db[_0xc20d('0x52')][_0xc20d('0x53')](_0x24de8e(_0x9648cd,_0xc20d('0x54')))[_0xc20d('0x2e')](function(){})[_0xc20d('0x55')](_0x2b9c5d()));}}}return _0x123faa;})[_0xc20d('0x57')]()[_0xc20d('0x2e')](function(){return db[_0xc20d('0x4b')][_0xc20d('0x4c')]({'where':{'type':_0xc20d('0x4d')},'attributes':['id'],'include':[{'model':db[_0xc20d('0x4f')],'as':_0xc20d('0x58'),'where':{'id':LISTID}}]})[_0xc20d('0x2e')](function(_0x2de5bd){var _0x3e810d=[];if(_0x2de5bd){var _0x235b16;for(var _0x18b9cd=0x0,_0x4dde7d;_0x18b9cd<_0x2de5bd[_0xc20d('0x18')];_0x18b9cd+=0x1){_0x4dde7d=_0x2de5bd[_0x18b9cd][_0xc20d('0x51')]({'plain':!![]});_0x3e810d[_0xc20d('0x2f')](db['sequelize'][_0xc20d('0x53')](_0xfeb589(_0x4dde7d,_0xc20d('0x54')))[_0xc20d('0x2e')](function(){})[_0xc20d('0x55')](_0x2b9c5d()));}}return _0x3e810d;})[_0xc20d('0x57')]();})[_0xc20d('0x2e')](function(){return db['Campaign'][_0xc20d('0x4c')]({'attributes':['id',_0xc20d('0x4e')],'include':[{'model':db[_0xc20d('0x4f')],'as':_0xc20d('0x50'),'where':{'id':LISTID}}]})[_0xc20d('0x2e')](function(_0x1c9ad3){var _0x45e54a=[];if(_0x1c9ad3){for(var _0x44a435=0x0,_0x58529f;_0x44a435<_0x1c9ad3[_0xc20d('0x18')];_0x44a435+=0x1){_0x58529f=_0x1c9ad3[_0x44a435][_0xc20d('0x51')]({'plain':!![]});switch(_0x58529f['dialCheckDuplicateType']){case _0xc20d('0x59'):_0x45e54a[_0xc20d('0x2f')](db[_0xc20d('0x52')][_0xc20d('0x53')](_0x5074a5(_0x58529f,_0xc20d('0x5a')))['then'](function(){})[_0xc20d('0x55')](_0x2b9c5d()));break;case _0xc20d('0x56'):_0x45e54a[_0xc20d('0x2f')](db[_0xc20d('0x52')]['query'](_0x5bb12f(_0x58529f,_0xc20d('0x5a')))[_0xc20d('0x2e')](function(){})[_0xc20d('0x55')](_0x2b9c5d()));break;default:_0x45e54a['push'](db['sequelize']['query'](_0x24de8e(_0x58529f,'CampaignId'))['then'](function(){})[_0xc20d('0x55')](_0x2b9c5d()));}}}return _0x45e54a;})[_0xc20d('0x57')]();})[_0xc20d('0x2e')](function(){return db[_0xc20d('0x5b')][_0xc20d('0x4c')]({'attributes':['id'],'include':[{'model':db[_0xc20d('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xc20d('0x2e')](function(_0x1b2ae2){var _0x38022f=[];if(_0x1b2ae2){for(var _0x3050b9=0x0,_0x21866a;_0x3050b9<_0x1b2ae2[_0xc20d('0x18')];_0x3050b9+=0x1){_0x21866a=_0x1b2ae2[_0x3050b9][_0xc20d('0x51')]({'plain':!![]});_0x38022f[_0xc20d('0x2f')](db[_0xc20d('0x52')][_0xc20d('0x53')](_0xfeb589(_0x21866a,'CampaignId'))[_0xc20d('0x2e')](function(){})[_0xc20d('0x55')](_0x2b9c5d()));}}return _0x38022f;})[_0xc20d('0x57')]();})['catch'](function(_0xe87ce){logger[_0xc20d('0x13')]('cmContact,\x20%s,\x20%s',_0xc20d('0x5c'),_0xe87ce['message']);});}var processPromises=function(_0x360031){return BPromise[_0xc20d('0x57')](promises)[_0xc20d('0x2e')](function(_0x47e36b){})[_0xc20d('0x55')](function(_0x2e41c7){logger[_0xc20d('0x13')](_0xc20d('0x5d'),JSON[_0xc20d('0x31')](_0x2e41c7));})[_0xc20d('0x5e')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x360031){return _0x360031[_0xc20d('0x5f')]();}});};var endCsv=function(){return BPromise[_0xc20d('0x60')]()[_0xc20d('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0xc20d('0x2e')](function(){socket[_0xc20d('0x61')](_0xc20d('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc20d('0x63')](FILEPATH);}catch(_0x661f66){logger[_0xc20d('0x13')](_0xc20d('0x64'),JSON[_0xc20d('0x31')](_0x661f66));}finally{process[_0xc20d('0x65')](0x0);}});};process['on'](_0xc20d('0x66'),function(){logger[_0xc20d('0x67')](_0xc20d('0x68'));endCsv();});function main(){return BPromise[_0xc20d('0x60')]()[_0xc20d('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xc20d('0x12')](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xc20d('0x2e')](function(_0x3dab8a){var _0x56bfef=fs[_0xc20d('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc20d('0x6a')](_0x56bfef,{'header':!![],'skipEmptyLines':!![],'step':function(_0x49d427,_0x412268){total+=0x1;var _0x3948a9=total;promises['push'](checkRow(_0x49d427,_0x3dab8a,_0x3948a9)['then'](function(){success+=0x1;})[_0xc20d('0x55')](function(_0x1f441c){if(_0x1f441c[_0xc20d('0x13')]){errors+=0x1;delete _0x1f441c[_0xc20d('0x13')];}else if(_0x1f441c[_0xc20d('0x2b')]){duplicates+=0x1;delete _0x1f441c[_0xc20d('0x2b')];}rows[_0xc20d('0x2f')](_0x1f441c);}));if(total%0xc8===0x0){_0x412268['pause']();return processPromises(_0x412268);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0xc20d('0x6b'));endCsv();});},'error':function(_0x10f902,_0x12f43b){logger[_0xc20d('0x67')](_0xc20d('0x6c'),JSON[_0xc20d('0x31')](_0x10f902));endCsv();}});})['catch'](function(_0x420102){logger[_0xc20d('0x13')](_0xc20d('0x6d'),JSON['stringify'](_0x420102));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index a429348..d871adb 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 _0x4891=['ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','parse','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','.CmListId','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.ListId','cm_contacts.ListId\x20=\x20','\x22always\x22','ListId\x20=\x20?','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','error','exit','errors','push','code','message','sequelize','query','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','length','all','then','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','.csv',',utcOffset','writeFileSync','createReadStream','rows','data','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory'];(function(_0x1ea7b1,_0x16a2db){var _0x120b7e=function(_0x4cd973){while(--_0x4cd973){_0x1ea7b1['push'](_0x1ea7b1['shift']());}};_0x120b7e(++_0x16a2db);}(_0x4891,0x14d));var _0x1489=function(_0x54ebe2,_0x46ca92){_0x54ebe2=_0x54ebe2-0x0;var _0x10367d=_0x4891[_0x54ebe2];return _0x10367d;};'use strict';var fs=require('fs');var path=require(_0x1489('0x0'));var _=require(_0x1489('0x1'));var Papa=require(_0x1489('0x2'));var util=require(_0x1489('0x3'));var BPromise=require(_0x1489('0x4'));var moment=require(_0x1489('0x5'));var squel=require(_0x1489('0x6'));var Redis=require('ioredis');var db=require(_0x1489('0x7'))['db'];var config=require(_0x1489('0x8'));var shared=require(_0x1489('0x9'));var logger=require('../../../config/logger')(_0x1489('0xa'));config['redis']=_[_0x1489('0xb')](config[_0x1489('0xc')],{'host':_0x1489('0xd'),'port':0x18eb});var socket=require(_0x1489('0xe'))(new Redis(config[_0x1489('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x1489('0xf')](_0x1489('0x10'));function isEmail(_0x1e94e7){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))*$/[_0x1489('0x11')](_0x1e94e7);}function selectNotIn(_0x292fbe,_0x3bdb13,_0x18f08e,_0x405299,_0xb73be7){return squel[_0x1489('0x12')]()[_0x1489('0x13')](_0x1489('0x14'))['from'](_0x405299)['join'](_0x3bdb13,null,_0x3bdb13+_0x1489('0x15')+_0x405299+'.'+_0x18f08e)[_0x1489('0x16')](_0x405299+'.'+_0x18f08e+_0x1489('0x17')+_0x292fbe+'.'+_0x18f08e)['where'](_0x3bdb13+_0x1489('0x18')+_0xb73be7[_0x1489('0x19')]()+')');}function insertCmHopper(_0xf75e40,_0x5ceddc,_0x1562a5,_0x4c846a,_0x18d1a7){var _0x53dd87=[_0x1489('0x1a'),_0x1489('0x1b'),_0x1489('0x1c'),'cm_contacts.ListId',_0x5ceddc+'.'+_0x4c846a,'cm_contacts.createdAt',_0x1489('0x1d'),_0x1489('0x1e'),_0x1489('0x1f'),'\x22'+_0x18d1a7+'\x22'];return squel[_0x1489('0x20')]()[_0x1489('0x21')](_0x1489('0x22'))[_0x1489('0x23')]([_0x1489('0x14'),_0x1489('0x24'),_0x1489('0x25'),_0x1489('0x26'),_0x4c846a,_0x1489('0x27'),_0x1489('0x28'),_0x1489('0x29'),_0x1489('0x2a'),_0x1489('0x2b')],squel[_0x1489('0x12')]()[_0x1489('0x2c')](_0x53dd87)[_0x1489('0x2d')](_0x5ceddc)[_0x1489('0x19')](_0x1489('0x2e'),null,'cm_contacts.ListId\x20=\x20'+_0x5ceddc+'.CmListId')['join'](_0x1562a5,null,_0x1562a5+_0x1489('0x15')+_0x5ceddc+'.'+_0x4c846a)['where'](_0x5ceddc+_0x1489('0x2f'),_0xf75e40)['where'](_0x1489('0x30'),NOW)[_0x1489('0x16')](_0x1489('0x31'),selectNotIn(_0x5ceddc,_0x1562a5,_0x4c846a,_0x1489('0x22'),['\x22always\x22',_0x1489('0x32')]))[_0x1489('0x16')](_0x1489('0x31'),selectNotIn(_0x5ceddc,_0x1562a5,_0x4c846a,_0x1489('0x22'),['\x22always\x22'])))[_0x1489('0x33')]();}function insertCmHopperBlack(_0x493cac,_0x5f28ed,_0x386aac,_0x58a612){var _0x55de9e=[_0x1489('0x1a'),_0x1489('0x1c'),'cm_contacts.ListId',_0x5f28ed+'.'+_0x58a612,_0x1489('0x34'),'cm_contacts.updatedAt'];return squel['insert']()[_0x1489('0x21')](_0x1489('0x35'))[_0x1489('0x23')]([_0x1489('0x14'),_0x1489('0x25'),_0x1489('0x26'),_0x58a612,_0x1489('0x27'),'updatedAt'],squel[_0x1489('0x12')]()[_0x1489('0x2c')](_0x55de9e)[_0x1489('0x2d')](_0x5f28ed)[_0x1489('0x19')](_0x1489('0x2e'),null,'cm_contacts.ListId\x20=\x20'+_0x5f28ed+_0x1489('0x36'))[_0x1489('0x19')](_0x386aac,null,_0x386aac+'.id\x20=\x20'+_0x5f28ed+'.'+_0x58a612)[_0x1489('0x16')](_0x5f28ed+'.CmListId\x20=\x20?',_0x493cac)[_0x1489('0x16')](_0x1489('0x30'),NOW)[_0x1489('0x16')](_0x1489('0x31'),squel[_0x1489('0x12')]()[_0x1489('0x13')](_0x1489('0x14'))[_0x1489('0x2d')](_0x1489('0x35'))[_0x1489('0x16')]('ListId\x20=\x20?',_0x493cac)[_0x1489('0x16')](_0x58a612+_0x1489('0x37'),_0x5f28ed+'.'+_0x58a612)))[_0x1489('0x33')]();}function insertTzCmHopper(_0x5a8229,_0x5b5401,_0x5ee137,_0x57ac11,_0x5f4e07,_0x5f4eaf){var _0x25a9e6=[_0x1489('0x1a'),_0x1489('0x38')+_0x5f4eaf+_0x1489('0x39'),_0x1489('0x1c'),_0x1489('0x3a'),_0x5b5401+'.'+_0x57ac11,'cm_contacts.createdAt',_0x1489('0x1d'),_0x1489('0x1e'),_0x1489('0x1f'),'\x22'+_0x5f4e07+'\x22'];var _0x287ce8=squel['insert']()[_0x1489('0x21')]('cm_hopper')[_0x1489('0x23')](['phone',_0x1489('0x24'),'ContactId',_0x1489('0x26'),_0x57ac11,_0x1489('0x27'),_0x1489('0x28'),_0x1489('0x29'),'UserId',_0x1489('0x2b')],squel['select']()[_0x1489('0x2c')](_0x25a9e6)[_0x1489('0x2d')](_0x5b5401)['join'](_0x1489('0x2e'),null,_0x1489('0x3b')+_0x5b5401+'.CmListId')[_0x1489('0x19')](_0x5ee137,null,_0x5ee137+_0x1489('0x15')+_0x5b5401+'.'+_0x57ac11)[_0x1489('0x19')](_0x5f4eaf,null,_0x5f4eaf+'.id\x20=\x20'+_0x5b5401+'.'+_0x57ac11)[_0x1489('0x16')](_0x5b5401+_0x1489('0x2f'),_0x5a8229)[_0x1489('0x16')](_0x1489('0x30'),NOW)[_0x1489('0x16')](_0x1489('0x31'),selectNotIn(_0x5b5401,_0x5ee137,_0x57ac11,_0x1489('0x22'),[_0x1489('0x3c'),_0x1489('0x32')]))['where'](_0x1489('0x31'),selectNotIn(_0x5b5401,_0x5ee137,_0x57ac11,_0x1489('0x22'),['\x22always\x22'])))[_0x1489('0x33')]();return _0x287ce8;}function insertTzCmHopperBlack(_0xce289d,_0x1d0845,_0x57b9eb,_0x59e40d){var _0x24174a=[_0x1489('0x1a'),_0x1489('0x1c'),_0x1489('0x3a'),_0x1d0845+'.'+_0x59e40d,_0x1489('0x34'),_0x1489('0x1d')];return squel[_0x1489('0x20')]()[_0x1489('0x21')]('cm_hopper_black')['fromQuery']([_0x1489('0x14'),'ContactId',_0x1489('0x26'),_0x59e40d,_0x1489('0x27'),_0x1489('0x28')],squel['select']()[_0x1489('0x2c')](_0x24174a)['from'](_0x1d0845)[_0x1489('0x19')](_0x1489('0x2e'),null,_0x1489('0x3b')+_0x1d0845+_0x1489('0x36'))[_0x1489('0x19')](_0x57b9eb,null,_0x57b9eb+_0x1489('0x15')+_0x1d0845+'.'+_0x59e40d)[_0x1489('0x16')](_0x1d0845+'.CmListId\x20=\x20?',_0xce289d)[_0x1489('0x16')](_0x1489('0x30'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x1489('0x12')]()[_0x1489('0x13')]('phone')[_0x1489('0x2d')](_0x1489('0x35'))['where'](_0x1489('0x3d'),_0xce289d)[_0x1489('0x16')](_0x59e40d+_0x1489('0x37'),_0x1d0845+'.'+_0x59e40d)))[_0x1489('0x33')]();}function insertCmContact(_0x356119,_0x381aa1,_0x4d8342,_0x256f30){var _0x1bba62=_['concat'](_[_0x1489('0x3e')](_0x256f30),[_0x1489('0x26'),'CompanyId','createdAt',_0x1489('0x28')]);return squel[_0x1489('0x20')]()[_0x1489('0x21')]('cm_contacts')[_0x1489('0x23')](_0x1bba62,squel[_0x1489('0x12')]()[_0x1489('0x2c')](_0x1bba62)['from'](_0x381aa1)['where']('('+_0x4d8342['join'](',')+_0x1489('0x3f'),squel[_0x1489('0x12')]()[_0x1489('0x2c')](_0x4d8342)['from'](_0x1489('0x2e'))[_0x1489('0x16')](_0x1489('0x3d'),_0x356119)[_0x1489('0x16')](_0x1489('0x40')))[_0x1489('0x16')](_0x1489('0x41'),squel['select']()[_0x1489('0x13')](_0x1489('0x42'),'min_id')[_0x1489('0x2d')](_0x381aa1)['group'](_0x4d8342[_0x1489('0x19')](','))))[_0x1489('0x33')]();}function handleStop(){logger[_0x1489('0x43')](_0x1489('0x44'));stopped=!![];}function handleUncaughtException(_0x229498){logger[_0x1489('0x45')](_0x229498['message']);process[_0x1489('0x46')](0x1);}function handleError(_0x49c0c5,_0x250a45){stats[_0x1489('0x47')][_0x1489('0x48')]({'name':_0x250a45[_0x1489('0x49')],'message':_0x250a45[_0x1489('0x4a')],'row':_0x49c0c5});}function handleQuery(_0x182166){logger[_0x1489('0x43')](_0x182166);return db[_0x1489('0x4b')][_0x1489('0x4c')](_0x182166)['spread'](function(_0x318eaf){results[_0x1489('0x48')](_0x318eaf);})[_0x1489('0x4d')](function(_0x413ff6){logger['error'](_0x413ff6[_0x1489('0x4a')]);});}function updateTzCampaigns(_0x5918ed){return new Promise(function(_0x1bc346,_0x49748b){var _0x5896e6=squel[_0x1489('0x12')]()['fields']([_0x1489('0x4e'),_0x1489('0x4f')])[_0x1489('0x2d')](_0x1489('0x50'))[_0x1489('0x19')](_0x1489('0x51'),null,_0x1489('0x52'))['where'](_0x1489('0x53')+_0x5918ed);db[_0x1489('0x4b')][_0x1489('0x4c')](_0x5896e6[_0x1489('0x33')]())[_0x1489('0x54')](function(_0x4b1708){var _0x528667=[];for(var _0x5a972e=0x0;_0x5a972e<_0x4b1708[_0x1489('0x55')];_0x5a972e++){_0x528667[_0x1489('0x48')](getTimezoneData(_0x4b1708[_0x5a972e],tmp_campaigns));}BPromise[_0x1489('0x56')](_0x528667)[_0x1489('0x57')](function(){_0x1bc346({'val':0x1});});})[_0x1489('0x4d')](function(_0x557dc8){logger[_0x1489('0x45')](_0x557dc8[_0x1489('0x4a')]);_0x1bc346({'val':0x0});});});}function updateTzVoiceQueues(_0x59bcec){return new Promise(function(_0xf62947,_0x2907fc){var _0x565cf7=squel['select']()['fields']([_0x1489('0x58'),_0x1489('0x59')])[_0x1489('0x2d')](_0x1489('0x5a'))[_0x1489('0x19')]('voice_queues_has_cm_lists',null,_0x1489('0x5b'))[_0x1489('0x16')](_0x1489('0x5c')+_0x59bcec);db['sequelize']['query'](_0x565cf7[_0x1489('0x33')]())['spread'](function(_0x8de54c){var _0x3aea02=[];for(var _0x374a0a=0x0;_0x374a0a<_0x8de54c[_0x1489('0x55')];_0x374a0a++){_0x3aea02[_0x1489('0x48')](getTimezoneData(_0x8de54c[_0x374a0a],tmp_voice_queues));}BPromise[_0x1489('0x56')](_0x3aea02)[_0x1489('0x57')](function(){_0xf62947({'val':0x1});});})['catch'](function(_0x27bed6){logger[_0x1489('0x45')](_0x27bed6[_0x1489('0x4a')]);_0xf62947({'val':0x0});});});}function getTimezoneData(_0x3cbb41,_0x6b4c31){return new Promise(function(_0x2a856e,_0xc06ea4){var _0x10e704=shared['timezones'];var _0x491486=_0x10e704[_0x3cbb41[_0x1489('0x5d')]];if(_[_0x1489('0x5e')](_0x491486)){_0x2a856e({'ret':0x1});}else{var _0x4f8552=_0x491486[_0x1489('0x5f')];var _0x1310fa=squel['insert']()[_0x1489('0x21')](_0x6b4c31)[_0x1489('0x60')]('id',_0x3cbb41['id'])[_0x1489('0x60')](_0x1489('0x61'),_0x4f8552)[_0x1489('0x60')](_0x1489('0x5d'),_0x3cbb41[_0x1489('0x5d')])['toString']();return db[_0x1489('0x4b')][_0x1489('0x4c')](_0x1310fa)[_0x1489('0x54')](function(_0x391df1){_0x2a856e({'ret':0x1});})[_0x1489('0x4d')](function(_0x2e6230){logger[_0x1489('0x45')](_0x2e6230[_0x1489('0x4a')]);_0xc06ea4({'ret':0x1});});}});}function handleTZQuery(_0x7a417f){logger[_0x1489('0x43')](_0x7a417f);return db[_0x1489('0x4b')][_0x1489('0x4c')](_0x7a417f)[_0x1489('0x54')](function(_0x35fb87){})[_0x1489('0x4d')](function(_0x3bf294){logger[_0x1489('0x45')](_0x3bf294['message']);});}function main(_0x1269cf,_0x1d24de,_0x478d21,_0x52a343){logger['info'](_0x1489('0x62'),_0x1269cf,JSON[_0x1489('0x63')](_0x1d24de));process[_0x1489('0x64')](_0x1489('0x65'));var _0x5354b5=_0x1d24de[_0x1489('0x66')];var _0x3615db=_0x1d24de[_0x1489('0x67')];var _0x2bd9f1=path['join'](config[_0x1489('0x68')],'server/files/tmp',_0x3615db+_0x1489('0x69'));hasTZ=_['keys'](_0x5354b5)['includes'](_0x1489('0x5d'));var _0x359740=_['keys'](_0x5354b5)['join']();logger[_0x1489('0x43')]('header',_0x359740);if(hasTZ)_0x359740+=_0x1489('0x6a');fs[_0x1489('0x6b')](_0x2bd9f1,_0x359740+'\x0a');Papa['parse'](fs[_0x1489('0x6c')](_0x1269cf),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2ca6d1,_0x5b552f){try{for(var _0x21aa14=0x0,_0x2094bc=[];_0x21aa14<_0x2ca6d1['data'][_0x1489('0x55')];_0x21aa14++){stats[_0x1489('0x6d')]+=0x1;if(_0x2ca6d1['errors'][_0x21aa14]){handleError(_0x2ca6d1[_0x1489('0x6e')][_0x21aa14],_0x2ca6d1[_0x1489('0x47')][_0x21aa14]);}else{var _0x4a2920=[];for(var _0x512fcc in _0x5354b5){if(_0x5354b5[_0x1489('0x6f')](_0x512fcc)){if(_0x2ca6d1['data'][_0x21aa14][_0x5354b5[_0x512fcc]]){var _0x2ecf93=_['trim'](_0x2ca6d1[_0x1489('0x6e')][_0x21aa14][_0x5354b5[_0x512fcc]][_0x1489('0x70')](/"/g,'\x27'));switch(_0x512fcc){case'scheduledat':var _0x149f43=moment(_0x2ecf93,_0x1489('0x10'),!![]);if(_0x149f43[_0x1489('0x71')]()){_0x2094bc[_0x1489('0x48')]('\x22'+_0x2ecf93+'\x22');}else{_0x4a2920['push'](_0x1489('0x72'));}break;case _0x1489('0x29'):var _0x44c96f=parseInt(_0x2ecf93);_0x2ecf93=_[_0x1489('0x73')](_0x44c96f)||_0x44c96f<0x0||_0x44c96f>0x4?_0x52a343?0x3:0x2:_0x44c96f;_0x2094bc[_0x1489('0x48')]('\x22'+_0x2ecf93+'\x22');break;case _0x1489('0x2a'):var _0x21c025=parseInt(_0x2ecf93);if(_['isNumber'](_0x21c025)&&_[_0x1489('0x74')](_0x478d21,_0x21c025)){_0x2094bc['push']('\x22'+_0x21c025+'\x22');}else{_0x4a2920[_0x1489('0x48')](_0x1489('0x75'));}break;case _0x1489('0x76'):if(isEmail(_0x2ecf93)){_0x2094bc[_0x1489('0x48')]('\x22'+_0x2ecf93+'\x22');}else{_0x4a2920[_0x1489('0x48')](_0x1489('0x77'));}break;case'dateOfBirth':var _0x5c6a6b=moment(_0x2ecf93,_0x1489('0x78'),!![]);if(_0x5c6a6b[_0x1489('0x71')]()){_0x2094bc[_0x1489('0x48')]('\x22'+_0x2ecf93+'\x22');}else{_0x4a2920[_0x1489('0x48')](_0x1489('0x79'));}break;case _0x1489('0x5d'):var _0x260ccf=shared[_0x1489('0x7a')];var _0x270639=_0x260ccf[_0x2ecf93];if(!_['isNil'](_0x270639)){var _0x13dfa5=_0x270639[_0x1489('0x5f')];_0x2094bc['push']('\x22'+_0x2ecf93+'\x22');_0x2094bc['push']('\x22'+_0x13dfa5+'\x22');}break;default:_0x2094bc[_0x1489('0x48')]('\x22'+_0x2ecf93+'\x22');}}else{switch(_0x512fcc){case _0x1489('0x7b'):case _0x1489('0x14'):_0x4a2920[_0x1489('0x48')](_0x512fcc+'\x20not\x20specified');break;default:_0x2094bc[_0x1489('0x48')]('\x22\x22');}}}}if(_0x4a2920[_0x1489('0x55')]){handleError(_0x2ca6d1[_0x1489('0x6e')][_0x21aa14],{'code':_0x1489('0x7c'),'message':_0x4a2920[_0x1489('0x19')]()});}else{fs[_0x1489('0x7d')](_0x2bd9f1,_0x2094bc[_0x1489('0x19')]()+'\x0a');}_0x2094bc=[];}if(!(stats['rows']%0xc8)){socket[_0x1489('0x7e')]('contact:import:'+_0x3615db,stats);stats[_0x1489('0x47')]=[];}}if(stopped){logger['info'](_0x1489('0x7f'));_0x5b552f[_0x1489('0x80')]();}}catch(_0x47b974){handleError(_0x2ca6d1[_0x1489('0x6e')][_0x21aa14],{'code':_0x1489('0x81'),'message':_0x47b974[_0x1489('0x4a')]});logger[_0x1489('0x45')]('step',_0x47b974['message']);}},'complete':function(){try{var _0xbddb70=[];var _0xf3bf93=[];var _0x754b8e=_0x1489('0x2e');if(_0x1d24de[_0x1489('0x82')]&&_0x1d24de[_0x1489('0x82')]['length']){_0x754b8e=_0x1489('0x83')+_0x3615db;_0xbddb70[_0x1489('0x48')](_0x1489('0x84')+_0x754b8e+_0x1489('0x85'));}tmp_campaigns=_0x1489('0x86')+_0x3615db;tmp_voice_queues='voice_queues_'+_0x3615db;_0xf3bf93[_0x1489('0x48')](_0x1489('0x84')+tmp_campaigns+_0x1489('0x87'));_0xf3bf93[_0x1489('0x48')](_0x1489('0x84')+tmp_voice_queues+_0x1489('0x87'));BPromise[_0x1489('0x88')](_0xf3bf93,handleTZQuery)[_0x1489('0x57')](function(_0x3d7c70){updateTzCampaigns(_0x1d24de[_0x1489('0x26')])['then'](function(_0x1347df){updateTzVoiceQueues(_0x1d24de[_0x1489('0x26')])[_0x1489('0x57')](function(_0x500342){var _0x10cb8b=util[_0x1489('0xf')](_0x1489('0x89'),_0x2bd9f1,_0x754b8e,_0x359740,_0x1d24de[_0x1489('0x26')],_0x1d24de[_0x1489('0x8a')]||null,NOW,NOW);if(_[_0x1489('0x5e')](_0x5354b5[_0x1489('0x24')])){_0x10cb8b+=',\x20scheduledAt\x20=\x20NOW()';}_0xbddb70[_0x1489('0x48')](_0x10cb8b);if(_0x1d24de[_0x1489('0x82')]&&_0x1d24de['duplicates'][_0x1489('0x55')]){_0xbddb70[_0x1489('0x48')](insertCmContact(_0x1d24de[_0x1489('0x26')],_0x754b8e,_0x1d24de[_0x1489('0x82')],_0x5354b5));_0xbddb70[_0x1489('0x48')](_0x1489('0x8b')+_0x754b8e+';');}if(hasTZ){_0xbddb70['push'](insertTzCmHopper(_0x1d24de['ListId'],_0x1489('0x8c'),_0x1489('0x5a'),'VoiceQueueId',_0x52a343,tmp_voice_queues));_0xbddb70[_0x1489('0x48')](insertTzCmHopperBlack(_0x1d24de[_0x1489('0x26')],_0x1489('0x8d'),_0x1489('0x5a'),_0x1489('0x8e')));_0xbddb70[_0x1489('0x48')](insertTzCmHopper(_0x1d24de['ListId'],_0x1489('0x51'),'campaigns',_0x1489('0x8f'),_0x52a343,tmp_campaigns));_0xbddb70[_0x1489('0x48')](insertTzCmHopperBlack(_0x1d24de['ListId'],_0x1489('0x90'),'campaigns',_0x1489('0x8f')));}else{_0xbddb70['push'](insertCmHopper(_0x1d24de[_0x1489('0x26')],_0x1489('0x8c'),_0x1489('0x5a'),_0x1489('0x8e'),_0x52a343));_0xbddb70[_0x1489('0x48')](insertCmHopperBlack(_0x1d24de['ListId'],_0x1489('0x8d'),_0x1489('0x5a'),_0x1489('0x8e')));_0xbddb70[_0x1489('0x48')](insertCmHopper(_0x1d24de['ListId'],_0x1489('0x51'),'campaigns','CampaignId',_0x52a343));_0xbddb70[_0x1489('0x48')](insertCmHopperBlack(_0x1d24de[_0x1489('0x26')],_0x1489('0x90'),_0x1489('0x50'),_0x1489('0x8f')));}_0xbddb70[_0x1489('0x48')](_0x1489('0x8b')+tmp_campaigns+';');_0xbddb70['push'](_0x1489('0x8b')+tmp_voice_queues+';');BPromise[_0x1489('0x88')](_0xbddb70,handleQuery)['then'](function(_0xa5e191){stats[_0x1489('0x91')]=!![];stats[_0x1489('0x92')]=_0x1d24de[_0x1489('0x82')]&&_0x1d24de[_0x1489('0x82')][_0x1489('0x55')]?results[0x2][_0x1489('0x92')]:results[0x0]['affectedRows'];socket[_0x1489('0x7e')]('contact:import:'+_0x3615db,stats);fs[_0x1489('0x93')](_0x1269cf);fs['unlink'](_0x2bd9f1);process[_0x1489('0x46')](0x0);})[_0x1489('0x4d')](function(_0x24851f){logger[_0x1489('0x45')](_0x24851f['message']);process['exit'](0x1);});});});});}catch(_0x17d872){logger[_0x1489('0x45')](_0x1489('0x94'),_0x17d872[_0x1489('0x4a')]);process[_0x1489('0x46')](0x1);}},'error':function(_0x2a76bc,_0x43db65,_0x562c44,_0x2f98a2){throw new Error(_0x2f98a2);}});}function validate(){if(process[_0x1489('0x95')]&&process['argv'][_0x1489('0x55')]<0x4){throw new Error(_0x1489('0x96'));}var _0x4441d4=path['join'](config[_0x1489('0x68')],_0x1489('0x97'),process[_0x1489('0x95')][0x2]);if(!fs[_0x1489('0x98')](_0x4441d4)){throw new Error(_0x1489('0x99'));}var _0x5c41e4={};try{_0x5c41e4=JSON['parse'](process[_0x1489('0x95')][0x3]);if(!_0x5c41e4[_0x1489('0x66')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x5c41e4[_0x1489('0x66')]['phone']){throw new Error(_0x1489('0x9a'));}if(!_0x5c41e4[_0x1489('0x66')]['firstName']){throw new Error(_0x1489('0x9b'));}var _0x235d50=0x0;if(_0x5c41e4[_0x1489('0x66')][_0x1489('0x2a')]){_0x235d50=0x1;}if(!_0x5c41e4[_0x1489('0x26')]){throw new Error(_0x1489('0x9c'));}}catch(_0x37b305){throw new Error(_0x1489('0x9d'));}var _0x27e509=[];try{_0x27e509=_[_0x1489('0x9e')](JSON[_0x1489('0x9f')](process['argv'][0x4]),'id');}catch(_0x40b6b2){logger[_0x1489('0x43')](_0x1489('0xa0'));}main(_0x4441d4,_0x5c41e4,_0x27e509,_0x235d50);}validate();process['on'](_0x1489('0xa1'),handleStop);process['on'](_0x1489('0xa2'),handleUncaughtException); \ No newline at end of file +var _0x4ed1=['phone','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','fromQuery','field','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','.CmListId\x20=\x20?','ListId\x20=\x20?','concat',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','exit','errors','push','code','message','sequelize','query','spread','catch','error','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','voice_queues.id','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','all','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','keys','header','writeFileSync','parse','createReadStream','rows','data','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select'];(function(_0x20e7bc,_0x3ba76b){var _0x519cab=function(_0x4e6e69){while(--_0x4e6e69){_0x20e7bc['push'](_0x20e7bc['shift']());}};_0x519cab(++_0x3ba76b);}(_0x4ed1,0x8f));var _0x14ed=function(_0xc0f5d8,_0x3e09a2){_0xc0f5d8=_0xc0f5d8-0x0;var _0x238c69=_0x4ed1[_0xc0f5d8];return _0x238c69;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x14ed('0x0'));var Papa=require(_0x14ed('0x1'));var util=require(_0x14ed('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x14ed('0x3'));var Redis=require(_0x14ed('0x4'));var db=require(_0x14ed('0x5'))['db'];var config=require(_0x14ed('0x6'));var shared=require(_0x14ed('0x7'));var logger=require('../../../config/logger')('import');config[_0x14ed('0x8')]=_['defaults'](config[_0x14ed('0x8')],{'host':_0x14ed('0x9'),'port':0x18eb});var socket=require(_0x14ed('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x14ed('0xb')](_0x14ed('0xc'));function isEmail(_0x350a0d){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))*$/[_0x14ed('0xd')](_0x350a0d);}function selectNotIn(_0x3de3ba,_0x247bc3,_0x41f650,_0x4d28f4,_0x348bcc){return squel[_0x14ed('0xe')]()['field'](_0x14ed('0xf'))['from'](_0x4d28f4)[_0x14ed('0x10')](_0x247bc3,null,_0x247bc3+_0x14ed('0x11')+_0x4d28f4+'.'+_0x41f650)[_0x14ed('0x12')](_0x4d28f4+'.'+_0x41f650+'\x20=\x20'+_0x3de3ba+'.'+_0x41f650)[_0x14ed('0x12')](_0x247bc3+_0x14ed('0x13')+_0x348bcc['join']()+')');}function insertCmHopper(_0x36b9da,_0x44a273,_0x247ebe,_0x1c3065,_0x3ffcac){var _0x8843d1=[_0x14ed('0x14'),_0x14ed('0x15'),_0x14ed('0x16'),_0x14ed('0x17'),_0x44a273+'.'+_0x1c3065,_0x14ed('0x18'),_0x14ed('0x19'),_0x14ed('0x1a'),_0x14ed('0x1b'),'\x22'+_0x3ffcac+'\x22'];return squel[_0x14ed('0x1c')]()[_0x14ed('0x1d')](_0x14ed('0x1e'))['fromQuery'](['phone',_0x14ed('0x1f'),_0x14ed('0x20'),_0x14ed('0x21'),_0x1c3065,_0x14ed('0x22'),_0x14ed('0x23'),_0x14ed('0x24'),_0x14ed('0x25'),_0x14ed('0x26')],squel[_0x14ed('0xe')]()[_0x14ed('0x27')](_0x8843d1)[_0x14ed('0x28')](_0x44a273)[_0x14ed('0x10')](_0x14ed('0x29'),null,_0x14ed('0x2a')+_0x44a273+_0x14ed('0x2b'))[_0x14ed('0x10')](_0x247ebe,null,_0x247ebe+_0x14ed('0x11')+_0x44a273+'.'+_0x1c3065)[_0x14ed('0x12')](_0x44a273+'.CmListId\x20=\x20?',_0x36b9da)['where'](_0x14ed('0x2c'),NOW)['where'](_0x14ed('0x2d'),selectNotIn(_0x44a273,_0x247ebe,_0x1c3065,'cm_hopper',[_0x14ed('0x2e'),_0x14ed('0x2f')]))[_0x14ed('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x44a273,_0x247ebe,_0x1c3065,_0x14ed('0x1e'),[_0x14ed('0x2e')])))[_0x14ed('0x30')]();}function insertCmHopperBlack(_0x44344d,_0x165c2d,_0x3c112b,_0x4f4224){var _0x304c75=[_0x14ed('0x14'),_0x14ed('0x16'),_0x14ed('0x17'),_0x165c2d+'.'+_0x4f4224,'cm_contacts.createdAt',_0x14ed('0x19')];return squel['insert']()[_0x14ed('0x1d')](_0x14ed('0x31'))[_0x14ed('0x32')]([_0x14ed('0xf'),_0x14ed('0x20'),'ListId',_0x4f4224,_0x14ed('0x22'),_0x14ed('0x23')],squel[_0x14ed('0xe')]()['fields'](_0x304c75)[_0x14ed('0x28')](_0x165c2d)[_0x14ed('0x10')]('cm_contacts',null,_0x14ed('0x2a')+_0x165c2d+_0x14ed('0x2b'))['join'](_0x3c112b,null,_0x3c112b+_0x14ed('0x11')+_0x165c2d+'.'+_0x4f4224)[_0x14ed('0x12')](_0x165c2d+'.CmListId\x20=\x20?',_0x44344d)[_0x14ed('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x14ed('0x2d'),squel['select']()[_0x14ed('0x33')](_0x14ed('0xf'))['from'](_0x14ed('0x31'))['where']('ListId\x20=\x20?',_0x44344d)['where'](_0x4f4224+_0x14ed('0x34'),_0x165c2d+'.'+_0x4f4224)))[_0x14ed('0x30')]();}function insertTzCmHopper(_0x1552b9,_0x17f07b,_0x577076,_0x3500d7,_0x2af543,_0xe2c021){var _0x5b5bba=[_0x14ed('0x14'),_0x14ed('0x35')+_0xe2c021+_0x14ed('0x36'),_0x14ed('0x16'),_0x14ed('0x17'),_0x17f07b+'.'+_0x3500d7,_0x14ed('0x18'),_0x14ed('0x19'),_0x14ed('0x1a'),_0x14ed('0x1b'),'\x22'+_0x2af543+'\x22'];var _0x5e8d96=squel[_0x14ed('0x1c')]()[_0x14ed('0x1d')](_0x14ed('0x1e'))[_0x14ed('0x32')]([_0x14ed('0xf'),'scheduledat','ContactId','ListId',_0x3500d7,_0x14ed('0x22'),_0x14ed('0x23'),_0x14ed('0x24'),_0x14ed('0x25'),_0x14ed('0x26')],squel[_0x14ed('0xe')]()[_0x14ed('0x27')](_0x5b5bba)[_0x14ed('0x28')](_0x17f07b)[_0x14ed('0x10')](_0x14ed('0x29'),null,_0x14ed('0x2a')+_0x17f07b+_0x14ed('0x2b'))[_0x14ed('0x10')](_0x577076,null,_0x577076+_0x14ed('0x11')+_0x17f07b+'.'+_0x3500d7)[_0x14ed('0x10')](_0xe2c021,null,_0xe2c021+'.id\x20=\x20'+_0x17f07b+'.'+_0x3500d7)[_0x14ed('0x12')](_0x17f07b+_0x14ed('0x37'),_0x1552b9)[_0x14ed('0x12')](_0x14ed('0x2c'),NOW)[_0x14ed('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x17f07b,_0x577076,_0x3500d7,_0x14ed('0x1e'),[_0x14ed('0x2e'),_0x14ed('0x2f')]))[_0x14ed('0x12')](_0x14ed('0x2d'),selectNotIn(_0x17f07b,_0x577076,_0x3500d7,_0x14ed('0x1e'),[_0x14ed('0x2e')])))[_0x14ed('0x30')]();return _0x5e8d96;}function insertTzCmHopperBlack(_0x27164f,_0x11bea5,_0x1579f6,_0x8e5132){var _0x78e514=['cm_contacts.phone',_0x14ed('0x16'),_0x14ed('0x17'),_0x11bea5+'.'+_0x8e5132,_0x14ed('0x18'),_0x14ed('0x19')];return squel[_0x14ed('0x1c')]()[_0x14ed('0x1d')](_0x14ed('0x31'))[_0x14ed('0x32')](['phone',_0x14ed('0x20'),'ListId',_0x8e5132,_0x14ed('0x22'),'updatedAt'],squel[_0x14ed('0xe')]()[_0x14ed('0x27')](_0x78e514)[_0x14ed('0x28')](_0x11bea5)[_0x14ed('0x10')](_0x14ed('0x29'),null,_0x14ed('0x2a')+_0x11bea5+_0x14ed('0x2b'))[_0x14ed('0x10')](_0x1579f6,null,_0x1579f6+_0x14ed('0x11')+_0x11bea5+'.'+_0x8e5132)[_0x14ed('0x12')](_0x11bea5+_0x14ed('0x37'),_0x27164f)[_0x14ed('0x12')](_0x14ed('0x2c'),NOW)['where'](_0x14ed('0x2d'),squel[_0x14ed('0xe')]()[_0x14ed('0x33')](_0x14ed('0xf'))[_0x14ed('0x28')](_0x14ed('0x31'))[_0x14ed('0x12')](_0x14ed('0x38'),_0x27164f)[_0x14ed('0x12')](_0x8e5132+_0x14ed('0x34'),_0x11bea5+'.'+_0x8e5132)))[_0x14ed('0x30')]();}function insertCmContact(_0x2ca846,_0x58262e,_0x115ac9,_0x207314){var _0x528cb2=_[_0x14ed('0x39')](_['keys'](_0x207314),[_0x14ed('0x21'),'CompanyId','createdAt','updatedAt']);return squel['insert']()[_0x14ed('0x1d')](_0x14ed('0x29'))[_0x14ed('0x32')](_0x528cb2,squel['select']()[_0x14ed('0x27')](_0x528cb2)[_0x14ed('0x28')](_0x58262e)[_0x14ed('0x12')]('('+_0x115ac9[_0x14ed('0x10')](',')+_0x14ed('0x3a'),squel[_0x14ed('0xe')]()[_0x14ed('0x27')](_0x115ac9)[_0x14ed('0x28')]('cm_contacts')[_0x14ed('0x12')](_0x14ed('0x38'),_0x2ca846)[_0x14ed('0x12')](_0x14ed('0x3b')))[_0x14ed('0x12')](_0x14ed('0x3c'),squel[_0x14ed('0xe')]()[_0x14ed('0x33')](_0x14ed('0x3d'),'min_id')[_0x14ed('0x28')](_0x58262e)['group'](_0x115ac9[_0x14ed('0x10')](','))))[_0x14ed('0x30')]();}function handleStop(){logger[_0x14ed('0x3e')](_0x14ed('0x3f'));stopped=!![];}function handleUncaughtException(_0x1dbf92){logger['error'](_0x1dbf92['message']);process[_0x14ed('0x40')](0x1);}function handleError(_0x2c442d,_0x5be506){stats[_0x14ed('0x41')][_0x14ed('0x42')]({'name':_0x5be506[_0x14ed('0x43')],'message':_0x5be506[_0x14ed('0x44')],'row':_0x2c442d});}function handleQuery(_0x4d0886){logger[_0x14ed('0x3e')](_0x4d0886);return db[_0x14ed('0x45')][_0x14ed('0x46')](_0x4d0886)[_0x14ed('0x47')](function(_0x289086){results[_0x14ed('0x42')](_0x289086);})[_0x14ed('0x48')](function(_0x1668da){logger[_0x14ed('0x49')](_0x1668da[_0x14ed('0x44')]);});}function updateTzCampaigns(_0x4ff494){return new Promise(function(_0x3ea34f,_0x4f72ab){var _0x230b8b=squel[_0x14ed('0xe')]()['fields'](['campaigns.id',_0x14ed('0x4a')])[_0x14ed('0x28')](_0x14ed('0x4b'))[_0x14ed('0x10')](_0x14ed('0x4c'),null,_0x14ed('0x4d'))[_0x14ed('0x12')](_0x14ed('0x4e')+_0x4ff494);db[_0x14ed('0x45')][_0x14ed('0x46')](_0x230b8b[_0x14ed('0x30')]())[_0x14ed('0x47')](function(_0x1a0465){var _0x29be58=[];for(var _0x33f0cf=0x0;_0x33f0cf<_0x1a0465[_0x14ed('0x4f')];_0x33f0cf++){_0x29be58['push'](getTimezoneData(_0x1a0465[_0x33f0cf],tmp_campaigns));}BPromise['all'](_0x29be58)['then'](function(){_0x3ea34f({'val':0x1});});})[_0x14ed('0x48')](function(_0x4beb67){logger[_0x14ed('0x49')](_0x4beb67[_0x14ed('0x44')]);_0x3ea34f({'val':0x0});});});}function updateTzVoiceQueues(_0x426629){return new Promise(function(_0x777605,_0x264481){var _0x541800=squel[_0x14ed('0xe')]()[_0x14ed('0x27')]([_0x14ed('0x50'),'voice_queues.dialTimezone'])['from'](_0x14ed('0x51'))[_0x14ed('0x10')]('voice_queues_has_cm_lists',null,_0x14ed('0x52'))['where']('voice_queues_has_cm_lists.CmListId='+_0x426629);db[_0x14ed('0x45')][_0x14ed('0x46')](_0x541800[_0x14ed('0x30')]())[_0x14ed('0x47')](function(_0x3226c9){var _0x3fbaad=[];for(var _0x2e490a=0x0;_0x2e490a<_0x3226c9[_0x14ed('0x4f')];_0x2e490a++){_0x3fbaad['push'](getTimezoneData(_0x3226c9[_0x2e490a],tmp_voice_queues));}BPromise[_0x14ed('0x53')](_0x3fbaad)['then'](function(){_0x777605({'val':0x1});});})['catch'](function(_0x392648){logger['error'](_0x392648[_0x14ed('0x44')]);_0x777605({'val':0x0});});});}function getTimezoneData(_0x35a196,_0xaee1a3){return new Promise(function(_0x2cf95e,_0xdd3ac8){var _0x1d5a0a=shared[_0x14ed('0x54')];var _0x167b5f=_0x1d5a0a[_0x35a196[_0x14ed('0x55')]];if(_['isNil'](_0x167b5f)){_0x2cf95e({'ret':0x1});}else{var _0x230287=_0x167b5f[_0x14ed('0x56')];var _0x5acd6e=squel['insert']()[_0x14ed('0x1d')](_0xaee1a3)[_0x14ed('0x57')]('id',_0x35a196['id'])[_0x14ed('0x57')](_0x14ed('0x58'),_0x230287)['set']('dialTimezone',_0x35a196['dialTimezone'])[_0x14ed('0x30')]();return db[_0x14ed('0x45')][_0x14ed('0x46')](_0x5acd6e)[_0x14ed('0x47')](function(_0x1f33d1){_0x2cf95e({'ret':0x1});})['catch'](function(_0x2af5a7){logger[_0x14ed('0x49')](_0x2af5a7['message']);_0xdd3ac8({'ret':0x1});});}});}function handleTZQuery(_0x218331){logger['info'](_0x218331);return db[_0x14ed('0x45')][_0x14ed('0x46')](_0x218331)['spread'](function(_0x127539){})[_0x14ed('0x48')](function(_0x13c858){logger[_0x14ed('0x49')](_0x13c858[_0x14ed('0x44')]);});}function main(_0x1fe9b6,_0x595b8a,_0x2aea2b,_0x2045ab){logger[_0x14ed('0x3e')](_0x14ed('0x59'),_0x1fe9b6,JSON[_0x14ed('0x5a')](_0x595b8a));process[_0x14ed('0x5b')](_0x14ed('0x5c'));var _0x2c061b=_0x595b8a[_0x14ed('0x5d')];var _0x4f18ef=_0x595b8a[_0x14ed('0x5e')];var _0x8d5111=path['join'](config[_0x14ed('0x5f')],_0x14ed('0x60'),_0x4f18ef+_0x14ed('0x61'));hasTZ=_[_0x14ed('0x62')](_0x2c061b)['includes'](_0x14ed('0x55'));var _0x4859f0=_[_0x14ed('0x62')](_0x2c061b)[_0x14ed('0x10')]();logger[_0x14ed('0x3e')](_0x14ed('0x63'),_0x4859f0);if(hasTZ)_0x4859f0+=',utcOffset';fs[_0x14ed('0x64')](_0x8d5111,_0x4859f0+'\x0a');Papa[_0x14ed('0x65')](fs[_0x14ed('0x66')](_0x1fe9b6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x34ae96,_0x2f148f){try{for(var _0x315b8d=0x0,_0x5e04c8=[];_0x315b8d<_0x34ae96['data'][_0x14ed('0x4f')];_0x315b8d++){stats[_0x14ed('0x67')]+=0x1;if(_0x34ae96[_0x14ed('0x41')][_0x315b8d]){handleError(_0x34ae96[_0x14ed('0x68')][_0x315b8d],_0x34ae96[_0x14ed('0x41')][_0x315b8d]);}else{var _0x567947=[];for(var _0x3965fa in _0x2c061b){if(_0x2c061b[_0x14ed('0x69')](_0x3965fa)){if(_0x34ae96[_0x14ed('0x68')][_0x315b8d][_0x2c061b[_0x3965fa]]){var _0x4be3ca=_[_0x14ed('0x6a')](_0x34ae96['data'][_0x315b8d][_0x2c061b[_0x3965fa]][_0x14ed('0x6b')](/"/g,'\x27'));switch(_0x3965fa){case _0x14ed('0x1f'):var _0x53e55f=moment(_0x4be3ca,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x53e55f[_0x14ed('0x6c')]()){_0x5e04c8[_0x14ed('0x42')]('\x22'+_0x4be3ca+'\x22');}else{_0x567947['push'](_0x14ed('0x6d'));}break;case _0x14ed('0x24'):var _0x4a0135=parseInt(_0x4be3ca);_0x4be3ca=_[_0x14ed('0x6e')](_0x4a0135)||_0x4a0135<0x0||_0x4a0135>0x4?_0x2045ab?0x3:0x2:_0x4a0135;_0x5e04c8[_0x14ed('0x42')]('\x22'+_0x4be3ca+'\x22');break;case _0x14ed('0x25'):var _0x5adb8c=parseInt(_0x4be3ca);if(_[_0x14ed('0x6f')](_0x5adb8c)&&_[_0x14ed('0x70')](_0x2aea2b,_0x5adb8c)){_0x5e04c8[_0x14ed('0x42')]('\x22'+_0x5adb8c+'\x22');}else{_0x567947[_0x14ed('0x42')](_0x14ed('0x71'));}break;case _0x14ed('0x72'):if(isEmail(_0x4be3ca)){_0x5e04c8['push']('\x22'+_0x4be3ca+'\x22');}else{_0x567947['push'](_0x14ed('0x73'));}break;case'dateOfBirth':var _0xd878e4=moment(_0x4be3ca,'YYYY-MM-DD',!![]);if(_0xd878e4['isValid']()){_0x5e04c8['push']('\x22'+_0x4be3ca+'\x22');}else{_0x567947['push'](_0x14ed('0x74'));}break;case _0x14ed('0x55'):var _0x32fac9=shared['timezones'];var _0x4f8eb4=_0x32fac9[_0x4be3ca];if(!_['isNil'](_0x4f8eb4)){var _0x380542=_0x4f8eb4[_0x14ed('0x56')];_0x5e04c8[_0x14ed('0x42')]('\x22'+_0x4be3ca+'\x22');_0x5e04c8['push']('\x22'+_0x380542+'\x22');}break;default:_0x5e04c8[_0x14ed('0x42')]('\x22'+_0x4be3ca+'\x22');}}else{switch(_0x3965fa){case _0x14ed('0x75'):case _0x14ed('0xf'):_0x567947[_0x14ed('0x42')](_0x3965fa+_0x14ed('0x76'));break;default:_0x5e04c8[_0x14ed('0x42')]('\x22\x22');}}}}if(_0x567947[_0x14ed('0x4f')]){handleError(_0x34ae96[_0x14ed('0x68')][_0x315b8d],{'code':_0x14ed('0x77'),'message':_0x567947[_0x14ed('0x10')]()});}else{fs[_0x14ed('0x78')](_0x8d5111,_0x5e04c8[_0x14ed('0x10')]()+'\x0a');}_0x5e04c8=[];}if(!(stats[_0x14ed('0x67')]%0xc8)){socket['emit'](_0x14ed('0x79')+_0x4f18ef,stats);stats[_0x14ed('0x41')]=[];}}if(stopped){logger[_0x14ed('0x3e')](_0x14ed('0x7a'));_0x2f148f[_0x14ed('0x7b')]();}}catch(_0x37953c){handleError(_0x34ae96[_0x14ed('0x68')][_0x315b8d],{'code':_0x14ed('0x7c'),'message':_0x37953c[_0x14ed('0x44')]});logger[_0x14ed('0x49')](_0x14ed('0x7d'),_0x37953c['message']);}},'complete':function(){try{var _0x20421b=[];var _0x3428e3=[];var _0x2f2c8c=_0x14ed('0x29');if(_0x595b8a[_0x14ed('0x7e')]&&_0x595b8a[_0x14ed('0x7e')][_0x14ed('0x4f')]){_0x2f2c8c='cm_contacts_'+_0x4f18ef;_0x20421b['push'](_0x14ed('0x7f')+_0x2f2c8c+_0x14ed('0x80'));}tmp_campaigns=_0x14ed('0x81')+_0x4f18ef;tmp_voice_queues=_0x14ed('0x82')+_0x4f18ef;_0x3428e3['push'](_0x14ed('0x7f')+tmp_campaigns+_0x14ed('0x83'));_0x3428e3[_0x14ed('0x42')](_0x14ed('0x7f')+tmp_voice_queues+_0x14ed('0x83'));BPromise[_0x14ed('0x84')](_0x3428e3,handleTZQuery)[_0x14ed('0x85')](function(_0x5f2871){updateTzCampaigns(_0x595b8a[_0x14ed('0x21')])[_0x14ed('0x85')](function(_0x4a4d7e){updateTzVoiceQueues(_0x595b8a['ListId'])[_0x14ed('0x85')](function(_0x548507){var _0x3c8b02=util[_0x14ed('0xb')](_0x14ed('0x86'),_0x8d5111,_0x2f2c8c,_0x4859f0,_0x595b8a['ListId'],_0x595b8a[_0x14ed('0x87')]||null,NOW,NOW);if(_[_0x14ed('0x88')](_0x2c061b[_0x14ed('0x1f')])){_0x3c8b02+=_0x14ed('0x89');}_0x20421b[_0x14ed('0x42')](_0x3c8b02);if(_0x595b8a['duplicates']&&_0x595b8a[_0x14ed('0x7e')][_0x14ed('0x4f')]){_0x20421b[_0x14ed('0x42')](insertCmContact(_0x595b8a[_0x14ed('0x21')],_0x2f2c8c,_0x595b8a['duplicates'],_0x2c061b));_0x20421b['push']('DROP\x20TABLE\x20'+_0x2f2c8c+';');}if(hasTZ){_0x20421b['push'](insertTzCmHopper(_0x595b8a[_0x14ed('0x21')],_0x14ed('0x8a'),_0x14ed('0x51'),_0x14ed('0x8b'),_0x2045ab,tmp_voice_queues));_0x20421b[_0x14ed('0x42')](insertTzCmHopperBlack(_0x595b8a[_0x14ed('0x21')],_0x14ed('0x8c'),_0x14ed('0x51'),_0x14ed('0x8b')));_0x20421b[_0x14ed('0x42')](insertTzCmHopper(_0x595b8a[_0x14ed('0x21')],_0x14ed('0x4c'),'campaigns',_0x14ed('0x8d'),_0x2045ab,tmp_campaigns));_0x20421b[_0x14ed('0x42')](insertTzCmHopperBlack(_0x595b8a[_0x14ed('0x21')],_0x14ed('0x8e'),'campaigns','CampaignId'));}else{_0x20421b['push'](insertCmHopper(_0x595b8a['ListId'],_0x14ed('0x8a'),_0x14ed('0x51'),_0x14ed('0x8b'),_0x2045ab));_0x20421b[_0x14ed('0x42')](insertCmHopperBlack(_0x595b8a[_0x14ed('0x21')],'voice_queues_has_cm_blacklists','voice_queues',_0x14ed('0x8b')));_0x20421b[_0x14ed('0x42')](insertCmHopper(_0x595b8a[_0x14ed('0x21')],'campaigns_has_cm_lists',_0x14ed('0x4b'),_0x14ed('0x8d'),_0x2045ab));_0x20421b[_0x14ed('0x42')](insertCmHopperBlack(_0x595b8a['ListId'],_0x14ed('0x8e'),_0x14ed('0x4b'),_0x14ed('0x8d')));}_0x20421b[_0x14ed('0x42')](_0x14ed('0x8f')+tmp_campaigns+';');_0x20421b[_0x14ed('0x42')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x14ed('0x84')](_0x20421b,handleQuery)[_0x14ed('0x85')](function(_0x59ba61){stats[_0x14ed('0x90')]=!![];stats[_0x14ed('0x91')]=_0x595b8a['duplicates']&&_0x595b8a[_0x14ed('0x7e')][_0x14ed('0x4f')]?results[0x2][_0x14ed('0x91')]:results[0x0][_0x14ed('0x91')];socket['emit'](_0x14ed('0x79')+_0x4f18ef,stats);fs[_0x14ed('0x92')](_0x1fe9b6);fs['unlink'](_0x8d5111);process[_0x14ed('0x40')](0x0);})['catch'](function(_0xeb6880){logger[_0x14ed('0x49')](_0xeb6880[_0x14ed('0x44')]);process[_0x14ed('0x40')](0x1);});});});});}catch(_0x45ecb1){logger[_0x14ed('0x49')](_0x14ed('0x93'),_0x45ecb1[_0x14ed('0x44')]);process['exit'](0x1);}},'error':function(_0x5e1e33,_0x4779dd,_0x424201,_0x23cfe8){throw new Error(_0x23cfe8);}});}function validate(){if(process[_0x14ed('0x94')]&&process['argv'][_0x14ed('0x4f')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x13bf97=path[_0x14ed('0x10')](config[_0x14ed('0x5f')],_0x14ed('0x60'),process['argv'][0x2]);if(!fs[_0x14ed('0x95')](_0x13bf97)){throw new Error(_0x14ed('0x96'));}var _0x401ae1={};try{_0x401ae1=JSON[_0x14ed('0x65')](process['argv'][0x3]);if(!_0x401ae1['binding']){throw new Error(_0x14ed('0x97'));}if(!_0x401ae1[_0x14ed('0x5d')][_0x14ed('0xf')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x401ae1[_0x14ed('0x5d')][_0x14ed('0x75')]){throw new Error(_0x14ed('0x98'));}var _0x1cc49a=0x0;if(_0x401ae1[_0x14ed('0x5d')]['UserId']){_0x1cc49a=0x1;}if(!_0x401ae1[_0x14ed('0x21')]){throw new Error(_0x14ed('0x99'));}}catch(_0x49cdb7){throw new Error(_0x14ed('0x9a'));}var _0x32b3c3=[];try{_0x32b3c3=_['map'](JSON[_0x14ed('0x65')](process[_0x14ed('0x94')][0x4]),'id');}catch(_0x8113a0){logger[_0x14ed('0x3e')](_0x14ed('0x9b'));}main(_0x13bf97,_0x401ae1,_0x32b3c3,_0x1cc49a);}validate();process['on'](_0x14ed('0x9c'),handleStop);process['on'](_0x14ed('0x9d'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 2aacb1c..ad45ad6 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 _0x8221=['Complete\x20Time','duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','queue','variable','outbound','push','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','Call\x20To','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','Agent\x20Ring','Agent\x20Connect','agentcompleteAt','Hold\x20Time','holdtime','talktime','Member\x20Name','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime'];(function(_0x419c3b,_0x7c4ed){var _0x98adf9=function(_0x316fd0){while(--_0x316fd0){_0x419c3b['push'](_0x419c3b['shift']());}};_0x98adf9(++_0x7c4ed);}(_0x8221,0x143));var _0x1822=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0x8221[_0x1488cd];return _0x63fa13;};'use strict';exports[_0x1822('0x0')]=function(_0x58b82f,_0x4a09c7){var _0x5c7426=[{'type':_0x1822('0x1'),'content':_0x1822('0x2'),'variableName':null}];switch(_0x58b82f['toLowerCase']()){case _0x1822('0x3'):switch(_0x4a09c7[_0x1822('0x4')]()){case _0x1822('0x5'):_0x5c7426['push']({'type':'variable','content':'','variableName':_0x1822('0x6')});_0x5c7426['push']({'type':_0x1822('0x7'),'content':'','variableName':'calleridnum'});break;case _0x1822('0x8'):_0x5c7426[_0x1822('0x9')]({'type':'string','content':_0x1822('0xa'),'variableName':null});_0x5c7426[_0x1822('0x9')]({'type':_0x1822('0x7'),'content':'','variableName':_0x1822('0xb')});break;}}return _0x5c7426;};exports[_0x1822('0xc')]=function(_0x16e081,_0x187137){var _0x108253=[];switch(_0x16e081['toLowerCase']()){case _0x1822('0x3'):switch(_0x187137[_0x1822('0x4')]()){case _0x1822('0x5'):_0x108253=[{'type':_0x1822('0x1'),'content':_0x1822('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0x1822('0xe'),'content':'','key':_0x1822('0xf'),'keyType':_0x1822('0x7'),'variableName':_0x1822('0x10')},{'type':_0x1822('0xe'),'content':'','key':_0x1822('0x11'),'keyType':'variable','variableName':'calleridname'},{'type':_0x1822('0xe'),'content':'','key':_0x1822('0x12'),'keyType':_0x1822('0x7'),'variableName':'destexten'},{'type':_0x1822('0xe'),'content':'','key':'Queue','keyType':_0x1822('0x7'),'variableName':'queue'},{'type':_0x1822('0xe'),'content':'','key':_0x1822('0x13'),'keyType':'variable','variableName':_0x1822('0x14')},{'type':'keyValue','content':'','key':_0x1822('0x15'),'keyType':'variable','variableName':_0x1822('0x16')},{'type':_0x1822('0x1'),'content':_0x1822('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x1822('0xe'),'content':'','key':'Agent\x20Name','keyType':_0x1822('0x7'),'variableName':_0x1822('0x18')},{'type':_0x1822('0xe'),'content':'','key':_0x1822('0x19'),'keyType':_0x1822('0x7'),'variableName':_0x1822('0xb')},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x1822('0xe'),'content':'','key':_0x1822('0x1a'),'keyType':'variable','variableName':_0x1822('0x16')},{'type':'keyValue','content':'','key':_0x1822('0x1b'),'keyType':'variable','variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':'Agent\x20Complete','keyType':_0x1822('0x7'),'variableName':_0x1822('0x1c')},{'type':_0x1822('0xe'),'content':'','key':_0x1822('0x1d'),'keyType':'variable','variableName':_0x1822('0x1e')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0x1822('0x7'),'variableName':_0x1822('0x1f')}];break;case _0x1822('0x8'):_0x108253=[{'type':_0x1822('0x1'),'content':_0x1822('0xd'),'variableName':null},{'type':_0x1822('0xe'),'content':'','key':'Called\x20Number','keyType':_0x1822('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x1822('0xe'),'content':'','key':_0x1822('0x20'),'keyType':_0x1822('0x7'),'keyContent':'','variableName':'membername'},{'type':_0x1822('0xe'),'content':'','key':_0x1822('0x13'),'keyType':_0x1822('0x7'),'keyContent':'','variableName':_0x1822('0x14')},{'type':_0x1822('0xe'),'content':'','key':_0x1822('0x15'),'keyType':'variable','keyContent':'','variableName':_0x1822('0x21')},{'type':_0x1822('0x1'),'content':_0x1822('0x22')},{'type':_0x1822('0xe'),'content':'','key':_0x1822('0x23'),'keyType':_0x1822('0x7'),'keyContent':'','variableName':_0x1822('0x24')},{'type':'keyValue','content':'','key':_0x1822('0x25'),'keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0x1822('0xe'),'content':'','key':'Duration','keyType':_0x1822('0x7'),'keyContent':'','variableName':_0x1822('0x26')},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0x1822('0x7'),'keyContent':'','variableName':_0x1822('0x27')}];break;}}return _0x108253;}; \ No newline at end of file +var _0x3271=['Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','Member\x20Name','membername','uniqueid','Date','starttime','answertime','Complete\x20Time','Duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','variable','queue','push','calleridnum','outbound','destcalleridnum','getDescriptions','Caller\x20Number','calleridname','keyValue','destexten','Queue','UniqueId','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','string','***\x20Time\x20Info\x20***','Agent\x20Ring'];(function(_0x20187c,_0x5e3eb7){var _0x5a4e25=function(_0x4d8d64){while(--_0x4d8d64){_0x20187c['push'](_0x20187c['shift']());}};_0x5a4e25(++_0x5e3eb7);}(_0x3271,0x19f));var _0x1327=function(_0xbcbe70,_0x46da3b){_0xbcbe70=_0xbcbe70-0x0;var _0x495bad=_0x3271[_0xbcbe70];return _0x495bad;};'use strict';exports[_0x1327('0x0')]=function(_0x2b0847,_0x4a44ab){var _0x4ffcfd=[{'type':'string','content':_0x1327('0x1'),'variableName':null}];switch(_0x2b0847['toLowerCase']()){case _0x1327('0x2'):switch(_0x4a44ab[_0x1327('0x3')]()){case _0x1327('0x4'):_0x4ffcfd['push']({'type':_0x1327('0x5'),'content':'','variableName':_0x1327('0x6')});_0x4ffcfd[_0x1327('0x7')]({'type':_0x1327('0x5'),'content':'','variableName':_0x1327('0x8')});break;case _0x1327('0x9'):_0x4ffcfd[_0x1327('0x7')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x4ffcfd['push']({'type':_0x1327('0x5'),'content':'','variableName':_0x1327('0xa')});break;}}return _0x4ffcfd;};exports[_0x1327('0xb')]=function(_0x3b5d99,_0x1e9146){var _0x31bece=[];switch(_0x3b5d99[_0x1327('0x3')]()){case _0x1327('0x2'):switch(_0x1e9146['toLowerCase']()){case'inbound':_0x31bece=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x1327('0xc'),'keyType':_0x1327('0x5'),'variableName':_0x1327('0x8')},{'type':'keyValue','content':'','key':'Caller\x20Name','keyType':'variable','variableName':_0x1327('0xd')},{'type':_0x1327('0xe'),'content':'','key':'Call\x20To','keyType':_0x1327('0x5'),'variableName':_0x1327('0xf')},{'type':_0x1327('0xe'),'content':'','key':_0x1327('0x10'),'keyType':_0x1327('0x5'),'variableName':'queue'},{'type':_0x1327('0xe'),'content':'','key':_0x1327('0x11'),'keyType':_0x1327('0x5'),'variableName':'uniqueid'},{'type':_0x1327('0xe'),'content':'','key':'Date','keyType':_0x1327('0x5'),'variableName':_0x1327('0x12')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x1327('0xe'),'content':'','key':_0x1327('0x13'),'keyType':'variable','variableName':_0x1327('0x14')},{'type':_0x1327('0xe'),'content':'','key':_0x1327('0x15'),'keyType':_0x1327('0x5'),'variableName':_0x1327('0xa')},{'type':_0x1327('0x16'),'content':_0x1327('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x1327('0xe'),'content':'','key':_0x1327('0x18'),'keyType':_0x1327('0x5'),'variableName':_0x1327('0x12')},{'type':_0x1327('0xe'),'content':'','key':_0x1327('0x19'),'keyType':_0x1327('0x5'),'variableName':_0x1327('0x1a')},{'type':_0x1327('0xe'),'content':'','key':_0x1327('0x1b'),'keyType':_0x1327('0x5'),'variableName':_0x1327('0x1c')},{'type':'keyValue','content':'','key':'Hold\x20Time','keyType':_0x1327('0x5'),'variableName':_0x1327('0x1d')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0x1327('0x5'),'variableName':'talktime'}];break;case _0x1327('0x9'):_0x31bece=[{'type':_0x1327('0x16'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x1327('0xe'),'content':'','key':'Called\x20Number','keyType':_0x1327('0x5'),'keyContent':'','variableName':_0x1327('0xa')},{'type':_0x1327('0xe'),'content':'','key':_0x1327('0x1e'),'keyType':_0x1327('0x5'),'keyContent':'','variableName':_0x1327('0x1f')},{'type':_0x1327('0xe'),'content':'','key':'UniqueId','keyType':'variable','keyContent':'','variableName':_0x1327('0x20')},{'type':_0x1327('0xe'),'content':'','key':_0x1327('0x21'),'keyType':_0x1327('0x5'),'keyContent':'','variableName':_0x1327('0x22')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0x1327('0xe'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':_0x1327('0x23')},{'type':_0x1327('0xe'),'content':'','key':_0x1327('0x24'),'keyType':_0x1327('0x5'),'keyContent':'','variableName':'endtime'},{'type':_0x1327('0xe'),'content':'','key':_0x1327('0x25'),'keyType':_0x1327('0x5'),'keyContent':'','variableName':'duration'},{'type':_0x1327('0xe'),'content':'','key':_0x1327('0x26'),'keyType':_0x1327('0x5'),'keyContent':'','variableName':_0x1327('0x27')}];break;}}return _0x31bece;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 60195bb..b6d9d78 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 _0xee8a=['tracked','user','query','body','html','fax','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','findOne','then','update','info','catch','error'];(function(_0x369d53,_0x548bcf){var _0x287ac4=function(_0x294921){while(--_0x294921){_0x369d53['push'](_0x369d53['shift']());}};_0x287ac4(++_0x548bcf);}(_0xee8a,0xde));var _0xaee8=function(_0xf31767,_0x381746){_0xf31767=_0xf31767-0x0;var _0x24bd0c=_0xee8a[_0xf31767];return _0x24bd0c;};'use strict';var _=require('lodash');var db=require(_0xaee8('0x0'))['db'];var loggers={'openchannel':require(_0xaee8('0x1'))(_0xaee8('0x2')),'mail':require('../../config/logger')(_0xaee8('0x3')),'fax':require(_0xaee8('0x1'))(_0xaee8('0x4')),'sms':require('../../config/logger')(_0xaee8('0x5')),'chat':require(_0xaee8('0x1'))(_0xaee8('0x6')),'whatsapp':require(_0xaee8('0x1'))('whatsapp-interactions')};function getInteractionId(_0x4db1df,_0x280ed5,_0x1bcc3a){if(_0x4db1df&&_0x4db1df[_[_0xaee8('0x7')](_0x1bcc3a)+_0xaee8('0x8')]){return _0x4db1df[_[_0xaee8('0x7')](_0x1bcc3a)+_0xaee8('0x8')];}else if(_0x4db1df&&_0x4db1df['id']){return _0x4db1df['id'];}else if(_0x280ed5&&_0x280ed5['id']){return _0x280ed5['id'];}else{return'unknown';}}function log(_0x5b1aad,_0x11296d,_0x31b798,_0x3c8bfa,_0x40cee9,_0x1d959c){loggers[_0x40cee9[_0xaee8('0x9')]()][_0x5b1aad](_0xaee8('0xa'),_0x1d959c[_0xaee8('0xb')](),_0x11296d?_0x11296d['id']:null,_0x11296d?_0x11296d[_0xaee8('0xc')]:null,_0x11296d?_0x11296d['role']:null,getInteractionId(_0x31b798,_0x3c8bfa,_0x40cee9),_0x31b798?JSON[_0xaee8('0xd')](_0x31b798):_0xaee8('0xe'));}function updateUser(_0x51b995,_0xa3e038,_0x5779f0,_0x49c282,_0x3c7b89){db[_[_0xaee8('0x7')](_0x49c282)+'Interaction'][_0xaee8('0xf')]({'where':{'id':getInteractionId(_0xa3e038,_0x5779f0,_0x49c282)}})[_0xaee8('0x10')](function(_0x451cd9){if(_0x451cd9){return _0x451cd9[_0xaee8('0x11')]({'UserId':_0x51b995?_0x51b995['id']:null});}})[_0xaee8('0x10')](function(_0x2067f7){if(_0x2067f7){log(_0xaee8('0x12'),_0x51b995,_0xa3e038,_0x5779f0,_0x49c282,_0x3c7b89);}})[_0xaee8('0x13')](function(){log(_0xaee8('0x14'),_0x51b995,_0xa3e038,_0x5779f0,_0x49c282,_0x3c7b89);});}exports[_0xaee8('0x15')]=function(_0x52177b,_0x4f0725){return function(_0x281e73,_0x2c5484,_0x329446){var _0x20e6bc=_0x281e73[_0xaee8('0x16')];var _0x36e255={};var _0x35e44b=_0x281e73[_0xaee8('0x17')];if(_0x36e255){_0x36e255=_['clone'](_0x281e73[_0xaee8('0x18')]);_0x36e255=_['omit'](_0x36e255,[_0xaee8('0x18'),_0xaee8('0x19'),'phone',_0xaee8('0x1a'),'mobile']);}updateUser(_0x20e6bc,_0x36e255,_0x35e44b,_0x52177b,_0x4f0725);_0x329446(null);};}; \ No newline at end of file +var _0x3fad=['chat-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','findOne','update','info','catch','error','tracked','user','body','omit','html','phone','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions'];(function(_0x49c54c,_0x54a647){var _0x446225=function(_0x462f62){while(--_0x462f62){_0x49c54c['push'](_0x49c54c['shift']());}};_0x446225(++_0x54a647);}(_0x3fad,0x1e6));var _0xd3fa=function(_0x515411,_0x371822){_0x515411=_0x515411-0x0;var _0xd329c0=_0x3fad[_0x515411];return _0xd329c0;};'use strict';var _=require(_0xd3fa('0x0'));var db=require(_0xd3fa('0x1'))['db'];var loggers={'openchannel':require(_0xd3fa('0x2'))(_0xd3fa('0x3')),'mail':require(_0xd3fa('0x2'))(_0xd3fa('0x4')),'fax':require(_0xd3fa('0x2'))(_0xd3fa('0x5')),'sms':require(_0xd3fa('0x2'))(_0xd3fa('0x6')),'chat':require(_0xd3fa('0x2'))(_0xd3fa('0x7')),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getInteractionId(_0x41cc63,_0x524105,_0x5726c6){if(_0x41cc63&&_0x41cc63[_[_0xd3fa('0x8')](_0x5726c6)+'InteractionId']){return _0x41cc63[_[_0xd3fa('0x8')](_0x5726c6)+_0xd3fa('0x9')];}else if(_0x41cc63&&_0x41cc63['id']){return _0x41cc63['id'];}else if(_0x524105&&_0x524105['id']){return _0x524105['id'];}else{return _0xd3fa('0xa');}}function log(_0x46de95,_0x20ee11,_0x5bda8a,_0x242e24,_0x5c6305,_0x41ae62){loggers[_0x5c6305['toLowerCase']()][_0x46de95](_0xd3fa('0xb'),_0x41ae62[_0xd3fa('0xc')](),_0x20ee11?_0x20ee11['id']:null,_0x20ee11?_0x20ee11['name']:null,_0x20ee11?_0x20ee11[_0xd3fa('0xd')]:null,getInteractionId(_0x5bda8a,_0x242e24,_0x5c6305),_0x5bda8a?JSON[_0xd3fa('0xe')](_0x5bda8a):_0xd3fa('0xf'));}function updateUser(_0x31efa5,_0x2bff49,_0x1c92ee,_0x382354,_0x2100c2){db[_['upperFirst'](_0x382354)+_0xd3fa('0x10')][_0xd3fa('0x11')]({'where':{'id':getInteractionId(_0x2bff49,_0x1c92ee,_0x382354)}})['then'](function(_0xbc4b5d){if(_0xbc4b5d){return _0xbc4b5d[_0xd3fa('0x12')]({'UserId':_0x31efa5?_0x31efa5['id']:null});}})['then'](function(_0x1ccc30){if(_0x1ccc30){log(_0xd3fa('0x13'),_0x31efa5,_0x2bff49,_0x1c92ee,_0x382354,_0x2100c2);}})[_0xd3fa('0x14')](function(){log(_0xd3fa('0x15'),_0x31efa5,_0x2bff49,_0x1c92ee,_0x382354,_0x2100c2);});}exports[_0xd3fa('0x16')]=function(_0x2edb7b,_0x97f69){return function(_0x21ede9,_0x20213c,_0x216251){var _0x314b87=_0x21ede9[_0xd3fa('0x17')];var _0x541864={};var _0x53abd0=_0x21ede9['query'];if(_0x541864){_0x541864=_['clone'](_0x21ede9[_0xd3fa('0x18')]);_0x541864=_[_0xd3fa('0x19')](_0x541864,[_0xd3fa('0x18'),_0xd3fa('0x1a'),_0xd3fa('0x1b'),'fax',_0xd3fa('0x1c')]);}updateUser(_0x314b87,_0x541864,_0x53abd0,_0x2edb7b,_0x97f69);_0x216251(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index b9e0444..6f93314 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 _0xc641=['createDecipher','aes-256-ctr','format','update','base64','parse','hasOwnProperty','use','License','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','split'];(function(_0xb30063,_0x2ce543){var _0x2bb464=function(_0x5bec23){while(--_0x5bec23){_0xb30063['push'](_0xb30063['shift']());}};_0x2bb464(++_0x2ce543);}(_0xc641,0x1d4));var _0x1c64=function(_0x3436a8,_0x8f0067){_0x3436a8=_0x3436a8-0x0;var _0x3a29bb=_0xc641[_0x3436a8];return _0x3a29bb;};'use strict';var crypto=require(_0x1c64('0x0'));var util=require(_0x1c64('0x1'));var compose=require(_0x1c64('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x1c64('0x3'));function getValueFromLicense(_0x5d359a,_0x3b0986){if(_0x5d359a&&_0x3b0986){if(_0x3b0986[_0x1c64('0x4')]&&_0x3b0986[_0x1c64('0x5')]){var _0x573913=_0x3b0986[_0x1c64('0x4')];var _0x5bb71e=_0x3b0986[_0x1c64('0x5')];var _0x250d38=_0x573913[_0x1c64('0x6')]('-')[0x4];var _0x182640=_0x573913[_0x1c64('0x6')]('-')[0x0];var _0x67d0e5=crypto[_0x1c64('0x7')](_0x1c64('0x8'),util[_0x1c64('0x9')]('%s:%s:%s',_0x250d38,_0x573913,_0x182640));var _0x695cc5=_0x67d0e5[_0x1c64('0xa')](_0x5bb71e,_0x1c64('0xb'),'utf8');_0x695cc5+=_0x67d0e5['final']('utf8');var _0x544c57=JSON[_0x1c64('0xc')](_0x695cc5);return _0x544c57[_0x1c64('0xd')](_0x5d359a)?_0x544c57[_0x5d359a]:null;}}return null;}function isLimit(_0xc015b4,_0x21933d,_0x16b69b,_0x2184b6){var _0x574140=_0x21933d;return compose()[_0x1c64('0xe')](function(_0x27eb17,_0x45d1c8,_0x2b678a){return db[_0x1c64('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x1c64('0x10')](function(_0x2758c0){var _0x59d6ee=getValueFromLicense(_0xc015b4,_0x2758c0);return _0x59d6ee?_0x59d6ee:_0x574140;})['then'](function(_0x13bab3){_0x574140=_0x13bab3;return _0x16b69b[_0x1c64('0x11')](_0x2184b6);})[_0x1c64('0x10')](function(_0x28e3a8){if(_0x28e3a8>=_0x574140){return _0x45d1c8['status'](0x193)[_0x1c64('0x12')]({'message':util[_0x1c64('0x9')](_0x1c64('0x13'),_0xc015b4)});}_0x2b678a();})[_0x1c64('0x14')](function(_0x50295e){_0x2b678a(_0x50295e);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x1c64('0x15')],{'where':{'$or':[{'role':_0x1c64('0x16')},{'role':_0x1c64('0x17')}]}});}exports[_0x1c64('0x18')]=isUserLimit; \ No newline at end of file +var _0xc600=['createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','hasOwnProperty','use','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split'];(function(_0x5c5923,_0x46ee71){var _0x145364=function(_0x395119){while(--_0x395119){_0x5c5923['push'](_0x5c5923['shift']());}};_0x145364(++_0x46ee71);}(_0xc600,0x11a));var _0x0c60=function(_0x3472c4,_0x56044a){_0x3472c4=_0x3472c4-0x0;var _0x4a32cc=_0xc600[_0x3472c4];return _0x4a32cc;};'use strict';var crypto=require(_0x0c60('0x0'));var util=require(_0x0c60('0x1'));var compose=require(_0x0c60('0x2'));var db=require(_0x0c60('0x3'))['db'];var config=require(_0x0c60('0x4'));function getValueFromLicense(_0x124c83,_0x4d4a66){if(_0x124c83&&_0x4d4a66){if(_0x4d4a66[_0x0c60('0x5')]&&_0x4d4a66[_0x0c60('0x6')]){var _0x285e31=_0x4d4a66['data1'];var _0x5635fc=_0x4d4a66[_0x0c60('0x6')];var _0x183cf7=_0x285e31['split']('-')[0x4];var _0x2de496=_0x285e31[_0x0c60('0x7')]('-')[0x0];var _0x3d55ef=crypto[_0x0c60('0x8')](_0x0c60('0x9'),util[_0x0c60('0xa')](_0x0c60('0xb'),_0x183cf7,_0x285e31,_0x2de496));var _0x547629=_0x3d55ef[_0x0c60('0xc')](_0x5635fc,_0x0c60('0xd'),'utf8');_0x547629+=_0x3d55ef['final'](_0x0c60('0xe'));var _0x27af9b=JSON[_0x0c60('0xf')](_0x547629);return _0x27af9b[_0x0c60('0x10')](_0x124c83)?_0x27af9b[_0x124c83]:null;}}return null;}function isLimit(_0x42f714,_0x126de2,_0x6f923c,_0x16c9e5){var _0x581c9e=_0x126de2;return compose()[_0x0c60('0x11')](function(_0x13ce1f,_0x57bb33,_0x223773){return db[_0x0c60('0x12')][_0x0c60('0x13')]({'where':{'id':0x1},'raw':!![]})[_0x0c60('0x14')](function(_0x13cba0){var _0x29108d=getValueFromLicense(_0x42f714,_0x13cba0);return _0x29108d?_0x29108d:_0x581c9e;})[_0x0c60('0x14')](function(_0x1f2865){_0x581c9e=_0x1f2865;return _0x6f923c['count'](_0x16c9e5);})['then'](function(_0x3296ae){if(_0x3296ae>=_0x581c9e){return _0x57bb33[_0x0c60('0x15')](0x193)[_0x0c60('0x16')]({'message':util[_0x0c60('0xa')](_0x0c60('0x17'),_0x42f714)});}_0x223773();})['catch'](function(_0x4e37fa){_0x223773(_0x4e37fa);});});}function isUserLimit(){return isLimit(_0x0c60('0x18'),0x1,db[_0x0c60('0x19')],{'where':{'$or':[{'role':_0x0c60('0x1a')},{'role':_0x0c60('0x1b')}]}});}exports[_0x0c60('0x1c')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index b02e1d2..02cca90 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 _0xa134=['sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','slice','forEach','shift','match','filter','indexOf','map','push','buildExpression','DATE','$eq','operator','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch'];(function(_0x3f9dca,_0xd26ced){var _0x4b7d90=function(_0x50edb9){while(--_0x50edb9){_0x3f9dca['push'](_0x3f9dca['shift']());}};_0x4b7d90(++_0xd26ced);}(_0xa134,0x15f));var _0x4a13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa134[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4a13('0x0'));var moment=require(_0x4a13('0x1'));exports[_0x4a13('0x2')]=function(_0x23d45a){var _0x26c324={'conditions':[]};_0x26c324[_0x4a13('0x3')]=_[_0x4a13('0x4')](_0x23d45a,_0x4a13('0x5'))?'or':_0x4a13('0x6');var _0x3f6e75=_0x23d45a['replace'](_0x4a13('0x7'),'')[_0x4a13('0x8')](_0x4a13('0x5'),'')[_0x4a13('0x9')]('||');for(var _0x290631=0x0;_0x290631<_0x3f6e75[_0x4a13('0xa')];_0x290631++){var _0x55fea5=_0x3f6e75[_0x290631][_0x4a13('0x9')](':=');var _0x4825fb=_0x55fea5[0x0];var _0x5aa193=_0x55fea5[_0x4a13('0xb')](0x1);_0x5aa193[_0x4a13('0xc')](function(_0x5b746f){var _0x44a805=_0x5b746f[_0x4a13('0x9')]('[')[_0x4a13('0xd')]();var _0x505614=_0x5b746f[_0x4a13('0xe')](/\[(.*?)\]/g);_0x505614[_0x4a13('0xc')](function(_0xafbe5c){var _0x5d8cab=_0xafbe5c[_0x4a13('0x9')]('[')[_0x4a13('0xf')](function(_0xd82ce6){return _0xd82ce6[_0x4a13('0x10')](']')>-0x1;})[_0x4a13('0x11')](function(_0xce4d41){return _0xce4d41[_0x4a13('0x9')](']')[0x0];})[0x0];_0x26c324['conditions'][_0x4a13('0x12')]({'field':_0x4825fb,'operator':_0x44a805,'value':_0x5d8cab});});});}return _0x26c324;};exports[_0x4a13('0x13')]=function(_0x1eb060,_0x472f32,_0x53f41e){var _0x4bdff7={};if(_0x472f32===_0x4a13('0x14')){if(_0x53f41e['operator']===_0x4a13('0x15')){_0x53f41e[_0x4a13('0x16')]=_0x4a13('0x17');_0x53f41e['value']+=','+_0x53f41e[_0x4a13('0x18')];}else if(_[_0x4a13('0x19')](['$gt',_0x4a13('0x1a')],_0x53f41e[_0x4a13('0x16')])){_0x53f41e[_0x4a13('0x18')]=moment(_0x53f41e['value'])[_0x4a13('0x1b')](0x1,_0x4a13('0x1c'))[_0x4a13('0x1d')](_0x4a13('0x1e'));}}if(_0x53f41e[_0x4a13('0x1f')]){_0x472f32=_0x53f41e['castTo'];_0x4bdff7[_0x4a13('0x20')]=_0x4a13('0x21')+_0x1eb060+'.'+_0x53f41e[_0x4a13('0x22')]+_0x4a13('0x23')+_0x53f41e[_0x4a13('0x1f')]+')\x20'+parseOperator(_0x53f41e['operator']);}else{_0x4bdff7[_0x4a13('0x20')]=_0x1eb060+'.'+_0x53f41e[_0x4a13('0x22')]+'\x20'+parseOperator(_0x53f41e['operator']);}if(_['includes']([_0x4a13('0x24'),_0x4a13('0x25')],_0x53f41e['operator']))_0x4bdff7['text']='('+_0x4bdff7['text']+'\x20OR\x20'+_0x1eb060+'.'+_0x53f41e[_0x4a13('0x22')]+'\x20IS\x20NULL)';_0x4bdff7['value']=parseValue(_0x472f32,_0x53f41e[_0x4a13('0x16')],_0x53f41e[_0x4a13('0x18')]);return _0x4bdff7;};function parseOperator(_0x3ee9e1){var _0x349ac4;switch(_0x3ee9e1){case _0x4a13('0x26'):_0x349ac4=_0x4a13('0x27');break;case _0x4a13('0x25'):_0x349ac4='NOT\x20IN\x20?';break;case _0x4a13('0x15'):_0x349ac4=_0x4a13('0x28');break;case'$ne':_0x349ac4=_0x4a13('0x29');break;case _0x4a13('0x2a'):case _0x4a13('0x2b'):case _0x4a13('0x2c'):_0x349ac4=_0x4a13('0x2d');break;case _0x4a13('0x2e'):_0x349ac4=_0x4a13('0x2f');break;case _0x4a13('0x30'):_0x349ac4=_0x4a13('0x31');break;case _0x4a13('0x1a'):_0x349ac4=_0x4a13('0x32');break;case _0x4a13('0x33'):_0x349ac4=_0x4a13('0x34');break;case _0x4a13('0x17'):_0x349ac4=_0x4a13('0x35');break;}return _0x349ac4;}function parseValue(_0xf85d31,_0x4ee8fb,_0x6780f2){var _0x225fe9={'start':undefined,'end':undefined};switch(_0x4ee8fb){case'$in':case _0x4a13('0x25'):_0x225fe9[_0x4a13('0x36')]=_0x6780f2['split'](',');break;case'$substring':_0x225fe9[_0x4a13('0x36')]='%'+_0x6780f2+'%';break;case _0x4a13('0x2b'):_0x225fe9[_0x4a13('0x36')]=_0x6780f2+'%';break;case _0x4a13('0x2c'):_0x225fe9['start']='%'+_0x6780f2;break;case _0x4a13('0x17'):var _0x296d06=_0x6780f2[_0x4a13('0x9')](',');var _0x6780f2=_0x296d06['shift']();var _0x16e539=_0x296d06['pop']();if(_0xf85d31===_0x4a13('0x14')){_0x6780f2=moment(_0x6780f2)[_0x4a13('0x37')](0x0,!![])[_0x4a13('0x1d')]();_0x16e539=moment(_0x16e539)[_0x4a13('0x37')](0x0,!![])['add'](0x17,_0x4a13('0x38'))[_0x4a13('0x1b')](0x3b,_0x4a13('0x39'))[_0x4a13('0x1b')](0x3b,_0x4a13('0x3a'))[_0x4a13('0x1d')]();}_0x225fe9={'start':_0x6780f2,'end':_0x16e539};break;default:_0x225fe9[_0x4a13('0x36')]=_0x6780f2;break;}return _0x225fe9;} \ No newline at end of file +var _0xf5ac=['<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$substring','hours','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','[$and]','replace','length','slice','shift','split','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','castTo','text','CAST(','\x20AS\x20','field','$notIn','\x20OR\x20','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt'];(function(_0x24c8c4,_0xfafd0f){var _0xeccc1a=function(_0x2c2d53){while(--_0x2c2d53){_0x24c8c4['push'](_0x24c8c4['shift']());}};_0xeccc1a(++_0xfafd0f);}(_0xf5ac,0xec));var _0xcf5a=function(_0x1bbe14,_0x1d07b0){_0x1bbe14=_0x1bbe14-0x0;var _0x573fe6=_0xf5ac[_0x1bbe14];return _0x573fe6;};'use strict';var _=require(_0xcf5a('0x0'));var moment=require(_0xcf5a('0x1'));exports['parseSearch']=function(_0x4e1194){var _0x5a3ac3={'conditions':[]};_0x5a3ac3[_0xcf5a('0x2')]=_[_0xcf5a('0x3')](_0x4e1194,_0xcf5a('0x4'))?'or':'and';var _0x51081f=_0x4e1194['replace'](_0xcf5a('0x5'),'')[_0xcf5a('0x6')]('[$or]','')['split']('||');for(var _0x4dcbe2=0x0;_0x4dcbe2<_0x51081f[_0xcf5a('0x7')];_0x4dcbe2++){var _0x100c2f=_0x51081f[_0x4dcbe2]['split'](':=');var _0x3115eb=_0x100c2f[0x0];var _0x4f69a5=_0x100c2f[_0xcf5a('0x8')](0x1);_0x4f69a5['forEach'](function(_0x100f23){var _0x461c01=_0x100f23['split']('[')[_0xcf5a('0x9')]();var _0x459c42=_0x100f23['match'](/\[(.*?)\]/g);_0x459c42['forEach'](function(_0x3a22c5){var _0x3d0215=_0x3a22c5[_0xcf5a('0xa')]('[')[_0xcf5a('0xb')](function(_0x946b44){return _0x946b44[_0xcf5a('0xc')](']')>-0x1;})[_0xcf5a('0xd')](function(_0x40e433){return _0x40e433[_0xcf5a('0xa')](']')[0x0];})[0x0];_0x5a3ac3[_0xcf5a('0xe')][_0xcf5a('0xf')]({'field':_0x3115eb,'operator':_0x461c01,'value':_0x3d0215});});});}return _0x5a3ac3;};exports[_0xcf5a('0x10')]=function(_0x379f96,_0x2c6b69,_0x176b2b){var _0xdb06e7={};if(_0x2c6b69===_0xcf5a('0x11')){if(_0x176b2b[_0xcf5a('0x12')]===_0xcf5a('0x13')){_0x176b2b['operator']=_0xcf5a('0x14');_0x176b2b[_0xcf5a('0x15')]+=','+_0x176b2b['value'];}else if(_[_0xcf5a('0x16')]([_0xcf5a('0x17'),_0xcf5a('0x18')],_0x176b2b['operator'])){_0x176b2b[_0xcf5a('0x15')]=moment(_0x176b2b['value'])[_0xcf5a('0x19')](0x1,_0xcf5a('0x1a'))[_0xcf5a('0x1b')]('YYYY-MM-DD');}}if(_0x176b2b[_0xcf5a('0x1c')]){_0x2c6b69=_0x176b2b[_0xcf5a('0x1c')];_0xdb06e7[_0xcf5a('0x1d')]=_0xcf5a('0x1e')+_0x379f96+'.'+_0x176b2b['field']+_0xcf5a('0x1f')+_0x176b2b[_0xcf5a('0x1c')]+')\x20'+parseOperator(_0x176b2b[_0xcf5a('0x12')]);}else{_0xdb06e7[_0xcf5a('0x1d')]=_0x379f96+'.'+_0x176b2b[_0xcf5a('0x20')]+'\x20'+parseOperator(_0x176b2b[_0xcf5a('0x12')]);}if(_[_0xcf5a('0x16')](['$ne',_0xcf5a('0x21')],_0x176b2b['operator']))_0xdb06e7[_0xcf5a('0x1d')]='('+_0xdb06e7[_0xcf5a('0x1d')]+_0xcf5a('0x22')+_0x379f96+'.'+_0x176b2b['field']+'\x20IS\x20NULL)';_0xdb06e7['value']=parseValue(_0x2c6b69,_0x176b2b['operator'],_0x176b2b[_0xcf5a('0x15')]);return _0xdb06e7;};function parseOperator(_0x2f1e8a){var _0x356768;switch(_0x2f1e8a){case'$in':_0x356768=_0xcf5a('0x23');break;case _0xcf5a('0x21'):_0x356768=_0xcf5a('0x24');break;case'$eq':_0x356768=_0xcf5a('0x25');break;case _0xcf5a('0x26'):_0x356768=_0xcf5a('0x27');break;case'$substring':case _0xcf5a('0x28'):case _0xcf5a('0x29'):_0x356768=_0xcf5a('0x2a');break;case _0xcf5a('0x2b'):_0x356768=_0xcf5a('0x2c');break;case _0xcf5a('0x17'):_0x356768=_0xcf5a('0x2d');break;case'$lte':_0x356768=_0xcf5a('0x2e');break;case _0xcf5a('0x2f'):_0x356768=_0xcf5a('0x30');break;case _0xcf5a('0x14'):_0x356768=_0xcf5a('0x31');break;}return _0x356768;}function parseValue(_0x294fce,_0xfd9b36,_0x2371fe){var _0x5c1c80={'start':undefined,'end':undefined};switch(_0xfd9b36){case _0xcf5a('0x32'):case'$notIn':_0x5c1c80[_0xcf5a('0x33')]=_0x2371fe[_0xcf5a('0xa')](',');break;case _0xcf5a('0x34'):_0x5c1c80[_0xcf5a('0x33')]='%'+_0x2371fe+'%';break;case'$startsWith':_0x5c1c80[_0xcf5a('0x33')]=_0x2371fe+'%';break;case _0xcf5a('0x29'):_0x5c1c80[_0xcf5a('0x33')]='%'+_0x2371fe;break;case _0xcf5a('0x14'):var _0x34b7fd=_0x2371fe[_0xcf5a('0xa')](',');var _0x2371fe=_0x34b7fd['shift']();var _0x3efb20=_0x34b7fd['pop']();if(_0x294fce==='DATE'){_0x2371fe=moment(_0x2371fe)['utcOffset'](0x0,!![])[_0xcf5a('0x1b')]();_0x3efb20=moment(_0x3efb20)['utcOffset'](0x0,!![])[_0xcf5a('0x19')](0x17,_0xcf5a('0x35'))[_0xcf5a('0x19')](0x3b,_0xcf5a('0x36'))[_0xcf5a('0x19')](0x3b,_0xcf5a('0x37'))[_0xcf5a('0x1b')]();}_0x5c1c80={'start':_0x2371fe,'end':_0x3efb20};break;default:_0x5c1c80['start']=_0x2371fe;break;}return _0x5c1c80;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 379c24e..4de6394 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 _0xe015=['cast','unsigned','substr','DESC','ASC','omit','isArray','length','isObject','isString','hasOwnProperty','isNumeric','getFullTextValue','forEach','replace','join','getOptions','query','$id','model','intersection','attributes','nolimit','offset','order','where','pick','filter','columns','name','value','VIRTUAL','lower','merge','options','lodash','sequelize','moment','keys','includes','parse','fields','split','filters','isEmpty','find','type','$gte','format','YYYY-MM-DD','utc','uniqueid','limit','sort','map','priority'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe015,0x13b));var _0x5e01=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xe015[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x5e01('0x0'));var sequelize=require(_0x5e01('0x1'));var moment=require(_0x5e01('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5811ae){var _0x51f689=['ne'];try{var _0x46ed0d=JSON['parse'](_0x5811ae);var _0x2136cf=Object[_0x5e01('0x3')](_0x46ed0d)[0x0];return _0x51f689[_0x5e01('0x4')](_0x2136cf);}catch(_0x241c0e){return![];}}function getOperatorValue(_0x4ac3f1){var _0x1814cb=JSON[_0x5e01('0x5')](_0x4ac3f1);var _0x4de678=Object['keys'](_0x1814cb)[0x0];var _0x414f73=_0x1814cb[_0x4de678];return{['$'+_0x4de678]:_0x414f73};}exports[_0x5e01('0x6')]=function(_0x1420c2){var _0x40d31f=null;if(_0x1420c2){_0x40d31f=_0x1420c2[_0x5e01('0x7')](',');}return _0x40d31f;};exports[_0x5e01('0x8')]=function(_0x5b3938,_0x1c4a44){var _0x502518={};if(!_[_0x5e01('0x9')](_0x5b3938)){_['forOwn'](_0x5b3938,function(_0x3c2ea2,_0x406b26){try{if(_0x1c4a44){var _0x553a53=_[_0x5e01('0xa')](_0x1c4a44,{'name':_0x406b26})||{};if(hasSequelizeOperator(_0x3c2ea2)){_0x502518[_0x406b26]=getOperatorValue(_0x3c2ea2);}else if(_0x553a53[_0x5e01('0xb')]==='DATE'&&_['isPlainObject'](_0x3c2ea2)){var _0x3d0b04=JSON[_0x5e01('0x5')](_0x3c2ea2);var _0x468901={'$gte':moment(moment(_0x3d0b04[_0x5e01('0xc')])[_0x5e01('0xd')](_0x5e01('0xe')))['utc']()[_0x5e01('0xd')](),'$lte':moment(moment(_0x3d0b04['$lte'])['format'](_0x5e01('0xe')))[_0x5e01('0xf')]()['subtract'](0x1,'s')[_0x5e01('0xd')]()};_0x502518[_0x406b26]=_0x468901;}else if(_0x553a53['name']===_0x5e01('0x10')){_0x502518[_0x406b26]=_0x3c2ea2;}else{_0x502518[_0x406b26]=_['isArray'](_0x3c2ea2)?_0x3c2ea2:JSON[_0x5e01('0x5')](_0x3c2ea2);}}else{_0x502518[_0x406b26]=_['isArray'](_0x3c2ea2)?_0x3c2ea2:JSON[_0x5e01('0x5')](_0x3c2ea2);}}catch(_0x5eda1d){_0x502518[_0x406b26]=_0x3c2ea2['split'](',');}});}return _0x502518;};exports[_0x5e01('0x11')]=function(_0x42b4f8){_0x42b4f8=parseInt(_0x42b4f8,0xa);if(!_0x42b4f8||_0x42b4f8<0x0){_0x42b4f8=LIMIT_VALUE;}return _0x42b4f8;};exports['offset']=function(_0xce3f3f){_0xce3f3f=parseInt(_0xce3f3f,0xa);if(!_0xce3f3f||_0xce3f3f<0x0){_0xce3f3f=0x0;}return _0xce3f3f;};exports[_0x5e01('0x12')]=function(_0x36b4a7){var _0x45e543,_0x396cf3=null;if(_0x36b4a7){_0x45e543=_0x36b4a7[_0x5e01('0x7')](',');_0x396cf3=_[_0x5e01('0x13')](_0x45e543,function(_0x153eb1){if(_0x153eb1['indexOf']('-')===0x0){return[_0x153eb1===_0x5e01('0x14')?sequelize[_0x5e01('0x15')](sequelize['col'](_0x5e01('0x14')),_0x5e01('0x16')):_0x153eb1[_0x5e01('0x17')](0x1),_0x5e01('0x18')];}else{return[_0x153eb1===_0x5e01('0x14')?sequelize[_0x5e01('0x15')](sequelize['col'](_0x5e01('0x14')),_0x5e01('0x16')):_0x153eb1,_0x5e01('0x19')];}});}return _0x396cf3;};exports[_0x5e01('0x1a')]=function(_0x514ade,_0x557f06){if(_[_0x5e01('0x9')](_0x514ade)){return _0x514ade;}if(_[_0x5e01('0x1b')](_0x514ade)){for(var _0x4f94d0=0x0;_0x4f94d0<_0x514ade[_0x5e01('0x1c')];_0x4f94d0+=0x1){_0x514ade[_0x4f94d0]=this[_0x5e01('0x1a')](_0x514ade[_0x4f94d0],_0x557f06);}return _0x514ade;}if(!_[_0x5e01('0x1d')](_0x514ade)){return _0x514ade;}if(_[_0x5e01('0x1e')](_0x557f06)){_0x557f06=[_0x557f06];}if(!_['isArray'](_0x557f06)){return _0x514ade;}for(var _0x4d0ebe=0x0;_0x4d0ebe<_0x557f06[_0x5e01('0x1c')];_0x4d0ebe+=0x1){_['unset'](_0x514ade,_0x557f06[_0x4d0ebe]);}for(var _0x14b9f5 in _0x514ade){if(_0x514ade[_0x5e01('0x1f')](_0x14b9f5)){_0x514ade[_0x14b9f5]=this[_0x5e01('0x1a')](_0x514ade[_0x14b9f5],_0x557f06);}}return _0x514ade;};exports[_0x5e01('0x20')]=function(_0x592a61){return _0x592a61['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x350ab4){return _0x350ab4['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x5e01('0x21')]=function(_0x37b32a){var _0xc6d3c2=[];_0x37b32a['split'](/[ ,]+/)[_0x5e01('0x22')](function(_0x36d7a8){_0x36d7a8=_0x36d7a8[_0x5e01('0x23')](/([^:]")"+/g,'$1');_0x36d7a8='+'+_0x36d7a8+'*';var _0x33b3b3=/[ `!@#$%^&*()_\-?~]/;if(_0x36d7a8['match'](_0x33b3b3))_0x36d7a8='\x22'+_0x36d7a8+'\x22';_0xc6d3c2['push'](_0x36d7a8);});return _0xc6d3c2[_0x5e01('0x24')]('\x20');};exports[_0x5e01('0x25')]=function(_0x308649,_0x207107,_0x350659){var _0x1a0ebe={},_0x2bc93b={};if(_0x207107[_0x5e01('0x26')][_0x5e01('0x27')]){_0x207107[_0x5e01('0x26')]['id']=_0x207107[_0x5e01('0x26')][_0x5e01('0x27')];delete _0x207107['query'][_0x5e01('0x27')];}_0x1a0ebe[_0x5e01('0x28')]=_[_0x5e01('0x13')](_0x308649,'name');_0x1a0ebe[_0x5e01('0x26')]=_[_0x5e01('0x3')](_0x207107['query']);_0x1a0ebe[_0x5e01('0x8')]=_[_0x5e01('0x29')](_0x1a0ebe[_0x5e01('0x28')],_0x1a0ebe['query']);_0x2bc93b[_0x5e01('0x2a')]=_[_0x5e01('0x29')](_0x1a0ebe[_0x5e01('0x28')],this[_0x5e01('0x6')](_0x207107[_0x5e01('0x26')][_0x5e01('0x6')]));_0x2bc93b[_0x5e01('0x2a')]=_0x2bc93b[_0x5e01('0x2a')][_0x5e01('0x1c')]?_0x2bc93b[_0x5e01('0x2a')]:_0x1a0ebe[_0x5e01('0x28')];if(!_0x207107[_0x5e01('0x26')][_0x5e01('0x1f')](_0x5e01('0x2b'))){_0x2bc93b[_0x5e01('0x11')]=this['limit'](_0x207107[_0x5e01('0x26')]['limit']);_0x2bc93b['offset']=this[_0x5e01('0x2c')](_0x207107[_0x5e01('0x26')][_0x5e01('0x2c')]);}_0x2bc93b[_0x5e01('0x2d')]=this[_0x5e01('0x12')](_0x207107['query'][_0x5e01('0x12')]);_0x2bc93b[_0x5e01('0x2e')]=this['filters'](_[_0x5e01('0x2f')](_0x207107[_0x5e01('0x26')],_0x1a0ebe[_0x5e01('0x8')]),_0x308649);if(_0x207107['query'][_0x5e01('0x30')]){var _0xfed2d2=_0x308649;var _0x503c8c=_0x207107[_0x5e01('0x26')][_0x5e01('0x30')];if(typeof _0x503c8c==='object'){_0xfed2d2=_['filter'](_0x308649,function(_0xce5f1b){return _['includes'](_0x503c8c[_0x5e01('0x31')],_0xce5f1b[_0x5e01('0x32')]);});_0x503c8c=_0x503c8c[_0x5e01('0x33')];}_0x2bc93b[_0x5e01('0x2e')]=_['merge'](_0x2bc93b[_0x5e01('0x2e')],{'$or':_[_0x5e01('0x13')](_0xfed2d2,function(_0x23275f){if(_0x23275f[_0x5e01('0xb')]!==_0x5e01('0x34')){if(_0x350659){return sequelize[_0x5e01('0x2e')](sequelize['fn'](_0x5e01('0x35'),sequelize['col'](_0x23275f[_0x5e01('0x32')])),{'$like':sequelize['fn'](_0x5e01('0x35'),'%'+_0x207107[_0x5e01('0x26')][_0x5e01('0x30')]+'%')});}else{var _0x1fb95f={};_0x1fb95f[_0x23275f['name']]={'$like':'%'+_0x207107[_0x5e01('0x26')][_0x5e01('0x30')]+'%'};return _0x1fb95f;}}})});}_0x2bc93b=_[_0x5e01('0x36')]({},_0x2bc93b,_0x207107[_0x5e01('0x37')]);return _0x2bc93b;}; \ No newline at end of file +var _0xf072=['DESC','unsigned','ASC','omit','isString','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','intersection','attributes','nolimit','limit','offset','pick','filter','object','includes','columns','where','merge','type','lower','col','options','lodash','sequelize','moment','parse','keys','fields','split','filters','forOwn','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','isArray','sort','map','cast','priority','substr'];(function(_0x220d63,_0x2ac173){var _0xffccaa=function(_0x6b794b){while(--_0x6b794b){_0x220d63['push'](_0x220d63['shift']());}};_0xffccaa(++_0x2ac173);}(_0xf072,0x1cf));var _0x2f07=function(_0x28af91,_0x547b27){_0x28af91=_0x28af91-0x0;var _0x2943bf=_0xf072[_0x28af91];return _0x2943bf;};'use strict';var _=require(_0x2f07('0x0'));var sequelize=require(_0x2f07('0x1'));var moment=require(_0x2f07('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4f62b0){var _0x3c1c25=['ne'];try{var _0x5f20e3=JSON[_0x2f07('0x3')](_0x4f62b0);var _0x432696=Object[_0x2f07('0x4')](_0x5f20e3)[0x0];return _0x3c1c25['includes'](_0x432696);}catch(_0x1d5a33){return![];}}function getOperatorValue(_0x14d6e6){var _0x3643bb=JSON[_0x2f07('0x3')](_0x14d6e6);var _0x235418=Object[_0x2f07('0x4')](_0x3643bb)[0x0];var _0x33b99c=_0x3643bb[_0x235418];return{['$'+_0x235418]:_0x33b99c};}exports[_0x2f07('0x5')]=function(_0x4746c2){var _0x2e167=null;if(_0x4746c2){_0x2e167=_0x4746c2[_0x2f07('0x6')](',');}return _0x2e167;};exports[_0x2f07('0x7')]=function(_0x1a3848,_0x18fe13){var _0x14e237={};if(!_['isEmpty'](_0x1a3848)){_[_0x2f07('0x8')](_0x1a3848,function(_0x2f464b,_0x1d0812){try{if(_0x18fe13){var _0x3525be=_['find'](_0x18fe13,{'name':_0x1d0812})||{};if(hasSequelizeOperator(_0x2f464b)){_0x14e237[_0x1d0812]=getOperatorValue(_0x2f464b);}else if(_0x3525be['type']===_0x2f07('0x9')&&_[_0x2f07('0xa')](_0x2f464b)){var _0x58549c=JSON[_0x2f07('0x3')](_0x2f464b);var _0x34dbd4={'$gte':moment(moment(_0x58549c[_0x2f07('0xb')])['format'](_0x2f07('0xc')))[_0x2f07('0xd')]()[_0x2f07('0xe')](),'$lte':moment(moment(_0x58549c[_0x2f07('0xf')])[_0x2f07('0xe')](_0x2f07('0xc')))['utc']()[_0x2f07('0x10')](0x1,'s')['format']()};_0x14e237[_0x1d0812]=_0x34dbd4;}else if(_0x3525be[_0x2f07('0x11')]===_0x2f07('0x12')){_0x14e237[_0x1d0812]=_0x2f464b;}else{_0x14e237[_0x1d0812]=_[_0x2f07('0x13')](_0x2f464b)?_0x2f464b:JSON[_0x2f07('0x3')](_0x2f464b);}}else{_0x14e237[_0x1d0812]=_[_0x2f07('0x13')](_0x2f464b)?_0x2f464b:JSON[_0x2f07('0x3')](_0x2f464b);}}catch(_0x1a6135){_0x14e237[_0x1d0812]=_0x2f464b[_0x2f07('0x6')](',');}});}return _0x14e237;};exports['limit']=function(_0x15c3dd){_0x15c3dd=parseInt(_0x15c3dd,0xa);if(!_0x15c3dd||_0x15c3dd<0x0){_0x15c3dd=LIMIT_VALUE;}return _0x15c3dd;};exports['offset']=function(_0x3cd3c0){_0x3cd3c0=parseInt(_0x3cd3c0,0xa);if(!_0x3cd3c0||_0x3cd3c0<0x0){_0x3cd3c0=0x0;}return _0x3cd3c0;};exports[_0x2f07('0x14')]=function(_0x119b68){var _0xd944d6,_0x2ef47d=null;if(_0x119b68){_0xd944d6=_0x119b68['split'](',');_0x2ef47d=_[_0x2f07('0x15')](_0xd944d6,function(_0x5a0146){if(_0x5a0146['indexOf']('-')===0x0){return[_0x5a0146==='priority'?sequelize[_0x2f07('0x16')](sequelize['col'](_0x2f07('0x17')),'unsigned'):_0x5a0146[_0x2f07('0x18')](0x1),_0x2f07('0x19')];}else{return[_0x5a0146===_0x2f07('0x17')?sequelize[_0x2f07('0x16')](sequelize['col'](_0x2f07('0x17')),_0x2f07('0x1a')):_0x5a0146,_0x2f07('0x1b')];}});}return _0x2ef47d;};exports['omit']=function(_0x111376,_0x113916){if(_['isEmpty'](_0x111376)){return _0x111376;}if(_[_0x2f07('0x13')](_0x111376)){for(var _0x1c9ca1=0x0;_0x1c9ca1<_0x111376['length'];_0x1c9ca1+=0x1){_0x111376[_0x1c9ca1]=this[_0x2f07('0x1c')](_0x111376[_0x1c9ca1],_0x113916);}return _0x111376;}if(!_['isObject'](_0x111376)){return _0x111376;}if(_[_0x2f07('0x1d')](_0x113916)){_0x113916=[_0x113916];}if(!_[_0x2f07('0x13')](_0x113916)){return _0x111376;}for(var _0x27bd72=0x0;_0x27bd72<_0x113916[_0x2f07('0x1e')];_0x27bd72+=0x1){_[_0x2f07('0x1f')](_0x111376,_0x113916[_0x27bd72]);}for(var _0x139ea8 in _0x111376){if(_0x111376[_0x2f07('0x20')](_0x139ea8)){_0x111376[_0x139ea8]=this[_0x2f07('0x1c')](_0x111376[_0x139ea8],_0x113916);}}return _0x111376;};exports[_0x2f07('0x21')]=function(_0x468cd8){return _0x468cd8[_0x2f07('0x22')](RegExp(_0x2f07('0x23')))?!![]:![];};exports['isEmail']=function(_0x1accef){return _0x1accef[_0x2f07('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x2f07('0x24')]=function(_0x571839){var _0x36d4b8=[];_0x571839[_0x2f07('0x6')](/[ ,]+/)[_0x2f07('0x25')](function(_0x5ad0de){_0x5ad0de=_0x5ad0de[_0x2f07('0x26')](/([^:]")"+/g,'$1');_0x5ad0de='+'+_0x5ad0de+'*';var _0x368e3d=/[ `!@#$%^&*()_\-?~]/;if(_0x5ad0de[_0x2f07('0x22')](_0x368e3d))_0x5ad0de='\x22'+_0x5ad0de+'\x22';_0x36d4b8[_0x2f07('0x27')](_0x5ad0de);});return _0x36d4b8[_0x2f07('0x28')]('\x20');};exports[_0x2f07('0x29')]=function(_0x3fed73,_0x5c7593,_0x1decd1){var _0x5b0407={},_0x3496eb={};if(_0x5c7593[_0x2f07('0x2a')][_0x2f07('0x2b')]){_0x5c7593[_0x2f07('0x2a')]['id']=_0x5c7593[_0x2f07('0x2a')][_0x2f07('0x2b')];delete _0x5c7593[_0x2f07('0x2a')][_0x2f07('0x2b')];}_0x5b0407[_0x2f07('0x2c')]=_[_0x2f07('0x15')](_0x3fed73,_0x2f07('0x11'));_0x5b0407[_0x2f07('0x2a')]=_[_0x2f07('0x4')](_0x5c7593[_0x2f07('0x2a')]);_0x5b0407[_0x2f07('0x7')]=_[_0x2f07('0x2d')](_0x5b0407['model'],_0x5b0407['query']);_0x3496eb[_0x2f07('0x2e')]=_[_0x2f07('0x2d')](_0x5b0407[_0x2f07('0x2c')],this['fields'](_0x5c7593['query'][_0x2f07('0x5')]));_0x3496eb['attributes']=_0x3496eb[_0x2f07('0x2e')][_0x2f07('0x1e')]?_0x3496eb[_0x2f07('0x2e')]:_0x5b0407[_0x2f07('0x2c')];if(!_0x5c7593[_0x2f07('0x2a')]['hasOwnProperty'](_0x2f07('0x2f'))){_0x3496eb['limit']=this[_0x2f07('0x30')](_0x5c7593['query'][_0x2f07('0x30')]);_0x3496eb['offset']=this['offset'](_0x5c7593[_0x2f07('0x2a')][_0x2f07('0x31')]);}_0x3496eb['order']=this[_0x2f07('0x14')](_0x5c7593[_0x2f07('0x2a')][_0x2f07('0x14')]);_0x3496eb['where']=this[_0x2f07('0x7')](_[_0x2f07('0x32')](_0x5c7593[_0x2f07('0x2a')],_0x5b0407[_0x2f07('0x7')]),_0x3fed73);if(_0x5c7593[_0x2f07('0x2a')][_0x2f07('0x33')]){var _0x1a0ef2=_0x3fed73;var _0x1a9645=_0x5c7593['query'][_0x2f07('0x33')];if(typeof _0x1a9645===_0x2f07('0x34')){_0x1a0ef2=_[_0x2f07('0x33')](_0x3fed73,function(_0x3f1b6b){return _[_0x2f07('0x35')](_0x1a9645[_0x2f07('0x36')],_0x3f1b6b[_0x2f07('0x11')]);});_0x1a9645=_0x1a9645['value'];}_0x3496eb[_0x2f07('0x37')]=_[_0x2f07('0x38')](_0x3496eb[_0x2f07('0x37')],{'$or':_[_0x2f07('0x15')](_0x1a0ef2,function(_0x3db7ad){if(_0x3db7ad[_0x2f07('0x39')]!=='VIRTUAL'){if(_0x1decd1){return sequelize[_0x2f07('0x37')](sequelize['fn'](_0x2f07('0x3a'),sequelize[_0x2f07('0x3b')](_0x3db7ad[_0x2f07('0x11')])),{'$like':sequelize['fn']('lower','%'+_0x5c7593['query'][_0x2f07('0x33')]+'%')});}else{var _0x437e94={};_0x437e94[_0x3db7ad[_0x2f07('0x11')]]={'$like':'%'+_0x5c7593[_0x2f07('0x2a')]['filter']+'%'};return _0x437e94;}}})});}_0x3496eb=_[_0x2f07('0x38')]({},_0x3496eb,_0x5c7593[_0x2f07('0x3c')]);return _0x3496eb;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index ad4fdf0..ad89e5d 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x2c2390,_0x37ef1c){var _0x478b7e=function(_0x2ea947){while(--_0x2ea947){_0x2c2390['push'](_0x2c2390['shift']());}};_0x478b7e(++_0x37ef1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 15d9ff8..4848d0b 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 _0xb10d=['child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','md5','update','digest','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','substring','lodash','crypto'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xb10d,0xc1));var _0xdb10=function(_0x11eca2,_0x194a9f){_0x11eca2=_0x11eca2-0x0;var _0x3ab3eb=_0xb10d[_0x11eca2];return _0x3ab3eb;};'use strict';var _=require(_0xdb10('0x0'));var os=require('os');var crypto=require(_0xdb10('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xdb10('0x2'))[_0xdb10('0x3')];var config=require(_0xdb10('0x4'));function getInterfaces(){var _0x190c18=[];var _0x4772d0=os[_0xdb10('0x5')]();var _0x3236b2=_[_0xdb10('0x6')](_[_0xdb10('0x7')](_0x4772d0));for(var _0x19d201=0x0;_0x19d201<_0x3236b2[_0xdb10('0x8')];_0x19d201++){var _0x3b3435=_0x4772d0[_0x3236b2[_0x19d201]][_0xdb10('0x9')](function(_0x611990){return _0x611990[_0xdb10('0xa')]==='IPv4'&&_0x611990[_0xdb10('0xb')]===![];});_0x190c18=_0x190c18[_0xdb10('0xc')](_0x3b3435);}return _0x190c18;}function getFirstInterface(){var _0x482aa4=_['head'](getInterfaces());return{'macAddress':_0x482aa4&&_0x482aa4['mac']?_0x482aa4[_0xdb10('0xd')]:_0xdb10('0xe'),'ipAddress':_0x482aa4&&_0x482aa4[_0xdb10('0xf')]?_0x482aa4[_0xdb10('0xf')]:_0xdb10('0x10')};}exports[_0xdb10('0x11')]=getFirstInterface;function getCPUhash(){var _0x4b471a=_[_0xdb10('0x6')](os[_0xdb10('0x12')]()[_0xdb10('0x13')](function(_0xd70084){return _0xd70084[_0xdb10('0x14')];}))[_0xdb10('0x15')](':');return crypto['createHash'](_0xdb10('0x16'))[_0xdb10('0x17')](_0x4b471a)[_0xdb10('0x18')](_0xdb10('0x19'));}exports[_0xdb10('0x1a')]=function(){var _0x5d3fa7=os[_0xdb10('0x1b')]();var _0x34dddf=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x34dddf[_0xdb10('0x1c')](config['licenseToken'])){return config[_0xdb10('0x1d')];}else if(_0x5d3fa7===_0xdb10('0x1e')){return exec(_0xdb10('0x1f'),{'encoding':_0xdb10('0x20')})[_0xdb10('0x21')]('\x0d\x0a','');}else{var _0x12d09f=getFirstInterface();var _0x5efb78=getCPUhash();var _0xdf82a8=_0x5efb78+'|'+os[_0xdb10('0x22')]()+'|'+_0x12d09f[_0xdb10('0x23')]+'|'+_0x12d09f[_0xdb10('0x24')];var _0xc69bc3=crypto[_0xdb10('0x25')]('md5')['update'](_0xdf82a8)[_0xdb10('0x18')]('hex');return _0xc69bc3[_0xdb10('0x26')](0x0,0x8)+'-'+_0xc69bc3[_0xdb10('0x26')](0x8,0xc)+'-'+_0xc69bc3['substring'](0xc,0x10)+'-'+_0xc69bc3['substring'](0x10,0x14)+'-'+_0xc69bc3['substring'](0x14);}}; \ No newline at end of file +var _0x3929=['map','createHash','md5','update','digest','hex','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','child_process','execSync','../environment','orderBy','keys','length','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x3929,0x1c9));var _0x9392=function(_0x3b4137,_0x46c8b5){_0x3b4137=_0x3b4137-0x0;var _0x578ed4=_0x3929[_0x3b4137];return _0x578ed4;};'use strict';var _=require(_0x9392('0x0'));var os=require('os');var crypto=require(_0x9392('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x9392('0x2'))[_0x9392('0x3')];var config=require(_0x9392('0x4'));function getInterfaces(){var _0x215b9d=[];var _0x4a0a36=os['networkInterfaces']();var _0x1b7a89=_[_0x9392('0x5')](_[_0x9392('0x6')](_0x4a0a36));for(var _0xa9aca6=0x0;_0xa9aca6<_0x1b7a89[_0x9392('0x7')];_0xa9aca6++){var _0x543913=_0x4a0a36[_0x1b7a89[_0xa9aca6]][_0x9392('0x8')](function(_0x3d2933){return _0x3d2933[_0x9392('0x9')]===_0x9392('0xa')&&_0x3d2933[_0x9392('0xb')]===![];});_0x215b9d=_0x215b9d[_0x9392('0xc')](_0x543913);}return _0x215b9d;}function getFirstInterface(){var _0xc321bf=_['head'](getInterfaces());return{'macAddress':_0xc321bf&&_0xc321bf[_0x9392('0xd')]?_0xc321bf[_0x9392('0xd')]:_0x9392('0xe'),'ipAddress':_0xc321bf&&_0xc321bf[_0x9392('0xf')]?_0xc321bf[_0x9392('0xf')]:_0x9392('0x10')};}exports[_0x9392('0x11')]=getFirstInterface;function getCPUhash(){var _0x4c4d7c=_[_0x9392('0x5')](os[_0x9392('0x12')]()[_0x9392('0x13')](function(_0x52928f){return _0x52928f['model'];}))['join'](':');return crypto[_0x9392('0x14')](_0x9392('0x15'))[_0x9392('0x16')](_0x4c4d7c)[_0x9392('0x17')](_0x9392('0x18'));}exports['getUuid']=function(){var _0x11016a=os[_0x9392('0x19')]();var _0x35d34c=/[0-9a-f-]{36}/;if(config[_0x9392('0x1a')]&&_0x35d34c[_0x9392('0x1b')](config[_0x9392('0x1a')])){return config[_0x9392('0x1a')];}else if(_0x11016a==='win32'){return exec(_0x9392('0x1c'),{'encoding':'utf8'})[_0x9392('0x1d')]('\x0d\x0a','');}else{var _0x5bae66=getFirstInterface();var _0x31e3a5=getCPUhash();var _0x4b9953=_0x31e3a5+'|'+os[_0x9392('0x1e')]()+'|'+_0x5bae66[_0x9392('0x1f')]+'|'+_0x5bae66[_0x9392('0x20')];var _0x534c6d=crypto[_0x9392('0x14')](_0x9392('0x15'))[_0x9392('0x16')](_0x4b9953)[_0x9392('0x17')](_0x9392('0x18'));return _0x534c6d['substring'](0x0,0x8)+'-'+_0x534c6d['substring'](0x8,0xc)+'-'+_0x534c6d[_0x9392('0x21')](0xc,0x10)+'-'+_0x534c6d['substring'](0x10,0x14)+'-'+_0x534c6d[_0x9392('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 83a232a..1d95563 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 _0x01a9=['toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','spread','default','util','moment','request-promise','pkginfo','version','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','get','data2','data1','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0x01a9,0x12c));var _0x901a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x01a9[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x901a('0x0'));var moment=require(_0x901a('0x1'));var rp=require(_0x901a('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x901a('0x3'))(module,_0x901a('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x901a('0x5'));var hardware=require(_0x901a('0x6'));var logger=require(_0x901a('0x7'))('license');var HOST=_0x901a('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x42e251){return new BPromise(function(_0x504d2d,_0x29695f){var _0x524d82=util[_0x901a('0x9')](_0x901a('0xa'),HOST,_0x42e251,module['exports'][_0x901a('0x4')]);if(oldToken){_0x524d82=util['format'](_0x901a('0xb'),HOST,_0x42e251,module[_0x901a('0xc')][_0x901a('0x4')],oldToken);}var _0x49a15e={'uri':_0x524d82,'method':_0x901a('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x49a15e)[_0x901a('0xe')](function(_0x4348c1){_0x504d2d(_0x4348c1);})[_0x901a('0xf')](function(_0x3f4d6a){_0x29695f(_0x3f4d6a);});});}function manageLicense(_0x4adf83,_0xf34515){var _0x4e62c2=_0xf34515[_0x901a('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x4e62c2['data1']!==_0x4adf83&&!_0x4e62c2[_0x901a('0x11')]){oldToken=_0x4e62c2[_0x901a('0x12')];}httpRequest(_0x4adf83)[_0x901a('0xe')](function(_0x3353f6){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3353f6['active']){isOldTokenSent=![];if(!_0x4e62c2[_0x901a('0x13')]&&_0x4e62c2[_0x901a('0x13')]!=_0x3353f6[_0x901a('0x13')]||_0x4e62c2[_0x901a('0x13')]&&_0x4e62c2[_0x901a('0x11')]){logger[_0x901a('0x14')](_0x901a('0x15'));}if(_0x4e62c2[_0x901a('0x13')]&&!_0x4e62c2[_0x901a('0x11')]&&_0x4e62c2[_0x901a('0x13')]!=_0x3353f6['license']){logger[_0x901a('0x14')](_0x901a('0x16'));}if(_0x4e62c2[_0x901a('0x13')]&&!_0x4e62c2[_0x901a('0x11')]&&_0x4e62c2[_0x901a('0x13')]==_0x3353f6['license']){return _0xf34515;}return _0xf34515[_0x901a('0x17')]({'data1':_0x4adf83,'data2':null,'license':_0x3353f6[_0x901a('0x13')]});}else{if(_0x3353f6[_0x901a('0x13')]||_0x4e62c2[_0x901a('0x13')]){if(!_0x4e62c2[_0x901a('0x11')]){if(_0x4e62c2[_0x901a('0x12')]==_0x4adf83){GRAY_PERIOD_REASON=_0x901a('0x18');logger['info'](_0x901a('0x19'));}else{GRAY_PERIOD_REASON=_0x901a('0x1a');logger[_0x901a('0x14')](_0x901a('0x1b'),_0x4e62c2['data1'],_0x4adf83);}logger[_0x901a('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x901a('0x1c')](),moment()[_0x901a('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0xf34515[_0x901a('0x17')]({'data2':encryptor[_0x901a('0x1d')](moment()[_0x901a('0x9')](_0x901a('0x1e')))});}else{if(moment()[_0x901a('0x1f')](encryptor[_0x901a('0x20')](_0x4e62c2[_0x901a('0x11')]),'days')>DAYS){logger[_0x901a('0x14')](_0x901a('0x21'),moment()[_0x901a('0x9')](_0x901a('0x1e')));isOldTokenSent=![];return _0xf34515[_0x901a('0x17')]({'data1':_0x4adf83,'data2':null,'license':null});}}}else{if(_0x4e62c2[_0x901a('0x12')]!=_0x4adf83){logger['info'](_0x901a('0x1b'),_0x4e62c2[_0x901a('0x12')],_0x4adf83);return _0xf34515[_0x901a('0x17')]({'data1':_0x4adf83,'data2':null,'license':null});}}}return _0xf34515;})['then'](function(_0x1f19d2){_0xf34515=_0x1f19d2;})['catch'](function(_0x3b4e6a){logger[_0x901a('0x22')](_0x3b4e6a[_0x901a('0x23')]);})[_0x901a('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0x901a('0x25')](),_0xf34515);},TIME);});}function defaultLicense(){var _0x120801=hardware[_0x901a('0x25')]();if(_0x120801){return db['License'][_0x901a('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x120801}})[_0x901a('0x27')](function(_0x262835,_0x229e1b){logger[_0x901a('0x14')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x120801);manageLicense(_0x120801,_0x262835);})[_0x901a('0xf')](function(_0x5c6521){logger[_0x901a('0x22')](_0x5c6521[_0x901a('0x23')]);});}}exports[_0x901a('0x28')]=defaultLicense; \ No newline at end of file +var _0x22a3=['Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','exports','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','data1'];(function(_0xf1ac50,_0x36c946){var _0xbc7f72=function(_0x131753){while(--_0x131753){_0xf1ac50['push'](_0xf1ac50['shift']());}};_0xbc7f72(++_0x36c946);}(_0x22a3,0x195));var _0x322a=function(_0x235ba6,_0x315773){_0x235ba6=_0x235ba6-0x0;var _0x2aa7c4=_0x22a3[_0x235ba6];return _0x2aa7c4;};'use strict';var util=require(_0x322a('0x0'));var moment=require(_0x322a('0x1'));var rp=require(_0x322a('0x2'));var BPromise=require(_0x322a('0x3'));var pkginfo=require(_0x322a('0x4'))(module,'version');var db=require(_0x322a('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x322a('0x6'));var logger=require(_0x322a('0x7'))(_0x322a('0x8'));var HOST=_0x322a('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2ca940){return new BPromise(function(_0x537701,_0x1a8974){var _0x776ef1=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x2ca940,module[_0x322a('0xa')][_0x322a('0xb')]);if(oldToken){_0x776ef1=util[_0x322a('0xc')](_0x322a('0xd'),HOST,_0x2ca940,module[_0x322a('0xa')][_0x322a('0xb')],oldToken);}var _0x130368={'uri':_0x776ef1,'method':_0x322a('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x130368)[_0x322a('0xf')](function(_0x4e7ff2){_0x537701(_0x4e7ff2);})[_0x322a('0x10')](function(_0x249016){_0x1a8974(_0x249016);});});}function manageLicense(_0x1c61bc,_0x2e6fc9){var _0x38e962=_0x2e6fc9[_0x322a('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x38e962['data1']!==_0x1c61bc&&!_0x38e962[_0x322a('0x12')]){oldToken=_0x38e962['data1'];}httpRequest(_0x1c61bc)['then'](function(_0x2b8da6){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2b8da6[_0x322a('0x13')]){isOldTokenSent=![];if(!_0x38e962['license']&&_0x38e962[_0x322a('0x8')]!=_0x2b8da6[_0x322a('0x8')]||_0x38e962[_0x322a('0x8')]&&_0x38e962[_0x322a('0x12')]){logger[_0x322a('0x14')](_0x322a('0x15'));}if(_0x38e962[_0x322a('0x8')]&&!_0x38e962[_0x322a('0x12')]&&_0x38e962['license']!=_0x2b8da6[_0x322a('0x8')]){logger[_0x322a('0x14')](_0x322a('0x16'));}if(_0x38e962[_0x322a('0x8')]&&!_0x38e962[_0x322a('0x12')]&&_0x38e962[_0x322a('0x8')]==_0x2b8da6[_0x322a('0x8')]){return _0x2e6fc9;}return _0x2e6fc9[_0x322a('0x17')]({'data1':_0x1c61bc,'data2':null,'license':_0x2b8da6['license']});}else{if(_0x2b8da6[_0x322a('0x8')]||_0x38e962[_0x322a('0x8')]){if(!_0x38e962[_0x322a('0x12')]){if(_0x38e962[_0x322a('0x18')]==_0x1c61bc){GRAY_PERIOD_REASON=_0x322a('0x19');logger['info'](_0x322a('0x1a'));}else{GRAY_PERIOD_REASON=_0x322a('0x1b');logger[_0x322a('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x38e962[_0x322a('0x18')],_0x1c61bc);}logger[_0x322a('0x14')](_0x322a('0x1c'),GRAY_PERIOD_REASON[_0x322a('0x1d')](),moment()[_0x322a('0xc')](_0x322a('0x1e')));return _0x2e6fc9[_0x322a('0x17')]({'data2':encryptor[_0x322a('0x1f')](moment()[_0x322a('0xc')](_0x322a('0x1e')))});}else{if(moment()['diff'](encryptor[_0x322a('0x20')](_0x38e962[_0x322a('0x12')]),'days')>DAYS){logger[_0x322a('0x14')](_0x322a('0x21'),moment()[_0x322a('0xc')](_0x322a('0x1e')));isOldTokenSent=![];return _0x2e6fc9[_0x322a('0x17')]({'data1':_0x1c61bc,'data2':null,'license':null});}}}else{if(_0x38e962[_0x322a('0x18')]!=_0x1c61bc){logger[_0x322a('0x14')](_0x322a('0x22'),_0x38e962['data1'],_0x1c61bc);return _0x2e6fc9[_0x322a('0x17')]({'data1':_0x1c61bc,'data2':null,'license':null});}}}return _0x2e6fc9;})[_0x322a('0xf')](function(_0x541987){_0x2e6fc9=_0x541987;})['catch'](function(_0x5594a5){logger[_0x322a('0x23')](_0x5594a5[_0x322a('0x24')]);})[_0x322a('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0x322a('0x26')](),_0x2e6fc9);},TIME);});}function defaultLicense(){var _0x2f8fab=hardware['getUuid']();if(_0x2f8fab){return db[_0x322a('0x27')][_0x322a('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x2f8fab}})[_0x322a('0x29')](function(_0xc13dc7,_0x101c80){logger[_0x322a('0x14')](_0x322a('0x2a'),_0x2f8fab);manageLicense(_0x2f8fab,_0xc13dc7);})[_0x322a('0x10')](function(_0x448e65){logger[_0x322a('0x23')](_0x448e65['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index d1ee8d4..e5e21de 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 _0x3e6c=['sequelize','COUNT','col','role','count','admin','user','telephone','users','telephones','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','License','find','defaults','then','catch','data1','license','isEmpty','data2','split','parse','demo','uuid','machineUuid','decryptString','deadline','days','format','grayReason','changed','disabled','message','User'];(function(_0x163cd0,_0x461c03){var _0x166213=function(_0x450910){while(--_0x450910){_0x163cd0['push'](_0x163cd0['shift']());}};_0x166213(++_0x461c03);}(_0x3e6c,0x9b));var _0xc3e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e6c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc3e6('0x0'));var _=require(_0xc3e6('0x1'));var moment=require(_0xc3e6('0x2'));var BPromise=require('bluebird');var hardware=require(_0xc3e6('0x3'));var encryptor=require(_0xc3e6('0x4'));var db=require(_0xc3e6('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc3e6('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc3e6('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc3e6('0x8'),'machineUuid':hardware[_0xc3e6('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x23208a){return new BPromise(function(_0x584957,_0xe59819){return db[_0xc3e6('0xa')][_0xc3e6('0xb')](_[_0xc3e6('0xc')](_0x23208a,{'raw':!![],'where':{'id':0x1}}))[_0xc3e6('0xd')](function(_0x180830){return checkLicense(_0x180830,null);})['then'](function(_0x267efc){_0x584957(_0x267efc);return;})[_0xc3e6('0xe')](function(_0x1d8a18){_0xe59819(_0x1d8a18);});});}function checkLicense(_0x48a66e,_0x4d6427){if(!_0x48a66e){demoLicense['uuid']=_0x48a66e[_0xc3e6('0xf')];return demoLicense;}try{var _0xef649e=_0x4d6427||_0x48a66e[_0xc3e6('0x10')];if(_[_0xc3e6('0x11')](_0xef649e)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x3952a3=_0x48a66e[_0xc3e6('0xf')];var _0x1e17a4=_0x48a66e[_0xc3e6('0x12')];var _0x388c86=_0x3952a3[_0xc3e6('0x13')]('-')[0x4];var _0x1a839c=_0x3952a3['split']('-')[0x0];var _0x34e159=encryptor['decryptString'](_0xef649e,util['format']('%s:%s:%s',_0x388c86,_0x3952a3,_0x1a839c));var _0x55ad99=JSON[_0xc3e6('0x14')](_0x34e159);_0x55ad99[_0xc3e6('0x15')]=![];_0x55ad99[_0xc3e6('0x16')]=_0x3952a3;_0x55ad99[_0xc3e6('0x17')]=hardware[_0xc3e6('0x9')]();if(_0x1e17a4){var _0x1cc37c=encryptor[_0xc3e6('0x18')](_0x1e17a4);_0x55ad99['gray']=_0x1cc37c;_0x55ad99[_0xc3e6('0x19')]=moment(_0x1cc37c)['add'](0x7,_0xc3e6('0x1a'))[_0xc3e6('0x1b')]();_0x55ad99[_0xc3e6('0x1c')]=_0x55ad99[_0xc3e6('0x16')]!=_0x55ad99[_0xc3e6('0x17')]?_0xc3e6('0x1d'):_0xc3e6('0x1e');}return _0x55ad99;}catch(_0xa80e5){breakingLicense['uuid']=_0x48a66e[_0xc3e6('0xf')];breakingLicense['message']=_0xa80e5[_0xc3e6('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3ab6fb,_0x166016){getLicense()['then'](function(_0x12f9a8){return db[_0xc3e6('0x20')]['findAll']({'attributes':['role',[db[_0xc3e6('0x21')]['fn'](_0xc3e6('0x22'),db[_0xc3e6('0x21')][_0xc3e6('0x23')](_0xc3e6('0x24'))),_0xc3e6('0x25')]],'group':_0xc3e6('0x24'),'where':{'role':{'$or':[_0xc3e6('0x26'),_0xc3e6('0x27'),_0xc3e6('0x28')]}},'raw':!![]})[_0xc3e6('0xd')](function(_0x34133b){var _0x48ce97={'user':_0x12f9a8[_0xc3e6('0x29')]||0x0,'telephone':_0x12f9a8[_0xc3e6('0x2a')]||0x0};_0x34133b['forEach'](function(_0x3b23d7){var _0x1ef0b1=_0x3b23d7[_0xc3e6('0x24')]===_0xc3e6('0x26')?_0xc3e6('0x27'):_0x3b23d7[_0xc3e6('0x24')];_0x48ce97[_0x1ef0b1]-=_0x3b23d7[_0xc3e6('0x25')];if(_0x48ce97[_0x1ef0b1]<0x0)_0x48ce97[_0x1ef0b1]=0x0;});_0x3ab6fb(_0x48ce97);return;});})[_0xc3e6('0xe')](function(_0x3a3244){_0x166016(_0x3a3244);});});}function checkUserLimits(_0x39f287){return new BPromise(function(_0x116db2,_0x2101c7){getLimits()['then'](function(_0xd0d5d7){var _0x2bcf27=_[_0xc3e6('0x2b')](_[_0xc3e6('0x2c')](_0x39f287,_0xc3e6('0x24')),[_0xc3e6('0x26'),'user','telephone']);var _0x262c5e=(_0x2bcf27[_0xc3e6('0x26')]||0x0)+(_0x2bcf27[_0xc3e6('0x27')]||0x0);var _0x52aa4a=_0x2bcf27['telephone']||0x0;if(_0x262c5e>_0xd0d5d7['user'])return _0x2101c7(_0xc3e6('0x2d'));if(_0x52aa4a>_0xd0d5d7[_0xc3e6('0x28')])return _0x2101c7(_0xc3e6('0x2e'));return _0x116db2();})[_0xc3e6('0xe')](function(_0x38ede2){_0x2101c7(_0x38ede2);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xb2f9=['License\x20limit\x20reached\x20for\x20users','exports','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','find','defaults','then','catch','uuid','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','add','changed','disabled','User','findAll','role','sequelize','COUNT','col','count','admin','telephone','users','forEach','pick','countBy','user'];(function(_0x28f61d,_0x147a60){var _0x19ac82=function(_0x748712){while(--_0x748712){_0x28f61d['push'](_0x28f61d['shift']());}};_0x19ac82(++_0x147a60);}(_0xb2f9,0x104));var _0x9b2f=function(_0x2d2990,_0x5b8547){_0x2d2990=_0x2d2990-0x0;var _0x47cf6c=_0xb2f9[_0x2d2990];return _0x47cf6c;};'use strict';var util=require('util');var _=require(_0x9b2f('0x0'));var moment=require(_0x9b2f('0x1'));var BPromise=require('bluebird');var hardware=require(_0x9b2f('0x2'));var encryptor=require(_0x9b2f('0x3'));var db=require(_0x9b2f('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9b2f('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9b2f('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9b2f('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x9b2f('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1ccf65){return new BPromise(function(_0x842d10,_0x1099b5){return db['License'][_0x9b2f('0x8')](_[_0x9b2f('0x9')](_0x1ccf65,{'raw':!![],'where':{'id':0x1}}))[_0x9b2f('0xa')](function(_0x249a32){return checkLicense(_0x249a32,null);})[_0x9b2f('0xa')](function(_0xfe10bd){_0x842d10(_0xfe10bd);return;})[_0x9b2f('0xb')](function(_0x2593c2){_0x1099b5(_0x2593c2);});});}function checkLicense(_0x3663df,_0x2a3d3e){if(!_0x3663df){demoLicense[_0x9b2f('0xc')]=_0x3663df['data1'];return demoLicense;}try{var _0x4e8595=_0x2a3d3e||_0x3663df['license'];if(_['isEmpty'](_0x4e8595)){throw new Error(_0x9b2f('0xd'));}var _0x211588=_0x3663df[_0x9b2f('0xe')];var _0x1ee0d1=_0x3663df[_0x9b2f('0xf')];var _0x221ff4=_0x211588[_0x9b2f('0x10')]('-')[0x4];var _0x326cdf=_0x211588[_0x9b2f('0x10')]('-')[0x0];var _0x496a87=encryptor[_0x9b2f('0x11')](_0x4e8595,util[_0x9b2f('0x12')](_0x9b2f('0x13'),_0x221ff4,_0x211588,_0x326cdf));var _0x29f310=JSON[_0x9b2f('0x14')](_0x496a87);_0x29f310[_0x9b2f('0x15')]=![];_0x29f310[_0x9b2f('0xc')]=_0x211588;_0x29f310[_0x9b2f('0x16')]=hardware[_0x9b2f('0x7')]();if(_0x1ee0d1){var _0x36d187=encryptor[_0x9b2f('0x11')](_0x1ee0d1);_0x29f310[_0x9b2f('0x17')]=_0x36d187;_0x29f310['deadline']=moment(_0x36d187)[_0x9b2f('0x18')](0x7,'days')['format']();_0x29f310['grayReason']=_0x29f310[_0x9b2f('0xc')]!=_0x29f310[_0x9b2f('0x16')]?_0x9b2f('0x19'):_0x9b2f('0x1a');}return _0x29f310;}catch(_0x57ded5){breakingLicense[_0x9b2f('0xc')]=_0x3663df[_0x9b2f('0xe')];breakingLicense['message']=_0x57ded5['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x431a6d,_0x22cd08){getLicense()[_0x9b2f('0xa')](function(_0x5b0385){return db[_0x9b2f('0x1b')][_0x9b2f('0x1c')]({'attributes':[_0x9b2f('0x1d'),[db[_0x9b2f('0x1e')]['fn'](_0x9b2f('0x1f'),db['sequelize'][_0x9b2f('0x20')]('role')),_0x9b2f('0x21')]],'group':_0x9b2f('0x1d'),'where':{'role':{'$or':[_0x9b2f('0x22'),'user',_0x9b2f('0x23')]}},'raw':!![]})[_0x9b2f('0xa')](function(_0xef7f5){var _0x2aa6b3={'user':_0x5b0385[_0x9b2f('0x24')]||0x0,'telephone':_0x5b0385['telephones']||0x0};_0xef7f5[_0x9b2f('0x25')](function(_0x55f85f){var _0x5950d4=_0x55f85f[_0x9b2f('0x1d')]===_0x9b2f('0x22')?'user':_0x55f85f[_0x9b2f('0x1d')];_0x2aa6b3[_0x5950d4]-=_0x55f85f[_0x9b2f('0x21')];if(_0x2aa6b3[_0x5950d4]<0x0)_0x2aa6b3[_0x5950d4]=0x0;});_0x431a6d(_0x2aa6b3);return;});})[_0x9b2f('0xb')](function(_0x5a652b){_0x22cd08(_0x5a652b);});});}function checkUserLimits(_0x453bd2){return new BPromise(function(_0x59c2a2,_0x2cf2ae){getLimits()[_0x9b2f('0xa')](function(_0x12a598){var _0x15a8fc=_[_0x9b2f('0x26')](_[_0x9b2f('0x27')](_0x453bd2,_0x9b2f('0x1d')),[_0x9b2f('0x22'),_0x9b2f('0x28'),'telephone']);var _0x487d4a=(_0x15a8fc[_0x9b2f('0x22')]||0x0)+(_0x15a8fc['user']||0x0);var _0x2975d5=_0x15a8fc[_0x9b2f('0x23')]||0x0;if(_0x487d4a>_0x12a598[_0x9b2f('0x28')])return _0x2cf2ae(_0x9b2f('0x29'));if(_0x2975d5>_0x12a598[_0x9b2f('0x23')])return _0x2cf2ae('License\x20limit\x20reached\x20for\x20telephones');return _0x59c2a2();})['catch'](function(_0x5ad553){_0x2cf2ae(_0x5ad553);});});}module[_0x9b2f('0x2a')]={'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 61de6b9..2276e05 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 _0xcf66=['secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xcf66,0x71));var _0x6cf6=function(_0x43c211,_0x520c0e){_0x43c211=_0x43c211-0x0;var _0x5cbe2f=_0xcf66[_0x43c211];return _0x5cbe2f;};'use strict';module[_0x6cf6('0x0')]={'DOMAIN':_0x6cf6('0x1'),'SESSION_SECRET':_0x6cf6('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x6cf6('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x1893=['myappanuglar-secret','app-id','secret'];(function(_0xcfe0ed,_0x3feab1){var _0x15bdec=function(_0x2a884d){while(--_0x2a884d){_0xcfe0ed['push'](_0xcfe0ed['shift']());}};_0x15bdec(++_0x3feab1);}(_0x1893,0xa2));var _0x3189=function(_0xbe31d1,_0x126345){_0xbe31d1=_0xbe31d1-0x0;var _0x7bd03=_0x1893[_0xbe31d1];return _0x7bd03;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3189('0x0'),'GOOGLE_ID':_0x3189('0x1'),'GOOGLE_SECRET':_0x3189('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 863c120..f5f2692 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ab3=['exports','../utils/loggers'];(function(_0x119634,_0xe72a5c){var _0x38cb08=function(_0x37bf24){while(--_0x37bf24){_0x119634['push'](_0x119634['shift']());}};_0x38cb08(++_0xe72a5c);}(_0x6ab3,0x1ad));var _0x36ab=function(_0x8d8917,_0x504e20){_0x8d8917=_0x8d8917-0x0;var _0x55bd93=_0x6ab3[_0x8d8917];return _0x55bd93;};'use strict';var fileLogger=require(_0x36ab('0x0'))['fileLogger'];module[_0x36ab('0x1')]=fileLogger; \ No newline at end of file +var _0xe3a5=['exports','../utils/loggers'];(function(_0x4719fc,_0x20e1c7){var _0x13d058=function(_0x7b6c5f){while(--_0x7b6c5f){_0x4719fc['push'](_0x4719fc['shift']());}};_0x13d058(++_0x20e1c7);}(_0xe3a5,0x75));var _0x5e3a=function(_0x30d507,_0x509f53){_0x30d507=_0x30d507-0x0;var _0x3af76b=_0xe3a5[_0x30d507];return _0x3af76b;};'use strict';var fileLogger=require(_0x5e3a('0x0'))['fileLogger'];module[_0x5e3a('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 182e12a..eba3272 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 _0x0458=['express','join','../../services/express/index.js','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x0458,0x12c));var _0x8045=function(_0x4f6b9e,_0x4f7bbf){_0x4f6b9e=_0x4f6b9e-0x0;var _0x4b645b=_0x0458[_0x4f6b9e];return _0x4b645b;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x8045('0x0'),'script':path[_0x8045('0x1')](__dirname,_0x8045('0x2'))},{'name':'ami','script':path[_0x8045('0x1')](__dirname,_0x8045('0x3'))},{'name':_0x8045('0x4'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0x8045('0x5'),'script':path[_0x8045('0x1')](__dirname,_0x8045('0x6'))},{'name':_0x8045('0x7'),'script':path['join'](__dirname,_0x8045('0x8'))},{'name':_0x8045('0x9'),'script':path[_0x8045('0x1')](__dirname,_0x8045('0xa'))}]};module[_0x8045('0xb')]=config; \ No newline at end of file +var _0x74c3=['routing','../../services/routing/index.js','exports','express','join','ami','agi','../../services/agi/index.js','../../services/email/index.js'];(function(_0x284c26,_0x31953c){var _0x351779=function(_0x10f7b1){while(--_0x10f7b1){_0x284c26['push'](_0x284c26['shift']());}};_0x351779(++_0x31953c);}(_0x74c3,0x6f));var _0x374c=function(_0x44ac5b,_0x274757){_0x44ac5b=_0x44ac5b-0x0;var _0x385b1a=_0x74c3[_0x44ac5b];return _0x385b1a;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x374c('0x0'),'script':path[_0x374c('0x1')](__dirname,'../../services/express/index.js')},{'name':_0x374c('0x2'),'script':path[_0x374c('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0x374c('0x3'),'script':path[_0x374c('0x1')](__dirname,_0x374c('0x4'))},{'name':'email','script':path[_0x374c('0x1')](__dirname,_0x374c('0x5'))},{'name':_0x374c('0x6'),'script':path[_0x374c('0x1')](__dirname,_0x374c('0x7'))},{'name':'xdr','script':path[_0x374c('0x1')](__dirname,'../../services/xdr/index.js')}]};module[_0x374c('0x8')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index c9ee896..13f0cfd 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 _0x0b43=['delete','dump','pm2','bluebird','./config','connect','start','then','disconnect','stop','restart','list','describe'];(function(_0x50eca3,_0x20ba3c){var _0x2e3b57=function(_0x51c088){while(--_0x51c088){_0x50eca3['push'](_0x50eca3['shift']());}};_0x2e3b57(++_0x20ba3c);}(_0x0b43,0xc5));var _0x30b4=function(_0x32439d,_0xcb9b5c){_0x32439d=_0x32439d-0x0;var _0x7de3ac=_0x0b43[_0x32439d];return _0x7de3ac;};'use strict';var pm2=require(_0x30b4('0x0'));var BPromise=require(_0x30b4('0x1'));var config=require(_0x30b4('0x2'));function connect(){return new BPromise(function(_0x4da555,_0x20eaba){return pm2[_0x30b4('0x3')](function(_0x49e3b7){if(_0x49e3b7){return _0x20eaba(_0x49e3b7);}return _0x4da555('connected');});});};exports[_0x30b4('0x4')]=function(_0x2f19b4){return connect()[_0x30b4('0x5')](function(){return new BPromise(function(_0x5bea69,_0x353406){return pm2['start'](_0x2f19b4,function(_0x535bb1,_0x2c177f){if(_0x535bb1){return _0x353406(_0x535bb1);}pm2[_0x30b4('0x6')]();return _0x5bea69(_0x2c177f);});});});};exports[_0x30b4('0x7')]=function(_0x1af0fe){return connect()[_0x30b4('0x5')](function(){return new BPromise(function(_0x30cce9,_0x2ec6bd){return pm2[_0x30b4('0x7')](_0x1af0fe,function(_0x8caa6d,_0x38a799){if(_0x8caa6d){return _0x2ec6bd(_0x8caa6d);}pm2['disconnect']();return _0x30cce9(_0x38a799);});});});};exports['restart']=function(_0x49be73){return connect()[_0x30b4('0x5')](function(){return new BPromise(function(_0x46d180,_0x4af543){return pm2[_0x30b4('0x8')](_0x49be73,function(_0x3ff468,_0x233630){if(_0x3ff468){return _0x4af543(_0x3ff468);}pm2[_0x30b4('0x6')]();return _0x46d180(_0x233630);});});});};exports[_0x30b4('0x9')]=function(){return connect()[_0x30b4('0x5')](function(){return new BPromise(function(_0x56048b,_0x33dfd9){return pm2[_0x30b4('0x9')](function(_0x3b279e,_0x5e5a7e){if(_0x3b279e){return _0x33dfd9(_0x3b279e);}pm2['disconnect']();return _0x56048b(_0x5e5a7e);});});});};exports[_0x30b4('0xa')]=function(_0x437701){return connect()[_0x30b4('0x5')](function(){return new BPromise(function(_0x5b1c10,_0x19af5e){return pm2[_0x30b4('0xa')](_0x437701,function(_0x390c3c,_0x4f7372){if(_0x390c3c){return _0x19af5e(_0x390c3c);}pm2[_0x30b4('0x6')]();return _0x5b1c10(_0x4f7372);});});});};exports[_0x30b4('0xb')]=function(_0x4c0dbb){return connect()[_0x30b4('0x5')](function(){return new BPromise(function(_0x534855,_0x1aec67){return pm2[_0x30b4('0xb')](_0x4c0dbb,function(_0x4be910,_0x2e130b){if(_0x4be910){return _0x1aec67(_0x4be910);}pm2[_0x30b4('0x6')]();return _0x534855(_0x2e130b);});});});};exports['dump']=function(){return connect()[_0x30b4('0x5')](function(){return new BPromise(function(_0xf5805a,_0x5f49a1){return pm2[_0x30b4('0xc')](function(_0x395508){if(_0x395508){return _0x5f49a1(_0x395508);}return _0xf5805a('saved');});});});}; \ No newline at end of file +var _0x87f3=['list','describe','delete','dump','bluebird','./config','connect','connected','start','then','stop','disconnect','restart'];(function(_0x836eab,_0x13e1e8){var _0x31d788=function(_0x2050d3){while(--_0x2050d3){_0x836eab['push'](_0x836eab['shift']());}};_0x31d788(++_0x13e1e8);}(_0x87f3,0x18a));var _0x387f=function(_0x55ef8b,_0x5deb5e){_0x55ef8b=_0x55ef8b-0x0;var _0x359c84=_0x87f3[_0x55ef8b];return _0x359c84;};'use strict';var pm2=require('pm2');var BPromise=require(_0x387f('0x0'));var config=require(_0x387f('0x1'));function connect(){return new BPromise(function(_0x3a5a9b,_0x5f5582){return pm2[_0x387f('0x2')](function(_0x3338cb){if(_0x3338cb){return _0x5f5582(_0x3338cb);}return _0x3a5a9b(_0x387f('0x3'));});});};exports[_0x387f('0x4')]=function(_0x380992){return connect()[_0x387f('0x5')](function(){return new BPromise(function(_0x2f8a47,_0x5b8c60){return pm2[_0x387f('0x4')](_0x380992,function(_0x5a1753,_0x369d92){if(_0x5a1753){return _0x5b8c60(_0x5a1753);}pm2['disconnect']();return _0x2f8a47(_0x369d92);});});});};exports[_0x387f('0x6')]=function(_0x2745f0){return connect()[_0x387f('0x5')](function(){return new BPromise(function(_0xf0c139,_0x514101){return pm2[_0x387f('0x6')](_0x2745f0,function(_0x45ab2e,_0x2776df){if(_0x45ab2e){return _0x514101(_0x45ab2e);}pm2[_0x387f('0x7')]();return _0xf0c139(_0x2776df);});});});};exports[_0x387f('0x8')]=function(_0xa073f7){return connect()[_0x387f('0x5')](function(){return new BPromise(function(_0x5927c9,_0x39ece1){return pm2[_0x387f('0x8')](_0xa073f7,function(_0x420a40,_0x4a4a63){if(_0x420a40){return _0x39ece1(_0x420a40);}pm2[_0x387f('0x7')]();return _0x5927c9(_0x4a4a63);});});});};exports[_0x387f('0x9')]=function(){return connect()[_0x387f('0x5')](function(){return new BPromise(function(_0x23e84a,_0x1904f0){return pm2[_0x387f('0x9')](function(_0x42a0a0,_0xaafb19){if(_0x42a0a0){return _0x1904f0(_0x42a0a0);}pm2[_0x387f('0x7')]();return _0x23e84a(_0xaafb19);});});});};exports[_0x387f('0xa')]=function(_0x56ec48){return connect()['then'](function(){return new BPromise(function(_0x363db7,_0x4984bb){return pm2[_0x387f('0xa')](_0x56ec48,function(_0x7dae04,_0x35618b){if(_0x7dae04){return _0x4984bb(_0x7dae04);}pm2[_0x387f('0x7')]();return _0x363db7(_0x35618b);});});});};exports[_0x387f('0xb')]=function(_0x25c97a){return connect()[_0x387f('0x5')](function(){return new BPromise(function(_0x3e7250,_0xcca0cc){return pm2[_0x387f('0xb')](_0x25c97a,function(_0x11e455,_0x3027f4){if(_0x11e455){return _0xcca0cc(_0x11e455);}pm2['disconnect']();return _0x3e7250(_0x3027f4);});});});};exports[_0x387f('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x597736,_0x1a8dfb){return pm2[_0x387f('0xc')](function(_0x27f34f){if(_0x27f34f){return _0x1a8dfb(_0x27f34f);}return _0x597736('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 10ee2e2..fcdeee6 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 _0x4bcb=['start','lodash','moment','ioredis','util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','info','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect'];(function(_0x255e09,_0x284fe3){var _0x2fd413=function(_0x44949e){while(--_0x44949e){_0x255e09['push'](_0x255e09['shift']());}};_0x2fd413(++_0x284fe3);}(_0x4bcb,0x1a5));var _0xb4bc=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x4bcb[_0x3cb6dc];return _0x47ec89;};'use strict';var _=require(_0xb4bc('0x0'));var moment=require(_0xb4bc('0x1'));var Redis=require(_0xb4bc('0x2'));var util=require(_0xb4bc('0x3'));var config=require('../../config/environment');var db=require(_0xb4bc('0x4'))['db'];var logger=require('../logger')('schedule');config['redis']=_[_0xb4bc('0x5')](config[_0xb4bc('0x6')],{'host':_0xb4bc('0x7'),'port':0x18eb});var io=require(_0xb4bc('0x8'))(new Redis(config[_0xb4bc('0x6')]));function closeInteractions(){var _0x1b4e46=0x0;var _0x18aff7=[];return db[_0xb4bc('0x9')]['find']({'raw':!![],'attributes':['id',_0xb4bc('0xa')],'where':{'id':0x1}})[_0xb4bc('0xb')](function(_0x19ee5b){_0x1b4e46=_0x19ee5b[_0xb4bc('0xa')];if(_0x1b4e46){return db[_0xb4bc('0xc')]['findAll']({'raw':!![],'attributes':['id',_0xb4bc('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xb4bc('0xe')](_0x19ee5b[_0xb4bc('0xa')],_0xb4bc('0xf'))}}});}else{return[];}})[_0xb4bc('0xb')](function(_0x21a7ee){if(_0x21a7ee&&_0x21a7ee[_0xb4bc('0x10')]){_0x18aff7=_[_0xb4bc('0x11')](_0x21a7ee||[],'id');logger['info'](_0xb4bc('0x12'),_0x18aff7[_0xb4bc('0x13')]());return db[_0xb4bc('0xc')][_0xb4bc('0x14')]({'closeReason':_0xb4bc('0x15'),'disposition':_0xb4bc('0x16'),'closed':!![],'closedAt':moment()[_0xb4bc('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x18aff7}});}})[_0xb4bc('0xb')](function(){if(_0x18aff7&&_0x18aff7[_0xb4bc('0x10')]){logger[_0xb4bc('0x18')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x18aff7[_0xb4bc('0x13')]());for(var _0x8da626=0x0;_0x8da626<_0x18aff7[_0xb4bc('0x10')];_0x8da626++){io['emit']('chatInteraction:update',{'id':_0x18aff7[_0x8da626],'closed':!![]});}}})[_0xb4bc('0x19')](function(_0x1c6d9a){logger[_0xb4bc('0x1a')](_0xb4bc('0x1b'),_0x1c6d9a?util[_0xb4bc('0x1c')](_0x1c6d9a,{'showHidden':![],'depth':null}):'');});}exports[_0xb4bc('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa164=['format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','system'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa164,0xbc));var _0x4a16=function(_0x3813ea,_0x1f4671){_0x3813ea=_0x3813ea-0x0;var _0x2a0daa=_0xa164[_0x3813ea];return _0x2a0daa;};'use strict';var _=require('lodash');var moment=require(_0x4a16('0x0'));var Redis=require(_0x4a16('0x1'));var util=require(_0x4a16('0x2'));var config=require('../../config/environment');var db=require(_0x4a16('0x3'))['db'];var logger=require(_0x4a16('0x4'))(_0x4a16('0x5'));config[_0x4a16('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4a16('0x7'))(new Redis(config[_0x4a16('0x6')]));function closeInteractions(){var _0x95d8d6=0x0;var _0x1a126e=[];return db[_0x4a16('0x8')][_0x4a16('0x9')]({'raw':!![],'attributes':['id',_0x4a16('0xa')],'where':{'id':0x1}})[_0x4a16('0xb')](function(_0x2d21d4){_0x95d8d6=_0x2d21d4[_0x4a16('0xa')];if(_0x95d8d6){return db[_0x4a16('0xc')][_0x4a16('0xd')]({'raw':!![],'attributes':['id',_0x4a16('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4a16('0xf')](_0x2d21d4['chatTimeout'],_0x4a16('0x10'))}}});}else{return[];}})['then'](function(_0x289066){if(_0x289066&&_0x289066[_0x4a16('0x11')]){_0x1a126e=_['map'](_0x289066||[],'id');logger[_0x4a16('0x12')](_0x4a16('0x13'),_0x1a126e[_0x4a16('0x14')]());return db[_0x4a16('0xc')]['update']({'closeReason':_0x4a16('0x15'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x4a16('0x16')](_0x4a16('0x17'))},{'where':{'id':_0x1a126e}});}})[_0x4a16('0xb')](function(){if(_0x1a126e&&_0x1a126e[_0x4a16('0x11')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x1a126e[_0x4a16('0x14')]());for(var _0x3dd965=0x0;_0x3dd965<_0x1a126e[_0x4a16('0x11')];_0x3dd965++){io[_0x4a16('0x18')](_0x4a16('0x19'),{'id':_0x1a126e[_0x3dd965],'closed':!![]});}}})['catch'](function(_0x44bb1f){logger[_0x4a16('0x1a')](_0x4a16('0x1b'),_0x44bb1f?util[_0x4a16('0x1c')](_0x44bb1f,{'showHidden':![],'depth':null}):'');});}exports[_0x4a16('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index d513b86..d642a27 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 _0x50c4=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x50c4,0x185));var _0x450c=function(_0x1e1858,_0x2bc0ec){_0x1e1858=_0x1e1858-0x0;var _0x4d8d7a=_0x50c4[_0x1e1858];return _0x4d8d7a;};'use strict';function start(){var _0x47ab6d=require(_0x450c('0x0'));return _0x47ab6d[_0x450c('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x0853=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x1e7aee,_0x42a759){var _0x3e3241=function(_0x226356){while(--_0x226356){_0x1e7aee['push'](_0x1e7aee['shift']());}};_0x3e3241(++_0x42a759);}(_0x0853,0x118));var _0x3085=function(_0x20047c,_0x205b59){_0x20047c=_0x20047c-0x0;var _0xdb9c92=_0x0853[_0x20047c];return _0xdb9c92;};'use strict';function start(){var _0x469e52=require(_0x3085('0x0'));return _0x469e52[_0x3085('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 5a38373..d998873 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 _0xa34a=['isNil','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','intersection','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','resolve','run\x20job','cron','isBetween','startAt','add','start','add\x20cron','stop\x20cron','endAt','update\x20cron','run','util','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','basename','savename','zip','join','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch'];(function(_0x2774bd,_0x498286){var _0x571fef=function(_0x4b114e){while(--_0x4b114e){_0x2774bd['push'](_0x2774bd['shift']());}};_0x571fef(++_0x498286);}(_0xa34a,0x183));var _0xaa34=function(_0x2ab3fe,_0x541452){_0x2ab3fe=_0x2ab3fe-0x0;var _0x22a07a=_0xa34a[_0x2ab3fe];return _0x22a07a;};'use strict';var fs=require('fs');var util=require(_0xaa34('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0xaa34('0x1'));var CronJobManager=require(_0xaa34('0x2'));var jayson=require(_0xaa34('0x3'));var BPromise=require(_0xaa34('0x4'));var logger=require('../logger')(_0xaa34('0x5'));var db=require(_0xaa34('0x6'))['db'];var analyticCustomReportController=require(_0xaa34('0x7'));var analyticDefaultReportController=require(_0xaa34('0x8'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4549b1,_0x47a686){return function(){logger[_0xaa34('0x9')](_0xaa34('0xa'),_0x4549b1[_0xaa34('0xb')]);var _0x3e123f=!![];var _0x810842={'tls':{'rejectUnauthorized':![]}};if(_0x4549b1[_0xaa34('0xc')][_0xaa34('0xd')][_0xaa34('0xe')]){_0x810842[_0xaa34('0xe')]=_0x4549b1[_0xaa34('0xc')][_0xaa34('0xd')][_0xaa34('0xe')];}else{_0x810842[_0xaa34('0xf')]=_0x4549b1[_0xaa34('0xc')][_0xaa34('0xd')][_0xaa34('0xf')];_0x810842[_0xaa34('0x10')]=_0x4549b1['MailAccount'][_0xaa34('0xd')][_0xaa34('0x10')];_0x810842['secure']=_0x4549b1[_0xaa34('0xc')][_0xaa34('0xd')][_0xaa34('0x11')];}if(_0x4549b1[_0xaa34('0xc')][_0xaa34('0xd')]['authentication']){_0x810842[_0xaa34('0x12')]={'user':_0x4549b1[_0xaa34('0xc')][_0xaa34('0xd')][_0xaa34('0x13')],'pass':_0x4549b1[_0xaa34('0xc')]['Smtp'][_0xaa34('0x14')]};}var _0x4108cb={'account':_0x810842,'message':{'from':util[_0xaa34('0x15')](_0xaa34('0x16'),_0x4549b1['MailAccount'][_0xaa34('0x17')],_0x4549b1[_0xaa34('0xc')]['email']||_0x4549b1['MailAccount'][_0xaa34('0xd')]['user']),'to':_0x4549b1['email'],'cc':_0x4549b1['cc'],'bcc':_0x4549b1[_0xaa34('0x18')],'subject':util[_0xaa34('0x15')](_0xaa34('0x19'),_0x47a686[_0xaa34('0x17')],_0x4549b1[_0xaa34('0x1a')],_0x4549b1[_0xaa34('0x1b')])}};var _0x5eefb1=path['join'](__dirname,'../../files/reports');var _0x3bea8c=_0x47a686['savename'];var _0x3afedd=util[_0xaa34('0x15')]('%s.%s',path[_0xaa34('0x1c')](_0x47a686[_0xaa34('0x1d')],path['extname'](_0x47a686['savename'])),_0xaa34('0x1e'));var _0x53f111=path[_0xaa34('0x1f')](_0x5eefb1,_0x3bea8c);var _0x37acfa=path[_0xaa34('0x1f')](_0x5eefb1,_0x3afedd);if(fs['existsSync'](_0x53f111)){_0x47a686[_0xaa34('0x20')]=_0xaa34('0x21');_0x4108cb[_0xaa34('0x22')]['attachments']=[{'filename':_0x3bea8c,'path':_0x53f111}];_0x4108cb[_0xaa34('0x22')][_0xaa34('0x23')]=util[_0xaa34('0x15')](_0xaa34('0x24'),JSON[_0xaa34('0x25')](_0x47a686,null,0x2));}else if(fs['existsSync'](_0x37acfa)){_0x47a686[_0xaa34('0x20')]=_0xaa34('0x21');_0x4108cb[_0xaa34('0x22')][_0xaa34('0x26')]=[{'filename':_0x3afedd,'path':_0x37acfa}];}else{_0x4108cb['message']['text']=_0xaa34('0x27');if(!_0x4549b1['sendIfEmpty']){_0x3e123f=![];logger[_0xaa34('0x9')](_0xaa34('0x28'));}}if(_0x3e123f){return client[_0xaa34('0x29')](_0xaa34('0x2a'),_0x4108cb)[_0xaa34('0x2b')](function(_0x25399e){if(_0x25399e[_0xaa34('0x2c')]){return logger[_0xaa34('0x2c')](_0xaa34('0x2d'),JSON['stringify'](_0x25399e));}return logger[_0xaa34('0x9')](_0xaa34('0x2e'));})[_0xaa34('0x2f')](function(_0x4dd4c2){return logger['error']('error\x20mail',JSON['stringify'](_0x4dd4c2));});}};}function handleError(){return function(_0xe18679){return logger[_0xaa34('0x2c')](JSON[_0xaa34('0x25')](_0xe18679));};}function handleResult(_0xb935d1){return function(_0x520310){logger[_0xaa34('0x9')]('data',JSON[_0xaa34('0x25')](_0x520310));if(_0xb935d1[_0xaa34('0xc')]&&_0xb935d1['MailAccount'][_0xaa34('0xd')]&&!_[_0xaa34('0x30')](_0xb935d1[_0xaa34('0xb')])){setTimeout(handleSendEmail(_0xb935d1,_0x520310),0x3c*0x3e8);}};}function handleJob(_0x355e73){return function(){try{if(_[_0xaa34('0x30')](_0x355e73[_0xaa34('0x1a')])){return logger[_0xaa34('0x9')](_0xaa34('0x31'));}if(_[_0xaa34('0x30')](_0x355e73[_0xaa34('0x1b')])){return logger[_0xaa34('0x9')]('subtractUnit\x20null\x20or\x20undefined');}var _0x479c29={'startDate':moment()['subtract'](_0x355e73['subtractNumber'],_0x355e73[_0xaa34('0x1b')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xaa34('0x15')](_0xaa34('0x32')),'type':_0xaa34('0x33'),'output':_0x355e73[_0xaa34('0x34')],'name':_0x355e73[_0xaa34('0x17')]};if(!_['isNil'](_0x355e73[_0xaa34('0x35')])){logger[_0xaa34('0x9')](_0xaa34('0x36'),_0x355e73['DefaultReportId']);return analyticDefaultReportController[_0xaa34('0x37')]({'id':_0x355e73[_0xaa34('0x35')]},_0x479c29)[_0xaa34('0x2b')](handleResult(_0x355e73))[_0xaa34('0x2f')](handleError());}if(!_[_0xaa34('0x30')](_0x355e73[_0xaa34('0x38')])){logger[_0xaa34('0x9')](_0xaa34('0x39'),_0x355e73[_0xaa34('0x38')]);return analyticCustomReportController['runReport']({'id':_0x355e73[_0xaa34('0x38')]},_0x479c29)[_0xaa34('0x2b')](handleResult(_0x355e73))[_0xaa34('0x2f')](handleError());}}catch(_0x1c7727){logger[_0xaa34('0x2c')](JSON[_0xaa34('0x25')](_0x1c7727));}return logger['info'](_0xaa34('0x3a'));};}function getJobs(_0x5d8483){var _0x43bfe6={};if(_0x5d8483){_0x43bfe6['id']=_0x5d8483;}return db[_0xaa34('0x3b')][_0xaa34('0x3c')]({'where':_0x43bfe6,'include':[{'model':db[_0xaa34('0xc')],'attributes':['id',_0xaa34('0x17'),_0xaa34('0xb')],'include':[{'model':db[_0xaa34('0x3d')],'as':_0xaa34('0xd')}]}]})[_0xaa34('0x2b')](function(_0x84125){var _0x2650eb=_[_0xaa34('0x3e')](manager[_0xaa34('0x3f')]);var _0x493705=_[_0xaa34('0x40')](_0x84125,function(_0x4e2400){return _0x4e2400['id'][_0xaa34('0x41')]();});var _0x12d288=_[_0xaa34('0x42')](_0x84125,function(_0x525fc8){return _0x525fc8['id'][_0xaa34('0x41')]();});var _0x4f5056=_0x5d8483?_0x493705:_['difference'](_0x493705,_0x2650eb);var _0x569889=_[_0xaa34('0x43')](_0x493705,_0x2650eb);var _0x2f09ba=_[_0xaa34('0x44')](_0x2650eb,_0x493705);var _0x42ba57;var _0x1d6cb1;for(_0x42ba57=0x0;_0x42ba57<_0x2f09ba[_0xaa34('0x45')]&&!_0x5d8483;_0x42ba57+=0x1){_0x1d6cb1=_0x2f09ba[_0x42ba57][_0xaa34('0x41')]();if(manager[_0xaa34('0x46')](_0x1d6cb1)){manager[_0xaa34('0x47')](_0x1d6cb1);manager[_0xaa34('0x48')](_0x1d6cb1);logger['info'](_0xaa34('0x49'),_0x1d6cb1);}}logger['info'](_0xaa34('0x4a'),JSON[_0xaa34('0x25')](_0x4f5056));for(_0x42ba57=0x0;_0x42ba57<_0x4f5056['length'];_0x42ba57+=0x1){_0x1d6cb1=_0x4f5056[_0x42ba57][_0xaa34('0x41')]();logger['info']('index',_0x1d6cb1);if(_0x5d8483){logger[_0xaa34('0x9')]('my\x20id',_0x5d8483);logger[_0xaa34('0x9')](JSON[_0xaa34('0x25')](_0x12d288[_0x1d6cb1]));BPromise[_0xaa34('0x4b')]()[_0xaa34('0x2b')](handleJob(_0x12d288[_0x1d6cb1]));logger[_0xaa34('0x9')](_0xaa34('0x4c'),_0x12d288[_0x1d6cb1]['name'],_0x12d288[_0x1d6cb1][_0xaa34('0x4d')]);}else if(_0x12d288[_0x1d6cb1][_0xaa34('0x4d')]&&_0x12d288[_0x1d6cb1]['active']&&moment()[_0xaa34('0x4e')](_0x12d288[_0x1d6cb1][_0xaa34('0x4f')],_0x12d288[_0x1d6cb1]['endAt'])){manager[_0xaa34('0x50')](_0x1d6cb1,_0x12d288[_0x1d6cb1][_0xaa34('0x4d')],handleJob(_0x12d288[_0x1d6cb1]));manager[_0xaa34('0x51')](_0x1d6cb1);logger['info'](_0xaa34('0x52'),_0x12d288[_0x1d6cb1][_0xaa34('0x17')],_0x12d288[_0x1d6cb1][_0xaa34('0x4d')]);}else if(manager['exists'](_0x1d6cb1)){manager[_0xaa34('0x47')](_0x1d6cb1);manager[_0xaa34('0x48')](_0x1d6cb1);logger[_0xaa34('0x9')](_0xaa34('0x53'),_0x12d288[_0x1d6cb1][_0xaa34('0x17')],_0x12d288[_0x1d6cb1][_0xaa34('0x4d')]);}}for(_0x42ba57=0x0,_0x1d6cb1;_0x42ba57<_0x569889[_0xaa34('0x45')]&&!_0x5d8483;_0x42ba57+=0x1){_0x1d6cb1=_0x569889[_0x42ba57][_0xaa34('0x41')]();if(manager['exists'](_0x1d6cb1)){if(_0x12d288[_0x1d6cb1][_0xaa34('0x4d')]&&_0x12d288[_0x1d6cb1]['active']&&moment()['isBetween'](_0x12d288[_0x1d6cb1][_0xaa34('0x4f')],_0x12d288[_0x1d6cb1][_0xaa34('0x54')])){manager['update'](_0x1d6cb1,_0x12d288[_0x1d6cb1][_0xaa34('0x4d')],handleJob(_0x12d288[_0x1d6cb1]));logger[_0xaa34('0x9')](_0xaa34('0x55'),_0x12d288[_0x1d6cb1][_0xaa34('0x17')],_0x12d288[_0x1d6cb1][_0xaa34('0x4d')]);}else{manager[_0xaa34('0x47')](_0x1d6cb1);manager[_0xaa34('0x48')](_0x1d6cb1);logger[_0xaa34('0x9')](_0xaa34('0x53'),_0x12d288[_0x1d6cb1][_0xaa34('0x17')],_0x12d288[_0x1d6cb1][_0xaa34('0x4d')]);}}}})[_0xaa34('0x2f')](function(_0x210457){logger[_0xaa34('0x2c')](JSON[_0xaa34('0x25')](_0x210457));});}exports[_0xaa34('0x56')]=function(_0x2a4874){return getJobs(_0x2a4874);};exports[_0xaa34('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x3809=['service','host','port','secure','authentication','user','pass','format','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','%s.%s','basename','extname','savename','zip','join','existsSync','Sent','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','message','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','error','stringify','catch','error\x20mail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','then','CustomReportId','runReport','Schedule','findAll','MailServerOut','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','toRun','index','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','add\x20cron','update','update\x20cron','stop\x20cron','run','start','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3809,0x158));var _0x9380=function(_0x332bec,_0x154bb2){_0x332bec=_0x332bec-0x0;var _0x3a47e9=_0x3809[_0x332bec];return _0x3a47e9;};'use strict';var fs=require('fs');var util=require(_0x9380('0x0'));var path=require(_0x9380('0x1'));var _=require(_0x9380('0x2'));var moment=require(_0x9380('0x3'));var CronJobManager=require(_0x9380('0x4'));var jayson=require(_0x9380('0x5'));var BPromise=require('bluebird');var logger=require(_0x9380('0x6'))('schedule');var db=require(_0x9380('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x9380('0x8'));var client=jayson[_0x9380('0x9')][_0x9380('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x11d7bc,_0x38fc1c){return function(){logger[_0x9380('0xb')](_0x9380('0xc'),_0x11d7bc[_0x9380('0xd')]);var _0x18bb67=!![];var _0x3155fb={'tls':{'rejectUnauthorized':![]}};if(_0x11d7bc[_0x9380('0xe')][_0x9380('0xf')][_0x9380('0x10')]){_0x3155fb[_0x9380('0x10')]=_0x11d7bc[_0x9380('0xe')][_0x9380('0xf')][_0x9380('0x10')];}else{_0x3155fb[_0x9380('0x11')]=_0x11d7bc[_0x9380('0xe')][_0x9380('0xf')][_0x9380('0x11')];_0x3155fb['port']=_0x11d7bc[_0x9380('0xe')][_0x9380('0xf')][_0x9380('0x12')];_0x3155fb[_0x9380('0x13')]=_0x11d7bc[_0x9380('0xe')][_0x9380('0xf')]['secure'];}if(_0x11d7bc[_0x9380('0xe')][_0x9380('0xf')][_0x9380('0x14')]){_0x3155fb['auth']={'user':_0x11d7bc[_0x9380('0xe')][_0x9380('0xf')][_0x9380('0x15')],'pass':_0x11d7bc['MailAccount'][_0x9380('0xf')][_0x9380('0x16')]};}var _0x29bcca={'account':_0x3155fb,'message':{'from':util[_0x9380('0x17')]('\x22%s\x22\x20<%s>',_0x11d7bc[_0x9380('0xe')][_0x9380('0x18')],_0x11d7bc['MailAccount'][_0x9380('0xd')]||_0x11d7bc[_0x9380('0xe')][_0x9380('0xf')]['user']),'to':_0x11d7bc[_0x9380('0xd')],'cc':_0x11d7bc['cc'],'bcc':_0x11d7bc[_0x9380('0x19')],'subject':util[_0x9380('0x17')](_0x9380('0x1a'),_0x38fc1c[_0x9380('0x18')],_0x11d7bc[_0x9380('0x1b')],_0x11d7bc[_0x9380('0x1c')])}};var _0x36730a=path['join'](__dirname,_0x9380('0x1d'));var _0x59da67=_0x38fc1c['savename'];var _0x5bfbd8=util[_0x9380('0x17')](_0x9380('0x1e'),path[_0x9380('0x1f')](_0x38fc1c['savename'],path[_0x9380('0x20')](_0x38fc1c[_0x9380('0x21')])),_0x9380('0x22'));var _0x464dad=path[_0x9380('0x23')](_0x36730a,_0x59da67);var _0xf3c449=path[_0x9380('0x23')](_0x36730a,_0x5bfbd8);if(fs[_0x9380('0x24')](_0x464dad)){_0x38fc1c['status']=_0x9380('0x25');_0x29bcca['message'][_0x9380('0x26')]=[{'filename':_0x59da67,'path':_0x464dad}];_0x29bcca['message'][_0x9380('0x27')]=util['format'](_0x9380('0x28'),JSON['stringify'](_0x38fc1c,null,0x2));}else if(fs['existsSync'](_0xf3c449)){_0x38fc1c['status']=_0x9380('0x25');_0x29bcca[_0x9380('0x29')][_0x9380('0x26')]=[{'filename':_0x5bfbd8,'path':_0xf3c449}];}else{_0x29bcca['message'][_0x9380('0x27')]=_0x9380('0x2a');if(!_0x11d7bc[_0x9380('0x2b')]){_0x18bb67=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x18bb67){return client[_0x9380('0x2c')](_0x9380('0x2d'),_0x29bcca)['then'](function(_0x9b8322){if(_0x9b8322['error']){return logger[_0x9380('0x2e')]('error\x20mail',JSON[_0x9380('0x2f')](_0x9b8322));}return logger[_0x9380('0xb')]('email\x20sent');})[_0x9380('0x30')](function(_0x2b3357){return logger[_0x9380('0x2e')](_0x9380('0x31'),JSON[_0x9380('0x2f')](_0x2b3357));});}};}function handleError(){return function(_0x202f39){return logger[_0x9380('0x2e')](JSON[_0x9380('0x2f')](_0x202f39));};}function handleResult(_0x5dbfb7){return function(_0x2b6c8f){logger[_0x9380('0xb')]('data',JSON[_0x9380('0x2f')](_0x2b6c8f));if(_0x5dbfb7[_0x9380('0xe')]&&_0x5dbfb7[_0x9380('0xe')][_0x9380('0xf')]&&!_[_0x9380('0x32')](_0x5dbfb7[_0x9380('0xd')])){setTimeout(handleSendEmail(_0x5dbfb7,_0x2b6c8f),0x3c*0x3e8);}};}function handleJob(_0x2c6ed2){return function(){try{if(_[_0x9380('0x32')](_0x2c6ed2['subtractNumber'])){return logger[_0x9380('0xb')](_0x9380('0x33'));}if(_['isNil'](_0x2c6ed2['subtractUnit'])){return logger[_0x9380('0xb')](_0x9380('0x34'));}var _0x14e091={'startDate':moment()['subtract'](_0x2c6ed2[_0x9380('0x1b')],_0x2c6ed2[_0x9380('0x1c')])[_0x9380('0x17')](_0x9380('0x35')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x9380('0x36'),'output':_0x2c6ed2[_0x9380('0x37')],'name':_0x2c6ed2[_0x9380('0x18')]};if(!_[_0x9380('0x32')](_0x2c6ed2['DefaultReportId'])){logger[_0x9380('0xb')](_0x9380('0x38'),_0x2c6ed2[_0x9380('0x39')]);return analyticDefaultReportController['runReport']({'id':_0x2c6ed2[_0x9380('0x39')]},_0x14e091)[_0x9380('0x3a')](handleResult(_0x2c6ed2))[_0x9380('0x30')](handleError());}if(!_['isNil'](_0x2c6ed2[_0x9380('0x3b')])){logger[_0x9380('0xb')]('exec\x20custom\x20report\x20id:%s',_0x2c6ed2['CustomReportId']);return analyticCustomReportController[_0x9380('0x3c')]({'id':_0x2c6ed2['CustomReportId']},_0x14e091)['then'](handleResult(_0x2c6ed2))[_0x9380('0x30')](handleError());}}catch(_0x446255){logger[_0x9380('0x2e')](JSON[_0x9380('0x2f')](_0x446255));}return logger[_0x9380('0xb')]('no\x20report\x20id');};}function getJobs(_0x510669){var _0x23200d={};if(_0x510669){_0x23200d['id']=_0x510669;}return db[_0x9380('0x3d')][_0x9380('0x3e')]({'where':_0x23200d,'include':[{'model':db[_0x9380('0xe')],'attributes':['id',_0x9380('0x18'),_0x9380('0xd')],'include':[{'model':db[_0x9380('0x3f')],'as':_0x9380('0xf')}]}]})[_0x9380('0x3a')](function(_0x2cbf71){var _0x2e57b6=_['keys'](manager[_0x9380('0x40')]);var _0x5b9106=_[_0x9380('0x41')](_0x2cbf71,function(_0x1c9f2c){return _0x1c9f2c['id'][_0x9380('0x42')]();});var _0x140777=_[_0x9380('0x43')](_0x2cbf71,function(_0x206172){return _0x206172['id'][_0x9380('0x42')]();});var _0x1614e5=_0x510669?_0x5b9106:_[_0x9380('0x44')](_0x5b9106,_0x2e57b6);var _0x25e133=_[_0x9380('0x45')](_0x5b9106,_0x2e57b6);var _0x57a84f=_[_0x9380('0x44')](_0x2e57b6,_0x5b9106);var _0x43bf77;var _0x3da6a8;for(_0x43bf77=0x0;_0x43bf77<_0x57a84f[_0x9380('0x46')]&&!_0x510669;_0x43bf77+=0x1){_0x3da6a8=_0x57a84f[_0x43bf77][_0x9380('0x42')]();if(manager[_0x9380('0x47')](_0x3da6a8)){manager[_0x9380('0x48')](_0x3da6a8);manager[_0x9380('0x49')](_0x3da6a8);logger['info']('delete\x20cron',_0x3da6a8);}}logger[_0x9380('0xb')](_0x9380('0x4a'),JSON[_0x9380('0x2f')](_0x1614e5));for(_0x43bf77=0x0;_0x43bf77<_0x1614e5['length'];_0x43bf77+=0x1){_0x3da6a8=_0x1614e5[_0x43bf77][_0x9380('0x42')]();logger['info'](_0x9380('0x4b'),_0x3da6a8);if(_0x510669){logger['info'](_0x9380('0x4c'),_0x510669);logger[_0x9380('0xb')](JSON[_0x9380('0x2f')](_0x140777[_0x3da6a8]));BPromise[_0x9380('0x4d')]()[_0x9380('0x3a')](handleJob(_0x140777[_0x3da6a8]));logger['info']('run\x20job',_0x140777[_0x3da6a8][_0x9380('0x18')],_0x140777[_0x3da6a8][_0x9380('0x4e')]);}else if(_0x140777[_0x3da6a8][_0x9380('0x4e')]&&_0x140777[_0x3da6a8][_0x9380('0x4f')]&&moment()[_0x9380('0x50')](_0x140777[_0x3da6a8][_0x9380('0x51')],_0x140777[_0x3da6a8][_0x9380('0x52')])){manager[_0x9380('0x53')](_0x3da6a8,_0x140777[_0x3da6a8][_0x9380('0x4e')],handleJob(_0x140777[_0x3da6a8]));manager['start'](_0x3da6a8);logger[_0x9380('0xb')](_0x9380('0x54'),_0x140777[_0x3da6a8]['name'],_0x140777[_0x3da6a8][_0x9380('0x4e')]);}else if(manager['exists'](_0x3da6a8)){manager[_0x9380('0x48')](_0x3da6a8);manager[_0x9380('0x49')](_0x3da6a8);logger[_0x9380('0xb')]('stop\x20cron',_0x140777[_0x3da6a8][_0x9380('0x18')],_0x140777[_0x3da6a8]['cron']);}}for(_0x43bf77=0x0,_0x3da6a8;_0x43bf77<_0x25e133[_0x9380('0x46')]&&!_0x510669;_0x43bf77+=0x1){_0x3da6a8=_0x25e133[_0x43bf77][_0x9380('0x42')]();if(manager[_0x9380('0x47')](_0x3da6a8)){if(_0x140777[_0x3da6a8][_0x9380('0x4e')]&&_0x140777[_0x3da6a8]['active']&&moment()[_0x9380('0x50')](_0x140777[_0x3da6a8]['startAt'],_0x140777[_0x3da6a8][_0x9380('0x52')])){manager[_0x9380('0x55')](_0x3da6a8,_0x140777[_0x3da6a8][_0x9380('0x4e')],handleJob(_0x140777[_0x3da6a8]));logger['info'](_0x9380('0x56'),_0x140777[_0x3da6a8][_0x9380('0x18')],_0x140777[_0x3da6a8][_0x9380('0x4e')]);}else{manager[_0x9380('0x48')](_0x3da6a8);manager[_0x9380('0x49')](_0x3da6a8);logger['info'](_0x9380('0x57'),_0x140777[_0x3da6a8][_0x9380('0x18')],_0x140777[_0x3da6a8][_0x9380('0x4e')]);}}}})[_0x9380('0x30')](function(_0x421a0d){logger[_0x9380('0x2e')](JSON[_0x9380('0x2f')](_0x421a0d));});}exports[_0x9380('0x58')]=function(_0xe7cf95){return getJobs(_0xe7cf95);};exports[_0x9380('0x59')]=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 7fb2897..707ef70 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 _0xab75=['Transcribe\x20not\x20configured','push','start','lodash','aws-sdk','request-promise','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','bucket','Sequelize','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','Positive','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','Settings\x20not\x20available','transcribeAccountId'];(function(_0x2ea947,_0x1535eb){var _0x367e24=function(_0x59b291){while(--_0x59b291){_0x2ea947['push'](_0x2ea947['shift']());}};_0x367e24(++_0x1535eb);}(_0xab75,0x11f));var _0x5ab7=function(_0x2896bc,_0x2a9e9e){_0x2896bc=_0x2896bc-0x0;var _0x4c4444=_0xab75[_0x2896bc];return _0x4c4444;};var _=require(_0x5ab7('0x0'));var AWS=require(_0x5ab7('0x1'));var rp=require(_0x5ab7('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x5ab7('0x3'))['db'];var logger=require(_0x5ab7('0x4'))(_0x5ab7('0x5'));function getTranscriptionJob(_0x5c5e38,_0x3b760c,_0x4678aa,_0x248e56){return new Promise(function(_0x3e1c7e,_0x406ca2){var _0x32b338=new AWS[(_0x5ab7('0x6'))]({'accessKeyId':_0x3b760c,'secretAccessKey':_0x5c5e38,'region':_0x4678aa});_0x32b338[_0x5ab7('0x7')]({'TranscriptionJobName':_0x248e56},function(_0x365a58,_0x86468a){if(_0x365a58){return _0x406ca2(_0x365a58);}else{return _0x3e1c7e(_0x86468a);}});});}function sentiment(_0x50c9f,_0x56f4b4,_0x216796,_0x16bbf4,_0x523404){return new Promise(function(_0x33ffe3,_0x12e9a2){var _0x45a8b8=new AWS[(_0x5ab7('0x8'))]({'accessKeyId':_0x56f4b4,'secretAccessKey':_0x50c9f,'region':_0x216796});_0x45a8b8[_0x5ab7('0x9')]({'Text':_0x16bbf4,'LanguageCode':_0x523404['substring'](0x0,0x2)},function(_0x501150,_0x40e48b){if(_0x501150){return _0x12e9a2(_0x501150);}else{return _0x33ffe3(_0x40e48b);}});});}function checkTranscribeJob(_0x3b91f8,_0x574502,_0x457c24){var _0x1d6ae0;return new BPromise(function(_0x3bb928,_0x15d811){logger[_0x5ab7('0xa')](util[_0x5ab7('0xb')](_0x5ab7('0xc'),_0x3b91f8['id'],_0x3b91f8[_0x5ab7('0xd')]));return getTranscriptionJob(_0x457c24['data1'],_0x457c24[_0x5ab7('0xe')],_0x574502[_0x5ab7('0xf')],_0x3b91f8[_0x5ab7('0xd')])[_0x5ab7('0x10')](function(_0x3ad6c9){logger[_0x5ab7('0xa')](util[_0x5ab7('0xb')](_0x5ab7('0x11'),_0x3b91f8['id'],_0x3b91f8[_0x5ab7('0xd')],_0x3ad6c9[_0x5ab7('0x12')]['TranscriptionJobStatus']));if(!_0x3b91f8[_0x5ab7('0x13')]){switch(_0x3ad6c9[_0x5ab7('0x12')][_0x5ab7('0x14')]){case'COMPLETED':var _0x1522eb={'transcribeStatus':_0x3ad6c9[_0x5ab7('0x12')][_0x5ab7('0x14')],'fileUri':_0x3ad6c9[_0x5ab7('0x12')]['Transcript'][_0x5ab7('0x15')]};logger[_0x5ab7('0xa')](util[_0x5ab7('0xb')](_0x5ab7('0x16'),_0x3b91f8['id']));return rp({'uri':_0x3ad6c9['TranscriptionJob'][_0x5ab7('0x17')]['TranscriptFileUri'],'json':!![]})[_0x5ab7('0x10')](function(_0x1ed9b9){logger[_0x5ab7('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x3b91f8['id']));if(_0x1ed9b9&&_0x1ed9b9[_0x5ab7('0x18')]&&_0x1ed9b9['results'][_0x5ab7('0x19')]&&_0x1ed9b9[_0x5ab7('0x18')][_0x5ab7('0x19')][_0x5ab7('0x1a')]){_0x1522eb['fileText']='';for(var _0x26f118=0x0;_0x26f118<_0x1ed9b9[_0x5ab7('0x18')]['transcripts']['length'];_0x26f118++){_0x1522eb[_0x5ab7('0x13')]+=_0x1ed9b9['results']['transcripts'][_0x26f118][_0x5ab7('0x1b')]+'';}}return _0x3b91f8[_0x5ab7('0x1c')](_0x1522eb);})[_0x5ab7('0x10')](function(){logger[_0x5ab7('0xa')](util[_0x5ab7('0xb')](_0x5ab7('0x1d'),_0x3b91f8['id']));if(!_0x3b91f8[_0x5ab7('0x1e')]){throw new db['Sequelize'][(_0x5ab7('0x1f'))](_0x5ab7('0x20'));}if(!_0x574502[_0x5ab7('0x21')]||!_0x574502[_0x5ab7('0x22')]||!_0x574502['sentimentRegion']||!_0x574502['language']||!_0x574502[_0x5ab7('0x23')]){throw new db[(_0x5ab7('0x24'))][(_0x5ab7('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1522eb[_0x5ab7('0x13')]){throw new Error(_0x5ab7('0x25'));}if(_0x574502['sentimentAccountId']===_0x457c24['id']){return _0x457c24;}else{return db[_0x5ab7('0x26')][_0x5ab7('0x27')]({'where':{'id':_settings[_0x5ab7('0x22')]}});}})['then'](function(_0x3c6344){if(!_0x3c6344){throw new db[(_0x5ab7('0x24'))][(_0x5ab7('0x1f'))](_0x5ab7('0x28'));}if(!_0x3c6344[_0x5ab7('0x29')]||!_0x3c6344[_0x5ab7('0xe')]){throw new db['Sequelize'][(_0x5ab7('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x1d6ae0=_0x3c6344;logger['info'](util['format'](_0x5ab7('0x2a'),_0x3b91f8['id']));return sentiment(_0x1d6ae0[_0x5ab7('0x29')],_0x1d6ae0[_0x5ab7('0xe')],_0x574502[_0x5ab7('0x2b')],_0x1522eb['fileText'],_0x574502[_0x5ab7('0x2c')]);})['then'](function(_0x2598a3){logger[_0x5ab7('0xa')](util['format'](_0x5ab7('0x2d'),_0x3b91f8['id']));return _0x3b91f8[_0x5ab7('0x1c')]({'sentiment':_0x2598a3[_0x5ab7('0x2e')],'sPositive':_0x2598a3[_0x5ab7('0x2f')]['Positive'],'sNegative':_0x2598a3[_0x5ab7('0x2f')][_0x5ab7('0x30')],'sMixed':_0x2598a3[_0x5ab7('0x2f')][_0x5ab7('0x31')],'sNeutral':_0x2598a3[_0x5ab7('0x2f')]['Neutral']});})[_0x5ab7('0x10')](function(){logger[_0x5ab7('0xa')](util[_0x5ab7('0xb')](_0x5ab7('0x1d'),_0x3b91f8['id']));_0x3bb928();});case _0x5ab7('0x32'):return _0x3b91f8['update']({'transcribeStatus':_0x5ab7('0x32'),'failureReason':_0x3ad6c9[_0x5ab7('0x12')][_0x5ab7('0x33')]})[_0x5ab7('0x10')](function(){logger[_0x5ab7('0xa')](util[_0x5ab7('0xb')](_0x5ab7('0x1d'),_0x3b91f8['id']));_0x3bb928();});default:logger[_0x5ab7('0xa')](util['format'](_0x5ab7('0x34'),_0x3b91f8['id']));break;}}else{return BPromise[_0x5ab7('0x35')]()[_0x5ab7('0x10')](function(){if(!_0x3b91f8['tempSentiment']){throw new db['Sequelize'][(_0x5ab7('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x574502[_0x5ab7('0x21')]||!_0x574502[_0x5ab7('0x22')]||!_0x574502[_0x5ab7('0x2b')]||!_0x574502[_0x5ab7('0x2c')]||!_0x574502[_0x5ab7('0x23')]){throw new db['Sequelize']['ValidationError'](_0x5ab7('0x36'));}if(!_0x3b91f8[_0x5ab7('0x13')]){throw new Error(_0x5ab7('0x25'));}if(_0x574502[_0x5ab7('0x22')]===_0x457c24['id']){return _0x457c24;}else{return db[_0x5ab7('0x26')][_0x5ab7('0x27')]({'where':{'id':_settings[_0x5ab7('0x22')]}});}})[_0x5ab7('0x10')](function(_0x1e554e){if(!_0x1e554e){throw new db[(_0x5ab7('0x24'))][(_0x5ab7('0x1f'))](_0x5ab7('0x28'));}if(!_0x1e554e[_0x5ab7('0x29')]||!_0x1e554e[_0x5ab7('0xe')]){throw new db['Sequelize']['ValidationError'](_0x5ab7('0x37'));}_0x1d6ae0=_0x1e554e;logger[_0x5ab7('0xa')](util[_0x5ab7('0xb')](_0x5ab7('0x2a'),_0x3b91f8['id']));return sentiment(_0x1d6ae0['data1'],_0x1d6ae0['data2'],_0x574502[_0x5ab7('0x2b')],_0x3b91f8['fileText'],_0x574502[_0x5ab7('0x2c')]);})[_0x5ab7('0x10')](function(_0x2f020c){logger['info'](util[_0x5ab7('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3b91f8['id']));return _0x3b91f8['update']({'sentiment':_0x2f020c[_0x5ab7('0x2e')],'sPositive':_0x2f020c[_0x5ab7('0x2f')][_0x5ab7('0x38')],'sNegative':_0x2f020c[_0x5ab7('0x2f')][_0x5ab7('0x30')],'sMixed':_0x2f020c[_0x5ab7('0x2f')][_0x5ab7('0x31')],'sNeutral':_0x2f020c['SentimentScore']['Neutral'],'transcribeStatus':_0x5ab7('0x39')});})[_0x5ab7('0x10')](function(){logger[_0x5ab7('0xa')](util[_0x5ab7('0xb')](_0x5ab7('0x1d'),_0x3b91f8['id']));_0x3bb928();});}})[_0x5ab7('0x3a')](function(_0x35da14){if(_0x35da14){if(!_0x35da14[_0x5ab7('0x3b')]||_0x35da14[_0x5ab7('0x3b')]!==_0x5ab7('0x3c')){logger[_0x5ab7('0x3d')](util[_0x5ab7('0xb')](_0x5ab7('0x3e'),_0x3b91f8['id']),util[_0x5ab7('0x3f')](_0x35da14,{'showHidden':![],'depth':null}));}}_0x3bb928();});});}function checkTranscribe(){var _0xeb6341;var _0x14f61f;var _0x55e231;return db[_0x5ab7('0x40')]['findAll']({'where':{'transcribeStatus':_0x5ab7('0x41')}})[_0x5ab7('0x10')](function(_0x4bd539){if(!_0x4bd539||!_0x4bd539[_0x5ab7('0x1a')]){throw new db[(_0x5ab7('0x24'))][(_0x5ab7('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0xeb6341=_0x4bd539;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x5ab7('0x10')](function(_0x467a17){if(!_0x467a17){throw new db[(_0x5ab7('0x24'))][(_0x5ab7('0x1f'))](_0x5ab7('0x42'));}_0x14f61f=_0x467a17;if(!_0x14f61f[_0x5ab7('0x5')]||!_0x14f61f[_0x5ab7('0x43')]||!_0x14f61f[_0x5ab7('0xf')]||!_0x14f61f[_0x5ab7('0x2c')]||!_0x14f61f[_0x5ab7('0x23')]){throw new db[(_0x5ab7('0x24'))][(_0x5ab7('0x1f'))](_0x5ab7('0x44'));}return db['CloudProvider'][_0x5ab7('0x27')]({'where':{'id':_0x14f61f[_0x5ab7('0x43')]}});})[_0x5ab7('0x10')](function(_0x14c5ad){if(!_0x14c5ad){throw new db[(_0x5ab7('0x24'))]['ValidationError'](_0x5ab7('0x28'));}if(!_0x14c5ad[_0x5ab7('0x29')]||!_0x14c5ad[_0x5ab7('0xe')]){throw new db[(_0x5ab7('0x24'))][(_0x5ab7('0x1f'))](_0x5ab7('0x37'));}_0x55e231=_0x14c5ad;var _0x13a92a=[];_0xeb6341['forEach'](function(_0x33d085){_0x13a92a[_0x5ab7('0x45')](checkTranscribeJob(_0x33d085,_0x14f61f,_0x55e231));});return BPromise['all'](_0x13a92a);})[_0x5ab7('0x3a')](function(_0x5730c9){if(_0x5730c9){if(!_0x5730c9[_0x5ab7('0x3b')]||_0x5730c9[_0x5ab7('0x3b')]!==_0x5ab7('0x3c')){logger[_0x5ab7('0x3d')](util[_0x5ab7('0x3f')](_0x5730c9,{'showHidden':![],'depth':null}));}}});}exports[_0x5ab7('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x4af8=['FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Negative','catch','name','error','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','SequelizeValidationError','start','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','format','transcribeName','data1','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','Transcript','TranscriptFileUri','info','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Sequelize','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','Positive','SentimentScore','Mixed'];(function(_0x13a094,_0x250688){var _0xa3d083=function(_0xa272f4){while(--_0xa272f4){_0x13a094['push'](_0x13a094['shift']());}};_0xa3d083(++_0x250688);}(_0x4af8,0x1ad));var _0x84af=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x4af8[_0x4ae625];return _0x31accf;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require('request-promise');var util=require('util');var BPromise=require(_0x84af('0x0'));var db=require(_0x84af('0x1'))['db'];var logger=require(_0x84af('0x2'))(_0x84af('0x3'));function getTranscriptionJob(_0x482825,_0x294e04,_0x83633,_0x59ad7b){return new Promise(function(_0x37c4f9,_0x3971f1){var _0x550ee6=new AWS[(_0x84af('0x4'))]({'accessKeyId':_0x294e04,'secretAccessKey':_0x482825,'region':_0x83633});_0x550ee6[_0x84af('0x5')]({'TranscriptionJobName':_0x59ad7b},function(_0x483ecc,_0x5b5e45){if(_0x483ecc){return _0x3971f1(_0x483ecc);}else{return _0x37c4f9(_0x5b5e45);}});});}function sentiment(_0x12f4e2,_0x154ab1,_0x479e1b,_0xc9f91b,_0x535556){return new Promise(function(_0x1623f6,_0x21e634){var _0x34aa9e=new AWS[(_0x84af('0x6'))]({'accessKeyId':_0x154ab1,'secretAccessKey':_0x12f4e2,'region':_0x479e1b});_0x34aa9e['detectSentiment']({'Text':_0xc9f91b,'LanguageCode':_0x535556[_0x84af('0x7')](0x0,0x2)},function(_0x4df0e5,_0x2a0d60){if(_0x4df0e5){return _0x21e634(_0x4df0e5);}else{return _0x1623f6(_0x2a0d60);}});});}function checkTranscribeJob(_0xe60937,_0x588eec,_0x3df8fa){var _0x499c7e;return new BPromise(function(_0x43086d,_0x427213){logger['info'](util[_0x84af('0x8')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0xe60937['id'],_0xe60937[_0x84af('0x9')]));return getTranscriptionJob(_0x3df8fa[_0x84af('0xa')],_0x3df8fa['data2'],_0x588eec[_0x84af('0xb')],_0xe60937[_0x84af('0x9')])['then'](function(_0x4490a9){logger['info'](util[_0x84af('0x8')](_0x84af('0xc'),_0xe60937['id'],_0xe60937['transcribeName'],_0x4490a9['TranscriptionJob'][_0x84af('0xd')]));if(!_0xe60937[_0x84af('0xe')]){switch(_0x4490a9[_0x84af('0xf')]['TranscriptionJobStatus']){case'COMPLETED':var _0x187195={'transcribeStatus':_0x4490a9[_0x84af('0xf')][_0x84af('0xd')],'fileUri':_0x4490a9[_0x84af('0xf')][_0x84af('0x10')][_0x84af('0x11')]};logger[_0x84af('0x12')](util[_0x84af('0x8')](_0x84af('0x13'),_0xe60937['id']));return rp({'uri':_0x4490a9['TranscriptionJob'][_0x84af('0x10')][_0x84af('0x11')],'json':!![]})[_0x84af('0x14')](function(_0x4ee3d1){logger[_0x84af('0x12')](util[_0x84af('0x8')](_0x84af('0x15'),_0xe60937['id']));if(_0x4ee3d1&&_0x4ee3d1['results']&&_0x4ee3d1['results'][_0x84af('0x16')]&&_0x4ee3d1[_0x84af('0x17')][_0x84af('0x16')][_0x84af('0x18')]){_0x187195[_0x84af('0xe')]='';for(var _0x1b23fb=0x0;_0x1b23fb<_0x4ee3d1[_0x84af('0x17')][_0x84af('0x16')][_0x84af('0x18')];_0x1b23fb++){_0x187195[_0x84af('0xe')]+=_0x4ee3d1[_0x84af('0x17')]['transcripts'][_0x1b23fb][_0x84af('0x19')]+'';}}return _0xe60937[_0x84af('0x1a')](_0x187195);})[_0x84af('0x14')](function(){logger[_0x84af('0x12')](util[_0x84af('0x8')](_0x84af('0x1b'),_0xe60937['id']));if(!_0xe60937[_0x84af('0x1c')]){throw new db['Sequelize'][(_0x84af('0x1d'))](_0x84af('0x1e'));}if(!_0x588eec['sentiment']||!_0x588eec[_0x84af('0x1f')]||!_0x588eec[_0x84af('0x20')]||!_0x588eec[_0x84af('0x21')]||!_0x588eec[_0x84af('0x22')]){throw new db['Sequelize']['ValidationError'](_0x84af('0x23'));}if(!_0x187195[_0x84af('0xe')]){throw new Error(_0x84af('0x24'));}if(_0x588eec[_0x84af('0x1f')]===_0x3df8fa['id']){return _0x3df8fa;}else{return db[_0x84af('0x25')][_0x84af('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x84af('0x14')](function(_0x38922c){if(!_0x38922c){throw new db['Sequelize'][(_0x84af('0x1d'))](_0x84af('0x27'));}if(!_0x38922c['data1']||!_0x38922c['data2']){throw new db[(_0x84af('0x28'))]['ValidationError'](_0x84af('0x29'));}_0x499c7e=_0x38922c;logger[_0x84af('0x12')](util['format'](_0x84af('0x2a'),_0xe60937['id']));return sentiment(_0x499c7e[_0x84af('0xa')],_0x499c7e[_0x84af('0x2b')],_0x588eec[_0x84af('0x20')],_0x187195[_0x84af('0xe')],_0x588eec[_0x84af('0x21')]);})[_0x84af('0x14')](function(_0x140da2){logger[_0x84af('0x12')](util[_0x84af('0x8')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xe60937['id']));return _0xe60937[_0x84af('0x1a')]({'sentiment':_0x140da2['Sentiment'],'sPositive':_0x140da2['SentimentScore'][_0x84af('0x2c')],'sNegative':_0x140da2['SentimentScore']['Negative'],'sMixed':_0x140da2[_0x84af('0x2d')][_0x84af('0x2e')],'sNeutral':_0x140da2[_0x84af('0x2d')]['Neutral']});})[_0x84af('0x14')](function(){logger[_0x84af('0x12')](util['format'](_0x84af('0x1b'),_0xe60937['id']));_0x43086d();});case _0x84af('0x2f'):return _0xe60937['update']({'transcribeStatus':'FAILED','failureReason':_0x4490a9[_0x84af('0xf')]['FailureReason']})[_0x84af('0x14')](function(){logger[_0x84af('0x12')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xe60937['id']));_0x43086d();});default:logger[_0x84af('0x12')](util[_0x84af('0x8')](_0x84af('0x30'),_0xe60937['id']));break;}}else{return BPromise['resolve']()[_0x84af('0x14')](function(){if(!_0xe60937['tempSentiment']){throw new db['Sequelize'][(_0x84af('0x1d'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x588eec[_0x84af('0x31')]||!_0x588eec[_0x84af('0x1f')]||!_0x588eec[_0x84af('0x20')]||!_0x588eec['language']||!_0x588eec[_0x84af('0x22')]){throw new db[(_0x84af('0x28'))]['ValidationError'](_0x84af('0x23'));}if(!_0xe60937[_0x84af('0xe')]){throw new Error(_0x84af('0x24'));}if(_0x588eec[_0x84af('0x1f')]===_0x3df8fa['id']){return _0x3df8fa;}else{return db['CloudProvider'][_0x84af('0x26')]({'where':{'id':_settings[_0x84af('0x1f')]}});}})['then'](function(_0x23e49d){if(!_0x23e49d){throw new db[(_0x84af('0x28'))][(_0x84af('0x1d'))](_0x84af('0x27'));}if(!_0x23e49d['data1']||!_0x23e49d[_0x84af('0x2b')]){throw new db[(_0x84af('0x28'))][(_0x84af('0x1d'))](_0x84af('0x29'));}_0x499c7e=_0x23e49d;logger[_0x84af('0x12')](util[_0x84af('0x8')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xe60937['id']));return sentiment(_0x499c7e[_0x84af('0xa')],_0x499c7e['data2'],_0x588eec[_0x84af('0x20')],_0xe60937[_0x84af('0xe')],_0x588eec['language']);})[_0x84af('0x14')](function(_0x13ee44){logger[_0x84af('0x12')](util[_0x84af('0x8')](_0x84af('0x32'),_0xe60937['id']));return _0xe60937[_0x84af('0x1a')]({'sentiment':_0x13ee44[_0x84af('0x33')],'sPositive':_0x13ee44[_0x84af('0x2d')][_0x84af('0x2c')],'sNegative':_0x13ee44[_0x84af('0x2d')][_0x84af('0x34')],'sMixed':_0x13ee44['SentimentScore']['Mixed'],'sNeutral':_0x13ee44[_0x84af('0x2d')]['Neutral'],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x84af('0x12')](util[_0x84af('0x8')](_0x84af('0x1b'),_0xe60937['id']));_0x43086d();});}})[_0x84af('0x35')](function(_0x3c2262){if(_0x3c2262){if(!_0x3c2262[_0x84af('0x36')]||_0x3c2262[_0x84af('0x36')]!=='SequelizeValidationError'){logger[_0x84af('0x37')](util[_0x84af('0x8')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0xe60937['id']),util[_0x84af('0x38')](_0x3c2262,{'showHidden':![],'depth':null}));}}_0x43086d();});});}function checkTranscribe(){var _0x2a0725;var _0x58d824;var _0x38d333;return db[_0x84af('0x39')][_0x84af('0x3a')]({'where':{'transcribeStatus':_0x84af('0x3b')}})[_0x84af('0x14')](function(_0x3dbb33){if(!_0x3dbb33||!_0x3dbb33[_0x84af('0x18')]){throw new db['Sequelize'][(_0x84af('0x1d'))]('No\x20transcribe\x20job\x20to\x20check');}_0x2a0725=_0x3dbb33;return db[_0x84af('0x3c')][_0x84af('0x26')]({'where':{'id':0x1}});})[_0x84af('0x14')](function(_0xe0842a){if(!_0xe0842a){throw new db[(_0x84af('0x28'))][(_0x84af('0x1d'))]('Settings\x20not\x20available');}_0x58d824=_0xe0842a;if(!_0x58d824[_0x84af('0x3')]||!_0x58d824[_0x84af('0x3d')]||!_0x58d824[_0x84af('0xb')]||!_0x58d824[_0x84af('0x21')]||!_0x58d824[_0x84af('0x22')]){throw new db[(_0x84af('0x28'))]['ValidationError'](_0x84af('0x3e'));}return db['CloudProvider'][_0x84af('0x26')]({'where':{'id':_0x58d824['transcribeAccountId']}});})['then'](function(_0x40fb43){if(!_0x40fb43){throw new db[(_0x84af('0x28'))][(_0x84af('0x1d'))](_0x84af('0x27'));}if(!_0x40fb43[_0x84af('0xa')]||!_0x40fb43[_0x84af('0x2b')]){throw new db[(_0x84af('0x28'))][(_0x84af('0x1d'))](_0x84af('0x29'));}_0x38d333=_0x40fb43;var _0x19ff7e=[];_0x2a0725[_0x84af('0x3f')](function(_0x41aad6){_0x19ff7e[_0x84af('0x40')](checkTranscribeJob(_0x41aad6,_0x58d824,_0x38d333));});return BPromise[_0x84af('0x41')](_0x19ff7e);})[_0x84af('0x35')](function(_0x470731){if(_0x470731){if(!_0x470731[_0x84af('0x36')]||_0x470731[_0x84af('0x36')]!==_0x84af('0x42')){logger[_0x84af('0x37')](util[_0x84af('0x38')](_0x470731,{'showHidden':![],'depth':null}));}}});}exports[_0x84af('0x43')]=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 eab9aa4..c2e5144 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 _0xa13a=['lodash','ioredis','util','../../config/environment','schedule','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','timeout','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa13a,0x78));var _0xaa13=function(_0x449f80,_0x4833f8){_0x449f80=_0x449f80-0x0;var _0x5c1d99=_0xa13a[_0x449f80];return _0x5c1d99;};'use strict';var _=require(_0xaa13('0x0'));var moment=require('moment');var Redis=require(_0xaa13('0x1'));var util=require(_0xaa13('0x2'));var config=require(_0xaa13('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xaa13('0x4'));config['redis']=_[_0xaa13('0x5')](config['redis'],{'host':_0xaa13('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x356883=[];return db[_0xaa13('0x7')][_0xaa13('0x8')]({'raw':!![],'attributes':['id',_0xaa13('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xaa13('0xa')](0x18,'hours')}}})[_0xaa13('0xb')](function(_0x192ace){if(_0x192ace&&_0x192ace['length']){_0x356883=_[_0xaa13('0xc')](_0x192ace||[],'id');logger[_0xaa13('0xd')](_0xaa13('0xe'),_0x356883['join']());return db['WhatsappInteraction'][_0xaa13('0xf')]({'closeReason':'system','disposition':_0xaa13('0x10'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x356883}});}})[_0xaa13('0xb')](function(){if(_0x356883&&_0x356883[_0xaa13('0x11')]){logger[_0xaa13('0xd')](_0xaa13('0x12'),_0x356883['join']());for(var _0x4d59ec=0x0;_0x4d59ec<_0x356883['length'];_0x4d59ec++){io['emit'](_0xaa13('0x13'),{'id':_0x356883[_0x4d59ec],'closed':!![]});}}})[_0xaa13('0x14')](function(_0x20da15){logger[_0xaa13('0x15')](_0xaa13('0x16'),_0x20da15?util[_0xaa13('0x17')](_0x20da15,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc8a4=['socket.io-emitter','WhatsappInteraction','findAll','subtract','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','timeout','format','length','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults'];(function(_0x5dcf0b,_0x59688a){var _0x4536a7=function(_0x1efe4c){while(--_0x1efe4c){_0x5dcf0b['push'](_0x5dcf0b['shift']());}};_0x4536a7(++_0x59688a);}(_0xc8a4,0x99));var _0x4c8a=function(_0x4d3c84,_0x474dac){_0x4d3c84=_0x4d3c84-0x0;var _0x243f89=_0xc8a4[_0x4d3c84];return _0x243f89;};'use strict';var _=require(_0x4c8a('0x0'));var moment=require(_0x4c8a('0x1'));var Redis=require(_0x4c8a('0x2'));var util=require(_0x4c8a('0x3'));var config=require('../../config/environment');var db=require(_0x4c8a('0x4'))['db'];var logger=require(_0x4c8a('0x5'))(_0x4c8a('0x6'));config[_0x4c8a('0x7')]=_[_0x4c8a('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4c8a('0x9'))(new Redis(config[_0x4c8a('0x7')]));function closeInteractions(){var _0x4c4840=[];return db[_0x4c8a('0xa')][_0x4c8a('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4c8a('0xc')](0x18,'hours')}}})[_0x4c8a('0xd')](function(_0x372e3a){if(_0x372e3a&&_0x372e3a['length']){_0x4c4840=_[_0x4c8a('0xe')](_0x372e3a||[],'id');logger[_0x4c8a('0xf')](_0x4c8a('0x10'),_0x4c4840[_0x4c8a('0x11')]());return db[_0x4c8a('0xa')]['update']({'closeReason':'system','disposition':_0x4c8a('0x12'),'closed':!![],'closedAt':moment()[_0x4c8a('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4c4840}});}})['then'](function(){if(_0x4c4840&&_0x4c4840[_0x4c8a('0x14')]){logger[_0x4c8a('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x4c4840[_0x4c8a('0x11')]());for(var _0x4f1bf1=0x0;_0x4f1bf1<_0x4c4840[_0x4c8a('0x14')];_0x4f1bf1++){io[_0x4c8a('0x15')](_0x4c8a('0x16'),{'id':_0x4c4840[_0x4f1bf1],'closed':!![]});}}})[_0x4c8a('0x17')](function(_0x341424){logger['error'](_0x4c8a('0x18'),_0x341424?util[_0x4c8a('0x19')](_0x341424,{'showHidden':![],'depth':null}):'');});}exports[_0x4c8a('0x1a')]=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 1e02e6b..2109c38 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84d6=['util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','then','bulkCreate','log','CmHopper','destroy','hopper1','finished\x20populating','contacts2','catch'];(function(_0x41be90,_0x982c24){var _0xee1c82=function(_0x586cc7){while(--_0x586cc7){_0x41be90['push'](_0x41be90['shift']());}};_0xee1c82(++_0x982c24);}(_0x84d6,0xea));var _0x684d=function(_0x29c809,_0x5a3847){_0x29c809=_0x29c809-0x0;var _0x59b813=_0x84d6[_0x29c809];return _0x59b813;};'use strict';var util=require(_0x684d('0x0'));var db=require(_0x684d('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x684d('0x2')+i,'lastName':_0x684d('0x3')+i,'phone':0xf879fb460+i,'email':_0x684d('0x4')+i+_0x684d('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x684d('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x684d('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x684d('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x684d('0x6')]({'id':i,'firstName':_0x684d('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x684d('0x4')+i+_0x684d('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x684d('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x684d('0x7')](),'updatedAt':Date[_0x684d('0x7')]()});}db[_0x684d('0x8')]['destroy']({'where':{}})[_0x684d('0x9')](function(){return db['CmContact'][_0x684d('0xa')](contacts);})['then'](function(){console[_0x684d('0xb')]('finished\x20populating','contacts1');return db[_0x684d('0xc')][_0x684d('0xd')]({'where':{}});})[_0x684d('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0x684d('0x9')](function(){console[_0x684d('0xb')]('finished\x20populating',_0x684d('0xe'));return db[_0x684d('0x8')]['bulkCreate'](contacts2);})['then'](function(){console[_0x684d('0xb')](_0x684d('0xf'),_0x684d('0x10'));return db['CmHopper'][_0x684d('0xa')](hopper2);})[_0x684d('0x9')](function(){console[_0x684d('0xb')](_0x684d('0xf'),'hopper2');})[_0x684d('0x11')](function(_0x253e26){console[_0x684d('0xb')](_0x253e26);}); \ No newline at end of file +var _0x5a20=['push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2','catch','util','../mysqldb'];(function(_0x2e217a,_0x56e223){var _0x43a5a9=function(_0x1fd1c7){while(--_0x1fd1c7){_0x2e217a['push'](_0x2e217a['shift']());}};_0x43a5a9(++_0x56e223);}(_0x5a20,0x1d9));var _0x05a2=function(_0x2e1c9c,_0x4a94a2){_0x2e1c9c=_0x2e1c9c-0x0;var _0x31ab33=_0x5a20[_0x2e1c9c];return _0x31ab33;};'use strict';var util=require(_0x05a2('0x0'));var db=require(_0x05a2('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x05a2('0x2')]({'id':i,'firstName':_0x05a2('0x3')+i,'lastName':_0x05a2('0x4')+i,'phone':0xf879fb460+i,'email':_0x05a2('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x05a2('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x05a2('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x05a2('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x05a2('0x2')]({'id':i,'firstName':_0x05a2('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x05a2('0x5')+i+_0x05a2('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x05a2('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x05a2('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x05a2('0x6')]()});}db[_0x05a2('0x8')][_0x05a2('0x9')]({'where':{}})[_0x05a2('0xa')](function(){return db['CmContact'][_0x05a2('0xb')](contacts);})[_0x05a2('0xa')](function(){console[_0x05a2('0xc')](_0x05a2('0xd'),_0x05a2('0xe'));return db['CmHopper'][_0x05a2('0x9')]({'where':{}});})['then'](function(){return db[_0x05a2('0xf')][_0x05a2('0xb')](hopper);})['then'](function(){console[_0x05a2('0xc')](_0x05a2('0xd'),_0x05a2('0x10'));return db[_0x05a2('0x8')]['bulkCreate'](contacts2);})[_0x05a2('0xa')](function(){console[_0x05a2('0xc')](_0x05a2('0xd'),'contacts2');return db[_0x05a2('0xf')][_0x05a2('0xb')](hopper2);})[_0x05a2('0xa')](function(){console['log']('finished\x20populating',_0x05a2('0x11'));})[_0x05a2('0x12')](function(_0x3cdeef){console[_0x05a2('0xc')](_0x3cdeef);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index edac105..6f1b91f 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd967=['udp','wss','all','ulaw','yes','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format','%s%s','agent','friend'];(function(_0x47dcba,_0x36a780){var _0x2c1765=function(_0x884ad2){while(--_0x884ad2){_0x47dcba['push'](_0x47dcba['shift']());}};_0x2c1765(++_0x36a780);}(_0xd967,0x8a));var _0x7d96=function(_0x32d414,_0x4d23da){_0x32d414=_0x32d414-0x0;var _0x4e0bca=_0xd967[_0x32d414];return _0x4e0bca;};'use strict';var util=require(_0x7d96('0x0'));var db=require(_0x7d96('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format']('%s%s','agent',i),'fullname':util[_0x7d96('0x2')](_0x7d96('0x3'),_0x7d96('0x4'),i),'email':util[_0x7d96('0x2')]('%s%s@xcally.com',_0x7d96('0x4'),i),'role':_0x7d96('0x4'),'password':'password','internal':0xfa0+i,'type':_0x7d96('0x5'),'transport':[_0x7d96('0x6'),'ws',_0x7d96('0x7')],'disallow':[_0x7d96('0x8')],'allow':[_0x7d96('0x9')],'defaultuser':util[_0x7d96('0x2')](_0x7d96('0x3'),'agent',i),'encryption':'yes','avpf':_0x7d96('0xa'),'force_avp':_0x7d96('0xa'),'icesupport':'yes','dtlsenable':_0x7d96('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util['format'](_0x7d96('0xb'),util['format']('%s%s','agent',i),0xfa0+i)});}db[_0x7d96('0xc')][_0x7d96('0xd')](users)[_0x7d96('0xe')](function(){console[_0x7d96('0xf')](_0x7d96('0x10'));})[_0x7d96('0x11')](function(_0x1e4774){console['log'](_0x1e4774);}); \ No newline at end of file +var _0x5deb=['/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','catch','log','util','../mysqldb','push','agent','format','%s%s@xcally.com','password','friend','wss','ulaw','%s%s','yes'];(function(_0x1e2420,_0x626980){var _0xc8371c=function(_0x2b9e9c){while(--_0x2b9e9c){_0x1e2420['push'](_0x1e2420['shift']());}};_0xc8371c(++_0x626980);}(_0x5deb,0x111));var _0xb5de=function(_0x30a956,_0x11222e){_0x30a956=_0x30a956-0x0;var _0x2ac17d=_0x5deb[_0x30a956];return _0x2ac17d;};'use strict';var util=require(_0xb5de('0x0'));var db=require(_0xb5de('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xb5de('0x2')]({'name':util['format']('%s%s',_0xb5de('0x3'),i),'fullname':util[_0xb5de('0x4')]('%s%s',_0xb5de('0x3'),i),'email':util['format'](_0xb5de('0x5'),_0xb5de('0x3'),i),'role':_0xb5de('0x3'),'password':_0xb5de('0x6'),'internal':0xfa0+i,'type':_0xb5de('0x7'),'transport':['udp','ws',_0xb5de('0x8')],'disallow':['all'],'allow':[_0xb5de('0x9')],'defaultuser':util['format'](_0xb5de('0xa'),'agent',i),'encryption':_0xb5de('0xb'),'avpf':_0xb5de('0xb'),'force_avp':_0xb5de('0xb'),'icesupport':_0xb5de('0xb'),'dtlsenable':_0xb5de('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xb5de('0xc'),'dtlssetup':_0xb5de('0xd'),'callerid':util[_0xb5de('0x4')](_0xb5de('0xe'),util[_0xb5de('0x4')](_0xb5de('0xa'),'agent',i),0xfa0+i)});}db['User'][_0xb5de('0xf')](users)[_0xb5de('0x10')](function(){console['log']('add\x20user');})[_0xb5de('0x11')](function(_0x3f5d54){console[_0xb5de('0x12')](_0x3f5d54);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 1e1efb5..ba30f26 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d8d=['log','default','setMaxListeners','address','remoteAddress','request','connection','remotePort','SocketIO\x20','nsp','disconnect','lodash','util','bluebird','./environment','Agents','User','name','role','telephone','agent','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','find','userProfileId','query','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','user','SmsQueues','MailQueues','MailQueue','WhatsappQueue','getVoiceQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','openchannel','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x7d8d,0x134));var _0xd7d8=function(_0x52cc85,_0x3b612e){_0x52cc85=_0x52cc85-0x0;var _0x52d137=_0x7d8d[_0x52cc85];return _0x52d137;};'use strict';var _=require(_0xd7d8('0x0'));var util=require(_0xd7d8('0x1'));var BPromise=require(_0xd7d8('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xd7d8('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xd7d8('0x4'),'model':db[_0xd7d8('0x5')],'attributes':['id',_0xd7d8('0x6'),_0xd7d8('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd7d8('0x6')],'where':{'role':_0xd7d8('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xd7d8('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0xd7d8('0x6')],'where':{'role':_0xd7d8('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xd7d8('0x6'),_0xd7d8('0xa')],'where':{'type':_0xd7d8('0xb')}};function getAssociatedResources(_0x465552,_0x16bedb,_0x4ddfb6){return db[_0xd7d8('0xc')]['findOne']({'where':{'name':_0x465552,'userProfileId':_0x16bedb},'raw':!![]})[_0xd7d8('0xd')](function(_0x32ec07){if(_0x32ec07){if(_0x32ec07[_0xd7d8('0xe')]){switch(_0x465552){case _0xd7d8('0xf'):case _0xd7d8('0x10'):case _0xd7d8('0x11'):case'SmsQueues':case'MailQueues':case _0xd7d8('0x12'):case _0xd7d8('0x13'):return db[_0x4ddfb6][_0xd7d8('0x14')](queryQueues);case _0xd7d8('0x15'):return db[_0x4ddfb6][_0xd7d8('0x14')](queryTelephones);case _0xd7d8('0x16'):return db[_0x4ddfb6]['findAll'](queryTrunks);case _0xd7d8('0x17'):return db[_0x4ddfb6][_0xd7d8('0x14')](queryCampaigns);}}else{return db[_0xd7d8('0x18')][_0xd7d8('0x14')]({'attributes':[_0xd7d8('0x19')],'where':{'sectionId':_0x32ec07['id']},'raw':!![]})[_0xd7d8('0xd')](function(_0x2f0666){if(_0x2f0666){var _0x1e0072={'where':{'id':_[_0xd7d8('0x1a')](_0x2f0666,_0xd7d8('0x19'))},'raw':!![]};switch(_0x4ddfb6){case _0xd7d8('0x5'):_0x1e0072[_0xd7d8('0x1b')][_0xd7d8('0x7')]=_0xd7d8('0x8');break;case _0xd7d8('0x1c'):_0x1e0072['where'][_0xd7d8('0xa')]=_0xd7d8('0xb');break;}return db[_0x4ddfb6]['findAll'](_0x1e0072);}else{return[];}});}}else{return[];}})[_0xd7d8('0xd')](function(_0x1ada0a){return _0x1ada0a;});}function joinOrLeaveQueues(_0x41cccd,_0x33c47b,_0x41058c,_0x2a304b){_0x41cccd[_0x33c47b](util[_0xd7d8('0x1d')](_0xd7d8('0x1e'),_0x41058c,_0x2a304b[_0xd7d8('0x6')]));if(_0x2a304b[_0xd7d8('0x4')]){for(var _0x3ba0eb=0x0;_0x3ba0eb<_0x2a304b[_0xd7d8('0x4')][_0xd7d8('0x1f')];_0x3ba0eb+=0x1){_0x41cccd[_0x33c47b](util[_0xd7d8('0x1d')](_0xd7d8('0x20'),_0x2a304b[_0xd7d8('0x4')][_0x3ba0eb][_0xd7d8('0x6')]));}}}function joinOrLeave(_0x4b33e0,_0x2697f1,_0x386ab1){var _0x1eeaa5;if(_0x4b33e0[_0xd7d8('0x21')]['query']['id']){db[_0xd7d8('0x5')][_0xd7d8('0x22')]({'attributes':['id',_0xd7d8('0x6'),_0xd7d8('0x7'),_0xd7d8('0x23')],'where':{'id':_0x4b33e0['handshake'][_0xd7d8('0x24')]['id']},'include':[{'model':db[_0xd7d8('0x25')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd7d8('0x26')],'as':_0xd7d8('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xd7d8('0x28')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd7d8('0x29')],'as':_0xd7d8('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xd7d8('0x2b')],'as':_0xd7d8('0x2c'),'attributes':['id'],'raw':!![]},{'model':db[_0xd7d8('0x2d')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xd7d8('0xd')](function(_0x29854a){if(_0x29854a){_0x1eeaa5=_0x29854a;_0x4b33e0[_0x2697f1](util[_0xd7d8('0x1d')]('user:%s',_0x29854a['name']));var _0x3fe59b=[];switch(_0x29854a['role']){case'admin':_0x4b33e0[_0x2697f1](_0xd7d8('0x2e'));_0x4b33e0[_0x2697f1](_0xd7d8('0x2f'));if(queryQueues['hasOwnProperty'](_0xd7d8('0x30'))){delete queryQueues[_0xd7d8('0x30')];}_0x3fe59b[_0xd7d8('0x31')](db[_0xd7d8('0x32')][_0xd7d8('0x14')](queryQueues));_0x3fe59b[_0xd7d8('0x31')](db[_0xd7d8('0x33')][_0xd7d8('0x14')](queryQueues));_0x3fe59b[_0xd7d8('0x31')](db[_0xd7d8('0x34')]['findAll'](queryQueues));_0x3fe59b[_0xd7d8('0x31')](db[_0xd7d8('0x35')][_0xd7d8('0x14')](queryQueues));_0x3fe59b['push'](db['MailQueue'][_0xd7d8('0x14')](queryQueues));_0x3fe59b[_0xd7d8('0x31')](db[_0xd7d8('0x36')][_0xd7d8('0x14')](queryQueues));_0x3fe59b['push'](db['WhatsappQueue']['findAll'](queryQueues));_0x3fe59b[_0xd7d8('0x31')](db[_0xd7d8('0x5')]['findAll'](queryTelephones));_0x3fe59b['push'](db[_0xd7d8('0x37')][_0xd7d8('0x14')](queryTrunks));_0x3fe59b[_0xd7d8('0x31')](db['Campaign']['findAll'](queryCampaigns));_0x3fe59b[_0xd7d8('0x31')](db[_0xd7d8('0x5')][_0xd7d8('0x14')](queryAgents));break;case _0xd7d8('0x38'):_0x4b33e0[_0x2697f1](_0xd7d8('0x2e'));_0x4b33e0[_0x2697f1](_0xd7d8('0x2f'));_0x3fe59b[_0xd7d8('0x31')](getAssociatedResources(_0xd7d8('0xf'),_0x29854a['userProfileId'],'VoiceQueue'));_0x3fe59b[_0xd7d8('0x31')](getAssociatedResources(_0xd7d8('0x10'),_0x29854a[_0xd7d8('0x23')],_0xd7d8('0x33')));_0x3fe59b[_0xd7d8('0x31')](getAssociatedResources(_0xd7d8('0x11'),_0x29854a[_0xd7d8('0x23')],_0xd7d8('0x34')));_0x3fe59b['push'](getAssociatedResources(_0xd7d8('0x39'),_0x29854a[_0xd7d8('0x23')],'SmsQueue'));_0x3fe59b[_0xd7d8('0x31')](getAssociatedResources(_0xd7d8('0x3a'),_0x29854a[_0xd7d8('0x23')],_0xd7d8('0x3b')));_0x3fe59b[_0xd7d8('0x31')](getAssociatedResources(_0xd7d8('0x12'),_0x29854a[_0xd7d8('0x23')],_0xd7d8('0x36')));_0x3fe59b[_0xd7d8('0x31')](getAssociatedResources(_0xd7d8('0x13'),_0x29854a[_0xd7d8('0x23')],_0xd7d8('0x3c')));_0x3fe59b[_0xd7d8('0x31')](getAssociatedResources('Telephones',_0x29854a[_0xd7d8('0x23')],'User'));_0x3fe59b[_0xd7d8('0x31')](getAssociatedResources(_0xd7d8('0x16'),_0x29854a[_0xd7d8('0x23')],'Trunk'));_0x3fe59b['push'](getAssociatedResources(_0xd7d8('0x17'),_0x29854a[_0xd7d8('0x23')],_0xd7d8('0x1c')));_0x3fe59b[_0xd7d8('0x31')](db[_0xd7d8('0x5')][_0xd7d8('0x14')](queryAgents));break;case _0xd7d8('0x9'):_0x4b33e0[_0x2697f1]('voice:inbound');_0x4b33e0[_0x2697f1](_0xd7d8('0x2f'));_0x3fe59b[_0xd7d8('0x31')](_0x29854a[_0xd7d8('0x3d')]({'attributes':['id','name']}));_0x3fe59b['push'](_0x29854a['getChatQueues']({'attributes':['id',_0xd7d8('0x6')]}));_0x3fe59b['push'](_0x29854a[_0xd7d8('0x3e')]({'attributes':['id',_0xd7d8('0x6')]}));_0x3fe59b[_0xd7d8('0x31')](_0x29854a['getSmsQueues']({'attributes':['id',_0xd7d8('0x6')]}));_0x3fe59b[_0xd7d8('0x31')](_0x29854a[_0xd7d8('0x3f')]({'attributes':['id','name']}));_0x3fe59b[_0xd7d8('0x31')](_0x29854a[_0xd7d8('0x40')]({'attributes':['id',_0xd7d8('0x6')]}));_0x3fe59b[_0xd7d8('0x31')](_0x29854a[_0xd7d8('0x41')]({'attributes':['id',_0xd7d8('0x6')]}));break;}return BPromise[_0xd7d8('0x42')](_0x3fe59b);}})[_0xd7d8('0xd')](function(_0xd10af3){if(_0xd10af3&&_0xd10af3[_0xd7d8('0x1f')]){for(var _0x29fa8f=0x0;_0x29fa8f<_0xd10af3[_0xd7d8('0x1f')];_0x29fa8f+=0x1){for(var _0x7b2b75=0x0;_0x7b2b75<_0xd10af3[_0x29fa8f][_0xd7d8('0x1f')];_0x7b2b75+=0x1){switch(_0x29fa8f){case 0x0:joinOrLeaveQueues(_0x4b33e0,_0x2697f1,_0xd7d8('0x43'),_0xd10af3[_0x29fa8f][_0x7b2b75]);break;case 0x1:joinOrLeaveQueues(_0x4b33e0,_0x2697f1,_0xd7d8('0x44'),_0xd10af3[_0x29fa8f][_0x7b2b75]);break;case 0x2:joinOrLeaveQueues(_0x4b33e0,_0x2697f1,_0xd7d8('0x45'),_0xd10af3[_0x29fa8f][_0x7b2b75]);break;case 0x3:joinOrLeaveQueues(_0x4b33e0,_0x2697f1,_0xd7d8('0x46'),_0xd10af3[_0x29fa8f][_0x7b2b75]);break;case 0x4:joinOrLeaveQueues(_0x4b33e0,_0x2697f1,'mail',_0xd10af3[_0x29fa8f][_0x7b2b75]);break;case 0x5:joinOrLeaveQueues(_0x4b33e0,_0x2697f1,_0xd7d8('0x47'),_0xd10af3[_0x29fa8f][_0x7b2b75]);break;case 0x6:joinOrLeaveQueues(_0x4b33e0,_0x2697f1,'whatsapp',_0xd10af3[_0x29fa8f][_0x7b2b75]);break;case 0x7:if(_0x1eeaa5[_0xd7d8('0x7')]!==_0xd7d8('0x9'))_0x4b33e0[_0x2697f1](util[_0xd7d8('0x1d')]('telephone:%s',_0xd10af3[_0x29fa8f][_0x7b2b75][_0xd7d8('0x6')]));break;case 0x8:if(_0x1eeaa5[_0xd7d8('0x7')]!==_0xd7d8('0x9'))_0x4b33e0[_0x2697f1](util[_0xd7d8('0x1d')]('trunk:%s',_0xd10af3[_0x29fa8f][_0x7b2b75][_0xd7d8('0x6')]));break;case 0x9:if(_0x1eeaa5[_0xd7d8('0x7')]!==_0xd7d8('0x9'))_0x4b33e0[_0x2697f1](util[_0xd7d8('0x1d')](_0xd7d8('0x48'),_0xd10af3[_0x29fa8f][_0x7b2b75][_0xd7d8('0xa')],_0xd10af3[_0x29fa8f][_0x7b2b75]['name']));break;case 0xa:_0x4b33e0[_0x2697f1](util[_0xd7d8('0x1d')](_0xd7d8('0x20'),_0xd10af3[_0x29fa8f][_0x7b2b75]['name']));break;}}}}})[_0xd7d8('0xd')](function(){if(_0x2697f1===_0xd7d8('0x49')){var _0x29d6bb=_[_0xd7d8('0x1a')](_0x1eeaa5[_0xd7d8('0x4a')],'id');return _0x1eeaa5[_0xd7d8('0x4b')](_0x29d6bb)[_0xd7d8('0xd')](function(){for(var _0x43c59d=0x0;_0x43c59d<_0x29d6bb[_0xd7d8('0x1f')];_0x43c59d+=0x1){_0x386ab1[_0xd7d8('0x4c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x29d6bb[_0x43c59d]),'UserId':Number(_0x1eeaa5['id'])});}});}})[_0xd7d8('0xd')](function(){if(_0x2697f1==='leave'){var _0x4cef70=_[_0xd7d8('0x1a')](_0x1eeaa5['MailInteractions'],'id');return _0x1eeaa5[_0xd7d8('0x4d')](_0x4cef70)[_0xd7d8('0xd')](function(){for(var _0x4e78a9=0x0;_0x4e78a9<_0x4cef70[_0xd7d8('0x1f')];_0x4e78a9+=0x1){_0x386ab1[_0xd7d8('0x4c')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4cef70[_0x4e78a9]),'UserId':Number(_0x1eeaa5['id'])});}});}})['then'](function(){if(_0x2697f1===_0xd7d8('0x49')){var _0x247633=_[_0xd7d8('0x1a')](_0x1eeaa5['FaxInteractions'],'id');return _0x1eeaa5[_0xd7d8('0x4e')](_0x247633)[_0xd7d8('0xd')](function(){for(var _0x2ea7bd=0x0;_0x2ea7bd<_0x247633['length'];_0x2ea7bd+=0x1){_0x386ab1[_0xd7d8('0x4c')](_0xd7d8('0x4f'),{'FaxInteractionId':Number(_0x247633[_0x2ea7bd]),'UserId':Number(_0x1eeaa5['id'])});}});}})['then'](function(){if(_0x2697f1===_0xd7d8('0x49')){var _0x1ab9f6=_[_0xd7d8('0x1a')](_0x1eeaa5[_0xd7d8('0x2a')],'id');return _0x1eeaa5[_0xd7d8('0x50')](_0x1ab9f6)[_0xd7d8('0xd')](function(){for(var _0x909f98=0x0;_0x909f98<_0x1ab9f6[_0xd7d8('0x1f')];_0x909f98+=0x1){_0x386ab1[_0xd7d8('0x4c')](_0xd7d8('0x51'),{'SmsInteractionId':Number(_0x1ab9f6[_0x909f98]),'UserId':Number(_0x1eeaa5['id'])});}});}})[_0xd7d8('0xd')](function(){if(_0x2697f1===_0xd7d8('0x49')){var _0x1e23ec=_[_0xd7d8('0x1a')](_0x1eeaa5[_0xd7d8('0x2c')],'id');return _0x1eeaa5[_0xd7d8('0x52')](_0x1e23ec)[_0xd7d8('0xd')](function(){for(var _0x4f7cd7=0x0;_0x4f7cd7<_0x1e23ec[_0xd7d8('0x1f')];_0x4f7cd7+=0x1){_0x386ab1[_0xd7d8('0x4c')](_0xd7d8('0x53'),{'OpenchannelInteractionId':Number(_0x1e23ec[_0x4f7cd7]),'UserId':Number(_0x1eeaa5['id'])});}});}})[_0xd7d8('0xd')](function(){if(_0x2697f1===_0xd7d8('0x49')){var _0x2cc4c4=_[_0xd7d8('0x1a')](_0x1eeaa5[_0xd7d8('0x54')],'id');return _0x1eeaa5[_0xd7d8('0x55')](_0x2cc4c4)[_0xd7d8('0xd')](function(){for(var _0x213333=0x0;_0x213333<_0x2cc4c4[_0xd7d8('0x1f')];_0x213333+=0x1){_0x386ab1[_0xd7d8('0x4c')](_0xd7d8('0x56'),{'WhatsappInteractionId':Number(_0x2cc4c4[_0x213333]),'UserId':Number(_0x1eeaa5['id'])});}});}})[_0xd7d8('0x57')](function(_0x178ce7){_0x4b33e0[_0xd7d8('0x58')](_0x178ce7);});}}function onDisconnect(_0x251396,_0x486268){joinOrLeave(_0x251396,_0xd7d8('0x49'),_0x486268);}function onConnect(_0x26997a){joinOrLeave(_0x26997a,'join');}exports[_0xd7d8('0x59')]=function(_0xe1049c){_0xe1049c['on']('connection',function(_0x3a056f){_0x3a056f[_0xd7d8('0x5a')](0x0);_0x3a056f[_0xd7d8('0x5b')]=_0x3a056f['request']['connection'][_0xd7d8('0x5c')]+':'+_0x3a056f[_0xd7d8('0x5d')][_0xd7d8('0x5e')][_0xd7d8('0x5f')];_0x3a056f['connectedAt']=new Date();_0x3a056f[_0xd7d8('0x58')]=function(_0x1ad8c5){console[_0xd7d8('0x58')](_0xd7d8('0x60')+_0x3a056f[_0xd7d8('0x61')]['name']+'['+_0x3a056f[_0xd7d8('0x5b')]+']',_0x1ad8c5);};_0x3a056f['on'](_0xd7d8('0x62'),function(){onDisconnect(_0x3a056f,_0xe1049c);_0x3a056f[_0xd7d8('0x58')]('DISCONNECTED');});onConnect(_0x3a056f);_0x3a056f['log']('CONNECTED');});}; \ No newline at end of file +var _0x0bf7=['MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','OpenchannelQueues','IvrCampaigns','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','length','voice','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','map','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','user_has_mail_interactions:remove','user_has_fax_interactions:remove','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','connection','setMaxListeners','remoteAddress','connectedAt','nsp','address','disconnect','lodash','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','type','ivr','UserProfileSection','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','where','telephone','Campaign','format','%s:queue:%s','user:%s','handshake','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','then','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue'];(function(_0x46a63b,_0x1140bf){var _0x200a0e=function(_0x1799bd){while(--_0x1799bd){_0x46a63b['push'](_0x46a63b['shift']());}};_0x200a0e(++_0x1140bf);}(_0x0bf7,0x14a));var _0x70bf=function(_0x2739d1,_0x40d375){_0x2739d1=_0x2739d1-0x0;var _0x44b81a=_0x0bf7[_0x2739d1];return _0x44b81a;};'use strict';var _=require(_0x70bf('0x0'));var util=require('util');var BPromise=require(_0x70bf('0x1'));var db=require(_0x70bf('0x2'))['db'];var config=require(_0x70bf('0x3'));var queryQueues={'attributes':['id',_0x70bf('0x4')],'include':[{'as':_0x70bf('0x5'),'model':db[_0x70bf('0x6')],'attributes':['id','name',_0x70bf('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x70bf('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x70bf('0x4')],'where':{'role':_0x70bf('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x70bf('0x4'),_0x70bf('0x9')],'where':{'type':_0x70bf('0xa')}};function getAssociatedResources(_0xeca0e3,_0x3910cb,_0x70693f){return db[_0x70bf('0xb')]['findOne']({'where':{'name':_0xeca0e3,'userProfileId':_0x3910cb},'raw':!![]})['then'](function(_0x976715){if(_0x976715){if(_0x976715['autoAssociation']){switch(_0xeca0e3){case _0x70bf('0xc'):case _0x70bf('0xd'):case _0x70bf('0xe'):case _0x70bf('0xf'):case _0x70bf('0x10'):case'OpenchannelQueues':case _0x70bf('0x11'):return db[_0x70693f][_0x70bf('0x12')](queryQueues);case _0x70bf('0x13'):return db[_0x70693f]['findAll'](queryTelephones);case _0x70bf('0x14'):return db[_0x70693f]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x70693f][_0x70bf('0x12')](queryCampaigns);}}else{return db[_0x70bf('0x15')]['findAll']({'attributes':[_0x70bf('0x16')],'where':{'sectionId':_0x976715['id']},'raw':!![]})['then'](function(_0x1e0dfc){if(_0x1e0dfc){var _0x5e5b4a={'where':{'id':_['map'](_0x1e0dfc,_0x70bf('0x16'))},'raw':!![]};switch(_0x70693f){case _0x70bf('0x6'):_0x5e5b4a[_0x70bf('0x17')][_0x70bf('0x7')]=_0x70bf('0x18');break;case _0x70bf('0x19'):_0x5e5b4a['where'][_0x70bf('0x9')]=_0x70bf('0xa');break;}return db[_0x70693f][_0x70bf('0x12')](_0x5e5b4a);}else{return[];}});}}else{return[];}})['then'](function(_0x1cfec3){return _0x1cfec3;});}function joinOrLeaveQueues(_0x5378f3,_0x1c2e22,_0x2c11d6,_0x534d80){_0x5378f3[_0x1c2e22](util[_0x70bf('0x1a')](_0x70bf('0x1b'),_0x2c11d6,_0x534d80['name']));if(_0x534d80[_0x70bf('0x5')]){for(var _0x5424a6=0x0;_0x5424a6<_0x534d80[_0x70bf('0x5')]['length'];_0x5424a6+=0x1){_0x5378f3[_0x1c2e22](util[_0x70bf('0x1a')](_0x70bf('0x1c'),_0x534d80[_0x70bf('0x5')][_0x5424a6][_0x70bf('0x4')]));}}}function joinOrLeave(_0x46e783,_0x4dfe63,_0x18d2e6){var _0xb20a35;if(_0x46e783[_0x70bf('0x1d')]['query']['id']){db[_0x70bf('0x6')][_0x70bf('0x1e')]({'attributes':['id',_0x70bf('0x4'),'role',_0x70bf('0x1f')],'where':{'id':_0x46e783['handshake']['query']['id']},'include':[{'model':db[_0x70bf('0x20')],'as':_0x70bf('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x70bf('0x22')],'as':_0x70bf('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x70bf('0x24')],'as':_0x70bf('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x70bf('0x26')],'as':_0x70bf('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x70bf('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x70bf('0x29')],'as':_0x70bf('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x70bf('0x2b')](function(_0xe9bbaf){if(_0xe9bbaf){_0xb20a35=_0xe9bbaf;_0x46e783[_0x4dfe63](util[_0x70bf('0x1a')](_0x70bf('0x1c'),_0xe9bbaf[_0x70bf('0x4')]));var _0x356db2=[];switch(_0xe9bbaf[_0x70bf('0x7')]){case _0x70bf('0x2c'):_0x46e783[_0x4dfe63](_0x70bf('0x2d'));_0x46e783[_0x4dfe63](_0x70bf('0x2e'));if(queryQueues[_0x70bf('0x2f')](_0x70bf('0x30'))){delete queryQueues[_0x70bf('0x30')];}_0x356db2[_0x70bf('0x31')](db[_0x70bf('0x32')][_0x70bf('0x12')](queryQueues));_0x356db2[_0x70bf('0x31')](db[_0x70bf('0x33')]['findAll'](queryQueues));_0x356db2[_0x70bf('0x31')](db[_0x70bf('0x34')][_0x70bf('0x12')](queryQueues));_0x356db2[_0x70bf('0x31')](db[_0x70bf('0x35')][_0x70bf('0x12')](queryQueues));_0x356db2[_0x70bf('0x31')](db[_0x70bf('0x36')][_0x70bf('0x12')](queryQueues));_0x356db2['push'](db[_0x70bf('0x37')][_0x70bf('0x12')](queryQueues));_0x356db2['push'](db[_0x70bf('0x38')][_0x70bf('0x12')](queryQueues));_0x356db2['push'](db['User']['findAll'](queryTelephones));_0x356db2[_0x70bf('0x31')](db[_0x70bf('0x39')][_0x70bf('0x12')](queryTrunks));_0x356db2[_0x70bf('0x31')](db[_0x70bf('0x19')][_0x70bf('0x12')](queryCampaigns));_0x356db2[_0x70bf('0x31')](db[_0x70bf('0x6')][_0x70bf('0x12')](queryAgents));break;case _0x70bf('0x3a'):_0x46e783[_0x4dfe63](_0x70bf('0x2d'));_0x46e783[_0x4dfe63](_0x70bf('0x2e'));_0x356db2[_0x70bf('0x31')](getAssociatedResources('VoiceQueues',_0xe9bbaf[_0x70bf('0x1f')],'VoiceQueue'));_0x356db2[_0x70bf('0x31')](getAssociatedResources(_0x70bf('0xd'),_0xe9bbaf[_0x70bf('0x1f')],_0x70bf('0x33')));_0x356db2['push'](getAssociatedResources(_0x70bf('0xe'),_0xe9bbaf[_0x70bf('0x1f')],'FaxQueue'));_0x356db2[_0x70bf('0x31')](getAssociatedResources(_0x70bf('0xf'),_0xe9bbaf['userProfileId'],_0x70bf('0x35')));_0x356db2['push'](getAssociatedResources('MailQueues',_0xe9bbaf[_0x70bf('0x1f')],_0x70bf('0x36')));_0x356db2[_0x70bf('0x31')](getAssociatedResources(_0x70bf('0x3b'),_0xe9bbaf[_0x70bf('0x1f')],_0x70bf('0x37')));_0x356db2[_0x70bf('0x31')](getAssociatedResources(_0x70bf('0x11'),_0xe9bbaf['userProfileId'],'WhatsappQueue'));_0x356db2[_0x70bf('0x31')](getAssociatedResources(_0x70bf('0x13'),_0xe9bbaf['userProfileId'],_0x70bf('0x6')));_0x356db2[_0x70bf('0x31')](getAssociatedResources('Trunks',_0xe9bbaf[_0x70bf('0x1f')],_0x70bf('0x39')));_0x356db2[_0x70bf('0x31')](getAssociatedResources(_0x70bf('0x3c'),_0xe9bbaf[_0x70bf('0x1f')],_0x70bf('0x19')));_0x356db2['push'](db[_0x70bf('0x6')][_0x70bf('0x12')](queryAgents));break;case _0x70bf('0x8'):_0x46e783[_0x4dfe63](_0x70bf('0x2d'));_0x46e783[_0x4dfe63]('voice:outbound');_0x356db2['push'](_0xe9bbaf['getVoiceQueues']({'attributes':['id',_0x70bf('0x4')]}));_0x356db2[_0x70bf('0x31')](_0xe9bbaf[_0x70bf('0x3d')]({'attributes':['id','name']}));_0x356db2[_0x70bf('0x31')](_0xe9bbaf[_0x70bf('0x3e')]({'attributes':['id',_0x70bf('0x4')]}));_0x356db2[_0x70bf('0x31')](_0xe9bbaf[_0x70bf('0x3f')]({'attributes':['id','name']}));_0x356db2[_0x70bf('0x31')](_0xe9bbaf[_0x70bf('0x40')]({'attributes':['id',_0x70bf('0x4')]}));_0x356db2[_0x70bf('0x31')](_0xe9bbaf[_0x70bf('0x41')]({'attributes':['id',_0x70bf('0x4')]}));_0x356db2['push'](_0xe9bbaf['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x70bf('0x42')](_0x356db2);}})[_0x70bf('0x2b')](function(_0x36c22b){if(_0x36c22b&&_0x36c22b[_0x70bf('0x43')]){for(var _0x27cc4f=0x0;_0x27cc4f<_0x36c22b[_0x70bf('0x43')];_0x27cc4f+=0x1){for(var _0x5ab54e=0x0;_0x5ab54e<_0x36c22b[_0x27cc4f][_0x70bf('0x43')];_0x5ab54e+=0x1){switch(_0x27cc4f){case 0x0:joinOrLeaveQueues(_0x46e783,_0x4dfe63,_0x70bf('0x44'),_0x36c22b[_0x27cc4f][_0x5ab54e]);break;case 0x1:joinOrLeaveQueues(_0x46e783,_0x4dfe63,_0x70bf('0x45'),_0x36c22b[_0x27cc4f][_0x5ab54e]);break;case 0x2:joinOrLeaveQueues(_0x46e783,_0x4dfe63,'fax',_0x36c22b[_0x27cc4f][_0x5ab54e]);break;case 0x3:joinOrLeaveQueues(_0x46e783,_0x4dfe63,_0x70bf('0x46'),_0x36c22b[_0x27cc4f][_0x5ab54e]);break;case 0x4:joinOrLeaveQueues(_0x46e783,_0x4dfe63,_0x70bf('0x47'),_0x36c22b[_0x27cc4f][_0x5ab54e]);break;case 0x5:joinOrLeaveQueues(_0x46e783,_0x4dfe63,_0x70bf('0x48'),_0x36c22b[_0x27cc4f][_0x5ab54e]);break;case 0x6:joinOrLeaveQueues(_0x46e783,_0x4dfe63,_0x70bf('0x49'),_0x36c22b[_0x27cc4f][_0x5ab54e]);break;case 0x7:if(_0xb20a35['role']!==_0x70bf('0x8'))_0x46e783[_0x4dfe63](util[_0x70bf('0x1a')](_0x70bf('0x4a'),_0x36c22b[_0x27cc4f][_0x5ab54e][_0x70bf('0x4')]));break;case 0x8:if(_0xb20a35[_0x70bf('0x7')]!==_0x70bf('0x8'))_0x46e783[_0x4dfe63](util['format'](_0x70bf('0x4b'),_0x36c22b[_0x27cc4f][_0x5ab54e][_0x70bf('0x4')]));break;case 0x9:if(_0xb20a35['role']!=='agent')_0x46e783[_0x4dfe63](util[_0x70bf('0x1a')](_0x70bf('0x4c'),_0x36c22b[_0x27cc4f][_0x5ab54e][_0x70bf('0x9')],_0x36c22b[_0x27cc4f][_0x5ab54e][_0x70bf('0x4')]));break;case 0xa:_0x46e783[_0x4dfe63](util[_0x70bf('0x1a')](_0x70bf('0x1c'),_0x36c22b[_0x27cc4f][_0x5ab54e]['name']));break;}}}}})['then'](function(){if(_0x4dfe63==='leave'){var _0x12a060=_[_0x70bf('0x4d')](_0xb20a35[_0x70bf('0x21')],'id');return _0xb20a35[_0x70bf('0x4e')](_0x12a060)[_0x70bf('0x2b')](function(){for(var _0xfc4e4c=0x0;_0xfc4e4c<_0x12a060['length'];_0xfc4e4c+=0x1){_0x18d2e6[_0x70bf('0x4f')](_0x70bf('0x50'),{'ChatInteractionId':Number(_0x12a060[_0xfc4e4c]),'UserId':Number(_0xb20a35['id'])});}});}})[_0x70bf('0x2b')](function(){if(_0x4dfe63===_0x70bf('0x51')){var _0x2000a8=_[_0x70bf('0x4d')](_0xb20a35[_0x70bf('0x23')],'id');return _0xb20a35['removeMailInteractions'](_0x2000a8)['then'](function(){for(var _0x1f6fd4=0x0;_0x1f6fd4<_0x2000a8['length'];_0x1f6fd4+=0x1){_0x18d2e6['emit'](_0x70bf('0x52'),{'MailInteractionId':Number(_0x2000a8[_0x1f6fd4]),'UserId':Number(_0xb20a35['id'])});}});}})[_0x70bf('0x2b')](function(){if(_0x4dfe63==='leave'){var _0x1d08af=_[_0x70bf('0x4d')](_0xb20a35[_0x70bf('0x25')],'id');return _0xb20a35['removeFaxInteractions'](_0x1d08af)['then'](function(){for(var _0x40c7b5=0x0;_0x40c7b5<_0x1d08af[_0x70bf('0x43')];_0x40c7b5+=0x1){_0x18d2e6[_0x70bf('0x4f')](_0x70bf('0x53'),{'FaxInteractionId':Number(_0x1d08af[_0x40c7b5]),'UserId':Number(_0xb20a35['id'])});}});}})['then'](function(){if(_0x4dfe63==='leave'){var _0x471d40=_[_0x70bf('0x4d')](_0xb20a35[_0x70bf('0x27')],'id');return _0xb20a35['removeSmsInteractions'](_0x471d40)[_0x70bf('0x2b')](function(){for(var _0x195136=0x0;_0x195136<_0x471d40[_0x70bf('0x43')];_0x195136+=0x1){_0x18d2e6[_0x70bf('0x4f')](_0x70bf('0x54'),{'SmsInteractionId':Number(_0x471d40[_0x195136]),'UserId':Number(_0xb20a35['id'])});}});}})[_0x70bf('0x2b')](function(){if(_0x4dfe63===_0x70bf('0x51')){var _0x1892f5=_[_0x70bf('0x4d')](_0xb20a35['OpenchannelInteractions'],'id');return _0xb20a35['removeOpenchannelInteractions'](_0x1892f5)[_0x70bf('0x2b')](function(){for(var _0x5e1e47=0x0;_0x5e1e47<_0x1892f5[_0x70bf('0x43')];_0x5e1e47+=0x1){_0x18d2e6[_0x70bf('0x4f')](_0x70bf('0x55'),{'OpenchannelInteractionId':Number(_0x1892f5[_0x5e1e47]),'UserId':Number(_0xb20a35['id'])});}});}})['then'](function(){if(_0x4dfe63===_0x70bf('0x51')){var _0x41db5c=_[_0x70bf('0x4d')](_0xb20a35['WhatsappInteractions'],'id');return _0xb20a35[_0x70bf('0x56')](_0x41db5c)[_0x70bf('0x2b')](function(){for(var _0x5ba6b5=0x0;_0x5ba6b5<_0x41db5c[_0x70bf('0x43')];_0x5ba6b5+=0x1){_0x18d2e6[_0x70bf('0x4f')](_0x70bf('0x57'),{'WhatsappInteractionId':Number(_0x41db5c[_0x5ba6b5]),'UserId':Number(_0xb20a35['id'])});}});}})['catch'](function(_0x58fc74){_0x46e783[_0x70bf('0x58')](_0x58fc74);});}}function onDisconnect(_0x1f4d90,_0x5c769d){joinOrLeave(_0x1f4d90,_0x70bf('0x51'),_0x5c769d);}function onConnect(_0x48a0b9){joinOrLeave(_0x48a0b9,'join');}exports['default']=function(_0x1d28ca){_0x1d28ca['on'](_0x70bf('0x59'),function(_0x1b1edf){_0x1b1edf[_0x70bf('0x5a')](0x0);_0x1b1edf['address']=_0x1b1edf['request'][_0x70bf('0x59')][_0x70bf('0x5b')]+':'+_0x1b1edf['request'][_0x70bf('0x59')]['remotePort'];_0x1b1edf[_0x70bf('0x5c')]=new Date();_0x1b1edf[_0x70bf('0x58')]=function(_0x3d9f9f){console[_0x70bf('0x58')]('SocketIO\x20'+_0x1b1edf[_0x70bf('0x5d')][_0x70bf('0x4')]+'['+_0x1b1edf[_0x70bf('0x5e')]+']',_0x3d9f9f);};_0x1b1edf['on'](_0x70bf('0x5f'),function(){onDisconnect(_0x1b1edf,_0x1d28ca);_0x1b1edf['log']('DISCONNECTED');});onConnect(_0x1b1edf);_0x1b1edf['log']('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 01522d9..691d7eb 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 _0x7a67=['default','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','triggers','Chat','afterCreate','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','newinteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','then','info','Trigger,\x20%s','error','code','get','channel','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','format','SIP/%s','incomingmessage','outgoingmessage','catch','AfterCreateMessage','offlineMessage','opened','contact','interface','agent','AfterCreate','changed','closed','substatus','User','find','fullname','email','internal'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7a67,0x179));var _0x77a6=function(_0x2e2f0b,_0x56cce2){_0x2e2f0b=_0x2e2f0b-0x0;var _0xf68f68=_0x7a67[_0x2e2f0b];return _0xf68f68;};'use strict';var util=require(_0x77a6('0x0'));var db=require(_0x77a6('0x1'))['db'];var jayson=require('jayson/promise');var logger=require('../logger')(_0x77a6('0x2'));var client=jayson['client']['http']({'port':0x232a});var triggers=[{'channel':_0x77a6('0x3'),'model':'ChatInteraction','event':_0x77a6('0x4'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x77a6('0x3'),'model':_0x77a6('0x5'),'event':_0x77a6('0x6'),'condition':_0x77a6('0x7'),'callback':afterUpdate},{'channel':_0x77a6('0x3'),'model':_0x77a6('0x8'),'event':_0x77a6('0x4'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x77a6('0x3'),'model':'ChatOfflineMessage','event':_0x77a6('0x4'),'condition':_0x77a6('0x9'),'callback':afterCreateOfflineMessage},{'channel':_0x77a6('0xa'),'model':_0x77a6('0xb'),'event':_0x77a6('0x4'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x77a6('0xa'),'model':_0x77a6('0xb'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':_0x77a6('0xc'),'event':'afterCreate','condition':_0x77a6('0x9'),'callback':afterCreateMessage},{'channel':_0x77a6('0xd'),'model':_0x77a6('0xe'),'event':'afterCreate','condition':_0x77a6('0xf'),'callback':afterCreate},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0x77a6('0x6'),'condition':_0x77a6('0x7'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x77a6('0x10'),'event':'afterCreate','condition':_0x77a6('0x9'),'callback':afterCreateMessage},{'channel':_0x77a6('0x11'),'model':_0x77a6('0x12'),'event':_0x77a6('0x4'),'condition':_0x77a6('0xf'),'callback':afterCreate},{'channel':_0x77a6('0x11'),'model':'FaxInteraction','event':_0x77a6('0x6'),'condition':_0x77a6('0x7'),'callback':afterUpdate},{'channel':_0x77a6('0x11'),'model':_0x77a6('0x13'),'event':_0x77a6('0x4'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x77a6('0x14'),'model':_0x77a6('0x15'),'event':_0x77a6('0x4'),'condition':_0x77a6('0xf'),'callback':afterCreate},{'channel':'Mail','model':_0x77a6('0x15'),'event':_0x77a6('0x6'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x77a6('0x14'),'model':_0x77a6('0x16'),'event':'afterCreate','condition':_0x77a6('0x9'),'callback':afterCreateMessage},{'channel':_0x77a6('0x17'),'model':'OpenchannelInteraction','event':_0x77a6('0x4'),'condition':_0x77a6('0xf'),'callback':afterCreate},{'channel':_0x77a6('0x17'),'model':_0x77a6('0x18'),'event':_0x77a6('0x6'),'condition':_0x77a6('0x7'),'callback':afterUpdate},{'channel':_0x77a6('0x17'),'model':_0x77a6('0x19'),'event':_0x77a6('0x4'),'condition':_0x77a6('0x9'),'callback':afterCreateMessage}];function request(_0xed9470){return client['request'](_0x77a6('0x1a'),_0xed9470)[_0x77a6('0x1b')](function(_0x3c49b9){logger[_0x77a6('0x1c')](_0x77a6('0x1d'),'EventManager',_0x3c49b9);if(_0x3c49b9[_0x77a6('0x1e')]){if(_0x3c49b9[_0x77a6('0x1e')][_0x77a6('0x1f')]===0x1f4){logger['error'](_0x77a6('0x1d'),_0x77a6('0x1a'),_0x3c49b9['error']);}}})['catch'](function(_0x31bdae){logger[_0x77a6('0x1e')](_0x77a6('0x1d'),'EventManager',_0x31bdae);});}function afterCreateMessage(_0x136067){return function(_0x4b82e9){_0x4b82e9=_0x4b82e9[_0x77a6('0x20')]({'plain':!![]});_0x4b82e9[_0x77a6('0x21')]=_0x136067;_0x4b82e9[_0x77a6('0x22')]=_0x136067;_0x4b82e9[_0x77a6('0x23')]=_0x4b82e9[_0x77a6('0x24')];Promise[_0x77a6('0x25')]()[_0x77a6('0x1b')](function(){if(typeof _0x4b82e9[_0x77a6('0x26')]===_0x77a6('0x27'))return null;var _0x264ada=_0x77a6('0x28')+_0x4b82e9[_0x77a6('0x26')];return db[_0x77a6('0x29')][_0x77a6('0x2a')](_0x264ada,{'type':db[_0x77a6('0x2b')][_0x77a6('0x2c')][_0x77a6('0x2d')],'raw':!![]});})[_0x77a6('0x1b')](function(_0x53c7cb){if(_0x53c7cb){_0x4b82e9['contact']=_0x53c7cb[0x0];}if(typeof _0x4b82e9[_0x77a6('0x2e')]===_0x77a6('0x27'))return;return getAgent(_0x4b82e9[_0x77a6('0x2e')]);})['then'](function(_0x386cee){if(_0x386cee){_0x4b82e9['interface']=util[_0x77a6('0x2f')](_0x77a6('0x30'),_0x386cee['name']);_0x4b82e9['agent']=_0x386cee;_0x4b82e9[_0x77a6('0x21')]=_0x136067;return request({'event':_0x77a6('0x31'),'message':_0x4b82e9});}else{return request({'event':_0x77a6('0x32'),'message':_0x4b82e9});}})[_0x77a6('0x33')](function(_0x16c36b){logger['error'](_0x77a6('0x1d'),_0x77a6('0x34'),_0x16c36b);});};}function afterCreateOfflineMessage(_0x2e72ff){return function(_0x4f42ad){_0x4f42ad=_0x4f42ad[_0x77a6('0x20')]({'plain':!![]});_0x4f42ad[_0x77a6('0x21')]=_0x2e72ff;_0x4f42ad['motionChannel']=_0x2e72ff;_0x4f42ad['event']=_0x77a6('0x35');return request({'event':_0x4f42ad['event'],'message':_0x4f42ad});};}function afterCreate(_0x11070a,_0x4cf3e9){return function(_0x17a159){_0x17a159=_0x17a159['get']({'plain':!![]});_0x17a159[_0x77a6('0x21')]=_0x11070a;_0x17a159['motionChannel']=_0x11070a;_0x17a159[_0x77a6('0x23')]=_0x77a6('0x36');Promise[_0x77a6('0x25')]()[_0x77a6('0x1b')](function(){var _0x3db3f1=_0x77a6('0x28')+_0x17a159[_0x77a6('0x26')];return db['sequelize'][_0x77a6('0x2a')](_0x3db3f1,{'type':db[_0x77a6('0x2b')][_0x77a6('0x2c')][_0x77a6('0x2d')],'raw':!![]});})[_0x77a6('0x1b')](function(_0x57e664){if(_0x57e664){_0x17a159[_0x77a6('0x37')]=_0x57e664[0x0];}if(typeof _0x17a159[_0x77a6('0x2e')]===_0x77a6('0x27'))return;return getAgent(_0x17a159[_0x77a6('0x2e')]);})[_0x77a6('0x1b')](function(_0x1b4296){if(_0x1b4296){_0x17a159[_0x77a6('0x38')]=util[_0x77a6('0x2f')]('SIP/%s',_0x1b4296['name']);_0x17a159[_0x77a6('0x39')]=_0x1b4296;}return request({'event':_0x4cf3e9,'message':_0x17a159});})[_0x77a6('0x33')](function(_0x18c6d1){logger[_0x77a6('0x1e')]('Trigger,\x20%s',_0x77a6('0x3a'),_0x18c6d1);});};}function afterUpdate(_0x2f57af){return function(_0x5088a3){var _0xf94124=_0x5088a3[_0x77a6('0x3b')](_0x77a6('0x3c'))&&_0x5088a3[_0x77a6('0x3c')];var _0x4d065d=_0x5088a3[_0x77a6('0x3b')]('substatus');if(_0xf94124||_0x4d065d){var _0x2cf94e=_0xf94124?'closedinteraction':'substatus';var _0x8ca6f=_0x5088a3['get']({'plain':!![]});_0x8ca6f['channel']=_0x2f57af;_0x8ca6f[_0x77a6('0x22')]=_0x2f57af;_0x8ca6f[_0x77a6('0x23')]=_0xf94124?_0x77a6('0x3c'):_0x77a6('0x3d');var _0xabf986=_0x77a6('0x28')+_0x8ca6f[_0x77a6('0x26')];return db[_0x77a6('0x29')][_0x77a6('0x2a')](_0xabf986,{'type':db[_0x77a6('0x2b')][_0x77a6('0x2c')]['SELECT'],'raw':!![]})[_0x77a6('0x1b')](function(_0x15cf29){if(_0x15cf29){_0x8ca6f[_0x77a6('0x37')]=_0x15cf29[0x0];}if(typeof _0x8ca6f['UserId']===_0x77a6('0x27'))return;return getAgent(_0x8ca6f[_0x77a6('0x2e')]);})[_0x77a6('0x1b')](function(_0x1689d0){if(_0x1689d0){_0x8ca6f[_0x77a6('0x38')]=util[_0x77a6('0x2f')](_0x77a6('0x30'),_0x1689d0['name']);_0x8ca6f[_0x77a6('0x39')]=_0x1689d0;}return request({'event':_0x2cf94e,'message':_0x8ca6f});})['catch'](function(_0x31f367){logger['error'](_0x77a6('0x1d'),'AfterUpdate',_0x31f367);});}};}function getAgent(_0xd1076d){return db[_0x77a6('0x3e')][_0x77a6('0x3f')]({'where':{'id':_0xd1076d},'attributes':['id','name',_0x77a6('0x40'),_0x77a6('0x41'),_0x77a6('0x42')],'raw':!![]})['then'](function(_0x5625ff){return _0x5625ff;});}exports[_0x77a6('0x43')]=function(){for(var _0x350c34=0x0;_0x350c34=_0x5d4244['agents']){throw Error(_0xb5ce('0x18'));}_0x1dae71(_0x3f5516);})['catch'](function(_0x5eec64){_0xba3328(_0x5eec64);});});}; \ No newline at end of file +var _0x3198=['then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','voice','chat','fax','openchannel','getChannels','includes','clearBlockUser','isUndefined','updateAttributes','getLicense','agent','User','count'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x3198,0xb8));var _0x8319=function(_0x45ac37,_0x1b8474){_0x45ac37=_0x45ac37-0x0;var _0x2969cc=_0x3198[_0x45ac37];return _0x2969cc;};'use strict';var _=require(_0x8319('0x0'));var BPromise=require('bluebird');var db=require(_0x8319('0x1'))['db'];var util=require(_0x8319('0x2'));var channels=[_0x8319('0x3'),'mail',_0x8319('0x4'),_0x8319('0x5'),'sms','whatsapp',_0x8319('0x6')];exports[_0x8319('0x7')]=function(){return channels;};exports['isValidChannel']=function(_0x28cddc){_0x28cddc=_0x28cddc['toLowerCase']();return _[_0x8319('0x8')](channels,_0x28cddc);};exports[_0x8319('0x9')]=function(_0x3f9c76,_0x57349d,_0x5dea52,_0x5a93dd){var _0x2638a3={'loginAttempts':_0x57349d,'blocked':_0x5dea52};if(!_[_0x8319('0xa')](_0x5a93dd)){_0x2638a3['blockedAt']=_0x5a93dd;}return _0x3f9c76[_0x8319('0xb')](_0x2638a3);};exports[_0x8319('0xc')]=function(_0x339099){return new BPromise(function(_0xb50910,_0x1e4183){var _0x3a8ac2=0x0;if(_0x339099['role']!==_0x8319('0xd')){_0xb50910(_0x339099);}db[_0x8319('0xe')][_0x8319('0xf')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x339099['id']}}})[_0x8319('0x10')](function(_0x24f78f){_0x3a8ac2=_0x24f78f;return util[_0x8319('0xc')]();})[_0x8319('0x10')](function(_0x355f16){if(_0x355f16&&_0x355f16[_0x8319('0x11')]&&_0x3a8ac2>=_0x355f16[_0x8319('0x11')]){throw Error(_0x8319('0x12'));}_0xb50910(_0x339099);})[_0x8319('0x13')](function(_0x259edd){_0x1e4183(_0x259edd);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 5f873ae..b101fd4 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x887e=['json','exports','404','status'];(function(_0x428290,_0x3480bf){var _0x6b39a=function(_0x534e9c){while(--_0x534e9c){_0x428290['push'](_0x428290['shift']());}};_0x6b39a(++_0x3480bf);}(_0x887e,0x14d));var _0xe887=function(_0x5f4e92,_0x1cf74c){_0x5f4e92=_0x5f4e92-0x0;var _0x4f88c9=_0x887e[_0x5f4e92];return _0x4f88c9;};'use strict';module[_0xe887('0x0')][0x194]=function pageNotFound(_0x461c71,_0x28c35b){var _0x3cb532=_0xe887('0x1');var _0x9acb5d=0x194;var _0x36f1f9={'status':_0x9acb5d};_0x28c35b['status'](_0x36f1f9[_0xe887('0x2')]);_0x28c35b['render'](_0x3cb532,{},function(_0x16e927,_0x5ded7e){if(_0x16e927){return _0x28c35b['status'](_0x36f1f9[_0xe887('0x2')])[_0xe887('0x3')](_0x36f1f9);}_0x28c35b['send'](_0x5ded7e);});}; \ No newline at end of file +var _0x15ec=['404','status','render','send'];(function(_0x3ea0af,_0x59adce){var _0x4b860f=function(_0x1352de){while(--_0x1352de){_0x3ea0af['push'](_0x3ea0af['shift']());}};_0x4b860f(++_0x59adce);}(_0x15ec,0x16c));var _0xc15e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x15ec[_0x4c7fb5];return _0x2e10ac;};'use strict';module['exports'][0x194]=function pageNotFound(_0x3dca0e,_0x9a19d6){var _0x272df9=_0xc15e('0x0');var _0x2924b7=0x194;var _0x4420c1={'status':_0x2924b7};_0x9a19d6[_0xc15e('0x1')](_0x4420c1[_0xc15e('0x1')]);_0x9a19d6[_0xc15e('0x2')](_0x272df9,{},function(_0x46d425,_0x18c3fc){if(_0x46d425){return _0x9a19d6['status'](_0x4420c1[_0xc15e('0x1')])['json'](_0x4420c1);}_0x9a19d6[_0xc15e('0x3')](_0x18c3fc);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e5e9a61..d10c50f 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6976=['username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','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/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Tag','../api/tag/tag.model','Template','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.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','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','hasOne','UserId','cascade','hasMany','VoiceQueuesRt','Extensions','HopperFinals','OpenchannelInteractions','ChatInteraction','SmsInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','UserProfile','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','UserMailQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','ChatWebsites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','VoiceContext','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','Trunk','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','voice_queues_has_cm_lists','UserVoiceQueue','Teams','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','VoiceCallReport','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','TemplateId','Agents','MailInteractionId','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','Account','ChatOfflineMessageId','TagId','DashboardItem','Items','FaxAccountId','Exntensions','mandatoryDispositionPauseId','FaxMessage','FaxInteractionId','fax_interaction_has_tags','Attachment','AttachmentId','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ChatWebsiteId','ChatApplication','user_has_chat_websites','OpenchannelQueueReport','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Members','Company','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','Condition','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','Sound','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','CustomReportId','DefaultReportId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','Field','FieldId','VariableId','SugarcrmAccount','SugarcrmConfiguration','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Field','FreshsalesConfiguration','FreshsalesField','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','SmsQueueReport','ProjectId','JscriptyProject','SquareProject','user_has_teams','team_has_mail_queues','team_has_fax_queues','team_has_whatsapp_queues','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToAccount','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','CustomFields','HopperHistory','Queues','UserProfileSection','Resources','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','UserSetting','user','exports','sequelize','lodash','jstz','defaultsDeep','motion2','127.0.0.1','mysql','utf8mb4','utf8','sequelizeHistory','xcall','xC@LL1234','utf8_general_ci','database'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x6976,0x1f3));var _0x6697=function(_0xa7631c,_0x5f3d78){_0xa7631c=_0xa7631c-0x0;var _0x34d62e=_0x6976[_0xa7631c];return _0x34d62e;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x6697('0x0'));var _=require(_0x6697('0x1'));var jstz=require(_0x6697('0x2'));var timezone=jstz['determine']();config['sequelize']=_[_0x6697('0x3')](config[_0x6697('0x0')],{'database':_0x6697('0x4'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x6697('0x5'),'port':0xcea,'dialect':_0x6697('0x6'),'dialectOptions':{'charset':_0x6697('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x6697('0x8'),'collate':'utf8_general_ci'}}});config[_0x6697('0x9')]=_[_0x6697('0x3')](config[_0x6697('0x9')],{'database':_0x6697('0x4'),'username':_0x6697('0xa'),'password':_0x6697('0xb'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x6697('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x6697('0x8'),'collate':_0x6697('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x6697('0xd')],config['sequelize'][_0x6697('0xe')],config[_0x6697('0x0')][_0x6697('0xf')],config[_0x6697('0x0')][_0x6697('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6697('0x9')]['database'],config['sequelizeHistory'][_0x6697('0xe')],config[_0x6697('0x9')][_0x6697('0xf')],config[_0x6697('0x9')][_0x6697('0x10')])};db[_0x6697('0x11')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x13'));db['VoiceChanSpy']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x14'));db['VoiceContext']=db[_0x6697('0x0')]['import'](_0x6697('0x15'));db[_0x6697('0x16')]=db['sequelize']['import'](_0x6697('0x17'));db['VoiceMusicOnHold']=db['sequelize']['import'](_0x6697('0x18'));db[_0x6697('0x19')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x1a'));db[_0x6697('0x1b')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x1c'));db['ScreenRecording']=db[_0x6697('0x0')]['import'](_0x6697('0x1d'));db[_0x6697('0x1e')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x1f'));db[_0x6697('0x20')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x21'));db['VoiceCallReport']=db['sequelize']['import'](_0x6697('0x22'));db['VoiceDialReport']=db[_0x6697('0x0')][_0x6697('0x12')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0x6697('0x0')]['import'](_0x6697('0x23'));db[_0x6697('0x24')]=db['sequelize'][_0x6697('0x12')](_0x6697('0x25'));db[_0x6697('0x26')]=db['sequelize'][_0x6697('0x12')](_0x6697('0x27'));db['Trunk']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x28'));db[_0x6697('0x29')]=db[_0x6697('0x0')]['import'](_0x6697('0x2a'));db[_0x6697('0x2b')]=db['sequelize']['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x2c'));db[_0x6697('0x2d')]=db[_0x6697('0x0')]['import']('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0x6697('0x0')]['import'](_0x6697('0x2e'));db[_0x6697('0x2f')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x30'));db[_0x6697('0x31')]=db['sequelize'][_0x6697('0x12')](_0x6697('0x32'));db[_0x6697('0x33')]=db['sequelize'][_0x6697('0x12')](_0x6697('0x34'));db[_0x6697('0x35')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x36'));db[_0x6697('0x37')]=db[_0x6697('0x0')]['import'](_0x6697('0x38'));db[_0x6697('0x39')]=db[_0x6697('0x0')]['import'](_0x6697('0x3a'));db[_0x6697('0x3b')]=db[_0x6697('0x0')]['import'](_0x6697('0x3c'));db[_0x6697('0x3d')]=db[_0x6697('0x0')][_0x6697('0x12')]('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x3e'));db[_0x6697('0x3f')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x40'));db[_0x6697('0x41')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x42'));db[_0x6697('0x43')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x44'));db[_0x6697('0x45')]=db[_0x6697('0x0')]['import'](_0x6697('0x46'));db[_0x6697('0x47')]=db['sequelize'][_0x6697('0x12')](_0x6697('0x48'));db['DashboardItem']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x49'));db['FaxAccount']=db[_0x6697('0x0')]['import'](_0x6697('0x4a'));db[_0x6697('0x4b')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x4c'));db[_0x6697('0x4d')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x4e'));db['FaxMessage']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x4f'));db[_0x6697('0x50')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x51'));db[_0x6697('0x52')]=db[_0x6697('0x0')]['import']('../api/faxQueueReport/faxQueueReport.model');db[_0x6697('0x53')]=db[_0x6697('0x0')][_0x6697('0x12')]('../api/smsAccount/smsAccount.model');db[_0x6697('0x54')]=db[_0x6697('0x0')]['import'](_0x6697('0x55'));db[_0x6697('0x56')]=db[_0x6697('0x0')][_0x6697('0x12')]('../api/smsInteraction/smsInteraction.model');db[_0x6697('0x57')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x58'));db[_0x6697('0x59')]=db[_0x6697('0x0')][_0x6697('0x12')]('../api/smsQueue/smsQueue.model');db[_0x6697('0x5a')]=db['sequelize'][_0x6697('0x12')]('../api/openchannelAccount/openchannelAccount.model');db[_0x6697('0x5b')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x5c'));db[_0x6697('0x5d')]=db[_0x6697('0x0')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0x6697('0x5e')]=db[_0x6697('0x0')]['import'](_0x6697('0x5f'));db[_0x6697('0x60')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x61'));db[_0x6697('0x62')]=db['sequelize'][_0x6697('0x12')](_0x6697('0x63'));db['OpenchannelQueueReport']=db[_0x6697('0x0')][_0x6697('0x12')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x64'));db['ChatInteraction']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x65'));db[_0x6697('0x66')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x67'));db[_0x6697('0x68')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x69'));db[_0x6697('0x6a')]=db[_0x6697('0x0')]['import'](_0x6697('0x6b'));db[_0x6697('0x6c')]=db[_0x6697('0x0')]['import'](_0x6697('0x6d'));db[_0x6697('0x6e')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x6f'));db['CmCompany']=db[_0x6697('0x0')][_0x6697('0x12')]('../api/cmCompany/cmCompany.model');db[_0x6697('0x70')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x71'));db[_0x6697('0x72')]=db[_0x6697('0x0')]['import'](_0x6697('0x73'));db[_0x6697('0x74')]=db[_0x6697('0x0')][_0x6697('0x12')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x6697('0x75')]=db['sequelize'][_0x6697('0x12')](_0x6697('0x76'));db[_0x6697('0x77')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x78'));db[_0x6697('0x79')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x7a'));db['CmCustomField']=db['sequelize']['import'](_0x6697('0x7b'));db[_0x6697('0x7c')]=db[_0x6697('0x0')]['import'](_0x6697('0x7d'));db[_0x6697('0x7e')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x7f'));db[_0x6697('0x80')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x81'));db[_0x6697('0x82')]=db[_0x6697('0x0')][_0x6697('0x12')]('../api/disposition/disposition.model');db['Condition']=db[_0x6697('0x0')]['import'](_0x6697('0x83'));db[_0x6697('0x84')]=db['sequelize'][_0x6697('0x12')](_0x6697('0x85'));db['Pause']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x86'));db['Cdr']=db['sequelize'][_0x6697('0x12')]('../api/cdr/cdr.model');db[_0x6697('0x87')]=db['sequelize'][_0x6697('0x12')](_0x6697('0x88'));db[_0x6697('0x89')]=db['sequelize'][_0x6697('0x12')]('../api/schedule/schedule.model');db['Sound']=db[_0x6697('0x0')][_0x6697('0x12')]('../api/sound/sound.model');db[_0x6697('0x8a')]=db[_0x6697('0x0')]['import'](_0x6697('0x8b'));db[_0x6697('0x8c')]=db[_0x6697('0x0')][_0x6697('0x12')]('../api/template/template.model');db[_0x6697('0x8d')]=db[_0x6697('0x0')][_0x6697('0x12')]('../api/trigger/trigger.model');db[_0x6697('0x8e')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x8f'));db[_0x6697('0x90')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x91'));db['IntegrationReport']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x92'));db[_0x6697('0x93')]=db[_0x6697('0x0')][_0x6697('0x12')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x6697('0x94')]=db['sequelize'][_0x6697('0x12')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x6697('0x95')]=db[_0x6697('0x0')][_0x6697('0x12')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x6697('0x96')]=db['sequelize'][_0x6697('0x12')](_0x6697('0x97'));db[_0x6697('0x98')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x99'));db[_0x6697('0x9a')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x9b'));db[_0x6697('0x9c')]=db[_0x6697('0x0')][_0x6697('0x12')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x6697('0x9d')]=db[_0x6697('0x0')][_0x6697('0x12')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x6697('0x9e')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x9f'));db['SugarcrmAccount']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xa0'));db['SugarcrmConfiguration']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xa1'));db[_0x6697('0xa2')]=db['sequelize']['import'](_0x6697('0xa3'));db[_0x6697('0xa4')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xa5'));db[_0x6697('0xa6')]=db['sequelize'][_0x6697('0x12')](_0x6697('0xa7'));db[_0x6697('0xa8')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xa9'));db[_0x6697('0xaa')]=db[_0x6697('0x0')]['import'](_0x6697('0xab'));db[_0x6697('0xac')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xad'));db[_0x6697('0xae')]=db['sequelize']['import'](_0x6697('0xaf'));db[_0x6697('0xb0')]=db[_0x6697('0x0')][_0x6697('0x12')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x6697('0xb1')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xb2'));db[_0x6697('0xb3')]=db['sequelize'][_0x6697('0x12')](_0x6697('0xb4'));db[_0x6697('0xb5')]=db[_0x6697('0x0')][_0x6697('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x6697('0xb6')]=db['sequelize'][_0x6697('0x12')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xb7'));db[_0x6697('0xb8')]=db[_0x6697('0x0')]['import'](_0x6697('0xb9'));db[_0x6697('0xba')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xbb'));db[_0x6697('0xbc')]=db['sequelize'][_0x6697('0x12')]('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db['sequelize'][_0x6697('0x12')](_0x6697('0xbd'));db[_0x6697('0xbe')]=db[_0x6697('0x0')]['import'](_0x6697('0xbf'));db[_0x6697('0xc0')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xc1'));db[_0x6697('0xc2')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xc3'));db[_0x6697('0xc4')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xc5'));db['Dynamics365Field']=db[_0x6697('0x0')][_0x6697('0x12')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x6697('0xc6')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xc7'));db['FreshsalesConfiguration']=db[_0x6697('0x0')]['import'](_0x6697('0xc8'));db['FreshsalesField']=db[_0x6697('0x0')]['import'](_0x6697('0xc9'));db[_0x6697('0x90')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x91'));db[_0x6697('0xca')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xcb'));db[_0x6697('0xcc')]=db[_0x6697('0x0')]['import']('../api/chatQueueReport/chatQueueReport.model');db[_0x6697('0xcd')]=db['sequelize'][_0x6697('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db['sequelize']['import'](_0x6697('0xce'));db['JscriptyQuestionReport']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xcf'));db[_0x6697('0xd0')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xd1'));db['SmsQueueReport']=db['sequelize'][_0x6697('0x12')](_0x6697('0xd2'));db[_0x6697('0xd3')]=db[_0x6697('0x0')]['import'](_0x6697('0xd4'));db[_0x6697('0xd5')]=db['sequelize']['import']('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db['sequelize'][_0x6697('0x12')](_0x6697('0xd6'));db[_0x6697('0xd7')]=db[_0x6697('0x0')]['import'](_0x6697('0xd8'));db[_0x6697('0xd9')]=db[_0x6697('0x0')][_0x6697('0x12')]('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db['sequelize']['import']('../api/squareProject/squareProject.model');db[_0x6697('0xda')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xdb'));db[_0x6697('0xdc')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xdd'));db[_0x6697('0xde')]=db[_0x6697('0x0')]['import']('../api/team/team.model');db[_0x6697('0xdf')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xe0'));db[_0x6697('0xe1')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xe2'));db[_0x6697('0xe3')]=db[_0x6697('0x0')]['import']('../api/migration/migration.model');db['Attachment']=db['sequelize'][_0x6697('0x12')](_0x6697('0xe4'));db[_0x6697('0xe5')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xe6'));db[_0x6697('0xe7')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xe8'));db[_0x6697('0xe9')]=db['sequelize'][_0x6697('0x12')]('../api/chatTransferReport/chatTransferReport.model');db[_0x6697('0xea')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xeb'));db[_0x6697('0xec')]=db[_0x6697('0x0')]['import'](_0x6697('0xed'));db[_0x6697('0xee')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xef'));db[_0x6697('0xf0')]=db[_0x6697('0x0')]['import'](_0x6697('0xf1'));db[_0x6697('0xf2')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xf3'));db['UserProfile']=db['sequelize'][_0x6697('0x12')](_0x6697('0xf4'));db['UserProfileSection']=db['sequelize']['import'](_0x6697('0xf5'));db[_0x6697('0xf6')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xf7'));db['UserNotification']=db['sequelize'][_0x6697('0x12')](_0x6697('0xf8'));db['WhatsappAccount']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xf9'));db[_0x6697('0xfa')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xfb'));db[_0x6697('0xfc')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0xfd'));db[_0x6697('0xfe')]=db['sequelize'][_0x6697('0x12')](_0x6697('0xff'));db['WhatsappQueueReport']=db['sequelize'][_0x6697('0x12')](_0x6697('0x100'));db[_0x6697('0x101')]=db[_0x6697('0x0')]['import'](_0x6697('0x102'));db[_0x6697('0x103')]=db['sequelize'][_0x6697('0x12')](_0x6697('0x104'));db[_0x6697('0x105')]=db[_0x6697('0x0')]['import'](_0x6697('0x106'));db[_0x6697('0x107')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x108'));db[_0x6697('0x109')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x10a'));db[_0x6697('0x10b')]=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x10c'));db['UserSetting']=db[_0x6697('0x0')][_0x6697('0x12')](_0x6697('0x10d'));db[_0x6697('0x11')][_0x6697('0x10e')](db[_0x6697('0x1e')],{'as':_0x6697('0x1e'),'onDelete':'cascade','foreignKey':_0x6697('0x10f')});db[_0x6697('0x11')][_0x6697('0x10e')](db['UserSetting'],{'as':'userSetting','onDelete':_0x6697('0x110'),'foreignKey':'UserId'});db[_0x6697('0x11')]['hasMany'](db[_0x6697('0x1b')],{'as':'Recordings','foreignKey':_0x6697('0x10f')});db['User'][_0x6697('0x111')](db[_0x6697('0x2b')],{'as':_0x6697('0x112'),'foreignKey':_0x6697('0x10f')});db[_0x6697('0x11')]['hasMany'](db['VoiceExtension'],{'as':_0x6697('0x113'),'onDelete':_0x6697('0x110'),'hooks':!![]});db[_0x6697('0x11')][_0x6697('0x111')](db['CmHopperFinal'],{'as':_0x6697('0x114'),'foreignKey':'UserId'});db['User'][_0x6697('0x111')](db[_0x6697('0x77')],{'as':'HopperHistory','foreignKey':_0x6697('0x10f')});db[_0x6697('0x11')][_0x6697('0x111')](db[_0x6697('0x79')],{'as':_0x6697('0x79'),'foreignKey':_0x6697('0x10f')});db[_0x6697('0x11')][_0x6697('0x111')](db['OpenchannelInteraction'],{'as':_0x6697('0x115'),'foreignKey':'UserId'});db[_0x6697('0x11')][_0x6697('0x111')](db[_0x6697('0x116')],{'as':'ChatInteractions','foreignKey':_0x6697('0x10f')});db['User'][_0x6697('0x111')](db[_0x6697('0x56')],{'as':_0x6697('0x117'),'foreignKey':'UserId'});db[_0x6697('0x11')][_0x6697('0x111')](db[_0x6697('0x4d')],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0x6697('0x11')]['hasMany'](db[_0x6697('0x3f')],{'as':_0x6697('0x118'),'foreignKey':_0x6697('0x10f')});db[_0x6697('0x11')][_0x6697('0x111')](db[_0x6697('0xfc')],{'as':_0x6697('0x119'),'foreignKey':_0x6697('0x10f')});db[_0x6697('0x11')][_0x6697('0x111')](db['UserNotification'],{'as':_0x6697('0x11a'),'foreignKey':_0x6697('0x11b')});db[_0x6697('0x11')][_0x6697('0x11c')](db[_0x6697('0x11d')],{'as':'UserProfile','foreignKey':_0x6697('0x11e')});db[_0x6697('0x11')]['belongsToMany'](db[_0x6697('0x6c')],{'as':_0x6697('0x11f'),'through':_0x6697('0x120')});db['User'][_0x6697('0x121')](db['CmContact'],{'as':_0x6697('0x122'),'through':_0x6697('0x123')});db[_0x6697('0x11')][_0x6697('0x121')](db['CmList'],{'as':_0x6697('0x124'),'through':'cm_user_has_lists'});db[_0x6697('0x11')][_0x6697('0x121')](db[_0x6697('0xde')],{'through':'user_has_teams'});db[_0x6697('0x11')][_0x6697('0x121')](db[_0x6697('0x3f')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0x6697('0x11')][_0x6697('0x121')](db[_0x6697('0x116')],{'as':_0x6697('0x125'),'through':_0x6697('0x126')});db['User']['belongsToMany'](db[_0x6697('0x4d')],{'as':_0x6697('0x127'),'through':_0x6697('0x128')});db[_0x6697('0x11')][_0x6697('0x121')](db['SmsInteraction'],{'as':_0x6697('0x117'),'through':_0x6697('0x129')});db[_0x6697('0x11')][_0x6697('0x121')](db[_0x6697('0x5d')],{'as':_0x6697('0x115'),'through':_0x6697('0x12a')});db[_0x6697('0x11')][_0x6697('0x121')](db['WhatsappInteraction'],{'as':_0x6697('0x119'),'through':_0x6697('0x12b')});db[_0x6697('0x11')]['belongsToMany'](db[_0x6697('0x19')],{'as':_0x6697('0x12c'),'through':'UserVoiceQueue','required':![]});db['User'][_0x6697('0x121')](db[_0x6697('0xf2')],{'as':_0x6697('0x12d'),'through':_0x6697('0x10b'),'required':![]});db['User'][_0x6697('0x121')](db[_0x6697('0x3d')],{'as':_0x6697('0x12e'),'through':_0x6697('0x12f'),'required':![]});db[_0x6697('0x11')]['belongsToMany'](db[_0x6697('0x6a')],{'as':_0x6697('0x130'),'through':_0x6697('0x2d'),'required':![],'hooks':!![]});db['User']['belongsToMany'](db[_0x6697('0x50')],{'as':_0x6697('0x131'),'through':_0x6697('0x2f'),'required':![]});db[_0x6697('0x11')][_0x6697('0x121')](db['SmsQueue'],{'as':_0x6697('0x132'),'through':_0x6697('0x31'),'required':![]});db[_0x6697('0x11')][_0x6697('0x121')](db['OpenchannelQueue'],{'as':_0x6697('0x133'),'through':'UserOpenchannelQueue','required':![]});db[_0x6697('0x11')][_0x6697('0x121')](db[_0x6697('0x103')],{'as':_0x6697('0x134'),'through':_0x6697('0x35'),'required':![]});db[_0x6697('0x11')][_0x6697('0x121')](db[_0x6697('0xf0')],{'through':_0x6697('0x135')});db[_0x6697('0x11')][_0x6697('0x121')](db[_0x6697('0x62')],{'as':_0x6697('0x136'),'through':'user_has_chat_websites'});db[_0x6697('0x11')][_0x6697('0x121')](db[_0x6697('0x137')],{'as':_0x6697('0x138'),'through':_0x6697('0x139')});db['User'][_0x6697('0x121')](db[_0x6697('0x3b')],{'as':_0x6697('0x13a'),'through':_0x6697('0x13b')});db[_0x6697('0x11')][_0x6697('0x121')](db[_0x6697('0x5a')],{'as':_0x6697('0x13c'),'through':'user_has_openchannel_accounts'});db['User'][_0x6697('0x121')](db['SmsAccount'],{'as':_0x6697('0x13d'),'through':_0x6697('0x13e')});db['User']['belongsToMany'](db[_0x6697('0x13f')],{'as':_0x6697('0x140'),'through':_0x6697('0x141')});db[_0x6697('0x11')][_0x6697('0x121')](db['SquareProject'],{'as':'SquareProjects','through':_0x6697('0x142')});db[_0x6697('0x143')][_0x6697('0x111')](db['VoiceExtension'],{'as':_0x6697('0x144'),'onDelete':'cascade','foreignKey':_0x6697('0x145')});db[_0x6697('0x146')][_0x6697('0x111')](db['VoiceExtension'],{'onDelete':_0x6697('0x110')});db['VoiceExtension'][_0x6697('0x111')](db[_0x6697('0x16')],{'as':_0x6697('0x147'),'onDelete':_0x6697('0x110')});db[_0x6697('0x148')][_0x6697('0x121')](db['Sound'],{'as':_0x6697('0x149'),'through':_0x6697('0x14a')});db['VoiceQueue'][_0x6697('0x111')](db[_0x6697('0x2b')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x6697('0x19')][_0x6697('0x111')](db[_0x6697('0x72')],{'as':_0x6697('0x14b'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x6697('0x111')](db[_0x6697('0x75')],{'as':'HopperFinals','foreignKey':_0x6697('0x14c')});db[_0x6697('0x19')]['hasMany'](db[_0x6697('0x77')],{'as':_0x6697('0x14d'),'foreignKey':_0x6697('0x14c')});db[_0x6697('0x19')][_0x6697('0x111')](db[_0x6697('0x79')],{'as':_0x6697('0x79'),'foreignKey':_0x6697('0x14c')});db[_0x6697('0x19')]['hasMany'](db['CmHopperBlack'],{'as':_0x6697('0x14e'),'foreignKey':_0x6697('0x14c')});db['VoiceQueue']['hasMany'](db[_0x6697('0xd0')],{'as':_0x6697('0x14f'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':_0x6697('0x150')});db[_0x6697('0x19')]['belongsTo'](db[_0x6697('0x151')],{'as':'TrunkBackup','foreignKey':_0x6697('0x152')});db[_0x6697('0x19')][_0x6697('0x11c')](db[_0x6697('0x84')],{'as':_0x6697('0x84'),'foreignKey':_0x6697('0x153')});db[_0x6697('0x19')][_0x6697('0x11c')](db[_0x6697('0x154')],{'as':_0x6697('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0x6697('0x124'),'through':_0x6697('0x156')});db[_0x6697('0x19')][_0x6697('0x121')](db[_0x6697('0x11')],{'as':'Agents','through':_0x6697('0x157')});db[_0x6697('0x19')][_0x6697('0x121')](db[_0x6697('0xde')],{'as':_0x6697('0x158'),'through':_0x6697('0x107')});db['VoiceQueue'][_0x6697('0x121')](db['CmList'],{'as':'BlackLists','through':_0x6697('0x159')});db[_0x6697('0x1b')][_0x6697('0x11c')](db['User'],{'as':_0x6697('0x11'),'foreignKey':_0x6697('0x10f')});db[_0x6697('0x15a')][_0x6697('0x11c')](db[_0x6697('0x11')],{'as':_0x6697('0x11'),'foreignKey':_0x6697('0x10f')});db[_0x6697('0x1e')][_0x6697('0x111')](db[_0x6697('0x20')],{'as':_0x6697('0x15b'),'onDelete':'cascade','foreignKey':_0x6697('0x15c'),'sourceKey':_0x6697('0x15d')});db[_0x6697('0x20')][_0x6697('0x11c')](db[_0x6697('0x1e')],{'foreignKey':'mailboxuser','targetKey':_0x6697('0x15d')});db[_0x6697('0x15e')][_0x6697('0x111')](db[_0x6697('0x24')],{'as':'QueueCalls','foreignKey':_0x6697('0x15f'),'constraints':![]});db['VoiceCallReport'][_0x6697('0x111')](db['VoiceAgentReport'],{'as':_0x6697('0x160'),'foreignKey':'uniqueid','constraints':![]});db[_0x6697('0x15e')][_0x6697('0x11c')](db[_0x6697('0x11')],{'as':_0x6697('0x11'),'foreignKey':'UserId'});db[_0x6697('0x15e')]['belongsTo'](db[_0x6697('0x70')],{'as':_0x6697('0x161'),'foreignKey':_0x6697('0x162')});db[_0x6697('0x37')]['belongsTo'](db[_0x6697('0x3b')],{'as':_0x6697('0x3b'),'foreignKey':_0x6697('0x163')});db[_0x6697('0x37')]['belongsTo'](db[_0x6697('0x105')],{'as':'CloudProvider','foreignKey':_0x6697('0x164'),'onDelete':_0x6697('0x165')});db['MailServerOut'][_0x6697('0x11c')](db[_0x6697('0x3b')],{'as':_0x6697('0x3b'),'foreignKey':_0x6697('0x163')});db[_0x6697('0x39')][_0x6697('0x11c')](db[_0x6697('0x105')],{'as':'CloudProvider','foreignKey':_0x6697('0x164'),'onDelete':_0x6697('0x165')});db[_0x6697('0x3b')]['hasOne'](db[_0x6697('0x37')],{'as':_0x6697('0x166'),'onDelete':'cascade'});db[_0x6697('0x3b')]['hasOne'](db['MailServerOut'],{'as':_0x6697('0x167'),'onDelete':_0x6697('0x110')});db[_0x6697('0x3b')]['hasMany'](db[_0x6697('0x82')],{'as':_0x6697('0x168'),'foreignKey':_0x6697('0x163'),'onDelete':'cascade'});db[_0x6697('0x3b')][_0x6697('0x111')](db[_0x6697('0x80')],{'as':_0x6697('0x169'),'foreignKey':_0x6697('0x163')});db['MailAccount'][_0x6697('0x111')](db[_0x6697('0x41')],{'as':_0x6697('0x15b'),'foreignKey':'MailAccountId'});db[_0x6697('0x3b')]['hasMany'](db[_0x6697('0x3f')],{'as':_0x6697('0x16a')});db['MailAccount']['hasMany'](db[_0x6697('0x43')],{'as':_0x6697('0x147')});db['MailAccount'][_0x6697('0x11c')](db[_0x6697('0xf0')],{'as':_0x6697('0x16b'),'foreignKey':_0x6697('0x16c')});db[_0x6697('0x3b')][_0x6697('0x11c')](db[_0x6697('0x8c')],{'as':_0x6697('0x8c'),'foreignKey':_0x6697('0x16d')});db[_0x6697('0x3b')][_0x6697('0x11c')](db[_0x6697('0x154')],{'as':_0x6697('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6697('0x3b')][_0x6697('0x121')](db[_0x6697('0x11')],{'as':_0x6697('0x16e'),'through':_0x6697('0x13b')});db[_0x6697('0x3d')][_0x6697('0x121')](db[_0x6697('0x11')],{'as':_0x6697('0x16e'),'through':_0x6697('0x12f')});db[_0x6697('0x3d')][_0x6697('0x121')](db[_0x6697('0xde')],{'through':'team_has_mail_queues','as':'Teams'});db[_0x6697('0x3f')][_0x6697('0x111')](db[_0x6697('0x41')],{'as':_0x6697('0x15b'),'onDelete':'cascade','foreignKey':_0x6697('0x16f')});db[_0x6697('0x3f')][_0x6697('0x11c')](db['MailAccount'],{'as':'Account','foreignKey':_0x6697('0x163')});db[_0x6697('0x3f')][_0x6697('0x11c')](db[_0x6697('0x70')],{'as':_0x6697('0x161'),'foreignKey':_0x6697('0x162')});db['MailInteraction'][_0x6697('0x11c')](db[_0x6697('0x11')],{'as':_0x6697('0x170'),'foreignKey':_0x6697('0x10f')});db[_0x6697('0x3f')]['belongsToMany'](db[_0x6697('0x8a')],{'through':'mail_interaction_has_tags','as':_0x6697('0x171')});db[_0x6697('0x3f')][_0x6697('0x121')](db[_0x6697('0x8a')],{'through':_0x6697('0x172'),'as':_0x6697('0x173')});db[_0x6697('0x3f')][_0x6697('0x121')](db[_0x6697('0x11')],{'as':_0x6697('0x174'),'through':_0x6697('0x175'),'foreignKey':'MailInteractionId'});db[_0x6697('0x41')][_0x6697('0x111')](db['Attachment'],{'as':_0x6697('0x176'),'onDelete':_0x6697('0x110')});db['MailMessage']['belongsTo'](db['User'],{'as':'User'});db[_0x6697('0x41')][_0x6697('0x11c')](db[_0x6697('0x70')],{'onDelete':_0x6697('0x110'),'as':'Contact'});db['MailMessage'][_0x6697('0x11c')](db['MailInteraction'],{'as':_0x6697('0x177'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x6697('0x11c')](db[_0x6697('0x3b')],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x163')});db[_0x6697('0x41')][_0x6697('0x11c')](db[_0x6697('0x62')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db['MailMessage'][_0x6697('0x11c')](db[_0x6697('0x68')],{'as':'ChatOfflineMessage','foreignKey':_0x6697('0x179')});db[_0x6697('0x43')][_0x6697('0x11c')](db[_0x6697('0x11')],{'onDelete':_0x6697('0x165')});db[_0x6697('0x43')][_0x6697('0x11c')](db['MailQueue'],{'onDelete':_0x6697('0x165')});db['MailApplication'][_0x6697('0x11c')](db[_0x6697('0x3b')],{'onDelete':_0x6697('0x165')});db[_0x6697('0x43')]['belongsTo'](db[_0x6697('0x84')],{'onDelete':_0x6697('0x165'),'foreignKey':_0x6697('0x153')});db[_0x6697('0x43')][_0x6697('0x11c')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x6697('0x17a')});db[_0x6697('0x45')][_0x6697('0x11c')](db[_0x6697('0x3b')],{});db['MailQueueReport'][_0x6697('0x11c')](db[_0x6697('0xf0')],{'as':_0x6697('0x16b'),'foreignKey':'ListId'});db[_0x6697('0x45')][_0x6697('0x11c')](db[_0x6697('0x70')],{'as':'Contact','foreignKey':_0x6697('0x162')});db[_0x6697('0x45')][_0x6697('0x11c')](db[_0x6697('0x3f')],{});db[_0x6697('0x45')][_0x6697('0x11c')](db[_0x6697('0x41')],{});db[_0x6697('0x45')][_0x6697('0x11c')](db['User'],{});db['MailQueueReport'][_0x6697('0x11c')](db[_0x6697('0x3d')],{});db['Dashboard']['hasMany'](db[_0x6697('0x17b')],{'as':_0x6697('0x17c'),'onDelete':'cascade'});db[_0x6697('0x137')][_0x6697('0x111')](db['Disposition'],{'as':_0x6697('0x168'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0x6697('0x137')][_0x6697('0x111')](db[_0x6697('0x80')],{'as':_0x6697('0x169'),'foreignKey':_0x6697('0x17d')});db[_0x6697('0x137')]['hasMany'](db[_0x6697('0x4d')],{'as':'Interactions'});db[_0x6697('0x137')][_0x6697('0x111')](db[_0x6697('0x4b')],{'as':_0x6697('0x147')});db[_0x6697('0x137')][_0x6697('0x111')](db['VoiceExtension'],{'as':_0x6697('0x17e'),'onDelete':_0x6697('0x110')});db[_0x6697('0x137')]['hasMany'](db['FaxMessage'],{'as':_0x6697('0x15b')});db[_0x6697('0x137')][_0x6697('0x11c')](db[_0x6697('0x151')],{'as':_0x6697('0x151')});db[_0x6697('0x137')][_0x6697('0x11c')](db[_0x6697('0xf0')],{'as':_0x6697('0x16b'),'foreignKey':_0x6697('0x16c')});db['FaxAccount'][_0x6697('0x11c')](db[_0x6697('0x154')],{'as':'mandatoryDispositionPause','foreignKey':_0x6697('0x17f')});db['FaxAccount']['belongsToMany'](db['User'],{'as':'Agents','through':_0x6697('0x139')});db[_0x6697('0x4b')]['belongsTo'](db['User'],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db[_0x6697('0x50')],{'onDelete':_0x6697('0x165')});db['FaxApplication'][_0x6697('0x11c')](db[_0x6697('0x137')],{'onDelete':_0x6697('0x165')});db[_0x6697('0x4b')][_0x6697('0x11c')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x6697('0x4d')][_0x6697('0x111')](db[_0x6697('0x180')],{'as':'Messages','onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x181')});db['FaxInteraction'][_0x6697('0x11c')](db[_0x6697('0x137')],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x17d')});db[_0x6697('0x4d')]['belongsTo'](db[_0x6697('0x70')],{'as':'Contact','foreignKey':_0x6697('0x162')});db[_0x6697('0x4d')][_0x6697('0x11c')](db['User'],{'as':_0x6697('0x170'),'foreignKey':_0x6697('0x10f')});db[_0x6697('0x4d')][_0x6697('0x121')](db[_0x6697('0x8a')],{'through':_0x6697('0x182'),'as':_0x6697('0x171')});db[_0x6697('0x4d')][_0x6697('0x121')](db[_0x6697('0x8a')],{'through':_0x6697('0x182'),'as':_0x6697('0x173')});db[_0x6697('0x4d')][_0x6697('0x121')](db[_0x6697('0x11')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0x6697('0x181')});db['FaxMessage'][_0x6697('0x11c')](db[_0x6697('0x11')],{'onDelete':'cascade','as':_0x6697('0x11')});db[_0x6697('0x180')][_0x6697('0x11c')](db['FaxInteraction'],{'as':_0x6697('0x177'),'foreignKey':_0x6697('0x181')});db[_0x6697('0x180')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x6697('0x161')});db['FaxMessage'][_0x6697('0x11c')](db[_0x6697('0x183')],{'as':_0x6697('0x183'),'foreignKey':_0x6697('0x184')});db[_0x6697('0x180')][_0x6697('0x11c')](db[_0x6697('0x137')],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x17d')});db[_0x6697('0x50')][_0x6697('0x121')](db[_0x6697('0x11')],{'as':'Agents','through':_0x6697('0x2f')});db[_0x6697('0x50')]['belongsToMany'](db[_0x6697('0xde')],{'through':'team_has_fax_queues','as':_0x6697('0x158')});db[_0x6697('0x52')][_0x6697('0x11c')](db[_0x6697('0x137')],{});db[_0x6697('0x52')][_0x6697('0x11c')](db['CmList'],{'as':_0x6697('0x16b'),'foreignKey':_0x6697('0x16c')});db[_0x6697('0x52')]['belongsTo'](db['CmContact'],{'as':_0x6697('0x161'),'foreignKey':_0x6697('0x162')});db['FaxQueueReport'][_0x6697('0x11c')](db[_0x6697('0x4d')],{});db[_0x6697('0x52')][_0x6697('0x11c')](db[_0x6697('0x180')],{});db[_0x6697('0x52')]['belongsTo'](db['User'],{});db['FaxQueueReport'][_0x6697('0x11c')](db[_0x6697('0x50')],{});db[_0x6697('0x53')][_0x6697('0x111')](db[_0x6697('0x82')],{'as':'Dispositions','foreignKey':_0x6697('0x185'),'onDelete':_0x6697('0x110')});db[_0x6697('0x53')][_0x6697('0x111')](db[_0x6697('0x80')],{'as':_0x6697('0x169'),'foreignKey':_0x6697('0x185')});db[_0x6697('0x53')]['hasMany'](db[_0x6697('0x57')],{'as':_0x6697('0x15b'),'foreignKey':_0x6697('0x185')});db['SmsAccount'][_0x6697('0x111')](db[_0x6697('0x56')],{'as':_0x6697('0x16a')});db[_0x6697('0x53')][_0x6697('0x111')](db['SmsApplication'],{'as':_0x6697('0x147')});db[_0x6697('0x53')][_0x6697('0x11c')](db[_0x6697('0xf0')],{'as':_0x6697('0x16b'),'foreignKey':_0x6697('0x16c')});db[_0x6697('0x53')][_0x6697('0x11c')](db[_0x6697('0x154')],{'as':_0x6697('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount']['belongsToMany'](db[_0x6697('0x11')],{'as':_0x6697('0x16e'),'through':_0x6697('0x13e')});db[_0x6697('0x54')][_0x6697('0x11c')](db['User'],{'onDelete':_0x6697('0x165')});db[_0x6697('0x54')][_0x6697('0x11c')](db[_0x6697('0x59')],{'onDelete':_0x6697('0x165')});db['SmsApplication']['belongsTo'](db[_0x6697('0x53')],{'onDelete':_0x6697('0x165')});db[_0x6697('0x54')][_0x6697('0x11c')](db[_0x6697('0x84')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x6697('0x54')][_0x6697('0x11c')](db[_0x6697('0x8a')],{'onDelete':_0x6697('0x165'),'foreignKey':'TagId'});db['SmsInteraction'][_0x6697('0x111')](db[_0x6697('0x57')],{'as':_0x6697('0x15b'),'onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x186')});db['SmsInteraction'][_0x6697('0x11c')](db[_0x6697('0x53')],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x185')});db[_0x6697('0x56')][_0x6697('0x11c')](db[_0x6697('0x70')],{'as':_0x6697('0x161'),'foreignKey':_0x6697('0x162')});db[_0x6697('0x56')][_0x6697('0x11c')](db[_0x6697('0x11')],{'as':_0x6697('0x170'),'foreignKey':_0x6697('0x10f')});db[_0x6697('0x56')]['belongsToMany'](db[_0x6697('0x8a')],{'through':_0x6697('0x187'),'as':_0x6697('0x171')});db['SmsInteraction'][_0x6697('0x121')](db[_0x6697('0x8a')],{'through':_0x6697('0x187'),'as':'ThroughTags'});db[_0x6697('0x56')][_0x6697('0x121')](db[_0x6697('0x11')],{'as':_0x6697('0x174'),'through':_0x6697('0x129'),'foreignKey':_0x6697('0x186')});db[_0x6697('0x57')][_0x6697('0x11c')](db[_0x6697('0x11')],{'as':_0x6697('0x11')});db[_0x6697('0x57')][_0x6697('0x11c')](db['CmContact'],{'onDelete':_0x6697('0x110'),'as':'Contact'});db['SmsMessage'][_0x6697('0x11c')](db[_0x6697('0x56')],{'onDelete':_0x6697('0x110'),'as':'Interaction','foreignKey':_0x6697('0x186')});db[_0x6697('0x57')]['belongsTo'](db[_0x6697('0x53')],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x185')});db[_0x6697('0x59')]['belongsToMany'](db[_0x6697('0x11')],{'as':_0x6697('0x16e'),'through':_0x6697('0x31'),'foreignKey':_0x6697('0x188')});db[_0x6697('0x59')][_0x6697('0x121')](db[_0x6697('0xde')],{'through':_0x6697('0x189'),'as':_0x6697('0x158')});db['OpenchannelAccount'][_0x6697('0x111')](db[_0x6697('0x82')],{'as':_0x6697('0x168'),'foreignKey':_0x6697('0x18a'),'onDelete':'cascade'});db[_0x6697('0x5a')][_0x6697('0x111')](db[_0x6697('0x80')],{'as':_0x6697('0x169'),'foreignKey':_0x6697('0x18a')});db[_0x6697('0x5a')]['hasMany'](db[_0x6697('0x5d')],{'as':_0x6697('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0x6697('0x5a')][_0x6697('0x111')](db[_0x6697('0x5e')],{'as':'Messages','foreignKey':_0x6697('0x18a')});db[_0x6697('0x5a')]['hasMany'](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0x6697('0x18a')});db['OpenchannelAccount'][_0x6697('0x11c')](db[_0x6697('0xf0')],{'as':'List','foreignKey':_0x6697('0x16c')});db[_0x6697('0x5a')][_0x6697('0x11c')](db['Pause'],{'as':_0x6697('0x155'),'foreignKey':_0x6697('0x17f')});db[_0x6697('0x5a')][_0x6697('0x121')](db['User'],{'as':'Agents','through':'user_has_openchannel_accounts'});db['OpenchannelApplication']['belongsTo'](db[_0x6697('0x11')],{'onDelete':_0x6697('0x165')});db[_0x6697('0x5b')][_0x6697('0x11c')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x6697('0x18b')});db[_0x6697('0x5b')][_0x6697('0x11c')](db[_0x6697('0x5a')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x6697('0x11c')](db[_0x6697('0x84')],{'onDelete':'restrict','foreignKey':_0x6697('0x153')});db[_0x6697('0x5b')]['belongsTo'](db[_0x6697('0x8a')],{'onDelete':_0x6697('0x165'),'foreignKey':_0x6697('0x17a')});db[_0x6697('0x5d')][_0x6697('0x111')](db[_0x6697('0x5e')],{'as':_0x6697('0x15b'),'onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x18c')});db[_0x6697('0x5d')][_0x6697('0x11c')](db['OpenchannelAccount'],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x18a')});db[_0x6697('0x5d')][_0x6697('0x11c')](db[_0x6697('0x70')],{'as':'Contact','foreignKey':_0x6697('0x162')});db['OpenchannelInteraction'][_0x6697('0x11c')](db[_0x6697('0x11')],{'as':_0x6697('0x170'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0x6697('0x121')](db[_0x6697('0x8a')],{'through':_0x6697('0x18d'),'as':_0x6697('0x171')});db[_0x6697('0x5d')][_0x6697('0x121')](db[_0x6697('0x8a')],{'through':_0x6697('0x18d'),'as':'ThroughTags'});db[_0x6697('0x5d')][_0x6697('0x121')](db['User'],{'as':_0x6697('0x174'),'through':_0x6697('0x12a'),'foreignKey':_0x6697('0x18c')});db[_0x6697('0x5e')][_0x6697('0x11c')](db[_0x6697('0x11')],{'onDelete':'cascade','as':_0x6697('0x11')});db[_0x6697('0x5e')][_0x6697('0x11c')](db['CmContact'],{'onDelete':'cascade','as':_0x6697('0x161')});db[_0x6697('0x5e')][_0x6697('0x11c')](db[_0x6697('0x5d')],{'onDelete':_0x6697('0x110'),'as':_0x6697('0x177'),'foreignKey':_0x6697('0x18c')});db[_0x6697('0x5e')][_0x6697('0x11c')](db[_0x6697('0x183')],{'as':_0x6697('0x183'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x6697('0x11c')](db[_0x6697('0x5a')],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x18a')});db['OpenchannelQueue']['belongsToMany'](db[_0x6697('0x11')],{'as':_0x6697('0x16e'),'through':_0x6697('0x33'),'foreignKey':_0x6697('0x18b')});db[_0x6697('0x60')]['belongsToMany'](db[_0x6697('0xde')],{'through':'team_has_openchannel_queues','as':_0x6697('0x158')});db[_0x6697('0x62')][_0x6697('0x111')](db[_0x6697('0x82')],{'as':_0x6697('0x168'),'foreignKey':_0x6697('0x18e'),'onDelete':_0x6697('0x110')});db[_0x6697('0x62')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x6697('0x18e')});db[_0x6697('0x62')][_0x6697('0x111')](db[_0x6697('0x6e')],{'as':'ProactiveActions'});db['ChatWebsite'][_0x6697('0x111')](db[_0x6697('0x116')],{'as':_0x6697('0x16a')});db['ChatWebsite'][_0x6697('0x111')](db[_0x6697('0x18f')],{'as':_0x6697('0x147')});db[_0x6697('0x62')][_0x6697('0x111')](db[_0x6697('0x66')],{'as':'Messages'});db[_0x6697('0x62')][_0x6697('0x11c')](db[_0x6697('0xf0')],{'as':_0x6697('0x16b'),'foreignKey':_0x6697('0x16c')});db[_0x6697('0x62')][_0x6697('0x11c')](db['Interval'],{'as':_0x6697('0x84'),'foreignKey':_0x6697('0x153')});db[_0x6697('0x62')]['belongsTo'](db['MailAccount'],{'as':_0x6697('0x3b'),'foreignKey':_0x6697('0x163')});db[_0x6697('0x62')][_0x6697('0x11c')](db[_0x6697('0x154')],{'as':'mandatoryDispositionPause','foreignKey':_0x6697('0x17f')});db[_0x6697('0x62')][_0x6697('0x121')](db[_0x6697('0x11')],{'as':_0x6697('0x16e'),'through':_0x6697('0x190')});db[_0x6697('0x191')][_0x6697('0x11c')](db['OpenchannelAccount'],{});db[_0x6697('0x191')][_0x6697('0x11c')](db[_0x6697('0xf0')],{'as':_0x6697('0x16b'),'foreignKey':'ListId'});db['OpenchannelQueueReport'][_0x6697('0x11c')](db['CmContact'],{'as':_0x6697('0x161'),'foreignKey':_0x6697('0x162')});db[_0x6697('0x191')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x6697('0x191')][_0x6697('0x11c')](db[_0x6697('0x5e')],{});db[_0x6697('0x191')]['belongsTo'](db['User'],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x6697('0x60')],{});db['ChatApplication'][_0x6697('0x11c')](db[_0x6697('0x11')],{'as':_0x6697('0x192'),'foreignKey':'UserId','onDelete':_0x6697('0x165')});db[_0x6697('0x18f')][_0x6697('0x11c')](db[_0x6697('0x6a')],{'as':_0x6697('0x193'),'foreignKey':_0x6697('0x194'),'onDelete':_0x6697('0x165')});db[_0x6697('0x18f')]['belongsTo'](db[_0x6697('0x62')],{'as':_0x6697('0x195'),'foreignKey':_0x6697('0x18e'),'onDelete':_0x6697('0x165')});db[_0x6697('0x18f')][_0x6697('0x11c')](db['Tag'],{'onDelete':_0x6697('0x165'),'foreignKey':_0x6697('0x17a')});db[_0x6697('0x116')][_0x6697('0x111')](db[_0x6697('0x66')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x6697('0x196')});db[_0x6697('0x116')][_0x6697('0x11c')](db[_0x6697('0x62')],{'as':_0x6697('0x178'),'foreignKey':'ChatWebsiteId'});db[_0x6697('0x116')][_0x6697('0x11c')](db['CmContact'],{'as':_0x6697('0x161'),'foreignKey':_0x6697('0x162')});db[_0x6697('0x116')][_0x6697('0x11c')](db[_0x6697('0x11')],{'as':'Owner','foreignKey':_0x6697('0x10f')});db[_0x6697('0x116')][_0x6697('0x121')](db[_0x6697('0x8a')],{'through':_0x6697('0x197'),'as':_0x6697('0x171')});db[_0x6697('0x116')][_0x6697('0x121')](db[_0x6697('0x8a')],{'through':_0x6697('0x197'),'as':_0x6697('0x173')});db[_0x6697('0x116')][_0x6697('0x121')](db[_0x6697('0x11')],{'as':_0x6697('0x174'),'through':'user_has_chat_interactions','foreignKey':_0x6697('0x196')});db[_0x6697('0x66')][_0x6697('0x11c')](db[_0x6697('0x11')],{'onDelete':'cascade','as':_0x6697('0x11')});db[_0x6697('0x66')][_0x6697('0x11c')](db[_0x6697('0x70')],{'onDelete':_0x6697('0x110'),'as':_0x6697('0x161'),'foreignKey':'ContactId'});db[_0x6697('0x66')][_0x6697('0x11c')](db[_0x6697('0x116')],{'onDelete':'cascade','as':'Interaction','foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x6697('0x11c')](db[_0x6697('0x183')],{'as':_0x6697('0x183'),'foreignKey':_0x6697('0x184')});db['ChatMessage']['belongsTo'](db[_0x6697('0x62')],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x18e')});db[_0x6697('0x68')][_0x6697('0x111')](db['Attachment'],{'as':_0x6697('0x176'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x6697('0x110'),'hooks':!![]});db[_0x6697('0x68')][_0x6697('0x11c')](db[_0x6697('0x70')],{'onDelete':_0x6697('0x110'),'as':_0x6697('0x161'),'foreignKey':_0x6697('0x162')});db[_0x6697('0x68')][_0x6697('0x11c')](db['ChatWebsite'],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x18e')});db[_0x6697('0x6a')][_0x6697('0x121')](db[_0x6697('0x11')],{'as':_0x6697('0x16e'),'through':_0x6697('0x2d'),'hooks':!![]});db[_0x6697('0x6a')][_0x6697('0x121')](db[_0x6697('0xde')],{'through':_0x6697('0x198'),'as':_0x6697('0x158')});db[_0x6697('0x6c')][_0x6697('0x111')](db[_0x6697('0xcd')],{'as':_0x6697('0x15b'),'foreignKey':_0x6697('0x199'),'onDelete':_0x6697('0x110')});db[_0x6697('0x6c')][_0x6697('0x121')](db['User'],{'as':_0x6697('0x19a'),'through':'chat_group_has_users'});db[_0x6697('0x6e')][_0x6697('0x11c')](db[_0x6697('0x62')],{'as':_0x6697('0x195'),'foreignKey':_0x6697('0x18e')});db['CmCompany'][_0x6697('0x111')](db['CmContact'],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x6697('0x70')][_0x6697('0x111')](db['CmHopper'],{'as':_0x6697('0x14b'),'foreignKey':'ContactId'});db[_0x6697('0x70')][_0x6697('0x111')](db[_0x6697('0x75')],{'as':_0x6697('0x114'),'foreignKey':_0x6697('0x162')});db['CmContact'][_0x6697('0x111')](db[_0x6697('0x77')],{'as':_0x6697('0x14d'),'foreignKey':'ContactId'});db['CmContact'][_0x6697('0x111')](db[_0x6697('0x79')],{'as':_0x6697('0x79'),'foreignKey':_0x6697('0x162')});db[_0x6697('0x70')]['hasMany'](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x6697('0x162')});db[_0x6697('0x70')][_0x6697('0x111')](db[_0x6697('0x5d')],{'as':_0x6697('0x115'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x6697('0x111')](db[_0x6697('0x116')],{'as':'ChatInteractions','foreignKey':_0x6697('0x162'),'onDelete':'restrict'});db['CmContact'][_0x6697('0x111')](db[_0x6697('0x56')],{'as':_0x6697('0x117'),'foreignKey':_0x6697('0x162'),'onDelete':_0x6697('0x165')});db['CmContact'][_0x6697('0x111')](db[_0x6697('0x4d')],{'as':'FaxInteractions','foreignKey':_0x6697('0x162'),'onDelete':_0x6697('0x165')});db[_0x6697('0x70')][_0x6697('0x111')](db[_0x6697('0x3f')],{'as':_0x6697('0x118'),'foreignKey':_0x6697('0x162'),'onDelete':_0x6697('0x165')});db['CmContact'][_0x6697('0x11c')](db['CmCompany'],{'as':_0x6697('0x19b'),'foreignKey':_0x6697('0x19c')});db[_0x6697('0x70')]['belongsTo'](db['CmList'],{'as':_0x6697('0x16b'),'foreignKey':_0x6697('0x16c'),'onDelete':_0x6697('0x110')});db[_0x6697('0x70')][_0x6697('0x121')](db[_0x6697('0x11')],{'as':_0x6697('0x174'),'through':_0x6697('0x123')});db['CmContact']['belongsToMany'](db[_0x6697('0x8a')],{'as':'Tags','through':_0x6697('0x19d')});db['CmContact'][_0x6697('0x121')](db[_0x6697('0x8a')],{'through':_0x6697('0x19d'),'as':_0x6697('0x173')});db[_0x6697('0x72')][_0x6697('0x11c')](db[_0x6697('0x70')],{'as':_0x6697('0x161'),'foreignKey':_0x6697('0x162'),'onDelete':_0x6697('0x110')});db['CmHopper'][_0x6697('0x11c')](db[_0x6697('0xf0')],{'as':'List','foreignKey':_0x6697('0x16c'),'onDelete':_0x6697('0x110')});db[_0x6697('0x72')][_0x6697('0x11c')](db['User'],{'as':_0x6697('0x192'),'foreignKey':_0x6697('0x10f')});db[_0x6697('0x72')]['belongsTo'](db[_0x6697('0x19')],{'as':_0x6697('0x193'),'foreignKey':_0x6697('0x14c'),'onDelete':_0x6697('0x110')});db['CmHopper']['belongsTo'](db[_0x6697('0xe1')],{'as':_0x6697('0xe1'),'foreignKey':_0x6697('0x19e'),'onDelete':_0x6697('0x110')});db[_0x6697('0x72')][_0x6697('0x11c')](db[_0x6697('0x11')],{'as':_0x6697('0x170'),'foreignKey':_0x6697('0x19f')});db['CmHopperBlack'][_0x6697('0x11c')](db[_0x6697('0x70')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x6697('0x110')});db[_0x6697('0x74')][_0x6697('0x11c')](db['CmList'],{'as':_0x6697('0x16b'),'foreignKey':_0x6697('0x16c'),'onDelete':_0x6697('0x110')});db[_0x6697('0x74')][_0x6697('0x11c')](db['VoiceQueue'],{'as':_0x6697('0x193'),'foreignKey':_0x6697('0x14c'),'onDelete':'cascade'});db[_0x6697('0x74')][_0x6697('0x11c')](db[_0x6697('0xe1')],{'as':_0x6697('0xe1'),'foreignKey':_0x6697('0x19e'),'onDelete':'cascade'});db[_0x6697('0x7e')]['hasMany'](db[_0x6697('0x1a0')],{'as':{'plural':'All','singular':_0x6697('0x1a1')},'foreignKey':_0x6697('0x1a2'),'onDelete':'cascade','hooks':!![]});db[_0x6697('0x7e')][_0x6697('0x111')](db[_0x6697('0x1a0')],{'as':{'plural':_0x6697('0x1a3'),'singular':_0x6697('0x1a4')},'foreignKey':_0x6697('0x1a5'),'onDelete':_0x6697('0x110'),'hooks':!![]});db[_0x6697('0x7e')][_0x6697('0x111')](db[_0x6697('0x7c')],{'as':_0x6697('0x1a6'),'foreignKey':_0x6697('0x1a7'),'onDelete':_0x6697('0x110'),'hooks':!![]});db[_0x6697('0x82')][_0x6697('0x111')](db['Disposition'],{'as':_0x6697('0x168'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0x6697('0x84')][_0x6697('0x111')](db[_0x6697('0x84')],{'as':_0x6697('0x1a8'),'foreignKey':_0x6697('0x153'),'onDelete':_0x6697('0x110'),'hooks':!![],'required':![]});db[_0x6697('0x84')][_0x6697('0x111')](db[_0x6697('0x16')],{'as':'Extensions','foreignKey':_0x6697('0x153'),'onDelete':_0x6697('0x165')});db[_0x6697('0x84')][_0x6697('0x111')](db[_0x6697('0x43')],{'as':_0x6697('0x1a9'),'foreignKey':_0x6697('0x153')});db[_0x6697('0x84')]['hasMany'](db[_0x6697('0x18f')],{'as':_0x6697('0x1aa'),'foreignKey':'IntervalId'});db[_0x6697('0x84')]['hasMany'](db[_0x6697('0x4b')],{'as':_0x6697('0x1ab'),'foreignKey':_0x6697('0x153')});db[_0x6697('0x84')][_0x6697('0x111')](db[_0x6697('0x54')],{'as':_0x6697('0x1ac'),'foreignKey':_0x6697('0x153')});db[_0x6697('0x89')][_0x6697('0x11c')](db[_0x6697('0x3b')],{});db[_0x6697('0x89')][_0x6697('0x11c')](db[_0x6697('0x94')],{'foreignKey':'DefaultReportId'});db[_0x6697('0x89')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0x6697('0x1ad')][_0x6697('0x121')](db[_0x6697('0x148')],{'as':_0x6697('0x1ae'),'through':_0x6697('0x14a'),'onDelete':_0x6697('0x165')});db[_0x6697('0x8a')][_0x6697('0x121')](db[_0x6697('0x70')],{'through':'cm_contact_has_tags'});db[_0x6697('0x8a')]['belongsToMany'](db[_0x6697('0x116')],{'through':'chat_interaction_has_tags'});db[_0x6697('0x8a')][_0x6697('0x121')](db[_0x6697('0x3f')],{'through':_0x6697('0x172')});db['Tag'][_0x6697('0x121')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0x6697('0x8a')][_0x6697('0x121')](db[_0x6697('0x4d')],{'through':_0x6697('0x182')});db[_0x6697('0x8a')][_0x6697('0x121')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x6697('0x8a')]['belongsToMany'](db[_0x6697('0xfc')],{'through':_0x6697('0x1af')});db[_0x6697('0x8d')]['hasMany'](db[_0x6697('0x1a0')],{'as':{'plural':_0x6697('0x1b0'),'singular':_0x6697('0x1b1')},'foreignKey':_0x6697('0x1b2'),'onDelete':_0x6697('0x110'),'hooks':!![]});db[_0x6697('0x8d')][_0x6697('0x111')](db['Condition'],{'as':{'plural':_0x6697('0x1b3'),'singular':'AnyCondition'},'foreignKey':_0x6697('0x1b4'),'onDelete':'cascade','hooks':!![]});db[_0x6697('0x8d')][_0x6697('0x111')](db['Action'],{'as':'Actions','foreignKey':_0x6697('0x1b5'),'onDelete':_0x6697('0x110'),'hooks':!![]});db['AnalyticCustomReport'][_0x6697('0x111')](db[_0x6697('0x98')],{'as':'Fields','onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x1b6'),'hooks':!![]});db['AnalyticDefaultReport'][_0x6697('0x111')](db[_0x6697('0x98')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x6697('0x1b7')});db['AnalyticMetric'][_0x6697('0x111')](db[_0x6697('0x98')],{'as':_0x6697('0x1b8'),'onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x1b9')});db[_0x6697('0x98')][_0x6697('0x11c')](db['AnalyticMetric'],{'foreignKey':_0x6697('0x1b9')});db[_0x6697('0x9c')]['hasMany'](db[_0x6697('0x9d')],{'as':_0x6697('0x1ba'),'onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x1bb')});db[_0x6697('0x9d')][_0x6697('0x111')](db[_0x6697('0x9e')],{'as':_0x6697('0x1bc'),'onDelete':'cascade','foreignKey':_0x6697('0x1bd')});db[_0x6697('0x9d')][_0x6697('0x111')](db[_0x6697('0x9e')],{'as':_0x6697('0x1be'),'onDelete':'cascade','foreignKey':_0x6697('0x1bf')});db[_0x6697('0x9d')]['hasMany'](db[_0x6697('0x9e')],{'as':'Fields','onDelete':_0x6697('0x110'),'foreignKey':'FieldId'});db[_0x6697('0x9d')]['belongsTo'](db[_0x6697('0x9c')],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x1bb')});db[_0x6697('0x9e')][_0x6697('0x111')](db[_0x6697('0x9e')],{'as':_0x6697('0x1c0'),'foreignKey':_0x6697('0x1bd')});db['SalesforceField'][_0x6697('0x111')](db[_0x6697('0x9e')],{'as':_0x6697('0x1c1'),'foreignKey':'DescriptionId'});db[_0x6697('0x9e')][_0x6697('0x111')](db[_0x6697('0x9e')],{'as':_0x6697('0x1c2'),'foreignKey':_0x6697('0x1c3')});db[_0x6697('0x9e')][_0x6697('0x11c')](db[_0x6697('0x8e')],{'as':_0x6697('0x8e'),'foreignKey':_0x6697('0x1c4')});db[_0x6697('0x1c5')][_0x6697('0x111')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x1bb')});db[_0x6697('0x1c6')][_0x6697('0x111')](db[_0x6697('0xa2')],{'as':'Subjects','onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x1bd')});db[_0x6697('0x1c6')][_0x6697('0x111')](db[_0x6697('0xa2')],{'as':_0x6697('0x1be'),'onDelete':'cascade','foreignKey':_0x6697('0x1bf')});db['SugarcrmConfiguration'][_0x6697('0x111')](db['SugarcrmField'],{'as':_0x6697('0x1b8'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x6697('0x1c6')][_0x6697('0x11c')](db[_0x6697('0x1c5')],{'as':_0x6697('0x178'),'foreignKey':'AccountId'});db['SugarcrmField'][_0x6697('0x111')](db[_0x6697('0xa2')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6697('0xa2')][_0x6697('0x111')](db[_0x6697('0xa2')],{'as':_0x6697('0x1c1'),'foreignKey':_0x6697('0x1bf')});db['SugarcrmField'][_0x6697('0x111')](db['SugarcrmField'],{'as':'Field','foreignKey':'FieldId'});db[_0x6697('0xa2')][_0x6697('0x11c')](db[_0x6697('0x8e')],{'as':_0x6697('0x8e'),'foreignKey':_0x6697('0x1c4')});db[_0x6697('0xa4')][_0x6697('0x111')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x6697('0x110'),'foreignKey':'AccountId'});db[_0x6697('0xa6')][_0x6697('0x111')](db['DeskField'],{'as':_0x6697('0x1bc'),'onDelete':_0x6697('0x110'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0x6697('0x111')](db[_0x6697('0xa8')],{'as':_0x6697('0x1be'),'onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x1bf')});db[_0x6697('0xa6')][_0x6697('0x111')](db[_0x6697('0xa8')],{'as':_0x6697('0x1b8'),'onDelete':_0x6697('0x110'),'foreignKey':'FieldId'});db[_0x6697('0xa6')][_0x6697('0x11c')](db['DeskAccount'],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x1bb')});db['DeskConfiguration'][_0x6697('0x121')](db[_0x6697('0x8a')],{'through':_0x6697('0x1c7')});db[_0x6697('0xa8')][_0x6697('0x111')](db[_0x6697('0xa8')],{'as':_0x6697('0x1c0'),'foreignKey':_0x6697('0x1bd')});db['DeskField'][_0x6697('0x111')](db[_0x6697('0xa8')],{'as':_0x6697('0x1c1'),'foreignKey':_0x6697('0x1bf')});db[_0x6697('0xa8')][_0x6697('0x111')](db['DeskField'],{'as':_0x6697('0x1c2'),'foreignKey':_0x6697('0x1c3')});db[_0x6697('0xa8')]['belongsTo'](db[_0x6697('0x8e')],{'as':_0x6697('0x8e'),'foreignKey':_0x6697('0x1c4')});db[_0x6697('0xaa')][_0x6697('0x111')](db[_0x6697('0xac')],{'as':_0x6697('0x1ba'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x6697('0xac')]['hasMany'](db[_0x6697('0xae')],{'as':_0x6697('0x1bc'),'onDelete':_0x6697('0x110'),'foreignKey':'SubjectId'});db[_0x6697('0xac')][_0x6697('0x111')](db[_0x6697('0xae')],{'as':'Descriptions','onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x1bf')});db[_0x6697('0xac')][_0x6697('0x111')](db[_0x6697('0xae')],{'as':_0x6697('0x1b8'),'onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x1c3')});db['ZohoConfiguration'][_0x6697('0x11c')](db[_0x6697('0xaa')],{'as':_0x6697('0x178'),'foreignKey':'AccountId'});db[_0x6697('0xae')][_0x6697('0x111')](db[_0x6697('0xae')],{'as':_0x6697('0x1c0'),'foreignKey':_0x6697('0x1bd')});db[_0x6697('0xae')][_0x6697('0x111')](db['ZohoField'],{'as':'Description','foreignKey':_0x6697('0x1bf')});db['ZohoField']['hasMany'](db[_0x6697('0xae')],{'as':_0x6697('0x1c2'),'foreignKey':_0x6697('0x1c3')});db[_0x6697('0xae')][_0x6697('0x11c')](db[_0x6697('0x8e')],{'as':_0x6697('0x8e'),'foreignKey':_0x6697('0x1c4')});db['ZendeskAccount']['hasMany'](db[_0x6697('0xb1')],{'as':_0x6697('0x1ba'),'onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x1bb')});db[_0x6697('0xb1')][_0x6697('0x111')](db[_0x6697('0xb3')],{'as':'Subjects','foreignKey':_0x6697('0x1bd')});db[_0x6697('0xb1')]['hasMany'](db['ZendeskField'],{'as':_0x6697('0x1be'),'foreignKey':_0x6697('0x1bf')});db[_0x6697('0xb1')]['hasMany'](db[_0x6697('0xb3')],{'as':'Fields','foreignKey':_0x6697('0x1c3')});db[_0x6697('0xb1')][_0x6697('0x11c')](db[_0x6697('0xb0')],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x1bb')});db[_0x6697('0xb1')][_0x6697('0x121')](db[_0x6697('0x8a')],{'through':_0x6697('0x1c8')});db['ZendeskField'][_0x6697('0x111')](db[_0x6697('0xb3')],{'as':'Subject','foreignKey':_0x6697('0x1bd')});db[_0x6697('0xb3')]['hasMany'](db[_0x6697('0xb3')],{'as':_0x6697('0x1c1'),'foreignKey':_0x6697('0x1bf')});db['ZendeskField'][_0x6697('0x111')](db['ZendeskField'],{'as':'Field','foreignKey':_0x6697('0x1c3')});db[_0x6697('0xb3')][_0x6697('0x11c')](db[_0x6697('0x8e')],{'as':_0x6697('0x8e'),'foreignKey':_0x6697('0x1c4')});db['FreshdeskAccount'][_0x6697('0x111')](db['FreshdeskConfiguration'],{'as':_0x6697('0x1ba'),'onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x1bb')});db[_0x6697('0xb6')][_0x6697('0x111')](db[_0x6697('0x1c9')],{'as':_0x6697('0x1bc'),'onDelete':_0x6697('0x110'),'foreignKey':'SubjectId'});db[_0x6697('0xb6')]['hasMany'](db[_0x6697('0x1c9')],{'as':_0x6697('0x1be'),'onDelete':'cascade','foreignKey':_0x6697('0x1bf')});db[_0x6697('0xb6')][_0x6697('0x111')](db[_0x6697('0x1c9')],{'as':_0x6697('0x1b8'),'onDelete':'cascade','foreignKey':_0x6697('0x1c3')});db['FreshdeskConfiguration']['belongsTo'](db['FreshdeskAccount'],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x1bb')});db['FreshdeskConfiguration'][_0x6697('0x121')](db[_0x6697('0x8a')],{'through':_0x6697('0x1ca')});db[_0x6697('0x1c9')]['hasMany'](db[_0x6697('0x1c9')],{'as':_0x6697('0x1c0'),'foreignKey':_0x6697('0x1bd')});db[_0x6697('0x1c9')][_0x6697('0x111')](db['FreshdeskField'],{'as':'Description','foreignKey':_0x6697('0x1bf')});db[_0x6697('0x1c9')]['hasMany'](db['FreshdeskField'],{'as':'Field','foreignKey':_0x6697('0x1c3')});db[_0x6697('0x1c9')][_0x6697('0x11c')](db[_0x6697('0x8e')],{'as':'Variable','foreignKey':_0x6697('0x1c4')});db['VtigerAccount'][_0x6697('0x111')](db[_0x6697('0xba')],{'as':_0x6697('0x1ba'),'onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x1bb')});db[_0x6697('0xba')][_0x6697('0x111')](db[_0x6697('0xbc')],{'as':'Subjects','foreignKey':_0x6697('0x1bd')});db['VtigerConfiguration'][_0x6697('0x111')](db[_0x6697('0xbc')],{'as':_0x6697('0x1be'),'foreignKey':_0x6697('0x1bf')});db[_0x6697('0xba')][_0x6697('0x111')](db[_0x6697('0xbc')],{'as':_0x6697('0x1b8'),'foreignKey':_0x6697('0x1c3')});db['VtigerConfiguration'][_0x6697('0x11c')](db[_0x6697('0xb8')],{'as':'Account','foreignKey':_0x6697('0x1bb')});db[_0x6697('0xbc')][_0x6697('0x111')](db[_0x6697('0xbc')],{'as':_0x6697('0x1c0'),'foreignKey':_0x6697('0x1bd')});db[_0x6697('0xbc')]['hasMany'](db[_0x6697('0xbc')],{'as':_0x6697('0x1c1'),'foreignKey':_0x6697('0x1bf')});db[_0x6697('0xbc')][_0x6697('0x111')](db[_0x6697('0xbc')],{'as':'Field','foreignKey':_0x6697('0x1c3')});db['VtigerField']['belongsTo'](db[_0x6697('0x8e')],{'as':'Variable','foreignKey':'VariableId'});db[_0x6697('0x1cb')]['hasMany'](db[_0x6697('0xbe')],{'as':_0x6697('0x1ba'),'onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x1bb')});db[_0x6697('0xbe')][_0x6697('0x111')](db[_0x6697('0xc0')],{'as':'Subjects','foreignKey':_0x6697('0x1bd')});db[_0x6697('0xbe')][_0x6697('0x111')](db[_0x6697('0xc0')],{'as':_0x6697('0x1be'),'foreignKey':'DescriptionId'});db[_0x6697('0xbe')][_0x6697('0x111')](db[_0x6697('0xc0')],{'as':'Fields','foreignKey':_0x6697('0x1c3')});db['ServicenowConfiguration'][_0x6697('0x11c')](db[_0x6697('0x1cb')],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x1bb')});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':_0x6697('0x1c0'),'foreignKey':_0x6697('0x1bd')});db[_0x6697('0xc0')]['hasMany'](db[_0x6697('0xc0')],{'as':_0x6697('0x1c1'),'foreignKey':_0x6697('0x1bf')});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':'Field','foreignKey':_0x6697('0x1c3')});db[_0x6697('0xc0')][_0x6697('0x11c')](db['Variable'],{'as':'Variable','foreignKey':_0x6697('0x1c4')});db[_0x6697('0xc2')]['hasMany'](db[_0x6697('0xc4')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x6697('0x1bb')});db[_0x6697('0xc2')]['belongsTo'](db[_0x6697('0x105')],{'as':'CloudProvider','foreignKey':_0x6697('0x164')});db[_0x6697('0xc4')]['hasMany'](db[_0x6697('0x1cc')],{'as':_0x6697('0x1bc'),'onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x1bd')});db[_0x6697('0xc4')][_0x6697('0x111')](db['Dynamics365Field'],{'as':_0x6697('0x1be'),'onDelete':'cascade','foreignKey':_0x6697('0x1bf')});db[_0x6697('0xc4')][_0x6697('0x111')](db[_0x6697('0x1cc')],{'as':_0x6697('0x1b8'),'onDelete':_0x6697('0x110'),'foreignKey':'FieldId'});db[_0x6697('0xc4')][_0x6697('0x11c')](db[_0x6697('0xc2')],{'as':'Account','foreignKey':_0x6697('0x1bb')});db[_0x6697('0x1cc')][_0x6697('0x111')](db[_0x6697('0x1cc')],{'as':'Subject','foreignKey':_0x6697('0x1bd')});db[_0x6697('0x1cc')]['hasMany'](db[_0x6697('0x1cc')],{'as':_0x6697('0x1c1'),'foreignKey':'DescriptionId'});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':_0x6697('0x1c2'),'foreignKey':_0x6697('0x1c3')});db[_0x6697('0x1cc')][_0x6697('0x11c')](db[_0x6697('0x8e')],{'as':'Variable','foreignKey':_0x6697('0x1c4')});db[_0x6697('0xc6')][_0x6697('0x111')](db['FreshsalesConfiguration'],{'as':_0x6697('0x1ba'),'onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x1bb')});db[_0x6697('0x1cd')][_0x6697('0x111')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x6697('0x1bd')});db[_0x6697('0x1cd')][_0x6697('0x111')](db['FreshsalesField'],{'as':_0x6697('0x1be'),'foreignKey':_0x6697('0x1bf')});db['FreshsalesConfiguration']['hasMany'](db[_0x6697('0x1ce')],{'as':_0x6697('0x1b8'),'foreignKey':_0x6697('0x1c3')});db[_0x6697('0x1cd')][_0x6697('0x11c')](db[_0x6697('0xc6')],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x1bb')});db[_0x6697('0x1ce')][_0x6697('0x111')](db[_0x6697('0x1ce')],{'as':_0x6697('0x1c0'),'foreignKey':_0x6697('0x1bd')});db['FreshsalesField']['hasMany'](db[_0x6697('0x1ce')],{'as':'Description','foreignKey':_0x6697('0x1bf')});db['FreshsalesField'][_0x6697('0x111')](db[_0x6697('0x1ce')],{'as':'Field','foreignKey':_0x6697('0x1c3')});db[_0x6697('0x1ce')]['belongsTo'](db[_0x6697('0x8e')],{'as':'Variable','foreignKey':_0x6697('0x1c4')});db[_0x6697('0xcc')][_0x6697('0x11c')](db[_0x6697('0x62')],{});db[_0x6697('0xcc')][_0x6697('0x11c')](db[_0x6697('0xf0')],{'as':_0x6697('0x16b'),'foreignKey':'ListId'});db[_0x6697('0xcc')][_0x6697('0x11c')](db[_0x6697('0x70')],{'as':_0x6697('0x161'),'foreignKey':_0x6697('0x162')});db['ChatQueueReport'][_0x6697('0x11c')](db['ChatInteraction'],{});db[_0x6697('0xcc')][_0x6697('0x11c')](db[_0x6697('0x66')],{});db[_0x6697('0xcc')][_0x6697('0x11c')](db[_0x6697('0x11')],{});db[_0x6697('0xcc')][_0x6697('0x11c')](db[_0x6697('0x6a')],{});db[_0x6697('0xcd')][_0x6697('0x11c')](db[_0x6697('0x11')],{'onDelete':_0x6697('0x110'),'foreignKey':'FromId'});db[_0x6697('0xcd')][_0x6697('0x11c')](db[_0x6697('0x11')],{'onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x1cf')});db[_0x6697('0xd0')][_0x6697('0x111')](db[_0x6697('0x1d0')],{'foreignKey':_0x6697('0x1d1'),'onDelete':_0x6697('0x110')});db[_0x6697('0xd0')][_0x6697('0x111')](db[_0x6697('0x1d2')],{'foreignKey':_0x6697('0x1d1'),'onDelete':'cascade'});db['SmsQueueReport']['belongsTo'](db[_0x6697('0x53')],{});db[_0x6697('0x1d3')][_0x6697('0x11c')](db['CmList'],{'as':_0x6697('0x16b'),'foreignKey':'ListId'});db[_0x6697('0x1d3')]['belongsTo'](db[_0x6697('0x70')],{'as':'Contact','foreignKey':_0x6697('0x162')});db[_0x6697('0x1d3')]['belongsTo'](db[_0x6697('0x56')],{});db[_0x6697('0x1d3')][_0x6697('0x11c')](db['SmsMessage'],{});db['SmsQueueReport'][_0x6697('0x11c')](db[_0x6697('0x11')],{});db[_0x6697('0x1d3')][_0x6697('0x11c')](db['SmsQueue'],{});db['JscriptyProject'][_0x6697('0x111')](db['JscriptySessionReport'],{'foreignKey':_0x6697('0x1d4')});db[_0x6697('0x1d5')][_0x6697('0x111')](db[_0x6697('0x1d0')],{'foreignKey':'ProjectId'});db[_0x6697('0x1d5')][_0x6697('0x111')](db[_0x6697('0x1d2')],{'foreignKey':_0x6697('0x1d4')});db[_0x6697('0x1d6')][_0x6697('0x121')](db[_0x6697('0x11')],{'as':_0x6697('0x174'),'through':'user_has_square_projects'});db[_0x6697('0xde')][_0x6697('0x121')](db[_0x6697('0x11')],{'as':_0x6697('0x16e'),'through':_0x6697('0x1d7')});db[_0x6697('0xde')][_0x6697('0x121')](db[_0x6697('0x19')],{'through':_0x6697('0x107'),'as':'VoiceQueues'});db['Team'][_0x6697('0x121')](db[_0x6697('0x3d')],{'through':_0x6697('0x1d8'),'as':_0x6697('0x12e')});db[_0x6697('0xde')][_0x6697('0x121')](db[_0x6697('0x6a')],{'through':_0x6697('0x198'),'as':_0x6697('0x130')});db['Team'][_0x6697('0x121')](db[_0x6697('0x50')],{'through':_0x6697('0x1d9'),'as':_0x6697('0x131')});db[_0x6697('0xde')]['belongsToMany'](db[_0x6697('0x59')],{'through':_0x6697('0x189'),'as':_0x6697('0x132')});db[_0x6697('0xde')][_0x6697('0x121')](db[_0x6697('0x60')],{'through':'team_has_openchannel_queues','as':_0x6697('0x133')});db[_0x6697('0xde')][_0x6697('0x121')](db[_0x6697('0x103')],{'through':_0x6697('0x1da'),'as':'WhatsappQueues'});db[_0x6697('0xde')][_0x6697('0x121')](db[_0x6697('0xf2')],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0x6697('0xe1')][_0x6697('0x111')](db[_0x6697('0x72')],{'as':_0x6697('0x14b'),'foreignKey':_0x6697('0x19e')});db[_0x6697('0xe1')][_0x6697('0x111')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x6697('0x19e')});db[_0x6697('0xe1')][_0x6697('0x111')](db[_0x6697('0x77')],{'as':_0x6697('0x14d'),'foreignKey':_0x6697('0x19e')});db['Campaign'][_0x6697('0x111')](db[_0x6697('0x74')],{'as':_0x6697('0x14e'),'foreignKey':_0x6697('0x19e')});db[_0x6697('0xe1')][_0x6697('0x11c')](db[_0x6697('0x151')],{'as':_0x6697('0x151'),'foreignKey':_0x6697('0x150')});db[_0x6697('0xe1')]['belongsTo'](db[_0x6697('0x151')],{'as':_0x6697('0x1db'),'foreignKey':'TrunkBackupId'});db[_0x6697('0xe1')][_0x6697('0x11c')](db[_0x6697('0x84')],{'as':_0x6697('0x84'),'foreignKey':_0x6697('0x153')});db['Campaign'][_0x6697('0x11c')](db[_0x6697('0x1d6')],{'as':_0x6697('0x1d6'),'foreignKey':_0x6697('0x1dc')});db[_0x6697('0xe1')]['belongsToMany'](db[_0x6697('0xf0')],{'as':'Lists','through':_0x6697('0x1dd')});db[_0x6697('0xe1')]['belongsToMany'](db[_0x6697('0xf0')],{'as':_0x6697('0x1de'),'through':_0x6697('0x1df')});db[_0x6697('0x183')][_0x6697('0x11c')](db[_0x6697('0x68')],{'as':_0x6697('0x68'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport'][_0x6697('0x11c')](db[_0x6697('0x41')],{});db[_0x6697('0xe7')][_0x6697('0x11c')](db[_0x6697('0x3f')],{});db[_0x6697('0xe7')][_0x6697('0x11c')](db[_0x6697('0x3b')],{'foreignKey':_0x6697('0x1e0'),'as':_0x6697('0x1e1')});db[_0x6697('0xe7')][_0x6697('0x11c')](db['User'],{'foreignKey':_0x6697('0x1e2'),'as':_0x6697('0x1e3')});db['MailTransferReport']['belongsTo'](db[_0x6697('0x11')],{'foreignKey':_0x6697('0x1e4'),'as':_0x6697('0x1e5')});db[_0x6697('0xe7')][_0x6697('0x11c')](db[_0x6697('0x3d')],{'foreignKey':_0x6697('0x1e6'),'as':_0x6697('0x1e7')});db[_0x6697('0xe7')][_0x6697('0x11c')](db[_0x6697('0x3b')],{'foreignKey':_0x6697('0x1e8'),'as':'ToAccount'});db['ChatTransferReport'][_0x6697('0x11c')](db[_0x6697('0x66')],{});db[_0x6697('0xe9')][_0x6697('0x11c')](db[_0x6697('0x116')],{});db[_0x6697('0xe9')]['belongsTo'](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0x6697('0x1e1')});db[_0x6697('0xe9')][_0x6697('0x11c')](db[_0x6697('0x11')],{'foreignKey':_0x6697('0x1e2'),'as':_0x6697('0x1e3')});db['ChatTransferReport'][_0x6697('0x11c')](db[_0x6697('0x11')],{'foreignKey':_0x6697('0x1e4'),'as':'ToAgent'});db[_0x6697('0xe9')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0x6697('0x1e9'),'as':'ToQueue'});db[_0x6697('0xe9')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x6697('0x1ea'),'as':'ToAccount'});db[_0x6697('0xea')]['belongsTo'](db['FaxMessage'],{});db[_0x6697('0xea')][_0x6697('0x11c')](db[_0x6697('0x4d')],{});db[_0x6697('0xea')][_0x6697('0x11c')](db['FaxAccount'],{'foreignKey':_0x6697('0x1eb'),'as':_0x6697('0x1e1')});db[_0x6697('0xea')][_0x6697('0x11c')](db[_0x6697('0x11')],{'foreignKey':_0x6697('0x1e2'),'as':_0x6697('0x1e3')});db[_0x6697('0xea')][_0x6697('0x11c')](db[_0x6697('0x11')],{'foreignKey':_0x6697('0x1e4'),'as':_0x6697('0x1e5')});db['FaxTransferReport'][_0x6697('0x11c')](db[_0x6697('0x50')],{'foreignKey':_0x6697('0x1ec'),'as':_0x6697('0x1e7')});db[_0x6697('0xea')][_0x6697('0x11c')](db['FaxAccount'],{'foreignKey':_0x6697('0x1ed'),'as':_0x6697('0x1ee')});db[_0x6697('0xec')][_0x6697('0x11c')](db[_0x6697('0x5e')],{});db[_0x6697('0xec')][_0x6697('0x11c')](db[_0x6697('0x5d')],{});db[_0x6697('0xec')][_0x6697('0x11c')](db['OpenchannelAccount'],{'foreignKey':_0x6697('0x1ef'),'as':'FromAccount'});db[_0x6697('0xec')]['belongsTo'](db['User'],{'foreignKey':_0x6697('0x1e2'),'as':_0x6697('0x1e3')});db[_0x6697('0xec')][_0x6697('0x11c')](db[_0x6697('0x11')],{'foreignKey':_0x6697('0x1e4'),'as':_0x6697('0x1e5')});db['OpenchannelTransferReport']['belongsTo'](db[_0x6697('0x60')],{'foreignKey':_0x6697('0x1f0'),'as':_0x6697('0x1e7')});db['OpenchannelTransferReport'][_0x6697('0x11c')](db['OpenchannelAccount'],{'foreignKey':_0x6697('0x1f1'),'as':_0x6697('0x1ee')});db[_0x6697('0xee')][_0x6697('0x11c')](db[_0x6697('0x57')],{});db[_0x6697('0xee')][_0x6697('0x11c')](db['SmsInteraction'],{});db[_0x6697('0xee')][_0x6697('0x11c')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0x6697('0x1e1')});db[_0x6697('0xee')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x6697('0xee')][_0x6697('0x11c')](db['User'],{'foreignKey':_0x6697('0x1e4'),'as':_0x6697('0x1e5')});db[_0x6697('0xee')][_0x6697('0x11c')](db[_0x6697('0x59')],{'foreignKey':_0x6697('0x1f2'),'as':'ToQueue'});db['SmsTransferReport']['belongsTo'](db[_0x6697('0x53')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x6697('0xf0')][_0x6697('0x111')](db['Disposition'],{'as':_0x6697('0x168'),'foreignKey':_0x6697('0x16c'),'onDelete':_0x6697('0x110')});db['CmList'][_0x6697('0x111')](db['CmCustomField'],{'as':_0x6697('0x1f3'),'foreignKey':'ListId'});db[_0x6697('0xf0')][_0x6697('0x111')](db['CmContact'],{'as':'Contacts','onDelete':_0x6697('0x110'),'foreignKey':_0x6697('0x16c')});db['CmList'][_0x6697('0x111')](db[_0x6697('0x75')],{'as':'HopperFinals','foreignKey':_0x6697('0x16c')});db[_0x6697('0xf0')][_0x6697('0x111')](db[_0x6697('0x77')],{'as':_0x6697('0x1f4'),'foreignKey':'ListId'});db[_0x6697('0xf0')][_0x6697('0x111')](db[_0x6697('0x79')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x6697('0xf0')]['belongsToMany'](db['VoiceQueue'],{'as':_0x6697('0x1f5'),'through':_0x6697('0x156')});db[_0x6697('0xf0')][_0x6697('0x121')](db[_0x6697('0x11')],{'as':_0x6697('0x16e'),'through':_0x6697('0x135')});db[_0x6697('0xf2')]['hasMany'](db['VoiceExtension'],{'as':_0x6697('0x113'),'onDelete':'cascade'});db[_0x6697('0xf2')][_0x6697('0x121')](db['User'],{'as':'Agents','through':'UserVoicePrefix'});db[_0x6697('0xf2')]['belongsToMany'](db[_0x6697('0xde')],{'through':'TeamVoicePrefix','as':_0x6697('0x158')});db['UserProfile']['hasMany'](db[_0x6697('0x11')],{'as':_0x6697('0x174'),'foreignKey':_0x6697('0x11e')});db[_0x6697('0x11d')][_0x6697('0x111')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x6697('0x11e'),'onDelete':_0x6697('0x110')});db[_0x6697('0x1f6')][_0x6697('0x111')](db[_0x6697('0xf6')],{'as':_0x6697('0x1f7'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0x6697('0x13f')][_0x6697('0x111')](db[_0x6697('0x82')],{'as':_0x6697('0x168'),'foreignKey':_0x6697('0x1f8'),'onDelete':_0x6697('0x110')});db['WhatsappAccount'][_0x6697('0x111')](db[_0x6697('0x80')],{'as':_0x6697('0x169'),'foreignKey':_0x6697('0x1f8')});db[_0x6697('0x13f')][_0x6697('0x111')](db['WhatsappMessage'],{'as':'Messages','foreignKey':_0x6697('0x1f8')});db[_0x6697('0x13f')][_0x6697('0x111')](db[_0x6697('0xfc')],{'as':_0x6697('0x16a')});db[_0x6697('0x13f')]['hasMany'](db['WhatsappApplication'],{'as':_0x6697('0x147')});db[_0x6697('0x13f')]['belongsTo'](db['CmList'],{'as':_0x6697('0x16b'),'foreignKey':_0x6697('0x16c')});db[_0x6697('0x13f')]['belongsTo'](db[_0x6697('0x154')],{'as':'mandatoryDispositionPause','foreignKey':_0x6697('0x17f')});db[_0x6697('0x13f')][_0x6697('0x121')](db[_0x6697('0x11')],{'as':_0x6697('0x16e'),'through':_0x6697('0x141')});db[_0x6697('0xfa')][_0x6697('0x11c')](db[_0x6697('0x11')],{'onDelete':_0x6697('0x165')});db[_0x6697('0xfa')]['belongsTo'](db[_0x6697('0x103')],{'onDelete':_0x6697('0x165')});db[_0x6697('0xfa')]['belongsTo'](db[_0x6697('0x13f')],{'onDelete':_0x6697('0x165')});db[_0x6697('0xfa')][_0x6697('0x11c')](db[_0x6697('0x84')],{'onDelete':_0x6697('0x165'),'foreignKey':_0x6697('0x153')});db[_0x6697('0xfa')]['belongsTo'](db[_0x6697('0x8a')],{'onDelete':'restrict','foreignKey':_0x6697('0x17a')});db[_0x6697('0xfc')]['hasMany'](db[_0x6697('0xfe')],{'as':_0x6697('0x15b'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0x6697('0x11c')](db[_0x6697('0x13f')],{'as':'Account','foreignKey':_0x6697('0x1f8')});db['WhatsappInteraction'][_0x6697('0x11c')](db[_0x6697('0x70')],{'as':'Contact','foreignKey':_0x6697('0x162')});db[_0x6697('0xfc')][_0x6697('0x11c')](db[_0x6697('0x11')],{'as':'Owner','foreignKey':_0x6697('0x10f')});db[_0x6697('0xfc')][_0x6697('0x121')](db[_0x6697('0x8a')],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db['WhatsappInteraction'][_0x6697('0x121')](db['Tag'],{'through':_0x6697('0x1af'),'as':_0x6697('0x173')});db[_0x6697('0xfc')]['belongsToMany'](db[_0x6697('0x11')],{'as':'Users','through':_0x6697('0x12b'),'foreignKey':_0x6697('0x1f9')});db[_0x6697('0xfe')][_0x6697('0x11c')](db[_0x6697('0x11')],{'as':_0x6697('0x11')});db[_0x6697('0xfe')][_0x6697('0x11c')](db[_0x6697('0x70')],{'onDelete':_0x6697('0x110'),'as':_0x6697('0x161')});db[_0x6697('0xfe')][_0x6697('0x11c')](db[_0x6697('0xfc')],{'onDelete':_0x6697('0x110'),'as':_0x6697('0x177'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage']['belongsTo'](db['WhatsappAccount'],{'as':_0x6697('0x178'),'foreignKey':_0x6697('0x1f8')});db[_0x6697('0x1fa')][_0x6697('0x11c')](db[_0x6697('0x13f')],{});db[_0x6697('0x1fa')]['belongsTo'](db[_0x6697('0xf0')],{'as':'List','foreignKey':_0x6697('0x16c')});db[_0x6697('0x1fa')][_0x6697('0x11c')](db[_0x6697('0x70')],{'as':_0x6697('0x161'),'foreignKey':'ContactId'});db[_0x6697('0x1fa')]['belongsTo'](db[_0x6697('0xfc')],{});db[_0x6697('0x1fa')][_0x6697('0x11c')](db[_0x6697('0x103')],{});db[_0x6697('0x1fa')]['belongsTo'](db[_0x6697('0xfe')],{});db['WhatsappQueueReport'][_0x6697('0x11c')](db[_0x6697('0x11')],{});db[_0x6697('0x101')][_0x6697('0x11c')](db['WhatsappMessage'],{});db[_0x6697('0x101')][_0x6697('0x11c')](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0x6697('0x11c')](db[_0x6697('0x13f')],{'foreignKey':_0x6697('0x1fb'),'as':'FromAccount'});db['WhatsappTransferReport'][_0x6697('0x11c')](db[_0x6697('0x13f')],{'foreignKey':_0x6697('0x1fc'),'as':_0x6697('0x1ee')});db[_0x6697('0x101')][_0x6697('0x11c')](db[_0x6697('0x103')],{'foreignKey':'ToQueueId','as':_0x6697('0x1e7')});db[_0x6697('0x101')]['belongsTo'](db[_0x6697('0x11')],{'foreignKey':_0x6697('0x1e2'),'as':'FromAgent'});db['WhatsappTransferReport']['belongsTo'](db[_0x6697('0x11')],{'foreignKey':_0x6697('0x1e4'),'as':_0x6697('0x1e5')});db[_0x6697('0x103')][_0x6697('0x121')](db['User'],{'as':_0x6697('0x16e'),'through':_0x6697('0x35'),'foreignKey':_0x6697('0x1fd')});db['WhatsappQueue'][_0x6697('0x121')](db[_0x6697('0xde')],{'through':_0x6697('0x1da'),'as':_0x6697('0x158')});db[_0x6697('0x1fe')]['belongsTo'](db[_0x6697('0x11')],{'as':_0x6697('0x1ff'),'foreignKey':'UserId','onDelete':'cascade','hooks':!![]});db[_0x6697('0x105')][_0x6697('0x10e')](db[_0x6697('0xc2')],{'as':_0x6697('0xc2'),'onDelete':_0x6697('0x165')});db[_0x6697('0x105')]['hasOne'](db['MailServerIn'],{'as':_0x6697('0x166'),'onDelete':'restrict'});db['CloudProvider'][_0x6697('0x10e')](db[_0x6697('0x39')],{'as':_0x6697('0x167'),'onDelete':_0x6697('0x165')});module[_0x6697('0x200')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x0852=['WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','hasMany','VoiceQueuesRt','Extensions','CmHopperHistory','HopperHistory','ChatInteractions','SmsInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','CmContact','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','MailInteractions','user_has_chat_interactions','FaxInteractions','user_has_sms_interactions','OpenchannelInteraction','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueues','UserWhatsappQueue','ChatWebsites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','UserVoiceQueueRt','Members','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','AgentReports','uniqueid','Contact','MailAccount','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Disposition','Dispositions','MailMessage','Interactions','ListId','TemplateId','MailQueue','team_has_mail_queues','Teams','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','List','DashboardItem','Items','FaxAccountId','Answers','FaxApplication','Exntensions','TagId','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','user_has_sms_accounts','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','ChatApplication','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CompanyId','CmHopper','Company','cm_contact_has_tags','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','AutomationAnyId','Actions','AutomationId','ParentId','MailApplications','ChatApplications','SmsApplications','AnalyticDefaultReport','CustomReportId','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','AnyConditions','AnyCondition','Fields','DefaultReportId','MetricId','Configurations','AccountId','Subjects','SubjectId','DescriptionId','FieldId','Field','SugarcrmConfiguration','Subject','Description','VariableId','DeskConfiguration','DeskField','int_desk_configuration_has_tags','ZohoConfiguration','Descriptions','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','Dynamics365Field','FreshsalesField','ToId','SessionId','ProjectId','user_has_teams','ChatQueues','team_has_whatsapp_queues','WhatsappQueues','VoicePrefixes','campaigns_has_cm_lists','BlackLists','ChatOfflineMessageId','MailTransferReport','FromMailAccountId','FromUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','FromAgent','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','IntegrationReport','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model'];(function(_0x147e7f,_0x1b27e6){var _0x5470f9=function(_0x5a33bb){while(--_0x5a33bb){_0x147e7f['push'](_0x147e7f['shift']());}};_0x5470f9(++_0x1b27e6);}(_0x0852,0x10a));var _0x2085=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x0852[_0x411017];return _0x2adeea;};'use strict';var config=require(_0x2085('0x0'));var Sequelize=require(_0x2085('0x1'));var _=require(_0x2085('0x2'));var jstz=require(_0x2085('0x3'));var timezone=jstz[_0x2085('0x4')]();config[_0x2085('0x1')]=_[_0x2085('0x5')](config[_0x2085('0x1')],{'database':_0x2085('0x6'),'username':_0x2085('0x7'),'password':_0x2085('0x8'),'options':{'host':_0x2085('0x9'),'port':0xcea,'dialect':_0x2085('0xa'),'dialectOptions':{'charset':_0x2085('0xb')},'logging':![],'timezone':timezone[_0x2085('0xc')](),'define':{'charset':_0x2085('0xd'),'collate':_0x2085('0xe')}}});config[_0x2085('0xf')]=_['defaultsDeep'](config[_0x2085('0xf')],{'database':_0x2085('0x6'),'username':_0x2085('0x7'),'password':'xC@LL1234','options':{'host':_0x2085('0x9'),'port':0xcea,'dialect':_0x2085('0xa'),'dialectOptions':{'charset':_0x2085('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x2085('0xd'),'collate':_0x2085('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2085('0x1')][_0x2085('0x10')],config[_0x2085('0x1')]['username'],config[_0x2085('0x1')][_0x2085('0x11')],config[_0x2085('0x1')][_0x2085('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2085('0xf')][_0x2085('0x10')],config['sequelizeHistory']['username'],config[_0x2085('0xf')][_0x2085('0x11')],config[_0x2085('0xf')][_0x2085('0x12')])};db[_0x2085('0x13')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x15'));db['VoiceChanSpy']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x16'));db['VoiceContext']=db[_0x2085('0x1')][_0x2085('0x14')]('../api/voiceContext/voiceContext.model');db[_0x2085('0x17')]=db['sequelize']['import'](_0x2085('0x18'));db[_0x2085('0x19')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x1a'));db[_0x2085('0x1b')]=db[_0x2085('0x1')]['import'](_0x2085('0x1c'));db[_0x2085('0x1d')]=db[_0x2085('0x1')]['import'](_0x2085('0x1e'));db[_0x2085('0x1f')]=db[_0x2085('0x1')]['import']('../api/screenRecording/screenRecording.model');db[_0x2085('0x20')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/voiceMail/voiceMail.model');db[_0x2085('0x21')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x2085('0x22')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x23'));db[_0x2085('0x24')]=db[_0x2085('0x1')]['import'](_0x2085('0x25'));db[_0x2085('0x26')]=db['sequelize'][_0x2085('0x14')](_0x2085('0x27'));db[_0x2085('0x28')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x29'));db[_0x2085('0x2a')]=db['sequelize']['import']('../api/memberReport/memberReport.model');db[_0x2085('0x2b')]=db['sequelize']['import'](_0x2085('0x2c'));db['VoiceTransferReport']=db[_0x2085('0x1')][_0x2085('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x2d'));db[_0x2085('0x2e')]=db[_0x2085('0x1')]['import'](_0x2085('0x2f'));db['UserChatQueue']=db[_0x2085('0x1')]['import'](_0x2085('0x30'));db[_0x2085('0x31')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/userMailQueue/userMailQueue.model');db[_0x2085('0x32')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0x2085('0x33')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x34'));db[_0x2085('0x35')]=db['sequelize'][_0x2085('0x14')](_0x2085('0x36'));db['UserWhatsappQueue']=db['sequelize'][_0x2085('0x14')](_0x2085('0x37'));db[_0x2085('0x38')]=db[_0x2085('0x1')]['import'](_0x2085('0x39'));db[_0x2085('0x3a')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x3b'));db['MailAccount']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x3c'));db['MailQueue']=db['sequelize'][_0x2085('0x14')](_0x2085('0x3d'));db['MailSubstatus']=db[_0x2085('0x1')][_0x2085('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0x2085('0x3e')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x3f'));db['MailMessage']=db[_0x2085('0x1')]['import']('../api/mailMessage/mailMessage.model');db[_0x2085('0x40')]=db[_0x2085('0x1')]['import'](_0x2085('0x41'));db[_0x2085('0x42')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/mailQueueReport/mailQueueReport.model');db[_0x2085('0x43')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x44'));db['DashboardItem']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x45'));db['FaxAccount']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x46'));db['FaxApplication']=db[_0x2085('0x1')][_0x2085('0x14')]('../api/faxApplication/faxApplication.model');db[_0x2085('0x47')]=db['sequelize']['import'](_0x2085('0x48'));db[_0x2085('0x49')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x4a'));db[_0x2085('0x4b')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x4c'));db['FaxQueueReport']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x4d'));db['SmsAccount']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x4e'));db[_0x2085('0x4f')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x50'));db[_0x2085('0x51')]=db['sequelize'][_0x2085('0x14')](_0x2085('0x52'));db['SmsMessage']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x53'));db[_0x2085('0x54')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x55'));db[_0x2085('0x56')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x57'));db['OpenchannelApplication']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x58'));db['OpenchannelInteraction']=db['sequelize'][_0x2085('0x14')](_0x2085('0x59'));db[_0x2085('0x5a')]=db['sequelize'][_0x2085('0x14')](_0x2085('0x5b'));db[_0x2085('0x5c')]=db[_0x2085('0x1')]['import'](_0x2085('0x5d'));db[_0x2085('0x5e')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x5f'));db[_0x2085('0x60')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x61'));db['ChatApplication']=db['sequelize'][_0x2085('0x14')](_0x2085('0x62'));db[_0x2085('0x63')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x64'));db[_0x2085('0x65')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x66'));db[_0x2085('0x67')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/chatQueue/chatQueue.model');db[_0x2085('0x68')]=db['sequelize']['import']('../api/chatGroup/chatGroup.model');db[_0x2085('0x69')]=db[_0x2085('0x1')]['import'](_0x2085('0x6a'));db[_0x2085('0x6b')]=db['sequelize'][_0x2085('0x14')](_0x2085('0x6c'));db['CmContact']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x6d'));db['CmHopper']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x6e'));db[_0x2085('0x6f')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x70'));db[_0x2085('0x71')]=db['sequelize']['import'](_0x2085('0x72'));db['CmHopperHistory']=db[_0x2085('0x1')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0x2085('0x73')]=db['sequelize'][_0x2085('0x14')](_0x2085('0x74'));db[_0x2085('0x75')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/cmCustomField/cmCustomField.model');db[_0x2085('0x76')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x77'));db[_0x2085('0x78')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x79'));db[_0x2085('0x7a')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x7b'));db['Disposition']=db[_0x2085('0x1')]['import'](_0x2085('0x7c'));db[_0x2085('0x7d')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x7e'));db[_0x2085('0x7f')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/interval/interval.model');db[_0x2085('0x80')]=db['sequelize']['import'](_0x2085('0x81'));db['Cdr']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x82'));db[_0x2085('0x83')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x2085('0x84')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x85'));db[_0x2085('0x86')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x87'));db[_0x2085('0x88')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/tag/tag.model');db[_0x2085('0x89')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x8a'));db['Trigger']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x8b'));db[_0x2085('0x8c')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x8d'));db['Integration']=db['sequelize'][_0x2085('0x14')]('../api/integration/integration.model');db[_0x2085('0x8e')]=db[_0x2085('0x1')]['import']('../api/integrationReport/integrationReport.model');db[_0x2085('0x8f')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0x2085('0x1')]['import'](_0x2085('0x90'));db[_0x2085('0x91')]=db['sequelize'][_0x2085('0x14')](_0x2085('0x92'));db[_0x2085('0x93')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x94'));db[_0x2085('0x95')]=db[_0x2085('0x1')]['import'](_0x2085('0x96'));db[_0x2085('0x97')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x98'));db[_0x2085('0x99')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x9a'));db[_0x2085('0x9b')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x2085('0x9c')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/intSalesforceField/intSalesforceField.model');db[_0x2085('0x9d')]=db['sequelize'][_0x2085('0x14')](_0x2085('0x9e'));db['SugarcrmConfiguration']=db['sequelize'][_0x2085('0x14')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x2085('0x9f')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x2085('0xa0')]=db['sequelize'][_0x2085('0x14')](_0x2085('0xa1'));db['DeskConfiguration']=db['sequelize'][_0x2085('0x14')](_0x2085('0xa2'));db['DeskField']=db['sequelize'][_0x2085('0x14')](_0x2085('0xa3'));db[_0x2085('0xa4')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xa5'));db['ZohoConfiguration']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xa6'));db[_0x2085('0xa7')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xa8'));db[_0x2085('0xa9')]=db['sequelize'][_0x2085('0x14')](_0x2085('0xaa'));db['ZendeskConfiguration']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xab'));db[_0x2085('0xac')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xad'));db['FreshdeskAccount']=db['sequelize'][_0x2085('0x14')](_0x2085('0xae'));db['FreshdeskConfiguration']=db['sequelize'][_0x2085('0x14')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xaf'));db['VtigerAccount']=db[_0x2085('0x1')][_0x2085('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x2085('0xb0')]=db[_0x2085('0x1')]['import'](_0x2085('0xb1'));db[_0x2085('0xb2')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xb3'));db[_0x2085('0xb4')]=db[_0x2085('0x1')]['import']('../api/intServicenowAccount/intServicenowAccount.model');db[_0x2085('0xb5')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x2085('0xb6')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/intServicenowField/intServicenowField.model');db[_0x2085('0xb7')]=db['sequelize']['import'](_0x2085('0xb8'));db[_0x2085('0xb9')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xba'));db['Dynamics365Field']=db[_0x2085('0x1')][_0x2085('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x2085('0xbb')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xbc'));db[_0x2085('0xbd')]=db['sequelize']['import'](_0x2085('0xbe'));db['FreshsalesField']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xbf'));db[_0x2085('0xc0')]=db['sequelize']['import'](_0x2085('0xc1'));db[_0x2085('0xc2')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xc3'));db[_0x2085('0xc4')]=db['sequelize'][_0x2085('0x14')](_0x2085('0xc5'));db[_0x2085('0xc6')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xc7'));db[_0x2085('0xc8')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x2085('0xc9')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xca'));db[_0x2085('0xcb')]=db['sequelize'][_0x2085('0x14')](_0x2085('0xcc'));db[_0x2085('0xcd')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xce'));db[_0x2085('0xcf')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xd0'));db[_0x2085('0xd1')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xd2'));db[_0x2085('0xd3')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/setting/setting.model');db['SquareOdbc']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xd4'));db['SquareProject']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xd5'));db[_0x2085('0xd6')]=db[_0x2085('0x1')]['import']('../api/squareRecording/squareRecording.model');db[_0x2085('0xd7')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xd8'));db[_0x2085('0xd9')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xda'));db[_0x2085('0xdb')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xdc'));db['Campaign']=db[_0x2085('0x1')][_0x2085('0x14')]('../api/campaign/campaign.model');db[_0x2085('0xdd')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xde'));db[_0x2085('0xdf')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xe0'));db[_0x2085('0xe1')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xe2'));db['MailTransferReport']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xe3'));db[_0x2085('0xe4')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xe5'));db[_0x2085('0xe6')]=db['sequelize'][_0x2085('0x14')]('../api/faxTransferReport/faxTransferReport.model');db[_0x2085('0xe7')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xe8'));db['SmsTransferReport']=db['sequelize'][_0x2085('0x14')](_0x2085('0xe9'));db['CmList']=db[_0x2085('0x1')]['import'](_0x2085('0xea'));db[_0x2085('0xeb')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/voicePrefix/voicePrefix.model');db[_0x2085('0xec')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xed'));db[_0x2085('0xee')]=db[_0x2085('0x1')]['import'](_0x2085('0xef'));db[_0x2085('0xf0')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xf1'));db[_0x2085('0xf2')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xf3'));db[_0x2085('0xf4')]=db[_0x2085('0x1')]['import'](_0x2085('0xf5'));db[_0x2085('0xf6')]=db['sequelize']['import'](_0x2085('0xf7'));db[_0x2085('0xf8')]=db[_0x2085('0x1')]['import'](_0x2085('0xf9'));db[_0x2085('0xfa')]=db['sequelize']['import']('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0xfb'));db[_0x2085('0xfc')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x2085('0xfd')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/whatsappQueue/whatsappQueue.model');db[_0x2085('0xfe')]=db[_0x2085('0x1')][_0x2085('0x14')]('../api/cloudProvider/cloudProvider.model');db[_0x2085('0xff')]=db['sequelize']['import'](_0x2085('0x100'));db[_0x2085('0x101')]=db['sequelize'][_0x2085('0x14')](_0x2085('0x102'));db[_0x2085('0x103')]=db[_0x2085('0x1')][_0x2085('0x14')](_0x2085('0x104'));db[_0x2085('0x105')]=db['sequelize'][_0x2085('0x14')](_0x2085('0x106'));db[_0x2085('0x13')][_0x2085('0x107')](db[_0x2085('0x20')],{'as':_0x2085('0x20'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x109')});db[_0x2085('0x13')][_0x2085('0x107')](db[_0x2085('0x105')],{'as':_0x2085('0x10a'),'onDelete':_0x2085('0x108'),'foreignKey':'UserId'});db[_0x2085('0x13')]['hasMany'](db[_0x2085('0x1d')],{'as':'Recordings','foreignKey':_0x2085('0x109')});db[_0x2085('0x13')][_0x2085('0x10b')](db['UserVoiceQueueRt'],{'as':_0x2085('0x10c'),'foreignKey':_0x2085('0x109')});db[_0x2085('0x13')]['hasMany'](db[_0x2085('0x17')],{'as':_0x2085('0x10d'),'onDelete':_0x2085('0x108'),'hooks':!![]});db[_0x2085('0x13')][_0x2085('0x10b')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x2085('0x109')});db[_0x2085('0x13')]['hasMany'](db[_0x2085('0x10e')],{'as':_0x2085('0x10f'),'foreignKey':_0x2085('0x109')});db[_0x2085('0x13')][_0x2085('0x10b')](db[_0x2085('0x73')],{'as':_0x2085('0x73'),'foreignKey':_0x2085('0x109')});db[_0x2085('0x13')][_0x2085('0x10b')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x2085('0x109')});db[_0x2085('0x13')][_0x2085('0x10b')](db[_0x2085('0x63')],{'as':_0x2085('0x110'),'foreignKey':_0x2085('0x109')});db[_0x2085('0x13')][_0x2085('0x10b')](db[_0x2085('0x51')],{'as':_0x2085('0x111'),'foreignKey':'UserId'});db[_0x2085('0x13')]['hasMany'](db[_0x2085('0x47')],{'as':'FaxInteractions','foreignKey':_0x2085('0x109')});db[_0x2085('0x13')][_0x2085('0x10b')](db[_0x2085('0x3e')],{'as':'MailInteractions','foreignKey':_0x2085('0x109')});db[_0x2085('0x13')][_0x2085('0x10b')](db['WhatsappInteraction'],{'as':_0x2085('0x112'),'foreignKey':'UserId'});db['User'][_0x2085('0x10b')](db['UserNotification'],{'as':_0x2085('0x113'),'foreignKey':_0x2085('0x114')});db[_0x2085('0x13')][_0x2085('0x115')](db['UserProfile'],{'as':_0x2085('0xec'),'foreignKey':_0x2085('0x116')});db[_0x2085('0x13')][_0x2085('0x117')](db['ChatGroup'],{'as':'Groups','through':'chat_group_has_users'});db['User']['belongsToMany'](db[_0x2085('0x118')],{'as':_0x2085('0x119'),'through':_0x2085('0x11a')});db['User'][_0x2085('0x117')](db[_0x2085('0x11b')],{'as':_0x2085('0x11c'),'through':_0x2085('0x11d')});db['User'][_0x2085('0x117')](db[_0x2085('0xd9')],{'through':'user_has_teams'});db[_0x2085('0x13')][_0x2085('0x117')](db[_0x2085('0x3e')],{'as':_0x2085('0x11e'),'through':'user_has_mail_interactions'});db[_0x2085('0x13')][_0x2085('0x117')](db[_0x2085('0x63')],{'as':_0x2085('0x110'),'through':_0x2085('0x11f')});db[_0x2085('0x13')][_0x2085('0x117')](db['FaxInteraction'],{'as':_0x2085('0x120'),'through':'user_has_fax_interactions'});db[_0x2085('0x13')][_0x2085('0x117')](db['SmsInteraction'],{'as':_0x2085('0x111'),'through':_0x2085('0x121')});db['User'][_0x2085('0x117')](db[_0x2085('0x122')],{'as':_0x2085('0x123'),'through':_0x2085('0x124')});db[_0x2085('0x13')][_0x2085('0x117')](db[_0x2085('0xf8')],{'as':_0x2085('0x112'),'through':_0x2085('0x125')});db[_0x2085('0x13')][_0x2085('0x117')](db[_0x2085('0x1b')],{'as':_0x2085('0x126'),'through':_0x2085('0x2e'),'required':![]});db[_0x2085('0x13')][_0x2085('0x117')](db[_0x2085('0xeb')],{'as':'VoicePrefixes','through':_0x2085('0x103'),'required':![]});db[_0x2085('0x13')][_0x2085('0x117')](db['MailQueue'],{'as':'MailQueues','through':_0x2085('0x31'),'required':![]});db[_0x2085('0x13')][_0x2085('0x117')](db[_0x2085('0x67')],{'as':'ChatQueues','through':_0x2085('0x127'),'required':![],'hooks':!![]});db[_0x2085('0x13')][_0x2085('0x117')](db[_0x2085('0x4b')],{'as':_0x2085('0x128'),'through':_0x2085('0x32'),'required':![]});db[_0x2085('0x13')][_0x2085('0x117')](db[_0x2085('0x54')],{'as':_0x2085('0x129'),'through':_0x2085('0x33'),'required':![]});db[_0x2085('0x13')][_0x2085('0x117')](db[_0x2085('0x5c')],{'as':_0x2085('0x12a'),'through':_0x2085('0x35'),'required':![]});db['User'][_0x2085('0x117')](db[_0x2085('0xfd')],{'as':'WhatsappQueues','through':_0x2085('0x12b'),'required':![]});db['User'][_0x2085('0x117')](db[_0x2085('0x11b')],{'through':_0x2085('0x11d')});db[_0x2085('0x13')]['belongsToMany'](db[_0x2085('0x5e')],{'as':_0x2085('0x12c'),'through':'user_has_chat_websites'});db['User'][_0x2085('0x117')](db[_0x2085('0x12d')],{'as':_0x2085('0x12e'),'through':_0x2085('0x12f')});db['User'][_0x2085('0x117')](db['MailAccount'],{'as':_0x2085('0x130'),'through':_0x2085('0x131')});db['User'][_0x2085('0x117')](db[_0x2085('0x56')],{'as':_0x2085('0x132'),'through':_0x2085('0x133')});db[_0x2085('0x13')][_0x2085('0x117')](db[_0x2085('0x134')],{'as':_0x2085('0x135'),'through':'user_has_sms_accounts'});db['User'][_0x2085('0x117')](db['WhatsappAccount'],{'as':_0x2085('0x136'),'through':_0x2085('0x137')});db[_0x2085('0x13')][_0x2085('0x117')](db[_0x2085('0x138')],{'as':_0x2085('0x139'),'through':_0x2085('0x13a')});db[_0x2085('0x13b')][_0x2085('0x10b')](db['VoiceExtension'],{'as':_0x2085('0x13c'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x13d')});db[_0x2085('0x13e')]['hasMany'](db[_0x2085('0x17')],{'onDelete':_0x2085('0x108')});db[_0x2085('0x17')][_0x2085('0x10b')](db['VoiceExtension'],{'as':_0x2085('0x13f'),'onDelete':'cascade'});db[_0x2085('0x19')][_0x2085('0x117')](db[_0x2085('0x86')],{'as':_0x2085('0x140'),'through':_0x2085('0x141')});db[_0x2085('0x1b')][_0x2085('0x10b')](db[_0x2085('0x142')],{'as':_0x2085('0x143'),'foreignKey':_0x2085('0x144')});db[_0x2085('0x1b')][_0x2085('0x10b')](db['CmHopper'],{'as':_0x2085('0x145'),'foreignKey':_0x2085('0x144')});db[_0x2085('0x1b')][_0x2085('0x10b')](db['CmHopperFinal'],{'as':_0x2085('0x146'),'foreignKey':'VoiceQueueId'});db[_0x2085('0x1b')][_0x2085('0x10b')](db[_0x2085('0x10e')],{'as':_0x2085('0x147'),'foreignKey':'VoiceQueueId'});db[_0x2085('0x1b')][_0x2085('0x10b')](db[_0x2085('0x73')],{'as':_0x2085('0x73'),'foreignKey':_0x2085('0x144')});db[_0x2085('0x1b')][_0x2085('0x10b')](db[_0x2085('0x6f')],{'as':_0x2085('0x148'),'foreignKey':_0x2085('0x144')});db[_0x2085('0x1b')][_0x2085('0x10b')](db[_0x2085('0xcb')],{'as':_0x2085('0x149'),'foreignKey':_0x2085('0x144')});db[_0x2085('0x1b')]['belongsTo'](db[_0x2085('0x2b')],{'as':_0x2085('0x2b'),'foreignKey':_0x2085('0x14a')});db['VoiceQueue']['belongsTo'](db[_0x2085('0x2b')],{'as':_0x2085('0x14b'),'foreignKey':_0x2085('0x14c')});db['VoiceQueue'][_0x2085('0x115')](db[_0x2085('0x7f')],{'as':_0x2085('0x7f'),'foreignKey':_0x2085('0x14d')});db[_0x2085('0x1b')][_0x2085('0x115')](db[_0x2085('0x80')],{'as':_0x2085('0x14e'),'foreignKey':_0x2085('0x14f')});db[_0x2085('0x1b')][_0x2085('0x117')](db['CmList'],{'as':_0x2085('0x11c'),'through':_0x2085('0x150')});db[_0x2085('0x1b')]['belongsToMany'](db['User'],{'as':_0x2085('0x151'),'through':_0x2085('0x2e')});db[_0x2085('0x1b')][_0x2085('0x117')](db[_0x2085('0xd9')],{'as':'Teams','through':'TeamVoiceQueue'});db['VoiceQueue'][_0x2085('0x117')](db[_0x2085('0x11b')],{'as':'BlackLists','through':_0x2085('0x152')});db[_0x2085('0x1d')]['belongsTo'](db['User'],{'as':_0x2085('0x13'),'foreignKey':'UserId'});db['ScreenRecording'][_0x2085('0x115')](db[_0x2085('0x13')],{'as':_0x2085('0x13'),'foreignKey':_0x2085('0x109')});db[_0x2085('0x20')][_0x2085('0x10b')](db[_0x2085('0x21')],{'as':_0x2085('0x153'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x154'),'sourceKey':_0x2085('0x155')});db[_0x2085('0x21')][_0x2085('0x115')](db[_0x2085('0x20')],{'foreignKey':'mailboxuser','targetKey':_0x2085('0x155')});db['VoiceCallReport'][_0x2085('0x10b')](db[_0x2085('0x28')],{'as':_0x2085('0x156'),'foreignKey':'uniqueid','constraints':![]});db[_0x2085('0x22')][_0x2085('0x10b')](db[_0x2085('0x26')],{'as':_0x2085('0x157'),'foreignKey':_0x2085('0x158'),'constraints':![]});db['VoiceCallReport'][_0x2085('0x115')](db['User'],{'as':_0x2085('0x13'),'foreignKey':_0x2085('0x109')});db[_0x2085('0x22')]['belongsTo'](db[_0x2085('0x118')],{'as':_0x2085('0x159'),'foreignKey':'ContactId'});db[_0x2085('0x38')][_0x2085('0x115')](db[_0x2085('0x15a')],{'as':_0x2085('0x15a'),'foreignKey':_0x2085('0x15b')});db[_0x2085('0x38')]['belongsTo'](db[_0x2085('0xfe')],{'as':_0x2085('0xfe'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0x2085('0x3a')]['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db['MailServerOut']['belongsTo'](db[_0x2085('0xfe')],{'as':'CloudProvider','foreignKey':_0x2085('0x15c'),'onDelete':_0x2085('0x15d')});db[_0x2085('0x15a')][_0x2085('0x107')](db['MailServerIn'],{'as':_0x2085('0x15e'),'onDelete':'cascade'});db[_0x2085('0x15a')][_0x2085('0x107')](db['MailServerOut'],{'as':_0x2085('0x15f'),'onDelete':_0x2085('0x108')});db['MailAccount'][_0x2085('0x10b')](db[_0x2085('0x160')],{'as':_0x2085('0x161'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0x2085('0x15a')]['hasMany'](db[_0x2085('0x7a')],{'as':'Answers','foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db[_0x2085('0x162')],{'as':_0x2085('0x153'),'foreignKey':_0x2085('0x15b')});db[_0x2085('0x15a')]['hasMany'](db[_0x2085('0x3e')],{'as':_0x2085('0x163')});db[_0x2085('0x15a')][_0x2085('0x10b')](db[_0x2085('0x40')],{'as':_0x2085('0x13f')});db['MailAccount'][_0x2085('0x115')](db['CmList'],{'as':'List','foreignKey':_0x2085('0x164')});db[_0x2085('0x15a')][_0x2085('0x115')](db[_0x2085('0x89')],{'as':'Template','foreignKey':_0x2085('0x165')});db[_0x2085('0x15a')][_0x2085('0x115')](db[_0x2085('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0x2085('0x14f')});db[_0x2085('0x15a')][_0x2085('0x117')](db[_0x2085('0x13')],{'as':'Agents','through':_0x2085('0x131')});db['MailQueue']['belongsToMany'](db[_0x2085('0x13')],{'as':_0x2085('0x151'),'through':'UserMailQueue'});db[_0x2085('0x166')][_0x2085('0x117')](db['Team'],{'through':_0x2085('0x167'),'as':_0x2085('0x168')});db[_0x2085('0x3e')][_0x2085('0x10b')](db[_0x2085('0x162')],{'as':_0x2085('0x153'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x169')});db[_0x2085('0x3e')]['belongsTo'](db['MailAccount'],{'as':_0x2085('0x16a'),'foreignKey':_0x2085('0x15b')});db['MailInteraction'][_0x2085('0x115')](db[_0x2085('0x118')],{'as':_0x2085('0x159'),'foreignKey':_0x2085('0x16b')});db[_0x2085('0x3e')][_0x2085('0x115')](db[_0x2085('0x13')],{'as':_0x2085('0x16c'),'foreignKey':_0x2085('0x109')});db[_0x2085('0x3e')][_0x2085('0x117')](db[_0x2085('0x88')],{'through':_0x2085('0x16d'),'as':_0x2085('0x16e')});db['MailInteraction']['belongsToMany'](db[_0x2085('0x88')],{'through':'mail_interaction_has_tags','as':_0x2085('0x16f')});db[_0x2085('0x3e')][_0x2085('0x117')](db[_0x2085('0x13')],{'as':_0x2085('0x170'),'through':_0x2085('0x171'),'foreignKey':_0x2085('0x169')});db[_0x2085('0x162')][_0x2085('0x10b')](db[_0x2085('0xdf')],{'as':_0x2085('0x172'),'onDelete':_0x2085('0x108')});db[_0x2085('0x162')][_0x2085('0x115')](db[_0x2085('0x13')],{'as':_0x2085('0x13')});db[_0x2085('0x162')][_0x2085('0x115')](db[_0x2085('0x118')],{'onDelete':_0x2085('0x108'),'as':_0x2085('0x159')});db[_0x2085('0x162')][_0x2085('0x115')](db['MailInteraction'],{'as':_0x2085('0x173'),'foreignKey':_0x2085('0x169')});db['MailMessage'][_0x2085('0x115')](db['MailAccount'],{'as':_0x2085('0x16a'),'foreignKey':_0x2085('0x15b')});db[_0x2085('0x162')][_0x2085('0x115')](db[_0x2085('0x5e')],{'as':_0x2085('0x5e'),'foreignKey':_0x2085('0x174')});db[_0x2085('0x162')][_0x2085('0x115')](db[_0x2085('0x175')],{'as':_0x2085('0x175'),'foreignKey':'ChatOfflineMessageId'});db[_0x2085('0x40')][_0x2085('0x115')](db[_0x2085('0x13')],{'onDelete':_0x2085('0x15d')});db[_0x2085('0x40')][_0x2085('0x115')](db[_0x2085('0x166')],{'onDelete':_0x2085('0x15d')});db[_0x2085('0x40')][_0x2085('0x115')](db[_0x2085('0x15a')],{'onDelete':'restrict'});db['MailApplication'][_0x2085('0x115')](db[_0x2085('0x7f')],{'onDelete':_0x2085('0x15d'),'foreignKey':'IntervalId'});db['MailApplication'][_0x2085('0x115')](db[_0x2085('0x88')],{'onDelete':_0x2085('0x15d'),'foreignKey':'TagId'});db[_0x2085('0x42')][_0x2085('0x115')](db[_0x2085('0x15a')],{});db[_0x2085('0x42')][_0x2085('0x115')](db[_0x2085('0x11b')],{'as':_0x2085('0x176'),'foreignKey':_0x2085('0x164')});db['MailQueueReport'][_0x2085('0x115')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x2085('0x42')][_0x2085('0x115')](db[_0x2085('0x3e')],{});db[_0x2085('0x42')]['belongsTo'](db['MailMessage'],{});db[_0x2085('0x42')][_0x2085('0x115')](db[_0x2085('0x13')],{});db[_0x2085('0x42')][_0x2085('0x115')](db['MailQueue'],{});db['Dashboard'][_0x2085('0x10b')](db[_0x2085('0x177')],{'as':_0x2085('0x178'),'onDelete':_0x2085('0x108')});db[_0x2085('0x12d')][_0x2085('0x10b')](db['Disposition'],{'as':_0x2085('0x161'),'foreignKey':_0x2085('0x179'),'onDelete':_0x2085('0x108')});db[_0x2085('0x12d')][_0x2085('0x10b')](db[_0x2085('0x7a')],{'as':_0x2085('0x17a'),'foreignKey':'FaxAccountId'});db[_0x2085('0x12d')][_0x2085('0x10b')](db['FaxInteraction'],{'as':'Interactions'});db[_0x2085('0x12d')][_0x2085('0x10b')](db[_0x2085('0x17b')],{'as':'Applications'});db['FaxAccount']['hasMany'](db['VoiceExtension'],{'as':_0x2085('0x17c'),'onDelete':_0x2085('0x108')});db[_0x2085('0x12d')][_0x2085('0x10b')](db[_0x2085('0x49')],{'as':_0x2085('0x153')});db[_0x2085('0x12d')]['belongsTo'](db[_0x2085('0x2b')],{'as':_0x2085('0x2b')});db[_0x2085('0x12d')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x2085('0x12d')][_0x2085('0x115')](db[_0x2085('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0x2085('0x14f')});db[_0x2085('0x12d')]['belongsToMany'](db[_0x2085('0x13')],{'as':_0x2085('0x151'),'through':_0x2085('0x12f')});db['FaxApplication'][_0x2085('0x115')](db[_0x2085('0x13')],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db[_0x2085('0x4b')],{'onDelete':_0x2085('0x15d')});db[_0x2085('0x17b')]['belongsTo'](db[_0x2085('0x12d')],{'onDelete':'restrict'});db['FaxApplication'][_0x2085('0x115')](db[_0x2085('0x88')],{'onDelete':_0x2085('0x15d'),'foreignKey':_0x2085('0x17d')});db[_0x2085('0x47')][_0x2085('0x10b')](db[_0x2085('0x49')],{'as':_0x2085('0x153'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x17e')});db[_0x2085('0x47')][_0x2085('0x115')](db['FaxAccount'],{'as':_0x2085('0x16a'),'foreignKey':_0x2085('0x179')});db[_0x2085('0x47')][_0x2085('0x115')](db[_0x2085('0x118')],{'as':_0x2085('0x159'),'foreignKey':_0x2085('0x16b')});db[_0x2085('0x47')][_0x2085('0x115')](db[_0x2085('0x13')],{'as':_0x2085('0x16c'),'foreignKey':'UserId'});db[_0x2085('0x47')]['belongsToMany'](db[_0x2085('0x88')],{'through':_0x2085('0x17f'),'as':'Tags'});db[_0x2085('0x47')]['belongsToMany'](db['Tag'],{'through':_0x2085('0x17f'),'as':_0x2085('0x16f')});db[_0x2085('0x47')]['belongsToMany'](db[_0x2085('0x13')],{'as':_0x2085('0x170'),'through':_0x2085('0x180'),'foreignKey':_0x2085('0x17e')});db['FaxMessage']['belongsTo'](db[_0x2085('0x13')],{'onDelete':'cascade','as':_0x2085('0x13')});db[_0x2085('0x49')]['belongsTo'](db[_0x2085('0x47')],{'as':'Interaction','foreignKey':_0x2085('0x17e')});db[_0x2085('0x49')][_0x2085('0x115')](db[_0x2085('0x118')],{'onDelete':_0x2085('0x108'),'as':_0x2085('0x159')});db['FaxMessage'][_0x2085('0x115')](db[_0x2085('0xdf')],{'as':_0x2085('0xdf'),'foreignKey':_0x2085('0x181')});db[_0x2085('0x49')][_0x2085('0x115')](db[_0x2085('0x12d')],{'as':'Account','foreignKey':_0x2085('0x179')});db[_0x2085('0x4b')]['belongsToMany'](db[_0x2085('0x13')],{'as':_0x2085('0x151'),'through':_0x2085('0x32')});db[_0x2085('0x4b')][_0x2085('0x117')](db['Team'],{'through':_0x2085('0x182'),'as':_0x2085('0x168')});db[_0x2085('0x183')][_0x2085('0x115')](db[_0x2085('0x12d')],{});db[_0x2085('0x183')]['belongsTo'](db[_0x2085('0x11b')],{'as':'List','foreignKey':'ListId'});db[_0x2085('0x183')]['belongsTo'](db[_0x2085('0x118')],{'as':'Contact','foreignKey':_0x2085('0x16b')});db[_0x2085('0x183')][_0x2085('0x115')](db[_0x2085('0x47')],{});db['FaxQueueReport'][_0x2085('0x115')](db['FaxMessage'],{});db[_0x2085('0x183')]['belongsTo'](db[_0x2085('0x13')],{});db[_0x2085('0x183')]['belongsTo'](db['FaxQueue'],{});db[_0x2085('0x134')][_0x2085('0x10b')](db[_0x2085('0x160')],{'as':'Dispositions','foreignKey':_0x2085('0x184'),'onDelete':_0x2085('0x108')});db[_0x2085('0x134')][_0x2085('0x10b')](db[_0x2085('0x7a')],{'as':_0x2085('0x17a'),'foreignKey':_0x2085('0x184')});db[_0x2085('0x134')][_0x2085('0x10b')](db[_0x2085('0x185')],{'as':_0x2085('0x153'),'foreignKey':_0x2085('0x184')});db[_0x2085('0x134')]['hasMany'](db['SmsInteraction'],{'as':_0x2085('0x163')});db[_0x2085('0x134')][_0x2085('0x10b')](db['SmsApplication'],{'as':_0x2085('0x13f')});db[_0x2085('0x134')][_0x2085('0x115')](db['CmList'],{'as':'List','foreignKey':_0x2085('0x164')});db['SmsAccount'][_0x2085('0x115')](db[_0x2085('0x80')],{'as':_0x2085('0x14e'),'foreignKey':_0x2085('0x14f')});db[_0x2085('0x134')][_0x2085('0x117')](db[_0x2085('0x13')],{'as':'Agents','through':_0x2085('0x186')});db[_0x2085('0x4f')][_0x2085('0x115')](db['User'],{'onDelete':_0x2085('0x15d')});db[_0x2085('0x4f')][_0x2085('0x115')](db['SmsQueue'],{'onDelete':_0x2085('0x15d')});db[_0x2085('0x4f')][_0x2085('0x115')](db[_0x2085('0x134')],{'onDelete':_0x2085('0x15d')});db['SmsApplication'][_0x2085('0x115')](db[_0x2085('0x7f')],{'onDelete':_0x2085('0x15d'),'foreignKey':_0x2085('0x14d')});db['SmsApplication'][_0x2085('0x115')](db[_0x2085('0x88')],{'onDelete':'restrict','foreignKey':_0x2085('0x17d')});db[_0x2085('0x51')][_0x2085('0x10b')](db['SmsMessage'],{'as':_0x2085('0x153'),'onDelete':_0x2085('0x108'),'foreignKey':'SmsInteractionId'});db[_0x2085('0x51')][_0x2085('0x115')](db[_0x2085('0x134')],{'as':_0x2085('0x16a'),'foreignKey':'SmsAccountId'});db[_0x2085('0x51')][_0x2085('0x115')](db[_0x2085('0x118')],{'as':_0x2085('0x159'),'foreignKey':'ContactId'});db[_0x2085('0x51')][_0x2085('0x115')](db[_0x2085('0x13')],{'as':_0x2085('0x16c'),'foreignKey':_0x2085('0x109')});db[_0x2085('0x51')][_0x2085('0x117')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x2085('0x16e')});db[_0x2085('0x51')][_0x2085('0x117')](db['Tag'],{'through':_0x2085('0x187'),'as':_0x2085('0x16f')});db[_0x2085('0x51')][_0x2085('0x117')](db[_0x2085('0x13')],{'as':_0x2085('0x170'),'through':'user_has_sms_interactions','foreignKey':_0x2085('0x188')});db[_0x2085('0x185')][_0x2085('0x115')](db[_0x2085('0x13')],{'as':_0x2085('0x13')});db[_0x2085('0x185')][_0x2085('0x115')](db['CmContact'],{'onDelete':_0x2085('0x108'),'as':_0x2085('0x159')});db[_0x2085('0x185')]['belongsTo'](db[_0x2085('0x51')],{'onDelete':_0x2085('0x108'),'as':_0x2085('0x173'),'foreignKey':'SmsInteractionId'});db[_0x2085('0x185')]['belongsTo'](db[_0x2085('0x134')],{'as':'Account','foreignKey':_0x2085('0x184')});db[_0x2085('0x54')]['belongsToMany'](db[_0x2085('0x13')],{'as':'Agents','through':_0x2085('0x33'),'foreignKey':_0x2085('0x189')});db[_0x2085('0x54')][_0x2085('0x117')](db[_0x2085('0xd9')],{'through':_0x2085('0x18a'),'as':_0x2085('0x168')});db[_0x2085('0x56')][_0x2085('0x10b')](db[_0x2085('0x160')],{'as':'Dispositions','foreignKey':_0x2085('0x18b'),'onDelete':'cascade'});db['OpenchannelAccount']['hasMany'](db[_0x2085('0x7a')],{'as':_0x2085('0x17a'),'foreignKey':_0x2085('0x18b')});db[_0x2085('0x56')]['hasMany'](db[_0x2085('0x122')],{'as':_0x2085('0x163'),'foreignKey':_0x2085('0x18b')});db[_0x2085('0x56')]['hasMany'](db[_0x2085('0x5a')],{'as':_0x2085('0x153'),'foreignKey':_0x2085('0x18b')});db['OpenchannelAccount'][_0x2085('0x10b')](db[_0x2085('0x18c')],{'as':_0x2085('0x13f'),'foreignKey':_0x2085('0x18b')});db[_0x2085('0x56')][_0x2085('0x115')](db['CmList'],{'as':_0x2085('0x176'),'foreignKey':_0x2085('0x164')});db[_0x2085('0x56')][_0x2085('0x115')](db[_0x2085('0x80')],{'as':_0x2085('0x14e'),'foreignKey':_0x2085('0x14f')});db[_0x2085('0x56')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x2085('0x18c')][_0x2085('0x115')](db[_0x2085('0x13')],{'onDelete':_0x2085('0x15d')});db[_0x2085('0x18c')]['belongsTo'](db[_0x2085('0x5c')],{'onDelete':_0x2085('0x15d'),'foreignKey':'OpenchannelQueueId'});db[_0x2085('0x18c')][_0x2085('0x115')](db['OpenchannelAccount'],{'onDelete':_0x2085('0x15d'),'foreignKey':_0x2085('0x18b')});db[_0x2085('0x18c')][_0x2085('0x115')](db[_0x2085('0x7f')],{'onDelete':_0x2085('0x15d'),'foreignKey':_0x2085('0x14d')});db[_0x2085('0x18c')]['belongsTo'](db['Tag'],{'onDelete':_0x2085('0x15d'),'foreignKey':_0x2085('0x17d')});db['OpenchannelInteraction']['hasMany'](db['OpenchannelMessage'],{'as':_0x2085('0x153'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x18d')});db[_0x2085('0x122')]['belongsTo'](db[_0x2085('0x56')],{'as':'Account','foreignKey':_0x2085('0x18b')});db['OpenchannelInteraction'][_0x2085('0x115')](db[_0x2085('0x118')],{'as':_0x2085('0x159'),'foreignKey':_0x2085('0x16b')});db[_0x2085('0x122')][_0x2085('0x115')](db['User'],{'as':_0x2085('0x16c'),'foreignKey':_0x2085('0x109')});db[_0x2085('0x122')][_0x2085('0x117')](db[_0x2085('0x88')],{'through':'openchannel_interaction_has_tags','as':_0x2085('0x16e')});db['OpenchannelInteraction'][_0x2085('0x117')](db[_0x2085('0x88')],{'through':_0x2085('0x18e'),'as':_0x2085('0x16f')});db[_0x2085('0x122')][_0x2085('0x117')](db[_0x2085('0x13')],{'as':_0x2085('0x170'),'through':'user_has_openchannel_interactions','foreignKey':_0x2085('0x18d')});db[_0x2085('0x5a')]['belongsTo'](db[_0x2085('0x13')],{'onDelete':_0x2085('0x108'),'as':_0x2085('0x13')});db[_0x2085('0x5a')][_0x2085('0x115')](db['CmContact'],{'onDelete':_0x2085('0x108'),'as':_0x2085('0x159')});db[_0x2085('0x5a')][_0x2085('0x115')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x2085('0x173'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x2085('0x115')](db[_0x2085('0xdf')],{'as':_0x2085('0xdf'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x2085('0x115')](db[_0x2085('0x56')],{'as':_0x2085('0x16a'),'foreignKey':_0x2085('0x18b')});db[_0x2085('0x5c')][_0x2085('0x117')](db[_0x2085('0x13')],{'as':'Agents','through':_0x2085('0x35'),'foreignKey':_0x2085('0x18f')});db['OpenchannelQueue'][_0x2085('0x117')](db[_0x2085('0xd9')],{'through':_0x2085('0x190'),'as':_0x2085('0x168')});db[_0x2085('0x5e')][_0x2085('0x10b')](db[_0x2085('0x160')],{'as':'Dispositions','foreignKey':_0x2085('0x174'),'onDelete':_0x2085('0x108')});db[_0x2085('0x5e')][_0x2085('0x10b')](db['CannedAnswer'],{'as':_0x2085('0x17a'),'foreignKey':_0x2085('0x174')});db['ChatWebsite']['hasMany'](db[_0x2085('0x69')],{'as':_0x2085('0x191')});db['ChatWebsite']['hasMany'](db[_0x2085('0x63')],{'as':'Interactions'});db[_0x2085('0x5e')][_0x2085('0x10b')](db[_0x2085('0x192')],{'as':_0x2085('0x13f')});db[_0x2085('0x5e')]['hasMany'](db[_0x2085('0x65')],{'as':_0x2085('0x153')});db['ChatWebsite']['belongsTo'](db['CmList'],{'as':_0x2085('0x176'),'foreignKey':_0x2085('0x164')});db['ChatWebsite'][_0x2085('0x115')](db[_0x2085('0x7f')],{'as':_0x2085('0x7f'),'foreignKey':_0x2085('0x14d')});db[_0x2085('0x5e')][_0x2085('0x115')](db[_0x2085('0x15a')],{'as':_0x2085('0x15a'),'foreignKey':_0x2085('0x15b')});db[_0x2085('0x5e')][_0x2085('0x115')](db[_0x2085('0x80')],{'as':_0x2085('0x14e'),'foreignKey':_0x2085('0x14f')});db[_0x2085('0x5e')][_0x2085('0x117')](db[_0x2085('0x13')],{'as':_0x2085('0x151'),'through':_0x2085('0x193')});db[_0x2085('0x60')]['belongsTo'](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0x2085('0x115')](db[_0x2085('0x11b')],{'as':_0x2085('0x176'),'foreignKey':_0x2085('0x164')});db['OpenchannelQueueReport'][_0x2085('0x115')](db[_0x2085('0x118')],{'as':_0x2085('0x159'),'foreignKey':_0x2085('0x16b')});db[_0x2085('0x60')][_0x2085('0x115')](db[_0x2085('0x122')],{});db[_0x2085('0x60')][_0x2085('0x115')](db['OpenchannelMessage'],{});db[_0x2085('0x60')]['belongsTo'](db['User'],{});db[_0x2085('0x60')][_0x2085('0x115')](db['OpenchannelQueue'],{});db['ChatApplication'][_0x2085('0x115')](db[_0x2085('0x13')],{'as':_0x2085('0x194'),'foreignKey':_0x2085('0x109'),'onDelete':_0x2085('0x15d')});db['ChatApplication'][_0x2085('0x115')](db[_0x2085('0x67')],{'as':_0x2085('0x195'),'foreignKey':_0x2085('0x196'),'onDelete':'restrict'});db[_0x2085('0x192')]['belongsTo'](db[_0x2085('0x5e')],{'as':_0x2085('0x197'),'foreignKey':_0x2085('0x174'),'onDelete':_0x2085('0x15d')});db[_0x2085('0x192')][_0x2085('0x115')](db[_0x2085('0x88')],{'onDelete':_0x2085('0x15d'),'foreignKey':_0x2085('0x17d')});db[_0x2085('0x63')][_0x2085('0x10b')](db[_0x2085('0x65')],{'as':_0x2085('0x153'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x198')});db[_0x2085('0x63')][_0x2085('0x115')](db[_0x2085('0x5e')],{'as':_0x2085('0x16a'),'foreignKey':_0x2085('0x174')});db['ChatInteraction'][_0x2085('0x115')](db[_0x2085('0x118')],{'as':_0x2085('0x159'),'foreignKey':_0x2085('0x16b')});db[_0x2085('0x63')][_0x2085('0x115')](db[_0x2085('0x13')],{'as':_0x2085('0x16c'),'foreignKey':_0x2085('0x109')});db[_0x2085('0x63')][_0x2085('0x117')](db[_0x2085('0x88')],{'through':_0x2085('0x199'),'as':'Tags'});db[_0x2085('0x63')][_0x2085('0x117')](db[_0x2085('0x88')],{'through':'chat_interaction_has_tags','as':_0x2085('0x16f')});db[_0x2085('0x63')][_0x2085('0x117')](db['User'],{'as':_0x2085('0x170'),'through':'user_has_chat_interactions','foreignKey':_0x2085('0x198')});db[_0x2085('0x65')][_0x2085('0x115')](db[_0x2085('0x13')],{'onDelete':'cascade','as':_0x2085('0x13')});db['ChatMessage'][_0x2085('0x115')](db[_0x2085('0x118')],{'onDelete':_0x2085('0x108'),'as':_0x2085('0x159'),'foreignKey':'ContactId'});db['ChatMessage']['belongsTo'](db[_0x2085('0x63')],{'onDelete':_0x2085('0x108'),'as':_0x2085('0x173'),'foreignKey':'ChatInteractionId'});db[_0x2085('0x65')]['belongsTo'](db[_0x2085('0xdf')],{'as':_0x2085('0xdf'),'foreignKey':_0x2085('0x181')});db[_0x2085('0x65')][_0x2085('0x115')](db[_0x2085('0x5e')],{'as':_0x2085('0x16a'),'foreignKey':_0x2085('0x174')});db[_0x2085('0x175')][_0x2085('0x10b')](db[_0x2085('0xdf')],{'as':_0x2085('0x172'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x2085('0x108'),'hooks':!![]});db['ChatOfflineMessage'][_0x2085('0x115')](db['CmContact'],{'onDelete':_0x2085('0x108'),'as':_0x2085('0x159'),'foreignKey':_0x2085('0x16b')});db[_0x2085('0x175')][_0x2085('0x115')](db[_0x2085('0x5e')],{'as':_0x2085('0x16a'),'foreignKey':_0x2085('0x174')});db[_0x2085('0x67')][_0x2085('0x117')](db[_0x2085('0x13')],{'as':_0x2085('0x151'),'through':'UserChatQueue','hooks':!![]});db[_0x2085('0x67')][_0x2085('0x117')](db[_0x2085('0xd9')],{'through':_0x2085('0x19a'),'as':_0x2085('0x168')});db[_0x2085('0x68')]['hasMany'](db[_0x2085('0xc6')],{'as':_0x2085('0x153'),'foreignKey':_0x2085('0x19b'),'onDelete':_0x2085('0x108')});db[_0x2085('0x68')]['belongsToMany'](db[_0x2085('0x13')],{'as':_0x2085('0x143'),'through':'chat_group_has_users'});db[_0x2085('0x69')][_0x2085('0x115')](db['ChatWebsite'],{'as':_0x2085('0x197'),'foreignKey':_0x2085('0x174')});db[_0x2085('0x6b')]['hasMany'](db[_0x2085('0x118')],{'as':_0x2085('0x119'),'foreignKey':_0x2085('0x19c')});db['CmContact'][_0x2085('0x10b')](db[_0x2085('0x19d')],{'as':_0x2085('0x145'),'foreignKey':_0x2085('0x16b')});db[_0x2085('0x118')][_0x2085('0x10b')](db[_0x2085('0x71')],{'as':_0x2085('0x146'),'foreignKey':'ContactId'});db[_0x2085('0x118')][_0x2085('0x10b')](db[_0x2085('0x10e')],{'as':'HopperHistories','foreignKey':_0x2085('0x16b')});db['CmContact']['hasMany'](db[_0x2085('0x73')],{'as':_0x2085('0x73'),'foreignKey':'ContactId'});db[_0x2085('0x118')][_0x2085('0x10b')](db[_0x2085('0xcb')],{'as':_0x2085('0x149'),'foreignKey':_0x2085('0x16b')});db[_0x2085('0x118')]['hasMany'](db[_0x2085('0x122')],{'as':'OpenchannelInteractions','foreignKey':_0x2085('0x16b'),'onDelete':_0x2085('0x15d')});db[_0x2085('0x118')]['hasMany'](db[_0x2085('0x63')],{'as':_0x2085('0x110'),'foreignKey':_0x2085('0x16b'),'onDelete':_0x2085('0x15d')});db['CmContact'][_0x2085('0x10b')](db['SmsInteraction'],{'as':_0x2085('0x111'),'foreignKey':'ContactId','onDelete':_0x2085('0x15d')});db[_0x2085('0x118')][_0x2085('0x10b')](db[_0x2085('0x47')],{'as':_0x2085('0x120'),'foreignKey':_0x2085('0x16b'),'onDelete':_0x2085('0x15d')});db[_0x2085('0x118')]['hasMany'](db['MailInteraction'],{'as':_0x2085('0x11e'),'foreignKey':_0x2085('0x16b'),'onDelete':_0x2085('0x15d')});db[_0x2085('0x118')][_0x2085('0x115')](db[_0x2085('0x6b')],{'as':_0x2085('0x19e'),'foreignKey':_0x2085('0x19c')});db[_0x2085('0x118')]['belongsTo'](db[_0x2085('0x11b')],{'as':_0x2085('0x176'),'foreignKey':_0x2085('0x164'),'onDelete':_0x2085('0x108')});db[_0x2085('0x118')][_0x2085('0x117')](db['User'],{'as':_0x2085('0x170'),'through':_0x2085('0x11a')});db[_0x2085('0x118')][_0x2085('0x117')](db[_0x2085('0x88')],{'as':_0x2085('0x16e'),'through':_0x2085('0x19f')});db[_0x2085('0x118')][_0x2085('0x117')](db[_0x2085('0x88')],{'through':_0x2085('0x19f'),'as':_0x2085('0x16f')});db['CmHopper'][_0x2085('0x115')](db[_0x2085('0x118')],{'as':_0x2085('0x159'),'foreignKey':_0x2085('0x16b'),'onDelete':_0x2085('0x108')});db[_0x2085('0x19d')]['belongsTo'](db[_0x2085('0x11b')],{'as':_0x2085('0x176'),'foreignKey':_0x2085('0x164'),'onDelete':_0x2085('0x108')});db[_0x2085('0x19d')][_0x2085('0x115')](db[_0x2085('0x13')],{'as':'Agent','foreignKey':_0x2085('0x109')});db['CmHopper'][_0x2085('0x115')](db[_0x2085('0x1b')],{'as':_0x2085('0x195'),'foreignKey':_0x2085('0x144'),'onDelete':_0x2085('0x108')});db[_0x2085('0x19d')]['belongsTo'](db[_0x2085('0x1a0')],{'as':'Campaign','foreignKey':_0x2085('0x1a1'),'onDelete':_0x2085('0x108')});db[_0x2085('0x19d')][_0x2085('0x115')](db[_0x2085('0x13')],{'as':_0x2085('0x16c'),'foreignKey':_0x2085('0x1a2')});db['CmHopperBlack'][_0x2085('0x115')](db[_0x2085('0x118')],{'as':_0x2085('0x159'),'foreignKey':_0x2085('0x16b'),'onDelete':'cascade'});db[_0x2085('0x6f')][_0x2085('0x115')](db[_0x2085('0x11b')],{'as':_0x2085('0x176'),'foreignKey':_0x2085('0x164'),'onDelete':'cascade'});db[_0x2085('0x6f')][_0x2085('0x115')](db['VoiceQueue'],{'as':_0x2085('0x195'),'foreignKey':_0x2085('0x144'),'onDelete':_0x2085('0x108')});db[_0x2085('0x6f')][_0x2085('0x115')](db[_0x2085('0x1a0')],{'as':_0x2085('0x1a0'),'foreignKey':'CampaignId','onDelete':'cascade'});db['Automation'][_0x2085('0x10b')](db[_0x2085('0x7d')],{'as':{'plural':_0x2085('0x1a3'),'singular':_0x2085('0x1a4')},'foreignKey':_0x2085('0x1a5'),'onDelete':'cascade','hooks':!![]});db[_0x2085('0x78')]['hasMany'](db[_0x2085('0x7d')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0x2085('0x1a6'),'onDelete':_0x2085('0x108'),'hooks':!![]});db[_0x2085('0x78')][_0x2085('0x10b')](db[_0x2085('0x76')],{'as':_0x2085('0x1a7'),'foreignKey':_0x2085('0x1a8'),'onDelete':'cascade','hooks':!![]});db[_0x2085('0x160')][_0x2085('0x10b')](db['Disposition'],{'as':_0x2085('0x161'),'foreignKey':_0x2085('0x1a9'),'onDelete':_0x2085('0x108')});db[_0x2085('0x7f')][_0x2085('0x10b')](db[_0x2085('0x7f')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0x2085('0x108'),'hooks':!![],'required':![]});db[_0x2085('0x7f')][_0x2085('0x10b')](db[_0x2085('0x17')],{'as':_0x2085('0x10d'),'foreignKey':_0x2085('0x14d'),'onDelete':_0x2085('0x15d')});db[_0x2085('0x7f')][_0x2085('0x10b')](db[_0x2085('0x40')],{'as':_0x2085('0x1aa'),'foreignKey':_0x2085('0x14d')});db[_0x2085('0x7f')][_0x2085('0x10b')](db[_0x2085('0x192')],{'as':_0x2085('0x1ab'),'foreignKey':'IntervalId'});db[_0x2085('0x7f')][_0x2085('0x10b')](db[_0x2085('0x17b')],{'as':'FaxApplications','foreignKey':_0x2085('0x14d')});db[_0x2085('0x7f')][_0x2085('0x10b')](db[_0x2085('0x4f')],{'as':_0x2085('0x1ac'),'foreignKey':_0x2085('0x14d')});db[_0x2085('0x84')][_0x2085('0x115')](db['MailAccount'],{});db['Schedule']['belongsTo'](db[_0x2085('0x1ad')],{'foreignKey':'DefaultReportId'});db[_0x2085('0x84')]['belongsTo'](db[_0x2085('0x8f')],{'foreignKey':_0x2085('0x1ae')});db['Sound'][_0x2085('0x117')](db[_0x2085('0x19')],{'as':'Mohs','through':_0x2085('0x141'),'onDelete':'restrict'});db[_0x2085('0x88')][_0x2085('0x117')](db[_0x2085('0x118')],{'through':'cm_contact_has_tags'});db['Tag'][_0x2085('0x117')](db[_0x2085('0x63')],{'through':'chat_interaction_has_tags'});db[_0x2085('0x88')][_0x2085('0x117')](db[_0x2085('0x3e')],{'through':_0x2085('0x16d')});db[_0x2085('0x88')][_0x2085('0x117')](db[_0x2085('0x51')],{'through':'sms_interaction_has_tags'});db['Tag'][_0x2085('0x117')](db[_0x2085('0x47')],{'through':'fax_interaction_has_tags'});db['Tag'][_0x2085('0x117')](db[_0x2085('0x122')],{'through':_0x2085('0x18e')});db['Tag'][_0x2085('0x117')](db['WhatsappInteraction'],{'through':_0x2085('0x1af')});db[_0x2085('0x1b0')][_0x2085('0x10b')](db[_0x2085('0x7d')],{'as':{'plural':_0x2085('0x1b1'),'singular':_0x2085('0x1b2')},'foreignKey':'TriggerAllId','onDelete':_0x2085('0x108'),'hooks':!![]});db[_0x2085('0x1b0')][_0x2085('0x10b')](db[_0x2085('0x7d')],{'as':{'plural':_0x2085('0x1b3'),'singular':_0x2085('0x1b4')},'foreignKey':'TriggerAnyId','onDelete':_0x2085('0x108'),'hooks':!![]});db['Trigger'][_0x2085('0x10b')](db[_0x2085('0x76')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0x2085('0x108'),'hooks':!![]});db[_0x2085('0x8f')][_0x2085('0x10b')](db['AnalyticFieldReport'],{'as':_0x2085('0x1b5'),'onDelete':_0x2085('0x108'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x2085('0x1ad')][_0x2085('0x10b')](db[_0x2085('0x95')],{'as':_0x2085('0x1b5'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1b6')});db[_0x2085('0x93')][_0x2085('0x10b')](db[_0x2085('0x95')],{'as':_0x2085('0x1b5'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1b7')});db[_0x2085('0x95')]['belongsTo'](db[_0x2085('0x93')],{'foreignKey':_0x2085('0x1b7')});db[_0x2085('0x99')][_0x2085('0x10b')](db[_0x2085('0x9b')],{'as':_0x2085('0x1b8'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1b9')});db[_0x2085('0x9b')]['hasMany'](db[_0x2085('0x9c')],{'as':_0x2085('0x1ba'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1bb')});db[_0x2085('0x9b')]['hasMany'](db[_0x2085('0x9c')],{'as':'Descriptions','onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1bc')});db['SalesforceConfiguration'][_0x2085('0x10b')](db[_0x2085('0x9c')],{'as':_0x2085('0x1b5'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1bd')});db[_0x2085('0x9b')][_0x2085('0x115')](db[_0x2085('0x99')],{'as':_0x2085('0x16a'),'foreignKey':_0x2085('0x1b9')});db['SalesforceField']['hasMany'](db[_0x2085('0x9c')],{'as':'Subject','foreignKey':_0x2085('0x1bb')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':'Description','foreignKey':_0x2085('0x1bc')});db['SalesforceField']['hasMany'](db[_0x2085('0x9c')],{'as':_0x2085('0x1be'),'foreignKey':_0x2085('0x1bd')});db[_0x2085('0x9c')]['belongsTo'](db[_0x2085('0x8c')],{'as':_0x2085('0x8c'),'foreignKey':'VariableId'});db[_0x2085('0x9d')][_0x2085('0x10b')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x2085('0x1b9')});db[_0x2085('0x1bf')][_0x2085('0x10b')](db[_0x2085('0x9f')],{'as':_0x2085('0x1ba'),'onDelete':'cascade','foreignKey':_0x2085('0x1bb')});db[_0x2085('0x1bf')][_0x2085('0x10b')](db[_0x2085('0x9f')],{'as':'Descriptions','onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1bc')});db[_0x2085('0x1bf')][_0x2085('0x10b')](db[_0x2085('0x9f')],{'as':_0x2085('0x1b5'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1bd')});db[_0x2085('0x1bf')][_0x2085('0x115')](db[_0x2085('0x9d')],{'as':_0x2085('0x16a'),'foreignKey':_0x2085('0x1b9')});db[_0x2085('0x9f')][_0x2085('0x10b')](db[_0x2085('0x9f')],{'as':_0x2085('0x1c0'),'foreignKey':_0x2085('0x1bb')});db[_0x2085('0x9f')][_0x2085('0x10b')](db[_0x2085('0x9f')],{'as':_0x2085('0x1c1'),'foreignKey':'DescriptionId'});db[_0x2085('0x9f')][_0x2085('0x10b')](db[_0x2085('0x9f')],{'as':_0x2085('0x1be'),'foreignKey':_0x2085('0x1bd')});db[_0x2085('0x9f')][_0x2085('0x115')](db['Variable'],{'as':'Variable','foreignKey':_0x2085('0x1c2')});db[_0x2085('0xa0')][_0x2085('0x10b')](db[_0x2085('0x1c3')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x2085('0x1c3')][_0x2085('0x10b')](db[_0x2085('0x1c4')],{'as':_0x2085('0x1ba'),'onDelete':_0x2085('0x108'),'foreignKey':'SubjectId'});db[_0x2085('0x1c3')][_0x2085('0x10b')](db[_0x2085('0x1c4')],{'as':'Descriptions','onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1bc')});db[_0x2085('0x1c3')]['hasMany'](db['DeskField'],{'as':_0x2085('0x1b5'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1bd')});db[_0x2085('0x1c3')]['belongsTo'](db[_0x2085('0xa0')],{'as':'Account','foreignKey':_0x2085('0x1b9')});db[_0x2085('0x1c3')][_0x2085('0x117')](db['Tag'],{'through':_0x2085('0x1c5')});db[_0x2085('0x1c4')][_0x2085('0x10b')](db[_0x2085('0x1c4')],{'as':_0x2085('0x1c0'),'foreignKey':_0x2085('0x1bb')});db['DeskField']['hasMany'](db[_0x2085('0x1c4')],{'as':_0x2085('0x1c1'),'foreignKey':_0x2085('0x1bc')});db[_0x2085('0x1c4')][_0x2085('0x10b')](db['DeskField'],{'as':_0x2085('0x1be'),'foreignKey':_0x2085('0x1bd')});db[_0x2085('0x1c4')][_0x2085('0x115')](db[_0x2085('0x8c')],{'as':_0x2085('0x8c'),'foreignKey':_0x2085('0x1c2')});db[_0x2085('0xa4')][_0x2085('0x10b')](db[_0x2085('0x1c6')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x2085('0x1b9')});db[_0x2085('0x1c6')]['hasMany'](db[_0x2085('0xa7')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x2085('0x1bb')});db[_0x2085('0x1c6')][_0x2085('0x10b')](db[_0x2085('0xa7')],{'as':_0x2085('0x1c7'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1bc')});db['ZohoConfiguration']['hasMany'](db['ZohoField'],{'as':_0x2085('0x1b5'),'onDelete':'cascade','foreignKey':_0x2085('0x1bd')});db[_0x2085('0x1c6')][_0x2085('0x115')](db['ZohoAccount'],{'as':_0x2085('0x16a'),'foreignKey':_0x2085('0x1b9')});db[_0x2085('0xa7')][_0x2085('0x10b')](db[_0x2085('0xa7')],{'as':_0x2085('0x1c0'),'foreignKey':_0x2085('0x1bb')});db[_0x2085('0xa7')]['hasMany'](db[_0x2085('0xa7')],{'as':'Description','foreignKey':_0x2085('0x1bc')});db['ZohoField'][_0x2085('0x10b')](db[_0x2085('0xa7')],{'as':'Field','foreignKey':'FieldId'});db[_0x2085('0xa7')][_0x2085('0x115')](db[_0x2085('0x8c')],{'as':'Variable','foreignKey':_0x2085('0x1c2')});db[_0x2085('0xa9')][_0x2085('0x10b')](db[_0x2085('0x1c8')],{'as':'Configurations','onDelete':_0x2085('0x108'),'foreignKey':'AccountId'});db[_0x2085('0x1c8')][_0x2085('0x10b')](db[_0x2085('0xac')],{'as':'Subjects','foreignKey':_0x2085('0x1bb')});db[_0x2085('0x1c8')]['hasMany'](db[_0x2085('0xac')],{'as':_0x2085('0x1c7'),'foreignKey':_0x2085('0x1bc')});db['ZendeskConfiguration']['hasMany'](db[_0x2085('0xac')],{'as':'Fields','foreignKey':_0x2085('0x1bd')});db[_0x2085('0x1c8')][_0x2085('0x115')](db['ZendeskAccount'],{'as':_0x2085('0x16a'),'foreignKey':'AccountId'});db[_0x2085('0x1c8')][_0x2085('0x117')](db[_0x2085('0x88')],{'through':_0x2085('0x1c9')});db[_0x2085('0xac')][_0x2085('0x10b')](db[_0x2085('0xac')],{'as':_0x2085('0x1c0'),'foreignKey':_0x2085('0x1bb')});db[_0x2085('0xac')][_0x2085('0x10b')](db[_0x2085('0xac')],{'as':_0x2085('0x1c1'),'foreignKey':_0x2085('0x1bc')});db[_0x2085('0xac')][_0x2085('0x10b')](db[_0x2085('0xac')],{'as':_0x2085('0x1be'),'foreignKey':'FieldId'});db[_0x2085('0xac')]['belongsTo'](db[_0x2085('0x8c')],{'as':_0x2085('0x8c'),'foreignKey':_0x2085('0x1c2')});db[_0x2085('0x1ca')][_0x2085('0x10b')](db[_0x2085('0x1cb')],{'as':_0x2085('0x1b8'),'onDelete':_0x2085('0x108'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x2085('0x10b')](db['FreshdeskField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x2085('0x1bb')});db['FreshdeskConfiguration'][_0x2085('0x10b')](db['FreshdeskField'],{'as':_0x2085('0x1c7'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1bc')});db[_0x2085('0x1cb')][_0x2085('0x10b')](db[_0x2085('0x1cc')],{'as':_0x2085('0x1b5'),'onDelete':'cascade','foreignKey':_0x2085('0x1bd')});db[_0x2085('0x1cb')]['belongsTo'](db[_0x2085('0x1ca')],{'as':_0x2085('0x16a'),'foreignKey':'AccountId'});db[_0x2085('0x1cb')]['belongsToMany'](db[_0x2085('0x88')],{'through':_0x2085('0x1cd')});db['FreshdeskField'][_0x2085('0x10b')](db['FreshdeskField'],{'as':_0x2085('0x1c0'),'foreignKey':_0x2085('0x1bb')});db[_0x2085('0x1cc')][_0x2085('0x10b')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x2085('0x1cc')]['hasMany'](db[_0x2085('0x1cc')],{'as':'Field','foreignKey':'FieldId'});db[_0x2085('0x1cc')][_0x2085('0x115')](db[_0x2085('0x8c')],{'as':_0x2085('0x8c'),'foreignKey':'VariableId'});db[_0x2085('0x1ce')]['hasMany'](db['VtigerConfiguration'],{'as':_0x2085('0x1b8'),'onDelete':_0x2085('0x108'),'foreignKey':'AccountId'});db[_0x2085('0xb0')][_0x2085('0x10b')](db[_0x2085('0xb2')],{'as':_0x2085('0x1ba'),'foreignKey':_0x2085('0x1bb')});db[_0x2085('0xb0')]['hasMany'](db[_0x2085('0xb2')],{'as':'Descriptions','foreignKey':_0x2085('0x1bc')});db[_0x2085('0xb0')][_0x2085('0x10b')](db[_0x2085('0xb2')],{'as':'Fields','foreignKey':_0x2085('0x1bd')});db[_0x2085('0xb0')]['belongsTo'](db['VtigerAccount'],{'as':_0x2085('0x16a'),'foreignKey':_0x2085('0x1b9')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Subject','foreignKey':_0x2085('0x1bb')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':_0x2085('0x1c1'),'foreignKey':_0x2085('0x1bc')});db[_0x2085('0xb2')]['hasMany'](db[_0x2085('0xb2')],{'as':_0x2085('0x1be'),'foreignKey':_0x2085('0x1bd')});db[_0x2085('0xb2')][_0x2085('0x115')](db['Variable'],{'as':_0x2085('0x8c'),'foreignKey':_0x2085('0x1c2')});db[_0x2085('0xb4')][_0x2085('0x10b')](db['ServicenowConfiguration'],{'as':_0x2085('0x1b8'),'onDelete':'cascade','foreignKey':_0x2085('0x1b9')});db[_0x2085('0xb5')][_0x2085('0x10b')](db[_0x2085('0xb6')],{'as':_0x2085('0x1ba'),'foreignKey':_0x2085('0x1bb')});db['ServicenowConfiguration'][_0x2085('0x10b')](db[_0x2085('0xb6')],{'as':_0x2085('0x1c7'),'foreignKey':_0x2085('0x1bc')});db[_0x2085('0xb5')]['hasMany'](db[_0x2085('0xb6')],{'as':_0x2085('0x1b5'),'foreignKey':_0x2085('0x1bd')});db[_0x2085('0xb5')][_0x2085('0x115')](db[_0x2085('0xb4')],{'as':_0x2085('0x16a'),'foreignKey':'AccountId'});db[_0x2085('0xb6')][_0x2085('0x10b')](db['ServicenowField'],{'as':_0x2085('0x1c0'),'foreignKey':_0x2085('0x1bb')});db[_0x2085('0xb6')][_0x2085('0x10b')](db['ServicenowField'],{'as':_0x2085('0x1c1'),'foreignKey':_0x2085('0x1bc')});db[_0x2085('0xb6')][_0x2085('0x10b')](db['ServicenowField'],{'as':_0x2085('0x1be'),'foreignKey':_0x2085('0x1bd')});db['ServicenowField'][_0x2085('0x115')](db['Variable'],{'as':_0x2085('0x8c'),'foreignKey':_0x2085('0x1c2')});db[_0x2085('0xb7')][_0x2085('0x10b')](db[_0x2085('0xb9')],{'as':'Configurations','onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1b9')});db[_0x2085('0xb7')]['belongsTo'](db[_0x2085('0xfe')],{'as':_0x2085('0xfe'),'foreignKey':_0x2085('0x15c')});db[_0x2085('0xb9')][_0x2085('0x10b')](db[_0x2085('0x1cf')],{'as':_0x2085('0x1ba'),'onDelete':_0x2085('0x108'),'foreignKey':'SubjectId'});db[_0x2085('0xb9')][_0x2085('0x10b')](db[_0x2085('0x1cf')],{'as':'Descriptions','onDelete':_0x2085('0x108'),'foreignKey':'DescriptionId'});db[_0x2085('0xb9')][_0x2085('0x10b')](db[_0x2085('0x1cf')],{'as':_0x2085('0x1b5'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1bd')});db[_0x2085('0xb9')][_0x2085('0x115')](db[_0x2085('0xb7')],{'as':_0x2085('0x16a'),'foreignKey':_0x2085('0x1b9')});db[_0x2085('0x1cf')][_0x2085('0x10b')](db[_0x2085('0x1cf')],{'as':_0x2085('0x1c0'),'foreignKey':_0x2085('0x1bb')});db['Dynamics365Field'][_0x2085('0x10b')](db['Dynamics365Field'],{'as':'Description','foreignKey':_0x2085('0x1bc')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':'Field','foreignKey':'FieldId'});db[_0x2085('0x1cf')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x2085('0x1c2')});db[_0x2085('0xbb')][_0x2085('0x10b')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1b9')});db[_0x2085('0xbd')]['hasMany'](db[_0x2085('0x1d0')],{'as':_0x2085('0x1ba'),'foreignKey':_0x2085('0x1bb')});db[_0x2085('0xbd')][_0x2085('0x10b')](db[_0x2085('0x1d0')],{'as':_0x2085('0x1c7'),'foreignKey':'DescriptionId'});db[_0x2085('0xbd')][_0x2085('0x10b')](db[_0x2085('0x1d0')],{'as':'Fields','foreignKey':_0x2085('0x1bd')});db[_0x2085('0xbd')][_0x2085('0x115')](db[_0x2085('0xbb')],{'as':_0x2085('0x16a'),'foreignKey':_0x2085('0x1b9')});db[_0x2085('0x1d0')][_0x2085('0x10b')](db[_0x2085('0x1d0')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x2085('0x1d0')][_0x2085('0x10b')](db['FreshsalesField'],{'as':_0x2085('0x1c1'),'foreignKey':_0x2085('0x1bc')});db[_0x2085('0x1d0')][_0x2085('0x10b')](db[_0x2085('0x1d0')],{'as':_0x2085('0x1be'),'foreignKey':_0x2085('0x1bd')});db[_0x2085('0x1d0')]['belongsTo'](db[_0x2085('0x8c')],{'as':_0x2085('0x8c'),'foreignKey':'VariableId'});db[_0x2085('0xc4')][_0x2085('0x115')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x2085('0x115')](db['CmList'],{'as':_0x2085('0x176'),'foreignKey':_0x2085('0x164')});db[_0x2085('0xc4')][_0x2085('0x115')](db[_0x2085('0x118')],{'as':_0x2085('0x159'),'foreignKey':_0x2085('0x16b')});db[_0x2085('0xc4')][_0x2085('0x115')](db['ChatInteraction'],{});db[_0x2085('0xc4')][_0x2085('0x115')](db[_0x2085('0x65')],{});db[_0x2085('0xc4')][_0x2085('0x115')](db[_0x2085('0x13')],{});db[_0x2085('0xc4')]['belongsTo'](db['ChatQueue'],{});db[_0x2085('0xc6')][_0x2085('0x115')](db[_0x2085('0x13')],{'onDelete':_0x2085('0x108'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x2085('0x115')](db['User'],{'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1d1')});db['JscriptySessionReport'][_0x2085('0x10b')](db[_0x2085('0xc9')],{'foreignKey':'SessionId','onDelete':_0x2085('0x108')});db[_0x2085('0xcb')][_0x2085('0x10b')](db[_0x2085('0xc8')],{'foreignKey':_0x2085('0x1d2'),'onDelete':'cascade'});db[_0x2085('0xcd')]['belongsTo'](db[_0x2085('0x134')],{});db[_0x2085('0xcd')][_0x2085('0x115')](db[_0x2085('0x11b')],{'as':_0x2085('0x176'),'foreignKey':'ListId'});db['SmsQueueReport'][_0x2085('0x115')](db['CmContact'],{'as':_0x2085('0x159'),'foreignKey':_0x2085('0x16b')});db[_0x2085('0xcd')][_0x2085('0x115')](db[_0x2085('0x51')],{});db[_0x2085('0xcd')]['belongsTo'](db['SmsMessage'],{});db[_0x2085('0xcd')]['belongsTo'](db[_0x2085('0x13')],{});db[_0x2085('0xcd')]['belongsTo'](db[_0x2085('0x54')],{});db[_0x2085('0xd1')][_0x2085('0x10b')](db[_0x2085('0xcb')],{'foreignKey':_0x2085('0x1d3')});db[_0x2085('0xd1')][_0x2085('0x10b')](db['JscriptyQuestionReport'],{'foreignKey':_0x2085('0x1d3')});db[_0x2085('0xd1')][_0x2085('0x10b')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db['SquareProject'][_0x2085('0x117')](db[_0x2085('0x13')],{'as':'Users','through':_0x2085('0x13a')});db[_0x2085('0xd9')]['belongsToMany'](db[_0x2085('0x13')],{'as':'Agents','through':_0x2085('0x1d4')});db[_0x2085('0xd9')][_0x2085('0x117')](db['VoiceQueue'],{'through':_0x2085('0xff'),'as':_0x2085('0x126')});db['Team'][_0x2085('0x117')](db['MailQueue'],{'through':'team_has_mail_queues','as':'MailQueues'});db['Team']['belongsToMany'](db[_0x2085('0x67')],{'through':_0x2085('0x19a'),'as':_0x2085('0x1d5')});db[_0x2085('0xd9')]['belongsToMany'](db['FaxQueue'],{'through':_0x2085('0x182'),'as':_0x2085('0x128')});db['Team']['belongsToMany'](db[_0x2085('0x54')],{'through':_0x2085('0x18a'),'as':_0x2085('0x129')});db[_0x2085('0xd9')][_0x2085('0x117')](db[_0x2085('0x5c')],{'through':_0x2085('0x190'),'as':_0x2085('0x12a')});db['Team']['belongsToMany'](db[_0x2085('0xfd')],{'through':_0x2085('0x1d6'),'as':_0x2085('0x1d7')});db[_0x2085('0xd9')][_0x2085('0x117')](db[_0x2085('0xeb')],{'through':_0x2085('0x101'),'as':_0x2085('0x1d8')});db[_0x2085('0x1a0')][_0x2085('0x10b')](db[_0x2085('0x19d')],{'as':_0x2085('0x145'),'foreignKey':_0x2085('0x1a1')});db[_0x2085('0x1a0')][_0x2085('0x10b')](db[_0x2085('0x71')],{'as':'HopperFinals','foreignKey':_0x2085('0x1a1')});db['Campaign'][_0x2085('0x10b')](db[_0x2085('0x10e')],{'as':'HopperHistories','foreignKey':_0x2085('0x1a1')});db[_0x2085('0x1a0')][_0x2085('0x10b')](db['CmHopperBlack'],{'as':_0x2085('0x148'),'foreignKey':_0x2085('0x1a1')});db[_0x2085('0x1a0')][_0x2085('0x115')](db['Trunk'],{'as':_0x2085('0x2b'),'foreignKey':_0x2085('0x14a')});db[_0x2085('0x1a0')][_0x2085('0x115')](db[_0x2085('0x2b')],{'as':_0x2085('0x14b'),'foreignKey':_0x2085('0x14c')});db[_0x2085('0x1a0')]['belongsTo'](db[_0x2085('0x7f')],{'as':_0x2085('0x7f'),'foreignKey':_0x2085('0x14d')});db[_0x2085('0x1a0')][_0x2085('0x115')](db[_0x2085('0x138')],{'as':_0x2085('0x138'),'foreignKey':'SquareProjectId'});db[_0x2085('0x1a0')][_0x2085('0x117')](db[_0x2085('0x11b')],{'as':_0x2085('0x11c'),'through':_0x2085('0x1d9')});db['Campaign']['belongsToMany'](db[_0x2085('0x11b')],{'as':_0x2085('0x1da'),'through':'campaigns_has_cm_blacklists'});db['Attachment']['belongsTo'](db[_0x2085('0x175')],{'as':_0x2085('0x175'),'foreignKey':_0x2085('0x1db')});db[_0x2085('0x1dc')][_0x2085('0x115')](db[_0x2085('0x162')],{});db['MailTransferReport']['belongsTo'](db[_0x2085('0x3e')],{});db[_0x2085('0x1dc')][_0x2085('0x115')](db[_0x2085('0x15a')],{'foreignKey':_0x2085('0x1dd'),'as':'FromAccount'});db[_0x2085('0x1dc')][_0x2085('0x115')](db['User'],{'foreignKey':_0x2085('0x1de'),'as':'FromAgent'});db[_0x2085('0x1dc')][_0x2085('0x115')](db[_0x2085('0x13')],{'foreignKey':'ToUserId','as':_0x2085('0x1df')});db['MailTransferReport']['belongsTo'](db['MailQueue'],{'foreignKey':_0x2085('0x1e0'),'as':_0x2085('0x1e1')});db['MailTransferReport'][_0x2085('0x115')](db[_0x2085('0x15a')],{'foreignKey':_0x2085('0x1e2'),'as':_0x2085('0x1e3')});db[_0x2085('0xe4')]['belongsTo'](db[_0x2085('0x65')],{});db['ChatTransferReport']['belongsTo'](db[_0x2085('0x63')],{});db[_0x2085('0xe4')]['belongsTo'](db[_0x2085('0x5e')],{'foreignKey':_0x2085('0x1e4'),'as':_0x2085('0x1e5')});db['ChatTransferReport'][_0x2085('0x115')](db[_0x2085('0x13')],{'foreignKey':_0x2085('0x1de'),'as':'FromAgent'});db[_0x2085('0xe4')][_0x2085('0x115')](db['User'],{'foreignKey':_0x2085('0x1e6'),'as':_0x2085('0x1df')});db[_0x2085('0xe4')][_0x2085('0x115')](db['ChatQueue'],{'foreignKey':_0x2085('0x1e7'),'as':_0x2085('0x1e1')});db[_0x2085('0xe4')][_0x2085('0x115')](db[_0x2085('0x5e')],{'foreignKey':_0x2085('0x1e8'),'as':_0x2085('0x1e3')});db[_0x2085('0xe6')][_0x2085('0x115')](db[_0x2085('0x49')],{});db[_0x2085('0xe6')][_0x2085('0x115')](db['FaxInteraction'],{});db[_0x2085('0xe6')][_0x2085('0x115')](db[_0x2085('0x12d')],{'foreignKey':_0x2085('0x1e9'),'as':_0x2085('0x1e5')});db[_0x2085('0xe6')][_0x2085('0x115')](db['User'],{'foreignKey':_0x2085('0x1de'),'as':_0x2085('0x1ea')});db[_0x2085('0xe6')][_0x2085('0x115')](db[_0x2085('0x13')],{'foreignKey':_0x2085('0x1e6'),'as':_0x2085('0x1df')});db[_0x2085('0xe6')][_0x2085('0x115')](db[_0x2085('0x4b')],{'foreignKey':_0x2085('0x1eb'),'as':'ToQueue'});db[_0x2085('0xe6')][_0x2085('0x115')](db[_0x2085('0x12d')],{'foreignKey':'ToFaxAccountId','as':_0x2085('0x1e3')});db[_0x2085('0xe7')][_0x2085('0x115')](db[_0x2085('0x5a')],{});db[_0x2085('0xe7')][_0x2085('0x115')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x2085('0x56')],{'foreignKey':_0x2085('0x1ec'),'as':_0x2085('0x1e5')});db[_0x2085('0xe7')][_0x2085('0x115')](db['User'],{'foreignKey':_0x2085('0x1de'),'as':_0x2085('0x1ea')});db[_0x2085('0xe7')][_0x2085('0x115')](db[_0x2085('0x13')],{'foreignKey':'ToUserId','as':_0x2085('0x1df')});db['OpenchannelTransferReport'][_0x2085('0x115')](db[_0x2085('0x5c')],{'foreignKey':_0x2085('0x1ed'),'as':'ToQueue'});db[_0x2085('0xe7')][_0x2085('0x115')](db[_0x2085('0x56')],{'foreignKey':_0x2085('0x1ee'),'as':'ToAccount'});db[_0x2085('0x1ef')][_0x2085('0x115')](db['SmsMessage'],{});db[_0x2085('0x1ef')][_0x2085('0x115')](db[_0x2085('0x51')],{});db[_0x2085('0x1ef')][_0x2085('0x115')](db[_0x2085('0x134')],{'foreignKey':_0x2085('0x1f0'),'as':_0x2085('0x1e5')});db[_0x2085('0x1ef')][_0x2085('0x115')](db[_0x2085('0x13')],{'foreignKey':'FromUserId','as':_0x2085('0x1ea')});db[_0x2085('0x1ef')]['belongsTo'](db[_0x2085('0x13')],{'foreignKey':_0x2085('0x1e6'),'as':_0x2085('0x1df')});db[_0x2085('0x1ef')][_0x2085('0x115')](db['SmsQueue'],{'foreignKey':_0x2085('0x1f1'),'as':_0x2085('0x1e1')});db['SmsTransferReport'][_0x2085('0x115')](db[_0x2085('0x134')],{'foreignKey':_0x2085('0x1f2'),'as':_0x2085('0x1e3')});db[_0x2085('0x11b')][_0x2085('0x10b')](db['Disposition'],{'as':_0x2085('0x161'),'foreignKey':_0x2085('0x164'),'onDelete':_0x2085('0x108')});db[_0x2085('0x11b')]['hasMany'](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0x2085('0x164')});db[_0x2085('0x11b')][_0x2085('0x10b')](db['CmContact'],{'as':'Contacts','onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x164')});db['CmList'][_0x2085('0x10b')](db['CmHopperFinal'],{'as':_0x2085('0x146'),'foreignKey':'ListId'});db['CmList'][_0x2085('0x10b')](db['CmHopperHistory'],{'as':_0x2085('0x10f'),'foreignKey':_0x2085('0x164')});db[_0x2085('0x11b')][_0x2085('0x10b')](db[_0x2085('0x73')],{'as':'ReportAgentPreview','foreignKey':_0x2085('0x164')});db[_0x2085('0x11b')][_0x2085('0x117')](db['VoiceQueue'],{'as':'Queues','through':_0x2085('0x150')});db['CmList'][_0x2085('0x117')](db[_0x2085('0x13')],{'as':'Agents','through':_0x2085('0x11d')});db['VoicePrefix']['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade'});db[_0x2085('0xeb')]['belongsToMany'](db['User'],{'as':_0x2085('0x151'),'through':_0x2085('0x103')});db['VoicePrefix'][_0x2085('0x117')](db[_0x2085('0xd9')],{'through':_0x2085('0x101'),'as':_0x2085('0x168')});db[_0x2085('0xec')][_0x2085('0x10b')](db['User'],{'as':_0x2085('0x170'),'foreignKey':_0x2085('0x116')});db[_0x2085('0xec')][_0x2085('0x10b')](db[_0x2085('0xee')],{'as':_0x2085('0x1f3'),'foreignKey':_0x2085('0x116'),'onDelete':_0x2085('0x108')});db[_0x2085('0xee')]['hasMany'](db[_0x2085('0xf0')],{'as':_0x2085('0x1f4'),'foreignKey':_0x2085('0x1f5'),'onDelete':_0x2085('0x108')});db[_0x2085('0xf4')][_0x2085('0x10b')](db[_0x2085('0x160')],{'as':_0x2085('0x161'),'foreignKey':_0x2085('0x1f6'),'onDelete':'cascade'});db[_0x2085('0xf4')][_0x2085('0x10b')](db[_0x2085('0x7a')],{'as':_0x2085('0x17a'),'foreignKey':_0x2085('0x1f6')});db[_0x2085('0xf4')][_0x2085('0x10b')](db['WhatsappMessage'],{'as':_0x2085('0x153'),'foreignKey':_0x2085('0x1f6')});db[_0x2085('0xf4')][_0x2085('0x10b')](db[_0x2085('0xf8')],{'as':_0x2085('0x163')});db[_0x2085('0xf4')][_0x2085('0x10b')](db['WhatsappApplication'],{'as':_0x2085('0x13f')});db[_0x2085('0xf4')]['belongsTo'](db[_0x2085('0x11b')],{'as':'List','foreignKey':_0x2085('0x164')});db[_0x2085('0xf4')][_0x2085('0x115')](db[_0x2085('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0x2085('0x14f')});db[_0x2085('0xf4')][_0x2085('0x117')](db['User'],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0x2085('0xf6')][_0x2085('0x115')](db[_0x2085('0x13')],{'onDelete':'restrict'});db[_0x2085('0xf6')][_0x2085('0x115')](db[_0x2085('0xfd')],{'onDelete':_0x2085('0x15d')});db['WhatsappApplication'][_0x2085('0x115')](db[_0x2085('0xf4')],{'onDelete':_0x2085('0x15d')});db[_0x2085('0xf6')][_0x2085('0x115')](db[_0x2085('0x7f')],{'onDelete':_0x2085('0x15d'),'foreignKey':_0x2085('0x14d')});db[_0x2085('0xf6')]['belongsTo'](db[_0x2085('0x88')],{'onDelete':_0x2085('0x15d'),'foreignKey':_0x2085('0x17d')});db[_0x2085('0xf8')][_0x2085('0x10b')](db[_0x2085('0xfa')],{'as':_0x2085('0x153'),'onDelete':_0x2085('0x108'),'foreignKey':_0x2085('0x1f7')});db[_0x2085('0xf8')]['belongsTo'](db[_0x2085('0xf4')],{'as':_0x2085('0x16a'),'foreignKey':_0x2085('0x1f6')});db[_0x2085('0xf8')]['belongsTo'](db[_0x2085('0x118')],{'as':_0x2085('0x159'),'foreignKey':_0x2085('0x16b')});db[_0x2085('0xf8')]['belongsTo'](db[_0x2085('0x13')],{'as':_0x2085('0x16c'),'foreignKey':_0x2085('0x109')});db['WhatsappInteraction'][_0x2085('0x117')](db[_0x2085('0x88')],{'through':'whatsapp_interaction_has_tags','as':_0x2085('0x16e')});db[_0x2085('0xf8')][_0x2085('0x117')](db[_0x2085('0x88')],{'through':'whatsapp_interaction_has_tags','as':_0x2085('0x16f')});db['WhatsappInteraction'][_0x2085('0x117')](db[_0x2085('0x13')],{'as':'Users','through':_0x2085('0x125'),'foreignKey':_0x2085('0x1f7')});db['WhatsappMessage'][_0x2085('0x115')](db[_0x2085('0x13')],{'as':_0x2085('0x13')});db[_0x2085('0xfa')]['belongsTo'](db[_0x2085('0x118')],{'onDelete':_0x2085('0x108'),'as':'Contact'});db['WhatsappMessage'][_0x2085('0x115')](db[_0x2085('0xf8')],{'onDelete':_0x2085('0x108'),'as':_0x2085('0x173'),'foreignKey':_0x2085('0x1f7')});db['WhatsappMessage'][_0x2085('0x115')](db[_0x2085('0xf4')],{'as':_0x2085('0x16a'),'foreignKey':_0x2085('0x1f6')});db[_0x2085('0x1f8')][_0x2085('0x115')](db[_0x2085('0xf4')],{});db[_0x2085('0x1f8')]['belongsTo'](db[_0x2085('0x11b')],{'as':_0x2085('0x176'),'foreignKey':_0x2085('0x164')});db[_0x2085('0x1f8')][_0x2085('0x115')](db[_0x2085('0x118')],{'as':_0x2085('0x159'),'foreignKey':_0x2085('0x16b')});db[_0x2085('0x1f8')][_0x2085('0x115')](db[_0x2085('0xf8')],{});db[_0x2085('0x1f8')][_0x2085('0x115')](db[_0x2085('0xfd')],{});db[_0x2085('0x1f8')][_0x2085('0x115')](db[_0x2085('0xfa')],{});db[_0x2085('0x1f8')]['belongsTo'](db[_0x2085('0x13')],{});db[_0x2085('0xfc')][_0x2085('0x115')](db[_0x2085('0xfa')],{});db[_0x2085('0xfc')]['belongsTo'](db[_0x2085('0xf8')],{});db[_0x2085('0xfc')][_0x2085('0x115')](db[_0x2085('0xf4')],{'foreignKey':_0x2085('0x1f9'),'as':_0x2085('0x1e5')});db[_0x2085('0xfc')][_0x2085('0x115')](db['WhatsappAccount'],{'foreignKey':_0x2085('0x1fa'),'as':_0x2085('0x1e3')});db[_0x2085('0xfc')][_0x2085('0x115')](db[_0x2085('0xfd')],{'foreignKey':'ToQueueId','as':_0x2085('0x1e1')});db[_0x2085('0xfc')][_0x2085('0x115')](db[_0x2085('0x13')],{'foreignKey':_0x2085('0x1de'),'as':_0x2085('0x1ea')});db[_0x2085('0xfc')][_0x2085('0x115')](db[_0x2085('0x13')],{'foreignKey':'ToUserId','as':_0x2085('0x1df')});db['WhatsappQueue']['belongsToMany'](db[_0x2085('0x13')],{'as':'Agents','through':_0x2085('0x12b'),'foreignKey':_0x2085('0x1fb')});db[_0x2085('0xfd')][_0x2085('0x117')](db[_0x2085('0xd9')],{'through':_0x2085('0x1d6'),'as':_0x2085('0x168')});db['UserSetting'][_0x2085('0x115')](db['User'],{'as':_0x2085('0x1fc'),'foreignKey':_0x2085('0x109'),'onDelete':_0x2085('0x108'),'hooks':!![]});db[_0x2085('0xfe')]['hasOne'](db[_0x2085('0xb7')],{'as':_0x2085('0xb7'),'onDelete':'restrict'});db['CloudProvider']['hasOne'](db[_0x2085('0x38')],{'as':'Imap','onDelete':'restrict'});db['CloudProvider'][_0x2085('0x107')](db[_0x2085('0x3a')],{'as':_0x2085('0x15f'),'onDelete':'restrict'});module[_0x2085('0x1fd')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 0a94341..006ac26 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81bd=['/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/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/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','/api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','use','./api/user','/api/voice/chanspy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/interactions','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoConfiguration'];(function(_0x16ca18,_0x76afb4){var _0x4e606a=function(_0x1ba359){while(--_0x1ba359){_0x16ca18['push'](_0x16ca18['shift']());}};_0x4e606a(++_0x76afb4);}(_0x81bd,0x7c));var _0xd81b=function(_0xf69e3c,_0xb098fe){_0xf69e3c=_0xf69e3c-0x0;var _0x2e253a=_0x81bd[_0xf69e3c];return _0x2e253a;};'use strict';var path=require(_0xd81b('0x0'));var express=require(_0xd81b('0x1'));var errors=require(_0xd81b('0x2'));var config=require(_0xd81b('0x3'));var setupLoggers=require(_0xd81b('0x4'))[_0xd81b('0x5')];var clientSideLogs=require(_0xd81b('0x6'));exports['default']=function(_0x16e8de){return setupLoggers(_0x16e8de)[_0xd81b('0x7')](function(){_0x16e8de[_0xd81b('0x8')]('/api/users',require(_0xd81b('0x9')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xa'),require('./api/voiceChanSpy'));_0x16e8de['use'](_0xd81b('0xb'),require('./api/voiceContext'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xc'),require(_0xd81b('0xd')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xe'),require(_0xd81b('0xf')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x10'),require(_0xd81b('0x11')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x12'),require(_0xd81b('0x13')));_0x16e8de[_0xd81b('0x8')]('/api/screen/recordings',require(_0xd81b('0x14')));_0x16e8de['use'](_0xd81b('0x15'),require(_0xd81b('0x16')));_0x16e8de['use'](_0xd81b('0x17'),require('./api/voiceMailMessage'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x18'),require(_0xd81b('0x19')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x1a'),require('./api/voiceDialReport'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x1b'),require('./api/voiceAgentReport'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x1c'),require(_0xd81b('0x1d')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x1e'),require(_0xd81b('0x1f')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x20'),require(_0xd81b('0x21')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x22'),require(_0xd81b('0x23')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x24'),require(_0xd81b('0x25')));_0x16e8de[_0xd81b('0x8')]('/api/mail/accounts',require('./api/mailAccount'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x26'),require(_0xd81b('0x27')));_0x16e8de['use'](_0xd81b('0x28'),require(_0xd81b('0x29')));_0x16e8de['use'](_0xd81b('0x2a'),require(_0xd81b('0x2b')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x2c'),require(_0xd81b('0x2d')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x2e'),require(_0xd81b('0x2f')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x30'),require(_0xd81b('0x31')));_0x16e8de[_0xd81b('0x8')]('/api/dashboards',require(_0xd81b('0x32')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x33'),require(_0xd81b('0x34')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x35'),require(_0xd81b('0x36')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x37'),require('./api/faxApplication'));_0x16e8de[_0xd81b('0x8')]('/api/fax/interactions',require('./api/faxInteraction'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x38'),require('./api/faxMessage'));_0x16e8de['use'](_0xd81b('0x39'),require(_0xd81b('0x3a')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x3b'),require(_0xd81b('0x3c')));_0x16e8de[_0xd81b('0x8')]('/api/sms/accounts',require(_0xd81b('0x3d')));_0x16e8de[_0xd81b('0x8')]('/api/sms/applications',require('./api/smsApplication'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x3e'),require('./api/smsInteraction'));_0x16e8de['use']('/api/sms/messages',require(_0xd81b('0x3f')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x40'),require(_0xd81b('0x41')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x42'),require(_0xd81b('0x43')));_0x16e8de['use'](_0xd81b('0x44'),require('./api/openchannelApplication'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x45'),require(_0xd81b('0x46')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x47'),require(_0xd81b('0x48')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x49'),require(_0xd81b('0x4a')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x4b'),require(_0xd81b('0x4c')));_0x16e8de[_0xd81b('0x8')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x4d'),require(_0xd81b('0x4e')));_0x16e8de['use'](_0xd81b('0x4f'),require(_0xd81b('0x50')));_0x16e8de['use'](_0xd81b('0x51'),require(_0xd81b('0x52')));_0x16e8de['use'](_0xd81b('0x53'),require('./api/chatOfflineMessage'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x54'),require(_0xd81b('0x55')));_0x16e8de[_0xd81b('0x8')]('/api/chat/groups',require(_0xd81b('0x56')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x57'),require(_0xd81b('0x58')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x59'),require(_0xd81b('0x5a')));_0x16e8de['use'](_0xd81b('0x5b'),require(_0xd81b('0x5c')));_0x16e8de[_0xd81b('0x8')]('/api/cm/hopper',require(_0xd81b('0x5d')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x5e'),require(_0xd81b('0x5f')));_0x16e8de[_0xd81b('0x8')]('/api/cm/hopper_final',require(_0xd81b('0x60')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x61'),require(_0xd81b('0x62')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x63'),require(_0xd81b('0x64')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x65'),require(_0xd81b('0x66')));_0x16e8de[_0xd81b('0x8')]('/api/automations',require(_0xd81b('0x67')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x68'),require(_0xd81b('0x69')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x6a'),require(_0xd81b('0x6b')));_0x16e8de[_0xd81b('0x8')]('/api/conditions',require('./api/condition'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x6c'),require(_0xd81b('0x6d')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x6e'),require(_0xd81b('0x6f')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x70'),require(_0xd81b('0x71')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x72'),require(_0xd81b('0x73')));_0x16e8de['use'](_0xd81b('0x74'),require(_0xd81b('0x75')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x76'),require(_0xd81b('0x77')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x78'),require(_0xd81b('0x79')));_0x16e8de[_0xd81b('0x8')]('/api/templates',require(_0xd81b('0x7a')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x7b'),require(_0xd81b('0x7c')));_0x16e8de['use'](_0xd81b('0x7d'),require(_0xd81b('0x7e')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x7f'),require(_0xd81b('0x80')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x81'),require(_0xd81b('0x82')));_0x16e8de[_0xd81b('0x8')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x83'),require(_0xd81b('0x84')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x85'),require(_0xd81b('0x86')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x87'),require('./api/analyticMetric'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x88'),require(_0xd81b('0x89')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x8a'),require('./api/analyticTreeReport'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x8b'),require('./api/intSalesforceAccount'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x8c'),require(_0xd81b('0x8d')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x8e'),require(_0xd81b('0x8f')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x90'),require(_0xd81b('0x91')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x92'),require('./api/intSugarcrmConfiguration'));_0x16e8de[_0xd81b('0x8')]('/api/integrations/sugarcrm/fields',require(_0xd81b('0x93')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x94'),require(_0xd81b('0x95')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x96'),require('./api/intDeskConfiguration'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x97'),require('./api/intDeskField'));_0x16e8de['use'](_0xd81b('0x98'),require('./api/intZohoAccount'));_0x16e8de[_0xd81b('0x8')]('/api/integrations/zoho/configurations',require(_0xd81b('0x99')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x9a'),require('./api/intZohoField'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x9b'),require('./api/intZendeskAccount'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x9c'),require('./api/intZendeskConfiguration'));_0x16e8de[_0xd81b('0x8')]('/api/integrations/zendesk/fields',require(_0xd81b('0x9d')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x9e'),require(_0xd81b('0x9f')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xa0'),require(_0xd81b('0xa1')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xa2'),require(_0xd81b('0xa3')));_0x16e8de['use'](_0xd81b('0xa4'),require(_0xd81b('0xa5')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xa6'),require(_0xd81b('0xa7')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xa8'),require('./api/intVtigerField'));_0x16e8de['use']('/api/integrations/servicenow/accounts',require(_0xd81b('0xa9')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xaa'),require(_0xd81b('0xab')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xac'),require(_0xd81b('0xad')));_0x16e8de['use'](_0xd81b('0xae'),require(_0xd81b('0xaf')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xb0'),require(_0xd81b('0xb1')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xb2'),require('./api/intDynamics365Field'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xb3'),require(_0xd81b('0xb4')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xb5'),require(_0xd81b('0xb6')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xb7'),require(_0xd81b('0xb8')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xb9'),require(_0xd81b('0xba')));_0x16e8de['use'](_0xd81b('0xbb'),require('./api/chatQueueReport'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xbc'),require(_0xd81b('0xbd')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xbe'),require(_0xd81b('0xbf')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xc0'),require(_0xd81b('0xc1')));_0x16e8de[_0xd81b('0x8')]('/api/jscripty/sessions/reports',require(_0xd81b('0xc2')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xc3'),require(_0xd81b('0xc4')));_0x16e8de[_0xd81b('0x8')]('/api/square/reports',require('./api/squareReport'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xc5'),require(_0xd81b('0xc6')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xc7'),require(_0xd81b('0xc8')));_0x16e8de[_0xd81b('0x8')]('/api/settings',require(_0xd81b('0xc9')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xca'),require(_0xd81b('0xcb')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xcc'),require(_0xd81b('0xcd')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xce'),require('./api/squareRecording'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xcf'),require(_0xd81b('0xd0')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xd1'),require('./api/team'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xd2'),require('./api/license'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xd3'),require('./api/campaign'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xd4'),require(_0xd81b('0xd5')));_0x16e8de['use'](_0xd81b('0xd6'),require(_0xd81b('0xd7')));_0x16e8de[_0xd81b('0x8')]('/api/plugins',require('./api/plugin'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xd8'),require(_0xd81b('0xd9')));_0x16e8de['use'](_0xd81b('0xda'),require(_0xd81b('0xdb')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xdc'),require('./api/faxTransferReport'));_0x16e8de['use'](_0xd81b('0xdd'),require(_0xd81b('0xde')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xdf'),require('./api/smsTransferReport'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xe0'),require('./api/cmList'));_0x16e8de[_0xd81b('0x8')]('/api/voice/prefixes',require(_0xd81b('0xe1')));_0x16e8de[_0xd81b('0x8')]('/api/userProfiles',require(_0xd81b('0xe2')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xe3'),require(_0xd81b('0xe4')));_0x16e8de[_0xd81b('0x8')]('/api/userProfile/resources',require(_0xd81b('0xe5')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xe6'),require(_0xd81b('0xe7')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xe8'),require('./api/whatsappAccount'));_0x16e8de['use'](_0xd81b('0xe9'),require(_0xd81b('0xea')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xeb'),require('./api/whatsappInteraction'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xec'),require(_0xd81b('0xed')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xee'),require('./api/whatsappQueueReport'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xef'),require(_0xd81b('0xf0')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xf1'),require(_0xd81b('0xf2')));_0x16e8de[_0xd81b('0x8')]('/api/cloudProviders',require(_0xd81b('0xf3')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xf4'),require(_0xd81b('0xf5')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xf6'),require('./api/user-setting'));_0x16e8de[_0xd81b('0x8')]('/api/auth/local',require(_0xd81b('0xf7')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xf8'),require('./api/authGoogle'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xf9'),require(_0xd81b('0xfa')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0xfb'),require(_0xd81b('0xfc')));_0x16e8de['use'](_0xd81b('0xfd'),require('./api/rpc'));_0x16e8de['use'](_0xd81b('0xfe'),require(_0xd81b('0xff')));_0x16e8de[_0xd81b('0x8')]('/api/system',require(_0xd81b('0x100')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x101'),require(_0xd81b('0x102')));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x103'),require('./api/webbar'));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x104'),clientSideLogs);_0x16e8de[_0xd81b('0x8')](_0xd81b('0x105'),express[_0xd81b('0x106')](path[_0xd81b('0x107')](config[_0xd81b('0x108')],_0xd81b('0x105'))));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x109'),express[_0xd81b('0x106')](path[_0xd81b('0x107')](config[_0xd81b('0x108')],_0xd81b('0x109'))));_0x16e8de[_0xd81b('0x8')]('/demo',express[_0xd81b('0x106')](path['join'](config[_0xd81b('0x108')],_0xd81b('0x10a'))));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x10b'),express[_0xd81b('0x106')](path[_0xd81b('0x107')](config['root'],_0xd81b('0x10c'),_0xd81b('0x10d'))));_0x16e8de[_0xd81b('0x8')](_0xd81b('0x10e'),express[_0xd81b('0x106')](path[_0xd81b('0x107')](config[_0xd81b('0x108')],_0xd81b('0x10f'))));_0x16e8de[_0xd81b('0x110')](_0xd81b('0x111'))[_0xd81b('0x112')](errors[0x194]);_0x16e8de[_0xd81b('0x110')]('/*')['get'](function(_0xb6c5b9,_0x32a785){_0x32a785[_0xd81b('0x113')](path[_0xd81b('0x114')](_0x16e8de[_0xd81b('0x112')]('appPath')+_0xd81b('0x115')));});return _0x16e8de;});}; \ No newline at end of file +var _0x1cb9=['./api/license','/api/campaigns','/api/migrations','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','./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','/apidoc','static','join','/www','root','/demo','snippet','3.0.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./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/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','/api/members/reports','./api/memberReport','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboardItem','/api/fax/accounts','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/messages','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/messages','/api/chat/offline_messages','/api/chat/queues','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/field_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','./api/intVtigerAccount','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/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/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/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/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license'];(function(_0x5b136c,_0xa358f5){var _0x329e1f=function(_0xb93134){while(--_0xb93134){_0x5b136c['push'](_0x5b136c['shift']());}};_0x329e1f(++_0xa358f5);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4d2e27,_0x573862){_0x4d2e27=_0x4d2e27-0x0;var _0x326af6=_0x1cb9[_0x4d2e27];return _0x326af6;};'use strict';var path=require(_0x91cb('0x0'));var express=require('express');var errors=require(_0x91cb('0x1'));var config=require(_0x91cb('0x2'));var setupLoggers=require(_0x91cb('0x3'))[_0x91cb('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0x91cb('0x5')]=function(_0x2b7314){return setupLoggers(_0x2b7314)['then'](function(){_0x2b7314[_0x91cb('0x6')](_0x91cb('0x7'),require(_0x91cb('0x8')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x9'),require(_0x91cb('0xa')));_0x2b7314['use'](_0x91cb('0xb'),require('./api/voiceContext'));_0x2b7314[_0x91cb('0x6')]('/api/voice/extensions',require(_0x91cb('0xc')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xd'),require(_0x91cb('0xe')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xf'),require(_0x91cb('0x10')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x11'),require(_0x91cb('0x12')));_0x2b7314['use'](_0x91cb('0x13'),require(_0x91cb('0x14')));_0x2b7314['use'](_0x91cb('0x15'),require(_0x91cb('0x16')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x17'),require('./api/voiceMailMessage'));_0x2b7314['use'](_0x91cb('0x18'),require(_0x91cb('0x19')));_0x2b7314['use']('/api/voice/dials/reports',require(_0x91cb('0x1a')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x1b'),require('./api/voiceAgentReport'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x1c'),require('./api/voiceQueueReport'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x1d'),require(_0x91cb('0x1e')));_0x2b7314[_0x91cb('0x6')]('/api/trunks',require(_0x91cb('0x1f')));_0x2b7314[_0x91cb('0x6')]('/api/voice/transfers/reports',require(_0x91cb('0x20')));_0x2b7314['use']('/api/mail/out_servers',require(_0x91cb('0x21')));_0x2b7314[_0x91cb('0x6')]('/api/mail/accounts',require('./api/mailAccount'));_0x2b7314['use'](_0x91cb('0x22'),require(_0x91cb('0x23')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x24'),require('./api/mailSubstatus'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x25'),require(_0x91cb('0x26')));_0x2b7314['use'](_0x91cb('0x27'),require(_0x91cb('0x28')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x29'),require(_0x91cb('0x2a')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x2b'),require(_0x91cb('0x2c')));_0x2b7314[_0x91cb('0x6')]('/api/dashboards',require('./api/dashboard'));_0x2b7314[_0x91cb('0x6')]('/api/dashboards/items',require(_0x91cb('0x2d')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x2e'),require('./api/faxAccount'));_0x2b7314[_0x91cb('0x6')]('/api/fax/applications',require(_0x91cb('0x2f')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x30'),require(_0x91cb('0x31')));_0x2b7314[_0x91cb('0x6')]('/api/fax/messages',require(_0x91cb('0x32')));_0x2b7314['use'](_0x91cb('0x33'),require(_0x91cb('0x34')));_0x2b7314[_0x91cb('0x6')]('/api/fax/reports/queue',require(_0x91cb('0x35')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x36'),require(_0x91cb('0x37')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x38'),require(_0x91cb('0x39')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x3a'),require('./api/smsInteraction'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x3b'),require(_0x91cb('0x3c')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x3d'),require('./api/smsQueue'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x3e'),require(_0x91cb('0x3f')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x40'),require('./api/openchannelApplication'));_0x2b7314[_0x91cb('0x6')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x2b7314['use'](_0x91cb('0x41'),require('./api/openchannelMessage'));_0x2b7314[_0x91cb('0x6')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x42'),require(_0x91cb('0x43')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x44'),require('./api/openchannelQueueReport'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x45'),require(_0x91cb('0x46')));_0x2b7314[_0x91cb('0x6')]('/api/chat/interactions',require('./api/chatInteraction'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x47'),require('./api/chatMessage'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x48'),require('./api/chatOfflineMessage'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x49'),require('./api/chatQueue'));_0x2b7314[_0x91cb('0x6')]('/api/chat/groups',require(_0x91cb('0x4a')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x4b'),require(_0x91cb('0x4c')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x4d'),require('./api/cmCompany'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x4e'),require('./api/cmContact'));_0x2b7314[_0x91cb('0x6')]('/api/cm/hopper',require(_0x91cb('0x4f')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x50'),require(_0x91cb('0x51')));_0x2b7314['use'](_0x91cb('0x52'),require(_0x91cb('0x53')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x54'),require(_0x91cb('0x55')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x56'),require(_0x91cb('0x57')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x58'),require('./api/action'));_0x2b7314[_0x91cb('0x6')]('/api/automations',require(_0x91cb('0x59')));_0x2b7314['use'](_0x91cb('0x5a'),require('./api/cannedAnswer'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x5b'),require(_0x91cb('0x5c')));_0x2b7314[_0x91cb('0x6')]('/api/conditions',require(_0x91cb('0x5d')));_0x2b7314[_0x91cb('0x6')]('/api/intervals',require(_0x91cb('0x5e')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x5f'),require(_0x91cb('0x60')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x61'),require(_0x91cb('0x62')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x63'),require('./api/voiceQueuesLog'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x64'),require(_0x91cb('0x65')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x66'),require(_0x91cb('0x67')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x68'),require('./api/tag'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x69'),require(_0x91cb('0x6a')));_0x2b7314[_0x91cb('0x6')]('/api/triggers',require(_0x91cb('0x6b')));_0x2b7314[_0x91cb('0x6')]('/api/variables',require(_0x91cb('0x6c')));_0x2b7314['use'](_0x91cb('0x6d'),require('./api/integration'));_0x2b7314['use']('/api/integrations/reports',require(_0x91cb('0x6e')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x6f'),require(_0x91cb('0x70')));_0x2b7314[_0x91cb('0x6')]('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x71'),require(_0x91cb('0x72')));_0x2b7314[_0x91cb('0x6')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x2b7314['use'](_0x91cb('0x73'),require('./api/analyticFieldReport'));_0x2b7314[_0x91cb('0x6')]('/api/analytics/tree_reports',require(_0x91cb('0x74')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x75'),require(_0x91cb('0x76')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x77'),require(_0x91cb('0x78')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x79'),require(_0x91cb('0x7a')));_0x2b7314[_0x91cb('0x6')]('/api/integrations/sugarcrm/accounts',require(_0x91cb('0x7b')));_0x2b7314[_0x91cb('0x6')]('/api/integrations/sugarcrm/configurations',require(_0x91cb('0x7c')));_0x2b7314[_0x91cb('0x6')]('/api/integrations/sugarcrm/fields',require(_0x91cb('0x7d')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x7e'),require(_0x91cb('0x7f')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x80'),require(_0x91cb('0x81')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x82'),require(_0x91cb('0x83')));_0x2b7314[_0x91cb('0x6')]('/api/integrations/zoho/accounts',require(_0x91cb('0x84')));_0x2b7314['use'](_0x91cb('0x85'),require('./api/intZohoConfiguration'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x86'),require(_0x91cb('0x87')));_0x2b7314['use'](_0x91cb('0x88'),require(_0x91cb('0x89')));_0x2b7314['use'](_0x91cb('0x8a'),require(_0x91cb('0x8b')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x8c'),require('./api/intZendeskField'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x8d'),require(_0x91cb('0x8e')));_0x2b7314[_0x91cb('0x6')]('/api/integrations/freshdesk/configurations',require(_0x91cb('0x8f')));_0x2b7314[_0x91cb('0x6')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x2b7314[_0x91cb('0x6')]('/api/integrations/vtiger/accounts',require(_0x91cb('0x90')));_0x2b7314[_0x91cb('0x6')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x2b7314[_0x91cb('0x6')]('/api/integrations/vtiger/fields',require(_0x91cb('0x91')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x92'),require('./api/intServicenowAccount'));_0x2b7314[_0x91cb('0x6')]('/api/integrations/servicenow/configurations',require(_0x91cb('0x93')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x94'),require(_0x91cb('0x95')));_0x2b7314['use'](_0x91cb('0x96'),require(_0x91cb('0x97')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x98'),require(_0x91cb('0x99')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x9a'),require(_0x91cb('0x9b')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x9c'),require(_0x91cb('0x9d')));_0x2b7314[_0x91cb('0x6')]('/api/integrations/freshsales/configurations',require(_0x91cb('0x9e')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0x9f'),require(_0x91cb('0xa0')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xa1'),require(_0x91cb('0xa2')));_0x2b7314['use'](_0x91cb('0xa3'),require('./api/chatQueueReport'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xa4'),require(_0x91cb('0xa5')));_0x2b7314[_0x91cb('0x6')]('/api/jscripty/answers/reports',require(_0x91cb('0xa6')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xa7'),require(_0x91cb('0xa8')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xa9'),require('./api/jscriptySessionReport'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xaa'),require(_0x91cb('0xab')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xac'),require(_0x91cb('0xad')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xae'),require(_0x91cb('0xaf')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xb0'),require(_0x91cb('0xb1')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xb2'),require(_0x91cb('0xb3')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xb4'),require('./api/squareOdbc'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xb5'),require('./api/squareProject'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xb6'),require(_0x91cb('0xb7')));_0x2b7314['use'](_0x91cb('0xb8'),require(_0x91cb('0xb9')));_0x2b7314['use']('/api/teams',require(_0x91cb('0xba')));_0x2b7314['use'](_0x91cb('0xbb'),require(_0x91cb('0xbc')));_0x2b7314['use'](_0x91cb('0xbd'),require('./api/campaign'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xbe'),require('./api/migration'));_0x2b7314['use'](_0x91cb('0xbf'),require(_0x91cb('0xc0')));_0x2b7314[_0x91cb('0x6')]('/api/plugins',require(_0x91cb('0xc1')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xc2'),require(_0x91cb('0xc3')));_0x2b7314['use'](_0x91cb('0xc4'),require('./api/chatTransferReport'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xc5'),require(_0x91cb('0xc6')));_0x2b7314[_0x91cb('0x6')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x2b7314[_0x91cb('0x6')]('/api/sms/reports/transfer',require(_0x91cb('0xc7')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xc8'),require(_0x91cb('0xc9')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xca'),require(_0x91cb('0xcb')));_0x2b7314['use'](_0x91cb('0xcc'),require(_0x91cb('0xcd')));_0x2b7314['use'](_0x91cb('0xce'),require('./api/userProfileSection'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xcf'),require(_0x91cb('0xd0')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xd1'),require(_0x91cb('0xd2')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xd3'),require(_0x91cb('0xd4')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xd5'),require(_0x91cb('0xd6')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xd7'),require(_0x91cb('0xd8')));_0x2b7314[_0x91cb('0x6')]('/api/whatsapp/messages',require(_0x91cb('0xd9')));_0x2b7314['use'](_0x91cb('0xda'),require(_0x91cb('0xdb')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xdc'),require(_0x91cb('0xdd')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xde'),require(_0x91cb('0xdf')));_0x2b7314['use'](_0x91cb('0xe0'),require(_0x91cb('0xe1')));_0x2b7314['use']('/api/realtime',require(_0x91cb('0xe2')));_0x2b7314['use']('/api/user-settings',require(_0x91cb('0xe3')));_0x2b7314['use'](_0x91cb('0xe4'),require('./api/authLocal'));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xe5'),require(_0x91cb('0xe6')));_0x2b7314[_0x91cb('0x6')]('/api/auth/activedirectory',require(_0x91cb('0xe7')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xe8'),require(_0x91cb('0xe9')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xea'),require(_0x91cb('0xeb')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xec'),require(_0x91cb('0xed')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xee'),require(_0x91cb('0xef')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xf0'),require(_0x91cb('0xf1')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xf2'),require(_0x91cb('0xf3')));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xf4'),clientSideLogs);_0x2b7314[_0x91cb('0x6')](_0x91cb('0xf5'),express[_0x91cb('0xf6')](path[_0x91cb('0xf7')](config['root'],_0x91cb('0xf5'))));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xf8'),express[_0x91cb('0xf6')](path[_0x91cb('0xf7')](config[_0x91cb('0xf9')],_0x91cb('0xf8'))));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xfa'),express[_0x91cb('0xf6')](path[_0x91cb('0xf7')](config['root'],_0x91cb('0xfa'))));_0x2b7314['use']('/snippet',express[_0x91cb('0xf6')](path[_0x91cb('0xf7')](config[_0x91cb('0xf9')],_0x91cb('0xfb'),_0x91cb('0xfc'))));_0x2b7314[_0x91cb('0x6')](_0x91cb('0xfd'),express[_0x91cb('0xf6')](path[_0x91cb('0xf7')](config[_0x91cb('0xf9')],'/server/files/plugins')));_0x2b7314[_0x91cb('0xfe')](_0x91cb('0xff'))['get'](errors[0x194]);_0x2b7314[_0x91cb('0xfe')]('/*')[_0x91cb('0x100')](function(_0x522871,_0xecd79c){_0xecd79c[_0x91cb('0x101')](path[_0x91cb('0x102')](_0x2b7314[_0x91cb('0x100')](_0x91cb('0x103'))+_0x91cb('0x104')));});return _0x2b7314;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 0a92aee..f4c00e0 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x340a=['../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/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/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','rpc','port','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc'];(function(_0x5c5c0d,_0x479b7a){var _0x1cf92e=function(_0x3398f6){while(--_0x3398f6){_0x5c5c0d['push'](_0x5c5c0d['shift']());}};_0x1cf92e(++_0x479b7a);}(_0x340a,0x127));var _0xa340=function(_0xe8bd28,_0x4c323f){_0xe8bd28=_0xe8bd28-0x0;var _0x1f148d=_0x340a[_0xe8bd28];return _0x1f148d;};'use strict';var jayson=require(_0xa340('0x0'));var _=require(_0xa340('0x1'));var config=require(_0xa340('0x2'));exports[_0xa340('0x3')]=function(){return new Promise(function(_0x5dfc6c,_0x418b6d){var _0x1b52b9={};_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x5')));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0x6')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x7')));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0x8')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x9')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0xa')));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0xb')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/trunk/trunk.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0xc')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0xd')));_0x1b52b9=_['merge'](_0x1b52b9,require('../api/mailServerIn/mailServerIn.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/mailAccount/mailAccount.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/mailQueue/mailQueue.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0xe')));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0xf')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x10')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x11')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x12')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x13')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x14')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x15')));_0x1b52b9=_['merge'](_0x1b52b9,require('../api/faxQueue/faxQueue.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x16')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/smsInteraction/smsInteraction.rpc'));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0x17')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x18')));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0x19')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x1a')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x1b')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x1c')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x1d')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x1e')));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0x1f')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/chatQueue/chatQueue.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x20')));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0x21')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x22')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x23')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x24')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x25')));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0x26')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x27')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/template/template.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/trigger/trigger.rpc'));_0x1b52b9=_['merge'](_0x1b52b9,require('../api/variable/variable.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x28')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0x29')));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0x2a')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x2b')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x2c')));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0x2d')));_0x1b52b9=_['merge'](_0x1b52b9,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x2e')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x2f')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/squareReport/squareReport.rpc'));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0x30')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/setting/setting.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/squareOdbc/squareOdbc.rpc'));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x31')));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0x32')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x33')));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0x34')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x35')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x36')));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0x37')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x38')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require(_0xa340('0x39')));_0x1b52b9=_['merge'](_0x1b52b9,require(_0xa340('0x3a')));_0x1b52b9=_[_0xa340('0x4')](_0x1b52b9,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0xbcef8b=jayson['server'](_0x1b52b9)['http']();var _0x2d2601=config[_0xa340('0x3b')][_0xa340('0x3c')]||config['port']+0x1;var _0x3d5ba9=config['rpc']['ip']||'localhost';_0xbcef8b['on']('error',function(_0x4a4fcb){return _0x418b6d(_0x4a4fcb);});_0xbcef8b[_0xa340('0x3')](_0x2d2601,_0x3d5ba9,function(){console[_0xa340('0x3d')](_0xa340('0x3e'),_0x3d5ba9,_0x2d2601);require('../config/triggers')[_0xa340('0x3f')]();return _0x5dfc6c('RPC\x20listening\x20on\x20'+_0x3d5ba9+':'+_0x2d2601);});});}; \ No newline at end of file +var _0x9087=['../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.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/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.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/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc'];(function(_0x49260b,_0x12c8d4){var _0x49e899=function(_0x34a5f2){while(--_0x34a5f2){_0x49260b['push'](_0x49260b['shift']());}};_0x49e899(++_0x12c8d4);}(_0x9087,0x71));var _0x7908=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9087[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x7908('0x0'));var _=require(_0x7908('0x1'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x136299,_0xa0f6b6){var _0xface8d={};_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x3')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require('../api/voiceExtension/voiceExtension.rpc'));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x4')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x5')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x6')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require('../api/voiceDialReport/voiceDialReport.rpc'));_0xface8d=_[_0x7908('0x2')](_0xface8d,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0xface8d=_[_0x7908('0x2')](_0xface8d,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0xface8d=_['merge'](_0xface8d,require(_0x7908('0x7')));_0xface8d=_['merge'](_0xface8d,require(_0x7908('0x8')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x9')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0xa')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0xb')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0xc')));_0xface8d=_['merge'](_0xface8d,require(_0x7908('0xd')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require('../api/mailInteraction/mailInteraction.rpc'));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0xe')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0xf')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x10')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x11')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x12')));_0xface8d=_['merge'](_0xface8d,require(_0x7908('0x13')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x14')));_0xface8d=_['merge'](_0xface8d,require(_0x7908('0x15')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x16')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x17')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x18')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x19')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x1a')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require('../api/openchannelApplication/openchannelApplication.rpc'));_0xface8d=_['merge'](_0xface8d,require(_0x7908('0x1b')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x1c')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x1d')));_0xface8d=_['merge'](_0xface8d,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x1e')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require('../api/chatMessage/chatMessage.rpc'));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x1f')));_0xface8d=_['merge'](_0xface8d,require(_0x7908('0x20')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x21')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x22')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x23')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x24')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x25')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require('../api/interval/interval.rpc'));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x26')));_0xface8d=_['merge'](_0xface8d,require('../api/sound/sound.rpc'));_0xface8d=_[_0x7908('0x2')](_0xface8d,require('../api/template/template.rpc'));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x27')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x28')));_0xface8d=_['merge'](_0xface8d,require(_0x7908('0x29')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x2a')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x2b')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x2c')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x2d')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x2e')));_0xface8d=_['merge'](_0xface8d,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x2f')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x30')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x31')));_0xface8d=_['merge'](_0xface8d,require(_0x7908('0x32')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require('../api/smsQueueReport/smsQueueReport.rpc'));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x33')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x34')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require('../api/setting/setting.rpc'));_0xface8d=_['merge'](_0xface8d,require('../api/squareOdbc/squareOdbc.rpc'));_0xface8d=_[_0x7908('0x2')](_0xface8d,require('../api/squareProject/squareProject.rpc'));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x35')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x36')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x37')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x38')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x39')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require(_0x7908('0x3a')));_0xface8d=_[_0x7908('0x2')](_0xface8d,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0xface8d=_[_0x7908('0x2')](_0xface8d,require('../api/whatsappMessage/whatsappMessage.rpc'));_0xface8d=_['merge'](_0xface8d,require(_0x7908('0x3b')));_0xface8d=_['merge'](_0xface8d,require(_0x7908('0x3c')));var _0x4a0f8e=jayson[_0x7908('0x3d')](_0xface8d)[_0x7908('0x3e')]();var _0x30ad25=config[_0x7908('0x3f')][_0x7908('0x40')]||config[_0x7908('0x40')]+0x1;var _0x4e2bf9=config[_0x7908('0x3f')]['ip']||_0x7908('0x41');_0x4a0f8e['on'](_0x7908('0x42'),function(_0x4cdcf0){return _0xa0f6b6(_0x4cdcf0);});_0x4a0f8e[_0x7908('0x43')](_0x30ad25,_0x4e2bf9,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x4e2bf9,_0x30ad25);require(_0x7908('0x44'))[_0x7908('0x45')]();return _0x136299(_0x7908('0x46')+_0x4e2bf9+':'+_0x30ad25);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index b7ed4cd..8e09436 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 _0x3c04=['substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','setPriority','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','exports','lodash','EventEmitter','./reply','./error','call','utf8','setEncoding','headers','emit','ready','line','hangup'];(function(_0x5bb6ef,_0xaf07ae){var _0x3a8ee1=function(_0x2c3701){while(--_0x2c3701){_0x5bb6ef['push'](_0x5bb6ef['shift']());}};_0x3a8ee1(++_0xaf07ae);}(_0x3c04,0x192));var _0x43c0=function(_0x53f1da,_0x567978){_0x53f1da=_0x53f1da-0x0;var _0x39e57f=_0x3c04[_0x53f1da];return _0x39e57f;};'use strict';var util=require('util');var _=require(_0x43c0('0x0'));var EventEmitter=require('events')[_0x43c0('0x1')];var AGIReply=require(_0x43c0('0x2'));var AGIError=require(_0x43c0('0x3'));function AGIChannel(_0x2acce3){var _0x212986=this,_0x43818b=new AGIReply(),_0xda1f1f=![],_0x23b839={};EventEmitter[_0x43c0('0x4')](_0x212986);_0x2acce3['setEncoding'](_0x43c0('0x5'));_0x2acce3['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x43818b[_0x43c0('0x6')]('utf8');_0x43818b['on'](_0x43c0('0x7'),function(_0x53b4b1){for(var _0x100fb8 in _0x53b4b1){_0x212986[_0x100fb8]=_0x53b4b1[_0x100fb8];}_0x212986[_0x43c0('0x8')](_0x43c0('0x9'));});_0x43818b['on'](_0x43c0('0xa'),function(_0x506f13){if(_0x506f13['toLowerCase']()==_0x43c0('0xb')){_0x212986['emit'](_0x43c0('0xb'));return;}if(_0x506f13[_0x43c0('0xc')](0x0,0xb)==_0x43c0('0xd')){_0xda1f1f=!![];}if(_0xda1f1f){_0x23b839['rx']+=_0x506f13+'\x0a';if(_0x506f13['search'](_0x43c0('0xe'))!=-0x1){_0xda1f1f=![];}}else{_0x23b839['rx']=_0x506f13;}if(_0xda1f1f){return;}if(typeof _0x23b839['cb']==_0x43c0('0xf')){var _0x3ad25d=_0x23b839['rx']['substring'](0x0,0x3),_0x3f235e=null,_0x4649fc=null;_0x3ad25d=parseInt(_0x3ad25d);if(isNaN(_0x3ad25d)){_0x23b839['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x43c0('0x10')});return;}if(_0x3ad25d!=0xc8){_0x23b839['cb'](null,{'code':_0x3ad25d,'result':-0x1,'extra':'KO'});return;}_0x3f235e=_0x23b839['rx'][_0x43c0('0xc')](0x4)[_0x43c0('0x11')](_0x43c0('0x12'),'');if(_0x3f235e[_0x43c0('0x13')]('\x20')!=-0x1){_0x3f235e=_0x3f235e['substr'](0x0,_0x3f235e[_0x43c0('0x13')]('\x20'));}if(_['startsWith'](_0x3f235e,'-1')){_0x3f235e=parseInt(_0x3f235e);}_0x4649fc=_0x23b839['rx'][_0x43c0('0x14')]('\x20');if(_0x4649fc['length']==0x3){_0x4649fc=_0x4649fc[0x2][_0x43c0('0xc')](0x1,_0x4649fc[0x2][_0x43c0('0x15')]-0x1);}else if(_0x4649fc[_0x43c0('0x15')]>0x3){var _0x2c5b6e=/\((.+)\)/;var _0x3f7db7=_0x23b839['rx']['match'](_0x2c5b6e);if(_0x3f7db7){_0x4649fc=_0x3f7db7[0x1];}else{_0x4649fc=null;}}else{_0x4649fc=null;}_0x23b839['cb'](null,{'code':_0x3ad25d,'result':_0x3f235e,'extra':_0x4649fc});}});_0x2acce3['on']('error',function(_0x5119e9){_0x212986[_0x43c0('0x8')](_0x43c0('0x16'),new AGIError(_0x43c0('0x17'),_0x5119e9[_0x43c0('0x18')]));});_0x2acce3['on'](_0x43c0('0x19'),function(){_0x212986[_0x43c0('0x8')]('close',new AGIError(_0x43c0('0x1a')));});_0x2acce3['on'](_0x43c0('0x1b'),function(){_0x212986[_0x43c0('0x8')](_0x43c0('0x1b'),new AGIError(_0x43c0('0x1c')));_0x2acce3[_0x43c0('0x1d')]();});_0x2acce3[_0x43c0('0x1e')](_0x43818b);this[_0x43c0('0x1f')]=function(_0xad2b9,_0x3873c0){var _0xad2b9=_0xad2b9||'',_0x3873c0=typeof _0x3873c0==_0x43c0('0xf')?_0x3873c0:new Function();_0x23b839={'tx':_0xad2b9,'rx':'','cb':_0x3873c0};_0x2acce3[_0x43c0('0x20')](_0xad2b9+'\x0a');},this['close']=function(){_0x2acce3[_0x43c0('0x1d')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x43c0('0x21')][_0x43c0('0x22')]=function(_0x3f85c4){return this[_0x43c0('0x1f')]['sync'](this,_0x3f85c4);};AGIChannel[_0x43c0('0x21')]['answer']=function(){return this[_0x43c0('0x22')](_0x43c0('0x23'));};AGIChannel['prototype'][_0x43c0('0x24')]=function(_0x1080a0,_0x31fde5,_0x30b428){_0x1080a0=_0x1080a0===undefined?_0x43c0('0x25'):_0x1080a0;_0x31fde5=_0x31fde5===undefined?'5':_0x31fde5;_0x30b428=_0x30b428===undefined?'1':_0x30b428;return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x27'),_0x1080a0,_0x31fde5*0x3e8,_0x30b428));};AGIChannel['prototype'][_0x43c0('0x28')]=function(_0x4c4e3d){_0x4c4e3d=_0x4c4e3d||_0x43c0('0x29');return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x2a'),_0x4c4e3d));};AGIChannel[_0x43c0('0x21')][_0x43c0('0x2b')]=function(_0x5b9828,_0x2dcc60){if(_['isArray'](_0x2dcc60)){return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x2c'),_0x5b9828,_0x2dcc60['join'](',')));}return this[_0x43c0('0x22')](util[_0x43c0('0x26')]('EXEC\x20%s\x20%s',_0x5b9828,_0x2dcc60));};AGIChannel['prototype'][_0x43c0('0x2d')]=function(_0x3d0faa){return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x2e'),_0x3d0faa));};AGIChannel[_0x43c0('0x21')]['setExtension']=function(_0x449abf){return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x2f'),_0x449abf));};AGIChannel['prototype']['setPriority']=function(_0x11455e){return this['sendRequest'](util[_0x43c0('0x26')]('SET\x20PRIORITY\x20%s',_0x11455e));};AGIChannel[_0x43c0('0x21')][_0x43c0('0xb')]=function(){return this[_0x43c0('0x22')]('HANGUP');};AGIChannel['prototype'][_0x43c0('0x30')]=function(_0x3b9dfa,_0x4275da){var _0x42efbc=_['isBoolean'](_0x4275da)||_[_0x43c0('0x31')](_0x4275da)?_0x4275da[_0x43c0('0x32')]():_0x4275da;return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x33'),_0x3b9dfa,_0x42efbc?_0x42efbc['toString']()[_0x43c0('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x43c0('0x21')][_0x43c0('0x34')]=function(_0x1aff97,_0x3285df){return this[_0x43c0('0x22')](util[_0x43c0('0x26')]('SAY\x20NUMBER\x20%s\x20%s',_0x1aff97,_0x3285df));};AGIChannel[_0x43c0('0x21')]['sayDigits']=function(_0x43473,_0x4da289){return this[_0x43c0('0x22')](util['format'](_0x43c0('0x35'),_0x43473,_0x4da289));};AGIChannel[_0x43c0('0x21')][_0x43c0('0x36')]=function(_0x442aaa,_0x450c62){return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x37'),_0x442aaa,_0x450c62));};AGIChannel[_0x43c0('0x21')][_0x43c0('0x38')]=function(_0x4fa430,_0x537276,_0x26ed59){_0x537276=_0x537276||this['extension'];_0x26ed59=_0x26ed59||0x1;this['setContext'](_0x4fa430);this[_0x43c0('0x39')](_0x537276);this[_0x43c0('0x3a')](_0x26ed59);return this['noop'](util[_0x43c0('0x26')]('GOTO\x20%s\x20%s\x20%s',_0x4fa430,_0x537276,_0x26ed59));};AGIChannel[_0x43c0('0x21')][_0x43c0('0x3b')]=function(_0x1d3ef7){return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x3c'),_0x1d3ef7));};AGIChannel[_0x43c0('0x21')][_0x43c0('0x3d')]=function(_0x437ae9,_0x2088ed,_0x11e23d,_0x6d5913,_0x64e1f2,_0x489c0a){_0x2088ed=_0x2088ed||_0x43c0('0x3e');_0x11e23d=_0x11e23d||'';_0x6d5913=_0x6d5913===undefined?-0x1:_0x6d5913==='-1'?-0x1:_0x6d5913*0x3e8;_0x64e1f2=_0x64e1f2===undefined?'':'s='+_0x64e1f2;_0x489c0a=_0x489c0a?_0x43c0('0x3f'):'';return this[_0x43c0('0x22')](util[_0x43c0('0x26')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x437ae9,_0x2088ed,_0x11e23d,_0x6d5913,_0x489c0a,_0x64e1f2));};AGIChannel[_0x43c0('0x21')]['streamFile']=function(_0x31dca4,_0x498c3c){_0x498c3c=_0x498c3c||'';return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x40'),_0x31dca4,_0x498c3c));};AGIChannel['prototype'][_0x43c0('0x41')]=function(_0x120952){return this[_0x43c0('0x2b')](_0x43c0('0x42'),_0x120952);};AGIChannel['prototype'][_0x43c0('0x43')]=function(_0x3abc2a){return this[_0x43c0('0x2b')]('WAIT',_0x3abc2a);};AGIChannel[_0x43c0('0x21')][_0x43c0('0x16')]=function(_0x496f84,_0x19ac3c){this[_0x43c0('0x28')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x496f84['id'],_0x496f84['label'],_0x19ac3c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x43c0('0x44')]=AGIChannel; \ No newline at end of file +var _0x66da=['WAIT','exports','util','lodash','events','EventEmitter','call','utf8','setTimeout','setEncoding','headers','emit','ready','line','toLowerCase','hangup','520\x20End\x20of\x20proper','substring','replace','indexOf','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits','sendRequest','sync','prototype','answer','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI'];(function(_0x35f4f3,_0x5061f1){var _0x581075=function(_0x59681d){while(--_0x59681d){_0x35f4f3['push'](_0x35f4f3['shift']());}};_0x581075(++_0x5061f1);}(_0x66da,0x16f));var _0xa66d=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0x66da[_0x186d17];return _0x5d4b89;};'use strict';var util=require(_0xa66d('0x0'));var _=require(_0xa66d('0x1'));var EventEmitter=require(_0xa66d('0x2'))[_0xa66d('0x3')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x4f873c){var _0x17b831=this,_0x950036=new AGIReply(),_0x1326e8=![],_0x436606={};EventEmitter[_0xa66d('0x4')](_0x17b831);_0x4f873c['setEncoding'](_0xa66d('0x5'));_0x4f873c[_0xa66d('0x6')](0x8*0x3c*0x3c*0x3e8);_0x950036[_0xa66d('0x7')](_0xa66d('0x5'));_0x950036['on'](_0xa66d('0x8'),function(_0x28f57f){for(var _0x35debc in _0x28f57f){_0x17b831[_0x35debc]=_0x28f57f[_0x35debc];}_0x17b831[_0xa66d('0x9')](_0xa66d('0xa'));});_0x950036['on'](_0xa66d('0xb'),function(_0x22b38f){if(_0x22b38f[_0xa66d('0xc')]()=='hangup'){_0x17b831[_0xa66d('0x9')](_0xa66d('0xd'));return;}if(_0x22b38f['substring'](0x0,0xb)=='520-Invalid'){_0x1326e8=!![];}if(_0x1326e8){_0x436606['rx']+=_0x22b38f+'\x0a';if(_0x22b38f['search'](_0xa66d('0xe'))!=-0x1){_0x1326e8=![];}}else{_0x436606['rx']=_0x22b38f;}if(_0x1326e8){return;}if(typeof _0x436606['cb']=='function'){var _0x1bcde6=_0x436606['rx'][_0xa66d('0xf')](0x0,0x3),_0x59ddee=null,_0x2a75f8=null;_0x1bcde6=parseInt(_0x1bcde6);if(isNaN(_0x1bcde6)){_0x436606['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x1bcde6!=0xc8){_0x436606['cb'](null,{'code':_0x1bcde6,'result':-0x1,'extra':'KO'});return;}_0x59ddee=_0x436606['rx'][_0xa66d('0xf')](0x4)[_0xa66d('0x10')]('result=','');if(_0x59ddee[_0xa66d('0x11')]('\x20')!=-0x1){_0x59ddee=_0x59ddee['substr'](0x0,_0x59ddee[_0xa66d('0x11')]('\x20'));}if(_['startsWith'](_0x59ddee,'-1')){_0x59ddee=parseInt(_0x59ddee);}_0x2a75f8=_0x436606['rx'][_0xa66d('0x12')]('\x20');if(_0x2a75f8[_0xa66d('0x13')]==0x3){_0x2a75f8=_0x2a75f8[0x2]['substring'](0x1,_0x2a75f8[0x2][_0xa66d('0x13')]-0x1);}else if(_0x2a75f8[_0xa66d('0x13')]>0x3){var _0x15191c=/\((.+)\)/;var _0x23cbcd=_0x436606['rx'][_0xa66d('0x14')](_0x15191c);if(_0x23cbcd){_0x2a75f8=_0x23cbcd[0x1];}else{_0x2a75f8=null;}}else{_0x2a75f8=null;}_0x436606['cb'](null,{'code':_0x1bcde6,'result':_0x59ddee,'extra':_0x2a75f8});}});_0x4f873c['on']('error',function(_0x109eb4){_0x17b831['emit'](_0xa66d('0x15'),new AGIError(_0xa66d('0x16'),_0x109eb4['code']));});_0x4f873c['on'](_0xa66d('0x17'),function(){_0x17b831[_0xa66d('0x9')](_0xa66d('0x17'),new AGIError(_0xa66d('0x18')));});_0x4f873c['on']('timeout',function(){_0x17b831[_0xa66d('0x9')](_0xa66d('0x19'),new AGIError(_0xa66d('0x1a')));_0x4f873c[_0xa66d('0x1b')]();});_0x4f873c[_0xa66d('0x1c')](_0x950036);this[_0xa66d('0x1d')]=function(_0x4b7f9f,_0x2cc4a3){var _0x4b7f9f=_0x4b7f9f||'',_0x2cc4a3=typeof _0x2cc4a3==_0xa66d('0x1e')?_0x2cc4a3:new Function();_0x436606={'tx':_0x4b7f9f,'rx':'','cb':_0x2cc4a3};_0x4f873c[_0xa66d('0x1f')](_0x4b7f9f+'\x0a');},this[_0xa66d('0x17')]=function(){_0x4f873c[_0xa66d('0x1b')]();};}util[_0xa66d('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xa66d('0x21')]=function(_0x49f869){return this[_0xa66d('0x1d')][_0xa66d('0x22')](this,_0x49f869);};AGIChannel[_0xa66d('0x23')][_0xa66d('0x24')]=function(){return this[_0xa66d('0x21')]('ANSWER');};AGIChannel['prototype'][_0xa66d('0x25')]=function(_0x718831,_0x5da390,_0x41b563){_0x718831=_0x718831===undefined?'beep':_0x718831;_0x5da390=_0x5da390===undefined?'5':_0x5da390;_0x41b563=_0x41b563===undefined?'1':_0x41b563;return this[_0xa66d('0x21')](util[_0xa66d('0x26')](_0xa66d('0x27'),_0x718831,_0x5da390*0x3e8,_0x41b563));};AGIChannel[_0xa66d('0x23')][_0xa66d('0x28')]=function(_0x582bdb){_0x582bdb=_0x582bdb||_0xa66d('0x29');return this[_0xa66d('0x21')](util[_0xa66d('0x26')](_0xa66d('0x2a'),_0x582bdb));};AGIChannel[_0xa66d('0x23')][_0xa66d('0x2b')]=function(_0x4037ba,_0x2e13b3){if(_['isArray'](_0x2e13b3)){return this[_0xa66d('0x21')](util[_0xa66d('0x26')](_0xa66d('0x2c'),_0x4037ba,_0x2e13b3['join'](',')));}return this[_0xa66d('0x21')](util['format'](_0xa66d('0x2c'),_0x4037ba,_0x2e13b3));};AGIChannel['prototype'][_0xa66d('0x2d')]=function(_0x234c93){return this[_0xa66d('0x21')](util[_0xa66d('0x26')](_0xa66d('0x2e'),_0x234c93));};AGIChannel[_0xa66d('0x23')][_0xa66d('0x2f')]=function(_0x423342){return this['sendRequest'](util[_0xa66d('0x26')](_0xa66d('0x30'),_0x423342));};AGIChannel[_0xa66d('0x23')][_0xa66d('0x31')]=function(_0x2b3707){return this[_0xa66d('0x21')](util[_0xa66d('0x26')](_0xa66d('0x32'),_0x2b3707));};AGIChannel['prototype'][_0xa66d('0xd')]=function(){return this[_0xa66d('0x21')]('HANGUP');};AGIChannel[_0xa66d('0x23')][_0xa66d('0x33')]=function(_0x3ad813,_0x485773){var _0x88b1d8=_[_0xa66d('0x34')](_0x485773)||_['isNumber'](_0x485773)?_0x485773['toString']():_0x485773;return this['sendRequest'](util['format'](_0xa66d('0x35'),_0x3ad813,_0x88b1d8?_0x88b1d8[_0xa66d('0x36')]()[_0xa66d('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xa66d('0x23')][_0xa66d('0x37')]=function(_0x49fa85,_0x52dc36){return this['sendRequest'](util['format'](_0xa66d('0x38'),_0x49fa85,_0x52dc36));};AGIChannel[_0xa66d('0x23')][_0xa66d('0x39')]=function(_0x1cc0f4,_0x2505d0){return this[_0xa66d('0x21')](util[_0xa66d('0x26')](_0xa66d('0x3a'),_0x1cc0f4,_0x2505d0));};AGIChannel['prototype'][_0xa66d('0x3b')]=function(_0x58d1ce,_0x33d32d){return this[_0xa66d('0x21')](util[_0xa66d('0x26')](_0xa66d('0x3c'),_0x58d1ce,_0x33d32d));};AGIChannel[_0xa66d('0x23')]['continueAt']=function(_0xd1383f,_0x4a0bfc,_0x58d3c8){_0x4a0bfc=_0x4a0bfc||this[_0xa66d('0x3d')];_0x58d3c8=_0x58d3c8||0x1;this[_0xa66d('0x2d')](_0xd1383f);this[_0xa66d('0x2f')](_0x4a0bfc);this[_0xa66d('0x31')](_0x58d3c8);return this[_0xa66d('0x28')](util['format'](_0xa66d('0x3e'),_0xd1383f,_0x4a0bfc,_0x58d3c8));};AGIChannel['prototype'][_0xa66d('0x3f')]=function(_0x5a83d1){return this[_0xa66d('0x21')](util[_0xa66d('0x26')]('GET\x20VARIABLE\x20\x22%s\x22',_0x5a83d1));};AGIChannel[_0xa66d('0x23')][_0xa66d('0x40')]=function(_0x3fb1d5,_0x315bca,_0x5c148d,_0x1ed81f,_0xb203ba,_0x5d6c8c){_0x315bca=_0x315bca||_0xa66d('0x41');_0x5c148d=_0x5c148d||'';_0x1ed81f=_0x1ed81f===undefined?-0x1:_0x1ed81f==='-1'?-0x1:_0x1ed81f*0x3e8;_0xb203ba=_0xb203ba===undefined?'':'s='+_0xb203ba;_0x5d6c8c=_0x5d6c8c?_0xa66d('0x42'):'';return this[_0xa66d('0x21')](util[_0xa66d('0x26')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3fb1d5,_0x315bca,_0x5c148d,_0x1ed81f,_0x5d6c8c,_0xb203ba));};AGIChannel[_0xa66d('0x23')][_0xa66d('0x43')]=function(_0x1f981c,_0x297284){_0x297284=_0x297284||'';return this['sendRequest'](util[_0xa66d('0x26')](_0xa66d('0x44'),_0x1f981c,_0x297284));};AGIChannel[_0xa66d('0x23')][_0xa66d('0x45')]=function(_0x1f3a92){return this[_0xa66d('0x2b')](_0xa66d('0x46'),_0x1f3a92);};AGIChannel[_0xa66d('0x23')]['wait']=function(_0xe6efd9){return this[_0xa66d('0x2b')](_0xa66d('0x47'),_0xe6efd9);};AGIChannel[_0xa66d('0x23')][_0xa66d('0x15')]=function(_0x23fdf7,_0x20ca2e){this[_0xa66d('0x28')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x23fdf7['id'],_0x23fdf7['label'],_0x20ca2e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xa66d('0x48')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 8f80aaa..4b5e899 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 _0xcf25=['name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf25,0x1d2));var _0x5cf2=function(_0x423024,_0x928def){_0x423024=_0x423024-0x0;var _0x3a02a2=_0xcf25[_0x423024];return _0x3a02a2;};'use strict';var util=require(_0x5cf2('0x0'));var error={'E_AGI_UNDEFINED':_0x5cf2('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x5cf2('0x2'),'E_AGI_SERVER_CLOSE':_0x5cf2('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x5cf2('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x5cf2('0x5'),'E_AGI_SOCKET_CLOSE':_0x5cf2('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x5cf2('0x7'),'E_AGI_COMMAND_EMPTY':_0x5cf2('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x375dd9){var _0x375dd9=_0x375dd9||null,_0x15fc47=_0x15fc47||[],_0x24ae5d=0x1,_0x274be6='';if(!error[_0x375dd9]){_0x375dd9=_0x5cf2('0x9');}_0x15fc47[_0x5cf2('0xa')](error[_0x375dd9]);while(arguments[_0x24ae5d]){_0x15fc47['push'](arguments[_0x24ae5d]);_0x24ae5d++;}_0x274be6=util[_0x5cf2('0xb')][_0x5cf2('0xc')](util,_0x15fc47);this[_0x5cf2('0xd')]=_0x274be6;this[_0x5cf2('0xe')]=_0x375dd9;}module[_0x5cf2('0xf')]=AGIError; \ No newline at end of file +var _0xacbf=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.'];(function(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_0xacbf,0x1a0));var _0xfacb=function(_0x259d6b,_0x2efc49){_0x259d6b=_0x259d6b-0x0;var _0x5e3636=_0xacbf[_0x259d6b];return _0x5e3636;};'use strict';var util=require(_0xfacb('0x0'));var error={'E_AGI_UNDEFINED':_0xfacb('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xfacb('0x2'),'E_AGI_SERVER_CLOSE':_0xfacb('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xfacb('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xfacb('0x5'),'E_AGI_SOCKET_CLOSE':_0xfacb('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xfacb('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xfacb('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x2b279e){var _0x2b279e=_0x2b279e||null,_0x5965aa=_0x5965aa||[],_0x17ae62=0x1,_0x262e7b='';if(!error[_0x2b279e]){_0x2b279e=_0xfacb('0x9');}_0x5965aa[_0xfacb('0xa')](error[_0x2b279e]);while(arguments[_0x17ae62]){_0x5965aa['push'](arguments[_0x17ae62]);_0x17ae62++;}_0x262e7b=util['format'][_0xfacb('0xb')](util,_0x5965aa);this[_0xfacb('0xc')]=_0x262e7b;this[_0xfacb('0xd')]=_0x2b279e;}module[_0xfacb('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 827b181..d79542d 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 _0x38d0=['exports','../../../config/logger','agi','menu','getsecretdigits','vertices','prototype','addEdge','edges','push','numberOfEdges','size','relations','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','condition','split','agicommand','vswitch','default','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found'];(function(_0x5e1055,_0xc7fdc9){var _0x39da39=function(_0x37649f){while(--_0x37649f){_0x5e1055['push'](_0x5e1055['shift']());}};_0x39da39(++_0xc7fdc9);}(_0x38d0,0x123));var _0x038d=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x38d0[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require('lodash');var logger=require(_0x038d('0x0'))(_0x038d('0x1'));var verticesWithRetry=[_0x038d('0x2'),'getdigits',_0x038d('0x3')];var Graph=function(){this[_0x038d('0x4')]={};this['edges']={};this['numberOfEdges']=0x0;};Graph[_0x038d('0x5')]['addVertex']=function(_0x26ae55){this[_0x038d('0x4')][_0x26ae55['id']]=_0x26ae55;this['edges'][_0x26ae55['id']]=[];};Graph[_0x038d('0x5')][_0x038d('0x6')]=function(_0x434026,_0x76bc10,_0x22d8ab){this[_0x038d('0x7')][_0x434026][_0x038d('0x8')]({'target':_0x76bc10,'condition':_0x22d8ab});this[_0x038d('0x9')]+=0x1;};Graph[_0x038d('0x5')][_0x038d('0xa')]=function(){return _[_0x038d('0xa')](this[_0x038d('0x4')]);};Graph['prototype'][_0x038d('0xb')]=function(){return this[_0x038d('0x9')];};Graph[_0x038d('0x5')]['getVertex']=function(_0x292b7f){return this[_0x038d('0x4')][_0x292b7f];};Graph[_0x038d('0x5')][_0x038d('0xc')]=function(_0x12c34d,_0x114250){if(!this[_0x038d('0x4')][_0x12c34d]){return logger[_0x038d('0xd')](_0x038d('0xe'));}var _0x4e78d3=_0x114250(this['vertices'][_0x12c34d]);if(!_0x4e78d3){return logger['info'](_0x038d('0xf'));}if(this[_0x038d('0x7')][_0x12c34d]['length']===0x0){return logger['info']('no\x20edge/s\x20available');}for(var _0x483822=0x0,_0x1be3f6=[],_0x748d51=![];_0x483822\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','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','sync','production','start','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','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','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','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','xml2json','syncho','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./vertices','agi','defaults','nextTick','error','log','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','format','[%s]\x20%s','message','[ERROR]\x20%s'];(function(_0x1474fd,_0x30b9aa){var _0x1b76e3=function(_0x380cd9){while(--_0x380cd9){_0x1474fd['push'](_0x1474fd['shift']());}};_0x1b76e3(++_0x30b9aa);}(_0xfbf0,0x1bc));var _0x0fbf=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xfbf0[_0x455c6c];return _0x488242;};'use strict';var parser=require(_0x0fbf('0x0'));var _=require('lodash');var syncho=require(_0x0fbf('0x1'));var util=require('util');var moment=require(_0x0fbf('0x2'));var config=require(_0x0fbf('0x3'));var logger=require(_0x0fbf('0x4'))('agi');var utilLicense=require(_0x0fbf('0x5'));var rpc=require(_0x0fbf('0x6'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0x0fbf('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x0fbf('0x8')]=_[_0x0fbf('0x9')](config[_0x0fbf('0x8')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x157927){process[_0x0fbf('0xa')](function(){syncho(function(){try{setChannelVariables(_0x157927);agiHandler(_0x157927);}catch(_0x3fbab5){logger[_0x0fbf('0xb')](_0x3fbab5['stack']);}});});}function listeningHandler(){console[_0x0fbf('0xc')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x0fbf('0xd')]);logger[_0x0fbf('0xe')](util['format'](_0x0fbf('0xf'),config[_0x0fbf('0x8')]['ip'],config[_0x0fbf('0x8')][_0x0fbf('0xd')]));}function errorHandler(_0x514ba2){if(_0x514ba2&&_0x514ba2[_0x0fbf('0x10')]&&_0x514ba2['message']){logger[_0x0fbf('0xb')](util[_0x0fbf('0x11')](_0x0fbf('0x12'),_0x514ba2[_0x0fbf('0x10')],_0x514ba2[_0x0fbf('0x13')]));}else{logger[_0x0fbf('0xb')](util[_0x0fbf('0x11')](_0x0fbf('0x14'),_0x514ba2[_0x0fbf('0x15')]));}}function closeHandler(){logger[_0x0fbf('0xe')](util[_0x0fbf('0x11')](_0x0fbf('0x16'),this[_0x0fbf('0x17')],this[_0x0fbf('0x18')],this[_0x0fbf('0x19')],this[_0x0fbf('0x1a')],this[_0x0fbf('0x1b')]));try{createSquareReport(this);}catch(_0x4d88a7){logger[_0x0fbf('0xb')](_0x4d88a7[_0x0fbf('0x15')]);}}function timeoutHandler(){logger['info'](util['format'](_0x0fbf('0x1c'),this[_0x0fbf('0x17')],this[_0x0fbf('0x18')],this[_0x0fbf('0x19')],this[_0x0fbf('0x1a')],this[_0x0fbf('0x1b')]));}function hangupHandler(){logger[_0x0fbf('0xe')](util[_0x0fbf('0x11')](_0x0fbf('0x1d'),this['arg_1'],this[_0x0fbf('0x18')],this[_0x0fbf('0x19')],this['dnid'],this[_0x0fbf('0x1b')]));this[_0x0fbf('0x1e')]=!![];}function getRoot(_0xc720d6){return parser[_0x0fbf('0x1f')](_0xc720d6,{'object':!![]})[_0x0fbf('0x20')][_0x0fbf('0x21')];}function addVertex(_0x5919e8,_0x2f0518,_0x453393){_0x2f0518[_0x0fbf('0x22')]=_0x453393;if(_0x2f0518[_0x0fbf('0x23')]('retry')){_0x2f0518[_0x0fbf('0x24')]=parseInt(_0x2f0518[_0x0fbf('0x25')],0xa);}_0x5919e8[_0x0fbf('0x26')](_[_0x0fbf('0x27')](_0x2f0518,'mxCell'));}function initGraph(_0x1aba7e,_0x641723){var _0x20f355=new Graph();for(var _0x3b271e in _0x1aba7e){if(_0x1aba7e['hasOwnProperty'](_0x3b271e)){if(_[_0x0fbf('0x28')](_0x1aba7e[_0x3b271e])){for(var _0x22c42e=0x0;_0x22c42e<_0x1aba7e[_0x3b271e][_0x0fbf('0x29')];_0x22c42e+=0x1){addVertex(_0x20f355,_0x1aba7e[_0x3b271e][_0x22c42e],_0x3b271e);}}else{addVertex(_0x20f355,_0x1aba7e[_0x3b271e],_0x3b271e);}}}for(var _0x411c08=0x0;_0x411c08<_0x641723[_0x0fbf('0x29')];_0x411c08+=0x1){if(_0x641723[_0x411c08]['source']&&_0x641723[_0x411c08][_0x0fbf('0x2a')]){_0x20f355[_0x0fbf('0x2b')](_0x641723[_0x411c08][_0x0fbf('0x2c')],_0x641723[_0x411c08][_0x0fbf('0x2a')],_0x641723[_0x411c08][_0x0fbf('0x2d')]);}}return _0x20f355;}function getSquareProject(_0x1590c3,_0x1dfb8f){rpc[_0x0fbf('0x2e')](_0x1590c3)[_0x0fbf('0x2f')](function(_0x57284f){_0x1dfb8f(null,_0x57284f);})[_0x0fbf('0x30')](function(_0x66b8a){_0x1dfb8f(null,_0x66b8a);});}function createSquareReport(_0x43e632,_0x568fa8){rpc[_0x0fbf('0x31')](_0x43e632)[_0x0fbf('0x2f')](function(_0x1ba855){if(_0x568fa8){_0x568fa8(null,_0x1ba855);}})[_0x0fbf('0x30')](function(_0x2f6ce9){if(_0x568fa8){_0x568fa8(null,_0x2f6ce9);}});}function setChannelVariables(_0xaef7f7){for(var _0x4cb333 in _0xaef7f7){if(_0xaef7f7[_0x0fbf('0x23')](_0x4cb333)){if(_0x4cb333[_0x0fbf('0x32')](_0x0fbf('0x33'))===0x0){_0xaef7f7[_0x4cb333[_0x0fbf('0x34')](0x4)]=_0xaef7f7[_0x4cb333];delete _0xaef7f7[_0x4cb333];}}}}function getLogFromObject(_0x20c8ed){return util[_0x0fbf('0x35')](_0x20c8ed,{'showHidden':![],'depth':null});}function agiHandler(_0x804db6){var _0x19c04d,_0x4782e9,_0x483788,_0x1c3dfd,_0x49a7c5;logger['debug'](_0x0fbf('0x36'),JSON[_0x0fbf('0x37')](_0x804db6,null,0x2));logger[_0x0fbf('0xe')](util['format'](_0x0fbf('0x38'),_0x804db6[_0x0fbf('0x17')],_0x804db6['calleridname'],_0x804db6[_0x0fbf('0x19')],_0x804db6['dnid'],_0x804db6[_0x0fbf('0x1b')]));_0x804db6['on'](_0x0fbf('0xb'),errorHandler);_0x804db6['on'](_0x0fbf('0x39'),closeHandler);_0x804db6['on']('timeout',timeoutHandler);_0x804db6[_0x0fbf('0x1e')]=![];_0x804db6['on']('hangup',hangupHandler);var _0x2ff92e=getSquareProject[_0x0fbf('0x3a')](null,_0x804db6['arg_1']);if(_0x2ff92e){if(_0x2ff92e['production']){_0x19c04d=getRoot(_0x2ff92e[_0x0fbf('0x3b')]);if(_0x19c04d&&_0x19c04d[_0x0fbf('0x3c')]){logger[_0x0fbf('0x3d')](_0x0fbf('0x21'),JSON[_0x0fbf('0x37')](_0x19c04d,null,0x2));_0x804db6[_0x0fbf('0x3e')]=moment()[_0x0fbf('0x11')](_0x0fbf('0x3f'));_0x4782e9=initGraph(_['omit'](_0x19c04d,_0x0fbf('0x40')),_0x19c04d[_0x0fbf('0x40')]);_0x483788=new Vertices(_0x804db6,rpc,mailRpc);logger[_0x0fbf('0xe')](util[_0x0fbf('0x11')](_0x0fbf('0x41'),_0x804db6[_0x0fbf('0x17')],_0x804db6[_0x0fbf('0x18')],_0x804db6[_0x0fbf('0x19')],_0x804db6[_0x0fbf('0x1a')],_0x804db6['uniqueid']));_0x4782e9[_0x0fbf('0x42')](_0x19c04d[_0x0fbf('0x3c')]['id'],function(_0x5a37b7){try{_0x5a37b7=_0x483788[_0x0fbf('0x43')](_0x5a37b7);logger[_0x0fbf('0x3d')]('vertex',JSON[_0x0fbf('0x37')](_0x5a37b7,null,0x2));if(_0x5a37b7['agicommand']===_0x0fbf('0x44')){logger[_0x0fbf('0xe')](_0x0fbf('0x45'));_0x804db6[_0x0fbf('0x46')]=_0x5a37b7['context']||_0x804db6[_0x0fbf('0x46')];_0x804db6['extension']=_0x5a37b7[_0x0fbf('0x47')];_0x804db6[_0x0fbf('0x48')]=_0x5a37b7[_0x0fbf('0x48')]?_0x5a37b7['priority']-0x1:0x1;return null;}else if(_0x5a37b7&&_0x483788[_0x5a37b7['agicommand']]){_0x49a7c5=_0x483788[_0x5a37b7[_0x0fbf('0x22')]](_0x5a37b7);logger[_0x0fbf('0xe')](_0x0fbf('0x49'),JSON[_0x0fbf('0x37')](_0x49a7c5,null,0x2));if(_0x49a7c5&&_0x49a7c5['code']===AGI_CODE_SUCCESS&&_0x49a7c5[_0x0fbf('0x4a')]!==AGI_RESULT_ERROR&&!_0x804db6[_0x0fbf('0x1e')]){logger[_0x0fbf('0x3d')](_0x0fbf('0x49'),getLogFromObject(_0x49a7c5));return _[_0x0fbf('0x4b')](_0x49a7c5['result'])?null:_0x49a7c5[_0x0fbf('0x4a')][_0x0fbf('0x4c')]();}else{logger['error'](_0x0fbf('0x49'),getLogFromObject(_0x49a7c5));return null;}}else{logger[_0x0fbf('0xb')](_0x0fbf('0x4d'));return null;}}catch(_0x2f226a){logger[_0x0fbf('0xb')](_0x2f226a[_0x0fbf('0x15')]);return null;}});if(_0x19c04d[_0x0fbf('0x4e')]){logger[_0x0fbf('0xe')](util['format'](_0x0fbf('0x4f'),_0x804db6[_0x0fbf('0x17')],_0x804db6[_0x0fbf('0x18')],_0x804db6[_0x0fbf('0x19')],_0x804db6['dnid'],_0x804db6[_0x0fbf('0x1b')]));_0x4782e9[_0x0fbf('0x42')](_0x19c04d[_0x0fbf('0x4e')]['id'],function(_0x2c6094){try{_0x2c6094=_0x483788[_0x0fbf('0x43')](_0x2c6094);logger['debug'](_0x0fbf('0x50'),JSON[_0x0fbf('0x37')](_0x2c6094,null,0x2));if(_0x2c6094&&_0x483788[_0x2c6094['agicommand']]){_0x49a7c5=_0x483788[_0x2c6094[_0x0fbf('0x22')]](_0x2c6094);if(_0x49a7c5){logger[_0x0fbf('0x3d')]('response',getLogFromObject(_0x49a7c5));return _['isUndefined'](_0x49a7c5['result'])?null:_0x49a7c5[_0x0fbf('0x4a')][_0x0fbf('0x4c')]();}else{logger[_0x0fbf('0xb')](_0x0fbf('0x49'),getLogFromObject(_0x49a7c5));return null;}}else{logger['error'](_0x0fbf('0x4d'));return null;}}catch(_0x21b7bd){logger[_0x0fbf('0xb')](_0x21b7bd[_0x0fbf('0x15')]);return null;}});}logger[_0x0fbf('0xe')](util['format'](_0x0fbf('0x51'),_0x804db6[_0x0fbf('0x17')],_0x804db6['calleridname'],_0x804db6[_0x0fbf('0x19')],_0x804db6[_0x0fbf('0x1a')],_0x804db6[_0x0fbf('0x1b')]));logger['info'](util[_0x0fbf('0x11')](_0x0fbf('0x52'),_0x804db6[_0x0fbf('0x46')],_0x804db6['extension'],parseInt(_0x804db6[_0x0fbf('0x48')],0xa)+0x1));_0x804db6['continueAt'](_0x804db6[_0x0fbf('0x46')],_0x804db6[_0x0fbf('0x47')],parseInt(_0x804db6[_0x0fbf('0x48')],0xa)+0x1);_0x804db6[_0x0fbf('0x39')]();}}else{logger[_0x0fbf('0xb')](util[_0x0fbf('0x11')]('Project\x20%s\x20not\x20published',_0x804db6[_0x0fbf('0x17')]));_0x804db6[_0x0fbf('0x53')](_0x804db6[_0x0fbf('0x46')],_0x804db6[_0x0fbf('0x47')],parseInt(_0x804db6[_0x0fbf('0x48')],0xa)+0x1);_0x804db6['close']();}}else{logger[_0x0fbf('0xb')](util[_0x0fbf('0x11')]('Project\x20%s\x20not\x20found',_0x804db6[_0x0fbf('0x17')]));_0x804db6[_0x0fbf('0x53')](_0x804db6[_0x0fbf('0x46')],_0x804db6[_0x0fbf('0x47')],parseInt(_0x804db6[_0x0fbf('0x48')],0xa)+0x1);_0x804db6[_0x0fbf('0x39')]();}}function main(){var _0x43adf2;return utilLicense[_0x0fbf('0x54')]()[_0x0fbf('0x2f')](function(_0x3a543f){if(_0x3a543f){if(_0x3a543f[_0x0fbf('0x55')]){if(_0x3a543f[_0x0fbf('0x56')]&&_0x3a543f[_0x0fbf('0x56')]>0x0){logger[_0x0fbf('0xe')](util['format'](_0x0fbf('0x57'),_0x3a543f['callysquare']));_0x43adf2=_0x3a543f[_0x0fbf('0x56')];}else{logger['info'](_0x0fbf('0x58'));}}else{logger[_0x0fbf('0xe')](_0x0fbf('0x59'));_0x43adf2=-0x1;}}})[_0x0fbf('0x30')](function(_0x4cf600){logger[_0x0fbf('0xb')](_0x0fbf('0x5a'),_0x4cf600[_0x0fbf('0x15')]);})['finally'](function(){var _0x43c49e=require('./server')(config[_0x0fbf('0x8')][_0x0fbf('0xd')],config['agi']['ip'],_0x43adf2);_0x43c49e['on'](_0x0fbf('0xb'),errorHandler);_0x43c49e['on'](_0x0fbf('0x5b'),listeningHandler);_0x43c49e['on'](_0x0fbf('0x5c'),connectionHandler);_0x43c49e['on'](_0x0fbf('0x39'),closeHandler);});}main(); \ No newline at end of file +var _0xa18c=['agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','response','result','isUndefined','toString','agicommand\x20not\x20found','finally','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','xml2json','syncho','util','moment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','root','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','getSquareProject','then','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa18c,0x7e));var _0xca18=function(_0x22d122,_0xc9f00a){_0x22d122=_0x22d122-0x0;var _0x1e8995=_0xa18c[_0x22d122];return _0x1e8995;};'use strict';var parser=require(_0xca18('0x0'));var _=require('lodash');var syncho=require(_0xca18('0x1'));var util=require(_0xca18('0x2'));var moment=require(_0xca18('0x3'));var config=require('../../config/environment');var logger=require(_0xca18('0x4'))('agi');var utilLicense=require(_0xca18('0x5'));var rpc=require(_0xca18('0x6'));var mailRpc=require(_0xca18('0x7'));var Graph=require(_0xca18('0x8'));var Vertices=require(_0xca18('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xca18('0xa')]=_[_0xca18('0xb')](config[_0xca18('0xa')],{'ip':_0xca18('0xc'),'port':0x11dd});function connectionHandler(_0x4be116){process[_0xca18('0xd')](function(){syncho(function(){try{setChannelVariables(_0x4be116);agiHandler(_0x4be116);}catch(_0x4cfc2f){logger[_0xca18('0xe')](_0x4cfc2f[_0xca18('0xf')]);}});});}function listeningHandler(){console['log'](_0xca18('0x10'),config[_0xca18('0xa')][_0xca18('0x11')]);logger['info'](util[_0xca18('0x12')](_0xca18('0x13'),config[_0xca18('0xa')]['ip'],config[_0xca18('0xa')][_0xca18('0x11')]));}function errorHandler(_0x51f10f){if(_0x51f10f&&_0x51f10f[_0xca18('0x14')]&&_0x51f10f['message']){logger['error'](util['format'](_0xca18('0x15'),_0x51f10f[_0xca18('0x14')],_0x51f10f[_0xca18('0x16')]));}else{logger[_0xca18('0xe')](util[_0xca18('0x12')](_0xca18('0x17'),_0x51f10f[_0xca18('0xf')]));}}function closeHandler(){logger[_0xca18('0x18')](util[_0xca18('0x12')](_0xca18('0x19'),this[_0xca18('0x1a')],this[_0xca18('0x1b')],this['callerid'],this[_0xca18('0x1c')],this[_0xca18('0x1d')]));try{createSquareReport(this);}catch(_0x4a1e70){logger['error'](_0x4a1e70[_0xca18('0xf')]);}}function timeoutHandler(){logger[_0xca18('0x18')](util[_0xca18('0x12')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xca18('0x1a')],this['calleridname'],this[_0xca18('0x1e')],this[_0xca18('0x1c')],this['uniqueid']));}function hangupHandler(){logger[_0xca18('0x18')](util[_0xca18('0x12')](_0xca18('0x1f'),this[_0xca18('0x1a')],this[_0xca18('0x1b')],this['callerid'],this[_0xca18('0x1c')],this[_0xca18('0x1d')]));this[_0xca18('0x20')]=!![];}function getRoot(_0x1d4c82){return parser['toJson'](_0x1d4c82,{'object':!![]})['mxGraphModel'][_0xca18('0x21')];}function addVertex(_0x18b6a4,_0xe036c1,_0x4f1f61){_0xe036c1['agicommand']=_0x4f1f61;if(_0xe036c1[_0xca18('0x22')]('retry')){_0xe036c1[_0xca18('0x23')]=parseInt(_0xe036c1[_0xca18('0x24')],0xa);}_0x18b6a4[_0xca18('0x25')](_[_0xca18('0x26')](_0xe036c1,_0xca18('0x27')));}function initGraph(_0x28e7c5,_0x198347){var _0x62544c=new Graph();for(var _0x45b735 in _0x28e7c5){if(_0x28e7c5[_0xca18('0x22')](_0x45b735)){if(_[_0xca18('0x28')](_0x28e7c5[_0x45b735])){for(var _0x189042=0x0;_0x189042<_0x28e7c5[_0x45b735][_0xca18('0x29')];_0x189042+=0x1){addVertex(_0x62544c,_0x28e7c5[_0x45b735][_0x189042],_0x45b735);}}else{addVertex(_0x62544c,_0x28e7c5[_0x45b735],_0x45b735);}}}for(var _0x49a664=0x0;_0x49a664<_0x198347[_0xca18('0x29')];_0x49a664+=0x1){if(_0x198347[_0x49a664][_0xca18('0x2a')]&&_0x198347[_0x49a664][_0xca18('0x2b')]){_0x62544c[_0xca18('0x2c')](_0x198347[_0x49a664][_0xca18('0x2a')],_0x198347[_0x49a664]['target'],_0x198347[_0x49a664]['value']);}}return _0x62544c;}function getSquareProject(_0x1284ff,_0x4a928e){rpc[_0xca18('0x2d')](_0x1284ff)[_0xca18('0x2e')](function(_0x1cbdba){_0x4a928e(null,_0x1cbdba);})[_0xca18('0x2f')](function(_0xf3d2ab){_0x4a928e(null,_0xf3d2ab);});}function createSquareReport(_0x8acb17,_0x4080a8){rpc['createSquareReport'](_0x8acb17)[_0xca18('0x2e')](function(_0x555c69){if(_0x4080a8){_0x4080a8(null,_0x555c69);}})[_0xca18('0x2f')](function(_0x21a853){if(_0x4080a8){_0x4080a8(null,_0x21a853);}});}function setChannelVariables(_0xeac28b){for(var _0x134866 in _0xeac28b){if(_0xeac28b[_0xca18('0x22')](_0x134866)){if(_0x134866['indexOf'](_0xca18('0x30'))===0x0){_0xeac28b[_0x134866[_0xca18('0x31')](0x4)]=_0xeac28b[_0x134866];delete _0xeac28b[_0x134866];}}}}function getLogFromObject(_0x131174){return util['inspect'](_0x131174,{'showHidden':![],'depth':null});}function agiHandler(_0x2aa061){var _0x4eb922,_0x5e6705,_0x51815f,_0x2929c1,_0x315c2c;logger[_0xca18('0x32')](_0xca18('0x33'),JSON[_0xca18('0x34')](_0x2aa061,null,0x2));logger[_0xca18('0x18')](util[_0xca18('0x12')](_0xca18('0x35'),_0x2aa061[_0xca18('0x1a')],_0x2aa061[_0xca18('0x1b')],_0x2aa061['callerid'],_0x2aa061[_0xca18('0x1c')],_0x2aa061[_0xca18('0x1d')]));_0x2aa061['on'](_0xca18('0xe'),errorHandler);_0x2aa061['on'](_0xca18('0x36'),closeHandler);_0x2aa061['on'](_0xca18('0x37'),timeoutHandler);_0x2aa061[_0xca18('0x20')]=![];_0x2aa061['on'](_0xca18('0x38'),hangupHandler);var _0x1939a9=getSquareProject[_0xca18('0x39')](null,_0x2aa061[_0xca18('0x1a')]);if(_0x1939a9){if(_0x1939a9[_0xca18('0x3a')]){_0x4eb922=getRoot(_0x1939a9[_0xca18('0x3a')]);if(_0x4eb922&&_0x4eb922[_0xca18('0x3b')]){logger[_0xca18('0x32')](_0xca18('0x21'),JSON[_0xca18('0x34')](_0x4eb922,null,0x2));_0x2aa061['joinAt']=moment()[_0xca18('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e6705=initGraph(_['omit'](_0x4eb922,_0xca18('0x27')),_0x4eb922[_0xca18('0x27')]);_0x51815f=new Vertices(_0x2aa061,rpc,mailRpc);logger[_0xca18('0x18')](util[_0xca18('0x12')](_0xca18('0x3c'),_0x2aa061[_0xca18('0x1a')],_0x2aa061[_0xca18('0x1b')],_0x2aa061['callerid'],_0x2aa061[_0xca18('0x1c')],_0x2aa061[_0xca18('0x1d')]));_0x5e6705[_0xca18('0x3d')](_0x4eb922['start']['id'],function(_0x1338c6){try{_0x1338c6=_0x51815f['clear'](_0x1338c6);logger[_0xca18('0x32')](_0xca18('0x3e'),JSON['stringify'](_0x1338c6,null,0x2));if(_0x1338c6['agicommand']===_0xca18('0x3f')){logger['info'](_0xca18('0x40'));_0x2aa061[_0xca18('0x41')]=_0x1338c6[_0xca18('0x41')]||_0x2aa061[_0xca18('0x41')];_0x2aa061[_0xca18('0x42')]=_0x1338c6['extension'];_0x2aa061['priority']=_0x1338c6['priority']?_0x1338c6[_0xca18('0x43')]-0x1:0x1;return null;}else if(_0x1338c6&&_0x51815f[_0x1338c6[_0xca18('0x44')]]){_0x315c2c=_0x51815f[_0x1338c6[_0xca18('0x44')]](_0x1338c6);logger[_0xca18('0x18')](_0xca18('0x45'),JSON[_0xca18('0x34')](_0x315c2c,null,0x2));if(_0x315c2c&&_0x315c2c['code']===AGI_CODE_SUCCESS&&_0x315c2c[_0xca18('0x46')]!==AGI_RESULT_ERROR&&!_0x2aa061[_0xca18('0x20')]){logger['debug'](_0xca18('0x45'),getLogFromObject(_0x315c2c));return _[_0xca18('0x47')](_0x315c2c[_0xca18('0x46')])?null:_0x315c2c[_0xca18('0x46')][_0xca18('0x48')]();}else{logger['error'](_0xca18('0x45'),getLogFromObject(_0x315c2c));return null;}}else{logger['error'](_0xca18('0x49'));return null;}}catch(_0x5426ab){logger[_0xca18('0xe')](_0x5426ab[_0xca18('0xf')]);return null;}});if(_0x4eb922['finally']){logger[_0xca18('0x18')](util[_0xca18('0x12')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2aa061['arg_1'],_0x2aa061[_0xca18('0x1b')],_0x2aa061[_0xca18('0x1e')],_0x2aa061[_0xca18('0x1c')],_0x2aa061[_0xca18('0x1d')]));_0x5e6705[_0xca18('0x3d')](_0x4eb922[_0xca18('0x4a')]['id'],function(_0x1c601f){try{_0x1c601f=_0x51815f[_0xca18('0x4b')](_0x1c601f);logger[_0xca18('0x32')](_0xca18('0x3e'),JSON[_0xca18('0x34')](_0x1c601f,null,0x2));if(_0x1c601f&&_0x51815f[_0x1c601f['agicommand']]){_0x315c2c=_0x51815f[_0x1c601f[_0xca18('0x44')]](_0x1c601f);if(_0x315c2c){logger[_0xca18('0x32')](_0xca18('0x45'),getLogFromObject(_0x315c2c));return _[_0xca18('0x47')](_0x315c2c['result'])?null:_0x315c2c[_0xca18('0x46')][_0xca18('0x48')]();}else{logger['error']('response',getLogFromObject(_0x315c2c));return null;}}else{logger[_0xca18('0xe')]('agicommand\x20not\x20found');return null;}}catch(_0x401ca6){logger['error'](_0x401ca6[_0xca18('0xf')]);return null;}});}logger[_0xca18('0x18')](util[_0xca18('0x12')](_0xca18('0x4c'),_0x2aa061[_0xca18('0x1a')],_0x2aa061[_0xca18('0x1b')],_0x2aa061[_0xca18('0x1e')],_0x2aa061[_0xca18('0x1c')],_0x2aa061[_0xca18('0x1d')]));logger['info'](util['format'](_0xca18('0x4d'),_0x2aa061[_0xca18('0x41')],_0x2aa061[_0xca18('0x42')],parseInt(_0x2aa061['priority'],0xa)+0x1));_0x2aa061[_0xca18('0x4e')](_0x2aa061[_0xca18('0x41')],_0x2aa061[_0xca18('0x42')],parseInt(_0x2aa061[_0xca18('0x43')],0xa)+0x1);_0x2aa061[_0xca18('0x36')]();}}else{logger[_0xca18('0xe')](util[_0xca18('0x12')](_0xca18('0x4f'),_0x2aa061['arg_1']));_0x2aa061[_0xca18('0x4e')](_0x2aa061[_0xca18('0x41')],_0x2aa061[_0xca18('0x42')],parseInt(_0x2aa061[_0xca18('0x43')],0xa)+0x1);_0x2aa061[_0xca18('0x36')]();}}else{logger['error'](util[_0xca18('0x12')]('Project\x20%s\x20not\x20found',_0x2aa061[_0xca18('0x1a')]));_0x2aa061[_0xca18('0x4e')](_0x2aa061[_0xca18('0x41')],_0x2aa061['extension'],parseInt(_0x2aa061[_0xca18('0x43')],0xa)+0x1);_0x2aa061[_0xca18('0x36')]();}}function main(){var _0x2048ad;return utilLicense[_0xca18('0x50')]()['then'](function(_0x326a78){if(_0x326a78){if(_0x326a78[_0xca18('0x51')]){if(_0x326a78[_0xca18('0x52')]&&_0x326a78[_0xca18('0x52')]>0x0){logger['info'](util[_0xca18('0x12')](_0xca18('0x53'),_0x326a78[_0xca18('0x52')]));_0x2048ad=_0x326a78[_0xca18('0x52')];}else{logger[_0xca18('0x18')](_0xca18('0x54'));}}else{logger[_0xca18('0x18')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x2048ad=-0x1;}}})[_0xca18('0x2f')](function(_0x5aae00){logger[_0xca18('0xe')](_0xca18('0x55'),_0x5aae00['stack']);})[_0xca18('0x4a')](function(){var _0x1d984f=require(_0xca18('0x56'))(config[_0xca18('0xa')][_0xca18('0x11')],config[_0xca18('0xa')]['ip'],_0x2048ad);_0x1d984f['on'](_0xca18('0xe'),errorHandler);_0x1d984f['on']('listening',listeningHandler);_0x1d984f['on']('connection',connectionHandler);_0x1d984f['on'](_0xca18('0x36'),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 ac1455e..767c149 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 _0x72bc=['sendMailMessage','jayson/promise','client','http','result'];(function(_0x5f5be7,_0xadd206){var _0x467dcf=function(_0x5c4bec){while(--_0x5c4bec){_0x5f5be7['push'](_0x5f5be7['shift']());}};_0x467dcf(++_0xadd206);}(_0x72bc,0x13c));var _0xc72b=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x72bc[_0xbca1b1];return _0x4e1686;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xc72b('0x0'));var client=jayson[_0xc72b('0x1')][_0xc72b('0x2')]({'port':0x232b});function request(_0x2ceaa4,_0x44d796){return new BPromise(function(_0xb6d543,_0xc7bdd5){return client['request'](_0x2ceaa4,_0x44d796)['then'](function(_0x13cf09){if(_0x13cf09['error']){return _0xc7bdd5(_0x13cf09['error']['message']);}else{return _0xb6d543(_0x13cf09[_0xc72b('0x3')]);}})['catch'](function(_0x3cfdd9){return _0xc7bdd5(_0x3cfdd9);});});}exports[_0xc72b('0x4')]=function(_0x5227da,_0x36e8ba){return request('SendMail',{'account':_0x5227da,'message':_0x36e8ba});}; \ No newline at end of file +var _0x7447=['catch','sendMailMessage','bluebird','jayson/promise','client','request','error','message','result'];(function(_0x1058ed,_0x109d8d){var _0x4e4661=function(_0x2fc1df){while(--_0x2fc1df){_0x1058ed['push'](_0x1058ed['shift']());}};_0x4e4661(++_0x109d8d);}(_0x7447,0x122));var _0x7744=function(_0x598b6f,_0x55690f){_0x598b6f=_0x598b6f-0x0;var _0x40959f=_0x7447[_0x598b6f];return _0x40959f;};'use strict';var BPromise=require(_0x7744('0x0'));var jayson=require(_0x7744('0x1'));var client=jayson[_0x7744('0x2')]['http']({'port':0x232b});function request(_0x55bce9,_0x19d65d){return new BPromise(function(_0x7ec1f8,_0x36c4a3){return client[_0x7744('0x3')](_0x55bce9,_0x19d65d)['then'](function(_0x32de33){if(_0x32de33[_0x7744('0x4')]){return _0x36c4a3(_0x32de33[_0x7744('0x4')][_0x7744('0x5')]);}else{return _0x7ec1f8(_0x32de33[_0x7744('0x6')]);}})[_0x7744('0x7')](function(_0x3b82c8){return _0x36c4a3(_0x3b82c8);});});}exports[_0x7744('0x8')]=function(_0x56c59e,_0xcfc259){return request('SendMail',{'account':_0x56c59e,'message':_0xcfc259});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 09ea658..bd24a0d 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 _0x2488=['emit','headers','exports','util','stream','Transform','_localBuffer','_inBody','inherits','prototype','_transform','indexOf','substring','split','slice','trim','length'];(function(_0x29572b,_0x2210ef){var _0x1bbeeb=function(_0x104d3c){while(--_0x104d3c){_0x29572b['push'](_0x29572b['shift']());}};_0x1bbeeb(++_0x2210ef);}(_0x2488,0xf1));var _0x8248=function(_0x3cb9eb,_0x3fd4b9){_0x3cb9eb=_0x3cb9eb-0x0;var _0x4d5970=_0x2488[_0x3cb9eb];return _0x4d5970;};'use strict';var util=require(_0x8248('0x0'));var Transform=require(_0x8248('0x1'))[_0x8248('0x2')];function AGIReply(_0x41c180){Transform['call'](this,_0x41c180);this[_0x8248('0x3')]='';this[_0x8248('0x4')]=![];}util[_0x8248('0x5')](AGIReply,Transform);AGIReply[_0x8248('0x6')][_0x8248('0x7')]=function(_0x438cf3,_0x1f495d,_0x589840){var _0x18ce9a='\x0a',_0xabd544=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x424c68=-0x1,_0x215e42=-0x1,_0x2a94b2='',_0x4385bd=0x0,_0x4a6458='',_0x1ebc46='';this[_0x8248('0x3')]+=_0x438cf3['toString']();_0x4a6458=this[_0x8248('0x3')];if(!this[_0x8248('0x4')]){_0x4385bd=0x0;while(_0xabd544[_0x4385bd]){while((_0x215e42=_0x4a6458[_0x8248('0x8')](_0xabd544[_0x4385bd]))!=-0x1){_0x2a94b2=_0xabd544[_0x4385bd];_0x1ebc46=_0x4a6458[_0x8248('0x9')](0x0,_0x215e42);_0x4a6458=_0x4a6458[_0x8248('0x9')](_0x215e42+_0x2a94b2['length']);var _0x444c4a=_0x1ebc46[_0x8248('0xa')](_0x18ce9a),_0x101bfb=0x0,_0x119266={},_0x214382='',_0x692fd4='',_0x398b74=-0x1;while(_0x444c4a[_0x101bfb]){_0x398b74=_0x444c4a[_0x101bfb][_0x8248('0x8')](':');if(_0x398b74!=-0x1){_0x214382=_0x444c4a[_0x101bfb][_0x8248('0xb')](0x0,_0x398b74)[_0x8248('0xc')]();_0x692fd4=_0x444c4a[_0x101bfb][_0x8248('0xb')](_0x398b74+0x1)[_0x8248('0xc')]();if(_0x214382[_0x8248('0xd')]>0x0){_0x119266[_0x214382]=_0x692fd4;}}else{}_0x101bfb++;}this[_0x8248('0xe')](_0x8248('0xf'),_0x119266);this['_inBody']=!![];}_0x4385bd++;}this[_0x8248('0x3')]=_0x4a6458;}else{while((_0x424c68=_0x4a6458[_0x8248('0x8')](_0x18ce9a))!=-0x1){_0x1ebc46=_0x4a6458[_0x8248('0x9')](0x0,_0x424c68);this[_0x8248('0xe')]('line',_0x1ebc46);_0x4a6458=_0x4a6458[_0x8248('0x9')](_0x424c68+_0x18ce9a[_0x8248('0xd')]);}this[_0x8248('0x3')]=_0x4a6458;}_0x589840();};module[_0x8248('0x10')]=AGIReply; \ No newline at end of file +var _0x2b2d=['_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','headers','line','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype'];(function(_0x7cbb6,_0x10e63e){var _0xf1cd09=function(_0x49ff8e){while(--_0x49ff8e){_0x7cbb6['push'](_0x7cbb6['shift']());}};_0xf1cd09(++_0x10e63e);}(_0x2b2d,0x1ad));var _0xd2b2=function(_0x522c1a,_0x1299ed){_0x522c1a=_0x522c1a-0x0;var _0x5807ee=_0x2b2d[_0x522c1a];return _0x5807ee;};'use strict';var util=require(_0xd2b2('0x0'));var Transform=require(_0xd2b2('0x1'))[_0xd2b2('0x2')];function AGIReply(_0x4dd940){Transform[_0xd2b2('0x3')](this,_0x4dd940);this[_0xd2b2('0x4')]='';this[_0xd2b2('0x5')]=![];}util[_0xd2b2('0x6')](AGIReply,Transform);AGIReply[_0xd2b2('0x7')][_0xd2b2('0x8')]=function(_0x40e522,_0x59fc4b,_0x1fd93e){var _0x5f58e0='\x0a',_0x3ff8ba=['\x0a\x0a',_0xd2b2('0x9')],_0x318976=-0x1,_0x4c00bd=-0x1,_0x3e4e8a='',_0x119378=0x0,_0x3eadbb='',_0x2012f0='';this[_0xd2b2('0x4')]+=_0x40e522[_0xd2b2('0xa')]();_0x3eadbb=this[_0xd2b2('0x4')];if(!this[_0xd2b2('0x5')]){_0x119378=0x0;while(_0x3ff8ba[_0x119378]){while((_0x4c00bd=_0x3eadbb[_0xd2b2('0xb')](_0x3ff8ba[_0x119378]))!=-0x1){_0x3e4e8a=_0x3ff8ba[_0x119378];_0x2012f0=_0x3eadbb['substring'](0x0,_0x4c00bd);_0x3eadbb=_0x3eadbb[_0xd2b2('0xc')](_0x4c00bd+_0x3e4e8a[_0xd2b2('0xd')]);var _0x3abb89=_0x2012f0[_0xd2b2('0xe')](_0x5f58e0),_0xfeb6ff=0x0,_0x2af6fd={},_0x1ddcc8='',_0x4f3bef='',_0x52e0e0=-0x1;while(_0x3abb89[_0xfeb6ff]){_0x52e0e0=_0x3abb89[_0xfeb6ff][_0xd2b2('0xb')](':');if(_0x52e0e0!=-0x1){_0x1ddcc8=_0x3abb89[_0xfeb6ff]['slice'](0x0,_0x52e0e0)['trim']();_0x4f3bef=_0x3abb89[_0xfeb6ff][_0xd2b2('0xf')](_0x52e0e0+0x1)[_0xd2b2('0x10')]();if(_0x1ddcc8[_0xd2b2('0xd')]>0x0){_0x2af6fd[_0x1ddcc8]=_0x4f3bef;}}else{}_0xfeb6ff++;}this['emit'](_0xd2b2('0x11'),_0x2af6fd);this[_0xd2b2('0x5')]=!![];}_0x119378++;}this[_0xd2b2('0x4')]=_0x3eadbb;}else{while((_0x318976=_0x3eadbb[_0xd2b2('0xb')](_0x5f58e0))!=-0x1){_0x2012f0=_0x3eadbb[_0xd2b2('0xc')](0x0,_0x318976);this['emit'](_0xd2b2('0x12'),_0x2012f0);_0x3eadbb=_0x3eadbb['substring'](_0x318976+_0x5f58e0[_0xd2b2('0xd')]);}this[_0xd2b2('0x4')]=_0x3eadbb;}_0x1fd93e();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 4dc3ab2..091f9c1 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 _0xf9d5=['ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','lodash','jayson/promise','client','http','then','error','result','catch','getSquareProject','ShowSquareProject','getMailAccountById','Smtp','name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper'];(function(_0x54bf67,_0x5381e5){var _0x5f18a9=function(_0x5fea82){while(--_0x5fea82){_0x54bf67['push'](_0x54bf67['shift']());}};_0x5f18a9(++_0x5381e5);}(_0xf9d5,0x122));var _0x5f9d=function(_0x54a6ae,_0x455b56){_0x54a6ae=_0x54a6ae-0x0;var _0xb3db49=_0xf9d5[_0x54a6ae];return _0xb3db49;};'use strict';var BPromise=require('bluebird');var moment=require(_0x5f9d('0x0'));var _=require(_0x5f9d('0x1'));var util=require('util');var jayson=require(_0x5f9d('0x2'));var client=jayson[_0x5f9d('0x3')][_0x5f9d('0x4')]({'port':0x2329});function request(_0x290ef2,_0x25fa8c){return new BPromise(function(_0xdd68fd,_0x27449e){return client['request'](_0x290ef2,_0x25fa8c)[_0x5f9d('0x5')](function(_0x59027b){if(_0x59027b[_0x5f9d('0x6')]){return _0x27449e(_0x59027b[_0x5f9d('0x6')]['message']);}else{return _0xdd68fd(_0x59027b[_0x5f9d('0x7')]);}})[_0x5f9d('0x8')](function(_0x46e265){return _0x27449e(_0x46e265);});});}exports[_0x5f9d('0x9')]=function(_0xcc3772){return request(_0x5f9d('0xa'),{'options':{'raw':![],'where':{'name':_0xcc3772},'attributes':['production']}});};exports[_0x5f9d('0xb')]=function(_0x211098){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x211098},'include':[{'model':'MailServerOut','as':_0x5f9d('0xc')}],'attributes':['id',_0x5f9d('0xd'),_0x5f9d('0xe')]}});};exports['getSquareProjectById']=function(_0x235de2){return request(_0x5f9d('0xa'),{'options':{'where':{'id':_0x235de2},'attributes':[_0x5f9d('0xd')]}});};exports[_0x5f9d('0xf')]=function(_0x550655){return request(_0x5f9d('0x10'),{'options':{'where':{'id':_0x550655},'attributes':[_0x5f9d('0xd')]}});};exports[_0x5f9d('0x11')]=function(_0x5aacdc){return request(_0x5f9d('0x12'),{'options':{'where':{'id':_0x5aacdc},'attributes':[_0x5f9d('0xd')]}});};exports['getSquareOdbcById']=function(_0x4fd1cb){return request(_0x5f9d('0x13'),{'options':{'where':{'id':_0x4fd1cb},'attributes':[_0x5f9d('0x14')]}});};exports[_0x5f9d('0x15')]=function(_0x26a76a){return request(_0x5f9d('0x16'),{'options':{'where':{'id':_0x26a76a},'attributes':['name']}});};exports['getContactByPhone']=function(_0x54bd00){return request(_0x5f9d('0x17'),{'options':{'where':{'phone':_0x54bd00['phone']},'attributes':['id']}});};exports[_0x5f9d('0x18')]=function(_0x48448e){return request(_0x5f9d('0x19'),{'options':{'where':{'id':_0x48448e},'attributes':[_0x5f9d('0xd')]}});};exports[_0x5f9d('0x1a')]=function(_0x55a31c){return request(_0x5f9d('0x1b'),{'options':{'where':{'id':_0x55a31c},'attributes':[_0x5f9d('0x1c')]}});};exports[_0x5f9d('0x1d')]=function(_0x1e51d7){return request(_0x5f9d('0x1e'),{'options':{'raw':![],'where':{'id':_0x1e51d7},'include':[{'model':_0x5f9d('0x1f'),'as':_0x5f9d('0x20')}]}});};exports[_0x5f9d('0x21')]=function(_0x3cd7a4){return request('ShowSmsAccount',{'options':{'where':{'id':_0x3cd7a4},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x1bc76b){return request('CreateSmsMessage',{'body':_0x1bc76b});};exports[_0x5f9d('0x22')]=function(_0x5a3472){return request(_0x5f9d('0x23'),{'body':_0x5a3472});};exports['createSquareReport']=function(_0x4875c5){return request('CreateSquareReport',{'body':_[_0x5f9d('0x24')](_0x4875c5,{'project_name':_0x4875c5[_0x5f9d('0x25')],'prev_project_name':_0x4875c5[_0x5f9d('0x26')]||'','is_subproject':_0x4875c5[_0x5f9d('0x26')]?!![]:![],'leaveAt':moment()['format'](_0x5f9d('0x27'))})});};exports[_0x5f9d('0x28')]=function(_0x190402){return request(_0x5f9d('0x29'),{'body':_0x190402});};exports[_0x5f9d('0x2a')]=function(_0x14aaca){return request(_0x5f9d('0x2b'),{'body':_0x14aaca});};exports[_0x5f9d('0x2c')]=function(_0x3b1efc){return request(_0x5f9d('0x2d'),{'options':{'raw':![],'where':{'phone':_0x3b1efc['phone'],'ListId':_0x3b1efc[_0x5f9d('0x2e')]}}})[_0x5f9d('0x5')](function(_0x1496c0){if(_0x1496c0){return _0x1496c0;}return request(_0x5f9d('0x2f'),{'body':_0x3b1efc});});};exports[_0x5f9d('0x30')]=function(_0x24233e){return request(_0x5f9d('0x31'),{'options':{'where':{'id':_0x24233e},'attributes':[_0x5f9d('0xd')]}});};exports[_0x5f9d('0x32')]=function(_0x4f43b2,_0x4ed27d){return request('LoginUser',{'body':{'interface':_0x4ed27d},'options':{'where':_0x4f43b2}});};exports[_0x5f9d('0x33')]=function(_0x5b7bd4,_0x461a2a,_0x49fe67){return request(_0x5f9d('0x34'),{'body':{'type':_0x461a2a,'uniqueid':_0x49fe67},'options':{'where':_0x5b7bd4}});};exports['agentUnpause']=function(_0x68f7ac){return request(_0x5f9d('0x35'),{'body':{},'options':{'where':_0x68f7ac}});};exports[_0x5f9d('0x36')]=function(_0x3b4933){return request(_0x5f9d('0x37'),{'body':{},'options':{'where':_0x3b4933}});}; \ No newline at end of file +var _0xf725=['agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','GetContactByPhone','phone','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','agentLogin','LoginUser'];(function(_0x2ef252,_0x1993fe){var _0x1139ca=function(_0x31f949){while(--_0x31f949){_0x2ef252['push'](_0x2ef252['shift']());}};_0x1139ca(++_0x1993fe);}(_0xf725,0x7e));var _0x5f72=function(_0x14c2a4,_0x2524a0){_0x14c2a4=_0x14c2a4-0x0;var _0x3c00b0=_0xf725[_0x14c2a4];return _0x3c00b0;};'use strict';var BPromise=require(_0x5f72('0x0'));var moment=require(_0x5f72('0x1'));var _=require(_0x5f72('0x2'));var util=require(_0x5f72('0x3'));var jayson=require(_0x5f72('0x4'));var client=jayson[_0x5f72('0x5')][_0x5f72('0x6')]({'port':0x2329});function request(_0x172588,_0x4200ff){return new BPromise(function(_0x17a5bc,_0x557be3){return client[_0x5f72('0x7')](_0x172588,_0x4200ff)[_0x5f72('0x8')](function(_0x3f2ca7){if(_0x3f2ca7[_0x5f72('0x9')]){return _0x557be3(_0x3f2ca7[_0x5f72('0x9')][_0x5f72('0xa')]);}else{return _0x17a5bc(_0x3f2ca7[_0x5f72('0xb')]);}})['catch'](function(_0x499e28){return _0x557be3(_0x499e28);});});}exports[_0x5f72('0xc')]=function(_0x3f189d){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x3f189d},'attributes':[_0x5f72('0xd')]}});};exports[_0x5f72('0xe')]=function(_0x547a1a){return request(_0x5f72('0xf'),{'options':{'raw':![],'where':{'id':_0x547a1a},'include':[{'model':_0x5f72('0x10'),'as':_0x5f72('0x11')}],'attributes':['id',_0x5f72('0x12'),_0x5f72('0x13')]}});};exports[_0x5f72('0x14')]=function(_0x1446f1){return request('ShowSquareProject',{'options':{'where':{'id':_0x1446f1},'attributes':[_0x5f72('0x12')]}});};exports[_0x5f72('0x15')]=function(_0x8a9487){return request(_0x5f72('0x16'),{'options':{'where':{'id':_0x8a9487},'attributes':[_0x5f72('0x12')]}});};exports['getVariableById']=function(_0x43d1fd){return request('ShowVariable',{'options':{'where':{'id':_0x43d1fd},'attributes':['name']}});};exports[_0x5f72('0x17')]=function(_0x5a036c){return request(_0x5f72('0x18'),{'options':{'where':{'id':_0x5a036c},'attributes':['dsn']}});};exports[_0x5f72('0x19')]=function(_0x4e0c32){return request(_0x5f72('0x1a'),{'options':{'where':{'id':_0x4e0c32},'attributes':[_0x5f72('0x12')]}});};exports['getContactByPhone']=function(_0xea99d5){return request(_0x5f72('0x1b'),{'options':{'where':{'phone':_0xea99d5[_0x5f72('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x490d14){return request('ShowTrunk',{'options':{'where':{'id':_0x490d14},'attributes':[_0x5f72('0x12')]}});};exports[_0x5f72('0x1d')]=function(_0x269dae){return request(_0x5f72('0x1e'),{'options':{'where':{'id':_0x269dae},'attributes':[_0x5f72('0x1f')]}});};exports[_0x5f72('0x20')]=function(_0x47ec64){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x47ec64},'include':[{'model':_0x5f72('0x21'),'as':_0x5f72('0x22')}]}});};exports[_0x5f72('0x23')]=function(_0xd5a0c5){return request(_0x5f72('0x24'),{'options':{'where':{'id':_0xd5a0c5},'attributes':['id',_0x5f72('0x12')]}});};exports[_0x5f72('0x25')]=function(_0x367716){return request(_0x5f72('0x26'),{'body':_0x367716});};exports[_0x5f72('0x27')]=function(_0x21c7d2){return request('CreateSquareDetailsReport',{'body':_0x21c7d2});};exports[_0x5f72('0x28')]=function(_0x21f4a3){return request(_0x5f72('0x29'),{'body':_[_0x5f72('0x2a')](_0x21f4a3,{'project_name':_0x21f4a3['arg_1'],'prev_project_name':_0x21f4a3[_0x5f72('0x2b')]||'','is_subproject':_0x21f4a3[_0x5f72('0x2b')]?!![]:![],'leaveAt':moment()['format'](_0x5f72('0x2c'))})});};exports[_0x5f72('0x2d')]=function(_0x347723){return request('CreateSquareRecording',{'body':_0x347723});};exports['createSquareMessage']=function(_0x3d4cfe){return request(_0x5f72('0x2e'),{'body':_0x3d4cfe});};exports[_0x5f72('0x2f')]=function(_0x18374d){return request(_0x5f72('0x30'),{'options':{'raw':![],'where':{'phone':_0x18374d[_0x5f72('0x1c')],'ListId':_0x18374d[_0x5f72('0x31')]}}})['then'](function(_0x1b12cd){if(_0x1b12cd){return _0x1b12cd;}return request('CreateCmContact',{'body':_0x18374d});});};exports[_0x5f72('0x32')]=function(_0x35fa31){return request(_0x5f72('0x33'),{'options':{'where':{'id':_0x35fa31},'attributes':[_0x5f72('0x12')]}});};exports[_0x5f72('0x34')]=function(_0x5278d9,_0x502057){return request(_0x5f72('0x35'),{'body':{'interface':_0x502057},'options':{'where':_0x5278d9}});};exports[_0x5f72('0x36')]=function(_0x25ab30,_0x3112ad,_0xce2370){return request(_0x5f72('0x37'),{'body':{'type':_0x3112ad,'uniqueid':_0xce2370},'options':{'where':_0x25ab30}});};exports[_0x5f72('0x38')]=function(_0x48912a){return request(_0x5f72('0x39'),{'body':{},'options':{'where':_0x48912a}});};exports[_0x5f72('0x3a')]=function(_0x336e19){return request(_0x5f72('0x3b'),{'body':{},'options':{'where':_0x336e19}});}; \ 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 4994e8e..c927e84 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 _0x8085=['./polly'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x8085,0x71));var _0x5808=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0x8085[_0x5cc8];return _0x450661;};var polly=require(_0x5808('0x0'));var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x15ef=['./lex','exports'];(function(_0x1dd304,_0x34a571){var _0x121cdb=function(_0x2225a9){while(--_0x2225a9){_0x1dd304['push'](_0x1dd304['shift']());}};_0x121cdb(++_0x34a571);}(_0x15ef,0x80));var _0xf15e=function(_0x2b6e4f,_0x2c9a12){_0x2b6e4f=_0x2b6e4f-0x0;var _0x258654=_0x15ef[_0x2b6e4f];return _0x258654;};var polly=require('./polly');var lex=require(_0xf15e('0x0'));module[_0xf15e('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 413c22b..ab78988 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 _0xe706=['exports','./lib/api'];(function(_0x286d15,_0x5957ee){var _0x3dd6f8=function(_0x45d373){while(--_0x45d373){_0x286d15['push'](_0x286d15['shift']());}};_0x3dd6f8(++_0x5957ee);}(_0xe706,0xa3));var _0x6e70=function(_0x1a0016,_0x3d80e1){_0x1a0016=_0x1a0016-0x0;var _0x2945df=_0xe706[_0x1a0016];return _0x2945df;};'use strict';var lex=require(_0x6e70('0x0'));module[_0x6e70('0x1')]=function(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3){return lex(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3);}; \ No newline at end of file +var _0x4ea3=['./lib/api','exports'];(function(_0x3ee7d3,_0x41e18e){var _0x20cc49=function(_0x96e1a3){while(--_0x96e1a3){_0x3ee7d3['push'](_0x3ee7d3['shift']());}};_0x20cc49(++_0x41e18e);}(_0x4ea3,0x70));var _0x34ea=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x4ea3[_0x6c993a];return _0x27f547;};'use strict';var lex=require(_0x34ea('0x0'));module[_0x34ea('0x1')]=function(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c){return lex(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c);}; \ 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 0c34b9d..de75ac0 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(_0x1e5232,_0xc3cf15){var _0x8f7b42=function(_0x831bab){while(--_0x831bab){_0x1e5232['push'](_0x1e5232['shift']());}};_0x8f7b42(++_0xc3cf15);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x1cb1f9,_0x29f2b9){var _0x5a4df7=function(_0x4dd584){while(--_0x4dd584){_0x1cb1f9['push'](_0x1cb1f9['shift']());}};_0x5a4df7(++_0x29f2b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 2cdf0be..fee8ce2 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 _0xa4ee=['exports'];(function(_0x4f66ef,_0x3d47ef){var _0x34c6ec=function(_0x449aaf){while(--_0x449aaf){_0x4f66ef['push'](_0x4f66ef['shift']());}};_0x34c6ec(++_0x3d47ef);}(_0xa4ee,0xbe));var _0xea4e=function(_0x3b3489,_0x1da252){_0x3b3489=_0x3b3489-0x0;var _0x2a70a3=_0xa4ee[_0x3b3489];return _0x2a70a3;};'use strict';var polly=require('./lib/api');module[_0xea4e('0x0')]=function(_0x3fdc52,_0x5d38be,_0x5dccfd,_0x834f6b,_0x21a327,_0x463887,_0x37127e){return polly(_0x3fdc52,_0x5d38be,_0x5dccfd,_0x834f6b,_0x21a327,_0x463887,_0x37127e);}; \ No newline at end of file +var _0x6fff=['./lib/api'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0x6fff,0x7d));var _0xf6ff=function(_0x41cf07,_0x18b087){_0x41cf07=_0x41cf07-0x0;var _0x54e273=_0x6fff[_0x41cf07];return _0x54e273;};'use strict';var polly=require(_0xf6ff('0x0'));module['exports']=function(_0x265c78,_0xa1689f,_0x5efa3a,_0x134b18,_0x50cc60,_0x43ec8e,_0x225e9f){return polly(_0x265c78,_0xa1689f,_0x5efa3a,_0x134b18,_0x50cc60,_0x43ec8e,_0x225e9f);}; \ 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 5606fc4..3edb070 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 _0x583b=['exports','Polly','text','mp3','bluebird','randomstring','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x2d7d4c,_0x4e6b13){var _0x4b4213=function(_0x1c6179){while(--_0x1c6179){_0x2d7d4c['push'](_0x2d7d4c['shift']());}};_0x4b4213(++_0x4e6b13);}(_0x583b,0x101));var _0xb583=function(_0x1f206b,_0x3d17a2){_0x1f206b=_0x1f206b-0x0;var _0x1b8e48=_0x583b[_0x1f206b];return _0x1b8e48;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xb583('0x0'));var rs=require(_0xb583('0x1'));var AWS=require(_0xb583('0x2'));function pollyResult(_0x22514d,_0x2c908b,_0xdd3e7f){return new BPromise(function(_0x405fb5,_0x3a00b5){_0x22514d['synthesizeSpeech'](_0x2c908b,function(_0x34bada,_0x131472){if(_0x34bada){_0x3a00b5(_0x34bada);}else if(_0x131472){if(_0x131472[_0xb583('0x3')]instanceof Buffer){fs[_0xb583('0x4')](_0xdd3e7f,_0x131472[_0xb583('0x3')],function(_0x441899){if(_0x441899){_0x3a00b5(_0x441899);}else{_0x405fb5();}});}else{_0x3a00b5(new Error(_0xb583('0x5')));}}else{_0x3a00b5(new Error(_0xb583('0x6')));}});});}module[_0xb583('0x7')]=function(_0x21192f,_0x350697,_0x602a71,_0x1f6043,_0x40cfa7,_0x1b36c6,_0x185cfc){var _0x5ef645=new AWS[(_0xb583('0x8'))]({'accessKeyId':_0x21192f,'secretAccessKey':_0x350697,'region':_0x602a71});var _0x14aa0e={'Text':_0x40cfa7,'TextType':_0x1b36c6||_0xb583('0x9'),'OutputFormat':_0xb583('0xa'),'VoiceId':_0x1f6043};return pollyResult(_0x5ef645,_0x14aa0e,_0x185cfc);}; \ No newline at end of file +var _0xba55=['randomstring','aws-sdk','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','path','bluebird'];(function(_0x34546e,_0x14832c){var _0x31faaa=function(_0x15ef31){while(--_0x15ef31){_0x34546e['push'](_0x34546e['shift']());}};_0x31faaa(++_0x14832c);}(_0xba55,0xf1));var _0x5ba5=function(_0x187962,_0x238683){_0x187962=_0x187962-0x0;var _0x5f29d7=_0xba55[_0x187962];return _0x5f29d7;};'use strict';var fs=require('fs');var path=require(_0x5ba5('0x0'));var BPromise=require(_0x5ba5('0x1'));var rs=require(_0x5ba5('0x2'));var AWS=require(_0x5ba5('0x3'));function pollyResult(_0x1678ca,_0x41d3f7,_0x54da0e){return new BPromise(function(_0x5de2a9,_0x184990){_0x1678ca['synthesizeSpeech'](_0x41d3f7,function(_0x12e0f0,_0x2edb97){if(_0x12e0f0){_0x184990(_0x12e0f0);}else if(_0x2edb97){if(_0x2edb97['AudioStream']instanceof Buffer){fs[_0x5ba5('0x4')](_0x54da0e,_0x2edb97['AudioStream'],function(_0xbdb5c0){if(_0xbdb5c0){_0x184990(_0xbdb5c0);}else{_0x5de2a9();}});}else{_0x184990(new Error(_0x5ba5('0x5')));}}else{_0x184990(new Error(_0x5ba5('0x6')));}});});}module[_0x5ba5('0x7')]=function(_0x110875,_0x3df308,_0x3848da,_0x1aca1b,_0x3cbfc0,_0x4f165f,_0x5651c8){var _0x39cb28=new AWS[(_0x5ba5('0x8'))]({'accessKeyId':_0x110875,'secretAccessKey':_0x3df308,'region':_0x3848da});var _0xcf1876={'Text':_0x3cbfc0,'TextType':_0x4f165f||'text','OutputFormat':'mp3','VoiceId':_0x1aca1b};return pollyResult(_0x39cb28,_0xcf1876,_0x5651c8);}; \ 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 d744379..1ec3d97 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(_0x54de35,_0x2f56e8,_0x238dbc,_0x2a1b92){return asr(_0x54de35,_0x2f56e8,_0x238dbc);}; \ No newline at end of file +var _0x4f8e=['exports','./lib/api'];(function(_0x1e3b1d,_0x444b2f){var _0x3d4f3c=function(_0x24e248){while(--_0x24e248){_0x1e3b1d['push'](_0x1e3b1d['shift']());}};_0x3d4f3c(++_0x444b2f);}(_0x4f8e,0x99));var _0xe4f8=function(_0x1a61db,_0x3ad3af){_0x1a61db=_0x1a61db-0x0;var _0x5ac3bf=_0x4f8e[_0x1a61db];return _0x5ac3bf;};'use strict';var asr=require(_0xe4f8('0x0'));module[_0xe4f8('0x1')]=function(_0x3efc1c,_0x417378,_0x537975,_0x97eba9){return asr(_0x3efc1c,_0x417378,_0x537975);}; \ 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 315cedd..ec93228 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 _0xec56=['length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','exports','string'];(function(_0x2b35d3,_0x51ac4c){var _0x48d670=function(_0x22d75c){while(--_0x22d75c){_0x2b35d3['push'](_0x2b35d3['shift']());}};_0x48d670(++_0x51ac4c);}(_0xec56,0x1bd));var _0x6ec5=function(_0x1e92ba,_0x3d166a){_0x1e92ba=_0x1e92ba-0x0;var _0x4f3467=_0xec56[_0x1e92ba];return _0x4f3467;};'use strict';var url=require(_0x6ec5('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0x6ec5('0x1')]=function(_0x3b8a3f,_0x26a5af,_0x240ccf){return new BPromise(function(_0x43c2cd,_0x399441){var _0x469679;if(typeof _0x3b8a3f!==_0x6ec5('0x2')||_0x3b8a3f[_0x6ec5('0x3')]===0x0){return _0x399441(_0x6ec5('0x4'));}if(typeof _0x26a5af!==_0x6ec5('0x2')||_0x26a5af[_0x6ec5('0x3')]===0x0){return _0x399441(_0x6ec5('0x5'));}if(typeof _0x240ccf!==_0x6ec5('0x6')&&(typeof _0x240ccf!==_0x6ec5('0x2')||_0x240ccf[_0x6ec5('0x3')]===0x0)){return _0x399441(_0x6ec5('0x7'));}try{_0x469679=fs[_0x6ec5('0x8')](_0x3b8a3f)[_0x6ec5('0x9')]('base64');}catch(_0x2e880d){return _0x399441(_0x2e880d);}return _0x43c2cd({'method':_0x6ec5('0xa'),'uri':host+_0x6ec5('0xb')+_0x26a5af,'body':{'config':{'encoding':_0x6ec5('0xc'),'sampleRateHertz':_0x6ec5('0xd'),'languageCode':_0x240ccf},'audio':{'content':_0x469679}},'json':!![]});});}; \ No newline at end of file +var _0xe14d=['bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url'];(function(_0x4c7035,_0x25b6d9){var _0x443b6f=function(_0x1747e5){while(--_0x1747e5){_0x4c7035['push'](_0x4c7035['shift']());}};_0x443b6f(++_0x25b6d9);}(_0xe14d,0x1ee));var _0xde14=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xe14d[_0x2fc012];return _0x2891f9;};'use strict';var url=require(_0xde14('0x0'));var BPromise=require(_0xde14('0x1'));var fs=require('fs');var host=_0xde14('0x2');module[_0xde14('0x3')]=function(_0x48b392,_0x1c5b4,_0x28965b){return new BPromise(function(_0x4b20e2,_0x1c3e94){var _0x13c24e;if(typeof _0x48b392!==_0xde14('0x4')||_0x48b392[_0xde14('0x5')]===0x0){return _0x1c3e94(_0xde14('0x6'));}if(typeof _0x1c5b4!==_0xde14('0x4')||_0x1c5b4['length']===0x0){return _0x1c3e94('key\x20should\x20be\x20a\x20string');}if(typeof _0x28965b!==_0xde14('0x7')&&(typeof _0x28965b!==_0xde14('0x4')||_0x28965b[_0xde14('0x5')]===0x0)){return _0x1c3e94(_0xde14('0x8'));}try{_0x13c24e=fs[_0xde14('0x9')](_0x48b392)[_0xde14('0xa')](_0xde14('0xb'));}catch(_0x1ce0a2){return _0x1c3e94(_0x1ce0a2);}return _0x4b20e2({'method':'POST','uri':host+_0xde14('0xc')+_0x1c5b4,'body':{'config':{'encoding':_0xde14('0xd'),'sampleRateHertz':_0xde14('0xe'),'languageCode':_0x28965b},'audio':{'content':_0x13c24e}},'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 9dc68e3..3dd91bf 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 _0x9873=['./asr'];(function(_0x4552ea,_0x5c6323){var _0x45499a=function(_0x174340){while(--_0x174340){_0x4552ea['push'](_0x4552ea['shift']());}};_0x45499a(++_0x5c6323);}(_0x9873,0x156));var _0x3987=function(_0x10b593,_0x4e497d){_0x10b593=_0x10b593-0x0;var _0x40cf20=_0x9873[_0x10b593];return _0x40cf20;};var asr=require(_0x3987('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x33ab=['exports','./asr'];(function(_0x3d2c5e,_0x178ef8){var _0xc99fa0=function(_0x4bdffe){while(--_0x4bdffe){_0x3d2c5e['push'](_0x3d2c5e['shift']());}};_0xc99fa0(++_0x178ef8);}(_0x33ab,0xd5));var _0xb33a=function(_0xa52927,_0x30e2c0){_0xa52927=_0xa52927-0x0;var _0x197216=_0x33ab[_0xa52927];return _0x197216;};var asr=require(_0xb33a('0x0'));module[_0xb33a('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 fc8daca..623649c 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 _0x33ba=['audiofile','dirName','apiai-promise','bluebird','http','md5','path','randomstring','sox','url','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','protocol','https:','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','get','end','transcode','wav','error\x20convert','start','resolve','generate','.wav','then','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','?key=','ssml','input','MP3','text:synthesize','POST','tmp','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','.mp3','writeFileSync','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','metadata','googleDialogflowV2','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','AudioFromTts','Data'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x33ba,0x19a));var _0xa33b=function(_0x62677c,_0x5f5aa6){_0x62677c=_0x62677c-0x0;var _0x2cf8a6=_0x33ba[_0x62677c];return _0x2cf8a6;};'use strict';var apiai=require(_0xa33b('0x0'));var BPromise=require(_0xa33b('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xa33b('0x2'));var https=require('https');var md5=require(_0xa33b('0x3'));var path=require(_0xa33b('0x4'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0xa33b('0x5'));var sox=require(_0xa33b('0x6'));var tts=require('google-tts-api');var urlParse=require(_0xa33b('0x7'))[_0xa33b('0x8')];var util=require(_0xa33b('0x9'));var aws=require(_0xa33b('0xa'));var google=require('./google');var sestek=require(_0xa33b('0xb'));var tilde=require(_0xa33b('0xc'));var logger=require(_0xa33b('0xd'))(_0xa33b('0xe'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x1169cb,_0x14cd2e){return new BPromise(function(_0xd67d61,_0x3e2e96){var _0x307370=urlParse(_0x1169cb);var _0x3ac23d=_0x307370[_0xa33b('0xf')]===_0xa33b('0x10')?https:http;var _0xebd28e={'host':_0x307370['host'],'path':_0x307370[_0xa33b('0x4')],'headers':{'user-agent':_0xa33b('0x11')}};_0x3ac23d['get'](_0xebd28e,function(_0x583360){if(_0x583360[_0xa33b('0x12')]!==0xc8){logger[_0xa33b('0x13')](_0xa33b('0x14')+_0x1169cb+_0xa33b('0x15')+_0x583360[_0xa33b('0x12')]+'\x20('+_0x583360[_0xa33b('0x16')]+')');_0x3e2e96(new Error('request\x20to\x20'+_0x1169cb+_0xa33b('0x15')+_0x583360['statusCode']+'\x20('+_0x583360[_0xa33b('0x16')]+')'));return;}var _0x513109=fs[_0xa33b('0x17')](_0x14cd2e);_0x513109['on'](_0xa33b('0x18'),function(){logger[_0xa33b('0x19')](_0xa33b('0x1a'));_0x513109[_0xa33b('0x1b')](_0xd67d61);});_0x513109['on'](_0xa33b('0x13'),function(_0x571371){fs[_0xa33b('0x1c')](_0x14cd2e);logger[_0xa33b('0x13')](_0xa33b('0x1d'),_0x571371);_0x3e2e96(_0x571371);});_0x583360[_0xa33b('0x1e')](_0x513109);})['on']('error',function(_0x1b18d1){logger[_0xa33b('0x13')](_0x1b18d1);_0x3e2e96(_0x1b18d1);})['end']();});}function uploadFile(_0x46ef4b){return new BPromise(function(_0x8ca656,_0x3e2f6f){var _0x469e54=urlParse(_0x46ef4b);var _0x42ca91=_0x469e54['protocol']===_0xa33b('0x10')?https:http;var _0x1aca2c={'host':_0x469e54['host'],'path':_0x469e54[_0xa33b('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x42ca91[_0xa33b('0x1f')](_0x1aca2c,function(_0x74db52){if(_0x74db52[_0xa33b('0x12')]!==0xc8){_0x3e2f6f(new Error(_0xa33b('0x14')+_0x46ef4b+_0xa33b('0x15')+_0x74db52[_0xa33b('0x12')]+'\x20('+_0x74db52[_0xa33b('0x16')]+')'));return;}var _0x136e59='';_0x74db52['on']('data',function(_0x50570f){_0x136e59+=_0x50570f;});_0x74db52['on'](_0xa33b('0x20'),function(){_0x8ca656(_0x136e59);});})['on'](_0xa33b('0x13'),function(_0x21af44){_0x3e2f6f(_0x21af44);})[_0xa33b('0x20')]();});}function convertFile(_0x148864,_0x5234be){return new BPromise(function(_0x59efae,_0x4840e1){var _0x88292=sox[_0xa33b('0x21')](_0x148864,_0x5234be,{'sampleRate':0x1f40,'format':_0xa33b('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x88292['on'](_0xa33b('0x13'),function(_0x8c13cb){logger[_0xa33b('0x13')](_0xa33b('0x23'),_0x8c13cb);_0x4840e1(_0x8c13cb);});_0x88292['on'](_0xa33b('0x20'),function(){logger[_0xa33b('0x19')]('finish\x20to\x20convert');_0x59efae();});_0x88292[_0xa33b('0x24')]();});}function base64Decode(_0x160228,_0xd191f){var _0x3f52ab=path[_0xa33b('0x25')](__dirname,'tmp',rs[_0xa33b('0x26')](0x4)+_0xa33b('0x27'));fs['writeFileSync'](_0x3f52ab,_0x160228,'base64');return convertFile(_0x3f52ab,_0xd191f)[_0xa33b('0x28')](function(){try{fs['unlink'](_0x3f52ab);fs[_0xa33b('0x29')](_0xd191f,_0xa33b('0x2a'));}catch(_0x5a9eb7){logger[_0xa33b('0x13')](_0x5a9eb7);}return _0xd191f[_0xa33b('0x2b')]('.')[0x0];});}function base64Encode(_0xf96340){var _0x67f81c=fs[_0xa33b('0x2c')](_0xf96340);return new Buffer(_0x67f81c)[_0xa33b('0x2d')](_0xa33b('0x2e'));}exports[_0xa33b('0x2f')]=function(_0x1569f1,_0x54d5a1,_0x87a33b,_0x4001aa,_0x4cddb2,_0x3bbd0b){var _0x1757c0,_0x53f8cd;var _0x4215e8='https://texttospeech.googleapis.com/v1/';var _0x51c801=_0xa33b('0x30')+_0x1569f1;var _0x55e1a2={};if(_0x54d5a1===_0xa33b('0x31')){_0x55e1a2[_0xa33b('0x32')]={'ssml':_0x87a33b};}else{_0x55e1a2[_0xa33b('0x32')]={'text':_0x87a33b};};_0x55e1a2['voice']={'languageCode':_0x4001aa,'ssmlGender':_0x4cddb2};_0x55e1a2['audioConfig']={'audioEncoding':_0xa33b('0x33'),'sampleRateHertz':0x1f40};var _0x17a973={'url':_0x4215e8+_0xa33b('0x34')+_0x51c801,'method':_0xa33b('0x35'),'json':!![],'body':_0x55e1a2};return rp(_0x17a973)['then'](function(_0x38487a){return new BPromise(function(_0x59f267,_0x4fd1a0){_0x1757c0=path[_0xa33b('0x25')](__dirname,_0xa33b('0x36'),rs[_0xa33b('0x26')](0x4)+'.mp3');var _0x71ef10=Buffer[_0xa33b('0x37')](_0x38487a[_0xa33b('0x38')],_0xa33b('0x2e'));return fs[_0xa33b('0x39')](_0x1757c0,_0x71ef10,function(_0x2d96b3){_0x4fd1a0(_0x2d96b3);},function(_0x199acf){fs[_0xa33b('0x29')](_0x1757c0,_0xa33b('0x2a'));_0x59f267(_0x199acf);});});})[_0xa33b('0x28')](function(_0x34a03c){_0x53f8cd=path[_0xa33b('0x25')](__dirname,_0xa33b('0x36'),rs[_0xa33b('0x26')](0x4)+'.wav');return convertFile(_0x1757c0,_0x53f8cd);})[_0xa33b('0x28')](function(){try{fs[_0xa33b('0x1c')](_0x1757c0);fs[_0xa33b('0x29')](_0x53f8cd,_0xa33b('0x2a'));}catch(_0x1dc276){logger['error'](_0x1dc276);}logger[_0xa33b('0x19')](_0xa33b('0x3a'),_0x53f8cd['split']('.')[0x0]);return _0x53f8cd[_0xa33b('0x2b')]('.')[0x0];});};exports[_0xa33b('0x3b')]=function(_0x4addf4,_0x1ad6e4){var _0x4d73b1=_0xa33b('0x3c');var _0x31de44,_0x1d761a;var _0x105235;var _0x343231={'encoding':_0xa33b('0x3d'),'method':_0xa33b('0x35'),'timeout':0x2710,'url':_0x4d73b1,'headers':{'Content-Type':_0xa33b('0x3e')},'body':_0xa33b('0x3f')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0xa33b('0x40')]([_0x4addf4,_0x1ad6e4||'en',![],_0xa33b('0x41')]),null,_0xa33b('0x42')]]]))};return rp(_0x343231)[_0xa33b('0x28')](function(_0x23f62c){try{_0x105235=eval(_0x23f62c[_0xa33b('0x43')](0x5))[0x0][0x2];}catch(_0x1dcfdc){throw new Error(_0xa33b('0x44')+_0x23f62c[_0xa33b('0x45')]);}if(!_0x105235){if(_0x4addf4[_0xa33b('0x46')]>0xc8){throw new Error(_0xa33b('0x47'));}else{throw new Error('lang\x20\x22'+_0x1ad6e4+'\x22\x20might\x20not\x20exist');}}try{_0x105235=eval(_0x105235)[0x0];}catch(_0x1c85f5){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xa33b('0x45')]);}const _0x535611=_0x105235;_0x31de44=path[_0xa33b('0x25')](__dirname,'tmp',rs[_0xa33b('0x26')](0x4)+_0xa33b('0x48'));fs[_0xa33b('0x49')](_0x31de44,_0x105235,{'encoding':_0xa33b('0x2e')});_0x1d761a=path[_0xa33b('0x25')](__dirname,'tmp',rs[_0xa33b('0x26')](0x4)+_0xa33b('0x27'));return convertFile(_0x31de44,_0x1d761a);})[_0xa33b('0x28')](function(){try{fs[_0xa33b('0x1c')](_0x31de44);fs[_0xa33b('0x29')](_0x1d761a,_0xa33b('0x2a'));}catch(_0x379985){logger[_0xa33b('0x13')](_0x379985);}logger[_0xa33b('0x19')](_0xa33b('0x4a'),_0x1d761a[_0xa33b('0x2b')]('.')[0x0]);return _0x1d761a[_0xa33b('0x2b')]('.')[0x0];});};exports[_0xa33b('0x4b')]=function(_0x20794a,_0x4e7dc5,_0x2da2d9){return google[_0xa33b('0x4c')](_0x20794a,_0x4e7dc5,_0x2da2d9)[_0xa33b('0x28')](function(_0x2569a4){logger[_0xa33b('0x19')](_0x2569a4['uri']);return rp(_0x2569a4);})[_0xa33b('0x28')](function(_0x2f01ed){var _0x9c88c8='';var _0xe1505=0x0;try{fs[_0xa33b('0x1c')](_0x20794a);}catch(_0x36d10b){logger['error'](_0x36d10b);}if(_0x2f01ed&&_0x2f01ed[_0xa33b('0x4d')]){_0x9c88c8=_0x2f01ed[_0xa33b('0x4d')][_0xa33b('0x4e')](function(_0x596893){return _0x596893&&_0x596893[_0xa33b('0x4f')][0x0]&&_0x596893[_0xa33b('0x4f')][0x0][_0xa33b('0x50')]?_0x596893['alternatives'][0x0]['transcript']:'';})[_0xa33b('0x51')]('\x0a');_0xe1505=_0x2f01ed['results'][_0xa33b('0x4e')](function(_0x15a62c){return _0x15a62c&&_0x15a62c[_0xa33b('0x4f')][0x0]&&_0x15a62c['alternatives'][0x0][_0xa33b('0x52')]?_0x15a62c[_0xa33b('0x4f')][0x0][_0xa33b('0x52')]:0x0;})[_0xa33b('0x51')]('\x0a');}logger[_0xa33b('0x19')](_0xa33b('0x53'),_0x9c88c8);logger[_0xa33b('0x19')](_0xa33b('0x54'),_0xe1505);return{'transcript':_0x9c88c8,'confidence':_0xe1505};})[_0xa33b('0x55')](function(_0x1bdd62){logger[_0xa33b('0x13')](_0xa33b('0x56'),_0x1bdd62['statusCode'],_0x1bdd62['name'],_0x1bdd62[_0xa33b('0x57')]);});};exports[_0xa33b('0x58')]=function(_0x5b290b,_0x2f4108,_0x49ca15,_0x14ef36){var _0x3388a2=apiai(_0x2f4108,{'language':_0x14ef36||'en'});return _0x3388a2[_0xa33b('0x59')](_0x49ca15,{'sessionId':md5(_0x5b290b)})[_0xa33b('0x28')](function(_0x285d4b){logger[_0xa33b('0x19')](JSON[_0xa33b('0x40')](_0x285d4b));return{'source':_0x285d4b[_0xa33b('0x5a')]['source'],'resolvedQuery':_0x285d4b[_0xa33b('0x5a')][_0xa33b('0x5b')],'action':_0x285d4b['result'][_0xa33b('0x5c')],'actionIncomplete':_0x285d4b[_0xa33b('0x5a')][_0xa33b('0x5d')],'speech':_0x285d4b[_0xa33b('0x5a')][_0xa33b('0x5e')][_0xa33b('0x5f')],'score':_0x285d4b['result'][_0xa33b('0x60')],'statusCode':_0x285d4b[_0xa33b('0x61')]['code'],'endConversation':_0x285d4b[_0xa33b('0x5a')]['metadata']['endConversation']||![],'isFallbackIntent':_0x285d4b['result'][_0xa33b('0x62')]['isFallbackIntent']};});};exports[_0xa33b('0x63')]=function(_0x381220,_0x5b8990,_0xeeb894,_0x56831c,_0x46e2f0,_0x59ce02){var _0x1eaf2b=_0x56831c['replace'](/\\n/g,'\x0a');var _0x6fcf55={'credentials':{'private_key':_0x1eaf2b,'client_email':_0xeeb894}};var _0x1d5ae1=new dialogflow[(_0xa33b('0x64'))](_0x6fcf55);var _0x54b0d2=_0x1d5ae1['sessionPath'](_0x5b8990,md5(_0x381220));var _0x124021={'session':_0x54b0d2,'queryInput':{'text':{'text':_0x46e2f0,'languageCode':_0x59ce02}}};return _0x1d5ae1[_0xa33b('0x65')](_0x124021)[_0xa33b('0x28')](function(_0x4ca97e){if(_0x4ca97e&&_0x4ca97e['length']){logger[_0xa33b('0x19')](_0xa33b('0x66'),JSON['stringify'](_0x4ca97e));var _0x46eade=_0x4ca97e[0x0];if(_0x46eade){var _0x2fb264={'action':_0x46eade[_0xa33b('0x67')][_0xa33b('0x5c')],'allRequiredParamsPresent':_0x46eade['queryResult'][_0xa33b('0x68')],'endConversation':_0x46eade[_0xa33b('0x67')][_0xa33b('0x69')]&&_0x46eade['queryResult'][_0xa33b('0x69')][_0xa33b('0x6a')]?_0x46eade[_0xa33b('0x67')][_0xa33b('0x69')][_0xa33b('0x6a')][_0xa33b('0x6b')][_0xa33b('0x6c')]:![],'fulfillmentText':_0x46eade['queryResult'][_0xa33b('0x6d')],'intentName':_0x46eade[_0xa33b('0x67')][_0xa33b('0x6e')]['name'],'intentDisplayName':_0x46eade['queryResult'][_0xa33b('0x6e')]['displayName'],'isFallbackIntent':_0x46eade[_0xa33b('0x67')][_0xa33b('0x6e')][_0xa33b('0x6f')],'languageCode':_0x46eade[_0xa33b('0x67')][_0xa33b('0x70')],'queryText':_0x46eade['queryResult'][_0xa33b('0x71')],'responseId':_0x46eade[_0xa33b('0x72')],'score':_0x46eade['queryResult'][_0xa33b('0x73')],'speech':_0x46eade[_0xa33b('0x67')][_0xa33b('0x6d')],'providerResponse':JSON[_0xa33b('0x40')](_0x4ca97e)};return _0x2fb264;}}});};exports['tildeASR']=function(_0x90205a,_0xc87edd,_0x511d45,_0x46f2da){return tilde['asr'](_0x90205a,_0xc87edd,_0x511d45,_0x46f2da)[_0xa33b('0x28')](function(_0x470c2d){try{fs[_0xa33b('0x1c')](_0x90205a);}catch(_0x3dcacf){logger['error'](_0x3dcacf);}logger[_0xa33b('0x19')](_0xa33b('0x74'),_0x470c2d['transcript']);logger[_0xa33b('0x19')](_0xa33b('0x75'),_0x470c2d['confidence']);return _0x470c2d;});};exports[_0xa33b('0x76')]=function(_0x487080,_0x5ad866,_0xd26ce2,_0x625866,_0x3558b6,_0x138ab2){var _0x2b1baa=path[_0xa33b('0x25')](__dirname,_0xa33b('0x36'),rs['generate'](0x4)+_0xa33b('0x48'));var _0x32eed9;return aws[_0xa33b('0x77')](_0x487080,_0x5ad866,_0xd26ce2,_0x625866,_0x3558b6,_0x138ab2,_0x2b1baa)[_0xa33b('0x28')](function(){_0x32eed9=path[_0xa33b('0x25')](__dirname,_0xa33b('0x36'),rs[_0xa33b('0x26')](0x4)+'.wav');return convertFile(_0x2b1baa,_0x32eed9);})['then'](function(){try{fs['unlink'](_0x2b1baa);fs[_0xa33b('0x29')](_0x32eed9,_0xa33b('0x2a'));}catch(_0xf0eea4){logger[_0xa33b('0x13')](_0xf0eea4);}return _0x32eed9[_0xa33b('0x2b')]('.')[0x0];});};exports[_0xa33b('0x78')]=function(_0x5f054e,_0x413bf3,_0x90fd7e,_0x1db823,_0x5ba7c5,_0x39f3d5){return aws[_0xa33b('0x79')](_0x5f054e,_0x413bf3,_0x90fd7e,_0x1db823,_0x5ba7c5,_0x39f3d5)[_0xa33b('0x28')](function(_0x35c9af){logger[_0xa33b('0x19')](JSON['stringify'](_0x35c9af));return _0x35c9af;});};exports[_0xa33b('0x7a')]=function(_0x12b9f9,_0x48bfb8,_0x57de25,_0xe1a466){var _0x15028b=util[_0xa33b('0x7b')](_0xa33b('0x7c'),ISPEECH_API,_0x12b9f9,encodeURIComponent(_0x48bfb8),_0x57de25,_0xe1a466);var _0x70e943=path[_0xa33b('0x25')](__dirname,_0xa33b('0x36'),rs[_0xa33b('0x26')](0x4)+'.mp3');var _0x4afd4b;return downloadFile(_0x15028b,_0x70e943)[_0xa33b('0x28')](function(){_0x4afd4b=path['resolve'](__dirname,'tmp',rs[_0xa33b('0x26')](0x4)+_0xa33b('0x27'));return convertFile(_0x70e943,_0x4afd4b);})[_0xa33b('0x28')](function(){try{fs[_0xa33b('0x1c')](_0x70e943);fs[_0xa33b('0x29')](_0x4afd4b,'777');}catch(_0x4364e6){logger[_0xa33b('0x13')](_0x4364e6);}return _0x4afd4b['split']('.')[0x0];});};exports[_0xa33b('0x7d')]=function(_0x11430e,_0x4ff93a,_0x3b53d8,_0x322c73){var _0x33659b=util[_0xa33b('0x7b')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x4ff93a,_0x3b53d8,base64Encode(_0x11430e),_0x322c73?util[_0xa33b('0x7b')](_0xa33b('0x7e'),encodeURIComponent(_0x322c73)):_0xa33b('0x7f'));return uploadFile(_0x33659b)[_0xa33b('0x28')](function(_0x23f516){return querystring[_0xa33b('0x8')](_0x23f516);});};exports[_0xa33b('0x80')]=function(_0x246dda,_0x57230f){return sestek[_0xa33b('0x81')](_0x246dda,_0x57230f)[_0xa33b('0x28')](function(_0x4fa4f4){logger[_0xa33b('0x19')](JSON[_0xa33b('0x40')](_0x4fa4f4));var _0x1ccf35={'speech':_0x4fa4f4['text'],'action':_0x4fa4f4[_0xa33b('0x82')]?_0x4fa4f4[_0xa33b('0x82')][_0xa33b('0x83')]:undefined,'actiondata':_0x4fa4f4[_0xa33b('0x82')]?_0x4fa4f4[_0xa33b('0x82')]['CustomActionData']:undefined};if(_0x4fa4f4['channelData']&&_0x4fa4f4[_0xa33b('0x82')][_0xa33b('0x84')]){return base64Decode(_0x4fa4f4[_0xa33b('0x82')]['AudioFromTts'][_0xa33b('0x85')],path[_0xa33b('0x25')](__dirname,_0xa33b('0x36'),rs[_0xa33b('0x26')](0x4)+_0xa33b('0x27')))[_0xa33b('0x28')](function(_0x45db86){_0x1ccf35[_0xa33b('0x86')]=_0x45db86;return _0x1ccf35;});}return _0x1ccf35;});};exports[_0xa33b('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0x66f5=['finish\x20to\x20convert','start','resolve','tmp','.wav','base64','then','chmodSync','777','split','toString','googleCloudTTS','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','from','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','[%s]\x20%s:%s','message','textRequest','source','result','resolvedQuery','action','actionIncomplete','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','queryText','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','parse','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','dirName','dialogflow','http','https','path','request-promise','randomstring','sox','google-tts-api','url','./aws','./google','./sestek','agi','protocol','https:','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','info','finish\x20download\x20file','close','error','unlink','download\x20error','end','host','data','transcode','wav','error\x20convert'];(function(_0xa2285e,_0x49e515){var _0x403bf2=function(_0x5a0cf8){while(--_0x5a0cf8){_0xa2285e['push'](_0xa2285e['shift']());}};_0x403bf2(++_0x49e515);}(_0x66f5,0xe3));var _0x566f=function(_0x4d1349,_0x4831d6){_0x4d1349=_0x4d1349-0x0;var _0x5f37c0=_0x66f5[_0x4d1349];return _0x5f37c0;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x566f('0x0'));var fs=require('fs');var http=require(_0x566f('0x1'));var https=require(_0x566f('0x2'));var md5=require('md5');var path=require(_0x566f('0x3'));var querystring=require('querystring');var rp=require(_0x566f('0x4'));var rs=require(_0x566f('0x5'));var sox=require(_0x566f('0x6'));var tts=require(_0x566f('0x7'));var urlParse=require(_0x566f('0x8'))['parse'];var util=require('util');var aws=require(_0x566f('0x9'));var google=require(_0x566f('0xa'));var sestek=require(_0x566f('0xb'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x566f('0xc'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x1ed237,_0x35696b){return new BPromise(function(_0x3068b1,_0x2e9335){var _0x179a60=urlParse(_0x1ed237);var _0x46a2fb=_0x179a60[_0x566f('0xd')]===_0x566f('0xe')?https:http;var _0x4a5986={'host':_0x179a60['host'],'path':_0x179a60[_0x566f('0x3')],'headers':{'user-agent':_0x566f('0xf')}};_0x46a2fb[_0x566f('0x10')](_0x4a5986,function(_0x573ca0){if(_0x573ca0[_0x566f('0x11')]!==0xc8){logger['error'](_0x566f('0x12')+_0x1ed237+_0x566f('0x13')+_0x573ca0[_0x566f('0x11')]+'\x20('+_0x573ca0[_0x566f('0x14')]+')');_0x2e9335(new Error('request\x20to\x20'+_0x1ed237+_0x566f('0x13')+_0x573ca0[_0x566f('0x11')]+'\x20('+_0x573ca0[_0x566f('0x14')]+')'));return;}var _0x319878=fs['createWriteStream'](_0x35696b);_0x319878['on']('finish',function(){logger[_0x566f('0x15')](_0x566f('0x16'));_0x319878[_0x566f('0x17')](_0x3068b1);});_0x319878['on'](_0x566f('0x18'),function(_0x35dcf9){fs[_0x566f('0x19')](_0x35696b);logger[_0x566f('0x18')](_0x566f('0x1a'),_0x35dcf9);_0x2e9335(_0x35dcf9);});_0x573ca0['pipe'](_0x319878);})['on']('error',function(_0x32d63c){logger[_0x566f('0x18')](_0x32d63c);_0x2e9335(_0x32d63c);})[_0x566f('0x1b')]();});}function uploadFile(_0x181b84){return new BPromise(function(_0x261ccf,_0x44cb17){var _0x2d1054=urlParse(_0x181b84);var _0x240b1a=_0x2d1054[_0x566f('0xd')]===_0x566f('0xe')?https:http;var _0x5247e6={'host':_0x2d1054[_0x566f('0x1c')],'path':_0x2d1054[_0x566f('0x3')],'headers':{'user-agent':_0x566f('0xf')}};_0x240b1a[_0x566f('0x10')](_0x5247e6,function(_0x4deb36){if(_0x4deb36['statusCode']!==0xc8){_0x44cb17(new Error(_0x566f('0x12')+_0x181b84+_0x566f('0x13')+_0x4deb36[_0x566f('0x11')]+'\x20('+_0x4deb36[_0x566f('0x14')]+')'));return;}var _0x3a05a6='';_0x4deb36['on'](_0x566f('0x1d'),function(_0x1652da){_0x3a05a6+=_0x1652da;});_0x4deb36['on'](_0x566f('0x1b'),function(){_0x261ccf(_0x3a05a6);});})['on'](_0x566f('0x18'),function(_0xe27ab6){_0x44cb17(_0xe27ab6);})[_0x566f('0x1b')]();});}function convertFile(_0x1dd71a,_0x169728){return new BPromise(function(_0x374f82,_0x46a277){var _0x1e3df3=sox[_0x566f('0x1e')](_0x1dd71a,_0x169728,{'sampleRate':0x1f40,'format':_0x566f('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1e3df3['on'](_0x566f('0x18'),function(_0x2f26d7){logger[_0x566f('0x18')](_0x566f('0x20'),_0x2f26d7);_0x46a277(_0x2f26d7);});_0x1e3df3['on'](_0x566f('0x1b'),function(){logger[_0x566f('0x15')](_0x566f('0x21'));_0x374f82();});_0x1e3df3[_0x566f('0x22')]();});}function base64Decode(_0x391b23,_0x195859){var _0x1ce362=path[_0x566f('0x23')](__dirname,_0x566f('0x24'),rs['generate'](0x4)+_0x566f('0x25'));fs['writeFileSync'](_0x1ce362,_0x391b23,_0x566f('0x26'));return convertFile(_0x1ce362,_0x195859)[_0x566f('0x27')](function(){try{fs[_0x566f('0x19')](_0x1ce362);fs[_0x566f('0x28')](_0x195859,_0x566f('0x29'));}catch(_0x3cbeec){logger[_0x566f('0x18')](_0x3cbeec);}return _0x195859[_0x566f('0x2a')]('.')[0x0];});}function base64Encode(_0x252779){var _0x498cf4=fs['readFileSync'](_0x252779);return new Buffer(_0x498cf4)[_0x566f('0x2b')](_0x566f('0x26'));}exports[_0x566f('0x2c')]=function(_0x199791,_0xc83c0f,_0x4b4325,_0x20ce33,_0x43c7da,_0x4ae612){var _0x23863c,_0x4678cc;var _0x13522b='https://texttospeech.googleapis.com/v1/';var _0xf5db86=_0x566f('0x2d')+_0x199791;var _0x53caec={};if(_0xc83c0f==='ssml'){_0x53caec['input']={'ssml':_0x4b4325};}else{_0x53caec[_0x566f('0x2e')]={'text':_0x4b4325};};_0x53caec[_0x566f('0x2f')]={'languageCode':_0x20ce33,'ssmlGender':_0x43c7da};_0x53caec[_0x566f('0x30')]={'audioEncoding':_0x566f('0x31'),'sampleRateHertz':0x1f40};var _0x1fa9e6={'url':_0x13522b+_0x566f('0x32')+_0xf5db86,'method':_0x566f('0x33'),'json':!![],'body':_0x53caec};return rp(_0x1fa9e6)[_0x566f('0x27')](function(_0x520c0c){return new BPromise(function(_0x1ccdac,_0x259fde){_0x23863c=path['resolve'](__dirname,_0x566f('0x24'),rs[_0x566f('0x34')](0x4)+_0x566f('0x35'));var _0x397465=Buffer[_0x566f('0x36')](_0x520c0c['audioContent'],_0x566f('0x26'));return fs['writeFile'](_0x23863c,_0x397465,function(_0x1a5720){_0x259fde(_0x1a5720);},function(_0x5ec044){fs[_0x566f('0x28')](_0x23863c,_0x566f('0x29'));_0x1ccdac(_0x5ec044);});});})[_0x566f('0x27')](function(_0x24d57b){_0x4678cc=path[_0x566f('0x23')](__dirname,_0x566f('0x24'),rs['generate'](0x4)+_0x566f('0x25'));return convertFile(_0x23863c,_0x4678cc);})[_0x566f('0x27')](function(){try{fs[_0x566f('0x19')](_0x23863c);fs[_0x566f('0x28')](_0x4678cc,_0x566f('0x29'));}catch(_0x13be51){logger[_0x566f('0x18')](_0x13be51);}logger[_0x566f('0x15')](_0x566f('0x37'),_0x4678cc[_0x566f('0x2a')]('.')[0x0]);return _0x4678cc[_0x566f('0x2a')]('.')[0x0];});};exports[_0x566f('0x38')]=function(_0x154cf7,_0x5368f4){var _0x69a5e0=_0x566f('0x39');var _0x3f1a38,_0x20261b;var _0xdcfc0c;var _0x204375={'encoding':'utf8','method':_0x566f('0x33'),'timeout':0x2710,'url':_0x69a5e0,'headers':{'Content-Type':_0x566f('0x3a')},'body':'f.req='+encodeURIComponent(JSON[_0x566f('0x3b')]([[[_0x566f('0x3c'),JSON[_0x566f('0x3b')]([_0x154cf7,_0x5368f4||'en',![],'null']),null,_0x566f('0x3d')]]]))};return rp(_0x204375)[_0x566f('0x27')](function(_0x1fa683){try{_0xdcfc0c=eval(_0x1fa683[_0x566f('0x3e')](0x5))[0x0][0x2];}catch(_0x1c9733){throw new Error(_0x566f('0x3f')+_0x1fa683[_0x566f('0x1d')]);}if(!_0xdcfc0c){if(_0x154cf7[_0x566f('0x40')]>0xc8){throw new Error(_0x566f('0x41'));}else{throw new Error(_0x566f('0x42')+_0x5368f4+_0x566f('0x43'));}}try{_0xdcfc0c=eval(_0xdcfc0c)[0x0];}catch(_0x2018c7){throw new Error(_0x566f('0x3f')+res[_0x566f('0x1d')]);}const _0x49bc69=_0xdcfc0c;_0x3f1a38=path['resolve'](__dirname,_0x566f('0x24'),rs[_0x566f('0x34')](0x4)+_0x566f('0x35'));fs[_0x566f('0x44')](_0x3f1a38,_0xdcfc0c,{'encoding':_0x566f('0x26')});_0x20261b=path[_0x566f('0x23')](__dirname,_0x566f('0x24'),rs[_0x566f('0x34')](0x4)+'.wav');return convertFile(_0x3f1a38,_0x20261b);})[_0x566f('0x27')](function(){try{fs['unlink'](_0x3f1a38);fs[_0x566f('0x28')](_0x20261b,_0x566f('0x29'));}catch(_0x33cad2){logger[_0x566f('0x18')](_0x33cad2);}logger[_0x566f('0x15')](_0x566f('0x45'),_0x20261b['split']('.')[0x0]);return _0x20261b['split']('.')[0x0];});};exports[_0x566f('0x46')]=function(_0x527359,_0x3d16b3,_0x32c83d){return google[_0x566f('0x47')](_0x527359,_0x3d16b3,_0x32c83d)['then'](function(_0x4bc076){logger[_0x566f('0x15')](_0x4bc076[_0x566f('0x48')]);return rp(_0x4bc076);})[_0x566f('0x27')](function(_0x1d84a0){var _0x2b3350='';var _0x8390fe=0x0;try{fs[_0x566f('0x19')](_0x527359);}catch(_0x9ba689){logger[_0x566f('0x18')](_0x9ba689);}if(_0x1d84a0&&_0x1d84a0['results']){_0x2b3350=_0x1d84a0[_0x566f('0x49')][_0x566f('0x4a')](function(_0x42ce78){return _0x42ce78&&_0x42ce78['alternatives'][0x0]&&_0x42ce78['alternatives'][0x0]['transcript']?_0x42ce78[_0x566f('0x4b')][0x0][_0x566f('0x4c')]:'';})['join']('\x0a');_0x8390fe=_0x1d84a0[_0x566f('0x49')][_0x566f('0x4a')](function(_0x4c9b21){return _0x4c9b21&&_0x4c9b21[_0x566f('0x4b')][0x0]&&_0x4c9b21['alternatives'][0x0][_0x566f('0x4d')]?_0x4c9b21['alternatives'][0x0]['confidence']:0x0;})[_0x566f('0x4e')]('\x0a');}logger[_0x566f('0x15')](_0x566f('0x4f'),_0x2b3350);logger['info']('googleASR\x20confidence',_0x8390fe);return{'transcript':_0x2b3350,'confidence':_0x8390fe};})['catch'](function(_0x526946){logger[_0x566f('0x18')](_0x566f('0x50'),_0x526946[_0x566f('0x11')],_0x526946['name'],_0x526946[_0x566f('0x51')]);});};exports['googleDialogflow']=function(_0x48b3ca,_0x4d45ec,_0x1f2fa4,_0x46f207){var _0x1c3f11=apiai(_0x4d45ec,{'language':_0x46f207||'en'});return _0x1c3f11[_0x566f('0x52')](_0x1f2fa4,{'sessionId':md5(_0x48b3ca)})[_0x566f('0x27')](function(_0x1fe940){logger[_0x566f('0x15')](JSON['stringify'](_0x1fe940));return{'source':_0x1fe940['result'][_0x566f('0x53')],'resolvedQuery':_0x1fe940[_0x566f('0x54')][_0x566f('0x55')],'action':_0x1fe940[_0x566f('0x54')][_0x566f('0x56')],'actionIncomplete':_0x1fe940[_0x566f('0x54')][_0x566f('0x57')],'speech':_0x1fe940[_0x566f('0x54')]['fulfillment'][_0x566f('0x58')],'score':_0x1fe940[_0x566f('0x54')][_0x566f('0x59')],'statusCode':_0x1fe940['status'][_0x566f('0x5a')],'endConversation':_0x1fe940[_0x566f('0x54')][_0x566f('0x5b')][_0x566f('0x5c')]||![],'isFallbackIntent':_0x1fe940[_0x566f('0x54')][_0x566f('0x5b')][_0x566f('0x5d')]};});};exports[_0x566f('0x5e')]=function(_0x583551,_0x19edfa,_0x4eb22d,_0x4723aa,_0x2c4dee,_0x2e0c4a){var _0x3a258d=_0x4723aa['replace'](/\\n/g,'\x0a');var _0x3fa4c0={'credentials':{'private_key':_0x3a258d,'client_email':_0x4eb22d}};var _0x8f621c=new dialogflow[(_0x566f('0x5f'))](_0x3fa4c0);var _0xe20e23=_0x8f621c[_0x566f('0x60')](_0x19edfa,md5(_0x583551));var _0x511352={'session':_0xe20e23,'queryInput':{'text':{'text':_0x2c4dee,'languageCode':_0x2e0c4a}}};return _0x8f621c[_0x566f('0x61')](_0x511352)[_0x566f('0x27')](function(_0x3d56e3){if(_0x3d56e3&&_0x3d56e3['length']){logger[_0x566f('0x15')](_0x566f('0x62'),JSON[_0x566f('0x3b')](_0x3d56e3));var _0x534d23=_0x3d56e3[0x0];if(_0x534d23){var _0x5c02aa={'action':_0x534d23[_0x566f('0x63')][_0x566f('0x56')],'allRequiredParamsPresent':_0x534d23['queryResult'][_0x566f('0x64')],'endConversation':_0x534d23[_0x566f('0x63')][_0x566f('0x65')]&&_0x534d23[_0x566f('0x63')]['diagnosticInfo'][_0x566f('0x66')]?_0x534d23[_0x566f('0x63')][_0x566f('0x65')][_0x566f('0x66')][_0x566f('0x67')][_0x566f('0x68')]:![],'fulfillmentText':_0x534d23[_0x566f('0x63')]['fulfillmentText'],'intentName':_0x534d23[_0x566f('0x63')][_0x566f('0x69')]['name'],'intentDisplayName':_0x534d23[_0x566f('0x63')][_0x566f('0x69')][_0x566f('0x6a')],'isFallbackIntent':_0x534d23[_0x566f('0x63')][_0x566f('0x69')]['isFallback'],'languageCode':_0x534d23[_0x566f('0x63')]['languageCode'],'queryText':_0x534d23[_0x566f('0x63')][_0x566f('0x6b')],'responseId':_0x534d23['responseId'],'score':_0x534d23['queryResult'][_0x566f('0x6c')],'speech':_0x534d23[_0x566f('0x63')][_0x566f('0x6d')],'providerResponse':JSON[_0x566f('0x3b')](_0x3d56e3)};return _0x5c02aa;}}});};exports[_0x566f('0x6e')]=function(_0x28c609,_0x542bcb,_0x2b8804,_0x54cae9){return tilde[_0x566f('0x47')](_0x28c609,_0x542bcb,_0x2b8804,_0x54cae9)[_0x566f('0x27')](function(_0x36f733){try{fs[_0x566f('0x19')](_0x28c609);}catch(_0x147486){logger['error'](_0x147486);}logger[_0x566f('0x15')](_0x566f('0x6f'),_0x36f733[_0x566f('0x4c')]);logger[_0x566f('0x15')](_0x566f('0x70'),_0x36f733[_0x566f('0x4d')]);return _0x36f733;});};exports[_0x566f('0x71')]=function(_0x218d96,_0x575786,_0x25ad77,_0x362a1a,_0x574061,_0x3fd443){var _0x9c241b=path[_0x566f('0x23')](__dirname,_0x566f('0x24'),rs[_0x566f('0x34')](0x4)+'.mp3');var _0xf19ff7;return aws[_0x566f('0x72')](_0x218d96,_0x575786,_0x25ad77,_0x362a1a,_0x574061,_0x3fd443,_0x9c241b)[_0x566f('0x27')](function(){_0xf19ff7=path[_0x566f('0x23')](__dirname,_0x566f('0x24'),rs[_0x566f('0x34')](0x4)+'.wav');return convertFile(_0x9c241b,_0xf19ff7);})['then'](function(){try{fs['unlink'](_0x9c241b);fs[_0x566f('0x28')](_0xf19ff7,_0x566f('0x29'));}catch(_0x2a24dc){logger[_0x566f('0x18')](_0x2a24dc);}return _0xf19ff7['split']('.')[0x0];});};exports[_0x566f('0x73')]=function(_0x156a0d,_0x2c0dc4,_0x6627c5,_0x18e88f,_0x5becc4,_0x46539d){return aws['lex'](_0x156a0d,_0x2c0dc4,_0x6627c5,_0x18e88f,_0x5becc4,_0x46539d)[_0x566f('0x27')](function(_0x10b51f){logger[_0x566f('0x15')](JSON[_0x566f('0x3b')](_0x10b51f));return _0x10b51f;});};exports[_0x566f('0x74')]=function(_0x4622c2,_0x1ec7bb,_0x4aaa76,_0x116d15){var _0x20204a=util[_0x566f('0x75')](_0x566f('0x76'),ISPEECH_API,_0x4622c2,encodeURIComponent(_0x1ec7bb),_0x4aaa76,_0x116d15);var _0x2a33f1=path[_0x566f('0x23')](__dirname,'tmp',rs[_0x566f('0x34')](0x4)+_0x566f('0x35'));var _0x31370b;return downloadFile(_0x20204a,_0x2a33f1)[_0x566f('0x27')](function(){_0x31370b=path[_0x566f('0x23')](__dirname,'tmp',rs[_0x566f('0x34')](0x4)+'.wav');return convertFile(_0x2a33f1,_0x31370b);})['then'](function(){try{fs[_0x566f('0x19')](_0x2a33f1);fs[_0x566f('0x28')](_0x31370b,_0x566f('0x29'));}catch(_0x1a2fa1){logger[_0x566f('0x18')](_0x1a2fa1);}return _0x31370b[_0x566f('0x2a')]('.')[0x0];});};exports['ispeechASR']=function(_0x15b19b,_0x2d4208,_0x32eccf,_0x5a7b25){var _0x4592c8=util[_0x566f('0x75')](_0x566f('0x77'),ISPEECH_API,_0x2d4208,_0x32eccf,base64Encode(_0x15b19b),_0x5a7b25?util[_0x566f('0x75')](_0x566f('0x78'),encodeURIComponent(_0x5a7b25)):'freeform=3');return uploadFile(_0x4592c8)[_0x566f('0x27')](function(_0x553da7){return querystring[_0x566f('0x79')](_0x553da7);});};exports[_0x566f('0x7a')]=function(_0x188251,_0x1bcb64){return sestek[_0x566f('0x7b')](_0x188251,_0x1bcb64)['then'](function(_0x374181){logger[_0x566f('0x15')](JSON[_0x566f('0x3b')](_0x374181));var _0x4b7538={'speech':_0x374181[_0x566f('0x7c')],'action':_0x374181[_0x566f('0x7d')]?_0x374181[_0x566f('0x7d')][_0x566f('0x7e')]:undefined,'actiondata':_0x374181[_0x566f('0x7d')]?_0x374181[_0x566f('0x7d')]['CustomActionData']:undefined};if(_0x374181[_0x566f('0x7d')]&&_0x374181['channelData'][_0x566f('0x7f')]){return base64Decode(_0x374181['channelData']['AudioFromTts'][_0x566f('0x80')],path[_0x566f('0x23')](__dirname,_0x566f('0x24'),rs[_0x566f('0x34')](0x4)+_0x566f('0x25')))[_0x566f('0x27')](function(_0x411ff7){_0x4b7538['audiofile']=_0x411ff7;return _0x4b7538;});}return _0x4b7538;});};exports[_0x566f('0x81')]=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 34ef294..9ab7c7d 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 _0x53df=['exports'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0x53df,0x93));var _0xf53d=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x53df[_0x3de8a4];return _0x4635cf;};var nda=require('./nda');module[_0xf53d('0x0')]={'nda':nda}; \ No newline at end of file +var _0xe24f=['./nda','exports'];(function(_0x30fa81,_0x92dad0){var _0x27f0d9=function(_0x50cffc){while(--_0x50cffc){_0x30fa81['push'](_0x30fa81['shift']());}};_0x27f0d9(++_0x92dad0);}(_0xe24f,0xa8));var _0xfe24=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe24f[_0x321bb2];return _0x9c12ed;};var nda=require(_0xfe24('0x0'));module[_0xfe24('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index c4521d1..dfdc20c 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 _0x5712=['ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','password','then','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','project','body','channelData'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x5712,0x140));var _0x2571=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5712[_0x397e5f];return _0x5302b8;};'use strict';var rp=require(_0x2571('0x0'));var url=require(_0x2571('0x1'));var logger=require(_0x2571('0x2'))(_0x2571('0x3'));module[_0x2571('0x4')]=function(_0xcd3caf,_0x29c464){var _0x1b044e={'method':_0x2571('0x5'),'uri':url[_0x2571('0x6')](_0x29c464['ndauth_url'],'/token'),'form':{'grant_type':_0x2571('0x7'),'username':_0x29c464['username'],'password':_0x29c464[_0x2571('0x7')]},'json':!![]};return rp(_0x1b044e)[_0x2571('0x8')](function(_0x3ca885){var _0x204ecc={'method':_0x2571('0x5'),'uri':url[_0x2571('0x6')](_0x29c464['ndassistant_url'],_0x2571('0x9')),'body':{'type':_0x29c464['ndaactivity_type']||_0x2571('0xa'),'channelId':_0x2571('0xb'),'conversation':{'id':_0xcd3caf[_0x2571('0xc')]},'from':{'id':_0xcd3caf[_0x2571('0xd')],'name':_0xcd3caf[_0x2571('0xe')]},'recipient':{'id':_0xcd3caf[_0x2571('0xf')],'name':_0xcd3caf[_0x2571('0x10')]},'text':_0x29c464[_0x2571('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x3ca885['access_token']},'json':!![]};if(_0x29c464[_0x2571('0x12')]){_0x204ecc[_0x2571('0x13')][_0x2571('0x14')][_0x2571('0x15')]=_0x29c464[_0x2571('0x12')];}if(_0x29c464[_0x2571('0x16')]=='1'){_0x204ecc[_0x2571('0x13')][_0x2571('0x14')][_0x2571('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2571('0x18')};}if(_0x29c464[_0x2571('0x19')]){_0x204ecc[_0x2571('0x13')]['channelData'][_0x2571('0x1a')]=_0x29c464['custom_action'];if(_0x29c464['custom_action_data']){_0x204ecc['body']['channelData'][_0x2571('0x1b')]=_0x29c464[_0x2571('0x1c')];}}logger[_0x2571('0x1d')](JSON[_0x2571('0x1e')](_0x204ecc));return rp(_0x204ecc);});}; \ No newline at end of file +var _0x644a=['text','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','ndauth_url','/token','password','then','POST','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid'];(function(_0x29c3a0,_0x32be87){var _0x430f8a=function(_0x4143d9){while(--_0x4143d9){_0x29c3a0['push'](_0x29c3a0['shift']());}};_0x430f8a(++_0x32be87);}(_0x644a,0xfd));var _0xa644=function(_0x5f31b0,_0x5d6223){_0x5f31b0=_0x5f31b0-0x0;var _0x5eb946=_0x644a[_0x5f31b0];return _0x5eb946;};'use strict';var rp=require(_0xa644('0x0'));var url=require(_0xa644('0x1'));var logger=require(_0xa644('0x2'))(_0xa644('0x3'));module[_0xa644('0x4')]=function(_0x48801b,_0x1423b7){var _0x704008={'method':'POST','uri':url['resolve'](_0x1423b7[_0xa644('0x5')],_0xa644('0x6')),'form':{'grant_type':_0xa644('0x7'),'username':_0x1423b7['username'],'password':_0x1423b7[_0xa644('0x7')]},'json':!![]};return rp(_0x704008)[_0xa644('0x8')](function(_0x4f8b23){var _0x15995f={'method':_0xa644('0x9'),'uri':url['resolve'](_0x1423b7['ndassistant_url'],_0xa644('0xa')),'body':{'type':_0x1423b7[_0xa644('0xb')]||'message','channelId':_0xa644('0xc'),'conversation':{'id':_0x48801b[_0xa644('0xd')]},'from':{'id':_0x48801b[_0xa644('0xe')],'name':_0x48801b[_0xa644('0xf')]},'recipient':{'id':_0x48801b[_0xa644('0x10')],'name':_0x48801b['extension']},'text':_0x1423b7[_0xa644('0x11')],'channelData':{}},'headers':{'Authorization':_0xa644('0x12')+_0x4f8b23[_0xa644('0x13')]},'json':!![]};if(_0x1423b7[_0xa644('0x14')]){_0x15995f[_0xa644('0x15')][_0xa644('0x16')]['ProjectName']=_0x1423b7[_0xa644('0x14')];}if(_0x1423b7[_0xa644('0x17')]=='1'){_0x15995f[_0xa644('0x15')][_0xa644('0x16')][_0xa644('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa644('0x19')};}if(_0x1423b7['custom_action']){_0x15995f['body']['channelData']['CustomAction']=_0x1423b7['custom_action'];if(_0x1423b7['custom_action_data']){_0x15995f[_0xa644('0x15')][_0xa644('0x16')][_0xa644('0x1a')]=_0x1423b7[_0xa644('0x1b')];}}logger[_0xa644('0x1c')](JSON[_0xa644('0x1d')](_0x15995f));return rp(_0x15995f);});}; \ 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 e809ff1..556649b 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5335=['./lib/api'];(function(_0x58e32c,_0x309781){var _0x481e60=function(_0x5326ab){while(--_0x5326ab){_0x58e32c['push'](_0x58e32c['shift']());}};_0x481e60(++_0x309781);}(_0x5335,0xec));var _0x5533=function(_0x6948b1,_0x4c7a43){_0x6948b1=_0x6948b1-0x0;var _0x5be4ba=_0x5335[_0x6948b1];return _0x5be4ba;};'use strict';var asr=require(_0x5533('0x0'));module['exports']=function(_0x3ee3be,_0xfe1bfa,_0x265b7b,_0x55a8b6){return asr(_0x3ee3be,_0xfe1bfa,_0x265b7b,_0x55a8b6);}; \ No newline at end of file +var _0x4c29=['exports','./lib/api'];(function(_0x166891,_0x550033){var _0x4a6944=function(_0x5cfab0){while(--_0x5cfab0){_0x166891['push'](_0x166891['shift']());}};_0x4a6944(++_0x550033);}(_0x4c29,0x17b));var _0x94c2=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x4c29[_0x3ff085];return _0x2b68c3;};'use strict';var asr=require(_0x94c2('0x0'));module[_0x94c2('0x1')]=function(_0xcd1d8e,_0x24838f,_0x3fafb2,_0x567884){return asr(_0xcd1d8e,_0x24838f,_0x3fafb2,_0x567884);}; \ 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 c224b7b..fbef421 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 _0x23c8=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.'];(function(_0x468595,_0x5e6f6b){var _0x14c0fe=function(_0x49acbc){while(--_0x49acbc){_0x468595['push'](_0x468595['shift']());}};_0x14c0fe(++_0x5e6f6b);}(_0x23c8,0x80));var _0x823c=function(_0x392dc3,_0x58d83a){_0x392dc3=_0x392dc3-0x0;var _0x2193d6=_0x23c8[_0x392dc3];return _0x2193d6;};'use strict';var BPromise=require(_0x823c('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x823c('0x1'));var crypto=require('crypto');var logger=require(_0x823c('0x2'))(_0x823c('0x3'));module[_0x823c('0x4')]=function(_0x5311af,_0x3bae8b,_0x3251f6,_0x340929){return new BPromise(function(_0x4d7c2a,_0xda3781){logger[_0x823c('0x5')](_0x823c('0x6'),_0x340929||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x5e4424=new WebSocket(_0x340929||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x32bed4='';var _0x2510be='0';var _0x46b0ee='1';var _0x47a7df=_0x823c('0x7');function _0x175060(_0x5349ca){var _0x5b54b7=crypto['createHash'](_0x823c('0x8'));_0x5b54b7[_0x823c('0x9')](_0x5349ca);return _0x5b54b7[_0x823c('0xa')](_0x823c('0xb'));}function _0x216c01(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x15849c=moment()[_0x823c('0xc')]();var _0x4f4419=_0x175060(_0x15849c+_0x3bae8b+_0x3251f6);_0x5e4424[_0x823c('0xd')](JSON[_0x823c('0xe')]({'appID':_0x3bae8b,'timestamp':_0x15849c,'appKey':_0x4f4419}));var _0x5440d4=fs[_0x823c('0xf')](_0x5311af);_0x5440d4['on'](_0x823c('0x10'),function(_0x386894){_0x5e4424[_0x823c('0xd')](_0x386894);});_0x5440d4['on'](_0x823c('0x11'),function(){_0x5e4424['send'](_0x823c('0x12'));});}catch(_0x2f9aef){logger[_0x823c('0x13')](_0x823c('0x14'),JSON['stringify'](_0x2f9aef));_0x5e4424[_0x823c('0x15')]();}}function _0x3ca01(_0x100270){try{if(_0x100270){var _0x5d0d31=JSON[_0x823c('0x16')](_0x100270);switch(_0x5d0d31[_0x823c('0x17')]){case 0x0:if(_0x5d0d31[_0x823c('0x18')]){if(_0x5d0d31[_0x823c('0x18')][_0x823c('0x19')]){logger[_0x823c('0x5')](_0x823c('0x1a'),JSON['stringify'](_0x5d0d31[_0x823c('0x18')][_0x823c('0x1b')]));_0x32bed4=_0x5d0d31[_0x823c('0x18')]['hypotheses'][0x0]['transcript'];_0x2510be=_0x5d0d31[_0x823c('0x18')][_0x823c('0x1b')][0x0][_0x823c('0x1c')];_0x46b0ee='0';_0x47a7df='Success.';_0x5e4424[_0x823c('0x15')]();}}break;case 0x1:logger[_0x823c('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x46b0ee='1';_0x47a7df='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x823c('0x5')](_0x823c('0x1d'));_0x46b0ee='2';_0x47a7df=_0x823c('0x1d');break;case 0x9:logger[_0x823c('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x46b0ee='9';_0x47a7df=_0x823c('0x1e');break;case 0xa:logger[_0x823c('0x5')](_0x823c('0x1f'));_0x46b0ee='10';_0x47a7df=_0x823c('0x1f');break;case 0xb:logger[_0x823c('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x46b0ee='11';_0x47a7df=_0x823c('0x20');}}}catch(_0x275129){logger[_0x823c('0x13')](_0x823c('0x21'),JSON[_0x823c('0xe')](_0x275129));_0x5e4424[_0x823c('0x15')]();}}function _0x24d08a(){logger[_0x823c('0x5')](_0x823c('0x22'));_0x4d7c2a({'transcript':_0x32bed4,'confidence':_0x2510be,'status':_0x46b0ee,'status_message':_0x47a7df});}function _0x3295d2(_0x3129de){logger[_0x823c('0x13')](_0x823c('0x23'));if(!_[_0x823c('0x24')](_0x3129de)){logger[_0x823c('0x13')](_[_0x823c('0x25')](_0x3129de)?JSON[_0x823c('0xe')](_0x3129de):_0x3129de);}}_0x5e4424['on'](_0x823c('0x26'),_0x216c01);_0x5e4424['on'](_0x823c('0x27'),_0x3ca01);_0x5e4424['on'](_0x823c('0x11'),_0x24d08a);_0x5e4424['on']('error',_0x3295d2);});}; \ No newline at end of file +var _0xcb12=['parse','status','result','final','info','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','terminate'];(function(_0x25ea4b,_0x38e669){var _0x4c819d=function(_0x2ac3dc){while(--_0x2ac3dc){_0x25ea4b['push'](_0x25ea4b['shift']());}};_0x4c819d(++_0x38e669);}(_0xcb12,0x131));var _0x2cb1=function(_0x46238f,_0x304b4d){_0x46238f=_0x46238f-0x0;var _0x49213b=_0xcb12[_0x46238f];return _0x49213b;};'use strict';var BPromise=require(_0x2cb1('0x0'));var _=require(_0x2cb1('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2cb1('0x2'));var crypto=require(_0x2cb1('0x3'));var logger=require(_0x2cb1('0x4'))('agi');module[_0x2cb1('0x5')]=function(_0x5ca2f4,_0x5f3a3f,_0x3b2a84,_0x2f3314){return new BPromise(function(_0x42df50,_0x3ed945){logger['info'](_0x2cb1('0x6'),_0x2f3314||_0x2cb1('0x7'));var _0x3e86a2=new WebSocket(_0x2f3314||_0x2cb1('0x7'),{'perMessageDeflate':![]});var _0x3c512d='';var _0x9147a8='0';var _0x416fbf='1';var _0x5d9eb8=_0x2cb1('0x8');function _0x3ec938(_0x27affb){var _0x387c11=crypto['createHash'](_0x2cb1('0x9'));_0x387c11[_0x2cb1('0xa')](_0x27affb);return _0x387c11[_0x2cb1('0xb')](_0x2cb1('0xc'));}function _0x496b77(){try{logger['info'](_0x2cb1('0xd'));var _0x41d7e2=moment()[_0x2cb1('0xe')]();var _0x15ba8d=_0x3ec938(_0x41d7e2+_0x5f3a3f+_0x3b2a84);_0x3e86a2[_0x2cb1('0xf')](JSON[_0x2cb1('0x10')]({'appID':_0x5f3a3f,'timestamp':_0x41d7e2,'appKey':_0x15ba8d}));var _0xb5fd75=fs[_0x2cb1('0x11')](_0x5ca2f4);_0xb5fd75['on'](_0x2cb1('0x12'),function(_0x7a2368){_0x3e86a2[_0x2cb1('0xf')](_0x7a2368);});_0xb5fd75['on']('close',function(){_0x3e86a2['send'](_0x2cb1('0x13'));});}catch(_0x2cb4ac){logger[_0x2cb1('0x14')](_0x2cb1('0x15'),JSON[_0x2cb1('0x10')](_0x2cb4ac));_0x3e86a2[_0x2cb1('0x16')]();}}function _0x524877(_0x3e2661){try{if(_0x3e2661){var _0x44d907=JSON[_0x2cb1('0x17')](_0x3e2661);switch(_0x44d907[_0x2cb1('0x18')]){case 0x0:if(_0x44d907[_0x2cb1('0x19')]){if(_0x44d907[_0x2cb1('0x19')][_0x2cb1('0x1a')]){logger[_0x2cb1('0x1b')](_0x2cb1('0x1c'),JSON[_0x2cb1('0x10')](_0x44d907[_0x2cb1('0x19')]['hypotheses']));_0x3c512d=_0x44d907[_0x2cb1('0x19')][_0x2cb1('0x1d')][0x0][_0x2cb1('0x1e')];_0x9147a8=_0x44d907[_0x2cb1('0x19')][_0x2cb1('0x1d')][0x0][_0x2cb1('0x1f')];_0x416fbf='0';_0x5d9eb8='Success.';_0x3e86a2[_0x2cb1('0x16')]();}}break;case 0x1:logger[_0x2cb1('0x1b')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x416fbf='1';_0x5d9eb8=_0x2cb1('0x8');break;case 0x2:logger[_0x2cb1('0x1b')](_0x2cb1('0x20'));_0x416fbf='2';_0x5d9eb8=_0x2cb1('0x20');break;case 0x9:logger[_0x2cb1('0x1b')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x416fbf='9';_0x5d9eb8=_0x2cb1('0x21');break;case 0xa:logger[_0x2cb1('0x1b')](_0x2cb1('0x22'));_0x416fbf='10';_0x5d9eb8='Authentication\x20failed.';break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x416fbf='11';_0x5d9eb8='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x1c38ed){logger[_0x2cb1('0x14')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x2cb1('0x10')](_0x1c38ed));_0x3e86a2[_0x2cb1('0x16')]();}}function _0x569414(){logger['info'](_0x2cb1('0x23'));_0x42df50({'transcript':_0x3c512d,'confidence':_0x9147a8,'status':_0x416fbf,'status_message':_0x5d9eb8});}function _0x5db2c7(_0x1d8381){logger[_0x2cb1('0x14')](_0x2cb1('0x24'));if(!_[_0x2cb1('0x25')](_0x1d8381)){logger[_0x2cb1('0x14')](_['isObject'](_0x1d8381)?JSON[_0x2cb1('0x10')](_0x1d8381):_0x1d8381);}}_0x3e86a2['on'](_0x2cb1('0x26'),_0x496b77);_0x3e86a2['on'](_0x2cb1('0x27'),_0x524877);_0x3e86a2['on'](_0x2cb1('0x28'),_0x569414);_0x3e86a2['on'](_0x2cb1('0x14'),_0x5db2c7);});}; \ 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 f1e224b..45db9f0 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 _0x5982=['./asr','exports'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x5982,0x192));var _0x2598=function(_0x577d64,_0x78e1dc){_0x577d64=_0x577d64-0x0;var _0x254a25=_0x5982[_0x577d64];return _0x254a25;};var asr=require(_0x2598('0x0'));module[_0x2598('0x1')]={'asr':asr}; \ No newline at end of file +var _0x9aa5=['./asr','exports'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x9aa5,0x114));var _0x59aa=function(_0x556d84,_0x57b7a2){_0x556d84=_0x556d84-0x0;var _0x430879=_0x9aa5[_0x556d84];return _0x430879;};var asr=require(_0x59aa('0x0'));module[_0x59aa('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 999ee2a..e806c97 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 _0x8c4d=['listening','connection','emit','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','events','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','createServer','listen'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x8c4d,0xa8));var _0xd8c4=function(_0x13fdb3,_0x493557){_0x13fdb3=_0x13fdb3-0x0;var _0x212e46=_0x8c4d[_0x13fdb3];return _0x212e46;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0xd8c4('0x0'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0xd8c4('0x1'));var AGIServer=function(_0x57efe5,_0x2557fa,_0x59457e){var _0x13c9e1=this,_0x57efe5=_0x57efe5||0x11dd,_0x2557fa=_0x2557fa||_0xd8c4('0x2'),_0x2fa348=null,_0x20d24c=0x0;EventEmitter[_0xd8c4('0x3')](_0x13c9e1);function _0x3b5164(){if(!_0x57efe5){_0x13c9e1['emit'](_0xd8c4('0x4'),new AGIError(_0xd8c4('0x5')));return![];}_0x2fa348=net[_0xd8c4('0x6')]();_0x2fa348[_0xd8c4('0x7')](_0x57efe5,_0x2557fa);_0x2fa348['on'](_0xd8c4('0x8'),function(){_0x13c9e1['emit']('listening');});_0x2fa348['on'](_0xd8c4('0x9'),function(_0x3ec4af){_0x2fa348['getConnections'](function(_0x21f872,_0x11911d){if(_0x21f872){_0x13c9e1[_0xd8c4('0xa')](_0xd8c4('0x4'),new AGIError(_0xd8c4('0xb'),_0x21f872));}else if(_0x59457e&&_0x59457e<0x0){_0x13c9e1[_0xd8c4('0xa')]('error',new AGIError(_0xd8c4('0xc')));_0x3ec4af[_0xd8c4('0xd')]();}else if(_0x59457e&&_0x59457e>0x0&&_0x59457e<_0x11911d){_0x20d24c+=0x1;_0x13c9e1[_0xd8c4('0xa')]('error',new AGIError(_0xd8c4('0xe'),_0x20d24c));_0x3ec4af[_0xd8c4('0xd')]();}else{var _0x5c07a3=new AGIChannel(_0x3ec4af);_0x5c07a3['on'](_0xd8c4('0xf'),function(){_0x13c9e1[_0xd8c4('0xa')](_0xd8c4('0x9'),_0x5c07a3);});}});});_0x2fa348['on'](_0xd8c4('0x4'),function(_0x2da6b1){_0x13c9e1['emit'](_0xd8c4('0x4'),new AGIError(_0xd8c4('0xb'),_0x2da6b1[_0xd8c4('0x10')]));});_0x2fa348['on'](_0xd8c4('0x11'),function(){_0x13c9e1[_0xd8c4('0xa')]('close',new AGIError(_0xd8c4('0x12')));});}process[_0xd8c4('0x13')](function(){_0x3b5164();});};util[_0xd8c4('0x14')](AGIServer,EventEmitter);module[_0xd8c4('0x15')]=function(_0x1a90d3,_0x1ad614,_0x3d8588){return new AGIServer(_0x1a90d3,_0x1ad614,_0x3d8588);}; \ No newline at end of file +var _0x04fd=['util','events','EventEmitter','./error','127.0.0.1','call','emit','error','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','code','close','nextTick','inherits','exports'];(function(_0x547736,_0x2e425a){var _0x3afe51=function(_0xdd1cbd){while(--_0xdd1cbd){_0x547736['push'](_0x547736['shift']());}};_0x3afe51(++_0x2e425a);}(_0x04fd,0xbd));var _0xd04f=function(_0x2cfb28,_0x3b8de0){_0x2cfb28=_0x2cfb28-0x0;var _0x183e1f=_0x04fd[_0x2cfb28];return _0x183e1f;};'use strict';var util=require(_0xd04f('0x0'));var net=require('net');var EventEmitter=require(_0xd04f('0x1'))[_0xd04f('0x2')];var AGIError=require(_0xd04f('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x3d50ab,_0x4eb315,_0x12d187){var _0x4af8ce=this,_0x3d50ab=_0x3d50ab||0x11dd,_0x4eb315=_0x4eb315||_0xd04f('0x4'),_0x4ce8c3=null,_0x50b37c=0x0;EventEmitter[_0xd04f('0x5')](_0x4af8ce);function _0x2e7013(){if(!_0x3d50ab){_0x4af8ce[_0xd04f('0x6')](_0xd04f('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x4ce8c3=net[_0xd04f('0x8')]();_0x4ce8c3[_0xd04f('0x9')](_0x3d50ab,_0x4eb315);_0x4ce8c3['on'](_0xd04f('0xa'),function(){_0x4af8ce[_0xd04f('0x6')](_0xd04f('0xa'));});_0x4ce8c3['on'](_0xd04f('0xb'),function(_0x28d3be){_0x4ce8c3[_0xd04f('0xc')](function(_0x3b8e7a,_0x386619){if(_0x3b8e7a){_0x4af8ce[_0xd04f('0x6')](_0xd04f('0x7'),new AGIError(_0xd04f('0xd'),_0x3b8e7a));}else if(_0x12d187&&_0x12d187<0x0){_0x4af8ce[_0xd04f('0x6')](_0xd04f('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x28d3be[_0xd04f('0xe')]();}else if(_0x12d187&&_0x12d187>0x0&&_0x12d187<_0x386619){_0x50b37c+=0x1;_0x4af8ce[_0xd04f('0x6')](_0xd04f('0x7'),new AGIError(_0xd04f('0xf'),_0x50b37c));_0x28d3be['destroy']();}else{var _0x5c8bf7=new AGIChannel(_0x28d3be);_0x5c8bf7['on']('ready',function(){_0x4af8ce[_0xd04f('0x6')](_0xd04f('0xb'),_0x5c8bf7);});}});});_0x4ce8c3['on']('error',function(_0xa8aeb3){_0x4af8ce['emit'](_0xd04f('0x7'),new AGIError(_0xd04f('0xd'),_0xa8aeb3[_0xd04f('0x10')]));});_0x4ce8c3['on']('close',function(){_0x4af8ce[_0xd04f('0x6')](_0xd04f('0x11'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xd04f('0x12')](function(){_0x2e7013();});};util[_0xd04f('0x13')](AGIServer,EventEmitter);module[_0xd04f('0x14')]=function(_0xa6757,_0xfe558f,_0xa273cf){return new AGIServer(_0xa6757,_0xfe558f,_0xa273cf);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 4a10ec9..6c214c6 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 _0x39a9=['Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','replaceAll','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','prototype','getVariable','rpc','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProjectById','getSquareOdbc','dsn','getUser','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','agicommand','arg_1','callerid','createSquareRecording','uniqueid','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','has','dialTimezone','CALLERID(dialTimezone)','getContactByPhone','utcOffset','scheduledat','add','minutes','insertContact','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','number','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','stringify','render','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','includes','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','length','isPlainObject','saveRestApiResult','%s.%s','isArray','replaceObjectAllVariables','split','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','result','noop','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','label','no\x20list\x20selected','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','opts','Executed\x20command\x20%s','DIAL','dialogflow','bot','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','password','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','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','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','intKey','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','continueAt','context','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','math','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','success','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restAPI','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','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','subject','service','host','port','secure','authentication','auth','user','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','sendSMS','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','yes','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','getSquareProject','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39a9,0x1d0));var _0x939a=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0x39a9[_0x6e1239];return _0x418150;};'use strict';var fs=require('fs');var path=require(_0x939a('0x0'));var util=require(_0x939a('0x1'));var _=require(_0x939a('0x2'));var sh=require(_0x939a('0x3'));var odbc=require(_0x939a('0x4'))();var rs=require(_0x939a('0x5'));var moment=require(_0x939a('0x6'));var Mustache=require(_0x939a('0x7'));var rp=require(_0x939a('0x8'));var logger=require(_0x939a('0x9'))(_0x939a('0xa'));var config=require('../../config/environment');var shared=require(_0x939a('0xb'));var scripts=require(_0x939a('0xc'));var FILES_PATH=_0x939a('0xd');var recursiveMapAttributes=[_0x939a('0xe'),_0x939a('0xf')];var verticesWithRetry=[_0x939a('0x10'),_0x939a('0x11'),_0x939a('0x12')];var AGIVertices=function(_0x529156,_0x382b90,_0x19e985){this[_0x939a('0x13')]=_0x529156;this['rpc']=_0x382b90;this[_0x939a('0x14')]=_0x19e985;};AGIVertices[_0x939a('0x15')][_0x939a('0x16')]=function(_0x5a84d8,_0x3032c4){this[_0x939a('0x17')][_0x939a('0x18')](_0x5a84d8)['then'](function(_0x546115){_0x3032c4(null,_0x546115?_0x546115[_0x939a('0x19')]:![]);})[_0x939a('0x1a')](function(_0x1c14ae){_0x3032c4(_0x1c14ae);});};AGIVertices['prototype'][_0x939a('0x1b')]=function(_0x1aed14,_0x3bf117){this[_0x939a('0x17')][_0x939a('0x1c')](_0x1aed14)[_0x939a('0x1d')](function(_0x10481a){_0x3bf117(null,_0x10481a?_0x10481a['name']:![]);})[_0x939a('0x1a')](function(_0x5cf40e){_0x3bf117(_0x5cf40e);});};AGIVertices[_0x939a('0x15')]['getSquareProject']=function(_0x42c937,_0x38c889){this[_0x939a('0x17')][_0x939a('0x1e')](_0x42c937)['then'](function(_0x4e8e70){_0x38c889(null,_0x4e8e70?_0x4e8e70[_0x939a('0x19')]:![]);})['catch'](function(_0x5648d5){_0x38c889(_0x5648d5);});};AGIVertices[_0x939a('0x15')][_0x939a('0x1f')]=function(_0xba8287,_0xa5f77e){this[_0x939a('0x17')]['getSquareOdbcById'](_0xba8287)[_0x939a('0x1d')](function(_0x57cc84){_0xa5f77e(null,_0x57cc84?_0x57cc84[_0x939a('0x20')]:![]);})['catch'](function(_0x483b87){_0xa5f77e(_0x483b87);});};AGIVertices[_0x939a('0x15')][_0x939a('0x21')]=function(_0xe6e025,_0x4f723e){this['rpc']['getUserById'](_0xe6e025)[_0x939a('0x1d')](function(_0x4fa5ae){_0x4f723e(null,_0x4fa5ae?_0x4fa5ae[_0x939a('0x19')]:![]);})[_0x939a('0x1a')](function(_0x528c5f){_0x4f723e(_0x528c5f);});};AGIVertices[_0x939a('0x15')]['getTrunk']=function(_0x16dc7e,_0x576f3d){this[_0x939a('0x17')][_0x939a('0x22')](_0x16dc7e)[_0x939a('0x1d')](function(_0x322226){_0x576f3d(null,_0x322226?_0x322226[_0x939a('0x19')]:![]);})[_0x939a('0x1a')](function(_0x17a6aa){_0x576f3d(_0x17a6aa);});};AGIVertices[_0x939a('0x15')][_0x939a('0x23')]=function(_0x199691,_0x5959f9){var _0x233b48=this;this[_0x939a('0x17')][_0x939a('0x24')](_0x199691)[_0x939a('0x1d')](function(_0x5add13){_0x5959f9(null,_0x5add13?_0x233b48[_0x939a('0x25')](_0x5add13['save_name']):![]);})[_0x939a('0x1a')](function(_0xccb577){_0x5959f9(_0xccb577);});};AGIVertices[_0x939a('0x15')][_0x939a('0x26')]=function(_0x48d585,_0x5962ba){this[_0x939a('0x17')][_0x939a('0x27')](_0x48d585)['then'](function(_0x11ac7f){_0x5962ba(null,_0x11ac7f?_0x11ac7f:![]);})['catch'](function(_0x4d18a4){_0x5962ba(_0x4d18a4);});};AGIVertices[_0x939a('0x15')][_0x939a('0x28')]=function(_0x3f4743,_0x5b4a5d,_0x378b87){this[_0x939a('0x14')][_0x939a('0x28')](_0x3f4743,_0x5b4a5d)[_0x939a('0x1d')](function(){_0x378b87(null);})[_0x939a('0x1a')](function(_0x3c2c5d){_0x378b87(_0x3c2c5d);});};AGIVertices[_0x939a('0x15')]['getIntervals']=function(_0x163a1a,_0xce9be8){this['rpc'][_0x939a('0x29')](_0x163a1a)[_0x939a('0x1d')](function(_0x587e54){if(_0x587e54){if(_0x587e54[_0x939a('0x2a')]){_0xce9be8(null,[_0x587e54['interval']]);}else{_0xce9be8(null,_[_0x939a('0x2b')](_0x587e54[_0x939a('0x2c')],_0x939a('0x2d')));}}else{_0xce9be8(null,![]);}})[_0x939a('0x1a')](function(_0x100ac5){_0xce9be8(_0x100ac5);});};AGIVertices[_0x939a('0x15')][_0x939a('0x25')]=function(_0x321669){return util[_0x939a('0x2e')](_0x939a('0x2f'),FILES_PATH,_0x321669);};AGIVertices[_0x939a('0x15')][_0x939a('0x30')]=function(_0x316c3e,_0x2d6001,_0x28adbe){odbc['open'](_0x316c3e,function(_0x132220){if(_0x132220){logger[_0x939a('0x31')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x132220);_0x28adbe(_0x132220);}else{logger[_0x939a('0x32')](_0x939a('0x33'));odbc[_0x939a('0x34')](_0x2d6001,function(_0x3457b4,_0x474557){if(_0x3457b4){logger[_0x939a('0x32')](_0x939a('0x35'),_0x2d6001);_0x28adbe(_0x3457b4);}else{logger['info'](_0x939a('0x36'),_0x2d6001);odbc[_0x939a('0x37')](function(_0x5b9137){if(_0x5b9137){logger[_0x939a('0x31')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x5b9137);}_0x28adbe(null,_0x474557);});}});}});};AGIVertices[_0x939a('0x15')][_0x939a('0x38')]=function(_0x504085,_0x249bc0){this[_0x939a('0x17')][_0x939a('0x39')](_0x504085)[_0x939a('0x1d')](function(_0x187538){_0x249bc0(null,_0x187538?_0x187538:![]);})[_0x939a('0x1a')](function(_0x3c117f){_0x249bc0(_0x3c117f);});};AGIVertices[_0x939a('0x15')][_0x939a('0x3a')]=function(_0x1c09cd,_0x43528e){this[_0x939a('0x17')][_0x939a('0x3a')](_0x1c09cd)['then'](function(_0x5da342){_0x43528e(null,_0x5da342);})[_0x939a('0x1a')](function(_0x5d9d64){_0x43528e(_0x5d9d64);});};AGIVertices[_0x939a('0x15')][_0x939a('0x3b')]=function(_0x596f0f,_0xf33e98,_0x5b34ee){this[_0x939a('0x17')][_0x939a('0x3b')]({'uniqueid':this[_0x939a('0x13')]['uniqueid'],'node':_0x596f0f['label'],'application':_0x596f0f[_0x939a('0x3c')],'data':_0xf33e98||null,'project_name':this[_0x939a('0x13')][_0x939a('0x3d')],'callerid':this[_0x939a('0x13')][_0x939a('0x3e')]})[_0x939a('0x1d')](function(_0x43acc0){if(_0x5b34ee){_0x5b34ee(null,_0x43acc0);}})[_0x939a('0x1a')](function(_0x4f2c06){if(_0x5b34ee){_0x5b34ee(_0x4f2c06);}});};AGIVertices[_0x939a('0x15')][_0x939a('0x3f')]=function(_0x520a9e,_0x212c51,_0x53cac6,_0x5d3e1e){this[_0x939a('0x17')][_0x939a('0x3f')]({'uniqueid':this[_0x939a('0x13')][_0x939a('0x40')],'callerid':this[_0x939a('0x13')][_0x939a('0x3e')],'calleridname':this[_0x939a('0x13')]['calleridname'],'context':this[_0x939a('0x13')]['context'],'extension':this[_0x939a('0x13')][_0x939a('0x41')],'priority':this[_0x939a('0x13')][_0x939a('0x42')],'accountcode':this[_0x939a('0x13')][_0x939a('0x43')],'dnid':this[_0x939a('0x13')][_0x939a('0x44')],'projectName':this[_0x939a('0x13')]['arg_1'],'saveName':_0x212c51,'filename':_0x520a9e[_0x939a('0x45')]||_0x212c51,'savePath':_0x53cac6})[_0x939a('0x1d')](function(_0x1dee0d){_0x5d3e1e(null,_0x1dee0d);})[_0x939a('0x1a')](function(_0x43c6a9){_0x5d3e1e(_0x43c6a9);});};AGIVertices['prototype'][_0x939a('0x46')]=function(_0xa18bb0,_0x1f271e,_0x3e7eeb,_0x163cb1,_0x192fcf){this[_0x939a('0x17')][_0x939a('0x46')]({'uniqueid':this[_0x939a('0x13')]['uniqueid'],'body':_0xa18bb0,'direction':_0x1f271e,'providerName':_0x3e7eeb,'providerResponse':_0x163cb1})[_0x939a('0x1d')](function(_0x5946db){if(_0x192fcf){_0x192fcf(null,_0x5946db);}})[_0x939a('0x1a')](function(_0x5c5b5d){if(_0x192fcf){_0x192fcf(_0x5c5b5d);}});};AGIVertices[_0x939a('0x15')][_0x939a('0x47')]=function(_0x549880,_0x2094b2){var _0x1253fd=this;var _0x22fbb2=0x0;var _0x4bf266={'firstName':_['isEmpty'](_0x549880[_0x939a('0x19')])||_[_0x939a('0x48')](_0x549880[_0x939a('0x19')])?_0x939a('0x49')+Math[_0x939a('0x4a')]():_0x549880[_0x939a('0x19')],'lastName':_[_0x939a('0x4b')](_0x549880[_0x939a('0x4c')])||_[_0x939a('0x48')](_0x549880['lastName'])?null:_0x549880[_0x939a('0x4c')],'phone':_0x549880[_0x939a('0x4d')],'ListId':_0x549880['list_id'],'scheduledat':_0x549880[_0x939a('0x4e')],'callbackUniqueid':this[_0x939a('0x13')][_0x939a('0x40')],'tags':_0x939a('0x4f'),'description':_0x939a('0x50')+_0x549880[_0x939a('0x4e')][_0x939a('0x51')](),'priority':_0x549880[_0x939a('0x52')]};if(_[_0x939a('0x53')](_0x549880,_0x939a('0x54'))){if(!_[_0x939a('0x48')](_0x549880[_0x939a('0x54')])){var _0x5b95f9=_0x549880['dialTimezone'];if(_0x549880[_0x939a('0x54')]==_0x939a('0x55')){this[_0x939a('0x17')][_0x939a('0x56')]({'phone':_0x549880[_0x939a('0x4d')]})[_0x939a('0x1d')](function(_0x56ad95){if(!_['isNil'](_0x56ad95)){var _0x134b08=_0x56ad95[_0x939a('0x54')];if(!_['isNil'](_0x134b08)){var _0x2f9bff=shared['timezones'][_0x134b08];if(!_['isNil'](_0x2f9bff)){var _0x5d861a=-0x1*_0x2f9bff[_0x939a('0x57')];_0x4bf266[_0x939a('0x58')]=moment(_0x549880['scheduledat'])[_0x939a('0x59')](_0x5d861a,_0x939a('0x5a'));_0x1253fd[_0x939a('0x5b')](_0x4bf266,_0x549880,_0x2094b2);}else{_0x1253fd[_0x939a('0x5b')](_0x4bf266,_0x549880,_0x2094b2);}}else{_0x1253fd['insertContact'](_0x4bf266,_0x549880,_0x2094b2);}}else{_0x1253fd['insertContact'](_0x4bf266,_0x549880,_0x2094b2);}});}else{var _0x22fbb2=shared['timezones'][_0x5b95f9];if(!_[_0x939a('0x48')](_0x22fbb2)){var _0x542319=-0x1*_0x22fbb2[_0x939a('0x57')];_0x4bf266[_0x939a('0x58')]=moment(_0x549880[_0x939a('0x58')])['add'](_0x542319,_0x939a('0x5a'));_0x1253fd[_0x939a('0x5b')](_0x4bf266,_0x549880,_0x2094b2);}else{_0x1253fd[_0x939a('0x5b')](_0x4bf266,_0x549880,_0x2094b2);}}}else{_0x1253fd[_0x939a('0x5b')](_0x4bf266,_0x549880,_0x2094b2);}}else{_0x1253fd[_0x939a('0x5b')](_0x4bf266,_0x549880,_0x2094b2);}};AGIVertices[_0x939a('0x15')][_0x939a('0x5c')]=function(_0x233965,_0x25b5ba){this[_0x939a('0x17')][_0x939a('0x5d')](_0x233965)[_0x939a('0x1d')](function(_0x1fb9be){_0x25b5ba(null,_0x1fb9be?_0x1fb9be[_0x939a('0x19')]:![]);})[_0x939a('0x1a')](function(_0x8ecf74){_0x25b5ba(_0x8ecf74);});};AGIVertices[_0x939a('0x15')]['agentPause']=function(_0x5b3664,_0x3518b4,_0xb919b3){var _0x1e2432={'role':_0x939a('0x5e')};_0x1e2432[_0x5b3664]=this[_0x939a('0x13')][_0x939a('0x3e')];this[_0x939a('0x17')][_0x939a('0x5f')](_0x1e2432,_0x3518b4,this['channel'][_0x939a('0x40')])['then'](function(_0x23e2db){_0xb919b3(null,_[_0x939a('0x48')](_0x23e2db)?![]:!![]);})[_0x939a('0x1a')](function(_0x3444e5){logger[_0x939a('0x31')](_0x3444e5);_0xb919b3(null,![]);});};AGIVertices[_0x939a('0x15')][_0x939a('0x60')]=function(_0x27fb22,_0x23336b){var _0x519271={'role':_0x939a('0x5e')};_0x519271[_0x27fb22]=this['channel'][_0x939a('0x3e')];this[_0x939a('0x17')]['agentUnpause'](_0x519271)['then'](function(_0x41fa1d){_0x23336b(null,_[_0x939a('0x48')](_0x41fa1d)?![]:!![]);})['catch'](function(_0x49c72c){logger[_0x939a('0x31')](_0x49c72c);_0x23336b(null,![]);});};AGIVertices[_0x939a('0x15')][_0x939a('0x61')]=function(_0x1f1f6f,_0x1fd51f){var _0x49f02a={'role':_0x939a('0x5e')};_0x49f02a[_0x1f1f6f]=this['channel'][_0x939a('0x3e')];this['rpc']['agentLogout'](_0x49f02a)['then'](function(_0x19cd7c){_0x1fd51f(null,_[_0x939a('0x48')](_0x19cd7c)?![]:!![]);})['catch'](function(_0x5f0e79){logger[_0x939a('0x31')](_0x5f0e79);_0x1fd51f(null,![]);});};AGIVertices[_0x939a('0x15')][_0x939a('0x62')]=function(_0x44e9aa,_0x544594){var _0x236407={'role':_0x939a('0x5e')};_0x236407[_0x44e9aa]=this[_0x939a('0x13')][_0x939a('0x3e')];var _0x4a643c=_0x44e9aa!='internal'?util[_0x939a('0x2e')](_0x939a('0x63'),_0x939a('0x64'),this[_0x939a('0x13')][_0x939a('0x3e')]):undefined;this['rpc'][_0x939a('0x62')](_0x236407,_0x4a643c)['then'](function(_0x5370a6){_0x544594(null,_[_0x939a('0x48')](_0x5370a6)?![]:!![]);})['catch'](function(_0x1815bc){logger[_0x939a('0x31')](_0x1815bc);_0x544594(null,![]);});};AGIVertices[_0x939a('0x15')][_0x939a('0x65')]=function(_0x4a2909,_0x17ed1e){sh[_0x939a('0x66')](_[_0x939a('0x67')](_0x4a2909),function(_0x33448b,_0x128678){var _0x487e6b=_0x128678['replace'](/(\r\n|\n|\r)/gm,'');_0x17ed1e(null,_0x487e6b);});};AGIVertices[_0x939a('0x15')]['googleCloudTTS']=function(_0x5e4ea2,_0x4b8d17){scripts[_0x939a('0x68')](_0x5e4ea2[_0x939a('0x69')],_0x5e4ea2[_0x939a('0x6a')]||'text',_0x5e4ea2[_0x939a('0x6b')],_0x5e4ea2[_0x939a('0x6c')]||_0x939a('0x6d'),_0x5e4ea2[_0x939a('0x6e')]||_0x939a('0x6f'),_0x5e4ea2[_0x939a('0x70')]||_0x939a('0x71'))[_0x939a('0x1d')](function(_0x479134){_0x4b8d17(null,_0x479134);})[_0x939a('0x1a')](function(_0x16f073){_0x4b8d17(_0x16f073);});};AGIVertices[_0x939a('0x15')][_0x939a('0x72')]=function(_0x399ee6,_0x2e4ffb){scripts[_0x939a('0x72')](_0x399ee6['text'],_0x399ee6[_0x939a('0x73')]||'en',0x1)[_0x939a('0x1d')](function(_0x27aad2){_0x2e4ffb(null,_0x27aad2);})[_0x939a('0x1a')](function(_0x2e73d7){_0x2e4ffb(_0x2e73d7);});};AGIVertices[_0x939a('0x15')]['restAPI']=function(_0x3831bc,_0x13e465){var _0x3044c4={'uri':_0x3831bc[_0x939a('0x74')],'method':_0x3831bc[_0x939a('0x75')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3831bc[_0x939a('0x76')])===_0x939a('0x77')&&parseInt(_0x3831bc[_0x939a('0x76')])>=0x1?parseInt(_0x3831bc[_0x939a('0x76')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0x939a('0x78')],_0x3044c4[_0x939a('0x75')][_0x939a('0x79')]())){try{_0x3044c4[_0x939a('0x7a')]=_0x3831bc[_0x939a('0xf')]?JSON[_0x939a('0x7b')](_0x3831bc['rawBody']):{};}catch(_0x171f19){logger[_0x939a('0x31')](_0x939a('0x7c'),_0x171f19);}}try{_0x3044c4[_0x939a('0x7d')]=_0x3831bc['rawHeaders']?JSON[_0x939a('0x7b')](_0x3831bc['rawHeaders']):{};}catch(_0x30082a){logger['error'](_0x939a('0x7e'),_0x30082a);}if(_0x3831bc[_0x939a('0x7f')]){try{var _0x36a980=require(_0x3831bc[_0x939a('0x7f')])[_0x939a('0x80')](this,_0x3044c4);_0x3044c4[_0x939a('0x81')]=Mustache['render'](_0x3831bc[_0x939a('0x74')],_0x36a980,{},['$$','$$']);if(_0x3044c4['headers']){_0x3044c4['headers']=JSON[_0x939a('0x7b')](Mustache['render'](JSON[_0x939a('0x82')](_0x3044c4[_0x939a('0x7d')]),_0x36a980,{},['$$','$$']));}if(_0x3044c4[_0x939a('0x7a')]){_0x3044c4[_0x939a('0x7a')]=JSON[_0x939a('0x7b')](Mustache[_0x939a('0x83')](JSON[_0x939a('0x82')](_0x3044c4[_0x939a('0x7a')]),_0x36a980,{},['$$','$$']));}}catch(_0xcd5776){logger[_0x939a('0x31')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0xcd5776);}}rp(_0x3044c4)[_0x939a('0x1d')](function(_0x3610ed){var _0x2fef68={'statusCode':_0x3610ed['statusCode']||0xc8,'statusMessage':_0x3610ed['statusMessage']||'OK','headers':_0x3610ed[_0x939a('0x7d')]||{},'body':_0x3610ed['body']||{}};_0x13e465(null,_0x2fef68);})[_0x939a('0x1a')](function(_0x505f08){var _0x2d06e3={'statusCode':_0x505f08[_0x939a('0x84')]||0x1f4,'statusMessage':_0x505f08[_0x939a('0x85')]||_0x939a('0x86'),'headers':_0x505f08[_0x939a('0x87')][_0x939a('0x7d')]||{},'body':_0x505f08[_0x939a('0x87')][_0x939a('0x7a')]||{}};_0x13e465(null,_0x2d06e3);});};AGIVertices[_0x939a('0x15')][_0x939a('0x88')]=function(_0x4f6627,_0x278295){scripts['googleDialogflow'](this[_0x939a('0x13')][_0x939a('0x40')],_0x4f6627['key'],_0x4f6627['text'],_0x4f6627[_0x939a('0x89')]||'en')[_0x939a('0x1d')](function(_0x4943be){_0x278295(null,_0x4943be);})[_0x939a('0x1a')](function(_0x3c2c76){_0x278295(_0x3c2c76);});};AGIVertices[_0x939a('0x15')]['googleDialogflowV2']=function(_0x2ed730,_0x1d8da3){scripts[_0x939a('0x8a')](this['channel'][_0x939a('0x40')],_0x2ed730[_0x939a('0x8b')],_0x2ed730[_0x939a('0x8c')],_0x2ed730['private_key'],_0x2ed730[_0x939a('0x6b')],_0x2ed730[_0x939a('0x8d')]||'en')[_0x939a('0x1d')](function(_0x1528e3){_0x1d8da3(null,_0x1528e3);})[_0x939a('0x1a')](function(_0x41eaff){_0x1d8da3(_0x41eaff);});};AGIVertices['prototype'][_0x939a('0x8e')]=function(_0x4955e3,_0x23bd96){scripts[_0x939a('0x8e')](this[_0x939a('0x13')],_0x4955e3)[_0x939a('0x1d')](function(_0x4a2a0e){_0x23bd96(null,_0x4a2a0e);})[_0x939a('0x1a')](function(_0x8f825b){_0x23bd96(_0x8f825b);});};AGIVertices[_0x939a('0x15')][_0x939a('0x8f')]=function(_0x536a0a,_0x290f29){scripts[_0x939a('0x8f')](_0x536a0a[_0x939a('0x90')],_0x536a0a[_0x939a('0x6b')],_0x536a0a[_0x939a('0x91')]||_0x939a('0x6d'),_0x536a0a[_0x939a('0x92')])['then'](function(_0x362900){_0x290f29(null,_0x362900);})[_0x939a('0x1a')](function(_0x438530){_0x290f29(_0x438530);});};AGIVertices[_0x939a('0x15')]['ispeechASR']=function(_0x3ed761,_0x27c7ed,_0x5c58a8){scripts[_0x939a('0x93')](_0x27c7ed,_0x3ed761['key'],_0x3ed761[_0x939a('0x94')]||_0x939a('0x6d'),this[_0x939a('0x95')](_0x3ed761[_0x939a('0x96')])?_0x3ed761[_0x939a('0x96')]:undefined)[_0x939a('0x1d')](function(_0xae322e){_0x5c58a8(null,_0xae322e);})[_0x939a('0x1a')](function(_0x2700a2){_0x5c58a8(_0x2700a2);});};AGIVertices[_0x939a('0x15')]['awsPolly']=function(_0x2c5cba,_0x464bd1){scripts[_0x939a('0x97')](_0x2c5cba[_0x939a('0x98')],_0x2c5cba[_0x939a('0x99')],_0x2c5cba[_0x939a('0x9a')],_0x2c5cba[_0x939a('0x9b')]||_0x939a('0x9c'),_0x2c5cba[_0x939a('0x6b')],_0x2c5cba[_0x939a('0x9d')]||'text')['then'](function(_0x25125f){_0x464bd1(null,_0x25125f);})[_0x939a('0x1a')](function(_0x578503){_0x464bd1(_0x578503);});};AGIVertices[_0x939a('0x15')][_0x939a('0x9e')]=function(_0x3a86c2,_0x3be41c){scripts['awsLex'](this[_0x939a('0x13')][_0x939a('0x40')],_0x3a86c2[_0x939a('0x98')],_0x3a86c2[_0x939a('0x99')],_0x3a86c2[_0x939a('0x9f')],_0x3a86c2[_0x939a('0x6b')],_0x3a86c2[_0x939a('0xa0')])[_0x939a('0x1d')](function(_0x46a7d8){_0x3be41c(null,_0x46a7d8);})[_0x939a('0x1a')](function(_0x407c94){_0x3be41c(_0x407c94);});};AGIVertices[_0x939a('0x15')]['googleASR']=function(_0x31c58e,_0x254238,_0x3f21f1){scripts[_0x939a('0xa1')](_0x254238,_0x31c58e['key'],_0x31c58e[_0x939a('0xa2')]||_0x939a('0x6d'))[_0x939a('0x1d')](function(_0x5a581c){_0x3f21f1(null,_0x5a581c);})['catch'](function(_0x4a8b64){_0x3f21f1(_0x4a8b64);});};AGIVertices[_0x939a('0x15')][_0x939a('0xa3')]=function(_0x949ab4,_0x57856f,_0x3810d8){scripts[_0x939a('0xa3')](_0x57856f,_0x949ab4[_0x939a('0xa4')],_0x949ab4[_0x939a('0xa5')],_0x949ab4[_0x939a('0x81')])[_0x939a('0x1d')](function(_0x4481ec){_0x3810d8(null,_0x4481ec);})[_0x939a('0x1a')](function(_0x5d5066){_0x3810d8(_0x5d5066);});};AGIVertices[_0x939a('0x15')]['clear']=function(_0x43b8a4){var _0x8f55bd=_[_0x939a('0xa6')](verticesWithRetry,_0x43b8a4['agicommand'])?_0x43b8a4:_[_0x939a('0xa7')](_0x43b8a4);for(var _0x5050e7 in _0x8f55bd){if(_0x8f55bd[_0x939a('0xa8')](_0x5050e7)){if(_0x8f55bd[_0x5050e7]&&_[_0x939a('0xa9')](_0x8f55bd[_0x5050e7])){if(_[_0x939a('0xa6')](recursiveMapAttributes,_0x5050e7)){_0x8f55bd[_0x5050e7]=this['replaceObjectAllVariables'](_0x8f55bd[_0x5050e7]);}else{_0x8f55bd[_0x5050e7]=this[_0x939a('0xaa')](_0x8f55bd[_0x5050e7]);}}}}return _0x8f55bd;};AGIVertices['prototype'][_0x939a('0xab')]=function(_0x153bd2){for(var _0x9d6982 in _0x153bd2){if(_0x153bd2['hasOwnProperty'](_0x9d6982)){if(_['isPlainObject'](_0x153bd2[_0x9d6982])){this[_0x939a('0xab')](_0x153bd2[_0x9d6982]);}else if(_['isArray'](_0x153bd2[_0x9d6982])){for(var _0x3b3abb=0x0;_0x3b3abb<_0x153bd2[_0x9d6982][_0x939a('0xac')];_0x3b3abb++){this['recursiveNodeIndex'](_0x153bd2[_0x9d6982][_0x3b3abb]);}}else if(_[_0x939a('0xa9')](_0x153bd2[_0x9d6982])){_0x153bd2[_0x9d6982]=this['replaceAllVariables'](_0x153bd2[_0x9d6982]);}}}};AGIVertices[_0x939a('0x15')]['saveRestApiResult']=function(_0x35575d,_0x2bab14){for(var _0x1f219e in _0x35575d){if(_0x35575d[_0x939a('0xa8')](_0x1f219e)){if(_[_0x939a('0xad')](_0x35575d[_0x1f219e])){if(!_['isEmpty'](_0x35575d[_0x1f219e])){this[_0x939a('0xae')](_0x35575d[_0x1f219e],util[_0x939a('0x2e')](_0x939a('0xaf'),_0x2bab14,_0x1f219e));}}else if(_[_0x939a('0xb0')](_0x35575d[_0x1f219e])){for(var _0x26b450=0x0;_0x26b450<_0x35575d[_0x1f219e][_0x939a('0xac')];_0x26b450++){this[_0x939a('0xae')](_0x35575d[_0x1f219e][_0x26b450],util[_0x939a('0x2e')](_0x939a('0xaf'),_0x2bab14,_0x1f219e+'['+_0x26b450+']'));}}else{if(!_[_0x939a('0x48')](_0x35575d[_0x1f219e])){this['channel']['setVariable'](util[_0x939a('0x2e')](_0x939a('0xaf'),_0x2bab14,_0x1f219e),_0x35575d[_0x1f219e]);}}}}};AGIVertices['prototype'][_0x939a('0xb1')]=function(_0x59fa5a){try{var _0x2348f2=JSON['parse'](_0x59fa5a);this[_0x939a('0xab')](_0x2348f2);return JSON[_0x939a('0x82')](_0x2348f2);}catch(_0x533568){return this[_0x939a('0xaa')](_0x59fa5a);}};AGIVertices[_0x939a('0x15')][_0x939a('0xaa')]=function(_0x16d7e3){var _0x15cc26=_0x16d7e3[_0x939a('0xb2')]('{');for(var _0x2601c0=0x1;_0x2601c0<_0x15cc26['length'];_0x2601c0+=0x1){var _0x8b4052=_0x15cc26[_0x2601c0][_0x939a('0xb2')]('}');if(_0x8b4052['length']>0x1){_0x16d7e3=_0x16d7e3['replaceAll']('{'+_0x8b4052[0x0]+'}',this[_0x939a('0x13')]['getVariable'](_0x8b4052[0x0])[_0x939a('0xb3')]||_0x8b4052[0x0]);}}if(_0x15cc26[_0x939a('0xac')]===0x1){return _0x16d7e3[_0x939a('0x51')]();}return this['replaceAllVariables'](_0x16d7e3);};AGIVertices[_0x939a('0x15')][_0x939a('0xb4')]=function(_0x226805,_0x36f749){var _0x396a46=this['channel'][_0x939a('0x16')](_0x226805);if(_0x396a46['result']===-0x1){return _0x396a46;}logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0xb5'),_0x36f749,_0x396a46['extra']));return this[_0x939a('0x13')][_0x939a('0xb6')](_0x36f749,_0x396a46[_0x939a('0xb3')]);};AGIVertices[_0x939a('0x15')]['isConfigured']=function(_0x5a3a7f){return _0x5a3a7f&&_0x5a3a7f!=='0'&&_0x5a3a7f!=='-1'&&_0x5a3a7f!=='';};AGIVertices[_0x939a('0x15')][_0x939a('0xb7')]=function(_0x858d09){this[_0x939a('0x3b')][_0x939a('0x80')](this,_0x858d09,'-');_0x858d09[_0x939a('0xb8')]=_0x858d09['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x939a('0x15')]['mrcpsynth']=function(_0x3bf2a6){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0xb9'),_0x3bf2a6['label']));if(!this['isConfigured'](_0x3bf2a6['text'])){return this[_0x939a('0x13')]['noop'](_0x939a('0xba'));}var _0x3bc241='\x22'+_0x3bf2a6[_0x939a('0x6b')]+'\x22';if(this['isConfigured'](_0x3bf2a6[_0x939a('0x87')])){_0x3bc241+=','+_0x3bf2a6[_0x939a('0x87')];}var _0x3c5eab=this['channel']['exec']('MRCPSynth',_0x3bc241);if(_0x3c5eab[_0x939a('0xbb')]===-0x1){return _0x3c5eab;}return this['channel'][_0x939a('0xbc')](util[_0x939a('0x2e')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3bc241));};AGIVertices[_0x939a('0x15')][_0x939a('0xbd')]=function(_0x4583fd){logger[_0x939a('0x32')](util['format'](_0x939a('0xbe'),_0x4583fd['label']));if(!this['isConfigured'](_0x4583fd[_0x939a('0xbf')])){return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0xc0'));}var _0xec9b69=_0x4583fd[_0x939a('0xbf')];if(this[_0x939a('0x95')](_0x4583fd[_0x939a('0x87')])){_0xec9b69+=','+_0x4583fd['options'];}var _0x5be577=this['channel'][_0x939a('0x66')]('MRCPRecog',_0xec9b69);if(_0x5be577[_0x939a('0xbb')]===-0x1){return _0x5be577;}var _0x914ab7=this[_0x939a('0xb4')](_0x939a('0xc1'),'MRCP_RECOG_CONFIDENCE');if(_0x914ab7['result']===-0x1){return _0x914ab7;}var _0x2dd8e3=this['getAndSetVariable'](_0x939a('0xc2'),_0x939a('0xc3'));if(_0x2dd8e3[_0x939a('0xbb')]===-0x1){return _0x2dd8e3;}var _0x1131c0=this[_0x939a('0xb4')](_0x939a('0xc4'),_0x939a('0xc5'));if(_0x1131c0[_0x939a('0xbb')]===-0x1){return _0x1131c0;}return this[_0x939a('0x13')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0xec9b69));};AGIVertices[_0x939a('0x15')][_0x939a('0xa')]=function(_0x40d2fc){logger[_0x939a('0x32')](util[_0x939a('0x2e')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x40d2fc['label']));return this[_0x939a('0x13')][_0x939a('0xa')]([_0x40d2fc[_0x939a('0xc6')],_0x40d2fc[_0x939a('0xc7')]]);};AGIVertices[_0x939a('0x15')][_0x939a('0xc8')]=function(_0x1b12d0){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0xc9'),_0x1b12d0['label']));if(this[_0x939a('0x95')](_0x1b12d0[_0x939a('0x76')])){logger['info'](util[_0x939a('0x2e')](_0x939a('0xca'),_0x1b12d0['timeout']));var _0x38fdbf=this[_0x939a('0x13')][_0x939a('0xcb')](_0x1b12d0[_0x939a('0x76')]);if(_0x38fdbf['result']===-0x1){return _0x38fdbf;}}return this[_0x939a('0x13')][_0x939a('0xc8')]();};AGIVertices[_0x939a('0x15')][_0x939a('0x4f')]=function(_0x4001c4){logger[_0x939a('0x32')](util['format'](_0x939a('0xcc'),_0x4001c4[_0x939a('0xcd')]));if(!this['isConfigured'](_0x4001c4['list_id'])){return this[_0x939a('0x13')][_0x939a('0x31')](_0x4001c4,_0x939a('0xce'));}_0x4001c4[_0x939a('0x4e')]=moment();if(this['isConfigured'](_0x4001c4['delay'])){_0x4001c4['scheduledAt']=moment()[_0x939a('0x59')](_0x4001c4['delay'],'minutes');}if(!this[_0x939a('0x95')](_0x4001c4[_0x939a('0x52')])){_0x4001c4[_0x939a('0x52')]=0x2;}this[_0x939a('0x47')][_0x939a('0x80')](this,_0x4001c4);return this[_0x939a('0x13')]['noop'](util[_0x939a('0x2e')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x4001c4[_0x939a('0x4d')],_0x4001c4['list_id'],_0x4001c4['scheduledAt']));};AGIVertices['prototype'][_0x939a('0xcf')]=function(_0x531d82){logger[_0x939a('0x32')](util[_0x939a('0x2e')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x531d82['label']));var _0x32652c=this[_0x939a('0x13')][_0x939a('0x66')](_0x531d82[_0x939a('0xd0')],_0x531d82[_0x939a('0x87')]);if(_0x32652c[_0x939a('0xbb')]===-0x1){return _0x32652c;}return this[_0x939a('0x13')]['noop'](util[_0x939a('0x2e')](_0x939a('0xd1'),_0x531d82[_0x939a('0xd0')],_0x531d82['options']));};AGIVertices['prototype'][_0x939a('0xd2')]=function(_0x4a75bf){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0xd3'),_0x4a75bf[_0x939a('0xcd')]));if(!this[_0x939a('0x95')](_0x4a75bf[_0x939a('0x6b')])){return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0xba'));}var _0x2b08ca='\x22'+_0x4a75bf[_0x939a('0x6b')]+'\x22';if(this['isConfigured'](_0x4a75bf['options'])){_0x2b08ca+=','+_0x4a75bf['options'];}var _0x207102=this[_0x939a('0x13')][_0x939a('0x66')]('MRCPSynth',_0x2b08ca);if(_0x207102[_0x939a('0xbb')]===-0x1){return _0x207102;}return this[_0x939a('0x13')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x2b08ca));};AGIVertices[_0x939a('0x15')][_0x939a('0xd4')]=function(_0x4714b1){logger['info'](util[_0x939a('0x2e')](_0x939a('0xd5'),_0x4714b1[_0x939a('0xcd')]));if(!this[_0x939a('0x95')](_0x4714b1[_0x939a('0x6b')])){return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0xba'));}var _0x390dfa='\x22'+_0x4714b1[_0x939a('0x6b')]+'\x22';if(this[_0x939a('0x95')](_0x4714b1[_0x939a('0x87')])){_0x390dfa+=','+_0x4714b1[_0x939a('0x87')];}var _0x8b6977=this[_0x939a('0x13')][_0x939a('0x66')](_0x939a('0xd6'),_0x390dfa);if(_0x8b6977[_0x939a('0xbb')]===-0x1){return _0x8b6977;}return this[_0x939a('0x13')]['noop'](util['format'](_0x939a('0xd7'),_0x390dfa));};AGIVertices[_0x939a('0x15')][_0x939a('0xd8')]=function(_0x498533){logger[_0x939a('0x32')](util['format'](_0x939a('0xd9'),_0x498533[_0x939a('0xcd')]));if(!this[_0x939a('0x95')](_0x498533[_0x939a('0xbf')])){return this[_0x939a('0x13')][_0x939a('0xbc')]('no\x20grammar\x20configured');}var _0x3a66a7=_0x498533['grammar'];if(this[_0x939a('0x95')](_0x498533[_0x939a('0x87')])){_0x3a66a7+=','+_0x498533['options'];}var _0x377f82=this['channel']['exec'](_0x939a('0xda'),_0x3a66a7);if(_0x377f82[_0x939a('0xbb')]===-0x1){return _0x377f82;}var _0x3ca144=this[_0x939a('0xb4')](_0x939a('0xc1'),_0x939a('0xdb'));if(_0x3ca144['result']===-0x1){return _0x3ca144;}var _0x1768a9=this[_0x939a('0xb4')](_0x939a('0xc2'),_0x939a('0xdc'));if(_0x1768a9[_0x939a('0xbb')]===-0x1){return _0x1768a9;}var _0x5c52ab=this[_0x939a('0xb4')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x5c52ab[_0x939a('0xbb')]===-0x1){return _0x5c52ab;}return this[_0x939a('0x13')][_0x939a('0xbc')](util['format'](_0x939a('0xdd'),_0x3a66a7));};AGIVertices[_0x939a('0x15')]['sestekasr']=function(_0x1bf668){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0xde'),_0x1bf668[_0x939a('0xcd')]));if(!this[_0x939a('0x95')](_0x1bf668[_0x939a('0xbf')])){return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0xc0'));}var _0x1f280f=_0x1bf668[_0x939a('0xbf')];if(this['isConfigured'](_0x1bf668['options'])){_0x1f280f+=','+_0x1bf668[_0x939a('0x87')];}var _0x74c2a8=this[_0x939a('0x13')][_0x939a('0x66')](_0x939a('0xda'),_0x1f280f);if(_0x74c2a8[_0x939a('0xbb')]===-0x1){return _0x74c2a8;}var _0x306ebe=this['getAndSetVariable'](_0x939a('0xc1'),_0x939a('0xdf'));if(_0x306ebe[_0x939a('0xbb')]===-0x1){return _0x306ebe;}var _0x4d9595=this['getAndSetVariable'](_0x939a('0xc2'),_0x939a('0xe0'));if(_0x4d9595[_0x939a('0xbb')]===-0x1){return _0x4d9595;}var _0x1c70e9=this['getAndSetVariable']('RECOG_INSTANCE()',_0x939a('0xe1'));if(_0x1c70e9[_0x939a('0xbb')]===-0x1){return _0x1c70e9;}return this[_0x939a('0x13')]['noop'](util[_0x939a('0x2e')](_0x939a('0xdd'),_0x1f280f));};AGIVertices[_0x939a('0x15')][_0x939a('0xe2')]=function(_0x8201d){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0xe3'),_0x8201d['label']));if(!this[_0x939a('0x95')](_0x8201d[_0x939a('0xe4')])){return this['channel'][_0x939a('0x31')](_0x8201d,_0x939a('0xe5'));}var _0xf27797=this[_0x939a('0x1f')]['sync'](this,_0x8201d[_0x939a('0xe4')]);if(!_0xf27797){return this[_0x939a('0x13')]['error'](_0x8201d,_0x939a('0xe6'));}if(!this['isConfigured'](_0x8201d[_0x939a('0x34')])){return this[_0x939a('0x13')][_0x939a('0x31')](_0x8201d,'no\x20query\x20configured');}var _0x3edf4c=_0x8201d[_0x939a('0x34')][_0x939a('0xe7')](/(\r\n|\n|\r)/gm,'\x20');this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0xe8'),_0x3edf4c));var _0x1fcfd4=this[_0x939a('0x30')][_0x939a('0x80')](this,_0xf27797,_0x3edf4c);this[_0x939a('0x3b')][_0x939a('0x80')](this,_0x8201d,_0x3edf4c);if(!this[_0x939a('0x95')](_0x8201d[_0x939a('0xe9')])){return this['channel']['noop'](_0x939a('0xea'));}var _0x1e6b5b=this[_0x939a('0x16')][_0x939a('0x80')](this,_0x8201d['variable_id']);if(!_0x1e6b5b){return this[_0x939a('0x13')]['error'](_0x8201d,_0x939a('0xeb'));}var _0x5161b5=this;_0x1fcfd4[_0x939a('0xec')](function(_0x206f6f,_0x56eaff){Object[_0x939a('0xed')](_0x206f6f)[_0x939a('0xec')](function(_0x4f4470){_0x5161b5[_0x939a('0x13')]['setVariable'](util['format'](_0x939a('0xee'),_0x1e6b5b,_0x56eaff,_0x4f4470),_0x206f6f[_0x4f4470]);});});this[_0x939a('0x13')][_0x939a('0xb6')](util[_0x939a('0x2e')](_0x939a('0xef'),_0x1e6b5b),_0x1fcfd4[_0x939a('0xac')]);return this['channel']['noop'](util[_0x939a('0x2e')](_0x939a('0xf0'),_0x1e6b5b));};AGIVertices['prototype'][_0x939a('0xf1')]=function(_0x3031f4){logger[_0x939a('0xf2')](util[_0x939a('0x2e')](_0x939a('0xf3'),_0x3031f4['label']));if(!this[_0x939a('0x95')](_0x3031f4[_0x939a('0xf4')])){return this[_0x939a('0x13')][_0x939a('0x31')](_0x3031f4,_0x939a('0xf5'));}var _0x23276f=this[_0x939a('0x21')][_0x939a('0x80')](this,_0x3031f4[_0x939a('0xf4')]);if(!_0x23276f){return this['channel'][_0x939a('0x31')](_0x3031f4,_0x939a('0xf6'));}var _0x2aadaf=this['channel'][_0x939a('0x66')]('DIAL',[util['format']('SIP/%s',_0x23276f),_0x3031f4[_0x939a('0x76')],_0x3031f4[_0x939a('0xf7')],_0x3031f4[_0x939a('0x74')]]);if(_0x2aadaf[_0x939a('0xbb')]===-0x1){return _0x2aadaf;}return this[_0x939a('0x13')]['noop'](util[_0x939a('0x2e')](_0x939a('0xf8'),_0x939a('0xf9')));};AGIVertices[_0x939a('0x15')][_0x939a('0xfa')]=function(_0x4ad998){logger[_0x939a('0x32')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4ad998[_0x939a('0xcd')]));if(!this[_0x939a('0x95')](_0x4ad998[_0x939a('0x90')])){return this[_0x939a('0x13')][_0x939a('0xbc')]('no\x20key\x20configured');}if(!this[_0x939a('0x95')](_0x4ad998['text'])){return this[_0x939a('0x13')][_0x939a('0xbc')]('no\x20text\x20configured');}this[_0x939a('0x13')][_0x939a('0xfb')]=!![];this[_0x939a('0x3b')](_0x4ad998);this['createSquareMessage'](_0x4ad998[_0x939a('0x6b')],'in','','');this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')]('Trying\x20Dialogflow:\x20%s',_0x4ad998[_0x939a('0x6b')]));var _0x371106=this[_0x939a('0x88')]['sync'](this,_0x4ad998);if(_0x371106){for(var _0x296b80 in _0x371106){if(_0x371106['hasOwnProperty'](_0x296b80)){this[_0x939a('0x13')][_0x939a('0xb6')](util[_0x939a('0x2e')](_0x939a('0xfc'),_0x296b80['toUpperCase']()),_0x371106[_0x296b80]);}}this[_0x939a('0x46')](_0x371106[_0x939a('0xfd')],'out',_0x939a('0xfa'),'');return this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0xfe'),_0x371106[_0x939a('0xfd')]));}return this[_0x939a('0x13')][_0x939a('0x31')](_0x4ad998,_0x939a('0xff'));};AGIVertices['prototype'][_0x939a('0x100')]=function(_0x3be4ac){logger['info'](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3be4ac['label']));if(!this[_0x939a('0x95')](_0x3be4ac[_0x939a('0x8b')])){return this['channel'][_0x939a('0xbc')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x3be4ac[_0x939a('0x8c')])){return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0x101'));}if(!this[_0x939a('0x95')](_0x3be4ac['private_key'])){return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0x102'));}if(!this[_0x939a('0x95')](_0x3be4ac[_0x939a('0x8d')])){return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0x103'));}if(!this[_0x939a('0x95')](_0x3be4ac[_0x939a('0x6b')])){return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0xba'));}this[_0x939a('0x13')][_0x939a('0xfb')]=!![];this['createSquareDetailsReport'](_0x3be4ac);this[_0x939a('0x46')](_0x3be4ac['text'],'in','','');this[_0x939a('0x13')]['noop'](util['format'](_0x939a('0x104'),_0x3be4ac[_0x939a('0x6b')]));var _0x419988=this[_0x939a('0x8a')][_0x939a('0x80')](this,_0x3be4ac);if(_0x419988){for(var _0x1478d8 in _0x419988){if(_0x419988[_0x939a('0xa8')](_0x1478d8)){if(_0x1478d8!==_0x939a('0x105')){this['channel'][_0x939a('0xb6')](util[_0x939a('0x2e')](_0x939a('0xfc'),_0x1478d8['toUpperCase']()),_0x419988[_0x1478d8]);}}}this[_0x939a('0x46')](_0x419988['speech'],_0x939a('0x106'),_0x939a('0x100'),_0x419988[_0x939a('0x105')]);return this[_0x939a('0x13')][_0x939a('0xbc')](util['format']('DialogflowV2\x20Result\x20%s',_0x419988[_0x939a('0xfd')]));}return this[_0x939a('0x13')][_0x939a('0x31')](_0x3be4ac,_0x939a('0x107'));};AGIVertices[_0x939a('0x15')][_0x939a('0x108')]=function(_0x13e438){logger[_0x939a('0x32')](util[_0x939a('0x2e')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x13e438[_0x939a('0xcd')]));if(!this[_0x939a('0x95')](_0x13e438[_0x939a('0x109')])){return this['channel'][_0x939a('0xbc')](_0x939a('0x10a'));}if(!this[_0x939a('0x95')](_0x13e438['username'])){return this[_0x939a('0x13')][_0x939a('0xbc')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x13e438[_0x939a('0x10b')])){return this[_0x939a('0x13')][_0x939a('0xbc')]('no\x20password\x20configured');}if(!this[_0x939a('0x95')](_0x13e438['ndassistant_url'])){return this['channel'][_0x939a('0xbc')](_0x939a('0xba'));}this[_0x939a('0x13')][_0x939a('0xfb')]=!![];this[_0x939a('0x3b')](_0x13e438);this[_0x939a('0x46')](_0x13e438['text'],'in','','');this[_0x939a('0x13')][_0x939a('0xbc')](util['format'](_0x939a('0x10c'),_0x13e438[_0x939a('0x6b')]));var _0x350b6a=this['sestekNDA'][_0x939a('0x80')](this,_0x13e438);if(_0x350b6a){for(var _0x4e1acb in _0x350b6a){if(_0x350b6a[_0x939a('0xa8')](_0x4e1acb)){this[_0x939a('0x13')][_0x939a('0xb6')](util[_0x939a('0x2e')](_0x939a('0x10d'),_0x4e1acb[_0x939a('0x79')]()),_0x350b6a[_0x4e1acb]);}}this[_0x939a('0x46')](_0x350b6a[_0x939a('0xfd')],_0x939a('0x106'),'sesteknda','');if(_0x350b6a['audiofile']){this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x10e'),_0x350b6a[_0x939a('0x10f')]));var _0xb906f8=this['channel']['streamFile'](_0x350b6a[_0x939a('0x10f')]);try{fs['unlink'](_0x350b6a[_0x939a('0x10f')]+_0x939a('0x110'));}catch(_0x9e4e8e){logger[_0x939a('0x31')](_0x9e4e8e);}return _0xb906f8;}else{return this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x111'),_0x350b6a[_0x939a('0xfd')]));}}return this[_0x939a('0x13')][_0x939a('0x31')](_0x13e438,_0x939a('0x112'));};AGIVertices[_0x939a('0x15')]['end']=function(_0x44fa23){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x44fa23['label']));return this['channel'][_0x939a('0xbc')](_0x939a('0x113'));};AGIVertices[_0x939a('0x15')]['ext_dial']=function(_0x5dbb0d){logger['info'](util[_0x939a('0x2e')](_0x939a('0x114'),_0x5dbb0d[_0x939a('0xcd')]));var _0x2c09a5='';if(_0x5dbb0d[_0x939a('0x115')]){if(!this['isConfigured'](_0x5dbb0d[_0x939a('0x115')])){return this['channel'][_0x939a('0x31')](_0x5dbb0d,'no\x20trunk\x20selected');}else{var _0x328d4a=parseInt(_0x5dbb0d[_0x939a('0x115')],0xa);if(isNaN(_0x328d4a)){_0x2c09a5=_0x5dbb0d[_0x939a('0x115')];}else{_0x2c09a5=this[_0x939a('0x116')][_0x939a('0x80')](this,_0x5dbb0d[_0x939a('0x115')]);if(!_0x2c09a5){return this[_0x939a('0x13')][_0x939a('0x31')](_0x5dbb0d,_0x939a('0x117'));}}}}else if(_0x5dbb0d[_0x939a('0x118')]){_0x2c09a5=_0x5dbb0d['trunk_name'];}else{return this[_0x939a('0x13')]['error'](_0x5dbb0d,_0x939a('0x119'));}var _0x457502=this[_0x939a('0x13')][_0x939a('0x66')](_0x939a('0xf9'),[util[_0x939a('0x2e')](_0x939a('0x11a'),_0x2c09a5,_0x5dbb0d[_0x939a('0x4d')]),_0x5dbb0d['timeout'],_0x5dbb0d[_0x939a('0xf7')],_0x5dbb0d[_0x939a('0x74')]]);if(_0x457502[_0x939a('0xbb')]===-0x1){return _0x457502;}return this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0xf8'),_0x939a('0xf9')));};AGIVertices[_0x939a('0x15')]['finally']=function(_0xd232dc){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x11b'),_0xd232dc['label']));return this['channel'][_0x939a('0xbc')](_0x939a('0x11c'));};AGIVertices[_0x939a('0x15')][_0x939a('0x11')]=function(_0xc00c1){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x11d'),_0xc00c1[_0x939a('0xcd')]));if(_0xc00c1['retry']===0x0){return this[_0x939a('0xb7')](_0xc00c1);}_0xc00c1[_0x939a('0xb8')]-=0x1;if(!this[_0x939a('0x95')](_0xc00c1[_0x939a('0x11e')])){return this[_0x939a('0x13')][_0x939a('0x31')](_0xc00c1,_0x939a('0x11f'));}var _0x57916a=this['getSound'][_0x939a('0x80')](this,_0xc00c1[_0x939a('0x11e')]);if(!_0x57916a){return this[_0x939a('0x13')][_0x939a('0x31')](_0xc00c1,_0x939a('0x120'));}if(!this[_0x939a('0x95')](_0xc00c1['variable_id'])){return this[_0x939a('0x13')][_0x939a('0x31')](_0x939a('0xea'));}var _0x4ba733=this[_0x939a('0x13')][_0x939a('0x121')](_0x57916a,_0xc00c1[_0x939a('0x122')],_0xc00c1['maxdigit']);var _0x72f612=_0x4ba733[_0x939a('0xbb')]?_0x4ba733[_0x939a('0xbb')][_0x939a('0x51')]():'';logger[_0x939a('0x32')](_0x939a('0x123'),JSON[_0x939a('0x82')](_0x4ba733));if(_0x4ba733[_0x939a('0xbb')]===-0x1){this[_0x939a('0x3b')][_0x939a('0x80')](this,_0xc00c1,_0x72f612);return _0x4ba733;}else if(_0x4ba733['extra']===_0x939a('0x76')){_0x4ba733[_0x939a('0xbb')]=_0x72f612['length']>=parseInt(_0xc00c1[_0x939a('0x124')])?'x':'i';}else{_0x4ba733[_0x939a('0xbb')]=_0x72f612[_0x939a('0xac')]>=parseInt(_0xc00c1[_0x939a('0x124')])&&_0x72f612['length']<=parseInt(_0xc00c1['maxdigit'])?'x':'i';}var _0x2801a4=this[_0x939a('0x16')][_0x939a('0x80')](this,_0xc00c1['variable_id']);if(!_0x2801a4){return this['channel'][_0x939a('0x31')](_0xc00c1,_0x939a('0xeb'));}this[_0x939a('0x13')][_0x939a('0xb6')](_0x2801a4,_0x72f612);if(this[_0x939a('0x95')](_0xc00c1[_0x939a('0x125')])){var _0x3104e1=parseInt(_0xc00c1['hiddendigitsnum'],0xa);var _0x459ac9=rs['generate']({'charset':'*','length':_0x3104e1});var _0x41b2ba=_0x72f612[_0x939a('0xac')];if(_0x41b2ba>0x0){if(_0x41b2ba>_0x3104e1){this[_0x939a('0x3b')][_0x939a('0x80')](this,_0xc00c1,_0xc00c1[_0x939a('0x126')]===_0x939a('0x127')?_0x459ac9+_0x72f612[_0x939a('0x128')](_0x3104e1):_0x72f612[_0x939a('0x128')](0x0,_0x41b2ba-_0x3104e1)+_0x459ac9);}else{this[_0x939a('0x3b')][_0x939a('0x80')](this,_0xc00c1,rs[_0x939a('0x129')]({'charset':'*','length':_0x41b2ba}));}}else{this[_0x939a('0x3b')][_0x939a('0x80')](this,_0xc00c1,'');}}else{this['createSquareDetailsReport'][_0x939a('0x80')](this,_0xc00c1,_0x72f612);}return _0x4ba733;};AGIVertices[_0x939a('0x15')]['getsecretdigits']=function(_0x5bb7b3){logger[_0x939a('0x32')](util['format'](_0x939a('0x12a'),_0x5bb7b3[_0x939a('0xcd')]));return this['getdigits'](_0x5bb7b3);};AGIVertices['prototype'][_0x939a('0x12b')]=function(_0x17325c){logger[_0x939a('0x32')](util[_0x939a('0x2e')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x17325c[_0x939a('0xcd')]));this[_0x939a('0x3b')][_0x939a('0x80')](this,_0x17325c,_0x17325c[_0x939a('0x12c')]);return this['channel'][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x12d'),_0x17325c[_0x939a('0x12c')]));};AGIVertices[_0x939a('0x15')]['awspolly']=function(_0x56e83e){logger['info'](util['format'](_0x939a('0x12e'),_0x56e83e[_0x939a('0xcd')]));if(!this['isConfigured'](_0x56e83e[_0x939a('0x98')])||!this['isConfigured'](_0x56e83e['aws_secret_access_key'])){return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0x12f'));}if(!this[_0x939a('0x95')](_0x56e83e[_0x939a('0x6b')])){return this[_0x939a('0x13')]['noop'](_0x939a('0xba'));}this['channel'][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x130'),_0x56e83e[_0x939a('0x6b')]));var _0x5620bd=this['awsPolly']['sync'](this,_0x56e83e);if(_0x5620bd){this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x131'),_0x5620bd));var _0x449c9d=this[_0x939a('0x13')][_0x939a('0x132')](_0x5620bd);try{fs[_0x939a('0x133')](_0x5620bd+'.wav');}catch(_0x3e9162){logger[_0x939a('0x31')](_0x3e9162);}return _0x449c9d;}return this['channel'][_0x939a('0x31')](_0x56e83e,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x939a('0x15')]['awslex']=function(_0x2c1fb9){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x134'),_0x2c1fb9[_0x939a('0xcd')]));if(!this[_0x939a('0x95')](_0x2c1fb9[_0x939a('0x98')])||!this['isConfigured'](_0x2c1fb9[_0x939a('0x99')])){return this[_0x939a('0x13')][_0x939a('0xbc')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x939a('0x95')](_0x2c1fb9[_0x939a('0xa0')])){return this[_0x939a('0x13')][_0x939a('0xbc')]('no\x20bot\x20name\x20configured');}if(!this[_0x939a('0x95')](_0x2c1fb9[_0x939a('0x6b')])){return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0xba'));}this['channel'][_0x939a('0xfb')]=!![];this['createSquareDetailsReport'](_0x2c1fb9);this[_0x939a('0x46')](_0x2c1fb9[_0x939a('0x6b')],'in','','');this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x135'),_0x2c1fb9['text']));var _0x5b609b=this[_0x939a('0x9e')]['sync'](this,_0x2c1fb9);if(_0x5b609b){for(var _0x25d642 in _0x5b609b){if(_0x5b609b[_0x939a('0xa8')](_0x25d642)&&_[_0x939a('0xa9')](_0x5b609b[_0x25d642])){this[_0x939a('0x13')][_0x939a('0xb6')](util[_0x939a('0x2e')]('AWS_LEX_%s',_0x25d642[_0x939a('0x79')]()),_0x5b609b[_0x25d642]);}}if(_['isNil'](_0x5b609b[_0x939a('0x85')])){return this['channel'][_0x939a('0xbc')](_0x939a('0x136'));}else{this['createSquareMessage'](_0x5b609b['message'],_0x939a('0x106'),'amazonlex','');return this['channel'][_0x939a('0xbc')](util['format'](_0x939a('0x137'),_0x5b609b[_0x939a('0x85')]));}}return this[_0x939a('0x13')][_0x939a('0x31')](_0x2c1fb9,_0x939a('0x138'));};AGIVertices[_0x939a('0x15')][_0x939a('0x139')]=function(_0x17498e){logger[_0x939a('0x32')](util[_0x939a('0x2e')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x17498e[_0x939a('0xcd')],_0x17498e[_0x939a('0x76')]));if(!this['isConfigured'](_0x17498e[_0x939a('0x90')])){return this[_0x939a('0x13')]['noop'](_0x939a('0x13a'));}var _0x50bac4=_0x939a('0x13b');var _0x3956eb=util[_0x939a('0x2e')](_0x939a('0x13c'),FILES_PATH,rs[_0x939a('0x129')](0x4));var _0x12aa63=util['format'](_0x939a('0xaf'),_0x3956eb,_0x50bac4);var _0xa7b2e9=!![];if(_0x17498e[_0x939a('0x13d')]===_0x939a('0x13e')){_0xa7b2e9=![];}var _0x341384=this[_0x939a('0x13')]['recordFile'](_0x3956eb,_0x50bac4,_0x17498e['intKey'],_0x17498e['timeout'],undefined,_0xa7b2e9);if(_0x341384['result']!==-0x1){this[_0x939a('0x13')][_0x939a('0xbc')](util['format'](_0x939a('0x13f'),_0x12aa63));var _0x1ac6ea=this['googleASR'][_0x939a('0x80')](this,_0x17498e,_0x12aa63);if(_0x1ac6ea){for(var _0x5dc373 in _0x1ac6ea){if(_0x1ac6ea['hasOwnProperty'](_0x5dc373)){this[_0x939a('0x13')][_0x939a('0xb6')](util[_0x939a('0x2e')](_0x939a('0x140'),_0x5dc373[_0x939a('0x79')]()),_0x1ac6ea[_0x5dc373]);}}return this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x141'),JSON[_0x939a('0x82')](_0x1ac6ea)));}}return _0x341384;};AGIVertices['prototype'][_0x939a('0x142')]=function(_0x22570e){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x143'),_0x22570e['label']));if(!this['isConfigured'](_0x22570e['appid'])){return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0x144'));}if(!this[_0x939a('0x95')](_0x22570e[_0x939a('0xa5')])){return this[_0x939a('0x13')][_0x939a('0xbc')]('no\x20appsecret\x20configured');}var _0x3c89bc=_0x939a('0x13b');var _0x380036=util[_0x939a('0x2e')](_0x939a('0x13c'),FILES_PATH,rs['generate'](0x4));var _0xce4841=util[_0x939a('0x2e')](_0x939a('0xaf'),_0x380036,_0x3c89bc);var _0x584d21=!![];if(_0x22570e[_0x939a('0x13d')]==='NOBEEP'){_0x584d21=![];}var _0x994f8f=this[_0x939a('0x13')]['recordFile'](_0x380036,_0x3c89bc,_0x22570e[_0x939a('0x145')],_0x22570e['timeout'],undefined,_0x584d21);if(_0x994f8f['result']!==-0x1){this[_0x939a('0x13')]['noop'](util['format'](_0x939a('0x146'),_0xce4841));var _0x36442f=this[_0x939a('0xa3')][_0x939a('0x80')](this,_0x22570e,_0xce4841);if(_0x36442f){for(var _0x1e938c in _0x36442f){if(_0x36442f[_0x939a('0xa8')](_0x1e938c)){this['channel'][_0x939a('0xb6')](util[_0x939a('0x2e')]('TILDE_ASR_%s',_0x1e938c[_0x939a('0x79')]()),_0x36442f[_0x1e938c]);}}return this[_0x939a('0x13')][_0x939a('0xbc')](util['format'](_0x939a('0x147'),JSON['stringify'](_0x36442f)));}}return _0x994f8f;};AGIVertices[_0x939a('0x15')]['gotoc']=function(_0x305458){logger['info'](util[_0x939a('0x2e')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x305458[_0x939a('0xcd')]));return this[_0x939a('0x13')][_0x939a('0x148')](_0x305458[_0x939a('0x149')],_0x305458[_0x939a('0x41')],_0x305458[_0x939a('0x42')]);};AGIVertices['prototype']['gotoif']=function(_0x49458f){logger[_0x939a('0x32')](util['format'](_0x939a('0x14a'),_0x49458f['label']));if(!this[_0x939a('0x95')](_0x49458f[_0x939a('0x14b')])){return this[_0x939a('0x13')][_0x939a('0x31')](_0x49458f,_0x939a('0x14c'));}try{var _0x42009e=eval(_0x49458f[_0x939a('0x14b')])?_0x939a('0x14d'):_0x939a('0x14e');this[_0x939a('0x13')][_0x939a('0xbc')](util['format'](_0x939a('0x14f'),_0x49458f[_0x939a('0x14b')],_0x42009e));return{'code':0xc8,'result':_0x42009e};}catch(_0x493f4c){return{'code':0xc8,'result':_0x939a('0x14e')};}};AGIVertices[_0x939a('0x15')]['gotoiftime']=function(_0x313256){logger[_0x939a('0x32')](util['format'](_0x939a('0x150'),_0x313256[_0x939a('0xcd')]));if(!this['isConfigured'](_0x313256[_0x939a('0x151')])){return this[_0x939a('0x13')]['error'](_0x313256,_0x939a('0x152'));}var _0x53bd3a=this['getIntervals']['sync'](this,_0x313256[_0x939a('0x151')]);if(!_0x53bd3a){return this['channel']['error'](_0x313256,_0x939a('0x153'));}for(var _0x2baecd=0x0;_0x2baecd<_0x53bd3a['length'];_0x2baecd+=0x1){var _0x9f9921=this[_0x939a('0x13')]['getVariable'](util[_0x939a('0x2e')]('IFTIME(%s?true:false)',_0x53bd3a[_0x2baecd]));if(_0x9f9921['result']===-0x1){return _0x9f9921;}logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x154'),_0x53bd3a[_0x2baecd],_0x9f9921[_0x939a('0xb3')]));if(_0x9f9921['extra']===_0x939a('0x14d')){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x154'),_0x53bd3a[_0x2baecd],_0x939a('0x14d')));this['channel'][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x154'),_0x53bd3a[_0x2baecd],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x939a('0x32')](util[_0x939a('0x2e')]('IFTIME\x20%s\x20%s',_0x53bd3a[_0x2baecd],_0x939a('0x14e')));this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')]('IFTIME\x20%s\x20%s',_0x53bd3a[_0x2baecd],_0x939a('0x14e')));}}return{'code':0xc8,'result':_0x939a('0x14e')};};AGIVertices['prototype'][_0x939a('0x155')]=function(_0x169d57){logger[_0x939a('0x32')](util['format'](_0x939a('0x156'),_0x169d57[_0x939a('0xcd')]));return this[_0x939a('0x13')]['hangup']();};AGIVertices[_0x939a('0x15')][_0x939a('0x157')]=function(_0x302b5f){logger[_0x939a('0x32')](util['format'](_0x939a('0x158'),_0x302b5f[_0x939a('0xcd')]));if(!this[_0x939a('0x95')](_0x302b5f[_0x939a('0x90')])){return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0x13a'));}var _0x3bcc65=_0x939a('0x13b');var _0x2a8f92=util['format'](_0x939a('0x13c'),FILES_PATH,rs[_0x939a('0x129')](0x4));var _0x3f84bb=util[_0x939a('0x2e')](_0x939a('0xaf'),_0x2a8f92,_0x3bcc65);var _0x225959=!![];if(_0x302b5f['beep']===_0x939a('0x13e')){_0x225959=![];}var _0x4a032f=this[_0x939a('0x13')][_0x939a('0x159')](_0x2a8f92,_0x3bcc65,_0x302b5f['intKey'],_0x302b5f[_0x939a('0x76')],undefined,_0x225959);if(_0x4a032f[_0x939a('0xbb')]!==-0x1){this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x15a'),_0x3f84bb));var _0x507d9b=this[_0x939a('0x93')][_0x939a('0x80')](this,_0x302b5f,_0x3f84bb);if(_0x507d9b){for(var _0x4f54f6 in _0x507d9b){if(_0x507d9b['hasOwnProperty'](_0x4f54f6)){this['channel'][_0x939a('0xb6')](util['format'](_0x939a('0x15b'),_0x4f54f6[_0x939a('0x79')]()),_0x507d9b[_0x4f54f6]);}}return this[_0x939a('0x13')][_0x939a('0xbc')](util['format'](_0x939a('0x15c'),JSON[_0x939a('0x82')](_0x507d9b)));}}return _0x4a032f;};AGIVertices[_0x939a('0x15')][_0x939a('0x15d')]=function(_0x46acb3){logger[_0x939a('0x32')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x46acb3[_0x939a('0xcd')]));if(!this[_0x939a('0x95')](_0x46acb3[_0x939a('0x90')])){return this['channel'][_0x939a('0xbc')](_0x939a('0x13a'));}if(!this[_0x939a('0x95')](_0x46acb3[_0x939a('0x6b')])){return this['channel'][_0x939a('0xbc')](_0x939a('0xba'));}this['channel'][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x15e'),_0x46acb3[_0x939a('0x6b')]));var _0x38a4cd=this[_0x939a('0x8f')][_0x939a('0x80')](this,_0x46acb3);if(_0x38a4cd){this[_0x939a('0x13')]['noop'](util['format'](_0x939a('0x15a'),_0x38a4cd));var _0x30197d=this[_0x939a('0x13')][_0x939a('0x132')](_0x38a4cd,_0x46acb3[_0x939a('0x145')]);try{fs[_0x939a('0x133')](_0x38a4cd+_0x939a('0x110'));}catch(_0x4efd0e){logger[_0x939a('0x31')](_0x4efd0e);}return _0x30197d;}return this[_0x939a('0x13')]['error'](_0x46acb3,_0x939a('0x15f'));};AGIVertices['prototype'][_0x939a('0x160')]=function(_0x140e87){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x161'),_0x140e87[_0x939a('0xcd')]));if(!this[_0x939a('0x95')](_0x140e87[_0x939a('0x162')])){return this[_0x939a('0x13')]['error'](_0x140e87,'no\x20find\x20by\x20configured');}logger[_0x939a('0x32')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x939a('0x3e')],_0x140e87[_0x939a('0x162')]));var _0x46e6b6=this[_0x939a('0x62')][_0x939a('0x80')](this,_0x140e87['findBy']);if(_0x46e6b6){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x163'),this[_0x939a('0x13')][_0x939a('0x3e')],_0x140e87['findBy']));this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x163'),this['channel'][_0x939a('0x3e')],_0x140e87[_0x939a('0x162')]));return{'code':0xc8,'result':'success'};}else{logger[_0x939a('0x32')](util[_0x939a('0x2e')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x939a('0x13')]['callerid'],_0x140e87[_0x939a('0x162')]));this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x164'),this[_0x939a('0x13')][_0x939a('0x3e')],_0x140e87[_0x939a('0x162')]));return{'code':0xc8,'result':_0x939a('0x165')};}};AGIVertices[_0x939a('0x15')][_0x939a('0x166')]=function(_0x314103){logger[_0x939a('0x32')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x314103['label']));if(!this['isConfigured'](_0x314103[_0x939a('0x162')])){return this[_0x939a('0x13')][_0x939a('0x31')](_0x314103,_0x939a('0x167'));}logger['info'](util[_0x939a('0x2e')](_0x939a('0x168'),this[_0x939a('0x13')][_0x939a('0x3e')],_0x314103[_0x939a('0x162')]));var _0x315b23=this[_0x939a('0x61')][_0x939a('0x80')](this,_0x314103['findBy']);if(_0x315b23){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x163'),this['channel'][_0x939a('0x3e')],_0x314103['findBy']));this['channel']['noop'](util['format'](_0x939a('0x163'),this['channel']['callerid'],_0x314103[_0x939a('0x162')]));return{'code':0xc8,'result':'success'};}else{logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x164'),this[_0x939a('0x13')][_0x939a('0x3e')],_0x314103[_0x939a('0x162')]));this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x164'),this['channel'][_0x939a('0x3e')],_0x314103[_0x939a('0x162')]));return{'code':0xc8,'result':_0x939a('0x165')};}};AGIVertices[_0x939a('0x15')][_0x939a('0x169')]=function(_0x495b09){logger[_0x939a('0x32')](util[_0x939a('0x2e')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x495b09[_0x939a('0xcd')]));if(!this['isConfigured'](_0x495b09[_0x939a('0x16a')])){return this[_0x939a('0x13')]['error'](_0x495b09,'no\x20operation\x20configured');}this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x16b'),_0x495b09['operation']));var _0x55a3fc=eval(_0x495b09[_0x939a('0x16a')]);if(!this[_0x939a('0x95')](_0x495b09[_0x939a('0xe9')])){return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0xea'));}var _0x20eaa1=this['getVariable'][_0x939a('0x80')](this,_0x495b09[_0x939a('0xe9')]);if(!_0x20eaa1){return this[_0x939a('0x13')][_0x939a('0x31')](_0x495b09,_0x939a('0xeb'));}if(_[_0x939a('0xb0')](_0x55a3fc)){var _0x40eef6=this;_0x55a3fc[_0x939a('0xec')](function(_0x206a9a,_0x237029){_0x40eef6[_0x939a('0x13')]['setVariable'](util['format'](_0x939a('0x16c'),_0x20eaa1,_0x237029),_0x206a9a);});return this[_0x939a('0x13')][_0x939a('0xbc')](util['format'](_0x939a('0x16d'),_0x20eaa1));}else{return this[_0x939a('0x13')][_0x939a('0xb6')](_0x20eaa1,_0x55a3fc);}};AGIVertices[_0x939a('0x15')][_0x939a('0x10')]=function(_0x1c8264){logger[_0x939a('0x32')](util[_0x939a('0x2e')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x1c8264[_0x939a('0xcd')]));if(_0x1c8264[_0x939a('0xb8')]===0x0){return this[_0x939a('0xb7')](_0x1c8264);}_0x1c8264[_0x939a('0xb8')]-=0x1;if(!this[_0x939a('0x95')](_0x1c8264['file_id'])){return this['channel']['error'](_0x1c8264,'no\x20file\x20audio\x20selected');}var _0x294ce3=this['getSound'][_0x939a('0x80')](this,_0x1c8264[_0x939a('0x11e')]);if(!_0x294ce3){return this[_0x939a('0x13')][_0x939a('0x31')](_0x1c8264,_0x939a('0x120'));}var _0x4e6051=this['channel'][_0x939a('0x121')](_0x294ce3,_0x1c8264[_0x939a('0x122')],_0x1c8264['digit']);var _0x2eb3ea=_0x4e6051['result'];if(_0x4e6051[_0x939a('0xbb')]===-0x1){this[_0x939a('0x3b')][_0x939a('0x80')](this,_0x1c8264,'-1');return _0x4e6051;}else if(_0x4e6051['extra']===_0x939a('0x76')){_0x4e6051[_0x939a('0xbb')]=_0x4e6051['result'][_0x939a('0xac')]>0x0?_0x4e6051[_0x939a('0xbb')]:'t';}else if(_[_0x939a('0x4b')](_0x4e6051[_0x939a('0xbb')])){_0x4e6051['result']='#';_0x2eb3ea='#';}if(!this[_0x939a('0x95')](_0x1c8264[_0x939a('0xe9')])){this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x264827=this[_0x939a('0x16')][_0x939a('0x80')](this,_0x1c8264[_0x939a('0xe9')]);if(!_0x264827){return this['channel'][_0x939a('0x31')](_0x1c8264,_0x939a('0xeb'));}this[_0x939a('0x13')][_0x939a('0xb6')](_0x264827,_0x2eb3ea);}this[_0x939a('0x3b')][_0x939a('0x80')](this,_0x1c8264,_0x2eb3ea);return _0x4e6051;};AGIVertices[_0x939a('0x15')][_0x939a('0xbc')]=function(_0x3081d7){logger['info'](util['format'](_0x939a('0x16e'),_0x3081d7[_0x939a('0xcd')]));return this['channel'][_0x939a('0xbc')](_0x3081d7[_0x939a('0x16f')]||_0x3081d7[_0x939a('0xcd')]);};AGIVertices[_0x939a('0x15')]['pause']=function(_0x2ceeb8){logger[_0x939a('0x32')](util['format'](_0x939a('0x170'),_0x2ceeb8['label']));if(!this[_0x939a('0x95')](_0x2ceeb8['findBy'])){return this[_0x939a('0x13')][_0x939a('0x31')](_0x2ceeb8,_0x939a('0x167'));}logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x168'),this[_0x939a('0x13')][_0x939a('0x3e')],_0x2ceeb8[_0x939a('0x162')]));var _0x26e7c9=this[_0x939a('0x5c')][_0x939a('0x80')](this,_0x2ceeb8['pause_id']);var _0x1d545b=this[_0x939a('0x5f')][_0x939a('0x80')](this,_0x2ceeb8['findBy'],_0x26e7c9);if(_0x1d545b){logger[_0x939a('0x32')](util[_0x939a('0x2e')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x939a('0x3e')],_0x2ceeb8[_0x939a('0x162')]));this[_0x939a('0x13')][_0x939a('0xbc')](util['format'](_0x939a('0x163'),this[_0x939a('0x13')][_0x939a('0x3e')],_0x2ceeb8[_0x939a('0x162')]));return{'code':0xc8,'result':_0x939a('0x171')};}else{logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x164'),this[_0x939a('0x13')][_0x939a('0x3e')],_0x2ceeb8[_0x939a('0x162')]));this[_0x939a('0x13')]['noop'](util[_0x939a('0x2e')](_0x939a('0x163'),this[_0x939a('0x13')][_0x939a('0x3e')],_0x2ceeb8[_0x939a('0x162')]));return{'code':0xc8,'result':_0x939a('0x165')};}};AGIVertices['prototype']['playback']=function(_0x3c6486){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x172'),_0x3c6486['label']));if(!this[_0x939a('0x95')](_0x3c6486[_0x939a('0x11e')])){return this[_0x939a('0x13')][_0x939a('0x31')](_0x3c6486,_0x939a('0x11f'));}var _0x1a358a=this[_0x939a('0x23')][_0x939a('0x80')](this,_0x3c6486[_0x939a('0x11e')]);if(!_0x1a358a){return this['channel'][_0x939a('0x31')](_0x3c6486,_0x939a('0x120'));}var _0x1ad0d3=this[_0x939a('0x13')][_0x939a('0x66')](_0x939a('0x173'),[_0x1a358a,_0x3c6486[_0x939a('0xf7')]]);if(_0x1ad0d3[_0x939a('0xbb')]===-0x1){return _0x1ad0d3;}return this['channel'][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0xd1'),'PLAYBACK',_0x1a358a));};AGIVertices[_0x939a('0x15')]['queue']=function(_0x47730b){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x174'),_0x47730b['label']));if(!this[_0x939a('0x95')](_0x47730b[_0x939a('0x175')])){return this[_0x939a('0x13')]['error'](_0x47730b,'no\x20queue\x20selected');}var _0x2b01ee='';var _0x46ab16=parseInt(_0x47730b[_0x939a('0x175')],0xa);if(isNaN(_0x46ab16)){_0x2b01ee=_0x47730b[_0x939a('0x175')];}else{_0x2b01ee=this[_0x939a('0x1b')][_0x939a('0x80')](this,_0x47730b[_0x939a('0x175')]);if(!_0x2b01ee){return this['channel'][_0x939a('0x31')](_0x47730b,_0x939a('0x176'));}}var _0xcd7db='';if(this[_0x939a('0x95')](_0x47730b[_0x939a('0x11e')])){var _0x40cc45=this['getSound'][_0x939a('0x80')](this,_0x47730b[_0x939a('0x11e')]);if(_0x40cc45){_0xcd7db=_0x40cc45;}}this[_0x939a('0x3b')][_0x939a('0x80')](this,_0x47730b,_0x2b01ee);if(_0x47730b['opts']['indexOf']('x')<0x0){_0x47730b[_0x939a('0xf7')]+='x';}if(_0x47730b[_0x939a('0xf7')][_0x939a('0x177')]('X')<0x0){_0x47730b['opts']+='X';}this['channel'][_0x939a('0xb6')](_0x939a('0x178'),_0x2b01ee?_0x2b01ee[_0x939a('0x179')]():'');var _0xb9af2a=this[_0x939a('0x13')]['exec'](_0x939a('0x17a'),[_0x2b01ee,_0x47730b[_0x939a('0xf7')],_0x47730b[_0x939a('0x74')],_0xcd7db,_0x47730b[_0x939a('0x76')],_0x47730b[_0x939a('0xa')],_0x47730b[_0x939a('0x17b')],_0x47730b['gosub'],'',_0x47730b[_0x939a('0x17c')]]);if(_0xb9af2a['result']===-0x1){return _0xb9af2a;}return this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0xd1'),_0x939a('0x17a'),_0x2b01ee));};AGIVertices[_0x939a('0x15')][_0x939a('0x17d')]=function(_0x30519a){logger[_0x939a('0x32')](util['format'](_0x939a('0x17e'),_0x30519a[_0x939a('0xcd')]));var _0x1ca698=_0x30519a[_0x939a('0x17f')]||'wav';var _0x2826e6=util[_0x939a('0x2e')](_0x939a('0x180'),this[_0x939a('0x13')][_0x939a('0x40')],rs[_0x939a('0x129')](0x5));var _0x34acdc=util[_0x939a('0x2e')]('%s/recordings/%s.%s',FILES_PATH,_0x2826e6,_0x1ca698);var _0x53886c=util['format'](_0x939a('0x13c'),FILES_PATH,_0x2826e6);this[_0x939a('0x3f')]['sync'](this,_0x30519a,_0x2826e6,_0x34acdc);this[_0x939a('0x13')]['setVariable']('RECORDING_SAVENAME',_0x2826e6);logger['info'](_0x939a('0x181'),_0x53886c,_0x1ca698,_0x30519a['escape_digits'],_0x30519a['timeout']);return this['channel'][_0x939a('0x159')](_0x53886c,_0x1ca698,_0x30519a[_0x939a('0x182')],_0x30519a['timeout'],undefined,!![]);};AGIVertices[_0x939a('0x15')]['restapi']=function(_0x4b3f11){logger['info'](util[_0x939a('0x2e')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x4b3f11['label']));if(!this[_0x939a('0x95')](_0x4b3f11['url'])){return this[_0x939a('0x13')]['noop']('no\x20url\x20configured');}var _0x10f0da=this[_0x939a('0x183')]['sync'](this,_0x4b3f11);logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x184'),util[_0x939a('0x185')](_0x10f0da,{'showHidden':![],'depth':null})));if(!this[_0x939a('0x95')](_0x4b3f11['variable_id'])){return this['channel'][_0x939a('0xbc')](_0x939a('0x186'));}var _0x23b973=this[_0x939a('0x16')][_0x939a('0x80')](this,_0x4b3f11['variable_id']);if(!_0x23b973){return this['channel'][_0x939a('0x31')](_0x4b3f11,_0x939a('0xeb'));}this['channel'][_0x939a('0xb6')](util[_0x939a('0x2e')](_0x939a('0x187'),_0x23b973),_0x10f0da[_0x939a('0x84')]?_0x10f0da['statusCode']:_0x939a('0x188'));this['channel'][_0x939a('0xb6')](util[_0x939a('0x2e')](_0x939a('0x189'),_0x23b973),_0x10f0da[_0x939a('0x18a')]?_0x10f0da[_0x939a('0x18a')]:'OK');if(_0x10f0da['body']){try{this[_0x939a('0xae')](_0x10f0da[_0x939a('0x7a')],_0x23b973);}catch(_0x2454a1){logger[_0x939a('0x31')](util[_0x939a('0x2e')](_0x939a('0x18b'),_0x23b973));}}return this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0xf0'),_0x23b973));};AGIVertices[_0x939a('0x15')][_0x939a('0x18c')]=function(_0xae656a){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x18d'),_0xae656a['label']));return this[_0x939a('0x13')][_0x939a('0x18e')](_0xae656a[_0x939a('0x18f')][_0x939a('0xe7')](/\s+/g,''),_0xae656a['escape_digits']);};AGIVertices['prototype'][_0x939a('0x190')]=function(_0xbdd244){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x191'),_0xbdd244[_0x939a('0xcd')]));return this[_0x939a('0x13')]['sayNumber'](_0xbdd244[_0x939a('0x77')][_0x939a('0xe7')](/\s+/g,''),_0xbdd244[_0x939a('0x182')]);};AGIVertices[_0x939a('0x15')]['sayphonetic']=function(_0x58ee2c){logger[_0x939a('0x32')](util['format'](_0x939a('0x192'),_0x58ee2c[_0x939a('0xcd')]));return this['channel']['sayPhonetic'](_0x58ee2c['text'],_0x58ee2c[_0x939a('0x182')]);};AGIVertices['prototype']['sendMail']=function(_0x3dcdbd){logger[_0x939a('0x32')](util[_0x939a('0x2e')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x3dcdbd[_0x939a('0xcd')]));if(!this['isConfigured'](_0x3dcdbd[_0x939a('0x193')])){return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0x194'));}var _0xcaf304=this[_0x939a('0x26')]['sync'](this,_0x3dcdbd['account_id']);if(!_0xcaf304||!_0xcaf304[_0x939a('0x195')]){return this['channel']['error'](_0x3dcdbd,_0x939a('0x196'));}var _0x16a6e6={'from':util[_0x939a('0x2e')]('\x22%s\x22\x20<%s>',_0xcaf304['name'],_0xcaf304[_0x939a('0x197')]||_0xcaf304[_0x939a('0x195')]['user']),'to':_0x3dcdbd['to']||'','cc':_0x3dcdbd['cc']||'','bcc':_0x3dcdbd['bcc']||'','subject':_0x3dcdbd[_0x939a('0x198')],'html':_0x3dcdbd[_0x939a('0x6b')],'text':_0x3dcdbd[_0x939a('0x6b')]};var _0x4452eb={'tls':{'rejectUnauthorized':![]}};if(_0xcaf304[_0x939a('0x195')][_0x939a('0x199')]){_0x4452eb[_0x939a('0x199')]=_0xcaf304[_0x939a('0x195')][_0x939a('0x199')];}else{_0x4452eb['host']=_0xcaf304[_0x939a('0x195')][_0x939a('0x19a')];_0x4452eb['port']=_0xcaf304[_0x939a('0x195')][_0x939a('0x19b')];_0x4452eb[_0x939a('0x19c')]=_0xcaf304[_0x939a('0x195')][_0x939a('0x19c')];}if(_0xcaf304[_0x939a('0x195')][_0x939a('0x19d')]){_0x4452eb[_0x939a('0x19e')]={'user':_0xcaf304[_0x939a('0x195')][_0x939a('0x19f')],'pass':_0xcaf304[_0x939a('0x195')][_0x939a('0x1a0')]};}if(this[_0x939a('0x95')](_0x3dcdbd[_0x939a('0x1a1')])){}logger[_0x939a('0xf2')](_0x939a('0x1a2'),JSON[_0x939a('0x82')](_0x16a6e6));this[_0x939a('0x3b')][_0x939a('0x80')](this,_0x3dcdbd,_0x3dcdbd[_0x939a('0x193')]);this['channel'][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x1a3'),_0xcaf304[_0x939a('0x19')]));this[_0x939a('0x28')][_0x939a('0x80')](this,_0x4452eb,_0x16a6e6);return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0x1a4'));};AGIVertices[_0x939a('0x15')][_0x939a('0x1a5')]=function(_0x59eb10){logger[_0x939a('0x32')](util[_0x939a('0x2e')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x59eb10[_0x939a('0xcd')]));return this[_0x939a('0x13')][_0x939a('0xbc')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x939a('0x15')][_0x939a('0x1a6')]=function(_0x3d8d3f){logger[_0x939a('0x32')](util[_0x939a('0x2e')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x3d8d3f[_0x939a('0xcd')]));if(!this[_0x939a('0x95')](_0x3d8d3f['sms_account_id'])){return this[_0x939a('0x13')][_0x939a('0xbc')]('no\x20sms\x20account\x20configured');}var _0x4805bd=this[_0x939a('0x38')][_0x939a('0x80')](this,_0x3d8d3f[_0x939a('0x1a7')]);if(!_0x4805bd){return this[_0x939a('0x13')]['error'](_0x3d8d3f,_0x939a('0x1a8'));}var _0x3c324c={'body':_0x3d8d3f[_0x939a('0x1a9')],'phone':_0x3d8d3f['to']||'','SmsAccountId':_0x4805bd['id']};logger['debug'](_0x939a('0x1aa'),JSON[_0x939a('0x82')](_0x3c324c));this[_0x939a('0x3b')]['sync'](this,_0x3d8d3f,_0x3d8d3f[_0x939a('0x1a7')]);this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x1ab'),_0x4805bd[_0x939a('0x19')]));this['createSmsMessage']['sync'](this,_0x3c324c);return this[_0x939a('0x13')][_0x939a('0xbc')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x939a('0x15')][_0x939a('0x1ac')]=function(_0xc7e530){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x1ad'),_0xc7e530[_0x939a('0xcd')]));if(!this[_0x939a('0x95')](_0xc7e530[_0x939a('0xe9')])){return this[_0x939a('0x13')][_0x939a('0x31')](_0xc7e530,'no\x20variable\x20selected');}var _0x270982=this['getVariable']['sync'](this,_0xc7e530[_0x939a('0xe9')]);if(!_0x270982){return this[_0x939a('0x13')][_0x939a('0x31')](_0xc7e530,_0x939a('0xeb'));}return this[_0x939a('0x13')][_0x939a('0xb6')](_0x270982,_0xc7e530[_0x939a('0x1ae')]);};AGIVertices['prototype'][_0x939a('0x1af')]=function(_0x4553dd){logger[_0x939a('0x32')](util[_0x939a('0x2e')]('Enter\x20in\x20START\x20(%s)\x20block',_0x4553dd[_0x939a('0xcd')]));this[_0x939a('0x13')][_0x939a('0xbc')]('START\x20CALLY\x20SQUARE');if(_0x4553dd['answer']===_0x939a('0x1b0')){this[_0x939a('0x13')][_0x939a('0xbc')]('Answer');return this[_0x939a('0x13')][_0x939a('0xc8')]();}return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0x1b1'));};AGIVertices[_0x939a('0x15')]['subproject']=function(_0x552dca){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x1b2'),_0x552dca['label']));if(!this[_0x939a('0x95')](_0x552dca[_0x939a('0x1b3')])){return this[_0x939a('0x13')][_0x939a('0x31')](_0x552dca,'no\x20subproject\x20selected');}var _0xa5d4b7=this[_0x939a('0x1b4')][_0x939a('0x80')](this,_0x552dca[_0x939a('0x1b3')]);if(!this[_0x939a('0x95')](_0xa5d4b7)){return this[_0x939a('0x13')]['error'](_0x552dca,util[_0x939a('0x2e')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x552dca[_0x939a('0x1b3')]));}if(_0xa5d4b7===this['channel'][_0x939a('0x3d')]){return this['channel']['error'](_0x552dca,_0x939a('0x1b5'));}this[_0x939a('0x3b')][_0x939a('0x80')](this,_0x552dca,_0xa5d4b7);var _0x2315dd=this[_0x939a('0x13')][_0x939a('0x66')](_0x939a('0x1b6'),util[_0x939a('0x2e')](_0x939a('0x1b7'),config[_0x939a('0xa')][_0x939a('0x19a')]||'127.0.0.1',_0xa5d4b7,this['channel'][_0x939a('0x3d')]));if(_0x2315dd[_0x939a('0xbb')]===-0x1){return _0x2315dd;}return this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')]('Executed\x20command\x20%s\x20%s',_0x939a('0x1b6'),_0xa5d4b7));};AGIVertices[_0x939a('0x15')][_0x939a('0x1b8')]=function(_0x203e2e){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x1b9'),_0x203e2e[_0x939a('0xcd')]));var _0xc89506=this['shellCommand']['sync'](this,_0x203e2e[_0x939a('0xc6')]);this[_0x939a('0x3b')]['sync'](this,_0x203e2e,_0x203e2e['command']);if(this[_0x939a('0x95')](_0x203e2e['variable_id'])){var _0x2e3585=this[_0x939a('0x16')][_0x939a('0x80')](this,_0x203e2e[_0x939a('0xe9')]);if(_0x2e3585){this[_0x939a('0x13')][_0x939a('0xb6')](_0x2e3585,_0xc89506);return this[_0x939a('0x13')][_0x939a('0xbc')](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x203e2e[_0x939a('0xc6')],_0x2e3585));}}return this[_0x939a('0x13')]['noop'](util[_0x939a('0x2e')](_0x939a('0x1ba'),_0x203e2e[_0x939a('0xc6')]));};AGIVertices[_0x939a('0x15')]['google_cloud_tts']=function(_0x356ff5){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x1bb'),_0x356ff5[_0x939a('0xcd')]));_0x356ff5[_0x939a('0x6b')]=_0x356ff5[_0x939a('0x6b')][_0x939a('0xe7')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x356ff5[_0x939a('0x69')])){return this[_0x939a('0x13')][_0x939a('0xbc')]('no\x20apiKey\x20configured');}if(!this[_0x939a('0x95')](_0x356ff5[_0x939a('0x6b')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x939a('0x13')][_0x939a('0xbc')](util[_0x939a('0x2e')](_0x939a('0x1bc'),_0x356ff5[_0x939a('0x6b')]));var _0x25fb53=this[_0x939a('0x68')]['sync'](this,_0x356ff5);if(_0x25fb53){this[_0x939a('0x13')]['noop'](util['format'](_0x939a('0x1bd'),_0x25fb53));var _0x5696c4=this['channel'][_0x939a('0x132')](_0x25fb53);try{fs[_0x939a('0x133')](_0x25fb53+_0x939a('0x110'));}catch(_0x2db157){logger[_0x939a('0x31')](_0x2db157);}return _0x5696c4;}return this['channel'][_0x939a('0x31')](_0x356ff5,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x939a('0x15')]['tts']=function(_0x5783e7){logger[_0x939a('0x32')](util[_0x939a('0x2e')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x5783e7['label']));_0x5783e7[_0x939a('0x6b')]=_0x5783e7['text'][_0x939a('0xe7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x939a('0x95')](_0x5783e7['text'])){return this[_0x939a('0x13')][_0x939a('0xbc')](_0x939a('0xba'));}this[_0x939a('0x13')]['noop'](util['format'](_0x939a('0x1be'),_0x5783e7[_0x939a('0x6b')]));var _0x111013=this[_0x939a('0x72')]['sync'](this,_0x5783e7);if(_0x111013){this[_0x939a('0x13')]['noop'](util[_0x939a('0x2e')](_0x939a('0x1bf'),_0x111013));var _0x42e129=this[_0x939a('0x13')]['streamFile'](_0x111013);try{fs[_0x939a('0x133')](_0x111013+'.wav');}catch(_0x5b2392){logger[_0x939a('0x31')](_0x5b2392);}return _0x42e129;}return this[_0x939a('0x13')][_0x939a('0x31')](_0x5783e7,_0x939a('0x1c0'));};AGIVertices[_0x939a('0x15')][_0x939a('0x1c1')]=function(_0x836be9){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x1c2'),_0x836be9[_0x939a('0xcd')]));if(!this[_0x939a('0x95')](_0x836be9[_0x939a('0x162')])){return this['channel'][_0x939a('0x31')](_0x836be9,_0x939a('0x167'));}logger['info'](util[_0x939a('0x2e')](_0x939a('0x168'),this[_0x939a('0x13')]['callerid'],_0x836be9[_0x939a('0x162')]));var _0x455ac5=this['agentUnpause']['sync'](this,_0x836be9[_0x939a('0x162')]);if(_0x455ac5){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x163'),this['channel'][_0x939a('0x3e')],_0x836be9['findBy']));this['channel']['noop'](util[_0x939a('0x2e')](_0x939a('0x163'),this[_0x939a('0x13')][_0x939a('0x3e')],_0x836be9['findBy']));return{'code':0xc8,'result':_0x939a('0x171')};}else{logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x164'),this[_0x939a('0x13')][_0x939a('0x3e')],_0x836be9[_0x939a('0x162')]));this[_0x939a('0x13')]['noop'](util[_0x939a('0x2e')](_0x939a('0x164'),this[_0x939a('0x13')][_0x939a('0x3e')],_0x836be9['findBy']));return{'code':0xc8,'result':_0x939a('0x165')};}};AGIVertices[_0x939a('0x15')][_0x939a('0x1c3')]=function(_0x508fe7){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x1c4'),_0x508fe7['label']));var _0xa7a1f4=this['channel'][_0x939a('0x66')](_0x939a('0x1c5'),[_0x508fe7[_0x939a('0x1c6')],_0x508fe7['options']]);if(_0xa7a1f4[_0x939a('0xbb')]===-0x1){return _0xa7a1f4;}return this[_0x939a('0x13')]['noop'](util['format'](_0x939a('0xd1'),'VOICEMAIL',_0x508fe7['mailbox']));};AGIVertices[_0x939a('0x15')][_0x939a('0x1c7')]=function(_0x3ad044){logger[_0x939a('0x32')](util[_0x939a('0x2e')](_0x939a('0x1c8'),_0x3ad044[_0x939a('0xcd')]));if(!this[_0x939a('0x95')](_0x3ad044[_0x939a('0xe9')])){return this[_0x939a('0x13')][_0x939a('0x31')](_0x3ad044,_0x939a('0x1c9'));}var _0x1bb0db=this[_0x939a('0x16')]['sync'](this,_0x3ad044[_0x939a('0xe9')]);if(!_0x1bb0db){return this['channel'][_0x939a('0x31')](_0x3ad044,'no\x20variable\x20found');}var _0x182983=this[_0x939a('0x13')][_0x939a('0x16')](_0x1bb0db);return{'code':0xc8,'result':_0x182983[_0x939a('0xb3')]?_0x182983['extra']:'-'};};String['prototype'][_0x939a('0x1ca')]=function(_0x421a15,_0x4eeb3a){return this[_0x939a('0xb2')](_0x421a15)['join'](_0x4eeb3a);};module[_0x939a('0x1cb')]=AGIVertices; \ No newline at end of file +var _0xe015=['awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clone','isString','replaceObjectAllVariables','hasOwnProperty','isPlainObject','isArray','length','recursiveNodeIndex','replaceAllVariables','saveRestApiResult','isEmpty','%s.%s','setVariable','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','no\x20text\x20configured','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_INSTANCE','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','out','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','DIALOGFLOW_%s','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','no\x20key\x20configured','wav','%s/recordings/%s','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','priority','gotoif','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','recordFile','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','no\x20operation\x20configured','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','playback','no\x20file\x20audio\x20selected','PLAYBACK','queue','queue_id','no\x20queue\x20selected','indexOf','QUEUE','position','Executed\x20command\x20%s\x20%s','record','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','service','host','port','secure','authentication','auth','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','googleCloudTTS','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','agentUnpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','replaceAll','join','exports','path','util','lodash','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment/shared','./scripts','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','getVariable','rpc','getVariableById','name','catch','prototype','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','then','getUser','getUserById','getSound','getSoundById','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','lastName','phone','scheduledAt','callback','toString','callback_priority','has','dialTimezone','getContactByPhone','timezones','utcOffset','scheduledat','add','minutes','insertContact','getPause','getPauseById','agentPause','agent','agentLogout','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','includes','POST','PUT','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xe015,0x13b));var _0x5e01=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xe015[_0x126558];return _0x1f6d14;};'use strict';var fs=require('fs');var path=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var _=require(_0x5e01('0x2'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x5e01('0x3'));var moment=require('moment');var Mustache=require(_0x5e01('0x4'));var rp=require(_0x5e01('0x5'));var logger=require(_0x5e01('0x6'))(_0x5e01('0x7'));var config=require('../../config/environment');var shared=require(_0x5e01('0x8'));var scripts=require(_0x5e01('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x5e01('0xa')];var verticesWithRetry=[_0x5e01('0xb'),_0x5e01('0xc'),_0x5e01('0xd')];var AGIVertices=function(_0x4a39b1,_0x36bd7e,_0x5b3938){this[_0x5e01('0xe')]=_0x4a39b1;this['rpc']=_0x36bd7e;this[_0x5e01('0xf')]=_0x5b3938;};AGIVertices['prototype'][_0x5e01('0x10')]=function(_0x406b26,_0x553a53){this[_0x5e01('0x11')][_0x5e01('0x12')](_0x406b26)['then'](function(_0x560ae2){_0x553a53(null,_0x560ae2?_0x560ae2[_0x5e01('0x13')]:![]);})[_0x5e01('0x14')](function(_0x468901){_0x553a53(_0x468901);});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x16')]=function(_0x16bc8f,_0x4bd426){this[_0x5e01('0x11')]['getVoiceQueueById'](_0x16bc8f)['then'](function(_0x1df2e0){_0x4bd426(null,_0x1df2e0?_0x1df2e0[_0x5e01('0x13')]:![]);})['catch'](function(_0x27c6e7){_0x4bd426(_0x27c6e7);});};AGIVertices['prototype'][_0x5e01('0x17')]=function(_0x5e4058,_0x384274){this['rpc'][_0x5e01('0x18')](_0x5e4058)['then'](function(_0x509c07){_0x384274(null,_0x509c07?_0x509c07[_0x5e01('0x13')]:![]);})[_0x5e01('0x14')](function(_0x4fa1c7){_0x384274(_0x4fa1c7);});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x19')]=function(_0x36b4a7,_0x45e543){this[_0x5e01('0x11')][_0x5e01('0x1a')](_0x36b4a7)[_0x5e01('0x1b')](function(_0x153eb1){_0x45e543(null,_0x153eb1?_0x153eb1['dsn']:![]);})[_0x5e01('0x14')](function(_0x208586){_0x45e543(_0x208586);});};AGIVertices['prototype'][_0x5e01('0x1c')]=function(_0x306cff,_0x337ad2){this[_0x5e01('0x11')][_0x5e01('0x1d')](_0x306cff)[_0x5e01('0x1b')](function(_0x5efff9){_0x337ad2(null,_0x5efff9?_0x5efff9[_0x5e01('0x13')]:![]);})[_0x5e01('0x14')](function(_0x3417b2){_0x337ad2(_0x3417b2);});};AGIVertices[_0x5e01('0x15')]['getTrunk']=function(_0x557f06,_0x23264f){this[_0x5e01('0x11')]['getTrunkById'](_0x557f06)[_0x5e01('0x1b')](function(_0x23454e){_0x23264f(null,_0x23454e?_0x23454e[_0x5e01('0x13')]:![]);})[_0x5e01('0x14')](function(_0x58dc6f){_0x23264f(_0x58dc6f);});};AGIVertices['prototype'][_0x5e01('0x1e')]=function(_0x5f01dd,_0x14b9f5){var _0x1332bb=this;this[_0x5e01('0x11')][_0x5e01('0x1f')](_0x5f01dd)['then'](function(_0x531f0a){_0x14b9f5(null,_0x531f0a?_0x1332bb['getSoundPath'](_0x531f0a['save_name']):![]);})[_0x5e01('0x14')](function(_0x5cd28e){_0x14b9f5(_0x5cd28e);});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x20')]=function(_0xc6d3c2,_0x494da9){this[_0x5e01('0x11')][_0x5e01('0x21')](_0xc6d3c2)[_0x5e01('0x1b')](function(_0x33b3b3){_0x494da9(null,_0x33b3b3?_0x33b3b3:![]);})['catch'](function(_0x5f263e){_0x494da9(_0x5f263e);});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x22')]=function(_0x308649,_0x207107,_0x350659){this[_0x5e01('0xf')][_0x5e01('0x22')](_0x308649,_0x207107)[_0x5e01('0x1b')](function(){_0x350659(null);})[_0x5e01('0x14')](function(_0xe5738){_0x350659(_0xe5738);});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x23')]=function(_0x53ab35,_0xbd01ae){this[_0x5e01('0x11')][_0x5e01('0x24')](_0x53ab35)['then'](function(_0x217fca){if(_0x217fca){if(_0x217fca[_0x5e01('0x25')]){_0xbd01ae(null,[_0x217fca['interval']]);}else{_0xbd01ae(null,_[_0x5e01('0x26')](_0x217fca[_0x5e01('0x27')],_0x5e01('0x28')));}}else{_0xbd01ae(null,![]);}})['catch'](function(_0x458a5e){_0xbd01ae(_0x458a5e);});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x29')]=function(_0x3dbba){return util[_0x5e01('0x2a')](_0x5e01('0x2b'),FILES_PATH,_0x3dbba);};AGIVertices[_0x5e01('0x15')][_0x5e01('0x2c')]=function(_0x94d4ee,_0x2b052e,_0x1c12af){odbc[_0x5e01('0x2d')](_0x94d4ee,function(_0x20f3c6){if(_0x20f3c6){logger[_0x5e01('0x2e')](_0x5e01('0x2f'),_0x20f3c6);_0x1c12af(_0x20f3c6);}else{logger['info'](_0x5e01('0x30'));odbc['query'](_0x2b052e,function(_0x544899,_0x34e8f5){if(_0x544899){logger[_0x5e01('0x31')](_0x5e01('0x32'),_0x2b052e);_0x1c12af(_0x544899);}else{logger[_0x5e01('0x31')](_0x5e01('0x33'),_0x2b052e);odbc['close'](function(_0xd4e3cc){if(_0xd4e3cc){logger[_0x5e01('0x2e')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0xd4e3cc);}_0x1c12af(null,_0x34e8f5);});}});}});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x34')]=function(_0xfbc18b,_0x4aeb11){this[_0x5e01('0x11')][_0x5e01('0x35')](_0xfbc18b)['then'](function(_0x1500da){_0x4aeb11(null,_0x1500da?_0x1500da:![]);})[_0x5e01('0x14')](function(_0x5cf776){_0x4aeb11(_0x5cf776);});};AGIVertices['prototype'][_0x5e01('0x36')]=function(_0x4fe865,_0x2d7423){this[_0x5e01('0x11')][_0x5e01('0x36')](_0x4fe865)[_0x5e01('0x1b')](function(_0x5c471d){_0x2d7423(null,_0x5c471d);})[_0x5e01('0x14')](function(_0xb93846){_0x2d7423(_0xb93846);});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x37')]=function(_0x3791e8,_0x1ecece,_0x3e6c8c){this['rpc'][_0x5e01('0x37')]({'uniqueid':this[_0x5e01('0xe')][_0x5e01('0x38')],'node':_0x3791e8[_0x5e01('0x39')],'application':_0x3791e8[_0x5e01('0x3a')],'data':_0x1ecece||null,'project_name':this['channel'][_0x5e01('0x3b')],'callerid':this[_0x5e01('0xe')][_0x5e01('0x3c')]})[_0x5e01('0x1b')](function(_0x4748c1){if(_0x3e6c8c){_0x3e6c8c(null,_0x4748c1);}})[_0x5e01('0x14')](function(_0x19e2f7){if(_0x3e6c8c){_0x3e6c8c(_0x19e2f7);}});};AGIVertices['prototype'][_0x5e01('0x3d')]=function(_0x4b5bf2,_0x220539,_0x2aadfe,_0x43c29b){this[_0x5e01('0x11')][_0x5e01('0x3d')]({'uniqueid':this[_0x5e01('0xe')]['uniqueid'],'callerid':this[_0x5e01('0xe')]['callerid'],'calleridname':this[_0x5e01('0xe')][_0x5e01('0x3e')],'context':this[_0x5e01('0xe')][_0x5e01('0x3f')],'extension':this[_0x5e01('0xe')][_0x5e01('0x40')],'priority':this['channel']['priority'],'accountcode':this[_0x5e01('0xe')][_0x5e01('0x41')],'dnid':this[_0x5e01('0xe')][_0x5e01('0x42')],'projectName':this[_0x5e01('0xe')][_0x5e01('0x3b')],'saveName':_0x220539,'filename':_0x4b5bf2[_0x5e01('0x43')]||_0x220539,'savePath':_0x2aadfe})[_0x5e01('0x1b')](function(_0xfd1153){_0x43c29b(null,_0xfd1153);})[_0x5e01('0x14')](function(_0x10cf3e){_0x43c29b(_0x10cf3e);});};AGIVertices['prototype'][_0x5e01('0x44')]=function(_0x426ab8,_0x1ad300,_0x4f6e74,_0x33416f,_0x3897a1){this[_0x5e01('0x11')][_0x5e01('0x44')]({'uniqueid':this[_0x5e01('0xe')]['uniqueid'],'body':_0x426ab8,'direction':_0x1ad300,'providerName':_0x4f6e74,'providerResponse':_0x33416f})[_0x5e01('0x1b')](function(_0x4f7939){if(_0x3897a1){_0x3897a1(null,_0x4f7939);}})[_0x5e01('0x14')](function(_0x13c787){if(_0x3897a1){_0x3897a1(_0x13c787);}});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x45')]=function(_0x11b36f,_0x16d6af){var _0x2f8d98=this;var _0x427748=0x0;var _0x19f0d6={'firstName':_['isEmpty'](_0x11b36f[_0x5e01('0x13')])||_[_0x5e01('0x46')](_0x11b36f[_0x5e01('0x13')])?_0x5e01('0x47')+Math[_0x5e01('0x48')]():_0x11b36f[_0x5e01('0x13')],'lastName':_['isEmpty'](_0x11b36f[_0x5e01('0x49')])||_['isNil'](_0x11b36f[_0x5e01('0x49')])?null:_0x11b36f[_0x5e01('0x49')],'phone':_0x11b36f[_0x5e01('0x4a')],'ListId':_0x11b36f['list_id'],'scheduledat':_0x11b36f[_0x5e01('0x4b')],'callbackUniqueid':this[_0x5e01('0xe')]['uniqueid'],'tags':_0x5e01('0x4c'),'description':'Callback\x20scheduled\x20at\x20'+_0x11b36f[_0x5e01('0x4b')][_0x5e01('0x4d')](),'priority':_0x11b36f[_0x5e01('0x4e')]};if(_[_0x5e01('0x4f')](_0x11b36f,'dialTimezone')){if(!_[_0x5e01('0x46')](_0x11b36f['dialTimezone'])){var _0x4ef450=_0x11b36f[_0x5e01('0x50')];if(_0x11b36f['dialTimezone']=='CALLERID(dialTimezone)'){this[_0x5e01('0x11')][_0x5e01('0x51')]({'phone':_0x11b36f[_0x5e01('0x4a')]})[_0x5e01('0x1b')](function(_0x39c3e9){if(!_[_0x5e01('0x46')](_0x39c3e9)){var _0x2942df=_0x39c3e9[_0x5e01('0x50')];if(!_['isNil'](_0x2942df)){var _0x15c7bb=shared[_0x5e01('0x52')][_0x2942df];if(!_['isNil'](_0x15c7bb)){var _0x9f5e19=-0x1*_0x15c7bb[_0x5e01('0x53')];_0x19f0d6['scheduledat']=moment(_0x11b36f[_0x5e01('0x54')])[_0x5e01('0x55')](_0x9f5e19,_0x5e01('0x56'));_0x2f8d98[_0x5e01('0x57')](_0x19f0d6,_0x11b36f,_0x16d6af);}else{_0x2f8d98[_0x5e01('0x57')](_0x19f0d6,_0x11b36f,_0x16d6af);}}else{_0x2f8d98['insertContact'](_0x19f0d6,_0x11b36f,_0x16d6af);}}else{_0x2f8d98[_0x5e01('0x57')](_0x19f0d6,_0x11b36f,_0x16d6af);}});}else{var _0x427748=shared[_0x5e01('0x52')][_0x4ef450];if(!_['isNil'](_0x427748)){var _0x45a7d4=-0x1*_0x427748['utcOffset'];_0x19f0d6[_0x5e01('0x54')]=moment(_0x11b36f[_0x5e01('0x54')])[_0x5e01('0x55')](_0x45a7d4,_0x5e01('0x56'));_0x2f8d98['insertContact'](_0x19f0d6,_0x11b36f,_0x16d6af);}else{_0x2f8d98['insertContact'](_0x19f0d6,_0x11b36f,_0x16d6af);}}}else{_0x2f8d98[_0x5e01('0x57')](_0x19f0d6,_0x11b36f,_0x16d6af);}}else{_0x2f8d98[_0x5e01('0x57')](_0x19f0d6,_0x11b36f,_0x16d6af);}};AGIVertices['prototype'][_0x5e01('0x58')]=function(_0x141e99,_0x4ce7fe){this[_0x5e01('0x11')][_0x5e01('0x59')](_0x141e99)[_0x5e01('0x1b')](function(_0xecbce4){_0x4ce7fe(null,_0xecbce4?_0xecbce4[_0x5e01('0x13')]:![]);})['catch'](function(_0x5d8c58){_0x4ce7fe(_0x5d8c58);});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x5a')]=function(_0x45ddb8,_0x5c87f6,_0x2026e1){var _0x5035ff={'role':_0x5e01('0x5b')};_0x5035ff[_0x45ddb8]=this[_0x5e01('0xe')][_0x5e01('0x3c')];this[_0x5e01('0x11')]['agentPause'](_0x5035ff,_0x5c87f6,this[_0x5e01('0xe')][_0x5e01('0x38')])[_0x5e01('0x1b')](function(_0x49f357){_0x2026e1(null,_['isNil'](_0x49f357)?![]:!![]);})[_0x5e01('0x14')](function(_0x16a05a){logger['error'](_0x16a05a);_0x2026e1(null,![]);});};AGIVertices[_0x5e01('0x15')]['agentUnpause']=function(_0xb66454,_0x32653d){var _0x224c9a={'role':'agent'};_0x224c9a[_0xb66454]=this[_0x5e01('0xe')][_0x5e01('0x3c')];this[_0x5e01('0x11')]['agentUnpause'](_0x224c9a)[_0x5e01('0x1b')](function(_0x2b21c2){_0x32653d(null,_[_0x5e01('0x46')](_0x2b21c2)?![]:!![]);})['catch'](function(_0x4d436c){logger[_0x5e01('0x2e')](_0x4d436c);_0x32653d(null,![]);});};AGIVertices['prototype'][_0x5e01('0x5c')]=function(_0x106162,_0x31c44f){var _0x2e0118={'role':'agent'};_0x2e0118[_0x106162]=this['channel'][_0x5e01('0x3c')];this['rpc']['agentLogout'](_0x2e0118)['then'](function(_0xb38f5b){_0x31c44f(null,_[_0x5e01('0x46')](_0xb38f5b)?![]:!![]);})[_0x5e01('0x14')](function(_0x20d2d4){logger[_0x5e01('0x2e')](_0x20d2d4);_0x31c44f(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x35f391,_0x31bb17){var _0x596082={'role':_0x5e01('0x5b')};_0x596082[_0x35f391]=this[_0x5e01('0xe')][_0x5e01('0x3c')];var _0xe9c4f2=_0x35f391!='internal'?util['format'](_0x5e01('0x5d'),_0x5e01('0x5e'),this[_0x5e01('0xe')][_0x5e01('0x3c')]):undefined;this[_0x5e01('0x11')]['agentLogin'](_0x596082,_0xe9c4f2)[_0x5e01('0x1b')](function(_0x5371c6){_0x31bb17(null,_[_0x5e01('0x46')](_0x5371c6)?![]:!![]);})['catch'](function(_0x339e44){logger[_0x5e01('0x2e')](_0x339e44);_0x31bb17(null,![]);});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x5f')]=function(_0x1083ed,_0x5b58d3){sh[_0x5e01('0x60')](_[_0x5e01('0x61')](_0x1083ed),function(_0xdc0d77,_0x461674){var _0xc4564=_0x461674[_0x5e01('0x62')](/(\r\n|\n|\r)/gm,'');_0x5b58d3(null,_0xc4564);});};AGIVertices[_0x5e01('0x15')]['googleCloudTTS']=function(_0x57a8e3,_0x244407){scripts['googleCloudTTS'](_0x57a8e3[_0x5e01('0x63')],_0x57a8e3[_0x5e01('0x64')]||_0x5e01('0x65'),_0x57a8e3[_0x5e01('0x65')],_0x57a8e3['languageCode']||_0x5e01('0x66'),_0x57a8e3[_0x5e01('0x67')]||_0x5e01('0x68'),_0x57a8e3[_0x5e01('0x69')]||_0x5e01('0x6a'))[_0x5e01('0x1b')](function(_0x13b15d){_0x244407(null,_0x13b15d);})[_0x5e01('0x14')](function(_0x2f48c7){_0x244407(_0x2f48c7);});};AGIVertices['prototype'][_0x5e01('0x6b')]=function(_0x7287ee,_0x44a4c9){scripts['googleTTS'](_0x7287ee[_0x5e01('0x65')],_0x7287ee[_0x5e01('0x6c')]||'en',0x1)[_0x5e01('0x1b')](function(_0x1c8fd8){_0x44a4c9(null,_0x1c8fd8);})[_0x5e01('0x14')](function(_0x58dee6){_0x44a4c9(_0x58dee6);});};AGIVertices['prototype'][_0x5e01('0x6d')]=function(_0x5679d5,_0x132fa6){var _0x5dde2c={'uri':_0x5679d5[_0x5e01('0x6e')],'method':_0x5679d5[_0x5e01('0x6f')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5679d5['timeout'])===_0x5e01('0x70')&&parseInt(_0x5679d5['timeout'])>=0x1?parseInt(_0x5679d5[_0x5e01('0x71')])*0x3e8:0x5*0x3e8};if(_[_0x5e01('0x72')]([_0x5e01('0x73'),_0x5e01('0x74')],_0x5dde2c[_0x5e01('0x6f')]['toUpperCase']())){try{_0x5dde2c['body']=_0x5679d5['rawBody']?JSON[_0x5e01('0x75')](_0x5679d5[_0x5e01('0xa')]):{};}catch(_0x37bd2b){logger[_0x5e01('0x2e')](_0x5e01('0x76'),_0x37bd2b);}}try{_0x5dde2c[_0x5e01('0x77')]=_0x5679d5[_0x5e01('0x78')]?JSON['parse'](_0x5679d5[_0x5e01('0x78')]):{};}catch(_0x57dbcf){logger[_0x5e01('0x2e')](_0x5e01('0x79'),_0x57dbcf);}if(_0x5679d5[_0x5e01('0x7a')]){try{var _0x41111c=require(_0x5679d5[_0x5e01('0x7a')])[_0x5e01('0x7b')](this,_0x5dde2c);_0x5dde2c[_0x5e01('0x7c')]=Mustache['render'](_0x5679d5[_0x5e01('0x6e')],_0x41111c,{},['$$','$$']);if(_0x5dde2c[_0x5e01('0x77')]){_0x5dde2c[_0x5e01('0x77')]=JSON[_0x5e01('0x75')](Mustache[_0x5e01('0x7d')](JSON[_0x5e01('0x7e')](_0x5dde2c[_0x5e01('0x77')]),_0x41111c,{},['$$','$$']));}if(_0x5dde2c[_0x5e01('0x7f')]){_0x5dde2c[_0x5e01('0x7f')]=JSON[_0x5e01('0x75')](Mustache[_0x5e01('0x7d')](JSON[_0x5e01('0x7e')](_0x5dde2c[_0x5e01('0x7f')]),_0x41111c,{},['$$','$$']));}}catch(_0x34b59c){logger[_0x5e01('0x2e')](_0x5e01('0x80'),_0x34b59c);}}rp(_0x5dde2c)[_0x5e01('0x1b')](function(_0x49d460){var _0x373a8c={'statusCode':_0x49d460[_0x5e01('0x81')]||0xc8,'statusMessage':_0x49d460[_0x5e01('0x82')]||'OK','headers':_0x49d460[_0x5e01('0x77')]||{},'body':_0x49d460['body']||{}};_0x132fa6(null,_0x373a8c);})[_0x5e01('0x14')](function(_0x37b942){var _0x1975a5={'statusCode':_0x37b942[_0x5e01('0x81')]||0x1f4,'statusMessage':_0x37b942['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x37b942['options'][_0x5e01('0x77')]||{},'body':_0x37b942[_0x5e01('0x83')][_0x5e01('0x7f')]||{}};_0x132fa6(null,_0x1975a5);});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x84')]=function(_0x5a0c1e,_0xf60b51){scripts[_0x5e01('0x84')](this['channel'][_0x5e01('0x38')],_0x5a0c1e[_0x5e01('0x85')],_0x5a0c1e['text'],_0x5a0c1e[_0x5e01('0x86')]||'en')[_0x5e01('0x1b')](function(_0x5c4366){_0xf60b51(null,_0x5c4366);})[_0x5e01('0x14')](function(_0x50721e){_0xf60b51(_0x50721e);});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x87')]=function(_0x251d61,_0x222c15){scripts['googleDialogflowV2'](this[_0x5e01('0xe')][_0x5e01('0x38')],_0x251d61[_0x5e01('0x88')],_0x251d61[_0x5e01('0x89')],_0x251d61['private_key'],_0x251d61[_0x5e01('0x65')],_0x251d61[_0x5e01('0x8a')]||'en')[_0x5e01('0x1b')](function(_0x194725){_0x222c15(null,_0x194725);})[_0x5e01('0x14')](function(_0x4158f0){_0x222c15(_0x4158f0);});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x8b')]=function(_0x363169,_0x1c6920){scripts[_0x5e01('0x8b')](this[_0x5e01('0xe')],_0x363169)[_0x5e01('0x1b')](function(_0x5e4d52){_0x1c6920(null,_0x5e4d52);})[_0x5e01('0x14')](function(_0x46dbe1){_0x1c6920(_0x46dbe1);});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x8c')]=function(_0x595dec,_0x5c40e4){scripts[_0x5e01('0x8c')](_0x595dec[_0x5e01('0x85')],_0x595dec[_0x5e01('0x65')],_0x595dec[_0x5e01('0x8d')]||_0x5e01('0x66'),_0x595dec[_0x5e01('0x8e')])['then'](function(_0x405daf){_0x5c40e4(null,_0x405daf);})[_0x5e01('0x14')](function(_0x34f5d8){_0x5c40e4(_0x34f5d8);});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x8f')]=function(_0x50b9be,_0x385efe,_0x554f8a){scripts[_0x5e01('0x8f')](_0x385efe,_0x50b9be[_0x5e01('0x85')],_0x50b9be[_0x5e01('0x90')]||'en-US',this['isConfigured'](_0x50b9be[_0x5e01('0x91')])?_0x50b9be[_0x5e01('0x91')]:undefined)[_0x5e01('0x1b')](function(_0x2afc2d){_0x554f8a(null,_0x2afc2d);})[_0x5e01('0x14')](function(_0x57c02e){_0x554f8a(_0x57c02e);});};AGIVertices[_0x5e01('0x15')][_0x5e01('0x92')]=function(_0x3eee62,_0x544f02){scripts[_0x5e01('0x92')](_0x3eee62['aws_access_key_id'],_0x3eee62[_0x5e01('0x93')],_0x3eee62[_0x5e01('0x94')],_0x3eee62[_0x5e01('0x95')]||_0x5e01('0x96'),_0x3eee62['text'],_0x3eee62[_0x5e01('0x97')]||'text')[_0x5e01('0x1b')](function(_0x525023){_0x544f02(null,_0x525023);})['catch'](function(_0x57445f){_0x544f02(_0x57445f);});};AGIVertices[_0x5e01('0x15')]['awsLex']=function(_0x3a205f,_0x3786fd){scripts[_0x5e01('0x98')](this[_0x5e01('0xe')][_0x5e01('0x38')],_0x3a205f[_0x5e01('0x99')],_0x3a205f['aws_secret_access_key'],_0x3a205f[_0x5e01('0x9a')],_0x3a205f[_0x5e01('0x65')],_0x3a205f[_0x5e01('0x9b')])[_0x5e01('0x1b')](function(_0x3df937){_0x3786fd(null,_0x3df937);})[_0x5e01('0x14')](function(_0x2cb032){_0x3786fd(_0x2cb032);});};AGIVertices['prototype']['googleASR']=function(_0x63175f,_0x325d2a,_0x182eec){scripts[_0x5e01('0x9c')](_0x325d2a,_0x63175f[_0x5e01('0x85')],_0x63175f[_0x5e01('0x9d')]||_0x5e01('0x66'))[_0x5e01('0x1b')](function(_0x1a46a1){_0x182eec(null,_0x1a46a1);})[_0x5e01('0x14')](function(_0x1a8266){_0x182eec(_0x1a8266);});};AGIVertices['prototype']['tildeASR']=function(_0x3aab65,_0x1a2e79,_0x3705ff){scripts[_0x5e01('0x9e')](_0x1a2e79,_0x3aab65[_0x5e01('0x9f')],_0x3aab65['appsecret'],_0x3aab65[_0x5e01('0x7c')])['then'](function(_0x4f2885){_0x3705ff(null,_0x4f2885);})[_0x5e01('0x14')](function(_0xfd25b8){_0x3705ff(_0xfd25b8);});};AGIVertices[_0x5e01('0x15')]['clear']=function(_0x2a8f55){var _0x9ef976=_['includes'](verticesWithRetry,_0x2a8f55[_0x5e01('0x3a')])?_0x2a8f55:_[_0x5e01('0xa0')](_0x2a8f55);for(var _0x2e5283 in _0x9ef976){if(_0x9ef976['hasOwnProperty'](_0x2e5283)){if(_0x9ef976[_0x2e5283]&&_[_0x5e01('0xa1')](_0x9ef976[_0x2e5283])){if(_[_0x5e01('0x72')](recursiveMapAttributes,_0x2e5283)){_0x9ef976[_0x2e5283]=this[_0x5e01('0xa2')](_0x9ef976[_0x2e5283]);}else{_0x9ef976[_0x2e5283]=this['replaceAllVariables'](_0x9ef976[_0x2e5283]);}}}}return _0x9ef976;};AGIVertices[_0x5e01('0x15')]['recursiveNodeIndex']=function(_0x21773d){for(var _0x115286 in _0x21773d){if(_0x21773d[_0x5e01('0xa3')](_0x115286)){if(_[_0x5e01('0xa4')](_0x21773d[_0x115286])){this['recursiveNodeIndex'](_0x21773d[_0x115286]);}else if(_[_0x5e01('0xa5')](_0x21773d[_0x115286])){for(var _0x322926=0x0;_0x322926<_0x21773d[_0x115286][_0x5e01('0xa6')];_0x322926++){this[_0x5e01('0xa7')](_0x21773d[_0x115286][_0x322926]);}}else if(_[_0x5e01('0xa1')](_0x21773d[_0x115286])){_0x21773d[_0x115286]=this[_0x5e01('0xa8')](_0x21773d[_0x115286]);}}}};AGIVertices[_0x5e01('0x15')][_0x5e01('0xa9')]=function(_0xf05f4f,_0x535a75){for(var _0x283e81 in _0xf05f4f){if(_0xf05f4f[_0x5e01('0xa3')](_0x283e81)){if(_[_0x5e01('0xa4')](_0xf05f4f[_0x283e81])){if(!_[_0x5e01('0xaa')](_0xf05f4f[_0x283e81])){this[_0x5e01('0xa9')](_0xf05f4f[_0x283e81],util[_0x5e01('0x2a')](_0x5e01('0xab'),_0x535a75,_0x283e81));}}else if(_['isArray'](_0xf05f4f[_0x283e81])){for(var _0x5aa19f=0x0;_0x5aa19f<_0xf05f4f[_0x283e81][_0x5e01('0xa6')];_0x5aa19f++){this['saveRestApiResult'](_0xf05f4f[_0x283e81][_0x5aa19f],util[_0x5e01('0x2a')](_0x5e01('0xab'),_0x535a75,_0x283e81+'['+_0x5aa19f+']'));}}else{if(!_[_0x5e01('0x46')](_0xf05f4f[_0x283e81])){this[_0x5e01('0xe')][_0x5e01('0xac')](util['format'](_0x5e01('0xab'),_0x535a75,_0x283e81),_0xf05f4f[_0x283e81]);}}}}};AGIVertices[_0x5e01('0x15')][_0x5e01('0xa2')]=function(_0x4fac88){try{var _0x45a485=JSON[_0x5e01('0x75')](_0x4fac88);this[_0x5e01('0xa7')](_0x45a485);return JSON[_0x5e01('0x7e')](_0x45a485);}catch(_0x2f30b5){return this['replaceAllVariables'](_0x4fac88);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x29c7ce){var _0x1fc2e7=_0x29c7ce[_0x5e01('0xad')]('{');for(var _0x13bda5=0x1;_0x13bda5<_0x1fc2e7['length'];_0x13bda5+=0x1){var _0x522d12=_0x1fc2e7[_0x13bda5]['split']('}');if(_0x522d12['length']>0x1){_0x29c7ce=_0x29c7ce['replaceAll']('{'+_0x522d12[0x0]+'}',this[_0x5e01('0xe')][_0x5e01('0x10')](_0x522d12[0x0])[_0x5e01('0xae')]||_0x522d12[0x0]);}}if(_0x1fc2e7[_0x5e01('0xa6')]===0x1){return _0x29c7ce[_0x5e01('0x4d')]();}return this[_0x5e01('0xa8')](_0x29c7ce);};AGIVertices[_0x5e01('0x15')][_0x5e01('0xaf')]=function(_0x156043,_0x40c404){var _0x4a5f40=this['channel']['getVariable'](_0x156043);if(_0x4a5f40[_0x5e01('0xb0')]===-0x1){return _0x4a5f40;}logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0xb1'),_0x40c404,_0x4a5f40['extra']));return this[_0x5e01('0xe')][_0x5e01('0xac')](_0x40c404,_0x4a5f40[_0x5e01('0xae')]);};AGIVertices[_0x5e01('0x15')][_0x5e01('0xb2')]=function(_0xe3c6c5){return _0xe3c6c5&&_0xe3c6c5!=='0'&&_0xe3c6c5!=='-1'&&_0xe3c6c5!=='';};AGIVertices['prototype'][_0x5e01('0xb3')]=function(_0x5c5d85){this[_0x5e01('0x37')]['sync'](this,_0x5c5d85,'-');_0x5c5d85[_0x5e01('0xb4')]=_0x5c5d85[_0x5e01('0xb3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5e01('0x15')][_0x5e01('0xb5')]=function(_0x1fc493){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0xb6'),_0x1fc493[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x1fc493[_0x5e01('0x65')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')]('no\x20text\x20configured');}var _0xabfa09='\x22'+_0x1fc493[_0x5e01('0x65')]+'\x22';if(this[_0x5e01('0xb2')](_0x1fc493[_0x5e01('0x83')])){_0xabfa09+=','+_0x1fc493[_0x5e01('0x83')];}var _0x264e2b=this[_0x5e01('0xe')][_0x5e01('0x60')](_0x5e01('0xb8'),_0xabfa09);if(_0x264e2b[_0x5e01('0xb0')]===-0x1){return _0x264e2b;}return this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0xb9'),_0xabfa09));};AGIVertices[_0x5e01('0x15')][_0x5e01('0xba')]=function(_0x4348df){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0xbb'),_0x4348df[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x4348df[_0x5e01('0xbc')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0xbd'));}var _0x104af5=_0x4348df[_0x5e01('0xbc')];if(this[_0x5e01('0xb2')](_0x4348df['options'])){_0x104af5+=','+_0x4348df[_0x5e01('0x83')];}var _0x493a29=this[_0x5e01('0xe')][_0x5e01('0x60')]('MRCPRecog',_0x104af5);if(_0x493a29[_0x5e01('0xb0')]===-0x1){return _0x493a29;}var _0x5b119d=this[_0x5e01('0xaf')](_0x5e01('0xbe'),'MRCP_RECOG_CONFIDENCE');if(_0x5b119d[_0x5e01('0xb0')]===-0x1){return _0x5b119d;}var _0x2b8694=this['getAndSetVariable'](_0x5e01('0xbf'),_0x5e01('0xc0'));if(_0x2b8694[_0x5e01('0xb0')]===-0x1){return _0x2b8694;}var _0x50609b=this['getAndSetVariable'](_0x5e01('0xc1'),_0x5e01('0xc2'));if(_0x50609b[_0x5e01('0xb0')]===-0x1){return _0x50609b;}return this['channel'][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0xc3'),_0x104af5));};AGIVertices[_0x5e01('0x15')][_0x5e01('0x7')]=function(_0x1bd365){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0xc4'),_0x1bd365[_0x5e01('0x39')]));return this[_0x5e01('0xe')][_0x5e01('0x7')]([_0x1bd365[_0x5e01('0xc5')],_0x1bd365['args']]);};AGIVertices[_0x5e01('0x15')]['answer']=function(_0x578000){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x578000[_0x5e01('0x39')]));if(this['isConfigured'](_0x578000['timeout'])){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0xc6'),_0x578000[_0x5e01('0x71')]));var _0x559a2d=this[_0x5e01('0xe')][_0x5e01('0xc7')](_0x578000[_0x5e01('0x71')]);if(_0x559a2d[_0x5e01('0xb0')]===-0x1){return _0x559a2d;}}return this[_0x5e01('0xe')][_0x5e01('0xc8')]();};AGIVertices[_0x5e01('0x15')][_0x5e01('0x4c')]=function(_0x57bca7){logger[_0x5e01('0x31')](util['format'](_0x5e01('0xc9'),_0x57bca7[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x57bca7[_0x5e01('0xca')])){return this['channel'][_0x5e01('0x2e')](_0x57bca7,_0x5e01('0xcb'));}_0x57bca7['scheduledAt']=moment();if(this['isConfigured'](_0x57bca7[_0x5e01('0xcc')])){_0x57bca7[_0x5e01('0x4b')]=moment()['add'](_0x57bca7['delay'],_0x5e01('0x56'));}if(!this[_0x5e01('0xb2')](_0x57bca7[_0x5e01('0x4e')])){_0x57bca7[_0x5e01('0x4e')]=0x2;}this['createCmContact'][_0x5e01('0x7b')](this,_0x57bca7);return this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0xcd'),_0x57bca7[_0x5e01('0x4a')],_0x57bca7[_0x5e01('0xca')],_0x57bca7['scheduledAt']));};AGIVertices[_0x5e01('0x15')][_0x5e01('0xce')]=function(_0x2cb4a7){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0xcf'),_0x2cb4a7['label']));var _0xa1e2fe=this[_0x5e01('0xe')][_0x5e01('0x60')](_0x2cb4a7[_0x5e01('0xd0')],_0x2cb4a7[_0x5e01('0x83')]);if(_0xa1e2fe[_0x5e01('0xb0')]===-0x1){return _0xa1e2fe;}return this[_0x5e01('0xe')]['noop'](util[_0x5e01('0x2a')]('Executed\x20command\x20%s\x20%s',_0x2cb4a7['application'],_0x2cb4a7[_0x5e01('0x83')]));};AGIVertices[_0x5e01('0x15')]['lumenvoxtts']=function(_0x25cd7c){logger[_0x5e01('0x31')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x25cd7c[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x25cd7c[_0x5e01('0x65')])){return this[_0x5e01('0xe')]['noop'](_0x5e01('0xd1'));}var _0x5484e3='\x22'+_0x25cd7c[_0x5e01('0x65')]+'\x22';if(this[_0x5e01('0xb2')](_0x25cd7c[_0x5e01('0x83')])){_0x5484e3+=','+_0x25cd7c[_0x5e01('0x83')];}var _0x5825f5=this[_0x5e01('0xe')][_0x5e01('0x60')](_0x5e01('0xb8'),_0x5484e3);if(_0x5825f5[_0x5e01('0xb0')]===-0x1){return _0x5825f5;}return this[_0x5e01('0xe')][_0x5e01('0xb7')](util['format'](_0x5e01('0xb9'),_0x5484e3));};AGIVertices[_0x5e01('0x15')]['sestektts']=function(_0x4ef8c2){logger['info'](util[_0x5e01('0x2a')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x4ef8c2[_0x5e01('0x39')]));if(!this['isConfigured'](_0x4ef8c2[_0x5e01('0x65')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')]('no\x20text\x20configured');}var _0x375cdb='\x22'+_0x4ef8c2[_0x5e01('0x65')]+'\x22';if(this[_0x5e01('0xb2')](_0x4ef8c2[_0x5e01('0x83')])){_0x375cdb+=','+_0x4ef8c2['options'];}var _0xe66edd=this['channel'][_0x5e01('0x60')](_0x5e01('0xb8'),_0x375cdb);if(_0xe66edd[_0x5e01('0xb0')]===-0x1){return _0xe66edd;}return this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0xb9'),_0x375cdb));};AGIVertices[_0x5e01('0x15')][_0x5e01('0xd2')]=function(_0x2e822c){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0xd3'),_0x2e822c[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x2e822c[_0x5e01('0xbc')])){return this['channel'][_0x5e01('0xb7')]('no\x20grammar\x20configured');}var _0x201158=_0x2e822c['grammar'];if(this[_0x5e01('0xb2')](_0x2e822c['options'])){_0x201158+=','+_0x2e822c[_0x5e01('0x83')];}var _0x3529e1=this[_0x5e01('0xe')][_0x5e01('0x60')](_0x5e01('0xd4'),_0x201158);if(_0x3529e1[_0x5e01('0xb0')]===-0x1){return _0x3529e1;}var _0x267649=this[_0x5e01('0xaf')](_0x5e01('0xbe'),_0x5e01('0xd5'));if(_0x267649[_0x5e01('0xb0')]===-0x1){return _0x267649;}var _0x3c786d=this[_0x5e01('0xaf')](_0x5e01('0xbf'),_0x5e01('0xd6'));if(_0x3c786d['result']===-0x1){return _0x3c786d;}var _0x35cec=this[_0x5e01('0xaf')](_0x5e01('0xc1'),_0x5e01('0xd7'));if(_0x35cec[_0x5e01('0xb0')]===-0x1){return _0x35cec;}return this['channel']['noop'](util[_0x5e01('0x2a')](_0x5e01('0xc3'),_0x201158));};AGIVertices[_0x5e01('0x15')]['sestekasr']=function(_0x48904f){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x48904f['label']));if(!this['isConfigured'](_0x48904f[_0x5e01('0xbc')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0xbd'));}var _0x179131=_0x48904f[_0x5e01('0xbc')];if(this[_0x5e01('0xb2')](_0x48904f[_0x5e01('0x83')])){_0x179131+=','+_0x48904f[_0x5e01('0x83')];}var _0x1d54d0=this[_0x5e01('0xe')][_0x5e01('0x60')](_0x5e01('0xd4'),_0x179131);if(_0x1d54d0[_0x5e01('0xb0')]===-0x1){return _0x1d54d0;}var _0xabb037=this[_0x5e01('0xaf')]('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0xabb037[_0x5e01('0xb0')]===-0x1){return _0xabb037;}var _0x217ad3=this['getAndSetVariable'](_0x5e01('0xbf'),'SESTEK_ASR_TRANSCRIPT');if(_0x217ad3['result']===-0x1){return _0x217ad3;}var _0x147820=this[_0x5e01('0xaf')]('RECOG_INSTANCE()',_0x5e01('0xd8'));if(_0x147820[_0x5e01('0xb0')]===-0x1){return _0x147820;}return this['channel'][_0x5e01('0xb7')](util[_0x5e01('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x179131));};AGIVertices['prototype']['database']=function(_0x22ff9c){logger['info'](util[_0x5e01('0x2a')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x22ff9c['label']));if(!this[_0x5e01('0xb2')](_0x22ff9c[_0x5e01('0xd9')])){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x22ff9c,_0x5e01('0xda'));}var _0x271b1b=this[_0x5e01('0x19')][_0x5e01('0x7b')](this,_0x22ff9c[_0x5e01('0xd9')]);if(!_0x271b1b){return this['channel']['error'](_0x22ff9c,_0x5e01('0xdb'));}if(!this['isConfigured'](_0x22ff9c[_0x5e01('0xdc')])){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x22ff9c,_0x5e01('0xdd'));}var _0x597ce1=_0x22ff9c[_0x5e01('0xdc')][_0x5e01('0x62')](/(\r\n|\n|\r)/gm,'\x20');this[_0x5e01('0xe')][_0x5e01('0xb7')](util['format']('query:\x20%s',_0x597ce1));var _0x3e5490=this[_0x5e01('0x2c')][_0x5e01('0x7b')](this,_0x271b1b,_0x597ce1);this['createSquareDetailsReport'][_0x5e01('0x7b')](this,_0x22ff9c,_0x597ce1);if(!this[_0x5e01('0xb2')](_0x22ff9c[_0x5e01('0xde')])){return this['channel']['noop'](_0x5e01('0xdf'));}var _0x3d94ee=this[_0x5e01('0x10')][_0x5e01('0x7b')](this,_0x22ff9c[_0x5e01('0xde')]);if(!_0x3d94ee){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x22ff9c,_0x5e01('0xe0'));}var _0x11ef67=this;_0x3e5490['forEach'](function(_0x428428,_0x40cb97){Object[_0x5e01('0xe1')](_0x428428)[_0x5e01('0xe2')](function(_0x26caf8){_0x11ef67['channel'][_0x5e01('0xac')](util[_0x5e01('0x2a')](_0x5e01('0xe3'),_0x3d94ee,_0x40cb97,_0x26caf8),_0x428428[_0x26caf8]);});});this[_0x5e01('0xe')][_0x5e01('0xac')](util[_0x5e01('0x2a')]('%s_ROWS_COUNT',_0x3d94ee),_0x3e5490[_0x5e01('0xa6')]);return this[_0x5e01('0xe')][_0x5e01('0xb7')](util['format']('variable\x20%s\x20set',_0x3d94ee));};AGIVertices[_0x5e01('0x15')][_0x5e01('0xe4')]=function(_0x34e8b0){logger['debug'](util['format'](_0x5e01('0xe5'),_0x34e8b0['label']));if(!this[_0x5e01('0xb2')](_0x34e8b0[_0x5e01('0xe6')])){return this['channel'][_0x5e01('0x2e')](_0x34e8b0,'no\x20user\x20selected');}var _0x4cdf8b=this[_0x5e01('0x1c')][_0x5e01('0x7b')](this,_0x34e8b0[_0x5e01('0xe6')]);if(!_0x4cdf8b){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x34e8b0,_0x5e01('0xe7'));}var _0x2bb8f6=this['channel'][_0x5e01('0x60')](_0x5e01('0xe8'),[util['format'](_0x5e01('0xe9'),_0x4cdf8b),_0x34e8b0[_0x5e01('0x71')],_0x34e8b0[_0x5e01('0xea')],_0x34e8b0['url']]);if(_0x2bb8f6['result']===-0x1){return _0x2bb8f6;}return this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0xeb'),_0x5e01('0xe8')));};AGIVertices[_0x5e01('0x15')]['dialogflow']=function(_0x194724){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0xec'),_0x194724[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x194724['key'])){return this[_0x5e01('0xe')][_0x5e01('0xb7')]('no\x20key\x20configured');}if(!this[_0x5e01('0xb2')](_0x194724[_0x5e01('0x65')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0xd1'));}this[_0x5e01('0xe')][_0x5e01('0xed')]=!![];this['createSquareDetailsReport'](_0x194724);this[_0x5e01('0x44')](_0x194724[_0x5e01('0x65')],'in','','');this[_0x5e01('0xe')]['noop'](util[_0x5e01('0x2a')](_0x5e01('0xee'),_0x194724[_0x5e01('0x65')]));var _0x1378fd=this['googleDialogflow'][_0x5e01('0x7b')](this,_0x194724);if(_0x1378fd){for(var _0x480947 in _0x1378fd){if(_0x1378fd[_0x5e01('0xa3')](_0x480947)){this['channel'][_0x5e01('0xac')](util[_0x5e01('0x2a')]('DIALOGFLOW_%s',_0x480947[_0x5e01('0xef')]()),_0x1378fd[_0x480947]);}}this['createSquareMessage'](_0x1378fd[_0x5e01('0xf0')],_0x5e01('0xf1'),'dialogflow','');return this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')]('Dialogflow\x20Result\x20%s',_0x1378fd[_0x5e01('0xf0')]));}return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x194724,_0x5e01('0xf2'));};AGIVertices[_0x5e01('0x15')]['dialogflowV2']=function(_0x400c0a){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0xf3'),_0x400c0a[_0x5e01('0x39')]));if(!this['isConfigured'](_0x400c0a[_0x5e01('0x88')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0xf4'));}if(!this[_0x5e01('0xb2')](_0x400c0a[_0x5e01('0x89')])){return this[_0x5e01('0xe')]['noop'](_0x5e01('0xf5'));}if(!this[_0x5e01('0xb2')](_0x400c0a['private_key'])){return this[_0x5e01('0xe')]['noop'](_0x5e01('0xf6'));}if(!this['isConfigured'](_0x400c0a[_0x5e01('0x8a')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0xf7'));}if(!this[_0x5e01('0xb2')](_0x400c0a[_0x5e01('0x65')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0xd1'));}this[_0x5e01('0xe')][_0x5e01('0xed')]=!![];this[_0x5e01('0x37')](_0x400c0a);this[_0x5e01('0x44')](_0x400c0a[_0x5e01('0x65')],'in','','');this['channel'][_0x5e01('0xb7')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x400c0a[_0x5e01('0x65')]));var _0x47f11b=this[_0x5e01('0x87')]['sync'](this,_0x400c0a);if(_0x47f11b){for(var _0x72fad4 in _0x47f11b){if(_0x47f11b[_0x5e01('0xa3')](_0x72fad4)){if(_0x72fad4!=='providerResponse'){this[_0x5e01('0xe')][_0x5e01('0xac')](util[_0x5e01('0x2a')](_0x5e01('0xf8'),_0x72fad4[_0x5e01('0xef')]()),_0x47f11b[_0x72fad4]);}}}this['createSquareMessage'](_0x47f11b[_0x5e01('0xf0')],'out',_0x5e01('0xf9'),_0x47f11b[_0x5e01('0xfa')]);return this['channel'][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0xfb'),_0x47f11b[_0x5e01('0xf0')]));}return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x400c0a,_0x5e01('0xfc'));};AGIVertices[_0x5e01('0x15')][_0x5e01('0xfd')]=function(_0x1efce7){logger[_0x5e01('0x31')](util['format'](_0x5e01('0xfe'),_0x1efce7[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x1efce7[_0x5e01('0xff')])){return this[_0x5e01('0xe')]['noop'](_0x5e01('0x100'));}if(!this[_0x5e01('0xb2')](_0x1efce7[_0x5e01('0x101')])){return this[_0x5e01('0xe')]['noop'](_0x5e01('0x102'));}if(!this[_0x5e01('0xb2')](_0x1efce7[_0x5e01('0x103')])){return this[_0x5e01('0xe')]['noop']('no\x20password\x20configured');}if(!this['isConfigured'](_0x1efce7[_0x5e01('0x104')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0xd1'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x1efce7);this[_0x5e01('0x44')](_0x1efce7['text'],'in','','');this[_0x5e01('0xe')]['noop'](util[_0x5e01('0x2a')](_0x5e01('0x105'),_0x1efce7[_0x5e01('0x65')]));var _0x55f4b1=this[_0x5e01('0x8b')][_0x5e01('0x7b')](this,_0x1efce7);if(_0x55f4b1){for(var _0x5562cb in _0x55f4b1){if(_0x55f4b1[_0x5e01('0xa3')](_0x5562cb)){this[_0x5e01('0xe')][_0x5e01('0xac')](util[_0x5e01('0x2a')](_0x5e01('0x106'),_0x5562cb['toUpperCase']()),_0x55f4b1[_0x5562cb]);}}this[_0x5e01('0x44')](_0x55f4b1[_0x5e01('0xf0')],_0x5e01('0xf1'),_0x5e01('0xfd'),'');if(_0x55f4b1[_0x5e01('0x107')]){this[_0x5e01('0xe')][_0x5e01('0xb7')](util['format'](_0x5e01('0x108'),_0x55f4b1['audiofile']));var _0x4901f6=this[_0x5e01('0xe')]['streamFile'](_0x55f4b1[_0x5e01('0x107')]);try{fs[_0x5e01('0x109')](_0x55f4b1['audiofile']+_0x5e01('0x10a'));}catch(_0x4d9188){logger[_0x5e01('0x2e')](_0x4d9188);}return _0x4901f6;}else{return this[_0x5e01('0xe')]['noop'](util[_0x5e01('0x2a')]('SestekNDA\x20Result\x20%s',_0x55f4b1['speech']));}}return this['channel'][_0x5e01('0x2e')](_0x1efce7,_0x5e01('0x10b'));};AGIVertices[_0x5e01('0x15')]['end']=function(_0x18fceb){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x10c'),_0x18fceb[_0x5e01('0x39')]));return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0x10d'));};AGIVertices['prototype']['ext_dial']=function(_0x11849d){logger['info'](util['format'](_0x5e01('0x10e'),_0x11849d[_0x5e01('0x39')]));var _0x1ac005='';if(_0x11849d[_0x5e01('0x10f')]){if(!this[_0x5e01('0xb2')](_0x11849d[_0x5e01('0x10f')])){return this[_0x5e01('0xe')]['error'](_0x11849d,_0x5e01('0x110'));}else{var _0x44f24d=parseInt(_0x11849d[_0x5e01('0x10f')],0xa);if(isNaN(_0x44f24d)){_0x1ac005=_0x11849d[_0x5e01('0x10f')];}else{_0x1ac005=this[_0x5e01('0x111')][_0x5e01('0x7b')](this,_0x11849d[_0x5e01('0x10f')]);if(!_0x1ac005){return this['channel'][_0x5e01('0x2e')](_0x11849d,_0x5e01('0x112'));}}}}else if(_0x11849d['trunk_name']){_0x1ac005=_0x11849d[_0x5e01('0x113')];}else{return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x11849d,'no\x20trunk\x20selected');}var _0x3fb230=this['channel']['exec'](_0x5e01('0xe8'),[util[_0x5e01('0x2a')](_0x5e01('0x114'),_0x1ac005,_0x11849d['phone']),_0x11849d[_0x5e01('0x71')],_0x11849d[_0x5e01('0xea')],_0x11849d[_0x5e01('0x6e')]]);if(_0x3fb230[_0x5e01('0xb0')]===-0x1){return _0x3fb230;}return this['channel'][_0x5e01('0xb7')](util['format'](_0x5e01('0xeb'),_0x5e01('0xe8')));};AGIVertices[_0x5e01('0x15')][_0x5e01('0x115')]=function(_0x4f98ee){logger['info'](util[_0x5e01('0x2a')](_0x5e01('0x116'),_0x4f98ee[_0x5e01('0x39')]));return this[_0x5e01('0xe')][_0x5e01('0xb7')]('finally');};AGIVertices[_0x5e01('0x15')][_0x5e01('0xc')]=function(_0x3a5710){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x117'),_0x3a5710['label']));if(_0x3a5710[_0x5e01('0xb4')]===0x0){return this[_0x5e01('0xb3')](_0x3a5710);}_0x3a5710['retry']-=0x1;if(!this[_0x5e01('0xb2')](_0x3a5710['file_id'])){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x3a5710,'no\x20file\x20audio\x20selected');}var _0xdd9b7f=this[_0x5e01('0x1e')]['sync'](this,_0x3a5710[_0x5e01('0x118')]);if(!_0xdd9b7f){return this[_0x5e01('0xe')]['error'](_0x3a5710,_0x5e01('0x119'));}if(!this[_0x5e01('0xb2')](_0x3a5710[_0x5e01('0xde')])){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x5e01('0xdf'));}var _0x31a564=this[_0x5e01('0xe')][_0x5e01('0x11a')](_0xdd9b7f,_0x3a5710[_0x5e01('0x11b')],_0x3a5710['maxdigit']);var _0x404be9=_0x31a564[_0x5e01('0xb0')]?_0x31a564[_0x5e01('0xb0')][_0x5e01('0x4d')]():'';logger[_0x5e01('0x31')](_0x5e01('0x11c'),JSON[_0x5e01('0x7e')](_0x31a564));if(_0x31a564[_0x5e01('0xb0')]===-0x1){this[_0x5e01('0x37')]['sync'](this,_0x3a5710,_0x404be9);return _0x31a564;}else if(_0x31a564[_0x5e01('0xae')]==='timeout'){_0x31a564['result']=_0x404be9[_0x5e01('0xa6')]>=parseInt(_0x3a5710[_0x5e01('0x11d')])?'x':'i';}else{_0x31a564[_0x5e01('0xb0')]=_0x404be9[_0x5e01('0xa6')]>=parseInt(_0x3a5710['mindigit'])&&_0x404be9[_0x5e01('0xa6')]<=parseInt(_0x3a5710[_0x5e01('0x11e')])?'x':'i';}var _0x7cf07a=this[_0x5e01('0x10')]['sync'](this,_0x3a5710[_0x5e01('0xde')]);if(!_0x7cf07a){return this['channel'][_0x5e01('0x2e')](_0x3a5710,_0x5e01('0xe0'));}this[_0x5e01('0xe')][_0x5e01('0xac')](_0x7cf07a,_0x404be9);if(this['isConfigured'](_0x3a5710['hiddendigitsnum'])){var _0x422c8c=parseInt(_0x3a5710['hiddendigitsnum'],0xa);var _0x56cd77=rs[_0x5e01('0x11f')]({'charset':'*','length':_0x422c8c});var _0x45c852=_0x404be9[_0x5e01('0xa6')];if(_0x45c852>0x0){if(_0x45c852>_0x422c8c){this[_0x5e01('0x37')][_0x5e01('0x7b')](this,_0x3a5710,_0x3a5710[_0x5e01('0x120')]==='first'?_0x56cd77+_0x404be9['substr'](_0x422c8c):_0x404be9[_0x5e01('0x121')](0x0,_0x45c852-_0x422c8c)+_0x56cd77);}else{this[_0x5e01('0x37')][_0x5e01('0x7b')](this,_0x3a5710,rs[_0x5e01('0x11f')]({'charset':'*','length':_0x45c852}));}}else{this[_0x5e01('0x37')]['sync'](this,_0x3a5710,'');}}else{this[_0x5e01('0x37')][_0x5e01('0x7b')](this,_0x3a5710,_0x404be9);}return _0x31a564;};AGIVertices[_0x5e01('0x15')]['getsecretdigits']=function(_0x33ba5a){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x122'),_0x33ba5a[_0x5e01('0x39')]));return this[_0x5e01('0xc')](_0x33ba5a);};AGIVertices['prototype'][_0x5e01('0x123')]=function(_0x380601){logger[_0x5e01('0x31')](util['format'](_0x5e01('0x124'),_0x380601['label']));this[_0x5e01('0x37')][_0x5e01('0x7b')](this,_0x380601,_0x380601[_0x5e01('0x125')]);return this['channel'][_0x5e01('0xb7')](util['format']('GOAL\x20%s',_0x380601[_0x5e01('0x125')]));};AGIVertices[_0x5e01('0x15')][_0x5e01('0x126')]=function(_0x4c33e4){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x127'),_0x4c33e4[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x4c33e4[_0x5e01('0x99')])||!this[_0x5e01('0xb2')](_0x4c33e4[_0x5e01('0x93')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0x128'));}if(!this[_0x5e01('0xb2')](_0x4c33e4[_0x5e01('0x65')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0xd1'));}this['channel'][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x129'),_0x4c33e4[_0x5e01('0x65')]));var _0x14a4b5=this[_0x5e01('0x92')][_0x5e01('0x7b')](this,_0x4c33e4);if(_0x14a4b5){this[_0x5e01('0xe')]['noop'](util['format'](_0x5e01('0x12a'),_0x14a4b5));var _0x44b140=this[_0x5e01('0xe')][_0x5e01('0x12b')](_0x14a4b5);try{fs[_0x5e01('0x109')](_0x14a4b5+'.wav');}catch(_0x13293d){logger[_0x5e01('0x2e')](_0x13293d);}return _0x44b140;}return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x4c33e4,_0x5e01('0x12c'));};AGIVertices[_0x5e01('0x15')][_0x5e01('0x12d')]=function(_0x304e1f){logger[_0x5e01('0x31')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x304e1f['label']));if(!this[_0x5e01('0xb2')](_0x304e1f['aws_access_key_id'])||!this[_0x5e01('0xb2')](_0x304e1f[_0x5e01('0x93')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0x128'));}if(!this[_0x5e01('0xb2')](_0x304e1f[_0x5e01('0x9b')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0x12e'));}if(!this[_0x5e01('0xb2')](_0x304e1f['text'])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0xd1'));}this[_0x5e01('0xe')][_0x5e01('0xed')]=!![];this[_0x5e01('0x37')](_0x304e1f);this[_0x5e01('0x44')](_0x304e1f[_0x5e01('0x65')],'in','','');this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')]('Trying\x20Amazon\x20Lex:\x20%s',_0x304e1f['text']));var _0x656440=this[_0x5e01('0x98')][_0x5e01('0x7b')](this,_0x304e1f);if(_0x656440){for(var _0x468fba in _0x656440){if(_0x656440['hasOwnProperty'](_0x468fba)&&_['isString'](_0x656440[_0x468fba])){this[_0x5e01('0xe')]['setVariable'](util[_0x5e01('0x2a')]('AWS_LEX_%s',_0x468fba[_0x5e01('0xef')]()),_0x656440[_0x468fba]);}}if(_[_0x5e01('0x46')](_0x656440[_0x5e01('0x12f')])){return this['channel'][_0x5e01('0xb7')](_0x5e01('0x130'));}else{this[_0x5e01('0x44')](_0x656440[_0x5e01('0x12f')],_0x5e01('0xf1'),'amazonlex','');return this[_0x5e01('0xe')]['noop'](util[_0x5e01('0x2a')](_0x5e01('0x131'),_0x656440['message']));}}return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x304e1f,_0x5e01('0x132'));};AGIVertices['prototype'][_0x5e01('0x133')]=function(_0x5b82de){logger[_0x5e01('0x31')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5b82de[_0x5e01('0x39')],_0x5b82de[_0x5e01('0x71')]));if(!this[_0x5e01('0xb2')](_0x5b82de[_0x5e01('0x85')])){return this[_0x5e01('0xe')]['noop'](_0x5e01('0x134'));}var _0x56ee3c=_0x5e01('0x135');var _0x22332f=util[_0x5e01('0x2a')](_0x5e01('0x136'),FILES_PATH,rs[_0x5e01('0x11f')](0x4));var _0x465db8=util[_0x5e01('0x2a')](_0x5e01('0xab'),_0x22332f,_0x56ee3c);var _0x3e5d69=!![];if(_0x5b82de['beep']===_0x5e01('0x137')){_0x3e5d69=![];}var _0x3df1a6=this[_0x5e01('0xe')]['recordFile'](_0x22332f,_0x56ee3c,_0x5b82de[_0x5e01('0x138')],_0x5b82de['timeout'],undefined,_0x3e5d69);if(_0x3df1a6[_0x5e01('0xb0')]!==-0x1){this['channel'][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x139'),_0x465db8));var _0x5b06f4=this[_0x5e01('0x9c')][_0x5e01('0x7b')](this,_0x5b82de,_0x465db8);if(_0x5b06f4){for(var _0x198660 in _0x5b06f4){if(_0x5b06f4[_0x5e01('0xa3')](_0x198660)){this['channel']['setVariable'](util[_0x5e01('0x2a')](_0x5e01('0x13a'),_0x198660[_0x5e01('0xef')]()),_0x5b06f4[_0x198660]);}}return this['channel'][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x13b'),JSON[_0x5e01('0x7e')](_0x5b06f4)));}}return _0x3df1a6;};AGIVertices[_0x5e01('0x15')][_0x5e01('0x13c')]=function(_0x231fae){logger[_0x5e01('0x31')](util['format'](_0x5e01('0x13d'),_0x231fae[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x231fae[_0x5e01('0x9f')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')]('no\x20appid\x20configured');}if(!this[_0x5e01('0xb2')](_0x231fae[_0x5e01('0x13e')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0x13f'));}var _0x134bc2='wav';var _0x1b4b47=util[_0x5e01('0x2a')](_0x5e01('0x136'),FILES_PATH,rs[_0x5e01('0x11f')](0x4));var _0x203bea=util[_0x5e01('0x2a')](_0x5e01('0xab'),_0x1b4b47,_0x134bc2);var _0x2a901f=!![];if(_0x231fae[_0x5e01('0x140')]===_0x5e01('0x137')){_0x2a901f=![];}var _0xa9509=this[_0x5e01('0xe')]['recordFile'](_0x1b4b47,_0x134bc2,_0x231fae[_0x5e01('0x138')],_0x231fae[_0x5e01('0x71')],undefined,_0x2a901f);if(_0xa9509[_0x5e01('0xb0')]!==-0x1){this['channel'][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x141'),_0x203bea));var _0xbe2b6c=this['tildeASR'][_0x5e01('0x7b')](this,_0x231fae,_0x203bea);if(_0xbe2b6c){for(var _0x1a0a59 in _0xbe2b6c){if(_0xbe2b6c['hasOwnProperty'](_0x1a0a59)){this[_0x5e01('0xe')][_0x5e01('0xac')](util['format'](_0x5e01('0x142'),_0x1a0a59[_0x5e01('0xef')]()),_0xbe2b6c[_0x1a0a59]);}}return this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x143'),JSON[_0x5e01('0x7e')](_0xbe2b6c)));}}return _0xa9509;};AGIVertices[_0x5e01('0x15')][_0x5e01('0x144')]=function(_0x4680f0){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4680f0[_0x5e01('0x39')]));return this['channel']['continueAt'](_0x4680f0[_0x5e01('0x3f')],_0x4680f0[_0x5e01('0x40')],_0x4680f0[_0x5e01('0x145')]);};AGIVertices[_0x5e01('0x15')][_0x5e01('0x146')]=function(_0x3eda87){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x3eda87[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x3eda87[_0x5e01('0x147')])){return this['channel'][_0x5e01('0x2e')](_0x3eda87,_0x5e01('0x148'));}try{var _0x5e9283=eval(_0x3eda87['condition'])?_0x5e01('0x149'):'false';this['channel']['noop'](util[_0x5e01('0x2a')](_0x5e01('0x14a'),_0x3eda87[_0x5e01('0x147')],_0x5e9283));return{'code':0xc8,'result':_0x5e9283};}catch(_0x21ab23){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x5e01('0x15')][_0x5e01('0x14b')]=function(_0x5329de){logger['info'](util[_0x5e01('0x2a')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5329de['label']));if(!this[_0x5e01('0xb2')](_0x5329de[_0x5e01('0x14c')])){return this[_0x5e01('0xe')]['error'](_0x5329de,'no\x20interval\x20configured');}var _0x5085c7=this[_0x5e01('0x23')][_0x5e01('0x7b')](this,_0x5329de[_0x5e01('0x14c')]);if(!_0x5085c7){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x5329de,_0x5e01('0x14d'));}for(var _0x46bb19=0x0;_0x46bb19<_0x5085c7[_0x5e01('0xa6')];_0x46bb19+=0x1){var _0x29510e=this['channel'][_0x5e01('0x10')](util[_0x5e01('0x2a')](_0x5e01('0x14e'),_0x5085c7[_0x46bb19]));if(_0x29510e[_0x5e01('0xb0')]===-0x1){return _0x29510e;}logger['info'](util[_0x5e01('0x2a')]('IFTIME\x20%s\x20%s',_0x5085c7[_0x46bb19],_0x29510e[_0x5e01('0xae')]));if(_0x29510e[_0x5e01('0xae')]===_0x5e01('0x149')){logger['info'](util['format'](_0x5e01('0x14f'),_0x5085c7[_0x46bb19],_0x5e01('0x149')));this[_0x5e01('0xe')][_0x5e01('0xb7')](util['format']('IFTIME\x20%s\x20%s',_0x5085c7[_0x46bb19],_0x5e01('0x149')));return{'code':0xc8,'result':'true'};}else{logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x14f'),_0x5085c7[_0x46bb19],_0x5e01('0x150')));this[_0x5e01('0xe')]['noop'](util['format'](_0x5e01('0x14f'),_0x5085c7[_0x46bb19],'false'));}}return{'code':0xc8,'result':_0x5e01('0x150')};};AGIVertices[_0x5e01('0x15')][_0x5e01('0x151')]=function(_0x353d8d){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x152'),_0x353d8d[_0x5e01('0x39')]));return this[_0x5e01('0xe')][_0x5e01('0x151')]();};AGIVertices[_0x5e01('0x15')][_0x5e01('0x153')]=function(_0x208544){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x208544[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x208544['key'])){return this[_0x5e01('0xe')]['noop'](_0x5e01('0x134'));}var _0xae4c25=_0x5e01('0x135');var _0x119a0c=util[_0x5e01('0x2a')](_0x5e01('0x136'),FILES_PATH,rs['generate'](0x4));var _0x4b725b=util[_0x5e01('0x2a')]('%s.%s',_0x119a0c,_0xae4c25);var _0x38f2e6=!![];if(_0x208544[_0x5e01('0x140')]===_0x5e01('0x137')){_0x38f2e6=![];}var _0x4e458f=this['channel'][_0x5e01('0x154')](_0x119a0c,_0xae4c25,_0x208544[_0x5e01('0x138')],_0x208544['timeout'],undefined,_0x38f2e6);if(_0x4e458f[_0x5e01('0xb0')]!==-0x1){this[_0x5e01('0xe')]['noop'](util['format'](_0x5e01('0x155'),_0x4b725b));var _0x232a6d=this[_0x5e01('0x8f')][_0x5e01('0x7b')](this,_0x208544,_0x4b725b);if(_0x232a6d){for(var _0x4ba91d in _0x232a6d){if(_0x232a6d[_0x5e01('0xa3')](_0x4ba91d)){this[_0x5e01('0xe')]['setVariable'](util[_0x5e01('0x2a')](_0x5e01('0x156'),_0x4ba91d[_0x5e01('0xef')]()),_0x232a6d[_0x4ba91d]);}}return this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x157'),JSON[_0x5e01('0x7e')](_0x232a6d)));}}return _0x4e458f;};AGIVertices[_0x5e01('0x15')]['ispeechtts']=function(_0xb51abe){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x158'),_0xb51abe[_0x5e01('0x39')]));if(!this['isConfigured'](_0xb51abe[_0x5e01('0x85')])){return this['channel'][_0x5e01('0xb7')]('no\x20key\x20configured');}if(!this['isConfigured'](_0xb51abe[_0x5e01('0x65')])){return this[_0x5e01('0xe')]['noop'](_0x5e01('0xd1'));}this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x159'),_0xb51abe[_0x5e01('0x65')]));var _0x54feff=this[_0x5e01('0x8c')]['sync'](this,_0xb51abe);if(_0x54feff){this['channel'][_0x5e01('0xb7')](util['format'](_0x5e01('0x155'),_0x54feff));var _0x469ece=this['channel']['streamFile'](_0x54feff,_0xb51abe['intKey']);try{fs['unlink'](_0x54feff+'.wav');}catch(_0x4a3f78){logger[_0x5e01('0x2e')](_0x4a3f78);}return _0x469ece;}return this['channel'][_0x5e01('0x2e')](_0xb51abe,_0x5e01('0x15a'));};AGIVertices[_0x5e01('0x15')][_0x5e01('0x15b')]=function(_0xe447a){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xe447a[_0x5e01('0x39')]));if(!this['isConfigured'](_0xe447a[_0x5e01('0x15c')])){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0xe447a,_0x5e01('0x15d'));}logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x15e'),this['channel']['callerid'],_0xe447a[_0x5e01('0x15c')]));var _0x3e7f24=this[_0x5e01('0x15f')]['sync'](this,_0xe447a[_0x5e01('0x15c')]);if(_0x3e7f24){logger['info'](util[_0x5e01('0x2a')](_0x5e01('0x160'),this[_0x5e01('0xe')]['callerid'],_0xe447a['findBy']));this[_0x5e01('0xe')][_0x5e01('0xb7')](util['format'](_0x5e01('0x160'),this[_0x5e01('0xe')]['callerid'],_0xe447a['findBy']));return{'code':0xc8,'result':_0x5e01('0x161')};}else{logger['info'](util[_0x5e01('0x2a')](_0x5e01('0x162'),this[_0x5e01('0xe')][_0x5e01('0x3c')],_0xe447a[_0x5e01('0x15c')]));this[_0x5e01('0xe')]['noop'](util['format'](_0x5e01('0x162'),this[_0x5e01('0xe')][_0x5e01('0x3c')],_0xe447a[_0x5e01('0x15c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x5e01('0x15')]['logout']=function(_0xc8a7d4){logger[_0x5e01('0x31')](util['format'](_0x5e01('0x163'),_0xc8a7d4[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0xc8a7d4['findBy'])){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0xc8a7d4,_0x5e01('0x15d'));}logger[_0x5e01('0x31')](util[_0x5e01('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x5e01('0x3c')],_0xc8a7d4[_0x5e01('0x15c')]));var _0x4e719b=this[_0x5e01('0x5c')][_0x5e01('0x7b')](this,_0xc8a7d4[_0x5e01('0x15c')]);if(_0x4e719b){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5e01('0xe')]['callerid'],_0xc8a7d4[_0x5e01('0x15c')]));this[_0x5e01('0xe')]['noop'](util[_0x5e01('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5e01('0xe')][_0x5e01('0x3c')],_0xc8a7d4[_0x5e01('0x15c')]));return{'code':0xc8,'result':'success'};}else{logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x162'),this[_0x5e01('0xe')]['callerid'],_0xc8a7d4['findBy']));this[_0x5e01('0xe')]['noop'](util[_0x5e01('0x2a')](_0x5e01('0x162'),this[_0x5e01('0xe')][_0x5e01('0x3c')],_0xc8a7d4[_0x5e01('0x15c')]));return{'code':0xc8,'result':_0x5e01('0x164')};}};AGIVertices['prototype'][_0x5e01('0x165')]=function(_0x92448a){logger['info'](util[_0x5e01('0x2a')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x92448a[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x92448a['operation'])){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x92448a,_0x5e01('0x166'));}this[_0x5e01('0xe')]['noop'](util['format']('math\x20%s',_0x92448a[_0x5e01('0x167')]));var _0x1feddb=eval(_0x92448a[_0x5e01('0x167')]);if(!this[_0x5e01('0xb2')](_0x92448a[_0x5e01('0xde')])){return this[_0x5e01('0xe')]['noop'](_0x5e01('0xdf'));}var _0x27d919=this['getVariable']['sync'](this,_0x92448a[_0x5e01('0xde')]);if(!_0x27d919){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x92448a,_0x5e01('0xe0'));}if(_['isArray'](_0x1feddb)){var _0x573e4e=this;_0x1feddb[_0x5e01('0xe2')](function(_0x5dd9ed,_0x174b45){_0x573e4e[_0x5e01('0xe')][_0x5e01('0xac')](util[_0x5e01('0x2a')](_0x5e01('0x168'),_0x27d919,_0x174b45),_0x5dd9ed);});return this[_0x5e01('0xe')]['noop'](util[_0x5e01('0x2a')](_0x5e01('0x169'),_0x27d919));}else{return this[_0x5e01('0xe')][_0x5e01('0xac')](_0x27d919,_0x1feddb);}};AGIVertices[_0x5e01('0x15')][_0x5e01('0xb')]=function(_0x2e044c){logger[_0x5e01('0x31')](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x2e044c[_0x5e01('0x39')]));if(_0x2e044c[_0x5e01('0xb4')]===0x0){return this[_0x5e01('0xb3')](_0x2e044c);}_0x2e044c[_0x5e01('0xb4')]-=0x1;if(!this[_0x5e01('0xb2')](_0x2e044c[_0x5e01('0x118')])){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x2e044c,'no\x20file\x20audio\x20selected');}var _0x3d8c36=this['getSound'][_0x5e01('0x7b')](this,_0x2e044c['file_id']);if(!_0x3d8c36){return this['channel']['error'](_0x2e044c,_0x5e01('0x119'));}var _0xa18dc=this[_0x5e01('0xe')][_0x5e01('0x11a')](_0x3d8c36,_0x2e044c[_0x5e01('0x11b')],_0x2e044c['digit']);var _0x575162=_0xa18dc[_0x5e01('0xb0')];if(_0xa18dc[_0x5e01('0xb0')]===-0x1){this[_0x5e01('0x37')][_0x5e01('0x7b')](this,_0x2e044c,'-1');return _0xa18dc;}else if(_0xa18dc[_0x5e01('0xae')]==='timeout'){_0xa18dc[_0x5e01('0xb0')]=_0xa18dc[_0x5e01('0xb0')][_0x5e01('0xa6')]>0x0?_0xa18dc['result']:'t';}else if(_[_0x5e01('0xaa')](_0xa18dc[_0x5e01('0xb0')])){_0xa18dc['result']='#';_0x575162='#';}if(!this[_0x5e01('0xb2')](_0x2e044c[_0x5e01('0xde')])){this[_0x5e01('0xe')][_0x5e01('0xb7')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x2ff5c7=this[_0x5e01('0x10')][_0x5e01('0x7b')](this,_0x2e044c[_0x5e01('0xde')]);if(!_0x2ff5c7){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x2e044c,_0x5e01('0xe0'));}this['channel'][_0x5e01('0xac')](_0x2ff5c7,_0x575162);}this['createSquareDetailsReport']['sync'](this,_0x2e044c,_0x575162);return _0xa18dc;};AGIVertices[_0x5e01('0x15')][_0x5e01('0xb7')]=function(_0x22a426){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x16a'),_0x22a426[_0x5e01('0x39')]));return this[_0x5e01('0xe')]['noop'](_0x22a426['output']||_0x22a426[_0x5e01('0x39')]);};AGIVertices[_0x5e01('0x15')][_0x5e01('0x16b')]=function(_0x134406){logger['info'](util[_0x5e01('0x2a')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x134406[_0x5e01('0x39')]));if(!this['isConfigured'](_0x134406['findBy'])){return this['channel'][_0x5e01('0x2e')](_0x134406,_0x5e01('0x15d'));}logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x15e'),this['channel'][_0x5e01('0x3c')],_0x134406[_0x5e01('0x15c')]));var _0x57fa0e=this[_0x5e01('0x58')][_0x5e01('0x7b')](this,_0x134406['pause_id']);var _0x21b68e=this[_0x5e01('0x5a')]['sync'](this,_0x134406[_0x5e01('0x15c')],_0x57fa0e);if(_0x21b68e){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x160'),this[_0x5e01('0xe')]['callerid'],_0x134406[_0x5e01('0x15c')]));this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x160'),this[_0x5e01('0xe')][_0x5e01('0x3c')],_0x134406[_0x5e01('0x15c')]));return{'code':0xc8,'result':_0x5e01('0x161')};}else{logger[_0x5e01('0x31')](util[_0x5e01('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x5e01('0x3c')],_0x134406[_0x5e01('0x15c')]));this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x160'),this[_0x5e01('0xe')]['callerid'],_0x134406[_0x5e01('0x15c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x5e01('0x15')][_0x5e01('0x16c')]=function(_0x5de94b){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x5de94b[_0x5e01('0x39')]));if(!this['isConfigured'](_0x5de94b['file_id'])){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x5de94b,_0x5e01('0x16d'));}var _0x3ee8df=this[_0x5e01('0x1e')][_0x5e01('0x7b')](this,_0x5de94b[_0x5e01('0x118')]);if(!_0x3ee8df){return this['channel'][_0x5e01('0x2e')](_0x5de94b,_0x5e01('0x119'));}var _0x4938e2=this[_0x5e01('0xe')]['exec'](_0x5e01('0x16e'),[_0x3ee8df,_0x5de94b[_0x5e01('0xea')]]);if(_0x4938e2['result']===-0x1){return _0x4938e2;}return this['channel'][_0x5e01('0xb7')](util['format']('Executed\x20command\x20%s\x20%s',_0x5e01('0x16e'),_0x3ee8df));};AGIVertices[_0x5e01('0x15')][_0x5e01('0x16f')]=function(_0x27ef7f){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x27ef7f[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x27ef7f[_0x5e01('0x170')])){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x27ef7f,_0x5e01('0x171'));}var _0x245959='';var _0x230833=parseInt(_0x27ef7f['queue_id'],0xa);if(isNaN(_0x230833)){_0x245959=_0x27ef7f[_0x5e01('0x170')];}else{_0x245959=this[_0x5e01('0x16')]['sync'](this,_0x27ef7f[_0x5e01('0x170')]);if(!_0x245959){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x27ef7f,'no\x20queue\x20found');}}var _0x53866f='';if(this['isConfigured'](_0x27ef7f[_0x5e01('0x118')])){var _0x355d65=this['getSound'][_0x5e01('0x7b')](this,_0x27ef7f[_0x5e01('0x118')]);if(_0x355d65){_0x53866f=_0x355d65;}}this[_0x5e01('0x37')][_0x5e01('0x7b')](this,_0x27ef7f,_0x245959);if(_0x27ef7f[_0x5e01('0xea')][_0x5e01('0x172')]('x')<0x0){_0x27ef7f[_0x5e01('0xea')]+='x';}if(_0x27ef7f['opts']['indexOf']('X')<0x0){_0x27ef7f['opts']+='X';}this[_0x5e01('0xe')][_0x5e01('0xac')]('XMCS-QUEUE',_0x245959?_0x245959['toLowerCase']():'');var _0x5a9c0b=this['channel'][_0x5e01('0x60')](_0x5e01('0x173'),[_0x245959,_0x27ef7f['opts'],_0x27ef7f['url'],_0x53866f,_0x27ef7f[_0x5e01('0x71')],_0x27ef7f[_0x5e01('0x7')],_0x27ef7f['macro'],_0x27ef7f['gosub'],'',_0x27ef7f[_0x5e01('0x174')]]);if(_0x5a9c0b[_0x5e01('0xb0')]===-0x1){return _0x5a9c0b;}return this[_0x5e01('0xe')][_0x5e01('0xb7')](util['format'](_0x5e01('0x175'),_0x5e01('0x173'),_0x245959));};AGIVertices['prototype'][_0x5e01('0x176')]=function(_0x489d8c){logger[_0x5e01('0x31')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x489d8c['label']));var _0x13fcab=_0x489d8c[_0x5e01('0x177')]||'wav';var _0x5c454a=util['format']('%s_%s',this[_0x5e01('0xe')][_0x5e01('0x38')],rs[_0x5e01('0x11f')](0x5));var _0x1efbfa=util[_0x5e01('0x2a')]('%s/recordings/%s.%s',FILES_PATH,_0x5c454a,_0x13fcab);var _0x38d989=util['format']('%s/recordings/%s',FILES_PATH,_0x5c454a);this[_0x5e01('0x3d')][_0x5e01('0x7b')](this,_0x489d8c,_0x5c454a,_0x1efbfa);this[_0x5e01('0xe')][_0x5e01('0xac')](_0x5e01('0x178'),_0x5c454a);logger[_0x5e01('0x31')](_0x5e01('0x179'),_0x38d989,_0x13fcab,_0x489d8c[_0x5e01('0x17a')],_0x489d8c['timeout']);return this[_0x5e01('0xe')]['recordFile'](_0x38d989,_0x13fcab,_0x489d8c['escape_digits'],_0x489d8c['timeout'],undefined,!![]);};AGIVertices[_0x5e01('0x15')][_0x5e01('0x17b')]=function(_0x50f690){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x17c'),_0x50f690[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x50f690[_0x5e01('0x6e')])){return this['channel'][_0x5e01('0xb7')](_0x5e01('0x17d'));}var _0x51b087=this['restAPI'][_0x5e01('0x7b')](this,_0x50f690);logger[_0x5e01('0x31')](util[_0x5e01('0x2a')]('Response:',util['inspect'](_0x51b087,{'showHidden':![],'depth':null})));if(!this[_0x5e01('0xb2')](_0x50f690[_0x5e01('0xde')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0x17e'));}var _0x59623f=this[_0x5e01('0x10')][_0x5e01('0x7b')](this,_0x50f690[_0x5e01('0xde')]);if(!_0x59623f){return this['channel'][_0x5e01('0x2e')](_0x50f690,_0x5e01('0xe0'));}this[_0x5e01('0xe')]['setVariable'](util[_0x5e01('0x2a')]('%s_STATUS_CODE',_0x59623f),_0x51b087[_0x5e01('0x81')]?_0x51b087[_0x5e01('0x81')]:_0x5e01('0x17f'));this[_0x5e01('0xe')][_0x5e01('0xac')](util['format'](_0x5e01('0x180'),_0x59623f),_0x51b087[_0x5e01('0x82')]?_0x51b087[_0x5e01('0x82')]:'OK');if(_0x51b087['body']){try{this[_0x5e01('0xa9')](_0x51b087[_0x5e01('0x7f')],_0x59623f);}catch(_0x1642fa){logger['error'](util[_0x5e01('0x2a')](_0x5e01('0x181'),_0x59623f));}}return this['channel'][_0x5e01('0xb7')](util['format'](_0x5e01('0x182'),_0x59623f));};AGIVertices['prototype'][_0x5e01('0x183')]=function(_0x4876aa){logger['info'](util[_0x5e01('0x2a')](_0x5e01('0x184'),_0x4876aa[_0x5e01('0x39')]));return this[_0x5e01('0xe')]['sayDigits'](_0x4876aa['digits'][_0x5e01('0x62')](/\s+/g,''),_0x4876aa[_0x5e01('0x17a')]);};AGIVertices['prototype']['saynumber']=function(_0x277002){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x185'),_0x277002[_0x5e01('0x39')]));return this[_0x5e01('0xe')][_0x5e01('0x186')](_0x277002[_0x5e01('0x70')]['replace'](/\s+/g,''),_0x277002[_0x5e01('0x17a')]);};AGIVertices[_0x5e01('0x15')][_0x5e01('0x187')]=function(_0x2ee264){logger[_0x5e01('0x31')](util['format'](_0x5e01('0x188'),_0x2ee264[_0x5e01('0x39')]));return this[_0x5e01('0xe')][_0x5e01('0x189')](_0x2ee264['text'],_0x2ee264[_0x5e01('0x17a')]);};AGIVertices[_0x5e01('0x15')][_0x5e01('0x18a')]=function(_0x454f71){logger['info'](util[_0x5e01('0x2a')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x454f71[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x454f71['account_id'])){return this[_0x5e01('0xe')]['noop']('no\x20mail\x20account\x20configured');}var _0x58eb37=this[_0x5e01('0x20')][_0x5e01('0x7b')](this,_0x454f71[_0x5e01('0x18b')]);if(!_0x58eb37||!_0x58eb37[_0x5e01('0x18c')]){return this[_0x5e01('0xe')]['error'](_0x454f71,_0x5e01('0x18d'));}var _0x8326db={'from':util[_0x5e01('0x2a')](_0x5e01('0x18e'),_0x58eb37[_0x5e01('0x13')],_0x58eb37[_0x5e01('0x18f')]||_0x58eb37[_0x5e01('0x18c')][_0x5e01('0x190')]),'to':_0x454f71['to']||'','cc':_0x454f71['cc']||'','bcc':_0x454f71['bcc']||'','subject':_0x454f71[_0x5e01('0x191')],'html':_0x454f71[_0x5e01('0x65')],'text':_0x454f71[_0x5e01('0x65')]};var _0x21bca4={'tls':{'rejectUnauthorized':![]}};if(_0x58eb37['Smtp'][_0x5e01('0x192')]){_0x21bca4[_0x5e01('0x192')]=_0x58eb37['Smtp'][_0x5e01('0x192')];}else{_0x21bca4[_0x5e01('0x193')]=_0x58eb37[_0x5e01('0x18c')][_0x5e01('0x193')];_0x21bca4[_0x5e01('0x194')]=_0x58eb37[_0x5e01('0x18c')][_0x5e01('0x194')];_0x21bca4[_0x5e01('0x195')]=_0x58eb37['Smtp']['secure'];}if(_0x58eb37['Smtp'][_0x5e01('0x196')]){_0x21bca4[_0x5e01('0x197')]={'user':_0x58eb37[_0x5e01('0x18c')][_0x5e01('0x190')],'pass':_0x58eb37[_0x5e01('0x18c')]['pass']};}if(this[_0x5e01('0xb2')](_0x454f71[_0x5e01('0x198')])){}logger[_0x5e01('0x199')](_0x5e01('0x19a'),JSON[_0x5e01('0x7e')](_0x8326db));this['createSquareDetailsReport'][_0x5e01('0x7b')](this,_0x454f71,_0x454f71[_0x5e01('0x18b')]);this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x19b'),_0x58eb37[_0x5e01('0x13')]));this[_0x5e01('0x22')]['sync'](this,_0x21bca4,_0x8326db);return this['channel'][_0x5e01('0xb7')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x5e01('0x15')][_0x5e01('0x19c')]=function(_0x63a17d){logger['info'](util['format'](_0x5e01('0x19d'),_0x63a17d['label']));return this['channel'][_0x5e01('0xb7')](_0x5e01('0x19e'));};AGIVertices[_0x5e01('0x15')][_0x5e01('0x19f')]=function(_0x54573b){logger[_0x5e01('0x31')](util['format'](_0x5e01('0x1a0'),_0x54573b[_0x5e01('0x39')]));if(!this['isConfigured'](_0x54573b[_0x5e01('0x1a1')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0x1a2'));}var _0x4ed363=this['getSmsAccount'][_0x5e01('0x7b')](this,_0x54573b[_0x5e01('0x1a1')]);if(!_0x4ed363){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x54573b,_0x5e01('0x1a3'));}var _0x53d80b={'body':_0x54573b[_0x5e01('0x1a4')],'phone':_0x54573b['to']||'','SmsAccountId':_0x4ed363['id']};logger['debug'](_0x5e01('0x1a5'),JSON[_0x5e01('0x7e')](_0x53d80b));this[_0x5e01('0x37')][_0x5e01('0x7b')](this,_0x54573b,_0x54573b[_0x5e01('0x1a1')]);this['channel'][_0x5e01('0xb7')](util[_0x5e01('0x2a')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x4ed363[_0x5e01('0x13')]));this[_0x5e01('0x36')]['sync'](this,_0x53d80b);return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0x1a6'));};AGIVertices[_0x5e01('0x15')]['set']=function(_0x536fd2){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x1a7'),_0x536fd2['label']));if(!this['isConfigured'](_0x536fd2[_0x5e01('0xde')])){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x536fd2,'no\x20variable\x20selected');}var _0x46297a=this[_0x5e01('0x10')][_0x5e01('0x7b')](this,_0x536fd2[_0x5e01('0xde')]);if(!_0x46297a){return this['channel']['error'](_0x536fd2,_0x5e01('0xe0'));}return this[_0x5e01('0xe')][_0x5e01('0xac')](_0x46297a,_0x536fd2[_0x5e01('0x1a8')]);};AGIVertices[_0x5e01('0x15')][_0x5e01('0x1a9')]=function(_0x24a40f){logger[_0x5e01('0x31')](util['format'](_0x5e01('0x1aa'),_0x24a40f['label']));this['channel']['noop'](_0x5e01('0x1ab'));if(_0x24a40f[_0x5e01('0xc8')]==='yes'){this[_0x5e01('0xe')]['noop'](_0x5e01('0x1ac'));return this['channel'][_0x5e01('0xc8')]();}return this['channel'][_0x5e01('0xb7')](_0x5e01('0x1ad'));};AGIVertices['prototype']['subproject']=function(_0x5726fb){logger[_0x5e01('0x31')](util['format'](_0x5e01('0x1ae'),_0x5726fb['label']));if(!this[_0x5e01('0xb2')](_0x5726fb[_0x5e01('0x1af')])){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x5726fb,'no\x20subproject\x20selected');}var _0x290fb6=this[_0x5e01('0x17')][_0x5e01('0x7b')](this,_0x5726fb[_0x5e01('0x1af')]);if(!this[_0x5e01('0xb2')](_0x290fb6)){return this[_0x5e01('0xe')]['error'](_0x5726fb,util['format'](_0x5e01('0x1b0'),_0x5726fb[_0x5e01('0x1af')]));}if(_0x290fb6===this[_0x5e01('0xe')][_0x5e01('0x3b')]){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x5726fb,_0x5e01('0x1b1'));}this[_0x5e01('0x37')][_0x5e01('0x7b')](this,_0x5726fb,_0x290fb6);var _0x32c081=this['channel'][_0x5e01('0x60')](_0x5e01('0x1b2'),util[_0x5e01('0x2a')](_0x5e01('0x1b3'),config[_0x5e01('0x7')]['host']||_0x5e01('0x1b4'),_0x290fb6,this[_0x5e01('0xe')][_0x5e01('0x3b')]));if(_0x32c081[_0x5e01('0xb0')]===-0x1){return _0x32c081;}return this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x175'),_0x5e01('0x1b2'),_0x290fb6));};AGIVertices['prototype'][_0x5e01('0x1b5')]=function(_0x30bd59){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x1b6'),_0x30bd59[_0x5e01('0x39')]));var _0x28403f=this[_0x5e01('0x5f')]['sync'](this,_0x30bd59['command']);this[_0x5e01('0x37')]['sync'](this,_0x30bd59,_0x30bd59[_0x5e01('0xc5')]);if(this[_0x5e01('0xb2')](_0x30bd59[_0x5e01('0xde')])){var _0x341cd4=this['getVariable'][_0x5e01('0x7b')](this,_0x30bd59[_0x5e01('0xde')]);if(_0x341cd4){this[_0x5e01('0xe')][_0x5e01('0xac')](_0x341cd4,_0x28403f);return this['channel'][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x1b7'),_0x30bd59['command'],_0x341cd4));}}return this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x1b8'),_0x30bd59[_0x5e01('0xc5')]));};AGIVertices['prototype'][_0x5e01('0x1b9')]=function(_0x1d9ff9){logger['info'](util[_0x5e01('0x2a')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1d9ff9['label']));_0x1d9ff9[_0x5e01('0x65')]=_0x1d9ff9['text'][_0x5e01('0x62')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5e01('0xb2')](_0x1d9ff9[_0x5e01('0x63')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0x1ba'));}if(!this[_0x5e01('0xb2')](_0x1d9ff9[_0x5e01('0x65')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')]('no\x20text\x20configured');}this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x1bb'),_0x1d9ff9[_0x5e01('0x65')]));var _0x42b14e=this[_0x5e01('0x1bc')][_0x5e01('0x7b')](this,_0x1d9ff9);if(_0x42b14e){this[_0x5e01('0xe')]['noop'](util[_0x5e01('0x2a')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x42b14e));var _0x45e331=this[_0x5e01('0xe')][_0x5e01('0x12b')](_0x42b14e);try{fs[_0x5e01('0x109')](_0x42b14e+_0x5e01('0x10a'));}catch(_0x21e279){logger[_0x5e01('0x2e')](_0x21e279);}return _0x45e331;}return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x1d9ff9,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x5e01('0x15')]['tts']=function(_0x472976){logger[_0x5e01('0x31')](util['format'](_0x5e01('0x1bd'),_0x472976[_0x5e01('0x39')]));_0x472976[_0x5e01('0x65')]=_0x472976[_0x5e01('0x65')][_0x5e01('0x62')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5e01('0xb2')](_0x472976[_0x5e01('0x65')])){return this[_0x5e01('0xe')][_0x5e01('0xb7')](_0x5e01('0xd1'));}this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')]('Trying\x20Google\x20TTS\x20%s',_0x472976[_0x5e01('0x65')]));var _0x597b15=this[_0x5e01('0x6b')]['sync'](this,_0x472976);if(_0x597b15){this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x1be'),_0x597b15));var _0x387085=this[_0x5e01('0xe')][_0x5e01('0x12b')](_0x597b15);try{fs[_0x5e01('0x109')](_0x597b15+_0x5e01('0x10a'));}catch(_0x97dfa5){logger[_0x5e01('0x2e')](_0x97dfa5);}return _0x387085;}return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x472976,_0x5e01('0x1bf'));};AGIVertices[_0x5e01('0x15')][_0x5e01('0x1c0')]=function(_0x44e408){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x1c1'),_0x44e408[_0x5e01('0x39')]));if(!this['isConfigured'](_0x44e408[_0x5e01('0x15c')])){return this[_0x5e01('0xe')]['error'](_0x44e408,_0x5e01('0x15d'));}logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x15e'),this[_0x5e01('0xe')][_0x5e01('0x3c')],_0x44e408['findBy']));var _0x484429=this[_0x5e01('0x1c2')][_0x5e01('0x7b')](this,_0x44e408[_0x5e01('0x15c')]);if(_0x484429){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x160'),this[_0x5e01('0xe')]['callerid'],_0x44e408['findBy']));this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x160'),this[_0x5e01('0xe')]['callerid'],_0x44e408[_0x5e01('0x15c')]));return{'code':0xc8,'result':_0x5e01('0x161')};}else{logger['info'](util[_0x5e01('0x2a')](_0x5e01('0x162'),this[_0x5e01('0xe')]['callerid'],_0x44e408[_0x5e01('0x15c')]));this['channel']['noop'](util['format'](_0x5e01('0x162'),this[_0x5e01('0xe')][_0x5e01('0x3c')],_0x44e408[_0x5e01('0x15c')]));return{'code':0xc8,'result':_0x5e01('0x164')};}};AGIVertices['prototype'][_0x5e01('0x1c3')]=function(_0x508198){logger[_0x5e01('0x31')](util[_0x5e01('0x2a')](_0x5e01('0x1c4'),_0x508198[_0x5e01('0x39')]));var _0x2babd8=this['channel'][_0x5e01('0x60')]('VOICEMAIL',[_0x508198[_0x5e01('0x1c5')],_0x508198[_0x5e01('0x83')]]);if(_0x2babd8[_0x5e01('0xb0')]===-0x1){return _0x2babd8;}return this[_0x5e01('0xe')][_0x5e01('0xb7')](util[_0x5e01('0x2a')](_0x5e01('0x175'),_0x5e01('0x1c6'),_0x508198['mailbox']));};AGIVertices[_0x5e01('0x15')][_0x5e01('0x1c7')]=function(_0x575529){logger['info'](util[_0x5e01('0x2a')](_0x5e01('0x1c8'),_0x575529[_0x5e01('0x39')]));if(!this[_0x5e01('0xb2')](_0x575529['variable_id'])){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x575529,_0x5e01('0x1c9'));}var _0x5b5412=this['getVariable'][_0x5e01('0x7b')](this,_0x575529[_0x5e01('0xde')]);if(!_0x5b5412){return this[_0x5e01('0xe')][_0x5e01('0x2e')](_0x575529,_0x5e01('0xe0'));}var _0x5291ec=this[_0x5e01('0xe')][_0x5e01('0x10')](_0x5b5412);return{'code':0xc8,'result':_0x5291ec[_0x5e01('0xae')]?_0x5291ec[_0x5e01('0xae')]:'-'};};String['prototype'][_0x5e01('0x1ca')]=function(_0x4cdd08,_0x2c6d45){return this[_0x5e01('0xad')](_0x4cdd08)[_0x5e01('0x1cb')](_0x2c6d45);};module[_0x5e01('0x1cc')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 11edce6..507795d 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 _0xb6f2=['[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangup','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','[ACW][START]\x20%s','message','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause'];(function(_0x7a7bd6,_0x51e48b){var _0x2576ad=function(_0x4907cd){while(--_0x4907cd){_0x7a7bd6['push'](_0x7a7bd6['shift']());}};_0x2576ad(++_0x51e48b);}(_0xb6f2,0xfa));var _0x2b6f=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xb6f2[_0x1b6186];return _0x186121;};'use strict';var util=require(_0x2b6f('0x0'));var _=require(_0x2b6f('0x1'));var moment=require(_0x2b6f('0x2'));var ami=require('../ami');var logger=require(_0x2b6f('0x3'))(_0x2b6f('0x4'));var RpcUser=require(_0x2b6f('0x5'));var RpcVoiceAgentReport=require(_0x2b6f('0x6'));function Acw(_0x4cdbbb){this[_0x2b6f('0x7')]=_0x4cdbbb[_0x2b6f('0x7')];this['agents']=_0x4cdbbb[_0x2b6f('0x8')];this[_0x2b6f('0x9')]=_0x4cdbbb[_0x2b6f('0x9')];this[_0x2b6f('0xa')]={};ami['on']('agentconnect',this[_0x2b6f('0xb')]['bind'](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x2b6f('0xc')](this));ami['on']('hangup',this[_0x2b6f('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0x2b6f('0xe')][_0x2b6f('0xc')](this));ami['on'](_0x2b6f('0xf'),this['syncAttendedTransfer'][_0x2b6f('0xc')](this));ami['on'](_0x2b6f('0x10'),this[_0x2b6f('0x11')]['bind'](this));ami['on'](_0x2b6f('0x12'),this[_0x2b6f('0x13')][_0x2b6f('0xc')](this));}function getDiff(_0x40e416){var _0x1e41dc=moment()['milliseconds'](0x0);var _0x527d90=moment(_0x40e416)[_0x2b6f('0x14')](0x0);return _0x1e41dc['diff'](_0x527d90,_0x2b6f('0x15'));}Acw[_0x2b6f('0x16')][_0x2b6f('0x17')]=function(_0x1499bf){try{var _0x449605=this;var _0x155964=this[_0x2b6f('0xa')][_0x1499bf][_0x2b6f('0x18')];var _0x238fd7=this['channels'][_0x1499bf][_0x2b6f('0x19')];var _0x162f8b=this[_0x2b6f('0x7')][_0x238fd7];var _0xe3e649=![];var _0x45a5c3=_0x2b6f('0x1a');if(_0x162f8b[_0x2b6f('0x1b')]){if(_0x162f8b[_0x2b6f('0x1c')][_0x2b6f('0x1d')]){_0xe3e649=!![];_0x45a5c3=_0x162f8b[_0x2b6f('0x1c')][_0x2b6f('0x1d')];}}ami[_0x2b6f('0x1e')]({'action':'QueuePause','interface':_0x155964,'paused':!![],'reason':_0x45a5c3})['then'](function(_0x5f3456){if(_0x449605[_0x2b6f('0x8')][_0x155964]){return RpcUser[_0x2b6f('0x1f')](_0x449605[_0x2b6f('0x8')][_0x155964]['id'])['then'](function(_0x334e79){if(_0x334e79&&!_0x334e79[_0x2b6f('0x20')]){logger[_0x2b6f('0x21')](_0x2b6f('0x22'),_0x1499bf,_0x155964,_0x238fd7);var _0x391497=_0x449605[_0x2b6f('0xa')][_0x1499bf][_0x2b6f('0x23')]&&_0x449605['channels'][_0x1499bf][_0x2b6f('0x24')]?_0x449605[_0x2b6f('0xa')][_0x1499bf][_0x2b6f('0x24')]:_0x1499bf;return RpcUser['savePause'](_0x449605[_0x2b6f('0x8')][_0x155964],_0x45a5c3,_0x391497)[_0x2b6f('0x25')](function(_0x38754a){if(!_0xe3e649){_0x449605[_0x2b6f('0x9')][_0x155964]={};logger[_0x2b6f('0x21')](_0x2b6f('0x26'),_0x1499bf,_0x449605[_0x2b6f('0x7')][_0x238fd7][_0x2b6f('0x27')],_0x155964,_0x238fd7);_0x449605['timers'][_0x155964][_0x2b6f('0x28')]=setTimeout(_0x449605[_0x2b6f('0x29')]['bind'](_0x449605,_0x155964),_0x449605['voiceQueues'][_0x238fd7][_0x2b6f('0x27')]*0x3e8);_0x449605[_0x2b6f('0x9')][_0x155964][_0x2b6f('0x2a')]=moment()['format'](_0x2b6f('0x2b'));_0x449605['timers'][_0x155964][_0x2b6f('0x2c')]=_0x1499bf;_0x449605[_0x2b6f('0x9')][_0x155964]['queue']=_0x238fd7;_0x449605[_0x2b6f('0x9')][_0x155964][_0x2b6f('0x2d')]=function(){var _0x5ee0a8=getDiff(_0x449605['timers'][_0x155964]['lastPauseAt']);clearTimeout(_0x449605[_0x2b6f('0x9')][_0x155964]['timer']);_0x449605['timers'][_0x155964][_0x2b6f('0x28')]=![];RpcVoiceAgentReport[_0x2b6f('0x2e')]({'acwtime':_0x5ee0a8},_0x449605[_0x2b6f('0x9')][_0x155964][_0x2b6f('0x2c')],_0x155964)[_0x2b6f('0x25')](function(_0x49c189){logger[_0x2b6f('0x21')](_0x2b6f('0x2f'),_0x1499bf,_0x5ee0a8,_0x49c189);})[_0x2b6f('0x30')](function(_0x38b4eb){logger[_0x2b6f('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x1499bf,_0x38b4eb);});delete _0x449605[_0x2b6f('0x9')][_0x155964];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x1499bf,_0x155964,_0x238fd7);}});}})[_0x2b6f('0x30')](function(_0x58c27a){logger['error'](_0x2b6f('0x26'),_0x1499bf,_0x449605[_0x2b6f('0x7')][_0x238fd7]['acwTimeout'],_0x155964,_0x238fd7);})[_0x2b6f('0x32')](function(){delete _0x449605[_0x2b6f('0xa')][_0x1499bf];});}catch(_0x327912){logger['error'](_0x2b6f('0x33'),_0x327912[_0x2b6f('0x34')]);}};Acw[_0x2b6f('0x16')][_0x2b6f('0x29')]=function(_0x5afacd){try{var _0x5bbb27=this;if(_0x5bbb27['timers'][_0x5afacd]){_0x5bbb27[_0x2b6f('0x9')][_0x5afacd]['timer']=![];var _0x260f6a=_0x5bbb27[_0x2b6f('0x9')][_0x5afacd][_0x2b6f('0x2c')];var _0x29c8ab=_0x5bbb27[_0x2b6f('0x9')][_0x5afacd]['queue'];var _0x34064f=_0x5bbb27['voiceQueues'][_0x29c8ab][_0x2b6f('0x27')];logger[_0x2b6f('0x21')]('[%s][TIMER][STOP][AGENT:%s]',_0x260f6a,_0x5afacd);RpcUser[_0x2b6f('0x35')](this['agents'][_0x5afacd]);RpcVoiceAgentReport[_0x2b6f('0x2e')]({'acwtime':_0x34064f,'agentacw':!![]},_0x260f6a,_0x5afacd)[_0x2b6f('0x25')](function(_0xa16f10){logger[_0x2b6f('0x21')](_0x2b6f('0x2f'),_0x260f6a,_0x34064f,_0xa16f10);})['catch'](function(_0x1944e9){logger[_0x2b6f('0x31')](_0x2b6f('0x36'),_0x260f6a,_0x1944e9);});}else{logger[_0x2b6f('0x31')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x5afacd);if(_0x5bbb27[_0x2b6f('0x9')]){logger[_0x2b6f('0x21')](_0x2b6f('0x37'),JSON[_0x2b6f('0x38')](_0x5bbb27[_0x2b6f('0x9')]));}}}catch(_0xfe8738){logger['error']('[ACW][STOP]\x20%s',_0xfe8738[_0x2b6f('0x34')]);}};Acw[_0x2b6f('0x16')][_0x2b6f('0xb')]=function(_0x49814b){try{if(this[_0x2b6f('0x7')][_0x49814b[_0x2b6f('0x19')]]&&(this['voiceQueues'][_0x49814b['queue']][_0x2b6f('0x4')]||this[_0x2b6f('0x7')][_0x49814b[_0x2b6f('0x19')]][_0x2b6f('0x1b')])){if(this[_0x2b6f('0x8')][_0x49814b[_0x2b6f('0x18')]]){this[_0x2b6f('0xa')][_0x49814b[_0x2b6f('0x2c')]]={'queue':_0x49814b[_0x2b6f('0x19')],'interface':_0x49814b[_0x2b6f('0x18')],'destlinkedid':_0x49814b['destlinkedid']};}}}catch(_0x302628){logger[_0x2b6f('0x31')](_0x2b6f('0x39'),_0x302628[_0x2b6f('0x34')]);}};Acw[_0x2b6f('0x16')][_0x2b6f('0x13')]=function(_0x1bb160){try{if(this['voiceQueues'][_0x1bb160[_0x2b6f('0x19')]]&&(this[_0x2b6f('0x7')][_0x1bb160[_0x2b6f('0x19')]][_0x2b6f('0x4')]||this[_0x2b6f('0x7')][_0x1bb160[_0x2b6f('0x19')]][_0x2b6f('0x1b')])){if(this[_0x2b6f('0x8')][_0x1bb160[_0x2b6f('0x18')]]){this['channels'][_0x1bb160[_0x2b6f('0x2c')]]={'queue':_0x1bb160['queue'],'interface':_0x1bb160[_0x2b6f('0x18')]};}}}catch(_0x8600cf){logger[_0x2b6f('0x31')](_0x2b6f('0x3a'),_0x8600cf[_0x2b6f('0x34')]);}};Acw[_0x2b6f('0x16')][_0x2b6f('0x3b')]=function(_0x381361){try{if(this[_0x2b6f('0xa')][_0x381361[_0x2b6f('0x2c')]]&&_[_0x2b6f('0x3c')](this['channels'][_0x381361[_0x2b6f('0x2c')]][_0x2b6f('0x23')])){logger[_0x2b6f('0x21')](_0x2b6f('0x3d'),_0x381361[_0x2b6f('0x2c')]);this[_0x2b6f('0x17')](_0x381361[_0x2b6f('0x2c')]);}else if(this[_0x2b6f('0xa')][_0x381361['linkedid']]&&_[_0x2b6f('0x3c')](this[_0x2b6f('0xa')][_0x381361[_0x2b6f('0x3e')]][_0x2b6f('0x23')])){logger[_0x2b6f('0x21')]('[%s][HANGUP:LINKEDID]',_0x381361['linkedid']);this[_0x2b6f('0x17')](_0x381361[_0x2b6f('0x3e')]);}}catch(_0x5ae0f8){logger[_0x2b6f('0x31')](_0x2b6f('0x3f'),_0x5ae0f8[_0x2b6f('0x34')]);}};Acw[_0x2b6f('0x16')][_0x2b6f('0xd')]=function(_0x1b708c){try{if(this[_0x2b6f('0xa')][_0x1b708c[_0x2b6f('0x2c')]]&&this[_0x2b6f('0xa')][_0x1b708c[_0x2b6f('0x2c')]][_0x2b6f('0x23')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x1b708c['uniqueid']);this[_0x2b6f('0x17')](_0x1b708c['uniqueid']);}else if(this[_0x2b6f('0xa')][_0x1b708c[_0x2b6f('0x3e')]]&&this[_0x2b6f('0xa')][_0x1b708c['linkedid']][_0x2b6f('0x23')]){logger[_0x2b6f('0x21')](_0x2b6f('0x40'),_0x1b708c[_0x2b6f('0x3e')]);this[_0x2b6f('0x17')](_0x1b708c[_0x2b6f('0x3e')]);}}catch(_0x2734de){logger[_0x2b6f('0x31')](_0x2b6f('0x41'),_0x2734de['message']);}};Acw[_0x2b6f('0x16')][_0x2b6f('0x42')]=function(_0x2bcc97){try{if(!_[_0x2b6f('0x43')](this[_0x2b6f('0xa')][_0x2bcc97[_0x2b6f('0x44')]])){this[_0x2b6f('0x17')](_0x2bcc97[_0x2b6f('0x44')]);if(this['channels'][_0x2bcc97[_0x2b6f('0x45')]]){this[_0x2b6f('0xa')][_0x2bcc97[_0x2b6f('0x45')]][_0x2b6f('0x23')]=!![];this[_0x2b6f('0xa')][_0x2bcc97[_0x2b6f('0x46')]]=this[_0x2b6f('0xa')][_0x2bcc97['secondtransfereruniqueid']];delete this[_0x2b6f('0xa')][_0x2bcc97['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x2b6f('0xa')][_0x2bcc97[_0x2b6f('0x46')]])){this[_0x2b6f('0x17')](_0x2bcc97[_0x2b6f('0x46')]);if(this[_0x2b6f('0xa')][_0x2bcc97[_0x2b6f('0x47')]]){this[_0x2b6f('0xa')][_0x2bcc97[_0x2b6f('0x47')]][_0x2b6f('0x23')]=!![];this['channels'][_0x2bcc97[_0x2b6f('0x44')]]=this['channels'][_0x2bcc97[_0x2b6f('0x47')]];delete this[_0x2b6f('0xa')][_0x2bcc97[_0x2b6f('0x47')]];}}}catch(_0x46e50b){logger['error'](_0x2b6f('0x48'),_0x46e50b[_0x2b6f('0x34')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x437650){try{if(this[_0x2b6f('0xa')][_0x437650['transfereruniqueid']]){logger[_0x2b6f('0x21')](_0x2b6f('0x49'),JSON[_0x2b6f('0x38')](_0x437650['transfereruniqueid']));this[_0x2b6f('0x17')](_0x437650[_0x2b6f('0x4a')]);}else if(this['channels'][_0x437650[_0x2b6f('0x4b')]]){logger['info'](_0x2b6f('0x4c'),JSON[_0x2b6f('0x38')](_0x437650[_0x2b6f('0x4b')]));this[_0x2b6f('0x17')](_0x437650['transfererlinkedid']);}}catch(_0x482863){logger[_0x2b6f('0x31')]('[ACW][syncBlindTransfer]\x20%s',_0x482863[_0x2b6f('0x34')]);}};Acw[_0x2b6f('0x16')][_0x2b6f('0xe')]=function(_0x2889ec){try{if(this['voiceQueues'][_0x2889ec[_0x2b6f('0x19')]]&&this[_0x2b6f('0x7')][_0x2889ec[_0x2b6f('0x19')]][_0x2b6f('0x4d')]==='all'){if(this[_0x2b6f('0x8')][_0x2889ec[_0x2b6f('0x18')]]){logger[_0x2b6f('0x21')](_0x2b6f('0x4e'),_0x2889ec['uniqueid'],_0x2889ec[_0x2b6f('0x18')],_0x2889ec[_0x2b6f('0x19')]);return RpcUser['savePause'](this[_0x2b6f('0x8')][_0x2889ec[_0x2b6f('0x18')]],_0x2b6f('0x4f'),_0x2889ec['uniqueid']);}}}catch(_0x2b95b6){logger['error'](_0x2b6f('0x50'),_0x2b95b6['message']);}};module[_0x2b6f('0x51')]=Acw; \ No newline at end of file +var _0xa5ee=['[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','stopAcw','saveUnpause','update','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','acw','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch'];(function(_0x16bc96,_0x3bcad){var _0x2cdf9c=function(_0x185f43){while(--_0x185f43){_0x16bc96['push'](_0x16bc96['shift']());}};_0x2cdf9c(++_0x3bcad);}(_0xa5ee,0x137));var _0xea5e=function(_0x596b3d,_0x2a6e03){_0x596b3d=_0x596b3d-0x0;var _0x53dda8=_0xa5ee[_0x596b3d];return _0x53dda8;};'use strict';var util=require(_0xea5e('0x0'));var _=require(_0xea5e('0x1'));var moment=require(_0xea5e('0x2'));var ami=require(_0xea5e('0x3'));var logger=require(_0xea5e('0x4'))('acw');var RpcUser=require(_0xea5e('0x5'));var RpcVoiceAgentReport=require(_0xea5e('0x6'));function Acw(_0x2c3f8f){this[_0xea5e('0x7')]=_0x2c3f8f['voiceQueues'];this[_0xea5e('0x8')]=_0x2c3f8f[_0xea5e('0x8')];this[_0xea5e('0x9')]=_0x2c3f8f['timers'];this[_0xea5e('0xa')]={};ami['on'](_0xea5e('0xb'),this[_0xea5e('0xc')]['bind'](this));ami['on'](_0xea5e('0xd'),this['syncHangupRequest'][_0xea5e('0xe')](this));ami['on'](_0xea5e('0xf'),this[_0xea5e('0x10')][_0xea5e('0xe')](this));ami['on'](_0xea5e('0x11'),this[_0xea5e('0x12')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xea5e('0xe')](this));ami['on'](_0xea5e('0x13'),this['syncBlindTransfer'][_0xea5e('0xe')](this));ami['on'](_0xea5e('0x14'),this[_0xea5e('0x15')][_0xea5e('0xe')](this));}function getDiff(_0x4093c5){var _0x3d5057=moment()[_0xea5e('0x16')](0x0);var _0x3dfdee=moment(_0x4093c5)[_0xea5e('0x16')](0x0);return _0x3d5057['diff'](_0x3dfdee,_0xea5e('0x17'));}Acw[_0xea5e('0x18')][_0xea5e('0x19')]=function(_0x48b28d){try{var _0x26b4cc=this;var _0x594cb9=this['channels'][_0x48b28d][_0xea5e('0x1a')];var _0x4db40b=this[_0xea5e('0xa')][_0x48b28d][_0xea5e('0x1b')];var _0x2d3b93=this[_0xea5e('0x7')][_0x4db40b];var _0x390960=![];var _0x3a066b=_0xea5e('0x1c');if(_0x2d3b93['mandatoryDisposition']){if(_0x2d3b93[_0xea5e('0x1d')][_0xea5e('0x1e')]){_0x390960=!![];_0x3a066b=_0x2d3b93[_0xea5e('0x1d')]['name'];}}ami['Action']({'action':_0xea5e('0x1f'),'interface':_0x594cb9,'paused':!![],'reason':_0x3a066b})[_0xea5e('0x20')](function(_0xc76b0c){if(_0x26b4cc[_0xea5e('0x8')][_0x594cb9]){return RpcUser[_0xea5e('0x21')](_0x26b4cc['agents'][_0x594cb9]['id'])['then'](function(_0x255286){if(_0x255286&&!_0x255286[_0xea5e('0x22')]){logger[_0xea5e('0x23')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x48b28d,_0x594cb9,_0x4db40b);var _0xe1ec26=_0x26b4cc[_0xea5e('0xa')][_0x48b28d][_0xea5e('0x24')]&&_0x26b4cc[_0xea5e('0xa')][_0x48b28d]['destlinkedid']?_0x26b4cc[_0xea5e('0xa')][_0x48b28d][_0xea5e('0x25')]:_0x48b28d;return RpcUser[_0xea5e('0x26')](_0x26b4cc[_0xea5e('0x8')][_0x594cb9],_0x3a066b,_0xe1ec26)[_0xea5e('0x20')](function(_0x1e89bd){if(!_0x390960){_0x26b4cc[_0xea5e('0x9')][_0x594cb9]={};logger[_0xea5e('0x23')](_0xea5e('0x27'),_0x48b28d,_0x26b4cc[_0xea5e('0x7')][_0x4db40b][_0xea5e('0x28')],_0x594cb9,_0x4db40b);_0x26b4cc[_0xea5e('0x9')][_0x594cb9][_0xea5e('0x29')]=setTimeout(_0x26b4cc['stopAcw'][_0xea5e('0xe')](_0x26b4cc,_0x594cb9),_0x26b4cc[_0xea5e('0x7')][_0x4db40b][_0xea5e('0x28')]*0x3e8);_0x26b4cc[_0xea5e('0x9')][_0x594cb9][_0xea5e('0x2a')]=moment()[_0xea5e('0x2b')](_0xea5e('0x2c'));_0x26b4cc[_0xea5e('0x9')][_0x594cb9][_0xea5e('0x2d')]=_0x48b28d;_0x26b4cc['timers'][_0x594cb9][_0xea5e('0x1b')]=_0x4db40b;_0x26b4cc['timers'][_0x594cb9][_0xea5e('0x2e')]=function(){var _0x3b26e5=getDiff(_0x26b4cc[_0xea5e('0x9')][_0x594cb9][_0xea5e('0x2a')]);clearTimeout(_0x26b4cc[_0xea5e('0x9')][_0x594cb9][_0xea5e('0x29')]);_0x26b4cc['timers'][_0x594cb9][_0xea5e('0x29')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x3b26e5},_0x26b4cc[_0xea5e('0x9')][_0x594cb9][_0xea5e('0x2d')],_0x594cb9)[_0xea5e('0x20')](function(_0xeb3be1){logger[_0xea5e('0x23')](_0xea5e('0x2f'),_0x48b28d,_0x3b26e5,_0xeb3be1);})[_0xea5e('0x30')](function(_0x49e815){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x48b28d,_0x49e815);});delete _0x26b4cc[_0xea5e('0x9')][_0x594cb9];};}});}else{logger[_0xea5e('0x23')](_0xea5e('0x31'),_0x48b28d,_0x594cb9,_0x4db40b);}});}})['catch'](function(_0x3cc0f4){logger[_0xea5e('0x32')](_0xea5e('0x27'),_0x48b28d,_0x26b4cc['voiceQueues'][_0x4db40b][_0xea5e('0x28')],_0x594cb9,_0x4db40b);})[_0xea5e('0x33')](function(){delete _0x26b4cc['channels'][_0x48b28d];});}catch(_0x49ed2c){logger[_0xea5e('0x32')](_0xea5e('0x34'),_0x49ed2c[_0xea5e('0x35')]);}};Acw['prototype'][_0xea5e('0x36')]=function(_0x214f21){try{var _0x53ff79=this;if(_0x53ff79[_0xea5e('0x9')][_0x214f21]){_0x53ff79[_0xea5e('0x9')][_0x214f21]['timer']=![];var _0x3f4d8a=_0x53ff79[_0xea5e('0x9')][_0x214f21][_0xea5e('0x2d')];var _0x3479e2=_0x53ff79[_0xea5e('0x9')][_0x214f21]['queue'];var _0x19c4d6=_0x53ff79[_0xea5e('0x7')][_0x3479e2]['acwTimeout'];logger[_0xea5e('0x23')]('[%s][TIMER][STOP][AGENT:%s]',_0x3f4d8a,_0x214f21);RpcUser[_0xea5e('0x37')](this[_0xea5e('0x8')][_0x214f21]);RpcVoiceAgentReport[_0xea5e('0x38')]({'acwtime':_0x19c4d6,'agentacw':!![]},_0x3f4d8a,_0x214f21)['then'](function(_0x2c9854){logger[_0xea5e('0x23')](_0xea5e('0x2f'),_0x3f4d8a,_0x19c4d6,_0x2c9854);})['catch'](function(_0x3b3564){logger[_0xea5e('0x32')](_0xea5e('0x39'),_0x3f4d8a,_0x3b3564);});}else{logger[_0xea5e('0x32')](_0xea5e('0x3a'),_0x214f21);if(_0x53ff79[_0xea5e('0x9')]){logger[_0xea5e('0x23')]('[ACW][TIMERS]',JSON[_0xea5e('0x3b')](_0x53ff79['timers']));}}}catch(_0xd2eb4e){logger[_0xea5e('0x32')](_0xea5e('0x3c'),_0xd2eb4e[_0xea5e('0x35')]);}};Acw[_0xea5e('0x18')][_0xea5e('0xc')]=function(_0x52db59){try{if(this[_0xea5e('0x7')][_0x52db59[_0xea5e('0x1b')]]&&(this[_0xea5e('0x7')][_0x52db59['queue']][_0xea5e('0x3d')]||this['voiceQueues'][_0x52db59['queue']][_0xea5e('0x3e')])){if(this[_0xea5e('0x8')][_0x52db59[_0xea5e('0x1a')]]){this[_0xea5e('0xa')][_0x52db59[_0xea5e('0x2d')]]={'queue':_0x52db59['queue'],'interface':_0x52db59[_0xea5e('0x1a')],'destlinkedid':_0x52db59[_0xea5e('0x25')]};}}}catch(_0x3988d6){logger['error'](_0xea5e('0x3f'),_0x3988d6[_0xea5e('0x35')]);}};Acw[_0xea5e('0x18')]['syncAgentConnectPreview']=function(_0x1df831){try{if(this[_0xea5e('0x7')][_0x1df831[_0xea5e('0x1b')]]&&(this['voiceQueues'][_0x1df831[_0xea5e('0x1b')]][_0xea5e('0x3d')]||this['voiceQueues'][_0x1df831['queue']][_0xea5e('0x3e')])){if(this[_0xea5e('0x8')][_0x1df831[_0xea5e('0x1a')]]){this[_0xea5e('0xa')][_0x1df831[_0xea5e('0x2d')]]={'queue':_0x1df831['queue'],'interface':_0x1df831[_0xea5e('0x1a')]};}}}catch(_0x9f2509){logger[_0xea5e('0x32')](_0xea5e('0x40'),_0x9f2509[_0xea5e('0x35')]);}};Acw[_0xea5e('0x18')][_0xea5e('0x41')]=function(_0x34c00e){try{if(this[_0xea5e('0xa')][_0x34c00e[_0xea5e('0x2d')]]&&_[_0xea5e('0x42')](this[_0xea5e('0xa')][_0x34c00e['uniqueid']][_0xea5e('0x24')])){logger['info'](_0xea5e('0x43'),_0x34c00e['uniqueid']);this[_0xea5e('0x19')](_0x34c00e[_0xea5e('0x2d')]);}else if(this['channels'][_0x34c00e[_0xea5e('0x44')]]&&_[_0xea5e('0x42')](this[_0xea5e('0xa')][_0x34c00e[_0xea5e('0x44')]][_0xea5e('0x24')])){logger[_0xea5e('0x23')](_0xea5e('0x45'),_0x34c00e[_0xea5e('0x44')]);this['startAcw'](_0x34c00e[_0xea5e('0x44')]);}}catch(_0x3613e3){logger[_0xea5e('0x32')](_0xea5e('0x46'),_0x3613e3[_0xea5e('0x35')]);}};Acw[_0xea5e('0x18')]['syncHangup']=function(_0x12b4bb){try{if(this[_0xea5e('0xa')][_0x12b4bb['uniqueid']]&&this[_0xea5e('0xa')][_0x12b4bb['uniqueid']][_0xea5e('0x24')]){logger[_0xea5e('0x23')](_0xea5e('0x47'),_0x12b4bb[_0xea5e('0x2d')]);this[_0xea5e('0x19')](_0x12b4bb[_0xea5e('0x2d')]);}else if(this[_0xea5e('0xa')][_0x12b4bb['linkedid']]&&this[_0xea5e('0xa')][_0x12b4bb[_0xea5e('0x44')]][_0xea5e('0x24')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x12b4bb[_0xea5e('0x44')]);this[_0xea5e('0x19')](_0x12b4bb[_0xea5e('0x44')]);}}catch(_0x5ee9d3){logger[_0xea5e('0x32')](_0xea5e('0x48'),_0x5ee9d3[_0xea5e('0x35')]);}};Acw[_0xea5e('0x18')][_0xea5e('0x49')]=function(_0x119e9d){try{if(!_[_0xea5e('0x4a')](this[_0xea5e('0xa')][_0x119e9d[_0xea5e('0x4b')]])){this[_0xea5e('0x19')](_0x119e9d[_0xea5e('0x4b')]);if(this[_0xea5e('0xa')][_0x119e9d[_0xea5e('0x4c')]]){this['channels'][_0x119e9d[_0xea5e('0x4c')]][_0xea5e('0x24')]=!![];this[_0xea5e('0xa')][_0x119e9d[_0xea5e('0x4d')]]=this['channels'][_0x119e9d['secondtransfereruniqueid']];delete this['channels'][_0x119e9d[_0xea5e('0x4c')]];}}else if(!_[_0xea5e('0x4a')](this[_0xea5e('0xa')][_0x119e9d['transfertargetuniqueid']])){this[_0xea5e('0x19')](_0x119e9d[_0xea5e('0x4d')]);if(this[_0xea5e('0xa')][_0x119e9d[_0xea5e('0x4e')]]){this[_0xea5e('0xa')][_0x119e9d[_0xea5e('0x4e')]][_0xea5e('0x24')]=!![];this[_0xea5e('0xa')][_0x119e9d[_0xea5e('0x4b')]]=this[_0xea5e('0xa')][_0x119e9d[_0xea5e('0x4e')]];delete this[_0xea5e('0xa')][_0x119e9d[_0xea5e('0x4e')]];}}}catch(_0x1d9b1b){logger[_0xea5e('0x32')](_0xea5e('0x4f'),_0x1d9b1b[_0xea5e('0x35')]);}};Acw[_0xea5e('0x18')][_0xea5e('0x50')]=function(_0x37938f){try{if(this[_0xea5e('0xa')][_0x37938f[_0xea5e('0x51')]]){logger[_0xea5e('0x23')](_0xea5e('0x52'),JSON['stringify'](_0x37938f[_0xea5e('0x51')]));this[_0xea5e('0x19')](_0x37938f[_0xea5e('0x51')]);}else if(this[_0xea5e('0xa')][_0x37938f['transfererlinkedid']]){logger[_0xea5e('0x23')](_0xea5e('0x53'),JSON[_0xea5e('0x3b')](_0x37938f['transfererlinkedid']));this[_0xea5e('0x19')](_0x37938f[_0xea5e('0x54')]);}}catch(_0x28c9ea){logger[_0xea5e('0x32')](_0xea5e('0x55'),_0x28c9ea[_0xea5e('0x35')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x288846){try{if(this[_0xea5e('0x7')][_0x288846[_0xea5e('0x1b')]]&&this[_0xea5e('0x7')][_0x288846[_0xea5e('0x1b')]]['autopause']===_0xea5e('0x56')){if(this[_0xea5e('0x8')][_0x288846[_0xea5e('0x1a')]]){logger[_0xea5e('0x23')](_0xea5e('0x57'),_0x288846['uniqueid'],_0x288846[_0xea5e('0x1a')],_0x288846[_0xea5e('0x1b')]);return RpcUser[_0xea5e('0x26')](this[_0xea5e('0x8')][_0x288846[_0xea5e('0x1a')]],_0xea5e('0x58'),_0x288846[_0xea5e('0x2d')]);}}}catch(_0x59483d){logger[_0xea5e('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x59483d[_0xea5e('0x35')]);}};module[_0xea5e('0x59')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 51e52f2..4f1639a 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 _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x33c959,_0x35ffaf){var _0x146bb9=function(_0x173076){while(--_0x173076){_0x33c959['push'](_0x33c959['shift']());}};_0x146bb9(++_0x35ffaf);}(_0x0b0e,0x187));var _0xe0b0=function(_0x229f5e,_0x433f0f){_0x229f5e=_0x229f5e-0x0;var _0x2d62ff=_0x0b0e[_0x229f5e];return _0x2d62ff;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file +var _0xbaf0=['once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','exports','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x7701ea,_0x3bd043){var _0x459df3=function(_0x21f61f){while(--_0x21f61f){_0x7701ea['push'](_0x7701ea['shift']());}};_0x459df3(++_0x3bd043);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var _=require(_0x0baf('0x3'));var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x0baf('0x6')][_0x0baf('0x7')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')][_0x0baf('0x9')],!![]);ami[_0x0baf('0xa')]();ami[_0x0baf('0xb')]=BPromise['promisify'](ami[_0x0baf('0xc')]);function error(_0x5f20aa){logger[_0x0baf('0xd')](util[_0x0baf('0xe')](_0x0baf('0xf'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')],util[_0x0baf('0x10')](_0x5f20aa,![],null)));}function close(){logger[_0x0baf('0xd')](util[_0x0baf('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x0baf('0xb')]({'action':'sipshowregistry'});};};ami[_0x0baf('0x11')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x12')});};};ami[_0x0baf('0x13')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x0baf('0x15')});};};ami[_0x0baf('0x16')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x17')});};};function connect(_0x2cf7da){logger[_0x0baf('0x18')](util['format'](_0x0baf('0x19'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));ami['once']('error',error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);}ami['on'](_0x0baf('0x1c'),connect);ami['on'](_0x0baf('0x1d'),function(_0x1fa92b){logger[_0x0baf('0x18')](util[_0x0baf('0xe')](_0x0baf('0x1e'),config[_0x0baf('0x6')][_0x0baf('0x8')],config['asterisk']['ip'],config[_0x0baf('0x6')]['port'],util[_0x0baf('0x10')](_0x1fa92b,![],null)));});ami['on']('fullybooted',function(_0x4de74c){logger[_0x0baf('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));return BPromise['resolve']()[_0x0baf('0x1f')](ami[_0x0baf('0x20')]())[_0x0baf('0x1f')](ami[_0x0baf('0x11')]())[_0x0baf('0x1f')](ami[_0x0baf('0x13')]())[_0x0baf('0x1f')](ami['actionQueueSummary']())[_0x0baf('0x1f')](ami[_0x0baf('0x16')]())[_0x0baf('0x21')](function(_0x265915){logger['error'](_0x0baf('0x22'),util[_0x0baf('0x10')](_0x265915,{'showHidden':![],'depth':null}));});});ami['once'](_0x0baf('0xd'),error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);module[_0x0baf('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index b797a19..5b7a463 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(_0x21d855,_0x31ebc2){var _0x48c5e2=function(_0x2aacdf){while(--_0x2aacdf){_0x21d855['push'](_0x21d855['shift']());}};_0x48c5e2(++_0x31ebc2);}(_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 _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x3f4cd0,_0x303070){var _0x3f9f01=function(_0x6ced93){while(--_0x6ced93){_0x3f4cd0['push'](_0x3f4cd0['shift']());}};_0x3f9f01(++_0x303070);}(_0xe706,0xa3));var _0x6e70=function(_0x5bfa44,_0x76dacc){_0x5bfa44=_0x5bfa44-0x0;var _0x43815f=_0xe706[_0x5bfa44];return _0x43815f;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 970965c..05504c9 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01e2=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','prototype','voiceQueue','dialCutDigit','number','exports','util','lodash','moment','isNil','string','uniqueid','name','Contact','firstName','lastName','phone','active','type','dialQueueTimeout','scheduledat','countbusyretry'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x01e2,0x1dc));var _0x201e=function(_0x306833,_0x128b29){_0x306833=_0x306833-0x0;var _0x471940=_0x01e2[_0x306833];return _0x471940;};'use strict';var util=require(_0x201e('0x0'));var _=require(_0x201e('0x1'));var moment=require(_0x201e('0x2'));function checkNameSurname(_0x287668,_0x2cc9d1,_0x28438a){var _0x11a718='';if(!_[_0x201e('0x3')](_0x2cc9d1)&&_0x201e('0x4')===typeof _0x2cc9d1){_0x11a718+=_0x2cc9d1;}if(!_[_0x201e('0x3')](_0x28438a)&&'string'===typeof _0x28438a){_0x11a718+='\x20'+_0x28438a;}if(_0x11a718!==''){return _0x11a718;}return _0x287668;}function Action(_0x71620f,_0x12f855,_0x41f721){this['voiceQueue']=_0x71620f;this[_0x201e('0x5')]=_0x41f721||undefined;this[_0x201e('0x6')]=checkNameSurname(_0x12f855[_0x201e('0x7')]['phone'],_0x12f855[_0x201e('0x7')][_0x201e('0x8')],_0x12f855[_0x201e('0x7')][_0x201e('0x9')]);this['number']=_0x12f855[_0x201e('0x7')][_0x201e('0xa')];this['queue']=_0x71620f[_0x201e('0x6')];this[_0x201e('0xb')]=_0x12f855[_0x201e('0xb')]||![];this[_0x201e('0xc')]=_0x71620f[_0x201e('0xc')];this[_0x201e('0xd')]=_0x71620f[_0x201e('0xd')]||0x3;this[_0x201e('0xe')]=_0x12f855[_0x201e('0xe')];this[_0x201e('0xf')]=_0x12f855[_0x201e('0xf')];this[_0x201e('0x10')]=_0x12f855[_0x201e('0x10')];this['countnoanswerretry']=_0x12f855[_0x201e('0x11')];this[_0x201e('0x12')]=_0x12f855['countnosuchnumberretry'];this[_0x201e('0x13')]=_0x12f855[_0x201e('0x13')];this[_0x201e('0x14')]=_0x12f855[_0x201e('0x14')];this[_0x201e('0x15')]=_0x12f855['countmachineretry'];this['countagentrejectretry']=_0x12f855[_0x201e('0x16')];this[_0x201e('0x17')]=_0x12f855[_0x201e('0x17')];this[_0x201e('0x18')]=_0x12f855[_0x201e('0x18')];this['UserId']=_0x12f855['UserId'];this[_0x201e('0x19')]=_0x12f855['VoiceQueueId'];this['CampaignId']=_0x12f855[_0x201e('0x1a')];this[_0x201e('0x1b')]=_0x12f855['id'];this[_0x201e('0x1c')]=_0x12f855[_0x201e('0x7')][_0x201e('0x8')]||'';this[_0x201e('0x1d')]=moment()[_0x201e('0x1e')](_0x201e('0x1f'));this['callback']=_0x12f855[_0x201e('0x20')];this['callbackuniqueid']=_0x12f855[_0x201e('0x21')];this[_0x201e('0x22')]=_0x12f855[_0x201e('0x22')];this[_0x201e('0x23')]=_0x12f855[_0x201e('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x201e('0x24')]['getCaller']=function(){return util[_0x201e('0x1e')]('\x22%s\x22\x20<%s>',this['name'],this[_0x201e('0x25')][_0x201e('0x26')]>0x0?this['number']['substring'](this[_0x201e('0x25')][_0x201e('0x26')]):this[_0x201e('0x27')]);};Action[_0x201e('0x24')]['getQueue']=function(){return this['queue'];};module[_0x201e('0x28')]=Action; \ No newline at end of file +var _0x3366=['countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','firstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','util','lodash','moment','string','isNil','voiceQueue','Contact','phone','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x58f214,_0x573775){var _0xac645f=function(_0x444ae4){while(--_0x444ae4){_0x58f214['push'](_0x58f214['shift']());}};_0xac645f(++_0x573775);}(_0x3366,0x9d));var _0x6336=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0x3366[_0x4ed1d4];return _0x28e363;};'use strict';var util=require(_0x6336('0x0'));var _=require(_0x6336('0x1'));var moment=require(_0x6336('0x2'));function checkNameSurname(_0x214d54,_0x339951,_0x24e90c){var _0x5ad8d2='';if(!_['isNil'](_0x339951)&&_0x6336('0x3')===typeof _0x339951){_0x5ad8d2+=_0x339951;}if(!_[_0x6336('0x4')](_0x24e90c)&&_0x6336('0x3')===typeof _0x24e90c){_0x5ad8d2+='\x20'+_0x24e90c;}if(_0x5ad8d2!==''){return _0x5ad8d2;}return _0x214d54;}function Action(_0x5ebc82,_0x21461a,_0xa85568){this[_0x6336('0x5')]=_0x5ebc82;this['uniqueid']=_0xa85568||undefined;this['name']=checkNameSurname(_0x21461a[_0x6336('0x6')][_0x6336('0x7')],_0x21461a['Contact']['firstName'],_0x21461a[_0x6336('0x6')][_0x6336('0x8')]);this[_0x6336('0x9')]=_0x21461a[_0x6336('0x6')][_0x6336('0x7')];this[_0x6336('0xa')]=_0x5ebc82[_0x6336('0xb')];this[_0x6336('0xc')]=_0x21461a['active']||![];this[_0x6336('0xd')]=_0x5ebc82[_0x6336('0xd')];this[_0x6336('0xe')]=_0x5ebc82[_0x6336('0xe')]||0x3;this[_0x6336('0xf')]=_0x21461a['scheduledat'];this[_0x6336('0x10')]=_0x21461a[_0x6336('0x10')];this[_0x6336('0x11')]=_0x21461a[_0x6336('0x11')];this[_0x6336('0x12')]=_0x21461a['countnoanswerretry'];this[_0x6336('0x13')]=_0x21461a[_0x6336('0x13')];this[_0x6336('0x14')]=_0x21461a[_0x6336('0x14')];this['countabandonedretry']=_0x21461a['countabandonedretry'];this['countmachineretry']=_0x21461a[_0x6336('0x15')];this[_0x6336('0x16')]=_0x21461a['countagentrejectretry'];this[_0x6336('0x17')]=_0x21461a[_0x6336('0x17')];this[_0x6336('0x18')]=_0x21461a[_0x6336('0x18')];this[_0x6336('0x19')]=_0x21461a[_0x6336('0x19')];this[_0x6336('0x1a')]=_0x21461a[_0x6336('0x1a')];this[_0x6336('0x1b')]=_0x21461a[_0x6336('0x1b')];this[_0x6336('0x1c')]=_0x21461a['id'];this['ContactFirstName']=_0x21461a[_0x6336('0x6')][_0x6336('0x1d')]||'';this[_0x6336('0x1e')]=moment()['format'](_0x6336('0x1f'));this['callback']=_0x21461a[_0x6336('0x20')];this[_0x6336('0x21')]=_0x21461a[_0x6336('0x21')];this[_0x6336('0x22')]=_0x21461a[_0x6336('0x22')];this[_0x6336('0x23')]=_0x21461a[_0x6336('0x23')];this[_0x6336('0x24')]='';this[_0x6336('0x25')]='';}Action[_0x6336('0x26')]['getCaller']=function(){return util[_0x6336('0x27')](_0x6336('0x28'),this[_0x6336('0xb')],this[_0x6336('0x5')][_0x6336('0x29')]>0x0?this[_0x6336('0x9')][_0x6336('0x2a')](this[_0x6336('0x5')][_0x6336('0x29')]):this[_0x6336('0x9')]);};Action[_0x6336('0x26')][_0x6336('0x2b')]=function(){return this[_0x6336('0xa')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index aa16c9a..3a7d90b 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd167=['countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue'];(function(_0xee5d2a,_0x534134){var _0x346948=function(_0x458fdf){while(--_0x458fdf){_0xee5d2a['push'](_0xee5d2a['shift']());}};_0x346948(++_0x534134);}(_0xd167,0x76));var _0x7d16=function(_0x4b964f,_0x29da03){_0x4b964f=_0x4b964f-0x0;var _0x2ae5e2=_0xd167[_0x4b964f];return _0x2ae5e2;};'use strict';var util=require(_0x7d16('0x0'));var _=require(_0x7d16('0x1'));var moment=require('moment');function getSeconds(_0x4271b5,_0x21e1ab){var _0x2242ff=moment(_0x4271b5)['milliseconds'](0x0);var _0x3e5875=moment(_0x21e1ab)['milliseconds'](0x0);return _0x2242ff[_0x7d16('0x2')](_0x3e5875,_0x7d16('0x3'));}function AgentComplete(_0x5f1236,_0x45be34){this[_0x7d16('0x4')]=0x4;this[_0x7d16('0x5')]=_0x7d16('0x6');this[_0x7d16('0x7')]=_0x5f1236['scheduledat'];this[_0x7d16('0x8')]=_0x5f1236[_0x7d16('0x8')];this['campaigntype']=_0x5f1236['type']===_0x7d16('0x9')?_0x7d16('0xa'):_0x5f1236[_0x7d16('0x8')];this['countbusyretry']=_0x5f1236['countbusyretry'];this[_0x7d16('0xb')]=_0x5f1236['countcongestionretry'];this[_0x7d16('0xc')]=_0x5f1236[_0x7d16('0xc')];this[_0x7d16('0xd')]=_0x5f1236[_0x7d16('0xe')]+_0x5f1236[_0x7d16('0xb')]+_0x5f1236['countnoanswerretry']+_0x5f1236[_0x7d16('0xf')]+_0x5f1236[_0x7d16('0x10')]+_0x5f1236['countabandonedretry']+_0x5f1236['countmachineretry']+_0x5f1236[_0x7d16('0x11')];this['countnosuchnumberretry']=_0x5f1236[_0x7d16('0xf')];this['countdropretry']=_0x5f1236['countdropretry'];this['countabandonedretry']=_0x5f1236['countabandonedretry'];this['countmachineretry']=_0x5f1236[_0x7d16('0x12')];this[_0x7d16('0x11')]=_0x5f1236['countagentrejectretry'];this[_0x7d16('0x13')]=_0x45be34[_0x7d16('0x13')];this['calleridname']=_0x5f1236[_0x7d16('0x14')];this[_0x7d16('0x15')]=_0x5f1236[_0x7d16('0x16')];this[_0x7d16('0x17')]=_0x5f1236[_0x7d16('0x17')];this[_0x7d16('0x18')]=_0x5f1236[_0x7d16('0x18')];this[_0x7d16('0x19')]=_0x5f1236[_0x7d16('0x19')];this['endtime']=moment()[_0x7d16('0x1a')](_0x7d16('0x1b'));this['ringtime']=getSeconds(_0x5f1236['responsetime'],_0x5f1236[_0x7d16('0x17')]);this[_0x7d16('0x1c')]=getSeconds(_0x5f1236[_0x7d16('0x19')],_0x5f1236[_0x7d16('0x18')]);this[_0x7d16('0x1d')]=getSeconds(this['endtime'],_0x5f1236[_0x7d16('0x19')]);this['queue']=_0x45be34[_0x7d16('0xa')];this[_0x7d16('0x1e')]=_0x45be34['membername'];this['reason']=_0x45be34[_0x7d16('0x1f')];this[_0x7d16('0x20')]=_0x5f1236[_0x7d16('0x20')];this['callbackuniqueid']=_0x5f1236['callbackuniqueid'];this[_0x7d16('0x21')]=_0x5f1236['callbackat'];this[_0x7d16('0x22')]=_0x5f1236[_0x7d16('0x22')];this[_0x7d16('0x23')]=_0x5f1236['ContactId'];this[_0x7d16('0x24')]=_0x5f1236[_0x7d16('0x24')];this[_0x7d16('0x25')]=_0x5f1236[_0x7d16('0x25')];this[_0x7d16('0x26')]=_0x5f1236[_0x7d16('0x26')];this['CampaignId']=_0x5f1236[_0x7d16('0x27')];this[_0x7d16('0x28')]=_0x5f1236[_0x7d16('0x28')]||'';this[_0x7d16('0x29')]=_0x5f1236[_0x7d16('0x29')]||'';}module[_0x7d16('0x2a')]=AgentComplete; \ No newline at end of file +var _0x2ba2=['ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme'];(function(_0x539f54,_0x24ec67){var _0x21e0f9=function(_0x267989){while(--_0x267989){_0x539f54['push'](_0x539f54['shift']());}};_0x21e0f9(++_0x24ec67);}(_0x2ba2,0x1a5));var _0x22ba=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x2ba2[_0x45b034];return _0x509cb0;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x3ffc85,_0x4a1e3f){var _0x32c93d=moment(_0x3ffc85)[_0x22ba('0x0')](0x0);var _0x1e8b7a=moment(_0x4a1e3f)['milliseconds'](0x0);return _0x32c93d[_0x22ba('0x1')](_0x1e8b7a,_0x22ba('0x2'));}function AgentComplete(_0xe75719,_0x2a1a3d){this['state']=0x4;this[_0x22ba('0x3')]=_0x22ba('0x4');this[_0x22ba('0x5')]=_0xe75719[_0x22ba('0x5')];this[_0x22ba('0x6')]=_0xe75719[_0x22ba('0x6')];this[_0x22ba('0x7')]=_0xe75719[_0x22ba('0x6')]===_0x22ba('0x8')?_0x22ba('0x9'):_0xe75719['type'];this['countbusyretry']=_0xe75719['countbusyretry'];this[_0x22ba('0xa')]=_0xe75719[_0x22ba('0xa')];this['countnoanswerretry']=_0xe75719[_0x22ba('0xb')];this[_0x22ba('0xc')]=_0xe75719[_0x22ba('0xd')]+_0xe75719[_0x22ba('0xa')]+_0xe75719[_0x22ba('0xb')]+_0xe75719['countnosuchnumberretry']+_0xe75719[_0x22ba('0xe')]+_0xe75719[_0x22ba('0xf')]+_0xe75719['countmachineretry']+_0xe75719['countagentrejectretry'];this[_0x22ba('0x10')]=_0xe75719[_0x22ba('0x10')];this[_0x22ba('0xe')]=_0xe75719[_0x22ba('0xe')];this['countabandonedretry']=_0xe75719['countabandonedretry'];this[_0x22ba('0x11')]=_0xe75719[_0x22ba('0x11')];this[_0x22ba('0x12')]=_0xe75719[_0x22ba('0x12')];this[_0x22ba('0x13')]=_0x2a1a3d['uniqueid'];this[_0x22ba('0x14')]=_0xe75719[_0x22ba('0x15')];this[_0x22ba('0x16')]=_0xe75719[_0x22ba('0x17')];this[_0x22ba('0x18')]=_0xe75719['starttime'];this[_0x22ba('0x19')]=_0xe75719[_0x22ba('0x19')];this[_0x22ba('0x1a')]=_0xe75719[_0x22ba('0x1a')];this['endtime']=moment()[_0x22ba('0x1b')](_0x22ba('0x1c'));this[_0x22ba('0x1d')]=getSeconds(_0xe75719[_0x22ba('0x19')],_0xe75719[_0x22ba('0x18')]);this[_0x22ba('0x1e')]=getSeconds(_0xe75719[_0x22ba('0x1a')],_0xe75719[_0x22ba('0x19')]);this[_0x22ba('0x1f')]=getSeconds(this[_0x22ba('0x20')],_0xe75719['answertime']);this[_0x22ba('0x9')]=_0x2a1a3d[_0x22ba('0x9')];this[_0x22ba('0x21')]=_0x2a1a3d[_0x22ba('0x21')];this[_0x22ba('0x22')]=_0x2a1a3d['reason'];this[_0x22ba('0x23')]=_0xe75719[_0x22ba('0x23')];this[_0x22ba('0x24')]=_0xe75719['callbackuniqueid'];this[_0x22ba('0x25')]=_0xe75719[_0x22ba('0x25')];this[_0x22ba('0x26')]=_0xe75719[_0x22ba('0x26')];this[_0x22ba('0x27')]=_0xe75719[_0x22ba('0x27')];this[_0x22ba('0x28')]=_0xe75719[_0x22ba('0x28')];this['UserId']=_0xe75719['UserId'];this[_0x22ba('0x29')]=_0xe75719[_0x22ba('0x29')];this[_0x22ba('0x2a')]=_0xe75719[_0x22ba('0x2a')];this[_0x22ba('0x2b')]=_0xe75719['originatecalleridnum']||'';this[_0x22ba('0x2c')]=_0xe75719['originatecalleridname']||'';}module[_0x22ba('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index fd8c90e..714bf5d 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a59=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x54ff3d,_0x1d03c6){var _0x5b175d=function(_0x1997ab){while(--_0x1997ab){_0x54ff3d['push'](_0x54ff3d['shift']());}};_0x5b175d(++_0x1d03c6);}(_0x7a59,0x16e));var _0x97a5=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x7a59[_0x8b8564];return _0x360c61;};'use strict';var util=require(_0x97a5('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x1f74cd,_0xe6f28a){var _0x23919f=moment(_0x1f74cd)[_0x97a5('0x1')](0x0);var _0x281bfd=moment(_0xe6f28a)['milliseconds'](0x0);return _0x23919f[_0x97a5('0x2')](_0x281bfd,_0x97a5('0x3'));}function Final(_0x3e1524){this['uniqueid']=_0x3e1524[_0x97a5('0x4')];this[_0x97a5('0x5')]=_0x3e1524[_0x97a5('0x5')];this[_0x97a5('0x6')]=_0x3e1524[_0x97a5('0x6')];this[_0x97a5('0x7')]=_0x3e1524[_0x97a5('0x6')]==='outbound'?_0x97a5('0x8'):_0x3e1524[_0x97a5('0x6')];this[_0x97a5('0x9')]=_0x3e1524[_0x97a5('0x9')];this[_0x97a5('0xa')]=_0x3e1524['countcongestionretry'];this['countnoanswerretry']=_0x3e1524[_0x97a5('0xb')];this[_0x97a5('0xc')]=_0x3e1524[_0x97a5('0x9')]+_0x3e1524['countcongestionretry']+_0x3e1524[_0x97a5('0xb')]+_0x3e1524[_0x97a5('0xd')]+_0x3e1524['countdropretry']+_0x3e1524['countabandonedretry']+_0x3e1524[_0x97a5('0xe')]+_0x3e1524[_0x97a5('0xf')];this['countnosuchnumberretry']=_0x3e1524['countnosuchnumberretry'];this['countdropretry']=_0x3e1524['countdropretry'];this[_0x97a5('0x10')]=_0x3e1524[_0x97a5('0x10')];this[_0x97a5('0xe')]=_0x3e1524['countmachineretry'];this[_0x97a5('0xf')]=_0x3e1524[_0x97a5('0xf')];this['queue']=_0x3e1524[_0x97a5('0x8')];this['calleridname']=_0x3e1524[_0x97a5('0x11')];this['calleridnum']=_0x3e1524['calleridnum'];this['starttime']=_0x3e1524[_0x97a5('0x12')];this['responsetime']=_0x3e1524[_0x97a5('0x13')];this[_0x97a5('0x14')]=_0x3e1524[_0x97a5('0x13')];this[_0x97a5('0x15')]=_0x3e1524['ringtime']||0x0;this['holdtime']=_0x3e1524[_0x97a5('0x16')]||0x0;this[_0x97a5('0x17')]=_0x3e1524['talktime']||0x0;this['callback']=_0x3e1524[_0x97a5('0x18')];this[_0x97a5('0x19')]=_0x3e1524[_0x97a5('0x19')];this['callbackat']=_0x3e1524[_0x97a5('0x1a')];this[_0x97a5('0x1b')]=_0x3e1524[_0x97a5('0x1b')];this['ContactId']=_0x3e1524[_0x97a5('0x1c')];this[_0x97a5('0x1d')]=_0x3e1524['ListId'];this[_0x97a5('0x1e')]=_0x3e1524[_0x97a5('0x1e')];this[_0x97a5('0x1f')]=_0x3e1524[_0x97a5('0x1f')];this[_0x97a5('0x20')]=_0x3e1524[_0x97a5('0x20')];this[_0x97a5('0x21')]=_0x3e1524[_0x97a5('0x21')]||'';this[_0x97a5('0x22')]=_0x3e1524['originatecalleridname']||'';}module[_0x97a5('0x23')]=Final; \ No newline at end of file +var _0xfa2b=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x4833ee,_0x1e822d){_0x4833ee=_0x4833ee-0x0;var _0x54db80=_0xfa2b[_0x4833ee];return _0x54db80;};'use strict';var util=require(_0xbfa2('0x0'));var _=require(_0xbfa2('0x1'));var moment=require(_0xbfa2('0x2'));function getSeconds(_0x9a9b55,_0x237b3e){var _0x41d712=moment(_0x9a9b55)[_0xbfa2('0x3')](0x0);var _0x1103cf=moment(_0x237b3e)[_0xbfa2('0x3')](0x0);return _0x41d712[_0xbfa2('0x4')](_0x1103cf,_0xbfa2('0x5'));}function Final(_0x2e8f3b){this[_0xbfa2('0x6')]=_0x2e8f3b[_0xbfa2('0x6')];this[_0xbfa2('0x7')]=_0x2e8f3b[_0xbfa2('0x7')];this['type']=_0x2e8f3b[_0xbfa2('0x8')];this['campaigntype']=_0x2e8f3b[_0xbfa2('0x8')]===_0xbfa2('0x9')?_0xbfa2('0xa'):_0x2e8f3b[_0xbfa2('0x8')];this[_0xbfa2('0xb')]=_0x2e8f3b[_0xbfa2('0xb')];this[_0xbfa2('0xc')]=_0x2e8f3b[_0xbfa2('0xc')];this[_0xbfa2('0xd')]=_0x2e8f3b['countnoanswerretry'];this['countglobal']=_0x2e8f3b['countbusyretry']+_0x2e8f3b[_0xbfa2('0xc')]+_0x2e8f3b[_0xbfa2('0xd')]+_0x2e8f3b[_0xbfa2('0xe')]+_0x2e8f3b[_0xbfa2('0xf')]+_0x2e8f3b[_0xbfa2('0x10')]+_0x2e8f3b[_0xbfa2('0x11')]+_0x2e8f3b['countagentrejectretry'];this[_0xbfa2('0xe')]=_0x2e8f3b[_0xbfa2('0xe')];this[_0xbfa2('0xf')]=_0x2e8f3b[_0xbfa2('0xf')];this[_0xbfa2('0x10')]=_0x2e8f3b['countabandonedretry'];this[_0xbfa2('0x11')]=_0x2e8f3b['countmachineretry'];this['countagentrejectretry']=_0x2e8f3b[_0xbfa2('0x12')];this['queue']=_0x2e8f3b['queue'];this[_0xbfa2('0x13')]=_0x2e8f3b[_0xbfa2('0x13')];this['calleridnum']=_0x2e8f3b[_0xbfa2('0x14')];this[_0xbfa2('0x15')]=_0x2e8f3b[_0xbfa2('0x15')];this[_0xbfa2('0x16')]=_0x2e8f3b[_0xbfa2('0x16')];this[_0xbfa2('0x17')]=_0x2e8f3b[_0xbfa2('0x16')];this['ringtime']=_0x2e8f3b[_0xbfa2('0x18')]||0x0;this[_0xbfa2('0x19')]=_0x2e8f3b[_0xbfa2('0x19')]||0x0;this['talktime']=_0x2e8f3b[_0xbfa2('0x1a')]||0x0;this[_0xbfa2('0x1b')]=_0x2e8f3b['callback'];this[_0xbfa2('0x1c')]=_0x2e8f3b['callbackuniqueid'];this['callbackat']=_0x2e8f3b[_0xbfa2('0x1d')];this[_0xbfa2('0x1e')]=_0x2e8f3b[_0xbfa2('0x1e')];this[_0xbfa2('0x1f')]=_0x2e8f3b['ContactId'];this['ListId']=_0x2e8f3b[_0xbfa2('0x20')];this[_0xbfa2('0x21')]=_0x2e8f3b['UserId'];this[_0xbfa2('0x22')]=_0x2e8f3b['VoiceQueueId'];this[_0xbfa2('0x23')]=_0x2e8f3b['CampaignId'];this[_0xbfa2('0x24')]=_0x2e8f3b[_0xbfa2('0x24')]||'';this[_0xbfa2('0x25')]=_0x2e8f3b[_0xbfa2('0x25')]||'';}module[_0xbfa2('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 1e1a066..55f5f46 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3d8=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype'];(function(_0x9337f,_0x537ebb){var _0x4efca3=function(_0x5bae65){while(--_0x5bae65){_0x9337f['push'](_0x9337f['shift']());}};_0x4efca3(++_0x537ebb);}(_0xd3d8,0xfe));var _0x8d3d=function(_0x549c51,_0x29e6fd){_0x549c51=_0x549c51-0x0;var _0x264861=_0xd3d8[_0x549c51];return _0x264861;};'use strict';var util=require(_0x8d3d('0x0'));var _=require(_0x8d3d('0x1'));var moment=require(_0x8d3d('0x2'));function getSeconds(_0x58ac3c,_0x3fa723){var _0x16fcbf=moment(_0x58ac3c)[_0x8d3d('0x3')](0x0);var _0xe31f86=moment(_0x3fa723)['milliseconds'](0x0);return _0x16fcbf[_0x8d3d('0x4')](_0xe31f86,'seconds');}function Hangup(_0x2117ad,_0x4fe54b){this['state']=0x4;this[_0x8d3d('0x5')]=_0x8d3d('0x6');this['scheduledat']=_0x2117ad[_0x8d3d('0x7')];this[_0x8d3d('0x8')]=_0x2117ad['type'];this[_0x8d3d('0x9')]=_0x2117ad[_0x8d3d('0x8')]==='outbound'?'queue':_0x2117ad['type'];this[_0x8d3d('0xa')]=_0x2117ad[_0x8d3d('0xa')];this[_0x8d3d('0xb')]=_0x2117ad['countcongestionretry'];this[_0x8d3d('0xc')]=_0x2117ad[_0x8d3d('0xc')];this['countglobal']=_0x2117ad[_0x8d3d('0xa')]+_0x2117ad[_0x8d3d('0xb')]+_0x2117ad[_0x8d3d('0xc')]+_0x2117ad[_0x8d3d('0xd')]+_0x2117ad[_0x8d3d('0xe')]+_0x2117ad[_0x8d3d('0xf')]+_0x2117ad[_0x8d3d('0x10')]+_0x2117ad[_0x8d3d('0x11')];this['countnosuchnumberretry']=_0x2117ad[_0x8d3d('0xd')];this[_0x8d3d('0xe')]=_0x2117ad[_0x8d3d('0xe')];this[_0x8d3d('0xf')]=_0x2117ad[_0x8d3d('0xf')];this[_0x8d3d('0x10')]=_0x2117ad[_0x8d3d('0x10')];this[_0x8d3d('0x11')]=_0x2117ad['countagentrejectretry'];this[_0x8d3d('0x12')]=_0x4fe54b[_0x8d3d('0x12')];this[_0x8d3d('0x13')]=_0x2117ad[_0x8d3d('0x14')];this[_0x8d3d('0x15')]=_0x2117ad['number'];this[_0x8d3d('0x16')]=_0x2117ad[_0x8d3d('0x16')];this[_0x8d3d('0x17')]=_0x2117ad[_0x8d3d('0x17')];this['endtime']=moment()['format'](_0x8d3d('0x18'));this[_0x8d3d('0x19')]=getSeconds(_0x2117ad['responsetime'],_0x2117ad['starttime']);this[_0x8d3d('0x1a')]=0x0;this[_0x8d3d('0x1b')]=getSeconds(this[_0x8d3d('0x1c')],_0x2117ad[_0x8d3d('0x17')]);this[_0x8d3d('0x1d')]=_0x2117ad[_0x8d3d('0x1d')];this[_0x8d3d('0x1e')]=_0x8d3d('0x1f');this[_0x8d3d('0x20')]=_0x4fe54b[_0x8d3d('0x21')];this[_0x8d3d('0x22')]=_0x2117ad[_0x8d3d('0x22')];this[_0x8d3d('0x23')]=_0x2117ad[_0x8d3d('0x23')];this[_0x8d3d('0x24')]=_0x2117ad[_0x8d3d('0x24')];this['recallme']=_0x2117ad[_0x8d3d('0x25')];this[_0x8d3d('0x26')]=_0x2117ad[_0x8d3d('0x26')];this[_0x8d3d('0x27')]=_0x2117ad[_0x8d3d('0x27')];this[_0x8d3d('0x28')]=_0x2117ad[_0x8d3d('0x28')];this[_0x8d3d('0x29')]=_0x2117ad[_0x8d3d('0x29')];this[_0x8d3d('0x2a')]=_0x2117ad['CampaignId'];}module[_0x8d3d('0x2b')]=Hangup; \ No newline at end of file +var _0x0aef=['util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','number','starttime','responsetime','endtime','format','ringtime','holdtime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x26261c,_0x25069a){var _0x731e75=function(_0x1b9dff){while(--_0x1b9dff){_0x26261c['push'](_0x26261c['shift']());}};_0x731e75(++_0x25069a);}(_0x0aef,0x1c3));var _0xf0ae=function(_0x46d76f,_0x4d47ea){_0x46d76f=_0x46d76f-0x0;var _0x28af26=_0x0aef[_0x46d76f];return _0x28af26;};'use strict';var util=require(_0xf0ae('0x0'));var _=require(_0xf0ae('0x1'));var moment=require(_0xf0ae('0x2'));function getSeconds(_0x1f33c6,_0x59cb10){var _0x185735=moment(_0x1f33c6)[_0xf0ae('0x3')](0x0);var _0x1df53a=moment(_0x59cb10)['milliseconds'](0x0);return _0x185735[_0xf0ae('0x4')](_0x1df53a,'seconds');}function Hangup(_0x4fb0f0,_0x394de0){this[_0xf0ae('0x5')]=0x4;this[_0xf0ae('0x6')]=_0xf0ae('0x7');this[_0xf0ae('0x8')]=_0x4fb0f0[_0xf0ae('0x8')];this[_0xf0ae('0x9')]=_0x4fb0f0[_0xf0ae('0x9')];this['campaigntype']=_0x4fb0f0[_0xf0ae('0x9')]===_0xf0ae('0xa')?_0xf0ae('0xb'):_0x4fb0f0[_0xf0ae('0x9')];this[_0xf0ae('0xc')]=_0x4fb0f0['countbusyretry'];this['countcongestionretry']=_0x4fb0f0[_0xf0ae('0xd')];this[_0xf0ae('0xe')]=_0x4fb0f0['countnoanswerretry'];this[_0xf0ae('0xf')]=_0x4fb0f0[_0xf0ae('0xc')]+_0x4fb0f0[_0xf0ae('0xd')]+_0x4fb0f0[_0xf0ae('0xe')]+_0x4fb0f0[_0xf0ae('0x10')]+_0x4fb0f0[_0xf0ae('0x11')]+_0x4fb0f0[_0xf0ae('0x12')]+_0x4fb0f0[_0xf0ae('0x13')]+_0x4fb0f0[_0xf0ae('0x14')];this['countnosuchnumberretry']=_0x4fb0f0[_0xf0ae('0x10')];this['countdropretry']=_0x4fb0f0['countdropretry'];this['countabandonedretry']=_0x4fb0f0['countabandonedretry'];this[_0xf0ae('0x13')]=_0x4fb0f0['countmachineretry'];this[_0xf0ae('0x14')]=_0x4fb0f0[_0xf0ae('0x14')];this[_0xf0ae('0x15')]=_0x394de0['uniqueid'];this['calleridname']=_0x4fb0f0['name'];this['calleridnum']=_0x4fb0f0[_0xf0ae('0x16')];this['starttime']=_0x4fb0f0[_0xf0ae('0x17')];this[_0xf0ae('0x18')]=_0x4fb0f0['responsetime'];this[_0xf0ae('0x19')]=moment()[_0xf0ae('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xf0ae('0x1b')]=getSeconds(_0x4fb0f0[_0xf0ae('0x18')],_0x4fb0f0[_0xf0ae('0x17')]);this[_0xf0ae('0x1c')]=0x0;this['talktime']=getSeconds(this[_0xf0ae('0x19')],_0x4fb0f0['responsetime']);this[_0xf0ae('0xb')]=_0x4fb0f0[_0xf0ae('0xb')];this[_0xf0ae('0x1d')]=_0xf0ae('0x1e');this['reason']=_0x394de0[_0xf0ae('0x1f')];this['callback']=_0x4fb0f0[_0xf0ae('0x20')];this[_0xf0ae('0x21')]=_0x4fb0f0[_0xf0ae('0x21')];this[_0xf0ae('0x22')]=_0x4fb0f0[_0xf0ae('0x22')];this[_0xf0ae('0x23')]=_0x4fb0f0[_0xf0ae('0x23')];this[_0xf0ae('0x24')]=_0x4fb0f0['ContactId'];this[_0xf0ae('0x25')]=_0x4fb0f0['ListId'];this[_0xf0ae('0x26')]=_0x4fb0f0[_0xf0ae('0x26')];this[_0xf0ae('0x27')]=_0x4fb0f0[_0xf0ae('0x27')];this[_0xf0ae('0x28')]=_0x4fb0f0[_0xf0ae('0x28')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 8d25019..cc80716 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2b2=['uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','number','starttime','endtime','responsetime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff'];(function(_0x29ab67,_0x2b0d70){var _0xb3b0b1=function(_0x277970){while(--_0x277970){_0x29ab67['push'](_0x29ab67['shift']());}};_0xb3b0b1(++_0x2b0d70);}(_0xd2b2,0x1ab));var _0x2d2b=function(_0x1d6b55,_0x43ab65){_0x1d6b55=_0x1d6b55-0x0;var _0x1751f9=_0xd2b2[_0x1d6b55];return _0x1751f9;};'use strict';var util=require(_0x2d2b('0x0'));var _=require(_0x2d2b('0x1'));var moment=require(_0x2d2b('0x2'));function getSeconds(_0x1a306f,_0x5aad2a){var _0x2622ae=moment(_0x1a306f)[_0x2d2b('0x3')](0x0);var _0x306d32=moment(_0x5aad2a)[_0x2d2b('0x3')](0x0);return _0x2622ae[_0x2d2b('0x4')](_0x306d32,'seconds');}function History(_0x4d6e05){this[_0x2d2b('0x5')]=_0x4d6e05[_0x2d2b('0x5')];this['scheduledat']=_0x4d6e05[_0x2d2b('0x6')]||undefined;this[_0x2d2b('0x7')]=_0x4d6e05['type'];this[_0x2d2b('0x8')]=_0x4d6e05[_0x2d2b('0x7')]==='outbound'?_0x2d2b('0x9'):_0x4d6e05[_0x2d2b('0x7')];this['countbusyretry']=_0x4d6e05[_0x2d2b('0xa')];this[_0x2d2b('0xb')]=_0x4d6e05['countcongestionretry'];this['countnoanswerretry']=_0x4d6e05['countnoanswerretry'];this['countglobal']=_0x4d6e05[_0x2d2b('0xa')]+_0x4d6e05[_0x2d2b('0xb')]+_0x4d6e05[_0x2d2b('0xc')]+_0x4d6e05['countnosuchnumberretry']+_0x4d6e05[_0x2d2b('0xd')]+_0x4d6e05[_0x2d2b('0xe')]+_0x4d6e05[_0x2d2b('0xf')]+_0x4d6e05[_0x2d2b('0x10')];this[_0x2d2b('0x11')]=_0x4d6e05['countnosuchnumberretry'];this[_0x2d2b('0xd')]=_0x4d6e05[_0x2d2b('0xd')];this[_0x2d2b('0xe')]=_0x4d6e05['countabandonedretry'];this[_0x2d2b('0xf')]=_0x4d6e05[_0x2d2b('0xf')];this[_0x2d2b('0x10')]=_0x4d6e05['countagentrejectretry'];this[_0x2d2b('0x9')]=_0x4d6e05[_0x2d2b('0x9')];this[_0x2d2b('0x12')]=_0x4d6e05['name'];this[_0x2d2b('0x13')]=_0x4d6e05[_0x2d2b('0x14')];this[_0x2d2b('0x15')]=_0x4d6e05[_0x2d2b('0x15')];this['responsetime']=_0x4d6e05['responsetime'];this[_0x2d2b('0x16')]=_0x4d6e05['responsetime'];this['ringtime']=getSeconds(_0x4d6e05[_0x2d2b('0x17')],_0x4d6e05[_0x2d2b('0x15')]);this['holdtime']=0x0;this[_0x2d2b('0x18')]=0x0;this['callback']=_0x4d6e05['callback'];this[_0x2d2b('0x19')]=_0x4d6e05[_0x2d2b('0x19')];this[_0x2d2b('0x1a')]=_0x4d6e05[_0x2d2b('0x1a')];this[_0x2d2b('0x1b')]=_0x4d6e05[_0x2d2b('0x1b')];this[_0x2d2b('0x1c')]=_0x4d6e05[_0x2d2b('0x1c')];this[_0x2d2b('0x1d')]=_0x4d6e05[_0x2d2b('0x1d')];this[_0x2d2b('0x1e')]=_0x4d6e05[_0x2d2b('0x1e')];this[_0x2d2b('0x1f')]=_0x4d6e05[_0x2d2b('0x1f')];this[_0x2d2b('0x20')]=_0x4d6e05['CampaignId'];this[_0x2d2b('0x21')]=_0x4d6e05[_0x2d2b('0x21')]||'';this[_0x2d2b('0x22')]=_0x4d6e05[_0x2d2b('0x22')]||'';}module[_0x2d2b('0x23')]=History; \ No newline at end of file +var _0xb9a1=['countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xb9a1,0x11f));var _0x1b9a=function(_0x154f29,_0x56a6ec){_0x154f29=_0x154f29-0x0;var _0x3b76a9=_0xb9a1[_0x154f29];return _0x3b76a9;};'use strict';var util=require(_0x1b9a('0x0'));var _=require(_0x1b9a('0x1'));var moment=require('moment');function getSeconds(_0x4dcdad,_0x324f5f){var _0x4cac67=moment(_0x4dcdad)[_0x1b9a('0x2')](0x0);var _0x4c2f66=moment(_0x324f5f)[_0x1b9a('0x2')](0x0);return _0x4cac67[_0x1b9a('0x3')](_0x4c2f66,'seconds');}function History(_0x4aadb4){this[_0x1b9a('0x4')]=_0x4aadb4[_0x1b9a('0x4')];this['scheduledat']=_0x4aadb4[_0x1b9a('0x5')]||undefined;this[_0x1b9a('0x6')]=_0x4aadb4[_0x1b9a('0x6')];this[_0x1b9a('0x7')]=_0x4aadb4[_0x1b9a('0x6')]===_0x1b9a('0x8')?_0x1b9a('0x9'):_0x4aadb4['type'];this[_0x1b9a('0xa')]=_0x4aadb4['countbusyretry'];this[_0x1b9a('0xb')]=_0x4aadb4[_0x1b9a('0xb')];this[_0x1b9a('0xc')]=_0x4aadb4[_0x1b9a('0xc')];this[_0x1b9a('0xd')]=_0x4aadb4[_0x1b9a('0xa')]+_0x4aadb4[_0x1b9a('0xb')]+_0x4aadb4[_0x1b9a('0xc')]+_0x4aadb4[_0x1b9a('0xe')]+_0x4aadb4[_0x1b9a('0xf')]+_0x4aadb4[_0x1b9a('0x10')]+_0x4aadb4['countmachineretry']+_0x4aadb4[_0x1b9a('0x11')];this[_0x1b9a('0xe')]=_0x4aadb4[_0x1b9a('0xe')];this[_0x1b9a('0xf')]=_0x4aadb4[_0x1b9a('0xf')];this[_0x1b9a('0x10')]=_0x4aadb4[_0x1b9a('0x10')];this['countmachineretry']=_0x4aadb4[_0x1b9a('0x12')];this[_0x1b9a('0x11')]=_0x4aadb4[_0x1b9a('0x11')];this[_0x1b9a('0x9')]=_0x4aadb4['queue'];this[_0x1b9a('0x13')]=_0x4aadb4[_0x1b9a('0x14')];this[_0x1b9a('0x15')]=_0x4aadb4[_0x1b9a('0x16')];this[_0x1b9a('0x17')]=_0x4aadb4[_0x1b9a('0x17')];this['responsetime']=_0x4aadb4[_0x1b9a('0x18')];this[_0x1b9a('0x19')]=_0x4aadb4[_0x1b9a('0x18')];this[_0x1b9a('0x1a')]=getSeconds(_0x4aadb4[_0x1b9a('0x18')],_0x4aadb4['starttime']);this[_0x1b9a('0x1b')]=0x0;this[_0x1b9a('0x1c')]=0x0;this[_0x1b9a('0x1d')]=_0x4aadb4['callback'];this[_0x1b9a('0x1e')]=_0x4aadb4['callbackuniqueid'];this[_0x1b9a('0x1f')]=_0x4aadb4[_0x1b9a('0x1f')];this['recallme']=_0x4aadb4[_0x1b9a('0x20')];this['ContactId']=_0x4aadb4[_0x1b9a('0x21')];this[_0x1b9a('0x22')]=_0x4aadb4[_0x1b9a('0x22')];this['UserId']=_0x4aadb4['UserId'];this[_0x1b9a('0x23')]=_0x4aadb4[_0x1b9a('0x23')];this['CampaignId']=_0x4aadb4['CampaignId'];this[_0x1b9a('0x24')]=_0x4aadb4[_0x1b9a('0x24')]||'';this[_0x1b9a('0x25')]=_0x4aadb4['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 7695348..ea287df 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 _0xb50d=['[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','timezones','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','dialPowerLevel','checkPreviewRecallReminder','throttle','filter','online','map','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','outbound','XMD-VOICEQUEUEID','tags','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','substring','trim','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','stateGlobal','outboundNoAnswerCallsDay','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','reason','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveInterval','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','startMethodPredictive','recalculate\x20predictive\x20at','averageHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','getDataPredictive','predictiveIntervalDroppedCallsCallersExit','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','predictiveIntervalPauses','check\x20failure','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','inBlackList','handleIvr','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','[actionOriginate]\x20','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','checkContactBlack','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','[busyFactor]','m\x20=\x20','Ts\x20=\x20','Umin\x20=\x20','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./history','./final','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBookedRR','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','syncQueueSummary','syncHangup','syncNewExten','queuemember','syncQueueMember','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Interval','Intervals','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','type','loggedIn','sumDuration','total','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\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','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','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','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','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','pTalking','available','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','endtime','clearZombieChannels','[uniqueid]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','reachable','SIP/%s','syncVarSet','uniqueid','variable','amdstatus','exten','dialAMDActive','value','HANGUP','state','HangupInAMD','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','outboundAnswerCallsDay','statedesc','Machine','membername','countmachineretry','countglobal','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','createStateFinal','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','AMD','custom:amd','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','[syncAgentComplete][createHistory][0]','countbusyretry','reason\x2019\x20machine....','minutes','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','syncAgentComplete','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridnum','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','stateinterface','strategy','queueBooked','push','idHopper','paused','queueStatusComplete','stringify','syncQueueStatusComplete','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0xb50d,0xea));var _0xdb50=function(_0x4b980e,_0x496eaa){_0x4b980e=_0x4b980e-0x0;var _0x457942=_0xb50d[_0x4b980e];return _0x457942;};'use strict';var util=require(_0xdb50('0x0'));var _=require(_0xdb50('0x1'));var BPromise=require(_0xdb50('0x2'));var uuid=require(_0xdb50('0x3'));var moment=require(_0xdb50('0x4'));var rr=require('rr');var md5=require(_0xdb50('0x5'));var Redis=require(_0xdb50('0x6'));var ut=require(_0xdb50('0x7'));var config=require(_0xdb50('0x8'));var logger=require(_0xdb50('0x9'))(_0xdb50('0xa'));var loggerBooked=require('../../../config/logger')(_0xdb50('0xb'));var loggerPredictive=require(_0xdb50('0x9'))(_0xdb50('0xc'));var loggerPredictiveCalls=require(_0xdb50('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xdb50('0x9'))('syncQueueSummary');var ami=require(_0xdb50('0xd'));config[_0xdb50('0xe')]=_['defaults'](config[_0xdb50('0xe')],{'host':_0xdb50('0xf'),'port':0x18eb});var io=require(_0xdb50('0x10'))(new Redis(config[_0xdb50('0xe')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xdb50('0x11'));var cmHopperBlack=require(_0xdb50('0x12'));var voiceQueueRt=require(_0xdb50('0x13'));var RpcSetting=require(_0xdb50('0x14'));var Action=require('./action');var History=require(_0xdb50('0x15'));var Final=require(_0xdb50('0x16'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xdb50('0x17'));var Hangup=require(_0xdb50('0x18'));var ipAgi=process['env'][_0xdb50('0x19')]||_0xdb50('0x1a');var strategy={'rrmemory':_0xdb50('0x1b'),'roundrobin':_0xdb50('0x1c')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xdb50('0x1d')][_0xdb50('0x1e')]=function(_0xb10433){this[_0xdb50('0x1f')]=this[_0xdb50('0x1f')]?this[_0xdb50('0x1f')][_0xdb50('0x20')](_0xb10433):_0xb10433();};function Dialer(_0x558b35,_0x2bd9f6){this[_0xdb50('0x21')]=new Sequence();this[_0xdb50('0x22')]=_0x2bd9f6;this['voiceQueues']=_0x558b35[_0xdb50('0x23')];this[_0xdb50('0x24')]=_0x558b35[_0xdb50('0x24')];this[_0xdb50('0x25')]=_0x558b35[_0xdb50('0x25')];this[_0xdb50('0x26')]=_0x558b35[_0xdb50('0x26')];this[_0xdb50('0x27')]=config[_0xdb50('0x27')]||0x2;this[_0xdb50('0x28')]={};this[_0xdb50('0x29')]={};this['contactsId']={};this[_0xdb50('0x2a')]={};this['optionPredictive']={};this[_0xdb50('0x2b')]={};this[_0xdb50('0x2c')]={};this[_0xdb50('0x2d')]={};this['queueBooked']={};this[_0xdb50('0x2e')]={};ami['on']('agentconnect',this[_0xdb50('0x2f')]['bind'](this));ami['on'](_0xdb50('0x30'),this[_0xdb50('0x31')][_0xdb50('0x32')](this));ami['on']('originateresponse',this[_0xdb50('0x33')][_0xdb50('0x32')](this));ami['on'](_0xdb50('0x34'),this['syncAgentComplete'][_0xdb50('0x32')](this));ami['on']('custom:queuesummary',this[_0xdb50('0x35')][_0xdb50('0x32')](this));ami['on']('hangup',this[_0xdb50('0x36')][_0xdb50('0x32')](this));ami['on']('newexten',this[_0xdb50('0x37')][_0xdb50('0x32')](this));ami['on']('varset',this['syncVarSet'][_0xdb50('0x32')](this));ami['on'](_0xdb50('0x38'),this[_0xdb50('0x39')][_0xdb50('0x32')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0xdb50('0x32')](this));this['loopCampaigns']();this[_0xdb50('0x3a')]();RpcSetting['getSettings']()[_0xdb50('0x3b')](function(_0x280cc0){previewRecallmeReminderInterval=_0x280cc0[_0xdb50('0x3c')];});}function isNotNull(_0x20cf4b){return _0x20cf4b!==null&&!_[_0xdb50('0x3d')](_0x20cf4b);}function checkIsLoggedIn(_0x28bb90,_0x573563){return function(){if(_0x573563<=0x0){_0x28bb90[_0xdb50('0x3e')]=_0xdb50('0x3f');throw _0x28bb90[_0xdb50('0x40')]+_0xdb50('0x41');}};}function isActive(_0x3c9b7a){return _0x3c9b7a;}function checkIsActive(_0x366359,_0x4c92be){return function(){if(!isActive(_0x4c92be)){_0x366359[_0xdb50('0x3e')]=_0xdb50('0x42');throw _0x366359[_0xdb50('0x40')]+_0xdb50('0x43');}};}function checkInterval(_0x310802){return function(){if(!isNotNull(_0x310802['Interval'])){_0x310802[_0xdb50('0x3e')]=_0xdb50('0x44');throw _0x310802[_0xdb50('0x40')]+_0xdb50('0x45');}if(!isNotNull(_0x310802['Interval']['Intervals'])){_0x310802[_0xdb50('0x3e')]=_0xdb50('0x44');throw _0x310802[_0xdb50('0x40')]+_0xdb50('0x45');}if(!isNotNull(_[_0xdb50('0x46')](_0x310802[_0xdb50('0x47')][_0xdb50('0x48')]))){_0x310802[_0xdb50('0x3e')]=_0xdb50('0x44');throw _0x310802[_0xdb50('0x40')]+_0xdb50('0x45');}};}function msgResponse(_0x3bb52c,_0x5d1823,_0x5ae704){return{'action':_0x3bb52c,'response':_0x5d1823,'message':_0x5ae704,'stack':_0x5ae704};}function myreject(_0x1f8356){return function(_0x1ff616){return _0x1f8356(msgResponse(_0xdb50('0x49'),_0xdb50('0x4a'),JSON['stringify'](_0x1ff616)));};}function getSeconds(_0x601784,_0x822f85){var _0x187797=moment(_0x601784)['milliseconds'](0x0);var _0x295f6e=moment(_0x822f85)[_0xdb50('0x4b')](0x0);return _0x187797[_0xdb50('0x4c')](_0x295f6e,_0xdb50('0x4d'));}function emit(_0x288e97,_0xef2965,_0x3d625c){io['to'](_0x288e97)[_0xdb50('0x4e')](_0xef2965,_0x3d625c);}function emitVoiceQueueSummary(_0x52c799){if(_0x52c799[_0xdb50('0x4f')]==='outbound'){var _0x4eca1f={'id':_0x52c799['id'],'name':_0x52c799[_0xdb50('0x40')],'strategy':_0x52c799['strategy'],'answered':_0x52c799['answered'],'available':_0x52c799['available'],'loggedIn':_0x52c799[_0xdb50('0x50')],'pTalking':_0x52c799['pTalking'],'sumBillable':_0x52c799['sumBillable'],'sumDuration':_0x52c799[_0xdb50('0x51')],'sumHoldTime':_0x52c799['sumHoldTime']||0x0,'talking':_0x52c799['talking'],'total':_0x52c799[_0xdb50('0x52')],'type':_0x52c799[_0xdb50('0x4f')],'unmanaged':_0x52c799[_0xdb50('0x53')],'abandoned':_0x52c799['abandoned'],'waiting':_0x52c799[_0xdb50('0x54')],'loggedInDb':_0x52c799[_0xdb50('0x55')],'dialActive':_0x52c799['dialActive'],'dialMethod':_0x52c799[_0xdb50('0x56')],'dialOriginateCallerIdName':_0x52c799[_0xdb50('0x57')],'dialOriginateCallerIdNumber':_0x52c799['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x52c799[_0xdb50('0x58')],'dialPrefix':_0x52c799[_0xdb50('0x59')],'outboundAnswerAgiCallsDay':_0x52c799[_0xdb50('0x5a')],'outboundAnswerCallsDay':_0x52c799['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x52c799[_0xdb50('0x5b')],'outboundBusyCallsDay':_0x52c799['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x52c799[_0xdb50('0x5c')],'outboundDropCallsDayACS':_0x52c799[_0xdb50('0x5d')],'outboundDropCallsDayCallersExit':_0x52c799[_0xdb50('0x5e')],'outboundDropCallsDayTimeout':_0x52c799[_0xdb50('0x5f')],'outboundNoAnswerCallsDay':_0x52c799['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x52c799[_0xdb50('0x60')],'outboundOriginateFailureCallsDay':_0x52c799[_0xdb50('0x61')],'outboundReCallsDay':_0x52c799[_0xdb50('0x62')],'outboundRejectCallsDay':_0x52c799[_0xdb50('0x63')],'outboundUnknownCallsDay':_0x52c799[_0xdb50('0x64')],'predictiveIntervalAnsweredCalls':_0x52c799[_0xdb50('0x65')],'predictiveIntervalAvgHoldtime':_0x52c799['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x52c799[_0xdb50('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x52c799['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x52c799[_0xdb50('0x67')],'predictiveIntervalErlangCalls':_0x52c799[_0xdb50('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x52c799[_0xdb50('0x69')],'predictiveIntervalHitRate':_0x52c799[_0xdb50('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x52c799[_0xdb50('0x6b')],'predictiveIntervalPauses':_0x52c799['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x52c799[_0xdb50('0x6c')],'predictiveIntervalTotalCalls':_0x52c799['predictiveIntervalTotalCalls'],'message':_0x52c799[_0xdb50('0x3e')],'originated':_0x52c799[_0xdb50('0x6d')],'erlangCalls':_0x52c799[_0xdb50('0x6e')],'erlangCallToSecond':_0x52c799[_0xdb50('0x6f')],'erlangAbandonmentRate':_0x52c799[_0xdb50('0x70')],'erlangBusyFactor':_0x52c799[_0xdb50('0x71')],'startPredictive':_0x52c799[_0xdb50('0x2b')],'startProgressive':_0x52c799[_0xdb50('0x2c')]};if(_0x52c799[_0xdb50('0x72')]){_0x4eca1f[_0xdb50('0x72')]={'id':_0x52c799[_0xdb50('0x72')]['id'],'name':_0x52c799[_0xdb50('0x72')][_0xdb50('0x40')],'active':_0x52c799[_0xdb50('0x72')][_0xdb50('0x73')],'callerid':_0x52c799['Trunk']['callerid']};}if(_0x52c799[_0xdb50('0x47')]){_0x4eca1f['Interval']={'id':_0x52c799[_0xdb50('0x47')]['id'],'name':_0x52c799[_0xdb50('0x47')]['name']};}var _0x6b9f18=md5(JSON['stringify'](_0x4eca1f));if(_0x52c799[_0xdb50('0x5')]!==_0x6b9f18){_0x52c799[_0xdb50('0x5')]=_0x6b9f18;emit(util[_0xdb50('0x74')](_0xdb50('0x75'),_0x4eca1f[_0xdb50('0x40')]),_0xdb50('0x76'),_0x4eca1f);}}}function emitCampaignSummary(_0x4f3498){if(_0x4f3498[_0xdb50('0x4f')]===_0xdb50('0x77')){emit(util['format'](_0xdb50('0x78'),_0x4f3498[_0xdb50('0x40')]),_0xdb50('0x79'),_0x4f3498);}}function checkGetDataPredictive(_0x107bb5){if(isNotNull(_0x107bb5)&&!_['isEmpty'](_0x107bb5)){loggerPredictive['info'](_0xdb50('0x7a'));loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x7c'),_0x107bb5['predictiveIntervalTotalCalls']);loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x7d'),_0x107bb5[_0xdb50('0x65')]);loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x7e'),_0x107bb5[_0xdb50('0x67')]);loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x7f'),_0x107bb5['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x80'),_0x107bb5[_0xdb50('0x81')]);loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x82'),_0x107bb5['predictiveIntervalAvgTalktime']);loggerPredictive[_0xdb50('0x7b')]('---------------------------');if(_0x107bb5[_0xdb50('0x83')]>0x0){if(!_[_0xdb50('0x3d')](_0x107bb5[_0xdb50('0x66')])&&_0x107bb5[_0xdb50('0x66')]>0x0){return!![];}loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x84'));if(!_['isUndefined'](_0x107bb5[_0xdb50('0x81')])&&_0x107bb5['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x85'));}else{loggerPredictive[_0xdb50('0x7b')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x86'));}return![];}function mergeDataErlangB(_0x2bcab2){return function(_0x19cb75){loggerPredictive['info'](_0xdb50('0x87'));loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x88'),_0x19cb75[_0xdb50('0x6e')]);loggerPredictive['info'](_0xdb50('0x89'),_0x19cb75[_0xdb50('0x6f')]);loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x8a'),_0x19cb75[_0xdb50('0x70')]);loggerPredictive[_0xdb50('0x7b')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x19cb75[_0xdb50('0x71')]);loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x8a'),_0x19cb75[_0xdb50('0x70')]);loggerPredictive[_0xdb50('0x7b')]('---------------------------');_['merge'](_0x2bcab2,_0x19cb75);};}function getDiff(_0x5accda){var _0x2147d3=moment()[_0xdb50('0x4b')](0x0);var _0x263651=moment(_0x5accda)[_0xdb50('0x4b')](0x0);return _0x2147d3[_0xdb50('0x4c')](_0x263651,_0xdb50('0x4d'));}function ifInterval(_0x43959b,_0x9082d1){if(_[_0xdb50('0x3d')](_0x9082d1)){return![];}return getDiff(_0x9082d1)<_0x43959b*0x3c;}function freeVariablesPredictive(_0x2b505f){if(isNotNull(_0x2b505f)){if(!_['isUndefined'](_0x2b505f[_0xdb50('0x2c')])){_0x2b505f[_0xdb50('0x2c')]=undefined;loggerPredictive[_0xdb50('0x7b')](_0x2b505f[_0xdb50('0x40')],_0xdb50('0x8b'));}if(!_['isUndefined'](_0x2b505f[_0xdb50('0x2b')])){_0x2b505f[_0xdb50('0x2b')]=undefined;loggerPredictive['info'](_0x2b505f[_0xdb50('0x40')],_0xdb50('0x8c'));}if(!_[_0xdb50('0x3d')](_0x2b505f[_0xdb50('0x8d')])){clearInterval(_0x2b505f[_0xdb50('0x8d')]);_0x2b505f['handlePredictive']=undefined;loggerPredictive['info'](_0x2b505f[_0xdb50('0x40')],_0xdb50('0x8e'));}}}function erlangb(_0x50f871,_0x3ad5b5){if(_0x3ad5b5===0x0){return 0x0;}var _0x13ed2b=0x1;for(var _0x4fe513=0x1;_0x4fe513<=_0x3ad5b5;_0x4fe513+=0x1){_0x13ed2b=0x1+_0x13ed2b*_0x4fe513/_0x50f871;}return 0x1/_0x13ed2b;}function isVoiceQueueOutbound(_0x3df9a8){return _0x3df9a8==='outbound';}function isNotPreview(_0x3b68fd){return _0x3b68fd!==_0xdb50('0x22');}function isCampaignIvr(_0x28e329){return _0x28e329===_0xdb50('0x77');}function getCallerId(_0x451404,_0xb04be5,_0x27609a){if(!_['isUndefined'](_0x27609a)&&typeof _0x27609a==='string'&&!_['isEmpty'](_0x27609a)){if(!_[_0xdb50('0x3d')](_0xb04be5)&&typeof _0xb04be5===_0xdb50('0x8f')&&!_[_0xdb50('0x46')](_0xb04be5)){return util[_0xdb50('0x74')](_0xdb50('0x90'),_0xb04be5,_0x27609a);}return util['format'](_0xdb50('0x90'),_0x27609a,_0x27609a);}if(!_['isUndefined'](_0x451404)&&typeof _0x451404===_0xdb50('0x8f')&&!_[_0xdb50('0x46')](_0x451404)){return _0x451404;}return _0xdb50('0x91');}function loggerCatchQueueSummary(_0x393889,_0x63fd95){return function(_0x537e6c){freeVariablesPredictive(_0x63fd95);emitVoiceQueueSummary(_0x63fd95);emitCampaignSummary(_0x63fd95);loggerSyncQueueSummary[_0xdb50('0x92')](_0x393889,util['inspect'](_0x537e6c,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x266d46,_0x36e3a8){return function(_0xe6226c){loggerPredictive[_0xdb50('0x92')](_0x36e3a8[_0xdb50('0x40')],_0x266d46);loggerPredictive[_0xdb50('0x92')](_0xe6226c[_0xdb50('0x93')]);freeVariablesPredictive(_0x36e3a8);};}function loggerCatch(_0x2c4820){return function(_0x4301de){logger[_0xdb50('0x92')](_0x2c4820,util[_0xdb50('0x94')](_0x4301de,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1acb3e){return _0x1acb3e&&!_[_0xdb50('0x3d')](_0x1acb3e)&&_0x1acb3e[_0xdb50('0x95')]>0x0;}function decremetOriginate(_0x3290fc){if(!_['isUndefined'](_0x3290fc)&&_0x3290fc!==null){if(typeof _0x3290fc[_0xdb50('0x6d')]!==_0xdb50('0x96')){if(_0x3290fc[_0xdb50('0x6d')]>0x0){_0x3290fc[_0xdb50('0x6d')]-=0x1;}else{logger[_0xdb50('0x92')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xdb50('0x92')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x511a19,_0x567310,_0x54e176){if(_0x567310>_0x54e176){for(var _0x383aae=0x0;_0x383aae<_0x567310-_0x54e176;_0x383aae+=0x1){decremetOriginate(_0x511a19);}}}function loggerGetContactDialer(_0x3ec6ee,_0x20bc58,_0x2de309){return function(_0x370cb3){checkContactLowerLimitOriginate(_0x20bc58,_0x2de309,0x0);logger['error'](_0x3ec6ee,util[_0xdb50('0x94')](_0x370cb3,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4d39c4){return function(_0x3a0a37){if(isNotNull(_0x3a0a37)&&isNotNull(_0x3a0a37[0x0])){if(_0x3a0a37[0x0][_0xdb50('0x97')]>0x0){_0x4d39c4[_0xdb50('0x3e')]=_0xdb50('0x98');logger[_0xdb50('0x7b')](_0xdb50('0x99')+_0x4d39c4[_0xdb50('0x40')],_0x3a0a37[0x0][_0xdb50('0x97')],_0xdb50('0x9a'));}else{_0x4d39c4[_0xdb50('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xdb50('0x7b')](_0xdb50('0x9b')+_0x4d39c4[_0xdb50('0x40')]);}}};}function notSendMessagesQueue(_0x258492){if(_0x258492[_0xdb50('0x9c')]){freeVariablesPredictive(_0x258492);if(_0x258492[_0xdb50('0x6d')]===0x0&&_0x258492[_0xdb50('0x9d')]===0x0&&_0x258492[_0xdb50('0x54')]===0x0&&(_0x258492[_0xdb50('0x9e')]||0x0)===0x0){_0x258492[_0xdb50('0x9c')]=![];_0x258492[_0xdb50('0x9f')]=0x0;_0x258492[_0xdb50('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x258492[_0xdb50('0x40')],_0xdb50('0xa0'));}else{_0x258492[_0xdb50('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xdb50('0x92')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x258492[_0xdb50('0x40')],_0xdb50('0xa1'));}emitVoiceQueueSummary(_0x258492);}}function notSendMessagesCampaign(_0x139830){if(_0x139830['sendMessageOneNotActive']){if(_0x139830[_0xdb50('0x6d')]===0x0){_0x139830['sendMessageOneNotActive']=![];_0x139830[_0xdb50('0x3e')]=_0xdb50('0x42');loggerSyncQueueSummary[_0xdb50('0x92')](_0xdb50('0xa2'),_0x139830[_0xdb50('0x40')],_0xdb50('0xa0'));}else{_0x139830['message']=_0xdb50('0xa3');loggerSyncQueueSummary[_0xdb50('0x92')](_0xdb50('0xa2'),_0x139830[_0xdb50('0x40')],_0xdb50('0xa1'));}emitCampaignSummary(_0x139830);}}function createObjHistory(_0x5d301a,_0x20fda0,_0x458294,_0xc0d3b,_0x493a98){_0x5d301a[_0xdb50('0x3e')]=_0x458294;var _0x37e9be=new Action(_0x5d301a,_0x20fda0);var _0x293c1c=new History(_0x37e9be);_0x293c1c['state']=_0xc0d3b;_0x293c1c['statedesc']=_0x493a98;_0x293c1c[_0xdb50('0xa4')]=_0x37e9be['starttime'];return _0x293c1c;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x49b762=this;setInterval(function(){_0x49b762[_0xdb50('0xa5')](_0x49b762[_0xdb50('0x2a')],_0xdb50('0xa6'));_0x49b762[_0xdb50('0xa5')](_0x49b762[_0xdb50('0x29')],'[actions]');},0x32c8);};Dialer[_0xdb50('0x1d')][_0xdb50('0xa5')]=function(_0x5ddc4e,_0xddbe4e){var _0x3c82c9=this;for(var _0x1bcf94 in _0x5ddc4e){if(typeof _0x5ddc4e[_0x1bcf94]!==_0xdb50('0x96')){this[_0xdb50('0x21')][_0xdb50('0x1e')](function(){if(!_[_0xdb50('0xa7')](_0x5ddc4e[_0x1bcf94])){return ami[_0xdb50('0xa8')]({'action':_0xdb50('0xa9'),'channel':_0x5ddc4e[_0x1bcf94][_0xdb50('0xaa')]})[_0xdb50('0xab')](function(_0x5f4e28){if(_0x5f4e28[_0xdb50('0x3e')]===_0xdb50('0xac')){setTimeout(function(){if(_0x5ddc4e[_0x1bcf94]&&_0x5ddc4e[_0x1bcf94][_0xdb50('0x4f')]!==_0xdb50('0x77')){_0x3c82c9[_0xdb50('0xad')](_0x3c82c9[_0xdb50('0x23')][_0x5ddc4e[_0x1bcf94][_0xdb50('0xae')]]);logger[_0xdb50('0x92')](_0xdb50('0xaf'),_0xddbe4e,_0x1bcf94,_0x5ddc4e[_0x1bcf94][_0xdb50('0xae')]);delete _0x5ddc4e[_0x1bcf94];}if(_0x5ddc4e[_0x1bcf94]&&_0x5ddc4e[_0x1bcf94][_0xdb50('0x4f')]===_0xdb50('0x77')){_0x3c82c9['updateOriginated'](_0x3c82c9[_0xdb50('0x24')][_0x5ddc4e[_0x1bcf94]['queue']]);logger['error'](_0xdb50('0xb0'),_0xddbe4e,_0x1bcf94,_0x5ddc4e[_0x1bcf94][_0xdb50('0xae')]);delete _0x5ddc4e[_0x1bcf94];}},0x2328);}});}});}}};Dialer[_0xdb50('0x1d')][_0xdb50('0xb1')]=function(_0x335b6f){return BPromise[_0xdb50('0xb2')]()[_0xdb50('0x3b')](cmHopper['countReScheduled'](_0x335b6f))[_0xdb50('0xab')](loggerCatch(_0xdb50('0xb3')));};Dialer[_0xdb50('0x1d')]['checkIsBlackList']=function(_0x1d80e2){return BPromise[_0xdb50('0xb2')]()[_0xdb50('0x3b')](cmHopperBlack[_0xdb50('0xb4')](_0x1d80e2))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0xdb50('0x1d')]['checkIsBlackListIvr']=function(_0x5f343b){return BPromise[_0xdb50('0xb2')]()[_0xdb50('0x3b')](cmHopperBlack[_0xdb50('0xb5')](_0x5f343b))[_0xdb50('0xab')](loggerCatch(_0xdb50('0xb6')));};Dialer[_0xdb50('0x1d')]['averageHandleTime']=function(_0x219c6e){return BPromise[_0xdb50('0xb2')]()[_0xdb50('0x3b')](cmHopperHistory[_0xdb50('0xb7')](_0x219c6e))[_0xdb50('0xab')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xdb50('0x1d')]['rescheduleContact']=function(_0x2733f8){return BPromise[_0xdb50('0xb2')]()[_0xdb50('0x3b')](cmHopper[_0xdb50('0xb8')](_0x2733f8))[_0xdb50('0xab')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype'][_0xdb50('0xb9')]=function(_0xfd7fe4,_0x51fda4,_0x456ea5){return BPromise[_0xdb50('0xb2')]()['then'](cmHopper[_0xdb50('0xb9')](_0xfd7fe4,_0x51fda4,_0x456ea5))[_0xdb50('0xab')](loggerCatch(_0xdb50('0xba')));};Dialer[_0xdb50('0x1d')][_0xdb50('0xbb')]=function(_0x3124ad,_0x46e432,_0x56411c,_0x4f7c1b,_0x8b31ff){return BPromise[_0xdb50('0xb2')]()[_0xdb50('0x3b')](cmHopper[_0xdb50('0xbb')](_0x3124ad,_0x46e432,_0x56411c,_0x4f7c1b))['catch'](function(_0x1ee281){_0x8b31ff['temp']-=_0x56411c;_0x8b31ff['temp']=_0x8b31ff[_0xdb50('0xbc')]>0x0?_0x8b31ff['temp']:0x0;loggerCatch(_0xdb50('0xbd'))(_0x1ee281);});};Dialer[_0xdb50('0x1d')][_0xdb50('0xbe')]=function(_0x4ae84b,_0xa34735,_0x2550b9,_0x4a8ea6){return BPromise[_0xdb50('0xb2')]()[_0xdb50('0x3b')](cmHopper[_0xdb50('0xbe')](_0x4ae84b,_0xa34735,_0x2550b9))[_0xdb50('0xab')](function(_0x52059f){_0x4a8ea6[_0xdb50('0xbc')]-=_0xa34735;_0x4a8ea6['temp']=_0x4a8ea6['temp']>0x0?_0x4a8ea6[_0xdb50('0xbc')]:0x0;loggerCatch(_0xdb50('0xbf'))(_0x52059f);});};Dialer['prototype'][_0xdb50('0xc0')]=function(_0x1754e8){return BPromise['resolve']()[_0xdb50('0x3b')](voiceQueueRt[_0xdb50('0xc0')](_0x1754e8))['catch'](loggerCatch(_0xdb50('0xc1')));};Dialer[_0xdb50('0x1d')][_0xdb50('0xc2')]=function(_0x2bc6c5){return BPromise[_0xdb50('0xb2')]()['then'](cmHopper['moveContactManagedDialer'](_0x2bc6c5))[_0xdb50('0xab')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xdb50('0x1d')][_0xdb50('0xc3')]=function(_0x248956){return BPromise[_0xdb50('0xb2')]()['then'](cmHopperHistory[_0xdb50('0xc3')](_0x248956))[_0xdb50('0xab')](loggerCatch(_0xdb50('0xc4')));};Dialer['prototype']['updateOriginated']=function(_0x5dee1b){if(!_[_0xdb50('0x3d')](_0x5dee1b)&&_0x5dee1b!==null){if(typeof _0x5dee1b['originated']!=='undefined'){if(_0x5dee1b[_0xdb50('0x6d')]>0x0){_0x5dee1b[_0xdb50('0x6d')]-=0x1;}else{logger['error'](_0xdb50('0xc5'));}}}else{logger[_0xdb50('0x92')](_0xdb50('0xc6'));}};Dialer[_0xdb50('0x1d')][_0xdb50('0xc7')]=function(_0x339f28,_0x5cc386){var _0x14653e=this;return function(_0x4ce0b6){_0x14653e['updateOriginated'](_0x5cc386);logger['error'](_0x339f28,util['inspect'](_0x4ce0b6,{'showHidden':![],'depth':null}));};};Dialer[_0xdb50('0x1d')][_0xdb50('0xc8')]=function(_0x3f43f1,_0x1bde2e,_0x5e8e89){var _0x38dc52={'state':0x19,'statedesc':_0xdb50('0xc9')};this[_0xdb50('0xad')](_0x1bde2e);this[_0xdb50('0xca')](_[_0xdb50('0xcb')](_0x38dc52,_[_0xdb50('0xcc')](_0x5e8e89,[_0xdb50('0xcd'),_0xdb50('0xce'),_0xdb50('0xcf'),_0xdb50('0xd0'),_0xdb50('0xd1')])),_0xdb50('0xd2'),_0xdb50('0xd3'));logger[_0xdb50('0x92')](_0x3f43f1);};Dialer['prototype'][_0xdb50('0xd4')]=function(_0x22a935){return _0x22a935===_0xdb50('0xd5');};Dialer[_0xdb50('0x1d')]['isTrunkReachable']=function(_0x349cf1){return!_[_0xdb50('0x3d')](_0x349cf1)&&_0x349cf1&&!_['isUndefined'](_0x349cf1['name'])&&!_[_0xdb50('0x3d')](_0x349cf1[_0xdb50('0x73')])&&_0x349cf1[_0xdb50('0x73')]&&(this[_0xdb50('0x26')][util[_0xdb50('0x74')]('SIP/%s',_0x349cf1[_0xdb50('0x40')])][_0xdb50('0xa9')]===_0xdb50('0xd6')||this[_0xdb50('0x26')][util[_0xdb50('0x74')](_0xdb50('0xd7'),_0x349cf1['name'])]['status']==='unmonitored');};Dialer[_0xdb50('0x1d')]['saveInDb']=function(_0x8d793a,_0x31bfc3,_0x2461d8){this[_0xdb50('0xc3')](_0x8d793a)['catch'](loggerCatch(_0x31bfc3));this[_0xdb50('0xc2')](_0x8d793a)[_0xdb50('0xab')](loggerCatch(_0x2461d8));};Dialer[_0xdb50('0x1d')][_0xdb50('0xd8')]=function(_0x3e561a){var _0x187718=this[_0xdb50('0x2a')][_0x3e561a[_0xdb50('0xd9')]];var _0x4b19bc;if(!_[_0xdb50('0xa7')](_0x3e561a)&&!_[_0xdb50('0xa7')](_0x3e561a['variable'])&&!_[_0xdb50('0xa7')](_0x3e561a[_0xdb50('0xda')][_0xdb50('0xdb')])&&_0x3e561a[_0xdb50('0xdc')]==='xcally-motion-dialer'&&_0x187718){if(_0x187718['type']!==_0xdb50('0x77')&&this[_0xdb50('0x23')][_0x187718['queue']][_0xdb50('0xdd')]&&_0x3e561a[_0xdb50('0xde')]===_0xdb50('0xdf')){delete this[_0xdb50('0x2a')][_0x3e561a[_0xdb50('0xd9')]];this[_0xdb50('0xad')](this[_0xdb50('0x23')][_0x187718[_0xdb50('0xae')]]);this['voiceQueues'][_0x187718[_0xdb50('0xae')]]['outboundAnswerCallsDay']+=0x1;this[_0xdb50('0x23')][_0x187718[_0xdb50('0xae')]][_0xdb50('0x5a')]+=0x1;_0x4b19bc=new Hangup(_0x187718,_0x3e561a);_0x4b19bc[_0xdb50('0xe0')]=0x12;_0x4b19bc['statedesc']=_0xdb50('0xe1');_0x4b19bc['membername']='AMD';ami[_0xdb50('0x4e')]('custom:amd',ut[_0xdb50('0xe2')](_0x4b19bc,_0xdb50('0xe3')));this[_0xdb50('0xca')](_0x4b19bc,_0xdb50('0xe4'),_0xdb50('0xe5'));}if(_0x187718[_0xdb50('0x4f')]!==_0xdb50('0x77')&&this[_0xdb50('0x23')][_0x187718['queue']][_0xdb50('0xdd')]&&_0x3e561a[_0xdb50('0xde')]==='MACHINE'){var _0x38e91e=this;return new BPromise(function(_0x700613,_0x625dcd){delete _0x38e91e[_0xdb50('0x2a')][_0x3e561a[_0xdb50('0xd9')]];_0x38e91e[_0xdb50('0xad')](_0x38e91e['voiceQueues'][_0x187718['queue']]);_0x38e91e[_0xdb50('0x23')][_0x187718[_0xdb50('0xae')]][_0xdb50('0xe6')]+=0x1;_0x38e91e[_0xdb50('0x23')][_0x187718[_0xdb50('0xae')]][_0xdb50('0x5a')]+=0x1;var _0x589808=_0x38e91e[_0xdb50('0x23')][_0x187718[_0xdb50('0xae')]];var _0x381b88=new Hangup(_0x187718,_0x3e561a);_0x381b88['state']=0x13;_0x381b88[_0xdb50('0xe7')]=_0xdb50('0xe8');_0x381b88[_0xdb50('0xe9')]='AMD';_0x381b88[_0xdb50('0xea')]+=0x1;_0x381b88[_0xdb50('0xeb')]+=0x1;_0x381b88[_0xdb50('0xe3')]=!![];ami[_0xdb50('0x4e')]('custom:amd',ut[_0xdb50('0xe2')](_0x381b88,'amd'));_0x38e91e['createHistory'](_0x381b88)[_0xdb50('0xab')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x381b88['countbusyretry']+_0x381b88[_0xdb50('0xec')]+_0x381b88[_0xdb50('0xed')]+_0x381b88[_0xdb50('0xee')]+_0x381b88[_0xdb50('0xef')]+_0x381b88[_0xdb50('0xf0')]+_0x381b88['countmachineretry']+_0x381b88[_0xdb50('0xf1')]>=_0x589808[_0xdb50('0xf2')]){_0x38e91e['stateGlobal'](_0x381b88,_0x700613,_0x625dcd,_0xdb50('0xf3'));}else{if(_0x381b88[_0xdb50('0xea')]>=_0x589808['dialMachineMaxRetry']){_0x38e91e[_0xdb50('0xf4')](_0x381b88,_0x700613,_0x625dcd,'reason\x2019\x20machine....');}else{_0x38e91e[_0xdb50('0xb8')]({'active':![],'countmachineretry':_0x381b88['countmachineretry'],'scheduledat':moment()[_0xdb50('0xf5')](_0x589808[_0xdb50('0xf6')],'minutes')[_0xdb50('0x74')](_0xdb50('0xf7')),'ContactId':_0x381b88[_0xdb50('0xcd')],'ListId':_0x381b88['ListId'],'VoiceQueueId':_0x381b88[_0xdb50('0xd0')]||undefined,'CampaignId':_0x381b88[_0xdb50('0xd1')]||undefined})[_0xdb50('0xab')](loggerCatch('[rescheduleContact][Machine]'));_0x700613({'reschedule':0x1});}}});}if(_0x187718[_0xdb50('0x4f')]===_0xdb50('0x77')&&this[_0xdb50('0x24')][_0x187718[_0xdb50('0xae')]][_0xdb50('0xdd')]&&_0x3e561a[_0xdb50('0xde')]===_0xdb50('0xdf')){delete this[_0xdb50('0x2a')][_0x3e561a[_0xdb50('0xd9')]];this[_0xdb50('0xad')](this[_0xdb50('0x24')][_0x187718['queue']]);_0x4b19bc=new Hangup(_0x187718,_0x3e561a);_0x4b19bc[_0xdb50('0xe0')]=0x12;_0x4b19bc['statedesc']='HangupInAMD';_0x4b19bc[_0xdb50('0xe9')]=_0xdb50('0xf8');ami[_0xdb50('0x4e')](_0xdb50('0xf9'),ut[_0xdb50('0xe2')](_0x4b19bc,'amd'));this[_0xdb50('0xca')](_0x4b19bc,_0xdb50('0xfa'),_0xdb50('0xfb'));}if(_0x187718['type']==='ivr'&&this[_0xdb50('0x24')][_0x187718['queue']][_0xdb50('0xdd')]&&_0x3e561a['value']===_0xdb50('0xfc')){var _0x38e91e=this;return new BPromise(function(_0x4a185c,_0x2f0824){delete _0x38e91e[_0xdb50('0x2a')][_0x3e561a[_0xdb50('0xd9')]];_0x38e91e[_0xdb50('0xad')](_0x38e91e['campaigns'][_0x187718['queue']]);_0x38e91e[_0xdb50('0x24')][_0x187718['queue']][_0xdb50('0xe6')]+=0x1;_0x38e91e[_0xdb50('0x24')][_0x187718[_0xdb50('0xae')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x27c37f=_0x38e91e[_0xdb50('0x24')][_0x187718[_0xdb50('0xae')]];var _0x1a80d9=new Hangup(_0x187718,_0x3e561a);_0x1a80d9['state']=0x13;_0x1a80d9[_0xdb50('0xe7')]=_0xdb50('0xe8');_0x1a80d9[_0xdb50('0xe9')]='AMD';_0x1a80d9[_0xdb50('0xea')]+=0x1;_0x1a80d9[_0xdb50('0xeb')]+=0x1;_0x1a80d9[_0xdb50('0xe3')]=!![];ami[_0xdb50('0x4e')](_0xdb50('0xf9'),ut[_0xdb50('0xe2')](_0x1a80d9,_0xdb50('0xe3')));_0x38e91e[_0xdb50('0xc3')](_0x1a80d9)['catch'](loggerCatch(_0xdb50('0xfd')));if(_0x1a80d9[_0xdb50('0xfe')]+_0x1a80d9['countcongestionretry']+_0x1a80d9[_0xdb50('0xed')]+_0x1a80d9[_0xdb50('0xee')]+_0x1a80d9[_0xdb50('0xef')]+_0x1a80d9['countabandonedretry']+_0x1a80d9['countmachineretry']+_0x1a80d9[_0xdb50('0xf1')]>=_0x27c37f[_0xdb50('0xf2')]){_0x38e91e['stateGlobal'](_0x1a80d9,_0x4a185c,_0x2f0824,'reason19\x20machine....');}else{if(_0x1a80d9[_0xdb50('0xea')]>=_0x27c37f['dialMachineMaxRetry']){_0x38e91e['createStateFinal'](_0x1a80d9,_0x4a185c,_0x2f0824,_0xdb50('0xff'));}else{_0x38e91e['rescheduleContact']({'active':![],'countmachineretry':_0x1a80d9['countmachineretry'],'scheduledat':moment()[_0xdb50('0xf5')](_0x27c37f['dialMachineRetryFrequency'],_0xdb50('0x100'))[_0xdb50('0x74')](_0xdb50('0xf7')),'ContactId':_0x1a80d9[_0xdb50('0xcd')],'ListId':_0x1a80d9['ListId'],'VoiceQueueId':_0x1a80d9[_0xdb50('0xd0')]||undefined,'CampaignId':_0x1a80d9['CampaignId']||undefined})[_0xdb50('0xab')](loggerCatch(_0xdb50('0x101')));_0x4a185c({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x243db8){var _0x342f80=this[_0xdb50('0x2a')][_0x243db8[_0xdb50('0xd9')]];var _0x15ecd8=this;var _0x30cb30;if(_0x342f80&&_0x342f80['type']===_0xdb50('0x77')){delete this[_0xdb50('0x2a')][_0x243db8[_0xdb50('0xd9')]];this['updateOriginated'](this['campaigns'][_0x342f80['queue']]);this[_0xdb50('0x24')][_0x342f80[_0xdb50('0xae')]][_0xdb50('0x102')]+=0x1;_0x30cb30=new Hangup(_0x342f80,_0x243db8);this[_0xdb50('0xc3')](_0x30cb30)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xdb50('0xc2')](_0x30cb30)[_0xdb50('0xab')](loggerCatch(_0xdb50('0x103')));}if(_0x342f80&&_0x342f80[_0xdb50('0x4f')]!==_0xdb50('0x77')&&isNotNull(this['voiceQueues'][_0x342f80[_0xdb50('0xae')]][_0xdb50('0x104')])){delete this[_0xdb50('0x2a')][_0x243db8['uniqueid']];this['updateOriginated'](this[_0xdb50('0x23')][_0x342f80[_0xdb50('0xae')]]);this['voiceQueues'][_0x342f80[_0xdb50('0xae')]][_0xdb50('0xe6')]+=0x1;this[_0xdb50('0x23')][_0x342f80[_0xdb50('0xae')]][_0xdb50('0x5a')]+=0x1;_0x30cb30=new Hangup(_0x342f80,_0x243db8);_0x30cb30['state']=0x10;_0x30cb30[_0xdb50('0xe7')]=_0xdb50('0x105');_0x30cb30['membername']=_0xdb50('0x106');this[_0xdb50('0xc3')](_0x30cb30)[_0xdb50('0xab')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xdb50('0xc2')](_0x30cb30)['catch'](loggerCatch(_0xdb50('0x103')));}if(_0x342f80&&_0x342f80['type']!==_0xdb50('0x77')&&!isNotNull(this[_0xdb50('0x23')][_0x342f80[_0xdb50('0xae')]]['dialQueueProject'])){delete this[_0xdb50('0x2a')][_0x243db8[_0xdb50('0xd9')]];this[_0xdb50('0xad')](this[_0xdb50('0x23')][_0x342f80[_0xdb50('0xae')]]);this[_0xdb50('0x23')][_0x342f80['queue']]['outboundUnknownCallsDay']+=0x1;_0x30cb30=new Hangup(_0x342f80,_0x243db8);_0x30cb30[_0xdb50('0xe0')]=0xc;_0x30cb30[_0xdb50('0xe7')]=_0x243db8['cause-txt'];_0x30cb30[_0xdb50('0xe9')]='Unknow';this['createHistory'](_0x30cb30)[_0xdb50('0xab')](loggerCatch(_0xdb50('0x107')));this['moveContactManagedDialer'](_0x30cb30)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xdb50('0x1d')][_0xdb50('0x108')]=function(_0x5188cd){var _0x125514=this[_0xdb50('0x2a')][_0x5188cd['uniqueid']];var _0x5eea78=this;if(this['voiceQueues'][_0x5188cd['queue']]){if(_0x125514&&_0x125514[_0xdb50('0x4f')]!==_0xdb50('0x77')){delete this[_0xdb50('0x2a')][_0x5188cd[_0xdb50('0xd9')]];this[_0xdb50('0x23')][_0x5188cd[_0xdb50('0xae')]][_0xdb50('0xe6')]+=0x1;var _0x31514d=new AgentComplete(_0x125514,_0x5188cd);if(_0x5188cd['reason']===_0xdb50('0x109')){_0x31514d[_0xdb50('0x10a')]=this[_0xdb50('0x23')][_0x5188cd['queue']][_0xdb50('0x10b')]&&this['voiceQueues'][_0x5188cd[_0xdb50('0xae')]]['dialAgiAfterHangupAgent']?moment()[_0xdb50('0x74')](_0xdb50('0xf7')):undefined;}this[_0xdb50('0xc3')](_0x31514d)[_0xdb50('0xab')](loggerCatch(_0xdb50('0x10c')));this[_0xdb50('0xc2')](_0x31514d)[_0xdb50('0xab')](loggerCatch(_0xdb50('0x10d')));}}};Dialer['prototype'][_0xdb50('0x2f')]=function(_0x4e209f){if(this[_0xdb50('0x23')][_0x4e209f[_0xdb50('0xae')]]){if(this[_0xdb50('0x2a')][_0x4e209f['uniqueid']]&&this['uniqueId'][_0x4e209f[_0xdb50('0xd9')]][_0xdb50('0x4f')]!==_0xdb50('0x77')){this[_0xdb50('0xad')](this[_0xdb50('0x23')][_0x4e209f[_0xdb50('0xae')]]);this[_0xdb50('0x2a')][_0x4e209f[_0xdb50('0xd9')]][_0xdb50('0x10e')]=moment()[_0xdb50('0x74')](_0xdb50('0xf7'));}}};Dialer[_0xdb50('0x1d')][_0xdb50('0x10f')]=function(_0x63e1cd){this[_0xdb50('0xc3')](_0x63e1cd)[_0xdb50('0xab')](loggerCatch(_0xdb50('0x10c')));this[_0xdb50('0xc2')](_0x63e1cd)[_0xdb50('0xab')](loggerCatch(_0xdb50('0x110')));};Dialer[_0xdb50('0x1d')][_0xdb50('0x31')]=function(_0x11bf4a){var _0x35da6c=this['uniqueId'][_0x11bf4a[_0xdb50('0xd9')]];var _0x197b1b=this;if(this[_0xdb50('0x23')][_0x11bf4a['queue']]){if(_0x35da6c&&_0x35da6c[_0xdb50('0x4f')]!==_0xdb50('0x77')){delete this['uniqueId'][_0x11bf4a['uniqueid']];this[_0xdb50('0xad')](this[_0xdb50('0x23')][_0x11bf4a[_0xdb50('0xae')]]);_0x35da6c['droptime']=moment()[_0xdb50('0x74')]('YYYY-MM-DD\x20HH:mm:ss');var _0x499f5c=new QueueCallerAbandon(_0x35da6c,_0x11bf4a);if(getSeconds(_0x35da6c[_0xdb50('0x111')],_0x35da6c[_0xdb50('0x112')])>=_0x35da6c[_0xdb50('0x113')]){this['voiceQueues'][_0x11bf4a[_0xdb50('0xae')]][_0xdb50('0x67')]+=0x1;this[_0xdb50('0x23')][_0x11bf4a['queue']][_0xdb50('0x5f')]+=0x1;this[_0xdb50('0x23')][_0x11bf4a[_0xdb50('0xae')]][_0xdb50('0x69')]+=0x1;_0x499f5c[_0xdb50('0xe0')]=0xa;_0x499f5c['statedesc']=_0xdb50('0x114');_0x499f5c[_0xdb50('0x115')]=_0xdb50('0x116');_0x499f5c[_0xdb50('0x10a')]=this[_0xdb50('0x23')][_0x11bf4a[_0xdb50('0xae')]][_0xdb50('0x10b')]?moment()[_0xdb50('0x74')](_0xdb50('0xf7')):undefined;_0x499f5c[_0xdb50('0xef')]+=0x1;_0x499f5c[_0xdb50('0xeb')]+=0x1;if(_0x499f5c['countdropretry']>=this[_0xdb50('0x23')][_0x11bf4a[_0xdb50('0xae')]][_0xdb50('0x117')]){this[_0xdb50('0x10f')](_0x499f5c);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x499f5c[_0xdb50('0xef')],'scheduledat':moment()[_0xdb50('0xf5')](this[_0xdb50('0x23')][_0x11bf4a[_0xdb50('0xae')]][_0xdb50('0x118')],_0xdb50('0x100'))['format'](_0xdb50('0xf7')),'ContactId':_0x35da6c[_0xdb50('0xcd')],'ListId':_0x35da6c[_0xdb50('0xce')],'VoiceQueueId':_0x35da6c[_0xdb50('0xd0')]||undefined,'CampaignId':_0x35da6c['CampaignId']||undefined})[_0xdb50('0xab')](loggerCatch(_0xdb50('0x119')));var _0x19ad42=new History(_0x499f5c);_0x19ad42[_0xdb50('0xe0')]=0xa;_0x19ad42['statedesc']=_0xdb50('0x114');_0x19ad42['starttime']=moment()[_0xdb50('0x74')](_0xdb50('0xf7'));_0x19ad42[_0xdb50('0xa4')]=_0x19ad42[_0xdb50('0x11a')];_0x19ad42['calleridname']=_0x499f5c['calleridname'];_0x19ad42[_0xdb50('0x11b')]=_0x499f5c[_0xdb50('0x11b')];this[_0xdb50('0xc3')](_0x19ad42)[_0xdb50('0xab')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this['voiceQueues'][_0x11bf4a[_0xdb50('0xae')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xdb50('0x23')][_0x11bf4a[_0xdb50('0xae')]]['outboundDropCallsDayCallersExit']+=0x1;_0x499f5c['state']=0xb;_0x499f5c['statedesc']=_0xdb50('0x11c');_0x499f5c[_0xdb50('0x115')]='CALLEREXIT';_0x499f5c[_0xdb50('0xf0')]+=0x1;_0x499f5c[_0xdb50('0xeb')]+=0x1;if(_0x499f5c[_0xdb50('0xf0')]>=this[_0xdb50('0x23')][_0x11bf4a[_0xdb50('0xae')]][_0xdb50('0x11d')]){this[_0xdb50('0x10f')](_0x499f5c);}else{this[_0xdb50('0xb8')]({'active':![],'countabandonedretry':_0x499f5c[_0xdb50('0xf0')],'scheduledat':moment()['add'](this[_0xdb50('0x23')][_0x11bf4a[_0xdb50('0xae')]][_0xdb50('0x11e')],_0xdb50('0x100'))[_0xdb50('0x74')](_0xdb50('0xf7')),'ContactId':_0x35da6c[_0xdb50('0xcd')],'ListId':_0x35da6c[_0xdb50('0xce')],'VoiceQueueId':_0x35da6c['VoiceQueueId']||undefined,'CampaignId':_0x35da6c[_0xdb50('0xd1')]||undefined})[_0xdb50('0xab')](loggerCatch(_0xdb50('0x11f')));var _0x19ad42=new History(_0x499f5c);_0x19ad42[_0xdb50('0xe0')]=0xb;_0x19ad42['statedesc']='Abandoned';_0x19ad42['starttime']=moment()[_0xdb50('0x74')]('YYYY-MM-DD\x20HH:mm:ss');_0x19ad42['endtime']=_0x19ad42[_0xdb50('0x11a')];_0x19ad42['calleridname']=_0x499f5c['calleridname'];_0x19ad42['calleridnum']=_0x499f5c['calleridnum'];this[_0xdb50('0xc3')](_0x19ad42)['catch'](loggerCatch(_0xdb50('0x120')));}}}}};Dialer[_0xdb50('0x1d')][_0xdb50('0x37')]=function(_0x1e18b8){if(this[_0xdb50('0x29')][_0x1e18b8[_0xdb50('0xd9')]]){this[_0xdb50('0x29')][_0x1e18b8[_0xdb50('0xd9')]]['channel']=_0x1e18b8[_0xdb50('0xaa')];}if(this[_0xdb50('0x2a')][_0x1e18b8[_0xdb50('0xd9')]]){this[_0xdb50('0x2a')][_0x1e18b8[_0xdb50('0xd9')]][_0xdb50('0xaa')]=_0x1e18b8[_0xdb50('0xaa')];}};Dialer[_0xdb50('0x1d')]['syncQueueMember']=function(_0x563459){if(strategy[this[_0xdb50('0x23')][this[_0xdb50('0x29')][_0x563459[_0xdb50('0x121')]][_0xdb50('0xae')]]['strategy']]===_0xdb50('0x1c')){if(this['actions'][_0x563459[_0xdb50('0x121')]]&&_['isNil'](this[_0xdb50('0x29')][_0x563459[_0xdb50('0x121')]][_0xdb50('0x122')])&&_0x563459[_0xdb50('0xa9')]==='1'&&_0x563459['paused']==='0'){if(this[_0xdb50('0x25')][_0x563459[_0xdb50('0x123')]]){if(!this[_0xdb50('0x25')][_0x563459[_0xdb50('0x123')]][_0xdb50('0x122')]){this[_0xdb50('0x25')][_0x563459[_0xdb50('0x123')]][_0xdb50('0x122')]=!![];this[_0xdb50('0x29')][_0x563459['actionid']]['locked']=!![];this[_0xdb50('0x29')][_0x563459[_0xdb50('0x121')]][_0xdb50('0x123')]=_0x563459[_0xdb50('0x123')];}}}}else if((strategy[this[_0xdb50('0x23')][this['actions'][_0x563459[_0xdb50('0x121')]]['queue']][_0xdb50('0x124')]]||_0xdb50('0x1b'))==='rrmemory'){if(this['actions'][_0x563459['actionid']]){if(this[_0xdb50('0x25')][_0x563459[_0xdb50('0x123')]]){this[_0xdb50('0x29')][_0x563459['actionid']]['stateinterface']=_0x563459['stateinterface'];if(_[_0xdb50('0xa7')](this['queueBooked'][this['actions'][_0x563459[_0xdb50('0x121')]][_0xdb50('0xae')]])){this[_0xdb50('0x125')][this[_0xdb50('0x29')][_0x563459[_0xdb50('0x121')]]['queue']]=[];}this[_0xdb50('0x125')][this[_0xdb50('0x29')][_0x563459[_0xdb50('0x121')]][_0xdb50('0xae')]][_0xdb50('0x126')](_[_0xdb50('0xcb')](_[_0xdb50('0xcc')](this[_0xdb50('0x29')][_0x563459['actionid']],[_0xdb50('0x127'),_0xdb50('0x123')]),{'status':_0x563459[_0xdb50('0xa9')],'paused':_0x563459[_0xdb50('0x128')]}));}}}};function unlockQueueStatus(_0x354033,_0x377e16){setTimeout(function(){if(_[_0xdb50('0x3d')](_0x354033[_0xdb50('0x129')])){loggerBooked[_0xdb50('0x92')]('[unlockQueueStatus][undefined]',_0x377e16);}_0x354033[_0xdb50('0x129')]=!![];loggerBooked[_0xdb50('0x7b')]('[booked][unlockQueueStatus]',_0x377e16,JSON[_0xdb50('0x12a')](_[_0xdb50('0xcc')](_0x354033,[_0xdb50('0x40'),_0xdb50('0x129')])));},0x1f3);}Dialer[_0xdb50('0x1d')][_0xdb50('0x12b')]=function(_0x3cbb96){var _0x2feaa7=this;var _0x32f439=_0x2feaa7['voiceQueues'][_0x2feaa7[_0xdb50('0x29')][_0x3cbb96['actionid']][_0xdb50('0xae')]];if(strategy[this[_0xdb50('0x23')][this[_0xdb50('0x29')][_0x3cbb96[_0xdb50('0x121')]][_0xdb50('0xae')]][_0xdb50('0x124')]]===_0xdb50('0x1c')){if(this[_0xdb50('0x29')][_0x3cbb96[_0xdb50('0x121')]]&&this[_0xdb50('0x29')][_0x3cbb96[_0xdb50('0x121')]][_0xdb50('0x123')]){this['preview']['run'](this[_0xdb50('0x29')][_0x3cbb96[_0xdb50('0x121')]]['idHopper'],this[_0xdb50('0x29')][_0x3cbb96['actionid']]['stateinterface'])[_0xdb50('0xab')](function(_0x14ac0d){logger[_0xdb50('0x92')](_0xdb50('0x12c'),util[_0xdb50('0x94')](_0x14ac0d,{'showHidden':![],'depth':null}));})[_0xdb50('0x20')](function(){_0x2feaa7['updateOriginated'](_0x2feaa7[_0xdb50('0x23')][_0x2feaa7['actions'][_0x3cbb96[_0xdb50('0x121')]]['queue']]);_0x2feaa7['agents'][_0x2feaa7['actions'][_0x3cbb96[_0xdb50('0x121')]][_0xdb50('0x123')]][_0xdb50('0x122')]=![];delete _0x2feaa7[_0xdb50('0x29')][_0x3cbb96[_0xdb50('0x121')]];unlockQueueStatus(_0x32f439);});}else{this[_0xdb50('0xad')](this[_0xdb50('0x23')][this[_0xdb50('0x29')][_0x3cbb96[_0xdb50('0x121')]][_0xdb50('0xae')]]);this[_0xdb50('0xb8')]({'active':![],'ContactId':this['actions'][_0x3cbb96['actionid']]['ContactId'],'ListId':this[_0xdb50('0x29')][_0x3cbb96['actionid']][_0xdb50('0xce')],'VoiceQueueId':this[_0xdb50('0x29')][_0x3cbb96[_0xdb50('0x121')]][_0xdb50('0xd0')]||undefined,'CampaignId':this['actions'][_0x3cbb96['actionid']][_0xdb50('0xd1')]||undefined})[_0xdb50('0xab')](loggerCatch(_0xdb50('0x12d')));delete this[_0xdb50('0x29')][_0x3cbb96[_0xdb50('0x121')]];unlockQueueStatus(_0x32f439);}}else if((strategy[this[_0xdb50('0x23')][this['actions'][_0x3cbb96[_0xdb50('0x121')]][_0xdb50('0xae')]][_0xdb50('0x124')]]||'rrmemory')==='rrmemory'){var _0x7970af;if(this['actions'][_0x3cbb96[_0xdb50('0x121')]]&&!_['isEmpty'](this[_0xdb50('0x125')][this[_0xdb50('0x29')][_0x3cbb96[_0xdb50('0x121')]][_0xdb50('0xae')]])){if(this[_0xdb50('0x2e')][_0x2feaa7[_0xdb50('0x29')][_0x3cbb96[_0xdb50('0x121')]][_0xdb50('0xae')]]){this[_0xdb50('0x2e')][_0x2feaa7[_0xdb50('0x29')][_0x3cbb96[_0xdb50('0x121')]][_0xdb50('0xae')]]=this[_0xdb50('0x2e')][this[_0xdb50('0x29')][_0x3cbb96['actionid']][_0xdb50('0xae')]]?this[_0xdb50('0x2e')][this['actions'][_0x3cbb96[_0xdb50('0x121')]][_0xdb50('0xae')]]:this[_0xdb50('0x125')][this[_0xdb50('0x29')][_0x3cbb96[_0xdb50('0x121')]]['queue']]?this[_0xdb50('0x125')][this['actions'][_0x3cbb96[_0xdb50('0x121')]]['queue']]['_rr']||0x0:0x0;}this[_0xdb50('0x125')][this[_0xdb50('0x29')][_0x3cbb96[_0xdb50('0x121')]][_0xdb50('0xae')]][_0xdb50('0x12e')]=this[_0xdb50('0x2e')][this[_0xdb50('0x29')][_0x3cbb96[_0xdb50('0x121')]][_0xdb50('0xae')]];for(var _0x5e970a=0x0;_0x5e970a=0x0;})[_0xdb50('0xab')](myreject(_0x49eede)));}}else{_0x40a030[_0xdb50('0x126')](ami[_0xdb50('0xa8')]({'action':'command','command':util[_0xdb50('0x74')](_0xdb50('0x148'),_0xe7e29,!_[_0xdb50('0x3d')](config[_0xdb50('0x149')][_0xbdb014])?_0xbdb014:'')})['then'](function(_0xbfbc25){return _0xbfbc25[_0xdb50('0x14a')][_0xdb50('0x14b')]('true')>=0x0;})[_0xdb50('0xab')](myreject(_0x49eede)));}BPromise['all'](_0x40a030)['then'](function(_0x4e3093){var _0x240355=_[_0xdb50('0x14d')](_0x4e3093);if(_0x240355){return _0x3620cd(_0x240355);}else{_0x413492[_0xdb50('0x3e')]=_0x23f10d?_0xdb50('0x14e'):_0xdb50('0x14f');return _0x49eede(msgResponse('[ifTime][promiseAll]',_0xdb50('0x142'),_0xdb50('0x150')+_0x23f10d+'\x20'+_0x264e15+_0xdb50('0x151')+util['inspect'](_0xe7e29,{'showHidden':![],'depth':null})+_0xdb50('0x152')+_0xbdb014));}})[_0xdb50('0xab')](function(_0x1f2f75){return _0x49eede(msgResponse(_0xdb50('0x140'),_0xdb50('0x142'),JSON[_0xdb50('0x12a')](_0x1f2f75)));});});};Dialer[_0xdb50('0x1d')][_0xdb50('0x153')]=function(_0x1c1a2e){var _0x3013fb=this;return function(){switch(_0x1c1a2e[_0xdb50('0x56')]){case'progressive':freeVariablesPredictive(_0x1c1a2e);_0x3013fb[_0xdb50('0x154')](_0x1c1a2e,0x1);break;case _0xdb50('0x155'):freeVariablesPredictive(_0x1c1a2e);_0x3013fb[_0xdb50('0x154')](_0x1c1a2e,_0x1c1a2e[_0xdb50('0x156')]);break;case _0xdb50('0xc'):_0x3013fb['predictive'](_0x1c1a2e);break;case _0xdb50('0xb'):freeVariablesPredictive(_0x1c1a2e);_0x3013fb[_0xdb50('0x154')](_0x1c1a2e,0x1);break;default:freeVariablesPredictive(_0x1c1a2e);logger[_0xdb50('0x92')]('Queue',_0x1c1a2e[_0xdb50('0x40')],'method\x20not\x20recognized');}};};Dialer[_0xdb50('0x1d')][_0xdb50('0x157')]=_[_0xdb50('0x158')](function(_0x5d5dc1){var _0x31c1ce=_[_0xdb50('0x159')](this[_0xdb50('0x25')],function(_0x1f694c){return _0x1f694c[_0xdb50('0x15a')]&&_0x1f694c[_0xdb50('0xa9')]==='reachable';});if(_0x31c1ce[_0xdb50('0x95')]>0x0){return BPromise['resolve']()[_0xdb50('0x3b')](cmHopper['handlePreviewRecallNotifications'](_0x5d5dc1['id'],previewRecallmeReminderInterval,_[_0xdb50('0x15b')](_0x31c1ce,'id')))[_0xdb50('0x3b')](function(_0x1c93ce){for(var _0x47af02=0x0;_0x47af02<_0x1c93ce['length'];_0x47af02++){var _0x4492f4=_0x1c93ce[_0x47af02]['Agent'][_0xdb50('0x40')];if(_0x4492f4)io['to'](util[_0xdb50('0x74')](_0xdb50('0x15c'),_0x4492f4))[_0xdb50('0x4e')](_0xdb50('0x15d'),{'hopper':_0x1c93ce[_0x47af02]});}})['catch'](function(_0x5c284){logger[_0xdb50('0x92')](_0xdb50('0x157'),_0x5c284);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xdb50('0x1d')][_0xdb50('0x15e')]=function(_0x773026){var _0x104b54=this;return function(){_0x104b54['handleIvr'](_0x773026);};};Dialer[_0xdb50('0x1d')]['syncQueueSummary']=function(_0x35ad3a){var _0x3c83e0=this;if(isNotPreview(_0x35ad3a['dialMethod'])){if(isVoiceQueueOutbound(_0x35ad3a[_0xdb50('0x4f')])&&isActive(_0x35ad3a['dialActive'])){_0x35ad3a[_0xdb50('0x9c')]=!![];BPromise[_0xdb50('0xb2')]()['then'](checkIsLoggedIn(_0x35ad3a,_0x35ad3a['loggedIn']))[_0xdb50('0x3b')](checkIsActive(_0x35ad3a,_0x35ad3a[_0xdb50('0x15f')]))[_0xdb50('0x3b')](checkInterval(_0x35ad3a))[_0xdb50('0x3b')](_0x3c83e0[_0xdb50('0x13c')](_0x35ad3a))['then'](_0x3c83e0['checkIfTime'](_0x35ad3a[_0xdb50('0x160')],_0x35ad3a[_0xdb50('0x161')],_0x35ad3a[_0xdb50('0x40')],_0x35ad3a))['then'](_0x3c83e0['checkIfTimeIntervals'](_0x35ad3a[_0xdb50('0x47')],_0x35ad3a[_0xdb50('0x161')],_0x35ad3a['name'],_0x35ad3a))['then'](_0x3c83e0['checkDialMethod'](_0x35ad3a))[_0xdb50('0xab')](loggerCatchQueueSummary(_0xdb50('0x162'),_0x35ad3a));}else{notSendMessagesQueue(_0x35ad3a);}}else{freeVariablesPredictive(_0x35ad3a);if(_0x35ad3a[_0xdb50('0x163')]){_0x3c83e0[_0xdb50('0x157')](_0x35ad3a);}}};Dialer['prototype'][_0xdb50('0x13b')]=function(){var _0xab0d5d=this;var _0x109a88;for(var _0x2819ca in this[_0xdb50('0x24')]){if(typeof this['campaigns'][_0x2819ca]!==_0xdb50('0x96')){_0x109a88=this['campaigns'][_0x2819ca];if(isCampaignIvr(_0x109a88['type'])&&isActive(_0x109a88[_0xdb50('0x73')])){_0x109a88[_0xdb50('0x9c')]=!![];BPromise[_0xdb50('0xb2')]()[_0xdb50('0x3b')](checkIsActive(_0x109a88,_0x109a88[_0xdb50('0x73')]))[_0xdb50('0x3b')](checkInterval(_0x109a88))['then'](_0xab0d5d[_0xdb50('0x13c')](_0x109a88))['then'](_0xab0d5d[_0xdb50('0x13f')](_0x109a88[_0xdb50('0x160')],_0x109a88[_0xdb50('0x161')],_0x109a88[_0xdb50('0x40')],_0x109a88))[_0xdb50('0x3b')](_0xab0d5d[_0xdb50('0x141')](_0x109a88['Interval'],_0x109a88['dialTimezone'],_0x109a88['name'],_0x109a88))[_0xdb50('0x3b')](_0xab0d5d[_0xdb50('0x15e')](_0x109a88))[_0xdb50('0xab')](loggerCatchQueueSummary(_0xdb50('0x164'),_0x109a88));}else{notSendMessagesCampaign(_0x109a88);}}}};function getCallerIdRandom(_0x27a41b,_0x27bcd0){var _0x4cdf5b;var _0x5e1715;var _0x43b4c6;if(_0x27bcd0<=0x0){_0x27bcd0=0x1;}_0x4cdf5b=new RegExp(_0xdb50('0x165')+_0x27bcd0+'}$');_0x5e1715=Math[_0xdb50('0x166')](0xa,_0x27bcd0-0x1);_0x43b4c6=Math[_0xdb50('0x166')](0xa,_0x27bcd0)-0x1;return util[_0xdb50('0x74')]('%s',_[_0xdb50('0x167')](_0x27a41b,_0x4cdf5b,_[_0xdb50('0x168')](_0x5e1715,_0x43b4c6)));}function extractCalleridName(_0x440220){var _0x489593=_0x440220[_0xdb50('0x169')](/"(.*?)"/);return _0x489593?_0x489593[0x1]:_0x440220;}function extractCalleridNumber(_0x5ae68d){var _0x366b8f=_0x5ae68d[_0xdb50('0x169')](/<(.*?)>/);return _0x366b8f?_0x366b8f[0x1]:_0x5ae68d;}Dialer['prototype'][_0xdb50('0x16a')]=function(_0x318d91,_0x312708){var _0x2a3291=this;var _0x3c9d74=uuid['v4']();this[_0xdb50('0x29')][_0x3c9d74]=new Action(_0x318d91,_0x312708,_0x3c9d74);return new BPromise(function(_0x52cb50,_0x375a4a){if(_[_0xdb50('0x3d')](_0x318d91)&&typeof _0x318d91!=='object'){return _0x375a4a(msgResponse(_0xdb50('0x16b'),_0xdb50('0x142'),_0xdb50('0x16c')));}if(_['isUndefined'](_0x312708[_0xdb50('0x16d')][_0xdb50('0x16e')])||_0x312708[_0xdb50('0x16d')][_0xdb50('0x16e')]===null){return _0x375a4a(msgResponse(_0xdb50('0x16b'),_0xdb50('0x142'),'contact\x20is\x20undefine'));}var _0x505134={'XMD-CALLERID':_0x2a3291[_0xdb50('0x29')][_0x3c9d74][_0xdb50('0x16f')](),'XMD-AGI':_0x318d91[_0xdb50('0x104')]?util[_0xdb50('0x74')](_0xdb50('0x170'),ipAgi,_0x318d91[_0xdb50('0x104')]):_0xdb50('0x171'),'XMD-AGIAFTER':_0x318d91[_0xdb50('0x10b')]?util[_0xdb50('0x74')](_0xdb50('0x170'),ipAgi,_0x318d91[_0xdb50('0x10b')]):_0xdb50('0x171'),'XMD-QUEUE':_0x318d91[_0xdb50('0x4f')]==='outbound'?util['format'](_0xdb50('0x172'),_0x318d91[_0xdb50('0x40')],_0x318d91['dialQueueOptions']||'',_0x318d91[_0xdb50('0x173')]?'c':'',_0x318d91[_0xdb50('0x113')]||0x3):'NONE','XMD-CONTACTID':_0x312708[_0xdb50('0xcd')],'XMD-CDRTYPE':_0xdb50('0xa'),'CALLERID(all)':_0x2a3291['actions'][_0x3c9d74][_0xdb50('0x16f')](),'XMD-AMD':_0x318d91[_0xdb50('0xdd')]?_0xdb50('0x174'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x318d91[_0xdb50('0xdd')]){_0x505134['XMD-AMDINITIALSILENCE']=_0x318d91[_0xdb50('0x175')]||0x9c4;_0x505134[_0xdb50('0x176')]=_0x318d91[_0xdb50('0x177')]||0x5dc;_0x505134[_0xdb50('0x178')]=_0x318d91[_0xdb50('0x179')]||0x320;_0x505134['XMD-AMDTOTALANALYSISTIME']=_0x318d91[_0xdb50('0x17a')]||0x1388;_0x505134[_0xdb50('0x17b')]=_0x318d91[_0xdb50('0x17c')]||0x64;_0x505134[_0xdb50('0x17d')]=_0x318d91['dialAMDBetweenWordsSilence']||0x32;_0x505134[_0xdb50('0x17e')]=_0x318d91[_0xdb50('0x17f')]||0x3;_0x505134[_0xdb50('0x180')]=_0x318d91['dialAMDSilenceThreshold']||0x100;_0x505134[_0xdb50('0x181')]=_0x318d91['dialAMDMaximumWordLength']||0x1388;}if(_0x318d91[_0xdb50('0x4f')]===_0xdb50('0x182')){_0x505134[_0xdb50('0x183')]=_0x312708[_0xdb50('0xd0')];}else{_0x505134['XMD-CAMPAIGNID']=_0x312708[_0xdb50('0xd1')];}for(var _0x1bbc6a in _0x312708['Contact']){if(typeof _0x312708['Contact'][_0x1bbc6a]!==_0xdb50('0x96')){if(isNotNull(_0x312708[_0xdb50('0x16d')][_0x1bbc6a])&&_0x1bbc6a!=='id'&&_0x1bbc6a!==_0xdb50('0x184')&&_0x1bbc6a!=='createdAt'&&_0x1bbc6a!==_0xdb50('0x185')){_0x505134[util['format'](_0xdb50('0x186'),'XMD-',_[_0xdb50('0x187')](_0x1bbc6a))]=_0x312708['Contact'][_0x1bbc6a];}}}var _0x580167=_0x2a3291[_0xdb50('0x13d')](_0x318d91[_0xdb50('0x72')])?getCallerId(_0x318d91[_0xdb50('0x72')]['callerid'],_0x318d91[_0xdb50('0x57')],_0x318d91[_0xdb50('0x188')]>0x0?getCallerIdRandom(_0x318d91[_0xdb50('0x189')],_0x318d91[_0xdb50('0x188')]):_0x318d91[_0xdb50('0x189')]):getCallerId(_[_0xdb50('0xa7')](_0x318d91[_0xdb50('0x13e')])?_0x318d91[_0xdb50('0x72')][_0xdb50('0x18a')]:_0x318d91[_0xdb50('0x13e')]['callerid'],_0x318d91[_0xdb50('0x57')],_0x318d91[_0xdb50('0x188')]>0x0?getCallerIdRandom(_0x318d91[_0xdb50('0x189')],_0x318d91[_0xdb50('0x188')]):_0x318d91[_0xdb50('0x189')]);if(_0x580167){_0x505134[_0xdb50('0x18b')]=_0x2a3291[_0xdb50('0x29')][_0x3c9d74]['originatecalleridname']=extractCalleridName(_0x580167);_0x505134[_0xdb50('0x18c')]=_0x2a3291[_0xdb50('0x29')][_0x3c9d74][_0xdb50('0x18d')]=extractCalleridNumber(_0x580167);}return ami[_0xdb50('0xa8')]({'actionid':_0x3c9d74,'action':'originate','channel':_0x2a3291[_0xdb50('0x13d')](_0x318d91[_0xdb50('0x72')])?util[_0xdb50('0x74')](_0xdb50('0x18e'),_0x318d91['Trunk']['name'],isNotNull(_0x318d91[_0xdb50('0x59')])?_0x318d91[_0xdb50('0x59')]['trim']()||'':'',_0x318d91[_0xdb50('0x18f')]>0x0?_0x312708[_0xdb50('0x16d')][_0xdb50('0x16e')][_0xdb50('0x190')](_0x318d91[_0xdb50('0x18f')]):_0x312708[_0xdb50('0x16d')][_0xdb50('0x16e')]):util[_0xdb50('0x74')](_0xdb50('0x18e'),_[_0xdb50('0xa7')](_0x318d91['TrunkBackup'])?_0x318d91[_0xdb50('0x72')][_0xdb50('0x40')]:_0x318d91[_0xdb50('0x13e')]['name'],isNotNull(_0x318d91[_0xdb50('0x59')])?_0x318d91['dialPrefix'][_0xdb50('0x191')]()||'':'',_0x318d91[_0xdb50('0x18f')]>0x0?_0x312708[_0xdb50('0x16d')][_0xdb50('0x16e')][_0xdb50('0x190')](_0x318d91['dialCutDigit']):_0x312708['Contact'][_0xdb50('0x16e')]),'callerid':_0x580167,'Exten':'xcally-motion-dialer','Context':_0xdb50('0x192'),'Priority':'1','variable':_0x505134,'timeout':(_0x318d91[_0xdb50('0x58')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3c9d74})[_0xdb50('0x3b')](function(_0x11ed13){return _0x52cb50(_0x11ed13);})[_0xdb50('0xab')](function(_0x58587a){_0x318d91[_0xdb50('0x61')]+=0x1;var _0x359dac=new History(_0x2a3291[_0xdb50('0x29')][_0x3c9d74]);logger[_0xdb50('0x92')](util[_0xdb50('0x74')](_0xdb50('0x193'),JSON[_0xdb50('0x12a')](_0x58587a)));_0x359dac['state']=0xe;_0x359dac[_0xdb50('0xe7')]=_0xdb50('0x194');_0x359dac[_0xdb50('0x11a')]=moment()[_0xdb50('0x74')](_0xdb50('0xf7'));_0x359dac[_0xdb50('0xa4')]=_0x359dac[_0xdb50('0x11a')];_0x2a3291[_0xdb50('0xc3')](_0x359dac)[_0xdb50('0xab')](loggerCatch(_0xdb50('0x195')));_0x2a3291[_0xdb50('0xc2')](_0x359dac)[_0xdb50('0xab')](loggerCatch(_0xdb50('0x195')))[_0xdb50('0x20')](function(){delete _0x2a3291[_0xdb50('0x29')][_0x3c9d74];return _0x375a4a(msgResponse('originate',_0xdb50('0x4a'),'originate\x20action\x20Error'));});});});};Dialer[_0xdb50('0x1d')][_0xdb50('0x33')]=function(_0x4ca566){var _0x9727a5=this[_0xdb50('0x29')][_0x4ca566[_0xdb50('0x121')]];if(_0x9727a5){delete this[_0xdb50('0x29')][_0x4ca566[_0xdb50('0x121')]];_0x9727a5[_0xdb50('0x112')]=moment()[_0xdb50('0x74')](_0xdb50('0xf7'));var _0x34d49e=_0x9727a5[_0xdb50('0x4f')]==='ivr'?this[_0xdb50('0x24')][_0x9727a5[_0xdb50('0xae')]]:this['voiceQueues'][_0x9727a5[_0xdb50('0x196')]()];if(!this[_0xdb50('0xd4')](_0x4ca566[_0xdb50('0x197')])){this[_0xdb50('0xad')](_0x34d49e);return this[_0xdb50('0x198')](_0x9727a5,_0x34d49e,_0x4ca566)[_0xdb50('0xab')](loggerCatch(_0xdb50('0x199')));}this['uniqueId'][_0x4ca566[_0xdb50('0xd9')]]=_0x9727a5;}};Dialer['prototype']['checkRetriveMax']=function(_0x451deb,_0x3f9cdf,_0x2a3b66){var _0x36f046=new History(_0x3f9cdf);if(_0x36f046['countbusyretry']+_0x36f046[_0xdb50('0xec')]+_0x36f046[_0xdb50('0xed')]+_0x36f046[_0xdb50('0xee')]+_0x36f046[_0xdb50('0xef')]+_0x36f046[_0xdb50('0xf0')]+_0x36f046[_0xdb50('0xea')]+_0x36f046[_0xdb50('0xf1')]>=_0x2a3b66[_0xdb50('0xf2')]-0x1){return!![];}switch(_0x451deb){case 0x3:if(_0x36f046[_0xdb50('0xed')]>=_0x2a3b66['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0xdb50('0xb8')]({'active':![],'countnoanswerretry':_0x36f046['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xdb50('0xf5')](_0x2a3b66[_0xdb50('0x19a')],'minutes')[_0xdb50('0x74')](_0xdb50('0xf7')),'ContactId':_0x36f046['ContactId'],'ListId':_0x36f046[_0xdb50('0xce')],'VoiceQueueId':_0x36f046[_0xdb50('0xd0')]||undefined,'CampaignId':_0x36f046[_0xdb50('0xd1')]||undefined})['catch'](loggerCatch(_0xdb50('0x19b')));break;case 0x5:if(_0x36f046[_0xdb50('0xfe')]>=_0x2a3b66['dialBusyMaxRetry']-0x1){return!![];}this[_0xdb50('0xb8')]({'active':![],'countbusyretry':_0x36f046[_0xdb50('0xfe')]+=0x1,'scheduledat':moment()[_0xdb50('0xf5')](_0x2a3b66[_0xdb50('0x19c')],_0xdb50('0x100'))[_0xdb50('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x36f046[_0xdb50('0xcd')],'ListId':_0x36f046[_0xdb50('0xce')],'VoiceQueueId':_0x36f046[_0xdb50('0xd0')]||undefined,'CampaignId':_0x36f046[_0xdb50('0xd1')]||undefined})['catch'](loggerCatch(_0xdb50('0x19d')));break;case 0x8:if(_0x36f046[_0xdb50('0xec')]>=_0x2a3b66['dialCongestionMaxRetry']-0x1){return!![];}this[_0xdb50('0xb8')]({'active':![],'countcongestionretry':_0x36f046[_0xdb50('0xec')]+=0x1,'scheduledat':moment()[_0xdb50('0xf5')](_0x2a3b66[_0xdb50('0x19e')],_0xdb50('0x100'))['format'](_0xdb50('0xf7')),'ContactId':_0x36f046[_0xdb50('0xcd')],'ListId':_0x36f046[_0xdb50('0xce')],'VoiceQueueId':_0x36f046[_0xdb50('0xd0')]||undefined,'CampaignId':_0x36f046['CampaignId']||undefined})[_0xdb50('0xab')](loggerCatch(_0xdb50('0x19f')));break;case 0x0:if(_0x36f046[_0xdb50('0xee')]>=_0x2a3b66[_0xdb50('0x1a0')]-0x1){return!![];}else{this[_0xdb50('0xb8')]({'active':![],'countnosuchnumberretry':_0x36f046[_0xdb50('0xee')]+=0x1,'scheduledat':moment()[_0xdb50('0xf5')](_0x2a3b66[_0xdb50('0x1a1')],_0xdb50('0x100'))[_0xdb50('0x74')](_0xdb50('0xf7')),'ContactId':_0x36f046[_0xdb50('0xcd')],'ListId':_0x36f046[_0xdb50('0xce')],'VoiceQueueId':_0x36f046[_0xdb50('0xd0')]||undefined,'CampaignId':_0x36f046[_0xdb50('0xd1')]||undefined})[_0xdb50('0xab')](loggerCatch(_0xdb50('0x1a2')));}break;case 0xa:if(_0x36f046['countdropretry']>=_0x2a3b66['dialDropMaxRetry']-0x1){return!![];}this[_0xdb50('0xb8')]({'active':![],'countdropretry':_0x36f046[_0xdb50('0xef')]+=0x1,'scheduledat':moment()['add'](_0x2a3b66['dialDropRetryFrequency'],_0xdb50('0x100'))[_0xdb50('0x74')](_0xdb50('0xf7')),'ContactId':_0x36f046[_0xdb50('0xcd')],'ListId':_0x36f046['ListId'],'VoiceQueueId':_0x36f046[_0xdb50('0xd0')]||undefined,'CampaignId':_0x36f046[_0xdb50('0xd1')]||undefined})[_0xdb50('0xab')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x36f046[_0xdb50('0xf0')]>=_0x2a3b66[_0xdb50('0x11d')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x36f046[_0xdb50('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x2a3b66[_0xdb50('0x11e')],_0xdb50('0x100'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x36f046[_0xdb50('0xcd')],'ListId':_0x36f046[_0xdb50('0xce')],'VoiceQueueId':_0x36f046[_0xdb50('0xd0')]||undefined,'CampaignId':_0x36f046[_0xdb50('0xd1')]||undefined})['catch'](loggerCatch(_0xdb50('0x11f')));break;case 0x13:if(_0x36f046[_0xdb50('0xea')]>=_0x2a3b66[_0xdb50('0x1a3')]-0x1){return!![];}this[_0xdb50('0xb8')]({'active':![],'countmachineretry':_0x36f046[_0xdb50('0xea')]+=0x1,'scheduledat':moment()[_0xdb50('0xf5')](_0x2a3b66[_0xdb50('0xf6')],_0xdb50('0x100'))[_0xdb50('0x74')](_0xdb50('0xf7')),'ContactId':_0x36f046['ContactId'],'ListId':_0x36f046[_0xdb50('0xce')],'VoiceQueueId':_0x36f046[_0xdb50('0xd0')]||undefined,'CampaignId':_0x36f046[_0xdb50('0xd1')]||undefined})[_0xdb50('0xab')](loggerCatch(_0xdb50('0x101')));break;case 0x14:if(_0x36f046['countagentrejectretry']>=_0x2a3b66[_0xdb50('0x1a4')]-0x1){return!![];}this[_0xdb50('0xb8')]({'active':![],'countagentrejectretry':_0x36f046[_0xdb50('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x2a3b66[_0xdb50('0x1a5')],'minutes')[_0xdb50('0x74')](_0xdb50('0xf7')),'ContactId':_0x36f046[_0xdb50('0xcd')],'ListId':_0x36f046[_0xdb50('0xce')],'VoiceQueueId':_0x36f046[_0xdb50('0xd0')]||undefined,'CampaignId':_0x36f046[_0xdb50('0xd1')]||undefined})['catch'](loggerCatch(_0xdb50('0x1a6')));break;default:return!![];}};Dialer['prototype'][_0xdb50('0x198')]=function(_0x2ee17,_0xa351ce,_0x27f8bc){var _0x5c59e5=this;var _0x3aa94c=new History(_0x2ee17);return new BPromise(function(_0x4e2d4f,_0x2c5bdc){if(_[_0xdb50('0x3d')](_0xa351ce)&&typeof _0xa351ce!=='object'){return _0x2c5bdc(msgResponse(_0xdb50('0x1a7'),_0xdb50('0x142'),'entity\x20is\x20undefine'));}if(_[_0xdb50('0x3d')](_0x27f8bc)&&typeof _0x27f8bc!=='object'){return _0x2c5bdc(msgResponse(_0xdb50('0x1a7'),_0xdb50('0x142'),_0xdb50('0x1a8')));}switch(_0x27f8bc['reason']){case'0':_0xa351ce['outboundNoSuchCallsDay']+=0x1;_0x3aa94c[_0xdb50('0xe0')]=0x0;_0x3aa94c['statedesc']=_0xdb50('0x1a9');_0x3aa94c[_0xdb50('0xee')]+=0x1;_0x3aa94c['countglobal']+=0x1;ami[_0xdb50('0x4e')](_0xdb50('0x1aa'),ut[_0xdb50('0xe2')](_0x2ee17,'nosuchnumber'));_0x5c59e5['createHistory'](_0x3aa94c)[_0xdb50('0xab')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5c59e5[_0xdb50('0x1ab')](0x0,_0x2ee17,_0xa351ce)){if(_0x3aa94c[_0xdb50('0xee')]>=_0xa351ce[_0xdb50('0x1a0')]){_0x5c59e5[_0xdb50('0xf4')](_0x3aa94c,_0x4e2d4f,_0x2c5bdc,_0xdb50('0x1ac'));}else{_0x5c59e5[_0xdb50('0x1ad')](_0x3aa94c,_0x4e2d4f,_0x2c5bdc,_0xdb50('0x1ac'));}}break;case'3':_0xa351ce[_0xdb50('0x1ae')]+=0x1;_0x3aa94c[_0xdb50('0xe0')]=0x3;_0x3aa94c[_0xdb50('0xe7')]=_0xdb50('0x1af');_0x3aa94c[_0xdb50('0xed')]+=0x1;_0x3aa94c['countglobal']+=0x1;ami[_0xdb50('0x4e')]('custom:agentnoanswer',ut[_0xdb50('0xe2')](_0x2ee17,_0xdb50('0x1b0')));_0x5c59e5[_0xdb50('0xc3')](_0x3aa94c)[_0xdb50('0xab')](loggerCatch(_0xdb50('0x1b1')));if(_0x5c59e5[_0xdb50('0x1ab')](0x3,_0x2ee17,_0xa351ce)){if(_0x3aa94c['countnoanswerretry']>=_0xa351ce[_0xdb50('0x1b2')]){_0x5c59e5[_0xdb50('0xf4')](_0x3aa94c,_0x4e2d4f,_0x2c5bdc,_0xdb50('0x1b3'));}else{_0x5c59e5[_0xdb50('0x1ad')](_0x3aa94c,_0x4e2d4f,_0x2c5bdc,_0xdb50('0x1b3'));}}break;case'5':_0xa351ce['outboundBusyCallsDay']+=0x1;_0x3aa94c['state']=0x5;_0x3aa94c['statedesc']='Busy';_0x3aa94c[_0xdb50('0xfe')]+=0x1;_0x3aa94c['countglobal']+=0x1;ami[_0xdb50('0x4e')](_0xdb50('0x1b4'),ut[_0xdb50('0xe2')](_0x2ee17,_0xdb50('0x1b5')));_0x5c59e5[_0xdb50('0xc3')](_0x3aa94c)[_0xdb50('0xab')](loggerCatch(_0xdb50('0x1b6')));if(_0x5c59e5[_0xdb50('0x1ab')](0x5,_0x2ee17,_0xa351ce)){if(_0x3aa94c[_0xdb50('0xfe')]>=_0xa351ce[_0xdb50('0x1b7')]){_0x5c59e5[_0xdb50('0xf4')](_0x3aa94c,_0x4e2d4f,_0x2c5bdc,_0xdb50('0x1b8'));}else{_0x5c59e5[_0xdb50('0x1ad')](_0x3aa94c,_0x4e2d4f,_0x2c5bdc,_0xdb50('0x1b8'));}}break;case'8':_0xa351ce[_0xdb50('0x5c')]+=0x1;_0x3aa94c[_0xdb50('0xe0')]=0x8;_0x3aa94c[_0xdb50('0xe7')]=_0xdb50('0x1b9');_0x3aa94c[_0xdb50('0xec')]+=0x1;_0x3aa94c['countglobal']+=0x1;ami['emit'](_0xdb50('0x1ba'),ut[_0xdb50('0xe2')](_0x2ee17,_0xdb50('0x1bb')));_0x5c59e5['createHistory'](_0x3aa94c)[_0xdb50('0xab')](loggerCatch(_0xdb50('0x1bc')));if(_0x5c59e5[_0xdb50('0x1ab')](0x8,_0x2ee17,_0xa351ce)){if(_0x3aa94c[_0xdb50('0xec')]>=_0xa351ce['dialCongestionMaxRetry']){_0x5c59e5[_0xdb50('0xf4')](_0x3aa94c,_0x4e2d4f,_0x2c5bdc,_0xdb50('0x1bd'));}else{_0x5c59e5[_0xdb50('0x1ad')](_0x3aa94c,_0x4e2d4f,_0x2c5bdc,_0xdb50('0x1bd'));}}break;case'11':_0xa351ce[_0xdb50('0x1be')]+=0x1;_0x3aa94c[_0xdb50('0xe0')]=0xb;_0x3aa94c[_0xdb50('0xe7')]=_0xdb50('0x11c');_0x3aa94c[_0xdb50('0xf0')]+=0x1;_0x3aa94c[_0xdb50('0xeb')]+=0x1;_0x5c59e5['createHistory'](_0x3aa94c)[_0xdb50('0xab')](loggerCatch(_0xdb50('0x120')));if(_0x5c59e5[_0xdb50('0x1ab')](0xb,_0x2ee17,_0xa351ce)){if(_0x3aa94c[_0xdb50('0xf0')]>=_0xa351ce[_0xdb50('0x11d')]){_0x5c59e5['createStateFinal'](_0x3aa94c,_0x4e2d4f,_0x2c5bdc,_0xdb50('0x1bf'));}else{_0x5c59e5[_0xdb50('0x1ad')](_0x3aa94c,_0x4e2d4f,_0x2c5bdc,'reason\x2011\x20abandoned');}}break;case'20':_0xa351ce[_0xdb50('0x63')]+=0x1;_0x3aa94c['state']=0x14;_0x3aa94c[_0xdb50('0xe7')]='AgentReject';_0x3aa94c[_0xdb50('0xf1')]+=0x1;_0x3aa94c['countglobal']+=0x1;ami[_0xdb50('0x4e')](_0xdb50('0x1c0'),ut[_0xdb50('0xe2')](_0x2ee17,'agentreject'));_0x5c59e5[_0xdb50('0xc3')](_0x3aa94c)[_0xdb50('0xab')](loggerCatch(_0xdb50('0x1c1')));if(_0x5c59e5[_0xdb50('0x1ab')](0x14,_0x2ee17,_0xa351ce)){if(_0x3aa94c[_0xdb50('0xf1')]>=_0xa351ce[_0xdb50('0x1a4')]){_0x5c59e5['createStateFinal'](_0x3aa94c,_0x4e2d4f,_0x2c5bdc,'reason\x2020\x20agentreject');}else{_0x5c59e5[_0xdb50('0x1ad')](_0x3aa94c,_0x4e2d4f,_0x2c5bdc,_0xdb50('0x1c2'));}}break;default:_0xa351ce[_0xdb50('0x64')]+=0x1;_0x3aa94c[_0xdb50('0xe0')]=0xc;_0x3aa94c[_0xdb50('0xe7')]=_0x27f8bc['reason'];_0x5c59e5[_0xdb50('0xc3')](_0x3aa94c)[_0xdb50('0xab')](loggerCatch(_0xdb50('0x1c3')));if(_0x5c59e5['checkRetriveMax'](_0x27f8bc['reason'],_0x2ee17,_0xa351ce)){if(_0x3aa94c[_0xdb50('0xfe')]+_0x3aa94c[_0xdb50('0xec')]+_0x3aa94c[_0xdb50('0xed')]+_0x3aa94c[_0xdb50('0xee')]+_0x3aa94c[_0xdb50('0xef')]+_0x3aa94c['countabandonedretry']+_0x3aa94c[_0xdb50('0xea')]+_0x3aa94c['countagentrejectretry']>=_0xa351ce[_0xdb50('0xf2')]){_0x5c59e5[_0xdb50('0x1ad')](_0x3aa94c,_0x4e2d4f,_0x2c5bdc,_0x27f8bc[_0xdb50('0x1c4')]);}else{_0x5c59e5[_0xdb50('0xf4')](_0x3aa94c,_0x4e2d4f,_0x2c5bdc,_0x27f8bc['reason']);}}}});};Dialer[_0xdb50('0x1d')][_0xdb50('0x1ad')]=function(_0x482f92,_0x4cf2de,_0x25738e,_0x388a09){var _0x27c7a6=new Final(_0x482f92);_0x27c7a6[_0xdb50('0xe0')]=0xf;_0x27c7a6[_0xdb50('0xe7')]='Global';this[_0xdb50('0xf4')](_0x27c7a6,_0x4cf2de,_0x25738e,_0x388a09);};Dialer[_0xdb50('0x1d')][_0xdb50('0xf4')]=function(_0x4eb71c,_0x31743f,_0x50a0c7,_0x32e616){this[_0xdb50('0xc2')](_0x4eb71c)[_0xdb50('0x3b')](function(){return _0x31743f(msgResponse(_0xdb50('0x1a7'),'Success',_0x32e616));})[_0xdb50('0xab')](function(){return _0x50a0c7(msgResponse(_0xdb50('0x1c5'),'Failure','contact\x20not\x20moved'));});};Dialer[_0xdb50('0x1d')][_0xdb50('0xc')]=function(_0x205aef){var _0x283c92=_0x205aef[_0xdb50('0x1c6')]/0x64;var _0x355df8=_0x205aef[_0xdb50('0x5f')]/(_0x205aef['outboundDropCallsDayTimeout']+_0x205aef[_0xdb50('0xe6')]);var _0x3d4d29=Math[_0xdb50('0x1c7')](_0x205aef[_0xdb50('0x6c')]*(_0x205aef[_0xdb50('0x1c8')]/0x64));var _0x3ebadb=Math['round'](_0x205aef[_0xdb50('0x6c')]*(_0x205aef[_0xdb50('0x1c9')]/0x64));var _0x3117a7=_0x205aef[_0xdb50('0x9f')]+_0x205aef[_0xdb50('0x9d')];var _0x443f55=Math[_0xdb50('0x1ca')](_0x205aef['erlangCalls']*_0x205aef[_0xdb50('0x70')]*_0x205aef[_0xdb50('0x6a')]*_0x205aef[_0xdb50('0x6b')]);if(_[_0xdb50('0x3d')](_0x205aef[_0xdb50('0x2c')])){if(!_['isUndefined'](_0x205aef[_0xdb50('0x2b')])){_0x205aef['startPredictive']=undefined;loggerPredictive[_0xdb50('0x92')]('[startMethodPredictive][StartProgressive]',_0xdb50('0x1cb'));}if(!_[_0xdb50('0x3d')](_0x205aef['handlePredictive'])){loggerPredictive[_0xdb50('0x92')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x205aef['handlePredictive']);_0x205aef[_0xdb50('0x8d')]=undefined;}_0x205aef[_0xdb50('0x2c')]=moment()[_0xdb50('0x74')](_0xdb50('0xf7'));loggerPredictive[_0xdb50('0x7b')](_0x205aef[_0xdb50('0x40')],'collection\x20data\x20in\x20progressive\x20at',_0x205aef[_0xdb50('0x2c')]);this[_0xdb50('0x154')](_0x205aef,0x1);}else if(ifInterval(_0x205aef[_0xdb50('0x1cc')],_0x205aef[_0xdb50('0x2c')])){this['handlePower'](_0x205aef,0x1);loggerPredictiveCalls[_0xdb50('0x7b')]('[startMethodPredictive][StartProgressive][Loop]',_0x205aef[_0xdb50('0x2c')],_0x205aef[_0xdb50('0x40')]);_0x205aef[_0xdb50('0x6e')]=0x0;_0x205aef[_0xdb50('0x69')]=0x0;}else if(_0x283c92<_0x355df8&&_0x205aef['dialPredictiveOptimization']===_0xdb50('0x1cd')){freeVariablesPredictive(_0x205aef);loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x1ce'),_0xdb50('0x1cf'),_0x355df8,_0xdb50('0x2c'),_0x205aef['name']);}else if(_0x443f55<_0x205aef[_0xdb50('0x69')]&&_0x205aef[_0xdb50('0x1d0')]===_0xdb50('0x1cd')){freeVariablesPredictive(_0x205aef);loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x1d1'),_0xdb50('0x1d2'),_0x443f55,_0xdb50('0x1d3'),_0x205aef[_0xdb50('0x69')],_0xdb50('0x2c'),_0x205aef[_0xdb50('0x40')]);}else if(!ifInterval(_0x205aef[_0xdb50('0x1cc')],_0x205aef[_0xdb50('0x2c')])&&_[_0xdb50('0x3d')](_0x205aef['startPredictive'])&&!_[_0xdb50('0x3d')](_0x205aef['startProgressive'])){_0x205aef[_0xdb50('0x2b')]=moment()[_0xdb50('0x74')](_0xdb50('0xf7'));loggerPredictive[_0xdb50('0x7b')](_0x205aef['name'],'started\x20in\x20predictive\x20at',_0x205aef[_0xdb50('0x2b')]);this['averageHandleTime'](_0x205aef[_0xdb50('0x1cc')])[_0xdb50('0x3b')](this['getDataPredictive'](_0x205aef))[_0xdb50('0x3b')](mergeDataErlangB(_0x205aef))[_0xdb50('0x3b')](this[_0xdb50('0x1d4')](_0x205aef))[_0xdb50('0xab')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x205aef));}else if(!ifInterval(_0x205aef['dialPredictiveInterval'],_0x205aef['startPredictive'])){_0x205aef[_0xdb50('0x69')]=0x0;_0x205aef[_0xdb50('0x2b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xdb50('0x7b')](_0x205aef[_0xdb50('0x40')],_0xdb50('0x1d5'),_0x205aef['startPredictive']);clearInterval(_0x205aef[_0xdb50('0x8d')]);_0x205aef[_0xdb50('0x8d')]=undefined;this[_0xdb50('0x1d6')](_0x205aef[_0xdb50('0x1cc')])[_0xdb50('0x3b')](this['getDataPredictive'](_0x205aef))[_0xdb50('0x3b')](mergeDataErlangB(_0x205aef))['then'](this['startMethodPredictive'](_0x205aef))[_0xdb50('0xab')](loggerCatchPredictive(_0xdb50('0x1d7'),_0x205aef));}else if(_0x205aef[_0xdb50('0x6c')]&&_0x3117a7<_0x205aef[_0xdb50('0x6c')]-_0x3ebadb){freeVariablesPredictive(_0x205aef);loggerPredictive[_0xdb50('0x7b')](_0x205aef[_0xdb50('0x40')],_0xdb50('0x1d8'),_0x3117a7,_0xdb50('0x1d9'),_0x205aef['predictiveIntervalAvailable'],'-',_0x3ebadb,'=',_0x205aef['predictiveIntervalAvailable']-_0x3ebadb,')');}else if(_0x205aef[_0xdb50('0x6c')]&&_0x3117a7>_0x205aef[_0xdb50('0x6c')]+_0x3d4d29){freeVariablesPredictive(_0x205aef);loggerPredictive[_0xdb50('0x7b')](_0x205aef[_0xdb50('0x40')],_0xdb50('0x1d8'),_0x3117a7,')\x20are\x20more\x20than\x20threshold\x20(',_0x205aef[_0xdb50('0x6c')],'+',_0x3d4d29,'=',_0x205aef['predictiveIntervalAvailable']+_0x3d4d29,')');}};Dialer[_0xdb50('0x1d')][_0xdb50('0x1da')]=function(_0x9f02ea){var _0x33ed54=this;return function(_0x574faf){return new BPromise(function(_0x4ba9a7,_0x34c7b3){_[_0xdb50('0xcb')](_0x9f02ea,_0x574faf[0x0]);if(checkGetDataPredictive(_0x574faf[0x0])){var _0x5a1d95=_0x9f02ea[_0xdb50('0x6c')]=_0x9f02ea[_0xdb50('0x9d')]+_0x9f02ea['available'];var _0x3a6c8f=_0x9f02ea[_0xdb50('0x1cc')]*0x3c;var _0x516fa2=_0x574faf[0x0]['predictiveIntervalAvgTalktime']+_0x574faf[0x0][_0xdb50('0x81')];var _0x3a0609=(_0x574faf[0x0][_0xdb50('0x65')]+_0x574faf[0x0][_0xdb50('0x67')]+_0x574faf[0x0][_0xdb50('0x1db')])/_0x574faf[0x0][_0xdb50('0x83')];_0x9f02ea[_0xdb50('0x6a')]=_0x3a0609>0x0?_0x3a0609:0x1;switch(_0x9f02ea[_0xdb50('0x1d0')]){case'dropRate':var _0x32f21d=_0x9f02ea[_0xdb50('0x1c6')]/0x64;return _0x33ed54['abandonmentRate'](_0x5a1d95,_0x3a6c8f,_0x516fa2,_0x3a0609,_0x32f21d)['then'](function(_0x5757cf){return _0x4ba9a7(_0x5757cf);});case _0xdb50('0x1dc'):var _0x15cfb7=_0x9f02ea['dialPredictiveOptimizationPercentage']/0x64;return _0x33ed54[_0xdb50('0x1dd')](_0x5a1d95,_0x3a6c8f,_0x516fa2,_0x3a0609,_0x15cfb7)[_0xdb50('0x3b')](function(_0x17fdd5){return _0x4ba9a7(_0x17fdd5);});default:return _0x34c7b3(msgResponse('[getDataPredictive]',_0xdb50('0x142'),_0xdb50('0x1de')));}}else{return _0x34c7b3(msgResponse(_0xdb50('0x1df'),_0xdb50('0x142'),'check\x20failure'));}});};};Dialer[_0xdb50('0x1d')][_0xdb50('0x1e0')]=function(_0x166f67){var _0x49f7e3=this;return function(_0x15f0fc){return new BPromise(function(_0x561a54,_0x41b735){_[_0xdb50('0xcb')](_0x166f67,_0x15f0fc[0x0]);if(checkGetDataPredictive(_0x15f0fc[0x0])){loggerPredictive[_0xdb50('0x7b')](JSON['stringify'](_0x15f0fc[0x0]));if(_0x166f67[_0xdb50('0x1d0')]===_0xdb50('0x1cd')){return _0x49f7e3['getVoiceQueueRtPauses'](_0x166f67['id'])[_0xdb50('0x3b')](function(_0x21626d){var _0x2acd5e=_0x166f67[_0xdb50('0x50')]-_0x21626d[0x0]['outboundQueuePauses'];var _0x43eee0=_0x166f67[_0xdb50('0x1cc')]*0x3c;var _0x130370=_0x15f0fc[0x0][_0xdb50('0x66')]+_0x15f0fc[0x0]['predictiveIntervalAvgHoldtime'];var _0x1c9782=(_0x15f0fc[0x0][_0xdb50('0x65')]+_0x15f0fc[0x0][_0xdb50('0x67')]+_0x15f0fc[0x0][_0xdb50('0x1db')])/_0x15f0fc[0x0][_0xdb50('0x83')];var _0x3fd5ec=_0x166f67['dialPredictiveOptimizationPercentage']/0x64;_0x166f67['predictiveIntervalPauses']=_0x21626d[0x0][_0xdb50('0x1e1')]||0x0;_0x166f67[_0xdb50('0x6a')]=_0x1c9782>0x0?_0x1c9782:0x1;return _0x49f7e3[_0xdb50('0x1e2')](_0x2acd5e,_0x43eee0,_0x130370,_0x1c9782,_0x3fd5ec);})[_0xdb50('0x3b')](function(_0x2c9a12){return _0x561a54(_0x2c9a12);})[_0xdb50('0xab')](function(_0x5b62ed){return _0x41b735(msgResponse(_0xdb50('0x1e3'),_0xdb50('0x142'),JSON[_0xdb50('0x12a')](_0x5b62ed)));});}if(_0x166f67['dialPredictiveOptimization']===_0xdb50('0x1dc')){return _0x49f7e3['getVoiceQueueRtPauses'](_0x166f67['id'])['then'](function(_0x3b7580){var _0x5de259=_0x166f67[_0xdb50('0x50')]-_0x3b7580[0x0][_0xdb50('0x1e1')];var _0x3fbef0=_0x166f67[_0xdb50('0x1cc')]*0x3c;var _0x3a84b1=_0x15f0fc[0x0][_0xdb50('0x66')]+_0x15f0fc[0x0]['predictiveIntervalAvgHoldtime'];var _0x422707=(_0x15f0fc[0x0][_0xdb50('0x65')]+_0x15f0fc[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x15f0fc[0x0][_0xdb50('0x1db')])/_0x15f0fc[0x0]['predictiveIntervalTotalCalls'];var _0x3da5c9=_0x166f67[_0xdb50('0x1c6')]/0x64;_0x166f67[_0xdb50('0x1e4')]=_0x3b7580[0x0][_0xdb50('0x1e1')]||0x0;_0x166f67[_0xdb50('0x6a')]=_0x422707>0x0?_0x422707:0x1;return _0x49f7e3[_0xdb50('0x1dd')](_0x5de259,_0x3fbef0,_0x3a84b1,_0x422707,_0x3da5c9);})[_0xdb50('0x3b')](function(_0x17397b){return _0x561a54(_0x17397b);})[_0xdb50('0xab')](function(_0x1bc02f){return _0x41b735(msgResponse(_0xdb50('0x1e3'),'Failure',JSON['stringify'](_0x1bc02f)));});}}else{return _0x41b735(msgResponse(_0xdb50('0x1df'),_0xdb50('0x142'),_0xdb50('0x1e5')));}});};};Dialer[_0xdb50('0x1d')][_0xdb50('0x1d4')]=function(_0x836a3c){var _0x22bc4b=this;return function(){var _0x2157f0=0x0;var _0x293d0b=Math['floor'](_0x836a3c[_0xdb50('0x6f')]*0x3e8);if(_0x293d0b>0x0){_0x293d0b=_0x293d0b<0x64?0x64:_0x293d0b;loggerPredictive[_0xdb50('0x7b')](_0x836a3c[_0xdb50('0x40')],'one\x20call\x20every:',_0x293d0b,'milliseconds');_0x836a3c[_0xdb50('0x8d')]=setInterval(function(){_0x22bc4b['handlePredictive'](_0x836a3c);loggerPredictiveCalls[_0xdb50('0x7b')](_0xdb50('0x1e6'),_0x2157f0+=0x1);},_0x293d0b);}else{loggerPredictive[_0xdb50('0x7b')](_0x836a3c[_0xdb50('0x40')],_0xdb50('0x1e7'));}};};Dialer[_0xdb50('0x1d')]['checkContactBlack']=function(_0x4cf8ff,_0x2f549d){var _0x2b2fae=this;return function(_0x21556b){if(_[_0xdb50('0x46')](_0x21556b)){if(_['isNil'](_0x2f549d[_0xdb50('0xcf')])||!_0x2f549d[_0xdb50('0x1e8')]){if(_0x4cf8ff['dialMethod']===_0xdb50('0xb')){_0x4cf8ff[_0xdb50('0x129')]=_[_0xdb50('0x3d')](_0x4cf8ff['queueStatusComplete'])?!![]:_0x4cf8ff[_0xdb50('0x129')];var _0x406c2c=uuid['v4']();_0x2b2fae[_0xdb50('0x29')][_0x406c2c]=new Action(_0x4cf8ff,_0x2f549d,_0x406c2c);loggerBooked[_0xdb50('0x7b')](_0xdb50('0x1e9'),_0x406c2c,_0xdb50('0x1ea'),JSON[_0xdb50('0x12a')](_0x4cf8ff[_0xdb50('0x129')]),_0xdb50('0x1eb'),_0x4cf8ff[_0xdb50('0x40')]);if(_0x4cf8ff['queueStatusComplete']){_0x4cf8ff[_0xdb50('0x129')]=![];_0x2b2fae['queueBooked'][_0x2b2fae[_0xdb50('0x29')][_0x406c2c][_0xdb50('0xae')]]=[];ami[_0xdb50('0xa8')]({'actionid':_0x406c2c,'action':_0xdb50('0x1ec'),'queue':_0x4cf8ff[_0xdb50('0x40')]})[_0xdb50('0xab')](function(){_0x2b2fae[_0xdb50('0xad')](_0x4cf8ff);_0x2b2fae['rescheduleContact']({'active':![],'ContactId':_0x2b2fae[_0xdb50('0x29')][_0x406c2c][_0xdb50('0xcd')],'ListId':_0x2b2fae[_0xdb50('0x29')][_0x406c2c]['ListId'],'VoiceQueueId':_0x2b2fae[_0xdb50('0x29')][_0x406c2c][_0xdb50('0xd0')]||undefined,'CampaignId':_0x2b2fae[_0xdb50('0x29')][_0x406c2c][_0xdb50('0xd1')]||undefined})[_0xdb50('0xab')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2b2fae[_0xdb50('0x29')][_0x406c2c];});}else{loggerBooked[_0xdb50('0x7b')](_0xdb50('0x1ed'),JSON[_0xdb50('0x12a')](_0x4cf8ff[_0xdb50('0x129')]),_0xdb50('0x1eb'),_0x4cf8ff[_0xdb50('0x40')]);_0x2b2fae['updateOriginated'](_0x4cf8ff);_0x2b2fae[_0xdb50('0xb8')]({'active':![],'ContactId':_0x2b2fae[_0xdb50('0x29')][_0x406c2c][_0xdb50('0xcd')],'ListId':_0x2b2fae[_0xdb50('0x29')][_0x406c2c][_0xdb50('0xce')],'VoiceQueueId':_0x2b2fae[_0xdb50('0x29')][_0x406c2c][_0xdb50('0xd0')]||undefined,'CampaignId':_0x2b2fae[_0xdb50('0x29')][_0x406c2c][_0xdb50('0xd1')]||undefined})[_0xdb50('0xab')](loggerCatch(_0xdb50('0x1ee')));delete _0x2b2fae['actions'][_0x406c2c];}}else{return _0x2b2fae['actionOriginate'](_0x4cf8ff,_0x2f549d);}}else{if(getDiff(_0x2f549d[_0xdb50('0x1ef')])<_0x4cf8ff[_0xdb50('0x1f0')]*0x3c){if(_0x2f549d[_0xdb50('0x1f1')]&&!_0x2f549d[_0xdb50('0x1f1')]['voicePause']){_0x2b2fae[_0xdb50('0x22')][_0xdb50('0x133')](_0x2f549d['id'])[_0xdb50('0x20')](function(){_0x2b2fae['updateOriginated'](_0x4cf8ff);});}else{_0x2b2fae[_0xdb50('0xb9')]({'active':![]},_0x2f549d['id'],0x1)[_0xdb50('0x20')](function(){_0x2b2fae[_0xdb50('0xad')](_0x4cf8ff);});}}else{_0x4cf8ff[_0xdb50('0x62')]+=0x1;_0x2b2fae[_0xdb50('0xad')](_0x4cf8ff);if(_0x4cf8ff['dialRecallInQueue']){_0x2b2fae['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2f549d[_0xdb50('0xcd')],'ListId':_0x2f549d[_0xdb50('0xce')],'VoiceQueueId':_0x2f549d[_0xdb50('0xd0')]||undefined,'CampaignId':_0x2f549d[_0xdb50('0xd1')]||undefined})[_0xdb50('0xab')](loggerCatch(_0xdb50('0x1f2')));_0x2b2fae[_0xdb50('0xc3')](createObjHistory(_0x4cf8ff,_0x2f549d,'RECALLINQUEUE',0x17,_0xdb50('0x1f3')))[_0xdb50('0xab')](loggerCatch(_0xdb50('0x1f4')));}else{_0x2b2fae[_0xdb50('0xca')](createObjHistory(_0x4cf8ff,_0x2f549d,'RECALLFAILEDTIMEOUT',0x16,_0xdb50('0x1f5')),_0xdb50('0x1f6'),_0xdb50('0x1f7'));}}}}else{_0x4cf8ff['outboundBlacklistCallsDay']+=0x1;_0x2b2fae[_0xdb50('0xca')](createObjHistory(_0x4cf8ff,_0x2f549d,_0xdb50('0x1f8'),0xd,'Blacklist'),_0xdb50('0x1f9'),'[Originate][MoveBlacklist]');throw _0xdb50('0x1fa');}};};Dialer[_0xdb50('0x1d')][_0xdb50('0x1fb')]=function(_0x1fafd6){var _0x2f612d=this;var _0x7b766=_0x1fafd6[_0xdb50('0x1fc')]-_0x1fafd6[_0xdb50('0x6d')]-_0x1fafd6[_0xdb50('0xbc')];emitCampaignSummary(_0x1fafd6);if(_0x7b766>0x0){if(_0x7b766>this[_0xdb50('0x27')]){_0x7b766=this[_0xdb50('0x27')];}_0x1fafd6[_0xdb50('0xbc')]+=_0x7b766;this[_0xdb50('0xbe')](_0x1fafd6['id'],_0x7b766,_0x1fafd6[_0xdb50('0x1fd')],_0x1fafd6)[_0xdb50('0x3b')](function(_0x38537b){_0x1fafd6['temp']-=_0x7b766;_0x1fafd6[_0xdb50('0xbc')]=_0x1fafd6['temp']>0x0?_0x1fafd6['temp']:0x0;if(!checkContactEmpty(_0x38537b)){_0x1fafd6[_0xdb50('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xdb50('0x7b')](_0xdb50('0x1fe')+_0x1fafd6[_0xdb50('0x40')]);}else{_0x1fafd6[_0xdb50('0x6d')]+=_0x38537b[_0xdb50('0x95')];_0x1fafd6[_0xdb50('0x3e')]=_0xdb50('0x1ff');for(var _0x2afe7a=0x0;_0x2afe7a<_0x38537b[_0xdb50('0x95')];_0x2afe7a+=0x1){_0x1fafd6[_0xdb50('0x200')]+=0x1;if(_[_0xdb50('0xa7')](_0x38537b[_0x2afe7a])||_[_0xdb50('0xa7')](_0x38537b[_0x2afe7a][_0xdb50('0x16d')])||_['isNil'](_0x38537b[_0x2afe7a][_0xdb50('0x16d')][_0xdb50('0x16e')])){_0x2f612d[_0xdb50('0xc8')]('[actionOriginate]\x20',_0x1fafd6,_0x38537b[_0x2afe7a]);}else{_0x2f612d[_0xdb50('0xb5')](_[_0xdb50('0xcc')](_0x38537b[_0x2afe7a],['CampaignId','Contact.phone']))[_0xdb50('0x3b')](_0x2f612d['checkContactBlack'](_0x1fafd6,_0x38537b[_0x2afe7a]))[_0xdb50('0xab')](_0x2f612d[_0xdb50('0xc7')](_0xdb50('0x201'),_0x1fafd6));}}}})[_0xdb50('0xab')](loggerGetContactDialer(_0xdb50('0x202'),_0x1fafd6,_0x7b766));}};Dialer[_0xdb50('0x1d')][_0xdb50('0x154')]=function(_0x1e4113,_0x1fc6a7){var _0x433e2b=this;var _0x3e469f=[];var _0x4c7386=_0x1fc6a7>=0x1?_0x1fc6a7:0x1;if(_0x1e4113[_0xdb50('0x56')]===_0xdb50('0xb')){_0x4c7386=0x1;}var _0x3ffd75=Math[_0xdb50('0x1ca')](_0x1e4113[_0xdb50('0x9f')]*_0x4c7386)-_0x1e4113[_0xdb50('0x6d')]-_0x1e4113[_0xdb50('0xbc')];emitVoiceQueueSummary(_0x1e4113);if(_0x1e4113[_0xdb50('0x203')]>0x0){var _0x5aefc3=_0x1e4113[_0xdb50('0x203')]-_0x1e4113[_0xdb50('0x6d')]-_0x1e4113['talking']-_0x1e4113[_0xdb50('0xbc')]-_0x1e4113[_0xdb50('0x9e')];if(_0x3ffd75>_0x5aefc3){_0x3ffd75=_0x5aefc3;}}if(_0x3ffd75>0x0){if(_0x1e4113[_0xdb50('0x56')]===_0xdb50('0xb')){_0x3ffd75=0x1;}if(_0x3ffd75>this[_0xdb50('0x27')]){_0x3ffd75=this[_0xdb50('0x27')];}_0x1e4113[_0xdb50('0xbc')]+=_0x3ffd75;for(var _0x5944ba in this[_0xdb50('0x25')]){if(typeof this[_0xdb50('0x25')][_0x5944ba]!==_0xdb50('0x96')){if(this[_0xdb50('0x25')][_0x5944ba]['state']==='not_inuse'&&this[_0xdb50('0x25')][_0x5944ba][_0xdb50('0xa9')]===_0xdb50('0xd6')){_0x3e469f[_0xdb50('0x126')](this['agents'][_0x5944ba]['id']);}}}this[_0xdb50('0xbb')](_0x1e4113['id'],_0x3e469f,_0x3ffd75,_0x1e4113[_0xdb50('0x1fd')],_0x1e4113)[_0xdb50('0x3b')](function(_0x29a913){_0x1e4113[_0xdb50('0xbc')]-=_0x3ffd75;_0x1e4113[_0xdb50('0xbc')]=_0x1e4113['temp']>0x0?_0x1e4113[_0xdb50('0xbc')]:0x0;if(!checkContactEmpty(_0x29a913)){_0x433e2b[_0xdb50('0xb1')](_0x1e4113)['then'](sendMessageReschedule(_0x1e4113))[_0xdb50('0xab')](loggerCatch(_0xdb50('0xb3')));}else{_0x1e4113[_0xdb50('0x6d')]+=_0x29a913[_0xdb50('0x95')];_0x1e4113['message']=_0x1e4113[_0xdb50('0x56')]===_0xdb50('0xb')?_0xdb50('0x174'):'RUNNING';for(var _0x1d806b=0x0;_0x1d806b<_0x29a913[_0xdb50('0x95')];_0x1d806b+=0x1){if(_[_0xdb50('0xa7')](_0x29a913[_0x1d806b])||_[_0xdb50('0xa7')](_0x29a913[_0x1d806b][_0xdb50('0x16d')])||_[_0xdb50('0xa7')](_0x29a913[_0x1d806b]['Contact'][_0xdb50('0x16e')])){_0x433e2b[_0xdb50('0xc8')](_0xdb50('0x204'),_0x1e4113,_0x29a913[_0x1d806b]);}else{_0x433e2b[_0xdb50('0xb4')](_[_0xdb50('0xcc')](_0x29a913[_0x1d806b],[_0xdb50('0xd0'),_0xdb50('0x205')]))[_0xdb50('0x3b')](_0x433e2b['checkContactBlack'](_0x1e4113,_0x29a913[_0x1d806b]))[_0xdb50('0xab')](_0x433e2b['loggerHandler'](_0xdb50('0x204'),_0x1e4113));}}}})['catch'](loggerGetContactDialer(_0xdb50('0x206'),_0x1e4113,_0x3ffd75));}};Dialer[_0xdb50('0x1d')]['handlePredictive']=function(_0x572fb){if(_0x572fb[_0xdb50('0x203')]>0x0){var _0x19dd91=_0x572fb[_0xdb50('0x203')]-_0x572fb[_0xdb50('0x6d')]-_0x572fb[_0xdb50('0x9d')];if(_0x19dd91>0x0){this[_0xdb50('0x207')](_0x572fb);}else{loggerPredictiveCalls['info'](_0xdb50('0x208'));}}else{this[_0xdb50('0x207')](_0x572fb);}};Dialer[_0xdb50('0x1d')][_0xdb50('0x207')]=function(_0x2bcd5a){var _0x4801a3=this;var _0x2f2916=[];_0x2bcd5a[_0xdb50('0x6d')]+=0x1;for(var _0x3521f8 in this[_0xdb50('0x25')]){if(typeof this[_0xdb50('0x25')][_0x3521f8]!==_0xdb50('0x96')){if(this[_0xdb50('0x25')][_0x3521f8][_0xdb50('0xe0')]===_0xdb50('0x209')&&this[_0xdb50('0x25')][_0x3521f8][_0xdb50('0xa9')]===_0xdb50('0xd6')){_0x2f2916[_0xdb50('0x126')](this[_0xdb50('0x25')][_0x3521f8]['id']);}}}this['getContactDialer'](_0x2bcd5a['id'],_0x2f2916,0x1,_0x2bcd5a['dialOrderByScheduledAt'],_0x2bcd5a)[_0xdb50('0x3b')](function(_0x3633ab){if(!checkContactEmpty(_0x3633ab)){checkContactLowerLimitOriginate(_0x2bcd5a,0x1,0x0);_0x4801a3[_0xdb50('0xb1')](_0x2bcd5a)[_0xdb50('0x3b')](sendMessageReschedule(_0x2bcd5a))[_0xdb50('0xab')](loggerCatch(_0xdb50('0xb3')));}else{_0x2bcd5a[_0xdb50('0x3e')]=_0xdb50('0x1ff');if(_['isNil'](_0x3633ab[0x0])||_[_0xdb50('0xa7')](_0x3633ab[0x0][_0xdb50('0x16d')])||_['isNil'](_0x3633ab[0x0][_0xdb50('0x16d')]['phone'])){_0x4801a3[_0xdb50('0xc8')](_0xdb50('0x204'),_0x2bcd5a,_0x3633ab[0x0]);}else{_0x4801a3['checkIsBlackList'](_[_0xdb50('0xcc')](_0x3633ab[0x0],[_0xdb50('0xd0'),'Contact.phone']))[_0xdb50('0x3b')](_0x4801a3[_0xdb50('0x20a')](_0x2bcd5a,_0x3633ab[0x0]))[_0xdb50('0xab')](_0x4801a3[_0xdb50('0xc7')]('[actionOriginatePredictive]\x20',_0x2bcd5a));}}})[_0xdb50('0xab')](loggerGetContactDialer(_0xdb50('0x20b'),_0x2bcd5a,0x1));emitVoiceQueueSummary(_0x2bcd5a);};Dialer[_0xdb50('0x1d')][_0xdb50('0x1e2')]=function(_0x48cdc4,_0x1f27e2,_0x28f9cf,_0x55d438,_0x1e978c,_0x5624b9){loggerPredictive['info'](_0xdb50('0x20c'));loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x20d'),_0x48cdc4);loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x20e'),_0x1f27e2);loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x20f'),_0x28f9cf);loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x210'),_0x55d438);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e978c);loggerPredictive[_0xdb50('0x7b')]('---------------------------');return new BPromise(function(_0x55add8,_0x2e348f){if(_0x48cdc4<=0x0||isNaN(_0x48cdc4)){return _0x2e348f(msgResponse('[abandonmentRate]','Error','m\x20=\x20'+_0x48cdc4));}if(_0x28f9cf<=0x0||isNaN(_0x28f9cf)){return _0x2e348f(msgResponse(_0xdb50('0x211'),'Error','Ts\x20=\x20'+_0x28f9cf));}if(_0x55d438<=0x0||isNaN(_0x55d438)){return _0x2e348f(msgResponse(_0xdb50('0x211'),'Error',_0xdb50('0x212')+_0x55d438));}if(_0x1f27e2<=0x0||isNaN(_0x1f27e2)){return _0x2e348f(msgResponse(_0xdb50('0x211'),'Error',_0xdb50('0x213')+_0x1f27e2));}if(_0x1e978c<=0x0||isNaN(_0x1e978c)){return _0x2e348f(msgResponse(_0xdb50('0x211'),_0xdb50('0x4a'),'Amax\x20=\x20'+_0x1e978c));}_0x5624b9=_0x5624b9||0x0;var _0x590dbc=0x1/_0x28f9cf;var _0x3e6820=0x0;var _0x363d9a=0x0;var _0x2123d9=0x0;var _0x5e049f=0x0;for(var _0x28bc91=0x0;_0x2123d9<_0x1e978c;_0x28bc91+=0x1){_0x363d9a=_0x28bc91/_0x1f27e2;_0x3e6820=(_0x55d438*_0x363d9a+_0x5624b9)/_0x590dbc;_0x2123d9=erlangb(_0x3e6820,_0x48cdc4);_0x5e049f=_0x3e6820/_0x48cdc4*(0x1-erlangb(_0x3e6820,_0x48cdc4));}return _0x55add8({'erlangCalls':_0x28bc91,'erlangCallToSecond':_0x1f27e2/_0x28bc91,'erlangAbandonmentRate':_0x2123d9,'erlangBusyFactor':_0x5e049f});});};Dialer[_0xdb50('0x1d')]['busyFactor']=function(_0x4fa0f8,_0x44d0dd,_0x99a9aa,_0x10c90f,_0x58903a,_0x373d0d){loggerPredictive[_0xdb50('0x7b')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x20d'),_0x4fa0f8);loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x20e'),_0x44d0dd);loggerPredictive[_0xdb50('0x7b')]('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',_0x99a9aa);loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x210'),_0x10c90f);loggerPredictive['info'](_0xdb50('0x214'),_0x58903a);loggerPredictive[_0xdb50('0x7b')](_0xdb50('0x215'));return new BPromise(function(_0x31b0a9,_0x1fd126){if(_0x4fa0f8<=0x0||isNaN(_0x4fa0f8)){return _0x1fd126(msgResponse(_0xdb50('0x216'),_0xdb50('0x4a'),_0xdb50('0x217')+_0x4fa0f8));}if(_0x99a9aa<=0x0||isNaN(_0x99a9aa)){return _0x1fd126(msgResponse(_0xdb50('0x216'),_0xdb50('0x4a'),_0xdb50('0x218')+_0x99a9aa));}if(_0x10c90f<=0x0||isNaN(_0x10c90f)){return _0x1fd126(msgResponse(_0xdb50('0x216'),_0xdb50('0x4a'),_0xdb50('0x212')+_0x10c90f));}if(_0x44d0dd<=0x0||isNaN(_0x44d0dd)){return _0x1fd126(msgResponse('[busyFactor]',_0xdb50('0x4a'),_0xdb50('0x213')+_0x44d0dd));}if(_0x58903a<=0x0||isNaN(_0x58903a)){return _0x1fd126(msgResponse('[busyFactor]','Error',_0xdb50('0x219')+_0x58903a));}_0x373d0d=_0x373d0d||0x0;var _0x2857db=0x1/_0x99a9aa;var _0x4d84ce=0x0;var _0x291043=0x0;var _0x1b67e5=0x0;var _0x4ea7c5=0x0;for(var _0x43b28c=0x0;_0x4ea7c5<_0x58903a;_0x43b28c+=0x1){_0x291043=_0x43b28c/_0x44d0dd;_0x4d84ce=(_0x10c90f*_0x291043+_0x373d0d)/_0x2857db;_0x1b67e5=erlangb(_0x4d84ce,_0x4fa0f8);_0x4ea7c5=_0x4d84ce/_0x4fa0f8*(0x1-erlangb(_0x4d84ce,_0x4fa0f8));}return _0x31b0a9({'erlangCalls':_0x43b28c,'erlangCallToSecond':_0x44d0dd/_0x43b28c,'erlangAbandonmentRate':_0x1b67e5,'erlangBusyFactor':_0x4ea7c5});});};module['exports']=Dialer; \ No newline at end of file +var _0xe36f=['originated','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','talking','waiting','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','state','statedesc','endtime','prototype','clearZombieChannels','[uniqueid]','actions','[actions]','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','ContactId','ListId','VoiceQueueId','[emptyContact]','isSuccess','Success','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','dialAMDActive','HANGUP','outboundAnswerCallsDay','HangupInAMD','custom:amd','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','membername','AMD','countmachineretry','countglobal','amd','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','dialMachineMaxRetry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','AnswerAGI','[syncHangupIvr]','dialQueueProject','cause-txt','Unknow','syncAgentComplete','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','dialQueueTimeout','dropreason','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','Drop','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','roundrobin','paused','agents','locked','stateinterface','queueBooked','push','pick','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','checkPreviewRecallReminder','throttle','filter','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','dialPreviewRecallmeReminder','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','responsetime','getQueue','response','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','object','reason','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','reason\x2020\x20agentreject','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','dialOrderByScheduledAt','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','ACTIVE','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Interval:\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','exports','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','rrmemory','enqueue','tail','finally','sequence','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','originateresponse','custom:queuesummary','hangup','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','diff','seconds','emit','type','outbound','strategy','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','stringify','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','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','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','milliseconds','handlePredictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length'];(function(_0x3ba5d2,_0x145e4f){var _0x35d196=function(_0x292b5f){while(--_0x292b5f){_0x3ba5d2['push'](_0x3ba5d2['shift']());}};_0x35d196(++_0x145e4f);}(_0xe36f,0x18c));var _0xfe36=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe36f[_0x321bb2];return _0x9c12ed;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xfe36('0x0'));var uuid=require(_0xfe36('0x1'));var moment=require('moment');var rr=require('rr');var md5=require(_0xfe36('0x2'));var Redis=require(_0xfe36('0x3'));var ut=require(_0xfe36('0x4'));var config=require('../../../config/environment/');var logger=require(_0xfe36('0x5'))(_0xfe36('0x6'));var loggerBooked=require(_0xfe36('0x5'))(_0xfe36('0x7'));var loggerPredictive=require('../../../config/logger')(_0xfe36('0x8'));var loggerPredictiveCalls=require(_0xfe36('0x5'))(_0xfe36('0x9'));var loggerSyncQueueSummary=require(_0xfe36('0x5'))(_0xfe36('0xa'));var ami=require(_0xfe36('0xb'));config[_0xfe36('0xc')]=_[_0xfe36('0xd')](config[_0xfe36('0xc')],{'host':_0xfe36('0xe'),'port':0x18eb});var io=require(_0xfe36('0xf'))(new Redis(config[_0xfe36('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xfe36('0x10'));var cmHopperBlack=require(_0xfe36('0x11'));var voiceQueueRt=require(_0xfe36('0x12'));var RpcSetting=require(_0xfe36('0x13'));var Action=require(_0xfe36('0x14'));var History=require(_0xfe36('0x15'));var Final=require('./final');var AgentComplete=require(_0xfe36('0x16'));var QueueCallerAbandon=require(_0xfe36('0x17'));var Hangup=require(_0xfe36('0x18'));var ipAgi=process[_0xfe36('0x19')][_0xfe36('0x1a')]||'127.0.0.1';var strategy={'rrmemory':_0xfe36('0x1b'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xfe36('0x1c')]=function(_0x4a261f){this[_0xfe36('0x1d')]=this['tail']?this[_0xfe36('0x1d')][_0xfe36('0x1e')](_0x4a261f):_0x4a261f();};function Dialer(_0x4d7874,_0x4bbf3c){this[_0xfe36('0x1f')]=new Sequence();this['preview']=_0x4bbf3c;this[_0xfe36('0x20')]=_0x4d7874[_0xfe36('0x20')];this[_0xfe36('0x21')]=_0x4d7874[_0xfe36('0x21')];this['agents']=_0x4d7874['agents'];this[_0xfe36('0x22')]=_0x4d7874[_0xfe36('0x22')];this[_0xfe36('0x23')]=config['maxNumberOriginate']||0x2;this[_0xfe36('0x24')]={};this['actions']={};this[_0xfe36('0x25')]={};this[_0xfe36('0x26')]={};this[_0xfe36('0x27')]={};this[_0xfe36('0x28')]={};this[_0xfe36('0x29')]={};this[_0xfe36('0x2a')]={};this['queueBooked']={};this[_0xfe36('0x2b')]={};ami['on']('agentconnect',this[_0xfe36('0x2c')][_0xfe36('0x2d')](this));ami['on'](_0xfe36('0x2e'),this['syncQueueCallerAbandon'][_0xfe36('0x2d')](this));ami['on'](_0xfe36('0x2f'),this['syncOriginateResponse'][_0xfe36('0x2d')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0xfe36('0x2d')](this));ami['on'](_0xfe36('0x30'),this['syncQueueSummary'][_0xfe36('0x2d')](this));ami['on'](_0xfe36('0x31'),this[_0xfe36('0x32')][_0xfe36('0x2d')](this));ami['on']('newexten',this[_0xfe36('0x33')]['bind'](this));ami['on'](_0xfe36('0x34'),this['syncVarSet']['bind'](this));ami['on'](_0xfe36('0x35'),this[_0xfe36('0x36')][_0xfe36('0x2d')](this));ami['on']('queuestatuscomplete',this[_0xfe36('0x37')]['bind'](this));this['loopCampaigns']();this[_0xfe36('0x38')]();RpcSetting[_0xfe36('0x39')]()[_0xfe36('0x3a')](function(_0x191316){previewRecallmeReminderInterval=_0x191316['previewRecallmeReminderInterval'];});}function isNotNull(_0x4067c3){return _0x4067c3!==null&&!_['isUndefined'](_0x4067c3);}function checkIsLoggedIn(_0x45123b,_0x19b2bf){return function(){if(_0x19b2bf<=0x0){_0x45123b['message']=_0xfe36('0x3b');throw _0x45123b[_0xfe36('0x3c')]+_0xfe36('0x3d');}};}function isActive(_0x424d1e){return _0x424d1e;}function checkIsActive(_0x2f2c20,_0x1d7f89){return function(){if(!isActive(_0x1d7f89)){_0x2f2c20[_0xfe36('0x3e')]=_0xfe36('0x3f');throw _0x2f2c20['name']+_0xfe36('0x40');}};}function checkInterval(_0x4e9544){return function(){if(!isNotNull(_0x4e9544[_0xfe36('0x41')])){_0x4e9544['message']=_0xfe36('0x42');throw _0x4e9544[_0xfe36('0x3c')]+_0xfe36('0x43');}if(!isNotNull(_0x4e9544[_0xfe36('0x41')]['Intervals'])){_0x4e9544['message']=_0xfe36('0x42');throw _0x4e9544[_0xfe36('0x3c')]+_0xfe36('0x43');}if(!isNotNull(_[_0xfe36('0x44')](_0x4e9544[_0xfe36('0x41')][_0xfe36('0x45')]))){_0x4e9544[_0xfe36('0x3e')]='INTERVAL_IS_NULL';throw _0x4e9544[_0xfe36('0x3c')]+_0xfe36('0x43');}};}function msgResponse(_0x4ba563,_0xd7081f,_0x1de290){return{'action':_0x4ba563,'response':_0xd7081f,'message':_0x1de290,'stack':_0x1de290};}function myreject(_0x1b0505){return function(_0x10d09d){return _0x1b0505(msgResponse(_0xfe36('0x46'),_0xfe36('0x47'),JSON['stringify'](_0x10d09d)));};}function getSeconds(_0xad76bf,_0x279c0e){var _0x141fb8=moment(_0xad76bf)['milliseconds'](0x0);var _0x3198cd=moment(_0x279c0e)['milliseconds'](0x0);return _0x141fb8[_0xfe36('0x48')](_0x3198cd,_0xfe36('0x49'));}function emit(_0xaed0a8,_0xa9ef48,_0x806a3a){io['to'](_0xaed0a8)[_0xfe36('0x4a')](_0xa9ef48,_0x806a3a);}function emitVoiceQueueSummary(_0x40ecdc){if(_0x40ecdc[_0xfe36('0x4b')]===_0xfe36('0x4c')){var _0x4c50a5={'id':_0x40ecdc['id'],'name':_0x40ecdc['name'],'strategy':_0x40ecdc[_0xfe36('0x4d')],'answered':_0x40ecdc['answered'],'available':_0x40ecdc[_0xfe36('0x4e')],'loggedIn':_0x40ecdc[_0xfe36('0x4f')],'pTalking':_0x40ecdc[_0xfe36('0x50')],'sumBillable':_0x40ecdc['sumBillable'],'sumDuration':_0x40ecdc[_0xfe36('0x51')],'sumHoldTime':_0x40ecdc[_0xfe36('0x52')]||0x0,'talking':_0x40ecdc['talking'],'total':_0x40ecdc[_0xfe36('0x53')],'type':_0x40ecdc[_0xfe36('0x4b')],'unmanaged':_0x40ecdc[_0xfe36('0x54')],'abandoned':_0x40ecdc[_0xfe36('0x55')],'waiting':_0x40ecdc['waiting'],'loggedInDb':_0x40ecdc[_0xfe36('0x56')],'dialActive':_0x40ecdc[_0xfe36('0x57')],'dialMethod':_0x40ecdc[_0xfe36('0x58')],'dialOriginateCallerIdName':_0x40ecdc[_0xfe36('0x59')],'dialOriginateCallerIdNumber':_0x40ecdc[_0xfe36('0x5a')],'dialOriginateTimeout':_0x40ecdc[_0xfe36('0x5b')],'dialPrefix':_0x40ecdc[_0xfe36('0x5c')],'outboundAnswerAgiCallsDay':_0x40ecdc[_0xfe36('0x5d')],'outboundAnswerCallsDay':_0x40ecdc['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x40ecdc[_0xfe36('0x5e')],'outboundBusyCallsDay':_0x40ecdc[_0xfe36('0x5f')],'outboundCongestionCallsDay':_0x40ecdc[_0xfe36('0x60')],'outboundDropCallsDayACS':_0x40ecdc[_0xfe36('0x61')],'outboundDropCallsDayCallersExit':_0x40ecdc['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x40ecdc[_0xfe36('0x62')],'outboundNoAnswerCallsDay':_0x40ecdc[_0xfe36('0x63')],'outboundNoSuchCallsDay':_0x40ecdc[_0xfe36('0x64')],'outboundOriginateFailureCallsDay':_0x40ecdc[_0xfe36('0x65')],'outboundReCallsDay':_0x40ecdc[_0xfe36('0x66')],'outboundRejectCallsDay':_0x40ecdc[_0xfe36('0x67')],'outboundUnknownCallsDay':_0x40ecdc[_0xfe36('0x68')],'predictiveIntervalAnsweredCalls':_0x40ecdc[_0xfe36('0x69')],'predictiveIntervalAvgHoldtime':_0x40ecdc[_0xfe36('0x6a')],'predictiveIntervalAvgTalktime':_0x40ecdc[_0xfe36('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x40ecdc[_0xfe36('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x40ecdc[_0xfe36('0x6d')],'predictiveIntervalErlangCalls':_0x40ecdc[_0xfe36('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0x40ecdc[_0xfe36('0x6f')],'predictiveIntervalHitRate':_0x40ecdc[_0xfe36('0x70')],'predictiveIntervalMultiplicativeFactor':_0x40ecdc[_0xfe36('0x71')],'predictiveIntervalPauses':_0x40ecdc[_0xfe36('0x72')],'predictiveIntervalAvailable':_0x40ecdc['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x40ecdc['predictiveIntervalTotalCalls'],'message':_0x40ecdc[_0xfe36('0x3e')],'originated':_0x40ecdc['originated'],'erlangCalls':_0x40ecdc['erlangCalls'],'erlangCallToSecond':_0x40ecdc[_0xfe36('0x73')],'erlangAbandonmentRate':_0x40ecdc['erlangAbandonmentRate'],'erlangBusyFactor':_0x40ecdc[_0xfe36('0x74')],'startPredictive':_0x40ecdc[_0xfe36('0x28')],'startProgressive':_0x40ecdc['startProgressive']};if(_0x40ecdc[_0xfe36('0x75')]){_0x4c50a5[_0xfe36('0x75')]={'id':_0x40ecdc[_0xfe36('0x75')]['id'],'name':_0x40ecdc[_0xfe36('0x75')]['name'],'active':_0x40ecdc['Trunk'][_0xfe36('0x76')],'callerid':_0x40ecdc[_0xfe36('0x75')][_0xfe36('0x77')]};}if(_0x40ecdc[_0xfe36('0x41')]){_0x4c50a5[_0xfe36('0x41')]={'id':_0x40ecdc[_0xfe36('0x41')]['id'],'name':_0x40ecdc[_0xfe36('0x41')]['name']};}var _0x5304ae=md5(JSON[_0xfe36('0x78')](_0x4c50a5));if(_0x40ecdc[_0xfe36('0x2')]!==_0x5304ae){_0x40ecdc[_0xfe36('0x2')]=_0x5304ae;emit(util[_0xfe36('0x79')]('voice:queue:%s',_0x4c50a5[_0xfe36('0x3c')]),_0xfe36('0x7a'),_0x4c50a5);}}}function emitCampaignSummary(_0x4fd5ca){if(_0x4fd5ca[_0xfe36('0x4b')]===_0xfe36('0x7b')){emit(util[_0xfe36('0x79')](_0xfe36('0x7c'),_0x4fd5ca[_0xfe36('0x3c')]),_0xfe36('0x7d'),_0x4fd5ca);}}function checkGetDataPredictive(_0x1c18c4){if(isNotNull(_0x1c18c4)&&!_[_0xfe36('0x44')](_0x1c18c4)){loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x7f'));loggerPredictive[_0xfe36('0x7e')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c18c4[_0xfe36('0x80')]);loggerPredictive[_0xfe36('0x7e')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c18c4[_0xfe36('0x69')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c18c4[_0xfe36('0x6d')]);loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x81'),_0x1c18c4['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0xfe36('0x82'),_0x1c18c4[_0xfe36('0x6a')]);loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x83'),_0x1c18c4[_0xfe36('0x6b')]);loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x84'));if(_0x1c18c4[_0xfe36('0x80')]>0x0){if(!_[_0xfe36('0x85')](_0x1c18c4[_0xfe36('0x6b')])&&_0x1c18c4[_0xfe36('0x6b')]>0x0){return!![];}loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x86'));if(!_[_0xfe36('0x85')](_0x1c18c4[_0xfe36('0x6a')])&&_0x1c18c4[_0xfe36('0x6a')]>0x0){return!![];}loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x87'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x88'));}return![];}function mergeDataErlangB(_0x89ecd8){return function(_0xafc289){loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x89'));loggerPredictive['info'](_0xfe36('0x8a'),_0xafc289[_0xfe36('0x8b')]);loggerPredictive[_0xfe36('0x7e')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xafc289[_0xfe36('0x73')]);loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x8c'),_0xafc289[_0xfe36('0x8d')]);loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x8e'),_0xafc289['erlangBusyFactor']);loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x8c'),_0xafc289[_0xfe36('0x8d')]);loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x84'));_['merge'](_0x89ecd8,_0xafc289);};}function getDiff(_0x27560e){var _0x13fae1=moment()[_0xfe36('0x8f')](0x0);var _0x5037d7=moment(_0x27560e)[_0xfe36('0x8f')](0x0);return _0x13fae1[_0xfe36('0x48')](_0x5037d7,_0xfe36('0x49'));}function ifInterval(_0x466433,_0xa7f06){if(_[_0xfe36('0x85')](_0xa7f06)){return![];}return getDiff(_0xa7f06)<_0x466433*0x3c;}function freeVariablesPredictive(_0x4a34fa){if(isNotNull(_0x4a34fa)){if(!_[_0xfe36('0x85')](_0x4a34fa[_0xfe36('0x29')])){_0x4a34fa['startProgressive']=undefined;loggerPredictive['info'](_0x4a34fa[_0xfe36('0x3c')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xfe36('0x85')](_0x4a34fa[_0xfe36('0x28')])){_0x4a34fa['startPredictive']=undefined;loggerPredictive[_0xfe36('0x7e')](_0x4a34fa['name'],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x4a34fa['handlePredictive'])){clearInterval(_0x4a34fa['handlePredictive']);_0x4a34fa[_0xfe36('0x90')]=undefined;loggerPredictive[_0xfe36('0x7e')](_0x4a34fa[_0xfe36('0x3c')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x4d9e3b,_0x3231f0){if(_0x3231f0===0x0){return 0x0;}var _0x316fef=0x1;for(var _0x8e665f=0x1;_0x8e665f<=_0x3231f0;_0x8e665f+=0x1){_0x316fef=0x1+_0x316fef*_0x8e665f/_0x4d9e3b;}return 0x1/_0x316fef;}function isVoiceQueueOutbound(_0x2e8fe9){return _0x2e8fe9==='outbound';}function isNotPreview(_0x4f8686){return _0x4f8686!==_0xfe36('0x91');}function isCampaignIvr(_0x17743a){return _0x17743a===_0xfe36('0x7b');}function getCallerId(_0x252d42,_0x2fa62d,_0x1ee91a){if(!_[_0xfe36('0x85')](_0x1ee91a)&&typeof _0x1ee91a==='string'&&!_[_0xfe36('0x44')](_0x1ee91a)){if(!_[_0xfe36('0x85')](_0x2fa62d)&&typeof _0x2fa62d===_0xfe36('0x92')&&!_['isEmpty'](_0x2fa62d)){return util['format'](_0xfe36('0x93'),_0x2fa62d,_0x1ee91a);}return util[_0xfe36('0x79')](_0xfe36('0x93'),_0x1ee91a,_0x1ee91a);}if(!_[_0xfe36('0x85')](_0x252d42)&&typeof _0x252d42===_0xfe36('0x92')&&!_[_0xfe36('0x44')](_0x252d42)){return _0x252d42;}return _0xfe36('0x94');}function loggerCatchQueueSummary(_0x5eeddf,_0x544dbe){return function(_0x1b9d4f){freeVariablesPredictive(_0x544dbe);emitVoiceQueueSummary(_0x544dbe);emitCampaignSummary(_0x544dbe);loggerSyncQueueSummary[_0xfe36('0x95')](_0x5eeddf,util[_0xfe36('0x96')](_0x1b9d4f,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x18676b,_0x1a767a){return function(_0x4f14c2){loggerPredictive[_0xfe36('0x95')](_0x1a767a[_0xfe36('0x3c')],_0x18676b);loggerPredictive[_0xfe36('0x95')](_0x4f14c2[_0xfe36('0x97')]);freeVariablesPredictive(_0x1a767a);};}function loggerCatch(_0x3e674b){return function(_0x3d8628){logger['error'](_0x3e674b,util[_0xfe36('0x96')](_0x3d8628,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x411d91){return _0x411d91&&!_[_0xfe36('0x85')](_0x411d91)&&_0x411d91[_0xfe36('0x98')]>0x0;}function decremetOriginate(_0x4bd49f){if(!_[_0xfe36('0x85')](_0x4bd49f)&&_0x4bd49f!==null){if(typeof _0x4bd49f[_0xfe36('0x99')]!==_0xfe36('0x9a')){if(_0x4bd49f[_0xfe36('0x99')]>0x0){_0x4bd49f['originated']-=0x1;}else{logger[_0xfe36('0x95')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xfe36('0x95')](_0xfe36('0x9b'));}}function checkContactLowerLimitOriginate(_0x12a2a2,_0x34034b,_0x53216c){if(_0x34034b>_0x53216c){for(var _0x59d82a=0x0;_0x59d82a<_0x34034b-_0x53216c;_0x59d82a+=0x1){decremetOriginate(_0x12a2a2);}}}function loggerGetContactDialer(_0xbf0f2f,_0xfa6ee,_0x26dae8){return function(_0x44fb69){checkContactLowerLimitOriginate(_0xfa6ee,_0x26dae8,0x0);logger[_0xfe36('0x95')](_0xbf0f2f,util['inspect'](_0x44fb69,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x262767){return function(_0x2c9355){if(isNotNull(_0x2c9355)&&isNotNull(_0x2c9355[0x0])){if(_0x2c9355[0x0][_0xfe36('0x9c')]>0x0){_0x262767[_0xfe36('0x3e')]=_0xfe36('0x9d');logger[_0xfe36('0x7e')](_0xfe36('0x9e')+_0x262767[_0xfe36('0x3c')],_0x2c9355[0x0]['contactsRescheduled'],_0xfe36('0x9f'));}else{_0x262767['message']=_0xfe36('0xa0');logger[_0xfe36('0x7e')]('[getContactDialer2][Empty]'+_0x262767[_0xfe36('0x3c')]);}}};}function notSendMessagesQueue(_0x12ace2){if(_0x12ace2[_0xfe36('0xa1')]){freeVariablesPredictive(_0x12ace2);if(_0x12ace2[_0xfe36('0x99')]===0x0&&_0x12ace2[_0xfe36('0xa2')]===0x0&&_0x12ace2[_0xfe36('0xa3')]===0x0&&(_0x12ace2['pTalking']||0x0)===0x0){_0x12ace2[_0xfe36('0xa1')]=![];_0x12ace2[_0xfe36('0x4e')]=0x0;_0x12ace2[_0xfe36('0x3e')]=_0xfe36('0x3f');loggerSyncQueueSummary['error'](_0xfe36('0xa4'),_0x12ace2['name'],'is\x20not\x20active');}else{_0x12ace2[_0xfe36('0x3e')]=_0xfe36('0xa5');loggerSyncQueueSummary[_0xfe36('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x12ace2[_0xfe36('0x3c')],_0xfe36('0xa6'));}emitVoiceQueueSummary(_0x12ace2);}}function notSendMessagesCampaign(_0x4bcf85){if(_0x4bcf85[_0xfe36('0xa1')]){if(_0x4bcf85[_0xfe36('0x99')]===0x0){_0x4bcf85[_0xfe36('0xa1')]=![];_0x4bcf85[_0xfe36('0x3e')]=_0xfe36('0x3f');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4bcf85['name'],'is\x20not\x20active');}else{_0x4bcf85['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0xfe36('0x95')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4bcf85['name'],_0xfe36('0xa6'));}emitCampaignSummary(_0x4bcf85);}}function createObjHistory(_0x314cf4,_0x8961a7,_0x60e93d,_0x3b6f5b,_0x11e666){_0x314cf4[_0xfe36('0x3e')]=_0x60e93d;var _0x2da83f=new Action(_0x314cf4,_0x8961a7);var _0x43ae86=new History(_0x2da83f);_0x43ae86[_0xfe36('0xa7')]=_0x3b6f5b;_0x43ae86[_0xfe36('0xa8')]=_0x11e666;_0x43ae86[_0xfe36('0xa9')]=_0x2da83f['starttime'];return _0x43ae86;}Dialer[_0xfe36('0xaa')][_0xfe36('0x38')]=function(){var _0x235f0d=this;setInterval(function(){_0x235f0d[_0xfe36('0xab')](_0x235f0d[_0xfe36('0x26')],_0xfe36('0xac'));_0x235f0d[_0xfe36('0xab')](_0x235f0d[_0xfe36('0xad')],_0xfe36('0xae'));},0x32c8);};Dialer[_0xfe36('0xaa')][_0xfe36('0xab')]=function(_0x2a48db,_0x59ccc2){var _0x50d02c=this;for(var _0x2f50a9 in _0x2a48db){if(typeof _0x2a48db[_0x2f50a9]!==_0xfe36('0x9a')){this['sequence'][_0xfe36('0x1c')](function(){if(!_[_0xfe36('0xaf')](_0x2a48db[_0x2f50a9])){return ami[_0xfe36('0xb0')]({'action':_0xfe36('0xb1'),'channel':_0x2a48db[_0x2f50a9][_0xfe36('0xb2')]})['catch'](function(_0x27724d){if(_0x27724d[_0xfe36('0x3e')]===_0xfe36('0xb3')){setTimeout(function(){if(_0x2a48db[_0x2f50a9]&&_0x2a48db[_0x2f50a9][_0xfe36('0x4b')]!==_0xfe36('0x7b')){_0x50d02c[_0xfe36('0xb4')](_0x50d02c[_0xfe36('0x20')][_0x2a48db[_0x2f50a9][_0xfe36('0xb5')]]);logger[_0xfe36('0x95')](_0xfe36('0xb6'),_0x59ccc2,_0x2f50a9,_0x2a48db[_0x2f50a9][_0xfe36('0xb5')]);delete _0x2a48db[_0x2f50a9];}if(_0x2a48db[_0x2f50a9]&&_0x2a48db[_0x2f50a9]['type']===_0xfe36('0x7b')){_0x50d02c[_0xfe36('0xb4')](_0x50d02c[_0xfe36('0x21')][_0x2a48db[_0x2f50a9][_0xfe36('0xb5')]]);logger[_0xfe36('0x95')](_0xfe36('0xb7'),_0x59ccc2,_0x2f50a9,_0x2a48db[_0x2f50a9][_0xfe36('0xb5')]);delete _0x2a48db[_0x2f50a9];}},0x2328);}});}});}}};Dialer[_0xfe36('0xaa')][_0xfe36('0xb8')]=function(_0x291aaf){return BPromise[_0xfe36('0xb9')]()[_0xfe36('0x3a')](cmHopper[_0xfe36('0xb8')](_0x291aaf))[_0xfe36('0xba')](loggerCatch(_0xfe36('0xbb')));};Dialer[_0xfe36('0xaa')][_0xfe36('0xbc')]=function(_0x42df7a){return BPromise['resolve']()['then'](cmHopperBlack[_0xfe36('0xbc')](_0x42df7a))[_0xfe36('0xba')](loggerCatch(_0xfe36('0xbd')));};Dialer[_0xfe36('0xaa')]['checkIsBlackListIvr']=function(_0x3f9e30){return BPromise[_0xfe36('0xb9')]()[_0xfe36('0x3a')](cmHopperBlack[_0xfe36('0xbe')](_0x3f9e30))[_0xfe36('0xba')](loggerCatch(_0xfe36('0xbf')));};Dialer[_0xfe36('0xaa')][_0xfe36('0xc0')]=function(_0x9abe59){return BPromise['resolve']()[_0xfe36('0x3a')](cmHopperHistory[_0xfe36('0xc1')](_0x9abe59))[_0xfe36('0xba')](loggerCatch(_0xfe36('0xc2')));};Dialer['prototype'][_0xfe36('0xc3')]=function(_0xa04e27){return BPromise[_0xfe36('0xb9')]()[_0xfe36('0x3a')](cmHopper[_0xfe36('0xc3')](_0xa04e27))['catch'](loggerCatch(_0xfe36('0xc4')));};Dialer[_0xfe36('0xaa')]['unlockContact']=function(_0x349b8b,_0x5135cb,_0xdf1566){return BPromise[_0xfe36('0xb9')]()[_0xfe36('0x3a')](cmHopper['unlockContact'](_0x349b8b,_0x5135cb,_0xdf1566))[_0xfe36('0xba')](loggerCatch(_0xfe36('0xc5')));};Dialer['prototype'][_0xfe36('0xc6')]=function(_0x4aaba0,_0x59e16c,_0x2bdd2b,_0xe396,_0x14e258){return BPromise['resolve']()[_0xfe36('0x3a')](cmHopper[_0xfe36('0xc6')](_0x4aaba0,_0x59e16c,_0x2bdd2b,_0xe396))['catch'](function(_0x2b2d98){_0x14e258[_0xfe36('0xc7')]-=_0x2bdd2b;_0x14e258['temp']=_0x14e258['temp']>0x0?_0x14e258['temp']:0x0;loggerCatch(_0xfe36('0xc8'))(_0x2b2d98);});};Dialer[_0xfe36('0xaa')][_0xfe36('0xc9')]=function(_0x10fe25,_0x1a0607,_0x2b05b5,_0x3d99ff){return BPromise[_0xfe36('0xb9')]()[_0xfe36('0x3a')](cmHopper[_0xfe36('0xc9')](_0x10fe25,_0x1a0607,_0x2b05b5))[_0xfe36('0xba')](function(_0x1e0960){_0x3d99ff[_0xfe36('0xc7')]-=_0x1a0607;_0x3d99ff['temp']=_0x3d99ff[_0xfe36('0xc7')]>0x0?_0x3d99ff[_0xfe36('0xc7')]:0x0;loggerCatch(_0xfe36('0xca'))(_0x1e0960);});};Dialer[_0xfe36('0xaa')][_0xfe36('0xcb')]=function(_0x11f11b){return BPromise[_0xfe36('0xb9')]()[_0xfe36('0x3a')](voiceQueueRt[_0xfe36('0xcb')](_0x11f11b))[_0xfe36('0xba')](loggerCatch(_0xfe36('0xcc')));};Dialer[_0xfe36('0xaa')][_0xfe36('0xcd')]=function(_0xfb5c22){return BPromise[_0xfe36('0xb9')]()[_0xfe36('0x3a')](cmHopper['moveContactManagedDialer'](_0xfb5c22))[_0xfe36('0xba')](loggerCatch(_0xfe36('0xce')));};Dialer[_0xfe36('0xaa')][_0xfe36('0xcf')]=function(_0x34b7a6){return BPromise[_0xfe36('0xb9')]()[_0xfe36('0x3a')](cmHopperHistory[_0xfe36('0xcf')](_0x34b7a6))[_0xfe36('0xba')](loggerCatch(_0xfe36('0xd0')));};Dialer[_0xfe36('0xaa')]['updateOriginated']=function(_0x449dd9){if(!_[_0xfe36('0x85')](_0x449dd9)&&_0x449dd9!==null){if(typeof _0x449dd9[_0xfe36('0x99')]!==_0xfe36('0x9a')){if(_0x449dd9[_0xfe36('0x99')]>0x0){_0x449dd9['originated']-=0x1;}else{logger[_0xfe36('0x95')](_0xfe36('0xd1'));}}}else{logger['error'](_0xfe36('0xd2'));}};Dialer[_0xfe36('0xaa')][_0xfe36('0xd3')]=function(_0x101545,_0x36ac7c){var _0x132f0a=this;return function(_0x23af1b){_0x132f0a[_0xfe36('0xb4')](_0x36ac7c);logger[_0xfe36('0x95')](_0x101545,util[_0xfe36('0x96')](_0x23af1b,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xfe36('0xd4')]=function(_0x18d44e,_0x17f14d,_0x30a7f0){var _0x3b76d1={'state':0x19,'statedesc':_0xfe36('0xd5')};this[_0xfe36('0xb4')](_0x17f14d);this[_0xfe36('0xd6')](_[_0xfe36('0xd7')](_0x3b76d1,_['pick'](_0x30a7f0,[_0xfe36('0xd8'),_0xfe36('0xd9'),'UserId',_0xfe36('0xda'),'CampaignId'])),'[emptyContact][createHistory]',_0xfe36('0xdb'));logger[_0xfe36('0x95')](_0x18d44e);};Dialer[_0xfe36('0xaa')][_0xfe36('0xdc')]=function(_0xb89a9c){return _0xb89a9c===_0xfe36('0xdd');};Dialer[_0xfe36('0xaa')]['isTrunkReachable']=function(_0x39de90){return!_[_0xfe36('0x85')](_0x39de90)&&_0x39de90&&!_[_0xfe36('0x85')](_0x39de90['name'])&&!_[_0xfe36('0x85')](_0x39de90[_0xfe36('0x76')])&&_0x39de90[_0xfe36('0x76')]&&(this[_0xfe36('0x22')][util[_0xfe36('0x79')](_0xfe36('0xde'),_0x39de90[_0xfe36('0x3c')])][_0xfe36('0xb1')]===_0xfe36('0xdf')||this['trunks'][util[_0xfe36('0x79')](_0xfe36('0xde'),_0x39de90[_0xfe36('0x3c')])][_0xfe36('0xb1')]===_0xfe36('0xe0'));};Dialer['prototype'][_0xfe36('0xd6')]=function(_0x2337b3,_0x3ad602,_0x401647){this[_0xfe36('0xcf')](_0x2337b3)[_0xfe36('0xba')](loggerCatch(_0x3ad602));this[_0xfe36('0xcd')](_0x2337b3)[_0xfe36('0xba')](loggerCatch(_0x401647));};Dialer[_0xfe36('0xaa')]['syncVarSet']=function(_0x261382){var _0x3c3285=this['uniqueId'][_0x261382[_0xfe36('0xe1')]];var _0x4797ab;if(!_[_0xfe36('0xaf')](_0x261382)&&!_[_0xfe36('0xaf')](_0x261382[_0xfe36('0xe2')])&&!_['isNil'](_0x261382['variable'][_0xfe36('0xe3')])&&_0x261382[_0xfe36('0xe4')]==='xcally-motion-dialer'&&_0x3c3285){if(_0x3c3285['type']!==_0xfe36('0x7b')&&this[_0xfe36('0x20')][_0x3c3285[_0xfe36('0xb5')]][_0xfe36('0xe5')]&&_0x261382['value']===_0xfe36('0xe6')){delete this['uniqueId'][_0x261382['uniqueid']];this['updateOriginated'](this[_0xfe36('0x20')][_0x3c3285[_0xfe36('0xb5')]]);this[_0xfe36('0x20')][_0x3c3285[_0xfe36('0xb5')]][_0xfe36('0xe7')]+=0x1;this[_0xfe36('0x20')][_0x3c3285[_0xfe36('0xb5')]][_0xfe36('0x5d')]+=0x1;_0x4797ab=new Hangup(_0x3c3285,_0x261382);_0x4797ab[_0xfe36('0xa7')]=0x12;_0x4797ab[_0xfe36('0xa8')]=_0xfe36('0xe8');_0x4797ab['membername']='AMD';ami['emit'](_0xfe36('0xe9'),ut[_0xfe36('0xea')](_0x4797ab,'amd'));this[_0xfe36('0xd6')](_0x4797ab,_0xfe36('0xeb'),_0xfe36('0xec'));}if(_0x3c3285[_0xfe36('0x4b')]!=='ivr'&&this['voiceQueues'][_0x3c3285[_0xfe36('0xb5')]]['dialAMDActive']&&_0x261382[_0xfe36('0xed')]===_0xfe36('0xee')){var _0x1704a2=this;return new BPromise(function(_0x57f30c,_0x4d70f8){delete _0x1704a2[_0xfe36('0x26')][_0x261382[_0xfe36('0xe1')]];_0x1704a2['updateOriginated'](_0x1704a2['voiceQueues'][_0x3c3285['queue']]);_0x1704a2[_0xfe36('0x20')][_0x3c3285['queue']][_0xfe36('0xe7')]+=0x1;_0x1704a2[_0xfe36('0x20')][_0x3c3285[_0xfe36('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3a96e7=_0x1704a2[_0xfe36('0x20')][_0x3c3285[_0xfe36('0xb5')]];var _0x3e6e27=new Hangup(_0x3c3285,_0x261382);_0x3e6e27[_0xfe36('0xa7')]=0x13;_0x3e6e27['statedesc']=_0xfe36('0xef');_0x3e6e27[_0xfe36('0xf0')]=_0xfe36('0xf1');_0x3e6e27[_0xfe36('0xf2')]+=0x1;_0x3e6e27[_0xfe36('0xf3')]+=0x1;_0x3e6e27[_0xfe36('0xf4')]=!![];ami[_0xfe36('0x4a')](_0xfe36('0xe9'),ut[_0xfe36('0xea')](_0x3e6e27,_0xfe36('0xf4')));_0x1704a2['createHistory'](_0x3e6e27)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3e6e27[_0xfe36('0xf5')]+_0x3e6e27['countcongestionretry']+_0x3e6e27['countnoanswerretry']+_0x3e6e27[_0xfe36('0xf6')]+_0x3e6e27[_0xfe36('0xf7')]+_0x3e6e27[_0xfe36('0xf8')]+_0x3e6e27[_0xfe36('0xf2')]+_0x3e6e27[_0xfe36('0xf9')]>=_0x3a96e7[_0xfe36('0xfa')]){_0x1704a2[_0xfe36('0xfb')](_0x3e6e27,_0x57f30c,_0x4d70f8,_0xfe36('0xfc'));}else{if(_0x3e6e27[_0xfe36('0xf2')]>=_0x3a96e7['dialMachineMaxRetry']){_0x1704a2[_0xfe36('0xfd')](_0x3e6e27,_0x57f30c,_0x4d70f8,_0xfe36('0xfe'));}else{_0x1704a2[_0xfe36('0xc3')]({'active':![],'countmachineretry':_0x3e6e27[_0xfe36('0xf2')],'scheduledat':moment()[_0xfe36('0xff')](_0x3a96e7[_0xfe36('0x100')],_0xfe36('0x101'))[_0xfe36('0x79')](_0xfe36('0x102')),'ContactId':_0x3e6e27[_0xfe36('0xd8')],'ListId':_0x3e6e27[_0xfe36('0xd9')],'VoiceQueueId':_0x3e6e27[_0xfe36('0xda')]||undefined,'CampaignId':_0x3e6e27[_0xfe36('0x103')]||undefined})['catch'](loggerCatch(_0xfe36('0x104')));_0x57f30c({'reschedule':0x1});}}});}if(_0x3c3285[_0xfe36('0x4b')]===_0xfe36('0x7b')&&this['campaigns'][_0x3c3285['queue']][_0xfe36('0xe5')]&&_0x261382[_0xfe36('0xed')]===_0xfe36('0xe6')){delete this[_0xfe36('0x26')][_0x261382[_0xfe36('0xe1')]];this[_0xfe36('0xb4')](this['campaigns'][_0x3c3285[_0xfe36('0xb5')]]);_0x4797ab=new Hangup(_0x3c3285,_0x261382);_0x4797ab[_0xfe36('0xa7')]=0x12;_0x4797ab[_0xfe36('0xa8')]=_0xfe36('0xe8');_0x4797ab[_0xfe36('0xf0')]=_0xfe36('0xf1');ami[_0xfe36('0x4a')](_0xfe36('0xe9'),ut[_0xfe36('0xea')](_0x4797ab,_0xfe36('0xf4')));this[_0xfe36('0xd6')](_0x4797ab,_0xfe36('0x105'),_0xfe36('0x106'));}if(_0x3c3285[_0xfe36('0x4b')]===_0xfe36('0x7b')&&this[_0xfe36('0x21')][_0x3c3285[_0xfe36('0xb5')]][_0xfe36('0xe5')]&&_0x261382['value']===_0xfe36('0xee')){var _0x1704a2=this;return new BPromise(function(_0x4f2f95,_0x4f5d3b){delete _0x1704a2[_0xfe36('0x26')][_0x261382[_0xfe36('0xe1')]];_0x1704a2[_0xfe36('0xb4')](_0x1704a2[_0xfe36('0x21')][_0x3c3285['queue']]);_0x1704a2[_0xfe36('0x21')][_0x3c3285[_0xfe36('0xb5')]][_0xfe36('0xe7')]+=0x1;_0x1704a2[_0xfe36('0x21')][_0x3c3285[_0xfe36('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x17571b=_0x1704a2[_0xfe36('0x21')][_0x3c3285[_0xfe36('0xb5')]];var _0x4b5f4a=new Hangup(_0x3c3285,_0x261382);_0x4b5f4a[_0xfe36('0xa7')]=0x13;_0x4b5f4a[_0xfe36('0xa8')]=_0xfe36('0xef');_0x4b5f4a[_0xfe36('0xf0')]=_0xfe36('0xf1');_0x4b5f4a[_0xfe36('0xf2')]+=0x1;_0x4b5f4a[_0xfe36('0xf3')]+=0x1;_0x4b5f4a[_0xfe36('0xf4')]=!![];ami['emit']('custom:amd',ut['buildObj'](_0x4b5f4a,'amd'));_0x1704a2[_0xfe36('0xcf')](_0x4b5f4a)['catch'](loggerCatch(_0xfe36('0x107')));if(_0x4b5f4a[_0xfe36('0xf5')]+_0x4b5f4a[_0xfe36('0x108')]+_0x4b5f4a[_0xfe36('0x109')]+_0x4b5f4a[_0xfe36('0xf6')]+_0x4b5f4a['countdropretry']+_0x4b5f4a[_0xfe36('0xf8')]+_0x4b5f4a[_0xfe36('0xf2')]+_0x4b5f4a[_0xfe36('0xf9')]>=_0x17571b['dialGlobalMaxRetry']){_0x1704a2['stateGlobal'](_0x4b5f4a,_0x4f2f95,_0x4f5d3b,'reason19\x20machine....');}else{if(_0x4b5f4a[_0xfe36('0xf2')]>=_0x17571b[_0xfe36('0x10a')]){_0x1704a2['createStateFinal'](_0x4b5f4a,_0x4f2f95,_0x4f5d3b,_0xfe36('0xfe'));}else{_0x1704a2[_0xfe36('0xc3')]({'active':![],'countmachineretry':_0x4b5f4a['countmachineretry'],'scheduledat':moment()[_0xfe36('0xff')](_0x17571b[_0xfe36('0x100')],_0xfe36('0x101'))[_0xfe36('0x79')](_0xfe36('0x102')),'ContactId':_0x4b5f4a[_0xfe36('0xd8')],'ListId':_0x4b5f4a['ListId'],'VoiceQueueId':_0x4b5f4a[_0xfe36('0xda')]||undefined,'CampaignId':_0x4b5f4a[_0xfe36('0x103')]||undefined})[_0xfe36('0xba')](loggerCatch('[rescheduleContact][Machine]'));_0x4f2f95({'reschedule':0x1});}}});}}};Dialer[_0xfe36('0xaa')][_0xfe36('0x32')]=function(_0x2ff89e){var _0x2ca919=this[_0xfe36('0x26')][_0x2ff89e['uniqueid']];var _0x3df444=this;var _0x5494ea;if(_0x2ca919&&_0x2ca919[_0xfe36('0x4b')]===_0xfe36('0x7b')){delete this['uniqueId'][_0x2ff89e[_0xfe36('0xe1')]];this[_0xfe36('0xb4')](this['campaigns'][_0x2ca919['queue']]);this[_0xfe36('0x21')][_0x2ca919['queue']][_0xfe36('0x10b')]+=0x1;_0x5494ea=new Hangup(_0x2ca919,_0x2ff89e);this[_0xfe36('0xcf')](_0x5494ea)[_0xfe36('0xba')](loggerCatch(_0xfe36('0x10c')));this[_0xfe36('0xcd')](_0x5494ea)[_0xfe36('0xba')](loggerCatch('[syncHangupIvr]'));}if(_0x2ca919&&_0x2ca919[_0xfe36('0x4b')]!=='ivr'&&isNotNull(this[_0xfe36('0x20')][_0x2ca919[_0xfe36('0xb5')]]['dialQueueProject'])){delete this[_0xfe36('0x26')][_0x2ff89e[_0xfe36('0xe1')]];this[_0xfe36('0xb4')](this[_0xfe36('0x20')][_0x2ca919[_0xfe36('0xb5')]]);this[_0xfe36('0x20')][_0x2ca919[_0xfe36('0xb5')]][_0xfe36('0xe7')]+=0x1;this[_0xfe36('0x20')][_0x2ca919[_0xfe36('0xb5')]][_0xfe36('0x5d')]+=0x1;_0x5494ea=new Hangup(_0x2ca919,_0x2ff89e);_0x5494ea[_0xfe36('0xa7')]=0x10;_0x5494ea[_0xfe36('0xa8')]=_0xfe36('0x10d');_0x5494ea[_0xfe36('0xf0')]='AGI';this[_0xfe36('0xcf')](_0x5494ea)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xfe36('0xcd')](_0x5494ea)[_0xfe36('0xba')](loggerCatch(_0xfe36('0x10e')));}if(_0x2ca919&&_0x2ca919['type']!==_0xfe36('0x7b')&&!isNotNull(this[_0xfe36('0x20')][_0x2ca919[_0xfe36('0xb5')]][_0xfe36('0x10f')])){delete this[_0xfe36('0x26')][_0x2ff89e[_0xfe36('0xe1')]];this[_0xfe36('0xb4')](this['voiceQueues'][_0x2ca919['queue']]);this[_0xfe36('0x20')][_0x2ca919['queue']][_0xfe36('0x68')]+=0x1;_0x5494ea=new Hangup(_0x2ca919,_0x2ff89e);_0x5494ea[_0xfe36('0xa7')]=0xc;_0x5494ea[_0xfe36('0xa8')]=_0x2ff89e[_0xfe36('0x110')];_0x5494ea[_0xfe36('0xf0')]=_0xfe36('0x111');this[_0xfe36('0xcf')](_0x5494ea)[_0xfe36('0xba')](loggerCatch(_0xfe36('0x10c')));this[_0xfe36('0xcd')](_0x5494ea)['catch'](loggerCatch(_0xfe36('0x10e')));}};Dialer[_0xfe36('0xaa')][_0xfe36('0x112')]=function(_0x5f41b1){var _0x50f14e=this[_0xfe36('0x26')][_0x5f41b1[_0xfe36('0xe1')]];var _0x3454db=this;if(this['voiceQueues'][_0x5f41b1[_0xfe36('0xb5')]]){if(_0x50f14e&&_0x50f14e[_0xfe36('0x4b')]!==_0xfe36('0x7b')){delete this[_0xfe36('0x26')][_0x5f41b1['uniqueid']];this[_0xfe36('0x20')][_0x5f41b1[_0xfe36('0xb5')]][_0xfe36('0xe7')]+=0x1;var _0x1cd42c=new AgentComplete(_0x50f14e,_0x5f41b1);if(_0x5f41b1['reason']===_0xfe36('0x113')){_0x1cd42c[_0xfe36('0x114')]=this[_0xfe36('0x20')][_0x5f41b1[_0xfe36('0xb5')]][_0xfe36('0x115')]&&this[_0xfe36('0x20')][_0x5f41b1['queue']][_0xfe36('0x116')]?moment()[_0xfe36('0x79')](_0xfe36('0x102')):undefined;}this['createHistory'](_0x1cd42c)[_0xfe36('0xba')](loggerCatch(_0xfe36('0x117')));this[_0xfe36('0xcd')](_0x1cd42c)[_0xfe36('0xba')](loggerCatch(_0xfe36('0x118')));}}};Dialer[_0xfe36('0xaa')][_0xfe36('0x2c')]=function(_0x36035a){if(this[_0xfe36('0x20')][_0x36035a[_0xfe36('0xb5')]]){if(this[_0xfe36('0x26')][_0x36035a[_0xfe36('0xe1')]]&&this['uniqueId'][_0x36035a[_0xfe36('0xe1')]][_0xfe36('0x4b')]!==_0xfe36('0x7b')){this[_0xfe36('0xb4')](this[_0xfe36('0x20')][_0x36035a[_0xfe36('0xb5')]]);this['uniqueId'][_0x36035a[_0xfe36('0xe1')]][_0xfe36('0x119')]=moment()['format'](_0xfe36('0x102'));}}};Dialer[_0xfe36('0xaa')][_0xfe36('0x11a')]=function(_0x5f2a78){this['createHistory'](_0x5f2a78)[_0xfe36('0xba')](loggerCatch(_0xfe36('0x117')));this[_0xfe36('0xcd')](_0x5f2a78)[_0xfe36('0xba')](loggerCatch(_0xfe36('0x11b')));};Dialer[_0xfe36('0xaa')][_0xfe36('0x11c')]=function(_0x234e78){var _0x5a24e9=this[_0xfe36('0x26')][_0x234e78['uniqueid']];var _0x1bec60=this;if(this[_0xfe36('0x20')][_0x234e78[_0xfe36('0xb5')]]){if(_0x5a24e9&&_0x5a24e9[_0xfe36('0x4b')]!==_0xfe36('0x7b')){delete this[_0xfe36('0x26')][_0x234e78[_0xfe36('0xe1')]];this[_0xfe36('0xb4')](this[_0xfe36('0x20')][_0x234e78[_0xfe36('0xb5')]]);_0x5a24e9[_0xfe36('0x11d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x47748c=new QueueCallerAbandon(_0x5a24e9,_0x234e78);if(getSeconds(_0x5a24e9['droptime'],_0x5a24e9['responsetime'])>=_0x5a24e9[_0xfe36('0x11e')]){this[_0xfe36('0x20')][_0x234e78['queue']][_0xfe36('0x6d')]+=0x1;this[_0xfe36('0x20')][_0x234e78['queue']][_0xfe36('0x62')]+=0x1;this[_0xfe36('0x20')][_0x234e78[_0xfe36('0xb5')]][_0xfe36('0x6f')]+=0x1;_0x47748c[_0xfe36('0xa7')]=0xa;_0x47748c[_0xfe36('0xa8')]='Drop';_0x47748c[_0xfe36('0x11f')]=_0xfe36('0x120');_0x47748c['agiafterat']=this[_0xfe36('0x20')][_0x234e78[_0xfe36('0xb5')]][_0xfe36('0x115')]?moment()[_0xfe36('0x79')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x47748c[_0xfe36('0xf7')]+=0x1;_0x47748c[_0xfe36('0xf3')]+=0x1;if(_0x47748c['countdropretry']>=this[_0xfe36('0x20')][_0x234e78[_0xfe36('0xb5')]][_0xfe36('0x121')]){this[_0xfe36('0x11a')](_0x47748c);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x47748c[_0xfe36('0xf7')],'scheduledat':moment()[_0xfe36('0xff')](this[_0xfe36('0x20')][_0x234e78[_0xfe36('0xb5')]]['dialDropRetryFrequency'],_0xfe36('0x101'))[_0xfe36('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5a24e9[_0xfe36('0xd8')],'ListId':_0x5a24e9[_0xfe36('0xd9')],'VoiceQueueId':_0x5a24e9['VoiceQueueId']||undefined,'CampaignId':_0x5a24e9['CampaignId']||undefined})[_0xfe36('0xba')](loggerCatch(_0xfe36('0x122')));var _0x1ef35b=new History(_0x47748c);_0x1ef35b[_0xfe36('0xa7')]=0xa;_0x1ef35b[_0xfe36('0xa8')]=_0xfe36('0x123');_0x1ef35b[_0xfe36('0x124')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1ef35b['endtime']=_0x1ef35b[_0xfe36('0x124')];_0x1ef35b[_0xfe36('0x125')]=_0x47748c[_0xfe36('0x125')];_0x1ef35b['calleridnum']=_0x47748c[_0xfe36('0x126')];this[_0xfe36('0xcf')](_0x1ef35b)[_0xfe36('0xba')](loggerCatch(_0xfe36('0x127')));}}else{this['voiceQueues'][_0x234e78[_0xfe36('0xb5')]][_0xfe36('0x6c')]+=0x1;this[_0xfe36('0x20')][_0x234e78[_0xfe36('0xb5')]][_0xfe36('0x128')]+=0x1;_0x47748c[_0xfe36('0xa7')]=0xb;_0x47748c[_0xfe36('0xa8')]=_0xfe36('0x129');_0x47748c[_0xfe36('0x11f')]=_0xfe36('0x12a');_0x47748c[_0xfe36('0xf8')]+=0x1;_0x47748c[_0xfe36('0xf3')]+=0x1;if(_0x47748c[_0xfe36('0xf8')]>=this[_0xfe36('0x20')][_0x234e78[_0xfe36('0xb5')]][_0xfe36('0x12b')]){this[_0xfe36('0x11a')](_0x47748c);}else{this[_0xfe36('0xc3')]({'active':![],'countabandonedretry':_0x47748c['countabandonedretry'],'scheduledat':moment()['add'](this['voiceQueues'][_0x234e78[_0xfe36('0xb5')]]['dialAbandonedRetryFrequency'],'minutes')[_0xfe36('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5a24e9[_0xfe36('0xd8')],'ListId':_0x5a24e9['ListId'],'VoiceQueueId':_0x5a24e9[_0xfe36('0xda')]||undefined,'CampaignId':_0x5a24e9[_0xfe36('0x103')]||undefined})['catch'](loggerCatch(_0xfe36('0x12c')));var _0x1ef35b=new History(_0x47748c);_0x1ef35b[_0xfe36('0xa7')]=0xb;_0x1ef35b['statedesc']=_0xfe36('0x129');_0x1ef35b[_0xfe36('0x124')]=moment()[_0xfe36('0x79')](_0xfe36('0x102'));_0x1ef35b[_0xfe36('0xa9')]=_0x1ef35b[_0xfe36('0x124')];_0x1ef35b[_0xfe36('0x125')]=_0x47748c[_0xfe36('0x125')];_0x1ef35b['calleridnum']=_0x47748c['calleridnum'];this[_0xfe36('0xcf')](_0x1ef35b)['catch'](loggerCatch(_0xfe36('0x12d')));}}}}};Dialer['prototype'][_0xfe36('0x33')]=function(_0x3b49fb){if(this['actions'][_0x3b49fb[_0xfe36('0xe1')]]){this[_0xfe36('0xad')][_0x3b49fb[_0xfe36('0xe1')]][_0xfe36('0xb2')]=_0x3b49fb[_0xfe36('0xb2')];}if(this[_0xfe36('0x26')][_0x3b49fb['uniqueid']]){this[_0xfe36('0x26')][_0x3b49fb[_0xfe36('0xe1')]]['channel']=_0x3b49fb['channel'];}};Dialer['prototype'][_0xfe36('0x36')]=function(_0x3f6741){if(strategy[this[_0xfe36('0x20')][this['actions'][_0x3f6741[_0xfe36('0x12e')]][_0xfe36('0xb5')]][_0xfe36('0x4d')]]===_0xfe36('0x12f')){if(this[_0xfe36('0xad')][_0x3f6741[_0xfe36('0x12e')]]&&_['isNil'](this[_0xfe36('0xad')][_0x3f6741['actionid']]['locked'])&&_0x3f6741[_0xfe36('0xb1')]==='1'&&_0x3f6741[_0xfe36('0x130')]==='0'){if(this[_0xfe36('0x131')][_0x3f6741['stateinterface']]){if(!this['agents'][_0x3f6741['stateinterface']][_0xfe36('0x132')]){this['agents'][_0x3f6741[_0xfe36('0x133')]][_0xfe36('0x132')]=!![];this[_0xfe36('0xad')][_0x3f6741[_0xfe36('0x12e')]][_0xfe36('0x132')]=!![];this[_0xfe36('0xad')][_0x3f6741[_0xfe36('0x12e')]][_0xfe36('0x133')]=_0x3f6741[_0xfe36('0x133')];}}}}else if((strategy[this[_0xfe36('0x20')][this[_0xfe36('0xad')][_0x3f6741[_0xfe36('0x12e')]][_0xfe36('0xb5')]][_0xfe36('0x4d')]]||'rrmemory')===_0xfe36('0x1b')){if(this['actions'][_0x3f6741['actionid']]){if(this['agents'][_0x3f6741[_0xfe36('0x133')]]){this[_0xfe36('0xad')][_0x3f6741['actionid']][_0xfe36('0x133')]=_0x3f6741[_0xfe36('0x133')];if(_[_0xfe36('0xaf')](this['queueBooked'][this[_0xfe36('0xad')][_0x3f6741[_0xfe36('0x12e')]][_0xfe36('0xb5')]])){this[_0xfe36('0x134')][this[_0xfe36('0xad')][_0x3f6741[_0xfe36('0x12e')]][_0xfe36('0xb5')]]=[];}this['queueBooked'][this[_0xfe36('0xad')][_0x3f6741[_0xfe36('0x12e')]]['queue']][_0xfe36('0x135')](_[_0xfe36('0xd7')](_[_0xfe36('0x136')](this['actions'][_0x3f6741[_0xfe36('0x12e')]],[_0xfe36('0x137'),_0xfe36('0x133')]),{'status':_0x3f6741[_0xfe36('0xb1')],'paused':_0x3f6741[_0xfe36('0x130')]}));}}}};function unlockQueueStatus(_0x2a9514,_0x32e393){setTimeout(function(){if(_['isUndefined'](_0x2a9514['queueStatusComplete'])){loggerBooked[_0xfe36('0x95')](_0xfe36('0x138'),_0x32e393);}_0x2a9514['queueStatusComplete']=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x32e393,JSON['stringify'](_[_0xfe36('0x136')](_0x2a9514,[_0xfe36('0x3c'),_0xfe36('0x139')])));},0x1f3);}Dialer[_0xfe36('0xaa')][_0xfe36('0x37')]=function(_0x105605){var _0x3cc572=this;var _0x4e6b69=_0x3cc572[_0xfe36('0x20')][_0x3cc572['actions'][_0x105605[_0xfe36('0x12e')]][_0xfe36('0xb5')]];if(strategy[this[_0xfe36('0x20')][this[_0xfe36('0xad')][_0x105605[_0xfe36('0x12e')]][_0xfe36('0xb5')]][_0xfe36('0x4d')]]==='roundrobin'){if(this[_0xfe36('0xad')][_0x105605[_0xfe36('0x12e')]]&&this[_0xfe36('0xad')][_0x105605['actionid']][_0xfe36('0x133')]){this[_0xfe36('0x91')][_0xfe36('0x13a')](this[_0xfe36('0xad')][_0x105605['actionid']]['idHopper'],this[_0xfe36('0xad')][_0x105605[_0xfe36('0x12e')]][_0xfe36('0x133')])[_0xfe36('0xba')](function(_0x4ab81c){logger['error'](_0xfe36('0x13b'),util[_0xfe36('0x96')](_0x4ab81c,{'showHidden':![],'depth':null}));})['finally'](function(){_0x3cc572[_0xfe36('0xb4')](_0x3cc572['voiceQueues'][_0x3cc572[_0xfe36('0xad')][_0x105605[_0xfe36('0x12e')]][_0xfe36('0xb5')]]);_0x3cc572[_0xfe36('0x131')][_0x3cc572['actions'][_0x105605[_0xfe36('0x12e')]][_0xfe36('0x133')]][_0xfe36('0x132')]=![];delete _0x3cc572['actions'][_0x105605[_0xfe36('0x12e')]];unlockQueueStatus(_0x4e6b69);});}else{this[_0xfe36('0xb4')](this['voiceQueues'][this[_0xfe36('0xad')][_0x105605[_0xfe36('0x12e')]][_0xfe36('0xb5')]]);this[_0xfe36('0xc3')]({'active':![],'ContactId':this[_0xfe36('0xad')][_0x105605[_0xfe36('0x12e')]][_0xfe36('0xd8')],'ListId':this[_0xfe36('0xad')][_0x105605[_0xfe36('0x12e')]]['ListId'],'VoiceQueueId':this[_0xfe36('0xad')][_0x105605[_0xfe36('0x12e')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xfe36('0xad')][_0x105605[_0xfe36('0x12e')]][_0xfe36('0x103')]||undefined})[_0xfe36('0xba')](loggerCatch(_0xfe36('0x13c')));delete this[_0xfe36('0xad')][_0x105605['actionid']];unlockQueueStatus(_0x4e6b69);}}else if((strategy[this[_0xfe36('0x20')][this['actions'][_0x105605[_0xfe36('0x12e')]]['queue']][_0xfe36('0x4d')]]||_0xfe36('0x1b'))===_0xfe36('0x1b')){var _0x3bacf0;if(this[_0xfe36('0xad')][_0x105605[_0xfe36('0x12e')]]&&!_['isEmpty'](this['queueBooked'][this['actions'][_0x105605[_0xfe36('0x12e')]][_0xfe36('0xb5')]])){if(this[_0xfe36('0x2b')][_0x3cc572[_0xfe36('0xad')][_0x105605[_0xfe36('0x12e')]][_0xfe36('0xb5')]]){this['queueBookedRR'][_0x3cc572['actions'][_0x105605[_0xfe36('0x12e')]][_0xfe36('0xb5')]]=this[_0xfe36('0x2b')][this[_0xfe36('0xad')][_0x105605['actionid']]['queue']]?this[_0xfe36('0x2b')][this[_0xfe36('0xad')][_0x105605[_0xfe36('0x12e')]][_0xfe36('0xb5')]]:this['queueBooked'][this['actions'][_0x105605[_0xfe36('0x12e')]][_0xfe36('0xb5')]]?this[_0xfe36('0x134')][this[_0xfe36('0xad')][_0x105605['actionid']][_0xfe36('0xb5')]][_0xfe36('0x13d')]||0x0:0x0;}this[_0xfe36('0x134')][this[_0xfe36('0xad')][_0x105605[_0xfe36('0x12e')]][_0xfe36('0xb5')]]['_rr']=this['queueBookedRR'][this[_0xfe36('0xad')][_0x105605[_0xfe36('0x12e')]][_0xfe36('0xb5')]];for(var _0x50ef5b=0x0;_0x50ef5b=0x0;})[_0xfe36('0xba')](myreject(_0x492ce7)));}}else{_0x366b18['push'](ami[_0xfe36('0xb0')]({'action':_0xfe36('0x153'),'command':util[_0xfe36('0x79')](_0xfe36('0x154'),_0x509cf8,!_['isUndefined'](config[_0xfe36('0x150')][_0x4373b2])?_0x4373b2:'')})[_0xfe36('0x3a')](function(_0x5ce5d5){return _0x5ce5d5[_0xfe36('0x156')][_0xfe36('0x157')](_0xfe36('0x158'))>=0x0;})['catch'](myreject(_0x492ce7)));}BPromise[_0xfe36('0x159')](_0x366b18)[_0xfe36('0x3a')](function(_0x1a839a){var _0x4bc310=_[_0xfe36('0x15a')](_0x1a839a);if(_0x4bc310){return _0x24509f(_0x4bc310);}else{_0x20d329[_0xfe36('0x3e')]=_0x56e5cd?_0xfe36('0x15b'):_0xfe36('0x15c');return _0x492ce7(msgResponse('[ifTime][promiseAll]',_0xfe36('0x14e'),_0xfe36('0x15d')+_0x56e5cd+'\x20'+_0x150670+'\x20Interval\x20is\x20overtime:\x20'+util[_0xfe36('0x96')](_0x509cf8,{'showHidden':![],'depth':null})+_0xfe36('0x15e')+_0x4373b2));}})[_0xfe36('0xba')](function(_0x2d5822){return _0x492ce7(msgResponse('ifTime',_0xfe36('0x14e'),JSON[_0xfe36('0x78')](_0x2d5822)));});});};Dialer['prototype']['checkDialMethod']=function(_0x53d12e){var _0x4d263a=this;return function(){switch(_0x53d12e[_0xfe36('0x58')]){case _0xfe36('0x15f'):freeVariablesPredictive(_0x53d12e);_0x4d263a[_0xfe36('0x160')](_0x53d12e,0x1);break;case _0xfe36('0x161'):freeVariablesPredictive(_0x53d12e);_0x4d263a[_0xfe36('0x160')](_0x53d12e,_0x53d12e[_0xfe36('0x162')]);break;case _0xfe36('0x8'):_0x4d263a['predictive'](_0x53d12e);break;case _0xfe36('0x7'):freeVariablesPredictive(_0x53d12e);_0x4d263a[_0xfe36('0x160')](_0x53d12e,0x1);break;default:freeVariablesPredictive(_0x53d12e);logger[_0xfe36('0x95')]('Queue',_0x53d12e[_0xfe36('0x3c')],_0xfe36('0x163'));}};};Dialer['prototype'][_0xfe36('0x164')]=_[_0xfe36('0x165')](function(_0x1ed9fb){var _0x3d20c9=_[_0xfe36('0x166')](this[_0xfe36('0x131')],function(_0xa3d5aa){return _0xa3d5aa['online']&&_0xa3d5aa['status']===_0xfe36('0xdf');});if(_0x3d20c9['length']>0x0){return BPromise[_0xfe36('0xb9')]()[_0xfe36('0x3a')](cmHopper[_0xfe36('0x167')](_0x1ed9fb['id'],previewRecallmeReminderInterval,_[_0xfe36('0x168')](_0x3d20c9,'id')))['then'](function(_0x1999e2){for(var _0xc25b0a=0x0;_0xc25b0a<_0x1999e2['length'];_0xc25b0a++){var _0x3388cf=_0x1999e2[_0xc25b0a][_0xfe36('0x169')][_0xfe36('0x3c')];if(_0x3388cf)io['to'](util[_0xfe36('0x79')](_0xfe36('0x16a'),_0x3388cf))['emit'](_0xfe36('0x16b'),{'hopper':_0x1999e2[_0xc25b0a]});}})[_0xfe36('0xba')](function(_0x4b17ff){logger[_0xfe36('0x95')](_0xfe36('0x164'),_0x4b17ff);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xfe36('0xaa')]['launchHandleIvr']=function(_0x15dbd3){var _0x1dd541=this;return function(){_0x1dd541['handleIvr'](_0x15dbd3);};};Dialer[_0xfe36('0xaa')][_0xfe36('0xa')]=function(_0x581005){var _0x4618d3=this;if(isNotPreview(_0x581005[_0xfe36('0x58')])){if(isVoiceQueueOutbound(_0x581005[_0xfe36('0x4b')])&&isActive(_0x581005[_0xfe36('0x57')])){_0x581005[_0xfe36('0xa1')]=!![];BPromise[_0xfe36('0xb9')]()['then'](checkIsLoggedIn(_0x581005,_0x581005[_0xfe36('0x4f')]))['then'](checkIsActive(_0x581005,_0x581005[_0xfe36('0x57')]))['then'](checkInterval(_0x581005))['then'](_0x4618d3[_0xfe36('0x147')](_0x581005))['then'](_0x4618d3['checkIfTime'](_0x581005[_0xfe36('0x16c')],_0x581005[_0xfe36('0x16d')],_0x581005[_0xfe36('0x3c')],_0x581005))[_0xfe36('0x3a')](_0x4618d3[_0xfe36('0x14c')](_0x581005[_0xfe36('0x41')],_0x581005[_0xfe36('0x16d')],_0x581005['name'],_0x581005))[_0xfe36('0x3a')](_0x4618d3[_0xfe36('0x16e')](_0x581005))[_0xfe36('0xba')](loggerCatchQueueSummary(_0xfe36('0x16f'),_0x581005));}else{notSendMessagesQueue(_0x581005);}}else{freeVariablesPredictive(_0x581005);if(_0x581005[_0xfe36('0x170')]){_0x4618d3['checkPreviewRecallReminder'](_0x581005);}}};Dialer[_0xfe36('0xaa')][_0xfe36('0x146')]=function(){var _0x4b6905=this;var _0x5db4ea;for(var _0x51d53f in this[_0xfe36('0x21')]){if(typeof this[_0xfe36('0x21')][_0x51d53f]!==_0xfe36('0x9a')){_0x5db4ea=this['campaigns'][_0x51d53f];if(isCampaignIvr(_0x5db4ea[_0xfe36('0x4b')])&&isActive(_0x5db4ea[_0xfe36('0x76')])){_0x5db4ea[_0xfe36('0xa1')]=!![];BPromise[_0xfe36('0xb9')]()['then'](checkIsActive(_0x5db4ea,_0x5db4ea['active']))['then'](checkInterval(_0x5db4ea))['then'](_0x4b6905[_0xfe36('0x147')](_0x5db4ea))[_0xfe36('0x3a')](_0x4b6905[_0xfe36('0x14a')](_0x5db4ea[_0xfe36('0x16c')],_0x5db4ea['dialTimezone'],_0x5db4ea[_0xfe36('0x3c')],_0x5db4ea))[_0xfe36('0x3a')](_0x4b6905[_0xfe36('0x14c')](_0x5db4ea['Interval'],_0x5db4ea['dialTimezone'],_0x5db4ea['name'],_0x5db4ea))[_0xfe36('0x3a')](_0x4b6905['launchHandleIvr'](_0x5db4ea))[_0xfe36('0xba')](loggerCatchQueueSummary(_0xfe36('0x171'),_0x5db4ea));}else{notSendMessagesCampaign(_0x5db4ea);}}}};function getCallerIdRandom(_0x389a1,_0x4d95ba){var _0x2d8538;var _0x45abac;var _0x12141a;if(_0x4d95ba<=0x0){_0x4d95ba=0x1;}_0x2d8538=new RegExp(_0xfe36('0x172')+_0x4d95ba+'}$');_0x45abac=Math['pow'](0xa,_0x4d95ba-0x1);_0x12141a=Math[_0xfe36('0x173')](0xa,_0x4d95ba)-0x1;return util[_0xfe36('0x79')]('%s',_['replace'](_0x389a1,_0x2d8538,_[_0xfe36('0x174')](_0x45abac,_0x12141a)));}function extractCalleridName(_0x5c8bfe){var _0x4815fd=_0x5c8bfe[_0xfe36('0x175')](/"(.*?)"/);return _0x4815fd?_0x4815fd[0x1]:_0x5c8bfe;}function extractCalleridNumber(_0x142bde){var _0x55cdf9=_0x142bde[_0xfe36('0x175')](/<(.*?)>/);return _0x55cdf9?_0x55cdf9[0x1]:_0x142bde;}Dialer[_0xfe36('0xaa')][_0xfe36('0x176')]=function(_0x31225a,_0x45a1e0){var _0x36830c=this;var _0x5f4fb9=uuid['v4']();this[_0xfe36('0xad')][_0x5f4fb9]=new Action(_0x31225a,_0x45a1e0,_0x5f4fb9);return new BPromise(function(_0x34a7a7,_0x36d623){if(_['isUndefined'](_0x31225a)&&typeof _0x31225a!=='object'){return _0x36d623(msgResponse(_0xfe36('0x177'),_0xfe36('0x14e'),_0xfe36('0x178')));}if(_[_0xfe36('0x85')](_0x45a1e0[_0xfe36('0x179')][_0xfe36('0x17a')])||_0x45a1e0[_0xfe36('0x179')]['phone']===null){return _0x36d623(msgResponse(_0xfe36('0x177'),_0xfe36('0x14e'),_0xfe36('0x17b')));}var _0x5838a4={'XMD-CALLERID':_0x36830c[_0xfe36('0xad')][_0x5f4fb9][_0xfe36('0x17c')](),'XMD-AGI':_0x31225a['dialQueueProject']?util[_0xfe36('0x79')](_0xfe36('0x17d'),ipAgi,_0x31225a[_0xfe36('0x10f')]):_0xfe36('0x17e'),'XMD-AGIAFTER':_0x31225a[_0xfe36('0x115')]?util['format'](_0xfe36('0x17d'),ipAgi,_0x31225a[_0xfe36('0x115')]):_0xfe36('0x17e'),'XMD-QUEUE':_0x31225a['type']===_0xfe36('0x4c')?util['format'](_0xfe36('0x17f'),_0x31225a[_0xfe36('0x3c')],_0x31225a[_0xfe36('0x180')]||'',_0x31225a[_0xfe36('0x116')]?'c':'',_0x31225a['dialQueueTimeout']||0x3):_0xfe36('0x17e'),'XMD-CONTACTID':_0x45a1e0[_0xfe36('0xd8')],'XMD-CDRTYPE':_0xfe36('0x6'),'CALLERID(all)':_0x36830c[_0xfe36('0xad')][_0x5f4fb9][_0xfe36('0x17c')](),'XMD-AMD':_0x31225a['dialAMDActive']?'ACTIVE':'NONE','XMD-DESTINATION':_0xfe36('0x181')};if(_0x31225a[_0xfe36('0xe5')]){_0x5838a4[_0xfe36('0x182')]=_0x31225a[_0xfe36('0x183')]||0x9c4;_0x5838a4[_0xfe36('0x184')]=_0x31225a['dialAMDGreeting']||0x5dc;_0x5838a4[_0xfe36('0x185')]=_0x31225a[_0xfe36('0x186')]||0x320;_0x5838a4[_0xfe36('0x187')]=_0x31225a['dialAMDTotalAnalysisTime']||0x1388;_0x5838a4[_0xfe36('0x188')]=_0x31225a[_0xfe36('0x189')]||0x64;_0x5838a4[_0xfe36('0x18a')]=_0x31225a[_0xfe36('0x18b')]||0x32;_0x5838a4[_0xfe36('0x18c')]=_0x31225a[_0xfe36('0x18d')]||0x3;_0x5838a4[_0xfe36('0x18e')]=_0x31225a[_0xfe36('0x18f')]||0x100;_0x5838a4[_0xfe36('0x190')]=_0x31225a[_0xfe36('0x191')]||0x1388;}if(_0x31225a[_0xfe36('0x4b')]===_0xfe36('0x4c')){_0x5838a4[_0xfe36('0x192')]=_0x45a1e0[_0xfe36('0xda')];}else{_0x5838a4[_0xfe36('0x193')]=_0x45a1e0[_0xfe36('0x103')];}for(var _0x49a1b3 in _0x45a1e0['Contact']){if(typeof _0x45a1e0[_0xfe36('0x179')][_0x49a1b3]!=='undefined'){if(isNotNull(_0x45a1e0[_0xfe36('0x179')][_0x49a1b3])&&_0x49a1b3!=='id'&&_0x49a1b3!==_0xfe36('0x194')&&_0x49a1b3!==_0xfe36('0x195')&&_0x49a1b3!==_0xfe36('0x196')){_0x5838a4[util[_0xfe36('0x79')]('%s%s','XMD-',_[_0xfe36('0x197')](_0x49a1b3))]=_0x45a1e0[_0xfe36('0x179')][_0x49a1b3];}}}var _0x536d96=_0x36830c[_0xfe36('0x148')](_0x31225a[_0xfe36('0x75')])?getCallerId(_0x31225a[_0xfe36('0x75')][_0xfe36('0x77')],_0x31225a[_0xfe36('0x59')],_0x31225a[_0xfe36('0x198')]>0x0?getCallerIdRandom(_0x31225a['dialOriginateCallerIdNumber'],_0x31225a[_0xfe36('0x198')]):_0x31225a[_0xfe36('0x5a')]):getCallerId(_[_0xfe36('0xaf')](_0x31225a[_0xfe36('0x199')])?_0x31225a['Trunk'][_0xfe36('0x77')]:_0x31225a['TrunkBackup'][_0xfe36('0x77')],_0x31225a[_0xfe36('0x59')],_0x31225a[_0xfe36('0x198')]>0x0?getCallerIdRandom(_0x31225a[_0xfe36('0x5a')],_0x31225a[_0xfe36('0x198')]):_0x31225a['dialOriginateCallerIdNumber']);if(_0x536d96){_0x5838a4[_0xfe36('0x19a')]=_0x36830c['actions'][_0x5f4fb9][_0xfe36('0x19b')]=extractCalleridName(_0x536d96);_0x5838a4[_0xfe36('0x19c')]=_0x36830c[_0xfe36('0xad')][_0x5f4fb9][_0xfe36('0x19d')]=extractCalleridNumber(_0x536d96);}return ami[_0xfe36('0xb0')]({'actionid':_0x5f4fb9,'action':_0xfe36('0x177'),'channel':_0x36830c[_0xfe36('0x148')](_0x31225a[_0xfe36('0x75')])?util[_0xfe36('0x79')](_0xfe36('0x19e'),_0x31225a[_0xfe36('0x75')][_0xfe36('0x3c')],isNotNull(_0x31225a[_0xfe36('0x5c')])?_0x31225a[_0xfe36('0x5c')][_0xfe36('0x19f')]()||'':'',_0x31225a[_0xfe36('0x1a0')]>0x0?_0x45a1e0[_0xfe36('0x179')][_0xfe36('0x17a')]['substring'](_0x31225a[_0xfe36('0x1a0')]):_0x45a1e0[_0xfe36('0x179')][_0xfe36('0x17a')]):util[_0xfe36('0x79')](_0xfe36('0x19e'),_[_0xfe36('0xaf')](_0x31225a['TrunkBackup'])?_0x31225a[_0xfe36('0x75')][_0xfe36('0x3c')]:_0x31225a[_0xfe36('0x199')]['name'],isNotNull(_0x31225a[_0xfe36('0x5c')])?_0x31225a['dialPrefix']['trim']()||'':'',_0x31225a[_0xfe36('0x1a0')]>0x0?_0x45a1e0[_0xfe36('0x179')][_0xfe36('0x17a')][_0xfe36('0x1a1')](_0x31225a[_0xfe36('0x1a0')]):_0x45a1e0['Contact']['phone']),'callerid':_0x536d96,'Exten':_0xfe36('0x181'),'Context':_0xfe36('0x1a2'),'Priority':'1','variable':_0x5838a4,'timeout':(_0x31225a[_0xfe36('0x5b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5f4fb9})[_0xfe36('0x3a')](function(_0x440d59){return _0x34a7a7(_0x440d59);})[_0xfe36('0xba')](function(_0x555480){_0x31225a['outboundOriginateFailureCallsDay']+=0x1;var _0x43cd30=new History(_0x36830c['actions'][_0x5f4fb9]);logger[_0xfe36('0x95')](util[_0xfe36('0x79')](_0xfe36('0x1a3'),JSON[_0xfe36('0x78')](_0x555480)));_0x43cd30[_0xfe36('0xa7')]=0xe;_0x43cd30['statedesc']=_0xfe36('0x1a4');_0x43cd30[_0xfe36('0x124')]=moment()[_0xfe36('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x43cd30[_0xfe36('0xa9')]=_0x43cd30[_0xfe36('0x124')];_0x36830c[_0xfe36('0xcf')](_0x43cd30)[_0xfe36('0xba')](loggerCatch(_0xfe36('0x1a5')));_0x36830c[_0xfe36('0xcd')](_0x43cd30)[_0xfe36('0xba')](loggerCatch(_0xfe36('0x1a5')))[_0xfe36('0x1e')](function(){delete _0x36830c[_0xfe36('0xad')][_0x5f4fb9];return _0x36d623(msgResponse(_0xfe36('0x177'),_0xfe36('0x47'),_0xfe36('0x1a6')));});});});};Dialer[_0xfe36('0xaa')][_0xfe36('0x1a7')]=function(_0x235ae2){var _0x1f6ebf=this[_0xfe36('0xad')][_0x235ae2[_0xfe36('0x12e')]];if(_0x1f6ebf){delete this[_0xfe36('0xad')][_0x235ae2[_0xfe36('0x12e')]];_0x1f6ebf[_0xfe36('0x1a8')]=moment()[_0xfe36('0x79')](_0xfe36('0x102'));var _0x167f32=_0x1f6ebf[_0xfe36('0x4b')]===_0xfe36('0x7b')?this[_0xfe36('0x21')][_0x1f6ebf[_0xfe36('0xb5')]]:this[_0xfe36('0x20')][_0x1f6ebf[_0xfe36('0x1a9')]()];if(!this['isSuccess'](_0x235ae2[_0xfe36('0x1aa')])){this['updateOriginated'](_0x167f32);return this['callProgressDetecting'](_0x1f6ebf,_0x167f32,_0x235ae2)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this[_0xfe36('0x26')][_0x235ae2[_0xfe36('0xe1')]]=_0x1f6ebf;}};Dialer[_0xfe36('0xaa')][_0xfe36('0x1ab')]=function(_0x22a9b5,_0x1364d4,_0x5812aa){var _0x4f39bd=new History(_0x1364d4);if(_0x4f39bd[_0xfe36('0xf5')]+_0x4f39bd[_0xfe36('0x108')]+_0x4f39bd['countnoanswerretry']+_0x4f39bd[_0xfe36('0xf6')]+_0x4f39bd[_0xfe36('0xf7')]+_0x4f39bd['countabandonedretry']+_0x4f39bd[_0xfe36('0xf2')]+_0x4f39bd[_0xfe36('0xf9')]>=_0x5812aa[_0xfe36('0xfa')]-0x1){return!![];}switch(_0x22a9b5){case 0x3:if(_0x4f39bd['countnoanswerretry']>=_0x5812aa[_0xfe36('0x1ac')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x4f39bd[_0xfe36('0x109')]+=0x1,'scheduledat':moment()['add'](_0x5812aa[_0xfe36('0x1ad')],_0xfe36('0x101'))['format'](_0xfe36('0x102')),'ContactId':_0x4f39bd[_0xfe36('0xd8')],'ListId':_0x4f39bd[_0xfe36('0xd9')],'VoiceQueueId':_0x4f39bd[_0xfe36('0xda')]||undefined,'CampaignId':_0x4f39bd['CampaignId']||undefined})[_0xfe36('0xba')](loggerCatch(_0xfe36('0x1ae')));break;case 0x5:if(_0x4f39bd[_0xfe36('0xf5')]>=_0x5812aa['dialBusyMaxRetry']-0x1){return!![];}this[_0xfe36('0xc3')]({'active':![],'countbusyretry':_0x4f39bd[_0xfe36('0xf5')]+=0x1,'scheduledat':moment()[_0xfe36('0xff')](_0x5812aa['dialBusyRetryFrequency'],_0xfe36('0x101'))[_0xfe36('0x79')](_0xfe36('0x102')),'ContactId':_0x4f39bd[_0xfe36('0xd8')],'ListId':_0x4f39bd[_0xfe36('0xd9')],'VoiceQueueId':_0x4f39bd[_0xfe36('0xda')]||undefined,'CampaignId':_0x4f39bd[_0xfe36('0x103')]||undefined})['catch'](loggerCatch(_0xfe36('0x1af')));break;case 0x8:if(_0x4f39bd['countcongestionretry']>=_0x5812aa[_0xfe36('0x1b0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x4f39bd[_0xfe36('0x108')]+=0x1,'scheduledat':moment()['add'](_0x5812aa['dialCongestionRetryFrequency'],_0xfe36('0x101'))[_0xfe36('0x79')](_0xfe36('0x102')),'ContactId':_0x4f39bd[_0xfe36('0xd8')],'ListId':_0x4f39bd[_0xfe36('0xd9')],'VoiceQueueId':_0x4f39bd[_0xfe36('0xda')]||undefined,'CampaignId':_0x4f39bd[_0xfe36('0x103')]||undefined})['catch'](loggerCatch(_0xfe36('0x1b1')));break;case 0x0:if(_0x4f39bd[_0xfe36('0xf6')]>=_0x5812aa[_0xfe36('0x1b2')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x4f39bd[_0xfe36('0xf6')]+=0x1,'scheduledat':moment()[_0xfe36('0xff')](_0x5812aa['dialNoSuchNumberRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f39bd[_0xfe36('0xd8')],'ListId':_0x4f39bd[_0xfe36('0xd9')],'VoiceQueueId':_0x4f39bd[_0xfe36('0xda')]||undefined,'CampaignId':_0x4f39bd[_0xfe36('0x103')]||undefined})[_0xfe36('0xba')](loggerCatch(_0xfe36('0x1b3')));}break;case 0xa:if(_0x4f39bd[_0xfe36('0xf7')]>=_0x5812aa[_0xfe36('0x121')]-0x1){return!![];}this[_0xfe36('0xc3')]({'active':![],'countdropretry':_0x4f39bd[_0xfe36('0xf7')]+=0x1,'scheduledat':moment()[_0xfe36('0xff')](_0x5812aa['dialDropRetryFrequency'],_0xfe36('0x101'))[_0xfe36('0x79')](_0xfe36('0x102')),'ContactId':_0x4f39bd['ContactId'],'ListId':_0x4f39bd['ListId'],'VoiceQueueId':_0x4f39bd[_0xfe36('0xda')]||undefined,'CampaignId':_0x4f39bd[_0xfe36('0x103')]||undefined})[_0xfe36('0xba')](loggerCatch(_0xfe36('0x122')));break;case 0xb:if(_0x4f39bd['countabandonedretry']>=_0x5812aa[_0xfe36('0x12b')]-0x1){return!![];}this[_0xfe36('0xc3')]({'active':![],'countabandonedretry':_0x4f39bd[_0xfe36('0xf8')]+=0x1,'scheduledat':moment()[_0xfe36('0xff')](_0x5812aa[_0xfe36('0x1b4')],'minutes')[_0xfe36('0x79')](_0xfe36('0x102')),'ContactId':_0x4f39bd[_0xfe36('0xd8')],'ListId':_0x4f39bd['ListId'],'VoiceQueueId':_0x4f39bd[_0xfe36('0xda')]||undefined,'CampaignId':_0x4f39bd[_0xfe36('0x103')]||undefined})['catch'](loggerCatch(_0xfe36('0x12c')));break;case 0x13:if(_0x4f39bd[_0xfe36('0xf2')]>=_0x5812aa['dialMachineMaxRetry']-0x1){return!![];}this[_0xfe36('0xc3')]({'active':![],'countmachineretry':_0x4f39bd[_0xfe36('0xf2')]+=0x1,'scheduledat':moment()[_0xfe36('0xff')](_0x5812aa[_0xfe36('0x100')],_0xfe36('0x101'))['format'](_0xfe36('0x102')),'ContactId':_0x4f39bd[_0xfe36('0xd8')],'ListId':_0x4f39bd['ListId'],'VoiceQueueId':_0x4f39bd[_0xfe36('0xda')]||undefined,'CampaignId':_0x4f39bd[_0xfe36('0x103')]||undefined})[_0xfe36('0xba')](loggerCatch(_0xfe36('0x104')));break;case 0x14:if(_0x4f39bd[_0xfe36('0xf9')]>=_0x5812aa[_0xfe36('0x1b5')]-0x1){return!![];}this[_0xfe36('0xc3')]({'active':![],'countagentrejectretry':_0x4f39bd[_0xfe36('0xf9')]+=0x1,'scheduledat':moment()[_0xfe36('0xff')](_0x5812aa[_0xfe36('0x1b6')],_0xfe36('0x101'))[_0xfe36('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f39bd[_0xfe36('0xd8')],'ListId':_0x4f39bd[_0xfe36('0xd9')],'VoiceQueueId':_0x4f39bd[_0xfe36('0xda')]||undefined,'CampaignId':_0x4f39bd[_0xfe36('0x103')]||undefined})[_0xfe36('0xba')](loggerCatch(_0xfe36('0x1b7')));break;default:return!![];}};Dialer[_0xfe36('0xaa')][_0xfe36('0x1b8')]=function(_0x568153,_0x3ecf25,_0x18837f){var _0x370397=this;var _0x386489=new History(_0x568153);return new BPromise(function(_0x42f3da,_0x3458d3){if(_[_0xfe36('0x85')](_0x3ecf25)&&typeof _0x3ecf25!=='object'){return _0x3458d3(msgResponse(_0xfe36('0x1b9'),_0xfe36('0x14e'),_0xfe36('0x1ba')));}if(_[_0xfe36('0x85')](_0x18837f)&&typeof _0x18837f!==_0xfe36('0x1bb')){return _0x3458d3(msgResponse('[callProgressDetecting]',_0xfe36('0x14e'),'evt\x20is\x20undefine'));}switch(_0x18837f[_0xfe36('0x1bc')]){case'0':_0x3ecf25[_0xfe36('0x64')]+=0x1;_0x386489['state']=0x0;_0x386489[_0xfe36('0xa8')]=_0xfe36('0x1bd');_0x386489['countnosuchnumberretry']+=0x1;_0x386489[_0xfe36('0xf3')]+=0x1;ami['emit'](_0xfe36('0x1be'),ut[_0xfe36('0xea')](_0x568153,'nosuchnumber'));_0x370397[_0xfe36('0xcf')](_0x386489)['catch'](loggerCatch(_0xfe36('0x107')));if(_0x370397[_0xfe36('0x1ab')](0x0,_0x568153,_0x3ecf25)){if(_0x386489[_0xfe36('0xf6')]>=_0x3ecf25[_0xfe36('0x1b2')]){_0x370397[_0xfe36('0xfd')](_0x386489,_0x42f3da,_0x3458d3,_0xfe36('0x1bf'));}else{_0x370397[_0xfe36('0xfb')](_0x386489,_0x42f3da,_0x3458d3,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3ecf25[_0xfe36('0x63')]+=0x1;_0x386489[_0xfe36('0xa7')]=0x3;_0x386489[_0xfe36('0xa8')]=_0xfe36('0x1c0');_0x386489['countnoanswerretry']+=0x1;_0x386489['countglobal']+=0x1;ami[_0xfe36('0x4a')](_0xfe36('0x1c1'),ut[_0xfe36('0xea')](_0x568153,_0xfe36('0x1c2')));_0x370397[_0xfe36('0xcf')](_0x386489)[_0xfe36('0xba')](loggerCatch(_0xfe36('0x1c3')));if(_0x370397[_0xfe36('0x1ab')](0x3,_0x568153,_0x3ecf25)){if(_0x386489[_0xfe36('0x109')]>=_0x3ecf25['dialNoAnswerMaxRetry']){_0x370397[_0xfe36('0xfd')](_0x386489,_0x42f3da,_0x3458d3,'reason\x203\x20ringing\x20no\x20answer');}else{_0x370397['stateGlobal'](_0x386489,_0x42f3da,_0x3458d3,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x3ecf25['outboundBusyCallsDay']+=0x1;_0x386489[_0xfe36('0xa7')]=0x5;_0x386489['statedesc']=_0xfe36('0x1c4');_0x386489[_0xfe36('0xf5')]+=0x1;_0x386489[_0xfe36('0xf3')]+=0x1;ami[_0xfe36('0x4a')](_0xfe36('0x1c5'),ut[_0xfe36('0xea')](_0x568153,_0xfe36('0x1c6')));_0x370397[_0xfe36('0xcf')](_0x386489)['catch'](loggerCatch(_0xfe36('0x1c7')));if(_0x370397[_0xfe36('0x1ab')](0x5,_0x568153,_0x3ecf25)){if(_0x386489['countbusyretry']>=_0x3ecf25[_0xfe36('0x1c8')]){_0x370397['createStateFinal'](_0x386489,_0x42f3da,_0x3458d3,_0xfe36('0x1c9'));}else{_0x370397[_0xfe36('0xfb')](_0x386489,_0x42f3da,_0x3458d3,_0xfe36('0x1c9'));}}break;case'8':_0x3ecf25[_0xfe36('0x60')]+=0x1;_0x386489[_0xfe36('0xa7')]=0x8;_0x386489[_0xfe36('0xa8')]='Congestion';_0x386489['countcongestionretry']+=0x1;_0x386489[_0xfe36('0xf3')]+=0x1;ami[_0xfe36('0x4a')]('custom:agentcongestion',ut[_0xfe36('0xea')](_0x568153,_0xfe36('0x1ca')));_0x370397['createHistory'](_0x386489)[_0xfe36('0xba')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x370397[_0xfe36('0x1ab')](0x8,_0x568153,_0x3ecf25)){if(_0x386489[_0xfe36('0x108')]>=_0x3ecf25[_0xfe36('0x1b0')]){_0x370397[_0xfe36('0xfd')](_0x386489,_0x42f3da,_0x3458d3,'reason\x208\x20congestion');}else{_0x370397[_0xfe36('0xfb')](_0x386489,_0x42f3da,_0x3458d3,_0xfe36('0x1cb'));}}break;case'11':_0x3ecf25['outboundAbandonedCallsDay']+=0x1;_0x386489['state']=0xb;_0x386489['statedesc']=_0xfe36('0x129');_0x386489[_0xfe36('0xf8')]+=0x1;_0x386489[_0xfe36('0xf3')]+=0x1;_0x370397[_0xfe36('0xcf')](_0x386489)[_0xfe36('0xba')](loggerCatch(_0xfe36('0x12d')));if(_0x370397[_0xfe36('0x1ab')](0xb,_0x568153,_0x3ecf25)){if(_0x386489[_0xfe36('0xf8')]>=_0x3ecf25[_0xfe36('0x12b')]){_0x370397['createStateFinal'](_0x386489,_0x42f3da,_0x3458d3,_0xfe36('0x1cc'));}else{_0x370397[_0xfe36('0xfb')](_0x386489,_0x42f3da,_0x3458d3,_0xfe36('0x1cc'));}}break;case'20':_0x3ecf25['outboundRejectCallsDay']+=0x1;_0x386489[_0xfe36('0xa7')]=0x14;_0x386489[_0xfe36('0xa8')]=_0xfe36('0x1cd');_0x386489[_0xfe36('0xf9')]+=0x1;_0x386489['countglobal']+=0x1;ami['emit'](_0xfe36('0x1ce'),ut[_0xfe36('0xea')](_0x568153,'agentreject'));_0x370397[_0xfe36('0xcf')](_0x386489)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x370397[_0xfe36('0x1ab')](0x14,_0x568153,_0x3ecf25)){if(_0x386489[_0xfe36('0xf9')]>=_0x3ecf25[_0xfe36('0x1b5')]){_0x370397[_0xfe36('0xfd')](_0x386489,_0x42f3da,_0x3458d3,'reason\x2020\x20agentreject');}else{_0x370397[_0xfe36('0xfb')](_0x386489,_0x42f3da,_0x3458d3,_0xfe36('0x1cf'));}}break;default:_0x3ecf25['outboundUnknownCallsDay']+=0x1;_0x386489[_0xfe36('0xa7')]=0xc;_0x386489['statedesc']=_0x18837f[_0xfe36('0x1bc')];_0x370397['createHistory'](_0x386489)[_0xfe36('0xba')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x370397[_0xfe36('0x1ab')](_0x18837f[_0xfe36('0x1bc')],_0x568153,_0x3ecf25)){if(_0x386489[_0xfe36('0xf5')]+_0x386489[_0xfe36('0x108')]+_0x386489[_0xfe36('0x109')]+_0x386489[_0xfe36('0xf6')]+_0x386489[_0xfe36('0xf7')]+_0x386489[_0xfe36('0xf8')]+_0x386489[_0xfe36('0xf2')]+_0x386489[_0xfe36('0xf9')]>=_0x3ecf25[_0xfe36('0xfa')]){_0x370397['stateGlobal'](_0x386489,_0x42f3da,_0x3458d3,_0x18837f[_0xfe36('0x1bc')]);}else{_0x370397[_0xfe36('0xfd')](_0x386489,_0x42f3da,_0x3458d3,_0x18837f[_0xfe36('0x1bc')]);}}}});};Dialer[_0xfe36('0xaa')]['stateGlobal']=function(_0xfee628,_0x3ec867,_0x849869,_0xb379cc){var _0x3a7454=new Final(_0xfee628);_0x3a7454['state']=0xf;_0x3a7454[_0xfe36('0xa8')]='Global';this[_0xfe36('0xfd')](_0x3a7454,_0x3ec867,_0x849869,_0xb379cc);};Dialer[_0xfe36('0xaa')][_0xfe36('0xfd')]=function(_0xc4249c,_0x2dc984,_0x3ae23e,_0x1fd31b){this[_0xfe36('0xcd')](_0xc4249c)['then'](function(){return _0x2dc984(msgResponse(_0xfe36('0x1b9'),_0xfe36('0xdd'),_0x1fd31b));})[_0xfe36('0xba')](function(){return _0x3ae23e(msgResponse(_0xfe36('0x1d0'),_0xfe36('0x14e'),_0xfe36('0x1d1')));});};Dialer[_0xfe36('0xaa')]['predictive']=function(_0x15625c){var _0x2d6cbd=_0x15625c[_0xfe36('0x1d2')]/0x64;var _0x377e57=_0x15625c[_0xfe36('0x62')]/(_0x15625c[_0xfe36('0x62')]+_0x15625c[_0xfe36('0xe7')]);var _0x39c117=Math[_0xfe36('0x1d3')](_0x15625c[_0xfe36('0x1d4')]*(_0x15625c[_0xfe36('0x1d5')]/0x64));var _0x1128ca=Math[_0xfe36('0x1d3')](_0x15625c[_0xfe36('0x1d4')]*(_0x15625c[_0xfe36('0x1d6')]/0x64));var _0x3bcd1d=_0x15625c['available']+_0x15625c[_0xfe36('0xa2')];var _0x51ed61=Math[_0xfe36('0x1d7')](_0x15625c['erlangCalls']*_0x15625c[_0xfe36('0x8d')]*_0x15625c[_0xfe36('0x70')]*_0x15625c[_0xfe36('0x71')]);if(_[_0xfe36('0x85')](_0x15625c[_0xfe36('0x29')])){if(!_[_0xfe36('0x85')](_0x15625c['startPredictive'])){_0x15625c[_0xfe36('0x28')]=undefined;loggerPredictive[_0xfe36('0x95')](_0xfe36('0x1d8'),_0xfe36('0x1d9'));}if(!_[_0xfe36('0x85')](_0x15625c[_0xfe36('0x90')])){loggerPredictive['error'](_0xfe36('0x1d8'),_0xfe36('0x1da'));clearInterval(_0x15625c[_0xfe36('0x90')]);_0x15625c[_0xfe36('0x90')]=undefined;}_0x15625c[_0xfe36('0x29')]=moment()[_0xfe36('0x79')](_0xfe36('0x102'));loggerPredictive[_0xfe36('0x7e')](_0x15625c[_0xfe36('0x3c')],'collection\x20data\x20in\x20progressive\x20at',_0x15625c[_0xfe36('0x29')]);this[_0xfe36('0x160')](_0x15625c,0x1);}else if(ifInterval(_0x15625c['dialPredictiveInterval'],_0x15625c[_0xfe36('0x29')])){this['handlePower'](_0x15625c,0x1);loggerPredictiveCalls[_0xfe36('0x7e')](_0xfe36('0x1db'),_0x15625c[_0xfe36('0x29')],_0x15625c[_0xfe36('0x3c')]);_0x15625c[_0xfe36('0x8b')]=0x0;_0x15625c[_0xfe36('0x6f')]=0x0;}else if(_0x2d6cbd<_0x377e57&&_0x15625c[_0xfe36('0x1dc')]===_0xfe36('0x1dd')){freeVariablesPredictive(_0x15625c);loggerPredictive['info'](_0xfe36('0x1de'),'Dropped\x20calls\x20day',_0x377e57,_0xfe36('0x29'),_0x15625c[_0xfe36('0x3c')]);}else if(_0x51ed61<_0x15625c[_0xfe36('0x6f')]&&_0x15625c[_0xfe36('0x1dc')]===_0xfe36('0x1dd')){freeVariablesPredictive(_0x15625c);loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x1df'),_0xfe36('0x1e0'),_0x51ed61,_0xfe36('0x1e1'),_0x15625c[_0xfe36('0x6f')],'startProgressive',_0x15625c[_0xfe36('0x3c')]);}else if(!ifInterval(_0x15625c[_0xfe36('0x1e2')],_0x15625c[_0xfe36('0x29')])&&_[_0xfe36('0x85')](_0x15625c['startPredictive'])&&!_[_0xfe36('0x85')](_0x15625c[_0xfe36('0x29')])){_0x15625c[_0xfe36('0x28')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xfe36('0x7e')](_0x15625c[_0xfe36('0x3c')],_0xfe36('0x1e3'),_0x15625c[_0xfe36('0x28')]);this[_0xfe36('0xc0')](_0x15625c[_0xfe36('0x1e2')])[_0xfe36('0x3a')](this[_0xfe36('0x1e4')](_0x15625c))[_0xfe36('0x3a')](mergeDataErlangB(_0x15625c))[_0xfe36('0x3a')](this['startMethodPredictive'](_0x15625c))[_0xfe36('0xba')](loggerCatchPredictive(_0xfe36('0x1e5'),_0x15625c));}else if(!ifInterval(_0x15625c['dialPredictiveInterval'],_0x15625c[_0xfe36('0x28')])){_0x15625c[_0xfe36('0x6f')]=0x0;_0x15625c['startPredictive']=moment()['format'](_0xfe36('0x102'));loggerPredictive[_0xfe36('0x7e')](_0x15625c['name'],_0xfe36('0x1e6'),_0x15625c[_0xfe36('0x28')]);clearInterval(_0x15625c[_0xfe36('0x90')]);_0x15625c[_0xfe36('0x90')]=undefined;this[_0xfe36('0xc0')](_0x15625c[_0xfe36('0x1e2')])[_0xfe36('0x3a')](this[_0xfe36('0x1e4')](_0x15625c))[_0xfe36('0x3a')](mergeDataErlangB(_0x15625c))[_0xfe36('0x3a')](this[_0xfe36('0x1e7')](_0x15625c))[_0xfe36('0xba')](loggerCatchPredictive(_0xfe36('0x1e8'),_0x15625c));}else if(_0x15625c[_0xfe36('0x1d4')]&&_0x3bcd1d<_0x15625c['predictiveIntervalAvailable']-_0x1128ca){freeVariablesPredictive(_0x15625c);loggerPredictive[_0xfe36('0x7e')](_0x15625c[_0xfe36('0x3c')],_0xfe36('0x1e9'),_0x3bcd1d,_0xfe36('0x1ea'),_0x15625c['predictiveIntervalAvailable'],'-',_0x1128ca,'=',_0x15625c[_0xfe36('0x1d4')]-_0x1128ca,')');}else if(_0x15625c[_0xfe36('0x1d4')]&&_0x3bcd1d>_0x15625c[_0xfe36('0x1d4')]+_0x39c117){freeVariablesPredictive(_0x15625c);loggerPredictive[_0xfe36('0x7e')](_0x15625c['name'],_0xfe36('0x1e9'),_0x3bcd1d,')\x20are\x20more\x20than\x20threshold\x20(',_0x15625c[_0xfe36('0x1d4')],'+',_0x39c117,'=',_0x15625c[_0xfe36('0x1d4')]+_0x39c117,')');}};Dialer[_0xfe36('0xaa')]['getDataPredictive']=function(_0x1db041){var _0x34d61e=this;return function(_0xf86213){return new BPromise(function(_0x47200e,_0x6606a2){_[_0xfe36('0xd7')](_0x1db041,_0xf86213[0x0]);if(checkGetDataPredictive(_0xf86213[0x0])){var _0x34e27b=_0x1db041[_0xfe36('0x1d4')]=_0x1db041[_0xfe36('0xa2')]+_0x1db041[_0xfe36('0x4e')];var _0x17c000=_0x1db041[_0xfe36('0x1e2')]*0x3c;var _0x27fc63=_0xf86213[0x0][_0xfe36('0x6b')]+_0xf86213[0x0][_0xfe36('0x6a')];var _0x52b02f=(_0xf86213[0x0][_0xfe36('0x69')]+_0xf86213[0x0][_0xfe36('0x6d')]+_0xf86213[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xf86213[0x0][_0xfe36('0x80')];_0x1db041[_0xfe36('0x70')]=_0x52b02f>0x0?_0x52b02f:0x1;switch(_0x1db041[_0xfe36('0x1dc')]){case _0xfe36('0x1dd'):var _0x46f7d7=_0x1db041[_0xfe36('0x1d2')]/0x64;return _0x34d61e[_0xfe36('0x1eb')](_0x34e27b,_0x17c000,_0x27fc63,_0x52b02f,_0x46f7d7)[_0xfe36('0x3a')](function(_0x1e594f){return _0x47200e(_0x1e594f);});case _0xfe36('0x1ec'):var _0x4ec5c2=_0x1db041[_0xfe36('0x1d2')]/0x64;return _0x34d61e[_0xfe36('0x1ed')](_0x34e27b,_0x17c000,_0x27fc63,_0x52b02f,_0x4ec5c2)['then'](function(_0x412ac9){return _0x47200e(_0x412ac9);});default:return _0x6606a2(msgResponse(_0xfe36('0x1ee'),_0xfe36('0x14e'),'Unknown\x20Predictive'));}}else{return _0x6606a2(msgResponse(_0xfe36('0x1ee'),_0xfe36('0x14e'),'check\x20failure'));}});};};Dialer[_0xfe36('0xaa')][_0xfe36('0x1ef')]=function(_0x1eb0d1){var _0xad10c6=this;return function(_0x1d517a){return new BPromise(function(_0x4b01a2,_0x4bb291){_[_0xfe36('0xd7')](_0x1eb0d1,_0x1d517a[0x0]);if(checkGetDataPredictive(_0x1d517a[0x0])){loggerPredictive[_0xfe36('0x7e')](JSON[_0xfe36('0x78')](_0x1d517a[0x0]));if(_0x1eb0d1['dialPredictiveOptimization']===_0xfe36('0x1dd')){return _0xad10c6[_0xfe36('0xcb')](_0x1eb0d1['id'])[_0xfe36('0x3a')](function(_0x5015f5){var _0x1698c1=_0x1eb0d1[_0xfe36('0x4f')]-_0x5015f5[0x0]['outboundQueuePauses'];var _0x1dba29=_0x1eb0d1[_0xfe36('0x1e2')]*0x3c;var _0x300460=_0x1d517a[0x0][_0xfe36('0x6b')]+_0x1d517a[0x0][_0xfe36('0x6a')];var _0x5d6d52=(_0x1d517a[0x0][_0xfe36('0x69')]+_0x1d517a[0x0][_0xfe36('0x6d')]+_0x1d517a[0x0][_0xfe36('0x6c')])/_0x1d517a[0x0]['predictiveIntervalTotalCalls'];var _0x5bbf8d=_0x1eb0d1['dialPredictiveOptimizationPercentage']/0x64;_0x1eb0d1[_0xfe36('0x72')]=_0x5015f5[0x0][_0xfe36('0x1f0')]||0x0;_0x1eb0d1[_0xfe36('0x70')]=_0x5d6d52>0x0?_0x5d6d52:0x1;return _0xad10c6[_0xfe36('0x1eb')](_0x1698c1,_0x1dba29,_0x300460,_0x5d6d52,_0x5bbf8d);})['then'](function(_0x131e8c){return _0x4b01a2(_0x131e8c);})[_0xfe36('0xba')](function(_0x3a8d01){return _0x4bb291(msgResponse(_0xfe36('0x1f1'),_0xfe36('0x14e'),JSON[_0xfe36('0x78')](_0x3a8d01)));});}if(_0x1eb0d1['dialPredictiveOptimization']===_0xfe36('0x1ec')){return _0xad10c6[_0xfe36('0xcb')](_0x1eb0d1['id'])[_0xfe36('0x3a')](function(_0x24043e){var _0x4e25ee=_0x1eb0d1[_0xfe36('0x4f')]-_0x24043e[0x0][_0xfe36('0x1f0')];var _0x46af2c=_0x1eb0d1['dialPredictiveInterval']*0x3c;var _0x2dbe70=_0x1d517a[0x0]['predictiveIntervalAvgTalktime']+_0x1d517a[0x0][_0xfe36('0x6a')];var _0x308d1e=(_0x1d517a[0x0][_0xfe36('0x69')]+_0x1d517a[0x0][_0xfe36('0x6d')]+_0x1d517a[0x0][_0xfe36('0x6c')])/_0x1d517a[0x0]['predictiveIntervalTotalCalls'];var _0x2084b0=_0x1eb0d1[_0xfe36('0x1d2')]/0x64;_0x1eb0d1[_0xfe36('0x72')]=_0x24043e[0x0][_0xfe36('0x1f0')]||0x0;_0x1eb0d1[_0xfe36('0x70')]=_0x308d1e>0x0?_0x308d1e:0x1;return _0xad10c6[_0xfe36('0x1ed')](_0x4e25ee,_0x46af2c,_0x2dbe70,_0x308d1e,_0x2084b0);})['then'](function(_0x20b14d){return _0x4b01a2(_0x20b14d);})['catch'](function(_0x12ed19){return _0x4bb291(msgResponse('[CatchErlangB]',_0xfe36('0x14e'),JSON[_0xfe36('0x78')](_0x12ed19)));});}}else{return _0x4bb291(msgResponse(_0xfe36('0x1ee'),_0xfe36('0x14e'),'check\x20failure'));}});};};Dialer[_0xfe36('0xaa')][_0xfe36('0x1e7')]=function(_0x17e467){var _0x40e3c4=this;return function(){var _0x5b22c2=0x0;var _0x12e23a=Math[_0xfe36('0x1d7')](_0x17e467[_0xfe36('0x73')]*0x3e8);if(_0x12e23a>0x0){_0x12e23a=_0x12e23a<0x64?0x64:_0x12e23a;loggerPredictive[_0xfe36('0x7e')](_0x17e467['name'],_0xfe36('0x1f2'),_0x12e23a,_0xfe36('0x8f'));_0x17e467[_0xfe36('0x90')]=setInterval(function(){_0x40e3c4['handlePredictive'](_0x17e467);loggerPredictiveCalls[_0xfe36('0x7e')](_0xfe36('0x1f3'),_0x5b22c2+=0x1);},_0x12e23a);}else{loggerPredictive['info'](_0x17e467[_0xfe36('0x3c')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xfe36('0xaa')]['checkContactBlack']=function(_0x18db2e,_0x2f74f8){var _0x4fe119=this;return function(_0x543840){if(_[_0xfe36('0x44')](_0x543840)){if(_[_0xfe36('0xaf')](_0x2f74f8['UserId'])||!_0x2f74f8[_0xfe36('0x1f4')]){if(_0x18db2e[_0xfe36('0x58')]===_0xfe36('0x7')){_0x18db2e[_0xfe36('0x139')]=_[_0xfe36('0x85')](_0x18db2e[_0xfe36('0x139')])?!![]:_0x18db2e[_0xfe36('0x139')];var _0x3e53f4=uuid['v4']();_0x4fe119[_0xfe36('0xad')][_0x3e53f4]=new Action(_0x18db2e,_0x2f74f8,_0x3e53f4);loggerBooked[_0xfe36('0x7e')](_0xfe36('0x1f5'),_0x3e53f4,'queueStatusComplete:\x20',JSON[_0xfe36('0x78')](_0x18db2e[_0xfe36('0x139')]),_0xfe36('0x1f6'),_0x18db2e[_0xfe36('0x3c')]);if(_0x18db2e[_0xfe36('0x139')]){_0x18db2e['queueStatusComplete']=![];_0x4fe119[_0xfe36('0x134')][_0x4fe119['actions'][_0x3e53f4][_0xfe36('0xb5')]]=[];ami['Action']({'actionid':_0x3e53f4,'action':_0xfe36('0x1f7'),'queue':_0x18db2e['name']})['catch'](function(){_0x4fe119['updateOriginated'](_0x18db2e);_0x4fe119[_0xfe36('0xc3')]({'active':![],'ContactId':_0x4fe119['actions'][_0x3e53f4][_0xfe36('0xd8')],'ListId':_0x4fe119[_0xfe36('0xad')][_0x3e53f4][_0xfe36('0xd9')],'VoiceQueueId':_0x4fe119[_0xfe36('0xad')][_0x3e53f4][_0xfe36('0xda')]||undefined,'CampaignId':_0x4fe119[_0xfe36('0xad')][_0x3e53f4][_0xfe36('0x103')]||undefined})['catch'](loggerCatch(_0xfe36('0x1f8')));delete _0x4fe119[_0xfe36('0xad')][_0x3e53f4];});}else{loggerBooked[_0xfe36('0x7e')]('[booked][checkContactBlack][else]',JSON[_0xfe36('0x78')](_0x18db2e[_0xfe36('0x139')]),'Queue:\x20',_0x18db2e[_0xfe36('0x3c')]);_0x4fe119['updateOriginated'](_0x18db2e);_0x4fe119['rescheduleContact']({'active':![],'ContactId':_0x4fe119['actions'][_0x3e53f4][_0xfe36('0xd8')],'ListId':_0x4fe119[_0xfe36('0xad')][_0x3e53f4][_0xfe36('0xd9')],'VoiceQueueId':_0x4fe119[_0xfe36('0xad')][_0x3e53f4]['VoiceQueueId']||undefined,'CampaignId':_0x4fe119['actions'][_0x3e53f4]['CampaignId']||undefined})[_0xfe36('0xba')](loggerCatch(_0xfe36('0x1f8')));delete _0x4fe119[_0xfe36('0xad')][_0x3e53f4];}}else{return _0x4fe119[_0xfe36('0x176')](_0x18db2e,_0x2f74f8);}}else{if(getDiff(_0x2f74f8[_0xfe36('0x1f9')])<_0x18db2e[_0xfe36('0x1fa')]*0x3c){if(_0x2f74f8[_0xfe36('0x169')]&&!_0x2f74f8[_0xfe36('0x169')][_0xfe36('0x1fb')]){_0x4fe119['preview'][_0xfe36('0x13a')](_0x2f74f8['id'])[_0xfe36('0x1e')](function(){_0x4fe119[_0xfe36('0xb4')](_0x18db2e);});}else{_0x4fe119[_0xfe36('0x1fc')]({'active':![]},_0x2f74f8['id'],0x1)[_0xfe36('0x1e')](function(){_0x4fe119[_0xfe36('0xb4')](_0x18db2e);});}}else{_0x18db2e['outboundReCallsDay']+=0x1;_0x4fe119[_0xfe36('0xb4')](_0x18db2e);if(_0x18db2e['dialRecallInQueue']){_0x4fe119['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2f74f8[_0xfe36('0xd8')],'ListId':_0x2f74f8[_0xfe36('0xd9')],'VoiceQueueId':_0x2f74f8['VoiceQueueId']||undefined,'CampaignId':_0x2f74f8[_0xfe36('0x103')]||undefined})[_0xfe36('0xba')](loggerCatch(_0xfe36('0x1fd')));_0x4fe119[_0xfe36('0xcf')](createObjHistory(_0x18db2e,_0x2f74f8,_0xfe36('0x1fe'),0x17,_0xfe36('0x1ff')))[_0xfe36('0xba')](loggerCatch(_0xfe36('0x200')));}else{_0x4fe119[_0xfe36('0xd6')](createObjHistory(_0x18db2e,_0x2f74f8,'RECALLFAILEDTIMEOUT',0x16,_0xfe36('0x201')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x18db2e['outboundBlacklistCallsDay']+=0x1;_0x4fe119[_0xfe36('0xd6')](createObjHistory(_0x18db2e,_0x2f74f8,'BLACKLIST',0xd,_0xfe36('0x202')),_0xfe36('0x203'),_0xfe36('0x204'));throw _0xfe36('0x205');}};};Dialer[_0xfe36('0xaa')]['handleIvr']=function(_0x2d5e9e){var _0x3ef35c=this;var _0x1defd0=_0x2d5e9e['limitCalls']-_0x2d5e9e['originated']-_0x2d5e9e['temp'];emitCampaignSummary(_0x2d5e9e);if(_0x1defd0>0x0){if(_0x1defd0>this[_0xfe36('0x23')]){_0x1defd0=this[_0xfe36('0x23')];}_0x2d5e9e[_0xfe36('0xc7')]+=_0x1defd0;this[_0xfe36('0xc9')](_0x2d5e9e['id'],_0x1defd0,_0x2d5e9e[_0xfe36('0x206')],_0x2d5e9e)['then'](function(_0xb6dcce){_0x2d5e9e[_0xfe36('0xc7')]-=_0x1defd0;_0x2d5e9e['temp']=_0x2d5e9e['temp']>0x0?_0x2d5e9e[_0xfe36('0xc7')]:0x0;if(!checkContactEmpty(_0xb6dcce)){_0x2d5e9e[_0xfe36('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xfe36('0x7e')]('[getContactCampaign2][Empty]'+_0x2d5e9e['name']);}else{_0x2d5e9e[_0xfe36('0x99')]+=_0xb6dcce[_0xfe36('0x98')];_0x2d5e9e[_0xfe36('0x3e')]='RUNNING';for(var _0x520406=0x0;_0x520406<_0xb6dcce[_0xfe36('0x98')];_0x520406+=0x1){_0x2d5e9e[_0xfe36('0x207')]+=0x1;if(_['isNil'](_0xb6dcce[_0x520406])||_[_0xfe36('0xaf')](_0xb6dcce[_0x520406][_0xfe36('0x179')])||_[_0xfe36('0xaf')](_0xb6dcce[_0x520406][_0xfe36('0x179')][_0xfe36('0x17a')])){_0x3ef35c[_0xfe36('0xd4')](_0xfe36('0x208'),_0x2d5e9e,_0xb6dcce[_0x520406]);}else{_0x3ef35c[_0xfe36('0xbe')](_[_0xfe36('0x136')](_0xb6dcce[_0x520406],['CampaignId',_0xfe36('0x209')]))[_0xfe36('0x3a')](_0x3ef35c[_0xfe36('0x20a')](_0x2d5e9e,_0xb6dcce[_0x520406]))[_0xfe36('0xba')](_0x3ef35c[_0xfe36('0xd3')](_0xfe36('0x20b'),_0x2d5e9e));}}}})['catch'](loggerGetContactDialer(_0xfe36('0x20c'),_0x2d5e9e,_0x1defd0));}};Dialer['prototype'][_0xfe36('0x160')]=function(_0x296eb7,_0x2ee0d4){var _0x5e29be=this;var _0x32b1f4=[];var _0x10cb92=_0x2ee0d4>=0x1?_0x2ee0d4:0x1;if(_0x296eb7['dialMethod']===_0xfe36('0x7')){_0x10cb92=0x1;}var _0x5754a2=Math[_0xfe36('0x1d7')](_0x296eb7[_0xfe36('0x4e')]*_0x10cb92)-_0x296eb7[_0xfe36('0x99')]-_0x296eb7[_0xfe36('0xc7')];emitVoiceQueueSummary(_0x296eb7);if(_0x296eb7[_0xfe36('0x20d')]>0x0){var _0x47f27c=_0x296eb7[_0xfe36('0x20d')]-_0x296eb7[_0xfe36('0x99')]-_0x296eb7[_0xfe36('0xa2')]-_0x296eb7[_0xfe36('0xc7')]-_0x296eb7[_0xfe36('0x50')];if(_0x5754a2>_0x47f27c){_0x5754a2=_0x47f27c;}}if(_0x5754a2>0x0){if(_0x296eb7[_0xfe36('0x58')]===_0xfe36('0x7')){_0x5754a2=0x1;}if(_0x5754a2>this[_0xfe36('0x23')]){_0x5754a2=this[_0xfe36('0x23')];}_0x296eb7[_0xfe36('0xc7')]+=_0x5754a2;for(var _0x191f1e in this['agents']){if(typeof this[_0xfe36('0x131')][_0x191f1e]!==_0xfe36('0x9a')){if(this[_0xfe36('0x131')][_0x191f1e][_0xfe36('0xa7')]==='not_inuse'&&this['agents'][_0x191f1e]['status']==='reachable'){_0x32b1f4[_0xfe36('0x135')](this[_0xfe36('0x131')][_0x191f1e]['id']);}}}this['getContactDialer'](_0x296eb7['id'],_0x32b1f4,_0x5754a2,_0x296eb7[_0xfe36('0x206')],_0x296eb7)[_0xfe36('0x3a')](function(_0x4ef507){_0x296eb7[_0xfe36('0xc7')]-=_0x5754a2;_0x296eb7[_0xfe36('0xc7')]=_0x296eb7[_0xfe36('0xc7')]>0x0?_0x296eb7['temp']:0x0;if(!checkContactEmpty(_0x4ef507)){_0x5e29be[_0xfe36('0xb8')](_0x296eb7)['then'](sendMessageReschedule(_0x296eb7))[_0xfe36('0xba')](loggerCatch(_0xfe36('0xbb')));}else{_0x296eb7[_0xfe36('0x99')]+=_0x4ef507['length'];_0x296eb7[_0xfe36('0x3e')]=_0x296eb7[_0xfe36('0x58')]===_0xfe36('0x7')?_0xfe36('0x20e'):_0xfe36('0x20f');for(var _0x128512=0x0;_0x128512<_0x4ef507[_0xfe36('0x98')];_0x128512+=0x1){if(_['isNil'](_0x4ef507[_0x128512])||_[_0xfe36('0xaf')](_0x4ef507[_0x128512]['Contact'])||_['isNil'](_0x4ef507[_0x128512][_0xfe36('0x179')][_0xfe36('0x17a')])){_0x5e29be[_0xfe36('0xd4')]('[actionOriginate]\x20',_0x296eb7,_0x4ef507[_0x128512]);}else{_0x5e29be[_0xfe36('0xbc')](_['pick'](_0x4ef507[_0x128512],[_0xfe36('0xda'),_0xfe36('0x209')]))[_0xfe36('0x3a')](_0x5e29be[_0xfe36('0x20a')](_0x296eb7,_0x4ef507[_0x128512]))['catch'](_0x5e29be['loggerHandler'](_0xfe36('0x208'),_0x296eb7));}}}})['catch'](loggerGetContactDialer(_0xfe36('0x210'),_0x296eb7,_0x5754a2));}};Dialer[_0xfe36('0xaa')][_0xfe36('0x90')]=function(_0x2ccf1e){if(_0x2ccf1e[_0xfe36('0x20d')]>0x0){var _0x3d1e0a=_0x2ccf1e[_0xfe36('0x20d')]-_0x2ccf1e[_0xfe36('0x99')]-_0x2ccf1e[_0xfe36('0xa2')];if(_0x3d1e0a>0x0){this[_0xfe36('0x211')](_0x2ccf1e);}else{loggerPredictiveCalls[_0xfe36('0x7e')](_0xfe36('0x212'));}}else{this[_0xfe36('0x211')](_0x2ccf1e);}};Dialer[_0xfe36('0xaa')]['tryOriginatePredictive']=function(_0x4c15bb){var _0x15207f=this;var _0x2fe013=[];_0x4c15bb['originated']+=0x1;for(var _0x3dc8c0 in this['agents']){if(typeof this[_0xfe36('0x131')][_0x3dc8c0]!=='undefined'){if(this['agents'][_0x3dc8c0][_0xfe36('0xa7')]===_0xfe36('0x213')&&this['agents'][_0x3dc8c0]['status']===_0xfe36('0xdf')){_0x2fe013[_0xfe36('0x135')](this[_0xfe36('0x131')][_0x3dc8c0]['id']);}}}this['getContactDialer'](_0x4c15bb['id'],_0x2fe013,0x1,_0x4c15bb[_0xfe36('0x206')],_0x4c15bb)['then'](function(_0x4f2bdb){if(!checkContactEmpty(_0x4f2bdb)){checkContactLowerLimitOriginate(_0x4c15bb,0x1,0x0);_0x15207f[_0xfe36('0xb8')](_0x4c15bb)[_0xfe36('0x3a')](sendMessageReschedule(_0x4c15bb))[_0xfe36('0xba')](loggerCatch(_0xfe36('0xbb')));}else{_0x4c15bb[_0xfe36('0x3e')]=_0xfe36('0x20f');if(_['isNil'](_0x4f2bdb[0x0])||_[_0xfe36('0xaf')](_0x4f2bdb[0x0][_0xfe36('0x179')])||_[_0xfe36('0xaf')](_0x4f2bdb[0x0][_0xfe36('0x179')][_0xfe36('0x17a')])){_0x15207f[_0xfe36('0xd4')]('[actionOriginate]\x20',_0x4c15bb,_0x4f2bdb[0x0]);}else{_0x15207f[_0xfe36('0xbc')](_[_0xfe36('0x136')](_0x4f2bdb[0x0],[_0xfe36('0xda'),_0xfe36('0x209')]))[_0xfe36('0x3a')](_0x15207f[_0xfe36('0x20a')](_0x4c15bb,_0x4f2bdb[0x0]))[_0xfe36('0xba')](_0x15207f[_0xfe36('0xd3')](_0xfe36('0x214'),_0x4c15bb));}}})['catch'](loggerGetContactDialer(_0xfe36('0x215'),_0x4c15bb,0x1));emitVoiceQueueSummary(_0x4c15bb);};Dialer[_0xfe36('0xaa')][_0xfe36('0x1eb')]=function(_0x208b58,_0x5b87ad,_0x2180c1,_0x4efc1e,_0x2841a3,_0x2f8b2a){loggerPredictive['info'](_0xfe36('0x216'));loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x217'),_0x208b58);loggerPredictive[_0xfe36('0x7e')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b87ad);loggerPredictive['info'](_0xfe36('0x218'),_0x2180c1);loggerPredictive['info'](_0xfe36('0x219'),_0x4efc1e);loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x21a'),_0x2841a3);loggerPredictive['info'](_0xfe36('0x84'));return new BPromise(function(_0x4008e2,_0x3e88dd){if(_0x208b58<=0x0||isNaN(_0x208b58)){return _0x3e88dd(msgResponse('[abandonmentRate]',_0xfe36('0x47'),_0xfe36('0x21b')+_0x208b58));}if(_0x2180c1<=0x0||isNaN(_0x2180c1)){return _0x3e88dd(msgResponse(_0xfe36('0x21c'),_0xfe36('0x47'),_0xfe36('0x21d')+_0x2180c1));}if(_0x4efc1e<=0x0||isNaN(_0x4efc1e)){return _0x3e88dd(msgResponse('[abandonmentRate]','Error',_0xfe36('0x21e')+_0x4efc1e));}if(_0x5b87ad<=0x0||isNaN(_0x5b87ad)){return _0x3e88dd(msgResponse(_0xfe36('0x21c'),_0xfe36('0x47'),_0xfe36('0x21f')+_0x5b87ad));}if(_0x2841a3<=0x0||isNaN(_0x2841a3)){return _0x3e88dd(msgResponse(_0xfe36('0x21c'),'Error','Amax\x20=\x20'+_0x2841a3));}_0x2f8b2a=_0x2f8b2a||0x0;var _0x479391=0x1/_0x2180c1;var _0x55f960=0x0;var _0x599baf=0x0;var _0x2fb16c=0x0;var _0x142493=0x0;for(var _0x748e86=0x0;_0x2fb16c<_0x2841a3;_0x748e86+=0x1){_0x599baf=_0x748e86/_0x5b87ad;_0x55f960=(_0x4efc1e*_0x599baf+_0x2f8b2a)/_0x479391;_0x2fb16c=erlangb(_0x55f960,_0x208b58);_0x142493=_0x55f960/_0x208b58*(0x1-erlangb(_0x55f960,_0x208b58));}return _0x4008e2({'erlangCalls':_0x748e86,'erlangCallToSecond':_0x5b87ad/_0x748e86,'erlangAbandonmentRate':_0x2fb16c,'erlangBusyFactor':_0x142493});});};Dialer['prototype'][_0xfe36('0x1ed')]=function(_0x3db57c,_0x40354c,_0x2b6b79,_0x193b1d,_0x1fb9f2,_0x19ba70){loggerPredictive[_0xfe36('0x7e')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xfe36('0x7e')]('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',_0x3db57c);loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x220'),_0x40354c);loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x218'),_0x2b6b79);loggerPredictive[_0xfe36('0x7e')]('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',_0x193b1d);loggerPredictive[_0xfe36('0x7e')](_0xfe36('0x221'),_0x1fb9f2);loggerPredictive[_0xfe36('0x7e')]('---------------------------');return new BPromise(function(_0x264641,_0x16eaa6){if(_0x3db57c<=0x0||isNaN(_0x3db57c)){return _0x16eaa6(msgResponse(_0xfe36('0x222'),_0xfe36('0x47'),'m\x20=\x20'+_0x3db57c));}if(_0x2b6b79<=0x0||isNaN(_0x2b6b79)){return _0x16eaa6(msgResponse(_0xfe36('0x222'),_0xfe36('0x47'),_0xfe36('0x21d')+_0x2b6b79));}if(_0x193b1d<=0x0||isNaN(_0x193b1d)){return _0x16eaa6(msgResponse(_0xfe36('0x222'),'Error',_0xfe36('0x21e')+_0x193b1d));}if(_0x40354c<=0x0||isNaN(_0x40354c)){return _0x16eaa6(msgResponse('[busyFactor]',_0xfe36('0x47'),_0xfe36('0x21f')+_0x40354c));}if(_0x1fb9f2<=0x0||isNaN(_0x1fb9f2)){return _0x16eaa6(msgResponse(_0xfe36('0x222'),_0xfe36('0x47'),_0xfe36('0x223')+_0x1fb9f2));}_0x19ba70=_0x19ba70||0x0;var _0x416d72=0x1/_0x2b6b79;var _0x30e2da=0x0;var _0x39825b=0x0;var _0x9a6cde=0x0;var _0x20b585=0x0;for(var _0x5233e5=0x0;_0x20b585<_0x1fb9f2;_0x5233e5+=0x1){_0x39825b=_0x5233e5/_0x40354c;_0x30e2da=(_0x193b1d*_0x39825b+_0x19ba70)/_0x416d72;_0x9a6cde=erlangb(_0x30e2da,_0x3db57c);_0x20b585=_0x30e2da/_0x3db57c*(0x1-erlangb(_0x30e2da,_0x3db57c));}return _0x264641({'erlangCalls':_0x5233e5,'erlangCallToSecond':_0x40354c/_0x5233e5,'erlangAbandonmentRate':_0x9a6cde,'erlangBusyFactor':_0x20b585});});};module[_0xfe36('0x224')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 525f637..3c9b0db 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6d3=['reason','callback','callbackuniqueid','callbackat','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','milliseconds','diff','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','responsetime','droptime','endtime','starttime','holdtime','talktime','queue','membername','connectedlinename'];(function(_0x5a0918,_0x3f3a02){var _0x524d59=function(_0x1a0c72){while(--_0x1a0c72){_0x5a0918['push'](_0x5a0918['shift']());}};_0x524d59(++_0x3f3a02);}(_0xc6d3,0x17c));var _0x3c6d=function(_0x556348,_0x37e6bc){_0x556348=_0x556348-0x0;var _0x4736b3=_0xc6d3[_0x556348];return _0x4736b3;};'use strict';var util=require('util');var _=require(_0x3c6d('0x0'));var moment=require('moment');function getSeconds(_0xa2f6b2,_0x2f9c3a){var _0x39bc61=moment(_0xa2f6b2)[_0x3c6d('0x1')](0x0);var _0x246d30=moment(_0x2f9c3a)[_0x3c6d('0x1')](0x0);return _0x39bc61[_0x3c6d('0x2')](_0x246d30,'seconds');}function QueueCallerAbandon(_0x1168a1,_0x485323){this[_0x3c6d('0x3')]=_0x1168a1[_0x3c6d('0x3')];this[_0x3c6d('0x4')]=_0x1168a1[_0x3c6d('0x4')];this['campaigntype']=_0x1168a1['type']==='outbound'?'queue':_0x1168a1[_0x3c6d('0x4')];this[_0x3c6d('0x5')]=_0x1168a1['countbusyretry'];this[_0x3c6d('0x6')]=_0x1168a1['countcongestionretry'];this[_0x3c6d('0x7')]=_0x1168a1[_0x3c6d('0x7')];this[_0x3c6d('0x8')]=_0x1168a1[_0x3c6d('0x5')]+_0x1168a1[_0x3c6d('0x6')]+_0x1168a1['countnoanswerretry']+_0x1168a1[_0x3c6d('0x9')]+_0x1168a1[_0x3c6d('0xa')]+_0x1168a1[_0x3c6d('0xb')]+_0x1168a1[_0x3c6d('0xc')]+_0x1168a1[_0x3c6d('0xd')];this[_0x3c6d('0x9')]=_0x1168a1['countnosuchnumberretry'];this[_0x3c6d('0xa')]=_0x1168a1[_0x3c6d('0xa')];this[_0x3c6d('0xb')]=_0x1168a1['countabandonedretry'];this[_0x3c6d('0xc')]=_0x1168a1['countmachineretry'];this['countagentrejectretry']=_0x1168a1[_0x3c6d('0xd')];this[_0x3c6d('0xe')]=_0x485323[_0x3c6d('0xe')];this[_0x3c6d('0xf')]=_0x1168a1['name'];this[_0x3c6d('0x10')]=_0x1168a1[_0x3c6d('0x11')];this['starttime']=_0x1168a1['starttime'];this[_0x3c6d('0x12')]=_0x1168a1['responsetime'];this[_0x3c6d('0x13')]=_0x1168a1[_0x3c6d('0x13')];this[_0x3c6d('0x14')]=this[_0x3c6d('0x13')];this['ringtime']=getSeconds(_0x1168a1[_0x3c6d('0x12')],_0x1168a1[_0x3c6d('0x15')]);this[_0x3c6d('0x16')]=getSeconds(this[_0x3c6d('0x13')],_0x1168a1['responsetime']);this[_0x3c6d('0x17')]=0x0;this[_0x3c6d('0x18')]=_0x485323[_0x3c6d('0x18')];this[_0x3c6d('0x19')]=_0x485323[_0x3c6d('0x1a')];this['reason']=_0x485323[_0x3c6d('0x1b')];this[_0x3c6d('0x1c')]=_0x1168a1['callback'];this[_0x3c6d('0x1d')]=_0x1168a1[_0x3c6d('0x1d')];this[_0x3c6d('0x1e')]=_0x1168a1['callbackat'];this['recallme']=_0x1168a1['recallme'];this['ContactId']=_0x1168a1[_0x3c6d('0x1f')];this[_0x3c6d('0x20')]=_0x1168a1[_0x3c6d('0x20')];this['UserId']=_0x1168a1['UserId'];this[_0x3c6d('0x21')]=_0x1168a1[_0x3c6d('0x21')];this['CampaignId']=_0x1168a1[_0x3c6d('0x22')];this[_0x3c6d('0x23')]=_0x1168a1[_0x3c6d('0x23')]||'';this['originatecalleridname']=_0x1168a1[_0x3c6d('0x24')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x6175=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x6175,0xd7));var _0x5617=function(_0x202a6e,_0x2dd346){_0x202a6e=_0x202a6e-0x0;var _0x326d74=_0x6175[_0x202a6e];return _0x326d74;};'use strict';var util=require(_0x5617('0x0'));var _=require('lodash');var moment=require(_0x5617('0x1'));function getSeconds(_0x2e1ee5,_0x571eae){var _0x1b58bf=moment(_0x2e1ee5)[_0x5617('0x2')](0x0);var _0x28a610=moment(_0x571eae)['milliseconds'](0x0);return _0x1b58bf['diff'](_0x28a610,_0x5617('0x3'));}function QueueCallerAbandon(_0x4b4d72,_0x4c8c7d){this[_0x5617('0x4')]=_0x4b4d72[_0x5617('0x4')];this[_0x5617('0x5')]=_0x4b4d72['type'];this[_0x5617('0x6')]=_0x4b4d72[_0x5617('0x5')]==='outbound'?_0x5617('0x7'):_0x4b4d72['type'];this['countbusyretry']=_0x4b4d72[_0x5617('0x8')];this[_0x5617('0x9')]=_0x4b4d72[_0x5617('0x9')];this[_0x5617('0xa')]=_0x4b4d72[_0x5617('0xa')];this['countglobal']=_0x4b4d72[_0x5617('0x8')]+_0x4b4d72['countcongestionretry']+_0x4b4d72[_0x5617('0xa')]+_0x4b4d72[_0x5617('0xb')]+_0x4b4d72[_0x5617('0xc')]+_0x4b4d72[_0x5617('0xd')]+_0x4b4d72[_0x5617('0xe')]+_0x4b4d72['countagentrejectretry'];this[_0x5617('0xb')]=_0x4b4d72['countnosuchnumberretry'];this[_0x5617('0xc')]=_0x4b4d72[_0x5617('0xc')];this['countabandonedretry']=_0x4b4d72['countabandonedretry'];this['countmachineretry']=_0x4b4d72['countmachineretry'];this[_0x5617('0xf')]=_0x4b4d72[_0x5617('0xf')];this[_0x5617('0x10')]=_0x4c8c7d[_0x5617('0x10')];this[_0x5617('0x11')]=_0x4b4d72[_0x5617('0x12')];this[_0x5617('0x13')]=_0x4b4d72['number'];this[_0x5617('0x14')]=_0x4b4d72[_0x5617('0x14')];this['responsetime']=_0x4b4d72[_0x5617('0x15')];this[_0x5617('0x16')]=_0x4b4d72[_0x5617('0x16')];this[_0x5617('0x17')]=this['droptime'];this[_0x5617('0x18')]=getSeconds(_0x4b4d72['responsetime'],_0x4b4d72['starttime']);this[_0x5617('0x19')]=getSeconds(this[_0x5617('0x16')],_0x4b4d72[_0x5617('0x15')]);this[_0x5617('0x1a')]=0x0;this[_0x5617('0x7')]=_0x4c8c7d['queue'];this[_0x5617('0x1b')]=_0x4c8c7d['connectedlinename'];this['reason']=_0x4c8c7d[_0x5617('0x1c')];this[_0x5617('0x1d')]=_0x4b4d72[_0x5617('0x1d')];this[_0x5617('0x1e')]=_0x4b4d72['callbackuniqueid'];this[_0x5617('0x1f')]=_0x4b4d72[_0x5617('0x1f')];this[_0x5617('0x20')]=_0x4b4d72[_0x5617('0x20')];this[_0x5617('0x21')]=_0x4b4d72[_0x5617('0x21')];this[_0x5617('0x22')]=_0x4b4d72[_0x5617('0x22')];this[_0x5617('0x23')]=_0x4b4d72['UserId'];this[_0x5617('0x24')]=_0x4b4d72[_0x5617('0x24')];this[_0x5617('0x25')]=_0x4b4d72[_0x5617('0x25')];this['originatecalleridnum']=_0x4b4d72[_0x5617('0x26')]||'';this[_0x5617('0x27')]=_0x4b4d72[_0x5617('0x27')]||'';}module[_0x5617('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index ef7a952..ccb5d90 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(_0x150d31,_0x4bb8f1){var _0x13ea46=function(_0x164aa5){while(--_0x164aa5){_0x150d31['push'](_0x150d31['shift']());}};_0x13ea46(++_0x4bb8f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x3c2dd9,_0x517e71){var _0x6bf6fa=function(_0x25f85f){while(--_0x25f85f){_0x3c2dd9['push'](_0x3c2dd9['shift']());}};_0x6bf6fa(++_0x517e71);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 2fbab00..e7b735f 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 _0x57f8=['/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','addVariables','active','isNil','SIP/%s','unmonitored','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x57f8,0x198));var _0x857f=function(_0x52ab8a,_0xee034b){_0x52ab8a=_0x52ab8a-0x0;var _0x5d6ddc=_0x57f8[_0x52ab8a];return _0x5d6ddc;};'use strict';var util=require('util');var _=require(_0x857f('0x0'));var BPromise=require(_0x857f('0x1'));var uuid=require(_0x857f('0x2'));var moment=require(_0x857f('0x3'));var path=require(_0x857f('0x4'));var tiff2pdf=require(_0x857f('0x5'));var gs=require(_0x857f('0x6'));var logger=require(_0x857f('0x7'))(_0x857f('0x8'));var ami=require(_0x857f('0x9'));var rpcDb=require(_0x857f('0xa'));var Channel=require(_0x857f('0xb'));var ut=require('./util/util');var Action=require(_0x857f('0xc'));var faxAccount=require(_0x857f('0xd'));var attachment=require(_0x857f('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5f6a66){this[_0x857f('0xf')]={};this[_0x857f('0x10')]=_0x5f6a66['faxAccounts'];this[_0x857f('0x11')]=_0x5f6a66[_0x857f('0x11')];this[_0x857f('0x12')]={};ami['on']('newchannel',this[_0x857f('0x13')][_0x857f('0x14')](this));ami['on'](_0x857f('0x15'),this[_0x857f('0x16')][_0x857f('0x14')](this));ami['on'](_0x857f('0x17'),this[_0x857f('0x18')]['bind'](this));ami['on'](_0x857f('0x19'),this[_0x857f('0x1a')][_0x857f('0x14')](this));ami['on'](_0x857f('0x1b'),this[_0x857f('0x1c')]['bind'](this));ami['on']('receivefax',this[_0x857f('0x1d')]['bind'](this));ami['on'](_0x857f('0x1e'),this['syncHangup'][_0x857f('0x14')](this));ami['on'](_0x857f('0x1f'),this['syncOriginateResponse'][_0x857f('0x14')](this));}Fax[_0x857f('0x20')][_0x857f('0x13')]=function(_0x10b547){if(_0x10b547[_0x857f('0x21')]===_0x857f('0x22')){for(var _0x1a9ef8 in this[_0x857f('0x10')]){if(this[_0x857f('0x10')][_0x857f('0x23')](_0x1a9ef8)){if(_0x10b547[_0x857f('0x24')]===this['faxAccounts'][_0x1a9ef8][_0x857f('0x25')]){this[_0x857f('0xf')][_0x10b547['uniqueid']]={};this[_0x857f('0xf')][_0x10b547[_0x857f('0x26')]][_0x857f('0x27')]=_0x10b547['channel'];this['channels'][_0x10b547[_0x857f('0x26')]]['id']=this[_0x857f('0x10')][_0x1a9ef8]['id'];this[_0x857f('0xf')][_0x10b547['uniqueid']][_0x857f('0x28')]=this[_0x857f('0x10')][_0x1a9ef8][_0x857f('0x28')];logger['info'](_0x10b547[_0x857f('0x26')],_0x857f('0x29'));}}}}if(this['actions'][_0x10b547[_0x857f('0x26')]]){this[_0x857f('0xf')][_0x10b547[_0x857f('0x26')]]={};this[_0x857f('0xf')][_0x10b547[_0x857f('0x26')]][_0x857f('0x27')]=_0x10b547[_0x857f('0x27')];logger[_0x857f('0x2a')](_0x10b547[_0x857f('0x26')],_0x857f('0x29'));}};Fax[_0x857f('0x20')][_0x857f('0x16')]=function(_0x250731){if(this[_0x857f('0xf')][_0x250731['uniqueid']]){for(var _0x17e415 in _0x250731[_0x857f('0x2b')]){if(_0x250731[_0x857f('0x2b')][_0x857f('0x23')](_0x17e415)){this['channels'][_0x250731[_0x857f('0x26')]][_0x17e415]=_0x250731['value'];}}}};Fax[_0x857f('0x20')][_0x857f('0x18')]=function(_0x45a37f){if(this[_0x857f('0xf')][_0x45a37f[_0x857f('0x26')]]){this[_0x857f('0xf')][_0x45a37f[_0x857f('0x26')]][_0x857f('0x2c')]=_0x45a37f[_0x857f('0x2c')];this[_0x857f('0xf')][_0x45a37f[_0x857f('0x26')]][_0x857f('0x2d')]=_0x45a37f[_0x857f('0x2d')];}};Fax['prototype'][_0x857f('0x1a')]=function(_0x24d370){if(this['channels'][_0x24d370[_0x857f('0x26')]]){for(var _0x396786 in _0x24d370['variable']){if(_0x24d370[_0x857f('0x2b')][_0x857f('0x23')](_0x396786)){this['channels'][_0x24d370[_0x857f('0x26')]][_0x396786]=_0x24d370[_0x857f('0x2e')];}}}};Fax[_0x857f('0x20')][_0x857f('0x1c')]=function(_0x52708b){if(this['channels'][_0x52708b[_0x857f('0x26')]]){this[_0x857f('0xf')][_0x52708b['uniqueid']][_0x857f('0x2f')]=_0x52708b['operation'];this[_0x857f('0xf')][_0x52708b[_0x857f('0x26')]][_0x857f('0x30')]=_0x52708b[_0x857f('0x30')];this[_0x857f('0xf')][_0x52708b['uniqueid']]['localstationid']=_0x52708b[_0x857f('0x25')];this['channels'][_0x52708b[_0x857f('0x26')]][_0x857f('0x31')]=_0x52708b[_0x857f('0x31')];logger['info'](_0x52708b[_0x857f('0x26')],_0x857f('0x32'));}};Fax[_0x857f('0x20')][_0x857f('0x1d')]=function(_0x36e6bd){var _0xba5525=this;if(this[_0x857f('0xf')][_0x36e6bd['uniqueid']]){var _0x458c67=this[_0x857f('0xf')][_0x36e6bd[_0x857f('0x26')]]['id'];this[_0x857f('0xf')][_0x36e6bd[_0x857f('0x26')]][_0x857f('0x33')]=_0x36e6bd[_0x857f('0x33')];this['channels'][_0x36e6bd[_0x857f('0x26')]][_0x857f('0x34')]=_0x36e6bd[_0x857f('0x34')];this[_0x857f('0xf')][_0x36e6bd[_0x857f('0x26')]][_0x857f('0x25')]=_0x36e6bd['localstationid'];this[_0x857f('0xf')][_0x36e6bd[_0x857f('0x26')]][_0x857f('0x35')]=_0x36e6bd[_0x857f('0x35')];this[_0x857f('0xf')][_0x36e6bd[_0x857f('0x26')]][_0x857f('0x36')]=_0x36e6bd[_0x857f('0x36')];this['channels'][_0x36e6bd[_0x857f('0x26')]][_0x857f('0x31')]=_0x36e6bd[_0x857f('0x31')];this[_0x857f('0xf')][_0x36e6bd[_0x857f('0x26')]][_0x857f('0x37')]=_0x36e6bd[_0x857f('0x37')];if(this[_0x857f('0xf')][_0x36e6bd[_0x857f('0x26')]][_0x857f('0x34')]>0x0){tiff2pdf(_0x36e6bd[_0x857f('0x31')],_0x857f('0x38'),function(_0x325f55){logger[_0x857f('0x2a')](_0x36e6bd['uniqueid'],_0x857f('0x39'),_0x325f55['message']);attachment[_0x857f('0x3a')]({'name':path[_0x857f('0x3b')](_0x36e6bd[_0x857f('0x31')])[_0x857f('0x28')],'basename':path[_0x857f('0x3b')](_0x36e6bd[_0x857f('0x31')])[_0x857f('0x28')]+_0x857f('0x3c'),'type':_0x857f('0x3d')})[_0x857f('0x3e')](function(_0xc5a81d){faxAccount['notify'](_0x458c67,{'from':_0x36e6bd['calleridnum'],'mapKey':_0x857f('0x8'),'body':path['parse'](_0x36e6bd[_0x857f('0x31')])['name']+_0x857f('0x3c'),'AttachmentId':_0xc5a81d['id']})[_0x857f('0x3f')](function(_0x334dc9){logger[_0x857f('0x40')](_0x36e6bd[_0x857f('0x26')],_0x857f('0x41'),JSON[_0x857f('0x42')](_0x334dc9));});})[_0x857f('0x3f')](function(_0x5d633e){logger[_0x857f('0x40')](_0x36e6bd[_0x857f('0x26')],_0x857f('0x43'),JSON[_0x857f('0x42')](_0x5d633e));});});}logger['info'](_0x36e6bd[_0x857f('0x26')],_0x857f('0x43'));}};Fax[_0x857f('0x20')][_0x857f('0x44')]=function(_0x67563){if(this['actions'][_0x67563[_0x857f('0x26')]]){_[_0x857f('0x45')](this['channels'][_0x67563[_0x857f('0x26')]],_[_0x857f('0x46')](_0x67563,['response',_0x857f('0x47')]));}};function updateStatus(_0x5a3f7e){if(_0x5a3f7e[_0x857f('0x48')]){faxMessage[_0x857f('0x49')](_0x5a3f7e[_0x857f('0x48')],{'failMessage':_0x857f('0x4a')})[_0x857f('0x3e')](function(_0x1ac808){ut[_0x857f('0x4b')](_0x857f('0x4c'),_0x1ac808);})[_0x857f('0x3f')](function(_0x6e39f4){ut['logger'](_0x857f('0x4d'),_0x6e39f4);});}else{ut[_0x857f('0x4b')](_0x857f('0x4e'));}}Fax[_0x857f('0x20')][_0x857f('0x4f')]=function(_0x9edee5,_0x12712a,_0x59164a){var _0xe2c360=this;var _0x1036a8={};if(_0x12712a){_0x1036a8={'read':_0x12712a};}else{_0x1036a8={'failMessage':_0x59164a};}if(this[_0x857f('0x12')][_0x9edee5][_0x857f('0x48')]){faxMessage[_0x857f('0x49')](this[_0x857f('0x12')][_0x9edee5]['AttachmentId'],_0x1036a8)[_0x857f('0x3e')](function(_0xe7e09b){ut[_0x857f('0x4b')](_0x857f('0x50'),_0xe7e09b);})[_0x857f('0x3f')](function(_0x658eb0){ut[_0x857f('0x4b')](_0x857f('0x51'),_0x658eb0);})['finally'](function(){delete _0xe2c360['channels'][_0x9edee5];delete _0xe2c360[_0x857f('0x12')][_0x9edee5];});}else{ut[_0x857f('0x4b')](_0x857f('0x52'));delete this[_0x857f('0xf')][_0x9edee5];delete this[_0x857f('0x12')][_0x9edee5];}};Fax[_0x857f('0x20')]['syncHangup']=function(_0x39568b){var _0x237739=this;if(this['channels'][_0x39568b[_0x857f('0x26')]]){if(this['actions'][_0x39568b[_0x857f('0x26')]]){this[_0x857f('0xf')][_0x39568b['uniqueid']]['id']=this[_0x857f('0x12')][_0x39568b[_0x857f('0x26')]]['id'];this[_0x857f('0xf')][_0x39568b[_0x857f('0x26')]][_0x857f('0x28')]=this[_0x857f('0x12')][_0x39568b[_0x857f('0x26')]][_0x857f('0x28')];}logger['info'](_0x39568b[_0x857f('0x26')],this[_0x857f('0x12')][_0x39568b[_0x857f('0x26')]]?_0x857f('0x53'):_0x857f('0x54'),JSON[_0x857f('0x42')](this[_0x857f('0xf')][_0x39568b[_0x857f('0x26')]]));if(this[_0x857f('0x12')][_0x39568b[_0x857f('0x26')]]){if(this[_0x857f('0xf')][_0x39568b['uniqueid']][_0x857f('0x55')]>0x0&&this[_0x857f('0xf')][_0x39568b[_0x857f('0x26')]][_0x857f('0x1b')]==='SUCCESS'){this[_0x857f('0x4f')](_0x39568b['uniqueid'],!![]);}else{this[_0x857f('0x4f')](_0x39568b[_0x857f('0x26')],![],this[_0x857f('0xf')][_0x39568b[_0x857f('0x26')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x857f('0xf')][_0x39568b[_0x857f('0x26')]][_0x857f('0x56')]:'SENDING\x20FAILED');}}}};Fax[_0x857f('0x20')]['send']=function(_0x5b505){var _0x1d6c1c=this;return new BPromise(function(_0x1bde49,_0x47fa5a){_0x1d6c1c['execOriginate'](_0x5b505,_0x1d6c1c[_0x857f('0x10')][_0x5b505[_0x857f('0x57')]])[_0x857f('0x3e')](function(_0x570e3a){ut[_0x857f('0x4b')](_0x857f('0x58'),_0x570e3a);_0x1bde49(ut[_0x857f('0x59')](_0x857f('0x5a')));})['catch'](function(_0x5c8183){ut[_0x857f('0x4b')](_0x857f('0x5b'),_0x5c8183);updateStatus(_0x5b505);_0x47fa5a(ut[_0x857f('0x59')](_0x857f('0x5c')));});});};Fax[_0x857f('0x20')][_0x857f('0x5d')]=function(_0x54c8d1){var _0x16cfe0=this;return new BPromise(function(_0x3ac1de,_0x2f92d3){var _0xeac958=_0x16cfe0[_0x857f('0x5e')](_0x16cfe0[_0x857f('0x10')][_0x54c8d1[_0x857f('0x57')]][_0x857f('0x5f')],_0x54c8d1);if(_0xeac958[_0x857f('0x60')]){_0x3ac1de(ut[_0x857f('0x59')]('Trunk\x20Reachable'));}else{_0x2f92d3(ut[_0x857f('0x59')](_0xeac958['message']));}});};function originate(_0x5ec513,_0x35cd3e,_0x48e588){return new BPromise(function(_0x5e5fd9,_0x2e2cf3){if(_0x48e588){var _0x59d2b6=util[_0x857f('0x61')]('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[_0x857f('0x3b')](_0x5ec513[_0x857f('0x4')])[_0x857f('0x28')],_0x5ec513[_0x857f('0x4')]);gs['execute'](_0x59d2b6)[_0x857f('0x3e')](function(){_0x5ec513[_0x857f('0x4')]=util[_0x857f('0x61')](_0x857f('0x62'),path[_0x857f('0x3b')](_0x5ec513[_0x857f('0x4')])[_0x857f('0x63')],path['parse'](_0x5ec513['path'])[_0x857f('0x28')]);_0x35cd3e[_0x857f('0x64')]=_0x5ec513[_0x857f('0x4')];ut[_0x857f('0x4b')](_0x857f('0x65'),'');ami[_0x857f('0x66')](ut['variablesAction'](_0x5ec513,_0x35cd3e))[_0x857f('0x3e')](function(_0x21c0b6){_0x5e5fd9(_0x21c0b6);})[_0x857f('0x3f')](function(_0x4fa8a8){_0x2e2cf3(_0x4fa8a8);});})['catch'](function(_0x27f85b){_0x2e2cf3(_0x27f85b);});}else{ami['Action'](ut['variablesAction'](_0x5ec513,_0x35cd3e))[_0x857f('0x3e')](function(_0x112dc4){_0x5e5fd9(_0x112dc4);})['catch'](function(_0x334d6a){_0x2e2cf3(_0x334d6a);});}});}Fax[_0x857f('0x20')]['execOriginate']=function(_0x4692eb,_0x21cc84){var _0x2dfd23=this;return new BPromise(function(_0x2398df,_0x7c10c9){var _0x180898=uuid['v4']();var _0x31125a=ut[_0x857f('0x67')](_0x4692eb,_0x21cc84);_0x2dfd23[_0x857f('0x12')][_0x180898]=new Action(_0x180898,_0x21cc84,_0x4692eb);var _0x465857=_0x2dfd23[_0x857f('0x12')][_0x180898];if(path[_0x857f('0x3b')](_0x4692eb['path'])['ext']==='.pdf'){originate(_0x465857,_0x31125a,!![])[_0x857f('0x3e')](function(_0x310b18){_0x2398df(_0x310b18);})[_0x857f('0x3f')](function(_0x1f3c92){_0x7c10c9(_0x1f3c92);});}else{originate(_0x465857,_0x31125a,![])[_0x857f('0x3e')](function(_0xcda571){_0x2398df(_0xcda571);})[_0x857f('0x3f')](function(_0x5e6f27){_0x7c10c9(_0x5e6f27);});}});};Fax[_0x857f('0x20')]['isTrunkReachable']=function(_0x3e5235){return!_['isNil'](_0x3e5235)&&!_['isNil'](_0x3e5235[_0x857f('0x28')])&&!_['isNil'](_0x3e5235[_0x857f('0x68')])&&_0x3e5235[_0x857f('0x68')]&&!_[_0x857f('0x69')](this['trunks'][util[_0x857f('0x61')](_0x857f('0x6a'),_0x3e5235[_0x857f('0x28')])])&&!_[_0x857f('0x69')](this[_0x857f('0x11')][util[_0x857f('0x61')](_0x857f('0x6a'),_0x3e5235[_0x857f('0x28')])][_0x857f('0x30')])&&(this['trunks'][util[_0x857f('0x61')](_0x857f('0x6a'),_0x3e5235[_0x857f('0x28')])][_0x857f('0x30')]==='reachable'||this[_0x857f('0x11')][util['format'](_0x857f('0x6a'),_0x3e5235[_0x857f('0x28')])][_0x857f('0x30')]===_0x857f('0x6b'));};Fax['prototype'][_0x857f('0x5e')]=function(_0x4974cf,_0x56f7a4){if(!this[_0x857f('0x6c')](_0x4974cf)){ut[_0x857f('0x4b')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x4974cf)?'':_0x4974cf[_0x857f('0x28')]+_0x857f('0x6d'));return{'isValid':![],'message':_0x857f('0x6e')};}if(_[_0x857f('0x69')](_0x56f7a4['fax'])){ut[_0x857f('0x4b')](_0x857f('0x6f'),JSON[_0x857f('0x42')](_0x56f7a4));return{'isValid':![],'message':_0x857f('0x70')};}if(_[_0x857f('0x69')](_0x56f7a4['path'])){ut['logger'](_0x857f('0x71'),JSON['stringify'](_0x56f7a4));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x857f('0x72')};};module[_0x857f('0x73')]=Fax; \ No newline at end of file +var _0x7916=['\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncHangup','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','variable','channelstatedesc','value','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','info','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','fax','catch','error'];(function(_0x1f6e37,_0x560390){var _0x3d17ad=function(_0x23a623){while(--_0x23a623){_0x1f6e37['push'](_0x1f6e37['shift']());}};_0x3d17ad(++_0x560390);}(_0x7916,0x128));var _0x6791=function(_0x2f4e55,_0x2abe26){_0x2f4e55=_0x2f4e55-0x0;var _0x2eb1e3=_0x7916[_0x2f4e55];return _0x2eb1e3;};'use strict';var util=require(_0x6791('0x0'));var _=require('lodash');var BPromise=require(_0x6791('0x1'));var uuid=require(_0x6791('0x2'));var moment=require('moment');var path=require(_0x6791('0x3'));var tiff2pdf=require(_0x6791('0x4'));var gs=require(_0x6791('0x5'));var logger=require(_0x6791('0x6'))('fax');var ami=require(_0x6791('0x7'));var rpcDb=require('./rpcDb');var Channel=require(_0x6791('0x8'));var ut=require(_0x6791('0x9'));var Action=require('./action');var faxAccount=require(_0x6791('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x6791('0xb'));function Fax(_0x50c563){this['channels']={};this[_0x6791('0xc')]=_0x50c563[_0x6791('0xc')];this['trunks']=_0x50c563[_0x6791('0xd')];this[_0x6791('0xe')]={};ami['on'](_0x6791('0xf'),this['syncNewchannel'][_0x6791('0x10')](this));ami['on'](_0x6791('0x11'),this[_0x6791('0x12')][_0x6791('0x10')](this));ami['on'](_0x6791('0x13'),this[_0x6791('0x14')][_0x6791('0x10')](this));ami['on'](_0x6791('0x15'),this[_0x6791('0x16')][_0x6791('0x10')](this));ami['on'](_0x6791('0x17'),this['syncFaxStatus']['bind'](this));ami['on'](_0x6791('0x18'),this['syncReceiveFax'][_0x6791('0x10')](this));ami['on']('hangup',this[_0x6791('0x19')][_0x6791('0x10')](this));ami['on']('originateresponse',this[_0x6791('0x1a')]['bind'](this));}Fax[_0x6791('0x1b')][_0x6791('0x1c')]=function(_0x596a06){if(_0x596a06[_0x6791('0x1d')]===_0x6791('0x1e')){for(var _0x5bec14 in this[_0x6791('0xc')]){if(this['faxAccounts'][_0x6791('0x1f')](_0x5bec14)){if(_0x596a06[_0x6791('0x20')]===this[_0x6791('0xc')][_0x5bec14][_0x6791('0x21')]){this[_0x6791('0x22')][_0x596a06[_0x6791('0x23')]]={};this[_0x6791('0x22')][_0x596a06['uniqueid']][_0x6791('0x24')]=_0x596a06[_0x6791('0x24')];this['channels'][_0x596a06[_0x6791('0x23')]]['id']=this[_0x6791('0xc')][_0x5bec14]['id'];this['channels'][_0x596a06[_0x6791('0x23')]][_0x6791('0x25')]=this[_0x6791('0xc')][_0x5bec14][_0x6791('0x25')];logger['info'](_0x596a06[_0x6791('0x23')],_0x6791('0x26'));}}}}if(this['actions'][_0x596a06['uniqueid']]){this['channels'][_0x596a06[_0x6791('0x23')]]={};this['channels'][_0x596a06[_0x6791('0x23')]]['channel']=_0x596a06['channel'];logger['info'](_0x596a06[_0x6791('0x23')],_0x6791('0x26'));}};Fax[_0x6791('0x1b')]['syncVarSet']=function(_0x3def2e){if(this[_0x6791('0x22')][_0x3def2e['uniqueid']]){for(var _0x342107 in _0x3def2e['variable']){if(_0x3def2e[_0x6791('0x27')]['hasOwnProperty'](_0x342107)){this['channels'][_0x3def2e[_0x6791('0x23')]][_0x342107]=_0x3def2e['value'];}}}};Fax[_0x6791('0x1b')][_0x6791('0x14')]=function(_0x483d6c){if(this[_0x6791('0x22')][_0x483d6c[_0x6791('0x23')]]){this[_0x6791('0x22')][_0x483d6c[_0x6791('0x23')]]['channelstate']=_0x483d6c['channelstate'];this[_0x6791('0x22')][_0x483d6c['uniqueid']][_0x6791('0x28')]=_0x483d6c[_0x6791('0x28')];}};Fax[_0x6791('0x1b')][_0x6791('0x16')]=function(_0x1d551b){if(this[_0x6791('0x22')][_0x1d551b[_0x6791('0x23')]]){for(var _0x14307e in _0x1d551b[_0x6791('0x27')]){if(_0x1d551b[_0x6791('0x27')]['hasOwnProperty'](_0x14307e)){this[_0x6791('0x22')][_0x1d551b[_0x6791('0x23')]][_0x14307e]=_0x1d551b[_0x6791('0x29')];}}}};Fax[_0x6791('0x1b')][_0x6791('0x2a')]=function(_0x36f673){if(this['channels'][_0x36f673['uniqueid']]){this['channels'][_0x36f673[_0x6791('0x23')]][_0x6791('0x2b')]=_0x36f673[_0x6791('0x2b')];this['channels'][_0x36f673['uniqueid']][_0x6791('0x2c')]=_0x36f673[_0x6791('0x2c')];this[_0x6791('0x22')][_0x36f673[_0x6791('0x23')]]['localstationid']=_0x36f673[_0x6791('0x21')];this[_0x6791('0x22')][_0x36f673[_0x6791('0x23')]]['filename']=_0x36f673[_0x6791('0x2d')];logger['info'](_0x36f673['uniqueid'],_0x6791('0x2e'));}};Fax[_0x6791('0x1b')]['syncReceiveFax']=function(_0x764f15){var _0x70b2b7=this;if(this[_0x6791('0x22')][_0x764f15[_0x6791('0x23')]]){var _0x3e5676=this['channels'][_0x764f15[_0x6791('0x23')]]['id'];this[_0x6791('0x22')][_0x764f15[_0x6791('0x23')]]['remotestationid']=_0x764f15[_0x6791('0x2f')];this[_0x6791('0x22')][_0x764f15[_0x6791('0x23')]]['pagestransferred']=_0x764f15[_0x6791('0x30')];this[_0x6791('0x22')][_0x764f15[_0x6791('0x23')]][_0x6791('0x21')]=_0x764f15['localstationid'];this[_0x6791('0x22')][_0x764f15[_0x6791('0x23')]][_0x6791('0x31')]=_0x764f15[_0x6791('0x31')];this[_0x6791('0x22')][_0x764f15[_0x6791('0x23')]][_0x6791('0x32')]=_0x764f15[_0x6791('0x32')];this[_0x6791('0x22')][_0x764f15['uniqueid']]['filename']=_0x764f15[_0x6791('0x2d')];this[_0x6791('0x22')][_0x764f15['uniqueid']][_0x6791('0x33')]=_0x764f15[_0x6791('0x33')];if(this[_0x6791('0x22')][_0x764f15[_0x6791('0x23')]][_0x6791('0x30')]>0x0){tiff2pdf(_0x764f15[_0x6791('0x2d')],_0x6791('0x34'),function(_0x58f6da){logger[_0x6791('0x35')](_0x764f15['uniqueid'],_0x6791('0x36'),_0x58f6da[_0x6791('0x37')]);attachment[_0x6791('0x38')]({'name':path[_0x6791('0x39')](_0x764f15['filename'])[_0x6791('0x25')],'basename':path[_0x6791('0x39')](_0x764f15[_0x6791('0x2d')])[_0x6791('0x25')]+_0x6791('0x3a'),'type':_0x6791('0x3b')})[_0x6791('0x3c')](function(_0x453ccd){faxAccount['notify'](_0x3e5676,{'from':_0x764f15[_0x6791('0x33')],'mapKey':_0x6791('0x3d'),'body':path[_0x6791('0x39')](_0x764f15[_0x6791('0x2d')])['name']+_0x6791('0x3a'),'AttachmentId':_0x453ccd['id']})[_0x6791('0x3e')](function(_0x540ebe){logger[_0x6791('0x3f')](_0x764f15['uniqueid'],_0x6791('0x40'),JSON[_0x6791('0x41')](_0x540ebe));});})[_0x6791('0x3e')](function(_0x3ddccc){logger[_0x6791('0x3f')](_0x764f15[_0x6791('0x23')],_0x6791('0x42'),JSON[_0x6791('0x41')](_0x3ddccc));});});}logger[_0x6791('0x35')](_0x764f15['uniqueid'],_0x6791('0x42'));}};Fax['prototype'][_0x6791('0x1a')]=function(_0x2bb86a){if(this[_0x6791('0xe')][_0x2bb86a[_0x6791('0x23')]]){_[_0x6791('0x43')](this['channels'][_0x2bb86a[_0x6791('0x23')]],_[_0x6791('0x44')](_0x2bb86a,[_0x6791('0x45'),_0x6791('0x46')]));}};function updateStatus(_0x2b1656){if(_0x2b1656['AttachmentId']){faxMessage[_0x6791('0x47')](_0x2b1656[_0x6791('0x48')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x6791('0x3c')](function(_0x56f6c6){ut[_0x6791('0x49')](_0x6791('0x4a'),_0x56f6c6);})[_0x6791('0x3e')](function(_0x37e360){ut['logger'](_0x6791('0x4b'),_0x37e360);});}else{ut[_0x6791('0x49')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x6791('0x1b')][_0x6791('0x4c')]=function(_0x3a895b,_0x5df56e,_0x355e97){var _0x166b9a=this;var _0x54272c={};if(_0x5df56e){_0x54272c={'read':_0x5df56e};}else{_0x54272c={'failMessage':_0x355e97};}if(this[_0x6791('0xe')][_0x3a895b][_0x6791('0x48')]){faxMessage['update'](this[_0x6791('0xe')][_0x3a895b][_0x6791('0x48')],_0x54272c)[_0x6791('0x3c')](function(_0x285bfd){ut['logger'](_0x6791('0x4d'),_0x285bfd);})[_0x6791('0x3e')](function(_0x32f36b){ut['logger']('[Fax][Message][NoUpdate1]',_0x32f36b);})[_0x6791('0x4e')](function(){delete _0x166b9a[_0x6791('0x22')][_0x3a895b];delete _0x166b9a[_0x6791('0xe')][_0x3a895b];});}else{ut[_0x6791('0x49')](_0x6791('0x4f'));delete this['channels'][_0x3a895b];delete this['actions'][_0x3a895b];}};Fax[_0x6791('0x1b')]['syncHangup']=function(_0x51f071){var _0x8fc04b=this;if(this[_0x6791('0x22')][_0x51f071[_0x6791('0x23')]]){if(this[_0x6791('0xe')][_0x51f071[_0x6791('0x23')]]){this[_0x6791('0x22')][_0x51f071['uniqueid']]['id']=this['actions'][_0x51f071[_0x6791('0x23')]]['id'];this[_0x6791('0x22')][_0x51f071['uniqueid']][_0x6791('0x25')]=this['actions'][_0x51f071[_0x6791('0x23')]][_0x6791('0x25')];}logger['info'](_0x51f071[_0x6791('0x23')],this[_0x6791('0xe')][_0x51f071[_0x6791('0x23')]]?'\x20hangup\x20sendFile\x20':_0x6791('0x50'),JSON[_0x6791('0x41')](this[_0x6791('0x22')][_0x51f071[_0x6791('0x23')]]));if(this[_0x6791('0xe')][_0x51f071['uniqueid']]){if(this['channels'][_0x51f071[_0x6791('0x23')]][_0x6791('0x51')]>0x0&&this['channels'][_0x51f071[_0x6791('0x23')]][_0x6791('0x17')]===_0x6791('0x52')){this[_0x6791('0x4c')](_0x51f071[_0x6791('0x23')],!![]);}else{this[_0x6791('0x4c')](_0x51f071[_0x6791('0x23')],![],this[_0x6791('0x22')][_0x51f071['uniqueid']][_0x6791('0x53')]?_0x6791('0x54')+this[_0x6791('0x22')][_0x51f071[_0x6791('0x23')]]['faxstatusstring']:_0x6791('0x55'));}}}};Fax[_0x6791('0x1b')][_0x6791('0x56')]=function(_0x5ca809){var _0x205320=this;return new BPromise(function(_0x1fcbb6,_0x99d4ee){_0x205320[_0x6791('0x57')](_0x5ca809,_0x205320['faxAccounts'][_0x5ca809[_0x6791('0x58')]])[_0x6791('0x3c')](function(_0x5522db){ut[_0x6791('0x49')](_0x6791('0x59'),_0x5522db);_0x1fcbb6(ut[_0x6791('0x37')](_0x6791('0x5a')));})[_0x6791('0x3e')](function(_0x36d02a){ut['logger'](_0x6791('0x5b'),_0x36d02a);updateStatus(_0x5ca809);_0x99d4ee(ut[_0x6791('0x37')](_0x6791('0x5c')));});});};Fax['prototype'][_0x6791('0x5d')]=function(_0x530e1c){var _0x2648fa=this;return new BPromise(function(_0x11f3b2,_0xf0941a){var _0x2d5818=_0x2648fa[_0x6791('0x5e')](_0x2648fa['faxAccounts'][_0x530e1c[_0x6791('0x58')]][_0x6791('0x5f')],_0x530e1c);if(_0x2d5818[_0x6791('0x60')]){_0x11f3b2(ut[_0x6791('0x37')]('Trunk\x20Reachable'));}else{_0xf0941a(ut[_0x6791('0x37')](_0x2d5818[_0x6791('0x37')]));}});};function originate(_0x546995,_0x34691c,_0x1fa44a){return new BPromise(function(_0x567302,_0x201465){if(_0x1fa44a){var _0x23b9b4=util[_0x6791('0x61')](_0x6791('0x62'),path['parse'](_0x546995[_0x6791('0x3')])[_0x6791('0x25')],_0x546995['path']);gs[_0x6791('0x63')](_0x23b9b4)[_0x6791('0x3c')](function(){_0x546995[_0x6791('0x3')]=util[_0x6791('0x61')](_0x6791('0x64'),path['parse'](_0x546995[_0x6791('0x3')])[_0x6791('0x65')],path['parse'](_0x546995[_0x6791('0x3')])[_0x6791('0x25')]);_0x34691c[_0x6791('0x66')]=_0x546995['path'];ut[_0x6791('0x49')](_0x6791('0x67'),'');ami[_0x6791('0x68')](ut[_0x6791('0x69')](_0x546995,_0x34691c))[_0x6791('0x3c')](function(_0x1a1c3b){_0x567302(_0x1a1c3b);})[_0x6791('0x3e')](function(_0x30b3e6){_0x201465(_0x30b3e6);});})['catch'](function(_0x2ec629){_0x201465(_0x2ec629);});}else{ami[_0x6791('0x68')](ut['variablesAction'](_0x546995,_0x34691c))[_0x6791('0x3c')](function(_0x2b39d1){_0x567302(_0x2b39d1);})[_0x6791('0x3e')](function(_0x4bca9f){_0x201465(_0x4bca9f);});}});}Fax[_0x6791('0x1b')]['execOriginate']=function(_0xa1e941,_0x304e2a){var _0x126732=this;return new BPromise(function(_0x30d606,_0x3a964a){var _0x2d15b5=uuid['v4']();var _0x45712e=ut[_0x6791('0x6a')](_0xa1e941,_0x304e2a);_0x126732[_0x6791('0xe')][_0x2d15b5]=new Action(_0x2d15b5,_0x304e2a,_0xa1e941);var _0x1fa853=_0x126732[_0x6791('0xe')][_0x2d15b5];if(path[_0x6791('0x39')](_0xa1e941[_0x6791('0x3')])[_0x6791('0x6b')]===_0x6791('0x3a')){originate(_0x1fa853,_0x45712e,!![])[_0x6791('0x3c')](function(_0x3b53b8){_0x30d606(_0x3b53b8);})[_0x6791('0x3e')](function(_0xc6c959){_0x3a964a(_0xc6c959);});}else{originate(_0x1fa853,_0x45712e,![])['then'](function(_0x49e48e){_0x30d606(_0x49e48e);})['catch'](function(_0x15af12){_0x3a964a(_0x15af12);});}});};Fax[_0x6791('0x1b')][_0x6791('0x6c')]=function(_0x194a0b){return!_[_0x6791('0x6d')](_0x194a0b)&&!_[_0x6791('0x6d')](_0x194a0b[_0x6791('0x25')])&&!_[_0x6791('0x6d')](_0x194a0b[_0x6791('0x6e')])&&_0x194a0b[_0x6791('0x6e')]&&!_[_0x6791('0x6d')](this[_0x6791('0xd')][util[_0x6791('0x61')](_0x6791('0x6f'),_0x194a0b[_0x6791('0x25')])])&&!_[_0x6791('0x6d')](this[_0x6791('0xd')][util[_0x6791('0x61')](_0x6791('0x6f'),_0x194a0b[_0x6791('0x25')])][_0x6791('0x2c')])&&(this[_0x6791('0xd')][util[_0x6791('0x61')](_0x6791('0x6f'),_0x194a0b[_0x6791('0x25')])]['status']===_0x6791('0x70')||this['trunks'][util[_0x6791('0x61')](_0x6791('0x6f'),_0x194a0b['name'])][_0x6791('0x2c')]==='unmonitored');};Fax[_0x6791('0x1b')][_0x6791('0x5e')]=function(_0x5945cb,_0x33ed3b){if(!this[_0x6791('0x6c')](_0x5945cb)){ut[_0x6791('0x49')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x6791('0x6d')](_0x5945cb)?'':_0x5945cb[_0x6791('0x25')]+_0x6791('0x71'));return{'isValid':![],'message':_0x6791('0x72')};}if(_[_0x6791('0x6d')](_0x33ed3b[_0x6791('0x3d')])){ut['logger'](_0x6791('0x73'),JSON[_0x6791('0x41')](_0x33ed3b));return{'isValid':![],'message':_0x6791('0x74')};}if(_[_0x6791('0x6d')](_0x33ed3b[_0x6791('0x3')])){ut[_0x6791('0x49')](_0x6791('0x75'),JSON['stringify'](_0x33ed3b));return{'isValid':![],'message':_0x6791('0x76')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x6791('0x77')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index cecbc61..163afd3 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 _0x269b=['notify','resolve','then','catch','[Notify]\x20','util','bluebird','preview','lodash','../rpc/faxAccount','error','inspect'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x269b,0x95));var _0xb269=function(_0x169790,_0x48aa33){_0x169790=_0x169790-0x0;var _0x4d0f36=_0x269b[_0x169790];return _0x4d0f36;};'use strict';var util=require(_0xb269('0x0'));var BPromise=require(_0xb269('0x1'));var logger=require('../../../config/logger')(_0xb269('0x2'));var _=require(_0xb269('0x3'));var faxAccount=require(_0xb269('0x4'));function loggerCatch(_0x65f0ff){return function(_0x52f942){logger[_0xb269('0x5')](_0x65f0ff,util[_0xb269('0x6')](_0x52f942,{'showHidden':![],'depth':null}));};}exports[_0xb269('0x7')]=function(_0x52b4ec,_0x2b145a){return BPromise[_0xb269('0x8')]()[_0xb269('0x9')](faxAccount[_0xb269('0x7')](_0x52b4ec,_0x2b145a))[_0xb269('0xa')](loggerCatch(_0xb269('0xb')));}; \ No newline at end of file +var _0xc6e1=['bluebird','lodash','error','notify','then','[Notify]\x20'];(function(_0x577c63,_0x24b374){var _0x345c23=function(_0x2528af){while(--_0x2528af){_0x577c63['push'](_0x577c63['shift']());}};_0x345c23(++_0x24b374);}(_0xc6e1,0x126));var _0x1c6e=function(_0x2d9e8f,_0x508da6){_0x2d9e8f=_0x2d9e8f-0x0;var _0x38185f=_0xc6e1[_0x2d9e8f];return _0x38185f;};'use strict';var util=require('util');var BPromise=require(_0x1c6e('0x0'));var logger=require('../../../config/logger')('preview');var _=require(_0x1c6e('0x1'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x34fd19){return function(_0x457f2f){logger[_0x1c6e('0x2')](_0x34fd19,util['inspect'](_0x457f2f,{'showHidden':![],'depth':null}));};}exports[_0x1c6e('0x3')]=function(_0x3846cf,_0x553ac8){return BPromise['resolve']()[_0x1c6e('0x4')](faxAccount[_0x1c6e('0x3')](_0x3846cf,_0x553ac8))['catch'](loggerCatch(_0x1c6e('0x5')));}; \ 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 bce932e..738a118 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 _0x2477=['execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','bluebird','child_process','exec'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x2477,0x16c));var _0x7247=function(_0x5f46e7,_0x62f9f8){_0x5f46e7=_0x5f46e7-0x0;var _0x567e95=_0x2477[_0x5f46e7];return _0x567e95;};'use strict';var util=require(_0x7247('0x0'));var logger=require(_0x7247('0x1'))('fax');var BPromise=require(_0x7247('0x2'));var exec=require(_0x7247('0x3'))[_0x7247('0x4')];exports[_0x7247('0x5')]=function(_0xd80eb5){return new BPromise(function(_0x2d1bba,_0x3ffb5e){exec(_0xd80eb5,function(_0x444bd7,_0x1f1dd7,_0xa55802){logger[_0x7247('0x6')](_0x7247('0x7'),_0x1f1dd7);if(_0x444bd7){logger[_0x7247('0x6')](_0x7247('0x7'),_0x7247('0x8'),util['inspect'](_0x444bd7,{'showHidden':![],'depth':null}),_0x1f1dd7,_0xa55802);_0x3ffb5e(_0x444bd7);}_0x2d1bba(_0x1f1dd7);});});}; \ No newline at end of file +var _0xafcd=['\x20Error\x20:','../../../../config/logger','fax','bluebird','exec','execute','Exec\x20gs','info'];(function(_0x14f41c,_0x3becf3){var _0x18fcd8=function(_0xd08791){while(--_0xd08791){_0x14f41c['push'](_0x14f41c['shift']());}};_0x18fcd8(++_0x3becf3);}(_0xafcd,0x1c1));var _0xdafc=function(_0x148bd2,_0x3338c6){_0x148bd2=_0x148bd2-0x0;var _0x38c56f=_0xafcd[_0x148bd2];return _0x38c56f;};'use strict';var util=require('util');var logger=require(_0xdafc('0x0'))(_0xdafc('0x1'));var BPromise=require(_0xdafc('0x2'));var exec=require('child_process')[_0xdafc('0x3')];exports[_0xdafc('0x4')]=function(_0x1ae1c8){return new BPromise(function(_0x5d29b7,_0x24c5b2){exec(_0x1ae1c8,function(_0x718a79,_0x1357dd,_0x47f6b4){logger['info'](_0xdafc('0x5'),_0x1357dd);if(_0x718a79){logger[_0xdafc('0x6')](_0xdafc('0x5'),_0xdafc('0x7'),util['inspect'](_0x718a79,{'showHidden':![],'depth':null}),_0x1357dd,_0x47f6b4);_0x24c5b2(_0x718a79);}_0x5d29b7(_0x1357dd);});});}; \ 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 173418b..9bc1a48 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 _0x2d43=['modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','uniqueid','util','lodash','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22'];(function(_0x3ba4c7,_0x5b28be){var _0x3ac6db=function(_0x531856){while(--_0x531856){_0x3ba4c7['push'](_0x3ba4c7['shift']());}};_0x3ac6db(++_0x5b28be);}(_0x2d43,0x78));var _0x32d4=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x2d43[_0x1b6c6d];return _0x290d9d;};'use strict';var util=require(_0x32d4('0x0'));var _=require(_0x32d4('0x1'));var moment=require('moment');var logger=require(_0x32d4('0x2'))(_0x32d4('0x3'));exports[_0x32d4('0x4')]=function(_0x35b1a7){return{'message':_0x35b1a7};};exports[_0x32d4('0x5')]=function(_0x5f1e97,_0x225237){logger[_0x32d4('0x6')](_0x5f1e97,util[_0x32d4('0x7')](_0x225237,{'showHidden':![],'depth':null}));};exports[_0x32d4('0x8')]=function(_0x3f9e67,_0x234b99){var _0x1c1223={'XMF-ECM':_0x234b99[_0x32d4('0x9')],'XMF-HEADERINFO':_0x234b99[_0x32d4('0xa')],'XMF-MINRATE':_0x234b99[_0x32d4('0xb')],'XMF-MAXRATE':_0x234b99[_0x32d4('0xc')],'XMF-MODEM':util[_0x32d4('0xd')](_0x32d4('0xe'),_0x234b99[_0x32d4('0xf')]),'XMF-GATEWAY':_0x234b99[_0x32d4('0x10')],'XMF-FAXDETECT':_0x234b99[_0x32d4('0x11')],'XMF-T38TIMEOUT':_0x234b99[_0x32d4('0x12')],'XMF-LOCALSTATIONID':_0x234b99[_0x32d4('0x13')],'XMF-PATH':_0x3f9e67[_0x32d4('0x14')]};return _0x1c1223;};exports[_0x32d4('0x15')]=function(_0x4ad9a0,_0x25061f){return{'actionid':_0x4ad9a0['uniqueid'],'action':_0x32d4('0x16'),'channel':_0x4ad9a0['channel'],'Exten':_0x32d4('0x17'),'Context':_0x32d4('0x18'),'Priority':'1','callerid':util[_0x32d4('0xd')](_0x32d4('0x19'),_0x4ad9a0[_0x32d4('0xa')]?_0x4ad9a0[_0x32d4('0xa')]:'',_0x4ad9a0[_0x32d4('0x13')]),'variable':_0x25061f,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4ad9a0[_0x32d4('0x1a')]};}; \ No newline at end of file +var _0x91b1=['minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','path','uniqueid','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','localstationid','util','../../../../config/logger','fax','message','logger','info','addVariables','ecm','headerinfo'];(function(_0x12e3e9,_0x5311aa){var _0x30ab95=function(_0x220f0d){while(--_0x220f0d){_0x12e3e9['push'](_0x12e3e9['shift']());}};_0x30ab95(++_0x5311aa);}(_0x91b1,0x195));var _0x191b=function(_0x85d5a8,_0x1977be){_0x85d5a8=_0x85d5a8-0x0;var _0x20479b=_0x91b1[_0x85d5a8];return _0x20479b;};'use strict';var util=require(_0x191b('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x191b('0x1'))(_0x191b('0x2'));exports[_0x191b('0x3')]=function(_0x445d92){return{'message':_0x445d92};};exports[_0x191b('0x4')]=function(_0x26aa85,_0x1517ad){logger[_0x191b('0x5')](_0x26aa85,util['inspect'](_0x1517ad,{'showHidden':![],'depth':null}));};exports[_0x191b('0x6')]=function(_0x25c4a6,_0x149d89){var _0x433fd1={'XMF-ECM':_0x149d89[_0x191b('0x7')],'XMF-HEADERINFO':_0x149d89[_0x191b('0x8')],'XMF-MINRATE':_0x149d89[_0x191b('0x9')],'XMF-MAXRATE':_0x149d89[_0x191b('0xa')],'XMF-MODEM':util['format'](_0x191b('0xb'),_0x149d89[_0x191b('0xc')]),'XMF-GATEWAY':_0x149d89[_0x191b('0xd')],'XMF-FAXDETECT':_0x149d89[_0x191b('0xe')],'XMF-T38TIMEOUT':_0x149d89['t38timeout'],'XMF-LOCALSTATIONID':_0x149d89['localstationid'],'XMF-PATH':_0x25c4a6[_0x191b('0xf')]};return _0x433fd1;};exports['variablesAction']=function(_0x137799,_0x56a17c){return{'actionid':_0x137799[_0x191b('0x10')],'action':'originate','channel':_0x137799[_0x191b('0x11')],'Exten':_0x191b('0x12'),'Context':_0x191b('0x13'),'Priority':'1','callerid':util[_0x191b('0x14')](_0x191b('0x15'),_0x137799['headerinfo']?_0x137799[_0x191b('0x8')]:'',_0x137799[_0x191b('0x16')]),'variable':_0x56a17c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x137799[_0x191b('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 76d9534..daca09f 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 _0x2c57=['./rpc/integrations/vtiger','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','then','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','resolve','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','listen','sync','[index.js][main]','bluebird','util','moment','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk'];(function(_0x354fc5,_0x533fd4){var _0x2c24aa=function(_0x4b8a55){while(--_0x4b8a55){_0x354fc5['push'](_0x354fc5['shift']());}};_0x2c24aa(++_0x533fd4);}(_0x2c57,0xc7));var _0x72c5=function(_0x50aa13,_0x259928){_0x50aa13=_0x50aa13-0x0;var _0x342271=_0x2c57[_0x50aa13];return _0x342271;};'use strict';var BPromise=require(_0x72c5('0x0'));var util=require(_0x72c5('0x1'));var moment=require(_0x72c5('0x2'));var server=require('./server');var Realtime=require(_0x72c5('0x3'));var Report=require('./report');var Acw=require(_0x72c5('0x4'));var Trigger=require(_0x72c5('0x5'));var Dialer=require(_0x72c5('0x6'));var Preview=require(_0x72c5('0x7'));var Fax=require(_0x72c5('0x8'));var user=require(_0x72c5('0x9'));var voiceQueue=require(_0x72c5('0xa'));var voiceQueueReport=require(_0x72c5('0xb'));var voiceCallReport=require(_0x72c5('0xc'));var trunk=require('./rpc/trunk');var trigger=require(_0x72c5('0xd'));var template=require(_0x72c5('0xe'));var cmHopperHistory=require(_0x72c5('0xf'));var campaign=require(_0x72c5('0x10'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x72c5('0x11'));var zendesk=require(_0x72c5('0x12'));var salesforce=require(_0x72c5('0x13'));var sugarcrm=require(_0x72c5('0x14'));var freshdesk=require(_0x72c5('0x15'));var desk=require(_0x72c5('0x16'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x72c5('0x17'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x72c5('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x72c5('0x19'))(_0x72c5('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x72c5('0x1b')](_0x72c5('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x72c5('0x1b')](_0x72c5('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x72c5('0x1d')](user['getAgents']())['then'](realtime['initAgents']())[_0x72c5('0x1d')](user[_0x72c5('0x1e')]())['then'](realtime[_0x72c5('0x1f')]())[_0x72c5('0x1d')](trunk[_0x72c5('0x20')]())['then'](realtime['initTrunks']())[_0x72c5('0x1d')](voiceQueue[_0x72c5('0x21')]())['then'](realtime[_0x72c5('0x22')]())['then'](trigger[_0x72c5('0x23')]())['then'](realtime[_0x72c5('0x24')]())['then'](template[_0x72c5('0x25')]())[_0x72c5('0x1d')](realtime[_0x72c5('0x26')]())[_0x72c5('0x1d')](zendesk[_0x72c5('0x27')]())[_0x72c5('0x1d')](realtime[_0x72c5('0x28')]())[_0x72c5('0x1d')](salesforce[_0x72c5('0x29')]())['then'](realtime[_0x72c5('0x2a')]())[_0x72c5('0x1d')](sugarcrm[_0x72c5('0x2b')]())[_0x72c5('0x1d')](realtime[_0x72c5('0x2c')]())['then'](freshdesk[_0x72c5('0x2d')]())[_0x72c5('0x1d')](realtime['initFreshdeskAccounts']())[_0x72c5('0x1d')](desk[_0x72c5('0x2e')]())[_0x72c5('0x1d')](realtime[_0x72c5('0x2f')]())['then'](zoho[_0x72c5('0x30')]())['then'](realtime[_0x72c5('0x31')]())[_0x72c5('0x1d')](vtiger[_0x72c5('0x32')]())['then'](realtime[_0x72c5('0x33')]())[_0x72c5('0x1d')](freshsales[_0x72c5('0x34')]())['then'](realtime[_0x72c5('0x35')]())[_0x72c5('0x1d')](servicenow[_0x72c5('0x36')]())[_0x72c5('0x1d')](realtime[_0x72c5('0x37')]())['then'](dynamics365[_0x72c5('0x38')]())[_0x72c5('0x1d')](realtime[_0x72c5('0x39')]())[_0x72c5('0x1d')](campaign[_0x72c5('0x3a')]())['then'](realtime[_0x72c5('0x3b')]())[_0x72c5('0x1d')](voiceExtension['getVoiceExtensions']())[_0x72c5('0x1d')](realtime['initVoiceExtensions']())[_0x72c5('0x1d')](faxAccount[_0x72c5('0x3c')]())[_0x72c5('0x1d')](realtime['initFaxAccounts']())[_0x72c5('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x72c5('0x3d')]()[_0x72c5('0x1d')](voiceQueueReport[_0x72c5('0x3e')]())[_0x72c5('0x1d')](realtime['initVoiceQueueReports']())[_0x72c5('0x1d')](cmHopperHistory[_0x72c5('0x3f')]())[_0x72c5('0x1d')](realtime[_0x72c5('0x40')]())[_0x72c5('0x1d')](cmHopperHistory[_0x72c5('0x41')]())[_0x72c5('0x1d')](realtime[_0x72c5('0x42')]())['then'](voiceCallReport[_0x72c5('0x43')]())[_0x72c5('0x1d')](realtime[_0x72c5('0x44')]())[_0x72c5('0x45')](function(_0x107e23){logger[_0x72c5('0x46')]('[index.js][initParams]',util['inspect'](_0x107e23,{'showHidden':![],'depth':null}));});}function main(){return server[_0x72c5('0x47')](realtime,preview,fax)[_0x72c5('0x1d')](function(_0x3008b2){return initRealtime();})[_0x72c5('0x1d')](function(){return initParams();})[_0x72c5('0x1d')](function(){report[_0x72c5('0x48')]();setInterval(initRealtime,0x1388);})[_0x72c5('0x45')](function(_0x5c62ff){logger[_0x72c5('0x46')](_0x72c5('0x49'),util['inspect'](_0x5c62ff,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x0737=['getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','catch','error','inspect','listen','sync','[index.js][main]','bluebird','util','moment','./server','./realtime','./acw','./dialer','./rpc/user','./rpc/voiceCallReport','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','getZendeskAccounts','initZendeskAccounts'];(function(_0x545e91,_0x23a607){var _0x2f7416=function(_0x230c88){while(--_0x230c88){_0x545e91['push'](_0x545e91['shift']());}};_0x2f7416(++_0x23a607);}(_0x0737,0x116));var _0x7073=function(_0x1a66a5,_0x1707ab){_0x1a66a5=_0x1a66a5-0x0;var _0xd77949=_0x0737[_0x1a66a5];return _0xd77949;};'use strict';var BPromise=require(_0x7073('0x0'));var util=require(_0x7073('0x1'));var moment=require(_0x7073('0x2'));var server=require(_0x7073('0x3'));var Realtime=require(_0x7073('0x4'));var Report=require('./report');var Acw=require(_0x7073('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x7073('0x6'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x7073('0x7'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x7073('0x8'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x7073('0x9'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x7073('0xa'));var voiceExtension=require(_0x7073('0xb'));var faxAccount=require(_0x7073('0xc'));var zendesk=require(_0x7073('0xd'));var salesforce=require(_0x7073('0xe'));var sugarcrm=require(_0x7073('0xf'));var freshdesk=require(_0x7073('0x10'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x7073('0x11'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x7073('0x12'));var dynamics365=require(_0x7073('0x13'));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(_0x7073('0x14'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x7073('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x7073('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x7073('0x16')]()[_0x7073('0x17')](user[_0x7073('0x18')]())['then'](realtime[_0x7073('0x19')]())[_0x7073('0x17')](user[_0x7073('0x1a')]())[_0x7073('0x17')](realtime[_0x7073('0x1b')]())['then'](trunk['getTrunks']())[_0x7073('0x17')](realtime[_0x7073('0x1c')]())['then'](voiceQueue[_0x7073('0x1d')]())['then'](realtime['initVoiceQueues']())[_0x7073('0x17')](trigger['getTriggers']())['then'](realtime['initTriggers']())[_0x7073('0x17')](template['getTemplates']())[_0x7073('0x17')](realtime['initTemplates']())['then'](zendesk[_0x7073('0x1e')]())[_0x7073('0x17')](realtime[_0x7073('0x1f')]())[_0x7073('0x17')](salesforce[_0x7073('0x20')]())[_0x7073('0x17')](realtime[_0x7073('0x21')]())[_0x7073('0x17')](sugarcrm[_0x7073('0x22')]())[_0x7073('0x17')](realtime[_0x7073('0x23')]())[_0x7073('0x17')](freshdesk[_0x7073('0x24')]())[_0x7073('0x17')](realtime[_0x7073('0x25')]())[_0x7073('0x17')](desk[_0x7073('0x26')]())[_0x7073('0x17')](realtime[_0x7073('0x27')]())[_0x7073('0x17')](zoho[_0x7073('0x28')]())[_0x7073('0x17')](realtime[_0x7073('0x29')]())['then'](vtiger[_0x7073('0x2a')]())[_0x7073('0x17')](realtime['initVtigerAccounts']())[_0x7073('0x17')](freshsales[_0x7073('0x2b')]())[_0x7073('0x17')](realtime['initFreshsalesAccounts']())['then'](servicenow[_0x7073('0x2c')]())[_0x7073('0x17')](realtime[_0x7073('0x2d')]())[_0x7073('0x17')](dynamics365['getDynamics365Accounts']())[_0x7073('0x17')](realtime[_0x7073('0x2e')]())[_0x7073('0x17')](campaign[_0x7073('0x2f')]())[_0x7073('0x17')](realtime[_0x7073('0x30')]())[_0x7073('0x17')](voiceExtension[_0x7073('0x31')]())[_0x7073('0x17')](realtime['initVoiceExtensions']())[_0x7073('0x17')](faxAccount[_0x7073('0x32')]())[_0x7073('0x17')](realtime['initFaxAccounts']())[_0x7073('0x17')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x7073('0x17')](voiceQueueReport[_0x7073('0x33')]())['then'](realtime[_0x7073('0x34')]())['then'](cmHopperHistory[_0x7073('0x35')]())[_0x7073('0x17')](realtime[_0x7073('0x36')]())['then'](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime['initCampaignHopperHistory']())[_0x7073('0x17')](voiceCallReport[_0x7073('0x37')]())[_0x7073('0x17')](realtime['initVoiceCallReports']())[_0x7073('0x38')](function(_0x4fbbc4){logger[_0x7073('0x39')]('[index.js][initParams]',util[_0x7073('0x3a')](_0x4fbbc4,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7073('0x3b')](realtime,preview,fax)['then'](function(_0x1403af){return initRealtime();})[_0x7073('0x17')](function(){return initParams();})[_0x7073('0x17')](function(){report[_0x7073('0x3c')]();setInterval(initRealtime,0x1388);})[_0x7073('0x38')](function(_0x5c86dd){logger[_0x7073('0x39')](_0x7073('0x3d'),util[_0x7073('0x3a')](_0x5c86dd,{'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 7342f30..b1af4dc 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 _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x3b4ac6,_0x528f99){var _0x89d970=function(_0x3fbdb3){while(--_0x3fbdb3){_0x3b4ac6['push'](_0x3b4ac6['shift']());}};_0x89d970(++_0x528f99);}(_0xe706,0xa3));var _0x6e70=function(_0x49536b,_0x2abe5d){_0x49536b=_0x49536b-0x0;var _0x30de59=_0xe706[_0x49536b];return _0x30de59;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file +var _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xedd9,0xfc));var _0x9edd=function(_0x1e48b6,_0x3eb69e){_0x1e48b6=_0x1e48b6-0x0;var _0x5e10af=_0xedd9[_0x1e48b6];return _0x5e10af;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('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 fc4df1b..69c6a36 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 _0xd9b5=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd9b5,0xe8));var _0x5d9b=function(_0x9d73e2,_0x2cb5d6){_0x9d73e2=_0x9d73e2-0x0;var _0x2674c6=_0xd9b5[_0x9d73e2];return _0x2674c6;};'use strict';function Campaign(_0x24c4e1){this['id']=_0x24c4e1['id']||0x0;this[_0x5d9b('0x0')]=_0x24c4e1[_0x5d9b('0x0')]||'';this[_0x5d9b('0x1')]=_0x24c4e1['type']||_0x5d9b('0x2');this[_0x5d9b('0x3')]=0x0;this[_0x5d9b('0x4')]=0x0;this[_0x5d9b('0x5')]=0x0;this[_0x5d9b('0x6')]=0x0;this[_0x5d9b('0x7')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x24c4e1[_0x5d9b('0x8')];this[_0x5d9b('0x9')]=_0x24c4e1[_0x5d9b('0x9')];this[_0x5d9b('0xa')]=_0x24c4e1['dialTimezone']||null;this[_0x5d9b('0xb')]=_0x24c4e1[_0x5d9b('0xb')]?_0x24c4e1['dialGlobalInterval']:null;this[_0x5d9b('0xc')]=_0x24c4e1['dialOriginateCallerIdName'];this[_0x5d9b('0xd')]=_0x24c4e1[_0x5d9b('0xd')];this['dialOriginateTimeout']=_0x24c4e1[_0x5d9b('0xe')]||0x1e;this[_0x5d9b('0xf')]=_0x24c4e1[_0x5d9b('0xf')];this[_0x5d9b('0x10')]=_0x24c4e1[_0x5d9b('0x10')];this[_0x5d9b('0x11')]=_0x24c4e1[_0x5d9b('0x11')];this[_0x5d9b('0x12')]=_0x24c4e1[_0x5d9b('0x12')];this[_0x5d9b('0x13')]=_0x24c4e1['dialNoAnswerMaxRetry'];this[_0x5d9b('0x14')]=_0x24c4e1[_0x5d9b('0x14')];this[_0x5d9b('0x15')]=_0x24c4e1[_0x5d9b('0x15')];this[_0x5d9b('0x16')]=_0x24c4e1[_0x5d9b('0x16')]||0x3;this[_0x5d9b('0x17')]=_0x24c4e1['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x24c4e1['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x24c4e1[_0x5d9b('0x18')]||0x96;this[_0x5d9b('0x19')]=_0x24c4e1[_0x5d9b('0x19')]||0x3;this[_0x5d9b('0x1a')]=_0x24c4e1['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x24c4e1[_0x5d9b('0x1b')]||0x3;this['dialMachineRetryFrequency']=_0x24c4e1['dialMachineRetryFrequency']||0x96;this[_0x5d9b('0x1c')]=_0x24c4e1[_0x5d9b('0x1c')]||0x3;this[_0x5d9b('0x1d')]=_0x24c4e1[_0x5d9b('0x1d')]||0x96;this[_0x5d9b('0x1e')]=_0x24c4e1[_0x5d9b('0x1e')]||_0x5d9b('0x1f');this[_0x5d9b('0x20')]=_0x24c4e1['dialPrefix']||undefined;this[_0x5d9b('0x21')]=_0x24c4e1['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x5d9b('0x22')]=_0x24c4e1[_0x5d9b('0x22')]||undefined;this['TrunkBackup']=_0x24c4e1[_0x5d9b('0x23')]?_0x24c4e1['TrunkBackup']:undefined;this[_0x5d9b('0x24')]=_0x24c4e1[_0x5d9b('0x24')]?_0x24c4e1[_0x5d9b('0x24')]:undefined;this[_0x5d9b('0x25')]=_0x24c4e1[_0x5d9b('0x25')]?_0x24c4e1['Interval']:undefined;this['SquareProject']=_0x24c4e1['SquareProject']?_0x24c4e1[_0x5d9b('0x26')]:undefined;this[_0x5d9b('0x27')]=_0x24c4e1[_0x5d9b('0x26')]?_0x24c4e1[_0x5d9b('0x26')][_0x5d9b('0x0')]:undefined;this[_0x5d9b('0x28')]=_0x24c4e1[_0x5d9b('0x28')]||![];this[_0x5d9b('0x29')]=_0x24c4e1[_0x5d9b('0x29')];this[_0x5d9b('0x2a')]=_0x24c4e1['dialAMDGreeting'];this[_0x5d9b('0x2b')]=_0x24c4e1['dialAMDAfterGreetingSilence'];this[_0x5d9b('0x2c')]=_0x24c4e1[_0x5d9b('0x2c')];this[_0x5d9b('0x2d')]=_0x24c4e1[_0x5d9b('0x2d')];this[_0x5d9b('0x2e')]=_0x24c4e1[_0x5d9b('0x2e')];this[_0x5d9b('0x2f')]=_0x24c4e1[_0x5d9b('0x2f')];this[_0x5d9b('0x30')]=_0x24c4e1[_0x5d9b('0x30')];this[_0x5d9b('0x31')]=_0x24c4e1[_0x5d9b('0x31')];}module['exports']=Campaign; \ No newline at end of file +var _0x42d1=['temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign'];(function(_0x1ee369,_0x4a5682){var _0x4cef65=function(_0xdc99bc){while(--_0xdc99bc){_0x1ee369['push'](_0x1ee369['shift']());}};_0x4cef65(++_0x4a5682);}(_0x42d1,0x195));var _0x142d=function(_0x493ad9,_0x509bef){_0x493ad9=_0x493ad9-0x0;var _0x42d50f=_0x42d1[_0x493ad9];return _0x42d50f;};'use strict';function Campaign(_0x401cb1){this['id']=_0x401cb1['id']||0x0;this[_0x142d('0x0')]=_0x401cb1[_0x142d('0x0')]||'';this[_0x142d('0x1')]=_0x401cb1['type']||_0x142d('0x2');this['originated']=0x0;this[_0x142d('0x3')]=0x0;this[_0x142d('0x4')]=0x0;this[_0x142d('0x5')]=0x0;this[_0x142d('0x6')]='';this[_0x142d('0x7')]=!![];this['active']=_0x401cb1[_0x142d('0x8')];this[_0x142d('0x9')]=_0x401cb1[_0x142d('0x9')];this['dialTimezone']=_0x401cb1['dialTimezone']||null;this[_0x142d('0xa')]=_0x401cb1[_0x142d('0xa')]?_0x401cb1['dialGlobalInterval']:null;this[_0x142d('0xb')]=_0x401cb1[_0x142d('0xb')];this[_0x142d('0xc')]=_0x401cb1['dialOriginateCallerIdNumber'];this[_0x142d('0xd')]=_0x401cb1[_0x142d('0xd')]||0x1e;this[_0x142d('0xe')]=_0x401cb1['dialCongestionMaxRetry'];this[_0x142d('0xf')]=_0x401cb1['dialCongestionRetryFrequency'];this[_0x142d('0x10')]=_0x401cb1[_0x142d('0x10')];this['dialBusyRetryFrequency']=_0x401cb1[_0x142d('0x11')];this[_0x142d('0x12')]=_0x401cb1[_0x142d('0x12')];this[_0x142d('0x13')]=_0x401cb1[_0x142d('0x13')];this[_0x142d('0x14')]=_0x401cb1[_0x142d('0x14')];this[_0x142d('0x15')]=_0x401cb1[_0x142d('0x15')]||0x3;this[_0x142d('0x16')]=_0x401cb1['dialNoSuchNumberRetryFrequency']||0x96;this[_0x142d('0x17')]=_0x401cb1[_0x142d('0x17')]||0x3;this['dialDropRetryFrequency']=_0x401cb1[_0x142d('0x18')]||0x96;this[_0x142d('0x19')]=_0x401cb1[_0x142d('0x19')]||0x3;this[_0x142d('0x1a')]=_0x401cb1['dialAbandonedRetryFrequency']||0x96;this[_0x142d('0x1b')]=_0x401cb1['dialMachineMaxRetry']||0x3;this[_0x142d('0x1c')]=_0x401cb1[_0x142d('0x1c')]||0x96;this[_0x142d('0x1d')]=_0x401cb1[_0x142d('0x1d')]||0x3;this[_0x142d('0x1e')]=_0x401cb1['dialAgentRejectRetryFrequency']||0x96;this[_0x142d('0x1f')]=_0x401cb1[_0x142d('0x1f')]||_0x142d('0x20');this[_0x142d('0x21')]=_0x401cb1[_0x142d('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x401cb1[_0x142d('0x22')]||undefined;this[_0x142d('0x23')]=_0x401cb1['dialCutDigit']||undefined;this[_0x142d('0x24')]=_0x401cb1[_0x142d('0x24')]?_0x401cb1[_0x142d('0x24')]:undefined;this[_0x142d('0x25')]=_0x401cb1[_0x142d('0x25')]?_0x401cb1['Trunk']:undefined;this[_0x142d('0x26')]=_0x401cb1[_0x142d('0x26')]?_0x401cb1['Interval']:undefined;this[_0x142d('0x27')]=_0x401cb1[_0x142d('0x27')]?_0x401cb1[_0x142d('0x27')]:undefined;this['dialQueueProject']=_0x401cb1['SquareProject']?_0x401cb1[_0x142d('0x27')][_0x142d('0x0')]:undefined;this[_0x142d('0x28')]=_0x401cb1['dialAMDActive']||![];this[_0x142d('0x29')]=_0x401cb1[_0x142d('0x29')];this[_0x142d('0x2a')]=_0x401cb1[_0x142d('0x2a')];this[_0x142d('0x2b')]=_0x401cb1['dialAMDAfterGreetingSilence'];this[_0x142d('0x2c')]=_0x401cb1[_0x142d('0x2c')];this[_0x142d('0x2d')]=_0x401cb1[_0x142d('0x2d')];this[_0x142d('0x2e')]=_0x401cb1['dialAMDBetweenWordsSilence'];this[_0x142d('0x2f')]=_0x401cb1[_0x142d('0x2f')];this[_0x142d('0x30')]=_0x401cb1[_0x142d('0x30')];this[_0x142d('0x31')]=_0x401cb1[_0x142d('0x31')];}module[_0x142d('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index a9c2752..24fe491 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 _0xfa4d=['abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','disposition','monitor','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','calleridnum','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged'];(function(_0x5139bb,_0x3fb5f4){var _0x306e2a=function(_0x3b6036){while(--_0x3b6036){_0x5139bb['push'](_0x5139bb['shift']());}};_0x306e2a(++_0x3fb5f4);}(_0xfa4d,0x90));var _0xdfa4=function(_0x80c6ed,_0x2187ee){_0x80c6ed=_0x80c6ed-0x0;var _0x5052bc=_0xfa4d[_0x80c6ed];return _0x5052bc;};'use strict';function Channel(){this[_0xdfa4('0x0')]=null;this[_0xdfa4('0x1')]='';this['destinationchannel']='';this[_0xdfa4('0x2')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0xdfa4('0x3')]=0x0;this[_0xdfa4('0x4')]='';this[_0xdfa4('0x5')]=0x0;this[_0xdfa4('0x6')]=0x0;this[_0xdfa4('0x7')]=0x0;this[_0xdfa4('0x8')]=![];this[_0xdfa4('0x9')]=null;this[_0xdfa4('0xa')]=null;this[_0xdfa4('0xb')]=![];this[_0xdfa4('0xc')]=![];this[_0xdfa4('0xd')]='';this[_0xdfa4('0xe')]='';this[_0xdfa4('0xf')]=0x0;this[_0xdfa4('0x10')]=0x0;this[_0xdfa4('0x11')]=0x0;this['type']=null;this['tag']=null;this[_0xdfa4('0x12')]=null;this[_0xdfa4('0x13')]=![];this['monitorFilename']=null;this[_0xdfa4('0x14')]=null;this['monitors']=[];this[_0xdfa4('0x15')]=undefined;this[_0xdfa4('0x16')]=undefined;this[_0xdfa4('0x17')]=undefined;this[_0xdfa4('0x18')]=0x0;}module[_0xdfa4('0x19')]=Channel; \ No newline at end of file +var _0xb78e=['monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitor'];(function(_0x2106b8,_0x4e4888){var _0x217b0b=function(_0x263d75){while(--_0x263d75){_0x2106b8['push'](_0x2106b8['shift']());}};_0x217b0b(++_0x4e4888);}(_0xb78e,0x1c9));var _0xeb78=function(_0x527bb4,_0x2d0a8d){_0x527bb4=_0x527bb4-0x0;var _0x3b3c65=_0xb78e[_0x527bb4];return _0x3b3c65;};'use strict';function Channel(){this[_0xeb78('0x0')]=null;this[_0xeb78('0x1')]='';this['destinationchannel']='';this[_0xeb78('0x2')]=0x0;this[_0xeb78('0x3')]='';this[_0xeb78('0x4')]=undefined;this[_0xeb78('0x5')]=undefined;this[_0xeb78('0x6')]=0x0;this[_0xeb78('0x7')]='';this[_0xeb78('0x8')]=0x0;this[_0xeb78('0x9')]=0x0;this['exten']=0x0;this[_0xeb78('0xa')]=![];this[_0xeb78('0xb')]=null;this[_0xeb78('0xc')]=null;this[_0xeb78('0xd')]=![];this[_0xeb78('0xe')]=![];this[_0xeb78('0xf')]='';this[_0xeb78('0x10')]='';this['duration']=0x0;this[_0xeb78('0x11')]=0x0;this[_0xeb78('0x12')]=0x0;this[_0xeb78('0x13')]=null;this[_0xeb78('0x14')]=null;this[_0xeb78('0x15')]=null;this[_0xeb78('0x16')]=![];this[_0xeb78('0x17')]=null;this[_0xeb78('0x18')]=null;this[_0xeb78('0x19')]=[];this['transfercalleridnum']=undefined;this[_0xeb78('0x1a')]=undefined;this[_0xeb78('0x1b')]=undefined;this[_0xeb78('0x1c')]=0x0;}module[_0xeb78('0x1d')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 4f29a34..0b6652d 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 _0xbf9b=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x57deb6,_0x478ded){var _0x32b7f7=function(_0x33b996){while(--_0x33b996){_0x57deb6['push'](_0x57deb6['shift']());}};_0x32b7f7(++_0x478ded);}(_0xbf9b,0x12f));var _0xbbf9=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xbf9b[_0x4709c0];return _0x13348b;};'use strict';function DeskAccount(_0x5bd2ec){this['id']=_0x5bd2ec['id']||0x0;this[_0xbbf9('0x0')]=_0x5bd2ec[_0xbbf9('0x0')]||'';this[_0xbbf9('0x1')]=_0x5bd2ec[_0xbbf9('0x1')]||'';this['remoteUri']=_0x5bd2ec[_0xbbf9('0x2')]||'';this[_0xbbf9('0x3')]=_0x5bd2ec[_0xbbf9('0x3')]||'';this[_0xbbf9('0x4')]=_0x5bd2ec['password']||'';this[_0xbbf9('0x5')]=_0x5bd2ec[_0xbbf9('0x5')]||'';this['consumerSecret']=_0x5bd2ec[_0xbbf9('0x6')]||'';this[_0xbbf9('0x7')]=_0x5bd2ec[_0xbbf9('0x7')]||'';this[_0xbbf9('0x8')]=_0x5bd2ec[_0xbbf9('0x8')]||'';this[_0xbbf9('0x9')]=_0x5bd2ec[_0xbbf9('0x9')]||'';this[_0xbbf9('0xa')]=_0x5bd2ec[_0xbbf9('0xa')]||'';this['Configurations']=_0x5bd2ec[_0xbbf9('0xb')]||{};}module[_0xbbf9('0xc')]=DeskAccount; \ No newline at end of file +var _0x5cee=['serverUrl','Configurations','name','username','remoteUri','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x589989,_0x2cfd1f){var _0x50584f=function(_0x22ec4c){while(--_0x22ec4c){_0x589989['push'](_0x589989['shift']());}};_0x50584f(++_0x2cfd1f);}(_0x5cee,0x66));var _0xe5ce=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x5cee[_0x4792c8];return _0x35edb1;};'use strict';function DeskAccount(_0x194bb2){this['id']=_0x194bb2['id']||0x0;this[_0xe5ce('0x0')]=_0x194bb2[_0xe5ce('0x0')]||'';this[_0xe5ce('0x1')]=_0x194bb2[_0xe5ce('0x1')]||'';this[_0xe5ce('0x2')]=_0x194bb2[_0xe5ce('0x2')]||'';this['authType']=_0x194bb2['authType']||'';this['password']=_0x194bb2['password']||'';this[_0xe5ce('0x3')]=_0x194bb2[_0xe5ce('0x3')]||'';this[_0xe5ce('0x4')]=_0x194bb2[_0xe5ce('0x4')]||'';this[_0xe5ce('0x5')]=_0x194bb2[_0xe5ce('0x5')]||'';this['tokenSecret']=_0x194bb2[_0xe5ce('0x6')]||'';this[_0xe5ce('0x7')]=_0x194bb2[_0xe5ce('0x7')]||'';this[_0xe5ce('0x8')]=_0x194bb2[_0xe5ce('0x8')]||'';this[_0xe5ce('0x9')]=_0x194bb2[_0xe5ce('0x9')]||{};}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 3d9cf10..36d5c7a 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 _0xcb5f=['clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','username','password','remoteUri','tenantId','clientId'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xcb5f,0x1db));var _0xfcb5=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcb5f[_0x19950b];return _0x3c6b41;};'use strict';function Dynamics365Account(_0x6d2083){this['id']=_0x6d2083['id']||0x0;this['name']=_0x6d2083['name']||'';this[_0xfcb5('0x0')]=_0x6d2083[_0xfcb5('0x0')]||'';this['password']=_0x6d2083[_0xfcb5('0x1')]||'';this[_0xfcb5('0x2')]=_0x6d2083[_0xfcb5('0x2')]||'';this[_0xfcb5('0x3')]=_0x6d2083[_0xfcb5('0x3')]||'';this['clientId']=_0x6d2083[_0xfcb5('0x4')]||'';this[_0xfcb5('0x5')]=_0x6d2083['clientSecret']||{};this[_0xfcb5('0x6')]=_0x6d2083[_0xfcb5('0x6')]||'';this[_0xfcb5('0x7')]=_0x6d2083[_0xfcb5('0x7')]||![];this['Configurations']=_0x6d2083[_0xfcb5('0x8')]||{};this[_0xfcb5('0x9')]=_0x6d2083[_0xfcb5('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xb51e=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x27a9c1,_0x1c09e4){var _0x398dae=function(_0x169792){while(--_0x169792){_0x27a9c1['push'](_0x27a9c1['shift']());}};_0x398dae(++_0x1c09e4);}(_0xb51e,0x85));var _0xeb51=function(_0x2c5b0e,_0x4af7b7){_0x2c5b0e=_0x2c5b0e-0x0;var _0x26f777=_0xb51e[_0x2c5b0e];return _0x26f777;};'use strict';function Dynamics365Account(_0x1961c4){this['id']=_0x1961c4['id']||0x0;this['name']=_0x1961c4[_0xeb51('0x0')]||'';this[_0xeb51('0x1')]=_0x1961c4[_0xeb51('0x1')]||'';this[_0xeb51('0x2')]=_0x1961c4[_0xeb51('0x2')]||'';this[_0xeb51('0x3')]=_0x1961c4[_0xeb51('0x3')]||'';this[_0xeb51('0x4')]=_0x1961c4[_0xeb51('0x4')]||'';this[_0xeb51('0x5')]=_0x1961c4['clientId']||'';this[_0xeb51('0x6')]=_0x1961c4[_0xeb51('0x6')]||{};this[_0xeb51('0x7')]=_0x1961c4[_0xeb51('0x7')]||'';this[_0xeb51('0x8')]=_0x1961c4[_0xeb51('0x8')]||![];this[_0xeb51('0x9')]=_0x1961c4[_0xeb51('0x9')]||{};this[_0xeb51('0xa')]=_0x1961c4[_0xeb51('0xa')]||{};}module[_0xeb51('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 29a1148..758f043 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 _0x070c=['ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x11f0a6,_0x1ce59d){var _0xa5ab4b=function(_0x42fd28){while(--_0x42fd28){_0x11f0a6['push'](_0x11f0a6['shift']());}};_0xa5ab4b(++_0x1ce59d);}(_0x070c,0x145));var _0xc070=function(_0x485d2e,_0x47330a){_0x485d2e=_0x485d2e-0x0;var _0x566c5a=_0x070c[_0x485d2e];return _0x566c5a;};'use strict';function FaxAccount(_0x55b624){this['id']=_0x55b624['id']||0x0;this[_0xc070('0x0')]=_0x55b624[_0xc070('0x0')]||'';this[_0xc070('0x1')]=_0x55b624[_0xc070('0x1')];this[_0xc070('0x2')]=_0x55b624[_0xc070('0x2')];this[_0xc070('0x3')]=_0x55b624[_0xc070('0x3')];this['localstationid']=_0x55b624[_0xc070('0x4')];this[_0xc070('0x5')]=_0x55b624['minrate']||0x960;this[_0xc070('0x6')]=_0x55b624['maxrate']||0x3840;this[_0xc070('0x7')]=_0x55b624[_0xc070('0x7')]||_0xc070('0x8');this[_0xc070('0x9')]=_0x55b624['gateway']||'no';this[_0xc070('0xa')]=_0x55b624['faxdetect']||'no';this[_0xc070('0xb')]=_0x55b624[_0xc070('0xb')]||0x1388;this[_0xc070('0xc')]=_0x55b624[_0xc070('0xc')]||_0xc070('0xd');this[_0xc070('0xe')]=_0x55b624['Trunk']?_0x55b624[_0xc070('0xe')]:undefined;this[_0xc070('0xf')]=_0x55b624[_0xc070('0xf')];this[_0xc070('0x10')]=_0x55b624[_0xc070('0x10')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x3477=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech'];(function(_0x550cb6,_0x12a9fa){var _0x23209e=function(_0x407b42){while(--_0x407b42){_0x550cb6['push'](_0x550cb6['shift']());}};_0x23209e(++_0x12a9fa);}(_0x3477,0xb9));var _0x7347=function(_0x22148e,_0x49ee91){_0x22148e=_0x22148e-0x0;var _0x510b72=_0x3477[_0x22148e];return _0x510b72;};'use strict';function FaxAccount(_0x2fe0c3){this['id']=_0x2fe0c3['id']||0x0;this[_0x7347('0x0')]=_0x2fe0c3[_0x7347('0x0')]||'';this[_0x7347('0x1')]=_0x2fe0c3[_0x7347('0x1')];this[_0x7347('0x2')]=_0x2fe0c3[_0x7347('0x2')];this[_0x7347('0x3')]=_0x2fe0c3[_0x7347('0x3')];this['localstationid']=_0x2fe0c3[_0x7347('0x4')];this['minrate']=_0x2fe0c3[_0x7347('0x5')]||0x960;this[_0x7347('0x6')]=_0x2fe0c3['maxrate']||0x3840;this['modem']=_0x2fe0c3[_0x7347('0x7')]||_0x7347('0x8');this['gateway']=_0x2fe0c3[_0x7347('0x9')]||'no';this[_0x7347('0xa')]=_0x2fe0c3[_0x7347('0xa')]||'no';this[_0x7347('0xb')]=_0x2fe0c3[_0x7347('0xb')]||0x1388;this[_0x7347('0xc')]=_0x2fe0c3[_0x7347('0xc')]||_0x7347('0xd');this[_0x7347('0xe')]=_0x2fe0c3[_0x7347('0xe')]?_0x2fe0c3['Trunk']:undefined;this[_0x7347('0xf')]=_0x2fe0c3[_0x7347('0xf')];this['key']=_0x2fe0c3[_0x7347('0x10')];}module[_0x7347('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index f508fb3..3f0af97 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 _0x262a=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x5de1cb,_0x581a64){var _0x18104b=function(_0x4ed056){while(--_0x4ed056){_0x5de1cb['push'](_0x5de1cb['shift']());}};_0x18104b(++_0x581a64);}(_0x262a,0x1c7));var _0xa262=function(_0x25280c,_0x2edec1){_0x25280c=_0x25280c-0x0;var _0x3a58c3=_0x262a[_0x25280c];return _0x3a58c3;};'use strict';function FreshdeskAccount(_0x9c901b){this['id']=_0x9c901b['id']||0x0;this[_0xa262('0x0')]=_0x9c901b[_0xa262('0x0')]||'';this[_0xa262('0x1')]=_0x9c901b[_0xa262('0x1')]||'';this[_0xa262('0x2')]=_0x9c901b[_0xa262('0x3')]||'';this['remoteUri']=_0x9c901b[_0xa262('0x4')]||'';this[_0xa262('0x5')]=_0x9c901b[_0xa262('0x5')]||'';this['Configurations']=_0x9c901b[_0xa262('0x6')]||{};}module[_0xa262('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x0475=['name','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x0475,0xd8));var _0x5047=function(_0x329e44,_0x2bec9b){_0x329e44=_0x329e44-0x0;var _0xe0eaac=_0x0475[_0x329e44];return _0xe0eaac;};'use strict';function FreshdeskAccount(_0x3e571a){this['id']=_0x3e571a['id']||0x0;this['name']=_0x3e571a[_0x5047('0x0')]||'';this['username']=_0x3e571a['username']||'';this[_0x5047('0x1')]=_0x3e571a[_0x5047('0x2')]||'';this[_0x5047('0x3')]=_0x3e571a[_0x5047('0x3')]||'';this[_0x5047('0x4')]=_0x3e571a[_0x5047('0x4')]||'';this['Configurations']=_0x3e571a[_0x5047('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 8bd3386..ab3c6b8 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 _0x96e0=['name','apiKey','token','remoteUri','Configurations','exports'];(function(_0x12479d,_0x484779){var _0x3b967e=function(_0x47a663){while(--_0x47a663){_0x12479d['push'](_0x12479d['shift']());}};_0x3b967e(++_0x484779);}(_0x96e0,0x7e));var _0x096e=function(_0x24e02f,_0x598c48){_0x24e02f=_0x24e02f-0x0;var _0x1a7004=_0x96e0[_0x24e02f];return _0x1a7004;};'use strict';function FreshsalesAccount(_0x27fe90){this['id']=_0x27fe90['id']||0x0;this['name']=_0x27fe90[_0x096e('0x0')]||'';this['username']=_0x27fe90['username']||'';this[_0x096e('0x1')]=_0x27fe90[_0x096e('0x2')]||'';this[_0x096e('0x3')]=_0x27fe90[_0x096e('0x3')]||'';this['serverUrl']=_0x27fe90['serverUrl']||'';this['Configurations']=_0x27fe90[_0x096e('0x4')]||{};}module[_0x096e('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x6b4e=['remoteUri','serverUrl','Configurations','exports','name','token'];(function(_0x10f9a0,_0x35b4a0){var _0x72095=function(_0x4fde66){while(--_0x4fde66){_0x10f9a0['push'](_0x10f9a0['shift']());}};_0x72095(++_0x35b4a0);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x3a5fa8,_0x211ed6){_0x3a5fa8=_0x3a5fa8-0x0;var _0x175519=_0x6b4e[_0x3a5fa8];return _0x175519;};'use strict';function FreshsalesAccount(_0x400121){this['id']=_0x400121['id']||0x0;this[_0xe6b4('0x0')]=_0x400121['name']||'';this['username']=_0x400121['username']||'';this['apiKey']=_0x400121[_0xe6b4('0x1')]||'';this[_0xe6b4('0x2')]=_0x400121[_0xe6b4('0x2')]||'';this[_0xe6b4('0x3')]=_0x400121[_0xe6b4('0x3')]||'';this[_0xe6b4('0x4')]=_0x400121['Configurations']||{};}module[_0xe6b4('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 07df2df..a20ee78 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 _0x3abe=['queuecallercomplete','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon'];(function(_0x1c5b29,_0x34023f){var _0x236647=function(_0xf5201e){while(--_0xf5201e){_0x1c5b29['push'](_0x1c5b29['shift']());}};_0x236647(++_0x34023f);}(_0x3abe,0x73));var _0xe3ab=function(_0x670a38,_0x44b04c){_0x670a38=_0x670a38-0x0;var _0xbb98c5=_0x3abe[_0x670a38];return _0xbb98c5;};'use strict';function QueueReport(){this[_0xe3ab('0x0')]=_0xe3ab('0x1');this['uniqueid']='';this[_0xe3ab('0x2')]='';this[_0xe3ab('0x3')]='';this[_0xe3ab('0x4')]='';this[_0xe3ab('0x5')]=null;this[_0xe3ab('0x6')]=null;this[_0xe3ab('0x7')]=0x1;this[_0xe3ab('0x8')]=0x1;this[_0xe3ab('0x9')]=![];this['queuecallerabandonAt']=null;this[_0xe3ab('0xa')]=![];this['queuecallercompleteAt']=null;this[_0xe3ab('0xb')]=![];this['queuecallerexitAt']=null;this[_0xe3ab('0xc')]=0x1;this[_0xe3ab('0xd')]='';this[_0xe3ab('0xe')]='';this[_0xe3ab('0xf')]='';this[_0xe3ab('0x10')]='';this['context']='';this['exten']='';this['priority']='';this[_0xe3ab('0x11')]=0x0;this[_0xe3ab('0x12')]=![];this[_0xe3ab('0x13')]='';this[_0xe3ab('0x14')]=_0xe3ab('0x15');this[_0xe3ab('0x16')]=0x0;this[_0xe3ab('0x17')]={};}module[_0xe3ab('0x18')]=QueueReport; \ No newline at end of file +var _0x5614=['queue','queuecallerleaveAt','position','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','priority','holdtime','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','calleridnum','calleridname'];(function(_0x30fff2,_0x1c4534){var _0x3f9f53=function(_0x1349c7){while(--_0x1349c7){_0x30fff2['push'](_0x30fff2['shift']());}};_0x3f9f53(++_0x1c4534);}(_0x5614,0x86));var _0x4561=function(_0x5cd027,_0x27d1fd){_0x5cd027=_0x5cd027-0x0;var _0x188b89=_0x5614[_0x5cd027];return _0x188b89;};'use strict';function QueueReport(){this[_0x4561('0x0')]=_0x4561('0x1');this['uniqueid']='';this[_0x4561('0x2')]='';this[_0x4561('0x3')]='';this[_0x4561('0x4')]='';this['queuecallerjoinAt']=null;this[_0x4561('0x5')]=null;this[_0x4561('0x6')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0x4561('0x7')]=null;this['queuecallercomplete']=![];this[_0x4561('0x8')]=null;this[_0x4561('0x9')]=![];this['queuecallerexitAt']=null;this[_0x4561('0xa')]=0x1;this[_0x4561('0xb')]='';this[_0x4561('0xc')]='';this[_0x4561('0xd')]='';this[_0x4561('0xe')]='';this['context']='';this['exten']='';this[_0x4561('0xf')]='';this[_0x4561('0x10')]=0x0;this['assigned']=![];this[_0x4561('0x11')]='';this[_0x4561('0x12')]=_0x4561('0x13');this[_0x4561('0x14')]=0x0;this[_0x4561('0x15')]={};}module[_0x4561('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index d0543f3..6d06fe7 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 _0x434b=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x34646f,_0x55a313){var _0x490624=function(_0x327c4f){while(--_0x327c4f){_0x34646f['push'](_0x34646f['shift']());}};_0x490624(++_0x55a313);}(_0x434b,0x17f));var _0xb434=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0x434b[_0x4709c8];return _0x478cdd;};'use strict';function SalesforceAccount(_0x10dc5d){this['id']=_0x10dc5d['id']||0x0;this['name']=_0x10dc5d[_0xb434('0x0')]||'';this[_0xb434('0x1')]=_0x10dc5d['username']||'';this[_0xb434('0x2')]=_0x10dc5d['remoteUri']||'';this[_0xb434('0x3')]=_0x10dc5d[_0xb434('0x3')]||'';this[_0xb434('0x4')]=_0x10dc5d[_0xb434('0x4')]||'';this[_0xb434('0x5')]=_0x10dc5d[_0xb434('0x5')]||'';this[_0xb434('0x6')]=_0x10dc5d[_0xb434('0x6')]||'';this[_0xb434('0x7')]=_0x10dc5d['type']||_0xb434('0x8');this[_0xb434('0x9')]=_0x10dc5d[_0xb434('0x9')]||'';this[_0xb434('0xa')]=_0x10dc5d[_0xb434('0xa')]||{};}module[_0xb434('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xafb4=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xafb4,0x1be));var _0x4afb=function(_0x3271db,_0x3444a2){_0x3271db=_0x3271db-0x0;var _0x108034=_0xafb4[_0x3271db];return _0x108034;};'use strict';function SalesforceAccount(_0x1194e5){this['id']=_0x1194e5['id']||0x0;this['name']=_0x1194e5[_0x4afb('0x0')]||'';this[_0x4afb('0x1')]=_0x1194e5[_0x4afb('0x1')]||'';this['remoteUri']=_0x1194e5[_0x4afb('0x2')]||'';this['password']=_0x1194e5[_0x4afb('0x3')]||'';this[_0x4afb('0x4')]=_0x1194e5[_0x4afb('0x4')]||'';this[_0x4afb('0x5')]=_0x1194e5['clientSecret']||'';this[_0x4afb('0x6')]=_0x1194e5[_0x4afb('0x6')]||'';this[_0x4afb('0x7')]=_0x1194e5[_0x4afb('0x7')]||_0x4afb('0x8');this[_0x4afb('0x9')]=_0x1194e5[_0x4afb('0x9')]||'';this['Configurations']=_0x1194e5[_0x4afb('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index eb1f924..23dd6b1 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 _0x5c63=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x2c96bb,_0x13a4cd){var _0x51bf2d=function(_0x7f361e){while(--_0x7f361e){_0x2c96bb['push'](_0x2c96bb['shift']());}};_0x51bf2d(++_0x13a4cd);}(_0x5c63,0x1ba));var _0x35c6=function(_0x58ee03,_0x5b4a36){_0x58ee03=_0x58ee03-0x0;var _0x5d6db8=_0x5c63[_0x58ee03];return _0x5d6db8;};'use strict';function ServicenowAccount(_0x328def){this['id']=_0x328def['id']||0x0;this[_0x35c6('0x0')]=_0x328def[_0x35c6('0x0')]||'';this[_0x35c6('0x1')]=_0x328def[_0x35c6('0x1')]||'';this[_0x35c6('0x2')]=_0x328def[_0x35c6('0x2')]||'';this['remoteUri']=_0x328def[_0x35c6('0x3')]||'';this[_0x35c6('0x4')]=_0x328def[_0x35c6('0x4')]||'';this[_0x35c6('0x5')]=_0x328def[_0x35c6('0x5')]||{};}module[_0x35c6('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xf556=['username','password','remoteUri','serverUrl','exports','name'];(function(_0x3514a1,_0x327d02){var _0x3e9115=function(_0x4e71e3){while(--_0x4e71e3){_0x3514a1['push'](_0x3514a1['shift']());}};_0x3e9115(++_0x327d02);}(_0xf556,0x16d));var _0x6f55=function(_0x2abd62,_0x36911e){_0x2abd62=_0x2abd62-0x0;var _0x1c41af=_0xf556[_0x2abd62];return _0x1c41af;};'use strict';function ServicenowAccount(_0x2e51f4){this['id']=_0x2e51f4['id']||0x0;this[_0x6f55('0x0')]=_0x2e51f4[_0x6f55('0x0')]||'';this[_0x6f55('0x1')]=_0x2e51f4[_0x6f55('0x1')]||'';this[_0x6f55('0x2')]=_0x2e51f4[_0x6f55('0x2')]||'';this[_0x6f55('0x3')]=_0x2e51f4['remoteUri']||'';this[_0x6f55('0x4')]=_0x2e51f4[_0x6f55('0x4')]||'';this['Configurations']=_0x2e51f4['Configurations']||{};}module[_0x6f55('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 b8e00ce..2deb8f7 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 _0x501e=['exports','name','username','remoteUri','Configurations'];(function(_0x476906,_0xda2f62){var _0x3e91e2=function(_0x7b09b){while(--_0x7b09b){_0x476906['push'](_0x476906['shift']());}};_0x3e91e2(++_0xda2f62);}(_0x501e,0x150));var _0xe501=function(_0x31f93a,_0x75b47c){_0x31f93a=_0x31f93a-0x0;var _0x4edb60=_0x501e[_0x31f93a];return _0x4edb60;};'use strict';function SugarcrmAccount(_0x1a7981){this['id']=_0x1a7981['id']||0x0;this[_0xe501('0x0')]=_0x1a7981[_0xe501('0x0')]||'';this[_0xe501('0x1')]=_0x1a7981['username']||'';this['password']=_0x1a7981['password']||'';this[_0xe501('0x2')]=_0x1a7981[_0xe501('0x2')]||'';this['serverUrl']=_0x1a7981['serverUrl']||'';this[_0xe501('0x3')]=_0x1a7981[_0xe501('0x3')]||{};}module[_0xe501('0x4')]=SugarcrmAccount; \ No newline at end of file +var _0x5ee6=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x5946f9,_0x53de7d){var _0x57d6bf=function(_0x2b90f0){while(--_0x2b90f0){_0x5946f9['push'](_0x5946f9['shift']());}};_0x57d6bf(++_0x53de7d);}(_0x5ee6,0x15c));var _0x65ee=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5ee6[_0x2641f9];return _0x585741;};'use strict';function SugarcrmAccount(_0x25def0){this['id']=_0x25def0['id']||0x0;this[_0x65ee('0x0')]=_0x25def0[_0x65ee('0x0')]||'';this[_0x65ee('0x1')]=_0x25def0['username']||'';this[_0x65ee('0x2')]=_0x25def0['password']||'';this[_0x65ee('0x3')]=_0x25def0[_0x65ee('0x3')]||'';this[_0x65ee('0x4')]=_0x25def0[_0x65ee('0x4')]||'';this[_0x65ee('0x5')]=_0x25def0[_0x65ee('0x5')]||{};}module[_0x65ee('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 88f1eb3..796ca5a 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 _0x0bb4=['accountcode','state','unknown','status','address','name'];(function(_0x4eefcf,_0xca618c){var _0x17ec51=function(_0xa31dd6){while(--_0xa31dd6){_0x4eefcf['push'](_0x4eefcf['shift']());}};_0x17ec51(++_0xca618c);}(_0x0bb4,0x77));var _0x40bb=function(_0x463005,_0x4ef179){_0x463005=_0x463005-0x0;var _0x12f27f=_0x0bb4[_0x463005];return _0x12f27f;};'use strict';function Telephone(_0x378d8b){this['id']=_0x378d8b['id']||0x0;this[_0x40bb('0x0')]=_0x378d8b['name']||'';this[_0x40bb('0x1')]=_0x378d8b[_0x40bb('0x1')]||'';this[_0x40bb('0x2')]=_0x40bb('0x3');this['stateTime']=0x0;this[_0x40bb('0x4')]='unknown';this[_0x40bb('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x6f59=['state','unknown','stateTime','status','address','exports','name','accountcode'];(function(_0x315180,_0x1957d6){var _0x17cee1=function(_0x24cf1a){while(--_0x24cf1a){_0x315180['push'](_0x315180['shift']());}};_0x17cee1(++_0x1957d6);}(_0x6f59,0x1be));var _0x96f5=function(_0x5d2521,_0x2bf7b6){_0x5d2521=_0x5d2521-0x0;var _0x170db7=_0x6f59[_0x5d2521];return _0x170db7;};'use strict';function Telephone(_0x454d6c){this['id']=_0x454d6c['id']||0x0;this[_0x96f5('0x0')]=_0x454d6c[_0x96f5('0x0')]||'';this[_0x96f5('0x1')]=_0x454d6c[_0x96f5('0x1')]||'';this[_0x96f5('0x2')]=_0x96f5('0x3');this[_0x96f5('0x4')]=0x0;this[_0x96f5('0x5')]=_0x96f5('0x3');this[_0x96f5('0x6')]='';}module[_0x96f5('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index ad2ab3b..dd6061b 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x41e8a9,_0x5dd56e){var _0x33b35d=function(_0x4dad67){while(--_0x4dad67){_0x41e8a9['push'](_0x41e8a9['shift']());}};_0x33b35d(++_0x5dd56e);}(_0xb10b,0x12a));var _0xbb10=function(_0x121d9e,_0x11b966){_0x121d9e=_0x121d9e-0x0;var _0x5df466=_0xb10b[_0x121d9e];return _0x5df466;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x2281e4,_0x374bc0){var _0x36880b=function(_0xc1409a){while(--_0xc1409a){_0x2281e4['push'](_0x2281e4['shift']());}};_0x36880b(++_0x374bc0);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b02ff,_0x4ce260){_0x5b02ff=_0x5b02ff-0x0;var _0xfe3187=_0xb10b[_0x5b02ff];return _0xfe3187;};'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 2cf0329..9a55c32 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 _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0x1db7d1,_0x10619d){var _0x544547=function(_0x5ffb42){while(--_0x5ffb42){_0x1db7d1['push'](_0x1db7d1['shift']());}};_0x544547(++_0x10619d);}(_0x14a0,0x8e));var _0x014a=function(_0x334e2d,_0x3a324a){_0x334e2d=_0x334e2d-0x0;var _0xbbd379=_0x14a0[_0x334e2d];return _0xbbd379;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 538447d..699912f 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 _0xcd8d=['refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown','registry','indexOf','split','host'];(function(_0x1543b9,_0x3aa9b5){var _0x403801=function(_0x241978){while(--_0x241978){_0x1543b9['push'](_0x1543b9['shift']());}};_0x403801(++_0x3aa9b5);}(_0xcd8d,0x17f));var _0xdcd8=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0xcd8d[_0x349148];return _0x2f2b0f;};'use strict';function Trunk(_0x2c9e66){this['id']=_0x2c9e66['id']||0x0;this[_0xdcd8('0x0')]=_0x2c9e66[_0xdcd8('0x0')]||![];this[_0xdcd8('0x1')]=_0x2c9e66[_0xdcd8('0x1')]||'';this['state']=_0xdcd8('0x2');this['stateTime']=0x0;this['status']=_0xdcd8('0x2');this['registry']=_0x2c9e66[_0xdcd8('0x3')]&&_0x2c9e66['registry'][_0xdcd8('0x4')](':')?_0x2c9e66[_0xdcd8('0x3')][_0xdcd8('0x5')](':')[0x0]:'';this[_0xdcd8('0x6')]='';this['port']='';this['domain']='';this['domainport']='';this[_0xdcd8('0x7')]='';this[_0xdcd8('0x8')]='unknown';this[_0xdcd8('0x9')]='';this[_0xdcd8('0xa')]='';this[_0xdcd8('0xb')]=_0x2c9e66[_0xdcd8('0xb')]||'';}module[_0xdcd8('0xc')]=Trunk; \ No newline at end of file +var _0xfe6f=['status','unknown','registry','indexOf','split','port','domain','stateRegistry','registrationtime','address','exports','active','name','stateTime'];(function(_0x389a39,_0x393105){var _0x5c9dfe=function(_0x2336d6){while(--_0x2336d6){_0x389a39['push'](_0x389a39['shift']());}};_0x5c9dfe(++_0x393105);}(_0xfe6f,0x7b));var _0xffe6=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xfe6f[_0xf50820];return _0x2a9b10;};'use strict';function Trunk(_0x3756c1){this['id']=_0x3756c1['id']||0x0;this['active']=_0x3756c1[_0xffe6('0x0')]||![];this[_0xffe6('0x1')]=_0x3756c1[_0xffe6('0x1')]||'';this['state']='unknown';this[_0xffe6('0x2')]=0x0;this[_0xffe6('0x3')]=_0xffe6('0x4');this['registry']=_0x3756c1[_0xffe6('0x5')]&&_0x3756c1[_0xffe6('0x5')][_0xffe6('0x6')](':')?_0x3756c1['registry'][_0xffe6('0x7')](':')[0x0]:'';this['host']='';this[_0xffe6('0x8')]='';this[_0xffe6('0x9')]='';this['domainport']='';this['refresh']='';this[_0xffe6('0xa')]=_0xffe6('0x4');this[_0xffe6('0xb')]='';this[_0xffe6('0xc')]='';this['defaultuser']=_0x3756c1['defaultuser']||'';}module[_0xffe6('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index dbb3c46..c6c4891 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 _0x6288=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x4c99d7,_0x378b6f){var _0x109a38=function(_0x21abb4){while(--_0x21abb4){_0x4c99d7['push'](_0x4c99d7['shift']());}};_0x109a38(++_0x378b6f);}(_0x6288,0x1dd));var _0x8628=function(_0x2567f0,_0x4fa60){_0x2567f0=_0x2567f0-0x0;var _0x14852a=_0x6288[_0x2567f0];return _0x14852a;};'use strict';function voiceExtension(_0x5a12d7){this['id']=_0x5a12d7['id']||0x0;this[_0x8628('0x0')]=_0x5a12d7['exten']||'';this['recordingFormat']=_0x5a12d7[_0x8628('0x1')]||_0x8628('0x2');this[_0x8628('0x3')]=_0x5a12d7[_0x8628('0x3')]||![];}module[_0x8628('0x4')]=voiceExtension; \ No newline at end of file +var _0x9c77=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x37b7c6,_0x16d450){var _0x923f2a=function(_0x52f106){while(--_0x52f106){_0x37b7c6['push'](_0x37b7c6['shift']());}};_0x923f2a(++_0x16d450);}(_0x9c77,0x12e));var _0x79c7=function(_0x37cb56,_0x502d03){_0x37cb56=_0x37cb56-0x0;var _0x16d47a=_0x9c77[_0x37cb56];return _0x16d47a;};'use strict';function voiceExtension(_0x34d9ba){this['id']=_0x34d9ba['id']||0x0;this[_0x79c7('0x0')]=_0x34d9ba[_0x79c7('0x0')]||'';this['recordingFormat']=_0x34d9ba[_0x79c7('0x1')]||_0x79c7('0x2');this[_0x79c7('0x3')]=_0x34d9ba[_0x79c7('0x3')]||![];}module[_0x79c7('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 f6e1230..4ad8f5c 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 _0xffc2=['dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','answered','sumDuration','sumHoldTime','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'];(function(_0xd54fe0,_0x1e4633){var _0x35e0b9=function(_0x5d3260){while(--_0x5d3260){_0xd54fe0['push'](_0xd54fe0['shift']());}};_0x35e0b9(++_0x1e4633);}(_0xffc2,0xf4));var _0x2ffc=function(_0x32aa68,_0x102e89){_0x32aa68=_0x32aa68-0x0;var _0x292133=_0xffc2[_0x32aa68];return _0x292133;};'use strict';var statusDesc=[_0x2ffc('0x0'),_0x2ffc('0x1'),_0x2ffc('0x2'),'busy',_0x2ffc('0x3'),_0x2ffc('0x4'),_0x2ffc('0x5'),_0x2ffc('0x6'),_0x2ffc('0x7')];var monitorFormat={'wav':'wav','wav49':_0x2ffc('0x8'),'gsm':_0x2ffc('0x9')};var strategy={'rrmemory':_0x2ffc('0xa'),'roundrobin':_0x2ffc('0xb')};function VoiceQueue(_0x5afe68){this['id']=_0x5afe68['id']||0x0;this[_0x2ffc('0xc')]=_0x5afe68['name']||'';this[_0x2ffc('0xd')]=_0x5afe68[_0x2ffc('0xd')]||'';this['type']=_0x5afe68[_0x2ffc('0xe')]||'inbound';this[_0x2ffc('0xf')]=0x0;this[_0x2ffc('0x10')]=0x0;this[_0x2ffc('0x11')]=0x0;this[_0x2ffc('0x12')]=0x0;this[_0x2ffc('0x13')]=0x0;this[_0x2ffc('0x14')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0x2ffc('0x15')]=0x0;this[_0x2ffc('0x16')]=0x0;this[_0x2ffc('0x17')]=0x0;this[_0x2ffc('0x18')]=_0x5afe68[_0x2ffc('0x18')]||![];this[_0x2ffc('0x19')]=_0x5afe68[_0x2ffc('0x19')]||0xa;this[_0x2ffc('0x1a')]=_0x5afe68[_0x2ffc('0x1a')]||'no';this[_0x2ffc('0x1b')]=!![];this[_0x2ffc('0x1c')]='';this[_0x2ffc('0x1d')]=0x0;this[_0x2ffc('0x1e')]=0x0;this['dialTimezone']=_0x5afe68['dialTimezone']||null;this[_0x2ffc('0x1f')]=_0x5afe68[_0x2ffc('0x1f')]?_0x5afe68[_0x2ffc('0x1f')]:null;this[_0x2ffc('0x20')]=_0x5afe68[_0x2ffc('0x20')];this[_0x2ffc('0x21')]=_0x5afe68[_0x2ffc('0x21')]||'progressive';this['dialLimitChannel']=_0x5afe68[_0x2ffc('0x22')]||0x0;this['dialLimitQueue']=_0x5afe68['dialLimitQueue']||0x0;this[_0x2ffc('0x23')]=_0x5afe68[_0x2ffc('0x23')]||0x1;this[_0x2ffc('0x24')]=_0x5afe68[_0x2ffc('0x24')]||_0x2ffc('0x25');this[_0x2ffc('0x26')]=_0x5afe68['dialPredictiveOptimizationPercentage']||0.03;this[_0x2ffc('0x27')]=_0x5afe68[_0x2ffc('0x27')]||0x258;this['dialOriginateCallerIdName']=_0x5afe68[_0x2ffc('0x28')]||_0x2ffc('0x29');this['dialOriginateCallerIdNumber']=_0x5afe68[_0x2ffc('0x2a')]||'anonymous';this[_0x2ffc('0x2b')]=_0x5afe68[_0x2ffc('0x2b')]||0x1e;this[_0x2ffc('0x2c')]=_0x5afe68[_0x2ffc('0x2c')]||_0x2ffc('0x2d');this[_0x2ffc('0x2e')]=_0x5afe68[_0x2ffc('0x2e')]||0x3;this[_0x2ffc('0x2f')]=_0x5afe68['dialQueueProject']||undefined;this[_0x2ffc('0x30')]=_0x5afe68['dialCongestionMaxRetry']||0x3;this[_0x2ffc('0x31')]=_0x5afe68[_0x2ffc('0x31')]||0x96;this['dialBusyMaxRetry']=_0x5afe68[_0x2ffc('0x32')]||0x3;this[_0x2ffc('0x33')]=_0x5afe68['dialBusyRetryFrequency']||0x96;this[_0x2ffc('0x34')]=_0x5afe68['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x5afe68[_0x2ffc('0x35')]||0x96;this[_0x2ffc('0x36')]=_0x5afe68[_0x2ffc('0x36')]||0x3;this[_0x2ffc('0x37')]=_0x5afe68['dialNoSuchNumberRetryFrequency']||0x96;this[_0x2ffc('0x38')]=_0x5afe68['dialDropMaxRetry']||0x3;this[_0x2ffc('0x39')]=_0x5afe68[_0x2ffc('0x39')]||0x96;this['dialAbandonedMaxRetry']=_0x5afe68['dialAbandonedMaxRetry']||0x3;this[_0x2ffc('0x3a')]=_0x5afe68[_0x2ffc('0x3a')]||0x96;this[_0x2ffc('0x3b')]=_0x5afe68[_0x2ffc('0x3b')]||0x3;this[_0x2ffc('0x3c')]=_0x5afe68[_0x2ffc('0x3c')]||0x96;this[_0x2ffc('0x3d')]=_0x5afe68[_0x2ffc('0x3d')]||0x3;this[_0x2ffc('0x3e')]=_0x5afe68[_0x2ffc('0x3e')]||0x96;this[_0x2ffc('0x3f')]=_0x5afe68[_0x2ffc('0x3f')]||0x4;this[_0x2ffc('0x40')]=_0x5afe68[_0x2ffc('0x40')]?_0x5afe68['Trunk']:undefined;this[_0x2ffc('0x41')]=_0x5afe68[_0x2ffc('0x41')]?_0x5afe68[_0x2ffc('0x41')]:undefined;this['dialPrefix']=_0x5afe68[_0x2ffc('0x42')]||undefined;this[_0x2ffc('0x43')]=_0x5afe68[_0x2ffc('0x43')]?_0x5afe68[_0x2ffc('0x43')]:undefined;this['dialOrderByScheduledAt']=_0x5afe68[_0x2ffc('0x44')]||_0x2ffc('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x5afe68['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x5afe68[_0x2ffc('0x46')]||undefined;this[_0x2ffc('0x47')]=strategy[_0x5afe68['strategy']]||_0x2ffc('0xa');this[_0x2ffc('0x48')]=!![];this[_0x2ffc('0x49')]=_0x5afe68[_0x2ffc('0x49')]||![];this['dialAMDInitialSilence']=_0x5afe68['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x5afe68['dialAMDGreeting'];this[_0x2ffc('0x4a')]=_0x5afe68[_0x2ffc('0x4a')];this[_0x2ffc('0x4b')]=_0x5afe68['dialAMDTotalAnalysisTime'];this[_0x2ffc('0x4c')]=_0x5afe68[_0x2ffc('0x4c')];this[_0x2ffc('0x4d')]=_0x5afe68[_0x2ffc('0x4d')];this['dialAMDMaximumNumberOfWords']=_0x5afe68[_0x2ffc('0x4e')];this[_0x2ffc('0x4f')]=_0x5afe68[_0x2ffc('0x4f')];this['dialAMDMaximumWordLength']=_0x5afe68['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0x2ffc('0x50')]=0x0;this[_0x2ffc('0x51')]=_0x5afe68[_0x2ffc('0x51')];this[_0x2ffc('0x52')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x2ffc('0x53')]=0x0;this[_0x2ffc('0x54')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x2ffc('0x55')]=0x0;this[_0x2ffc('0x56')]=0x0;this[_0x2ffc('0x57')]=0x0;this[_0x2ffc('0x58')]=0x0;this[_0x2ffc('0x59')]=0x0;this[_0x2ffc('0x5a')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x2ffc('0x5b')]=0x0;this[_0x2ffc('0x5c')]=0x0;this[_0x2ffc('0x5d')]=undefined;this[_0x2ffc('0x5e')]=undefined;this['handlePredictive']=undefined;this[_0x2ffc('0x5f')]=1.05;this[_0x2ffc('0x60')]=0x0;this[_0x2ffc('0x61')]=0x0;this[_0x2ffc('0x62')]=0x0;this[_0x2ffc('0x63')]=0x0;this[_0x2ffc('0x64')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x2ffc('0x65')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x2ffc('0x66')]=_0x5afe68[_0x2ffc('0x67')]||0x14;this[_0x2ffc('0x68')]=_0x5afe68[_0x2ffc('0x67')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x2ffc('0x69')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x2ffc('0x6a')]=0x0;this[_0x2ffc('0x6b')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x2ffc('0x6c')]=0x0;this[_0x2ffc('0x6d')]=_0x5afe68[_0x2ffc('0x6d')]||0x1e;this[_0x2ffc('0x6e')]=_0x5afe68[_0x2ffc('0x6e')]||![];this[_0x2ffc('0x6f')]=!!_0x5afe68[_0x2ffc('0x6f')]||![];this[_0x2ffc('0x70')]=!!_0x5afe68['dialPreviewRecallmeReminder']||![];this[_0x2ffc('0x71')]=_0x5afe68['dialQueueProject2']||undefined;this[_0x2ffc('0x72')]=_0x5afe68[_0x2ffc('0x72')]||![];this['dialAgiAfterHangupAgent']=_0x5afe68[_0x2ffc('0x73')]||![];this[_0x2ffc('0xd')]=monitorFormat[_0x5afe68[_0x2ffc('0xd')]]?monitorFormat[_0x5afe68[_0x2ffc('0xd')]]:undefined;this['mandatoryDisposition']=_0x5afe68[_0x2ffc('0x74')]||![];this[_0x2ffc('0x75')]=_0x5afe68[_0x2ffc('0x75')]?_0x5afe68['mandatoryDispositionPause']:undefined;}module[_0x2ffc('0x76')]=VoiceQueue; \ No newline at end of file +var _0xbcf8=['onhold','wav49','gsm','rrmemory','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringinuse'];(function(_0x1ac3a9,_0x426baf){var _0x406426=function(_0x50796f){while(--_0x50796f){_0x1ac3a9['push'](_0x1ac3a9['shift']());}};_0x406426(++_0x426baf);}(_0xbcf8,0x16b));var _0x8bcf=function(_0x273b68,_0x1c7025){_0x273b68=_0x273b68-0x0;var _0x2d19be=_0xbcf8[_0x273b68];return _0x2d19be;};'use strict';var statusDesc=[_0x8bcf('0x0'),_0x8bcf('0x1'),_0x8bcf('0x2'),_0x8bcf('0x3'),'invalid',_0x8bcf('0x4'),'ringing',_0x8bcf('0x5'),_0x8bcf('0x6')];var monitorFormat={'wav':'wav','wav49':_0x8bcf('0x7'),'gsm':_0x8bcf('0x8')};var strategy={'rrmemory':_0x8bcf('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x4cb7c3){this['id']=_0x4cb7c3['id']||0x0;this[_0x8bcf('0xa')]=_0x4cb7c3[_0x8bcf('0xa')]||'';this[_0x8bcf('0xb')]=_0x4cb7c3[_0x8bcf('0xb')]||'';this[_0x8bcf('0xc')]=_0x4cb7c3['type']||_0x8bcf('0xd');this[_0x8bcf('0xe')]=0x0;this['talking']=0x0;this[_0x8bcf('0xf')]=0x0;this[_0x8bcf('0x10')]=0x0;this['sumDuration']=0x0;this[_0x8bcf('0x11')]=0x0;this['sumBillable']=0x0;this[_0x8bcf('0x12')]=0x0;this[_0x8bcf('0x13')]=0x0;this[_0x8bcf('0x14')]=0x0;this[_0x8bcf('0x15')]=0x0;this[_0x8bcf('0x16')]=_0x4cb7c3[_0x8bcf('0x16')]||![];this[_0x8bcf('0x17')]=_0x4cb7c3[_0x8bcf('0x17')]||0xa;this[_0x8bcf('0x18')]=_0x4cb7c3[_0x8bcf('0x18')]||'no';this[_0x8bcf('0x19')]=!![];this[_0x8bcf('0x1a')]='';this[_0x8bcf('0x1b')]=0x0;this[_0x8bcf('0x1c')]=0x0;this[_0x8bcf('0x1d')]=_0x4cb7c3['dialTimezone']||null;this[_0x8bcf('0x1e')]=_0x4cb7c3[_0x8bcf('0x1e')]?_0x4cb7c3[_0x8bcf('0x1e')]:null;this[_0x8bcf('0x1f')]=_0x4cb7c3[_0x8bcf('0x1f')];this[_0x8bcf('0x20')]=_0x4cb7c3[_0x8bcf('0x20')]||'progressive';this[_0x8bcf('0x21')]=_0x4cb7c3[_0x8bcf('0x21')]||0x0;this[_0x8bcf('0x22')]=_0x4cb7c3[_0x8bcf('0x22')]||0x0;this[_0x8bcf('0x23')]=_0x4cb7c3[_0x8bcf('0x23')]||0x1;this['dialPredictiveOptimization']=_0x4cb7c3[_0x8bcf('0x24')]||'dropRate';this[_0x8bcf('0x25')]=_0x4cb7c3['dialPredictiveOptimizationPercentage']||0.03;this[_0x8bcf('0x26')]=_0x4cb7c3[_0x8bcf('0x26')]||0x258;this[_0x8bcf('0x27')]=_0x4cb7c3['dialOriginateCallerIdName']||_0x8bcf('0x28');this['dialOriginateCallerIdNumber']=_0x4cb7c3[_0x8bcf('0x29')]||'anonymous';this['dialOriginateTimeout']=_0x4cb7c3['dialOriginateTimeout']||0x1e;this[_0x8bcf('0x2a')]=_0x4cb7c3[_0x8bcf('0x2a')]||_0x8bcf('0x2b');this[_0x8bcf('0x2c')]=_0x4cb7c3[_0x8bcf('0x2c')]||0x3;this[_0x8bcf('0x2d')]=_0x4cb7c3[_0x8bcf('0x2d')]||undefined;this[_0x8bcf('0x2e')]=_0x4cb7c3[_0x8bcf('0x2e')]||0x3;this[_0x8bcf('0x2f')]=_0x4cb7c3['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x4cb7c3[_0x8bcf('0x30')]||0x3;this[_0x8bcf('0x31')]=_0x4cb7c3[_0x8bcf('0x31')]||0x96;this[_0x8bcf('0x32')]=_0x4cb7c3[_0x8bcf('0x32')]||0x3;this[_0x8bcf('0x33')]=_0x4cb7c3['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x4cb7c3[_0x8bcf('0x34')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4cb7c3['dialNoSuchNumberRetryFrequency']||0x96;this[_0x8bcf('0x35')]=_0x4cb7c3['dialDropMaxRetry']||0x3;this[_0x8bcf('0x36')]=_0x4cb7c3['dialDropRetryFrequency']||0x96;this[_0x8bcf('0x37')]=_0x4cb7c3[_0x8bcf('0x37')]||0x3;this[_0x8bcf('0x38')]=_0x4cb7c3['dialAbandonedRetryFrequency']||0x96;this[_0x8bcf('0x39')]=_0x4cb7c3[_0x8bcf('0x39')]||0x3;this[_0x8bcf('0x3a')]=_0x4cb7c3[_0x8bcf('0x3a')]||0x96;this[_0x8bcf('0x3b')]=_0x4cb7c3[_0x8bcf('0x3b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4cb7c3[_0x8bcf('0x3c')]||0x96;this[_0x8bcf('0x3d')]=_0x4cb7c3['dialGlobalMaxRetry']||0x4;this[_0x8bcf('0x3e')]=_0x4cb7c3[_0x8bcf('0x3e')]?_0x4cb7c3[_0x8bcf('0x3e')]:undefined;this[_0x8bcf('0x3f')]=_0x4cb7c3[_0x8bcf('0x3f')]?_0x4cb7c3[_0x8bcf('0x3f')]:undefined;this[_0x8bcf('0x40')]=_0x4cb7c3[_0x8bcf('0x40')]||undefined;this[_0x8bcf('0x41')]=_0x4cb7c3[_0x8bcf('0x41')]?_0x4cb7c3['Interval']:undefined;this['dialOrderByScheduledAt']=_0x4cb7c3[_0x8bcf('0x42')]||_0x8bcf('0x43');this[_0x8bcf('0x44')]=_0x4cb7c3[_0x8bcf('0x44')]||undefined;this[_0x8bcf('0x45')]=_0x4cb7c3[_0x8bcf('0x45')]||undefined;this[_0x8bcf('0x46')]=strategy[_0x4cb7c3[_0x8bcf('0x46')]]||'rrmemory';this['queueStatusComplete']=!![];this[_0x8bcf('0x47')]=_0x4cb7c3[_0x8bcf('0x47')]||![];this[_0x8bcf('0x48')]=_0x4cb7c3[_0x8bcf('0x48')];this[_0x8bcf('0x49')]=_0x4cb7c3[_0x8bcf('0x49')];this[_0x8bcf('0x4a')]=_0x4cb7c3[_0x8bcf('0x4a')];this[_0x8bcf('0x4b')]=_0x4cb7c3['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x4cb7c3[_0x8bcf('0x4c')];this[_0x8bcf('0x4d')]=_0x4cb7c3['dialAMDBetweenWordsSilence'];this[_0x8bcf('0x4e')]=_0x4cb7c3[_0x8bcf('0x4e')];this[_0x8bcf('0x4f')]=_0x4cb7c3[_0x8bcf('0x4f')];this[_0x8bcf('0x50')]=_0x4cb7c3['dialAMDMaximumWordLength'];this[_0x8bcf('0x51')]=0x0;this[_0x8bcf('0x52')]=0x0;this['timeout']=_0x4cb7c3[_0x8bcf('0x53')];this[_0x8bcf('0x54')]=0x0;this[_0x8bcf('0x55')]=0x0;this[_0x8bcf('0x56')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x8bcf('0x57')]=0x0;this[_0x8bcf('0x58')]=0x0;this[_0x8bcf('0x59')]=0x0;this[_0x8bcf('0x5a')]=0x0;this[_0x8bcf('0x5b')]=0x0;this[_0x8bcf('0x5c')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x8bcf('0x5d')]=0x0;this[_0x8bcf('0x5e')]=0x0;this[_0x8bcf('0x5f')]=undefined;this[_0x8bcf('0x60')]=undefined;this[_0x8bcf('0x61')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x8bcf('0x62')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x8bcf('0x63')]=0x0;this[_0x8bcf('0x64')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x8bcf('0x65')]=0x0;this[_0x8bcf('0x66')]=0x0;this[_0x8bcf('0x67')]=0x0;this[_0x8bcf('0x68')]=_0x4cb7c3[_0x8bcf('0x69')]||0x14;this[_0x8bcf('0x6a')]=_0x4cb7c3[_0x8bcf('0x69')]||0xa;this[_0x8bcf('0x6b')]=0x0;this[_0x8bcf('0x6c')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x8bcf('0x6d')]=0x0;this[_0x8bcf('0x6e')]=0x0;this[_0x8bcf('0x6f')]=0x0;this[_0x8bcf('0x70')]=0x0;this['dialRecallMeTimeout']=_0x4cb7c3[_0x8bcf('0x71')]||0x1e;this[_0x8bcf('0x72')]=_0x4cb7c3[_0x8bcf('0x72')]||![];this[_0x8bcf('0x73')]=!!_0x4cb7c3[_0x8bcf('0x73')]||![];this['dialPreviewRecallmeReminder']=!!_0x4cb7c3[_0x8bcf('0x74')]||![];this['dialQueueProject2']=_0x4cb7c3[_0x8bcf('0x75')]||undefined;this[_0x8bcf('0x76')]=_0x4cb7c3[_0x8bcf('0x76')]||![];this[_0x8bcf('0x77')]=_0x4cb7c3[_0x8bcf('0x77')]||![];this[_0x8bcf('0xb')]=monitorFormat[_0x4cb7c3[_0x8bcf('0xb')]]?monitorFormat[_0x4cb7c3[_0x8bcf('0xb')]]:undefined;this[_0x8bcf('0x78')]=_0x4cb7c3['mandatoryDisposition']||![];this[_0x8bcf('0x79')]=_0x4cb7c3[_0x8bcf('0x79')]?_0x4cb7c3['mandatoryDispositionPause']:undefined;}module[_0x8bcf('0x7a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 569bd9a..33ce450 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 _0xa1b9=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x30f395,_0x3629b5){var _0x2ea0ee=function(_0x35a9af){while(--_0x35a9af){_0x30f395['push'](_0x30f395['shift']());}};_0x2ea0ee(++_0x3629b5);}(_0xa1b9,0x170));var _0x9a1b=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa1b9[_0x2b4411];return _0x8e41ef;};'use strict';function VtigerAccount(_0x41f18e){this['id']=_0x41f18e['id']||0x0;this['name']=_0x41f18e[_0x9a1b('0x0')]||'';this[_0x9a1b('0x1')]=_0x41f18e['username']||'';this[_0x9a1b('0x2')]=_0x41f18e['accessKey']||'';this[_0x9a1b('0x3')]=_0x41f18e[_0x9a1b('0x3')]||'';this[_0x9a1b('0x4')]=_0x41f18e['serverUrl']||'';this[_0x9a1b('0x5')]=_0x41f18e['Configurations']||{};}module[_0x9a1b('0x6')]=VtigerAccount; \ No newline at end of file +var _0x5d1c=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x50936f,_0x384d77){var _0x32ca54=function(_0x14b789){while(--_0x14b789){_0x50936f['push'](_0x50936f['shift']());}};_0x32ca54(++_0x384d77);}(_0x5d1c,0x1dd));var _0xc5d1=function(_0x53efe4,_0x58b196){_0x53efe4=_0x53efe4-0x0;var _0xf94431=_0x5d1c[_0x53efe4];return _0xf94431;};'use strict';function VtigerAccount(_0x1bc3d7){this['id']=_0x1bc3d7['id']||0x0;this[_0xc5d1('0x0')]=_0x1bc3d7[_0xc5d1('0x0')]||'';this[_0xc5d1('0x1')]=_0x1bc3d7['username']||'';this[_0xc5d1('0x2')]=_0x1bc3d7[_0xc5d1('0x2')]||'';this[_0xc5d1('0x3')]=_0x1bc3d7[_0xc5d1('0x3')]||'';this[_0xc5d1('0x4')]=_0x1bc3d7[_0xc5d1('0x4')]||'';this[_0xc5d1('0x5')]=_0x1bc3d7[_0xc5d1('0x5')]||{};}module[_0xc5d1('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 033e484..5c599b0 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 _0x60c3=['serverUrl','Configurations','exports','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x60c3,0x99));var _0x360c=function(_0x2d02cf,_0x4058c8){_0x2d02cf=_0x2d02cf-0x0;var _0x1647d1=_0x60c3[_0x2d02cf];return _0x1647d1;};'use strict';function ZendeskAccount(_0x362ca9){this['id']=_0x362ca9['id']||0x0;this['name']=_0x362ca9['name']||'';this[_0x360c('0x0')]=_0x362ca9[_0x360c('0x0')]||'';this[_0x360c('0x1')]=_0x362ca9[_0x360c('0x1')]||'';this[_0x360c('0x2')]=_0x362ca9[_0x360c('0x2')]||'';this['remoteUri']=_0x362ca9[_0x360c('0x3')]||'';this[_0x360c('0x4')]=_0x362ca9[_0x360c('0x4')]||'';this[_0x360c('0x5')]=_0x362ca9['type']||_0x360c('0x6');this[_0x360c('0x7')]=_0x362ca9[_0x360c('0x7')]||'';this[_0x360c('0x8')]=_0x362ca9['Configurations']||{};}module[_0x360c('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xf1a2=['Configurations','exports','name','username','password','authType','type','serverUrl'];(function(_0x17db61,_0x364236){var _0x7ac96b=function(_0x329bf4){while(--_0x329bf4){_0x17db61['push'](_0x17db61['shift']());}};_0x7ac96b(++_0x364236);}(_0xf1a2,0xd2));var _0x2f1a=function(_0x13be30,_0x1a45db){_0x13be30=_0x13be30-0x0;var _0x364aae=_0xf1a2[_0x13be30];return _0x364aae;};'use strict';function ZendeskAccount(_0x5637ff){this['id']=_0x5637ff['id']||0x0;this[_0x2f1a('0x0')]=_0x5637ff[_0x2f1a('0x0')]||'';this[_0x2f1a('0x1')]=_0x5637ff[_0x2f1a('0x1')]||'';this[_0x2f1a('0x2')]=_0x5637ff['password']||'';this['token']=_0x5637ff['token']||'';this['remoteUri']=_0x5637ff['remoteUri']||'';this[_0x2f1a('0x3')]=_0x5637ff['authType']||'';this[_0x2f1a('0x4')]=_0x5637ff[_0x2f1a('0x4')]||'integrationTab';this['serverUrl']=_0x5637ff[_0x2f1a('0x5')]||'';this[_0x2f1a('0x6')]=_0x5637ff[_0x2f1a('0x6')]||{};}module[_0x2f1a('0x7')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 484303d..4457bb1 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 _0xbbe1=['exports','name','description','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x56372a,_0x230c67){var _0x17efc2=function(_0x2b3c01){while(--_0x2b3c01){_0x56372a['push'](_0x56372a['shift']());}};_0x17efc2(++_0x230c67);}(_0xbbe1,0x137));var _0x1bbe=function(_0x288f73,_0x5d378b){_0x288f73=_0x288f73-0x0;var _0x417fe3=_0xbbe1[_0x288f73];return _0x417fe3;};'use strict';function ZohoAccount(_0x49fc50){this['id']=_0x49fc50['id']||0x0;this['name']=_0x49fc50[_0x1bbe('0x0')]||'';this[_0x1bbe('0x1')]=_0x49fc50[_0x1bbe('0x1')]||'';this['host']=_0x49fc50['host']||'';this[_0x1bbe('0x2')]=_0x49fc50['zone']||'';this[_0x1bbe('0x3')]=_0x49fc50['clientId']||'';this[_0x1bbe('0x4')]=_0x49fc50[_0x1bbe('0x4')]||'';this['serverUrl']=_0x49fc50[_0x1bbe('0x5')]||'';this[_0x1bbe('0x6')]=_0x49fc50[_0x1bbe('0x6')]||'';this[_0x1bbe('0x7')]=_0x49fc50[_0x1bbe('0x7')]||'';this[_0x1bbe('0x8')]=_0x49fc50[_0x1bbe('0x8')]||{};}module[_0x1bbe('0x9')]=ZohoAccount; \ No newline at end of file +var _0x4fe5=['serverUrl','code','refreshToken','Configurations','name','description','zone','clientId','clientSecret'];(function(_0x5e19e6,_0x1d5c20){var _0x5f0fdc=function(_0x5c22cd){while(--_0x5c22cd){_0x5e19e6['push'](_0x5e19e6['shift']());}};_0x5f0fdc(++_0x1d5c20);}(_0x4fe5,0x1c6));var _0x54fe=function(_0x255fb4,_0x320722){_0x255fb4=_0x255fb4-0x0;var _0x31a031=_0x4fe5[_0x255fb4];return _0x31a031;};'use strict';function ZohoAccount(_0x2a3c13){this['id']=_0x2a3c13['id']||0x0;this[_0x54fe('0x0')]=_0x2a3c13['name']||'';this['description']=_0x2a3c13[_0x54fe('0x1')]||'';this['host']=_0x2a3c13['host']||'';this[_0x54fe('0x2')]=_0x2a3c13[_0x54fe('0x2')]||'';this[_0x54fe('0x3')]=_0x2a3c13['clientId']||'';this[_0x54fe('0x4')]=_0x2a3c13[_0x54fe('0x4')]||'';this[_0x54fe('0x5')]=_0x2a3c13[_0x54fe('0x5')]||'';this[_0x54fe('0x6')]=_0x2a3c13[_0x54fe('0x6')]||'';this['refreshToken']=_0x2a3c13[_0x54fe('0x7')]||'';this['Configurations']=_0x2a3c13[_0x54fe('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 450bc71..0c81c1a 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 _0xa001=['calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','campaigntype','dialAnswer','membername','Agent','channelAgent','SIP/%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa001,0x1eb));var _0x1a00=function(_0x2101c0,_0xc50e67){_0x2101c0=_0x2101c0-0x0;var _0x394061=_0xa001[_0x2101c0];return _0x394061;};'use strict';var util=require(_0x1a00('0x0'));var _=require(_0x1a00('0x1'));var moment=require(_0x1a00('0x2'));function checkNameSurname(_0x5acc5f,_0x5e9d0c,_0xedee34){var _0x2aecb0='';if(!_[_0x1a00('0x3')](_0x5e9d0c)&&_0x1a00('0x4')===typeof _0x5e9d0c){_0x2aecb0+=_0x5e9d0c;}if(!_[_0x1a00('0x3')](_0xedee34)&&_0x1a00('0x4')===typeof _0xedee34){_0x2aecb0+='\x20'+_0xedee34;}if(_0x2aecb0!==''){return _0x2aecb0;}return _0x5acc5f;}function Action(_0x4a695e,_0x4869d2,_0x4da7ea,_0x48978b,_0x584add){this[_0x1a00('0x5')]=_0x4da7ea||undefined;this[_0x1a00('0x6')]=_0x4a695e['id'];this[_0x1a00('0x7')]=_0x4869d2[_0x1a00('0x8')];this['type']=_0x4869d2['type'];this[_0x1a00('0x9')]=_0x1a00('0x7');this[_0x1a00('0xa')]=![];this[_0x1a00('0xb')]=_[_0x1a00('0x3')](_0x4a695e[_0x1a00('0xc')])?undefined:_0x4a695e[_0x1a00('0xc')]['name'];this[_0x1a00('0xd')]=this[_0x1a00('0xb')]?util['format'](_0x1a00('0xe'),this[_0x1a00('0xb')]):_0x48978b||undefined;this[_0x1a00('0xf')]=checkNameSurname(_0x4a695e[_0x1a00('0x10')]['phone'],_0x4a695e['Contact'][_0x1a00('0x11')],_0x4a695e[_0x1a00('0x10')][_0x1a00('0x12')]);this[_0x1a00('0x13')]=_0x4a695e[_0x1a00('0x13')]||![];this[_0x1a00('0x14')]=_0x4a695e[_0x1a00('0x10')][_0x1a00('0x15')];this[_0x1a00('0x16')]=_0x4a695e[_0x1a00('0x16')];this[_0x1a00('0x17')]=_0x4a695e[_0x1a00('0x17')]||0x0;this[_0x1a00('0x18')]=_0x4a695e[_0x1a00('0x18')]||0x0;this['countnoanswerretry']=_0x4a695e[_0x1a00('0x19')]||0x0;this[_0x1a00('0x1a')]=(_0x4a695e['countbusyretry']||0x0)+(_0x4a695e[_0x1a00('0x18')]||0x0)+(_0x4a695e[_0x1a00('0x19')]||0x0)+(_0x4a695e[_0x1a00('0x1b')]||0x0)+(_0x4a695e[_0x1a00('0x1c')]||0x0)+(_0x4a695e[_0x1a00('0x1d')]||0x0)+(_0x4a695e['countmachineretry']||0x0)+(_0x4a695e['countagentrejectretry']||0x0);this[_0x1a00('0x1b')]=_0x4a695e[_0x1a00('0x1b')]||0x0;this[_0x1a00('0x1c')]=_0x4a695e[_0x1a00('0x1c')]||0x0;this[_0x1a00('0x1d')]=_0x4a695e[_0x1a00('0x1d')]||0x0;this[_0x1a00('0x1e')]=_0x4a695e[_0x1a00('0x1e')]||0x0;this[_0x1a00('0x1f')]=_0x4a695e['countagentrejectretry']||0x0;this[_0x1a00('0x20')]=_0x4a695e[_0x1a00('0x20')];this[_0x1a00('0x21')]=_0x4a695e[_0x1a00('0x21')];this[_0x1a00('0x22')]=_0x4a695e['callbackat'];this[_0x1a00('0x23')]=_0x4a695e[_0x1a00('0x23')];this[_0x1a00('0x24')]=_0x4a695e[_0x1a00('0x24')];this[_0x1a00('0x25')]=_0x4a695e[_0x1a00('0x25')];this[_0x1a00('0x26')]=_['isNil'](_0x4a695e[_0x1a00('0xc')])?_0x4a695e['UserId']:_0x4a695e[_0x1a00('0xc')]['id'];this[_0x1a00('0x27')]=_0x4a695e[_0x1a00('0x27')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x1a00('0x28')][_0x1a00('0x29')]=function(){return util[_0x1a00('0x2a')](_0x1a00('0x2b'),this[_0x1a00('0xf')],this[_0x1a00('0x2c')]);};module[_0x1a00('0x2d')]=Action; \ No newline at end of file +var _0x00e1=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','calleridname','exports','util','lodash','moment','string','uniqueid','idContact','queue','name','type','dialAnswer','membername','isNil','Agent','channelAgent','format','SIP/%s','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x58fc2b,_0x368286){var _0x3937ce=function(_0x25a86e){while(--_0x25a86e){_0x58fc2b['push'](_0x58fc2b['shift']());}};_0x3937ce(++_0x368286);}(_0x00e1,0x1e6));var _0x100e=function(_0x1dfd84,_0x185264){_0x1dfd84=_0x1dfd84-0x0;var _0x477b39=_0x00e1[_0x1dfd84];return _0x477b39;};'use strict';var util=require(_0x100e('0x0'));var _=require(_0x100e('0x1'));var moment=require(_0x100e('0x2'));function checkNameSurname(_0x361ee5,_0x3599b2,_0xbf654b){var _0x3cf85c='';if(!_['isNil'](_0x3599b2)&&_0x100e('0x3')===typeof _0x3599b2){_0x3cf85c+=_0x3599b2;}if(!_['isNil'](_0xbf654b)&&'string'===typeof _0xbf654b){_0x3cf85c+='\x20'+_0xbf654b;}if(_0x3cf85c!==''){return _0x3cf85c;}return _0x361ee5;}function Action(_0x281576,_0x47e82f,_0x215d06,_0x531810,_0x463568){this[_0x100e('0x4')]=_0x215d06||undefined;this[_0x100e('0x5')]=_0x281576['id'];this[_0x100e('0x6')]=_0x47e82f[_0x100e('0x7')];this[_0x100e('0x8')]=_0x47e82f[_0x100e('0x8')];this['campaigntype']=_0x100e('0x6');this[_0x100e('0x9')]=![];this[_0x100e('0xa')]=_[_0x100e('0xb')](_0x281576['Agent'])?undefined:_0x281576[_0x100e('0xc')][_0x100e('0x7')];this[_0x100e('0xd')]=this['membername']?util[_0x100e('0xe')](_0x100e('0xf'),this[_0x100e('0xa')]):_0x531810||undefined;this['calleridname']=checkNameSurname(_0x281576[_0x100e('0x10')][_0x100e('0x11')],_0x281576[_0x100e('0x10')]['firstName'],_0x281576[_0x100e('0x10')][_0x100e('0x12')]);this['active']=_0x281576[_0x100e('0x13')]||![];this[_0x100e('0x14')]=_0x281576[_0x100e('0x10')][_0x100e('0x11')];this[_0x100e('0x15')]=_0x281576['scheduledat'];this[_0x100e('0x16')]=_0x281576['countbusyretry']||0x0;this[_0x100e('0x17')]=_0x281576[_0x100e('0x17')]||0x0;this[_0x100e('0x18')]=_0x281576[_0x100e('0x18')]||0x0;this['countglobal']=(_0x281576[_0x100e('0x16')]||0x0)+(_0x281576[_0x100e('0x17')]||0x0)+(_0x281576[_0x100e('0x18')]||0x0)+(_0x281576[_0x100e('0x19')]||0x0)+(_0x281576[_0x100e('0x1a')]||0x0)+(_0x281576[_0x100e('0x1b')]||0x0)+(_0x281576[_0x100e('0x1c')]||0x0)+(_0x281576['countagentrejectretry']||0x0);this[_0x100e('0x19')]=_0x281576[_0x100e('0x19')]||0x0;this[_0x100e('0x1a')]=_0x281576[_0x100e('0x1a')]||0x0;this[_0x100e('0x1b')]=_0x281576[_0x100e('0x1b')]||0x0;this['countmachineretry']=_0x281576[_0x100e('0x1c')]||0x0;this[_0x100e('0x1d')]=_0x281576[_0x100e('0x1d')]||0x0;this['callback']=_0x281576[_0x100e('0x1e')];this[_0x100e('0x1f')]=_0x281576['callbackuniqueid'];this['callbackat']=_0x281576[_0x100e('0x20')];this[_0x100e('0x21')]=_0x281576['recallme'];this[_0x100e('0x22')]=_0x281576['ContactId'];this['ListId']=_0x281576[_0x100e('0x23')];this['UserId']=_[_0x100e('0xb')](_0x281576['Agent'])?_0x281576[_0x100e('0x24')]:_0x281576[_0x100e('0xc')]['id'];this[_0x100e('0x25')]=_0x281576[_0x100e('0x25')];this[_0x100e('0x26')]='';this['originatecalleridname']='';}Action['prototype'][_0x100e('0x27')]=function(){return util[_0x100e('0xe')](_0x100e('0x28'),this[_0x100e('0x29')],this['number']);};module[_0x100e('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index e024259..c582f23 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 _0x5ad3=['Busy','custom:agentbusy','busy','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','scheduledAt','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','checkInBlack','Contact','phone','lookAgent','then','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','validateContact','checkIsBlackList','Contact.phone','[Preview][getContactPreview]','Call\x20unsuccessful','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','TrunkBackup','[Preview][validateContact][Trunk\x20not\x20work]','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','merge','toLowerVariables','Action','variablesAction','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','dialQueueProject','channelstate','transfer','disableContact','[syncHangup][talking][transfer]','variables','filterKey','keys','variable','addVariable','value','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','redis','defaults','socket.io-emitter','enqueue','tail','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','sumBillable','sumDuration','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundReCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','Queue','queue','stringify','pick','UserId','VoiceQueueId','ListId','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','loggerError','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','createCustomerFinal','IsNotLoggedIn','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','activeContact','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','linkedid','countbusyretry'];(function(_0x1fa1b3,_0x22cd91){var _0x3cf5bc=function(_0x40ec72){while(--_0x40ec72){_0x1fa1b3['push'](_0x1fa1b3['shift']());}};_0x3cf5bc(++_0x22cd91);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x5ad3[_0x2d8fc2];return _0x3a9e53;};'use strict';var util=require(_0x35ad('0x0'));var _=require(_0x35ad('0x1'));var BPromise=require(_0x35ad('0x2'));var uuid=require(_0x35ad('0x3'));var moment=require('moment');var md5=require(_0x35ad('0x4'));var Redis=require(_0x35ad('0x5'));var config=require(_0x35ad('0x6'));var logger=require(_0x35ad('0x7'))(_0x35ad('0x8'));var loggerAction=require(_0x35ad('0x7'))(_0x35ad('0x9'));var ami=require(_0x35ad('0xa'));var rpcDb=require(_0x35ad('0xb'));var Action=require(_0x35ad('0xc'));var ut=require('./util/util');config[_0x35ad('0xd')]=_[_0x35ad('0xe')](config[_0x35ad('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0x35ad('0xf'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0x35ad('0x10')]=function(_0x3e9830){this['tail']=this[_0x35ad('0x11')]?this[_0x35ad('0x11')]['finally'](_0x3e9830):_0x3e9830();};function Preview(_0x4b31a1){this[_0x35ad('0x12')]=new Sequence();this[_0x35ad('0x13')]=_0x4b31a1['voiceQueues'];this[_0x35ad('0x14')]=_0x4b31a1[_0x35ad('0x14')];this['actions']={};this['agents']=_0x4b31a1[_0x35ad('0x15')];this[_0x35ad('0x16')]=0x0;ami['on'](_0x35ad('0x17'),this['syncOriginateResponse'][_0x35ad('0x18')](this));ami['on'](_0x35ad('0x19'),this['syncHangup'][_0x35ad('0x18')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x35ad('0x18')](this));ami['on'](_0x35ad('0x1a'),this[_0x35ad('0x1b')]['bind'](this));ami['on'](_0x35ad('0x1c'),this[_0x35ad('0x1d')][_0x35ad('0x18')](this));ami['on'](_0x35ad('0x1e'),this[_0x35ad('0x1f')][_0x35ad('0x18')](this));ami['on']('attendedtransfer',this[_0x35ad('0x20')][_0x35ad('0x18')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x35ad('0x18')](this));this[_0x35ad('0x21')](this['campaignsPreview']);}function emit(_0x21f611,_0x32735e,_0x496620){io['to'](_0x21f611)[_0x35ad('0x22')](_0x32735e,_0x496620);}function emitCampaignPreview(_0x40e5e8){if(_0x40e5e8[_0x35ad('0x23')]===_0x35ad('0x24')){var _0x1be6d2={'id':_0x40e5e8['id'],'name':_0x40e5e8[_0x35ad('0x25')],'strategy':_0x40e5e8[_0x35ad('0x26')],'answered':_0x40e5e8[_0x35ad('0x27')],'available':_0x40e5e8[_0x35ad('0x28')],'loggedIn':_0x40e5e8[_0x35ad('0x29')],'pTalking':_0x40e5e8['pTalking'],'sumBillable':_0x40e5e8[_0x35ad('0x2a')],'sumDuration':_0x40e5e8[_0x35ad('0x2b')],'sumHoldTime':_0x40e5e8['sumHoldTime']||0x0,'talking':_0x40e5e8[_0x35ad('0x2c')],'total':_0x40e5e8[_0x35ad('0x2d')],'type':_0x40e5e8[_0x35ad('0x23')],'unmanaged':_0x40e5e8[_0x35ad('0x2e')],'abandoned':_0x40e5e8[_0x35ad('0x2f')],'waiting':_0x40e5e8['waiting'],'loggedInDb':_0x40e5e8[_0x35ad('0x30')],'dialActive':_0x40e5e8[_0x35ad('0x31')],'dialMethod':_0x40e5e8[_0x35ad('0x32')],'dialOriginateCallerIdName':_0x40e5e8[_0x35ad('0x33')],'dialOriginateCallerIdNumber':_0x40e5e8[_0x35ad('0x34')],'dialOriginateTimeout':_0x40e5e8[_0x35ad('0x35')],'dialPrefix':_0x40e5e8[_0x35ad('0x36')],'outboundAnswerAgiCallsDay':_0x40e5e8[_0x35ad('0x37')],'outboundAnswerCallsDay':_0x40e5e8['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x40e5e8[_0x35ad('0x38')],'outboundBusyCallsDay':_0x40e5e8[_0x35ad('0x39')],'outboundCongestionCallsDay':_0x40e5e8[_0x35ad('0x3a')],'outboundDropCallsDayACS':_0x40e5e8[_0x35ad('0x3b')],'outboundDropCallsDayCallersExit':_0x40e5e8[_0x35ad('0x3c')],'outboundDropCallsDayTimeout':_0x40e5e8['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x40e5e8['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x40e5e8[_0x35ad('0x3d')],'outboundOriginateFailureCallsDay':_0x40e5e8['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x40e5e8[_0x35ad('0x3e')],'outboundRejectCallsDay':_0x40e5e8['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x40e5e8['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x40e5e8['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x40e5e8['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x40e5e8[_0x35ad('0x3f')],'predictiveIntervalAvgTalktime':_0x40e5e8['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x40e5e8['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x40e5e8[_0x35ad('0x40')],'predictiveIntervalErlangCalls':_0x40e5e8['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x40e5e8[_0x35ad('0x41')],'predictiveIntervalHitRate':_0x40e5e8['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x40e5e8[_0x35ad('0x42')],'predictiveIntervalPauses':_0x40e5e8['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x40e5e8[_0x35ad('0x43')],'predictiveIntervalTotalCalls':_0x40e5e8['predictiveIntervalTotalCalls'],'message':_0x40e5e8[_0x35ad('0x44')],'originated':_0x40e5e8[_0x35ad('0x45')],'erlangCalls':_0x40e5e8[_0x35ad('0x46')],'erlangCallToSecond':_0x40e5e8['erlangCallToSecond'],'erlangAbandonmentRate':_0x40e5e8[_0x35ad('0x47')],'erlangBusyFactor':_0x40e5e8[_0x35ad('0x48')],'startPredictive':_0x40e5e8[_0x35ad('0x49')],'startProgressive':_0x40e5e8[_0x35ad('0x4a')]};if(_0x40e5e8[_0x35ad('0x4b')]){_0x1be6d2['Trunk']={'id':_0x40e5e8['Trunk']['id'],'name':_0x40e5e8[_0x35ad('0x4b')][_0x35ad('0x25')],'active':_0x40e5e8[_0x35ad('0x4b')][_0x35ad('0x4c')],'callerid':_0x40e5e8['Trunk'][_0x35ad('0x4d')]};}if(_0x40e5e8[_0x35ad('0x4e')]){_0x1be6d2[_0x35ad('0x4e')]={'id':_0x40e5e8[_0x35ad('0x4e')]['id'],'name':_0x40e5e8[_0x35ad('0x4e')][_0x35ad('0x25')]};}var _0x49c33d=md5(JSON['stringify'](_0x1be6d2));if(_0x40e5e8[_0x35ad('0x4')]!==_0x49c33d){_0x40e5e8[_0x35ad('0x4')]=_0x49c33d;emit(util[_0x35ad('0x4f')](_0x35ad('0x50'),_0x1be6d2[_0x35ad('0x25')]),_0x35ad('0x51'),_0x1be6d2);}}}function emitVoiceQueueChannelRemove(_0x11e7e2){logger[_0x35ad('0x52')](_0x35ad('0x53'),JSON['stringify'](_0x11e7e2));emit(util[_0x35ad('0x4f')]('voice:queue:%s',_0x11e7e2[_0x35ad('0x25')]),_0x35ad('0x54'),_0x11e7e2);io[_0x35ad('0x22')](_0x35ad('0x55'),_0x11e7e2);}function notSendMessagesQueue(_0x1ad7e6){if(_0x1ad7e6[_0x35ad('0x56')]){if(_0x1ad7e6[_0x35ad('0x45')]===0x0&&_0x1ad7e6[_0x35ad('0x57')]===0x0){_0x1ad7e6[_0x35ad('0x56')]=![];_0x1ad7e6['available']=0x0;_0x1ad7e6[_0x35ad('0x58')]=0x0;_0x1ad7e6[_0x35ad('0x44')]=_0x35ad('0x59');ut['logger'](_0x35ad('0x5a'),_0x1ad7e6[_0x35ad('0x25')]+_0x35ad('0x5b'));}else{_0x1ad7e6[_0x35ad('0x44')]=_0x35ad('0x5c');ut[_0x35ad('0x5d')](_0x35ad('0x5a'),_0x1ad7e6[_0x35ad('0x25')]+_0x35ad('0x5e'));}emitCampaignPreview(_0x1ad7e6);}}Preview[_0x35ad('0x5f')][_0x35ad('0x21')]=function(){var _0x557bf4=this;setInterval(function(){_0x557bf4[_0x35ad('0x60')]();},0x7cf);};Preview['prototype'][_0x35ad('0x60')]=function(){var _0x3b80c0=this[_0x35ad('0x13')];this[_0x35ad('0x16')]+=0x1;for(var _0x1785b5 in _0x3b80c0){if(_0x3b80c0[_0x35ad('0x61')](_0x1785b5)&&(_0x3b80c0[_0x1785b5][_0x35ad('0x32')]===_0x35ad('0x8')||_0x3b80c0[_0x1785b5][_0x35ad('0x32')]==='booked')&&_0x3b80c0[_0x1785b5][_0x35ad('0x23')]===_0x35ad('0x24')){if(this[_0x35ad('0x16')]>0x7){this[_0x35ad('0x16')]=0x0;this[_0x35ad('0x62')]();}}if(_0x3b80c0['hasOwnProperty'](_0x1785b5)&&_0x3b80c0[_0x1785b5][_0x35ad('0x32')]===_0x35ad('0x8')&&_0x3b80c0[_0x1785b5]['type']==='outbound'){if(_0x3b80c0[_0x1785b5][_0x35ad('0x31')]){this[_0x35ad('0x63')](_0x3b80c0[_0x1785b5]);if(_0x3b80c0[_0x1785b5][_0x35ad('0x64')])this[_0x35ad('0x65')](_0x3b80c0[_0x1785b5]);}else{notSendMessagesQueue(_0x3b80c0[_0x1785b5]);}}}};Preview['prototype'][_0x35ad('0x66')]=function(_0x1e3794){var _0x3c148a=this;this[_0x35ad('0x12')][_0x35ad('0x10')](function(){if(!_[_0x35ad('0x67')](_0x3c148a[_0x35ad('0x68')][_0x1e3794])){loggerAction['info'](_0x35ad('0x69'),_0x1e3794,_0x35ad('0x6a'),_0x3c148a[_0x35ad('0x68')][_0x1e3794]['queue'],'originated:\x20',JSON['stringify'](_0x3c148a[_0x35ad('0x13')][_0x3c148a[_0x35ad('0x68')][_0x1e3794][_0x35ad('0x6b')]][_0x35ad('0x45')]),'pTalking:\x20',JSON[_0x35ad('0x6c')](_0x3c148a[_0x35ad('0x13')][_0x3c148a[_0x35ad('0x68')][_0x1e3794][_0x35ad('0x6b')]][_0x35ad('0x57')]),JSON[_0x35ad('0x6c')](_0x3c148a['actions'][_0x1e3794]['dialAnswer']),JSON[_0x35ad('0x6c')](_[_0x35ad('0x6d')](_0x3c148a['actions'][_0x1e3794],['contactId',_0x35ad('0x6e'),_0x35ad('0x6f'),_0x35ad('0x70')])));return ami['Action']({'action':'status','channel':_0x3c148a[_0x35ad('0x68')][_0x1e3794][_0x35ad('0x71')]})[_0x35ad('0x72')](function(_0x5a8155){if(_0x5a8155[_0x35ad('0x44')]===_0x35ad('0x73')){setTimeout(function(){if(_0x3c148a[_0x35ad('0x68')][_0x1e3794]){ut[_0x35ad('0x74')](_0x3c148a[_0x35ad('0x13')][_0x3c148a[_0x35ad('0x68')][_0x1e3794]['queue']],_0x35ad('0x75'));if(_0x3c148a[_0x35ad('0x68')][_0x1e3794][_0x35ad('0x76')]===!![]){ut['decrementTalkink'](_0x3c148a[_0x35ad('0x13')][_0x3c148a[_0x35ad('0x68')][_0x1e3794][_0x35ad('0x6b')]],_0x35ad('0x75'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x1e3794,_0x3c148a[_0x35ad('0x68')][_0x1e3794][_0x35ad('0x6b')]);}ut[_0x35ad('0x77')](_0x35ad('0x78')+_0x1e3794,_0x3c148a[_0x35ad('0x68')][_0x1e3794]['queue']);delete _0x3c148a[_0x35ad('0x68')][_0x1e3794];}},0x2328);}});}});};Preview[_0x35ad('0x5f')][_0x35ad('0x62')]=function(){var _0xae2c85=this;loggerAction[_0x35ad('0x52')](_0x35ad('0x79'),_['size'](this['actions']));for(var _0x33da9c in this[_0x35ad('0x68')]){if(_0xae2c85[_0x35ad('0x68')][_0x35ad('0x61')](_0x33da9c)){_0xae2c85[_0x35ad('0x66')](_0x33da9c);}}};Preview[_0x35ad('0x5f')][_0x35ad('0x65')]=function(_0x5cef35){var _0x1da9a7=this;rpcDb[_0x35ad('0x7a')](_0x5cef35['id'],ut[_0x35ad('0x7b')](this[_0x35ad('0x15')]))['then'](function(_0x12735e){if(!_[_0x35ad('0x67')](_0x12735e)){for(var _0x4baa80=0x0;_0x4baa80<_0x12735e[_0x35ad('0x7c')];_0x4baa80+=0x1){if(ut[_0x35ad('0x7d')](_0x12735e[_0x4baa80][_0x35ad('0x7e')])<_0x5cef35[_0x35ad('0x7f')]*0x3c){if(_0x12735e[_0x4baa80][_0x35ad('0x80')]&&!_0x12735e[_0x4baa80][_0x35ad('0x80')][_0x35ad('0x81')]){_0x1da9a7[_0x35ad('0x82')](_0x12735e[_0x4baa80]['id'])['then'](ut[_0x35ad('0x83')](_0x35ad('0x84')))[_0x35ad('0x72')](ut['logger2'](_0x35ad('0x84')));}else{rpcDb['disableContact'](_0x12735e[_0x4baa80]['id']);}}else{var _0x24cfdc=new Action(_0x12735e[_0x4baa80],_0x5cef35);_0x24cfdc[_0x35ad('0x85')]=moment()[_0x35ad('0x4f')](_0x35ad('0x86'));_0x5cef35['outboundReCallsDay']+=0x1;ut[_0x35ad('0x87')](_0x24cfdc,0x17,_0x35ad('0x88'));if(_0x5cef35[_0x35ad('0x89')]){rpcDb[_0x35ad('0x8a')](ut[_0x35ad('0x8b')](_0x12735e[_0x4baa80]));rpcDb['createCustomerHistory'](_0x24cfdc,_0x35ad('0x8c'));}else{ut['logCustomer'](_0x24cfdc,0x16,_0x35ad('0x8d'));rpcDb[_0x35ad('0x8e')](_0x24cfdc,'[HistoryRecallClose]');rpcDb[_0x35ad('0x8f')](_0x24cfdc,'[HistoryRecallClose]');}}}}})[_0x35ad('0x72')](ut[_0x35ad('0x83')]('[getContactRecallMe]'));};Preview[_0x35ad('0x5f')][_0x35ad('0x63')]=function(_0x39f642){_0x39f642[_0x35ad('0x56')]=!![];if(ut[_0x35ad('0x90')](_0x39f642[_0x35ad('0x29')])){_0x39f642[_0x35ad('0x44')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x35ad('0x91')](_0x39f642[_0x35ad('0x31')])){_0x39f642[_0x35ad('0x44')]=_0x35ad('0x59');}else if(!this[_0x35ad('0x92')](_0x39f642[_0x35ad('0x4b')])){if(!this[_0x35ad('0x92')](_0x39f642['TrunkBackup'])){_0x39f642[_0x35ad('0x44')]=_0x35ad('0x93');}else{_0x39f642[_0x35ad('0x44')]=_0x35ad('0x94');}}else{_0x39f642[_0x35ad('0x44')]='ACTIVE';}emitCampaignPreview(_0x39f642);};Preview[_0x35ad('0x5f')][_0x35ad('0x95')]=function(_0x5b8b1d,_0x139a89,_0x2265f7){var _0x891ab4=this;var _0x286543=this['actions'][_0x139a89];var _0x351f14=this['campaignsPreview'][_0x286543[_0x35ad('0x6b')]];var _0x468331;if(_0x351f14){switch(_0x2265f7){case'1':_0x351f14[_0x35ad('0x3d')]+=0x1;_0x286543['countnosuchnumberretry']+=0x1;_0x286543[_0x35ad('0x96')]=ut['totalGlobal'](_0x286543);ut[_0x35ad('0x87')](_0x286543,0x0,'NoSuchNumber');ami['emit'](_0x35ad('0x97'),ut[_0x35ad('0x98')](_0x286543,'nosuchnumber'));rpcDb[_0x35ad('0x8e')](_0x286543,_0x35ad('0x99'));if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14['dialGlobalMaxRetry']){_0x468331=ut['cloneAction'](_0x286543,0xf,'Global');rpcDb['createCustomerFinal'](_0x468331,_0x35ad('0x9b'));}else{if(_0x286543[_0x35ad('0x9c')]>=_0x351f14[_0x35ad('0x9d')]){rpcDb[_0x35ad('0x8f')](_0x286543,_0x35ad('0x9b'));}else{rpcDb[_0x35ad('0x9e')](ut['scheduledAt'](_0x286543,_0x35ad('0x9c'),_0x351f14[_0x35ad('0x9f')]),_0x286543['unlockAgent'],_0x286543[_0x35ad('0xa0')]);}}delete this[_0x35ad('0x68')][_0x5b8b1d['linkedid']];break;case _0x35ad('0xa1'):var _0x31f8bb=moment()[_0x35ad('0x4f')](_0x35ad('0x86'));_0x286543['responsetime']=_0x31f8bb;_0x286543[_0x35ad('0xa2')]=_0x31f8bb;_0x286543[_0x35ad('0x76')]=!![];_0x351f14[_0x35ad('0x57')]+=0x1;logger[_0x35ad('0x52')](_0x35ad('0xa3'),_0x286543[_0x35ad('0xa4')],_0x35ad('0xa5'),_0x351f14[_0x35ad('0x25')],_0x35ad('0xa6'),_0x351f14[_0x35ad('0x57')]);ami['emit']('custom:agentconnect',ut[_0x35ad('0x98')](_0x286543,_0x35ad('0xa7'),this['campaignsPreview'][_0x286543[_0x35ad('0x6b')]]));if(_0x351f14[_0x35ad('0xa8')]){ami[_0x35ad('0x22')](_0x35ad('0xa9'),ut[_0x35ad('0xaa')](_0x286543));}break;case'16':ami[_0x35ad('0x22')]('custom:agentcomplete',ut[_0x35ad('0x98')](_0x286543,_0x35ad('0xab'),this[_0x35ad('0x13')][_0x286543[_0x35ad('0x6b')]]));emitVoiceQueueChannelRemove(ut[_0x35ad('0x98')](_0x286543,_0x35ad('0xab')));_0x351f14[_0x35ad('0xac')]+=0x1;_0x351f14[_0x35ad('0x2d')]+=0x1;_0x351f14['answered']+=0x1;ut[_0x35ad('0xad')](_0x351f14,_0x35ad('0xae'));_0x286543[_0x35ad('0x96')]=ut[_0x35ad('0x9a')](_0x286543);ut['logCustomer'](_0x286543,0x4,_0x35ad('0xaf'));rpcDb['createCustomerHistory'](_0x286543,_0x35ad('0xb0'));rpcDb['createCustomerFinal'](_0x286543,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x35ad('0xb1')](_0x286543);_0x351f14[_0x35ad('0x2b')]+=_0x286543[_0x35ad('0xb2')];_0x351f14['sumBillable']+=_0x286543[_0x35ad('0xb2')];logger['info'](_0x35ad('0xb3'),_0x286543[_0x35ad('0xa4')],_0x35ad('0xa5'),_0x351f14[_0x35ad('0x25')],'pTalking:\x20',_0x351f14[_0x35ad('0x57')]);delete this['actions'][_0x5b8b1d[_0x35ad('0xb4')]];break;case'BUSY':_0x351f14[_0x35ad('0x39')]+=0x1;_0x286543[_0x35ad('0xb5')]+=0x1;_0x286543['countglobal']=ut['totalGlobal'](_0x286543);ut['logCustomer'](_0x286543,0x5,_0x35ad('0xb6'));ami[_0x35ad('0x22')](_0x35ad('0xb7'),ut[_0x35ad('0x98')](_0x286543,_0x35ad('0xb8')));rpcDb['createCustomerHistory'](_0x286543,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14['dialGlobalMaxRetry']){_0x468331=ut[_0x35ad('0xb9')](_0x286543,0xf,'Global');rpcDb[_0x35ad('0x8f')](_0x468331,_0x35ad('0xba'));}else{if(_0x286543[_0x35ad('0xb5')]>=_0x351f14[_0x35ad('0xbb')]){rpcDb['createCustomerFinal'](_0x286543,_0x35ad('0xbc'));}else{rpcDb[_0x35ad('0x9e')](ut[_0x35ad('0xbd')](_0x286543,_0x35ad('0xb5'),_0x351f14[_0x35ad('0xbe')]),_0x286543[_0x35ad('0xbf')],_0x286543[_0x35ad('0xa0')]);}}break;case _0x35ad('0xc0'):_0x351f14['outboundNoAnswerCallsDay']+=0x1;_0x286543[_0x35ad('0xc1')]+=0x1;_0x286543[_0x35ad('0x96')]=ut['totalGlobal'](_0x286543);ut['logCustomer'](_0x286543,0x3,'NoAnswer');ami[_0x35ad('0x22')](_0x35ad('0xc2'),ut[_0x35ad('0x98')](_0x286543,_0x35ad('0xc3')));rpcDb['createCustomerHistory'](_0x286543,_0x35ad('0xc4'));if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14[_0x35ad('0xc5')]){_0x468331=ut[_0x35ad('0xb9')](_0x286543,0xf,_0x35ad('0xc6'));rpcDb[_0x35ad('0x8f')](_0x468331,_0x35ad('0xc7'));}else{if(_0x286543[_0x35ad('0xc1')]>=_0x351f14[_0x35ad('0xc8')]){rpcDb[_0x35ad('0x8f')](_0x286543,_0x35ad('0xc4'));}else{rpcDb['rescheduleContact'](ut[_0x35ad('0xbd')](_0x286543,_0x35ad('0xc1'),_0x351f14[_0x35ad('0xc9')]),_0x286543[_0x35ad('0xbf')],_0x286543[_0x35ad('0xa0')]);}}break;case'CONGESTION':_0x351f14['outboundCongestionCallsDay']+=0x1;_0x286543[_0x35ad('0xca')]+=0x1;_0x286543[_0x35ad('0x96')]=ut[_0x35ad('0x9a')](_0x286543);ut[_0x35ad('0x87')](_0x286543,0x8,_0x35ad('0xcb'));ami[_0x35ad('0x22')](_0x35ad('0xcc'),ut[_0x35ad('0x98')](_0x286543,_0x35ad('0xcd')));rpcDb[_0x35ad('0x8e')](_0x286543,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14[_0x35ad('0xc5')]){_0x468331=ut[_0x35ad('0xb9')](_0x286543,0xf,_0x35ad('0xc6'));rpcDb[_0x35ad('0x8f')](_0x468331,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x286543[_0x35ad('0xca')]>=_0x351f14[_0x35ad('0xce')]){rpcDb[_0x35ad('0x8f')](_0x286543,_0x35ad('0xcf'));}else{rpcDb['rescheduleContact'](ut[_0x35ad('0xbd')](_0x286543,_0x35ad('0xca'),_0x351f14['dialBusyRetryFrequency']),_0x286543['unlockAgent'],_0x286543[_0x35ad('0xa0')]);}}break;case _0x35ad('0xd0'):_0x351f14['outboundRejectCallsDay']+=0x1;_0x286543[_0x35ad('0xd1')]+=0x1;_0x286543[_0x35ad('0x96')]=ut[_0x35ad('0x9a')](_0x286543);ut['logCustomer'](_0x286543,0x14,_0x35ad('0xd2'));ami['emit'](_0x35ad('0xd3'),ut['buildObj'](_0x286543,_0x35ad('0xd4')));rpcDb[_0x35ad('0x8e')](_0x286543,_0x35ad('0xd5'));if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14[_0x35ad('0xc5')]){_0x468331=ut['cloneAction'](_0x286543,0x14,_0x35ad('0xd2'));rpcDb[_0x35ad('0x8f')](_0x468331,_0x35ad('0xd6'));}else{if(_0x286543[_0x35ad('0xd1')]>=_0x351f14['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x286543,_0x35ad('0xd6'));}else{rpcDb['rescheduleContact'](ut[_0x35ad('0xbd')](_0x286543,'countagentrejectretry',_0x351f14[_0x35ad('0xd7')]),_0x286543['unlockAgent'],_0x286543['activeContact']);}}break;case _0x35ad('0xd8'):_0x351f14['outboundAbandonedCallsDay']+=0x1;_0x286543[_0x35ad('0xd9')]+=0x1;_0x286543[_0x35ad('0x96')]=ut[_0x35ad('0x9a')](_0x286543);ut[_0x35ad('0x87')](_0x286543,0xb,_0x35ad('0xda'));rpcDb[_0x35ad('0x8e')](_0x286543,_0x35ad('0xdb'));if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14['dialGlobalMaxRetry']){_0x468331=ut[_0x35ad('0xb9')](_0x286543,0xf,_0x35ad('0xc6'));rpcDb[_0x35ad('0x8f')](_0x468331,_0x35ad('0xdb'));}else{if(_0x286543['countabandonedetry']>=_0x351f14[_0x35ad('0xdc')]){rpcDb[_0x35ad('0x8f')](_0x286543,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0x35ad('0xbd')](_0x286543,_0x35ad('0xd9'),_0x351f14[_0x35ad('0xdd')]),_0x286543['unlockAgent'],_0x286543[_0x35ad('0xa0')]);}}break;case'18':_0x351f14['outboundUnknownCallsDay']+=0x1;_0x286543[_0x35ad('0xde')]+=0x1;_0x286543[_0x35ad('0x96')]=ut[_0x35ad('0x9a')](_0x286543);ut[_0x35ad('0x87')](_0x286543,0x12,_0x5b8b1d[_0x35ad('0xdf')]||_0x5b8b1d[_0x35ad('0xe0')]);ami[_0x35ad('0x22')](_0x35ad('0xe1'),ut[_0x35ad('0x98')](_0x286543,'amd'));rpcDb[_0x35ad('0x8e')](_0x286543,_0x35ad('0xe2'));if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14['dialGlobalMaxRetry']){_0x468331=ut['cloneAction'](_0x286543,0xf,_0x35ad('0xc6'));rpcDb[_0x35ad('0x8f')](_0x468331,_0x35ad('0xe2'));}else{rpcDb[_0x35ad('0x8f')](_0x286543,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x35ad('0x68')][_0x5b8b1d[_0x35ad('0xb4')]];break;case'19':_0x351f14[_0x35ad('0xe3')]+=0x1;_0x286543[_0x35ad('0x96')]=ut[_0x35ad('0x9a')](_0x286543);ut[_0x35ad('0x87')](_0x286543,0x13,_0x5b8b1d[_0x35ad('0xdf')]||_0x5b8b1d[_0x35ad('0xe0')]);ami[_0x35ad('0x22')](_0x35ad('0xe1'),ut['buildObj'](_0x286543,'amd'));rpcDb[_0x35ad('0x8e')](_0x286543,_0x35ad('0xe4'));if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14[_0x35ad('0xc5')]){_0x468331=ut[_0x35ad('0xb9')](_0x286543,0xf,_0x35ad('0xc6'));rpcDb[_0x35ad('0x8f')](_0x468331,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x286543,_0x35ad('0xe4'));}delete this[_0x35ad('0x68')][_0x5b8b1d['linkedid']];break;default:if(_0x286543['dialAnswer']){ut[_0x35ad('0xad')](_0x351f14,'[default]');ut[_0x35ad('0x77')](_0x35ad('0xe5')+_0x351f14[_0x35ad('0x25')],_0x5b8b1d);}_0x351f14['outboundUnknownCallsDay']+=0x1;_0x286543['countglobal']=ut['totalGlobal'](_0x286543);ut[_0x35ad('0x87')](_0x286543,0xc,_0x5b8b1d[_0x35ad('0xdf')]||_0x5b8b1d[_0x35ad('0xe0')]);rpcDb[_0x35ad('0x8e')](_0x286543,_0x35ad('0xe6'));if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14[_0x35ad('0xc5')]){_0x468331=ut[_0x35ad('0xb9')](_0x286543,0xf,'Global');rpcDb[_0x35ad('0x8f')](_0x468331,_0x35ad('0xe7'));}else{rpcDb[_0x35ad('0x8f')](_0x286543,_0x35ad('0xe7'));}delete this['actions'][_0x5b8b1d[_0x35ad('0xb4')]];}if(!(_0x286543['dialAnswer']&&_0x2265f7==='16')){ut[_0x35ad('0x74')](_0x351f14,_0x35ad('0xe8'));logger[_0x35ad('0x52')](_0x35ad('0xe9'),_0x286543['uniqueid'],_0x35ad('0xa5'),_0x351f14[_0x35ad('0x25')],_0x35ad('0xea'),_0x351f14['originated']);}if(_0x2265f7!==_0x35ad('0xa1')){delete this[_0x35ad('0x68')][_0x5b8b1d[_0x35ad('0xb4')]];delete this[_0x35ad('0x68')][_0x5b8b1d[_0x35ad('0xeb')]];}}};Preview[_0x35ad('0x5f')]['callProgressDetectingAgent']=function(_0x333369,_0x22d76b,_0x1c2af7){if(_[_0x35ad('0xec')](_0x22d76b)&&_0x35ad('0xed')!==typeof _0x22d76b){return;}if(_[_0x35ad('0xec')](_0x1c2af7)&&_0x35ad('0xed')!==typeof _0x1c2af7){return;}switch(_0x1c2af7[_0x35ad('0xee')]){case'0':ut[_0x35ad('0xef')](_0x333369,0x0,_0x35ad('0xf0'));rpcDb[_0x35ad('0xf1')](_0x333369,_0x35ad('0xf2'));break;case'3':ut[_0x35ad('0xef')](_0x333369,0x3,_0x35ad('0xf3'));rpcDb[_0x35ad('0xf1')](_0x333369,_0x35ad('0xf4'));break;case'5':ut[_0x35ad('0xef')](_0x333369,0x5,'Busy');rpcDb[_0x35ad('0xf1')](_0x333369,_0x35ad('0xf5'));break;case'8':ut[_0x35ad('0xef')](_0x333369,0x8,_0x35ad('0xcb'));rpcDb[_0x35ad('0xf1')](_0x333369,_0x35ad('0xf6'));break;case'22':ut[_0x35ad('0xef')](_0x333369,0x16,_0x35ad('0xf7'));rpcDb[_0x35ad('0xf1')](_0x333369,_0x35ad('0xf8'));break;default:ut[_0x35ad('0xef')](_0x333369,0xc,_0x1c2af7['reason']);rpcDb[_0x35ad('0xf1')](_0x333369,'[callProgressDetectingAgent][logCongestion]');}ut[_0x35ad('0x74')](_0x22d76b,'[callProgressDetectingAgent]');logger[_0x35ad('0x52')]('[originated][decrement][callProgressDetectingAgent]',_0x333369[_0x35ad('0xa4')],_0x35ad('0xa5'),_0x22d76b[_0x35ad('0x25')],_0x35ad('0xea'),_0x22d76b[_0x35ad('0x45')]);delete this['actions'][_0x333369[_0x35ad('0xa4')]];};Preview[_0x35ad('0x5f')][_0x35ad('0xf9')]=function(_0xa95c70,_0x5b5c8f,_0x30c05e,_0x18aeb0,_0x35dbbe){var _0x502cba=this;return new BPromise(function(_0x4fa7df,_0x2cceb9){if(_[_0x35ad('0x67')](_0x5b5c8f)||_[_0x35ad('0x67')](_0x5b5c8f[_0x35ad('0xfa')])||_[_0x35ad('0x67')](_0x5b5c8f[_0x35ad('0xfa')][_0x35ad('0xfb')])||_[_0x35ad('0x67')](_0x5b5c8f['VoiceQueueId'])){_0x2cceb9(ut[_0x35ad('0x44')]('Contact\x20is\x20undefined',_0x18aeb0,_0x35dbbe));return;}var _0x420701=uuid['v4']();var _0x3a82bc=_0x502cba['campaignsPreview'][_0x5b5c8f['Queue'][_0x35ad('0x25')]];var _0x46ddb3=_0x30c05e?_0x502cba[_0x35ad('0x15')][_0x30c05e]['id']:undefined;_0x502cba['actions'][_0x420701]=new Action(_0x5b5c8f,_0x3a82bc,_0x420701,_0x30c05e,_0x46ddb3);var _0x23fe9b=_0x502cba['actions'][_0x420701];_0x23fe9b[_0x35ad('0xbf')]=_0x18aeb0;_0x23fe9b[_0x35ad('0xa0')]=_0x35dbbe;_0x23fe9b[_0x35ad('0xfc')]=_0x30c05e;if(_['isEmpty'](_0xa95c70)){_0x502cba['execCall'](_0x23fe9b,_0x3a82bc,_0x5b5c8f,_0x30c05e)[_0x35ad('0xfd')](function(_0x515b71){logger[_0x35ad('0x52')](_0x35ad('0xfe'),_0x35ad('0xff')+_0x23fe9b[_0x35ad('0x6b')]+_0x35ad('0x100')+_0x23fe9b[_0x35ad('0x101')],JSON[_0x35ad('0x6c')](_0x515b71));ami[_0x35ad('0x22')](_0x35ad('0x102'),ut[_0x35ad('0x98')](_0x23fe9b,_0x35ad('0x103'),_0x502cba[_0x35ad('0x13')][_0x23fe9b['queue']]));_0x4fa7df(ut[_0x35ad('0x44')](_0x35ad('0x104')));})[_0x35ad('0x72')](function(_0x181e1a){ut[_0x35ad('0x5d')](_0x35ad('0x105'),_0x181e1a);_0x2cceb9(ut[_0x35ad('0x44')](_0x35ad('0x106'),_0x18aeb0,_0x35dbbe));});}else{_0x3a82bc['outboundBlacklistCallsDay']+=0x1;ut[_0x35ad('0x107')](_0x23fe9b);rpcDb[_0x35ad('0x108')](_0x23fe9b,_0x35ad('0x109'));delete _0x502cba[_0x35ad('0x68')][_0x420701];_0x2cceb9(ut[_0x35ad('0x44')]('Contact\x20in\x20black\x20List',_0x18aeb0,_0x35dbbe));}});};Preview['prototype'][_0x35ad('0x92')]=function(_0x4e8ca9){return!_['isNil'](_0x4e8ca9)&&!_['isNil'](_0x4e8ca9[_0x35ad('0x25')])&&!_[_0x35ad('0x67')](_0x4e8ca9[_0x35ad('0x4c')])&&_0x4e8ca9[_0x35ad('0x4c')]&&!_[_0x35ad('0x67')](this[_0x35ad('0x14')][util[_0x35ad('0x4f')](_0x35ad('0x10a'),_0x4e8ca9[_0x35ad('0x25')])])&&!_[_0x35ad('0x67')](this[_0x35ad('0x14')][util['format'](_0x35ad('0x10a'),_0x4e8ca9[_0x35ad('0x25')])]['status'])&&(this['trunks'][util[_0x35ad('0x4f')](_0x35ad('0x10a'),_0x4e8ca9[_0x35ad('0x25')])][_0x35ad('0x10b')]===_0x35ad('0x10c')||this[_0x35ad('0x14')][util[_0x35ad('0x4f')](_0x35ad('0x10a'),_0x4e8ca9[_0x35ad('0x25')])][_0x35ad('0x10b')]===_0x35ad('0x10d'));};Preview[_0x35ad('0x5f')]['run']=function(_0x3f6b5d,_0x215096){var _0xdfc473=this;return new BPromise(function(_0x12f28e,_0x299c73){_0xdfc473[_0x35ad('0x10e')](_0x3f6b5d,_0x215096)[_0x35ad('0xfd')](function(_0x2af5ba){_0x12f28e(_['pick'](_0x2af5ba,[_0x35ad('0x44')]));})[_0x35ad('0x72')](function(_0x50cacb){if(_0x50cacb[_0x35ad('0x10f')]){rpcDb[_0x35ad('0x110')](_0x3f6b5d);}if(_0x50cacb[_0x35ad('0x4c')]){rpcDb['disableContact'](_0x3f6b5d);}_0x299c73(_['pick'](_0x50cacb,[_0x35ad('0x44')]));});});};Preview[_0x35ad('0x5f')][_0x35ad('0x10e')]=function(_0x21949f,_0x156de8){var _0x5038a5=this;return new BPromise(function(_0x1257da,_0x9d1163){var _0x1b8bc8,_0xba3bc8;rpcDb[_0x35ad('0x111')](_0x21949f)[_0x35ad('0xfd')](function(_0x39a1db){if(!_[_0x35ad('0x67')](_0x39a1db[0x0])){_0xba3bc8=_0x39a1db[0x0]['recallme']?![]:!![];_0x1b8bc8=_0x39a1db[0x0]['recallme']?!![]:![];_0x1b8bc8=_0x156de8?!![]:_0x1b8bc8;}var _0x9db0c8=_0x5038a5[_0x35ad('0x112')](_0x39a1db);if(_0x9db0c8['isValid']){rpcDb[_0x35ad('0x113')](_['pick'](_0x39a1db[0x0],[_0x35ad('0x6f'),_0x35ad('0x114')]))[_0x35ad('0xfd')](function(_0xbf8aea){_0x5038a5[_0x35ad('0xf9')](_0xbf8aea,_0x39a1db[0x0],_0x156de8,_0xba3bc8,_0x1b8bc8)[_0x35ad('0xfd')](function(_0x370db0){_0x1257da(_0x370db0);})[_0x35ad('0x72')](function(_0x1f0fcb){_0x9d1163(_0x1f0fcb);});})[_0x35ad('0x72')](function(_0x52f291){ut[_0x35ad('0x5d')]('[Preview][checkIsBlackList]',_0x52f291);_0x9d1163(ut['message']('Call\x20unsuccessful',_0xba3bc8,_0x1b8bc8));});}else{_0x9d1163(ut['message'](_0x9db0c8[_0x35ad('0x44')],_0xba3bc8,_0x1b8bc8));}})[_0x35ad('0x72')](function(_0x42929e){ut['logger'](_0x35ad('0x115'),_0x42929e);_0x9d1163(ut[_0x35ad('0x44')](_0x35ad('0x116'),![],!![]));});});};Preview[_0x35ad('0x5f')][_0x35ad('0x112')]=function(_0x5547a7){if(_[_0x35ad('0x67')](_0x5547a7)||_[_0x35ad('0x117')](_0x5547a7)||!_[_0x35ad('0x67')](_0x5547a7[0x0][_0x35ad('0x80')])&&_[_0x35ad('0x67')](_0x5547a7[0x0][_0x35ad('0x80')][_0x35ad('0x25')])){ut[_0x35ad('0x5d')](_0x35ad('0x118'),_0x5547a7);return{'isValid':![],'message':_0x35ad('0x119')};}var _0x17ed92=this[_0x35ad('0x13')][_0x5547a7[0x0][_0x35ad('0x6a')]['name']];_0x17ed92[_0x35ad('0x44')]='ACTIVE';if(_[_0x35ad('0x67')](_0x17ed92)){ut['logger'](_0x35ad('0x11a'),_0x17ed92);return{'isValid':![],'message':_0x35ad('0x11b')};}if(!this[_0x35ad('0x92')](_0x17ed92['Trunk'])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x35ad('0x11c')+_0x17ed92['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x35ad('0x92')](_0x17ed92[_0x35ad('0x11d')])){ut[_0x35ad('0x5d')](_0x35ad('0x11e'),_0x17ed92[_0x35ad('0x25')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x35ad('0x11f')};}}if(!ut[_0x35ad('0x91')](_0x17ed92[_0x35ad('0x31')])){ut[_0x35ad('0x5d')](_0x35ad('0x120'),_0x17ed92[_0x35ad('0x25')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x35ad('0x11c')+_0x17ed92[_0x35ad('0x25')]+_0x35ad('0x121')};}return{'isValid':!![],'message':_0x35ad('0x122')};};Preview[_0x35ad('0x5f')][_0x35ad('0x123')]=function(_0x5dc83e,_0xc77534,_0x2a59e3,_0x42a01){var _0x357f2d=this;return new BPromise(function(_0x30d3d6,_0x2e9350){var _0x47b122=_0x5dc83e['uniqueid'];var _0x44a6da=_0x357f2d[_0x35ad('0x92')](_0xc77534[_0x35ad('0x4b')])?util['format'](_0x35ad('0x124'),_0xc77534[_0x35ad('0x4b')][_0x35ad('0x25')],_[_0x35ad('0x67')](_0xc77534[_0x35ad('0x36')])?'':_0xc77534[_0x35ad('0x36')][_0x35ad('0x125')]()||'',_0xc77534['dialCutDigit']>0x0?_0x2a59e3['Contact']['phone']['substring'](_0xc77534[_0x35ad('0x126')]):_0x2a59e3[_0x35ad('0xfa')][_0x35ad('0xfb')]):util[_0x35ad('0x4f')]('SIP/%s/%s%s',_[_0x35ad('0x67')](_0xc77534[_0x35ad('0x11d')])?_0xc77534[_0x35ad('0x4b')][_0x35ad('0x25')]:_0xc77534[_0x35ad('0x11d')]['name'],_[_0x35ad('0x67')](_0xc77534[_0x35ad('0x36')])?'':_0xc77534[_0x35ad('0x36')]['trim']()||'',_0xc77534[_0x35ad('0x126')]>0x0?_0x2a59e3[_0x35ad('0xfa')][_0x35ad('0xfb')]['substring'](_0xc77534[_0x35ad('0x126')]):_0x2a59e3['Contact'][_0x35ad('0xfb')]);var _0xe23530=_0x357f2d[_0x35ad('0x92')](_0xc77534[_0x35ad('0x4b')])?ut[_0x35ad('0x127')](_0xc77534[_0x35ad('0x4b')]['callerid'],_0xc77534[_0x35ad('0x33')],_0xc77534[_0x35ad('0x128')]>0x0?ut[_0x35ad('0x129')](_0xc77534['dialOriginateCallerIdNumber'],_0xc77534['dialRandomLastDigitCallerIdNumber']):_0xc77534[_0x35ad('0x34')]):ut[_0x35ad('0x127')](_[_0x35ad('0x67')](_0xc77534[_0x35ad('0x11d')])?_0xc77534[_0x35ad('0x4b')][_0x35ad('0x4d')]:_0xc77534['TrunkBackup']['callerid'],_0xc77534['dialOriginateCallerIdName'],_0xc77534[_0x35ad('0x128')]>0x0?ut[_0x35ad('0x129')](_0xc77534[_0x35ad('0x34')],_0xc77534['dialRandomLastDigitCallerIdNumber']):_0xc77534['dialOriginateCallerIdNumber']);if(_0xe23530){_0x5dc83e['originatecalleridname']=ut[_0x35ad('0x12a')](_0xe23530);_0x5dc83e[_0x35ad('0x12b')]=ut['extractCalleridNumber'](_0xe23530);}var _0x2adf3b=ut['addVariables'](_0xc77534,_0x2a59e3,_0x44a6da,_0xe23530,_0x47b122,_0x5dc83e);_[_0x35ad('0x12c')](_0x5dc83e,ut[_0x35ad('0x12d')](_0x2adf3b));_0x5dc83e['starttime']=moment()[_0x35ad('0x4f')](_0x35ad('0x86'));ami[_0x35ad('0x12e')](ut[_0x35ad('0x12f')](_0x5dc83e,_0xc77534,_0x2adf3b,_0x5dc83e[_0x35ad('0xa0')],_0x42a01))[_0x35ad('0xfd')](function(_0x1cdbd5){_0xc77534[_0x35ad('0x45')]+=0x1;logger[_0x35ad('0x52')]('[originated][increment]',_0x47b122,_0x35ad('0xa5'),_0xc77534[_0x35ad('0x25')],_0x35ad('0xea'),_0xc77534[_0x35ad('0x45')]);_0x30d3d6(_0x1cdbd5);})['catch'](function(_0x42e7ae){ut['logAgent'](_0x5dc83e,0xe,'OriginateError');rpcDb[_0x35ad('0xf1')](_0x5dc83e,_0x35ad('0x130'));_0x2e9350(_0x42e7ae);});});};Preview['prototype']['syncNewExten']=function(_0x10f1cb){if(this[_0x35ad('0x68')][_0x10f1cb['linkedid']]){this[_0x35ad('0x68')][_0x10f1cb[_0x35ad('0xb4')]]['channel']=_0x10f1cb[_0x35ad('0x71')];}};Preview[_0x35ad('0x5f')][_0x35ad('0x131')]=function(_0x28252c){var _0x3d15b5=this;var _0xc67ff1=this[_0x35ad('0x68')][_0x28252c[_0x35ad('0x132')]];if(_0xc67ff1){if(_0xc67ff1[_0x35ad('0xfc')]&&this['agents'][_0xc67ff1[_0x35ad('0xfc')]]){ut[_0x35ad('0x133')](_0xc67ff1,this['agents'][_0xc67ff1[_0x35ad('0xfc')]][_0x35ad('0x25')],this[_0x35ad('0x15')][_0xc67ff1[_0x35ad('0xfc')]]['id']);}var _0x55aabf=_['clone'](_0xc67ff1);_0x55aabf['responsetime']=moment()['format'](_0x35ad('0x86'));var _0x521f45=_0x3d15b5[_0x35ad('0x13')][_0xc67ff1['queue']];if(ut[_0x35ad('0x134')](_0x28252c[_0x35ad('0x135')])){if(_0xc67ff1[_0x35ad('0xbf')]){rpcDb[_0x35ad('0x110')](_0xc67ff1['idContact']);}if(_0xc67ff1[_0x35ad('0xa0')]){rpcDb['disableContact'](_0xc67ff1[_0x35ad('0x101')]);}ami[_0x35ad('0x22')](_0x35ad('0x136'),ut[_0x35ad('0x98')](_0xc67ff1,_0x35ad('0x137'),this[_0x35ad('0x13')][_0xc67ff1[_0x35ad('0x6b')]]));this[_0x35ad('0x138')](_0x55aabf,_0x521f45,_0x28252c);}else{_0xc67ff1[_0x35ad('0x85')]=moment()[_0x35ad('0x4f')](_0x35ad('0x86'));ut[_0x35ad('0xef')](_0x55aabf,0x4,_0x35ad('0xaf'));rpcDb['createAgentHistory'](_0x55aabf,_0x35ad('0x139'));}}};Preview[_0x35ad('0x5f')][_0x35ad('0x13a')]=function(_0xd241e8){var _0x50efb3=this;var _0x5a1de6=this[_0x35ad('0x68')][_0xd241e8[_0x35ad('0xb4')]];var _0x4419a8;if(_0x5a1de6){_0x4419a8=this[_0x35ad('0x13')][_0x5a1de6['queue']];logger[_0x35ad('0x52')](_0x35ad('0x13b'),_0xd241e8['linkedid'],_0x35ad('0xa5'),_0x4419a8[_0x35ad('0x25')],_0x35ad('0xa6'),_0x4419a8[_0x35ad('0x57')]);}if(this['actions'][_0xd241e8[_0x35ad('0xb4')]]&&_0xd241e8[_0x35ad('0xb4')]!==_0xd241e8[_0x35ad('0xa4')]){if(_0xd241e8[_0x35ad('0x13c')]==='16'&&this[_0x35ad('0x68')][_0xd241e8[_0x35ad('0xb4')]]['dialAnswer']){this[_0x35ad('0x95')](_0xd241e8,_0xd241e8[_0x35ad('0xb4')],_0xd241e8[_0x35ad('0x13c')]);}else if(this[_0x35ad('0x68')][_0xd241e8[_0x35ad('0xb4')]][_0x35ad('0x76')]){logger[_0x35ad('0x52')]('[syncHangup][talking][cause]',_0xd241e8['linkedid'],_0xd241e8[_0x35ad('0x13c')],_0x35ad('0xa5'),_0x4419a8[_0x35ad('0x25')],_0x35ad('0xa6'),_0x4419a8[_0x35ad('0x57')]);this[_0x35ad('0x95')](_0xd241e8,_0xd241e8['linkedid'],_0xd241e8[_0x35ad('0x13c')]);}}else if(_0x5a1de6&&_[_0x35ad('0x67')](_0x5a1de6['statedesc'])&&_0x4419a8[_0x35ad('0x13d')]&&_0xd241e8[_0x35ad('0xb4')]===_0xd241e8[_0x35ad('0xa4')]&&_['isNil'](_0xd241e8['reason'])&&_0xd241e8[_0x35ad('0x13c')]==='16'&&_0xd241e8[_0x35ad('0x13e')]==='6'&&_['isUndefined'](_0x5a1de6[_0x35ad('0x13f')])){if(_0x5a1de6[_0x35ad('0xbf')]){rpcDb[_0x35ad('0x110')](_0x5a1de6[_0x35ad('0x101')]);}if(_0x5a1de6[_0x35ad('0xa0')]){rpcDb[_0x35ad('0x140')](_0x5a1de6['idContact']);}_0xd241e8[_0x35ad('0xee')]='22';this['callProgressDetectingAgent'](_0x5a1de6,_0x4419a8,_0xd241e8);}else if(_0x5a1de6&&_0x5a1de6[_0x35ad('0x13f')]){if(_0xd241e8[_0x35ad('0x13c')]==='16'&&this['actions'][_0xd241e8[_0x35ad('0xb4')]][_0x35ad('0x76')]){logger[_0x35ad('0x52')](_0x35ad('0x141'),_0xd241e8['linkedid'],_0xd241e8['cause'],_0x35ad('0xa5'),_0x4419a8[_0x35ad('0x25')],_0x35ad('0xa6'),_0x4419a8[_0x35ad('0x57')]);this['callProgressDetectingCustomer'](_0xd241e8,_0xd241e8[_0x35ad('0xb4')],_0xd241e8['cause']);}else if(this[_0x35ad('0x68')][_0xd241e8[_0x35ad('0xb4')]][_0x35ad('0x76')]){logger[_0x35ad('0x52')]('[syncHangup][talking][cause]',_0xd241e8[_0x35ad('0xb4')],_0xd241e8[_0x35ad('0x13c')],_0x35ad('0xa5'),_0x4419a8[_0x35ad('0x25')],_0x35ad('0xa6'),_0x4419a8[_0x35ad('0x57')]);this[_0x35ad('0x95')](_0xd241e8,_0xd241e8[_0x35ad('0xb4')],_0xd241e8[_0x35ad('0x13c')]);}}};Preview['prototype'][_0x35ad('0x1b')]=function(_0x3ec9ed){if(this['actions'][_0x3ec9ed[_0x35ad('0xeb')]]&&_0x3ec9ed['destlinkedid']!==_0x3ec9ed['destuniqueid']){this[_0x35ad('0x95')](_0x3ec9ed,_0x3ec9ed[_0x35ad('0xeb')],_0x3ec9ed[_0x35ad('0xe0')]);}};Preview[_0x35ad('0x5f')]['syncHangupRequest']=function(_0x2691e2){if(this[_0x35ad('0x68')][_0x2691e2[_0x35ad('0xb4')]]&&_0x2691e2[_0x35ad('0xb4')]!==_0x2691e2['uniqueid']&&!this['actions'][_0x2691e2[_0x35ad('0xb4')]]['dialAnswer']){if(_0x2691e2[_0x35ad('0x13c')]==='1'){this[_0x35ad('0x95')](_0x2691e2,_0x2691e2[_0x35ad('0xb4')],_0x2691e2['cause']);}}};Preview[_0x35ad('0x5f')]['addVariable']=function(_0x3171e0,_0x425732,_0x499fcf){if(this[_0x35ad('0x68')][_0x3171e0]){if(_[_0x35ad('0x67')](this['actions'][_0x3171e0][_0x35ad('0x142')])){this[_0x35ad('0x68')][_0x3171e0]['variables']={};}this[_0x35ad('0x68')][_0x3171e0][_0x35ad('0x142')][_0x425732]=_0x499fcf;}};Preview[_0x35ad('0x5f')]['syncVarSet']=function(_0x432863){try{if(!_['isNil'](_0x432863)){if(ut[_0x35ad('0x143')](_[_0x35ad('0x144')](_0x432863[_0x35ad('0x145')])[0x0])){this[_0x35ad('0x146')](_0x432863[_0x35ad('0xa4')],_[_0x35ad('0x144')](_0x432863[_0x35ad('0x145')])[0x0],_0x432863[_0x35ad('0x147')]);}}}catch(_0x33b595){logger['error']('[syncVarSet][Preview]',util[_0x35ad('0x148')](_0x33b595,{'showHidden':![],'depth':null}));}};Preview[_0x35ad('0x5f')]['syncAttendedTransfer']=function(_0x58b9e8){if(_0x58b9e8){if(this[_0x35ad('0x68')][_0x58b9e8[_0x35ad('0x149')]]){this[_0x35ad('0x68')][_0x58b9e8[_0x35ad('0x149')]][_0x35ad('0x13f')]=!![];}}};Preview[_0x35ad('0x5f')][_0x35ad('0x14a')]=function(_0x3e97ca){if(_0x3e97ca){if(this[_0x35ad('0x68')][_0x3e97ca[_0x35ad('0x14b')]]){this[_0x35ad('0x68')][_0x3e97ca[_0x35ad('0x14b')]][_0x35ad('0x13f')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xcd59=['./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','type','outbound','name','strategy','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice_queue:save','info','format','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','contactId','UserId','VoiceQueueId','Action','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','createCustomerFinal','rescheduleContact','unlockAgent','activeContact','linkedid','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','scheduledAt','dialBusyRetryFrequency','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','Congestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer]','ANSWER','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','execRun','pick','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','phone','substring','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','extractCalleridNumber','merge','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','isFailure','response','unlockContact','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','cause','[syncHangup][talking][cause]','dialQueueProject','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami'];(function(_0x15e55b,_0x33292a){var _0x791ae7=function(_0x50c49b){while(--_0x50c49b){_0x15e55b['push'](_0x15e55b['shift']());}};_0x791ae7(++_0x33292a);}(_0xcd59,0x14b));var _0x9cd5=function(_0x118733,_0x2bd820){_0x118733=_0x118733-0x0;var _0x4777af=_0xcd59[_0x118733];return _0x4777af;};'use strict';var util=require(_0x9cd5('0x0'));var _=require(_0x9cd5('0x1'));var BPromise=require(_0x9cd5('0x2'));var uuid=require(_0x9cd5('0x3'));var moment=require(_0x9cd5('0x4'));var md5=require(_0x9cd5('0x5'));var Redis=require('ioredis');var config=require(_0x9cd5('0x6'));var logger=require(_0x9cd5('0x7'))(_0x9cd5('0x8'));var loggerAction=require(_0x9cd5('0x7'))(_0x9cd5('0x9'));var ami=require(_0x9cd5('0xa'));var rpcDb=require(_0x9cd5('0xb'));var Action=require(_0x9cd5('0xc'));var ut=require(_0x9cd5('0xd'));config[_0x9cd5('0xe')]=_['defaults'](config[_0x9cd5('0xe')],{'host':_0x9cd5('0xf'),'port':0x18eb});var io=require(_0x9cd5('0x10'))(new Redis(config[_0x9cd5('0xe')]));var Sequence=function(){};Sequence[_0x9cd5('0x11')][_0x9cd5('0x12')]=function(_0x46bbca){this[_0x9cd5('0x13')]=this['tail']?this[_0x9cd5('0x13')][_0x9cd5('0x14')](_0x46bbca):_0x46bbca();};function Preview(_0x3fefe6){this[_0x9cd5('0x15')]=new Sequence();this['campaignsPreview']=_0x3fefe6['voiceQueues'];this[_0x9cd5('0x16')]=_0x3fefe6[_0x9cd5('0x16')];this[_0x9cd5('0x17')]={};this[_0x9cd5('0x18')]=_0x3fefe6[_0x9cd5('0x18')];this[_0x9cd5('0x19')]=0x0;ami['on']('originateresponse',this[_0x9cd5('0x1a')][_0x9cd5('0x1b')](this));ami['on'](_0x9cd5('0x1c'),this['syncHangup']['bind'](this));ami['on']('hanguprequest',this[_0x9cd5('0x1d')][_0x9cd5('0x1b')](this));ami['on']('dialend',this[_0x9cd5('0x1e')][_0x9cd5('0x1b')](this));ami['on'](_0x9cd5('0x1f'),this['syncNewExten'][_0x9cd5('0x1b')](this));ami['on'](_0x9cd5('0x20'),this[_0x9cd5('0x21')][_0x9cd5('0x1b')](this));ami['on'](_0x9cd5('0x22'),this[_0x9cd5('0x23')]['bind'](this));ami['on'](_0x9cd5('0x24'),this[_0x9cd5('0x25')][_0x9cd5('0x1b')](this));this[_0x9cd5('0x26')](this[_0x9cd5('0x27')]);}function emit(_0x4ed8b9,_0x16c4e9,_0x271444){io['to'](_0x4ed8b9)[_0x9cd5('0x28')](_0x16c4e9,_0x271444);}function emitCampaignPreview(_0x12e402){if(_0x12e402[_0x9cd5('0x29')]===_0x9cd5('0x2a')){var _0x1cf603={'id':_0x12e402['id'],'name':_0x12e402[_0x9cd5('0x2b')],'strategy':_0x12e402[_0x9cd5('0x2c')],'answered':_0x12e402['answered'],'available':_0x12e402[_0x9cd5('0x2d')],'loggedIn':_0x12e402[_0x9cd5('0x2e')],'pTalking':_0x12e402[_0x9cd5('0x2f')],'sumBillable':_0x12e402[_0x9cd5('0x30')],'sumDuration':_0x12e402['sumDuration'],'sumHoldTime':_0x12e402[_0x9cd5('0x31')]||0x0,'talking':_0x12e402[_0x9cd5('0x32')],'total':_0x12e402[_0x9cd5('0x33')],'type':_0x12e402[_0x9cd5('0x29')],'unmanaged':_0x12e402[_0x9cd5('0x34')],'abandoned':_0x12e402[_0x9cd5('0x35')],'waiting':_0x12e402[_0x9cd5('0x36')],'loggedInDb':_0x12e402['loggedInDb'],'dialActive':_0x12e402[_0x9cd5('0x37')],'dialMethod':_0x12e402[_0x9cd5('0x38')],'dialOriginateCallerIdName':_0x12e402[_0x9cd5('0x39')],'dialOriginateCallerIdNumber':_0x12e402['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x12e402['dialOriginateTimeout'],'dialPrefix':_0x12e402[_0x9cd5('0x3a')],'outboundAnswerAgiCallsDay':_0x12e402['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x12e402['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x12e402[_0x9cd5('0x3b')],'outboundBusyCallsDay':_0x12e402[_0x9cd5('0x3c')],'outboundCongestionCallsDay':_0x12e402[_0x9cd5('0x3d')],'outboundDropCallsDayACS':_0x12e402['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x12e402[_0x9cd5('0x3e')],'outboundDropCallsDayTimeout':_0x12e402[_0x9cd5('0x3f')],'outboundNoAnswerCallsDay':_0x12e402[_0x9cd5('0x40')],'outboundNoSuchCallsDay':_0x12e402[_0x9cd5('0x41')],'outboundOriginateFailureCallsDay':_0x12e402[_0x9cd5('0x42')],'outboundReCallsDay':_0x12e402[_0x9cd5('0x43')],'outboundRejectCallsDay':_0x12e402[_0x9cd5('0x44')],'outboundUnknownCallsDay':_0x12e402[_0x9cd5('0x45')],'outboundAbandonedCallsDay':_0x12e402[_0x9cd5('0x46')],'predictiveIntervalAnsweredCalls':_0x12e402[_0x9cd5('0x47')],'predictiveIntervalAvgHoldtime':_0x12e402[_0x9cd5('0x48')],'predictiveIntervalAvgTalktime':_0x12e402[_0x9cd5('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x12e402[_0x9cd5('0x4a')],'predictiveIntervalDroppedCallsTimeout':_0x12e402[_0x9cd5('0x4b')],'predictiveIntervalErlangCalls':_0x12e402['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x12e402[_0x9cd5('0x4c')],'predictiveIntervalHitRate':_0x12e402[_0x9cd5('0x4d')],'predictiveIntervalMultiplicativeFactor':_0x12e402['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x12e402['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x12e402[_0x9cd5('0x4e')],'predictiveIntervalTotalCalls':_0x12e402[_0x9cd5('0x4f')],'message':_0x12e402['message'],'originated':_0x12e402[_0x9cd5('0x50')],'erlangCalls':_0x12e402['erlangCalls'],'erlangCallToSecond':_0x12e402['erlangCallToSecond'],'erlangAbandonmentRate':_0x12e402[_0x9cd5('0x51')],'erlangBusyFactor':_0x12e402[_0x9cd5('0x52')],'startPredictive':_0x12e402[_0x9cd5('0x53')],'startProgressive':_0x12e402[_0x9cd5('0x54')]};if(_0x12e402['Trunk']){_0x1cf603[_0x9cd5('0x55')]={'id':_0x12e402[_0x9cd5('0x55')]['id'],'name':_0x12e402[_0x9cd5('0x55')]['name'],'active':_0x12e402[_0x9cd5('0x55')][_0x9cd5('0x56')],'callerid':_0x12e402[_0x9cd5('0x55')][_0x9cd5('0x57')]};}if(_0x12e402[_0x9cd5('0x58')]){_0x1cf603[_0x9cd5('0x58')]={'id':_0x12e402[_0x9cd5('0x58')]['id'],'name':_0x12e402[_0x9cd5('0x58')][_0x9cd5('0x2b')]};}var _0x1ed01d=md5(JSON[_0x9cd5('0x59')](_0x1cf603));if(_0x12e402['md5']!==_0x1ed01d){_0x12e402[_0x9cd5('0x5')]=_0x1ed01d;emit(util['format']('voice:queue:%s',_0x1cf603[_0x9cd5('0x2b')]),_0x9cd5('0x5a'),_0x1cf603);}}}function emitVoiceQueueChannelRemove(_0x46b974){logger[_0x9cd5('0x5b')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x9cd5('0x59')](_0x46b974));emit(util[_0x9cd5('0x5c')](_0x9cd5('0x5d'),_0x46b974[_0x9cd5('0x2b')]),'voice_queue_channel:remove',_0x46b974);io[_0x9cd5('0x28')](_0x9cd5('0x5e'),_0x46b974);}function notSendMessagesQueue(_0x1324a2){if(_0x1324a2[_0x9cd5('0x5f')]){if(_0x1324a2[_0x9cd5('0x50')]===0x0&&_0x1324a2[_0x9cd5('0x2f')]===0x0){_0x1324a2['sendMessageOneNotActive']=![];_0x1324a2[_0x9cd5('0x2d')]=0x0;_0x1324a2[_0x9cd5('0x60')]=0x0;_0x1324a2[_0x9cd5('0x61')]=_0x9cd5('0x62');ut[_0x9cd5('0x63')](_0x9cd5('0x64'),_0x1324a2[_0x9cd5('0x2b')]+_0x9cd5('0x65'));}else{_0x1324a2[_0x9cd5('0x61')]=_0x9cd5('0x66');ut[_0x9cd5('0x63')](_0x9cd5('0x64'),_0x1324a2[_0x9cd5('0x2b')]+_0x9cd5('0x67'));}emitCampaignPreview(_0x1324a2);}}Preview[_0x9cd5('0x11')][_0x9cd5('0x26')]=function(){var _0xd94baf=this;setInterval(function(){_0xd94baf[_0x9cd5('0x68')]();},0x7cf);};Preview['prototype'][_0x9cd5('0x68')]=function(){var _0x58ae2e=this[_0x9cd5('0x27')];this[_0x9cd5('0x19')]+=0x1;for(var _0xaa50a in _0x58ae2e){if(_0x58ae2e[_0x9cd5('0x69')](_0xaa50a)&&(_0x58ae2e[_0xaa50a][_0x9cd5('0x38')]==='preview'||_0x58ae2e[_0xaa50a][_0x9cd5('0x38')]===_0x9cd5('0x6a'))&&_0x58ae2e[_0xaa50a][_0x9cd5('0x29')]==='outbound'){if(this[_0x9cd5('0x19')]>0x7){this[_0x9cd5('0x19')]=0x0;this[_0x9cd5('0x6b')]();}}if(_0x58ae2e[_0x9cd5('0x69')](_0xaa50a)&&_0x58ae2e[_0xaa50a]['dialMethod']===_0x9cd5('0x8')&&_0x58ae2e[_0xaa50a][_0x9cd5('0x29')]===_0x9cd5('0x2a')){if(_0x58ae2e[_0xaa50a][_0x9cd5('0x37')]){this[_0x9cd5('0x6c')](_0x58ae2e[_0xaa50a]);if(_0x58ae2e[_0xaa50a][_0x9cd5('0x6d')])this[_0x9cd5('0x6e')](_0x58ae2e[_0xaa50a]);}else{notSendMessagesQueue(_0x58ae2e[_0xaa50a]);}}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x6f')]=function(_0x200d64){var _0x3962c2=this;this[_0x9cd5('0x15')][_0x9cd5('0x12')](function(){if(!_[_0x9cd5('0x70')](_0x3962c2[_0x9cd5('0x17')][_0x200d64])){loggerAction[_0x9cd5('0x5b')](_0x9cd5('0x71'),_0x200d64,_0x9cd5('0x72'),_0x3962c2['actions'][_0x200d64][_0x9cd5('0x73')],_0x9cd5('0x74'),JSON[_0x9cd5('0x59')](_0x3962c2[_0x9cd5('0x27')][_0x3962c2['actions'][_0x200d64][_0x9cd5('0x73')]][_0x9cd5('0x50')]),'pTalking:\x20',JSON[_0x9cd5('0x59')](_0x3962c2[_0x9cd5('0x27')][_0x3962c2[_0x9cd5('0x17')][_0x200d64][_0x9cd5('0x73')]][_0x9cd5('0x2f')]),JSON[_0x9cd5('0x59')](_0x3962c2[_0x9cd5('0x17')][_0x200d64][_0x9cd5('0x75')]),JSON['stringify'](_['pick'](_0x3962c2[_0x9cd5('0x17')][_0x200d64],[_0x9cd5('0x76'),_0x9cd5('0x77'),_0x9cd5('0x78'),'ListId'])));return ami[_0x9cd5('0x79')]({'action':'status','channel':_0x3962c2['actions'][_0x200d64][_0x9cd5('0x7a')]})[_0x9cd5('0x7b')](function(_0x34c5eb){if(_0x34c5eb['message']===_0x9cd5('0x7c')){setTimeout(function(){if(_0x3962c2[_0x9cd5('0x17')][_0x200d64]){ut[_0x9cd5('0x7d')](_0x3962c2[_0x9cd5('0x27')][_0x3962c2[_0x9cd5('0x17')][_0x200d64][_0x9cd5('0x73')]],'[clearZombieChannel]');if(_0x3962c2['actions'][_0x200d64][_0x9cd5('0x75')]===!![]){ut[_0x9cd5('0x7e')](_0x3962c2[_0x9cd5('0x27')][_0x3962c2[_0x9cd5('0x17')][_0x200d64][_0x9cd5('0x73')]],'[clearZombieChannel]');ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x200d64,_0x3962c2['actions'][_0x200d64][_0x9cd5('0x73')]);}ut[_0x9cd5('0x7f')](_0x9cd5('0x80')+_0x200d64,_0x3962c2[_0x9cd5('0x17')][_0x200d64][_0x9cd5('0x73')]);delete _0x3962c2[_0x9cd5('0x17')][_0x200d64];}},0x2328);}});}});};Preview[_0x9cd5('0x11')][_0x9cd5('0x6b')]=function(){var _0x1249a7=this;loggerAction[_0x9cd5('0x5b')](_0x9cd5('0x81'),_[_0x9cd5('0x82')](this[_0x9cd5('0x17')]));for(var _0x3a15af in this['actions']){if(_0x1249a7[_0x9cd5('0x17')][_0x9cd5('0x69')](_0x3a15af)){_0x1249a7['clearZombieChannel'](_0x3a15af);}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x6e')]=function(_0xf73845){var _0x1c1812=this;rpcDb[_0x9cd5('0x83')](_0xf73845['id'],ut[_0x9cd5('0x84')](this[_0x9cd5('0x18')]))['then'](function(_0x538ffa){if(!_[_0x9cd5('0x70')](_0x538ffa)){for(var _0x472456=0x0;_0x472456<_0x538ffa[_0x9cd5('0x85')];_0x472456+=0x1){if(ut[_0x9cd5('0x86')](_0x538ffa[_0x472456][_0x9cd5('0x87')])<_0xf73845[_0x9cd5('0x88')]*0x3c){if(_0x538ffa[_0x472456][_0x9cd5('0x89')]&&!_0x538ffa[_0x472456][_0x9cd5('0x89')][_0x9cd5('0x8a')]){_0x1c1812[_0x9cd5('0x8b')](_0x538ffa[_0x472456]['id'])[_0x9cd5('0x8c')](ut[_0x9cd5('0x8d')](_0x9cd5('0x8e')))[_0x9cd5('0x7b')](ut['logger2']('[RecallMe]'));}else{rpcDb[_0x9cd5('0x8f')](_0x538ffa[_0x472456]['id']);}}else{var _0x94de58=new Action(_0x538ffa[_0x472456],_0xf73845);_0x94de58[_0x9cd5('0x90')]=moment()['format'](_0x9cd5('0x91'));_0xf73845['outboundReCallsDay']+=0x1;ut[_0x9cd5('0x92')](_0x94de58,0x17,_0x9cd5('0x93'));if(_0xf73845[_0x9cd5('0x94')]){rpcDb['rescheduleContactInQueue'](ut[_0x9cd5('0x95')](_0x538ffa[_0x472456]));rpcDb[_0x9cd5('0x96')](_0x94de58,_0x9cd5('0x97'));}else{ut[_0x9cd5('0x92')](_0x94de58,0x16,_0x9cd5('0x98'));rpcDb['createCustomerHistory'](_0x94de58,_0x9cd5('0x99'));rpcDb['createCustomerFinal'](_0x94de58,_0x9cd5('0x99'));}}}}})['catch'](ut[_0x9cd5('0x8d')](_0x9cd5('0x9a')));};Preview[_0x9cd5('0x11')][_0x9cd5('0x6c')]=function(_0x50c6fb){_0x50c6fb[_0x9cd5('0x5f')]=!![];if(ut[_0x9cd5('0x9b')](_0x50c6fb[_0x9cd5('0x2e')])){_0x50c6fb[_0x9cd5('0x61')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x9cd5('0x9c')](_0x50c6fb[_0x9cd5('0x37')])){_0x50c6fb['message']=_0x9cd5('0x62');}else if(!this[_0x9cd5('0x9d')](_0x50c6fb[_0x9cd5('0x55')])){if(!this[_0x9cd5('0x9d')](_0x50c6fb[_0x9cd5('0x9e')])){_0x50c6fb['message']=_0x9cd5('0x9f');}else{_0x50c6fb[_0x9cd5('0x61')]=_0x9cd5('0xa0');}}else{_0x50c6fb[_0x9cd5('0x61')]=_0x9cd5('0xa0');}emitCampaignPreview(_0x50c6fb);};Preview[_0x9cd5('0x11')][_0x9cd5('0xa1')]=function(_0x35120d,_0x1b037f,_0x5d0599){var _0x1b00d4=this;var _0x3b715e=this['actions'][_0x1b037f];var _0x4baea3=this[_0x9cd5('0x27')][_0x3b715e[_0x9cd5('0x73')]];var _0x594544;if(_0x4baea3){switch(_0x5d0599){case'1':_0x4baea3['outboundNoSuchCallsDay']+=0x1;_0x3b715e[_0x9cd5('0xa2')]+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x0,'NoSuchNumber');ami['emit'](_0x9cd5('0xa5'),ut[_0x9cd5('0xa6')](_0x3b715e,_0x9cd5('0xa7')));rpcDb[_0x9cd5('0x96')](_0x3b715e,_0x9cd5('0xa8'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3[_0x9cd5('0xa9')]){_0x594544=ut[_0x9cd5('0xaa')](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb['createCustomerFinal'](_0x594544,_0x9cd5('0xac'));}else{if(_0x3b715e['countnosuchnumberretry']>=_0x4baea3[_0x9cd5('0xad')]){rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xac'));}else{rpcDb[_0x9cd5('0xaf')](ut['scheduledAt'](_0x3b715e,_0x9cd5('0xa2'),_0x4baea3['dialNoSuchNumberRetryFrequency']),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}delete this[_0x9cd5('0x17')][_0x35120d[_0x9cd5('0xb2')]];break;case'ANSWER':var _0x3c7cc4=moment()[_0x9cd5('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b715e[_0x9cd5('0xb3')]=_0x3c7cc4;_0x3b715e['answertime']=_0x3c7cc4;_0x3b715e[_0x9cd5('0x75')]=!![];_0x4baea3['pTalking']+=0x1;logger['info'](_0x9cd5('0xb4'),_0x3b715e[_0x9cd5('0xb5')],_0x9cd5('0xb6'),_0x4baea3[_0x9cd5('0x2b')],_0x9cd5('0xb7'),_0x4baea3[_0x9cd5('0x2f')]);ami['emit'](_0x9cd5('0xb8'),ut[_0x9cd5('0xa6')](_0x3b715e,_0x9cd5('0xb9'),this['campaignsPreview'][_0x3b715e['queue']]));if(_0x4baea3[_0x9cd5('0xba')]){ami[_0x9cd5('0x28')](_0x9cd5('0xbb'),ut[_0x9cd5('0xbc')](_0x3b715e));}break;case'16':ami[_0x9cd5('0x28')](_0x9cd5('0xbd'),ut[_0x9cd5('0xa6')](_0x3b715e,_0x9cd5('0xbe'),this[_0x9cd5('0x27')][_0x3b715e[_0x9cd5('0x73')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x3b715e,_0x9cd5('0xbe')));_0x4baea3['outboundAnswerCallsDay']+=0x1;_0x4baea3[_0x9cd5('0x33')]+=0x1;_0x4baea3[_0x9cd5('0xbf')]+=0x1;ut[_0x9cd5('0x7e')](_0x4baea3,'[16]');_0x3b715e[_0x9cd5('0xa3')]=ut['totalGlobal'](_0x3b715e);ut['logCustomer'](_0x3b715e,0x4,_0x9cd5('0xc0'));rpcDb[_0x9cd5('0x96')](_0x3b715e,_0x9cd5('0xc1'));rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xc2'));rpcDb[_0x9cd5('0xc3')](_0x3b715e);_0x4baea3['sumDuration']+=_0x3b715e[_0x9cd5('0xc4')];_0x4baea3[_0x9cd5('0x30')]+=_0x3b715e[_0x9cd5('0xc4')];logger[_0x9cd5('0x5b')]('[syncHangup][talking][decrement]',_0x3b715e[_0x9cd5('0xb5')],_0x9cd5('0xb6'),_0x4baea3[_0x9cd5('0x2b')],_0x9cd5('0xb7'),_0x4baea3[_0x9cd5('0x2f')]);delete this['actions'][_0x35120d[_0x9cd5('0xb2')]];break;case _0x9cd5('0xc5'):_0x4baea3[_0x9cd5('0x3c')]+=0x1;_0x3b715e[_0x9cd5('0xc6')]+=0x1;_0x3b715e['countglobal']=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x5,_0x9cd5('0xc7'));ami[_0x9cd5('0x28')](_0x9cd5('0xc8'),ut[_0x9cd5('0xa6')](_0x3b715e,'busy'));rpcDb[_0x9cd5('0x96')](_0x3b715e,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3['dialGlobalMaxRetry']){_0x594544=ut[_0x9cd5('0xaa')](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb[_0x9cd5('0xae')](_0x594544,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x3b715e[_0x9cd5('0xc6')]>=_0x4baea3['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x3b715e,_0x9cd5('0xc9'));}else{rpcDb[_0x9cd5('0xaf')](ut[_0x9cd5('0xca')](_0x3b715e,'countbusyretry',_0x4baea3[_0x9cd5('0xcb')]),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}break;case _0x9cd5('0xcc'):_0x4baea3[_0x9cd5('0x40')]+=0x1;_0x3b715e['countnoanswerretry']+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x3,_0x9cd5('0xcd'));ami['emit'](_0x9cd5('0xce'),ut[_0x9cd5('0xa6')](_0x3b715e,_0x9cd5('0xcf')));rpcDb['createCustomerHistory'](_0x3b715e,_0x9cd5('0xd0'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3['dialGlobalMaxRetry']){_0x594544=ut['cloneAction'](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb['createCustomerFinal'](_0x594544,_0x9cd5('0xd1'));}else{if(_0x3b715e['countnoanswerretry']>=_0x4baea3[_0x9cd5('0xd2')]){rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xd0'));}else{rpcDb['rescheduleContact'](ut[_0x9cd5('0xca')](_0x3b715e,'countnoanswerretry',_0x4baea3[_0x9cd5('0xd3')]),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}break;case _0x9cd5('0xd4'):_0x4baea3['outboundCongestionCallsDay']+=0x1;_0x3b715e['countcongestionretry']+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x8,_0x9cd5('0xd5'));ami[_0x9cd5('0x28')]('custom:agentcongestion',ut['buildObj'](_0x3b715e,_0x9cd5('0xd6')));rpcDb['createCustomerHistory'](_0x3b715e,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3['dialGlobalMaxRetry']){_0x594544=ut[_0x9cd5('0xaa')](_0x3b715e,0xf,'Global');rpcDb[_0x9cd5('0xae')](_0x594544,_0x9cd5('0xd7'));}else{if(_0x3b715e[_0x9cd5('0xd8')]>=_0x4baea3[_0x9cd5('0xd9')]){rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xda'));}else{rpcDb[_0x9cd5('0xaf')](ut[_0x9cd5('0xca')](_0x3b715e,_0x9cd5('0xd8'),_0x4baea3[_0x9cd5('0xcb')]),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}break;case _0x9cd5('0xdb'):_0x4baea3[_0x9cd5('0x44')]+=0x1;_0x3b715e[_0x9cd5('0xdc')]+=0x1;_0x3b715e['countglobal']=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x14,'AgentReject');ami[_0x9cd5('0x28')](_0x9cd5('0xdd'),ut[_0x9cd5('0xa6')](_0x3b715e,_0x9cd5('0xde')));rpcDb[_0x9cd5('0x96')](_0x3b715e,_0x9cd5('0xdf'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3['dialGlobalMaxRetry']){_0x594544=ut[_0x9cd5('0xaa')](_0x3b715e,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x594544,_0x9cd5('0xe0'));}else{if(_0x3b715e[_0x9cd5('0xdc')]>=_0x4baea3[_0x9cd5('0xe1')]){rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xe0'));}else{rpcDb[_0x9cd5('0xaf')](ut['scheduledAt'](_0x3b715e,_0x9cd5('0xdc'),_0x4baea3[_0x9cd5('0xe2')]),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}break;case _0x9cd5('0xe3'):_0x4baea3[_0x9cd5('0x46')]+=0x1;_0x3b715e[_0x9cd5('0xe4')]+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut['totalGlobal'](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0xb,_0x9cd5('0xe5'));rpcDb[_0x9cd5('0x96')](_0x3b715e,_0x9cd5('0xe6'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3[_0x9cd5('0xa9')]){_0x594544=ut['cloneAction'](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb['createCustomerFinal'](_0x594544,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3b715e[_0x9cd5('0xe7')]>=_0x4baea3[_0x9cd5('0xe8')]){rpcDb['createCustomerFinal'](_0x3b715e,_0x9cd5('0xe6'));}else{rpcDb[_0x9cd5('0xaf')](ut[_0x9cd5('0xca')](_0x3b715e,_0x9cd5('0xe4'),_0x4baea3[_0x9cd5('0xe9')]),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}break;case'18':_0x4baea3[_0x9cd5('0x45')]+=0x1;_0x3b715e[_0x9cd5('0xea')]+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x12,_0x35120d['cause-txt']||_0x35120d['dialstatus']);ami[_0x9cd5('0x28')](_0x9cd5('0xeb'),ut['buildObj'](_0x3b715e,_0x9cd5('0xec')));rpcDb['createCustomerHistory'](_0x3b715e,_0x9cd5('0xed'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3['dialGlobalMaxRetry']){_0x594544=ut['cloneAction'](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb[_0x9cd5('0xae')](_0x594544,_0x9cd5('0xed'));}else{rpcDb[_0x9cd5('0xae')](_0x3b715e,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x9cd5('0x17')][_0x35120d['linkedid']];break;case'19':_0x4baea3[_0x9cd5('0x45')]+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut['logCustomer'](_0x3b715e,0x13,_0x35120d['cause-txt']||_0x35120d[_0x9cd5('0xee')]);ami[_0x9cd5('0x28')](_0x9cd5('0xeb'),ut['buildObj'](_0x3b715e,_0x9cd5('0xec')));rpcDb[_0x9cd5('0x96')](_0x3b715e,_0x9cd5('0xef'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3[_0x9cd5('0xa9')]){_0x594544=ut[_0x9cd5('0xaa')](_0x3b715e,0xf,'Global');rpcDb[_0x9cd5('0xae')](_0x594544,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xef'));}delete this[_0x9cd5('0x17')][_0x35120d['linkedid']];break;default:if(_0x3b715e['dialAnswer']){ut[_0x9cd5('0x7e')](_0x4baea3,_0x9cd5('0xf0'));ut['loggerError'](_0x9cd5('0xf1')+_0x4baea3[_0x9cd5('0x2b')],_0x35120d);}_0x4baea3['outboundUnknownCallsDay']+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0xc,_0x35120d[_0x9cd5('0xf2')]||_0x35120d['dialstatus']);rpcDb[_0x9cd5('0x96')](_0x3b715e,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x3b715e)>=_0x4baea3[_0x9cd5('0xa9')]){_0x594544=ut['cloneAction'](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb[_0x9cd5('0xae')](_0x594544,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x9cd5('0xae')](_0x3b715e,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x9cd5('0x17')][_0x35120d[_0x9cd5('0xb2')]];}if(!(_0x3b715e[_0x9cd5('0x75')]&&_0x5d0599==='16')){ut['updateOriginated'](_0x4baea3,_0x9cd5('0xf3'));logger[_0x9cd5('0x5b')]('[originated][decrement][callProgressDetectingCustomer]',_0x3b715e[_0x9cd5('0xb5')],_0x9cd5('0xb6'),_0x4baea3[_0x9cd5('0x2b')],'originated:\x20',_0x4baea3['originated']);}if(_0x5d0599!==_0x9cd5('0xf4')){delete this['actions'][_0x35120d['linkedid']];delete this[_0x9cd5('0x17')][_0x35120d['destlinkedid']];}}};Preview[_0x9cd5('0x11')][_0x9cd5('0xf5')]=function(_0x5e8757,_0x58fc27,_0x4b2713){if(_[_0x9cd5('0xf6')](_0x58fc27)&&_0x9cd5('0xf7')!==typeof _0x58fc27){return;}if(_['isUndefined'](_0x4b2713)&&_0x9cd5('0xf7')!==typeof _0x4b2713){return;}switch(_0x4b2713[_0x9cd5('0xf8')]){case'0':ut[_0x9cd5('0xf9')](_0x5e8757,0x0,_0x9cd5('0xfa'));rpcDb[_0x9cd5('0xfb')](_0x5e8757,_0x9cd5('0xfc'));break;case'3':ut['logAgent'](_0x5e8757,0x3,'NoAnswer');rpcDb[_0x9cd5('0xfb')](_0x5e8757,_0x9cd5('0xfd'));break;case'5':ut['logAgent'](_0x5e8757,0x5,_0x9cd5('0xc7'));rpcDb[_0x9cd5('0xfb')](_0x5e8757,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x9cd5('0xf9')](_0x5e8757,0x8,'Congestion');rpcDb[_0x9cd5('0xfb')](_0x5e8757,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x5e8757,0x16,_0x9cd5('0xfe'));rpcDb['createAgentHistory'](_0x5e8757,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x5e8757,0xc,_0x4b2713['reason']);rpcDb[_0x9cd5('0xfb')](_0x5e8757,'[callProgressDetectingAgent][logCongestion]');}ut[_0x9cd5('0x7d')](_0x58fc27,_0x9cd5('0xff'));logger[_0x9cd5('0x5b')](_0x9cd5('0x100'),_0x5e8757['uniqueid'],_0x9cd5('0xb6'),_0x58fc27['name'],_0x9cd5('0x74'),_0x58fc27[_0x9cd5('0x50')]);delete this[_0x9cd5('0x17')][_0x5e8757[_0x9cd5('0xb5')]];};Preview['prototype'][_0x9cd5('0x101')]=function(_0x12db08,_0x352f5c,_0x1545c3,_0x1f35d5,_0x265077){var _0xd813e=this;return new BPromise(function(_0x4bbae2,_0x504ae9){if(_[_0x9cd5('0x70')](_0x352f5c)||_['isNil'](_0x352f5c[_0x9cd5('0x102')])||_[_0x9cd5('0x70')](_0x352f5c['Contact']['phone'])||_[_0x9cd5('0x70')](_0x352f5c['VoiceQueueId'])){_0x504ae9(ut[_0x9cd5('0x61')](_0x9cd5('0x103'),_0x1f35d5,_0x265077));return;}var _0x54566d=uuid['v4']();var _0x373644=_0xd813e[_0x9cd5('0x27')][_0x352f5c[_0x9cd5('0x72')][_0x9cd5('0x2b')]];var _0xaba61a=_0x1545c3?_0xd813e[_0x9cd5('0x18')][_0x1545c3]['id']:undefined;_0xd813e[_0x9cd5('0x17')][_0x54566d]=new Action(_0x352f5c,_0x373644,_0x54566d,_0x1545c3,_0xaba61a);var _0x491ed8=_0xd813e[_0x9cd5('0x17')][_0x54566d];_0x491ed8[_0x9cd5('0xb0')]=_0x1f35d5;_0x491ed8['activeContact']=_0x265077;_0x491ed8[_0x9cd5('0x104')]=_0x1545c3;if(_[_0x9cd5('0x105')](_0x12db08)){_0xd813e[_0x9cd5('0x106')](_0x491ed8,_0x373644,_0x352f5c,_0x1545c3)[_0x9cd5('0x8c')](function(_0x36050e){logger[_0x9cd5('0x5b')](_0x9cd5('0x107'),_0x9cd5('0x108')+_0x491ed8[_0x9cd5('0x73')]+'\x20IdHopper:\x20'+_0x491ed8['idContact'],JSON[_0x9cd5('0x59')](_0x36050e));ami[_0x9cd5('0x28')](_0x9cd5('0x109'),ut[_0x9cd5('0xa6')](_0x491ed8,_0x9cd5('0x10a'),_0xd813e[_0x9cd5('0x27')][_0x491ed8[_0x9cd5('0x73')]]));_0x4bbae2(ut[_0x9cd5('0x61')]('Calling'));})[_0x9cd5('0x7b')](function(_0x23cab8){ut[_0x9cd5('0x63')](_0x9cd5('0x10b'),_0x23cab8);_0x504ae9(ut[_0x9cd5('0x61')](_0x9cd5('0x10c'),_0x1f35d5,_0x265077));});}else{_0x373644[_0x9cd5('0x3b')]+=0x1;ut[_0x9cd5('0x10d')](_0x491ed8);rpcDb[_0x9cd5('0x10e')](_0x491ed8,_0x9cd5('0x10f'));delete _0xd813e[_0x9cd5('0x17')][_0x54566d];_0x504ae9(ut[_0x9cd5('0x61')](_0x9cd5('0x110'),_0x1f35d5,_0x265077));}});};Preview[_0x9cd5('0x11')][_0x9cd5('0x9d')]=function(_0x56c8a7){return!_[_0x9cd5('0x70')](_0x56c8a7)&&!_[_0x9cd5('0x70')](_0x56c8a7[_0x9cd5('0x2b')])&&!_[_0x9cd5('0x70')](_0x56c8a7[_0x9cd5('0x56')])&&_0x56c8a7['active']&&!_['isNil'](this[_0x9cd5('0x16')][util[_0x9cd5('0x5c')](_0x9cd5('0x111'),_0x56c8a7[_0x9cd5('0x2b')])])&&!_[_0x9cd5('0x70')](this[_0x9cd5('0x16')][util['format'](_0x9cd5('0x111'),_0x56c8a7['name'])][_0x9cd5('0x112')])&&(this[_0x9cd5('0x16')][util[_0x9cd5('0x5c')](_0x9cd5('0x111'),_0x56c8a7['name'])][_0x9cd5('0x112')]===_0x9cd5('0x113')||this['trunks'][util[_0x9cd5('0x5c')](_0x9cd5('0x111'),_0x56c8a7[_0x9cd5('0x2b')])]['status']===_0x9cd5('0x114'));};Preview[_0x9cd5('0x11')][_0x9cd5('0x8b')]=function(_0x502a08,_0x50f4b1){var _0x90a557=this;return new BPromise(function(_0x348da2,_0x4075e4){_0x90a557[_0x9cd5('0x115')](_0x502a08,_0x50f4b1)[_0x9cd5('0x8c')](function(_0x57dd6b){_0x348da2(_[_0x9cd5('0x116')](_0x57dd6b,['message']));})[_0x9cd5('0x7b')](function(_0x10b392){if(_0x10b392[_0x9cd5('0x117')]){rpcDb['unlockContact'](_0x502a08);}if(_0x10b392[_0x9cd5('0x56')]){rpcDb[_0x9cd5('0x8f')](_0x502a08);}_0x4075e4(_[_0x9cd5('0x116')](_0x10b392,[_0x9cd5('0x61')]));});});};Preview[_0x9cd5('0x11')][_0x9cd5('0x115')]=function(_0x15e4a9,_0x5e1dca){var _0x3a23b5=this;return new BPromise(function(_0x4a32c3,_0x19ecae){var _0x177bc7,_0x1f9289;rpcDb[_0x9cd5('0x118')](_0x15e4a9)[_0x9cd5('0x8c')](function(_0x2e0b58){if(!_['isNil'](_0x2e0b58[0x0])){_0x1f9289=_0x2e0b58[0x0][_0x9cd5('0x119')]?![]:!![];_0x177bc7=_0x2e0b58[0x0]['recallme']?!![]:![];_0x177bc7=_0x5e1dca?!![]:_0x177bc7;}var _0x93835a=_0x3a23b5[_0x9cd5('0x11a')](_0x2e0b58);if(_0x93835a[_0x9cd5('0x11b')]){rpcDb[_0x9cd5('0x11c')](_['pick'](_0x2e0b58[0x0],['VoiceQueueId',_0x9cd5('0x11d')]))[_0x9cd5('0x8c')](function(_0x2817a3){_0x3a23b5['checkInBlack'](_0x2817a3,_0x2e0b58[0x0],_0x5e1dca,_0x1f9289,_0x177bc7)[_0x9cd5('0x8c')](function(_0x1dc65b){_0x4a32c3(_0x1dc65b);})[_0x9cd5('0x7b')](function(_0x410378){_0x19ecae(_0x410378);});})[_0x9cd5('0x7b')](function(_0x170915){ut[_0x9cd5('0x63')](_0x9cd5('0x11e'),_0x170915);_0x19ecae(ut[_0x9cd5('0x61')]('Call\x20unsuccessful',_0x1f9289,_0x177bc7));});}else{_0x19ecae(ut[_0x9cd5('0x61')](_0x93835a[_0x9cd5('0x61')],_0x1f9289,_0x177bc7));}})[_0x9cd5('0x7b')](function(_0xa468ec){ut[_0x9cd5('0x63')](_0x9cd5('0x11f'),_0xa468ec);_0x19ecae(ut[_0x9cd5('0x61')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x9cd5('0x11')]['validateContact']=function(_0x4e2d6b){if(_['isNil'](_0x4e2d6b)||_[_0x9cd5('0x105')](_0x4e2d6b)||!_[_0x9cd5('0x70')](_0x4e2d6b[0x0]['Agent'])&&_[_0x9cd5('0x70')](_0x4e2d6b[0x0]['Agent'][_0x9cd5('0x2b')])){ut[_0x9cd5('0x63')](_0x9cd5('0x120'),_0x4e2d6b);return{'isValid':![],'message':_0x9cd5('0x121')};}var _0x389641=this[_0x9cd5('0x27')][_0x4e2d6b[0x0][_0x9cd5('0x72')][_0x9cd5('0x2b')]];_0x389641[_0x9cd5('0x61')]=_0x9cd5('0xa0');if(_['isNil'](_0x389641)){ut[_0x9cd5('0x63')]('[Preview][validateContact][Empty\x20Campaign]',_0x389641);return{'isValid':![],'message':_0x9cd5('0x122')};}if(!this['isTrunkReachable'](_0x389641[_0x9cd5('0x55')])){ut[_0x9cd5('0x63')](_0x9cd5('0x123'),'campaign\x20Name:\x20'+_0x389641[_0x9cd5('0x2b')]+_0x9cd5('0x124'));if(!this[_0x9cd5('0x9d')](_0x389641[_0x9cd5('0x9e')])){ut[_0x9cd5('0x63')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x389641[_0x9cd5('0x2b')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x9cd5('0x125')};}}if(!ut[_0x9cd5('0x9c')](_0x389641['dialActive'])){ut[_0x9cd5('0x63')](_0x9cd5('0x126'),_0x389641['name']+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x389641[_0x9cd5('0x2b')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x9cd5('0x127')};};Preview[_0x9cd5('0x11')][_0x9cd5('0x106')]=function(_0x2a4db3,_0x57884b,_0x5a7668,_0x82bc74){var _0xbc0826=this;return new BPromise(function(_0x3515fc,_0x362e9f){var _0x39fbd1=_0x2a4db3[_0x9cd5('0xb5')];var _0x21fd2c=_0xbc0826['isTrunkReachable'](_0x57884b[_0x9cd5('0x55')])?util[_0x9cd5('0x5c')](_0x9cd5('0x128'),_0x57884b['Trunk']['name'],_[_0x9cd5('0x70')](_0x57884b[_0x9cd5('0x3a')])?'':_0x57884b['dialPrefix'][_0x9cd5('0x129')]()||'',_0x57884b[_0x9cd5('0x12a')]>0x0?_0x5a7668[_0x9cd5('0x102')][_0x9cd5('0x12b')]['substring'](_0x57884b[_0x9cd5('0x12a')]):_0x5a7668['Contact'][_0x9cd5('0x12b')]):util[_0x9cd5('0x5c')]('SIP/%s/%s%s',_[_0x9cd5('0x70')](_0x57884b[_0x9cd5('0x9e')])?_0x57884b['Trunk'][_0x9cd5('0x2b')]:_0x57884b[_0x9cd5('0x9e')]['name'],_[_0x9cd5('0x70')](_0x57884b[_0x9cd5('0x3a')])?'':_0x57884b[_0x9cd5('0x3a')][_0x9cd5('0x129')]()||'',_0x57884b[_0x9cd5('0x12a')]>0x0?_0x5a7668[_0x9cd5('0x102')][_0x9cd5('0x12b')][_0x9cd5('0x12c')](_0x57884b[_0x9cd5('0x12a')]):_0x5a7668[_0x9cd5('0x102')][_0x9cd5('0x12b')]);var _0x4c2f4c=_0xbc0826[_0x9cd5('0x9d')](_0x57884b[_0x9cd5('0x55')])?ut['getCallerId'](_0x57884b[_0x9cd5('0x55')]['callerid'],_0x57884b[_0x9cd5('0x39')],_0x57884b['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x9cd5('0x12d')](_0x57884b[_0x9cd5('0x12e')],_0x57884b[_0x9cd5('0x12f')]):_0x57884b[_0x9cd5('0x12e')]):ut[_0x9cd5('0x130')](_['isNil'](_0x57884b[_0x9cd5('0x9e')])?_0x57884b[_0x9cd5('0x55')][_0x9cd5('0x57')]:_0x57884b[_0x9cd5('0x9e')]['callerid'],_0x57884b[_0x9cd5('0x39')],_0x57884b[_0x9cd5('0x12f')]>0x0?ut[_0x9cd5('0x12d')](_0x57884b[_0x9cd5('0x12e')],_0x57884b[_0x9cd5('0x12f')]):_0x57884b[_0x9cd5('0x12e')]);if(_0x4c2f4c){_0x2a4db3[_0x9cd5('0x131')]=ut[_0x9cd5('0x132')](_0x4c2f4c);_0x2a4db3['originatecalleridnum']=ut[_0x9cd5('0x133')](_0x4c2f4c);}var _0x527732=ut['addVariables'](_0x57884b,_0x5a7668,_0x21fd2c,_0x4c2f4c,_0x39fbd1,_0x2a4db3);_[_0x9cd5('0x134')](_0x2a4db3,ut['toLowerVariables'](_0x527732));_0x2a4db3[_0x9cd5('0x90')]=moment()['format'](_0x9cd5('0x91'));ami[_0x9cd5('0x79')](ut[_0x9cd5('0x135')](_0x2a4db3,_0x57884b,_0x527732,_0x2a4db3[_0x9cd5('0xb1')],_0x82bc74))['then'](function(_0x409c70){_0x57884b['originated']+=0x1;logger[_0x9cd5('0x5b')](_0x9cd5('0x136'),_0x39fbd1,_0x9cd5('0xb6'),_0x57884b[_0x9cd5('0x2b')],_0x9cd5('0x74'),_0x57884b[_0x9cd5('0x50')]);_0x3515fc(_0x409c70);})[_0x9cd5('0x7b')](function(_0x28fb8a){ut[_0x9cd5('0xf9')](_0x2a4db3,0xe,_0x9cd5('0x137'));rpcDb['createAgentHistory'](_0x2a4db3,_0x9cd5('0x138'));_0x362e9f(_0x28fb8a);});});};Preview[_0x9cd5('0x11')][_0x9cd5('0x139')]=function(_0xd9794d){if(this['actions'][_0xd9794d[_0x9cd5('0xb2')]]){this[_0x9cd5('0x17')][_0xd9794d['linkedid']][_0x9cd5('0x7a')]=_0xd9794d[_0x9cd5('0x7a')];}};Preview[_0x9cd5('0x11')]['syncOriginateResponse']=function(_0x4c0a48){var _0x269225=this;var _0x52cf93=this[_0x9cd5('0x17')][_0x4c0a48[_0x9cd5('0x13a')]];if(_0x52cf93){if(_0x52cf93[_0x9cd5('0x104')]&&this[_0x9cd5('0x18')][_0x52cf93[_0x9cd5('0x104')]]){ut[_0x9cd5('0x13b')](_0x52cf93,this[_0x9cd5('0x18')][_0x52cf93['lookAgent']][_0x9cd5('0x2b')],this[_0x9cd5('0x18')][_0x52cf93[_0x9cd5('0x104')]]['id']);}var _0x593a89=_[_0x9cd5('0x13c')](_0x52cf93);_0x593a89['responsetime']=moment()[_0x9cd5('0x5c')](_0x9cd5('0x91'));var _0x8ddd85=_0x269225[_0x9cd5('0x27')][_0x52cf93['queue']];if(ut[_0x9cd5('0x13d')](_0x4c0a48[_0x9cd5('0x13e')])){if(_0x52cf93[_0x9cd5('0xb0')]){rpcDb[_0x9cd5('0x13f')](_0x52cf93[_0x9cd5('0x140')]);}if(_0x52cf93[_0x9cd5('0xb1')]){rpcDb[_0x9cd5('0x8f')](_0x52cf93[_0x9cd5('0x140')]);}ami[_0x9cd5('0x28')](_0x9cd5('0x141'),ut['buildObj'](_0x52cf93,_0x9cd5('0x142'),this[_0x9cd5('0x27')][_0x52cf93[_0x9cd5('0x73')]]));this['callProgressDetectingAgent'](_0x593a89,_0x8ddd85,_0x4c0a48);}else{_0x52cf93[_0x9cd5('0x90')]=moment()[_0x9cd5('0x5c')](_0x9cd5('0x91'));ut['logAgent'](_0x593a89,0x4,_0x9cd5('0xc0'));rpcDb['createAgentHistory'](_0x593a89,_0x9cd5('0x143'));}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x144')]=function(_0x2ce635){var _0x2bac68=this;var _0x1bf315=this[_0x9cd5('0x17')][_0x2ce635[_0x9cd5('0xb2')]];var _0x252b20;if(_0x1bf315){_0x252b20=this[_0x9cd5('0x27')][_0x1bf315[_0x9cd5('0x73')]];logger[_0x9cd5('0x5b')]('[syncHangup][talking]',_0x2ce635[_0x9cd5('0xb2')],_0x9cd5('0xb6'),_0x252b20[_0x9cd5('0x2b')],_0x9cd5('0xb7'),_0x252b20['pTalking']);}if(this['actions'][_0x2ce635[_0x9cd5('0xb2')]]&&_0x2ce635[_0x9cd5('0xb2')]!==_0x2ce635[_0x9cd5('0xb5')]){if(_0x2ce635[_0x9cd5('0x145')]==='16'&&this[_0x9cd5('0x17')][_0x2ce635[_0x9cd5('0xb2')]][_0x9cd5('0x75')]){this[_0x9cd5('0xa1')](_0x2ce635,_0x2ce635[_0x9cd5('0xb2')],_0x2ce635[_0x9cd5('0x145')]);}else if(this[_0x9cd5('0x17')][_0x2ce635[_0x9cd5('0xb2')]][_0x9cd5('0x75')]){logger[_0x9cd5('0x5b')](_0x9cd5('0x146'),_0x2ce635[_0x9cd5('0xb2')],_0x2ce635[_0x9cd5('0x145')],_0x9cd5('0xb6'),_0x252b20[_0x9cd5('0x2b')],'pTalking:\x20',_0x252b20[_0x9cd5('0x2f')]);this[_0x9cd5('0xa1')](_0x2ce635,_0x2ce635[_0x9cd5('0xb2')],_0x2ce635['cause']);}}else if(_0x1bf315&&_[_0x9cd5('0x70')](_0x1bf315['statedesc'])&&_0x252b20[_0x9cd5('0x147')]&&_0x2ce635['linkedid']===_0x2ce635[_0x9cd5('0xb5')]&&_[_0x9cd5('0x70')](_0x2ce635['reason'])&&_0x2ce635['cause']==='16'&&_0x2ce635['channelstate']==='6'&&_[_0x9cd5('0xf6')](_0x1bf315[_0x9cd5('0x148')])){if(_0x1bf315['unlockAgent']){rpcDb[_0x9cd5('0x13f')](_0x1bf315[_0x9cd5('0x140')]);}if(_0x1bf315[_0x9cd5('0xb1')]){rpcDb[_0x9cd5('0x8f')](_0x1bf315[_0x9cd5('0x140')]);}_0x2ce635[_0x9cd5('0xf8')]='22';this['callProgressDetectingAgent'](_0x1bf315,_0x252b20,_0x2ce635);}else if(_0x1bf315&&_0x1bf315[_0x9cd5('0x148')]){if(_0x2ce635[_0x9cd5('0x145')]==='16'&&this[_0x9cd5('0x17')][_0x2ce635[_0x9cd5('0xb2')]]['dialAnswer']){logger[_0x9cd5('0x5b')](_0x9cd5('0x149'),_0x2ce635[_0x9cd5('0xb2')],_0x2ce635['cause'],_0x9cd5('0xb6'),_0x252b20[_0x9cd5('0x2b')],'pTalking:\x20',_0x252b20[_0x9cd5('0x2f')]);this[_0x9cd5('0xa1')](_0x2ce635,_0x2ce635['linkedid'],_0x2ce635[_0x9cd5('0x145')]);}else if(this[_0x9cd5('0x17')][_0x2ce635['linkedid']]['dialAnswer']){logger[_0x9cd5('0x5b')]('[syncHangup][talking][cause]',_0x2ce635[_0x9cd5('0xb2')],_0x2ce635[_0x9cd5('0x145')],_0x9cd5('0xb6'),_0x252b20[_0x9cd5('0x2b')],_0x9cd5('0xb7'),_0x252b20[_0x9cd5('0x2f')]);this[_0x9cd5('0xa1')](_0x2ce635,_0x2ce635['linkedid'],_0x2ce635[_0x9cd5('0x145')]);}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x1e')]=function(_0x5cc594){if(this[_0x9cd5('0x17')][_0x5cc594['destlinkedid']]&&_0x5cc594[_0x9cd5('0x14a')]!==_0x5cc594[_0x9cd5('0x14b')]){this[_0x9cd5('0xa1')](_0x5cc594,_0x5cc594[_0x9cd5('0x14a')],_0x5cc594[_0x9cd5('0xee')]);}};Preview['prototype'][_0x9cd5('0x1d')]=function(_0x5f2a06){if(this[_0x9cd5('0x17')][_0x5f2a06[_0x9cd5('0xb2')]]&&_0x5f2a06['linkedid']!==_0x5f2a06[_0x9cd5('0xb5')]&&!this['actions'][_0x5f2a06['linkedid']][_0x9cd5('0x75')]){if(_0x5f2a06[_0x9cd5('0x145')]==='1'){this[_0x9cd5('0xa1')](_0x5f2a06,_0x5f2a06[_0x9cd5('0xb2')],_0x5f2a06[_0x9cd5('0x145')]);}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x14c')]=function(_0x53e1ef,_0xfe62d1,_0x2fd2d2){if(this['actions'][_0x53e1ef]){if(_[_0x9cd5('0x70')](this[_0x9cd5('0x17')][_0x53e1ef][_0x9cd5('0x14d')])){this[_0x9cd5('0x17')][_0x53e1ef][_0x9cd5('0x14d')]={};}this[_0x9cd5('0x17')][_0x53e1ef][_0x9cd5('0x14d')][_0xfe62d1]=_0x2fd2d2;}};Preview[_0x9cd5('0x11')]['syncVarSet']=function(_0x150c19){try{if(!_[_0x9cd5('0x70')](_0x150c19)){if(ut['filterKey'](_[_0x9cd5('0x14e')](_0x150c19[_0x9cd5('0x14f')])[0x0])){this[_0x9cd5('0x14c')](_0x150c19[_0x9cd5('0xb5')],_['keys'](_0x150c19[_0x9cd5('0x14f')])[0x0],_0x150c19[_0x9cd5('0x150')]);}}}catch(_0x127652){logger[_0x9cd5('0x151')](_0x9cd5('0x152'),util['inspect'](_0x127652,{'showHidden':![],'depth':null}));}};Preview[_0x9cd5('0x11')][_0x9cd5('0x23')]=function(_0x36b8b2){if(_0x36b8b2){if(this[_0x9cd5('0x17')][_0x36b8b2[_0x9cd5('0x153')]]){this[_0x9cd5('0x17')][_0x36b8b2[_0x9cd5('0x153')]][_0x9cd5('0x148')]=!![];}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x25')]=function(_0x56d272){if(_0x56d272){if(this[_0x9cd5('0x17')][_0x56d272[_0x9cd5('0x154')]]){this[_0x9cd5('0x17')][_0x56d272[_0x9cd5('0x154')]]['transfer']=!![];}}};module[_0x9cd5('0x155')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 0bab4a6..7a4de4f 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 _0x47a7=['xcally-motion-preview','assigned','queuecallerexitreason','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','[createHistory]\x20','then','catch','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','UserId','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','connectedlinename','context','from-sip','exten'];(function(_0x3ffd77,_0x81000d){var _0x4a3474=function(_0x95588e){while(--_0x95588e){_0x3ffd77['push'](_0x3ffd77['shift']());}};_0x4a3474(++_0x81000d);}(_0x47a7,0x1a7));var _0x747a=function(_0x1c364b,_0x2262d5){_0x1c364b=_0x1c364b-0x0;var _0x21b48e=_0x47a7[_0x1c364b];return _0x21b48e;};'use strict';var util=require(_0x747a('0x0'));var BPromise=require(_0x747a('0x1'));var logger=require(_0x747a('0x2'))(_0x747a('0x3'));var _=require(_0x747a('0x4'));var cmHopper=require(_0x747a('0x5'));var cmHopperFinal=require(_0x747a('0x6'));var cmHopperHistory=require(_0x747a('0x7'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x747a('0x8'));var agentReportPreview=require(_0x747a('0x9'));var voiceQueueReport=require(_0x747a('0xa'));function loggerCatch(_0x393a0e){return function(_0x553a29){logger[_0x747a('0xb')](_0x393a0e,util[_0x747a('0xc')](_0x553a29,{'showHidden':![],'depth':null}));};}function create(_0x5bfa55){return BPromise[_0x747a('0xd')]()['then'](cmHopperHistory[_0x747a('0xe')](_0x5bfa55))['catch'](loggerCatch(_0x747a('0xf')));}function createAgent(_0xa6e62a){return BPromise[_0x747a('0xd')]()[_0x747a('0x10')](agentReportPreview['createHistory'](_0xa6e62a))[_0x747a('0x11')](loggerCatch('[createHistory]\x20'));}function moveContact(_0xea413c){return BPromise[_0x747a('0xd')]()[_0x747a('0x10')](cmHopper['moveContactManagedDialer'](_0xea413c,!![]))[_0x747a('0x11')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x747a('0x12')]=function(_0x3637df){return BPromise[_0x747a('0xd')]()['then'](cmHopperBlack[_0x747a('0x12')](_0x3637df))['catch'](loggerCatch(_0x747a('0x13')));};exports[_0x747a('0x14')]=function(_0x586d22){return BPromise[_0x747a('0xd')]()[_0x747a('0x10')](cmHopper[_0x747a('0x14')](_0x586d22))[_0x747a('0x11')](loggerCatch(_0x747a('0x15')));};exports[_0x747a('0xe')]=function(_0x3a52b6,_0x52810b){create(_0x3a52b6)[_0x747a('0x11')](loggerCatch(_0x52810b));moveContact(_0x3a52b6)['catch'](loggerCatch(_0x52810b));};exports['createAgentHistory']=function(_0x306677,_0x5e9ce2){createAgent(_0x306677)[_0x747a('0x11')](loggerCatch(_0x5e9ce2));};exports[_0x747a('0x16')]=function(_0x43160b,_0x2e75c6){create(_0x43160b)[_0x747a('0x11')](loggerCatch(_0x2e75c6));};exports['createCustomerFinal']=function(_0x4772ff,_0x4a00d1){moveContact(_0x4772ff)['catch'](loggerCatch(_0x4a00d1));};exports['rescheduleContact']=function(_0x4e9c02,_0x22a0d2,_0x511502){if(_0x22a0d2){_0x4e9c02[_0x747a('0x17')]=null;}if(_0x511502){_0x4e9c02['active']=![];}return BPromise['resolve']()[_0x747a('0x10')](cmHopper[_0x747a('0x18')](_0x4e9c02))[_0x747a('0x11')](loggerCatch(_0x747a('0x19')));};exports['countReScheduled']=function(_0x23d355){return BPromise['resolve']()[_0x747a('0x10')](cmHopper[_0x747a('0x1a')](_0x23d355))['catch'](loggerCatch(_0x747a('0x1b')));};exports['unlockContact']=function(_0x176e4c){return BPromise['resolve']()[_0x747a('0x10')](cmHopper['unlockContact']({'UserId':null},_0x176e4c,0x1))[_0x747a('0x11')](loggerCatch(_0x747a('0x1c')));};exports[_0x747a('0x1d')]=function(_0x137e67){return BPromise[_0x747a('0xd')]()[_0x747a('0x10')](cmHopper[_0x747a('0x1e')]({'active':![]},_0x137e67,0x1))['catch'](loggerCatch(_0x747a('0x1f')));};exports[_0x747a('0x20')]=function(_0x4e1b66){var _0x43865b={};_0x43865b[_0x747a('0x21')]=_0x4e1b66['type'];_0x43865b['uniqueid']=_0x4e1b66['uniqueid'];_0x43865b['calleridnum']=_0x4e1b66[_0x747a('0x22')];_0x43865b[_0x747a('0x23')]=_0x4e1b66[_0x747a('0x23')];_0x43865b[_0x747a('0x24')]=_0x4e1b66[_0x747a('0x24')];_0x43865b[_0x747a('0x25')]=_0x4e1b66[_0x747a('0x26')];_0x43865b[_0x747a('0x27')]=_0x4e1b66[_0x747a('0x26')];_0x43865b['queuecallercomplete']=0x1;_0x43865b['queuecallercompleteAt']=_0x4e1b66[_0x747a('0x28')];_0x43865b[_0x747a('0x29')]=_0x4e1b66['membername'];_0x43865b[_0x747a('0x2a')]=_0x747a('0x2b');_0x43865b[_0x747a('0x2c')]=_0x747a('0x2d');_0x43865b['holdtime']=0x0;_0x43865b[_0x747a('0x2e')]=0x1;_0x43865b['lastAssignedTo']=_0x4e1b66['membername'];_0x43865b[_0x747a('0x2f')]='COMPLETED';return BPromise['resolve']()[_0x747a('0x10')](voiceQueueReport['create'](_0x43865b))[_0x747a('0x11')](loggerCatch(_0x747a('0x30')));};exports[_0x747a('0x31')]=function(_0x15069c,_0x1931fd){return BPromise[_0x747a('0xd')]()[_0x747a('0x10')](cmHopper['getContactRecallMe'](_0x15069c,_0x1931fd))[_0x747a('0x11')](loggerCatch(_0x747a('0x32')));};exports['rescheduleContactInQueue']=function(_0x126080){return BPromise[_0x747a('0xd')]()[_0x747a('0x10')](cmHopper[_0x747a('0x18')](_0x126080,!![],!![]))['catch'](loggerCatch(_0x747a('0x33')));}; \ No newline at end of file +var _0xa520=['bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueReport','error','inspect','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa520,0x1ee));var _0x0a52=function(_0x176436,_0x297dfa){_0x176436=_0x176436-0x0;var _0x250916=_0xa520[_0x176436];return _0x250916;};'use strict';var util=require(_0x0a52('0x0'));var BPromise=require(_0x0a52('0x1'));var logger=require(_0x0a52('0x2'))('preview');var _=require(_0x0a52('0x3'));var cmHopper=require(_0x0a52('0x4'));var cmHopperFinal=require(_0x0a52('0x5'));var cmHopperHistory=require(_0x0a52('0x6'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x0a52('0x7'));function loggerCatch(_0x22461d){return function(_0x222fe1){logger[_0x0a52('0x8')](_0x22461d,util[_0x0a52('0x9')](_0x222fe1,{'showHidden':![],'depth':null}));};}function create(_0x2d2b55){return BPromise['resolve']()[_0x0a52('0xa')](cmHopperHistory[_0x0a52('0xb')](_0x2d2b55))[_0x0a52('0xc')](loggerCatch(_0x0a52('0xd')));}function createAgent(_0x48775a){return BPromise['resolve']()[_0x0a52('0xa')](agentReportPreview[_0x0a52('0xb')](_0x48775a))[_0x0a52('0xc')](loggerCatch(_0x0a52('0xd')));}function moveContact(_0x4be18e){return BPromise[_0x0a52('0xe')]()[_0x0a52('0xa')](cmHopper[_0x0a52('0xf')](_0x4be18e,!![]))[_0x0a52('0xc')](loggerCatch(_0x0a52('0x10')));}exports[_0x0a52('0x11')]=function(_0x345f94){return BPromise['resolve']()['then'](cmHopperBlack[_0x0a52('0x11')](_0x345f94))[_0x0a52('0xc')](loggerCatch(_0x0a52('0x12')));};exports[_0x0a52('0x13')]=function(_0x2021fc){return BPromise[_0x0a52('0xe')]()[_0x0a52('0xa')](cmHopper[_0x0a52('0x13')](_0x2021fc))[_0x0a52('0xc')](loggerCatch(_0x0a52('0x14')));};exports['createHistory']=function(_0x2e0f64,_0x4d51f6){create(_0x2e0f64)['catch'](loggerCatch(_0x4d51f6));moveContact(_0x2e0f64)[_0x0a52('0xc')](loggerCatch(_0x4d51f6));};exports[_0x0a52('0x15')]=function(_0x1b133e,_0x28872f){createAgent(_0x1b133e)['catch'](loggerCatch(_0x28872f));};exports[_0x0a52('0x16')]=function(_0x1681d2,_0x2fbb63){create(_0x1681d2)[_0x0a52('0xc')](loggerCatch(_0x2fbb63));};exports['createCustomerFinal']=function(_0x57dbf2,_0x5b5cc2){moveContact(_0x57dbf2)[_0x0a52('0xc')](loggerCatch(_0x5b5cc2));};exports[_0x0a52('0x17')]=function(_0x871048,_0x22b383,_0x1574bc){if(_0x22b383){_0x871048['UserId']=null;}if(_0x1574bc){_0x871048['active']=![];}return BPromise[_0x0a52('0xe')]()['then'](cmHopper[_0x0a52('0x17')](_0x871048))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0x0a52('0x18')]=function(_0x57061a){return BPromise[_0x0a52('0xe')]()['then'](cmHopper[_0x0a52('0x18')](_0x57061a))['catch'](loggerCatch(_0x0a52('0x19')));};exports['unlockContact']=function(_0x3237c7){return BPromise[_0x0a52('0xe')]()[_0x0a52('0xa')](cmHopper[_0x0a52('0x1a')]({'UserId':null},_0x3237c7,0x1))[_0x0a52('0xc')](loggerCatch(_0x0a52('0x1b')));};exports['disableContact']=function(_0x9b694e){return BPromise[_0x0a52('0xe')]()[_0x0a52('0xa')](cmHopper[_0x0a52('0x1a')]({'active':![]},_0x9b694e,0x1))[_0x0a52('0xc')](loggerCatch(_0x0a52('0x1c')));};exports[_0x0a52('0x1d')]=function(_0x394717){var _0x512103={};_0x512103[_0x0a52('0x1e')]=_0x394717[_0x0a52('0x1e')];_0x512103[_0x0a52('0x1f')]=_0x394717[_0x0a52('0x1f')];_0x512103['calleridnum']=_0x394717[_0x0a52('0x20')];_0x512103[_0x0a52('0x21')]=_0x394717[_0x0a52('0x21')];_0x512103[_0x0a52('0x22')]=_0x394717['queue'];_0x512103['queuecallerjoinAt']=_0x394717[_0x0a52('0x23')];_0x512103[_0x0a52('0x24')]=_0x394717['answertime'];_0x512103[_0x0a52('0x25')]=0x1;_0x512103[_0x0a52('0x26')]=_0x394717[_0x0a52('0x27')];_0x512103[_0x0a52('0x28')]=_0x394717[_0x0a52('0x29')];_0x512103[_0x0a52('0x2a')]=_0x0a52('0x2b');_0x512103[_0x0a52('0x2c')]='xcally-motion-preview';_0x512103[_0x0a52('0x2d')]=0x0;_0x512103[_0x0a52('0x2e')]=0x1;_0x512103[_0x0a52('0x2f')]=_0x394717[_0x0a52('0x29')];_0x512103[_0x0a52('0x30')]=_0x0a52('0x31');return BPromise[_0x0a52('0xe')]()[_0x0a52('0xa')](voiceQueueReport['create'](_0x512103))[_0x0a52('0xc')](loggerCatch(_0x0a52('0x32')));};exports[_0x0a52('0x33')]=function(_0x1e4c05,_0x451187){return BPromise['resolve']()[_0x0a52('0xa')](cmHopper[_0x0a52('0x33')](_0x1e4c05,_0x451187))[_0x0a52('0xc')](loggerCatch(_0x0a52('0x34')));};exports[_0x0a52('0x35')]=function(_0x5a0a27){return BPromise['resolve']()[_0x0a52('0xa')](cmHopper['rescheduleContact'](_0x5a0a27,!![],!![]))[_0x0a52('0xc')](loggerCatch(_0x0a52('0x36')));}; \ 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 adcf878..c31b338 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 _0x50e8=['from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ContactId','ListId','VoiceQueueId','decrementTalkink','isNil','pTalking','IsNotLoggedIn','buildObj','name','queue','interface','channelAgent','motionChannel','mandatoryDisposition','buildAcw','not_inuse','status','reachable','getDiff','createBody','CampaignId','idContact','campaigntype','membername','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','extractCalleridName','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','inspect','logger','loggerError','error','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','addVariables','Queue','calleridname','calleridnum','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','logAgent','responsetime','ringtime','logLookAgent','UserId','logCustomer','endtime','talktime','variablesAction','BOOKED','uniqueid','originate'];(function(_0x557655,_0x24aaa1){var _0x38d725=function(_0x2c2808){while(--_0x2c2808){_0x557655['push'](_0x557655['shift']());}};_0x38d725(++_0x24aaa1);}(_0x50e8,0xd4));var _0x850e=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x50e8[_0x999b85];return _0x1d7124;};'use strict';var util=require(_0x850e('0x0'));var _=require(_0x850e('0x1'));var moment=require(_0x850e('0x2'));var logger=require(_0x850e('0x3'))(_0x850e('0x4'));var ipAgi=process[_0x850e('0x5')][_0x850e('0x6')]||_0x850e('0x7');function getSeconds(_0x31da72,_0x4b0671){var _0x53e106=moment(_0x31da72)[_0x850e('0x8')](0x0);var _0x492028=moment(_0x4b0671)['milliseconds'](0x0);return _0x53e106[_0x850e('0x9')](_0x492028,_0x850e('0xa'));}exports[_0x850e('0xb')]=function(_0x1d8c38){return function(_0x169017){logger['error'](_0x1d8c38,util[_0x850e('0xc')](_0x169017,{'showHidden':![],'depth':null}));};};exports[_0x850e('0xd')]=function(_0x481ddd,_0x41f4ae){logger['info'](_0x481ddd,util[_0x850e('0xc')](_0x41f4ae,{'showHidden':![],'depth':null}));};exports[_0x850e('0xe')]=function(_0x3d1841,_0x2a2ee6){logger[_0x850e('0xf')](_0x3d1841,util[_0x850e('0xc')](_0x2a2ee6,{'showHidden':![],'depth':null}));};exports[_0x850e('0x10')]=function(_0x39d038){return function(_0x4063c6){logger['info'](_0x39d038,util[_0x850e('0xc')](_0x4063c6,{'showHidden':![],'depth':null}));};};exports[_0x850e('0x11')]=function(_0x2dffaa,_0x7706e0,_0x407fa0){return{'message':_0x2dffaa,'unlock':_0x7706e0,'active':_0x407fa0};};exports[_0x850e('0x12')]=function(_0x3a8bf3,_0xa721a3,_0x4e5f2f){if(!_[_0x850e('0x13')](_0x4e5f2f)&&_0x850e('0x14')===typeof _0x4e5f2f&&!_[_0x850e('0x15')](_0x4e5f2f)){if(!_['isUndefined'](_0xa721a3)&&_0x850e('0x14')===typeof _0xa721a3&&!_[_0x850e('0x15')](_0xa721a3)){return util[_0x850e('0x16')]('\x22%s\x22\x20<%s>',_0xa721a3,_0x4e5f2f);}return util[_0x850e('0x16')](_0x850e('0x17'),_0x4e5f2f,_0x4e5f2f);}if(!_['isUndefined'](_0x3a8bf3)&&_0x850e('0x14')===typeof _0x3a8bf3&&!_[_0x850e('0x15')](_0x3a8bf3)){return _0x3a8bf3;}return'\x22\x22\x20<>';};exports['isActive']=function(_0xf844d6){if(_['isNil'](_0xf844d6)){return![];}return _0xf844d6;};exports[_0x850e('0x18')]=function(_0x48a818,_0x50cc8b,_0x26d4ef,_0x111d52,_0x1e015e,_0x51703a){var _0x3f7c53={'XMD-QUEUE':_0x50cc8b[_0x850e('0x19')]?_0x50cc8b[_0x850e('0x19')]['name']:'','XMD-CALLERID':_0x111d52,'XMD-CALLERID-PREVIEW':_0x51703a?util[_0x850e('0x16')](_0x850e('0x17'),_0x51703a[_0x850e('0x1a')],_0x51703a[_0x850e('0x1b')]):_0x111d52,'XMD-DIALID':_0x1e015e,'XMD-CONTACTID':_0x50cc8b['ContactId'],'XMD-CDRTYPE':_0x850e('0x1c'),'CALLERID(all)':_0x111d52,'XMD-VOICEQUEUEID':_0x50cc8b['VoiceQueueId'],'XMD-DIALCHANNEL':_0x26d4ef,'XMD-DIALTIMEOUT':_0x48a818[_0x850e('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x850e('0x16')](_0x850e('0x1e'),_0x48a818[_0x850e('0x1f')]?'g':'',_[_0x850e('0x15')](_0x48a818['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x48a818[_0x850e('0x20')]||'','XMD-AGI':_0x48a818[_0x850e('0x21')]?util[_0x850e('0x16')](_0x850e('0x22'),ipAgi,_0x48a818['dialQueueProject']):_0x850e('0x23'),'XMD-AGIAFTER':_0x48a818[_0x850e('0x1f')]?util[_0x850e('0x16')](_0x850e('0x22'),ipAgi,_0x48a818[_0x850e('0x1f')]):_0x850e('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x51703a?_0x51703a[_0x850e('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x51703a?_0x51703a[_0x850e('0x25')]:'','XMD-DESTINATION':_0x850e('0x26'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x850e('0x15')](_0x48a818[_0x850e('0x27')])){_0x3f7c53[util[_0x850e('0x16')]('%s',_0x850e('0x28'))]=_0x48a818[_0x850e('0x27')];_0x3f7c53[util['format']('%s',_0x850e('0x29'))]=_0x1e015e;}if(_0x50cc8b&&_0x50cc8b[_0x850e('0x2a')]){for(var _0x2f2ff3 in _0x50cc8b['Contact']){if(_0x50cc8b['Contact'][_0x850e('0x2b')](_0x2f2ff3)){if(!_['isNil'](_0x50cc8b[_0x850e('0x2a')][_0x2f2ff3])&&_0x2f2ff3!=='id'&&_0x2f2ff3!==_0x850e('0x2c')&&_0x2f2ff3!==_0x850e('0x2d')&&_0x2f2ff3!==_0x850e('0x2e')){_0x3f7c53[util[_0x850e('0x16')](_0x850e('0x2f'),_0x850e('0x30'),_[_0x850e('0x31')](_0x2f2ff3))]=_0x50cc8b[_0x850e('0x2a')][_0x2f2ff3];}}}}return _0x3f7c53;};exports[_0x850e('0x32')]=function(_0x377b4d){var _0x2389f6={};for(var _0x2aec5a in _0x377b4d){if(_0x377b4d[_0x850e('0x2b')](_0x2aec5a)){_0x2389f6[util[_0x850e('0x16')]('%s',_[_0x850e('0x33')](_0x2aec5a))]=_0x377b4d[_0x2aec5a];}}return{'variables':_0x2389f6};};exports[_0x850e('0x34')]=function(_0x155785,_0x25dc38){if(!_['isNil'](_0x155785)){if(_0x155785[_0x850e('0x2b')](_0x850e('0x35'))){if(_0x155785[_0x850e('0x35')]>0x0){_0x155785[_0x850e('0x35')]-=0x1;}else{logger[_0x850e('0xf')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x25dc38);}}}else{logger[_0x850e('0xf')](_0x850e('0x36'),_0x25dc38);}};exports['logBlacklist']=function(_0x5c297c){var _0xc6e7e0=moment()['format'](_0x850e('0x37'));_0x5c297c[_0x850e('0x38')]=0xd;_0x5c297c[_0x850e('0x39')]=_0x850e('0x3a');_0x5c297c[_0x850e('0x3b')]=_0xc6e7e0;_0x5c297c['responsetime']=_0xc6e7e0;_0x5c297c['endtime']=_0xc6e7e0;};exports[_0x850e('0x3c')]=function(_0x40144c,_0x23a75f,_0xe2685a){var _0x3e03c4=moment()[_0x850e('0x16')](_0x850e('0x37'));_0x40144c[_0x850e('0x38')]=_0x23a75f;_0x40144c[_0x850e('0x39')]=_0xe2685a;_0x40144c[_0x850e('0x3d')]=_0x3e03c4;_0x40144c[_0x850e('0x3e')]=getSeconds(_0x40144c[_0x850e('0x3d')],_0x40144c['starttime']);};exports[_0x850e('0x3f')]=function(_0x26ed26,_0xa33ec0,_0x4a3a90){_0x26ed26['membername']=_0xa33ec0;_0x26ed26[_0x850e('0x40')]=_0x4a3a90;};exports[_0x850e('0x41')]=function(_0x5ad707,_0x5f7031,_0x1c7713){var _0x44df7e=moment()[_0x850e('0x16')](_0x850e('0x37'));_0x5ad707['state']=_0x5f7031;_0x5ad707[_0x850e('0x39')]=_0x1c7713;_0x5ad707[_0x850e('0x3d')]=_0x5ad707['responsetime']?_0x5ad707[_0x850e('0x3d')]:_0x44df7e;_0x5ad707['endtime']=_0x5ad707['endtime']?_0x5ad707[_0x850e('0x42')]:_0x44df7e;_0x5ad707[_0x850e('0x3e')]=getSeconds(_0x5ad707['responsetime']||0x0,_0x5ad707[_0x850e('0x3b')]||0x0);_0x5ad707[_0x850e('0x43')]=_0x5ad707['answertime']?getSeconds(_0x5ad707[_0x850e('0x42')],_0x5ad707['answertime']):0x0;};exports['isFailure']=function(_0x5c204c){return _0x5c204c==='Failure';};exports[_0x850e('0x44')]=function(_0x3c70e9,_0x4dd672,_0x231293,_0x808118,_0x3c6545){var _0x5b1b4c=_0x808118?'RECALL':_0x3c70e9['calleridname'];_0x5b1b4c=_0x3c6545?_0x850e('0x45'):_0x5b1b4c;return{'actionid':_0x3c70e9[_0x850e('0x46')],'action':_0x850e('0x47'),'channel':_0x3c70e9['channelAgent'],'callerid':util[_0x850e('0x16')](_0x850e('0x17'),_0x5b1b4c,_0x3c70e9[_0x850e('0x1b')]),'Exten':_0x850e('0x26'),'Context':_0x850e('0x48'),'Priority':'1','variable':_0x231293,'timeout':(_0x4dd672[_0x850e('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3c70e9[_0x850e('0x46')]};};exports[_0x850e('0x4a')]=function(_0x59c2b3){return _0x59c2b3['countbusyretry']+_0x59c2b3[_0x850e('0x4b')]+_0x59c2b3[_0x850e('0x4c')]+_0x59c2b3[_0x850e('0x4d')]+_0x59c2b3[_0x850e('0x4e')];};exports[_0x850e('0x4f')]=function(_0x3a23fa){var _0x17438d=_[_0x850e('0x50')](_0x3a23fa);_0x17438d[_0x850e('0x38')]=0xf;_0x17438d[_0x850e('0x39')]=_0x850e('0x51');return _0x17438d;};exports[_0x850e('0x52')]=function(_0x38a5fb,_0x35d666,_0x274951){var _0x2202a5={};_0x2202a5[_0x35d666]=_0x38a5fb[_0x35d666];_0x2202a5[_0x850e('0x53')]=![];_0x2202a5['scheduledat']=moment()[_0x850e('0x54')](_0x274951,_0x850e('0x55'))[_0x850e('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x2202a5['ContactId']=_0x38a5fb[_0x850e('0x56')];_0x2202a5[_0x850e('0x57')]=_0x38a5fb['ListId'];_0x2202a5[_0x850e('0x58')]=_0x38a5fb[_0x850e('0x58')]||undefined;return _0x2202a5;};exports[_0x850e('0x59')]=function(_0xf335ab,_0x230fb0){if(!_[_0x850e('0x5a')](_0xf335ab)){if(_0xf335ab[_0x850e('0x5b')]>0x0){_0xf335ab[_0x850e('0x5b')]-=0x1;}else{logger[_0x850e('0xf')](_0x230fb0,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x850e('0xf')](_0x230fb0,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x850e('0x5c')]=function(_0x182116){if(_0x182116<=0x0){return!![];}return![];};exports[_0x850e('0x5d')]=function(_0xc64d81,_0xa804f6,_0x2d693f){_0xc64d81['lastevent']=_0xa804f6;_0xc64d81[_0x850e('0x5e')]=_0xc64d81[_0x850e('0x5f')];_0xc64d81[_0x850e('0x60')]=_0xc64d81[_0x850e('0x61')];_0xc64d81[_0x850e('0x62')]='voice';if(_0x2d693f){_0xc64d81[_0x850e('0x63')]=_0x2d693f[_0x850e('0x63')];}return _0xc64d81;};exports[_0x850e('0x64')]=function(_0x370ba9){var _0x5798cf={};_0x5798cf[_0x850e('0x5f')]=_0x370ba9['queue'];_0x5798cf[_0x850e('0x60')]=_0x370ba9['channelAgent'];_0x5798cf['uniqueid']=_0x370ba9[_0x850e('0x46')];return _0x5798cf;};exports['agentReadyId']=function(_0x388132){var _0x3bad71=[];for(var _0x28db4d in _0x388132){if(_0x388132['hasOwnProperty'](_0x28db4d)){if(!_[_0x850e('0x5a')](_0x388132[_0x28db4d])&&_0x388132[_0x28db4d]['state']===_0x850e('0x65')&&_0x388132[_0x28db4d][_0x850e('0x66')]===_0x850e('0x67')){_0x3bad71['push'](_0x388132[_0x28db4d]['id']);}}}return _0x3bad71;};exports[_0x850e('0x68')]=function(_0xdb611a){var _0x228ae7=moment()['milliseconds'](0x0);var _0xd1e8c4=moment(_0xdb611a)[_0x850e('0x8')](0x0);return _0x228ae7[_0x850e('0x9')](_0xd1e8c4,_0x850e('0xa'));};exports[_0x850e('0x69')]=function(_0xd00001){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xd00001[_0x850e('0x56')],'ListId':_0xd00001['ListId'],'VoiceQueueId':_0xd00001[_0x850e('0x58')]||undefined,'CampaignId':_0xd00001[_0x850e('0x6a')]||undefined};};exports['filterKey']=function(_0x3db2a4){if(_0x3db2a4==='uniqueid'||_0x3db2a4===_0x850e('0x6b')||_0x3db2a4===_0x850e('0x5f')||_0x3db2a4==='type'||_0x3db2a4===_0x850e('0x6c')||_0x3db2a4==='dialAnswer'||_0x3db2a4===_0x850e('0x6d')||_0x3db2a4===_0x850e('0x61')||_0x3db2a4===_0x850e('0x1a')||_0x3db2a4===_0x850e('0x53')||_0x3db2a4===_0x850e('0x1b')||_0x3db2a4===_0x850e('0x6e')||_0x3db2a4==='countbusyretry'||_0x3db2a4==='countcongestionretry'||_0x3db2a4===_0x850e('0x4c')||_0x3db2a4===_0x850e('0x6f')||_0x3db2a4===_0x850e('0x70')||_0x3db2a4===_0x850e('0x71')||_0x3db2a4===_0x850e('0x72')||_0x3db2a4===_0x850e('0x73')||_0x3db2a4===_0x850e('0x56')||_0x3db2a4===_0x850e('0x57')||_0x3db2a4==='UserId'||_0x3db2a4===_0x850e('0x58')||_0x3db2a4===_0x850e('0x74')||_0x3db2a4===_0x850e('0x75')||_0x3db2a4===_0x850e('0x76')||_0x3db2a4===_0x850e('0x77')||_0x3db2a4===_0x850e('0x78')||_0x3db2a4==='xmd-dialurl'||_0x3db2a4==='xmd-dialtimeout'||_0x3db2a4===_0x850e('0x79')||_0x3db2a4==='xmd-dialid'||_0x3db2a4===_0x850e('0x7a')||_0x3db2a4==='xmd-contactid'||_0x3db2a4===_0x850e('0x7b')||_0x3db2a4===_0x850e('0x7c')||_0x3db2a4===_0x850e('0x7d')||_0x3db2a4===_0x850e('0x7e')||_0x3db2a4===_0x850e('0x7f')||_0x3db2a4===_0x850e('0x80')||_0x3db2a4===_0x850e('0x81')||_0x3db2a4===_0x850e('0x82')||_0x3db2a4===_0x850e('0x83')||_0x3db2a4===_0x850e('0x84')||_0x3db2a4===_0x850e('0x85')||_0x3db2a4==='rtpaudioqosrttbridged'||_0x3db2a4===_0x850e('0x7f')||_0x3db2a4===_0x850e('0x80')||_0x3db2a4==='rtpaudioqosjitter'||_0x3db2a4===_0x850e('0x82')||_0x3db2a4==='rtpaudioqosloss'||_0x3db2a4===_0x850e('0x84')||_0x3db2a4===_0x850e('0x85')||_0x3db2a4===_0x850e('0x86')||_0x3db2a4===_0x850e('0x87')||_0x3db2a4===_0x850e('0x88')||_0x3db2a4==='state'||_0x3db2a4==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5a9e7f,_0x22ad92){var _0x76e952,_0x7c2860,_0x3782a5;if(_0x22ad92<=0x0){_0x22ad92=0x1;}_0x76e952=new RegExp(_0x850e('0x89')+_0x22ad92+'}$');_0x7c2860=Math[_0x850e('0x8a')](0xa,_0x22ad92-0x1);_0x3782a5=Math['pow'](0xa,_0x22ad92)-0x1;return util['format']('%s',_['replace'](_0x5a9e7f,_0x76e952,_['random'](_0x7c2860,_0x3782a5)));};exports[_0x850e('0x8b')]=function(_0x5bf829){var _0xadf2c6=_0x5bf829['match'](/"(.*?)"/);return _0xadf2c6?_0xadf2c6[0x1]:_0x5bf829;};exports[_0x850e('0x8c')]=function(_0x36a902){var _0x3c7e12=_0x36a902[_0x850e('0x8d')](/<(.*?)>/);return _0x3c7e12?_0x3c7e12[0x1]:_0x36a902;}; \ No newline at end of file +var _0x42e5=['callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','match','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','isActive','addVariables','Queue','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','isNil','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','UserId','logCustomer','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','name','motionChannel','voice','mandatoryDisposition','queue','interface','agentReadyId','status','reachable','push','getDiff','diff','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','calleridname','countglobal'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x42e5,0x144));var _0x542e=function(_0x3a3afe,_0x15da25){_0x3a3afe=_0x3a3afe-0x0;var _0x262dab=_0x42e5[_0x3a3afe];return _0x262dab;};'use strict';var util=require('util');var _=require(_0x542e('0x0'));var moment=require('moment');var logger=require(_0x542e('0x1'))(_0x542e('0x2'));var ipAgi=process[_0x542e('0x3')][_0x542e('0x4')]||_0x542e('0x5');function getSeconds(_0x2cf329,_0x1d9e17){var _0x3a7dc8=moment(_0x2cf329)['milliseconds'](0x0);var _0x49be0d=moment(_0x1d9e17)[_0x542e('0x6')](0x0);return _0x3a7dc8['diff'](_0x49be0d,'seconds');}exports[_0x542e('0x7')]=function(_0x11140c){return function(_0x2f8331){logger[_0x542e('0x8')](_0x11140c,util[_0x542e('0x9')](_0x2f8331,{'showHidden':![],'depth':null}));};};exports[_0x542e('0xa')]=function(_0x2556c3,_0x1f314c){logger[_0x542e('0xb')](_0x2556c3,util[_0x542e('0x9')](_0x1f314c,{'showHidden':![],'depth':null}));};exports[_0x542e('0xc')]=function(_0x556e80,_0x475861){logger[_0x542e('0x8')](_0x556e80,util[_0x542e('0x9')](_0x475861,{'showHidden':![],'depth':null}));};exports[_0x542e('0xd')]=function(_0x10ea34){return function(_0x5813a3){logger[_0x542e('0xb')](_0x10ea34,util[_0x542e('0x9')](_0x5813a3,{'showHidden':![],'depth':null}));};};exports[_0x542e('0xe')]=function(_0x4f5b5e,_0x197ea1,_0x4e7150){return{'message':_0x4f5b5e,'unlock':_0x197ea1,'active':_0x4e7150};};exports[_0x542e('0xf')]=function(_0x40a4c3,_0x173dd7,_0x1b399d){if(!_['isUndefined'](_0x1b399d)&&_0x542e('0x10')===typeof _0x1b399d&&!_[_0x542e('0x11')](_0x1b399d)){if(!_[_0x542e('0x12')](_0x173dd7)&&_0x542e('0x10')===typeof _0x173dd7&&!_[_0x542e('0x11')](_0x173dd7)){return util[_0x542e('0x13')]('\x22%s\x22\x20<%s>',_0x173dd7,_0x1b399d);}return util[_0x542e('0x13')](_0x542e('0x14'),_0x1b399d,_0x1b399d);}if(!_[_0x542e('0x12')](_0x40a4c3)&&_0x542e('0x10')===typeof _0x40a4c3&&!_['isEmpty'](_0x40a4c3)){return _0x40a4c3;}return'\x22\x22\x20<>';};exports[_0x542e('0x15')]=function(_0x1068bb){if(_['isNil'](_0x1068bb)){return![];}return _0x1068bb;};exports[_0x542e('0x16')]=function(_0x218d26,_0x515900,_0x1d5cf4,_0x619ef,_0x55fd00,_0x80a079){var _0x540a77={'XMD-QUEUE':_0x515900[_0x542e('0x17')]?_0x515900[_0x542e('0x17')]['name']:'','XMD-CALLERID':_0x619ef,'XMD-CALLERID-PREVIEW':_0x80a079?util[_0x542e('0x13')](_0x542e('0x14'),_0x80a079['calleridname'],_0x80a079[_0x542e('0x18')]):_0x619ef,'XMD-DIALID':_0x55fd00,'XMD-CONTACTID':_0x515900[_0x542e('0x19')],'XMD-CDRTYPE':_0x542e('0x1a'),'CALLERID(all)':_0x619ef,'XMD-VOICEQUEUEID':_0x515900[_0x542e('0x1b')],'XMD-DIALCHANNEL':_0x1d5cf4,'XMD-DIALTIMEOUT':_0x218d26[_0x542e('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x542e('0x13')](_0x542e('0x1d'),_0x218d26[_0x542e('0x1e')]?'g':'',_[_0x542e('0x11')](_0x218d26[_0x542e('0x1f')])?'':_0x542e('0x20')),'XMD-DIALURL':_0x218d26['dialPreviewUrl']||'','XMD-AGI':_0x218d26[_0x542e('0x21')]?util[_0x542e('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x218d26[_0x542e('0x21')]):'NONE','XMD-AGIAFTER':_0x218d26['dialQueueProject2']?util[_0x542e('0x13')](_0x542e('0x22'),ipAgi,_0x218d26[_0x542e('0x1e')]):_0x542e('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x80a079?_0x80a079[_0x542e('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x80a079?_0x80a079['originatecalleridname']:'','XMD-DESTINATION':_0x542e('0x25'),'SIPADDHEADER':_0x542e('0x26')};if(!_[_0x542e('0x11')](_0x218d26[_0x542e('0x1f')])){_0x540a77[util[_0x542e('0x13')]('%s',_0x542e('0x27'))]=_0x218d26[_0x542e('0x1f')];_0x540a77[util[_0x542e('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x55fd00;}if(_0x515900&&_0x515900['Contact']){for(var _0x4053fc in _0x515900['Contact']){if(_0x515900[_0x542e('0x28')][_0x542e('0x29')](_0x4053fc)){if(!_[_0x542e('0x2a')](_0x515900[_0x542e('0x28')][_0x4053fc])&&_0x4053fc!=='id'&&_0x4053fc!=='tags'&&_0x4053fc!==_0x542e('0x2b')&&_0x4053fc!==_0x542e('0x2c')){_0x540a77[util['format'](_0x542e('0x2d'),_0x542e('0x2e'),_['toUpper'](_0x4053fc))]=_0x515900[_0x542e('0x28')][_0x4053fc];}}}}return _0x540a77;};exports[_0x542e('0x2f')]=function(_0x2b9b40){var _0x15fef8={};for(var _0x2bdaec in _0x2b9b40){if(_0x2b9b40[_0x542e('0x29')](_0x2bdaec)){_0x15fef8[util[_0x542e('0x13')]('%s',_[_0x542e('0x30')](_0x2bdaec))]=_0x2b9b40[_0x2bdaec];}}return{'variables':_0x15fef8};};exports[_0x542e('0x31')]=function(_0x4080c7,_0x4f5e6c){if(!_[_0x542e('0x2a')](_0x4080c7)){if(_0x4080c7[_0x542e('0x29')](_0x542e('0x32'))){if(_0x4080c7[_0x542e('0x32')]>0x0){_0x4080c7[_0x542e('0x32')]-=0x1;}else{logger[_0x542e('0x8')](_0x542e('0x33'),_0x4f5e6c);}}}else{logger[_0x542e('0x8')](_0x542e('0x34'),_0x4f5e6c);}};exports[_0x542e('0x35')]=function(_0x2dc2b9){var _0xe1e9ad=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2dc2b9[_0x542e('0x36')]=0xd;_0x2dc2b9[_0x542e('0x37')]='Blacklist';_0x2dc2b9[_0x542e('0x38')]=_0xe1e9ad;_0x2dc2b9[_0x542e('0x39')]=_0xe1e9ad;_0x2dc2b9[_0x542e('0x3a')]=_0xe1e9ad;};exports[_0x542e('0x3b')]=function(_0x93a029,_0x3690c1,_0xfbcc51){var _0xd2d252=moment()[_0x542e('0x13')](_0x542e('0x3c'));_0x93a029[_0x542e('0x36')]=_0x3690c1;_0x93a029['statedesc']=_0xfbcc51;_0x93a029['responsetime']=_0xd2d252;_0x93a029[_0x542e('0x3d')]=getSeconds(_0x93a029[_0x542e('0x39')],_0x93a029[_0x542e('0x38')]);};exports[_0x542e('0x3e')]=function(_0x158e69,_0x2e9186,_0x323601){_0x158e69[_0x542e('0x3f')]=_0x2e9186;_0x158e69[_0x542e('0x40')]=_0x323601;};exports[_0x542e('0x41')]=function(_0x59dc10,_0x47f5c2,_0x2ff04f){var _0x50353a=moment()[_0x542e('0x13')](_0x542e('0x3c'));_0x59dc10[_0x542e('0x36')]=_0x47f5c2;_0x59dc10[_0x542e('0x37')]=_0x2ff04f;_0x59dc10[_0x542e('0x39')]=_0x59dc10[_0x542e('0x39')]?_0x59dc10[_0x542e('0x39')]:_0x50353a;_0x59dc10[_0x542e('0x3a')]=_0x59dc10[_0x542e('0x3a')]?_0x59dc10['endtime']:_0x50353a;_0x59dc10[_0x542e('0x3d')]=getSeconds(_0x59dc10[_0x542e('0x39')]||0x0,_0x59dc10[_0x542e('0x38')]||0x0);_0x59dc10['talktime']=_0x59dc10[_0x542e('0x42')]?getSeconds(_0x59dc10[_0x542e('0x3a')],_0x59dc10[_0x542e('0x42')]):0x0;};exports[_0x542e('0x43')]=function(_0x4d67e1){return _0x4d67e1===_0x542e('0x44');};exports[_0x542e('0x45')]=function(_0x136a88,_0x52aa27,_0x4d7e42,_0x5b0df7,_0x5e383e){var _0x593cfb=_0x5b0df7?'RECALL':_0x136a88['calleridname'];_0x593cfb=_0x5e383e?_0x542e('0x46'):_0x593cfb;return{'actionid':_0x136a88[_0x542e('0x47')],'action':_0x542e('0x48'),'channel':_0x136a88[_0x542e('0x49')],'callerid':util['format'](_0x542e('0x14'),_0x593cfb,_0x136a88[_0x542e('0x18')]),'Exten':_0x542e('0x25'),'Context':'from-sip','Priority':'1','variable':_0x4d7e42,'timeout':(_0x52aa27['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x136a88[_0x542e('0x47')]};};exports[_0x542e('0x4a')]=function(_0x390f58){return _0x390f58[_0x542e('0x4b')]+_0x390f58[_0x542e('0x4c')]+_0x390f58[_0x542e('0x4d')]+_0x390f58[_0x542e('0x4e')]+_0x390f58[_0x542e('0x4f')];};exports[_0x542e('0x50')]=function(_0x38361c){var _0x1dd053=_[_0x542e('0x51')](_0x38361c);_0x1dd053[_0x542e('0x36')]=0xf;_0x1dd053[_0x542e('0x37')]=_0x542e('0x52');return _0x1dd053;};exports['scheduledAt']=function(_0x447e27,_0x2d203e,_0x164c18){var _0x475a2c={};_0x475a2c[_0x2d203e]=_0x447e27[_0x2d203e];_0x475a2c[_0x542e('0x53')]=![];_0x475a2c[_0x542e('0x54')]=moment()[_0x542e('0x55')](_0x164c18,_0x542e('0x56'))[_0x542e('0x13')](_0x542e('0x3c'));_0x475a2c[_0x542e('0x19')]=_0x447e27[_0x542e('0x19')];_0x475a2c[_0x542e('0x57')]=_0x447e27[_0x542e('0x57')];_0x475a2c['VoiceQueueId']=_0x447e27[_0x542e('0x1b')]||undefined;return _0x475a2c;};exports['decrementTalkink']=function(_0x3afe76,_0x5a1db2){if(!_[_0x542e('0x2a')](_0x3afe76)){if(_0x3afe76[_0x542e('0x58')]>0x0){_0x3afe76['pTalking']-=0x1;}else{logger[_0x542e('0x8')](_0x5a1db2,_0x542e('0x59'));}}else{logger[_0x542e('0x8')](_0x5a1db2,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x542e('0x5a')]=function(_0x2ad47d){if(_0x2ad47d<=0x0){return!![];}return![];};exports[_0x542e('0x5b')]=function(_0xe9e0a7,_0x3fc6a6,_0x577d6f){_0xe9e0a7[_0x542e('0x5c')]=_0x3fc6a6;_0xe9e0a7[_0x542e('0x5d')]=_0xe9e0a7['queue'];_0xe9e0a7['interface']=_0xe9e0a7[_0x542e('0x49')];_0xe9e0a7[_0x542e('0x5e')]=_0x542e('0x5f');if(_0x577d6f){_0xe9e0a7[_0x542e('0x60')]=_0x577d6f[_0x542e('0x60')];}return _0xe9e0a7;};exports['buildAcw']=function(_0x143870){var _0x1bb471={};_0x1bb471['queue']=_0x143870[_0x542e('0x61')];_0x1bb471[_0x542e('0x62')]=_0x143870['channelAgent'];_0x1bb471[_0x542e('0x47')]=_0x143870[_0x542e('0x47')];return _0x1bb471;};exports[_0x542e('0x63')]=function(_0x4adc18){var _0x2f0130=[];for(var _0x4ff616 in _0x4adc18){if(_0x4adc18[_0x542e('0x29')](_0x4ff616)){if(!_[_0x542e('0x2a')](_0x4adc18[_0x4ff616])&&_0x4adc18[_0x4ff616][_0x542e('0x36')]==='not_inuse'&&_0x4adc18[_0x4ff616][_0x542e('0x64')]===_0x542e('0x65')){_0x2f0130[_0x542e('0x66')](_0x4adc18[_0x4ff616]['id']);}}}return _0x2f0130;};exports[_0x542e('0x67')]=function(_0x334b27){var _0x14701b=moment()['milliseconds'](0x0);var _0x21dfcc=moment(_0x334b27)['milliseconds'](0x0);return _0x14701b[_0x542e('0x68')](_0x21dfcc,_0x542e('0x69'));};exports[_0x542e('0x6a')]=function(_0x2a5d41){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2a5d41[_0x542e('0x19')],'ListId':_0x2a5d41['ListId'],'VoiceQueueId':_0x2a5d41['VoiceQueueId']||undefined,'CampaignId':_0x2a5d41[_0x542e('0x6b')]||undefined};};exports[_0x542e('0x6c')]=function(_0x5914a4){if(_0x5914a4==='uniqueid'||_0x5914a4===_0x542e('0x6d')||_0x5914a4===_0x542e('0x61')||_0x5914a4===_0x542e('0x6e')||_0x5914a4===_0x542e('0x6f')||_0x5914a4==='dialAnswer'||_0x5914a4===_0x542e('0x3f')||_0x5914a4===_0x542e('0x49')||_0x5914a4===_0x542e('0x70')||_0x5914a4===_0x542e('0x53')||_0x5914a4===_0x542e('0x18')||_0x5914a4===_0x542e('0x54')||_0x5914a4===_0x542e('0x4b')||_0x5914a4===_0x542e('0x4c')||_0x5914a4===_0x542e('0x4d')||_0x5914a4===_0x542e('0x71')||_0x5914a4==='callback'||_0x5914a4===_0x542e('0x72')||_0x5914a4===_0x542e('0x73')||_0x5914a4===_0x542e('0x74')||_0x5914a4===_0x542e('0x19')||_0x5914a4===_0x542e('0x57')||_0x5914a4==='UserId'||_0x5914a4==='VoiceQueueId'||_0x5914a4===_0x542e('0x75')||_0x5914a4===_0x542e('0x76')||_0x5914a4===_0x542e('0x77')||_0x5914a4===_0x542e('0x78')||_0x5914a4===_0x542e('0x79')||_0x5914a4===_0x542e('0x7a')||_0x5914a4===_0x542e('0x7b')||_0x5914a4==='xmd-dialoptions'||_0x5914a4===_0x542e('0x7c')||_0x5914a4===_0x542e('0x7d')||_0x5914a4===_0x542e('0x7e')||_0x5914a4===_0x542e('0x7f')||_0x5914a4===_0x542e('0x80')||_0x5914a4===_0x542e('0x81')||_0x5914a4===_0x542e('0x82')||_0x5914a4===_0x542e('0x83')||_0x5914a4===_0x542e('0x84')||_0x5914a4===_0x542e('0x85')||_0x5914a4==='rtpaudioqosjitterbridged'||_0x5914a4==='rtpaudioqosloss'||_0x5914a4===_0x542e('0x86')||_0x5914a4===_0x542e('0x87')||_0x5914a4===_0x542e('0x88')||_0x5914a4===_0x542e('0x83')||_0x5914a4==='rtpaudioqosbridged'||_0x5914a4===_0x542e('0x85')||_0x5914a4===_0x542e('0x89')||_0x5914a4===_0x542e('0x8a')||_0x5914a4===_0x542e('0x86')||_0x5914a4===_0x542e('0x87')||_0x5914a4===_0x542e('0x88')||_0x5914a4===_0x542e('0x8b')||_0x5914a4===_0x542e('0x8c')||_0x5914a4===_0x542e('0x36')||_0x5914a4===_0x542e('0x37')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x138bb9,_0x64fba2){var _0x2d8e50,_0x55ce97,_0x57e4d7;if(_0x64fba2<=0x0){_0x64fba2=0x1;}_0x2d8e50=new RegExp(_0x542e('0x8d')+_0x64fba2+'}$');_0x55ce97=Math[_0x542e('0x8e')](0xa,_0x64fba2-0x1);_0x57e4d7=Math[_0x542e('0x8e')](0xa,_0x64fba2)-0x1;return util[_0x542e('0x13')]('%s',_[_0x542e('0x8f')](_0x138bb9,_0x2d8e50,_['random'](_0x55ce97,_0x57e4d7)));};exports[_0x542e('0x90')]=function(_0x13a7b5){var _0x172b15=_0x13a7b5['match'](/"(.*?)"/);return _0x172b15?_0x172b15[0x1]:_0x13a7b5;};exports['extractCalleridNumber']=function(_0x1eee26){var _0x439f27=_0x1eee26[_0x542e('0x91')](/<(.*?)>/);return _0x439f27?_0x439f27[0x1]:_0x1eee26;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 61e82da..45071a4 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 _0xb609=['voicequeuechannelredirect','string','number','queuepause','reload'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xb609,0x137));var _0x9b60=function(_0x255c22,_0x47fa24){_0x255c22=_0x255c22-0x0;var _0x39d454=_0xb609[_0x255c22];return _0x39d454;};'use strict';exports['queueadd']={'queue':{'type':_0x9b60('0x0'),'required':!![]},'interface':{'type':_0x9b60('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x9b60('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0x9b60('0x0'),'required':!![]},'interface':{'type':_0x9b60('0x0'),'required':!![]}};exports[_0x9b60('0x2')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0x9b60('0x3')]={'module':{'type':_0x9b60('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x9b60('0x0')},'format':{'type':_0x9b60('0x0')},'mixmonitorid':{'type':_0x9b60('0x0')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x9b60('0x0'),'required':!![]}};exports[_0x9b60('0x4')]={'uniqueid':{'type':_0x9b60('0x0'),'required':!![]},'exten':{'type':_0x9b60('0x0'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x75aa=['queueremove','queuepause','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean'];(function(_0x606880,_0x1a65aa){var _0x38451f=function(_0x273f41){while(--_0x273f41){_0x606880['push'](_0x606880['shift']());}};_0x38451f(++_0x1a65aa);}(_0x75aa,0xad));var _0xa75a=function(_0x5a9bd8,_0x29f9c4){_0x5a9bd8=_0x5a9bd8-0x0;var _0x22834e=_0x75aa[_0x5a9bd8];return _0x22834e;};'use strict';exports[_0xa75a('0x0')]={'queue':{'type':_0xa75a('0x1'),'required':!![]},'interface':{'type':_0xa75a('0x1'),'required':!![]},'membername':{'type':_0xa75a('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xa75a('0x2'),'required':![]}};exports[_0xa75a('0x3')]={'queue':{'type':_0xa75a('0x1'),'required':!![]},'interface':{'type':_0xa75a('0x1'),'required':!![]}};exports[_0xa75a('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xa75a('0x1'),'required':![]}};exports['reload']={'module':{'type':_0xa75a('0x1'),'required':![]}};exports[_0xa75a('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xa75a('0x1'),'required':!![]},'filename':{'type':_0xa75a('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0xa75a('0x6')]={'uniqueid':{'type':_0xa75a('0x1'),'required':!![]}};exports[_0xa75a('0x7')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xa75a('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index d971c39..94df414 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 _0x77e2=['bluebird','lodash','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','trunks','voiceQueues','triggers','campaigns','voiceExtensions','outboundChannels','timers','settings','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','isEmpty','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','isUndefined','telephones','length','initTrunks','initTriggers','templates','initZendeskAccounts','zendeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','queuecallerleaveAt','outbound','duration','disposition','billableseconds','sumBillable','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','faxAccounts','exports'];(function(_0x51b347,_0x2c896d){var _0x5a55b4=function(_0x6a3e1d){while(--_0x6a3e1d){_0x51b347['push'](_0x51b347['shift']());}};_0x5a55b4(++_0x2c896d);}(_0x77e2,0x1f4));var _0x277e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77e2[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x277e('0x0'));var util=require('util');var _=require(_0x277e('0x1'));var moment=require(_0x277e('0x2'));var Agent=require('../model/agent');var Telephone=require(_0x277e('0x3'));var Trunk=require(_0x277e('0x4'));var VoiceQueue=require(_0x277e('0x5'));var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0x277e('0x6'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x277e('0x7'));var FreshdeskAccount=require(_0x277e('0x8'));var SugarcrmAccount=require(_0x277e('0x9'));var ZohoAccount=require(_0x277e('0xa'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x277e('0xb'));var ServicenowAccount=require(_0x277e('0xc'));var Dynamics365Account=require(_0x277e('0xd'));var FreshsalesAccount=require(_0x277e('0xe'));var FaxAccount=require(_0x277e('0xf'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0x277e('0x10')]={};this[_0x277e('0x11')]={};this[_0x277e('0x12')]={};this[_0x277e('0x13')]={};this['templates']={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x277e('0x14')]={};this['channels']={};this['queueChannels']={};this[_0x277e('0x15')]={};this[_0x277e('0x16')]={};this[_0x277e('0x17')]={};this['zendeskAccounts']={};this[_0x277e('0x18')]={};this[_0x277e('0x19')]={};this['freshdeskAccounts']={};this[_0x277e('0x1a')]={};this[_0x277e('0x1b')]={};this[_0x277e('0x1c')]={};this[_0x277e('0x1d')]={};this[_0x277e('0x1e')]={};this[_0x277e('0x1f')]={};this['faxAccounts']={};};function freeIsNotKey(_0x336e45,_0x2c6b4d,_0x1d797b){var _0x42896f=_[_0x277e('0x20')](_0x336e45,function(_0xb6a187,_0x3c72c9){return _0xb6a187[_0x1d797b];});for(var _0x11e32b in _0x2c6b4d){if(_0x2c6b4d[_0x277e('0x21')](_0x11e32b)){if(!_0x42896f[_0x11e32b]){delete _0x2c6b4d[_0x11e32b];}}}}function freeIsNotKeySip(_0x2c060a,_0x2b9793){var _0x3dcc28=_['mapKeys'](_0x2c060a,function(_0x52cc30,_0x94c95f){return util[_0x277e('0x22')](_0x277e('0x23'),_0x52cc30[_0x277e('0x24')]);});for(var _0x12220b in _0x2b9793){if(_0x2b9793['hasOwnProperty'](_0x12220b)){if(!_0x3dcc28[_0x12220b]){delete _0x2b9793[_0x12220b];}}}}function freeIsNotKeyAgent(_0x1f8c88,_0x47eb4f){var _0x37c5ea=_[_0x277e('0x20')](_0x1f8c88,function(_0x1b28e0,_0x2c8abc){var _0x5ccc79=_[_0x277e('0x25')](_0x1b28e0[_0x277e('0x26')])?util[_0x277e('0x22')](_0x277e('0x23'),_0x1b28e0[_0x277e('0x24')]):_0x1b28e0[_0x277e('0x26')];return _0x5ccc79;});for(var _0x3b9d68 in _0x47eb4f){if(_0x47eb4f['hasOwnProperty'](_0x3b9d68)){if(!_0x37c5ea[_0x3b9d68]){delete _0x47eb4f[_0x3b9d68];}}}}function clearVoiceCallReports(_0x3a34bd){_0x3a34bd[_0x277e('0x27')]=0x0;_0x3a34bd[_0x277e('0x28')]=0x0;_0x3a34bd[_0x277e('0x29')]=0x0;_0x3a34bd[_0x277e('0x2a')]=0x0;_0x3a34bd['sumBillable']=0x0;}function clearCampaigns(_0x567738){if(!_[_0x277e('0x2b')](_0x567738)){for(var _0x4ad02a in _0x567738){if(_0x567738[_0x277e('0x21')](_0x4ad02a)){_0x567738[_0x4ad02a]['ivrTotalCallsDays']=0x0;_0x567738[_0x4ad02a]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x1b91fe){if(!_[_0x277e('0x2b')](_0x1b91fe)){for(var _0x1e9ebc in _0x1b91fe){if(_0x1b91fe['hasOwnProperty'](_0x1e9ebc)){_0x1b91fe[_0x1e9ebc][_0x277e('0x27')]=0x0;_0x1b91fe[_0x1e9ebc][_0x277e('0x28')]=0x0;_0x1b91fe[_0x1e9ebc][_0x277e('0x2c')]=0x0;_0x1b91fe[_0x1e9ebc]['abandoned']=0x0;_0x1b91fe[_0x1e9ebc]['sumHoldTime']=0x0;_0x1b91fe[_0x1e9ebc][_0x277e('0x2a')]=0x0;_0x1b91fe[_0x1e9ebc]['sumBillable']=0x0;_0x1b91fe[_0x1e9ebc][_0x277e('0x2d')]=0x0;_0x1b91fe[_0x1e9ebc][_0x277e('0x2e')]=0x0;_0x1b91fe[_0x1e9ebc][_0x277e('0x2f')]=0x0;_0x1b91fe[_0x1e9ebc]['outboundCongestionCallsDay']=0x0;_0x1b91fe[_0x1e9ebc][_0x277e('0x30')]=0x0;_0x1b91fe[_0x1e9ebc]['outboundUnknownCallsDay']=0x0;_0x1b91fe[_0x1e9ebc][_0x277e('0x31')]=0x0;_0x1b91fe[_0x1e9ebc]['outboundDropCallsDayCallersExit']=0x0;_0x1b91fe[_0x1e9ebc][_0x277e('0x32')]=0x0;_0x1b91fe[_0x1e9ebc]['outboundOriginateFailureCallsDay']=0x0;_0x1b91fe[_0x1e9ebc]['outboundRejectCallsDay']=0x0;_0x1b91fe[_0x1e9ebc][_0x277e('0x33')]=0x0;_0x1b91fe[_0x1e9ebc][_0x277e('0x2d')]=0x0;_0x1b91fe[_0x1e9ebc][_0x277e('0x34')]=0x0;_0x1b91fe[_0x1e9ebc][_0x277e('0x35')]=!![];}}}}Realtime[_0x277e('0x36')][_0x277e('0x37')]=function(_0x3315f2,_0x3431fd){for(var _0x4aa92e in _0x3431fd){if(_0x3315f2['hasOwnProperty'](_0x4aa92e)){_0x3315f2[_0x4aa92e]=_0x3431fd[_0x4aa92e];}}};Realtime[_0x277e('0x36')][_0x277e('0x38')]=function(){var _0x12e9a9=this;return function(_0x216e4f){if(_0x216e4f){freeIsNotKeyAgent(_0x216e4f,_0x12e9a9[_0x277e('0x39')]);for(var _0x637e59=0x0,_0x1b6457={},_0x4a1112={};_0x637e59<_0x216e4f['length'];_0x637e59+=0x1){_0x1b6457=_0x216e4f[_0x637e59];var _0x345894=_[_0x277e('0x25')](_0x1b6457[_0x277e('0x26')])?util[_0x277e('0x22')]('SIP/%s',_0x1b6457['name']):_0x1b6457['interface'];if(_[_0x277e('0x3a')](_0x12e9a9['agents'][_0x345894])){_0x12e9a9[_0x277e('0x39')][_0x345894]=new Agent(_0x1b6457);}else{_0x12e9a9[_0x277e('0x37')](_0x12e9a9[_0x277e('0x39')][_0x345894],_0x1b6457);}}}return _0x12e9a9[_0x277e('0x39')];};};Realtime[_0x277e('0x36')]['initTelephones']=function(){var _0xb48fc5=this;return function(_0x185b59){if(_0x185b59){freeIsNotKeySip(_0x185b59,_0xb48fc5[_0x277e('0x3b')]);for(var _0x5ed814=0x0,_0x5c2bec={},_0x2e43ae={};_0x5ed814<_0x185b59[_0x277e('0x3c')];_0x5ed814+=0x1){_0x5c2bec=_0x185b59[_0x5ed814];if(_[_0x277e('0x3a')](_0xb48fc5[_0x277e('0x3b')][util['format']('SIP/%s',_0x5c2bec[_0x277e('0x24')])])){_0xb48fc5['telephones'][util[_0x277e('0x22')](_0x277e('0x23'),_0x5c2bec[_0x277e('0x24')])]=new Telephone(_0x5c2bec);}else{_0xb48fc5[_0x277e('0x37')](_0xb48fc5['telephones'][util[_0x277e('0x22')](_0x277e('0x23'),_0x5c2bec[_0x277e('0x24')])],_0x5c2bec);}}}return _0xb48fc5[_0x277e('0x3b')];};};Realtime[_0x277e('0x36')][_0x277e('0x3d')]=function(){var _0x1d787e=this;return function(_0x43ec5d){if(_0x43ec5d){freeIsNotKeySip(_0x43ec5d,_0x1d787e['trunks']);for(var _0x2486ea=0x0,_0x48eb0f={},_0x3cffa1={};_0x2486ea<_0x43ec5d['length'];_0x2486ea+=0x1){_0x48eb0f=_0x43ec5d[_0x2486ea];if(_[_0x277e('0x3a')](_0x1d787e[_0x277e('0x10')][util['format']('SIP/%s',_0x48eb0f['name'])])){_0x1d787e['trunks'][util[_0x277e('0x22')](_0x277e('0x23'),_0x48eb0f[_0x277e('0x24')])]=new Trunk(_0x48eb0f);}else{_0x1d787e[_0x277e('0x37')](_0x1d787e[_0x277e('0x10')][util['format'](_0x277e('0x23'),_0x48eb0f[_0x277e('0x24')])],_0x48eb0f);}}}return _0x1d787e['trunks'];};};Realtime[_0x277e('0x36')]['initVoiceQueues']=function(){var _0x1cdbd1=this;return function(_0x1a3a14){if(_0x1a3a14){freeIsNotKey(_0x1a3a14,_0x1cdbd1[_0x277e('0x11')],_0x277e('0x24'));for(var _0x1a1bb4=0x0,_0x1c4f36={},_0x87eaf1={};_0x1a1bb4<_0x1a3a14['length'];_0x1a1bb4+=0x1){_0x1c4f36=_0x1a3a14[_0x1a1bb4];if(_[_0x277e('0x3a')](_0x1cdbd1[_0x277e('0x11')][_0x1c4f36[_0x277e('0x24')]])){_0x1cdbd1['voiceQueues'][_0x1c4f36[_0x277e('0x24')]]=new VoiceQueue(_0x1c4f36);}else{_0x1cdbd1[_0x277e('0x37')](_0x1cdbd1[_0x277e('0x11')][_0x1c4f36[_0x277e('0x24')]],_0x1c4f36);}}}return _0x1cdbd1[_0x277e('0x11')];};};Realtime[_0x277e('0x36')][_0x277e('0x3e')]=function(){var _0x236cf0=this;return function(_0x33270e){if(_0x33270e){freeIsNotKey(_0x33270e,_0x236cf0['triggers'],'id');for(var _0x264480=0x0,_0x84d08c={},_0x57b4ca={};_0x264480<_0x33270e[_0x277e('0x3c')];_0x264480+=0x1){_0x84d08c=_0x33270e[_0x264480];if(_[_0x277e('0x3a')](_0x236cf0['triggers'][_0x84d08c['id']])){_0x236cf0[_0x277e('0x12')][_0x84d08c['id']]=new Trigger(_0x84d08c);}else{_0x236cf0[_0x277e('0x37')](_0x236cf0[_0x277e('0x12')][_0x84d08c['id']],_0x84d08c);}}}return _0x236cf0[_0x277e('0x12')];};};Realtime[_0x277e('0x36')]['initTemplates']=function(){var _0x66b119=this;return function(_0x2a2fc9){if(_0x2a2fc9){freeIsNotKey(_0x2a2fc9,_0x66b119[_0x277e('0x3f')],'id');for(var _0x151481=0x0,_0x4a2812={},_0x687c13={};_0x151481<_0x2a2fc9['length'];_0x151481+=0x1){_0x4a2812=_0x2a2fc9[_0x151481];if(_['isUndefined'](_0x66b119[_0x277e('0x3f')][_0x4a2812['id']])){_0x66b119[_0x277e('0x3f')][_0x4a2812['id']]=new Template(_0x4a2812);}else{_0x66b119[_0x277e('0x37')](_0x66b119[_0x277e('0x3f')][_0x4a2812['id']],_0x4a2812);}}}return _0x66b119[_0x277e('0x3f')];};};Realtime[_0x277e('0x36')][_0x277e('0x40')]=function(){var _0x573f56=this;return function(_0x506f1d){if(_0x506f1d){freeIsNotKey(_0x506f1d,_0x573f56[_0x277e('0x41')],'id');for(var _0xa75ecc=0x0,_0x4b05a3={},_0x32af94={};_0xa75ecc<_0x506f1d[_0x277e('0x3c')];_0xa75ecc+=0x1){_0x4b05a3=_0x506f1d[_0xa75ecc];if(_[_0x277e('0x3a')](_0x573f56[_0x277e('0x41')][_0x4b05a3['id']])){_0x573f56[_0x277e('0x41')][_0x4b05a3['id']]=new ZendeskAccount(_0x4b05a3);}else{_0x573f56[_0x277e('0x37')](_0x573f56[_0x277e('0x41')][_0x4b05a3['id']],_0x4b05a3);}}}return _0x573f56[_0x277e('0x41')];};};Realtime[_0x277e('0x36')]['initSalesforceAccounts']=function(){var _0xc2a3d4=this;return function(_0x16a6c0){if(_0x16a6c0){freeIsNotKey(_0x16a6c0,_0xc2a3d4['salesforceAccounts'],'id');for(var _0x58b9b4=0x0,_0xb25176={},_0x329ed5={};_0x58b9b4<_0x16a6c0[_0x277e('0x3c')];_0x58b9b4+=0x1){_0xb25176=_0x16a6c0[_0x58b9b4];if(_[_0x277e('0x3a')](_0xc2a3d4[_0x277e('0x18')][_0xb25176['id']])){_0xc2a3d4[_0x277e('0x18')][_0xb25176['id']]=new SalesforceAccount(_0xb25176);}else{_0xc2a3d4['mergeFromDatabase'](_0xc2a3d4[_0x277e('0x18')][_0xb25176['id']],_0xb25176);}}}return _0xc2a3d4[_0x277e('0x18')];};};Realtime[_0x277e('0x36')]['initFreshdeskAccounts']=function(){var _0x4f3d15=this;return function(_0x4f86fe){if(_0x4f86fe){freeIsNotKey(_0x4f86fe,_0x4f3d15[_0x277e('0x42')],'id');for(var _0x99eb2e=0x0,_0x446d92={},_0x1a691e={};_0x99eb2e<_0x4f86fe[_0x277e('0x3c')];_0x99eb2e+=0x1){_0x446d92=_0x4f86fe[_0x99eb2e];if(_['isUndefined'](_0x4f3d15[_0x277e('0x42')][_0x446d92['id']])){_0x4f3d15[_0x277e('0x42')][_0x446d92['id']]=new FreshdeskAccount(_0x446d92);}else{_0x4f3d15['mergeFromDatabase'](_0x4f3d15['freshdeskAccounts'][_0x446d92['id']],_0x446d92);}}}return _0x4f3d15[_0x277e('0x42')];};};Realtime['prototype'][_0x277e('0x43')]=function(){var _0x4d1e09=this;return function(_0x250103){if(_0x250103){freeIsNotKey(_0x250103,_0x4d1e09[_0x277e('0x1a')],'id');for(var _0x1007a4=0x0,_0x53c276={},_0x126401={};_0x1007a4<_0x250103[_0x277e('0x3c')];_0x1007a4+=0x1){_0x53c276=_0x250103[_0x1007a4];if(_[_0x277e('0x3a')](_0x4d1e09[_0x277e('0x1a')][_0x53c276['id']])){_0x4d1e09[_0x277e('0x1a')][_0x53c276['id']]=new ZohoAccount(_0x53c276);}else{_0x4d1e09['mergeFromDatabase'](_0x4d1e09['zohoAccounts'][_0x53c276['id']],_0x53c276);}}}return _0x4d1e09[_0x277e('0x1a')];};};Realtime[_0x277e('0x36')][_0x277e('0x44')]=function(){var _0x18132e=this;return function(_0x36bb7b){if(_0x36bb7b){freeIsNotKey(_0x36bb7b,_0x18132e['deskAccounts'],'id');for(var _0x1ab4ea=0x0,_0xaa1294={},_0x4ec42f={};_0x1ab4ea<_0x36bb7b[_0x277e('0x3c')];_0x1ab4ea+=0x1){_0xaa1294=_0x36bb7b[_0x1ab4ea];if(_[_0x277e('0x3a')](_0x18132e[_0x277e('0x1b')][_0xaa1294['id']])){_0x18132e[_0x277e('0x1b')][_0xaa1294['id']]=new DeskAccount(_0xaa1294);}else{_0x18132e[_0x277e('0x37')](_0x18132e[_0x277e('0x1b')][_0xaa1294['id']],_0xaa1294);}}}return _0x18132e['deskAccounts'];};};Realtime[_0x277e('0x36')][_0x277e('0x45')]=function(){var _0x27a55f=this;return function(_0x286bef){if(_0x286bef){freeIsNotKey(_0x286bef,_0x27a55f[_0x277e('0x19')],'id');for(var _0x15ee60=0x0,_0x51f45a={},_0x479556={};_0x15ee60<_0x286bef[_0x277e('0x3c')];_0x15ee60+=0x1){_0x51f45a=_0x286bef[_0x15ee60];if(_['isUndefined'](_0x27a55f[_0x277e('0x19')][_0x51f45a['id']])){_0x27a55f[_0x277e('0x19')][_0x51f45a['id']]=new SugarcrmAccount(_0x51f45a);}else{_0x27a55f[_0x277e('0x37')](_0x27a55f['sugarcrmAccounts'][_0x51f45a['id']],_0x51f45a);}}}return _0x27a55f['sugarcrmAccounts'];};};Realtime['prototype'][_0x277e('0x46')]=function(){var _0x1f895f=this;return function(_0x58c642){if(_0x58c642){freeIsNotKey(_0x58c642,_0x1f895f['vtigerAccounts'],'id');for(var _0x377923=0x0,_0x39e868={},_0x5d7808={};_0x377923<_0x58c642[_0x277e('0x3c')];_0x377923+=0x1){_0x39e868=_0x58c642[_0x377923];if(_['isUndefined'](_0x1f895f[_0x277e('0x1c')][_0x39e868['id']])){_0x1f895f[_0x277e('0x1c')][_0x39e868['id']]=new VtigerAccount(_0x39e868);}else{_0x1f895f['mergeFromDatabase'](_0x1f895f['vtigerAccounts'][_0x39e868['id']],_0x39e868);}}}return _0x1f895f[_0x277e('0x1c')];};};Realtime['prototype'][_0x277e('0x47')]=function(){var _0x4aa847=this;return function(_0x1ea262){if(_0x1ea262){freeIsNotKey(_0x1ea262,_0x4aa847['servicenowAccounts'],'id');for(var _0x3e0365=0x0,_0x3e32b0={},_0x2e5b32={};_0x3e0365<_0x1ea262[_0x277e('0x3c')];_0x3e0365+=0x1){_0x3e32b0=_0x1ea262[_0x3e0365];if(_[_0x277e('0x3a')](_0x4aa847['servicenowAccounts'][_0x3e32b0['id']])){_0x4aa847['servicenowAccounts'][_0x3e32b0['id']]=new ServicenowAccount(_0x3e32b0);}else{_0x4aa847[_0x277e('0x37')](_0x4aa847[_0x277e('0x1d')][_0x3e32b0['id']],_0x3e32b0);}}}return _0x4aa847[_0x277e('0x1d')];};};Realtime[_0x277e('0x36')][_0x277e('0x48')]=function(){var _0x5bc1be=this;return function(_0x91bb3c){if(_0x91bb3c){freeIsNotKey(_0x91bb3c,_0x5bc1be[_0x277e('0x1e')],'id');for(var _0x32566b=0x0,_0x51e00b={},_0x5eace3={};_0x32566b<_0x91bb3c[_0x277e('0x3c')];_0x32566b+=0x1){_0x51e00b=_0x91bb3c[_0x32566b];if(_[_0x277e('0x3a')](_0x5bc1be[_0x277e('0x1e')][_0x51e00b['id']])){_0x5bc1be[_0x277e('0x1e')][_0x51e00b['id']]=new Dynamics365Account(_0x51e00b);}else{_0x5bc1be[_0x277e('0x37')](_0x5bc1be[_0x277e('0x1e')][_0x51e00b['id']],_0x51e00b);}}}return _0x5bc1be['dynamics365Accounts'];};};Realtime[_0x277e('0x36')][_0x277e('0x49')]=function(){var _0x158a6d=this;return function(_0xdc7152){if(_0xdc7152){freeIsNotKey(_0xdc7152,_0x158a6d[_0x277e('0x1f')],'id');for(var _0x251d01=0x0,_0x523e9d={},_0x21c24b={};_0x251d01<_0xdc7152[_0x277e('0x3c')];_0x251d01+=0x1){_0x523e9d=_0xdc7152[_0x251d01];if(_[_0x277e('0x3a')](_0x158a6d[_0x277e('0x1f')][_0x523e9d['id']])){_0x158a6d[_0x277e('0x1f')][_0x523e9d['id']]=new FreshsalesAccount(_0x523e9d);}else{_0x158a6d[_0x277e('0x37')](_0x158a6d[_0x277e('0x1f')][_0x523e9d['id']],_0x523e9d);}}}return _0x158a6d[_0x277e('0x1f')];};};Realtime[_0x277e('0x36')]['initVoiceQueueHopperHistory']=function(){var _0x1b68fa=this;return function(_0x2a3961){for(var _0x407ed2=0x0;_0x407ed2<_0x2a3961[_0x277e('0x3c')];_0x407ed2+=0x1){_[_0x277e('0x4a')](_0x1b68fa[_0x277e('0x11')][_0x2a3961[_0x407ed2][_0x277e('0x24')]],_0x2a3961[_0x407ed2]);}return _0x1b68fa[_0x277e('0x11')];};};Realtime[_0x277e('0x36')][_0x277e('0x4b')]=function(){var _0x28061f=this;return function(_0x37f5b9){clearVoiceQueues(_0x28061f['voiceQueues']);if(_0x37f5b9){_0x37f5b9=_[_0x277e('0x4c')](_0x37f5b9,_0x277e('0x4d'));for(var _0x1467d5 in _0x37f5b9){if(_0x37f5b9[_0x277e('0x21')](_0x1467d5)){var _0x161e03={};for(var _0x255147=0x0;_0x255147<_0x37f5b9[_0x1467d5][_0x277e('0x3c')];_0x255147+=0x1){var _0x5bf9f6=_0x37f5b9[_0x1467d5][_0x255147][_0x277e('0x4e')];if(_0x28061f[_0x277e('0x11')][_0x5bf9f6]){if(_0x37f5b9[_0x1467d5][_0x255147]['queuecallerexit']){_0x28061f['voiceQueues'][_0x5bf9f6][_0x277e('0x2c')]+=0x1;}if(_0x37f5b9[_0x1467d5][_0x255147][_0x277e('0x4f')]){_0x28061f[_0x277e('0x11')][_0x5bf9f6][_0x277e('0x50')]+=0x1;}_0x28061f['voiceQueues'][_0x5bf9f6]['sumHoldTime']+=moment(_0x37f5b9[_0x1467d5][_0x255147]['queuecallerleaveAt'])[_0x277e('0x51')](moment(_0x37f5b9[_0x1467d5][_0x255147][_0x277e('0x52')]),_0x277e('0x53'))||0x0;if(_0x255147===_0x37f5b9[_0x1467d5]['length']-0x1){_0x28061f[_0x277e('0x11')][_0x5bf9f6][_0x277e('0x2a')]+=moment(_0x37f5b9[_0x1467d5][_0x255147][_0x277e('0x54')]||_0x37f5b9[_0x1467d5][_0x255147]['queuecallerabandonAt']||_0x37f5b9[_0x1467d5][_0x255147][_0x277e('0x55')])[_0x277e('0x51')](moment(_0x37f5b9[_0x1467d5][_0x255147][_0x277e('0x52')]),_0x277e('0x53'))||0x0;_0x28061f[_0x277e('0x11')][_0x5bf9f6]['total']+=0x1;if(_0x37f5b9[_0x1467d5][_0x255147][_0x277e('0x56')]){_0x28061f[_0x277e('0x11')][_0x5bf9f6][_0x277e('0x28')]+=0x1;_0x28061f[_0x277e('0x11')][_0x5bf9f6]['sumBillable']+=moment(_0x37f5b9[_0x1467d5][_0x255147]['queuecallercompleteAt'])[_0x277e('0x51')](moment(_0x37f5b9[_0x1467d5][_0x255147][_0x277e('0x57')]),'seconds')||0x0;}}else{_0x28061f[_0x277e('0x11')][_0x5bf9f6]['sumDuration']+=_0x28061f[_0x277e('0x11')][_0x5bf9f6][_0x277e('0x29')]||0x0;}}}}}}return _0x28061f[_0x277e('0x11')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x1581d2=this;return function(_0xbcc082){clearVoiceCallReports(_0x1581d2[_0x277e('0x58')]);if(_0xbcc082){for(var _0x1d9658=0x0;_0x1d9658<_0xbcc082[_0x277e('0x3c')];_0x1d9658+=0x1){_0x1581d2['outbound'][_0x277e('0x27')]+=0x1;_0x1581d2[_0x277e('0x58')][_0x277e('0x2a')]+=_0xbcc082[_0x1d9658][_0x277e('0x59')];if(_0xbcc082[_0x1d9658][_0x277e('0x5a')]==='ANSWERED'){_0x1581d2[_0x277e('0x58')][_0x277e('0x28')]+=0x1;_0x1581d2[_0x277e('0x58')]['sumHoldTime']+=_0xbcc082[_0x1d9658][_0x277e('0x59')]-_0xbcc082[_0x1d9658][_0x277e('0x5b')]||0x0;_0x1581d2[_0x277e('0x58')][_0x277e('0x5c')]+=_0xbcc082[_0x1d9658]['billableseconds'];}}}return _0x1581d2[_0x277e('0x58')];};};Realtime['prototype'][_0x277e('0x5d')]=function(){var _0x5d7906=this;return function(_0x46877b){if(_0x46877b){freeIsNotKey(_0x46877b,_0x5d7906[_0x277e('0x13')],_0x277e('0x24'));for(var _0x58523f=0x0,_0x1911db={};_0x58523f<_0x46877b[_0x277e('0x3c')];_0x58523f+=0x1){_0x1911db=_0x46877b[_0x58523f];if(_[_0x277e('0x3a')](_0x5d7906['campaigns'][_0x1911db['name']])){_0x5d7906[_0x277e('0x13')][_0x1911db[_0x277e('0x24')]]=new Campaign(_0x1911db);}else{_0x5d7906[_0x277e('0x37')](_0x5d7906[_0x277e('0x13')][_0x1911db['name']],_0x1911db);_0x5d7906[_0x277e('0x13')][_0x1911db[_0x277e('0x24')]][_0x277e('0x5e')]=_0x1911db[_0x277e('0x5f')]?_0x1911db[_0x277e('0x5f')][_0x277e('0x24')]:undefined;}}}return _0x5d7906[_0x277e('0x13')];};};Realtime[_0x277e('0x36')][_0x277e('0x60')]=function(){var _0x5509dd=this;return function(_0x2435ce){if(_0x2435ce){freeIsNotKey(_0x2435ce,_0x5509dd[_0x277e('0x14')],'id');for(var _0x34a7e4=0x0,_0x803b8a={};_0x34a7e4<_0x2435ce[_0x277e('0x3c')];_0x34a7e4+=0x1){_0x803b8a=_0x2435ce[_0x34a7e4];if(_['isUndefined'](_0x5509dd[_0x277e('0x14')][_0x803b8a['id']])){_0x5509dd[_0x277e('0x14')][_0x803b8a['id']]=new VoiceExtension(_0x803b8a);}else{_0x5509dd[_0x277e('0x37')](_0x5509dd[_0x277e('0x14')][_0x803b8a['id']],_0x803b8a);}}}return _0x5509dd[_0x277e('0x14')];};};Realtime[_0x277e('0x36')]['initCampaignHopperHistory']=function(){var _0x3a007d=this;return function(_0x477c4f){clearCampaigns(_0x3a007d[_0x277e('0x13')]);for(var _0x331ee2=0x0;_0x331ee2<_0x477c4f[_0x277e('0x3c')];_0x331ee2+=0x1){_[_0x277e('0x4a')](_0x3a007d[_0x277e('0x13')][_0x477c4f[_0x331ee2][_0x277e('0x24')]],_0x477c4f[_0x331ee2]);}return _0x3a007d[_0x277e('0x13')];};};Realtime[_0x277e('0x36')][_0x277e('0x61')]=function(){var _0x43e4b8=this;return function(_0x1d3a8c){if(_0x1d3a8c){freeIsNotKey(_0x1d3a8c,_0x43e4b8[_0x277e('0x62')],'id');for(var _0x6cb265=0x0,_0x217ff4={},_0x39649f={};_0x6cb265<_0x1d3a8c['length'];_0x6cb265+=0x1){_0x217ff4=_0x1d3a8c[_0x6cb265];if(_['isUndefined'](_0x43e4b8[_0x277e('0x62')][_0x217ff4['id']])){_0x43e4b8[_0x277e('0x62')][_0x217ff4['id']]=new FaxAccount(_0x217ff4);}else{_0x43e4b8['mergeFromDatabase'](_0x43e4b8[_0x277e('0x62')][_0x217ff4['id']],_0x217ff4);}}}return _0x43e4b8[_0x277e('0x62')];};};module[_0x277e('0x63')]=Realtime; \ No newline at end of file +var _0x1375=['agents','trunks','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','interface','format','answered','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','sumHoldTime','sumDuration','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','isUndefined','initTelephones','telephones','initVoiceQueues','length','initTriggers','triggers','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','total','duration','disposition','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','bluebird','util','lodash','moment','../model/agent','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/freshsalesAccount'];(function(_0x5c4824,_0x197457){var _0x5b1578=function(_0x492525){while(--_0x492525){_0x5c4824['push'](_0x5c4824['shift']());}};_0x5b1578(++_0x197457);}(_0x1375,0xb9));var _0x5137=function(_0x221813,_0x4ef7d2){_0x221813=_0x221813-0x0;var _0x509789=_0x1375[_0x221813];return _0x509789;};'use strict';var BPromise=require(_0x5137('0x0'));var util=require(_0x5137('0x1'));var _=require(_0x5137('0x2'));var moment=require(_0x5137('0x3'));var Agent=require(_0x5137('0x4'));var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0x5137('0x5'));var Trigger=require(_0x5137('0x6'));var Template=require(_0x5137('0x7'));var Campaign=require(_0x5137('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x5137('0x9'));var FreshdeskAccount=require(_0x5137('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x5137('0xb'));var DeskAccount=require(_0x5137('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x5137('0xd'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x5137('0xe'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x5137('0xf')]={};this['telephones']={};this[_0x5137('0x10')]={};this[_0x5137('0x11')]={};this['triggers']={};this[_0x5137('0x12')]={};this[_0x5137('0x13')]={};this[_0x5137('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x5137('0x15')]={};this[_0x5137('0x16')]={};this[_0x5137('0x17')]={};this[_0x5137('0x18')]={};this[_0x5137('0x19')]={};this['settings']={};this[_0x5137('0x1a')]={};this[_0x5137('0x1b')]={};this[_0x5137('0x1c')]={};this[_0x5137('0x1d')]={};this[_0x5137('0x1e')]={};this['deskAccounts']={};this[_0x5137('0x1f')]={};this[_0x5137('0x20')]={};this['dynamics365Accounts']={};this[_0x5137('0x21')]={};this['faxAccounts']={};};function freeIsNotKey(_0x4784b9,_0x3aa5ff,_0x38ca8f){var _0x1d9ad6=_[_0x5137('0x22')](_0x4784b9,function(_0x5c4de4,_0x540531){return _0x5c4de4[_0x38ca8f];});for(var _0xdeb5d5 in _0x3aa5ff){if(_0x3aa5ff[_0x5137('0x23')](_0xdeb5d5)){if(!_0x1d9ad6[_0xdeb5d5]){delete _0x3aa5ff[_0xdeb5d5];}}}}function freeIsNotKeySip(_0x11e8c6,_0x554431){var _0x18d3ed=_[_0x5137('0x22')](_0x11e8c6,function(_0x453d59,_0xcdccc3){return util['format'](_0x5137('0x24'),_0x453d59[_0x5137('0x25')]);});for(var _0x52a467 in _0x554431){if(_0x554431['hasOwnProperty'](_0x52a467)){if(!_0x18d3ed[_0x52a467]){delete _0x554431[_0x52a467];}}}}function freeIsNotKeyAgent(_0x189409,_0x1f7f48){var _0x426188=_[_0x5137('0x22')](_0x189409,function(_0x3007be,_0x2914b4){var _0x5a830c=_[_0x5137('0x26')](_0x3007be[_0x5137('0x27')])?util[_0x5137('0x28')](_0x5137('0x24'),_0x3007be[_0x5137('0x25')]):_0x3007be['interface'];return _0x5a830c;});for(var _0x514dc1 in _0x1f7f48){if(_0x1f7f48['hasOwnProperty'](_0x514dc1)){if(!_0x426188[_0x514dc1]){delete _0x1f7f48[_0x514dc1];}}}}function clearVoiceCallReports(_0x3065e1){_0x3065e1['total']=0x0;_0x3065e1[_0x5137('0x29')]=0x0;_0x3065e1['sumHoldTime']=0x0;_0x3065e1['sumDuration']=0x0;_0x3065e1[_0x5137('0x2a')]=0x0;}function clearCampaigns(_0x2a727e){if(!_[_0x5137('0x2b')](_0x2a727e)){for(var _0x5457ff in _0x2a727e){if(_0x2a727e['hasOwnProperty'](_0x5457ff)){_0x2a727e[_0x5457ff]['ivrTotalCallsDays']=0x0;_0x2a727e[_0x5457ff][_0x5137('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x1adc1f){if(!_['isEmpty'](_0x1adc1f)){for(var _0x80cc6e in _0x1adc1f){if(_0x1adc1f[_0x5137('0x23')](_0x80cc6e)){_0x1adc1f[_0x80cc6e]['total']=0x0;_0x1adc1f[_0x80cc6e][_0x5137('0x29')]=0x0;_0x1adc1f[_0x80cc6e][_0x5137('0x2d')]=0x0;_0x1adc1f[_0x80cc6e]['abandoned']=0x0;_0x1adc1f[_0x80cc6e][_0x5137('0x2e')]=0x0;_0x1adc1f[_0x80cc6e][_0x5137('0x2f')]=0x0;_0x1adc1f[_0x80cc6e][_0x5137('0x2a')]=0x0;_0x1adc1f[_0x80cc6e][_0x5137('0x30')]=0x0;_0x1adc1f[_0x80cc6e]['outboundNoAnswerCallsDay']=0x0;_0x1adc1f[_0x80cc6e][_0x5137('0x31')]=0x0;_0x1adc1f[_0x80cc6e]['outboundCongestionCallsDay']=0x0;_0x1adc1f[_0x80cc6e]['outboundNoSuchCallsDay']=0x0;_0x1adc1f[_0x80cc6e]['outboundUnknownCallsDay']=0x0;_0x1adc1f[_0x80cc6e][_0x5137('0x32')]=0x0;_0x1adc1f[_0x80cc6e]['outboundDropCallsDayCallersExit']=0x0;_0x1adc1f[_0x80cc6e][_0x5137('0x33')]=0x0;_0x1adc1f[_0x80cc6e][_0x5137('0x34')]=0x0;_0x1adc1f[_0x80cc6e][_0x5137('0x35')]=0x0;_0x1adc1f[_0x80cc6e][_0x5137('0x36')]=0x0;_0x1adc1f[_0x80cc6e][_0x5137('0x30')]=0x0;_0x1adc1f[_0x80cc6e][_0x5137('0x37')]=0x0;_0x1adc1f[_0x80cc6e][_0x5137('0x38')]=!![];}}}}Realtime[_0x5137('0x39')][_0x5137('0x3a')]=function(_0x47fd58,_0xf7c8df){for(var _0x5b0c0c in _0xf7c8df){if(_0x47fd58[_0x5137('0x23')](_0x5b0c0c)){_0x47fd58[_0x5b0c0c]=_0xf7c8df[_0x5b0c0c];}}};Realtime[_0x5137('0x39')][_0x5137('0x3b')]=function(){var _0x46e086=this;return function(_0x504fd9){if(_0x504fd9){freeIsNotKeyAgent(_0x504fd9,_0x46e086[_0x5137('0xf')]);for(var _0x179e8d=0x0,_0x6942ed={},_0x48e772={};_0x179e8d<_0x504fd9['length'];_0x179e8d+=0x1){_0x6942ed=_0x504fd9[_0x179e8d];var _0x346259=_[_0x5137('0x26')](_0x6942ed[_0x5137('0x27')])?util[_0x5137('0x28')](_0x5137('0x24'),_0x6942ed[_0x5137('0x25')]):_0x6942ed[_0x5137('0x27')];if(_[_0x5137('0x3c')](_0x46e086[_0x5137('0xf')][_0x346259])){_0x46e086[_0x5137('0xf')][_0x346259]=new Agent(_0x6942ed);}else{_0x46e086['mergeFromDatabase'](_0x46e086['agents'][_0x346259],_0x6942ed);}}}return _0x46e086[_0x5137('0xf')];};};Realtime[_0x5137('0x39')][_0x5137('0x3d')]=function(){var _0x20b478=this;return function(_0x4c92fb){if(_0x4c92fb){freeIsNotKeySip(_0x4c92fb,_0x20b478[_0x5137('0x3e')]);for(var _0x3bb5dc=0x0,_0x26650f={},_0x194738={};_0x3bb5dc<_0x4c92fb['length'];_0x3bb5dc+=0x1){_0x26650f=_0x4c92fb[_0x3bb5dc];if(_['isUndefined'](_0x20b478['telephones'][util[_0x5137('0x28')](_0x5137('0x24'),_0x26650f[_0x5137('0x25')])])){_0x20b478['telephones'][util[_0x5137('0x28')](_0x5137('0x24'),_0x26650f['name'])]=new Telephone(_0x26650f);}else{_0x20b478[_0x5137('0x3a')](_0x20b478[_0x5137('0x3e')][util[_0x5137('0x28')]('SIP/%s',_0x26650f[_0x5137('0x25')])],_0x26650f);}}}return _0x20b478[_0x5137('0x3e')];};};Realtime[_0x5137('0x39')]['initTrunks']=function(){var _0x5ac0b1=this;return function(_0x29b652){if(_0x29b652){freeIsNotKeySip(_0x29b652,_0x5ac0b1['trunks']);for(var _0x69405e=0x0,_0x21eb9d={},_0x4469e7={};_0x69405e<_0x29b652['length'];_0x69405e+=0x1){_0x21eb9d=_0x29b652[_0x69405e];if(_[_0x5137('0x3c')](_0x5ac0b1['trunks'][util[_0x5137('0x28')](_0x5137('0x24'),_0x21eb9d[_0x5137('0x25')])])){_0x5ac0b1[_0x5137('0x10')][util[_0x5137('0x28')](_0x5137('0x24'),_0x21eb9d[_0x5137('0x25')])]=new Trunk(_0x21eb9d);}else{_0x5ac0b1[_0x5137('0x3a')](_0x5ac0b1[_0x5137('0x10')][util[_0x5137('0x28')](_0x5137('0x24'),_0x21eb9d[_0x5137('0x25')])],_0x21eb9d);}}}return _0x5ac0b1[_0x5137('0x10')];};};Realtime[_0x5137('0x39')][_0x5137('0x3f')]=function(){var _0x4a34a1=this;return function(_0x33e4d5){if(_0x33e4d5){freeIsNotKey(_0x33e4d5,_0x4a34a1[_0x5137('0x11')],'name');for(var _0x54795f=0x0,_0x9a3624={},_0x1a0a08={};_0x54795f<_0x33e4d5[_0x5137('0x40')];_0x54795f+=0x1){_0x9a3624=_0x33e4d5[_0x54795f];if(_['isUndefined'](_0x4a34a1[_0x5137('0x11')][_0x9a3624[_0x5137('0x25')]])){_0x4a34a1[_0x5137('0x11')][_0x9a3624['name']]=new VoiceQueue(_0x9a3624);}else{_0x4a34a1[_0x5137('0x3a')](_0x4a34a1[_0x5137('0x11')][_0x9a3624[_0x5137('0x25')]],_0x9a3624);}}}return _0x4a34a1[_0x5137('0x11')];};};Realtime['prototype'][_0x5137('0x41')]=function(){var _0x1ef0b6=this;return function(_0x22301c){if(_0x22301c){freeIsNotKey(_0x22301c,_0x1ef0b6[_0x5137('0x42')],'id');for(var _0x5e83af=0x0,_0x30696c={},_0x5c96a9={};_0x5e83af<_0x22301c['length'];_0x5e83af+=0x1){_0x30696c=_0x22301c[_0x5e83af];if(_[_0x5137('0x3c')](_0x1ef0b6[_0x5137('0x42')][_0x30696c['id']])){_0x1ef0b6[_0x5137('0x42')][_0x30696c['id']]=new Trigger(_0x30696c);}else{_0x1ef0b6[_0x5137('0x3a')](_0x1ef0b6[_0x5137('0x42')][_0x30696c['id']],_0x30696c);}}}return _0x1ef0b6['triggers'];};};Realtime[_0x5137('0x39')]['initTemplates']=function(){var _0x36f14b=this;return function(_0x58da89){if(_0x58da89){freeIsNotKey(_0x58da89,_0x36f14b[_0x5137('0x13')],'id');for(var _0x9b9b70=0x0,_0x11b8df={},_0xd7569a={};_0x9b9b70<_0x58da89[_0x5137('0x40')];_0x9b9b70+=0x1){_0x11b8df=_0x58da89[_0x9b9b70];if(_[_0x5137('0x3c')](_0x36f14b[_0x5137('0x13')][_0x11b8df['id']])){_0x36f14b[_0x5137('0x13')][_0x11b8df['id']]=new Template(_0x11b8df);}else{_0x36f14b['mergeFromDatabase'](_0x36f14b['templates'][_0x11b8df['id']],_0x11b8df);}}}return _0x36f14b[_0x5137('0x13')];};};Realtime[_0x5137('0x39')][_0x5137('0x43')]=function(){var _0x16225b=this;return function(_0x2b0467){if(_0x2b0467){freeIsNotKey(_0x2b0467,_0x16225b[_0x5137('0x1a')],'id');for(var _0x2b75f6=0x0,_0x330cf2={},_0x3cab6e={};_0x2b75f6<_0x2b0467[_0x5137('0x40')];_0x2b75f6+=0x1){_0x330cf2=_0x2b0467[_0x2b75f6];if(_['isUndefined'](_0x16225b['zendeskAccounts'][_0x330cf2['id']])){_0x16225b[_0x5137('0x1a')][_0x330cf2['id']]=new ZendeskAccount(_0x330cf2);}else{_0x16225b[_0x5137('0x3a')](_0x16225b[_0x5137('0x1a')][_0x330cf2['id']],_0x330cf2);}}}return _0x16225b[_0x5137('0x1a')];};};Realtime['prototype'][_0x5137('0x44')]=function(){var _0x176fed=this;return function(_0x3e6683){if(_0x3e6683){freeIsNotKey(_0x3e6683,_0x176fed[_0x5137('0x1b')],'id');for(var _0x24d056=0x0,_0xbeb76c={},_0x218e07={};_0x24d056<_0x3e6683[_0x5137('0x40')];_0x24d056+=0x1){_0xbeb76c=_0x3e6683[_0x24d056];if(_[_0x5137('0x3c')](_0x176fed['salesforceAccounts'][_0xbeb76c['id']])){_0x176fed['salesforceAccounts'][_0xbeb76c['id']]=new SalesforceAccount(_0xbeb76c);}else{_0x176fed[_0x5137('0x3a')](_0x176fed['salesforceAccounts'][_0xbeb76c['id']],_0xbeb76c);}}}return _0x176fed[_0x5137('0x1b')];};};Realtime[_0x5137('0x39')][_0x5137('0x45')]=function(){var _0x1eccff=this;return function(_0x32840f){if(_0x32840f){freeIsNotKey(_0x32840f,_0x1eccff[_0x5137('0x1d')],'id');for(var _0x41654e=0x0,_0x32a27b={},_0x217544={};_0x41654e<_0x32840f['length'];_0x41654e+=0x1){_0x32a27b=_0x32840f[_0x41654e];if(_[_0x5137('0x3c')](_0x1eccff[_0x5137('0x1d')][_0x32a27b['id']])){_0x1eccff[_0x5137('0x1d')][_0x32a27b['id']]=new FreshdeskAccount(_0x32a27b);}else{_0x1eccff['mergeFromDatabase'](_0x1eccff['freshdeskAccounts'][_0x32a27b['id']],_0x32a27b);}}}return _0x1eccff[_0x5137('0x1d')];};};Realtime[_0x5137('0x39')]['initZohoAccounts']=function(){var _0x20d8dd=this;return function(_0x284bf2){if(_0x284bf2){freeIsNotKey(_0x284bf2,_0x20d8dd[_0x5137('0x1e')],'id');for(var _0x10a4cd=0x0,_0x2e083a={},_0x308853={};_0x10a4cd<_0x284bf2['length'];_0x10a4cd+=0x1){_0x2e083a=_0x284bf2[_0x10a4cd];if(_[_0x5137('0x3c')](_0x20d8dd[_0x5137('0x1e')][_0x2e083a['id']])){_0x20d8dd[_0x5137('0x1e')][_0x2e083a['id']]=new ZohoAccount(_0x2e083a);}else{_0x20d8dd[_0x5137('0x3a')](_0x20d8dd[_0x5137('0x1e')][_0x2e083a['id']],_0x2e083a);}}}return _0x20d8dd['zohoAccounts'];};};Realtime[_0x5137('0x39')][_0x5137('0x46')]=function(){var _0x3c71d6=this;return function(_0x578510){if(_0x578510){freeIsNotKey(_0x578510,_0x3c71d6[_0x5137('0x47')],'id');for(var _0x18898f=0x0,_0x2dc8e6={},_0x44e51b={};_0x18898f<_0x578510[_0x5137('0x40')];_0x18898f+=0x1){_0x2dc8e6=_0x578510[_0x18898f];if(_['isUndefined'](_0x3c71d6['deskAccounts'][_0x2dc8e6['id']])){_0x3c71d6[_0x5137('0x47')][_0x2dc8e6['id']]=new DeskAccount(_0x2dc8e6);}else{_0x3c71d6[_0x5137('0x3a')](_0x3c71d6[_0x5137('0x47')][_0x2dc8e6['id']],_0x2dc8e6);}}}return _0x3c71d6[_0x5137('0x47')];};};Realtime['prototype'][_0x5137('0x48')]=function(){var _0xdb01e4=this;return function(_0x3f8141){if(_0x3f8141){freeIsNotKey(_0x3f8141,_0xdb01e4[_0x5137('0x1c')],'id');for(var _0x130eae=0x0,_0x2a916b={},_0x4b32d7={};_0x130eae<_0x3f8141[_0x5137('0x40')];_0x130eae+=0x1){_0x2a916b=_0x3f8141[_0x130eae];if(_[_0x5137('0x3c')](_0xdb01e4[_0x5137('0x1c')][_0x2a916b['id']])){_0xdb01e4[_0x5137('0x1c')][_0x2a916b['id']]=new SugarcrmAccount(_0x2a916b);}else{_0xdb01e4['mergeFromDatabase'](_0xdb01e4[_0x5137('0x1c')][_0x2a916b['id']],_0x2a916b);}}}return _0xdb01e4[_0x5137('0x1c')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x122c82=this;return function(_0x92ee87){if(_0x92ee87){freeIsNotKey(_0x92ee87,_0x122c82[_0x5137('0x1f')],'id');for(var _0x400383=0x0,_0x24e9ed={},_0x213070={};_0x400383<_0x92ee87[_0x5137('0x40')];_0x400383+=0x1){_0x24e9ed=_0x92ee87[_0x400383];if(_[_0x5137('0x3c')](_0x122c82[_0x5137('0x1f')][_0x24e9ed['id']])){_0x122c82[_0x5137('0x1f')][_0x24e9ed['id']]=new VtigerAccount(_0x24e9ed);}else{_0x122c82[_0x5137('0x3a')](_0x122c82[_0x5137('0x1f')][_0x24e9ed['id']],_0x24e9ed);}}}return _0x122c82[_0x5137('0x1f')];};};Realtime[_0x5137('0x39')][_0x5137('0x49')]=function(){var _0x5b6512=this;return function(_0x4d63a3){if(_0x4d63a3){freeIsNotKey(_0x4d63a3,_0x5b6512[_0x5137('0x20')],'id');for(var _0x33c6e6=0x0,_0x5415a6={},_0x4a57a9={};_0x33c6e6<_0x4d63a3[_0x5137('0x40')];_0x33c6e6+=0x1){_0x5415a6=_0x4d63a3[_0x33c6e6];if(_[_0x5137('0x3c')](_0x5b6512['servicenowAccounts'][_0x5415a6['id']])){_0x5b6512[_0x5137('0x20')][_0x5415a6['id']]=new ServicenowAccount(_0x5415a6);}else{_0x5b6512[_0x5137('0x3a')](_0x5b6512[_0x5137('0x20')][_0x5415a6['id']],_0x5415a6);}}}return _0x5b6512['servicenowAccounts'];};};Realtime[_0x5137('0x39')][_0x5137('0x4a')]=function(){var _0x3a2205=this;return function(_0x5f0355){if(_0x5f0355){freeIsNotKey(_0x5f0355,_0x3a2205[_0x5137('0x4b')],'id');for(var _0x34599a=0x0,_0x4b370f={},_0x3e33a3={};_0x34599a<_0x5f0355['length'];_0x34599a+=0x1){_0x4b370f=_0x5f0355[_0x34599a];if(_[_0x5137('0x3c')](_0x3a2205[_0x5137('0x4b')][_0x4b370f['id']])){_0x3a2205[_0x5137('0x4b')][_0x4b370f['id']]=new Dynamics365Account(_0x4b370f);}else{_0x3a2205['mergeFromDatabase'](_0x3a2205[_0x5137('0x4b')][_0x4b370f['id']],_0x4b370f);}}}return _0x3a2205['dynamics365Accounts'];};};Realtime[_0x5137('0x39')]['initFreshsalesAccounts']=function(){var _0x858807=this;return function(_0x2b230f){if(_0x2b230f){freeIsNotKey(_0x2b230f,_0x858807[_0x5137('0x21')],'id');for(var _0x39a009=0x0,_0x225613={},_0x3a7b5a={};_0x39a009<_0x2b230f[_0x5137('0x40')];_0x39a009+=0x1){_0x225613=_0x2b230f[_0x39a009];if(_['isUndefined'](_0x858807[_0x5137('0x21')][_0x225613['id']])){_0x858807[_0x5137('0x21')][_0x225613['id']]=new FreshsalesAccount(_0x225613);}else{_0x858807[_0x5137('0x3a')](_0x858807['freshsalesAccounts'][_0x225613['id']],_0x225613);}}}return _0x858807['freshsalesAccounts'];};};Realtime[_0x5137('0x39')][_0x5137('0x4c')]=function(){var _0x482f8c=this;return function(_0x3e05bf){for(var _0x13d8c2=0x0;_0x13d8c2<_0x3e05bf[_0x5137('0x40')];_0x13d8c2+=0x1){_[_0x5137('0x4d')](_0x482f8c['voiceQueues'][_0x3e05bf[_0x13d8c2][_0x5137('0x25')]],_0x3e05bf[_0x13d8c2]);}return _0x482f8c[_0x5137('0x11')];};};Realtime[_0x5137('0x39')]['initVoiceQueueReports']=function(){var _0xfa30ff=this;return function(_0x3ad28c){clearVoiceQueues(_0xfa30ff[_0x5137('0x11')]);if(_0x3ad28c){_0x3ad28c=_[_0x5137('0x4e')](_0x3ad28c,_0x5137('0x4f'));for(var _0x876f08 in _0x3ad28c){if(_0x3ad28c[_0x5137('0x23')](_0x876f08)){var _0x210e0c={};for(var _0x4b532d=0x0;_0x4b532d<_0x3ad28c[_0x876f08]['length'];_0x4b532d+=0x1){var _0x20c004=_0x3ad28c[_0x876f08][_0x4b532d]['queue'];if(_0xfa30ff['voiceQueues'][_0x20c004]){if(_0x3ad28c[_0x876f08][_0x4b532d][_0x5137('0x50')]){_0xfa30ff[_0x5137('0x11')][_0x20c004][_0x5137('0x2d')]+=0x1;}if(_0x3ad28c[_0x876f08][_0x4b532d]['queuecallerabandon']){_0xfa30ff['voiceQueues'][_0x20c004][_0x5137('0x51')]+=0x1;}_0xfa30ff[_0x5137('0x11')][_0x20c004]['sumHoldTime']+=moment(_0x3ad28c[_0x876f08][_0x4b532d]['queuecallerleaveAt'])[_0x5137('0x52')](moment(_0x3ad28c[_0x876f08][_0x4b532d][_0x5137('0x53')]),_0x5137('0x54'))||0x0;if(_0x4b532d===_0x3ad28c[_0x876f08][_0x5137('0x40')]-0x1){_0xfa30ff[_0x5137('0x11')][_0x20c004][_0x5137('0x2f')]+=moment(_0x3ad28c[_0x876f08][_0x4b532d][_0x5137('0x55')]||_0x3ad28c[_0x876f08][_0x4b532d]['queuecallerabandonAt']||_0x3ad28c[_0x876f08][_0x4b532d]['queuecallerexitAt'])[_0x5137('0x52')](moment(_0x3ad28c[_0x876f08][_0x4b532d][_0x5137('0x53')]),_0x5137('0x54'))||0x0;_0xfa30ff[_0x5137('0x11')][_0x20c004]['total']+=0x1;if(_0x3ad28c[_0x876f08][_0x4b532d][_0x5137('0x56')]){_0xfa30ff[_0x5137('0x11')][_0x20c004]['answered']+=0x1;_0xfa30ff[_0x5137('0x11')][_0x20c004][_0x5137('0x2a')]+=moment(_0x3ad28c[_0x876f08][_0x4b532d]['queuecallercompleteAt'])[_0x5137('0x52')](moment(_0x3ad28c[_0x876f08][_0x4b532d][_0x5137('0x57')]),_0x5137('0x54'))||0x0;}}else{_0xfa30ff[_0x5137('0x11')][_0x20c004]['sumDuration']+=_0xfa30ff[_0x5137('0x11')][_0x20c004][_0x5137('0x2e')]||0x0;}}}}}}return _0xfa30ff[_0x5137('0x11')];};};Realtime[_0x5137('0x39')][_0x5137('0x58')]=function(){var _0x22e18c=this;return function(_0x3923d9){clearVoiceCallReports(_0x22e18c['outbound']);if(_0x3923d9){for(var _0x11ba1b=0x0;_0x11ba1b<_0x3923d9['length'];_0x11ba1b+=0x1){_0x22e18c[_0x5137('0x14')][_0x5137('0x59')]+=0x1;_0x22e18c['outbound'][_0x5137('0x2f')]+=_0x3923d9[_0x11ba1b][_0x5137('0x5a')];if(_0x3923d9[_0x11ba1b][_0x5137('0x5b')]==='ANSWERED'){_0x22e18c['outbound'][_0x5137('0x29')]+=0x1;_0x22e18c['outbound'][_0x5137('0x2e')]+=_0x3923d9[_0x11ba1b][_0x5137('0x5a')]-_0x3923d9[_0x11ba1b][_0x5137('0x5c')]||0x0;_0x22e18c[_0x5137('0x14')][_0x5137('0x2a')]+=_0x3923d9[_0x11ba1b][_0x5137('0x5c')];}}}return _0x22e18c[_0x5137('0x14')];};};Realtime[_0x5137('0x39')][_0x5137('0x5d')]=function(){var _0x3bf651=this;return function(_0x12c755){if(_0x12c755){freeIsNotKey(_0x12c755,_0x3bf651['campaigns'],_0x5137('0x25'));for(var _0x540a53=0x0,_0x599985={};_0x540a53<_0x12c755[_0x5137('0x40')];_0x540a53+=0x1){_0x599985=_0x12c755[_0x540a53];if(_[_0x5137('0x3c')](_0x3bf651['campaigns'][_0x599985[_0x5137('0x25')]])){_0x3bf651[_0x5137('0x12')][_0x599985[_0x5137('0x25')]]=new Campaign(_0x599985);}else{_0x3bf651[_0x5137('0x3a')](_0x3bf651[_0x5137('0x12')][_0x599985[_0x5137('0x25')]],_0x599985);_0x3bf651[_0x5137('0x12')][_0x599985[_0x5137('0x25')]][_0x5137('0x5e')]=_0x599985[_0x5137('0x5f')]?_0x599985[_0x5137('0x5f')][_0x5137('0x25')]:undefined;}}}return _0x3bf651[_0x5137('0x12')];};};Realtime[_0x5137('0x39')][_0x5137('0x60')]=function(){var _0x5233da=this;return function(_0x11be77){if(_0x11be77){freeIsNotKey(_0x11be77,_0x5233da[_0x5137('0x15')],'id');for(var _0x2526ed=0x0,_0x127255={};_0x2526ed<_0x11be77['length'];_0x2526ed+=0x1){_0x127255=_0x11be77[_0x2526ed];if(_[_0x5137('0x3c')](_0x5233da[_0x5137('0x15')][_0x127255['id']])){_0x5233da['voiceExtensions'][_0x127255['id']]=new VoiceExtension(_0x127255);}else{_0x5233da[_0x5137('0x3a')](_0x5233da[_0x5137('0x15')][_0x127255['id']],_0x127255);}}}return _0x5233da[_0x5137('0x15')];};};Realtime[_0x5137('0x39')][_0x5137('0x61')]=function(){var _0x355807=this;return function(_0x5b6f8e){clearCampaigns(_0x355807[_0x5137('0x12')]);for(var _0x74d7d9=0x0;_0x74d7d9<_0x5b6f8e[_0x5137('0x40')];_0x74d7d9+=0x1){_[_0x5137('0x4d')](_0x355807[_0x5137('0x12')][_0x5b6f8e[_0x74d7d9][_0x5137('0x25')]],_0x5b6f8e[_0x74d7d9]);}return _0x355807[_0x5137('0x12')];};};Realtime[_0x5137('0x39')][_0x5137('0x62')]=function(){var _0x3a722f=this;return function(_0x30ae5e){if(_0x30ae5e){freeIsNotKey(_0x30ae5e,_0x3a722f[_0x5137('0x63')],'id');for(var _0x16ed55=0x0,_0xac774a={},_0x3cd3a4={};_0x16ed55<_0x30ae5e['length'];_0x16ed55+=0x1){_0xac774a=_0x30ae5e[_0x16ed55];if(_['isUndefined'](_0x3a722f[_0x5137('0x63')][_0xac774a['id']])){_0x3a722f[_0x5137('0x63')][_0xac774a['id']]=new FaxAccount(_0xac774a);}else{_0x3a722f['mergeFromDatabase'](_0x3a722f[_0x5137('0x63')][_0xac774a['id']],_0xac774a);}}}return _0x3a722f[_0x5137('0x63')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 5306cda..ce93953 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 _0x0968=['bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','interface','format','length','connectedlinenum','assigned','isNil','SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','destination','exten','lastapplication','lastdata','queue','context','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','calleridname','transfers','transfereelinkedid','uniqueid','linkedid','type','UserId','membername','monitor','monitors','filename','createdAt','isArray','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','voiceCallReport'];(function(_0x11d684,_0x4d4123){var _0x78a301=function(_0x1a1966){while(--_0x1a1966){_0x11d684['push'](_0x11d684['shift']());}};_0x78a301(++_0x4d4123);}(_0x0968,0xf4));var _0x8096=function(_0x4787aa,_0x16b755){_0x4787aa=_0x4787aa-0x0;var _0x571fdf=_0x0968[_0x4787aa];return _0x571fdf;};'use strict';var _=require(_0x8096('0x0'));var moment=require(_0x8096('0x1'));var util=require('util');var config=require(_0x8096('0x2'));var ami=require(_0x8096('0x3'));var RpcVoiceAgentReport=require(_0x8096('0x4'));var RpcVoiceCallReport=require(_0x8096('0x5'));var RpcVoiceDialReport=require(_0x8096('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x8096('0x7'));var RpcVoiceRecording=require(_0x8096('0x8'));var RpcVoiceTransferReport=require(_0x8096('0x9'));var VoiceQueueReport=require(_0x8096('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x8096('0xb'));var UserReport=require(_0x8096('0xc'));function Report(_0x3d307d){this[_0x8096('0xd')]=_0x3d307d;this[_0x8096('0xe')]=_0x3d307d['agents'];this['telephones']=_0x3d307d[_0x8096('0xf')];}Report[_0x8096('0x10')][_0x8096('0x11')]=function(_0x2dd910){var _0x417559=new VoiceQueueReport(this[_0x8096('0xd')]);var _0x2ab345=new VoiceAgentReport(this['realtime']);var _0x970372=new VoiceDialReport(this[_0x8096('0xd')]);var _0x2f52f3=new VoiceCallReport(this[_0x8096('0xd')]);var _0x170426=new UserReport(this['realtime']);if(config[_0x8096('0x12')]&&config['xdr'][_0x8096('0x13')]){ami['on'](_0x8096('0x14'),this[_0x8096('0x15')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x8096('0x16')][_0x8096('0x17')](this));ami['on'](_0x8096('0x18'),this[_0x8096('0x19')][_0x8096('0x17')](this));ami['on'](_0x8096('0x1a'),this[_0x8096('0x1b')][_0x8096('0x17')](this));ami['on']('blindtransfer',this[_0x8096('0x1c')][_0x8096('0x17')](this));ami['on'](_0x8096('0x1d'),this[_0x8096('0x1e')][_0x8096('0x17')](this));}};Report[_0x8096('0x10')][_0x8096('0x1f')]=function(_0x5a277e){var _0x26817c;_0x26817c=_[_0x8096('0x20')](this[_0x8096('0xe')],function(_0x44ad5d){return _0x44ad5d[_0x8096('0x21')]==_0x5a277e||_0x44ad5d[_0x8096('0x22')]==_0x5a277e;});if(_['isNil'](_0x26817c)){var _0x1c04b8=_[_0x8096('0x20')](this[_0x8096('0xf')],function(_0x35c7be){return _0x35c7be['accountcode']==_0x5a277e||_0x35c7be[_0x8096('0x22')]==_0x5a277e;});if(_0x1c04b8){_0x26817c=_[_0x8096('0x20')](this[_0x8096('0xe')],function(_0x258604){return _0x258604[_0x8096('0x23')]==util[_0x8096('0x24')]('SIP/%s',_0x1c04b8[_0x8096('0x22')]);});}}return _0x26817c;};Report[_0x8096('0x10')][_0x8096('0x15')]=function(_0x24824c){for(var _0xd93664=0x0;_0xd93664<_0x24824c[_0x8096('0x25')];_0xd93664+=0x1){var _0x3077dc=this['findAgent'](_0x24824c[_0xd93664][_0x8096('0x26')]);if(_0x3077dc){_0x24824c[_0xd93664]['accountcode']=_0x3077dc[_0x8096('0x21')];_0x24824c[_0xd93664][_0x8096('0x27')]=!![];_0x24824c[_0xd93664]['lastAssignedTo']=_0x3077dc['name'];_0x24824c[_0xd93664][_0x8096('0x23')]=_[_0x8096('0x28')](_0x3077dc['interface'])?util[_0x8096('0x24')](_0x8096('0x29'),_0x3077dc[_0x8096('0x22')]):_0x3077dc[_0x8096('0x23')];if(_0x24824c[_0xd93664][_0x8096('0x2a')]){_0x24824c[_0xd93664]['queuecallercompleteAt']=moment()[_0x8096('0x24')](_0x8096('0x2b'));}if(_0x24824c[_0xd93664][_0x8096('0x2c')]){_0x24824c[_0xd93664][_0x8096('0x2d')]=moment()[_0x8096('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x24824c[_0xd93664]);}RpcVoiceQueueReport[_0x8096('0x2e')](_0x24824c[_0xd93664]);}};function extractCalleridNumber(_0x35bdc9){var _0x483185=_0x35bdc9['match'](/<(.*?)>/);return _0x483185?_0x483185[0x1]:_0x35bdc9;}Report[_0x8096('0x10')][_0x8096('0x2f')]=function(_0x341243){for(var _0x7cf8d4=0x0;_0x7cf8d4',_0x7922cf[_0x8096('0x44')],_0x7922cf[_0x8096('0x34')]);}if(RpcVoiceTransferReport['transfers'][_0x7922cf['linkedid']]){var _0x1fc5bc=RpcVoiceTransferReport[_0x8096('0x45')][_0x7922cf['linkedid']];_0x1fc5bc[_0x8096('0x46')]=_0x7922cf[_0x8096('0x47')];RpcVoiceTransferReport['blindTransfer'](_0x1fc5bc);delete RpcVoiceTransferReport['transfers'][_0x7922cf[_0x8096('0x48')]];}if(_[_0x8096('0x28')](_0x7922cf[_0x8096('0x49')])){_0x7922cf[_0x8096('0x49')]=this[_0x8096('0x31')](_0x7922cf);}if(_[_0x8096('0x28')](_0x7922cf['UserId'])){var _0x4be144=_0x7922cf['channel'][_0x8096('0x33')]('-')[0x0];var _0x28896b=this[_0x8096('0xe')][_0x4be144];if(!_0x28896b)_0x28896b=this[_0x8096('0x2f')](_0x7922cf[_0x8096('0x21')]);if(_0x28896b){_0x7922cf[_0x8096('0x4a')]=_0x28896b['id'];_0x7922cf[_0x8096('0x4b')]=_0x28896b[_0x8096('0x22')];}}RpcVoiceCallReport[_0x8096('0x2e')](_0x7922cf);if(_0x7922cf[_0x8096('0x4c')]){for(var _0x527523=0x0;_0x527523<_0x7922cf[_0x8096('0x4d')][_0x8096('0x25')];_0x527523+=0x1){_0x7922cf['monitorFilename']=_0x7922cf['monitors'][_0x527523][_0x8096('0x4e')];_0x7922cf[_0x8096('0x4f')]=_0x7922cf[_0x8096('0x4d')][_0x527523][_0x8096('0x4f')];if(_0x7922cf[_0x8096('0x37')]==_0x8096('0x3e')){_0x7922cf[_0x8096('0x34')]=_0x7922cf[_0x8096('0x26')];_0x7922cf[_0x8096('0x44')]=_0x7922cf['connectedlinename'];_0x7922cf[_0x8096('0x26')]=_0x7922cf['accountcode'];_0x7922cf['connectedlinename']=_0x7922cf['membername'];_0x7922cf['exten']=_0x7922cf[_0x8096('0x3f')];}else if(_0x7922cf[_0x8096('0x37')]=='xcally-motion-dialer'){_0x7922cf[_0x8096('0x34')]=_0x7922cf[_0x8096('0x36')];_0x7922cf[_0x8096('0x37')]=_0x7922cf['originatecalleridnum'];}RpcVoiceRecording[_0x8096('0x2e')](_0x7922cf);}}};Report[_0x8096('0x10')][_0x8096('0x19')]=function(_0x475959){if(_[_0x8096('0x50')](_0x475959)){_0x475959['forEach'](function(_0x57062a){RpcVoiceAgentReport[_0x8096('0x2e')](_0x57062a);});}else{RpcVoiceAgentReport[_0x8096('0x2e')](_0x475959);}};Report[_0x8096('0x10')]['voiceDialReport']=function(_0x1e3d00){RpcVoiceDialReport['create'](_0x1e3d00);var _0x12ef85;var _0x3a7ac9;var _0x25a2b0=_0x1e3d00['channel'];if(_[_0x8096('0x51')](_0x25a2b0,'Local')){_0x3a7ac9=_0x25a2b0[_0x8096('0x52')](_0x25a2b0[_0x8096('0x53')]('/')+0x1,_0x25a2b0[_0x8096('0x53')]('@'));_0x12ef85=_[_0x8096('0x20')](this[_0x8096('0xe')],function(_0x5ae56f){return _0x5ae56f[_0x8096('0x54')]==_0x3a7ac9||_0x5ae56f[_0x8096('0x55')]==_0x3a7ac9||_0x5ae56f['accountcode']==_0x3a7ac9;});}else{_0x3a7ac9=_0x25a2b0['substring'](_0x25a2b0[_0x8096('0x53')]('/')+0x1,_0x25a2b0[_0x8096('0x56')]('-'));_0x12ef85=this[_0x8096('0x1f')](_0x3a7ac9);}if(_0x12ef85){_0x1e3d00['interface']=_[_0x8096('0x28')](_0x12ef85[_0x8096('0x23')])?util['format'](_0x8096('0x29'),_0x12ef85[_0x8096('0x22')]):_0x12ef85[_0x8096('0x23')];_0x1e3d00['membername']=_0x12ef85[_0x8096('0x22')];_0x1e3d00[_0x8096('0x21')]=_0x12ef85[_0x8096('0x21')];RpcMemberReport[_0x8096('0x1b')](_0x1e3d00);}};Report[_0x8096('0x10')][_0x8096('0x1c')]=function(_0x11b4a1){RpcVoiceTransferReport[_0x8096('0x45')][_0x11b4a1[_0x8096('0x57')]]=_0x11b4a1;};Report[_0x8096('0x10')][_0x8096('0x1e')]=function(_0x4ad29b){RpcVoiceTransferReport[_0x8096('0x1e')](_0x4ad29b);};module[_0x8096('0x58')]=Report; \ No newline at end of file +var _0x8091=['calleridnum','outbound','internal','voiceCallReport','destination','exten','type','lastapplication','queue','lastdata','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','split','membername','monitor','monitors','monitorFilename','filename','calleridname','connectedlinename','originatecalleridnum','xcally-motion-dialer','create','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','voiceQueueReport','custom:voiceAgentReport','voiceAgentReport','bind','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','findAgent','find','name','interface','connectedlinenum','accountcode','assigned','lastAssignedTo','isNil','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','format','match','keys','length','getCallType','channel','getAgentByInternal'];(function(_0x35af6b,_0xd7dc0b){var _0xc9727e=function(_0x3bcdd4){while(--_0x3bcdd4){_0x35af6b['push'](_0x35af6b['shift']());}};_0xc9727e(++_0xd7dc0b);}(_0x8091,0x8f));var _0x1809=function(_0x58d178,_0x2bcb30){_0x58d178=_0x58d178-0x0;var _0x24f6c5=_0x8091[_0x58d178];return _0x24f6c5;};'use strict';var _=require(_0x1809('0x0'));var moment=require(_0x1809('0x1'));var util=require('util');var config=require(_0x1809('0x2'));var ami=require(_0x1809('0x3'));var RpcVoiceAgentReport=require(_0x1809('0x4'));var RpcVoiceCallReport=require(_0x1809('0x5'));var RpcVoiceDialReport=require(_0x1809('0x6'));var RpcMemberReport=require(_0x1809('0x7'));var RpcVoiceQueueReport=require(_0x1809('0x8'));var RpcVoiceRecording=require(_0x1809('0x9'));var RpcVoiceTransferReport=require(_0x1809('0xa'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x1809('0xb'));var VoiceDialReport=require(_0x1809('0xc'));var UserReport=require(_0x1809('0xd'));function Report(_0x55fb5c){this['realtime']=_0x55fb5c;this[_0x1809('0xe')]=_0x55fb5c[_0x1809('0xe')];this[_0x1809('0xf')]=_0x55fb5c[_0x1809('0xf')];}Report[_0x1809('0x10')][_0x1809('0x11')]=function(_0x587647){var _0x228842=new VoiceQueueReport(this[_0x1809('0x12')]);var _0x229a52=new VoiceAgentReport(this['realtime']);var _0x79b8f0=new VoiceDialReport(this[_0x1809('0x12')]);var _0x5402f1=new VoiceCallReport(this[_0x1809('0x12')]);var _0x4bcf10=new UserReport(this[_0x1809('0x12')]);if(config[_0x1809('0x13')]&&config['xdr'][_0x1809('0x14')]){ami['on']('custom:voiceQueueReport',this[_0x1809('0x15')]['bind'](this));ami['on']('custom:voiceCallReport',this['voiceCallReport']['bind'](this));ami['on'](_0x1809('0x16'),this[_0x1809('0x17')][_0x1809('0x18')](this));ami['on'](_0x1809('0x19'),this[_0x1809('0x1a')][_0x1809('0x18')](this));ami['on'](_0x1809('0x1b'),this[_0x1809('0x1c')][_0x1809('0x18')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x1809('0x18')](this));}};Report[_0x1809('0x10')][_0x1809('0x1d')]=function(_0x52dbfa){var _0x2cdf3e;_0x2cdf3e=_[_0x1809('0x1e')](this[_0x1809('0xe')],function(_0x53d6d1){return _0x53d6d1['accountcode']==_0x52dbfa||_0x53d6d1['name']==_0x52dbfa;});if(_['isNil'](_0x2cdf3e)){var _0x4087c7=_[_0x1809('0x1e')](this['telephones'],function(_0x12cc7f){return _0x12cc7f['accountcode']==_0x52dbfa||_0x12cc7f[_0x1809('0x1f')]==_0x52dbfa;});if(_0x4087c7){_0x2cdf3e=_[_0x1809('0x1e')](this[_0x1809('0xe')],function(_0x5876a0){return _0x5876a0[_0x1809('0x20')]==util['format']('SIP/%s',_0x4087c7[_0x1809('0x1f')]);});}}return _0x2cdf3e;};Report[_0x1809('0x10')][_0x1809('0x15')]=function(_0x572887){for(var _0xf875c0=0x0;_0xf875c0<_0x572887['length'];_0xf875c0+=0x1){var _0x860c01=this[_0x1809('0x1d')](_0x572887[_0xf875c0][_0x1809('0x21')]);if(_0x860c01){_0x572887[_0xf875c0][_0x1809('0x22')]=_0x860c01['accountcode'];_0x572887[_0xf875c0][_0x1809('0x23')]=!![];_0x572887[_0xf875c0][_0x1809('0x24')]=_0x860c01[_0x1809('0x1f')];_0x572887[_0xf875c0]['interface']=_[_0x1809('0x25')](_0x860c01[_0x1809('0x20')])?util['format'](_0x1809('0x26'),_0x860c01['name']):_0x860c01[_0x1809('0x20')];if(_0x572887[_0xf875c0][_0x1809('0x27')]){_0x572887[_0xf875c0][_0x1809('0x28')]=moment()['format'](_0x1809('0x29'));}if(_0x572887[_0xf875c0][_0x1809('0x2a')]){_0x572887[_0xf875c0][_0x1809('0x2b')]=moment()[_0x1809('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x1809('0x15')](_0x572887[_0xf875c0]);}RpcVoiceQueueReport['create'](_0x572887[_0xf875c0]);}};function extractCalleridNumber(_0x289c0f){var _0x32cc00=_0x289c0f[_0x1809('0x2d')](/<(.*?)>/);return _0x32cc00?_0x32cc00[0x1]:_0x289c0f;}Report['prototype']['getAgentByInternal']=function(_0x490b64){for(var _0x20281a=0x0;_0x20281a0x0?_0x595247:0x0;this[_0x0102('0x14')][_0x125db7[_0x0102('0x65')]][_0x0102('0x31')]=this['voiceQueues'][_0x125db7[_0x0102('0x65')]]['talking']>_[_0x0102('0x69')](_0x125db7[_0x0102('0x6a')])?_[_0x0102('0x69')](_0x125db7['loggedin']):this[_0x0102('0x14')][_0x125db7['queue']][_0x0102('0x31')];this[_0x0102('0x4f')](this[_0x0102('0x14')][_0x125db7[_0x0102('0x65')]],_0x0102('0x18'));}logger['debug'](_0x0102('0x6c'),util[_0x0102('0x3c')](this[_0x0102('0x14')][_0x125db7[_0x0102('0x65')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0102('0x6d'),this['voiceQueues'][_0x125db7['queue']]);}}}catch(_0x2a63a5){logger['error'](_0x0102('0x64'),util[_0x0102('0x3c')](_0x2a63a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0102('0xd')]['syncQueueSummaryComplete']=function(_0x817e8e){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x0102('0x3c')](_0x817e8e,{'showHidden':![],'depth':null}));this[_0x0102('0x15')]=!![];};VoiceQueueReport['prototype'][_0x0102('0x1e')]=function(_0x43feff){try{if(this[_0x0102('0x61')](_0x43feff)){logger['debug'](_0x0102('0x6e'),_0x43feff[_0x0102('0x46')],util[_0x0102('0x3c')](_0x43feff,{'showHidden':![],'depth':null}));if(_[_0x0102('0x6f')](this['queueReports'][_0x43feff[_0x0102('0x46')]]))this[_0x0102('0x11')][_0x43feff[_0x0102('0x46')]]=[];if(_['isUndefined'](this['channels'][_0x43feff[_0x0102('0x46')]]))this[_0x0102('0x34')][_0x43feff[_0x0102('0x46')]]={};var _0x349c67=new QueueReport();_0x349c67[_0x0102('0x49')]=_0x43feff[_0x0102('0x65')];_0x349c67[_0x0102('0x56')]=this[_0x0102('0x14')][_0x349c67[_0x0102('0x49')]]&&this[_0x0102('0x14')][_0x349c67[_0x0102('0x49')]][_0x0102('0x56')]?this['voiceQueues'][_0x349c67[_0x0102('0x49')]][_0x0102('0x56')]||_0x0102('0x70'):'inbound';_0x349c67['queue']=_0x43feff[_0x0102('0x65')];_0x349c67[_0x0102('0x71')]=moment()[_0x0102('0x47')](_0x0102('0x72'));_0x349c67[_0x0102('0x73')]=_0x43feff[_0x0102('0x73')];_0x349c67['count']=_0x43feff[_0x0102('0x74')];_0x349c67[_0x0102('0x46')]=_0x43feff[_0x0102('0x46')];_0x349c67['routealias']=this[_0x0102('0x34')][_0x43feff[_0x0102('0x46')]][_0x0102('0x75')];logger['info'](_0x0102('0x76'),_0x349c67[_0x0102('0x49')],_0x349c67[_0x0102('0x56')]);_[_0x0102('0x77')](_0x349c67,_[_0x0102('0x78')](_0x43feff,_[_0x0102('0x79')](_0x349c67)));this[_0x0102('0x11')][_0x43feff['uniqueid']][_0x0102('0x7a')](_0x349c67);this[_0x0102('0x34')][_0x43feff[_0x0102('0x46')]]=_0x349c67;this[_0x0102('0x42')](_0x349c67,_0x0102('0x1d'));}}catch(_0x170e84){logger[_0x0102('0x3b')](_0x0102('0x6e'),_0x43feff[_0x0102('0x46')],util[_0x0102('0x3c')](_0x170e84,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0102('0xd')][_0x0102('0x20')]=function(_0x23dae1){try{if(this[_0x0102('0x61')](_0x23dae1)){logger[_0x0102('0x43')]('[%s][voiceQueueReport][queuecallerabandon]',_0x23dae1[_0x0102('0x46')],util[_0x0102('0x3c')](_0x23dae1,{'showHidden':![],'depth':null}));if(this[_0x0102('0x11')][_0x23dae1[_0x0102('0x46')]]){var _0xd60621=_[_0x0102('0x7b')](this['queueReports'][_0x23dae1[_0x0102('0x46')]]);_0xd60621[_0x0102('0x7c')]=![];_0xd60621[_0x0102('0x7d')]=null;_0xd60621[_0x0102('0x7e')]=_0x23dae1[_0x0102('0x7e')];_0xd60621[_0x0102('0x7f')]=_0x23dae1['originalposition'];_0xd60621[_0x0102('0x1f')]=!![];_0xd60621[_0x0102('0x80')]=moment()[_0x0102('0x47')](_0x0102('0x72'));_0xd60621[_0x0102('0x4c')]='ABANDONED';_0xd60621[_0x0102('0x81')]=null;logger[_0x0102('0x82')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0xd60621[_0x0102('0x49')],_0xd60621['type']);this['channels'][_0x23dae1['uniqueid']]=_0xd60621;this[_0x0102('0x4a')](_0xd60621,'queuecallerabandon');}}}catch(_0x38adb6){logger[_0x0102('0x3b')](_0x0102('0x83'),_0x23dae1['uniqueid'],util[_0x0102('0x3c')](_0x38adb6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x589711){try{if(this[_0x0102('0x61')](_0x589711)){logger[_0x0102('0x43')](_0x0102('0x84'),_0x589711[_0x0102('0x46')],util['inspect'](_0x589711,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x589711[_0x0102('0x46')]]){var _0x4e6270=_['last'](this[_0x0102('0x11')][_0x589711[_0x0102('0x46')]]);_0x4e6270[_0x0102('0x85')]=moment()['format'](_0x0102('0x72'));_0x4e6270[_0x0102('0x86')]=_0x589711[_0x0102('0x86')];_0x4e6270[_0x0102('0x87')]=_0x589711['connectedlinename'];logger[_0x0102('0x82')](_0x0102('0x88'),_0x4e6270['name'],_0x4e6270['type'],_0x589711['connectedlinenum'],_0x589711[_0x0102('0x87')]);this[_0x0102('0x34')][_0x589711[_0x0102('0x46')]]=_0x4e6270;this[_0x0102('0x42')](_0x4e6270,_0x0102('0x21'));}}}catch(_0x514487){logger[_0x0102('0x3b')](_0x0102('0x84'),_0x589711[_0x0102('0x46')],util[_0x0102('0x3c')](_0x514487,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0102('0x89')]=function(_0x26b8b3){try{if(this['isNotNull'](_0x26b8b3)){logger[_0x0102('0x43')](_0x0102('0x8a'),_0x26b8b3[_0x0102('0x46')],util[_0x0102('0x3c')](_0x26b8b3,{'showHidden':![],'depth':null}));if(this[_0x0102('0x11')][_0x26b8b3[_0x0102('0x46')]]){var _0x121415=_['last'](this[_0x0102('0x11')][_0x26b8b3[_0x0102('0x46')]]);_0x121415[_0x0102('0x7c')]=!![];_0x121415['queuecallerexitreason']=_0x0102('0x8b');logger[_0x0102('0x82')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x121415[_0x0102('0x49')],_0x121415[_0x0102('0x56')]);}}}catch(_0x90d050){logger[_0x0102('0x3b')](_0x0102('0x8a'),_0x26b8b3[_0x0102('0x46')],util[_0x0102('0x3c')](_0x90d050,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0102('0xd')][_0x0102('0x23')]=function(_0x3a1c82){try{if(this[_0x0102('0x61')](_0x3a1c82)){logger[_0x0102('0x43')](_0x0102('0x8c'),_0x3a1c82[_0x0102('0x46')],util[_0x0102('0x3c')](_0x3a1c82,{'showHidden':![],'depth':null}));if(this[_0x0102('0x11')][_0x3a1c82['uniqueid']]){var _0x451b82=_['last'](this[_0x0102('0x11')][_0x3a1c82[_0x0102('0x46')]]);_0x451b82[_0x0102('0x1f')]=![];_0x451b82['queuecallerabandonAt']=null;_0x451b82[_0x0102('0x8d')]=!![];_0x451b82[_0x0102('0x81')]=_0x3a1c82[_0x0102('0x8e')];_0x451b82[_0x0102('0x7e')]=_0x3a1c82['holdtime'];_0x451b82['queuecallercomplete']=!![];_0x451b82['queuecallerexit']=![];_0x451b82[_0x0102('0x8f')]=null;if(!_0x451b82[_0x0102('0x90')]){if(_0x3a1c82['reason']==_0x0102('0x90')){_0x451b82['queuecallerexitreason']='COMPLETED';logger['info'](_0x0102('0x91'),_0x451b82[_0x0102('0x49')],_0x451b82[_0x0102('0x56')]);}else{if(_[_0x0102('0x92')](_0x3a1c82[_0x0102('0x38')]['toLowerCase'](),'local/')){if(this[_0x0102('0x11')][_0x3a1c82[_0x0102('0x93')]]){var _0x137bcb=_[_0x0102('0x7b')](this[_0x0102('0x11')][_0x3a1c82[_0x0102('0x93')]]);_0x137bcb['queuecallercomplete']=![];_0x137bcb[_0x0102('0x94')]=!![];_0x137bcb[_0x0102('0x8f')]=moment(_0x451b82['queuecallerjoinAt'])[_0x0102('0x95')](_0x3a1c82[_0x0102('0x7e')],_0x0102('0x96'))[_0x0102('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x137bcb[_0x0102('0x4c')]=_0x0102('0x97');_0x137bcb[_0x0102('0x90')]=!![];_0x137bcb[_0x0102('0x98')]=_0x0102('0x99');_0x137bcb[_0x0102('0x9a')]=_0x3a1c82[_0x0102('0x9b')];_0x137bcb[_0x0102('0x9c')]=_0x3a1c82['uniqueid'];logger['info'](_0x0102('0x9d'),_0x137bcb[_0x0102('0x49')],_0x137bcb['type']);var _0xc1105b=this[_0x0102('0x11')][_0x3a1c82['linkedid']];this[_0x0102('0x11')][_0x3a1c82['linkedid']]=this[_0x0102('0x11')][_0x3a1c82['uniqueid']];this[_0x0102('0x11')][_0x3a1c82[_0x0102('0x46')]]=_0xc1105b;}}else{_0x451b82['queuecallerexitreason']='COMPLETEDBY'+_0x3a1c82[_0x0102('0x9e')][_0x0102('0x9f')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x451b82['name'],_0x451b82[_0x0102('0x56')],_0x451b82[_0x0102('0x4c')]);}}}this[_0x0102('0x34')][_0x3a1c82[_0x0102('0x46')]]=_0x451b82;this['emitVoiceQueueChannelRemove'](_0x451b82,_0x0102('0xa0'));}}}catch(_0x2fb1aa){logger[_0x0102('0x3b')](_0x0102('0x8c'),_0x3a1c82['uniqueid'],util['inspect'](_0x2fb1aa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0102('0xd')][_0x0102('0x26')]=function(_0x61334d){try{if(this['isNotNull'](_0x61334d)){logger[_0x0102('0x43')](_0x0102('0xa1'),_0x61334d[_0x0102('0x46')],util['inspect'](_0x61334d,{'showHidden':![],'depth':null}));this[_0x0102('0xa2')](_0x61334d[_0x0102('0x46')],_[_0x0102('0x79')](_0x61334d[_0x0102('0xa3')])[0x0],_0x61334d[_0x0102('0xa4')]);if(this[_0x0102('0x11')][_0x61334d[_0x0102('0x46')]]){var _0x420402=_['last'](this[_0x0102('0x11')][_0x61334d['uniqueid']]);if(_0x420402){if(this[_0x0102('0x61')](_0x61334d[_0x0102('0xa3')])&&this[_0x0102('0x61')](_0x61334d['variable']['queuestatus'])){switch(_0x61334d[_0x0102('0xa4')]){case'CONTINUE':_0x420402['queuecallerexit']=![];_0x420402[_0x0102('0x8f')]=null;break;case _0x0102('0xa5'):_0x420402[_0x0102('0xa6')]=_0x0102('0xa7');_0x420402[_0x0102('0x94')]=!![];_0x420402[_0x0102('0x8f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x420402[_0x0102('0x85')]=moment()[_0x0102('0x47')](_0x0102('0x72'));logger[_0x0102('0x43')](_0x0102('0xa8'),_0x61334d['uniqueid'],util[_0x0102('0x3c')](_0x420402,{'showHidden':![],'depth':null}));ami[_0x0102('0x41')]('custom:timeout',_0x420402);break;default:_0x420402[_0x0102('0x94')]=!![];_0x420402['queuecallerexitAt']=moment()[_0x0102('0x47')](_0x0102('0x72'));_0x420402[_0x0102('0x85')]=moment()['format'](_0x0102('0x72'));}_0x420402['queuecallerabandon']=![];_0x420402[_0x0102('0x80')]=null;_0x420402[_0x0102('0x4c')]=_0x61334d[_0x0102('0xa4')];this['channels'][_0x61334d[_0x0102('0x46')]]=_0x420402;this[_0x0102('0x4a')](_0x420402,'varset');}else if(this[_0x0102('0x61')](_0x61334d['variable'])&&this[_0x0102('0x61')](_0x61334d[_0x0102('0xa3')]['queueposition'])){if(!_0x420402['queuecallerabandon']){_0x420402[_0x0102('0x94')]=!![];_0x420402['queuecallerexitAt']=moment()[_0x0102('0x47')](_0x0102('0x72'));_0x420402[_0x0102('0x4c')]=_0x0102('0xa9');_0x420402['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0102('0x34')][_0x61334d[_0x0102('0x46')]]=_0x420402;}}logger[_0x0102('0x82')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x61334d[_0x0102('0x46')],_0x420402[_0x0102('0x49')],_0x420402[_0x0102('0x56')],_['keys'](_0x61334d['variable'])[0x0],_0x61334d[_0x0102('0xa4')]);_0x420402[_0x0102('0x17')]=this['variables'][_0x61334d[_0x0102('0x46')]];}}}}catch(_0x171177){logger[_0x0102('0x3b')](_0x0102('0xa1'),_0x61334d[_0x0102('0x46')],util[_0x0102('0x3c')](_0x171177,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0102('0xd')]['addVariable']=function(_0x1b762e,_0x30062d,_0x3b63d1){var _0x905a94=['rtpaudioqos',_0x0102('0xaa'),_0x0102('0xab'),_0x0102('0xac'),_0x0102('0xad'),_0x0102('0xae'),_0x0102('0xaf'),'rtpaudioqosrttbridged',_0x0102('0xb0'),_0x0102('0xb1'),_0x0102('0xb2'),_0x0102('0xb3'),_0x0102('0xb4'),_0x0102('0xb5'),_0x0102('0xb6'),'memberlastcall',_0x0102('0x8e'),_0x0102('0xb7'),'memberrealtime'];if(!_[_0x0102('0x36')](_0x30062d)&&!_[_0x0102('0xb8')](_0x905a94,_0x30062d)){if(_['isUndefined'](this['variables'][_0x1b762e])){this[_0x0102('0x17')][_0x1b762e]={};}this[_0x0102('0x17')][_0x1b762e][_0x30062d]=_0x3b63d1;}};VoiceQueueReport[_0x0102('0xd')][_0x0102('0xb9')]=function(_0x58b77b){try{if(this[_0x0102('0x61')](_0x58b77b)){logger[_0x0102('0x43')](_0x0102('0xba'),_0x58b77b['uniqueid'],util[_0x0102('0x3c')](_0x58b77b,{'showHidden':![],'depth':null}));if(this[_0x0102('0x11')][_0x58b77b[_0x0102('0x46')]]){for(var _0x460067=0x0,_0x2292f0={};_0x4600670x0?_0x2505af:0x0;this[_0x0492('0x13')][_0x1f32db[_0x0492('0x6e')]][_0x0492('0x32')]=this[_0x0492('0x13')][_0x1f32db[_0x0492('0x6e')]][_0x0492('0x32')]>_[_0x0492('0x74')](_0x1f32db[_0x0492('0x76')])?_[_0x0492('0x74')](_0x1f32db['loggedin']):this[_0x0492('0x13')][_0x1f32db[_0x0492('0x6e')]][_0x0492('0x32')];this[_0x0492('0x52')](this['voiceQueues'][_0x1f32db[_0x0492('0x6e')]],_0x0492('0x16'));}logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util['inspect'](this[_0x0492('0x13')][_0x1f32db[_0x0492('0x6e')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0492('0x77'),this['voiceQueues'][_0x1f32db['queue']]);}}}catch(_0x5af06b){logger[_0x0492('0x3b')](_0x0492('0x6d'),util[_0x0492('0x3a')](_0x5af06b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0492('0xa')][_0x0492('0x1a')]=function(_0x596a5d){logger[_0x0492('0x45')](_0x0492('0x78'),util[_0x0492('0x3a')](_0x596a5d,{'showHidden':![],'depth':null}));this[_0x0492('0x14')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x2bbbd5){try{if(this[_0x0492('0x67')](_0x2bbbd5)){logger[_0x0492('0x45')](_0x0492('0x79'),_0x2bbbd5[_0x0492('0x7a')],util['inspect'](_0x2bbbd5,{'showHidden':![],'depth':null}));if(_[_0x0492('0x68')](this['queueReports'][_0x2bbbd5['uniqueid']]))this[_0x0492('0xf')][_0x2bbbd5['uniqueid']]=[];if(_[_0x0492('0x68')](this[_0x0492('0x11')][_0x2bbbd5['uniqueid']]))this['channels'][_0x2bbbd5[_0x0492('0x7a')]]={};var _0x5377d1=new QueueReport();_0x5377d1[_0x0492('0x4a')]=_0x2bbbd5[_0x0492('0x6e')];_0x5377d1[_0x0492('0x5c')]=this['voiceQueues'][_0x5377d1['name']]&&this[_0x0492('0x13')][_0x5377d1['name']]['type']?this['voiceQueues'][_0x5377d1[_0x0492('0x4a')]][_0x0492('0x5c')]||_0x0492('0x53'):_0x0492('0x53');_0x5377d1[_0x0492('0x6e')]=_0x2bbbd5[_0x0492('0x6e')];_0x5377d1[_0x0492('0x7b')]=moment()[_0x0492('0x48')](_0x0492('0x7c'));_0x5377d1['position']=_0x2bbbd5[_0x0492('0x7d')];_0x5377d1[_0x0492('0x7e')]=_0x2bbbd5['count'];_0x5377d1['uniqueid']=_0x2bbbd5[_0x0492('0x7a')];_0x5377d1[_0x0492('0x7f')]=this[_0x0492('0x11')][_0x2bbbd5[_0x0492('0x7a')]][_0x0492('0x7f')];logger[_0x0492('0x70')](_0x0492('0x80'),_0x5377d1[_0x0492('0x4a')],_0x5377d1[_0x0492('0x5c')]);_['merge'](_0x5377d1,_['pick'](_0x2bbbd5,_[_0x0492('0x81')](_0x5377d1)));this['queueReports'][_0x2bbbd5[_0x0492('0x7a')]][_0x0492('0x82')](_0x5377d1);this[_0x0492('0x11')][_0x2bbbd5[_0x0492('0x7a')]]=_0x5377d1;this['emitVoiceQueueChannelSave'](_0x5377d1,_0x0492('0x1b'));}}catch(_0x3b73f7){logger[_0x0492('0x3b')](_0x0492('0x79'),_0x2bbbd5['uniqueid'],util[_0x0492('0x3a')](_0x3b73f7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0492('0x1e')]=function(_0xaecd0b){try{if(this[_0x0492('0x67')](_0xaecd0b)){logger[_0x0492('0x45')](_0x0492('0x83'),_0xaecd0b[_0x0492('0x7a')],util[_0x0492('0x3a')](_0xaecd0b,{'showHidden':![],'depth':null}));if(this[_0x0492('0xf')][_0xaecd0b[_0x0492('0x7a')]]){var _0x5afd4c=_[_0x0492('0x84')](this[_0x0492('0xf')][_0xaecd0b['uniqueid']]);_0x5afd4c[_0x0492('0x85')]=![];_0x5afd4c[_0x0492('0x86')]=null;_0x5afd4c[_0x0492('0x87')]=_0xaecd0b[_0x0492('0x87')];_0x5afd4c[_0x0492('0x88')]=_0xaecd0b[_0x0492('0x88')];_0x5afd4c['queuecallerabandon']=!![];_0x5afd4c[_0x0492('0x89')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5afd4c[_0x0492('0x4e')]=_0x0492('0x8a');_0x5afd4c[_0x0492('0x8b')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x5afd4c[_0x0492('0x4a')],_0x5afd4c[_0x0492('0x5c')]);this[_0x0492('0x11')][_0xaecd0b[_0x0492('0x7a')]]=_0x5afd4c;this[_0x0492('0x41')](_0x5afd4c,_0x0492('0x1d'));}}}catch(_0x286e42){logger[_0x0492('0x3b')](_0x0492('0x83'),_0xaecd0b['uniqueid'],util['inspect'](_0x286e42,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0492('0xa')]['syncQueueCallerLeave']=function(_0x2af7a6){try{if(this['isNotNull'](_0x2af7a6)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x2af7a6['uniqueid'],util[_0x0492('0x3a')](_0x2af7a6,{'showHidden':![],'depth':null}));if(this[_0x0492('0xf')][_0x2af7a6[_0x0492('0x7a')]]){var _0x3b6694=_[_0x0492('0x84')](this[_0x0492('0xf')][_0x2af7a6[_0x0492('0x7a')]]);_0x3b6694['queuecallerleaveAt']=moment()[_0x0492('0x48')](_0x0492('0x7c'));_0x3b6694['connectedlinenum']=_0x2af7a6[_0x0492('0x8c')];_0x3b6694[_0x0492('0x8d')]=_0x2af7a6[_0x0492('0x8d')];logger[_0x0492('0x70')](_0x0492('0x8e'),_0x3b6694[_0x0492('0x4a')],_0x3b6694[_0x0492('0x5c')],_0x2af7a6['connectedlinenum'],_0x2af7a6[_0x0492('0x8d')]);this[_0x0492('0x11')][_0x2af7a6['uniqueid']]=_0x3b6694;this[_0x0492('0x44')](_0x3b6694,_0x0492('0x8f'));}}}catch(_0x56daf4){logger[_0x0492('0x3b')](_0x0492('0x90'),_0x2af7a6[_0x0492('0x7a')],util[_0x0492('0x3a')](_0x56daf4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0492('0x23')]=function(_0x102653){try{if(this[_0x0492('0x67')](_0x102653)){logger['debug'](_0x0492('0x91'),_0x102653[_0x0492('0x7a')],util['inspect'](_0x102653,{'showHidden':![],'depth':null}));if(this[_0x0492('0xf')][_0x102653[_0x0492('0x7a')]]){var _0x3afad0=_[_0x0492('0x84')](this[_0x0492('0xf')][_0x102653[_0x0492('0x7a')]]);_0x3afad0[_0x0492('0x85')]=!![];_0x3afad0[_0x0492('0x4e')]=_0x0492('0x92');logger[_0x0492('0x70')](_0x0492('0x93'),_0x3afad0[_0x0492('0x4a')],_0x3afad0[_0x0492('0x5c')]);}}}catch(_0x429412){logger['error'](_0x0492('0x91'),_0x102653[_0x0492('0x7a')],util[_0x0492('0x3a')](_0x429412,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0492('0xa')][_0x0492('0x21')]=function(_0x3f5adb){try{if(this[_0x0492('0x67')](_0x3f5adb)){logger['debug'](_0x0492('0x94'),_0x3f5adb['uniqueid'],util[_0x0492('0x3a')](_0x3f5adb,{'showHidden':![],'depth':null}));if(this[_0x0492('0xf')][_0x3f5adb[_0x0492('0x7a')]]){var _0x44ccd8=_[_0x0492('0x84')](this[_0x0492('0xf')][_0x3f5adb[_0x0492('0x7a')]]);_0x44ccd8[_0x0492('0x1d')]=![];_0x44ccd8[_0x0492('0x89')]=null;_0x44ccd8[_0x0492('0x95')]=!![];_0x44ccd8['lastAssignedTo']=_0x3f5adb[_0x0492('0x96')];_0x44ccd8[_0x0492('0x87')]=_0x3f5adb['holdtime'];_0x44ccd8[_0x0492('0x85')]=!![];_0x44ccd8[_0x0492('0x97')]=![];_0x44ccd8[_0x0492('0x98')]=null;if(!_0x44ccd8[_0x0492('0x99')]){if(_0x3f5adb[_0x0492('0x9a')]==_0x0492('0x99')){_0x44ccd8[_0x0492('0x4e')]=_0x0492('0x9b');logger[_0x0492('0x70')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x44ccd8[_0x0492('0x4a')],_0x44ccd8['type']);}else{if(_[_0x0492('0x9c')](_0x3f5adb[_0x0492('0x9d')]['toLowerCase'](),_0x0492('0x9e'))){if(this[_0x0492('0xf')][_0x3f5adb[_0x0492('0x9f')]]){var _0x1ad9e0=_[_0x0492('0x84')](this[_0x0492('0xf')][_0x3f5adb[_0x0492('0x9f')]]);_0x1ad9e0[_0x0492('0x85')]=![];_0x1ad9e0[_0x0492('0x97')]=!![];_0x1ad9e0[_0x0492('0x98')]=moment(_0x44ccd8[_0x0492('0x7b')])[_0x0492('0xa0')](_0x3f5adb[_0x0492('0x87')],'seconds')['format'](_0x0492('0x7c'));_0x1ad9e0[_0x0492('0x4e')]=_0x0492('0xa1');_0x1ad9e0[_0x0492('0x99')]=!![];_0x1ad9e0['transfertype']='FORWARD';_0x1ad9e0[_0x0492('0xa2')]=_0x3f5adb[_0x0492('0xa3')];_0x1ad9e0[_0x0492('0xa4')]=_0x3f5adb['uniqueid'];logger['info'](_0x0492('0xa5'),_0x1ad9e0[_0x0492('0x4a')],_0x1ad9e0[_0x0492('0x5c')]);var _0x12eb7f=this[_0x0492('0xf')][_0x3f5adb['linkedid']];this['queueReports'][_0x3f5adb[_0x0492('0x9f')]]=this['queueReports'][_0x3f5adb[_0x0492('0x7a')]];this[_0x0492('0xf')][_0x3f5adb[_0x0492('0x7a')]]=_0x12eb7f;}}else{_0x44ccd8[_0x0492('0x4e')]=_0x0492('0xa6')+_0x3f5adb[_0x0492('0x9a')][_0x0492('0xa7')]();logger[_0x0492('0x70')](_0x0492('0xa8'),_0x44ccd8[_0x0492('0x4a')],_0x44ccd8[_0x0492('0x5c')],_0x44ccd8[_0x0492('0x4e')]);}}}this[_0x0492('0x11')][_0x3f5adb[_0x0492('0x7a')]]=_0x44ccd8;this['emitVoiceQueueChannelRemove'](_0x44ccd8,_0x0492('0x20'));}}}catch(_0x414e2e){logger[_0x0492('0x3b')]('[%s][voiceQueueReport][agentcomplete]',_0x3f5adb[_0x0492('0x7a')],util[_0x0492('0x3a')](_0x414e2e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0492('0x24')]=function(_0x4b93e5){try{if(this[_0x0492('0x67')](_0x4b93e5)){logger[_0x0492('0x45')](_0x0492('0xa9'),_0x4b93e5[_0x0492('0x7a')],util[_0x0492('0x3a')](_0x4b93e5,{'showHidden':![],'depth':null}));this[_0x0492('0xaa')](_0x4b93e5['uniqueid'],_[_0x0492('0x81')](_0x4b93e5[_0x0492('0xab')])[0x0],_0x4b93e5[_0x0492('0xac')]);if(this[_0x0492('0xf')][_0x4b93e5[_0x0492('0x7a')]]){var _0x1c1e0a=_['last'](this['queueReports'][_0x4b93e5[_0x0492('0x7a')]]);if(_0x1c1e0a){if(this[_0x0492('0x67')](_0x4b93e5[_0x0492('0xab')])&&this[_0x0492('0x67')](_0x4b93e5[_0x0492('0xab')][_0x0492('0xad')])){switch(_0x4b93e5[_0x0492('0xac')]){case _0x0492('0xae'):_0x1c1e0a['queuecallerexit']=![];_0x1c1e0a[_0x0492('0x98')]=null;break;case _0x0492('0xaf'):_0x1c1e0a[_0x0492('0xb0')]=_0x0492('0xb1');_0x1c1e0a[_0x0492('0x97')]=!![];_0x1c1e0a[_0x0492('0x98')]=moment()[_0x0492('0x48')](_0x0492('0x7c'));_0x1c1e0a[_0x0492('0xb2')]=moment()[_0x0492('0x48')](_0x0492('0x7c'));logger['debug'](_0x0492('0xb3'),_0x4b93e5[_0x0492('0x7a')],util[_0x0492('0x3a')](_0x1c1e0a,{'showHidden':![],'depth':null}));ami[_0x0492('0x43')](_0x0492('0xb4'),_0x1c1e0a);break;default:_0x1c1e0a[_0x0492('0x97')]=!![];_0x1c1e0a[_0x0492('0x98')]=moment()[_0x0492('0x48')](_0x0492('0x7c'));_0x1c1e0a[_0x0492('0xb2')]=moment()[_0x0492('0x48')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1c1e0a['queuecallerabandon']=![];_0x1c1e0a[_0x0492('0x89')]=null;_0x1c1e0a[_0x0492('0x4e')]=_0x4b93e5[_0x0492('0xac')];this[_0x0492('0x11')][_0x4b93e5['uniqueid']]=_0x1c1e0a;this[_0x0492('0x41')](_0x1c1e0a,'varset');}else if(this['isNotNull'](_0x4b93e5[_0x0492('0xab')])&&this[_0x0492('0x67')](_0x4b93e5[_0x0492('0xab')]['queueposition'])){if(!_0x1c1e0a[_0x0492('0x1d')]){_0x1c1e0a[_0x0492('0x97')]=!![];_0x1c1e0a['queuecallerexitAt']=moment()[_0x0492('0x48')](_0x0492('0x7c'));_0x1c1e0a[_0x0492('0x4e')]='EXITWITHKEY';_0x1c1e0a[_0x0492('0xb2')]=moment()[_0x0492('0x48')](_0x0492('0x7c'));this['channels'][_0x4b93e5[_0x0492('0x7a')]]=_0x1c1e0a;}}logger['info'](_0x0492('0xb5'),_0x4b93e5[_0x0492('0x7a')],_0x1c1e0a[_0x0492('0x4a')],_0x1c1e0a[_0x0492('0x5c')],_[_0x0492('0x81')](_0x4b93e5['variable'])[0x0],_0x4b93e5[_0x0492('0xac')]);_0x1c1e0a[_0x0492('0x3d')]=this[_0x0492('0x3d')][_0x4b93e5[_0x0492('0x7a')]];}}}}catch(_0x3bea05){logger[_0x0492('0x3b')](_0x0492('0xa9'),_0x4b93e5[_0x0492('0x7a')],util[_0x0492('0x3a')](_0x3bea05,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0492('0xa')][_0x0492('0xaa')]=function(_0x47f858,_0xd788f9,_0xcb31aa){var _0x2c58cf=[_0x0492('0xb6'),'rtpaudioqosbridged',_0x0492('0xb7'),_0x0492('0xb8'),_0x0492('0xb9'),_0x0492('0xba'),_0x0492('0xbb'),_0x0492('0xbc'),_0x0492('0xbd'),_0x0492('0xbe'),_0x0492('0xbf'),_0x0492('0xc0'),_0x0492('0xc1'),_0x0492('0xc2'),_0x0492('0xc3'),_0x0492('0xc4'),_0x0492('0x96'),_0x0492('0xc5'),'memberrealtime'];if(!_['isNil'](_0xd788f9)&&!_[_0x0492('0xc6')](_0x2c58cf,_0xd788f9)){if(_['isUndefined'](this[_0x0492('0x3d')][_0x47f858])){this['variables'][_0x47f858]={};}this[_0x0492('0x3d')][_0x47f858][_0xd788f9]=_0xcb31aa;}};VoiceQueueReport[_0x0492('0xa')][_0x0492('0x26')]=function(_0x3518c2){try{if(this[_0x0492('0x67')](_0x3518c2)){logger[_0x0492('0x45')](_0x0492('0xc7'),_0x3518c2['uniqueid'],util[_0x0492('0x3a')](_0x3518c2,{'showHidden':![],'depth':null}));if(this[_0x0492('0xf')][_0x3518c2[_0x0492('0x7a')]]){for(var _0x1338e4=0x0,_0x5ab242={};_0x1338e4=0x0?moment(_0x368064[_0x63a7('0x14')])[_0x63a7('0x15')](_0x368064[_0x63a7('0x16')],_0x63a7('0xe')):null,'data1':'outbound','data2':_0x368064[_0x63a7('0x12')],'data3':_0x368064[_0x63a7('0x17')],'data4':_0x368064['dialstring']||null,'role':_0x63a7('0x18'),'internal':_0x368064[_0x63a7('0x12')]?_[_0x63a7('0x19')](_0x368064[_0x63a7('0x12')]):undefined,'uniqueid':_0x368064[_0x63a7('0x13')]},'log':_0x63a7('0x6')});}; \ No newline at end of file +var _0xe7a5=['interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','exten','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','endtime','starttime','outbound','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe7a5,0x8f));var _0x5e7a=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xe7a5[_0x311c35];return _0x5cc50c;};'use strict';var moment=require(_0x5e7a('0x0'));var _=require(_0x5e7a('0x1'));var util=require(_0x5e7a('0x2'));var client=require(_0x5e7a('0x3'));exports[_0x5e7a('0x4')]=function(_0x1c5f15){var _0x4c749a=_0x1c5f15[_0x5e7a('0x5')]||_0x1c5f15[_0x5e7a('0x6')];return client[_0x5e7a('0x7')](_0x5e7a('0x8'),{'body':{'channel':_0x5e7a('0x9'),'membername':_0x1c5f15[_0x5e7a('0xa')],'interface':_[_0x5e7a('0xb')](_0x1c5f15[_0x5e7a('0xc')])?util[_0x5e7a('0xd')](_0x5e7a('0xe'),_0x1c5f15[_0x5e7a('0xa')]):_0x1c5f15[_0x5e7a('0xc')],'type':_0x5e7a('0xf'),'enterAt':_0x1c5f15[_0x5e7a('0x10')],'exitAt':_0x4c749a,'duration':moment(_0x4c749a)[_0x5e7a('0x11')](_0x1c5f15[_0x5e7a('0x10')],_0x5e7a('0x12')),'data1':_0x5e7a('0x13'),'data2':_0x1c5f15['calleridnum'],'data3':_0x1c5f15[_0x5e7a('0x14')],'data4':null,'data5':_0x1c5f15['queue'],'role':_0x5e7a('0x15'),'internal':_0x1c5f15[_0x5e7a('0x16')]?_[_0x5e7a('0x17')](_0x1c5f15[_0x5e7a('0x16')]):undefined,'uniqueid':_0x1c5f15[_0x5e7a('0x18')]},'log':_0x5e7a('0x8')});};exports[_0x5e7a('0x19')]=function(_0x2df9bc){return client[_0x5e7a('0x7')](_0x5e7a('0x8'),{'body':{'channel':'voice','membername':_0x2df9bc[_0x5e7a('0x1a')],'interface':_0x2df9bc['interface'],'type':'TALKING','enterAt':_0x2df9bc['starttime'],'exitAt':_0x2df9bc[_0x5e7a('0x1b')],'duration':moment(_0x2df9bc['endtime'])[_0x5e7a('0x11')](_0x2df9bc[_0x5e7a('0x1c')],_0x5e7a('0x12'))>=0x0?moment(_0x2df9bc[_0x5e7a('0x1b')])[_0x5e7a('0x11')](_0x2df9bc[_0x5e7a('0x1c')],_0x5e7a('0x12')):null,'data1':_0x5e7a('0x1d'),'data2':_0x2df9bc[_0x5e7a('0x16')],'data3':_0x2df9bc[_0x5e7a('0x14')],'data4':_0x2df9bc[_0x5e7a('0x1e')]||null,'role':_0x5e7a('0x15'),'internal':_0x2df9bc[_0x5e7a('0x16')]?_['toNumber'](_0x2df9bc['accountcode']):undefined,'uniqueid':_0x2df9bc['uniqueid']},'log':_0x5e7a('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 9f655f1..054b8f3 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 _0x5d36=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request'];(function(_0x5a9d2b,_0x64b8b8){var _0x55a4a5=function(_0x589406){while(--_0x589406){_0x5a9d2b['push'](_0x5a9d2b['shift']());}};_0x55a4a5(++_0x64b8b8);}(_0x5d36,0x11a));var _0x65d3=function(_0x5df780,_0x3460c8){_0x5df780=_0x5df780-0x0;var _0x535f5b=_0x5d36[_0x5df780];return _0x535f5b;};'use strict';var client=require(_0x65d3('0x0'));exports[_0x65d3('0x1')]=function(){return client[_0x65d3('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x65d3('0x3')]},'log':_0x65d3('0x4')});}; \ No newline at end of file +var _0xbac1=['Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','getSettings'];(function(_0x2af504,_0x46a924){var _0x2abb2e=function(_0x53f705){while(--_0x53f705){_0x2af504['push'](_0x2af504['shift']());}};_0x2abb2e(++_0x46a924);}(_0xbac1,0x17f));var _0x1bac=function(_0xe4f8dd,_0x192696){_0xe4f8dd=_0xe4f8dd-0x0;var _0x481a09=_0xbac1[_0xe4f8dd];return _0x481a09;};'use strict';var client=require('../client');exports[_0x1bac('0x0')]=function(){return client[_0x1bac('0x1')](_0x1bac('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1bac('0x3'),_0x1bac('0x4')]},'log':_0x1bac('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 7434a7d..5582c67 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 _0x188f=['name','GetTemplate','getTemplates'];(function(_0x30af87,_0x373c81){var _0x2f8a09=function(_0x38ed5a){while(--_0x38ed5a){_0x30af87['push'](_0x30af87['shift']());}};_0x2f8a09(++_0x373c81);}(_0x188f,0xc8));var _0xf188=function(_0x142cb4,_0x1ab0f2){_0x142cb4=_0x142cb4-0x0;var _0x452201=_0x188f[_0x142cb4];return _0x452201;};'use strict';var client=require('../client');exports[_0xf188('0x0')]=function(_0x1e434c){return function(_0x16ba53){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xf188('0x1'),'html']},'log':_0xf188('0x2')});};}; \ No newline at end of file +var _0x09a1=['html','getTemplates','Request','GetTemplate','name'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x09a1,0x14b));var _0x109a=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x09a1[_0x1deb03];return _0x189fe7;};'use strict';var client=require('../client');exports[_0x109a('0x0')]=function(_0x597284){return function(_0x12189d){return client[_0x109a('0x1')](_0x109a('0x2'),{'options':{'raw':!![],'attributes':['id',_0x109a('0x3'),_0x109a('0x4')]},'log':_0x109a('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 842c0b4..916fef6 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 _0x1177=['data6','data7','../client','getTriggers','Request','channel','Condition','AllConditions','value','AnyConditions','field','operator','Action','Actions','data1','data3'];(function(_0x43adaf,_0x840bfd){var _0x486d3d=function(_0x25c3a1){while(--_0x25c3a1){_0x43adaf['push'](_0x43adaf['shift']());}};_0x486d3d(++_0x840bfd);}(_0x1177,0x72));var _0x7117=function(_0x3975cc,_0x911199){_0x3975cc=_0x3975cc-0x0;var _0x10dc27=_0x1177[_0x3975cc];return _0x10dc27;};'use strict';var client=require(_0x7117('0x0'));exports[_0x7117('0x1')]=function(_0x3c05d0){return function(_0x47722a){return client[_0x7117('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x7117('0x3'),'status'],'include':[{'model':_0x7117('0x4'),'as':_0x7117('0x5'),'attributes':['id','field','operator',_0x7117('0x6')]},{'model':_0x7117('0x4'),'as':_0x7117('0x7'),'attributes':['id',_0x7117('0x8'),_0x7117('0x9'),_0x7117('0x6')]},{'model':_0x7117('0xa'),'as':_0x7117('0xb'),'attributes':['id','action',_0x7117('0xc'),'data2',_0x7117('0xd'),'data4','data5',_0x7117('0xe'),_0x7117('0xf')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x624a=['Condition','AllConditions','field','operator','Action','Actions','action','data2','data3','data4','data5','data6','data7','../client','Request','GetTrigger','name','status'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x624a,0x199));var _0xa624=function(_0x67ef3d,_0x50f0bd){_0x67ef3d=_0x67ef3d-0x0;var _0x2ef03e=_0x624a[_0x67ef3d];return _0x2ef03e;};'use strict';var client=require(_0xa624('0x0'));exports['getTriggers']=function(_0x7f5fe0){return function(_0x137565){return client[_0xa624('0x1')](_0xa624('0x2'),{'options':{'raw':![],'attributes':['id',_0xa624('0x3'),'channel',_0xa624('0x4')],'include':[{'model':_0xa624('0x5'),'as':_0xa624('0x6'),'attributes':['id',_0xa624('0x7'),_0xa624('0x8'),'value']},{'model':_0xa624('0x5'),'as':'AnyConditions','attributes':['id',_0xa624('0x7'),_0xa624('0x8'),'value']},{'model':_0xa624('0x9'),'as':_0xa624('0xa'),'attributes':['id',_0xa624('0xb'),'data1',_0xa624('0xc'),_0xa624('0xd'),_0xa624('0xe'),_0xa624('0xf'),_0xa624('0x10'),_0xa624('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 3c02530..a91f3f8 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 _0x815b=['../client','getTrunks','Request','name','GetTrunk'];(function(_0x451e44,_0x2a4226){var _0x58f6ca=function(_0x504c35){while(--_0x504c35){_0x451e44['push'](_0x451e44['shift']());}};_0x58f6ca(++_0x2a4226);}(_0x815b,0xb4));var _0xb815=function(_0x4310d4,_0xe518d2){_0x4310d4=_0x4310d4-0x0;var _0x53cda3=_0x815b[_0x4310d4];return _0x53cda3;};'use strict';var client=require(_0xb815('0x0'));exports[_0xb815('0x1')]=function(_0x346faf){return function(_0x43d273){return client[_0xb815('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb815('0x3'),'registry','defaultuser']},'log':_0xb815('0x4')});};}; \ No newline at end of file +var _0x6898=['defaultuser','../client','Request','GetTrunk','name','registry'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6898,0x11b));var _0x8689=function(_0x30ff5d,_0x5a42e0){_0x30ff5d=_0x30ff5d-0x0;var _0x59726d=_0x6898[_0x30ff5d];return _0x59726d;};'use strict';var client=require(_0x8689('0x0'));exports['getTrunks']=function(_0x3b6c93){return function(_0x15c5c2){return client[_0x8689('0x1')](_0x8689('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x8689('0x3'),_0x8689('0x4'),_0x8689('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index cd4c146..a7e6c5d 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x5d68c9,_0x47a132){var _0x238978=function(_0x1b95b2){while(--_0x1b95b2){_0x5d68c9['push'](_0x5d68c9['shift']());}};_0x238978(++_0x47a132);}(_0xedd9,0xfc));var _0x9edd=function(_0x3e661c,_0x4a1e6d){_0x3e661c=_0x3e661c-0x0;var _0xae0f6a=_0xedd9[_0x3e661c];return _0xae0f6a;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe706,0xa3));var _0x6e70=function(_0x311df2,_0x5b6291){_0x311df2=_0x311df2-0x0;var _0x2d70d7=_0xe706[_0x311df2];return _0x2d70d7;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ca51ce5..e8c7bd4 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 _0x4cc9=['UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport'];(function(_0xe21946,_0x1c3991){var _0x10c84b=function(_0x5c3a09){while(--_0x5c3a09){_0xe21946['push'](_0xe21946['shift']());}};_0x10c84b(++_0x1c3991);}(_0x4cc9,0x161));var _0x94cc=function(_0x207d8e,_0x3e90e9){_0x207d8e=_0x207d8e-0x0;var _0x2fff92=_0x4cc9[_0x207d8e];return _0x2fff92;};'use strict';var client=require(_0x94cc('0x0'));exports[_0x94cc('0x1')]=function(_0xbda4eb){return client['Request'](_0x94cc('0x2'),{'body':_0xbda4eb,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x3bd5d4,_0x68380,_0x47e65e){return client['Request'](_0x94cc('0x3'),{'body':_0x3bd5d4,'options':{'where':{'uniqueid':_0x68380,'interface':_0x47e65e,'agentcomplete':!![]}},'log':_0x94cc('0x3')});}; \ No newline at end of file +var _0x838e=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x13fdb1,_0x1c6fba){var _0x55f710=function(_0x3b0f2b){while(--_0x3b0f2b){_0x13fdb1['push'](_0x13fdb1['shift']());}};_0x55f710(++_0x1c6fba);}(_0x838e,0x111));var _0xe838=function(_0x5e255b,_0x4471b0){_0x5e255b=_0x5e255b-0x0;var _0x5ef0d6=_0x838e[_0x5e255b];return _0x5ef0d6;};'use strict';var client=require(_0xe838('0x0'));exports[_0xe838('0x1')]=function(_0x1426ea){return client['Request'](_0xe838('0x2'),{'body':_0x1426ea,'log':_0xe838('0x2')});};exports[_0xe838('0x3')]=function(_0x9c137d,_0x1200de,_0x2768eb){return client['Request']('UpdateVoiceAgentReport',{'body':_0x9c137d,'options':{'where':{'uniqueid':_0x1200de,'interface':_0x2768eb,'agentcomplete':!![]}},'log':_0xe838('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index d1d8377..8b47830 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 _0xb417=['CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request'];(function(_0x151a57,_0x3c4812){var _0x255c41=function(_0x23aa47){while(--_0x23aa47){_0x151a57['push'](_0x151a57['shift']());}};_0x255c41(++_0x3c4812);}(_0xb417,0x198));var _0x7b41=function(_0x377e11,_0x4bd449){_0x377e11=_0x377e11-0x0;var _0x270348=_0xb417[_0x377e11];return _0x270348;};'use strict';var moment=require(_0x7b41('0x0'));var util=require(_0x7b41('0x1'));var _=require(_0x7b41('0x2'));var client=require(_0x7b41('0x3'));exports[_0x7b41('0x4')]=function(_0x46cc47){return client[_0x7b41('0x5')](_0x7b41('0x6'),{'body':_[_0x7b41('0x7')](_0x46cc47,{'source':_0x46cc47[_0x7b41('0x8')],'destinationcontext':_0x46cc47[_0x7b41('0x9')],'callerid':_0x46cc47[_0x7b41('0xa')],'amaflags':_0x7b41('0xb')}),'log':_0x7b41('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x7b41('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x7b41('0xc')],'createdAt':{'$between':[moment()[_0x7b41('0xd')](_0x7b41('0xe'))[_0x7b41('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x7b41('0x10')]('day')[_0x7b41('0xf')](_0x7b41('0x11'))]}},'attributes':[_0x7b41('0x12'),_0x7b41('0x13'),_0x7b41('0x14'),_0x7b41('0x15')]},'log':_0x7b41('0x16')});};}; \ No newline at end of file +var _0x9275=['YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','util','create','Request','CreateVoiceCallReport','merge','calleridnum','context','GetVoiceCallReport','outbound','day','format'];(function(_0x512c83,_0x42a67a){var _0x1f7f25=function(_0x1e656c){while(--_0x1e656c){_0x512c83['push'](_0x512c83['shift']());}};_0x1f7f25(++_0x42a67a);}(_0x9275,0x105));var _0x5927=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0x9275[_0x51674a];return _0x13fca6;};'use strict';var moment=require('moment');var util=require(_0x5927('0x0'));var _=require('lodash');var client=require('../client');exports[_0x5927('0x1')]=function(_0x4e072b){return client[_0x5927('0x2')](_0x5927('0x3'),{'body':_[_0x5927('0x4')](_0x4e072b,{'source':_0x4e072b[_0x5927('0x5')],'destinationcontext':_0x4e072b[_0x5927('0x6')],'callerid':_0x4e072b['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x5927('0x3')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x5927('0x2')](_0x5927('0x7'),{'options':{'where':{'type':[_0x5927('0x8')],'createdAt':{'$between':[moment()['startOf'](_0x5927('0x9'))[_0x5927('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x5927('0x9'))[_0x5927('0xa')](_0x5927('0xb'))]}},'attributes':[_0x5927('0xc'),_0x5927('0xd'),_0x5927('0xe'),_0x5927('0xf')]},'log':_0x5927('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index da597a4..625dd96 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 _0x2530=['../client','create','Request','CreateVoiceDialReport'];(function(_0x38b708,_0x28e052){var _0x3d1743=function(_0x916791){while(--_0x916791){_0x38b708['push'](_0x38b708['shift']());}};_0x3d1743(++_0x28e052);}(_0x2530,0x1d0));var _0x0253=function(_0x37647d,_0x399069){_0x37647d=_0x37647d-0x0;var _0x2af351=_0x2530[_0x37647d];return _0x2af351;};'use strict';var client=require(_0x0253('0x0'));exports[_0x0253('0x1')]=function(_0x58b082){return client[_0x0253('0x2')]('CreateVoiceDialReport',{'body':_0x58b082,'log':_0x0253('0x3')});}; \ No newline at end of file +var _0x5f84=['Request','../client','create'];(function(_0x14723d,_0x4e09de){var _0x53227d=function(_0x28aea4){while(--_0x28aea4){_0x14723d['push'](_0x14723d['shift']());}};_0x53227d(++_0x4e09de);}(_0x5f84,0x1a8));var _0x45f8=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5f84[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0x45f8('0x0'));exports[_0x45f8('0x1')]=function(_0x3600eb){return client[_0x45f8('0x2')]('CreateVoiceDialReport',{'body':_0x3600eb,'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 d7f6f58..e4066db 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 _0x6ea9=['GetVoiceExtension','exten','../client','getVoiceExtensions','Request'];(function(_0x94ed6b,_0xb30f27){var _0x1cb3a0=function(_0x4667f2){while(--_0x4667f2){_0x94ed6b['push'](_0x94ed6b['shift']());}};_0x1cb3a0(++_0xb30f27);}(_0x6ea9,0x89));var _0x96ea=function(_0x448be7,_0x5b60be){_0x448be7=_0x448be7-0x0;var _0x7f385=_0x6ea9[_0x448be7];return _0x7f385;};'use strict';var client=require(_0x96ea('0x0'));exports[_0x96ea('0x1')]=function(){return function(){return client[_0x96ea('0x2')](_0x96ea('0x3'),{'options':{'raw':!![],'attributes':['id',_0x96ea('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x96ea('0x1')});};}; \ No newline at end of file +var _0xe3d4=['GetVoiceExtension','recordingFormat','getVoiceExtensions','Request'];(function(_0x5adb83,_0xdbf39e){var _0x17e533=function(_0x11cf0f){while(--_0x11cf0f){_0x5adb83['push'](_0x5adb83['shift']());}};_0x17e533(++_0xdbf39e);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x5d76cc,_0x195736){_0x5d76cc=_0x5d76cc-0x0;var _0x4acce4=_0xe3d4[_0x5d76cc];return _0x4acce4;};'use strict';var client=require('../client');exports[_0x4e3d('0x0')]=function(){return function(){return client[_0x4e3d('0x1')](_0x4e3d('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x4e3d('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x4e3d('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 951fdb6..6248acc 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 _0x09a4=['dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','Pause','mandatoryDispositionPause','TrunkBackup','callerid','active','Interval','Intervals','interval','getVoiceQueues','../client','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'];(function(_0x121981,_0x36d2f6){var _0x30dc1e=function(_0x2e9950){while(--_0x2e9950){_0x121981['push'](_0x121981['shift']());}};_0x30dc1e(++_0x36d2f6);}(_0x09a4,0x147));var _0x409a=function(_0x3db79e,_0x25a039){_0x3db79e=_0x3db79e-0x0;var _0x132484=_0x09a4[_0x3db79e];return _0x132484;};'use strict';var client=require(_0x409a('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x409a('0x1'),{'options':{'raw':![],'attributes':['id',_0x409a('0x2'),_0x409a('0x3'),_0x409a('0x4'),'autopause',_0x409a('0x5'),_0x409a('0x6'),_0x409a('0x7'),_0x409a('0x8'),_0x409a('0x9'),_0x409a('0xa'),_0x409a('0xb'),_0x409a('0xc'),_0x409a('0xd'),_0x409a('0xe'),_0x409a('0xf'),'dialOriginateCallerIdNumber',_0x409a('0x10'),'dialQueueOptions',_0x409a('0x11'),'dialQueueProject',_0x409a('0x12'),_0x409a('0x13'),'dialBusyMaxRetry',_0x409a('0x14'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x409a('0x15'),_0x409a('0x16'),_0x409a('0x17'),_0x409a('0x18'),_0x409a('0x19'),_0x409a('0x1a'),_0x409a('0x1b'),_0x409a('0x1c'),_0x409a('0x1d'),'dialAMDTotalAnalysisTime',_0x409a('0x1e'),_0x409a('0x1f'),_0x409a('0x20'),_0x409a('0x21'),'dialAMDMaximumWordLength',_0x409a('0x22'),_0x409a('0x23'),'dialRecallInQueue','dialOrderByScheduledAt',_0x409a('0x24'),_0x409a('0x25'),'dialQueueProject2','monitor_format',_0x409a('0x26'),_0x409a('0x27'),'dialCutDigit',_0x409a('0x28'),_0x409a('0x29'),_0x409a('0x2a'),_0x409a('0x2b'),_0x409a('0x2c'),_0x409a('0x2d'),_0x409a('0x2e'),_0x409a('0x2f'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x409a('0x30'),_0x409a('0x31'),_0x409a('0x32'),_0x409a('0x33'),_0x409a('0x34')],'include':[{'model':_0x409a('0x35'),'as':_0x409a('0x35'),'attributes':['id',_0x409a('0x2'),'callerid','active']},{'model':_0x409a('0x36'),'as':_0x409a('0x37'),'attributes':['id','name']},{'model':_0x409a('0x35'),'as':_0x409a('0x38'),'attributes':['id',_0x409a('0x2'),_0x409a('0x39'),_0x409a('0x3a')]},{'model':_0x409a('0x3b'),'as':_0x409a('0x3b'),'attributes':['id',_0x409a('0x2')],'include':[{'model':_0x409a('0x3b'),'as':_0x409a('0x3c'),'attributes':['id',_0x409a('0x2'),_0x409a('0x3d')]}]}]},'log':_0x409a('0x3e')});};}; \ No newline at end of file +var _0x2148=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','name','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x2148,0x179));var _0x8214=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x2148[_0x5d4607];return _0x5e4a86;};'use strict';var client=require(_0x8214('0x0'));exports[_0x8214('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x8214('0x2'),'acw',_0x8214('0x3'),_0x8214('0x4'),_0x8214('0x5'),_0x8214('0x6'),'dialActive',_0x8214('0x7'),_0x8214('0x8'),_0x8214('0x9'),_0x8214('0xa'),_0x8214('0xb'),_0x8214('0xc'),_0x8214('0xd'),_0x8214('0xe'),_0x8214('0xf'),_0x8214('0x10'),_0x8214('0x11'),_0x8214('0x12'),_0x8214('0x13'),_0x8214('0x14'),_0x8214('0x15'),_0x8214('0x16'),_0x8214('0x17'),_0x8214('0x18'),_0x8214('0x19'),_0x8214('0x1a'),'dialTimezone',_0x8214('0x1b'),_0x8214('0x1c'),_0x8214('0x1d'),_0x8214('0x1e'),_0x8214('0x1f'),'dialAMDGreeting',_0x8214('0x20'),'dialAMDTotalAnalysisTime',_0x8214('0x21'),_0x8214('0x22'),_0x8214('0x23'),'dialAMDSilenceThreshold',_0x8214('0x24'),_0x8214('0x25'),_0x8214('0x26'),'dialRecallInQueue',_0x8214('0x27'),_0x8214('0x28'),_0x8214('0x29'),_0x8214('0x2a'),_0x8214('0x5'),_0x8214('0x2b'),_0x8214('0x2c'),_0x8214('0x2d'),_0x8214('0x2e'),'dialNoSuchNumberRetryFrequency',_0x8214('0x2f'),_0x8214('0x30'),_0x8214('0x31'),_0x8214('0x32'),_0x8214('0x33'),_0x8214('0x34'),_0x8214('0x35'),_0x8214('0x36'),_0x8214('0x37'),_0x8214('0x38'),_0x8214('0x39'),'dialPreviewAutoRecallMe',_0x8214('0x3a')],'include':[{'model':_0x8214('0x3b'),'as':_0x8214('0x3b'),'attributes':['id',_0x8214('0x2'),_0x8214('0x3c'),_0x8214('0x3d')]},{'model':_0x8214('0x3e'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':'Trunk','as':_0x8214('0x3f'),'attributes':['id',_0x8214('0x2'),_0x8214('0x3c'),_0x8214('0x3d')]},{'model':'Interval','as':_0x8214('0x40'),'attributes':['id',_0x8214('0x2')],'include':[{'model':_0x8214('0x40'),'as':_0x8214('0x41'),'attributes':['id',_0x8214('0x2'),_0x8214('0x42')]}]}]},'log':_0x8214('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index dbb84c3..6e7c671 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(_0x22d0bd,_0x348614){var _0x187314=function(_0x2243bb){while(--_0x2243bb){_0x22d0bd['push'](_0x22d0bd['shift']());}};_0x187314(++_0x348614);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x3cf2b1,_0x1d5815){var _0x17eda5=function(_0x5aed9d){while(--_0x5aed9d){_0x3cf2b1['push'](_0x3cf2b1['shift']());}};_0x17eda5(++_0x1d5815);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 83e4f8f..a4ab6cc 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 _0xcdfc=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcdfc,0x74));var _0xccdf=function(_0x2d21f6,_0x345752){_0x2d21f6=_0x2d21f6-0x0;var _0x37b69c=_0xcdfc[_0x2d21f6];return _0x37b69c;};'use strict';var client=require('../client');exports[_0xccdf('0x0')]=function(_0x22983c){return function(){return client[_0xccdf('0x1')](_0xccdf('0x2'),{'options':{'where':{'VoiceQueueId':_0x22983c,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x4027=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4027,0xd5));var _0x7402=function(_0x1fc7a2,_0x1deb33){_0x1fc7a2=_0x1fc7a2-0x0;var _0x4df5eb=_0x4027[_0x1fc7a2];return _0x4df5eb;};'use strict';var client=require('../client');exports[_0x7402('0x0')]=function(_0xe56155){return function(){return client[_0x7402('0x1')](_0x7402('0x2'),{'options':{'where':{'VoiceQueueId':_0xe56155,'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 d346834..3141c7b 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(_0x4a59c8,_0x1bf774){var _0x212f32=function(_0x38b3e0){while(--_0x38b3e0){_0x4a59c8['push'](_0x4a59c8['shift']());}};_0x212f32(++_0x1bf774);}(_0x7a54,0x106));var _0x47a5=function(_0x505330,_0x2a8749){_0x505330=_0x505330-0x0;var _0x22d70b=_0x7a54[_0x505330];return _0x22d70b;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x16d213,_0x43d9f8){var _0x4be2b8=function(_0x5cd32e){while(--_0x5cd32e){_0x16d213['push'](_0x16d213['shift']());}};_0x4be2b8(++_0x43d9f8);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 775c1d2..e2ae612 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 _0x277c=['transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransfererexten','attended','../client','blindTransfer','CreateVoiceTransferReport','transfererchannel','transfererconnectedlinename','transfereraccountcode','transferercontext','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','Request','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid'];(function(_0x41c310,_0x2be3e2){var _0x339050=function(_0x14bcdc){while(--_0x14bcdc){_0x41c310['push'](_0x41c310['shift']());}};_0x339050(++_0x2be3e2);}(_0x277c,0x156));var _0xc277=function(_0x550218,_0xafb4fe){_0x550218=_0x550218-0x0;var _0x24d497=_0x277c[_0x550218];return _0x24d497;};'use strict';var client=require(_0xc277('0x0'));exports['transfers']={};exports[_0xc277('0x1')]=function(_0x504443){return client['Request'](_0xc277('0x2'),{'body':{'result':_0x504443['result'],'transfererchannel':_0x504443[_0xc277('0x3')],'transferercalleridnum':_0x504443['transferercalleridnum'],'transferercalleridname':_0x504443['transferercalleridname'],'transfererconnectedlinenum':_0x504443['transfererconnectedlinenum'],'transfererconnectedlinename':_0x504443[_0xc277('0x4')],'transfereraccountcode':_0x504443[_0xc277('0x5')],'transferercontext':_0x504443[_0xc277('0x6')],'transfererexten':_0x504443['transfererexten'],'transfererlinkedid':_0x504443['transfererlinkedid'],'transfereechannel':_0x504443[_0xc277('0x7')],'transfereecalleridnum':_0x504443[_0xc277('0x8')],'transfereecalleridname':_0x504443['transfereecalleridname'],'transfereeconnectedlinenum':_0x504443[_0xc277('0x9')],'transfereeconnectedlinename':_0x504443[_0xc277('0xa')],'transfereeaccountcode':_0x504443[_0xc277('0xb')],'transfereecontext':_0x504443[_0xc277('0xc')],'transfereeexten':_0x504443[_0xc277('0xd')],'transfereelinkedid':_0x504443[_0xc277('0xe')],'isexternal':_0x504443[_0xc277('0xf')],'context':_0x504443[_0xc277('0x10')],'extension':_0x504443[_0xc277('0x11')],'type':_0xc277('0x12')},'log':'CreateVoiceTransferReport'});};exports[_0xc277('0x13')]=function(_0x54d4ab){return client[_0xc277('0x14')](_0xc277('0x2'),{'body':{'result':_0x54d4ab[_0xc277('0x15')],'transfererchannel':_0x54d4ab[_0xc277('0x16')],'transferercalleridnum':_0x54d4ab[_0xc277('0x17')],'transferercalleridname':_0x54d4ab[_0xc277('0x18')],'transfererconnectedlinenum':_0x54d4ab['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x54d4ab[_0xc277('0x19')],'transfereraccountcode':_0x54d4ab['origtransfereraccountcode'],'transferercontext':_0x54d4ab[_0xc277('0x1a')],'transfererexten':_0x54d4ab['secondtransfererexten'],'transfererlinkedid':_0x54d4ab[_0xc277('0x1b')],'transfereechannel':_0x54d4ab[_0xc277('0x1c')],'transfereecalleridnum':_0x54d4ab[_0xc277('0x1d')],'transfereecalleridname':_0x54d4ab['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x54d4ab[_0xc277('0x1e')],'transfereeconnectedlinename':_0x54d4ab[_0xc277('0x1f')],'transfereeaccountcode':_0x54d4ab[_0xc277('0x20')],'transfereecontext':_0x54d4ab[_0xc277('0x21')],'transfereeexten':_0x54d4ab['transfertargetexten'],'transfereelinkedid':_0x54d4ab[_0xc277('0x22')],'isexternal':_0x54d4ab[_0xc277('0xf')],'context':_0x54d4ab['origtransferercontext'],'extension':_0x54d4ab[_0xc277('0x23')],'type':_0xc277('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x1e8f=['transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','Request','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x1e8f,0x1f4));var _0xf1e8=function(_0x3d8651,_0x354057){_0x3d8651=_0x3d8651-0x0;var _0x55dec7=_0x1e8f[_0x3d8651];return _0x55dec7;};'use strict';var client=require(_0xf1e8('0x0'));exports[_0xf1e8('0x1')]={};exports[_0xf1e8('0x2')]=function(_0x472664){return client['Request'](_0xf1e8('0x3'),{'body':{'result':_0x472664[_0xf1e8('0x4')],'transfererchannel':_0x472664[_0xf1e8('0x5')],'transferercalleridnum':_0x472664['transferercalleridnum'],'transferercalleridname':_0x472664[_0xf1e8('0x6')],'transfererconnectedlinenum':_0x472664[_0xf1e8('0x7')],'transfererconnectedlinename':_0x472664['transfererconnectedlinename'],'transfereraccountcode':_0x472664[_0xf1e8('0x8')],'transferercontext':_0x472664[_0xf1e8('0x9')],'transfererexten':_0x472664[_0xf1e8('0xa')],'transfererlinkedid':_0x472664['transfererlinkedid'],'transfereechannel':_0x472664['transfereechannel'],'transfereecalleridnum':_0x472664['transfereecalleridnum'],'transfereecalleridname':_0x472664[_0xf1e8('0xb')],'transfereeconnectedlinenum':_0x472664[_0xf1e8('0xc')],'transfereeconnectedlinename':_0x472664[_0xf1e8('0xd')],'transfereeaccountcode':_0x472664[_0xf1e8('0xe')],'transfereecontext':_0x472664[_0xf1e8('0xf')],'transfereeexten':_0x472664[_0xf1e8('0x10')],'transfereelinkedid':_0x472664[_0xf1e8('0x11')],'isexternal':_0x472664[_0xf1e8('0x12')],'context':_0x472664[_0xf1e8('0x13')],'extension':_0x472664[_0xf1e8('0x14')],'type':'blind'},'log':_0xf1e8('0x3')});};exports[_0xf1e8('0x15')]=function(_0xc7da2a){return client[_0xf1e8('0x16')](_0xf1e8('0x3'),{'body':{'result':_0xc7da2a[_0xf1e8('0x4')],'transfererchannel':_0xc7da2a[_0xf1e8('0x17')],'transferercalleridnum':_0xc7da2a['origtransferercalleridnum'],'transferercalleridname':_0xc7da2a[_0xf1e8('0x18')],'transfererconnectedlinenum':_0xc7da2a[_0xf1e8('0x19')],'transfererconnectedlinename':_0xc7da2a[_0xf1e8('0x1a')],'transfereraccountcode':_0xc7da2a[_0xf1e8('0x1b')],'transferercontext':_0xc7da2a[_0xf1e8('0x1c')],'transfererexten':_0xc7da2a[_0xf1e8('0x1d')],'transfererlinkedid':_0xc7da2a[_0xf1e8('0x1e')],'transfereechannel':_0xc7da2a[_0xf1e8('0x1f')],'transfereecalleridnum':_0xc7da2a[_0xf1e8('0x20')],'transfereecalleridname':_0xc7da2a[_0xf1e8('0x21')],'transfereeconnectedlinenum':_0xc7da2a[_0xf1e8('0x22')],'transfereeconnectedlinename':_0xc7da2a[_0xf1e8('0x23')],'transfereeaccountcode':_0xc7da2a[_0xf1e8('0x24')],'transfereecontext':_0xc7da2a['transfertargetcontext'],'transfereeexten':_0xc7da2a[_0xf1e8('0x25')],'transfereelinkedid':_0xc7da2a[_0xf1e8('0x26')],'isexternal':_0xc7da2a[_0xf1e8('0x12')],'context':_0xc7da2a[_0xf1e8('0x27')],'extension':_0xc7da2a['origtransfererexten'],'type':_0xf1e8('0x28')},'log':_0xf1e8('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 5514c2b..4010a40 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 _0xf61e=['action','Action','then','message','catch','command','Command','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','omit','undefined','channels','voicechannel','map','uniqueid','format','%s.%s','wav','MixMonitor','channel','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','resolve','StopMixMonitor','destinationchannel','monitors','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf61e,0x191));var _0xef61=function(_0x43b1f8,_0x1543d9){_0x43b1f8=_0x43b1f8-0x0;var _0x5a7955=_0xf61e[_0x43b1f8];return _0x5a7955;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var jayson=require(_0xef61('0x2'));var schema=require(_0xef61('0x3'));var BPromise=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var config=require(_0xef61('0x6'));var properties=require(_0xef61('0x7'));var ami=require(_0xef61('0x8'));exports[_0xef61('0x9')]=function(_0x239fa9,_0x45a18d,_0x5b00b2){return new BPromise(function(_0x9e17f4,_0x3e2f79){var _0x4f0cc5={'QueuePause':function(_0x2242a7){return new Promise(function(_0x277fa1,_0x106e7f){var _0x4dba00=util['format'](_0xef61('0xa'),_0xef61('0xb'),_0x2242a7[_0xef61('0xc')]);if(_0x239fa9[_0xef61('0xd')]&&_0x239fa9[_0xef61('0xd')][_0x4dba00]&&_0x239fa9[_0xef61('0xd')][_0x4dba00][_0xef61('0xe')]){_0x239fa9[_0xef61('0xd')][_0x4dba00][_0xef61('0xf')]();}if(_0x239fa9[_0xef61('0x10')][_0x4dba00]){_0x239fa9[_0xef61('0x10')][_0x4dba00][_0xef61('0x11')]({'statePause':_0x2242a7[_0xef61('0x12')]?!![]:![]});}_0x277fa1({'code':0xc8,'message':_0xef61('0x13')});});},'Reload':function(_0x5de159){var _0x2a6b04=this;return new Promise(function(_0x58d9a0,_0x106472){if(ami[_0xef61('0x14')]()==![]){return _0x106472(_0x2a6b04[_0xef61('0x15')](0x1f4,[config[_0xef61('0x16')]['ip'],config['asterisk'][_0xef61('0x17')],_0xef61('0x18')][_0xef61('0x19')]('\x20')));}_0x5de159=_[_0xef61('0x1a')](_0x5de159,_['keys'](properties[_0xef61('0x1b')]));_0x5de159[_0xef61('0x1c')]='Reload';return ami[_0xef61('0x1d')](_0x5de159)[_0xef61('0x1e')](function(_0x36f558){_0x58d9a0({'code':0xc8,'message':_0x36f558[_0xef61('0x1f')]});})[_0xef61('0x20')](function(_0x28315a){_0x106472(_0x2a6b04[_0xef61('0x15')](0x1f5,_0x28315a['message']));});});},'Command':function(_0x39443d){var _0x2c8dad=this;return new Promise(function(_0x4a3af6,_0xb7ba69){if(ami[_0xef61('0x14')]()==![]){return _0xb7ba69(_0x2c8dad[_0xef61('0x15')](0x1f4,[config[_0xef61('0x16')]['ip'],config[_0xef61('0x16')][_0xef61('0x17')],_0xef61('0x18')]['join']('\x20')));}_0x39443d=_['pick'](_0x39443d,_0xef61('0x21'));_0x39443d['action']=_0xef61('0x22');return ami['Action'](_0x39443d)['then'](function(_0x2f0569){_0x4a3af6({'code':0xc8,'message':_0x2f0569['content']});})['catch'](function(_0xfbee94){_0xb7ba69(_0x2c8dad[_0xef61('0x15')](0x1f5,_0xfbee94[_0xef61('0x1f')]));});});},'VoiceQueues':function(_0x111bac){return new Promise(function(_0x5e56da,_0x16b144){var _0x4e738f=[];for(var _0x2a6832 in _0x239fa9[_0xef61('0x23')]){if(_0x239fa9[_0xef61('0x23')][_0xef61('0x24')](_0x2a6832)){var _0x2155f1=_0x239fa9[_0xef61('0x23')][_0x2a6832];var _0x258b5a={'id':_0x2155f1['id'],'name':_0x2155f1[_0xef61('0xc')],'strategy':_0x2155f1[_0xef61('0x25')],'answered':_0x2155f1[_0xef61('0x26')],'available':_0x2155f1[_0xef61('0x27')],'loggedIn':_0x2155f1[_0xef61('0x28')],'pTalking':_0x2155f1[_0xef61('0x29')],'sumBillable':_0x2155f1[_0xef61('0x2a')],'sumDuration':_0x2155f1[_0xef61('0x2b')],'sumHoldTime':_0x2155f1[_0xef61('0x2c')]||0x0,'talking':_0x2155f1[_0xef61('0x2d')],'total':_0x2155f1[_0xef61('0x2e')],'type':_0x2155f1[_0xef61('0x2f')],'unmanaged':_0x2155f1[_0xef61('0x30')],'abandoned':_0x2155f1[_0xef61('0x31')],'waiting':_0x2155f1[_0xef61('0x32')],'loggedInDb':_0x2155f1['loggedInDb']};if(_0x2155f1['type']===_0xef61('0x33')){_0x258b5a[_0xef61('0x34')]=_0x2155f1[_0xef61('0x34')];_0x258b5a['dialMethod']=_0x2155f1[_0xef61('0x35')];_0x258b5a[_0xef61('0x36')]=_0x2155f1['dialOriginateCallerIdName'];_0x258b5a[_0xef61('0x37')]=_0x2155f1['dialOriginateCallerIdNumber'];_0x258b5a['dialOriginateTimeout']=_0x2155f1[_0xef61('0x38')];_0x258b5a['dialPrefix']=_0x2155f1[_0xef61('0x39')];_0x258b5a['temp']=_0x2155f1[_0xef61('0x3a')];_0x258b5a[_0xef61('0x3b')]=_0x2155f1[_0xef61('0x3b')];_0x258b5a[_0xef61('0x3c')]=_0x2155f1[_0xef61('0x3c')];_0x258b5a[_0xef61('0x3d')]=_0x2155f1[_0xef61('0x3d')];_0x258b5a[_0xef61('0x3e')]=_0x2155f1[_0xef61('0x3e')];_0x258b5a[_0xef61('0x3f')]=_0x2155f1['outboundCongestionCallsDay'];_0x258b5a[_0xef61('0x40')]=_0x2155f1[_0xef61('0x40')];_0x258b5a[_0xef61('0x41')]=_0x2155f1[_0xef61('0x41')];_0x258b5a[_0xef61('0x42')]=_0x2155f1['outboundDropCallsDayTimeout'];_0x258b5a[_0xef61('0x43')]=_0x2155f1[_0xef61('0x43')];_0x258b5a[_0xef61('0x44')]=_0x2155f1['outboundNoSuchCallsDay'];_0x258b5a['outboundOriginateFailureCallsDay']=_0x2155f1['outboundOriginateFailureCallsDay'];_0x258b5a[_0xef61('0x45')]=_0x2155f1['outboundReCallsDay'];_0x258b5a['outboundRejectCallsDay']=_0x2155f1['outboundRejectCallsDay'];_0x258b5a[_0xef61('0x46')]=_0x2155f1[_0xef61('0x46')];_0x258b5a[_0xef61('0x47')]=_0x2155f1['predictiveIntervalAnsweredCalls'];_0x258b5a['predictiveIntervalAvgHoldtime']=_0x2155f1['predictiveIntervalAvgHoldtime'];_0x258b5a[_0xef61('0x48')]=_0x2155f1[_0xef61('0x48')];_0x258b5a['predictiveIntervalDroppedCallsCallersExit']=_0x2155f1[_0xef61('0x49')];_0x258b5a[_0xef61('0x4a')]=_0x2155f1[_0xef61('0x4a')];_0x258b5a[_0xef61('0x4b')]=_0x2155f1['predictiveIntervalErlangCalls'];_0x258b5a[_0xef61('0x4c')]=_0x2155f1[_0xef61('0x4c')];_0x258b5a[_0xef61('0x4d')]=_0x2155f1[_0xef61('0x4d')];_0x258b5a['predictiveIntervalMultiplicativeFactor']=_0x2155f1['predictiveIntervalMultiplicativeFactor'];_0x258b5a[_0xef61('0x4e')]=_0x2155f1[_0xef61('0x4e')];_0x258b5a[_0xef61('0x4f')]=_0x2155f1['predictiveIntervalAvailable'];_0x258b5a[_0xef61('0x50')]=_0x2155f1[_0xef61('0x50')];_0x258b5a[_0xef61('0x1f')]=_0x2155f1[_0xef61('0x1f')];_0x258b5a['originated']=_0x2155f1['originated'];_0x258b5a['erlangCalls']=_0x2155f1[_0xef61('0x51')];_0x258b5a[_0xef61('0x52')]=_0x2155f1[_0xef61('0x52')];_0x258b5a[_0xef61('0x53')]=_0x2155f1[_0xef61('0x53')];_0x258b5a[_0xef61('0x54')]=_0x2155f1[_0xef61('0x54')];_0x258b5a['startPredictive']=_0x2155f1[_0xef61('0x55')];_0x258b5a[_0xef61('0x56')]=_0x2155f1[_0xef61('0x56')];}if(_0x2155f1[_0xef61('0x57')]){_0x258b5a['Trunk']={'id':_0x2155f1[_0xef61('0x57')]['id'],'name':_0x2155f1[_0xef61('0x57')][_0xef61('0xc')],'active':_0x2155f1[_0xef61('0x57')][_0xef61('0x58')],'callerid':_0x2155f1[_0xef61('0x57')]['callerid']};}if(_0x2155f1[_0xef61('0x59')]){_0x258b5a[_0xef61('0x59')]={'id':_0x2155f1[_0xef61('0x59')]['id'],'name':_0x2155f1['Interval'][_0xef61('0xc')]};}_0x4e738f[_0xef61('0x5a')](_0x258b5a);}}_0x5e56da({'count':_0x4e738f[_0xef61('0x5b')],'rows':_0x4e738f});});},'UpdateVoiceQueue':function(_0x408e7c){return new Promise(function(_0x216916,_0x354ab1){var _0x4efe56=_[_0xef61('0x5c')](_0x239fa9[_0xef61('0x23')],{'id':parseInt(_0x408e7c['id'])});var _0x5c6ab1=_[_0xef61('0x5d')](_0x408e7c,['id']);if(_0x4efe56){for(var _0x37da22 in _0x5c6ab1){if(typeof _0x5c6ab1[_0x37da22]!==_0xef61('0x5e')&&typeof _0x4efe56[_0x37da22]!==_0xef61('0x5e')){_0x4efe56[_0x37da22]=_0x5c6ab1[_0x37da22];}}_0x216916(_0x4efe56);}else{_0x354ab1();}});},'VoiceChannels':function(_0x5aed1e){return new Promise(function(_0x260c42,_0x20e4f2){var _0x5e614b=_['values'](_0x239fa9[_0xef61('0x5f')]);_0x260c42({'count':_0x5e614b[_0xef61('0x5b')],'rows':_0x5e614b});});},'VoiceChannelMixMonitor':function(_0x53bd30){var _0xe9d203=this;return new Promise(function(_0x132c77,_0x13d0f8){if(ami[_0xef61('0x14')]()==![]){return _0x13d0f8(_0xe9d203[_0xef61('0x15')](0x1f4,[config[_0xef61('0x16')]['ip'],config[_0xef61('0x16')]['username'],_0xef61('0x18')]['join']('\x20')));}var _0x89c04e=schema(properties[_0xef61('0x60')])[_0xef61('0x3')](_0x53bd30);if(_0x89c04e[_0xef61('0x5b')]>0x0){return _0x13d0f8(_0xe9d203[_0xef61('0x15')](0x1f4,_[_0xef61('0x61')](_0x89c04e,_0xef61('0x1f'))[_0xef61('0x19')](',\x20')));}var _0x264877=_['find'](_0x239fa9[_0xef61('0x5f')],{'uniqueid':_0x53bd30[_0xef61('0x62')]});if(_0x264877&&_0x264877['channel']){var _0x5316ac=util[_0xef61('0x63')](_0xef61('0x64'),_0x53bd30['filename']||_0x53bd30[_0xef61('0x62')],_0x53bd30['format']||_0xef61('0x65'));return ami[_0xef61('0x1d')]({'action':_0xef61('0x66'),'channel':_0x264877[_0xef61('0x67')],'file':_0x5316ac,'options':_0xef61('0x68')})[_0xef61('0x1e')](function(_0x593a9a){var _0x474dad=_[_0xef61('0x5c')](_0x264877['monitors'],{'filename':_0xef61('0x69')+_0x5316ac[_0xef61('0x6a')]()});if(_['isNil'](_0x474dad)){_0x264877['monitors'][_0xef61('0x5a')]({'filename':'/var/spool/asterisk/monitor/'+_0x5316ac['toLowerCase'](),'createdAt':moment()['format'](_0xef61('0x6b')),'mixmonitorid':_0x593a9a[_0xef61('0x6c')],'status':'rec'});}else{_0x474dad[_0xef61('0x6c')]=_0x593a9a[_0xef61('0x6c')];_0x474dad[_0xef61('0x6d')]=_0xef61('0x6e');}_0x132c77({'code':0xc8,'message':[_0x53bd30[_0xef61('0x62')],_0xef61('0x6f'),_0x593a9a[_0xef61('0x6c')]][_0xef61('0x19')]('\x20'),'mixmonitorid':_0x593a9a['mixmonitorid']});})['catch'](function(_0x1cb2ef){_0x13d0f8(_0xe9d203[_0xef61('0x15')](0x1f5,[_0x53bd30[_0xef61('0x62')],_0x1cb2ef[_0xef61('0x1f')][_0xef61('0x6a')]()]['join']('\x20')));});}else{return _0x13d0f8(_0xe9d203[_0xef61('0x15')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x5f3b97){var _0x290a23=this;return new Promise(function(_0x310206,_0x224f3a){if(ami['isConnected']()==![]){return _0x224f3a(_0x290a23[_0xef61('0x15')](0x1f4,[config[_0xef61('0x16')]['ip'],config[_0xef61('0x16')][_0xef61('0x17')],_0xef61('0x18')][_0xef61('0x19')]('\x20')));}var _0x2984a7=schema(properties[_0xef61('0x60')])[_0xef61('0x3')](_0x5f3b97);if(_0x2984a7[_0xef61('0x5b')]>0x0){return _0x224f3a(_0x290a23['error'](0x1f4,_[_0xef61('0x61')](_0x2984a7,'message')['join'](',\x20')));}var _0x4386a7=_[_0xef61('0x5c')](_0x239fa9[_0xef61('0x5f')],{'uniqueid':_0x5f3b97[_0xef61('0x62')]});if(_0x4386a7){return BPromise[_0xef61('0x70')]()[_0xef61('0x1e')](function(){if(_0x4386a7['channel']){return ami['Action']({'action':_0xef61('0x71'),'channel':_0x4386a7[_0xef61('0x67')],'mixmonitorid':_0x5f3b97[_0xef61('0x6c')]})[_0xef61('0x20')](function(_0x2921b9){});}})[_0xef61('0x1e')](function(){if(_0x4386a7[_0xef61('0x72')]){return ami[_0xef61('0x1d')]({'action':_0xef61('0x71'),'channel':_0x4386a7[_0xef61('0x72')],'mixmonitorid':_0x5f3b97[_0xef61('0x6c')]})['catch'](function(_0x18d0e8){});}})[_0xef61('0x1e')](function(_0x485945){var _0x4559a6=_[_0xef61('0x5c')](_0x4386a7[_0xef61('0x73')],{'mixmonitorid':_0x5f3b97[_0xef61('0x6c')]});if(_0x4559a6){_0x4559a6[_0xef61('0x6d')]=_0xef61('0x74');}})[_0xef61('0x1e')](function(){var _0x3d9760=util['format'](_0xef61('0x64'),_0x5f3b97['filename']||_0x5f3b97['uniqueid'],_0x5f3b97['format']||_0xef61('0x65'));var _0x205f80=_[_0xef61('0x5c')](_0x4386a7['monitors'],{'filename':_0xef61('0x69')+_0x3d9760[_0xef61('0x6a')]()});if(_0x205f80){_0x205f80[_0xef61('0x6d')]=_0xef61('0x74');}})[_0xef61('0x1e')](function(){_0x310206({'code':0xc8,'message':[_0x5f3b97[_0xef61('0x62')],_0xef61('0x75')][_0xef61('0x19')]('\x20')});})[_0xef61('0x20')](function(_0x2d24c4){_0x224f3a(_0x290a23[_0xef61('0x15')](0x1f5,[_0x5f3b97[_0xef61('0x62')],_0x2d24c4[_0xef61('0x1f')][_0xef61('0x6a')]()][_0xef61('0x19')]('\x20')));});}else{return _0x224f3a(_0x290a23[_0xef61('0x15')](0x1f5,_0xef61('0x76')));}});},'VoiceQueuesChannels':function(_0x117d37){return new Promise(function(_0x529a78,_0xb0ab6d){var _0x1a990c=_[_0xef61('0x77')](_0x239fa9[_0xef61('0x78')]);_0x529a78({'count':_0x1a990c[_0xef61('0x5b')],'rows':_0x1a990c});});},'VoiceQueuesChannel':function(_0x346752){var _0x51e179=this;return new Promise(function(_0xd7537e,_0x38d683){var _0x582492=schema(properties[_0xef61('0x79')])['validate'](_0x346752);if(_0x582492[_0xef61('0x5b')]>0x0){return _0x38d683(_0x51e179[_0xef61('0x15')](0x1f4,_['map'](_0x582492,_0xef61('0x1f'))['join'](',\x20')));}var _0x3cba7f=_[_0xef61('0x5c')](_0x239fa9['queueChannels'],{'uniqueid':_0x346752['uniqueid']});if(_0x3cba7f){_0xd7537e(_0x3cba7f);}else{return _0x38d683(_0x51e179[_0xef61('0x15')](0x1f5,_0xef61('0x76')));}});},'VoiceQueuesChannelHangup':function(_0x7083d8){var _0x3b64e2=this;return new Promise(function(_0x46d614,_0x51255b){if(ami[_0xef61('0x14')]()==![]){return _0x51255b(_0x3b64e2[_0xef61('0x15')](0x1f4,[config[_0xef61('0x16')]['ip'],config[_0xef61('0x16')][_0xef61('0x17')],_0xef61('0x18')]['join']('\x20')));}var _0x28f379=schema(properties['voicequeuechannelhangup'])[_0xef61('0x3')](_0x7083d8);if(_0x28f379[_0xef61('0x5b')]>0x0){return _0x51255b(_0x3b64e2[_0xef61('0x15')](0x1f4,_[_0xef61('0x61')](_0x28f379,_0xef61('0x1f'))[_0xef61('0x19')](',\x20')));}var _0x1eef77=_[_0xef61('0x5c')](_0x239fa9[_0xef61('0x78')],{'uniqueid':_0x7083d8[_0xef61('0x62')]});if(_0x1eef77&&_0x1eef77[_0xef61('0x67')]){return ami[_0xef61('0x1d')]({'action':_0xef61('0x7a'),'channel':_0x1eef77['channel']})[_0xef61('0x1e')](function(_0x37f2e8){_0x46d614({'code':0xc8,'message':[_0x7083d8[_0xef61('0x62')],_0x37f2e8[_0xef61('0x1f')]['toLowerCase']()][_0xef61('0x19')]('\x20')});})['catch'](function(_0x5c5a60){_0x51255b(_0x3b64e2[_0xef61('0x15')](0x1f5,[_0x7083d8['uniqueid'],_0x5c5a60[_0xef61('0x1f')]['toLowerCase']()]['join']('\x20')));});}else{return _0x51255b(_0x3b64e2[_0xef61('0x15')](0x1f5,_0xef61('0x76')));}});},'VoiceQueuesChannelRedirect':function(_0x4f6351){var _0x13cb62=this;return new Promise(function(_0x4a2e8c,_0x11f9c8){if(ami[_0xef61('0x14')]()==![]){return _0x11f9c8(_0x13cb62[_0xef61('0x15')](0x1f4,[config[_0xef61('0x16')]['ip'],config['asterisk'][_0xef61('0x17')],'ami\x20disconnected'][_0xef61('0x19')]('\x20')));}var _0x2ddf83=schema(properties[_0xef61('0x7b')])[_0xef61('0x3')](_0x4f6351);if(_0x2ddf83[_0xef61('0x5b')]>0x0){return _0x11f9c8(_0x13cb62[_0xef61('0x15')](0x1f4,_[_0xef61('0x61')](_0x2ddf83,_0xef61('0x1f'))[_0xef61('0x19')](',\x20')));}var _0x540b68=_[_0xef61('0x5c')](_0x239fa9['queueChannels'],{'uniqueid':_0x4f6351[_0xef61('0x62')]});if(_0x540b68&&_0x540b68[_0xef61('0x67')]){return ami['Action']({'action':_0xef61('0x7c'),'channel':_0x540b68['channel'],'exten':_0x4f6351['exten'],'context':_0x4f6351[_0xef61('0x7d')]||_0x540b68[_0xef61('0x7d')],'priority':0x1})['then'](function(_0x1caf33){_0x4a2e8c({'code':0xc8,'message':[_0x4f6351[_0xef61('0x62')],_0x1caf33['message'][_0xef61('0x6a')]()][_0xef61('0x19')]('\x20')});})['catch'](function(_0x6539a5){_0x11f9c8(_0x13cb62['error'](0x1f5,[_0x4f6351[_0xef61('0x62')],_0x6539a5[_0xef61('0x1f')][_0xef61('0x6a')]()][_0xef61('0x19')]('\x20')));});}else{return _0x11f9c8(_0x13cb62['error'](0x1f5,_0xef61('0x76')));}});},'Agents':function(_0x1b48ea){return new Promise(function(_0x113bf2,_0x4dc8c0){var _0xa1b8d2=_[_0xef61('0x77')](_0x239fa9['agents']);_0x113bf2({'count':_0xa1b8d2['length'],'rows':_0xa1b8d2});});},'Telephones':function(_0x146652){return new Promise(function(_0x229f92,_0x30887a){var _0x3d829e=_[_0xef61('0x77')](_0x239fa9[_0xef61('0x7e')]);_0x229f92({'count':_0x3d829e[_0xef61('0x5b')],'rows':_0x3d829e});});},'Trunks':function(_0x113f9c){return new Promise(function(_0x16b0cb,_0x12a8e){var _0x17f16a=_[_0xef61('0x77')](_0x239fa9[_0xef61('0x7f')]);_0x16b0cb({'count':_0x17f16a[_0xef61('0x5b')],'rows':_0x17f16a});});},'OutboundChannels':function(_0x437b81){return new Promise(function(_0x2f5888,_0x5bb94b){var _0x2ca676=_[_0xef61('0x77')](_0x239fa9[_0xef61('0x80')]);_0x2f5888({'count':_0x2ca676[_0xef61('0x5b')],'rows':_0x2ca676});});},'Outbound':function(_0x3d0f55){return new Promise(function(_0x2a13b0,_0x29ef4b){_0x2a13b0(_0x239fa9[_0xef61('0x33')]);});},'Campaigns':function(_0x1aa0b3){return new Promise(function(_0x371dd3,_0x41be5a){var _0x2ebe38=_['values'](_0x239fa9[_0xef61('0x81')]);_0x371dd3({'count':_0x2ebe38[_0xef61('0x5b')],'rows':_0x2ebe38});});},'VoiceQueuesPreview':function(_0x5f25d7){var _0x32d478=this;return new Promise(function(_0x3607f9,_0x4629bf){_0x45a18d[_0xef61('0x82')](_0x5f25d7['id'])[_0xef61('0x1e')](function(_0x51a988){_0x3607f9({'code':0xc8,'message':_0x51a988[_0xef61('0x1f')]});})['catch'](function(_0xb9a4ba){_0x4629bf(_0x32d478[_0xef61('0x15')](0x1f4,_0xb9a4ba[_0xef61('0x1f')]));});});},'EventManager':function(_0x19b1a0){var _0x2c9a86=this;return new Promise(function(_0x35f379,_0x1aeb3b){if(!_0x19b1a0[_0xef61('0x83')]){return _0x1aeb3b(_0x2c9a86['error'](0x1f4,_0xef61('0x84')));}ami[_0xef61('0x85')](_0xef61('0x86')+_0x19b1a0[_0xef61('0x83')],_0x19b1a0[_0xef61('0x1f')]);_0x35f379({'code':0xc8,'message':_0x19b1a0});});},'FaxAccounts':function(_0x3f8bdb){return new Promise(function(_0x411b1b,_0x2c8155){var _0x338d4f=_['values'](_0x239fa9[_0xef61('0x87')]);_0x411b1b({'count':_0x338d4f[_0xef61('0x5b')],'rows':_0x338d4f});});},'SendFax':function(_0x22006a){var _0x317c4a=this;return new Promise(function(_0x5d8ee9,_0x56535f){_0x5b00b2[_0xef61('0x88')](_0x22006a)[_0xef61('0x1e')](function(_0x12d514){_0x5d8ee9({'code':0xc8,'message':_0x12d514[_0xef61('0x1f')]});})[_0xef61('0x20')](function(_0x4680a6){_0x56535f(_0x317c4a[_0xef61('0x15')](0x1f4,_0x4680a6['message']));});});},'CheckAfterSend':function(_0x3f8355){var _0x660c71=this;return new Promise(function(_0x30a2c7,_0x22e342){_0x5b00b2[_0xef61('0x89')](_0x3f8355)['then'](function(_0x3a815d){_0x30a2c7({'code':0xc8,'message':_0x3a815d['message']});})[_0xef61('0x20')](function(_0x25b183){_0x22e342(_0x660c71[_0xef61('0x15')](0x1f4,_0x25b183[_0xef61('0x1f')]));});});}};var _0x4354f6=jayson[_0xef61('0x8a')](_0x4f0cc5)['http']();_0x4354f6['on'](_0xef61('0x15'),function(_0x10e5f0){return _0x3e2f79(_0x10e5f0);});_0x4354f6[_0xef61('0x9')](0x232a,_0xef61('0x8b'),function(){console[_0xef61('0x8c')](_0xef61('0x8d'),0x232a);return _0x9e17f4(_0xef61('0x8e')+0x232a);});});}; \ No newline at end of file +var _0x5430=['%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','ami\x20disconnected','join','pick','keys','module','Reload','Action','then','message','catch','isConnected','username','command','action','Command','voiceQueues','hasOwnProperty','name','strategy','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','unmanaged','abandoned','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','length','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','find','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','resolve','StopMixMonitor','destinationchannel','stop','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','voicequeuechannelredirect','exten','context','telephones','trunks','campaigns','run','event','Event\x20name\x20mandatory','emit','server','http','listen','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../ami','format'];(function(_0x17848c,_0x4032f8){var _0xb53b0=function(_0x4866aa){while(--_0x4866aa){_0x17848c['push'](_0x17848c['shift']());}};_0xb53b0(++_0x4032f8);}(_0x5430,0x10c));var _0x0543=function(_0x2ede76,_0x10aa55){_0x2ede76=_0x2ede76-0x0;var _0x201f8e=_0x5430[_0x2ede76];return _0x201f8e;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var jayson=require(_0x0543('0x2'));var schema=require(_0x0543('0x3'));var BPromise=require(_0x0543('0x4'));var moment=require(_0x0543('0x5'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0x0543('0x6'));exports['listen']=function(_0x523f3d,_0xce0b65,_0x45b909){return new BPromise(function(_0x9754ba,_0x319568){var _0x46bca7={'QueuePause':function(_0x5ac352){return new Promise(function(_0x372974,_0x7b8280){var _0x2955ea=util[_0x0543('0x7')](_0x0543('0x8'),_0x0543('0x9'),_0x5ac352['name']);if(_0x523f3d[_0x0543('0xa')]&&_0x523f3d[_0x0543('0xa')][_0x2955ea]&&_0x523f3d['timers'][_0x2955ea][_0x0543('0xb')]){_0x523f3d[_0x0543('0xa')][_0x2955ea][_0x0543('0xc')]();}if(_0x523f3d[_0x0543('0xd')][_0x2955ea]){_0x523f3d[_0x0543('0xd')][_0x2955ea][_0x0543('0xe')]({'statePause':_0x5ac352[_0x0543('0xf')]?!![]:![]});}_0x372974({'code':0xc8,'message':_0x0543('0x10')});});},'Reload':function(_0x46d176){var _0x430b4f=this;return new Promise(function(_0x4204db,_0x509afa){if(ami['isConnected']()==![]){return _0x509afa(_0x430b4f[_0x0543('0x11')](0x1f4,[config[_0x0543('0x12')]['ip'],config['asterisk']['username'],_0x0543('0x13')][_0x0543('0x14')]('\x20')));}_0x46d176=_[_0x0543('0x15')](_0x46d176,_[_0x0543('0x16')](properties[_0x0543('0x17')]));_0x46d176['action']=_0x0543('0x18');return ami[_0x0543('0x19')](_0x46d176)[_0x0543('0x1a')](function(_0x25254e){_0x4204db({'code':0xc8,'message':_0x25254e[_0x0543('0x1b')]});})[_0x0543('0x1c')](function(_0x577cf0){_0x509afa(_0x430b4f['error'](0x1f5,_0x577cf0[_0x0543('0x1b')]));});});},'Command':function(_0x5362cb){var _0x50ea84=this;return new Promise(function(_0xbb8816,_0x419913){if(ami[_0x0543('0x1d')]()==![]){return _0x419913(_0x50ea84['error'](0x1f4,[config[_0x0543('0x12')]['ip'],config['asterisk'][_0x0543('0x1e')],_0x0543('0x13')]['join']('\x20')));}_0x5362cb=_[_0x0543('0x15')](_0x5362cb,_0x0543('0x1f'));_0x5362cb[_0x0543('0x20')]=_0x0543('0x21');return ami[_0x0543('0x19')](_0x5362cb)[_0x0543('0x1a')](function(_0x4adba7){_0xbb8816({'code':0xc8,'message':_0x4adba7['content']});})['catch'](function(_0xbfe5dc){_0x419913(_0x50ea84[_0x0543('0x11')](0x1f5,_0xbfe5dc[_0x0543('0x1b')]));});});},'VoiceQueues':function(_0xaf1c0e){return new Promise(function(_0x2b1425,_0x26e500){var _0x36d824=[];for(var _0x17a3de in _0x523f3d[_0x0543('0x22')]){if(_0x523f3d[_0x0543('0x22')][_0x0543('0x23')](_0x17a3de)){var _0x21fc63=_0x523f3d['voiceQueues'][_0x17a3de];var _0x25e6f1={'id':_0x21fc63['id'],'name':_0x21fc63[_0x0543('0x24')],'strategy':_0x21fc63[_0x0543('0x25')],'answered':_0x21fc63['answered'],'available':_0x21fc63[_0x0543('0x26')],'loggedIn':_0x21fc63[_0x0543('0x27')],'pTalking':_0x21fc63[_0x0543('0x28')],'sumBillable':_0x21fc63[_0x0543('0x29')],'sumDuration':_0x21fc63['sumDuration'],'sumHoldTime':_0x21fc63[_0x0543('0x2a')]||0x0,'talking':_0x21fc63[_0x0543('0x2b')],'total':_0x21fc63['total'],'type':_0x21fc63['type'],'unmanaged':_0x21fc63[_0x0543('0x2c')],'abandoned':_0x21fc63[_0x0543('0x2d')],'waiting':_0x21fc63['waiting'],'loggedInDb':_0x21fc63[_0x0543('0x2e')]};if(_0x21fc63[_0x0543('0x2f')]===_0x0543('0x30')){_0x25e6f1[_0x0543('0x31')]=_0x21fc63[_0x0543('0x31')];_0x25e6f1[_0x0543('0x32')]=_0x21fc63[_0x0543('0x32')];_0x25e6f1['dialOriginateCallerIdName']=_0x21fc63[_0x0543('0x33')];_0x25e6f1['dialOriginateCallerIdNumber']=_0x21fc63[_0x0543('0x34')];_0x25e6f1[_0x0543('0x35')]=_0x21fc63[_0x0543('0x35')];_0x25e6f1[_0x0543('0x36')]=_0x21fc63[_0x0543('0x36')];_0x25e6f1['temp']=_0x21fc63[_0x0543('0x37')];_0x25e6f1['outboundAnswerAgiCallsDay']=_0x21fc63[_0x0543('0x38')];_0x25e6f1[_0x0543('0x39')]=_0x21fc63[_0x0543('0x39')];_0x25e6f1[_0x0543('0x3a')]=_0x21fc63['outboundBlacklistCallsDay'];_0x25e6f1[_0x0543('0x3b')]=_0x21fc63['outboundBusyCallsDay'];_0x25e6f1[_0x0543('0x3c')]=_0x21fc63[_0x0543('0x3c')];_0x25e6f1[_0x0543('0x3d')]=_0x21fc63[_0x0543('0x3d')];_0x25e6f1[_0x0543('0x3e')]=_0x21fc63[_0x0543('0x3e')];_0x25e6f1[_0x0543('0x3f')]=_0x21fc63[_0x0543('0x3f')];_0x25e6f1[_0x0543('0x40')]=_0x21fc63[_0x0543('0x40')];_0x25e6f1['outboundNoSuchCallsDay']=_0x21fc63[_0x0543('0x41')];_0x25e6f1[_0x0543('0x42')]=_0x21fc63['outboundOriginateFailureCallsDay'];_0x25e6f1[_0x0543('0x43')]=_0x21fc63['outboundReCallsDay'];_0x25e6f1[_0x0543('0x44')]=_0x21fc63[_0x0543('0x44')];_0x25e6f1['outboundUnknownCallsDay']=_0x21fc63['outboundUnknownCallsDay'];_0x25e6f1[_0x0543('0x45')]=_0x21fc63[_0x0543('0x45')];_0x25e6f1['predictiveIntervalAvgHoldtime']=_0x21fc63[_0x0543('0x46')];_0x25e6f1[_0x0543('0x47')]=_0x21fc63['predictiveIntervalAvgTalktime'];_0x25e6f1[_0x0543('0x48')]=_0x21fc63[_0x0543('0x48')];_0x25e6f1[_0x0543('0x49')]=_0x21fc63[_0x0543('0x49')];_0x25e6f1[_0x0543('0x4a')]=_0x21fc63['predictiveIntervalErlangCalls'];_0x25e6f1['predictiveIntervalErlangCallsDroppedCalls']=_0x21fc63['predictiveIntervalErlangCallsDroppedCalls'];_0x25e6f1[_0x0543('0x4b')]=_0x21fc63[_0x0543('0x4b')];_0x25e6f1[_0x0543('0x4c')]=_0x21fc63[_0x0543('0x4c')];_0x25e6f1['predictiveIntervalPauses']=_0x21fc63[_0x0543('0x4d')];_0x25e6f1[_0x0543('0x4e')]=_0x21fc63[_0x0543('0x4e')];_0x25e6f1[_0x0543('0x4f')]=_0x21fc63[_0x0543('0x4f')];_0x25e6f1[_0x0543('0x1b')]=_0x21fc63[_0x0543('0x1b')];_0x25e6f1['originated']=_0x21fc63[_0x0543('0x50')];_0x25e6f1[_0x0543('0x51')]=_0x21fc63[_0x0543('0x51')];_0x25e6f1[_0x0543('0x52')]=_0x21fc63[_0x0543('0x52')];_0x25e6f1[_0x0543('0x53')]=_0x21fc63['erlangAbandonmentRate'];_0x25e6f1['erlangBusyFactor']=_0x21fc63[_0x0543('0x54')];_0x25e6f1[_0x0543('0x55')]=_0x21fc63[_0x0543('0x55')];_0x25e6f1[_0x0543('0x56')]=_0x21fc63[_0x0543('0x56')];}if(_0x21fc63[_0x0543('0x57')]){_0x25e6f1[_0x0543('0x57')]={'id':_0x21fc63[_0x0543('0x57')]['id'],'name':_0x21fc63[_0x0543('0x57')]['name'],'active':_0x21fc63['Trunk'][_0x0543('0x58')],'callerid':_0x21fc63[_0x0543('0x57')]['callerid']};}if(_0x21fc63['Interval']){_0x25e6f1[_0x0543('0x59')]={'id':_0x21fc63[_0x0543('0x59')]['id'],'name':_0x21fc63['Interval'][_0x0543('0x24')]};}_0x36d824['push'](_0x25e6f1);}}_0x2b1425({'count':_0x36d824[_0x0543('0x5a')],'rows':_0x36d824});});},'UpdateVoiceQueue':function(_0x3e723a){return new Promise(function(_0x4c412b,_0x5e2511){var _0xd95442=_['find'](_0x523f3d[_0x0543('0x22')],{'id':parseInt(_0x3e723a['id'])});var _0x40b2ac=_[_0x0543('0x5b')](_0x3e723a,['id']);if(_0xd95442){for(var _0x270ce0 in _0x40b2ac){if(typeof _0x40b2ac[_0x270ce0]!==_0x0543('0x5c')&&typeof _0xd95442[_0x270ce0]!==_0x0543('0x5c')){_0xd95442[_0x270ce0]=_0x40b2ac[_0x270ce0];}}_0x4c412b(_0xd95442);}else{_0x5e2511();}});},'VoiceChannels':function(_0x5a28a3){return new Promise(function(_0x4236b7,_0x21268c){var _0xb8076c=_[_0x0543('0x5d')](_0x523f3d[_0x0543('0x5e')]);_0x4236b7({'count':_0xb8076c['length'],'rows':_0xb8076c});});},'VoiceChannelMixMonitor':function(_0x29840e){var _0x4e4b75=this;return new Promise(function(_0x183bef,_0x3e8c64){if(ami[_0x0543('0x1d')]()==![]){return _0x3e8c64(_0x4e4b75[_0x0543('0x11')](0x1f4,[config[_0x0543('0x12')]['ip'],config[_0x0543('0x12')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0xc832e2=schema(properties[_0x0543('0x5f')])['validate'](_0x29840e);if(_0xc832e2[_0x0543('0x5a')]>0x0){return _0x3e8c64(_0x4e4b75[_0x0543('0x11')](0x1f4,_[_0x0543('0x60')](_0xc832e2,_0x0543('0x1b'))[_0x0543('0x14')](',\x20')));}var _0x4038a6=_['find'](_0x523f3d[_0x0543('0x5e')],{'uniqueid':_0x29840e[_0x0543('0x61')]});if(_0x4038a6&&_0x4038a6[_0x0543('0x62')]){var _0x416ae0=util[_0x0543('0x7')](_0x0543('0x63'),_0x29840e[_0x0543('0x64')]||_0x29840e[_0x0543('0x61')],_0x29840e[_0x0543('0x7')]||_0x0543('0x65'));return ami[_0x0543('0x19')]({'action':_0x0543('0x66'),'channel':_0x4038a6[_0x0543('0x62')],'file':_0x416ae0,'options':_0x0543('0x67')})['then'](function(_0x14358d){var _0x3c5acc=_[_0x0543('0x68')](_0x4038a6[_0x0543('0x69')],{'filename':_0x0543('0x6a')+_0x416ae0[_0x0543('0x6b')]()});if(_[_0x0543('0x6c')](_0x3c5acc)){_0x4038a6[_0x0543('0x69')][_0x0543('0x6d')]({'filename':_0x0543('0x6a')+_0x416ae0[_0x0543('0x6b')](),'createdAt':moment()[_0x0543('0x7')](_0x0543('0x6e')),'mixmonitorid':_0x14358d[_0x0543('0x6f')],'status':_0x0543('0x70')});}else{_0x3c5acc['mixmonitorid']=_0x14358d[_0x0543('0x6f')];_0x3c5acc[_0x0543('0x71')]='rec';}_0x183bef({'code':0xc8,'message':[_0x29840e[_0x0543('0x61')],_0x0543('0x72'),_0x14358d[_0x0543('0x6f')]]['join']('\x20'),'mixmonitorid':_0x14358d[_0x0543('0x6f')]});})['catch'](function(_0x294a38){_0x3e8c64(_0x4e4b75['error'](0x1f5,[_0x29840e[_0x0543('0x61')],_0x294a38['message'][_0x0543('0x6b')]()][_0x0543('0x14')]('\x20')));});}else{return _0x3e8c64(_0x4e4b75[_0x0543('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x117466){var _0x1a569b=this;return new Promise(function(_0x20ccee,_0xf46956){if(ami[_0x0543('0x1d')]()==![]){return _0xf46956(_0x1a569b[_0x0543('0x11')](0x1f4,[config[_0x0543('0x12')]['ip'],config[_0x0543('0x12')][_0x0543('0x1e')],_0x0543('0x13')][_0x0543('0x14')]('\x20')));}var _0x2ff23a=schema(properties[_0x0543('0x5f')])[_0x0543('0x3')](_0x117466);if(_0x2ff23a[_0x0543('0x5a')]>0x0){return _0xf46956(_0x1a569b['error'](0x1f4,_['map'](_0x2ff23a,_0x0543('0x1b'))[_0x0543('0x14')](',\x20')));}var _0x312d6f=_[_0x0543('0x68')](_0x523f3d[_0x0543('0x5e')],{'uniqueid':_0x117466[_0x0543('0x61')]});if(_0x312d6f){return BPromise[_0x0543('0x73')]()[_0x0543('0x1a')](function(){if(_0x312d6f[_0x0543('0x62')]){return ami['Action']({'action':_0x0543('0x74'),'channel':_0x312d6f[_0x0543('0x62')],'mixmonitorid':_0x117466[_0x0543('0x6f')]})[_0x0543('0x1c')](function(_0x5d7b59){});}})[_0x0543('0x1a')](function(){if(_0x312d6f[_0x0543('0x75')]){return ami[_0x0543('0x19')]({'action':'StopMixMonitor','channel':_0x312d6f['destinationchannel'],'mixmonitorid':_0x117466[_0x0543('0x6f')]})[_0x0543('0x1c')](function(_0x1f44a3){});}})['then'](function(_0x3b9444){var _0x1dfdd7=_[_0x0543('0x68')](_0x312d6f['monitors'],{'mixmonitorid':_0x117466[_0x0543('0x6f')]});if(_0x1dfdd7){_0x1dfdd7[_0x0543('0x71')]=_0x0543('0x76');}})[_0x0543('0x1a')](function(){var _0x2cd2e9=util[_0x0543('0x7')](_0x0543('0x63'),_0x117466[_0x0543('0x64')]||_0x117466[_0x0543('0x61')],_0x117466[_0x0543('0x7')]||_0x0543('0x65'));var _0x6167e6=_[_0x0543('0x68')](_0x312d6f[_0x0543('0x69')],{'filename':'/var/spool/asterisk/monitor/'+_0x2cd2e9['toLowerCase']()});if(_0x6167e6){_0x6167e6[_0x0543('0x71')]=_0x0543('0x76');}})[_0x0543('0x1a')](function(){_0x20ccee({'code':0xc8,'message':[_0x117466[_0x0543('0x61')],'StopMixMonitor\x20Success'][_0x0543('0x14')]('\x20')});})['catch'](function(_0x1e1fc0){_0xf46956(_0x1a569b[_0x0543('0x11')](0x1f5,[_0x117466[_0x0543('0x61')],_0x1e1fc0['message']['toLowerCase']()][_0x0543('0x14')]('\x20')));});}else{return _0xf46956(_0x1a569b['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x30ee35){return new Promise(function(_0x1f26dd,_0xf32305){var _0x314c60=_[_0x0543('0x5d')](_0x523f3d[_0x0543('0x77')]);_0x1f26dd({'count':_0x314c60[_0x0543('0x5a')],'rows':_0x314c60});});},'VoiceQueuesChannel':function(_0x42f249){var _0x236c40=this;return new Promise(function(_0x55bfa5,_0x1b94de){var _0xec2838=schema(properties[_0x0543('0x78')])[_0x0543('0x3')](_0x42f249);if(_0xec2838[_0x0543('0x5a')]>0x0){return _0x1b94de(_0x236c40['error'](0x1f4,_[_0x0543('0x60')](_0xec2838,'message')[_0x0543('0x14')](',\x20')));}var _0x85a666=_[_0x0543('0x68')](_0x523f3d[_0x0543('0x77')],{'uniqueid':_0x42f249['uniqueid']});if(_0x85a666){_0x55bfa5(_0x85a666);}else{return _0x1b94de(_0x236c40[_0x0543('0x11')](0x1f5,_0x0543('0x79')));}});},'VoiceQueuesChannelHangup':function(_0x439121){var _0x534eb7=this;return new Promise(function(_0x3ae9f2,_0x4f5946){if(ami[_0x0543('0x1d')]()==![]){return _0x4f5946(_0x534eb7[_0x0543('0x11')](0x1f4,[config[_0x0543('0x12')]['ip'],config[_0x0543('0x12')][_0x0543('0x1e')],_0x0543('0x13')]['join']('\x20')));}var _0x59f214=schema(properties['voicequeuechannelhangup'])[_0x0543('0x3')](_0x439121);if(_0x59f214[_0x0543('0x5a')]>0x0){return _0x4f5946(_0x534eb7[_0x0543('0x11')](0x1f4,_[_0x0543('0x60')](_0x59f214,_0x0543('0x1b'))[_0x0543('0x14')](',\x20')));}var _0x15a605=_[_0x0543('0x68')](_0x523f3d['queueChannels'],{'uniqueid':_0x439121['uniqueid']});if(_0x15a605&&_0x15a605[_0x0543('0x62')]){return ami[_0x0543('0x19')]({'action':'Hangup','channel':_0x15a605[_0x0543('0x62')]})['then'](function(_0x136760){_0x3ae9f2({'code':0xc8,'message':[_0x439121[_0x0543('0x61')],_0x136760[_0x0543('0x1b')][_0x0543('0x6b')]()][_0x0543('0x14')]('\x20')});})['catch'](function(_0x13c620){_0x4f5946(_0x534eb7[_0x0543('0x11')](0x1f5,[_0x439121['uniqueid'],_0x13c620[_0x0543('0x1b')][_0x0543('0x6b')]()][_0x0543('0x14')]('\x20')));});}else{return _0x4f5946(_0x534eb7['error'](0x1f5,_0x0543('0x79')));}});},'VoiceQueuesChannelRedirect':function(_0x328825){var _0x44d480=this;return new Promise(function(_0x4abf55,_0x18d597){if(ami[_0x0543('0x1d')]()==![]){return _0x18d597(_0x44d480[_0x0543('0x11')](0x1f4,[config[_0x0543('0x12')]['ip'],config['asterisk'][_0x0543('0x1e')],_0x0543('0x13')][_0x0543('0x14')]('\x20')));}var _0x53d3ab=schema(properties[_0x0543('0x7a')])[_0x0543('0x3')](_0x328825);if(_0x53d3ab[_0x0543('0x5a')]>0x0){return _0x18d597(_0x44d480[_0x0543('0x11')](0x1f4,_[_0x0543('0x60')](_0x53d3ab,_0x0543('0x1b'))[_0x0543('0x14')](',\x20')));}var _0xffbbf2=_[_0x0543('0x68')](_0x523f3d[_0x0543('0x77')],{'uniqueid':_0x328825[_0x0543('0x61')]});if(_0xffbbf2&&_0xffbbf2[_0x0543('0x62')]){return ami[_0x0543('0x19')]({'action':'Redirect','channel':_0xffbbf2[_0x0543('0x62')],'exten':_0x328825[_0x0543('0x7b')],'context':_0x328825[_0x0543('0x7c')]||_0xffbbf2[_0x0543('0x7c')],'priority':0x1})[_0x0543('0x1a')](function(_0x768420){_0x4abf55({'code':0xc8,'message':[_0x328825[_0x0543('0x61')],_0x768420[_0x0543('0x1b')][_0x0543('0x6b')]()][_0x0543('0x14')]('\x20')});})[_0x0543('0x1c')](function(_0x4bb8ea){_0x18d597(_0x44d480[_0x0543('0x11')](0x1f5,[_0x328825[_0x0543('0x61')],_0x4bb8ea[_0x0543('0x1b')]['toLowerCase']()][_0x0543('0x14')]('\x20')));});}else{return _0x18d597(_0x44d480['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x46ab3c){return new Promise(function(_0x587f56,_0x110318){var _0xabba9a=_[_0x0543('0x5d')](_0x523f3d[_0x0543('0xd')]);_0x587f56({'count':_0xabba9a['length'],'rows':_0xabba9a});});},'Telephones':function(_0x4bc97b){return new Promise(function(_0x46dc8e,_0x1769d9){var _0x7eafcf=_['values'](_0x523f3d[_0x0543('0x7d')]);_0x46dc8e({'count':_0x7eafcf[_0x0543('0x5a')],'rows':_0x7eafcf});});},'Trunks':function(_0x4cf0ca){return new Promise(function(_0x32a641,_0x146062){var _0x5979d4=_['values'](_0x523f3d[_0x0543('0x7e')]);_0x32a641({'count':_0x5979d4[_0x0543('0x5a')],'rows':_0x5979d4});});},'OutboundChannels':function(_0x28bfe2){return new Promise(function(_0x4e4ec2,_0x32ea5d){var _0x37f54b=_[_0x0543('0x5d')](_0x523f3d['outboundChannels']);_0x4e4ec2({'count':_0x37f54b['length'],'rows':_0x37f54b});});},'Outbound':function(_0x702a00){return new Promise(function(_0xb2a557,_0xc75d33){_0xb2a557(_0x523f3d['outbound']);});},'Campaigns':function(_0x2cf198){return new Promise(function(_0x2403e1,_0x662fdb){var _0x13bd65=_[_0x0543('0x5d')](_0x523f3d[_0x0543('0x7f')]);_0x2403e1({'count':_0x13bd65[_0x0543('0x5a')],'rows':_0x13bd65});});},'VoiceQueuesPreview':function(_0x19eeb5){var _0xefa0a1=this;return new Promise(function(_0x403340,_0xa3bb00){_0xce0b65[_0x0543('0x80')](_0x19eeb5['id'])[_0x0543('0x1a')](function(_0x3d9f3d){_0x403340({'code':0xc8,'message':_0x3d9f3d[_0x0543('0x1b')]});})[_0x0543('0x1c')](function(_0x107350){_0xa3bb00(_0xefa0a1['error'](0x1f4,_0x107350[_0x0543('0x1b')]));});});},'EventManager':function(_0x6e5f4b){var _0x37c82f=this;return new Promise(function(_0x24ec36,_0x4f2319){if(!_0x6e5f4b[_0x0543('0x81')]){return _0x4f2319(_0x37c82f[_0x0543('0x11')](0x1f4,_0x0543('0x82')));}ami[_0x0543('0x83')]('custom:'+_0x6e5f4b[_0x0543('0x81')],_0x6e5f4b[_0x0543('0x1b')]);_0x24ec36({'code':0xc8,'message':_0x6e5f4b});});},'FaxAccounts':function(_0x5cc7f5){return new Promise(function(_0x1db64c,_0x24bc48){var _0x34f06a=_[_0x0543('0x5d')](_0x523f3d['faxAccounts']);_0x1db64c({'count':_0x34f06a[_0x0543('0x5a')],'rows':_0x34f06a});});},'SendFax':function(_0x35ed5f){var _0x28c5ef=this;return new Promise(function(_0x24fca2,_0x2d7617){_0x45b909['send'](_0x35ed5f)[_0x0543('0x1a')](function(_0x384548){_0x24fca2({'code':0xc8,'message':_0x384548['message']});})[_0x0543('0x1c')](function(_0x535601){_0x2d7617(_0x28c5ef[_0x0543('0x11')](0x1f4,_0x535601[_0x0543('0x1b')]));});});},'CheckAfterSend':function(_0x128f67){var _0x15df91=this;return new Promise(function(_0x566e89,_0xf70d9a){_0x45b909['checkAfterSend'](_0x128f67)[_0x0543('0x1a')](function(_0x20eec9){_0x566e89({'code':0xc8,'message':_0x20eec9[_0x0543('0x1b')]});})[_0x0543('0x1c')](function(_0x26d460){_0xf70d9a(_0x15df91[_0x0543('0x11')](0x1f4,_0x26d460[_0x0543('0x1b')]));});});}};var _0x2d1390=jayson[_0x0543('0x84')](_0x46bca7)[_0x0543('0x85')]();_0x2d1390['on'](_0x0543('0x11'),function(_0x57aa7e){return _0x319568(_0x57aa7e);});_0x2d1390[_0x0543('0x86')](0x232a,_0x0543('0x87'),function(){console[_0x0543('0x88')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x9754ba(_0x0543('0x89')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 957883a..d93d733 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 _0x9bde=['destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','user:%s','name','action','toLowerCase','length','bluebird','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','[CM][%s][%s]','stringify','emit','data1','data2','isNil','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','Unknown'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x9bde,0xe1));var _0xe9bd=function(_0x540356,_0x4091f2){_0x540356=_0x540356-0x0;var _0x5dad68=_0x9bde[_0x540356];return _0x5dad68;};'use strict';var _=require('lodash');var BPromise=require(_0xe9bd('0x0'));var Redis=require('ioredis');var util=require(_0xe9bd('0x1'));var config=require('../../../../config/environment');var logger=require(_0xe9bd('0x2'))(_0xe9bd('0x3'));var cmContactRpc=require(_0xe9bd('0x4'));config[_0xe9bd('0x5')]=_[_0xe9bd('0x6')](config[_0xe9bd('0x5')],{'host':_0xe9bd('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe9bd('0x5')]));function emit(_0x5f18fe,_0x22a438,_0xa66ae2,_0x2d5c75,_0x3ef9e3){logger[_0xe9bd('0x8')](_0xe9bd('0x9'),_0x5f18fe,_0x22a438['id'],_0xa66ae2,_0x2d5c75,JSON[_0xe9bd('0xa')](_0x3ef9e3));io['to'](_0xa66ae2)[_0xe9bd('0xb')](_0x2d5c75,_0x3ef9e3);}exports['exec']=function(_0x5f36c8,_0x3c8e95,_0x145521,_0x2601ac){var _0x581ab9,_0x12c96e;var _0x9eca50={};var _0x3339f9=Number(_0x145521[_0xe9bd('0xc')]);var _0x5e022a=_0x145521[_0xe9bd('0xd')]?Boolean(Number(_0x145521['data2'])):![];var _0x220d07;var _0x429e88=![];if(!_[_0xe9bd('0xe')](_0x145521['data5'])){if(_0x145521['data5']=='1')_0x429e88=!![];}if(!_0x429e88){if(_0x2601ac[_0xe9bd('0xf')]){_0x9eca50['id']=_0x2601ac[_0xe9bd('0xf')];}}if(!_0x9eca50['id']){_0x9eca50[_0xe9bd('0x10')]=_0x3339f9;_0x220d07=_0x145521[_0xe9bd('0x11')]&&_0x145521[_0xe9bd('0x11')]!=='0'?_0x145521[_0xe9bd('0x11')][_0xe9bd('0x12')](','):['phone'];_0x9eca50[_0xe9bd('0x13')]=_[_0xe9bd('0x14')](_0x220d07,function(_0x160281){var _0x494b27={};_0x494b27[_0x160281]=_0x2601ac[_0xe9bd('0x15')]?_0x2601ac[_0xe9bd('0x16')]:_0x2601ac[_0xe9bd('0x17')];return _0x494b27;});}var _0x330733=['id','firstName',_0xe9bd('0x18'),'phone',_0xe9bd('0x19'),'fax',_0xe9bd('0x10'),_0xe9bd('0x1a'),_0xe9bd('0x1b'),_0xe9bd('0x1c')];var _0x1acb82=_[_0xe9bd('0x1d')](_0x330733,_0x220d07);BPromise[_0xe9bd('0x1e')]()['then'](cmContactRpc[_0xe9bd('0x1f')]({'attributes':_0x1acb82,'where':_0x9eca50}))[_0xe9bd('0x20')](function(_0x4ecaf5){_0x12c96e=_0x4ecaf5;if(!_[_0xe9bd('0x21')](_0x12c96e)){if(_0x12c96e['length']===0x1){_0x581ab9=_0x12c96e[0x0];logger[_0xe9bd('0x8')](_0xe9bd('0x22'),_0x2601ac[_0xe9bd('0x23')],_0x3c8e95['id'],_0x581ab9['id']);}else{logger[_0xe9bd('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x2601ac[_0xe9bd('0x23')],_0x3c8e95['id'],_[_0xe9bd('0x14')](_0x12c96e,'id')[_0xe9bd('0x24')](','));}return;}else{logger[_0xe9bd('0x8')](_0xe9bd('0x25'),_0x2601ac[_0xe9bd('0x23')],_0x3c8e95['id']);var _0x399f3c={'ListId':_0x3339f9};var _0x43ea90=_0x145521[_0xe9bd('0x26')]&&_0x145521['data4']!=='0'?_0x145521[_0xe9bd('0x26')]:_0xe9bd('0x27');if(_0x5e022a){logger['info'](_0xe9bd('0x28'),_0x2601ac[_0xe9bd('0x23')],_0x3c8e95['id']);_0x399f3c[_0x43ea90]=_[_0xe9bd('0xe')](_0x2601ac[_0xe9bd('0x15')])?_0x2601ac[_0xe9bd('0x17')]:_0x2601ac[_0xe9bd('0x16')];if(_['isNil'](_0x2601ac['routeId'])){_0x399f3c[_0xe9bd('0x29')]=_0x2601ac['calleridname']&&_0x2601ac[_0xe9bd('0x2a')]!==_0xe9bd('0x2b')?_0x2601ac[_0xe9bd('0x2a')]:_0xe9bd('0x2c');}else{_0x399f3c[_0xe9bd('0x29')]=_0x2601ac['destcalleridname']&&_0x2601ac['destcalleridname']!==_0xe9bd('0x2b')?_0x2601ac[_0xe9bd('0x2d')]:_0xe9bd('0x2c');}return BPromise[_0xe9bd('0x1e')]()[_0xe9bd('0x20')](cmContactRpc[_0xe9bd('0x2e')](_0x399f3c))[_0xe9bd('0x20')](function(_0x66213a){_0x581ab9=_0x66213a;_0x12c96e[_0xe9bd('0x2f')](_0x66213a);if(_0x581ab9){logger['info'](_0xe9bd('0x30'),_0x2601ac[_0xe9bd('0x23')],_0x3c8e95['id'],_0x581ab9['id']);}return;});}else{logger[_0xe9bd('0x8')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x2601ac['uniqueid'],_0x3c8e95['id']);_0x399f3c[_0x43ea90]=_[_0xe9bd('0xe')](_0x2601ac[_0xe9bd('0x15')])?_0x2601ac[_0xe9bd('0x17')]:_0x2601ac[_0xe9bd('0x16')];if(_[_0xe9bd('0xe')](_0x2601ac[_0xe9bd('0x15')])){_0x399f3c[_0xe9bd('0x29')]=_0x2601ac[_0xe9bd('0x2a')]&&_0x2601ac[_0xe9bd('0x2a')]!==_0xe9bd('0x2b')?_0x2601ac[_0xe9bd('0x2a')]:_0xe9bd('0x2c');}else{_0x399f3c[_0xe9bd('0x29')]=_0x2601ac[_0xe9bd('0x2d')]&&_0x2601ac[_0xe9bd('0x2d')]!==_0xe9bd('0x2b')?_0x2601ac[_0xe9bd('0x2d')]:_0xe9bd('0x2c');}_0x581ab9=_0x399f3c;_0x12c96e['push'](_0x399f3c);return;}}})[_0xe9bd('0x20')](function(){if(_0x5f36c8){emit(_0x2601ac[_0xe9bd('0x23')],_0x3c8e95,util['format'](_0xe9bd('0x31'),_0x5f36c8[_0xe9bd('0x32')]),util['format']('trigger:%s',_0x145521[_0xe9bd('0x33')][_0xe9bd('0x34')]()),{'evt':_['merge'](_0x2601ac,{'autoCreate':_0x5e022a}),'contact':_0x581ab9===undefined?{}:_0x581ab9,'contacts':_0x12c96e[_0xe9bd('0x35')]===0x0?undefined:_0x12c96e});}});}; \ No newline at end of file +var _0x5fd1=['data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','firstName','calleridname','','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','Unknown','format','user:%s','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','exec','data1','data2','data5','xmd-contactid','ListId','data3','split','map','destcalleridnum','calleridnum','lastName','phone','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]'];(function(_0x388c8c,_0x5162dd){var _0x22b98c=function(_0x15923f){while(--_0x15923f){_0x388c8c['push'](_0x388c8c['shift']());}};_0x22b98c(++_0x5162dd);}(_0x5fd1,0x155));var _0x15fd=function(_0x55ac8b,_0x5306dd){_0x55ac8b=_0x55ac8b-0x0;var _0xb4649=_0x5fd1[_0x55ac8b];return _0xb4649;};'use strict';var _=require(_0x15fd('0x0'));var BPromise=require('bluebird');var Redis=require(_0x15fd('0x1'));var util=require(_0x15fd('0x2'));var config=require(_0x15fd('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x15fd('0x4'));config[_0x15fd('0x5')]=_[_0x15fd('0x6')](config['redis'],{'host':_0x15fd('0x7'),'port':0x18eb});var io=require(_0x15fd('0x8'))(new Redis(config[_0x15fd('0x5')]));function emit(_0x2e88bf,_0x225728,_0x534e63,_0x210e90,_0x1ee117){logger[_0x15fd('0x9')]('[CM][%s][%s]',_0x2e88bf,_0x225728['id'],_0x534e63,_0x210e90,JSON[_0x15fd('0xa')](_0x1ee117));io['to'](_0x534e63)['emit'](_0x210e90,_0x1ee117);}exports[_0x15fd('0xb')]=function(_0x250457,_0x4c226a,_0x4883fd,_0x4ebde5){var _0x3dd2af,_0x2a4d55;var _0x2b5485={};var _0x188905=Number(_0x4883fd[_0x15fd('0xc')]);var _0x2e18ec=_0x4883fd[_0x15fd('0xd')]?Boolean(Number(_0x4883fd[_0x15fd('0xd')])):![];var _0x459fa4;var _0x4cb391=![];if(!_['isNil'](_0x4883fd['data5'])){if(_0x4883fd[_0x15fd('0xe')]=='1')_0x4cb391=!![];}if(!_0x4cb391){if(_0x4ebde5[_0x15fd('0xf')]){_0x2b5485['id']=_0x4ebde5[_0x15fd('0xf')];}}if(!_0x2b5485['id']){_0x2b5485[_0x15fd('0x10')]=_0x188905;_0x459fa4=_0x4883fd[_0x15fd('0x11')]&&_0x4883fd[_0x15fd('0x11')]!=='0'?_0x4883fd[_0x15fd('0x11')][_0x15fd('0x12')](','):['phone'];_0x2b5485['$or']=_[_0x15fd('0x13')](_0x459fa4,function(_0x5ca5a2){var _0x7afe9c={};_0x7afe9c[_0x5ca5a2]=_0x4ebde5['routeId']?_0x4ebde5[_0x15fd('0x14')]:_0x4ebde5[_0x15fd('0x15')];return _0x7afe9c;});}var _0x855bae=['id','firstName',_0x15fd('0x16'),_0x15fd('0x17'),_0x15fd('0x18'),_0x15fd('0x19'),_0x15fd('0x10'),_0x15fd('0x1a'),_0x15fd('0x1b'),_0x15fd('0x1c')];var _0x1b8b9f=_[_0x15fd('0x1d')](_0x855bae,_0x459fa4);BPromise[_0x15fd('0x1e')]()['then'](cmContactRpc['getContacts']({'attributes':_0x1b8b9f,'where':_0x2b5485}))[_0x15fd('0x1f')](function(_0x36b21e){_0x2a4d55=_0x36b21e;if(!_[_0x15fd('0x20')](_0x2a4d55)){if(_0x2a4d55[_0x15fd('0x21')]===0x1){_0x3dd2af=_0x2a4d55[0x0];logger[_0x15fd('0x9')](_0x15fd('0x22'),_0x4ebde5[_0x15fd('0x23')],_0x4c226a['id'],_0x3dd2af['id']);}else{logger['info'](_0x15fd('0x24'),_0x4ebde5[_0x15fd('0x23')],_0x4c226a['id'],_[_0x15fd('0x13')](_0x2a4d55,'id')['join'](','));}return;}else{logger[_0x15fd('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x4ebde5[_0x15fd('0x23')],_0x4c226a['id']);var _0x1fc24f={'ListId':_0x188905};var _0x21601d=_0x4883fd['data4']&&_0x4883fd[_0x15fd('0x25')]!=='0'?_0x4883fd[_0x15fd('0x25')]:_0x15fd('0x17');if(_0x2e18ec){logger['info'](_0x15fd('0x26'),_0x4ebde5['uniqueid'],_0x4c226a['id']);_0x1fc24f[_0x21601d]=_[_0x15fd('0x27')](_0x4ebde5[_0x15fd('0x28')])?_0x4ebde5[_0x15fd('0x15')]:_0x4ebde5[_0x15fd('0x14')];if(_[_0x15fd('0x27')](_0x4ebde5[_0x15fd('0x28')])){_0x1fc24f[_0x15fd('0x29')]=_0x4ebde5[_0x15fd('0x2a')]&&_0x4ebde5[_0x15fd('0x2a')]!==_0x15fd('0x2b')?_0x4ebde5[_0x15fd('0x2a')]:'Unknown';}else{_0x1fc24f[_0x15fd('0x29')]=_0x4ebde5[_0x15fd('0x2c')]&&_0x4ebde5['destcalleridname']!==_0x15fd('0x2b')?_0x4ebde5[_0x15fd('0x2c')]:'Unknown';}return BPromise[_0x15fd('0x1e')]()[_0x15fd('0x1f')](cmContactRpc['createContact'](_0x1fc24f))[_0x15fd('0x1f')](function(_0x199647){_0x3dd2af=_0x199647;_0x2a4d55[_0x15fd('0x2d')](_0x199647);if(_0x3dd2af){logger[_0x15fd('0x9')](_0x15fd('0x2e'),_0x4ebde5[_0x15fd('0x23')],_0x4c226a['id'],_0x3dd2af['id']);}return;});}else{logger['info'](_0x15fd('0x2f'),_0x4ebde5[_0x15fd('0x23')],_0x4c226a['id']);_0x1fc24f[_0x21601d]=_[_0x15fd('0x27')](_0x4ebde5[_0x15fd('0x28')])?_0x4ebde5['calleridnum']:_0x4ebde5[_0x15fd('0x14')];if(_[_0x15fd('0x27')](_0x4ebde5[_0x15fd('0x28')])){_0x1fc24f[_0x15fd('0x29')]=_0x4ebde5[_0x15fd('0x2a')]&&_0x4ebde5[_0x15fd('0x2a')]!==''?_0x4ebde5[_0x15fd('0x2a')]:_0x15fd('0x30');}else{_0x1fc24f['firstName']=_0x4ebde5[_0x15fd('0x2c')]&&_0x4ebde5[_0x15fd('0x2c')]!==_0x15fd('0x2b')?_0x4ebde5['destcalleridname']:_0x15fd('0x30');}_0x3dd2af=_0x1fc24f;_0x2a4d55[_0x15fd('0x2d')](_0x1fc24f);return;}}})[_0x15fd('0x1f')](function(){if(_0x250457){emit(_0x4ebde5[_0x15fd('0x23')],_0x4c226a,util[_0x15fd('0x31')](_0x15fd('0x32'),_0x250457['name']),util['format']('trigger:%s',_0x4883fd[_0x15fd('0x33')][_0x15fd('0x34')]()),{'evt':_[_0x15fd('0x35')](_0x4ebde5,{'autoCreate':_0x2e18ec}),'contact':_0x3dd2af===undefined?{}:_0x3dd2af,'contacts':_0x2a4d55['length']===0x0?undefined:_0x2a4d55});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f7b3906..0f1f873 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 _0x5adb=['lastevent','null','substatus','undefined','offlineMessage','created','equals','exports','lodash','url','ioredis','./integration','./cmContact','./script','../../../config/logger','trigger','../ami','redis','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','freshdeskAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','voice','checkTriggers','interface','hasOwnProperty','checkTrigger','variables','Actions','length','toLowerCase','motionbar','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','800','data5','data6','600','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','action','contactmanager','exec','integration','queue','routeId','script','buildUri','query','search','replace','channel','AllConditions','every','AnyConditions','some','checkConditions','field','chat','operator','value','ChatWebsiteId','AccountId','upperFirst','interaction','event','agent','membername'];(function(_0x722aa2,_0x50ce38){var _0x416c31=function(_0x48a9c6){while(--_0x48a9c6){_0x722aa2['push'](_0x722aa2['shift']());}};_0x416c31(++_0x50ce38);}(_0x5adb,0x84));var _0xb5ad=function(_0x467c05,_0x2cbb49){_0x467c05=_0x467c05-0x0;var _0x192eee=_0x5adb[_0x467c05];return _0x192eee;};'use strict';var util=require('util');var _=require(_0xb5ad('0x0'));var url=require(_0xb5ad('0x1'));var Mustache=require('mustache');var Redis=require(_0xb5ad('0x2'));var urlforward=require('./urlforward');var integration=require(_0xb5ad('0x3'));var cmContact=require(_0xb5ad('0x4'));var script=require(_0xb5ad('0x5'));var config=require('../../../config/environment');var logger=require(_0xb5ad('0x6'))(_0xb5ad('0x7'));var ami=require(_0xb5ad('0x8'));config[_0xb5ad('0x9')]=_['defaults'](config[_0xb5ad('0x9')],{'host':_0xb5ad('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb5ad('0x9')]));var operators={'equals':function(_0x178dd3,_0x3c4b86){return _0x178dd3==_0x3c4b86;},'not_equals':function(_0x4e6f41,_0x48853a){return _0x4e6f41!=_0x48853a;}};var barAndWebActions=[_0xb5ad('0xb'),'url',_0xb5ad('0xc')];function Trigger(_0x39d590){this[_0xb5ad('0xd')]=_0x39d590[_0xb5ad('0xd')];this[_0xb5ad('0xe')]=_0x39d590[_0xb5ad('0xe')];this[_0xb5ad('0xf')]=_0x39d590['voiceQueues'];this[_0xb5ad('0x10')]=_0x39d590[_0xb5ad('0x10')];this[_0xb5ad('0x11')]=_0x39d590[_0xb5ad('0x11')];this[_0xb5ad('0x12')]=_0x39d590['zendeskAccounts'];this['freshdeskAccounts']=_0x39d590['freshdeskAccounts'];this[_0xb5ad('0x13')]=_0x39d590[_0xb5ad('0x13')];this[_0xb5ad('0x14')]=_0x39d590[_0xb5ad('0x14')];this[_0xb5ad('0x15')]=_0x39d590[_0xb5ad('0x15')];this[_0xb5ad('0x16')]=_0x39d590[_0xb5ad('0x16')];this[_0xb5ad('0x17')]=_0x39d590['vtigerAccounts'];this[_0xb5ad('0x18')]=_0x39d590[_0xb5ad('0x18')];this[_0xb5ad('0x19')]=_0x39d590['dynamics365Accounts'];this[_0xb5ad('0x1a')]=_0x39d590[_0xb5ad('0x1a')];this[_0xb5ad('0x1b')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xb5ad('0x13')],'freshdesk':this[_0xb5ad('0x1c')],'sugarcrm':this[_0xb5ad('0x14')],'zoho':this[_0xb5ad('0x15')],'desk':this[_0xb5ad('0x16')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xb5ad('0x19')],'freshsales':this[_0xb5ad('0x1a')],'servicenow':this[_0xb5ad('0x18')]};ami['on'](_0xb5ad('0x1d'),this[_0xb5ad('0x1e')][_0xb5ad('0x1f')](this));ami['on']('custom:agentconnect',this['syncCustomEvent'][_0xb5ad('0x1f')](this));ami['on']('custom:agentringnoanswer',this[_0xb5ad('0x1e')][_0xb5ad('0x1f')](this));ami['on'](_0xb5ad('0x20'),this[_0xb5ad('0x1e')][_0xb5ad('0x1f')](this));ami['on'](_0xb5ad('0x21'),this[_0xb5ad('0x1e')][_0xb5ad('0x1f')](this));ami['on'](_0xb5ad('0x22'),this[_0xb5ad('0x1e')][_0xb5ad('0x1f')](this));ami['on'](_0xb5ad('0x23'),this[_0xb5ad('0x1e')]['bind'](this));ami['on'](_0xb5ad('0x24'),this[_0xb5ad('0x1e')]['bind'](this));ami['on'](_0xb5ad('0x25'),this['syncCustomEvent'][_0xb5ad('0x1f')](this));ami['on'](_0xb5ad('0x26'),this[_0xb5ad('0x1e')][_0xb5ad('0x1f')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent'][_0xb5ad('0x1f')](this));ami['on']('custom:timeout',this['syncCustomEvent'][_0xb5ad('0x1f')](this));ami['on'](_0xb5ad('0x27'),this[_0xb5ad('0x28')][_0xb5ad('0x1f')](this));ami['on'](_0xb5ad('0x29'),this[_0xb5ad('0x28')][_0xb5ad('0x1f')](this));ami['on'](_0xb5ad('0x2a'),this[_0xb5ad('0x28')]['bind'](this));ami['on'](_0xb5ad('0x2b'),this[_0xb5ad('0x1e')]['bind'](this));ami['on']('custom:closedinteraction',this[_0xb5ad('0x1e')][_0xb5ad('0x1f')](this));ami['on']('custom:substatus',this['syncCustomEvent'][_0xb5ad('0x1f')](this));ami['on']('custom:incomingmessage',this[_0xb5ad('0x1e')]['bind'](this));ami['on'](_0xb5ad('0x2c'),this[_0xb5ad('0x1e')][_0xb5ad('0x1f')](this));ami['on'](_0xb5ad('0x2d'),this[_0xb5ad('0x1e')][_0xb5ad('0x1f')](this));ami['on'](_0xb5ad('0x2e'),this['syncCustomEvent'][_0xb5ad('0x1f')](this));ami['on'](_0xb5ad('0x2f'),this[_0xb5ad('0x1e')]['bind'](this));}Trigger[_0xb5ad('0x30')][_0xb5ad('0x31')]=function(_0x20505e,_0x2e9452,_0x14c3ed){logger[_0xb5ad('0x32')](_0x20505e,_0x2e9452,JSON[_0xb5ad('0x33')](_0x14c3ed));io['to'](_0x20505e)[_0xb5ad('0x31')](_0x2e9452,_0x14c3ed);};Trigger[_0xb5ad('0x30')][_0xb5ad('0x1e')]=function(_0x39cb0f){var _0xbddf2e=_[_0xb5ad('0x34')](_0x39cb0f);if(typeof _0xbddf2e[_0xb5ad('0x35')]==='undefined'){_0xbddf2e[_0xb5ad('0x35')]=_0xb5ad('0x36');}this[_0xb5ad('0x37')](_0xbddf2e);};Trigger[_0xb5ad('0x30')]['syncAgentDial']=function(_0x3d4390){if(this[_0xb5ad('0xe')][_0x3d4390[_0xb5ad('0x38')]]){this[_0xb5ad('0x1e')](_0x3d4390);}};Trigger[_0xb5ad('0x30')]['checkTriggers']=function(_0xa33d87){var _0x13bb43;for(var _0x40e700 in this[_0xb5ad('0xd')]){if(this[_0xb5ad('0xd')][_0xb5ad('0x39')](_0x40e700)){if(this[_0xb5ad('0xd')][_0x40e700]['status']){_0x13bb43=this[_0xb5ad('0x3a')](this['triggers'][_0x40e700],_0xa33d87);if(_0x13bb43){_['merge'](_0xa33d87,_0xa33d87[_0xb5ad('0x3b')]);for(var _0x591956=0x0,_0x1cea84,_0x44f924,_0x2e667f;_0x5919560x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x129204,_0x224d26){var _0x38b543=function(_0x4d5443){while(--_0x4d5443){_0x129204['push'](_0x129204['shift']());}};_0x38b543(++_0x224d26);}(_0x55ca,0x126));var _0xa55c=function(_0x14735c,_0x56c131){_0x14735c=_0x14735c-0x0;var _0x44e4f4=_0x55ca[_0x14735c];return _0x44e4f4;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index e29f611..1b40e95 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 _0x3acd=['userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','length','catch','toLowerCase','destcalleridnum','calleridnum','contacts','headers','substring','lastIndexOf','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','enduserId','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','type','nameField','customField','indexOf','content','ticketType','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','phonecall','callDirection','queue','phonecalls','Fields','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','data7','serverUrl','unmanaged','outbound','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','resolve','data5','POST','clientId','username','password','clientSecret','then','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','internalemailaddress','isdisabled','info','systemuserid'];(function(_0x3ba85a,_0x44d336){var _0x324581=function(_0x28d5cb){while(--_0x28d5cb){_0x3ba85a['push'](_0x3ba85a['shift']());}};_0x324581(++_0x44d336);}(_0x3acd,0x112));var _0xd3ac=function(_0x3fbb70,_0x8468f1){_0x3fbb70=_0x3fbb70-0x0;var _0x1b3348=_0x3acd[_0x3fbb70];return _0x1b3348;};'use strict';var _=require(_0xd3ac('0x0'));var rp=require('request-promise');var util=require(_0xd3ac('0x1'));var intUtil=require(_0xd3ac('0x2'));var md5=require(_0xd3ac('0x3'));var Redis=require(_0xd3ac('0x4'));var logger=require(_0xd3ac('0x5'))(_0xd3ac('0x6'));var config=require(_0xd3ac('0x7'));config[_0xd3ac('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd3ac('0x9'))(new Redis(config[_0xd3ac('0x8')]));function getAuthToken(_0x4b6dcc,_0x190eb6,_0x2c2d04){if(_0x4b6dcc[_0xd3ac('0xa')]){_0x4b6dcc[_0xd3ac('0xb')]=_0x4b6dcc[_0xd3ac('0xc')]['data7'];_0x4b6dcc[_0xd3ac('0xd')]=_0x4b6dcc[_0xd3ac('0xc')][_0xd3ac('0xe')];return Promise[_0xd3ac('0xf')](_0x4b6dcc['CloudProvider'][_0xd3ac('0x10')]);}var _0x3520f3={'method':_0xd3ac('0x11'),'uri':_0x190eb6,'form':{'client_id':_0x4b6dcc[_0xd3ac('0x12')],'resource':_0x4b6dcc[_0xd3ac('0xb')],'username':_0x4b6dcc[_0xd3ac('0x13')],'password':_0x4b6dcc[_0xd3ac('0x14')],'grant_type':_0xd3ac('0x14'),'client_secret':_0x4b6dcc[_0xd3ac('0x15')]},'json':!![]};return rp(_0x3520f3)[_0xd3ac('0x16')](function(_0x296aaf){return _0x296aaf['access_token'];})['catch'](function(_0x2bd2c8){logger[_0xd3ac('0x17')]('['+[_0x2c2d04[_0xd3ac('0x18')]()]+']\x20Wrong\x20credentials!');return _0x2bd2c8[_0xd3ac('0x19')];});}function getUser(_0x595ca1,_0x586877,_0x4fb9d4,_0x7c6c1,_0x20d309,_0xa4644f){return new Promise(function(_0x29ba9a,_0xa6a9de){return getAuthToken(_0x586877,_0x7c6c1,_0xa4644f)[_0xd3ac('0x16')](function(_0x37a86a){var _0x5138b4={'method':_0xd3ac('0x1a'),'uri':_0x20d309+_0xd3ac('0x1b'),'headers':{'Authorization':_0xd3ac('0x1c')+_0x37a86a,'OData-Version':_0xd3ac('0x1d')},'json':!![]};return rp(_0x5138b4);})[_0xd3ac('0x16')](function(_0x5a3d77){var _0x1c8c13=_0x5a3d77[_0xd3ac('0x1e')];var _0x4b26cf=![];var _0x37197d=null;if(!_[_0xd3ac('0x1f')](_0x4fb9d4)){if(intUtil[_0xd3ac('0x20')](_0x4fb9d4[_0xd3ac('0x21')])){_0x595ca1['userEmail']=_0x4fb9d4[_0xd3ac('0x21')];for(_0x37197d=0x0;_0x37197d<_0x1c8c13['length'];_0x37197d++){if(_0x1c8c13[_0x37197d][_0xd3ac('0x22')]===_0x4fb9d4['email']&&!_0x1c8c13[_0x37197d][_0xd3ac('0x23')]){_0x4b26cf=!![];logger[_0xd3ac('0x24')]('['+[_0xa4644f[_0xd3ac('0x18')]()]+']\x20Agent\x20found\x20'+_0x1c8c13[_0x37197d][_0xd3ac('0x25')]+'!');_0x595ca1[_0xd3ac('0x26')]=_0x1c8c13[_0x37197d][_0xd3ac('0x25')];}}}}if(!_0x4b26cf){logger[_0xd3ac('0x24')]('['+[_0xa4644f[_0xd3ac('0x18')]()]+_0xd3ac('0x27'));_0x595ca1[_0xd3ac('0x28')]=_0x586877[_0xd3ac('0x13')];for(_0x37197d=0x0;_0x37197d<_0x1c8c13[_0xd3ac('0x29')];_0x37197d++){if(_0x1c8c13[_0x37197d]['internalemailaddress']===_0x586877[_0xd3ac('0x13')]){_0x595ca1[_0xd3ac('0x26')]=_0x1c8c13[_0x37197d][_0xd3ac('0x25')];}}}_0x29ba9a(_0x595ca1);})[_0xd3ac('0x2a')](function(_0x374dec){_0xa6a9de(_0x374dec['message']);});});}function createEndUser(_0x5ad31e,_0x2c6612,_0x42e539,_0xc8fcb8,_0x2c5999,_0x521e21){return new Promise(function(_0x349423,_0x59dc84){return getAuthToken(_0x2c6612,_0x42e539,_0x521e21)[_0xd3ac('0x16')](function(_0x56a6ae){var _0x22f600=_0x521e21[_0xd3ac('0x2b')]()==='outbound'?_0x2c5999[_0xd3ac('0x2c')]:_0x2c5999[_0xd3ac('0x2d')];var _0x135c86={'method':'POST','uri':_0xc8fcb8+_0xd3ac('0x2e'),'body':{'telephone1':_0x22f600,'fullname':_0x22f600,'firstname':_0x22f600,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x5ad31e[_0xd3ac('0x26')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x56a6ae,'OData-Version':_0xd3ac('0x1d')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x135c86);})[_0xd3ac('0x16')](function(_0x17b724){var _0x258a43=_0x17b724[_0xd3ac('0x2f')]['odata-entityid'];var _0x4f6146=_0x258a43[_0xd3ac('0x30')](_0x258a43[_0xd3ac('0x31')]('(')+0x1,_0x258a43['lastIndexOf'](')'));_0x5ad31e['enduserId']=_0x4f6146;_0x349423(_0x5ad31e);})[_0xd3ac('0x2a')](function(_0x51de01){_0x59dc84(_0x51de01[_0xd3ac('0x19')]);});});}function getEndUser(_0x49bbee,_0x425c30,_0x58c8e1,_0x15029b,_0x1c1eb7,_0x5001cb,_0x4510d1){var _0x55cdcd=_0x5001cb[_0xd3ac('0x2b')]()==='outbound'?_0x1c1eb7[_0xd3ac('0x2c')]:_0x1c1eb7[_0xd3ac('0x2d')];return getAuthToken(_0x425c30,_0x58c8e1,_0x5001cb)[_0xd3ac('0x16')](function(_0x40132a){var _0x10286d={'method':'GET','uri':_0x15029b+_0xd3ac('0x32')+_0x55cdcd[_0xd3ac('0x33')]('+',_0xd3ac('0x34'))+'\x27','headers':{'Authorization':_0xd3ac('0x1c')+_0x40132a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x10286d);})[_0xd3ac('0x16')](function(_0x3d3c73){var _0x3b185b=![];if(!_0x3d3c73)return _0x3b185b;var _0x3d7fa5=_0x3d3c73[_0xd3ac('0x1e')];for(var _0x267cc0=0x0;_0x267cc0<_0x3d7fa5[_0xd3ac('0x29')];_0x267cc0++){if(_0x3d7fa5[_0x267cc0][_0xd3ac('0x35')]===_0x55cdcd){_0x3b185b=!![];_0x49bbee[_0xd3ac('0x36')]=_0x3d7fa5[_0x267cc0][_0xd3ac('0x37')];}}return _0x3b185b;})['then'](function(_0x4563dc){if(_0x4563dc)return _0x49bbee;if(_0x4510d1==='nothing'){logger[_0xd3ac('0x24')]('['+[_0x5001cb[_0xd3ac('0x18')]()]+_0xd3ac('0x38'));return _0x49bbee;}return createEndUser(_0x49bbee,_0x425c30,_0x58c8e1,_0x15029b,_0x1c1eb7,_0x5001cb)[_0xd3ac('0x16')](function(_0x33b136){logger[_0xd3ac('0x24')]('['+[_0x5001cb[_0xd3ac('0x18')]()]+_0xd3ac('0x39'),_0x33b136[_0xd3ac('0x36')]);return _0x33b136;});});}function getCustomFields(_0x415c70,_0x15272d,_0x50150e){var _0x5d4416={};if(_0x415c70[_0xd3ac('0x29')]>0x0){_[_0xd3ac('0x3a')](_0x415c70,function(_0x1df8d8){if(_[_0xd3ac('0x3b')](['string','picklist'],_0x1df8d8[_0xd3ac('0x3c')])&&_0x1df8d8[_0xd3ac('0x3d')]&&!_0x1df8d8[_0xd3ac('0x3e')]){var _0x1f2f1f=_0x1df8d8['idField']['toLowerCase']();var _0x5bb12c=_0x1f2f1f[_0xd3ac('0x30')](0x0,_0x1f2f1f[_0xd3ac('0x3f')]('_'));var _0x48674b=_0x1f2f1f[_0xd3ac('0x30')](_0x1f2f1f['indexOf']('_')+0x1);if(_0x5bb12c===_0x50150e){_0x5d4416[_0x48674b]=_0x1df8d8[_0xd3ac('0x40')];}}});}return _0x5d4416;}function getTicket(_0xbf59a3,_0x32a6bb,_0x4cdd52,_0x36226b,_0x18a014,_0x5220cc,_0x403b61){return new Promise(function(_0x21f253,_0x582bb4){var _0x4608ee;return getAuthToken(_0x32a6bb,_0x4cdd52,_0x403b61)[_0xd3ac('0x16')](function(_0x227461){if(_0x5220cc[_0xd3ac('0x41')]==='incident'){_0x4608ee={'method':_0xd3ac('0x11'),'uri':_0x36226b+_0xd3ac('0x42'),'body':Object[_0xd3ac('0x43')]({},{'title':intUtil[_0xd3ac('0x44')](_0x5220cc[_0xd3ac('0x45')],_0x18a014,'\x20'),'description':intUtil[_0xd3ac('0x44')](_0x5220cc[_0xd3ac('0x46')],_0x18a014,'\x0a'),'customerid_contact@odata.bind':_0xbf59a3[_0xd3ac('0x36')]?_0xd3ac('0x47')+_0xbf59a3[_0xd3ac('0x36')]+')':undefined,'ownerid@odata.bind':_0xd3ac('0x48')+_0xbf59a3['userId']+')','caseorigincode':'1'},getCustomFields(_0x5220cc['Fields'],_0x18a014,_0x5220cc['ticketType'])),'headers':{'Authorization':_0xd3ac('0x1c')+_0x227461,'OData-Version':_0xd3ac('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5220cc[_0xd3ac('0x41')]===_0xd3ac('0x49')){var _0x3391a9=_0xbf59a3['enduserId']?[{'partyid_systemuser@odata.bind':_0xd3ac('0x48')+_0xbf59a3[_0xd3ac('0x26')]+')','participationtypemask':_0xbf59a3[_0xd3ac('0x4a')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xd3ac('0x47')+_0xbf59a3[_0xd3ac('0x36')]+')','participationtypemask':_0xbf59a3[_0xd3ac('0x4a')]===_0xd3ac('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xd3ac('0x48')+_0xbf59a3[_0xd3ac('0x26')]+')','participationtypemask':_0xbf59a3[_0xd3ac('0x4a')]===_0xd3ac('0x4b')?0x2:0x1}];_0x4608ee={'method':_0xd3ac('0x11'),'uri':_0x36226b+_0xd3ac('0x4c'),'body':Object[_0xd3ac('0x43')]({},{'subject':intUtil[_0xd3ac('0x44')](_0x5220cc['Subjects'],_0x18a014,'\x20'),'phonenumber':String(_0x18a014[_0xd3ac('0x2d')]),'description':intUtil[_0xd3ac('0x44')](_0x5220cc['Descriptions'],_0x18a014,'\x0a'),'regardingobjectid_contact@odata.bind':_0xbf59a3[_0xd3ac('0x36')]?_0xd3ac('0x47')+_0xbf59a3[_0xd3ac('0x36')]+')':undefined,'ownerid@odata.bind':_0xd3ac('0x48')+_0xbf59a3[_0xd3ac('0x26')]+')','directioncode':_0xbf59a3[_0xd3ac('0x4a')]===_0xd3ac('0x4b')?![]:!![],'phonecall_activity_parties':_0x3391a9},getCustomFields(_0x5220cc[_0xd3ac('0x4d')],_0x18a014,_0x5220cc[_0xd3ac('0x41')])),'headers':{'Authorization':_0xd3ac('0x1c')+_0x227461,'OData-Version':_0xd3ac('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4608ee);})[_0xd3ac('0x16')](function(_0x3e2ed8){var _0x487f47=_0x3e2ed8[_0xd3ac('0x2f')]['odata-entityid'];var _0x84855e=_0x487f47[_0xd3ac('0x30')](_0x487f47[_0xd3ac('0x31')]('(')+0x1,_0x487f47[_0xd3ac('0x31')](')'));_0xbf59a3['ticketId']=_0x84855e;_0x21f253(_0xbf59a3);})['catch'](function(_0x828861){_0x582bb4(_0x828861[_0xd3ac('0x19')]);});});}function emit(_0x11ba9d,_0x58ca26,_0x89e6a,_0x243a25){var _0x54c03b={'uri':util[_0xd3ac('0x4e')](_0xd3ac('0x4f'),_0x11ba9d,_0x89e6a,_0x243a25)};io['to'](util[_0xd3ac('0x4e')](_0xd3ac('0x50'),_0x58ca26))['emit'](_0xd3ac('0x51'),_0x54c03b);}exports['cs']=function(_0x42cd3a,_0x5a1efb,_0x24597f,_0x4ab1c3,_0x13ef9b,_0x5faa7c,_0x47ce9c,_0x316043){var _0x4a44fb={};_0x5faa7c[_0xd3ac('0xb')]=_0x5faa7c['modernAuthentication']?intUtil[_0xd3ac('0x52')](_0x5faa7c[_0xd3ac('0xc')][_0xd3ac('0x53')]):intUtil[_0xd3ac('0x52')](_0x5faa7c[_0xd3ac('0xb')]);_0x5faa7c[_0xd3ac('0x54')]=intUtil['stripTrailingSlash'](_0x5faa7c[_0xd3ac('0x54')]);_0x4a44fb[_0xd3ac('0x4a')]=_0x316043===_0xd3ac('0x4b')||_0x316043===_0xd3ac('0x55')?_0xd3ac('0x4b'):_0xd3ac('0x56');var _0x43fa0b=_0x5faa7c[_0xd3ac('0xa')]?util[_0xd3ac('0x4e')](_0xd3ac('0x57'),_0x5faa7c[_0xd3ac('0xc')][_0xd3ac('0x53')]):util['format']('%s/api/data/v9.0/',_0x5faa7c[_0xd3ac('0xb')]);var _0x48ec2c=util[_0xd3ac('0x4e')](_0xd3ac('0x58'),_0x5faa7c[_0xd3ac('0xd')]);var _0xc70be2=util[_0xd3ac('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5faa7c['serverUrl'],_0x5a1efb[_0xd3ac('0x59')],md5(_0x5a1efb[_0xd3ac('0x59')]));if(_0x13ef9b&&_0x13ef9b['monitor_format']){logger[_0xd3ac('0x24')]('[QUEUE]','Recording\x20is\x20enabled!');_0x5a1efb[_0xd3ac('0x5a')]=_0xc70be2;}else if(_0x47ce9c&&_0x47ce9c[_0xd3ac('0x5b')]&&_0x47ce9c[_0xd3ac('0x5b')]!==_0xd3ac('0x5c')){logger[_0xd3ac('0x24')](_0xd3ac('0x5d'),_0xd3ac('0x5e'));_0x5a1efb[_0xd3ac('0x5a')]=_0xc70be2;}else{_0x5a1efb[_0xd3ac('0x5a')]='';}return getUser(_0x4a44fb,_0x5faa7c,_0x4ab1c3,_0x48ec2c,_0x43fa0b,_0x316043)[_0xd3ac('0x16')](function(_0xee4801){logger[_0xd3ac('0x24')]('['+_0x316043[_0xd3ac('0x18')]()+']\x20The\x20User\x20ID\x20is:',_0xee4801['userId']);logger[_0xd3ac('0x24')]('['+_0x316043[_0xd3ac('0x18')]()+_0xd3ac('0x5f'),_0xee4801['userEmail']);return getEndUser(_0xee4801,_0x5faa7c,_0x48ec2c,_0x43fa0b,_0x5a1efb,_0x316043,_0x24597f[_0xd3ac('0x60')]);})[_0xd3ac('0x16')](function(_0x575e0f){logger[_0xd3ac('0x24')]('['+_0x316043[_0xd3ac('0x18')]()+_0xd3ac('0x61'),_0x575e0f[_0xd3ac('0x36')]);logger[_0xd3ac('0x24')]('['+_0x316043[_0xd3ac('0x18')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x5a1efb['calleridnum']);return getTicket(_0x575e0f,_0x5faa7c,_0x48ec2c,_0x43fa0b,_0x5a1efb,_0x24597f,_0x316043);})['then'](function(_0x3d3e1e){logger[_0xd3ac('0x24')](util[_0xd3ac('0x4e')]('['+_0x316043['toUpperCase']()+_0xd3ac('0x62'),_0x24597f[_0xd3ac('0x41')],_0x3d3e1e[_0xd3ac('0x63')]));logger[_0xd3ac('0x24')](util['format']('['+_0x316043['toUpperCase']()+_0xd3ac('0x64'),_0x316043));if(_0x316043!=='unmanaged'){logger[_0xd3ac('0x24')]('['+_0x316043[_0xd3ac('0x18')]()+']',_0xd3ac('0x65'));emit(_0x5faa7c[_0xd3ac('0xb')],_0x4ab1c3[_0xd3ac('0x66')],_0x24597f[_0xd3ac('0x41')],_0x3d3e1e[_0xd3ac('0x63')]);}})[_0xd3ac('0x2a')](function(_0x5e46ad){logger[_0xd3ac('0x17')]('['+_0x316043[_0xd3ac('0x18')]()+_0xd3ac('0x67'),_0x5e46ad['message']);});}; \ No newline at end of file +var _0x64c4=['uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','redis','defaults','socket.io-emitter','remoteUri','CloudProvider','tenantId','resolve','clientId','username','password','clientSecret','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','message','outbound','destcalleridnum','calleridnum','/systemusers(','headers','odata-entityid','substring','lastIndexOf','toLowerCase','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','type','nameField','indexOf','content','ticketType','incident','POST','incidents','getString','Subjects','Descriptions','/contacts(','phonecall','callDirection','queue','assign','Fields','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token'];(function(_0x11a69a,_0x2916e1){var _0x58d75c=function(_0x46eaca){while(--_0x46eaca){_0x11a69a['push'](_0x11a69a['shift']());}};_0x58d75c(++_0x2916e1);}(_0x64c4,0x1a6));var _0x464c=function(_0x7be062,_0x37d0ef){_0x7be062=_0x7be062-0x0;var _0x426354=_0x64c4[_0x7be062];return _0x426354;};'use strict';var _=require(_0x464c('0x0'));var rp=require(_0x464c('0x1'));var util=require(_0x464c('0x2'));var intUtil=require(_0x464c('0x3'));var md5=require('md5');var Redis=require(_0x464c('0x4'));var logger=require(_0x464c('0x5'))(_0x464c('0x6'));var config=require('../../../../config/environment');config[_0x464c('0x7')]=_[_0x464c('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x464c('0x9'))(new Redis(config[_0x464c('0x7')]));function getAuthToken(_0x126e60,_0xa23f13,_0x4cd5fa){if(_0x126e60['modernAuthentication']){_0x126e60[_0x464c('0xa')]=_0x126e60[_0x464c('0xb')]['data7'];_0x126e60[_0x464c('0xc')]=_0x126e60[_0x464c('0xb')]['data2'];return Promise[_0x464c('0xd')](_0x126e60['CloudProvider']['data5']);}var _0x595f8d={'method':'POST','uri':_0xa23f13,'form':{'client_id':_0x126e60[_0x464c('0xe')],'resource':_0x126e60[_0x464c('0xa')],'username':_0x126e60[_0x464c('0xf')],'password':_0x126e60[_0x464c('0x10')],'grant_type':'password','client_secret':_0x126e60[_0x464c('0x11')]},'json':!![]};return rp(_0x595f8d)['then'](function(_0x4eb9fc){return _0x4eb9fc[_0x464c('0x12')];})['catch'](function(_0x5c136f){logger[_0x464c('0x13')]('['+[_0x4cd5fa[_0x464c('0x14')]()]+_0x464c('0x15'));return _0x5c136f['message'];});}function getUser(_0x29bd03,_0x4bf707,_0x1f3c08,_0x2e2bbe,_0x630264,_0x36a8f2){return new Promise(function(_0x419270,_0xb1c80b){return getAuthToken(_0x4bf707,_0x2e2bbe,_0x36a8f2)[_0x464c('0x16')](function(_0x20cee5){var _0x37501f={'method':_0x464c('0x17'),'uri':_0x630264+_0x464c('0x18'),'headers':{'Authorization':_0x464c('0x19')+_0x20cee5,'OData-Version':_0x464c('0x1a')},'json':!![]};return rp(_0x37501f);})['then'](function(_0x609f8a){var _0x3e2b41=_0x609f8a[_0x464c('0x1b')];var _0xcdafb1=![];var _0x169a19=null;if(!_['isNil'](_0x1f3c08)){if(intUtil[_0x464c('0x1c')](_0x1f3c08[_0x464c('0x1d')])){_0x29bd03[_0x464c('0x1e')]=_0x1f3c08['email'];for(_0x169a19=0x0;_0x169a19<_0x3e2b41[_0x464c('0x1f')];_0x169a19++){if(_0x3e2b41[_0x169a19][_0x464c('0x20')]===_0x1f3c08[_0x464c('0x1d')]&&!_0x3e2b41[_0x169a19][_0x464c('0x21')]){_0xcdafb1=!![];logger[_0x464c('0x22')]('['+[_0x36a8f2[_0x464c('0x14')]()]+']\x20Agent\x20found\x20'+_0x3e2b41[_0x169a19]['systemuserid']+'!');_0x29bd03[_0x464c('0x23')]=_0x3e2b41[_0x169a19][_0x464c('0x24')];}}}}if(!_0xcdafb1){logger[_0x464c('0x22')]('['+[_0x36a8f2['toUpperCase']()]+_0x464c('0x25'));_0x29bd03[_0x464c('0x1e')]=_0x4bf707[_0x464c('0xf')];for(_0x169a19=0x0;_0x169a19<_0x3e2b41['length'];_0x169a19++){if(_0x3e2b41[_0x169a19]['internalemailaddress']===_0x4bf707[_0x464c('0xf')]){_0x29bd03[_0x464c('0x23')]=_0x3e2b41[_0x169a19][_0x464c('0x24')];}}}_0x419270(_0x29bd03);})[_0x464c('0x26')](function(_0x365012){_0xb1c80b(_0x365012[_0x464c('0x27')]);});});}function createEndUser(_0xd346a9,_0x3d2f45,_0x226f6b,_0x3a0d24,_0xedb71b,_0x2bbc7e){return new Promise(function(_0x94a128,_0x15f9bc){return getAuthToken(_0x3d2f45,_0x226f6b,_0x2bbc7e)[_0x464c('0x16')](function(_0x4e7c7d){var _0x239d57=_0x2bbc7e['toLowerCase']()===_0x464c('0x28')?_0xedb71b[_0x464c('0x29')]:_0xedb71b[_0x464c('0x2a')];var _0x522abe={'method':'POST','uri':_0x3a0d24+'contacts','body':{'telephone1':_0x239d57,'fullname':_0x239d57,'firstname':_0x239d57,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x464c('0x2b')+_0xd346a9[_0x464c('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4e7c7d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x522abe);})[_0x464c('0x16')](function(_0x2edb03){var _0x3ac1d3=_0x2edb03[_0x464c('0x2c')][_0x464c('0x2d')];var _0x500ae7=_0x3ac1d3[_0x464c('0x2e')](_0x3ac1d3[_0x464c('0x2f')]('(')+0x1,_0x3ac1d3[_0x464c('0x2f')](')'));_0xd346a9['enduserId']=_0x500ae7;_0x94a128(_0xd346a9);})[_0x464c('0x26')](function(_0x1fa8f7){_0x15f9bc(_0x1fa8f7['message']);});});}function getEndUser(_0x42b0d0,_0x5be101,_0x5a1f7d,_0x2014a7,_0x2204be,_0x33725e,_0x553187){var _0x624930=_0x33725e[_0x464c('0x30')]()==='outbound'?_0x2204be[_0x464c('0x29')]:_0x2204be[_0x464c('0x2a')];return getAuthToken(_0x5be101,_0x5a1f7d,_0x33725e)[_0x464c('0x16')](function(_0x760d76){var _0x4ff488={'method':_0x464c('0x17'),'uri':_0x2014a7+_0x464c('0x31')+_0x624930[_0x464c('0x32')]('+',_0x464c('0x33'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x760d76,'If-None-Match':null,'OData-Version':_0x464c('0x1a')},'json':!![]};return rp(_0x4ff488);})['then'](function(_0x240e00){var _0x4b0dfc=![];if(!_0x240e00)return _0x4b0dfc;var _0x5d9df2=_0x240e00['value'];for(var _0x3d4a8e=0x0;_0x3d4a8e<_0x5d9df2[_0x464c('0x1f')];_0x3d4a8e++){if(_0x5d9df2[_0x3d4a8e]['telephone1']===_0x624930){_0x4b0dfc=!![];_0x42b0d0[_0x464c('0x34')]=_0x5d9df2[_0x3d4a8e][_0x464c('0x35')];}}return _0x4b0dfc;})['then'](function(_0x4d47b8){if(_0x4d47b8)return _0x42b0d0;if(_0x553187===_0x464c('0x36')){logger[_0x464c('0x22')]('['+[_0x33725e[_0x464c('0x14')]()]+_0x464c('0x37'));return _0x42b0d0;}return createEndUser(_0x42b0d0,_0x5be101,_0x5a1f7d,_0x2014a7,_0x2204be,_0x33725e)[_0x464c('0x16')](function(_0xb42258){logger[_0x464c('0x22')]('['+[_0x33725e[_0x464c('0x14')]()]+_0x464c('0x38'),_0xb42258[_0x464c('0x34')]);return _0xb42258;});});}function getCustomFields(_0x4ceb23,_0x36ddee,_0x32d4a1){var _0x2e61f5={};if(_0x4ceb23[_0x464c('0x1f')]>0x0){_[_0x464c('0x39')](_0x4ceb23,function(_0x3c5106){if(_[_0x464c('0x3a')](['string','picklist'],_0x3c5106[_0x464c('0x3b')])&&_0x3c5106[_0x464c('0x3c')]&&!_0x3c5106['customField']){var _0xfd13e7=_0x3c5106['idField'][_0x464c('0x30')]();var _0x37a66f=_0xfd13e7[_0x464c('0x2e')](0x0,_0xfd13e7['indexOf']('_'));var _0x599be0=_0xfd13e7[_0x464c('0x2e')](_0xfd13e7[_0x464c('0x3d')]('_')+0x1);if(_0x37a66f===_0x32d4a1){_0x2e61f5[_0x599be0]=_0x3c5106[_0x464c('0x3e')];}}});}return _0x2e61f5;}function getTicket(_0x5ebcfb,_0x5f2cd3,_0x14ffb7,_0x7b3315,_0x54c8c4,_0x13073e,_0x2c647e){return new Promise(function(_0x63b298,_0xcb64ec){var _0x1361bd;return getAuthToken(_0x5f2cd3,_0x14ffb7,_0x2c647e)[_0x464c('0x16')](function(_0x19054e){if(_0x13073e[_0x464c('0x3f')]===_0x464c('0x40')){_0x1361bd={'method':_0x464c('0x41'),'uri':_0x7b3315+_0x464c('0x42'),'body':Object['assign']({},{'title':intUtil[_0x464c('0x43')](_0x13073e[_0x464c('0x44')],_0x54c8c4,'\x20'),'description':intUtil[_0x464c('0x43')](_0x13073e[_0x464c('0x45')],_0x54c8c4,'\x0a'),'customerid_contact@odata.bind':_0x5ebcfb['enduserId']?_0x464c('0x46')+_0x5ebcfb['enduserId']+')':undefined,'ownerid@odata.bind':_0x464c('0x2b')+_0x5ebcfb[_0x464c('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x13073e['Fields'],_0x54c8c4,_0x13073e['ticketType'])),'headers':{'Authorization':_0x464c('0x19')+_0x19054e,'OData-Version':_0x464c('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x13073e['ticketType']===_0x464c('0x47')){var _0x8875ab=_0x5ebcfb[_0x464c('0x34')]?[{'partyid_systemuser@odata.bind':_0x464c('0x2b')+_0x5ebcfb[_0x464c('0x23')]+')','participationtypemask':_0x5ebcfb[_0x464c('0x48')]===_0x464c('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0x464c('0x46')+_0x5ebcfb[_0x464c('0x34')]+')','participationtypemask':_0x5ebcfb[_0x464c('0x48')]===_0x464c('0x49')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x5ebcfb[_0x464c('0x23')]+')','participationtypemask':_0x5ebcfb[_0x464c('0x48')]===_0x464c('0x49')?0x2:0x1}];_0x1361bd={'method':'POST','uri':_0x7b3315+'phonecalls','body':Object[_0x464c('0x4a')]({},{'subject':intUtil[_0x464c('0x43')](_0x13073e['Subjects'],_0x54c8c4,'\x20'),'phonenumber':String(_0x54c8c4[_0x464c('0x2a')]),'description':intUtil[_0x464c('0x43')](_0x13073e[_0x464c('0x45')],_0x54c8c4,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5ebcfb[_0x464c('0x34')]?_0x464c('0x46')+_0x5ebcfb[_0x464c('0x34')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x5ebcfb[_0x464c('0x23')]+')','directioncode':_0x5ebcfb['callDirection']===_0x464c('0x49')?![]:!![],'phonecall_activity_parties':_0x8875ab},getCustomFields(_0x13073e[_0x464c('0x4b')],_0x54c8c4,_0x13073e[_0x464c('0x3f')])),'headers':{'Authorization':_0x464c('0x19')+_0x19054e,'OData-Version':_0x464c('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1361bd);})['then'](function(_0xbc6c2f){var _0x4f6110=_0xbc6c2f['headers'][_0x464c('0x2d')];var _0x4e66c8=_0x4f6110[_0x464c('0x2e')](_0x4f6110[_0x464c('0x2f')]('(')+0x1,_0x4f6110[_0x464c('0x2f')](')'));_0x5ebcfb['ticketId']=_0x4e66c8;_0x63b298(_0x5ebcfb);})[_0x464c('0x26')](function(_0x45cc78){_0xcb64ec(_0x45cc78[_0x464c('0x27')]);});});}function emit(_0x35ff4c,_0x3bb3b0,_0x179936,_0x2daf65){var _0x4d4997={'uri':util[_0x464c('0x4c')](_0x464c('0x4d'),_0x35ff4c,_0x179936,_0x2daf65)};io['to'](util['format'](_0x464c('0x4e'),_0x3bb3b0))[_0x464c('0x4f')](_0x464c('0x50'),_0x4d4997);}exports['cs']=function(_0x10fb14,_0x3115e5,_0x52dd8b,_0x1fde99,_0x114e12,_0x239458,_0x321453,_0x2a1bde){var _0x1d52a5={};_0x239458[_0x464c('0xa')]=_0x239458[_0x464c('0x51')]?intUtil[_0x464c('0x52')](_0x239458['CloudProvider'][_0x464c('0x53')]):intUtil[_0x464c('0x52')](_0x239458['remoteUri']);_0x239458['serverUrl']=intUtil[_0x464c('0x52')](_0x239458[_0x464c('0x54')]);_0x1d52a5[_0x464c('0x48')]=_0x2a1bde==='queue'||_0x2a1bde===_0x464c('0x55')?_0x464c('0x49'):_0x464c('0x28');var _0x426446=_0x239458[_0x464c('0x51')]?util['format'](_0x464c('0x56'),_0x239458['CloudProvider'][_0x464c('0x53')]):util[_0x464c('0x4c')](_0x464c('0x56'),_0x239458['remoteUri']);var _0x25f40d=util[_0x464c('0x4c')](_0x464c('0x57'),_0x239458[_0x464c('0xc')]);var _0x53289f=util[_0x464c('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x239458[_0x464c('0x54')],_0x3115e5[_0x464c('0x58')],md5(_0x3115e5[_0x464c('0x58')]));if(_0x114e12&&_0x114e12['monitor_format']){logger['info'](_0x464c('0x59'),_0x464c('0x5a'));_0x3115e5[_0x464c('0x5b')]=_0x53289f;}else if(_0x321453&&_0x321453[_0x464c('0x5c')]&&_0x321453[_0x464c('0x5c')]!=='none'){logger[_0x464c('0x22')](_0x464c('0x5d'),'Recording\x20is\x20enabled!');_0x3115e5['recordingURL']=_0x53289f;}else{_0x3115e5[_0x464c('0x5b')]='';}return getUser(_0x1d52a5,_0x239458,_0x1fde99,_0x25f40d,_0x426446,_0x2a1bde)[_0x464c('0x16')](function(_0x1cf97d){logger[_0x464c('0x22')]('['+_0x2a1bde[_0x464c('0x14')]()+_0x464c('0x5e'),_0x1cf97d['userId']);logger[_0x464c('0x22')]('['+_0x2a1bde[_0x464c('0x14')]()+_0x464c('0x5f'),_0x1cf97d[_0x464c('0x1e')]);return getEndUser(_0x1cf97d,_0x239458,_0x25f40d,_0x426446,_0x3115e5,_0x2a1bde,_0x52dd8b['moduleCreate']);})[_0x464c('0x16')](function(_0x222e4a){logger[_0x464c('0x22')]('['+_0x2a1bde['toUpperCase']()+_0x464c('0x60'),_0x222e4a[_0x464c('0x34')]);logger[_0x464c('0x22')]('['+_0x2a1bde[_0x464c('0x14')]()+_0x464c('0x61'),_0x3115e5['calleridnum']);return getTicket(_0x222e4a,_0x239458,_0x25f40d,_0x426446,_0x3115e5,_0x52dd8b,_0x2a1bde);})[_0x464c('0x16')](function(_0x230ba3){logger['info'](util['format']('['+_0x2a1bde[_0x464c('0x14')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x52dd8b[_0x464c('0x3f')],_0x230ba3[_0x464c('0x62')]));logger[_0x464c('0x22')](util[_0x464c('0x4c')]('['+_0x2a1bde[_0x464c('0x14')]()+']\x20Call\x20direction:\x20%s',_0x2a1bde));if(_0x2a1bde!==_0x464c('0x55')){logger[_0x464c('0x22')]('['+_0x2a1bde[_0x464c('0x14')]()+']',_0x464c('0x63'));emit(_0x239458['remoteUri'],_0x1fde99[_0x464c('0x64')],_0x52dd8b[_0x464c('0x3f')],_0x230ba3['ticketId']);}})[_0x464c('0x26')](function(_0x49d075){logger[_0x464c('0x13')]('['+_0x2a1bde[_0x464c('0x14')]()+_0x464c('0x65'),_0x49d075[_0x464c('0x27')]);});}; \ 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 738c0b3..f122d5c 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 _0x0e0b=['
','Tags','name','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','forEach','includes','string','picklist','type','nameField','content','idField','push','customField','variableName','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString'];(function(_0x464759,_0x3f6560){var _0x47ef45=function(_0x344ed0){while(--_0x344ed0){_0x464759['push'](_0x464759['shift']());}};_0x47ef45(++_0x3f6560);}(_0x0e0b,0x150));var _0xb0e0=function(_0x32efcb,_0x55523f){_0x32efcb=_0x32efcb-0x0;var _0x1dae88=_0x0e0b[_0x32efcb];return _0x1dae88;};'use strict';var _=require('lodash');var rp=require(_0xb0e0('0x0'));var md5=require(_0xb0e0('0x1'));var util=require(_0xb0e0('0x2'));var Redis=require(_0xb0e0('0x3'));var intUtil=require(_0xb0e0('0x4'));var config=require(_0xb0e0('0x5'));var logger=require(_0xb0e0('0x6'))(_0xb0e0('0x7'));config[_0xb0e0('0x8')]=_[_0xb0e0('0x9')](config[_0xb0e0('0x8')],{'host':_0xb0e0('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb0e0('0x8')]));var headers={'Content-Type':'application/json','Accept':_0xb0e0('0xb')};function emit(_0x93f07e,_0xf0097d,_0x4bc056){io['to'](_0x93f07e)['emit'](_0xf0097d,_0x4bc056);}function getTicket(_0x5e0198,_0x2d04dc,_0x35a19b,_0x34b056,_0x14e7d5){logger[_0xb0e0('0xc')](_0xb0e0('0xd'));var _0x3e49d1=_[_0xb0e0('0xe')]({'responder_id':_0x2d04dc['id'],'requester_id':_0x35a19b['id'],'name':util[_0xb0e0('0xf')](_0xb0e0('0x10'),_0x14e7d5[_0xb0e0('0x11')]),'phone':_0x14e7d5[_0xb0e0('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb0e0('0x13')](_0x34b056['Subjects'],_0x14e7d5,'\x20'),'description':intUtil[_0xb0e0('0x13')](_0x34b056['Descriptions'],_0x14e7d5,_0xb0e0('0x14')),'tags':getTags(_0x34b056[_0xb0e0('0x15')],_0xb0e0('0x16'))},getCustomFields(_0x34b056['Fields'],_0x14e7d5));_0x3e49d1[_0xb0e0('0x17')]=_['mapValues'](_[_0xb0e0('0x18')](_0x3e49d1[_0xb0e0('0x17')],'id'),_0xb0e0('0x19'));return request({'uri':util['format'](_0xb0e0('0x1a'),_0x5e0198[_0xb0e0('0x1b')]),'method':_0xb0e0('0x1c'),'body':_0x3e49d1})[_0xb0e0('0x1d')](function(_0x47efef){logger['info'](_0xb0e0('0x1e'));return _0x47efef;});}function getUser(_0x33641c,_0x410f17){if(intUtil[_0xb0e0('0x1f')](_0x410f17)){return request({'uri':util[_0xb0e0('0xf')](_0xb0e0('0x20'),_0x33641c[_0xb0e0('0x1b')]),'qs':{'email':_0x410f17}})[_0xb0e0('0x1d')](function(_0x46747b){if(_0x46747b[_0xb0e0('0x21')]){logger[_0xb0e0('0xc')](_0xb0e0('0x22'));return _['find'](_0x46747b,function(_0x3af736){return _0x3af736[_0xb0e0('0x23')][_0xb0e0('0x24')]===_0x410f17;});}else{logger[_0xb0e0('0xc')](_0xb0e0('0x25'));return request({'uri':util[_0xb0e0('0xf')](_0xb0e0('0x26'),_0x33641c['remoteUri'])})[_0xb0e0('0x1d')](function(_0xf37743){logger['info'](_0xb0e0('0x27'));return _0xf37743;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb0e0('0xf')](_0xb0e0('0x26'),_0x33641c[_0xb0e0('0x1b')])})[_0xb0e0('0x1d')](function(_0xdb871c){logger[_0xb0e0('0xc')](_0xb0e0('0x27'));return _0xdb871c;});}}function getEndUser(_0x268dcb,_0x326c8e,_0x37de7f){logger['info'](_0xb0e0('0x28'),_0x37de7f);return request({'uri':util[_0xb0e0('0xf')](_0xb0e0('0x29'),_0x268dcb[_0xb0e0('0x1b')]),'qs':{'phone':_0x37de7f}})['then'](function(_0x13f332){if(_0x13f332[_0xb0e0('0x21')]){logger[_0xb0e0('0xc')](_0xb0e0('0x2a'));return _['find'](_0x13f332,{'phone':_0x37de7f});}else{logger[_0xb0e0('0xc')](_0xb0e0('0x2b'));return request({'uri':util['format'](_0xb0e0('0x29'),_0x268dcb[_0xb0e0('0x1b')]),'method':_0xb0e0('0x1c'),'body':{'name':_0x326c8e,'phone':_0x37de7f}})[_0xb0e0('0x1d')](function(_0x4f8d3f){logger[_0xb0e0('0xc')](_0xb0e0('0x2c'));return _0x4f8d3f;});}});}function getAuth(_0x78a93c){return util['format'](_0xb0e0('0x2d'),new Buffer(_0x78a93c[_0xb0e0('0x2e')]+':X')[_0xb0e0('0x2f')](_0xb0e0('0x30')));}function request(_0x3c50ec){logger[_0xb0e0('0x31')]('[HTTP]',JSON['stringify'](_0x3c50ec));return rp(_[_0xb0e0('0x9')](_0x3c50ec,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x18007b,_0x52ed46){var _0x5e4810=[];if(_0x18007b&&_0x18007b[_0xb0e0('0x21')]>0x0){_0x5e4810=_['map'](_0x18007b,_0x52ed46);}return _0x5e4810;}function getCustomFields(_0x116549,_0x5ded87){var _0x15efb0=[];var _0x65a78={'custom_fields':[]};if(_0x116549['length']>0x0){_[_0xb0e0('0x32')](_0x116549,function(_0x23c6be){if(_[_0xb0e0('0x33')]([_0xb0e0('0x34'),_0xb0e0('0x35')],_0x23c6be[_0xb0e0('0x36')])&&_0x23c6be[_0xb0e0('0x37')]&&!_0x23c6be['customField']){_0x65a78[_0x23c6be[_0xb0e0('0x37')]['toLowerCase']()]=_0x23c6be[_0xb0e0('0x38')][_0xb0e0('0x2f')]();}else if(_[_0xb0e0('0x33')]([_0xb0e0('0x34'),_0xb0e0('0x35')],_0x23c6be[_0xb0e0('0x36')])&&_0x23c6be[_0xb0e0('0x39')]&&_0x23c6be['customField']){_0x65a78[_0xb0e0('0x17')][_0xb0e0('0x3a')]({'id':_0x23c6be['idField'],'value':_0x23c6be[_0xb0e0('0x38')][_0xb0e0('0x2f')]()});}else if(_0x23c6be[_0xb0e0('0x36')]==='variable'&&_0x23c6be['variableName']&&_0x23c6be[_0xb0e0('0x39')]&&_0x23c6be[_0xb0e0('0x3b')]){_0x5ded87[_0x23c6be['variableName']]&&_0x65a78[_0xb0e0('0x17')]['push']({'id':_0x23c6be[_0xb0e0('0x39')],'value':_0x5ded87[_0x23c6be[_0xb0e0('0x3c')]][_0xb0e0('0x2f')]()});}else if(_0x23c6be[_0xb0e0('0x36')]===_0xb0e0('0x3d')&&_0x23c6be[_0xb0e0('0x3e')]&&_0x23c6be[_0xb0e0('0x3e')]['name']&&_0x23c6be['idField']&&_0x23c6be['customField']){_0x5ded87[_0x23c6be[_0xb0e0('0x3e')]['name'][_0xb0e0('0x3f')]()]&&_0x65a78['custom_fields']['push']({'id':_0x23c6be[_0xb0e0('0x39')],'value':_0x5ded87[_0x23c6be['Variable']['name'][_0xb0e0('0x3f')]()]['toString']()});}});}return _0x65a78;}exports['queue']=function(_0x559cfd,_0x37352c,_0x16fd9a,_0x4ac234,_0x18d4c0,_0x26d360){var _0x4e3e3b,_0x3d2946;_0x26d360[_0xb0e0('0x1b')]=intUtil[_0xb0e0('0x40')](_0x26d360[_0xb0e0('0x1b')]);_0x26d360[_0xb0e0('0x41')]=intUtil[_0xb0e0('0x40')](_0x26d360[_0xb0e0('0x41')]);if(_0x18d4c0&&_0x18d4c0[_0xb0e0('0x42')]){logger[_0xb0e0('0xc')](_0xb0e0('0x43'),_0xb0e0('0x44'));_0x37352c[_0xb0e0('0x45')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x26d360[_0xb0e0('0x41')],_0x37352c[_0xb0e0('0x46')],md5(_0x37352c[_0xb0e0('0x46')]));}else{_0x37352c[_0xb0e0('0x45')]='';}headers[_0xb0e0('0x47')]=getAuth(_0x26d360);return getUser(_0x26d360,_0x4ac234[_0xb0e0('0x24')])[_0xb0e0('0x1d')](function(_0x57a097){_0x4e3e3b=_0x57a097;logger[_0xb0e0('0xc')]('The\x20User\x20ID\x20is:',_0x4e3e3b['id']);return getEndUser(_0x26d360,_0x37352c[_0xb0e0('0x11')],_0x37352c[_0xb0e0('0x12')]);})['then'](function(_0x2fd388){_0x3d2946=_0x2fd388;logger[_0xb0e0('0xc')](_0xb0e0('0x48'),_0x3d2946['id']);return getTicket(_0x26d360,_0x4e3e3b,_0x3d2946,_0x16fd9a,_0x37352c);})[_0xb0e0('0x1d')](function(_0x566c4a){if(_0x566c4a&&_0x566c4a['id']){logger[_0xb0e0('0xc')](_0xb0e0('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x566c4a['id']);logger['info'](_0xb0e0('0x43'),_0xb0e0('0x49'));emit(util[_0xb0e0('0xf')]('user:%s',_0x4ac234['name']),_0xb0e0('0x4a'),{'uri':util[_0xb0e0('0xf')](_0xb0e0('0x4b'),_0x26d360[_0xb0e0('0x1b')],_0x566c4a['id'])});}})[_0xb0e0('0x4c')](function(_0x315f35){logger[_0xb0e0('0x4d')](_0xb0e0('0x43'),JSON[_0xb0e0('0x4e')](_0x315f35));});};exports[_0xb0e0('0x4f')]=function(_0x9cf5f1,_0x1ebacc,_0x44eebf,_0x36745e,_0x2afed1,_0x2112a4,_0x2fb4ca){var _0x56a50d,_0x2714ab;_0x2112a4['remoteUri']=intUtil['stripTrailingSlash'](_0x2112a4[_0xb0e0('0x1b')]);_0x2112a4['serverUrl']=intUtil[_0xb0e0('0x40')](_0x2112a4[_0xb0e0('0x41')]);if(_0x2fb4ca&&_0x2fb4ca[_0xb0e0('0x50')]&&_0x2fb4ca[_0xb0e0('0x50')]!=='none'){logger['info'](_0xb0e0('0x51'),_0xb0e0('0x44'));_0x1ebacc[_0xb0e0('0x45')]=util[_0xb0e0('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2112a4[_0xb0e0('0x41')],_0x1ebacc[_0xb0e0('0x46')],md5(_0x1ebacc['uniqueid']));}headers[_0xb0e0('0x47')]=getAuth(_0x2112a4);return getUser(_0x2112a4,_0x36745e[_0xb0e0('0x24')])[_0xb0e0('0x1d')](function(_0x2086d9){_0x56a50d=_0x2086d9;logger['info'](_0xb0e0('0x52'),_0x56a50d['id']);return getEndUser(_0x2112a4,_0x1ebacc[_0xb0e0('0x53')],_0x1ebacc['destcalleridnum']);})[_0xb0e0('0x1d')](function(_0x32f0cb){_0x2714ab=_0x32f0cb;logger[_0xb0e0('0xc')](_0xb0e0('0x48'),_0x2714ab['id']);return getTicket(_0x2112a4,_0x56a50d,_0x2714ab,_0x44eebf,_0x1ebacc);})[_0xb0e0('0x1d')](function(_0x463f37){if(_0x463f37&&_0x463f37['id']){logger['info'](_0xb0e0('0x1e'));logger[_0xb0e0('0xc')](_0xb0e0('0x54'),_0x463f37['id']);logger[_0xb0e0('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb0e0('0xf')](_0xb0e0('0x55'),_0x36745e[_0xb0e0('0x16')]),'trigger:browser:url',{'uri':util[_0xb0e0('0xf')](_0xb0e0('0x4b'),_0x2112a4[_0xb0e0('0x1b')],_0x463f37['id'])});}})[_0xb0e0('0x4c')](function(_0x2293a5){logger[_0xb0e0('0x4d')](_0xb0e0('0x51'),JSON[_0xb0e0('0x4e')](_0x2293a5));});};exports[_0xb0e0('0x56')]=function(_0x5daf74,_0x4084bd,_0x5708f0,_0x333535,_0x14671d,_0x2f1f14){var _0x161ac5,_0x1e73a8;_0x2f1f14['remoteUri']=intUtil[_0xb0e0('0x40')](_0x2f1f14[_0xb0e0('0x1b')]);_0x2f1f14[_0xb0e0('0x41')]=intUtil[_0xb0e0('0x40')](_0x2f1f14[_0xb0e0('0x41')]);if(_0x14671d&&_0x14671d[_0xb0e0('0x42')]){logger[_0xb0e0('0xc')]('['+_0x4084bd[_0xb0e0('0x57')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x4084bd[_0xb0e0('0x45')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f1f14[_0xb0e0('0x41')],_0x4084bd['uniqueid'],md5(_0x4084bd[_0xb0e0('0x46')]));}else{_0x4084bd['recordingURL']='';}headers[_0xb0e0('0x47')]=getAuth(_0x2f1f14);return getUser(_0x2f1f14,'')[_0xb0e0('0x1d')](function(_0x20f31c){_0x161ac5=_0x20f31c;logger['info'](_0xb0e0('0x52'),_0x161ac5['id']);return getEndUser(_0x2f1f14,_0x4084bd[_0xb0e0('0x11')],_0x4084bd[_0xb0e0('0x12')]);})[_0xb0e0('0x1d')](function(_0x320218){_0x1e73a8=_0x320218;logger[_0xb0e0('0xc')]('The\x20Enduser\x20ID\x20is:',_0x1e73a8['id']);return getTicket(_0x2f1f14,_0x161ac5,_0x1e73a8,_0x5708f0,_0x4084bd);})[_0xb0e0('0x1d')](function(_0x1be9e5){if(_0x1be9e5){logger[_0xb0e0('0xc')](_0xb0e0('0x1e'));logger[_0xb0e0('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1be9e5['id']);}})[_0xb0e0('0x4c')](function(_0x350b50){logger['error']('['+_0x4084bd[_0xb0e0('0x57')][_0xb0e0('0x58')]()+']',JSON[_0xb0e0('0x4e')](_0x350b50));});}; \ No newline at end of file +var _0xc0cf=['toLowerCase','queue','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','stripTrailingSlash','recordingFormat','none','destcalleridname','[OUTBOUND]','catch','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','
','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','Agent\x20found!','find','contact','email','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','forEach','includes','picklist','type','content','string','idField','customField','push','variable','customVariable','Variable'];(function(_0x1df4bb,_0xa16438){var _0x30273a=function(_0xbfd1e4){while(--_0xbfd1e4){_0x1df4bb['push'](_0x1df4bb['shift']());}};_0x30273a(++_0xa16438);}(_0xc0cf,0xcd));var _0xfc0c=function(_0x25064f,_0x9e9a6){_0x25064f=_0x25064f-0x0;var _0x22c2d2=_0xc0cf[_0x25064f];return _0x22c2d2;};'use strict';var _=require('lodash');var rp=require(_0xfc0c('0x0'));var md5=require(_0xfc0c('0x1'));var util=require('util');var Redis=require(_0xfc0c('0x2'));var intUtil=require(_0xfc0c('0x3'));var config=require(_0xfc0c('0x4'));var logger=require(_0xfc0c('0x5'))(_0xfc0c('0x6'));config[_0xfc0c('0x7')]=_[_0xfc0c('0x8')](config['redis'],{'host':_0xfc0c('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0xfc0c('0xa')};function emit(_0x420b5f,_0x56bb65,_0x2c2d1a){io['to'](_0x420b5f)[_0xfc0c('0xb')](_0x56bb65,_0x2c2d1a);}function getTicket(_0xfc02cb,_0x1e0624,_0x1238e3,_0x544d1a,_0x9c8500){logger[_0xfc0c('0xc')](_0xfc0c('0xd'));var _0x1b5be2=_['merge']({'responder_id':_0x1e0624['id'],'requester_id':_0x1238e3['id'],'name':util[_0xfc0c('0xe')](_0xfc0c('0xf'),_0x9c8500[_0xfc0c('0x10')]),'phone':_0x9c8500['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x544d1a['Subjects'],_0x9c8500,'\x20'),'description':intUtil[_0xfc0c('0x11')](_0x544d1a['Descriptions'],_0x9c8500,_0xfc0c('0x12')),'tags':getTags(_0x544d1a['Tags'],_0xfc0c('0x13'))},getCustomFields(_0x544d1a[_0xfc0c('0x14')],_0x9c8500));_0x1b5be2['custom_fields']=_[_0xfc0c('0x15')](_[_0xfc0c('0x16')](_0x1b5be2[_0xfc0c('0x17')],'id'),_0xfc0c('0x18'));return request({'uri':util[_0xfc0c('0xe')](_0xfc0c('0x19'),_0xfc02cb[_0xfc0c('0x1a')]),'method':_0xfc0c('0x1b'),'body':_0x1b5be2})[_0xfc0c('0x1c')](function(_0x32ff13){logger[_0xfc0c('0xc')](_0xfc0c('0x1d'));return _0x32ff13;});}function getUser(_0x6fb315,_0x152d69){if(intUtil['validateEmail'](_0x152d69)){return request({'uri':util[_0xfc0c('0xe')](_0xfc0c('0x1e'),_0x6fb315[_0xfc0c('0x1a')]),'qs':{'email':_0x152d69}})[_0xfc0c('0x1c')](function(_0x53c71b){if(_0x53c71b['length']){logger[_0xfc0c('0xc')](_0xfc0c('0x1f'));return _[_0xfc0c('0x20')](_0x53c71b,function(_0x215f80){return _0x215f80[_0xfc0c('0x21')][_0xfc0c('0x22')]===_0x152d69;});}else{logger[_0xfc0c('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/api/v2/agents/me',_0x6fb315[_0xfc0c('0x1a')])})['then'](function(_0x2f29b3){logger['info'](_0xfc0c('0x23'));return _0x2f29b3;});}});}else{logger[_0xfc0c('0xc')](_0xfc0c('0x24'));return request({'uri':util[_0xfc0c('0xe')](_0xfc0c('0x25'),_0x6fb315[_0xfc0c('0x1a')])})['then'](function(_0x12e206){logger['info'](_0xfc0c('0x23'));return _0x12e206;});}}function getEndUser(_0x1d34c6,_0x5a9c8d,_0x52852d){logger['info'](_0xfc0c('0x26'),_0x52852d);return request({'uri':util[_0xfc0c('0xe')](_0xfc0c('0x27'),_0x1d34c6['remoteUri']),'qs':{'phone':_0x52852d}})[_0xfc0c('0x1c')](function(_0xbb1d85){if(_0xbb1d85[_0xfc0c('0x28')]){logger['info'](_0xfc0c('0x29'));return _[_0xfc0c('0x20')](_0xbb1d85,{'phone':_0x52852d});}else{logger[_0xfc0c('0xc')](_0xfc0c('0x2a'));return request({'uri':util['format'](_0xfc0c('0x27'),_0x1d34c6[_0xfc0c('0x1a')]),'method':_0xfc0c('0x1b'),'body':{'name':_0x5a9c8d,'phone':_0x52852d}})['then'](function(_0x16e097){logger[_0xfc0c('0xc')](_0xfc0c('0x2b'));return _0x16e097;});}});}function getAuth(_0xea0659){return util[_0xfc0c('0xe')](_0xfc0c('0x2c'),new Buffer(_0xea0659[_0xfc0c('0x2d')]+':X')[_0xfc0c('0x2e')](_0xfc0c('0x2f')));}function request(_0x3dc029){logger['debug'](_0xfc0c('0x30'),JSON[_0xfc0c('0x31')](_0x3dc029));return rp(_[_0xfc0c('0x8')](_0x3dc029,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xc86322,_0x1f157c){var _0x22f285=[];if(_0xc86322&&_0xc86322['length']>0x0){_0x22f285=_['map'](_0xc86322,_0x1f157c);}return _0x22f285;}function getCustomFields(_0x3317b2,_0x1ed190){var _0x27972d=[];var _0x14dd85={'custom_fields':[]};if(_0x3317b2[_0xfc0c('0x28')]>0x0){_[_0xfc0c('0x32')](_0x3317b2,function(_0x253594){if(_[_0xfc0c('0x33')](['string',_0xfc0c('0x34')],_0x253594[_0xfc0c('0x35')])&&_0x253594['nameField']&&!_0x253594['customField']){_0x14dd85[_0x253594['nameField']['toLowerCase']()]=_0x253594[_0xfc0c('0x36')][_0xfc0c('0x2e')]();}else if(_[_0xfc0c('0x33')]([_0xfc0c('0x37'),_0xfc0c('0x34')],_0x253594[_0xfc0c('0x35')])&&_0x253594[_0xfc0c('0x38')]&&_0x253594[_0xfc0c('0x39')]){_0x14dd85['custom_fields'][_0xfc0c('0x3a')]({'id':_0x253594[_0xfc0c('0x38')],'value':_0x253594[_0xfc0c('0x36')][_0xfc0c('0x2e')]()});}else if(_0x253594[_0xfc0c('0x35')]===_0xfc0c('0x3b')&&_0x253594['variableName']&&_0x253594[_0xfc0c('0x38')]&&_0x253594[_0xfc0c('0x39')]){_0x1ed190[_0x253594['variableName']]&&_0x14dd85[_0xfc0c('0x17')]['push']({'id':_0x253594[_0xfc0c('0x38')],'value':_0x1ed190[_0x253594['variableName']][_0xfc0c('0x2e')]()});}else if(_0x253594[_0xfc0c('0x35')]===_0xfc0c('0x3c')&&_0x253594[_0xfc0c('0x3d')]&&_0x253594[_0xfc0c('0x3d')][_0xfc0c('0x13')]&&_0x253594[_0xfc0c('0x38')]&&_0x253594['customField']){_0x1ed190[_0x253594[_0xfc0c('0x3d')]['name'][_0xfc0c('0x3e')]()]&&_0x14dd85['custom_fields'][_0xfc0c('0x3a')]({'id':_0x253594[_0xfc0c('0x38')],'value':_0x1ed190[_0x253594[_0xfc0c('0x3d')]['name'][_0xfc0c('0x3e')]()][_0xfc0c('0x2e')]()});}});}return _0x14dd85;}exports[_0xfc0c('0x3f')]=function(_0x421473,_0x2b998d,_0x154b97,_0x4efd4c,_0x5cd1fc,_0x4cf5b5){var _0x2c4adb,_0x2064ba;_0x4cf5b5[_0xfc0c('0x1a')]=intUtil['stripTrailingSlash'](_0x4cf5b5[_0xfc0c('0x1a')]);_0x4cf5b5[_0xfc0c('0x40')]=intUtil['stripTrailingSlash'](_0x4cf5b5['serverUrl']);if(_0x5cd1fc&&_0x5cd1fc[_0xfc0c('0x41')]){logger[_0xfc0c('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x2b998d[_0xfc0c('0x42')]=util['format'](_0xfc0c('0x43'),_0x4cf5b5[_0xfc0c('0x40')],_0x2b998d['uniqueid'],md5(_0x2b998d[_0xfc0c('0x44')]));}else{_0x2b998d['recordingURL']='';}headers[_0xfc0c('0x45')]=getAuth(_0x4cf5b5);return getUser(_0x4cf5b5,_0x4efd4c[_0xfc0c('0x22')])[_0xfc0c('0x1c')](function(_0xbc86da){_0x2c4adb=_0xbc86da;logger[_0xfc0c('0xc')](_0xfc0c('0x46'),_0x2c4adb['id']);return getEndUser(_0x4cf5b5,_0x2b998d[_0xfc0c('0x10')],_0x2b998d[_0xfc0c('0x47')]);})[_0xfc0c('0x1c')](function(_0x427bb4){_0x2064ba=_0x427bb4;logger[_0xfc0c('0xc')](_0xfc0c('0x48'),_0x2064ba['id']);return getTicket(_0x4cf5b5,_0x2c4adb,_0x2064ba,_0x154b97,_0x2b998d);})[_0xfc0c('0x1c')](function(_0x2c8a1b){if(_0x2c8a1b&&_0x2c8a1b['id']){logger[_0xfc0c('0xc')](_0xfc0c('0x1d'));logger[_0xfc0c('0xc')](_0xfc0c('0x49'),_0x2c8a1b['id']);logger[_0xfc0c('0xc')](_0xfc0c('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfc0c('0xe')](_0xfc0c('0x4b'),_0x4efd4c['name']),_0xfc0c('0x4c'),{'uri':util[_0xfc0c('0xe')](_0xfc0c('0x4d'),_0x4cf5b5[_0xfc0c('0x1a')],_0x2c8a1b['id'])});}})['catch'](function(_0x18307c){logger[_0xfc0c('0x4e')](_0xfc0c('0x4a'),JSON[_0xfc0c('0x31')](_0x18307c));});};exports['outbound']=function(_0x521f4c,_0x4dd23c,_0x26d78a,_0x52ac31,_0x74408a,_0x4e13aa,_0x11181c){var _0x209144,_0x484f3f;_0x4e13aa[_0xfc0c('0x1a')]=intUtil[_0xfc0c('0x4f')](_0x4e13aa[_0xfc0c('0x1a')]);_0x4e13aa[_0xfc0c('0x40')]=intUtil[_0xfc0c('0x4f')](_0x4e13aa['serverUrl']);if(_0x11181c&&_0x11181c[_0xfc0c('0x50')]&&_0x11181c[_0xfc0c('0x50')]!==_0xfc0c('0x51')){logger[_0xfc0c('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4dd23c[_0xfc0c('0x42')]=util['format'](_0xfc0c('0x43'),_0x4e13aa[_0xfc0c('0x40')],_0x4dd23c[_0xfc0c('0x44')],md5(_0x4dd23c[_0xfc0c('0x44')]));}headers[_0xfc0c('0x45')]=getAuth(_0x4e13aa);return getUser(_0x4e13aa,_0x52ac31[_0xfc0c('0x22')])[_0xfc0c('0x1c')](function(_0x54b8bc){_0x209144=_0x54b8bc;logger[_0xfc0c('0xc')](_0xfc0c('0x46'),_0x209144['id']);return getEndUser(_0x4e13aa,_0x4dd23c[_0xfc0c('0x52')],_0x4dd23c['destcalleridnum']);})[_0xfc0c('0x1c')](function(_0x5a3115){_0x484f3f=_0x5a3115;logger[_0xfc0c('0xc')](_0xfc0c('0x48'),_0x484f3f['id']);return getTicket(_0x4e13aa,_0x209144,_0x484f3f,_0x26d78a,_0x4dd23c);})[_0xfc0c('0x1c')](function(_0x2a6c30){if(_0x2a6c30&&_0x2a6c30['id']){logger[_0xfc0c('0xc')]('Ticket\x20created!');logger[_0xfc0c('0xc')]('The\x20Ticket\x20ID\x20is:',_0x2a6c30['id']);logger[_0xfc0c('0xc')](_0xfc0c('0x53'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfc0c('0xe')](_0xfc0c('0x4b'),_0x52ac31[_0xfc0c('0x13')]),_0xfc0c('0x4c'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x4e13aa['remoteUri'],_0x2a6c30['id'])});}})[_0xfc0c('0x54')](function(_0x393777){logger[_0xfc0c('0x4e')](_0xfc0c('0x53'),JSON[_0xfc0c('0x31')](_0x393777));});};exports[_0xfc0c('0x55')]=function(_0x2e1e1b,_0x5f2621,_0x33b859,_0x305a7a,_0x2e4433,_0x1dd76b){var _0x26ae7b,_0x22158f;_0x1dd76b[_0xfc0c('0x1a')]=intUtil[_0xfc0c('0x4f')](_0x1dd76b['remoteUri']);_0x1dd76b[_0xfc0c('0x40')]=intUtil[_0xfc0c('0x4f')](_0x1dd76b[_0xfc0c('0x40')]);if(_0x2e4433&&_0x2e4433[_0xfc0c('0x41')]){logger[_0xfc0c('0xc')]('['+_0x5f2621[_0xfc0c('0x56')][_0xfc0c('0x57')]()+']',_0xfc0c('0x58'));_0x5f2621[_0xfc0c('0x42')]=util['format'](_0xfc0c('0x43'),_0x1dd76b[_0xfc0c('0x40')],_0x5f2621[_0xfc0c('0x44')],md5(_0x5f2621[_0xfc0c('0x44')]));}else{_0x5f2621[_0xfc0c('0x42')]='';}headers[_0xfc0c('0x45')]=getAuth(_0x1dd76b);return getUser(_0x1dd76b,'')['then'](function(_0x525ec7){_0x26ae7b=_0x525ec7;logger['info'](_0xfc0c('0x46'),_0x26ae7b['id']);return getEndUser(_0x1dd76b,_0x5f2621['calleridname'],_0x5f2621[_0xfc0c('0x47')]);})['then'](function(_0x3e315e){_0x22158f=_0x3e315e;logger[_0xfc0c('0xc')](_0xfc0c('0x48'),_0x22158f['id']);return getTicket(_0x1dd76b,_0x26ae7b,_0x22158f,_0x33b859,_0x5f2621);})['then'](function(_0xa3344f){if(_0xa3344f){logger[_0xfc0c('0xc')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0xa3344f['id']);}})[_0xfc0c('0x54')](function(_0x5a1184){logger[_0xfc0c('0x4e')]('['+_0x5f2621[_0xfc0c('0x56')][_0xfc0c('0x57')]()+']',JSON[_0xfc0c('0x31')](_0x5a1184));});}; \ 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 504470b..21f2faf 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 _0x79ca=['./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','length','User\x20found:','Admin\x20selected','userEmail','userId','error','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','getString','Subjects','Descriptions','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','bluebird','ioredis'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x79ca,0x1a8));var _0xa79c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x79ca[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa79c('0x0'));var rp=require(_0xa79c('0x1'));var md5=require('md5');var util=require(_0xa79c('0x2'));var moment=require(_0xa79c('0x3'));var Promise=require(_0xa79c('0x4'));var Redis=require(_0xa79c('0x5'));var intUtil=require(_0xa79c('0x6'));var config=require('../../../../config/environment');var logger=require(_0xa79c('0x7'))(_0xa79c('0x8'));config[_0xa79c('0x9')]=_[_0xa79c('0xa')](config['redis'],{'host':_0xa79c('0xb'),'port':0x18eb});var io=require(_0xa79c('0xc'))(new Redis(config[_0xa79c('0x9')]));function getAdminId(_0x5021fb,_0x82b201,_0x2ba1cd,_0x1adc5e){return new Promise(function(_0x508c64,_0xc1262b){var _0x554be4=![];var _0x58cfa9={'method':_0xa79c('0xd'),'uri':_0x1adc5e+'/api/selector/owners','json':!![]};_0x58cfa9['headers']=_0x2ba1cd;logger[_0xa79c('0xe')](_0xa79c('0xf'));return rp(_0x58cfa9)[_0xa79c('0x10')](function(_0x7115fc){if(_0x7115fc){var _0x149852=_0x7115fc[_0xa79c('0x11')];var _0x44f818=null;for(_0x44f818=0x0;_0x44f818<_0x149852['length'];_0x44f818++){if(_0x149852[_0x44f818][_0xa79c('0x12')]===_0x5021fb[_0xa79c('0x13')]){_0x5021fb[_0xa79c('0x14')]=_0x149852[_0x44f818]['id'];_0x554be4=!![];}}if(_0x554be4){logger[_0xa79c('0xe')](_0xa79c('0x15'),_0x5021fb['adminId']);_0x508c64(_0x5021fb);}else{_0xc1262b({'statusCode':0x194,'message':_0xa79c('0x16')});}}else{_0xc1262b({'statusCode':0x194,'message':_0xa79c('0x16')});}})[_0xa79c('0x17')](function(_0x178635){logger['error']('['+[_0x82b201[_0xa79c('0x18')]()]+']',_0x178635[_0xa79c('0x19')]);_0xc1262b(_0x178635);});});}function getUser(_0x5c40ae,_0x5671d9,_0x454ec8){return function(_0x2fbeeb){return new Promise(function(_0x577d4c,_0x556e2c){var _0x10f120={'method':'GET','uri':_0x454ec8+'/api/selector/owners','json':!![]};_0x10f120[_0xa79c('0x1a')]=_0x5671d9;logger[_0xa79c('0xe')](_0xa79c('0x1b'));return rp(_0x10f120)[_0xa79c('0x10')](function(_0x1463c5){if(_0x1463c5){var _0x153de7=_0x1463c5[_0xa79c('0x11')];var _0x3d1fff=![];var _0x59edff=null;if(_0x2fbeeb[_0xa79c('0x1c')]!==null){logger['info'](_0xa79c('0x1d'),_0x2fbeeb[_0xa79c('0x1c')]);_0x2fbeeb['userEmail']=_0x2fbeeb[_0xa79c('0x1c')];for(_0x59edff=0x0;_0x59edff<_0x153de7[_0xa79c('0x1e')];_0x59edff++){if(_0x153de7[_0x59edff]['email']===_0x2fbeeb[_0xa79c('0x1c')]){_0x3d1fff=!![];_0x2fbeeb['userId']=_0x153de7[_0x59edff]['id'];logger[_0xa79c('0xe')](_0xa79c('0x1f'),_0x2fbeeb['userId']);}}}if(!_0x3d1fff){logger[_0xa79c('0xe')](_0xa79c('0x20'));_0x2fbeeb[_0xa79c('0x21')]=_0x2fbeeb[_0xa79c('0x13')];_0x2fbeeb[_0xa79c('0x22')]=_0x2fbeeb[_0xa79c('0x14')];_0x3d1fff=!![];}if(_0x3d1fff){_0x577d4c(_0x2fbeeb);}else{_0x556e2c({'statusCode':0x194,'message':_0xa79c('0x16')});}}else{_0x556e2c({'statusCode':0x194,'message':_0xa79c('0x16')});}})['catch'](function(_0x149464){logger[_0xa79c('0x23')]('['+[_0x5c40ae[_0xa79c('0x18')]()]+']',_0x149464[_0xa79c('0x19')]);_0x556e2c(_0x149464);});});};}function searchContact(_0x42f6d8,_0x4fa06e,_0xe711bb,_0x5d5499){return new Promise(function(_0x467380,_0xd2bf72){var _0x2ee268={'method':_0xa79c('0xd'),'headers':_0x4fa06e,'uri':_0x42f6d8+_0xa79c('0x24')+_0x5d5499+_0xa79c('0x25')+_0xe711bb+_0xa79c('0x26'),'json':!![]};rp(_0x2ee268)['then'](function(_0x3a1d0c){var _0x2a20b9=_['find'](_0x3a1d0c['contacts'][_0xa79c('0x27')],[_0xe711bb,_0x5d5499]);_0x467380(_0x2a20b9);})[_0xa79c('0x17')](function(_0x4c7f22){_0xd2bf72(_0x4c7f22);});});}function getEndUser(_0x2a1e83,_0x288007,_0x2627fc){return function(_0x42ff64){return new Promise(function(_0x149008,_0x44e1d7){logger[_0xa79c('0xe')](util[_0xa79c('0x28')](_0xa79c('0x29'),_0x42ff64[_0xa79c('0x2a')]));searchContact(_0x2627fc,_0x288007,_0xa79c('0x2b'),_0x42ff64['contactNumber'])[_0xa79c('0x10')](function(_0x533ea0){if(_0x533ea0){_0x42ff64[_0xa79c('0x2c')]=_0x533ea0['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x42ff64[_0xa79c('0x2c')]);return _0x149008(_0x42ff64);}searchContact(_0x2627fc,_0x288007,_0xa79c('0x2d'),_0x42ff64['contactNumber'])[_0xa79c('0x10')](function(_0x4ac76a){if(_0x4ac76a){_0x42ff64[_0xa79c('0x2c')]=_0x4ac76a['id'];logger[_0xa79c('0xe')]('Contact\x20found\x20work_number:',_0x42ff64[_0xa79c('0x2c')]);return _0x149008(_0x42ff64);}createEndUser(_0x42ff64,_0x2a1e83,_0x288007,_0x2627fc)[_0xa79c('0x10')](function(_0x927e8){logger[_0xa79c('0xe')](_0xa79c('0x2e'),_0x927e8['endUserId']);return _0x149008(_0x927e8);});});})[_0xa79c('0x17')](function(_0x414ef1){_0x44e1d7(_0x414ef1);});});};}function createEndUser(_0x5f1cc1,_0xafd410,_0x4469d6,_0x3ac5fd){return new Promise(function(_0x1da581,_0x5c4d75){var _0x919792=moment();var _0x279373={'method':_0xa79c('0x2f'),'uri':_0x3ac5fd+_0xa79c('0x30'),'body':{'contact':{'last_name':_0x5f1cc1[_0xa79c('0x2a')],'work_number':_0x5f1cc1[_0xa79c('0x2a')],'mobile_number':_0x5f1cc1[_0xa79c('0x2a')],'owner_id':_0x5f1cc1[_0xa79c('0x22')],'created_at':_0x919792[_0xa79c('0x28')](_0xa79c('0x31'))}},'json':!![]};_0x279373[_0xa79c('0x1a')]=_0x4469d6;logger['info'](_0xa79c('0x32'));return rp(_0x279373)[_0xa79c('0x10')](function(_0x3eaa5c){_0x5f1cc1[_0xa79c('0x2c')]=_0x3eaa5c['contact']['id'];_0x1da581(_0x5f1cc1);})['catch'](function(_0x3d022b){logger[_0xa79c('0x23')]('['+[_0xafd410[_0xa79c('0x18')]()]+']',_0x3d022b[_0xa79c('0x19')]);_0x5c4d75(_0x3d022b[_0xa79c('0x19')]);});});}function getTicket(_0x96f7c4,_0x424274,_0x4b4706,_0x5398de,_0x53bebd){return function(_0x517bd8){logger[_0xa79c('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x3e8cc4,_0x57e157){var _0x50a141=moment();var _0x13a61b={'method':_0xa79c('0x2f'),'uri':_0x4b4706+_0xa79c('0x33'),'body':{'title':intUtil[_0xa79c('0x34')](_0x5398de[_0xa79c('0x35')],_0x53bebd,'\x20'),'description':intUtil[_0xa79c('0x34')](_0x5398de[_0xa79c('0x36')],_0x53bebd,'\x0a'),'owner_id':_0x517bd8[_0xa79c('0x22')],'creater_id':_0x517bd8[_0xa79c('0x14')],'targetable_id':_0x517bd8[_0xa79c('0x2c')],'targetable_type':'Contact','created_at':_0x50a141[_0xa79c('0x28')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x50a141[_0xa79c('0x37')](0x1e,'m')['format'](_0xa79c('0x31'))},'json':!![]};_0x13a61b[_0xa79c('0x1a')]=_0x424274;return rp(_0x13a61b)[_0xa79c('0x10')](function(_0x326220){_0x517bd8[_0xa79c('0x38')]=_0x326220['task']['id'];logger[_0xa79c('0xe')](_0xa79c('0x39'),_0x517bd8['ticketId']);_0x3e8cc4(_0x517bd8);})['catch'](function(_0x3b791a){logger[_0xa79c('0x23')]('['+[_0x96f7c4[_0xa79c('0x18')]()]+']',_0x3b791a[_0xa79c('0x19')]);_0x57e157(_0x3b791a[_0xa79c('0x19')]);});});};}function emit(_0x3f6c3e,_0x3679ce,_0x127430){var _0x2ab195={'uri':_0x3f6c3e+_0xa79c('0x3a')+_0x127430};io['to'](util[_0xa79c('0x28')](_0xa79c('0x3b'),_0x3679ce))[_0xa79c('0x3c')](_0xa79c('0x3d'),_0x2ab195);}exports['cs']=function(_0x285b46,_0x3b8212,_0x4ed2f9,_0x31f749,_0x3b9eab,_0x33175e,_0x4d3fae,_0x39aa78){var _0x4b20ce={};var _0x5e7a30={'Authorization':_0xa79c('0x3e')+_0x33175e[_0xa79c('0x3f')]};_0x33175e[_0xa79c('0x40')]=intUtil[_0xa79c('0x41')](_0x33175e[_0xa79c('0x40')]);_0x33175e['serverUrl']=intUtil[_0xa79c('0x41')](_0x33175e[_0xa79c('0x42')]);var _0x52a1a7=_0x33175e[_0xa79c('0x40')];_0x4b20ce[_0xa79c('0x13')]=_0x33175e['username'];_0x4b20ce[_0xa79c('0x2a')]=_0x39aa78[_0xa79c('0x43')]()===_0xa79c('0x44')?_0x3b8212[_0xa79c('0x45')]:_0x3b8212[_0xa79c('0x46')];_0x4b20ce[_0xa79c('0x47')]=_0x39aa78==='queue'||_0x39aa78===_0xa79c('0x48')?_0xa79c('0x49'):_0xa79c('0x44');if(_0x31f749){_0x4b20ce[_0xa79c('0x1c')]=_0x31f749[_0xa79c('0x12')];}var _0x2770b2=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x33175e[_0xa79c('0x42')],_0x3b8212['uniqueid'],md5(_0x3b8212[_0xa79c('0x4a')]));if(_0x3b9eab&&_0x3b9eab[_0xa79c('0x4b')]){logger[_0xa79c('0xe')](_0xa79c('0x4c'),_0xa79c('0x4d'));_0x3b8212['recordingURL']=_0x2770b2;}else if(_0x4d3fae&&_0x4d3fae[_0xa79c('0x4e')]&&_0x4d3fae[_0xa79c('0x4e')]!==_0xa79c('0x4f')){logger[_0xa79c('0xe')](_0xa79c('0x50'),_0xa79c('0x4d'));_0x3b8212['recordingURL']=_0x2770b2;}else{_0x3b8212[_0xa79c('0x51')]='';}return getAdminId(_0x4b20ce,_0x39aa78,_0x5e7a30,_0x52a1a7)[_0xa79c('0x10')](getUser(_0x39aa78,_0x5e7a30,_0x52a1a7))['then'](getEndUser(_0x39aa78,_0x5e7a30,_0x52a1a7))['then'](getTicket(_0x39aa78,_0x5e7a30,_0x52a1a7,_0x4ed2f9,_0x3b8212))[_0xa79c('0x10')](function(_0x4468c0){logger['info'](util[_0xa79c('0x28')](_0xa79c('0x52'),_0x4468c0[_0xa79c('0x38')]));if(_0x39aa78!==_0xa79c('0x48')){logger[_0xa79c('0xe')]('['+[_0x39aa78['toUpperCase']()]+']',_0xa79c('0x53'));emit(_0x52a1a7,_0x31f749['name'],_0x4468c0[_0xa79c('0x2c')]);}})[_0xa79c('0x17')](function(_0xf07db8){logger[_0xa79c('0x23')]('['+[_0x39aa78[_0xa79c('0x18')]()]+_0xa79c('0x54'),util[_0xa79c('0x55')](_0xf07db8,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4ed4=['The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','defaults','redis','localhost','socket.io-emitter','GET','then','users','length','email','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','YYYY-MM-DDTHH:mm:ss','task','Task\x20created:','ticketId','/contacts/','emit','Token\x20token=','apiKey','stripTrailingSlash','serverUrl','remoteUri','adminEmail','toLowerCase','outbound','calleridnum','callDirection','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x4ed4,0x155));var _0x44ed=function(_0x477445,_0x3f6a63){_0x477445=_0x477445-0x0;var _0x1fa5f5=_0x4ed4[_0x477445];return _0x1fa5f5;};'use strict';var _=require(_0x44ed('0x0'));var rp=require(_0x44ed('0x1'));var md5=require(_0x44ed('0x2'));var util=require(_0x44ed('0x3'));var moment=require(_0x44ed('0x4'));var Promise=require(_0x44ed('0x5'));var Redis=require(_0x44ed('0x6'));var intUtil=require(_0x44ed('0x7'));var config=require(_0x44ed('0x8'));var logger=require('../../../../config/logger')(_0x44ed('0x9'));config['redis']=_[_0x44ed('0xa')](config[_0x44ed('0xb')],{'host':_0x44ed('0xc'),'port':0x18eb});var io=require(_0x44ed('0xd'))(new Redis(config[_0x44ed('0xb')]));function getAdminId(_0x27fe45,_0x4ce948,_0x24b307,_0x11a04a){return new Promise(function(_0x537500,_0x3237ba){var _0x58e2b3=![];var _0x1a24a9={'method':_0x44ed('0xe'),'uri':_0x11a04a+'/api/selector/owners','json':!![]};_0x1a24a9['headers']=_0x24b307;logger['info']('Getting\x20admin\x20information');return rp(_0x1a24a9)[_0x44ed('0xf')](function(_0x31aae7){if(_0x31aae7){var _0x5a8578=_0x31aae7[_0x44ed('0x10')];var _0x37fae5=null;for(_0x37fae5=0x0;_0x37fae5<_0x5a8578[_0x44ed('0x11')];_0x37fae5++){if(_0x5a8578[_0x37fae5][_0x44ed('0x12')]===_0x27fe45['adminEmail']){_0x27fe45[_0x44ed('0x13')]=_0x5a8578[_0x37fae5]['id'];_0x58e2b3=!![];}}if(_0x58e2b3){logger[_0x44ed('0x14')](_0x44ed('0x15'),_0x27fe45[_0x44ed('0x13')]);_0x537500(_0x27fe45);}else{_0x3237ba({'statusCode':0x194,'message':_0x44ed('0x16')});}}else{_0x3237ba({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x44ed('0x17')](function(_0x45b8b6){logger[_0x44ed('0x18')]('['+[_0x4ce948[_0x44ed('0x19')]()]+']',_0x45b8b6[_0x44ed('0x1a')]);_0x3237ba(_0x45b8b6);});});}function getUser(_0x55193f,_0x20565e,_0x16f861){return function(_0x4a2fa1){return new Promise(function(_0x31c473,_0x36f3f4){var _0x15ece5={'method':_0x44ed('0xe'),'uri':_0x16f861+_0x44ed('0x1b'),'json':!![]};_0x15ece5[_0x44ed('0x1c')]=_0x20565e;logger['info'](_0x44ed('0x1d'));return rp(_0x15ece5)[_0x44ed('0xf')](function(_0x279394){if(_0x279394){var _0x2c3d45=_0x279394[_0x44ed('0x10')];var _0x42d7bb=![];var _0x4d2448=null;if(_0x4a2fa1[_0x44ed('0x1e')]!==null){logger[_0x44ed('0x14')](_0x44ed('0x1f'),_0x4a2fa1[_0x44ed('0x1e')]);_0x4a2fa1[_0x44ed('0x20')]=_0x4a2fa1[_0x44ed('0x1e')];for(_0x4d2448=0x0;_0x4d2448<_0x2c3d45['length'];_0x4d2448++){if(_0x2c3d45[_0x4d2448]['email']===_0x4a2fa1[_0x44ed('0x1e')]){_0x42d7bb=!![];_0x4a2fa1[_0x44ed('0x21')]=_0x2c3d45[_0x4d2448]['id'];logger[_0x44ed('0x14')](_0x44ed('0x22'),_0x4a2fa1['userId']);}}}if(!_0x42d7bb){logger[_0x44ed('0x14')]('Admin\x20selected');_0x4a2fa1[_0x44ed('0x20')]=_0x4a2fa1['adminEmail'];_0x4a2fa1[_0x44ed('0x21')]=_0x4a2fa1['adminId'];_0x42d7bb=!![];}if(_0x42d7bb){_0x31c473(_0x4a2fa1);}else{_0x36f3f4({'statusCode':0x194,'message':_0x44ed('0x16')});}}else{_0x36f3f4({'statusCode':0x194,'message':_0x44ed('0x16')});}})[_0x44ed('0x17')](function(_0x38d152){logger['error']('['+[_0x55193f['toUpperCase']()]+']',_0x38d152[_0x44ed('0x1a')]);_0x36f3f4(_0x38d152);});});};}function searchContact(_0x3b2c72,_0x12dcf4,_0xf81975,_0x14b4a4){return new Promise(function(_0x309a3b,_0x584dd9){var _0x2a90d6={'method':_0x44ed('0xe'),'headers':_0x12dcf4,'uri':_0x3b2c72+_0x44ed('0x23')+_0x14b4a4+_0x44ed('0x24')+_0xf81975+_0x44ed('0x25'),'json':!![]};rp(_0x2a90d6)[_0x44ed('0xf')](function(_0x4ff51c){var _0x1220e7=_['find'](_0x4ff51c[_0x44ed('0x26')][_0x44ed('0x26')],[_0xf81975,_0x14b4a4]);_0x309a3b(_0x1220e7);})[_0x44ed('0x17')](function(_0x1da744){_0x584dd9(_0x1da744);});});}function getEndUser(_0x344e12,_0x35d857,_0x238fe7){return function(_0x5919a4){return new Promise(function(_0xcd5677,_0x5ee0a8){logger['info'](util[_0x44ed('0x27')](_0x44ed('0x28'),_0x5919a4[_0x44ed('0x29')]));searchContact(_0x238fe7,_0x35d857,'mobile_number',_0x5919a4[_0x44ed('0x29')])[_0x44ed('0xf')](function(_0x4180c2){if(_0x4180c2){_0x5919a4[_0x44ed('0x2a')]=_0x4180c2['id'];logger['info'](_0x44ed('0x2b'),_0x5919a4[_0x44ed('0x2a')]);return _0xcd5677(_0x5919a4);}searchContact(_0x238fe7,_0x35d857,_0x44ed('0x2c'),_0x5919a4[_0x44ed('0x29')])['then'](function(_0x392069){if(_0x392069){_0x5919a4[_0x44ed('0x2a')]=_0x392069['id'];logger['info'](_0x44ed('0x2d'),_0x5919a4[_0x44ed('0x2a')]);return _0xcd5677(_0x5919a4);}createEndUser(_0x5919a4,_0x344e12,_0x35d857,_0x238fe7)['then'](function(_0x489b52){logger['info']('Contact\x20created:',_0x489b52[_0x44ed('0x2a')]);return _0xcd5677(_0x489b52);});});})['catch'](function(_0xbddcc7){_0x5ee0a8(_0xbddcc7);});});};}function createEndUser(_0x16392a,_0x662d92,_0xe44e7f,_0x4c7a2b){return new Promise(function(_0x102342,_0x33a0cb){var _0x41f2db=moment();var _0x4de377={'method':_0x44ed('0x2e'),'uri':_0x4c7a2b+_0x44ed('0x2f'),'body':{'contact':{'last_name':_0x16392a[_0x44ed('0x29')],'work_number':_0x16392a[_0x44ed('0x29')],'mobile_number':_0x16392a[_0x44ed('0x29')],'owner_id':_0x16392a['userId'],'created_at':_0x41f2db[_0x44ed('0x27')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4de377['headers']=_0xe44e7f;logger[_0x44ed('0x14')](_0x44ed('0x30'));return rp(_0x4de377)[_0x44ed('0xf')](function(_0x13b9f1){_0x16392a[_0x44ed('0x2a')]=_0x13b9f1[_0x44ed('0x31')]['id'];_0x102342(_0x16392a);})[_0x44ed('0x17')](function(_0x2cfcf7){logger[_0x44ed('0x18')]('['+[_0x662d92[_0x44ed('0x19')]()]+']',_0x2cfcf7[_0x44ed('0x1a')]);_0x33a0cb(_0x2cfcf7[_0x44ed('0x1a')]);});});}function getTicket(_0x2ca491,_0x3655d5,_0x51d88a,_0xfe0bf3,_0x30ed09){return function(_0x514447){logger[_0x44ed('0x14')](_0x44ed('0x32'));return new Promise(function(_0x7c06a1,_0x396118){var _0x255ce7=moment();var _0x195e61={'method':'POST','uri':_0x51d88a+_0x44ed('0x33'),'body':{'title':intUtil[_0x44ed('0x34')](_0xfe0bf3['Subjects'],_0x30ed09,'\x20'),'description':intUtil[_0x44ed('0x34')](_0xfe0bf3[_0x44ed('0x35')],_0x30ed09,'\x0a'),'owner_id':_0x514447['userId'],'creater_id':_0x514447[_0x44ed('0x13')],'targetable_id':_0x514447[_0x44ed('0x2a')],'targetable_type':_0x44ed('0x36'),'created_at':_0x255ce7[_0x44ed('0x27')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x255ce7[_0x44ed('0x37')](0x1e,'m')[_0x44ed('0x27')](_0x44ed('0x38'))},'json':!![]};_0x195e61['headers']=_0x3655d5;return rp(_0x195e61)[_0x44ed('0xf')](function(_0x58ce78){_0x514447['ticketId']=_0x58ce78[_0x44ed('0x39')]['id'];logger[_0x44ed('0x14')](_0x44ed('0x3a'),_0x514447[_0x44ed('0x3b')]);_0x7c06a1(_0x514447);})['catch'](function(_0x16e41a){logger[_0x44ed('0x18')]('['+[_0x2ca491['toUpperCase']()]+']',_0x16e41a[_0x44ed('0x1a')]);_0x396118(_0x16e41a[_0x44ed('0x1a')]);});});};}function emit(_0x5c743d,_0x4128d2,_0x1829ca){var _0x4fa83d={'uri':_0x5c743d+_0x44ed('0x3c')+_0x1829ca};io['to'](util['format']('user:%s',_0x4128d2))[_0x44ed('0x3d')]('trigger:browser:url',_0x4fa83d);}exports['cs']=function(_0x2a9e72,_0x25b43a,_0x45c0a3,_0x1dc1d4,_0x1be297,_0x5f18b4,_0x444b3f,_0x4bdcb4){var _0x10775c={};var _0x16db3d={'Authorization':_0x44ed('0x3e')+_0x5f18b4[_0x44ed('0x3f')]};_0x5f18b4['remoteUri']=intUtil[_0x44ed('0x40')](_0x5f18b4['remoteUri']);_0x5f18b4[_0x44ed('0x41')]=intUtil[_0x44ed('0x40')](_0x5f18b4[_0x44ed('0x41')]);var _0x20fbdc=_0x5f18b4[_0x44ed('0x42')];_0x10775c[_0x44ed('0x43')]=_0x5f18b4['username'];_0x10775c[_0x44ed('0x29')]=_0x4bdcb4[_0x44ed('0x44')]()===_0x44ed('0x45')?_0x25b43a['destcalleridnum']:_0x25b43a[_0x44ed('0x46')];_0x10775c[_0x44ed('0x47')]=_0x4bdcb4==='queue'||_0x4bdcb4===_0x44ed('0x48')?'queue':'outbound';if(_0x1dc1d4){_0x10775c[_0x44ed('0x1e')]=_0x1dc1d4[_0x44ed('0x12')];}var _0x3fd8d6=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5f18b4[_0x44ed('0x41')],_0x25b43a[_0x44ed('0x49')],md5(_0x25b43a[_0x44ed('0x49')]));if(_0x1be297&&_0x1be297['monitor_format']){logger['info'](_0x44ed('0x4a'),_0x44ed('0x4b'));_0x25b43a['recordingURL']=_0x3fd8d6;}else if(_0x444b3f&&_0x444b3f[_0x44ed('0x4c')]&&_0x444b3f[_0x44ed('0x4c')]!==_0x44ed('0x4d')){logger[_0x44ed('0x14')]('[OUTBOUND]',_0x44ed('0x4b'));_0x25b43a['recordingURL']=_0x3fd8d6;}else{_0x25b43a[_0x44ed('0x4e')]='';}return getAdminId(_0x10775c,_0x4bdcb4,_0x16db3d,_0x20fbdc)[_0x44ed('0xf')](getUser(_0x4bdcb4,_0x16db3d,_0x20fbdc))['then'](getEndUser(_0x4bdcb4,_0x16db3d,_0x20fbdc))[_0x44ed('0xf')](getTicket(_0x4bdcb4,_0x16db3d,_0x20fbdc,_0x45c0a3,_0x25b43a))[_0x44ed('0xf')](function(_0xab3326){logger['info'](util[_0x44ed('0x27')](_0x44ed('0x4f'),_0xab3326[_0x44ed('0x3b')]));if(_0x4bdcb4!=='unmanaged'){logger[_0x44ed('0x14')]('['+[_0x4bdcb4[_0x44ed('0x19')]()]+']',_0x44ed('0x50'));emit(_0x20fbdc,_0x1dc1d4[_0x44ed('0x51')],_0xab3326[_0x44ed('0x2a')]);}})[_0x44ed('0x17')](function(_0x47b713){logger[_0x44ed('0x18')]('['+[_0x4bdcb4['toUpperCase']()]+_0x44ed('0x52'),util[_0x44ed('0x53')](_0x47b713,{'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 42f4873..82293c5 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 _0xe1e8=['find','data3','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','sugarcrm','log','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','lodash','./zendesk','./salesforce','./sugarcrm','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2'];(function(_0x5eca9f,_0x1d15d3){var _0x53a05c=function(_0x10bacd){while(--_0x10bacd){_0x5eca9f['push'](_0x5eca9f['shift']());}};_0x53a05c(++_0x1d15d3);}(_0xe1e8,0xe0));var _0x8e1e=function(_0xb31302,_0x2433c6){_0xb31302=_0xb31302-0x0;var _0x1f36f1=_0xe1e8[_0xb31302];return _0x1f36f1;};'use strict';var _=require(_0x8e1e('0x0'));var util=require('util');var zendesk=require(_0x8e1e('0x1'));var salesforce=require(_0x8e1e('0x2'));var sugarcrm=require(_0x8e1e('0x3'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0x8e1e('0x4'));var servicenow=require(_0x8e1e('0x5'));var dynamics365=require(_0x8e1e('0x6'));var freshsales=require(_0x8e1e('0x7'));var integrations=[_0x8e1e('0x8'),_0x8e1e('0x9'),'sugarcrm',_0x8e1e('0xa'),_0x8e1e('0xb'),'desk',_0x8e1e('0xc'),_0x8e1e('0xd'),_0x8e1e('0xe'),_0x8e1e('0xf')];exports[_0x8e1e('0x10')]=function(_0x4352ce,_0x189ca3,_0x1b9134,_0x39d471,_0x2f49f5,_0x3d65a0){if(_0x1b9134){if(_[_0x8e1e('0x11')](integrations,_0x4352ce[_0x8e1e('0x12')][_0x8e1e('0x13')]())){try{var _0x331899=null;var _0x325f4e='';var _0x1edabc=_0x1b9134[_0x4352ce[_0x8e1e('0x12')][_0x8e1e('0x13')]()];if(_0x1edabc){var _0x6688a8=_0x1edabc[_0x4352ce[_0x8e1e('0x14')]];if(_0x6688a8){var _0x1d5455=_[_0x8e1e('0x15')](_0x6688a8['Configurations'],{'id':parseInt(_0x4352ce[_0x8e1e('0x16')],0xa)});if(_0x1d5455){if(_0x39d471){if(_0x2f49f5&&_0x189ca3['queue']){_0x325f4e='queue';}else if(_0x189ca3[_0x8e1e('0x17')]){_0x325f4e=_0x8e1e('0x18');}else{console['log'](_0x8e1e('0x19'),_0x189ca3);}}else{_0x325f4e=_0x8e1e('0x1a');}switch(_0x4352ce[_0x8e1e('0x12')][_0x8e1e('0x13')]()){case _0x8e1e('0x8'):zendesk[_0x325f4e](_0x4352ce,_0x189ca3,_0x1d5455,_0x39d471,_0x2f49f5,_0x6688a8,_0x3d65a0);break;case'salesforce':salesforce[_0x325f4e](_0x4352ce,_0x189ca3,_0x1d5455,_0x39d471,_0x2f49f5,_0x6688a8,_0x3d65a0);break;case _0x8e1e('0x1b'):sugarcrm[_0x325f4e](_0x4352ce,_0x189ca3,_0x1d5455,_0x39d471,_0x2f49f5,_0x6688a8,_0x3d65a0);break;case _0x8e1e('0xa'):freshdesk[_0x325f4e](_0x4352ce,_0x189ca3,_0x1d5455,_0x39d471,_0x2f49f5,_0x6688a8,_0x3d65a0);break;case _0x8e1e('0xb'):zoho[_0x325f4e](_0x4352ce,_0x189ca3,_0x1d5455,_0x39d471,_0x2f49f5,_0x6688a8,_0x3d65a0);break;case'desk':desk[_0x325f4e](_0x4352ce,_0x189ca3,_0x1d5455,_0x39d471,_0x2f49f5,_0x6688a8,_0x3d65a0);break;case _0x8e1e('0xc'):vtiger[_0x325f4e](_0x4352ce,_0x189ca3,_0x1d5455,_0x39d471,_0x2f49f5,_0x6688a8,_0x3d65a0);break;case _0x8e1e('0xe'):freshsales['cs'](_0x4352ce,_0x189ca3,_0x1d5455,_0x39d471,_0x2f49f5,_0x6688a8,_0x3d65a0,_0x325f4e);break;case _0x8e1e('0xf'):servicenow['cs'](_0x4352ce,_0x189ca3,_0x1d5455,_0x39d471,_0x2f49f5,_0x6688a8,_0x3d65a0,_0x325f4e);break;case'dynamics365':dynamics365['cs'](_0x4352ce,_0x189ca3,_0x1d5455,_0x39d471,_0x2f49f5,_0x6688a8,_0x3d65a0,_0x325f4e);break;default:console[_0x8e1e('0x1c')](_0x8e1e('0x1d'));}}else{_0x331899=require(_0x8e1e('0x1e'))(_0x4352ce['data1'][_0x8e1e('0x13')]());_0x331899['error'](_0x8e1e('0x1f'),util[_0x8e1e('0x20')](_0x8e1e('0x21'),_0x4352ce[_0x8e1e('0x12')][_0x8e1e('0x13')](),_0x4352ce[_0x8e1e('0x16')]));}}else{_0x331899=require(_0x8e1e('0x1e'))(_0x4352ce[_0x8e1e('0x12')][_0x8e1e('0x13')]());_0x331899[_0x8e1e('0x22')](_0x8e1e('0x1f'),util[_0x8e1e('0x20')]('%s\x20account\x20#%s\x20not\x20found',_0x4352ce[_0x8e1e('0x12')][_0x8e1e('0x13')](),_0x4352ce[_0x8e1e('0x14')]));}}else{}}catch(_0x2d86eb){console[_0x8e1e('0x22')](_0x2d86eb);}}}}; \ No newline at end of file +var _0x433f=['../../../../config/logger','format','%s\x20configuration\x20#%s\x20not\x20found','error','[EXEC]','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','data1','zoho','unknown\x20integration'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x433f,0xa6));var _0xf433=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x433f[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0xf433('0x0'));var zendesk=require(_0xf433('0x1'));var salesforce=require(_0xf433('0x2'));var sugarcrm=require(_0xf433('0x3'));var freshdesk=require(_0xf433('0x4'));var zoho=require(_0xf433('0x5'));var desk=require(_0xf433('0x6'));var vtiger=require(_0xf433('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0xf433('0x8'));var freshsales=require(_0xf433('0x9'));var integrations=[_0xf433('0xa'),_0xf433('0xb'),'sugarcrm',_0xf433('0xc'),'zoho',_0xf433('0xd'),_0xf433('0xe'),_0xf433('0xf'),_0xf433('0x10'),_0xf433('0x11')];exports[_0xf433('0x12')]=function(_0x12eca3,_0x2372b0,_0x35a57e,_0x2e3e5b,_0x1b4086,_0x12ebfa){if(_0x35a57e){if(_[_0xf433('0x13')](integrations,_0x12eca3['data1'][_0xf433('0x14')]())){try{var _0x4690b9=null;var _0x1e095f='';var _0x37023f=_0x35a57e[_0x12eca3['data1'][_0xf433('0x14')]()];if(_0x37023f){var _0x47ce60=_0x37023f[_0x12eca3[_0xf433('0x15')]];if(_0x47ce60){var _0x545781=_[_0xf433('0x16')](_0x47ce60[_0xf433('0x17')],{'id':parseInt(_0x12eca3[_0xf433('0x18')],0xa)});if(_0x545781){if(_0x2e3e5b){if(_0x1b4086&&_0x2372b0[_0xf433('0x19')]){_0x1e095f=_0xf433('0x19');}else if(_0x2372b0[_0xf433('0x1a')]){_0x1e095f=_0xf433('0x1b');}else{console[_0xf433('0x1c')](_0xf433('0x1d'),_0x2372b0);}}else{_0x1e095f=_0xf433('0x1e');}switch(_0x12eca3[_0xf433('0x1f')][_0xf433('0x14')]()){case'zendesk':zendesk[_0x1e095f](_0x12eca3,_0x2372b0,_0x545781,_0x2e3e5b,_0x1b4086,_0x47ce60,_0x12ebfa);break;case _0xf433('0xb'):salesforce[_0x1e095f](_0x12eca3,_0x2372b0,_0x545781,_0x2e3e5b,_0x1b4086,_0x47ce60,_0x12ebfa);break;case'sugarcrm':sugarcrm[_0x1e095f](_0x12eca3,_0x2372b0,_0x545781,_0x2e3e5b,_0x1b4086,_0x47ce60,_0x12ebfa);break;case _0xf433('0xc'):freshdesk[_0x1e095f](_0x12eca3,_0x2372b0,_0x545781,_0x2e3e5b,_0x1b4086,_0x47ce60,_0x12ebfa);break;case _0xf433('0x20'):zoho[_0x1e095f](_0x12eca3,_0x2372b0,_0x545781,_0x2e3e5b,_0x1b4086,_0x47ce60,_0x12ebfa);break;case _0xf433('0xd'):desk[_0x1e095f](_0x12eca3,_0x2372b0,_0x545781,_0x2e3e5b,_0x1b4086,_0x47ce60,_0x12ebfa);break;case _0xf433('0xe'):vtiger[_0x1e095f](_0x12eca3,_0x2372b0,_0x545781,_0x2e3e5b,_0x1b4086,_0x47ce60,_0x12ebfa);break;case _0xf433('0x10'):freshsales['cs'](_0x12eca3,_0x2372b0,_0x545781,_0x2e3e5b,_0x1b4086,_0x47ce60,_0x12ebfa,_0x1e095f);break;case _0xf433('0x11'):servicenow['cs'](_0x12eca3,_0x2372b0,_0x545781,_0x2e3e5b,_0x1b4086,_0x47ce60,_0x12ebfa,_0x1e095f);break;case _0xf433('0xf'):dynamics365['cs'](_0x12eca3,_0x2372b0,_0x545781,_0x2e3e5b,_0x1b4086,_0x47ce60,_0x12ebfa,_0x1e095f);break;default:console['log'](_0xf433('0x21'));}}else{_0x4690b9=require(_0xf433('0x22'))(_0x12eca3['data1'][_0xf433('0x14')]());_0x4690b9['error']('[EXEC]',util[_0xf433('0x23')](_0xf433('0x24'),_0x12eca3['data1'][_0xf433('0x14')](),_0x12eca3['data3']));}}else{_0x4690b9=require(_0xf433('0x22'))(_0x12eca3[_0xf433('0x1f')]['toLowerCase']());_0x4690b9[_0xf433('0x25')](_0xf433('0x26'),util['format'](_0xf433('0x27'),_0x12eca3[_0xf433('0x1f')][_0xf433('0x14')](),_0x12eca3[_0xf433('0x15')]));}}else{}}catch(_0x40e93a){console[_0xf433('0x25')](_0x40e93a);}}}}; \ 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 db8d892..78c3384 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 _0xc108=['find','then','length','Email','Agent\x20%s\x20found.','identity','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','Contact','execute','cloneDeep','additionalSearchLead','$or','Lead','additionalSearchAccount','Account','first','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','Caller\x20-\x20%s','Company','upperFirst','forEach','includes','type','idField','content','toString','variable','variableName','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase','calleridname',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','assign','Subjects','getString','Descriptions','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','account','WhatId','ticketType','Case','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User'];(function(_0x42ee92,_0x3f6f20){var _0x2f1831=function(_0x4ebbf3){while(--_0x4ebbf3){_0x42ee92['push'](_0x42ee92['shift']());}};_0x2f1831(++_0x3f6f20);}(_0xc108,0xdd));var _0x8c10=function(_0x5a6ce1,_0x30407b){_0x5a6ce1=_0x5a6ce1-0x0;var _0x195f4f=_0xc108[_0x5a6ce1];return _0x195f4f;};'use strict';var _=require(_0x8c10('0x0'));var rp=require(_0x8c10('0x1'));var moment=require('moment');var BPromise=require(_0x8c10('0x2'));var md5=require(_0x8c10('0x3'));var jsforce=require(_0x8c10('0x4'));var util=require('util');var Redis=require(_0x8c10('0x5'));var intUtil=require(_0x8c10('0x6'));var config=require(_0x8c10('0x7'));var logger=require('../../../../config/logger')(_0x8c10('0x8'));config[_0x8c10('0x9')]=_[_0x8c10('0xa')](config[_0x8c10('0x9')],{'host':_0x8c10('0xb'),'port':0x18eb});var io=require(_0x8c10('0xc'))(new Redis(config[_0x8c10('0x9')]));function emit(_0x23b249,_0x3ab295,_0x1c3448){io['to'](_0x23b249)['emit'](_0x3ab295,_0x1c3448);}function getTicket(_0x457bf9,_0x1e8b17,_0x1d1c1d,_0x278b8a,_0x4adab1,_0x1e98a8,_0x2b3afe,_0x17b60b){var _0x202418=Object[_0x8c10('0xd')]({},{'OwnerId':_0x1e8b17['id'],'Subject':intUtil['getString'](_0x278b8a[_0x8c10('0xe')],_0x4adab1,'\x20'),'Description':intUtil[_0x8c10('0xf')](_0x278b8a[_0x8c10('0x10')],_0x4adab1,'\x0a')},getCustomFields(_0x1e98a8,_0x4adab1));if(_0x1d1c1d){if(_0x278b8a['ticketType']==='Task'){_0x202418[_0x8c10('0x11')]=moment[_0x8c10('0x12')]();_0x202418[_0x8c10('0x13')]=![];_0x202418[_0x8c10('0x14')]=![];if(_0x1d1c1d[_0x8c10('0x15')]===_0x8c10('0x16')||_0x1d1c1d[_0x8c10('0x15')]==='lead'){_0x202418['WhoId']=_0x1d1c1d['id'];}else if(_0x1d1c1d[_0x8c10('0x15')]===_0x8c10('0x17')){_0x202418[_0x8c10('0x18')]=_0x1d1c1d['id'];}}else if(_0x278b8a[_0x8c10('0x19')]===_0x8c10('0x1a')){if(_0x1d1c1d[_0x8c10('0x15')]===_0x8c10('0x16')){_0x202418[_0x8c10('0x1b')]=_0x1d1c1d['id'];}else if(_0x1d1c1d[_0x8c10('0x15')]===_0x8c10('0x17')){_0x202418[_0x8c10('0x1c')]=_0x1d1c1d['id'];}else if(_0x1d1c1d[_0x8c10('0x15')]===_0x8c10('0x1d')&&_0x278b8a[_0x8c10('0x1e')]){_0x202418[_0x278b8a[_0x8c10('0x1e')]]=_0x1d1c1d['id'];}else{logger[_0x8c10('0x1f')](_0x8c10('0x20'));}}}return _0x2b3afe[_0x8c10('0x21')](_0x278b8a[_0x8c10('0x19')])['create'](_0x202418);}function getUser(_0x38b49d,_0x446e7a,_0x3a1304){if(!_[_0x8c10('0x22')](_0x446e7a)&&intUtil[_0x8c10('0x23')](_0x446e7a)){var _0xb4cbe6={'Email':_0x446e7a};var _0x273708={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3a1304[_0x8c10('0x21')](_0x8c10('0x24'))[_0x8c10('0x25')](_0xb4cbe6,_0x273708)['execute']()[_0x8c10('0x26')](function(_0xc73db8){if(_0xc73db8[_0x8c10('0x27')]){var _0x3c2b42=_['find'](_0xc73db8,function(_0x210973){return _0x210973[_0x8c10('0x28')]===_0x446e7a;});if(_0x3c2b42){logger[_0x8c10('0x1f')](_0x8c10('0x29'),_0x446e7a);return BPromise['resolve']({'id':_0x3c2b42['Id'],'name':_0x3c2b42['Name']});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x446e7a);return _0x3a1304[_0x8c10('0x2a')]()['then'](function(_0x111f33){return BPromise['resolve']({'id':_0x111f33['user_id'],'name':_0x111f33['display_name']});});}});}else{logger[_0x8c10('0x1f')](_0x8c10('0x2b'),_0x446e7a);return _0x3a1304['identity']()[_0x8c10('0x26')](function(_0x56b097){return BPromise[_0x8c10('0x2c')]({'id':_0x56b097['user_id'],'name':_0x56b097[_0x8c10('0x2d')]});});}}function getEndUser(_0x510729,_0x65e618,_0x1e3ce4,_0x7e2d9e,_0xd5baf7){var _0x3fb19e={'$or':{'Phone':_0x7e2d9e}};var _0x1dbff4={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8c10('0x2c')]()[_0x8c10('0x26')](function(){logger[_0x8c10('0x1f')](_0x8c10('0x2e'),_0x7e2d9e,_0x65e618[_0x8c10('0x2f')]);switch(_0x65e618[_0x8c10('0x2f')]){case _0x8c10('0x30'):var _0x4212e6=_['cloneDeep'](_0x3fb19e);if(_0x65e618[_0x8c10('0x31')]){var _0x1c05ef={};_0x1c05ef[_0x65e618[_0x8c10('0x31')]]=_0x7e2d9e;_[_0x8c10('0x32')](_0x4212e6['$or'],_0x1c05ef);}return _0xd5baf7[_0x8c10('0x21')](_0x8c10('0x33'))[_0x8c10('0x25')](_0x4212e6,_0x1dbff4)[_0x8c10('0x34')]()['then'](function(_0x473d15){if(_0x473d15&&_0x473d15[_0x8c10('0x27')]){return _0x473d15;}else{var _0x4ca290=_[_0x8c10('0x35')](_0x3fb19e);if(_0x65e618[_0x8c10('0x36')]){var _0x55fe18={};_0x55fe18[_0x65e618['additionalSearchLead']]=_0x7e2d9e;_['merge'](_0x4ca290[_0x8c10('0x37')],_0x55fe18);}return _0xd5baf7[_0x8c10('0x21')](_0x8c10('0x38'))['find'](_0x4ca290,_0x1dbff4);}});case'account_contact_lead':var _0x47644b=_[_0x8c10('0x35')](_0x3fb19e);if(_0x65e618['additionalSearchAccount']){var _0x1c05ef={};_0x1c05ef[_0x65e618[_0x8c10('0x39')]]=_0x7e2d9e;_[_0x8c10('0x32')](_0x47644b[_0x8c10('0x37')],_0x1c05ef);}return _0xd5baf7[_0x8c10('0x21')](_0x8c10('0x3a'))[_0x8c10('0x25')](_0x47644b,_0x1dbff4)[_0x8c10('0x34')]()[_0x8c10('0x26')](function(_0x1690fe){if(_0x1690fe&&_0x1690fe['length']){return _0x1690fe;}else{var _0x1295be=_[_0x8c10('0x35')](_0x3fb19e);if(_0x65e618['additionalSearchContact']){var _0x4c63cd={};_0x4c63cd[_0x65e618[_0x8c10('0x31')]]=_0x7e2d9e;_['merge'](_0x1295be[_0x8c10('0x37')],_0x4c63cd);}return _0xd5baf7[_0x8c10('0x21')]('Contact')['find'](_0x1295be,_0x1dbff4)['then'](function(_0x51b9ba){if(_0x51b9ba&&_0x51b9ba['length']){return _0x51b9ba;}else{var _0xe16c4a=_['cloneDeep'](_0x3fb19e);if(_0x65e618[_0x8c10('0x36')]){var _0x3c4b2d={};_0x3c4b2d[_0x65e618['additionalSearchLead']]=_0x7e2d9e;_['merge'](_0xe16c4a[_0x8c10('0x37')],_0x3c4b2d);}return _0xd5baf7[_0x8c10('0x21')]('Lead')[_0x8c10('0x25')](_0xe16c4a,_0x1dbff4);}});}});case'contact':var _0x4212e6=_[_0x8c10('0x35')](_0x3fb19e);if(_0x65e618['additionalSearchContact']){var _0x1c05ef={};_0x1c05ef[_0x65e618[_0x8c10('0x31')]]=_0x7e2d9e;_[_0x8c10('0x32')](_0x4212e6[_0x8c10('0x37')],_0x1c05ef);}return _0xd5baf7[_0x8c10('0x21')]('Contact')[_0x8c10('0x25')](_0x4212e6,_0x1dbff4)[_0x8c10('0x34')]();case _0x8c10('0x1d'):var _0x19328a=_['cloneDeep'](_0x3fb19e);if(_0x65e618[_0x8c10('0x36')]){var _0x1c05ef={};_0x1c05ef[_0x65e618[_0x8c10('0x36')]]=_0x7e2d9e;_[_0x8c10('0x32')](_0x19328a['$or'],_0x1c05ef);}return _0xd5baf7['sobject'](_0x8c10('0x38'))[_0x8c10('0x25')](_0x19328a,_0x1dbff4);case _0x8c10('0x17'):var _0x47644b=_[_0x8c10('0x35')](_0x3fb19e);if(_0x65e618[_0x8c10('0x39')]){var _0x1c05ef={};_0x1c05ef[_0x65e618[_0x8c10('0x39')]]=_0x7e2d9e;_[_0x8c10('0x32')](_0x47644b['$or'],_0x1c05ef);}return _0xd5baf7[_0x8c10('0x21')]('Account')['find'](_0x47644b,_0x1dbff4);default:return null;}})[_0x8c10('0x26')](function(_0x5c468e){if(_0x5c468e&&_0x5c468e[_0x8c10('0x27')]){var _0x33ddfc=_[_0x8c10('0x3b')](_0x5c468e);if(_0x33ddfc){return BPromise['resolve']({'id':_0x33ddfc['Id'],'name':_0x33ddfc[_0x8c10('0x3c')],'phone':_0x33ddfc[_0x8c10('0x3d')],'endUserType':_0x33ddfc[_0x8c10('0x3e')]['type'][_0x8c10('0x3f')]()});}}})['then'](function(_0x574b24){if(_0x574b24){logger[_0x8c10('0x1f')](_0x8c10('0x40'),_0x574b24[_0x8c10('0x15')],_0x7e2d9e);return BPromise[_0x8c10('0x2c')](_0x574b24);}else{logger[_0x8c10('0x1f')](_0x8c10('0x41'),_0x7e2d9e);var _0x29a7b9={'Phone':_0x7e2d9e};if(_0x65e618[_0x8c10('0x42')]){if(_0x65e618[_0x8c10('0x42')]===_0x8c10('0x16')){logger['info'](_0x8c10('0x43'),_0x7e2d9e,_0x65e618[_0x8c10('0x42')]);_0x29a7b9[_0x8c10('0x44')]=_0x1e3ce4!==_0x8c10('0x45')?_0x1e3ce4:util[_0x8c10('0x46')](_0x8c10('0x47'),_0x7e2d9e);}else if(_0x65e618[_0x8c10('0x42')]==='lead'){logger[_0x8c10('0x1f')](_0x8c10('0x43'),_0x7e2d9e,_0x65e618['moduleCreate']);_0x29a7b9[_0x8c10('0x44')]=_0x1e3ce4!==_0x8c10('0x45')?_0x1e3ce4:util[_0x8c10('0x46')](_0x8c10('0x47'),_0x7e2d9e);_0x29a7b9[_0x8c10('0x48')]='No\x20Company';}else if(_0x65e618['moduleCreate']===_0x8c10('0x17')){logger[_0x8c10('0x1f')](_0x8c10('0x43'),_0x7e2d9e,_0x65e618[_0x8c10('0x42')]);_0x29a7b9[_0x8c10('0x3c')]=_0x1e3ce4!==_0x8c10('0x45')?_0x1e3ce4:util[_0x8c10('0x46')](_0x8c10('0x47'),_0x7e2d9e);}else{return null;}}return _0xd5baf7[_0x8c10('0x21')](_[_0x8c10('0x49')](_0x65e618[_0x8c10('0x42')]))['create'](_0x29a7b9)[_0x8c10('0x26')](function(_0x17f2ff){return BPromise[_0x8c10('0x2c')]({'id':_0x17f2ff['id'],'endUserType':_0x65e618['moduleCreate']});});}});}function getCustomFields(_0x1ee0c5,_0x4f6c63){var _0x3d3876={};if(_0x1ee0c5[_0x8c10('0x27')]>0x0){_[_0x8c10('0x4a')](_0x1ee0c5,function(_0x2a4a74){if(_[_0x8c10('0x4b')](['string','picklist'],_0x2a4a74[_0x8c10('0x4c')])&&_0x2a4a74[_0x8c10('0x4d')]){_0x3d3876[_0x2a4a74['idField']]=_0x2a4a74[_0x8c10('0x4e')][_0x8c10('0x4f')]();}else if(_0x2a4a74[_0x8c10('0x4c')]===_0x8c10('0x50')&&_0x2a4a74['variableName']&&_0x2a4a74['idField']){_0x4f6c63[_0x2a4a74[_0x8c10('0x51')]]&&(_0x3d3876[_0x2a4a74[_0x8c10('0x4d')]]=_0x4f6c63[_0x2a4a74[_0x8c10('0x51')]][_0x8c10('0x4f')]());}else if(_0x2a4a74['type']==='customVariable'&&_0x2a4a74[_0x8c10('0x52')]&&_0x2a4a74[_0x8c10('0x52')][_0x8c10('0x53')]&&_0x2a4a74[_0x8c10('0x4d')]){_0x4f6c63[_0x2a4a74[_0x8c10('0x52')][_0x8c10('0x53')][_0x8c10('0x3f')]()]&&(_0x3d3876[_0x2a4a74['idField']]=_0x4f6c63[_0x2a4a74[_0x8c10('0x52')][_0x8c10('0x53')][_0x8c10('0x3f')]()][_0x8c10('0x4f')]());}});}return _0x3d3876;}function getConnection(_0x35496a){var _0xed0264=_0x35496a[_0x8c10('0x54')][_0x8c10('0x55')](_0x35496a['securityToken']);var _0x4ebab6=new jsforce[(_0x8c10('0x56'))]({'oauth2':{'loginUrl':_0x35496a[_0x8c10('0x57')]||_0x8c10('0x58'),'clientId':_0x35496a[_0x8c10('0x59')],'clientSecret':_0x35496a[_0x8c10('0x5a')]}});return _0x4ebab6[_0x8c10('0x5b')](_0x35496a[_0x8c10('0x5c')],_0xed0264)[_0x8c10('0x26')](function(){logger[_0x8c10('0x1f')](_0x8c10('0x5d'));return _0x4ebab6;});}exports[_0x8c10('0x5e')]=function(_0x581b8b,_0x41bbc7,_0x2f133d,_0x10386b,_0x29bd39,_0x56fb6f){var _0x1653b1,_0x114bd7,_0x40d38c,_0x5d8c06;_0x56fb6f[_0x8c10('0x5f')]=intUtil['stripTrailingSlash'](_0x56fb6f[_0x8c10('0x5f')]);_0x56fb6f[_0x8c10('0x57')]=intUtil['stripTrailingSlash'](_0x56fb6f[_0x8c10('0x57')]);if(_0x29bd39&&_0x29bd39['monitor_format']){logger['info']('[QUEUE]',_0x8c10('0x60'));_0x41bbc7[_0x8c10('0x61')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56fb6f['serverUrl'],_0x41bbc7[_0x8c10('0x62')],md5(_0x41bbc7['uniqueid']));}else{_0x41bbc7['recordingURL']='';}return getConnection(_0x56fb6f)[_0x8c10('0x26')](function(_0xdf47d7){_0x5d8c06=_0xdf47d7;return getUser(_0x56fb6f,_0x10386b[_0x8c10('0x63')],_0x5d8c06);})[_0x8c10('0x26')](function(_0x1069a4){_0x1653b1=_0x1069a4;return getEndUser(_0x56fb6f,_0x2f133d,_0x41bbc7['calleridname'],_0x41bbc7[_0x8c10('0x64')],_0x5d8c06);})[_0x8c10('0x26')](function(_0x45b7c4){_0x114bd7=_0x45b7c4;return getTicket(_0x56fb6f,_0x1653b1,_0x114bd7,_0x2f133d,_0x41bbc7,_0x2f133d[_0x8c10('0x65')],_0x5d8c06,'queue');})[_0x8c10('0x26')](function(_0x4481ff){_0x40d38c=_0x4481ff;logger['info'](_0x8c10('0x66'),_0x40d38c['id']);logger[_0x8c10('0x1f')](_0x8c10('0x67'),_0x40d38c['id'],_0x10386b[_0x8c10('0x53')],_0x56fb6f[_0x8c10('0x4c')]);switch(_0x56fb6f['type']){case'integrationTab':emit(util[_0x8c10('0x46')](_0x8c10('0x68'),_0x10386b[_0x8c10('0x53')]),'trigger:salesforce:display',{'recordId':_0x40d38c['id']});break;case _0x8c10('0x69'):emit(util[_0x8c10('0x46')]('user:%s',_0x10386b[_0x8c10('0x53')]),'trigger:browser:url',{'uri':util['format'](_0x8c10('0x6a'),_0x5d8c06[_0x8c10('0x6b')],_0x40d38c['id'])});break;default:logger[_0x8c10('0x6c')](_0x8c10('0x6d'));}})[_0x8c10('0x6e')](function(_0x47ba42){logger[_0x8c10('0x6c')](_0x8c10('0x6f'),_0x47ba42);});};exports[_0x8c10('0x70')]=function(_0x5d77,_0x3890a4,_0x32acc4,_0x3c2fd0,_0x1b4186,_0x1fdb9d,_0x12a00e){var _0x1b77a7,_0x17164d,_0x5bb9c1,_0x5c5b9c;_0x1fdb9d[_0x8c10('0x5f')]=intUtil[_0x8c10('0x71')](_0x1fdb9d[_0x8c10('0x5f')]);_0x1fdb9d[_0x8c10('0x57')]=intUtil['stripTrailingSlash'](_0x1fdb9d[_0x8c10('0x57')]);if(_0x12a00e&&_0x12a00e[_0x8c10('0x72')]&&_0x12a00e[_0x8c10('0x72')]!==_0x8c10('0x73')){logger[_0x8c10('0x1f')](_0x8c10('0x74'),_0x8c10('0x60'));_0x3890a4['recordingURL']=util['format'](_0x8c10('0x75'),_0x1fdb9d['serverUrl'],_0x3890a4['uniqueid'],md5(_0x3890a4[_0x8c10('0x62')]));}return getConnection(_0x1fdb9d)[_0x8c10('0x26')](function(_0x2d6cdb){_0x5c5b9c=_0x2d6cdb;return getUser(_0x1fdb9d,_0x3c2fd0[_0x8c10('0x63')],_0x5c5b9c);})[_0x8c10('0x26')](function(_0x4e5895){_0x1b77a7=_0x4e5895;return getEndUser(_0x1fdb9d,_0x32acc4,_0x3890a4['destcalleridname'],_0x3890a4[_0x8c10('0x76')],_0x5c5b9c);})[_0x8c10('0x26')](function(_0x388d40){_0x17164d=_0x388d40;return getTicket(_0x1fdb9d,_0x1b77a7,_0x17164d,_0x32acc4,_0x3890a4,_0x32acc4[_0x8c10('0x65')],_0x5c5b9c,_0x8c10('0x70'));})['then'](function(_0xb2d29a){_0x5bb9c1=_0xb2d29a;logger[_0x8c10('0x1f')](_0x8c10('0x77'),_0x5bb9c1['id']);logger[_0x8c10('0x1f')](_0x8c10('0x78'),_0x5bb9c1['id'],_0x3c2fd0[_0x8c10('0x53')],_0x1fdb9d[_0x8c10('0x4c')]);switch(_0x1fdb9d[_0x8c10('0x4c')]){case _0x8c10('0x79'):emit(util[_0x8c10('0x46')](_0x8c10('0x68'),_0x3c2fd0['name']),'trigger:salesforce:display',{'recordId':_0x5bb9c1['id']});break;case'newTab':emit(util[_0x8c10('0x46')](_0x8c10('0x68'),_0x3c2fd0[_0x8c10('0x53')]),'trigger:browser:url',{'uri':util[_0x8c10('0x46')](_0x8c10('0x6a'),_0x5c5b9c[_0x8c10('0x6b')],_0x5bb9c1['id'])});break;default:logger[_0x8c10('0x6c')]('[OUTBOUND]',_0x8c10('0x7a'));}})['catch'](function(_0x40595b){logger[_0x8c10('0x6c')](_0x8c10('0x74'),_0x40595b);});};exports[_0x8c10('0x7b')]=function(_0x56052f,_0x20683e,_0x5e2f2e,_0x8faf9e,_0x5d1abd,_0x1373a6){var _0x1196fd,_0x35efdc,_0x4ad87e,_0x14bb1e;_0x1373a6[_0x8c10('0x5f')]=intUtil[_0x8c10('0x71')](_0x1373a6[_0x8c10('0x5f')]);_0x1373a6[_0x8c10('0x57')]=intUtil['stripTrailingSlash'](_0x1373a6[_0x8c10('0x57')]);if(_0x5d1abd&&_0x5d1abd[_0x8c10('0x7c')]){logger['info']('['+_0x20683e[_0x8c10('0x7d')][_0x8c10('0x7e')]()+']',_0x8c10('0x60'));_0x20683e[_0x8c10('0x61')]=util[_0x8c10('0x46')](_0x8c10('0x75'),_0x1373a6[_0x8c10('0x5f')],_0x20683e[_0x8c10('0x62')],md5(_0x20683e[_0x8c10('0x62')]));}else{_0x20683e['recordingURL']='';}return getConnection(_0x1373a6)['then'](function(_0x435769){_0x14bb1e=_0x435769;if(!_[_0x8c10('0x22')](_0x8faf9e)){return getUser(_0x1373a6,_0x8faf9e['name'],_0x14bb1e);}else{return getUser(_0x1373a6,null,_0x14bb1e);}})[_0x8c10('0x26')](function(_0xf70283){_0x1196fd=_0xf70283;return getEndUser(_0x1373a6,_0x5e2f2e,_0x20683e[_0x8c10('0x7f')],_0x20683e[_0x8c10('0x64')],_0x14bb1e);})[_0x8c10('0x26')](function(_0x1e1695){_0x35efdc=_0x1e1695;return getTicket(_0x1373a6,_0x1196fd,_0x35efdc,_0x5e2f2e,_0x20683e,_0x5e2f2e[_0x8c10('0x65')],_0x14bb1e);})[_0x8c10('0x26')](function(_0x5b89b0){_0x4ad87e=_0x5b89b0;logger[_0x8c10('0x1f')]('['+_0x20683e[_0x8c10('0x7d')][_0x8c10('0x7e')]()+']\x20Ticket\x20%s\x20created.',_0x4ad87e['id']);logger[_0x8c10('0x1f')]('['+_0x20683e['lastevent']['toUpperCase']()+_0x8c10('0x80'),_0x1373a6[_0x8c10('0x4c')]);})[_0x8c10('0x6e')](function(_0x26f741){logger[_0x8c10('0x6c')]('['+_0x20683e[_0x8c10('0x7d')][_0x8c10('0x7e')]()+']',_0x26f741);});}; \ No newline at end of file +var _0xb177=['concat','securityToken','Connection','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','error','catch','outbound','recordingFormat','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','[OUTBOUND]','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','ioredis','../../../../config/environment','salesforce','redis','defaults','emit','assign','getString','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','contact','endUserType','lead','WhoId','account','WhatId','Case','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','execute','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','Company','No\x20Company','Name','forEach','includes','string','picklist','idField','content','variable','variableName','toString','customVariable','Variable','name'];(function(_0x1b8a47,_0x36cf13){var _0x18fa8c=function(_0x541a9c){while(--_0x541a9c){_0x1b8a47['push'](_0x1b8a47['shift']());}};_0x18fa8c(++_0x36cf13);}(_0xb177,0xa9));var _0x7b17=function(_0x3ab750,_0x4e1803){_0x3ab750=_0x3ab750-0x0;var _0x3216a8=_0xb177[_0x3ab750];return _0x3216a8;};'use strict';var _=require(_0x7b17('0x0'));var rp=require(_0x7b17('0x1'));var moment=require(_0x7b17('0x2'));var BPromise=require(_0x7b17('0x3'));var md5=require('md5');var jsforce=require(_0x7b17('0x4'));var util=require('util');var Redis=require(_0x7b17('0x5'));var intUtil=require('./util');var config=require(_0x7b17('0x6'));var logger=require('../../../../config/logger')(_0x7b17('0x7'));config[_0x7b17('0x8')]=_[_0x7b17('0x9')](config[_0x7b17('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7b17('0x8')]));function emit(_0xfa7d12,_0x479f17,_0x2370f4){io['to'](_0xfa7d12)[_0x7b17('0xa')](_0x479f17,_0x2370f4);}function getTicket(_0x5dcc9d,_0x493294,_0x21e56e,_0x4deb17,_0x417f5a,_0x3e594f,_0x416a90,_0x54a963){var _0x3777fb=Object[_0x7b17('0xb')]({},{'OwnerId':_0x493294['id'],'Subject':intUtil[_0x7b17('0xc')](_0x4deb17['Subjects'],_0x417f5a,'\x20'),'Description':intUtil[_0x7b17('0xc')](_0x4deb17[_0x7b17('0xd')],_0x417f5a,'\x0a')},getCustomFields(_0x3e594f,_0x417f5a));if(_0x21e56e){if(_0x4deb17[_0x7b17('0xe')]===_0x7b17('0xf')){_0x3777fb[_0x7b17('0x10')]=moment['utc']();_0x3777fb[_0x7b17('0x11')]=![];_0x3777fb[_0x7b17('0x12')]=![];if(_0x21e56e['endUserType']===_0x7b17('0x13')||_0x21e56e[_0x7b17('0x14')]===_0x7b17('0x15')){_0x3777fb[_0x7b17('0x16')]=_0x21e56e['id'];}else if(_0x21e56e[_0x7b17('0x14')]===_0x7b17('0x17')){_0x3777fb[_0x7b17('0x18')]=_0x21e56e['id'];}}else if(_0x4deb17['ticketType']===_0x7b17('0x19')){if(_0x21e56e['endUserType']==='contact'){_0x3777fb['ContactId']=_0x21e56e['id'];}else if(_0x21e56e[_0x7b17('0x14')]==='account'){_0x3777fb['AccountId']=_0x21e56e['id'];}else if(_0x21e56e[_0x7b17('0x14')]===_0x7b17('0x15')&&_0x4deb17[_0x7b17('0x1a')]){_0x3777fb[_0x4deb17['leadId']]=_0x21e56e['id'];}else{logger[_0x7b17('0x1b')](_0x7b17('0x1c'));}}}return _0x416a90[_0x7b17('0x1d')](_0x4deb17[_0x7b17('0xe')])[_0x7b17('0x1e')](_0x3777fb);}function getUser(_0x5962ce,_0x909215,_0x30a544){if(!_[_0x7b17('0x1f')](_0x909215)&&intUtil[_0x7b17('0x20')](_0x909215)){var _0x14a58f={'Email':_0x909215};var _0x1fb279={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x30a544['sobject'](_0x7b17('0x21'))[_0x7b17('0x22')](_0x14a58f,_0x1fb279)['execute']()[_0x7b17('0x23')](function(_0x336336){if(_0x336336[_0x7b17('0x24')]){var _0x1fa4e3=_['find'](_0x336336,function(_0x4eb740){return _0x4eb740[_0x7b17('0x25')]===_0x909215;});if(_0x1fa4e3){logger['info'](_0x7b17('0x26'),_0x909215);return BPromise[_0x7b17('0x27')]({'id':_0x1fa4e3['Id'],'name':_0x1fa4e3['Name']});}}else{logger[_0x7b17('0x1b')](_0x7b17('0x28'),_0x909215);return _0x30a544[_0x7b17('0x29')]()['then'](function(_0x235c9c){return BPromise[_0x7b17('0x27')]({'id':_0x235c9c[_0x7b17('0x2a')],'name':_0x235c9c[_0x7b17('0x2b')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x909215);return _0x30a544['identity']()[_0x7b17('0x23')](function(_0x4be856){return BPromise[_0x7b17('0x27')]({'id':_0x4be856[_0x7b17('0x2a')],'name':_0x4be856[_0x7b17('0x2b')]});});}}function getEndUser(_0x3932a6,_0x34b10e,_0x147ff4,_0x168495,_0x5219d0){var _0x2a686a={'$or':{'Phone':_0x168495}};var _0x3b6cf8={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x7b17('0x23')](function(){logger[_0x7b17('0x1b')](_0x7b17('0x2c'),_0x168495,_0x34b10e[_0x7b17('0x2d')]);switch(_0x34b10e[_0x7b17('0x2d')]){case _0x7b17('0x2e'):var _0x4e79dc=_[_0x7b17('0x2f')](_0x2a686a);if(_0x34b10e[_0x7b17('0x30')]){var _0xc951f3={};_0xc951f3[_0x34b10e[_0x7b17('0x30')]]=_0x168495;_['merge'](_0x4e79dc[_0x7b17('0x31')],_0xc951f3);}return _0x5219d0[_0x7b17('0x1d')](_0x7b17('0x32'))[_0x7b17('0x22')](_0x4e79dc,_0x3b6cf8)[_0x7b17('0x33')]()[_0x7b17('0x23')](function(_0xd75706){if(_0xd75706&&_0xd75706['length']){return _0xd75706;}else{var _0x1d17be=_[_0x7b17('0x2f')](_0x2a686a);if(_0x34b10e[_0x7b17('0x34')]){var _0x4f4468={};_0x4f4468[_0x34b10e[_0x7b17('0x34')]]=_0x168495;_[_0x7b17('0x35')](_0x1d17be[_0x7b17('0x31')],_0x4f4468);}return _0x5219d0[_0x7b17('0x1d')](_0x7b17('0x36'))['find'](_0x1d17be,_0x3b6cf8);}});case'account_contact_lead':var _0x306562=_[_0x7b17('0x2f')](_0x2a686a);if(_0x34b10e[_0x7b17('0x37')]){var _0xc951f3={};_0xc951f3[_0x34b10e['additionalSearchAccount']]=_0x168495;_[_0x7b17('0x35')](_0x306562[_0x7b17('0x31')],_0xc951f3);}return _0x5219d0[_0x7b17('0x1d')](_0x7b17('0x38'))['find'](_0x306562,_0x3b6cf8)[_0x7b17('0x33')]()[_0x7b17('0x23')](function(_0x162655){if(_0x162655&&_0x162655[_0x7b17('0x24')]){return _0x162655;}else{var _0x29704b=_['cloneDeep'](_0x2a686a);if(_0x34b10e[_0x7b17('0x30')]){var _0x350846={};_0x350846[_0x34b10e[_0x7b17('0x30')]]=_0x168495;_[_0x7b17('0x35')](_0x29704b['$or'],_0x350846);}return _0x5219d0[_0x7b17('0x1d')](_0x7b17('0x32'))['find'](_0x29704b,_0x3b6cf8)[_0x7b17('0x23')](function(_0x5ba0b4){if(_0x5ba0b4&&_0x5ba0b4[_0x7b17('0x24')]){return _0x5ba0b4;}else{var _0x3e595b=_[_0x7b17('0x2f')](_0x2a686a);if(_0x34b10e[_0x7b17('0x34')]){var _0x53e615={};_0x53e615[_0x34b10e['additionalSearchLead']]=_0x168495;_[_0x7b17('0x35')](_0x3e595b['$or'],_0x53e615);}return _0x5219d0[_0x7b17('0x1d')](_0x7b17('0x36'))[_0x7b17('0x22')](_0x3e595b,_0x3b6cf8);}});}});case _0x7b17('0x13'):var _0x4e79dc=_['cloneDeep'](_0x2a686a);if(_0x34b10e[_0x7b17('0x30')]){var _0xc951f3={};_0xc951f3[_0x34b10e[_0x7b17('0x30')]]=_0x168495;_[_0x7b17('0x35')](_0x4e79dc[_0x7b17('0x31')],_0xc951f3);}return _0x5219d0[_0x7b17('0x1d')]('Contact')[_0x7b17('0x22')](_0x4e79dc,_0x3b6cf8)[_0x7b17('0x33')]();case'lead':var _0x167c1f=_[_0x7b17('0x2f')](_0x2a686a);if(_0x34b10e[_0x7b17('0x34')]){var _0xc951f3={};_0xc951f3[_0x34b10e[_0x7b17('0x34')]]=_0x168495;_[_0x7b17('0x35')](_0x167c1f[_0x7b17('0x31')],_0xc951f3);}return _0x5219d0[_0x7b17('0x1d')](_0x7b17('0x36'))[_0x7b17('0x22')](_0x167c1f,_0x3b6cf8);case _0x7b17('0x17'):var _0x306562=_[_0x7b17('0x2f')](_0x2a686a);if(_0x34b10e[_0x7b17('0x37')]){var _0xc951f3={};_0xc951f3[_0x34b10e[_0x7b17('0x37')]]=_0x168495;_[_0x7b17('0x35')](_0x306562['$or'],_0xc951f3);}return _0x5219d0[_0x7b17('0x1d')](_0x7b17('0x38'))['find'](_0x306562,_0x3b6cf8);default:return null;}})[_0x7b17('0x23')](function(_0x20d812){if(_0x20d812&&_0x20d812['length']){var _0x180c1a=_[_0x7b17('0x39')](_0x20d812);if(_0x180c1a){return BPromise['resolve']({'id':_0x180c1a['Id'],'name':_0x180c1a['Name'],'phone':_0x180c1a[_0x7b17('0x3a')],'endUserType':_0x180c1a[_0x7b17('0x3b')][_0x7b17('0x3c')][_0x7b17('0x3d')]()});}}})['then'](function(_0x3618c3){if(_0x3618c3){logger['info'](_0x7b17('0x3e'),_0x3618c3[_0x7b17('0x14')],_0x168495);return BPromise['resolve'](_0x3618c3);}else{logger[_0x7b17('0x1b')](_0x7b17('0x3f'),_0x168495);var _0xb0bb3f={'Phone':_0x168495};if(_0x34b10e[_0x7b17('0x40')]){if(_0x34b10e[_0x7b17('0x40')]===_0x7b17('0x13')){logger[_0x7b17('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x168495,_0x34b10e[_0x7b17('0x40')]);_0xb0bb3f[_0x7b17('0x41')]=_0x147ff4!==_0x7b17('0x42')?_0x147ff4:util['format']('Caller\x20-\x20%s',_0x168495);}else if(_0x34b10e['moduleCreate']==='lead'){logger['info'](_0x7b17('0x43'),_0x168495,_0x34b10e['moduleCreate']);_0xb0bb3f[_0x7b17('0x41')]=_0x147ff4!==_0x7b17('0x42')?_0x147ff4:util[_0x7b17('0x44')](_0x7b17('0x45'),_0x168495);_0xb0bb3f[_0x7b17('0x46')]=_0x7b17('0x47');}else if(_0x34b10e[_0x7b17('0x40')]===_0x7b17('0x17')){logger['info'](_0x7b17('0x43'),_0x168495,_0x34b10e[_0x7b17('0x40')]);_0xb0bb3f[_0x7b17('0x48')]=_0x147ff4!==''?_0x147ff4:util[_0x7b17('0x44')](_0x7b17('0x45'),_0x168495);}else{return null;}}return _0x5219d0['sobject'](_['upperFirst'](_0x34b10e[_0x7b17('0x40')]))[_0x7b17('0x1e')](_0xb0bb3f)[_0x7b17('0x23')](function(_0x38695e){return BPromise[_0x7b17('0x27')]({'id':_0x38695e['id'],'endUserType':_0x34b10e[_0x7b17('0x40')]});});}});}function getCustomFields(_0x307c8e,_0x55bad5){var _0x317b57={};if(_0x307c8e[_0x7b17('0x24')]>0x0){_[_0x7b17('0x49')](_0x307c8e,function(_0x33d7e1){if(_[_0x7b17('0x4a')]([_0x7b17('0x4b'),_0x7b17('0x4c')],_0x33d7e1[_0x7b17('0x3c')])&&_0x33d7e1[_0x7b17('0x4d')]){_0x317b57[_0x33d7e1[_0x7b17('0x4d')]]=_0x33d7e1[_0x7b17('0x4e')]['toString']();}else if(_0x33d7e1[_0x7b17('0x3c')]===_0x7b17('0x4f')&&_0x33d7e1[_0x7b17('0x50')]&&_0x33d7e1[_0x7b17('0x4d')]){_0x55bad5[_0x33d7e1['variableName']]&&(_0x317b57[_0x33d7e1[_0x7b17('0x4d')]]=_0x55bad5[_0x33d7e1['variableName']][_0x7b17('0x51')]());}else if(_0x33d7e1[_0x7b17('0x3c')]===_0x7b17('0x52')&&_0x33d7e1[_0x7b17('0x53')]&&_0x33d7e1[_0x7b17('0x53')]['name']&&_0x33d7e1['idField']){_0x55bad5[_0x33d7e1['Variable'][_0x7b17('0x54')][_0x7b17('0x3d')]()]&&(_0x317b57[_0x33d7e1[_0x7b17('0x4d')]]=_0x55bad5[_0x33d7e1[_0x7b17('0x53')][_0x7b17('0x54')][_0x7b17('0x3d')]()]['toString']());}});}return _0x317b57;}function getConnection(_0x1ee5e1){var _0xc24b0b=_0x1ee5e1['password'][_0x7b17('0x55')](_0x1ee5e1[_0x7b17('0x56')]);var _0x1b5155=new jsforce[(_0x7b17('0x57'))]({'oauth2':{'loginUrl':_0x1ee5e1['remoteUri']||_0x7b17('0x58'),'clientId':_0x1ee5e1['clientId'],'clientSecret':_0x1ee5e1[_0x7b17('0x59')]}});return _0x1b5155[_0x7b17('0x5a')](_0x1ee5e1[_0x7b17('0x5b')],_0xc24b0b)['then'](function(){logger[_0x7b17('0x1b')](_0x7b17('0x5c'));return _0x1b5155;});}exports[_0x7b17('0x5d')]=function(_0x30492d,_0xd3526,_0x4993ad,_0x3afe9c,_0xc85ea1,_0x8122bc){var _0x4a4cc4,_0x4f59b1,_0x1e0bd7,_0x376f7a;_0x8122bc[_0x7b17('0x5e')]=intUtil[_0x7b17('0x5f')](_0x8122bc[_0x7b17('0x5e')]);_0x8122bc[_0x7b17('0x60')]=intUtil[_0x7b17('0x5f')](_0x8122bc[_0x7b17('0x60')]);if(_0xc85ea1&&_0xc85ea1['monitor_format']){logger[_0x7b17('0x1b')](_0x7b17('0x61'),_0x7b17('0x62'));_0xd3526['recordingURL']=util[_0x7b17('0x44')](_0x7b17('0x63'),_0x8122bc[_0x7b17('0x5e')],_0xd3526[_0x7b17('0x64')],md5(_0xd3526['uniqueid']));}else{_0xd3526[_0x7b17('0x65')]='';}return getConnection(_0x8122bc)[_0x7b17('0x23')](function(_0x81937b){_0x376f7a=_0x81937b;return getUser(_0x8122bc,_0x3afe9c[_0x7b17('0x66')],_0x376f7a);})[_0x7b17('0x23')](function(_0x59ac05){_0x4a4cc4=_0x59ac05;return getEndUser(_0x8122bc,_0x4993ad,_0xd3526[_0x7b17('0x67')],_0xd3526['calleridnum'],_0x376f7a);})[_0x7b17('0x23')](function(_0x1318da){_0x4f59b1=_0x1318da;return getTicket(_0x8122bc,_0x4a4cc4,_0x4f59b1,_0x4993ad,_0xd3526,_0x4993ad[_0x7b17('0x68')],_0x376f7a,_0x7b17('0x5d'));})['then'](function(_0x58b9cd){_0x1e0bd7=_0x58b9cd;logger['info'](_0x7b17('0x69'),_0x1e0bd7['id']);logger[_0x7b17('0x1b')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1e0bd7['id'],_0x3afe9c[_0x7b17('0x54')],_0x8122bc[_0x7b17('0x3c')]);switch(_0x8122bc[_0x7b17('0x3c')]){case _0x7b17('0x6a'):emit(util[_0x7b17('0x44')](_0x7b17('0x6b'),_0x3afe9c[_0x7b17('0x54')]),_0x7b17('0x6c'),{'recordId':_0x1e0bd7['id']});break;case _0x7b17('0x6d'):emit(util[_0x7b17('0x44')](_0x7b17('0x6b'),_0x3afe9c[_0x7b17('0x54')]),'trigger:browser:url',{'uri':util[_0x7b17('0x44')](_0x7b17('0x6e'),_0x376f7a['instanceUrl'],_0x1e0bd7['id'])});break;default:logger[_0x7b17('0x6f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x7b17('0x70')](function(_0x5a794e){logger[_0x7b17('0x6f')]('[QUEUE]',_0x5a794e);});};exports[_0x7b17('0x71')]=function(_0x322e9f,_0x263017,_0x4c54c9,_0x5743aa,_0x1d4f83,_0x4d598,_0x47be76){var _0x46bb9e,_0x18ca89,_0x5c03bb,_0x23916b;_0x4d598[_0x7b17('0x5e')]=intUtil[_0x7b17('0x5f')](_0x4d598[_0x7b17('0x5e')]);_0x4d598[_0x7b17('0x60')]=intUtil[_0x7b17('0x5f')](_0x4d598['remoteUri']);if(_0x47be76&&_0x47be76[_0x7b17('0x72')]&&_0x47be76['recordingFormat']!=='none'){logger[_0x7b17('0x1b')]('[OUTBOUND]',_0x7b17('0x62'));_0x263017[_0x7b17('0x65')]=util[_0x7b17('0x44')](_0x7b17('0x63'),_0x4d598['serverUrl'],_0x263017[_0x7b17('0x64')],md5(_0x263017['uniqueid']));}return getConnection(_0x4d598)[_0x7b17('0x23')](function(_0xa9e241){_0x23916b=_0xa9e241;return getUser(_0x4d598,_0x5743aa['email'],_0x23916b);})[_0x7b17('0x23')](function(_0x469d41){_0x46bb9e=_0x469d41;return getEndUser(_0x4d598,_0x4c54c9,_0x263017[_0x7b17('0x73')],_0x263017[_0x7b17('0x74')],_0x23916b);})[_0x7b17('0x23')](function(_0x1aafce){_0x18ca89=_0x1aafce;return getTicket(_0x4d598,_0x46bb9e,_0x18ca89,_0x4c54c9,_0x263017,_0x4c54c9[_0x7b17('0x68')],_0x23916b,_0x7b17('0x71'));})[_0x7b17('0x23')](function(_0x1c58e2){_0x5c03bb=_0x1c58e2;logger[_0x7b17('0x1b')](_0x7b17('0x75'),_0x5c03bb['id']);logger[_0x7b17('0x1b')](_0x7b17('0x76'),_0x5c03bb['id'],_0x5743aa[_0x7b17('0x54')],_0x4d598[_0x7b17('0x3c')]);switch(_0x4d598[_0x7b17('0x3c')]){case _0x7b17('0x6a'):emit(util[_0x7b17('0x44')](_0x7b17('0x6b'),_0x5743aa[_0x7b17('0x54')]),'trigger:salesforce:display',{'recordId':_0x5c03bb['id']});break;case _0x7b17('0x6d'):emit(util[_0x7b17('0x44')](_0x7b17('0x6b'),_0x5743aa[_0x7b17('0x54')]),'trigger:browser:url',{'uri':util[_0x7b17('0x44')](_0x7b17('0x6e'),_0x23916b[_0x7b17('0x77')],_0x5c03bb['id'])});break;default:logger['error'](_0x7b17('0x78'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x7b17('0x70')](function(_0xf6cf25){logger['error']('[OUTBOUND]',_0xf6cf25);});};exports[_0x7b17('0x79')]=function(_0x4e085e,_0x45fc2a,_0x254997,_0x3f0ffe,_0x21ff80,_0x486435){var _0x4e1124,_0x5baafe,_0x53b5c6,_0xbb494a;_0x486435['serverUrl']=intUtil[_0x7b17('0x5f')](_0x486435[_0x7b17('0x5e')]);_0x486435[_0x7b17('0x60')]=intUtil['stripTrailingSlash'](_0x486435[_0x7b17('0x60')]);if(_0x21ff80&&_0x21ff80[_0x7b17('0x7a')]){logger[_0x7b17('0x1b')]('['+_0x45fc2a[_0x7b17('0x7b')][_0x7b17('0x7c')]()+']','Recording\x20is\x20enabled!');_0x45fc2a[_0x7b17('0x65')]=util['format'](_0x7b17('0x63'),_0x486435[_0x7b17('0x5e')],_0x45fc2a[_0x7b17('0x64')],md5(_0x45fc2a['uniqueid']));}else{_0x45fc2a[_0x7b17('0x65')]='';}return getConnection(_0x486435)[_0x7b17('0x23')](function(_0x565707){_0xbb494a=_0x565707;if(!_[_0x7b17('0x1f')](_0x3f0ffe)){return getUser(_0x486435,_0x3f0ffe[_0x7b17('0x54')],_0xbb494a);}else{return getUser(_0x486435,null,_0xbb494a);}})[_0x7b17('0x23')](function(_0x45a7ac){_0x4e1124=_0x45a7ac;return getEndUser(_0x486435,_0x254997,_0x45fc2a[_0x7b17('0x67')],_0x45fc2a[_0x7b17('0x7d')],_0xbb494a);})['then'](function(_0x38e63a){_0x5baafe=_0x38e63a;return getTicket(_0x486435,_0x4e1124,_0x5baafe,_0x254997,_0x45fc2a,_0x254997['Fields'],_0xbb494a);})['then'](function(_0x34f213){_0x53b5c6=_0x34f213;logger[_0x7b17('0x1b')]('['+_0x45fc2a[_0x7b17('0x7b')][_0x7b17('0x7c')]()+']\x20Ticket\x20%s\x20created.',_0x53b5c6['id']);logger['info']('['+_0x45fc2a[_0x7b17('0x7b')][_0x7b17('0x7c')]()+_0x7b17('0x7e'),_0x486435[_0x7b17('0x3c')]);})[_0x7b17('0x70')](function(_0x1afa78){logger[_0x7b17('0x6f')]('['+_0x45fc2a[_0x7b17('0x7b')][_0x7b17('0x7c')]()+']',_0x1afa78);});}; \ 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 b7e9723..9bd042a 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 _0xd7ac=['variable','variableName','customVariable','name','Variable','outbound','incident','assign','getString','Subjects',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketNumber','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/logger','redis','defaults','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','sys_id','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','adminEmail','POST','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','type','customField','nameField','toLowerCase','content','toString','picklist','idField'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xd7ac,0x1ef));var _0xcd7a=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xd7ac[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xcd7a('0x0'));var Promise=require(_0xcd7a('0x1'));var rp=require(_0xcd7a('0x2'));var util=require(_0xcd7a('0x3'));var md5=require(_0xcd7a('0x4'));var Redis=require(_0xcd7a('0x5'));var intUtil=require(_0xcd7a('0x6'));var config=require('../../../../config/environment');var logger=require(_0xcd7a('0x7'))('servicenow');config[_0xcd7a('0x8')]=_[_0xcd7a('0x9')](config[_0xcd7a('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcd7a('0x8')]));function getAdminUser(_0x45fe43,_0x4d8701,_0x259ffe,_0x75193a,_0x234e26,_0xcc4229){return new Promise(function(_0x49d38a,_0x4f25e4){var _0x226736={'method':'GET','uri':_0x75193a+_0xcd7a('0xa')+'&'+_0x234e26+'&'+_0xcc4229,'auth':_0x4d8701,'json':!![]};return rp(_0x226736)[_0xcd7a('0xb')](function(_0x323650){if(_0x323650[_0xcd7a('0xc')][_0xcd7a('0xd')]>0x0){_0x259ffe[_0xcd7a('0xe')]=_0x323650[_0xcd7a('0xc')][0x0]['sys_id'];}logger[_0xcd7a('0xf')]('['+[_0x45fe43[_0xcd7a('0x10')]()]+_0xcd7a('0x11'),_0x259ffe);_0x49d38a(_0x259ffe);})['catch'](function(_0x352e31){logger[_0xcd7a('0x12')]('['+[_0x45fe43[_0xcd7a('0x10')]()]+']',_0x352e31['message']);_0x4f25e4(_0x352e31[_0xcd7a('0x13')]);});});}function getUser(_0x5da35e,_0x219898,_0x38e084,_0x21fd1a,_0x89c648){return function(_0x1db273){logger[_0xcd7a('0xf')]('['+[_0x5da35e[_0xcd7a('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x1db273);return new Promise(function(_0x3b6707,_0x25e4c2){if(intUtil[_0xcd7a('0x14')](_0x1db273[_0xcd7a('0x15')])){var _0x5b6189={'method':_0xcd7a('0x16'),'uri':_0x38e084+_0xcd7a('0x17')+_0x1db273[_0xcd7a('0x15')]+'&'+_0x21fd1a+'&'+_0x89c648,'auth':_0x219898,'json':!![]};logger[_0xcd7a('0xf')]('['+[_0x5da35e[_0xcd7a('0x10')]()]+_0xcd7a('0x18'),_0x5b6189);return rp(_0x5b6189)['then'](function(_0x2b880f){logger['info']('['+[_0x5da35e[_0xcd7a('0x10')]()]+_0xcd7a('0x19'),_0x2b880f);if(_0x2b880f[_0xcd7a('0xc')][_0xcd7a('0xd')]>0x0&&String(_0x2b880f[_0xcd7a('0xc')][0x0][_0xcd7a('0x1a')])===_0xcd7a('0x1b')){_0x1db273[_0xcd7a('0x1c')]=_0x2b880f['result'][0x0][_0xcd7a('0x1d')];}else{_0x1db273['userId']=_0x1db273['adminId'];_0x1db273[_0xcd7a('0x15')]=_0x1db273['adminEmail'];}logger[_0xcd7a('0xf')]('['+[_0x5da35e[_0xcd7a('0x10')]()]+_0xcd7a('0x1e'),_0x1db273);_0x3b6707(_0x1db273);})[_0xcd7a('0x1f')](function(_0x3aa95b){logger[_0xcd7a('0x12')]('['+[_0x5da35e['toUpperCase']()]+']',_0x3aa95b['message']);_0x25e4c2(_0x3aa95b[_0xcd7a('0x13')]);});}else{logger[_0xcd7a('0xf')]('['+[_0x5da35e[_0xcd7a('0x10')]()]+_0xcd7a('0x20'));_0x1db273[_0xcd7a('0x1c')]=_0x1db273[_0xcd7a('0xe')];_0x1db273[_0xcd7a('0x15')]=_0x1db273[_0xcd7a('0x21')];_0x3b6707(_0x1db273);}});};}function createEndUser(_0x4d2d75,_0x540881,_0x5cd229,_0x1e34d6,_0x4cbf52){logger[_0xcd7a('0xf')]('['+[_0x4d2d75[_0xcd7a('0x10')]()]+'],\x20createEndUser\x20input\x20crm',_0x5cd229);return new Promise(function(_0x2b65b9,_0x58b11a){var _0x2ce46e={'method':_0xcd7a('0x22'),'uri':_0x1e34d6+_0xcd7a('0x23')+_0x4cbf52,'body':{'user_name':_0x5cd229[_0xcd7a('0x24')],'roles':_0xcd7a('0x25'),'first_name':_0x5cd229[_0xcd7a('0x24')],'active':'true','date_format':_0xcd7a('0x26'),'phone':_0x5cd229['endUserNumber']},'auth':_0x540881,'json':!![]};return rp(_0x2ce46e)['then'](function(_0x4563ef){logger[_0xcd7a('0xf')]('['+[_0x4d2d75[_0xcd7a('0x10')]()]+'],\x20EndUser\x20schema',_0x4563ef[_0xcd7a('0xc')]);_0x5cd229[_0xcd7a('0x27')]=_0x4563ef[_0xcd7a('0xc')][_0xcd7a('0x1d')];_0x2b65b9(_0x5cd229);})[_0xcd7a('0x1f')](function(_0x444bd5){logger['error']('['+[_0x4d2d75[_0xcd7a('0x10')]()]+']',_0x444bd5[_0xcd7a('0x13')]);_0x58b11a(_0x444bd5[_0xcd7a('0x13')]);});});}function getEndUser(_0x6f4135,_0x3c2870,_0x238ebe,_0x4b6e54,_0x3efb75){return function(_0x4efd98){logger[_0xcd7a('0xf')]('['+[_0x6f4135[_0xcd7a('0x10')]()]+_0xcd7a('0x28'),_0x4efd98);return new Promise(function(_0x1ba08f,_0x4da4b6){var _0x555a16={'method':'GET','uri':_0x238ebe+_0xcd7a('0x29')+_0x4efd98['endUserNumber']+'&'+_0x4b6e54+'&'+_0x3efb75,'auth':_0x3c2870,'json':!![]};return rp(_0x555a16)['then'](function(_0x2351fa){if(_0x2351fa['result'][_0xcd7a('0xd')]>0x0){_0x4efd98[_0xcd7a('0x27')]=_0x2351fa[_0xcd7a('0xc')][0x0][_0xcd7a('0x1d')];logger[_0xcd7a('0xf')]('['+[_0x6f4135['toUpperCase']()]+_0xcd7a('0x2a'),_0x4efd98);_0x1ba08f(_0x4efd98);}else{return createEndUser(_0x6f4135,_0x3c2870,_0x4efd98,_0x238ebe,_0x4b6e54)[_0xcd7a('0xb')](function(_0x2063c7){logger['info']('['+[_0x6f4135[_0xcd7a('0x10')]()]+_0xcd7a('0x2b'),_0x2063c7);_0x1ba08f(_0x2063c7);});}})['catch'](function(_0xd6f287){logger[_0xcd7a('0x12')]('['+[_0x6f4135[_0xcd7a('0x10')]()]+']',_0xd6f287[_0xcd7a('0x13')]);_0x4da4b6(_0xd6f287['message']);});});};}function getCustomFields(_0x5de65a,_0x38c85e){var _0x23beff={};if(_0x5de65a[_0xcd7a('0xd')]>0x0){_[_0xcd7a('0x2c')](_0x5de65a,function(_0x56cf34){if(_[_0xcd7a('0x2d')]([_0xcd7a('0x2e'),'picklist'],_0x56cf34[_0xcd7a('0x2f')])&&_0x56cf34['nameField']&&!_0x56cf34[_0xcd7a('0x30')]){_0x23beff[_0x56cf34[_0xcd7a('0x31')][_0xcd7a('0x32')]()]=_0x56cf34[_0xcd7a('0x33')][_0xcd7a('0x34')]();}else if(_[_0xcd7a('0x2d')](['string',_0xcd7a('0x35')],_0x56cf34[_0xcd7a('0x2f')])&&_0x56cf34[_0xcd7a('0x36')]&&_0x56cf34['customField']){_0x23beff[_0x56cf34[_0xcd7a('0x36')]['toLowerCase']()]=_0x56cf34[_0xcd7a('0x33')][_0xcd7a('0x34')]();}else if(_0x56cf34[_0xcd7a('0x2f')]===_0xcd7a('0x37')&&_0x56cf34['variableName']&&_0x56cf34[_0xcd7a('0x36')]&&_0x56cf34[_0xcd7a('0x30')]){_0x23beff[_0x56cf34[_0xcd7a('0x36')][_0xcd7a('0x32')]()]=_0x38c85e[_0x56cf34[_0xcd7a('0x38')]]['toString']();}else if(_0x56cf34[_0xcd7a('0x2f')]===_0xcd7a('0x39')&&_0x56cf34['Variable']&&_0x56cf34['Variable'][_0xcd7a('0x3a')]&&_0x56cf34[_0xcd7a('0x36')]&&_0x56cf34[_0xcd7a('0x30')]){_0x23beff[_0x56cf34['idField'][_0xcd7a('0x32')]()]=_0x38c85e[_0x56cf34[_0xcd7a('0x3b')][_0xcd7a('0x3a')]['toLowerCase']()][_0xcd7a('0x34')]();}});}return _0x23beff;}function getTicket(_0x3de778,_0x4abde2,_0x3e0018,_0x2fd188,_0x36a379,_0x1f4706){return function(_0x28ab47){logger[_0xcd7a('0xf')]('['+[_0x3de778[_0xcd7a('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x28ab47);return new Promise(function(_0x3b391c,_0x37a5d0){var _0x4dbcf9=_0x3de778[_0xcd7a('0x32')]()===_0xcd7a('0x3c')?_0x28ab47['userId']:_0x28ab47[_0xcd7a('0x27')];var _0x161a68={'method':_0xcd7a('0x22'),'uri':_0x3e0018+_0xcd7a('0x3d')+'?'+_0x1f4706,'body':Object[_0xcd7a('0x3e')]({},{'active':_0xcd7a('0x1b'),'caller_id':_0x4dbcf9,'assigned_to':_0x28ab47[_0xcd7a('0x1c')],'short_description':intUtil[_0xcd7a('0x3f')](_0x2fd188[_0xcd7a('0x40')],_0x36a379,'\x20'),'description':intUtil[_0xcd7a('0x3f')](_0x2fd188['Descriptions'],_0x36a379,'\x0a')},getCustomFields(_0x2fd188['Fields'],_0x36a379)),'auth':_0x4abde2,'json':!![]};return rp(_0x161a68)['then'](function(_0xd6e657){logger[_0xcd7a('0xf')]('['+[_0x3de778[_0xcd7a('0x10')]()]+_0xcd7a('0x41'),_0xd6e657[_0xcd7a('0xc')]);_0x28ab47[_0xcd7a('0x42')]=_0xd6e657[_0xcd7a('0xc')][_0xcd7a('0x1d')];_0x28ab47['ticketNumber']=_0xd6e657[_0xcd7a('0xc')][_0xcd7a('0x43')];logger['info']('['+[_0x3de778[_0xcd7a('0x10')]()]+_0xcd7a('0x44'),_0x28ab47);_0x3b391c(_0x28ab47);})[_0xcd7a('0x1f')](function(_0x125c66){logger[_0xcd7a('0x12')]('['+[_0x3de778[_0xcd7a('0x10')]()]+']',_0x125c66[_0xcd7a('0x13')]);_0x37a5d0(_0x125c66[_0xcd7a('0x13')]);});});};}function createRemoteTag(_0x4f987f,_0x116f93,_0x5351c2,_0x426be5){return new Promise(function(_0x4feb6e,_0x548054){var _0x2a30bd={'method':'POST','uri':_0x5351c2+_0xcd7a('0x45')+'?'+_0x426be5,'body':{'short_description':_0x4f987f,'global':!![],'active':!![],'name':_0x4f987f},'auth':_0x116f93,'json':!![]};return rp(_0x2a30bd)[_0xcd7a('0xb')](function(_0x118e18){var _0x3b25a2=_0x118e18['result'][_0xcd7a('0x1d')];_0x4feb6e(_0x3b25a2);});});}function getRemoteTag(_0x1d1384,_0x16f224,_0x483be7,_0x19c927,_0x4c2615){return new Promise(function(_0x51c9aa,_0x5292c3){var _0x563c5d={'method':_0xcd7a('0x16'),'uri':_0x483be7+_0xcd7a('0x45')+_0xcd7a('0x46')+_0x1d1384+'&'+_0x19c927,'auth':_0x16f224,'json':!![]};return rp(_0x563c5d)[_0xcd7a('0xb')](function(_0x95864d){if(_0x95864d['result']['length']>0x0){var _0x25063c=_0x95864d[_0xcd7a('0xc')][0x0][_0xcd7a('0x1d')];_0x51c9aa(_0x25063c);}else{return createRemoteTag(_0x1d1384,_0x16f224,_0x483be7,_0x19c927)[_0xcd7a('0xb')](function(_0x408a44){_0x51c9aa(_0x408a44);});}});});}function assignTagToIncident(_0x540a1e,_0x37d655,_0x2d9c4d,_0x493a3d,_0x4d23f7){return new Promise(function(_0x44876d,_0x46f8ae){var _0xe18ee3={'method':_0xcd7a('0x22'),'uri':_0x2d9c4d+_0xcd7a('0x47')+'?'+_0x4d23f7,'body':{'label':_0x540a1e,'table':'incident','id_type':_0xcd7a('0x48'),'table_key':_0x493a3d[_0xcd7a('0x42')],'title':'Incident\x20-\x20'+_0x493a3d[_0xcd7a('0x49')],'id_display':_0x493a3d[_0xcd7a('0x49')]},'auth':_0x37d655,'json':!![]};return rp(_0xe18ee3)[_0xcd7a('0xb')](function(_0x57e8bb){_0x44876d();})[_0xcd7a('0x1f')](function(){_0x44876d();});});}function manageTags(_0x57491b,_0xfefd6e,_0x4ff33b,_0x4b0ee5,_0x3967c2,_0x4a0cd3,_0x380c98){return new Promise(function(_0x2cef13,_0x3c4585){var _0xec76ce=[];_0xfefd6e[_0xcd7a('0x2c')](function(_0x7aa845){_0xec76ce[_0xcd7a('0x4a')](getRemoteTag(_0x7aa845,_0x4ff33b,_0x4b0ee5,_0x4a0cd3,_0x380c98));});return Promise[_0xcd7a('0x4b')](_0xec76ce)['then'](function(_0x36f86b){if(_0x36f86b[_0xcd7a('0xd')]){logger[_0xcd7a('0xf')]('['+[_0x57491b['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x36f86b);var _0x5ab2dc=[];_0x36f86b[_0xcd7a('0x2c')](function(_0x5695ce){_0x5ab2dc['push'](assignTagToIncident(_0x5695ce,_0x4ff33b,_0x4b0ee5,_0x3967c2,_0x4a0cd3));});return Promise['all'](_0x5ab2dc)['then'](function(){_0x2cef13();})[_0xcd7a('0x1f')](function(){_0x2cef13();});}else{_0x2cef13();}});});}function getTags(_0x334659,_0x405320,_0x32a634,_0x46f1ff,_0x305245,_0x16db85){return function(_0x371716){return new Promise(function(_0x25d220,_0x135f75){var _0xc8aa6c=[];var _0x453849=_0x46f1ff[_0xcd7a('0x4c')];if(_0x453849&&_0x453849[_0xcd7a('0xd')]>0x0){_0xc8aa6c=_[_0xcd7a('0x4d')](_0x453849,_0xcd7a('0x3a'));}if(_0xc8aa6c[_0xcd7a('0xd')]>0x0){return manageTags(_0x334659,_0xc8aa6c,_0x405320,_0x32a634,_0x371716,_0x305245,_0x16db85)[_0xcd7a('0xb')](function(){_0x25d220(_0x371716);});}else{_0x25d220(_0x371716);}});};}function emit(_0x1b538c,_0x183ac3,_0x223234){var _0x1a4904=_0xcd7a('0x4e')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xcd7a('0x4f')+_0xcd7a('0x50');var _0x81a7dd={'uri':_0x1b538c+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x223234+_0x1a4904};io['to'](util[_0xcd7a('0x51')](_0xcd7a('0x52'),_0x183ac3))[_0xcd7a('0x53')](_0xcd7a('0x54'),_0x81a7dd);}exports['cs']=function(_0x4504f1,_0x46f08d,_0x174b8a,_0x385c1a,_0x3df990,_0x288b48,_0x90a14c,_0x36dc41){var _0x46ca43={};var _0x36b57f={'user':_0x288b48['username'],'pass':_0x288b48['password']};var _0x1c84b4=_0xcd7a('0x55');var _0x4dccc9=_0xcd7a('0x56');_0x288b48[_0xcd7a('0x57')]=intUtil[_0xcd7a('0x58')](_0x288b48[_0xcd7a('0x57')]);_0x288b48[_0xcd7a('0x59')]=intUtil[_0xcd7a('0x58')](_0x288b48[_0xcd7a('0x59')]);var _0x49fdf9=util['format']('%s/api/now/table/',_0x288b48['remoteUri']);_0x46ca43[_0xcd7a('0x15')]=!_[_0xcd7a('0x5a')](_0x385c1a)?_0x385c1a[_0xcd7a('0x5b')]:null;_0x46ca43[_0xcd7a('0x21')]=_0x288b48[_0xcd7a('0x5b')];_0x46ca43[_0xcd7a('0x24')]=_0x36dc41[_0xcd7a('0x32')]()===_0xcd7a('0x3c')?_0x46f08d[_0xcd7a('0x5c')]:_0x46f08d[_0xcd7a('0x5d')];_0x46ca43[_0xcd7a('0x5e')]=_0x36dc41===_0xcd7a('0x5f')||_0x36dc41===_0xcd7a('0x60')?'queue':_0xcd7a('0x3c');var _0x53d48c=util[_0xcd7a('0x51')](_0xcd7a('0x61'),_0x288b48[_0xcd7a('0x59')],_0x46f08d['uniqueid'],md5(_0x46f08d[_0xcd7a('0x62')]));if(_0x3df990&&_0x3df990[_0xcd7a('0x63')]){logger[_0xcd7a('0xf')](_0xcd7a('0x64'),_0xcd7a('0x65'));_0x46f08d[_0xcd7a('0x66')]=_0x53d48c;}else if(_0x90a14c&&_0x90a14c[_0xcd7a('0x67')]&&_0x90a14c['recordingFormat']!==_0xcd7a('0x68')){logger[_0xcd7a('0xf')]('[OUTBOUND]',_0xcd7a('0x65'));_0x46f08d[_0xcd7a('0x66')]=_0x53d48c;}else{_0x46f08d[_0xcd7a('0x66')]='';}return getAdminUser(_0x36dc41,_0x36b57f,_0x46ca43,_0x49fdf9,_0x4dccc9,_0x1c84b4)[_0xcd7a('0xb')](getUser(_0x36dc41,_0x36b57f,_0x49fdf9,_0x4dccc9,_0x1c84b4))[_0xcd7a('0xb')](getEndUser(_0x36dc41,_0x36b57f,_0x49fdf9,_0x4dccc9,_0x1c84b4))[_0xcd7a('0xb')](getTicket(_0x36dc41,_0x36b57f,_0x49fdf9,_0x174b8a,_0x46f08d,_0x4dccc9))[_0xcd7a('0xb')](function(_0x3bd159){logger[_0xcd7a('0xf')](util['format'](_0xcd7a('0x69'),_0x3bd159['ticketId']));logger[_0xcd7a('0xf')](util[_0xcd7a('0x51')](_0xcd7a('0x6a'),_0x36dc41));if(_0x36dc41!==_0xcd7a('0x60')){logger[_0xcd7a('0xf')]('['+[_0x36dc41[_0xcd7a('0x10')]()]+']',_0xcd7a('0x6b'));emit(_0x288b48[_0xcd7a('0x57')],_0x385c1a['name'],_0x3bd159[_0xcd7a('0x42')]);}})[_0xcd7a('0x1f')](function(_0x636584){logger[_0xcd7a('0x12')]('['+[_0x36dc41[_0xcd7a('0x10')]()]+_0xcd7a('0x6c'),util[_0xcd7a('0x6d')](_0x636584,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x65c7=['format','%s/api/now/table/','isNil','email','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','./util','../../../../config/logger','servicenow','redis','defaults','localhost','result','adminId','toUpperCase','],\x20getAdminUser\x20crm','catch','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','then','endUserId','sys_id','],\x20getEndUser\x20input\x20crm','GET','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','picklist','type','customField','nameField','toLowerCase','content','toString','includes','string','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','all','forEach','push','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','emit','trigger:browser:url','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash'];(function(_0x3722f4,_0x339f56){var _0x546e88=function(_0x3952fe){while(--_0x3952fe){_0x3722f4['push'](_0x3722f4['shift']());}};_0x546e88(++_0x339f56);}(_0x65c7,0x137));var _0x765c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x65c7[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var Promise=require(_0x765c('0x0'));var rp=require(_0x765c('0x1'));var util=require(_0x765c('0x2'));var md5=require(_0x765c('0x3'));var Redis=require('ioredis');var intUtil=require(_0x765c('0x4'));var config=require('../../../../config/environment');var logger=require(_0x765c('0x5'))(_0x765c('0x6'));config[_0x765c('0x7')]=_[_0x765c('0x8')](config[_0x765c('0x7')],{'host':_0x765c('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x765c('0x7')]));function getAdminUser(_0x2c29fe,_0x325f4f,_0x483fd5,_0x5aefcf,_0xc2d00c,_0x739d66){return new Promise(function(_0x245533,_0x5c0d6c){var _0x221031={'method':'GET','uri':_0x5aefcf+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0xc2d00c+'&'+_0x739d66,'auth':_0x325f4f,'json':!![]};return rp(_0x221031)['then'](function(_0x4e69ea){if(_0x4e69ea[_0x765c('0xa')]['length']>0x0){_0x483fd5[_0x765c('0xb')]=_0x4e69ea[_0x765c('0xa')][0x0]['sys_id'];}logger['info']('['+[_0x2c29fe[_0x765c('0xc')]()]+_0x765c('0xd'),_0x483fd5);_0x245533(_0x483fd5);})[_0x765c('0xe')](function(_0x446d4a){logger['error']('['+[_0x2c29fe[_0x765c('0xc')]()]+']',_0x446d4a[_0x765c('0xf')]);_0x5c0d6c(_0x446d4a[_0x765c('0xf')]);});});}function getUser(_0x2a79b0,_0x41f441,_0x27c774,_0x4bfb18,_0x429a1c){return function(_0x432854){logger[_0x765c('0x10')]('['+[_0x2a79b0[_0x765c('0xc')]()]+_0x765c('0x11'),_0x432854);return new Promise(function(_0x4aac47,_0x257937){if(intUtil[_0x765c('0x12')](_0x432854[_0x765c('0x13')])){var _0x35b810={'method':'GET','uri':_0x27c774+'sys_user?sysparm_query=email%3D'+_0x432854[_0x765c('0x13')]+'&'+_0x4bfb18+'&'+_0x429a1c,'auth':_0x41f441,'json':!![]};logger[_0x765c('0x10')]('['+[_0x2a79b0[_0x765c('0xc')]()]+_0x765c('0x14'),_0x35b810);return rp(_0x35b810)['then'](function(_0x4c9b03){logger[_0x765c('0x10')]('['+[_0x2a79b0[_0x765c('0xc')]()]+_0x765c('0x15'),_0x4c9b03);if(_0x4c9b03[_0x765c('0xa')][_0x765c('0x16')]>0x0&&String(_0x4c9b03[_0x765c('0xa')][0x0]['active'])==='true'){_0x432854[_0x765c('0x17')]=_0x4c9b03[_0x765c('0xa')][0x0]['sys_id'];}else{_0x432854[_0x765c('0x17')]=_0x432854[_0x765c('0xb')];_0x432854[_0x765c('0x13')]=_0x432854[_0x765c('0x18')];}logger['info']('['+[_0x2a79b0[_0x765c('0xc')]()]+_0x765c('0x19'),_0x432854);_0x4aac47(_0x432854);})['catch'](function(_0x5ab667){logger[_0x765c('0x1a')]('['+[_0x2a79b0[_0x765c('0xc')]()]+']',_0x5ab667[_0x765c('0xf')]);_0x257937(_0x5ab667[_0x765c('0xf')]);});}else{logger[_0x765c('0x10')]('['+[_0x2a79b0[_0x765c('0xc')]()]+_0x765c('0x1b'));_0x432854['userId']=_0x432854[_0x765c('0xb')];_0x432854[_0x765c('0x13')]=_0x432854[_0x765c('0x18')];_0x4aac47(_0x432854);}});};}function createEndUser(_0x4d0238,_0x114df8,_0x696c47,_0x3cbdc8,_0x4cd09d){logger['info']('['+[_0x4d0238['toUpperCase']()]+_0x765c('0x1c'),_0x696c47);return new Promise(function(_0x10a645,_0x17a4fa){var _0x24b46e={'method':_0x765c('0x1d'),'uri':_0x3cbdc8+'sys_user?'+_0x4cd09d,'body':{'user_name':_0x696c47[_0x765c('0x1e')],'roles':_0x765c('0x1f'),'first_name':_0x696c47[_0x765c('0x1e')],'active':'true','date_format':_0x765c('0x20'),'phone':_0x696c47[_0x765c('0x1e')]},'auth':_0x114df8,'json':!![]};return rp(_0x24b46e)[_0x765c('0x21')](function(_0x2d4a76){logger[_0x765c('0x10')]('['+[_0x4d0238[_0x765c('0xc')]()]+'],\x20EndUser\x20schema',_0x2d4a76[_0x765c('0xa')]);_0x696c47[_0x765c('0x22')]=_0x2d4a76[_0x765c('0xa')][_0x765c('0x23')];_0x10a645(_0x696c47);})[_0x765c('0xe')](function(_0xe1d98c){logger['error']('['+[_0x4d0238['toUpperCase']()]+']',_0xe1d98c[_0x765c('0xf')]);_0x17a4fa(_0xe1d98c[_0x765c('0xf')]);});});}function getEndUser(_0x3f9ce5,_0xc49985,_0x2b39c6,_0x2717c2,_0x5191b9){return function(_0x3ae1b0){logger[_0x765c('0x10')]('['+[_0x3f9ce5[_0x765c('0xc')]()]+_0x765c('0x24'),_0x3ae1b0);return new Promise(function(_0x5091ea,_0x42b51c){var _0x5c3ada={'method':_0x765c('0x25'),'uri':_0x2b39c6+_0x765c('0x26')+_0x3ae1b0[_0x765c('0x1e')]+'&'+_0x2717c2+'&'+_0x5191b9,'auth':_0xc49985,'json':!![]};return rp(_0x5c3ada)[_0x765c('0x21')](function(_0xb8ab45){if(_0xb8ab45[_0x765c('0xa')]['length']>0x0){_0x3ae1b0[_0x765c('0x22')]=_0xb8ab45['result'][0x0][_0x765c('0x23')];logger[_0x765c('0x10')]('['+[_0x3f9ce5[_0x765c('0xc')]()]+_0x765c('0x27'),_0x3ae1b0);_0x5091ea(_0x3ae1b0);}else{return createEndUser(_0x3f9ce5,_0xc49985,_0x3ae1b0,_0x2b39c6,_0x2717c2)['then'](function(_0x11b2e5){logger[_0x765c('0x10')]('['+[_0x3f9ce5['toUpperCase']()]+_0x765c('0x28'),_0x11b2e5);_0x5091ea(_0x11b2e5);});}})['catch'](function(_0x41ef53){logger[_0x765c('0x1a')]('['+[_0x3f9ce5[_0x765c('0xc')]()]+']',_0x41ef53['message']);_0x42b51c(_0x41ef53[_0x765c('0xf')]);});});};}function getCustomFields(_0x2bf45e,_0x5ab9fe){var _0x883dcc={};if(_0x2bf45e[_0x765c('0x16')]>0x0){_['forEach'](_0x2bf45e,function(_0x238dc2){if(_['includes'](['string',_0x765c('0x29')],_0x238dc2[_0x765c('0x2a')])&&_0x238dc2['nameField']&&!_0x238dc2[_0x765c('0x2b')]){_0x883dcc[_0x238dc2[_0x765c('0x2c')][_0x765c('0x2d')]()]=_0x238dc2[_0x765c('0x2e')][_0x765c('0x2f')]();}else if(_[_0x765c('0x30')]([_0x765c('0x31'),_0x765c('0x29')],_0x238dc2[_0x765c('0x2a')])&&_0x238dc2[_0x765c('0x32')]&&_0x238dc2[_0x765c('0x2b')]){_0x883dcc[_0x238dc2[_0x765c('0x32')][_0x765c('0x2d')]()]=_0x238dc2[_0x765c('0x2e')][_0x765c('0x2f')]();}else if(_0x238dc2['type']===_0x765c('0x33')&&_0x238dc2[_0x765c('0x34')]&&_0x238dc2[_0x765c('0x32')]&&_0x238dc2['customField']){_0x883dcc[_0x238dc2['idField'][_0x765c('0x2d')]()]=_0x5ab9fe[_0x238dc2[_0x765c('0x34')]][_0x765c('0x2f')]();}else if(_0x238dc2[_0x765c('0x2a')]===_0x765c('0x35')&&_0x238dc2['Variable']&&_0x238dc2[_0x765c('0x36')][_0x765c('0x37')]&&_0x238dc2[_0x765c('0x32')]&&_0x238dc2[_0x765c('0x2b')]){_0x883dcc[_0x238dc2['idField'][_0x765c('0x2d')]()]=_0x5ab9fe[_0x238dc2[_0x765c('0x36')][_0x765c('0x37')][_0x765c('0x2d')]()][_0x765c('0x2f')]();}});}return _0x883dcc;}function getTicket(_0x3b32a7,_0x3b283b,_0x40c714,_0x313f61,_0x305620,_0x5e616a){return function(_0x466f28){logger[_0x765c('0x10')]('['+[_0x3b32a7[_0x765c('0xc')]()]+_0x765c('0x38'),_0x466f28);return new Promise(function(_0x46aefb,_0x4af021){var _0x3702c8=_0x3b32a7[_0x765c('0x2d')]()===_0x765c('0x39')?_0x466f28[_0x765c('0x17')]:_0x466f28[_0x765c('0x22')];var _0x259490={'method':_0x765c('0x1d'),'uri':_0x40c714+'incident'+'?'+_0x5e616a,'body':Object[_0x765c('0x3a')]({},{'active':'true','caller_id':_0x3702c8,'assigned_to':_0x466f28[_0x765c('0x17')],'short_description':intUtil[_0x765c('0x3b')](_0x313f61[_0x765c('0x3c')],_0x305620,'\x20'),'description':intUtil[_0x765c('0x3b')](_0x313f61[_0x765c('0x3d')],_0x305620,'\x0a')},getCustomFields(_0x313f61[_0x765c('0x3e')],_0x305620)),'auth':_0x3b283b,'json':!![]};return rp(_0x259490)[_0x765c('0x21')](function(_0x17c902){logger['info']('['+[_0x3b32a7[_0x765c('0xc')]()]+_0x765c('0x3f'),_0x17c902['result']);_0x466f28[_0x765c('0x40')]=_0x17c902['result']['sys_id'];_0x466f28[_0x765c('0x41')]=_0x17c902['result']['number'];logger[_0x765c('0x10')]('['+[_0x3b32a7['toUpperCase']()]+_0x765c('0x42'),_0x466f28);_0x46aefb(_0x466f28);})[_0x765c('0xe')](function(_0x4de601){logger[_0x765c('0x1a')]('['+[_0x3b32a7[_0x765c('0xc')]()]+']',_0x4de601[_0x765c('0xf')]);_0x4af021(_0x4de601['message']);});});};}function createRemoteTag(_0x5483dc,_0x1d257a,_0x59af6a,_0xa0b0cf){return new Promise(function(_0x4d962b,_0x5b1b4b){var _0x2dd804={'method':_0x765c('0x1d'),'uri':_0x59af6a+_0x765c('0x43')+'?'+_0xa0b0cf,'body':{'short_description':_0x5483dc,'global':!![],'active':!![],'name':_0x5483dc},'auth':_0x1d257a,'json':!![]};return rp(_0x2dd804)['then'](function(_0x356dbc){var _0x4c7628=_0x356dbc[_0x765c('0xa')][_0x765c('0x23')];_0x4d962b(_0x4c7628);});});}function getRemoteTag(_0x2660b5,_0x2c121c,_0x15abc4,_0x5ec6e4,_0x3706ca){return new Promise(function(_0x5c768c,_0xe4189e){var _0x57f25a={'method':_0x765c('0x25'),'uri':_0x15abc4+_0x765c('0x43')+'?sysparm_query=name%3D'+_0x2660b5+'&'+_0x5ec6e4,'auth':_0x2c121c,'json':!![]};return rp(_0x57f25a)[_0x765c('0x21')](function(_0x51e6f6){if(_0x51e6f6[_0x765c('0xa')][_0x765c('0x16')]>0x0){var _0x5a47b5=_0x51e6f6['result'][0x0]['sys_id'];_0x5c768c(_0x5a47b5);}else{return createRemoteTag(_0x2660b5,_0x2c121c,_0x15abc4,_0x5ec6e4)[_0x765c('0x21')](function(_0x462362){_0x5c768c(_0x462362);});}});});}function assignTagToIncident(_0x53c26a,_0x3ee126,_0x4f85f0,_0x188c9b,_0x3e3371){return new Promise(function(_0x50b0ee,_0x1957bb){var _0x1eae5a={'method':_0x765c('0x1d'),'uri':_0x4f85f0+_0x765c('0x44')+'?'+_0x3e3371,'body':{'label':_0x53c26a,'table':_0x765c('0x45'),'id_type':_0x765c('0x46'),'table_key':_0x188c9b[_0x765c('0x40')],'title':_0x765c('0x47')+_0x188c9b[_0x765c('0x41')],'id_display':_0x188c9b[_0x765c('0x41')]},'auth':_0x3ee126,'json':!![]};return rp(_0x1eae5a)[_0x765c('0x21')](function(_0x482e01){_0x50b0ee();})[_0x765c('0xe')](function(){_0x50b0ee();});});}function manageTags(_0x6692b,_0x3519ab,_0x57d159,_0xda20ca,_0x140099,_0x58904a,_0x5503dd){return new Promise(function(_0x5637fa,_0x25f4c1){var _0x4c80c8=[];_0x3519ab['forEach'](function(_0x2eaaa0){_0x4c80c8['push'](getRemoteTag(_0x2eaaa0,_0x57d159,_0xda20ca,_0x58904a,_0x5503dd));});return Promise[_0x765c('0x48')](_0x4c80c8)[_0x765c('0x21')](function(_0x2a604d){if(_0x2a604d[_0x765c('0x16')]){logger[_0x765c('0x10')]('['+[_0x6692b[_0x765c('0xc')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x2a604d);var _0x3d1a29=[];_0x2a604d[_0x765c('0x49')](function(_0x4e6497){_0x3d1a29[_0x765c('0x4a')](assignTagToIncident(_0x4e6497,_0x57d159,_0xda20ca,_0x140099,_0x58904a));});return Promise[_0x765c('0x48')](_0x3d1a29)[_0x765c('0x21')](function(){_0x5637fa();})[_0x765c('0xe')](function(){_0x5637fa();});}else{_0x5637fa();}});});}function getTags(_0x292cd7,_0x47362b,_0x2540b6,_0xe4da0a,_0x45c09a,_0x5d24dc){return function(_0x3e2d96){return new Promise(function(_0x529e35,_0x584c10){var _0x346f3a=[];var _0x57e949=_0xe4da0a['Tags'];if(_0x57e949&&_0x57e949[_0x765c('0x16')]>0x0){_0x346f3a=_['map'](_0x57e949,_0x765c('0x37'));}if(_0x346f3a['length']>0x0){return manageTags(_0x292cd7,_0x346f3a,_0x47362b,_0x2540b6,_0x3e2d96,_0x45c09a,_0x5d24dc)[_0x765c('0x21')](function(){_0x529e35(_0x3e2d96);});}else{_0x529e35(_0x3e2d96);}});};}function emit(_0x409289,_0x5764ef,_0x3ed29f){var _0x395540='%26sysparm_record_target%3Dincident'+_0x765c('0x4b')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x765c('0x4c');var _0x4ebfb5={'uri':_0x409289+_0x765c('0x4d')+_0x3ed29f+_0x395540};io['to'](util['format']('user:%s',_0x5764ef))[_0x765c('0x4e')](_0x765c('0x4f'),_0x4ebfb5);}exports['cs']=function(_0x22e266,_0x3614e4,_0x31551b,_0x277b51,_0x3581c5,_0x207c9b,_0x1bb003,_0x21ed6d){var _0x522a2e={};var _0x490602={'user':_0x207c9b['username'],'pass':_0x207c9b['password']};var _0x8a87e=_0x765c('0x50');var _0x4a52f0=_0x765c('0x51');_0x207c9b[_0x765c('0x52')]=intUtil['stripTrailingSlash'](_0x207c9b[_0x765c('0x52')]);_0x207c9b[_0x765c('0x53')]=intUtil[_0x765c('0x54')](_0x207c9b[_0x765c('0x53')]);var _0x2dcf4e=util[_0x765c('0x55')](_0x765c('0x56'),_0x207c9b[_0x765c('0x52')]);_0x522a2e[_0x765c('0x13')]=!_[_0x765c('0x57')](_0x277b51)?_0x277b51[_0x765c('0x58')]:null;_0x522a2e[_0x765c('0x18')]=_0x207c9b['email'];_0x522a2e[_0x765c('0x1e')]=_0x21ed6d[_0x765c('0x2d')]()===_0x765c('0x39')?_0x3614e4['destcalleridnum']:_0x3614e4['calleridnum'];_0x522a2e[_0x765c('0x59')]=_0x21ed6d===_0x765c('0x5a')||_0x21ed6d===_0x765c('0x5b')?_0x765c('0x5a'):_0x765c('0x39');var _0x1f83a9=util[_0x765c('0x55')](_0x765c('0x5c'),_0x207c9b[_0x765c('0x53')],_0x3614e4[_0x765c('0x5d')],md5(_0x3614e4[_0x765c('0x5d')]));if(_0x3581c5&&_0x3581c5['monitor_format']){logger[_0x765c('0x10')]('[QUEUE]',_0x765c('0x5e'));_0x3614e4[_0x765c('0x5f')]=_0x1f83a9;}else if(_0x1bb003&&_0x1bb003['recordingFormat']&&_0x1bb003['recordingFormat']!=='none'){logger[_0x765c('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3614e4[_0x765c('0x5f')]=_0x1f83a9;}else{_0x3614e4['recordingURL']='';}return getAdminUser(_0x21ed6d,_0x490602,_0x522a2e,_0x2dcf4e,_0x4a52f0,_0x8a87e)[_0x765c('0x21')](getUser(_0x21ed6d,_0x490602,_0x2dcf4e,_0x4a52f0,_0x8a87e))[_0x765c('0x21')](getEndUser(_0x21ed6d,_0x490602,_0x2dcf4e,_0x4a52f0,_0x8a87e))[_0x765c('0x21')](getTicket(_0x21ed6d,_0x490602,_0x2dcf4e,_0x31551b,_0x3614e4,_0x4a52f0))[_0x765c('0x21')](function(_0x208eeb){logger[_0x765c('0x10')](util[_0x765c('0x55')]('The\x20ticket\x20ID\x20is:\x20%s',_0x208eeb[_0x765c('0x40')]));logger['info'](util['format'](_0x765c('0x60'),_0x21ed6d));if(_0x21ed6d!==_0x765c('0x5b')){logger[_0x765c('0x10')]('['+[_0x21ed6d[_0x765c('0xc')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x207c9b['remoteUri'],_0x277b51[_0x765c('0x37')],_0x208eeb[_0x765c('0x40')]);}})['catch'](function(_0x5e32f1){logger['error']('['+[_0x21ed6d['toUpperCase']()]+_0x765c('0x61'),util[_0x765c('0x62')](_0x5e32f1,{'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 8842f11..0eec6f8 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 _0xa686=['Searching\x20enduser\x20with\x20phone','Contacts','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','map','type','nameField','customField','custom_fields','push','content','variable','Variable','toLowerCase','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','contacts','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','lodash','md5','util','ioredis','sugarcrm','redis','defaults','localhost','POST','emit','name','getString','Subjects','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','forEach','idField','variableName','set_entry','JSON','stringify','format','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','info','Agent\x20found!','value','resolve','user_id'];(function(_0x229429,_0x3ea5c5){var _0x5f038f=function(_0x141f94){while(--_0x141f94){_0x229429['push'](_0x229429['shift']());}};_0x5f038f(++_0x3ea5c5);}(_0xa686,0x1a1));var _0x6a68=function(_0x159efd,_0x589300){_0x159efd=_0x159efd-0x0;var _0x28a1d2=_0xa686[_0x159efd];return _0x28a1d2;};'use strict';var _=require(_0x6a68('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x6a68('0x1'));var util=require(_0x6a68('0x2'));var Redis=require(_0x6a68('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x6a68('0x4'));config[_0x6a68('0x5')]=_[_0x6a68('0x6')](config['redis'],{'host':_0x6a68('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6a68('0x5')]));var def={'method':_0x6a68('0x8'),'json':!![]};function emit(_0x501ecc,_0x8698de,_0x36aa79){io['to'](_0x501ecc)[_0x6a68('0x9')](_0x8698de,_0x36aa79);}function getTicket(_0xfc4e7f,_0x3f5755,_0x41750e,_0x57039c,_0x4bb3c2,_0x5e2154,_0x380d76,_0x1fb231){logger['info']('Creating\x20new\x20ticket...');var _0xbee079=new Date();var _0x4f4968=[{'name':_0x6a68('0xa'),'value':intUtil[_0x6a68('0xb')](_0x57039c[_0x6a68('0xc')],_0x4bb3c2,'\x20')},{'name':'assigned_user_id','value':_0x3f5755['id']},{'name':_0x6a68('0xd'),'value':_0x3f5755['id']},{'name':_0x6a68('0xe'),'value':intUtil['getString'](_0x57039c[_0x6a68('0xf')],_0x4bb3c2,'\x0a')},{'name':'date_start','value':_0xbee079[_0x6a68('0x10')]()[_0x6a68('0x11')](0x0,0x13)[_0x6a68('0x12')]('T','\x20')},{'name':_0x6a68('0x13'),'value':'0'},{'name':_0x6a68('0x14'),'value':'15'},{'name':_0x6a68('0x15'),'value':_0x41750e['id']},{'name':_0x6a68('0x16'),'value':'Contacts'},{'name':_0x6a68('0x17'),'value':_0x41750e['name']},{'name':_0x6a68('0x18'),'value':_0x1fb231}];if(_0x5e2154['length']){_[_0x6a68('0x19')](_0x5e2154,function(_0x51e9d5){if(_0x4bb3c2[_0x51e9d5['variableName']]){_0x4f4968['push']({'name':_0x51e9d5[_0x6a68('0x1a')],'value':_0x4bb3c2[_0x51e9d5[_0x6a68('0x1b')]]});}});}return request({'form':{'method':_0x6a68('0x1c'),'input_type':'JSON','response_type':_0x6a68('0x1d'),'rest_data':JSON[_0x6a68('0x1e')]({'session':_0x380d76['id'],'module_name':'Calls','name_value_list':_0x4f4968})}});}function getAuth(_0x28443d){return util[_0x6a68('0x1f')]('Basic\x20%s',new Buffer(_0x28443d['apiKey']+':X')[_0x6a68('0x20')](_0x6a68('0x21')));}function getServerInfo(_0x239f47){return request({'form':{'method':_0x6a68('0x22'),'input_type':_0x6a68('0x1d'),'response_type':_0x6a68('0x1d'),'rest_data':JSON[_0x6a68('0x1e')]({'session':_0x239f47['id']})}});}function getUser(_0x252f00,_0x1ea725,_0x5e79bf){if(!_[_0x6a68('0x23')](_0x1ea725)){logger['info'](_0x6a68('0x24'),_0x1ea725);return request({'form':{'method':_0x6a68('0x25'),'input_type':_0x6a68('0x1d'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x5e79bf['id'],'module_name':_0x6a68('0x26'),'query':util[_0x6a68('0x1f')](_0x6a68('0x27'),_0x1ea725),'order_by':'','offset':'0','select_fields':['id','name',_0x6a68('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6a68('0x29')](function(_0x4175e0){if(_0x4175e0[_0x6a68('0x2a')][_0x6a68('0x2b')]){var _0x4dd6b4=_[_0x6a68('0x2c')](_0x4175e0['entry_list'],function(_0x4d607f){return _0x4d607f[_0x6a68('0x2d')][_0x6a68('0x28')]['value']===_0x1ea725;});if(_0x4dd6b4){logger[_0x6a68('0x2e')](_0x6a68('0x2f'));return BPromise['resolve']({'id':_0x4dd6b4[_0x6a68('0x2d')]['id'][_0x6a68('0x30')],'name':_0x4dd6b4[_0x6a68('0x2d')][_0x6a68('0xa')][_0x6a68('0x30')]});}}logger[_0x6a68('0x2e')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x6a68('0x31')]({'id':_0x5e79bf[_0x6a68('0x2d')]['user_id'][_0x6a68('0x30')],'name':_0x5e79bf[_0x6a68('0x2d')][_0x6a68('0x28')][_0x6a68('0x30')]});});}else{logger[_0x6a68('0x2e')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x6a68('0x31')]({'id':_0x5e79bf[_0x6a68('0x2d')][_0x6a68('0x32')]['value'],'name':_0x5e79bf[_0x6a68('0x2d')][_0x6a68('0x28')][_0x6a68('0x30')]});}}function getEndUser(_0x3dd11b,_0x1d20f3,_0xffc14,_0x53d801){logger[_0x6a68('0x2e')](_0x6a68('0x33'),_0xffc14);return request({'form':{'method':_0x6a68('0x25'),'input_type':_0x6a68('0x1d'),'response_type':_0x6a68('0x1d'),'rest_data':JSON['stringify']({'session':_0x53d801['id'],'module_name':_0x6a68('0x34'),'query':util[_0x6a68('0x1f')]('contacts.phone_home\x20=\x20\x22%s\x22',_0xffc14),'order_by':'','offset':'0','select_fields':['id',_0x6a68('0xa'),_0x6a68('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6a68('0x29')](function(_0x55ad9f){if(_0x55ad9f['entry_list']['length']){var _0x48ca96=_[_0x6a68('0x2c')](_0x55ad9f[_0x6a68('0x2a')],function(_0x19ffa2){return _0x19ffa2[_0x6a68('0x2d')][_0x6a68('0x35')][_0x6a68('0x30')]===_0xffc14;});if(_0x48ca96){logger[_0x6a68('0x2e')](_0x6a68('0x36'));return BPromise[_0x6a68('0x31')]({'id':_0x48ca96[_0x6a68('0x2d')]['id'][_0x6a68('0x30')],'name':_0x48ca96[_0x6a68('0x2d')]['name'][_0x6a68('0x30')],'phone':_0x48ca96[_0x6a68('0x2d')][_0x6a68('0x35')][_0x6a68('0x30')]});}}else{logger[_0x6a68('0x2e')](_0x6a68('0x37'));return request({'form':{'method':_0x6a68('0x1c'),'input_type':'JSON','response_type':_0x6a68('0x1d'),'rest_data':JSON[_0x6a68('0x1e')]({'session':_0x53d801['id'],'module_name':_0x6a68('0x34'),'name_value_list':[{'name':'first_name','value':_0x1d20f3!==_0x6a68('0x38')?_0x1d20f3:util[_0x6a68('0x1f')](_0x6a68('0x39'),_0xffc14)},{'name':_0x6a68('0x35'),'value':_0xffc14}]})}})[_0x6a68('0x29')](function(_0x5a9284){logger[_0x6a68('0x2e')](_0x6a68('0x3a'));return BPromise[_0x6a68('0x31')]({'id':_0x5a9284['id'],'name':_0x5a9284[_0x6a68('0x2a')][_0x6a68('0x3b')]['value'],'phone':_0x5a9284[_0x6a68('0x2a')][_0x6a68('0x35')][_0x6a68('0x30')]});});}});}function request(_0x2a2356){logger[_0x6a68('0x3c')](_0x6a68('0x3d'),JSON[_0x6a68('0x1e')](_0x2a2356));return rp(_['merge'](def,_0x2a2356));}function getTags(_0x10e6d9,_0x18fb5b){var _0x560b3d=[];if(_0x10e6d9&&_0x10e6d9[_0x6a68('0x2b')]>0x0){_0x560b3d=_[_0x6a68('0x3e')](_0x10e6d9,_0x18fb5b);}return _0x560b3d;}function getCustomFields(_0x3d9bfb,_0x1315f0){var _0x46d1c6=[];var _0x32a930={'custom_fields':[]};if(_0x3d9bfb[_0x6a68('0x2b')]>0x0){_[_0x6a68('0x19')](_0x3d9bfb,function(_0x28eaec){if(_0x28eaec[_0x6a68('0x3f')]==='string'&&_0x28eaec[_0x6a68('0x40')]&&!_0x28eaec['customField']){_0x32a930[_0x28eaec[_0x6a68('0x40')]['toLowerCase']()]=_0x28eaec['content'][_0x6a68('0x20')]();}else if(_0x28eaec['type']==='string'&&_0x28eaec[_0x6a68('0x1a')]&&_0x28eaec[_0x6a68('0x41')]){_0x32a930[_0x6a68('0x42')][_0x6a68('0x43')]({'id':_0x28eaec['idField'],'value':_0x28eaec[_0x6a68('0x44')][_0x6a68('0x20')]()});}else if(_0x28eaec['type']===_0x6a68('0x45')&&_0x28eaec[_0x6a68('0x1b')]&&_0x28eaec['idField']&&_0x28eaec['customField']){_0x1315f0[_0x28eaec[_0x6a68('0x1b')]]&&_0x32a930[_0x6a68('0x42')][_0x6a68('0x43')]({'id':_0x28eaec['idField'],'value':_0x1315f0[_0x28eaec[_0x6a68('0x1b')]]['toString']()});}else if(_0x28eaec[_0x6a68('0x3f')]==='customVariable'&&_0x28eaec['Variable']&&_0x28eaec[_0x6a68('0x46')][_0x6a68('0xa')]&&_0x28eaec[_0x6a68('0x1a')]&&_0x28eaec[_0x6a68('0x41')]){_0x1315f0[_0x28eaec[_0x6a68('0x46')]['name'][_0x6a68('0x47')]()]&&_0x32a930[_0x6a68('0x42')]['push']({'id':_0x28eaec[_0x6a68('0x1a')],'value':_0x1315f0[_0x28eaec['Variable'][_0x6a68('0xa')][_0x6a68('0x47')]()]['toString']()});}});}return _0x32a930;}function getConnection(_0x134232){return request({'method':_0x6a68('0x8'),'form':{'method':_0x6a68('0x48'),'input_type':_0x6a68('0x1d'),'response_type':'JSON','rest_data':JSON[_0x6a68('0x1e')]({'user_auth':{'user_name':_0x134232['username'],'password':_0x134232[_0x6a68('0x49')],'encryption':_0x6a68('0x4a')},'application':_0x6a68('0x4b')})}})[_0x6a68('0x29')](function(_0x3b3e0d){var _0x2b14cf=_0x3b3e0d;if(_0x2b14cf['id']){def[_0x6a68('0x4c')]=_0x2b14cf['id'];return BPromise[_0x6a68('0x31')](_0x2b14cf);}else{throw new Error(util[_0x6a68('0x1f')]('Account\x20%d\x20is\x20not\x20valid',_0x134232['id']));}});}function setRelationship(_0x49eab5,_0x42b85b,_0x3c2b1e,_0x9e1ef3){return request({'form':{'method':_0x6a68('0x4d'),'input_type':_0x6a68('0x1d'),'response_type':'JSON','rest_data':JSON[_0x6a68('0x1e')]({'session':_0x49eab5['id'],'module_name':'Calls','module_id':_0x3c2b1e['id'],'link_field_name':_0x9e1ef3,'related_ids':[_0x42b85b['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6a68('0x4e')]=function(_0x1fb448,_0x2cef1f,_0x598ee3,_0x510702,_0x10998a,_0x3f0ffb){var _0x387e6f,_0x18df79,_0x38b132,_0x852886;_0x3f0ffb['remoteUri']=intUtil[_0x6a68('0x4f')](_0x3f0ffb[_0x6a68('0x50')]);_0x3f0ffb[_0x6a68('0x51')]=intUtil[_0x6a68('0x4f')](_0x3f0ffb[_0x6a68('0x51')]);def[_0x6a68('0x52')]=util['format'](_0x6a68('0x53'),_0x3f0ffb['remoteUri']);if(_0x10998a&&_0x10998a[_0x6a68('0x54')]){logger['info'](_0x6a68('0x55'),_0x6a68('0x56'));_0x2cef1f[_0x6a68('0x57')]=util[_0x6a68('0x1f')](_0x6a68('0x58'),_0x3f0ffb[_0x6a68('0x51')],_0x2cef1f[_0x6a68('0x59')],md5(_0x2cef1f[_0x6a68('0x59')]));}else{_0x2cef1f['recordingURL']='';}return getConnection(_0x3f0ffb)[_0x6a68('0x29')](function(_0x5ca7f1){_0x852886=_0x5ca7f1;return getUser(_0x3f0ffb,_0x510702[_0x6a68('0xa')],_0x852886);})[_0x6a68('0x29')](function(_0x98908a){_0x387e6f=_0x98908a;logger['info'](_0x6a68('0x5a'),_0x387e6f['id']);return getEndUser(_0x3f0ffb,_0x2cef1f[_0x6a68('0x5b')],_0x2cef1f[_0x6a68('0x5c')],_0x852886);})[_0x6a68('0x29')](function(_0x1e7896){_0x18df79=_0x1e7896;logger['info']('The\x20Enduser\x20ID\x20is:',_0x18df79['id']);return getTicket(_0x3f0ffb,_0x387e6f,_0x18df79,_0x598ee3,_0x2cef1f,_0x598ee3[_0x6a68('0x5d')],_0x852886,_0x6a68('0x5e'));})[_0x6a68('0x29')](function(_0x42eec1){_0x38b132=_0x42eec1;logger[_0x6a68('0x2e')](_0x6a68('0x5f'));logger[_0x6a68('0x2e')]('The\x20Ticket\x20ID\x20is:',_0x38b132['id']);return setRelationship(_0x852886,_0x387e6f,_0x38b132,_0x6a68('0x60'));})[_0x6a68('0x29')](function(){return setRelationship(_0x852886,_0x18df79,_0x38b132,'contacts');})[_0x6a68('0x29')](function(){return getServerInfo(_0x852886);})[_0x6a68('0x29')](function(_0x38bc41){var _0x37b294=parseInt(_0x38bc41[_0x6a68('0x61')][_0x6a68('0x62')](0x0));var _0x9222e=util[_0x6a68('0x1f')](_0x6a68('0x63'),_0x3f0ffb[_0x6a68('0x50')],_0x38b132['id']);if(_0x37b294>0x6){_0x9222e=util['format'](_0x6a68('0x64'),_0x3f0ffb['remoteUri'],_0x38b132['id']);}logger[_0x6a68('0x2e')](_0x6a68('0x55'),_0x6a68('0x65'));emit(util[_0x6a68('0x1f')](_0x6a68('0x66'),_0x510702[_0x6a68('0xa')]),_0x6a68('0x67'),{'uri':_0x9222e});})[_0x6a68('0x68')](function(_0x2e0afd){logger[_0x6a68('0x69')](_0x6a68('0x55'),JSON['stringify'](_0x2e0afd));});};exports[_0x6a68('0x6a')]=function(_0x304f5d,_0x6a925a,_0x2a7d96,_0x5bd916,_0x49a223,_0x2cd595,_0x364752){var _0x35959c,_0x2c8b09,_0x508610,_0x9d689a;_0x2cd595[_0x6a68('0x50')]=intUtil[_0x6a68('0x4f')](_0x2cd595[_0x6a68('0x50')]);_0x2cd595[_0x6a68('0x51')]=intUtil['stripTrailingSlash'](_0x2cd595[_0x6a68('0x51')]);def[_0x6a68('0x52')]=util['format'](_0x6a68('0x53'),_0x2cd595[_0x6a68('0x50')]);if(_0x364752&&_0x364752[_0x6a68('0x6b')]&&_0x364752[_0x6a68('0x6b')]!=='none'){logger[_0x6a68('0x2e')](_0x6a68('0x6c'),_0x6a68('0x56'));_0x6a925a[_0x6a68('0x57')]=util['format'](_0x6a68('0x58'),_0x2cd595[_0x6a68('0x51')],_0x6a925a[_0x6a68('0x59')],md5(_0x6a925a[_0x6a68('0x59')]));}return getConnection(_0x2cd595)[_0x6a68('0x29')](function(_0x2f0b0a){_0x9d689a=_0x2f0b0a;return getUser(_0x2cd595,_0x5bd916[_0x6a68('0xa')],_0x9d689a);})[_0x6a68('0x29')](function(_0x465fbf){_0x35959c=_0x465fbf;logger[_0x6a68('0x2e')](_0x6a68('0x5a'),_0x35959c['id']);return getEndUser(_0x2cd595,_0x6a925a[_0x6a68('0x6d')],_0x6a925a[_0x6a68('0x6e')],_0x9d689a);})[_0x6a68('0x29')](function(_0x173fe0){_0x2c8b09=_0x173fe0;logger[_0x6a68('0x2e')]('The\x20Enduser\x20ID\x20is:',_0x2c8b09['id']);return getTicket(_0x2cd595,_0x35959c,_0x2c8b09,_0x2a7d96,_0x6a925a,_0x2a7d96[_0x6a68('0x5d')],_0x9d689a,_0x6a68('0x6f'));})[_0x6a68('0x29')](function(_0x5e1880){_0x508610=_0x5e1880;logger[_0x6a68('0x2e')]('Ticket\x20created!');logger[_0x6a68('0x2e')](_0x6a68('0x70'),_0x508610['id']);return setRelationship(_0x9d689a,_0x35959c,_0x508610,'users');})[_0x6a68('0x29')](function(){return setRelationship(_0x9d689a,_0x2c8b09,_0x508610,_0x6a68('0x71'));})[_0x6a68('0x29')](function(){return getServerInfo(_0x9d689a);})[_0x6a68('0x29')](function(_0x41709a){var _0x54e082=parseInt(_0x41709a[_0x6a68('0x61')][_0x6a68('0x62')](0x0));var _0x517ddd=util['format'](_0x6a68('0x63'),_0x2cd595[_0x6a68('0x50')],_0x508610['id']);if(_0x54e082>0x6){_0x517ddd=util['format'](_0x6a68('0x64'),_0x2cd595['remoteUri'],_0x508610['id']);}logger[_0x6a68('0x2e')](_0x6a68('0x6c'),_0x6a68('0x65'));emit(util['format']('user:%s',_0x5bd916[_0x6a68('0xa')]),_0x6a68('0x67'),{'uri':_0x517ddd});})[_0x6a68('0x68')](function(_0xf699fd){logger[_0x6a68('0x69')](_0x6a68('0x6c'),JSON['stringify'](_0xf699fd));});};exports['unmanaged']=function(_0x36c47b,_0x5868ef,_0xea86b9,_0x389060,_0xd2408a,_0x200b2f){var _0x364248,_0x585a43,_0x11ffdd,_0x29e4e9;_0x200b2f[_0x6a68('0x50')]=intUtil[_0x6a68('0x4f')](_0x200b2f['remoteUri']);_0x200b2f[_0x6a68('0x51')]=intUtil[_0x6a68('0x4f')](_0x200b2f[_0x6a68('0x51')]);def['uri']=util[_0x6a68('0x1f')](_0x6a68('0x53'),_0x200b2f[_0x6a68('0x50')]);if(_0xd2408a&&_0xd2408a[_0x6a68('0x54')]){logger['info']('['+_0x5868ef[_0x6a68('0x72')][_0x6a68('0x73')]()+']',_0x6a68('0x56'));_0x5868ef['recordingURL']=util['format'](_0x6a68('0x58'),_0x200b2f[_0x6a68('0x51')],_0x5868ef[_0x6a68('0x59')],md5(_0x5868ef[_0x6a68('0x59')]));}else{_0x5868ef[_0x6a68('0x57')]='';}return getConnection(_0x200b2f)[_0x6a68('0x29')](function(_0x42a382){_0x29e4e9=_0x42a382;if(!_[_0x6a68('0x23')](_0x389060)){return getUser(_0x200b2f,_0x389060['name'],_0x29e4e9);}else{return getUser(_0x200b2f,null,_0x29e4e9);}})['then'](function(_0x2ca4d9){_0x364248=_0x2ca4d9;logger[_0x6a68('0x2e')](_0x6a68('0x5a'),_0x364248['id']);return getEndUser(_0x200b2f,_0x5868ef[_0x6a68('0x5b')],_0x5868ef[_0x6a68('0x5c')],_0x29e4e9);})[_0x6a68('0x29')](function(_0xbcad1f){_0x585a43=_0xbcad1f;logger[_0x6a68('0x2e')](_0x6a68('0x74'),_0x585a43['id']);return getTicket(_0x200b2f,_0x364248,_0x585a43,_0xea86b9,_0x5868ef,_0xea86b9[_0x6a68('0x5d')],_0x29e4e9,_0x6a68('0x5e'));})[_0x6a68('0x29')](function(_0x16f8ef){_0x11ffdd=_0x16f8ef;logger['info']('Ticket\x20created!');logger[_0x6a68('0x2e')](_0x6a68('0x70'),_0x11ffdd['id']);return setRelationship(_0x29e4e9,_0x364248,_0x11ffdd,_0x6a68('0x60'));})[_0x6a68('0x29')](function(){return setRelationship(_0x29e4e9,_0x585a43,_0x11ffdd,_0x6a68('0x71'));})['then'](function(){return getServerInfo(_0x29e4e9);})[_0x6a68('0x68')](function(_0x159870){logger[_0x6a68('0x69')]('['+_0x5868ef[_0x6a68('0x72')][_0x6a68('0x73')]()+']',JSON[_0x6a68('0x1e')](_0x159870));});}; \ No newline at end of file +var _0x8862=['Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','length','forEach','idField','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','debug','[HTTP]','merge','map','type','string','nameField','toLowerCase','content','custom_fields','push','variable','customField','customVariable','Variable','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','error','outbound','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','contacts','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','catch','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info'];(function(_0x49743f,_0x355895){var _0x535f3=function(_0x25c996){while(--_0x25c996){_0x49743f['push'](_0x49743f['shift']());}};_0x535f3(++_0x355895);}(_0x8862,0x1ec));var _0x2886=function(_0x226a0c,_0x3342c8){_0x226a0c=_0x226a0c-0x0;var _0x4d82de=_0x8862[_0x226a0c];return _0x4d82de;};'use strict';var _=require(_0x2886('0x0'));var rp=require(_0x2886('0x1'));var BPromise=require(_0x2886('0x2'));var md5=require(_0x2886('0x3'));var util=require(_0x2886('0x4'));var Redis=require(_0x2886('0x5'));var intUtil=require(_0x2886('0x6'));var config=require(_0x2886('0x7'));var logger=require(_0x2886('0x8'))(_0x2886('0x9'));config[_0x2886('0xa')]=_[_0x2886('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2886('0xc'))(new Redis(config[_0x2886('0xa')]));var def={'method':_0x2886('0xd'),'json':!![]};function emit(_0x2b0463,_0x2ed7d3,_0x297651){io['to'](_0x2b0463)[_0x2886('0xe')](_0x2ed7d3,_0x297651);}function getTicket(_0x12d574,_0x54bf63,_0x1385d9,_0xcee74b,_0x378ab9,_0x1d61a5,_0x2d7d02,_0x4e92a4){logger[_0x2886('0xf')](_0x2886('0x10'));var _0x104806=new Date();var _0x34f90e=[{'name':_0x2886('0x11'),'value':intUtil[_0x2886('0x12')](_0xcee74b[_0x2886('0x13')],_0x378ab9,'\x20')},{'name':_0x2886('0x14'),'value':_0x54bf63['id']},{'name':_0x2886('0x15'),'value':_0x54bf63['id']},{'name':_0x2886('0x16'),'value':intUtil[_0x2886('0x12')](_0xcee74b[_0x2886('0x17')],_0x378ab9,'\x0a')},{'name':_0x2886('0x18'),'value':_0x104806[_0x2886('0x19')]()[_0x2886('0x1a')](0x0,0x13)[_0x2886('0x1b')]('T','\x20')},{'name':_0x2886('0x1c'),'value':'0'},{'name':_0x2886('0x1d'),'value':'15'},{'name':'parent_id','value':_0x1385d9['id']},{'name':_0x2886('0x1e'),'value':_0x2886('0x1f')},{'name':_0x2886('0x20'),'value':_0x1385d9[_0x2886('0x11')]},{'name':_0x2886('0x21'),'value':_0x4e92a4}];if(_0x1d61a5[_0x2886('0x22')]){_[_0x2886('0x23')](_0x1d61a5,function(_0x11f92a){if(_0x378ab9[_0x11f92a['variableName']]){_0x34f90e['push']({'name':_0x11f92a[_0x2886('0x24')],'value':_0x378ab9[_0x11f92a[_0x2886('0x25')]]});}});}return request({'form':{'method':_0x2886('0x26'),'input_type':_0x2886('0x27'),'response_type':_0x2886('0x27'),'rest_data':JSON[_0x2886('0x28')]({'session':_0x2d7d02['id'],'module_name':_0x2886('0x29'),'name_value_list':_0x34f90e})}});}function getAuth(_0x69a19c){return util[_0x2886('0x2a')](_0x2886('0x2b'),new Buffer(_0x69a19c[_0x2886('0x2c')]+':X')[_0x2886('0x2d')]('base64'));}function getServerInfo(_0x492dad){return request({'form':{'method':'get_server_info','input_type':_0x2886('0x27'),'response_type':_0x2886('0x27'),'rest_data':JSON[_0x2886('0x28')]({'session':_0x492dad['id']})}});}function getUser(_0x28c2a0,_0x17e2ed,_0xd61dd5){if(!_[_0x2886('0x2e')](_0x17e2ed)){logger[_0x2886('0xf')](_0x2886('0x2f'),_0x17e2ed);return request({'form':{'method':_0x2886('0x30'),'input_type':_0x2886('0x27'),'response_type':_0x2886('0x27'),'rest_data':JSON['stringify']({'session':_0xd61dd5['id'],'module_name':_0x2886('0x31'),'query':util[_0x2886('0x2a')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x17e2ed),'order_by':'','offset':'0','select_fields':['id',_0x2886('0x11'),_0x2886('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5c59d1){if(_0x5c59d1[_0x2886('0x33')][_0x2886('0x22')]){var _0x182714=_['find'](_0x5c59d1[_0x2886('0x33')],function(_0x30e55d){return _0x30e55d[_0x2886('0x34')][_0x2886('0x32')][_0x2886('0x35')]===_0x17e2ed;});if(_0x182714){logger['info'](_0x2886('0x36'));return BPromise[_0x2886('0x37')]({'id':_0x182714[_0x2886('0x34')]['id'][_0x2886('0x35')],'name':_0x182714[_0x2886('0x34')]['name'][_0x2886('0x35')]});}}logger['info'](_0x2886('0x38'));return BPromise[_0x2886('0x37')]({'id':_0xd61dd5[_0x2886('0x34')][_0x2886('0x39')][_0x2886('0x35')],'name':_0xd61dd5[_0x2886('0x34')][_0x2886('0x32')][_0x2886('0x35')]});});}else{logger['info'](_0x2886('0x3a'));return BPromise[_0x2886('0x37')]({'id':_0xd61dd5[_0x2886('0x34')][_0x2886('0x39')][_0x2886('0x35')],'name':_0xd61dd5['name_value_list'][_0x2886('0x32')]['value']});}}function getEndUser(_0x388640,_0x5d8bdf,_0x20b666,_0x2ed10b){logger[_0x2886('0xf')](_0x2886('0x3b'),_0x20b666);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x2886('0x27'),'rest_data':JSON[_0x2886('0x28')]({'session':_0x2ed10b['id'],'module_name':_0x2886('0x1f'),'query':util[_0x2886('0x2a')](_0x2886('0x3c'),_0x20b666),'order_by':'','offset':'0','select_fields':['id',_0x2886('0x11'),_0x2886('0x3d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2886('0x3e')](function(_0x1641e7){if(_0x1641e7[_0x2886('0x33')][_0x2886('0x22')]){var _0x9e1811=_[_0x2886('0x3f')](_0x1641e7['entry_list'],function(_0x2d4dec){return _0x2d4dec['name_value_list'][_0x2886('0x3d')][_0x2886('0x35')]===_0x20b666;});if(_0x9e1811){logger[_0x2886('0xf')](_0x2886('0x40'));return BPromise[_0x2886('0x37')]({'id':_0x9e1811[_0x2886('0x34')]['id']['value'],'name':_0x9e1811[_0x2886('0x34')][_0x2886('0x11')][_0x2886('0x35')],'phone':_0x9e1811[_0x2886('0x34')][_0x2886('0x3d')][_0x2886('0x35')]});}}else{logger['info'](_0x2886('0x41'));return request({'form':{'method':_0x2886('0x26'),'input_type':'JSON','response_type':_0x2886('0x27'),'rest_data':JSON[_0x2886('0x28')]({'session':_0x2ed10b['id'],'module_name':'Contacts','name_value_list':[{'name':_0x2886('0x42'),'value':_0x5d8bdf!==''?_0x5d8bdf:util[_0x2886('0x2a')]('Caller\x20-\x20%s',_0x20b666)},{'name':_0x2886('0x3d'),'value':_0x20b666}]})}})['then'](function(_0x519c2c){logger[_0x2886('0xf')]('Enduser\x20created.');return BPromise[_0x2886('0x37')]({'id':_0x519c2c['id'],'name':_0x519c2c[_0x2886('0x33')]['first_name'][_0x2886('0x35')],'phone':_0x519c2c['entry_list']['phone_home'][_0x2886('0x35')]});});}});}function request(_0x3ca40b){logger[_0x2886('0x43')](_0x2886('0x44'),JSON[_0x2886('0x28')](_0x3ca40b));return rp(_[_0x2886('0x45')](def,_0x3ca40b));}function getTags(_0x39813a,_0xef16f2){var _0x16ea99=[];if(_0x39813a&&_0x39813a[_0x2886('0x22')]>0x0){_0x16ea99=_[_0x2886('0x46')](_0x39813a,_0xef16f2);}return _0x16ea99;}function getCustomFields(_0x4a7848,_0x9683ae){var _0x440b80=[];var _0x321804={'custom_fields':[]};if(_0x4a7848[_0x2886('0x22')]>0x0){_['forEach'](_0x4a7848,function(_0x14ef05){if(_0x14ef05[_0x2886('0x47')]===_0x2886('0x48')&&_0x14ef05[_0x2886('0x49')]&&!_0x14ef05['customField']){_0x321804[_0x14ef05['nameField'][_0x2886('0x4a')]()]=_0x14ef05[_0x2886('0x4b')][_0x2886('0x2d')]();}else if(_0x14ef05['type']===_0x2886('0x48')&&_0x14ef05[_0x2886('0x24')]&&_0x14ef05['customField']){_0x321804[_0x2886('0x4c')][_0x2886('0x4d')]({'id':_0x14ef05[_0x2886('0x24')],'value':_0x14ef05[_0x2886('0x4b')]['toString']()});}else if(_0x14ef05['type']===_0x2886('0x4e')&&_0x14ef05[_0x2886('0x25')]&&_0x14ef05[_0x2886('0x24')]&&_0x14ef05[_0x2886('0x4f')]){_0x9683ae[_0x14ef05[_0x2886('0x25')]]&&_0x321804[_0x2886('0x4c')][_0x2886('0x4d')]({'id':_0x14ef05[_0x2886('0x24')],'value':_0x9683ae[_0x14ef05[_0x2886('0x25')]][_0x2886('0x2d')]()});}else if(_0x14ef05[_0x2886('0x47')]===_0x2886('0x50')&&_0x14ef05[_0x2886('0x51')]&&_0x14ef05[_0x2886('0x51')][_0x2886('0x11')]&&_0x14ef05[_0x2886('0x24')]&&_0x14ef05['customField']){_0x9683ae[_0x14ef05[_0x2886('0x51')][_0x2886('0x11')][_0x2886('0x4a')]()]&&_0x321804[_0x2886('0x4c')][_0x2886('0x4d')]({'id':_0x14ef05[_0x2886('0x24')],'value':_0x9683ae[_0x14ef05['Variable'][_0x2886('0x11')][_0x2886('0x4a')]()][_0x2886('0x2d')]()});}});}return _0x321804;}function getConnection(_0x2e0135){return request({'method':_0x2886('0xd'),'form':{'method':_0x2886('0x52'),'input_type':_0x2886('0x27'),'response_type':_0x2886('0x27'),'rest_data':JSON[_0x2886('0x28')]({'user_auth':{'user_name':_0x2e0135[_0x2886('0x53')],'password':_0x2e0135[_0x2886('0x54')],'encryption':_0x2886('0x55')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x2886('0x3e')](function(_0x47c641){var _0x1246ef=_0x47c641;if(_0x1246ef['id']){def[_0x2886('0x56')]=_0x1246ef['id'];return BPromise['resolve'](_0x1246ef);}else{throw new Error(util[_0x2886('0x2a')](_0x2886('0x57'),_0x2e0135['id']));}});}function setRelationship(_0x20a94f,_0x4193cd,_0x32d5fc,_0xe64766){return request({'form':{'method':_0x2886('0x58'),'input_type':_0x2886('0x27'),'response_type':_0x2886('0x27'),'rest_data':JSON[_0x2886('0x28')]({'session':_0x20a94f['id'],'module_name':_0x2886('0x29'),'module_id':_0x32d5fc['id'],'link_field_name':_0xe64766,'related_ids':[_0x4193cd['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x2886('0x59')]=function(_0x417317,_0x31da00,_0x3f0e83,_0x4d5ead,_0x934004,_0x4fad8c){var _0x3e8ad1,_0x1968db,_0x5d5741,_0x5301a6;_0x4fad8c[_0x2886('0x5a')]=intUtil[_0x2886('0x5b')](_0x4fad8c['remoteUri']);_0x4fad8c[_0x2886('0x5c')]=intUtil[_0x2886('0x5b')](_0x4fad8c[_0x2886('0x5c')]);def[_0x2886('0x5d')]=util[_0x2886('0x2a')](_0x2886('0x5e'),_0x4fad8c[_0x2886('0x5a')]);if(_0x934004&&_0x934004[_0x2886('0x5f')]){logger[_0x2886('0xf')](_0x2886('0x60'),'Recording\x20is\x20enabled!');_0x31da00[_0x2886('0x61')]=util[_0x2886('0x2a')](_0x2886('0x62'),_0x4fad8c[_0x2886('0x5c')],_0x31da00[_0x2886('0x63')],md5(_0x31da00[_0x2886('0x63')]));}else{_0x31da00[_0x2886('0x61')]='';}return getConnection(_0x4fad8c)[_0x2886('0x3e')](function(_0x38e066){_0x5301a6=_0x38e066;return getUser(_0x4fad8c,_0x4d5ead[_0x2886('0x11')],_0x5301a6);})['then'](function(_0x2ac6b4){_0x3e8ad1=_0x2ac6b4;logger[_0x2886('0xf')](_0x2886('0x64'),_0x3e8ad1['id']);return getEndUser(_0x4fad8c,_0x31da00[_0x2886('0x65')],_0x31da00[_0x2886('0x66')],_0x5301a6);})['then'](function(_0x14c047){_0x1968db=_0x14c047;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1968db['id']);return getTicket(_0x4fad8c,_0x3e8ad1,_0x1968db,_0x3f0e83,_0x31da00,_0x3f0e83[_0x2886('0x67')],_0x5301a6,_0x2886('0x68'));})[_0x2886('0x3e')](function(_0x547478){_0x5d5741=_0x547478;logger[_0x2886('0xf')](_0x2886('0x69'));logger['info'](_0x2886('0x6a'),_0x5d5741['id']);return setRelationship(_0x5301a6,_0x3e8ad1,_0x5d5741,_0x2886('0x6b'));})[_0x2886('0x3e')](function(){return setRelationship(_0x5301a6,_0x1968db,_0x5d5741,'contacts');})['then'](function(){return getServerInfo(_0x5301a6);})[_0x2886('0x3e')](function(_0x32d25d){var _0x467334=parseInt(_0x32d25d[_0x2886('0x6c')][_0x2886('0x6d')](0x0));var _0x52a95f=util[_0x2886('0x2a')](_0x2886('0x6e'),_0x4fad8c[_0x2886('0x5a')],_0x5d5741['id']);if(_0x467334>0x6){_0x52a95f=util['format'](_0x2886('0x6f'),_0x4fad8c['remoteUri'],_0x5d5741['id']);}logger[_0x2886('0xf')](_0x2886('0x60'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2886('0x2a')](_0x2886('0x70'),_0x4d5ead['name']),_0x2886('0x71'),{'uri':_0x52a95f});})['catch'](function(_0x23cf61){logger[_0x2886('0x72')](_0x2886('0x60'),JSON['stringify'](_0x23cf61));});};exports[_0x2886('0x73')]=function(_0x486eb0,_0x1b4aef,_0x50e994,_0x1846e0,_0x2e5df7,_0x460b74,_0x445278){var _0x209940,_0x378e6e,_0x730c41,_0x4e8b28;_0x460b74[_0x2886('0x5a')]=intUtil['stripTrailingSlash'](_0x460b74[_0x2886('0x5a')]);_0x460b74['serverUrl']=intUtil[_0x2886('0x5b')](_0x460b74[_0x2886('0x5c')]);def[_0x2886('0x5d')]=util[_0x2886('0x2a')](_0x2886('0x5e'),_0x460b74[_0x2886('0x5a')]);if(_0x445278&&_0x445278['recordingFormat']&&_0x445278['recordingFormat']!=='none'){logger[_0x2886('0xf')](_0x2886('0x74'),'Recording\x20is\x20enabled!');_0x1b4aef[_0x2886('0x61')]=util[_0x2886('0x2a')](_0x2886('0x62'),_0x460b74[_0x2886('0x5c')],_0x1b4aef['uniqueid'],md5(_0x1b4aef['uniqueid']));}return getConnection(_0x460b74)[_0x2886('0x3e')](function(_0x39b75d){_0x4e8b28=_0x39b75d;return getUser(_0x460b74,_0x1846e0[_0x2886('0x11')],_0x4e8b28);})[_0x2886('0x3e')](function(_0x1c874d){_0x209940=_0x1c874d;logger[_0x2886('0xf')](_0x2886('0x64'),_0x209940['id']);return getEndUser(_0x460b74,_0x1b4aef[_0x2886('0x75')],_0x1b4aef[_0x2886('0x76')],_0x4e8b28);})['then'](function(_0x201939){_0x378e6e=_0x201939;logger[_0x2886('0xf')](_0x2886('0x77'),_0x378e6e['id']);return getTicket(_0x460b74,_0x209940,_0x378e6e,_0x50e994,_0x1b4aef,_0x50e994[_0x2886('0x67')],_0x4e8b28,_0x2886('0x78'));})[_0x2886('0x3e')](function(_0x350d8c){_0x730c41=_0x350d8c;logger[_0x2886('0xf')](_0x2886('0x69'));logger['info'](_0x2886('0x6a'),_0x730c41['id']);return setRelationship(_0x4e8b28,_0x209940,_0x730c41,'users');})[_0x2886('0x3e')](function(){return setRelationship(_0x4e8b28,_0x378e6e,_0x730c41,_0x2886('0x79'));})['then'](function(){return getServerInfo(_0x4e8b28);})[_0x2886('0x3e')](function(_0x2b7759){var _0x486fc8=parseInt(_0x2b7759[_0x2886('0x6c')][_0x2886('0x6d')](0x0));var _0x5bf922=util[_0x2886('0x2a')](_0x2886('0x6e'),_0x460b74[_0x2886('0x5a')],_0x730c41['id']);if(_0x486fc8>0x6){_0x5bf922=util['format'](_0x2886('0x6f'),_0x460b74['remoteUri'],_0x730c41['id']);}logger['info']('[OUTBOUND]',_0x2886('0x7a'));emit(util[_0x2886('0x2a')]('user:%s',_0x1846e0[_0x2886('0x11')]),'trigger:browser:url',{'uri':_0x5bf922});})['catch'](function(_0x3631c5){logger[_0x2886('0x72')](_0x2886('0x74'),JSON[_0x2886('0x28')](_0x3631c5));});};exports[_0x2886('0x7b')]=function(_0x2979ad,_0x190ae6,_0x336e16,_0x70a5bf,_0x1716e9,_0x251728){var _0x2f8f80,_0x44579c,_0x3f799e,_0x402150;_0x251728['remoteUri']=intUtil[_0x2886('0x5b')](_0x251728[_0x2886('0x5a')]);_0x251728['serverUrl']=intUtil[_0x2886('0x5b')](_0x251728[_0x2886('0x5c')]);def[_0x2886('0x5d')]=util['format']('%s/service/v4_1/rest.php',_0x251728[_0x2886('0x5a')]);if(_0x1716e9&&_0x1716e9[_0x2886('0x5f')]){logger[_0x2886('0xf')]('['+_0x190ae6[_0x2886('0x7c')][_0x2886('0x7d')]()+']','Recording\x20is\x20enabled!');_0x190ae6[_0x2886('0x61')]=util['format'](_0x2886('0x62'),_0x251728[_0x2886('0x5c')],_0x190ae6[_0x2886('0x63')],md5(_0x190ae6[_0x2886('0x63')]));}else{_0x190ae6['recordingURL']='';}return getConnection(_0x251728)['then'](function(_0x2e67a9){_0x402150=_0x2e67a9;if(!_[_0x2886('0x2e')](_0x70a5bf)){return getUser(_0x251728,_0x70a5bf['name'],_0x402150);}else{return getUser(_0x251728,null,_0x402150);}})[_0x2886('0x3e')](function(_0x17b5ce){_0x2f8f80=_0x17b5ce;logger[_0x2886('0xf')]('The\x20User\x20ID\x20is:',_0x2f8f80['id']);return getEndUser(_0x251728,_0x190ae6[_0x2886('0x65')],_0x190ae6[_0x2886('0x66')],_0x402150);})[_0x2886('0x3e')](function(_0x4b45d5){_0x44579c=_0x4b45d5;logger[_0x2886('0xf')](_0x2886('0x77'),_0x44579c['id']);return getTicket(_0x251728,_0x2f8f80,_0x44579c,_0x336e16,_0x190ae6,_0x336e16[_0x2886('0x67')],_0x402150,_0x2886('0x68'));})[_0x2886('0x3e')](function(_0x33149e){_0x3f799e=_0x33149e;logger[_0x2886('0xf')]('Ticket\x20created!');logger[_0x2886('0xf')](_0x2886('0x6a'),_0x3f799e['id']);return setRelationship(_0x402150,_0x2f8f80,_0x3f799e,_0x2886('0x6b'));})[_0x2886('0x3e')](function(){return setRelationship(_0x402150,_0x44579c,_0x3f799e,_0x2886('0x79'));})[_0x2886('0x3e')](function(){return getServerInfo(_0x402150);})[_0x2886('0x7e')](function(_0x54a241){logger[_0x2886('0x72')]('['+_0x190ae6[_0x2886('0x7c')]['toUpperCase']()+']',JSON['stringify'](_0x54a241));});}; \ 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 8163b5c..2061e37 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 _0xbbdd=['type','string','content','variable','variableName','toString','customVariable','Variable','toLowerCase','push','name','keyValue','key','%s:\x20%s','format','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','length'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0xbbdd,0x1c6));var _0xdbbd=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xbbdd[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xdbbd('0x0'));var util=require('util');exports['getString']=function(_0x1d8b1e,_0x22628a,_0x36e22a){var _0x5cba3c=[];if(_0x1d8b1e['length']>0x0){var _0x129f52=_['sortBy'](_0x1d8b1e,['id']);for(var _0x26d949=0x0;_0x26d949<_0x129f52[_0xdbbd('0x1')];_0x26d949++){var _0x2c7115=_0x129f52[_0x26d949];if(_0x2c7115[_0xdbbd('0x2')]===_0xdbbd('0x3')){_0x5cba3c['push'](_0x2c7115[_0xdbbd('0x4')]);}else if(_0x2c7115[_0xdbbd('0x2')]===_0xdbbd('0x5')&&_0x2c7115['variableName']){_0x22628a[_0x2c7115[_0xdbbd('0x6')]]&&_0x5cba3c['push'](_0x22628a[_0x2c7115[_0xdbbd('0x6')]][_0xdbbd('0x7')]());}else if(_0x2c7115[_0xdbbd('0x2')]===_0xdbbd('0x8')&&_0x2c7115[_0xdbbd('0x9')]&&_0x2c7115[_0xdbbd('0x9')]['name']){_0x22628a[_0x2c7115[_0xdbbd('0x9')]['name'][_0xdbbd('0xa')]()]&&_0x5cba3c[_0xdbbd('0xb')](_0x22628a[_0x2c7115[_0xdbbd('0x9')][_0xdbbd('0xc')][_0xdbbd('0xa')]()][_0xdbbd('0x7')]());}else if(_0x2c7115[_0xdbbd('0x2')]===_0xdbbd('0xd')){if(_0x2c7115['keyType']==='string'&&_0x2c7115[_0xdbbd('0xe')]){_0x5cba3c[_0xdbbd('0xb')](util['format'](_0xdbbd('0xf'),_0x2c7115[_0xdbbd('0xe')],_0x2c7115['keyContent']));}else if(_0x2c7115['keyType']===_0xdbbd('0x5')&&_0x2c7115['variableName']&&_0x2c7115[_0xdbbd('0xe')]){_0x22628a[_0x2c7115['variableName']]&&_0x5cba3c[_0xdbbd('0xb')](util['format'](_0xdbbd('0xf'),_0x2c7115[_0xdbbd('0xe')],_0x22628a[_0x2c7115['variableName']]));}else if(_0x2c7115['keyType']===_0xdbbd('0x8')&&_0x2c7115[_0xdbbd('0x9')]&&_0x2c7115[_0xdbbd('0x9')][_0xdbbd('0xc')]&&_0x2c7115[_0xdbbd('0xe')]){_0x22628a[_0x2c7115['Variable'][_0xdbbd('0xc')][_0xdbbd('0xa')]()]&&_0x5cba3c[_0xdbbd('0xb')](util[_0xdbbd('0x10')](_0xdbbd('0xf'),_0x2c7115[_0xdbbd('0xe')],_0x22628a[_0x2c7115[_0xdbbd('0x9')][_0xdbbd('0xc')]['toLowerCase']()]));}}}}return _0x5cba3c['join'](_0x36e22a);};exports[_0xdbbd('0x11')]=function(_0x54db95){var _0xf6a028=_0x54db95[_0xdbbd('0x12')](-0x1);if(_0xf6a028==='/'){_0x54db95=_0x54db95[_0xdbbd('0x13')](0x0,_0x54db95[_0xdbbd('0x14')](_0xf6a028));}return _0x54db95;};exports[_0xdbbd('0x15')]=function(_0x211162){if(!_[_0xdbbd('0x16')](_0x211162)&&_0x211162!==''){var _0x6cd1c5=/^(([^<>()\[\]\\.,;:\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 _0x6cd1c5[_0xdbbd('0x17')](String(_0x211162)[_0xdbbd('0xa')]());}else{return![];}}; \ No newline at end of file +var _0x2691=['name','toLowerCase','toString','keyType','string','key','%s:\x20%s','keyContent','format','slice','lastIndexOf','validateEmail','isNil','lodash','util','getString','sortBy','length','type','push','content','variable','variableName','customVariable','Variable'];(function(_0xd405fb,_0xaaa0bd){var _0x211e1d=function(_0x360d91){while(--_0x360d91){_0xd405fb['push'](_0xd405fb['shift']());}};_0x211e1d(++_0xaaa0bd);}(_0x2691,0x1b6));var _0x1269=function(_0x2af279,_0x3677e0){_0x2af279=_0x2af279-0x0;var _0x541545=_0x2691[_0x2af279];return _0x541545;};'use strict';var _=require(_0x1269('0x0'));var util=require(_0x1269('0x1'));exports[_0x1269('0x2')]=function(_0x20ccf7,_0x28f127,_0x182494){var _0x5502a7=[];if(_0x20ccf7['length']>0x0){var _0x3b2b2e=_[_0x1269('0x3')](_0x20ccf7,['id']);for(var _0x5c3c8a=0x0;_0x5c3c8a<_0x3b2b2e[_0x1269('0x4')];_0x5c3c8a++){var _0x52d419=_0x3b2b2e[_0x5c3c8a];if(_0x52d419[_0x1269('0x5')]==='string'){_0x5502a7[_0x1269('0x6')](_0x52d419[_0x1269('0x7')]);}else if(_0x52d419[_0x1269('0x5')]===_0x1269('0x8')&&_0x52d419['variableName']){_0x28f127[_0x52d419[_0x1269('0x9')]]&&_0x5502a7[_0x1269('0x6')](_0x28f127[_0x52d419[_0x1269('0x9')]]['toString']());}else if(_0x52d419['type']===_0x1269('0xa')&&_0x52d419[_0x1269('0xb')]&&_0x52d419[_0x1269('0xb')][_0x1269('0xc')]){_0x28f127[_0x52d419[_0x1269('0xb')][_0x1269('0xc')]['toLowerCase']()]&&_0x5502a7['push'](_0x28f127[_0x52d419[_0x1269('0xb')][_0x1269('0xc')][_0x1269('0xd')]()][_0x1269('0xe')]());}else if(_0x52d419[_0x1269('0x5')]==='keyValue'){if(_0x52d419[_0x1269('0xf')]===_0x1269('0x10')&&_0x52d419[_0x1269('0x11')]){_0x5502a7['push'](util['format'](_0x1269('0x12'),_0x52d419['key'],_0x52d419[_0x1269('0x13')]));}else if(_0x52d419[_0x1269('0xf')]==='variable'&&_0x52d419[_0x1269('0x9')]&&_0x52d419[_0x1269('0x11')]){_0x28f127[_0x52d419['variableName']]&&_0x5502a7[_0x1269('0x6')](util[_0x1269('0x14')](_0x1269('0x12'),_0x52d419[_0x1269('0x11')],_0x28f127[_0x52d419[_0x1269('0x9')]]));}else if(_0x52d419[_0x1269('0xf')]===_0x1269('0xa')&&_0x52d419[_0x1269('0xb')]&&_0x52d419[_0x1269('0xb')][_0x1269('0xc')]&&_0x52d419['key']){_0x28f127[_0x52d419[_0x1269('0xb')][_0x1269('0xc')][_0x1269('0xd')]()]&&_0x5502a7['push'](util[_0x1269('0x14')](_0x1269('0x12'),_0x52d419[_0x1269('0x11')],_0x28f127[_0x52d419[_0x1269('0xb')][_0x1269('0xc')]['toLowerCase']()]));}}}}return _0x5502a7['join'](_0x182494);};exports['stripTrailingSlash']=function(_0x4f7baa){var _0x2204cb=_0x4f7baa[_0x1269('0x15')](-0x1);if(_0x2204cb==='/'){_0x4f7baa=_0x4f7baa['substring'](0x0,_0x4f7baa[_0x1269('0x16')](_0x2204cb));}return _0x4f7baa;};exports[_0x1269('0x17')]=function(_0x436059){if(!_[_0x1269('0x18')](_0x436059)&&_0x436059!==''){var _0x5a7754=/^(([^<>()\[\]\\.,;:\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 _0x5a7754['test'](String(_0x436059)[_0x1269('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 e24f932..fa13762 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x9f0520,_0x5ed64a){var _0x16b2f3=function(_0x1e72c0){while(--_0x1e72c0){_0x9f0520['push'](_0x9f0520['shift']());}};_0x16b2f3(++_0x5ed64a);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _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(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 001b752..f24a25f 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 _0xab22=['POST','Tags','name','getString','Descriptions','Fields','ticket','%s/search.json','then','count','Agent\x20found!','find','agent','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','filter','end-user','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','token','username','Basic\x20%s','toString','[HTTP]','stringify','GET','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','/api/v2','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xab22,0x127));var _0x2ab2=function(_0x27c294,_0x2e8e21){_0x27c294=_0x27c294-0x0;var _0x18bfad=_0xab22[_0x27c294];return _0x18bfad;};'use strict';var _=require(_0x2ab2('0x0'));var rp=require(_0x2ab2('0x1'));var md5=require(_0x2ab2('0x2'));var util=require(_0x2ab2('0x3'));var Redis=require(_0x2ab2('0x4'));var intUtil=require(_0x2ab2('0x5'));var config=require(_0x2ab2('0x6'));var logger=require(_0x2ab2('0x7'))(_0x2ab2('0x8'));config['redis']=_[_0x2ab2('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2ab2('0xa')]));function emit(_0x1e55ef,_0x185690,_0x2d74cb){io['to'](_0x1e55ef)[_0x2ab2('0xb')](_0x185690,_0x2d74cb);}var headers={'Content-Type':_0x2ab2('0xc'),'Accept':_0x2ab2('0xc')};function getTicket(_0x13aa71,_0x26fb5a,_0x3cea8e,_0x255172,_0x42b4e5){logger[_0x2ab2('0xd')](_0x2ab2('0xe'));return request({'uri':util[_0x2ab2('0xf')]('%s/tickets.json',_0x13aa71[_0x2ab2('0x10')]),'method':_0x2ab2('0x11'),'body':{'ticket':_['merge']({'requester_id':_0x3cea8e['id'],'submitter_id':_0x26fb5a?_0x26fb5a['id']:undefined,'assignee_id':_0x26fb5a?_0x26fb5a['id']:undefined,'tags':getTags(_0x255172[_0x2ab2('0x12')],_0x2ab2('0x13')),'subject':intUtil['getString'](_0x255172['Subjects'],_0x42b4e5,'\x20'),'description':intUtil[_0x2ab2('0x14')](_0x255172[_0x2ab2('0x15')],_0x42b4e5,'\x0a'),'comment':{'public':![],'body':intUtil[_0x2ab2('0x14')](_0x255172[_0x2ab2('0x15')],_0x42b4e5,'\x0a')}},getCustomFields(_0x255172[_0x2ab2('0x16')],_0x42b4e5))}})['then'](function(_0x3b4be8){logger[_0x2ab2('0xd')]('Ticket\x20created!');return _0x3b4be8[_0x2ab2('0x17')];});}function getUser(_0x1fc93f,_0x277746){if(intUtil['validateEmail'](_0x277746)){logger['info']('Getting\x20agent\x20with\x20email',_0x277746);return request({'uri':util['format'](_0x2ab2('0x18'),_0x1fc93f[_0x2ab2('0x10')]),'qs':{'query':util[_0x2ab2('0xf')]('type:user\x20role:agent\x20email:%s',_0x277746)}})[_0x2ab2('0x19')](function(_0x5b3659){if(_0x5b3659[_0x2ab2('0x1a')]){logger[_0x2ab2('0xd')](_0x2ab2('0x1b'));return _[_0x2ab2('0x1c')](_0x5b3659['results'],{'email':_0x277746,'role':_0x2ab2('0x1d')});}else{logger[_0x2ab2('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x2ab2('0x1e'),_0x1fc93f['remoteUri'])})[_0x2ab2('0x19')](function(_0x5bb520){logger[_0x2ab2('0xd')]('Admin\x20account\x20selected.');return _0x5bb520[_0x2ab2('0x1f')];});}});}else{logger[_0x2ab2('0xd')](_0x2ab2('0x20'));return request({'uri':util['format'](_0x2ab2('0x1e'),_0x1fc93f[_0x2ab2('0x10')])})[_0x2ab2('0x19')](function(_0x4e54a0){logger[_0x2ab2('0xd')](_0x2ab2('0x21'));return _0x4e54a0[_0x2ab2('0x1f')];});}}function getEndUser(_0x1f65a3,_0xace95e,_0x170492){logger[_0x2ab2('0xd')](_0x2ab2('0x22'),_0x170492);return request({'uri':util[_0x2ab2('0xf')]('%s/search.json',_0x1f65a3[_0x2ab2('0x10')]),'qs':{'query':util[_0x2ab2('0xf')](_0x2ab2('0x23'),_0x170492)}})[_0x2ab2('0x19')](function(_0x45f8b4){var _0x19435e;if(_0x45f8b4[_0x2ab2('0x24')]['length']){_0x45f8b4['results']=_[_0x2ab2('0x25')](_0x45f8b4[_0x2ab2('0x24')],{'suspended':![],'role':_0x2ab2('0x26')});if(_0x45f8b4['results'][_0x2ab2('0x27')]){_0x19435e=_['first'](_0x45f8b4[_0x2ab2('0x24')]);}}if(_0x19435e){logger['info'](_0x2ab2('0x28'));return _0x19435e;}else{logger[_0x2ab2('0xd')](_0x2ab2('0x29'));return request({'uri':util[_0x2ab2('0xf')](_0x2ab2('0x2a'),_0x1f65a3[_0x2ab2('0x10')]),'method':_0x2ab2('0x11'),'body':{'user':{'role':_0x2ab2('0x26'),'name':util[_0x2ab2('0xf')](_0x2ab2('0x2b'),_0xace95e||_0x170492),'phone':_0x170492}}})['then'](function(_0x3c72dd){logger[_0x2ab2('0xd')]('Enduser\x20created.');return _0x3c72dd[_0x2ab2('0x1f')];});}});}function getAuth(_0x415a1e){var _0x23f1fc;if(_0x415a1e[_0x2ab2('0x2c')]===_0x2ab2('0x2d')){_0x23f1fc=util[_0x2ab2('0xf')](_0x2ab2('0x2e'),_0x415a1e['username'],_0x415a1e[_0x2ab2('0x2d')]);}else if(_0x415a1e['authType']===_0x2ab2('0x2f')){_0x23f1fc=util[_0x2ab2('0xf')]('%s/token:%s',_0x415a1e[_0x2ab2('0x30')],_0x415a1e[_0x2ab2('0x2f')]);}return util['format'](_0x2ab2('0x31'),new Buffer(_0x23f1fc)[_0x2ab2('0x32')]('base64'));}function request(_0x2bb85e){logger['debug'](_0x2ab2('0x33'),JSON[_0x2ab2('0x34')](_0x2bb85e));return rp(_['defaults'](_0x2bb85e,{'method':_0x2ab2('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x1b14b5,_0x9e1321){var _0x754ff7=[];if(_0x1b14b5&&_0x1b14b5[_0x2ab2('0x27')]>0x0){_0x754ff7=_['map'](_0x1b14b5,_0x9e1321);}return _0x754ff7;}function getCustomFields(_0x66b666,_0xfb4a02){var _0xbc9142=[];var _0x159214={'custom_fields':[]};if(_0x66b666[_0x2ab2('0x27')]>0x0){_['forEach'](_0x66b666,function(_0x3d96cd){if(_[_0x2ab2('0x36')]([_0x2ab2('0x37'),_0x2ab2('0x38')],_0x3d96cd[_0x2ab2('0x39')])&&_0x3d96cd[_0x2ab2('0x3a')]&&!_0x3d96cd[_0x2ab2('0x3b')]){_0x159214[_0x3d96cd[_0x2ab2('0x3a')][_0x2ab2('0x3c')]()]=_0x3d96cd[_0x2ab2('0x3d')][_0x2ab2('0x32')]();}else if(_[_0x2ab2('0x36')]([_0x2ab2('0x37'),_0x2ab2('0x38')],_0x3d96cd[_0x2ab2('0x39')])&&_0x3d96cd[_0x2ab2('0x3e')]&&_0x3d96cd[_0x2ab2('0x3b')]){_0x159214[_0x2ab2('0x3f')][_0x2ab2('0x40')]({'id':_0x3d96cd[_0x2ab2('0x3e')],'value':_0x3d96cd['content'][_0x2ab2('0x32')]()});}else if(_0x3d96cd['type']===_0x2ab2('0x41')&&_0x3d96cd[_0x2ab2('0x42')]&&_0x3d96cd['idField']&&_0x3d96cd[_0x2ab2('0x3b')]){_0xfb4a02[_0x3d96cd[_0x2ab2('0x42')]]&&_0x159214[_0x2ab2('0x3f')][_0x2ab2('0x40')]({'id':_0x3d96cd[_0x2ab2('0x3e')],'value':_0xfb4a02[_0x3d96cd[_0x2ab2('0x42')]][_0x2ab2('0x32')]()});}else if(_0x3d96cd[_0x2ab2('0x39')]==='customVariable'&&_0x3d96cd['Variable']&&_0x3d96cd[_0x2ab2('0x43')]['name']&&_0x3d96cd['idField']&&_0x3d96cd[_0x2ab2('0x3b')]){_0xfb4a02[_0x3d96cd['Variable'][_0x2ab2('0x13')][_0x2ab2('0x3c')]()]&&_0x159214[_0x2ab2('0x3f')][_0x2ab2('0x40')]({'id':_0x3d96cd[_0x2ab2('0x3e')],'value':_0xfb4a02[_0x3d96cd[_0x2ab2('0x43')]['name'][_0x2ab2('0x3c')]()][_0x2ab2('0x32')]()});}});}return _0x159214;}exports[_0x2ab2('0x44')]=function(_0x502f4e,_0x382a66,_0x4375ac,_0x4376e6,_0x8ae264,_0xd57e78){var _0x3b47f9,_0x36b1bd;_0xd57e78[_0x2ab2('0x10')]=intUtil[_0x2ab2('0x45')](_0xd57e78[_0x2ab2('0x10')]);_0xd57e78['serverUrl']=intUtil[_0x2ab2('0x45')](_0xd57e78[_0x2ab2('0x46')]);if(_0x8ae264&&_0x8ae264[_0x2ab2('0x47')]){logger[_0x2ab2('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x382a66[_0x2ab2('0x48')]=util[_0x2ab2('0xf')](_0x2ab2('0x49'),_0xd57e78[_0x2ab2('0x46')],_0x382a66[_0x2ab2('0x4a')],md5(_0x382a66['uniqueid']));}else{_0x382a66[_0x2ab2('0x48')]='';}headers[_0x2ab2('0x4b')]=getAuth(_0xd57e78);return getUser(_0xd57e78,_0x4376e6[_0x2ab2('0x4c')])[_0x2ab2('0x19')](function(_0x5b876c){_0x3b47f9=_0x5b876c;logger['info']('The\x20User\x20ID\x20is:',_0x3b47f9['id']);return getEndUser(_0xd57e78,_0x382a66['calleridname'],_0x382a66[_0x2ab2('0x4d')]);})[_0x2ab2('0x19')](function(_0x483321){_0x36b1bd=_0x483321;logger[_0x2ab2('0xd')]('The\x20Enduser\x20ID\x20is:',_0x36b1bd['id']);return getTicket(_0xd57e78,_0x3b47f9,_0x36b1bd,_0x4375ac,_0x382a66);})['then'](function(_0x56a041){if(_0x56a041){logger[_0x2ab2('0xd')](_0x2ab2('0x4e'),_0x56a041['id']);switch(_0xd57e78['type']){case _0x2ab2('0x4f'):logger['info'](_0x2ab2('0x50'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x2ab2('0xf')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xd57e78[_0x2ab2('0x10')],_0x3b47f9['id'],_0x56a041['id']),'method':_0x2ab2('0x11')});case _0x2ab2('0x51'):logger['info'](_0x2ab2('0x50'),_0x2ab2('0x52'));emit(util[_0x2ab2('0xf')](_0x2ab2('0x53'),_0x4376e6[_0x2ab2('0x13')]),_0x2ab2('0x54'),{'uri':util['format']('%s/agent/tickets/%s',_0xd57e78[_0x2ab2('0x10')][_0x2ab2('0x55')]('/api/v2',''),_0x56a041['id'])});break;default:logger['error'](_0x2ab2('0x50'),_0x2ab2('0x56'));}}})[_0x2ab2('0x57')](function(_0x475cbc){logger[_0x2ab2('0x58')](_0x2ab2('0x59'),util[_0x2ab2('0x5a')](_0x475cbc,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x524c60,_0x52f6c0,_0x1bb6e6,_0x31a143,_0xaa6795,_0x2ce763,_0x23b92a){var _0x39ecca,_0x52cd16;_0x2ce763[_0x2ab2('0x10')]=intUtil['stripTrailingSlash'](_0x2ce763['remoteUri']);_0x2ce763[_0x2ab2('0x46')]=intUtil[_0x2ab2('0x45')](_0x2ce763[_0x2ab2('0x46')]);if(_0x23b92a&&_0x23b92a[_0x2ab2('0x5b')]&&_0x23b92a['recordingFormat']!=='none'){logger[_0x2ab2('0xd')]('[OUTBOUND]',_0x2ab2('0x5c'));_0x52f6c0[_0x2ab2('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ce763[_0x2ab2('0x46')],_0x52f6c0[_0x2ab2('0x4a')],md5(_0x52f6c0['uniqueid']));}headers[_0x2ab2('0x4b')]=getAuth(_0x2ce763);return getUser(_0x2ce763,_0x31a143['email'])['then'](function(_0x1df1da){_0x39ecca=_0x1df1da;logger[_0x2ab2('0xd')](_0x2ab2('0x5d'),_0x39ecca['id']);return getEndUser(_0x2ce763,_0x52f6c0[_0x2ab2('0x5e')],_0x52f6c0[_0x2ab2('0x5f')]);})['then'](function(_0x5c459e){_0x52cd16=_0x5c459e;logger[_0x2ab2('0xd')](_0x2ab2('0x60'),_0x52cd16['id']);return getTicket(_0x2ce763,_0x39ecca,_0x52cd16,_0x1bb6e6,_0x52f6c0);})[_0x2ab2('0x19')](function(_0x3795c6){if(_0x3795c6){logger[_0x2ab2('0xd')](_0x2ab2('0x4e'),_0x3795c6['id']);switch(_0x2ce763['type']){case'integrationTab':logger['info'](_0x2ab2('0x61'),_0x2ab2('0x62'));return request({'uri':util[_0x2ab2('0xf')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2ce763[_0x2ab2('0x10')],_0x39ecca['id'],_0x3795c6['id']),'method':_0x2ab2('0x11')});case _0x2ab2('0x51'):logger[_0x2ab2('0xd')](_0x2ab2('0x61'),_0x2ab2('0x52'));emit(util[_0x2ab2('0xf')]('user:%s',_0x31a143['name']),'trigger:browser:url',{'uri':util[_0x2ab2('0xf')](_0x2ab2('0x63'),_0x2ce763[_0x2ab2('0x10')][_0x2ab2('0x55')](_0x2ab2('0x64'),''),_0x3795c6['id'])});break;default:logger[_0x2ab2('0x58')](_0x2ab2('0x61'),_0x2ab2('0x56'));}}})[_0x2ab2('0x57')](function(_0x4e5adb){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x2ab2('0x5a')](_0x4e5adb,{'showHidden':!![],'depth':null}));});};exports[_0x2ab2('0x65')]=function(_0x32794a,_0x4db7ad,_0x573bfd,_0x5c61e6,_0x4dd2ff,_0x364345){var _0x571d54,_0x28457e;_0x364345['remoteUri']=intUtil[_0x2ab2('0x45')](_0x364345[_0x2ab2('0x10')]);_0x364345[_0x2ab2('0x46')]=intUtil[_0x2ab2('0x45')](_0x364345[_0x2ab2('0x46')]);if(_0x4dd2ff&&_0x4dd2ff[_0x2ab2('0x47')]){logger[_0x2ab2('0xd')]('['+_0x4db7ad[_0x2ab2('0x66')][_0x2ab2('0x67')]()+']',_0x2ab2('0x5c'));_0x4db7ad[_0x2ab2('0x48')]=util[_0x2ab2('0xf')](_0x2ab2('0x49'),_0x364345[_0x2ab2('0x46')],_0x4db7ad[_0x2ab2('0x4a')],md5(_0x4db7ad[_0x2ab2('0x4a')]));}else{_0x4db7ad[_0x2ab2('0x48')]='';}headers[_0x2ab2('0x4b')]=getAuth(_0x364345);return getUser(_0x364345)[_0x2ab2('0x19')](function(_0x27dc9f){_0x571d54=_0x27dc9f;logger[_0x2ab2('0xd')](_0x2ab2('0x5d'),_0x571d54['id']);return getEndUser(_0x364345,_0x4db7ad['calleridname'],_0x4db7ad['calleridnum']);})[_0x2ab2('0x19')](function(_0x582f79){_0x28457e=_0x582f79;logger[_0x2ab2('0xd')](_0x2ab2('0x60'),_0x28457e['id']);return getTicket(_0x364345,_0x571d54,_0x28457e,_0x573bfd,_0x4db7ad);})[_0x2ab2('0x19')](function(_0x243af3){if(_0x243af3){logger['info'](_0x2ab2('0x4e'),_0x243af3['id']);}})['catch'](function(_0x31ca62){logger[_0x2ab2('0x58')]('['+_0x4db7ad[_0x2ab2('0x66')][_0x2ab2('0x67')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x31ca62,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x10db=['getString','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','toString','base64','[HTTP]','stringify','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','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','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','%s/agent/tickets/%s','/api/v2','catch','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','name','Subjects'];(function(_0x3b048d,_0x450938){var _0x31b2d4=function(_0x13ebc0){while(--_0x13ebc0){_0x3b048d['push'](_0x3b048d['shift']());}};_0x31b2d4(++_0x450938);}(_0x10db,0xd9));var _0xb10d=function(_0x5e9698,_0x2a46b1){_0x5e9698=_0x5e9698-0x0;var _0x526c8a=_0x10db[_0x5e9698];return _0x526c8a;};'use strict';var _=require(_0xb10d('0x0'));var rp=require(_0xb10d('0x1'));var md5=require(_0xb10d('0x2'));var util=require(_0xb10d('0x3'));var Redis=require(_0xb10d('0x4'));var intUtil=require(_0xb10d('0x5'));var config=require(_0xb10d('0x6'));var logger=require('../../../../config/logger')(_0xb10d('0x7'));config[_0xb10d('0x8')]=_[_0xb10d('0x9')](config[_0xb10d('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xb10d('0xa'))(new Redis(config[_0xb10d('0x8')]));function emit(_0x4b5030,_0x405a78,_0x2449c1){io['to'](_0x4b5030)[_0xb10d('0xb')](_0x405a78,_0x2449c1);}var headers={'Content-Type':'application/json','Accept':_0xb10d('0xc')};function getTicket(_0x436132,_0x352eb1,_0x30e960,_0x2f11b0,_0x1841c4){logger[_0xb10d('0xd')](_0xb10d('0xe'));return request({'uri':util[_0xb10d('0xf')](_0xb10d('0x10'),_0x436132[_0xb10d('0x11')]),'method':'POST','body':{'ticket':_[_0xb10d('0x12')]({'requester_id':_0x30e960['id'],'submitter_id':_0x352eb1?_0x352eb1['id']:undefined,'assignee_id':_0x352eb1?_0x352eb1['id']:undefined,'tags':getTags(_0x2f11b0['Tags'],_0xb10d('0x13')),'subject':intUtil['getString'](_0x2f11b0[_0xb10d('0x14')],_0x1841c4,'\x20'),'description':intUtil[_0xb10d('0x15')](_0x2f11b0[_0xb10d('0x16')],_0x1841c4,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x2f11b0[_0xb10d('0x16')],_0x1841c4,'\x0a')}},getCustomFields(_0x2f11b0[_0xb10d('0x17')],_0x1841c4))}})[_0xb10d('0x18')](function(_0x2a5029){logger[_0xb10d('0xd')](_0xb10d('0x19'));return _0x2a5029[_0xb10d('0x1a')];});}function getUser(_0x2cfaf0,_0x51b769){if(intUtil['validateEmail'](_0x51b769)){logger[_0xb10d('0xd')](_0xb10d('0x1b'),_0x51b769);return request({'uri':util[_0xb10d('0xf')](_0xb10d('0x1c'),_0x2cfaf0[_0xb10d('0x11')]),'qs':{'query':util[_0xb10d('0xf')](_0xb10d('0x1d'),_0x51b769)}})[_0xb10d('0x18')](function(_0x4227be){if(_0x4227be[_0xb10d('0x1e')]){logger[_0xb10d('0xd')]('Agent\x20found!');return _[_0xb10d('0x1f')](_0x4227be['results'],{'email':_0x51b769,'role':_0xb10d('0x20')});}else{logger[_0xb10d('0xd')](_0xb10d('0x21'));return request({'uri':util[_0xb10d('0xf')](_0xb10d('0x22'),_0x2cfaf0['remoteUri'])})['then'](function(_0x32374b){logger[_0xb10d('0xd')](_0xb10d('0x23'));return _0x32374b[_0xb10d('0x24')];});}});}else{logger['info'](_0xb10d('0x21'));return request({'uri':util[_0xb10d('0xf')]('%s/users/me.json',_0x2cfaf0[_0xb10d('0x11')])})[_0xb10d('0x18')](function(_0x58261a){logger[_0xb10d('0xd')](_0xb10d('0x23'));return _0x58261a['user'];});}}function getEndUser(_0x2a428f,_0x45c664,_0x537cd1){logger[_0xb10d('0xd')](_0xb10d('0x25'),_0x537cd1);return request({'uri':util[_0xb10d('0xf')](_0xb10d('0x1c'),_0x2a428f[_0xb10d('0x11')]),'qs':{'query':util[_0xb10d('0xf')](_0xb10d('0x26'),_0x537cd1)}})[_0xb10d('0x18')](function(_0x3443db){var _0x1c1341;if(_0x3443db['results']['length']){_0x3443db[_0xb10d('0x27')]=_[_0xb10d('0x28')](_0x3443db[_0xb10d('0x27')],{'suspended':![],'role':_0xb10d('0x29')});if(_0x3443db[_0xb10d('0x27')][_0xb10d('0x2a')]){_0x1c1341=_[_0xb10d('0x2b')](_0x3443db[_0xb10d('0x27')]);}}if(_0x1c1341){logger[_0xb10d('0xd')](_0xb10d('0x2c'));return _0x1c1341;}else{logger[_0xb10d('0xd')](_0xb10d('0x2d'));return request({'uri':util[_0xb10d('0xf')](_0xb10d('0x2e'),_0x2a428f[_0xb10d('0x11')]),'method':'POST','body':{'user':{'role':_0xb10d('0x29'),'name':util['format'](_0xb10d('0x2f'),_0x45c664||_0x537cd1),'phone':_0x537cd1}}})[_0xb10d('0x18')](function(_0x47a59b){logger[_0xb10d('0xd')](_0xb10d('0x30'));return _0x47a59b[_0xb10d('0x24')];});}});}function getAuth(_0x1e04b8){var _0x1dcbbb;if(_0x1e04b8[_0xb10d('0x31')]===_0xb10d('0x32')){_0x1dcbbb=util[_0xb10d('0xf')](_0xb10d('0x33'),_0x1e04b8['username'],_0x1e04b8[_0xb10d('0x32')]);}else if(_0x1e04b8['authType']===_0xb10d('0x34')){_0x1dcbbb=util['format'](_0xb10d('0x35'),_0x1e04b8[_0xb10d('0x36')],_0x1e04b8['token']);}return util[_0xb10d('0xf')]('Basic\x20%s',new Buffer(_0x1dcbbb)[_0xb10d('0x37')](_0xb10d('0x38')));}function request(_0x376ec0){logger['debug'](_0xb10d('0x39'),JSON[_0xb10d('0x3a')](_0x376ec0));return rp(_[_0xb10d('0x9')](_0x376ec0,{'method':_0xb10d('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x17b87c,_0x585296){var _0x5d3a9b=[];if(_0x17b87c&&_0x17b87c[_0xb10d('0x2a')]>0x0){_0x5d3a9b=_[_0xb10d('0x3c')](_0x17b87c,_0x585296);}return _0x5d3a9b;}function getCustomFields(_0x25ef92,_0x164e90){var _0x35d54a=[];var _0x5957d9={'custom_fields':[]};if(_0x25ef92[_0xb10d('0x2a')]>0x0){_[_0xb10d('0x3d')](_0x25ef92,function(_0x533e38){if(_[_0xb10d('0x3e')](['string',_0xb10d('0x3f')],_0x533e38[_0xb10d('0x40')])&&_0x533e38[_0xb10d('0x41')]&&!_0x533e38[_0xb10d('0x42')]){_0x5957d9[_0x533e38[_0xb10d('0x41')][_0xb10d('0x43')]()]=_0x533e38[_0xb10d('0x44')][_0xb10d('0x37')]();}else if(_[_0xb10d('0x3e')]([_0xb10d('0x45'),'picklist'],_0x533e38['type'])&&_0x533e38[_0xb10d('0x46')]&&_0x533e38['customField']){_0x5957d9[_0xb10d('0x47')][_0xb10d('0x48')]({'id':_0x533e38['idField'],'value':_0x533e38[_0xb10d('0x44')][_0xb10d('0x37')]()});}else if(_0x533e38['type']===_0xb10d('0x49')&&_0x533e38[_0xb10d('0x4a')]&&_0x533e38[_0xb10d('0x46')]&&_0x533e38['customField']){_0x164e90[_0x533e38[_0xb10d('0x4a')]]&&_0x5957d9[_0xb10d('0x47')][_0xb10d('0x48')]({'id':_0x533e38[_0xb10d('0x46')],'value':_0x164e90[_0x533e38['variableName']][_0xb10d('0x37')]()});}else if(_0x533e38[_0xb10d('0x40')]===_0xb10d('0x4b')&&_0x533e38['Variable']&&_0x533e38[_0xb10d('0x4c')][_0xb10d('0x13')]&&_0x533e38['idField']&&_0x533e38[_0xb10d('0x42')]){_0x164e90[_0x533e38['Variable'][_0xb10d('0x13')][_0xb10d('0x43')]()]&&_0x5957d9['custom_fields'][_0xb10d('0x48')]({'id':_0x533e38[_0xb10d('0x46')],'value':_0x164e90[_0x533e38[_0xb10d('0x4c')]['name'][_0xb10d('0x43')]()]['toString']()});}});}return _0x5957d9;}exports[_0xb10d('0x4d')]=function(_0x51768f,_0x422de6,_0x4bf253,_0x42eb7e,_0x2b3cb7,_0x5102a3){var _0x339f8a,_0x309a0c;_0x5102a3[_0xb10d('0x11')]=intUtil[_0xb10d('0x4e')](_0x5102a3['remoteUri']);_0x5102a3[_0xb10d('0x4f')]=intUtil[_0xb10d('0x4e')](_0x5102a3[_0xb10d('0x4f')]);if(_0x2b3cb7&&_0x2b3cb7[_0xb10d('0x50')]){logger['info'](_0xb10d('0x51'),_0xb10d('0x52'));_0x422de6[_0xb10d('0x53')]=util[_0xb10d('0xf')](_0xb10d('0x54'),_0x5102a3[_0xb10d('0x4f')],_0x422de6['uniqueid'],md5(_0x422de6[_0xb10d('0x55')]));}else{_0x422de6[_0xb10d('0x53')]='';}headers['Authorization']=getAuth(_0x5102a3);return getUser(_0x5102a3,_0x42eb7e['email'])['then'](function(_0x568cb8){_0x339f8a=_0x568cb8;logger[_0xb10d('0xd')]('The\x20User\x20ID\x20is:',_0x339f8a['id']);return getEndUser(_0x5102a3,_0x422de6[_0xb10d('0x56')],_0x422de6[_0xb10d('0x57')]);})[_0xb10d('0x18')](function(_0x503910){_0x309a0c=_0x503910;logger[_0xb10d('0xd')](_0xb10d('0x58'),_0x309a0c['id']);return getTicket(_0x5102a3,_0x339f8a,_0x309a0c,_0x4bf253,_0x422de6);})[_0xb10d('0x18')](function(_0x125a3d){if(_0x125a3d){logger['info'](_0xb10d('0x59'),_0x125a3d['id']);switch(_0x5102a3[_0xb10d('0x40')]){case _0xb10d('0x5a'):logger['info'](_0xb10d('0x51'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xb10d('0xf')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5102a3[_0xb10d('0x11')],_0x339f8a['id'],_0x125a3d['id']),'method':_0xb10d('0x5b')});case _0xb10d('0x5c'):logger[_0xb10d('0xd')](_0xb10d('0x51'),_0xb10d('0x5d'));emit(util[_0xb10d('0xf')](_0xb10d('0x5e'),_0x42eb7e[_0xb10d('0x13')]),_0xb10d('0x5f'),{'uri':util[_0xb10d('0xf')]('%s/agent/tickets/%s',_0x5102a3['remoteUri'][_0xb10d('0x60')]('/api/v2',''),_0x125a3d['id'])});break;default:logger[_0xb10d('0x61')](_0xb10d('0x51'),_0xb10d('0x62'));}}})['catch'](function(_0x38dc14){logger['error'](_0xb10d('0x63'),util[_0xb10d('0x64')](_0x38dc14,{'showHidden':!![],'depth':null}));});};exports[_0xb10d('0x65')]=function(_0x12d264,_0x8bb762,_0x410986,_0x196048,_0x29cc70,_0x47ece1,_0x364911){var _0x583f36,_0x37edc7;_0x47ece1['remoteUri']=intUtil[_0xb10d('0x4e')](_0x47ece1['remoteUri']);_0x47ece1[_0xb10d('0x4f')]=intUtil[_0xb10d('0x4e')](_0x47ece1[_0xb10d('0x4f')]);if(_0x364911&&_0x364911[_0xb10d('0x66')]&&_0x364911[_0xb10d('0x66')]!==_0xb10d('0x67')){logger[_0xb10d('0xd')](_0xb10d('0x68'),_0xb10d('0x52'));_0x8bb762[_0xb10d('0x53')]=util['format'](_0xb10d('0x54'),_0x47ece1[_0xb10d('0x4f')],_0x8bb762['uniqueid'],md5(_0x8bb762['uniqueid']));}headers[_0xb10d('0x69')]=getAuth(_0x47ece1);return getUser(_0x47ece1,_0x196048[_0xb10d('0x6a')])['then'](function(_0x2033e1){_0x583f36=_0x2033e1;logger[_0xb10d('0xd')](_0xb10d('0x6b'),_0x583f36['id']);return getEndUser(_0x47ece1,_0x8bb762[_0xb10d('0x6c')],_0x8bb762[_0xb10d('0x6d')]);})[_0xb10d('0x18')](function(_0x5c2ed7){_0x37edc7=_0x5c2ed7;logger[_0xb10d('0xd')](_0xb10d('0x58'),_0x37edc7['id']);return getTicket(_0x47ece1,_0x583f36,_0x37edc7,_0x410986,_0x8bb762);})[_0xb10d('0x18')](function(_0x59b45c){if(_0x59b45c){logger[_0xb10d('0xd')](_0xb10d('0x59'),_0x59b45c['id']);switch(_0x47ece1['type']){case _0xb10d('0x5a'):logger[_0xb10d('0xd')](_0xb10d('0x68'),_0xb10d('0x6e'));return request({'uri':util[_0xb10d('0xf')](_0xb10d('0x6f'),_0x47ece1[_0xb10d('0x11')],_0x583f36['id'],_0x59b45c['id']),'method':'POST'});case _0xb10d('0x5c'):logger['info'](_0xb10d('0x68'),_0xb10d('0x5d'));emit(util[_0xb10d('0xf')](_0xb10d('0x5e'),_0x196048[_0xb10d('0x13')]),_0xb10d('0x5f'),{'uri':util[_0xb10d('0xf')](_0xb10d('0x70'),_0x47ece1[_0xb10d('0x11')][_0xb10d('0x60')](_0xb10d('0x71'),''),_0x59b45c['id'])});break;default:logger[_0xb10d('0x61')](_0xb10d('0x68'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xb10d('0x72')](function(_0x1b7103){logger[_0xb10d('0x61')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xb10d('0x64')](_0x1b7103,{'showHidden':!![],'depth':null}));});};exports[_0xb10d('0x73')]=function(_0x272790,_0x4f5774,_0x1cb77c,_0x3ae6ca,_0x1f857a,_0x27da39){var _0x391164,_0x395936;_0x27da39[_0xb10d('0x11')]=intUtil['stripTrailingSlash'](_0x27da39[_0xb10d('0x11')]);_0x27da39['serverUrl']=intUtil['stripTrailingSlash'](_0x27da39[_0xb10d('0x4f')]);if(_0x1f857a&&_0x1f857a[_0xb10d('0x50')]){logger[_0xb10d('0xd')]('['+_0x4f5774[_0xb10d('0x74')][_0xb10d('0x75')]()+']','Recording\x20is\x20enabled!');_0x4f5774[_0xb10d('0x53')]=util[_0xb10d('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x27da39[_0xb10d('0x4f')],_0x4f5774[_0xb10d('0x55')],md5(_0x4f5774[_0xb10d('0x55')]));}else{_0x4f5774['recordingURL']='';}headers[_0xb10d('0x69')]=getAuth(_0x27da39);return getUser(_0x27da39)[_0xb10d('0x18')](function(_0x465e2e){_0x391164=_0x465e2e;logger['info'](_0xb10d('0x6b'),_0x391164['id']);return getEndUser(_0x27da39,_0x4f5774[_0xb10d('0x56')],_0x4f5774[_0xb10d('0x57')]);})['then'](function(_0x4e2aa7){_0x395936=_0x4e2aa7;logger[_0xb10d('0xd')](_0xb10d('0x58'),_0x395936['id']);return getTicket(_0x27da39,_0x391164,_0x395936,_0x1cb77c,_0x4f5774);})[_0xb10d('0x18')](function(_0x9d96f6){if(_0x9d96f6){logger[_0xb10d('0xd')](_0xb10d('0x59'),_0x9d96f6['id']);}})[_0xb10d('0x72')](function(_0x12d7cf){logger[_0xb10d('0x61')]('['+_0x4f5774[_0xb10d('0x74')][_0xb10d('0x75')]()+']'+_0xb10d('0x76'),util['inspect'](_0x12d7cf,{'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 6842108..b3702af 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 _0x16f2=['Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','https://crm.','outbound','recordingFormat','none','The\x20User\x20ID\x20is:','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','unmanaged','monitor_format','lodash','request-promise','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','debug','stringify','length','forEach','includes','string','picklist','idField','content','type','variable','variableName','toString','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Agent\x20found!','info','Using\x20the\x20admin\x20account!','user','profile','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','administrator','Subject','Description','getString','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Call_Result','complete','connect','Answered','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','starttime','agentcalledAt','Inbound','merge','/crm/v2/Calls'];(function(_0x19cc0b,_0x2bd519){var _0x5b0f0e=function(_0x27894f){while(--_0x27894f){_0x19cc0b['push'](_0x19cc0b['shift']());}};_0x5b0f0e(++_0x2bd519);}(_0x16f2,0x150));var _0x216f=function(_0x1a79c6,_0x5bad0b){_0x1a79c6=_0x1a79c6-0x0;var _0x301647=_0x16f2[_0x1a79c6];return _0x301647;};'use strict';var _=require(_0x216f('0x0'));var rp=require(_0x216f('0x1'));var md5=require(_0x216f('0x2'));var util=require(_0x216f('0x3'));var intUtil=require(_0x216f('0x4'));var moment=require(_0x216f('0x5'));var Redis=require(_0x216f('0x6'));var BPromise=require('bluebird');var config=require(_0x216f('0x7'));var logger=require(_0x216f('0x8'))('zoho');config[_0x216f('0x9')]=_[_0x216f('0xa')](config[_0x216f('0x9')],{'host':_0x216f('0xb'),'port':0x18eb});var io=require(_0x216f('0xc'))(new Redis(config[_0x216f('0x9')]));function emit(_0x333cf5,_0x4d7b26,_0x2d70b1){io['to'](_0x333cf5)['emit'](_0x4d7b26,_0x2d70b1);}function request(_0x6a8389){logger[_0x216f('0xd')]('[HTTP]',JSON[_0x216f('0xe')](_0x6a8389));return rp(_0x6a8389);}function getCustomFields(_0x6bf3b0,_0x535eaf){var _0x52f8d3={};if(_0x6bf3b0[_0x216f('0xf')]>0x0){_[_0x216f('0x10')](_0x6bf3b0,function(_0x236c4f){if(_[_0x216f('0x11')]([_0x216f('0x12'),_0x216f('0x13')],_0x236c4f['type'])&&_0x236c4f[_0x216f('0x14')]){_0x52f8d3[_0x236c4f[_0x216f('0x14')]]=_0x236c4f[_0x216f('0x15')]['toString']();}else if(_0x236c4f[_0x216f('0x16')]===_0x216f('0x17')&&_0x236c4f[_0x216f('0x18')]&&_0x236c4f[_0x216f('0x14')]&&_0x535eaf[_0x236c4f[_0x216f('0x18')]]){_0x52f8d3[_0x236c4f['idField']]=_0x535eaf[_0x236c4f[_0x216f('0x18')]][_0x216f('0x19')]();}else if(_0x236c4f[_0x216f('0x16')]==='customVariable'&&_0x236c4f[_0x216f('0x1a')]&&_0x236c4f['Variable'][_0x216f('0x1b')]&&_0x236c4f[_0x216f('0x14')]&&_0x535eaf[_0x236c4f[_0x216f('0x1a')][_0x216f('0x1b')][_0x216f('0x1c')]()]){_0x52f8d3[_0x236c4f[_0x216f('0x14')]]=_0x535eaf[_0x236c4f[_0x216f('0x1a')][_0x216f('0x1b')][_0x216f('0x1c')]()]['toString']();}});}return _0x52f8d3;}function getName(_0x46f0a0){if(_0x46f0a0[_0x216f('0x1d')]('\x20')>0x0){var _0xdb6bb8=_0x46f0a0[_0x216f('0x1e')](/ (.+)/);if(_0xdb6bb8[0x1]){return _0xdb6bb8;}}return[_0x46f0a0,_0x46f0a0];}var accountsTokens={};function getAccessToken(_0x51fdcb){return new Promise(function(_0x4d5558,_0x349485){if(!_[_0x216f('0x1f')](accountsTokens[_0x51fdcb['id']])&&!_[_0x216f('0x1f')](accountsTokens[_0x51fdcb['id']][_0x216f('0x20')])){if(moment()[_0x216f('0x21')](accountsTokens[_0x51fdcb['id']][_0x216f('0x22')])){_0x4d5558(accountsTokens[_0x51fdcb['id']][_0x216f('0x20')]);}}var _0x2bcbdb;switch(_0x51fdcb[_0x216f('0x23')]){case'US':_0x2bcbdb=_0x216f('0x24');break;case'AU':_0x2bcbdb='https://accounts.zoho.com.au';break;case'EU':_0x2bcbdb=_0x216f('0x25');break;case'IN':_0x2bcbdb='https://accounts.zoho.in';break;case'CN':_0x2bcbdb=_0x216f('0x26');break;default:_0x2bcbdb=_0x216f('0x25');break;}var _0x161505={'method':_0x216f('0x27'),'uri':_0x2bcbdb+_0x216f('0x28'),'qs':{'refresh_token':_0x51fdcb[_0x216f('0x29')],'client_id':_0x51fdcb[_0x216f('0x2a')],'client_secret':_0x51fdcb[_0x216f('0x2b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x161505)[_0x216f('0x2c')](function(_0x16cd78){accountsTokens[_0x51fdcb['id']]={'access_token':_0x16cd78['access_token'],'expires_in':moment()[_0x216f('0x2d')](_0x16cd78[_0x216f('0x22')],_0x216f('0x2e'))};_0x4d5558(_0x16cd78['access_token']);})[_0x216f('0x2f')](function(_0x1cfecc){logger['error'](_0x216f('0x30'),_0x1cfecc[_0x216f('0x31')]);_0x349485(_0x1cfecc);});});}function getUser(_0x44433b,_0x2a7392,_0x1d96a3,_0x11a756){logger['info']('Search\x20user');return request({'method':_0x216f('0x32'),'uri':util[_0x216f('0x33')]('https://www.zohoapis.%s/crm/v2/users',_0x2a7392),'qs':{'type':_0x216f('0x34')},'headers':{'Authorization':_0x216f('0x35')+_0x44433b},'json':!![]})[_0x216f('0x2c')](function(_0x286b48){if(_0x286b48[_0x216f('0x36')]){var _0x3871ad=-0x1;if(_[_0x216f('0x37')](_0x286b48[_0x216f('0x36')])){if(!_[_0x216f('0x1f')](_0x11a756)){_0x3871ad=_[_0x216f('0x38')](_0x286b48[_0x216f('0x36')],function(_0x3be8a0){return _0x3be8a0['email']===_0x11a756;});}if(_0x3871ad>=0x0){logger['info'](_0x216f('0x39'));}else{logger[_0x216f('0x3a')](_0x216f('0x3b'));_0x3871ad=_[_0x216f('0x38')](_0x286b48[_0x216f('0x36')],function(_0x52efc6){return _0x52efc6['profile'][_0x216f('0x1b')]==='Administrator';});}return _0x286b48['users'][_0x3871ad];}else{if(_0x286b48[_0x216f('0x3c')][_0x216f('0x3d')][_0x216f('0x1b')]===_0x216f('0x3e')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x286b48['user'];return user;}else{logger[_0x216f('0x3f')](_0x216f('0x40'),JSON['stringify'](_0x286b48));throw new Error(_0x216f('0x41')+JSON[_0x216f('0xe')](_0x286b48));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x286b48));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x216f('0xe')](_0x286b48));}})[_0x216f('0x2f')](function(_0x411a76){console['error'](_0x411a76);});}function getZohoUser(_0x5946a3,_0x18fc78){return new BPromise(function(_0x5bd045,_0x5a9270){request(_0x5946a3)['then'](function(_0x1ab556){var _0x36e4a=null;if(_0x1ab556){_0x36e4a=_0x1ab556[_0x216f('0x42')][0x0];_0x36e4a[_0x216f('0x43')]=_0x18fc78;}_0x5bd045(_0x36e4a);})[_0x216f('0x2f')](function(_0x18c1ac){_0x5a9270(_0x18c1ac);});});}function createEndUser(_0x46f690,_0x1043c6,_0x5d5d59,_0x595c16,_0x1cda16,_0x5ecb70){var _0x5d5d59=getName(_0x5d5d59);return request({'method':_0x216f('0x27'),'uri':_0x216f('0x44')+_0x1043c6+_0x216f('0x45')+_[_0x216f('0x46')](_0x5ecb70[_0x216f('0x47')])+'s','body':{'data':[{'Last_Name':_0x5d5d59[0x1],'First_Name':_0x5d5d59[0x0],'Phone':_0x595c16,'Owner':{'name':!_['isNil'](_0x1cda16[_0x216f('0x48')][_0x216f('0x1b')])?_0x1cda16[_0x216f('0x48')][_0x216f('0x1b')]:!_[_0x216f('0x1f')](_0x1cda16[_0x216f('0x49')])?_0x1cda16[_0x216f('0x49')]+'\x20'+_0x1cda16[_0x216f('0x4a')]:_0x1cda16[_0x216f('0x4a')],'id':_0x1cda16['id']}}]},'headers':{'Authorization':_0x216f('0x35')+_0x46f690},'json':!![]})[_0x216f('0x2c')](function(_0x185832){if(_0x185832&&_0x185832[_0x216f('0x42')][0x0][_0x216f('0x4b')]===_0x216f('0x4c')){var _0x56a5cd=_0x185832[_0x216f('0x42')][0x0][_0x216f('0x4d')];_0x56a5cd['enduserType']=_[_0x216f('0x46')](_0x5ecb70[_0x216f('0x47')])+'s';return _0x56a5cd;}logger[_0x216f('0x3f')](_0x216f('0x40'),JSON[_0x216f('0xe')](data));throw new Error(_0x216f('0x4e')+JSON[_0x216f('0xe')](data));})[_0x216f('0x2f')](function(_0x16bae4){console[_0x216f('0x4f')](_0x216f('0x50'),_0x16bae4);});}function getEndUser(_0x2c406a,_0x5b4343,_0x5daec4,_0x3651aa,_0x16dea4,_0x3a8101,_0x360419){var _0x27cdb9={'method':_0x216f('0x32'),'uri':'','headers':{'Authorization':_0x216f('0x35')+_0x2c406a},'json':!![]};switch(_0x360419[_0x216f('0x51')]){case _0x216f('0x52'):_0x27cdb9[_0x216f('0x53')]=_0x216f('0x44')+_0x5b4343+_0x216f('0x54')+_0x16dea4+'))';return getZohoUser(_0x27cdb9,_0x216f('0x55'))[_0x216f('0x2c')](function(_0x4c8c6d){if(_0x4c8c6d)return _0x4c8c6d;_0x27cdb9[_0x216f('0x53')]='https://www.zohoapis.'+_0x5b4343+_0x216f('0x56')+_0x16dea4+'))';return getZohoUser(_0x27cdb9,_0x216f('0x57'))[_0x216f('0x2c')](function(_0x8b309c){if(_0x8b309c)return _0x8b309c;if(_0x360419[_0x216f('0x47')]!=_0x216f('0x58')){return createEndUser(_0x2c406a,_0x5b4343,_0x3651aa,_0x16dea4,_0x3a8101,_0x360419);}else{return{};}});});break;case _0x216f('0x59'):_0x27cdb9[_0x216f('0x53')]=_0x216f('0x44')+_0x5b4343+_0x216f('0x54')+_0x16dea4+'))';return getZohoUser(_0x27cdb9,_0x216f('0x55'))[_0x216f('0x2c')](function(_0x4cd0e1){if(_0x4cd0e1)return _0x4cd0e1;if(_0x360419['moduleCreate']!=_0x216f('0x58')){return createEndUser(_0x2c406a,_0x5b4343,_0x3651aa,_0x16dea4,_0x3a8101,_0x360419);}else{return{};}});break;case _0x216f('0x5a'):_0x27cdb9[_0x216f('0x53')]=_0x216f('0x44')+_0x5b4343+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x16dea4+'))';return getZohoUser(_0x27cdb9,_0x216f('0x57'))[_0x216f('0x2c')](function(_0x3975a7){if(_0x3975a7)return _0x3975a7;if(_0x360419[_0x216f('0x47')]!='nothing'){return createEndUser(_0x2c406a,_0x5b4343,_0x3651aa,_0x16dea4,_0x3a8101,_0x360419);}else{return{};}});break;}}function getCall(_0x457b0a,_0x49d5d2,_0x43a777,_0x5e1120,_0x4697e1,_0x4a7027,_0x2f0641,_0x226db0){logger[_0x216f('0x3a')]('Creating\x20new\x20call...');var _0x2b2abd={};_0x2b2abd['Owner']={'name':!_['isNil'](_0x5e1120['role'][_0x216f('0x1b')])&&!_[_0x216f('0x1f')](_0x5e1120[_0x216f('0x3d')][_0x216f('0x1b')])&&_0x5e1120['profile'][_0x216f('0x1b')]===_0x216f('0x5b')?_0x5e1120[_0x216f('0x48')]['name']:!_['isNil'](_0x5e1120[_0x216f('0x49')])?_0x5e1120[_0x216f('0x49')]+'\x20'+_0x5e1120['last_name']:_0x5e1120['last_name'],'id':_0x5e1120['id']};_0x2b2abd[_0x216f('0x5c')]=intUtil['getString'](_0x4a7027['Subjects'],_0x2f0641,'\x20');_0x2b2abd[_0x216f('0x5d')]=intUtil[_0x216f('0x5e')](_0x4a7027['Descriptions'],_0x2f0641,'\x0a');if(_0x4697e1[_0x216f('0x43')]===_0x216f('0x55')){_0x2b2abd[_0x216f('0x5f')]={'name':!_['isNil'](_0x4697e1['Full_Name'])?_0x4697e1[_0x216f('0x60')]:!_[_0x216f('0x1f')](_0x4697e1[_0x216f('0x61')])?_0x4697e1['First_Name']+'\x20'+_0x4697e1[_0x216f('0x62')]:_0x4697e1['Last_Name'],'id':_0x4697e1['id']};}if(_0x4697e1[_0x216f('0x43')]==='Leads'){_0x2b2abd[_0x216f('0x63')]={'name':!_[_0x216f('0x1f')](_0x4697e1['Full_Name'])?_0x4697e1['Full_Name']:!_[_0x216f('0x1f')](_0x4697e1['First_Name'])?_0x4697e1[_0x216f('0x61')]+'\x20'+_0x4697e1['Last_Name']:_0x4697e1[_0x216f('0x62')],'id':_0x4697e1['id']};_0x2b2abd['$se_module']=_['startCase'](_0x4697e1['enduserType']);}if(_0x2f0641[_0x216f('0x64')]){_0x2b2abd[_0x216f('0x65')]=moment[_0x216f('0x66')](parseInt(_0x2f0641[_0x216f('0x64')])*0x3e8)[_0x216f('0x33')](_0x216f('0x67'));}else if(_0x2f0641[_0x216f('0x68')]&&_0x2f0641[_0x216f('0x69')]){_0x2b2abd[_0x216f('0x65')]=moment[_0x216f('0x66')](moment(_0x2f0641[_0x216f('0x69')],_0x216f('0x6a'))[_0x216f('0x6b')](moment(_0x2f0641['starttime'],_0x216f('0x6a'))))[_0x216f('0x33')](_0x216f('0x67'));}switch(_0x2f0641[_0x216f('0x6c')]){case'called':_0x2b2abd[_0x216f('0x6d')]='Called';break;case _0x216f('0x6e'):case _0x216f('0x6f'):_0x2b2abd[_0x216f('0x6d')]=_0x216f('0x70');break;case'rejected':_0x2b2abd[_0x216f('0x6d')]=_0x216f('0x71');break;case _0x216f('0x72'):_0x2b2abd['Call_Result']=_0x216f('0x73');break;case'timeout':_0x2b2abd[_0x216f('0x6d')]=_0x216f('0x74');default:}_0x2b2abd[_0x216f('0x75')]=(_0x226db0==='outbound'?moment(_0x2f0641[_0x216f('0x76')])['format'](_0x216f('0x6a')):moment(_0x2f0641[_0x216f('0x77')])[_0x216f('0x33')](_0x216f('0x6a')))||moment()[_0x216f('0x33')](_0x216f('0x6a'));_0x2b2abd['Call_Type']=_0x226db0||_0x216f('0x78');_0x2b2abd=_[_0x216f('0x79')](_0x2b2abd,getCustomFields(_0x4a7027['Fields'],_0x2f0641));return request({'method':'POST','uri':_0x216f('0x44')+_0x49d5d2+_0x216f('0x7a'),'headers':{'Authorization':_0x216f('0x35')+_0x457b0a},'body':{'data':[_0x2b2abd]},'json':!![]})[_0x216f('0x2c')](function(_0x3b9b9c){if(_0x3b9b9c&&_0x3b9b9c[_0x216f('0x42')][0x0][_0x216f('0x4b')]===_0x216f('0x4c')){logger[_0x216f('0x3a')](_0x216f('0x7b'));return{'id':_0x3b9b9c[_0x216f('0x42')][0x0]['details']['id']};}})[_0x216f('0x2f')](function(_0x27ffb8){logger[_0x216f('0x3a')](_0x216f('0x7c'),_0x27ffb8[_0x216f('0x31')]);console[_0x216f('0x4f')]('err',_0x27ffb8);});}exports[_0x216f('0x7d')]=function(_0x15daef,_0x2bd7e1,_0x5af83a,_0x3de4f8,_0x5353ab,_0x4f1481){var _0xc1be21,_0x4b7593,_0x4bc45e;_0x4f1481['host']=intUtil[_0x216f('0x7e')](_0x4f1481[_0x216f('0x7f')]);_0x4f1481[_0x216f('0x80')]=intUtil[_0x216f('0x7e')](_0x4f1481[_0x216f('0x80')]);if(_0x5353ab&&_0x5353ab['monitor_format']){logger[_0x216f('0x3a')](_0x216f('0x81'),_0x216f('0x82'));_0x2bd7e1[_0x216f('0x83')]=_0x4f1481[_0x216f('0x80')]+_0x216f('0x84')+_0x2bd7e1[_0x216f('0x85')]+_0x216f('0x86')+md5(_0x2bd7e1['uniqueid']);}else{_0x2bd7e1[_0x216f('0x83')]='';}var _0x106559=_0x4f1481['host']===_0x216f('0x87')?'eu':_0x216f('0x88');return getAccessToken(_0x4f1481)[_0x216f('0x2c')](function(_0x35f634){_0x4bc45e=_0x35f634;return getUser(_0x4bc45e,_0x106559,_0x4f1481,_0x3de4f8[_0x216f('0x89')]);})['then'](function(_0x2e3116){_0xc1be21=_0x2e3116;logger[_0x216f('0x3a')]('The\x20User\x20ID\x20is:',_0xc1be21['id']);return getEndUser(_0x4bc45e,_0x106559,_0x4f1481,_0x2bd7e1[_0x216f('0x8a')],_0x2bd7e1[_0x216f('0x8b')],_0xc1be21,_0x5af83a);})[_0x216f('0x2c')](function(_0xfd3134){_0x4b7593=_0xfd3134;return getCall(_0x4bc45e,_0x106559,_0x4f1481,_0xc1be21,_0x4b7593,_0x5af83a,_0x2bd7e1,_0x216f('0x78'));})[_0x216f('0x2c')](function(_0x1f1e24){if(_0x1f1e24){logger[_0x216f('0x3a')](_0x216f('0x8c'),_0x1f1e24['id']);logger[_0x216f('0x3a')](_0x216f('0x81'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x216f('0x8d'),_0x3de4f8[_0x216f('0x1b')]),'trigger:browser:url',{'uri':_0x216f('0x8e')+_0x4f1481['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1f1e24['id']});}})['catch'](function(_0x2b1fc0){logger[_0x216f('0x3f')](_0x216f('0x81'),JSON[_0x216f('0xe')](_0x2b1fc0));});};exports[_0x216f('0x8f')]=function(_0x4b7687,_0x394a63,_0x47ca8a,_0x2dfe0f,_0x5c952f,_0x274ead,_0x4d5b4b){var _0x191b5b,_0x1374f5,_0x11a786;_0x274ead['host']=intUtil['stripTrailingSlash'](_0x274ead['host']);_0x274ead['serverUrl']=intUtil[_0x216f('0x7e')](_0x274ead[_0x216f('0x80')]);if(_0x4d5b4b&&_0x4d5b4b[_0x216f('0x90')]&&_0x4d5b4b[_0x216f('0x90')]!==_0x216f('0x91')){logger[_0x216f('0x3a')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x394a63['recordingURL']=_0x274ead[_0x216f('0x80')]+_0x216f('0x84')+_0x394a63[_0x216f('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x394a63['uniqueid']);}var _0x48abe0=_0x274ead['host']===_0x216f('0x87')?'eu':_0x216f('0x88');return getAccessToken(_0x274ead)[_0x216f('0x2c')](function(_0x23022d){_0x11a786=_0x23022d;return getUser(_0x11a786,_0x48abe0,_0x274ead,_0x2dfe0f[_0x216f('0x89')]);})['then'](function(_0xa5e336){_0x191b5b=_0xa5e336;logger[_0x216f('0x3a')](_0x216f('0x92'),_0x191b5b['id']);return getEndUser(_0x11a786,_0x48abe0,_0x274ead,_0x394a63['destcalleridname'],_0x394a63['destcalleridnum'],_0x191b5b,_0x47ca8a);})[_0x216f('0x2c')](function(_0x31661a){_0x1374f5=_0x31661a;return getCall(_0x11a786,_0x48abe0,_0x274ead,_0x191b5b,_0x1374f5,_0x47ca8a,_0x394a63,_0x216f('0x93'));})['then'](function(_0x542db2){if(_0x542db2){logger['info']('The\x20Call\x20ID\x20is:',_0x542db2['id']);logger[_0x216f('0x3a')](_0x216f('0x94'),_0x216f('0x95'));emit(util[_0x216f('0x33')]('user:%s',_0x2dfe0f[_0x216f('0x1b')]),'trigger:browser:url',{'uri':_0x216f('0x8e')+_0x274ead[_0x216f('0x7f')]+_0x216f('0x96')+_0x542db2['id']});}})['catch'](function(_0x460db0){logger[_0x216f('0x3f')]('[OUTBOUND]',JSON['stringify'](_0x460db0));});};exports[_0x216f('0x97')]=function(_0x18fe09,_0x5e091e,_0x3c8ef0,_0x17afba,_0x3e9646,_0x164215){var _0x59d84e,_0x5b2b6b,_0x4c0e88;_0x164215['host']=intUtil[_0x216f('0x7e')](_0x164215[_0x216f('0x7f')]);_0x164215[_0x216f('0x80')]=intUtil['stripTrailingSlash'](_0x164215[_0x216f('0x80')]);if(_0x3e9646&&_0x3e9646[_0x216f('0x98')]){logger[_0x216f('0x3a')]('['+_0x5e091e[_0x216f('0x6c')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x5e091e[_0x216f('0x83')]=_0x164215[_0x216f('0x80')]+_0x216f('0x84')+_0x5e091e['uniqueid']+_0x216f('0x86')+md5(_0x5e091e['uniqueid']);}else{_0x5e091e[_0x216f('0x83')]='';}var _0x44cadd=_0x164215['host']===_0x216f('0x87')?'eu':_0x216f('0x88');return getAccessToken(_0x164215)[_0x216f('0x2c')](function(_0x2793d4){_0x4c0e88=_0x2793d4;return getUser(_0x4c0e88,_0x44cadd,_0x164215);})[_0x216f('0x2c')](function(_0x277fa2){_0x59d84e=_0x277fa2;logger['info'](_0x216f('0x92'),_0x59d84e['id']);return getEndUser(_0x4c0e88,_0x44cadd,_0x164215,_0x5e091e[_0x216f('0x8a')],_0x5e091e['calleridnum'],_0x59d84e,_0x3c8ef0);})[_0x216f('0x2c')](function(_0x519e71){_0x5b2b6b=_0x519e71;return getCall(_0x4c0e88,_0x44cadd,_0x164215,_0x59d84e,_0x5b2b6b,_0x3c8ef0,_0x5e091e,_0x216f('0x78'));})[_0x216f('0x2c')](function(_0x3db6d2){if(_0x3db6d2){logger[_0x216f('0x3a')]('The\x20Call\x20ID\x20is:',_0x3db6d2['id']);}})[_0x216f('0x2f')](function(_0x6f4960){logger['error']('['+_0x5e091e[_0x216f('0x6c')]['toUpperCase']()+']',JSON[_0x216f('0xe')](_0x6f4960));});}; \ No newline at end of file +var _0x766f=['Rejected','abandoned','timeout','outbound','agentcalledAt','format','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','log','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','host','/crm/EntityInfo.do?module=Calls&id=','[OUTBOUND]','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','destcalleridnum','https://crm.','calleridname','toUpperCase','./util','moment','ioredis','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','string','picklist','type','content','toString','variable','variableName','idField','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','POST','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','Contacts','nothing','lead','Creating\x20new\x20call...','profile','Subject','getString','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','complete','connect','rejected'];(function(_0x45d84b,_0x514b0a){var _0x4c5fe6=function(_0x74d631){while(--_0x74d631){_0x45d84b['push'](_0x45d84b['shift']());}};_0x4c5fe6(++_0x514b0a);}(_0x766f,0x14f));var _0xf766=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x766f[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require('util');var intUtil=require(_0xf766('0x0'));var moment=require(_0xf766('0x1'));var Redis=require(_0xf766('0x2'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0xf766('0x3'))(_0xf766('0x4'));config['redis']=_['defaults'](config[_0xf766('0x5')],{'host':_0xf766('0x6'),'port':0x18eb});var io=require(_0xf766('0x7'))(new Redis(config['redis']));function emit(_0x3c48b1,_0x577129,_0x18a75e){io['to'](_0x3c48b1)[_0xf766('0x8')](_0x577129,_0x18a75e);}function request(_0x59142d){logger['debug'](_0xf766('0x9'),JSON[_0xf766('0xa')](_0x59142d));return rp(_0x59142d);}function getCustomFields(_0x65a845,_0x554814){var _0x37fe14={};if(_0x65a845[_0xf766('0xb')]>0x0){_[_0xf766('0xc')](_0x65a845,function(_0x137306){if(_[_0xf766('0xd')]([_0xf766('0xe'),_0xf766('0xf')],_0x137306[_0xf766('0x10')])&&_0x137306['idField']){_0x37fe14[_0x137306['idField']]=_0x137306[_0xf766('0x11')][_0xf766('0x12')]();}else if(_0x137306[_0xf766('0x10')]===_0xf766('0x13')&&_0x137306[_0xf766('0x14')]&&_0x137306['idField']&&_0x554814[_0x137306[_0xf766('0x14')]]){_0x37fe14[_0x137306[_0xf766('0x15')]]=_0x554814[_0x137306[_0xf766('0x14')]]['toString']();}else if(_0x137306[_0xf766('0x10')]==='customVariable'&&_0x137306[_0xf766('0x16')]&&_0x137306[_0xf766('0x16')][_0xf766('0x17')]&&_0x137306[_0xf766('0x15')]&&_0x554814[_0x137306[_0xf766('0x16')][_0xf766('0x17')][_0xf766('0x18')]()]){_0x37fe14[_0x137306[_0xf766('0x15')]]=_0x554814[_0x137306[_0xf766('0x16')][_0xf766('0x17')][_0xf766('0x18')]()][_0xf766('0x12')]();}});}return _0x37fe14;}function getName(_0x27a2ba){if(_0x27a2ba[_0xf766('0x19')]('\x20')>0x0){var _0x29712f=_0x27a2ba[_0xf766('0x1a')](/ (.+)/);if(_0x29712f[0x1]){return _0x29712f;}}return[_0x27a2ba,_0x27a2ba];}var accountsTokens={};function getAccessToken(_0x3dc405){return new Promise(function(_0x3a1927,_0x208130){if(!_['isNil'](accountsTokens[_0x3dc405['id']])&&!_[_0xf766('0x1b')](accountsTokens[_0x3dc405['id']][_0xf766('0x1c')])){if(moment()['isBefore'](accountsTokens[_0x3dc405['id']][_0xf766('0x1d')])){_0x3a1927(accountsTokens[_0x3dc405['id']][_0xf766('0x1c')]);}}var _0x5fa047;switch(_0x3dc405[_0xf766('0x1e')]){case'US':_0x5fa047=_0xf766('0x1f');break;case'AU':_0x5fa047=_0xf766('0x20');break;case'EU':_0x5fa047=_0xf766('0x21');break;case'IN':_0x5fa047='https://accounts.zoho.in';break;case'CN':_0x5fa047=_0xf766('0x22');break;default:_0x5fa047=_0xf766('0x21');break;}var _0x5adae4={'method':'POST','uri':_0x5fa047+_0xf766('0x23'),'qs':{'refresh_token':_0x3dc405[_0xf766('0x24')],'client_id':_0x3dc405[_0xf766('0x25')],'client_secret':_0x3dc405[_0xf766('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5adae4)[_0xf766('0x27')](function(_0x285714){accountsTokens[_0x3dc405['id']]={'access_token':_0x285714[_0xf766('0x1c')],'expires_in':moment()[_0xf766('0x28')](_0x285714[_0xf766('0x1d')],'seconds')};_0x3a1927(_0x285714[_0xf766('0x1c')]);})[_0xf766('0x29')](function(_0x222698){logger[_0xf766('0x2a')](_0xf766('0x2b'),_0x222698[_0xf766('0x2c')]);_0x208130(_0x222698);});});}function getUser(_0x26d8a6,_0x195d92,_0x5b6596,_0x40de10){logger[_0xf766('0x2d')](_0xf766('0x2e'));return request({'method':_0xf766('0x2f'),'uri':util['format'](_0xf766('0x30'),_0x195d92),'qs':{'type':_0xf766('0x31')},'headers':{'Authorization':_0xf766('0x32')+_0x26d8a6},'json':!![]})[_0xf766('0x27')](function(_0x36f5ed){if(_0x36f5ed[_0xf766('0x33')]){var _0x21ca13=-0x1;if(_[_0xf766('0x34')](_0x36f5ed['users'])){if(!_[_0xf766('0x1b')](_0x40de10)){_0x21ca13=_[_0xf766('0x35')](_0x36f5ed[_0xf766('0x33')],function(_0x5ea469){return _0x5ea469[_0xf766('0x36')]===_0x40de10;});}if(_0x21ca13>=0x0){logger['info'](_0xf766('0x37'));}else{logger[_0xf766('0x2d')]('Using\x20the\x20admin\x20account!');_0x21ca13=_[_0xf766('0x35')](_0x36f5ed[_0xf766('0x33')],function(_0x208c1a){return _0x208c1a['profile']['name']===_0xf766('0x38');});}return _0x36f5ed[_0xf766('0x33')][_0x21ca13];}else{if(_0x36f5ed['user']['profile'][_0xf766('0x17')]===_0xf766('0x38')){logger[_0xf766('0x2d')]('Using\x20the\x20admin\x20account!');user=_0x36f5ed[_0xf766('0x39')];return user;}else{logger[_0xf766('0x2a')]('The\x20failing\x20result\x20is',JSON[_0xf766('0xa')](_0x36f5ed));throw new Error(_0xf766('0x3a')+JSON[_0xf766('0xa')](_0x36f5ed));}}}else{logger[_0xf766('0x2a')](_0xf766('0x3b'),JSON[_0xf766('0xa')](_0x36f5ed));throw new Error(_0xf766('0x3a')+JSON['stringify'](_0x36f5ed));}})['catch'](function(_0x4c2f76){console[_0xf766('0x2a')](_0x4c2f76);});}function getZohoUser(_0x43dba5,_0x3036ba){return new BPromise(function(_0x3aa040,_0x16436c){request(_0x43dba5)[_0xf766('0x27')](function(_0x21fcfe){var _0xd70fa9=null;if(_0x21fcfe){_0xd70fa9=_0x21fcfe[_0xf766('0x3c')][0x0];_0xd70fa9[_0xf766('0x3d')]=_0x3036ba;}_0x3aa040(_0xd70fa9);})[_0xf766('0x29')](function(_0x29f095){_0x16436c(_0x29f095);});});}function createEndUser(_0x259c11,_0x1ed175,_0x343c8a,_0x227cd9,_0x3af9ab,_0x24c379){var _0x343c8a=getName(_0x343c8a);return request({'method':_0xf766('0x3e'),'uri':'https://www.zohoapis.'+_0x1ed175+_0xf766('0x3f')+_[_0xf766('0x40')](_0x24c379[_0xf766('0x41')])+'s','body':{'data':[{'Last_Name':_0x343c8a[0x1],'First_Name':_0x343c8a[0x0],'Phone':_0x227cd9,'Owner':{'name':!_[_0xf766('0x1b')](_0x3af9ab[_0xf766('0x42')]['name'])?_0x3af9ab[_0xf766('0x42')][_0xf766('0x17')]:!_['isNil'](_0x3af9ab[_0xf766('0x43')])?_0x3af9ab[_0xf766('0x43')]+'\x20'+_0x3af9ab['last_name']:_0x3af9ab[_0xf766('0x44')],'id':_0x3af9ab['id']}}]},'headers':{'Authorization':_0xf766('0x32')+_0x259c11},'json':!![]})[_0xf766('0x27')](function(_0x19559c){if(_0x19559c&&_0x19559c[_0xf766('0x3c')][0x0][_0xf766('0x45')]===_0xf766('0x46')){var _0x20aa90=_0x19559c['data'][0x0][_0xf766('0x47')];_0x20aa90[_0xf766('0x3d')]=_[_0xf766('0x40')](_0x24c379[_0xf766('0x41')])+'s';return _0x20aa90;}logger[_0xf766('0x2a')](_0xf766('0x3b'),JSON[_0xf766('0xa')](data));throw new Error(_0xf766('0x48')+JSON[_0xf766('0xa')](data));})[_0xf766('0x29')](function(_0x57019b){console['log'](_0xf766('0x49'),_0x57019b);});}function getEndUser(_0x4efb01,_0x13574d,_0x28818c,_0x297432,_0x130126,_0x2c62be,_0x45a7aa){var _0xf02e4e={'method':_0xf766('0x2f'),'uri':'','headers':{'Authorization':_0xf766('0x32')+_0x4efb01},'json':!![]};switch(_0x45a7aa[_0xf766('0x4a')]){case _0xf766('0x4b'):_0xf02e4e[_0xf766('0x4c')]=_0xf766('0x4d')+_0x13574d+_0xf766('0x4e')+_0x130126+'))';return getZohoUser(_0xf02e4e,'Contacts')['then'](function(_0x3e1635){if(_0x3e1635)return _0x3e1635;_0xf02e4e[_0xf766('0x4c')]=_0xf766('0x4d')+_0x13574d+_0xf766('0x4f')+_0x130126+'))';return getZohoUser(_0xf02e4e,_0xf766('0x50'))[_0xf766('0x27')](function(_0x4f5f3b){if(_0x4f5f3b)return _0x4f5f3b;if(_0x45a7aa[_0xf766('0x41')]!='nothing'){return createEndUser(_0x4efb01,_0x13574d,_0x297432,_0x130126,_0x2c62be,_0x45a7aa);}else{return{};}});});break;case _0xf766('0x51'):_0xf02e4e[_0xf766('0x4c')]=_0xf766('0x4d')+_0x13574d+_0xf766('0x4e')+_0x130126+'))';return getZohoUser(_0xf02e4e,_0xf766('0x52'))[_0xf766('0x27')](function(_0xce1596){if(_0xce1596)return _0xce1596;if(_0x45a7aa[_0xf766('0x41')]!=_0xf766('0x53')){return createEndUser(_0x4efb01,_0x13574d,_0x297432,_0x130126,_0x2c62be,_0x45a7aa);}else{return{};}});break;case _0xf766('0x54'):_0xf02e4e['uri']=_0xf766('0x4d')+_0x13574d+_0xf766('0x4f')+_0x130126+'))';return getZohoUser(_0xf02e4e,_0xf766('0x50'))[_0xf766('0x27')](function(_0x32dfde){if(_0x32dfde)return _0x32dfde;if(_0x45a7aa['moduleCreate']!=_0xf766('0x53')){return createEndUser(_0x4efb01,_0x13574d,_0x297432,_0x130126,_0x2c62be,_0x45a7aa);}else{return{};}});break;}}function getCall(_0x398f56,_0x287fcd,_0x2c1f33,_0x1e0d7f,_0x15813a,_0xc22108,_0x56512,_0x777495){logger['info'](_0xf766('0x55'));var _0x452073={};_0x452073['Owner']={'name':!_[_0xf766('0x1b')](_0x1e0d7f['role'][_0xf766('0x17')])&&!_[_0xf766('0x1b')](_0x1e0d7f[_0xf766('0x56')][_0xf766('0x17')])&&_0x1e0d7f['profile'][_0xf766('0x17')]==='administrator'?_0x1e0d7f[_0xf766('0x42')]['name']:!_[_0xf766('0x1b')](_0x1e0d7f['first_name'])?_0x1e0d7f[_0xf766('0x43')]+'\x20'+_0x1e0d7f[_0xf766('0x44')]:_0x1e0d7f[_0xf766('0x44')],'id':_0x1e0d7f['id']};_0x452073[_0xf766('0x57')]=intUtil['getString'](_0xc22108['Subjects'],_0x56512,'\x20');_0x452073['Description']=intUtil[_0xf766('0x58')](_0xc22108[_0xf766('0x59')],_0x56512,'\x0a');if(_0x15813a[_0xf766('0x3d')]===_0xf766('0x52')){_0x452073['Who_Id']={'name':!_[_0xf766('0x1b')](_0x15813a[_0xf766('0x5a')])?_0x15813a[_0xf766('0x5a')]:!_['isNil'](_0x15813a[_0xf766('0x5b')])?_0x15813a[_0xf766('0x5b')]+'\x20'+_0x15813a['Last_Name']:_0x15813a[_0xf766('0x5c')],'id':_0x15813a['id']};}if(_0x15813a[_0xf766('0x3d')]==='Leads'){_0x452073[_0xf766('0x5d')]={'name':!_[_0xf766('0x1b')](_0x15813a[_0xf766('0x5a')])?_0x15813a[_0xf766('0x5a')]:!_[_0xf766('0x1b')](_0x15813a[_0xf766('0x5b')])?_0x15813a[_0xf766('0x5b')]+'\x20'+_0x15813a[_0xf766('0x5c')]:_0x15813a[_0xf766('0x5c')],'id':_0x15813a['id']};_0x452073[_0xf766('0x5e')]=_['startCase'](_0x15813a['enduserType']);}if(_0x56512['talktime']){_0x452073[_0xf766('0x5f')]=moment[_0xf766('0x60')](parseInt(_0x56512[_0xf766('0x61')])*0x3e8)['format'](_0xf766('0x62'));}else if(_0x56512['answertime']&&_0x56512[_0xf766('0x63')]){_0x452073[_0xf766('0x5f')]=moment['utc'](moment(_0x56512['endtime'],_0xf766('0x64'))['diff'](moment(_0x56512[_0xf766('0x65')],_0xf766('0x64'))))['format'](_0xf766('0x62'));}switch(_0x56512[_0xf766('0x66')]){case _0xf766('0x67'):_0x452073[_0xf766('0x68')]=_0xf766('0x69');break;case _0xf766('0x6a'):case _0xf766('0x6b'):_0x452073[_0xf766('0x68')]='Answered';break;case _0xf766('0x6c'):_0x452073[_0xf766('0x68')]=_0xf766('0x6d');break;case _0xf766('0x6e'):_0x452073['Call_Result']='Abandoned';break;case _0xf766('0x6f'):_0x452073[_0xf766('0x68')]='Timeout';default:}_0x452073['Call_Start_Time']=(_0x777495===_0xf766('0x70')?moment(_0x56512[_0xf766('0x65')])['format'](_0xf766('0x64')):moment(_0x56512[_0xf766('0x71')])[_0xf766('0x72')](_0xf766('0x64')))||moment()['format'](_0xf766('0x64'));_0x452073[_0xf766('0x73')]=_0x777495||_0xf766('0x74');_0x452073=_[_0xf766('0x75')](_0x452073,getCustomFields(_0xc22108[_0xf766('0x76')],_0x56512));return request({'method':'POST','uri':_0xf766('0x4d')+_0x287fcd+_0xf766('0x77'),'headers':{'Authorization':_0xf766('0x32')+_0x398f56},'body':{'data':[_0x452073]},'json':!![]})['then'](function(_0x183f40){if(_0x183f40&&_0x183f40[_0xf766('0x3c')][0x0]['code']===_0xf766('0x46')){logger[_0xf766('0x2d')](_0xf766('0x78'));return{'id':_0x183f40['data'][0x0][_0xf766('0x47')]['id']};}})[_0xf766('0x29')](function(_0x2169cc){logger['info'](_0xf766('0x79'),_0x2169cc[_0xf766('0x2c')]);console[_0xf766('0x7a')]('err',_0x2169cc);});}exports[_0xf766('0x7b')]=function(_0x123307,_0x484b95,_0x5dafef,_0x53fb4d,_0x1f766b,_0x4ebbaa){var _0x5a6849,_0x28036a,_0x57ad7f;_0x4ebbaa['host']=intUtil[_0xf766('0x7c')](_0x4ebbaa['host']);_0x4ebbaa[_0xf766('0x7d')]=intUtil[_0xf766('0x7c')](_0x4ebbaa[_0xf766('0x7d')]);if(_0x1f766b&&_0x1f766b[_0xf766('0x7e')]){logger[_0xf766('0x2d')](_0xf766('0x7f'),'Recording\x20is\x20enabled!');_0x484b95[_0xf766('0x80')]=_0x4ebbaa[_0xf766('0x7d')]+_0xf766('0x81')+_0x484b95[_0xf766('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x484b95[_0xf766('0x82')]);}else{_0x484b95[_0xf766('0x80')]='';}var _0x272fa1=_0x4ebbaa['host']===_0xf766('0x83')?'eu':_0xf766('0x84');return getAccessToken(_0x4ebbaa)[_0xf766('0x27')](function(_0x3af0c1){_0x57ad7f=_0x3af0c1;return getUser(_0x57ad7f,_0x272fa1,_0x4ebbaa,_0x53fb4d[_0xf766('0x36')]);})[_0xf766('0x27')](function(_0x1e63b0){_0x5a6849=_0x1e63b0;logger[_0xf766('0x2d')](_0xf766('0x85'),_0x5a6849['id']);return getEndUser(_0x57ad7f,_0x272fa1,_0x4ebbaa,_0x484b95['calleridname'],_0x484b95[_0xf766('0x86')],_0x5a6849,_0x5dafef);})[_0xf766('0x27')](function(_0x32425e){_0x28036a=_0x32425e;return getCall(_0x57ad7f,_0x272fa1,_0x4ebbaa,_0x5a6849,_0x28036a,_0x5dafef,_0x484b95,_0xf766('0x74'));})[_0xf766('0x27')](function(_0x57b7a2){if(_0x57b7a2){logger[_0xf766('0x2d')](_0xf766('0x87'),_0x57b7a2['id']);logger['info']('[QUEUE]',_0xf766('0x88'));emit(util[_0xf766('0x72')](_0xf766('0x89'),_0x53fb4d[_0xf766('0x17')]),_0xf766('0x8a'),{'uri':'https://crm.'+_0x4ebbaa[_0xf766('0x8b')]+_0xf766('0x8c')+_0x57b7a2['id']});}})[_0xf766('0x29')](function(_0x4c9eef){logger[_0xf766('0x2a')]('[QUEUE]',JSON[_0xf766('0xa')](_0x4c9eef));});};exports[_0xf766('0x70')]=function(_0x41bafa,_0x195d4f,_0x3c03d7,_0x5a5390,_0x2fc6ce,_0x279e93,_0x33eb71){var _0x11942d,_0x5f78b5,_0xf0a9df;_0x279e93[_0xf766('0x8b')]=intUtil[_0xf766('0x7c')](_0x279e93[_0xf766('0x8b')]);_0x279e93['serverUrl']=intUtil[_0xf766('0x7c')](_0x279e93[_0xf766('0x7d')]);if(_0x33eb71&&_0x33eb71['recordingFormat']&&_0x33eb71['recordingFormat']!=='none'){logger[_0xf766('0x2d')](_0xf766('0x8d'),_0xf766('0x8e'));_0x195d4f[_0xf766('0x80')]=_0x279e93['serverUrl']+_0xf766('0x81')+_0x195d4f[_0xf766('0x82')]+_0xf766('0x8f')+md5(_0x195d4f[_0xf766('0x82')]);}var _0x4c8ed4=_0x279e93['host']==='zoho.eu'?'eu':_0xf766('0x84');return getAccessToken(_0x279e93)['then'](function(_0x488a45){_0xf0a9df=_0x488a45;return getUser(_0xf0a9df,_0x4c8ed4,_0x279e93,_0x5a5390[_0xf766('0x36')]);})[_0xf766('0x27')](function(_0x5c3957){_0x11942d=_0x5c3957;logger[_0xf766('0x2d')](_0xf766('0x85'),_0x11942d['id']);return getEndUser(_0xf0a9df,_0x4c8ed4,_0x279e93,_0x195d4f['destcalleridname'],_0x195d4f[_0xf766('0x90')],_0x11942d,_0x3c03d7);})[_0xf766('0x27')](function(_0x47cbd3){_0x5f78b5=_0x47cbd3;return getCall(_0xf0a9df,_0x4c8ed4,_0x279e93,_0x11942d,_0x5f78b5,_0x3c03d7,_0x195d4f,'Outbound');})[_0xf766('0x27')](function(_0x3864cc){if(_0x3864cc){logger[_0xf766('0x2d')](_0xf766('0x87'),_0x3864cc['id']);logger[_0xf766('0x2d')](_0xf766('0x8d'),_0xf766('0x88'));emit(util[_0xf766('0x72')](_0xf766('0x89'),_0x5a5390[_0xf766('0x17')]),'trigger:browser:url',{'uri':_0xf766('0x91')+_0x279e93[_0xf766('0x8b')]+_0xf766('0x8c')+_0x3864cc['id']});}})['catch'](function(_0x93e6ac){logger[_0xf766('0x2a')](_0xf766('0x8d'),JSON['stringify'](_0x93e6ac));});};exports['unmanaged']=function(_0x20d43b,_0x47bac0,_0x2929b6,_0x23c5e9,_0x1c1111,_0x2855ac){var _0xb28fcf,_0x2519c3,_0x2ececd;_0x2855ac['host']=intUtil[_0xf766('0x7c')](_0x2855ac[_0xf766('0x8b')]);_0x2855ac['serverUrl']=intUtil[_0xf766('0x7c')](_0x2855ac[_0xf766('0x7d')]);if(_0x1c1111&&_0x1c1111[_0xf766('0x7e')]){logger[_0xf766('0x2d')]('['+_0x47bac0[_0xf766('0x66')]['toUpperCase']()+']',_0xf766('0x8e'));_0x47bac0['recordingURL']=_0x2855ac[_0xf766('0x7d')]+_0xf766('0x81')+_0x47bac0['uniqueid']+_0xf766('0x8f')+md5(_0x47bac0[_0xf766('0x82')]);}else{_0x47bac0[_0xf766('0x80')]='';}var _0x1ba8d1=_0x2855ac[_0xf766('0x8b')]===_0xf766('0x83')?'eu':_0xf766('0x84');return getAccessToken(_0x2855ac)[_0xf766('0x27')](function(_0x1a3320){_0x2ececd=_0x1a3320;return getUser(_0x2ececd,_0x1ba8d1,_0x2855ac);})[_0xf766('0x27')](function(_0x471bff){_0xb28fcf=_0x471bff;logger[_0xf766('0x2d')](_0xf766('0x85'),_0xb28fcf['id']);return getEndUser(_0x2ececd,_0x1ba8d1,_0x2855ac,_0x47bac0[_0xf766('0x92')],_0x47bac0['calleridnum'],_0xb28fcf,_0x2929b6);})['then'](function(_0x2d53de){_0x2519c3=_0x2d53de;return getCall(_0x2ececd,_0x1ba8d1,_0x2855ac,_0xb28fcf,_0x2519c3,_0x2929b6,_0x47bac0,'Inbound');})[_0xf766('0x27')](function(_0x3e33a8){if(_0x3e33a8){logger[_0xf766('0x2d')](_0xf766('0x87'),_0x3e33a8['id']);}})['catch'](function(_0x4e1bc6){logger[_0xf766('0x2a')]('['+_0x47bac0[_0xf766('0x66')][_0xf766('0x93')]()+']',JSON[_0xf766('0xa')](_0x4e1bc6));});}; \ 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 256f1c9..efa4fce 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 _0x4660=['render','error','format','info','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3'];(function(_0xd53b14,_0x54d7e7){var _0x542de3=function(_0x167428){while(--_0x167428){_0xd53b14['push'](_0xd53b14['shift']());}};_0x542de3(++_0x54d7e7);}(_0x4660,0x12f));var _0x0466=function(_0x484653,_0x115ba7){_0x484653=_0x484653-0x0;var _0x323521=_0x4660[_0x484653];return _0x323521;};'use strict';var util=require(_0x0466('0x0'));var sh=require(_0x0466('0x1'));var Mustache=require(_0x0466('0x2'));var logger=require(_0x0466('0x3'))(_0x0466('0x4'));exports[_0x0466('0x5')]=function(_0x390eb0,_0x4ff263){var _0x4b6863=_0x390eb0[_0x0466('0x6')]?_0x390eb0[_0x0466('0x6')]:_0x0466('0x7');var _0x97fc27=_0x390eb0[_0x0466('0x8')]?Mustache[_0x0466('0x9')](_0x390eb0[_0x0466('0x8')],_0x4ff263):_0x4ff263;sh[_0x0466('0x5')](_0x97fc27,function(_0x39ac69,_0x486369,_0x5da865){if(_0x39ac69!==0x0){logger[_0x0466('0xa')](util[_0x0466('0xb')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x4b6863,_0x97fc27,_0x39ac69,_0x5da865));}else{logger[_0x0466('0xc')](util[_0x0466('0xb')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x4b6863,_0x97fc27,_0x486369));}});}; \ No newline at end of file +var _0xb858=['mustache','../../../../config/logger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xb858,0x1a2));var _0x8b85=function(_0xf78ccb,_0x1ca698){_0xf78ccb=_0xf78ccb-0x0;var _0x303eb7=_0xb858[_0xf78ccb];return _0x303eb7;};'use strict';var util=require(_0x8b85('0x0'));var sh=require(_0x8b85('0x1'));var Mustache=require(_0x8b85('0x2'));var logger=require(_0x8b85('0x3'))('trigger');exports[_0x8b85('0x4')]=function(_0x3cc924,_0x567509){var _0x178784=_0x3cc924[_0x8b85('0x5')]?_0x3cc924['data2']:_0x8b85('0x6');var _0x5eea83=_0x3cc924[_0x8b85('0x7')]?Mustache[_0x8b85('0x8')](_0x3cc924[_0x8b85('0x7')],_0x567509):_0x567509;sh[_0x8b85('0x4')](_0x5eea83,function(_0x489f23,_0x55ce41,_0x2eb6bf){if(_0x489f23!==0x0){logger[_0x8b85('0x9')](util[_0x8b85('0xa')](_0x8b85('0xb'),_0x178784,_0x5eea83,_0x489f23,_0x2eb6bf));}else{logger[_0x8b85('0xc')](util[_0x8b85('0xa')](_0x8b85('0xd'),_0x178784,_0x5eea83,_0x55ce41));}});}; \ 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 23bf0a9..44e4b64 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 _0xb009=['error','stack','toUpperCase','GET','DELETE','POST','data7','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','format','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','../../../../config/logger','trigger','exec','data1','render','data5','number','headers','data6','parse'];(function(_0x319784,_0x47e6d4){var _0x1917da=function(_0x2cb921){while(--_0x2cb921){_0x319784['push'](_0x319784['shift']());}};_0x1917da(++_0x47e6d4);}(_0xb009,0x195));var _0x9b00=function(_0x4d3924,_0x327b56){_0x4d3924=_0x4d3924-0x0;var _0x844555=_0xb009[_0x4d3924];return _0x844555;};'use strict';var rp=require('request-promise');var util=require(_0x9b00('0x0'));var _=require('lodash');var Mustache=require('mustache');var logger=require(_0x9b00('0x1'))(_0x9b00('0x2'));exports[_0x9b00('0x3')]=function(_0x598648,_0x2dd04b){var _0x1a418c,_0x255e94;var _0x43e038={'method':_0x598648[_0x9b00('0x4')]['toUpperCase'](),'uri':Mustache[_0x9b00('0x5')](_0x598648['data2'],_0x2dd04b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x598648[_0x9b00('0x6')])===_0x9b00('0x7')&&parseInt(_0x598648['data5'])>=0x1&&parseInt(_0x598648[_0x9b00('0x6')])<=0xa?parseInt(_0x598648[_0x9b00('0x6')])*0x3e8:0x5*0x3e8};try{_0x43e038[_0x9b00('0x8')]=_0x598648[_0x9b00('0x9')]?JSON[_0x9b00('0xa')](Mustache[_0x9b00('0x5')](_0x598648[_0x9b00('0x9')],_0x2dd04b)):{};}catch(_0x1f2ae1){logger[_0x9b00('0xb')](_0x1f2ae1[_0x9b00('0xc')]);}switch(_0x598648[_0x9b00('0x4')][_0x9b00('0xd')]()){case _0x9b00('0xe'):case _0x9b00('0xf'):_0x1a418c=null;_0x43e038['qs']=_0x2dd04b;break;case _0x9b00('0x10'):case'PUT':if(_0x598648[_0x9b00('0x11')]){try{_0x1a418c=JSON['parse'](Mustache[_0x9b00('0x5')](_0x598648[_0x9b00('0x11')],_0x2dd04b));_0x43e038[_0x9b00('0x12')]=_0x1a418c;}catch(_0x5eb8bf){logger[_0x9b00('0xb')](_0x5eb8bf[_0x9b00('0xc')]);logger[_0x9b00('0xb')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x1a418c=_0x2dd04b;_0x43e038[_0x9b00('0x12')]=_0x1a418c;}break;}logger[_0x9b00('0x13')](util['format'](_0x9b00('0x14'),_0x598648['data1'],_0x598648[_0x9b00('0x15')],JSON[_0x9b00('0x16')](_0x43e038)));rp(_0x43e038)[_0x9b00('0x17')](function(_0x2a6346){_0x1a418c=!_[_0x9b00('0x18')](_0x1a418c)?',\x20request\x20body:\x20'+_0x1a418c:'';_0x255e94=typeof _0x2a6346[_0x9b00('0x12')]===_0x9b00('0x19')?JSON[_0x9b00('0x16')](_0x2a6346[_0x9b00('0x12')]):_0x2a6346[_0x9b00('0x12')];logger[_0x9b00('0x13')](util['format'](_0x9b00('0x1a'),_0x598648[_0x9b00('0x4')],_0x598648['data2'],_0x2a6346[_0x9b00('0x1b')],_0x255e94));})['catch'](function(_0x25a951){logger[_0x9b00('0xb')](util[_0x9b00('0x1c')](_0x9b00('0x1d'),_0x598648[_0x9b00('0x4')],_0x598648[_0x9b00('0x15')],_0x25a951[_0x9b00('0x1b')],_0x25a951[_0x9b00('0x1e')],_0x25a951[_0x9b00('0x1f')]));});}; \ No newline at end of file +var _0xbb41=['message','request-promise','lodash','mustache','../../../../config/logger','toUpperCase','data2','data5','parse','render','error','stack','data1','GET','DELETE','POST','data7','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','body','format','statusCode','catch','name'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0xbb41,0x88));var _0x1bb4=function(_0x56bd76,_0x385967){_0x56bd76=_0x56bd76-0x0;var _0x3d4b93=_0xbb41[_0x56bd76];return _0x3d4b93;};'use strict';var rp=require(_0x1bb4('0x0'));var util=require('util');var _=require(_0x1bb4('0x1'));var Mustache=require(_0x1bb4('0x2'));var logger=require(_0x1bb4('0x3'))('trigger');exports['exec']=function(_0x57abc2,_0x1aebc8){var _0x207e09,_0x2bf24f;var _0x42b2e9={'method':_0x57abc2['data1'][_0x1bb4('0x4')](),'uri':Mustache['render'](_0x57abc2[_0x1bb4('0x5')],_0x1aebc8),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x57abc2[_0x1bb4('0x6')])==='number'&&parseInt(_0x57abc2['data5'])>=0x1&&parseInt(_0x57abc2[_0x1bb4('0x6')])<=0xa?parseInt(_0x57abc2[_0x1bb4('0x6')])*0x3e8:0x5*0x3e8};try{_0x42b2e9['headers']=_0x57abc2['data6']?JSON[_0x1bb4('0x7')](Mustache[_0x1bb4('0x8')](_0x57abc2['data6'],_0x1aebc8)):{};}catch(_0x17ca6b){logger[_0x1bb4('0x9')](_0x17ca6b[_0x1bb4('0xa')]);}switch(_0x57abc2[_0x1bb4('0xb')][_0x1bb4('0x4')]()){case _0x1bb4('0xc'):case _0x1bb4('0xd'):_0x207e09=null;_0x42b2e9['qs']=_0x1aebc8;break;case _0x1bb4('0xe'):case'PUT':if(_0x57abc2[_0x1bb4('0xf')]){try{_0x207e09=JSON[_0x1bb4('0x7')](Mustache['render'](_0x57abc2[_0x1bb4('0xf')],_0x1aebc8));_0x42b2e9['body']=_0x207e09;}catch(_0x23e2cd){logger['error'](_0x23e2cd[_0x1bb4('0xa')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x207e09=_0x1aebc8;_0x42b2e9['body']=_0x207e09;}break;}logger[_0x1bb4('0x10')](util['format'](_0x1bb4('0x11'),_0x57abc2[_0x1bb4('0xb')],_0x57abc2[_0x1bb4('0x5')],JSON[_0x1bb4('0x12')](_0x42b2e9)));rp(_0x42b2e9)['then'](function(_0x7f2305){_0x207e09=!_[_0x1bb4('0x13')](_0x207e09)?_0x1bb4('0x14')+_0x207e09:'';_0x2bf24f=typeof _0x7f2305[_0x1bb4('0x15')]==='object'?JSON[_0x1bb4('0x12')](_0x7f2305[_0x1bb4('0x15')]):_0x7f2305['body'];logger['info'](util[_0x1bb4('0x16')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x57abc2[_0x1bb4('0xb')],_0x57abc2[_0x1bb4('0x5')],_0x7f2305[_0x1bb4('0x17')],_0x2bf24f));})[_0x1bb4('0x18')](function(_0x9c56d5){logger[_0x1bb4('0x9')](util[_0x1bb4('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x57abc2[_0x1bb4('0xb')],_0x57abc2['data2'],_0x9c56d5[_0x1bb4('0x17')],_0x9c56d5[_0x1bb4('0x19')],_0x9c56d5[_0x1bb4('0x1a')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 84e4e18..fb56373 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 _0xd54c=['jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','rpc','error','message','catch','exports'];(function(_0x598f4b,_0x76e533){var _0x4d9186=function(_0x596906){while(--_0x596906){_0x598f4b['push'](_0x598f4b['shift']());}};_0x4d9186(++_0x76e533);}(_0xd54c,0x1c0));var _0xcd54=function(_0x423299,_0x520914){_0x423299=_0x423299-0x0;var _0x11a3b7=_0xd54c[_0x423299];return _0x11a3b7;};'use strict';var jayson=require(_0xcd54('0x0'));var BPromise=require(_0xcd54('0x1'));var logger=require(_0xcd54('0x2'))(_0xcd54('0x3'));var client=jayson[_0xcd54('0x4')][_0xcd54('0x5')]({'port':0x2329});client[_0xcd54('0x6')]=function(_0x3edb03,_0x56b60e){return new BPromise(function(_0x4cf03e,_0xa9878e){return client[_0xcd54('0x7')](_0x3edb03,_0x56b60e)[_0xcd54('0x8')](function(_0x4e0e96){logger['debug'](_0xcd54('0x9'),'routing',_0x3edb03,_0x56b60e,_0x4e0e96);if(_0x4e0e96['error']){logger[_0xcd54('0xa')](_0xcd54('0x9'),_0xcd54('0x3'),_0x3edb03,_0x4e0e96[_0xcd54('0xa')][_0xcd54('0xb')],_0x56b60e);return _0xa9878e(_0x4e0e96[_0xcd54('0xa')][_0xcd54('0xb')]);}else{return _0x4cf03e(_0x4e0e96['result']);}})[_0xcd54('0xc')](function(_0x2923a9){logger[_0xcd54('0xa')](_0xcd54('0x9'),_0xcd54('0x3'),_0x3edb03,_0x2923a9,_0x56b60e);return _0xa9878e(_0x2923a9);});});};module[_0xcd54('0xd')]=client; \ No newline at end of file +var _0xc288=['exports','jayson/promise','bluebird','../../config/logger','routing','client','Request','request','debug','rpc','error','message','result','catch'];(function(_0xf4e7e2,_0x364891){var _0x41e936=function(_0x3dde21){while(--_0x3dde21){_0xf4e7e2['push'](_0xf4e7e2['shift']());}};_0x41e936(++_0x364891);}(_0xc288,0x15f));var _0x8c28=function(_0x510002,_0x22475d){_0x510002=_0x510002-0x0;var _0x513716=_0xc288[_0x510002];return _0x513716;};'use strict';var jayson=require(_0x8c28('0x0'));var BPromise=require(_0x8c28('0x1'));var logger=require(_0x8c28('0x2'))(_0x8c28('0x3'));var client=jayson[_0x8c28('0x4')]['http']({'port':0x2329});client[_0x8c28('0x5')]=function(_0x4163ba,_0x33d8c3){return new BPromise(function(_0x493373,_0x5b7014){return client[_0x8c28('0x6')](_0x4163ba,_0x33d8c3)['then'](function(_0x69a855){logger[_0x8c28('0x7')](_0x8c28('0x8'),_0x8c28('0x3'),_0x4163ba,_0x33d8c3,_0x69a855);if(_0x69a855[_0x8c28('0x9')]){logger[_0x8c28('0x9')](_0x8c28('0x8'),'routing',_0x4163ba,_0x69a855[_0x8c28('0x9')]['message'],_0x33d8c3);return _0x5b7014(_0x69a855[_0x8c28('0x9')][_0x8c28('0xa')]);}else{return _0x493373(_0x69a855[_0x8c28('0xb')]);}})[_0x8c28('0xc')](function(_0x2fece0){logger[_0x8c28('0x9')]('rpc',_0x8c28('0x3'),_0x4163ba,_0x2fece0,_0x33d8c3);return _0x5b7014(_0x2fece0);});});};module[_0x8c28('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 25bf5cb..303681a 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 _0xa143=['mailAccounts','listen','loginMailFrequency','catch','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve','getMailAccounts','initMailAccounts','then'];(function(_0x553f8c,_0x30e67c){var _0x4707c0=function(_0x29f324){while(--_0x29f324){_0x553f8c['push'](_0x553f8c['shift']());}};_0x4707c0(++_0x30e67c);}(_0xa143,0x123));var _0x3a14=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa143[_0x321bb2];return _0x9c12ed;};'use strict';var server=require('./server');var Realtime=require(_0x3a14('0x0'));var EmailChannel=require(_0x3a14('0x1'));var mailAccount=require(_0x3a14('0x2'));var setting=require(_0x3a14('0x3'));var logger=require('../../config/logger')(_0x3a14('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3a14('0x5')]()['then'](mailAccount[_0x3a14('0x6')]())['then'](realtime[_0x3a14('0x7')]())[_0x3a14('0x8')](function(){email['refresh'](realtime[_0x3a14('0x9')]);return realtime;});}function main(){return server[_0x3a14('0xa')](realtime,email)[_0x3a14('0x8')](function(){return initRealtime();})[_0x3a14('0x8')](function(){return setting['getSettings']();})[_0x3a14('0x8')](function(_0x4852c2){return setInterval(initRealtime,_0x4852c2[_0x3a14('0xb')]*0x3e8);})[_0x3a14('0xc')](function(_0xe9a073){logger[_0x3a14('0xd')](_0x3a14('0xe'),_0xe9a073);});}main(); \ No newline at end of file +var _0xaab3=['then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','Email\x20service\x20initialization','./lib/email','./rpc/setting','../../config/logger','email','resolve'];(function(_0xca1089,_0x5c69da){var _0x219184=function(_0x5327b7){while(--_0x5327b7){_0xca1089['push'](_0xca1089['shift']());}};_0x219184(++_0x5c69da);}(_0xaab3,0x105));var _0x3aab=function(_0x121e93,_0x15ab41){_0x121e93=_0x121e93-0x0;var _0x172040=_0xaab3[_0x121e93];return _0x172040;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x3aab('0x0'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x3aab('0x1'));var logger=require(_0x3aab('0x2'))(_0x3aab('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3aab('0x4')]()[_0x3aab('0x5')](mailAccount[_0x3aab('0x6')]())[_0x3aab('0x5')](realtime[_0x3aab('0x7')]())[_0x3aab('0x5')](function(){email[_0x3aab('0x8')](realtime[_0x3aab('0x9')]);return realtime;});}function main(){return server[_0x3aab('0xa')](realtime,email)[_0x3aab('0x5')](function(){return initRealtime();})['then'](function(){return setting[_0x3aab('0xb')]();})[_0x3aab('0x5')](function(_0x1a68a5){return setInterval(initRealtime,_0x1a68a5[_0x3aab('0xc')]*0x3e8);})['catch'](function(_0x3d2d79){logger['error'](_0x3aab('0xd'),_0x3d2d79);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 8051266..bf36329 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 _0x0393=['handleImapBox','messages','total','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','Smtp','lastSync','verify','lodash','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','mailAccount:update','refresh','hasOwnProperty','service','provider','box','bind','end','handleImapEnd','handleImapError','isNil','disabled'];(function(_0x2d18b9,_0xb56bcf){var _0x166d0c=function(_0x5c4eef){while(--_0x5c4eef){_0x2d18b9['push'](_0x2d18b9['shift']());}};_0x166d0c(++_0xb56bcf);}(_0x0393,0xea));var _0x3039=function(_0x5627b0,_0xa1e41c){_0x5627b0=_0x5627b0-0x0;var _0x7c9093=_0x0393[_0x5627b0];return _0x7c9093;};'use strict';var _=require(_0x3039('0x0'));var moment=require('moment');var BPromise=require(_0x3039('0x1'));var md5=require(_0x3039('0x2'));var Redis=require('ioredis');var config=require(_0x3039('0x3'));var logger=require(_0x3039('0x4'))(_0x3039('0x5'));config[_0x3039('0x6')]=_[_0x3039('0x7')](config[_0x3039('0x6')],{'host':_0x3039('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3039('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x3039('0x9'));var mailAccount=require(_0x3039('0xa'));var md5Accounts={};function EmailChannel(_0x147ec0){logger[_0x3039('0xb')](_0x3039('0xc'));this[_0x3039('0xd')]=_0x147ec0['mailAccounts'];this[_0x3039('0xe')]={};this[_0x3039('0xf')]=new EmailSmtp();}EmailChannel[_0x3039('0x10')][_0x3039('0x11')]=function(_0x5229fe){var _0x3b9ea9=this[_0x3039('0xd')][_0x5229fe];var _0x73aa26={'id':_0x3b9ea9['id'],'name':_0x3b9ea9[_0x3039('0x12')],'key':_0x3b9ea9[_0x3039('0x13')],'active':_0x3b9ea9[_0x3039('0x14')],'Imap':{'status':_0x3b9ea9[_0x3039('0x15')][_0x3039('0x16')],'messageStatus':_0x3b9ea9[_0x3039('0x15')][_0x3039('0x17')],'total':_0x3b9ea9[_0x3039('0x15')]['total']}};if(_['isNil'](md5Accounts[_0x5229fe])){md5Accounts[_0x5229fe]={};}var _0x27fb1b=md5(JSON['stringify'](_0x73aa26));if(md5Accounts[_0x5229fe][_0x3039('0x2')]!==_0x27fb1b){md5Accounts[_0x5229fe][_0x3039('0x2')]=_0x27fb1b;io[_0x3039('0x11')](_0x3039('0x18'),_0x73aa26);}};EmailChannel['prototype'][_0x3039('0x19')]=function(_0x5787c2){for(var _0x50f8fe in _0x5787c2){if(_0x5787c2[_0x3039('0x1a')](_0x50f8fe)){if(_0x5787c2[_0x50f8fe][_0x3039('0x15')]&&_0x5787c2[_0x50f8fe][_0x3039('0x14')]){var _0x3e910f=_0x5787c2[_0x50f8fe][_0x3039('0x15')];if(!_0x3e910f[_0x3039('0x1b')]&&_0x5787c2[_0x50f8fe][_0x3039('0x1c')]!=='custom')_0x3e910f['service']=_0x5787c2[_0x50f8fe]['provider'];if(!this[_0x3039('0xe')]['hasOwnProperty'](_0x3e910f['id'])){this[_0x3039('0xe')][_0x3e910f['id']]=new EmailImap(_0x3e910f,_0x5787c2[_0x50f8fe][_0x3039('0x5')]);this[_0x3039('0xe')][_0x3e910f['id']]['on'](_0x3039('0x1d'),this['handleImapBox'][_0x3039('0x1e')](this,_0x50f8fe));this['imapAccounts'][_0x3e910f['id']]['on']('email',this['handleImapEmail'][_0x3039('0x1e')](this,_0x50f8fe));this[_0x3039('0xe')][_0x3e910f['id']]['on'](_0x3039('0x1f'),this[_0x3039('0x20')]['bind'](this,_0x50f8fe));this[_0x3039('0xe')][_0x3e910f['id']]['on']('error',this[_0x3039('0x21')][_0x3039('0x1e')](this,_0x50f8fe));}}else{if(_[_0x3039('0x22')](this['mailAccounts'][_0x50f8fe][_0x3039('0x15')])){this[_0x3039('0xd')][_0x50f8fe][_0x3039('0x15')]={};}this[_0x3039('0xd')][_0x50f8fe]['Imap'][_0x3039('0x16')]=_0x3039('0x23');this['mailAccounts'][_0x50f8fe][_0x3039('0x15')][_0x3039('0x17')]='';this['emit'](_0x50f8fe);}}}};EmailChannel[_0x3039('0x10')][_0x3039('0x24')]=function(_0x24ea30,_0x1b3975){if(this[_0x3039('0xd')][_0x24ea30]){this[_0x3039('0xd')][_0x24ea30][_0x3039('0x15')][_0x3039('0x16')]='connected';this[_0x3039('0xd')][_0x24ea30][_0x3039('0x15')][_0x3039('0x17')]=_0x1b3975[_0x3039('0x12')];if(_0x1b3975[_0x3039('0x25')]){this[_0x3039('0xd')][_0x24ea30][_0x3039('0x15')]['total']=_0x1b3975[_0x3039('0x25')][_0x3039('0x26')];}return this[_0x3039('0x11')](_0x24ea30);}};EmailChannel['prototype'][_0x3039('0x27')]=function(_0x33aa1e,_0x454c72){logger['info'](_0x3039('0x28'),_0x454c72['firstName'],_0x454c72[_0x3039('0x29')],_0x454c72[_0x3039('0x2a')],_0x33aa1e);if(this['mailAccounts'][_0x33aa1e]){return mailAccount[_0x3039('0x2b')](_0x33aa1e,_0x454c72)[_0x3039('0x2c')](function(_0x54ffae){if(_0x54ffae){logger['info'](_0x3039('0x2d'));}})[_0x3039('0x2e')](function(_0x1ae3b6){logger[_0x3039('0x2f')](_0x3039('0x30'),JSON[_0x3039('0x31')](_0x1ae3b6));});}};EmailChannel[_0x3039('0x10')][_0x3039('0x20')]=function(_0xd448a5){if(this[_0x3039('0xd')][_0xd448a5]&&this[_0x3039('0xd')][_0xd448a5][_0x3039('0x15')]){if(this[_0x3039('0xe')][this[_0x3039('0xd')][_0xd448a5]['Imap']['id']]){delete this[_0x3039('0xe')][this[_0x3039('0xd')][_0xd448a5]['Imap']['id']];}this[_0x3039('0xd')][_0xd448a5][_0x3039('0x15')]['lastSync']=moment();this[_0x3039('0x11')](_0xd448a5);}};EmailChannel['prototype'][_0x3039('0x21')]=function(_0x4c35a3,_0x51c19b){if(this['mailAccounts'][_0x4c35a3]){this[_0x3039('0xd')][_0x4c35a3]['Imap'][_0x3039('0x16')]=_0x3039('0x2f');this['mailAccounts'][_0x4c35a3][_0x3039('0x15')][_0x3039('0x17')]=_0x51c19b;return this['emit'](_0x4c35a3);}};EmailChannel[_0x3039('0x10')][_0x3039('0x32')]=function(_0x36573a,_0x3a094d){return this[_0x3039('0xf')]['send'](_0x36573a,_0x3a094d);};EmailChannel[_0x3039('0x10')]['verifySmtp']=function(_0x43fe05){var _0x3db12b=this;if(this[_0x3039('0xd')][_0x43fe05['id']]){if(_['isNil'](this['mailAccounts'][_0x43fe05['id']]['Smtp'])){this[_0x3039('0xd')][_0x43fe05['id']][_0x3039('0x33')]={};}this['mailAccounts'][_0x43fe05['id']][_0x3039('0x33')][_0x3039('0x34')]=moment();return new BPromise(function(_0x67ced3,_0x593594){return _0x3db12b['smtp']['verify'](_0x43fe05)[_0x3039('0x2c')](function(_0x5a941a){_0x3db12b[_0x3039('0xd')][_0x43fe05['id']][_0x3039('0x33')][_0x3039('0x16')]='verified';_0x3db12b[_0x3039('0xd')][_0x43fe05['id']][_0x3039('0x33')][_0x3039('0x17')]='';_0x3db12b[_0x3039('0x11')](_0x43fe05['id']);_0x67ced3(_0x5a941a);})[_0x3039('0x2e')](function(_0x4bed01){_0x3db12b[_0x3039('0xd')][_0x43fe05['id']][_0x3039('0x33')][_0x3039('0x16')]=_0x3039('0x2f');_0x3db12b['mailAccounts'][_0x43fe05['id']][_0x3039('0x33')][_0x3039('0x17')]=_0x4bed01;_0x3db12b[_0x3039('0x11')](_0x43fe05['id']);_0x593594(_0x4bed01);});});}return this[_0x3039('0xf')][_0x3039('0x35')](_0x43fe05);};module['exports']=EmailChannel; \ No newline at end of file +var _0xfdcf=['lastSync','error','smtp','Smtp','verify','then','verified','catch','exports','lodash','moment','bluebird','md5','ioredis','email','redis','defaults','localhost','socket.io-emitter','./smtp','info','mailAccounts','prototype','emit','name','key','active','Imap','status','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','service','custom','provider','imapAccounts','handleImapBox','handleImapEmail','bind','handleImapEnd','handleImapError','isNil','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s'];(function(_0x147c96,_0x309657){var _0x4ec711=function(_0x3cf7c9){while(--_0x3cf7c9){_0x147c96['push'](_0x147c96['shift']());}};_0x4ec711(++_0x309657);}(_0xfdcf,0xa8));var _0xffdc=function(_0x24f1f5,_0x59f00e){_0x24f1f5=_0x24f1f5-0x0;var _0x19443b=_0xfdcf[_0x24f1f5];return _0x19443b;};'use strict';var _=require(_0xffdc('0x0'));var moment=require(_0xffdc('0x1'));var BPromise=require(_0xffdc('0x2'));var md5=require(_0xffdc('0x3'));var Redis=require(_0xffdc('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xffdc('0x5'));config[_0xffdc('0x6')]=_[_0xffdc('0x7')](config[_0xffdc('0x6')],{'host':_0xffdc('0x8'),'port':0x18eb});var io=require(_0xffdc('0x9'))(new Redis(config[_0xffdc('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xffdc('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3657e4){logger[_0xffdc('0xb')]('start\x20email\x20channel');this[_0xffdc('0xc')]=_0x3657e4['mailAccounts'];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0xffdc('0xd')][_0xffdc('0xe')]=function(_0x1b5413){var _0xce429d=this['mailAccounts'][_0x1b5413];var _0x2ab748={'id':_0xce429d['id'],'name':_0xce429d[_0xffdc('0xf')],'key':_0xce429d[_0xffdc('0x10')],'active':_0xce429d[_0xffdc('0x11')],'Imap':{'status':_0xce429d[_0xffdc('0x12')][_0xffdc('0x13')],'messageStatus':_0xce429d[_0xffdc('0x12')][_0xffdc('0x14')],'total':_0xce429d[_0xffdc('0x12')][_0xffdc('0x15')]}};if(_['isNil'](md5Accounts[_0x1b5413])){md5Accounts[_0x1b5413]={};}var _0x2c340d=md5(JSON[_0xffdc('0x16')](_0x2ab748));if(md5Accounts[_0x1b5413][_0xffdc('0x3')]!==_0x2c340d){md5Accounts[_0x1b5413][_0xffdc('0x3')]=_0x2c340d;io[_0xffdc('0xe')](_0xffdc('0x17'),_0x2ab748);}};EmailChannel[_0xffdc('0xd')][_0xffdc('0x18')]=function(_0x5dd90f){for(var _0x479fc6 in _0x5dd90f){if(_0x5dd90f[_0xffdc('0x19')](_0x479fc6)){if(_0x5dd90f[_0x479fc6]['Imap']&&_0x5dd90f[_0x479fc6][_0xffdc('0x11')]){var _0x27fdd5=_0x5dd90f[_0x479fc6][_0xffdc('0x12')];if(!_0x27fdd5[_0xffdc('0x1a')]&&_0x5dd90f[_0x479fc6]['provider']!==_0xffdc('0x1b'))_0x27fdd5[_0xffdc('0x1a')]=_0x5dd90f[_0x479fc6][_0xffdc('0x1c')];if(!this[_0xffdc('0x1d')][_0xffdc('0x19')](_0x27fdd5['id'])){this[_0xffdc('0x1d')][_0x27fdd5['id']]=new EmailImap(_0x27fdd5,_0x5dd90f[_0x479fc6][_0xffdc('0x5')]);this['imapAccounts'][_0x27fdd5['id']]['on']('box',this[_0xffdc('0x1e')]['bind'](this,_0x479fc6));this['imapAccounts'][_0x27fdd5['id']]['on'](_0xffdc('0x5'),this[_0xffdc('0x1f')][_0xffdc('0x20')](this,_0x479fc6));this[_0xffdc('0x1d')][_0x27fdd5['id']]['on']('end',this[_0xffdc('0x21')][_0xffdc('0x20')](this,_0x479fc6));this[_0xffdc('0x1d')][_0x27fdd5['id']]['on']('error',this[_0xffdc('0x22')][_0xffdc('0x20')](this,_0x479fc6));}}else{if(_[_0xffdc('0x23')](this[_0xffdc('0xc')][_0x479fc6][_0xffdc('0x12')])){this['mailAccounts'][_0x479fc6][_0xffdc('0x12')]={};}this['mailAccounts'][_0x479fc6][_0xffdc('0x12')][_0xffdc('0x13')]=_0xffdc('0x24');this[_0xffdc('0xc')][_0x479fc6][_0xffdc('0x12')][_0xffdc('0x14')]='';this[_0xffdc('0xe')](_0x479fc6);}}}};EmailChannel[_0xffdc('0xd')][_0xffdc('0x1e')]=function(_0x2ba7c3,_0x2f3999){if(this['mailAccounts'][_0x2ba7c3]){this[_0xffdc('0xc')][_0x2ba7c3][_0xffdc('0x12')][_0xffdc('0x13')]=_0xffdc('0x25');this['mailAccounts'][_0x2ba7c3][_0xffdc('0x12')][_0xffdc('0x14')]=_0x2f3999[_0xffdc('0xf')];if(_0x2f3999[_0xffdc('0x26')]){this[_0xffdc('0xc')][_0x2ba7c3][_0xffdc('0x12')][_0xffdc('0x15')]=_0x2f3999[_0xffdc('0x26')][_0xffdc('0x15')];}return this['emit'](_0x2ba7c3);}};EmailChannel[_0xffdc('0xd')][_0xffdc('0x1f')]=function(_0x4f234a,_0x23c7b0){logger[_0xffdc('0xb')](_0xffdc('0x27'),_0x23c7b0[_0xffdc('0x28')],_0x23c7b0['lastName'],_0x23c7b0[_0xffdc('0x29')],_0x4f234a);if(this[_0xffdc('0xc')][_0x4f234a]){return mailAccount['notify'](_0x4f234a,_0x23c7b0)['then'](function(_0x37338d){if(_0x37338d){logger[_0xffdc('0xb')](_0xffdc('0x2a'));}})['catch'](function(_0x6dc745){logger['error'](_0xffdc('0x2b'),JSON[_0xffdc('0x16')](_0x6dc745));});}};EmailChannel[_0xffdc('0xd')][_0xffdc('0x21')]=function(_0x26ad50){if(this[_0xffdc('0xc')][_0x26ad50]&&this[_0xffdc('0xc')][_0x26ad50]['Imap']){if(this[_0xffdc('0x1d')][this[_0xffdc('0xc')][_0x26ad50]['Imap']['id']]){delete this['imapAccounts'][this[_0xffdc('0xc')][_0x26ad50][_0xffdc('0x12')]['id']];}this['mailAccounts'][_0x26ad50][_0xffdc('0x12')][_0xffdc('0x2c')]=moment();this[_0xffdc('0xe')](_0x26ad50);}};EmailChannel[_0xffdc('0xd')]['handleImapError']=function(_0x49aac7,_0x175db8){if(this[_0xffdc('0xc')][_0x49aac7]){this[_0xffdc('0xc')][_0x49aac7][_0xffdc('0x12')][_0xffdc('0x13')]=_0xffdc('0x2d');this[_0xffdc('0xc')][_0x49aac7][_0xffdc('0x12')][_0xffdc('0x14')]=_0x175db8;return this[_0xffdc('0xe')](_0x49aac7);}};EmailChannel['prototype']['sendMail']=function(_0x124647,_0x3e3868){return this[_0xffdc('0x2e')]['send'](_0x124647,_0x3e3868);};EmailChannel[_0xffdc('0xd')]['verifySmtp']=function(_0x5a4df6){var _0x68d98e=this;if(this[_0xffdc('0xc')][_0x5a4df6['id']]){if(_[_0xffdc('0x23')](this[_0xffdc('0xc')][_0x5a4df6['id']][_0xffdc('0x2f')])){this['mailAccounts'][_0x5a4df6['id']][_0xffdc('0x2f')]={};}this['mailAccounts'][_0x5a4df6['id']][_0xffdc('0x2f')]['lastSync']=moment();return new BPromise(function(_0x4ac5cb,_0xb46f56){return _0x68d98e[_0xffdc('0x2e')][_0xffdc('0x30')](_0x5a4df6)[_0xffdc('0x31')](function(_0x38b2d1){_0x68d98e[_0xffdc('0xc')][_0x5a4df6['id']]['Smtp'][_0xffdc('0x13')]=_0xffdc('0x32');_0x68d98e['mailAccounts'][_0x5a4df6['id']][_0xffdc('0x2f')]['messageStatus']='';_0x68d98e[_0xffdc('0xe')](_0x5a4df6['id']);_0x4ac5cb(_0x38b2d1);})[_0xffdc('0x33')](function(_0x54775b){_0x68d98e[_0xffdc('0xc')][_0x5a4df6['id']][_0xffdc('0x2f')][_0xffdc('0x13')]=_0xffdc('0x2d');_0x68d98e[_0xffdc('0xc')][_0x5a4df6['id']][_0xffdc('0x2f')][_0xffdc('0x14')]=_0x54775b;_0x68d98e[_0xffdc('0xe')](_0x5a4df6['id']);_0xb46f56(_0x54775b);});});}return this[_0xffdc('0x2e')][_0xffdc('0x30')](_0x5a4df6);};module[_0xffdc('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 22a6da9..12acdea 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 _0x1623=['bind','error','handleError','connect','prototype','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','modernAuthentication','CloudProvider','data5','getHost','email','anonymous@xcally.com','handleReady','openBox','mailbox','handleOpenBox','box','readUnseen','search','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','closeBox','textCode','hasOwnProperty','upperFirst','exports','lodash','mailparser','simpleParser','iconv','Iconv','events','../../../config/logger','INBOX','account','getAccount','imap','once','ready','end','handleEnd'];(function(_0x395d71,_0x352d8c){var _0x41a8a3=function(_0x1e73b4){while(--_0x1e73b4){_0x395d71['push'](_0x395d71['shift']());}};_0x41a8a3(++_0x352d8c);}(_0x1623,0xab));var _0x3162=function(_0x48bffa,_0x356a6b){_0x48bffa=_0x48bffa-0x0;var _0x1189d3=_0x1623[_0x48bffa];return _0x1189d3;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var Imap=require('imap');var simpleParser=require(_0x3162('0x1'))[_0x3162('0x2')];var Iconv=require(_0x3162('0x3'))[_0x3162('0x4')];var EventEmitter=require(_0x3162('0x5'))['EventEmitter'];var utils=require('./utils');var logger=require(_0x3162('0x6'))('email');function EmailImap(_0x1b55f2,_0x428de6){this['mailbox']=_0x3162('0x7');this[_0x3162('0x8')]=this[_0x3162('0x9')](_0x1b55f2,_0x428de6);this[_0x3162('0xa')]=new Imap(this[_0x3162('0x8')]);this[_0x3162('0xa')][_0x3162('0xb')](_0x3162('0xc'),this['handleReady']['bind'](this));this[_0x3162('0xa')][_0x3162('0xb')](_0x3162('0xd'),this[_0x3162('0xe')][_0x3162('0xf')](this));this[_0x3162('0xa')]['on'](_0x3162('0x10'),this[_0x3162('0x11')][_0x3162('0xf')](this));this['imap'][_0x3162('0x12')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x3162('0x13')][_0x3162('0x9')]=function(_0x49d1ad,_0x4a393a){var _0x198764={'connTimeout':_0x49d1ad[_0x3162('0x14')]?_0x49d1ad[_0x3162('0x14')]*0x3e8:0x2710,'authTimeout':_0x49d1ad['authTimeout']?_0x49d1ad[_0x3162('0x15')]*0x3e8:0x1388};if(_[_0x3162('0x16')](_0x49d1ad[_0x3162('0x17')])){if(_0x49d1ad['authentication']){_0x198764[_0x3162('0x18')]=_0x49d1ad[_0x3162('0x18')];_0x198764[_0x3162('0x19')]=_0x49d1ad[_0x3162('0x19')];}_0x198764[_0x3162('0x1a')]=_0x49d1ad[_0x3162('0x1a')];_0x198764[_0x3162('0x1b')]=_0x49d1ad['port']||0x3e1;if(_0x49d1ad[_0x3162('0x1c')]){_0x198764[_0x3162('0x1c')]=!![];}else{_0x198764[_0x3162('0x1c')]=![];_0x198764[_0x3162('0x1d')]='required';}}else{if(_0x49d1ad[_0x3162('0x1e')]){_0x198764['xoauth2']=utils['generateXOAuth2Token'](_0x49d1ad[_0x3162('0x1f')][_0x3162('0x20')],_0x49d1ad[_0x3162('0x18')]);_0x198764['user']=_0x49d1ad['user'];}else{_0x198764[_0x3162('0x18')]=_0x49d1ad[_0x3162('0x18')];_0x198764[_0x3162('0x19')]=_0x49d1ad[_0x3162('0x19')];}_0x198764[_0x3162('0x1a')]=utils[_0x3162('0x21')](_0x49d1ad[_0x3162('0x17')]);_0x198764[_0x3162('0x1b')]=0x3e1;_0x198764['tls']=!![];}_0x198764[_0x3162('0x22')]=_0x4a393a||_0x49d1ad[_0x3162('0x18')]||_0x3162('0x23');return _0x198764;};EmailImap[_0x3162('0x13')][_0x3162('0x24')]=function(){this[_0x3162('0xa')][_0x3162('0x25')](this[_0x3162('0x26')],![],this[_0x3162('0x27')][_0x3162('0xf')](this));};EmailImap[_0x3162('0x13')][_0x3162('0x27')]=function(_0x1c03a4,_0x48de45){if(_0x1c03a4){this[_0x3162('0x11')](_0x1c03a4,!![]);}else{this['emit'](_0x3162('0x28'),_0x48de45);this[_0x3162('0x29')]();}};EmailImap[_0x3162('0x13')]['handleCloseBox']=function(_0x4903e7){if(_0x4903e7){this[_0x3162('0x11')](_0x4903e7,!![]);}else{this[_0x3162('0xa')][_0x3162('0xd')]();}};EmailImap[_0x3162('0x13')][_0x3162('0x29')]=function(){this['imap'][_0x3162('0x2a')](['UNSEEN'],this[_0x3162('0x2b')][_0x3162('0xf')](this));};EmailImap[_0x3162('0x13')][_0x3162('0x2b')]=function(_0x118dab,_0x18b9f2){if(_0x118dab){this[_0x3162('0x11')](_0x118dab,!![]);}else{if(_0x18b9f2[_0x3162('0x2c')]){try{var _0x549ffe=this[_0x3162('0xa')][_0x3162('0x2d')](_0x18b9f2,{'bodies':'','markSeen':!![]});_0x549ffe['on']('message',this[_0x3162('0x2e')][_0x3162('0xf')](this));_0x549ffe['once']('error',this[_0x3162('0x2f')]['bind'](this));_0x549ffe[_0x3162('0xb')](_0x3162('0xd'),this[_0x3162('0x30')]['bind'](this));}catch(_0x548f7f){logger[_0x3162('0x10')](_0x548f7f);}}else{this[_0x3162('0xa')]['closeBox'](!![],this[_0x3162('0x31')]['bind'](this));}}};EmailImap[_0x3162('0x13')][_0x3162('0x2e')]=function(_0x339be2){_0x339be2['on'](_0x3162('0x32'),this[_0x3162('0x33')][_0x3162('0xf')](this));_0x339be2[_0x3162('0xb')](_0x3162('0x34'),this[_0x3162('0x35')][_0x3162('0xf')](this));_0x339be2[_0x3162('0xb')]('end',this[_0x3162('0x36')][_0x3162('0xf')](this));};EmailImap[_0x3162('0x13')]['handleMessageBody']=function(_0x59759d){simpleParser(_0x59759d,{'Iconv':Iconv},this[_0x3162('0x37')][_0x3162('0xf')](this));};EmailImap[_0x3162('0x13')][_0x3162('0x35')]=function(){};EmailImap['prototype'][_0x3162('0x36')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x5dee49,_0x298ed7){if(_0x5dee49){logger[_0x3162('0x10')](_0x5dee49);}else{var _0x315fdb=this;utils['parser'](this[_0x3162('0x8')],_0x298ed7,function(_0x2ce9c6){_0x315fdb[_0x3162('0x38')](_0x3162('0x22'),_0x2ce9c6);});}};EmailImap[_0x3162('0x13')]['handleFetchEnd']=function(){this['imap'][_0x3162('0x39')](!![],this[_0x3162('0x31')]['bind'](this));};EmailImap['prototype'][_0x3162('0x2f')]=function(_0x32c960){this[_0x3162('0x11')](_0x32c960);this['imap'][_0x3162('0x39')](!![],this[_0x3162('0x31')][_0x3162('0xf')](this));};EmailImap[_0x3162('0x13')]['handleEnd']=function(){this[_0x3162('0x38')](_0x3162('0xd'));};EmailImap['prototype'][_0x3162('0x11')]=function(_0x337352,_0x500e6b){logger[_0x3162('0x10')](_0x3162('0x11'),this['account'][_0x3162('0x22')],JSON['stringify'](_0x337352));var _0x4146f1='';if(_0x337352){if(_0x337352[_0x3162('0x3a')]){_0x4146f1=_0x337352[_0x3162('0x3a')];}else{for(var _0x262f9d in _0x337352){if(_0x337352[_0x3162('0x3b')](_0x262f9d)){_0x4146f1+=_[_0x3162('0x3c')](_0x262f9d)+':\x20'+_0x337352[_0x262f9d]+'\x0a';}}}}if(_0x500e6b){this['imap'][_0x3162('0xd')]();}else{this[_0x3162('0x38')](_0x3162('0x10'),_0x4146f1);this['emit'](_0x3162('0xd'));}};module[_0x3162('0x3d')]=EmailImap; \ No newline at end of file +var _0xabce=['UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','handleCloseBox','stringify','textCode','hasOwnProperty','exports','lodash','util','imap','mailparser','simpleParser','events','EventEmitter','./utils','mailbox','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','prototype','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','required','xoauth2','generateXOAuth2Token','data5','email','anonymous@xcally.com','openBox','handleOpenBox','emit','readUnseen','search'];(function(_0x2626a8,_0xa9b965){var _0x527424=function(_0xcf30c4){while(--_0xcf30c4){_0x2626a8['push'](_0x2626a8['shift']());}};_0x527424(++_0xa9b965);}(_0xabce,0x103));var _0xeabc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xabce[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var Imap=require(_0xeabc('0x2'));var simpleParser=require(_0xeabc('0x3'))[_0xeabc('0x4')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0xeabc('0x5'))[_0xeabc('0x6')];var utils=require(_0xeabc('0x7'));var logger=require('../../../config/logger')('email');function EmailImap(_0x1b07a8,_0x52a4d7){this[_0xeabc('0x8')]='INBOX';this[_0xeabc('0x9')]=this[_0xeabc('0xa')](_0x1b07a8,_0x52a4d7);this[_0xeabc('0x2')]=new Imap(this['account']);this[_0xeabc('0x2')][_0xeabc('0xb')](_0xeabc('0xc'),this[_0xeabc('0xd')][_0xeabc('0xe')](this));this[_0xeabc('0x2')][_0xeabc('0xb')](_0xeabc('0xf'),this[_0xeabc('0x10')][_0xeabc('0xe')](this));this[_0xeabc('0x2')]['on'](_0xeabc('0x11'),this[_0xeabc('0x12')][_0xeabc('0xe')](this));this[_0xeabc('0x2')][_0xeabc('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xeabc('0x14')][_0xeabc('0xa')]=function(_0x3251c6,_0x55f0de){var _0x5f4ee8={'connTimeout':_0x3251c6[_0xeabc('0x15')]?_0x3251c6[_0xeabc('0x15')]*0x3e8:0x2710,'authTimeout':_0x3251c6[_0xeabc('0x16')]?_0x3251c6['authTimeout']*0x3e8:0x1388};if(_[_0xeabc('0x17')](_0x3251c6[_0xeabc('0x18')])){if(_0x3251c6['authentication']){_0x5f4ee8['user']=_0x3251c6[_0xeabc('0x19')];_0x5f4ee8['password']=_0x3251c6[_0xeabc('0x1a')];}_0x5f4ee8[_0xeabc('0x1b')]=_0x3251c6[_0xeabc('0x1b')];_0x5f4ee8[_0xeabc('0x1c')]=_0x3251c6[_0xeabc('0x1c')]||0x3e1;if(_0x3251c6[_0xeabc('0x1d')]){_0x5f4ee8[_0xeabc('0x1d')]=!![];}else{_0x5f4ee8[_0xeabc('0x1d')]=![];_0x5f4ee8['autotls']=_0xeabc('0x1e');}}else{if(_0x3251c6['modernAuthentication']){_0x5f4ee8[_0xeabc('0x1f')]=utils[_0xeabc('0x20')](_0x3251c6['CloudProvider'][_0xeabc('0x21')],_0x3251c6[_0xeabc('0x19')]);_0x5f4ee8[_0xeabc('0x19')]=_0x3251c6[_0xeabc('0x19')];}else{_0x5f4ee8[_0xeabc('0x19')]=_0x3251c6['user'];_0x5f4ee8[_0xeabc('0x1a')]=_0x3251c6[_0xeabc('0x1a')];}_0x5f4ee8[_0xeabc('0x1b')]=utils['getHost'](_0x3251c6[_0xeabc('0x18')]);_0x5f4ee8[_0xeabc('0x1c')]=0x3e1;_0x5f4ee8[_0xeabc('0x1d')]=!![];}_0x5f4ee8[_0xeabc('0x22')]=_0x55f0de||_0x3251c6['user']||_0xeabc('0x23');return _0x5f4ee8;};EmailImap['prototype'][_0xeabc('0xd')]=function(){this['imap'][_0xeabc('0x24')](this[_0xeabc('0x8')],![],this[_0xeabc('0x25')][_0xeabc('0xe')](this));};EmailImap[_0xeabc('0x14')][_0xeabc('0x25')]=function(_0x131722,_0x4c2693){if(_0x131722){this['handleError'](_0x131722,!![]);}else{this[_0xeabc('0x26')]('box',_0x4c2693);this[_0xeabc('0x27')]();}};EmailImap[_0xeabc('0x14')]['handleCloseBox']=function(_0x2163e6){if(_0x2163e6){this[_0xeabc('0x12')](_0x2163e6,!![]);}else{this[_0xeabc('0x2')][_0xeabc('0xf')]();}};EmailImap[_0xeabc('0x14')][_0xeabc('0x27')]=function(){this[_0xeabc('0x2')][_0xeabc('0x28')]([_0xeabc('0x29')],this['handleReadUnseen'][_0xeabc('0xe')](this));};EmailImap['prototype'][_0xeabc('0x2a')]=function(_0x2d027e,_0x98b445){if(_0x2d027e){this[_0xeabc('0x12')](_0x2d027e,!![]);}else{if(_0x98b445[_0xeabc('0x2b')]){try{var _0x368b8a=this[_0xeabc('0x2')]['fetch'](_0x98b445,{'bodies':'','markSeen':!![]});_0x368b8a['on'](_0xeabc('0x2c'),this[_0xeabc('0x2d')][_0xeabc('0xe')](this));_0x368b8a['once'](_0xeabc('0x11'),this[_0xeabc('0x2e')][_0xeabc('0xe')](this));_0x368b8a['once'](_0xeabc('0xf'),this[_0xeabc('0x2f')][_0xeabc('0xe')](this));}catch(_0x521091){logger[_0xeabc('0x11')](_0x521091);}}else{this[_0xeabc('0x2')]['closeBox'](!![],this['handleCloseBox'][_0xeabc('0xe')](this));}}};EmailImap[_0xeabc('0x14')]['handleFetchMessage']=function(_0x43df50){_0x43df50['on'](_0xeabc('0x30'),this[_0xeabc('0x31')][_0xeabc('0xe')](this));_0x43df50[_0xeabc('0xb')]('attributes',this[_0xeabc('0x32')]['bind'](this));_0x43df50[_0xeabc('0xb')](_0xeabc('0xf'),this[_0xeabc('0x33')]['bind'](this));};EmailImap['prototype'][_0xeabc('0x31')]=function(_0x560d4a){simpleParser(_0x560d4a,{'Iconv':Iconv},this[_0xeabc('0x34')]['bind'](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap['prototype'][_0xeabc('0x33')]=function(){};EmailImap['prototype'][_0xeabc('0x34')]=function(_0x1ebfb6,_0x5c7302){if(_0x1ebfb6){logger[_0xeabc('0x11')](_0x1ebfb6);}else{var _0x4a8415=this;utils[_0xeabc('0x35')](this['account'],_0x5c7302,function(_0xbd7f03){_0x4a8415[_0xeabc('0x26')](_0xeabc('0x22'),_0xbd7f03);});}};EmailImap['prototype']['handleFetchEnd']=function(){this['imap'][_0xeabc('0x36')](!![],this[_0xeabc('0x37')][_0xeabc('0xe')](this));};EmailImap['prototype']['handleFetchError']=function(_0x5cd62e){this[_0xeabc('0x12')](_0x5cd62e);this['imap'][_0xeabc('0x36')](!![],this['handleCloseBox'][_0xeabc('0xe')](this));};EmailImap['prototype']['handleEnd']=function(){this['emit'](_0xeabc('0xf'));};EmailImap[_0xeabc('0x14')][_0xeabc('0x12')]=function(_0x3eeeb5,_0x4ca6a3){logger[_0xeabc('0x11')]('handleError',this[_0xeabc('0x9')][_0xeabc('0x22')],JSON[_0xeabc('0x38')](_0x3eeeb5));var _0x17a0df='';if(_0x3eeeb5){if(_0x3eeeb5[_0xeabc('0x39')]){_0x17a0df=_0x3eeeb5['textCode'];}else{for(var _0x482971 in _0x3eeeb5){if(_0x3eeeb5[_0xeabc('0x3a')](_0x482971)){_0x17a0df+=_['upperFirst'](_0x482971)+':\x20'+_0x3eeeb5[_0x482971]+'\x0a';}}}}if(_0x4ca6a3){this[_0xeabc('0x2')][_0xeabc('0xf')]();}else{this['emit'](_0xeabc('0x11'),_0x17a0df);this[_0xeabc('0x26')](_0xeabc('0xf'));}};module[_0xeabc('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 1f37a87..71df4ab 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a16=['verify','exports','nodemailer','prototype','send','createTransport','use','compile','sendMail','toString'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x2a16,0x17e));var _0x62a1=function(_0x1a7c1e,_0x1c4a52){_0x1a7c1e=_0x1a7c1e-0x0;var _0x99debb=_0x2a16[_0x1a7c1e];return _0x99debb;};'use strict';var nodemailer=require(_0x62a1('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x62a1('0x1')][_0x62a1('0x2')]=function(_0x415c80,_0x4eadcb){return new Promise(function(_0x31cf24,_0x1c4411){var _0x401fb3=nodemailer[_0x62a1('0x3')](_0x415c80);_0x401fb3[_0x62a1('0x4')](_0x62a1('0x5'),inlineBase64());_0x401fb3[_0x62a1('0x6')](_0x4eadcb,function(_0x4a7db9,_0x5d8d64){if(_0x4a7db9){_0x1c4411(_0x4a7db9[_0x62a1('0x7')]());}else{_0x31cf24(_0x5d8d64);}});});};EmailSmtp['prototype'][_0x62a1('0x8')]=function(_0x138cc2){return new Promise(function(_0x8c7fc9,_0x26d8df){var _0x23c0c0=nodemailer[_0x62a1('0x3')](_0x138cc2);_0x23c0c0[_0x62a1('0x8')](function(_0x82c19a,_0x5bf606){if(_0x82c19a){_0x26d8df(_0x82c19a[_0x62a1('0x7')]());}else{if(_0x5bf606){_0x8c7fc9(_0x5bf606);}else{_0x26d8df('Not\x20verifired');}}});});};module[_0x62a1('0x9')]=EmailSmtp; \ No newline at end of file +var _0x1cc3=['send','createTransport','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','prototype'];(function(_0x13ee14,_0x4f4795){var _0x19fef7=function(_0x10f2a8){while(--_0x10f2a8){_0x13ee14['push'](_0x13ee14['shift']());}};_0x19fef7(++_0x4f4795);}(_0x1cc3,0x115));var _0x31cc=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1cc3[_0x502c7d];return _0x30b7ed;};'use strict';var nodemailer=require(_0x31cc('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x31cc('0x1')][_0x31cc('0x2')]=function(_0x577ece,_0x1de0ff){return new Promise(function(_0x3ffe60,_0x3ee358){var _0x4d2509=nodemailer[_0x31cc('0x3')](_0x577ece);_0x4d2509['use']('compile',inlineBase64());_0x4d2509[_0x31cc('0x4')](_0x1de0ff,function(_0x3dbb2a,_0x46accf){if(_0x3dbb2a){_0x3ee358(_0x3dbb2a[_0x31cc('0x5')]());}else{_0x3ffe60(_0x46accf);}});});};EmailSmtp[_0x31cc('0x1')][_0x31cc('0x6')]=function(_0x30fac8){return new Promise(function(_0x3d92a7,_0x41ca98){var _0x45d1eb=nodemailer['createTransport'](_0x30fac8);_0x45d1eb[_0x31cc('0x6')](function(_0x279fde,_0x240417){if(_0x279fde){_0x41ca98(_0x279fde[_0x31cc('0x5')]());}else{if(_0x240417){_0x3d92a7(_0x240417);}else{_0x41ca98(_0x31cc('0x7'));}}});});};module[_0x31cc('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index db44aa2..ebd6c74 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d9c=['includes','bcc','attach','type','now','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','isAutoreply','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','format','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','moment','util','node-tnef','../../../config/logger','email','head','address','anonymous','@xcally.com','value','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','generate','html','test','replace','attachments','forEach','push','_SRC','_IMG','\x20[Attachment:\x20','body','textAsHtml','message','originTo','originCc'];(function(_0x503ea8,_0x22e391){var _0x427e5d=function(_0x1484e8){while(--_0x1484e8){_0x503ea8['push'](_0x503ea8['shift']());}};_0x427e5d(++_0x22e391);}(_0x9d9c,0xbd));var _0xc9d9=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x9d9c[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0xc9d9('0x0'));var moment=require(_0xc9d9('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0xc9d9('0x2'));var tnef=require(_0xc9d9('0x3'));var logger=require(_0xc9d9('0x4'))(_0xc9d9('0x5'));var config=require('../../../config/environment');function getAddress(_0x24274c){var _0x4b37d6=_[_0xc9d9('0x6')](_0x24274c['value']);return _0x4b37d6&&_0x4b37d6['address']?_0x4b37d6[_0xc9d9('0x7')]:_0xc9d9('0x8')+random['generate'](0x6)+_0xc9d9('0x9');}function getFirstName(_0x2da3d3){var _0x1ba00c=_[_0xc9d9('0x6')](_0x2da3d3[_0xc9d9('0xa')]);if(_0x1ba00c&&_0x1ba00c[_0xc9d9('0xb')]){if(_0x1ba00c['name']==_0x1ba00c[_0xc9d9('0x7')]){return _0x1ba00c[_0xc9d9('0xb')][_0xc9d9('0xc')](0x0,_0x1ba00c[_0xc9d9('0xb')][_0xc9d9('0xd')]('@'));}var _0x49b260=_0x1ba00c[_0xc9d9('0xb')][_0xc9d9('0xe')](/\s+/);return _0x49b260[_0xc9d9('0xf')]>0x1?_0x49b260[_0xc9d9('0x10')](0x0,-0x1)[_0xc9d9('0x11')]('\x20'):_0x1ba00c[_0xc9d9('0xb')];}return _0xc9d9('0x12');}function getLastName(_0x43f37e){var _0x7657f8=_[_0xc9d9('0x6')](_0x43f37e['value']);if(_0x7657f8&&_0x7657f8['name']){var _0x234d44=_0x7657f8[_0xc9d9('0xb')]['split'](/\s+/);return _0x234d44[_0xc9d9('0xf')]>0x1?_0x234d44[_0xc9d9('0x13')]():'';}return'';}function getMails(_0x36ec60,_0x5041fb){var _0x4cf287='';for(var _0x40cf88=0x0;_0x40cf88<_0x5041fb[_0xc9d9('0xa')][_0xc9d9('0xf')];_0x40cf88+=0x1){if(_0x5041fb[_0xc9d9('0xa')][_0x40cf88][_0xc9d9('0x7')]!==_0x36ec60){if(!_[_0xc9d9('0x14')](_0x4cf287)){_0x4cf287+=',';}_0x4cf287+=_0x5041fb['value'][_0x40cf88][_0xc9d9('0xb')]||_0x5041fb['value'][_0x40cf88]['address']||'';_0x4cf287+='\x20<';_0x4cf287+=_0x5041fb[_0xc9d9('0xa')][_0x40cf88][_0xc9d9('0x7')]?_0x5041fb[_0xc9d9('0xa')][_0x40cf88][_0xc9d9('0x7')]:_0xc9d9('0x8')+random[_0xc9d9('0x15')](0x6)+'@xcally.com';_0x4cf287+='>';}}return _0x4cf287;}function parseEmail(_0x48196f,_0x2a55ea,_0x5cfc0e){if(_0x2a55ea[_0xc9d9('0x16')]){var _0x534f07=/)<[^<]*)*<\/script>/gi;while(_0x534f07[_0xc9d9('0x17')](_0x2a55ea['html'])){_0x2a55ea[_0xc9d9('0x16')]=_0x2a55ea[_0xc9d9('0x16')][_0xc9d9('0x18')](_0x534f07,'');}if(_0x2a55ea[_0xc9d9('0x16')]['includes']('{_0x59fe09[_0xc9d9('0x1b')](_0x219f3a['filename']);});var _0x3ad72d=/]+>/g;var _0x30370b=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x489450=_0x2a55ea['html'][_0xc9d9('0x18')](_0x30370b,_0xc9d9('0x1c'));var _0x14886a=_0x489450[_0xc9d9('0x18')](_0x3ad72d,_0xc9d9('0x1d'));for(let _0x46bca4=0x0;_0x46bca4<_0x59fe09[_0xc9d9('0xf')];_0x46bca4++){var _0x10497a=_0x14886a['replace'](_0xc9d9('0x1d'),_0xc9d9('0x1e')+_0x59fe09[_0x46bca4]+'\x20]');_0x14886a=_0x10497a;}_0x2a55ea[_0xc9d9('0x16')]=_0x14886a;}_0x5cfc0e[_0xc9d9('0x1f')]=_0x2a55ea[_0xc9d9('0x16')];}else{_0x5cfc0e['body']=_0x2a55ea[_0xc9d9('0x20')];}if(_0x5cfc0e[_0xc9d9('0x1f')]){_0x5cfc0e[_0xc9d9('0x1f')]=_0x5cfc0e[_0xc9d9('0x1f')][_0xc9d9('0x18')](/0x0){var _0x2ccc08=[_0xc9d9('0x2e'),_0xc9d9('0x2f'),'Precedence:\x20auto_reply'];for(var _0xfab2ee=0x0;_0xfab2ee<_0x2a55ea[_0xc9d9('0x2d')][_0xc9d9('0xf')];_0xfab2ee++){var _0x2a580d=_[_0xc9d9('0xd')](_0x2ccc08,_0x2a55ea['headerLines'][_0xfab2ee]['line']);if(_0x2a580d>=0x0){_0x5cfc0e[_0xc9d9('0x30')]=!![];}}}return _0x5cfc0e;}exports['parser']=function(_0x126f90,_0x3fb368,_0x212b90){var _0x4f2a25={'from':getAddress(_0x3fb368['from']),'firstName':getFirstName(_0x3fb368[_0xc9d9('0x31')]),'lastName':getLastName(_0x3fb368[_0xc9d9('0x31')]),'mapKey':_0xc9d9('0x5'),'message':{'from':getMails(_0x126f90['email'],_0x3fb368[_0xc9d9('0x31')]),'to':_0x126f90[_0xc9d9('0x5')],'cc':'','subject':_0x3fb368[_0xc9d9('0x32')]||'','messageId':_0x3fb368[_0xc9d9('0x33')],'inReplyTo':_0x3fb368[_0xc9d9('0x34')],'sentAt':moment(_0x3fb368[_0xc9d9('0x35')])['format'](_0xc9d9('0x36')),'attach':![],'attachments':[]}};if(!_0x3fb368[_0xc9d9('0x16')]&&!_0x3fb368[_0xc9d9('0x20')]){var _0xf57726=_[_0xc9d9('0x37')](_0x3fb368['attachments'],{'contentType':_0xc9d9('0x38')});if(_0xf57726[_0xc9d9('0xf')]){logger['info'](util[_0xc9d9('0x39')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x3fb368[_0xc9d9('0x33')]));tnef[_0xc9d9('0x3a')](_[_0xc9d9('0x3b')](_0xf57726)[_0xc9d9('0x2b')],function(_0x52074f,_0xddb653){if(_0xddb653){_0x3fb368[_0xc9d9('0x16')]=_0xddb653[_0xc9d9('0x3c')]||_0xc9d9('0x3d');if(_0xddb653['Attachments']){for(var _0x3c046a=0x0;_0x3c046a<_0xddb653[_0xc9d9('0x3e')][_0xc9d9('0xf')];_0x3c046a++){var _0x550d94=_0xddb653[_0xc9d9('0x3e')][_0x3c046a];_0x4f2a25[_0xc9d9('0x21')]['attachments'][_0xc9d9('0x1b')]({'filename':_0x550d94[_0xc9d9('0x3f')],'content':Buffer[_0xc9d9('0x31')](_0x550d94['Data'])});}}}_0x212b90(parseEmail(_0x126f90,_0x3fb368,_0x4f2a25));});}else{_0x3fb368[_0xc9d9('0x16')]=_0xc9d9('0x3d');_0x212b90(parseEmail(_0x126f90,_0x3fb368,_0x4f2a25));}}else{_0x212b90(parseEmail(_0x126f90,_0x3fb368,_0x4f2a25));}};exports['getHost']=function(_0x163352){switch(_0x163352){case _0xc9d9('0x40'):return _0xc9d9('0x41');case'yahoo':return _0xc9d9('0x42');case _0xc9d9('0x43'):return'imap-mail.outlook.com';case _0xc9d9('0x44'):return _0xc9d9('0x45');}return'127.0.0.1';};exports[_0xc9d9('0x46')]=function(_0x23796c,_0x217555){var _0x32fa9d=[_0xc9d9('0x47')+(_0x217555||''),_0xc9d9('0x48')+_0x23796c,'',''];return Buffer['from'](_0x32fa9d[_0xc9d9('0x11')](''),'utf-8')[_0xc9d9('0x49')](_0xc9d9('0x4a'));}; \ No newline at end of file +var _0x46d7=['hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','@xcally.com','value','name','substring','indexOf','split','length','join','Anonymous','pop','isEmpty','html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com'];(function(_0x46cd55,_0x106212){var _0x510439=function(_0x3b0e17){while(--_0x3b0e17){_0x46cd55['push'](_0x46cd55['shift']());}};_0x510439(++_0x106212);}(_0x46d7,0x162));var _0x746d=function(_0x14e5aa,_0x21896){_0x14e5aa=_0x14e5aa-0x0;var _0x2a2725=_0x46d7[_0x14e5aa];return _0x2a2725;};'use strict';var _=require(_0x746d('0x0'));var moment=require(_0x746d('0x1'));var random=require(_0x746d('0x2'));var fs=require('fs');var path=require(_0x746d('0x3'));var util=require(_0x746d('0x4'));var tnef=require(_0x746d('0x5'));var logger=require(_0x746d('0x6'))(_0x746d('0x7'));var config=require(_0x746d('0x8'));function getAddress(_0x16587c){var _0x166e15=_[_0x746d('0x9')](_0x16587c['value']);return _0x166e15&&_0x166e15[_0x746d('0xa')]?_0x166e15[_0x746d('0xa')]:_0x746d('0xb')+random['generate'](0x6)+_0x746d('0xc');}function getFirstName(_0xda1f27){var _0x50423f=_[_0x746d('0x9')](_0xda1f27[_0x746d('0xd')]);if(_0x50423f&&_0x50423f[_0x746d('0xe')]){if(_0x50423f[_0x746d('0xe')]==_0x50423f[_0x746d('0xa')]){return _0x50423f[_0x746d('0xe')][_0x746d('0xf')](0x0,_0x50423f[_0x746d('0xe')][_0x746d('0x10')]('@'));}var _0x34afe7=_0x50423f[_0x746d('0xe')][_0x746d('0x11')](/\s+/);return _0x34afe7[_0x746d('0x12')]>0x1?_0x34afe7['slice'](0x0,-0x1)[_0x746d('0x13')]('\x20'):_0x50423f['name'];}return _0x746d('0x14');}function getLastName(_0x58caf2){var _0x54dbfe=_[_0x746d('0x9')](_0x58caf2[_0x746d('0xd')]);if(_0x54dbfe&&_0x54dbfe[_0x746d('0xe')]){var _0x20dd1b=_0x54dbfe['name'][_0x746d('0x11')](/\s+/);return _0x20dd1b[_0x746d('0x12')]>0x1?_0x20dd1b[_0x746d('0x15')]():'';}return'';}function getMails(_0x4d21d6,_0x1ce15c){var _0x1358c8='';for(var _0x584ee0=0x0;_0x584ee0<_0x1ce15c[_0x746d('0xd')][_0x746d('0x12')];_0x584ee0+=0x1){if(_0x1ce15c['value'][_0x584ee0][_0x746d('0xa')]!==_0x4d21d6){if(!_[_0x746d('0x16')](_0x1358c8)){_0x1358c8+=',';}_0x1358c8+=_0x1ce15c[_0x746d('0xd')][_0x584ee0][_0x746d('0xe')]||_0x1ce15c[_0x746d('0xd')][_0x584ee0]['address']||'';_0x1358c8+='\x20<';_0x1358c8+=_0x1ce15c[_0x746d('0xd')][_0x584ee0]['address']?_0x1ce15c['value'][_0x584ee0][_0x746d('0xa')]:_0x746d('0xb')+random['generate'](0x6)+_0x746d('0xc');_0x1358c8+='>';}}return _0x1358c8;}function parseEmail(_0x53ee4e,_0x3cf21a,_0x12a457){if(_0x3cf21a[_0x746d('0x17')]){var _0x4c3b61=/)<[^<]*)*<\/script>/gi;while(_0x4c3b61[_0x746d('0x18')](_0x3cf21a['html'])){_0x3cf21a[_0x746d('0x17')]=_0x3cf21a[_0x746d('0x17')]['replace'](_0x4c3b61,'');}if(_0x3cf21a[_0x746d('0x17')][_0x746d('0x19')](_0x746d('0x1a'))){var _0x63d7cc=[];_0x3cf21a['attachments'][_0x746d('0x1b')](_0x258daa=>{_0x63d7cc['push'](_0x258daa[_0x746d('0x1c')]);});var _0x2dcbd8=/]+>/g;var _0x24afa2=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x48d07d=_0x3cf21a[_0x746d('0x17')][_0x746d('0x1d')](_0x24afa2,_0x746d('0x1e'));var _0x426912=_0x48d07d['replace'](_0x2dcbd8,'_IMG');for(let _0x48283a=0x0;_0x48283a<_0x63d7cc[_0x746d('0x12')];_0x48283a++){var _0x4da187=_0x426912[_0x746d('0x1d')]('_IMG',_0x746d('0x1f')+_0x63d7cc[_0x48283a]+_0x746d('0x20'));_0x426912=_0x4da187;}_0x3cf21a[_0x746d('0x17')]=_0x426912;}_0x12a457[_0x746d('0x21')]=_0x3cf21a[_0x746d('0x17')];}else{_0x12a457[_0x746d('0x21')]=_0x3cf21a[_0x746d('0x22')];}if(_0x12a457[_0x746d('0x21')]){_0x12a457[_0x746d('0x21')]=_0x12a457['body'][_0x746d('0x1d')](/0x0){var _0x4d7f97=[_0x746d('0x33'),_0x746d('0x34'),_0x746d('0x35')];for(var _0x4316c8=0x0;_0x4316c8<_0x3cf21a[_0x746d('0x32')]['length'];_0x4316c8++){var _0x19fcf9=_[_0x746d('0x10')](_0x4d7f97,_0x3cf21a[_0x746d('0x32')][_0x4316c8][_0x746d('0x36')]);if(_0x19fcf9>=0x0){_0x12a457[_0x746d('0x37')]=!![];}}}return _0x12a457;}exports[_0x746d('0x38')]=function(_0x5c93e8,_0x24c455,_0x11c802){var _0x488588={'from':getAddress(_0x24c455[_0x746d('0x39')]),'firstName':getFirstName(_0x24c455[_0x746d('0x39')]),'lastName':getLastName(_0x24c455[_0x746d('0x39')]),'mapKey':_0x746d('0x7'),'message':{'from':getMails(_0x5c93e8[_0x746d('0x7')],_0x24c455[_0x746d('0x39')]),'to':_0x5c93e8[_0x746d('0x7')],'cc':'','subject':_0x24c455[_0x746d('0x3a')]||'','messageId':_0x24c455['messageId'],'inReplyTo':_0x24c455[_0x746d('0x3b')],'sentAt':moment(_0x24c455['date'])[_0x746d('0x2c')](_0x746d('0x3c')),'attach':![],'attachments':[]}};if(!_0x24c455[_0x746d('0x17')]&&!_0x24c455[_0x746d('0x22')]){var _0xddce4=_[_0x746d('0x3d')](_0x24c455[_0x746d('0x28')],{'contentType':_0x746d('0x3e')});if(_0xddce4[_0x746d('0x12')]){logger[_0x746d('0x3f')](util[_0x746d('0x2c')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x24c455[_0x746d('0x40')]));tnef[_0x746d('0x41')](_[_0x746d('0x42')](_0xddce4)[_0x746d('0x30')],function(_0x547595,_0x29f78a){if(_0x29f78a){_0x24c455[_0x746d('0x17')]=_0x29f78a[_0x746d('0x43')]||_0x746d('0x44');if(_0x29f78a[_0x746d('0x45')]){for(var _0x30c29d=0x0;_0x30c29d<_0x29f78a['Attachments'][_0x746d('0x12')];_0x30c29d++){var _0x59b321=_0x29f78a[_0x746d('0x45')][_0x30c29d];_0x488588[_0x746d('0x25')][_0x746d('0x28')]['push']({'filename':_0x59b321[_0x746d('0x46')],'content':Buffer[_0x746d('0x39')](_0x59b321['Data'])});}}}_0x11c802(parseEmail(_0x5c93e8,_0x24c455,_0x488588));});}else{_0x24c455[_0x746d('0x17')]='

Empty\x20message

';_0x11c802(parseEmail(_0x5c93e8,_0x24c455,_0x488588));}}else{_0x11c802(parseEmail(_0x5c93e8,_0x24c455,_0x488588));}};exports[_0x746d('0x47')]=function(_0x44670c){switch(_0x44670c){case _0x746d('0x48'):return _0x746d('0x49');case _0x746d('0x4a'):return _0x746d('0x4b');case _0x746d('0x4c'):return _0x746d('0x4d');case _0x746d('0x4e'):return _0x746d('0x4f');}return _0x746d('0x50');};exports['generateXOAuth2Token']=function(_0x4a4e52,_0x29881a){var _0x48ffd1=[_0x746d('0x51')+(_0x29881a||''),_0x746d('0x52')+_0x4a4e52,'',''];return Buffer[_0x746d('0x39')](_0x48ffd1[_0x746d('0x13')](''),_0x746d('0x53'))[_0x746d('0x54')](_0x746d('0x55'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 81976f5..066f24e 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 _0x0cf4=['active','Imap','Smtp','exports','lodash','name','key'];(function(_0x67de5e,_0x3a3ba5){var _0x430736=function(_0xa07e57){while(--_0xa07e57){_0x67de5e['push'](_0x67de5e['shift']());}};_0x430736(++_0x3a3ba5);}(_0x0cf4,0x1d2));var _0x40cf=function(_0x1418a5,_0x19c106){_0x1418a5=_0x1418a5-0x0;var _0x22c849=_0x0cf4[_0x1418a5];return _0x22c849;};'use strict';var _=require(_0x40cf('0x0'));function MailAccount(_0x175024){this['id']=_0x175024['id']||0x0;this[_0x40cf('0x1')]=_0x175024[_0x40cf('0x1')]||'Service';this[_0x40cf('0x2')]=_0x175024['key']||'SERV';this[_0x40cf('0x3')]=_0x175024['active']||![];this[_0x40cf('0x4')]=_0x175024[_0x40cf('0x4')]||[];this[_0x40cf('0x5')]=_0x175024[_0x40cf('0x5')]||[];}module[_0x40cf('0x6')]=MailAccount; \ No newline at end of file +var _0xacd9=['Smtp','exports','key','SERV','active','Imap'];(function(_0x1a398a,_0x53f4d8){var _0x4f3aca=function(_0x496a5a){while(--_0x496a5a){_0x1a398a['push'](_0x1a398a['shift']());}};_0x4f3aca(++_0x53f4d8);}(_0xacd9,0x1be));var _0x9acd=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xacd9[_0x5447fd];return _0x15b28a;};'use strict';var _=require('lodash');function MailAccount(_0x225360){this['id']=_0x225360['id']||0x0;this['name']=_0x225360['name']||'Service';this[_0x9acd('0x0')]=_0x225360[_0x9acd('0x0')]||_0x9acd('0x1');this[_0x9acd('0x2')]=_0x225360[_0x9acd('0x2')]||![];this[_0x9acd('0x3')]=_0x225360[_0x9acd('0x3')]||[];this[_0x9acd('0x4')]=_0x225360[_0x9acd('0x4')]||[];}module[_0x9acd('0x5')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 240b466..6392a3a 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 _0xbfc4=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','isUndefined','lodash','mailAccounts'];(function(_0x40e593,_0x366141){var _0x3b5527=function(_0x127cab){while(--_0x127cab){_0x40e593['push'](_0x40e593['shift']());}};_0x3b5527(++_0x366141);}(_0xbfc4,0xfa));var _0x4bfc=function(_0x5187de,_0x3d3f48){_0x5187de=_0x5187de-0x0;var _0x52b4d7=_0xbfc4[_0x5187de];return _0x52b4d7;};'use strict';var _=require(_0x4bfc('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x4bfc('0x1')]={};};function freeIsNotKey(_0x4f523c,_0x3d30ea,_0x52fe98){var _0x54bf93=_[_0x4bfc('0x2')](_0x4f523c,function(_0x54e2ab,_0x14fcd7){return _0x54e2ab[_0x52fe98];});for(var _0x33630b in _0x3d30ea){if(_0x3d30ea[_0x4bfc('0x3')](_0x33630b)){if(!_0x54bf93[_0x33630b]){delete _0x3d30ea[_0x33630b];}}}}Realtime[_0x4bfc('0x4')][_0x4bfc('0x5')]=function(_0x1ddf4f,_0xddc585){for(var _0x45bfbf in _0xddc585){if(_0x1ddf4f[_0x4bfc('0x3')](_0x45bfbf)){_0x1ddf4f[_0x45bfbf]=_0xddc585[_0x45bfbf];}}};Realtime[_0x4bfc('0x4')]['initMailAccounts']=function(){var _0x2b042d=this;return function(_0xda02dc){if(_0xda02dc){freeIsNotKey(_0xda02dc,_0x2b042d[_0x4bfc('0x1')],'id');for(var _0x3b4f36=0x0,_0x299a21={},_0x2e7b2a={};_0x3b4f36<_0xda02dc['length'];_0x3b4f36+=0x1){_0x299a21=_0xda02dc[_0x3b4f36];if(_[_0x4bfc('0x6')](_0x2b042d[_0x4bfc('0x1')][_0x299a21['id']])){_0x2b042d[_0x4bfc('0x1')][_0x299a21['id']]=new MailAccount(_0x299a21);}else{_['merge'](_0x2b042d[_0x4bfc('0x1')][_0x299a21['id']],_0x299a21);}}}return _0x2b042d[_0x4bfc('0x1')];};};module['exports']=Realtime; \ No newline at end of file +var _0x9774=['lodash','prototype','mergeFromDatabase','hasOwnProperty','mailAccounts','length','isUndefined'];(function(_0x59bf86,_0x587ef1){var _0x3a1c66=function(_0x3896d0){while(--_0x3896d0){_0x59bf86['push'](_0x59bf86['shift']());}};_0x3a1c66(++_0x587ef1);}(_0x9774,0x1d5));var _0x4977=function(_0x3c0941,_0x224c98){_0x3c0941=_0x3c0941-0x0;var _0x3c41f6=_0x9774[_0x3c0941];return _0x3c41f6;};'use strict';var _=require(_0x4977('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x604696,_0x39f35f,_0xf2fbc3){var _0x200ee1=_['mapKeys'](_0x604696,function(_0x2665a4,_0x5183b8){return _0x2665a4[_0xf2fbc3];});for(var _0x260bf1 in _0x39f35f){if(_0x39f35f['hasOwnProperty'](_0x260bf1)){if(!_0x200ee1[_0x260bf1]){delete _0x39f35f[_0x260bf1];}}}}Realtime[_0x4977('0x1')][_0x4977('0x2')]=function(_0x199b5a,_0x190926){for(var _0x29605e in _0x190926){if(_0x199b5a[_0x4977('0x3')](_0x29605e)){_0x199b5a[_0x29605e]=_0x190926[_0x29605e];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x175a4f=this;return function(_0x152b81){if(_0x152b81){freeIsNotKey(_0x152b81,_0x175a4f[_0x4977('0x4')],'id');for(var _0x4455c7=0x0,_0x57e765={},_0x4e6d64={};_0x4455c7<_0x152b81[_0x4977('0x5')];_0x4455c7+=0x1){_0x57e765=_0x152b81[_0x4455c7];if(_[_0x4977('0x6')](_0x175a4f[_0x4977('0x4')][_0x57e765['id']])){_0x175a4f[_0x4977('0x4')][_0x57e765['id']]=new MailAccount(_0x57e765);}else{_['merge'](_0x175a4f['mailAccounts'][_0x57e765['id']],_0x57e765);}}}return _0x175a4f['mailAccounts'];};};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 000b511..8bf83c7 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 _0xb296=['notify','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','active','ListId','TemplateId','Imap','CloudProvider','type','MailServerOut','Smtp','data5','getMailAccount'];(function(_0xb47dc0,_0x407032){var _0x57f0b0=function(_0x11c030){while(--_0x11c030){_0xb47dc0['push'](_0xb47dc0['shift']());}};_0x57f0b0(++_0x407032);}(_0xb296,0xa3));var _0x6b29=function(_0x3dba1a,_0x1496de){_0x3dba1a=_0x3dba1a-0x0;var _0x470cc6=_0xb296[_0x3dba1a];return _0x470cc6;};'use strict';var client=require(_0x6b29('0x0'));exports[_0x6b29('0x1')]=function(){return function(){return client[_0x6b29('0x2')](_0x6b29('0x3'),{'options':{'attributes':['id',_0x6b29('0x4'),_0x6b29('0x5'),_0x6b29('0x6'),'email',_0x6b29('0x7'),'key',_0x6b29('0x8'),_0x6b29('0x9')],'raw':![],'include':[{'model':'MailServerIn','as':_0x6b29('0xa'),'include':[{'model':_0x6b29('0xb'),'attributes':['id',_0x6b29('0x4'),_0x6b29('0x6'),_0x6b29('0xc'),'data5'],'as':_0x6b29('0xb')}]},{'model':_0x6b29('0xd'),'as':_0x6b29('0xe'),'include':[{'model':_0x6b29('0xb'),'attributes':['id',_0x6b29('0x4'),_0x6b29('0x6'),_0x6b29('0xc'),_0x6b29('0xf')],'as':'CloudProvider'}]}]},'log':_0x6b29('0x10')});};};exports[_0x6b29('0x11')]=function(_0x389ead,_0x5949f6){return client[_0x6b29('0x2')]('NotifyMailAccount',{'account':{'id':_0x389ead},'body':_0x5949f6,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xbf25=['key','TemplateId','MailServerIn','CloudProvider','data5','MailServerOut','type','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','provider','service','email'];(function(_0x5bf79a,_0x2eaa1d){var _0x3ff10f=function(_0x48523){while(--_0x48523){_0x5bf79a['push'](_0x5bf79a['shift']());}};_0x3ff10f(++_0x2eaa1d);}(_0xbf25,0x15e));var _0x5bf2=function(_0x22c435,_0xc6d4f5){_0x22c435=_0x22c435-0x0;var _0x338ebd=_0xbf25[_0x22c435];return _0x338ebd;};'use strict';var client=require(_0x5bf2('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x5bf2('0x1')](_0x5bf2('0x2'),{'options':{'attributes':['id',_0x5bf2('0x3'),_0x5bf2('0x4'),_0x5bf2('0x5'),_0x5bf2('0x6'),'active',_0x5bf2('0x7'),'ListId',_0x5bf2('0x8')],'raw':![],'include':[{'model':_0x5bf2('0x9'),'as':'Imap','include':[{'model':_0x5bf2('0xa'),'attributes':['id',_0x5bf2('0x3'),_0x5bf2('0x5'),'type',_0x5bf2('0xb')],'as':_0x5bf2('0xa')}]},{'model':_0x5bf2('0xc'),'as':'Smtp','include':[{'model':_0x5bf2('0xa'),'attributes':['id',_0x5bf2('0x3'),_0x5bf2('0x5'),_0x5bf2('0xd'),_0x5bf2('0xb')],'as':_0x5bf2('0xa')}]}]},'log':_0x5bf2('0xe')});};};exports[_0x5bf2('0xf')]=function(_0x3e00e1,_0x2b800f){return client[_0x5bf2('0x1')](_0x5bf2('0x10'),{'account':{'id':_0x3e00e1},'body':_0x2b800f,'log':_0x5bf2('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 55e4633..5370758 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 _0x3c82=['getSettings','Request','ShowSetting','GetSettings','../client'];(function(_0x1392c4,_0x5a51c6){var _0x179f77=function(_0x14ecba){while(--_0x14ecba){_0x1392c4['push'](_0x1392c4['shift']());}};_0x179f77(++_0x5a51c6);}(_0x3c82,0x86));var _0x23c8=function(_0x523cba,_0xace434){_0x523cba=_0x523cba-0x0;var _0x5d52c7=_0x3c82[_0x523cba];return _0x5d52c7;};'use strict';var client=require(_0x23c8('0x0'));exports[_0x23c8('0x1')]=function(){return client[_0x23c8('0x2')](_0x23c8('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x23c8('0x4')});}; \ No newline at end of file +var _0xba71=['loginMailFrequency','GetSettings','../client','ShowSetting'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0xba71,0x1be));var _0x1ba7=function(_0x3dca46,_0x59fbfe){_0x3dca46=_0x3dca46-0x0;var _0x53c9be=_0xba71[_0x3dca46];return _0x53c9be;};'use strict';var client=require(_0x1ba7('0x0'));exports['getSettings']=function(){return client['Request'](_0x1ba7('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1ba7('0x2')]},'log':_0x1ba7('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 9cb0ed5..f3ca62c 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(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 9788214..0430ac6 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 _0xd08e=['localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','http','express','ioredis','../../config/environment','createServer','timeout','socket.io','websocket','polling','redis'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xd08e,0xdc));var _0xed08=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0xd08e[_0x352e09];return _0x1b7094;};'use strict';var _=require('lodash');var http=require(_0xed08('0x0'));var express=require(_0xed08('0x1'));var sticky=require('sticky-session');var Redis=require(_0xed08('0x2'));var config=require(_0xed08('0x3'));var app=express();var server=http[_0xed08('0x4')](app);server[_0xed08('0x5')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0xed08('0x6'))(server,{'transports':[_0xed08('0x7'),_0xed08('0x8')]});config[_0xed08('0x9')]=_['defaults'](config['redis'],{'host':_0xed08('0xa'),'port':0x18eb});socketio[_0xed08('0xb')](require(_0xed08('0xc'))({'pubClient':new Redis(config[_0xed08('0x9')]),'subClient':new Redis(config[_0xed08('0x9')])}));require(_0xed08('0xd'))[_0xed08('0xe')]();require(_0xed08('0xf'))[_0xed08('0xe')](socketio);require(_0xed08('0x10'))['default'](app);require(_0xed08('0x11'))[_0xed08('0xe')](app);}else{server[_0xed08('0x12')]('listening',function(){console[_0xed08('0x13')](_0xed08('0x14'),config[_0xed08('0x15')]);});}exports=module[_0xed08('0x16')]=app; \ No newline at end of file +var _0x96b7=['../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','../../config/environment','timeout','listen','port','socket.io','websocket','polling','redis','localhost','adapter','../../config/triggers','default','../../config/socketio','../../config/express'];(function(_0x567f25,_0x114d6f){var _0x505d0b=function(_0x56dfed){while(--_0x56dfed){_0x567f25['push'](_0x567f25['shift']());}};_0x505d0b(++_0x114d6f);}(_0x96b7,0x1a7));var _0x796b=function(_0x4b6887,_0x96c4b7){_0x4b6887=_0x4b6887-0x0;var _0x2bf120=_0x96b7[_0x4b6887];return _0x2bf120;};'use strict';var _=require(_0x796b('0x0'));var http=require(_0x796b('0x1'));var express=require(_0x796b('0x2'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0x796b('0x3'));var app=express();var server=http['createServer'](app);server[_0x796b('0x4')]=0xdbba0;if(sticky[_0x796b('0x5')](server,config[_0x796b('0x6')])){var socketio=require(_0x796b('0x7'))(server,{'transports':[_0x796b('0x8'),_0x796b('0x9')]});config['redis']=_['defaults'](config[_0x796b('0xa')],{'host':_0x796b('0xb'),'port':0x18eb});socketio[_0x796b('0xc')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x796b('0xa')])}));require(_0x796b('0xd'))[_0x796b('0xe')]();require(_0x796b('0xf'))[_0x796b('0xe')](socketio);require(_0x796b('0x10'))[_0x796b('0xe')](app);require(_0x796b('0x11'))[_0x796b('0xe')](app);}else{server[_0x796b('0x12')](_0x796b('0x13'),function(){console[_0x796b('0x14')](_0x796b('0x15'),config[_0x796b('0x6')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 93be07b..f071ef8 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 _0xe773=['routing','error','message','result','catch','exports','jayson/promise','bluebird','client','http','request','then','debug','rpc'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xe773,0x172));var _0x3e77=function(_0x38aeb5,_0x544987){_0x38aeb5=_0x38aeb5-0x0;var _0x128a90=_0xe773[_0x38aeb5];return _0x128a90;};'use strict';var jayson=require(_0x3e77('0x0'));var BPromise=require(_0x3e77('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x3e77('0x2')][_0x3e77('0x3')]({'port':0x2329});client['Request']=function(_0x3c5990,_0x44e956){return new BPromise(function(_0x2de95e,_0x14d2f7){return client[_0x3e77('0x4')](_0x3c5990,_0x44e956)[_0x3e77('0x5')](function(_0x1d0773){logger[_0x3e77('0x6')](_0x3e77('0x7'),_0x3e77('0x8'),_0x3c5990,_0x44e956,_0x1d0773);if(_0x1d0773[_0x3e77('0x9')]){logger[_0x3e77('0x9')](_0x3e77('0x7'),'routing',_0x3c5990,_0x1d0773[_0x3e77('0x9')][_0x3e77('0xa')],_0x44e956);return _0x14d2f7(_0x1d0773[_0x3e77('0x9')][_0x3e77('0xa')]);}else{return _0x2de95e(_0x1d0773[_0x3e77('0xb')]);}})[_0x3e77('0xc')](function(_0x19a5c2){logger['error'](_0x3e77('0x7'),'routing',_0x3c5990,_0x19a5c2,_0x44e956);return _0x14d2f7(_0x19a5c2);});});};module[_0x3e77('0xd')]=client; \ No newline at end of file +var _0xa284=['rpc','routing','error','result','catch','exports','http','Request','then','debug'];(function(_0x3dd975,_0xad4b36){var _0x59ca44=function(_0x138a7e){while(--_0x138a7e){_0x3dd975['push'](_0x3dd975['shift']());}};_0x59ca44(++_0xad4b36);}(_0xa284,0xec));var _0x4a28=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa284[_0x2641f9];return _0x585741;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson['client'][_0x4a28('0x0')]({'port':0x2329});client[_0x4a28('0x1')]=function(_0x6432ca,_0x303acf){return new BPromise(function(_0x408e28,_0xd52f2){return client['request'](_0x6432ca,_0x303acf)[_0x4a28('0x2')](function(_0x578326){logger[_0x4a28('0x3')](_0x4a28('0x4'),_0x4a28('0x5'),_0x6432ca,_0x303acf,_0x578326);if(_0x578326[_0x4a28('0x6')]){logger[_0x4a28('0x6')](_0x4a28('0x4'),_0x4a28('0x5'),_0x6432ca,_0x578326[_0x4a28('0x6')]['message'],_0x303acf);return _0xd52f2(_0x578326[_0x4a28('0x6')]['message']);}else{return _0x408e28(_0x578326[_0x4a28('0x7')]);}})[_0x4a28('0x8')](function(_0x411db3){logger[_0x4a28('0x6')](_0x4a28('0x4'),_0x4a28('0x5'),_0x6432ca,_0x411db3,_0x303acf);return _0xd52f2(_0x411db3);});});};module[_0x4a28('0x9')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index b1fa63c..7828b65 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 _0x5d74=['./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval'];(function(_0x41b986,_0x5a1dc2){var _0x5ede09=function(_0x2b91ff){while(--_0x2b91ff){_0x41b986['push'](_0x41b986['shift']());}};_0x5ede09(++_0x5a1dc2);}(_0x5d74,0x1ad));var _0x45d7=function(_0x328049,_0x320b5b){_0x328049=_0x328049-0x0;var _0x27f878=_0x5d74[_0x328049];return _0x27f878;};'use strict';var BPromise=require(_0x45d7('0x0'));var server=require(_0x45d7('0x1'));var Realtime=require(_0x45d7('0x2'));var user=require(_0x45d7('0x3'));var interval=require(_0x45d7('0x4'));var openchannelQueue=require(_0x45d7('0x5'));var chatQueue=require(_0x45d7('0x6'));var smsQueue=require(_0x45d7('0x7'));var mailQueue=require(_0x45d7('0x8'));var faxQueue=require(_0x45d7('0x9'));var whatsappQueue=require(_0x45d7('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x45d7('0xb')]()[_0x45d7('0xc')](user[_0x45d7('0xd')]())['then'](realtime[_0x45d7('0xe')]())[_0x45d7('0xc')](interval[_0x45d7('0xf')]())[_0x45d7('0xc')](realtime[_0x45d7('0x10')]())[_0x45d7('0xc')](openchannelQueue['getOpenchannelQueues']())[_0x45d7('0xc')](realtime[_0x45d7('0x11')]())['then'](chatQueue[_0x45d7('0x12')]())[_0x45d7('0xc')](realtime[_0x45d7('0x13')]())[_0x45d7('0xc')](smsQueue[_0x45d7('0x14')]())[_0x45d7('0xc')](realtime[_0x45d7('0x15')]())[_0x45d7('0xc')](mailQueue[_0x45d7('0x16')]())[_0x45d7('0xc')](realtime[_0x45d7('0x17')]())[_0x45d7('0xc')](faxQueue[_0x45d7('0x18')]())[_0x45d7('0xc')](realtime[_0x45d7('0x19')]())['then'](whatsappQueue[_0x45d7('0x1a')]())[_0x45d7('0xc')](realtime[_0x45d7('0x1b')]())[_0x45d7('0xc')](function(){return realtime;});}function main(){return server[_0x45d7('0x1c')](realtime)[_0x45d7('0xc')](function(_0x333d2a){return initRealtime();})[_0x45d7('0xc')](function(_0x3d00a9){return setInterval(initRealtime,0x1388);})[_0x45d7('0x1d')](function(_0x4693eb){console[_0x45d7('0x1e')](_0x4693eb);});}main(); \ No newline at end of file +var _0xcfeb=['initChatQueues','getMailQueues','initMailQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues'];(function(_0x54de5d,_0x1f8b26){var _0x1b349e=function(_0xe199cc){while(--_0xe199cc){_0x54de5d['push'](_0x54de5d['shift']());}};_0x1b349e(++_0x1f8b26);}(_0xcfeb,0x1d4));var _0xbcfe=function(_0x595c54,_0x2844b4){_0x595c54=_0x595c54-0x0;var _0x57ec5a=_0xcfeb[_0x595c54];return _0x57ec5a;};'use strict';var BPromise=require('bluebird');var server=require(_0xbcfe('0x0'));var Realtime=require(_0xbcfe('0x1'));var user=require(_0xbcfe('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xbcfe('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xbcfe('0x4'));var mailQueue=require(_0xbcfe('0x5'));var faxQueue=require(_0xbcfe('0x6'));var whatsappQueue=require(_0xbcfe('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xbcfe('0x8')]()[_0xbcfe('0x9')](user[_0xbcfe('0xa')]())[_0xbcfe('0x9')](realtime[_0xbcfe('0xb')]())[_0xbcfe('0x9')](interval['getIntervals']())['then'](realtime[_0xbcfe('0xc')]())[_0xbcfe('0x9')](openchannelQueue[_0xbcfe('0xd')]())[_0xbcfe('0x9')](realtime[_0xbcfe('0xe')]())[_0xbcfe('0x9')](chatQueue['getChatQueues']())[_0xbcfe('0x9')](realtime[_0xbcfe('0xf')]())[_0xbcfe('0x9')](smsQueue['getSmsQueues']())[_0xbcfe('0x9')](realtime['initSmsQueues']())[_0xbcfe('0x9')](mailQueue[_0xbcfe('0x10')]())[_0xbcfe('0x9')](realtime[_0xbcfe('0x11')]())[_0xbcfe('0x9')](faxQueue['getFaxQueues']())['then'](realtime[_0xbcfe('0x12')]())[_0xbcfe('0x9')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0xbcfe('0x13')]())[_0xbcfe('0x9')](function(){return realtime;});}function main(){return server[_0xbcfe('0x14')](realtime)[_0xbcfe('0x9')](function(_0x2f1062){return initRealtime();})[_0xbcfe('0x9')](function(_0x4b3c39){return setInterval(initRealtime,0x1388);})[_0xbcfe('0x15')](function(_0x3629ce){console[_0xbcfe('0x16')](_0x3629ce);});}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 072ddbe..0ce090a 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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1261,0x144));var _0x1126=function(_0x1dbb97,_0xc2e02f){_0x1dbb97=_0x1dbb97-0x0;var _0x57612f=_0x1261[_0x1dbb97];return _0x57612f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +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(_0x487da2,_0x3ed451){var _0x1bf989=function(_0x174dcc){while(--_0x174dcc){_0x487da2['push'](_0x487da2['shift']());}};_0x1bf989(++_0x3ed451);}(_0xe14b,0x93));var _0xbe14=function(_0x3fe598,_0x15f129){_0x3fe598=_0x3fe598-0x0;var _0x2bbc37=_0xe14b[_0x3fe598];return _0x2bbc37;};'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 diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 8289638..90a5953 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 _0xf507=['then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','http','request'];(function(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0xf507,0x15c));var _0x7f50=function(_0x104c93,_0x45de84){_0x104c93=_0x104c93-0x0;var _0x41c9a3=_0xf507[_0x104c93];return _0x41c9a3;};'use strict';var BPromise=require(_0x7f50('0x0'));var jayson=require(_0x7f50('0x1'));var client=jayson['client'][_0x7f50('0x2')]({'port':0x232b});function request(_0x23ff3c,_0x2f07bf){return new BPromise(function(_0x9593e7,_0xc63e13){return client[_0x7f50('0x3')](_0x23ff3c,_0x2f07bf)[_0x7f50('0x4')](function(_0x5c5b56){if(_0x5c5b56['error']){return _0xc63e13(_0x5c5b56[_0x7f50('0x5')][_0x7f50('0x6')]);}else{return _0x9593e7(_0x5c5b56[_0x7f50('0x7')]);}})[_0x7f50('0x8')](function(_0x48b8c2){return _0xc63e13(_0x48b8c2);});});}exports[_0x7f50('0x9')]=function(_0x1c2c13,_0x145ba1){return request(_0x7f50('0xa'),{'account':_0x1c2c13,'message':_0x145ba1});}; \ No newline at end of file +var _0x0d28=['sendMailMessage','SendMail','bluebird','client','http','then','error','result','catch'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0x0d28,0x17c));var _0x80d2=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x0d28[_0x412e27];return _0x53da42;};'use strict';var BPromise=require(_0x80d2('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x80d2('0x1')][_0x80d2('0x2')]({'port':0x232b});function request(_0x309b8c,_0x589f51){return new BPromise(function(_0x150483,_0x42d988){return client['request'](_0x309b8c,_0x589f51)[_0x80d2('0x3')](function(_0x386c0c){if(_0x386c0c[_0x80d2('0x4')]){return _0x42d988(_0x386c0c[_0x80d2('0x4')]['message']);}else{return _0x150483(_0x386c0c[_0x80d2('0x5')]);}})[_0x80d2('0x6')](function(_0xce521f){return _0x42d988(_0xce521f);});});}exports[_0x80d2('0x7')]=function(_0x5e2aae,_0x24f28b){return request(_0x80d2('0x8'),{'account':_0x5e2aae,'message':_0x24f28b});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 9db042e..d17c35a 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 _0x25c9=['mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','openchannel','fax','sms','whatsapp','length','Status','StatusTime','format','mailStatusTime','faxStatusTime','smsCurrentCapacity','openchannelStatus','busyQueue','stringify','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x25c9,0x1d9));var _0x925c=function(_0x11dca5,_0x4570ec){_0x11dca5=_0x11dca5-0x0;var _0x3f33c3=_0x25c9[_0x11dca5];return _0x3f33c3;};'use strict';var _=require(_0x925c('0x0'));var moment=require(_0x925c('0x1'));var md5=require(_0x925c('0x2'));var Redis=require(_0x925c('0x3'));var config=require(_0x925c('0x4'));config[_0x925c('0x5')]=_[_0x925c('0x6')](config['redis'],{'host':_0x925c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x925c('0x5')]));function Agent(_0x58010f){this['id']=_0x58010f['id']||0x0;this['name']=_0x58010f[_0x925c('0x8')]||'';this['online']=_0x58010f[_0x925c('0x9')]||!![];this[_0x925c('0xa')]=_0x58010f[_0x925c('0xa')]||![];this[_0x925c('0xb')]=_0x58010f[_0x925c('0xb')]||![];this['mailPause']=_0x58010f[_0x925c('0xc')]||![];this[_0x925c('0xd')]=_0x58010f[_0x925c('0xd')]||![];this['smsPause']=_0x58010f[_0x925c('0xe')]||![];this['openchannelPause']=_0x58010f[_0x925c('0xf')]||![];this[_0x925c('0x10')]=_0x925c('0x11');this[_0x925c('0x12')]=0x0;this[_0x925c('0x13')]=_0x58010f['chatCapacity']||0x0;this[_0x925c('0x14')]=0x0;this[_0x925c('0x15')]=_0x925c('0x11');this['mailStatusTime']=0x0;this[_0x925c('0x16')]=_0x58010f[_0x925c('0x16')]||0x0;this[_0x925c('0x17')]=0x0;this[_0x925c('0x18')]='unknown';this['faxStatusTime']=0x0;this[_0x925c('0x19')]=_0x58010f[_0x925c('0x19')]||0x0;this[_0x925c('0x1a')]=0x0;this[_0x925c('0x1b')]=_0x925c('0x11');this[_0x925c('0x1c')]=0x0;this[_0x925c('0x1d')]=_0x58010f['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x925c('0x1e')]=_0x925c('0x11');this[_0x925c('0x1f')]=0x0;this[_0x925c('0x20')]=_0x58010f[_0x925c('0x20')]||0x0;this[_0x925c('0x21')]=0x0;this['openchannelStatus']=_0x925c('0x11');this[_0x925c('0x22')]=0x0;this[_0x925c('0x23')]=_0x58010f[_0x925c('0x23')]||0x0;this[_0x925c('0x24')]=0x0;this[_0x925c('0x25')]=![];this['busyQueue']=undefined;this['md5']='';this[_0x925c('0x26')]();}Agent[_0x925c('0x27')][_0x925c('0x28')]=function(_0x53e67d){if(this[_0x53e67d+_0x925c('0x29')]>0x0){if(this[_0x53e67d+'Capacity']>0x0&&this[_0x53e67d+_0x925c('0x29')]>=this[_0x53e67d+_0x925c('0x2a')]){return _0x925c('0x2b');}else{return _0x925c('0x2c');}}else{return'idle';}};Agent[_0x925c('0x27')][_0x925c('0x26')]=function(){var _0x32c21f=[_0x925c('0x2d'),'chat',_0x925c('0x2e'),_0x925c('0x2f'),_0x925c('0x30'),_0x925c('0x31')];for(var _0xf6ace2=0x0;_0xf6ace2<_0x32c21f[_0x925c('0x32')];_0xf6ace2+=0x1){var _0x4d8ab4=this[_0x925c('0x28')](_0x32c21f[_0xf6ace2]);if(this[_0x32c21f[_0xf6ace2]+_0x925c('0x33')]!==_0x4d8ab4){this[_0x32c21f[_0xf6ace2]+_0x925c('0x34')]=_['toNumber'](moment()[_0x925c('0x35')]('x'));}this[_0x32c21f[_0xf6ace2]+_0x925c('0x33')]=_0x4d8ab4;}var _0x23cefe={'id':this['id'],'name':this[_0x925c('0x8')],'online':this['online'],'voicePause':this[_0x925c('0xa')],'chatPause':this[_0x925c('0xb')],'mailPause':this[_0x925c('0xc')],'smsPause':this[_0x925c('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0x925c('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x925c('0x13')],'chatCurrentCapacity':this[_0x925c('0x14')],'mailStatus':this[_0x925c('0x15')],'mailStatusTime':this[_0x925c('0x36')],'mailCapacity':this[_0x925c('0x16')],'mailCurrentCapacity':this[_0x925c('0x17')],'faxStatus':this[_0x925c('0x18')],'faxStatusTime':this[_0x925c('0x37')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x925c('0x1a')],'smsStatus':this[_0x925c('0x1b')],'smsStatusTime':this[_0x925c('0x1c')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x925c('0x38')],'whatsappStatus':this[_0x925c('0x1e')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x925c('0x20')],'whatsappCurrentCapacity':this[_0x925c('0x21')],'openchannelStatus':this[_0x925c('0x39')],'openchannelStatusTime':this[_0x925c('0x22')],'openchannelCapacity':this[_0x925c('0x23')],'openchannelCurrentCapacity':this[_0x925c('0x24')],'busy':this[_0x925c('0x25')],'busyQueue':this[_0x925c('0x3a')]};var _0x185430=md5(JSON[_0x925c('0x3b')](_0x23cefe));if(this[_0x925c('0x2')]!==_0x185430){this[_0x925c('0x2')]=_0x185430;io['emit'](_0x925c('0x3c'),_0x23cefe);}};module[_0x925c('0x3d')]=Agent; \ No newline at end of file +var _0xd1d3=['online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity','mailStatus','unknown','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','CurrentCapacity','Capacity','maxcapacity','prototype','chat','sms','whatsapp','getChannelStatus','Status','format','chatStatus','chatStatusTime','chatCurrentCapacity','mailStatusTime','faxStatusTime','openchannelStatusTime','stringify','emit','user:save','exports','moment','md5','defaults','redis','socket.io-emitter','name'];(function(_0x418afd,_0x2cd8e9){var _0x228aa2=function(_0x1e721a){while(--_0x1e721a){_0x418afd['push'](_0x418afd['shift']());}};_0x228aa2(++_0x2cd8e9);}(_0xd1d3,0x68));var _0x3d1d=function(_0x2b5620,_0x3dcc13){_0x2b5620=_0x2b5620-0x0;var _0x1d738d=_0xd1d3[_0x2b5620];return _0x1d738d;};'use strict';var _=require('lodash');var moment=require(_0x3d1d('0x0'));var md5=require(_0x3d1d('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x3d1d('0x2')](config[_0x3d1d('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x3d1d('0x4'))(new Redis(config[_0x3d1d('0x3')]));function Agent(_0x5ed012){this['id']=_0x5ed012['id']||0x0;this[_0x3d1d('0x5')]=_0x5ed012[_0x3d1d('0x5')]||'';this[_0x3d1d('0x6')]=_0x5ed012['online']||!![];this[_0x3d1d('0x7')]=_0x5ed012[_0x3d1d('0x7')]||![];this['chatPause']=_0x5ed012[_0x3d1d('0x8')]||![];this['mailPause']=_0x5ed012[_0x3d1d('0x9')]||![];this['faxPause']=_0x5ed012[_0x3d1d('0xa')]||![];this['smsPause']=_0x5ed012[_0x3d1d('0xb')]||![];this[_0x3d1d('0xc')]=_0x5ed012[_0x3d1d('0xc')]||![];this['chatStatus']='unknown';this['chatStatusTime']=0x0;this['chatCapacity']=_0x5ed012[_0x3d1d('0xd')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x3d1d('0xe')]=_0x3d1d('0xf');this['mailStatusTime']=0x0;this[_0x3d1d('0x10')]=_0x5ed012[_0x3d1d('0x10')]||0x0;this[_0x3d1d('0x11')]=0x0;this[_0x3d1d('0x12')]=_0x3d1d('0xf');this['faxStatusTime']=0x0;this[_0x3d1d('0x13')]=_0x5ed012[_0x3d1d('0x13')]||0x0;this[_0x3d1d('0x14')]=0x0;this[_0x3d1d('0x15')]=_0x3d1d('0xf');this[_0x3d1d('0x16')]=0x0;this[_0x3d1d('0x17')]=_0x5ed012['smsCapacity']||0x0;this[_0x3d1d('0x18')]=0x0;this[_0x3d1d('0x19')]=_0x3d1d('0xf');this[_0x3d1d('0x1a')]=0x0;this[_0x3d1d('0x1b')]=_0x5ed012[_0x3d1d('0x1b')]||0x0;this[_0x3d1d('0x1c')]=0x0;this[_0x3d1d('0x1d')]=_0x3d1d('0xf');this['openchannelStatusTime']=0x0;this[_0x3d1d('0x1e')]=_0x5ed012[_0x3d1d('0x1e')]||0x0;this[_0x3d1d('0x1f')]=0x0;this[_0x3d1d('0x20')]=![];this[_0x3d1d('0x21')]=undefined;this[_0x3d1d('0x1')]='';this[_0x3d1d('0x22')]();}Agent['prototype']['getChannelStatus']=function(_0x38adf8){if(this[_0x38adf8+_0x3d1d('0x23')]>0x0){if(this[_0x38adf8+_0x3d1d('0x24')]>0x0&&this[_0x38adf8+_0x3d1d('0x23')]>=this[_0x38adf8+_0x3d1d('0x24')]){return _0x3d1d('0x25');}else{return'working';}}else{return'idle';}};Agent[_0x3d1d('0x26')]['updateRealtime']=function(){var _0x2b230c=['mail',_0x3d1d('0x27'),'openchannel','fax',_0x3d1d('0x28'),_0x3d1d('0x29')];for(var _0x35f50e=0x0;_0x35f50e<_0x2b230c['length'];_0x35f50e+=0x1){var _0x23ef9d=this[_0x3d1d('0x2a')](_0x2b230c[_0x35f50e]);if(this[_0x2b230c[_0x35f50e]+_0x3d1d('0x2b')]!==_0x23ef9d){this[_0x2b230c[_0x35f50e]+'StatusTime']=_['toNumber'](moment()[_0x3d1d('0x2c')]('x'));}this[_0x2b230c[_0x35f50e]+_0x3d1d('0x2b')]=_0x23ef9d;}var _0x155486={'id':this['id'],'name':this[_0x3d1d('0x5')],'online':this[_0x3d1d('0x6')],'voicePause':this[_0x3d1d('0x7')],'chatPause':this['chatPause'],'mailPause':this[_0x3d1d('0x9')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x3d1d('0x2d')],'chatStatusTime':this[_0x3d1d('0x2e')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x3d1d('0x2f')],'mailStatus':this[_0x3d1d('0xe')],'mailStatusTime':this[_0x3d1d('0x30')],'mailCapacity':this[_0x3d1d('0x10')],'mailCurrentCapacity':this[_0x3d1d('0x11')],'faxStatus':this[_0x3d1d('0x12')],'faxStatusTime':this[_0x3d1d('0x31')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x3d1d('0x14')],'smsStatus':this[_0x3d1d('0x15')],'smsStatusTime':this[_0x3d1d('0x16')],'smsCapacity':this[_0x3d1d('0x17')],'smsCurrentCapacity':this[_0x3d1d('0x18')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x3d1d('0x1a')],'whatsappCapacity':this[_0x3d1d('0x1b')],'whatsappCurrentCapacity':this[_0x3d1d('0x1c')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x3d1d('0x32')],'openchannelCapacity':this[_0x3d1d('0x1e')],'openchannelCurrentCapacity':this[_0x3d1d('0x1f')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x5ee9d3=md5(JSON[_0x3d1d('0x33')](_0x155486));if(this['md5']!==_0x5ee9d3){this[_0x3d1d('0x1')]=_0x5ee9d3;io[_0x3d1d('0x34')](_0x3d1d('0x35'),_0x155486);}};module[_0x3d1d('0x36')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 201c200..b74d72e 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 _0x75b0=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','_rr','map','prototype','paused','length','online','loggedIn','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x31c051,_0x516f22){var _0x42f3e8=function(_0x21eecd){while(--_0x21eecd){_0x31c051['push'](_0x31c051['shift']());}};_0x42f3e8(++_0x516f22);}(_0x75b0,0xe7));var _0x075b=function(_0x17d761,_0x37e416){_0x17d761=_0x17d761-0x0;var _0x183e8f=_0x75b0[_0x17d761];return _0x183e8f;};'use strict';var _=require(_0x075b('0x0'));var md5=require(_0x075b('0x1'));var util=require(_0x075b('0x2'));var Redis=require(_0x075b('0x3'));var config=require('../../../config/environment');config[_0x075b('0x4')]=_[_0x075b('0x5')](config[_0x075b('0x4')],{'host':_0x075b('0x6'),'port':0x18eb});var io=require(_0x075b('0x7'))(new Redis(config[_0x075b('0x4')]));function ChatQueue(_0x4eb1a3){this['id']=_0x4eb1a3['id']||0x0;this[_0x075b('0x8')]=_0x4eb1a3['name']||'';this[_0x075b('0x9')]=_0x4eb1a3[_0x075b('0x9')]||0xa;this[_0x075b('0xa')]=_0x4eb1a3[_0x075b('0xa')]||_0x075b('0xb');this[_0x075b('0xc')]=_0x4eb1a3[_0x075b('0xc')];this[_0x075b('0xd')]={};this[_0x075b('0xe')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}ChatQueue['prototype']['updateRouting']=function(){var _0x170943=this['mapAgentsId'][_0x075b('0xf')];this[_0x075b('0xd')]=_[_0x075b('0x10')](this[_0x075b('0xc')],'id');this['mapAgentsId'][_0x075b('0xf')]=_0x170943;};ChatQueue[_0x075b('0x11')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x075b('0x12')]=0x0;for(var _0x374ee2=0x0;_0x374ee2=0x0?this['available']:0x0;var _0x4448a7={'id':this['id'],'available':this[_0x075b('0x17')],'loggedIn':this[_0x075b('0x15')],'name':this['name'],'paused':this[_0x075b('0x12')],'waiting':this[_0x075b('0xe')]};var _0x5d5740=md5(JSON[_0x075b('0x18')](_0x4448a7));if(this['md5']!==_0x5d5740){this[_0x075b('0x1')]=_0x5d5740;io['to'](util[_0x075b('0x19')](_0x075b('0x1a'),_0x4448a7[_0x075b('0x8')]))[_0x075b('0x1b')](_0x075b('0x1c'),_0x4448a7);}};module[_0x075b('0x1d')]=ChatQueue; \ No newline at end of file +var _0xec00=['lodash','util','ioredis','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','chatPause','available','format','chat:queue:%s','emit','chat_queue:save','exports'];(function(_0x24d777,_0x22ec88){var _0x135b9b=function(_0x113ad2){while(--_0x113ad2){_0x24d777['push'](_0x24d777['shift']());}};_0x135b9b(++_0x22ec88);}(_0xec00,0x10e));var _0x0ec0=function(_0x200aa5,_0x197802){_0x200aa5=_0x200aa5-0x0;var _0x458200=_0xec00[_0x200aa5];return _0x458200;};'use strict';var _=require(_0x0ec0('0x0'));var md5=require('md5');var util=require(_0x0ec0('0x1'));var Redis=require(_0x0ec0('0x2'));var config=require('../../../config/environment');config[_0x0ec0('0x3')]=_['defaults'](config[_0x0ec0('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0ec0('0x3')]));function ChatQueue(_0x1178d8){this['id']=_0x1178d8['id']||0x0;this['name']=_0x1178d8[_0x0ec0('0x4')]||'';this[_0x0ec0('0x5')]=_0x1178d8[_0x0ec0('0x5')]||0xa;this[_0x0ec0('0x6')]=_0x1178d8[_0x0ec0('0x6')]||_0x0ec0('0x7');this['Agents']=_0x1178d8[_0x0ec0('0x8')];this[_0x0ec0('0x9')]={};this[_0x0ec0('0xa')]=0x0;this[_0x0ec0('0xb')]='';this[_0x0ec0('0xc')]();this[_0x0ec0('0xd')]();}ChatQueue['prototype'][_0x0ec0('0xc')]=function(){var _0x475ce2=this[_0x0ec0('0x9')][_0x0ec0('0xe')];this[_0x0ec0('0x9')]=_[_0x0ec0('0xf')](this['Agents'],'id');this[_0x0ec0('0x9')]['_rr']=_0x475ce2;};ChatQueue[_0x0ec0('0x10')][_0x0ec0('0xd')]=function(){this[_0x0ec0('0x11')]=0x0;this[_0x0ec0('0x12')]=0x0;for(var _0x53781c=0x0;_0x53781c=0x0?this[_0x0ec0('0x15')]:0x0;var _0x2ed661={'id':this['id'],'available':this[_0x0ec0('0x15')],'loggedIn':this[_0x0ec0('0x11')],'name':this[_0x0ec0('0x4')],'paused':this[_0x0ec0('0x12')],'waiting':this[_0x0ec0('0xa')]};var _0x885ef8=md5(JSON['stringify'](_0x2ed661));if(this[_0x0ec0('0xb')]!==_0x885ef8){this[_0x0ec0('0xb')]=_0x885ef8;io['to'](util[_0x0ec0('0x16')](_0x0ec0('0x17'),_0x2ed661[_0x0ec0('0x4')]))[_0x0ec0('0x18')](_0x0ec0('0x19'),_0x2ed661);}};module[_0x0ec0('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 006454a..5bc9845 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 _0x6688=['updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','faxPause','available','paused','waiting','stringify','format','fax:queue:%s','emit','fax_queue:save','md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0xfbca6e,_0x2f8484){var _0x44cb48=function(_0x103d04){while(--_0x103d04){_0xfbca6e['push'](_0xfbca6e['shift']());}};_0x44cb48(++_0x2f8484);}(_0x6688,0x1a6));var _0x8668=function(_0x252d3a,_0xb79553){_0x252d3a=_0x252d3a-0x0;var _0x13f261=_0x6688[_0x252d3a];return _0x13f261;};'use strict';var _=require('lodash');var md5=require(_0x8668('0x0'));var util=require(_0x8668('0x1'));var Redis=require(_0x8668('0x2'));var config=require(_0x8668('0x3'));config['redis']=_[_0x8668('0x4')](config[_0x8668('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x8668('0x6'))(new Redis(config[_0x8668('0x5')]));function FaxQueue(_0x268126){this['id']=_0x268126['id']||0x0;this['name']=_0x268126[_0x8668('0x7')]||'';this[_0x8668('0x8')]=_0x268126[_0x8668('0x8')]||0xa;this[_0x8668('0x9')]=_0x268126[_0x8668('0x9')]||_0x8668('0xa');this['Agents']=_0x268126[_0x8668('0xb')];this[_0x8668('0xc')]={};this['waiting']=0x0;this[_0x8668('0x0')]='';this[_0x8668('0xd')]();this['updateRealtime']();}FaxQueue[_0x8668('0xe')][_0x8668('0xd')]=function(){var _0xe41daf=this[_0x8668('0xc')][_0x8668('0xf')];this[_0x8668('0xc')]=_[_0x8668('0x10')](this[_0x8668('0xb')],'id');this[_0x8668('0xc')][_0x8668('0xf')]=_0xe41daf;};FaxQueue[_0x8668('0xe')][_0x8668('0x11')]=function(){this[_0x8668('0x12')]=0x0;this['paused']=0x0;for(var _0x5457e7=0x0;_0x5457e7=0x0?this[_0x8668('0x15')]:0x0;var _0x4e31b1={'id':this['id'],'available':this[_0x8668('0x15')],'loggedIn':this[_0x8668('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x8668('0x17')]};var _0x2c33c=md5(JSON[_0x8668('0x18')](_0x4e31b1));if(this[_0x8668('0x0')]!==_0x2c33c){this[_0x8668('0x0')]=_0x2c33c;io['to'](util[_0x8668('0x19')](_0x8668('0x1a'),_0x4e31b1[_0x8668('0x7')]))[_0x8668('0x1b')](_0x8668('0x1c'),_0x4e31b1);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x8b07=['emit','fax_queue:save','lodash','md5','util','ioredis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','online','available','stringify','format','fax:queue:%s'];(function(_0x59504c,_0x227955){var _0x85648=function(_0x5797ce){while(--_0x5797ce){_0x59504c['push'](_0x59504c['shift']());}};_0x85648(++_0x227955);}(_0x8b07,0xfe));var _0x78b0=function(_0x529063,_0x28e6fe){_0x529063=_0x529063-0x0;var _0x2164da=_0x8b07[_0x529063];return _0x2164da;};'use strict';var _=require(_0x78b0('0x0'));var md5=require(_0x78b0('0x1'));var util=require(_0x78b0('0x2'));var Redis=require(_0x78b0('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x78b0('0x4')](config['redis'],{'host':_0x78b0('0x5'),'port':0x18eb});var io=require(_0x78b0('0x6'))(new Redis(config['redis']));function FaxQueue(_0x16781a){this['id']=_0x16781a['id']||0x0;this[_0x78b0('0x7')]=_0x16781a['name']||'';this[_0x78b0('0x8')]=_0x16781a[_0x78b0('0x8')]||0xa;this['strategy']=_0x16781a[_0x78b0('0x9')]||_0x78b0('0xa');this[_0x78b0('0xb')]=_0x16781a[_0x78b0('0xb')];this[_0x78b0('0xc')]={};this[_0x78b0('0xd')]=0x0;this[_0x78b0('0x1')]='';this[_0x78b0('0xe')]();this[_0x78b0('0xf')]();}FaxQueue['prototype'][_0x78b0('0xe')]=function(){var _0x695b14=this[_0x78b0('0xc')]['_rr'];this[_0x78b0('0xc')]=_['map'](this[_0x78b0('0xb')],'id');this[_0x78b0('0xc')][_0x78b0('0x10')]=_0x695b14;};FaxQueue[_0x78b0('0x11')]['updateRealtime']=function(){this[_0x78b0('0x12')]=0x0;this[_0x78b0('0x13')]=0x0;for(var _0x43c490=0x0;_0x43c490=0x0?this[_0x78b0('0x16')]:0x0;var _0x4077ed={'id':this['id'],'available':this[_0x78b0('0x16')],'loggedIn':this[_0x78b0('0x12')],'name':this[_0x78b0('0x7')],'paused':this[_0x78b0('0x13')],'waiting':this[_0x78b0('0xd')]};var _0xd64694=md5(JSON[_0x78b0('0x17')](_0x4077ed));if(this['md5']!==_0xd64694){this[_0x78b0('0x1')]=_0xd64694;io['to'](util[_0x78b0('0x18')](_0x78b0('0x19'),_0x4077ed[_0x78b0('0x7')]))[_0x78b0('0x1a')](_0x78b0('0x1b'),_0x4077ed);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 9427d66..75fc05c 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 _0xbe60=['name','Intervals','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe60,0xab));var _0x0be6=function(_0x48f17c,_0x2f480c){_0x48f17c=_0x48f17c-0x0;var _0x1bfd30=_0xbe60[_0x48f17c];return _0x1bfd30;};'use strict';function Interval(_0x1b50c5){this['id']=_0x1b50c5['id']||0x0;this['name']=_0x1b50c5[_0x0be6('0x0')]||'';this['Intervals']=_0x1b50c5[_0x0be6('0x1')]||{};}module[_0x0be6('0x2')]=Interval; \ No newline at end of file +var _0x32e9=['name','Intervals','exports'];(function(_0x1d4449,_0x495153){var _0x4dcde3=function(_0x36d549){while(--_0x36d549){_0x1d4449['push'](_0x1d4449['shift']());}};_0x4dcde3(++_0x495153);}(_0x32e9,0x12f));var _0x932e=function(_0xb65f0c,_0xe60c57){_0xb65f0c=_0xb65f0c-0x0;var _0x2ff246=_0x32e9[_0xb65f0c];return _0x2ff246;};'use strict';function Interval(_0xdde0ec){this['id']=_0xdde0ec['id']||0x0;this[_0x932e('0x0')]=_0xdde0ec['name']||'';this[_0x932e('0x1')]=_0xdde0ec['Intervals']||{};}module[_0x932e('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 9f33f36..29e6aa0 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 _0x0842=['mail_queue:save','lodash','util','../../../config/environment','defaults','redis','localhost','name','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr','map','Agents','prototype','paused','loggedIn','available','format','mail:queue:%s'];(function(_0x5c2a2b,_0x22c94e){var _0x19921f=function(_0x3fb937){while(--_0x3fb937){_0x5c2a2b['push'](_0x5c2a2b['shift']());}};_0x19921f(++_0x22c94e);}(_0x0842,0xfe));var _0x2084=function(_0x2d758e,_0x2bd153){_0x2d758e=_0x2d758e-0x0;var _0x2ea733=_0x0842[_0x2d758e];return _0x2ea733;};'use strict';var _=require(_0x2084('0x0'));var md5=require('md5');var util=require(_0x2084('0x1'));var Redis=require('ioredis');var config=require(_0x2084('0x2'));config['redis']=_[_0x2084('0x3')](config[_0x2084('0x4')],{'host':_0x2084('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2084('0x4')]));function MailQueue(_0x150284){this['id']=_0x150284['id']||0x0;this[_0x2084('0x6')]=_0x150284[_0x2084('0x6')]||'';this['timeout']=_0x150284['timeout']||0xa;this[_0x2084('0x7')]=_0x150284['strategy']||'beepall';this['Agents']=_0x150284['Agents'];this[_0x2084('0x8')]={};this[_0x2084('0x9')]=0x0;this[_0x2084('0xa')]='';this[_0x2084('0xb')]();this[_0x2084('0xc')]();}MailQueue['prototype'][_0x2084('0xb')]=function(){var _0x300699=this[_0x2084('0x8')][_0x2084('0xd')];this[_0x2084('0x8')]=_[_0x2084('0xe')](this[_0x2084('0xf')],'id');this[_0x2084('0x8')]['_rr']=_0x300699;};MailQueue[_0x2084('0x10')][_0x2084('0xc')]=function(){this['loggedIn']=0x0;this[_0x2084('0x11')]=0x0;for(var _0x40b971=0x0;_0x40b971=0x0?this[_0x2084('0x13')]:0x0;var _0x20cfc2={'id':this['id'],'available':this[_0x2084('0x13')],'loggedIn':this[_0x2084('0x12')],'name':this[_0x2084('0x6')],'paused':this[_0x2084('0x11')],'waiting':this[_0x2084('0x9')]};var _0x58e26b=md5(JSON['stringify'](_0x20cfc2));if(this['md5']!==_0x58e26b){this[_0x2084('0xa')]=_0x58e26b;io['to'](util[_0x2084('0x14')](_0x2084('0x15'),_0x20cfc2['name']))['emit'](_0x2084('0x16'),_0x20cfc2);}};module['exports']=MailQueue; \ No newline at end of file +var _0x82f5=['strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','online','available','stringify','format','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x82f5,0x15e));var _0x582f=function(_0x3a8b75,_0x38e6f1){_0x3a8b75=_0x3a8b75-0x0;var _0x3e701d=_0x82f5[_0x3a8b75];return _0x3e701d;};'use strict';var _=require(_0x582f('0x0'));var md5=require(_0x582f('0x1'));var util=require(_0x582f('0x2'));var Redis=require(_0x582f('0x3'));var config=require(_0x582f('0x4'));config[_0x582f('0x5')]=_[_0x582f('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x582f('0x7'))(new Redis(config['redis']));function MailQueue(_0x594b8a){this['id']=_0x594b8a['id']||0x0;this[_0x582f('0x8')]=_0x594b8a[_0x582f('0x8')]||'';this[_0x582f('0x9')]=_0x594b8a[_0x582f('0x9')]||0xa;this['strategy']=_0x594b8a[_0x582f('0xa')]||_0x582f('0xb');this['Agents']=_0x594b8a[_0x582f('0xc')];this['mapAgentsId']={};this[_0x582f('0xd')]=0x0;this[_0x582f('0x1')]='';this[_0x582f('0xe')]();this[_0x582f('0xf')]();}MailQueue['prototype'][_0x582f('0xe')]=function(){var _0x17134c=this[_0x582f('0x10')][_0x582f('0x11')];this[_0x582f('0x10')]=_[_0x582f('0x12')](this[_0x582f('0xc')],'id');this[_0x582f('0x10')][_0x582f('0x11')]=_0x17134c;};MailQueue[_0x582f('0x13')][_0x582f('0xf')]=function(){this[_0x582f('0x14')]=0x0;this[_0x582f('0x15')]=0x0;for(var _0x5c1d8a=0x0;_0x5c1d8a=0x0?this[_0x582f('0x18')]:0x0;var _0xe2c078={'id':this['id'],'available':this['available'],'loggedIn':this[_0x582f('0x14')],'name':this['name'],'paused':this[_0x582f('0x15')],'waiting':this[_0x582f('0xd')]};var _0x33a79c=md5(JSON[_0x582f('0x19')](_0xe2c078));if(this[_0x582f('0x1')]!==_0x33a79c){this[_0x582f('0x1')]=_0x33a79c;io['to'](util[_0x582f('0x1a')]('mail:queue:%s',_0xe2c078[_0x582f('0x8')]))[_0x582f('0x1b')](_0x582f('0x1c'),_0xe2c078);}};module[_0x582f('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 51aa8f5..a5c322d 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 _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(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x326f,0xd1));var _0xf326=function(_0x5ea4bd,_0xb03b28){_0x5ea4bd=_0x5ea4bd-0x0;var _0x1b4079=_0x326f[_0x5ea4bd];return _0x1b4079;};'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 +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0xe60800,_0x4e59d1){var _0x46623c=function(_0x47c169){while(--_0x47c169){_0xe60800['push'](_0xe60800['shift']());}};_0x46623c(++_0x4e59d1);}(_0x814b,0x1a2));var _0xb814=function(_0x42bb6d,_0x412255){_0x42bb6d=_0x42bb6d-0x0;var _0x1db89b=_0x814b[_0x42bb6d];return _0x1db89b;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 67825c2..cbb6059 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 _0xac31=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length','online','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac31,0xca));var _0x1ac3=function(_0x2ec8a7,_0x34fae5){_0x2ec8a7=_0x2ec8a7-0x0;var _0xd4219c=_0xac31[_0x2ec8a7];return _0xd4219c;};'use strict';var _=require(_0x1ac3('0x0'));var md5=require(_0x1ac3('0x1'));var util=require(_0x1ac3('0x2'));var Redis=require(_0x1ac3('0x3'));var config=require(_0x1ac3('0x4'));config[_0x1ac3('0x5')]=_[_0x1ac3('0x6')](config['redis'],{'host':_0x1ac3('0x7'),'port':0x18eb});var io=require(_0x1ac3('0x8'))(new Redis(config['redis']));function SmsQueue(_0x5ef1b6){this['id']=_0x5ef1b6['id']||0x0;this[_0x1ac3('0x9')]=_0x5ef1b6[_0x1ac3('0x9')]||'';this[_0x1ac3('0xa')]=_0x5ef1b6[_0x1ac3('0xa')]||0xa;this[_0x1ac3('0xb')]=_0x5ef1b6['strategy']||_0x1ac3('0xc');this['Agents']=_0x5ef1b6[_0x1ac3('0xd')];this[_0x1ac3('0xe')]={};this[_0x1ac3('0xf')]=0x0;this['md5']='';this[_0x1ac3('0x10')]();this[_0x1ac3('0x11')]();}SmsQueue[_0x1ac3('0x12')][_0x1ac3('0x10')]=function(){var _0x2a8dc7=this[_0x1ac3('0xe')]['_rr'];this[_0x1ac3('0xe')]=_[_0x1ac3('0x13')](this[_0x1ac3('0xd')],'id');this[_0x1ac3('0xe')]['_rr']=_0x2a8dc7;};SmsQueue[_0x1ac3('0x12')][_0x1ac3('0x11')]=function(){this[_0x1ac3('0x14')]=0x0;this[_0x1ac3('0x15')]=0x0;for(var _0x53cc35=0x0;_0x53cc35=0x0?this[_0x1ac3('0x18')]:0x0;var _0x1e1280={'id':this['id'],'available':this[_0x1ac3('0x18')],'loggedIn':this[_0x1ac3('0x14')],'name':this[_0x1ac3('0x9')],'paused':this['paused'],'waiting':this[_0x1ac3('0xf')]};var _0x2ea481=md5(JSON[_0x1ac3('0x19')](_0x1e1280));if(this[_0x1ac3('0x1')]!==_0x2ea481){this['md5']=_0x2ea481;io['to'](util['format'](_0x1ac3('0x1a'),_0x1e1280[_0x1ac3('0x9')]))[_0x1ac3('0x1b')](_0x1ac3('0x1c'),_0x1e1280);}};module[_0x1ac3('0x1d')]=SmsQueue; \ No newline at end of file +var _0xc2cc=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','Agents','paused','loggedIn','smsPause','available','name','stringify','sms_queue:save','exports','md5','util','ioredis','redis','socket.io-emitter','timeout','strategy','beepall'];(function(_0x72b0ab,_0x2c42e0){var _0xc8b77f=function(_0x55fd65){while(--_0x55fd65){_0x72b0ab['push'](_0x72b0ab['shift']());}};_0xc8b77f(++_0x2c42e0);}(_0xc2cc,0x70));var _0xcc2c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc2cc[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var md5=require(_0xcc2c('0x0'));var util=require(_0xcc2c('0x1'));var Redis=require(_0xcc2c('0x2'));var config=require('../../../config/environment');config[_0xcc2c('0x3')]=_['defaults'](config[_0xcc2c('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xcc2c('0x4'))(new Redis(config['redis']));function SmsQueue(_0x342a00){this['id']=_0x342a00['id']||0x0;this['name']=_0x342a00['name']||'';this[_0xcc2c('0x5')]=_0x342a00['timeout']||0xa;this[_0xcc2c('0x6')]=_0x342a00['strategy']||_0xcc2c('0x7');this['Agents']=_0x342a00['Agents'];this[_0xcc2c('0x8')]={};this[_0xcc2c('0x9')]=0x0;this[_0xcc2c('0x0')]='';this[_0xcc2c('0xa')]();this[_0xcc2c('0xb')]();}SmsQueue[_0xcc2c('0xc')][_0xcc2c('0xa')]=function(){var _0x1c18a8=this['mapAgentsId'][_0xcc2c('0xd')];this['mapAgentsId']=_[_0xcc2c('0xe')](this[_0xcc2c('0xf')],'id');this[_0xcc2c('0x8')][_0xcc2c('0xd')]=_0x1c18a8;};SmsQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xcc2c('0x10')]=0x0;for(var _0xc1cafd=0x0;_0xc1cafd=0x0?this[_0xcc2c('0x13')]:0x0;var _0x285deb={'id':this['id'],'available':this[_0xcc2c('0x13')],'loggedIn':this[_0xcc2c('0x11')],'name':this[_0xcc2c('0x14')],'paused':this[_0xcc2c('0x10')],'waiting':this[_0xcc2c('0x9')]};var _0x5a1f0a=md5(JSON[_0xcc2c('0x15')](_0x285deb));if(this[_0xcc2c('0x0')]!==_0x5a1f0a){this['md5']=_0x5a1f0a;io['to'](util['format']('sms:queue:%s',_0x285deb[_0xcc2c('0x14')]))['emit'](_0xcc2c('0x16'),_0x285deb);}};module[_0xcc2c('0x17')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 7a0f40a..b83df38 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 _0x7bfc=['emit','exports','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','whatsappPause','available','paused','waiting','stringify','whatsapp:queue:%s'];(function(_0x5d8604,_0x2c98c5){var _0x9da588=function(_0x2027bd){while(--_0x2027bd){_0x5d8604['push'](_0x5d8604['shift']());}};_0x9da588(++_0x2c98c5);}(_0x7bfc,0x1b2));var _0xc7bf=function(_0x17032c,_0x16d341){_0x17032c=_0x17032c-0x0;var _0x1bb077=_0x7bfc[_0x17032c];return _0x1bb077;};'use strict';var _=require(_0xc7bf('0x0'));var md5=require(_0xc7bf('0x1'));var util=require(_0xc7bf('0x2'));var Redis=require(_0xc7bf('0x3'));var config=require('../../../config/environment');config[_0xc7bf('0x4')]=_[_0xc7bf('0x5')](config[_0xc7bf('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xc7bf('0x6'))(new Redis(config[_0xc7bf('0x4')]));function WhatsappQueue(_0x26e7ea){this['id']=_0x26e7ea['id']||0x0;this[_0xc7bf('0x7')]=_0x26e7ea[_0xc7bf('0x7')]||'';this['timeout']=_0x26e7ea[_0xc7bf('0x8')]||0xa;this[_0xc7bf('0x9')]=_0x26e7ea[_0xc7bf('0x9')]||_0xc7bf('0xa');this[_0xc7bf('0xb')]=_0x26e7ea['Agents'];this[_0xc7bf('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0xc7bf('0xd')]();this[_0xc7bf('0xe')]();}WhatsappQueue[_0xc7bf('0xf')][_0xc7bf('0xd')]=function(){var _0x2e4b40=this[_0xc7bf('0xc')][_0xc7bf('0x10')];this[_0xc7bf('0xc')]=_['map'](this[_0xc7bf('0xb')],'id');this[_0xc7bf('0xc')][_0xc7bf('0x10')]=_0x2e4b40;};WhatsappQueue[_0xc7bf('0xf')]['updateRealtime']=function(){this[_0xc7bf('0x11')]=0x0;this['paused']=0x0;for(var _0x19d667=0x0;_0x19d667=0x0?this[_0xc7bf('0x14')]:0x0;var _0x7ae2cc={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xc7bf('0x7')],'paused':this[_0xc7bf('0x15')],'waiting':this[_0xc7bf('0x16')]};var _0x16ca1b=md5(JSON[_0xc7bf('0x17')](_0x7ae2cc));if(this[_0xc7bf('0x1')]!==_0x16ca1b){this['md5']=_0x16ca1b;io['to'](util['format'](_0xc7bf('0x18'),_0x7ae2cc[_0xc7bf('0x7')]))[_0xc7bf('0x19')]('whatsapp_queue:save',_0x7ae2cc);}};module[_0xc7bf('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0x1cc6=['available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','whatsappPause'];(function(_0x526298,_0x2ec3ba){var _0x467835=function(_0x32d027){while(--_0x32d027){_0x526298['push'](_0x526298['shift']());}};_0x467835(++_0x2ec3ba);}(_0x1cc6,0x1c6));var _0x61cc=function(_0x258919,_0x1754e6){_0x258919=_0x258919-0x0;var _0xfbd68b=_0x1cc6[_0x258919];return _0xfbd68b;};'use strict';var _=require(_0x61cc('0x0'));var md5=require(_0x61cc('0x1'));var util=require(_0x61cc('0x2'));var Redis=require(_0x61cc('0x3'));var config=require(_0x61cc('0x4'));config['redis']=_[_0x61cc('0x5')](config[_0x61cc('0x6')],{'host':_0x61cc('0x7'),'port':0x18eb});var io=require(_0x61cc('0x8'))(new Redis(config[_0x61cc('0x6')]));function WhatsappQueue(_0x1f7ed9){this['id']=_0x1f7ed9['id']||0x0;this[_0x61cc('0x9')]=_0x1f7ed9[_0x61cc('0x9')]||'';this[_0x61cc('0xa')]=_0x1f7ed9[_0x61cc('0xa')]||0xa;this[_0x61cc('0xb')]=_0x1f7ed9[_0x61cc('0xb')]||_0x61cc('0xc');this[_0x61cc('0xd')]=_0x1f7ed9[_0x61cc('0xd')];this[_0x61cc('0xe')]={};this[_0x61cc('0xf')]=0x0;this[_0x61cc('0x1')]='';this[_0x61cc('0x10')]();this[_0x61cc('0x11')]();}WhatsappQueue[_0x61cc('0x12')]['updateRouting']=function(){var _0xafcd64=this[_0x61cc('0xe')][_0x61cc('0x13')];this[_0x61cc('0xe')]=_[_0x61cc('0x14')](this[_0x61cc('0xd')],'id');this[_0x61cc('0xe')][_0x61cc('0x13')]=_0xafcd64;};WhatsappQueue[_0x61cc('0x12')][_0x61cc('0x11')]=function(){this['loggedIn']=0x0;this[_0x61cc('0x15')]=0x0;for(var _0xbc9bed=0x0;_0xbc9bed=0x0?this[_0x61cc('0x1a')]:0x0;var _0x55da4f={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x61cc('0x15')],'waiting':this['waiting']};var _0x11e583=md5(JSON['stringify'](_0x55da4f));if(this[_0x61cc('0x1')]!==_0x11e583){this[_0x61cc('0x1')]=_0x11e583;io['to'](util[_0x61cc('0x1b')](_0x61cc('0x1c'),_0x55da4f[_0x61cc('0x9')]))[_0x61cc('0x1d')](_0x61cc('0x1e'),_0x55da4f);}};module[_0x61cc('0x1f')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 39142f3..1f47805 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 9667667..929043e 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 _0x0aec=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x2219c9,_0x92d9ee){var _0x477119=function(_0x41a74b){while(--_0x41a74b){_0x2219c9['push'](_0x2219c9['shift']());}};_0x477119(++_0x92d9ee);}(_0x0aec,0x1a3));var _0xc0ae=function(_0x1f29cd,_0x4901d2){_0x1f29cd=_0x1f29cd-0x0;var _0x54a357=_0x0aec[_0x1f29cd];return _0x54a357;};'use strict';var client=require(_0xc0ae('0x0'));exports[_0xc0ae('0x1')]=function(_0x254fb7,_0x2592f1){return client[_0xc0ae('0x2')](_0xc0ae('0x3'),{'body':_0x2592f1,'options':{'where':{'id':_0x254fb7}},'log':_0xc0ae('0x4')});};exports[_0xc0ae('0x5')]=function(_0x235b48,_0x4488ff){return client[_0xc0ae('0x2')]('AddTagsToChatInteraction',{'body':_0x4488ff,'options':{'where':{'id':_0x235b48}},'log':_0xc0ae('0x6')});}; \ No newline at end of file +var _0x23b4=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction','Request'];(function(_0xca1105,_0x5eeb3f){var _0x4fe8de=function(_0x21c088){while(--_0x21c088){_0xca1105['push'](_0xca1105['shift']());}};_0x4fe8de(++_0x5eeb3f);}(_0x23b4,0xaa));var _0x423b=function(_0x5c10fc,_0x1116d9){_0x5c10fc=_0x5c10fc-0x0;var _0x44391b=_0x23b4[_0x5c10fc];return _0x44391b;};'use strict';var client=require(_0x423b('0x0'));exports[_0x423b('0x1')]=function(_0x3d1ac6,_0xe2a6f8){return client['Request'](_0x423b('0x2'),{'body':_0xe2a6f8,'options':{'where':{'id':_0x3d1ac6}},'log':_0x423b('0x3')});};exports['addTags']=function(_0x58917c,_0xf163d0){return client[_0x423b('0x4')](_0x423b('0x5'),{'body':_0xf163d0,'options':{'where':{'id':_0x58917c}},'log':_0x423b('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 5d338a7..5b66fae 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 _0x5b32=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x477503,_0x2f14eb){var _0x50df07=function(_0x599c52){while(--_0x599c52){_0x477503['push'](_0x477503['shift']());}};_0x50df07(++_0x2f14eb);}(_0x5b32,0x8b));var _0x25b3=function(_0x44c253,_0x6a8eb7){_0x44c253=_0x44c253-0x0;var _0x1db89a=_0x5b32[_0x44c253];return _0x1db89a;};'use strict';var client=require(_0x25b3('0x0'));exports[_0x25b3('0x1')]=function(_0x3c25d3){return client[_0x25b3('0x2')](_0x25b3('0x3'),{'body':_0x3c25d3,'log':_0x25b3('0x4')});}; \ No newline at end of file +var _0x106a=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x106a,0x87));var _0xa106=function(_0x47c5bd,_0x7605da){_0x47c5bd=_0x47c5bd-0x0;var _0x2447dc=_0x106a[_0x47c5bd];return _0x2447dc;};'use strict';var client=require(_0xa106('0x0'));exports[_0xa106('0x1')]=function(_0x3623d9){return client[_0xa106('0x2')](_0xa106('0x3'),{'body':_0x3623d9,'log':_0xa106('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 56fdf70..75a2d1f 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 _0x7f90=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','User','Agents','online'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7f90,0xf4));var _0x07f9=function(_0xa23369,_0x1b7895){_0xa23369=_0xa23369-0x0;var _0x48b0e2=_0x7f90[_0xa23369];return _0x48b0e2;};'use strict';var client=require(_0x07f9('0x0'));exports[_0x07f9('0x1')]=function(){return function(){return client[_0x07f9('0x2')](_0x07f9('0x3'),{'options':{'raw':![],'attributes':['id',_0x07f9('0x4'),'timeout','strategy'],'include':[{'model':_0x07f9('0x5'),'as':_0x07f9('0x6'),'attributes':['id','name',_0x07f9('0x7'),_0x07f9('0x8')]}]},'log':_0x07f9('0x1')});};}; \ No newline at end of file +var _0x7c8e=['getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents','online','chatPause'];(function(_0x3bae98,_0x3aaee4){var _0x52b8f2=function(_0x408118){while(--_0x408118){_0x3bae98['push'](_0x3bae98['shift']());}};_0x52b8f2(++_0x3aaee4);}(_0x7c8e,0x10e));var _0xe7c8=function(_0x4a8418,_0x39078a){_0x4a8418=_0x4a8418-0x0;var _0x390174=_0x7c8e[_0x4a8418];return _0x390174;};'use strict';var client=require('../client');exports[_0xe7c8('0x0')]=function(){return function(){return client[_0xe7c8('0x1')](_0xe7c8('0x2'),{'options':{'raw':![],'attributes':['id',_0xe7c8('0x3'),_0xe7c8('0x4'),_0xe7c8('0x5')],'include':[{'model':_0xe7c8('0x6'),'as':_0xe7c8('0x7'),'attributes':['id',_0xe7c8('0x3'),_0xe7c8('0x8'),_0xe7c8('0x9')]}]},'log':_0xe7c8('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 457b083..89e3132 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 _0x5ab4=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x44c742,_0x5d69a4){var _0x40fcf0=function(_0x453d3c){while(--_0x453d3c){_0x44c742['push'](_0x44c742['shift']());}};_0x40fcf0(++_0x5d69a4);}(_0x5ab4,0x9f));var _0x45ab=function(_0x2dd109,_0x49ca5b){_0x2dd109=_0x2dd109-0x0;var _0x4bf04c=_0x5ab4[_0x2dd109];return _0x4bf04c;};'use strict';var client=require(_0x45ab('0x0'));exports[_0x45ab('0x1')]=function(_0x17df82){return client[_0x45ab('0x2')](_0x45ab('0x3'),{'body':_0x17df82,'log':'CreateChatQueueReport'});};exports[_0x45ab('0x4')]=function(_0x2d0e3b,_0x3d5dbd){return client[_0x45ab('0x2')](_0x45ab('0x5'),{'body':_0x3d5dbd,'options':{'where':{'uniqueid':_0x2d0e3b},'order':[['id',_0x45ab('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xc9b7=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x398792,_0x5c85e1){var _0x1623b2=function(_0x514603){while(--_0x514603){_0x398792['push'](_0x398792['shift']());}};_0x1623b2(++_0x5c85e1);}(_0xc9b7,0x1ab));var _0x7c9b=function(_0x135b81,_0x39db4b){_0x135b81=_0x135b81-0x0;var _0x5d8a8e=_0xc9b7[_0x135b81];return _0x5d8a8e;};'use strict';var client=require(_0x7c9b('0x0'));exports[_0x7c9b('0x1')]=function(_0x19e4f4){return client[_0x7c9b('0x2')]('CreateChatQueueReport',{'body':_0x19e4f4,'log':_0x7c9b('0x3')});};exports[_0x7c9b('0x4')]=function(_0x56f327,_0x474486){return client[_0x7c9b('0x2')](_0x7c9b('0x5'),{'body':_0x474486,'options':{'where':{'uniqueid':_0x56f327},'order':[['id',_0x7c9b('0x6')]],'limit':0x1},'log':_0x7c9b('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index b93e53e..803dbc9 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x17e75e,_0x24753e){var _0x25f451=function(_0x36d907){while(--_0x36d907){_0x17e75e['push'](_0x17e75e['shift']());}};_0x25f451(++_0x24753e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x503cd5,_0x57774a){var _0x1fdf1e=function(_0x5222cc){while(--_0x5222cc){_0x503cd5['push'](_0x503cd5['shift']());}};_0x1fdf1e(++_0x57774a);}(_0x7a54,0x106));var _0x47a5=function(_0x484115,_0x209fea){_0x484115=_0x484115-0x0;var _0x3c22b7=_0x7a54[_0x484115];return _0x3c22b7;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index aba3dea..857c121 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 _0x7f21=['../client','Request'];(function(_0x46e690,_0x1c31e9){var _0x5dc731=function(_0x39a114){while(--_0x39a114){_0x46e690['push'](_0x46e690['shift']());}};_0x5dc731(++_0x1c31e9);}(_0x7f21,0x15c));var _0x17f2=function(_0x375c60,_0x584af3){_0x375c60=_0x375c60-0x0;var _0x170d2d=_0x7f21[_0x375c60];return _0x170d2d;};'use strict';var client=require(_0x17f2('0x0'));exports['create']=function(_0x36f77e){return client[_0x17f2('0x1')]('CreateFaxMessage',{'body':_0x36f77e,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x01b6=['Request','CreateFaxMessage','../client'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x01b6,0x12b));var _0x601b=function(_0x5b1aed,_0x322c17){_0x5b1aed=_0x5b1aed-0x0;var _0x26add8=_0x01b6[_0x5b1aed];return _0x26add8;};'use strict';var client=require(_0x601b('0x0'));exports['create']=function(_0x185dd8){return client[_0x601b('0x1')](_0x601b('0x2'),{'body':_0x185dd8,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index c1085f5..0d40818 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 _0x43ba=['strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x5b3b9b,_0x1c71b0){var _0x47c1d7=function(_0x34c20b){while(--_0x34c20b){_0x5b3b9b['push'](_0x5b3b9b['shift']());}};_0x47c1d7(++_0x1c71b0);}(_0x43ba,0x1de));var _0xa43b=function(_0x3b5818,_0xf1e892){_0x3b5818=_0x3b5818-0x0;var _0xe390f5=_0x43ba[_0x3b5818];return _0xe390f5;};'use strict';var client=require(_0xa43b('0x0'));exports[_0xa43b('0x1')]=function(){return function(){return client[_0xa43b('0x2')](_0xa43b('0x3'),{'options':{'raw':![],'attributes':['id',_0xa43b('0x4'),_0xa43b('0x5'),_0xa43b('0x6')],'include':[{'model':_0xa43b('0x7'),'as':_0xa43b('0x8'),'attributes':['id',_0xa43b('0x4'),_0xa43b('0x9'),_0xa43b('0xa')]}]},'log':_0xa43b('0x1')});};}; \ No newline at end of file +var _0x27d6=['faxPause','../client','Request','GetFaxQueue','name','timeout','strategy','online'];(function(_0x47623f,_0x148f3a){var _0x282ce8=function(_0x35bca1){while(--_0x35bca1){_0x47623f['push'](_0x47623f['shift']());}};_0x282ce8(++_0x148f3a);}(_0x27d6,0x1b1));var _0x627d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x27d6[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x627d('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x627d('0x1')](_0x627d('0x2'),{'options':{'raw':![],'attributes':['id',_0x627d('0x3'),_0x627d('0x4'),_0x627d('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x627d('0x3'),_0x627d('0x6'),_0x627d('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 40d4670..380e427 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 _0x6ecd=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x28a085,_0x3845ba){var _0x5ad4f3=function(_0xd109b5){while(--_0xd109b5){_0x28a085['push'](_0x28a085['shift']());}};_0x5ad4f3(++_0x3845ba);}(_0x6ecd,0xf3));var _0xd6ec=function(_0x43025,_0x45a373){_0x43025=_0x43025-0x0;var _0x1b5343=_0x6ecd[_0x43025];return _0x1b5343;};'use strict';var client=require(_0xd6ec('0x0'));exports[_0xd6ec('0x1')]=function(_0x54eafd){return client[_0xd6ec('0x2')](_0xd6ec('0x3'),{'body':_0x54eafd,'log':'CreateFaxQueueReport'});};exports[_0xd6ec('0x4')]=function(_0x32de62,_0xfdd1bf){return client[_0xd6ec('0x2')](_0xd6ec('0x5'),{'body':_0xfdd1bf,'options':{'where':{'uniqueid':_0x32de62},'order':[['id',_0xd6ec('0x6')]],'limit':0x1},'log':_0xd6ec('0x5')});}; \ No newline at end of file +var _0x2939=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x26dc96,_0x10c6f5){var _0x30b7be=function(_0x47de22){while(--_0x47de22){_0x26dc96['push'](_0x26dc96['shift']());}};_0x30b7be(++_0x10c6f5);}(_0x2939,0x1a2));var _0x9293=function(_0x587439,_0x153c32){_0x587439=_0x587439-0x0;var _0x138c81=_0x2939[_0x587439];return _0x138c81;};'use strict';var client=require(_0x9293('0x0'));exports[_0x9293('0x1')]=function(_0x4dfe06){return client[_0x9293('0x2')](_0x9293('0x3'),{'body':_0x4dfe06,'log':_0x9293('0x3')});};exports[_0x9293('0x4')]=function(_0x2889b7,_0x100935){return client['Request'](_0x9293('0x5'),{'body':_0x100935,'options':{'where':{'uniqueid':_0x2889b7},'order':[['id',_0x9293('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 6ce82e5..a9cecc6 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 _0xab08=['Request','GetInterval','Interval','Intervals','name','interval','getIntervals'];(function(_0x1cd5d5,_0x3059b9){var _0x5558dc=function(_0x226975){while(--_0x226975){_0x1cd5d5['push'](_0x1cd5d5['shift']());}};_0x5558dc(++_0x3059b9);}(_0xab08,0xfb));var _0x8ab0=function(_0x5bd9b8,_0x554022){_0x5bd9b8=_0x5bd9b8-0x0;var _0x5ab4ca=_0xab08[_0x5bd9b8];return _0x5ab4ca;};'use strict';var client=require('../client');exports[_0x8ab0('0x0')]=function(){return function(){return client[_0x8ab0('0x1')](_0x8ab0('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x8ab0('0x3'),'as':_0x8ab0('0x4'),'attributes':['id',_0x8ab0('0x5'),_0x8ab0('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x3b48=['GetInterval','name','Interval','interval','getIntervals','Request'];(function(_0x88ec18,_0xc1002c){var _0x249a2f=function(_0x3946cd){while(--_0x3946cd){_0x88ec18['push'](_0x88ec18['shift']());}};_0x249a2f(++_0xc1002c);}(_0x3b48,0x130));var _0x83b4=function(_0x3aad4e,_0x18e812){_0x3aad4e=_0x3aad4e-0x0;var _0x33b4a2=_0x3b48[_0x3aad4e];return _0x33b4a2;};'use strict';var client=require('../client');exports[_0x83b4('0x0')]=function(){return function(){return client[_0x83b4('0x1')](_0x83b4('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x83b4('0x3')],'include':[{'model':_0x83b4('0x4'),'as':'Intervals','attributes':['id',_0x83b4('0x3'),_0x83b4('0x5')]}]},'log':_0x83b4('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 1edf204..d486eb3 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 _0x955f=['update','Request','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x48b492,_0x1c5091){var _0x5eb0f1=function(_0x282a94){while(--_0x282a94){_0x48b492['push'](_0x48b492['shift']());}};_0x5eb0f1(++_0x1c5091);}(_0x955f,0x1eb));var _0xf955=function(_0x451aed,_0x4a1501){_0x451aed=_0x451aed-0x0;var _0xdc96c7=_0x955f[_0x451aed];return _0xdc96c7;};'use strict';var client=require(_0xf955('0x0'));exports[_0xf955('0x1')]=function(_0x438668,_0x382225){return client[_0xf955('0x2')]('UpdateMailInteraction',{'body':_0x382225,'options':{'where':{'id':_0x438668}},'log':_0xf955('0x3')});};exports['addTags']=function(_0x5d0c95,_0x1db0dd){return client['Request'](_0xf955('0x4'),{'body':_0x1db0dd,'options':{'where':{'id':_0x5d0c95}},'log':_0xf955('0x5')});}; \ No newline at end of file +var _0x32f4=['updateMailInteraction','Request','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction'];(function(_0x1a6e0a,_0x24cf55){var _0x31cc3b=function(_0x1a051a){while(--_0x1a051a){_0x1a6e0a['push'](_0x1a6e0a['shift']());}};_0x31cc3b(++_0x24cf55);}(_0x32f4,0x154));var _0x432f=function(_0x29140d,_0x1937bb){_0x29140d=_0x29140d-0x0;var _0x3da7c9=_0x32f4[_0x29140d];return _0x3da7c9;};'use strict';var client=require(_0x432f('0x0'));exports[_0x432f('0x1')]=function(_0x29845b,_0x2b22ad){return client['Request'](_0x432f('0x2'),{'body':_0x2b22ad,'options':{'where':{'id':_0x29845b}},'log':_0x432f('0x3')});};exports['addTags']=function(_0x354293,_0x1eabac){return client[_0x432f('0x4')](_0x432f('0x5'),{'body':_0x1eabac,'options':{'where':{'id':_0x354293}},'log':_0x432f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index dcde393..f067e4c 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 _0xe9b3=['create','createMailMessage'];(function(_0x2f18bb,_0x478ce9){var _0x1edda7=function(_0x4df0cb){while(--_0x4df0cb){_0x2f18bb['push'](_0x2f18bb['shift']());}};_0x1edda7(++_0x478ce9);}(_0xe9b3,0x11e));var _0x3e9b=function(_0x350cf1,_0x47d949){_0x350cf1=_0x350cf1-0x0;var _0x383b9e=_0xe9b3[_0x350cf1];return _0x383b9e;};'use strict';var client=require('../client');exports[_0x3e9b('0x0')]=function(_0x532471){return client['Request']('CreateMailMessage',{'body':_0x532471,'log':_0x3e9b('0x1')});}; \ No newline at end of file +var _0x9dda=['CreateMailMessage','createMailMessage','../client'];(function(_0xf26382,_0x38e040){var _0x54cb3e=function(_0x54f76f){while(--_0x54f76f){_0xf26382['push'](_0xf26382['shift']());}};_0x54cb3e(++_0x38e040);}(_0x9dda,0xd1));var _0xa9dd=function(_0x28ceb5,_0x55bbe5){_0x28ceb5=_0x28ceb5-0x0;var _0x2410a6=_0x9dda[_0x28ceb5];return _0x2410a6;};'use strict';var client=require(_0xa9dd('0x0'));exports['create']=function(_0x533687){return client['Request'](_0xa9dd('0x1'),{'body':_0x533687,'log':_0xa9dd('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 1c2b092..8607e79 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 _0x7040=['Agents','name','online','mailPause','../client','getMailQueues','Request','GetMailQueue','timeout','strategy','User'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7040,0xf6));var _0x0704=function(_0x461396,_0x38f96b){_0x461396=_0x461396-0x0;var _0x5caff3=_0x7040[_0x461396];return _0x5caff3;};'use strict';var client=require(_0x0704('0x0'));exports[_0x0704('0x1')]=function(){return function(){return client[_0x0704('0x2')](_0x0704('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x0704('0x4'),_0x0704('0x5')],'include':[{'model':_0x0704('0x6'),'as':_0x0704('0x7'),'attributes':['id',_0x0704('0x8'),_0x0704('0x9'),_0x0704('0xa')]}]},'log':_0x0704('0x1')});};}; \ No newline at end of file +var _0xfff6=['name','timeout','strategy','Agents','online','mailPause','getMailQueues','../client','GetMailQueue'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0xfff6,0x1a5));var _0x6fff=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfff6[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x6fff('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0x6fff('0x1'),{'options':{'raw':![],'attributes':['id',_0x6fff('0x2'),_0x6fff('0x3'),_0x6fff('0x4')],'include':[{'model':'User','as':_0x6fff('0x5'),'attributes':['id',_0x6fff('0x2'),_0x6fff('0x6'),_0x6fff('0x7')]}]},'log':_0x6fff('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 3bcb077..58d4657 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 _0x7c2e=['UpdateMailQueueReport','../client','Request','CreateMailQueueReport'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x7c2e,0x161));var _0xe7c2=function(_0x6cccfe,_0x5ec2b2){_0x6cccfe=_0x6cccfe-0x0;var _0x965c00=_0x7c2e[_0x6cccfe];return _0x965c00;};'use strict';var client=require(_0xe7c2('0x0'));exports['create']=function(_0x4d7d84){return client[_0xe7c2('0x1')](_0xe7c2('0x2'),{'body':_0x4d7d84,'log':_0xe7c2('0x2')});};exports['update']=function(_0x2a925b,_0x14591e){return client[_0xe7c2('0x1')]('UpdateMailQueueReport',{'body':_0x14591e,'options':{'where':{'uniqueid':_0x2a925b},'order':[['id','DESC']],'limit':0x1},'log':_0xe7c2('0x3')});}; \ No newline at end of file +var _0x667b=['update','DESC','../client','Request','CreateMailQueueReport'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x667b,0x1e2));var _0xb667=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0x667b[_0x5d0609];return _0xaa3fd1;};'use strict';var client=require(_0xb667('0x0'));exports['create']=function(_0x243021){return client[_0xb667('0x1')](_0xb667('0x2'),{'body':_0x243021,'log':_0xb667('0x2')});};exports[_0xb667('0x3')]=function(_0x509fad,_0x5926){return client[_0xb667('0x1')]('UpdateMailQueueReport',{'body':_0x5926,'options':{'where':{'uniqueid':_0x509fad},'order':[['id',_0xb667('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 570da2c..cca17cc 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 _0xd560=['Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x43ecd1,_0x2142e8){var _0x1f4e41=function(_0xe7d1f0){while(--_0xe7d1f0){_0x43ecd1['push'](_0x43ecd1['shift']());}};_0x1f4e41(++_0x2142e8);}(_0xd560,0x12f));var _0x0d56=function(_0x2195bd,_0x19e61d){_0x2195bd=_0x2195bd-0x0;var _0x1ead1c=_0xd560[_0x2195bd];return _0x1ead1c;};'use strict';var client=require('../client');exports['update']=function(_0x585715,_0x114ba8){return client['Request'](_0x0d56('0x0'),{'body':_0x114ba8,'options':{'where':{'id':_0x585715}},'log':_0x0d56('0x1')});};exports[_0x0d56('0x2')]=function(_0x25deea,_0x5c6ae2){return client[_0x0d56('0x3')](_0x0d56('0x4'),{'body':_0x5c6ae2,'options':{'where':{'id':_0x25deea}},'log':_0x0d56('0x5')});}; \ No newline at end of file +var _0xb2c5=['update','Request','UpdateOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x5413ef,_0x5c69c5){var _0xb600ed=function(_0x402e73){while(--_0x402e73){_0x5413ef['push'](_0x5413ef['shift']());}};_0xb600ed(++_0x5c69c5);}(_0xb2c5,0xd1));var _0x5b2c=function(_0x182fff,_0x568aee){_0x182fff=_0x182fff-0x0;var _0x1b4171=_0xb2c5[_0x182fff];return _0x1b4171;};'use strict';var client=require(_0x5b2c('0x0'));exports[_0x5b2c('0x1')]=function(_0x3bb9e3,_0x334cb8){return client[_0x5b2c('0x2')](_0x5b2c('0x3'),{'body':_0x334cb8,'options':{'where':{'id':_0x3bb9e3}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x200bb6,_0x5684ca){return client[_0x5b2c('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x5684ca,'options':{'where':{'id':_0x200bb6}},'log':_0x5b2c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 8dc8f90..fc62c27 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 _0x3c5c=['Request','CreateOpenchannelMessage','create'];(function(_0x452770,_0x108ecd){var _0x369927=function(_0x119c5f){while(--_0x119c5f){_0x452770['push'](_0x452770['shift']());}};_0x369927(++_0x108ecd);}(_0x3c5c,0x1f1));var _0xc3c5=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x3c5c[_0x2dea24];return _0x309d58;};'use strict';var client=require('../client');exports[_0xc3c5('0x0')]=function(_0x18447f){return client[_0xc3c5('0x1')](_0xc3c5('0x2'),{'body':_0x18447f,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x7397=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x44c243,_0x416cf5){var _0x2e767c=function(_0xbf72f2){while(--_0xbf72f2){_0x44c243['push'](_0x44c243['shift']());}};_0x2e767c(++_0x416cf5);}(_0x7397,0x16e));var _0x7739=function(_0x23d5fa,_0x397ebd){_0x23d5fa=_0x23d5fa-0x0;var _0x399840=_0x7397[_0x23d5fa];return _0x399840;};'use strict';var client=require(_0x7739('0x0'));exports[_0x7739('0x1')]=function(_0x1f83cc){return client[_0x7739('0x2')](_0x7739('0x3'),{'body':_0x1f83cc,'log':_0x7739('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 7b7113a..cf9c3cf 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 _0xb126=['Request','GetOpenchannelQueue','name','timeout','Agents','online','../client','getOpenchannelQueues'];(function(_0x525fde,_0x2178b4){var _0x121a4a=function(_0x5e21aa){while(--_0x5e21aa){_0x525fde['push'](_0x525fde['shift']());}};_0x121a4a(++_0x2178b4);}(_0xb126,0x76));var _0x6b12=function(_0x5b1d3d,_0x56ec7d){_0x5b1d3d=_0x5b1d3d-0x0;var _0x40b12b=_0xb126[_0x5b1d3d];return _0x40b12b;};'use strict';var client=require(_0x6b12('0x0'));exports[_0x6b12('0x1')]=function(){return function(){return client[_0x6b12('0x2')](_0x6b12('0x3'),{'options':{'raw':![],'attributes':['id',_0x6b12('0x4'),_0x6b12('0x5'),'strategy'],'include':[{'model':'User','as':_0x6b12('0x6'),'attributes':['id','name',_0x6b12('0x7'),'openchannelPause']}]},'log':_0x6b12('0x1')});};}; \ No newline at end of file +var _0xf201=['GetOpenchannelQueue','name','strategy','User','Agents','../client','getOpenchannelQueues','Request'];(function(_0x417197,_0x191f3d){var _0x3f5a2f=function(_0x3d8a82){while(--_0x3d8a82){_0x417197['push'](_0x417197['shift']());}};_0x3f5a2f(++_0x191f3d);}(_0xf201,0x155));var _0x1f20=function(_0x372699,_0x1e8c22){_0x372699=_0x372699-0x0;var _0x122c61=_0xf201[_0x372699];return _0x122c61;};'use strict';var client=require(_0x1f20('0x0'));exports[_0x1f20('0x1')]=function(){return function(){return client[_0x1f20('0x2')](_0x1f20('0x3'),{'options':{'raw':![],'attributes':['id',_0x1f20('0x4'),'timeout',_0x1f20('0x5')],'include':[{'model':_0x1f20('0x6'),'as':_0x1f20('0x7'),'attributes':['id',_0x1f20('0x4'),'online','openchannelPause']}]},'log':_0x1f20('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 54d2e7c..e39d4e9 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 _0x16e3=['../client','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x16bfbb,_0x1d972b){var _0x12bac1=function(_0xf05b52){while(--_0xf05b52){_0x16bfbb['push'](_0x16bfbb['shift']());}};_0x12bac1(++_0x1d972b);}(_0x16e3,0x168));var _0x316e=function(_0x54cbf4,_0x15e046){_0x54cbf4=_0x54cbf4-0x0;var _0xceca9=_0x16e3[_0x54cbf4];return _0xceca9;};'use strict';var client=require(_0x316e('0x0'));exports['create']=function(_0x5193fd){return client[_0x316e('0x1')]('CreateOpenchannelQueueReport',{'body':_0x5193fd,'log':_0x316e('0x2')});};exports[_0x316e('0x3')]=function(_0x4c2083,_0x1b3909){return client['Request'](_0x316e('0x4'),{'body':_0x1b3909,'options':{'where':{'uniqueid':_0x4c2083},'order':[['id',_0x316e('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xb218=['update','UpdateOpenchannelQueueReport','../client','Request','CreateOpenchannelQueueReport'];(function(_0x4a4405,_0x174256){var _0x4e368b=function(_0x18df2c){while(--_0x18df2c){_0x4a4405['push'](_0x4a4405['shift']());}};_0x4e368b(++_0x174256);}(_0xb218,0x192));var _0x8b21=function(_0x3d3bf0,_0x4a7191){_0x3d3bf0=_0x3d3bf0-0x0;var _0x3132c4=_0xb218[_0x3d3bf0];return _0x3132c4;};'use strict';var client=require(_0x8b21('0x0'));exports['create']=function(_0x16872f){return client[_0x8b21('0x1')](_0x8b21('0x2'),{'body':_0x16872f,'log':'CreateOpenchannelQueueReport'});};exports[_0x8b21('0x3')]=function(_0x3f922f,_0x28661e){return client['Request'](_0x8b21('0x4'),{'body':_0x28661e,'options':{'where':{'uniqueid':_0x3f922f},'order':[['id','DESC']],'limit':0x1},'log':_0x8b21('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 9ae3331..519b195 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 _0x723e=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction','update'];(function(_0x132844,_0x98bc49){var _0x13c26f=function(_0xf5c16f){while(--_0xf5c16f){_0x132844['push'](_0x132844['shift']());}};_0x13c26f(++_0x98bc49);}(_0x723e,0x179));var _0xe723=function(_0x29d932,_0x97f2a7){_0x29d932=_0x29d932-0x0;var _0x5cd611=_0x723e[_0x29d932];return _0x5cd611;};'use strict';var client=require('../client');exports[_0xe723('0x0')]=function(_0x95eab5,_0x21d00c){return client[_0xe723('0x1')](_0xe723('0x2'),{'body':_0x21d00c,'options':{'where':{'id':_0x95eab5}},'log':_0xe723('0x3')});};exports[_0xe723('0x4')]=function(_0x1da20f,_0x8f78b2){return client[_0xe723('0x1')]('AddTagsToSmsInteraction',{'body':_0x8f78b2,'options':{'where':{'id':_0x1da20f}},'log':_0xe723('0x5')});}; \ No newline at end of file +var _0x72a2=['addTags','update','Request','UpdateSmsInteraction'];(function(_0x1af05b,_0x5134b5){var _0x5be7cc=function(_0x2d4ac0){while(--_0x2d4ac0){_0x1af05b['push'](_0x1af05b['shift']());}};_0x5be7cc(++_0x5134b5);}(_0x72a2,0x161));var _0x272a=function(_0x38cf38,_0x12ce83){_0x38cf38=_0x38cf38-0x0;var _0x2e7888=_0x72a2[_0x38cf38];return _0x2e7888;};'use strict';var client=require('../client');exports[_0x272a('0x0')]=function(_0xd12811,_0x1927cc){return client[_0x272a('0x1')](_0x272a('0x2'),{'body':_0x1927cc,'options':{'where':{'id':_0xd12811}},'log':'updateSmsInteraction'});};exports[_0x272a('0x3')]=function(_0x52287e,_0x1d154d){return client['Request']('AddTagsToSmsInteraction',{'body':_0x1d154d,'options':{'where':{'id':_0x52287e}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 1b0384d..06043e9 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 _0x54dc=['createSmsMessage','../client','create','CreateSmsMessage'];(function(_0x3f6e26,_0x811a34){var _0x474345=function(_0x4a0cbe){while(--_0x4a0cbe){_0x3f6e26['push'](_0x3f6e26['shift']());}};_0x474345(++_0x811a34);}(_0x54dc,0xd1));var _0xc54d=function(_0x52fd3d,_0x3af718){_0x52fd3d=_0x52fd3d-0x0;var _0x49b06d=_0x54dc[_0x52fd3d];return _0x49b06d;};'use strict';var client=require(_0xc54d('0x0'));exports[_0xc54d('0x1')]=function(_0x3726b1){return client['Request'](_0xc54d('0x2'),{'body':_0x3726b1,'log':_0xc54d('0x3')});}; \ No newline at end of file +var _0x16db=['createSmsMessage','../client','create','CreateSmsMessage'];(function(_0x5f2525,_0x38ff67){var _0x56c2d6=function(_0x49d208){while(--_0x49d208){_0x5f2525['push'](_0x5f2525['shift']());}};_0x56c2d6(++_0x38ff67);}(_0x16db,0xf9));var _0xb16d=function(_0x2ffc46,_0x35ce3c){_0x2ffc46=_0x2ffc46-0x0;var _0x1eda8f=_0x16db[_0x2ffc46];return _0x1eda8f;};'use strict';var client=require(_0xb16d('0x0'));exports[_0xb16d('0x1')]=function(_0x4c91dc){return client['Request'](_0xb16d('0x2'),{'body':_0x4c91dc,'log':_0xb16d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 0923ca2..fee3476 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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x502598,_0x1e95c8){var _0xbdee21=function(_0x140feb){while(--_0x140feb){_0x502598['push'](_0x502598['shift']());}};_0xbdee21(++_0x1e95c8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x4d038c,_0x3a7e2a){var _0x3f63c9=function(_0x176883){while(--_0x176883){_0x4d038c['push'](_0x4d038c['shift']());}};_0x3f63c9(++_0x3a7e2a);}(_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 820c21d..77535f7 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 _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x375541,_0x300d56){var _0x291d8b=function(_0x27bb64){while(--_0x27bb64){_0x375541['push'](_0x375541['shift']());}};_0x291d8b(++_0x300d56);}(_0x55ca,0x126));var _0xa55c=function(_0x3407ee,_0xb2e716){_0x3407ee=_0x3407ee-0x0;var _0x1b0b35=_0x55ca[_0x3407ee];return _0x1b0b35;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x192add,_0x4490e4){var _0x1b9d9d=function(_0x55084d){while(--_0x55084d){_0x192add['push'](_0x192add['shift']());}};_0x1b9d9d(++_0x4490e4);}(_0x008c,0x188));var _0xc008=function(_0x39e8f5,_0xb151a6){_0x39e8f5=_0x39e8f5-0x0;var _0x346526=_0x008c[_0x39e8f5];return _0x346526;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 6d9adfc..6651e5b 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(_0x5c26be,_0x752cd8){var _0x546dca=function(_0x2c217c){while(--_0x2c217c){_0x5c26be['push'](_0x5c26be['shift']());}};_0x546dca(++_0x752cd8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x4937db,_0x19022c){var _0x4bb464=function(_0x3e363c){while(--_0x3e363c){_0x4937db['push'](_0x4937db['shift']());}};_0x4bb464(++_0x19022c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 d7fde58..b6706d0 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 _0xd663=['addTags','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x32e865,_0x317078){var _0x850461=function(_0x37417f){while(--_0x37417f){_0x32e865['push'](_0x32e865['shift']());}};_0x850461(++_0x317078);}(_0xd663,0x1ed));var _0x3d66=function(_0x15c79c,_0x53697e){_0x15c79c=_0x15c79c-0x0;var _0x41016c=_0xd663[_0x15c79c];return _0x41016c;};'use strict';var client=require(_0x3d66('0x0'));exports[_0x3d66('0x1')]=function(_0x55a3d4,_0x1fdc60){return client[_0x3d66('0x2')](_0x3d66('0x3'),{'body':_0x1fdc60,'options':{'where':{'id':_0x55a3d4}},'log':_0x3d66('0x4')});};exports[_0x3d66('0x5')]=function(_0x4e9001,_0x28d76b){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x28d76b,'options':{'where':{'id':_0x4e9001}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x3c6c=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x340fb8,_0x371d51){var _0x3fa73f=function(_0x234fba){while(--_0x234fba){_0x340fb8['push'](_0x340fb8['shift']());}};_0x3fa73f(++_0x371d51);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x66318f,_0x28ebf4){_0x66318f=_0x66318f-0x0;var _0x173e96=_0x3c6c[_0x66318f];return _0x173e96;};'use strict';var client=require(_0xc3c6('0x0'));exports['update']=function(_0x26d304,_0x2fc57d){return client[_0xc3c6('0x1')](_0xc3c6('0x2'),{'body':_0x2fc57d,'options':{'where':{'id':_0x26d304}},'log':_0xc3c6('0x3')});};exports[_0xc3c6('0x4')]=function(_0x65a78,_0x34db2e){return client['Request'](_0xc3c6('0x5'),{'body':_0x34db2e,'options':{'where':{'id':_0x65a78}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 4879ef5..87149c2 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 _0x9f79=['CreateWhatsappMessage','../client','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f79,0x181));var _0x99f7=function(_0x364d01,_0x17f870){_0x364d01=_0x364d01-0x0;var _0x47e5e9=_0x9f79[_0x364d01];return _0x47e5e9;};'use strict';var client=require(_0x99f7('0x0'));exports['create']=function(_0x322d45){return client[_0x99f7('0x1')](_0x99f7('0x2'),{'body':_0x322d45,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x16dd=['create','createWhatsappMessage','../client'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x16dd,0x185));var _0xd16d=function(_0x38ea43,_0x4edaa0){_0x38ea43=_0x38ea43-0x0;var _0x599da2=_0x16dd[_0x38ea43];return _0x599da2;};'use strict';var client=require(_0xd16d('0x0'));exports[_0xd16d('0x1')]=function(_0x34f114){return client['Request']('CreateWhatsappMessage',{'body':_0x34f114,'log':_0xd16d('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index b8987be..f96c2b0 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 _0x97f3=['online','whatsappPause','getWhatsappQueues','Request','name','timeout','strategy','User'];(function(_0x2f8a7c,_0x3f65fd){var _0x257e01=function(_0x412826){while(--_0x412826){_0x2f8a7c['push'](_0x2f8a7c['shift']());}};_0x257e01(++_0x3f65fd);}(_0x97f3,0xcb));var _0x397f=function(_0x1e5924,_0x327fad){_0x1e5924=_0x1e5924-0x0;var _0x13ccd6=_0x97f3[_0x1e5924];return _0x13ccd6;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x397f('0x0')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x397f('0x1'),_0x397f('0x2'),_0x397f('0x3')],'include':[{'model':_0x397f('0x4'),'as':'Agents','attributes':['id',_0x397f('0x1'),_0x397f('0x5'),_0x397f('0x6')]}]},'log':_0x397f('0x7')});};}; \ No newline at end of file +var _0xcedc=['getWhatsappQueues','Request','timeout','strategy','User','Agents','name','whatsappPause'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcedc,0x190));var _0xcced=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcedc[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0xcced('0x0')]=function(){return function(){return client[_0xcced('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0xcced('0x2'),_0xcced('0x3')],'include':[{'model':_0xcced('0x4'),'as':_0xcced('0x5'),'attributes':['id',_0xcced('0x6'),'online',_0xcced('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 1a8329b..0e0cf7d 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 _0x974d=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x22c141,_0x341ffe){var _0x25abea=function(_0x442d33){while(--_0x442d33){_0x22c141['push'](_0x22c141['shift']());}};_0x25abea(++_0x341ffe);}(_0x974d,0xba));var _0xd974=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x974d[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0xd974('0x0'));exports[_0xd974('0x1')]=function(_0x62eabf){return client[_0xd974('0x2')](_0xd974('0x3'),{'body':_0x62eabf,'log':_0xd974('0x3')});};exports[_0xd974('0x4')]=function(_0x194ced,_0x100ecf){return client[_0xd974('0x2')]('UpdateWhatsappQueueReport',{'body':_0x100ecf,'options':{'where':{'uniqueid':_0x194ced},'order':[['id','DESC']],'limit':0x1},'log':_0xd974('0x5')});}; \ No newline at end of file +var _0x2073=['UpdateWhatsappQueueReport','DESC','../client','CreateWhatsappQueueReport','update'];(function(_0x3e9950,_0x1f0946){var _0x2e1438=function(_0x44fa8c){while(--_0x44fa8c){_0x3e9950['push'](_0x3e9950['shift']());}};_0x2e1438(++_0x1f0946);}(_0x2073,0x16f));var _0x3207=function(_0x152fe3,_0x12b0c8){_0x152fe3=_0x152fe3-0x0;var _0xc5bb39=_0x2073[_0x152fe3];return _0xc5bb39;};'use strict';var client=require(_0x3207('0x0'));exports['create']=function(_0x59cc59){return client['Request'](_0x3207('0x1'),{'body':_0x59cc59,'log':_0x3207('0x1')});};exports[_0x3207('0x2')]=function(_0xb35e0c,_0x4b4c6a){return client['Request'](_0x3207('0x3'),{'body':_0x4b4c6a,'options':{'where':{'uniqueid':_0xb35e0c},'order':[['id',_0x3207('0x4')]],'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 af4caed..379fa9c 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 _0x5d66=['agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','util','../../../../config/logger','routing','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','stop','find','agents','timeout','createQueue','atimeout','channel','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','next'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x5d66,0x164));var _0x65d6=function(_0x2490e6,_0x6473a0){_0x2490e6=_0x2490e6-0x0;var _0x2fff5a=_0x5d66[_0x2490e6];return _0x2fff5a;};'use strict';var schema=require(_0x65d6('0x0'));var _=require('lodash');var util=require(_0x65d6('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x65d6('0x2'))(_0x65d6('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x65d6('0x4'),'message':_0x65d6('0x5')}});function writeLog(_0x1fa0a0,_0x35ed09,_0x5595be){return logger[_0x65d6('0x6')](util[_0x65d6('0x7')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1fa0a0,_0x35ed09[_0x65d6('0x8')],_0x5595be));}function handleFindAgent(_0x4e7c3f){return function(_0x4ff763){return _0x4ff763[_0x65d6('0x8')][_0x65d6('0x9')]()===_0x4e7c3f[_0x65d6('0x9')]();};}exports[_0x65d6('0xa')]=function(_0x39d6a8,_0x4ea844,_0x2e5577,_0x573129){return function(_0x475e65){try{var _0x13fbd1={'name':_0x4ea844[0x0],'timeout':_0x4ea844[0x1]};var _0x19f68a=queue[_0x65d6('0x0')](_0x13fbd1,{'typecast':!![]});if(_0x19f68a[_0x65d6('0xb')]){logger[_0x65d6('0xc')](_0x65d6('0xd'),_0x39d6a8,_['map'](_0x19f68a,_0x65d6('0xe'))['join'](',\x20'));_0x475e65[_0x65d6('0xf')]();}else{var _0x218251=_[_0x65d6('0x10')](_0x2e5577[_0x65d6('0x11')],handleFindAgent(_0x13fbd1[_0x65d6('0x8')]));if(_0x218251){var _0x188a9f=(_0x13fbd1[_0x65d6('0x12')]||0xa)*0x3e8;var _0x4e30fc,_0x328709;var _0x598f77=seqqueue[_0x65d6('0x13')](_0x188a9f);_0x598f77['id']=_0x39d6a8;_0x598f77[_0x65d6('0x14')]=_0x188a9f;_0x598f77['channel']=_0x573129[_0x65d6('0x15')];writeLog(_0x39d6a8,_0x218251,util['format']('START:%s',_0x188a9f));_0x2e5577[_0x65d6('0x16')][_0x39d6a8]['on'](_0x65d6('0x17'),function(){logger[_0x65d6('0x6')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x39d6a8);clearTimeout(_0x328709);_0x328709=undefined;_0x598f77[_0x65d6('0x18')]();if(_0x2e5577[_0x65d6('0x16')][_0x39d6a8]){delete _0x2e5577[_0x65d6('0x16')][_0x39d6a8];}_0x475e65[_0x65d6('0xf')]();});_0x2e5577['rules'][_0x39d6a8]['on'](_0x65d6('0x19'),function(){if(_0x2e5577['rules'][_0x39d6a8]){delete _0x2e5577[_0x65d6('0x16')][_0x39d6a8];}});_0x328709=setTimeout(function(){logger[_0x65d6('0x6')](_0x65d6('0x1a'),_0x39d6a8);clearTimeout(_0x328709);_0x598f77[_0x65d6('0x18')]();_0x475e65[_0x65d6('0x1b')]();},_0x188a9f);strategy[_0x65d6('0x1c')](_0x598f77,_0x218251,_0x2e5577,_0x573129);}else{logger[_0x65d6('0xc')](_0x65d6('0x1d'),_0x39d6a8,_0x13fbd1[_0x65d6('0x8')]);_0x475e65[_0x65d6('0xf')]();}}}catch(_0x1a0091){console[_0x65d6('0x1e')](_0x1a0091);logger[_0x65d6('0xc')](_0x65d6('0x1f'),_0x39d6a8,_0x1a0091['stack']);_0x475e65['stop']();}};}; \ No newline at end of file +var _0x5f6b=['string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','rules','end','complete','close','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','util','seq-queue','../../../../config/logger'];(function(_0x3850a2,_0x84d736){var _0x6d3824=function(_0x5f1ecc){while(--_0x5f1ecc){_0x3850a2['push'](_0x3850a2['shift']());}};_0x6d3824(++_0x84d736);}(_0x5f6b,0x81));var _0xb5f6=function(_0xeb6b2b,_0x520aeb){_0xeb6b2b=_0xeb6b2b-0x0;var _0x24eedd=_0x5f6b[_0xeb6b2b];return _0x24eedd;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xb5f6('0x0'));var seqqueue=require(_0xb5f6('0x1'));var logger=require(_0xb5f6('0x2'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0xb5f6('0x3'),'required':!![],'message':_0xb5f6('0x4')},'timeout':{'type':'number','message':_0xb5f6('0x5')}});function writeLog(_0x44cf57,_0x56f55b,_0x587b9a){return logger[_0xb5f6('0x6')](util[_0xb5f6('0x7')](_0xb5f6('0x8'),_0x44cf57,_0x56f55b[_0xb5f6('0x9')],_0x587b9a));}function handleFindAgent(_0x9b2748){return function(_0x58bdc7){return _0x58bdc7[_0xb5f6('0x9')][_0xb5f6('0xa')]()===_0x9b2748[_0xb5f6('0xa')]();};}exports[_0xb5f6('0xb')]=function(_0x207a01,_0x505a71,_0x482b73,_0x3a378a){return function(_0x349b74){try{var _0x4e3394={'name':_0x505a71[0x0],'timeout':_0x505a71[0x1]};var _0x1dc350=queue[_0xb5f6('0xc')](_0x4e3394,{'typecast':!![]});if(_0x1dc350[_0xb5f6('0xd')]){logger[_0xb5f6('0xe')](_0xb5f6('0xf'),_0x207a01,_[_0xb5f6('0x10')](_0x1dc350,_0xb5f6('0x11'))[_0xb5f6('0x12')](',\x20'));_0x349b74[_0xb5f6('0x13')]();}else{var _0x547f2d=_[_0xb5f6('0x14')](_0x482b73[_0xb5f6('0x15')],handleFindAgent(_0x4e3394['name']));if(_0x547f2d){var _0x10cc67=(_0x4e3394[_0xb5f6('0x16')]||0xa)*0x3e8;var _0x520946,_0x5d5823;var _0xfc9507=seqqueue[_0xb5f6('0x17')](_0x10cc67);_0xfc9507['id']=_0x207a01;_0xfc9507[_0xb5f6('0x18')]=_0x10cc67;_0xfc9507[_0xb5f6('0x19')]=_0x3a378a[_0xb5f6('0x19')];writeLog(_0x207a01,_0x547f2d,util[_0xb5f6('0x7')]('START:%s',_0x10cc67));_0x482b73[_0xb5f6('0x1a')][_0x207a01]['on'](_0xb5f6('0x1b'),function(){logger[_0xb5f6('0x6')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x207a01);clearTimeout(_0x5d5823);_0x5d5823=undefined;_0xfc9507['close']();if(_0x482b73['rules'][_0x207a01]){delete _0x482b73[_0xb5f6('0x1a')][_0x207a01];}_0x349b74[_0xb5f6('0x13')]();});_0x482b73['rules'][_0x207a01]['on'](_0xb5f6('0x1c'),function(){if(_0x482b73['rules'][_0x207a01]){delete _0x482b73[_0xb5f6('0x1a')][_0x207a01];}});_0x5d5823=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x207a01);clearTimeout(_0x5d5823);_0xfc9507[_0xb5f6('0x1d')]();_0x349b74['next']();},_0x10cc67);strategy[_0xb5f6('0x1e')](_0xfc9507,_0x547f2d,_0x482b73,_0x3a378a);}else{logger[_0xb5f6('0xe')](_0xb5f6('0x1f'),_0x207a01,_0x4e3394[_0xb5f6('0x9')]);_0x349b74[_0xb5f6('0x13')]();}}}catch(_0x4fce75){console['log'](_0x4fce75);logger[_0xb5f6('0xe')](_0xb5f6('0x20'),_0x207a01,_0x4fce75['stack']);_0x349b74['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 a7e04a0..00bd4bd 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 _0x39ee=['created','isEmpty','body','getMustacheRender','create','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','postText','message','amazonlex','Message','then','dialogState','Failed','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x39ee,0xaf));var _0xe39e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39ee[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe39e('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xe39e('0x1'));var logger=require(_0xe39e('0x2'))(_0xe39e('0x3'));var rpc={'chatMessage':require(_0xe39e('0x4')),'openchannelMessage':require(_0xe39e('0x5')),'mailMessage':require(_0xe39e('0x6')),'smsMessage':require(_0xe39e('0x7')),'faxMessage':require(_0xe39e('0x8')),'whatsappMessage':require(_0xe39e('0x9'))};exports[_0xe39e('0xa')]=function(_0x3d93d7,_0x52bbde){return function(_0x2c9505){try{if(!_[_0xe39e('0xb')](this['interaction'][_0xe39e('0xc')])){logger[_0xe39e('0xd')]('[%s][AMAZONLEX]\x20%s',_0x3d93d7,_0xe39e('0xe'));return _0x2c9505[_0xe39e('0xf')]();}var _0x4caa76={'ContactId':this[_0xe39e('0x10')]['id'],'sentAt':moment()[_0xe39e('0x11')](_0xe39e('0x12')),'direction':_0xe39e('0x13')};if(this[_0xe39e('0x14')]===_0xe39e('0x15')||this[_0xe39e('0x14')]===_0xe39e('0x16')){_0x4caa76[_0xe39e('0x17')]=this[_0xe39e('0x18')][_0xe39e('0x17')];}var _0x596363=this[_0xe39e('0x14')];if(_0x596363===_0xe39e('0x19')){_0x4caa76[_0xe39e('0x1a')]=this[_0xe39e('0x1b')]['id'];}else{_0x4caa76[_['upperFirst'](_0x596363)+'AccountId']=this[_0xe39e('0x1b')]['id'];}_0x4caa76[_[_0xe39e('0x1c')](_0x596363)+'InteractionId']=this[_0xe39e('0x18')]['id'];if(this['interaction'][_0xe39e('0x1d')]){var _0x39165c=_0x52bbde[0x4];if(!_[_0xe39e('0x1e')](_0x39165c)){_0x4caa76[_0xe39e('0x1f')]=utils[_0xe39e('0x20')](_0x39165c,this);return rpc[_0x596363+'Message'][_0xe39e('0x21')](_0x4caa76)['then'](function(_0x3a66de){logger[_0xe39e('0xd')](_0xe39e('0x22'),_0x3d93d7,_0x4caa76[_0xe39e('0x1f')]);})[_0xe39e('0x23')](function(_0x363b9e){logger[_0xe39e('0x24')](_0xe39e('0x22'),_0x3d93d7,JSON[_0xe39e('0x25')](_0x363b9e));})[_0xe39e('0x26')](function(){logger[_0xe39e('0xd')](_0xe39e('0x27'),_0x3d93d7);_0x2c9505[_0xe39e('0x28')]();});}else{logger['info'](_0xe39e('0x29'),_0x3d93d7);_0x2c9505[_0xe39e('0x28')]();}}else{var _0x5a4931=this;var _0x32a8be=new AWS[(_0xe39e('0x2a'))]({'accessKeyId':_0x52bbde[0x0],'secretAccessKey':_0x52bbde[0x1],'region':_0x52bbde[0x2]});var _0xeb14bb={'botAlias':_0xe39e('0x2b'),'botName':_0x52bbde[0x3],'inputText':this['message'][_0xe39e('0x1f')],'userId':this[_0xe39e('0x14')]+':'+this[_0xe39e('0x18')]['id']['toString']()};_0x32a8be[_0xe39e('0x2c')](_0xeb14bb,function(_0x48f7a5,_0xc30220){if(_0x48f7a5){logger[_0xe39e('0x24')]('[%s][AMAZONLEX]\x20%s',_0x3d93d7,_0x48f7a5[_0xe39e('0x2d')]);_0x2c9505[_0xe39e('0xf')]();}else if(_0xc30220&&_0xc30220[_0xe39e('0x2d')]){_0x5a4931[_0xe39e('0x1f')][_0xe39e('0x2e')]=_0xc30220;_0x4caa76['body']=_0xc30220[_0xe39e('0x2d')];_0x4caa76['providerName']=_0xe39e('0x2e');_0x4caa76['providerResponse']=JSON[_0xe39e('0x25')](_0xc30220);return rpc[_0x596363+_0xe39e('0x2f')]['create'](_0x4caa76)[_0xe39e('0x30')](function(_0x3071c9){logger[_0xe39e('0xd')](_0xe39e('0x22'),_0x3d93d7,_0x4caa76[_0xe39e('0x1f')]);if(_0xc30220[_0xe39e('0x31')]==_0xe39e('0x32')){_0x2c9505[_0xe39e('0xf')]();}else{_0x2c9505[_0xe39e('0x28')]();}})[_0xe39e('0x23')](function(_0x160558){logger[_0xe39e('0x24')](_0xe39e('0x22'),_0x3d93d7,JSON['stringify'](_0x160558));_0x2c9505['next']();});}else{_0x2c9505[_0xe39e('0xf')]();}});}}catch(_0xa47b39){logger['error']('[%s][AMAZONLEX]\x20%s',_0x3d93d7,JSON[_0xe39e('0x25')](_0xa47b39));_0x2c9505['stop']();}};}; \ No newline at end of file +var _0x7152=['providerResponse','dialogState','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','channel','sms','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','message','amazonlex','providerName'];(function(_0x4daf2e,_0x56b3aa){var _0x176739=function(_0x29c65c){while(--_0x29c65c){_0x4daf2e['push'](_0x4daf2e['shift']());}};_0x176739(++_0x56b3aa);}(_0x7152,0x1b3));var _0x2715=function(_0x30099e,_0x1ee4b2){_0x30099e=_0x30099e-0x0;var _0x474f63=_0x7152[_0x30099e];return _0x474f63;};'use strict';var _=require(_0x2715('0x0'));var moment=require('moment');var AWS=require(_0x2715('0x1'));var utils=require(_0x2715('0x2'));var logger=require(_0x2715('0x3'))(_0x2715('0x4'));var rpc={'chatMessage':require(_0x2715('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2715('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x2715('0x7'))};exports[_0x2715('0x8')]=function(_0x5b59b8,_0x1bd1b3){return function(_0x2c8bc3){try{if(!_[_0x2715('0x9')](this[_0x2715('0xa')][_0x2715('0xb')])){logger['info'](_0x2715('0xc'),_0x5b59b8,_0x2715('0xd'));return _0x2c8bc3[_0x2715('0xe')]();}var _0x5571fe={'ContactId':this['contact']['id'],'sentAt':moment()[_0x2715('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2715('0x10')};if(this[_0x2715('0x11')]===_0x2715('0x12')||this[_0x2715('0x11')]==='whatsapp'){_0x5571fe[_0x2715('0x13')]=this['interaction']['phone'];}var _0x1651de=this[_0x2715('0x11')];if(_0x1651de===_0x2715('0x14')){_0x5571fe['ChatWebsiteId']=this[_0x2715('0x15')]['id'];}else{_0x5571fe[_[_0x2715('0x16')](_0x1651de)+_0x2715('0x17')]=this[_0x2715('0x15')]['id'];}_0x5571fe[_[_0x2715('0x16')](_0x1651de)+_0x2715('0x18')]=this[_0x2715('0xa')]['id'];if(this[_0x2715('0xa')][_0x2715('0x19')]){var _0xd7dcfd=_0x1bd1b3[0x4];if(!_[_0x2715('0x1a')](_0xd7dcfd)){_0x5571fe[_0x2715('0x1b')]=utils[_0x2715('0x1c')](_0xd7dcfd,this);return rpc[_0x1651de+_0x2715('0x1d')][_0x2715('0x1e')](_0x5571fe)[_0x2715('0x1f')](function(_0x4b79c0){logger[_0x2715('0x20')](_0x2715('0xc'),_0x5b59b8,_0x5571fe[_0x2715('0x1b')]);})['catch'](function(_0x5420bb){logger[_0x2715('0x21')](_0x2715('0xc'),_0x5b59b8,JSON[_0x2715('0x22')](_0x5420bb));})[_0x2715('0x23')](function(){logger[_0x2715('0x20')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5b59b8);_0x2c8bc3[_0x2715('0x24')]();});}else{logger['info'](_0x2715('0x25'),_0x5b59b8);_0x2c8bc3[_0x2715('0x24')]();}}else{var _0x5774a5=this;var _0xae1e5=new AWS[(_0x2715('0x26'))]({'accessKeyId':_0x1bd1b3[0x0],'secretAccessKey':_0x1bd1b3[0x1],'region':_0x1bd1b3[0x2]});var _0x4a1732={'botAlias':_0x2715('0x27'),'botName':_0x1bd1b3[0x3],'inputText':this['message']['body'],'userId':this['channel']+':'+this[_0x2715('0xa')]['id'][_0x2715('0x28')]()};_0xae1e5[_0x2715('0x29')](_0x4a1732,function(_0x4c602d,_0x402160){if(_0x4c602d){logger[_0x2715('0x21')](_0x2715('0xc'),_0x5b59b8,_0x4c602d[_0x2715('0x2a')]);_0x2c8bc3[_0x2715('0xe')]();}else if(_0x402160&&_0x402160[_0x2715('0x2a')]){_0x5774a5[_0x2715('0x1b')][_0x2715('0x2b')]=_0x402160;_0x5571fe[_0x2715('0x1b')]=_0x402160[_0x2715('0x2a')];_0x5571fe[_0x2715('0x2c')]=_0x2715('0x2b');_0x5571fe[_0x2715('0x2d')]=JSON[_0x2715('0x22')](_0x402160);return rpc[_0x1651de+_0x2715('0x1d')][_0x2715('0x1e')](_0x5571fe)[_0x2715('0x1f')](function(_0x100706){logger[_0x2715('0x20')](_0x2715('0xc'),_0x5b59b8,_0x5571fe['body']);if(_0x402160[_0x2715('0x2e')]==_0x2715('0x2f')){_0x2c8bc3[_0x2715('0xe')]();}else{_0x2c8bc3[_0x2715('0x24')]();}})['catch'](function(_0x220aec){logger['error'](_0x2715('0xc'),_0x5b59b8,JSON['stringify'](_0x220aec));_0x2c8bc3[_0x2715('0xe')]();});}else{_0x2c8bc3[_0x2715('0xe')]();}});}}catch(_0x565068){logger[_0x2715('0x21')](_0x2715('0xc'),_0x5b59b8,JSON[_0x2715('0x22')](_0x565068));_0x2c8bc3[_0x2715('0x24')]();}};}; \ 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 d263c44..f83e242 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 _0xbb6d=['authentication','user','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../mailRpc','channel','mail','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','Message','Smtp','service','host','port','secure'];(function(_0x523909,_0x47f221){var _0x1d3b1e=function(_0x4651d8){while(--_0x4651d8){_0x523909['push'](_0x523909['shift']());}};_0x1d3b1e(++_0x47f221);}(_0xbb6d,0x187));var _0xdbb6=function(_0x4ba7f8,_0x2e6aa5){_0x4ba7f8=_0x4ba7f8-0x0;var _0x21a944=_0xbb6d[_0x4ba7f8];return _0x21a944;};'use strict';var _=require('lodash');var moment=require(_0xdbb6('0x0'));var utils=require(_0xdbb6('0x1'));var logger=require('../../../../config/logger')(_0xdbb6('0x2'));var rpc={'chatMessage':require(_0xdbb6('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xdbb6('0x4')),'smsMessage':require(_0xdbb6('0x5')),'faxMessage':require(_0xdbb6('0x6')),'whatsappMessage':require(_0xdbb6('0x7')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xdbb6('0x8')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xdbb6('0x9')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xdbb6('0xa'));exports['consequence']=function(_0x1e4953,_0x1e72c3,_0x2472ed,_0x273f42){return function(_0x7e88f4){try{var _0xd29423=this[_0xdbb6('0xb')];if(_0xd29423===_0xdbb6('0xc')&&_0x273f42['body']['isAutoreply']){logger['info']('[%s][AUTOREPLY]\x20%s',_0x1e4953,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x7e88f4['next']();}if(_0x1e72c3[0x0]==='1'&&(_[_0xdbb6('0xd')](this[_0xdbb6('0xe')]['created'])||!this[_0xdbb6('0xe')][_0xdbb6('0xf')])){logger[_0xdbb6('0x10')](_0xdbb6('0x11'),_0x1e4953,_0xdbb6('0x12'));return _0x7e88f4[_0xdbb6('0x13')]();}if(_0x1e72c3[0x0]==='2'&&this[_0xdbb6('0xe')][_0xdbb6('0x14')]){logger[_0xdbb6('0x10')](_0xdbb6('0x15'),_0x1e4953,_0xdbb6('0x16'));return _0x7e88f4[_0xdbb6('0x13')]();}var _0x4125d3={'ContactId':this[_0xdbb6('0x17')]['id'],'sentAt':moment()[_0xdbb6('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xdbb6('0x19')};if(this[_0xdbb6('0xb')]===_0xdbb6('0xc')){_0x4125d3[_0xdbb6('0x1a')]=utils[_0xdbb6('0x1b')](_0x1e72c3[0x2],this);}else{_0x4125d3[_0xdbb6('0x1a')]=utils[_0xdbb6('0x1b')](_0x1e72c3[0x1],this);}if(this['message']){_0x4125d3['to']=this[_0xdbb6('0x1c')][_0xdbb6('0x1d')]||'';if(this[_0xdbb6('0xb')]===_0xdbb6('0xc')&&_0x1e72c3[0x1]==='1'){_0x4125d3['cc']=this[_0xdbb6('0x1c')]['cc']||'';}_0x4125d3[_0xdbb6('0x1d')]=this[_0xdbb6('0x1c')]['to']||'';_0x4125d3[_0xdbb6('0x1e')]=this['message'][_0xdbb6('0x1e')]||'';_0x4125d3[_0xdbb6('0x1f')]=!![];if(this[_0xdbb6('0x1c')][_0xdbb6('0x20')]){_0x4125d3['subject']='';_0x4125d3[_0xdbb6('0x20')]+=_[_0xdbb6('0x21')](this[_0xdbb6('0x1c')][_0xdbb6('0x20')],'Re:')?'':_0xdbb6('0x22');_0x4125d3['subject']+=this['message'][_0xdbb6('0x20')];}}if(this[_0xdbb6('0xb')]===_0xdbb6('0x23')){_0x4125d3[_0xdbb6('0x24')]=this[_0xdbb6('0x25')]['id'];}else{_0x4125d3[_['upperFirst'](this[_0xdbb6('0xb')])+_0xdbb6('0x26')]=this[_0xdbb6('0x25')]['id'];}_0x4125d3[_[_0xdbb6('0x27')](this[_0xdbb6('0xb')])+_0xdbb6('0x28')]=this[_0xdbb6('0xe')]['id'];var _0x3d1bb2=this[_0xdbb6('0xe')];if(rpc[this[_0xdbb6('0xb')]+_0xdbb6('0x29')]){if(this['channel']==='mail'){var _0x265594={'tls':{'rejectUnauthorized':![]}};if(this[_0xdbb6('0x25')][_0xdbb6('0x2a')][_0xdbb6('0x2b')]){_0x265594[_0xdbb6('0x2b')]=this[_0xdbb6('0x25')][_0xdbb6('0x2a')]['service'];}else{_0x265594[_0xdbb6('0x2c')]=this[_0xdbb6('0x25')][_0xdbb6('0x2a')][_0xdbb6('0x2c')];_0x265594[_0xdbb6('0x2d')]=this[_0xdbb6('0x25')][_0xdbb6('0x2a')][_0xdbb6('0x2d')];_0x265594[_0xdbb6('0x2e')]=this[_0xdbb6('0x25')]['Smtp'][_0xdbb6('0x2e')];}if(this[_0xdbb6('0x25')][_0xdbb6('0x2a')][_0xdbb6('0x2f')]){_0x265594['auth']={'user':this[_0xdbb6('0x25')][_0xdbb6('0x2a')][_0xdbb6('0x30')],'pass':this['account'][_0xdbb6('0x2a')]['pass']};}_0x4125d3[_0xdbb6('0x31')]=this[_0xdbb6('0x1c')][_0xdbb6('0x32')];_0x4125d3[_0xdbb6('0x33')]=_0xdbb6('0x34')+_[_0xdbb6('0x35')](_0x4125d3[_0xdbb6('0x1a')],_0xdbb6('0x36'),'','';_0x854dd1[_0x8c59('0x39')]={'Auto-Submitted':_0x8c59('0x3a'),'X-Auto-Response-Suppress':_0x8c59('0x3b'),'Precedence':_0x8c59('0x3c')};return mailRpc['sendMailMessage'](_0x23788a,_0x854dd1)[_0x8c59('0x3d')](function(_0x9e2129){logger[_0x8c59('0x10')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x51f68c);_0x854dd1[_0x8c59('0x3e')]=_0x9e2129[_0x8c59('0x1f')][_0x8c59('0x3e')];return rpc[_0x20bf80+_0x8c59('0x2c')][_0x8c59('0x3f')](_0x854dd1);})[_0x8c59('0x3d')](function(_0x443283){logger[_0x8c59('0x10')](_0x8c59('0x11'),_0x51f68c,JSON[_0x8c59('0x40')](_0x443283));})[_0x8c59('0x41')](function(_0x2d2374){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x51f68c,JSON[_0x8c59('0x40')](_0x2d2374));})[_0x8c59('0x42')](function(){Promise['resolve']()[_0x8c59('0x3d')](function(){if(_0x535f40[0x0]!=='2'||_0x55cafd[_0x8c59('0x17')])return;return rpc[_0x20bf80+_0x8c59('0x43')][_0x8c59('0x44')](_0x55cafd['id'],{'autoreplyExecuted':!![]})[_0x8c59('0x3d')](function(_0x295805){logger[_0x8c59('0x10')](_0x8c59('0x18'),_0x51f68c,JSON['stringify'](_0x295805));})[_0x8c59('0x41')](function(_0x57423b){logger[_0x8c59('0x45')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x51f68c,JSON[_0x8c59('0x40')](_0x57423b));});})[_0x8c59('0x3d')](function(){_0x24a583['next']();});});}else{return rpc[this[_0x8c59('0xd')]+_0x8c59('0x2c')]['create'](_0x854dd1)[_0x8c59('0x3d')](function(_0x12b2e8){logger[_0x8c59('0x10')](_0x8c59('0x11'),_0x51f68c,_0x854dd1[_0x8c59('0xe')]);})[_0x8c59('0x41')](function(_0x31dc23){logger[_0x8c59('0x45')](_0x8c59('0x11'),_0x51f68c,JSON[_0x8c59('0x40')](_0x31dc23));})['finally'](function(){Promise[_0x8c59('0x46')]()[_0x8c59('0x3d')](function(){if(_0x535f40[0x0]!=='2'||_0x55cafd[_0x8c59('0x17')])return;return rpc[_0x20bf80+_0x8c59('0x43')][_0x8c59('0x44')](_0x55cafd['id'],{'autoreplyExecuted':!![]})[_0x8c59('0x3d')](function(_0x3d20f9){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x51f68c,JSON[_0x8c59('0x40')](_0x3d20f9));})[_0x8c59('0x41')](function(_0x5ba7bc){logger[_0x8c59('0x45')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x51f68c,JSON[_0x8c59('0x40')](_0x5ba7bc));});})['then'](function(){_0x24a583['next']();});});}}}catch(_0x3be0e8){logger['error'](_0x8c59('0x11'),_0x51f68c,JSON[_0x8c59('0x40')](_0x3be0e8));_0x24a583[_0x8c59('0x47')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index fe0be9e..25c5591 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28c6=['moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x28c6,0xb8));var _0x628c=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0x28c6[_0x5179a5];return _0x15c8ce;};'use strict';var moment=require(_0x628c('0x0'));var logger=require(_0x628c('0x1'))(_0x628c('0x2'));var rpc={'chatInteraction':require(_0x628c('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x628c('0x4')),'mailInteraction':require(_0x628c('0x5')),'faxInteraction':require(_0x628c('0x6')),'whatsappInteraction':require(_0x628c('0x7'))};exports[_0x628c('0x8')]=function(_0x1dc73d,_0x117ab3,_0x4c5abf,_0x3b43d7){return function(_0xf9aeb4){try{logger[_0x628c('0x9')](_0x628c('0xa'),_0x1dc73d,_0x117ab3[0x0]);var _0x276d3c={'closed':0x1,'closedAt':moment()[_0x628c('0xb')](_0x628c('0xc')),'closeReason':_0x628c('0xd'),'disposition':_0x117ab3[0x0]};if(rpc[_0x3b43d7[_0x628c('0xe')]+_0x628c('0xf')]){rpc[_0x3b43d7[_0x628c('0xe')]+'Interaction']['update'](_0x3b43d7[_0x628c('0x10')]['id'],_0x276d3c)['then'](function(_0x479c5f){logger[_0x628c('0x9')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x1dc73d,_0x3b43d7[_0x628c('0x10')]['id']);})[_0x628c('0x11')](function(_0x42f890){logger[_0x628c('0x12')](_0x628c('0x13'),_0x1dc73d,JSON[_0x628c('0x14')](_0x42f890));})[_0x628c('0x15')](function(){_0xf9aeb4[_0x628c('0x16')]();});}}catch(_0x1a8d80){logger[_0x628c('0x12')]('[%s][CLOSE]\x20%s',_0x1dc73d,JSON[_0x628c('0x14')](_0x1a8d80));_0xf9aeb4['stop']();}};}; \ No newline at end of file +var _0x4f4d=['routing','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','channel','update','interaction','then','catch','error','[%s][CLOSE]\x20%s','finally','stop','moment','../../../../config/logger'];(function(_0x49a8b6,_0x2ca700){var _0xc30a33=function(_0x52f7e4){while(--_0x52f7e4){_0x49a8b6['push'](_0x49a8b6['shift']());}};_0xc30a33(++_0x2ca700);}(_0x4f4d,0x108));var _0xd4f4=function(_0x4d3d50,_0x50f156){_0x4d3d50=_0x4d3d50-0x0;var _0x175e6d=_0x4f4d[_0x4d3d50];return _0x175e6d;};'use strict';var moment=require(_0xd4f4('0x0'));var logger=require(_0xd4f4('0x1'))(_0xd4f4('0x2'));var rpc={'chatInteraction':require(_0xd4f4('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xd4f4('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xd4f4('0x5'))};exports[_0xd4f4('0x6')]=function(_0x43912f,_0x53ae6e,_0x5f3653,_0x6ad6a8){return function(_0x3cbdb6){try{logger[_0xd4f4('0x7')](_0xd4f4('0x8'),_0x43912f,_0x53ae6e[0x0]);var _0x38601d={'closed':0x1,'closedAt':moment()['format'](_0xd4f4('0x9')),'closeReason':'system','disposition':_0x53ae6e[0x0]};if(rpc[_0x6ad6a8[_0xd4f4('0xa')]+'Interaction']){rpc[_0x6ad6a8[_0xd4f4('0xa')]+'Interaction'][_0xd4f4('0xb')](_0x6ad6a8[_0xd4f4('0xc')]['id'],_0x38601d)[_0xd4f4('0xd')](function(_0x227a03){logger[_0xd4f4('0x7')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x43912f,_0x6ad6a8[_0xd4f4('0xc')]['id']);})[_0xd4f4('0xe')](function(_0x2ab7bd){logger[_0xd4f4('0xf')](_0xd4f4('0x10'),_0x43912f,JSON['stringify'](_0x2ab7bd));})[_0xd4f4('0x11')](function(){_0x3cbdb6['stop']();});}}catch(_0x2b639c){logger[_0xd4f4('0xf')](_0xd4f4('0x10'),_0x43912f,JSON['stringify'](_0x2b639c));_0x3cbdb6[_0xd4f4('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 3e941ff..6a39998 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc962=['speech','providerName','providerResponse','metadata','endConversation','error','next','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment'];(function(_0x47c558,_0x1664ca){var _0xb8991=function(_0x183454){while(--_0x183454){_0x47c558['push'](_0x47c558['shift']());}};_0xb8991(++_0x1664ca);}(_0xc962,0x6d));var _0x2c96=function(_0x43f63c,_0x2716f3){_0x43f63c=_0x43f63c-0x0;var _0x32795c=_0xc962[_0x43f63c];return _0x32795c;};'use strict';var _=require(_0x2c96('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x2c96('0x1'));var logger=require(_0x2c96('0x2'))(_0x2c96('0x3'));var rpc={'chatMessage':require(_0x2c96('0x4')),'openchannelMessage':require(_0x2c96('0x5')),'mailMessage':require(_0x2c96('0x6')),'smsMessage':require(_0x2c96('0x7')),'faxMessage':require(_0x2c96('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x2c96('0x9')]=function(_0x2df446,_0x1f9859){return function(_0x17a493){try{if(!_[_0x2c96('0xa')](this[_0x2c96('0xb')][_0x2c96('0xc')])){logger[_0x2c96('0xd')](_0x2c96('0xe'),_0x2df446,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x17a493['next']();}var _0x238c6b={'ContactId':this[_0x2c96('0xf')]['id'],'sentAt':moment()[_0x2c96('0x10')](_0x2c96('0x11')),'direction':_0x2c96('0x12')};if(this[_0x2c96('0x13')]==='sms'||this['channel']===_0x2c96('0x14')){_0x238c6b[_0x2c96('0x15')]=this[_0x2c96('0xb')][_0x2c96('0x15')];}var _0x188e75=this[_0x2c96('0x13')];if(_0x188e75===_0x2c96('0x16')){_0x238c6b['ChatWebsiteId']=this['account']['id'];}else{_0x238c6b[_['upperFirst'](_0x188e75)+_0x2c96('0x17')]=this[_0x2c96('0x18')]['id'];}_0x238c6b[_['upperFirst'](_0x188e75)+_0x2c96('0x19')]=this[_0x2c96('0xb')]['id'];if(this['interaction'][_0x2c96('0x1a')]){var _0x3232c0=_0x1f9859[0x2];if(!_[_0x2c96('0x1b')](_0x3232c0)){_0x238c6b[_0x2c96('0x1c')]=utils[_0x2c96('0x1d')](_0x3232c0,this);return rpc[_0x188e75+_0x2c96('0x1e')][_0x2c96('0x1f')](_0x238c6b)[_0x2c96('0x20')](function(_0x3fde3e){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x2df446,_0x238c6b[_0x2c96('0x1c')]);})[_0x2c96('0x21')](function(_0x4001a9){logger['error'](_0x2c96('0xe'),_0x2df446,JSON[_0x2c96('0x22')](_0x4001a9));})[_0x2c96('0x23')](function(){logger['info'](_0x2c96('0x24'),_0x2df446);_0x17a493[_0x2c96('0x25')]();});}else{logger['info'](_0x2c96('0x26'),_0x2df446);_0x17a493[_0x2c96('0x25')]();}}else{var _0x361e42=this;var _0x14daf1=apiai(_0x1f9859[0x0],{'language':_0x1f9859[0x1]||'en'});return _0x14daf1[_0x2c96('0x27')](this[_0x2c96('0x28')][_0x2c96('0x1c')],{'sessionId':md5(this['interaction']['id'])})[_0x2c96('0x20')](function(_0x58933c){_0x361e42['body'][_0x2c96('0x29')]=_0x58933c;_0x238c6b['body']=_0x58933c[_0x2c96('0x2a')][_0x2c96('0x2b')][_0x2c96('0x2c')];_0x238c6b[_0x2c96('0x2d')]='dialogflow';_0x238c6b[_0x2c96('0x2e')]=JSON[_0x2c96('0x22')](_0x58933c);return rpc[_0x188e75+'Message'][_0x2c96('0x1f')](_0x238c6b)[_0x2c96('0x20')](function(_0x200951){logger[_0x2c96('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x2df446,_0x238c6b[_0x2c96('0x1c')]);if(_0x58933c[_0x2c96('0x2a')][_0x2c96('0x2f')][_0x2c96('0x30')]){_0x17a493['next']();}else{_0x17a493[_0x2c96('0x25')]();}})[_0x2c96('0x21')](function(_0x5eea2f){logger[_0x2c96('0x31')]('[%s][DIALOGFLOW]\x20%s',_0x2df446,JSON[_0x2c96('0x22')](_0x5eea2f));_0x17a493[_0x2c96('0x32')]();});})[_0x2c96('0x21')](function(_0x363da9){logger[_0x2c96('0x31')](_0x2c96('0xe'),_0x2df446,_0x363da9[_0x2c96('0x28')]);_0x17a493[_0x2c96('0x32')]();});}}catch(_0x5b73c3){logger[_0x2c96('0x31')](_0x2c96('0xe'),_0x2df446,JSON[_0x2c96('0x22')](_0x5b73c3));_0x17a493['stop']();}};}; \ No newline at end of file +var _0x1b65=['info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','providerName','providerResponse','endConversation','next','error','lodash','moment','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','[%s][DIALOGFLOW]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','body','getMustacheRender','Message','create','then','catch','stringify','finally'];(function(_0x1fc2fd,_0x1c4832){var _0x329755=function(_0x249e88){while(--_0x249e88){_0x1fc2fd['push'](_0x1fc2fd['shift']());}};_0x329755(++_0x1c4832);}(_0x1b65,0x1b4));var _0x51b6=function(_0x49a0b9,_0x8201dd){_0x49a0b9=_0x49a0b9-0x0;var _0x457f3e=_0x1b65[_0x49a0b9];return _0x457f3e;};'use strict';var _=require(_0x51b6('0x0'));var moment=require(_0x51b6('0x1'));var apiai=require(_0x51b6('0x2'));var md5=require(_0x51b6('0x3'));var utils=require('./utils');var logger=require(_0x51b6('0x4'))(_0x51b6('0x5'));var rpc={'chatMessage':require(_0x51b6('0x6')),'openchannelMessage':require(_0x51b6('0x7')),'mailMessage':require(_0x51b6('0x8')),'smsMessage':require(_0x51b6('0x9')),'faxMessage':require(_0x51b6('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x51b6('0xb')]=function(_0xecac96,_0x2c6926){return function(_0x16459f){try{if(!_['isNil'](this[_0x51b6('0xc')][_0x51b6('0xd')])){logger['info'](_0x51b6('0xe'),_0xecac96,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x16459f['next']();}var _0x1cf35d={'ContactId':this[_0x51b6('0xf')]['id'],'sentAt':moment()[_0x51b6('0x10')](_0x51b6('0x11')),'direction':_0x51b6('0x12')};if(this['channel']==='sms'||this[_0x51b6('0x13')]==='whatsapp'){_0x1cf35d['phone']=this[_0x51b6('0xc')]['phone'];}var _0x2c2aff=this['channel'];if(_0x2c2aff===_0x51b6('0x14')){_0x1cf35d[_0x51b6('0x15')]=this[_0x51b6('0x16')]['id'];}else{_0x1cf35d[_[_0x51b6('0x17')](_0x2c2aff)+_0x51b6('0x18')]=this[_0x51b6('0x16')]['id'];}_0x1cf35d[_['upperFirst'](_0x2c2aff)+_0x51b6('0x19')]=this[_0x51b6('0xc')]['id'];if(this[_0x51b6('0xc')]['created']){var _0x4007b0=_0x2c6926[0x2];if(!_['isEmpty'](_0x4007b0)){_0x1cf35d[_0x51b6('0x1a')]=utils[_0x51b6('0x1b')](_0x4007b0,this);return rpc[_0x2c2aff+_0x51b6('0x1c')][_0x51b6('0x1d')](_0x1cf35d)[_0x51b6('0x1e')](function(_0x22c6da){logger['info'](_0x51b6('0xe'),_0xecac96,_0x1cf35d['body']);})[_0x51b6('0x1f')](function(_0x444da9){logger['error'](_0x51b6('0xe'),_0xecac96,JSON[_0x51b6('0x20')](_0x444da9));})[_0x51b6('0x21')](function(){logger[_0x51b6('0x22')](_0x51b6('0x23'),_0xecac96);_0x16459f[_0x51b6('0x24')]();});}else{logger[_0x51b6('0x22')](_0x51b6('0x25'),_0xecac96);_0x16459f['stop']();}}else{var _0x35d2ab=this;var _0x11db4e=apiai(_0x2c6926[0x0],{'language':_0x2c6926[0x1]||'en'});return _0x11db4e[_0x51b6('0x26')](this[_0x51b6('0x27')]['body'],{'sessionId':md5(this[_0x51b6('0xc')]['id'])})[_0x51b6('0x1e')](function(_0x51c013){_0x35d2ab['body'][_0x51b6('0x28')]=_0x51c013;_0x1cf35d[_0x51b6('0x1a')]=_0x51c013[_0x51b6('0x29')]['fulfillment']['speech'];_0x1cf35d[_0x51b6('0x2a')]=_0x51b6('0x28');_0x1cf35d[_0x51b6('0x2b')]=JSON['stringify'](_0x51c013);return rpc[_0x2c2aff+_0x51b6('0x1c')][_0x51b6('0x1d')](_0x1cf35d)[_0x51b6('0x1e')](function(_0x2df2fa){logger[_0x51b6('0x22')](_0x51b6('0xe'),_0xecac96,_0x1cf35d[_0x51b6('0x1a')]);if(_0x51c013[_0x51b6('0x29')]['metadata'][_0x51b6('0x2c')]){_0x16459f[_0x51b6('0x2d')]();}else{_0x16459f[_0x51b6('0x24')]();}})['catch'](function(_0x38f855){logger[_0x51b6('0x2e')](_0x51b6('0xe'),_0xecac96,JSON[_0x51b6('0x20')](_0x38f855));_0x16459f['next']();});})[_0x51b6('0x1f')](function(_0x56532b){logger[_0x51b6('0x2e')](_0x51b6('0xe'),_0xecac96,_0x56532b['message']);_0x16459f['next']();});}}catch(_0x560381){logger[_0x51b6('0x2e')]('[%s][DIALOGFLOW]\x20%s',_0xecac96,JSON[_0x51b6('0x20')](_0x560381));_0x16459f[_0x51b6('0x24')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 0045161..4d2f468 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x018c=['allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','length','fulfillmentText','all','lodash','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','upperFirst','AccountId','account','InteractionId','created','getMustacheRender','create','then','finally','stop','replace','SessionsClient','sessionPath','message','detectIntent','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0x018c,0x9f));var _0xc018=function(_0x55351e,_0x445856){_0x55351e=_0x55351e-0x0;var _0x5ab293=_0x018c[_0x55351e];return _0x5ab293;};'use strict';var _=require(_0xc018('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xc018('0x1'));var moment=require(_0xc018('0x2'));var Promise=require(_0xc018('0x3'));var logger=require('../../../../config/logger')(_0xc018('0x4'));var utils=require(_0xc018('0x5'));var rpc={'chatMessage':require(_0xc018('0x6')),'openchannelMessage':require(_0xc018('0x7')),'mailMessage':require(_0xc018('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc018('0x9')),'whatsappMessage':require(_0xc018('0xa'))};function createMessage(_0x5ce830,_0x5ee469,_0x332292,_0x4cf717){return new Promise(function(_0x4b393b,_0x5dcaa5){var _0x2f7d12=_['clone'](_0x332292);_0x2f7d12[_0xc018('0xb')]=_0x4cf717;return rpc[_0x5ee469+_0xc018('0xc')]['create'](_0x2f7d12)['then'](function(){logger[_0xc018('0xd')](_0xc018('0xe'),_0x5ce830,_0x2f7d12[_0xc018('0xb')]);_0x4b393b();})[_0xc018('0xf')](function(_0xc8473a){logger[_0xc018('0x10')](_0xc018('0xe'),_0x5ce830,JSON[_0xc018('0x11')](_0xc8473a));_0x5dcaa5(_0xc8473a);});});}exports[_0xc018('0x12')]=function(_0x37a696,_0x557694){return function(_0x48b210){try{if(!_[_0xc018('0x13')](this[_0xc018('0x14')]['UserId'])){logger[_0xc018('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x37a696,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x48b210[_0xc018('0x15')]();}var _0x289d75={'ContactId':this[_0xc018('0x16')]['id'],'sentAt':moment()[_0xc018('0x17')](_0xc018('0x18')),'direction':'out'};if(this[_0xc018('0x19')]===_0xc018('0x1a')||this[_0xc018('0x19')]===_0xc018('0x1b')){_0x289d75[_0xc018('0x1c')]=this[_0xc018('0x14')][_0xc018('0x1c')];}var _0xe39b0c=this[_0xc018('0x19')];if(_0xe39b0c===_0xc018('0x1d')){_0x289d75['ChatWebsiteId']=this['account']['id'];}else{_0x289d75[_[_0xc018('0x1e')](_0xe39b0c)+_0xc018('0x1f')]=this[_0xc018('0x20')]['id'];}_0x289d75[_[_0xc018('0x1e')](_0xe39b0c)+_0xc018('0x21')]=this[_0xc018('0x14')]['id'];if(this[_0xc018('0x14')][_0xc018('0x22')]){var _0x15f175=_0x557694[0x4];if(!_['isEmpty'](_0x15f175)){_0x289d75[_0xc018('0xb')]=utils[_0xc018('0x23')](_0x15f175,this);return rpc[_0xe39b0c+_0xc018('0xc')][_0xc018('0x24')](_0x289d75)[_0xc018('0x25')](function(_0x1f672a){logger[_0xc018('0xd')](_0xc018('0xe'),_0x37a696,_0x289d75[_0xc018('0xb')]);})[_0xc018('0xf')](function(_0x3e92b2){logger['error'](_0xc018('0xe'),_0x37a696,JSON[_0xc018('0x11')](_0x3e92b2));})[_0xc018('0x26')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x37a696);_0x48b210[_0xc018('0x27')]();});}else{logger[_0xc018('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x37a696);_0x48b210['stop']();}}else{var _0x4fc6db=this;var _0x5371e5=_0x557694[0x2][_0xc018('0x28')](/\\n/g,'\x0a');var _0x6c3e34={'credentials':{'private_key':_0x5371e5,'client_email':_0x557694[0x1]}};var _0x5ef8ea=new dialogflow[(_0xc018('0x29'))](_0x6c3e34);var _0x2bd3fa=_0x5ef8ea[_0xc018('0x2a')](_0x557694[0x0],md5(_0x4fc6db['interaction']['id']));var _0x56d57a={'session':_0x2bd3fa,'queryInput':{'text':{'text':_0x4fc6db[_0xc018('0x2b')][_0xc018('0xb')],'languageCode':_0x557694[0x3]||'en'}}};return _0x5ef8ea[_0xc018('0x2c')](_0x56d57a)['then'](function(_0x104627){if(_0x104627&&_0x104627['length']){_0x4fc6db[_0xc018('0xb')][_0xc018('0x2d')]=_0x104627;var _0x2fda98=_0x104627[0x0];var _0x306edd=_0x2fda98['queryResult'][_0xc018('0x2e')]&&_0x2fda98[_0xc018('0x2f')][_0xc018('0x2e')][_0xc018('0x30')]?_0x2fda98[_0xc018('0x2f')][_0xc018('0x2e')][_0xc018('0x30')][_0xc018('0x31')][_0xc018('0x32')]:![];_0x4fc6db[_0xc018('0xb')][_0xc018('0x33')]=_0x2fda98[_0xc018('0x2f')][_0xc018('0x34')];_0x4fc6db['body'][_0xc018('0x35')]=_0x2fda98[_0xc018('0x2f')][_0xc018('0x36')];_0x4fc6db['body'][_0xc018('0x37')]=_0x2fda98['queryResult']['diagnosticInfo']&&_0x2fda98[_0xc018('0x2f')]['diagnosticInfo'][_0xc018('0x30')]?_0x2fda98['queryResult']['diagnosticInfo'][_0xc018('0x30')][_0xc018('0x31')][_0xc018('0x32')]:![];_0x4fc6db[_0xc018('0xb')][_0xc018('0x38')]=_0x2fda98[_0xc018('0x2f')]['intent']['name'];_0x4fc6db[_0xc018('0xb')][_0xc018('0x39')]=_0x2fda98[_0xc018('0x2f')]['intent'][_0xc018('0x3a')];_0x4fc6db[_0xc018('0xb')][_0xc018('0x3b')]=_0x2fda98['queryResult'][_0xc018('0x3c')][_0xc018('0x3d')];_0x4fc6db[_0xc018('0xb')][_0xc018('0x3e')]=_0x2fda98[_0xc018('0x2f')]['languageCode'];_0x4fc6db[_0xc018('0xb')][_0xc018('0x3f')]=_0x2fda98[_0xc018('0x2f')][_0xc018('0x40')];_0x4fc6db[_0xc018('0xb')][_0xc018('0x41')]=_0x2fda98[_0xc018('0x2f')]['intentDetectionConfidence'];_0x289d75[_0xc018('0x42')]=_0xc018('0x2d');_0x289d75[_0xc018('0x43')]=JSON[_0xc018('0x11')](_0x104627);var _0x2fbfd1=[];for(var _0x294cbe=0x0;_0x294cbe<_0x104627[_0xc018('0x44')];_0x294cbe++){var _0x6543f2=_0x104627[_0x294cbe];if(_0x6543f2&&_0x6543f2[_0xc018('0x2f')]&&_0x6543f2[_0xc018('0x2f')][_0xc018('0x45')]){_0x2fbfd1['push'](createMessage(_0x37a696,_0xe39b0c,_0x289d75,_0x6543f2[_0xc018('0x2f')][_0xc018('0x45')]));}}return Promise[_0xc018('0x46')](_0x2fbfd1)[_0xc018('0x25')](function(){if(_0x306edd){_0x48b210[_0xc018('0x15')]();}else{_0x48b210[_0xc018('0x27')]();}})[_0xc018('0xf')](function(_0x2e2995){logger[_0xc018('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x37a696,JSON[_0xc018('0x11')](_0x2e2995));_0x48b210[_0xc018('0x15')]();});}})['catch'](function(_0x6fbb7b){logger[_0xc018('0x10')](_0xc018('0xe'),_0x37a696,_0x6fbb7b[_0xc018('0x2b')]);_0x48b210['next']();});}}catch(_0x4ff12e){logger[_0xc018('0x10')](_0xc018('0xe'),_0x37a696,JSON[_0xc018('0x11')](_0x4ff12e));_0x48b210['stop']();}};}; \ No newline at end of file +var _0x4ee1=['diagnosticInfo','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','fields','end_conversation','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','fulfillmentText','all','lodash','dialogflow','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','create','then','[%s][DIALOGFLOWV2]\x20%s','body','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','created','isEmpty','getMustacheRender','Message','catch','error','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','detectIntent','length','queryResult'];(function(_0x15b932,_0x39ba3f){var _0x28fa64=function(_0x479c8a){while(--_0x479c8a){_0x15b932['push'](_0x15b932['shift']());}};_0x28fa64(++_0x39ba3f);}(_0x4ee1,0x1a5));var _0x14ee=function(_0x4f9820,_0x31624f){_0x4f9820=_0x4f9820-0x0;var _0x9f22a7=_0x4ee1[_0x4f9820];return _0x9f22a7;};'use strict';var _=require(_0x14ee('0x0'));var dialogflow=require(_0x14ee('0x1'));var md5=require('md5');var moment=require('moment');var Promise=require('bluebird');var logger=require(_0x14ee('0x2'))(_0x14ee('0x3'));var utils=require(_0x14ee('0x4'));var rpc={'chatMessage':require(_0x14ee('0x5')),'openchannelMessage':require(_0x14ee('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x14ee('0x7')),'faxMessage':require(_0x14ee('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x28cd44,_0x412e39,_0x5b3cee,_0x53f5cf){return new Promise(function(_0x5758ac,_0x1f23d5){var _0x49d035=_[_0x14ee('0x9')](_0x5b3cee);_0x49d035['body']=_0x53f5cf;return rpc[_0x412e39+'Message'][_0x14ee('0xa')](_0x49d035)[_0x14ee('0xb')](function(){logger['info'](_0x14ee('0xc'),_0x28cd44,_0x49d035[_0x14ee('0xd')]);_0x5758ac();})['catch'](function(_0x57bbf7){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x28cd44,JSON['stringify'](_0x57bbf7));_0x1f23d5(_0x57bbf7);});});}exports[_0x14ee('0xe')]=function(_0x2d55d7,_0x23e865){return function(_0x256f7b){try{if(!_[_0x14ee('0xf')](this[_0x14ee('0x10')][_0x14ee('0x11')])){logger[_0x14ee('0x12')](_0x14ee('0xc'),_0x2d55d7,_0x14ee('0x13'));return _0x256f7b[_0x14ee('0x14')]();}var _0x3a353f={'ContactId':this['contact']['id'],'sentAt':moment()[_0x14ee('0x15')](_0x14ee('0x16')),'direction':_0x14ee('0x17')};if(this[_0x14ee('0x18')]===_0x14ee('0x19')||this[_0x14ee('0x18')]==='whatsapp'){_0x3a353f[_0x14ee('0x1a')]=this[_0x14ee('0x10')][_0x14ee('0x1a')];}var _0x33d7e3=this[_0x14ee('0x18')];if(_0x33d7e3===_0x14ee('0x1b')){_0x3a353f[_0x14ee('0x1c')]=this['account']['id'];}else{_0x3a353f[_[_0x14ee('0x1d')](_0x33d7e3)+_0x14ee('0x1e')]=this[_0x14ee('0x1f')]['id'];}_0x3a353f[_[_0x14ee('0x1d')](_0x33d7e3)+'InteractionId']=this[_0x14ee('0x10')]['id'];if(this[_0x14ee('0x10')][_0x14ee('0x20')]){var _0x59c8ff=_0x23e865[0x4];if(!_[_0x14ee('0x21')](_0x59c8ff)){_0x3a353f[_0x14ee('0xd')]=utils[_0x14ee('0x22')](_0x59c8ff,this);return rpc[_0x33d7e3+_0x14ee('0x23')]['create'](_0x3a353f)[_0x14ee('0xb')](function(_0x597872){logger[_0x14ee('0x12')](_0x14ee('0xc'),_0x2d55d7,_0x3a353f['body']);})[_0x14ee('0x24')](function(_0x48f344){logger[_0x14ee('0x25')]('[%s][DIALOGFLOWV2]\x20%s',_0x2d55d7,JSON[_0x14ee('0x26')](_0x48f344));})[_0x14ee('0x27')](function(){logger[_0x14ee('0x12')](_0x14ee('0x28'),_0x2d55d7);_0x256f7b[_0x14ee('0x29')]();});}else{logger[_0x14ee('0x12')](_0x14ee('0x2a'),_0x2d55d7);_0x256f7b['stop']();}}else{var _0x34049e=this;var _0x3e3102=_0x23e865[0x2]['replace'](/\\n/g,'\x0a');var _0x1800dc={'credentials':{'private_key':_0x3e3102,'client_email':_0x23e865[0x1]}};var _0x53c4c1=new dialogflow[(_0x14ee('0x2b'))](_0x1800dc);var _0x1d0d01=_0x53c4c1[_0x14ee('0x2c')](_0x23e865[0x0],md5(_0x34049e[_0x14ee('0x10')]['id']));var _0x448ba1={'session':_0x1d0d01,'queryInput':{'text':{'text':_0x34049e['message'][_0x14ee('0xd')],'languageCode':_0x23e865[0x3]||'en'}}};return _0x53c4c1[_0x14ee('0x2d')](_0x448ba1)[_0x14ee('0xb')](function(_0x5a4d0e){if(_0x5a4d0e&&_0x5a4d0e[_0x14ee('0x2e')]){_0x34049e[_0x14ee('0xd')]['dialogflowV2']=_0x5a4d0e;var _0x20c356=_0x5a4d0e[0x0];var _0x531195=_0x20c356[_0x14ee('0x2f')][_0x14ee('0x30')]&&_0x20c356[_0x14ee('0x2f')][_0x14ee('0x30')]['fields']?_0x20c356[_0x14ee('0x2f')][_0x14ee('0x30')]['fields']['end_conversation'][_0x14ee('0x31')]:![];_0x34049e[_0x14ee('0xd')][_0x14ee('0x32')]=_0x20c356[_0x14ee('0x2f')][_0x14ee('0x33')];_0x34049e[_0x14ee('0xd')][_0x14ee('0x34')]=_0x20c356['queryResult'][_0x14ee('0x35')];_0x34049e[_0x14ee('0xd')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x20c356[_0x14ee('0x2f')][_0x14ee('0x30')]&&_0x20c356[_0x14ee('0x2f')][_0x14ee('0x30')][_0x14ee('0x36')]?_0x20c356['queryResult'][_0x14ee('0x30')][_0x14ee('0x36')][_0x14ee('0x37')][_0x14ee('0x31')]:![];_0x34049e[_0x14ee('0xd')]['DIALOGFLOWV2_INTENTNAME']=_0x20c356[_0x14ee('0x2f')][_0x14ee('0x38')]['name'];_0x34049e[_0x14ee('0xd')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x20c356['queryResult'][_0x14ee('0x38')]['displayName'];_0x34049e[_0x14ee('0xd')][_0x14ee('0x39')]=_0x20c356[_0x14ee('0x2f')][_0x14ee('0x38')][_0x14ee('0x3a')];_0x34049e[_0x14ee('0xd')][_0x14ee('0x3b')]=_0x20c356[_0x14ee('0x2f')]['languageCode'];_0x34049e['body'][_0x14ee('0x3c')]=_0x20c356[_0x14ee('0x2f')]['queryText'];_0x34049e['body'][_0x14ee('0x3d')]=_0x20c356[_0x14ee('0x2f')][_0x14ee('0x3e')];_0x3a353f[_0x14ee('0x3f')]=_0x14ee('0x40');_0x3a353f['providerResponse']=JSON[_0x14ee('0x26')](_0x5a4d0e);var _0x43d909=[];for(var _0x1b2055=0x0;_0x1b2055<_0x5a4d0e[_0x14ee('0x2e')];_0x1b2055++){var _0x2158a1=_0x5a4d0e[_0x1b2055];if(_0x2158a1&&_0x2158a1[_0x14ee('0x2f')]&&_0x2158a1[_0x14ee('0x2f')][_0x14ee('0x41')]){_0x43d909['push'](createMessage(_0x2d55d7,_0x33d7e3,_0x3a353f,_0x2158a1[_0x14ee('0x2f')]['fulfillmentText']));}}return Promise[_0x14ee('0x42')](_0x43d909)[_0x14ee('0xb')](function(){if(_0x531195){_0x256f7b[_0x14ee('0x14')]();}else{_0x256f7b['stop']();}})['catch'](function(_0x1aad48){logger[_0x14ee('0x25')](_0x14ee('0xc'),_0x2d55d7,JSON[_0x14ee('0x26')](_0x1aad48));_0x256f7b[_0x14ee('0x14')]();});}})['catch'](function(_0x4622b7){logger[_0x14ee('0x25')](_0x14ee('0xc'),_0x2d55d7,_0x4622b7['message']);_0x256f7b[_0x14ee('0x14')]();});}}catch(_0x3b21c1){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x2d55d7,JSON[_0x14ee('0x26')](_0x3b21c1));_0x256f7b['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 6c4dd14..5ba052f 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x209f=['[%s][GOTOIF]\x20eval\x20error:\x20%s','message','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','length','error','[%s][GOTOIF]\x20%s','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x5dea2f,_0x5d5415){var _0x11b097=function(_0x28bcf3){while(--_0x28bcf3){_0x5dea2f['push'](_0x5dea2f['shift']());}};_0x11b097(++_0x5d5415);}(_0x209f,0x136));var _0xf209=function(_0xe5c58f,_0x79173c){_0xe5c58f=_0xe5c58f-0x0;var _0x1ea3b4=_0x209f[_0xe5c58f];return _0x1ea3b4;};'use strict';var schema=require(_0xf209('0x0'));var _=require(_0xf209('0x1'));var htmlToText=require(_0xf209('0x2'));var utils=require(_0xf209('0x3'));var logger=require(_0xf209('0x4'))(_0xf209('0x5'));var gotoif=schema({'condition':{'type':_0xf209('0x6'),'required':!![],'message':_0xf209('0x7')},'priorityTrue':{'type':_0xf209('0x8'),'message':_0xf209('0x9')},'priorityFalse':{'type':_0xf209('0x8'),'message':_0xf209('0xa')}});exports[_0xf209('0xb')]=function(_0x4d60be,_0xbf19f5){return function(_0x3df016){try{var _0xfaf20b={'condition':htmlToText[_0xf209('0xc')](utils['getMustacheRender'](_0xbf19f5[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xbf19f5[0x1],'priorityFalse':_0xbf19f5[0x2]};var _0x56f726=gotoif[_0xf209('0x0')](_0xfaf20b,{'typecast':!![]});if(_0x56f726[_0xf209('0xd')]){logger[_0xf209('0xe')](_0xf209('0xf'),_0x4d60be,_['map'](_0x56f726,'message')[_0xf209('0x10')](',\x20'));_0x3df016[_0xf209('0x11')]();}else{try{var _0x5a52b=eval('('+_0xfaf20b[_0xf209('0x12')]+')');var _0x3f6b44=_0x5a52b?_0xfaf20b[_0xf209('0x13')]:_0xfaf20b[_0xf209('0x14')];logger[_0xf209('0x15')](_0xf209('0x16'),_0x4d60be,_0xfaf20b[_0xf209('0x12')],_0x5a52b,_0x3f6b44||_0xf209('0x17'));if(_0x3f6b44){var _0x13ce79=_[_0xf209('0x18')](_0x3df016['rules'](),{'p':_0x3f6b44});if(_0x13ce79>=0x0){logger['info'](_0xf209('0x19'),_0x4d60be,_0x3f6b44||_0xf209('0x17'),_0x13ce79);_0x3df016['next'](_0x13ce79);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x4d60be,_0x3f6b44||_0xf209('0x17'));_0x3df016['stop']();}}else{_0x3df016[_0xf209('0x17')]();}}catch(_0x5583e9){logger[_0xf209('0xe')](_0xf209('0x1a'),_0x4d60be,_0x5583e9[_0xf209('0x1b')]);_0x3df016[_0xf209('0x11')]();}}}catch(_0x18a9a8){logger[_0xf209('0xe')](_0xf209('0xf'),_0x4d60be,JSON['stringify'](_0x18a9a8));_0x3df016[_0xf209('0x11')]();}};}; \ No newline at end of file +var _0x1927=['stringify','lodash','html-to-text','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','validate','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','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s'];(function(_0x124831,_0x3d5fd6){var _0x28e72=function(_0x42cf74){while(--_0x42cf74){_0x124831['push'](_0x124831['shift']());}};_0x28e72(++_0x3d5fd6);}(_0x1927,0x181));var _0x7192=function(_0x4684e9,_0x418964){_0x4684e9=_0x4684e9-0x0;var _0x118227=_0x1927[_0x4684e9];return _0x118227;};'use strict';var schema=require('validate');var _=require(_0x7192('0x0'));var htmlToText=require(_0x7192('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x7192('0x2'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x7192('0x3')},'priorityTrue':{'type':_0x7192('0x4'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x7192('0x4'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x7192('0x5')]=function(_0x3b5197,_0x57813e){return function(_0x2879a0){try{var _0x42c183={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x57813e[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x57813e[0x1],'priorityFalse':_0x57813e[0x2]};var _0x49c9fa=gotoif[_0x7192('0x6')](_0x42c183,{'typecast':!![]});if(_0x49c9fa[_0x7192('0x7')]){logger['error'](_0x7192('0x8'),_0x3b5197,_['map'](_0x49c9fa,_0x7192('0x9'))[_0x7192('0xa')](',\x20'));_0x2879a0[_0x7192('0xb')]();}else{try{var _0x3458f6=eval('('+_0x42c183[_0x7192('0xc')]+')');var _0xe9699c=_0x3458f6?_0x42c183['priorityTrue']:_0x42c183[_0x7192('0xd')];logger[_0x7192('0xe')](_0x7192('0xf'),_0x3b5197,_0x42c183[_0x7192('0xc')],_0x3458f6,_0xe9699c||_0x7192('0x10'));if(_0xe9699c){var _0x53bbf8=_[_0x7192('0x11')](_0x2879a0[_0x7192('0x12')](),{'p':_0xe9699c});if(_0x53bbf8>=0x0){logger['info'](_0x7192('0x13'),_0x3b5197,_0xe9699c||_0x7192('0x10'),_0x53bbf8);_0x2879a0[_0x7192('0x10')](_0x53bbf8);}else{logger[_0x7192('0xe')](_0x7192('0x14'),_0x3b5197,_0xe9699c||'next');_0x2879a0[_0x7192('0xb')]();}}else{_0x2879a0['next']();}}catch(_0x39ac26){logger[_0x7192('0x15')](_0x7192('0x16'),_0x3b5197,_0x39ac26[_0x7192('0x9')]);_0x2879a0[_0x7192('0xb')]();}}}catch(_0x2dde04){logger[_0x7192('0x15')](_0x7192('0x8'),_0x3b5197,JSON[_0x7192('0x17')](_0x2dde04));_0x2879a0[_0x7192('0xb')]();}};}; \ 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 9f25275..7d3b7b4 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 _0x85a5=['message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map'];(function(_0x263f82,_0x4061f1){var _0x230ae0=function(_0x71ade5){while(--_0x71ade5){_0x263f82['push'](_0x263f82['shift']());}};_0x230ae0(++_0x4061f1);}(_0x85a5,0xe7));var _0x585a=function(_0x45564a,_0x160043){_0x45564a=_0x45564a-0x0;var _0x1184c7=_0x85a5[_0x45564a];return _0x1184c7;};'use strict';var schema=require(_0x585a('0x0'));var _=require('lodash');var logger=require(_0x585a('0x1'))('routing');var gotop=schema({'priority':{'type':_0x585a('0x2'),'required':!![],'message':_0x585a('0x3')}});exports[_0x585a('0x4')]=function(_0x174377,_0x32add2){return function(_0xa6b81a){try{var _0x1130aa={'priority':_0x32add2[0x0]};var _0x1807f6=gotop['validate'](_0x1130aa,{'typecast':!![]});if(_0x1807f6[_0x585a('0x5')]){logger[_0x585a('0x6')](_0x585a('0x7'),_0x174377,_[_0x585a('0x8')](_0x1807f6,_0x585a('0x9'))[_0x585a('0xa')](',\x20'));_0xa6b81a[_0x585a('0xb')]();}else{logger[_0x585a('0xc')](_0x585a('0xd'),_0x174377,_0x1130aa[_0x585a('0xe')]);if(_0x1130aa['priority']){var _0x51d7d6=_['findIndex'](_0xa6b81a[_0x585a('0xf')](),{'p':_0x1130aa[_0x585a('0xe')]});if(_0x51d7d6>=0x0){logger['info'](_0x585a('0x10'),_0x174377,_0x1130aa[_0x585a('0xe')]||'next',_0x51d7d6);_0xa6b81a[_0x585a('0x11')](_0x51d7d6);}else{logger[_0x585a('0xc')](_0x585a('0x12'),_0x174377,_0x1130aa[_0x585a('0xe')]||_0x585a('0x11'));_0xa6b81a[_0x585a('0xb')]();}}else{_0xa6b81a[_0x585a('0x11')]();}}}catch(_0x2eae03){logger['error'](_0x585a('0x7'),_0x174377,JSON[_0x585a('0x13')](_0x2eae03));_0xa6b81a[_0x585a('0xb')]();}};}; \ No newline at end of file +var _0x5a69=['length','error','[%s][GOTOP]\x20%s','map','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a69,0x162));var _0x95a6=function(_0x62695c,_0x1fcde9){_0x62695c=_0x62695c-0x0;var _0x24fc45=_0x5a69[_0x62695c];return _0x24fc45;};'use strict';var schema=require(_0x95a6('0x0'));var _=require(_0x95a6('0x1'));var logger=require(_0x95a6('0x2'))(_0x95a6('0x3'));var gotop=schema({'priority':{'type':_0x95a6('0x4'),'required':!![],'message':_0x95a6('0x5')}});exports['consequence']=function(_0x442636,_0x1ac6f8){return function(_0x3323bd){try{var _0x555be8={'priority':_0x1ac6f8[0x0]};var _0x4893d6=gotop[_0x95a6('0x0')](_0x555be8,{'typecast':!![]});if(_0x4893d6[_0x95a6('0x6')]){logger[_0x95a6('0x7')](_0x95a6('0x8'),_0x442636,_[_0x95a6('0x9')](_0x4893d6,'message')['join'](',\x20'));_0x3323bd[_0x95a6('0xa')]();}else{logger[_0x95a6('0xb')](_0x95a6('0xc'),_0x442636,_0x555be8[_0x95a6('0xd')]);if(_0x555be8[_0x95a6('0xd')]){var _0x20d8da=_['findIndex'](_0x3323bd[_0x95a6('0xe')](),{'p':_0x555be8[_0x95a6('0xd')]});if(_0x20d8da>=0x0){logger[_0x95a6('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x442636,_0x555be8[_0x95a6('0xd')]||_0x95a6('0xf'),_0x20d8da);_0x3323bd[_0x95a6('0xf')](_0x20d8da);}else{logger[_0x95a6('0xb')](_0x95a6('0x10'),_0x442636,_0x555be8[_0x95a6('0xd')]||_0x95a6('0xf'));_0x3323bd[_0x95a6('0xa')]();}}else{_0x3323bd['next']();}}}catch(_0x33edcf){logger['error'](_0x95a6('0x8'),_0x442636,JSON[_0x95a6('0x11')](_0x33edcf));_0x3323bd[_0x95a6('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 484a238..1b31217 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 _0x1a4d=['chat','ChatWebsiteId','upperFirst','channel','AccountId','account','InteractionId','interaction','Message','info','body','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x1a4d,0x12e));var _0xd1a4=function(_0xa54f7e,_0x4f1bd3){_0xa54f7e=_0xa54f7e-0x0;var _0x13b8b4=_0x1a4d[_0xa54f7e];return _0x13b8b4;};'use strict';var _=require(_0xd1a4('0x0'));var utils=require(_0xd1a4('0x1'));var logger=require(_0xd1a4('0x2'))(_0xd1a4('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xd1a4('0x4')),'mailMessage':require(_0xd1a4('0x5')),'smsMessage':require(_0xd1a4('0x6')),'faxMessage':require(_0xd1a4('0x7')),'whatsappMessage':require(_0xd1a4('0x8'))};exports['consequence']=function(_0x21fa7b,_0x17e984){return function(_0x41fbef){try{var _0x35b097={'body':utils[_0xd1a4('0x9')](_0x17e984[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0xd1a4('0xa')){_0x35b097[_0xd1a4('0xb')]=this['account']['id'];}else{_0x35b097[_[_0xd1a4('0xc')](this[_0xd1a4('0xd')])+_0xd1a4('0xe')]=this[_0xd1a4('0xf')]['id'];}_0x35b097[_[_0xd1a4('0xc')](this[_0xd1a4('0xd')])+_0xd1a4('0x10')]=this[_0xd1a4('0x11')]['id'];if(rpc[this[_0xd1a4('0xd')]+_0xd1a4('0x12')]){return rpc[this[_0xd1a4('0xd')]+_0xd1a4('0x12')]['create'](_0x35b097)['then'](function(_0x28f41e){logger[_0xd1a4('0x13')]('[%s][MESSAGE]\x20%s',_0x21fa7b,_0x35b097[_0xd1a4('0x14')]);_0x41fbef['next']();})[_0xd1a4('0x15')](function(_0x4d65fc){logger[_0xd1a4('0x16')](_0xd1a4('0x17'),_0x21fa7b,JSON[_0xd1a4('0x18')](_0x4d65fc));_0x41fbef[_0xd1a4('0x19')]();});}}catch(_0x2d2524){logger[_0xd1a4('0x16')]('[%s][MESSAGE]\x20%s',_0x21fa7b,JSON[_0xd1a4('0x18')](_0x2d2524));_0x41fbef[_0xd1a4('0x19')]();}};}; \ No newline at end of file +var _0x0735=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','error','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage'];(function(_0x3ca9c5,_0x40b83a){var _0x225126=function(_0xb7064){while(--_0xb7064){_0x3ca9c5['push'](_0x3ca9c5['shift']());}};_0x225126(++_0x40b83a);}(_0x0735,0x7d));var _0x5073=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x0735[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x5073('0x0'));var utils=require(_0x5073('0x1'));var logger=require(_0x5073('0x2'))(_0x5073('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5073('0x4')),'mailMessage':require(_0x5073('0x5')),'smsMessage':require(_0x5073('0x6')),'faxMessage':require(_0x5073('0x7')),'whatsappMessage':require(_0x5073('0x8'))};exports[_0x5073('0x9')]=function(_0x5e9536,_0x339b56){return function(_0x6f0c91){try{var _0x4acd2a={'body':utils[_0x5073('0xa')](_0x339b56[0x0],this),'ContactId':this[_0x5073('0xb')]['id']};if(this[_0x5073('0xc')]===_0x5073('0xd')){_0x4acd2a[_0x5073('0xe')]=this[_0x5073('0xf')]['id'];}else{_0x4acd2a[_[_0x5073('0x10')](this[_0x5073('0xc')])+'AccountId']=this['account']['id'];}_0x4acd2a[_[_0x5073('0x10')](this[_0x5073('0xc')])+_0x5073('0x11')]=this[_0x5073('0x12')]['id'];if(rpc[this[_0x5073('0xc')]+_0x5073('0x13')]){return rpc[this[_0x5073('0xc')]+'Message'][_0x5073('0x14')](_0x4acd2a)[_0x5073('0x15')](function(_0x1536b8){logger['info'](_0x5073('0x16'),_0x5e9536,_0x4acd2a[_0x5073('0x17')]);_0x6f0c91['next']();})['catch'](function(_0x5d1780){logger[_0x5073('0x18')](_0x5073('0x16'),_0x5e9536,JSON['stringify'](_0x5d1780));_0x6f0c91['stop']();});}}catch(_0x3c44d){logger[_0x5073('0x18')]('[%s][MESSAGE]\x20%s',_0x5e9536,JSON['stringify'](_0x3c44d));_0x6f0c91[_0x5073('0x19')]();}};}; \ 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 3b1576f..0fec96e 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 _0x19a3=['getMustacheRender','next','error','stringify','stop','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x19a3,0x87));var _0x319a=function(_0x4b0207,_0x9632d5){_0x4b0207=_0x4b0207-0x0;var _0x20536a=_0x19a3[_0x4b0207];return _0x20536a;};'use strict';var utils=require('./utils');var logger=require(_0x319a('0x0'))(_0x319a('0x1'));exports[_0x319a('0x2')]=function(_0xb88298,_0x14845){return function(_0x3caa60){try{logger[_0x319a('0x3')](_0x319a('0x4'),_0xb88298,utils[_0x319a('0x5')](_0x14845[0x0],this));_0x3caa60[_0x319a('0x6')]();}catch(_0xd97b50){logger[_0x319a('0x7')](_0x319a('0x4'),_0xb88298,JSON[_0x319a('0x8')](_0xd97b50));_0x3caa60[_0x319a('0x9')]();}};}; \ No newline at end of file +var _0x35b4=['error','[%s][NOOP]\x20%s','stringify','stop','./utils','routing','consequence','info','getMustacheRender','next'];(function(_0x547fe3,_0x5bbc1a){var _0x5391b7=function(_0x2b0612){while(--_0x2b0612){_0x547fe3['push'](_0x547fe3['shift']());}};_0x5391b7(++_0x5bbc1a);}(_0x35b4,0x14e));var _0x435b=function(_0x27320b,_0x4c2c52){_0x27320b=_0x27320b-0x0;var _0x4da383=_0x35b4[_0x27320b];return _0x4da383;};'use strict';var utils=require(_0x435b('0x0'));var logger=require('../../../../config/logger')(_0x435b('0x1'));exports[_0x435b('0x2')]=function(_0x3ffdee,_0x5a1b20){return function(_0x204ebb){try{logger[_0x435b('0x3')]('[%s][NOOP]\x20%s',_0x3ffdee,utils[_0x435b('0x4')](_0x5a1b20[0x0],this));_0x204ebb[_0x435b('0x5')]();}catch(_0xf9eb20){logger[_0x435b('0x6')](_0x435b('0x7'),_0x3ffdee,JSON[_0x435b('0x8')](_0xf9eb20));_0x204ebb[_0x435b('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 3c268ab..5919bc6 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 _0x6629=['validate','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','account','pick','%sQueuesWaitingInteractions','format','%s:queue:%s','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','QueueReport','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','name','catch','error','update\x20queue\x20report','timeout','toLowerCase','consequence','length','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack'];(function(_0x1ec64e,_0x2189a4){var _0x1a56e3=function(_0x56e4ea){while(--_0x56e4ea){_0x1ec64e['push'](_0x1ec64e['shift']());}};_0x1a56e3(++_0x2189a4);}(_0x6629,0x1c2));var _0x9662=function(_0x1126b4,_0xd1862f){_0x1126b4=_0x1126b4-0x0;var _0x442201=_0x6629[_0x1126b4];return _0x442201;};'use strict';var schema=require(_0x9662('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x9662('0x1'));var moment=require(_0x9662('0x2'));var Redis=require(_0x9662('0x3'));var config=require(_0x9662('0x4'));var logger=require('../../../../config/logger')(_0x9662('0x5'));var strategy=require(_0x9662('0x6'));config[_0x9662('0x7')]=_['defaults'](config[_0x9662('0x7')],{'host':_0x9662('0x8'),'port':0x18eb});var io=require(_0x9662('0x9'))(new Redis(config['redis']));var attributes=['id',_0x9662('0xa'),'account',_0x9662('0xb'),_0x9662('0xc'),_0x9662('0xd')];function emit(_0x11ae91,_0x3615f3,_0x40c983){io['to'](_0x11ae91)[_0x9662('0xe')](_0x3615f3,_0x40c983);}function emitChannelQueueInteraction(_0x413ba3,_0x3bb261,_0x3202d8,_0x449b65,_0x556842,_0x1fed23,_0x4d7432,_0x14c8b7){var _0x8db665=_['clone'](_0x3202d8);_0x8db665[_0x9662('0xa')]=_0x14c8b7;_0x8db665[_0x9662('0xb')]=_0x3bb261;_0x8db665[_0x9662('0xf')]=_0x449b65;_0x8db665['id']=_0x556842;if(_0x1fed23){_0x4d7432[util['format']('%sQueuesWaitingInteractions',_0x413ba3)][_0x556842]=_[_0x9662('0x10')](_0x8db665,attributes);}else{delete _0x4d7432[util['format'](_0x9662('0x11'),_0x413ba3)][_0x556842];}emit(util[_0x9662('0x12')](_0x9662('0x13'),_0x413ba3,_0x3bb261),util['format']('%s_queue_waiting_interaction:%s',_0x413ba3,_0x1fed23?'save':_0x9662('0x14')),_[_0x9662('0x10')](_0x8db665,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x9662('0x15')),'chatQueueReport':require(_0x9662('0x16')),'smsQueueReport':require(_0x9662('0x17')),'faxQueueReport':require(_0x9662('0x18')),'whatsappQueueReport':require(_0x9662('0x19'))};var queue=schema({'name':{'type':_0x9662('0x1a'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9662('0x1b'),'message':_0x9662('0x1c')}});function startRouting(_0x4e69af,_0x433500,_0xef0462,_0x139d1a){if(_0x4e69af&&_0x433500&&_0xef0462){_0x433500[_0x9662('0x1d')]+=0x1;var _0x2e16cf={'uniqueid':_0x4e69af,'from':_0xef0462[_0x9662('0x1e')]?_0xef0462[_0x9662('0x1e')][_0x9662('0xc')]:'','joinAt':moment()[_0x9662('0x12')](_0x9662('0x1f')),'ContactId':_0xef0462['contact']?_0xef0462['contact']['id']:null,'ListId':_0xef0462[_0x9662('0x20')]?_0xef0462[_0x9662('0x20')]['id']:null};_0x2e16cf[_[_0x9662('0x21')](_0xef0462[_0x9662('0x22')])+_0x9662('0x23')]=_0x433500['id']||null;_0x2e16cf[_[_0x9662('0x21')](_0xef0462[_0x9662('0x22')])+'InteractionId']=_0xef0462['interaction']?_0xef0462[_0x9662('0x24')]['id']:null;_0x2e16cf[_[_0x9662('0x21')](_0xef0462[_0x9662('0x22')])+_0x9662('0x25')]=_0xef0462['message']?_0xef0462[_0x9662('0x26')]['id']:null;_0x2e16cf[_[_0x9662('0x21')](_0xef0462[_0x9662('0x22')])+(_0xef0462[_0x9662('0x22')]!==_0x9662('0x27')?_0x9662('0x28'):_0x9662('0x29'))]=_0xef0462[_0x9662('0xf')]?_0xef0462['account']['id']:null;logger[_0x9662('0x2a')](util[_0x9662('0x12')](_0x9662('0x2b'),_0x4e69af,_0x433500['name']));emitChannelQueueInteraction(_0xef0462['channel'],_0x433500['name'],_0x2e16cf,_0xef0462['account']['name'],_0xef0462['message']['id'],!![],_0x139d1a,_0x433500['id']);if(rpc[_0xef0462[_0x9662('0x22')]+_0x9662('0x2c')]){return rpc[_0xef0462[_0x9662('0x22')]+_0x9662('0x2c')]['create'](_0x2e16cf)['catch'](function(_0x14387c){logger['error'](_0x9662('0x2d'));});}}}function stopRouting(_0x2e13ee,_0x3cd379,_0x28c20a,_0x13a3de){if(_0x2e13ee&&_0x3cd379){_0x3cd379['waiting']-=0x1;var _0xae35b6={'leaveAt':moment()[_0x9662('0x12')](_0x9662('0x1f')),'acceptAt':moment()[_0x9662('0x12')](_0x9662('0x1f')),'reason':'accepted'};logger[_0x9662('0x2a')](util['format'](_0x9662('0x2e'),_0x2e13ee,_0x3cd379[_0x9662('0x2f')]));emitChannelQueueInteraction(_0x28c20a[_0x9662('0x22')],_0x3cd379['name'],_0x28c20a['body'],_0x28c20a['account'][_0x9662('0x2f')],_0x28c20a[_0x9662('0x26')]['id'],![],_0x13a3de,_0x3cd379['id']);if(rpc[_0x28c20a[_0x9662('0x22')]+'QueueReport']){return rpc[_0x28c20a[_0x9662('0x22')]+_0x9662('0x2c')]['update'](_0x2e13ee,_0xae35b6)[_0x9662('0x30')](function(_0x1f5dc8){logger[_0x9662('0x31')](_0x9662('0x32'));});}}}function endRouting(_0x54caa4,_0x58c394,_0x2888d2,_0xdeaaab){if(_0x54caa4&&_0x58c394){_0x58c394[_0x9662('0x1d')]-=0x1;var _0x52c65b={'leaveAt':moment()[_0x9662('0x12')](_0x9662('0x1f')),'exitAt':moment()[_0x9662('0x12')](_0x9662('0x1f')),'reason':_0x9662('0x33')};logger[_0x9662('0x2a')](util[_0x9662('0x12')]('[%s][END:QUEUE][NAME:%s]',_0x54caa4,_0x58c394['name']));emitChannelQueueInteraction(_0x2888d2['channel'],_0x58c394[_0x9662('0x2f')],_0x2888d2['body'],_0x2888d2['account'][_0x9662('0x2f')],_0x2888d2[_0x9662('0x26')]['id'],![],_0xdeaaab);if(rpc[_0x2888d2['channel']+_0x9662('0x2c')]){return rpc[_0x2888d2[_0x9662('0x22')]+'QueueReport']['update'](_0x54caa4,_0x52c65b)[_0x9662('0x30')](function(_0x27c767){logger[_0x9662('0x31')](_0x9662('0x32'));});}}}function handleFindQueue(_0x127fed){return function(_0x5659f0){return _0x5659f0['name'][_0x9662('0x34')]()===_0x127fed[_0x9662('0x34')]();};}exports[_0x9662('0x35')]=function(_0x5cb3dd,_0x3e103b,_0x2f01b4,_0x38cf58){return function(_0x1c1c19){try{var _0x19fe60={'name':_0x3e103b[0x0],'timeout':_0x3e103b[0x1]};var _0x1ac8ef=queue[_0x9662('0x0')](_0x19fe60,{'typecast':!![]});if(_0x1ac8ef[_0x9662('0x36')]){logger['error']('[%s][QUEUE]\x20%s',_0x5cb3dd,_[_0x9662('0x37')](_0x1ac8ef,_0x9662('0x26'))[_0x9662('0x38')](',\x20'));_0x1c1c19[_0x9662('0x39')]();}else{var _0xb42ca=_[_0x9662('0x3a')](_0x2f01b4[_0x38cf58[_0x9662('0x22')]+_0x9662('0x3b')],handleFindQueue(_0x19fe60[_0x9662('0x2f')]));if(_0xb42ca){startRouting(_0x5cb3dd,_0xb42ca,_0x38cf58,_0x2f01b4);var _0x11713a=(_0xb42ca['timeout']||0xa)*0x3e8;var _0x4e6584=(_0x19fe60['timeout']||0x14)*0x3e8;var _0x9bf8d4,_0x5454bf;if(_0x11713a>_0x4e6584){_0x4e6584=_0x11713a;}var _0x61f9c7=seqqueue[_0x9662('0x3c')](_0x11713a);_0x61f9c7['id']=_0x5cb3dd;_0x61f9c7[_0x9662('0x3d')]=_0x11713a;_0x61f9c7[_0x9662('0x3e')]=_0x4e6584;_0x61f9c7[_0x9662('0x22')]=_0x38cf58[_0x9662('0x22')];_0x2f01b4['rules'][_0x5cb3dd]['on']('end',function(){logger[_0x9662('0x2a')](_0x9662('0x3f'),_0x5cb3dd);stopRouting(_0x5cb3dd,_0xb42ca,_0x38cf58,_0x2f01b4);clearTimeout(_0x9bf8d4);_0x9bf8d4=undefined;_0x61f9c7[_0x9662('0x40')](!![]);if(_0x2f01b4[_0x9662('0x41')][_0x5cb3dd]){delete _0x2f01b4[_0x9662('0x41')][_0x5cb3dd];}_0x1c1c19[_0x9662('0x39')]();});_0x2f01b4['rules'][_0x5cb3dd]['on'](_0x9662('0x42'),function(){if(_0x2f01b4[_0x9662('0x41')][_0x5cb3dd]){delete _0x2f01b4[_0x9662('0x41')][_0x5cb3dd];}});_0x9bf8d4=setTimeout(function(){logger['info'](_0x9662('0x43'),_0x5cb3dd);endRouting(_0x5cb3dd,_0xb42ca,_0x38cf58,_0x2f01b4);clearTimeout(_0x9bf8d4);_0x61f9c7['close'](!![]);_0x1c1c19['next']();},_0x4e6584);switch(_0xb42ca[_0x9662('0x44')]){case'rrmemory':strategy[_0x9662('0x45')](_0x61f9c7,_0xb42ca,_0x2f01b4,_0x38cf58);break;default:strategy[_0x9662('0x46')](_0x61f9c7,_0xb42ca,_0x2f01b4,_0x38cf58);}}else{logger[_0x9662('0x31')](_0x9662('0x47'),_0x5cb3dd,_0x19fe60[_0x9662('0x2f')]);_0x1c1c19['stop']();}}}catch(_0x8328cb){console[_0x9662('0x48')](_0x8328cb);logger[_0x9662('0x31')](_0x9662('0x49'),_0x5cb3dd,_0x8328cb[_0x9662('0x4a')]);_0x1c1c19[_0x9662('0x39')]();}};}; \ No newline at end of file +var _0x5f34=['qtimeout','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','account','queue','from','emit','clone','queue_id','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','catch','create\x20queue\x20report','accepted','update','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','[%s][QUEUE]\x20%s','map','join','stop','find','atimeout'];(function(_0x3beb3d,_0x1518e8){var _0x140705=function(_0xf4826a){while(--_0xf4826a){_0x3beb3d['push'](_0x3beb3d['shift']());}};_0x140705(++_0x1518e8);}(_0x5f34,0xf9));var _0x45f3=function(_0x5106ce,_0xee03bc){_0x5106ce=_0x5106ce-0x0;var _0x22bb1f=_0x5f34[_0x5106ce];return _0x22bb1f;};'use strict';var schema=require(_0x45f3('0x0'));var _=require(_0x45f3('0x1'));var util=require(_0x45f3('0x2'));var seqqueue=require(_0x45f3('0x3'));var moment=require(_0x45f3('0x4'));var Redis=require(_0x45f3('0x5'));var config=require(_0x45f3('0x6'));var logger=require(_0x45f3('0x7'))(_0x45f3('0x8'));var strategy=require(_0x45f3('0x9'));config[_0x45f3('0xa')]=_['defaults'](config[_0x45f3('0xa')],{'host':_0x45f3('0xb'),'port':0x18eb});var io=require(_0x45f3('0xc'))(new Redis(config['redis']));var attributes=['id','queue_id',_0x45f3('0xd'),_0x45f3('0xe'),_0x45f3('0xf'),'joinAt'];function emit(_0x1b97b6,_0x2837c5,_0x72eb50){io['to'](_0x1b97b6)[_0x45f3('0x10')](_0x2837c5,_0x72eb50);}function emitChannelQueueInteraction(_0x136593,_0x43efb7,_0x1b2111,_0x281909,_0x26119d,_0x489422,_0x45d5f1,_0x10f930){var _0x2fc357=_[_0x45f3('0x11')](_0x1b2111);_0x2fc357[_0x45f3('0x12')]=_0x10f930;_0x2fc357['queue']=_0x43efb7;_0x2fc357[_0x45f3('0xd')]=_0x281909;_0x2fc357['id']=_0x26119d;if(_0x489422){_0x45d5f1[util[_0x45f3('0x13')](_0x45f3('0x14'),_0x136593)][_0x26119d]=_[_0x45f3('0x15')](_0x2fc357,attributes);}else{delete _0x45d5f1[util['format'](_0x45f3('0x14'),_0x136593)][_0x26119d];}emit(util[_0x45f3('0x13')]('%s:queue:%s',_0x136593,_0x43efb7),util[_0x45f3('0x13')](_0x45f3('0x16'),_0x136593,_0x489422?_0x45f3('0x17'):_0x45f3('0x18')),_[_0x45f3('0x15')](_0x2fc357,attributes));}var rpc={'openchannelQueueReport':require(_0x45f3('0x19')),'mailQueueReport':require(_0x45f3('0x1a')),'chatQueueReport':require(_0x45f3('0x1b')),'smsQueueReport':require(_0x45f3('0x1c')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x45f3('0x1d'))};var queue=schema({'name':{'type':_0x45f3('0x1e'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x45f3('0x1f'),'message':_0x45f3('0x20')}});function startRouting(_0xd3f5a1,_0x5e2b46,_0x301fe0,_0x4f695c){if(_0xd3f5a1&&_0x5e2b46&&_0x301fe0){_0x5e2b46[_0x45f3('0x21')]+=0x1;var _0x33a05b={'uniqueid':_0xd3f5a1,'from':_0x301fe0[_0x45f3('0x22')]?_0x301fe0['body'][_0x45f3('0xf')]:'','joinAt':moment()[_0x45f3('0x13')](_0x45f3('0x23')),'ContactId':_0x301fe0[_0x45f3('0x24')]?_0x301fe0[_0x45f3('0x24')]['id']:null,'ListId':_0x301fe0[_0x45f3('0x25')]?_0x301fe0[_0x45f3('0x25')]['id']:null};_0x33a05b[_[_0x45f3('0x26')](_0x301fe0['channel'])+_0x45f3('0x27')]=_0x5e2b46['id']||null;_0x33a05b[_[_0x45f3('0x26')](_0x301fe0['channel'])+_0x45f3('0x28')]=_0x301fe0['interaction']?_0x301fe0[_0x45f3('0x29')]['id']:null;_0x33a05b[_[_0x45f3('0x26')](_0x301fe0[_0x45f3('0x2a')])+_0x45f3('0x2b')]=_0x301fe0['message']?_0x301fe0[_0x45f3('0x2c')]['id']:null;_0x33a05b[_[_0x45f3('0x26')](_0x301fe0[_0x45f3('0x2a')])+(_0x301fe0['channel']!==_0x45f3('0x2d')?_0x45f3('0x2e'):_0x45f3('0x2f'))]=_0x301fe0[_0x45f3('0xd')]?_0x301fe0[_0x45f3('0xd')]['id']:null;logger[_0x45f3('0x30')](util['format']('[%s][START:QUEUE][NAME:%s]',_0xd3f5a1,_0x5e2b46[_0x45f3('0x31')]));emitChannelQueueInteraction(_0x301fe0[_0x45f3('0x2a')],_0x5e2b46[_0x45f3('0x31')],_0x33a05b,_0x301fe0[_0x45f3('0xd')]['name'],_0x301fe0[_0x45f3('0x2c')]['id'],!![],_0x4f695c,_0x5e2b46['id']);if(rpc[_0x301fe0[_0x45f3('0x2a')]+_0x45f3('0x32')]){return rpc[_0x301fe0['channel']+_0x45f3('0x32')][_0x45f3('0x33')](_0x33a05b)[_0x45f3('0x34')](function(_0x490483){logger['error'](_0x45f3('0x35'));});}}}function stopRouting(_0x45707b,_0x5a0581,_0x1660ef,_0x4f540d){if(_0x45707b&&_0x5a0581){_0x5a0581['waiting']-=0x1;var _0x2532f4={'leaveAt':moment()[_0x45f3('0x13')](_0x45f3('0x23')),'acceptAt':moment()[_0x45f3('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x45f3('0x36')};logger[_0x45f3('0x30')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x45707b,_0x5a0581['name']));emitChannelQueueInteraction(_0x1660ef[_0x45f3('0x2a')],_0x5a0581['name'],_0x1660ef[_0x45f3('0x22')],_0x1660ef[_0x45f3('0xd')]['name'],_0x1660ef[_0x45f3('0x2c')]['id'],![],_0x4f540d,_0x5a0581['id']);if(rpc[_0x1660ef[_0x45f3('0x2a')]+_0x45f3('0x32')]){return rpc[_0x1660ef[_0x45f3('0x2a')]+'QueueReport'][_0x45f3('0x37')](_0x45707b,_0x2532f4)[_0x45f3('0x34')](function(_0x17ebf0){logger[_0x45f3('0x38')](_0x45f3('0x39'));});}}}function endRouting(_0x17e61e,_0x3774a7,_0x3a0964,_0x3c047a){if(_0x17e61e&&_0x3774a7){_0x3774a7[_0x45f3('0x21')]-=0x1;var _0x3a412b={'leaveAt':moment()['format'](_0x45f3('0x23')),'exitAt':moment()[_0x45f3('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x45f3('0x3a')};logger['info'](util[_0x45f3('0x13')](_0x45f3('0x3b'),_0x17e61e,_0x3774a7['name']));emitChannelQueueInteraction(_0x3a0964['channel'],_0x3774a7[_0x45f3('0x31')],_0x3a0964[_0x45f3('0x22')],_0x3a0964[_0x45f3('0xd')][_0x45f3('0x31')],_0x3a0964[_0x45f3('0x2c')]['id'],![],_0x3c047a);if(rpc[_0x3a0964[_0x45f3('0x2a')]+_0x45f3('0x32')]){return rpc[_0x3a0964[_0x45f3('0x2a')]+_0x45f3('0x32')][_0x45f3('0x37')](_0x17e61e,_0x3a412b)[_0x45f3('0x34')](function(_0x5a2cc5){logger[_0x45f3('0x38')](_0x45f3('0x39'));});}}}function handleFindQueue(_0x31f6d0){return function(_0x2bb929){return _0x2bb929['name'][_0x45f3('0x3c')]()===_0x31f6d0[_0x45f3('0x3c')]();};}exports['consequence']=function(_0x2a8e8c,_0x21091c,_0x5a56f5,_0x40ee5b){return function(_0x3aa4dd){try{var _0x12235d={'name':_0x21091c[0x0],'timeout':_0x21091c[0x1]};var _0x359686=queue[_0x45f3('0x0')](_0x12235d,{'typecast':!![]});if(_0x359686['length']){logger[_0x45f3('0x38')](_0x45f3('0x3d'),_0x2a8e8c,_[_0x45f3('0x3e')](_0x359686,_0x45f3('0x2c'))[_0x45f3('0x3f')](',\x20'));_0x3aa4dd[_0x45f3('0x40')]();}else{var _0x224cee=_[_0x45f3('0x41')](_0x5a56f5[_0x40ee5b['channel']+'Queues'],handleFindQueue(_0x12235d[_0x45f3('0x31')]));if(_0x224cee){startRouting(_0x2a8e8c,_0x224cee,_0x40ee5b,_0x5a56f5);var _0x205c00=(_0x224cee['timeout']||0xa)*0x3e8;var _0x48f0eb=(_0x12235d['timeout']||0x14)*0x3e8;var _0x5b220d,_0x23e942;if(_0x205c00>_0x48f0eb){_0x48f0eb=_0x205c00;}var _0x192d22=seqqueue['createQueue'](_0x205c00);_0x192d22['id']=_0x2a8e8c;_0x192d22[_0x45f3('0x42')]=_0x205c00;_0x192d22[_0x45f3('0x43')]=_0x48f0eb;_0x192d22[_0x45f3('0x2a')]=_0x40ee5b[_0x45f3('0x2a')];_0x5a56f5['rules'][_0x2a8e8c]['on']('end',function(){logger[_0x45f3('0x30')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x2a8e8c);stopRouting(_0x2a8e8c,_0x224cee,_0x40ee5b,_0x5a56f5);clearTimeout(_0x5b220d);_0x5b220d=undefined;_0x192d22[_0x45f3('0x44')](!![]);if(_0x5a56f5['rules'][_0x2a8e8c]){delete _0x5a56f5[_0x45f3('0x45')][_0x2a8e8c];}_0x3aa4dd[_0x45f3('0x40')]();});_0x5a56f5[_0x45f3('0x45')][_0x2a8e8c]['on'](_0x45f3('0x46'),function(){if(_0x5a56f5[_0x45f3('0x45')][_0x2a8e8c]){delete _0x5a56f5[_0x45f3('0x45')][_0x2a8e8c];}});_0x5b220d=setTimeout(function(){logger['info'](_0x45f3('0x47'),_0x2a8e8c);endRouting(_0x2a8e8c,_0x224cee,_0x40ee5b,_0x5a56f5);clearTimeout(_0x5b220d);_0x192d22[_0x45f3('0x44')](!![]);_0x3aa4dd[_0x45f3('0x48')]();},_0x48f0eb);switch(_0x224cee[_0x45f3('0x49')]){case _0x45f3('0x4a'):strategy[_0x45f3('0x4a')](_0x192d22,_0x224cee,_0x5a56f5,_0x40ee5b);break;default:strategy[_0x45f3('0x4b')](_0x192d22,_0x224cee,_0x5a56f5,_0x40ee5b);}}else{logger[_0x45f3('0x38')](_0x45f3('0x4c'),_0x2a8e8c,_0x12235d[_0x45f3('0x31')]);_0x3aa4dd[_0x45f3('0x40')]();}}}catch(_0x3c9979){console[_0x45f3('0x4d')](_0x3c9979);logger[_0x45f3('0x38')](_0x45f3('0x3d'),_0x2a8e8c,_0x3c9979[_0x45f3('0x4e')]);_0x3aa4dd[_0x45f3('0x40')]();}};}; \ 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 5a54e64..67d5e4a 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 _0x15e0=['uuid','../../../../../config/logger','notificationId','squeue','realtime','routing','push','handleRun','bind','handleTimeout','drained','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','busy','busyQueue','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x15e0,0xc5));var _0x015e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x15e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x015e('0x0'));var uuid=require(_0x015e('0x1'));var util=require('./util');var logger=require(_0x015e('0x2'))('routing');var Agent=function(_0x4d7111,_0x1491cc,_0x301a63,_0xdab1a2){this[_0x015e('0x3')]=uuid['v4']();this[_0x015e('0x4')]=_0x4d7111;this['agent']=_0x1491cc;this[_0x015e('0x5')]=_0x301a63;this[_0x015e('0x6')]=_0xdab1a2;this[_0x015e('0x4')][_0x015e('0x7')](this[_0x015e('0x8')][_0x015e('0x9')](this),this['handleTimeout']['bind'](this));this['squeue']['on']('timeout',this[_0x015e('0xa')][_0x015e('0x9')](this));this['squeue']['on'](_0x015e('0xb'),this['handleDrained'][_0x015e('0x9')](this));};Agent[_0x015e('0xc')][_0x015e('0x7')]=function(){this['squeue']['push'](this[_0x015e('0x8')][_0x015e('0x9')](this),this['handleTimeout'][_0x015e('0x9')](this));};Agent[_0x015e('0xc')][_0x015e('0xd')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x015e('0x8')]=function(_0x4ab26b){logger[_0x015e('0xe')](_0x015e('0xf'),this[_0x015e('0x4')]['id'],this[_0x015e('0x10')]['id']);if(_[_0x015e('0x11')](this[_0x015e('0x5')]['agents'][this[_0x015e('0x10')]['id']])){logger[_0x015e('0xe')](_0x015e('0x12'),this[_0x015e('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x015e('0x7')][_0x015e('0x9')](this),0x3e8);}else{if(this[_0x015e('0x6')][_0x015e('0x13')]||util[_0x015e('0x14')](this[_0x015e('0x4')]['id'],this[_0x015e('0x5')][_0x015e('0x15')][this[_0x015e('0x10')]['id']],this[_0x015e('0x4')]['channel'],![])){this[_0x015e('0x5')][_0x015e('0x15')][this[_0x015e('0x10')]['id']][_0x015e('0x16')]=!![];this['realtime'][_0x015e('0x15')][this[_0x015e('0x10')]['id']][_0x015e('0x17')]=undefined;util['showNotification'](this[_0x015e('0x3')],this[_0x015e('0x4')]['id'],this[_0x015e('0x5')][_0x015e('0x15')][this['agent']['id']],null,this[_0x015e('0x6')]);util[_0x015e('0x18')](this['squeue']['id'],this[_0x015e('0x5')][_0x015e('0x15')][this[_0x015e('0x10')]['id']],_0x015e('0x19')+(this[_0x015e('0x6')][_0x015e('0x13')]?_0x015e('0x1a'):''));}else{logger[_0x015e('0xe')](_0x015e('0x1b'),this[_0x015e('0x4')]['id'],this[_0x015e('0x10')]['id']);setTimeout(this[_0x015e('0x7')][_0x015e('0x9')](this),0x3e8);}}};Agent[_0x015e('0xc')][_0x015e('0xa')]=function(_0x4ba3d6){if(_[_0x015e('0x11')](this[_0x015e('0x5')][_0x015e('0x15')][this[_0x015e('0x10')]['id']])){return logger[_0x015e('0xe')](_0x015e('0x12'),this['squeue']['id'],this['agent']['id']);}else{logger[_0x015e('0xe')](_0x015e('0x1c'),this[_0x015e('0x4')]['id'],this[_0x015e('0x10')]['id']);util[_0x015e('0x1d')](this['notificationId'],this[_0x015e('0x4')]['id'],this[_0x015e('0x5')][_0x015e('0x15')][this[_0x015e('0x10')]['id']],null,this['routing']);this[_0x015e('0x5')][_0x015e('0x15')][this[_0x015e('0x10')]['id']][_0x015e('0x16')]=![];this[_0x015e('0x5')][_0x015e('0x15')][this[_0x015e('0x10')]['id']][_0x015e('0x17')]=undefined;util['writeLog'](this[_0x015e('0x4')]['id'],this['realtime'][_0x015e('0x15')][this[_0x015e('0x10')]['id']],_0x4ba3d6?_0x015e('0x1e'):_0x015e('0x1f'));}if(!_0x4ba3d6){setTimeout(this['push'][_0x015e('0x9')](this),0x3e8);}};function agent(_0x146417,_0x3c3066,_0x2ea235,_0x25d3a2){return new Agent(_0x146417,_0x3c3066,_0x2ea235,_0x25d3a2);}module[_0x015e('0x20')]=agent; \ No newline at end of file +var _0xac64=['handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout','timeout','drained','handleDrained','prototype'];(function(_0x5f1790,_0x3fd46f){var _0x2d4f97=function(_0x1fd526){while(--_0x1fd526){_0x5f1790['push'](_0x5f1790['shift']());}};_0x2d4f97(++_0x3fd46f);}(_0xac64,0xe5));var _0x4ac6=function(_0x409a08,_0xd88e8d){_0x409a08=_0x409a08-0x0;var _0x1aa924=_0xac64[_0x409a08];return _0x1aa924;};'use strict';var _=require(_0x4ac6('0x0'));var uuid=require(_0x4ac6('0x1'));var util=require(_0x4ac6('0x2'));var logger=require(_0x4ac6('0x3'))(_0x4ac6('0x4'));var Agent=function(_0x5f1f82,_0x436e44,_0x30f521,_0x12515e){this[_0x4ac6('0x5')]=uuid['v4']();this[_0x4ac6('0x6')]=_0x5f1f82;this[_0x4ac6('0x7')]=_0x436e44;this[_0x4ac6('0x8')]=_0x30f521;this['routing']=_0x12515e;this[_0x4ac6('0x6')][_0x4ac6('0x9')](this['handleRun'][_0x4ac6('0xa')](this),this[_0x4ac6('0xb')][_0x4ac6('0xa')](this));this[_0x4ac6('0x6')]['on'](_0x4ac6('0xc'),this[_0x4ac6('0xb')][_0x4ac6('0xa')](this));this['squeue']['on'](_0x4ac6('0xd'),this[_0x4ac6('0xe')]['bind'](this));};Agent[_0x4ac6('0xf')][_0x4ac6('0x9')]=function(){this['squeue']['push'](this[_0x4ac6('0x10')]['bind'](this),this['handleTimeout'][_0x4ac6('0xa')](this));};Agent[_0x4ac6('0xf')][_0x4ac6('0xe')]=function(){this[_0x4ac6('0xb')](!![]);};Agent['prototype'][_0x4ac6('0x10')]=function(_0x20066d){logger[_0x4ac6('0x11')](_0x4ac6('0x12'),this[_0x4ac6('0x6')]['id'],this[_0x4ac6('0x7')]['id']);if(_[_0x4ac6('0x13')](this[_0x4ac6('0x8')]['agents'][this[_0x4ac6('0x7')]['id']])){logger[_0x4ac6('0x11')](_0x4ac6('0x14'),this['squeue']['id'],this[_0x4ac6('0x7')]['id']);setTimeout(this[_0x4ac6('0x9')][_0x4ac6('0xa')](this),0x3e8);}else{if(this[_0x4ac6('0x4')][_0x4ac6('0x15')]||util[_0x4ac6('0x16')](this[_0x4ac6('0x6')]['id'],this['realtime'][_0x4ac6('0x17')][this[_0x4ac6('0x7')]['id']],this[_0x4ac6('0x6')][_0x4ac6('0x18')],![])){this[_0x4ac6('0x8')]['agents'][this[_0x4ac6('0x7')]['id']][_0x4ac6('0x19')]=!![];this[_0x4ac6('0x8')][_0x4ac6('0x17')][this[_0x4ac6('0x7')]['id']][_0x4ac6('0x1a')]=undefined;util['showNotification'](this[_0x4ac6('0x5')],this[_0x4ac6('0x6')]['id'],this[_0x4ac6('0x8')]['agents'][this[_0x4ac6('0x7')]['id']],null,this[_0x4ac6('0x4')]);util['writeLog'](this['squeue']['id'],this[_0x4ac6('0x8')][_0x4ac6('0x17')][this[_0x4ac6('0x7')]['id']],_0x4ac6('0x1b')+(this[_0x4ac6('0x4')][_0x4ac6('0x15')]?_0x4ac6('0x1c'):''));}else{logger[_0x4ac6('0x11')](_0x4ac6('0x1d'),this[_0x4ac6('0x6')]['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x4ac6('0xf')][_0x4ac6('0xb')]=function(_0x2d3595){if(_['isNil'](this[_0x4ac6('0x8')]['agents'][this[_0x4ac6('0x7')]['id']])){return logger[_0x4ac6('0x11')](_0x4ac6('0x14'),this[_0x4ac6('0x6')]['id'],this[_0x4ac6('0x7')]['id']);}else{logger['info'](_0x4ac6('0x1e'),this[_0x4ac6('0x6')]['id'],this[_0x4ac6('0x7')]['id']);util[_0x4ac6('0x1f')](this[_0x4ac6('0x5')],this[_0x4ac6('0x6')]['id'],this[_0x4ac6('0x8')]['agents'][this[_0x4ac6('0x7')]['id']],null,this['routing']);this[_0x4ac6('0x8')][_0x4ac6('0x17')][this[_0x4ac6('0x7')]['id']][_0x4ac6('0x19')]=![];this[_0x4ac6('0x8')][_0x4ac6('0x17')][this[_0x4ac6('0x7')]['id']]['busyQueue']=undefined;util[_0x4ac6('0x20')](this[_0x4ac6('0x6')]['id'],this['realtime'][_0x4ac6('0x17')][this[_0x4ac6('0x7')]['id']],_0x2d3595?_0x4ac6('0x21'):'TIMEOUT');}if(!_0x2d3595){setTimeout(this['push'][_0x4ac6('0xa')](this),0x3e8);}};function agent(_0x5c445d,_0x5af57c,_0x4eb6ff,_0x2708f3){return new Agent(_0x5c445d,_0x5af57c,_0x4eb6ff,_0x2708f3);}module[_0x4ac6('0x22')]=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 8c24573..5bb1f10 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 _0x885a=['handleDrained','handleRun','prototype','isNil','Agents','length','realtime','agents','info','isAgentAvailable','channel','RINGING','busy','busyQueue','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','push','bind','handleTimeout','timeout','drained'];(function(_0x52ede5,_0x1bf23f){var _0x63f00b=function(_0x43f020){while(--_0x43f020){_0x52ede5['push'](_0x52ede5['shift']());}};_0x63f00b(++_0x1bf23f);}(_0x885a,0x180));var _0xa885=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x885a[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var uuid=require(_0xa885('0x0'));var util=require(_0xa885('0x1'));var logger=require(_0xa885('0x2'))(_0xa885('0x3'));var Beepall=function(_0x573a2b,_0xcf0656,_0x1c41b5,_0x2386ec){this[_0xa885('0x4')]=uuid['v4']();this[_0xa885('0x5')]=_0x573a2b;this[_0xa885('0x6')]=_0xcf0656;this['realtime']=_0x1c41b5;this[_0xa885('0x3')]=_0x2386ec;this[_0xa885('0x5')][_0xa885('0x7')](this['handleRun'][_0xa885('0x8')](this),this[_0xa885('0x9')][_0xa885('0x8')](this));this['squeue']['on'](_0xa885('0xa'),this[_0xa885('0x9')][_0xa885('0x8')](this));this[_0xa885('0x5')]['on'](_0xa885('0xb'),this[_0xa885('0xc')][_0xa885('0x8')](this));};Beepall['prototype'][_0xa885('0x7')]=function(){this[_0xa885('0x5')][_0xa885('0x7')](this[_0xa885('0xd')][_0xa885('0x8')](this),this[_0xa885('0x9')][_0xa885('0x8')](this));};Beepall['prototype'][_0xa885('0xc')]=function(_0x1d789f){this[_0xa885('0x9')](!![]);};Beepall[_0xa885('0xe')][_0xa885('0xd')]=function(_0x5bdb0c){var _0x1c9687=!![];if(!_[_0xa885('0xf')](this['queue'])&&!_[_0xa885('0xf')](this[_0xa885('0x6')]['Agents'])&&this[_0xa885('0x6')][_0xa885('0x10')]['length']>0x0){for(var _0x20a206=0x0,_0x543e7a;_0x20a2060x0){for(var _0x2e5c4f=0x0,_0x20845a;_0x2e5c4f0x0&&_0x29d647[_0x88b47b+_0xf0ad('0x25')]>=_0x29d647[_0x88b47b+_0xf0ad('0x24')]){writeLog(_0x3ece1e,_0x29d647,_0x88b47b[_0xf0ad('0x26')]()+_0xf0ad('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x2cbe00,_0x19a32a,_0x2b62,_0x1e60b1,_0x1b6880){return sendNotification(!![],_0x2cbe00,_0x19a32a,_0x2b62,_0x1e60b1,_0x1b6880);};exports[_0xf0ad('0x28')]=function(_0x267b7a,_0x1bee71,_0x2386e8,_0x39c46c,_0x2d1b2f){return sendNotification(![],_0x267b7a,_0x1bee71,_0x2386e8,_0x39c46c,_0x2d1b2f);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x3a6d=['getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','lodash','util','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','emit','format','name','user:save','account','notificationSound','notificationShake','body','queue','msg'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x3a6d,0x143));var _0xd3a6=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x3a6d[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var utils=require('../utils');var Mustache=require(_0xd3a6('0x2'));var Redis=require(_0xd3a6('0x3'));var config=require(_0xd3a6('0x4'));var logger=require(_0xd3a6('0x5'))(_0xd3a6('0x6'));config['redis']=_[_0xd3a6('0x7')](config[_0xd3a6('0x8')],{'host':_0xd3a6('0x9'),'port':0x18eb});var io=require(_0xd3a6('0xa'))(new Redis(config[_0xd3a6('0x8')]));function emit(_0x282cb1,_0x58d83a,_0x121bd2){io['to'](_0x282cb1)[_0xd3a6('0xb')](_0x58d83a,_0x121bd2);}function sendNotification(_0x16858,_0x410dac,_0x14b46b,_0xa67661,_0x1dbcce,_0x4094a2){io['to'](util[_0xd3a6('0xc')]('user:%s',_0xa67661[_0xd3a6('0xd')]))[_0xd3a6('0xb')](_0xd3a6('0xe'),_0xa67661);var _0x225399=_0x4094a2||{};var _0x2bd4f0=_0x14b46b['split']('.');var _0x5430c0={'uniqueid':_0x410dac,'channel':_0x2bd4f0[0x0],'id':_0x2bd4f0[0x1],'title':_0x2bd4f0[0x0]+'\x20interaction','interactionId':_0x2bd4f0[0x2],'queue':_0x1dbcce?_0x1dbcce[_0xd3a6('0xd')]:null,'sound':_0x225399[_0xd3a6('0xf')][_0xd3a6('0x10')],'shake':_0x225399[_0xd3a6('0xf')][_0xd3a6('0x11')]};try{if(!_0x225399[_0xd3a6('0x12')]){_0x225399[_0xd3a6('0x12')]={};}if(_0x1dbcce){_0x225399['body'][_0xd3a6('0x13')]=_0x1dbcce;}else if(_0x225399[_0xd3a6('0x12')][_0xd3a6('0x13')]){delete _0x225399['body'][_0xd3a6('0x13')];}_0x5430c0[_0xd3a6('0x14')]=utils[_0xd3a6('0x15')](_0x225399['account'][_0xd3a6('0x16')],_0x225399);}catch(_0x5174e0){_0x5430c0['msg']=_0xd3a6('0x17');logger[_0xd3a6('0x18')](util[_0xd3a6('0xc')](_0xd3a6('0x19'),_0x410dac,_0x5174e0[_0xd3a6('0x1a')]));}io['to'](util[_0xd3a6('0xc')](_0xd3a6('0x1b'),_0xa67661['name']))[_0xd3a6('0xb')](util['format'](_0xd3a6('0x1c'),_0x16858?_0xd3a6('0x1d'):_0xd3a6('0x1e')),_0x5430c0);}function writeLog(_0x20a34e,_0x465d25,_0x6ecd88){return logger['info'](util[_0xd3a6('0xc')](_0xd3a6('0x1f'),_0x20a34e,_0x465d25['name'],_0x6ecd88));}exports['isAgentAvailable']=function(_0x5846bc,_0x573870,_0x5c9075,_0x98a12a){if(_0x573870[_0xd3a6('0x20')]){writeLog(_0x5846bc,_0x573870,_0xd3a6('0x21'));return![];}if(!_0x573870['online']){writeLog(_0x5846bc,_0x573870,_0xd3a6('0x22'));return![];}if(_0x573870[_0x5c9075+'Pause']){writeLog(_0x5846bc,_0x573870,_0xd3a6('0x23'));return![];}if(_0x98a12a&&_0x573870[_0xd3a6('0x24')](_0x5c9075+_0xd3a6('0x25'))&&_0x573870['hasOwnProperty'](_0x5c9075+_0xd3a6('0x26'))){if(_0x573870[_0x5c9075+_0xd3a6('0x25')]>0x0&&_0x573870[_0x5c9075+_0xd3a6('0x26')]>=_0x573870[_0x5c9075+_0xd3a6('0x25')]){writeLog(_0x5846bc,_0x573870,_0x5c9075[_0xd3a6('0x27')]()+_0xd3a6('0x28'));return![];}}return!![];};exports['showNotification']=function(_0x30df90,_0x2b5448,_0x24ff6d,_0x3f6d35,_0x30abc2){return sendNotification(!![],_0x30df90,_0x2b5448,_0x24ff6d,_0x3f6d35,_0x30abc2);};exports[_0xd3a6('0x29')]=function(_0x5c2186,_0x535bd4,_0x1f4859,_0x210aa1,_0x35981c){return sendNotification(![],_0x5c2186,_0x535bd4,_0x1f4859,_0x210aa1,_0x35981c);};exports[_0xd3a6('0x2a')]=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 610c8a5..a651db6 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 _0x633c=['[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable'];(function(_0xb17208,_0x16f568){var _0x160444=function(_0x20e377){while(--_0x20e377){_0xb17208['push'](_0xb17208['shift']());}};_0x160444(++_0x16f568);}(_0x633c,0x1b4));var _0xc633=function(_0x41cc89,_0x4f78ae){_0x41cc89=_0x41cc89-0x0;var _0x3c4704=_0x633c[_0x41cc89];return _0x3c4704;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require('lodash');var utils=require(_0xc633('0x0'));var logger=require('../../../../config/logger')(_0xc633('0x1'));var system=schema({'command':{'type':_0xc633('0x2'),'required':!![],'message':_0xc633('0x3')}});exports[_0xc633('0x4')]=function(_0x3ce630,_0x310d8a){return function(_0x15cc01){try{var _0x4a6010={'command':_0x310d8a[0x0]};var _0x52f495=system[_0xc633('0x5')](_0x4a6010,{'typecast':!![]});if(_0x52f495[_0xc633('0x6')]){logger[_0xc633('0x7')](_0xc633('0x8'),_0x3ce630,_[_0xc633('0x9')](_0x52f495,_0xc633('0xa'))[_0xc633('0xb')](',\x20'));logger[_0xc633('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3ce630);_0x15cc01[_0xc633('0xd')]();}else{var _0x27aab7=this;var _0x2fcabc=utils['getMustacheRender'](_0x310d8a[0x0],this);logger[_0xc633('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x3ce630,_0x2fcabc);sh[_0xc633('0xe')](_[_0xc633('0xf')](_0x2fcabc),function(_0x2b479a,_0x4a554a){logger[_0xc633('0xc')](_0xc633('0x10'),_0x3ce630,_0x2b479a);if(_0x2b479a==0x0){var _0x5dd369=_0x4a554a[_0xc633('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xc633('0x12')](_0x310d8a[0x1])||_['isEmpty'](_0x310d8a[0x1])){logger['info'](_0xc633('0x13'),_0x3ce630);_0x27aab7['body'][_0x310d8a[0x1]]=_0x5dd369;}else{logger[_0xc633('0xc')](_0xc633('0x14'),_0x3ce630,_0x310d8a[0x1],_0x5dd369);_0x27aab7['body'][_0x310d8a[0x1]]=_0x5dd369;}}_0x15cc01['next']();});}}catch(_0x1577c8){logger['error'](_0xc633('0x8'),_0x3ce630,_[_0xc633('0x15')](_0x1577c8)?JSON[_0xc633('0x16')](_0x1577c8):_0x1577c8);logger[_0xc633('0xc')](_0xc633('0x17'),_0x3ce630);_0x15cc01[_0xc633('0xd')]();}};}; \ No newline at end of file +var _0x8243=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify','validate','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x8243,0x1ba));var _0x3824=function(_0x2eb0fb,_0x5d0a35){_0x2eb0fb=_0x2eb0fb-0x0;var _0x5366e8=_0x8243[_0x2eb0fb];return _0x5366e8;};'use strict';var schema=require(_0x3824('0x0'));var sh=require('shelljs');var _=require(_0x3824('0x1'));var utils=require(_0x3824('0x2'));var logger=require(_0x3824('0x3'))(_0x3824('0x4'));var system=schema({'command':{'type':_0x3824('0x5'),'required':!![],'message':_0x3824('0x6')}});exports[_0x3824('0x7')]=function(_0x44706a,_0x4daf71){return function(_0x2e8d9e){try{var _0x548281={'command':_0x4daf71[0x0]};var _0x362756=system[_0x3824('0x0')](_0x548281,{'typecast':!![]});if(_0x362756[_0x3824('0x8')]){logger[_0x3824('0x9')](_0x3824('0xa'),_0x44706a,_[_0x3824('0xb')](_0x362756,_0x3824('0xc'))[_0x3824('0xd')](',\x20'));logger[_0x3824('0xe')](_0x3824('0xf'),_0x44706a);_0x2e8d9e[_0x3824('0x10')]();}else{var _0x2a97f4=this;var _0x477fa7=utils[_0x3824('0x11')](_0x4daf71[0x0],this);logger[_0x3824('0xe')](_0x3824('0x12'),_0x44706a,_0x477fa7);sh[_0x3824('0x13')](_['trim'](_0x477fa7),function(_0x560191,_0xeecdb5){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x44706a,_0x560191);if(_0x560191==0x0){var _0xb73e60=_0xeecdb5[_0x3824('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x3824('0x15')](_0x4daf71[0x1])||_[_0x3824('0x16')](_0x4daf71[0x1])){logger['info'](_0x3824('0x17'),_0x44706a);_0x2a97f4['body'][_0x4daf71[0x1]]=_0xb73e60;}else{logger[_0x3824('0xe')](_0x3824('0x18'),_0x44706a,_0x4daf71[0x1],_0xb73e60);_0x2a97f4[_0x3824('0x19')][_0x4daf71[0x1]]=_0xb73e60;}}_0x2e8d9e['next']();});}}catch(_0x5866a3){logger[_0x3824('0x9')](_0x3824('0xa'),_0x44706a,_[_0x3824('0x1a')](_0x5866a3)?JSON[_0x3824('0x1b')](_0x5866a3):_0x5866a3);logger['info'](_0x3824('0xf'),_0x44706a);_0x2e8d9e[_0x3824('0x10')]();}};}; \ 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 ab3cb0a..37bd986 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 _0xf8b1=['consequence','length','[%s][TAG]\x20%s','map','message','join','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','catch','error','stringify','finally','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x166e0e,_0x140810){var _0x461129=function(_0x3146bc){while(--_0x3146bc){_0x166e0e['push'](_0x166e0e['shift']());}};_0x461129(++_0x140810);}(_0xf8b1,0x68));var _0x1f8b=function(_0x4941c6,_0x3ca9f8){_0x4941c6=_0x4941c6-0x0;var _0x4d3654=_0xf8b1[_0x4941c6];return _0x4d3654;};'use strict';var schema=require(_0x1f8b('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x1f8b('0x1')),'openchannelInteraction':require(_0x1f8b('0x2')),'smsInteraction':require(_0x1f8b('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x1f8b('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x1f8b('0x5'))(_0x1f8b('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x1f8b('0x7')}});exports[_0x1f8b('0x8')]=function(_0x4eecae,_0x5db4d6,_0x4e82d0,_0x1612db){return function(_0x53f237){try{var _0x4b6355={'tag':_0x5db4d6[0x0]};var _0x2a2b65=tag['validate'](_0x4b6355,{'typecast':!![]});if(_0x2a2b65[_0x1f8b('0x9')]){logger['error'](_0x1f8b('0xa'),_0x4eecae,_[_0x1f8b('0xb')](_0x2a2b65,_0x1f8b('0xc'))[_0x1f8b('0xd')](',\x20'));logger[_0x1f8b('0xe')](_0x1f8b('0xf'),_0x4eecae);_0x53f237[_0x1f8b('0x10')]();}else{var _0x1662d2={'ids':[_0x5db4d6[0x0]]};if(rpc[_0x1612db[_0x1f8b('0x11')]+_0x1f8b('0x12')]){rpc[_0x1612db['channel']+_0x1f8b('0x12')][_0x1f8b('0x13')](_0x1612db[_0x1f8b('0x14')]['id'],_0x1662d2)[_0x1f8b('0x15')](function(_0x35d151){logger[_0x1f8b('0xe')](_0x1f8b('0x16'),_0x4eecae,_0x5db4d6[0x1],_0x1612db[_0x1f8b('0x11')],_0x1612db[_0x1f8b('0x14')]['id']);})[_0x1f8b('0x17')](function(_0xe1b5d3){logger[_0x1f8b('0x18')]('[%s][TAG]\x20%s',_0x4eecae,JSON[_0x1f8b('0x19')](_0xe1b5d3));logger[_0x1f8b('0xe')](_0x1f8b('0xf'),_0x4eecae);})[_0x1f8b('0x1a')](function(){_0x53f237[_0x1f8b('0x10')]();});}}}catch(_0x5eef28){logger[_0x1f8b('0x18')](_0x1f8b('0xa'),_0x4eecae,_[_0x1f8b('0x1b')](_0x5eef28)?JSON['stringify'](_0x5eef28):_0x5eef28);logger[_0x1f8b('0xe')](_0x1f8b('0xf'),_0x4eecae);_0x53f237[_0x1f8b('0x10')]();}};}; \ No newline at end of file +var _0x72e0=['Interaction','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','validate','lodash','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel'];(function(_0x44b204,_0x4b57e1){var _0x6e1f58=function(_0x26cd01){while(--_0x26cd01){_0x44b204['push'](_0x44b204['shift']());}};_0x6e1f58(++_0x4b57e1);}(_0x72e0,0x8e));var _0x072e=function(_0x28dacc,_0x362baf){_0x28dacc=_0x28dacc-0x0;var _0x5d9955=_0x72e0[_0x28dacc];return _0x5d9955;};'use strict';var schema=require(_0x072e('0x0'));var _=require(_0x072e('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x072e('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x072e('0x3')),'faxInteraction':require(_0x072e('0x4')),'whatsappInteraction':require(_0x072e('0x5'))};var logger=require(_0x072e('0x6'))(_0x072e('0x7'));var tag=schema({'tag':{'type':_0x072e('0x8'),'required':!![],'message':_0x072e('0x9')}});exports[_0x072e('0xa')]=function(_0x386561,_0x2b5872,_0x377642,_0x42c0e3){return function(_0x48d4bf){try{var _0x15fe7f={'tag':_0x2b5872[0x0]};var _0x2c9b02=tag[_0x072e('0x0')](_0x15fe7f,{'typecast':!![]});if(_0x2c9b02[_0x072e('0xb')]){logger[_0x072e('0xc')](_0x072e('0xd'),_0x386561,_[_0x072e('0xe')](_0x2c9b02,_0x072e('0xf'))[_0x072e('0x10')](',\x20'));logger['info'](_0x072e('0x11'),_0x386561);_0x48d4bf[_0x072e('0x12')]();}else{var _0xd19c9c={'ids':[_0x2b5872[0x0]]};if(rpc[_0x42c0e3[_0x072e('0x13')]+_0x072e('0x14')]){rpc[_0x42c0e3[_0x072e('0x13')]+_0x072e('0x14')]['addTags'](_0x42c0e3[_0x072e('0x15')]['id'],_0xd19c9c)[_0x072e('0x16')](function(_0x5c4dc9){logger[_0x072e('0x17')](_0x072e('0x18'),_0x386561,_0x2b5872[0x1],_0x42c0e3['channel'],_0x42c0e3[_0x072e('0x15')]['id']);})['catch'](function(_0x26f505){logger['error'](_0x072e('0xd'),_0x386561,JSON[_0x072e('0x19')](_0x26f505));logger[_0x072e('0x17')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x386561);})[_0x072e('0x1a')](function(){_0x48d4bf[_0x072e('0x12')]();});}}}catch(_0x35b67a){logger[_0x072e('0xc')](_0x072e('0xd'),_0x386561,_['isObject'](_0x35b67a)?JSON[_0x072e('0x19')](_0x35b67a):_0x35b67a);logger['info'](_0x072e('0x11'),_0x386561);_0x48d4bf[_0x072e('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index a7dc21c..7e42610 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 _0xa30f=['isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','includes','push','urlOnAnswer','urlOnRing','jsonrpc','2.0','method','params','stringify','POST','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&data=','then','info','stop','catch','[%s][TVOX]\x20%s'];(function(_0x1092ea,_0x4fa3bc){var _0x608673=function(_0x205fc6){while(--_0x205fc6){_0x1092ea['push'](_0x1092ea['shift']());}};_0x608673(++_0x4fa3bc);}(_0xa30f,0xce));var _0xfa30=function(_0x39530c,_0xad8cd5){_0x39530c=_0x39530c-0x0;var _0x513ebd=_0xa30f[_0x39530c];return _0x513ebd;};'use strict';var rp=require(_0xfa30('0x0'));var logger=require(_0xfa30('0x1'))(_0xfa30('0x2'));var _=require(_0xfa30('0x3'));var arr=[];exports[_0xfa30('0x4')]=function(_0x261490,_0x48752c){return function(_0x236e13){var _0x293b7a=_0x48752c[0xa];var _0x4c479a=_0x48752c[0xb];var _0x9c7eaa=_0x48752c[0xc];var _0x4662c0=_0x48752c[0xd];var _0x388004=_0x48752c[0xe];var _0x27bb4c=_0x48752c[0xf][_0xfa30('0x5')](/\n/g,'\x20-\x20');var _0x40802d=_0x48752c[0x10][_0xfa30('0x5')](/\n/g,'\x20');if(!arr[_0xfa30('0x6')](_0x4c479a)){arr[_0xfa30('0x7')](_0x4c479a);var _0x3fed3d=_0x48752c[0x3];var _0x124250=_0x48752c[0x4];var _0x1f8c41=_0x48752c[0x1];var _0xb9e7e7=_0x48752c[0x0];var _0x38ad1a={};_0x38ad1a[_0xfa30('0x8')]=_0x48752c[0x8]+'?params='+_0x9c7eaa+'|'+_0x293b7a+'|'+_0x4662c0+'|'+_0x4c479a+'|'+_0x388004;_0x38ad1a[_0xfa30('0x9')]=_0x48752c[0x7]+'?params='+_0x9c7eaa+'|'+_0x293b7a+'|'+_0x4662c0+'|'+_0x4c479a+'|'+_0x388004+'|'+_0x27bb4c+'|'+_0x40802d;_0x38ad1a['title']=_0x48752c[0x9];var _0x4d07a7={};_0x4d07a7[_0xfa30('0xa')]=_0xfa30('0xb');_0x4d07a7[_0xfa30('0xc')]='login';var _0x4b566f=[];_0x4b566f[_0xfa30('0x7')](_0x48752c[0x2]);_0x4b566f['push'](_0x48752c[0x5]);_0x4b566f[_0xfa30('0x7')](_0x48752c[0x6]);_0x4d07a7[_0xfa30('0xd')]=_0x4b566f;_0x4d07a7['id']=0x1;var _0x1c1080=JSON[_0xfa30('0xe')](_0x4d07a7);var _0x3426c9={'encoding':'utf8','method':_0xfa30('0xf'),'timeout':0x2710,'url':_0x3fed3d,'headers':{'Content-Type':'application/json-rpc'},'body':_0x1c1080};return rp(_0x3426c9)['then'](function(_0x3d011c){const _0x1979a2=JSON['parse'](_0x3d011c);if(!_0x1979a2[_0xfa30('0x10')][_0xfa30('0x11')]){throw new Error(_0xfa30('0x12'));}var _0x2d8f6d=_0x4c479a;var _0x5bb6b0='channelId='+_0x1f8c41+_0xfa30('0x13')+_0xb9e7e7+'&sessionId='+_0x2d8f6d+_0xfa30('0x14')+JSON[_0xfa30('0xe')](_0x38ad1a);var _0x5ef7ed=_0x124250+'?'+_0x5bb6b0;return rp(_0x5ef7ed);})[_0xfa30('0x15')](function(_0xdab6f8){logger[_0xfa30('0x16')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x261490,_0xdab6f8);_0x236e13[_0xfa30('0x17')]();})[_0xfa30('0x18')](function(_0x46a169){logger['error'](_0xfa30('0x19'),_0x261490,_[_0xfa30('0x1a')](_0x46a169)?JSON[_0xfa30('0xe')](_0x46a169):_0x46a169);_0x236e13[_0xfa30('0x17')]();});}else{logger[_0xfa30('0x16')](_0xfa30('0x1b'),_0x261490);_0x236e13[_0xfa30('0x1c')]();}};}; \ No newline at end of file +var _0x92db=['stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','utf8','application/json-rpc','then','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','stringify','info'];(function(_0x4e9e1a,_0x5b4dc7){var _0x4ce706=function(_0x30deef){while(--_0x30deef){_0x4e9e1a['push'](_0x4e9e1a['shift']());}};_0x4ce706(++_0x5b4dc7);}(_0x92db,0x130));var _0xb92d=function(_0x2a63d2,_0x2fea45){_0x2a63d2=_0x2a63d2-0x0;var _0x26d71e=_0x92db[_0x2a63d2];return _0x26d71e;};'use strict';var rp=require(_0xb92d('0x0'));var logger=require(_0xb92d('0x1'))('routing');var _=require('lodash');var arr=[];exports[_0xb92d('0x2')]=function(_0x4802d7,_0x2483e8){return function(_0x3d9525){var _0x5c9382=_0x2483e8[0xa];var _0x1e4fd5=_0x2483e8[0xb];var _0x1429c7=_0x2483e8[0xc];var _0x3e2f17=_0x2483e8[0xd];var _0x2aa4b2=_0x2483e8[0xe];var _0x487890=_0x2483e8[0xf][_0xb92d('0x3')](/\n/g,_0xb92d('0x4'));var _0x1112ba=_0x2483e8[0x10][_0xb92d('0x3')](/\n/g,'\x20');if(!arr[_0xb92d('0x5')](_0x1e4fd5)){arr[_0xb92d('0x6')](_0x1e4fd5);var _0x3f309c=_0x2483e8[0x3];var _0x2ddcfa=_0x2483e8[0x4];var _0x265181=_0x2483e8[0x1];var _0x208d46=_0x2483e8[0x0];var _0x28bbf2={};_0x28bbf2[_0xb92d('0x7')]=_0x2483e8[0x8]+_0xb92d('0x8')+_0x1429c7+'|'+_0x5c9382+'|'+_0x3e2f17+'|'+_0x1e4fd5+'|'+_0x2aa4b2;_0x28bbf2[_0xb92d('0x9')]=_0x2483e8[0x7]+'?params='+_0x1429c7+'|'+_0x5c9382+'|'+_0x3e2f17+'|'+_0x1e4fd5+'|'+_0x2aa4b2+'|'+_0x487890+'|'+_0x1112ba;_0x28bbf2[_0xb92d('0xa')]=_0x2483e8[0x9];var _0x500ac8={};_0x500ac8[_0xb92d('0xb')]=_0xb92d('0xc');_0x500ac8[_0xb92d('0xd')]=_0xb92d('0xe');var _0x4b89b7=[];_0x4b89b7[_0xb92d('0x6')](_0x2483e8[0x2]);_0x4b89b7[_0xb92d('0x6')](_0x2483e8[0x5]);_0x4b89b7[_0xb92d('0x6')](_0x2483e8[0x6]);_0x500ac8['params']=_0x4b89b7;_0x500ac8['id']=0x1;var _0x51abe5=JSON['stringify'](_0x500ac8);var _0x4ba3c0={'encoding':_0xb92d('0xf'),'method':'POST','timeout':0x2710,'url':_0x3f309c,'headers':{'Content-Type':_0xb92d('0x10')},'body':_0x51abe5};return rp(_0x4ba3c0)[_0xb92d('0x11')](function(_0x49ae29){const _0x4112df=JSON['parse'](_0x49ae29);if(!_0x4112df['result'][_0xb92d('0x12')]){throw new Error(_0xb92d('0x13'));}var _0x59e643=_0x1e4fd5;var _0x263aed=_0xb92d('0x14')+_0x265181+_0xb92d('0x15')+_0x208d46+_0xb92d('0x16')+_0x59e643+_0xb92d('0x17')+JSON[_0xb92d('0x18')](_0x28bbf2);var _0x314fcf=_0x2ddcfa+'?'+_0x263aed;return rp(_0x314fcf);})[_0xb92d('0x11')](function(_0x54308d){logger[_0xb92d('0x19')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x4802d7,_0x54308d);_0x3d9525[_0xb92d('0x1a')]();})[_0xb92d('0x1b')](function(_0x8ce199){logger[_0xb92d('0x1c')](_0xb92d('0x1d'),_0x4802d7,_[_0xb92d('0x1e')](_0x8ce199)?JSON[_0xb92d('0x18')](_0x8ce199):_0x8ce199);_0x3d9525[_0xb92d('0x1a')]();});}else{logger[_0xb92d('0x19')](_0xb92d('0x1f'),_0x4802d7);_0x3d9525[_0xb92d('0x20')]();}};}; \ 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 2cc635a..3785c3e 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 _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x4753e0,_0x11dd04){var _0xadb46e=function(_0x528fc8){while(--_0x528fc8){_0x4753e0['push'](_0x4753e0['shift']());}};_0xadb46e(++_0x11dd04);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x9b7020,_0x5e5d7d){var _0x478f98=function(_0x295665){while(--_0x295665){_0x9b7020['push'](_0x9b7020['shift']());}};_0x478f98(++_0x5e5d7d);}(_0xe706,0xa3));var _0x6e70=function(_0xaa4f3,_0x37be20){_0xaa4f3=_0xaa4f3-0x0;var _0x163cc9=_0xe706[_0xaa4f3];return _0x163cc9;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 7fee3b0..69e942b 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 _0x7b6b=['join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflowv2','amazonlex','TagId','account','notificationTemplate','ChatWebsiteId','ContactId','body','./interval','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','isArray','applications','length'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x7b6b,0xac));var _0xb7b6=function(_0x2ac8bc,_0x234afe){_0x2ac8bc=_0x2ac8bc-0x0;var _0x6d4815=_0x7b6b[_0x2ac8bc];return _0x6d4815;};'use strict';var _=require(_0xb7b6('0x0'));var util=require('util');var path=require(_0xb7b6('0x1'));var fs=require('fs');var jayson=require(_0xb7b6('0x2'));var BPromise=require(_0xb7b6('0x3'));var uuid=require('uuid');var utils=require(_0xb7b6('0x4'));var config=require('../../../config/environment');var logger=require(_0xb7b6('0x5'))(_0xb7b6('0x6'));var rpc={'openchannelQueueReport':require(_0xb7b6('0x7')),'mailQueueReport':require(_0xb7b6('0x8')),'chatQueueReport':require(_0xb7b6('0x9')),'smsQueueReport':require(_0xb7b6('0xa')),'faxQueueReport':require(_0xb7b6('0xb')),'whatsappQueueReport':require(_0xb7b6('0xc'))};var RuleEngine=require(_0xb7b6('0xd'));function getId(_0x31809b,_0xb5b26f,_0x4074d1){return util[_0xb7b6('0xe')](_0xb7b6('0xf'),_0x31809b,_0xb5b26f||0x0,_0x4074d1||0x0);}function getIntervals(_0x22ee5f,_0x4025fe){var _0x14a6ac=[];if(!_[_0xb7b6('0x10')](_0x4025fe[_0xb7b6('0x11')])&&!_[_0xb7b6('0x10')](_0x22ee5f[_0x4025fe['IntervalId']])&&!_[_0xb7b6('0x10')](_0x22ee5f[_0x4025fe[_0xb7b6('0x11')]][_0xb7b6('0x12')])){_0x14a6ac=_[_0xb7b6('0x13')](_0x22ee5f[_0x4025fe[_0xb7b6('0x11')]][_0xb7b6('0x12')],_0xb7b6('0x14'));}else if(!_[_0xb7b6('0x10')](_0x4025fe[_0xb7b6('0x14')])){_0x14a6ac=[_0x4025fe[_0xb7b6('0x14')]];}return _0x14a6ac;}exports[_0xb7b6('0x15')]=function(_0x37985a){_0x37985a['rules']={};return new BPromise(function(_0x47ac7d,_0x26566e){var _0x53ea93={'Start':function(_0x51c79a){var _0x6d7d=this;return new Promise(function(_0x543440,_0x4cbe26){if(_0x51c79a){try{var _0x1c2160=[];var _0xa99f35=getId(_0x51c79a[_0xb7b6('0x16')],_0x51c79a[_0xb7b6('0x17')]?_0x51c79a[_0xb7b6('0x17')]['id']:0x0,_0x51c79a[_0xb7b6('0x18')]?_0x51c79a[_0xb7b6('0x18')]['id']:0x0);if(_0x51c79a['applications']&&_[_0xb7b6('0x19')](_0x51c79a[_0xb7b6('0x1a')])&&_0x51c79a['applications'][_0xb7b6('0x1b')]){for(var _0x159965=0x0;_0x159965<_0x51c79a['applications'][_0xb7b6('0x1b')];_0x159965+=0x1){var _0x1adc4f=_0x51c79a['applications'][_0x159965];if(fs['existsSync'](path[_0xb7b6('0x1c')](__dirname,'applications',_0x1adc4f[_0xb7b6('0x1d')]+_0xb7b6('0x1e')))){var _0xdb7eca=[];switch(_0x1adc4f[_0xb7b6('0x1d')][_0xb7b6('0x1f')]()){case _0xb7b6('0x20'):var _0x220509=_0x1adc4f[_0xb7b6('0x21')][_0xb7b6('0x22')](',');if(_0x51c79a[_0xb7b6('0x16')]===_0xb7b6('0x23')){_0xdb7eca[_0xb7b6('0x24')](_0x220509[0x0]);_0xdb7eca[_0xb7b6('0x24')](_0x220509[0x1]);_0xdb7eca['push'](_0x220509[_0xb7b6('0x25')](0x2,_0x220509['length'])[_0xb7b6('0x1c')](','));}else{_0xdb7eca['push'](_0x220509[0x0]);_0xdb7eca['push'](_0x220509['slice'](0x1,_0x220509[_0xb7b6('0x1b')])['join'](','));}break;case'dialogflow':var _0x449d06=_0x1adc4f[_0xb7b6('0x21')][_0xb7b6('0x22')](',');_0xdb7eca[_0xb7b6('0x24')](_0x449d06[0x0]);_0xdb7eca[_0xb7b6('0x24')](_0x449d06[0x1]);_0xdb7eca[_0xb7b6('0x24')](_0x449d06[_0xb7b6('0x25')](0x2,_0x449d06['length'])['join'](','));break;case _0xb7b6('0x26'):var _0x2df0ee=_0x1adc4f[_0xb7b6('0x21')][_0xb7b6('0x22')](',');_0xdb7eca[_0xb7b6('0x24')](_0x2df0ee[0x0]);_0xdb7eca['push'](_0x2df0ee[0x1]);_0xdb7eca[_0xb7b6('0x24')](_0x2df0ee[0x2]);_0xdb7eca['push'](_0x2df0ee[0x3]);_0xdb7eca['push'](_0x2df0ee[_0xb7b6('0x25')](0x4,_0x2df0ee[_0xb7b6('0x1b')])[_0xb7b6('0x1c')](','));break;case _0xb7b6('0x27'):var _0x899fda=_0x1adc4f['appdata']['split'](',');_0xdb7eca[_0xb7b6('0x24')](_0x899fda[0x0]);_0xdb7eca[_0xb7b6('0x24')](_0x899fda[0x1]);_0xdb7eca[_0xb7b6('0x24')](_0x899fda[0x2]);_0xdb7eca[_0xb7b6('0x24')](_0x899fda[0x3]);_0xdb7eca[_0xb7b6('0x24')](_0x899fda[_0xb7b6('0x25')](0x4,_0x899fda[_0xb7b6('0x1b')])['join'](','));break;case _0xb7b6('0x17'):_0xdb7eca[_0xb7b6('0x24')](_0x1adc4f[_0xb7b6('0x21')]);break;case'tag':_0xdb7eca[_0xb7b6('0x24')](_0x1adc4f[_0xb7b6('0x28')]);_0xdb7eca['push'](_0x1adc4f['appdata']);break;case'tvox':var _0x3900fb=utils['getMustacheRender'](_0x51c79a[_0xb7b6('0x29')][_0xb7b6('0x2a')],_0x51c79a);var _0x21cc34=_0x1adc4f[_0xb7b6('0x21')][_0xb7b6('0x22')](',');_0xdb7eca['push'](_0x21cc34[0x0]);_0xdb7eca['push'](_0x21cc34[0x1]);_0xdb7eca[_0xb7b6('0x24')](_0x21cc34[0x2]);_0xdb7eca[_0xb7b6('0x24')](_0x21cc34[0x3]);_0xdb7eca[_0xb7b6('0x24')](_0x21cc34[0x4]);_0xdb7eca[_0xb7b6('0x24')](_0x21cc34[0x5]);_0xdb7eca[_0xb7b6('0x24')](_0x21cc34[0x6]);_0xdb7eca[_0xb7b6('0x24')](_0x21cc34[0x7]);_0xdb7eca[_0xb7b6('0x24')](_0x21cc34[0x8]);_0xdb7eca[_0xb7b6('0x24')](_0x21cc34[0x9]);_0xdb7eca['push'](_0x21cc34[0xa]);_0xdb7eca[_0xb7b6('0x24')](_0x51c79a[_0xb7b6('0x18')]['id']);_0xdb7eca['push'](_0x51c79a[_0xb7b6('0x17')]['id']);_0xdb7eca[_0xb7b6('0x24')](_0x1adc4f[_0xb7b6('0x2b')]);_0xdb7eca['push'](_0x51c79a['interaction'][_0xb7b6('0x2c')]);_0xdb7eca[_0xb7b6('0x24')](_0x51c79a[_0xb7b6('0x2d')]['body']);_0xdb7eca['push'](_0x3900fb);break;default:_0xdb7eca=_[_0xb7b6('0x10')](_0x1adc4f[_0xb7b6('0x21')])?[]:_0x1adc4f[_0xb7b6('0x21')][_0xb7b6('0x22')](',');}var _0x3a8598={'id':util[_0xb7b6('0xe')]('%s:%s:%s',_0xa99f35,_0x1adc4f['id'],_0x1adc4f[_0xb7b6('0x1d')]),'condition':require(_0xb7b6('0x2e'))['condition'](_0xa99f35,getIntervals(_0x37985a['intervals'],_0x1adc4f),_0x37985a),'consequence':require(_0xb7b6('0x2f')+_0x1adc4f[_0xb7b6('0x1d')])[_0xb7b6('0x30')](_0xa99f35,_0xdb7eca,_0x37985a,_0x51c79a),'p':_0x1adc4f['priority']||0x0};logger[_0xb7b6('0x31')](_0xb7b6('0x32'),_0x3a8598['id'],_0xb7b6('0x33'),getIntervals(_0x37985a['intervals'],_0x1adc4f)[_0xb7b6('0x1c')](_0xb7b6('0x34')));_0x1c2160[_0xb7b6('0x24')](_0x3a8598);}else{logger[_0xb7b6('0x35')](_0xb7b6('0x36'),path['join'](__dirname,_0xb7b6('0x1a'),_0x1adc4f['app']+'.js'));}}_0x37985a[_0xb7b6('0x37')][_0xa99f35]=new RuleEngine(_0x1c2160);_0x37985a[_0xb7b6('0x37')][_0xa99f35][_0xb7b6('0x38')](_0x51c79a,function(_0x277a8d){logger[_0xb7b6('0x31')]('Applications\x20executed',JSON[_0xb7b6('0x39')](_0x277a8d[_0xb7b6('0x3a')]));if(_0x37985a[_0xb7b6('0x37')][_0xa99f35]){_0x37985a[_0xb7b6('0x37')][_0xa99f35][_0xb7b6('0x3b')](_0xb7b6('0x3c'));}});return _0x543440({'code':0xc8,'message':_0x51c79a});}else{logger['info'](_0xb7b6('0x3d'));return _0x543440({'code':0xc8,'message':_0x51c79a});}}catch(_0x313ee8){logger[_0xb7b6('0x35')](_0x313ee8[_0xb7b6('0x3e')]);return _0x4cbe26(_0x6d7d[_0xb7b6('0x35')](0x1f4,_0x313ee8));}}return _0x4cbe26(_0xb7b6('0x3f'));});},'AcceptMessage':function(_0x1ecd4b){var _0x54dd43=this;return new Promise(function(_0x1f6c8c,_0x2eb4f1){if(_0x1ecd4b[_0xb7b6('0x40')]&&_0x1ecd4b[_0xb7b6('0x40')]['id']){if(_0x37985a[_0xb7b6('0x41')][_0x1ecd4b['agent']['id']]){_0x37985a[_0xb7b6('0x41')][_0x1ecd4b[_0xb7b6('0x40')]['id']][_0xb7b6('0x42')]=![];_0x37985a[_0xb7b6('0x41')][_0x1ecd4b[_0xb7b6('0x40')]['id']]['busyQueue']=undefined;}}if(_0x1ecd4b[_0xb7b6('0x17')]&&_0x1ecd4b['message']['id']){try{var _0x4490bd=getId(_0x1ecd4b['channel'],_0x1ecd4b[_0xb7b6('0x17')]?_0x1ecd4b['message']['id']:0x0,_0x1ecd4b['interaction']?_0x1ecd4b['interaction']['id']:0x0);if(_0x37985a['rules'][_0x4490bd]){_0x37985a[_0xb7b6('0x37')][_0x4490bd][_0xb7b6('0x3b')](_0xb7b6('0x43'));if(rpc[_0x1ecd4b['channel']+'QueueReport']){rpc[_0x1ecd4b[_0xb7b6('0x16')]+_0xb7b6('0x44')][_0xb7b6('0x45')](_0x4490bd,{'UserId':_0x1ecd4b[_0xb7b6('0x17')][_0xb7b6('0x46')]})['catch'](function(_0x29020f){logger[_0xb7b6('0x35')](_0xb7b6('0x47'));});}}return _0x1f6c8c({'code':0xc8,'message':_0x1ecd4b});}catch(_0x5964b9){logger[_0xb7b6('0x35')](_0x5964b9[_0xb7b6('0x3e')]);return _0x2eb4f1(_0x54dd43[_0xb7b6('0x35')](0x1f4,_0x5964b9));}}logger['error'](_0xb7b6('0x48'));return _0x2eb4f1(_0x54dd43[_0xb7b6('0x35')](0x1f4,_0xb7b6('0x48')));});},'RejectMessage':function(_0x2684e5){var _0x382cf8=this;return new Promise(function(_0x3aa819,_0x24c04d){if(_0x2684e5[_0xb7b6('0x40')]&&_0x2684e5[_0xb7b6('0x40')]['id']){try{if(_0x37985a[_0xb7b6('0x41')][_0x2684e5[_0xb7b6('0x40')]['id']]){_0x37985a[_0xb7b6('0x41')][_0x2684e5[_0xb7b6('0x40')]['id']][_0xb7b6('0x42')]=![];_0x37985a[_0xb7b6('0x41')][_0x2684e5['agent']['id']][_0xb7b6('0x49')]=undefined;}return _0x3aa819({'code':0xc8,'message':_0x2684e5});}catch(_0x1bf4cd){logger['error'](_0x1bf4cd[_0xb7b6('0x3e')]);return _0x24c04d(_0x382cf8[_0xb7b6('0x35')](0x1f4,_0x1bf4cd));}}logger[_0xb7b6('0x35')]('message\x20is\x20empty');return _0x24c04d(_0x382cf8[_0xb7b6('0x35')](0x1f4,_0xb7b6('0x48')));});},'AbandonInteraction':function(_0xc98eb6){var _0x72503f=this;return new Promise(function(_0x3154e5,_0x37042f){if(_0xc98eb6['channel']&&_0xc98eb6[_0xb7b6('0x18')]&&_0xc98eb6[_0xb7b6('0x18')]['id']){try{var _0x4cfdb1=getId(_0xc98eb6['channel'],_0xc98eb6[_0xb7b6('0x17')]?_0xc98eb6[_0xb7b6('0x17')]['id']:0x0,_0xc98eb6[_0xb7b6('0x18')]?_0xc98eb6['interaction']['id']:0x0);if(_0x37985a[_0xb7b6('0x37')][_0x4cfdb1]){_0x37985a[_0xb7b6('0x37')][_0x4cfdb1][_0xb7b6('0x3b')]('end');}return _0x3154e5({'code':0xc8,'message':_0xc98eb6});}catch(_0x4d18c2){logger[_0xb7b6('0x35')](_0x4d18c2[_0xb7b6('0x3e')]);return _0x37042f(_0x72503f[_0xb7b6('0x35')](0x1f4,_0x4d18c2));}}logger[_0xb7b6('0x35')]('message\x20is\x20empty');return _0x37042f(_0x72503f[_0xb7b6('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0xf7ec12){var _0x727b38=this;return new Promise(function(_0x3a0029,_0x3248c0){if(_0x37985a[_0xb7b6('0x41')][_0xb7b6('0x4a')](_0xf7ec12['id'])){for(var _0x540ac4 in _0xf7ec12[_0xb7b6('0x4b')]){if(_0xf7ec12[_0xb7b6('0x4b')][_0xb7b6('0x4a')](_0x540ac4)){if(_0x37985a[_0xb7b6('0x41')][_0xf7ec12['id']][_0xb7b6('0x4a')](_0x540ac4+_0xb7b6('0x4c'))){_0x37985a[_0xb7b6('0x41')][_0xf7ec12['id']][_0x540ac4+_0xb7b6('0x4c')]=parseInt(_0xf7ec12[_0xb7b6('0x4b')][_0x540ac4],0xa);}}}_0x37985a[_0xb7b6('0x41')][_0xf7ec12['id']]['updateRealtime']();return _0x3a0029({'code':0xc8,'message':_0x37985a['agents'][_0xf7ec12['id']]});}else{return _0x3248c0(_0x727b38[_0xb7b6('0x35')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x5eb554){return new Promise(function(_0x37d16a,_0x13288d){var _0x367580=_[_0xb7b6('0x4d')](_0x37985a[_0xb7b6('0x41')]);_0x37d16a({'count':_0x367580[_0xb7b6('0x1b')],'rows':_0x367580});});},'ChatQueues':function(_0x106508){return new Promise(function(_0x53b253,_0x378c5c){var _0x46021c=[];for(var _0x3d83fd in _0x37985a[_0xb7b6('0x4e')]){if(_0x37985a[_0xb7b6('0x4e')][_0xb7b6('0x4a')](_0x3d83fd)){var _0x1053cc=_0x37985a['chatQueues'][_0x3d83fd];var _0x3c9e57={'id':_0x1053cc['id'],'available':_0x1053cc[_0xb7b6('0x4f')],'loggedIn':_0x1053cc[_0xb7b6('0x50')],'name':_0x1053cc[_0xb7b6('0x51')],'paused':_0x1053cc[_0xb7b6('0x52')],'waiting':_0x1053cc[_0xb7b6('0x53')]};_0x46021c[_0xb7b6('0x24')](_0x3c9e57);}}_0x53b253({'count':_0x46021c[_0xb7b6('0x1b')],'rows':_0x46021c});});},'MailQueues':function(_0x4a4329){return new Promise(function(_0x4d03b8,_0x1fdfde){var _0x3f2306=[];for(var _0x5367d4 in _0x37985a['mailQueues']){if(_0x37985a['mailQueues'][_0xb7b6('0x4a')](_0x5367d4)){var _0x1547b3=_0x37985a[_0xb7b6('0x54')][_0x5367d4];var _0x581b70={'id':_0x1547b3['id'],'available':_0x1547b3['available'],'loggedIn':_0x1547b3['loggedIn'],'name':_0x1547b3['name'],'paused':_0x1547b3['paused'],'waiting':_0x1547b3['waiting']};_0x3f2306[_0xb7b6('0x24')](_0x581b70);}}_0x4d03b8({'count':_0x3f2306[_0xb7b6('0x1b')],'rows':_0x3f2306});});},'OpenchannelQueues':function(_0x3a3f1a){return new Promise(function(_0x1733d9,_0x314ec2){var _0x29f74e=[];for(var _0x5261e8 in _0x37985a[_0xb7b6('0x55')]){if(_0x37985a['openchannelQueues'][_0xb7b6('0x4a')](_0x5261e8)){var _0x3502de=_0x37985a[_0xb7b6('0x55')][_0x5261e8];var _0x47e2d2={'id':_0x3502de['id'],'available':_0x3502de[_0xb7b6('0x4f')],'loggedIn':_0x3502de[_0xb7b6('0x50')],'name':_0x3502de['name'],'paused':_0x3502de[_0xb7b6('0x52')],'waiting':_0x3502de[_0xb7b6('0x53')]};_0x29f74e[_0xb7b6('0x24')](_0x47e2d2);}}_0x1733d9({'count':_0x29f74e[_0xb7b6('0x1b')],'rows':_0x29f74e});});},'SmsQueues':function(_0x1507ea){return new Promise(function(_0x1c085d,_0x2259b0){var _0x49bb2e=[];for(var _0x5ab7ba in _0x37985a['smsQueues']){if(_0x37985a[_0xb7b6('0x56')]['hasOwnProperty'](_0x5ab7ba)){var _0x535030=_0x37985a['smsQueues'][_0x5ab7ba];var _0x3aab58={'id':_0x535030['id'],'available':_0x535030[_0xb7b6('0x4f')],'loggedIn':_0x535030[_0xb7b6('0x50')],'name':_0x535030[_0xb7b6('0x51')],'paused':_0x535030['paused'],'waiting':_0x535030[_0xb7b6('0x53')]};_0x49bb2e['push'](_0x3aab58);}}_0x1c085d({'count':_0x49bb2e[_0xb7b6('0x1b')],'rows':_0x49bb2e});});},'FaxQueues':function(_0x59ae43){return new Promise(function(_0x7ae3ec,_0x543599){var _0x1afe17=[];for(var _0x51d739 in _0x37985a['faxQueues']){if(_0x37985a[_0xb7b6('0x57')][_0xb7b6('0x4a')](_0x51d739)){var _0x46e152=_0x37985a[_0xb7b6('0x57')][_0x51d739];var _0x5d90b9={'id':_0x46e152['id'],'available':_0x46e152[_0xb7b6('0x4f')],'loggedIn':_0x46e152[_0xb7b6('0x50')],'name':_0x46e152['name'],'paused':_0x46e152[_0xb7b6('0x52')],'waiting':_0x46e152[_0xb7b6('0x53')]};_0x1afe17[_0xb7b6('0x24')](_0x5d90b9);}}_0x7ae3ec({'count':_0x1afe17[_0xb7b6('0x1b')],'rows':_0x1afe17});});},'WhatsappQueues':function(_0x751034){return new Promise(function(_0x301403,_0x282351){var _0x3f3654=[];for(var _0x42a280 in _0x37985a[_0xb7b6('0x58')]){if(_0x37985a['whatsappQueues'][_0xb7b6('0x4a')](_0x42a280)){var _0xc537ec=_0x37985a['whatsappQueues'][_0x42a280];var _0x173a58={'id':_0xc537ec['id'],'available':_0xc537ec[_0xb7b6('0x4f')],'loggedIn':_0xc537ec[_0xb7b6('0x50')],'name':_0xc537ec[_0xb7b6('0x51')],'paused':_0xc537ec[_0xb7b6('0x52')],'waiting':_0xc537ec['waiting']};_0x3f3654[_0xb7b6('0x24')](_0x173a58);}}_0x301403({'count':_0x3f3654[_0xb7b6('0x1b')],'rows':_0x3f3654});});},'ChatQueuesWaitingInteractions':function(_0x4a80f1){return new Promise(function(_0x2c2ffb,_0x37e2e8){var _0xd13fa9=_['values'](_0x37985a[_0xb7b6('0x59')]);_0x2c2ffb({'count':_0xd13fa9['length'],'rows':_0xd13fa9});});},'MailQueuesWaitingInteractions':function(_0x5f57b2){return new Promise(function(_0x18ab60,_0x3018c5){var _0x5292ce=_[_0xb7b6('0x4d')](_0x37985a[_0xb7b6('0x5a')]);_0x18ab60({'count':_0x5292ce[_0xb7b6('0x1b')],'rows':_0x5292ce});});},'OpenchannelQueuesWaitingInteractions':function(_0x113a81){return new Promise(function(_0x1a17b8,_0x21be03){var _0x29bc3d=_[_0xb7b6('0x4d')](_0x37985a['openchannelQueuesWaitingInteractions']);_0x1a17b8({'count':_0x29bc3d[_0xb7b6('0x1b')],'rows':_0x29bc3d});});},'SmsQueuesWaitingInteractions':function(_0x16eb46){return new Promise(function(_0x486827,_0x54e7e6){var _0x399ec5=_[_0xb7b6('0x4d')](_0x37985a[_0xb7b6('0x5b')]);_0x486827({'count':_0x399ec5['length'],'rows':_0x399ec5});});},'FaxQueuesWaitingInteractions':function(_0x37b8ba){return new Promise(function(_0x4a456c,_0x2f4650){var _0x44d7b1=_['values'](_0x37985a[_0xb7b6('0x5c')]);_0x4a456c({'count':_0x44d7b1['length'],'rows':_0x44d7b1});});},'WhatsappQueuesWaitingInteractions':function(_0x1ddd4a){return new Promise(function(_0xf223ab,_0x565e9f){var _0x452e60=_[_0xb7b6('0x4d')](_0x37985a[_0xb7b6('0x5d')]);_0xf223ab({'count':_0x452e60[_0xb7b6('0x1b')],'rows':_0x452e60});});}};var _0x5dbb2e=jayson[_0xb7b6('0x5e')](_0x53ea93)[_0xb7b6('0x5f')]();_0x5dbb2e['on'](_0xb7b6('0x35'),function(_0x9c83f8){logger['error'](JSON[_0xb7b6('0x39')](_0x9c83f8));return _0x26566e(_0x9c83f8);});_0x5dbb2e[_0xb7b6('0x15')](0x232c,_0xb7b6('0x60'),function(){console[_0xb7b6('0x61')](_0xb7b6('0x62'),0x232c);return _0x47ac7d(_0xb7b6('0x63')+0x232c);});});}; \ No newline at end of file +var _0xcffe=['message\x20is\x20empty','emit','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','split','mail','push','slice','dialogflow','appdata','dialogflowv2','tag','TagId','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','matchPath','complete','No\x20applications\x20to\x20execute','stack','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch'];(function(_0x5c5ad1,_0x148828){var _0x1c275b=function(_0x5ca5db){while(--_0x5ca5db){_0x5c5ad1['push'](_0x5c5ad1['shift']());}};_0x1c275b(++_0x148828);}(_0xcffe,0x1a1));var _0xecff=function(_0x2c9d95,_0xcc4c3){_0x2c9d95=_0x2c9d95-0x0;var _0x1b9a2e=_0xcffe[_0x2c9d95];return _0x1b9a2e;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var path=require(_0xecff('0x2'));var fs=require('fs');var jayson=require(_0xecff('0x3'));var BPromise=require(_0xecff('0x4'));var uuid=require(_0xecff('0x5'));var utils=require(_0xecff('0x6'));var config=require(_0xecff('0x7'));var logger=require(_0xecff('0x8'))(_0xecff('0x9'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xecff('0xa')),'smsQueueReport':require(_0xecff('0xb')),'faxQueueReport':require(_0xecff('0xc')),'whatsappQueueReport':require(_0xecff('0xd'))};var RuleEngine=require(_0xecff('0xe'));function getId(_0x298c19,_0x1f7386,_0x4d4458){return util[_0xecff('0xf')](_0xecff('0x10'),_0x298c19,_0x1f7386||0x0,_0x4d4458||0x0);}function getIntervals(_0x195b15,_0x20ab4f){var _0x698e40=[];if(!_['isNil'](_0x20ab4f[_0xecff('0x11')])&&!_[_0xecff('0x12')](_0x195b15[_0x20ab4f[_0xecff('0x11')]])&&!_[_0xecff('0x12')](_0x195b15[_0x20ab4f[_0xecff('0x11')]][_0xecff('0x13')])){_0x698e40=_[_0xecff('0x14')](_0x195b15[_0x20ab4f[_0xecff('0x11')]][_0xecff('0x13')],_0xecff('0x15'));}else if(!_[_0xecff('0x12')](_0x20ab4f[_0xecff('0x15')])){_0x698e40=[_0x20ab4f[_0xecff('0x15')]];}return _0x698e40;}exports[_0xecff('0x16')]=function(_0x5495f9){_0x5495f9['rules']={};return new BPromise(function(_0xa26f3d,_0x2e1d6f){var _0x558ecd={'Start':function(_0x35ce1f){var _0x362ed0=this;return new Promise(function(_0x3a7623,_0x596b09){if(_0x35ce1f){try{var _0x52b62f=[];var _0x24abef=getId(_0x35ce1f[_0xecff('0x17')],_0x35ce1f['message']?_0x35ce1f[_0xecff('0x18')]['id']:0x0,_0x35ce1f[_0xecff('0x19')]?_0x35ce1f[_0xecff('0x19')]['id']:0x0);if(_0x35ce1f[_0xecff('0x1a')]&&_[_0xecff('0x1b')](_0x35ce1f[_0xecff('0x1a')])&&_0x35ce1f['applications'][_0xecff('0x1c')]){for(var _0x422bd8=0x0;_0x422bd8<_0x35ce1f[_0xecff('0x1a')][_0xecff('0x1c')];_0x422bd8+=0x1){var _0x49d0e2=_0x35ce1f[_0xecff('0x1a')][_0x422bd8];if(fs[_0xecff('0x1d')](path[_0xecff('0x1e')](__dirname,_0xecff('0x1a'),_0x49d0e2[_0xecff('0x1f')]+_0xecff('0x20')))){var _0x494754=[];switch(_0x49d0e2[_0xecff('0x1f')]['toLowerCase']()){case'autoreply':var _0x2d16f1=_0x49d0e2['appdata'][_0xecff('0x21')](',');if(_0x35ce1f['channel']===_0xecff('0x22')){_0x494754['push'](_0x2d16f1[0x0]);_0x494754[_0xecff('0x23')](_0x2d16f1[0x1]);_0x494754[_0xecff('0x23')](_0x2d16f1['slice'](0x2,_0x2d16f1[_0xecff('0x1c')])[_0xecff('0x1e')](','));}else{_0x494754[_0xecff('0x23')](_0x2d16f1[0x0]);_0x494754[_0xecff('0x23')](_0x2d16f1[_0xecff('0x24')](0x1,_0x2d16f1['length'])['join'](','));}break;case _0xecff('0x25'):var _0x484415=_0x49d0e2[_0xecff('0x26')][_0xecff('0x21')](',');_0x494754[_0xecff('0x23')](_0x484415[0x0]);_0x494754[_0xecff('0x23')](_0x484415[0x1]);_0x494754['push'](_0x484415['slice'](0x2,_0x484415['length'])[_0xecff('0x1e')](','));break;case _0xecff('0x27'):var _0x230d04=_0x49d0e2[_0xecff('0x26')]['split'](',');_0x494754[_0xecff('0x23')](_0x230d04[0x0]);_0x494754[_0xecff('0x23')](_0x230d04[0x1]);_0x494754[_0xecff('0x23')](_0x230d04[0x2]);_0x494754['push'](_0x230d04[0x3]);_0x494754[_0xecff('0x23')](_0x230d04[_0xecff('0x24')](0x4,_0x230d04[_0xecff('0x1c')])[_0xecff('0x1e')](','));break;case'amazonlex':var _0x7e7a6c=_0x49d0e2[_0xecff('0x26')]['split'](',');_0x494754[_0xecff('0x23')](_0x7e7a6c[0x0]);_0x494754[_0xecff('0x23')](_0x7e7a6c[0x1]);_0x494754[_0xecff('0x23')](_0x7e7a6c[0x2]);_0x494754[_0xecff('0x23')](_0x7e7a6c[0x3]);_0x494754['push'](_0x7e7a6c[_0xecff('0x24')](0x4,_0x7e7a6c[_0xecff('0x1c')])[_0xecff('0x1e')](','));break;case'message':_0x494754[_0xecff('0x23')](_0x49d0e2[_0xecff('0x26')]);break;case _0xecff('0x28'):_0x494754[_0xecff('0x23')](_0x49d0e2[_0xecff('0x29')]);_0x494754[_0xecff('0x23')](_0x49d0e2['appdata']);break;case'tvox':var _0x4dd43c=utils[_0xecff('0x2a')](_0x35ce1f['account'][_0xecff('0x2b')],_0x35ce1f);var _0x21411b=_0x49d0e2['appdata'][_0xecff('0x21')](',');_0x494754[_0xecff('0x23')](_0x21411b[0x0]);_0x494754[_0xecff('0x23')](_0x21411b[0x1]);_0x494754['push'](_0x21411b[0x2]);_0x494754[_0xecff('0x23')](_0x21411b[0x3]);_0x494754[_0xecff('0x23')](_0x21411b[0x4]);_0x494754[_0xecff('0x23')](_0x21411b[0x5]);_0x494754['push'](_0x21411b[0x6]);_0x494754[_0xecff('0x23')](_0x21411b[0x7]);_0x494754[_0xecff('0x23')](_0x21411b[0x8]);_0x494754[_0xecff('0x23')](_0x21411b[0x9]);_0x494754[_0xecff('0x23')](_0x21411b[0xa]);_0x494754[_0xecff('0x23')](_0x35ce1f[_0xecff('0x19')]['id']);_0x494754[_0xecff('0x23')](_0x35ce1f[_0xecff('0x18')]['id']);_0x494754[_0xecff('0x23')](_0x49d0e2[_0xecff('0x2c')]);_0x494754[_0xecff('0x23')](_0x35ce1f['interaction'][_0xecff('0x2d')]);_0x494754[_0xecff('0x23')](_0x35ce1f[_0xecff('0x2e')][_0xecff('0x2e')]);_0x494754[_0xecff('0x23')](_0x4dd43c);break;default:_0x494754=_[_0xecff('0x12')](_0x49d0e2[_0xecff('0x26')])?[]:_0x49d0e2[_0xecff('0x26')]['split'](',');}var _0x28141f={'id':util['format'](_0xecff('0x2f'),_0x24abef,_0x49d0e2['id'],_0x49d0e2[_0xecff('0x1f')]),'condition':require(_0xecff('0x30'))[_0xecff('0x31')](_0x24abef,getIntervals(_0x5495f9[_0xecff('0x32')],_0x49d0e2),_0x5495f9),'consequence':require(_0xecff('0x33')+_0x49d0e2[_0xecff('0x1f')])['consequence'](_0x24abef,_0x494754,_0x5495f9,_0x35ce1f),'p':_0x49d0e2[_0xecff('0x34')]||0x0};logger[_0xecff('0x35')]('Push\x20new\x20rule',_0x28141f['id'],'on\x20interval',getIntervals(_0x5495f9[_0xecff('0x32')],_0x49d0e2)[_0xecff('0x1e')](_0xecff('0x36')));_0x52b62f[_0xecff('0x23')](_0x28141f);}else{logger[_0xecff('0x37')](_0xecff('0x38'),path['join'](__dirname,_0xecff('0x1a'),_0x49d0e2[_0xecff('0x1f')]+'.js'));}}_0x5495f9[_0xecff('0x39')][_0x24abef]=new RuleEngine(_0x52b62f);_0x5495f9[_0xecff('0x39')][_0x24abef][_0xecff('0x3a')](_0x35ce1f,function(_0x4402a0){logger[_0xecff('0x35')](_0xecff('0x3b'),JSON['stringify'](_0x4402a0[_0xecff('0x3c')]));if(_0x5495f9[_0xecff('0x39')][_0x24abef]){_0x5495f9[_0xecff('0x39')][_0x24abef]['emit'](_0xecff('0x3d'));}});return _0x3a7623({'code':0xc8,'message':_0x35ce1f});}else{logger[_0xecff('0x35')](_0xecff('0x3e'));return _0x3a7623({'code':0xc8,'message':_0x35ce1f});}}catch(_0x3c73ca){logger['error'](_0x3c73ca[_0xecff('0x3f')]);return _0x596b09(_0x362ed0[_0xecff('0x37')](0x1f4,_0x3c73ca));}}return _0x596b09('routing\x20is\x20empty');});},'AcceptMessage':function(_0x22869d){var _0x1d2ac3=this;return new Promise(function(_0x4ba9e3,_0x1ee5fc){if(_0x22869d['agent']&&_0x22869d[_0xecff('0x40')]['id']){if(_0x5495f9[_0xecff('0x41')][_0x22869d[_0xecff('0x40')]['id']]){_0x5495f9[_0xecff('0x41')][_0x22869d[_0xecff('0x40')]['id']][_0xecff('0x42')]=![];_0x5495f9['agents'][_0x22869d['agent']['id']][_0xecff('0x43')]=undefined;}}if(_0x22869d[_0xecff('0x18')]&&_0x22869d[_0xecff('0x18')]['id']){try{var _0x29ff01=getId(_0x22869d[_0xecff('0x17')],_0x22869d[_0xecff('0x18')]?_0x22869d[_0xecff('0x18')]['id']:0x0,_0x22869d[_0xecff('0x19')]?_0x22869d['interaction']['id']:0x0);if(_0x5495f9[_0xecff('0x39')][_0x29ff01]){_0x5495f9[_0xecff('0x39')][_0x29ff01]['emit'](_0xecff('0x44'));if(rpc[_0x22869d['channel']+_0xecff('0x45')]){rpc[_0x22869d[_0xecff('0x17')]+'QueueReport'][_0xecff('0x46')](_0x29ff01,{'UserId':_0x22869d[_0xecff('0x18')][_0xecff('0x47')]})[_0xecff('0x48')](function(_0x27cc00){logger['error']('error\x20update\x20queue\x20report');});}}return _0x4ba9e3({'code':0xc8,'message':_0x22869d});}catch(_0x198ad6){logger[_0xecff('0x37')](_0x198ad6[_0xecff('0x3f')]);return _0x1ee5fc(_0x1d2ac3[_0xecff('0x37')](0x1f4,_0x198ad6));}}logger[_0xecff('0x37')](_0xecff('0x49'));return _0x1ee5fc(_0x1d2ac3[_0xecff('0x37')](0x1f4,_0xecff('0x49')));});},'RejectMessage':function(_0x9b44d4){var _0x4f9060=this;return new Promise(function(_0x289659,_0x56fed4){if(_0x9b44d4[_0xecff('0x40')]&&_0x9b44d4[_0xecff('0x40')]['id']){try{if(_0x5495f9[_0xecff('0x41')][_0x9b44d4['agent']['id']]){_0x5495f9[_0xecff('0x41')][_0x9b44d4['agent']['id']][_0xecff('0x42')]=![];_0x5495f9['agents'][_0x9b44d4['agent']['id']][_0xecff('0x43')]=undefined;}return _0x289659({'code':0xc8,'message':_0x9b44d4});}catch(_0x5cd819){logger[_0xecff('0x37')](_0x5cd819[_0xecff('0x3f')]);return _0x56fed4(_0x4f9060['error'](0x1f4,_0x5cd819));}}logger[_0xecff('0x37')](_0xecff('0x49'));return _0x56fed4(_0x4f9060[_0xecff('0x37')](0x1f4,_0xecff('0x49')));});},'AbandonInteraction':function(_0x181760){var _0x162938=this;return new Promise(function(_0x74fc77,_0x574c40){if(_0x181760['channel']&&_0x181760[_0xecff('0x19')]&&_0x181760[_0xecff('0x19')]['id']){try{var _0x18ead4=getId(_0x181760[_0xecff('0x17')],_0x181760[_0xecff('0x18')]?_0x181760[_0xecff('0x18')]['id']:0x0,_0x181760[_0xecff('0x19')]?_0x181760[_0xecff('0x19')]['id']:0x0);if(_0x5495f9[_0xecff('0x39')][_0x18ead4]){_0x5495f9[_0xecff('0x39')][_0x18ead4][_0xecff('0x4a')](_0xecff('0x44'));}return _0x74fc77({'code':0xc8,'message':_0x181760});}catch(_0x3f8e22){logger[_0xecff('0x37')](_0x3f8e22['stack']);return _0x574c40(_0x162938['error'](0x1f4,_0x3f8e22));}}logger[_0xecff('0x37')]('message\x20is\x20empty');return _0x574c40(_0x162938['error'](0x1f4,_0xecff('0x49')));});},'AgentCapacity':function(_0x41efbc){var _0x371e6=this;return new Promise(function(_0x48a737,_0x161190){if(_0x5495f9[_0xecff('0x41')][_0xecff('0x4b')](_0x41efbc['id'])){for(var _0x56b445 in _0x41efbc[_0xecff('0x4c')]){if(_0x41efbc['capacity']['hasOwnProperty'](_0x56b445)){if(_0x5495f9[_0xecff('0x41')][_0x41efbc['id']][_0xecff('0x4b')](_0x56b445+_0xecff('0x4d'))){_0x5495f9[_0xecff('0x41')][_0x41efbc['id']][_0x56b445+_0xecff('0x4d')]=parseInt(_0x41efbc[_0xecff('0x4c')][_0x56b445],0xa);}}}_0x5495f9[_0xecff('0x41')][_0x41efbc['id']][_0xecff('0x4e')]();return _0x48a737({'code':0xc8,'message':_0x5495f9[_0xecff('0x41')][_0x41efbc['id']]});}else{return _0x161190(_0x371e6[_0xecff('0x37')](0x1f4,_0xecff('0x4f')));}});},'Agents':function(_0x3dcafd){return new Promise(function(_0x22e778,_0x3042c3){var _0x4d6265=_['values'](_0x5495f9[_0xecff('0x41')]);_0x22e778({'count':_0x4d6265[_0xecff('0x1c')],'rows':_0x4d6265});});},'ChatQueues':function(_0x4c0b1c){return new Promise(function(_0x15be2b,_0xe7f29a){var _0x59857d=[];for(var _0x148c69 in _0x5495f9[_0xecff('0x50')]){if(_0x5495f9[_0xecff('0x50')][_0xecff('0x4b')](_0x148c69)){var _0x20e8ab=_0x5495f9[_0xecff('0x50')][_0x148c69];var _0x485361={'id':_0x20e8ab['id'],'available':_0x20e8ab[_0xecff('0x51')],'loggedIn':_0x20e8ab[_0xecff('0x52')],'name':_0x20e8ab[_0xecff('0x53')],'paused':_0x20e8ab[_0xecff('0x54')],'waiting':_0x20e8ab[_0xecff('0x55')]};_0x59857d['push'](_0x485361);}}_0x15be2b({'count':_0x59857d[_0xecff('0x1c')],'rows':_0x59857d});});},'MailQueues':function(_0x4ca3c0){return new Promise(function(_0x6988b9,_0x3e54b8){var _0x5661b5=[];for(var _0x5988c2 in _0x5495f9['mailQueues']){if(_0x5495f9[_0xecff('0x56')][_0xecff('0x4b')](_0x5988c2)){var _0x1af54d=_0x5495f9['mailQueues'][_0x5988c2];var _0x2b79b3={'id':_0x1af54d['id'],'available':_0x1af54d['available'],'loggedIn':_0x1af54d[_0xecff('0x52')],'name':_0x1af54d[_0xecff('0x53')],'paused':_0x1af54d[_0xecff('0x54')],'waiting':_0x1af54d[_0xecff('0x55')]};_0x5661b5['push'](_0x2b79b3);}}_0x6988b9({'count':_0x5661b5[_0xecff('0x1c')],'rows':_0x5661b5});});},'OpenchannelQueues':function(_0x23aa75){return new Promise(function(_0xb3594f,_0x4dfd1d){var _0x5dd627=[];for(var _0x3aa2d8 in _0x5495f9[_0xecff('0x57')]){if(_0x5495f9['openchannelQueues'][_0xecff('0x4b')](_0x3aa2d8)){var _0x3756fe=_0x5495f9[_0xecff('0x57')][_0x3aa2d8];var _0xe7f2fb={'id':_0x3756fe['id'],'available':_0x3756fe[_0xecff('0x51')],'loggedIn':_0x3756fe['loggedIn'],'name':_0x3756fe['name'],'paused':_0x3756fe[_0xecff('0x54')],'waiting':_0x3756fe[_0xecff('0x55')]};_0x5dd627['push'](_0xe7f2fb);}}_0xb3594f({'count':_0x5dd627['length'],'rows':_0x5dd627});});},'SmsQueues':function(_0xd588df){return new Promise(function(_0x5d1635,_0x1b0ccd){var _0xac26eb=[];for(var _0x5155c1 in _0x5495f9[_0xecff('0x58')]){if(_0x5495f9[_0xecff('0x58')][_0xecff('0x4b')](_0x5155c1)){var _0x3f6444=_0x5495f9[_0xecff('0x58')][_0x5155c1];var _0x11648c={'id':_0x3f6444['id'],'available':_0x3f6444[_0xecff('0x51')],'loggedIn':_0x3f6444[_0xecff('0x52')],'name':_0x3f6444['name'],'paused':_0x3f6444[_0xecff('0x54')],'waiting':_0x3f6444['waiting']};_0xac26eb['push'](_0x11648c);}}_0x5d1635({'count':_0xac26eb[_0xecff('0x1c')],'rows':_0xac26eb});});},'FaxQueues':function(_0x5aa6c7){return new Promise(function(_0x4932ff,_0x3769ff){var _0x16669b=[];for(var _0x8fcddc in _0x5495f9[_0xecff('0x59')]){if(_0x5495f9[_0xecff('0x59')]['hasOwnProperty'](_0x8fcddc)){var _0x46e71c=_0x5495f9[_0xecff('0x59')][_0x8fcddc];var _0x147766={'id':_0x46e71c['id'],'available':_0x46e71c[_0xecff('0x51')],'loggedIn':_0x46e71c[_0xecff('0x52')],'name':_0x46e71c['name'],'paused':_0x46e71c[_0xecff('0x54')],'waiting':_0x46e71c[_0xecff('0x55')]};_0x16669b[_0xecff('0x23')](_0x147766);}}_0x4932ff({'count':_0x16669b[_0xecff('0x1c')],'rows':_0x16669b});});},'WhatsappQueues':function(_0x46ba08){return new Promise(function(_0x4e829b,_0x5a0cea){var _0x29ea01=[];for(var _0x5b6054 in _0x5495f9['whatsappQueues']){if(_0x5495f9[_0xecff('0x5a')]['hasOwnProperty'](_0x5b6054)){var _0xae0c00=_0x5495f9['whatsappQueues'][_0x5b6054];var _0x5ef856={'id':_0xae0c00['id'],'available':_0xae0c00['available'],'loggedIn':_0xae0c00['loggedIn'],'name':_0xae0c00[_0xecff('0x53')],'paused':_0xae0c00[_0xecff('0x54')],'waiting':_0xae0c00[_0xecff('0x55')]};_0x29ea01[_0xecff('0x23')](_0x5ef856);}}_0x4e829b({'count':_0x29ea01[_0xecff('0x1c')],'rows':_0x29ea01});});},'ChatQueuesWaitingInteractions':function(_0x391ea3){return new Promise(function(_0x1bbf7a,_0x385909){var _0x410d73=_[_0xecff('0x5b')](_0x5495f9['chatQueuesWaitingInteractions']);_0x1bbf7a({'count':_0x410d73[_0xecff('0x1c')],'rows':_0x410d73});});},'MailQueuesWaitingInteractions':function(_0x461dfb){return new Promise(function(_0x44e34a,_0x2d77a){var _0x2c07fb=_['values'](_0x5495f9[_0xecff('0x5c')]);_0x44e34a({'count':_0x2c07fb[_0xecff('0x1c')],'rows':_0x2c07fb});});},'OpenchannelQueuesWaitingInteractions':function(_0x19d449){return new Promise(function(_0x4f3e8c,_0xd9787d){var _0x4f2af6=_[_0xecff('0x5b')](_0x5495f9['openchannelQueuesWaitingInteractions']);_0x4f3e8c({'count':_0x4f2af6[_0xecff('0x1c')],'rows':_0x4f2af6});});},'SmsQueuesWaitingInteractions':function(_0x1fd6df){return new Promise(function(_0x2d934a,_0x198b36){var _0x2d3286=_['values'](_0x5495f9[_0xecff('0x5d')]);_0x2d934a({'count':_0x2d3286[_0xecff('0x1c')],'rows':_0x2d3286});});},'FaxQueuesWaitingInteractions':function(_0x537151){return new Promise(function(_0x49c50e,_0x4306f4){var _0x334310=_[_0xecff('0x5b')](_0x5495f9[_0xecff('0x5e')]);_0x49c50e({'count':_0x334310['length'],'rows':_0x334310});});},'WhatsappQueuesWaitingInteractions':function(_0x2eb5b4){return new Promise(function(_0x28e423,_0x581e15){var _0x3f8cd9=_['values'](_0x5495f9['whatsappQueuesWaitingInteractions']);_0x28e423({'count':_0x3f8cd9[_0xecff('0x1c')],'rows':_0x3f8cd9});});}};var _0x49cc1e=jayson[_0xecff('0x5f')](_0x558ecd)[_0xecff('0x60')]();_0x49cc1e['on'](_0xecff('0x37'),function(_0x8cb05f){logger[_0xecff('0x37')](JSON['stringify'](_0x8cb05f));return _0x2e1d6f(_0x8cb05f);});_0x49cc1e['listen'](0x232c,'127.0.0.1',function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0xa26f3d(_0xecff('0x61')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index ff456be..10de559 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 _0x41a5=['bluebird','lodash','../../../config/logger','routing','client','http','request','error','message','catch','condition','info','stop','push','Command','format','iftime\x20%s','then','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x41a5,0x10d));var _0x541a=function(_0x4ccaaf,_0x2de9ea){_0x4ccaaf=_0x4ccaaf-0x0;var _0x4f070a=_0x41a5[_0x4ccaaf];return _0x4f070a;};'use strict';var util=require(_0x541a('0x0'));var BPromise=require(_0x541a('0x1'));var jayson=require('jayson/promise');var _=require(_0x541a('0x2'));var logger=require(_0x541a('0x3'))(_0x541a('0x4'));var client=jayson[_0x541a('0x5')][_0x541a('0x6')]({'port':0x232a});function request(_0x368366,_0x2ce8cf){return new BPromise(function(_0x780154,_0x4a589){return client[_0x541a('0x7')](_0x368366,_0x2ce8cf)['then'](function(_0x1947d3){if(_0x1947d3[_0x541a('0x8')]){return _0x4a589(_0x1947d3[_0x541a('0x8')][_0x541a('0x9')]);}else{return _0x780154(_0x1947d3['result']);}})[_0x541a('0xa')](function(_0x4b9d08){return _0x4a589(_0x4b9d08);});});}exports[_0x541a('0xb')]=function(_0x4cdd31,_0x5e06ba,_0x5001ad){return function(_0x18e0de){if(_0x5001ad['rules']&&!_0x5001ad['rules'][_0x4cdd31]){logger[_0x541a('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x4cdd31);return _0x18e0de[_0x541a('0xd')]();}var _0x57dbc3=[];for(var _0x1d6865=0x0;_0x1d6865<_0x5e06ba['length'];_0x1d6865+=0x1){_0x57dbc3[_0x541a('0xe')](request(_0x541a('0xf'),{'command':util[_0x541a('0x10')](_0x541a('0x11'),_0x5e06ba[_0x1d6865])})[_0x541a('0x12')](function(_0x266d99){return _0x266d99&&_0x266d99['message']&&_0x266d99['message']['indexOf']('true')>=0x0?!![]:![];})['catch'](function(_0x4c3084){logger[_0x541a('0x8')](_0x541a('0x13'),_0x4cdd31,_0x5e06ba[_0x1d6865]);}));}BPromise['all'](_0x57dbc3)[_0x541a('0x12')](function(_0x35042c){var _0x2531c2=_[_0x541a('0x14')](_0x35042c);logger[_0x541a('0xc')](_0x541a('0x15'),_0x4cdd31,_0x5e06ba[_0x541a('0x16')](_0x541a('0x17')),_0x2531c2);_0x18e0de[_0x541a('0x18')](_0x2531c2);})[_0x541a('0xa')](function(_0x3f02b6){console[_0x541a('0x19')](_0x3f02b6);logger[_0x541a('0x8')](_0x541a('0x15'),_0x4cdd31,_0x5e06ba['join'](_0x541a('0x17')),_0x3f02b6[_0x541a('0x1a')]);_0x18e0de['stop']();});};}; \ No newline at end of file +var _0x2606=['\x20|\x20','when','log','stack','util','bluebird','../../../config/logger','client','http','request','message','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','iftime\x20%s','then','indexOf','true','catch','error','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join'];(function(_0x360e40,_0x2b8a52){var _0x271ff8=function(_0x1469e9){while(--_0x1469e9){_0x360e40['push'](_0x360e40['shift']());}};_0x271ff8(++_0x2b8a52);}(_0x2606,0x1d4));var _0x6260=function(_0x12605e,_0x3d8305){_0x12605e=_0x12605e-0x0;var _0x35fb69=_0x2606[_0x12605e];return _0x35fb69;};'use strict';var util=require(_0x6260('0x0'));var BPromise=require(_0x6260('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0x6260('0x2'))('routing');var client=jayson[_0x6260('0x3')][_0x6260('0x4')]({'port':0x232a});function request(_0x37bdd3,_0x494636){return new BPromise(function(_0x20db30,_0x3021b9){return client[_0x6260('0x5')](_0x37bdd3,_0x494636)['then'](function(_0x599671){if(_0x599671['error']){return _0x3021b9(_0x599671['error'][_0x6260('0x6')]);}else{return _0x20db30(_0x599671[_0x6260('0x7')]);}})['catch'](function(_0x2bb1a3){return _0x3021b9(_0x2bb1a3);});});}exports['condition']=function(_0x5a0bc2,_0x434c15,_0x5d147c){return function(_0x14173a){if(_0x5d147c[_0x6260('0x8')]&&!_0x5d147c[_0x6260('0x8')][_0x5a0bc2]){logger[_0x6260('0x9')](_0x6260('0xa'),_0x5a0bc2);return _0x14173a[_0x6260('0xb')]();}var _0x5bba19=[];for(var _0x2a0b38=0x0;_0x2a0b38<_0x434c15['length'];_0x2a0b38+=0x1){_0x5bba19[_0x6260('0xc')](request(_0x6260('0xd'),{'command':util['format'](_0x6260('0xe'),_0x434c15[_0x2a0b38])})[_0x6260('0xf')](function(_0x2e1748){return _0x2e1748&&_0x2e1748['message']&&_0x2e1748[_0x6260('0x6')][_0x6260('0x10')](_0x6260('0x11'))>=0x0?!![]:![];})[_0x6260('0x12')](function(_0x589135){logger[_0x6260('0x13')](_0x6260('0x14'),_0x5a0bc2,_0x434c15[_0x2a0b38]);}));}BPromise[_0x6260('0x15')](_0x5bba19)['then'](function(_0x450ff8){var _0x429641=_[_0x6260('0x16')](_0x450ff8);logger[_0x6260('0x9')](_0x6260('0x17'),_0x5a0bc2,_0x434c15[_0x6260('0x18')](_0x6260('0x19')),_0x429641);_0x14173a[_0x6260('0x1a')](_0x429641);})[_0x6260('0x12')](function(_0x3d688b){console[_0x6260('0x1b')](_0x3d688b);logger[_0x6260('0x13')](_0x6260('0x17'),_0x5a0bc2,_0x434c15[_0x6260('0x18')](_0x6260('0x19')),_0x3d688b[_0x6260('0x1c')]);_0x14173a[_0x6260('0xb')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 9fc142f..8184920 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 _0x750a=['interface','calleridnum','connectedlinenum','lastevent','then','type','agentcomplete','acw','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','now','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','agentconnectAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','agentcalledAt','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername'];(function(_0x36817f,_0x3137af){var _0x5e6bf0=function(_0x39d47b){while(--_0x39d47b){_0x36817f['push'](_0x36817f['shift']());}};_0x5e6bf0(++_0x3137af);}(_0x750a,0x140));var _0xa750=function(_0x594695,_0xd103c4){_0x594695=_0x594695-0x0;var _0x353faa=_0x750a[_0x594695];return _0x353faa;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x499583,_0x139fa5){utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x3'),_0x499583[_0xa750('0x4')],_0x499583[_0xa750('0x5')],_0x499583[_0xa750('0x6')],_0x499583[_0xa750('0x7')],_0x499583[_0xa750('0x8')],_0x499583[_0xa750('0x9')],_0x499583[_0xa750('0xa')],_0x499583[_0xa750('0xb')]));if(_0x499583[_0xa750('0x6')]){utils['getVoiceQueueByName'](_0x499583['queue'])[_0xa750('0xc')](function(_0x5b684e){if(_0x5b684e){_0x499583[_0xa750('0xd')]=_0x5b684e[_0xa750('0xd')];_0x499583['agentacw']=_0x499583[_0xa750('0xe')]?_0x5b684e[_0xa750('0xf')]:![];_0x499583['acwtime']=_0x499583['agentacw']?_0x5b684e[_0xa750('0x10')]:0x0;}utils['request'](_0xa750('0x11'),_0x499583);});}else{utils[_0xa750('0x12')]('CreateVoiceAgentReport',_0x499583);}if(_0x139fa5){delete transfers[_0x499583[_0xa750('0x4')]];}else{delete agents[_0x499583[_0xa750('0x13')]];}}exports[_0xa750('0x14')]=function(_0x567c51){try{utils[_0xa750('0x15')](util[_0xa750('0x2')](_0xa750('0x16'),_0x567c51[_0xa750('0x4')]),_0x567c51);agents[_0x567c51[_0xa750('0x13')]]=_0x567c51;agents[_0x567c51[_0xa750('0x13')]]['agentcalledAt']=utils[_0xa750('0x17')]();agents[_0x567c51[_0xa750('0x13')]][_0xa750('0xb')]='called';agents[_0x567c51[_0xa750('0x13')]][_0xa750('0xa')]=null;agents[_0x567c51['destuniqueid']]['connectedlinename']=null;utils[_0xa750('0x1')](util['format'](_0xa750('0x18'),_0x567c51[_0xa750('0x4')],agents[_0x567c51['destuniqueid']][_0xa750('0x7')],_0x567c51['destuniqueid']));}catch(_0x5f28f4){utils[_0xa750('0x19')](util['format'](_0xa750('0x16'),_0x567c51['uniqueid']),_0x5f28f4);}};exports[_0xa750('0x1a')]=function(_0x4a007d){try{if(!_[_0xa750('0x1b')](agents[_0x4a007d['destuniqueid']])){utils[_0xa750('0x15')](util['format']('[%s][agents][agentringnoanswer]',_0x4a007d[_0xa750('0x4')]),_0x4a007d);utils['info'](util[_0xa750('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x4a007d['uniqueid'],agents[_0x4a007d['destuniqueid']]['membername'],_0x4a007d[_0xa750('0x13')]));agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1a')]=!![];agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1c')]=utils[_0xa750('0x17')]();agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0xb')]=_0xa750('0x1d');agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1e')]=_0xa750('0x1d');agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1f')]=_0x4a007d[_0xa750('0x20')]?parseInt(_0x4a007d['ringtime'])/0x3e8:0x0;agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x21')]=0x0;unanswered[_0xa750('0x22')](_0x4a007d['destuniqueid']);}}catch(_0x35ab53){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x23'),_0x4a007d['uniqueid']),_0x35ab53);}};exports[_0xa750('0x24')]=function(_0x34d5e9){try{_[_0xa750('0x25')](agents,function(_0x2aef3a,_0x2c5253){if(_0x2aef3a['uniqueid']==_0x34d5e9[_0xa750('0x4')]&&!_['includes'](unanswered,_0x2aef3a[_0xa750('0x13')])){utils[_0xa750('0x15')](util['format'](_0xa750('0x26'),_0x34d5e9[_0xa750('0x4')]),_0x34d5e9);utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x27'),_0x34d5e9[_0xa750('0x4')],_0x2aef3a[_0xa750('0x7')],_0x2aef3a[_0xa750('0x13')]));_0x2aef3a['agentringnoanswer']=!![];_0x2aef3a[_0xa750('0x1c')]=utils['now']();_0x2aef3a[_0xa750('0xb')]=_0xa750('0x28');_0x2aef3a[_0xa750('0x1e')]=_0xa750('0x28');_0x2aef3a['holdtime']=_0x34d5e9[_0xa750('0x1f')];_0x2aef3a[_0xa750('0x21')]=0x0;writeDB(_0x2aef3a);}});}catch(_0x5c2e02){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x26'),_0x34d5e9[_0xa750('0x4')]),_0x5c2e02);}};exports['agentconnect']=function(_0xf60128){try{if(agents[_0xf60128['destuniqueid']]){utils['debug'](util[_0xa750('0x2')](_0xa750('0x29'),_0xf60128[_0xa750('0x4')]),_0xf60128);utils['info'](util[_0xa750('0x2')](_0xa750('0x2a'),_0xf60128[_0xa750('0x4')],agents[_0xf60128['destuniqueid']][_0xa750('0x7')],_0xf60128[_0xa750('0x13')]));agents[_0xf60128[_0xa750('0x13')]]['agentconnectAt']=utils[_0xa750('0x17')]();agents[_0xf60128[_0xa750('0x13')]][_0xa750('0xa')]=_0xf60128['connectedlinenum'];agents[_0xf60128[_0xa750('0x13')]][_0xa750('0x2b')]=_0xf60128[_0xa750('0x2b')];agents[_0xf60128[_0xa750('0x13')]]['holdtime']=_0xf60128['ringtime'];agents[_0xf60128[_0xa750('0x13')]][_0xa750('0xb')]='connect';_[_0xa750('0x25')](agents,function(_0x2f57e9,_0x15d35a){if(_0x2f57e9[_0xa750('0x13')]!=_0xf60128[_0xa750('0x13')]&&_0x2f57e9['uniqueid']==_0xf60128[_0xa750('0x4')]){_0x2f57e9[_0xa750('0x21')]=0x0;_0x2f57e9[_0xa750('0x1f')]=_0xf60128[_0xa750('0x20')];_0x2f57e9[_0xa750('0x1a')]=!![];_0x2f57e9[_0xa750('0x1c')]=utils[_0xa750('0x17')]();_0x2f57e9['lastevent']=_0xa750('0x2c');_0x2f57e9['reason']=_0xa750('0x2c');_0x2f57e9['answeredelsewheredestinationuniqueid']=_0xf60128[_0xa750('0x13')];_0x2f57e9[_0xa750('0x2d')]=_0xf60128[_0xa750('0x7')];writeDB(_0x2f57e9);}});}}catch(_0x1be24e){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x29'),_0xf60128[_0xa750('0x4')]),_0x1be24e);}};exports[_0xa750('0xe')]=function(_0x108a1a){try{if(!_[_0xa750('0x1b')](agents[_0x108a1a[_0xa750('0x13')]])){utils[_0xa750('0x15')](util[_0xa750('0x2')](_0xa750('0x2e'),_0x108a1a[_0xa750('0x4')]),_0x108a1a);utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x2f'),_0x108a1a[_0xa750('0x4')],agents[_0x108a1a['destuniqueid']][_0xa750('0x7')],_0x108a1a[_0xa750('0x13')]));agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0xe')]=!![];agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x30')]=utils[_0xa750('0x17')]();agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x21')]=utils['diffTime'](agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x30')],agents[_0x108a1a['destuniqueid']][_0xa750('0x31')]);agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x1e')]=_0x108a1a[_0xa750('0x1e')];agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0xb')]=_0xa750('0x32');writeDB(agents[_0x108a1a[_0xa750('0x13')]]);}}catch(_0x3faf01){utils[_0xa750('0x19')](util['format'](_0xa750('0x2e'),_0x108a1a[_0xa750('0x4')]),_0x3faf01);}};exports['blindtransfer']=function(_0x93e49f){try{if(!_[_0xa750('0x1b')](agents[_0x93e49f[_0xa750('0x33')]])){utils['debug'](util[_0xa750('0x2')](_0xa750('0x34'),_0x93e49f[_0xa750('0x4')]),_0x93e49f);utils[_0xa750('0x1')](util['format'](_0xa750('0x35'),_0x93e49f[_0xa750('0x4')],agents[_0x93e49f[_0xa750('0x33')]][_0xa750('0x7')],agents[_0x93e49f['transfereruniqueid']][_0xa750('0x4')]));agents[_0x93e49f[_0xa750('0x33')]]['transfer']=!![];agents[_0x93e49f[_0xa750('0x33')]]['transfertype']=_0xa750('0x36');agents[_0x93e49f[_0xa750('0x33')]]['transferexten']=_0x93e49f['extension'];agents[_0x93e49f['transfereruniqueid']][_0xa750('0x37')]=agents[_0x93e49f[_0xa750('0x33')]]['uniqueid'];}}catch(_0xe88dc){utils[_0xa750('0x19')](util[_0xa750('0x2')]('[%s][agents][blindtransfer]',_0x93e49f['uniqueid']),_0xe88dc);}};exports['attendedtransfer']=function(_0x5d8dd2){try{utils[_0xa750('0x15')](util['format'](_0xa750('0x38'),_0x5d8dd2[_0xa750('0x39')]),_0x5d8dd2);if(_0x5d8dd2['origtransfereruniqueid']==_0x5d8dd2[_0xa750('0x3a')]){if(!_['isNil'](agents[_0x5d8dd2[_0xa750('0x3b')]])){utils['info'](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x5d8dd2['origtransfereruniqueid'],agents[_0x5d8dd2[_0xa750('0x3b')]][_0xa750('0x7')]));agents[_0x5d8dd2['secondtransfereruniqueid']]['transfer']=!![];agents[_0x5d8dd2['secondtransfereruniqueid']][_0xa750('0x3c')]=_0xa750('0x3d');agents[_0x5d8dd2[_0xa750('0x3b')]][_0xa750('0x3e')]=_0x5d8dd2[_0xa750('0x3f')];agents[_0x5d8dd2[_0xa750('0x3b')]]['transferuniqueid']=_0x5d8dd2['origtransfereruniqueid'];}if(_0x5d8dd2[_0xa750('0x40')]&&agents[_0x5d8dd2[_0xa750('0x40')]]){agents[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x41')]=0x1;transfers[_0x5d8dd2[_0xa750('0x40')]]=_['clone'](agents[_0x5d8dd2[_0xa750('0x40')]]);transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x9')]=agents[_0x5d8dd2[_0xa750('0x3b')]][_0xa750('0x9')];transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x42')]=agents[_0x5d8dd2[_0xa750('0x3b')]]['calleridname'];transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x43')]=utils[_0xa750('0x17')]();transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x31')]=utils['now']();transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x1f')]=0x0;transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x41')]=0x2;}}else if(_0x5d8dd2[_0xa750('0x3b')]==_0x5d8dd2[_0xa750('0x44')]){if(!_[_0xa750('0x1b')](agents[_0x5d8dd2[_0xa750('0x39')]])){utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x45'),_0x5d8dd2[_0xa750('0x39')],agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x7')]));agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x46')]=!![];agents[_0x5d8dd2['origtransfereruniqueid']][_0xa750('0x3c')]='ATTENDED';agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x3e')]=_0x5d8dd2[_0xa750('0x47')];agents[_0x5d8dd2['origtransfereruniqueid']][_0xa750('0x37')]=_0x5d8dd2[_0xa750('0x3b')];}if(_0x5d8dd2[_0xa750('0x48')]&&agents[_0x5d8dd2[_0xa750('0x48')]]){agents[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x41')]=0x1;transfers[_0x5d8dd2['transfertargetuniqueid']]=_[_0xa750('0x49')](agents[_0x5d8dd2[_0xa750('0x48')]]);transfers[_0x5d8dd2['transfertargetuniqueid']][_0xa750('0x9')]=agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x9')];transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x42')]=agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x42')];transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x43')]=utils[_0xa750('0x17')]();transfers[_0x5d8dd2[_0xa750('0x48')]]['agentconnectAt']=utils['now']();transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x1f')]=0x0;transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x41')]=0x2;}}}catch(_0x5e17a0){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x38'),_0x5d8dd2[_0xa750('0x39')]),_0x5e17a0);}};exports[_0xa750('0x4a')]=function(_0x473188){try{utils[_0xa750('0x15')](util[_0xa750('0x2')](_0xa750('0x4b'),_0x473188[_0xa750('0x4')]),_0x473188);if(agents[_0x473188[_0xa750('0x4')]]&&agents[_0x473188['uniqueid']]['reason']===_0xa750('0x1d')){if(_0x473188['cause']==='21'){agents[_0x473188['uniqueid']][_0xa750('0x1e')]=_0xa750('0x4c');agents[_0x473188[_0xa750('0x4')]][_0xa750('0xb')]=_0xa750('0x4c');}utils['info'](util[_0xa750('0x2')](_0xa750('0x4d'),_0x473188[_0xa750('0x4')],agents[_0x473188[_0xa750('0x4')]][_0xa750('0x7')],agents[_0x473188[_0xa750('0x4')]]['reason'],agents[_0x473188['uniqueid']][_0xa750('0xb')]));writeDB(agents[_0x473188[_0xa750('0x4')]]);var _0x30a371=unanswered[_0xa750('0x4e')](_0x473188[_0xa750('0x4')]);if(_0x30a371>-0x1){unanswered[_0xa750('0x4f')](_0x30a371,0x1);}}if(transfers[_0x473188[_0xa750('0x4')]]){transfers[_0x473188[_0xa750('0x4')]]['agentcomplete']=!![];transfers[_0x473188[_0xa750('0x4')]]['agentcompleteAt']=utils['now']();transfers[_0x473188[_0xa750('0x4')]][_0xa750('0x21')]=utils[_0xa750('0x50')](transfers[_0x473188[_0xa750('0x4')]]['agentcompleteAt'],transfers[_0x473188[_0xa750('0x4')]][_0xa750('0x31')]);transfers[_0x473188[_0xa750('0x4')]][_0xa750('0x1e')]='agent';transfers[_0x473188[_0xa750('0x4')]][_0xa750('0xb')]=_0xa750('0x32');utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x4d'),_0x473188[_0xa750('0x4')],transfers[_0x473188[_0xa750('0x4')]]['membername'],transfers[_0x473188['uniqueid']][_0xa750('0x1e')],transfers[_0x473188['uniqueid']][_0xa750('0xb')]));writeDB(transfers[_0x473188[_0xa750('0x4')]],!![]);}if(agents[_0x473188['uniqueid']]&&agents[_0x473188[_0xa750('0x4')]]['agentconnectAt']){agents[_0x473188[_0xa750('0x4')]][_0xa750('0xe')]=!![];agents[_0x473188[_0xa750('0x4')]]['agentcompleteAt']=utils[_0xa750('0x17')]();agents[_0x473188[_0xa750('0x4')]][_0xa750('0x21')]=utils[_0xa750('0x50')](agents[_0x473188['uniqueid']]['agentcompleteAt'],agents[_0x473188['uniqueid']][_0xa750('0x31')]);agents[_0x473188[_0xa750('0x4')]]['reason']=agents[_0x473188[_0xa750('0x4')]][_0xa750('0x46')]?_0xa750('0x46'):_0xa750('0x51');agents[_0x473188[_0xa750('0x4')]][_0xa750('0xb')]='complete';utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x4d'),_0x473188['uniqueid'],agents[_0x473188[_0xa750('0x4')]][_0xa750('0x7')],agents[_0x473188[_0xa750('0x4')]][_0xa750('0x1e')],agents[_0x473188['uniqueid']][_0xa750('0xb')]));writeDB(agents[_0x473188[_0xa750('0x4')]]);}}catch(_0x32b8e7){utils['error'](util[_0xa750('0x2')]('[%s][agents][hangup]',_0x473188[_0xa750('0x4')]),_0x32b8e7);}}; \ No newline at end of file +var _0xab40=['forIn','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfer','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','connectedlinenum','lastevent','queue','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','membername','agentringnoanswerAt','timeout','reason','ringtime','talktime','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connect'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xab40,0xcd));var _0x0ab4=function(_0x10ed3f,_0x15d427){_0x10ed3f=_0x10ed3f-0x0;var _0x875e95=_0xab40[_0x10ed3f];return _0x875e95;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x570f05,_0x4f3e19){utils[_0x0ab4('0x2')](util[_0x0ab4('0x3')](_0x0ab4('0x4'),_0x570f05[_0x0ab4('0x5')],_0x570f05[_0x0ab4('0x6')],_0x570f05['queue'],_0x570f05['membername'],_0x570f05[_0x0ab4('0x7')],_0x570f05['calleridnum'],_0x570f05[_0x0ab4('0x8')],_0x570f05[_0x0ab4('0x9')]));if(_0x570f05[_0x0ab4('0xa')]){utils[_0x0ab4('0xb')](_0x570f05['queue'])['then'](function(_0x4b01c4){if(_0x4b01c4){_0x570f05[_0x0ab4('0xc')]=_0x4b01c4[_0x0ab4('0xc')];_0x570f05[_0x0ab4('0xd')]=_0x570f05[_0x0ab4('0xe')]?_0x4b01c4[_0x0ab4('0xf')]:![];_0x570f05[_0x0ab4('0x10')]=_0x570f05[_0x0ab4('0xd')]?_0x4b01c4[_0x0ab4('0x11')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x570f05);});}else{utils[_0x0ab4('0x12')]('CreateVoiceAgentReport',_0x570f05);}if(_0x4f3e19){delete transfers[_0x570f05[_0x0ab4('0x5')]];}else{delete agents[_0x570f05[_0x0ab4('0x13')]];}}exports[_0x0ab4('0x14')]=function(_0x1e2b56){try{utils[_0x0ab4('0x15')](util[_0x0ab4('0x3')](_0x0ab4('0x16'),_0x1e2b56[_0x0ab4('0x5')]),_0x1e2b56);agents[_0x1e2b56[_0x0ab4('0x13')]]=_0x1e2b56;agents[_0x1e2b56[_0x0ab4('0x13')]][_0x0ab4('0x17')]=utils[_0x0ab4('0x18')]();agents[_0x1e2b56[_0x0ab4('0x13')]][_0x0ab4('0x9')]=_0x0ab4('0x19');agents[_0x1e2b56[_0x0ab4('0x13')]][_0x0ab4('0x8')]=null;agents[_0x1e2b56[_0x0ab4('0x13')]]['connectedlinename']=null;utils['info'](util['format'](_0x0ab4('0x1a'),_0x1e2b56[_0x0ab4('0x5')],agents[_0x1e2b56[_0x0ab4('0x13')]]['membername'],_0x1e2b56[_0x0ab4('0x13')]));}catch(_0x13ea9f){utils[_0x0ab4('0x1b')](util[_0x0ab4('0x3')]('[%s][agents][agentcalled]',_0x1e2b56['uniqueid']),_0x13ea9f);}};exports[_0x0ab4('0x1c')]=function(_0x5b1ed5){try{if(!_[_0x0ab4('0x1d')](agents[_0x5b1ed5[_0x0ab4('0x13')]])){utils['debug'](util[_0x0ab4('0x3')](_0x0ab4('0x1e'),_0x5b1ed5[_0x0ab4('0x5')]),_0x5b1ed5);utils[_0x0ab4('0x2')](util[_0x0ab4('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x5b1ed5['uniqueid'],agents[_0x5b1ed5[_0x0ab4('0x13')]][_0x0ab4('0x1f')],_0x5b1ed5[_0x0ab4('0x13')]));agents[_0x5b1ed5[_0x0ab4('0x13')]]['agentringnoanswer']=!![];agents[_0x5b1ed5[_0x0ab4('0x13')]][_0x0ab4('0x20')]=utils[_0x0ab4('0x18')]();agents[_0x5b1ed5['destuniqueid']]['lastevent']=_0x0ab4('0x21');agents[_0x5b1ed5[_0x0ab4('0x13')]][_0x0ab4('0x22')]='timeout';agents[_0x5b1ed5['destuniqueid']]['holdtime']=_0x5b1ed5[_0x0ab4('0x23')]?parseInt(_0x5b1ed5['ringtime'])/0x3e8:0x0;agents[_0x5b1ed5[_0x0ab4('0x13')]][_0x0ab4('0x24')]=0x0;unanswered['push'](_0x5b1ed5['destuniqueid']);}}catch(_0x4d0cc1){utils[_0x0ab4('0x1b')](util[_0x0ab4('0x3')](_0x0ab4('0x1e'),_0x5b1ed5[_0x0ab4('0x5')]),_0x4d0cc1);}};exports[_0x0ab4('0x25')]=function(_0x588e0d){try{_['forIn'](agents,function(_0x580d56,_0x2e7a97){if(_0x580d56[_0x0ab4('0x5')]==_0x588e0d[_0x0ab4('0x5')]&&!_[_0x0ab4('0x26')](unanswered,_0x580d56[_0x0ab4('0x13')])){utils['debug'](util['format'](_0x0ab4('0x27'),_0x588e0d[_0x0ab4('0x5')]),_0x588e0d);utils[_0x0ab4('0x2')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x588e0d[_0x0ab4('0x5')],_0x580d56['membername'],_0x580d56[_0x0ab4('0x13')]));_0x580d56[_0x0ab4('0x1c')]=!![];_0x580d56[_0x0ab4('0x20')]=utils[_0x0ab4('0x18')]();_0x580d56[_0x0ab4('0x9')]=_0x0ab4('0x28');_0x580d56['reason']=_0x0ab4('0x28');_0x580d56[_0x0ab4('0x29')]=_0x588e0d[_0x0ab4('0x29')];_0x580d56[_0x0ab4('0x24')]=0x0;writeDB(_0x580d56);}});}catch(_0x4cce0c){utils['error'](util[_0x0ab4('0x3')](_0x0ab4('0x27'),_0x588e0d[_0x0ab4('0x5')]),_0x4cce0c);}};exports['agentconnect']=function(_0x507d77){try{if(agents[_0x507d77['destuniqueid']]){utils[_0x0ab4('0x15')](util[_0x0ab4('0x3')](_0x0ab4('0x2a'),_0x507d77['uniqueid']),_0x507d77);utils['info'](util['format'](_0x0ab4('0x2b'),_0x507d77[_0x0ab4('0x5')],agents[_0x507d77[_0x0ab4('0x13')]][_0x0ab4('0x1f')],_0x507d77[_0x0ab4('0x13')]));agents[_0x507d77[_0x0ab4('0x13')]][_0x0ab4('0x2c')]=utils[_0x0ab4('0x18')]();agents[_0x507d77[_0x0ab4('0x13')]][_0x0ab4('0x8')]=_0x507d77['connectedlinenum'];agents[_0x507d77[_0x0ab4('0x13')]][_0x0ab4('0x2d')]=_0x507d77[_0x0ab4('0x2d')];agents[_0x507d77[_0x0ab4('0x13')]][_0x0ab4('0x29')]=_0x507d77[_0x0ab4('0x23')];agents[_0x507d77[_0x0ab4('0x13')]][_0x0ab4('0x9')]=_0x0ab4('0x2e');_[_0x0ab4('0x2f')](agents,function(_0x449437,_0x1974ce){if(_0x449437['destuniqueid']!=_0x507d77[_0x0ab4('0x13')]&&_0x449437[_0x0ab4('0x5')]==_0x507d77[_0x0ab4('0x5')]){_0x449437[_0x0ab4('0x24')]=0x0;_0x449437['holdtime']=_0x507d77[_0x0ab4('0x23')];_0x449437['agentringnoanswer']=!![];_0x449437[_0x0ab4('0x20')]=utils[_0x0ab4('0x18')]();_0x449437[_0x0ab4('0x9')]=_0x0ab4('0x30');_0x449437[_0x0ab4('0x22')]=_0x0ab4('0x30');_0x449437['answeredelsewheredestinationuniqueid']=_0x507d77[_0x0ab4('0x13')];_0x449437[_0x0ab4('0x31')]=_0x507d77[_0x0ab4('0x1f')];writeDB(_0x449437);}});}}catch(_0x48029f){utils[_0x0ab4('0x1b')](util[_0x0ab4('0x3')](_0x0ab4('0x2a'),_0x507d77[_0x0ab4('0x5')]),_0x48029f);}};exports[_0x0ab4('0xe')]=function(_0x5aa047){try{if(!_['isNil'](agents[_0x5aa047['destuniqueid']])){utils[_0x0ab4('0x15')](util[_0x0ab4('0x3')]('[%s][agents][agentcomplete]',_0x5aa047[_0x0ab4('0x5')]),_0x5aa047);utils['info'](util[_0x0ab4('0x3')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5aa047[_0x0ab4('0x5')],agents[_0x5aa047[_0x0ab4('0x13')]][_0x0ab4('0x1f')],_0x5aa047[_0x0ab4('0x13')]));agents[_0x5aa047[_0x0ab4('0x13')]][_0x0ab4('0xe')]=!![];agents[_0x5aa047['destuniqueid']][_0x0ab4('0x32')]=utils[_0x0ab4('0x18')]();agents[_0x5aa047[_0x0ab4('0x13')]][_0x0ab4('0x24')]=utils[_0x0ab4('0x33')](agents[_0x5aa047[_0x0ab4('0x13')]]['agentcompleteAt'],agents[_0x5aa047[_0x0ab4('0x13')]]['agentconnectAt']);agents[_0x5aa047[_0x0ab4('0x13')]][_0x0ab4('0x22')]=_0x5aa047[_0x0ab4('0x22')];agents[_0x5aa047['destuniqueid']][_0x0ab4('0x9')]=_0x0ab4('0x34');writeDB(agents[_0x5aa047[_0x0ab4('0x13')]]);}}catch(_0x3c1247){utils[_0x0ab4('0x1b')](util[_0x0ab4('0x3')]('[%s][agents][agentcomplete]',_0x5aa047[_0x0ab4('0x5')]),_0x3c1247);}};exports[_0x0ab4('0x35')]=function(_0x302894){try{if(!_[_0x0ab4('0x1d')](agents[_0x302894[_0x0ab4('0x36')]])){utils[_0x0ab4('0x15')](util[_0x0ab4('0x3')](_0x0ab4('0x37'),_0x302894[_0x0ab4('0x5')]),_0x302894);utils[_0x0ab4('0x2')](util[_0x0ab4('0x3')](_0x0ab4('0x38'),_0x302894[_0x0ab4('0x5')],agents[_0x302894['transfereruniqueid']][_0x0ab4('0x1f')],agents[_0x302894[_0x0ab4('0x36')]]['uniqueid']));agents[_0x302894[_0x0ab4('0x36')]]['transfer']=!![];agents[_0x302894['transfereruniqueid']][_0x0ab4('0x39')]=_0x0ab4('0x3a');agents[_0x302894[_0x0ab4('0x36')]]['transferexten']=_0x302894[_0x0ab4('0x3b')];agents[_0x302894[_0x0ab4('0x36')]][_0x0ab4('0x3c')]=agents[_0x302894[_0x0ab4('0x36')]][_0x0ab4('0x5')];}}catch(_0x3f20de){utils[_0x0ab4('0x1b')](util['format'](_0x0ab4('0x37'),_0x302894['uniqueid']),_0x3f20de);}};exports[_0x0ab4('0x3d')]=function(_0x55c073){try{utils[_0x0ab4('0x15')](util['format']('[%s][agents][attendedtransfer]',_0x55c073[_0x0ab4('0x3e')]),_0x55c073);if(_0x55c073[_0x0ab4('0x3e')]==_0x55c073[_0x0ab4('0x3f')]){if(!_[_0x0ab4('0x1d')](agents[_0x55c073['secondtransfereruniqueid']])){utils[_0x0ab4('0x2')](util[_0x0ab4('0x3')](_0x0ab4('0x40'),_0x55c073[_0x0ab4('0x3e')],agents[_0x55c073[_0x0ab4('0x41')]][_0x0ab4('0x1f')]));agents[_0x55c073[_0x0ab4('0x41')]][_0x0ab4('0x42')]=!![];agents[_0x55c073[_0x0ab4('0x41')]][_0x0ab4('0x39')]=_0x0ab4('0x43');agents[_0x55c073[_0x0ab4('0x41')]][_0x0ab4('0x44')]=_0x55c073[_0x0ab4('0x45')];agents[_0x55c073[_0x0ab4('0x41')]][_0x0ab4('0x3c')]=_0x55c073[_0x0ab4('0x3e')];}if(_0x55c073[_0x0ab4('0x46')]&&agents[_0x55c073[_0x0ab4('0x46')]]){agents[_0x55c073['transfereeuniqueid']][_0x0ab4('0x47')]=0x1;transfers[_0x55c073[_0x0ab4('0x46')]]=_[_0x0ab4('0x48')](agents[_0x55c073[_0x0ab4('0x46')]]);transfers[_0x55c073[_0x0ab4('0x46')]][_0x0ab4('0x49')]=agents[_0x55c073[_0x0ab4('0x41')]][_0x0ab4('0x49')];transfers[_0x55c073['transfereeuniqueid']][_0x0ab4('0x4a')]=agents[_0x55c073[_0x0ab4('0x41')]]['calleridname'];transfers[_0x55c073['transfereeuniqueid']][_0x0ab4('0x17')]=utils[_0x0ab4('0x18')]();transfers[_0x55c073['transfereeuniqueid']]['agentconnectAt']=utils[_0x0ab4('0x18')]();transfers[_0x55c073['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x55c073[_0x0ab4('0x46')]][_0x0ab4('0x47')]=0x2;}}else if(_0x55c073[_0x0ab4('0x41')]==_0x55c073[_0x0ab4('0x4b')]){if(!_[_0x0ab4('0x1d')](agents[_0x55c073[_0x0ab4('0x3e')]])){utils[_0x0ab4('0x2')](util['format'](_0x0ab4('0x40'),_0x55c073[_0x0ab4('0x3e')],agents[_0x55c073[_0x0ab4('0x3e')]][_0x0ab4('0x1f')]));agents[_0x55c073[_0x0ab4('0x3e')]][_0x0ab4('0x42')]=!![];agents[_0x55c073['origtransfereruniqueid']][_0x0ab4('0x39')]=_0x0ab4('0x43');agents[_0x55c073['origtransfereruniqueid']][_0x0ab4('0x44')]=_0x55c073['secondtransfererexten'];agents[_0x55c073[_0x0ab4('0x3e')]]['transferuniqueid']=_0x55c073[_0x0ab4('0x41')];}if(_0x55c073[_0x0ab4('0x4c')]&&agents[_0x55c073[_0x0ab4('0x4c')]]){agents[_0x55c073[_0x0ab4('0x4c')]]['agententerreason']=0x1;transfers[_0x55c073['transfertargetuniqueid']]=_[_0x0ab4('0x48')](agents[_0x55c073[_0x0ab4('0x4c')]]);transfers[_0x55c073['transfertargetuniqueid']][_0x0ab4('0x49')]=agents[_0x55c073[_0x0ab4('0x3e')]][_0x0ab4('0x49')];transfers[_0x55c073['transfertargetuniqueid']][_0x0ab4('0x4a')]=agents[_0x55c073[_0x0ab4('0x3e')]][_0x0ab4('0x4a')];transfers[_0x55c073[_0x0ab4('0x4c')]][_0x0ab4('0x17')]=utils[_0x0ab4('0x18')]();transfers[_0x55c073[_0x0ab4('0x4c')]][_0x0ab4('0x2c')]=utils['now']();transfers[_0x55c073['transfertargetuniqueid']][_0x0ab4('0x29')]=0x0;transfers[_0x55c073[_0x0ab4('0x4c')]][_0x0ab4('0x47')]=0x2;}}}catch(_0xc23642){utils['error'](util[_0x0ab4('0x3')]('[%s][agents][attendedtransfer]',_0x55c073[_0x0ab4('0x3e')]),_0xc23642);}};exports[_0x0ab4('0x4d')]=function(_0x18308f){try{utils[_0x0ab4('0x15')](util[_0x0ab4('0x3')](_0x0ab4('0x4e'),_0x18308f[_0x0ab4('0x5')]),_0x18308f);if(agents[_0x18308f[_0x0ab4('0x5')]]&&agents[_0x18308f[_0x0ab4('0x5')]]['reason']===_0x0ab4('0x21')){if(_0x18308f['cause']==='21'){agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x22')]=_0x0ab4('0x4f');agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x9')]=_0x0ab4('0x4f');}utils[_0x0ab4('0x2')](util[_0x0ab4('0x3')](_0x0ab4('0x50'),_0x18308f['uniqueid'],agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x1f')],agents[_0x18308f['uniqueid']][_0x0ab4('0x22')],agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x9')]));writeDB(agents[_0x18308f['uniqueid']]);var _0x3feaaa=unanswered[_0x0ab4('0x51')](_0x18308f[_0x0ab4('0x5')]);if(_0x3feaaa>-0x1){unanswered[_0x0ab4('0x52')](_0x3feaaa,0x1);}}if(transfers[_0x18308f['uniqueid']]){transfers[_0x18308f['uniqueid']][_0x0ab4('0xe')]=!![];transfers[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x32')]=utils[_0x0ab4('0x18')]();transfers[_0x18308f['uniqueid']][_0x0ab4('0x24')]=utils[_0x0ab4('0x33')](transfers[_0x18308f[_0x0ab4('0x5')]]['agentcompleteAt'],transfers[_0x18308f['uniqueid']][_0x0ab4('0x2c')]);transfers[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x22')]=_0x0ab4('0x53');transfers[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x9')]=_0x0ab4('0x34');utils['info'](util[_0x0ab4('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x18308f['uniqueid'],transfers[_0x18308f[_0x0ab4('0x5')]]['membername'],transfers[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x22')],transfers[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x9')]));writeDB(transfers[_0x18308f[_0x0ab4('0x5')]],!![]);}if(agents[_0x18308f['uniqueid']]&&agents[_0x18308f['uniqueid']][_0x0ab4('0x2c')]){agents[_0x18308f[_0x0ab4('0x5')]]['agentcomplete']=!![];agents[_0x18308f['uniqueid']][_0x0ab4('0x32')]=utils[_0x0ab4('0x18')]();agents[_0x18308f['uniqueid']][_0x0ab4('0x24')]=utils[_0x0ab4('0x33')](agents[_0x18308f[_0x0ab4('0x5')]]['agentcompleteAt'],agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x2c')]);agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x22')]=agents[_0x18308f['uniqueid']][_0x0ab4('0x42')]?_0x0ab4('0x42'):_0x0ab4('0x53');agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x9')]=_0x0ab4('0x34');utils[_0x0ab4('0x2')](util[_0x0ab4('0x3')](_0x0ab4('0x50'),_0x18308f[_0x0ab4('0x5')],agents[_0x18308f['uniqueid']][_0x0ab4('0x1f')],agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x22')],agents[_0x18308f[_0x0ab4('0x5')]][_0x0ab4('0x9')]));writeDB(agents[_0x18308f['uniqueid']]);}}catch(_0x448fcb){utils[_0x0ab4('0x1b')](util[_0x0ab4('0x3')](_0x0ab4('0x4e'),_0x18308f[_0x0ab4('0x5')]),_0x448fcb);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 3a5d743..8677384 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 _0x0189=['blinds','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','ANSWERED','hangup','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','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','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','noop','execif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','uniqueid'];(function(_0x5e1f15,_0x1cd535){var _0x57ab04=function(_0x3fa7d6){while(--_0x3fa7d6){_0x5e1f15['push'](_0x5e1f15['shift']());}};_0x57ab04(++_0x1cd535);}(_0x0189,0x1a8));var _0x9018=function(_0x49223f,_0x3ab510){_0x49223f=_0x49223f-0x0;var _0x2bdb8f=_0x0189[_0x49223f];return _0x2bdb8f;};'use strict';var _=require(_0x9018('0x0'));var util=require(_0x9018('0x1'));var utils=require(_0x9018('0x2'));var transfers=require(_0x9018('0x3'));var dispositions=[_0x9018('0x4'),_0x9018('0x5'),_0x9018('0x5'),_0x9018('0x4'),'NO\x20ANSWER',_0x9018('0x4'),'ANSWERED',_0x9018('0x6'),_0x9018('0x5'),_0x9018('0x5'),_0x9018('0x5')];var channels={};function writeDB(_0xaabdaa){var _0x495469;if(transfers['blinds'][_0xaabdaa[_0x9018('0x7')]]){_0x495469=_0xaabdaa[_0x9018('0x7')];_0xaabdaa[_0x9018('0x7')]=transfers[_0x9018('0x8')][_0xaabdaa['uniqueid']][_0x9018('0x9')];}utils[_0x9018('0xa')](util[_0x9018('0xb')](_0x9018('0xc'),_0xaabdaa[_0x9018('0x7')],_0xaabdaa[_0x9018('0xd')],_0xaabdaa[_0x9018('0xe')],_0xaabdaa[_0x9018('0xf')],_0xaabdaa['interface'],_0xaabdaa[_0x9018('0x10')],_0xaabdaa['connectedlinenum'],_0xaabdaa[_0x9018('0x11')]));if(_0xaabdaa[_0x9018('0x12')]){utils[_0x9018('0x13')](_0xaabdaa[_0x9018('0x12')])[_0x9018('0x14')](function(_0x58f4b1){if(_0x58f4b1){_0xaabdaa['UserId']=_0x58f4b1['id'];}utils[_0x9018('0x15')](_0x9018('0x16'),_0xaabdaa);});}else{utils[_0x9018('0x15')](_0x9018('0x16'),_0xaabdaa);}if(channels[_0xaabdaa[_0x9018('0x7')]]){delete channels[_0xaabdaa['uniqueid']];}else if(_0x495469&&channels[_0x495469]){if(!transfers['blinds'][_0x495469][_0x9018('0x17')])delete transfers['blinds'][_0x495469];delete channels[_0x495469];}}exports['newchannel']=function(_0x9a6499){try{utils['debug'](util[_0x9018('0xb')](_0x9018('0x18'),_0x9a6499[_0x9018('0x7')]),_0x9a6499);if(_0x9a6499['uniqueid']==_0x9a6499[_0x9018('0x19')]&&_0x9a6499[_0x9018('0xd')]!=_0x9018('0x1a')){utils['info'](util[_0x9018('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x9a6499[_0x9018('0x7')],_0x9a6499[_0x9018('0x1b')],_0x9a6499[_0x9018('0x1c')]));channels[_0x9a6499[_0x9018('0x7')]]={'uniqueid':_0x9a6499[_0x9018('0x7')],'accountcode':_0x9a6499[_0x9018('0x12')],'source':_0x9a6499[_0x9018('0x10')],'destination':_0x9a6499[_0x9018('0x1c')],'destinationcontext':_0x9a6499[_0x9018('0x1b')],'channel':_0x9a6499[_0x9018('0xd')],'starttime':utils[_0x9018('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9018('0x4'),'amaflags':_0x9018('0x1e')};}}catch(_0x4e6e8c){utils[_0x9018('0x1f')](util[_0x9018('0xb')](_0x9018('0x18'),_0x9a6499[_0x9018('0x7')]),_0x4e6e8c);}};exports['newstate']=function(_0x1d9ef7){try{utils[_0x9018('0x20')](util[_0x9018('0xb')](_0x9018('0x21'),_0x1d9ef7[_0x9018('0x7')]),_0x1d9ef7);if(!_[_0x9018('0x22')](channels[_0x1d9ef7['uniqueid']])&&_0x1d9ef7[_0x9018('0x23')]==0x6){utils['info'](util[_0x9018('0xb')](_0x9018('0x24'),_0x1d9ef7['uniqueid'],_0x1d9ef7['context'],_0x1d9ef7[_0x9018('0xd')]));if(_[_0x9018('0x22')](channels[_0x1d9ef7[_0x9018('0x7')]][_0x9018('0x25')])){channels[_0x1d9ef7[_0x9018('0x7')]]['systemanswertime']=utils[_0x9018('0x1d')]();}}else if(!_[_0x9018('0x22')](channels[_0x1d9ef7[_0x9018('0x19')]])&&_0x1d9ef7[_0x9018('0x23')]==0x6&&_0x1d9ef7['context']!=_0x9018('0x26')){utils[_0x9018('0xa')](util[_0x9018('0xb')](_0x9018('0x27'),_0x1d9ef7['uniqueid'],_0x1d9ef7[_0x9018('0x19')],_0x1d9ef7[_0x9018('0x1b')],_0x1d9ef7[_0x9018('0xd')]));channels[_0x1d9ef7[_0x9018('0x19')]]['accountcode']=_0x1d9ef7[_0x9018('0x12')];channels[_0x1d9ef7[_0x9018('0x19')]]['destinationchannel']=_0x1d9ef7['channel'];if(_[_0x9018('0x22')](channels[_0x1d9ef7[_0x9018('0x19')]][_0x9018('0x28')])){channels[_0x1d9ef7[_0x9018('0x19')]][_0x9018('0x28')]=utils[_0x9018('0x1d')]();}channels[_0x1d9ef7[_0x9018('0x19')]][_0x9018('0x29')]=dispositions[_[_0x9018('0x2a')](_0x1d9ef7['channelstate'])]||_0x9018('0x2b');}}catch(_0x3eff69){utils[_0x9018('0x1f')](util['format']('[%s][calls][newstate]',_0x1d9ef7[_0x9018('0x7')]),_0x3eff69);}};exports[_0x9018('0x2c')]=function(_0x29ea8a){try{if(!_['isNil'](channels[_0x29ea8a[_0x9018('0x7')]])){utils['debug'](util['format']('[%s][calls][hangup]',_0x29ea8a[_0x9018('0x7')]),_0x29ea8a);if(_[_0x9018('0x22')](channels[_0x29ea8a[_0x9018('0x7')]][_0x9018('0x2d')])){channels[_0x29ea8a[_0x9018('0x7')]]['callerid']=_0x29ea8a['calleridname']+'\x20<'+_0x29ea8a[_0x9018('0x10')]+'>';}utils['info'](util[_0x9018('0xb')](_0x9018('0x2e'),_0x29ea8a[_0x9018('0x7')],channels[_0x29ea8a[_0x9018('0x7')]][_0x9018('0x2d')],_0x29ea8a[_0x9018('0x2f')]));channels[_0x29ea8a['uniqueid']][_0x9018('0x30')]=utils[_0x9018('0x1d')]();channels[_0x29ea8a[_0x9018('0x7')]][_0x9018('0x31')]=utils['diffTime'](channels[_0x29ea8a['uniqueid']]['endtime'],channels[_0x29ea8a[_0x9018('0x7')]][_0x9018('0x32')]);channels[_0x29ea8a[_0x9018('0x7')]][_0x9018('0x33')]=channels[_0x29ea8a[_0x9018('0x7')]][_0x9018('0x28')]?utils[_0x9018('0x34')](channels[_0x29ea8a['uniqueid']][_0x9018('0x30')],channels[_0x29ea8a['uniqueid']]['answertime']):0x0;writeDB(channels[_0x29ea8a[_0x9018('0x7')]]);}}catch(_0x28f638){utils[_0x9018('0x1f')](util[_0x9018('0xb')](_0x9018('0x35'),_0x29ea8a[_0x9018('0x7')]),_0x28f638);}};exports[_0x9018('0x36')]=function(_0x38d0a2){try{if(!_[_0x9018('0x22')](channels[_0x38d0a2[_0x9018('0x37')]])){utils['debug'](util[_0x9018('0xb')]('[%s][calls][attendedtransfer]',_0x38d0a2[_0x9018('0x38')]),_0x38d0a2);if(channels[_0x38d0a2['localtwolinkedid']][_0x9018('0xd')]==_0x38d0a2[_0x9018('0x39')]){utils[_0x9018('0xa')](util['format'](_0x9018('0x3a'),_0x38d0a2['origtransfereruniqueid'],_0x38d0a2['localtwolinkedid'],_0x38d0a2[_0x9018('0x3b')]));channels[_0x38d0a2[_0x9018('0x37')]]['destinationchannel']=_0x38d0a2[_0x9018('0x3b')];channels[_0x38d0a2['localtwolinkedid']]['userfield']=_0x9018('0x3c');}else if(channels[_0x38d0a2[_0x9018('0x37')]][_0x9018('0xd')]=_0x38d0a2[_0x9018('0x3d')]){utils[_0x9018('0xa')](util[_0x9018('0xb')](_0x9018('0x3a'),_0x38d0a2[_0x9018('0x38')],_0x38d0a2['localtwolinkedid'],_0x38d0a2[_0x9018('0x3e')]));channels[_0x38d0a2[_0x9018('0x37')]]['destinationchannel']=_0x38d0a2[_0x9018('0x3e')];channels[_0x38d0a2['localtwolinkedid']][_0x9018('0x3f')]=_0x9018('0x3c');}}}catch(_0x1ca753){utils['error'](util['format'](_0x9018('0x40'),_0x38d0a2[_0x9018('0x38')]),_0x1ca753);}};exports['musiconholdstart']=function(_0x44d1dd){try{if(!_[_0x9018('0x22')](channels[_0x44d1dd[_0x9018('0x7')]])){utils[_0x9018('0x20')](util[_0x9018('0xb')]('[%s][calls][musiconholdstart]',_0x44d1dd[_0x9018('0x7')]),_0x44d1dd);channels[_0x44d1dd[_0x9018('0x7')]][_0x9018('0x41')]=utils[_0x9018('0x1d')]();utils[_0x9018('0xa')](util[_0x9018('0xb')](_0x9018('0x42'),_0x44d1dd[_0x9018('0x7')],channels[_0x44d1dd['uniqueid']]['musiconholdstartAt']));}}catch(_0x1a1d0){utils[_0x9018('0x1f')](util[_0x9018('0xb')](_0x9018('0x43'),_0x44d1dd[_0x9018('0x7')]),_0x1a1d0);}};exports[_0x9018('0x44')]=function(_0x2902c4){try{if(!_[_0x9018('0x22')](channels[_0x2902c4[_0x9018('0x7')]])){utils[_0x9018('0x20')](util[_0x9018('0xb')](_0x9018('0x45'),_0x2902c4[_0x9018('0x7')]),_0x2902c4);if(!_[_0x9018('0x22')](channels[_0x2902c4[_0x9018('0x7')]]['musiconholdstartAt'])){channels[_0x2902c4[_0x9018('0x7')]]['mohtime']+=utils[_0x9018('0x34')](utils[_0x9018('0x1d')](),channels[_0x2902c4[_0x9018('0x7')]][_0x9018('0x41')]);utils['info'](util[_0x9018('0xb')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x2902c4['uniqueid'],channels[_0x2902c4[_0x9018('0x7')]][_0x9018('0x46')]));delete channels[_0x2902c4[_0x9018('0x7')]][_0x9018('0x41')];}}}catch(_0x159bf4){utils[_0x9018('0x1f')](util[_0x9018('0xb')](_0x9018('0x45'),_0x2902c4[_0x9018('0x7')]),_0x159bf4);}};exports[_0x9018('0x47')]=function(_0x43c242){try{if(!_[_0x9018('0x22')](channels[_0x43c242[_0x9018('0x7')]])){utils[_0x9018('0x20')](util[_0x9018('0xb')]('[%s][calls][varset]',_0x43c242[_0x9018('0x7')]),_0x43c242);if(!_['isNil'](_0x43c242[_0x9018('0x48')]['xmd-originatecalleridnum'])){utils[_0x9018('0xa')](util['format'](_0x9018('0x49'),_0x43c242['uniqueid'],_0x43c242[_0x9018('0x4a')]));channels[_0x43c242[_0x9018('0x7')]]['source']=_0x43c242[_0x9018('0x4a')];}if(!_[_0x9018('0x22')](_0x43c242[_0x9018('0x48')][_0x9018('0x4b')])){utils['info'](util[_0x9018('0xb')](_0x9018('0x4c'),_0x43c242[_0x9018('0x7')],_0x43c242['value']));channels[_0x43c242[_0x9018('0x7')]][_0x9018('0x4d')]=_0x43c242[_0x9018('0x4a')];channels[_0x43c242[_0x9018('0x7')]][_0x9018('0x2d')]='\x22'+_0x43c242[_0x9018('0x4a')]+_0x9018('0x4e')+_0x43c242[_0x9018('0x4a')]+'>';}if(!_[_0x9018('0x22')](_0x43c242[_0x9018('0x48')][_0x9018('0x4f')])||!_['isNil'](_0x43c242[_0x9018('0x48')][_0x9018('0x50')])){utils[_0x9018('0xa')](util[_0x9018('0xb')](_0x9018('0x51'),_0x43c242[_0x9018('0x7')],!_[_0x9018('0x22')](_0x43c242[_0x9018('0x48')][_0x9018('0x4f')])?_0x9018('0x4f'):_0x9018('0x50'),_0x43c242[_0x9018('0x4a')]));channels[_0x43c242[_0x9018('0x7')]][_0x9018('0x2d')]=_0x43c242[_0x9018('0x4a')];}if(!_[_0x9018('0x22')](_0x43c242[_0x9018('0x48')][_0x9018('0x52')])||!_[_0x9018('0x22')](_0x43c242['variable'][_0x9018('0x53')])){utils[_0x9018('0xa')](util[_0x9018('0xb')](_0x9018('0x51'),_0x43c242[_0x9018('0x7')],!_['isNil'](_0x43c242['variable'][_0x9018('0x52')])?_0x9018('0x52'):_0x9018('0x53'),_0x43c242[_0x9018('0x4a')]));channels[_0x43c242[_0x9018('0x7')]][_0x9018('0x54')]='Queue';channels[_0x43c242[_0x9018('0x7')]][_0x9018('0x55')]=_0x43c242[_0x9018('0x4a')];channels[_0x43c242[_0x9018('0x7')]]['queue']=!![];}if(!_[_0x9018('0x22')](_0x43c242['variable']['xmd-contactid'])){utils[_0x9018('0xa')](util[_0x9018('0xb')](_0x9018('0x56'),_0x43c242[_0x9018('0x7')],_0x43c242['value']));channels[_0x43c242['uniqueid']][_0x9018('0x57')]=_0x43c242[_0x9018('0x4a')];}if(!_['isNil'](_0x43c242['variable'][_0x9018('0x58')])){utils['info'](util[_0x9018('0xb')](_0x9018('0x59'),_0x43c242[_0x9018('0x7')],_0x43c242['value']));channels[_0x43c242['uniqueid']]['type']=_0x43c242[_0x9018('0x4a')];}if(!_[_0x9018('0x22')](_0x43c242[_0x9018('0x48')][_0x9018('0x5a')])){utils['info'](util[_0x9018('0xb')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x43c242[_0x9018('0x7')],_0x43c242['value']));channels[_0x43c242[_0x9018('0x7')]][_0x9018('0x5b')]=_0x43c242['value'];}if(!_[_0x9018('0x22')](_0x43c242[_0x9018('0x48')]['sipcallid'])){utils[_0x9018('0xa')](util[_0x9018('0xb')](_0x9018('0x5c'),_0x43c242[_0x9018('0x7')],_0x43c242[_0x9018('0x4a')]));channels[_0x43c242[_0x9018('0x7')]][_0x9018('0x5d')]=_0x43c242['value'];}}}catch(_0xb0cd45){utils[_0x9018('0x1f')](util['format'](_0x9018('0x5e'),_0x43c242['uniqueid']),_0xb0cd45);}};exports['newexten']=function(_0x2ec09e){try{if(!_[_0x9018('0x22')](channels[_0x2ec09e[_0x9018('0x7')]])){utils[_0x9018('0x20')](util[_0x9018('0xb')](_0x9018('0x5f'),_0x2ec09e[_0x9018('0x7')]),_0x2ec09e);utils[_0x9018('0xa')](util[_0x9018('0xb')](_0x9018('0x60'),_0x2ec09e['uniqueid'],_0x2ec09e[_0x9018('0x61')],_0x2ec09e[_0x9018('0x62')]));if(_0x2ec09e[_0x9018('0x61')][_0x9018('0x63')]()==_0x9018('0x64')&&_[_0x9018('0x65')](_0x2ec09e[_0x9018('0x62')][_0x9018('0x63')](),_0x9018('0x66'))){var _0x41fa6a=_0x2ec09e['appdata'][_0x9018('0x67')]('=');var _0x48971d=_0x41fa6a[0x0][_0x9018('0x68')](_0x41fa6a[0x0][_0x9018('0x69')]('(')+0x1,_0x41fa6a[0x0][_0x9018('0x69')](')'));var _0xf507ec=_0x41fa6a[0x1];channels[_0x2ec09e[_0x9018('0x7')]][_0x48971d]=_0xf507ec;}if(!_['includes']([_0x9018('0x2c'),_0x9018('0x6a'),_0x9018('0x6b'),_0x9018('0x64'),'gotoif'],_0x2ec09e[_0x9018('0x61')][_0x9018('0x63')]())){channels[_0x2ec09e[_0x9018('0x7')]][_0x9018('0x54')]=_0x2ec09e[_0x9018('0x61')];channels[_0x2ec09e[_0x9018('0x7')]]['lastdata']=_0x2ec09e['appdata'];}}}catch(_0xc1517){utils['error'](util[_0x9018('0xb')](_0x9018('0x5f'),_0x2ec09e[_0x9018('0x7')]),_0xc1517);}}; \ No newline at end of file +var _0x576b=['endtime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','variable','xmd-phone','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lastapplication','[%s][calls][newexten]','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','channel','queue','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','recording','newchannel','debug','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','info','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','starttime','billableseconds','diffTime'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x576b,0x1d9));var _0xb576=function(_0x407089,_0x9d489f){_0x407089=_0x407089-0x0;var _0x3e3996=_0x576b[_0x407089];return _0x3e3996;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var transfers=require(_0xb576('0x0'));var dispositions=[_0xb576('0x1'),'FAILED',_0xb576('0x2'),_0xb576('0x1'),'NO\x20ANSWER',_0xb576('0x1'),_0xb576('0x3'),_0xb576('0x4'),_0xb576('0x2'),_0xb576('0x2'),_0xb576('0x2')];var channels={};function writeDB(_0x42affb){var _0x42f2c0;if(transfers[_0xb576('0x5')][_0x42affb[_0xb576('0x6')]]){_0x42f2c0=_0x42affb[_0xb576('0x6')];_0x42affb[_0xb576('0x6')]=transfers[_0xb576('0x5')][_0x42affb[_0xb576('0x6')]][_0xb576('0x7')];}utils['info'](util[_0xb576('0x8')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x42affb[_0xb576('0x6')],_0x42affb[_0xb576('0x9')],_0x42affb[_0xb576('0xa')],_0x42affb['membername'],_0x42affb['interface'],_0x42affb[_0xb576('0xb')],_0x42affb[_0xb576('0xc')],_0x42affb[_0xb576('0xd')]));if(_0x42affb[_0xb576('0xe')]){utils[_0xb576('0xf')](_0x42affb[_0xb576('0xe')])[_0xb576('0x10')](function(_0x1f3a23){if(_0x1f3a23){_0x42affb[_0xb576('0x11')]=_0x1f3a23['id'];}utils[_0xb576('0x12')]('CreateVoiceCallReport',_0x42affb);});}else{utils['request']('CreateVoiceCallReport',_0x42affb);}if(channels[_0x42affb[_0xb576('0x6')]]){delete channels[_0x42affb[_0xb576('0x6')]];}else if(_0x42f2c0&&channels[_0x42f2c0]){if(!transfers[_0xb576('0x5')][_0x42f2c0][_0xb576('0x13')])delete transfers[_0xb576('0x5')][_0x42f2c0];delete channels[_0x42f2c0];}}exports[_0xb576('0x14')]=function(_0x564bff){try{utils[_0xb576('0x15')](util[_0xb576('0x8')]('[%s][calls][newchannel]',_0x564bff['uniqueid']),_0x564bff);if(_0x564bff[_0xb576('0x6')]==_0x564bff[_0xb576('0x16')]&&_0x564bff[_0xb576('0x9')]!='OutgoingSpoolFailed'){utils['info'](util['format'](_0xb576('0x17'),_0x564bff['uniqueid'],_0x564bff['context'],_0x564bff[_0xb576('0x18')]));channels[_0x564bff[_0xb576('0x6')]]={'uniqueid':_0x564bff[_0xb576('0x6')],'accountcode':_0x564bff[_0xb576('0xe')],'source':_0x564bff['calleridnum'],'destination':_0x564bff[_0xb576('0x18')],'destinationcontext':_0x564bff[_0xb576('0x19')],'channel':_0x564bff[_0xb576('0x9')],'starttime':utils[_0xb576('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xb576('0x1'),'amaflags':_0xb576('0x1b')};}}catch(_0x2b6074){utils[_0xb576('0x1c')](util[_0xb576('0x8')](_0xb576('0x1d'),_0x564bff[_0xb576('0x6')]),_0x2b6074);}};exports[_0xb576('0x1e')]=function(_0x364f81){try{utils[_0xb576('0x15')](util['format'](_0xb576('0x1f'),_0x364f81[_0xb576('0x6')]),_0x364f81);if(!_[_0xb576('0x20')](channels[_0x364f81[_0xb576('0x6')]])&&_0x364f81[_0xb576('0x21')]==0x6){utils[_0xb576('0x22')](util[_0xb576('0x8')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x364f81[_0xb576('0x6')],_0x364f81[_0xb576('0x19')],_0x364f81[_0xb576('0x9')]));if(_[_0xb576('0x20')](channels[_0x364f81[_0xb576('0x6')]]['systemanswertime'])){channels[_0x364f81[_0xb576('0x6')]]['systemanswertime']=utils[_0xb576('0x1a')]();}}else if(!_[_0xb576('0x20')](channels[_0x364f81[_0xb576('0x16')]])&&_0x364f81[_0xb576('0x21')]==0x6&&_0x364f81[_0xb576('0x19')]!='transfer'){utils[_0xb576('0x22')](util[_0xb576('0x8')](_0xb576('0x23'),_0x364f81[_0xb576('0x6')],_0x364f81['linkedid'],_0x364f81[_0xb576('0x19')],_0x364f81[_0xb576('0x9')]));channels[_0x364f81[_0xb576('0x16')]]['accountcode']=_0x364f81['accountcode'];channels[_0x364f81['linkedid']][_0xb576('0x24')]=_0x364f81[_0xb576('0x9')];if(_[_0xb576('0x20')](channels[_0x364f81[_0xb576('0x16')]][_0xb576('0x25')])){channels[_0x364f81[_0xb576('0x16')]][_0xb576('0x25')]=utils[_0xb576('0x1a')]();}channels[_0x364f81[_0xb576('0x16')]]['disposition']=dispositions[_[_0xb576('0x26')](_0x364f81['channelstate'])]||'ANSWERED';}}catch(_0x18ed43){utils[_0xb576('0x1c')](util[_0xb576('0x8')]('[%s][calls][newstate]',_0x364f81[_0xb576('0x6')]),_0x18ed43);}};exports[_0xb576('0x27')]=function(_0x53722d){try{if(!_[_0xb576('0x20')](channels[_0x53722d[_0xb576('0x6')]])){utils[_0xb576('0x15')](util[_0xb576('0x8')](_0xb576('0x28'),_0x53722d[_0xb576('0x6')]),_0x53722d);if(_[_0xb576('0x20')](channels[_0x53722d[_0xb576('0x6')]][_0xb576('0x29')])){channels[_0x53722d[_0xb576('0x6')]][_0xb576('0x29')]=_0x53722d['calleridname']+'\x20<'+_0x53722d['calleridnum']+'>';}utils[_0xb576('0x22')](util['format'](_0xb576('0x2a'),_0x53722d[_0xb576('0x6')],channels[_0x53722d[_0xb576('0x6')]][_0xb576('0x29')],_0x53722d['cause-txt']));channels[_0x53722d[_0xb576('0x6')]]['endtime']=utils[_0xb576('0x1a')]();channels[_0x53722d[_0xb576('0x6')]][_0xb576('0x2b')]=utils['diffTime'](channels[_0x53722d[_0xb576('0x6')]]['endtime'],channels[_0x53722d['uniqueid']][_0xb576('0x2c')]);channels[_0x53722d[_0xb576('0x6')]][_0xb576('0x2d')]=channels[_0x53722d[_0xb576('0x6')]][_0xb576('0x25')]?utils[_0xb576('0x2e')](channels[_0x53722d['uniqueid']][_0xb576('0x2f')],channels[_0x53722d[_0xb576('0x6')]][_0xb576('0x25')]):0x0;writeDB(channels[_0x53722d[_0xb576('0x6')]]);}}catch(_0x26f25f){utils[_0xb576('0x1c')](util[_0xb576('0x8')](_0xb576('0x28'),_0x53722d[_0xb576('0x6')]),_0x26f25f);}};exports['attendedtransfer']=function(_0x2294a1){try{if(!_[_0xb576('0x20')](channels[_0x2294a1[_0xb576('0x30')]])){utils[_0xb576('0x15')](util[_0xb576('0x8')](_0xb576('0x31'),_0x2294a1[_0xb576('0x32')]),_0x2294a1);if(channels[_0x2294a1[_0xb576('0x30')]][_0xb576('0x9')]==_0x2294a1[_0xb576('0x33')]){utils[_0xb576('0x22')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2294a1[_0xb576('0x32')],_0x2294a1[_0xb576('0x30')],_0x2294a1[_0xb576('0x34')]));channels[_0x2294a1[_0xb576('0x30')]][_0xb576('0x24')]=_0x2294a1[_0xb576('0x34')];channels[_0x2294a1[_0xb576('0x30')]][_0xb576('0x35')]=_0xb576('0x36');}else if(channels[_0x2294a1['localtwolinkedid']]['channel']=_0x2294a1[_0xb576('0x37')]){utils['info'](util['format'](_0xb576('0x38'),_0x2294a1[_0xb576('0x32')],_0x2294a1[_0xb576('0x30')],_0x2294a1['origtransfererchannel']));channels[_0x2294a1[_0xb576('0x30')]][_0xb576('0x24')]=_0x2294a1[_0xb576('0x39')];channels[_0x2294a1['localtwolinkedid']]['userfield']=_0xb576('0x36');}}}catch(_0x516f07){utils[_0xb576('0x1c')](util[_0xb576('0x8')]('[%s][calls][attendedtransfer]',_0x2294a1['origtransfereruniqueid']),_0x516f07);}};exports[_0xb576('0x3a')]=function(_0x1634e5){try{if(!_[_0xb576('0x20')](channels[_0x1634e5['uniqueid']])){utils[_0xb576('0x15')](util[_0xb576('0x8')](_0xb576('0x3b'),_0x1634e5[_0xb576('0x6')]),_0x1634e5);channels[_0x1634e5[_0xb576('0x6')]][_0xb576('0x3c')]=utils[_0xb576('0x1a')]();utils[_0xb576('0x22')](util[_0xb576('0x8')](_0xb576('0x3d'),_0x1634e5[_0xb576('0x6')],channels[_0x1634e5[_0xb576('0x6')]][_0xb576('0x3c')]));}}catch(_0x399152){utils[_0xb576('0x1c')](util[_0xb576('0x8')](_0xb576('0x3b'),_0x1634e5[_0xb576('0x6')]),_0x399152);}};exports['musiconholdstop']=function(_0x43cbca){try{if(!_[_0xb576('0x20')](channels[_0x43cbca[_0xb576('0x6')]])){utils[_0xb576('0x15')](util[_0xb576('0x8')](_0xb576('0x3e'),_0x43cbca[_0xb576('0x6')]),_0x43cbca);if(!_['isNil'](channels[_0x43cbca['uniqueid']]['musiconholdstartAt'])){channels[_0x43cbca['uniqueid']][_0xb576('0x3f')]+=utils['diffTime'](utils[_0xb576('0x1a')](),channels[_0x43cbca['uniqueid']][_0xb576('0x3c')]);utils['info'](util[_0xb576('0x8')](_0xb576('0x40'),_0x43cbca[_0xb576('0x6')],channels[_0x43cbca[_0xb576('0x6')]]['mohtime']));delete channels[_0x43cbca['uniqueid']][_0xb576('0x3c')];}}}catch(_0x5aaf2d){utils[_0xb576('0x1c')](util[_0xb576('0x8')](_0xb576('0x3e'),_0x43cbca['uniqueid']),_0x5aaf2d);}};exports['varset']=function(_0x20f84f){try{if(!_[_0xb576('0x20')](channels[_0x20f84f[_0xb576('0x6')]])){utils[_0xb576('0x15')](util[_0xb576('0x8')](_0xb576('0x41'),_0x20f84f[_0xb576('0x6')]),_0x20f84f);if(!_['isNil'](_0x20f84f['variable'][_0xb576('0x42')])){utils['info'](util[_0xb576('0x8')](_0xb576('0x43'),_0x20f84f[_0xb576('0x6')],_0x20f84f['value']));channels[_0x20f84f[_0xb576('0x6')]][_0xb576('0x44')]=_0x20f84f[_0xb576('0x45')];}if(!_[_0xb576('0x20')](_0x20f84f[_0xb576('0x46')][_0xb576('0x47')])){utils[_0xb576('0x22')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x20f84f[_0xb576('0x6')],_0x20f84f[_0xb576('0x45')]));channels[_0x20f84f[_0xb576('0x6')]][_0xb576('0x48')]=_0x20f84f[_0xb576('0x45')];channels[_0x20f84f[_0xb576('0x6')]]['callerid']='\x22'+_0x20f84f[_0xb576('0x45')]+'\x22\x20<'+_0x20f84f[_0xb576('0x45')]+'>';}if(!_[_0xb576('0x20')](_0x20f84f[_0xb576('0x46')][_0xb576('0x49')])||!_[_0xb576('0x20')](_0x20f84f['variable'][_0xb576('0x4a')])){utils['info'](util[_0xb576('0x8')](_0xb576('0x4b'),_0x20f84f[_0xb576('0x6')],!_['isNil'](_0x20f84f[_0xb576('0x46')]['xmd-callerid-preview'])?_0xb576('0x49'):_0xb576('0x4a'),_0x20f84f['value']));channels[_0x20f84f['uniqueid']][_0xb576('0x29')]=_0x20f84f[_0xb576('0x45')];}if(!_[_0xb576('0x20')](_0x20f84f['variable'][_0xb576('0x4c')])||!_[_0xb576('0x20')](_0x20f84f['variable'][_0xb576('0x4d')])){utils[_0xb576('0x22')](util[_0xb576('0x8')](_0xb576('0x4b'),_0x20f84f['uniqueid'],!_[_0xb576('0x20')](_0x20f84f[_0xb576('0x46')]['xmd-queue'])?_0xb576('0x4c'):_0xb576('0x4d'),_0x20f84f['value']));channels[_0x20f84f['uniqueid']]['lastapplication']=_0xb576('0x4e');channels[_0x20f84f['uniqueid']][_0xb576('0x4f')]=_0x20f84f[_0xb576('0x45')];channels[_0x20f84f[_0xb576('0x6')]][_0xb576('0xa')]=!![];}if(!_[_0xb576('0x20')](_0x20f84f[_0xb576('0x46')]['xmd-contactid'])){utils[_0xb576('0x22')](util['format'](_0xb576('0x50'),_0x20f84f[_0xb576('0x6')],_0x20f84f[_0xb576('0x45')]));channels[_0x20f84f[_0xb576('0x6')]][_0xb576('0x51')]=_0x20f84f[_0xb576('0x45')];}if(!_[_0xb576('0x20')](_0x20f84f[_0xb576('0x46')]['xmd-cdrtype'])){utils[_0xb576('0x22')](util[_0xb576('0x8')](_0xb576('0x52'),_0x20f84f[_0xb576('0x6')],_0x20f84f[_0xb576('0x45')]));channels[_0x20f84f[_0xb576('0x6')]][_0xb576('0x53')]=_0x20f84f[_0xb576('0x45')];}if(!_['isNil'](_0x20f84f[_0xb576('0x46')]['outboundrouteid'])){utils[_0xb576('0x22')](util[_0xb576('0x8')](_0xb576('0x54'),_0x20f84f[_0xb576('0x6')],_0x20f84f[_0xb576('0x45')]));channels[_0x20f84f['uniqueid']][_0xb576('0x55')]=_0x20f84f[_0xb576('0x45')];}if(!_[_0xb576('0x20')](_0x20f84f[_0xb576('0x46')]['sipcallid'])){utils[_0xb576('0x22')](util[_0xb576('0x8')](_0xb576('0x56'),_0x20f84f[_0xb576('0x6')],_0x20f84f[_0xb576('0x45')]));channels[_0x20f84f[_0xb576('0x6')]]['sipcallid']=_0x20f84f[_0xb576('0x45')];}}}catch(_0x255cf0){utils[_0xb576('0x1c')](util[_0xb576('0x8')](_0xb576('0x41'),_0x20f84f[_0xb576('0x6')]),_0x255cf0);}};exports[_0xb576('0x57')]=function(_0x47253b){try{if(!_[_0xb576('0x20')](channels[_0x47253b['uniqueid']])){utils[_0xb576('0x15')](util[_0xb576('0x8')]('[%s][calls][newexten]',_0x47253b[_0xb576('0x6')]),_0x47253b);utils[_0xb576('0x22')](util[_0xb576('0x8')](_0xb576('0x58'),_0x47253b['uniqueid'],_0x47253b[_0xb576('0x59')],_0x47253b[_0xb576('0x5a')]));if(_0x47253b[_0xb576('0x59')][_0xb576('0x5b')]()==_0xb576('0x5c')&&_[_0xb576('0x5d')](_0x47253b[_0xb576('0x5a')]['toLowerCase'](),_0xb576('0x5e'))){var _0x5d65a8=_0x47253b[_0xb576('0x5a')][_0xb576('0x5f')]('=');var _0x394f69=_0x5d65a8[0x0][_0xb576('0x60')](_0x5d65a8[0x0][_0xb576('0x61')]('(')+0x1,_0x5d65a8[0x0][_0xb576('0x61')](')'));var _0x3b350b=_0x5d65a8[0x1];channels[_0x47253b[_0xb576('0x6')]][_0x394f69]=_0x3b350b;}if(!_[_0xb576('0x62')]([_0xb576('0x27'),_0xb576('0x63'),_0xb576('0x64'),_0xb576('0x5c'),_0xb576('0x65')],_0x47253b[_0xb576('0x59')]['toLowerCase']())){channels[_0x47253b[_0xb576('0x6')]][_0xb576('0x66')]=_0x47253b['application'];channels[_0x47253b[_0xb576('0x6')]][_0xb576('0x4f')]=_0x47253b[_0xb576('0x5a')];}}}catch(_0x55d76e){utils[_0xb576('0x1c')](util[_0xb576('0x8')](_0xb576('0x67'),_0x47253b[_0xb576('0x6')]),_0x55d76e);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index aaa54f6..7bf6af6 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 _0x47a4=['close','[core]\x20close','managerevent','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x15f27e,_0x547fea){var _0x18da4f=function(_0x1b88aa){while(--_0x1b88aa){_0x15f27e['push'](_0x15f27e['shift']());}};_0x18da4f(++_0x547fea);}(_0x47a4,0x19a));var _0x447a=function(_0x27a16c,_0x1dbd5a){_0x27a16c=_0x27a16c-0x0;var _0x3a53d7=_0x47a4[_0x27a16c];return _0x3a53d7;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x447a('0x0')](_0x447a('0x1'));};exports[_0x447a('0x2')]=function(){utils[_0x447a('0x0')](_0x447a('0x3'));};exports[_0x447a('0x4')]=function(){utils[_0x447a('0x0')](_0x447a('0x5'));};exports[_0x447a('0x6')]=function(_0x18609a){utils[_0x447a('0x6')](_0x447a('0x7'),_0x18609a);};exports[_0x447a('0x8')]=function(){utils[_0x447a('0x0')](_0x447a('0x9'));};exports[_0x447a('0xa')]=function(_0xd74d0e){}; \ No newline at end of file +var _0xc904=['info','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','shutdown'];(function(_0x605961,_0x12df74){var _0x3cd6cf=function(_0x419b36){while(--_0x419b36){_0x605961['push'](_0x605961['shift']());}};_0x3cd6cf(++_0x12df74);}(_0xc904,0x1aa));var _0x4c90=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xc904[_0x1a36a5];return _0x746243;};'use strict';var utils=require(_0x4c90('0x0'));exports[_0x4c90('0x1')]=function(){utils['info']('[core]\x20connected');};exports[_0x4c90('0x2')]=function(){utils[_0x4c90('0x3')]('[core]\x20shutdown');};exports[_0x4c90('0x4')]=function(){utils[_0x4c90('0x3')](_0x4c90('0x5'));};exports['error']=function(_0x1af645){utils[_0x4c90('0x6')](_0x4c90('0x7'),_0x1af645);};exports[_0x4c90('0x8')]=function(){utils[_0x4c90('0x3')](_0x4c90('0x9'));};exports[_0x4c90('0xa')]=function(_0x3d95d6){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 23553e6..8f7121b 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 _0x97aa=['debug','[%s][dials][newexten]','uniqueid','application','appdata','toLowerCase','set','cdr(routeid)','split','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','[%s][dials][dialbegin]','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','assign','complete','endtime','starttime','holdtime','diffTime','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','calleridnum','connectedlinenum','request','newexten'];(function(_0x38f825,_0x592d8c){var _0x4598a0=function(_0x50f081){while(--_0x50f081){_0x38f825['push'](_0x38f825['shift']());}};_0x4598a0(++_0x592d8c);}(_0x97aa,0x140));var _0xa97a=function(_0x3c87d5,_0x1f2e3e){_0x3c87d5=_0x3c87d5-0x0;var _0x231bc4=_0x97aa[_0x3c87d5];return _0x231bc4;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xa97a('0x0'));var dials={};function writeDB(_0x2180ec){utils[_0xa97a('0x1')](util[_0xa97a('0x2')](_0xa97a('0x3'),_0x2180ec['uniqueid'],_0x2180ec['channel'],_0x2180ec[_0xa97a('0x4')],_0x2180ec[_0xa97a('0x5')],_0x2180ec[_0xa97a('0x6')],_0x2180ec['dialstatus']));utils[_0xa97a('0x7')]('CreateVoiceDialReport',_0x2180ec);delete dials[_0x2180ec['uniqueid']];}exports[_0xa97a('0x8')]=function(_0x34f021){try{utils[_0xa97a('0x9')](util[_0xa97a('0x2')](_0xa97a('0xa'),_0x34f021[_0xa97a('0xb')]),_0x34f021);utils['info'](util[_0xa97a('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x34f021[_0xa97a('0xb')],_0x34f021[_0xa97a('0xc')],_0x34f021[_0xa97a('0xd')]));if(_0x34f021[_0xa97a('0xc')][_0xa97a('0xe')]()==_0xa97a('0xf')&&_['startsWith'](_0x34f021['appdata'][_0xa97a('0xe')](),_0xa97a('0x10'))){var _0x136dcf=_0x34f021['appdata'][_0xa97a('0x11')]('=');dials[_0x34f021[_0xa97a('0xb')]]={'routeId':_0x136dcf[0x1]};}}catch(_0x37772d){utils[_0xa97a('0x12')](util[_0xa97a('0x2')](_0xa97a('0xa'),_0x34f021[_0xa97a('0xb')]),_0x37772d);}};exports[_0xa97a('0x13')]=function(_0x1bce33){try{utils[_0xa97a('0x9')](util['format']('[%s][dials][varset]',_0x1bce33[_0xa97a('0xb')]),_0x1bce33);if(!_[_0xa97a('0x14')](_0x1bce33[_0xa97a('0x15')][_0xa97a('0x16')])){utils[_0xa97a('0x1')](util['format'](_0xa97a('0x17'),_0x1bce33['uniqueid'],_0x1bce33[_0xa97a('0x18')]));dials[_0x1bce33['uniqueid']]={'routeId':_0x1bce33[_0xa97a('0x18')]};}}catch(_0x5939cf){utils['error'](util[_0xa97a('0x2')](_0xa97a('0x19'),_0x1bce33['uniqueid']),_0x5939cf);}};exports['dialbegin']=function(_0x5a3092){try{if(!_[_0xa97a('0x14')](dials[_0x5a3092[_0xa97a('0xb')]])){utils[_0xa97a('0x9')](util['format'](_0xa97a('0x1a'),_0x5a3092['uniqueid']),_0x5a3092);dials[_0x5a3092[_0xa97a('0xb')]]=_['assign'](dials[_0x5a3092[_0xa97a('0xb')]],_0x5a3092);dials[_0x5a3092['uniqueid']]['starttime']=utils[_0xa97a('0x1b')]();dials[_0x5a3092['uniqueid']][_0xa97a('0x1c')]=_0xa97a('0x1d');utils[_0xa97a('0x1')](util[_0xa97a('0x2')](_0xa97a('0x1e'),_0x5a3092[_0xa97a('0xb')],dials[_0x5a3092['uniqueid']]['starttime']));}}catch(_0xdd6be2){utils[_0xa97a('0x12')](util[_0xa97a('0x2')](_0xa97a('0x1a'),_0x5a3092['uniqueid']),_0xdd6be2);}};exports[_0xa97a('0x1f')]=function(_0x16a151){try{if(!_['isNil'](dials[_0x16a151[_0xa97a('0xb')]])){utils[_0xa97a('0x9')](util['format'](_0xa97a('0x20'),_0x16a151['uniqueid']),_0x16a151);dials[_0x16a151[_0xa97a('0xb')]]['dialstatus']=_0x16a151[_0xa97a('0x21')];if(_0x16a151[_0xa97a('0x21')]==_0xa97a('0x22')){dials[_0x16a151[_0xa97a('0xb')]]=_['assign'](dials[_0x16a151[_0xa97a('0xb')]],_0x16a151);dials[_0x16a151[_0xa97a('0xb')]][_0xa97a('0x23')]=utils[_0xa97a('0x1b')]();dials[_0x16a151[_0xa97a('0xb')]]['lastevent']='connect';utils[_0xa97a('0x1')](util['format']('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x16a151[_0xa97a('0xb')],_0x16a151[_0xa97a('0x21')],dials[_0x16a151['uniqueid']][_0xa97a('0x23')]));}else{utils[_0xa97a('0x1')](util[_0xa97a('0x2')](_0xa97a('0x24'),_0x16a151[_0xa97a('0xb')],_0x16a151[_0xa97a('0x21')]));}}}catch(_0x1d0661){utils[_0xa97a('0x12')](util[_0xa97a('0x2')](_0xa97a('0x20'),_0x16a151[_0xa97a('0xb')]),_0x1d0661);}};exports[_0xa97a('0x25')]=function(_0x88343b){try{if(!_[_0xa97a('0x14')](dials[_0x88343b['uniqueid']])){utils[_0xa97a('0x9')](util['format'](_0xa97a('0x26'),_0x88343b[_0xa97a('0xb')]),_0x88343b);utils['info'](util[_0xa97a('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x88343b[_0xa97a('0xb')],_0x88343b['calleridnum'],_0x88343b[_0xa97a('0x27')],_0x88343b[_0xa97a('0x28')]));dials[_0x88343b['uniqueid']]=_[_0xa97a('0x29')](dials[_0x88343b['uniqueid']],{'endtime':utils[_0xa97a('0x1b')](),'lastevent':_0xa97a('0x2a')});dials[_0x88343b[_0xa97a('0xb')]]['duration']=utils['diffTime'](dials[_0x88343b[_0xa97a('0xb')]][_0xa97a('0x2b')],dials[_0x88343b[_0xa97a('0xb')]][_0xa97a('0x2c')]);dials[_0x88343b[_0xa97a('0xb')]][_0xa97a('0x2d')]=utils[_0xa97a('0x2e')](dials[_0x88343b[_0xa97a('0xb')]][_0xa97a('0x23')]||dials[_0x88343b[_0xa97a('0xb')]]['endtime'],dials[_0x88343b['uniqueid']][_0xa97a('0x2c')]);dials[_0x88343b[_0xa97a('0xb')]]['billableseconds']=dials[_0x88343b['uniqueid']][_0xa97a('0x23')]?utils[_0xa97a('0x2e')](dials[_0x88343b[_0xa97a('0xb')]][_0xa97a('0x2b')],dials[_0x88343b[_0xa97a('0xb')]][_0xa97a('0x23')]):0x0;writeDB(dials[_0x88343b[_0xa97a('0xb')]]);}}catch(_0x4e31e9){utils[_0xa97a('0x12')](util[_0xa97a('0x2')](_0xa97a('0x26'),_0x88343b[_0xa97a('0xb')]),_0x4e31e9);}}; \ No newline at end of file +var _0x19ca=['calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','holdtime','endtime','billableseconds','answertime','[%s][dials][hangup]','lodash','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel'];(function(_0x139eb2,_0x3d7e18){var _0x2a5657=function(_0x3f0a33){while(--_0x3f0a33){_0x139eb2['push'](_0x139eb2['shift']());}};_0x2a5657(++_0x3d7e18);}(_0x19ca,0x9f));var _0xa19c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x19ca[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xa19c('0x0'));var util=require('util');var utils=require(_0xa19c('0x1'));var dials={};function writeDB(_0x26b14e){utils['info'](util[_0xa19c('0x2')](_0xa19c('0x3'),_0x26b14e[_0xa19c('0x4')],_0x26b14e[_0xa19c('0x5')],_0x26b14e['dialstring'],_0x26b14e[_0xa19c('0x6')],_0x26b14e[_0xa19c('0x7')],_0x26b14e[_0xa19c('0x8')]));utils['request'](_0xa19c('0x9'),_0x26b14e);delete dials[_0x26b14e[_0xa19c('0x4')]];}exports[_0xa19c('0xa')]=function(_0x3f5829){try{utils[_0xa19c('0xb')](util[_0xa19c('0x2')](_0xa19c('0xc'),_0x3f5829[_0xa19c('0x4')]),_0x3f5829);utils[_0xa19c('0xd')](util['format'](_0xa19c('0xe'),_0x3f5829['uniqueid'],_0x3f5829[_0xa19c('0xf')],_0x3f5829[_0xa19c('0x10')]));if(_0x3f5829['application'][_0xa19c('0x11')]()==_0xa19c('0x12')&&_[_0xa19c('0x13')](_0x3f5829[_0xa19c('0x10')][_0xa19c('0x11')](),_0xa19c('0x14'))){var _0x155669=_0x3f5829[_0xa19c('0x10')][_0xa19c('0x15')]('=');dials[_0x3f5829[_0xa19c('0x4')]]={'routeId':_0x155669[0x1]};}}catch(_0x1fb560){utils[_0xa19c('0x16')](util[_0xa19c('0x2')](_0xa19c('0xc'),_0x3f5829['uniqueid']),_0x1fb560);}};exports['varset']=function(_0x45befb){try{utils[_0xa19c('0xb')](util[_0xa19c('0x2')](_0xa19c('0x17'),_0x45befb[_0xa19c('0x4')]),_0x45befb);if(!_[_0xa19c('0x18')](_0x45befb[_0xa19c('0x19')][_0xa19c('0x1a')])){utils['info'](util[_0xa19c('0x2')](_0xa19c('0x1b'),_0x45befb[_0xa19c('0x4')],_0x45befb[_0xa19c('0x1c')]));dials[_0x45befb[_0xa19c('0x4')]]={'routeId':_0x45befb[_0xa19c('0x1c')]};}}catch(_0x9d4679){utils[_0xa19c('0x16')](util[_0xa19c('0x2')]('[%s][dials][varset]',_0x45befb[_0xa19c('0x4')]),_0x9d4679);}};exports[_0xa19c('0x1d')]=function(_0x3af929){try{if(!_['isNil'](dials[_0x3af929[_0xa19c('0x4')]])){utils['debug'](util[_0xa19c('0x2')](_0xa19c('0x1e'),_0x3af929[_0xa19c('0x4')]),_0x3af929);dials[_0x3af929[_0xa19c('0x4')]]=_[_0xa19c('0x1f')](dials[_0x3af929[_0xa19c('0x4')]],_0x3af929);dials[_0x3af929[_0xa19c('0x4')]][_0xa19c('0x20')]=utils[_0xa19c('0x21')]();dials[_0x3af929['uniqueid']][_0xa19c('0x22')]=_0xa19c('0x23');utils[_0xa19c('0xd')](util['format'](_0xa19c('0x24'),_0x3af929[_0xa19c('0x4')],dials[_0x3af929[_0xa19c('0x4')]][_0xa19c('0x20')]));}}catch(_0x4111ef){utils[_0xa19c('0x16')](util['format'](_0xa19c('0x1e'),_0x3af929[_0xa19c('0x4')]),_0x4111ef);}};exports[_0xa19c('0x25')]=function(_0xcd425){try{if(!_[_0xa19c('0x18')](dials[_0xcd425[_0xa19c('0x4')]])){utils[_0xa19c('0xb')](util[_0xa19c('0x2')](_0xa19c('0x26'),_0xcd425[_0xa19c('0x4')]),_0xcd425);dials[_0xcd425[_0xa19c('0x4')]][_0xa19c('0x8')]=_0xcd425[_0xa19c('0x8')];if(_0xcd425[_0xa19c('0x8')]==_0xa19c('0x27')){dials[_0xcd425[_0xa19c('0x4')]]=_[_0xa19c('0x1f')](dials[_0xcd425[_0xa19c('0x4')]],_0xcd425);dials[_0xcd425[_0xa19c('0x4')]]['answertime']=utils['now']();dials[_0xcd425[_0xa19c('0x4')]]['lastevent']=_0xa19c('0x28');utils[_0xa19c('0xd')](util[_0xa19c('0x2')](_0xa19c('0x29'),_0xcd425[_0xa19c('0x4')],_0xcd425[_0xa19c('0x8')],dials[_0xcd425['uniqueid']]['answertime']));}else{utils['info'](util['format'](_0xa19c('0x2a'),_0xcd425[_0xa19c('0x4')],_0xcd425[_0xa19c('0x8')]));}}}catch(_0xf0763a){utils[_0xa19c('0x16')](util['format'](_0xa19c('0x26'),_0xcd425[_0xa19c('0x4')]),_0xf0763a);}};exports[_0xa19c('0x2b')]=function(_0x32f06b){try{if(!_[_0xa19c('0x18')](dials[_0x32f06b['uniqueid']])){utils[_0xa19c('0xb')](util[_0xa19c('0x2')]('[%s][dials][hangup]',_0x32f06b[_0xa19c('0x4')]),_0x32f06b);utils[_0xa19c('0xd')](util['format'](_0xa19c('0x2c'),_0x32f06b[_0xa19c('0x4')],_0x32f06b[_0xa19c('0x6')],_0x32f06b[_0xa19c('0x2d')],_0x32f06b[_0xa19c('0x2e')]));dials[_0x32f06b[_0xa19c('0x4')]]=_[_0xa19c('0x1f')](dials[_0x32f06b[_0xa19c('0x4')]],{'endtime':utils[_0xa19c('0x21')](),'lastevent':_0xa19c('0x2f')});dials[_0x32f06b[_0xa19c('0x4')]][_0xa19c('0x30')]=utils[_0xa19c('0x31')](dials[_0x32f06b[_0xa19c('0x4')]]['endtime'],dials[_0x32f06b[_0xa19c('0x4')]][_0xa19c('0x20')]);dials[_0x32f06b['uniqueid']][_0xa19c('0x32')]=utils[_0xa19c('0x31')](dials[_0x32f06b['uniqueid']]['answertime']||dials[_0x32f06b['uniqueid']][_0xa19c('0x33')],dials[_0x32f06b['uniqueid']][_0xa19c('0x20')]);dials[_0x32f06b[_0xa19c('0x4')]][_0xa19c('0x34')]=dials[_0x32f06b[_0xa19c('0x4')]][_0xa19c('0x35')]?utils[_0xa19c('0x31')](dials[_0x32f06b[_0xa19c('0x4')]][_0xa19c('0x33')],dials[_0x32f06b[_0xa19c('0x4')]][_0xa19c('0x35')]):0x0;writeDB(dials[_0x32f06b['uniqueid']]);}}catch(_0x53acdb){utils['error'](util[_0xa19c('0x2')](_0xa19c('0x36'),_0x32f06b[_0xa19c('0x4')]),_0x53acdb);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index a7f35be..9c94011 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 _0x2d04=['[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','env','local','asterisk','port','username','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]'];(function(_0x2340ce,_0x44a477){var _0x5c774d=function(_0x1b3e84){while(--_0x1b3e84){_0x2340ce['push'](_0x2340ce['shift']());}};_0x5c774d(++_0x44a477);}(_0x2d04,0x177));var _0x42d0=function(_0x1b047f,_0x3b292c){_0x1b047f=_0x1b047f-0x0;var _0x3b2a9c=_0x2d04[_0x1b047f];return _0x3b2a9c;};var AsteriskManager=require(_0x42d0('0x0'));var config=require(_0x42d0('0x1'));var utils=require('./utils');var util=require(_0x42d0('0x2'));var isXDREnabled=config[_0x42d0('0x3')]&&config[_0x42d0('0x3')]['disabled']?!config[_0x42d0('0x3')][_0x42d0('0x4')]:!![];var isProduction=config[_0x42d0('0x5')]==='production'||![];var isLocalAsterisk=config[_0x42d0('0x3')]&&config[_0x42d0('0x3')][_0x42d0('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x42d0('0x7')][_0x42d0('0x8')],config[_0x42d0('0x7')]['ip'],config[_0x42d0('0x7')][_0x42d0('0x9')],config['asterisk'][_0x42d0('0xa')],!![]);ami[_0x42d0('0xb')]();if(!isXDREnabled){utils['info'](_0x42d0('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x42d0('0xd')](_0x42d0('0xe'));}else{var agents=require(_0x42d0('0xf'));var calls=require(_0x42d0('0x10'));var queues=require(_0x42d0('0x11'));var recordings=require('./recordings.controller');var members=require(_0x42d0('0x12'));var dials=require(_0x42d0('0x13'));var transfers=require(_0x42d0('0x14'));var core=require(_0x42d0('0x15'));ami['on'](_0x42d0('0x16'),core['connect']);ami['on'](_0x42d0('0x17'),core[_0x42d0('0x17')]);ami['on'](_0x42d0('0x18'),core['fullybooted']);ami['on'](_0x42d0('0x19'),core[_0x42d0('0x19')]);ami['on'](_0x42d0('0x1a'),core[_0x42d0('0x1a')]);ami['on'](_0x42d0('0x1b'),core[_0x42d0('0x1b')]);ami['on'](_0x42d0('0x1c'),function(_0x3267fd){try{utils[_0x42d0('0x1d')](util[_0x42d0('0x1e')](_0x42d0('0x1f'),_0x3267fd['device']),_0x3267fd);members[_0x42d0('0x1c')](_0x3267fd);}catch(_0x51d4dd){utils[_0x42d0('0x19')](util[_0x42d0('0x1e')](_0x42d0('0x1f'),_0x3267fd[_0x42d0('0x20')]),_0x51d4dd);}});ami['on']('agentcalled',function(_0x30d6b1){try{utils[_0x42d0('0x1d')](util[_0x42d0('0x1e')](_0x42d0('0x21'),_0x30d6b1[_0x42d0('0x22')]),_0x30d6b1);agents[_0x42d0('0x23')](_0x30d6b1);}catch(_0x1e7a6e){utils[_0x42d0('0x19')](util[_0x42d0('0x1e')](_0x42d0('0x21'),_0x30d6b1['uniqueid']),_0x1e7a6e);}});ami['on']('agentringnoanswer',function(_0x242551){try{utils[_0x42d0('0x1d')](util[_0x42d0('0x1e')]('[%s][index][agentringnoanswer]',_0x242551[_0x42d0('0x22')]),_0x242551);agents['agentringnoanswer'](_0x242551);}catch(_0x23790c){utils[_0x42d0('0x19')](util[_0x42d0('0x1e')](_0x42d0('0x24'),_0x242551['uniqueid']),_0x23790c);}});ami['on'](_0x42d0('0x25'),function(_0x3357bb){try{utils[_0x42d0('0x1d')](util[_0x42d0('0x1e')](_0x42d0('0x26'),_0x3357bb['uniqueid']),_0x3357bb);agents[_0x42d0('0x25')](_0x3357bb);queues[_0x42d0('0x25')](_0x3357bb);}catch(_0x3ddeb1){utils['error'](util['format']('[%s][index][agentconnect]',_0x3357bb[_0x42d0('0x22')]),_0x3ddeb1);}});ami['on']('agentcomplete',function(_0x457d30){try{utils[_0x42d0('0x1d')](util[_0x42d0('0x1e')](_0x42d0('0x27'),_0x457d30[_0x42d0('0x22')]),_0x457d30);agents[_0x42d0('0x28')](_0x457d30);queues['agentcomplete'](_0x457d30);members[_0x42d0('0x28')](_0x457d30);}catch(_0xe9b0b8){utils[_0x42d0('0x19')](util['format']('[%s][index][agentcomplete]',_0x457d30[_0x42d0('0x22')]),_0xe9b0b8);}});ami['on'](_0x42d0('0x29'),function(_0x3a9305){try{utils[_0x42d0('0x1d')](util['format'](_0x42d0('0x2a'),_0x3a9305['uniqueid']),_0x3a9305);agents[_0x42d0('0x29')](_0x3a9305);queues[_0x42d0('0x29')](_0x3a9305);}catch(_0x4fce7a){utils[_0x42d0('0x19')](util[_0x42d0('0x1e')](_0x42d0('0x2a'),_0x3a9305['uniqueid']),_0x4fce7a);}});ami['on'](_0x42d0('0x2b'),function(_0xc963f7){try{utils['debug'](util[_0x42d0('0x1e')](_0x42d0('0x2c'),_0xc963f7['uniqueid']),_0xc963f7);queues[_0x42d0('0x2b')](_0xc963f7);recordings[_0x42d0('0x2b')](_0xc963f7);}catch(_0x3ea138){utils[_0x42d0('0x19')](util[_0x42d0('0x1e')](_0x42d0('0x2c'),_0xc963f7['uniqueid']),_0x3ea138);}});ami['on'](_0x42d0('0x2d'),function(_0x3033aa){try{utils[_0x42d0('0x1d')](util[_0x42d0('0x1e')](_0x42d0('0x2e'),_0x3033aa[_0x42d0('0x22')]),_0x3033aa);queues[_0x42d0('0x2d')](_0x3033aa);}catch(_0x2f3ad5){utils[_0x42d0('0x19')](util['format'](_0x42d0('0x2e'),_0x3033aa[_0x42d0('0x22')]),_0x2f3ad5);}});ami['on'](_0x42d0('0x2f'),function(_0x6c1dad){try{utils[_0x42d0('0x1d')](util[_0x42d0('0x1e')]('[%s][index][musiconholdstart]',_0x6c1dad['uniqueid']),_0x6c1dad);queues[_0x42d0('0x2f')](_0x6c1dad);calls[_0x42d0('0x2f')](_0x6c1dad);}catch(_0x2d165d){utils[_0x42d0('0x19')](util[_0x42d0('0x1e')](_0x42d0('0x30'),_0x6c1dad[_0x42d0('0x22')]),_0x2d165d);}});ami['on'](_0x42d0('0x31'),function(_0x1c1ed4){try{utils[_0x42d0('0x1d')](util[_0x42d0('0x1e')](_0x42d0('0x32'),_0x1c1ed4[_0x42d0('0x22')]),_0x1c1ed4);queues[_0x42d0('0x31')](_0x1c1ed4);calls['musiconholdstop'](_0x1c1ed4);}catch(_0x10cf5c){utils[_0x42d0('0x19')](util[_0x42d0('0x1e')](_0x42d0('0x32'),_0x1c1ed4[_0x42d0('0x22')]),_0x10cf5c);}});ami['on'](_0x42d0('0x33'),function(_0x23e6d9){try{utils[_0x42d0('0x1d')](util[_0x42d0('0x1e')]('[%s][index][newstate]',_0x23e6d9[_0x42d0('0x22')]),_0x23e6d9);calls[_0x42d0('0x33')](_0x23e6d9);recordings[_0x42d0('0x33')](_0x23e6d9);}catch(_0x3dbabe){utils['error'](util[_0x42d0('0x1e')](_0x42d0('0x34'),_0x23e6d9[_0x42d0('0x22')]),_0x3dbabe);}});ami['on']('hangup',function(_0x3f49f0){try{utils[_0x42d0('0x1d')](util['format'](_0x42d0('0x35'),_0x3f49f0[_0x42d0('0x22')]),_0x3f49f0);calls[_0x42d0('0x36')](_0x3f49f0);recordings[_0x42d0('0x36')](_0x3f49f0);dials[_0x42d0('0x36')](_0x3f49f0);agents['hangup'](_0x3f49f0);queues[_0x42d0('0x36')](_0x3f49f0);}catch(_0x44a78c){utils[_0x42d0('0x19')](util[_0x42d0('0x1e')](_0x42d0('0x35'),_0x3f49f0[_0x42d0('0x22')]),_0x44a78c);}});ami['on'](_0x42d0('0x37'),function(_0x3affa6){try{utils[_0x42d0('0x1d')](util[_0x42d0('0x1e')](_0x42d0('0x38'),_0x3affa6[_0x42d0('0x22')]),_0x3affa6);members[_0x42d0('0x37')](_0x3affa6);}catch(_0x24a37a){utils['error'](util['format'](_0x42d0('0x38'),_0x3affa6['uniqueid']),_0x24a37a);}});ami['on']('blindtransfer',function(_0x1fcb3a){try{utils[_0x42d0('0x1d')](util[_0x42d0('0x1e')](_0x42d0('0x39'),_0x1fcb3a[_0x42d0('0x22')]),_0x1fcb3a);queues['blindtransfer'](_0x1fcb3a);agents['blindtransfer'](_0x1fcb3a);transfers[_0x42d0('0x3a')](_0x1fcb3a);recordings[_0x42d0('0x3a')](_0x1fcb3a);}catch(_0xa78ed9){utils[_0x42d0('0x19')](util[_0x42d0('0x1e')](_0x42d0('0x39'),_0x1fcb3a[_0x42d0('0x22')]),_0xa78ed9);}});ami['on'](_0x42d0('0x3b'),function(_0x57bef9){try{utils[_0x42d0('0x1d')](util[_0x42d0('0x1e')](_0x42d0('0x3c'),_0x57bef9[_0x42d0('0x3d')]),_0x57bef9);queues[_0x42d0('0x3b')](_0x57bef9);transfers[_0x42d0('0x3b')](_0x57bef9);agents[_0x42d0('0x3b')](_0x57bef9);calls[_0x42d0('0x3b')](_0x57bef9);}catch(_0x3676d0){utils['error'](util['format'](_0x42d0('0x3c'),_0x57bef9[_0x42d0('0x3d')]),_0x3676d0);}});ami['on'](_0x42d0('0x3e'),function(_0x50747f){try{utils[_0x42d0('0x1d')](util[_0x42d0('0x1e')]('[%s][index][varset]',_0x50747f[_0x42d0('0x22')]),_0x50747f);queues[_0x42d0('0x3e')](_0x50747f);recordings[_0x42d0('0x3e')](_0x50747f);calls['varset'](_0x50747f);dials[_0x42d0('0x3e')](_0x50747f);}catch(_0x420e80){utils[_0x42d0('0x19')](util[_0x42d0('0x1e')](_0x42d0('0x3f'),_0x50747f[_0x42d0('0x22')]),_0x420e80);}});ami['on'](_0x42d0('0x40'),function(_0x2de10e){try{utils['debug'](util[_0x42d0('0x1e')]('[%s][index][newexten]',_0x2de10e['uniqueid']),_0x2de10e);calls[_0x42d0('0x40')](_0x2de10e);recordings['newexten'](_0x2de10e);dials[_0x42d0('0x40')](_0x2de10e);}catch(_0x61b6e0){utils['error'](util[_0x42d0('0x1e')](_0x42d0('0x41'),_0x2de10e[_0x42d0('0x22')]),_0x61b6e0);}});ami['on'](_0x42d0('0x42'),function(_0x575587){try{utils['debug'](util[_0x42d0('0x1e')]('[%s][index][newchannel]',_0x575587[_0x42d0('0x22')]),_0x575587);calls[_0x42d0('0x42')](_0x575587);recordings[_0x42d0('0x42')](_0x575587);}catch(_0x57548c){utils[_0x42d0('0x19')](util[_0x42d0('0x1e')]('[%s][index][newchannel]',_0x575587[_0x42d0('0x22')]),_0x57548c);}});ami['on'](_0x42d0('0x43'),function(_0x6787){try{utils['debug'](util[_0x42d0('0x1e')](_0x42d0('0x44'),_0x6787[_0x42d0('0x22')]),_0x6787);dials[_0x42d0('0x43')](_0x6787);}catch(_0x529fe2){utils[_0x42d0('0x19')](util[_0x42d0('0x1e')](_0x42d0('0x45'),_0x6787['uniqueid']),_0x529fe2);}});ami['on'](_0x42d0('0x46'),function(_0x734c8e){try{utils[_0x42d0('0x1d')](util[_0x42d0('0x1e')](_0x42d0('0x47'),_0x734c8e['uniqueid']),_0x734c8e);dials[_0x42d0('0x46')](_0x734c8e);}catch(_0x4a73ef){utils[_0x42d0('0x19')](util[_0x42d0('0x1e')](_0x42d0('0x47'),_0x734c8e['uniqueid']),_0x4a73ef);}});} \ No newline at end of file +var _0xa88b=['agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','port','asterisk','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]'];(function(_0x5d0e0a,_0x3e85d4){var _0x5eb0c2=function(_0x300b01){while(--_0x300b01){_0x5d0e0a['push'](_0x5d0e0a['shift']());}};_0x5eb0c2(++_0x3e85d4);}(_0xa88b,0x1de));var _0xba88=function(_0x438685,_0x4ec0c0){_0x438685=_0x438685-0x0;var _0x41cca2=_0xa88b[_0x438685];return _0x41cca2;};var AsteriskManager=require(_0xba88('0x0'));var config=require(_0xba88('0x1'));var utils=require(_0xba88('0x2'));var util=require(_0xba88('0x3'));var isXDREnabled=config[_0xba88('0x4')]&&config[_0xba88('0x4')][_0xba88('0x5')]?!config['xdr']['disabled']:!![];var isProduction=config[_0xba88('0x6')]===_0xba88('0x7')||![];var isLocalAsterisk=config[_0xba88('0x4')]&&config[_0xba88('0x4')][_0xba88('0x8')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xba88('0x9')],config[_0xba88('0xa')]['ip'],config[_0xba88('0xa')]['username'],config[_0xba88('0xa')][_0xba88('0xb')],!![]);ami[_0xba88('0xc')]();if(!isXDREnabled){utils[_0xba88('0xd')](_0xba88('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xba88('0xd')](_0xba88('0xf'));}else{var agents=require(_0xba88('0x10'));var calls=require(_0xba88('0x11'));var queues=require(_0xba88('0x12'));var recordings=require('./recordings.controller');var members=require(_0xba88('0x13'));var dials=require(_0xba88('0x14'));var transfers=require(_0xba88('0x15'));var core=require(_0xba88('0x16'));ami['on'](_0xba88('0x17'),core[_0xba88('0x17')]);ami['on'](_0xba88('0x18'),core[_0xba88('0x18')]);ami['on'](_0xba88('0x19'),core[_0xba88('0x19')]);ami['on'](_0xba88('0x1a'),core[_0xba88('0x1a')]);ami['on'](_0xba88('0x1b'),core[_0xba88('0x1b')]);ami['on'](_0xba88('0x1c'),core['managerevent']);ami['on'](_0xba88('0x1d'),function(_0x474fb9){try{utils[_0xba88('0x1e')](util[_0xba88('0x1f')](_0xba88('0x20'),_0x474fb9[_0xba88('0x21')]),_0x474fb9);members[_0xba88('0x1d')](_0x474fb9);}catch(_0x232775){utils[_0xba88('0x1a')](util[_0xba88('0x1f')]('[%s][index][devicestatechange]',_0x474fb9[_0xba88('0x21')]),_0x232775);}});ami['on']('agentcalled',function(_0x32630a){try{utils[_0xba88('0x1e')](util[_0xba88('0x1f')](_0xba88('0x22'),_0x32630a['uniqueid']),_0x32630a);agents['agentcalled'](_0x32630a);}catch(_0x31f6a1){utils['error'](util['format'](_0xba88('0x22'),_0x32630a['uniqueid']),_0x31f6a1);}});ami['on'](_0xba88('0x23'),function(_0x2385fe){try{utils[_0xba88('0x1e')](util[_0xba88('0x1f')](_0xba88('0x24'),_0x2385fe['uniqueid']),_0x2385fe);agents[_0xba88('0x23')](_0x2385fe);}catch(_0x15f044){utils[_0xba88('0x1a')](util['format'](_0xba88('0x24'),_0x2385fe[_0xba88('0x25')]),_0x15f044);}});ami['on'](_0xba88('0x26'),function(_0x824058){try{utils['debug'](util[_0xba88('0x1f')](_0xba88('0x27'),_0x824058[_0xba88('0x25')]),_0x824058);agents[_0xba88('0x26')](_0x824058);queues[_0xba88('0x26')](_0x824058);}catch(_0x4612f6){utils[_0xba88('0x1a')](util['format']('[%s][index][agentconnect]',_0x824058[_0xba88('0x25')]),_0x4612f6);}});ami['on'](_0xba88('0x28'),function(_0x418df6){try{utils[_0xba88('0x1e')](util['format']('[%s][index][agentcomplete]',_0x418df6[_0xba88('0x25')]),_0x418df6);agents[_0xba88('0x28')](_0x418df6);queues[_0xba88('0x28')](_0x418df6);members[_0xba88('0x28')](_0x418df6);}catch(_0x5bb87d){utils[_0xba88('0x1a')](util[_0xba88('0x1f')](_0xba88('0x29'),_0x418df6[_0xba88('0x25')]),_0x5bb87d);}});ami['on'](_0xba88('0x2a'),function(_0x2fde45){try{utils[_0xba88('0x1e')](util[_0xba88('0x1f')](_0xba88('0x2b'),_0x2fde45[_0xba88('0x25')]),_0x2fde45);agents[_0xba88('0x2a')](_0x2fde45);queues[_0xba88('0x2a')](_0x2fde45);}catch(_0x2cd24b){utils[_0xba88('0x1a')](util['format'](_0xba88('0x2b'),_0x2fde45[_0xba88('0x25')]),_0x2cd24b);}});ami['on'](_0xba88('0x2c'),function(_0xf5b004){try{utils[_0xba88('0x1e')](util['format'](_0xba88('0x2d'),_0xf5b004[_0xba88('0x25')]),_0xf5b004);queues[_0xba88('0x2c')](_0xf5b004);recordings[_0xba88('0x2c')](_0xf5b004);}catch(_0x299ca3){utils['error'](util[_0xba88('0x1f')](_0xba88('0x2d'),_0xf5b004[_0xba88('0x25')]),_0x299ca3);}});ami['on'](_0xba88('0x2e'),function(_0x123e95){try{utils[_0xba88('0x1e')](util[_0xba88('0x1f')](_0xba88('0x2f'),_0x123e95['uniqueid']),_0x123e95);queues['queuecallerleave'](_0x123e95);}catch(_0x5dd71c){utils[_0xba88('0x1a')](util[_0xba88('0x1f')](_0xba88('0x2f'),_0x123e95['uniqueid']),_0x5dd71c);}});ami['on'](_0xba88('0x30'),function(_0x4df6c4){try{utils[_0xba88('0x1e')](util[_0xba88('0x1f')](_0xba88('0x31'),_0x4df6c4[_0xba88('0x25')]),_0x4df6c4);queues[_0xba88('0x30')](_0x4df6c4);calls['musiconholdstart'](_0x4df6c4);}catch(_0x4db988){utils[_0xba88('0x1a')](util[_0xba88('0x1f')](_0xba88('0x31'),_0x4df6c4[_0xba88('0x25')]),_0x4db988);}});ami['on']('musiconholdstop',function(_0x42242d){try{utils[_0xba88('0x1e')](util['format'](_0xba88('0x32'),_0x42242d[_0xba88('0x25')]),_0x42242d);queues[_0xba88('0x33')](_0x42242d);calls['musiconholdstop'](_0x42242d);}catch(_0x3f29bf){utils['error'](util[_0xba88('0x1f')](_0xba88('0x32'),_0x42242d[_0xba88('0x25')]),_0x3f29bf);}});ami['on'](_0xba88('0x34'),function(_0x534bc1){try{utils[_0xba88('0x1e')](util[_0xba88('0x1f')](_0xba88('0x35'),_0x534bc1[_0xba88('0x25')]),_0x534bc1);calls[_0xba88('0x34')](_0x534bc1);recordings[_0xba88('0x34')](_0x534bc1);}catch(_0x408ab4){utils[_0xba88('0x1a')](util['format'](_0xba88('0x35'),_0x534bc1[_0xba88('0x25')]),_0x408ab4);}});ami['on'](_0xba88('0x36'),function(_0x2f1c00){try{utils[_0xba88('0x1e')](util['format'](_0xba88('0x37'),_0x2f1c00['uniqueid']),_0x2f1c00);calls[_0xba88('0x36')](_0x2f1c00);recordings[_0xba88('0x36')](_0x2f1c00);dials[_0xba88('0x36')](_0x2f1c00);agents[_0xba88('0x36')](_0x2f1c00);queues[_0xba88('0x36')](_0x2f1c00);}catch(_0x295d78){utils[_0xba88('0x1a')](util[_0xba88('0x1f')](_0xba88('0x37'),_0x2f1c00[_0xba88('0x25')]),_0x295d78);}});ami['on'](_0xba88('0x38'),function(_0x19cc4c){try{utils[_0xba88('0x1e')](util[_0xba88('0x1f')](_0xba88('0x39'),_0x19cc4c[_0xba88('0x25')]),_0x19cc4c);members[_0xba88('0x38')](_0x19cc4c);}catch(_0x12a1bb){utils[_0xba88('0x1a')](util['format'](_0xba88('0x39'),_0x19cc4c[_0xba88('0x25')]),_0x12a1bb);}});ami['on']('blindtransfer',function(_0x583d05){try{utils[_0xba88('0x1e')](util[_0xba88('0x1f')](_0xba88('0x3a'),_0x583d05['uniqueid']),_0x583d05);queues[_0xba88('0x3b')](_0x583d05);agents['blindtransfer'](_0x583d05);transfers[_0xba88('0x3b')](_0x583d05);recordings[_0xba88('0x3b')](_0x583d05);}catch(_0x34e842){utils['error'](util['format']('[%s][index][blindtransfer]',_0x583d05[_0xba88('0x25')]),_0x34e842);}});ami['on'](_0xba88('0x3c'),function(_0x38073d){try{utils[_0xba88('0x1e')](util[_0xba88('0x1f')](_0xba88('0x3d'),_0x38073d[_0xba88('0x3e')]),_0x38073d);queues[_0xba88('0x3c')](_0x38073d);transfers[_0xba88('0x3c')](_0x38073d);agents[_0xba88('0x3c')](_0x38073d);calls['attendedtransfer'](_0x38073d);}catch(_0xe1d023){utils[_0xba88('0x1a')](util[_0xba88('0x1f')]('[%s][index][attendedtransfer]',_0x38073d[_0xba88('0x3e')]),_0xe1d023);}});ami['on'](_0xba88('0x3f'),function(_0x38f10b){try{utils[_0xba88('0x1e')](util[_0xba88('0x1f')](_0xba88('0x40'),_0x38f10b[_0xba88('0x25')]),_0x38f10b);queues[_0xba88('0x3f')](_0x38f10b);recordings[_0xba88('0x3f')](_0x38f10b);calls[_0xba88('0x3f')](_0x38f10b);dials[_0xba88('0x3f')](_0x38f10b);}catch(_0x379dcb){utils['error'](util[_0xba88('0x1f')](_0xba88('0x40'),_0x38f10b[_0xba88('0x25')]),_0x379dcb);}});ami['on'](_0xba88('0x41'),function(_0x16c741){try{utils[_0xba88('0x1e')](util[_0xba88('0x1f')]('[%s][index][newexten]',_0x16c741[_0xba88('0x25')]),_0x16c741);calls[_0xba88('0x41')](_0x16c741);recordings[_0xba88('0x41')](_0x16c741);dials['newexten'](_0x16c741);}catch(_0x51ef99){utils['error'](util[_0xba88('0x1f')](_0xba88('0x42'),_0x16c741[_0xba88('0x25')]),_0x51ef99);}});ami['on'](_0xba88('0x43'),function(_0x3873b8){try{utils[_0xba88('0x1e')](util['format'](_0xba88('0x44'),_0x3873b8[_0xba88('0x25')]),_0x3873b8);calls['newchannel'](_0x3873b8);recordings[_0xba88('0x43')](_0x3873b8);}catch(_0x53a31c){utils[_0xba88('0x1a')](util[_0xba88('0x1f')](_0xba88('0x44'),_0x3873b8[_0xba88('0x25')]),_0x53a31c);}});ami['on'](_0xba88('0x45'),function(_0x107b17){try{utils[_0xba88('0x1e')](util[_0xba88('0x1f')](_0xba88('0x46'),_0x107b17['uniqueid']),_0x107b17);dials['dialbegin'](_0x107b17);}catch(_0x16f548){utils[_0xba88('0x1a')](util[_0xba88('0x1f')](_0xba88('0x47'),_0x107b17[_0xba88('0x25')]),_0x16f548);}});ami['on'](_0xba88('0x48'),function(_0x5c0e0a){try{utils['debug'](util[_0xba88('0x1f')](_0xba88('0x49'),_0x5c0e0a[_0xba88('0x25')]),_0x5c0e0a);dials[_0xba88('0x48')](_0x5c0e0a);}catch(_0x39f616){utils[_0xba88('0x1a')](util[_0xba88('0x1f')]('[%s][index][dialend]',_0x5c0e0a['uniqueid']),_0x39f616);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 8943f2a..1f54365 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 _0x848c=['[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','agent','isNil','exitAt','now','diffTime','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','debug','[%s][members][cdr]','data1','source','data3','destination'];(function(_0x561808,_0x4d3bcf){var _0x213c7e=function(_0x274f9f){while(--_0x274f9f){_0x561808['push'](_0x561808['shift']());}};_0x213c7e(++_0x4d3bcf);}(_0x848c,0x110));var _0xc848=function(_0x5365ad,_0x41ec9b){_0x5365ad=_0x5365ad-0x0;var _0x365519=_0x848c[_0x5365ad];return _0x365519;};'use strict';var _=require(_0xc848('0x0'));var util=require(_0xc848('0x1'));var utils=require(_0xc848('0x2'));var members={};var exclude=[_0xc848('0x3'),_0xc848('0x4')];function writeDB(_0x199378){utils[_0xc848('0x5')](util[_0xc848('0x6')](_0xc848('0x7'),_0x199378[_0xc848('0x8')],_0x199378['interface'],_0x199378[_0xc848('0x9')],_0x199378[_0xc848('0xa')],_0x199378[_0xc848('0xb')],_0x199378['type']));if(_0x199378[_0xc848('0xc')]){utils[_0xc848('0xd')](_0x199378[_0xc848('0xc')])[_0xc848('0xe')](function(_0x391832){if(_0x391832){_0x199378[_0xc848('0xb')]=_0x391832[_0xc848('0xf')];_0x199378[_0xc848('0x10')]=_0x391832[_0xc848('0x10')];utils[_0xc848('0x11')](_0xc848('0x12'),_0x199378);}else{utils[_0xc848('0x13')](_0x199378[_0xc848('0xc')][_0xc848('0x14')]('/')[0x1])[_0xc848('0xe')](function(_0x1b7847){if(_0x1b7847){_0x199378[_0xc848('0xb')]=_0x1b7847[_0xc848('0xf')];_0x199378[_0xc848('0x10')]=_0x1b7847['internal'];utils[_0xc848('0x11')](_0xc848('0x12'),_0x199378);}});}})[_0xc848('0x15')](function(_0x19b0eb){utils[_0xc848('0x16')](util[_0xc848('0x6')](_0xc848('0x17'),_0x199378[_0xc848('0x8')]),_0x19b0eb);});}delete members[_0x199378[_0xc848('0xc')]];}function startsWith(_0x36ddb1,_0xf42b8b){return _[_0xc848('0x18')](_0x36ddb1,function(_0x3000de){return _[_0xc848('0x19')](_0xf42b8b,_0x3000de);});}exports[_0xc848('0x1a')]=function(_0x26f362){try{utils['debug'](util[_0xc848('0x6')](_0xc848('0x1b'),members[_0x26f362[_0xc848('0x1c')]]?members[_0x26f362[_0xc848('0x1c')]]['uniqueid']:_0x26f362['device']),_0x26f362);utils[_0xc848('0x5')](util['format'](_0xc848('0x1d'),members[_0x26f362['device']]?members[_0x26f362[_0xc848('0x1c')]]['uniqueid']:_0x26f362[_0xc848('0x1c')],_0x26f362[_0xc848('0x1e')],_0x26f362[_0xc848('0x1c')]));switch(_0x26f362['state']){case _0xc848('0x1f'):case _0xc848('0x20'):if(!startsWith(exclude,_0x26f362['device'])){members[_0x26f362[_0xc848('0x1c')]]={'channel':_0xc848('0x21'),'interface':_0x26f362['device'],'type':_0xc848('0x22'),'enterAt':utils['now'](),'role':_0xc848('0x23')};}break;case'NOT_INUSE':if(!_[_0xc848('0x24')](members[_0x26f362[_0xc848('0x1c')]])){members[_0x26f362[_0xc848('0x1c')]][_0xc848('0x25')]=utils[_0xc848('0x26')]();members[_0x26f362[_0xc848('0x1c')]]['duration']=utils[_0xc848('0x27')](members[_0x26f362[_0xc848('0x1c')]][_0xc848('0x25')],members[_0x26f362[_0xc848('0x1c')]]['enterAt']);if(members[_0x26f362[_0xc848('0x1c')]][_0xc848('0x8')]){writeDB(members[_0x26f362[_0xc848('0x1c')]]);}}break;default:break;}}catch(_0x369843){utils[_0xc848('0x16')](util[_0xc848('0x6')]('[%s][members][devicestatechange]',members[_0x26f362[_0xc848('0x1c')]]?members[_0x26f362[_0xc848('0x1c')]][_0xc848('0x8')]:_0x26f362[_0xc848('0x1c')]),_0x369843);}};exports[_0xc848('0x28')]=function(_0x5e6e70){try{if(!_[_0xc848('0x24')](members[_0x5e6e70['interface']])){utils['debug'](util['format']('[%s][members][agentcomplete]',_0x5e6e70['uniqueid']),_0x5e6e70);utils[_0xc848('0x5')](util[_0xc848('0x6')](_0xc848('0x29'),_0x5e6e70[_0xc848('0x8')],_0x5e6e70[_0xc848('0xc')],_0x5e6e70[_0xc848('0x2a')]));members[_0x5e6e70[_0xc848('0xc')]]=_[_0xc848('0x2b')](members[_0x5e6e70[_0xc848('0xc')]],{'data4':_0x5e6e70['queue'],'uniqueid':_0x5e6e70['uniqueid']});}}catch(_0x2e224d){utils[_0xc848('0x16')](util[_0xc848('0x6')](_0xc848('0x2c'),_0x5e6e70[_0xc848('0x8')]),_0x2e224d);}};exports[_0xc848('0x2d')]=function(_0x374fff){try{utils[_0xc848('0x2e')](util[_0xc848('0x6')](_0xc848('0x2f'),_0x374fff[_0xc848('0x8')]),_0x374fff);if(_0x374fff[_0xc848('0x9')]){var _0x1b1a79=_0x374fff[_0xc848('0x9')]['split']('-')[0x0];if(!_['isNil'](members[_0x1b1a79])){members[_0x1b1a79]=_['assign'](members[_0x1b1a79],{'data1':members[_0x1b1a79][_0xc848('0x30')]||_0x374fff['type'],'data2':members[_0x1b1a79][_0xc848('0xa')]||_0x374fff[_0xc848('0x31')],'data3':members[_0x1b1a79][_0xc848('0x32')]||_0x374fff[_0xc848('0x33')],'uniqueid':members[_0x1b1a79]['uniqueid']||_0x374fff['uniqueid']});utils[_0xc848('0x5')](util[_0xc848('0x6')](_0xc848('0x34'),_0x374fff['uniqueid'],members[_0x1b1a79][_0xc848('0x30')],members[_0x1b1a79][_0xc848('0xa')],members[_0x1b1a79]['data3']));if(members[_0x1b1a79][_0xc848('0x25')]){writeDB(members[_0x1b1a79]);}}}if(_0x374fff[_0xc848('0x35')]){var _0x1d0776=_0x374fff[_0xc848('0x35')][_0xc848('0x14')]('-')[0x0];if(!_[_0xc848('0x24')](members[_0x1d0776])){members[_0x1d0776]=_[_0xc848('0x2b')](members[_0x1d0776],{'data1':members[_0x1d0776][_0xc848('0x30')]||_0x374fff['type'],'data2':members[_0x1d0776][_0xc848('0xa')]||_0x374fff[_0xc848('0x31')],'data3':members[_0x1d0776][_0xc848('0x32')]||_0x374fff[_0xc848('0x33')],'uniqueid':members[_0x1d0776]['uniqueid']||_0x374fff[_0xc848('0x8')]});utils[_0xc848('0x5')](util['format'](_0xc848('0x34'),_0x374fff['uniqueid'],members[_0x1d0776][_0xc848('0x30')],members[_0x1d0776][_0xc848('0xa')],members[_0x1d0776][_0xc848('0x32')]));if(members[_0x1d0776][_0xc848('0x25')]){writeDB(members[_0x1d0776]);}}}}catch(_0x2f600e){utils[_0xc848('0x16')](util[_0xc848('0x6')](_0xc848('0x2f'),_0x374fff[_0xc848('0x8')]),_0x2f600e);}}; \ No newline at end of file +var _0x80cb=['uniqueid','some','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','interface','channel','data2','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','membername','name','error','format'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x80cb,0x193));var _0xb80c=function(_0x4a010b,_0x3523b3){_0x4a010b=_0x4a010b-0x0;var _0xe0b19b=_0x80cb[_0x4a010b];return _0xe0b19b;};'use strict';var _=require(_0xb80c('0x0'));var util=require(_0xb80c('0x1'));var utils=require(_0xb80c('0x2'));var members={};var exclude=[_0xb80c('0x3'),_0xb80c('0x4')];function writeDB(_0x2099c5){utils[_0xb80c('0x5')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x2099c5['uniqueid'],_0x2099c5[_0xb80c('0x6')],_0x2099c5[_0xb80c('0x7')],_0x2099c5[_0xb80c('0x8')],_0x2099c5['membername'],_0x2099c5[_0xb80c('0x9')]));if(_0x2099c5['interface']){utils[_0xb80c('0xa')](_0x2099c5[_0xb80c('0x6')])[_0xb80c('0xb')](function(_0x3b0a8e){if(_0x3b0a8e){_0x2099c5['membername']=_0x3b0a8e['name'];_0x2099c5['internal']=_0x3b0a8e[_0xb80c('0xc')];utils[_0xb80c('0xd')](_0xb80c('0xe'),_0x2099c5);}else{utils[_0xb80c('0xf')](_0x2099c5[_0xb80c('0x6')][_0xb80c('0x10')]('/')[0x1])[_0xb80c('0xb')](function(_0x244275){if(_0x244275){_0x2099c5[_0xb80c('0x11')]=_0x244275[_0xb80c('0x12')];_0x2099c5[_0xb80c('0xc')]=_0x244275['internal'];utils[_0xb80c('0xd')](_0xb80c('0xe'),_0x2099c5);}});}})['catch'](function(_0xa567ba){utils[_0xb80c('0x13')](util[_0xb80c('0x14')]('[%s][members][writeDB]',_0x2099c5[_0xb80c('0x15')]),_0xa567ba);});}delete members[_0x2099c5['interface']];}function startsWith(_0x13d29d,_0x3269c8){return _[_0xb80c('0x16')](_0x13d29d,function(_0x185dbb){return _[_0xb80c('0x17')](_0x3269c8,_0x185dbb);});}exports[_0xb80c('0x18')]=function(_0x3b0171){try{utils[_0xb80c('0x19')](util['format']('[%s][members][devicestatechange]',members[_0x3b0171[_0xb80c('0x1a')]]?members[_0x3b0171[_0xb80c('0x1a')]]['uniqueid']:_0x3b0171[_0xb80c('0x1a')]),_0x3b0171);utils[_0xb80c('0x5')](util[_0xb80c('0x14')](_0xb80c('0x1b'),members[_0x3b0171[_0xb80c('0x1a')]]?members[_0x3b0171[_0xb80c('0x1a')]][_0xb80c('0x15')]:_0x3b0171[_0xb80c('0x1a')],_0x3b0171[_0xb80c('0x1c')],_0x3b0171[_0xb80c('0x1a')]));switch(_0x3b0171['state']){case _0xb80c('0x1d'):case _0xb80c('0x1e'):if(!startsWith(exclude,_0x3b0171[_0xb80c('0x1a')])){members[_0x3b0171[_0xb80c('0x1a')]]={'channel':'voice','interface':_0x3b0171['device'],'type':_0xb80c('0x1f'),'enterAt':utils[_0xb80c('0x20')](),'role':_0xb80c('0x21')};}break;case _0xb80c('0x22'):if(!_[_0xb80c('0x23')](members[_0x3b0171['device']])){members[_0x3b0171[_0xb80c('0x1a')]][_0xb80c('0x24')]=utils[_0xb80c('0x20')]();members[_0x3b0171['device']][_0xb80c('0x25')]=utils[_0xb80c('0x26')](members[_0x3b0171[_0xb80c('0x1a')]][_0xb80c('0x24')],members[_0x3b0171[_0xb80c('0x1a')]][_0xb80c('0x27')]);if(members[_0x3b0171['device']][_0xb80c('0x15')]){writeDB(members[_0x3b0171[_0xb80c('0x1a')]]);}}break;default:break;}}catch(_0x4a1fd5){utils[_0xb80c('0x13')](util['format'](_0xb80c('0x28'),members[_0x3b0171[_0xb80c('0x1a')]]?members[_0x3b0171['device']][_0xb80c('0x15')]:_0x3b0171[_0xb80c('0x1a')]),_0x4a1fd5);}};exports[_0xb80c('0x29')]=function(_0x519f25){try{if(!_['isNil'](members[_0x519f25[_0xb80c('0x6')]])){utils['debug'](util['format'](_0xb80c('0x2a'),_0x519f25[_0xb80c('0x15')]),_0x519f25);utils[_0xb80c('0x5')](util['format'](_0xb80c('0x2b'),_0x519f25[_0xb80c('0x15')],_0x519f25['interface'],_0x519f25[_0xb80c('0x2c')]));members[_0x519f25[_0xb80c('0x6')]]=_[_0xb80c('0x2d')](members[_0x519f25['interface']],{'data4':_0x519f25[_0xb80c('0x2c')],'uniqueid':_0x519f25[_0xb80c('0x15')]});}}catch(_0x366b7b){utils['error'](util[_0xb80c('0x14')](_0xb80c('0x2a'),_0x519f25['uniqueid']),_0x366b7b);}};exports['cdr']=function(_0x3635a0){try{utils[_0xb80c('0x19')](util[_0xb80c('0x14')](_0xb80c('0x2e'),_0x3635a0[_0xb80c('0x15')]),_0x3635a0);if(_0x3635a0[_0xb80c('0x7')]){var _0x1f4223=_0x3635a0[_0xb80c('0x7')][_0xb80c('0x10')]('-')[0x0];if(!_[_0xb80c('0x23')](members[_0x1f4223])){members[_0x1f4223]=_['assign'](members[_0x1f4223],{'data1':members[_0x1f4223][_0xb80c('0x2f')]||_0x3635a0[_0xb80c('0x9')],'data2':members[_0x1f4223][_0xb80c('0x8')]||_0x3635a0[_0xb80c('0x30')],'data3':members[_0x1f4223][_0xb80c('0x31')]||_0x3635a0[_0xb80c('0x32')],'uniqueid':members[_0x1f4223][_0xb80c('0x15')]||_0x3635a0[_0xb80c('0x15')]});utils[_0xb80c('0x5')](util['format'](_0xb80c('0x33'),_0x3635a0[_0xb80c('0x15')],members[_0x1f4223][_0xb80c('0x2f')],members[_0x1f4223][_0xb80c('0x8')],members[_0x1f4223][_0xb80c('0x31')]));if(members[_0x1f4223][_0xb80c('0x24')]){writeDB(members[_0x1f4223]);}}}if(_0x3635a0['destinationchannel']){var _0x2b3d67=_0x3635a0[_0xb80c('0x34')]['split']('-')[0x0];if(!_[_0xb80c('0x23')](members[_0x2b3d67])){members[_0x2b3d67]=_[_0xb80c('0x2d')](members[_0x2b3d67],{'data1':members[_0x2b3d67]['data1']||_0x3635a0[_0xb80c('0x9')],'data2':members[_0x2b3d67]['data2']||_0x3635a0[_0xb80c('0x30')],'data3':members[_0x2b3d67]['data3']||_0x3635a0[_0xb80c('0x32')],'uniqueid':members[_0x2b3d67][_0xb80c('0x15')]||_0x3635a0[_0xb80c('0x15')]});utils[_0xb80c('0x5')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x3635a0['uniqueid'],members[_0x2b3d67][_0xb80c('0x2f')],members[_0x2b3d67]['data2'],members[_0x2b3d67]['data3']));if(members[_0x2b3d67][_0xb80c('0x24')]){writeDB(members[_0x2b3d67]);}}}}catch(_0x562dda){utils[_0xb80c('0x13')](util[_0xb80c('0x14')](_0xb80c('0x2e'),_0x3635a0['uniqueid']),_0x562dda);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 25fee5d..7bc3f48 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 _0xb849=['BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','[%s][queues][varset]','queuestatus','value','CONTINUE','queuecallerabandon','queuecallerexit','queuecallerexitAt','toUpperCase','queueposition','queuecallerabandonAt','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype'];(function(_0x544923,_0x5ea7fe){var _0x48f576=function(_0x3473a1){while(--_0x3473a1){_0x544923['push'](_0x544923['shift']());}};_0x48f576(++_0x5ea7fe);}(_0xb849,0x86));var _0x9b84=function(_0x419c56,_0x20acd5){_0x419c56=_0x419c56-0x0;var _0x3ecca1=_0xb849[_0x419c56];return _0x3ecca1;};'use strict';var _=require(_0x9b84('0x0'));var util=require(_0x9b84('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x4dc003){utils[_0x9b84('0x2')](util['format'](_0x9b84('0x3'),_0x4dc003[_0x9b84('0x4')],_0x4dc003[_0x9b84('0x5')],_0x4dc003[_0x9b84('0x6')],_0x4dc003[_0x9b84('0x7')],_0x4dc003['calleridnum'],_0x4dc003[_0x9b84('0x8')],_0x4dc003['queuecallerexitreason']));if(_0x4dc003['queue']){utils[_0x9b84('0x9')](_0x4dc003[_0x9b84('0x6')])[_0x9b84('0xa')](function(_0x703950){if(_0x703950){_0x4dc003[_0x9b84('0xb')]=_0x703950[_0x9b84('0xb')];}utils[_0x9b84('0xc')](_0x9b84('0xd'),_0x4dc003);});}else{utils[_0x9b84('0xc')]('CreateVoiceQueueReport',_0x4dc003);}if(_0x4dc003[_0x9b84('0xe')]){delete queues[_0x4dc003['transfereduniqueid']];}else{delete queues[_0x4dc003['uniqueid']];}}exports[_0x9b84('0xf')]=function(_0x7b1630){try{utils[_0x9b84('0x10')](util[_0x9b84('0x11')]('[%s][queues][queuecallerjoin]',_0x7b1630[_0x9b84('0x4')]),_0x7b1630);utils['info'](util[_0x9b84('0x11')](_0x9b84('0x12'),_0x7b1630['uniqueid'],_0x7b1630['queue'],_0x7b1630[_0x9b84('0x13')]));queues[_0x7b1630[_0x9b84('0x4')]]=_[_0x9b84('0x14')](_0x7b1630,{'originalposition':_0x7b1630['position'],'queuecallerjoinAt':utils[_0x9b84('0x15')](),'mohtime':0x0});}catch(_0xc0f58a){utils[_0x9b84('0x16')](util[_0x9b84('0x11')]('[%s][queues][queuecallerjoin]',_0x7b1630[_0x9b84('0x4')]),_0xc0f58a);}};exports[_0x9b84('0x17')]=function(_0x124114){try{if(!_[_0x9b84('0x18')](queues[_0x124114['uniqueid']])){utils[_0x9b84('0x10')](util[_0x9b84('0x11')](_0x9b84('0x19'),_0x124114['uniqueid']),_0x124114);if(queues[_0x124114[_0x9b84('0x4')]][_0x9b84('0x1a')]){if(!queues[_0x124114[_0x9b84('0x4')]]['queuecallerabandon']&&!queues[_0x124114[_0x9b84('0x4')]]['queuecallerexit']){queues[_0x124114[_0x9b84('0x4')]][_0x9b84('0x1b')]=!![];queues[_0x124114[_0x9b84('0x4')]][_0x9b84('0x1c')]=utils[_0x9b84('0x15')]();queues[_0x124114[_0x9b84('0x4')]][_0x9b84('0x1d')]=_0x9b84('0x1e');}utils[_0x9b84('0x2')](util[_0x9b84('0x11')](_0x9b84('0x1f'),_0x124114['uniqueid'],queues[_0x124114['uniqueid']]['name'],queues[_0x124114[_0x9b84('0x4')]][_0x9b84('0x1d')]));writeDB(queues[_0x124114[_0x9b84('0x4')]]);}else if(queues[_0x124114[_0x9b84('0x4')]][_0x9b84('0xe')]){utils[_0x9b84('0x2')](util[_0x9b84('0x11')](_0x9b84('0x20'),_0x124114[_0x9b84('0x4')],queues[_0x124114[_0x9b84('0x4')]][_0x9b84('0x21')],queues[_0x124114['uniqueid']]['transfereduniqueid']));queues[queues[_0x124114[_0x9b84('0x4')]]['transfereduniqueid']]=queues[_0x124114[_0x9b84('0x4')]];queues[queues[_0x124114['uniqueid']]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x124114[_0x9b84('0x4')]];}}}catch(_0xe48e7e){utils['error'](util[_0x9b84('0x11')](_0x9b84('0x19'),_0x124114[_0x9b84('0x4')]),_0xe48e7e);}};exports['varset']=function(_0x177e95){try{utils[_0x9b84('0x10')](util[_0x9b84('0x11')](_0x9b84('0x22'),_0x177e95['uniqueid']),_0x177e95);if(!_[_0x9b84('0x18')](_0x177e95['variable'][_0x9b84('0x23')])&&_0x177e95[_0x9b84('0x24')]['toUpperCase']()!==_0x9b84('0x25')){if(!_[_0x9b84('0x18')](queues[_0x177e95[_0x9b84('0x4')]])){queues[_0x177e95[_0x9b84('0x4')]][_0x9b84('0x26')]=![];queues[_0x177e95[_0x9b84('0x4')]]['queuecallerabandonAt']=null;queues[_0x177e95[_0x9b84('0x4')]][_0x9b84('0x27')]=!![];queues[_0x177e95['uniqueid']][_0x9b84('0x28')]=utils[_0x9b84('0x15')]();queues[_0x177e95['uniqueid']][_0x9b84('0x1d')]=_0x177e95[_0x9b84('0x24')][_0x9b84('0x29')]();utils['info'](util[_0x9b84('0x11')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x177e95['uniqueid'],queues[_0x177e95[_0x9b84('0x4')]][_0x9b84('0x21')],_0x177e95['value'],queues[_0x177e95[_0x9b84('0x4')]][_0x9b84('0x1d')]));writeDB(queues[_0x177e95[_0x9b84('0x4')]]);}}else if(!_[_0x9b84('0x18')](_0x177e95['variable'][_0x9b84('0x2a')])){if(!_[_0x9b84('0x18')](queues[_0x177e95[_0x9b84('0x4')]])&&!queues[_0x177e95['uniqueid']][_0x9b84('0x26')]){queues[_0x177e95[_0x9b84('0x4')]][_0x9b84('0x26')]=![];queues[_0x177e95['uniqueid']][_0x9b84('0x2b')]=null;queues[_0x177e95[_0x9b84('0x4')]][_0x9b84('0x27')]=!![];queues[_0x177e95['uniqueid']]['queuecallerexitAt']=utils[_0x9b84('0x15')]();queues[_0x177e95[_0x9b84('0x4')]][_0x9b84('0x1d')]='EXITWITHKEY';utils[_0x9b84('0x2')](util[_0x9b84('0x11')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x177e95[_0x9b84('0x4')],queues[_0x177e95[_0x9b84('0x4')]][_0x9b84('0x21')],_0x177e95[_0x9b84('0x24')],queues[_0x177e95[_0x9b84('0x4')]]['queuecallerexitreason']));}}}catch(_0x3d0e42){utils[_0x9b84('0x16')](util[_0x9b84('0x11')](_0x9b84('0x22'),_0x177e95['uniqueid']),_0x3d0e42);}};exports[_0x9b84('0x26')]=function(_0x5e8769){try{if(!_['isNil'](queues[_0x5e8769[_0x9b84('0x4')]])){utils[_0x9b84('0x10')](util[_0x9b84('0x11')]('[%s][queues][queuecallerabandon]',_0x5e8769['uniqueid']),_0x5e8769);queues[_0x5e8769[_0x9b84('0x4')]][_0x9b84('0x27')]=![];queues[_0x5e8769[_0x9b84('0x4')]][_0x9b84('0x28')]=null;queues[_0x5e8769[_0x9b84('0x4')]]['queuecallerabandon']=!![];queues[_0x5e8769[_0x9b84('0x4')]][_0x9b84('0x2b')]=utils[_0x9b84('0x15')]();queues[_0x5e8769[_0x9b84('0x4')]][_0x9b84('0x1d')]='ABANDONED';utils[_0x9b84('0x2')](util[_0x9b84('0x11')](_0x9b84('0x2c'),_0x5e8769[_0x9b84('0x4')],queues[_0x5e8769[_0x9b84('0x4')]]['name'],queues[_0x5e8769['uniqueid']][_0x9b84('0x1d')]));}}catch(_0x19fe08){utils['error'](util[_0x9b84('0x11')](_0x9b84('0x2d'),_0x5e8769['uniqueid']),_0x19fe08);}};exports['queuecallerleave']=function(_0xd86f6b){try{if(!_[_0x9b84('0x18')](queues[_0xd86f6b[_0x9b84('0x4')]])){utils[_0x9b84('0x10')](util['format'](_0x9b84('0x2e'),_0xd86f6b[_0x9b84('0x4')]),_0xd86f6b);utils[_0x9b84('0x2')](util['format'](_0x9b84('0x2f'),_0xd86f6b['uniqueid'],queues[_0xd86f6b[_0x9b84('0x4')]]['name'],_0xd86f6b['connectedlinenum'],_0xd86f6b[_0x9b84('0x30')]));queues[_0xd86f6b[_0x9b84('0x4')]][_0x9b84('0x31')]=!![];queues[_0xd86f6b[_0x9b84('0x4')]][_0x9b84('0x1a')]=utils[_0x9b84('0x15')]();queues[_0xd86f6b[_0x9b84('0x4')]][_0x9b84('0x32')]=utils[_0x9b84('0x33')](queues[_0xd86f6b[_0x9b84('0x4')]][_0x9b84('0x1a')],queues[_0xd86f6b[_0x9b84('0x4')]][_0x9b84('0x34')]);queues[_0xd86f6b[_0x9b84('0x4')]][_0x9b84('0x13')]=_0xd86f6b[_0x9b84('0x13')];queues[_0xd86f6b[_0x9b84('0x4')]][_0x9b84('0x35')]=_0xd86f6b[_0x9b84('0x35')];queues[_0xd86f6b[_0x9b84('0x4')]][_0x9b84('0x36')]=_0xd86f6b[_0x9b84('0x36')];queues[_0xd86f6b['uniqueid']][_0x9b84('0x30')]=_0xd86f6b[_0x9b84('0x30')];}}catch(_0x44f49a){utils[_0x9b84('0x16')](util[_0x9b84('0x11')](_0x9b84('0x2e'),_0xd86f6b[_0x9b84('0x4')]),_0x44f49a);}};exports['agentconnect']=function(_0x5d72dd){try{if(!_[_0x9b84('0x18')](queues[_0x5d72dd['uniqueid']])){utils['debug'](util[_0x9b84('0x11')](_0x9b84('0x37'),_0x5d72dd[_0x9b84('0x4')]),_0x5d72dd);utils['info'](util[_0x9b84('0x11')](_0x9b84('0x38'),_0x5d72dd[_0x9b84('0x4')],queues[_0x5d72dd['uniqueid']]['name'],_0x5d72dd[_0x9b84('0x39')],_0x5d72dd['destaccountcode']));queues[_0x5d72dd['uniqueid']][_0x9b84('0x26')]=![];queues[_0x5d72dd[_0x9b84('0x4')]][_0x9b84('0x26')]=![];queues[_0x5d72dd['uniqueid']][_0x9b84('0x2b')]=null;queues[_0x5d72dd[_0x9b84('0x4')]][_0x9b84('0x27')]=![];queues[_0x5d72dd[_0x9b84('0x4')]][_0x9b84('0x1d')]=null;queues[_0x5d72dd[_0x9b84('0x4')]][_0x9b84('0x28')]=null;queues[_0x5d72dd[_0x9b84('0x4')]]['assigned']=!![];queues[_0x5d72dd['uniqueid']][_0x9b84('0x8')]=_0x5d72dd[_0x9b84('0x3a')];queues[_0x5d72dd[_0x9b84('0x4')]]['lastAssignedTo']=_0x5d72dd[_0x9b84('0x39')];}}catch(_0x556a91){utils['error'](util['format'](_0x9b84('0x37'),_0x5d72dd[_0x9b84('0x4')]),_0x556a91);}};exports[_0x9b84('0x3b')]=function(_0x40284b){try{if(!_[_0x9b84('0x18')](queues[_0x40284b[_0x9b84('0x4')]])){if(queues[_0x40284b[_0x9b84('0x4')]][_0x9b84('0x1a')]){utils[_0x9b84('0x10')](util['format']('[%s][queues][agentcomplete]',_0x40284b[_0x9b84('0x4')]),_0x40284b);queues[_0x40284b[_0x9b84('0x4')]][_0x9b84('0x26')]=![];queues[_0x40284b['uniqueid']][_0x9b84('0x26')]=![];queues[_0x40284b[_0x9b84('0x4')]][_0x9b84('0x2b')]=null;queues[_0x40284b[_0x9b84('0x4')]][_0x9b84('0x27')]=![];queues[_0x40284b[_0x9b84('0x4')]][_0x9b84('0x28')]=null;queues[_0x40284b[_0x9b84('0x4')]][_0x9b84('0x3c')]=!![];queues[_0x40284b[_0x9b84('0x4')]]['lastAssignedTo']=_0x40284b[_0x9b84('0x39')];queues[_0x40284b[_0x9b84('0x4')]]['queuecallercomplete']=!![];queues[_0x40284b[_0x9b84('0x4')]]['queuecallercompleteAt']=utils[_0x9b84('0x15')]();if(_0x40284b[_0x9b84('0x3d')]=='transfer'){if(!queues[_0x40284b[_0x9b84('0x4')]][_0x9b84('0x3e')]){queues[_0x40284b[_0x9b84('0x4')]][_0x9b84('0x1d')]=_0x9b84('0x3f');}}else{queues[_0x40284b[_0x9b84('0x4')]][_0x9b84('0x1d')]=_0x9b84('0x40')+_0x40284b[_0x9b84('0x3d')][_0x9b84('0x29')]();}utils[_0x9b84('0x2')](util[_0x9b84('0x11')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x40284b[_0x9b84('0x4')],queues[_0x40284b['uniqueid']]['name'],_0x40284b[_0x9b84('0x39')],queues[_0x40284b[_0x9b84('0x4')]][_0x9b84('0x1d')]));writeDB(queues[_0x40284b['uniqueid']]);}}}catch(_0x54cf48){utils[_0x9b84('0x16')](util[_0x9b84('0x11')](_0x9b84('0x41'),_0x40284b['uniqueid']),_0x54cf48);}};exports[_0x9b84('0x42')]=function(_0x1d5643){try{if(!_[_0x9b84('0x18')](queues[_0x1d5643['transfereeuniqueid']])){utils[_0x9b84('0x10')](util[_0x9b84('0x11')](_0x9b84('0x43'),_0x1d5643[_0x9b84('0x4')]),_0x1d5643);queues[_0x1d5643[_0x9b84('0x44')]]['transfer']=!![];queues[_0x1d5643['transfereeuniqueid']][_0x9b84('0x45')]=_0x9b84('0x46');queues[_0x1d5643['transfereeuniqueid']][_0x9b84('0x47')]=_0x1d5643[_0x9b84('0x48')];queues[_0x1d5643[_0x9b84('0x44')]][_0x9b84('0x49')]=_0x1d5643['transfereeuniqueid'];queues[_0x1d5643[_0x9b84('0x44')]]['queuecallerexitreason']='BLINDTRANSFER';utils[_0x9b84('0x2')](util[_0x9b84('0x11')](_0x9b84('0x4a'),_0x1d5643[_0x9b84('0x4')],queues[_0x1d5643[_0x9b84('0x44')]]['name'],_0x1d5643['transfereeuniqueid'],_0x1d5643['extension']));}}catch(_0x1bb4f6){utils[_0x9b84('0x16')](util[_0x9b84('0x11')](_0x9b84('0x43'),_0x1d5643[_0x9b84('0x4')]),_0x1bb4f6);}};exports['attendedtransfer']=function(_0x19df8e){try{utils['debug'](util[_0x9b84('0x11')](_0x9b84('0x4b'),_0x19df8e[_0x9b84('0x4c')]),_0x19df8e);if(_0x19df8e['origtransfereruniqueid']==_0x19df8e[_0x9b84('0x4d')]){if(!_[_0x9b84('0x18')](queues[_0x19df8e['secondtransfererlinkedid']])){utils[_0x9b84('0x2')](util[_0x9b84('0x11')](_0x9b84('0x4e'),_0x19df8e['origtransfereruniqueid'],queues[_0x19df8e[_0x9b84('0x4f')]]['name'],_0x19df8e[_0x9b84('0x50')]));queues[_0x19df8e[_0x9b84('0x4f')]][_0x9b84('0x3e')]=!![];queues[_0x19df8e[_0x9b84('0x4f')]][_0x9b84('0x45')]=_0x9b84('0x51');queues[_0x19df8e[_0x9b84('0x4f')]][_0x9b84('0x47')]=_0x19df8e[_0x9b84('0x50')];queues[_0x19df8e[_0x9b84('0x4f')]][_0x9b84('0x49')]=_0x19df8e['origtransfereruniqueid'];queues[_0x19df8e[_0x9b84('0x4f')]]['queuecallerexitreason']=_0x9b84('0x52');}if(!_[_0x9b84('0x18')](queues[_0x19df8e[_0x9b84('0x4d')]])){if(_0x19df8e[_0x9b84('0x53')]&&queues[_0x19df8e[_0x9b84('0x53')]]){queues[_0x19df8e[_0x9b84('0x53')]][_0x9b84('0x54')]=0x1;queues[_0x19df8e[_0x9b84('0x44')]]=_[_0x9b84('0x55')](queues[_0x19df8e['transfereelinkedid']]);queues[_0x19df8e['transfereeuniqueid']]['transfereduniqueid']=_0x19df8e[_0x9b84('0x56')];queues[_0x19df8e[_0x9b84('0x44')]][_0x9b84('0x54')]=0x2;queues[_0x19df8e['transfereeuniqueid']][_0x9b84('0x57')]=queues[_0x19df8e[_0x9b84('0x4f')]]['calleridnum'];queues[_0x19df8e[_0x9b84('0x44')]][_0x9b84('0x58')]=queues[_0x19df8e['secondtransfererlinkedid']]['calleridname'];queues[_0x19df8e[_0x9b84('0x44')]][_0x9b84('0x34')]=utils[_0x9b84('0x15')]();queues[_0x19df8e[_0x9b84('0x44')]][_0x9b84('0x1a')]=utils['now']();queues[_0x19df8e[_0x9b84('0x44')]][_0x9b84('0x32')]=0x0;queues[_0x19df8e[_0x9b84('0x44')]][_0x9b84('0x59')]=0x0;utils['info'](util[_0x9b84('0x11')](_0x9b84('0x5a'),_0x19df8e[_0x9b84('0x4c')],queues[_0x19df8e[_0x9b84('0x44')]][_0x9b84('0x21')],queues[_0x19df8e[_0x9b84('0x44')]][_0x9b84('0x57')],queues[_0x19df8e[_0x9b84('0x44')]][_0x9b84('0x58')]));}else{utils[_0x9b84('0x2')](util[_0x9b84('0x11')](_0x9b84('0x5b'),_0x19df8e['origtransfereruniqueid'],queues[_0x19df8e[_0x9b84('0x4d')]]['name'],_0x19df8e[_0x9b84('0x4f')]));queues[_0x19df8e['origtransfererlinkedid']][_0x9b84('0xe')]=_0x19df8e['secondtransfererlinkedid'];}}}else if(_0x19df8e[_0x9b84('0x5c')]==_0x19df8e['secondtransfererlinkedid']){if(!_[_0x9b84('0x18')](queues[_0x19df8e[_0x9b84('0x4d')]])){utils[_0x9b84('0x2')](util[_0x9b84('0x11')](_0x9b84('0x5d'),_0x19df8e['origtransfereruniqueid'],queues[_0x19df8e[_0x9b84('0x4d')]]['name'],_0x19df8e[_0x9b84('0x5c')],_0x19df8e[_0x9b84('0x5e')]));queues[_0x19df8e[_0x9b84('0x4d')]]['transfer']=!![];queues[_0x19df8e[_0x9b84('0x4d')]]['transfertype']=_0x9b84('0x51');queues[_0x19df8e[_0x9b84('0x4d')]]['transferexten']=_0x19df8e[_0x9b84('0x5e')];queues[_0x19df8e[_0x9b84('0x4d')]]['transferuniqueid']=_0x19df8e[_0x9b84('0x5c')];queues[_0x19df8e[_0x9b84('0x4d')]][_0x9b84('0x1d')]=_0x9b84('0x52');}if(!_[_0x9b84('0x18')](queues[_0x19df8e[_0x9b84('0x4f')]])){if(_0x19df8e[_0x9b84('0x5f')]&&queues[_0x19df8e['transfertargetlinkedid']]){queues[_0x19df8e['transfertargetlinkedid']][_0x9b84('0x54')]=0x1;queues[_0x19df8e['transfertargetuniqueid']]=_[_0x9b84('0x55')](queues[_0x19df8e['transfertargetlinkedid']]);queues[_0x19df8e[_0x9b84('0x56')]][_0x9b84('0xe')]=_0x19df8e['transfertargetuniqueid'];queues[_0x19df8e['transfertargetuniqueid']][_0x9b84('0x54')]=0x2;queues[_0x19df8e[_0x9b84('0x56')]][_0x9b84('0x57')]=queues[_0x19df8e[_0x9b84('0x4d')]][_0x9b84('0x57')];queues[_0x19df8e[_0x9b84('0x56')]][_0x9b84('0x58')]=queues[_0x19df8e['origtransfererlinkedid']][_0x9b84('0x58')];queues[_0x19df8e[_0x9b84('0x56')]][_0x9b84('0x34')]=utils['now']();queues[_0x19df8e[_0x9b84('0x56')]][_0x9b84('0x1a')]=utils[_0x9b84('0x15')]();queues[_0x19df8e['transfertargetuniqueid']][_0x9b84('0x32')]=0x0;queues[_0x19df8e[_0x9b84('0x56')]]['mohtime']=0x0;utils[_0x9b84('0x2')](util[_0x9b84('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x19df8e[_0x9b84('0x4c')],queues[_0x19df8e[_0x9b84('0x56')]]['name'],queues[_0x19df8e[_0x9b84('0x56')]][_0x9b84('0xe')],queues[_0x19df8e[_0x9b84('0x56')]]['calleridnum'],queues[_0x19df8e[_0x9b84('0x56')]][_0x9b84('0x58')]));}else{utils[_0x9b84('0x2')](util[_0x9b84('0x11')](_0x9b84('0x5b'),_0x19df8e[_0x9b84('0x4c')],queues[_0x19df8e['secondtransfererlinkedid']][_0x9b84('0x21')],_0x19df8e[_0x9b84('0x4d')]));queues[_0x19df8e[_0x9b84('0x4f')]]['transfereduniqueid']=_0x19df8e['origtransfererlinkedid'];}}}}catch(_0x193f76){utils[_0x9b84('0x16')](util[_0x9b84('0x11')](_0x9b84('0x4b'),_0x19df8e[_0x9b84('0x4c')]),_0x193f76);}};exports[_0x9b84('0x60')]=function(_0x422514){try{if(!_[_0x9b84('0x18')](queues[_0x422514['uniqueid']])){utils[_0x9b84('0x10')](util[_0x9b84('0x11')](_0x9b84('0x61'),_0x422514[_0x9b84('0x4')]),_0x422514);queues[_0x422514[_0x9b84('0x4')]][_0x9b84('0x62')]=utils[_0x9b84('0x15')]();utils[_0x9b84('0x2')](util[_0x9b84('0x11')](_0x9b84('0x63'),_0x422514[_0x9b84('0x4')],queues[_0x422514['uniqueid']][_0x9b84('0x21')],queues[_0x422514[_0x9b84('0x4')]][_0x9b84('0x62')]));}}catch(_0x2e783c){utils['error'](util[_0x9b84('0x11')]('[%s][queues][musiconholdstart]',_0x422514['uniqueid']),_0x2e783c);}};exports[_0x9b84('0x64')]=function(_0x4f6876){try{if(!_['isNil'](queues[_0x4f6876[_0x9b84('0x4')]])){if(!_[_0x9b84('0x18')](queues[_0x4f6876[_0x9b84('0x4')]][_0x9b84('0x62')])){utils[_0x9b84('0x10')](util[_0x9b84('0x11')](_0x9b84('0x65'),_0x4f6876['uniqueid']),_0x4f6876);queues[_0x4f6876[_0x9b84('0x4')]][_0x9b84('0x59')]+=utils['diffTime'](utils[_0x9b84('0x15')](),queues[_0x4f6876[_0x9b84('0x4')]][_0x9b84('0x62')]);utils[_0x9b84('0x2')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x4f6876[_0x9b84('0x4')],queues[_0x4f6876[_0x9b84('0x4')]][_0x9b84('0x21')],queues[_0x4f6876['uniqueid']][_0x9b84('0x59')]));delete queues[_0x4f6876[_0x9b84('0x4')]][_0x9b84('0x62')];}}}catch(_0x54baf5){utils[_0x9b84('0x16')](util[_0x9b84('0x11')]('[%s][queues][musiconholdstop]',_0x4f6876[_0x9b84('0x4')]),_0x54baf5);}}; \ No newline at end of file +var _0x4027=['channel','lastAssignedTo','calleridnum','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','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','queuecallerexitAt','toUpperCase','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','accountcode','[%s][queues][agentcomplete]','queuecallerabandonAt','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDED','origtransfererexten','transfereelinkedid','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','uniqueid'];(function(_0x386bf1,_0x13902c){var _0x3ec26d=function(_0x1deed6){while(--_0x1deed6){_0x386bf1['push'](_0x386bf1['shift']());}};_0x3ec26d(++_0x13902c);}(_0x4027,0xc9));var _0x7402=function(_0xbbe70f,_0x22f18b){_0xbbe70f=_0xbbe70f-0x0;var _0x3ee24d=_0x4027[_0xbbe70f];return _0x3ee24d;};'use strict';var _=require(_0x7402('0x0'));var util=require('util');var utils=require(_0x7402('0x1'));var queues={};function writeDB(_0x53f7c8){utils[_0x7402('0x2')](util[_0x7402('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x53f7c8[_0x7402('0x4')],_0x53f7c8[_0x7402('0x5')],_0x53f7c8['queue'],_0x53f7c8[_0x7402('0x6')],_0x53f7c8[_0x7402('0x7')],_0x53f7c8['accountcode'],_0x53f7c8[_0x7402('0x8')]));if(_0x53f7c8[_0x7402('0x9')]){utils[_0x7402('0xa')](_0x53f7c8[_0x7402('0x9')])['then'](function(_0x3845ca){if(_0x3845ca){_0x53f7c8[_0x7402('0xb')]=_0x3845ca[_0x7402('0xb')];}utils[_0x7402('0xc')]('CreateVoiceQueueReport',_0x53f7c8);});}else{utils[_0x7402('0xc')](_0x7402('0xd'),_0x53f7c8);}if(_0x53f7c8[_0x7402('0xe')]){delete queues[_0x53f7c8[_0x7402('0xe')]];}else{delete queues[_0x53f7c8['uniqueid']];}}exports[_0x7402('0xf')]=function(_0x12412f){try{utils[_0x7402('0x10')](util[_0x7402('0x3')](_0x7402('0x11'),_0x12412f[_0x7402('0x4')]),_0x12412f);utils[_0x7402('0x2')](util[_0x7402('0x3')](_0x7402('0x12'),_0x12412f['uniqueid'],_0x12412f[_0x7402('0x9')],_0x12412f['position']));queues[_0x12412f[_0x7402('0x4')]]=_[_0x7402('0x13')](_0x12412f,{'originalposition':_0x12412f[_0x7402('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x278e15){utils['error'](util[_0x7402('0x3')](_0x7402('0x11'),_0x12412f[_0x7402('0x4')]),_0x278e15);}};exports['hangup']=function(_0x5aa42f){try{if(!_[_0x7402('0x15')](queues[_0x5aa42f[_0x7402('0x4')]])){utils[_0x7402('0x10')](util[_0x7402('0x3')](_0x7402('0x16'),_0x5aa42f[_0x7402('0x4')]),_0x5aa42f);if(queues[_0x5aa42f[_0x7402('0x4')]][_0x7402('0x17')]){if(!queues[_0x5aa42f['uniqueid']][_0x7402('0x18')]&&!queues[_0x5aa42f[_0x7402('0x4')]][_0x7402('0x19')]){queues[_0x5aa42f['uniqueid']][_0x7402('0x1a')]=!![];queues[_0x5aa42f[_0x7402('0x4')]][_0x7402('0x1b')]=utils[_0x7402('0x1c')]();queues[_0x5aa42f['uniqueid']][_0x7402('0x8')]=_0x7402('0x1d');}utils[_0x7402('0x2')](util[_0x7402('0x3')](_0x7402('0x1e'),_0x5aa42f['uniqueid'],queues[_0x5aa42f[_0x7402('0x4')]][_0x7402('0x1f')],queues[_0x5aa42f[_0x7402('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x5aa42f['uniqueid']]);}else if(queues[_0x5aa42f['uniqueid']][_0x7402('0xe')]){utils[_0x7402('0x2')](util[_0x7402('0x3')](_0x7402('0x20'),_0x5aa42f[_0x7402('0x4')],queues[_0x5aa42f[_0x7402('0x4')]]['name'],queues[_0x5aa42f[_0x7402('0x4')]][_0x7402('0xe')]));queues[queues[_0x5aa42f[_0x7402('0x4')]][_0x7402('0xe')]]=queues[_0x5aa42f[_0x7402('0x4')]];queues[queues[_0x5aa42f[_0x7402('0x4')]][_0x7402('0xe')]][_0x7402('0x21')]=0x2;delete queues[_0x5aa42f[_0x7402('0x4')]];}}}catch(_0x58476a){utils[_0x7402('0x22')](util[_0x7402('0x3')](_0x7402('0x16'),_0x5aa42f['uniqueid']),_0x58476a);}};exports[_0x7402('0x23')]=function(_0x58eec9){try{utils[_0x7402('0x10')](util[_0x7402('0x3')](_0x7402('0x24'),_0x58eec9[_0x7402('0x4')]),_0x58eec9);if(!_[_0x7402('0x15')](_0x58eec9[_0x7402('0x25')][_0x7402('0x26')])&&_0x58eec9[_0x7402('0x27')]['toUpperCase']()!==_0x7402('0x28')){if(!_['isNil'](queues[_0x58eec9[_0x7402('0x4')]])){queues[_0x58eec9[_0x7402('0x4')]][_0x7402('0x18')]=![];queues[_0x58eec9[_0x7402('0x4')]]['queuecallerabandonAt']=null;queues[_0x58eec9[_0x7402('0x4')]][_0x7402('0x19')]=!![];queues[_0x58eec9['uniqueid']][_0x7402('0x29')]=utils[_0x7402('0x1c')]();queues[_0x58eec9[_0x7402('0x4')]][_0x7402('0x8')]=_0x58eec9[_0x7402('0x27')][_0x7402('0x2a')]();utils['info'](util[_0x7402('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x58eec9[_0x7402('0x4')],queues[_0x58eec9[_0x7402('0x4')]][_0x7402('0x1f')],_0x58eec9[_0x7402('0x27')],queues[_0x58eec9[_0x7402('0x4')]][_0x7402('0x8')]));writeDB(queues[_0x58eec9[_0x7402('0x4')]]);}}else if(!_[_0x7402('0x15')](_0x58eec9[_0x7402('0x25')][_0x7402('0x2b')])){if(!_[_0x7402('0x15')](queues[_0x58eec9[_0x7402('0x4')]])&&!queues[_0x58eec9[_0x7402('0x4')]][_0x7402('0x18')]){queues[_0x58eec9[_0x7402('0x4')]]['queuecallerabandon']=![];queues[_0x58eec9[_0x7402('0x4')]]['queuecallerabandonAt']=null;queues[_0x58eec9[_0x7402('0x4')]][_0x7402('0x19')]=!![];queues[_0x58eec9[_0x7402('0x4')]][_0x7402('0x29')]=utils[_0x7402('0x1c')]();queues[_0x58eec9[_0x7402('0x4')]][_0x7402('0x8')]=_0x7402('0x2c');utils[_0x7402('0x2')](util[_0x7402('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x58eec9[_0x7402('0x4')],queues[_0x58eec9['uniqueid']][_0x7402('0x1f')],_0x58eec9['value'],queues[_0x58eec9[_0x7402('0x4')]][_0x7402('0x8')]));}}}catch(_0x45ee25){utils[_0x7402('0x22')](util[_0x7402('0x3')]('[%s][queues][varset]',_0x58eec9[_0x7402('0x4')]),_0x45ee25);}};exports[_0x7402('0x18')]=function(_0x48688e){try{if(!_['isNil'](queues[_0x48688e[_0x7402('0x4')]])){utils[_0x7402('0x10')](util[_0x7402('0x3')](_0x7402('0x2d'),_0x48688e[_0x7402('0x4')]),_0x48688e);queues[_0x48688e['uniqueid']]['queuecallerexit']=![];queues[_0x48688e[_0x7402('0x4')]][_0x7402('0x29')]=null;queues[_0x48688e[_0x7402('0x4')]][_0x7402('0x18')]=!![];queues[_0x48688e[_0x7402('0x4')]]['queuecallerabandonAt']=utils['now']();queues[_0x48688e[_0x7402('0x4')]][_0x7402('0x8')]=_0x7402('0x2e');utils[_0x7402('0x2')](util[_0x7402('0x3')](_0x7402('0x2f'),_0x48688e[_0x7402('0x4')],queues[_0x48688e['uniqueid']][_0x7402('0x1f')],queues[_0x48688e['uniqueid']]['queuecallerexitreason']));}}catch(_0x29dca1){utils['error'](util[_0x7402('0x3')](_0x7402('0x2d'),_0x48688e[_0x7402('0x4')]),_0x29dca1);}};exports[_0x7402('0x30')]=function(_0xe9f9d0){try{if(!_['isNil'](queues[_0xe9f9d0[_0x7402('0x4')]])){utils[_0x7402('0x10')](util['format']('[%s][queues][queuecallerleave]',_0xe9f9d0[_0x7402('0x4')]),_0xe9f9d0);utils['info'](util[_0x7402('0x3')](_0x7402('0x31'),_0xe9f9d0['uniqueid'],queues[_0xe9f9d0[_0x7402('0x4')]][_0x7402('0x1f')],_0xe9f9d0[_0x7402('0x32')],_0xe9f9d0[_0x7402('0x33')]));queues[_0xe9f9d0['uniqueid']][_0x7402('0x30')]=!![];queues[_0xe9f9d0[_0x7402('0x4')]][_0x7402('0x17')]=utils[_0x7402('0x1c')]();queues[_0xe9f9d0[_0x7402('0x4')]][_0x7402('0x34')]=utils['diffTime'](queues[_0xe9f9d0[_0x7402('0x4')]]['queuecallerleaveAt'],queues[_0xe9f9d0[_0x7402('0x4')]]['queuecallerjoinAt']);queues[_0xe9f9d0[_0x7402('0x4')]][_0x7402('0x14')]=_0xe9f9d0[_0x7402('0x14')];queues[_0xe9f9d0[_0x7402('0x4')]][_0x7402('0x35')]=_0xe9f9d0['count'];queues[_0xe9f9d0['uniqueid']][_0x7402('0x32')]=_0xe9f9d0[_0x7402('0x32')];queues[_0xe9f9d0[_0x7402('0x4')]][_0x7402('0x33')]=_0xe9f9d0[_0x7402('0x33')];}}catch(_0x1ca1a3){utils[_0x7402('0x22')](util[_0x7402('0x3')](_0x7402('0x36'),_0xe9f9d0[_0x7402('0x4')]),_0x1ca1a3);}};exports[_0x7402('0x37')]=function(_0x55e9b2){try{if(!_[_0x7402('0x15')](queues[_0x55e9b2['uniqueid']])){utils[_0x7402('0x10')](util[_0x7402('0x3')](_0x7402('0x38'),_0x55e9b2[_0x7402('0x4')]),_0x55e9b2);utils['info'](util[_0x7402('0x3')](_0x7402('0x39'),_0x55e9b2[_0x7402('0x4')],queues[_0x55e9b2[_0x7402('0x4')]][_0x7402('0x1f')],_0x55e9b2[_0x7402('0x3a')],_0x55e9b2['destaccountcode']));queues[_0x55e9b2[_0x7402('0x4')]][_0x7402('0x18')]=![];queues[_0x55e9b2[_0x7402('0x4')]][_0x7402('0x18')]=![];queues[_0x55e9b2[_0x7402('0x4')]]['queuecallerabandonAt']=null;queues[_0x55e9b2[_0x7402('0x4')]][_0x7402('0x19')]=![];queues[_0x55e9b2[_0x7402('0x4')]][_0x7402('0x8')]=null;queues[_0x55e9b2[_0x7402('0x4')]]['queuecallerexitAt']=null;queues[_0x55e9b2[_0x7402('0x4')]][_0x7402('0x3b')]=!![];queues[_0x55e9b2[_0x7402('0x4')]][_0x7402('0x3c')]=_0x55e9b2['destaccountcode'];queues[_0x55e9b2['uniqueid']][_0x7402('0x6')]=_0x55e9b2[_0x7402('0x3a')];}}catch(_0x41147f){utils[_0x7402('0x22')](util[_0x7402('0x3')](_0x7402('0x38'),_0x55e9b2[_0x7402('0x4')]),_0x41147f);}};exports['agentcomplete']=function(_0x47f2a8){try{if(!_[_0x7402('0x15')](queues[_0x47f2a8[_0x7402('0x4')]])){if(queues[_0x47f2a8['uniqueid']][_0x7402('0x17')]){utils[_0x7402('0x10')](util[_0x7402('0x3')](_0x7402('0x3d'),_0x47f2a8[_0x7402('0x4')]),_0x47f2a8);queues[_0x47f2a8[_0x7402('0x4')]][_0x7402('0x18')]=![];queues[_0x47f2a8[_0x7402('0x4')]]['queuecallerabandon']=![];queues[_0x47f2a8[_0x7402('0x4')]][_0x7402('0x3e')]=null;queues[_0x47f2a8[_0x7402('0x4')]][_0x7402('0x19')]=![];queues[_0x47f2a8[_0x7402('0x4')]][_0x7402('0x29')]=null;queues[_0x47f2a8[_0x7402('0x4')]][_0x7402('0x3b')]=!![];queues[_0x47f2a8['uniqueid']]['lastAssignedTo']=_0x47f2a8[_0x7402('0x3a')];queues[_0x47f2a8['uniqueid']]['queuecallercomplete']=!![];queues[_0x47f2a8[_0x7402('0x4')]][_0x7402('0x1b')]=utils['now']();if(_0x47f2a8[_0x7402('0x3f')]==_0x7402('0x40')){if(!queues[_0x47f2a8['uniqueid']][_0x7402('0x40')]){queues[_0x47f2a8['uniqueid']][_0x7402('0x8')]=_0x7402('0x41');}}else{queues[_0x47f2a8[_0x7402('0x4')]]['queuecallerexitreason']='COMPLETEDBY'+_0x47f2a8[_0x7402('0x3f')][_0x7402('0x2a')]();}utils['info'](util['format'](_0x7402('0x42'),_0x47f2a8[_0x7402('0x4')],queues[_0x47f2a8['uniqueid']][_0x7402('0x1f')],_0x47f2a8[_0x7402('0x3a')],queues[_0x47f2a8['uniqueid']][_0x7402('0x8')]));writeDB(queues[_0x47f2a8[_0x7402('0x4')]]);}}}catch(_0x1b0545){utils[_0x7402('0x22')](util[_0x7402('0x3')](_0x7402('0x3d'),_0x47f2a8[_0x7402('0x4')]),_0x1b0545);}};exports[_0x7402('0x43')]=function(_0x53435e){try{if(!_[_0x7402('0x15')](queues[_0x53435e[_0x7402('0x44')]])){utils[_0x7402('0x10')](util[_0x7402('0x3')](_0x7402('0x45'),_0x53435e['uniqueid']),_0x53435e);queues[_0x53435e[_0x7402('0x44')]][_0x7402('0x40')]=!![];queues[_0x53435e[_0x7402('0x44')]][_0x7402('0x46')]=_0x7402('0x47');queues[_0x53435e[_0x7402('0x44')]][_0x7402('0x48')]=_0x53435e[_0x7402('0x49')];queues[_0x53435e[_0x7402('0x44')]][_0x7402('0x4a')]=_0x53435e[_0x7402('0x44')];queues[_0x53435e[_0x7402('0x44')]][_0x7402('0x8')]=_0x7402('0x4b');utils[_0x7402('0x2')](util[_0x7402('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x53435e[_0x7402('0x4')],queues[_0x53435e[_0x7402('0x44')]][_0x7402('0x1f')],_0x53435e[_0x7402('0x44')],_0x53435e['extension']));}}catch(_0x53035a){utils['error'](util[_0x7402('0x3')](_0x7402('0x45'),_0x53435e[_0x7402('0x4')]),_0x53035a);}};exports['attendedtransfer']=function(_0x496504){try{utils['debug'](util[_0x7402('0x3')](_0x7402('0x4c'),_0x496504[_0x7402('0x4d')]),_0x496504);if(_0x496504[_0x7402('0x4d')]==_0x496504[_0x7402('0x4e')]){if(!_['isNil'](queues[_0x496504['secondtransfererlinkedid']])){utils[_0x7402('0x2')](util[_0x7402('0x3')](_0x7402('0x4f'),_0x496504['origtransfereruniqueid'],queues[_0x496504[_0x7402('0x50')]][_0x7402('0x1f')],_0x496504['origtransfererexten']));queues[_0x496504['secondtransfererlinkedid']][_0x7402('0x40')]=!![];queues[_0x496504['secondtransfererlinkedid']]['transfertype']=_0x7402('0x51');queues[_0x496504[_0x7402('0x50')]][_0x7402('0x48')]=_0x496504[_0x7402('0x52')];queues[_0x496504[_0x7402('0x50')]][_0x7402('0x4a')]=_0x496504[_0x7402('0x4d')];queues[_0x496504[_0x7402('0x50')]][_0x7402('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x7402('0x15')](queues[_0x496504['origtransfererlinkedid']])){if(_0x496504[_0x7402('0x53')]&&queues[_0x496504[_0x7402('0x53')]]){queues[_0x496504[_0x7402('0x53')]]['queuecallerenterreason']=0x1;queues[_0x496504[_0x7402('0x44')]]=_['clone'](queues[_0x496504[_0x7402('0x53')]]);queues[_0x496504[_0x7402('0x44')]][_0x7402('0xe')]=_0x496504[_0x7402('0x54')];queues[_0x496504['transfereeuniqueid']][_0x7402('0x21')]=0x2;queues[_0x496504[_0x7402('0x44')]]['calleridnum']=queues[_0x496504['secondtransfererlinkedid']][_0x7402('0x7')];queues[_0x496504[_0x7402('0x44')]]['calleridname']=queues[_0x496504['secondtransfererlinkedid']][_0x7402('0x55')];queues[_0x496504['transfereeuniqueid']][_0x7402('0x56')]=utils['now']();queues[_0x496504['transfereeuniqueid']][_0x7402('0x17')]=utils['now']();queues[_0x496504[_0x7402('0x44')]][_0x7402('0x34')]=0x0;queues[_0x496504[_0x7402('0x44')]][_0x7402('0x57')]=0x0;utils[_0x7402('0x2')](util[_0x7402('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x496504[_0x7402('0x4d')],queues[_0x496504[_0x7402('0x44')]][_0x7402('0x1f')],queues[_0x496504[_0x7402('0x44')]][_0x7402('0x7')],queues[_0x496504['transfereeuniqueid']]['calleridname']));}else{utils[_0x7402('0x2')](util[_0x7402('0x3')](_0x7402('0x58'),_0x496504['origtransfereruniqueid'],queues[_0x496504[_0x7402('0x4e')]][_0x7402('0x1f')],_0x496504[_0x7402('0x50')]));queues[_0x496504[_0x7402('0x4e')]][_0x7402('0xe')]=_0x496504[_0x7402('0x50')];}}}else if(_0x496504[_0x7402('0x59')]==_0x496504[_0x7402('0x50')]){if(!_[_0x7402('0x15')](queues[_0x496504[_0x7402('0x4e')]])){utils[_0x7402('0x2')](util[_0x7402('0x3')](_0x7402('0x5a'),_0x496504['origtransfereruniqueid'],queues[_0x496504[_0x7402('0x4e')]][_0x7402('0x1f')],_0x496504[_0x7402('0x59')],_0x496504[_0x7402('0x5b')]));queues[_0x496504[_0x7402('0x4e')]]['transfer']=!![];queues[_0x496504[_0x7402('0x4e')]][_0x7402('0x46')]=_0x7402('0x51');queues[_0x496504[_0x7402('0x4e')]][_0x7402('0x48')]=_0x496504[_0x7402('0x5b')];queues[_0x496504[_0x7402('0x4e')]][_0x7402('0x4a')]=_0x496504[_0x7402('0x59')];queues[_0x496504[_0x7402('0x4e')]][_0x7402('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x7402('0x15')](queues[_0x496504[_0x7402('0x50')]])){if(_0x496504['transfertargetlinkedid']&&queues[_0x496504[_0x7402('0x5c')]]){queues[_0x496504[_0x7402('0x5c')]]['queuecallerenterreason']=0x1;queues[_0x496504[_0x7402('0x54')]]=_[_0x7402('0x5d')](queues[_0x496504[_0x7402('0x5c')]]);queues[_0x496504[_0x7402('0x54')]][_0x7402('0xe')]=_0x496504[_0x7402('0x54')];queues[_0x496504[_0x7402('0x54')]][_0x7402('0x21')]=0x2;queues[_0x496504[_0x7402('0x54')]][_0x7402('0x7')]=queues[_0x496504[_0x7402('0x4e')]][_0x7402('0x7')];queues[_0x496504[_0x7402('0x54')]][_0x7402('0x55')]=queues[_0x496504[_0x7402('0x4e')]][_0x7402('0x55')];queues[_0x496504[_0x7402('0x54')]][_0x7402('0x56')]=utils[_0x7402('0x1c')]();queues[_0x496504[_0x7402('0x54')]][_0x7402('0x17')]=utils[_0x7402('0x1c')]();queues[_0x496504[_0x7402('0x54')]]['holdtime']=0x0;queues[_0x496504[_0x7402('0x54')]][_0x7402('0x57')]=0x0;utils[_0x7402('0x2')](util[_0x7402('0x3')](_0x7402('0x5e'),_0x496504['origtransfereruniqueid'],queues[_0x496504[_0x7402('0x54')]]['name'],queues[_0x496504[_0x7402('0x54')]][_0x7402('0xe')],queues[_0x496504[_0x7402('0x54')]]['calleridnum'],queues[_0x496504[_0x7402('0x54')]]['calleridname']));}else{utils['info'](util[_0x7402('0x3')](_0x7402('0x58'),_0x496504['origtransfereruniqueid'],queues[_0x496504[_0x7402('0x50')]][_0x7402('0x1f')],_0x496504[_0x7402('0x4e')]));queues[_0x496504[_0x7402('0x50')]][_0x7402('0xe')]=_0x496504[_0x7402('0x4e')];}}}}catch(_0xf1ed87){utils[_0x7402('0x22')](util[_0x7402('0x3')](_0x7402('0x4c'),_0x496504[_0x7402('0x4d')]),_0xf1ed87);}};exports[_0x7402('0x5f')]=function(_0x3db58e){try{if(!_[_0x7402('0x15')](queues[_0x3db58e[_0x7402('0x4')]])){utils['debug'](util[_0x7402('0x3')](_0x7402('0x60'),_0x3db58e[_0x7402('0x4')]),_0x3db58e);queues[_0x3db58e[_0x7402('0x4')]][_0x7402('0x61')]=utils['now']();utils['info'](util[_0x7402('0x3')](_0x7402('0x62'),_0x3db58e[_0x7402('0x4')],queues[_0x3db58e[_0x7402('0x4')]]['name'],queues[_0x3db58e[_0x7402('0x4')]]['musiconholdstartAt']));}}catch(_0x17a49a){utils[_0x7402('0x22')](util[_0x7402('0x3')](_0x7402('0x60'),_0x3db58e[_0x7402('0x4')]),_0x17a49a);}};exports[_0x7402('0x63')]=function(_0x5c1f81){try{if(!_['isNil'](queues[_0x5c1f81['uniqueid']])){if(!_[_0x7402('0x15')](queues[_0x5c1f81[_0x7402('0x4')]][_0x7402('0x61')])){utils[_0x7402('0x10')](util[_0x7402('0x3')](_0x7402('0x64'),_0x5c1f81[_0x7402('0x4')]),_0x5c1f81);queues[_0x5c1f81[_0x7402('0x4')]][_0x7402('0x57')]+=utils[_0x7402('0x65')](utils[_0x7402('0x1c')](),queues[_0x5c1f81['uniqueid']]['musiconholdstartAt']);utils[_0x7402('0x2')](util['format'](_0x7402('0x66'),_0x5c1f81[_0x7402('0x4')],queues[_0x5c1f81[_0x7402('0x4')]][_0x7402('0x1f')],queues[_0x5c1f81[_0x7402('0x4')]][_0x7402('0x57')]));delete queues[_0x5c1f81['uniqueid']][_0x7402('0x61')];}}}catch(_0xe9ec94){utils[_0x7402('0x22')](util['format'](_0x7402('0x64'),_0x5c1f81[_0x7402('0x4')]),_0xe9ec94);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 77b9b5a..ccb0a5e 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 _0x0cca=['forEach','clone','newexten','application','appdata','set','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','[%s][recordings][blindtransfer]','lodash','util','./utils','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','name','CreateVoiceRecording','request','newchannel','linkedid','info','context','exten','channel','error','[%s][recordings][newchannel]','newstate','debug','[%s][recordings][newstate]','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','isNil','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','find','monitors','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound'];(function(_0x208600,_0x7b7865){var _0x35849a=function(_0x2038a1){while(--_0x2038a1){_0x208600['push'](_0x208600['shift']());}};_0x35849a(++_0x7b7865);}(_0x0cca,0xe9));var _0xa0cc=function(_0xfbe06e,_0x2fb7ab){_0xfbe06e=_0xfbe06e-0x0;var _0x24e5b6=_0x0cca[_0xfbe06e];return _0x24e5b6;};'use strict';var _=require(_0xa0cc('0x0'));var util=require(_0xa0cc('0x1'));var utils=require(_0xa0cc('0x2'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x20ff30){var _0x5b008c;utils['info'](util[_0xa0cc('0x3')](_0xa0cc('0x4'),_0x20ff30[_0xa0cc('0x5')]));if(transfers[_0xa0cc('0x6')][_0x20ff30[_0xa0cc('0x5')]]){_0x5b008c=_0x20ff30[_0xa0cc('0x5')];_0x20ff30[_0xa0cc('0x5')]=transfers[_0xa0cc('0x6')][_0x20ff30['uniqueid']][_0xa0cc('0x7')];}if(_0x20ff30[_0xa0cc('0x8')]){utils[_0xa0cc('0x9')](_0x20ff30[_0xa0cc('0x8')])[_0xa0cc('0xa')](function(_0x358f30){if(_0x358f30){_0x20ff30['membername']=_0x358f30[_0xa0cc('0xb')];_0x20ff30['UserId']=_0x358f30['id'];}utils['request'](_0xa0cc('0xc'),_0x20ff30);});}else{utils[_0xa0cc('0xd')](_0xa0cc('0xc'),_0x20ff30);}if(_0x5b008c)delete transfers[_0xa0cc('0x6')][_0x5b008c];}exports[_0xa0cc('0xe')]=function(_0x3997cd){try{utils['debug'](util[_0xa0cc('0x3')]('[%s][recordings][newchannel]',_0x3997cd[_0xa0cc('0x5')]),_0x3997cd);if(_0x3997cd['uniqueid']==_0x3997cd[_0xa0cc('0xf')]){utils[_0xa0cc('0x10')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x3997cd[_0xa0cc('0x5')],_0x3997cd[_0xa0cc('0x11')],_0x3997cd[_0xa0cc('0x12')]));recordings[_0x3997cd[_0xa0cc('0x5')]]={'uniqueid':_0x3997cd[_0xa0cc('0x5')],'accountcode':_0x3997cd[_0xa0cc('0x8')],'exten':_0x3997cd['exten'],'context':_0x3997cd[_0xa0cc('0x11')],'channel':_0x3997cd[_0xa0cc('0x13')],'monitors':[]};}}catch(_0x5f57c0){utils[_0xa0cc('0x14')](util[_0xa0cc('0x3')](_0xa0cc('0x15'),_0x3997cd[_0xa0cc('0x5')]),_0x5f57c0);}};exports[_0xa0cc('0x16')]=function(_0x493431){try{utils[_0xa0cc('0x17')](util['format'](_0xa0cc('0x18'),_0x493431['uniqueid']),_0x493431);if(!_['isNil'](recordings[_0x493431[_0xa0cc('0x5')]])&&_0x493431[_0xa0cc('0x19')]==0x6){utils['info'](util[_0xa0cc('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x493431[_0xa0cc('0x5')],_0x493431[_0xa0cc('0x11')],_0x493431[_0xa0cc('0x13')]));}else if(!_['isNil'](recordings[_0x493431[_0xa0cc('0xf')]])&&_0x493431['channelstate']==0x6&&_0x493431[_0xa0cc('0x11')]!=_0xa0cc('0x1a')){utils[_0xa0cc('0x10')](util[_0xa0cc('0x3')](_0xa0cc('0x1b'),_0x493431[_0xa0cc('0x5')],_0x493431[_0xa0cc('0xf')],_0x493431[_0xa0cc('0x11')],_0x493431[_0xa0cc('0x13')]));recordings[_0x493431['linkedid']][_0xa0cc('0x8')]=_0x493431['accountcode'];}}catch(_0x2f94cf){utils[_0xa0cc('0x14')](util[_0xa0cc('0x3')](_0xa0cc('0x18'),_0x493431[_0xa0cc('0x5')]),_0x2f94cf);}};exports[_0xa0cc('0x1c')]=function(_0x2c01d5){try{if(!_[_0xa0cc('0x1d')](_0x2c01d5['variable'])&&!_[_0xa0cc('0x1d')](_0x2c01d5[_0xa0cc('0x1e')][_0xa0cc('0x1f')])){utils[_0xa0cc('0x17')](util[_0xa0cc('0x3')]('[%s][recordings][varset]',_0x2c01d5[_0xa0cc('0x5')]),_0x2c01d5);utils[_0xa0cc('0x10')](util[_0xa0cc('0x3')](_0xa0cc('0x20'),_0x2c01d5['uniqueid'],_0x2c01d5[_0xa0cc('0x1e')],_0x2c01d5['value']));if(_[_0xa0cc('0x21')](_0x2c01d5[_0xa0cc('0x22')],_0xa0cc('0x23'))){_0x2c01d5[_0xa0cc('0x22')]=_0x2c01d5[_0xa0cc('0x22')][_0xa0cc('0x24')](_0xa0cc('0x23'),_0xa0cc('0x25'));}if(recordings[_0x2c01d5['linkedid']]){var _0x3b8b76=_[_0xa0cc('0x26')](recordings[_0x2c01d5[_0xa0cc('0xf')]]['monitors'],{'value':_0x2c01d5[_0xa0cc('0x22')]});if(_['isNil'](_0x3b8b76)){recordings[_0x2c01d5[_0xa0cc('0xf')]][_0xa0cc('0x27')]['push']({'value':_0x2c01d5['value']});}}}}catch(_0x4cc598){utils[_0xa0cc('0x14')](util['format'](_0xa0cc('0x28'),_0x2c01d5[_0xa0cc('0x5')]),_0x4cc598);}};exports[_0xa0cc('0x29')]=function(_0x5398da){try{if(!_[_0xa0cc('0x1d')](recordings[_0x5398da[_0xa0cc('0x5')]])){utils[_0xa0cc('0x17')](util['format'](_0xa0cc('0x2a'),_0x5398da[_0xa0cc('0x5')]),_0x5398da);utils[_0xa0cc('0x10')](util[_0xa0cc('0x3')](_0xa0cc('0x2b'),_0x5398da[_0xa0cc('0x5')],_0x5398da[_0xa0cc('0x2c')],_0x5398da['calleridname'],_0x5398da[_0xa0cc('0x2d')]));recordings[_0x5398da['uniqueid']][_0xa0cc('0x2c')]=_0x5398da[_0xa0cc('0x2c')];recordings[_0x5398da['uniqueid']][_0xa0cc('0x2e')]=_0x5398da[_0xa0cc('0x2e')];recordings[_0x5398da['uniqueid']]['connectedlinenum']=_0x5398da[_0xa0cc('0x2f')];recordings[_0x5398da[_0xa0cc('0x5')]][_0xa0cc('0x30')]=_0x5398da[_0xa0cc('0x30')];if(recordings[_0x5398da[_0xa0cc('0x5')]][_0xa0cc('0x31')]==_0xa0cc('0x32')&&recordings[_0x5398da[_0xa0cc('0x5')]][_0xa0cc('0x8')]){recordings[_0x5398da['uniqueid']]['connectedlinenum']=recordings[_0x5398da[_0xa0cc('0x5')]][_0xa0cc('0x8')];recordings[_0x5398da[_0xa0cc('0x5')]][_0xa0cc('0x30')]='';}recordings[_0x5398da[_0xa0cc('0x5')]][_0xa0cc('0x27')][_0xa0cc('0x33')](function(_0x66293b){var _0xa2e923=_[_0xa0cc('0x34')](recordings[_0x5398da['uniqueid']]);_0xa2e923[_0xa0cc('0x22')]=_0x66293b[_0xa0cc('0x22')];writeDB(_0xa2e923);});delete recordings[_0x5398da['uniqueid']];}}catch(_0x4a285d){utils[_0xa0cc('0x14')](util[_0xa0cc('0x3')]('[%s][recordings][hangup]',_0x5398da['uniqueid']),_0x4a285d);}};exports[_0xa0cc('0x35')]=function(_0xbbc858){try{if(!_['isNil'](recordings[_0xbbc858[_0xa0cc('0x5')]])){utils[_0xa0cc('0x17')](util['format']('[%s][recordings][newexten]',_0xbbc858[_0xa0cc('0x5')]),_0xbbc858);utils['info'](util[_0xa0cc('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0xbbc858[_0xa0cc('0x5')],_0xbbc858[_0xa0cc('0x36')],_0xbbc858[_0xa0cc('0x37')]));if(_0xbbc858['application']['toLowerCase']()==_0xa0cc('0x38')&&_['startsWith'](_0xbbc858[_0xa0cc('0x37')]['toLowerCase'](),'cdr')){var _0x19de7d=_0xbbc858[_0xa0cc('0x37')][_0xa0cc('0x39')]('=');var _0x415c18=_0x19de7d[0x0][_0xa0cc('0x3a')](_0x19de7d[0x0][_0xa0cc('0x3b')]('(')+0x1,_0x19de7d[0x0][_0xa0cc('0x3b')](')'));var _0x1bee52=_0x19de7d[0x1];recordings[_0xbbc858[_0xa0cc('0x5')]][_0x415c18]=_0x1bee52;}}}catch(_0x102132){utils[_0xa0cc('0x14')](util[_0xa0cc('0x3')](_0xa0cc('0x3c'),_0xbbc858[_0xa0cc('0x5')]),_0x102132);}};exports[_0xa0cc('0x3d')]=function(_0x56a5bc){try{if(!_[_0xa0cc('0x1d')](recordings[_0x56a5bc[_0xa0cc('0x5')]])){utils['debug'](util['format'](_0xa0cc('0x3e'),_0x56a5bc['uniqueid']),_0x56a5bc);utils['info'](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x56a5bc['uniqueid'],_0x56a5bc[_0xa0cc('0x3f')]));recordings[_0x56a5bc[_0xa0cc('0x5')]]['queue']=_0x56a5bc['queue'];}}catch(_0x140ed7){utils[_0xa0cc('0x14')](util[_0xa0cc('0x3')](_0xa0cc('0x3e'),_0x56a5bc[_0xa0cc('0x5')]),_0x140ed7);}};exports[_0xa0cc('0x40')]=function(_0x2fb21a){try{utils[_0xa0cc('0x17')](util['format']('[%s][recordings][blindtransfer]',_0x2fb21a[_0xa0cc('0x5')]),_0x2fb21a);utils[_0xa0cc('0x10')](util[_0xa0cc('0x3')](_0xa0cc('0x41'),_0x2fb21a[_0xa0cc('0x5')],_0x2fb21a[_0xa0cc('0x42')],_0x2fb21a[_0xa0cc('0x43')],_0x2fb21a['transfereecalleridnum'],_0x2fb21a[_0xa0cc('0x44')]));if(recordings[_0x2fb21a[_0xa0cc('0x45')]]&&transfers[_0xa0cc('0x6')][_0x2fb21a[_0xa0cc('0x45')]]){transfers['blinds'][_0x2fb21a[_0xa0cc('0x45')]]['recording']=!![];}}catch(_0x306c83){utils[_0xa0cc('0x14')](util[_0xa0cc('0x3')](_0xa0cc('0x46'),_0x2fb21a[_0xa0cc('0x5')]),_0x306c83);}}; \ No newline at end of file +var _0xe8b7=['lodash','util','./utils','./transfers.controller','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','.wav49','value','replace','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid'];(function(_0x3b9e84,_0x3ed845){var _0xe34408=function(_0x160f37){while(--_0x160f37){_0x3b9e84['push'](_0x3b9e84['shift']());}};_0xe34408(++_0x3ed845);}(_0xe8b7,0x8c));var _0x7e8b=function(_0x4fc118,_0xc9b243){_0x4fc118=_0x4fc118-0x0;var _0x194492=_0xe8b7[_0x4fc118];return _0x194492;};'use strict';var _=require(_0x7e8b('0x0'));var util=require(_0x7e8b('0x1'));var utils=require(_0x7e8b('0x2'));var transfers=require(_0x7e8b('0x3'));var recordings={};function writeDB(_0x4be8bb){var _0x524f54;utils[_0x7e8b('0x4')](util[_0x7e8b('0x5')]('[%s][recordings][writeDB]',_0x4be8bb[_0x7e8b('0x6')]));if(transfers[_0x7e8b('0x7')][_0x4be8bb[_0x7e8b('0x6')]]){_0x524f54=_0x4be8bb[_0x7e8b('0x6')];_0x4be8bb['uniqueid']=transfers[_0x7e8b('0x7')][_0x4be8bb[_0x7e8b('0x6')]][_0x7e8b('0x8')];}if(_0x4be8bb[_0x7e8b('0x9')]){utils['getUserByInternal'](_0x4be8bb[_0x7e8b('0x9')])[_0x7e8b('0xa')](function(_0x5ee84c){if(_0x5ee84c){_0x4be8bb[_0x7e8b('0xb')]=_0x5ee84c[_0x7e8b('0xc')];_0x4be8bb[_0x7e8b('0xd')]=_0x5ee84c['id'];}utils[_0x7e8b('0xe')]('CreateVoiceRecording',_0x4be8bb);});}else{utils[_0x7e8b('0xe')](_0x7e8b('0xf'),_0x4be8bb);}if(_0x524f54)delete transfers[_0x7e8b('0x7')][_0x524f54];}exports['newchannel']=function(_0x49d4ac){try{utils[_0x7e8b('0x10')](util['format'](_0x7e8b('0x11'),_0x49d4ac[_0x7e8b('0x6')]),_0x49d4ac);if(_0x49d4ac[_0x7e8b('0x6')]==_0x49d4ac['linkedid']){utils['info'](util[_0x7e8b('0x5')](_0x7e8b('0x12'),_0x49d4ac[_0x7e8b('0x6')],_0x49d4ac[_0x7e8b('0x13')],_0x49d4ac['exten']));recordings[_0x49d4ac[_0x7e8b('0x6')]]={'uniqueid':_0x49d4ac['uniqueid'],'accountcode':_0x49d4ac[_0x7e8b('0x9')],'exten':_0x49d4ac[_0x7e8b('0x14')],'context':_0x49d4ac[_0x7e8b('0x13')],'channel':_0x49d4ac[_0x7e8b('0x15')],'monitors':[]};}}catch(_0x324b4e){utils[_0x7e8b('0x16')](util['format'](_0x7e8b('0x11'),_0x49d4ac[_0x7e8b('0x6')]),_0x324b4e);}};exports[_0x7e8b('0x17')]=function(_0x337d95){try{utils['debug'](util[_0x7e8b('0x5')](_0x7e8b('0x18'),_0x337d95[_0x7e8b('0x6')]),_0x337d95);if(!_[_0x7e8b('0x19')](recordings[_0x337d95[_0x7e8b('0x6')]])&&_0x337d95[_0x7e8b('0x1a')]==0x6){utils['info'](util[_0x7e8b('0x5')](_0x7e8b('0x1b'),_0x337d95[_0x7e8b('0x6')],_0x337d95[_0x7e8b('0x13')],_0x337d95[_0x7e8b('0x15')]));}else if(!_[_0x7e8b('0x19')](recordings[_0x337d95[_0x7e8b('0x1c')]])&&_0x337d95[_0x7e8b('0x1a')]==0x6&&_0x337d95['context']!='transfer'){utils['info'](util[_0x7e8b('0x5')](_0x7e8b('0x1d'),_0x337d95[_0x7e8b('0x6')],_0x337d95['linkedid'],_0x337d95[_0x7e8b('0x13')],_0x337d95[_0x7e8b('0x15')]));recordings[_0x337d95[_0x7e8b('0x1c')]][_0x7e8b('0x9')]=_0x337d95['accountcode'];}}catch(_0x2c0938){utils[_0x7e8b('0x16')](util['format'](_0x7e8b('0x18'),_0x337d95[_0x7e8b('0x6')]),_0x2c0938);}};exports[_0x7e8b('0x1e')]=function(_0x34d950){try{if(!_[_0x7e8b('0x19')](_0x34d950[_0x7e8b('0x1f')])&&!_['isNil'](_0x34d950['variable'][_0x7e8b('0x20')])){utils['debug'](util['format']('[%s][recordings][varset]',_0x34d950[_0x7e8b('0x6')]),_0x34d950);utils['info'](util[_0x7e8b('0x5')](_0x7e8b('0x21'),_0x34d950['uniqueid'],_0x34d950[_0x7e8b('0x1f')],_0x34d950['value']));if(_['endsWith'](_0x34d950['value'],_0x7e8b('0x22'))){_0x34d950[_0x7e8b('0x23')]=_0x34d950[_0x7e8b('0x23')][_0x7e8b('0x24')](_0x7e8b('0x22'),_0x7e8b('0x25'));}if(recordings[_0x34d950[_0x7e8b('0x1c')]]){var _0x5d1a52=_[_0x7e8b('0x26')](recordings[_0x34d950[_0x7e8b('0x1c')]]['monitors'],{'value':_0x34d950['value']});if(_[_0x7e8b('0x19')](_0x5d1a52)){recordings[_0x34d950[_0x7e8b('0x1c')]][_0x7e8b('0x27')][_0x7e8b('0x28')]({'value':_0x34d950['value']});}}}}catch(_0xa2b24b){utils[_0x7e8b('0x16')](util[_0x7e8b('0x5')](_0x7e8b('0x29'),_0x34d950['uniqueid']),_0xa2b24b);}};exports[_0x7e8b('0x2a')]=function(_0x5a817f){try{if(!_[_0x7e8b('0x19')](recordings[_0x5a817f[_0x7e8b('0x6')]])){utils[_0x7e8b('0x10')](util['format'](_0x7e8b('0x2b'),_0x5a817f[_0x7e8b('0x6')]),_0x5a817f);utils[_0x7e8b('0x4')](util[_0x7e8b('0x5')](_0x7e8b('0x2c'),_0x5a817f[_0x7e8b('0x6')],_0x5a817f['calleridnum'],_0x5a817f['calleridname'],_0x5a817f['cause-txt']));recordings[_0x5a817f[_0x7e8b('0x6')]]['calleridnum']=_0x5a817f[_0x7e8b('0x2d')];recordings[_0x5a817f[_0x7e8b('0x6')]][_0x7e8b('0x2e')]=_0x5a817f[_0x7e8b('0x2e')];recordings[_0x5a817f[_0x7e8b('0x6')]][_0x7e8b('0x2f')]=_0x5a817f[_0x7e8b('0x2f')];recordings[_0x5a817f[_0x7e8b('0x6')]][_0x7e8b('0x30')]=_0x5a817f[_0x7e8b('0x30')];if(recordings[_0x5a817f[_0x7e8b('0x6')]][_0x7e8b('0x31')]==_0x7e8b('0x32')&&recordings[_0x5a817f[_0x7e8b('0x6')]][_0x7e8b('0x9')]){recordings[_0x5a817f[_0x7e8b('0x6')]]['connectedlinenum']=recordings[_0x5a817f[_0x7e8b('0x6')]][_0x7e8b('0x9')];recordings[_0x5a817f[_0x7e8b('0x6')]][_0x7e8b('0x30')]='';}recordings[_0x5a817f[_0x7e8b('0x6')]][_0x7e8b('0x27')]['forEach'](function(_0x217338){var _0x3f62a4=_['clone'](recordings[_0x5a817f[_0x7e8b('0x6')]]);_0x3f62a4[_0x7e8b('0x23')]=_0x217338[_0x7e8b('0x23')];writeDB(_0x3f62a4);});delete recordings[_0x5a817f[_0x7e8b('0x6')]];}}catch(_0x431a61){utils[_0x7e8b('0x16')](util[_0x7e8b('0x5')](_0x7e8b('0x2b'),_0x5a817f[_0x7e8b('0x6')]),_0x431a61);}};exports[_0x7e8b('0x33')]=function(_0x2f061a){try{if(!_['isNil'](recordings[_0x2f061a[_0x7e8b('0x6')]])){utils['debug'](util[_0x7e8b('0x5')](_0x7e8b('0x34'),_0x2f061a[_0x7e8b('0x6')]),_0x2f061a);utils[_0x7e8b('0x4')](util[_0x7e8b('0x5')](_0x7e8b('0x35'),_0x2f061a[_0x7e8b('0x6')],_0x2f061a['application'],_0x2f061a[_0x7e8b('0x36')]));if(_0x2f061a[_0x7e8b('0x37')][_0x7e8b('0x38')]()==_0x7e8b('0x39')&&_['startsWith'](_0x2f061a[_0x7e8b('0x36')][_0x7e8b('0x38')](),'cdr')){var _0x13a6ad=_0x2f061a[_0x7e8b('0x36')]['split']('=');var _0x26386d=_0x13a6ad[0x0][_0x7e8b('0x3a')](_0x13a6ad[0x0]['lastIndexOf']('(')+0x1,_0x13a6ad[0x0][_0x7e8b('0x3b')](')'));var _0x5a13fe=_0x13a6ad[0x1];recordings[_0x2f061a[_0x7e8b('0x6')]][_0x26386d]=_0x5a13fe;}}}catch(_0xe3ef1d){utils['error'](util[_0x7e8b('0x5')]('[%s][recordings][newexten]',_0x2f061a[_0x7e8b('0x6')]),_0xe3ef1d);}};exports[_0x7e8b('0x3c')]=function(_0x1d29bd){try{if(!_[_0x7e8b('0x19')](recordings[_0x1d29bd[_0x7e8b('0x6')]])){utils[_0x7e8b('0x10')](util[_0x7e8b('0x5')](_0x7e8b('0x3d'),_0x1d29bd[_0x7e8b('0x6')]),_0x1d29bd);utils[_0x7e8b('0x4')](util[_0x7e8b('0x5')](_0x7e8b('0x3e'),_0x1d29bd[_0x7e8b('0x6')],_0x1d29bd[_0x7e8b('0x3f')]));recordings[_0x1d29bd[_0x7e8b('0x6')]][_0x7e8b('0x3f')]=_0x1d29bd[_0x7e8b('0x3f')];}}catch(_0x45d953){utils[_0x7e8b('0x16')](util[_0x7e8b('0x5')]('[%s][recordings][queuecallerjoin]',_0x1d29bd['uniqueid']),_0x45d953);}};exports[_0x7e8b('0x40')]=function(_0x3f99bd){try{utils['debug'](util[_0x7e8b('0x5')](_0x7e8b('0x41'),_0x3f99bd[_0x7e8b('0x6')]),_0x3f99bd);utils[_0x7e8b('0x4')](util[_0x7e8b('0x5')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3f99bd[_0x7e8b('0x6')],_0x3f99bd['transferercalleridnum'],_0x3f99bd[_0x7e8b('0x42')],_0x3f99bd[_0x7e8b('0x43')],_0x3f99bd[_0x7e8b('0x44')]));if(recordings[_0x3f99bd[_0x7e8b('0x45')]]&&transfers['blinds'][_0x3f99bd[_0x7e8b('0x45')]]){transfers['blinds'][_0x3f99bd[_0x7e8b('0x45')]]['recording']=!![];}}catch(_0x497bf4){utils['error'](util[_0x7e8b('0x5')](_0x7e8b('0x41'),_0x3f99bd['uniqueid']),_0x497bf4);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 9b65649..c5f0054 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 _0xfea1=['./utils','info','format','type','attended','origtransfereruniqueid','uniqueid','request','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','origtransferercalleridnum','transfertargetcalleridnum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util'];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0xfea1,0x195));var _0x1fea=function(_0x249565,_0x2a026a){_0x249565=_0x249565-0x0;var _0x43dee8=_0xfea1[_0x249565];return _0x43dee8;};'use strict';var _=require(_0x1fea('0x0'));var util=require(_0x1fea('0x1'));var utils=require(_0x1fea('0x2'));function writeDB(_0x91ecfc){utils[_0x1fea('0x3')](util[_0x1fea('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x91ecfc[_0x1fea('0x5')]===_0x1fea('0x6')?_0x91ecfc[_0x1fea('0x7')]:_0x91ecfc[_0x1fea('0x8')],_0x91ecfc[_0x1fea('0x5')]));utils[_0x1fea('0x9')]('CreateVoiceTransferReport',_0x91ecfc);}exports[_0x1fea('0xa')]={};exports[_0x1fea('0xb')]=function(_0x49c919){try{utils[_0x1fea('0xc')](util[_0x1fea('0x4')](_0x1fea('0xd'),_0x49c919['uniqueid']),_0x49c919);utils[_0x1fea('0x3')](util[_0x1fea('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x49c919[_0x1fea('0x8')],_0x49c919['transferercalleridnum'],_0x49c919[_0x1fea('0xe')],_0x49c919['transfereecalleridnum'],_0x49c919[_0x1fea('0xf')]));_0x49c919['type']=_0x1fea('0x10');exports[_0x1fea('0xa')][_0x49c919[_0x1fea('0x11')]]=_0x49c919;writeDB(_0x49c919);}catch(_0x7ec348){utils[_0x1fea('0x12')](util['format'](_0x1fea('0xd'),_0x49c919['uniqueid']),_0x7ec348);}};exports[_0x1fea('0x13')]=function(_0x44aae6){try{utils[_0x1fea('0xc')](util[_0x1fea('0x4')]('[%s][transfers][attendedtransfer]',_0x44aae6[_0x1fea('0x7')]),_0x44aae6);utils[_0x1fea('0x3')](util[_0x1fea('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x44aae6[_0x1fea('0x7')],_0x44aae6[_0x1fea('0x14')],_0x44aae6['origtransferercalleridname'],_0x44aae6[_0x1fea('0x15')],_0x44aae6['transfertargetcalleridname']));_0x44aae6=_['assign'](_0x44aae6,{'transfererchannel':_0x44aae6['origtransfererchannel'],'transferercalleridnum':_0x44aae6[_0x1fea('0x14')],'transferercalleridname':_0x44aae6['origtransferercalleridname'],'transfererconnectedlinenum':_0x44aae6['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x44aae6[_0x1fea('0x16')],'transfereraccountcode':_0x44aae6['origtransfereraccountcode'],'transferercontext':_0x44aae6[_0x1fea('0x17')],'transfererexten':_0x44aae6[_0x1fea('0x18')],'transfererlinkedid':_0x44aae6['origtransfererlinkedid'],'context':_0x44aae6[_0x1fea('0x19')],'extension':_0x44aae6[_0x1fea('0x1a')],'type':_0x1fea('0x6')});if(_[_0x1fea('0x1b')](_0x44aae6[_0x1fea('0x1c')])){_0x44aae6=_['assign'](_0x44aae6,{'transfereechannel':_0x44aae6[_0x1fea('0x1d')],'transfereecalleridnum':_0x44aae6[_0x1fea('0x15')],'transfereecalleridname':_0x44aae6[_0x1fea('0x1e')],'transfereeconnectedlinenum':_0x44aae6[_0x1fea('0x1f')],'transfereeconnectedlinename':_0x44aae6[_0x1fea('0x20')],'transfereeaccountcode':_0x44aae6[_0x1fea('0x21')],'transfereecontext':_0x44aae6[_0x1fea('0x22')],'transfereeexten':_0x44aae6[_0x1fea('0x23')],'transfereelinkedid':_0x44aae6[_0x1fea('0x24')]});}writeDB(_0x44aae6);}catch(_0x4310ae){utils[_0x1fea('0x12')](util['format']('[%s][transfers][attendedtransfer]',_0x44aae6['origtransfereruniqueid']),_0x4310ae);}}; \ No newline at end of file +var _0x74f4=['origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum'];(function(_0x3a8cb6,_0x589bfe){var _0x3527ed=function(_0x32d7ef){while(--_0x32d7ef){_0x3a8cb6['push'](_0x3a8cb6['shift']());}};_0x3527ed(++_0x589bfe);}(_0x74f4,0x1a1));var _0x474f=function(_0x528941,_0x2f50ed){_0x528941=_0x528941-0x0;var _0xbfd8f9=_0x74f4[_0x528941];return _0xbfd8f9;};'use strict';var _=require('lodash');var util=require(_0x474f('0x0'));var utils=require(_0x474f('0x1'));function writeDB(_0x512df7){utils[_0x474f('0x2')](util[_0x474f('0x3')](_0x474f('0x4'),_0x512df7[_0x474f('0x5')]===_0x474f('0x6')?_0x512df7[_0x474f('0x7')]:_0x512df7['uniqueid'],_0x512df7[_0x474f('0x5')]));utils['request'](_0x474f('0x8'),_0x512df7);}exports[_0x474f('0x9')]={};exports[_0x474f('0xa')]=function(_0x329e60){try{utils[_0x474f('0xb')](util['format'](_0x474f('0xc'),_0x329e60[_0x474f('0xd')]),_0x329e60);utils[_0x474f('0x2')](util[_0x474f('0x3')](_0x474f('0xe'),_0x329e60['uniqueid'],_0x329e60['transferercalleridnum'],_0x329e60[_0x474f('0xf')],_0x329e60['transfereecalleridnum'],_0x329e60[_0x474f('0x10')]));_0x329e60[_0x474f('0x5')]='blind';exports['blinds'][_0x329e60[_0x474f('0x11')]]=_0x329e60;writeDB(_0x329e60);}catch(_0x5a1a5f){utils[_0x474f('0x12')](util[_0x474f('0x3')]('[%s][transfers][blindtransfer]',_0x329e60[_0x474f('0xd')]),_0x5a1a5f);}};exports[_0x474f('0x13')]=function(_0x562bfc){try{utils[_0x474f('0xb')](util[_0x474f('0x3')](_0x474f('0x14'),_0x562bfc[_0x474f('0x7')]),_0x562bfc);utils['info'](util[_0x474f('0x3')](_0x474f('0x15'),_0x562bfc['origtransfereruniqueid'],_0x562bfc[_0x474f('0x16')],_0x562bfc[_0x474f('0x17')],_0x562bfc[_0x474f('0x18')],_0x562bfc[_0x474f('0x19')]));_0x562bfc=_['assign'](_0x562bfc,{'transfererchannel':_0x562bfc['origtransfererchannel'],'transferercalleridnum':_0x562bfc[_0x474f('0x16')],'transferercalleridname':_0x562bfc[_0x474f('0x17')],'transfererconnectedlinenum':_0x562bfc[_0x474f('0x1a')],'transfererconnectedlinename':_0x562bfc[_0x474f('0x1b')],'transfereraccountcode':_0x562bfc[_0x474f('0x1c')],'transferercontext':_0x562bfc[_0x474f('0x1d')],'transfererexten':_0x562bfc[_0x474f('0x1e')],'transfererlinkedid':_0x562bfc[_0x474f('0x1f')],'context':_0x562bfc[_0x474f('0x20')],'extension':_0x562bfc['origtransfererexten'],'type':_0x474f('0x6')});if(_[_0x474f('0x21')](_0x562bfc[_0x474f('0x22')])){_0x562bfc=_[_0x474f('0x23')](_0x562bfc,{'transfereechannel':_0x562bfc[_0x474f('0x24')],'transfereecalleridnum':_0x562bfc['transfertargetcalleridnum'],'transfereecalleridname':_0x562bfc[_0x474f('0x19')],'transfereeconnectedlinenum':_0x562bfc[_0x474f('0x25')],'transfereeconnectedlinename':_0x562bfc['transfertargetconnectedlinename'],'transfereeaccountcode':_0x562bfc[_0x474f('0x26')],'transfereecontext':_0x562bfc['transfertargetcontext'],'transfereeexten':_0x562bfc[_0x474f('0x27')],'transfereelinkedid':_0x562bfc['transfertargetlinkedid']});}writeDB(_0x562bfc);}catch(_0x58d298){utils[_0x474f('0x12')](util[_0x474f('0x3')](_0x474f('0x14'),_0x562bfc[_0x474f('0x7')]),_0x58d298);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 90c4481..a6f76fc 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 _0xcb18=['YYYY-MM-DD\x20HH:mm:ss','diffTime','sumTime','isAfter','isBefore','bluebird','moment','util','http','../../config/logger','xdr','info','debug','inspect','error','request','[utils][request]\x20name:%s','catch','GetUser','name','then','[utils][getUser]\x20where:%s','result','length','getUserByInternal','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','format','subtractTime'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xcb18,0x191));var _0x8cb1=function(_0x599c5f,_0x5d2efe){_0x599c5f=_0x599c5f-0x0;var _0x57655c=_0xcb18[_0x599c5f];return _0x57655c;};'use strict';var BPromise=require(_0x8cb1('0x0'));var jayson=require('jayson/promise');var moment=require(_0x8cb1('0x1'));var util=require(_0x8cb1('0x2'));var client=jayson['client'][_0x8cb1('0x3')]({'port':0x2329});var logger=require(_0x8cb1('0x4'))(_0x8cb1('0x5'));exports['info']=function(_0x287d3d,_0x129492){logger[_0x8cb1('0x6')](_0x287d3d,_0x129492?util['inspect'](_0x129492,{'showHidden':![],'depth':null}):'');};exports[_0x8cb1('0x7')]=function(_0x28b3c6,_0x54cd88){logger[_0x8cb1('0x7')](_0x28b3c6,_0x54cd88?util[_0x8cb1('0x8')](_0x54cd88,{'showHidden':![],'depth':null}):'');};exports[_0x8cb1('0x9')]=function(_0x41d537,_0x4de152){logger[_0x8cb1('0x9')](_0x41d537,_0x4de152?util[_0x8cb1('0x8')](_0x4de152,{'showHidden':![],'depth':null}):'');};exports[_0x8cb1('0xa')]=function(_0xdb7269,_0x6ce265){return client[_0x8cb1('0xa')](_0xdb7269,{'body':_0x6ce265})['then'](function(_0x54c3ae){logger[_0x8cb1('0x7')](_0x8cb1('0xb'),_0xdb7269,_0x54c3ae?util['inspect'](_0x54c3ae,{'showHidden':![],'depth':null}):'');})[_0x8cb1('0xc')](function(_0x40b28d){logger['error'](_0x8cb1('0xb'),_0xdb7269,_0x40b28d?util[_0x8cb1('0x8')](_0x40b28d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1a1a20){return client[_0x8cb1('0xa')](_0x8cb1('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0x8cb1('0xe'),'interface'],'where':_0x1a1a20,'limit':0x1}})[_0x8cb1('0xf')](function(_0x127c97){logger[_0x8cb1('0x7')](_0x8cb1('0x10'),JSON['stringify'](_0x1a1a20),_0x127c97?util[_0x8cb1('0x8')](_0x127c97,{'showHidden':![],'depth':null}):'');return _0x127c97[_0x8cb1('0x11')][_0x8cb1('0x12')]?_0x127c97['result'][0x0]:null;});}exports[_0x8cb1('0x13')]=function(_0x58c8aa){return new BPromise(function(_0x40c8d5,_0x197a49){if(_0x58c8aa){return getUser({'internal':_0x58c8aa})[_0x8cb1('0xf')](function(_0x4f0a28){logger[_0x8cb1('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x58c8aa,_0x4f0a28?'found':_0x8cb1('0x14'));return _0x40c8d5(_0x4f0a28);})[_0x8cb1('0xc')](function(_0x2eb299){logger[_0x8cb1('0x9')](_0x8cb1('0x15'),_0x2eb299?util[_0x8cb1('0x8')](_0x2eb299,{'showHidden':![],'depth':null}):'');return _0x40c8d5(null);});}return _0x40c8d5(null);});};exports['getUserByInterface']=function(_0x4857a8){return new BPromise(function(_0x55ecd9,_0x2e8a67){if(_0x4857a8){return getUser({'interface':_0x4857a8})[_0x8cb1('0xf')](function(_0x471170){logger[_0x8cb1('0x6')](_0x8cb1('0x16'),_0x4857a8,_0x471170?_0x8cb1('0x17'):'notfound');return _0x55ecd9(_0x471170);})[_0x8cb1('0xc')](function(_0xbbe189){logger[_0x8cb1('0x9')](_0x8cb1('0x18'),_0xbbe189?util[_0x8cb1('0x8')](_0xbbe189,{'showHidden':![],'depth':null}):'');return _0x55ecd9(null);});}return _0x55ecd9(null);});};exports[_0x8cb1('0x19')]=function(_0x3df415){return new BPromise(function(_0x5c5b92,_0x2bedd4){if(_0x3df415){return getUser({'name':_0x3df415})[_0x8cb1('0xf')](function(_0x2c95dc){logger[_0x8cb1('0x6')](_0x8cb1('0x1a'),_0x3df415,_0x2c95dc?_0x8cb1('0x17'):_0x8cb1('0x14'));return _0x5c5b92(_0x2c95dc);})[_0x8cb1('0xc')](function(_0x4081f3){logger[_0x8cb1('0x9')](_0x8cb1('0x1b'),_0x4081f3?util['inspect'](_0x4081f3,{'showHidden':![],'depth':null}):'');return _0x5c5b92(null);});}return _0x5c5b92(null);});};exports['getVoiceQueueByName']=function(_0x474a94){return new BPromise(function(_0x5245f2,_0x19b94d){if(_0x474a94){return client[_0x8cb1('0xa')](_0x8cb1('0x1c'),{'options':{'raw':!![],'attributes':['id',_0x8cb1('0xe'),_0x8cb1('0x1d'),_0x8cb1('0x1e'),_0x8cb1('0x1f')],'where':{'name':_0x474a94},'limit':0x1}})['then'](function(_0xa1f52a){logger[_0x8cb1('0x7')](_0x8cb1('0x20'),_0x474a94,_0xa1f52a?util[_0x8cb1('0x8')](_0xa1f52a,{'showHidden':![],'depth':null}):'');logger['info'](_0x8cb1('0x21'),_0x474a94,_0xa1f52a?_0x8cb1('0x17'):_0x8cb1('0x14'));return _0x5245f2(_0xa1f52a[_0x8cb1('0x11')][_0x8cb1('0x12')]?_0xa1f52a[_0x8cb1('0x11')][0x0]:null);})[_0x8cb1('0xc')](function(_0x155a76){logger[_0x8cb1('0x9')](_0x8cb1('0x22'),_0x155a76?util[_0x8cb1('0x8')](_0x155a76,{'showHidden':![],'depth':null}):'');return _0x5245f2(null);});}return _0x5245f2(null);});};exports['addTime']=function(_0x2e30b5,_0x3d5821){return moment(_0x2e30b5)[_0x8cb1('0x23')](_0x3d5821,_0x8cb1('0x24'))[_0x8cb1('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x8cb1('0x26')]=function(_0x5704d2,_0x1d6b88){return moment(_0x5704d2)['subtract'](_0x1d6b88,_0x8cb1('0x24'))['format'](_0x8cb1('0x27'));};exports[_0x8cb1('0x28')]=function(_0x22752a,_0x1ff313){return moment(_0x22752a)['diff'](moment(_0x1ff313),_0x8cb1('0x24'));};exports[_0x8cb1('0x29')]=function(_0x1f9ba0,_0x19b8fc){return parseInt(_0x1f9ba0,0xa)+parseInt(_0x19b8fc,0xa);};exports['now']=function(){return moment()[_0x8cb1('0x25')](_0x8cb1('0x27'));};exports['isAfter']=function(_0x34e459,_0xcdbd4){if(_0xcdbd4){return moment(_0x34e459)[_0x8cb1('0x2a')](_0xcdbd4);}return!![];};exports[_0x8cb1('0x2b')]=function(_0x5cd2d5,_0x50985a){if(_0x50985a){return moment(_0x5cd2d5)['isBefore'](_0x50985a);}else if(_0x5cd2d5){return!![];}return![];}; \ No newline at end of file +var _0xc132=['moment','http','../../config/logger','info','inspect','error','request','debug','[utils][request]\x20name:%s','catch','GetUser','internal','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise'];(function(_0x2b4cc1,_0x37baae){var _0x32b5b5=function(_0x2c909b){while(--_0x2c909b){_0x2b4cc1['push'](_0x2b4cc1['shift']());}};_0x32b5b5(++_0x37baae);}(_0xc132,0x11e));var _0x2c13=function(_0x30d438,_0x3382ff){_0x30d438=_0x30d438-0x0;var _0x313278=_0xc132[_0x30d438];return _0x313278;};'use strict';var BPromise=require(_0x2c13('0x0'));var jayson=require(_0x2c13('0x1'));var moment=require(_0x2c13('0x2'));var util=require('util');var client=jayson['client'][_0x2c13('0x3')]({'port':0x2329});var logger=require(_0x2c13('0x4'))('xdr');exports[_0x2c13('0x5')]=function(_0x58125a,_0x22d73e){logger[_0x2c13('0x5')](_0x58125a,_0x22d73e?util[_0x2c13('0x6')](_0x22d73e,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x41581e,_0x3bc603){logger['debug'](_0x41581e,_0x3bc603?util['inspect'](_0x3bc603,{'showHidden':![],'depth':null}):'');};exports[_0x2c13('0x7')]=function(_0x668941,_0x3733c5){logger[_0x2c13('0x7')](_0x668941,_0x3733c5?util[_0x2c13('0x6')](_0x3733c5,{'showHidden':![],'depth':null}):'');};exports[_0x2c13('0x8')]=function(_0xefebe4,_0xd7fef6){return client[_0x2c13('0x8')](_0xefebe4,{'body':_0xd7fef6})['then'](function(_0x4d3703){logger[_0x2c13('0x9')](_0x2c13('0xa'),_0xefebe4,_0x4d3703?util[_0x2c13('0x6')](_0x4d3703,{'showHidden':![],'depth':null}):'');})[_0x2c13('0xb')](function(_0x209403){logger[_0x2c13('0x7')]('[utils][request]\x20name:%s',_0xefebe4,_0x209403?util[_0x2c13('0x6')](_0x209403,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4e4497){return client[_0x2c13('0x8')](_0x2c13('0xc'),{'options':{'raw':!![],'attributes':['id',_0x2c13('0xd'),'name',_0x2c13('0xe')],'where':_0x4e4497,'limit':0x1}})[_0x2c13('0xf')](function(_0x4d584d){logger[_0x2c13('0x9')](_0x2c13('0x10'),JSON[_0x2c13('0x11')](_0x4e4497),_0x4d584d?util[_0x2c13('0x6')](_0x4d584d,{'showHidden':![],'depth':null}):'');return _0x4d584d[_0x2c13('0x12')][_0x2c13('0x13')]?_0x4d584d[_0x2c13('0x12')][0x0]:null;});}exports[_0x2c13('0x14')]=function(_0x1569c5){return new BPromise(function(_0x119c8e,_0x230488){if(_0x1569c5){return getUser({'internal':_0x1569c5})[_0x2c13('0xf')](function(_0x4477f0){logger['info'](_0x2c13('0x15'),_0x1569c5,_0x4477f0?_0x2c13('0x16'):'notfound');return _0x119c8e(_0x4477f0);})[_0x2c13('0xb')](function(_0x7711c9){logger[_0x2c13('0x7')](_0x2c13('0x17'),_0x7711c9?util[_0x2c13('0x6')](_0x7711c9,{'showHidden':![],'depth':null}):'');return _0x119c8e(null);});}return _0x119c8e(null);});};exports[_0x2c13('0x18')]=function(_0x54ae7a){return new BPromise(function(_0x1f3a51,_0x60661e){if(_0x54ae7a){return getUser({'interface':_0x54ae7a})[_0x2c13('0xf')](function(_0x4d69cc){logger[_0x2c13('0x5')](_0x2c13('0x19'),_0x54ae7a,_0x4d69cc?_0x2c13('0x16'):'notfound');return _0x1f3a51(_0x4d69cc);})[_0x2c13('0xb')](function(_0x46c176){logger[_0x2c13('0x7')](_0x2c13('0x1a'),_0x46c176?util[_0x2c13('0x6')](_0x46c176,{'showHidden':![],'depth':null}):'');return _0x1f3a51(null);});}return _0x1f3a51(null);});};exports[_0x2c13('0x1b')]=function(_0x1f221f){return new BPromise(function(_0x16e51f,_0x2cc03f){if(_0x1f221f){return getUser({'name':_0x1f221f})[_0x2c13('0xf')](function(_0x300ca5){logger[_0x2c13('0x5')](_0x2c13('0x1c'),_0x1f221f,_0x300ca5?_0x2c13('0x16'):_0x2c13('0x1d'));return _0x16e51f(_0x300ca5);})[_0x2c13('0xb')](function(_0x4fe6e0){logger[_0x2c13('0x7')](_0x2c13('0x1e'),_0x4fe6e0?util['inspect'](_0x4fe6e0,{'showHidden':![],'depth':null}):'');return _0x16e51f(null);});}return _0x16e51f(null);});};exports[_0x2c13('0x1f')]=function(_0x1ce36a){return new BPromise(function(_0x14903c,_0x4e1204){if(_0x1ce36a){return client[_0x2c13('0x8')](_0x2c13('0x20'),{'options':{'raw':!![],'attributes':['id',_0x2c13('0x21'),'type','acw',_0x2c13('0x22')],'where':{'name':_0x1ce36a},'limit':0x1}})[_0x2c13('0xf')](function(_0x127d13){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x1ce36a,_0x127d13?util[_0x2c13('0x6')](_0x127d13,{'showHidden':![],'depth':null}):'');logger['info'](_0x2c13('0x23'),_0x1ce36a,_0x127d13?_0x2c13('0x16'):'notfound');return _0x14903c(_0x127d13['result'][_0x2c13('0x13')]?_0x127d13[_0x2c13('0x12')][0x0]:null);})[_0x2c13('0xb')](function(_0x364ad9){logger[_0x2c13('0x7')](_0x2c13('0x24'),_0x364ad9?util[_0x2c13('0x6')](_0x364ad9,{'showHidden':![],'depth':null}):'');return _0x14903c(null);});}return _0x14903c(null);});};exports[_0x2c13('0x25')]=function(_0x5b8d57,_0x13fa2e){return moment(_0x5b8d57)[_0x2c13('0x26')](_0x13fa2e,_0x2c13('0x27'))[_0x2c13('0x28')](_0x2c13('0x29'));};exports['subtractTime']=function(_0x362431,_0x395cfc){return moment(_0x362431)[_0x2c13('0x2a')](_0x395cfc,_0x2c13('0x27'))[_0x2c13('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2c13('0x2b')]=function(_0x4bb9b7,_0x431fa5){return moment(_0x4bb9b7)['diff'](moment(_0x431fa5),_0x2c13('0x27'));};exports[_0x2c13('0x2c')]=function(_0x54a11e,_0x275cdf){return parseInt(_0x54a11e,0xa)+parseInt(_0x275cdf,0xa);};exports[_0x2c13('0x2d')]=function(){return moment()[_0x2c13('0x28')](_0x2c13('0x29'));};exports['isAfter']=function(_0x2a495f,_0x290499){if(_0x290499){return moment(_0x2a495f)[_0x2c13('0x2e')](_0x290499);}return!![];};exports[_0x2c13('0x2f')]=function(_0x89b555,_0x2939ca){if(_0x2939ca){return moment(_0x89b555)[_0x2c13('0x2f')](_0x2939ca);}else if(_0x89b555){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 2964c96..784a889 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 _0x7f16=['join','client','role','ensureDir','then','catch','user','no-user','timestamp','error','api','auth','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','device','test','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','log','xcally'];(function(_0x221721,_0x4b42be){var _0x484cf2=function(_0x118420){while(--_0x118420){_0x221721['push'](_0x221721['shift']());}};_0x484cf2(++_0x4b42be);}(_0x7f16,0x103));var _0x67f1=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0x7f16[_0x3042c5];return _0x7cd140;};var fs=require(_0x67f1('0x0'));var _=require(_0x67f1('0x1'));var ewinston=require(_0x67f1('0x2'));var path=require(_0x67f1('0x3'));var util=require(_0x67f1('0x4'));var fileLogger=require(_0x67f1('0x5'))[_0x67f1('0x6')];var safeTemplate=require(_0x67f1('0x7'))['safeTemplate'];var maskSensitiveData=require(_0x67f1('0x8'))['maskSensitiveData'];function ClientSideLogger(){function _0x5040e7(_0x5d5976){var _0x2d351e=path['join']('/var',_0x67f1('0x9'),_0x67f1('0xa'));var _0x5aa879=path[_0x67f1('0xb')](_0x67f1('0xc'),_0x5d5976[_0x67f1('0xd')]+'-'+_0x5d5976['name']);return fs[_0x67f1('0xe')](path['join'](_0x2d351e,_0x5aa879))[_0x67f1('0xf')](function(){var _0x551482=fileLogger('client',path['join'](_0x2d351e,_0x5aa879));return _0x551482;})[_0x67f1('0x10')](function(_0x5eabd2){throw _0x5eabd2;});}this[_0x67f1('0x9')]=function(_0x2f8790,_0x54c433,_0x292dd5,_0x3a4d95){return _0x5040e7(_0x2f8790['user'])[_0x67f1('0xf')](function(_0xd8ab6b){var _0x50ca2c=_0xd8ab6b[_0x54c433];return _0x50ca2c;})[_0x67f1('0xf')](function(_0x3ea4a1){var _0x418c1f=_0x2f8790[_0x67f1('0x11')]?_0x2f8790[_0x67f1('0x11')]['id']:_0x67f1('0x12');var _0x54d956=_0x3a4d95['data'];var _0x5ad022=_0x3a4d95[_0x67f1('0x13')];var _0x5a25b0=new Date(Number(_0x5ad022));return _0x3ea4a1(_0x418c1f,_0x5a25b0,_0x292dd5,_0x54d956);})[_0x67f1('0x10')](function(_0x56c91a){fileLogger(_0x67f1('0xc'))[_0x67f1('0x14')](_0x56c91a);});};}function setupLoggers(_0x2541d0){return new Promise(function(_0x4a721c){var _0x4064fe=new ClientSideLogger();var _0x12f8d7=fileLogger(_0x67f1('0x15'));var _0x49e01d=fileLogger(_0x67f1('0x16'));_0x2541d0[_0x67f1('0x17')]('client-side-logger',_0x4064fe);_0x2541d0[_0x67f1('0x18')](ewinston[_0x67f1('0x19')]({'winstonInstance':_0x12f8d7,'meta':![],'statusLevels':!![],'msg':function(_0x5a5a6c,_0x3fd2e6){var _0x3809cd=_0x67f1('0x1a');if(!_[_0x67f1('0x1b')](_0x5a5a6c[_0x67f1('0x1c')])){_0x3809cd+='\x20body=%s';var _0xcacb9a=_0x5a5a6c['body'];maskSensitiveData(_0xcacb9a);}return safeTemplate(util[_0x67f1('0x1d')](_0x3809cd,_0x5a5a6c[_0x67f1('0x1e')],_0x5a5a6c['headers']['x-forwarded-for']?_0x5a5a6c[_0x67f1('0x1f')][_0x67f1('0x20')]:_0x5a5a6c[_0x67f1('0x21')][_0x67f1('0x22')]||_0x5a5a6c['ip'],_0x5a5a6c[_0x67f1('0x23')],_0x3fd2e6[_0x67f1('0x24')],_0x3fd2e6[_0x67f1('0x25')],_0x5a5a6c[_0x67f1('0x11')]?_0x5a5a6c[_0x67f1('0x11')]['id']:null,_0x5a5a6c[_0x67f1('0x11')]?_0x5a5a6c[_0x67f1('0x11')][_0x67f1('0x26')]:null,_0x5a5a6c[_0x67f1('0x11')]?_0x5a5a6c[_0x67f1('0x11')][_0x67f1('0xd')]:null,_0xcacb9a?util[_0x67f1('0x27')](_0xcacb9a,![],null):''));}}));_0x2541d0['use'](ewinston[_0x67f1('0x19')]({'winstonInstance':_0x49e01d,'meta':![],'statusLevels':!![],'msg':function(_0x1c506c,_0x4cb390){var _0x4ea86b=_0x67f1('0x28');if(_0x1c506c[_0x67f1('0x1c')]&&_0x1c506c[_0x67f1('0x1c')]['device']&&_0x1c506c[_0x67f1('0x1c')][_0x67f1('0x29')]){_0x4ea86b=_0x67f1('0x2a');}return util[_0x67f1('0x1d')](_0x4ea86b,_0x1c506c['method'],_0x1c506c[_0x67f1('0x1f')]['x-forwarded-for']?_0x1c506c[_0x67f1('0x1f')][_0x67f1('0x20')]:_0x1c506c[_0x67f1('0x21')][_0x67f1('0x22')]||_0x1c506c['ip'],_0x1c506c['url'],_0x4cb390[_0x67f1('0x24')],_0x4cb390[_0x67f1('0x25')],_0x1c506c['user']?_0x1c506c[_0x67f1('0x11')]['id']:null,_0x1c506c[_0x67f1('0x11')]?_0x1c506c[_0x67f1('0x11')]['name']:null,_0x1c506c[_0x67f1('0x11')]?_0x1c506c[_0x67f1('0x11')]['role']:null,_0x1c506c[_0x67f1('0x1c')]&&_0x1c506c[_0x67f1('0x1c')]['device']?_0x1c506c[_0x67f1('0x1c')][_0x67f1('0x2b')]:'other',_0x1c506c['body']&&_0x1c506c[_0x67f1('0x1c')][_0x67f1('0x29')]?_0x1c506c[_0x67f1('0x1c')][_0x67f1('0x29')]:'',_0x1c506c['body']&&_0x1c506c[_0x67f1('0x1c')]['agent_name']?_0x1c506c[_0x67f1('0x1c')]['agent_name']:'');},'ignoreRoute':function(_0x1215a0){var _0x187cd2=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x187cd2[_0x67f1('0x2c')](_0x1215a0['url']);}}));return _0x4a721c();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0xb193=['use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','headers','x-forwarded-for','remoteAddress','url','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','statusCode','other','agent_name','test','setupLoggers','lodash','express-winston','path','./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData','log','join','client','role','name','ensureDir','then','user','data','timestamp','catch','error','api','auth','set','client-side-logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb193,0x1be));var _0x3b19=function(_0x375126,_0x514a8e){_0x375126=_0x375126-0x0;var _0x1f76bb=_0xb193[_0x375126];return _0x1f76bb;};var fs=require('fs-extra');var _=require(_0x3b19('0x0'));var ewinston=require(_0x3b19('0x1'));var path=require(_0x3b19('0x2'));var util=require('util');var fileLogger=require(_0x3b19('0x3'))[_0x3b19('0x4')];var safeTemplate=require(_0x3b19('0x5'))[_0x3b19('0x6')];var maskSensitiveData=require('./mask-sensitive-data')[_0x3b19('0x7')];function ClientSideLogger(){function _0x52e09e(_0x2e6801){var _0x1e9057=path['join']('/var',_0x3b19('0x8'),'xcally');var _0x30360c=path[_0x3b19('0x9')](_0x3b19('0xa'),_0x2e6801[_0x3b19('0xb')]+'-'+_0x2e6801[_0x3b19('0xc')]);return fs[_0x3b19('0xd')](path['join'](_0x1e9057,_0x30360c))[_0x3b19('0xe')](function(){var _0x34da06=fileLogger(_0x3b19('0xa'),path['join'](_0x1e9057,_0x30360c));return _0x34da06;})['catch'](function(_0xba59b5){throw _0xba59b5;});}this[_0x3b19('0x8')]=function(_0x33988e,_0x4b6a9a,_0x5f44ee,_0x37a058){return _0x52e09e(_0x33988e['user'])[_0x3b19('0xe')](function(_0x533eac){var _0x21d842=_0x533eac[_0x4b6a9a];return _0x21d842;})[_0x3b19('0xe')](function(_0x4d5e){var _0x2d2c89=_0x33988e[_0x3b19('0xf')]?_0x33988e['user']['id']:'no-user';var _0x32e662=_0x37a058[_0x3b19('0x10')];var _0x10f228=_0x37a058[_0x3b19('0x11')];var _0x593b53=new Date(Number(_0x10f228));return _0x4d5e(_0x2d2c89,_0x593b53,_0x5f44ee,_0x32e662);})[_0x3b19('0x12')](function(_0x4b7e2f){fileLogger(_0x3b19('0xa'))[_0x3b19('0x13')](_0x4b7e2f);});};}function setupLoggers(_0x257768){return new Promise(function(_0x7cdecf){var _0x410bda=new ClientSideLogger();var _0x1f57f1=fileLogger(_0x3b19('0x14'));var _0x90a887=fileLogger(_0x3b19('0x15'));_0x257768[_0x3b19('0x16')](_0x3b19('0x17'),_0x410bda);_0x257768[_0x3b19('0x18')](ewinston[_0x3b19('0x19')]({'winstonInstance':_0x1f57f1,'meta':![],'statusLevels':!![],'msg':function(_0x4d019b,_0x4b9dd7){var _0x1761ba=_0x3b19('0x1a');if(!_[_0x3b19('0x1b')](_0x4d019b['body'])){_0x1761ba+=_0x3b19('0x1c');var _0x44c090=_0x4d019b[_0x3b19('0x1d')];maskSensitiveData(_0x44c090);}return safeTemplate(util['format'](_0x1761ba,_0x4d019b['method'],_0x4d019b[_0x3b19('0x1e')][_0x3b19('0x1f')]?_0x4d019b[_0x3b19('0x1e')]['x-forwarded-for']:_0x4d019b['connection'][_0x3b19('0x20')]||_0x4d019b['ip'],_0x4d019b[_0x3b19('0x21')],_0x4b9dd7['statusCode'],_0x4b9dd7[_0x3b19('0x22')],_0x4d019b[_0x3b19('0xf')]?_0x4d019b[_0x3b19('0xf')]['id']:null,_0x4d019b['user']?_0x4d019b[_0x3b19('0xf')][_0x3b19('0xc')]:null,_0x4d019b[_0x3b19('0xf')]?_0x4d019b[_0x3b19('0xf')][_0x3b19('0xb')]:null,_0x44c090?util[_0x3b19('0x23')](_0x44c090,![],null):''));}}));_0x257768[_0x3b19('0x18')](ewinston[_0x3b19('0x19')]({'winstonInstance':_0x90a887,'meta':![],'statusLevels':!![],'msg':function(_0x3da88c,_0x4f32d7){var _0x473b7f=_0x3b19('0x24');if(_0x3da88c[_0x3b19('0x1d')]&&_0x3da88c['body'][_0x3b19('0x25')]&&_0x3da88c[_0x3b19('0x1d')][_0x3b19('0x26')]){_0x473b7f=_0x3b19('0x27');}return util[_0x3b19('0x28')](_0x473b7f,_0x3da88c[_0x3b19('0x29')],_0x3da88c[_0x3b19('0x1e')]['x-forwarded-for']?_0x3da88c['headers'][_0x3b19('0x1f')]:_0x3da88c['connection'][_0x3b19('0x20')]||_0x3da88c['ip'],_0x3da88c['url'],_0x4f32d7[_0x3b19('0x2a')],_0x4f32d7[_0x3b19('0x22')],_0x3da88c[_0x3b19('0xf')]?_0x3da88c[_0x3b19('0xf')]['id']:null,_0x3da88c['user']?_0x3da88c[_0x3b19('0xf')][_0x3b19('0xc')]:null,_0x3da88c[_0x3b19('0xf')]?_0x3da88c[_0x3b19('0xf')]['role']:null,_0x3da88c[_0x3b19('0x1d')]&&_0x3da88c[_0x3b19('0x1d')][_0x3b19('0x25')]?_0x3da88c[_0x3b19('0x1d')][_0x3b19('0x25')]:_0x3b19('0x2b'),_0x3da88c[_0x3b19('0x1d')]&&_0x3da88c[_0x3b19('0x1d')][_0x3b19('0x26')]?_0x3da88c[_0x3b19('0x1d')]['agent_id']:'',_0x3da88c[_0x3b19('0x1d')]&&_0x3da88c[_0x3b19('0x1d')]['agent_name']?_0x3da88c['body'][_0x3b19('0x2c')]:'');},'ignoreRoute':function(_0x238cec){var _0xe8f737=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xe8f737[_0x3b19('0x2d')](_0x238cec[_0x3b19('0x21')]);}}));return _0x7cdecf();});}exports[_0x3b19('0x2e')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index af579f9..1d12e12 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb719=['bold\x20magenta','bold\x20blue','/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','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','white','bold\x20white','bold\x20green','gray'];(function(_0x4d1363,_0x210309){var _0x43f91c=function(_0x214922){while(--_0x214922){_0x4d1363['push'](_0x4d1363['shift']());}};_0x43f91c(++_0x210309);}(_0xb719,0x10b));var _0x9b71=function(_0x558e45,_0x4f5e4f){_0x558e45=_0x558e45-0x0;var _0x3e9075=_0xb719[_0x558e45];return _0x3e9075;};'use strict';var path=require(_0x9b71('0x0'));var util=require(_0x9b71('0x1'));var moment=require(_0x9b71('0x2'));var winston=require('winston');var config=require(_0x9b71('0x3'));var debugLevel=config[_0x9b71('0x4')]?config[_0x9b71('0x4')][_0x9b71('0x5')]():_0x9b71('0x6');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':_0x9b71('0x7'),'error':_0x9b71('0x8'),'warn':'bold\x20yellow','info':_0x9b71('0x9'),'print':_0x9b71('0xa'),'success':_0x9b71('0xb'),'http':_0x9b71('0xc'),'verbose':_0x9b71('0xd'),'debug':_0x9b71('0xe'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x528e07,_0x28b4ea,_0x4c562d){var _0x551104=_0x528e07||_0x9b71('0xf');return path[_0x9b71('0x10')](_0x551104,util[_0x9b71('0x11')](_0x9b71('0x12'),_0x28b4ea,_0x4c562d));}function formatter(_0x24eda9,_0x49705b){_0x49705b[_0x9b71('0x13')]=_0x49705b['message'][_0x9b71('0x14')](/@@{/g,_0x9b71('0x15'))[_0x9b71('0x14')](/}@@/g,_0x9b71('0x16'))[_0x9b71('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x9b71('0x11')](_0x9b71('0x17'),moment()[_0x9b71('0x11')](_0x9b71('0x18')),_0x49705b[_0x9b71('0x19')][_0x9b71('0x1a')](),_0x24eda9,_0x49705b[_0x9b71('0x13')]);}function fileFormat(_0x327c43,_0x4bb672){_0x4bb672[_0x9b71('0x13')]=_0x4bb672[_0x9b71('0x13')][_0x9b71('0x14')](/@@{/g,'{{{')[_0x9b71('0x14')](/}@@/g,_0x9b71('0x16'))[_0x9b71('0x14')](/@{/g,'{{')[_0x9b71('0x14')](/}@/g,'}}');var _0x2bb69a=_0x4bb672['meta']&&Object[_0x9b71('0x1b')](_0x4bb672[_0x9b71('0x1c')])[_0x9b71('0x1d')]?'\x0a\x09'+JSON[_0x9b71('0x1e')](_0x4bb672[_0x9b71('0x1c')]):'';return util[_0x9b71('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0x9b71('0x18')),_0x4bb672[_0x9b71('0x19')]['toUpperCase'](),_0x327c43,_0x4bb672[_0x9b71('0x13')],_0x2bb69a);}function consoleLogger(){var _0x38165f=new winston[(_0x9b71('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x9b71('0x20'))][(_0x9b71('0x21'))]({'level':_0x9b71('0x22'),'json':![],'formatter':function(_0x214646){return formatter('',_0x214646);}})]});return _0x38165f;}function fileLogger(_0x1c0e10,_0x4485dd){var _0x381377=new winston[(_0x9b71('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x9b71('0x20'))][(_0x9b71('0x23'))]({'name':util[_0x9b71('0x11')](_0x9b71('0x24'),_0x1c0e10,_0x9b71('0x25')),'filename':getLogFileName(_0x4485dd,_0x1c0e10,_0x9b71('0x25')),'level':_0x9b71('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4dac92){return fileFormat(_0x1c0e10,_0x4dac92);}}),new winston[(_0x9b71('0x20'))]['File']({'name':util['format']('%s-%s',_0x1c0e10,debugLevel),'filename':getLogFileName(_0x4485dd,_0x1c0e10,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x193077){return fileFormat(_0x1c0e10,_0x193077);}}),new winston['transports'][(_0x9b71('0x21'))]({'level':_0x9b71('0x22'),'json':![],'formatter':function(_0x746eaa){return fileFormat(_0x1c0e10,_0x746eaa);}})]});return _0x381377;}exports[_0x9b71('0x26')]=consoleLogger;exports[_0x9b71('0x27')]=fileLogger; \ No newline at end of file +var _0x8a1d=['white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','stringify','level','Logger','transports','Console','warn','error','File','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','info','redBG\x20white','bold\x20yellow'];(function(_0x53b375,_0x5237c0){var _0xc02f32=function(_0x4ef49b){while(--_0x4ef49b){_0x53b375['push'](_0x53b375['shift']());}};_0xc02f32(++_0x5237c0);}(_0x8a1d,0x93));var _0xd8a1=function(_0x783067,_0xb08721){_0x783067=_0x783067-0x0;var _0x5391a8=_0x8a1d[_0x783067];return _0x5391a8;};'use strict';var path=require(_0xd8a1('0x0'));var util=require(_0xd8a1('0x1'));var moment=require(_0xd8a1('0x2'));var winston=require(_0xd8a1('0x3'));var config=require(_0xd8a1('0x4'));var debugLevel=config[_0xd8a1('0x5')]?config['debugLevel']['toLowerCase']():_0xd8a1('0x6');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':_0xd8a1('0x7'),'error':'red','warn':_0xd8a1('0x8'),'info':_0xd8a1('0x9'),'print':'bold\x20white','success':_0xd8a1('0xa'),'http':'gray','verbose':_0xd8a1('0xb'),'debug':_0xd8a1('0xc'),'silly':_0xd8a1('0xd')};winston[_0xd8a1('0xe')](XC_LOG_COLORS);function getLogFileName(_0x132ffc,_0x5a393c,_0x306c6a){var _0x292854=_0x132ffc||_0xd8a1('0xf');return path[_0xd8a1('0x10')](_0x292854,util[_0xd8a1('0x11')](_0xd8a1('0x12'),_0x5a393c,_0x306c6a));}function formatter(_0x6e1535,_0x1ac166){_0x1ac166[_0xd8a1('0x13')]=_0x1ac166[_0xd8a1('0x13')][_0xd8a1('0x14')](/@@{/g,_0xd8a1('0x15'))[_0xd8a1('0x14')](/}@@/g,_0xd8a1('0x16'))['replace'](/@{/g,'{{')[_0xd8a1('0x14')](/}@/g,'}}');return util['format'](_0xd8a1('0x17'),moment()['format'](_0xd8a1('0x18')),_0x1ac166['level'][_0xd8a1('0x19')](),_0x6e1535,_0x1ac166[_0xd8a1('0x13')]);}function fileFormat(_0x1c828e,_0x3dba6f){_0x3dba6f[_0xd8a1('0x13')]=_0x3dba6f['message'][_0xd8a1('0x14')](/@@{/g,_0xd8a1('0x15'))[_0xd8a1('0x14')](/}@@/g,'}}}')[_0xd8a1('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x2cc35e=_0x3dba6f[_0xd8a1('0x1a')]&&Object[_0xd8a1('0x1b')](_0x3dba6f[_0xd8a1('0x1a')])[_0xd8a1('0x1c')]?'\x0a\x09'+JSON[_0xd8a1('0x1d')](_0x3dba6f[_0xd8a1('0x1a')]):'';return util[_0xd8a1('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0xd8a1('0x18')),_0x3dba6f[_0xd8a1('0x1e')]['toUpperCase'](),_0x1c828e,_0x3dba6f[_0xd8a1('0x13')],_0x2cc35e);}function consoleLogger(){var _0x32636c=new winston[(_0xd8a1('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd8a1('0x20'))][(_0xd8a1('0x21'))]({'level':_0xd8a1('0x22'),'json':![],'formatter':function(_0x3e390e){return formatter('',_0x3e390e);}})]});return _0x32636c;}function fileLogger(_0x17b06a,_0x2e40b8){var _0x52074c=new winston[(_0xd8a1('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd8a1('0x20'))]['File']({'name':util['format']('%s-%s',_0x17b06a,_0xd8a1('0x23')),'filename':getLogFileName(_0x2e40b8,_0x17b06a,_0xd8a1('0x23')),'level':_0xd8a1('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x287a2d){return fileFormat(_0x17b06a,_0x287a2d);}}),new winston[(_0xd8a1('0x20'))][(_0xd8a1('0x24'))]({'name':util['format']('%s-%s',_0x17b06a,debugLevel),'filename':getLogFileName(_0x2e40b8,_0x17b06a,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x989184){return fileFormat(_0x17b06a,_0x989184);}}),new winston['transports'][(_0xd8a1('0x21'))]({'level':_0xd8a1('0x22'),'json':![],'formatter':function(_0x565cd0){return fileFormat(_0x17b06a,_0x565cd0);}})]});return _0x52074c;}exports[_0xd8a1('0x25')]=consoleLogger;exports[_0xd8a1('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 0a71f3b..211ca6b 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(_0x46f73f,_0x2d5f6e){var _0x23ae7d=function(_0x366c44){while(--_0x366c44){_0x46f73f['push'](_0x46f73f['shift']());}};_0x23ae7d(++_0x2d5f6e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x0b0e[_0x58efa6];return _0x5d643c;};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 _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x1967,0x173));var _0x7196=function(_0x2f7610,_0x1c07eb){_0x2f7610=_0x2f7610-0x0;var _0x2d9fc9=_0x1967[_0x2f7610];return _0x2d9fc9;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 377320c..e13d91c 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 _0x13f6=['isArray','map','keys','reduce','lodash','string'];(function(_0x3c8099,_0x3771ea){var _0xefba6d=function(_0x188877){while(--_0x188877){_0x3c8099['push'](_0x3c8099['shift']());}};_0xefba6d(++_0x3771ea);}(_0x13f6,0x124));var _0x613f=function(_0x432a4e,_0x471c14){_0x432a4e=_0x432a4e-0x0;var _0x5a2345=_0x13f6[_0x432a4e];return _0x5a2345;};var _=require(_0x613f('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x1844a4){return _0x1844a4==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0xd04cfd){var _0x13b50a=_0xd04cfd;if(typeof _0xd04cfd===_0x613f('0x1')){_0x13b50a=_0xd04cfd['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x613f('0x2')](_0xd04cfd)){_0x13b50a=_0xd04cfd[_0x613f('0x3')](function(_0x20af2f){return safeTemplate(_0x20af2f);});}else if(_['isPlainObject'](_0xd04cfd)){_0x13b50a=Object[_0x613f('0x4')](_0xd04cfd)[_0x613f('0x5')](function(_0x5618fa,_0x4b546b){_0x5618fa[_0x4b546b]=safeTemplate(_0xd04cfd[_0x4b546b]);return _0x5618fa;},{});}return _0x13b50a;}module['exports']['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x5c00=['replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','string'];(function(_0x5b508f,_0x1a09ea){var _0x15ef72=function(_0x3102c9){while(--_0x3102c9){_0x5b508f['push'](_0x5b508f['shift']());}};_0x15ef72(++_0x1a09ea);}(_0x5c00,0x17e));var _0x05c0=function(_0x5c98cc,_0x58190a){_0x5c98cc=_0x5c98cc-0x0;var _0x164644=_0x5c00[_0x5c98cc];return _0x164644;};var _=require(_0x05c0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x7f1364){return _0x7f1364==='{{'?_0x05c0('0x1'):'\x20}\x20}';}function safeTemplate(_0x1e76da){var _0x5859bc=_0x1e76da;if(typeof _0x1e76da===_0x05c0('0x2')){_0x5859bc=_0x1e76da[_0x05c0('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x05c0('0x4')](_0x1e76da)){_0x5859bc=_0x1e76da[_0x05c0('0x5')](function(_0x565efc){return safeTemplate(_0x565efc);});}else if(_[_0x05c0('0x6')](_0x1e76da)){_0x5859bc=Object[_0x05c0('0x7')](_0x1e76da)[_0x05c0('0x8')](function(_0x27dc10,_0x5b9f09){_0x27dc10[_0x5b9f09]=safeTemplate(_0x1e76da[_0x5b9f09]);return _0x27dc10;},{});}return _0x5859bc;}module[_0x05c0('0x9')][_0x05c0('0xa')]=safeTemplate; \ No newline at end of file